From: Andrea Bianco Date: Sat, 27 Mar 2021 13:35:04 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.23 X-Git-Url: http://repos.xcallymotion.com/base//%22/%22?a=commitdiff_plain;h=3eb4d45cf3dd6ddded3cc3ec6c3f572a300ae6d2;p=motion2.git Built motion from commit (unavailable).|2.5.23 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 79c2b27..1e93cb4 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-03-27T11:06:05.220Z", + "time": "2021-03-27T13:24:42.071Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index e936f97..1db3e86 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-03-27T11:06:05.220Z", + "time": "2021-03-27T13:24:42.071Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/public/assets/plugins/angular-material-form-builder/dist/angular-material-form-builder.css b/public/assets/plugins/angular-material-form-builder/dist/angular-material-form-builder.css new file mode 100644 index 0000000..5da6bb0 --- /dev/null +++ b/public/assets/plugins/angular-material-form-builder/dist/angular-material-form-builder.css @@ -0,0 +1,84 @@ +@import url(https://fonts.googleapis.com/icon?family=Material+Icons); +.main-view .content .builder, +.main-view .content .view, +.main-view .content .json { + border-right: 1px solid #cccccc; + height: 800px; + overflow: auto; +} + +.builder-icon, form-item .form-item-container .md-button, form-item .option-item .md-button { + min-height: 36px; + min-width: 36px; + height: 36px; + width: 36px; + line-height: 0; +} + +form-item .option-item { + min-height: 75px; +} +form-item .option-item .md-button { + line-height: 0; + margin-top: 20px; +} +form-item .option-item .md-button.handle:active, form-item .option-item .md-button.handle:hover { + cursor: move; +} +form-item .form-item-container { + position: relative; + padding-top: 30px; +} +form-item .form-item-container .form-item-actions { + position: absolute; + right: 20px; + top: 0; +} +form-view .formItem-title { + font-size: 18px; +} +form-view .formItem-content { + font-size: 18px; +} +form-view .formItem-help-text { + font-size: 14px; + color: #6c6c6c; +} +form-view .matrix-container { + overflow: auto; +} +form-view .matrix-container .matrix .matrix-row { + border-bottom: 1px solid #4caf50; +} +form-view .matrix-container .matrix .matrix-cell { + text-align: center; + overflow: hidden; +} +form-view .matrix-container .matrix md-radio-button .md-label { + margin-left: 0; + margin-right: 0; +} +form-view .matrix-container .matrix md-radio-button, +form-view .matrix-container .matrix .md-switch-thumb { + margin: 15px 0; +} + +i.material-icons { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} +i.material-icons.medium { + font-size: 36px; +} + +.md-button.upload-button { + padding: 0 16px; + height: 36px; +} +.md-button.upload-button md-icon { + font-size: 16px; +} + +/*# sourceMappingURL=angular-material-form-builder.css.map*/ \ No newline at end of file diff --git a/public/assets/plugins/angular-material-form-builder/dist/angular-material-form-builder.js b/public/assets/plugins/angular-material-form-builder/dist/angular-material-form-builder.js new file mode 100644 index 0000000..5c81fc0 --- /dev/null +++ b/public/assets/plugins/angular-material-form-builder/dist/angular-material-form-builder.js @@ -0,0 +1,2717 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["angular-material-form-builder"] = factory(); + else + root["angular-material-form-builder"] = factory(); +})(self, function() { +return /******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/lib/directives/agreement-item/agreement-item.controller.js": +/*!************************************************************************!*\ + !*** ./src/lib/directives/agreement-item/agreement-item.controller.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "AgreementItemCtrl": () => /* binding */ AgreementItemCtrl +/* harmony export */ }); +AgreementItemCtrl.$inject = ["Utils", "$element"]; + +/** + * @ngInject + * + * @param {import('../../utils/utils.service').Utils} Utils + * @param {JQLite} $element + */ +function AgreementItemCtrl(Utils, $element) { + this.Element = $element; + this.item = Utils.extend(this.item || {}, { + config: { + maxSelections: null + }, + options: [{ + value: '', + selected: false + }] + }); +} + + + +/***/ }), + +/***/ "./src/lib/directives/agreement-item/agreement-item.directive.js": +/*!***********************************************************************!*\ + !*** ./src/lib/directives/agreement-item/agreement-item.directive.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "AgreementItem": () => /* binding */ AgreementItem +/* harmony export */ }); +/* harmony import */ var _agreement_item_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./agreement-item.controller */ "./src/lib/directives/agreement-item/agreement-item.controller.js"); + // import AgreementItemTemplate from './agreement-item.tpl.html' + +/** + * @implements {ng.IDirective} + */ + +class AgreementItem { + /** + * @ngInject + */ + constructor() { + this.restrict = 'E'; + this.scope = { + item: '=' + }; + this.controller = _agreement_item_controller__WEBPACK_IMPORTED_MODULE_0__.AgreementItemCtrl; + this.controllerAs = 'Agreement'; + this.bindToController = true; + } + +} + +AgreementItem.$inject = []; + + +/***/ }), + +/***/ "./src/lib/directives/agreement-item/agreement-view.controller.js": +/*!************************************************************************!*\ + !*** ./src/lib/directives/agreement-item/agreement-view.controller.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "AgreementViewCtrl": () => /* binding */ AgreementViewCtrl +/* harmony export */ }); +class AgreementViewCtrl { + /** + * @ngInject + * @param {ng.IScope} $scope + * @param {import('../../utils/utils.service').Utils} Utils + */ + constructor($scope, Utils) { + this.Scope = $scope; + this.Utils = Utils; + this.formItem = {}; + } + + init() { + this.formItem = this.Utils.extend(this.formItem || {}, { + config: {}, + options: [{ + value: '', + selected: false + }] + }); + this.selectedOptions = this._getSelectedOptions(); + this.disableOptions = false; + this.isValid = true; + + this._updateView(); + + this._updateValidity(); + + if (this.isPreview()) { + this._enableWatchers(); + } + } + + toggleSelectedOption() { + this.selectedOptions = this._getSelectedOptions(); + + this._updateView(); + + this._updateValidity(); + } + + _getSelectedOptions() { + return this.formItem.options.filter(option => { + return option.selected; + }); + } + + _updateView() { + if (!this.formItem.config.maxSelections) { + this.disableOptions = false; + } else if (this.selectedOptions.length === this.formItem.config.maxSelections) { + this.disableOptions = true; + } else { + this.disableOptions = false; + } + } + + _updateValidity() { + if (this.formItem.config.required) { + this.isValid = this.selectedOptions.length > 0; + } else { + this.isValid = true; + } + + this.form.$setValidity('minSelections', this.isValid); + } + + _enableWatchers() { + this.Scope.$watch('AgreementView.formItem.config.required', newVal => { + if (newVal !== undefined) { + this._updateView(); + + this._updateValidity(); + } + }); + } + +} + +AgreementViewCtrl.$inject = ["$scope", "Utils"]; + + +/***/ }), + +/***/ "./src/lib/directives/agreement-item/agreement-view.directive.js": +/*!***********************************************************************!*\ + !*** ./src/lib/directives/agreement-item/agreement-view.directive.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "AgreementView": () => /* binding */ AgreementView +/* harmony export */ }); +/* harmony import */ var _agreement_view_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./agreement-view.controller */ "./src/lib/directives/agreement-item/agreement-view.controller.js"); +/* harmony import */ var _agreement_view_tpl_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./agreement-view.tpl.html */ "./src/lib/directives/agreement-item/agreement-view.tpl.html"); + + + +class AgreementView { + /** + * @ngInject + * @param {ng.ITimeoutService} $timeout + */ + constructor($timeout) { + this.$timeout = $timeout; + this.template = _agreement_view_tpl_html__WEBPACK_IMPORTED_MODULE_1__.default; + this.restrict = 'E'; + this.scope = { + formItem: '=', + isPreview: '&', + form: '=' + }; + this.controller = _agreement_view_controller__WEBPACK_IMPORTED_MODULE_0__.AgreementViewCtrl; + this.controllerAs = 'AgreementView'; + this.bindToController = true; + } + /** + * @see https://docs.angularjs.org/api/ng/service/$compile#-link- + * @param {ng.IScope} scope - scope + * @param {JQLite} element - element + * @param {ng.IAttributes} attrs - attributes + * @param {AgreementViewCtrl} ctrl - this instance controller + * @param {ng.ITranscludeFunction} transcludeFn - transclude function ($transclude) + */ + + + link(scope, element, attrs, ctrl) { + //this timeout is placed here in order to make sure that the creator directive of this view is finished its work + this.$timeout(function () { + ctrl.init(); + }, 50); + } + +} + +AgreementView.$inject = ["$timeout"]; + + +/***/ }), + +/***/ "./src/lib/directives/checkboxes-item/checkboxes-item.controller.js": +/*!**************************************************************************!*\ + !*** ./src/lib/directives/checkboxes-item/checkboxes-item.controller.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "CheckboxesItemCtrl": () => /* binding */ CheckboxesItemCtrl +/* harmony export */ }); +class CheckboxesItemCtrl { + /** + * @ngInject + * + * @param {import('../../utils/utils.service').Utils} Utils + * @param {JQLite} $element + */ + constructor(Utils, $element) { + this.Element = $element; + this.item = Utils.extend(this.item || {}, { + config: { + maxSelections: null + }, + options: [{ + value: '', + selected: false + }] + }); + } + + deleteOption(index) { + this.item.options.splice(index, 1); + } + + addOption() { + this.item.options.push({ + value: '', + selected: false + }); // Focus new element + + setTimeout(() => { + const options = this.Element.find('input'); + const addedOption = options[options.length - 1]; + addedOption.focus(); + }, 0); + } + +} + +CheckboxesItemCtrl.$inject = ["Utils", "$element"]; + + +/***/ }), + +/***/ "./src/lib/directives/checkboxes-item/checkboxes-item.directive.js": +/*!*************************************************************************!*\ + !*** ./src/lib/directives/checkboxes-item/checkboxes-item.directive.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "CheckboxesItem": () => /* binding */ CheckboxesItem +/* harmony export */ }); +/* harmony import */ var _checkboxes_item_tpl_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./checkboxes-item.tpl.html */ "./src/lib/directives/checkboxes-item/checkboxes-item.tpl.html"); +/* harmony import */ var _checkboxes_item_controller__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./checkboxes-item.controller */ "./src/lib/directives/checkboxes-item/checkboxes-item.controller.js"); + + +/** + * @implements {ng.IDirective} + */ + +function CheckboxesItem() { + const directive = { + restrict: 'E', + template: _checkboxes_item_tpl_html__WEBPACK_IMPORTED_MODULE_0__.default, + scope: { + item: '=' + }, + controller: _checkboxes_item_controller__WEBPACK_IMPORTED_MODULE_1__.CheckboxesItemCtrl, + controllerAs: 'Checkboxes', + bindToController: true + }; + return directive; +} + + + +/***/ }), + +/***/ "./src/lib/directives/checkboxes-item/checkboxes-view.controller.js": +/*!**************************************************************************!*\ + !*** ./src/lib/directives/checkboxes-item/checkboxes-view.controller.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "CheckboxesViewCtrl": () => /* binding */ CheckboxesViewCtrl +/* harmony export */ }); +class CheckboxesViewCtrl { + /** + * @ngInject + * @param {ng.IScope} $scope + * @param {import('../../utils/utils.service').Utils} Utils + */ + constructor($scope, Utils) { + this.Scope = $scope; + this.Utils = Utils; + this.formItem = {}; + } + + init() { + this.formItem = this.Utils.extend(this.formItem || {}, { + config: {}, + options: [] + }); + this.selectedOptions = this._getSelectedOptions(); + this.disableOptions = false; + this.isValid = true; + + this._updateView(); + + this._updateValidity(); + + if (this.isPreview()) { + this._enableWatchers(); + } + } + + toggleSelectedOption() { + this.selectedOptions = this._getSelectedOptions(); + + this._updateView(); + + this._updateValidity(); + } + + _getSelectedOptions() { + return this.formItem.options.filter(option => { + return option.selected; + }); + } + + _updateView() { + if (!this.formItem.config.maxSelections) { + this.disableOptions = false; + } else if (this.selectedOptions.length === this.formItem.config.maxSelections) { + this.disableOptions = true; + } else { + this.disableOptions = false; + } + } + + _updateValidity() { + if (this.formItem.config.required) { + this.isValid = this.selectedOptions.length > 0; + } else { + this.isValid = true; + } + + this.form.$setValidity('minSelections', this.isValid); + } + + _enableWatchers() { + this.Scope.$watch('CheckboxesView.formItem.config.required', newVal => { + if (newVal !== undefined) { + this._updateView(); + + this._updateValidity(); + } + }); + } + +} + +CheckboxesViewCtrl.$inject = ["$scope", "Utils"]; + + +/***/ }), + +/***/ "./src/lib/directives/checkboxes-item/checkboxes-view.directive.js": +/*!*************************************************************************!*\ + !*** ./src/lib/directives/checkboxes-item/checkboxes-view.directive.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "CheckboxesView": () => /* binding */ CheckboxesView +/* harmony export */ }); +/* harmony import */ var _checkboxes_view_tpl_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./checkboxes-view.tpl.html */ "./src/lib/directives/checkboxes-item/checkboxes-view.tpl.html"); +/* harmony import */ var _checkboxes_view_controller__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./checkboxes-view.controller */ "./src/lib/directives/checkboxes-item/checkboxes-view.controller.js"); + + +/** + * @implements {ng.IDirective} + */ + +class CheckboxesView { + /** + * @ngInject + * @param {ng.ITimeoutService} $timeout + */ + constructor($timeout) { + this.$timeout = $timeout; + this.restrict = 'E'; + this.template = _checkboxes_view_tpl_html__WEBPACK_IMPORTED_MODULE_0__.default; + this.scope = { + formItem: '=', + isPreview: '&', + form: '=' + }; + this.controller = _checkboxes_view_controller__WEBPACK_IMPORTED_MODULE_1__.CheckboxesViewCtrl; + this.controllerAs = 'CheckboxesView'; + this.bindToController = true; + } + /** + * @see https://docs.angularjs.org/api/ng/service/$compile#-link- + * @param {ng.IScope} scope - scope + * @param {JQLite} element - element + * @param {ng.IAttributes} attrs - attributes + * @param {CheckboxesViewCtrl} ctrl - this instance controller + * @param {ng.ITranscludeFunction} transcludeFn - transclude function ($transclude) + */ + + + link(scope, element, attrs, ctrl) { + //this timeout is placed here in order to make sure that the creator directive of this view is finished its work + this.$timeout(function () { + ctrl.init(); + }, 50); + } + +} + +CheckboxesView.$inject = ["$timeout"]; + + +/***/ }), + +/***/ "./src/lib/directives/form-item/form-item.controller.js": +/*!**************************************************************!*\ + !*** ./src/lib/directives/form-item/form-item.controller.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "FormItemCtrl": () => /* binding */ FormItemCtrl +/* harmony export */ }); +const DEFAULT_TITLE = { + upload: 'Attachment', + agreement: 'Agreement', + input: 'Field', + chooseFromList: 'Select', + label: 'Label', + multipleChoices: 'Choice', + matrix: 'Matrix', + checkboxes: 'Options', + textarea: 'Text' +}; + +class FormItemCtrl { + /** + * @ngInject + * @param {ng.IScope} $scope + * @param {ng.IAttributes} $attrs + * @param {import('../../utils/utils.service').Utils} Utils + */ + constructor($scope, $attrs, Utils) { + this.Attrs = $attrs; + this.Utils = Utils; + this.templates = { + upload: '', + agreement: '', + input: '', + chooseFromList: '', + label: '', + multipleChoices: '', + matrix: '', + checkboxes: '', + textarea: '' + }; + this.item = {}; + this.scope = $scope; + } + + init() { + this.item = this.Utils.extend(this.item || {}, { + type: this.Attrs.type, + props: { + title: DEFAULT_TITLE[this.Attrs.type], + helpText: '' + }, + config: { + required: false + } + }); + } + + deleteClicked() { + this.onDelete({ + item: this.item, + index: this.index() + }); + } + /** + * + * @param {string} type + */ + + + _getItemTemplate(type) { + const prefix = '' + '
' + '
' + ' ' + 'delete' + '' + ' ' + 'arrow_drop_up' + '' + ' ' + 'arrow_drop_down' + '' + '
' + '' + '' + '' + '' + '' + '' + '' + ''; + const suffix = '' + '' + 'Required field' + '' + '
'; + return prefix + this.templates[type] + suffix; + } + +} + +FormItemCtrl.$inject = ["$scope", "$attrs", "Utils"]; + + +/***/ }), + +/***/ "./src/lib/directives/form-item/form-item.directive.js": +/*!*************************************************************!*\ + !*** ./src/lib/directives/form-item/form-item.directive.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "FormItem": () => /* binding */ FormItem +/* harmony export */ }); +/* harmony import */ var _form_item_tpl_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./form-item.tpl.html */ "./src/lib/directives/form-item/form-item.tpl.html"); +/* harmony import */ var _form_item_controller__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./form-item.controller */ "./src/lib/directives/form-item/form-item.controller.js"); + + +/** + * @implements {ng.IDirective} + */ + +class FormItem { + /** + * @ngInject + * @param {ng.ICompileService} $compile + */ + constructor($compile) { + this.$compile = $compile; + this.restrict = 'E'; + this.scope = { + item: '=', + onDelete: '&', + onUp: '&', + onDown: '&', + index: '&' + }; + this.controller = _form_item_controller__WEBPACK_IMPORTED_MODULE_1__.FormItemCtrl; + this.controllerAs = 'FormItem'; + this.bindToController = true; + this.template = _form_item_tpl_html__WEBPACK_IMPORTED_MODULE_0__.default; + } + /** + * @see https://docs.angularjs.org/api/ng/service/$compile#-link- + * @param {ng.IScope} scope - scope + * @param {JQLite} element - element + * @param {ng.IAttributes} attrs - attributes + * @param {FormItemCtrl} ctrl - this instance controller + * @param {ng.ITranscludeFunction} transcludeFn - transclude function ($transclude) + */ + + + link(scope, element, attrs, ctrl) { + const template = ctrl._getItemTemplate(attrs.type); + + const el = this.$compile(template)(scope); // element.append(el) + // if done like above adds twice + // element.append(this.$compile(template)(scope)) + + ctrl.init(); + return el; + } + +} + +FormItem.$inject = ["$compile"]; + + +/***/ }), + +/***/ "./src/lib/directives/form-items-container/form-items-container.controller.js": +/*!************************************************************************************!*\ + !*** ./src/lib/directives/form-items-container/form-items-container.controller.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "FormItemsContainerCtrl": () => /* binding */ FormItemsContainerCtrl +/* harmony export */ }); +class FormItemsContainerCtrl { + /** + * @ngInject + */ + constructor() { + /** + * @type {import('../../main/main.controller').FormConfig} + */ + this.form = { + items: [] + }; + } + /** + * + * @param {import('../../main/main.controller').Item} item + * @param {number} index + */ + + + delete(item, index) { + this.form.items.splice(index, 1); + } + /** + * + * @param {import('../../main/main.controller').Item} item + * @param {number} index + */ + + + up(item, index) { + if (index !== 0) { + const prevItem = this.form.items[index - 1]; + this.form.items[index] = prevItem; + this.form.items[index - 1] = item; + } + } + /** + * + * @param {import('../../main/main.controller').Item} item + * @param {number} index + */ + + + down(item, index) { + if (index !== this.form.items.length - 1) { + const nextItem = this.form.items[index + 1]; + this.form.items[index] = nextItem; + this.form.items[index + 1] = item; + } + } + +} + +FormItemsContainerCtrl.$inject = []; + + +/***/ }), + +/***/ "./src/lib/directives/form-items-container/form-items-container.directive.js": +/*!***********************************************************************************!*\ + !*** ./src/lib/directives/form-items-container/form-items-container.directive.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "FormItemsContainer": () => /* binding */ FormItemsContainer +/* harmony export */ }); +/* harmony import */ var _form_items_container_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./form-items-container.controller */ "./src/lib/directives/form-items-container/form-items-container.controller.js"); +/* harmony import */ var _form_items_container_tpl_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./form-items-container.tpl.html */ "./src/lib/directives/form-items-container/form-items-container.tpl.html"); + + +/** + * @implements {ng.IDirective} + */ + +class FormItemsContainer { + /** + * @ngInject + */ + constructor() { + this.restrict = 'E'; + this.scope = { + form: '=' + }; + this.template = _form_items_container_tpl_html__WEBPACK_IMPORTED_MODULE_1__.default; + this.controller = _form_items_container_controller__WEBPACK_IMPORTED_MODULE_0__.FormItemsContainerCtrl; + this.controllerAs = 'container'; + this.bindToController = true; + } + +} + +FormItemsContainer.$inject = []; + + +/***/ }), + +/***/ "./src/lib/directives/form-view/form-view.controller.js": +/*!**************************************************************!*\ + !*** ./src/lib/directives/form-view/form-view.controller.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "FormViewCtrl": () => /* binding */ FormViewCtrl +/* harmony export */ }); +class FormViewCtrl { + /** + * @ngInject + * @param {ng.IScù} $scope + */ + constructor($scope) { + this.Scope = $scope; + } + + init() {} + +} + +FormViewCtrl.$inject = ["$scope"]; + + +/***/ }), + +/***/ "./src/lib/directives/form-view/form-view.directive.js": +/*!*************************************************************!*\ + !*** ./src/lib/directives/form-view/form-view.directive.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "FormView": () => /* binding */ FormView +/* harmony export */ }); +/* harmony import */ var _form_view_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./form-view.controller */ "./src/lib/directives/form-view/form-view.controller.js"); +/* harmony import */ var _form_view_tpl_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./form-view.tpl.html */ "./src/lib/directives/form-view/form-view.tpl.html"); + + +/** + * @implements {ng.IDirective} + */ + +class FormView { + /** + * @ngInject + */ + constructor() { + this.restrict = 'E'; + this.template = _form_view_tpl_html__WEBPACK_IMPORTED_MODULE_1__.default; + this.scope = { + form: '=' + }; + this.controller = _form_view_controller__WEBPACK_IMPORTED_MODULE_0__.FormViewCtrl; + this.controllerAs = 'FormView'; + this.bindToController = true; + } + /** + * @see https://docs.angularjs.org/api/ng/service/$compile#-link- + * @param {ng.IScope} scope - scope + * @param {JQLite} element - element + * @param {ng.IAttributes} attrs - attributes + * @param {FormViewCtrl} ctrl - this instance controller + * @param {ng.ITranscludeFunction} transcludeFn - transclude function ($transclude) + */ + + + link(scope, element, attrs, ctrl) { + ctrl.init(); + } + +} + +FormView.$inject = []; + + +/***/ }), + +/***/ "./src/lib/directives/input-item/input-item.controller.js": +/*!****************************************************************!*\ + !*** ./src/lib/directives/input-item/input-item.controller.js ***! + \****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "InputItemCtrl": () => /* binding */ InputItemCtrl +/* harmony export */ }); +class InputItemCtrl { + /** + * @ngInject + * @param {import('../../utils/utils.service').Utils} Utils + * @param {JQLite} $element + */ + constructor(Utils, $element) { + this.Element = $element; + this.item = Utils.extend(this.item || {}, { + config: { + type: 'text' + } + }); + } + +} + +InputItemCtrl.$inject = ["Utils", "$element"]; + + +/***/ }), + +/***/ "./src/lib/directives/input-item/input-item.directive.js": +/*!***************************************************************!*\ + !*** ./src/lib/directives/input-item/input-item.directive.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "InputItem": () => /* binding */ InputItem +/* harmony export */ }); +/* harmony import */ var _input_item_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./input-item.controller */ "./src/lib/directives/input-item/input-item.controller.js"); +/* harmony import */ var _input_item_tpl_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./input-item.tpl.html */ "./src/lib/directives/input-item/input-item.tpl.html"); + + +/** + * @implements {ng.IDirective} + */ + +class InputItem { + /** + * @ngInject + */ + constructor() { + this.restrict = 'E'; + this.template = _input_item_tpl_html__WEBPACK_IMPORTED_MODULE_1__.default; + this.scope = { + item: '=' + }; + this.controller = _input_item_controller__WEBPACK_IMPORTED_MODULE_0__.InputItemCtrl; + this.controllerAs = 'Input'; + this.bindToController = true; + } + +} + +InputItem.$inject = []; + + +/***/ }), + +/***/ "./src/lib/directives/input-item/input-view.controller.js": +/*!****************************************************************!*\ + !*** ./src/lib/directives/input-item/input-view.controller.js ***! + \****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "InputViewCtrl": () => /* binding */ InputViewCtrl +/* harmony export */ }); +class InputViewCtrl { + /** + * @ngInject + * @param {import('../../utils/utils.service').Utils} Utils + */ + constructor(Utils) { + this.Utils = Utils; + this.formItem = {}; + } + + init() { + this.Utils.extend(this.formItem, { + config: {} + }); + } + +} + +InputViewCtrl.$inject = ["Utils"]; + + +/***/ }), + +/***/ "./src/lib/directives/input-item/input-view.directive.js": +/*!***************************************************************!*\ + !*** ./src/lib/directives/input-item/input-view.directive.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "InputView": () => /* binding */ InputView +/* harmony export */ }); +/* harmony import */ var _input_view_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./input-view.controller */ "./src/lib/directives/input-item/input-view.controller.js"); +/* harmony import */ var _input_view_tpl_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./input-view.tpl.html */ "./src/lib/directives/input-item/input-view.tpl.html"); + + +/** + * @implements {ng.IDirective} + */ + +class InputView { + /** + * @ngInject + * @param {ng.ITimeoutService} $timeout + */ + constructor($timeout) { + this.$timeout = $timeout; + this.restrict = 'E'; + this.template = _input_view_tpl_html__WEBPACK_IMPORTED_MODULE_1__.default; + this.scope = { + formItem: '=', + form: '=' + }; + this.controller = _input_view_controller__WEBPACK_IMPORTED_MODULE_0__.InputViewCtrl; + this.controllerAs = 'InputView'; + this.bindToController = true; + } + /** + * @see https://docs.angularjs.org/api/ng/service/$compile#-link- + * @param {ng.IScope} scope - scope + * @param {JQLite} element - element + * @param {ng.IAttributes} attrs - attributes + * @param {FormItemCtrl} ctrl - this instance controller + * @param {ng.ITranscludeFunction} transcludeFn - transclude function ($transclude) + */ + + + link(scope, elem, attrs, ctrl) { + //this timeout is placed here in order to make sure that the creator directive of this view is finished its work + this.$timeout(function () { + ctrl.init(); + }, 50); + } + +} + +InputView.$inject = ["$timeout"]; + + +/***/ }), + +/***/ "./src/lib/directives/label-item/label-item.controller.js": +/*!****************************************************************!*\ + !*** ./src/lib/directives/label-item/label-item.controller.js ***! + \****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "LabelItemCtrl": () => /* binding */ LabelItemCtrl +/* harmony export */ }); +class LabelItemCtrl { + /** + * @ngInject + * @param {JQLite} $element + */ + constructor($element) { + this.Element = $element; + } + +} + +LabelItemCtrl.$inject = ["$element"]; + + +/***/ }), + +/***/ "./src/lib/directives/label-item/label-item.directive.js": +/*!***************************************************************!*\ + !*** ./src/lib/directives/label-item/label-item.directive.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "LabelItem": () => /* binding */ LabelItem +/* harmony export */ }); +/* harmony import */ var _label_item_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./label-item.controller */ "./src/lib/directives/label-item/label-item.controller.js"); +/* harmony import */ var _label_item_tpl_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./label-item.tpl.html */ "./src/lib/directives/label-item/label-item.tpl.html"); + + +/** + * @implements {ng.IDirective} + */ + +class LabelItem { + constructor() { + this.restrict = 'E'; + this.template = _label_item_tpl_html__WEBPACK_IMPORTED_MODULE_1__.default; + this.scope = { + item: '=' + }; + this.controller = _label_item_controller__WEBPACK_IMPORTED_MODULE_0__.LabelItemCtrl; + this.controllerAs = 'Label'; + this.bindToController = true; + } + +} + + + +/***/ }), + +/***/ "./src/lib/directives/label-item/label-view.controller.js": +/*!****************************************************************!*\ + !*** ./src/lib/directives/label-item/label-view.controller.js ***! + \****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "LabelViewCtrl": () => /* binding */ LabelViewCtrl +/* harmony export */ }); +class LabelViewCtrl { + /** + * @ngInject + * @param {import('../../utils/utils.service').Utils} Utils + */ + constructor(Utils) { + this.Utils = Utils; + } + + init() { + this.Utils.extend(this.formItem, {}); + } + +} + +LabelViewCtrl.$inject = ["Utils"]; + + +/***/ }), + +/***/ "./src/lib/directives/label-item/label-view.directive.js": +/*!***************************************************************!*\ + !*** ./src/lib/directives/label-item/label-view.directive.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "LabelView": () => /* binding */ LabelView +/* harmony export */ }); +/* harmony import */ var _label_view_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./label-view.controller */ "./src/lib/directives/label-item/label-view.controller.js"); +/* harmony import */ var _label_view_tpl_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./label-view.tpl.html */ "./src/lib/directives/label-item/label-view.tpl.html"); + + +/** + * @implements {ng.IDirective} + */ + +class LabelView { + /** + * @ngInject + * @param {ng.ITimeoutService} $timeout + */ + constructor($timeout) { + this.$timeout = $timeout; + this.restrict = 'E'; + this.template = _label_view_tpl_html__WEBPACK_IMPORTED_MODULE_1__.default; + this.scope = { + formItem: '=', + form: '=' + }; + this.controller = _label_view_controller__WEBPACK_IMPORTED_MODULE_0__.LabelViewCtrl; + this.controllerAs = 'LabelView'; + this.bindToController = true; + } + /** + * @see https://docs.angularjs.org/api/ng/service/$compile#-link- + * @param {ng.IScope} scope - scope + * @param {JQLite} element - element + * @param {ng.IAttributes} attrs - attributes + * @param {LabelViewCtrl} ctrl - this instance controller + * @param {ng.ITranscludeFunction} transcludeFn - transclude function ($transclude) + */ + + + link(scope, elem, attrs, ctrl) { + //this timeout is placed here in order to make sure that the creator directive of this view is finished its work + this.$timeout(function () { + ctrl.init(); + }, 50); + } + +} + +LabelView.$inject = ["$timeout"]; + + +/***/ }), + +/***/ "./src/lib/directives/matrix-item/matrix-item.controller.js": +/*!******************************************************************!*\ + !*** ./src/lib/directives/matrix-item/matrix-item.controller.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "MatrixItemCtrl": () => /* binding */ MatrixItemCtrl +/* harmony export */ }); +class MatrixItemCtrl { + /** + * @ngInject + * @param {import('../../utils/utils.service').Utils} Utils + * @param {ng.IDocumentService} $document + */ + constructor(Utils, $document) { + this.RowContainer = angular.element($document[0].querySelector('.rowContainer')); + this.ColumnContainer = angular.element($document[0].querySelector('.columnContainer')); + this.item = Utils.extend(this.item || {}, { + config: { + rows: [{ + value: '' + }], + columns: [{ + value: '' + }] + } + }); + } + /** + * + * @param {number} index + */ + + + deleteRow(index) { + this.item.config.rows.splice(index, 1); + } + + addRow() { + this.item.config.rows.push({ + value: '' + }); + setTimeout(function () { + const options = this.RowContainer.find('input'); + const addedOption = options[options.length - 1]; + addedOption.focus(); + }.bind(this), 0); + } + /** + * + * @param {number} index + */ + + + deleteColumn(index) { + this.item.config.columns.splice(index, 1); + } + + addColumn() { + this.item.config.columns.push({ + value: '' + }); + setTimeout(() => { + const options = this.ColumnContainer.find('input'); + const addedOption = options[options.length - 1]; + addedOption.focus(); + }, 0); + } + +} + +MatrixItemCtrl.$inject = ["Utils", "$document"]; + + +/***/ }), + +/***/ "./src/lib/directives/matrix-item/matrix-item.directive.js": +/*!*****************************************************************!*\ + !*** ./src/lib/directives/matrix-item/matrix-item.directive.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "MatrixItem": () => /* binding */ MatrixItem +/* harmony export */ }); +/* harmony import */ var _matrix_item_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./matrix-item.controller */ "./src/lib/directives/matrix-item/matrix-item.controller.js"); +/* harmony import */ var _matrix_item_tpl_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./matrix-item.tpl.html */ "./src/lib/directives/matrix-item/matrix-item.tpl.html"); + + +/** + * @implements {ng.IDirective} + */ + +class MatrixItem { + /** + * @ngInject + */ + constructor() { + this.restrict = 'E'; + this.template = _matrix_item_tpl_html__WEBPACK_IMPORTED_MODULE_1__.default; + this.scope = { + item: '=' + }; + this.controller = _matrix_item_controller__WEBPACK_IMPORTED_MODULE_0__.MatrixItemCtrl; + this.controllerAs = 'Matrix'; + this.bindToController = true; + } + +} + +MatrixItem.$inject = []; + + +/***/ }), + +/***/ "./src/lib/directives/matrix-item/matrix-view.controller.js": +/*!******************************************************************!*\ + !*** ./src/lib/directives/matrix-item/matrix-view.controller.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "MatrixViewCtrl": () => /* binding */ MatrixViewCtrl +/* harmony export */ }); +class MatrixViewCtrl { + /** + * @ngInject + * @param {ng.IScope} $scope + * @param {import('../../utils/utils.service').Utils} Utils + */ + constructor($scope, Utils) { + this.Scope = $scope; + this.Utils = Utils; + this.isValid = true; + this.formItem = {}; + } + + init() { + this.formItem = this.Utils.extend(this.formItem, { + config: { + rows: [], + columns: [] + } + }); + + this._updateValidity(); + + if (this.isPreview()) { + this._enableWatchers(); + } + } + + _updateValidity() { + let valid = true; + + if (this.formItem.config.required) { + valid = !this.formItem.config.rows.some(row => typeof row['selected'] === 'undefined'); // for (let i = 0; i < this.formItem.config.rows.length; i++) { + // if (typeof this.formItem.config.rows[i]['selected'] === 'undefined') { + // valid = false + // break + // } + // } + } + + this.isValid = valid; + this.form.$setValidity('required', this.isValid); + } + + _enableWatchers() { + this.Scope.$watchGroup(['MatrixView.formItem.config.required', 'MatrixView.formItem.config.rows.length'], newVal => { + if (newVal !== undefined) { + this._updateValidity(); + } + }); + } + +} + +MatrixViewCtrl.$inject = ["$scope", "Utils"]; + + +/***/ }), + +/***/ "./src/lib/directives/matrix-item/matrix-view.directive.js": +/*!*****************************************************************!*\ + !*** ./src/lib/directives/matrix-item/matrix-view.directive.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "MatrixView": () => /* binding */ MatrixView +/* harmony export */ }); +/* harmony import */ var _matrix_view_tpl_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./matrix-view.tpl.html */ "./src/lib/directives/matrix-item/matrix-view.tpl.html"); +/* harmony import */ var _matrix_view_controller__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./matrix-view.controller */ "./src/lib/directives/matrix-item/matrix-view.controller.js"); + + +/** + * @implements {ng.IDirective} + */ + +class MatrixView { + /** + * @ngInject + * @param {ng.ITimeoutService} $timeout + */ + constructor($timeout) { + this.$timeout = $timeout; + this.restrict = 'E'; + this.template = _matrix_view_tpl_html__WEBPACK_IMPORTED_MODULE_0__.default; + this.scope = { + formItem: '=', + isPreview: '&', + form: '=' + }; + this.controller = _matrix_view_controller__WEBPACK_IMPORTED_MODULE_1__.MatrixViewCtrl; + this.controllerAs = 'MatrixView'; + this.bindToController = true; + } + /** + * @see https://docs.angularjs.org/api/ng/service/$compile#-link- + * @param {ng.IScope} scope - scope + * @param {JQLite} element - element + * @param {ng.IAttributes} attrs - attributes + * @param {MatrixViewCtrl} ctrl - this instance controller + * @param {ng.ITranscludeFunction} transcludeFn - transclude function ($transclude) + */ + + + link(scope, elem, attrs, ctrl) { + //this timeout is placed here in order to make sure that the creator directive of this view is finished its work + this.$timeout(function () { + ctrl.init(); + }, 50); + } + +} + +MatrixView.$inject = ["$timeout"]; + + +/***/ }), + +/***/ "./src/lib/directives/radio-button-item/radio-button-item.controller.js": +/*!******************************************************************************!*\ + !*** ./src/lib/directives/radio-button-item/radio-button-item.controller.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "RadioButtonItemCtrl": () => /* binding */ RadioButtonItemCtrl +/* harmony export */ }); +class RadioButtonItemCtrl { + /** + * @ngInject + * @param {import('../../utils/utils.service').Utils} Utils + * @param {JQLite} $element + */ + constructor(Utils, $element) { + this.Element = $element; + this.item = Utils.extend(this.item || {}, { + config: {}, + options: [{ + value: '' + }] + }); + } + + deleteOption(index) { + this.item.options.splice(index, 1); + } + + addOption() { + this.item.options.push({ + value: '' + }); + setTimeout(() => { + const options = this.Element.find('input'); + const addedOption = options[options.length - 1]; + addedOption.focus(); + }, 0); + } + +} + +RadioButtonItemCtrl.$inject = ["Utils", "$element"]; + + +/***/ }), + +/***/ "./src/lib/directives/radio-button-item/radio-button-item.directive.js": +/*!*****************************************************************************!*\ + !*** ./src/lib/directives/radio-button-item/radio-button-item.directive.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "RadioButtonItem": () => /* binding */ RadioButtonItem +/* harmony export */ }); +/* harmony import */ var _radio_button_item_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./radio-button-item.controller */ "./src/lib/directives/radio-button-item/radio-button-item.controller.js"); +/* harmony import */ var _radio_button_item_tpl_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./radio-button-item.tpl.html */ "./src/lib/directives/radio-button-item/radio-button-item.tpl.html"); + + +/** + * @implements {ng.IDirective} + */ + +class RadioButtonItem { + /** + * @ngInject + */ + constructor() { + this.restrict = 'E'; + this.template = _radio_button_item_tpl_html__WEBPACK_IMPORTED_MODULE_1__.default; + this.scope = { + item: '=' + }; + this.controller = _radio_button_item_controller__WEBPACK_IMPORTED_MODULE_0__.RadioButtonItemCtrl; + this.controllerAs = 'RadioButton'; + this.bindToController = true; + } + +} + +RadioButtonItem.$inject = []; + + +/***/ }), + +/***/ "./src/lib/directives/radio-button-item/radio-button-view.controller.js": +/*!******************************************************************************!*\ + !*** ./src/lib/directives/radio-button-item/radio-button-view.controller.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "RadioButtonViewCtrl": () => /* binding */ RadioButtonViewCtrl +/* harmony export */ }); +class RadioButtonViewCtrl { + /** + * @ngInject + * @param {import('../../utils/utils.service').Utils} Utils + */ + constructor(Utils) { + this.Utils = Utils; + this.formItem = {}; + } + + init() { + this.formItem = this.Utils.extend(this.formItem, { + config: {}, + options: [] + }); + } + +} + +RadioButtonViewCtrl.$inject = ["Utils"]; + + +/***/ }), + +/***/ "./src/lib/directives/radio-button-item/radio-button-view.directive.js": +/*!*****************************************************************************!*\ + !*** ./src/lib/directives/radio-button-item/radio-button-view.directive.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "RadioButtonView": () => /* binding */ RadioButtonView +/* harmony export */ }); +/* harmony import */ var _radio_button_view_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./radio-button-view.controller */ "./src/lib/directives/radio-button-item/radio-button-view.controller.js"); +/* harmony import */ var _radio_button_view_tpl_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./radio-button-view.tpl.html */ "./src/lib/directives/radio-button-item/radio-button-view.tpl.html"); + + + +class RadioButtonView { + /** + * @ngInject + * @param {ng.ITimeoutService} $timeout + */ + constructor($timeout) { + this.$timeout = $timeout; + this.restrict = 'E'; + this.template = _radio_button_view_tpl_html__WEBPACK_IMPORTED_MODULE_1__.default; + this.scope = { + formItem: '=', + isPreview: '&', + form: '=' + }; + this.controller = _radio_button_view_controller__WEBPACK_IMPORTED_MODULE_0__.RadioButtonViewCtrl; + this.controllerAs = 'RadioButtonView'; + this.bindToController = true; + } + /** + * @see https://docs.angularjs.org/api/ng/service/$compile#-link- + * @param {ng.IScope} scope - scope + * @param {JQLite} element - element + * @param {ng.IAttributes} attrs - attributes + * @param {RadioButtonViewCtrl} ctrl - this instance controller + * @param {ng.ITranscludeFunction} transcludeFn - transclude function ($transclude) + */ + + + link(scope, elem, attrs, ctrl) { + //this timeout is placed here in order to make sure that the creator directive of this view is finished its work + this.$timeout(function () { + ctrl.init(); + }, 50); + } + +} + +RadioButtonView.$inject = ["$timeout"]; + + +/***/ }), + +/***/ "./src/lib/directives/select-item/select-item.controller.js": +/*!******************************************************************!*\ + !*** ./src/lib/directives/select-item/select-item.controller.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "SelectItemCtrl": () => /* binding */ SelectItemCtrl +/* harmony export */ }); +class SelectItemCtrl { + /** + * @ngInject + * @param {import('../../utils/utils.service').Utils} Utils + * @param {JQLite} $element + */ + constructor(Utils, $element) { + this.Element = $element; + this.item = Utils.extend(this.item || {}, { + config: {}, + options: [{ + value: '' + }] + }); + } + /** + * + * @param {number} index + */ + + + deleteOption(index) { + this.item.options.splice(index, 1); + } + + addOption() { + this.item.options.push({ + value: '' + }); + setTimeout(() => { + const options = this.Element.find('input'); + const addedOption = options[options.length - 1]; + addedOption.focus(); + }, 0); + } + +} + +SelectItemCtrl.$inject = ["Utils", "$element"]; + + +/***/ }), + +/***/ "./src/lib/directives/select-item/select-item.directive.js": +/*!*****************************************************************!*\ + !*** ./src/lib/directives/select-item/select-item.directive.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "SelectItem": () => /* binding */ SelectItem +/* harmony export */ }); +/* harmony import */ var _select_item_tpl_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./select-item.tpl.html */ "./src/lib/directives/select-item/select-item.tpl.html"); +/* harmony import */ var _select_item_controller__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./select-item.controller */ "./src/lib/directives/select-item/select-item.controller.js"); + + +/** + * @implements {ng.IDirective} + */ + +class SelectItem { + /** + * @ngInject + */ + constructor() { + this.restrict = 'E'; + this.template = _select_item_tpl_html__WEBPACK_IMPORTED_MODULE_0__.default; + this.scope = { + item: '=' + }; + this.controller = _select_item_controller__WEBPACK_IMPORTED_MODULE_1__.SelectItemCtrl; + this.controllerAs = 'Select'; + this.bindToController = true; + } + +} + +SelectItem.$inject = []; + + +/***/ }), + +/***/ "./src/lib/directives/select-item/select-view.controller.js": +/*!******************************************************************!*\ + !*** ./src/lib/directives/select-item/select-view.controller.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "SelectViewCtrl": () => /* binding */ SelectViewCtrl +/* harmony export */ }); +class SelectViewCtrl { + /** + * @ngInject + * @param {import('../../utils/utils.service').Utils} Utils + */ + constructor(Utils) { + this.Utils = Utils; + this.formItem = {}; + } + + init() { + this.formItem = this.Utils.extend(this.formItem, { + config: {}, + options: [] + }); + } + +} + +SelectViewCtrl.$inject = ["Utils"]; + + +/***/ }), + +/***/ "./src/lib/directives/select-item/select-view.directive.js": +/*!*****************************************************************!*\ + !*** ./src/lib/directives/select-item/select-view.directive.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "SelectView": () => /* binding */ SelectView +/* harmony export */ }); +/* harmony import */ var _select_view_tpl_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./select-view.tpl.html */ "./src/lib/directives/select-item/select-view.tpl.html"); +/* harmony import */ var _select_view_controller__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./select-view.controller */ "./src/lib/directives/select-item/select-view.controller.js"); + + +/** + * @implements {ng.IDirective} + */ + +class SelectView { + /** + * @ngInject + * @param {ng.ITimeoutService} $timeout + */ + constructor($timeout) { + this.$timeout = $timeout; + this.restrict = 'E'; + this.template = _select_view_tpl_html__WEBPACK_IMPORTED_MODULE_0__.default; + this.scope = { + formItem: '=', + isPreview: '&', + form: '=' + }; + this.controller = _select_view_controller__WEBPACK_IMPORTED_MODULE_1__.SelectViewCtrl; + this.controllerAs = 'SelectView'; + this.bindToController = true; + } + /** + * @see https://docs.angularjs.org/api/ng/service/$compile#-link- + * @param {ng.IScope} scope - scope + * @param {JQLite} element - element + * @param {ng.IAttributes} attrs - attributes + * @param {SelectViewCtrl} ctrl - this instance controller + * @param {ng.ITranscludeFunction} transcludeFn - transclude function ($transclude) + */ + + + link(scope, elem, attrs, ctrl) { + //this timeout is placed here in order to make sure that the creator directive of this view is finished its work + this.$timeout(function () { + ctrl.init(); + }, 50); + } + +} + +SelectView.$inject = ["$timeout"]; + + +/***/ }), + +/***/ "./src/lib/directives/textarea-item/textarea-item.controller.js": +/*!**********************************************************************!*\ + !*** ./src/lib/directives/textarea-item/textarea-item.controller.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TextareaItemCtrl": () => /* binding */ TextareaItemCtrl +/* harmony export */ }); +class TextareaItemCtrl { + /** + * @ngInject + * @param {import('../../utils/utils.service').Utils} Utils + * @param {JQLite} $element + */ + constructor(Utils, $element) { + this.Element = $element; + this.item = Utils.extend(this.item || {}, { + config: {} + }); + } + +} + +TextareaItemCtrl.$inject = ["Utils", "$element"]; + + +/***/ }), + +/***/ "./src/lib/directives/textarea-item/textarea-item.directive.js": +/*!*********************************************************************!*\ + !*** ./src/lib/directives/textarea-item/textarea-item.directive.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TextareaItem": () => /* binding */ TextareaItem +/* harmony export */ }); +/* harmony import */ var _textarea_item_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./textarea-item.controller */ "./src/lib/directives/textarea-item/textarea-item.controller.js"); +/* harmony import */ var _textarea_item_tpl_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./textarea-item.tpl.html */ "./src/lib/directives/textarea-item/textarea-item.tpl.html"); + + +/** + * @implements {ng.IDirective} + */ + +class TextareaItem { + /** + * @ngInject + */ + constructor() { + this.restrict = 'E'; + this.template = _textarea_item_tpl_html__WEBPACK_IMPORTED_MODULE_1__.default; + this.scope = { + item: '=' + }; + this.controller = _textarea_item_controller__WEBPACK_IMPORTED_MODULE_0__.TextareaItemCtrl; + this.controllerAs = 'Textarea'; + this.bindToController = true; + } + +} + +TextareaItem.$inject = []; + + +/***/ }), + +/***/ "./src/lib/directives/textarea-item/textarea-view.controller.js": +/*!**********************************************************************!*\ + !*** ./src/lib/directives/textarea-item/textarea-view.controller.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TextareaViewCtrl": () => /* binding */ TextareaViewCtrl +/* harmony export */ }); +class TextareaViewCtrl { + /** + * @ngInject + * @param {import('../../utils/utils.service').Utils} Utils + */ + constructor(Utils) { + this.Utils = Utils; + this.formItem = {}; + } + + init() { + this.formItem = this.Utils.extend(this.formItem, { + config: {} + }); + } + +} + +TextareaViewCtrl.$inject = ["Utils"]; + + +/***/ }), + +/***/ "./src/lib/directives/textarea-item/textarea-view.directive.js": +/*!*********************************************************************!*\ + !*** ./src/lib/directives/textarea-item/textarea-view.directive.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TextareaView": () => /* binding */ TextareaView +/* harmony export */ }); +/* harmony import */ var _textarea_view_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./textarea-view.controller */ "./src/lib/directives/textarea-item/textarea-view.controller.js"); +/* harmony import */ var _textarea_view_tpl_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./textarea-view.tpl.html */ "./src/lib/directives/textarea-item/textarea-view.tpl.html"); + + +/** + * @implements {ng.IDirective} + */ + +class TextareaView { + /** + * @ngInject + * @param {ng.ITimeoutService} $timeout + */ + constructor($timeout) { + this.$timeout = $timeout; + this.scope = { + formItem: '=', + form: '=' + }; + this.restrict = 'E'; + this.template = _textarea_view_tpl_html__WEBPACK_IMPORTED_MODULE_1__.default; + this.controller = _textarea_view_controller__WEBPACK_IMPORTED_MODULE_0__.TextareaViewCtrl; + this.controllerAs = 'TextareaView'; + this.bindToController = true; + } + /** + * @see https://docs.angularjs.org/api/ng/service/$compile#-link- + * @param {ng.IScope} scope - scope + * @param {JQLite} element - element + * @param {ng.IAttributes} attrs - attributes + * @param {TextareaViewCtrl} ctrl - this instance controller + * @param {ng.ITranscludeFunction} transcludeFn - transclude function ($transclude) + */ + + + link(scope, elem, attrs, ctrl) { + //this timeout is placed here in order to make sure that the creator directive of this view is finished its work + this.$timeout(function () { + ctrl.init(); + }, 50); + } + +} + +TextareaView.$inject = ["$timeout"]; + + +/***/ }), + +/***/ "./src/lib/directives/upload-item/upload-item.controller.js": +/*!******************************************************************!*\ + !*** ./src/lib/directives/upload-item/upload-item.controller.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UploadItemCtrl": () => /* binding */ UploadItemCtrl +/* harmony export */ }); +class UploadItemCtrl { + /** + * @ngInject + * + * @param {import('../../utils/utils.service').Utils} Utils + * @param {JQLite} $element + */ + constructor(Utils, $element) { + this.Element = $element; + this.item = Utils.extend(this.item || {}, { + config: {}, + options: [] + }); + } + +} + +UploadItemCtrl.$inject = ["Utils", "$element"]; + + +/***/ }), + +/***/ "./src/lib/directives/upload-item/upload-item.directive.js": +/*!*****************************************************************!*\ + !*** ./src/lib/directives/upload-item/upload-item.directive.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UploadItem": () => /* binding */ UploadItem +/* harmony export */ }); +/* harmony import */ var _upload_item_tpl_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./upload-item.tpl.html */ "./src/lib/directives/upload-item/upload-item.tpl.html"); +/* harmony import */ var _upload_item_controller__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./upload-item.controller */ "./src/lib/directives/upload-item/upload-item.controller.js"); + + +/** + * @implements {ng.IDirective} + */ + +class UploadItem { + /** + * @ngInject + */ + constructor() { + this.restrict = 'E'; + this.template = _upload_item_tpl_html__WEBPACK_IMPORTED_MODULE_0__.default; + this.scope = { + item: '=' + }; + this.controller = _upload_item_controller__WEBPACK_IMPORTED_MODULE_1__.UploadItemCtrl; + this.controllerAs = 'Upload'; + this.bindToController = true; + } + +} + +UploadItem.$inject = []; + + +/***/ }), + +/***/ "./src/lib/directives/upload-item/upload-view.controller.js": +/*!******************************************************************!*\ + !*** ./src/lib/directives/upload-item/upload-view.controller.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UploadViewCtrl": () => /* binding */ UploadViewCtrl +/* harmony export */ }); +class UploadViewCtrl { + /** + * @ngInject + * @param {ng.IScope} $scope + * @param {import('../../utils/utils.service').Utils} Utils + * @param {JQLite} $element + */ + constructor($scope, Utils, $element) { + this.Scope = $scope; + this.Element = $element; + this.Utils = Utils; + this.formItem = {}; + } + + init() { + this.isMultiple = false; + this.showAllowed = false; + this.formItem = this.Utils.extend(this.formItem || {}, { + config: { + size: 10, + uploadFileButtonLabel: 'Add files' + }, + options: [] + }); + + if (this.isPreview()) { + this._enableWatchers(); + } + } + + _updateMultiple() { + this.isMultiple = !!this.formItem.config.multipleUpload; + const input = angular.element(this.Element[0].querySelector('input[type=file]')); + + if (input) { + this.formItem.options = []; + + if (this.isMultiple) { + input.attr('multiple', 'multiple'); + } else { + input.removeAttr('multiple'); + } + } + } + + _updateAccept() { + this.showAllowed = !!this.formItem.config.showAccept; + const input = angular.element(this.Element[0].querySelector('input[type=file]')); + + if (input) { + if (this.showAllowed) { + input[0].setAttribute('accept', this.formItem.config.accept); + } else { + input[0].removeAttribute('accept'); + delete this.formItem.config.accept; + } + } + } + + _enableWatchers() { + this.Scope.$watch('UploadView.formItem.config.multipleUpload', newVal => { + if (newVal !== undefined) { + this._updateMultiple(); + } + }); + this.Scope.$watch('UploadView.formItem.config.showAccept', newVal => { + if (newVal !== undefined) { + this._updateAccept(); + } + }); + this.Scope.$watch('UploadView.formItem.config.accept', newVal => { + if (newVal !== undefined) { + this._updateAccept(); + } + }); + } + + removeItem(index) { + this.formItem.options.splice(index, 1); + } + +} + +UploadViewCtrl.$inject = ["$scope", "Utils", "$element"]; + + +/***/ }), + +/***/ "./src/lib/directives/upload-item/upload-view.directive.js": +/*!*****************************************************************!*\ + !*** ./src/lib/directives/upload-item/upload-view.directive.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UploadView": () => /* binding */ UploadView +/* harmony export */ }); +/* harmony import */ var _upload_view_controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./upload-view.controller */ "./src/lib/directives/upload-item/upload-view.controller.js"); +/* harmony import */ var _upload_view_tpl_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./upload-view.tpl.html */ "./src/lib/directives/upload-item/upload-view.tpl.html"); + + +const MB = 1024 * 1024; + +class UploadView { + /** + * @ngInject + * @param {ng.ITimeoutService} $timeout + */ + constructor($timeout) { + this.$timeout = $timeout; + this.template = _upload_view_tpl_html__WEBPACK_IMPORTED_MODULE_1__.default; + this.restrict = 'E'; + this.scope = { + formItem: '=', + isPreview: '&', + form: '=' + }; + this.controller = _upload_view_controller__WEBPACK_IMPORTED_MODULE_0__.UploadViewCtrl; + this.controllerAs = 'UploadView'; + this.bindToController = true; + } + /** + * @see https://docs.angularjs.org/api/ng/service/$compile#-link- + * @param {ng.IScope} scope - scope + * @param {JQLite} element - element + * @param {ng.IAttributes} attrs - attributes + * @param {UploadViewCtrl} ctrl - this instance controller + * @param {ng.ITranscludeFunction} transcludeFn - transclude function ($transclude) + */ + + + link(scope, element, attrs, ctrl) { + //this timeout is placed here in order to make sure that the creator directive of this view is finished its work + this.$timeout(function () { + ctrl.init(); + }, 50); + const button = angular.element(element[0].querySelector('.upload-button')); + const input = angular.element(element[0].querySelector('input[type=file]')); + const label = angular.element(element[0].querySelector('label')); + + if (label.length) { + label.css('display', 'none'); + } + + button.on('click', () => { + label.css('display', 'none'); + typeof input.trigger === 'function' ? input.trigger('click') : input[0].click(); + }); + input.on('change', e => { + scope.$apply(function () { + /** + * @type {File[]} + */ + const files = Array.from(e.target.files); // Max allowed size in MB + + const maxSizeMB = ctrl.formItem.config.size * MB; + const exceedsSize = files.some(file => file.size >= maxSizeMB); + + if (exceedsSize) { + label.css('display', 'block'); + label.text(ctrl.formItem.config.sizeErrMessage); + ctrl.formItem.options = []; + } else { + ctrl.formItem.options = files.map(file => { + const { + name, + size, + type + } = file; + return { + name, + size, + type, + file + }; + }); + } + }); + }); + } + +} + +UploadView.$inject = ["$timeout"]; + + +/***/ }), + +/***/ "./src/lib/index.module.js": +/*!*********************************!*\ + !*** ./src/lib/index.module.js ***! + \*********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony import */ var _index_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.scss */ "./src/lib/index.scss"); +/* harmony import */ var _directives_upload_item_upload_item_directive__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./directives/upload-item/upload-item.directive */ "./src/lib/directives/upload-item/upload-item.directive.js"); +/* harmony import */ var _directives_upload_item_upload_view_directive__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./directives/upload-item/upload-view.directive */ "./src/lib/directives/upload-item/upload-view.directive.js"); +/* harmony import */ var _directives_agreement_item_agreement_item_directive__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./directives/agreement-item/agreement-item.directive */ "./src/lib/directives/agreement-item/agreement-item.directive.js"); +/* harmony import */ var _directives_agreement_item_agreement_view_directive__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./directives/agreement-item/agreement-view.directive */ "./src/lib/directives/agreement-item/agreement-view.directive.js"); +/* harmony import */ var _main_main_controller__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./main/main.controller */ "./src/lib/main/main.controller.js"); +/* harmony import */ var _utils_utils_service__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/utils.service */ "./src/lib/utils/utils.service.js"); +/* harmony import */ var _directives_checkboxes_item_checkboxes_item_directive__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./directives/checkboxes-item/checkboxes-item.directive */ "./src/lib/directives/checkboxes-item/checkboxes-item.directive.js"); +/* harmony import */ var _directives_checkboxes_item_checkboxes_view_directive__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./directives/checkboxes-item/checkboxes-view.directive */ "./src/lib/directives/checkboxes-item/checkboxes-view.directive.js"); +/* harmony import */ var _directives_form_item_form_item_directive__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./directives/form-item/form-item.directive */ "./src/lib/directives/form-item/form-item.directive.js"); +/* harmony import */ var _directives_form_items_container_form_items_container_directive__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./directives/form-items-container/form-items-container.directive */ "./src/lib/directives/form-items-container/form-items-container.directive.js"); +/* harmony import */ var _directives_form_view_form_view_directive__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./directives/form-view/form-view.directive */ "./src/lib/directives/form-view/form-view.directive.js"); +/* harmony import */ var _directives_input_item_input_item_directive__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./directives/input-item/input-item.directive */ "./src/lib/directives/input-item/input-item.directive.js"); +/* harmony import */ var _directives_input_item_input_view_directive__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./directives/input-item/input-view.directive */ "./src/lib/directives/input-item/input-view.directive.js"); +/* harmony import */ var _directives_label_item_label_item_directive__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./directives/label-item/label-item.directive */ "./src/lib/directives/label-item/label-item.directive.js"); +/* harmony import */ var _directives_label_item_label_view_directive__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./directives/label-item/label-view.directive */ "./src/lib/directives/label-item/label-view.directive.js"); +/* harmony import */ var _directives_matrix_item_matrix_item_directive__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./directives/matrix-item/matrix-item.directive */ "./src/lib/directives/matrix-item/matrix-item.directive.js"); +/* harmony import */ var _directives_matrix_item_matrix_view_directive__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./directives/matrix-item/matrix-view.directive */ "./src/lib/directives/matrix-item/matrix-view.directive.js"); +/* harmony import */ var _directives_radio_button_item_radio_button_item_directive__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./directives/radio-button-item/radio-button-item.directive */ "./src/lib/directives/radio-button-item/radio-button-item.directive.js"); +/* harmony import */ var _directives_radio_button_item_radio_button_view_directive__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./directives/radio-button-item/radio-button-view.directive */ "./src/lib/directives/radio-button-item/radio-button-view.directive.js"); +/* harmony import */ var _directives_select_item_select_view_directive__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./directives/select-item/select-view.directive */ "./src/lib/directives/select-item/select-view.directive.js"); +/* harmony import */ var _directives_select_item_select_item_directive__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./directives/select-item/select-item.directive */ "./src/lib/directives/select-item/select-item.directive.js"); +/* harmony import */ var _directives_textarea_item_textarea_item_directive__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./directives/textarea-item/textarea-item.directive */ "./src/lib/directives/textarea-item/textarea-item.directive.js"); +/* harmony import */ var _directives_textarea_item_textarea_view_directive__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./directives/textarea-item/textarea-view.directive */ "./src/lib/directives/textarea-item/textarea-view.directive.js"); + + + + + + + + + + + + + + + + + + + + + + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (angular.module('angularMaterialFormBuilder', ['ngMaterial', 'angular-sortable-view', 'ngMessages']).service('Utils', _utils_utils_service__WEBPACK_IMPORTED_MODULE_6__.Utils).controller('MainController', _main_main_controller__WEBPACK_IMPORTED_MODULE_5__.MainController).directive('uploadItem', _directives_upload_item_upload_item_directive__WEBPACK_IMPORTED_MODULE_1__.UploadItem).directive('uploadView', _directives_upload_item_upload_view_directive__WEBPACK_IMPORTED_MODULE_2__.UploadView).directive('agreementItem', _directives_agreement_item_agreement_item_directive__WEBPACK_IMPORTED_MODULE_3__.AgreementItem).directive('agreementView', _directives_agreement_item_agreement_view_directive__WEBPACK_IMPORTED_MODULE_4__.AgreementView).directive('checkboxesItem', _directives_checkboxes_item_checkboxes_item_directive__WEBPACK_IMPORTED_MODULE_7__.CheckboxesItem).directive('checkboxesView', _directives_checkboxes_item_checkboxes_view_directive__WEBPACK_IMPORTED_MODULE_8__.CheckboxesView).directive('formItem', _directives_form_item_form_item_directive__WEBPACK_IMPORTED_MODULE_9__.FormItem).directive('formItemsContainer', _directives_form_items_container_form_items_container_directive__WEBPACK_IMPORTED_MODULE_10__.FormItemsContainer).directive('formView', _directives_form_view_form_view_directive__WEBPACK_IMPORTED_MODULE_11__.FormView).directive('inputItem', _directives_input_item_input_item_directive__WEBPACK_IMPORTED_MODULE_12__.InputItem).directive('inputView', _directives_input_item_input_view_directive__WEBPACK_IMPORTED_MODULE_13__.InputView).directive('labelItem', _directives_label_item_label_item_directive__WEBPACK_IMPORTED_MODULE_14__.LabelItem).directive('labelView', _directives_label_item_label_view_directive__WEBPACK_IMPORTED_MODULE_15__.LabelView).directive('matrixItem', _directives_matrix_item_matrix_item_directive__WEBPACK_IMPORTED_MODULE_16__.MatrixItem).directive('matrixView', _directives_matrix_item_matrix_view_directive__WEBPACK_IMPORTED_MODULE_17__.MatrixView).directive('radioButtonItem', _directives_radio_button_item_radio_button_item_directive__WEBPACK_IMPORTED_MODULE_18__.RadioButtonItem).directive('radioButtonView', _directives_radio_button_item_radio_button_view_directive__WEBPACK_IMPORTED_MODULE_19__.RadioButtonView).directive('selectItem', _directives_select_item_select_item_directive__WEBPACK_IMPORTED_MODULE_21__.SelectItem).directive('selectView', _directives_select_item_select_view_directive__WEBPACK_IMPORTED_MODULE_20__.SelectView).directive('textareaItem', _directives_textarea_item_textarea_item_directive__WEBPACK_IMPORTED_MODULE_22__.TextareaItem).directive('textareaView', _directives_textarea_item_textarea_view_directive__WEBPACK_IMPORTED_MODULE_23__.TextareaView)); + +/***/ }), + +/***/ "./src/lib/main/main.controller.js": +/*!*****************************************!*\ + !*** ./src/lib/main/main.controller.js ***! + \*****************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "MainController": () => /* binding */ MainController +/* harmony export */ }); +/** + * @typedef {{type:string}} Item + * @typedef {{items: Item[]}} FormConfig + */ +class MainController { + /** + * @ngInject + */ + constructor() { + /** + * @type {FormConfig} + */ + this.form = { + items: [] + }; + } + /** + * Add new Item + * @param {string} type + */ + + + addItem(type) { + this.form.items.push({ + type + }); + } + /** + * Remove item at index + * @param {Item} item + * @param {number} index + */ + + + delete(item, index) { + this.form.items.splice(index, 1); + } + /** + * insert before (bounded) + * Pops out latest element (wanted?) + * @param {Item} item + * @param {number} index + */ + + + up(item, index) { + if (index !== 0) { + const prevItem = this.form.items[index - 1]; + this.form.items[index] = prevItem; + this.form.items[index - 1] = item; + } + } + /** + * insert after (bounded) + * Pops out latest element (wanted?) + * @param {Item} item + * @param {number} index + */ + + + down(item, index) { + if (index !== this.form.items.length - 1) { + const nextItem = this.form.items[index + 1]; + this.form.items[index] = nextItem; + this.form.items[index + 1] = item; + } + } + +} + +MainController.$inject = []; + + +/***/ }), + +/***/ "./src/lib/utils/utils.service.js": +/*!****************************************!*\ + !*** ./src/lib/utils/utils.service.js ***! + \****************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Utils": () => /* binding */ Utils +/* harmony export */ }); +class Utils { + /** + * Recursively extend object properties + * @param {Object} dest + * @param {Object} src + * @returns {Object} + */ + extend(dest, src) { + return Object.keys(src).reduce((result, key) => { + if (typeof result[key] === 'undefined') { + result[key] = src[key]; + } else if (typeof src[key] === 'object') { + result[key] = this.extend(result[key], src[key]); + } + + return result; + }, typeof dest === 'undefined' ? {} : dest); + } + +} + + + +/***/ }), + +/***/ "./src/lib/index.scss": +/*!****************************!*\ + !*** ./src/lib/index.scss ***! + \****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "./src/lib/directives/agreement-item/agreement-view.tpl.html": +/*!*******************************************************************!*\ + !*** ./src/lib/directives/agreement-item/agreement-view.tpl.html ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n {{AgreementView.formItem.options[0].value}}\n \n\n
\n
\n Must select {{AgreementView.formItem.maxSelections || 1}} items\n
\n
\n
\n"); + +/***/ }), + +/***/ "./src/lib/directives/checkboxes-item/checkboxes-item.tpl.html": +/*!*********************************************************************!*\ + !*** ./src/lib/directives/checkboxes-item/checkboxes-item.tpl.html ***! + \*********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n \n \n \n\n \n Layout direction ({{Checkboxes.item.config.direction == 'horizontal' ?\n 'Horizontal' : 'Vertical'}})\n \n\n \n \n reorder\n \n\n \n \n \n \n\n \n delete\n \n \n
\n \n add\n \n
\n\n"); + +/***/ }), + +/***/ "./src/lib/directives/checkboxes-item/checkboxes-view.tpl.html": +/*!*********************************************************************!*\ + !*** ./src/lib/directives/checkboxes-item/checkboxes-view.tpl.html ***! + \*********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n {{option.value}}\n \n\n
\n
\n Must select {{CheckboxesView.formItem.maxSelections || 1}} items\n
\n
\n
\n"); + +/***/ }), + +/***/ "./src/lib/directives/form-item/form-item.tpl.html": +/*!*********************************************************!*\ + !*** ./src/lib/directives/form-item/form-item.tpl.html ***! + \*********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("
\n
\n \n delete\n \n \n arrow_drop_up\n \n \n arrow_drop_down\n \n
\n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n
\n \n \n \n \n \n \n \n \n \n

UNKNOWN TYPE

\n
\n\n \n Required field\n \n
\n"); + +/***/ }), + +/***/ "./src/lib/directives/form-items-container/form-items-container.tpl.html": +/*!*******************************************************************************!*\ + !*** ./src/lib/directives/form-items-container/form-items-container.tpl.html ***! + \*******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("
\n \n \n
\n"); + +/***/ }), + +/***/ "./src/lib/directives/form-view/form-view.tpl.html": +/*!*********************************************************!*\ + !*** ./src/lib/directives/form-view/form-view.tpl.html ***! + \*********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("
\n \n \n
\n
{{formItem.props.title}}
\n
{{formItem.props.helpText}}
\n\n \n \n \n \n \n \n \n \n \n
\n
\n
\n\n"); + +/***/ }), + +/***/ "./src/lib/directives/input-item/input-item.tpl.html": +/*!***********************************************************!*\ + !*** ./src/lib/directives/input-item/input-item.tpl.html ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n \n\n\n \n \n Text\n Number\n Email\n \n\n"); + +/***/ }), + +/***/ "./src/lib/directives/input-item/input-view.tpl.html": +/*!***********************************************************!*\ + !*** ./src/lib/directives/input-item/input-view.tpl.html ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n
\n
This field is required
\n
\n
\n"); + +/***/ }), + +/***/ "./src/lib/directives/label-item/label-item.tpl.html": +/*!***********************************************************!*\ + !*** ./src/lib/directives/label-item/label-item.tpl.html ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n \n\n"); + +/***/ }), + +/***/ "./src/lib/directives/label-item/label-view.tpl.html": +/*!***********************************************************!*\ + !*** ./src/lib/directives/label-item/label-view.tpl.html ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n
\n      {{LabelView.formItem.value}}\n    
\n
\n
\n"); + +/***/ }), + +/***/ "./src/lib/directives/matrix-item/matrix-item.tpl.html": +/*!*************************************************************!*\ + !*** ./src/lib/directives/matrix-item/matrix-item.tpl.html ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n \n reorder\n \n\n \n \n \n \n\n \n delete\n Delete\n \n \n
\n Add Column\n
\n\n\n\n \n \n reorder\n \n\n \n \n \n \n\n \n delete\n Delete\n \n \n
\n Add row\n
\n\n"); + +/***/ }), + +/***/ "./src/lib/directives/matrix-item/matrix-view.tpl.html": +/*!*************************************************************!*\ + !*** ./src/lib/directives/matrix-item/matrix-view.tpl.html ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n
\n
\n \n {{column.value}}\n
\n \n {{row.value}}\n \n \n \n \n \n
\n \n\n
\n
This is required
\n
\n
\n"); + +/***/ }), + +/***/ "./src/lib/directives/radio-button-item/radio-button-item.tpl.html": +/*!*************************************************************************!*\ + !*** ./src/lib/directives/radio-button-item/radio-button-item.tpl.html ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n Layout direction ({{RadioButton.item.config.direction == 'horizontal' ?\n 'Horizontal' : 'Vertical'}})\n \n\n \n \n reorder\n \n\n \n \n \n \n\n \n delete\n \n \n\n Add Option\n\n"); + +/***/ }), + +/***/ "./src/lib/directives/radio-button-item/radio-button-view.tpl.html": +/*!*************************************************************************!*\ + !*** ./src/lib/directives/radio-button-item/radio-button-view.tpl.html ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n \n {{option.value}}\n \n \n\n
\n
This field is required
\n
\n
\n"); + +/***/ }), + +/***/ "./src/lib/directives/select-item/select-item.tpl.html": +/*!*************************************************************!*\ + !*** ./src/lib/directives/select-item/select-item.tpl.html ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n \n reorder\n \n\n \n \n \n \n\n \n delete\n \n \n\n Add Option\n\n"); + +/***/ }), + +/***/ "./src/lib/directives/select-item/select-view.tpl.html": +/*!*************************************************************!*\ + !*** ./src/lib/directives/select-item/select-view.tpl.html ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n {{ option.value }}\n \n
\n
This field is required
\n
\n
\n"); + +/***/ }), + +/***/ "./src/lib/directives/textarea-item/textarea-item.tpl.html": +/*!*****************************************************************!*\ + !*** ./src/lib/directives/textarea-item/textarea-item.tpl.html ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n \n\n"); + +/***/ }), + +/***/ "./src/lib/directives/textarea-item/textarea-view.tpl.html": +/*!*****************************************************************!*\ + !*** ./src/lib/directives/textarea-item/textarea-view.tpl.html ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n
\n
This field is required
\n
\n
\n"); + +/***/ }), + +/***/ "./src/lib/directives/upload-item/upload-item.tpl.html": +/*!*************************************************************!*\ + !*** ./src/lib/directives/upload-item/upload-item.tpl.html ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("\n \n \n \n \n\n \n Multiple\n \n\n \n Max File size: {{Upload.item.config.size}} Mb\n \n \n\n \n \n \n \n\n \n Configure allowed file types\n \n\n \n \n \n \n\n"); + +/***/ }), + +/***/ "./src/lib/directives/upload-item/upload-view.tpl.html": +/*!*************************************************************!*\ + !*** ./src/lib/directives/upload-item/upload-view.tpl.html ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("
\n \n \n \n \n \n \n\n attach_file{{UploadView.formItem.config.uploadFileButtonLabel}}\n
\n\n
\n \n \n \n close\n \n {{option.name}}\n
\n\n"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ if(__webpack_module_cache__[moduleId]) { +/******/ return __webpack_module_cache__[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +/******/ // module exports must be returned from runtime so entry inlining is disabled +/******/ // startup +/******/ // Load entry module and return exports +/******/ return __webpack_require__("./src/lib/index.module.js"); +/******/ })() +; +}); +//# sourceMappingURL=angular-material-form-builder.js.map \ No newline at end of file diff --git a/public/assets/plugins/angular-material-form-builder/dist/angular-material-form-builder.min.css b/public/assets/plugins/angular-material-form-builder/dist/angular-material-form-builder.min.css new file mode 100644 index 0000000..cef55ea --- /dev/null +++ b/public/assets/plugins/angular-material-form-builder/dist/angular-material-form-builder.min.css @@ -0,0 +1,2 @@ +@import url(https://fonts.googleapis.com/icon?family=Material+Icons);.main-view .content .builder,.main-view .content .json,.main-view .content .view{border-right:1px solid #ccc;height:800px;overflow:auto}.builder-icon,form-item .form-item-container .md-button,form-item .option-item .md-button{min-height:36px;min-width:36px;height:36px;width:36px;line-height:0}form-item .option-item{min-height:75px}form-item .option-item .md-button{line-height:0;margin-top:20px}form-item .option-item .md-button.handle:active,form-item .option-item .md-button.handle:hover{cursor:move}form-item .form-item-container{position:relative;padding-top:30px}form-item .form-item-container .form-item-actions{position:absolute;right:20px;top:0}form-view .formItem-content,form-view .formItem-title{font-size:18px}form-view .formItem-help-text{font-size:14px;color:#6c6c6c}form-view .matrix-container{overflow:auto}form-view .matrix-container .matrix .matrix-row{border-bottom:1px solid #4caf50}form-view .matrix-container .matrix .matrix-cell{text-align:center;overflow:hidden}form-view .matrix-container .matrix md-radio-button .md-label{margin-left:0;margin-right:0}form-view .matrix-container .matrix .md-switch-thumb,form-view .matrix-container .matrix md-radio-button{margin:15px 0}i.material-icons{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}i.material-icons.medium{font-size:36px}.md-button.upload-button{padding:0 16px;height:36px}.md-button.upload-button md-icon{font-size:16px} +/*# sourceMappingURL=angular-material-form-builder.min.css.map*/ \ No newline at end of file diff --git a/public/assets/plugins/angular-material-form-builder/dist/angular-material-form-builder.min.js b/public/assets/plugins/angular-material-form-builder/dist/angular-material-form-builder.min.js new file mode 100644 index 0000000..c68c2e0 --- /dev/null +++ b/public/assets/plugins/angular-material-form-builder/dist/angular-material-form-builder.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["angular-material-form-builder"]=t():e["angular-material-form-builder"]=t()}(self,(function(){return(()=>{"use strict";var e={"./src/lib/directives/agreement-item/agreement-item.controller.js":(e,t,i)=>{function n(e,t){this.Element=t,this.item=e.extend(this.item||{},{config:{maxSelections:null},options:[{value:"",selected:!1}]})}i.r(t),i.d(t,{AgreementItemCtrl:()=>n}),n.$inject=["Utils","$element"]},"./src/lib/directives/agreement-item/agreement-item.directive.js":(e,t,i)=>{i.r(t),i.d(t,{AgreementItem:()=>o});var n=i("./src/lib/directives/agreement-item/agreement-item.controller.js");class o{constructor(){this.restrict="E",this.scope={item:"="},this.controller=n.AgreementItemCtrl,this.controllerAs="Agreement",this.bindToController=!0}}o.$inject=[]},"./src/lib/directives/agreement-item/agreement-view.controller.js":(e,t,i)=>{i.r(t),i.d(t,{AgreementViewCtrl:()=>n});class n{constructor(e,t){this.Scope=e,this.Utils=t,this.formItem={}}init(){this.formItem=this.Utils.extend(this.formItem||{},{config:{},options:[{value:"",selected:!1}]}),this.selectedOptions=this._getSelectedOptions(),this.disableOptions=!1,this.isValid=!0,this._updateView(),this._updateValidity(),this.isPreview()&&this._enableWatchers()}toggleSelectedOption(){this.selectedOptions=this._getSelectedOptions(),this._updateView(),this._updateValidity()}_getSelectedOptions(){return this.formItem.options.filter((e=>e.selected))}_updateView(){this.formItem.config.maxSelections&&this.selectedOptions.length===this.formItem.config.maxSelections?this.disableOptions=!0:this.disableOptions=!1}_updateValidity(){this.formItem.config.required?this.isValid=this.selectedOptions.length>0:this.isValid=!0,this.form.$setValidity("minSelections",this.isValid)}_enableWatchers(){this.Scope.$watch("AgreementView.formItem.config.required",(e=>{void 0!==e&&(this._updateView(),this._updateValidity())}))}}n.$inject=["$scope","Utils"]},"./src/lib/directives/agreement-item/agreement-view.directive.js":(e,t,i)=>{i.r(t),i.d(t,{AgreementView:()=>r});var n=i("./src/lib/directives/agreement-item/agreement-view.controller.js"),o=i("./src/lib/directives/agreement-item/agreement-view.tpl.html");class r{constructor(e){this.$timeout=e,this.template=o.default,this.restrict="E",this.scope={formItem:"=",isPreview:"&",form:"="},this.controller=n.AgreementViewCtrl,this.controllerAs="AgreementView",this.bindToController=!0}link(e,t,i,n){this.$timeout((function(){n.init()}),50)}}r.$inject=["$timeout"]},"./src/lib/directives/checkboxes-item/checkboxes-item.controller.js":(e,t,i)=>{i.r(t),i.d(t,{CheckboxesItemCtrl:()=>n});class n{constructor(e,t){this.Element=t,this.item=e.extend(this.item||{},{config:{maxSelections:null},options:[{value:"",selected:!1}]})}deleteOption(e){this.item.options.splice(e,1)}addOption(){this.item.options.push({value:"",selected:!1}),setTimeout((()=>{const e=this.Element.find("input");e[e.length-1].focus()}),0)}}n.$inject=["Utils","$element"]},"./src/lib/directives/checkboxes-item/checkboxes-item.directive.js":(e,t,i)=>{i.r(t),i.d(t,{CheckboxesItem:()=>r});var n=i("./src/lib/directives/checkboxes-item/checkboxes-item.tpl.html"),o=i("./src/lib/directives/checkboxes-item/checkboxes-item.controller.js");function r(){return{restrict:"E",template:n.default,scope:{item:"="},controller:o.CheckboxesItemCtrl,controllerAs:"Checkboxes",bindToController:!0}}},"./src/lib/directives/checkboxes-item/checkboxes-view.controller.js":(e,t,i)=>{i.r(t),i.d(t,{CheckboxesViewCtrl:()=>n});class n{constructor(e,t){this.Scope=e,this.Utils=t,this.formItem={}}init(){this.formItem=this.Utils.extend(this.formItem||{},{config:{},options:[]}),this.selectedOptions=this._getSelectedOptions(),this.disableOptions=!1,this.isValid=!0,this._updateView(),this._updateValidity(),this.isPreview()&&this._enableWatchers()}toggleSelectedOption(){this.selectedOptions=this._getSelectedOptions(),this._updateView(),this._updateValidity()}_getSelectedOptions(){return this.formItem.options.filter((e=>e.selected))}_updateView(){this.formItem.config.maxSelections&&this.selectedOptions.length===this.formItem.config.maxSelections?this.disableOptions=!0:this.disableOptions=!1}_updateValidity(){this.formItem.config.required?this.isValid=this.selectedOptions.length>0:this.isValid=!0,this.form.$setValidity("minSelections",this.isValid)}_enableWatchers(){this.Scope.$watch("CheckboxesView.formItem.config.required",(e=>{void 0!==e&&(this._updateView(),this._updateValidity())}))}}n.$inject=["$scope","Utils"]},"./src/lib/directives/checkboxes-item/checkboxes-view.directive.js":(e,t,i)=>{i.r(t),i.d(t,{CheckboxesView:()=>r});var n=i("./src/lib/directives/checkboxes-item/checkboxes-view.tpl.html"),o=i("./src/lib/directives/checkboxes-item/checkboxes-view.controller.js");class r{constructor(e){this.$timeout=e,this.restrict="E",this.template=n.default,this.scope={formItem:"=",isPreview:"&",form:"="},this.controller=o.CheckboxesViewCtrl,this.controllerAs="CheckboxesView",this.bindToController=!0}link(e,t,i,n){this.$timeout((function(){n.init()}),50)}}r.$inject=["$timeout"]},"./src/lib/directives/form-item/form-item.controller.js":(e,t,i)=>{i.r(t),i.d(t,{FormItemCtrl:()=>o});const n={upload:"Attachment",agreement:"Agreement",input:"Field",chooseFromList:"Select",label:"Label",multipleChoices:"Choice",matrix:"Matrix",checkboxes:"Options",textarea:"Text"};class o{constructor(e,t,i){this.Attrs=t,this.Utils=i,this.templates={upload:'',agreement:'',input:'',chooseFromList:'',label:'',multipleChoices:'',matrix:'',checkboxes:'',textarea:''},this.item={},this.scope=e}init(){this.item=this.Utils.extend(this.item||{},{type:this.Attrs.type,props:{title:n[this.Attrs.type],helpText:""},config:{required:!1}})}deleteClicked(){this.onDelete({item:this.item,index:this.index()})}_getItemTemplate(e){return'
delete arrow_drop_up arrow_drop_down
'+this.templates[e]+'Required field
'}}o.$inject=["$scope","$attrs","Utils"]},"./src/lib/directives/form-item/form-item.directive.js":(e,t,i)=>{i.r(t),i.d(t,{FormItem:()=>r});var n=i("./src/lib/directives/form-item/form-item.tpl.html"),o=i("./src/lib/directives/form-item/form-item.controller.js");class r{constructor(e){this.$compile=e,this.restrict="E",this.scope={item:"=",onDelete:"&",onUp:"&",onDown:"&",index:"&"},this.controller=o.FormItemCtrl,this.controllerAs="FormItem",this.bindToController=!0,this.template=n.default}link(e,t,i,n){const o=n._getItemTemplate(i.type),r=this.$compile(o)(e);return n.init(),r}}r.$inject=["$compile"]},"./src/lib/directives/form-items-container/form-items-container.controller.js":(e,t,i)=>{i.r(t),i.d(t,{FormItemsContainerCtrl:()=>n});class n{constructor(){this.form={items:[]}}delete(e,t){this.form.items.splice(t,1)}up(e,t){if(0!==t){const i=this.form.items[t-1];this.form.items[t]=i,this.form.items[t-1]=e}}down(e,t){if(t!==this.form.items.length-1){const i=this.form.items[t+1];this.form.items[t]=i,this.form.items[t+1]=e}}}n.$inject=[]},"./src/lib/directives/form-items-container/form-items-container.directive.js":(e,t,i)=>{i.r(t),i.d(t,{FormItemsContainer:()=>r});var n=i("./src/lib/directives/form-items-container/form-items-container.controller.js"),o=i("./src/lib/directives/form-items-container/form-items-container.tpl.html");class r{constructor(){this.restrict="E",this.scope={form:"="},this.template=o.default,this.controller=n.FormItemsContainerCtrl,this.controllerAs="container",this.bindToController=!0}}r.$inject=[]},"./src/lib/directives/form-view/form-view.controller.js":(e,t,i)=>{i.r(t),i.d(t,{FormViewCtrl:()=>n});class n{constructor(e){this.Scope=e}init(){}}n.$inject=["$scope"]},"./src/lib/directives/form-view/form-view.directive.js":(e,t,i)=>{i.r(t),i.d(t,{FormView:()=>r});var n=i("./src/lib/directives/form-view/form-view.controller.js"),o=i("./src/lib/directives/form-view/form-view.tpl.html");class r{constructor(){this.restrict="E",this.template=o.default,this.scope={form:"="},this.controller=n.FormViewCtrl,this.controllerAs="FormView",this.bindToController=!0}link(e,t,i,n){n.init()}}r.$inject=[]},"./src/lib/directives/input-item/input-item.controller.js":(e,t,i)=>{i.r(t),i.d(t,{InputItemCtrl:()=>n});class n{constructor(e,t){this.Element=t,this.item=e.extend(this.item||{},{config:{type:"text"}})}}n.$inject=["Utils","$element"]},"./src/lib/directives/input-item/input-item.directive.js":(e,t,i)=>{i.r(t),i.d(t,{InputItem:()=>r});var n=i("./src/lib/directives/input-item/input-item.controller.js"),o=i("./src/lib/directives/input-item/input-item.tpl.html");class r{constructor(){this.restrict="E",this.template=o.default,this.scope={item:"="},this.controller=n.InputItemCtrl,this.controllerAs="Input",this.bindToController=!0}}r.$inject=[]},"./src/lib/directives/input-item/input-view.controller.js":(e,t,i)=>{i.r(t),i.d(t,{InputViewCtrl:()=>n});class n{constructor(e){this.Utils=e,this.formItem={}}init(){this.Utils.extend(this.formItem,{config:{}})}}n.$inject=["Utils"]},"./src/lib/directives/input-item/input-view.directive.js":(e,t,i)=>{i.r(t),i.d(t,{InputView:()=>r});var n=i("./src/lib/directives/input-item/input-view.controller.js"),o=i("./src/lib/directives/input-item/input-view.tpl.html");class r{constructor(e){this.$timeout=e,this.restrict="E",this.template=o.default,this.scope={formItem:"=",form:"="},this.controller=n.InputViewCtrl,this.controllerAs="InputView",this.bindToController=!0}link(e,t,i,n){this.$timeout((function(){n.init()}),50)}}r.$inject=["$timeout"]},"./src/lib/directives/label-item/label-item.controller.js":(e,t,i)=>{i.r(t),i.d(t,{LabelItemCtrl:()=>n});class n{constructor(e){this.Element=e}}n.$inject=["$element"]},"./src/lib/directives/label-item/label-item.directive.js":(e,t,i)=>{i.r(t),i.d(t,{LabelItem:()=>r});var n=i("./src/lib/directives/label-item/label-item.controller.js"),o=i("./src/lib/directives/label-item/label-item.tpl.html");class r{constructor(){this.restrict="E",this.template=o.default,this.scope={item:"="},this.controller=n.LabelItemCtrl,this.controllerAs="Label",this.bindToController=!0}}},"./src/lib/directives/label-item/label-view.controller.js":(e,t,i)=>{i.r(t),i.d(t,{LabelViewCtrl:()=>n});class n{constructor(e){this.Utils=e}init(){this.Utils.extend(this.formItem,{})}}n.$inject=["Utils"]},"./src/lib/directives/label-item/label-view.directive.js":(e,t,i)=>{i.r(t),i.d(t,{LabelView:()=>r});var n=i("./src/lib/directives/label-item/label-view.controller.js"),o=i("./src/lib/directives/label-item/label-view.tpl.html");class r{constructor(e){this.$timeout=e,this.restrict="E",this.template=o.default,this.scope={formItem:"=",form:"="},this.controller=n.LabelViewCtrl,this.controllerAs="LabelView",this.bindToController=!0}link(e,t,i,n){this.$timeout((function(){n.init()}),50)}}r.$inject=["$timeout"]},"./src/lib/directives/matrix-item/matrix-item.controller.js":(e,t,i)=>{i.r(t),i.d(t,{MatrixItemCtrl:()=>n});class n{constructor(e,t){this.RowContainer=angular.element(t[0].querySelector(".rowContainer")),this.ColumnContainer=angular.element(t[0].querySelector(".columnContainer")),this.item=e.extend(this.item||{},{config:{rows:[{value:""}],columns:[{value:""}]}})}deleteRow(e){this.item.config.rows.splice(e,1)}addRow(){this.item.config.rows.push({value:""}),setTimeout(function(){const e=this.RowContainer.find("input");e[e.length-1].focus()}.bind(this),0)}deleteColumn(e){this.item.config.columns.splice(e,1)}addColumn(){this.item.config.columns.push({value:""}),setTimeout((()=>{const e=this.ColumnContainer.find("input");e[e.length-1].focus()}),0)}}n.$inject=["Utils","$document"]},"./src/lib/directives/matrix-item/matrix-item.directive.js":(e,t,i)=>{i.r(t),i.d(t,{MatrixItem:()=>r});var n=i("./src/lib/directives/matrix-item/matrix-item.controller.js"),o=i("./src/lib/directives/matrix-item/matrix-item.tpl.html");class r{constructor(){this.restrict="E",this.template=o.default,this.scope={item:"="},this.controller=n.MatrixItemCtrl,this.controllerAs="Matrix",this.bindToController=!0}}r.$inject=[]},"./src/lib/directives/matrix-item/matrix-view.controller.js":(e,t,i)=>{i.r(t),i.d(t,{MatrixViewCtrl:()=>n});class n{constructor(e,t){this.Scope=e,this.Utils=t,this.isValid=!0,this.formItem={}}init(){this.formItem=this.Utils.extend(this.formItem,{config:{rows:[],columns:[]}}),this._updateValidity(),this.isPreview()&&this._enableWatchers()}_updateValidity(){let e=!0;this.formItem.config.required&&(e=!this.formItem.config.rows.some((e=>void 0===e.selected))),this.isValid=e,this.form.$setValidity("required",this.isValid)}_enableWatchers(){this.Scope.$watchGroup(["MatrixView.formItem.config.required","MatrixView.formItem.config.rows.length"],(e=>{void 0!==e&&this._updateValidity()}))}}n.$inject=["$scope","Utils"]},"./src/lib/directives/matrix-item/matrix-view.directive.js":(e,t,i)=>{i.r(t),i.d(t,{MatrixView:()=>r});var n=i("./src/lib/directives/matrix-item/matrix-view.tpl.html"),o=i("./src/lib/directives/matrix-item/matrix-view.controller.js");class r{constructor(e){this.$timeout=e,this.restrict="E",this.template=n.default,this.scope={formItem:"=",isPreview:"&",form:"="},this.controller=o.MatrixViewCtrl,this.controllerAs="MatrixView",this.bindToController=!0}link(e,t,i,n){this.$timeout((function(){n.init()}),50)}}r.$inject=["$timeout"]},"./src/lib/directives/radio-button-item/radio-button-item.controller.js":(e,t,i)=>{i.r(t),i.d(t,{RadioButtonItemCtrl:()=>n});class n{constructor(e,t){this.Element=t,this.item=e.extend(this.item||{},{config:{},options:[{value:""}]})}deleteOption(e){this.item.options.splice(e,1)}addOption(){this.item.options.push({value:""}),setTimeout((()=>{const e=this.Element.find("input");e[e.length-1].focus()}),0)}}n.$inject=["Utils","$element"]},"./src/lib/directives/radio-button-item/radio-button-item.directive.js":(e,t,i)=>{i.r(t),i.d(t,{RadioButtonItem:()=>r});var n=i("./src/lib/directives/radio-button-item/radio-button-item.controller.js"),o=i("./src/lib/directives/radio-button-item/radio-button-item.tpl.html");class r{constructor(){this.restrict="E",this.template=o.default,this.scope={item:"="},this.controller=n.RadioButtonItemCtrl,this.controllerAs="RadioButton",this.bindToController=!0}}r.$inject=[]},"./src/lib/directives/radio-button-item/radio-button-view.controller.js":(e,t,i)=>{i.r(t),i.d(t,{RadioButtonViewCtrl:()=>n});class n{constructor(e){this.Utils=e,this.formItem={}}init(){this.formItem=this.Utils.extend(this.formItem,{config:{},options:[]})}}n.$inject=["Utils"]},"./src/lib/directives/radio-button-item/radio-button-view.directive.js":(e,t,i)=>{i.r(t),i.d(t,{RadioButtonView:()=>r});var n=i("./src/lib/directives/radio-button-item/radio-button-view.controller.js"),o=i("./src/lib/directives/radio-button-item/radio-button-view.tpl.html");class r{constructor(e){this.$timeout=e,this.restrict="E",this.template=o.default,this.scope={formItem:"=",isPreview:"&",form:"="},this.controller=n.RadioButtonViewCtrl,this.controllerAs="RadioButtonView",this.bindToController=!0}link(e,t,i,n){this.$timeout((function(){n.init()}),50)}}r.$inject=["$timeout"]},"./src/lib/directives/select-item/select-item.controller.js":(e,t,i)=>{i.r(t),i.d(t,{SelectItemCtrl:()=>n});class n{constructor(e,t){this.Element=t,this.item=e.extend(this.item||{},{config:{},options:[{value:""}]})}deleteOption(e){this.item.options.splice(e,1)}addOption(){this.item.options.push({value:""}),setTimeout((()=>{const e=this.Element.find("input");e[e.length-1].focus()}),0)}}n.$inject=["Utils","$element"]},"./src/lib/directives/select-item/select-item.directive.js":(e,t,i)=>{i.r(t),i.d(t,{SelectItem:()=>r});var n=i("./src/lib/directives/select-item/select-item.tpl.html"),o=i("./src/lib/directives/select-item/select-item.controller.js");class r{constructor(){this.restrict="E",this.template=n.default,this.scope={item:"="},this.controller=o.SelectItemCtrl,this.controllerAs="Select",this.bindToController=!0}}r.$inject=[]},"./src/lib/directives/select-item/select-view.controller.js":(e,t,i)=>{i.r(t),i.d(t,{SelectViewCtrl:()=>n});class n{constructor(e){this.Utils=e,this.formItem={}}init(){this.formItem=this.Utils.extend(this.formItem,{config:{},options:[]})}}n.$inject=["Utils"]},"./src/lib/directives/select-item/select-view.directive.js":(e,t,i)=>{i.r(t),i.d(t,{SelectView:()=>r});var n=i("./src/lib/directives/select-item/select-view.tpl.html"),o=i("./src/lib/directives/select-item/select-view.controller.js");class r{constructor(e){this.$timeout=e,this.restrict="E",this.template=n.default,this.scope={formItem:"=",isPreview:"&",form:"="},this.controller=o.SelectViewCtrl,this.controllerAs="SelectView",this.bindToController=!0}link(e,t,i,n){this.$timeout((function(){n.init()}),50)}}r.$inject=["$timeout"]},"./src/lib/directives/textarea-item/textarea-item.controller.js":(e,t,i)=>{i.r(t),i.d(t,{TextareaItemCtrl:()=>n});class n{constructor(e,t){this.Element=t,this.item=e.extend(this.item||{},{config:{}})}}n.$inject=["Utils","$element"]},"./src/lib/directives/textarea-item/textarea-item.directive.js":(e,t,i)=>{i.r(t),i.d(t,{TextareaItem:()=>r});var n=i("./src/lib/directives/textarea-item/textarea-item.controller.js"),o=i("./src/lib/directives/textarea-item/textarea-item.tpl.html");class r{constructor(){this.restrict="E",this.template=o.default,this.scope={item:"="},this.controller=n.TextareaItemCtrl,this.controllerAs="Textarea",this.bindToController=!0}}r.$inject=[]},"./src/lib/directives/textarea-item/textarea-view.controller.js":(e,t,i)=>{i.r(t),i.d(t,{TextareaViewCtrl:()=>n});class n{constructor(e){this.Utils=e,this.formItem={}}init(){this.formItem=this.Utils.extend(this.formItem,{config:{}})}}n.$inject=["Utils"]},"./src/lib/directives/textarea-item/textarea-view.directive.js":(e,t,i)=>{i.r(t),i.d(t,{TextareaView:()=>r});var n=i("./src/lib/directives/textarea-item/textarea-view.controller.js"),o=i("./src/lib/directives/textarea-item/textarea-view.tpl.html");class r{constructor(e){this.$timeout=e,this.scope={formItem:"=",form:"="},this.restrict="E",this.template=o.default,this.controller=n.TextareaViewCtrl,this.controllerAs="TextareaView",this.bindToController=!0}link(e,t,i,n){this.$timeout((function(){n.init()}),50)}}r.$inject=["$timeout"]},"./src/lib/directives/upload-item/upload-item.controller.js":(e,t,i)=>{i.r(t),i.d(t,{UploadItemCtrl:()=>n});class n{constructor(e,t){this.Element=t,this.item=e.extend(this.item||{},{config:{},options:[]})}}n.$inject=["Utils","$element"]},"./src/lib/directives/upload-item/upload-item.directive.js":(e,t,i)=>{i.r(t),i.d(t,{UploadItem:()=>r});var n=i("./src/lib/directives/upload-item/upload-item.tpl.html"),o=i("./src/lib/directives/upload-item/upload-item.controller.js");class r{constructor(){this.restrict="E",this.template=n.default,this.scope={item:"="},this.controller=o.UploadItemCtrl,this.controllerAs="Upload",this.bindToController=!0}}r.$inject=[]},"./src/lib/directives/upload-item/upload-view.controller.js":(e,t,i)=>{i.r(t),i.d(t,{UploadViewCtrl:()=>n});class n{constructor(e,t,i){this.Scope=e,this.Element=i,this.Utils=t,this.formItem={}}init(){this.isMultiple=!1,this.showAllowed=!1,this.formItem=this.Utils.extend(this.formItem||{},{config:{size:10,uploadFileButtonLabel:"Add files"},options:[]}),this.isPreview()&&this._enableWatchers()}_updateMultiple(){this.isMultiple=!!this.formItem.config.multipleUpload;const e=angular.element(this.Element[0].querySelector("input[type=file]"));e&&(this.formItem.options=[],this.isMultiple?e.attr("multiple","multiple"):e.removeAttr("multiple"))}_updateAccept(){this.showAllowed=!!this.formItem.config.showAccept;const e=angular.element(this.Element[0].querySelector("input[type=file]"));e&&(this.showAllowed?e[0].setAttribute("accept",this.formItem.config.accept):(e[0].removeAttribute("accept"),delete this.formItem.config.accept))}_enableWatchers(){this.Scope.$watch("UploadView.formItem.config.multipleUpload",(e=>{void 0!==e&&this._updateMultiple()})),this.Scope.$watch("UploadView.formItem.config.showAccept",(e=>{void 0!==e&&this._updateAccept()})),this.Scope.$watch("UploadView.formItem.config.accept",(e=>{void 0!==e&&this._updateAccept()}))}removeItem(e){this.formItem.options.splice(e,1)}}n.$inject=["$scope","Utils","$element"]},"./src/lib/directives/upload-item/upload-view.directive.js":(e,t,i)=>{i.r(t),i.d(t,{UploadView:()=>r});var n=i("./src/lib/directives/upload-item/upload-view.controller.js"),o=i("./src/lib/directives/upload-item/upload-view.tpl.html");class r{constructor(e){this.$timeout=e,this.template=o.default,this.restrict="E",this.scope={formItem:"=",isPreview:"&",form:"="},this.controller=n.UploadViewCtrl,this.controllerAs="UploadView",this.bindToController=!0}link(e,t,i,n){this.$timeout((function(){n.init()}),50);const o=angular.element(t[0].querySelector(".upload-button")),r=angular.element(t[0].querySelector("input[type=file]")),s=angular.element(t[0].querySelector("label"));s.length&&s.css("display","none"),o.on("click",(()=>{s.css("display","none"),"function"==typeof r.trigger?r.trigger("click"):r[0].click()})),r.on("change",(t=>{e.$apply((function(){const e=Array.from(t.target.files),i=1048576*n.formItem.config.size;e.some((e=>e.size>=i))?(s.css("display","block"),s.text(n.formItem.config.sizeErrMessage),n.formItem.options=[]):n.formItem.options=e.map((e=>{const{name:t,size:i,type:n}=e;return{name:t,size:i,type:n,file:e}}))}))}))}}r.$inject=["$timeout"]},"./src/lib/index.module.js":(e,t,i)=>{i.r(t),i.d(t,{default:()=>y});i("./src/lib/index.scss");var n=i("./src/lib/directives/upload-item/upload-item.directive.js"),o=i("./src/lib/directives/upload-item/upload-view.directive.js"),r=i("./src/lib/directives/agreement-item/agreement-item.directive.js"),s=i("./src/lib/directives/agreement-item/agreement-view.directive.js"),l=i("./src/lib/main/main.controller.js"),m=i("./src/lib/utils/utils.service.js"),c=i("./src/lib/directives/checkboxes-item/checkboxes-item.directive.js"),a=i("./src/lib/directives/checkboxes-item/checkboxes-view.directive.js"),d=i("./src/lib/directives/form-item/form-item.directive.js"),u=i("./src/lib/directives/form-items-container/form-items-container.directive.js"),p=i("./src/lib/directives/form-view/form-view.directive.js"),h=i("./src/lib/directives/input-item/input-item.directive.js"),b=i("./src/lib/directives/input-item/input-view.directive.js"),v=i("./src/lib/directives/label-item/label-item.directive.js"),f=i("./src/lib/directives/label-item/label-view.directive.js"),g=i("./src/lib/directives/matrix-item/matrix-item.directive.js"),w=i("./src/lib/directives/matrix-item/matrix-view.directive.js"),x=i("./src/lib/directives/radio-button-item/radio-button-item.directive.js"),I=i("./src/lib/directives/radio-button-item/radio-button-view.directive.js"),k=i("./src/lib/directives/select-item/select-view.directive.js"),V=i("./src/lib/directives/select-item/select-item.directive.js"),j=i("./src/lib/directives/textarea-item/textarea-item.directive.js"),$=i("./src/lib/directives/textarea-item/textarea-view.directive.js");const y=angular.module("angularMaterialFormBuilder",["ngMaterial","angular-sortable-view","ngMessages"]).service("Utils",m.Utils).controller("MainController",l.MainController).directive("uploadItem",n.UploadItem).directive("uploadView",o.UploadView).directive("agreementItem",r.AgreementItem).directive("agreementView",s.AgreementView).directive("checkboxesItem",c.CheckboxesItem).directive("checkboxesView",a.CheckboxesView).directive("formItem",d.FormItem).directive("formItemsContainer",u.FormItemsContainer).directive("formView",p.FormView).directive("inputItem",h.InputItem).directive("inputView",b.InputView).directive("labelItem",v.LabelItem).directive("labelView",f.LabelView).directive("matrixItem",g.MatrixItem).directive("matrixView",w.MatrixView).directive("radioButtonItem",x.RadioButtonItem).directive("radioButtonView",I.RadioButtonView).directive("selectItem",V.SelectItem).directive("selectView",k.SelectView).directive("textareaItem",j.TextareaItem).directive("textareaView",$.TextareaView)},"./src/lib/main/main.controller.js":(e,t,i)=>{i.r(t),i.d(t,{MainController:()=>n});class n{constructor(){this.form={items:[]}}addItem(e){this.form.items.push({type:e})}delete(e,t){this.form.items.splice(t,1)}up(e,t){if(0!==t){const i=this.form.items[t-1];this.form.items[t]=i,this.form.items[t-1]=e}}down(e,t){if(t!==this.form.items.length-1){const i=this.form.items[t+1];this.form.items[t]=i,this.form.items[t+1]=e}}}n.$inject=[]},"./src/lib/utils/utils.service.js":(e,t,i)=>{i.r(t),i.d(t,{Utils:()=>n});class n{extend(e,t){return Object.keys(t).reduce(((e,i)=>(void 0===e[i]?e[i]=t[i]:"object"==typeof t[i]&&(e[i]=this.extend(e[i],t[i])),e)),void 0===e?{}:e)}}},"./src/lib/index.scss":(e,t,i)=>{i.r(t)},"./src/lib/directives/agreement-item/agreement-view.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n {{AgreementView.formItem.options[0].value}}\n \n\n
\n
\n Must select {{AgreementView.formItem.maxSelections || 1}} items\n
\n
\n
\n'},"./src/lib/directives/checkboxes-item/checkboxes-item.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n \n \n \n\n \n Layout direction ({{Checkboxes.item.config.direction == \'horizontal\' ?\n \'Horizontal\' : \'Vertical\'}})\n \n\n \n \n reorder\n \n\n \n \n \n \n\n \n delete\n \n \n
\n \n add\n \n
\n\n'},"./src/lib/directives/checkboxes-item/checkboxes-view.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n {{option.value}}\n \n\n
\n
\n Must select {{CheckboxesView.formItem.maxSelections || 1}} items\n
\n
\n
\n'},"./src/lib/directives/form-item/form-item.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='
\n
\n \n delete\n \n \n arrow_drop_up\n \n \n arrow_drop_down\n \n
\n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n
\n \n \n \n \n \n \n \n \n \n

UNKNOWN TYPE

\n
\n\n \n Required field\n \n
\n'},"./src/lib/directives/form-items-container/form-items-container.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='
\n \n \n
\n'},"./src/lib/directives/form-view/form-view.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='
\n \n \n
\n
{{formItem.props.title}}
\n
{{formItem.props.helpText}}
\n\n \n \n \n \n \n \n \n \n \n
\n
\n
\n\n'},"./src/lib/directives/input-item/input-item.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n \n\n\n \n \n Text\n Number\n Email\n \n\n'},"./src/lib/directives/input-item/input-view.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n
\n
This field is required
\n
\n
\n'},"./src/lib/directives/label-item/label-item.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n \n\n'},"./src/lib/directives/label-item/label-view.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n
\n      {{LabelView.formItem.value}}\n    
\n
\n
\n'},"./src/lib/directives/matrix-item/matrix-item.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n \n reorder\n \n\n \n \n \n \n\n \n delete\n Delete\n \n \n
\n Add Column\n
\n\n\n\n \n \n reorder\n \n\n \n \n \n \n\n \n delete\n Delete\n \n \n
\n Add row\n
\n\n'},"./src/lib/directives/matrix-item/matrix-view.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n
\n
\n \n {{column.value}}\n
\n \n {{row.value}}\n \n \n \n \n \n
\n \n\n
\n
This is required
\n
\n
\n'},"./src/lib/directives/radio-button-item/radio-button-item.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n Layout direction ({{RadioButton.item.config.direction == \'horizontal\' ?\n \'Horizontal\' : \'Vertical\'}})\n \n\n \n \n reorder\n \n\n \n \n \n \n\n \n delete\n \n \n\n Add Option\n\n'},"./src/lib/directives/radio-button-item/radio-button-view.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n \n {{option.value}}\n \n \n\n
\n
This field is required
\n
\n
\n'},"./src/lib/directives/select-item/select-item.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n \n reorder\n \n\n \n \n \n \n\n \n delete\n \n \n\n Add Option\n\n'},"./src/lib/directives/select-item/select-view.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n {{ option.value }}\n \n
\n
This field is required
\n
\n
\n'},"./src/lib/directives/textarea-item/textarea-item.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n \n\n'},"./src/lib/directives/textarea-item/textarea-view.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n
\n
This field is required
\n
\n
\n'},"./src/lib/directives/upload-item/upload-item.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='\n \n \n \n \n\n \n Multiple\n \n\n \n Max File size: {{Upload.item.config.size}} Mb\n \n \n\n \n \n \n \n\n \n Configure allowed file types\n \n\n \n \n \n \n\n'},"./src/lib/directives/upload-item/upload-view.tpl.html":(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});const n='
\n \n \n \n \n \n \n\n attach_file{{UploadView.formItem.config.uploadFileButtonLabel}}\n
\n\n
\n \n \n \n close\n \n {{option.name}}\n
\n\n'}},t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={exports:{}};return e[n](o,o.exports,i),o.exports}return i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i("./src/lib/index.module.js")})()})); +//# sourceMappingURL=angular-material-form-builder.min.js.map \ No newline at end of file diff --git a/public/index.html b/public/index.html index f6b4220..1ea369a 100644 --- a/public/index.html +++ b/public/index.html @@ -62,6 +62,10 @@ + + + + @@ -72,10 +76,6 @@ - - - - diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index fb1e95e..ebacad8 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 _0x85a3=['getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x85a3,0x19f));var _0x385a=function(_0x249969,_0x4bcf6d){_0x249969=_0x249969-0x0;var _0x4b4a61=_0x85a3[_0x249969];return _0x4b4a61;};'use strict';var Sequelize=require(_0x385a('0x0'));module[_0x385a('0x1')]={'name':{'type':Sequelize[_0x385a('0x2')],'get':function(_0xbee8db){return this[_0x385a('0x3')](_0x385a('0x4'));}},'action':{'type':Sequelize[_0x385a('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x385a('0x6'),_0x385a('0x7'),_0x385a('0x8'),_0x385a('0x9'),_0x385a('0xa'),_0x385a('0xb'),_0x385a('0xc'),_0x385a('0xd')]],'msg':_0x385a('0xe')}},'comment':_0x385a('0xe')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x385a('0xf')},'data2':{'type':Sequelize[_0x385a('0x5')](0x1000),'comment':_0x385a('0x10')},'data3':{'type':Sequelize[_0x385a('0x5')](0x1000),'comment':_0x385a('0x11')},'data4':{'type':Sequelize[_0x385a('0x5')](0x1000)},'data5':{'type':Sequelize[_0x385a('0x5')](0x1000)},'data6':{'type':Sequelize[_0x385a('0x5')]},'data7':{'type':Sequelize[_0x385a('0x12')]}}; \ No newline at end of file +var _0x304c=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','jscripty','urlForward','browser','bot'];(function(_0x160eaf,_0x924d7a){var _0x541191=function(_0x48c7c5){while(--_0x48c7c5){_0x160eaf['push'](_0x160eaf['shift']());}};_0x541191(++_0x924d7a);}(_0x304c,0x81));var _0xc304=function(_0x2b22cf,_0x2a8c59){_0x2b22cf=_0x2b22cf-0x0;var _0x572e28=_0x304c[_0x2b22cf];return _0x572e28;};'use strict';var Sequelize=require(_0xc304('0x0'));module['exports']={'name':{'type':Sequelize[_0xc304('0x1')],'get':function(_0x18509c){return this[_0xc304('0x2')](_0xc304('0x3'));}},'action':{'type':Sequelize[_0xc304('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xc304('0x5'),'integration',_0xc304('0x6'),_0xc304('0x7'),_0xc304('0x8'),_0xc304('0x9'),_0xc304('0xa'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xc304('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xc304('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xc304('0xd')},'data3':{'type':Sequelize[_0xc304('0x4')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0xc304('0x4')](0x1000)},'data5':{'type':Sequelize[_0xc304('0x4')](0x1000)},'data6':{'type':Sequelize[_0xc304('0x4')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 74c05c8..b5ac119 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 _0xc42a=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','update','Action','params','body','catch','find','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x104af4,_0x3cd4ea){var _0x162361=function(_0x198ec6){while(--_0x198ec6){_0x104af4['push'](_0x104af4['shift']());}};_0x162361(++_0x3cd4ea);}(_0xc42a,0x17a));var _0xac42=function(_0x3611a7,_0x59563c){_0x3611a7=_0x3611a7-0x0;var _0x569692=_0xc42a[_0x3611a7];return _0x569692;};'use strict';var pdf=require(_0xac42('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xac42('0x1'));var jsonpatch=require(_0xac42('0x2'));var rp=require(_0xac42('0x3'));var moment=require(_0xac42('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xac42('0x5'));var util=require(_0xac42('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xac42('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac42('0x8'));var squel=require(_0xac42('0x9'));var crypto=require(_0xac42('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xac42('0xb'));var toCsv=require(_0xac42('0x7'));var querystring=require(_0xac42('0xc'));var Papa=require(_0xac42('0xd'));var Redis=require('ioredis');var authService=require(_0xac42('0xe'));var qs=require(_0xac42('0xf'));var as=require(_0xac42('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xac42('0x11'));var utils=require(_0xac42('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xac42('0x13'));var db=require(_0xac42('0x14'))['db'];function respondWithStatusCode(_0x2297ac,_0x1352c2){_0x1352c2=_0x1352c2||0xcc;return function(_0x1355ae){if(_0x1355ae){return _0x2297ac[_0xac42('0x15')](_0x1352c2);}return _0x2297ac[_0xac42('0x16')](_0x1352c2)['end']();};}function respondWithResult(_0x3b1a7b,_0x57f8a1){_0x57f8a1=_0x57f8a1||0xc8;return function(_0x994e3c){if(_0x994e3c){return _0x3b1a7b['status'](_0x57f8a1)[_0xac42('0x17')](_0x994e3c);}};}function respondWithFilteredResult(_0x11b2d4,_0x5c5aed){return function(_0x1e7a55){if(_0x1e7a55){var _0x2ee92e=_0x1e7a55[_0xac42('0x18')],_0x1634dd=_0x5c5aed[_0xac42('0x19')],_0x4bd779=_0x5c5aed[_0xac42('0x19')]+_0x5c5aed[_0xac42('0x1a')],_0x12ed3f;if(_0x4bd779>=_0x2ee92e){_0x4bd779=_0x2ee92e;_0x12ed3f=0xc8;}else{_0x12ed3f=0xce;}_0x11b2d4['status'](_0x12ed3f);return _0x11b2d4[_0xac42('0x1b')](_0xac42('0x1c'),_0x1634dd+'-'+_0x4bd779+'/'+_0x2ee92e)[_0xac42('0x17')](_0x1e7a55);}return null;};}function patchUpdates(_0x366ccf){return function(_0x504799){try{jsonpatch[_0xac42('0x1d')](_0x504799,_0x366ccf,!![]);}catch(_0x574d3){return BPromise[_0xac42('0x1e')](_0x574d3);}return _0x504799['save']();};}function saveUpdates(_0x1bd8d4,_0x59d8c1){return function(_0x52e362){if(_0x52e362){return _0x52e362['update'](_0x1bd8d4)[_0xac42('0x1f')](function(_0x4dc755){return _0x4dc755;});}return null;};}function removeEntity(_0x51d85b,_0x3658fd){return function(_0x5432f6){if(_0x5432f6){return _0x5432f6[_0xac42('0x20')]()[_0xac42('0x1f')](function(){_0x51d85b['status'](0xcc)[_0xac42('0x21')]();});}};}function handleEntityNotFound(_0x54906c,_0xd73bc4){return function(_0x87afca){if(!_0x87afca){_0x54906c[_0xac42('0x15')](0x194);}return _0x87afca;};}function handleError(_0x2e7337,_0x976eda){_0x976eda=_0x976eda||0x1f4;return function(_0x1ab769){logger[_0xac42('0x22')](_0x1ab769[_0xac42('0x23')]);if(_0x1ab769[_0xac42('0x24')]){delete _0x1ab769[_0xac42('0x24')];}_0x2e7337[_0xac42('0x16')](_0x976eda)[_0xac42('0x25')](_0x1ab769);};}exports[_0xac42('0x26')]=function(_0xb47793,_0x38bf00){if(_0xb47793['body']['id']){delete _0xb47793['body']['id'];}return db[_0xac42('0x27')]['find']({'where':{'id':_0xb47793[_0xac42('0x28')]['id']}})[_0xac42('0x1f')](handleEntityNotFound(_0x38bf00,null))[_0xac42('0x1f')](saveUpdates(_0xb47793[_0xac42('0x29')],null))[_0xac42('0x1f')](respondWithResult(_0x38bf00,null))[_0xac42('0x2a')](handleError(_0x38bf00,null));};exports[_0xac42('0x20')]=function(_0x5cedf3,_0x2165ad){return db[_0xac42('0x27')][_0xac42('0x2b')]({'where':{'id':_0x5cedf3[_0xac42('0x28')]['id']}})[_0xac42('0x1f')](handleEntityNotFound(_0x2165ad,null))['then'](removeEntity(_0x2165ad,null))[_0xac42('0x2a')](handleError(_0x2165ad,null));}; \ No newline at end of file +var _0x65a9=['send','update','body','params','then','Action','find','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','destroy','error','stack','name'];(function(_0x332597,_0x33648e){var _0x70870e=function(_0x415f6f){while(--_0x415f6f){_0x332597['push'](_0x332597['shift']());}};_0x70870e(++_0x33648e);}(_0x65a9,0x6a));var _0x965a=function(_0x370314,_0x38925){_0x370314=_0x370314-0x0;var _0x5e8217=_0x65a9[_0x370314];return _0x5e8217;};'use strict';var pdf=require(_0x965a('0x0'));var emlformat=require(_0x965a('0x1'));var rimraf=require(_0x965a('0x2'));var zipdir=require(_0x965a('0x3'));var jsonpatch=require(_0x965a('0x4'));var rp=require(_0x965a('0x5'));var moment=require(_0x965a('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x965a('0x7'));var path=require(_0x965a('0x8'));var sox=require(_0x965a('0x9'));var csv=require(_0x965a('0xa'));var ejs=require(_0x965a('0xb'));var fs=require('fs');var fs_extra=require(_0x965a('0xc'));var _=require(_0x965a('0xd'));var squel=require(_0x965a('0xe'));var crypto=require(_0x965a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x965a('0x10'));var toCsv=require(_0x965a('0xa'));var querystring=require(_0x965a('0x11'));var Papa=require(_0x965a('0x12'));var Redis=require(_0x965a('0x13'));var authService=require(_0x965a('0x14'));var qs=require(_0x965a('0x15'));var as=require(_0x965a('0x16'));var hardwareService=require(_0x965a('0x17'));var logger=require('../../config/logger')(_0x965a('0x18'));var utils=require('../../config/utils');var config=require(_0x965a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x965a('0x1a'))['db'];function respondWithStatusCode(_0x18ea85,_0x349830){_0x349830=_0x349830||0xcc;return function(_0x1cbfe7){if(_0x1cbfe7){return _0x18ea85[_0x965a('0x1b')](_0x349830);}return _0x18ea85[_0x965a('0x1c')](_0x349830)[_0x965a('0x1d')]();};}function respondWithResult(_0x358406,_0x4589fc){_0x4589fc=_0x4589fc||0xc8;return function(_0xcb005e){if(_0xcb005e){return _0x358406[_0x965a('0x1c')](_0x4589fc)[_0x965a('0x1e')](_0xcb005e);}};}function respondWithFilteredResult(_0x4d4639,_0xa14b53){return function(_0x22cabb){if(_0x22cabb){var _0x4d8ed3=_0x22cabb[_0x965a('0x1f')],_0x3c62fc=_0xa14b53[_0x965a('0x20')],_0x12598a=_0xa14b53[_0x965a('0x20')]+_0xa14b53[_0x965a('0x21')],_0x1341b3;if(_0x12598a>=_0x4d8ed3){_0x12598a=_0x4d8ed3;_0x1341b3=0xc8;}else{_0x1341b3=0xce;}_0x4d4639['status'](_0x1341b3);return _0x4d4639['set']('Content-Range',_0x3c62fc+'-'+_0x12598a+'/'+_0x4d8ed3)[_0x965a('0x1e')](_0x22cabb);}return null;};}function patchUpdates(_0x549e31){return function(_0x4dca1b){try{jsonpatch[_0x965a('0x22')](_0x4dca1b,_0x549e31,!![]);}catch(_0x58a423){return BPromise[_0x965a('0x23')](_0x58a423);}return _0x4dca1b[_0x965a('0x24')]();};}function saveUpdates(_0x2d3d1e,_0x3abf52){return function(_0x383ef0){if(_0x383ef0){return _0x383ef0['update'](_0x2d3d1e)['then'](function(_0x3acd7c){return _0x3acd7c;});}return null;};}function removeEntity(_0x39db1e,_0x2567ca){return function(_0x3bae43){if(_0x3bae43){return _0x3bae43[_0x965a('0x25')]()['then'](function(){_0x39db1e[_0x965a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cb714,_0x4b0cff){return function(_0x58c828){if(!_0x58c828){_0x5cb714[_0x965a('0x1b')](0x194);}return _0x58c828;};}function handleError(_0x9637f3,_0xd00ba9){_0xd00ba9=_0xd00ba9||0x1f4;return function(_0x59cf44){logger[_0x965a('0x26')](_0x59cf44[_0x965a('0x27')]);if(_0x59cf44[_0x965a('0x28')]){delete _0x59cf44[_0x965a('0x28')];}_0x9637f3['status'](_0xd00ba9)[_0x965a('0x29')](_0x59cf44);};}exports[_0x965a('0x2a')]=function(_0x53bcf2,_0x370bf0){if(_0x53bcf2['body']['id']){delete _0x53bcf2[_0x965a('0x2b')]['id'];}return db['Action']['find']({'where':{'id':_0x53bcf2[_0x965a('0x2c')]['id']}})[_0x965a('0x2d')](handleEntityNotFound(_0x370bf0,null))[_0x965a('0x2d')](saveUpdates(_0x53bcf2[_0x965a('0x2b')],null))[_0x965a('0x2d')](respondWithResult(_0x370bf0,null))['catch'](handleError(_0x370bf0,null));};exports[_0x965a('0x25')]=function(_0x4bf16b,_0x2e8eab){return db[_0x965a('0x2e')][_0x965a('0x2f')]({'where':{'id':_0x4bf16b['params']['id']}})[_0x965a('0x2d')](handleEntityNotFound(_0x2e8eab,null))[_0x965a('0x2d')](removeEntity(_0x2e8eab,null))[_0x965a('0x30')](handleError(_0x2e8eab,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 89e3b37..a9b0109 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 _0x655c=['bluebird','path','rimraf','../../config/environment','./action.attributes','Action','tools_actions','lodash','util','../../config/logger','api','moment'];(function(_0x3d09ec,_0xf30d0f){var _0x4dcbd8=function(_0x944b6d){while(--_0x944b6d){_0x3d09ec['push'](_0x3d09ec['shift']());}};_0x4dcbd8(++_0xf30d0f);}(_0x655c,0x163));var _0xc655=function(_0x414ef0,_0x507dd8){_0x414ef0=_0x414ef0-0x0;var _0xaaadbd=_0x655c[_0x414ef0];return _0xaaadbd;};'use strict';var _=require(_0xc655('0x0'));var util=require(_0xc655('0x1'));var logger=require(_0xc655('0x2'))(_0xc655('0x3'));var moment=require(_0xc655('0x4'));var BPromise=require(_0xc655('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc655('0x6'));var rimraf=require(_0xc655('0x7'));var config=require(_0xc655('0x8'));var attributes=require(_0xc655('0x9'));module['exports']=function(_0x5ded79,_0x58b276){return _0x5ded79['define'](_0xc655('0xa'),attributes,{'tableName':_0xc655('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47f8=['rimraf','../../config/environment','./action.attributes','exports','tools_actions','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47f8,0x191));var _0x847f=function(_0x48f3e4,_0x41a294){_0x48f3e4=_0x48f3e4-0x0;var _0x559b5f=_0x47f8[_0x48f3e4];return _0x559b5f;};'use strict';var _=require(_0x847f('0x0'));var util=require(_0x847f('0x1'));var logger=require(_0x847f('0x2'))(_0x847f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x847f('0x4'));var fs=require('fs');var path=require(_0x847f('0x5'));var rimraf=require(_0x847f('0x6'));var config=require(_0x847f('0x7'));var attributes=require(_0x847f('0x8'));module[_0x847f('0x9')]=function(_0xf4fd73,_0x4370da){return _0xf4fd73['define']('Action',attributes,{'tableName':_0x847f('0xa'),'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 c53d3f0..eae7ec6 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 _0x70e0=['code','Action,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xe6d141,_0x192c19){var _0x5e470b=function(_0x49e816){while(--_0x49e816){_0xe6d141['push'](_0xe6d141['shift']());}};_0x5e470b(++_0x192c19);}(_0x70e0,0x17b));var _0x070e=function(_0x455e72,_0xc76ee7){_0x455e72=_0x455e72-0x0;var _0x28c1aa=_0x70e0[_0x455e72];return _0x28c1aa;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('Action,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('Action,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x40d339,_0xb726c3){var _0x5cbd0b=function(_0xf239d3){while(--_0xf239d3){_0x40d339['push'](_0x40d339['shift']());}};_0x5cbd0b(++_0xb726c3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index f13ad77..9862bb5 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 _0x355e=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete'];(function(_0xf707f5,_0x566532){var _0x246899=function(_0x18f2aa){while(--_0x18f2aa){_0xf707f5['push'](_0xf707f5['shift']());}};_0x246899(++_0x566532);}(_0x355e,0xa7));var _0xe355=function(_0x1daafa,_0x5562d5){_0x1daafa=_0x1daafa-0x0;var _0x421f30=_0x355e[_0x1daafa];return _0x421f30;};'use strict';var multer=require(_0xe355('0x0'));var util=require(_0xe355('0x1'));var path=require('path');var timeout=require(_0xe355('0x2'));var express=require(_0xe355('0x3'));var router=express[_0xe355('0x4')]();var fs_extra=require(_0xe355('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe355('0x6'));var controller=require(_0xe355('0x7'));router[_0xe355('0x8')](_0xe355('0x9'),auth[_0xe355('0xa')](),controller[_0xe355('0xb')]);router[_0xe355('0xc')](_0xe355('0x9'),auth['isAuthenticated'](),controller[_0xe355('0xd')]);module[_0xe355('0xe')]=router; \ No newline at end of file +var _0xab1e=['express','Router','fs-extra','../../components/auth/service','./action.controller','/:id','update','isAuthenticated','exports','connect-timeout'];(function(_0x1d4bd7,_0x4ae21e){var _0xb42592=function(_0x321a6f){while(--_0x321a6f){_0x1d4bd7['push'](_0x1d4bd7['shift']());}};_0xb42592(++_0x4ae21e);}(_0xab1e,0x81));var _0xeab1=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xab1e[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xeab1('0x0'));var express=require(_0xeab1('0x1'));var router=express[_0xeab1('0x2')]();var fs_extra=require(_0xeab1('0x3'));var auth=require(_0xeab1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeab1('0x5'));router['put'](_0xeab1('0x6'),auth['isAuthenticated'](),controller[_0xeab1('0x7')]);router['delete'](_0xeab1('0x6'),auth[_0xeab1('0x8')](),controller['destroy']);module[_0xeab1('0x9')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 48670c9..25d01fa 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 _0x75a3=['STRING','TEXT','exports'];(function(_0x7b360c,_0x5cec49){var _0x2dad8e=function(_0x560e7f){while(--_0x560e7f){_0x7b360c['push'](_0x7b360c['shift']());}};_0x2dad8e(++_0x5cec49);}(_0x75a3,0x158));var _0x375a=function(_0x1b4ced,_0x28dfd1){_0x1b4ced=_0x1b4ced-0x0;var _0x34c145=_0x75a3[_0x1b4ced];return _0x34c145;};'use strict';var Sequelize=require('sequelize');module[_0x375a('0x0')]={'name':{'type':Sequelize[_0x375a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x375a('0x1')]},'parent':{'type':Sequelize[_0x375a('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x375a('0x2')]},'joins':{'type':Sequelize[_0x375a('0x2')]}}; \ No newline at end of file +var _0xde7e=['exports','STRING','TEXT','sequelize'];(function(_0x2b4232,_0x1c8e4c){var _0x50bc34=function(_0x133c0c){while(--_0x133c0c){_0x2b4232['push'](_0x2b4232['shift']());}};_0x50bc34(++_0x1c8e4c);}(_0xde7e,0xcb));var _0xede7=function(_0x21839b,_0x167dd3){_0x21839b=_0x21839b-0x0;var _0x4ddde3=_0xde7e[_0x21839b];return _0x4ddde3;};'use strict';var Sequelize=require(_0xede7('0x0'));module[_0xede7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xede7('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xede7('0x2')]},'conditions':{'type':Sequelize[_0xede7('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index baa6f3d..ce93414 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 _0x2ada=['AnalyticMetric','table','MetricId','metric','function','replace','format','groupBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','right_join','cross_join','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20EMPTY','operator','keyBy','select','orderBy','output','fullPath','%s-%s.%s','randomstring','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','savename','from','countTable','COUNT(*)','run','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','crypto','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field'];(function(_0x59a284,_0x28c308){var _0x3de2cf=function(_0x1bd4bf){while(--_0x1bd4bf){_0x59a284['push'](_0x59a284['shift']());}};_0x3de2cf(++_0x28c308);}(_0x2ada,0xda));var _0xa2ad=function(_0x377f50,_0x5589ba){_0x377f50=_0x377f50-0x0;var _0x14a9d2=_0x2ada[_0x377f50];return _0x14a9d2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa2ad('0x0'));var rimraf=require(_0xa2ad('0x1'));var zipdir=require(_0xa2ad('0x2'));var jsonpatch=require(_0xa2ad('0x3'));var rp=require(_0xa2ad('0x4'));var moment=require(_0xa2ad('0x5'));var BPromise=require(_0xa2ad('0x6'));var Mustache=require('mustache');var util=require(_0xa2ad('0x7'));var path=require('path');var sox=require(_0xa2ad('0x8'));var csv=require('to-csv');var ejs=require(_0xa2ad('0x9'));var fs=require('fs');var fs_extra=require(_0xa2ad('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2ad('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa2ad('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa2ad('0xd'));var hardwareService=require(_0xa2ad('0xe'));var logger=require(_0xa2ad('0xf'))(_0xa2ad('0x10'));var utils=require(_0xa2ad('0x11'));var config=require(_0xa2ad('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2ad('0x13'))['db'];var dbH=require(_0xa2ad('0x13'))['dbH'];function respondWithStatusCode(_0x48c972,_0x3affb4){_0x3affb4=_0x3affb4||0xcc;return function(_0x2c1a73){if(_0x2c1a73){return _0x48c972[_0xa2ad('0x14')](_0x3affb4);}return _0x48c972[_0xa2ad('0x15')](_0x3affb4)[_0xa2ad('0x16')]();};}function respondWithResult(_0x97a2b9,_0x5c6883){_0x5c6883=_0x5c6883||0xc8;return function(_0x4a20df){if(_0x4a20df){return _0x97a2b9['status'](_0x5c6883)['json'](_0x4a20df);}};}function respondWithFilteredResult(_0x52a559,_0x524f){return function(_0x1f0fab){if(_0x1f0fab){var _0x3ae5ec=_0x1f0fab[_0xa2ad('0x17')],_0x4399b8=_0x524f[_0xa2ad('0x18')],_0x576575=_0x524f[_0xa2ad('0x18')]+_0x524f[_0xa2ad('0x19')],_0x1e2ac4;if(_0x576575>=_0x3ae5ec){_0x576575=_0x3ae5ec;_0x1e2ac4=0xc8;}else{_0x1e2ac4=0xce;}_0x52a559[_0xa2ad('0x15')](_0x1e2ac4);return _0x52a559[_0xa2ad('0x1a')](_0xa2ad('0x1b'),_0x4399b8+'-'+_0x576575+'/'+_0x3ae5ec)[_0xa2ad('0x1c')](_0x1f0fab);}return null;};}function patchUpdates(_0x5ec712){return function(_0x20ca9e){try{jsonpatch[_0xa2ad('0x1d')](_0x20ca9e,_0x5ec712,!![]);}catch(_0x4e578d){return BPromise[_0xa2ad('0x1e')](_0x4e578d);}return _0x20ca9e[_0xa2ad('0x1f')]();};}function saveUpdates(_0x4bed25,_0x5ef96b){return function(_0x5e3748){if(_0x5e3748){return _0x5e3748[_0xa2ad('0x20')](_0x4bed25)[_0xa2ad('0x21')](function(_0x180c61){return _0x180c61;});}return null;};}function removeEntity(_0x5675fa,_0x1f15ef){return function(_0x4d7830){if(_0x4d7830){return _0x4d7830[_0xa2ad('0x22')]()[_0xa2ad('0x21')](function(){var _0x35adc7=_0x4d7830['get']({'plain':!![]});var _0x4379a1='CustomReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x4379a1,'resourceId':_0x35adc7['id']}})[_0xa2ad('0x21')](function(){return _0x4d7830;});})['then'](function(){_0x5675fa[_0xa2ad('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x496c84,_0x4e7440){return function(_0x3264a5){if(!_0x3264a5){_0x496c84[_0xa2ad('0x14')](0x194);}return _0x3264a5;};}function handleError(_0xf2a54f,_0x4e38ca){_0x4e38ca=_0x4e38ca||0x1f4;return function(_0xfde6e9){logger['error'](_0xfde6e9[_0xa2ad('0x23')]);if(_0xfde6e9[_0xa2ad('0x24')]){delete _0xfde6e9[_0xa2ad('0x24')];}_0xf2a54f['status'](_0x4e38ca)[_0xa2ad('0x25')](_0xfde6e9);};}exports[_0xa2ad('0x26')]=function(_0xee4fd3,_0x1b5ff4){var _0x270ec6={},_0x3757b6={},_0x47f5b3={'count':0x0,'rows':[]};var _0x1c0a34=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x354d90){return{'name':_0x354d90[_0xa2ad('0x27')],'type':_0x354d90[_0xa2ad('0x28')][_0xa2ad('0x29')]};});_0x3757b6[_0xa2ad('0x2a')]=_[_0xa2ad('0x2b')](_0x1c0a34,'name');_0x3757b6[_0xa2ad('0x2c')]=_[_0xa2ad('0x2d')](_0xee4fd3[_0xa2ad('0x2c')]);_0x3757b6[_0xa2ad('0x2e')]=_['intersection'](_0x3757b6[_0xa2ad('0x2a')],_0x3757b6[_0xa2ad('0x2c')]);_0x270ec6['attributes']=_[_0xa2ad('0x2f')](_0x3757b6['model'],qs[_0xa2ad('0x30')](_0xee4fd3[_0xa2ad('0x2c')][_0xa2ad('0x30')]));_0x270ec6[_0xa2ad('0x31')]=_0x270ec6[_0xa2ad('0x31')]['length']?_0x270ec6[_0xa2ad('0x31')]:_0x3757b6[_0xa2ad('0x2a')];if(!_0xee4fd3['query'][_0xa2ad('0x32')]('nolimit')){_0x270ec6[_0xa2ad('0x19')]=qs[_0xa2ad('0x19')](_0xee4fd3['query'][_0xa2ad('0x19')]);_0x270ec6['offset']=qs[_0xa2ad('0x18')](_0xee4fd3[_0xa2ad('0x2c')]['offset']);}_0x270ec6[_0xa2ad('0x33')]=qs[_0xa2ad('0x34')](_0xee4fd3[_0xa2ad('0x2c')][_0xa2ad('0x34')]);_0x270ec6[_0xa2ad('0x35')]=qs[_0xa2ad('0x2e')](_[_0xa2ad('0x36')](_0xee4fd3[_0xa2ad('0x2c')],_0x3757b6[_0xa2ad('0x2e')]),_0x1c0a34);if(_0xee4fd3[_0xa2ad('0x2c')][_0xa2ad('0x37')]){_0x270ec6[_0xa2ad('0x35')]=_[_0xa2ad('0x38')](_0x270ec6[_0xa2ad('0x35')],{'$or':_[_0xa2ad('0x2b')](_0x1c0a34,function(_0x4e455f){if(_0x4e455f[_0xa2ad('0x28')]!==_0xa2ad('0x39')){var _0x386cda={};_0x386cda[_0x4e455f[_0xa2ad('0x24')]]={'$like':'%'+_0xee4fd3[_0xa2ad('0x2c')][_0xa2ad('0x37')]+'%'};return _0x386cda;}})});}_0x270ec6=_['merge']({},_0x270ec6,_0xee4fd3[_0xa2ad('0x3a')]);var _0x2a829c={'where':_0x270ec6[_0xa2ad('0x35')]};return db[_0xa2ad('0x3b')][_0xa2ad('0x17')](_0x2a829c)[_0xa2ad('0x21')](function(_0x3fe629){_0x47f5b3['count']=_0x3fe629;if(_0xee4fd3[_0xa2ad('0x2c')]['includeAll']){_0x270ec6[_0xa2ad('0x3c')]=[{'all':!![]}];}return db[_0xa2ad('0x3b')][_0xa2ad('0x3d')](_0x270ec6);})['then'](function(_0x4179ff){_0x47f5b3[_0xa2ad('0x3e')]=_0x4179ff;return _0x47f5b3;})['then'](respondWithFilteredResult(_0x1b5ff4,_0x270ec6))[_0xa2ad('0x3f')](handleError(_0x1b5ff4,null));};exports['show']=function(_0x5ca31f,_0x65f868){var _0x1874f2={'raw':![],'where':{'id':_0x5ca31f[_0xa2ad('0x40')]['id']}},_0x4b1ebe={};_0x4b1ebe[_0xa2ad('0x2a')]=_[_0xa2ad('0x2d')](db[_0xa2ad('0x3b')][_0xa2ad('0x41')]);_0x4b1ebe[_0xa2ad('0x2c')]=_[_0xa2ad('0x2d')](_0x5ca31f['query']);_0x4b1ebe['filters']=_[_0xa2ad('0x2f')](_0x4b1ebe[_0xa2ad('0x2a')],_0x4b1ebe[_0xa2ad('0x2c')]);_0x1874f2[_0xa2ad('0x31')]=_[_0xa2ad('0x2f')](_0x4b1ebe[_0xa2ad('0x2a')],qs[_0xa2ad('0x30')](_0x5ca31f[_0xa2ad('0x2c')]['fields']));_0x1874f2['attributes']=_0x1874f2[_0xa2ad('0x31')][_0xa2ad('0x42')]?_0x1874f2[_0xa2ad('0x31')]:_0x4b1ebe[_0xa2ad('0x2a')];if(_0x5ca31f[_0xa2ad('0x2c')][_0xa2ad('0x43')]){_0x1874f2[_0xa2ad('0x3c')]=[{'all':!![]}];}_0x1874f2=_[_0xa2ad('0x38')]({},_0x1874f2,_0x5ca31f[_0xa2ad('0x3a')]);return db[_0xa2ad('0x3b')]['find'](_0x1874f2)['then'](handleEntityNotFound(_0x65f868,null))[_0xa2ad('0x21')](respondWithResult(_0x65f868,null))[_0xa2ad('0x3f')](handleError(_0x65f868,null));};exports['create']=function(_0x3453a3,_0x4f9e0e){return db[_0xa2ad('0x3b')][_0xa2ad('0x44')](_0x3453a3['body'],{})[_0xa2ad('0x21')](function(_0x82f27d){var _0x34a011=_0x3453a3[_0xa2ad('0x45')][_0xa2ad('0x46')]({'plain':!![]});if(!_0x34a011)throw new Error(_0xa2ad('0x47'));if(_0x34a011[_0xa2ad('0x48')]===_0xa2ad('0x45')){var _0x275c1e=_0x82f27d[_0xa2ad('0x46')]({'plain':!![]});var _0x371936=_0xa2ad('0x49');return db[_0xa2ad('0x4a')][_0xa2ad('0x4b')]({'where':{'name':_0x371936,'userProfileId':_0x34a011[_0xa2ad('0x4c')]},'raw':!![]})['then'](function(_0x4a0bb9){if(_0x4a0bb9&&_0x4a0bb9[_0xa2ad('0x4d')]===0x0){return db[_0xa2ad('0x4e')][_0xa2ad('0x44')]({'name':_0x275c1e['name'],'resourceId':_0x275c1e['id'],'type':_0xa2ad('0x4f'),'sectionId':_0x4a0bb9['id']},{})['then'](function(){return _0x82f27d;});}else{return _0x82f27d;}})['catch'](function(_0x19cfe1){logger['error'](_0xa2ad('0x50'),_0x19cfe1);throw _0x19cfe1;});}return _0x82f27d;})['then'](respondWithResult(_0x4f9e0e,0xc9))[_0xa2ad('0x3f')](handleError(_0x4f9e0e,null));};exports[_0xa2ad('0x20')]=function(_0x41a119,_0x1f12cb){if(_0x41a119[_0xa2ad('0x51')]['id']){delete _0x41a119[_0xa2ad('0x51')]['id'];}return db[_0xa2ad('0x3b')]['find']({'where':{'id':_0x41a119['params']['id']}})['then'](handleEntityNotFound(_0x1f12cb,null))[_0xa2ad('0x21')](saveUpdates(_0x41a119[_0xa2ad('0x51')],null))[_0xa2ad('0x21')](respondWithResult(_0x1f12cb,null))[_0xa2ad('0x3f')](handleError(_0x1f12cb,null));};exports[_0xa2ad('0x22')]=function(_0x5365bf,_0x8b3eb2){return db[_0xa2ad('0x3b')][_0xa2ad('0x4b')]({'where':{'id':_0x5365bf[_0xa2ad('0x40')]['id']}})[_0xa2ad('0x21')](handleEntityNotFound(_0x8b3eb2,null))[_0xa2ad('0x21')](removeEntity(_0x8b3eb2,null))[_0xa2ad('0x3f')](handleError(_0x8b3eb2,null));};exports[_0xa2ad('0x52')]=function(_0x19dcd7,_0x4a7e9a){var _0x2962a1=0xa;var _0x5cffa0=[_0xa2ad('0x53'),'left_join','right_join','cross_join'];var _0x18e776={'SUM':_0xa2ad('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa2ad('0x55'),'MAX':_0xa2ad('0x56'),'MIN':_0xa2ad('0x57'),'AVG':_0xa2ad('0x58'),'GROUP_CONCAT':_0xa2ad('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x187281={'SEC_TO_TIME':_0xa2ad('0x5a'),'DATE':_0xa2ad('0x5b'),'HOUR':_0xa2ad('0x5c'),'ROUND':_0xa2ad('0x5d'),'UNIX_TIMESTAMP':_0xa2ad('0x5e')};var _0x5b423f=function(_0x47b179){return!_[_0xa2ad('0x5f')]([_0xa2ad('0x60'),_0xa2ad('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x47b179);};var _0x3dbd81=function(_0x20f659){if(!_0x20f659||!_0x20f659[_0xa2ad('0x62')][_0xa2ad('0x42')]){return'';}for(var _0x33e598='(',_0x5d6878=0x0;_0x5d6878<_0x20f659[_0xa2ad('0x62')][_0xa2ad('0x42')];_0x5d6878+=0x1){_0x5d6878>0x0&&(_0x33e598+='\x20'+_0x20f659['operator']+'\x20');_0x33e598+=_0x20f659['rules'][_0x5d6878][_0xa2ad('0x63')]?_0x3dbd81(_0x20f659[_0xa2ad('0x62')][_0x5d6878]['group']):_0x20f659[_0xa2ad('0x62')][_0x5d6878][_0xa2ad('0x64')]+'\x20'+_0x20f659[_0xa2ad('0x62')][_0x5d6878][_0xa2ad('0x65')]+(_0x5b423f(_0x20f659[_0xa2ad('0x62')][_0x5d6878]['condition'])?'\x20'+_0x20f659['rules'][_0x5d6878][_0xa2ad('0x66')]:'');}return _0x33e598+')';};var _0x52b693={'where':{'id':_0x19dcd7['params']['id']}},_0x5c0c19,_0x50b4f3,_0x310c1a,_0x461c4b,_0x3eb905;_0x52b693=_[_0xa2ad('0x38')]({},_0x52b693,_0x19dcd7[_0xa2ad('0x3a')]);return db[_0xa2ad('0x3b')][_0xa2ad('0x4b')](_0x52b693)[_0xa2ad('0x21')](function(_0x7c2345){if(_0x7c2345){_0x5c0c19=_0x7c2345;return _0x7c2345[_0xa2ad('0x67')]();}return null;})[_0xa2ad('0x21')](function(_0x125c8c){if(_0x125c8c){if(!_0x125c8c['length']){throw new db[(_0xa2ad('0x68'))]['ValidationErrorItem'](_0xa2ad('0x69'),0x193);}_0x50b4f3=_0x125c8c;return db[_0xa2ad('0x6a')][_0xa2ad('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x483b52){if(_0x483b52){_0x310c1a=_['keyBy'](_0x483b52,'id');var _0x11e6d3;var _0x2c5045=squel['select']();_0x2c5045['from'](_0x5c0c19[_0xa2ad('0x6b')]);for(var _0x3ed59e=0x0;_0x3ed59e<_0x50b4f3[_0xa2ad('0x42')];_0x3ed59e+=0x1){_0x11e6d3=_0x50b4f3[_0x3ed59e][_0xa2ad('0x6c')]?_0x310c1a[_0x50b4f3[_0x3ed59e][_0xa2ad('0x6c')]][_0xa2ad('0x6d')]:_0x50b4f3[_0x3ed59e][_0xa2ad('0x64')];_0x11e6d3=_0x50b4f3[_0x3ed59e][_0xa2ad('0x6e')]?_[_0xa2ad('0x6f')](_0x18e776[_0x50b4f3[_0x3ed59e]['function']],'%s',_0x11e6d3):_0x11e6d3;_0x11e6d3=_0x50b4f3[_0x3ed59e]['format']?_[_0xa2ad('0x6f')](_0x187281[_0x50b4f3[_0x3ed59e][_0xa2ad('0x70')]],'%s',_0x11e6d3):_0x11e6d3;if(_0x50b4f3[_0x3ed59e][_0xa2ad('0x71')]){_0x2c5045[_0xa2ad('0x63')](_0x11e6d3);}_0x50b4f3[_0x3ed59e]['orderBy']&&_0x2c5045['order'](_0x11e6d3,_0x50b4f3[_0x3ed59e]['orderBy']===_0xa2ad('0x72')?![]:!![]);_0x2c5045[_0xa2ad('0x64')](_0x11e6d3,_0x50b4f3[_0x3ed59e][_0xa2ad('0x73')]||_0x11e6d3);}if(_0x5c0c19[_0xa2ad('0x74')]){_0x5c0c19[_0xa2ad('0x74')]=JSON[_0xa2ad('0x75')](_0x5c0c19[_0xa2ad('0x74')]);for(var _0x15275d=0x0;_0x15275d<_0x5c0c19['joins']['length'];_0x15275d+=0x1){if(_0x5c0c19[_0xa2ad('0x74')][_0x15275d][_0xa2ad('0x28')]&&_[_0xa2ad('0x5f')](_0x5cffa0,_0x5c0c19['joins'][_0x15275d][_0xa2ad('0x28')])&&_0x5c0c19[_0xa2ad('0x74')][_0x15275d]['parentKey']&&_0x5c0c19[_0xa2ad('0x74')][_0x15275d][_0xa2ad('0x76')]&&_0x5c0c19['joins'][_0x15275d]['foreignKey']){_0x2c5045[_0x5c0c19['joins'][_0x15275d][_0xa2ad('0x28')]](_0x5c0c19[_0xa2ad('0x74')][_0x15275d][_0xa2ad('0x76')],null,util[_0xa2ad('0x70')](_0xa2ad('0x77'),_0x5c0c19[_0xa2ad('0x6b')],_0x5c0c19[_0xa2ad('0x74')][_0x15275d][_0xa2ad('0x78')],_0x5c0c19['joins'][_0x15275d][_0xa2ad('0x76')],_0x5c0c19['joins'][_0x15275d][_0xa2ad('0x79')]));}}}if(_0x5c0c19[_0xa2ad('0x7a')]){_0x5c0c19['conditions']=JSON[_0xa2ad('0x75')](_0x5c0c19[_0xa2ad('0x7a')]);_0x2c5045[_0xa2ad('0x35')](_0x3dbd81(_0x5c0c19[_0xa2ad('0x7a')]['group']));}_0x3eb905=_0x2c5045[_0xa2ad('0x7b')]();_0x2c5045[_0xa2ad('0x19')](_0x2962a1);_0x2c5045[_0xa2ad('0x18')](0x0);logger[_0xa2ad('0x7c')](_0xa2ad('0x7d'),_0x2c5045[_0xa2ad('0x7e')]());return dbH[_0xa2ad('0x7f')][_0xa2ad('0x2c')](_0x2c5045[_0xa2ad('0x7e')](),{'type':dbH['sequelize'][_0xa2ad('0x80')][_0xa2ad('0x81')]});}})[_0xa2ad('0x21')](respondWithResult(_0x4a7e9a,null))['catch'](handleError(_0x4a7e9a,null));};function runReport(_0x59947f,_0xdb894c,_0x57c6b3){var _0x3a4fbe=_0xdb894c[_0xa2ad('0x24')];var _0xf9814d=0xa;var _0x522451=[_0xa2ad('0x53'),_0xa2ad('0x82'),_0xa2ad('0x83'),_0xa2ad('0x84')];var _0x43b6a4={'SUM':'SUM(%s)','COUNT':_0xa2ad('0x85'),'COUNT DISTINCT':_0xa2ad('0x55'),'MAX':_0xa2ad('0x56'),'MIN':_0xa2ad('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xa2ad('0x59'),'GROUP_CONCAT ASC':_0xa2ad('0x86'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1b760c={'SEC_TO_TIME':_0xa2ad('0x5a'),'DATE':_0xa2ad('0x5b'),'HOUR':_0xa2ad('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xa2ad('0x5e')};var _0x114651=function(_0x5f4d6c){return!_[_0xa2ad('0x5f')]([_0xa2ad('0x60'),_0xa2ad('0x61'),_0xa2ad('0x87'),'IS\x20NOT\x20EMPTY'],_0x5f4d6c);};var _0x15750b=function(_0x34fa69){if(!_0x34fa69||!_0x34fa69[_0xa2ad('0x62')][_0xa2ad('0x42')]){return'';}for(var _0x509dbf='(',_0x46aeb5=0x0;_0x46aeb5<_0x34fa69['rules']['length'];_0x46aeb5+=0x1){_0x46aeb5>0x0&&(_0x509dbf+='\x20'+_0x34fa69[_0xa2ad('0x88')]+'\x20');_0x509dbf+=_0x34fa69[_0xa2ad('0x62')][_0x46aeb5][_0xa2ad('0x63')]?_0x15750b(_0x34fa69[_0xa2ad('0x62')][_0x46aeb5]['group']):_0x34fa69[_0xa2ad('0x62')][_0x46aeb5][_0xa2ad('0x64')]+'\x20'+_0x34fa69['rules'][_0x46aeb5][_0xa2ad('0x65')]+(_0x114651(_0x34fa69[_0xa2ad('0x62')][_0x46aeb5][_0xa2ad('0x65')])?'\x20'+_0x34fa69['rules'][_0x46aeb5][_0xa2ad('0x66')]:'');}return _0x509dbf+')';};var _0x4cc65f={'where':{'id':_0x59947f['id']}},_0x42fa98,_0x20017e,_0x32809b,_0xefc153,_0x485cfc;_0x4cc65f=_['merge']({},_0x4cc65f,_0x57c6b3);return db[_0xa2ad('0x3b')]['find'](_0x4cc65f)['then'](function(_0x49b315){if(_0x49b315){_0x42fa98=_0x49b315;return _0x49b315[_0xa2ad('0x67')]();}return null;})[_0xa2ad('0x21')](function(_0x4ad506){if(_0x4ad506){if(!_0x4ad506[_0xa2ad('0x42')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x20017e=_0x4ad506;return db[_0xa2ad('0x6a')][_0xa2ad('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x5b2852){if(_0x5b2852){_0x32809b=_[_0xa2ad('0x89')](_0x5b2852,'id');var _0x36f5f5;var _0x4b51c0=squel[_0xa2ad('0x8a')]();_0x4b51c0['from'](_0x42fa98[_0xa2ad('0x6b')]);for(var _0x4bd354=0x0;_0x4bd354<_0x20017e[_0xa2ad('0x42')];_0x4bd354+=0x1){_0x36f5f5=_0x20017e[_0x4bd354]['MetricId']?_0x32809b[_0x20017e[_0x4bd354]['MetricId']][_0xa2ad('0x6d')]:_0x20017e[_0x4bd354]['field'];_0x36f5f5=_0x20017e[_0x4bd354][_0xa2ad('0x6e')]?_[_0xa2ad('0x6f')](_0x43b6a4[_0x20017e[_0x4bd354][_0xa2ad('0x6e')]],'%s',_0x36f5f5):_0x36f5f5;_0x36f5f5=_0x20017e[_0x4bd354][_0xa2ad('0x70')]?_[_0xa2ad('0x6f')](_0x1b760c[_0x20017e[_0x4bd354][_0xa2ad('0x70')]],'%s',_0x36f5f5):_0x36f5f5;if(_0x20017e[_0x4bd354][_0xa2ad('0x71')]){_0x4b51c0[_0xa2ad('0x63')](_0x36f5f5);}_0x20017e[_0x4bd354][_0xa2ad('0x8b')]&&_0x4b51c0[_0xa2ad('0x33')](_0x36f5f5,_0x20017e[_0x4bd354][_0xa2ad('0x8b')]===_0xa2ad('0x72')?![]:!![]);_0x4b51c0[_0xa2ad('0x64')](_0x36f5f5,_0x20017e[_0x4bd354][_0xa2ad('0x73')]||_0x36f5f5);}if(_0x42fa98[_0xa2ad('0x74')]){_0x42fa98['joins']=JSON['parse'](_0x42fa98[_0xa2ad('0x74')]);for(var _0x21b397=0x0;_0x21b397<_0x42fa98[_0xa2ad('0x74')][_0xa2ad('0x42')];_0x21b397+=0x1){if(_0x42fa98[_0xa2ad('0x74')][_0x21b397][_0xa2ad('0x28')]&&_[_0xa2ad('0x5f')](_0x522451,_0x42fa98[_0xa2ad('0x74')][_0x21b397][_0xa2ad('0x28')])&&_0x42fa98['joins'][_0x21b397][_0xa2ad('0x78')]&&_0x42fa98[_0xa2ad('0x74')][_0x21b397][_0xa2ad('0x76')]&&_0x42fa98[_0xa2ad('0x74')][_0x21b397][_0xa2ad('0x79')]){_0x4b51c0[_0x42fa98[_0xa2ad('0x74')][_0x21b397][_0xa2ad('0x28')]](_0x42fa98[_0xa2ad('0x74')][_0x21b397][_0xa2ad('0x76')],null,util[_0xa2ad('0x70')](_0xa2ad('0x77'),_0x42fa98[_0xa2ad('0x6b')],_0x42fa98[_0xa2ad('0x74')][_0x21b397]['parentKey'],_0x42fa98[_0xa2ad('0x74')][_0x21b397]['foreignTable'],_0x42fa98[_0xa2ad('0x74')][_0x21b397][_0xa2ad('0x79')]));}}}if(_0x42fa98[_0xa2ad('0x7a')]){_0x42fa98[_0xa2ad('0x7a')]=JSON[_0xa2ad('0x75')](_0x42fa98['conditions']);_0x4b51c0['where'](_0x15750b(_0x42fa98[_0xa2ad('0x7a')][_0xa2ad('0x63')]));}_0x485cfc=_0x4b51c0[_0xa2ad('0x7b')]();_0x4b51c0['limit'](_0xf9814d);_0x4b51c0[_0xa2ad('0x18')](0x0);return;}})[_0xa2ad('0x21')](function(){if(_0xdb894c[_0xa2ad('0x8c')]==='web'){return null;}var _0x5ef42f=_['merge'](_0xdb894c,{'name':_0xdb894c[_0xa2ad('0x8d')]||_0xdb894c[_0xa2ad('0x24')]||_0x42fa98[_0xa2ad('0x24')],'basename':_0x3a4fbe,'savename':util[_0xa2ad('0x70')](_0xa2ad('0x8e'),_0xdb894c['name']||_0x42fa98['name'],require(_0xa2ad('0x8f'))['generate'](0x4),_0xdb894c[_0xa2ad('0x8c')]||_0xa2ad('0x90')),'reportId':_0x42fa98['id'],'reportType':_0xa2ad('0x91')});return db['AnalyticExtractedReport'][_0xa2ad('0x44')](_0x5ef42f,{'raw':!![]});})[_0xa2ad('0x21')](function(_0x53de66){if(_0x42fa98[_0xa2ad('0x6b')]===_0xa2ad('0x92')){_0x485cfc[_0xa2ad('0x35')](_0x42fa98[_0xa2ad('0x6b')]+_0xa2ad('0x93'),_0xdb894c['startDate'],_0xdb894c[_0xa2ad('0x94')]);}else{_0x485cfc['where'](_0x42fa98['table']+_0xa2ad('0x95'),_0xdb894c[_0xa2ad('0x96')],_0xdb894c[_0xa2ad('0x94')]);}if(_0x53de66){logger[_0xa2ad('0x97')](_0xa2ad('0x98'),_0x485cfc[_0xa2ad('0x7e')]());require(_0xa2ad('0x99'))[_0xa2ad('0x9a')](path['join'](__dirname,'../../components/export/',_0x53de66[_0xa2ad('0x8c')]),[_0x53de66['id'],_0x485cfc[_0xa2ad('0x7e')](),path[_0xa2ad('0x53')](__dirname,'../../files/reports',_0x53de66[_0xa2ad('0x9b')]),_0x3a4fbe]);return _0x53de66;}else{var _0x4765a3=squel[_0xa2ad('0x8a')]();_0x4765a3[_0xa2ad('0x9c')]('('+_0x485cfc[_0xa2ad('0x7e')]()+')',_0xa2ad('0x9d'));_0x4765a3[_0xa2ad('0x64')](_0xa2ad('0x9e'),_0xa2ad('0x17'));_0x485cfc[_0xa2ad('0x19')](_0xdb894c[_0xa2ad('0x19')]||_0xf9814d);_0x485cfc[_0xa2ad('0x18')](_0xdb894c[_0xa2ad('0x18')]||0x0);return dbH[_0xa2ad('0x7f')][_0xa2ad('0x2c')](_0x4765a3[_0xa2ad('0x7e')](),{'type':dbH['sequelize'][_0xa2ad('0x80')]['SELECT']})[_0xa2ad('0x21')](function(_0x3b9051){if(!_0x3b9051['length']){_0xefc153=0x0;}else{_0xefc153=_0x3b9051[0x0]['count']||0x0;}return dbH[_0xa2ad('0x7f')][_0xa2ad('0x2c')](_0x485cfc['toString'](),{'type':dbH['sequelize'][_0xa2ad('0x80')][_0xa2ad('0x81')]});})[_0xa2ad('0x21')](function(_0x34757a){return{'rows':_0x34757a||[],'count':_0xefc153};});}});}exports[_0xa2ad('0x9f')]=function(_0x425a4f,_0x361083){return runReport(_0x425a4f[_0xa2ad('0x40')],_0x425a4f['query'],_0x425a4f[_0xa2ad('0x3a')])[_0xa2ad('0x21')](respondWithResult(_0x361083,null))['catch'](handleError(_0x361083,null));};exports['runReport']=runReport;exports['query']=function(_0x1068d5,_0x156287){var _0x34e6a5=0xa;var _0x1ba373=[_0xa2ad('0x53'),_0xa2ad('0x82'),_0xa2ad('0x83'),_0xa2ad('0x84')];var _0x461868={'SUM':_0xa2ad('0x54'),'COUNT':_0xa2ad('0x85'),'COUNT DISTINCT':_0xa2ad('0x55'),'MAX':_0xa2ad('0x56'),'MIN':_0xa2ad('0x57'),'AVG':_0xa2ad('0x58'),'GROUP_CONCAT':_0xa2ad('0x59'),'GROUP_CONCAT ASC':_0xa2ad('0x86'),'GROUP_CONCAT DESC':_0xa2ad('0xa0')};var _0x1d7ccc={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xa2ad('0x5c'),'ROUND':_0xa2ad('0x5d'),'UNIX_TIMESTAMP':_0xa2ad('0x5e')};var _0x62130a=function(_0x4f20f7){return!_['includes'](['IS\x20NULL',_0xa2ad('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x4f20f7);};var _0x171530=function(_0x574895){if(!_0x574895||!_0x574895[_0xa2ad('0x62')][_0xa2ad('0x42')]){return'';}for(var _0x33b14f='(',_0x5855e2=0x0;_0x5855e2<_0x574895[_0xa2ad('0x62')][_0xa2ad('0x42')];_0x5855e2+=0x1){_0x5855e2>0x0&&(_0x33b14f+='\x20'+_0x574895[_0xa2ad('0x88')]+'\x20');_0x33b14f+=_0x574895[_0xa2ad('0x62')][_0x5855e2]['group']?_0x171530(_0x574895[_0xa2ad('0x62')][_0x5855e2][_0xa2ad('0x63')]):_0x574895[_0xa2ad('0x62')][_0x5855e2][_0xa2ad('0x64')]+'\x20'+_0x574895['rules'][_0x5855e2][_0xa2ad('0x65')]+(_0x62130a(_0x574895[_0xa2ad('0x62')][_0x5855e2][_0xa2ad('0x65')])?'\x20'+_0x574895[_0xa2ad('0x62')][_0x5855e2]['value']:'');}return _0x33b14f+')';};var _0x3c4d41={'where':{'id':_0x1068d5[_0xa2ad('0x40')]['id']}},_0x265bb5,_0x424b02,_0x2d2b8d,_0x4985ef,_0x316f4c;_0x3c4d41=_['merge']({},_0x3c4d41,_0x1068d5[_0xa2ad('0x3a')]);return db['AnalyticCustomReport'][_0xa2ad('0x4b')](_0x3c4d41)[_0xa2ad('0x21')](function(_0x1fb617){if(_0x1fb617){_0x265bb5=_0x1fb617;return _0x1fb617['getFields']();}return null;})[_0xa2ad('0x21')](function(_0x47a4f1){if(_0x47a4f1){if(!_0x47a4f1[_0xa2ad('0x42')]){throw new db[(_0xa2ad('0x68'))][(_0xa2ad('0xa1'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x424b02=_0x47a4f1;return db[_0xa2ad('0x6a')]['findAll']({'raw':!![]});}return null;})[_0xa2ad('0x21')](function(_0x9af25e){if(_0x9af25e){_0x2d2b8d=_[_0xa2ad('0x89')](_0x9af25e,'id');var _0x21a0fe;var _0x2098fe=squel[_0xa2ad('0x8a')]();_0x2098fe[_0xa2ad('0x9c')](_0x265bb5[_0xa2ad('0x6b')]);for(var _0xd905cd=0x0;_0xd905cd<_0x424b02['length'];_0xd905cd+=0x1){_0x21a0fe=_0x424b02[_0xd905cd][_0xa2ad('0x6c')]?_0x2d2b8d[_0x424b02[_0xd905cd][_0xa2ad('0x6c')]][_0xa2ad('0x6d')]:_0x424b02[_0xd905cd][_0xa2ad('0x64')];_0x21a0fe=_0x424b02[_0xd905cd][_0xa2ad('0x6e')]?_[_0xa2ad('0x6f')](_0x461868[_0x424b02[_0xd905cd][_0xa2ad('0x6e')]],'%s',_0x21a0fe):_0x21a0fe;_0x21a0fe=_0x424b02[_0xd905cd][_0xa2ad('0x70')]?_[_0xa2ad('0x6f')](_0x1d7ccc[_0x424b02[_0xd905cd][_0xa2ad('0x70')]],'%s',_0x21a0fe):_0x21a0fe;if(_0x424b02[_0xd905cd][_0xa2ad('0x71')]){_0x2098fe[_0xa2ad('0x63')](_0x21a0fe);}_0x424b02[_0xd905cd]['orderBy']&&_0x2098fe[_0xa2ad('0x33')](_0x21a0fe,_0x424b02[_0xd905cd][_0xa2ad('0x8b')]===_0xa2ad('0x72')?![]:!![]);_0x2098fe[_0xa2ad('0x64')](_0x21a0fe,_0x424b02[_0xd905cd][_0xa2ad('0x73')]||_0x21a0fe);}if(_0x265bb5[_0xa2ad('0x74')]){_0x265bb5[_0xa2ad('0x74')]=JSON[_0xa2ad('0x75')](_0x265bb5[_0xa2ad('0x74')]);for(var _0x5cd9a9=0x0;_0x5cd9a9<_0x265bb5['joins'][_0xa2ad('0x42')];_0x5cd9a9+=0x1){if(_0x265bb5['joins'][_0x5cd9a9]['type']&&_[_0xa2ad('0x5f')](_0x1ba373,_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9]['type'])&&_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9][_0xa2ad('0x78')]&&_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9][_0xa2ad('0x76')]&&_0x265bb5['joins'][_0x5cd9a9][_0xa2ad('0x79')]){_0x2098fe[_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9][_0xa2ad('0x28')]](_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9][_0xa2ad('0x76')],null,util[_0xa2ad('0x70')](_0xa2ad('0x77'),_0x265bb5['table'],_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9][_0xa2ad('0x78')],_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9]['foreignTable'],_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9]['foreignKey']));}}}if(_0x265bb5['conditions']){_0x265bb5['conditions']=JSON['parse'](_0x265bb5[_0xa2ad('0x7a')]);_0x2098fe[_0xa2ad('0x35')](_0x171530(_0x265bb5[_0xa2ad('0x7a')][_0xa2ad('0x63')]));}_0x316f4c=_0x2098fe['clone']();_0x2098fe[_0xa2ad('0x19')](_0x34e6a5);_0x2098fe['offset'](0x0);logger[_0xa2ad('0x7c')](_0xa2ad('0x7d'),_0x2098fe[_0xa2ad('0x7e')]());return dbH[_0xa2ad('0x7f')]['query'](_0x2098fe[_0xa2ad('0x7e')](),{'type':dbH[_0xa2ad('0x7f')][_0xa2ad('0x80')][_0xa2ad('0x81')]});}})[_0xa2ad('0x21')](function(){return{'sql':_0x316f4c['toString']()};})['then'](respondWithResult(_0x156287,null))[_0xa2ad('0x3f')](handleError(_0x156287,null));}; \ No newline at end of file +var _0xa2c2=['left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','operator','value','metric','function','replace','output','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','DESC','clone','html-pdf','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','get','CustomReports','destroy','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0xa2c2,0xf6));var _0x2a2c=function(_0x545d9c,_0x37e8d6){_0x545d9c=_0x545d9c-0x0;var _0x4d7c66=_0xa2c2[_0x545d9c];return _0x4d7c66;};'use strict';var pdf=require(_0x2a2c('0x0'));var emlformat=require(_0x2a2c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2a2c('0x2'));var rp=require('request-promise');var moment=require(_0x2a2c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2a2c('0x4'));var util=require(_0x2a2c('0x5'));var path=require(_0x2a2c('0x6'));var sox=require(_0x2a2c('0x7'));var csv=require(_0x2a2c('0x8'));var ejs=require(_0x2a2c('0x9'));var fs=require('fs');var fs_extra=require(_0x2a2c('0xa'));var _=require(_0x2a2c('0xb'));var squel=require(_0x2a2c('0xc'));var crypto=require(_0x2a2c('0xd'));var jsforce=require(_0x2a2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2a2c('0x8'));var querystring=require('querystring');var Papa=require(_0x2a2c('0xf'));var Redis=require('ioredis');var authService=require(_0x2a2c('0x10'));var qs=require(_0x2a2c('0x11'));var as=require(_0x2a2c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a2c('0x13'))(_0x2a2c('0x14'));var utils=require('../../config/utils');var config=require(_0x2a2c('0x15'));var licenseUtil=require(_0x2a2c('0x16'));var db=require(_0x2a2c('0x17'))['db'];var dbH=require(_0x2a2c('0x17'))['dbH'];function respondWithStatusCode(_0x4d4a4b,_0x4bd51c){_0x4bd51c=_0x4bd51c||0xcc;return function(_0x3768d6){if(_0x3768d6){return _0x4d4a4b[_0x2a2c('0x18')](_0x4bd51c);}return _0x4d4a4b[_0x2a2c('0x19')](_0x4bd51c)[_0x2a2c('0x1a')]();};}function respondWithResult(_0x52821f,_0x48df79){_0x48df79=_0x48df79||0xc8;return function(_0xd18512){if(_0xd18512){return _0x52821f['status'](_0x48df79)[_0x2a2c('0x1b')](_0xd18512);}};}function respondWithFilteredResult(_0x2e5af3,_0x5161ee){return function(_0x3eb882){if(_0x3eb882){var _0x7d0854=_0x3eb882['count'],_0x1b618f=_0x5161ee[_0x2a2c('0x1c')],_0x5e98a7=_0x5161ee[_0x2a2c('0x1c')]+_0x5161ee[_0x2a2c('0x1d')],_0x42a291;if(_0x5e98a7>=_0x7d0854){_0x5e98a7=_0x7d0854;_0x42a291=0xc8;}else{_0x42a291=0xce;}_0x2e5af3[_0x2a2c('0x19')](_0x42a291);return _0x2e5af3[_0x2a2c('0x1e')](_0x2a2c('0x1f'),_0x1b618f+'-'+_0x5e98a7+'/'+_0x7d0854)[_0x2a2c('0x1b')](_0x3eb882);}return null;};}function patchUpdates(_0x4c1b61){return function(_0x12dbb7){try{jsonpatch['apply'](_0x12dbb7,_0x4c1b61,!![]);}catch(_0x10845f){return BPromise[_0x2a2c('0x20')](_0x10845f);}return _0x12dbb7[_0x2a2c('0x21')]();};}function saveUpdates(_0x498e90,_0x3091a7){return function(_0x475db5){if(_0x475db5){return _0x475db5[_0x2a2c('0x22')](_0x498e90)[_0x2a2c('0x23')](function(_0x3dfab1){return _0x3dfab1;});}return null;};}function removeEntity(_0x38d8b8,_0x44f3cd){return function(_0x5c025e){if(_0x5c025e){return _0x5c025e['destroy']()[_0x2a2c('0x23')](function(){var _0x467ec7=_0x5c025e[_0x2a2c('0x24')]({'plain':!![]});var _0x2f9ada=_0x2a2c('0x25');return db['UserProfileResource'][_0x2a2c('0x26')]({'where':{'type':_0x2f9ada,'resourceId':_0x467ec7['id']}})[_0x2a2c('0x23')](function(){return _0x5c025e;});})[_0x2a2c('0x23')](function(){_0x38d8b8['status'](0xcc)[_0x2a2c('0x1a')]();});}};}function handleEntityNotFound(_0x28b91e,_0x4922de){return function(_0x2e8f7e){if(!_0x2e8f7e){_0x28b91e[_0x2a2c('0x18')](0x194);}return _0x2e8f7e;};}function handleError(_0x13aee7,_0x11bcd3){_0x11bcd3=_0x11bcd3||0x1f4;return function(_0x377c16){logger[_0x2a2c('0x27')](_0x377c16[_0x2a2c('0x28')]);if(_0x377c16[_0x2a2c('0x29')]){delete _0x377c16['name'];}_0x13aee7['status'](_0x11bcd3)[_0x2a2c('0x2a')](_0x377c16);};}exports[_0x2a2c('0x2b')]=function(_0x1395b4,_0x1f5466){var _0x3021fa={},_0xc441e1={},_0xa48a6d={'count':0x0,'rows':[]};var _0x20a7e8=_[_0x2a2c('0x2c')](db[_0x2a2c('0x2d')][_0x2a2c('0x2e')],function(_0x18a9e3){return{'name':_0x18a9e3['fieldName'],'type':_0x18a9e3[_0x2a2c('0x2f')][_0x2a2c('0x30')]};});_0xc441e1[_0x2a2c('0x31')]=_[_0x2a2c('0x2c')](_0x20a7e8,_0x2a2c('0x29'));_0xc441e1[_0x2a2c('0x32')]=_[_0x2a2c('0x33')](_0x1395b4[_0x2a2c('0x32')]);_0xc441e1[_0x2a2c('0x34')]=_[_0x2a2c('0x35')](_0xc441e1[_0x2a2c('0x31')],_0xc441e1[_0x2a2c('0x32')]);_0x3021fa['attributes']=_[_0x2a2c('0x35')](_0xc441e1[_0x2a2c('0x31')],qs[_0x2a2c('0x36')](_0x1395b4[_0x2a2c('0x32')][_0x2a2c('0x36')]));_0x3021fa['attributes']=_0x3021fa['attributes'][_0x2a2c('0x37')]?_0x3021fa[_0x2a2c('0x38')]:_0xc441e1[_0x2a2c('0x31')];if(!_0x1395b4['query'][_0x2a2c('0x39')](_0x2a2c('0x3a'))){_0x3021fa[_0x2a2c('0x1d')]=qs[_0x2a2c('0x1d')](_0x1395b4['query'][_0x2a2c('0x1d')]);_0x3021fa[_0x2a2c('0x1c')]=qs[_0x2a2c('0x1c')](_0x1395b4[_0x2a2c('0x32')][_0x2a2c('0x1c')]);}_0x3021fa[_0x2a2c('0x3b')]=qs[_0x2a2c('0x3c')](_0x1395b4[_0x2a2c('0x32')]['sort']);_0x3021fa['where']=qs[_0x2a2c('0x34')](_[_0x2a2c('0x3d')](_0x1395b4[_0x2a2c('0x32')],_0xc441e1['filters']),_0x20a7e8);if(_0x1395b4['query'][_0x2a2c('0x3e')]){_0x3021fa[_0x2a2c('0x3f')]=_['merge'](_0x3021fa[_0x2a2c('0x3f')],{'$or':_[_0x2a2c('0x2c')](_0x20a7e8,function(_0x21c8ae){if(_0x21c8ae[_0x2a2c('0x2f')]!=='VIRTUAL'){var _0x1dbcd9={};_0x1dbcd9[_0x21c8ae[_0x2a2c('0x29')]]={'$like':'%'+_0x1395b4[_0x2a2c('0x32')]['filter']+'%'};return _0x1dbcd9;}})});}_0x3021fa=_[_0x2a2c('0x40')]({},_0x3021fa,_0x1395b4[_0x2a2c('0x41')]);var _0x4172f0={'where':_0x3021fa[_0x2a2c('0x3f')]};return db['AnalyticCustomReport'][_0x2a2c('0x42')](_0x4172f0)['then'](function(_0x5900e9){_0xa48a6d['count']=_0x5900e9;if(_0x1395b4['query'][_0x2a2c('0x43')]){_0x3021fa[_0x2a2c('0x44')]=[{'all':!![]}];}return db[_0x2a2c('0x2d')][_0x2a2c('0x45')](_0x3021fa);})[_0x2a2c('0x23')](function(_0x5fe1ed){_0xa48a6d[_0x2a2c('0x46')]=_0x5fe1ed;return _0xa48a6d;})[_0x2a2c('0x23')](respondWithFilteredResult(_0x1f5466,_0x3021fa))[_0x2a2c('0x47')](handleError(_0x1f5466,null));};exports[_0x2a2c('0x48')]=function(_0x36f9a0,_0x56774e){var _0x521e86={'raw':![],'where':{'id':_0x36f9a0[_0x2a2c('0x49')]['id']}},_0x1d7331={};_0x1d7331[_0x2a2c('0x31')]=_[_0x2a2c('0x33')](db[_0x2a2c('0x2d')][_0x2a2c('0x2e')]);_0x1d7331[_0x2a2c('0x32')]=_[_0x2a2c('0x33')](_0x36f9a0[_0x2a2c('0x32')]);_0x1d7331[_0x2a2c('0x34')]=_[_0x2a2c('0x35')](_0x1d7331['model'],_0x1d7331[_0x2a2c('0x32')]);_0x521e86[_0x2a2c('0x38')]=_[_0x2a2c('0x35')](_0x1d7331[_0x2a2c('0x31')],qs[_0x2a2c('0x36')](_0x36f9a0['query'][_0x2a2c('0x36')]));_0x521e86['attributes']=_0x521e86[_0x2a2c('0x38')][_0x2a2c('0x37')]?_0x521e86[_0x2a2c('0x38')]:_0x1d7331[_0x2a2c('0x31')];if(_0x36f9a0[_0x2a2c('0x32')][_0x2a2c('0x43')]){_0x521e86[_0x2a2c('0x44')]=[{'all':!![]}];}_0x521e86=_['merge']({},_0x521e86,_0x36f9a0[_0x2a2c('0x41')]);return db[_0x2a2c('0x2d')][_0x2a2c('0x4a')](_0x521e86)[_0x2a2c('0x23')](handleEntityNotFound(_0x56774e,null))[_0x2a2c('0x23')](respondWithResult(_0x56774e,null))[_0x2a2c('0x47')](handleError(_0x56774e,null));};exports['create']=function(_0x4ab9a0,_0xa4ef58){return db[_0x2a2c('0x2d')][_0x2a2c('0x4b')](_0x4ab9a0[_0x2a2c('0x4c')],{})[_0x2a2c('0x23')](function(_0x3d1dec){var _0xb67e6b=_0x4ab9a0[_0x2a2c('0x4d')][_0x2a2c('0x24')]({'plain':!![]});if(!_0xb67e6b)throw new Error(_0x2a2c('0x4e'));if(_0xb67e6b[_0x2a2c('0x4f')]==='user'){var _0x3f1668=_0x3d1dec[_0x2a2c('0x24')]({'plain':!![]});var _0x37bd0a=_0x2a2c('0x50');return db['UserProfileSection'][_0x2a2c('0x4a')]({'where':{'name':_0x37bd0a,'userProfileId':_0xb67e6b[_0x2a2c('0x51')]},'raw':!![]})[_0x2a2c('0x23')](function(_0x52ac24){if(_0x52ac24&&_0x52ac24[_0x2a2c('0x52')]===0x0){return db['UserProfileResource'][_0x2a2c('0x4b')]({'name':_0x3f1668[_0x2a2c('0x29')],'resourceId':_0x3f1668['id'],'type':_0x2a2c('0x25'),'sectionId':_0x52ac24['id']},{})['then'](function(){return _0x3d1dec;});}else{return _0x3d1dec;}})['catch'](function(_0x1a431f){logger['error'](_0x2a2c('0x53'),_0x1a431f);throw _0x1a431f;});}return _0x3d1dec;})[_0x2a2c('0x23')](respondWithResult(_0xa4ef58,0xc9))[_0x2a2c('0x47')](handleError(_0xa4ef58,null));};exports[_0x2a2c('0x22')]=function(_0x50a65f,_0x1cc03d){if(_0x50a65f[_0x2a2c('0x4c')]['id']){delete _0x50a65f[_0x2a2c('0x4c')]['id'];}return db[_0x2a2c('0x2d')]['find']({'where':{'id':_0x50a65f[_0x2a2c('0x49')]['id']}})[_0x2a2c('0x23')](handleEntityNotFound(_0x1cc03d,null))['then'](saveUpdates(_0x50a65f['body'],null))[_0x2a2c('0x23')](respondWithResult(_0x1cc03d,null))[_0x2a2c('0x47')](handleError(_0x1cc03d,null));};exports[_0x2a2c('0x26')]=function(_0x587f82,_0xc7557e){return db[_0x2a2c('0x2d')][_0x2a2c('0x4a')]({'where':{'id':_0x587f82['params']['id']}})[_0x2a2c('0x23')](handleEntityNotFound(_0xc7557e,null))[_0x2a2c('0x23')](removeEntity(_0xc7557e,null))[_0x2a2c('0x47')](handleError(_0xc7557e,null));};exports[_0x2a2c('0x54')]=function(_0x39f21c,_0x368d6b){var _0x27e5b7=0xa;var _0x3f74ee=[_0x2a2c('0x55'),_0x2a2c('0x56'),_0x2a2c('0x57'),_0x2a2c('0x58')];var _0x23d4de={'SUM':'SUM(%s)','COUNT':_0x2a2c('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2a2c('0x5a'),'MIN':_0x2a2c('0x5b'),'AVG':_0x2a2c('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2a2c('0x5d'),'GROUP_CONCAT DESC':_0x2a2c('0x5e')};var _0x3011ae={'SEC_TO_TIME':_0x2a2c('0x5f'),'DATE':_0x2a2c('0x60'),'HOUR':_0x2a2c('0x61'),'ROUND':_0x2a2c('0x62'),'UNIX_TIMESTAMP':_0x2a2c('0x63')};var _0x335661=function(_0x115ac4){return!_[_0x2a2c('0x64')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x2a2c('0x65')],_0x115ac4);};var _0x53dbc2=function(_0xfa5304){if(!_0xfa5304||!_0xfa5304[_0x2a2c('0x66')]['length']){return'';}for(var _0x1049cb='(',_0x2d21fe=0x0;_0x2d21fe<_0xfa5304[_0x2a2c('0x66')][_0x2a2c('0x37')];_0x2d21fe+=0x1){_0x2d21fe>0x0&&(_0x1049cb+='\x20'+_0xfa5304['operator']+'\x20');_0x1049cb+=_0xfa5304[_0x2a2c('0x66')][_0x2d21fe][_0x2a2c('0x67')]?_0x53dbc2(_0xfa5304[_0x2a2c('0x66')][_0x2d21fe][_0x2a2c('0x67')]):_0xfa5304['rules'][_0x2d21fe][_0x2a2c('0x68')]+'\x20'+_0xfa5304[_0x2a2c('0x66')][_0x2d21fe]['condition']+(_0x335661(_0xfa5304['rules'][_0x2d21fe][_0x2a2c('0x69')])?'\x20'+_0xfa5304[_0x2a2c('0x66')][_0x2d21fe]['value']:'');}return _0x1049cb+')';};var _0x164f60={'where':{'id':_0x39f21c[_0x2a2c('0x49')]['id']}},_0x4c2533,_0x4ede56,_0x55b4e0,_0x554fc0,_0x7a3730;_0x164f60=_[_0x2a2c('0x40')]({},_0x164f60,_0x39f21c['options']);return db[_0x2a2c('0x2d')][_0x2a2c('0x4a')](_0x164f60)[_0x2a2c('0x23')](function(_0x942243){if(_0x942243){_0x4c2533=_0x942243;return _0x942243[_0x2a2c('0x6a')]();}return null;})[_0x2a2c('0x23')](function(_0x4ad732){if(_0x4ad732){if(!_0x4ad732[_0x2a2c('0x37')]){throw new db[(_0x2a2c('0x6b'))][(_0x2a2c('0x6c'))](_0x2a2c('0x6d'),0x193);}_0x4ede56=_0x4ad732;return db[_0x2a2c('0x6e')][_0x2a2c('0x45')]({'raw':!![]});}return null;})[_0x2a2c('0x23')](function(_0x38afa7){if(_0x38afa7){_0x55b4e0=_[_0x2a2c('0x6f')](_0x38afa7,'id');var _0x41a354;var _0x84824d=squel[_0x2a2c('0x70')]();_0x84824d[_0x2a2c('0x71')](_0x4c2533[_0x2a2c('0x72')]);for(var _0x4a7c28=0x0;_0x4a7c28<_0x4ede56[_0x2a2c('0x37')];_0x4a7c28+=0x1){_0x41a354=_0x4ede56[_0x4a7c28][_0x2a2c('0x73')]?_0x55b4e0[_0x4ede56[_0x4a7c28]['MetricId']]['metric']:_0x4ede56[_0x4a7c28][_0x2a2c('0x68')];_0x41a354=_0x4ede56[_0x4a7c28]['function']?_['replace'](_0x23d4de[_0x4ede56[_0x4a7c28]['function']],'%s',_0x41a354):_0x41a354;_0x41a354=_0x4ede56[_0x4a7c28][_0x2a2c('0x74')]?_['replace'](_0x3011ae[_0x4ede56[_0x4a7c28]['format']],'%s',_0x41a354):_0x41a354;if(_0x4ede56[_0x4a7c28][_0x2a2c('0x75')]){_0x84824d['group'](_0x41a354);}_0x4ede56[_0x4a7c28][_0x2a2c('0x76')]&&_0x84824d[_0x2a2c('0x3b')](_0x41a354,_0x4ede56[_0x4a7c28][_0x2a2c('0x76')]==='DESC'?![]:!![]);_0x84824d[_0x2a2c('0x68')](_0x41a354,_0x4ede56[_0x4a7c28][_0x2a2c('0x77')]||_0x41a354);}if(_0x4c2533[_0x2a2c('0x78')]){_0x4c2533[_0x2a2c('0x78')]=JSON[_0x2a2c('0x79')](_0x4c2533[_0x2a2c('0x78')]);for(var _0x312579=0x0;_0x312579<_0x4c2533[_0x2a2c('0x78')][_0x2a2c('0x37')];_0x312579+=0x1){if(_0x4c2533[_0x2a2c('0x78')][_0x312579][_0x2a2c('0x2f')]&&_[_0x2a2c('0x64')](_0x3f74ee,_0x4c2533[_0x2a2c('0x78')][_0x312579][_0x2a2c('0x2f')])&&_0x4c2533['joins'][_0x312579][_0x2a2c('0x7a')]&&_0x4c2533[_0x2a2c('0x78')][_0x312579][_0x2a2c('0x7b')]&&_0x4c2533[_0x2a2c('0x78')][_0x312579][_0x2a2c('0x7c')]){_0x84824d[_0x4c2533['joins'][_0x312579][_0x2a2c('0x2f')]](_0x4c2533[_0x2a2c('0x78')][_0x312579][_0x2a2c('0x7b')],null,util['format'](_0x2a2c('0x7d'),_0x4c2533[_0x2a2c('0x72')],_0x4c2533[_0x2a2c('0x78')][_0x312579][_0x2a2c('0x7a')],_0x4c2533[_0x2a2c('0x78')][_0x312579][_0x2a2c('0x7b')],_0x4c2533[_0x2a2c('0x78')][_0x312579][_0x2a2c('0x7c')]));}}}if(_0x4c2533[_0x2a2c('0x7e')]){_0x4c2533[_0x2a2c('0x7e')]=JSON[_0x2a2c('0x79')](_0x4c2533[_0x2a2c('0x7e')]);_0x84824d[_0x2a2c('0x3f')](_0x53dbc2(_0x4c2533[_0x2a2c('0x7e')][_0x2a2c('0x67')]));}_0x7a3730=_0x84824d['clone']();_0x84824d[_0x2a2c('0x1d')](_0x27e5b7);_0x84824d[_0x2a2c('0x1c')](0x0);logger[_0x2a2c('0x7f')](_0x2a2c('0x80'),_0x84824d['toString']());return dbH[_0x2a2c('0x81')][_0x2a2c('0x32')](_0x84824d['toString'](),{'type':dbH['sequelize'][_0x2a2c('0x82')][_0x2a2c('0x83')]});}})[_0x2a2c('0x23')](respondWithResult(_0x368d6b,null))[_0x2a2c('0x47')](handleError(_0x368d6b,null));};function runReport(_0x2e7211,_0x188e89,_0x1cb1d7){var _0x5e6b30=_0x188e89[_0x2a2c('0x29')];var _0x4d2e3e=0xa;var _0xd024b3=['join',_0x2a2c('0x56'),_0x2a2c('0x57'),_0x2a2c('0x58')];var _0x1d9bd4={'SUM':'SUM(%s)','COUNT':_0x2a2c('0x59'),'COUNT DISTINCT':_0x2a2c('0x84'),'MAX':_0x2a2c('0x5a'),'MIN':_0x2a2c('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2a2c('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2a2c('0x5e')};var _0x730ac3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x2a2c('0x61'),'ROUND':_0x2a2c('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x227ce0=function(_0x524f02){return!_['includes']([_0x2a2c('0x86'),_0x2a2c('0x87'),_0x2a2c('0x88'),'IS\x20NOT\x20EMPTY'],_0x524f02);};var _0x5eb9cf=function(_0x377894){if(!_0x377894||!_0x377894[_0x2a2c('0x66')][_0x2a2c('0x37')]){return'';}for(var _0x1db418='(',_0x52b941=0x0;_0x52b941<_0x377894[_0x2a2c('0x66')][_0x2a2c('0x37')];_0x52b941+=0x1){_0x52b941>0x0&&(_0x1db418+='\x20'+_0x377894[_0x2a2c('0x89')]+'\x20');_0x1db418+=_0x377894['rules'][_0x52b941][_0x2a2c('0x67')]?_0x5eb9cf(_0x377894[_0x2a2c('0x66')][_0x52b941][_0x2a2c('0x67')]):_0x377894[_0x2a2c('0x66')][_0x52b941][_0x2a2c('0x68')]+'\x20'+_0x377894[_0x2a2c('0x66')][_0x52b941][_0x2a2c('0x69')]+(_0x227ce0(_0x377894['rules'][_0x52b941]['condition'])?'\x20'+_0x377894[_0x2a2c('0x66')][_0x52b941][_0x2a2c('0x8a')]:'');}return _0x1db418+')';};var _0x50d1fe={'where':{'id':_0x2e7211['id']}},_0x4f1cb8,_0x42ba05,_0x411340,_0x1e5edc,_0x15fc3c;_0x50d1fe=_[_0x2a2c('0x40')]({},_0x50d1fe,_0x1cb1d7);return db[_0x2a2c('0x2d')][_0x2a2c('0x4a')](_0x50d1fe)[_0x2a2c('0x23')](function(_0x283b76){if(_0x283b76){_0x4f1cb8=_0x283b76;return _0x283b76['getFields']();}return null;})[_0x2a2c('0x23')](function(_0x133c6e){if(_0x133c6e){if(!_0x133c6e[_0x2a2c('0x37')]){throw new db[(_0x2a2c('0x6b'))][(_0x2a2c('0x6c'))](_0x2a2c('0x6d'),0x193);}_0x42ba05=_0x133c6e;return db['AnalyticMetric'][_0x2a2c('0x45')]({'raw':!![]});}return null;})[_0x2a2c('0x23')](function(_0x48c42b){if(_0x48c42b){_0x411340=_['keyBy'](_0x48c42b,'id');var _0x16ac1c;var _0x1b8b70=squel['select']();_0x1b8b70[_0x2a2c('0x71')](_0x4f1cb8[_0x2a2c('0x72')]);for(var _0x381261=0x0;_0x381261<_0x42ba05[_0x2a2c('0x37')];_0x381261+=0x1){_0x16ac1c=_0x42ba05[_0x381261]['MetricId']?_0x411340[_0x42ba05[_0x381261][_0x2a2c('0x73')]][_0x2a2c('0x8b')]:_0x42ba05[_0x381261][_0x2a2c('0x68')];_0x16ac1c=_0x42ba05[_0x381261][_0x2a2c('0x8c')]?_['replace'](_0x1d9bd4[_0x42ba05[_0x381261][_0x2a2c('0x8c')]],'%s',_0x16ac1c):_0x16ac1c;_0x16ac1c=_0x42ba05[_0x381261][_0x2a2c('0x74')]?_[_0x2a2c('0x8d')](_0x730ac3[_0x42ba05[_0x381261][_0x2a2c('0x74')]],'%s',_0x16ac1c):_0x16ac1c;if(_0x42ba05[_0x381261][_0x2a2c('0x75')]){_0x1b8b70[_0x2a2c('0x67')](_0x16ac1c);}_0x42ba05[_0x381261][_0x2a2c('0x76')]&&_0x1b8b70[_0x2a2c('0x3b')](_0x16ac1c,_0x42ba05[_0x381261]['orderBy']==='DESC'?![]:!![]);_0x1b8b70[_0x2a2c('0x68')](_0x16ac1c,_0x42ba05[_0x381261][_0x2a2c('0x77')]||_0x16ac1c);}if(_0x4f1cb8[_0x2a2c('0x78')]){_0x4f1cb8[_0x2a2c('0x78')]=JSON[_0x2a2c('0x79')](_0x4f1cb8[_0x2a2c('0x78')]);for(var _0x5220c5=0x0;_0x5220c5<_0x4f1cb8[_0x2a2c('0x78')][_0x2a2c('0x37')];_0x5220c5+=0x1){if(_0x4f1cb8[_0x2a2c('0x78')][_0x5220c5][_0x2a2c('0x2f')]&&_['includes'](_0xd024b3,_0x4f1cb8[_0x2a2c('0x78')][_0x5220c5][_0x2a2c('0x2f')])&&_0x4f1cb8[_0x2a2c('0x78')][_0x5220c5][_0x2a2c('0x7a')]&&_0x4f1cb8['joins'][_0x5220c5][_0x2a2c('0x7b')]&&_0x4f1cb8[_0x2a2c('0x78')][_0x5220c5]['foreignKey']){_0x1b8b70[_0x4f1cb8[_0x2a2c('0x78')][_0x5220c5][_0x2a2c('0x2f')]](_0x4f1cb8[_0x2a2c('0x78')][_0x5220c5][_0x2a2c('0x7b')],null,util[_0x2a2c('0x74')](_0x2a2c('0x7d'),_0x4f1cb8[_0x2a2c('0x72')],_0x4f1cb8[_0x2a2c('0x78')][_0x5220c5][_0x2a2c('0x7a')],_0x4f1cb8[_0x2a2c('0x78')][_0x5220c5][_0x2a2c('0x7b')],_0x4f1cb8[_0x2a2c('0x78')][_0x5220c5]['foreignKey']));}}}if(_0x4f1cb8[_0x2a2c('0x7e')]){_0x4f1cb8[_0x2a2c('0x7e')]=JSON[_0x2a2c('0x79')](_0x4f1cb8[_0x2a2c('0x7e')]);_0x1b8b70[_0x2a2c('0x3f')](_0x5eb9cf(_0x4f1cb8['conditions'][_0x2a2c('0x67')]));}_0x15fc3c=_0x1b8b70['clone']();_0x1b8b70['limit'](_0x4d2e3e);_0x1b8b70['offset'](0x0);return;}})[_0x2a2c('0x23')](function(){if(_0x188e89[_0x2a2c('0x8e')]==='web'){return null;}var _0xbf67a=_[_0x2a2c('0x40')](_0x188e89,{'name':_0x188e89[_0x2a2c('0x8f')]||_0x188e89[_0x2a2c('0x29')]||_0x4f1cb8[_0x2a2c('0x29')],'basename':_0x5e6b30,'savename':util[_0x2a2c('0x74')](_0x2a2c('0x90'),_0x188e89[_0x2a2c('0x29')]||_0x4f1cb8[_0x2a2c('0x29')],require(_0x2a2c('0x91'))['generate'](0x4),_0x188e89[_0x2a2c('0x8e')]||_0x2a2c('0x92')),'reportId':_0x4f1cb8['id'],'reportType':_0x2a2c('0x93')});return db[_0x2a2c('0x94')][_0x2a2c('0x4b')](_0xbf67a,{'raw':!![]});})['then'](function(_0x3c2b92){if(_0x4f1cb8[_0x2a2c('0x72')]===_0x2a2c('0x95')){_0x15fc3c[_0x2a2c('0x3f')](_0x4f1cb8[_0x2a2c('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x188e89['startDate'],_0x188e89[_0x2a2c('0x96')]);}else{_0x15fc3c[_0x2a2c('0x3f')](_0x4f1cb8[_0x2a2c('0x72')]+_0x2a2c('0x97'),_0x188e89[_0x2a2c('0x98')],_0x188e89['endDate']);}if(_0x3c2b92){logger[_0x2a2c('0x99')](_0x2a2c('0x9a'),_0x15fc3c[_0x2a2c('0x9b')]());require(_0x2a2c('0x9c'))[_0x2a2c('0x9d')](path[_0x2a2c('0x55')](__dirname,_0x2a2c('0x9e'),_0x3c2b92[_0x2a2c('0x8e')]),[_0x3c2b92['id'],_0x15fc3c[_0x2a2c('0x9b')](),path[_0x2a2c('0x55')](__dirname,_0x2a2c('0x9f'),_0x3c2b92[_0x2a2c('0xa0')]),_0x5e6b30]);return _0x3c2b92;}else{var _0x1ed9a6=squel['select']();_0x1ed9a6['from']('('+_0x15fc3c['toString']()+')','countTable');_0x1ed9a6[_0x2a2c('0x68')](_0x2a2c('0xa1'),_0x2a2c('0x42'));_0x15fc3c[_0x2a2c('0x1d')](_0x188e89[_0x2a2c('0x1d')]||_0x4d2e3e);_0x15fc3c[_0x2a2c('0x1c')](_0x188e89['offset']||0x0);return dbH['sequelize'][_0x2a2c('0x32')](_0x1ed9a6['toString'](),{'type':dbH[_0x2a2c('0x81')][_0x2a2c('0x82')][_0x2a2c('0x83')]})[_0x2a2c('0x23')](function(_0x2ad32b){if(!_0x2ad32b[_0x2a2c('0x37')]){_0x1e5edc=0x0;}else{_0x1e5edc=_0x2ad32b[0x0][_0x2a2c('0x42')]||0x0;}return dbH['sequelize']['query'](_0x15fc3c[_0x2a2c('0x9b')](),{'type':dbH['sequelize'][_0x2a2c('0x82')][_0x2a2c('0x83')]});})[_0x2a2c('0x23')](function(_0x728313){return{'rows':_0x728313||[],'count':_0x1e5edc};});}});}exports[_0x2a2c('0xa2')]=function(_0x496d38,_0x15595b){return runReport(_0x496d38[_0x2a2c('0x49')],_0x496d38[_0x2a2c('0x32')],_0x496d38[_0x2a2c('0x41')])[_0x2a2c('0x23')](respondWithResult(_0x15595b,null))[_0x2a2c('0x47')](handleError(_0x15595b,null));};exports[_0x2a2c('0xa3')]=runReport;exports[_0x2a2c('0x32')]=function(_0x578b57,_0x51b882){var _0x9493b5=0xa;var _0x2396bb=[_0x2a2c('0x55'),'left_join','right_join',_0x2a2c('0x58')];var _0x414e0f={'SUM':'SUM(%s)','COUNT':_0x2a2c('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2a2c('0x5a'),'MIN':_0x2a2c('0x5b'),'AVG':_0x2a2c('0x5c'),'GROUP_CONCAT':_0x2a2c('0x85'),'GROUP_CONCAT ASC':_0x2a2c('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x416fc9={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x2a2c('0x62'),'UNIX_TIMESTAMP':_0x2a2c('0x63')};var _0x2eb3b1=function(_0x288801){return!_[_0x2a2c('0x64')]([_0x2a2c('0x86'),_0x2a2c('0x87'),_0x2a2c('0x88'),_0x2a2c('0x65')],_0x288801);};var _0x5eca0a=function(_0x17423a){if(!_0x17423a||!_0x17423a[_0x2a2c('0x66')][_0x2a2c('0x37')]){return'';}for(var _0x2e271a='(',_0x306814=0x0;_0x306814<_0x17423a[_0x2a2c('0x66')][_0x2a2c('0x37')];_0x306814+=0x1){_0x306814>0x0&&(_0x2e271a+='\x20'+_0x17423a['operator']+'\x20');_0x2e271a+=_0x17423a['rules'][_0x306814][_0x2a2c('0x67')]?_0x5eca0a(_0x17423a[_0x2a2c('0x66')][_0x306814][_0x2a2c('0x67')]):_0x17423a[_0x2a2c('0x66')][_0x306814][_0x2a2c('0x68')]+'\x20'+_0x17423a['rules'][_0x306814]['condition']+(_0x2eb3b1(_0x17423a[_0x2a2c('0x66')][_0x306814][_0x2a2c('0x69')])?'\x20'+_0x17423a[_0x2a2c('0x66')][_0x306814][_0x2a2c('0x8a')]:'');}return _0x2e271a+')';};var _0x4f8b98={'where':{'id':_0x578b57[_0x2a2c('0x49')]['id']}},_0x39efe9,_0x12c00e,_0x3e38fb,_0x2d9a4d,_0x33c065;_0x4f8b98=_['merge']({},_0x4f8b98,_0x578b57[_0x2a2c('0x41')]);return db[_0x2a2c('0x2d')][_0x2a2c('0x4a')](_0x4f8b98)[_0x2a2c('0x23')](function(_0x4301fe){if(_0x4301fe){_0x39efe9=_0x4301fe;return _0x4301fe[_0x2a2c('0x6a')]();}return null;})['then'](function(_0x4ef6aa){if(_0x4ef6aa){if(!_0x4ef6aa[_0x2a2c('0x37')]){throw new db[(_0x2a2c('0x6b'))][(_0x2a2c('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x12c00e=_0x4ef6aa;return db[_0x2a2c('0x6e')][_0x2a2c('0x45')]({'raw':!![]});}return null;})[_0x2a2c('0x23')](function(_0x50c606){if(_0x50c606){_0x3e38fb=_[_0x2a2c('0x6f')](_0x50c606,'id');var _0x1f2b52;var _0x2f928a=squel[_0x2a2c('0x70')]();_0x2f928a[_0x2a2c('0x71')](_0x39efe9['table']);for(var _0x53f202=0x0;_0x53f202<_0x12c00e['length'];_0x53f202+=0x1){_0x1f2b52=_0x12c00e[_0x53f202]['MetricId']?_0x3e38fb[_0x12c00e[_0x53f202][_0x2a2c('0x73')]][_0x2a2c('0x8b')]:_0x12c00e[_0x53f202][_0x2a2c('0x68')];_0x1f2b52=_0x12c00e[_0x53f202][_0x2a2c('0x8c')]?_[_0x2a2c('0x8d')](_0x414e0f[_0x12c00e[_0x53f202][_0x2a2c('0x8c')]],'%s',_0x1f2b52):_0x1f2b52;_0x1f2b52=_0x12c00e[_0x53f202][_0x2a2c('0x74')]?_['replace'](_0x416fc9[_0x12c00e[_0x53f202]['format']],'%s',_0x1f2b52):_0x1f2b52;if(_0x12c00e[_0x53f202][_0x2a2c('0x75')]){_0x2f928a[_0x2a2c('0x67')](_0x1f2b52);}_0x12c00e[_0x53f202][_0x2a2c('0x76')]&&_0x2f928a[_0x2a2c('0x3b')](_0x1f2b52,_0x12c00e[_0x53f202]['orderBy']===_0x2a2c('0xa4')?![]:!![]);_0x2f928a[_0x2a2c('0x68')](_0x1f2b52,_0x12c00e[_0x53f202][_0x2a2c('0x77')]||_0x1f2b52);}if(_0x39efe9[_0x2a2c('0x78')]){_0x39efe9[_0x2a2c('0x78')]=JSON[_0x2a2c('0x79')](_0x39efe9[_0x2a2c('0x78')]);for(var _0x169e19=0x0;_0x169e19<_0x39efe9['joins'][_0x2a2c('0x37')];_0x169e19+=0x1){if(_0x39efe9[_0x2a2c('0x78')][_0x169e19][_0x2a2c('0x2f')]&&_[_0x2a2c('0x64')](_0x2396bb,_0x39efe9[_0x2a2c('0x78')][_0x169e19][_0x2a2c('0x2f')])&&_0x39efe9['joins'][_0x169e19]['parentKey']&&_0x39efe9[_0x2a2c('0x78')][_0x169e19][_0x2a2c('0x7b')]&&_0x39efe9[_0x2a2c('0x78')][_0x169e19][_0x2a2c('0x7c')]){_0x2f928a[_0x39efe9['joins'][_0x169e19][_0x2a2c('0x2f')]](_0x39efe9[_0x2a2c('0x78')][_0x169e19][_0x2a2c('0x7b')],null,util['format'](_0x2a2c('0x7d'),_0x39efe9[_0x2a2c('0x72')],_0x39efe9[_0x2a2c('0x78')][_0x169e19][_0x2a2c('0x7a')],_0x39efe9[_0x2a2c('0x78')][_0x169e19][_0x2a2c('0x7b')],_0x39efe9[_0x2a2c('0x78')][_0x169e19][_0x2a2c('0x7c')]));}}}if(_0x39efe9[_0x2a2c('0x7e')]){_0x39efe9[_0x2a2c('0x7e')]=JSON[_0x2a2c('0x79')](_0x39efe9[_0x2a2c('0x7e')]);_0x2f928a[_0x2a2c('0x3f')](_0x5eca0a(_0x39efe9[_0x2a2c('0x7e')][_0x2a2c('0x67')]));}_0x33c065=_0x2f928a[_0x2a2c('0xa5')]();_0x2f928a[_0x2a2c('0x1d')](_0x9493b5);_0x2f928a[_0x2a2c('0x1c')](0x0);logger[_0x2a2c('0x7f')](_0x2a2c('0x80'),_0x2f928a['toString']());return dbH[_0x2a2c('0x81')][_0x2a2c('0x32')](_0x2f928a[_0x2a2c('0x9b')](),{'type':dbH[_0x2a2c('0x81')][_0x2a2c('0x82')]['SELECT']});}})[_0x2a2c('0x23')](function(){return{'sql':_0x33c065[_0x2a2c('0x9b')]()};})[_0x2a2c('0x23')](respondWithResult(_0x51b882,null))[_0x2a2c('0x47')](handleError(_0x51b882,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index b26defa..621fd54 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 _0x5fa2=['moment','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger'];(function(_0x1811e0,_0x487da0){var _0x3ce439=function(_0x1abaf6){while(--_0x1abaf6){_0x1811e0['push'](_0x1811e0['shift']());}};_0x3ce439(++_0x487da0);}(_0x5fa2,0xa3));var _0x25fa=function(_0x3fdedb,_0x57e373){_0x3fdedb=_0x3fdedb-0x0;var _0x492efe=_0x5fa2[_0x3fdedb];return _0x492efe;};'use strict';var _=require(_0x25fa('0x0'));var util=require('util');var logger=require(_0x25fa('0x1'))('api');var moment=require(_0x25fa('0x2'));var BPromise=require('bluebird');var rp=require(_0x25fa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25fa('0x4'));var config=require(_0x25fa('0x5'));var attributes=require(_0x25fa('0x6'));module[_0x25fa('0x7')]=function(_0x10e959,_0x13a0a2){return _0x10e959[_0x25fa('0x8')](_0x25fa('0x9'),attributes,{'tableName':_0x25fa('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7afe=['util','../../config/logger','moment','request-promise','path','../../config/environment','./analyticCustomReport.attributes','define','analytics_custom_reports'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x7afe,0xea));var _0xe7af=function(_0xf80ba7,_0x2d3bea){_0xf80ba7=_0xf80ba7-0x0;var _0x5336a1=_0x7afe[_0xf80ba7];return _0x5336a1;};'use strict';var _=require('lodash');var util=require(_0xe7af('0x0'));var logger=require(_0xe7af('0x1'))('api');var moment=require(_0xe7af('0x2'));var BPromise=require('bluebird');var rp=require(_0xe7af('0x3'));var fs=require('fs');var path=require(_0xe7af('0x4'));var rimraf=require('rimraf');var config=require(_0xe7af('0x5'));var attributes=require(_0xe7af('0x6'));module['exports']=function(_0x31c4b1,_0x1635e7){return _0x31c4b1[_0xe7af('0x7')]('AnalyticCustomReport',attributes,{'tableName':_0xe7af('0x8'),'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 6cbfb85..a356e4e 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 _0x09e4=['client','request','info','request\x20sent','debug','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x09e4,0x1f0));var _0x409e=function(_0x1c07f2,_0x3a720a){_0x1c07f2=_0x1c07f2-0x0;var _0x2bfc32=_0x09e4[_0x1c07f2];return _0x2bfc32;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x409e('0x0'));var BPromise=require(_0x409e('0x1'));var rs=require(_0x409e('0x2'));var fs=require('fs');var Redis=require(_0x409e('0x3'));var db=require(_0x409e('0x4'))['db'];var utils=require(_0x409e('0x5'));var logger=require(_0x409e('0x6'))(_0x409e('0x7'));var config=require(_0x409e('0x8'));var jayson=require(_0x409e('0x9'));var client=jayson[_0x409e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f7d48,_0x40108b,_0x5161a1){return new BPromise(function(_0x205e43,_0x28a60e){return client[_0x409e('0xb')](_0x2f7d48,_0x5161a1)['then'](function(_0x5c0caf){logger[_0x409e('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x40108b,_0x409e('0xd'));logger[_0x409e('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x40108b,'request\x20sent',JSON[_0x409e('0xf')](_0x5c0caf));if(_0x5c0caf['error']){if(_0x5c0caf[_0x409e('0x10')][_0x409e('0x11')]===0x1f4){logger[_0x409e('0x10')](_0x409e('0x12'),_0x40108b,_0x5c0caf[_0x409e('0x10')][_0x409e('0x13')]);return _0x28a60e(_0x5c0caf[_0x409e('0x10')][_0x409e('0x13')]);}logger[_0x409e('0x10')](_0x409e('0x12'),_0x40108b,_0x5c0caf[_0x409e('0x10')][_0x409e('0x13')]);return _0x205e43(_0x5c0caf[_0x409e('0x10')][_0x409e('0x13')]);}else{logger[_0x409e('0xc')](_0x409e('0x12'),_0x40108b,_0x409e('0xd'));_0x205e43(_0x5c0caf[_0x409e('0x14')][_0x409e('0x13')]);}})[_0x409e('0x15')](function(_0x18c303){logger[_0x409e('0x10')](_0x409e('0x12'),_0x40108b,_0x18c303);_0x28a60e(_0x18c303);});});} \ No newline at end of file +var _0xe94e=['message','AnalyticCustomReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../config/logger','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code'];(function(_0x1761f0,_0x27fe8b){var _0x371d9f=function(_0x4b1a4e){while(--_0x4b1a4e){_0x1761f0['push'](_0x1761f0['shift']());}};_0x371d9f(++_0x27fe8b);}(_0xe94e,0x100));var _0xee94=function(_0x2b952a,_0x51a884){_0x2b952a=_0x2b952a-0x0;var _0x32af4f=_0xe94e[_0x2b952a];return _0x32af4f;};'use strict';var _=require(_0xee94('0x0'));var util=require(_0xee94('0x1'));var moment=require(_0xee94('0x2'));var BPromise=require(_0xee94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xee94('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xee94('0x5'));var client=jayson[_0xee94('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14b3dc,_0x4553c0,_0x1b641b){return new BPromise(function(_0x2b6796,_0x4080f7){return client[_0xee94('0x7')](_0x14b3dc,_0x1b641b)[_0xee94('0x8')](function(_0x2d2708){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x4553c0,_0xee94('0x9'));logger[_0xee94('0xa')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4553c0,_0xee94('0x9'),JSON[_0xee94('0xb')](_0x2d2708));if(_0x2d2708[_0xee94('0xc')]){if(_0x2d2708[_0xee94('0xc')][_0xee94('0xd')]===0x1f4){logger[_0xee94('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4553c0,_0x2d2708[_0xee94('0xc')][_0xee94('0xe')]);return _0x4080f7(_0x2d2708[_0xee94('0xc')]['message']);}logger['error'](_0xee94('0xf'),_0x4553c0,_0x2d2708[_0xee94('0xc')]['message']);return _0x2b6796(_0x2d2708['error'][_0xee94('0xe')]);}else{logger['info'](_0xee94('0xf'),_0x4553c0,'request\x20sent');_0x2b6796(_0x2d2708[_0xee94('0x10')][_0xee94('0xe')]);}})[_0xee94('0x11')](function(_0x3b414b){logger['error'](_0xee94('0xf'),_0x4553c0,_0x3b414b);_0x4080f7(_0x3b414b);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index f5166e8..b77c65f 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 _0x7e07=['/:id/run','run','/:id/query','post','put','update','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/preview','preview'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0x7e07,0x16e));var _0x77e0=function(_0x248e53,_0x123aca){_0x248e53=_0x248e53-0x0;var _0x3a75cb=_0x7e07[_0x248e53];return _0x3a75cb;};'use strict';var multer=require('multer');var util=require(_0x77e0('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x77e0('0x1'));var router=express['Router']();var fs_extra=require(_0x77e0('0x2'));var auth=require(_0x77e0('0x3'));var interaction=require(_0x77e0('0x4'));var config=require(_0x77e0('0x5'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0x77e0('0x6')](),controller[_0x77e0('0x7')]);router[_0x77e0('0x8')](_0x77e0('0x9'),auth[_0x77e0('0x6')](),controller['show']);router[_0x77e0('0x8')](_0x77e0('0xa'),auth[_0x77e0('0x6')](),controller[_0x77e0('0xb')]);router['get'](_0x77e0('0xc'),auth[_0x77e0('0x6')](),controller[_0x77e0('0xd')]);router['get'](_0x77e0('0xe'),auth[_0x77e0('0x6')](),controller['query']);router[_0x77e0('0xf')]('/',auth[_0x77e0('0x6')](),controller['create']);router[_0x77e0('0x10')](_0x77e0('0x9'),auth['isAuthenticated'](),controller[_0x77e0('0x11')]);router[_0x77e0('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x77e0('0x13')]);module[_0x77e0('0x14')]=router; \ No newline at end of file +var _0x22ef=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','post','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra'];(function(_0x392e1d,_0x125aed){var _0x486d9b=function(_0x2223a4){while(--_0x2223a4){_0x392e1d['push'](_0x392e1d['shift']());}};_0x486d9b(++_0x125aed);}(_0x22ef,0x9c));var _0xf22e=function(_0x3e3182,_0x596abc){_0x3e3182=_0x3e3182-0x0;var _0xb33c81=_0x22ef[_0x3e3182];return _0xb33c81;};'use strict';var multer=require('multer');var util=require(_0xf22e('0x0'));var path=require('path');var timeout=require(_0xf22e('0x1'));var express=require(_0xf22e('0x2'));var router=express[_0xf22e('0x3')]();var fs_extra=require(_0xf22e('0x4'));var auth=require(_0xf22e('0x5'));var interaction=require(_0xf22e('0x6'));var config=require(_0xf22e('0x7'));var controller=require('./analyticCustomReport.controller');router[_0xf22e('0x8')]('/',auth[_0xf22e('0x9')](),controller[_0xf22e('0xa')]);router[_0xf22e('0x8')](_0xf22e('0xb'),auth[_0xf22e('0x9')](),controller[_0xf22e('0xc')]);router[_0xf22e('0x8')](_0xf22e('0xd'),auth[_0xf22e('0x9')](),controller[_0xf22e('0xe')]);router[_0xf22e('0x8')](_0xf22e('0xf'),auth[_0xf22e('0x9')](),controller[_0xf22e('0x10')]);router[_0xf22e('0x8')](_0xf22e('0x11'),auth[_0xf22e('0x9')](),controller['query']);router[_0xf22e('0x12')]('/',auth[_0xf22e('0x9')](),controller['create']);router[_0xf22e('0x13')]('/:id',auth[_0xf22e('0x9')](),controller[_0xf22e('0x14')]);router[_0xf22e('0x15')]('/:id',auth[_0xf22e('0x9')](),controller[_0xf22e('0x16')]);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 7db6c3b..145304f 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 _0x8a68=['sequelize','exports','STRING','TEXT'];(function(_0x2ac71a,_0x1d2a02){var _0x3ee904=function(_0x5c902a){while(--_0x5c902a){_0x2ac71a['push'](_0x2ac71a['shift']());}};_0x3ee904(++_0x1d2a02);}(_0x8a68,0x68));var _0x88a6=function(_0x5608fe,_0x699e8){_0x5608fe=_0x5608fe-0x0;var _0x1fb255=_0x8a68[_0x5608fe];return _0x1fb255;};'use strict';var Sequelize=require(_0x88a6('0x0'));module[_0x88a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x88a6('0x2')]},'parent':{'type':Sequelize[_0x88a6('0x2')]},'table':{'type':Sequelize[_0x88a6('0x2')]},'conditions':{'type':Sequelize[_0x88a6('0x3')]},'joins':{'type':Sequelize[_0x88a6('0x3')]}}; \ No newline at end of file +var _0xbb84=['STRING','TEXT','sequelize','exports'];(function(_0x136420,_0x22ebb1){var _0x361f87=function(_0x570159){while(--_0x570159){_0x136420['push'](_0x136420['shift']());}};_0x361f87(++_0x22ebb1);}(_0xbb84,0x132));var _0x4bb8=function(_0x357979,_0x56feef){_0x357979=_0x357979-0x0;var _0xabb42f=_0xbb84[_0x357979];return _0xabb42f;};'use strict';var Sequelize=require(_0x4bb8('0x0'));module[_0x4bb8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4bb8('0x2')]},'table':{'type':Sequelize[_0x4bb8('0x2')]},'conditions':{'type':Sequelize[_0x4bb8('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 2bacc7f..7de67bc 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 _0x66bd=['moment','bluebird','mustache','sox','to-csv','ejs','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','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','DefaultReports','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','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)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','value','groupBy','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','select','countTable','COUNT(*)','run','runReport','getFields','ValidationErrorItem','html-pdf','rimraf','zip-dir'];(function(_0x5d567e,_0x35f96a){var _0x310c25=function(_0x5d255f){while(--_0x5d255f){_0x5d567e['push'](_0x5d567e['shift']());}};_0x310c25(++_0x35f96a);}(_0x66bd,0x14b));var _0xd66b=function(_0x2a9bf4,_0x5e0ffb){_0x2a9bf4=_0x2a9bf4-0x0;var _0x5f5ff1=_0x66bd[_0x2a9bf4];return _0x5f5ff1;};'use strict';var pdf=require(_0xd66b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd66b('0x1'));var zipdir=require(_0xd66b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd66b('0x3'));var BPromise=require(_0xd66b('0x4'));var Mustache=require(_0xd66b('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd66b('0x6'));var csv=require(_0xd66b('0x7'));var ejs=require(_0xd66b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd66b('0x9'));var squel=require('squel');var crypto=require(_0xd66b('0xa'));var jsforce=require(_0xd66b('0xb'));var deskjs=require(_0xd66b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd66b('0xd'));var Redis=require(_0xd66b('0xe'));var authService=require(_0xd66b('0xf'));var qs=require(_0xd66b('0x10'));var as=require(_0xd66b('0x11'));var hardwareService=require(_0xd66b('0x12'));var logger=require(_0xd66b('0x13'))(_0xd66b('0x14'));var utils=require(_0xd66b('0x15'));var config=require(_0xd66b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd66b('0x17'))['db'];var dbH=require('../../mysqldb')[_0xd66b('0x18')];function respondWithStatusCode(_0x42acf7,_0x2e4462){_0x2e4462=_0x2e4462||0xcc;return function(_0x42e489){if(_0x42e489){return _0x42acf7[_0xd66b('0x19')](_0x2e4462);}return _0x42acf7[_0xd66b('0x1a')](_0x2e4462)[_0xd66b('0x1b')]();};}function respondWithResult(_0xb4b86b,_0x5c1788){_0x5c1788=_0x5c1788||0xc8;return function(_0x3cc7d1){if(_0x3cc7d1){return _0xb4b86b[_0xd66b('0x1a')](_0x5c1788)[_0xd66b('0x1c')](_0x3cc7d1);}};}function respondWithFilteredResult(_0x4a3fce,_0x1e9a0f){return function(_0x22a1cb){if(_0x22a1cb){var _0x4a77b8=_0x22a1cb[_0xd66b('0x1d')],_0x1d5372=_0x1e9a0f['offset'],_0x45577b=_0x1e9a0f[_0xd66b('0x1e')]+_0x1e9a0f[_0xd66b('0x1f')],_0x1c8f63;if(_0x45577b>=_0x4a77b8){_0x45577b=_0x4a77b8;_0x1c8f63=0xc8;}else{_0x1c8f63=0xce;}_0x4a3fce[_0xd66b('0x1a')](_0x1c8f63);return _0x4a3fce[_0xd66b('0x20')](_0xd66b('0x21'),_0x1d5372+'-'+_0x45577b+'/'+_0x4a77b8)[_0xd66b('0x1c')](_0x22a1cb);}return null;};}function patchUpdates(_0xeb1e44){return function(_0x10e52f){try{jsonpatch['apply'](_0x10e52f,_0xeb1e44,!![]);}catch(_0x277886){return BPromise['reject'](_0x277886);}return _0x10e52f[_0xd66b('0x22')]();};}function saveUpdates(_0x1c2e1e,_0x44e02b){return function(_0x57605b){if(_0x57605b){return _0x57605b[_0xd66b('0x23')](_0x1c2e1e)[_0xd66b('0x24')](function(_0x57a6ce){return _0x57a6ce;});}return null;};}function removeEntity(_0x49a779,_0x2736ca){return function(_0x572748){if(_0x572748){return _0x572748[_0xd66b('0x25')]()['then'](function(){var _0x52f149=_0x572748[_0xd66b('0x26')]({'plain':!![]});var _0x2916b5=_0xd66b('0x27');return db['UserProfileResource'][_0xd66b('0x25')]({'where':{'type':_0x2916b5,'resourceId':_0x52f149['id']}})[_0xd66b('0x24')](function(){return _0x572748;});})[_0xd66b('0x24')](function(){_0x49a779['status'](0xcc)[_0xd66b('0x1b')]();});}};}function handleEntityNotFound(_0x5a6113,_0x5304e7){return function(_0x1ab53e){if(!_0x1ab53e){_0x5a6113[_0xd66b('0x19')](0x194);}return _0x1ab53e;};}function handleError(_0x4e299f,_0x1b0911){_0x1b0911=_0x1b0911||0x1f4;return function(_0x1bb6d3){logger['error'](_0x1bb6d3['stack']);if(_0x1bb6d3['name']){delete _0x1bb6d3[_0xd66b('0x28')];}_0x4e299f[_0xd66b('0x1a')](_0x1b0911)['send'](_0x1bb6d3);};}exports[_0xd66b('0x29')]=function(_0x13653e,_0x3b994a){var _0x419443={},_0x281a0e={},_0x2b5a78={'count':0x0,'rows':[]};var _0x5227=_[_0xd66b('0x2a')](db[_0xd66b('0x2b')][_0xd66b('0x2c')],function(_0x229f4c){return{'name':_0x229f4c[_0xd66b('0x2d')],'type':_0x229f4c[_0xd66b('0x2e')][_0xd66b('0x2f')]};});_0x281a0e[_0xd66b('0x30')]=_[_0xd66b('0x2a')](_0x5227,_0xd66b('0x28'));_0x281a0e[_0xd66b('0x31')]=_[_0xd66b('0x32')](_0x13653e['query']);_0x281a0e[_0xd66b('0x33')]=_[_0xd66b('0x34')](_0x281a0e[_0xd66b('0x30')],_0x281a0e[_0xd66b('0x31')]);_0x419443['attributes']=_[_0xd66b('0x34')](_0x281a0e[_0xd66b('0x30')],qs['fields'](_0x13653e[_0xd66b('0x31')][_0xd66b('0x35')]));_0x419443['attributes']=_0x419443[_0xd66b('0x36')][_0xd66b('0x37')]?_0x419443['attributes']:_0x281a0e[_0xd66b('0x30')];if(!_0x13653e[_0xd66b('0x31')][_0xd66b('0x38')](_0xd66b('0x39'))){_0x419443[_0xd66b('0x1f')]=qs[_0xd66b('0x1f')](_0x13653e[_0xd66b('0x31')][_0xd66b('0x1f')]);_0x419443['offset']=qs[_0xd66b('0x1e')](_0x13653e[_0xd66b('0x31')]['offset']);}_0x419443[_0xd66b('0x3a')]=qs['sort'](_0x13653e[_0xd66b('0x31')][_0xd66b('0x3b')]);_0x419443[_0xd66b('0x3c')]=qs['filters'](_[_0xd66b('0x3d')](_0x13653e[_0xd66b('0x31')],_0x281a0e['filters']),_0x5227);if(_0x13653e[_0xd66b('0x31')][_0xd66b('0x3e')]){_0x419443[_0xd66b('0x3c')]=_[_0xd66b('0x3f')](_0x419443['where'],{'$or':_[_0xd66b('0x2a')](_0x5227,function(_0x2c7b1b){if(_0x2c7b1b['type']!==_0xd66b('0x40')){var _0x660f09={};_0x660f09[_0x2c7b1b['name']]={'$like':'%'+_0x13653e[_0xd66b('0x31')][_0xd66b('0x3e')]+'%'};return _0x660f09;}})});}_0x419443=_['merge']({},_0x419443,_0x13653e[_0xd66b('0x41')]);var _0x2e8a29={'where':_0x419443[_0xd66b('0x3c')]};return db[_0xd66b('0x2b')][_0xd66b('0x1d')](_0x2e8a29)[_0xd66b('0x24')](function(_0x27b4ea){_0x2b5a78[_0xd66b('0x1d')]=_0x27b4ea;if(_0x13653e[_0xd66b('0x31')][_0xd66b('0x42')]){_0x419443[_0xd66b('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0xd66b('0x44')](_0x419443);})[_0xd66b('0x24')](function(_0x4f5df1){_0x2b5a78['rows']=_0x4f5df1;return _0x2b5a78;})[_0xd66b('0x24')](respondWithFilteredResult(_0x3b994a,_0x419443))['catch'](handleError(_0x3b994a,null));};exports[_0xd66b('0x45')]=function(_0x1d6346,_0x30730b){var _0x54ac49={'raw':!![],'where':{'id':_0x1d6346['params']['id']}},_0x2e7295={};_0x2e7295[_0xd66b('0x30')]=_[_0xd66b('0x32')](db[_0xd66b('0x2b')][_0xd66b('0x2c')]);_0x2e7295[_0xd66b('0x31')]=_[_0xd66b('0x32')](_0x1d6346[_0xd66b('0x31')]);_0x2e7295[_0xd66b('0x33')]=_['intersection'](_0x2e7295[_0xd66b('0x30')],_0x2e7295['query']);_0x54ac49['attributes']=_[_0xd66b('0x34')](_0x2e7295[_0xd66b('0x30')],qs[_0xd66b('0x35')](_0x1d6346[_0xd66b('0x31')]['fields']));_0x54ac49[_0xd66b('0x36')]=_0x54ac49[_0xd66b('0x36')]['length']?_0x54ac49[_0xd66b('0x36')]:_0x2e7295[_0xd66b('0x30')];if(_0x1d6346[_0xd66b('0x31')]['includeAll']){_0x54ac49[_0xd66b('0x43')]=[{'all':!![]}];}_0x54ac49=_['merge']({},_0x54ac49,_0x1d6346[_0xd66b('0x41')]);return db[_0xd66b('0x2b')][_0xd66b('0x46')](_0x54ac49)[_0xd66b('0x24')](handleEntityNotFound(_0x30730b,null))[_0xd66b('0x24')](respondWithResult(_0x30730b,null))[_0xd66b('0x47')](handleError(_0x30730b,null));};exports[_0xd66b('0x48')]=function(_0x5bde1a,_0x540269){return db[_0xd66b('0x2b')]['create'](_0x5bde1a[_0xd66b('0x49')],{})[_0xd66b('0x24')](function(_0x132695){var _0x10f3c5=_0x5bde1a[_0xd66b('0x4a')][_0xd66b('0x26')]({'plain':!![]});if(!_0x10f3c5)throw new Error(_0xd66b('0x4b'));if(_0x10f3c5[_0xd66b('0x4c')]==='user'){var _0x36069a=_0x132695[_0xd66b('0x26')]({'plain':!![]});var _0x241049=_0xd66b('0x4d');return db['UserProfileSection']['find']({'where':{'name':_0x241049,'userProfileId':_0x10f3c5[_0xd66b('0x4e')]},'raw':!![]})[_0xd66b('0x24')](function(_0x279624){if(_0x279624&&_0x279624[_0xd66b('0x4f')]===0x0){return db[_0xd66b('0x50')][_0xd66b('0x48')]({'name':_0x36069a[_0xd66b('0x28')],'resourceId':_0x36069a['id'],'type':_0xd66b('0x27'),'sectionId':_0x279624['id']},{})[_0xd66b('0x24')](function(){return _0x132695;});}else{return _0x132695;}})[_0xd66b('0x47')](function(_0x2755bf){logger[_0xd66b('0x51')](_0xd66b('0x52'),_0x2755bf);throw _0x2755bf;});}return _0x132695;})[_0xd66b('0x24')](respondWithResult(_0x540269,0xc9))['catch'](handleError(_0x540269,null));};exports['update']=function(_0x2c7e6c,_0x401f39){if(_0x2c7e6c[_0xd66b('0x49')]['id']){delete _0x2c7e6c[_0xd66b('0x49')]['id'];}return db[_0xd66b('0x2b')][_0xd66b('0x46')]({'where':{'id':_0x2c7e6c[_0xd66b('0x53')]['id']}})[_0xd66b('0x24')](handleEntityNotFound(_0x401f39,null))[_0xd66b('0x24')](saveUpdates(_0x2c7e6c[_0xd66b('0x49')],null))[_0xd66b('0x24')](respondWithResult(_0x401f39,null))['catch'](handleError(_0x401f39,null));};exports[_0xd66b('0x25')]=function(_0x5bb207,_0x5e738a){return db[_0xd66b('0x2b')][_0xd66b('0x46')]({'where':{'id':_0x5bb207['params']['id']}})[_0xd66b('0x24')](handleEntityNotFound(_0x5e738a,null))[_0xd66b('0x24')](removeEntity(_0x5e738a,null))[_0xd66b('0x47')](handleError(_0x5e738a,null));};exports[_0xd66b('0x54')]=function(_0x296fb7,_0x4d3bab){var _0x11be28=0xa;var _0x57ed01=['join','left_join',_0xd66b('0x55'),_0xd66b('0x56')];var _0x1e432e={'SUM':_0xd66b('0x57'),'COUNT':_0xd66b('0x58'),'COUNT DISTINCT':_0xd66b('0x59'),'MAX':_0xd66b('0x5a'),'MIN':_0xd66b('0x5b'),'AVG':_0xd66b('0x5c'),'GROUP_CONCAT':_0xd66b('0x5d'),'GROUP_CONCAT ASC':_0xd66b('0x5e'),'GROUP_CONCAT DESC':_0xd66b('0x5f')};var _0x776f0b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd66b('0x60'),'HOUR':_0xd66b('0x61'),'ROUND':_0xd66b('0x62'),'UNIX_TIMESTAMP':_0xd66b('0x63')};var _0x4536e2=function(_0x2a15b9){return!_[_0xd66b('0x64')]([_0xd66b('0x65'),'IS\x20NOT\x20NULL',_0xd66b('0x66'),_0xd66b('0x67')],_0x2a15b9);};var _0x5f4073=function(_0x49bab0){if(!_0x49bab0||!_0x49bab0[_0xd66b('0x68')]['length']){return'';}for(var _0x234cf8='(',_0x4cfd51=0x0;_0x4cfd51<_0x49bab0[_0xd66b('0x68')][_0xd66b('0x37')];_0x4cfd51+=0x1){_0x4cfd51>0x0&&(_0x234cf8+='\x20'+_0x49bab0['operator']+'\x20');_0x234cf8+=_0x49bab0[_0xd66b('0x68')][_0x4cfd51][_0xd66b('0x69')]?_0x5f4073(_0x49bab0[_0xd66b('0x68')][_0x4cfd51][_0xd66b('0x69')]):_0x49bab0[_0xd66b('0x68')][_0x4cfd51][_0xd66b('0x6a')]+'\x20'+_0x49bab0[_0xd66b('0x68')][_0x4cfd51][_0xd66b('0x6b')]+(_0x4536e2(_0x49bab0[_0xd66b('0x68')][_0x4cfd51][_0xd66b('0x6b')])?'\x20'+_0x49bab0[_0xd66b('0x68')][_0x4cfd51]['value']:'');}return _0x234cf8+')';};var _0x26c9bb={'where':{'id':_0x296fb7['params']['id']}},_0x2de9c3,_0x582f6e,_0x163218,_0xd35613,_0xf2b27f;_0x26c9bb=_[_0xd66b('0x3f')]({},_0x26c9bb,_0x296fb7[_0xd66b('0x41')]);return db[_0xd66b('0x2b')][_0xd66b('0x46')](_0x26c9bb)[_0xd66b('0x24')](function(_0x182437){if(_0x182437){_0x2de9c3=_0x182437;return _0x182437['getFields']();}return null;})[_0xd66b('0x24')](function(_0x3e7d2a){if(_0x3e7d2a){if(!_0x3e7d2a[_0xd66b('0x37')]){throw new db[(_0xd66b('0x6c'))]['ValidationErrorItem'](_0xd66b('0x6d'),0x193);}_0x582f6e=_0x3e7d2a;return db[_0xd66b('0x6e')][_0xd66b('0x44')]({'raw':!![]});}return null;})[_0xd66b('0x24')](function(_0x4519da){if(_0x4519da){_0x163218=_[_0xd66b('0x6f')](_0x4519da,'id');var _0x2e0ddc;var _0x14805a=squel['select']();_0x14805a[_0xd66b('0x70')](_0x2de9c3['table']);for(var _0x38dc9d=0x0;_0x38dc9d<_0x582f6e[_0xd66b('0x37')];_0x38dc9d+=0x1){_0x2e0ddc=_0x582f6e[_0x38dc9d][_0xd66b('0x71')]?_0x163218[_0x582f6e[_0x38dc9d][_0xd66b('0x71')]][_0xd66b('0x72')]:_0x582f6e[_0x38dc9d]['field'];_0x2e0ddc=_0x582f6e[_0x38dc9d][_0xd66b('0x73')]?_[_0xd66b('0x74')](_0x1e432e[_0x582f6e[_0x38dc9d][_0xd66b('0x73')]],'%s',_0x2e0ddc):_0x2e0ddc;_0x2e0ddc=_0x582f6e[_0x38dc9d][_0xd66b('0x75')]?_['replace'](_0x776f0b[_0x582f6e[_0x38dc9d][_0xd66b('0x75')]],'%s',_0x2e0ddc):_0x2e0ddc;if(_0x582f6e[_0x38dc9d]['groupBy']){_0x14805a['group'](_0x2e0ddc);}_0x582f6e[_0x38dc9d][_0xd66b('0x76')]&&_0x14805a[_0xd66b('0x3a')](_0x2e0ddc,_0x582f6e[_0x38dc9d][_0xd66b('0x76')]===_0xd66b('0x77')?![]:!![]);_0x14805a[_0xd66b('0x6a')](_0x2e0ddc,_0x582f6e[_0x38dc9d][_0xd66b('0x78')]||_0x2e0ddc);}if(_0x2de9c3[_0xd66b('0x79')]){_0x2de9c3['joins']=JSON[_0xd66b('0x7a')](_0x2de9c3[_0xd66b('0x79')]);for(var _0x1af25f=0x0;_0x1af25f<_0x2de9c3[_0xd66b('0x79')][_0xd66b('0x37')];_0x1af25f+=0x1){if(_0x2de9c3[_0xd66b('0x79')][_0x1af25f][_0xd66b('0x2e')]&&_['includes'](_0x57ed01,_0x2de9c3[_0xd66b('0x79')][_0x1af25f][_0xd66b('0x2e')])&&_0x2de9c3[_0xd66b('0x79')][_0x1af25f][_0xd66b('0x7b')]&&_0x2de9c3[_0xd66b('0x79')][_0x1af25f][_0xd66b('0x7c')]&&_0x2de9c3[_0xd66b('0x79')][_0x1af25f]['foreignKey']){_0x14805a[_0x2de9c3[_0xd66b('0x79')][_0x1af25f]['type']](_0x2de9c3[_0xd66b('0x79')][_0x1af25f][_0xd66b('0x7c')],null,util[_0xd66b('0x75')](_0xd66b('0x7d'),_0x2de9c3[_0xd66b('0x7e')],_0x2de9c3[_0xd66b('0x79')][_0x1af25f]['parentKey'],_0x2de9c3['joins'][_0x1af25f]['foreignTable'],_0x2de9c3[_0xd66b('0x79')][_0x1af25f][_0xd66b('0x7f')]));}}}if(_0x2de9c3[_0xd66b('0x80')]){_0x2de9c3[_0xd66b('0x80')]=JSON[_0xd66b('0x7a')](_0x2de9c3[_0xd66b('0x80')]);_0x14805a[_0xd66b('0x3c')](_0x5f4073(_0x2de9c3[_0xd66b('0x80')][_0xd66b('0x69')]));}_0xf2b27f=_0x14805a[_0xd66b('0x81')]();_0x14805a['limit'](_0x11be28);_0x14805a[_0xd66b('0x1e')](0x0);logger[_0xd66b('0x82')](_0xd66b('0x83'),_0x14805a[_0xd66b('0x84')]());return dbH[_0xd66b('0x85')]['query'](_0x14805a['toString'](),{'type':dbH[_0xd66b('0x85')][_0xd66b('0x86')][_0xd66b('0x87')]});}})[_0xd66b('0x24')](respondWithResult(_0x4d3bab,null))['catch'](handleError(_0x4d3bab,null));};function runReport(_0x3d3f37,_0x19ccfe,_0x337096){var _0x551a34=_0x19ccfe['name'];var _0x44eecc=0xa;var _0x3db7cc=[_0xd66b('0x88'),_0xd66b('0x89'),'right_join','cross_join'];var _0x264f28={'SUM':_0xd66b('0x57'),'COUNT':_0xd66b('0x58'),'COUNT DISTINCT':_0xd66b('0x59'),'MAX':_0xd66b('0x5a'),'MIN':_0xd66b('0x5b'),'AVG':_0xd66b('0x5c'),'GROUP_CONCAT':_0xd66b('0x5d'),'GROUP_CONCAT ASC':_0xd66b('0x5e'),'GROUP_CONCAT DESC':_0xd66b('0x5f')};var _0x5b26f2={'SEC_TO_TIME':_0xd66b('0x8a'),'DATE':_0xd66b('0x60'),'HOUR':_0xd66b('0x61'),'ROUND':_0xd66b('0x62'),'UNIX_TIMESTAMP':_0xd66b('0x63')};var _0x24703d=function(_0x12cbbc){return!_[_0xd66b('0x64')]([_0xd66b('0x65'),_0xd66b('0x8b'),_0xd66b('0x66'),_0xd66b('0x67')],_0x12cbbc);};var _0x407434=function(_0x172a64){if(!_0x172a64||!_0x172a64[_0xd66b('0x68')][_0xd66b('0x37')]){return'';}for(var _0x479667='(',_0x1fcf0a=0x0;_0x1fcf0a<_0x172a64[_0xd66b('0x68')]['length'];_0x1fcf0a+=0x1){_0x1fcf0a>0x0&&(_0x479667+='\x20'+_0x172a64['operator']+'\x20');_0x479667+=_0x172a64['rules'][_0x1fcf0a][_0xd66b('0x69')]?_0x407434(_0x172a64[_0xd66b('0x68')][_0x1fcf0a][_0xd66b('0x69')]):_0x172a64[_0xd66b('0x68')][_0x1fcf0a]['field']+'\x20'+_0x172a64[_0xd66b('0x68')][_0x1fcf0a][_0xd66b('0x6b')]+(_0x24703d(_0x172a64[_0xd66b('0x68')][_0x1fcf0a]['condition'])?'\x20'+_0x172a64[_0xd66b('0x68')][_0x1fcf0a][_0xd66b('0x8c')]:'');}return _0x479667+')';};var _0x4ef8b8={'where':{'id':_0x3d3f37['id']}},_0x3d85d0,_0x37c071,_0x45821e,_0x20a8fa,_0x3bb165;_0x4ef8b8=_[_0xd66b('0x3f')]({},_0x4ef8b8,_0x337096);return db['AnalyticDefaultReport'][_0xd66b('0x46')](_0x4ef8b8)['then'](function(_0x4ea839){if(_0x4ea839){_0x3d85d0=_0x4ea839;return _0x4ea839['getFields']();}return null;})[_0xd66b('0x24')](function(_0x417ed1){if(_0x417ed1){if(!_0x417ed1['length']){throw new db[(_0xd66b('0x6c'))]['ValidationErrorItem'](_0xd66b('0x6d'),0x193);}_0x37c071=_0x417ed1;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x471547){if(_0x471547){_0x45821e=_[_0xd66b('0x6f')](_0x471547,'id');var _0x43f201;var _0xce9da7=squel['select']();_0xce9da7[_0xd66b('0x70')](_0x3d85d0['table']);for(var _0x51ab57=0x0;_0x51ab57<_0x37c071[_0xd66b('0x37')];_0x51ab57+=0x1){_0x43f201=_0x37c071[_0x51ab57][_0xd66b('0x71')]?_0x45821e[_0x37c071[_0x51ab57][_0xd66b('0x71')]][_0xd66b('0x72')]:_0x37c071[_0x51ab57][_0xd66b('0x6a')];_0x43f201=_0x37c071[_0x51ab57][_0xd66b('0x73')]?_[_0xd66b('0x74')](_0x264f28[_0x37c071[_0x51ab57][_0xd66b('0x73')]],'%s',_0x43f201):_0x43f201;_0x43f201=_0x37c071[_0x51ab57][_0xd66b('0x75')]?_[_0xd66b('0x74')](_0x5b26f2[_0x37c071[_0x51ab57]['format']],'%s',_0x43f201):_0x43f201;if(_0x37c071[_0x51ab57][_0xd66b('0x8d')]){_0xce9da7[_0xd66b('0x69')](_0x43f201);}_0x37c071[_0x51ab57]['orderBy']&&_0xce9da7[_0xd66b('0x3a')](_0x43f201,_0x37c071[_0x51ab57]['orderBy']==='DESC'?![]:!![]);_0xce9da7['field'](_0x43f201,_0x37c071[_0x51ab57][_0xd66b('0x78')]||_0x43f201);}if(_0x3d85d0[_0xd66b('0x79')]){_0x3d85d0[_0xd66b('0x79')]=JSON['parse'](_0x3d85d0[_0xd66b('0x79')]);for(var _0x3cb102=0x0;_0x3cb102<_0x3d85d0[_0xd66b('0x79')][_0xd66b('0x37')];_0x3cb102+=0x1){if(_0x3d85d0[_0xd66b('0x79')][_0x3cb102][_0xd66b('0x2e')]&&_[_0xd66b('0x64')](_0x3db7cc,_0x3d85d0[_0xd66b('0x79')][_0x3cb102][_0xd66b('0x2e')])&&_0x3d85d0['joins'][_0x3cb102]['parentKey']&&_0x3d85d0[_0xd66b('0x79')][_0x3cb102][_0xd66b('0x7c')]&&_0x3d85d0[_0xd66b('0x79')][_0x3cb102]['foreignKey']){_0xce9da7[_0x3d85d0[_0xd66b('0x79')][_0x3cb102]['type']](_0x3d85d0[_0xd66b('0x79')][_0x3cb102][_0xd66b('0x7c')],null,util['format'](_0xd66b('0x7d'),_0x3d85d0[_0xd66b('0x7e')],_0x3d85d0[_0xd66b('0x79')][_0x3cb102][_0xd66b('0x7b')],_0x3d85d0[_0xd66b('0x79')][_0x3cb102][_0xd66b('0x7c')],_0x3d85d0[_0xd66b('0x79')][_0x3cb102]['foreignKey']));}}}if(_0x3d85d0[_0xd66b('0x80')]){_0x3d85d0[_0xd66b('0x80')]=JSON['parse'](_0x3d85d0[_0xd66b('0x80')]);_0xce9da7['where'](_0x407434(_0x3d85d0[_0xd66b('0x80')][_0xd66b('0x69')]));}_0x3bb165=_0xce9da7[_0xd66b('0x81')]();_0xce9da7['limit'](_0x44eecc);_0xce9da7[_0xd66b('0x1e')](0x0);return;}})[_0xd66b('0x24')](function(){if(_0x19ccfe[_0xd66b('0x8e')]===_0xd66b('0x8f')){return null;}var _0x24f8ca=_['merge'](_0x19ccfe,{'name':_0x19ccfe[_0xd66b('0x90')]||_0x19ccfe[_0xd66b('0x28')]||_0x3d85d0[_0xd66b('0x28')],'basename':_0x551a34,'savename':util[_0xd66b('0x75')](_0xd66b('0x91'),_0x19ccfe[_0xd66b('0x28')]||_0x3d85d0[_0xd66b('0x28')],require(_0xd66b('0x92'))[_0xd66b('0x93')](0x4),_0x19ccfe[_0xd66b('0x8e')]||_0xd66b('0x94')),'reportId':_0x3d85d0['id'],'reportType':'default'});return db[_0xd66b('0x95')][_0xd66b('0x48')](_0x24f8ca,{'raw':!![]});})[_0xd66b('0x24')](function(_0xcd22df){if(_0x3d85d0[_0xd66b('0x7e')]===_0xd66b('0x96')){_0x3bb165[_0xd66b('0x3c')](_0x3d85d0[_0xd66b('0x7e')]+_0xd66b('0x97'),_0x19ccfe[_0xd66b('0x98')],_0x19ccfe[_0xd66b('0x99')]);}else{_0x3bb165[_0xd66b('0x3c')](_0x3d85d0[_0xd66b('0x7e')]+_0xd66b('0x9a'),_0x19ccfe['startDate'],_0x19ccfe[_0xd66b('0x99')]);}if(_0xcd22df){logger[_0xd66b('0x9b')](_0xd66b('0x9c'),_0x3bb165['toString']());require(_0xd66b('0x9d'))[_0xd66b('0x9e')](path['join'](__dirname,_0xd66b('0x9f'),_0xcd22df[_0xd66b('0x8e')]),[_0xcd22df['id'],_0x3bb165[_0xd66b('0x84')](),path[_0xd66b('0x88')](__dirname,'../../files/reports',_0xcd22df['savename']),_0x551a34]);return _0xcd22df;}else{var _0x5709c0=squel[_0xd66b('0xa0')]();_0x5709c0['from']('('+_0x3bb165['toString']()+')',_0xd66b('0xa1'));_0x5709c0[_0xd66b('0x6a')](_0xd66b('0xa2'),_0xd66b('0x1d'));_0x3bb165[_0xd66b('0x1f')](_0x19ccfe[_0xd66b('0x1f')]||_0x44eecc);_0x3bb165[_0xd66b('0x1e')](_0x19ccfe[_0xd66b('0x1e')]||0x0);return dbH[_0xd66b('0x85')]['query'](_0x5709c0[_0xd66b('0x84')](),{'type':dbH[_0xd66b('0x85')][_0xd66b('0x86')][_0xd66b('0x87')]})[_0xd66b('0x24')](function(_0x59f303){if(!_0x59f303[_0xd66b('0x37')]){_0x20a8fa=0x0;}else{_0x20a8fa=_0x59f303[0x0][_0xd66b('0x1d')]||0x0;}return dbH[_0xd66b('0x85')]['query'](_0x3bb165['toString'](),{'type':dbH['sequelize'][_0xd66b('0x86')][_0xd66b('0x87')]});})[_0xd66b('0x24')](function(_0x40fb67){return{'rows':_0x40fb67||[],'count':_0x20a8fa};});}});}exports[_0xd66b('0xa3')]=function(_0x488871,_0x1c41c3){return runReport(_0x488871[_0xd66b('0x53')],_0x488871[_0xd66b('0x31')],_0x488871['options'])[_0xd66b('0x24')](respondWithResult(_0x1c41c3,null))['catch'](handleError(_0x1c41c3,null));};exports[_0xd66b('0xa4')]=runReport;exports['query']=function(_0x2a6a26,_0x53f18a){var _0x203b67=0xa;var _0x3fd9fc=['join',_0xd66b('0x89'),_0xd66b('0x55'),'cross_join'];var _0x2b1412={'SUM':_0xd66b('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd66b('0x59'),'MAX':_0xd66b('0x5a'),'MIN':'MIN(%s)','AVG':_0xd66b('0x5c'),'GROUP_CONCAT':_0xd66b('0x5d'),'GROUP_CONCAT ASC':_0xd66b('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1f0507={'SEC_TO_TIME':_0xd66b('0x8a'),'DATE':_0xd66b('0x60'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd66b('0x63')};var _0x5a65d4=function(_0x108f9a){return!_[_0xd66b('0x64')](['IS\x20NULL',_0xd66b('0x8b'),_0xd66b('0x66'),'IS\x20NOT\x20EMPTY'],_0x108f9a);};var _0x3c5a72=function(_0x22703f){if(!_0x22703f||!_0x22703f[_0xd66b('0x68')][_0xd66b('0x37')]){return'';}for(var _0x480c6f='(',_0x2d0070=0x0;_0x2d0070<_0x22703f['rules'][_0xd66b('0x37')];_0x2d0070+=0x1){_0x2d0070>0x0&&(_0x480c6f+='\x20'+_0x22703f['operator']+'\x20');_0x480c6f+=_0x22703f['rules'][_0x2d0070][_0xd66b('0x69')]?_0x3c5a72(_0x22703f['rules'][_0x2d0070]['group']):_0x22703f['rules'][_0x2d0070]['field']+'\x20'+_0x22703f[_0xd66b('0x68')][_0x2d0070]['condition']+(_0x5a65d4(_0x22703f[_0xd66b('0x68')][_0x2d0070][_0xd66b('0x6b')])?'\x20'+_0x22703f[_0xd66b('0x68')][_0x2d0070][_0xd66b('0x8c')]:'');}return _0x480c6f+')';};var _0x43ee36={'where':{'id':_0x2a6a26['params']['id']}},_0x415ffb,_0x5e0b48,_0xa80241,_0x13d9b8,_0x2e5fed;_0x43ee36=_[_0xd66b('0x3f')]({},_0x43ee36,_0x2a6a26[_0xd66b('0x41')]);return db[_0xd66b('0x2b')][_0xd66b('0x46')](_0x43ee36)[_0xd66b('0x24')](function(_0x5766aa){if(_0x5766aa){_0x415ffb=_0x5766aa;return _0x5766aa[_0xd66b('0xa5')]();}return null;})[_0xd66b('0x24')](function(_0x2e6687){if(_0x2e6687){if(!_0x2e6687[_0xd66b('0x37')]){throw new db[(_0xd66b('0x6c'))][(_0xd66b('0xa6'))](_0xd66b('0x6d'),0x193);}_0x5e0b48=_0x2e6687;return db[_0xd66b('0x6e')][_0xd66b('0x44')]({'raw':!![]});}return null;})[_0xd66b('0x24')](function(_0x1738de){if(_0x1738de){_0xa80241=_[_0xd66b('0x6f')](_0x1738de,'id');var _0x5b0519;var _0x1ee72f=squel[_0xd66b('0xa0')]();_0x1ee72f[_0xd66b('0x70')](_0x415ffb[_0xd66b('0x7e')]);for(var _0x37ce00=0x0;_0x37ce00<_0x5e0b48[_0xd66b('0x37')];_0x37ce00+=0x1){_0x5b0519=_0x5e0b48[_0x37ce00]['MetricId']?_0xa80241[_0x5e0b48[_0x37ce00][_0xd66b('0x71')]]['metric']:_0x5e0b48[_0x37ce00][_0xd66b('0x6a')];_0x5b0519=_0x5e0b48[_0x37ce00]['function']?_[_0xd66b('0x74')](_0x2b1412[_0x5e0b48[_0x37ce00][_0xd66b('0x73')]],'%s',_0x5b0519):_0x5b0519;_0x5b0519=_0x5e0b48[_0x37ce00][_0xd66b('0x75')]?_[_0xd66b('0x74')](_0x1f0507[_0x5e0b48[_0x37ce00][_0xd66b('0x75')]],'%s',_0x5b0519):_0x5b0519;if(_0x5e0b48[_0x37ce00][_0xd66b('0x8d')]){_0x1ee72f[_0xd66b('0x69')](_0x5b0519);}_0x5e0b48[_0x37ce00][_0xd66b('0x76')]&&_0x1ee72f['order'](_0x5b0519,_0x5e0b48[_0x37ce00][_0xd66b('0x76')]===_0xd66b('0x77')?![]:!![]);_0x1ee72f['field'](_0x5b0519,_0x5e0b48[_0x37ce00][_0xd66b('0x78')]||_0x5b0519);}if(_0x415ffb[_0xd66b('0x79')]){_0x415ffb[_0xd66b('0x79')]=JSON[_0xd66b('0x7a')](_0x415ffb[_0xd66b('0x79')]);for(var _0x305728=0x0;_0x305728<_0x415ffb['joins'][_0xd66b('0x37')];_0x305728+=0x1){if(_0x415ffb[_0xd66b('0x79')][_0x305728][_0xd66b('0x2e')]&&_[_0xd66b('0x64')](_0x3fd9fc,_0x415ffb['joins'][_0x305728][_0xd66b('0x2e')])&&_0x415ffb['joins'][_0x305728][_0xd66b('0x7b')]&&_0x415ffb[_0xd66b('0x79')][_0x305728]['foreignTable']&&_0x415ffb[_0xd66b('0x79')][_0x305728]['foreignKey']){_0x1ee72f[_0x415ffb[_0xd66b('0x79')][_0x305728][_0xd66b('0x2e')]](_0x415ffb['joins'][_0x305728]['foreignTable'],null,util['format'](_0xd66b('0x7d'),_0x415ffb[_0xd66b('0x7e')],_0x415ffb[_0xd66b('0x79')][_0x305728][_0xd66b('0x7b')],_0x415ffb['joins'][_0x305728][_0xd66b('0x7c')],_0x415ffb[_0xd66b('0x79')][_0x305728][_0xd66b('0x7f')]));}}}if(_0x415ffb[_0xd66b('0x80')]){_0x415ffb[_0xd66b('0x80')]=JSON[_0xd66b('0x7a')](_0x415ffb['conditions']);_0x1ee72f[_0xd66b('0x3c')](_0x3c5a72(_0x415ffb[_0xd66b('0x80')][_0xd66b('0x69')]));}_0x2e5fed=_0x1ee72f[_0xd66b('0x81')]();_0x1ee72f[_0xd66b('0x1f')](_0x203b67);_0x1ee72f[_0xd66b('0x1e')](0x0);logger['debug']('Limited\x20Query:',_0x1ee72f['toString']());return dbH['sequelize'][_0xd66b('0x31')](_0x1ee72f[_0xd66b('0x84')](),{'type':dbH[_0xd66b('0x85')][_0xd66b('0x86')]['SELECT']});}})['then'](function(){return{'sql':_0x2e5fed['toString']()};})[_0xd66b('0x24')](respondWithResult(_0x53f18a,null))[_0xd66b('0x47')](handleError(_0x53f18a,null));}; \ No newline at end of file +var _0x0bea=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','json','limit','set','Content-Range','reject','save','update','then','destroy','get','DefaultReports','sendStatus','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','offset','order','sort','where','pick','filter','merge','type','options','count','include','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','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)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','findAll','keyBy','select','from','MetricId','metric','function','replace','format','orderBy','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','foreignKey','conditions','clone','debug','toString','sequelize','QueryTypes','join','IS\x20EMPTY','Please\x20insert\x20at\x20least\x20one\x20field','DESC','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','SELECT','run','runReport','ROUND(%s)','IS\x20NOT\x20EMPTY','AnalyticMetric','Limited\x20Query:','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x41bcb8,_0x467524){var _0x29ca2c=function(_0x268fa4){while(--_0x268fa4){_0x41bcb8['push'](_0x41bcb8['shift']());}};_0x29ca2c(++_0x467524);}(_0x0bea,0x97));var _0xa0be=function(_0x1f7120,_0x53456a){_0x1f7120=_0x1f7120-0x0;var _0x512142=_0x0bea[_0x1f7120];return _0x512142;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa0be('0x0'));var rimraf=require(_0xa0be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa0be('0x2'));var moment=require(_0xa0be('0x3'));var BPromise=require(_0xa0be('0x4'));var Mustache=require(_0xa0be('0x5'));var util=require(_0xa0be('0x6'));var path=require(_0xa0be('0x7'));var sox=require('sox');var csv=require(_0xa0be('0x8'));var ejs=require(_0xa0be('0x9'));var fs=require('fs');var fs_extra=require(_0xa0be('0xa'));var _=require(_0xa0be('0xb'));var squel=require(_0xa0be('0xc'));var crypto=require(_0xa0be('0xd'));var jsforce=require(_0xa0be('0xe'));var deskjs=require(_0xa0be('0xf'));var toCsv=require(_0xa0be('0x8'));var querystring=require(_0xa0be('0x10'));var Papa=require(_0xa0be('0x11'));var Redis=require('ioredis');var authService=require(_0xa0be('0x12'));var qs=require(_0xa0be('0x13'));var as=require(_0xa0be('0x14'));var hardwareService=require(_0xa0be('0x15'));var logger=require(_0xa0be('0x16'))(_0xa0be('0x17'));var utils=require(_0xa0be('0x18'));var config=require(_0xa0be('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0xa0be('0x1a'))[_0xa0be('0x1b')];function respondWithStatusCode(_0x573e9c,_0x504460){_0x504460=_0x504460||0xcc;return function(_0x52b8b9){if(_0x52b8b9){return _0x573e9c['sendStatus'](_0x504460);}return _0x573e9c[_0xa0be('0x1c')](_0x504460)[_0xa0be('0x1d')]();};}function respondWithResult(_0x418a25,_0x4bce49){_0x4bce49=_0x4bce49||0xc8;return function(_0x394875){if(_0x394875){return _0x418a25[_0xa0be('0x1c')](_0x4bce49)[_0xa0be('0x1e')](_0x394875);}};}function respondWithFilteredResult(_0x4b290c,_0x25a982){return function(_0x2f1df4){if(_0x2f1df4){var _0x9ae665=_0x2f1df4['count'],_0x4f5b89=_0x25a982['offset'],_0xb2e0dd=_0x25a982['offset']+_0x25a982[_0xa0be('0x1f')],_0x36aaac;if(_0xb2e0dd>=_0x9ae665){_0xb2e0dd=_0x9ae665;_0x36aaac=0xc8;}else{_0x36aaac=0xce;}_0x4b290c[_0xa0be('0x1c')](_0x36aaac);return _0x4b290c[_0xa0be('0x20')](_0xa0be('0x21'),_0x4f5b89+'-'+_0xb2e0dd+'/'+_0x9ae665)[_0xa0be('0x1e')](_0x2f1df4);}return null;};}function patchUpdates(_0x44af65){return function(_0xebf87){try{jsonpatch['apply'](_0xebf87,_0x44af65,!![]);}catch(_0x1b7646){return BPromise[_0xa0be('0x22')](_0x1b7646);}return _0xebf87[_0xa0be('0x23')]();};}function saveUpdates(_0x1c2e68,_0x3de1ba){return function(_0x5b9381){if(_0x5b9381){return _0x5b9381[_0xa0be('0x24')](_0x1c2e68)[_0xa0be('0x25')](function(_0x3e2ce1){return _0x3e2ce1;});}return null;};}function removeEntity(_0x9b8ddb,_0x2f6fb7){return function(_0x3e4bde){if(_0x3e4bde){return _0x3e4bde[_0xa0be('0x26')]()[_0xa0be('0x25')](function(){var _0x3677b4=_0x3e4bde[_0xa0be('0x27')]({'plain':!![]});var _0x8301e3=_0xa0be('0x28');return db['UserProfileResource'][_0xa0be('0x26')]({'where':{'type':_0x8301e3,'resourceId':_0x3677b4['id']}})['then'](function(){return _0x3e4bde;});})[_0xa0be('0x25')](function(){_0x9b8ddb['status'](0xcc)[_0xa0be('0x1d')]();});}};}function handleEntityNotFound(_0x534c81,_0x71a3f6){return function(_0x4ba6ce){if(!_0x4ba6ce){_0x534c81[_0xa0be('0x29')](0x194);}return _0x4ba6ce;};}function handleError(_0x13b958,_0x467f50){_0x467f50=_0x467f50||0x1f4;return function(_0x5a5666){logger[_0xa0be('0x2a')](_0x5a5666[_0xa0be('0x2b')]);if(_0x5a5666[_0xa0be('0x2c')]){delete _0x5a5666[_0xa0be('0x2c')];}_0x13b958['status'](_0x467f50)[_0xa0be('0x2d')](_0x5a5666);};}exports['index']=function(_0x4a181c,_0xe3fa7f){var _0x119195={},_0x5cae7a={},_0x31e28c={'count':0x0,'rows':[]};var _0x79fca2=_[_0xa0be('0x2e')](db[_0xa0be('0x2f')][_0xa0be('0x30')],function(_0x37fd5b){return{'name':_0x37fd5b['fieldName'],'type':_0x37fd5b['type']['key']};});_0x5cae7a[_0xa0be('0x31')]=_[_0xa0be('0x2e')](_0x79fca2,'name');_0x5cae7a['query']=_[_0xa0be('0x32')](_0x4a181c[_0xa0be('0x33')]);_0x5cae7a[_0xa0be('0x34')]=_['intersection'](_0x5cae7a[_0xa0be('0x31')],_0x5cae7a[_0xa0be('0x33')]);_0x119195[_0xa0be('0x35')]=_[_0xa0be('0x36')](_0x5cae7a[_0xa0be('0x31')],qs[_0xa0be('0x37')](_0x4a181c[_0xa0be('0x33')][_0xa0be('0x37')]));_0x119195[_0xa0be('0x35')]=_0x119195[_0xa0be('0x35')][_0xa0be('0x38')]?_0x119195[_0xa0be('0x35')]:_0x5cae7a[_0xa0be('0x31')];if(!_0x4a181c[_0xa0be('0x33')]['hasOwnProperty']('nolimit')){_0x119195[_0xa0be('0x1f')]=qs[_0xa0be('0x1f')](_0x4a181c[_0xa0be('0x33')][_0xa0be('0x1f')]);_0x119195[_0xa0be('0x39')]=qs[_0xa0be('0x39')](_0x4a181c[_0xa0be('0x33')]['offset']);}_0x119195[_0xa0be('0x3a')]=qs[_0xa0be('0x3b')](_0x4a181c[_0xa0be('0x33')][_0xa0be('0x3b')]);_0x119195[_0xa0be('0x3c')]=qs['filters'](_[_0xa0be('0x3d')](_0x4a181c['query'],_0x5cae7a['filters']),_0x79fca2);if(_0x4a181c['query'][_0xa0be('0x3e')]){_0x119195[_0xa0be('0x3c')]=_[_0xa0be('0x3f')](_0x119195[_0xa0be('0x3c')],{'$or':_[_0xa0be('0x2e')](_0x79fca2,function(_0x1b6a8){if(_0x1b6a8[_0xa0be('0x40')]!=='VIRTUAL'){var _0xd5244={};_0xd5244[_0x1b6a8[_0xa0be('0x2c')]]={'$like':'%'+_0x4a181c[_0xa0be('0x33')][_0xa0be('0x3e')]+'%'};return _0xd5244;}})});}_0x119195=_[_0xa0be('0x3f')]({},_0x119195,_0x4a181c[_0xa0be('0x41')]);var _0x529bf6={'where':_0x119195[_0xa0be('0x3c')]};return db[_0xa0be('0x2f')]['count'](_0x529bf6)[_0xa0be('0x25')](function(_0x474b46){_0x31e28c[_0xa0be('0x42')]=_0x474b46;if(_0x4a181c[_0xa0be('0x33')]['includeAll']){_0x119195[_0xa0be('0x43')]=[{'all':!![]}];}return db[_0xa0be('0x2f')]['findAll'](_0x119195);})[_0xa0be('0x25')](function(_0x4fad31){_0x31e28c[_0xa0be('0x44')]=_0x4fad31;return _0x31e28c;})['then'](respondWithFilteredResult(_0xe3fa7f,_0x119195))[_0xa0be('0x45')](handleError(_0xe3fa7f,null));};exports['show']=function(_0x17cfbd,_0x42775f){var _0x5bdc0f={'raw':!![],'where':{'id':_0x17cfbd['params']['id']}},_0x5681e6={};_0x5681e6[_0xa0be('0x31')]=_['keys'](db[_0xa0be('0x2f')][_0xa0be('0x30')]);_0x5681e6['query']=_[_0xa0be('0x32')](_0x17cfbd[_0xa0be('0x33')]);_0x5681e6[_0xa0be('0x34')]=_[_0xa0be('0x36')](_0x5681e6['model'],_0x5681e6[_0xa0be('0x33')]);_0x5bdc0f['attributes']=_[_0xa0be('0x36')](_0x5681e6[_0xa0be('0x31')],qs[_0xa0be('0x37')](_0x17cfbd[_0xa0be('0x33')][_0xa0be('0x37')]));_0x5bdc0f[_0xa0be('0x35')]=_0x5bdc0f[_0xa0be('0x35')]['length']?_0x5bdc0f[_0xa0be('0x35')]:_0x5681e6[_0xa0be('0x31')];if(_0x17cfbd['query']['includeAll']){_0x5bdc0f[_0xa0be('0x43')]=[{'all':!![]}];}_0x5bdc0f=_[_0xa0be('0x3f')]({},_0x5bdc0f,_0x17cfbd['options']);return db['AnalyticDefaultReport'][_0xa0be('0x46')](_0x5bdc0f)[_0xa0be('0x25')](handleEntityNotFound(_0x42775f,null))['then'](respondWithResult(_0x42775f,null))['catch'](handleError(_0x42775f,null));};exports[_0xa0be('0x47')]=function(_0x3adb0a,_0x124e7c){return db['AnalyticDefaultReport'][_0xa0be('0x47')](_0x3adb0a[_0xa0be('0x48')],{})[_0xa0be('0x25')](function(_0x4867eb){var _0x25ad5a=_0x3adb0a[_0xa0be('0x49')][_0xa0be('0x27')]({'plain':!![]});if(!_0x25ad5a)throw new Error(_0xa0be('0x4a'));if(_0x25ad5a[_0xa0be('0x4b')]==='user'){var _0x23c19f=_0x4867eb[_0xa0be('0x27')]({'plain':!![]});var _0x5b5991=_0xa0be('0x4c');return db[_0xa0be('0x4d')][_0xa0be('0x46')]({'where':{'name':_0x5b5991,'userProfileId':_0x25ad5a[_0xa0be('0x4e')]},'raw':!![]})[_0xa0be('0x25')](function(_0x5789ac){if(_0x5789ac&&_0x5789ac[_0xa0be('0x4f')]===0x0){return db['UserProfileResource'][_0xa0be('0x47')]({'name':_0x23c19f[_0xa0be('0x2c')],'resourceId':_0x23c19f['id'],'type':_0xa0be('0x28'),'sectionId':_0x5789ac['id']},{})['then'](function(){return _0x4867eb;});}else{return _0x4867eb;}})[_0xa0be('0x45')](function(_0x377bc0){logger[_0xa0be('0x2a')](_0xa0be('0x50'),_0x377bc0);throw _0x377bc0;});}return _0x4867eb;})[_0xa0be('0x25')](respondWithResult(_0x124e7c,0xc9))[_0xa0be('0x45')](handleError(_0x124e7c,null));};exports[_0xa0be('0x24')]=function(_0xbf2b60,_0x452a31){if(_0xbf2b60[_0xa0be('0x48')]['id']){delete _0xbf2b60['body']['id'];}return db[_0xa0be('0x2f')][_0xa0be('0x46')]({'where':{'id':_0xbf2b60[_0xa0be('0x51')]['id']}})[_0xa0be('0x25')](handleEntityNotFound(_0x452a31,null))[_0xa0be('0x25')](saveUpdates(_0xbf2b60[_0xa0be('0x48')],null))[_0xa0be('0x25')](respondWithResult(_0x452a31,null))['catch'](handleError(_0x452a31,null));};exports['destroy']=function(_0x339bef,_0x193ea3){return db[_0xa0be('0x2f')]['find']({'where':{'id':_0x339bef[_0xa0be('0x51')]['id']}})[_0xa0be('0x25')](handleEntityNotFound(_0x193ea3,null))[_0xa0be('0x25')](removeEntity(_0x193ea3,null))['catch'](handleError(_0x193ea3,null));};exports['preview']=function(_0x6e8a34,_0x23e9a4){var _0x4c7d56=0xa;var _0x3126b9=['join',_0xa0be('0x52'),_0xa0be('0x53'),_0xa0be('0x54')];var _0x4b651a={'SUM':_0xa0be('0x55'),'COUNT':_0xa0be('0x56'),'COUNT DISTINCT':_0xa0be('0x57'),'MAX':_0xa0be('0x58'),'MIN':_0xa0be('0x59'),'AVG':_0xa0be('0x5a'),'GROUP_CONCAT':_0xa0be('0x5b'),'GROUP_CONCAT ASC':_0xa0be('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x23f110={'SEC_TO_TIME':_0xa0be('0x5d'),'DATE':_0xa0be('0x5e'),'HOUR':_0xa0be('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xa0be('0x60')};var _0xd2fe55=function(_0x41a34c){return!_[_0xa0be('0x61')]([_0xa0be('0x62'),_0xa0be('0x63'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x41a34c);};var _0x39d8a6=function(_0x2fcca7){if(!_0x2fcca7||!_0x2fcca7[_0xa0be('0x64')][_0xa0be('0x38')]){return'';}for(var _0x7b0812='(',_0x1dc3b9=0x0;_0x1dc3b9<_0x2fcca7['rules']['length'];_0x1dc3b9+=0x1){_0x1dc3b9>0x0&&(_0x7b0812+='\x20'+_0x2fcca7[_0xa0be('0x65')]+'\x20');_0x7b0812+=_0x2fcca7[_0xa0be('0x64')][_0x1dc3b9]['group']?_0x39d8a6(_0x2fcca7[_0xa0be('0x64')][_0x1dc3b9][_0xa0be('0x66')]):_0x2fcca7[_0xa0be('0x64')][_0x1dc3b9][_0xa0be('0x67')]+'\x20'+_0x2fcca7[_0xa0be('0x64')][_0x1dc3b9]['condition']+(_0xd2fe55(_0x2fcca7[_0xa0be('0x64')][_0x1dc3b9][_0xa0be('0x68')])?'\x20'+_0x2fcca7['rules'][_0x1dc3b9][_0xa0be('0x69')]:'');}return _0x7b0812+')';};var _0x4c365f={'where':{'id':_0x6e8a34[_0xa0be('0x51')]['id']}},_0x438c4b,_0x227472,_0x420957,_0x376d60,_0x3bd0b8;_0x4c365f=_[_0xa0be('0x3f')]({},_0x4c365f,_0x6e8a34['options']);return db[_0xa0be('0x2f')][_0xa0be('0x46')](_0x4c365f)['then'](function(_0x4a0733){if(_0x4a0733){_0x438c4b=_0x4a0733;return _0x4a0733[_0xa0be('0x6a')]();}return null;})['then'](function(_0x3b0b49){if(_0x3b0b49){if(!_0x3b0b49['length']){throw new db[(_0xa0be('0x6b'))][(_0xa0be('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x227472=_0x3b0b49;return db['AnalyticMetric'][_0xa0be('0x6d')]({'raw':!![]});}return null;})[_0xa0be('0x25')](function(_0x18c493){if(_0x18c493){_0x420957=_[_0xa0be('0x6e')](_0x18c493,'id');var _0x469e51;var _0x1dfa1a=squel[_0xa0be('0x6f')]();_0x1dfa1a[_0xa0be('0x70')](_0x438c4b['table']);for(var _0x4df63d=0x0;_0x4df63d<_0x227472[_0xa0be('0x38')];_0x4df63d+=0x1){_0x469e51=_0x227472[_0x4df63d][_0xa0be('0x71')]?_0x420957[_0x227472[_0x4df63d]['MetricId']][_0xa0be('0x72')]:_0x227472[_0x4df63d][_0xa0be('0x67')];_0x469e51=_0x227472[_0x4df63d][_0xa0be('0x73')]?_[_0xa0be('0x74')](_0x4b651a[_0x227472[_0x4df63d]['function']],'%s',_0x469e51):_0x469e51;_0x469e51=_0x227472[_0x4df63d][_0xa0be('0x75')]?_[_0xa0be('0x74')](_0x23f110[_0x227472[_0x4df63d]['format']],'%s',_0x469e51):_0x469e51;if(_0x227472[_0x4df63d]['groupBy']){_0x1dfa1a['group'](_0x469e51);}_0x227472[_0x4df63d][_0xa0be('0x76')]&&_0x1dfa1a[_0xa0be('0x3a')](_0x469e51,_0x227472[_0x4df63d][_0xa0be('0x76')]==='DESC'?![]:!![]);_0x1dfa1a[_0xa0be('0x67')](_0x469e51,_0x227472[_0x4df63d][_0xa0be('0x77')]||_0x469e51);}if(_0x438c4b[_0xa0be('0x78')]){_0x438c4b[_0xa0be('0x78')]=JSON[_0xa0be('0x79')](_0x438c4b[_0xa0be('0x78')]);for(var _0x6b74d7=0x0;_0x6b74d7<_0x438c4b[_0xa0be('0x78')][_0xa0be('0x38')];_0x6b74d7+=0x1){if(_0x438c4b[_0xa0be('0x78')][_0x6b74d7]['type']&&_[_0xa0be('0x61')](_0x3126b9,_0x438c4b['joins'][_0x6b74d7][_0xa0be('0x40')])&&_0x438c4b['joins'][_0x6b74d7]['parentKey']&&_0x438c4b[_0xa0be('0x78')][_0x6b74d7][_0xa0be('0x7a')]&&_0x438c4b[_0xa0be('0x78')][_0x6b74d7]['foreignKey']){_0x1dfa1a[_0x438c4b[_0xa0be('0x78')][_0x6b74d7][_0xa0be('0x40')]](_0x438c4b[_0xa0be('0x78')][_0x6b74d7][_0xa0be('0x7a')],null,util['format'](_0xa0be('0x7b'),_0x438c4b[_0xa0be('0x7c')],_0x438c4b[_0xa0be('0x78')][_0x6b74d7][_0xa0be('0x7d')],_0x438c4b[_0xa0be('0x78')][_0x6b74d7][_0xa0be('0x7a')],_0x438c4b[_0xa0be('0x78')][_0x6b74d7][_0xa0be('0x7e')]));}}}if(_0x438c4b[_0xa0be('0x7f')]){_0x438c4b[_0xa0be('0x7f')]=JSON[_0xa0be('0x79')](_0x438c4b[_0xa0be('0x7f')]);_0x1dfa1a['where'](_0x39d8a6(_0x438c4b['conditions'][_0xa0be('0x66')]));}_0x3bd0b8=_0x1dfa1a[_0xa0be('0x80')]();_0x1dfa1a[_0xa0be('0x1f')](_0x4c7d56);_0x1dfa1a[_0xa0be('0x39')](0x0);logger[_0xa0be('0x81')]('Limited\x20Query:',_0x1dfa1a['toString']());return dbH['sequelize']['query'](_0x1dfa1a[_0xa0be('0x82')](),{'type':dbH[_0xa0be('0x83')][_0xa0be('0x84')]['SELECT']});}})[_0xa0be('0x25')](respondWithResult(_0x23e9a4,null))[_0xa0be('0x45')](handleError(_0x23e9a4,null));};function runReport(_0xcdcd5b,_0x481716,_0x1a09c8){var _0x565af9=_0x481716['name'];var _0x495ee8=0xa;var _0x3d6616=[_0xa0be('0x85'),_0xa0be('0x52'),'right_join',_0xa0be('0x54')];var _0x3d211d={'SUM':'SUM(%s)','COUNT':_0xa0be('0x56'),'COUNT DISTINCT':_0xa0be('0x57'),'MAX':_0xa0be('0x58'),'MIN':_0xa0be('0x59'),'AVG':_0xa0be('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xa0be('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2929c0={'SEC_TO_TIME':_0xa0be('0x5d'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xa0be('0x60')};var _0x35074b=function(_0x107522){return!_[_0xa0be('0x61')]([_0xa0be('0x62'),_0xa0be('0x63'),_0xa0be('0x86'),'IS\x20NOT\x20EMPTY'],_0x107522);};var _0xf394c2=function(_0x649b0d){if(!_0x649b0d||!_0x649b0d['rules'][_0xa0be('0x38')]){return'';}for(var _0x2e3682='(',_0x1e5194=0x0;_0x1e5194<_0x649b0d['rules'][_0xa0be('0x38')];_0x1e5194+=0x1){_0x1e5194>0x0&&(_0x2e3682+='\x20'+_0x649b0d[_0xa0be('0x65')]+'\x20');_0x2e3682+=_0x649b0d[_0xa0be('0x64')][_0x1e5194][_0xa0be('0x66')]?_0xf394c2(_0x649b0d[_0xa0be('0x64')][_0x1e5194][_0xa0be('0x66')]):_0x649b0d[_0xa0be('0x64')][_0x1e5194][_0xa0be('0x67')]+'\x20'+_0x649b0d[_0xa0be('0x64')][_0x1e5194][_0xa0be('0x68')]+(_0x35074b(_0x649b0d[_0xa0be('0x64')][_0x1e5194][_0xa0be('0x68')])?'\x20'+_0x649b0d['rules'][_0x1e5194][_0xa0be('0x69')]:'');}return _0x2e3682+')';};var _0xcd552={'where':{'id':_0xcdcd5b['id']}},_0x5359a4,_0x28800e,_0xf933f9,_0x28cc1f,_0x394e7b;_0xcd552=_[_0xa0be('0x3f')]({},_0xcd552,_0x1a09c8);return db[_0xa0be('0x2f')][_0xa0be('0x46')](_0xcd552)[_0xa0be('0x25')](function(_0x2e4846){if(_0x2e4846){_0x5359a4=_0x2e4846;return _0x2e4846[_0xa0be('0x6a')]();}return null;})[_0xa0be('0x25')](function(_0x551128){if(_0x551128){if(!_0x551128['length']){throw new db[(_0xa0be('0x6b'))][(_0xa0be('0x6c'))](_0xa0be('0x87'),0x193);}_0x28800e=_0x551128;return db['AnalyticMetric'][_0xa0be('0x6d')]({'raw':!![]});}return null;})[_0xa0be('0x25')](function(_0x3747f4){if(_0x3747f4){_0xf933f9=_[_0xa0be('0x6e')](_0x3747f4,'id');var _0x3e7246;var _0x30b6a6=squel[_0xa0be('0x6f')]();_0x30b6a6[_0xa0be('0x70')](_0x5359a4[_0xa0be('0x7c')]);for(var _0x425a59=0x0;_0x425a59<_0x28800e[_0xa0be('0x38')];_0x425a59+=0x1){_0x3e7246=_0x28800e[_0x425a59][_0xa0be('0x71')]?_0xf933f9[_0x28800e[_0x425a59][_0xa0be('0x71')]][_0xa0be('0x72')]:_0x28800e[_0x425a59][_0xa0be('0x67')];_0x3e7246=_0x28800e[_0x425a59]['function']?_[_0xa0be('0x74')](_0x3d211d[_0x28800e[_0x425a59][_0xa0be('0x73')]],'%s',_0x3e7246):_0x3e7246;_0x3e7246=_0x28800e[_0x425a59][_0xa0be('0x75')]?_[_0xa0be('0x74')](_0x2929c0[_0x28800e[_0x425a59][_0xa0be('0x75')]],'%s',_0x3e7246):_0x3e7246;if(_0x28800e[_0x425a59]['groupBy']){_0x30b6a6['group'](_0x3e7246);}_0x28800e[_0x425a59][_0xa0be('0x76')]&&_0x30b6a6[_0xa0be('0x3a')](_0x3e7246,_0x28800e[_0x425a59]['orderBy']===_0xa0be('0x88')?![]:!![]);_0x30b6a6[_0xa0be('0x67')](_0x3e7246,_0x28800e[_0x425a59]['alias']||_0x3e7246);}if(_0x5359a4[_0xa0be('0x78')]){_0x5359a4[_0xa0be('0x78')]=JSON[_0xa0be('0x79')](_0x5359a4[_0xa0be('0x78')]);for(var _0x36f1c7=0x0;_0x36f1c7<_0x5359a4[_0xa0be('0x78')][_0xa0be('0x38')];_0x36f1c7+=0x1){if(_0x5359a4[_0xa0be('0x78')][_0x36f1c7]['type']&&_['includes'](_0x3d6616,_0x5359a4[_0xa0be('0x78')][_0x36f1c7][_0xa0be('0x40')])&&_0x5359a4['joins'][_0x36f1c7][_0xa0be('0x7d')]&&_0x5359a4[_0xa0be('0x78')][_0x36f1c7][_0xa0be('0x7a')]&&_0x5359a4[_0xa0be('0x78')][_0x36f1c7]['foreignKey']){_0x30b6a6[_0x5359a4[_0xa0be('0x78')][_0x36f1c7]['type']](_0x5359a4['joins'][_0x36f1c7]['foreignTable'],null,util['format'](_0xa0be('0x7b'),_0x5359a4[_0xa0be('0x7c')],_0x5359a4['joins'][_0x36f1c7][_0xa0be('0x7d')],_0x5359a4[_0xa0be('0x78')][_0x36f1c7]['foreignTable'],_0x5359a4[_0xa0be('0x78')][_0x36f1c7]['foreignKey']));}}}if(_0x5359a4[_0xa0be('0x7f')]){_0x5359a4[_0xa0be('0x7f')]=JSON[_0xa0be('0x79')](_0x5359a4[_0xa0be('0x7f')]);_0x30b6a6[_0xa0be('0x3c')](_0xf394c2(_0x5359a4[_0xa0be('0x7f')][_0xa0be('0x66')]));}_0x394e7b=_0x30b6a6[_0xa0be('0x80')]();_0x30b6a6[_0xa0be('0x1f')](_0x495ee8);_0x30b6a6[_0xa0be('0x39')](0x0);return;}})[_0xa0be('0x25')](function(){if(_0x481716[_0xa0be('0x89')]==='web'){return null;}var _0xbbdb30=_['merge'](_0x481716,{'name':_0x481716[_0xa0be('0x8a')]||_0x481716[_0xa0be('0x2c')]||_0x5359a4['name'],'basename':_0x565af9,'savename':util[_0xa0be('0x75')](_0xa0be('0x8b'),_0x481716[_0xa0be('0x2c')]||_0x5359a4[_0xa0be('0x2c')],require(_0xa0be('0x8c'))[_0xa0be('0x8d')](0x4),_0x481716[_0xa0be('0x89')]||_0xa0be('0x8e')),'reportId':_0x5359a4['id'],'reportType':_0xa0be('0x8f')});return db[_0xa0be('0x90')][_0xa0be('0x47')](_0xbbdb30,{'raw':!![]});})['then'](function(_0x5016b1){if(_0x5359a4[_0xa0be('0x7c')]==='cdr'){_0x394e7b[_0xa0be('0x3c')](_0x5359a4[_0xa0be('0x7c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x481716[_0xa0be('0x91')],_0x481716['endDate']);}else{_0x394e7b[_0xa0be('0x3c')](_0x5359a4[_0xa0be('0x7c')]+_0xa0be('0x92'),_0x481716[_0xa0be('0x91')],_0x481716[_0xa0be('0x93')]);}if(_0x5016b1){logger[_0xa0be('0x94')](_0xa0be('0x95'),_0x394e7b[_0xa0be('0x82')]());require(_0xa0be('0x96'))['fork'](path[_0xa0be('0x85')](__dirname,_0xa0be('0x97'),_0x5016b1[_0xa0be('0x89')]),[_0x5016b1['id'],_0x394e7b['toString'](),path[_0xa0be('0x85')](__dirname,'../../files/reports',_0x5016b1[_0xa0be('0x98')]),_0x565af9]);return _0x5016b1;}else{var _0xfa58ef=squel['select']();_0xfa58ef[_0xa0be('0x70')]('('+_0x394e7b[_0xa0be('0x82')]()+')',_0xa0be('0x99'));_0xfa58ef[_0xa0be('0x67')](_0xa0be('0x9a'),_0xa0be('0x42'));_0x394e7b[_0xa0be('0x1f')](_0x481716[_0xa0be('0x1f')]||_0x495ee8);_0x394e7b['offset'](_0x481716[_0xa0be('0x39')]||0x0);return dbH[_0xa0be('0x83')]['query'](_0xfa58ef['toString'](),{'type':dbH[_0xa0be('0x83')][_0xa0be('0x84')]['SELECT']})[_0xa0be('0x25')](function(_0x13f93b){if(!_0x13f93b['length']){_0x28cc1f=0x0;}else{_0x28cc1f=_0x13f93b[0x0][_0xa0be('0x42')]||0x0;}return dbH[_0xa0be('0x83')][_0xa0be('0x33')](_0x394e7b[_0xa0be('0x82')](),{'type':dbH[_0xa0be('0x83')][_0xa0be('0x84')][_0xa0be('0x9b')]});})[_0xa0be('0x25')](function(_0x303c5a){return{'rows':_0x303c5a||[],'count':_0x28cc1f};});}});}exports[_0xa0be('0x9c')]=function(_0x1e2369,_0x569216){return runReport(_0x1e2369[_0xa0be('0x51')],_0x1e2369[_0xa0be('0x33')],_0x1e2369[_0xa0be('0x41')])[_0xa0be('0x25')](respondWithResult(_0x569216,null))['catch'](handleError(_0x569216,null));};exports[_0xa0be('0x9d')]=runReport;exports[_0xa0be('0x33')]=function(_0x434414,_0x3346f3){var _0x1fa88e=0xa;var _0xacecb5=[_0xa0be('0x85'),_0xa0be('0x52'),_0xa0be('0x53'),_0xa0be('0x54')];var _0x27f1f7={'SUM':_0xa0be('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa0be('0x57'),'MAX':_0xa0be('0x58'),'MIN':_0xa0be('0x59'),'AVG':_0xa0be('0x5a'),'GROUP_CONCAT':_0xa0be('0x5b'),'GROUP_CONCAT ASC':_0xa0be('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x229b2b={'SEC_TO_TIME':_0xa0be('0x5d'),'DATE':'DATE(%s)','HOUR':_0xa0be('0x5f'),'ROUND':_0xa0be('0x9e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x8915a2=function(_0x50417a){return!_[_0xa0be('0x61')]([_0xa0be('0x62'),_0xa0be('0x63'),_0xa0be('0x86'),_0xa0be('0x9f')],_0x50417a);};var _0x3ffe62=function(_0x2a7821){if(!_0x2a7821||!_0x2a7821[_0xa0be('0x64')][_0xa0be('0x38')]){return'';}for(var _0xfad389='(',_0x4db4d0=0x0;_0x4db4d0<_0x2a7821[_0xa0be('0x64')]['length'];_0x4db4d0+=0x1){_0x4db4d0>0x0&&(_0xfad389+='\x20'+_0x2a7821[_0xa0be('0x65')]+'\x20');_0xfad389+=_0x2a7821[_0xa0be('0x64')][_0x4db4d0][_0xa0be('0x66')]?_0x3ffe62(_0x2a7821[_0xa0be('0x64')][_0x4db4d0][_0xa0be('0x66')]):_0x2a7821[_0xa0be('0x64')][_0x4db4d0][_0xa0be('0x67')]+'\x20'+_0x2a7821[_0xa0be('0x64')][_0x4db4d0]['condition']+(_0x8915a2(_0x2a7821[_0xa0be('0x64')][_0x4db4d0][_0xa0be('0x68')])?'\x20'+_0x2a7821[_0xa0be('0x64')][_0x4db4d0][_0xa0be('0x69')]:'');}return _0xfad389+')';};var _0xb16229={'where':{'id':_0x434414[_0xa0be('0x51')]['id']}},_0x54198d,_0x2c5bc2,_0x2a9de9,_0x3064ae,_0x4f97aa;_0xb16229=_[_0xa0be('0x3f')]({},_0xb16229,_0x434414[_0xa0be('0x41')]);return db['AnalyticDefaultReport'][_0xa0be('0x46')](_0xb16229)['then'](function(_0x4defd1){if(_0x4defd1){_0x54198d=_0x4defd1;return _0x4defd1[_0xa0be('0x6a')]();}return null;})[_0xa0be('0x25')](function(_0x18a003){if(_0x18a003){if(!_0x18a003[_0xa0be('0x38')]){throw new db['Sequelize']['ValidationErrorItem'](_0xa0be('0x87'),0x193);}_0x2c5bc2=_0x18a003;return db[_0xa0be('0xa0')][_0xa0be('0x6d')]({'raw':!![]});}return null;})[_0xa0be('0x25')](function(_0x5a2139){if(_0x5a2139){_0x2a9de9=_[_0xa0be('0x6e')](_0x5a2139,'id');var _0x2edefa;var _0x2a863f=squel['select']();_0x2a863f['from'](_0x54198d[_0xa0be('0x7c')]);for(var _0x4ca4e4=0x0;_0x4ca4e4<_0x2c5bc2[_0xa0be('0x38')];_0x4ca4e4+=0x1){_0x2edefa=_0x2c5bc2[_0x4ca4e4][_0xa0be('0x71')]?_0x2a9de9[_0x2c5bc2[_0x4ca4e4]['MetricId']]['metric']:_0x2c5bc2[_0x4ca4e4][_0xa0be('0x67')];_0x2edefa=_0x2c5bc2[_0x4ca4e4]['function']?_['replace'](_0x27f1f7[_0x2c5bc2[_0x4ca4e4][_0xa0be('0x73')]],'%s',_0x2edefa):_0x2edefa;_0x2edefa=_0x2c5bc2[_0x4ca4e4]['format']?_[_0xa0be('0x74')](_0x229b2b[_0x2c5bc2[_0x4ca4e4]['format']],'%s',_0x2edefa):_0x2edefa;if(_0x2c5bc2[_0x4ca4e4]['groupBy']){_0x2a863f[_0xa0be('0x66')](_0x2edefa);}_0x2c5bc2[_0x4ca4e4][_0xa0be('0x76')]&&_0x2a863f['order'](_0x2edefa,_0x2c5bc2[_0x4ca4e4][_0xa0be('0x76')]===_0xa0be('0x88')?![]:!![]);_0x2a863f['field'](_0x2edefa,_0x2c5bc2[_0x4ca4e4][_0xa0be('0x77')]||_0x2edefa);}if(_0x54198d[_0xa0be('0x78')]){_0x54198d[_0xa0be('0x78')]=JSON[_0xa0be('0x79')](_0x54198d[_0xa0be('0x78')]);for(var _0x1256aa=0x0;_0x1256aa<_0x54198d[_0xa0be('0x78')][_0xa0be('0x38')];_0x1256aa+=0x1){if(_0x54198d[_0xa0be('0x78')][_0x1256aa][_0xa0be('0x40')]&&_['includes'](_0xacecb5,_0x54198d[_0xa0be('0x78')][_0x1256aa]['type'])&&_0x54198d[_0xa0be('0x78')][_0x1256aa][_0xa0be('0x7d')]&&_0x54198d[_0xa0be('0x78')][_0x1256aa][_0xa0be('0x7a')]&&_0x54198d['joins'][_0x1256aa][_0xa0be('0x7e')]){_0x2a863f[_0x54198d[_0xa0be('0x78')][_0x1256aa][_0xa0be('0x40')]](_0x54198d[_0xa0be('0x78')][_0x1256aa][_0xa0be('0x7a')],null,util['format'](_0xa0be('0x7b'),_0x54198d[_0xa0be('0x7c')],_0x54198d[_0xa0be('0x78')][_0x1256aa][_0xa0be('0x7d')],_0x54198d['joins'][_0x1256aa]['foreignTable'],_0x54198d[_0xa0be('0x78')][_0x1256aa]['foreignKey']));}}}if(_0x54198d['conditions']){_0x54198d[_0xa0be('0x7f')]=JSON[_0xa0be('0x79')](_0x54198d[_0xa0be('0x7f')]);_0x2a863f[_0xa0be('0x3c')](_0x3ffe62(_0x54198d[_0xa0be('0x7f')][_0xa0be('0x66')]));}_0x4f97aa=_0x2a863f[_0xa0be('0x80')]();_0x2a863f[_0xa0be('0x1f')](_0x1fa88e);_0x2a863f[_0xa0be('0x39')](0x0);logger[_0xa0be('0x81')](_0xa0be('0xa1'),_0x2a863f[_0xa0be('0x82')]());return dbH[_0xa0be('0x83')][_0xa0be('0x33')](_0x2a863f['toString'](),{'type':dbH[_0xa0be('0x83')][_0xa0be('0x84')][_0xa0be('0x9b')]});}})[_0xa0be('0x25')](function(){return{'sql':_0x4f97aa[_0xa0be('0x82')]()};})[_0xa0be('0x25')](respondWithResult(_0x3346f3,null))[_0xa0be('0x45')](handleError(_0x3346f3,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 13cfcaa..b92ca6d 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 _0xc5b5=['./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1956c9,_0x2ad6b4){var _0x499d4=function(_0x2fa03f){while(--_0x2fa03f){_0x1956c9['push'](_0x1956c9['shift']());}};_0x499d4(++_0x2ad6b4);}(_0xc5b5,0x1b2));var _0x5c5b=function(_0x5e8c7c,_0x3429c6){_0x5e8c7c=_0x5e8c7c-0x0;var _0x48f7bd=_0xc5b5[_0x5e8c7c];return _0x48f7bd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5c5b('0x0'))(_0x5c5b('0x1'));var moment=require('moment');var BPromise=require(_0x5c5b('0x2'));var rp=require(_0x5c5b('0x3'));var fs=require('fs');var path=require(_0x5c5b('0x4'));var rimraf=require(_0x5c5b('0x5'));var config=require('../../config/environment');var attributes=require(_0x5c5b('0x6'));module[_0x5c5b('0x7')]=function(_0x27509d,_0x6cb181){return _0x27509d[_0x5c5b('0x8')](_0x5c5b('0x9'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24f1=['../../config/logger','api','moment','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x82370f,_0x3b7c69){var _0x1ba2f2=function(_0xe06603){while(--_0xe06603){_0x82370f['push'](_0x82370f['shift']());}};_0x1ba2f2(++_0x3b7c69);}(_0x24f1,0xf0));var _0x124f=function(_0x12c7e3,_0x417a84){_0x12c7e3=_0x12c7e3-0x0;var _0x348f08=_0x24f1[_0x12c7e3];return _0x348f08;};'use strict';var _=require(_0x124f('0x0'));var util=require(_0x124f('0x1'));var logger=require(_0x124f('0x2'))(_0x124f('0x3'));var moment=require(_0x124f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x124f('0x5'));var config=require('../../config/environment');var attributes=require(_0x124f('0x6'));module[_0x124f('0x7')]=function(_0x347deb,_0x545f15){return _0x347deb[_0x124f('0x8')](_0x124f('0x9'),attributes,{'tableName':_0x124f('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 4b0897e..dd8fa13 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 _0xe3ed=['message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x26c79f,_0x58e5b0){var _0xb36938=function(_0x5e8b6a){while(--_0x5e8b6a){_0x26c79f['push'](_0x26c79f['shift']());}};_0xb36938(++_0x58e5b0);}(_0xe3ed,0x8d));var _0xde3e=function(_0x42ae49,_0x2a8e60){_0x42ae49=_0x42ae49-0x0;var _0x1091a1=_0xe3ed[_0x42ae49];return _0x1091a1;};'use strict';var _=require(_0xde3e('0x0'));var util=require(_0xde3e('0x1'));var moment=require(_0xde3e('0x2'));var BPromise=require(_0xde3e('0x3'));var rs=require(_0xde3e('0x4'));var fs=require('fs');var Redis=require(_0xde3e('0x5'));var db=require(_0xde3e('0x6'))['db'];var utils=require(_0xde3e('0x7'));var logger=require('../../config/logger')(_0xde3e('0x8'));var config=require(_0xde3e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xde3e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x184b02,_0x4c4ac6,_0x47e97f){return new BPromise(function(_0x3e0bb4,_0x3b1597){return client[_0xde3e('0xb')](_0x184b02,_0x47e97f)[_0xde3e('0xc')](function(_0x76daf5){logger['info'](_0xde3e('0xd'),_0x4c4ac6,_0xde3e('0xe'));logger[_0xde3e('0xf')](_0xde3e('0x10'),_0x4c4ac6,'request\x20sent',JSON[_0xde3e('0x11')](_0x76daf5));if(_0x76daf5[_0xde3e('0x12')]){if(_0x76daf5['error'][_0xde3e('0x13')]===0x1f4){logger[_0xde3e('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4c4ac6,_0x76daf5[_0xde3e('0x12')]['message']);return _0x3b1597(_0x76daf5[_0xde3e('0x12')][_0xde3e('0x14')]);}logger[_0xde3e('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4c4ac6,_0x76daf5[_0xde3e('0x12')][_0xde3e('0x14')]);return _0x3e0bb4(_0x76daf5['error']['message']);}else{logger[_0xde3e('0x15')](_0xde3e('0xd'),_0x4c4ac6,_0xde3e('0xe'));_0x3e0bb4(_0x76daf5['result']['message']);}})[_0xde3e('0x16')](function(_0x5e041a){logger['error'](_0xde3e('0xd'),_0x4c4ac6,_0x5e041a);_0x3b1597(_0x5e041a);});});} \ No newline at end of file +var _0x1152=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x1152,0x182));var _0x2115=function(_0x1acefc,_0x5da0bf){_0x1acefc=_0x1acefc-0x0;var _0x543527=_0x1152[_0x1acefc];return _0x543527;};'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')]('AnalyticDefaultReport,\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 diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index bbf93fb..df66412 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 _0x706d=['/:id','show','/:id/preview','preview','run','/:id/query','query','post','create','put','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x706d,0x174));var _0xd706=function(_0x3f208a,_0x42a861){_0x3f208a=_0x3f208a-0x0;var _0x3af1d4=_0x706d[_0x3f208a];return _0x3af1d4;};'use strict';var multer=require(_0xd706('0x0'));var util=require('util');var path=require(_0xd706('0x1'));var timeout=require(_0xd706('0x2'));var express=require(_0xd706('0x3'));var router=express['Router']();var fs_extra=require(_0xd706('0x4'));var auth=require(_0xd706('0x5'));var interaction=require(_0xd706('0x6'));var config=require(_0xd706('0x7'));var controller=require(_0xd706('0x8'));router[_0xd706('0x9')]('/',auth[_0xd706('0xa')](),controller[_0xd706('0xb')]);router['get'](_0xd706('0xc'),auth[_0xd706('0xa')](),controller[_0xd706('0xd')]);router[_0xd706('0x9')](_0xd706('0xe'),auth[_0xd706('0xa')](),controller[_0xd706('0xf')]);router['get']('/:id/run',auth[_0xd706('0xa')](),controller[_0xd706('0x10')]);router[_0xd706('0x9')](_0xd706('0x11'),auth['isAuthenticated'](),controller[_0xd706('0x12')]);router[_0xd706('0x13')]('/',auth[_0xd706('0xa')](),controller[_0xd706('0x14')]);router[_0xd706('0x15')](_0xd706('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd706('0x16')](_0xd706('0xc'),auth[_0xd706('0xa')](),controller[_0xd706('0x17')]);module['exports']=router; \ No newline at end of file +var _0x4181=['query','post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x4181,0xec));var _0x1418=function(_0x4db08e,_0x5d51b1){_0x4db08e=_0x4db08e-0x0;var _0x55107=_0x4181[_0x4db08e];return _0x55107;};'use strict';var multer=require('multer');var util=require(_0x1418('0x0'));var path=require(_0x1418('0x1'));var timeout=require(_0x1418('0x2'));var express=require(_0x1418('0x3'));var router=express[_0x1418('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1418('0x5'));var interaction=require(_0x1418('0x6'));var config=require('../../config/environment');var controller=require(_0x1418('0x7'));router[_0x1418('0x8')]('/',auth[_0x1418('0x9')](),controller[_0x1418('0xa')]);router[_0x1418('0x8')](_0x1418('0xb'),auth[_0x1418('0x9')](),controller[_0x1418('0xc')]);router[_0x1418('0x8')](_0x1418('0xd'),auth[_0x1418('0x9')](),controller[_0x1418('0xe')]);router[_0x1418('0x8')]('/:id/run',auth[_0x1418('0x9')](),controller[_0x1418('0xf')]);router[_0x1418('0x8')](_0x1418('0x10'),auth[_0x1418('0x9')](),controller[_0x1418('0x11')]);router[_0x1418('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1418('0x13')]('/:id',auth[_0x1418('0x9')](),controller['update']);router[_0x1418('0x14')](_0x1418('0xb'),auth[_0x1418('0x9')](),controller[_0x1418('0x15')]);module[_0x1418('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 6237932..b7f476d 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 _0x2a06=['moment','exports','STRING','csv','pdf','DATE','Loading','manual','INTEGER','sequelize'];(function(_0x237b41,_0x4639f3){var _0x8544a0=function(_0x1bb11b){while(--_0x1bb11b){_0x237b41['push'](_0x237b41['shift']());}};_0x8544a0(++_0x4639f3);}(_0x2a06,0xd1));var _0x62a0=function(_0x14dd9e,_0x2cafac){_0x14dd9e=_0x14dd9e-0x0;var _0x583c61=_0x2a06[_0x14dd9e];return _0x583c61;};'use strict';var Sequelize=require(_0x62a0('0x0'));var moment=require(_0x62a0('0x1'));module[_0x62a0('0x2')]={'name':{'type':Sequelize[_0x62a0('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x62a0('0x4'),_0x62a0('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x62a0('0x4')},'savename':{'type':Sequelize[_0x62a0('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x62a0('0x6')]},'endDate':{'type':Sequelize[_0x62a0('0x6')]},'status':{'type':Sequelize[_0x62a0('0x3')],'defaultValue':_0x62a0('0x7')},'type':{'type':Sequelize['ENUM'](_0x62a0('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x62a0('0x8')},'reportId':{'type':Sequelize[_0x62a0('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x62a0('0x3')]}}; \ No newline at end of file +var _0x8d97=['STRING','ENUM','csv','pdf','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','exports'];(function(_0x1c0f4c,_0x4bea96){var _0x26eeca=function(_0x565bec){while(--_0x565bec){_0x1c0f4c['push'](_0x1c0f4c['shift']());}};_0x26eeca(++_0x4bea96);}(_0x8d97,0xfc));var _0x78d9=function(_0x27efc3,_0x343b78){_0x27efc3=_0x27efc3-0x0;var _0x187ebb=_0x8d97[_0x27efc3];return _0x187ebb;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x78d9('0x0')]={'name':{'type':Sequelize[_0x78d9('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x78d9('0x2')](_0x78d9('0x3'),_0x78d9('0x4'),_0x78d9('0x5')),'allowNull':![],'defaultValue':_0x78d9('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x78d9('0x6')]},'status':{'type':Sequelize[_0x78d9('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x78d9('0x7'),_0x78d9('0x8')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x78d9('0x9')](0xb)[_0x78d9('0xa')]},'reportType':{'type':Sequelize[_0x78d9('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 6a42a4e..e7c2760 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 _0x65c2=['stack','name','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','length','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','join','root','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','output','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','mustache','sox','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error'];(function(_0x15ab62,_0x23feb1){var _0x182543=function(_0x510ef0){while(--_0x510ef0){_0x15ab62['push'](_0x15ab62['shift']());}};_0x182543(++_0x23feb1);}(_0x65c2,0x92));var _0x265c=function(_0x37f0e2,_0x27c5d3){_0x37f0e2=_0x37f0e2-0x0;var _0x3eeb75=_0x65c2[_0x37f0e2];return _0x3eeb75;};'use strict';var pdf=require(_0x265c('0x0'));var emlformat=require(_0x265c('0x1'));var rimraf=require(_0x265c('0x2'));var zipdir=require(_0x265c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x265c('0x4'));var util=require('util');var path=require('path');var sox=require(_0x265c('0x5'));var csv=require('to-csv');var ejs=require(_0x265c('0x6'));var fs=require('fs');var fs_extra=require(_0x265c('0x7'));var _=require(_0x265c('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x265c('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x265c('0xa'));var Papa=require('papaparse');var Redis=require(_0x265c('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x265c('0xc'));var as=require(_0x265c('0xd'));var hardwareService=require(_0x265c('0xe'));var logger=require(_0x265c('0xf'))(_0x265c('0x10'));var utils=require(_0x265c('0x11'));var config=require(_0x265c('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17440f,_0x158c1d){_0x158c1d=_0x158c1d||0xcc;return function(_0x35ae7f){if(_0x35ae7f){return _0x17440f[_0x265c('0x13')](_0x158c1d);}return _0x17440f[_0x265c('0x14')](_0x158c1d)[_0x265c('0x15')]();};}function respondWithResult(_0x2ee295,_0x4b9463){_0x4b9463=_0x4b9463||0xc8;return function(_0x49aae5){if(_0x49aae5){return _0x2ee295[_0x265c('0x14')](_0x4b9463)[_0x265c('0x16')](_0x49aae5);}};}function respondWithFilteredResult(_0x1465b8,_0x7ce747){return function(_0x257466){if(_0x257466){var _0xfbad24=_0x257466[_0x265c('0x17')],_0x1ab230=_0x7ce747[_0x265c('0x18')],_0x21a391=_0x7ce747[_0x265c('0x18')]+_0x7ce747['limit'],_0x17372d;if(_0x21a391>=_0xfbad24){_0x21a391=_0xfbad24;_0x17372d=0xc8;}else{_0x17372d=0xce;}_0x1465b8[_0x265c('0x14')](_0x17372d);return _0x1465b8['set'](_0x265c('0x19'),_0x1ab230+'-'+_0x21a391+'/'+_0xfbad24)[_0x265c('0x16')](_0x257466);}return null;};}function patchUpdates(_0x301adf){return function(_0x9b3719){try{jsonpatch[_0x265c('0x1a')](_0x9b3719,_0x301adf,!![]);}catch(_0x46975c){return BPromise[_0x265c('0x1b')](_0x46975c);}return _0x9b3719[_0x265c('0x1c')]();};}function saveUpdates(_0xd5cf96,_0x57c71a){return function(_0x30e089){if(_0x30e089){return _0x30e089[_0x265c('0x1d')](_0xd5cf96)[_0x265c('0x1e')](function(_0x13f793){return _0x13f793;});}return null;};}function removeEntity(_0x463b95,_0x3370c5){return function(_0x5c0901){if(_0x5c0901){return _0x5c0901[_0x265c('0x1f')]()[_0x265c('0x1e')](function(){var _0x16a3eb=_0x5c0901['get']({'plain':!![]});var _0x25d4d3='ExtractedReports';return db[_0x265c('0x20')][_0x265c('0x1f')]({'where':{'type':_0x25d4d3,'resourceId':_0x16a3eb['id']}})[_0x265c('0x1e')](function(){return _0x5c0901;});})[_0x265c('0x1e')](function(){_0x463b95[_0x265c('0x14')](0xcc)[_0x265c('0x15')]();});}};}function handleEntityNotFound(_0x4518f4,_0x240c1e){return function(_0x445f00){if(!_0x445f00){_0x4518f4['sendStatus'](0x194);}return _0x445f00;};}function handleError(_0x55e270,_0x5a1bb4){_0x5a1bb4=_0x5a1bb4||0x1f4;return function(_0x96878a){logger[_0x265c('0x21')](_0x96878a[_0x265c('0x22')]);if(_0x96878a[_0x265c('0x23')]){delete _0x96878a[_0x265c('0x23')];}_0x55e270[_0x265c('0x14')](_0x5a1bb4)['send'](_0x96878a);};}exports[_0x265c('0x24')]=function(_0x1d32e1,_0x57df82){var _0x148a37={},_0x49732a={},_0x5268c0={'count':0x0,'rows':[]};var _0x5308f3=_[_0x265c('0x25')](db[_0x265c('0x26')]['rawAttributes'],function(_0x13a9dd){return{'name':_0x13a9dd[_0x265c('0x27')],'type':_0x13a9dd[_0x265c('0x28')][_0x265c('0x29')]};});_0x49732a[_0x265c('0x2a')]=_['map'](_0x5308f3,'name');_0x49732a[_0x265c('0x2b')]=_[_0x265c('0x2c')](_0x1d32e1[_0x265c('0x2b')]);_0x49732a[_0x265c('0x2d')]=_[_0x265c('0x2e')](_0x49732a[_0x265c('0x2a')],_0x49732a['query']);_0x148a37[_0x265c('0x2f')]=_[_0x265c('0x2e')](_0x49732a['model'],qs[_0x265c('0x30')](_0x1d32e1[_0x265c('0x2b')][_0x265c('0x30')]));_0x148a37['attributes']=_0x148a37[_0x265c('0x2f')]['length']?_0x148a37['attributes']:_0x49732a[_0x265c('0x2a')];if(!_0x1d32e1[_0x265c('0x2b')][_0x265c('0x31')](_0x265c('0x32'))){_0x148a37[_0x265c('0x33')]=qs[_0x265c('0x33')](_0x1d32e1['query'][_0x265c('0x33')]);_0x148a37[_0x265c('0x18')]=qs[_0x265c('0x18')](_0x1d32e1[_0x265c('0x2b')]['offset']);}_0x148a37[_0x265c('0x34')]=qs[_0x265c('0x35')](_0x1d32e1[_0x265c('0x2b')][_0x265c('0x35')]);_0x148a37[_0x265c('0x36')]=qs['filters'](_[_0x265c('0x37')](_0x1d32e1[_0x265c('0x2b')],_0x49732a[_0x265c('0x2d')]),_0x5308f3);if(_0x1d32e1[_0x265c('0x2b')][_0x265c('0x38')]){_0x148a37[_0x265c('0x36')]=_[_0x265c('0x39')](_0x148a37['where'],{'$or':_[_0x265c('0x25')](_0x5308f3,function(_0x2b8212){if(_0x2b8212[_0x265c('0x28')]!=='VIRTUAL'){var _0xf029df={};_0xf029df[_0x2b8212[_0x265c('0x23')]]={'$like':'%'+_0x1d32e1[_0x265c('0x2b')][_0x265c('0x38')]+'%'};return _0xf029df;}})});}_0x148a37=_['merge']({},_0x148a37,_0x1d32e1[_0x265c('0x3a')]);var _0x3dd4be={'where':_0x148a37['where']};return db[_0x265c('0x26')][_0x265c('0x17')](_0x3dd4be)[_0x265c('0x1e')](function(_0x4cf614){_0x5268c0[_0x265c('0x17')]=_0x4cf614;if(_0x1d32e1[_0x265c('0x2b')][_0x265c('0x3b')]){_0x148a37[_0x265c('0x3c')]=[{'all':!![]}];}return db[_0x265c('0x26')][_0x265c('0x3d')](_0x148a37);})[_0x265c('0x1e')](function(_0x23efac){_0x5268c0['rows']=_0x23efac;return _0x5268c0;})[_0x265c('0x1e')](respondWithFilteredResult(_0x57df82,_0x148a37))['catch'](handleError(_0x57df82,null));};exports[_0x265c('0x3e')]=function(_0x2b4774,_0x228d9b){var _0x21c9cb={'raw':!![],'where':{'id':_0x2b4774[_0x265c('0x3f')]['id']}},_0x422d55={};_0x422d55['model']=_[_0x265c('0x2c')](db[_0x265c('0x26')][_0x265c('0x40')]);_0x422d55[_0x265c('0x2b')]=_[_0x265c('0x2c')](_0x2b4774['query']);_0x422d55[_0x265c('0x2d')]=_['intersection'](_0x422d55[_0x265c('0x2a')],_0x422d55[_0x265c('0x2b')]);_0x21c9cb[_0x265c('0x2f')]=_[_0x265c('0x2e')](_0x422d55[_0x265c('0x2a')],qs['fields'](_0x2b4774[_0x265c('0x2b')]['fields']));_0x21c9cb['attributes']=_0x21c9cb['attributes'][_0x265c('0x41')]?_0x21c9cb[_0x265c('0x2f')]:_0x422d55[_0x265c('0x2a')];if(_0x2b4774[_0x265c('0x2b')][_0x265c('0x3b')]){_0x21c9cb[_0x265c('0x3c')]=[{'all':!![]}];}_0x21c9cb=_[_0x265c('0x39')]({},_0x21c9cb,_0x2b4774[_0x265c('0x3a')]);return db['AnalyticExtractedReport']['find'](_0x21c9cb)[_0x265c('0x1e')](handleEntityNotFound(_0x228d9b,null))[_0x265c('0x1e')](respondWithResult(_0x228d9b,null))[_0x265c('0x42')](handleError(_0x228d9b,null));};exports[_0x265c('0x43')]=function(_0x2e9ece,_0x338cb2){return db[_0x265c('0x26')][_0x265c('0x43')](_0x2e9ece[_0x265c('0x44')],{})[_0x265c('0x1e')](function(_0x770445){var _0x53bcf6=_0x2e9ece[_0x265c('0x45')][_0x265c('0x46')]({'plain':!![]});if(!_0x53bcf6)throw new Error(_0x265c('0x47'));if(_0x53bcf6[_0x265c('0x48')]==='user'){var _0x2ef436=_0x770445['get']({'plain':!![]});var _0x47fa45=_0x265c('0x49');return db[_0x265c('0x4a')][_0x265c('0x4b')]({'where':{'name':_0x47fa45,'userProfileId':_0x53bcf6[_0x265c('0x4c')]},'raw':!![]})[_0x265c('0x1e')](function(_0x17628d){if(_0x17628d&&_0x17628d[_0x265c('0x4d')]===0x0){return db[_0x265c('0x20')][_0x265c('0x43')]({'name':_0x2ef436['name'],'resourceId':_0x2ef436['id'],'type':_0x17628d[_0x265c('0x23')],'sectionId':_0x17628d['id']},{})[_0x265c('0x1e')](function(){return _0x770445;});}else{return _0x770445;}})[_0x265c('0x42')](function(_0x412656){logger[_0x265c('0x21')](_0x265c('0x4e'),_0x412656);throw _0x412656;});}return _0x770445;})[_0x265c('0x1e')](respondWithResult(_0x338cb2,0xc9))['catch'](handleError(_0x338cb2,null));};exports['update']=function(_0x4d6190,_0x1120bc){if(_0x4d6190['body']['id']){delete _0x4d6190[_0x265c('0x44')]['id'];}return db[_0x265c('0x26')][_0x265c('0x4b')]({'where':{'id':_0x4d6190[_0x265c('0x3f')]['id']}})[_0x265c('0x1e')](handleEntityNotFound(_0x1120bc,null))['then'](saveUpdates(_0x4d6190['body'],null))[_0x265c('0x1e')](respondWithResult(_0x1120bc,null))['catch'](handleError(_0x1120bc,null));};exports[_0x265c('0x1f')]=function(_0x56dbf5,_0x390001){return db[_0x265c('0x26')][_0x265c('0x4b')]({'where':{'id':_0x56dbf5[_0x265c('0x3f')]['id']}})[_0x265c('0x1e')](handleEntityNotFound(_0x390001,null))[_0x265c('0x1e')](removeEntity(_0x390001,null))[_0x265c('0x42')](handleError(_0x390001,null));};exports['download']=function(_0xfbfe95,_0x5f4e68,_0x375dd5){return db[_0x265c('0x26')]['find']({'where':{'id':_0xfbfe95['params']['id']},'attributes':[_0x265c('0x23'),_0x265c('0x4f'),_0x265c('0x50'),'output'],'raw':!![]})[_0x265c('0x1e')](handleEntityNotFound(_0x5f4e68,null))['then'](function(_0x1020de){if(_0x1020de){if(!fs['existsSync'](path[_0x265c('0x51')](config[_0x265c('0x52')],'server/files/reports',_0x1020de[_0x265c('0x50')]))){throw new db['Sequelize']['ValidationError'](_0x265c('0x53'));}if(_0xfbfe95['query'][_0x265c('0x54')]){return _0x5f4e68[_0x265c('0x13')](0xc8);}return _0x5f4e68[_0x265c('0x55')](path[_0x265c('0x51')](config[_0x265c('0x52')],'server/files/reports',_0x1020de['savename']),util[_0x265c('0x56')](_0x265c('0x57'),_0x1020de[_0x265c('0x4f')]||_0x1020de[_0x265c('0x23')],_0x1020de[_0x265c('0x58')][_0x265c('0x59')]()));}})[_0x265c('0x42')](handleError(_0x5f4e68,null));}; \ No newline at end of file +var _0x857f=['ExtractedReports','UserProfileResource','error','name','send','index','AnalyticExtractedReport','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','limit','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','%s.%s','toLowerCase','html-pdf','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','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','update','then','destroy','get'];(function(_0x1655f5,_0x62c62a){var _0x4a5b72=function(_0x49e8ff){while(--_0x49e8ff){_0x1655f5['push'](_0x1655f5['shift']());}};_0x4a5b72(++_0x62c62a);}(_0x857f,0x155));var _0xf857=function(_0x38febf,_0x1fdebc){_0x38febf=_0x38febf-0x0;var _0x36db7f=_0x857f[_0x38febf];return _0x36db7f;};'use strict';var pdf=require(_0xf857('0x0'));var emlformat=require(_0xf857('0x1'));var rimraf=require(_0xf857('0x2'));var zipdir=require(_0xf857('0x3'));var jsonpatch=require(_0xf857('0x4'));var rp=require(_0xf857('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf857('0x6'));var util=require(_0xf857('0x7'));var path=require(_0xf857('0x8'));var sox=require(_0xf857('0x9'));var csv=require(_0xf857('0xa'));var ejs=require(_0xf857('0xb'));var fs=require('fs');var fs_extra=require(_0xf857('0xc'));var _=require(_0xf857('0xd'));var squel=require(_0xf857('0xe'));var crypto=require(_0xf857('0xf'));var jsforce=require(_0xf857('0x10'));var deskjs=require(_0xf857('0x11'));var toCsv=require(_0xf857('0xa'));var querystring=require('querystring');var Papa=require(_0xf857('0x12'));var Redis=require('ioredis');var authService=require(_0xf857('0x13'));var qs=require(_0xf857('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf857('0x15'));var logger=require(_0xf857('0x16'))(_0xf857('0x17'));var utils=require(_0xf857('0x18'));var config=require(_0xf857('0x19'));var licenseUtil=require(_0xf857('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e13c9,_0x26fa8b){_0x26fa8b=_0x26fa8b||0xcc;return function(_0x3ae1ee){if(_0x3ae1ee){return _0x5e13c9[_0xf857('0x1b')](_0x26fa8b);}return _0x5e13c9[_0xf857('0x1c')](_0x26fa8b)[_0xf857('0x1d')]();};}function respondWithResult(_0x55310a,_0x13b0ef){_0x13b0ef=_0x13b0ef||0xc8;return function(_0x532303){if(_0x532303){return _0x55310a[_0xf857('0x1c')](_0x13b0ef)[_0xf857('0x1e')](_0x532303);}};}function respondWithFilteredResult(_0x3aa853,_0x2a1490){return function(_0x172bf0){if(_0x172bf0){var _0x44ddb5=_0x172bf0[_0xf857('0x1f')],_0x55a2f4=_0x2a1490['offset'],_0x2ac595=_0x2a1490[_0xf857('0x20')]+_0x2a1490['limit'],_0x44003c;if(_0x2ac595>=_0x44ddb5){_0x2ac595=_0x44ddb5;_0x44003c=0xc8;}else{_0x44003c=0xce;}_0x3aa853[_0xf857('0x1c')](_0x44003c);return _0x3aa853[_0xf857('0x21')](_0xf857('0x22'),_0x55a2f4+'-'+_0x2ac595+'/'+_0x44ddb5)['json'](_0x172bf0);}return null;};}function patchUpdates(_0x1c5310){return function(_0x2a5577){try{jsonpatch['apply'](_0x2a5577,_0x1c5310,!![]);}catch(_0x28b576){return BPromise['reject'](_0x28b576);}return _0x2a5577['save']();};}function saveUpdates(_0x4f599f,_0x230679){return function(_0x37b0d0){if(_0x37b0d0){return _0x37b0d0[_0xf857('0x23')](_0x4f599f)[_0xf857('0x24')](function(_0x1661e0){return _0x1661e0;});}return null;};}function removeEntity(_0x5bc6f3,_0x5224cf){return function(_0x300383){if(_0x300383){return _0x300383[_0xf857('0x25')]()['then'](function(){var _0x4a5c7c=_0x300383[_0xf857('0x26')]({'plain':!![]});var _0xd4d516=_0xf857('0x27');return db[_0xf857('0x28')][_0xf857('0x25')]({'where':{'type':_0xd4d516,'resourceId':_0x4a5c7c['id']}})[_0xf857('0x24')](function(){return _0x300383;});})[_0xf857('0x24')](function(){_0x5bc6f3[_0xf857('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52f7bc,_0x3c5e72){return function(_0x10b283){if(!_0x10b283){_0x52f7bc[_0xf857('0x1b')](0x194);}return _0x10b283;};}function handleError(_0x53c326,_0x297da1){_0x297da1=_0x297da1||0x1f4;return function(_0x14c22){logger[_0xf857('0x29')](_0x14c22['stack']);if(_0x14c22[_0xf857('0x2a')]){delete _0x14c22[_0xf857('0x2a')];}_0x53c326['status'](_0x297da1)[_0xf857('0x2b')](_0x14c22);};}exports[_0xf857('0x2c')]=function(_0x22e343,_0x2fca62){var _0x1eb6ed={},_0x51ed9d={},_0x38895e={'count':0x0,'rows':[]};var _0x38702a=_['map'](db[_0xf857('0x2d')]['rawAttributes'],function(_0x554c79){return{'name':_0x554c79[_0xf857('0x2e')],'type':_0x554c79[_0xf857('0x2f')][_0xf857('0x30')]};});_0x51ed9d['model']=_[_0xf857('0x31')](_0x38702a,_0xf857('0x2a'));_0x51ed9d[_0xf857('0x32')]=_[_0xf857('0x33')](_0x22e343[_0xf857('0x32')]);_0x51ed9d[_0xf857('0x34')]=_[_0xf857('0x35')](_0x51ed9d[_0xf857('0x36')],_0x51ed9d[_0xf857('0x32')]);_0x1eb6ed[_0xf857('0x37')]=_[_0xf857('0x35')](_0x51ed9d[_0xf857('0x36')],qs[_0xf857('0x38')](_0x22e343[_0xf857('0x32')][_0xf857('0x38')]));_0x1eb6ed[_0xf857('0x37')]=_0x1eb6ed[_0xf857('0x37')]['length']?_0x1eb6ed[_0xf857('0x37')]:_0x51ed9d[_0xf857('0x36')];if(!_0x22e343[_0xf857('0x32')][_0xf857('0x39')]('nolimit')){_0x1eb6ed['limit']=qs[_0xf857('0x3a')](_0x22e343[_0xf857('0x32')][_0xf857('0x3a')]);_0x1eb6ed['offset']=qs[_0xf857('0x20')](_0x22e343['query'][_0xf857('0x20')]);}_0x1eb6ed['order']=qs[_0xf857('0x3b')](_0x22e343[_0xf857('0x32')][_0xf857('0x3b')]);_0x1eb6ed[_0xf857('0x3c')]=qs[_0xf857('0x34')](_['pick'](_0x22e343[_0xf857('0x32')],_0x51ed9d[_0xf857('0x34')]),_0x38702a);if(_0x22e343[_0xf857('0x32')][_0xf857('0x3d')]){_0x1eb6ed['where']=_['merge'](_0x1eb6ed[_0xf857('0x3c')],{'$or':_[_0xf857('0x31')](_0x38702a,function(_0x560591){if(_0x560591['type']!==_0xf857('0x3e')){var _0x2f2436={};_0x2f2436[_0x560591['name']]={'$like':'%'+_0x22e343[_0xf857('0x32')]['filter']+'%'};return _0x2f2436;}})});}_0x1eb6ed=_[_0xf857('0x3f')]({},_0x1eb6ed,_0x22e343[_0xf857('0x40')]);var _0x5c8cb1={'where':_0x1eb6ed[_0xf857('0x3c')]};return db[_0xf857('0x2d')][_0xf857('0x1f')](_0x5c8cb1)['then'](function(_0x4f4f3b){_0x38895e['count']=_0x4f4f3b;if(_0x22e343[_0xf857('0x32')][_0xf857('0x41')]){_0x1eb6ed['include']=[{'all':!![]}];}return db[_0xf857('0x2d')][_0xf857('0x42')](_0x1eb6ed);})['then'](function(_0x54d3a2){_0x38895e[_0xf857('0x43')]=_0x54d3a2;return _0x38895e;})[_0xf857('0x24')](respondWithFilteredResult(_0x2fca62,_0x1eb6ed))['catch'](handleError(_0x2fca62,null));};exports[_0xf857('0x44')]=function(_0x30eed7,_0x4d7928){var _0x451691={'raw':!![],'where':{'id':_0x30eed7[_0xf857('0x45')]['id']}},_0x4bf4c0={};_0x4bf4c0[_0xf857('0x36')]=_[_0xf857('0x33')](db[_0xf857('0x2d')][_0xf857('0x46')]);_0x4bf4c0['query']=_[_0xf857('0x33')](_0x30eed7['query']);_0x4bf4c0[_0xf857('0x34')]=_[_0xf857('0x35')](_0x4bf4c0[_0xf857('0x36')],_0x4bf4c0[_0xf857('0x32')]);_0x451691[_0xf857('0x37')]=_[_0xf857('0x35')](_0x4bf4c0['model'],qs[_0xf857('0x38')](_0x30eed7[_0xf857('0x32')][_0xf857('0x38')]));_0x451691['attributes']=_0x451691[_0xf857('0x37')]['length']?_0x451691[_0xf857('0x37')]:_0x4bf4c0[_0xf857('0x36')];if(_0x30eed7[_0xf857('0x32')]['includeAll']){_0x451691[_0xf857('0x47')]=[{'all':!![]}];}_0x451691=_[_0xf857('0x3f')]({},_0x451691,_0x30eed7[_0xf857('0x40')]);return db[_0xf857('0x2d')][_0xf857('0x48')](_0x451691)['then'](handleEntityNotFound(_0x4d7928,null))[_0xf857('0x24')](respondWithResult(_0x4d7928,null))['catch'](handleError(_0x4d7928,null));};exports[_0xf857('0x49')]=function(_0x6e692,_0x53304d){return db['AnalyticExtractedReport'][_0xf857('0x49')](_0x6e692[_0xf857('0x4a')],{})[_0xf857('0x24')](function(_0x4d9c5b){var _0x4248c2=_0x6e692[_0xf857('0x4b')][_0xf857('0x26')]({'plain':!![]});if(!_0x4248c2)throw new Error(_0xf857('0x4c'));if(_0x4248c2['role']==='user'){var _0x380135=_0x4d9c5b[_0xf857('0x26')]({'plain':!![]});var _0x5ba0e7=_0xf857('0x27');return db[_0xf857('0x4d')][_0xf857('0x48')]({'where':{'name':_0x5ba0e7,'userProfileId':_0x4248c2[_0xf857('0x4e')]},'raw':!![]})[_0xf857('0x24')](function(_0x14dc2d){if(_0x14dc2d&&_0x14dc2d[_0xf857('0x4f')]===0x0){return db[_0xf857('0x28')][_0xf857('0x49')]({'name':_0x380135[_0xf857('0x2a')],'resourceId':_0x380135['id'],'type':_0x14dc2d[_0xf857('0x2a')],'sectionId':_0x14dc2d['id']},{})[_0xf857('0x24')](function(){return _0x4d9c5b;});}else{return _0x4d9c5b;}})[_0xf857('0x50')](function(_0xba21b7){logger[_0xf857('0x29')](_0xf857('0x51'),_0xba21b7);throw _0xba21b7;});}return _0x4d9c5b;})['then'](respondWithResult(_0x53304d,0xc9))[_0xf857('0x50')](handleError(_0x53304d,null));};exports[_0xf857('0x23')]=function(_0x372c37,_0x91a818){if(_0x372c37[_0xf857('0x4a')]['id']){delete _0x372c37[_0xf857('0x4a')]['id'];}return db[_0xf857('0x2d')][_0xf857('0x48')]({'where':{'id':_0x372c37[_0xf857('0x45')]['id']}})[_0xf857('0x24')](handleEntityNotFound(_0x91a818,null))['then'](saveUpdates(_0x372c37['body'],null))[_0xf857('0x24')](respondWithResult(_0x91a818,null))['catch'](handleError(_0x91a818,null));};exports[_0xf857('0x25')]=function(_0x13ab5b,_0x1f341e){return db[_0xf857('0x2d')]['find']({'where':{'id':_0x13ab5b[_0xf857('0x45')]['id']}})[_0xf857('0x24')](handleEntityNotFound(_0x1f341e,null))[_0xf857('0x24')](removeEntity(_0x1f341e,null))[_0xf857('0x50')](handleError(_0x1f341e,null));};exports[_0xf857('0x52')]=function(_0x4c1bcd,_0x3f272b,_0x1c7df1){return db[_0xf857('0x2d')][_0xf857('0x48')]({'where':{'id':_0x4c1bcd[_0xf857('0x45')]['id']},'attributes':[_0xf857('0x2a'),_0xf857('0x53'),_0xf857('0x54'),_0xf857('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x3f272b,null))['then'](function(_0x5f403f){if(_0x5f403f){if(!fs[_0xf857('0x56')](path[_0xf857('0x57')](config[_0xf857('0x58')],_0xf857('0x59'),_0x5f403f[_0xf857('0x54')]))){throw new db[(_0xf857('0x5a'))][(_0xf857('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x4c1bcd[_0xf857('0x32')][_0xf857('0x5c')]){return _0x3f272b[_0xf857('0x1b')](0xc8);}return _0x3f272b[_0xf857('0x52')](path[_0xf857('0x57')](config[_0xf857('0x58')],_0xf857('0x59'),_0x5f403f[_0xf857('0x54')]),util['format'](_0xf857('0x5d'),_0x5f403f[_0xf857('0x53')]||_0x5f403f[_0xf857('0x2a')],_0x5f403f['output'][_0xf857('0x5e')]()));}})[_0xf857('0x50')](handleError(_0x3f272b,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 68d90c9..207f276 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 _0x7a35=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x5de445,_0x6556a){var _0x57b8c4=function(_0x27b039){while(--_0x27b039){_0x5de445['push'](_0x5de445['shift']());}};_0x57b8c4(++_0x6556a);}(_0x7a35,0x1c5));var _0x57a3=function(_0x50ffbb,_0x21a925){_0x50ffbb=_0x50ffbb-0x0;var _0x576a1c=_0x7a35[_0x50ffbb];return _0x576a1c;};'use strict';var _=require(_0x57a3('0x0'));var util=require('util');var logger=require(_0x57a3('0x1'))(_0x57a3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x57a3('0x3'));var config=require(_0x57a3('0x4'));var attributes=require(_0x57a3('0x5'));module[_0x57a3('0x6')]=function(_0x2363bf,_0x1330f9){return _0x2363bf[_0x57a3('0x7')](_0x57a3('0x8'),attributes,{'tableName':_0x57a3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9624=['rimraf','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','moment'];(function(_0x5a8269,_0xfb2f54){var _0x539ed7=function(_0x31ce98){while(--_0x31ce98){_0x5a8269['push'](_0x5a8269['shift']());}};_0x539ed7(++_0xfb2f54);}(_0x9624,0xa5));var _0x4962=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9624[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4962('0x0'));var util=require('util');var logger=require(_0x4962('0x1'))('api');var moment=require(_0x4962('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4962('0x3'));var config=require('../../config/environment');var attributes=require(_0x4962('0x4'));module['exports']=function(_0x2b7785,_0x49fd16){return _0x2b7785[_0x4962('0x5')](_0x4962('0x6'),attributes,{'tableName':_0x4962('0x7'),'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 5b0c182..4e7c843 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 _0x6d08=['error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x507bff,_0x3ce65b){var _0x714b98=function(_0x3997f9){while(--_0x3997f9){_0x507bff['push'](_0x507bff['shift']());}};_0x714b98(++_0x3ce65b);}(_0x6d08,0x1b5));var _0x86d0=function(_0x560cd8,_0x126e2f){_0x560cd8=_0x560cd8-0x0;var _0x369de0=_0x6d08[_0x560cd8];return _0x369de0;};'use strict';var _=require(_0x86d0('0x0'));var util=require(_0x86d0('0x1'));var moment=require(_0x86d0('0x2'));var BPromise=require(_0x86d0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86d0('0x4'));var db=require(_0x86d0('0x5'))['db'];var utils=require(_0x86d0('0x6'));var logger=require(_0x86d0('0x7'))(_0x86d0('0x8'));var config=require('../../config/environment');var jayson=require(_0x86d0('0x9'));var client=jayson[_0x86d0('0xa')][_0x86d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d1331,_0xf14b7c,_0x29b1e9){return new BPromise(function(_0x30022c,_0xcf26d6){return client[_0x86d0('0xc')](_0x3d1331,_0x29b1e9)[_0x86d0('0xd')](function(_0x21fab2){logger['info'](_0x86d0('0xe'),_0xf14b7c,_0x86d0('0xf'));logger[_0x86d0('0x10')](_0x86d0('0x11'),_0xf14b7c,_0x86d0('0xf'),JSON[_0x86d0('0x12')](_0x21fab2));if(_0x21fab2['error']){if(_0x21fab2['error']['code']===0x1f4){logger[_0x86d0('0x13')](_0x86d0('0xe'),_0xf14b7c,_0x21fab2[_0x86d0('0x13')]['message']);return _0xcf26d6(_0x21fab2[_0x86d0('0x13')][_0x86d0('0x14')]);}logger[_0x86d0('0x13')](_0x86d0('0xe'),_0xf14b7c,_0x21fab2[_0x86d0('0x13')][_0x86d0('0x14')]);return _0x30022c(_0x21fab2[_0x86d0('0x13')][_0x86d0('0x14')]);}else{logger[_0x86d0('0x15')](_0x86d0('0xe'),_0xf14b7c,'request\x20sent');_0x30022c(_0x21fab2[_0x86d0('0x16')][_0x86d0('0x14')]);}})[_0x86d0('0x17')](function(_0x2d81f2){logger[_0x86d0('0x13')](_0x86d0('0xe'),_0xf14b7c,_0x2d81f2);_0xcf26d6(_0x2d81f2);});});} \ No newline at end of file +var _0x33a3=['stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x1e6aca,_0x344a44){var _0x4923b3=function(_0x292414){while(--_0x292414){_0x1e6aca['push'](_0x1e6aca['shift']());}};_0x4923b3(++_0x344a44);}(_0x33a3,0xcd));var _0x333a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33a3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x333a('0x0'));var util=require('util');var moment=require(_0x333a('0x1'));var BPromise=require(_0x333a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x333a('0x3'));var db=require(_0x333a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x333a('0x5'))(_0x333a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x333a('0x7')][_0x333a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x490c5f,_0x53b8dc,_0x93f637){return new BPromise(function(_0x219bf6,_0x294a41){return client[_0x333a('0x9')](_0x490c5f,_0x93f637)['then'](function(_0x3ec517){logger[_0x333a('0xa')](_0x333a('0xb'),_0x53b8dc,_0x333a('0xc'));logger[_0x333a('0xd')](_0x333a('0xe'),_0x53b8dc,_0x333a('0xc'),JSON[_0x333a('0xf')](_0x3ec517));if(_0x3ec517[_0x333a('0x10')]){if(_0x3ec517[_0x333a('0x10')]['code']===0x1f4){logger['error'](_0x333a('0xb'),_0x53b8dc,_0x3ec517[_0x333a('0x10')][_0x333a('0x11')]);return _0x294a41(_0x3ec517['error']['message']);}logger[_0x333a('0x10')](_0x333a('0xb'),_0x53b8dc,_0x3ec517['error'][_0x333a('0x11')]);return _0x219bf6(_0x3ec517['error'][_0x333a('0x11')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x53b8dc,_0x333a('0xc'));_0x219bf6(_0x3ec517[_0x333a('0x12')][_0x333a('0x11')]);}})[_0x333a('0x13')](function(_0x190a1d){logger[_0x333a('0x10')](_0x333a('0xb'),_0x53b8dc,_0x190a1d);_0x294a41(_0x190a1d);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d78c023..c3607ce 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 _0xa472=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','post','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x28f4a3,_0x1e9165){var _0x587861=function(_0x3c4b61){while(--_0x3c4b61){_0x28f4a3['push'](_0x28f4a3['shift']());}};_0x587861(++_0x1e9165);}(_0xa472,0x6c));var _0x2a47=function(_0x373dca,_0x336990){_0x373dca=_0x373dca-0x0;var _0x7a6fe=_0xa472[_0x373dca];return _0x7a6fe;};'use strict';var multer=require(_0x2a47('0x0'));var util=require(_0x2a47('0x1'));var path=require(_0x2a47('0x2'));var timeout=require(_0x2a47('0x3'));var express=require('express');var router=express[_0x2a47('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2a47('0x5'));var interaction=require(_0x2a47('0x6'));var config=require(_0x2a47('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0x2a47('0x8')]('/',auth[_0x2a47('0x9')](),controller[_0x2a47('0xa')]);router[_0x2a47('0x8')]('/:id',auth[_0x2a47('0x9')](),controller[_0x2a47('0xb')]);router[_0x2a47('0x8')](_0x2a47('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x2a47('0xd')]('/',auth[_0x2a47('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2a47('0xe')]);router[_0x2a47('0xf')](_0x2a47('0x10'),auth[_0x2a47('0x9')](),controller[_0x2a47('0x11')]);module[_0x2a47('0x12')]=router; \ No newline at end of file +var _0x9a54=['get','/:id','isAuthenticated','show','/:id/download','download','post','create','put','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','index'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9a54,0x1e0));var _0x49a5=function(_0x48c5f6,_0x467809){_0x48c5f6=_0x48c5f6-0x0;var _0x5517a4=_0x9a54[_0x48c5f6];return _0x5517a4;};'use strict';var multer=require(_0x49a5('0x0'));var util=require(_0x49a5('0x1'));var path=require('path');var timeout=require(_0x49a5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x49a5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x49a5('0x4'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x49a5('0x5')]);router[_0x49a5('0x6')](_0x49a5('0x7'),auth[_0x49a5('0x8')](),controller[_0x49a5('0x9')]);router[_0x49a5('0x6')](_0x49a5('0xa'),auth['isAuthenticated'](),controller[_0x49a5('0xb')]);router[_0x49a5('0xc')]('/',auth[_0x49a5('0x8')](),controller[_0x49a5('0xd')]);router[_0x49a5('0xe')](_0x49a5('0x7'),auth[_0x49a5('0x8')](),controller['update']);router[_0x49a5('0xf')](_0x49a5('0x7'),auth[_0x49a5('0x8')](),controller[_0x49a5('0x10')]);module[_0x49a5('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 0c6da3f..d2335a2 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 _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x40a91d,_0x565ef0){var _0x2a887e=function(_0x369aa8){while(--_0x369aa8){_0x40a91d['push'](_0x40a91d['shift']());}};_0x2a887e(++_0x565ef0);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3474ac,_0x22d0f7){_0x3474ac=_0x3474ac-0x0;var _0x5345ec=_0x5fc3[_0x3474ac];return _0x5345ec;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7a54=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x2c53d3,_0x322f01){var _0x560182=function(_0x57957d){while(--_0x57957d){_0x2c53d3['push'](_0x2c53d3['shift']());}};_0x560182(++_0x322f01);}(_0x7a54,0x106));var _0x47a5=function(_0x210aa9,_0x47017a){_0x210aa9=_0x210aa9-0x0;var _0x593fac=_0x7a54[_0x210aa9];return _0x593fac;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'field':{'type':Sequelize[_0x47a5('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x47a5('0x3')]},'format':{'type':Sequelize[_0x47a5('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x47a5('0x3')]},'custom':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 9dacbae..40e0e6f 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 _0x475f=['key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','intersection','find','create','bulkCreate','body','params','ids','addFields','AnalyticCustomReport','findOne','transaction','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','count','limit','apply','update','then','destroy','end','sendStatus','error','stack','name','send','map','AnalyticFieldReport','rawAttributes'];(function(_0xfcc030,_0x3ec053){var _0x5caa66=function(_0xf2e6d2){while(--_0xf2e6d2){_0xfcc030['push'](_0xfcc030['shift']());}};_0x5caa66(++_0x3ec053);}(_0x475f,0x112));var _0xf475=function(_0x73e4cf,_0x2a8375){_0x73e4cf=_0x73e4cf-0x0;var _0x1e1bf8=_0x475f[_0x73e4cf];return _0x1e1bf8;};'use strict';var pdf=require(_0xf475('0x0'));var emlformat=require(_0xf475('0x1'));var rimraf=require(_0xf475('0x2'));var zipdir=require(_0xf475('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf475('0x4'));var moment=require(_0xf475('0x5'));var BPromise=require(_0xf475('0x6'));var Mustache=require(_0xf475('0x7'));var util=require(_0xf475('0x8'));var path=require(_0xf475('0x9'));var sox=require(_0xf475('0xa'));var csv=require(_0xf475('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf475('0xc'));var squel=require(_0xf475('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf475('0xb'));var querystring=require('querystring');var Papa=require(_0xf475('0xe'));var Redis=require(_0xf475('0xf'));var authService=require(_0xf475('0x10'));var qs=require(_0xf475('0x11'));var as=require(_0xf475('0x12'));var hardwareService=require(_0xf475('0x13'));var logger=require(_0xf475('0x14'))(_0xf475('0x15'));var utils=require(_0xf475('0x16'));var config=require(_0xf475('0x17'));var licenseUtil=require(_0xf475('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50fb82,_0x5f577e){_0x5f577e=_0x5f577e||0xcc;return function(_0xa65bb){if(_0xa65bb){return _0x50fb82['sendStatus'](_0x5f577e);}return _0x50fb82[_0xf475('0x19')](_0x5f577e)['end']();};}function respondWithResult(_0x59409f,_0x480bb7){_0x480bb7=_0x480bb7||0xc8;return function(_0x2f56fb){if(_0x2f56fb){return _0x59409f[_0xf475('0x19')](_0x480bb7)[_0xf475('0x1a')](_0x2f56fb);}};}function respondWithFilteredResult(_0x36efc4,_0x46332b){return function(_0x4a97ae){if(_0x4a97ae){var _0x577fc4=_0x4a97ae[_0xf475('0x1b')],_0x28f649=_0x46332b['offset'],_0x1f0ac3=_0x46332b['offset']+_0x46332b[_0xf475('0x1c')],_0x2f0ed4;if(_0x1f0ac3>=_0x577fc4){_0x1f0ac3=_0x577fc4;_0x2f0ed4=0xc8;}else{_0x2f0ed4=0xce;}_0x36efc4[_0xf475('0x19')](_0x2f0ed4);return _0x36efc4['set']('Content-Range',_0x28f649+'-'+_0x1f0ac3+'/'+_0x577fc4)[_0xf475('0x1a')](_0x4a97ae);}return null;};}function patchUpdates(_0xcb936f){return function(_0x3d3d2a){try{jsonpatch[_0xf475('0x1d')](_0x3d3d2a,_0xcb936f,!![]);}catch(_0x5981de){return BPromise['reject'](_0x5981de);}return _0x3d3d2a['save']();};}function saveUpdates(_0x15d8cd,_0x3c4ebf){return function(_0x39d950){if(_0x39d950){return _0x39d950[_0xf475('0x1e')](_0x15d8cd)[_0xf475('0x1f')](function(_0x55be4a){return _0x55be4a;});}return null;};}function removeEntity(_0x46a4c9,_0x487247){return function(_0x20d9c4){if(_0x20d9c4){return _0x20d9c4[_0xf475('0x20')]()[_0xf475('0x1f')](function(){_0x46a4c9[_0xf475('0x19')](0xcc)[_0xf475('0x21')]();});}};}function handleEntityNotFound(_0x5febd4,_0x5f1904){return function(_0x2ba680){if(!_0x2ba680){_0x5febd4[_0xf475('0x22')](0x194);}return _0x2ba680;};}function handleError(_0x4be6a4,_0x281284){_0x281284=_0x281284||0x1f4;return function(_0x5497ef){logger[_0xf475('0x23')](_0x5497ef[_0xf475('0x24')]);if(_0x5497ef[_0xf475('0x25')]){delete _0x5497ef[_0xf475('0x25')];}_0x4be6a4['status'](_0x281284)[_0xf475('0x26')](_0x5497ef);};}exports['index']=function(_0x5a35cd,_0x209ec7){var _0x49657e={},_0xfbbfe7={},_0x278bf1={'count':0x0,'rows':[]};var _0x4c8987=_[_0xf475('0x27')](db[_0xf475('0x28')][_0xf475('0x29')],function(_0x375ded){return{'name':_0x375ded['fieldName'],'type':_0x375ded['type'][_0xf475('0x2a')]};});_0xfbbfe7[_0xf475('0x2b')]=_[_0xf475('0x27')](_0x4c8987,_0xf475('0x25'));_0xfbbfe7[_0xf475('0x2c')]=_[_0xf475('0x2d')](_0x5a35cd['query']);_0xfbbfe7[_0xf475('0x2e')]=_['intersection'](_0xfbbfe7[_0xf475('0x2b')],_0xfbbfe7[_0xf475('0x2c')]);_0x49657e[_0xf475('0x2f')]=_['intersection'](_0xfbbfe7[_0xf475('0x2b')],qs['fields'](_0x5a35cd[_0xf475('0x2c')][_0xf475('0x30')]));_0x49657e['attributes']=_0x49657e[_0xf475('0x2f')][_0xf475('0x31')]?_0x49657e[_0xf475('0x2f')]:_0xfbbfe7[_0xf475('0x2b')];if(!_0x5a35cd[_0xf475('0x2c')][_0xf475('0x32')](_0xf475('0x33'))){_0x49657e[_0xf475('0x1c')]=qs[_0xf475('0x1c')](_0x5a35cd[_0xf475('0x2c')][_0xf475('0x1c')]);_0x49657e[_0xf475('0x34')]=qs['offset'](_0x5a35cd[_0xf475('0x2c')][_0xf475('0x34')]);}_0x49657e[_0xf475('0x35')]=qs[_0xf475('0x36')](_0x5a35cd[_0xf475('0x2c')][_0xf475('0x36')]);_0x49657e[_0xf475('0x37')]=qs[_0xf475('0x2e')](_[_0xf475('0x38')](_0x5a35cd[_0xf475('0x2c')],_0xfbbfe7[_0xf475('0x2e')]),_0x4c8987);if(_0x5a35cd[_0xf475('0x2c')]['filter']){_0x49657e['where']=_[_0xf475('0x39')](_0x49657e[_0xf475('0x37')],{'$or':_[_0xf475('0x27')](_0x4c8987,function(_0xc7136c){if(_0xc7136c[_0xf475('0x3a')]!==_0xf475('0x3b')){var _0x1d493e={};_0x1d493e[_0xc7136c[_0xf475('0x25')]]={'$like':'%'+_0x5a35cd[_0xf475('0x2c')][_0xf475('0x3c')]+'%'};return _0x1d493e;}})});}_0x49657e=_[_0xf475('0x39')]({},_0x49657e,_0x5a35cd[_0xf475('0x3d')]);var _0x491b2f={'where':_0x49657e['where']};return db[_0xf475('0x28')][_0xf475('0x1b')](_0x491b2f)['then'](function(_0x216f21){_0x278bf1[_0xf475('0x1b')]=_0x216f21;if(_0x5a35cd[_0xf475('0x2c')][_0xf475('0x3e')]){_0x49657e[_0xf475('0x3f')]=[{'all':!![]}];}return db[_0xf475('0x28')][_0xf475('0x40')](_0x49657e);})[_0xf475('0x1f')](function(_0x3910dd){_0x278bf1[_0xf475('0x41')]=_0x3910dd;return _0x278bf1;})['then'](respondWithFilteredResult(_0x209ec7,_0x49657e))[_0xf475('0x42')](handleError(_0x209ec7,null));};exports[_0xf475('0x43')]=function(_0x34c629,_0x407ccb){var _0x339eb0={'raw':![],'where':{'id':_0x34c629['params']['id']}},_0x9f8ee1={};_0x9f8ee1[_0xf475('0x2b')]=_['keys'](db[_0xf475('0x28')][_0xf475('0x29')]);_0x9f8ee1['query']=_[_0xf475('0x2d')](_0x34c629[_0xf475('0x2c')]);_0x9f8ee1[_0xf475('0x2e')]=_[_0xf475('0x44')](_0x9f8ee1[_0xf475('0x2b')],_0x9f8ee1[_0xf475('0x2c')]);_0x339eb0[_0xf475('0x2f')]=_[_0xf475('0x44')](_0x9f8ee1[_0xf475('0x2b')],qs[_0xf475('0x30')](_0x34c629[_0xf475('0x2c')][_0xf475('0x30')]));_0x339eb0[_0xf475('0x2f')]=_0x339eb0['attributes'][_0xf475('0x31')]?_0x339eb0[_0xf475('0x2f')]:_0x9f8ee1[_0xf475('0x2b')];if(_0x34c629[_0xf475('0x2c')][_0xf475('0x3e')]){_0x339eb0['include']=[{'all':!![]}];}_0x339eb0=_['merge']({},_0x339eb0,_0x34c629[_0xf475('0x3d')]);return db['AnalyticFieldReport'][_0xf475('0x45')](_0x339eb0)[_0xf475('0x1f')](handleEntityNotFound(_0x407ccb,null))[_0xf475('0x1f')](respondWithResult(_0x407ccb,null))[_0xf475('0x42')](handleError(_0x407ccb,null));};exports[_0xf475('0x46')]=function(_0x1d8db4,_0x5685ac){return db['AnalyticFieldReport'][_0xf475('0x46')](_0x1d8db4['body'],{})[_0xf475('0x1f')](respondWithResult(_0x5685ac,0xc9))[_0xf475('0x42')](handleError(_0x5685ac,null));};exports['bulkCreate']=function(_0x27653d,_0xbe0760){return db[_0xf475('0x28')][_0xf475('0x47')](_0x27653d['body'],{'raw':![],'individualHooks':!![]})[_0xf475('0x1f')](respondWithResult(_0xbe0760,0xc9))[_0xf475('0x42')](handleError(_0xbe0760,null));};exports[_0xf475('0x1e')]=function(_0x77ea2c,_0x56d807){if(_0x77ea2c['body']['id']){delete _0x77ea2c[_0xf475('0x48')]['id'];}return db[_0xf475('0x28')][_0xf475('0x45')]({'where':{'id':_0x77ea2c[_0xf475('0x49')]['id']}})[_0xf475('0x1f')](handleEntityNotFound(_0x56d807,null))['then'](saveUpdates(_0x77ea2c[_0xf475('0x48')],null))[_0xf475('0x1f')](respondWithResult(_0x56d807,null))['catch'](handleError(_0x56d807,null));};exports[_0xf475('0x20')]=function(_0x7bdc99,_0x2b48e0){return db[_0xf475('0x28')][_0xf475('0x45')]({'where':{'id':_0x7bdc99[_0xf475('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b48e0,null))[_0xf475('0x1f')](removeEntity(_0x2b48e0,null))[_0xf475('0x42')](handleError(_0x2b48e0,null));};exports['bulkDestroy']=function(_0x39a657,_0x10a680){return db['AnalyticFieldReport'][_0xf475('0x20')]({'where':{'id':_0x39a657['query'][_0xf475('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xf475('0x1f')](respondWithResult(_0x10a680,0xcc))[_0xf475('0x42')](handleError(_0x10a680,null));};exports[_0xf475('0x4b')]=function(_0x50cc17,_0x4bfc62,_0xbd9c58){return db[_0xf475('0x4c')][_0xf475('0x4d')]({'where':{'id':_0x50cc17[_0xf475('0x49')]['id']}})[_0xf475('0x1f')](handleEntityNotFound(_0x4bfc62,null))['then'](function(_0x529ffa){if(_0x529ffa){return db['sequelize'][_0xf475('0x4e')](function(_0x57b562){return db['AnalyticFieldReport'][_0xf475('0x20')]({'where':{'CustomReportId':_0x50cc17[_0xf475('0x49')]['id']},'transaction':_0x57b562})[_0xf475('0x1f')](function(_0x5b08f7){var _0x29bf14=_['map'](_0x50cc17['body'],function(_0x4c5d51){delete _0x4c5d51['id'];_0x4c5d51['CustomReportId']=_0x50cc17[_0xf475('0x49')]['id'];return _0x4c5d51;});return db['AnalyticFieldReport'][_0xf475('0x47')](_0x29bf14,{'transaction':_0x57b562});});})[_0xf475('0x1f')](function(){return db['AnalyticFieldReport'][_0xf475('0x40')]({'where':{'CustomReportId':_0x50cc17[_0xf475('0x49')]['id']}});});}})[_0xf475('0x1f')](respondWithResult(_0x4bfc62,null))['catch'](handleError(_0x4bfc62,null));}; \ No newline at end of file +var _0x9255=['transaction','CustomReportId','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport'];(function(_0x52e68e,_0x309912){var _0x3211a4=function(_0x467c01){while(--_0x467c01){_0x52e68e['push'](_0x52e68e['shift']());}};_0x3211a4(++_0x309912);}(_0x9255,0x19c));var _0x5925=function(_0x1090f8,_0xd83a11){_0x1090f8=_0x1090f8-0x0;var _0x180524=_0x9255[_0x1090f8];return _0x180524;};'use strict';var pdf=require(_0x5925('0x0'));var emlformat=require(_0x5925('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5925('0x2'));var jsonpatch=require(_0x5925('0x3'));var rp=require(_0x5925('0x4'));var moment=require(_0x5925('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5925('0x6'));var sox=require(_0x5925('0x7'));var csv=require(_0x5925('0x8'));var ejs=require(_0x5925('0x9'));var fs=require('fs');var fs_extra=require(_0x5925('0xa'));var _=require(_0x5925('0xb'));var squel=require(_0x5925('0xc'));var crypto=require(_0x5925('0xd'));var jsforce=require(_0x5925('0xe'));var deskjs=require(_0x5925('0xf'));var toCsv=require(_0x5925('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5925('0x10'));var authService=require(_0x5925('0x11'));var qs=require(_0x5925('0x12'));var as=require(_0x5925('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5925('0x14'));var utils=require('../../config/utils');var config=require(_0x5925('0x15'));var licenseUtil=require(_0x5925('0x16'));var db=require(_0x5925('0x17'))['db'];function respondWithStatusCode(_0x45012d,_0x1a1eea){_0x1a1eea=_0x1a1eea||0xcc;return function(_0x120efd){if(_0x120efd){return _0x45012d[_0x5925('0x18')](_0x1a1eea);}return _0x45012d[_0x5925('0x19')](_0x1a1eea)[_0x5925('0x1a')]();};}function respondWithResult(_0x2de46b,_0x23ea54){_0x23ea54=_0x23ea54||0xc8;return function(_0x547369){if(_0x547369){return _0x2de46b[_0x5925('0x19')](_0x23ea54)[_0x5925('0x1b')](_0x547369);}};}function respondWithFilteredResult(_0x3f44a1,_0x307c4a){return function(_0x26a5c1){if(_0x26a5c1){var _0xe9af3e=_0x26a5c1[_0x5925('0x1c')],_0x3090c9=_0x307c4a['offset'],_0x2ee2f2=_0x307c4a[_0x5925('0x1d')]+_0x307c4a[_0x5925('0x1e')],_0x283e55;if(_0x2ee2f2>=_0xe9af3e){_0x2ee2f2=_0xe9af3e;_0x283e55=0xc8;}else{_0x283e55=0xce;}_0x3f44a1[_0x5925('0x19')](_0x283e55);return _0x3f44a1[_0x5925('0x1f')]('Content-Range',_0x3090c9+'-'+_0x2ee2f2+'/'+_0xe9af3e)[_0x5925('0x1b')](_0x26a5c1);}return null;};}function patchUpdates(_0x222d70){return function(_0x4700ba){try{jsonpatch[_0x5925('0x20')](_0x4700ba,_0x222d70,!![]);}catch(_0x78f988){return BPromise[_0x5925('0x21')](_0x78f988);}return _0x4700ba[_0x5925('0x22')]();};}function saveUpdates(_0x1482c5,_0xb2f31c){return function(_0x3f1271){if(_0x3f1271){return _0x3f1271['update'](_0x1482c5)[_0x5925('0x23')](function(_0x2bc197){return _0x2bc197;});}return null;};}function removeEntity(_0x3477e2,_0x5c2a50){return function(_0x1e7119){if(_0x1e7119){return _0x1e7119[_0x5925('0x24')]()['then'](function(){_0x3477e2['status'](0xcc)[_0x5925('0x1a')]();});}};}function handleEntityNotFound(_0x3e0de2,_0x29b108){return function(_0x4bd549){if(!_0x4bd549){_0x3e0de2[_0x5925('0x18')](0x194);}return _0x4bd549;};}function handleError(_0x3d179c,_0x3d8245){_0x3d8245=_0x3d8245||0x1f4;return function(_0x501147){logger['error'](_0x501147[_0x5925('0x25')]);if(_0x501147[_0x5925('0x26')]){delete _0x501147[_0x5925('0x26')];}_0x3d179c['status'](_0x3d8245)['send'](_0x501147);};}exports[_0x5925('0x27')]=function(_0x2aa4c4,_0x55a5b7){var _0xb4b6ce={},_0x18d36a={},_0x2d51b2={'count':0x0,'rows':[]};var _0x3f8a29=_[_0x5925('0x28')](db[_0x5925('0x29')][_0x5925('0x2a')],function(_0x5b8f57){return{'name':_0x5b8f57[_0x5925('0x2b')],'type':_0x5b8f57[_0x5925('0x2c')][_0x5925('0x2d')]};});_0x18d36a[_0x5925('0x2e')]=_['map'](_0x3f8a29,'name');_0x18d36a[_0x5925('0x2f')]=_[_0x5925('0x30')](_0x2aa4c4['query']);_0x18d36a[_0x5925('0x31')]=_[_0x5925('0x32')](_0x18d36a[_0x5925('0x2e')],_0x18d36a[_0x5925('0x2f')]);_0xb4b6ce[_0x5925('0x33')]=_[_0x5925('0x32')](_0x18d36a[_0x5925('0x2e')],qs[_0x5925('0x34')](_0x2aa4c4[_0x5925('0x2f')][_0x5925('0x34')]));_0xb4b6ce[_0x5925('0x33')]=_0xb4b6ce[_0x5925('0x33')][_0x5925('0x35')]?_0xb4b6ce[_0x5925('0x33')]:_0x18d36a[_0x5925('0x2e')];if(!_0x2aa4c4[_0x5925('0x2f')][_0x5925('0x36')](_0x5925('0x37'))){_0xb4b6ce['limit']=qs[_0x5925('0x1e')](_0x2aa4c4['query']['limit']);_0xb4b6ce['offset']=qs[_0x5925('0x1d')](_0x2aa4c4['query']['offset']);}_0xb4b6ce[_0x5925('0x38')]=qs[_0x5925('0x39')](_0x2aa4c4[_0x5925('0x2f')][_0x5925('0x39')]);_0xb4b6ce['where']=qs['filters'](_[_0x5925('0x3a')](_0x2aa4c4[_0x5925('0x2f')],_0x18d36a[_0x5925('0x31')]),_0x3f8a29);if(_0x2aa4c4['query']['filter']){_0xb4b6ce['where']=_[_0x5925('0x3b')](_0xb4b6ce[_0x5925('0x3c')],{'$or':_[_0x5925('0x28')](_0x3f8a29,function(_0x49015e){if(_0x49015e[_0x5925('0x2c')]!==_0x5925('0x3d')){var _0x163703={};_0x163703[_0x49015e[_0x5925('0x26')]]={'$like':'%'+_0x2aa4c4[_0x5925('0x2f')][_0x5925('0x3e')]+'%'};return _0x163703;}})});}_0xb4b6ce=_[_0x5925('0x3b')]({},_0xb4b6ce,_0x2aa4c4['options']);var _0x4626fc={'where':_0xb4b6ce['where']};return db['AnalyticFieldReport']['count'](_0x4626fc)[_0x5925('0x23')](function(_0x5e53dd){_0x2d51b2[_0x5925('0x1c')]=_0x5e53dd;if(_0x2aa4c4['query'][_0x5925('0x3f')]){_0xb4b6ce[_0x5925('0x40')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x5925('0x41')](_0xb4b6ce);})[_0x5925('0x23')](function(_0x1ec518){_0x2d51b2[_0x5925('0x42')]=_0x1ec518;return _0x2d51b2;})[_0x5925('0x23')](respondWithFilteredResult(_0x55a5b7,_0xb4b6ce))[_0x5925('0x43')](handleError(_0x55a5b7,null));};exports[_0x5925('0x44')]=function(_0x2ec0fa,_0x4e9210){var _0x4db6a1={'raw':![],'where':{'id':_0x2ec0fa[_0x5925('0x45')]['id']}},_0x2c6ed0={};_0x2c6ed0['model']=_[_0x5925('0x30')](db[_0x5925('0x29')][_0x5925('0x2a')]);_0x2c6ed0[_0x5925('0x2f')]=_[_0x5925('0x30')](_0x2ec0fa[_0x5925('0x2f')]);_0x2c6ed0[_0x5925('0x31')]=_[_0x5925('0x32')](_0x2c6ed0[_0x5925('0x2e')],_0x2c6ed0['query']);_0x4db6a1[_0x5925('0x33')]=_[_0x5925('0x32')](_0x2c6ed0[_0x5925('0x2e')],qs[_0x5925('0x34')](_0x2ec0fa[_0x5925('0x2f')][_0x5925('0x34')]));_0x4db6a1[_0x5925('0x33')]=_0x4db6a1[_0x5925('0x33')][_0x5925('0x35')]?_0x4db6a1[_0x5925('0x33')]:_0x2c6ed0[_0x5925('0x2e')];if(_0x2ec0fa[_0x5925('0x2f')]['includeAll']){_0x4db6a1['include']=[{'all':!![]}];}_0x4db6a1=_[_0x5925('0x3b')]({},_0x4db6a1,_0x2ec0fa[_0x5925('0x46')]);return db[_0x5925('0x29')][_0x5925('0x47')](_0x4db6a1)[_0x5925('0x23')](handleEntityNotFound(_0x4e9210,null))[_0x5925('0x23')](respondWithResult(_0x4e9210,null))[_0x5925('0x43')](handleError(_0x4e9210,null));};exports[_0x5925('0x48')]=function(_0x40f226,_0x285f12){return db[_0x5925('0x29')]['create'](_0x40f226[_0x5925('0x49')],{})[_0x5925('0x23')](respondWithResult(_0x285f12,0xc9))[_0x5925('0x43')](handleError(_0x285f12,null));};exports[_0x5925('0x4a')]=function(_0x2b213c,_0x4a7830){return db[_0x5925('0x29')][_0x5925('0x4a')](_0x2b213c[_0x5925('0x49')],{'raw':![],'individualHooks':!![]})[_0x5925('0x23')](respondWithResult(_0x4a7830,0xc9))[_0x5925('0x43')](handleError(_0x4a7830,null));};exports[_0x5925('0x4b')]=function(_0xa5181a,_0x1a3315){if(_0xa5181a[_0x5925('0x49')]['id']){delete _0xa5181a[_0x5925('0x49')]['id'];}return db[_0x5925('0x29')]['find']({'where':{'id':_0xa5181a[_0x5925('0x45')]['id']}})[_0x5925('0x23')](handleEntityNotFound(_0x1a3315,null))[_0x5925('0x23')](saveUpdates(_0xa5181a[_0x5925('0x49')],null))[_0x5925('0x23')](respondWithResult(_0x1a3315,null))[_0x5925('0x43')](handleError(_0x1a3315,null));};exports[_0x5925('0x24')]=function(_0x43f0b2,_0x2658cf){return db['AnalyticFieldReport'][_0x5925('0x47')]({'where':{'id':_0x43f0b2[_0x5925('0x45')]['id']}})['then'](handleEntityNotFound(_0x2658cf,null))['then'](removeEntity(_0x2658cf,null))[_0x5925('0x43')](handleError(_0x2658cf,null));};exports[_0x5925('0x4c')]=function(_0x41980f,_0x266757){return db[_0x5925('0x29')][_0x5925('0x24')]({'where':{'id':_0x41980f['query'][_0x5925('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x5925('0x23')](respondWithResult(_0x266757,0xcc))[_0x5925('0x43')](handleError(_0x266757,null));};exports[_0x5925('0x4e')]=function(_0x51c80b,_0x3d01cf,_0x13343e){return db[_0x5925('0x4f')]['findOne']({'where':{'id':_0x51c80b[_0x5925('0x45')]['id']}})['then'](handleEntityNotFound(_0x3d01cf,null))['then'](function(_0x5e9fe8){if(_0x5e9fe8){return db['sequelize'][_0x5925('0x50')](function(_0x1d37e1){return db[_0x5925('0x29')][_0x5925('0x24')]({'where':{'CustomReportId':_0x51c80b[_0x5925('0x45')]['id']},'transaction':_0x1d37e1})[_0x5925('0x23')](function(_0x2f9a26){var _0x463fef=_['map'](_0x51c80b[_0x5925('0x49')],function(_0x381fee){delete _0x381fee['id'];_0x381fee[_0x5925('0x51')]=_0x51c80b['params']['id'];return _0x381fee;});return db[_0x5925('0x29')][_0x5925('0x4a')](_0x463fef,{'transaction':_0x1d37e1});});})['then'](function(){return db[_0x5925('0x29')][_0x5925('0x41')]({'where':{'CustomReportId':_0x51c80b[_0x5925('0x45')]['id']}});});}})['then'](respondWithResult(_0x3d01cf,null))[_0x5925('0x43')](handleError(_0x3d01cf,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 1910f3a..3542317 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 _0x63a8=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport'];(function(_0x22548e,_0x172658){var _0x3e6bc1=function(_0x35c582){while(--_0x35c582){_0x22548e['push'](_0x22548e['shift']());}};_0x3e6bc1(++_0x172658);}(_0x63a8,0x1ef));var _0x863a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x63a8[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x863a('0x0'));var util=require(_0x863a('0x1'));var logger=require('../../config/logger')(_0x863a('0x2'));var moment=require('moment');var BPromise=require(_0x863a('0x3'));var rp=require(_0x863a('0x4'));var fs=require('fs');var path=require(_0x863a('0x5'));var rimraf=require('rimraf');var config=require(_0x863a('0x6'));var attributes=require(_0x863a('0x7'));module[_0x863a('0x8')]=function(_0x42cfea,_0x512d99){return _0x42cfea[_0x863a('0x9')](_0x863a('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e0d=['./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xf529fd,_0x5bb03b){var _0x4ef5fa=function(_0x91ef5){while(--_0x91ef5){_0xf529fd['push'](_0xf529fd['shift']());}};_0x4ef5fa(++_0x5bb03b);}(_0x1e0d,0x79));var _0xd1e0=function(_0x6d3ce5,_0x1c1ca2){_0x6d3ce5=_0x6d3ce5-0x0;var _0x245166=_0x1e0d[_0x6d3ce5];return _0x245166;};'use strict';var _=require(_0xd1e0('0x0'));var util=require(_0xd1e0('0x1'));var logger=require(_0xd1e0('0x2'))(_0xd1e0('0x3'));var moment=require(_0xd1e0('0x4'));var BPromise=require(_0xd1e0('0x5'));var rp=require(_0xd1e0('0x6'));var fs=require('fs');var path=require(_0xd1e0('0x7'));var rimraf=require('rimraf');var config=require(_0xd1e0('0x8'));var attributes=require(_0xd1e0('0x9'));module[_0xd1e0('0xa')]=function(_0xc99375,_0xd298ef){return _0xc99375[_0xd1e0('0xb')]('AnalyticFieldReport',attributes,{'tableName':_0xd1e0('0xc'),'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 3fac200..6fcd0d3 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 _0x7ca0=['AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','then','info'];(function(_0x4fc6f7,_0xea9941){var _0x216b2e=function(_0xedf2b5){while(--_0xedf2b5){_0x4fc6f7['push'](_0x4fc6f7['shift']());}};_0x216b2e(++_0xea9941);}(_0x7ca0,0x6e));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x07ca('0x0'));var moment=require('moment');var BPromise=require(_0x07ca('0x1'));var rs=require(_0x07ca('0x2'));var fs=require('fs');var Redis=require(_0x07ca('0x3'));var db=require(_0x07ca('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x07ca('0x5'));var client=jayson[_0x07ca('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x491a9c,_0x3342ba,_0x4cf2f5){return new BPromise(function(_0x35df07,_0x4e9810){return client[_0x07ca('0x7')](_0x491a9c,_0x4cf2f5)[_0x07ca('0x8')](function(_0x11fdf8){logger[_0x07ca('0x9')](_0x07ca('0xa'),_0x3342ba,'request\x20sent');logger[_0x07ca('0xb')](_0x07ca('0xc'),_0x3342ba,_0x07ca('0xd'),JSON[_0x07ca('0xe')](_0x11fdf8));if(_0x11fdf8[_0x07ca('0xf')]){if(_0x11fdf8['error'][_0x07ca('0x10')]===0x1f4){logger[_0x07ca('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3342ba,_0x11fdf8[_0x07ca('0xf')]['message']);return _0x4e9810(_0x11fdf8[_0x07ca('0xf')][_0x07ca('0x11')]);}logger['error'](_0x07ca('0xa'),_0x3342ba,_0x11fdf8[_0x07ca('0xf')][_0x07ca('0x11')]);return _0x35df07(_0x11fdf8[_0x07ca('0xf')][_0x07ca('0x11')]);}else{logger[_0x07ca('0x9')](_0x07ca('0xa'),_0x3342ba,_0x07ca('0xd'));_0x35df07(_0x11fdf8[_0x07ca('0x12')][_0x07ca('0x11')]);}})[_0x07ca('0x13')](function(_0x47b571){logger['error'](_0x07ca('0xa'),_0x3342ba,_0x47b571);_0x4e9810(_0x47b571);});});} \ No newline at end of file +var _0x7513=['../../config/logger','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils'];(function(_0x2d6608,_0x457cd1){var _0x23edaa=function(_0x4f029e){while(--_0x4f029e){_0x2d6608['push'](_0x2d6608['shift']());}};_0x23edaa(++_0x457cd1);}(_0x7513,0x119));var _0x3751=function(_0x34c56f,_0x1c519d){_0x34c56f=_0x34c56f-0x0;var _0x2a90f0=_0x7513[_0x34c56f];return _0x2a90f0;};'use strict';var _=require('lodash');var util=require(_0x3751('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3751('0x1'));var fs=require('fs');var Redis=require(_0x3751('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3751('0x3'));var logger=require(_0x3751('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3751('0x5')][_0x3751('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4feb40,_0x2d1293,_0x3c4e30){return new BPromise(function(_0x1865f9,_0x3b4b79){return client['request'](_0x4feb40,_0x3c4e30)[_0x3751('0x7')](function(_0xb9156){logger[_0x3751('0x8')](_0x3751('0x9'),_0x2d1293,_0x3751('0xa'));logger[_0x3751('0xb')](_0x3751('0xc'),_0x2d1293,'request\x20sent',JSON[_0x3751('0xd')](_0xb9156));if(_0xb9156[_0x3751('0xe')]){if(_0xb9156[_0x3751('0xe')][_0x3751('0xf')]===0x1f4){logger[_0x3751('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2d1293,_0xb9156[_0x3751('0xe')][_0x3751('0x10')]);return _0x3b4b79(_0xb9156['error'][_0x3751('0x10')]);}logger[_0x3751('0xe')](_0x3751('0x9'),_0x2d1293,_0xb9156[_0x3751('0xe')][_0x3751('0x10')]);return _0x1865f9(_0xb9156[_0x3751('0xe')]['message']);}else{logger[_0x3751('0x8')](_0x3751('0x9'),_0x2d1293,_0x3751('0xa'));_0x1865f9(_0xb9156[_0x3751('0x11')]['message']);}})[_0x3751('0x12')](function(_0x2ec5e0){logger[_0x3751('0xe')](_0x3751('0x9'),_0x2d1293,_0x2ec5e0);_0x3b4b79(_0x2ec5e0);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index bb56062..1fbe341 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 _0xe17f=['delete','bulkDestroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','/create_many','put','update'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0xe17f,0x158));var _0xfe17=function(_0xcf66f6,_0x281d62){_0xcf66f6=_0xcf66f6-0x0;var _0x1c6602=_0xe17f[_0xcf66f6];return _0x1c6602;};'use strict';var multer=require(_0xfe17('0x0'));var util=require(_0xfe17('0x1'));var path=require(_0xfe17('0x2'));var timeout=require(_0xfe17('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfe17('0x4'));var auth=require(_0xfe17('0x5'));var interaction=require(_0xfe17('0x6'));var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router[_0xfe17('0x7')]('/',auth[_0xfe17('0x8')](),controller[_0xfe17('0x9')]);router[_0xfe17('0x7')](_0xfe17('0xa'),auth['isAuthenticated'](),controller[_0xfe17('0xb')]);router[_0xfe17('0xc')]('/',auth[_0xfe17('0x8')](),controller['create']);router['post'](_0xfe17('0xd'),auth[_0xfe17('0x8')](),controller['bulkCreate']);router[_0xfe17('0xc')]('/:id/create_many',auth[_0xfe17('0x8')](),controller['addFields']);router[_0xfe17('0xe')](_0xfe17('0xa'),auth[_0xfe17('0x8')](),controller[_0xfe17('0xf')]);router[_0xfe17('0x10')]('/destroy_many',auth[_0xfe17('0x8')](),controller[_0xfe17('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa28e=['delete','/destroy_many','bulkDestroy','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update'];(function(_0x23d6d0,_0x3b8384){var _0x4b997d=function(_0x50a2b2){while(--_0x50a2b2){_0x23d6d0['push'](_0x23d6d0['shift']());}};_0x4b997d(++_0x3b8384);}(_0xa28e,0x11b));var _0xea28=function(_0x5b6828,_0x4a19d9){_0x5b6828=_0x5b6828-0x0;var _0x2dbd2c=_0xa28e[_0x5b6828];return _0x2dbd2c;};'use strict';var multer=require('multer');var util=require(_0xea28('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xea28('0x1')]();var fs_extra=require(_0xea28('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xea28('0x3'));var config=require(_0xea28('0x4'));var controller=require(_0xea28('0x5'));router[_0xea28('0x6')]('/',auth[_0xea28('0x7')](),controller[_0xea28('0x8')]);router[_0xea28('0x6')](_0xea28('0x9'),auth[_0xea28('0x7')](),controller['show']);router[_0xea28('0xa')]('/',auth[_0xea28('0x7')](),controller[_0xea28('0xb')]);router[_0xea28('0xa')](_0xea28('0xc'),auth[_0xea28('0x7')](),controller[_0xea28('0xd')]);router[_0xea28('0xa')](_0xea28('0xe'),auth[_0xea28('0x7')](),controller[_0xea28('0xf')]);router['put'](_0xea28('0x9'),auth[_0xea28('0x7')](),controller[_0xea28('0x10')]);router[_0xea28('0x11')](_0xea28('0x12'),auth[_0xea28('0x7')](),controller[_0xea28('0x13')]);router[_0xea28('0x11')](_0xea28('0x9'),auth[_0xea28('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 9beab5f..a137010 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 _0x573e=['exports','STRING'];(function(_0x585b10,_0x5d038a){var _0x43f4e6=function(_0x5582b3){while(--_0x5582b3){_0x585b10['push'](_0x585b10['shift']());}};_0x43f4e6(++_0x5d038a);}(_0x573e,0x134));var _0xe573=function(_0x46c955,_0x3e316c){_0x46c955=_0x46c955-0x0;var _0x1b4969=_0x573e[_0x46c955];return _0x1b4969;};'use strict';var Sequelize=require('sequelize');module[_0xe573('0x0')]={'name':{'type':Sequelize[_0xe573('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xe573('0x1')]}}; \ No newline at end of file +var _0x98dc=['STRING','name','sequelize','exports'];(function(_0x1fcd0a,_0x3d743f){var _0x770b80=function(_0x10140b){while(--_0x10140b){_0x1fcd0a['push'](_0x1fcd0a['shift']());}};_0x770b80(++_0x3d743f);}(_0x98dc,0x18a));var _0xc98d=function(_0x4ea2ab,_0x1aed1c){_0x4ea2ab=_0x4ea2ab-0x0;var _0x20cd07=_0x98dc[_0x4ea2ab];return _0x20cd07;};'use strict';var Sequelize=require(_0xc98d('0x0'));module[_0xc98d('0x1')]={'name':{'type':Sequelize[_0xc98d('0x2')],'allowNull':![],'unique':_0xc98d('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xc98d('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index d95a107..a3827a0 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 _0x565f=['model','attributes','fields','length','nolimit','order','pick','filter','where','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','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','limit','Content-Range','apply','save','update','destroy','then','get','Metrics','error','name','send','index','AnalyticMetric','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection'];(function(_0x54a0c7,_0x296e82){var _0x2d6783=function(_0x435447){while(--_0x435447){_0x54a0c7['push'](_0x54a0c7['shift']());}};_0x2d6783(++_0x296e82);}(_0x565f,0x68));var _0xf565=function(_0x3ff6bf,_0x438e79){_0x3ff6bf=_0x3ff6bf-0x0;var _0x8980a1=_0x565f[_0x3ff6bf];return _0x8980a1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf565('0x0'));var rimraf=require(_0xf565('0x1'));var zipdir=require(_0xf565('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf565('0x3'));var moment=require(_0xf565('0x4'));var BPromise=require(_0xf565('0x5'));var Mustache=require(_0xf565('0x6'));var util=require(_0xf565('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf565('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf565('0x9'));var squel=require(_0xf565('0xa'));var crypto=require(_0xf565('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf565('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf565('0xd'));var Papa=require('papaparse');var Redis=require(_0xf565('0xe'));var authService=require(_0xf565('0xf'));var qs=require(_0xf565('0x10'));var as=require(_0xf565('0x11'));var hardwareService=require(_0xf565('0x12'));var logger=require(_0xf565('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf565('0x14'));var licenseUtil=require(_0xf565('0x15'));var db=require(_0xf565('0x16'))['db'];function respondWithStatusCode(_0xb66e55,_0xa56a8b){_0xa56a8b=_0xa56a8b||0xcc;return function(_0x3dad4){if(_0x3dad4){return _0xb66e55[_0xf565('0x17')](_0xa56a8b);}return _0xb66e55[_0xf565('0x18')](_0xa56a8b)[_0xf565('0x19')]();};}function respondWithResult(_0x366ac2,_0x4f926d){_0x4f926d=_0x4f926d||0xc8;return function(_0x25b187){if(_0x25b187){return _0x366ac2[_0xf565('0x18')](_0x4f926d)['json'](_0x25b187);}};}function respondWithFilteredResult(_0x394e33,_0x2cd6a8){return function(_0x468d80){if(_0x468d80){var _0x46ee2e=_0x468d80['count'],_0x38e9d1=_0x2cd6a8['offset'],_0x509ff4=_0x2cd6a8[_0xf565('0x1a')]+_0x2cd6a8[_0xf565('0x1b')],_0x15c485;if(_0x509ff4>=_0x46ee2e){_0x509ff4=_0x46ee2e;_0x15c485=0xc8;}else{_0x15c485=0xce;}_0x394e33['status'](_0x15c485);return _0x394e33['set'](_0xf565('0x1c'),_0x38e9d1+'-'+_0x509ff4+'/'+_0x46ee2e)['json'](_0x468d80);}return null;};}function patchUpdates(_0x248111){return function(_0x1aeb02){try{jsonpatch[_0xf565('0x1d')](_0x1aeb02,_0x248111,!![]);}catch(_0x51215d){return BPromise['reject'](_0x51215d);}return _0x1aeb02[_0xf565('0x1e')]();};}function saveUpdates(_0x3a8a09,_0x2141ee){return function(_0x4114d0){if(_0x4114d0){return _0x4114d0[_0xf565('0x1f')](_0x3a8a09)['then'](function(_0x436a7d){return _0x436a7d;});}return null;};}function removeEntity(_0x24aa90,_0x282f3a){return function(_0x29057a){if(_0x29057a){return _0x29057a[_0xf565('0x20')]()[_0xf565('0x21')](function(){var _0xe23d61=_0x29057a[_0xf565('0x22')]({'plain':!![]});var _0x11d948=_0xf565('0x23');return db['UserProfileResource'][_0xf565('0x20')]({'where':{'type':_0x11d948,'resourceId':_0xe23d61['id']}})['then'](function(){return _0x29057a;});})[_0xf565('0x21')](function(){_0x24aa90[_0xf565('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x385d8f,_0xe06651){return function(_0x2e8f6b){if(!_0x2e8f6b){_0x385d8f[_0xf565('0x17')](0x194);}return _0x2e8f6b;};}function handleError(_0x10a396,_0x1239a7){_0x1239a7=_0x1239a7||0x1f4;return function(_0x42d7ab){logger[_0xf565('0x24')](_0x42d7ab['stack']);if(_0x42d7ab[_0xf565('0x25')]){delete _0x42d7ab[_0xf565('0x25')];}_0x10a396[_0xf565('0x18')](_0x1239a7)[_0xf565('0x26')](_0x42d7ab);};}exports[_0xf565('0x27')]=function(_0x5ecd01,_0x2288db){var _0x2ce91d={},_0x3bf46a={},_0x55b80d={'count':0x0,'rows':[]};var _0x233dca=_['map'](db[_0xf565('0x28')][_0xf565('0x29')],function(_0x3efca0){return{'name':_0x3efca0[_0xf565('0x2a')],'type':_0x3efca0[_0xf565('0x2b')][_0xf565('0x2c')]};});_0x3bf46a['model']=_[_0xf565('0x2d')](_0x233dca,_0xf565('0x25'));_0x3bf46a['query']=_[_0xf565('0x2e')](_0x5ecd01[_0xf565('0x2f')]);_0x3bf46a[_0xf565('0x30')]=_[_0xf565('0x31')](_0x3bf46a[_0xf565('0x32')],_0x3bf46a[_0xf565('0x2f')]);_0x2ce91d[_0xf565('0x33')]=_[_0xf565('0x31')](_0x3bf46a['model'],qs[_0xf565('0x34')](_0x5ecd01[_0xf565('0x2f')][_0xf565('0x34')]));_0x2ce91d['attributes']=_0x2ce91d[_0xf565('0x33')][_0xf565('0x35')]?_0x2ce91d[_0xf565('0x33')]:_0x3bf46a[_0xf565('0x32')];if(!_0x5ecd01[_0xf565('0x2f')]['hasOwnProperty'](_0xf565('0x36'))){_0x2ce91d['limit']=qs[_0xf565('0x1b')](_0x5ecd01[_0xf565('0x2f')]['limit']);_0x2ce91d['offset']=qs[_0xf565('0x1a')](_0x5ecd01[_0xf565('0x2f')]['offset']);}_0x2ce91d[_0xf565('0x37')]=qs['sort'](_0x5ecd01['query']['sort']);_0x2ce91d['where']=qs[_0xf565('0x30')](_[_0xf565('0x38')](_0x5ecd01[_0xf565('0x2f')],_0x3bf46a['filters']),_0x233dca);if(_0x5ecd01[_0xf565('0x2f')][_0xf565('0x39')]){_0x2ce91d[_0xf565('0x3a')]=_['merge'](_0x2ce91d[_0xf565('0x3a')],{'$or':_['map'](_0x233dca,function(_0x2d09fb){if(_0x2d09fb[_0xf565('0x2b')]!==_0xf565('0x3b')){var _0x54bf2d={};_0x54bf2d[_0x2d09fb[_0xf565('0x25')]]={'$like':'%'+_0x5ecd01['query'][_0xf565('0x39')]+'%'};return _0x54bf2d;}})});}_0x2ce91d=_['merge']({},_0x2ce91d,_0x5ecd01[_0xf565('0x3c')]);var _0x25dc34={'where':_0x2ce91d['where']};return db[_0xf565('0x28')][_0xf565('0x3d')](_0x25dc34)[_0xf565('0x21')](function(_0x5b8685){_0x55b80d[_0xf565('0x3d')]=_0x5b8685;if(_0x5ecd01['query'][_0xf565('0x3e')]){_0x2ce91d[_0xf565('0x3f')]=[{'all':!![]}];}return db[_0xf565('0x28')][_0xf565('0x40')](_0x2ce91d);})[_0xf565('0x21')](function(_0x2321f5){_0x55b80d['rows']=_0x2321f5;return _0x55b80d;})['then'](respondWithFilteredResult(_0x2288db,_0x2ce91d))[_0xf565('0x41')](handleError(_0x2288db,null));};exports[_0xf565('0x42')]=function(_0x40920b,_0x43416e){var _0x190f3a={'raw':!![],'where':{'id':_0x40920b[_0xf565('0x43')]['id']}},_0x482efc={};_0x482efc[_0xf565('0x32')]=_[_0xf565('0x2e')](db[_0xf565('0x28')]['rawAttributes']);_0x482efc[_0xf565('0x2f')]=_['keys'](_0x40920b['query']);_0x482efc[_0xf565('0x30')]=_[_0xf565('0x31')](_0x482efc['model'],_0x482efc['query']);_0x190f3a['attributes']=_[_0xf565('0x31')](_0x482efc[_0xf565('0x32')],qs[_0xf565('0x34')](_0x40920b[_0xf565('0x2f')][_0xf565('0x34')]));_0x190f3a[_0xf565('0x33')]=_0x190f3a[_0xf565('0x33')][_0xf565('0x35')]?_0x190f3a[_0xf565('0x33')]:_0x482efc[_0xf565('0x32')];if(_0x40920b[_0xf565('0x2f')]['includeAll']){_0x190f3a['include']=[{'all':!![]}];}_0x190f3a=_['merge']({},_0x190f3a,_0x40920b[_0xf565('0x3c')]);return db[_0xf565('0x28')][_0xf565('0x44')](_0x190f3a)['then'](handleEntityNotFound(_0x43416e,null))['then'](respondWithResult(_0x43416e,null))[_0xf565('0x41')](handleError(_0x43416e,null));};exports[_0xf565('0x45')]=function(_0x1a0386,_0x5ee510){return db[_0xf565('0x28')][_0xf565('0x45')](_0x1a0386[_0xf565('0x46')],{})['then'](function(_0x5b6cbb){var _0x2db9d2=_0x1a0386['user'][_0xf565('0x22')]({'plain':!![]});if(!_0x2db9d2)throw new Error(_0xf565('0x47'));if(_0x2db9d2[_0xf565('0x48')]===_0xf565('0x49')){var _0x3771b9=_0x5b6cbb[_0xf565('0x22')]({'plain':!![]});var _0x4326cc=_0xf565('0x23');return db[_0xf565('0x4a')][_0xf565('0x44')]({'where':{'name':_0x4326cc,'userProfileId':_0x2db9d2[_0xf565('0x4b')]},'raw':!![]})[_0xf565('0x21')](function(_0xe2fffa){if(_0xe2fffa&&_0xe2fffa[_0xf565('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x3771b9[_0xf565('0x25')],'resourceId':_0x3771b9['id'],'type':_0xe2fffa[_0xf565('0x25')],'sectionId':_0xe2fffa['id']},{})['then'](function(){return _0x5b6cbb;});}else{return _0x5b6cbb;}})[_0xf565('0x41')](function(_0x1869ff){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1869ff);throw _0x1869ff;});}return _0x5b6cbb;})[_0xf565('0x21')](respondWithResult(_0x5ee510,0xc9))[_0xf565('0x41')](handleError(_0x5ee510,null));};exports[_0xf565('0x1f')]=function(_0x3d650d,_0x203eed){if(_0x3d650d[_0xf565('0x46')]['id']){delete _0x3d650d[_0xf565('0x46')]['id'];}return db[_0xf565('0x28')]['find']({'where':{'id':_0x3d650d[_0xf565('0x43')]['id']}})['then'](handleEntityNotFound(_0x203eed,null))[_0xf565('0x21')](saveUpdates(_0x3d650d[_0xf565('0x46')],null))['then'](respondWithResult(_0x203eed,null))['catch'](handleError(_0x203eed,null));};exports[_0xf565('0x20')]=function(_0x4243fd,_0x2edcd2){return db[_0xf565('0x28')]['find']({'where':{'id':_0x4243fd[_0xf565('0x43')]['id']}})[_0xf565('0x21')](handleEntityNotFound(_0x2edcd2,null))[_0xf565('0x21')](removeEntity(_0x2edcd2,null))[_0xf565('0x41')](handleError(_0x2edcd2,null));}; \ No newline at end of file +var _0x41ec=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','status','Content-Range','json','apply','reject','then','destroy','Metrics','UserProfileResource','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','findAll','rows','show','params','include','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0x41ec,0x143));var _0xc41e=function(_0x5579f2,_0x4b5e1e){_0x5579f2=_0x5579f2-0x0;var _0x51ea04=_0x41ec[_0x5579f2];return _0x51ea04;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc41e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc41e('0x1'));var jsonpatch=require(_0xc41e('0x2'));var rp=require('request-promise');var moment=require(_0xc41e('0x3'));var BPromise=require(_0xc41e('0x4'));var Mustache=require(_0xc41e('0x5'));var util=require(_0xc41e('0x6'));var path=require(_0xc41e('0x7'));var sox=require(_0xc41e('0x8'));var csv=require(_0xc41e('0x9'));var ejs=require(_0xc41e('0xa'));var fs=require('fs');var fs_extra=require(_0xc41e('0xb'));var _=require(_0xc41e('0xc'));var squel=require(_0xc41e('0xd'));var crypto=require('crypto');var jsforce=require(_0xc41e('0xe'));var deskjs=require(_0xc41e('0xf'));var toCsv=require(_0xc41e('0x9'));var querystring=require(_0xc41e('0x10'));var Papa=require(_0xc41e('0x11'));var Redis=require(_0xc41e('0x12'));var authService=require(_0xc41e('0x13'));var qs=require(_0xc41e('0x14'));var as=require(_0xc41e('0x15'));var hardwareService=require(_0xc41e('0x16'));var logger=require(_0xc41e('0x17'))('api');var utils=require(_0xc41e('0x18'));var config=require(_0xc41e('0x19'));var licenseUtil=require(_0xc41e('0x1a'));var db=require(_0xc41e('0x1b'))['db'];function respondWithStatusCode(_0x11a117,_0x433ca9){_0x433ca9=_0x433ca9||0xcc;return function(_0x242120){if(_0x242120){return _0x11a117[_0xc41e('0x1c')](_0x433ca9);}return _0x11a117['status'](_0x433ca9)[_0xc41e('0x1d')]();};}function respondWithResult(_0x6b614a,_0xcd58a0){_0xcd58a0=_0xcd58a0||0xc8;return function(_0x52df47){if(_0x52df47){return _0x6b614a['status'](_0xcd58a0)['json'](_0x52df47);}};}function respondWithFilteredResult(_0x4f960d,_0x28eb53){return function(_0x4293a5){if(_0x4293a5){var _0x5c394b=_0x4293a5['count'],_0x450898=_0x28eb53[_0xc41e('0x1e')],_0x2ef2ca=_0x28eb53['offset']+_0x28eb53[_0xc41e('0x1f')],_0x541fc7;if(_0x2ef2ca>=_0x5c394b){_0x2ef2ca=_0x5c394b;_0x541fc7=0xc8;}else{_0x541fc7=0xce;}_0x4f960d[_0xc41e('0x20')](_0x541fc7);return _0x4f960d['set'](_0xc41e('0x21'),_0x450898+'-'+_0x2ef2ca+'/'+_0x5c394b)[_0xc41e('0x22')](_0x4293a5);}return null;};}function patchUpdates(_0xee0f01){return function(_0x45e204){try{jsonpatch[_0xc41e('0x23')](_0x45e204,_0xee0f01,!![]);}catch(_0x14e766){return BPromise[_0xc41e('0x24')](_0x14e766);}return _0x45e204['save']();};}function saveUpdates(_0x239c25,_0x44a84c){return function(_0x3f26d5){if(_0x3f26d5){return _0x3f26d5['update'](_0x239c25)[_0xc41e('0x25')](function(_0x408d27){return _0x408d27;});}return null;};}function removeEntity(_0x814a72,_0x490cc3){return function(_0x1f46cf){if(_0x1f46cf){return _0x1f46cf[_0xc41e('0x26')]()[_0xc41e('0x25')](function(){var _0x4adaad=_0x1f46cf['get']({'plain':!![]});var _0x4c20b1=_0xc41e('0x27');return db[_0xc41e('0x28')]['destroy']({'where':{'type':_0x4c20b1,'resourceId':_0x4adaad['id']}})['then'](function(){return _0x1f46cf;});})['then'](function(){_0x814a72[_0xc41e('0x20')](0xcc)[_0xc41e('0x1d')]();});}};}function handleEntityNotFound(_0x3f0809,_0x467672){return function(_0x1c6a2a){if(!_0x1c6a2a){_0x3f0809['sendStatus'](0x194);}return _0x1c6a2a;};}function handleError(_0xceb96d,_0xdf9a54){_0xdf9a54=_0xdf9a54||0x1f4;return function(_0xbf33ef){logger['error'](_0xbf33ef[_0xc41e('0x29')]);if(_0xbf33ef[_0xc41e('0x2a')]){delete _0xbf33ef['name'];}_0xceb96d[_0xc41e('0x20')](_0xdf9a54)[_0xc41e('0x2b')](_0xbf33ef);};}exports[_0xc41e('0x2c')]=function(_0xcb3a15,_0x2fa98a){var _0x17246e={},_0x2c71b9={},_0x51a7d6={'count':0x0,'rows':[]};var _0x57dad9=_['map'](db[_0xc41e('0x2d')][_0xc41e('0x2e')],function(_0x24b7ac){return{'name':_0x24b7ac[_0xc41e('0x2f')],'type':_0x24b7ac[_0xc41e('0x30')][_0xc41e('0x31')]};});_0x2c71b9[_0xc41e('0x32')]=_['map'](_0x57dad9,_0xc41e('0x2a'));_0x2c71b9[_0xc41e('0x33')]=_[_0xc41e('0x34')](_0xcb3a15['query']);_0x2c71b9[_0xc41e('0x35')]=_['intersection'](_0x2c71b9[_0xc41e('0x32')],_0x2c71b9[_0xc41e('0x33')]);_0x17246e[_0xc41e('0x36')]=_[_0xc41e('0x37')](_0x2c71b9['model'],qs['fields'](_0xcb3a15[_0xc41e('0x33')][_0xc41e('0x38')]));_0x17246e[_0xc41e('0x36')]=_0x17246e[_0xc41e('0x36')][_0xc41e('0x39')]?_0x17246e[_0xc41e('0x36')]:_0x2c71b9['model'];if(!_0xcb3a15[_0xc41e('0x33')][_0xc41e('0x3a')](_0xc41e('0x3b'))){_0x17246e['limit']=qs[_0xc41e('0x1f')](_0xcb3a15[_0xc41e('0x33')]['limit']);_0x17246e[_0xc41e('0x1e')]=qs[_0xc41e('0x1e')](_0xcb3a15[_0xc41e('0x33')][_0xc41e('0x1e')]);}_0x17246e[_0xc41e('0x3c')]=qs['sort'](_0xcb3a15['query'][_0xc41e('0x3d')]);_0x17246e[_0xc41e('0x3e')]=qs[_0xc41e('0x35')](_[_0xc41e('0x3f')](_0xcb3a15[_0xc41e('0x33')],_0x2c71b9[_0xc41e('0x35')]),_0x57dad9);if(_0xcb3a15[_0xc41e('0x33')][_0xc41e('0x40')]){_0x17246e[_0xc41e('0x3e')]=_['merge'](_0x17246e['where'],{'$or':_[_0xc41e('0x41')](_0x57dad9,function(_0xfd6ff6){if(_0xfd6ff6[_0xc41e('0x30')]!==_0xc41e('0x42')){var _0x46127e={};_0x46127e[_0xfd6ff6[_0xc41e('0x2a')]]={'$like':'%'+_0xcb3a15[_0xc41e('0x33')][_0xc41e('0x40')]+'%'};return _0x46127e;}})});}_0x17246e=_['merge']({},_0x17246e,_0xcb3a15['options']);var _0x463019={'where':_0x17246e[_0xc41e('0x3e')]};return db[_0xc41e('0x2d')]['count'](_0x463019)['then'](function(_0x128a2e){_0x51a7d6['count']=_0x128a2e;if(_0xcb3a15['query']['includeAll']){_0x17246e['include']=[{'all':!![]}];}return db[_0xc41e('0x2d')][_0xc41e('0x43')](_0x17246e);})[_0xc41e('0x25')](function(_0xfc6e5){_0x51a7d6[_0xc41e('0x44')]=_0xfc6e5;return _0x51a7d6;})[_0xc41e('0x25')](respondWithFilteredResult(_0x2fa98a,_0x17246e))['catch'](handleError(_0x2fa98a,null));};exports[_0xc41e('0x45')]=function(_0x1a3e67,_0x8b217){var _0x148474={'raw':!![],'where':{'id':_0x1a3e67[_0xc41e('0x46')]['id']}},_0x4c3343={};_0x4c3343['model']=_[_0xc41e('0x34')](db[_0xc41e('0x2d')]['rawAttributes']);_0x4c3343[_0xc41e('0x33')]=_[_0xc41e('0x34')](_0x1a3e67['query']);_0x4c3343[_0xc41e('0x35')]=_['intersection'](_0x4c3343[_0xc41e('0x32')],_0x4c3343[_0xc41e('0x33')]);_0x148474[_0xc41e('0x36')]=_['intersection'](_0x4c3343[_0xc41e('0x32')],qs[_0xc41e('0x38')](_0x1a3e67['query']['fields']));_0x148474['attributes']=_0x148474['attributes'][_0xc41e('0x39')]?_0x148474['attributes']:_0x4c3343[_0xc41e('0x32')];if(_0x1a3e67['query']['includeAll']){_0x148474[_0xc41e('0x47')]=[{'all':!![]}];}_0x148474=_['merge']({},_0x148474,_0x1a3e67[_0xc41e('0x48')]);return db[_0xc41e('0x2d')][_0xc41e('0x49')](_0x148474)[_0xc41e('0x25')](handleEntityNotFound(_0x8b217,null))[_0xc41e('0x25')](respondWithResult(_0x8b217,null))[_0xc41e('0x4a')](handleError(_0x8b217,null));};exports[_0xc41e('0x4b')]=function(_0x244a2b,_0xfabc4f){return db[_0xc41e('0x2d')][_0xc41e('0x4b')](_0x244a2b['body'],{})['then'](function(_0x1cdf49){var _0x34506e=_0x244a2b[_0xc41e('0x4c')]['get']({'plain':!![]});if(!_0x34506e)throw new Error(_0xc41e('0x4d'));if(_0x34506e[_0xc41e('0x4e')]===_0xc41e('0x4c')){var _0x343056=_0x1cdf49[_0xc41e('0x4f')]({'plain':!![]});var _0x41d151=_0xc41e('0x27');return db['UserProfileSection'][_0xc41e('0x49')]({'where':{'name':_0x41d151,'userProfileId':_0x34506e[_0xc41e('0x50')]},'raw':!![]})['then'](function(_0x5495f0){if(_0x5495f0&&_0x5495f0[_0xc41e('0x51')]===0x0){return db[_0xc41e('0x28')][_0xc41e('0x4b')]({'name':_0x343056[_0xc41e('0x2a')],'resourceId':_0x343056['id'],'type':_0x5495f0[_0xc41e('0x2a')],'sectionId':_0x5495f0['id']},{})['then'](function(){return _0x1cdf49;});}else{return _0x1cdf49;}})['catch'](function(_0x139fe6){logger['error'](_0xc41e('0x52'),_0x139fe6);throw _0x139fe6;});}return _0x1cdf49;})['then'](respondWithResult(_0xfabc4f,0xc9))['catch'](handleError(_0xfabc4f,null));};exports[_0xc41e('0x53')]=function(_0x4a2df2,_0xf26387){if(_0x4a2df2[_0xc41e('0x54')]['id']){delete _0x4a2df2[_0xc41e('0x54')]['id'];}return db[_0xc41e('0x2d')][_0xc41e('0x49')]({'where':{'id':_0x4a2df2[_0xc41e('0x46')]['id']}})['then'](handleEntityNotFound(_0xf26387,null))[_0xc41e('0x25')](saveUpdates(_0x4a2df2[_0xc41e('0x54')],null))[_0xc41e('0x25')](respondWithResult(_0xf26387,null))[_0xc41e('0x4a')](handleError(_0xf26387,null));};exports[_0xc41e('0x26')]=function(_0x5ebc40,_0x22dd5b){return db[_0xc41e('0x2d')]['find']({'where':{'id':_0x5ebc40[_0xc41e('0x46')]['id']}})[_0xc41e('0x25')](handleEntityNotFound(_0x22dd5b,null))[_0xc41e('0x25')](removeEntity(_0x22dd5b,null))['catch'](handleError(_0x22dd5b,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5bbe138..711f115 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 _0x4886=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics'];(function(_0x16662c,_0x3d32b3){var _0x3e1a15=function(_0x285b01){while(--_0x285b01){_0x16662c['push'](_0x16662c['shift']());}};_0x3e1a15(++_0x3d32b3);}(_0x4886,0xcc));var _0x6488=function(_0x1b7c84,_0x15c14e){_0x1b7c84=_0x1b7c84-0x0;var _0x2ed9df=_0x4886[_0x1b7c84];return _0x2ed9df;};'use strict';var _=require(_0x6488('0x0'));var util=require(_0x6488('0x1'));var logger=require('../../config/logger')(_0x6488('0x2'));var moment=require(_0x6488('0x3'));var BPromise=require(_0x6488('0x4'));var rp=require(_0x6488('0x5'));var fs=require('fs');var path=require(_0x6488('0x6'));var rimraf=require('rimraf');var config=require(_0x6488('0x7'));var attributes=require(_0x6488('0x8'));module[_0x6488('0x9')]=function(_0x7c95b,_0x37e1ce){return _0x7c95b[_0x6488('0xa')]('AnalyticMetric',attributes,{'tableName':_0x6488('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf82=['analytics_metrics','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','AnalyticMetric'];(function(_0x36e059,_0x19ee27){var _0x52ee13=function(_0x3dbfb1){while(--_0x3dbfb1){_0x36e059['push'](_0x36e059['shift']());}};_0x52ee13(++_0x19ee27);}(_0xdf82,0x64));var _0x2df8=function(_0x114af0,_0x2edd2a){_0x114af0=_0x114af0-0x0;var _0x4bd825=_0xdf82[_0x114af0];return _0x4bd825;};'use strict';var _=require(_0x2df8('0x0'));var util=require(_0x2df8('0x1'));var logger=require('../../config/logger')(_0x2df8('0x2'));var moment=require(_0x2df8('0x3'));var BPromise=require(_0x2df8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2df8('0x5'));var rimraf=require(_0x2df8('0x6'));var config=require(_0x2df8('0x7'));var attributes=require('./analyticMetric.attributes');module[_0x2df8('0x8')]=function(_0x5a46f9,_0x32d154){return _0x5a46f9['define'](_0x2df8('0x9'),attributes,{'tableName':_0x2df8('0xa'),'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 d0f7899..022586f 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 _0xcc8a=['then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticMetric,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x73ae90,_0x3e2d96){var _0x464671=function(_0xdc4b96){while(--_0xdc4b96){_0x73ae90['push'](_0x73ae90['shift']());}};_0x464671(++_0x3e2d96);}(_0xcc8a,0x12a));var _0xacc8=function(_0x519443,_0x235b27){_0x519443=_0x519443-0x0;var _0x315f8c=_0xcc8a[_0x519443];return _0x315f8c;};'use strict';var _=require(_0xacc8('0x0'));var util=require(_0xacc8('0x1'));var moment=require(_0xacc8('0x2'));var BPromise=require(_0xacc8('0x3'));var rs=require(_0xacc8('0x4'));var fs=require('fs');var Redis=require(_0xacc8('0x5'));var db=require(_0xacc8('0x6'))['db'];var utils=require(_0xacc8('0x7'));var logger=require(_0xacc8('0x8'))(_0xacc8('0x9'));var config=require(_0xacc8('0xa'));var jayson=require(_0xacc8('0xb'));var client=jayson[_0xacc8('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18ab7a,_0x5a47cf,_0x1afb22){return new BPromise(function(_0x552ff2,_0x2016af){return client[_0xacc8('0xd')](_0x18ab7a,_0x1afb22)[_0xacc8('0xe')](function(_0x13bd50){logger[_0xacc8('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x5a47cf,_0xacc8('0x10'));logger[_0xacc8('0x11')](_0xacc8('0x12'),_0x5a47cf,_0xacc8('0x10'),JSON[_0xacc8('0x13')](_0x13bd50));if(_0x13bd50[_0xacc8('0x14')]){if(_0x13bd50['error'][_0xacc8('0x15')]===0x1f4){logger[_0xacc8('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x5a47cf,_0x13bd50[_0xacc8('0x14')][_0xacc8('0x16')]);return _0x2016af(_0x13bd50[_0xacc8('0x14')][_0xacc8('0x16')]);}logger[_0xacc8('0x14')](_0xacc8('0x17'),_0x5a47cf,_0x13bd50[_0xacc8('0x14')]['message']);return _0x552ff2(_0x13bd50[_0xacc8('0x14')][_0xacc8('0x16')]);}else{logger[_0xacc8('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x5a47cf,_0xacc8('0x10'));_0x552ff2(_0x13bd50['result'][_0xacc8('0x16')]);}})['catch'](function(_0x5d7c66){logger[_0xacc8('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x5a47cf,_0x5d7c66);_0x2016af(_0x5d7c66);});});} \ No newline at end of file +var _0x0269=['http','then','info','debug','stringify','error','AnalyticMetric,\x20%s,\x20%s','message','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3b29d5,_0x12faa2){var _0x20b96d=function(_0x284207){while(--_0x284207){_0x3b29d5['push'](_0x3b29d5['shift']());}};_0x20b96d(++_0x12faa2);}(_0x0269,0x78));var _0x9026=function(_0xe4eb0c,_0x50c57f){_0xe4eb0c=_0xe4eb0c-0x0;var _0x14cd41=_0x0269[_0xe4eb0c];return _0x14cd41;};'use strict';var _=require('lodash');var util=require(_0x9026('0x0'));var moment=require(_0x9026('0x1'));var BPromise=require(_0x9026('0x2'));var rs=require(_0x9026('0x3'));var fs=require('fs');var Redis=require(_0x9026('0x4'));var db=require(_0x9026('0x5'))['db'];var utils=require(_0x9026('0x6'));var logger=require(_0x9026('0x7'))(_0x9026('0x8'));var config=require(_0x9026('0x9'));var jayson=require(_0x9026('0xa'));var client=jayson[_0x9026('0xb')][_0x9026('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59fb07,_0x139261,_0xb527bd){return new BPromise(function(_0x5c6483,_0x52469b){return client['request'](_0x59fb07,_0xb527bd)[_0x9026('0xd')](function(_0x267efd){logger[_0x9026('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x139261,'request\x20sent');logger[_0x9026('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x139261,'request\x20sent',JSON[_0x9026('0x10')](_0x267efd));if(_0x267efd[_0x9026('0x11')]){if(_0x267efd['error']['code']===0x1f4){logger[_0x9026('0x11')](_0x9026('0x12'),_0x139261,_0x267efd[_0x9026('0x11')][_0x9026('0x13')]);return _0x52469b(_0x267efd[_0x9026('0x11')][_0x9026('0x13')]);}logger[_0x9026('0x11')](_0x9026('0x12'),_0x139261,_0x267efd['error'][_0x9026('0x13')]);return _0x5c6483(_0x267efd[_0x9026('0x11')][_0x9026('0x13')]);}else{logger[_0x9026('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x139261,_0x9026('0x14'));_0x5c6483(_0x267efd[_0x9026('0x15')][_0x9026('0x13')]);}})['catch'](function(_0x4213e2){logger[_0x9026('0x11')](_0x9026('0x12'),_0x139261,_0x4213e2);_0x52469b(_0x4213e2);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 21703ef..c520227 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 _0xbdb7=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','index','get','show','post','put','/:id','isAuthenticated','update'];(function(_0x502036,_0x502686){var _0x485247=function(_0x135ee3){while(--_0x135ee3){_0x502036['push'](_0x502036['shift']());}};_0x485247(++_0x502686);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x326b39,_0x4143c9){_0x326b39=_0x326b39-0x0;var _0x5b62d1=_0xbdb7[_0x326b39];return _0x5b62d1;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7bdb('0xe')](_0x7bdb('0xf'),auth[_0x7bdb('0x10')](),controller[_0x7bdb('0x11')]);router[_0x7bdb('0x12')](_0x7bdb('0xf'),auth[_0x7bdb('0x10')](),controller[_0x7bdb('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5c00=['delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x3ba33b,_0x411b6d){var _0x4b9337=function(_0x521904){while(--_0x521904){_0x3ba33b['push'](_0x3ba33b['shift']());}};_0x4b9337(++_0x411b6d);}(_0x5c00,0x17e));var _0x05c0=function(_0xae0c01,_0x449c99){_0xae0c01=_0xae0c01-0x0;var _0x913e86=_0x5c00[_0xae0c01];return _0x913e86;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./analyticMetric.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x05c0('0xd')]);router[_0x05c0('0xe')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router[_0x05c0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x05c0('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 4ddc1c0..b88a1a7 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 _0x7769=['TEXT','sequelize'];(function(_0x10ff18,_0x11a300){var _0x76d79c=function(_0x10cd21){while(--_0x10cd21){_0x10ff18['push'](_0x10ff18['shift']());}};_0x76d79c(++_0x11a300);}(_0x7769,0x163));var _0x9776=function(_0x1a1b39,_0x2b180a){_0x1a1b39=_0x1a1b39-0x0;var _0x2e03e7=_0x7769[_0x1a1b39];return _0x2e03e7;};'use strict';var Sequelize=require(_0x9776('0x0'));module['exports']={'tree':{'type':Sequelize[_0x9776('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8a02=['TEXT'];(function(_0x1c4afe,_0x1d4e9d){var _0x9085dd=function(_0x173359){while(--_0x173359){_0x1c4afe['push'](_0x1c4afe['shift']());}};_0x9085dd(++_0x1d4e9d);}(_0x8a02,0x136));var _0x28a0=function(_0x1005d6,_0x1e6ef8){_0x1005d6=_0x1005d6-0x0;var _0x59c66a=_0x8a02[_0x1005d6];return _0x59c66a;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x28a0('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 72f098c..f880f5e 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 _0x4d67=['reject','save','update','then','destroy','status','end','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','limit','set','apply'];(function(_0x2a01d3,_0x1b7cf0){var _0x5610d5=function(_0x846f1e){while(--_0x846f1e){_0x2a01d3['push'](_0x2a01d3['shift']());}};_0x5610d5(++_0x1b7cf0);}(_0x4d67,0x16c));var _0x74d6=function(_0x5455e2,_0x4675b4){_0x5455e2=_0x5455e2-0x0;var _0x4c8a44=_0x4d67[_0x5455e2];return _0x4c8a44;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x74d6('0x0'));var rimraf=require(_0x74d6('0x1'));var zipdir=require(_0x74d6('0x2'));var jsonpatch=require(_0x74d6('0x3'));var rp=require(_0x74d6('0x4'));var moment=require(_0x74d6('0x5'));var BPromise=require(_0x74d6('0x6'));var Mustache=require(_0x74d6('0x7'));var util=require(_0x74d6('0x8'));var path=require(_0x74d6('0x9'));var sox=require(_0x74d6('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74d6('0xb'));var squel=require(_0x74d6('0xc'));var crypto=require(_0x74d6('0xd'));var jsforce=require(_0x74d6('0xe'));var deskjs=require(_0x74d6('0xf'));var toCsv=require(_0x74d6('0x10'));var querystring=require(_0x74d6('0x11'));var Papa=require(_0x74d6('0x12'));var Redis=require(_0x74d6('0x13'));var authService=require(_0x74d6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x74d6('0x15'));var hardwareService=require(_0x74d6('0x16'));var logger=require(_0x74d6('0x17'))(_0x74d6('0x18'));var utils=require(_0x74d6('0x19'));var config=require(_0x74d6('0x1a'));var licenseUtil=require(_0x74d6('0x1b'));var db=require(_0x74d6('0x1c'))['db'];function respondWithStatusCode(_0x43114e,_0x249bc8){_0x249bc8=_0x249bc8||0xcc;return function(_0x523432){if(_0x523432){return _0x43114e[_0x74d6('0x1d')](_0x249bc8);}return _0x43114e['status'](_0x249bc8)['end']();};}function respondWithResult(_0x1df273,_0x5a09d2){_0x5a09d2=_0x5a09d2||0xc8;return function(_0x10baea){if(_0x10baea){return _0x1df273['status'](_0x5a09d2)[_0x74d6('0x1e')](_0x10baea);}};}function respondWithFilteredResult(_0x4d234f,_0x14f76b){return function(_0x5dd846){if(_0x5dd846){var _0x4da8b8=_0x5dd846[_0x74d6('0x1f')],_0x474347=_0x14f76b[_0x74d6('0x20')],_0x1bc0d5=_0x14f76b[_0x74d6('0x20')]+_0x14f76b[_0x74d6('0x21')],_0x412651;if(_0x1bc0d5>=_0x4da8b8){_0x1bc0d5=_0x4da8b8;_0x412651=0xc8;}else{_0x412651=0xce;}_0x4d234f['status'](_0x412651);return _0x4d234f[_0x74d6('0x22')]('Content-Range',_0x474347+'-'+_0x1bc0d5+'/'+_0x4da8b8)[_0x74d6('0x1e')](_0x5dd846);}return null;};}function patchUpdates(_0x30b156){return function(_0x597b75){try{jsonpatch[_0x74d6('0x23')](_0x597b75,_0x30b156,!![]);}catch(_0x31ae31){return BPromise[_0x74d6('0x24')](_0x31ae31);}return _0x597b75[_0x74d6('0x25')]();};}function saveUpdates(_0x561898,_0x58fa0b){return function(_0x23b006){if(_0x23b006){return _0x23b006[_0x74d6('0x26')](_0x561898)[_0x74d6('0x27')](function(_0x4ca1f9){return _0x4ca1f9;});}return null;};}function removeEntity(_0x20fdc9,_0x36ed3b){return function(_0x2f920e){if(_0x2f920e){return _0x2f920e[_0x74d6('0x28')]()[_0x74d6('0x27')](function(){_0x20fdc9[_0x74d6('0x29')](0xcc)[_0x74d6('0x2a')]();});}};}function handleEntityNotFound(_0x2b2efb,_0x3154fc){return function(_0x2df0b0){if(!_0x2df0b0){_0x2b2efb[_0x74d6('0x1d')](0x194);}return _0x2df0b0;};}function handleError(_0x5328db,_0x585990){_0x585990=_0x585990||0x1f4;return function(_0x4ad4ca){logger['error'](_0x4ad4ca[_0x74d6('0x2b')]);if(_0x4ad4ca['name']){delete _0x4ad4ca[_0x74d6('0x2c')];}_0x5328db[_0x74d6('0x29')](_0x585990)[_0x74d6('0x2d')](_0x4ad4ca);};}exports[_0x74d6('0x2e')]=function(_0x53345a,_0x72f49f){var _0x1159dd={},_0x2cf55c={},_0x564107={'count':0x0,'rows':[]};var _0xc41688=_['map'](db[_0x74d6('0x2f')][_0x74d6('0x30')],function(_0x2db4cd){return{'name':_0x2db4cd[_0x74d6('0x31')],'type':_0x2db4cd[_0x74d6('0x32')][_0x74d6('0x33')]};});_0x2cf55c[_0x74d6('0x34')]=_[_0x74d6('0x35')](_0xc41688,'name');_0x2cf55c[_0x74d6('0x36')]=_['keys'](_0x53345a[_0x74d6('0x36')]);_0x2cf55c[_0x74d6('0x37')]=_['intersection'](_0x2cf55c['model'],_0x2cf55c['query']);_0x1159dd[_0x74d6('0x38')]=_[_0x74d6('0x39')](_0x2cf55c['model'],qs[_0x74d6('0x3a')](_0x53345a[_0x74d6('0x36')]['fields']));_0x1159dd[_0x74d6('0x38')]=_0x1159dd[_0x74d6('0x38')][_0x74d6('0x3b')]?_0x1159dd['attributes']:_0x2cf55c[_0x74d6('0x34')];if(!_0x53345a[_0x74d6('0x36')][_0x74d6('0x3c')](_0x74d6('0x3d'))){_0x1159dd[_0x74d6('0x21')]=qs[_0x74d6('0x21')](_0x53345a[_0x74d6('0x36')][_0x74d6('0x21')]);_0x1159dd[_0x74d6('0x20')]=qs[_0x74d6('0x20')](_0x53345a['query'][_0x74d6('0x20')]);}_0x1159dd[_0x74d6('0x3e')]=qs[_0x74d6('0x3f')](_0x53345a[_0x74d6('0x36')]['sort']);_0x1159dd[_0x74d6('0x40')]=qs[_0x74d6('0x37')](_[_0x74d6('0x41')](_0x53345a[_0x74d6('0x36')],_0x2cf55c[_0x74d6('0x37')]),_0xc41688);if(_0x53345a[_0x74d6('0x36')][_0x74d6('0x42')]){_0x1159dd[_0x74d6('0x40')]=_[_0x74d6('0x43')](_0x1159dd[_0x74d6('0x40')],{'$or':_[_0x74d6('0x35')](_0xc41688,function(_0x31e656){if(_0x31e656[_0x74d6('0x32')]!==_0x74d6('0x44')){var _0x12ca16={};_0x12ca16[_0x31e656['name']]={'$like':'%'+_0x53345a['query'][_0x74d6('0x42')]+'%'};return _0x12ca16;}})});}_0x1159dd=_[_0x74d6('0x43')]({},_0x1159dd,_0x53345a[_0x74d6('0x45')]);var _0x3b6933={'where':_0x1159dd[_0x74d6('0x40')]};return db['AnalyticTreeReport']['count'](_0x3b6933)[_0x74d6('0x27')](function(_0x4db9bc){_0x564107[_0x74d6('0x1f')]=_0x4db9bc;if(_0x53345a[_0x74d6('0x36')][_0x74d6('0x46')]){_0x1159dd[_0x74d6('0x47')]=[{'all':!![]}];}return db[_0x74d6('0x2f')]['findAll'](_0x1159dd);})[_0x74d6('0x27')](function(_0x565edc){_0x564107[_0x74d6('0x48')]=_0x565edc;return _0x564107;})[_0x74d6('0x27')](respondWithFilteredResult(_0x72f49f,_0x1159dd))[_0x74d6('0x49')](handleError(_0x72f49f,null));};exports[_0x74d6('0x4a')]=function(_0x3c0e29,_0x496ddc){var _0x38309d={'raw':!![],'where':{'id':_0x3c0e29[_0x74d6('0x4b')]['id']}},_0x27ce56={};_0x27ce56[_0x74d6('0x34')]=_[_0x74d6('0x4c')](db[_0x74d6('0x2f')][_0x74d6('0x30')]);_0x27ce56[_0x74d6('0x36')]=_['keys'](_0x3c0e29[_0x74d6('0x36')]);_0x27ce56[_0x74d6('0x37')]=_[_0x74d6('0x39')](_0x27ce56[_0x74d6('0x34')],_0x27ce56[_0x74d6('0x36')]);_0x38309d[_0x74d6('0x38')]=_['intersection'](_0x27ce56[_0x74d6('0x34')],qs[_0x74d6('0x3a')](_0x3c0e29[_0x74d6('0x36')][_0x74d6('0x3a')]));_0x38309d[_0x74d6('0x38')]=_0x38309d[_0x74d6('0x38')][_0x74d6('0x3b')]?_0x38309d[_0x74d6('0x38')]:_0x27ce56[_0x74d6('0x34')];if(_0x3c0e29['query'][_0x74d6('0x46')]){_0x38309d[_0x74d6('0x47')]=[{'all':!![]}];}_0x38309d=_[_0x74d6('0x43')]({},_0x38309d,_0x3c0e29[_0x74d6('0x45')]);return db['AnalyticTreeReport'][_0x74d6('0x4d')](_0x38309d)[_0x74d6('0x27')](handleEntityNotFound(_0x496ddc,null))['then'](respondWithResult(_0x496ddc,null))[_0x74d6('0x49')](handleError(_0x496ddc,null));};exports[_0x74d6('0x4e')]=function(_0x4e0e18,_0x2c07fd){return db[_0x74d6('0x2f')][_0x74d6('0x4e')](_0x4e0e18[_0x74d6('0x4f')],{})[_0x74d6('0x27')](respondWithResult(_0x2c07fd,0xc9))[_0x74d6('0x49')](handleError(_0x2c07fd,null));};exports[_0x74d6('0x26')]=function(_0x28d5f4,_0x5a03cf){if(_0x28d5f4[_0x74d6('0x4f')]['id']){delete _0x28d5f4[_0x74d6('0x4f')]['id'];}return db[_0x74d6('0x2f')][_0x74d6('0x4d')]({'where':{'id':_0x28d5f4['params']['id']}})[_0x74d6('0x27')](handleEntityNotFound(_0x5a03cf,null))['then'](saveUpdates(_0x28d5f4[_0x74d6('0x4f')],null))[_0x74d6('0x27')](respondWithResult(_0x5a03cf,null))[_0x74d6('0x49')](handleError(_0x5a03cf,null));};exports[_0x74d6('0x28')]=function(_0x30b90e,_0x4a88ea){return db['AnalyticTreeReport'][_0x74d6('0x4d')]({'where':{'id':_0x30b90e[_0x74d6('0x4b')]['id']}})[_0x74d6('0x27')](handleEntityNotFound(_0x4a88ea,null))[_0x74d6('0x27')](removeEntity(_0x4a88ea,null))['catch'](handleError(_0x4a88ea,null));}; \ No newline at end of file +var _0xe6b8=['keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','body','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x3eb57e,_0x3103ec){var _0x494a30=function(_0x286181){while(--_0x286181){_0x3eb57e['push'](_0x3eb57e['shift']());}};_0x494a30(++_0x3103ec);}(_0xe6b8,0x19b));var _0x8e6b=function(_0x382ec4,_0x1120a7){_0x382ec4=_0x382ec4-0x0;var _0x1e7b48=_0xe6b8[_0x382ec4];return _0x1e7b48;};'use strict';var pdf=require(_0x8e6b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8e6b('0x1'));var moment=require(_0x8e6b('0x2'));var BPromise=require(_0x8e6b('0x3'));var Mustache=require(_0x8e6b('0x4'));var util=require(_0x8e6b('0x5'));var path=require(_0x8e6b('0x6'));var sox=require(_0x8e6b('0x7'));var csv=require('to-csv');var ejs=require(_0x8e6b('0x8'));var fs=require('fs');var fs_extra=require(_0x8e6b('0x9'));var _=require(_0x8e6b('0xa'));var squel=require(_0x8e6b('0xb'));var crypto=require(_0x8e6b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8e6b('0xd'));var querystring=require(_0x8e6b('0xe'));var Papa=require(_0x8e6b('0xf'));var Redis=require(_0x8e6b('0x10'));var authService=require(_0x8e6b('0x11'));var qs=require(_0x8e6b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e6b('0x13'));var logger=require(_0x8e6b('0x14'))(_0x8e6b('0x15'));var utils=require(_0x8e6b('0x16'));var config=require(_0x8e6b('0x17'));var licenseUtil=require(_0x8e6b('0x18'));var db=require(_0x8e6b('0x19'))['db'];function respondWithStatusCode(_0x47ea81,_0x3d453c){_0x3d453c=_0x3d453c||0xcc;return function(_0x32879d){if(_0x32879d){return _0x47ea81[_0x8e6b('0x1a')](_0x3d453c);}return _0x47ea81['status'](_0x3d453c)[_0x8e6b('0x1b')]();};}function respondWithResult(_0x102b49,_0x15dcf9){_0x15dcf9=_0x15dcf9||0xc8;return function(_0x33b1ea){if(_0x33b1ea){return _0x102b49[_0x8e6b('0x1c')](_0x15dcf9)['json'](_0x33b1ea);}};}function respondWithFilteredResult(_0x42228b,_0x43ad80){return function(_0x38cd0e){if(_0x38cd0e){var _0x2f2e5a=_0x38cd0e[_0x8e6b('0x1d')],_0x433b02=_0x43ad80[_0x8e6b('0x1e')],_0x20c221=_0x43ad80[_0x8e6b('0x1e')]+_0x43ad80[_0x8e6b('0x1f')],_0x52ca01;if(_0x20c221>=_0x2f2e5a){_0x20c221=_0x2f2e5a;_0x52ca01=0xc8;}else{_0x52ca01=0xce;}_0x42228b[_0x8e6b('0x1c')](_0x52ca01);return _0x42228b['set'](_0x8e6b('0x20'),_0x433b02+'-'+_0x20c221+'/'+_0x2f2e5a)['json'](_0x38cd0e);}return null;};}function patchUpdates(_0xaba93){return function(_0x507bce){try{jsonpatch[_0x8e6b('0x21')](_0x507bce,_0xaba93,!![]);}catch(_0x274359){return BPromise[_0x8e6b('0x22')](_0x274359);}return _0x507bce['save']();};}function saveUpdates(_0x2b9277,_0x5b848e){return function(_0x1d0b2d){if(_0x1d0b2d){return _0x1d0b2d[_0x8e6b('0x23')](_0x2b9277)[_0x8e6b('0x24')](function(_0x4e7727){return _0x4e7727;});}return null;};}function removeEntity(_0x36ea22,_0x23fda9){return function(_0x2a518d){if(_0x2a518d){return _0x2a518d[_0x8e6b('0x25')]()['then'](function(){_0x36ea22[_0x8e6b('0x1c')](0xcc)[_0x8e6b('0x1b')]();});}};}function handleEntityNotFound(_0x57da18,_0x37a72b){return function(_0x54561d){if(!_0x54561d){_0x57da18[_0x8e6b('0x1a')](0x194);}return _0x54561d;};}function handleError(_0x3abc5c,_0x4fb50d){_0x4fb50d=_0x4fb50d||0x1f4;return function(_0x223907){logger[_0x8e6b('0x26')](_0x223907[_0x8e6b('0x27')]);if(_0x223907[_0x8e6b('0x28')]){delete _0x223907[_0x8e6b('0x28')];}_0x3abc5c[_0x8e6b('0x1c')](_0x4fb50d)[_0x8e6b('0x29')](_0x223907);};}exports[_0x8e6b('0x2a')]=function(_0x4c2100,_0x550558){var _0x556f19={},_0x6bd145={},_0x9d1cb0={'count':0x0,'rows':[]};var _0x7b6a4=_[_0x8e6b('0x2b')](db[_0x8e6b('0x2c')][_0x8e6b('0x2d')],function(_0x298b1b){return{'name':_0x298b1b[_0x8e6b('0x2e')],'type':_0x298b1b[_0x8e6b('0x2f')][_0x8e6b('0x30')]};});_0x6bd145[_0x8e6b('0x31')]=_[_0x8e6b('0x2b')](_0x7b6a4,_0x8e6b('0x28'));_0x6bd145[_0x8e6b('0x32')]=_[_0x8e6b('0x33')](_0x4c2100[_0x8e6b('0x32')]);_0x6bd145['filters']=_['intersection'](_0x6bd145[_0x8e6b('0x31')],_0x6bd145[_0x8e6b('0x32')]);_0x556f19[_0x8e6b('0x34')]=_['intersection'](_0x6bd145[_0x8e6b('0x31')],qs[_0x8e6b('0x35')](_0x4c2100['query']['fields']));_0x556f19[_0x8e6b('0x34')]=_0x556f19['attributes'][_0x8e6b('0x36')]?_0x556f19[_0x8e6b('0x34')]:_0x6bd145[_0x8e6b('0x31')];if(!_0x4c2100[_0x8e6b('0x32')][_0x8e6b('0x37')](_0x8e6b('0x38'))){_0x556f19['limit']=qs[_0x8e6b('0x1f')](_0x4c2100[_0x8e6b('0x32')]['limit']);_0x556f19['offset']=qs[_0x8e6b('0x1e')](_0x4c2100['query']['offset']);}_0x556f19[_0x8e6b('0x39')]=qs[_0x8e6b('0x3a')](_0x4c2100[_0x8e6b('0x32')][_0x8e6b('0x3a')]);_0x556f19[_0x8e6b('0x3b')]=qs[_0x8e6b('0x3c')](_[_0x8e6b('0x3d')](_0x4c2100['query'],_0x6bd145[_0x8e6b('0x3c')]),_0x7b6a4);if(_0x4c2100['query'][_0x8e6b('0x3e')]){_0x556f19['where']=_[_0x8e6b('0x3f')](_0x556f19['where'],{'$or':_[_0x8e6b('0x2b')](_0x7b6a4,function(_0x3a89a2){if(_0x3a89a2[_0x8e6b('0x2f')]!==_0x8e6b('0x40')){var _0x564946={};_0x564946[_0x3a89a2[_0x8e6b('0x28')]]={'$like':'%'+_0x4c2100['query'][_0x8e6b('0x3e')]+'%'};return _0x564946;}})});}_0x556f19=_['merge']({},_0x556f19,_0x4c2100['options']);var _0x17719e={'where':_0x556f19[_0x8e6b('0x3b')]};return db[_0x8e6b('0x2c')][_0x8e6b('0x1d')](_0x17719e)[_0x8e6b('0x24')](function(_0x443a18){_0x9d1cb0['count']=_0x443a18;if(_0x4c2100[_0x8e6b('0x32')][_0x8e6b('0x41')]){_0x556f19[_0x8e6b('0x42')]=[{'all':!![]}];}return db[_0x8e6b('0x2c')][_0x8e6b('0x43')](_0x556f19);})[_0x8e6b('0x24')](function(_0x3a6c65){_0x9d1cb0[_0x8e6b('0x44')]=_0x3a6c65;return _0x9d1cb0;})[_0x8e6b('0x24')](respondWithFilteredResult(_0x550558,_0x556f19))[_0x8e6b('0x45')](handleError(_0x550558,null));};exports[_0x8e6b('0x46')]=function(_0x1b47b8,_0x2bd044){var _0x34d30b={'raw':!![],'where':{'id':_0x1b47b8[_0x8e6b('0x47')]['id']}},_0x533932={};_0x533932[_0x8e6b('0x31')]=_[_0x8e6b('0x33')](db[_0x8e6b('0x2c')]['rawAttributes']);_0x533932[_0x8e6b('0x32')]=_['keys'](_0x1b47b8['query']);_0x533932[_0x8e6b('0x3c')]=_[_0x8e6b('0x48')](_0x533932[_0x8e6b('0x31')],_0x533932[_0x8e6b('0x32')]);_0x34d30b[_0x8e6b('0x34')]=_['intersection'](_0x533932[_0x8e6b('0x31')],qs[_0x8e6b('0x35')](_0x1b47b8['query']['fields']));_0x34d30b['attributes']=_0x34d30b[_0x8e6b('0x34')][_0x8e6b('0x36')]?_0x34d30b['attributes']:_0x533932[_0x8e6b('0x31')];if(_0x1b47b8['query'][_0x8e6b('0x41')]){_0x34d30b[_0x8e6b('0x42')]=[{'all':!![]}];}_0x34d30b=_[_0x8e6b('0x3f')]({},_0x34d30b,_0x1b47b8[_0x8e6b('0x49')]);return db[_0x8e6b('0x2c')][_0x8e6b('0x4a')](_0x34d30b)[_0x8e6b('0x24')](handleEntityNotFound(_0x2bd044,null))[_0x8e6b('0x24')](respondWithResult(_0x2bd044,null))[_0x8e6b('0x45')](handleError(_0x2bd044,null));};exports[_0x8e6b('0x4b')]=function(_0x1e35b7,_0x5007c1){return db[_0x8e6b('0x2c')][_0x8e6b('0x4b')](_0x1e35b7[_0x8e6b('0x4c')],{})[_0x8e6b('0x24')](respondWithResult(_0x5007c1,0xc9))[_0x8e6b('0x45')](handleError(_0x5007c1,null));};exports[_0x8e6b('0x23')]=function(_0x4fe748,_0x17614a){if(_0x4fe748['body']['id']){delete _0x4fe748['body']['id'];}return db['AnalyticTreeReport'][_0x8e6b('0x4a')]({'where':{'id':_0x4fe748[_0x8e6b('0x47')]['id']}})[_0x8e6b('0x24')](handleEntityNotFound(_0x17614a,null))[_0x8e6b('0x24')](saveUpdates(_0x4fe748[_0x8e6b('0x4c')],null))['then'](respondWithResult(_0x17614a,null))[_0x8e6b('0x45')](handleError(_0x17614a,null));};exports[_0x8e6b('0x25')]=function(_0x874701,_0x3c7a7b){return db[_0x8e6b('0x2c')]['find']({'where':{'id':_0x874701['params']['id']}})[_0x8e6b('0x24')](handleEntityNotFound(_0x3c7a7b,null))[_0x8e6b('0x24')](removeEntity(_0x3c7a7b,null))['catch'](handleError(_0x3c7a7b,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 692f72e..30d1a92 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 _0xa5d7=['analytics_report_trees','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports','AnalyticTreeReport'];(function(_0x25dd03,_0x38fe2b){var _0x195a85=function(_0x226a6c){while(--_0x226a6c){_0x25dd03['push'](_0x25dd03['shift']());}};_0x195a85(++_0x38fe2b);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x26218b,_0x2ce309){_0x26218b=_0x26218b-0x0;var _0x2c19be=_0xa5d7[_0x26218b];return _0x2c19be;};'use strict';var _=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var logger=require(_0x7a5d('0x2'))(_0x7a5d('0x3'));var moment=require('moment');var BPromise=require(_0x7a5d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a5d('0x5'));var rimraf=require('rimraf');var config=require(_0x7a5d('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0x7a5d('0x7')]=function(_0x42a143,_0x251ef5){return _0x42a143['define'](_0x7a5d('0x8'),attributes,{'tableName':_0x7a5d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87bc=['request-promise','rimraf','define','lodash','util','api'];(function(_0x13ffab,_0x449a1c){var _0x11cfda=function(_0x2cd296){while(--_0x2cd296){_0x13ffab['push'](_0x13ffab['shift']());}};_0x11cfda(++_0x449a1c);}(_0x87bc,0x189));var _0xc87b=function(_0x1484cd,_0x587336){_0x1484cd=_0x1484cd-0x0;var _0x13e34c=_0x87bc[_0x1484cd];return _0x13e34c;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var logger=require('../../config/logger')(_0xc87b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc87b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc87b('0x4'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x1a2172,_0x1dfa75){return _0x1a2172[_0xc87b('0x5')]('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 0c14d63..997024e 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 _0xca74=['request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca74,0x11a));var _0x4ca7=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0xca74[_0x30d87a];return _0x48f64b;};'use strict';var _=require('lodash');var util=require(_0x4ca7('0x0'));var moment=require(_0x4ca7('0x1'));var BPromise=require(_0x4ca7('0x2'));var rs=require(_0x4ca7('0x3'));var fs=require('fs');var Redis=require(_0x4ca7('0x4'));var db=require(_0x4ca7('0x5'))['db'];var utils=require(_0x4ca7('0x6'));var logger=require(_0x4ca7('0x7'))(_0x4ca7('0x8'));var config=require(_0x4ca7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4ca7('0xa')][_0x4ca7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25be50,_0x1690f7,_0x5c649a){return new BPromise(function(_0xd2d4e4,_0x20f97e){return client[_0x4ca7('0xc')](_0x25be50,_0x5c649a)['then'](function(_0x2974fe){logger[_0x4ca7('0xd')](_0x4ca7('0xe'),_0x1690f7,'request\x20sent');logger[_0x4ca7('0xf')](_0x4ca7('0x10'),_0x1690f7,_0x4ca7('0x11'),JSON[_0x4ca7('0x12')](_0x2974fe));if(_0x2974fe[_0x4ca7('0x13')]){if(_0x2974fe[_0x4ca7('0x13')]['code']===0x1f4){logger[_0x4ca7('0x13')](_0x4ca7('0xe'),_0x1690f7,_0x2974fe[_0x4ca7('0x13')][_0x4ca7('0x14')]);return _0x20f97e(_0x2974fe[_0x4ca7('0x13')][_0x4ca7('0x14')]);}logger[_0x4ca7('0x13')](_0x4ca7('0xe'),_0x1690f7,_0x2974fe['error'][_0x4ca7('0x14')]);return _0xd2d4e4(_0x2974fe[_0x4ca7('0x13')][_0x4ca7('0x14')]);}else{logger[_0x4ca7('0xd')](_0x4ca7('0xe'),_0x1690f7,_0x4ca7('0x11'));_0xd2d4e4(_0x2974fe[_0x4ca7('0x15')]['message']);}})[_0x4ca7('0x16')](function(_0x8b1443){logger['error'](_0x4ca7('0xe'),_0x1690f7,_0x8b1443);_0x20f97e(_0x8b1443);});});} \ No newline at end of file +var _0x8fa2=['request','then','info','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticTreeReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xf45bd6,_0x4b4cc6){var _0x2cc731=function(_0x110007){while(--_0x110007){_0xf45bd6['push'](_0xf45bd6['shift']());}};_0x2cc731(++_0x4b4cc6);}(_0x8fa2,0x97));var _0x28fa=function(_0x2b3e0c,_0xca0a58){_0x2b3e0c=_0x2b3e0c-0x0;var _0x3535e8=_0x8fa2[_0x2b3e0c];return _0x3535e8;};'use strict';var _=require(_0x28fa('0x0'));var util=require('util');var moment=require(_0x28fa('0x1'));var BPromise=require(_0x28fa('0x2'));var rs=require(_0x28fa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28fa('0x4'))['db'];var utils=require(_0x28fa('0x5'));var logger=require(_0x28fa('0x6'))(_0x28fa('0x7'));var config=require(_0x28fa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x28fa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48686f,_0x264da9,_0x52e051){return new BPromise(function(_0x54f235,_0x3ebb68){return client[_0x28fa('0xa')](_0x48686f,_0x52e051)[_0x28fa('0xb')](function(_0x5db887){logger[_0x28fa('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x264da9,_0x28fa('0xd'));logger[_0x28fa('0xe')](_0x28fa('0xf'),_0x264da9,_0x28fa('0xd'),JSON[_0x28fa('0x10')](_0x5db887));if(_0x5db887['error']){if(_0x5db887[_0x28fa('0x11')][_0x28fa('0x12')]===0x1f4){logger[_0x28fa('0x11')](_0x28fa('0x13'),_0x264da9,_0x5db887[_0x28fa('0x11')]['message']);return _0x3ebb68(_0x5db887[_0x28fa('0x11')][_0x28fa('0x14')]);}logger[_0x28fa('0x11')](_0x28fa('0x13'),_0x264da9,_0x5db887[_0x28fa('0x11')][_0x28fa('0x14')]);return _0x54f235(_0x5db887[_0x28fa('0x11')]['message']);}else{logger['info'](_0x28fa('0x13'),_0x264da9,_0x28fa('0xd'));_0x54f235(_0x5db887[_0x28fa('0x15')][_0x28fa('0x14')]);}})[_0x28fa('0x16')](function(_0x22c914){logger[_0x28fa('0x11')](_0x28fa('0x13'),_0x264da9,_0x22c914);_0x3ebb68(_0x22c914);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 5e16afe..23dd307 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 _0x025c=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x3b0c9d,_0x3ddeb5){var _0xcfc8d7=function(_0x320dc6){while(--_0x320dc6){_0x3b0c9d['push'](_0x3b0c9d['shift']());}};_0xcfc8d7(++_0x3ddeb5);}(_0x025c,0x128));var _0xc025=function(_0x114975,_0x4c8b1a){_0x114975=_0x114975-0x0;var _0x41a0bd=_0x025c[_0x114975];return _0x41a0bd;};'use strict';var multer=require(_0xc025('0x0'));var util=require(_0xc025('0x1'));var path=require(_0xc025('0x2'));var timeout=require('connect-timeout');var express=require(_0xc025('0x3'));var router=express[_0xc025('0x4')]();var fs_extra=require(_0xc025('0x5'));var auth=require(_0xc025('0x6'));var interaction=require(_0xc025('0x7'));var config=require('../../config/environment');var controller=require(_0xc025('0x8'));router['get']('/',auth[_0xc025('0x9')](),controller[_0xc025('0xa')]);router[_0xc025('0xb')](_0xc025('0xc'),auth[_0xc025('0x9')](),controller[_0xc025('0xd')]);router[_0xc025('0xe')]('/',auth[_0xc025('0x9')](),controller[_0xc025('0xf')]);router[_0xc025('0x10')](_0xc025('0xc'),auth[_0xc025('0x9')](),controller[_0xc025('0x11')]);router[_0xc025('0x12')](_0xc025('0xc'),auth[_0xc025('0x9')](),controller[_0xc025('0x13')]);module[_0xc025('0x14')]=router; \ No newline at end of file +var _0x3237=['./analyticTreeReport.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2300ea,_0x556523){var _0x47f2b2=function(_0x3d1fe2){while(--_0x3d1fe2){_0x2300ea['push'](_0x2300ea['shift']());}};_0x47f2b2(++_0x556523);}(_0x3237,0x150));var _0x7323=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3237[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7323('0x0'));var timeout=require(_0x7323('0x1'));var express=require('express');var router=express[_0x7323('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7323('0x3'));var interaction=require(_0x7323('0x4'));var config=require(_0x7323('0x5'));var controller=require(_0x7323('0x6'));router['get']('/',auth[_0x7323('0x7')](),controller[_0x7323('0x8')]);router[_0x7323('0x9')]('/:id',auth[_0x7323('0x7')](),controller['show']);router[_0x7323('0xa')]('/',auth[_0x7323('0x7')](),controller[_0x7323('0xb')]);router[_0x7323('0xc')](_0x7323('0xd'),auth[_0x7323('0x7')](),controller[_0x7323('0xe')]);router[_0x7323('0xf')]('/:id',auth[_0x7323('0x7')](),controller[_0x7323('0x10')]);module[_0x7323('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 17e62e6..bc75e98 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 _0xbacb=['exports','STRING'];(function(_0x42b1e1,_0x2c393d){var _0x2276eb=function(_0x3e7a56){while(--_0x3e7a56){_0x42b1e1['push'](_0x42b1e1['shift']());}};_0x2276eb(++_0x2c393d);}(_0xbacb,0x104));var _0xbbac=function(_0x32eade,_0x4d817e){_0x32eade=_0x32eade-0x0;var _0x1bc1d6=_0xbacb[_0x32eade];return _0x1bc1d6;};'use strict';var Sequelize=require('sequelize');module[_0xbbac('0x0')]={'name':{'type':Sequelize[_0xbbac('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbbac('0x1')]}}; \ No newline at end of file +var _0x2680=['STRING','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2680,0x18b));var _0x0268=function(_0x370801,_0x3208cb){_0x370801=_0x370801-0x0;var _0x5185b4=_0x2680[_0x370801];return _0x5185b4;};'use strict';var Sequelize=require('sequelize');module[_0x0268('0x0')]={'name':{'type':Sequelize[_0x0268('0x1')]},'basename':{'type':Sequelize[_0x0268('0x1')]},'type':{'type':Sequelize[_0x0268('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index ddad7f5..42d0a5e 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 _0xa9e0=['sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','fields','find','clone','omit','createdAt','updatedAt','body','update','create','file','originalname','basename','filename','mimetype','join','root','server/files/attachments/','offline-chat/','download','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','index','map','Attachment','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit'];(function(_0xe81e03,_0x15695d){var _0x2e87c6=function(_0x17557e){while(--_0x17557e){_0xe81e03['push'](_0xe81e03['shift']());}};_0x2e87c6(++_0x15695d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];function respondWithStatusCode(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xcc;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['sendStatus'](_0x32d742);}return _0x26d672[_0x0a9e('0x16')](_0x32d742)[_0x0a9e('0x17')]();};}function respondWithResult(_0x2b4227,_0x281129){_0x281129=_0x281129||0xc8;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x16')](_0x281129)['json'](_0x44dcfd);}};}function respondWithFilteredResult(_0x22dccb,_0x5d0880){return function(_0x1985b6){if(_0x1985b6){var _0x519dfd=_0x1985b6[_0x0a9e('0x18')],_0x16033c=_0x5d0880['offset'],_0x12066b=_0x5d0880[_0x0a9e('0x19')]+_0x5d0880[_0x0a9e('0x1a')],_0x48f32d;if(_0x12066b>=_0x519dfd){_0x12066b=_0x519dfd;_0x48f32d=0xc8;}else{_0x48f32d=0xce;}_0x22dccb[_0x0a9e('0x16')](_0x48f32d);return _0x22dccb[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x16033c+'-'+_0x12066b+'/'+_0x519dfd)[_0x0a9e('0x1d')](_0x1985b6);}return null;};}function patchUpdates(_0x530eb7){return function(_0x20559e){try{jsonpatch[_0x0a9e('0x1e')](_0x20559e,_0x530eb7,!![]);}catch(_0x112016){return BPromise[_0x0a9e('0x1f')](_0x112016);}return _0x20559e[_0x0a9e('0x20')]();};}function saveUpdates(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['update'](_0x4bb1e3)[_0x0a9e('0x21')](function(_0x5a09ef){return _0x5a09ef;});}return null;};}function removeEntity(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x22')]()[_0x0a9e('0x21')](function(){_0x588269['status'](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(!_0x4d00e6){_0x2fb0e4[_0x0a9e('0x23')](0x194);}return _0x4d00e6;};}function handleError(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0x1f4;return function(_0x5ea472){logger['error'](_0x5ea472[_0x0a9e('0x24')]);if(_0x5ea472[_0x0a9e('0x25')]){delete _0x5ea472[_0x0a9e('0x25')];}_0x42ac8f[_0x0a9e('0x16')](_0x16b1ca)['send'](_0x5ea472);};}exports[_0x0a9e('0x26')]=function(_0x479bc4,_0x45a1e7){var _0x5bfb33={},_0x1dc186={},_0x34dc65={'count':0x0,'rows':[]};var _0x25fba9=_[_0x0a9e('0x27')](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x11c3b6){return{'name':_0x11c3b6[_0x0a9e('0x2a')],'type':_0x11c3b6['type'][_0x0a9e('0x2b')]};});_0x1dc186[_0x0a9e('0x2c')]=_[_0x0a9e('0x27')](_0x25fba9,_0x0a9e('0x25'));_0x1dc186['query']=_[_0x0a9e('0x2d')](_0x479bc4[_0x0a9e('0x2e')]);_0x1dc186[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x1dc186[_0x0a9e('0x2c')],_0x1dc186[_0x0a9e('0x2e')]);_0x5bfb33[_0x0a9e('0x31')]=_[_0x0a9e('0x30')](_0x1dc186[_0x0a9e('0x2c')],qs['fields'](_0x479bc4[_0x0a9e('0x2e')]['fields']));_0x5bfb33[_0x0a9e('0x31')]=_0x5bfb33[_0x0a9e('0x31')][_0x0a9e('0x32')]?_0x5bfb33[_0x0a9e('0x31')]:_0x1dc186[_0x0a9e('0x2c')];if(!_0x479bc4['query'][_0x0a9e('0x33')](_0x0a9e('0x34'))){_0x5bfb33[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x1a')]);_0x5bfb33[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x479bc4['query'][_0x0a9e('0x19')]);}_0x5bfb33['order']=qs[_0x0a9e('0x35')](_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x5bfb33[_0x0a9e('0x36')]=qs['filters'](_[_0x0a9e('0x37')](_0x479bc4[_0x0a9e('0x2e')],_0x1dc186[_0x0a9e('0x2f')]),_0x25fba9);if(_0x479bc4[_0x0a9e('0x2e')]['filter']){_0x5bfb33['where']=_[_0x0a9e('0x38')](_0x5bfb33['where'],{'$or':_[_0x0a9e('0x27')](_0x25fba9,function(_0x3d9717){if(_0x3d9717[_0x0a9e('0x39')]!==_0x0a9e('0x3a')){var _0x4f41ae={};_0x4f41ae[_0x3d9717[_0x0a9e('0x25')]]={'$like':'%'+_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x3b')]+'%'};return _0x4f41ae;}})});}_0x5bfb33=_['merge']({},_0x5bfb33,_0x479bc4[_0x0a9e('0x3c')]);var _0x1a180b={'where':_0x5bfb33[_0x0a9e('0x36')]};return db['Attachment']['count'](_0x1a180b)[_0x0a9e('0x21')](function(_0x40d766){_0x34dc65['count']=_0x40d766;if(_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x5bfb33[_0x0a9e('0x3e')]=[{'all':!![]}];}return db[_0x0a9e('0x28')]['findAll'](_0x5bfb33);})['then'](function(_0x15e37d){_0x34dc65[_0x0a9e('0x3f')]=_0x15e37d;return _0x34dc65;})['then'](respondWithFilteredResult(_0x45a1e7,_0x5bfb33))[_0x0a9e('0x40')](handleError(_0x45a1e7,null));};exports[_0x0a9e('0x41')]=function(_0x1459bb,_0x5b4f5e){var _0x316c8f={'raw':!![],'where':{'id':_0x1459bb[_0x0a9e('0x42')]['id']}},_0x2cfea9={};_0x2cfea9[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2cfea9[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x1459bb[_0x0a9e('0x2e')]);_0x2cfea9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x2cfea9[_0x0a9e('0x2c')],_0x2cfea9[_0x0a9e('0x2e')]);_0x316c8f[_0x0a9e('0x31')]=_['intersection'](_0x2cfea9['model'],qs[_0x0a9e('0x43')](_0x1459bb[_0x0a9e('0x2e')][_0x0a9e('0x43')]));_0x316c8f[_0x0a9e('0x31')]=_0x316c8f[_0x0a9e('0x31')][_0x0a9e('0x32')]?_0x316c8f[_0x0a9e('0x31')]:_0x2cfea9[_0x0a9e('0x2c')];if(_0x1459bb[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x316c8f[_0x0a9e('0x3e')]=[{'all':!![]}];}_0x316c8f=_[_0x0a9e('0x38')]({},_0x316c8f,_0x1459bb['options']);return db[_0x0a9e('0x28')][_0x0a9e('0x44')](_0x316c8f)[_0x0a9e('0x21')](handleEntityNotFound(_0x5b4f5e,null))[_0x0a9e('0x21')](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0x40')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x45')]=function(_0x21eb86,_0x44dd99){var _0x59afe8={'where':{'id':_0x21eb86['params']['id']}},_0x2e9d90={};_0x2e9d90[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x28')]['rawAttributes']);_0x59afe8[_0x0a9e('0x31')]=_[_0x0a9e('0x30')](_0x2e9d90[_0x0a9e('0x2c')],qs[_0x0a9e('0x43')](_0x21eb86[_0x0a9e('0x2e')][_0x0a9e('0x43')]));_0x59afe8[_0x0a9e('0x31')]=_0x59afe8['attributes'][_0x0a9e('0x32')]?_0x59afe8[_0x0a9e('0x31')]:_0x2e9d90[_0x0a9e('0x2c')];if(_0x21eb86[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x59afe8[_0x0a9e('0x3e')]=[{'all':!![]}];}_0x59afe8=_[_0x0a9e('0x38')]({},_0x59afe8,_0x21eb86[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')]['find'](_0x59afe8)[_0x0a9e('0x21')](handleEntityNotFound(_0x44dd99,null))[_0x0a9e('0x21')](function(_0x4f7240){if(_0x4f7240){var _0x4ae14b=_0x4f7240['get']({'plain':!![]});_0x4ae14b=qs[_0x0a9e('0x46')](_0x4ae14b,['id',_0x0a9e('0x47'),_0x0a9e('0x48')]);_0x21eb86[_0x0a9e('0x49')]=_[_0x0a9e('0x46')](_0x21eb86[_0x0a9e('0x49')],['id',_0x0a9e('0x47'),_0x0a9e('0x48')]);return db['Attachment']['create'](_['merge'](_0x4ae14b,_0x21eb86[_0x0a9e('0x49')]),{'include':_0x21eb86[_0x0a9e('0x2e')][_0x0a9e('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x44dd99,0xc9))[_0x0a9e('0x40')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x4a')]=function(_0x53d113,_0x5a88da){if(_0x53d113[_0x0a9e('0x49')]['id']){delete _0x53d113['body']['id'];}return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x53d113[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x5a88da,null))[_0x0a9e('0x21')](saveUpdates(_0x53d113['body'],null))[_0x0a9e('0x21')](respondWithResult(_0x5a88da,null))[_0x0a9e('0x40')](handleError(_0x5a88da,null));};exports['destroy']=function(_0x50f687,_0x128aa6){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x50f687[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x128aa6,null))[_0x0a9e('0x21')](removeEntity(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x4b')]=function(_0x4a6deb,_0x5da27d,_0x5df0ad){_0x4a6deb[_0x0a9e('0x49')]['name']=_0x4a6deb[_0x0a9e('0x4c')][_0x0a9e('0x4d')];_0x4a6deb[_0x0a9e('0x49')][_0x0a9e('0x4e')]=_0x4a6deb[_0x0a9e('0x4c')][_0x0a9e('0x4f')];_0x4a6deb[_0x0a9e('0x49')][_0x0a9e('0x39')]=_0x4a6deb['file'][_0x0a9e('0x50')];return db[_0x0a9e('0x28')][_0x0a9e('0x4b')](_0x4a6deb[_0x0a9e('0x49')])[_0x0a9e('0x21')](respondWithResult(_0x5da27d,0xc9))[_0x0a9e('0x40')](handleError(_0x5da27d,null));};exports['download']=function(_0x956fbe,_0x26bc80,_0x5239ef){return db[_0x0a9e('0x28')]['findOne']({'where':{'id':_0x956fbe[_0x0a9e('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x26bc80,null))['then'](function(_0x5674ee){if(_0x5674ee){var _0x273cb5=_0x5674ee['ChatOfflineMessageId']!==null;var _0x2244d6=path[_0x0a9e('0x51')](config[_0x0a9e('0x52')],_0x0a9e('0x53'));if(_0x273cb5){_0x2244d6=path[_0x0a9e('0x51')](_0x2244d6,_0x0a9e('0x54'));}var _0x49eed0=path[_0x0a9e('0x51')](_0x2244d6,_0x5674ee['basename']);return _0x26bc80[_0x0a9e('0x55')](_0x49eed0);}})[_0x0a9e('0x40')](handleError(_0x26bc80,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','fields','find','clone','omit','createdAt','updatedAt','body','update','create','file','originalname','basename','filename','mimetype','join','root','server/files/attachments/','offline-chat/','download','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','index','map','Attachment','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit'];(function(_0x2a3876,_0x3736ec){var _0x4f769f=function(_0x3d4101){while(--_0x3d4101){_0x2a3876['push'](_0x2a3876['shift']());}};_0x4f769f(++_0x3736ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];function respondWithStatusCode(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xcc;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['sendStatus'](_0x32d742);}return _0x26d672[_0x0a9e('0x16')](_0x32d742)[_0x0a9e('0x17')]();};}function respondWithResult(_0x2b4227,_0x281129){_0x281129=_0x281129||0xc8;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x16')](_0x281129)['json'](_0x44dcfd);}};}function respondWithFilteredResult(_0x22dccb,_0x5d0880){return function(_0x1985b6){if(_0x1985b6){var _0x519dfd=_0x1985b6[_0x0a9e('0x18')],_0x16033c=_0x5d0880['offset'],_0x12066b=_0x5d0880[_0x0a9e('0x19')]+_0x5d0880[_0x0a9e('0x1a')],_0x48f32d;if(_0x12066b>=_0x519dfd){_0x12066b=_0x519dfd;_0x48f32d=0xc8;}else{_0x48f32d=0xce;}_0x22dccb[_0x0a9e('0x16')](_0x48f32d);return _0x22dccb[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x16033c+'-'+_0x12066b+'/'+_0x519dfd)[_0x0a9e('0x1d')](_0x1985b6);}return null;};}function patchUpdates(_0x530eb7){return function(_0x20559e){try{jsonpatch[_0x0a9e('0x1e')](_0x20559e,_0x530eb7,!![]);}catch(_0x112016){return BPromise[_0x0a9e('0x1f')](_0x112016);}return _0x20559e[_0x0a9e('0x20')]();};}function saveUpdates(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['update'](_0x4bb1e3)[_0x0a9e('0x21')](function(_0x5a09ef){return _0x5a09ef;});}return null;};}function removeEntity(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x22')]()[_0x0a9e('0x21')](function(){_0x588269['status'](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(!_0x4d00e6){_0x2fb0e4[_0x0a9e('0x23')](0x194);}return _0x4d00e6;};}function handleError(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0x1f4;return function(_0x5ea472){logger['error'](_0x5ea472[_0x0a9e('0x24')]);if(_0x5ea472[_0x0a9e('0x25')]){delete _0x5ea472[_0x0a9e('0x25')];}_0x42ac8f[_0x0a9e('0x16')](_0x16b1ca)['send'](_0x5ea472);};}exports[_0x0a9e('0x26')]=function(_0x479bc4,_0x45a1e7){var _0x5bfb33={},_0x1dc186={},_0x34dc65={'count':0x0,'rows':[]};var _0x25fba9=_[_0x0a9e('0x27')](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x11c3b6){return{'name':_0x11c3b6[_0x0a9e('0x2a')],'type':_0x11c3b6['type'][_0x0a9e('0x2b')]};});_0x1dc186[_0x0a9e('0x2c')]=_[_0x0a9e('0x27')](_0x25fba9,_0x0a9e('0x25'));_0x1dc186['query']=_[_0x0a9e('0x2d')](_0x479bc4[_0x0a9e('0x2e')]);_0x1dc186[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x1dc186[_0x0a9e('0x2c')],_0x1dc186[_0x0a9e('0x2e')]);_0x5bfb33[_0x0a9e('0x31')]=_[_0x0a9e('0x30')](_0x1dc186[_0x0a9e('0x2c')],qs['fields'](_0x479bc4[_0x0a9e('0x2e')]['fields']));_0x5bfb33[_0x0a9e('0x31')]=_0x5bfb33[_0x0a9e('0x31')][_0x0a9e('0x32')]?_0x5bfb33[_0x0a9e('0x31')]:_0x1dc186[_0x0a9e('0x2c')];if(!_0x479bc4['query'][_0x0a9e('0x33')](_0x0a9e('0x34'))){_0x5bfb33[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x1a')]);_0x5bfb33[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x479bc4['query'][_0x0a9e('0x19')]);}_0x5bfb33['order']=qs[_0x0a9e('0x35')](_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x5bfb33[_0x0a9e('0x36')]=qs['filters'](_[_0x0a9e('0x37')](_0x479bc4[_0x0a9e('0x2e')],_0x1dc186[_0x0a9e('0x2f')]),_0x25fba9);if(_0x479bc4[_0x0a9e('0x2e')]['filter']){_0x5bfb33['where']=_[_0x0a9e('0x38')](_0x5bfb33['where'],{'$or':_[_0x0a9e('0x27')](_0x25fba9,function(_0x3d9717){if(_0x3d9717[_0x0a9e('0x39')]!==_0x0a9e('0x3a')){var _0x4f41ae={};_0x4f41ae[_0x3d9717[_0x0a9e('0x25')]]={'$like':'%'+_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x3b')]+'%'};return _0x4f41ae;}})});}_0x5bfb33=_['merge']({},_0x5bfb33,_0x479bc4[_0x0a9e('0x3c')]);var _0x1a180b={'where':_0x5bfb33[_0x0a9e('0x36')]};return db['Attachment']['count'](_0x1a180b)[_0x0a9e('0x21')](function(_0x40d766){_0x34dc65['count']=_0x40d766;if(_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x5bfb33[_0x0a9e('0x3e')]=[{'all':!![]}];}return db[_0x0a9e('0x28')]['findAll'](_0x5bfb33);})['then'](function(_0x15e37d){_0x34dc65[_0x0a9e('0x3f')]=_0x15e37d;return _0x34dc65;})['then'](respondWithFilteredResult(_0x45a1e7,_0x5bfb33))[_0x0a9e('0x40')](handleError(_0x45a1e7,null));};exports[_0x0a9e('0x41')]=function(_0x1459bb,_0x5b4f5e){var _0x316c8f={'raw':!![],'where':{'id':_0x1459bb[_0x0a9e('0x42')]['id']}},_0x2cfea9={};_0x2cfea9[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2cfea9[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x1459bb[_0x0a9e('0x2e')]);_0x2cfea9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x2cfea9[_0x0a9e('0x2c')],_0x2cfea9[_0x0a9e('0x2e')]);_0x316c8f[_0x0a9e('0x31')]=_['intersection'](_0x2cfea9['model'],qs[_0x0a9e('0x43')](_0x1459bb[_0x0a9e('0x2e')][_0x0a9e('0x43')]));_0x316c8f[_0x0a9e('0x31')]=_0x316c8f[_0x0a9e('0x31')][_0x0a9e('0x32')]?_0x316c8f[_0x0a9e('0x31')]:_0x2cfea9[_0x0a9e('0x2c')];if(_0x1459bb[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x316c8f[_0x0a9e('0x3e')]=[{'all':!![]}];}_0x316c8f=_[_0x0a9e('0x38')]({},_0x316c8f,_0x1459bb['options']);return db[_0x0a9e('0x28')][_0x0a9e('0x44')](_0x316c8f)[_0x0a9e('0x21')](handleEntityNotFound(_0x5b4f5e,null))[_0x0a9e('0x21')](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0x40')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x45')]=function(_0x21eb86,_0x44dd99){var _0x59afe8={'where':{'id':_0x21eb86['params']['id']}},_0x2e9d90={};_0x2e9d90[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x28')]['rawAttributes']);_0x59afe8[_0x0a9e('0x31')]=_[_0x0a9e('0x30')](_0x2e9d90[_0x0a9e('0x2c')],qs[_0x0a9e('0x43')](_0x21eb86[_0x0a9e('0x2e')][_0x0a9e('0x43')]));_0x59afe8[_0x0a9e('0x31')]=_0x59afe8['attributes'][_0x0a9e('0x32')]?_0x59afe8[_0x0a9e('0x31')]:_0x2e9d90[_0x0a9e('0x2c')];if(_0x21eb86[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x59afe8[_0x0a9e('0x3e')]=[{'all':!![]}];}_0x59afe8=_[_0x0a9e('0x38')]({},_0x59afe8,_0x21eb86[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')]['find'](_0x59afe8)[_0x0a9e('0x21')](handleEntityNotFound(_0x44dd99,null))[_0x0a9e('0x21')](function(_0x4f7240){if(_0x4f7240){var _0x4ae14b=_0x4f7240['get']({'plain':!![]});_0x4ae14b=qs[_0x0a9e('0x46')](_0x4ae14b,['id',_0x0a9e('0x47'),_0x0a9e('0x48')]);_0x21eb86[_0x0a9e('0x49')]=_[_0x0a9e('0x46')](_0x21eb86[_0x0a9e('0x49')],['id',_0x0a9e('0x47'),_0x0a9e('0x48')]);return db['Attachment']['create'](_['merge'](_0x4ae14b,_0x21eb86[_0x0a9e('0x49')]),{'include':_0x21eb86[_0x0a9e('0x2e')][_0x0a9e('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x44dd99,0xc9))[_0x0a9e('0x40')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x4a')]=function(_0x53d113,_0x5a88da){if(_0x53d113[_0x0a9e('0x49')]['id']){delete _0x53d113['body']['id'];}return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x53d113[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x5a88da,null))[_0x0a9e('0x21')](saveUpdates(_0x53d113['body'],null))[_0x0a9e('0x21')](respondWithResult(_0x5a88da,null))[_0x0a9e('0x40')](handleError(_0x5a88da,null));};exports['destroy']=function(_0x50f687,_0x128aa6){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x50f687[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x128aa6,null))[_0x0a9e('0x21')](removeEntity(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x4b')]=function(_0x4a6deb,_0x5da27d,_0x5df0ad){_0x4a6deb[_0x0a9e('0x49')]['name']=_0x4a6deb[_0x0a9e('0x4c')][_0x0a9e('0x4d')];_0x4a6deb[_0x0a9e('0x49')][_0x0a9e('0x4e')]=_0x4a6deb[_0x0a9e('0x4c')][_0x0a9e('0x4f')];_0x4a6deb[_0x0a9e('0x49')][_0x0a9e('0x39')]=_0x4a6deb['file'][_0x0a9e('0x50')];return db[_0x0a9e('0x28')][_0x0a9e('0x4b')](_0x4a6deb[_0x0a9e('0x49')])[_0x0a9e('0x21')](respondWithResult(_0x5da27d,0xc9))[_0x0a9e('0x40')](handleError(_0x5da27d,null));};exports['download']=function(_0x956fbe,_0x26bc80,_0x5239ef){return db[_0x0a9e('0x28')]['findOne']({'where':{'id':_0x956fbe[_0x0a9e('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x26bc80,null))['then'](function(_0x5674ee){if(_0x5674ee){var _0x273cb5=_0x5674ee['ChatOfflineMessageId']!==null;var _0x2244d6=path[_0x0a9e('0x51')](config[_0x0a9e('0x52')],_0x0a9e('0x53'));if(_0x273cb5){_0x2244d6=path[_0x0a9e('0x51')](_0x2244d6,_0x0a9e('0x54'));}var _0x49eed0=path[_0x0a9e('0x51')](_0x2244d6,_0x5674ee['basename']);return _0x26bc80[_0x0a9e('0x55')](_0x49eed0);}})[_0x0a9e('0x40')](handleError(_0x26bc80,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 77e4810..55f3d6f 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 _0xea5b=['bluebird','request-promise','path','rimraf','./attachment.attributes','define','Attachment','attachments','lodash','util','../../config/logger'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0xea5b,0x152));var _0xbea5=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xea5b[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xbea5('0x0'));var util=require(_0xbea5('0x1'));var logger=require(_0xbea5('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbea5('0x3'));var rp=require(_0xbea5('0x4'));var fs=require('fs');var path=require(_0xbea5('0x5'));var rimraf=require(_0xbea5('0x6'));var config=require('../../config/environment');var attributes=require(_0xbea5('0x7'));module['exports']=function(_0x2db67a,_0x3d9263){return _0x2db67a[_0xbea5('0x8')](_0xbea5('0x9'),attributes,{'tableName':_0xbea5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ffd=['Attachment','attachments','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./attachment.attributes','define'];(function(_0x280fba,_0x32db4d){var _0x5225b8=function(_0xf1417){while(--_0xf1417){_0x280fba['push'](_0x280fba['shift']());}};_0x5225b8(++_0x32db4d);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x345952,_0x224e34){_0x345952=_0x345952-0x0;var _0x345685=_0x9ffd[_0x345952];return _0x345685;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('api');var moment=require(_0xd9ff('0x3'));var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var fs=require('fs');var path=require(_0xd9ff('0x6'));var rimraf=require('rimraf');var config=require(_0xd9ff('0x7'));var attributes=require(_0xd9ff('0x8'));module['exports']=function(_0x3aa26b,_0x2982c3){return _0x3aa26b[_0xd9ff('0x9')](_0xd9ff('0xa'),attributes,{'tableName':_0xd9ff('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 c6d4d72..7273433 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 _0x970c=['create','options','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','client','http','request','then','info','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Attachment,\x20%s,\x20%s','CreateAttachment'];(function(_0x1a57cb,_0x5ec459){var _0x4d59c8=function(_0x2afc92){while(--_0x2afc92){_0x1a57cb['push'](_0x1a57cb['shift']());}};_0x4d59c8(++_0x5ec459);}(_0x970c,0x1ac));var _0xc970=function(_0x8bda08,_0x1fdb02){_0x8bda08=_0x8bda08-0x0;var _0x50007f=_0x970c[_0x8bda08];return _0x50007f;};'use strict';var _=require(_0xc970('0x0'));var util=require(_0xc970('0x1'));var moment=require(_0xc970('0x2'));var BPromise=require('bluebird');var rs=require(_0xc970('0x3'));var fs=require('fs');var Redis=require(_0xc970('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc970('0x5'));var logger=require('../../config/logger')(_0xc970('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc970('0x7')][_0xc970('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e0645,_0x984617,_0x1e6dcd){return new BPromise(function(_0x15a0ad,_0x46fc94){return client[_0xc970('0x9')](_0x4e0645,_0x1e6dcd)[_0xc970('0xa')](function(_0x4563cf){logger[_0xc970('0xb')]('Attachment,\x20%s,\x20%s',_0x984617,'request\x20sent');logger['debug'](_0xc970('0xc'),_0x984617,_0xc970('0xd'),JSON[_0xc970('0xe')](_0x4563cf));if(_0x4563cf['error']){if(_0x4563cf[_0xc970('0xf')][_0xc970('0x10')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x984617,_0x4563cf[_0xc970('0xf')][_0xc970('0x11')]);return _0x46fc94(_0x4563cf[_0xc970('0xf')][_0xc970('0x11')]);}logger[_0xc970('0xf')]('Attachment,\x20%s,\x20%s',_0x984617,_0x4563cf[_0xc970('0xf')][_0xc970('0x11')]);return _0x15a0ad(_0x4563cf[_0xc970('0xf')]['message']);}else{logger[_0xc970('0xb')]('Attachment,\x20%s,\x20%s',_0x984617,'request\x20sent');_0x15a0ad(_0x4563cf[_0xc970('0x12')][_0xc970('0x11')]);}})[_0xc970('0x13')](function(_0x4ebfd2){logger['error'](_0xc970('0x14'),_0x984617,_0x4ebfd2);_0x46fc94(_0x4ebfd2);});});}exports[_0xc970('0x15')]=function(_0xded351){var _0x5b242e=this;return new Promise(function(_0x2e719c,_0x4d9ecf){return db['Attachment'][_0xc970('0x16')](_0xded351['body'],{'raw':_0xded351[_0xc970('0x17')]?_0xded351[_0xc970('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xc970('0xa')](function(_0x34b717){logger[_0xc970('0xb')](_0xc970('0x15'),_0xded351);logger[_0xc970('0x18')](_0xc970('0x15'),_0xded351,JSON['stringify'](_0x34b717));_0x2e719c(_0x34b717);})[_0xc970('0x13')](function(_0x591b80){logger[_0xc970('0xf')]('CreateAttachment',_0x591b80[_0xc970('0x11')],_0xded351);_0x4d9ecf(_0x5b242e[_0xc970('0xf')](0x1f4,_0x591b80[_0xc970('0x11')]));});});}; \ No newline at end of file +var _0xc45b=['http','then','Attachment,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','CreateAttachment','create','options','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x48655c,_0xe0f881){var _0x37fe0b=function(_0x465c41){while(--_0x465c41){_0x48655c['push'](_0x48655c['shift']());}};_0x37fe0b(++_0xe0f881);}(_0xc45b,0x87));var _0xbc45=function(_0x27cf50,_0x49a30c){_0x27cf50=_0x27cf50-0x0;var _0x5cff79=_0xc45b[_0x27cf50];return _0x5cff79;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbc45('0x0'));var BPromise=require(_0xbc45('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc45('0x2'))['db'];var utils=require(_0xbc45('0x3'));var logger=require(_0xbc45('0x4'))(_0xbc45('0x5'));var config=require(_0xbc45('0x6'));var jayson=require(_0xbc45('0x7'));var client=jayson[_0xbc45('0x8')][_0xbc45('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3501e9,_0x5d402a,_0x3ecef5){return new BPromise(function(_0x1dc3e4,_0x55c798){return client['request'](_0x3501e9,_0x3ecef5)[_0xbc45('0xa')](function(_0x46abeb){logger['info'](_0xbc45('0xb'),_0x5d402a,'request\x20sent');logger[_0xbc45('0xc')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5d402a,_0xbc45('0xd'),JSON[_0xbc45('0xe')](_0x46abeb));if(_0x46abeb[_0xbc45('0xf')]){if(_0x46abeb[_0xbc45('0xf')][_0xbc45('0x10')]===0x1f4){logger[_0xbc45('0xf')](_0xbc45('0xb'),_0x5d402a,_0x46abeb[_0xbc45('0xf')][_0xbc45('0x11')]);return _0x55c798(_0x46abeb[_0xbc45('0xf')][_0xbc45('0x11')]);}logger['error'](_0xbc45('0xb'),_0x5d402a,_0x46abeb[_0xbc45('0xf')]['message']);return _0x1dc3e4(_0x46abeb[_0xbc45('0xf')][_0xbc45('0x11')]);}else{logger[_0xbc45('0x12')](_0xbc45('0xb'),_0x5d402a,_0xbc45('0xd'));_0x1dc3e4(_0x46abeb[_0xbc45('0x13')][_0xbc45('0x11')]);}})[_0xbc45('0x14')](function(_0x35eacf){logger[_0xbc45('0xf')](_0xbc45('0xb'),_0x5d402a,_0x35eacf);_0x55c798(_0x35eacf);});});}exports[_0xbc45('0x15')]=function(_0x4e1d0d){var _0xd396b8=this;return new Promise(function(_0x125aaf,_0x775e4){return db['Attachment'][_0xbc45('0x16')](_0x4e1d0d['body'],{'raw':_0x4e1d0d[_0xbc45('0x17')]?_0x4e1d0d['options']['raw']===undefined?!![]:![]:!![]})[_0xbc45('0xa')](function(_0x3860bc){logger[_0xbc45('0x12')](_0xbc45('0x15'),_0x4e1d0d);logger[_0xbc45('0xc')]('CreateAttachment',_0x4e1d0d,JSON['stringify'](_0x3860bc));_0x125aaf(_0x3860bc);})['catch'](function(_0x18e6ea){logger['error'](_0xbc45('0x15'),_0x18e6ea[_0xbc45('0x11')],_0x4e1d0d);_0x775e4(_0xd396b8[_0xbc45('0xf')](0x1f4,_0x18e6ea[_0xbc45('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 3c330bf..e5c8c38 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 _0x00b3=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','create','put','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./attachment.controller','get','isAuthenticated','index','/:id/download','download'];(function(_0x272764,_0x16630c){var _0xab237d=function(_0x38195b){while(--_0x38195b){_0x272764['push'](_0x272764['shift']());}};_0xab237d(++_0x16630c);}(_0x00b3,0x17a));var _0x300b=function(_0x529f72,_0x47f1e3){_0x529f72=_0x529f72-0x0;var _0x2d884a=_0x00b3[_0x529f72];return _0x2d884a;};'use strict';var multer=require('multer');var util=require(_0x300b('0x0'));var path=require(_0x300b('0x1'));var timeout=require(_0x300b('0x2'));var express=require(_0x300b('0x3'));var router=express['Router']();var fs_extra=require(_0x300b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x300b('0x5'));var config=require('../../config/environment');var controller=require(_0x300b('0x6'));router[_0x300b('0x7')]('/',auth[_0x300b('0x8')](),controller[_0x300b('0x9')]);router['get']('/:id',auth[_0x300b('0x8')](),controller['show']);router['get'](_0x300b('0xa'),auth[_0x300b('0x8')](),controller[_0x300b('0xb')]);router['post'](_0x300b('0xc'),auth[_0x300b('0x8')](),controller[_0x300b('0xd')]);var upload=multer({'storage':multer[_0x300b('0xe')]({'destination':function(_0x566fb9,_0x1a96aa,_0x2eeb2d){_0x2eeb2d(null,path[_0x300b('0xf')](config['root'],_0x300b('0x10')));},'filename':function(_0xea95bb,_0x138efb,_0x40c03b){_0x40c03b(null,util[_0x300b('0x11')](_0x300b('0x12'),Date[_0x300b('0x13')](),_0x138efb[_0x300b('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload['single']('file'),controller[_0x300b('0x15')]);router[_0x300b('0x16')](_0x300b('0x17'),auth[_0x300b('0x8')](),controller['update']);router['delete'](_0x300b('0x17'),auth[_0x300b('0x8')](),controller[_0x300b('0x18')]);module[_0x300b('0x19')]=router; \ No newline at end of file +var _0xf4eb=['delete','exports','multer','Router','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id/download','download','post','/:id/clone','clone','join','root','format','%s-%s','now','originalname','replace','create','put','/:id','update'];(function(_0x2b8f0f,_0x5d1035){var _0x32e52f=function(_0x24807b){while(--_0x24807b){_0x2b8f0f['push'](_0x2b8f0f['shift']());}};_0x32e52f(++_0x5d1035);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4eb878,_0x287049){_0x4eb878=_0x4eb878-0x0;var _0x39dcb8=_0xf4eb[_0x4eb878];return _0x39dcb8;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/:id',auth[_0xbf4e('0x6')](),controller['show']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0xa')](_0xbf4e('0xb'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d9a07,_0x7dfb74,_0x5a8397){_0x5a8397(null,path[_0xbf4e('0xd')](config[_0xbf4e('0xe')],'server/files/attachments/'));},'filename':function(_0x17fd01,_0x5a3035,_0x56d185){_0x56d185(null,util[_0xbf4e('0xf')](_0xbf4e('0x10'),Date[_0xbf4e('0x11')](),_0x5a3035[_0xbf4e('0x12')][_0xbf4e('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbf4e('0xa')]('/',upload['single']('file'),controller[_0xbf4e('0x14')]);router[_0xbf4e('0x15')](_0xbf4e('0x16'),auth['isAuthenticated'](),controller[_0xbf4e('0x17')]);router[_0xbf4e('0x18')](_0xbf4e('0x16'),auth[_0xbf4e('0x6')](),controller['destroy']);module[_0xbf4e('0x19')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 4f9dd59..a4f56b2 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 _0x04fb=['callback','use','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','find','map','emails','admin','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile'];(function(_0x24afa6,_0x5c26db){var _0x2896a2=function(_0x598137){while(--_0x598137){_0x24afa6['push'](_0x24afa6['shift']());}};_0x2896a2(++_0x5c26db);}(_0x04fb,0x15a));var _0xb04f=function(_0xc1cb80,_0x60f7cf){_0xc1cb80=_0xc1cb80-0x0;var _0x55ab6b=_0x04fb[_0xc1cb80];return _0x55ab6b;};'use strict';var _=require('lodash');var passport=require(_0xb04f('0x0'));var GoogleStrategy=require(_0xb04f('0x1'))[_0xb04f('0x2')];var moment=require(_0xb04f('0x3'));var db=require(_0xb04f('0x4'))['db'];var config=require(_0xb04f('0x5'));var signToken=require(_0xb04f('0x6'))[_0xb04f('0x7')];var utils=require(_0xb04f('0x8'));exports[_0xb04f('0x9')]=passport[_0xb04f('0xa')](_0xb04f('0xb'),{'failureRedirect':_0xb04f('0xc'),'scope':[_0xb04f('0xd'),'email'],'session':![]});exports[_0xb04f('0xe')]=passport[_0xb04f('0xa')](_0xb04f('0xb'),{'failureRedirect':_0xb04f('0xc'),'session':![]});passport[_0xb04f('0xf')](new GoogleStrategy({'clientID':config[_0xb04f('0xb')]?config[_0xb04f('0xb')]['clientID']:'id','clientSecret':config[_0xb04f('0xb')]?config['google'][_0xb04f('0x10')]:_0xb04f('0x11'),'callbackURL':config[_0xb04f('0xb')]?config[_0xb04f('0xb')][_0xb04f('0x12')]:''},function(_0x9507ad,_0x5b284c,_0x14094e,_0x3662ef){var _0x5ce9df,_0xe0046c;return db[_0xb04f('0x13')][_0xb04f('0x14')]({'where':{'id':0x1},'attributes':[_0xb04f('0x15'),_0xb04f('0x16')],'raw':!![]})[_0xb04f('0x17')](function(_0x3f153b){_0x5ce9df=_0x3f153b;return db['User'][_0xb04f('0x18')]({'where':{'email':_[_0xb04f('0x19')](_0x14094e[_0xb04f('0x1a')],'value'),'role':{'$or':[_0xb04f('0x1b'),'user','agent']}}});})[_0xb04f('0x17')](function(_0x373dd9){_0xe0046c=_0x373dd9;if(_0xe0046c){if(_0xe0046c[_0xb04f('0x1c')]){return _0x3662ef(_0xb04f('0x1d'));}else if(_0x5ce9df['blockDuration']>0x0){if(_0xe0046c[_0xb04f('0x1e')]){if(moment(_0xe0046c[_0xb04f('0x1f')])[_0xb04f('0x20')](_0x5ce9df[_0xb04f('0x16')],_0xb04f('0x21'))>moment()){return _0x3662ef(_0xb04f('0x1d'));}else{return utils[_0xb04f('0x22')](_0xe0046c,0x0,![],null)[_0xb04f('0x17')](function(){return utils['getLicense'](_0xe0046c);})[_0xb04f('0x17')](function(){return _0x3662ef(null,_0xe0046c);});}}else{return utils[_0xb04f('0x23')](_0xe0046c)[_0xb04f('0x17')](function(){return _0x3662ef(null,_0xe0046c);});}}else{return utils[_0xb04f('0x23')](_0xe0046c)['then'](function(){return _0x3662ef(null,_0xe0046c);});}}return _0x3662ef('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})['catch'](function(_0x2ebdc4){_0x3662ef(_0x2ebdc4);});})); \ No newline at end of file +var _0x515f=['../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','profile','callback','authenticate','google','/login','clientID','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','emails','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport-google-oauth20','Strategy'];(function(_0x135a1c,_0x28b5f6){var _0x295c98=function(_0x2747fc){while(--_0x2747fc){_0x135a1c['push'](_0x135a1c['shift']());}};_0x295c98(++_0x28b5f6);}(_0x515f,0xac));var _0xf515=function(_0x39fdb7,_0x5ac80d){_0x39fdb7=_0x39fdb7-0x0;var _0xbd17e7=_0x515f[_0x39fdb7];return _0xbd17e7;};'use strict';var _=require(_0xf515('0x0'));var passport=require('passport');var GoogleStrategy=require(_0xf515('0x1'))[_0xf515('0x2')];var moment=require('moment');var db=require(_0xf515('0x3'))['db'];var config=require(_0xf515('0x4'));var signToken=require(_0xf515('0x5'))[_0xf515('0x6')];var utils=require(_0xf515('0x7'));exports[_0xf515('0x8')]=passport['authenticate']('google',{'failureRedirect':'/login','scope':[_0xf515('0x9'),'email'],'session':![]});exports[_0xf515('0xa')]=passport[_0xf515('0xb')](_0xf515('0xc'),{'failureRedirect':_0xf515('0xd'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0xf515('0xc')]?config['google'][_0xf515('0xe')]:'id','clientSecret':config[_0xf515('0xc')]?config[_0xf515('0xc')]['clientSecret']:'secret','callbackURL':config[_0xf515('0xc')]?config[_0xf515('0xc')]['callbackURL']:''},function(_0xa3005c,_0x48e681,_0x5c195d,_0xc37a4e){var _0x144c93,_0x40c159;return db['Setting'][_0xf515('0xf')]({'where':{'id':0x1},'attributes':[_0xf515('0x10'),_0xf515('0x11')],'raw':!![]})[_0xf515('0x12')](function(_0x26b58a){_0x144c93=_0x26b58a;return db[_0xf515('0x13')][_0xf515('0x14')]({'where':{'email':_[_0xf515('0x15')](_0x5c195d[_0xf515('0x16')],'value'),'role':{'$or':[_0xf515('0x17'),_0xf515('0x18'),_0xf515('0x19')]}}});})[_0xf515('0x12')](function(_0x1f0366){_0x40c159=_0x1f0366;if(_0x40c159){if(_0x40c159[_0xf515('0x1a')]){return _0xc37a4e(_0xf515('0x1b'));}else if(_0x144c93['blockDuration']>0x0){if(_0x40c159[_0xf515('0x1c')]){if(moment(_0x40c159[_0xf515('0x1d')])[_0xf515('0x1e')](_0x144c93[_0xf515('0x11')],_0xf515('0x1f'))>moment()){return _0xc37a4e(_0xf515('0x1b'));}else{return utils[_0xf515('0x20')](_0x40c159,0x0,![],null)[_0xf515('0x12')](function(){return utils[_0xf515('0x21')](_0x40c159);})[_0xf515('0x12')](function(){return _0xc37a4e(null,_0x40c159);});}}else{return utils[_0xf515('0x21')](_0x40c159)[_0xf515('0x12')](function(){return _0xc37a4e(null,_0x40c159);});}}else{return utils['getLicense'](_0x40c159)[_0xf515('0x12')](function(){return _0xc37a4e(null,_0x40c159);});}}return _0xc37a4e(_0xf515('0x1b'));})[_0xf515('0x22')](function(_0x28bd8a){_0xc37a4e(_0x28bd8a);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index b4c05a9..946d1a3 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 _0x0dba=['callback','isMiddleware','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0x0dba,0x136));var _0xa0db=function(_0x3d526b,_0x1b6dda){_0x3d526b=_0x3d526b-0x0;var _0x3ed17e=_0x0dba[_0x3d526b];return _0x3ed17e;};'use strict';var express=require(_0xa0db('0x0'));var passport=require(_0xa0db('0x1'));var router=express[_0xa0db('0x2')]();var controller=require(_0xa0db('0x3'));var userController=require(_0xa0db('0x4'));var authService=require(_0xa0db('0x5'));router[_0xa0db('0x6')]('/',controller[_0xa0db('0x7')]);router[_0xa0db('0x6')](_0xa0db('0x8'),controller[_0xa0db('0x9')],authService[_0xa0db('0xa')],userController['login'],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0x43f3=['passport','Router','../user/user.controller.js','get','/callback','callback','login','setTokenCookie','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x43f3,0xab));var _0x343f=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x43f3[_0x1969a7];return _0x3d665f;};'use strict';var express=require('express');var passport=require(_0x343f('0x0'));var router=express[_0x343f('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0x343f('0x2'));var authService=require('../../components/auth/service');router[_0x343f('0x3')]('/',controller['login']);router[_0x343f('0x3')](_0x343f('0x4'),controller[_0x343f('0x5')],authService['isMiddleware'],userController[_0x343f('0x6')],authService[_0x343f('0x7')]);module[_0x343f('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 0f7cc08..7136528 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 _0x7c09=['findOne','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','minutes','clearBlockUser','add','getLicense','catch','MailAccount','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','find','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','Reset\x20Email\x20sent!','reset','params','token','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','use','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils'];(function(_0x196c01,_0x978ece){var _0x478319=function(_0x1e50a2){while(--_0x1e50a2){_0x196c01['push'](_0x196c01['shift']());}};_0x478319(++_0x978ece);}(_0x7c09,0x102));var _0x97c0=function(_0x16014f,_0x4f5bc7){_0x16014f=_0x16014f-0x0;var _0x308d18=_0x7c09[_0x16014f];return _0x308d18;};'use strict';var util=require('util');var passport=require(_0x97c0('0x0'));var LocalStrategy=require(_0x97c0('0x1'))['Strategy'];var jayson=require(_0x97c0('0x2'));var _=require(_0x97c0('0x3'));var rs=require(_0x97c0('0x4'));var moment=require(_0x97c0('0x5'));var db=require(_0x97c0('0x6'))['db'];var authService=require(_0x97c0('0x7'));var utils=require(_0x97c0('0x8'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x590368,_0x46fdd9,_0x42c6c7,_0x2c19fa){var _0x109bc8,_0x293785;return db['Setting'][_0x97c0('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x97c0('0xa')],'raw':!![]})[_0x97c0('0xb')](function(_0x52bce2){_0x109bc8=_0x52bce2;return _0x590368['findOne']({'attributes':['id',_0x97c0('0xc'),_0x97c0('0xd'),_0x97c0('0xe'),_0x97c0('0xf'),_0x97c0('0x10'),_0x97c0('0x11'),_0x97c0('0x12'),_0x97c0('0x13')],'where':{'name':_0x46fdd9,'role':{'$or':[_0x97c0('0x14'),_0x97c0('0x15'),_0x97c0('0x16')]}}});})[_0x97c0('0xb')](function(_0x20acfa){if(!_0x20acfa||_0x20acfa&&_0x20acfa['name']!==_0x46fdd9){throw new Error(_0x97c0('0x17'));}else{_0x293785=_0x20acfa;return _0x293785;}})[_0x97c0('0xb')](function(){_0x293785[_0x97c0('0x18')](_0x42c6c7,function(_0x496017,_0x42027d){var _0x9ca6a8=_0x293785[_0x97c0('0x13')]+0x1;if(_0x496017){return _0x2c19fa(_0x496017);}else if(!_0x42027d){if(_0x293785[_0x97c0('0x10')]){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}else if(_0x109bc8[_0x97c0('0x19')]>0x0){if(_0x293785['blocked']){if(_0x109bc8[_0x97c0('0xa')]>0x0){if(moment(_0x293785[_0x97c0('0x12')])['add'](_0x109bc8[_0x97c0('0xa')],_0x97c0('0x1a'))>moment()){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}else{return utils[_0x97c0('0x1b')](_0x293785,_0x9ca6a8,![],null)[_0x97c0('0xb')](function(){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});});}}else{return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}}else{if(_0x9ca6a8>=_0x109bc8[_0x97c0('0x19')]){return utils[_0x97c0('0x1b')](_0x293785,0x0,!![],moment())[_0x97c0('0xb')](function(){return _0x2c19fa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x293785,_0x9ca6a8,![],null)[_0x97c0('0xb')](function(){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});});}}}else{return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}}else{if(_0x293785['disabled']){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}else if(_0x109bc8[_0x97c0('0x19')]>0x0){if(_0x293785[_0x97c0('0x11')]){if(_0x109bc8[_0x97c0('0xa')]>0x0){if(moment(_0x293785[_0x97c0('0x12')])[_0x97c0('0x1c')](_0x109bc8[_0x97c0('0xa')],'minutes')>moment()){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}else{return utils[_0x97c0('0x1b')](_0x293785,0x0,![],null)[_0x97c0('0xb')](function(){return utils[_0x97c0('0x1d')](_0x293785);})['then'](function(){return _0x2c19fa(null,_0x293785);});}}else{return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}}else{return utils[_0x97c0('0x1b')](_0x293785,0x0,![],null)['then'](function(){return utils[_0x97c0('0x1d')](_0x293785);})[_0x97c0('0xb')](function(){return _0x2c19fa(null,_0x293785);})[_0x97c0('0x1e')](function(_0x4af5a5){return _0x2c19fa(null,![],_0x4af5a5);});}}else{if(_0x293785['blocked']){return _0x2c19fa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x97c0('0x1d')](_0x293785)[_0x97c0('0xb')](function(){return _0x2c19fa(null,_0x293785);});}}}});})[_0x97c0('0x1e')](function(_0x225e43){return _0x2c19fa(null,![],_0x225e43);});}function sendServiceMail(_0x26939e){return db[_0x97c0('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x97c0('0xc'),_0x97c0('0x20')],'include':[{'model':db[_0x97c0('0x21')],'as':'Smtp'}]})[_0x97c0('0xb')](function(_0x148e95){if(!_0x148e95){throw new Error(_0x97c0('0x22'));}var _0x23d2af={'tls':{'rejectUnauthorized':![]}};if(_0x148e95[_0x97c0('0x23')]['service']){_0x23d2af['service']=_0x148e95[_0x97c0('0x23')][_0x97c0('0x24')];}else{_0x23d2af[_0x97c0('0x25')]=_0x148e95['Smtp'][_0x97c0('0x25')];_0x23d2af[_0x97c0('0x26')]=_0x148e95['Smtp'][_0x97c0('0x26')];_0x23d2af[_0x97c0('0x27')]=_0x148e95[_0x97c0('0x23')][_0x97c0('0x27')];}if(_0x148e95[_0x97c0('0x23')][_0x97c0('0x28')]){_0x23d2af[_0x97c0('0x29')]={'user':_0x148e95[_0x97c0('0x23')][_0x97c0('0x15')],'pass':_0x148e95[_0x97c0('0x23')][_0x97c0('0x2a')]};}var _0x356b73={'account':_0x23d2af,'message':_[_0x97c0('0x2b')]({'from':util[_0x97c0('0x2c')](_0x97c0('0x2d'),_0x148e95['name'],_0x148e95[_0x97c0('0x20')]||_0x148e95[_0x97c0('0x23')][_0x97c0('0x15')])},_0x26939e)};return client[_0x97c0('0x2e')](_0x97c0('0x2f'),_0x356b73);})[_0x97c0('0xb')](function(_0x40a780){if(_0x40a780[_0x97c0('0x30')]){throw new Error(util['format'](_0x97c0('0x31'),_0x40a780['error'][_0x97c0('0x32')]||JSON[_0x97c0('0x33')](_0x40a780[_0x97c0('0x30')])));}return!![];});}function handleError(_0x3988d3,_0x41e360,_0x2a613a){return _0x3988d3[_0x97c0('0x34')](_0x41e360||0x1f4)[_0x97c0('0x35')]({'message':_0x2a613a?_0x2a613a[_0x97c0('0x32')]||_0x2a613a:''});}exports[_0x97c0('0x36')]=function(_0x3f202d,_0x4a1dad,_0x3368d0){passport[_0x97c0('0x18')]('local',function(_0x137ee1,_0x477aae,_0x2aeffc){var _0x44dbe6=_0x137ee1||_0x2aeffc;if(_0x44dbe6){return handleError(_0x4a1dad,0x191,_0x44dbe6);}if(!_0x477aae){return handleError(_0x4a1dad,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x860e0c={'payload':{'id':_0x477aae['id'],'role':_0x477aae['role']},'options':{'expiresIn':0x15180}};return authService[_0x97c0('0x37')](_0x860e0c)[_0x97c0('0xb')](function(_0x5660b3){_0x4a1dad[_0x97c0('0x38')]({'id':_0x477aae['id'],'token':_0x5660b3,'statusCall':'','isAlreadyLogged':_0x477aae[_0x97c0('0x39')]});});}})(_0x3f202d,_0x4a1dad,_0x3368d0);};exports[_0x97c0('0x3a')]=function(_0xb13649,_0x33b034,_0x2121e8){if(!_0xb13649[_0x97c0('0x3b')][_0x97c0('0x20')]){return handleError(_0x33b034,0x1f4,{'message':_0x97c0('0x3c')});}var _0x2d4c25=rs[_0x97c0('0x3d')]();_0xb13649[_0x97c0('0x3b')][_0x97c0('0x20')]=_0xb13649['body'][_0x97c0('0x20')][_0x97c0('0x3e')]()[_0x97c0('0x3f')]();var _0x142421;return db[_0x97c0('0x40')][_0x97c0('0x9')]({'where':{'id':0x1},'attributes':[_0x97c0('0x19'),'blockDuration'],'raw':!![]})['then'](function(_0x10ee7b){_0x142421=_0x10ee7b;return db[_0x97c0('0x41')][_0x97c0('0x42')]({'where':{'email':_0xb13649[_0x97c0('0x3b')][_0x97c0('0x20')]}});})['then'](function(_0x5bcdc9){if(!_0x5bcdc9){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x5bcdc9[_0x97c0('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x5bcdc9['blocked']){if(moment(_0x5bcdc9[_0x97c0('0x12')])[_0x97c0('0x1c')](_0x142421[_0x97c0('0xa')],_0x97c0('0x1a'))>moment()){throw new Error(_0x97c0('0x43'));}else{_0x5bcdc9['blocked']=![];_0x5bcdc9[_0x97c0('0x12')]=null;}}_0x5bcdc9[_0x97c0('0x44')]=_0x2d4c25;_0x5bcdc9[_0x97c0('0x45')]=Date[_0x97c0('0x46')]()+0x36ee80;return _0x5bcdc9[_0x97c0('0x47')]();})[_0x97c0('0xb')](function(){return sendServiceMail({'to':_0xb13649[_0x97c0('0x3b')][_0x97c0('0x20')],'subject':_0x97c0('0x48'),'text':_0x97c0('0x49')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x97c0('0x4a')+_0xb13649[_0x97c0('0x4b')][_0x97c0('0x25')]+_0x97c0('0x4c')+_0x2d4c25+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x33b034[_0x97c0('0x34')](0xc8)[_0x97c0('0x35')]({'message':_0x97c0('0x4d')});})['catch'](function(_0x3e09d5){return handleError(_0x33b034,0x1f4,_0x3e09d5);});};exports[_0x97c0('0x4e')]=function(_0x240f68,_0x2fc02f,_0x122524){return db['User'][_0x97c0('0x42')]({'where':{'resetPasswordToken':_0x240f68[_0x97c0('0x4f')][_0x97c0('0x50')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x94ce89){if(!_0x94ce89){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x97c0('0x9')]({'attributes':['id',_0x97c0('0x51'),_0x97c0('0x52'),'passwordHistoryLimit']})['then'](function(_0x5190b0){if(_0x5190b0[_0x97c0('0x51')])authService[_0x97c0('0x53')](_0x240f68[_0x97c0('0x3b')][_0x97c0('0xd')]);if(!_0x5190b0[_0x97c0('0x52')]||!_0x94ce89[_0x97c0('0x54')])return _0x94ce89;authService[_0x97c0('0x55')](_0x240f68['body'][_0x97c0('0xd')],_0x94ce89[_0x97c0('0x54')],_0x5190b0[_0x97c0('0x56')]);return _0x94ce89;})[_0x97c0('0xb')](function(){_0x94ce89[_0x97c0('0xd')]=_0x240f68[_0x97c0('0x3b')]['password'];_0x94ce89[_0x97c0('0x44')]=null;_0x94ce89[_0x97c0('0x45')]=null;return _0x94ce89['save']();});})[_0x97c0('0xb')](function(){_0x2fc02f[_0x97c0('0x34')](0xc8)[_0x97c0('0x35')]({'message':_0x97c0('0x57')});})[_0x97c0('0x1e')](function(_0x18992d){return handleError(_0x2fc02f,0x1f4,_0x18992d);});};passport[_0x97c0('0x58')](new LocalStrategy({'usernameField':'name','passwordField':_0x97c0('0xd')},function(_0x14e93c,_0x3cb4c7,_0x1919f5){return localAuthenticate(db[_0x97c0('0x41')],_0x14e93c,_0x3cb4c7,_0x1919f5);})); \ No newline at end of file +var _0x11e5=['minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','securePassword','passwordHistoryLimit','validatePasswordPattern','previousPasswords','Password\x20reset!','use','util','passport-local','Strategy','lodash','randomstring','moment','../../components/auth/service','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blocked','clearBlockUser','add'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x11e5,0x8b));var _0x511e=function(_0x3f55de,_0x3ae98f){_0x3f55de=_0x3f55de-0x0;var _0x2698de=_0x11e5[_0x3f55de];return _0x2698de;};'use strict';var util=require(_0x511e('0x0'));var passport=require('passport');var LocalStrategy=require(_0x511e('0x1'))[_0x511e('0x2')];var jayson=require('jayson/promise');var _=require(_0x511e('0x3'));var rs=require(_0x511e('0x4'));var moment=require(_0x511e('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x511e('0x6'));var utils=require('../../config/utils');var client=jayson['client'][_0x511e('0x7')]({'port':0x232b});function localAuthenticate(_0x323f8c,_0x466dec,_0x57cac3,_0x47cf56){var _0x3ebc4b,_0xf0ba86;return db[_0x511e('0x8')][_0x511e('0x9')]({'where':{'id':0x1},'attributes':[_0x511e('0xa'),_0x511e('0xb')],'raw':!![]})[_0x511e('0xc')](function(_0x50564b){_0x3ebc4b=_0x50564b;return _0x323f8c[_0x511e('0x9')]({'attributes':['id',_0x511e('0xd'),_0x511e('0xe'),'salt',_0x511e('0xf'),'disabled','blocked',_0x511e('0x10'),_0x511e('0x11')],'where':{'name':_0x466dec,'role':{'$or':[_0x511e('0x12'),_0x511e('0x13'),_0x511e('0x14')]}}});})[_0x511e('0xc')](function(_0x4e72fd){if(!_0x4e72fd||_0x4e72fd&&_0x4e72fd[_0x511e('0xd')]!==_0x466dec){throw new Error(_0x511e('0x15'));}else{_0xf0ba86=_0x4e72fd;return _0xf0ba86;}})['then'](function(){_0xf0ba86[_0x511e('0x16')](_0x57cac3,function(_0x43a329,_0x4f50b9){var _0xed773e=_0xf0ba86[_0x511e('0x11')]+0x1;if(_0x43a329){return _0x47cf56(_0x43a329);}else if(!_0x4f50b9){if(_0xf0ba86[_0x511e('0x17')]){return _0x47cf56(null,![],{'message':_0x511e('0x15')});}else if(_0x3ebc4b['allowedLoginAttempts']>0x0){if(_0xf0ba86[_0x511e('0x18')]){if(_0x3ebc4b[_0x511e('0xb')]>0x0){if(moment(_0xf0ba86[_0x511e('0x10')])['add'](_0x3ebc4b[_0x511e('0xb')],'minutes')>moment()){return _0x47cf56(null,![],{'message':_0x511e('0x15')});}else{return utils['clearBlockUser'](_0xf0ba86,_0xed773e,![],null)['then'](function(){return _0x47cf56(null,![],{'message':_0x511e('0x15')});});}}else{return _0x47cf56(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xed773e>=_0x3ebc4b[_0x511e('0xa')]){return utils[_0x511e('0x19')](_0xf0ba86,0x0,!![],moment())[_0x511e('0xc')](function(){return _0x47cf56(null,![],{'message':_0x511e('0x15')});});}else{return utils[_0x511e('0x19')](_0xf0ba86,_0xed773e,![],null)[_0x511e('0xc')](function(){return _0x47cf56(null,![],{'message':_0x511e('0x15')});});}}}else{return _0x47cf56(null,![],{'message':_0x511e('0x15')});}}else{if(_0xf0ba86['disabled']){return _0x47cf56(null,![],{'message':_0x511e('0x15')});}else if(_0x3ebc4b[_0x511e('0xa')]>0x0){if(_0xf0ba86[_0x511e('0x18')]){if(_0x3ebc4b[_0x511e('0xb')]>0x0){if(moment(_0xf0ba86[_0x511e('0x10')])[_0x511e('0x1a')](_0x3ebc4b[_0x511e('0xb')],_0x511e('0x1b'))>moment()){return _0x47cf56(null,![],{'message':_0x511e('0x15')});}else{return utils[_0x511e('0x19')](_0xf0ba86,0x0,![],null)['then'](function(){return utils['getLicense'](_0xf0ba86);})[_0x511e('0xc')](function(){return _0x47cf56(null,_0xf0ba86);});}}else{return _0x47cf56(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x511e('0x19')](_0xf0ba86,0x0,![],null)['then'](function(){return utils[_0x511e('0x1c')](_0xf0ba86);})[_0x511e('0xc')](function(){return _0x47cf56(null,_0xf0ba86);})[_0x511e('0x1d')](function(_0x1f8040){return _0x47cf56(null,![],_0x1f8040);});}}else{if(_0xf0ba86[_0x511e('0x18')]){return _0x47cf56(null,![],{'message':_0x511e('0x15')});}else{return utils[_0x511e('0x1c')](_0xf0ba86)[_0x511e('0xc')](function(){return _0x47cf56(null,_0xf0ba86);});}}}});})[_0x511e('0x1d')](function(_0x2451c2){return _0x47cf56(null,![],_0x2451c2);});}function sendServiceMail(_0x5b72fe){return db[_0x511e('0x1e')][_0x511e('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x511e('0xd'),_0x511e('0x20')],'include':[{'model':db[_0x511e('0x21')],'as':'Smtp'}]})[_0x511e('0xc')](function(_0x4e157f){if(!_0x4e157f){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x262dde={'tls':{'rejectUnauthorized':![]}};if(_0x4e157f[_0x511e('0x22')][_0x511e('0x23')]){_0x262dde[_0x511e('0x23')]=_0x4e157f[_0x511e('0x22')]['service'];}else{_0x262dde[_0x511e('0x24')]=_0x4e157f[_0x511e('0x22')][_0x511e('0x24')];_0x262dde[_0x511e('0x25')]=_0x4e157f[_0x511e('0x22')]['port'];_0x262dde[_0x511e('0x26')]=_0x4e157f[_0x511e('0x22')][_0x511e('0x26')];}if(_0x4e157f[_0x511e('0x22')][_0x511e('0x27')]){_0x262dde[_0x511e('0x28')]={'user':_0x4e157f[_0x511e('0x22')][_0x511e('0x13')],'pass':_0x4e157f['Smtp'][_0x511e('0x29')]};}var _0x34f73e={'account':_0x262dde,'message':_[_0x511e('0x2a')]({'from':util[_0x511e('0x2b')]('\x22%s\x22\x20<%s>',_0x4e157f['name'],_0x4e157f[_0x511e('0x20')]||_0x4e157f['Smtp']['user'])},_0x5b72fe)};return client[_0x511e('0x2c')](_0x511e('0x2d'),_0x34f73e);})[_0x511e('0xc')](function(_0x30898a){if(_0x30898a[_0x511e('0x2e')]){throw new Error(util['format'](_0x511e('0x2f'),_0x30898a[_0x511e('0x2e')][_0x511e('0x30')]||JSON['stringify'](_0x30898a[_0x511e('0x2e')])));}return!![];});}function handleError(_0xbba7ce,_0x345ad3,_0x47938d){return _0xbba7ce[_0x511e('0x31')](_0x345ad3||0x1f4)[_0x511e('0x32')]({'message':_0x47938d?_0x47938d['message']||_0x47938d:''});}exports[_0x511e('0x33')]=function(_0xff2428,_0x2b6065,_0x229972){passport[_0x511e('0x16')](_0x511e('0x34'),function(_0x2032dd,_0x8cc26e,_0xde4b8){var _0x217feb=_0x2032dd||_0xde4b8;if(_0x217feb){return handleError(_0x2b6065,0x191,_0x217feb);}if(!_0x8cc26e){return handleError(_0x2b6065,0x194,{'message':_0x511e('0x35')});}else{var _0x4f1f1d={'payload':{'id':_0x8cc26e['id'],'role':_0x8cc26e[_0x511e('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4f1f1d)['then'](function(_0xd31415){_0x2b6065['json']({'id':_0x8cc26e['id'],'token':_0xd31415,'statusCall':'','isAlreadyLogged':_0x8cc26e['online']});});}})(_0xff2428,_0x2b6065,_0x229972);};exports[_0x511e('0x36')]=function(_0x200207,_0x3c0ef4,_0x3d1e9d){if(!_0x200207[_0x511e('0x37')][_0x511e('0x20')]){return handleError(_0x3c0ef4,0x1f4,{'message':_0x511e('0x38')});}var _0x27a78a=rs[_0x511e('0x39')]();_0x200207[_0x511e('0x37')][_0x511e('0x20')]=_0x200207[_0x511e('0x37')][_0x511e('0x20')][_0x511e('0x3a')]()['toLowerCase']();var _0x5a7a12;return db[_0x511e('0x8')][_0x511e('0x9')]({'where':{'id':0x1},'attributes':[_0x511e('0xa'),_0x511e('0xb')],'raw':!![]})[_0x511e('0xc')](function(_0x512f70){_0x5a7a12=_0x512f70;return db[_0x511e('0x3b')][_0x511e('0x1f')]({'where':{'email':_0x200207[_0x511e('0x37')]['email']}});})['then'](function(_0x55c20d){if(!_0x55c20d){throw new Error(_0x511e('0x3c'));}if(_0x55c20d[_0x511e('0x17')]){throw new Error(_0x511e('0x3d'));}if(_0x55c20d['blocked']){if(moment(_0x55c20d['blockedAt'])['add'](_0x5a7a12[_0x511e('0xb')],_0x511e('0x1b'))>moment()){throw new Error(_0x511e('0x3e'));}else{_0x55c20d[_0x511e('0x18')]=![];_0x55c20d[_0x511e('0x10')]=null;}}_0x55c20d[_0x511e('0x3f')]=_0x27a78a;_0x55c20d[_0x511e('0x40')]=Date[_0x511e('0x41')]()+0x36ee80;return _0x55c20d[_0x511e('0x42')]();})[_0x511e('0xc')](function(){return sendServiceMail({'to':_0x200207[_0x511e('0x37')][_0x511e('0x20')],'subject':_0x511e('0x43'),'text':_0x511e('0x44')+_0x511e('0x45')+_0x511e('0x46')+_0x200207[_0x511e('0x47')][_0x511e('0x24')]+_0x511e('0x48')+_0x27a78a+'\x0a\x0a'+_0x511e('0x49')});})[_0x511e('0xc')](function(){_0x3c0ef4[_0x511e('0x31')](0xc8)[_0x511e('0x32')]({'message':_0x511e('0x4a')});})[_0x511e('0x1d')](function(_0x4096c0){return handleError(_0x3c0ef4,0x1f4,_0x4096c0);});};exports[_0x511e('0x4b')]=function(_0x31e949,_0x3a4ad1,_0x1f11ad){return db[_0x511e('0x3b')]['find']({'where':{'resetPasswordToken':_0x31e949[_0x511e('0x4c')]['token'],'resetPasswordExpires':{'$gt':Date[_0x511e('0x41')]()}}})[_0x511e('0xc')](function(_0x169a4d){if(!_0x169a4d){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x511e('0x8')][_0x511e('0x9')]({'attributes':['id',_0x511e('0x4d'),'enforcePasswordHistory',_0x511e('0x4e')]})[_0x511e('0xc')](function(_0x4a8e96){if(_0x4a8e96[_0x511e('0x4d')])authService[_0x511e('0x4f')](_0x31e949[_0x511e('0x37')][_0x511e('0xe')]);if(!_0x4a8e96['enforcePasswordHistory']||!_0x169a4d[_0x511e('0x50')])return _0x169a4d;authService['validatePasswordHistory'](_0x31e949[_0x511e('0x37')][_0x511e('0xe')],_0x169a4d[_0x511e('0x50')],_0x4a8e96['passwordHistoryLimit']);return _0x169a4d;})[_0x511e('0xc')](function(){_0x169a4d['password']=_0x31e949[_0x511e('0x37')][_0x511e('0xe')];_0x169a4d[_0x511e('0x3f')]=null;_0x169a4d[_0x511e('0x40')]=null;return _0x169a4d[_0x511e('0x42')]();});})['then'](function(){_0x3a4ad1[_0x511e('0x31')](0xc8)[_0x511e('0x32')]({'message':_0x511e('0x51')});})[_0x511e('0x1d')](function(_0x1d8688){return handleError(_0x3a4ad1,0x1f4,_0x1d8688);});};passport[_0x511e('0x52')](new LocalStrategy({'usernameField':_0x511e('0xd'),'passwordField':_0x511e('0xe')},function(_0x4b66a5,_0x3f780c,_0x2eb672){return localAuthenticate(db['User'],_0x4b66a5,_0x3f780c,_0x2eb672);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 78493d2..ef40128 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 _0x6a8a=['/reset/:token','reset','express','Router','post','login','/forgot'];(function(_0x40fcda,_0x2e8598){var _0x38e739=function(_0x16d71a){while(--_0x16d71a){_0x40fcda['push'](_0x40fcda['shift']());}};_0x38e739(++_0x2e8598);}(_0x6a8a,0x72));var _0xa6a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a8a[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xa6a8('0x0'));var router=express[_0xa6a8('0x1')]();var controller=require('./authLocal.controller');router[_0xa6a8('0x2')]('/',controller[_0xa6a8('0x3')]);router[_0xa6a8('0x2')](_0xa6a8('0x4'),controller['forgot']);router[_0xa6a8('0x2')](_0xa6a8('0x5'),controller[_0xa6a8('0x6')]);module['exports']=router; \ No newline at end of file +var _0xd1cd=['./authLocal.controller','post','/forgot','forgot','/reset/:token','reset','exports','express','Router'];(function(_0x2a2137,_0x280212){var _0x466f22=function(_0x233867){while(--_0x233867){_0x2a2137['push'](_0x2a2137['shift']());}};_0x466f22(++_0x280212);}(_0xd1cd,0x127));var _0xdd1c=function(_0x165873,_0x3f44af){_0x165873=_0x165873-0x0;var _0x19312d=_0xd1cd[_0x165873];return _0x19312d;};'use strict';var express=require(_0xdd1c('0x0'));var router=express[_0xdd1c('0x1')]();var controller=require(_0xdd1c('0x2'));router['post']('/',controller['login']);router[_0xdd1c('0x3')](_0xdd1c('0x4'),controller[_0xdd1c('0x5')]);router[_0xdd1c('0x3')](_0xdd1c('0x6'),controller[_0xdd1c('0x7')]);module[_0xdd1c('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e505aae..30db66b 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 _0x222c=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x1f3fd8,_0x330562){var _0x2d9d33=function(_0x34061f){while(--_0x34061f){_0x1f3fd8['push'](_0x1f3fd8['shift']());}};_0x2d9d33(++_0x330562);}(_0x222c,0x1d6));var _0xc222=function(_0x1666c7,_0x54bb9a){_0x1666c7=_0x1666c7-0x0;var _0x341d90=_0x222c[_0x1666c7];return _0x341d90;};'use strict';var Sequelize=require(_0xc222('0x0'));module[_0xc222('0x1')]={'name':{'type':Sequelize[_0xc222('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xc222('0x2')]},'description':{'type':Sequelize[_0xc222('0x2')]},'status':{'type':Sequelize[_0xc222('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xc222('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x9c98=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0x9c98,0x136));var _0x89c9=function(_0xcaa349,_0x535468){_0xcaa349=_0xcaa349-0x0;var _0x239628=_0x9c98[_0xcaa349];return _0x239628;};'use strict';var Sequelize=require(_0x89c9('0x0'));module[_0x89c9('0x1')]={'name':{'type':Sequelize[_0x89c9('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x89c9('0x2')]},'description':{'type':Sequelize[_0x89c9('0x2')]},'status':{'type':Sequelize[_0x89c9('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x89c9('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 10b3a87..cf10cd5 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 _0x6afd=['Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','VIRTUAL','options','include','findAll','catch','show','params','includeAll','merge','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','order','addActions','Action','getActions','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset'];(function(_0x464f98,_0x3d69cb){var _0x4604cd=function(_0x392a79){while(--_0x392a79){_0x464f98['push'](_0x464f98['shift']());}};_0x4604cd(++_0x3d69cb);}(_0x6afd,0xe3));var _0xd6af=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x6afd[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd6af('0x0'));var rimraf=require(_0xd6af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd6af('0x2'));var moment=require(_0xd6af('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd6af('0x4'));var path=require(_0xd6af('0x5'));var sox=require(_0xd6af('0x6'));var csv=require(_0xd6af('0x7'));var ejs=require(_0xd6af('0x8'));var fs=require('fs');var fs_extra=require(_0xd6af('0x9'));var _=require('lodash');var squel=require(_0xd6af('0xa'));var crypto=require(_0xd6af('0xb'));var jsforce=require(_0xd6af('0xc'));var deskjs=require(_0xd6af('0xd'));var toCsv=require(_0xd6af('0x7'));var querystring=require(_0xd6af('0xe'));var Papa=require(_0xd6af('0xf'));var Redis=require(_0xd6af('0x10'));var authService=require(_0xd6af('0x11'));var qs=require(_0xd6af('0x12'));var as=require(_0xd6af('0x13'));var hardwareService=require(_0xd6af('0x14'));var logger=require(_0xd6af('0x15'))(_0xd6af('0x16'));var utils=require(_0xd6af('0x17'));var config=require(_0xd6af('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6af('0x19'))['db'];function respondWithStatusCode(_0x5579e6,_0x8d9ec){_0x8d9ec=_0x8d9ec||0xcc;return function(_0x50f3e9){if(_0x50f3e9){return _0x5579e6['sendStatus'](_0x8d9ec);}return _0x5579e6[_0xd6af('0x1a')](_0x8d9ec)[_0xd6af('0x1b')]();};}function respondWithResult(_0x5dd09d,_0x29f685){_0x29f685=_0x29f685||0xc8;return function(_0x4c6f24){if(_0x4c6f24){return _0x5dd09d['status'](_0x29f685)[_0xd6af('0x1c')](_0x4c6f24);}};}function respondWithFilteredResult(_0x28ec5f,_0x431398){return function(_0x8a1895){if(_0x8a1895){var _0x5e4e9a=_0x8a1895[_0xd6af('0x1d')],_0x272ce8=_0x431398[_0xd6af('0x1e')],_0xdc5188=_0x431398['offset']+_0x431398['limit'],_0x595ee1;if(_0xdc5188>=_0x5e4e9a){_0xdc5188=_0x5e4e9a;_0x595ee1=0xc8;}else{_0x595ee1=0xce;}_0x28ec5f[_0xd6af('0x1a')](_0x595ee1);return _0x28ec5f['set'](_0xd6af('0x1f'),_0x272ce8+'-'+_0xdc5188+'/'+_0x5e4e9a)['json'](_0x8a1895);}return null;};}function patchUpdates(_0x1abaad){return function(_0x2298c4){try{jsonpatch['apply'](_0x2298c4,_0x1abaad,!![]);}catch(_0x486238){return BPromise[_0xd6af('0x20')](_0x486238);}return _0x2298c4[_0xd6af('0x21')]();};}function saveUpdates(_0x1d52fb,_0xbba7e5){return function(_0x586c04){if(_0x586c04){return _0x586c04[_0xd6af('0x22')](_0x1d52fb)[_0xd6af('0x23')](function(_0x2faae8){return _0x2faae8;});}return null;};}function removeEntity(_0x2a864c,_0x386da2){return function(_0x438d98){if(_0x438d98){return _0x438d98[_0xd6af('0x24')]()[_0xd6af('0x23')](function(){_0x2a864c[_0xd6af('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49fe33,_0x56b389){return function(_0x36ac94){if(!_0x36ac94){_0x49fe33[_0xd6af('0x25')](0x194);}return _0x36ac94;};}function handleError(_0x1b8b69,_0x255584){_0x255584=_0x255584||0x1f4;return function(_0x53c1d3){logger[_0xd6af('0x26')](_0x53c1d3[_0xd6af('0x27')]);if(_0x53c1d3['name']){delete _0x53c1d3[_0xd6af('0x28')];}_0x1b8b69[_0xd6af('0x1a')](_0x255584)[_0xd6af('0x29')](_0x53c1d3);};}exports[_0xd6af('0x2a')]=function(_0x80473c,_0x55fec1){var _0x5733cf={},_0x5115db={},_0x307056={'count':0x0,'rows':[]};var _0x501ded=_[_0xd6af('0x2b')](db[_0xd6af('0x2c')][_0xd6af('0x2d')],function(_0x518077){return{'name':_0x518077[_0xd6af('0x2e')],'type':_0x518077[_0xd6af('0x2f')][_0xd6af('0x30')]};});_0x5115db[_0xd6af('0x31')]=_[_0xd6af('0x2b')](_0x501ded,_0xd6af('0x28'));_0x5115db[_0xd6af('0x32')]=_[_0xd6af('0x33')](_0x80473c['query']);_0x5115db[_0xd6af('0x34')]=_[_0xd6af('0x35')](_0x5115db[_0xd6af('0x31')],_0x5115db[_0xd6af('0x32')]);_0x5733cf[_0xd6af('0x36')]=_['intersection'](_0x5115db[_0xd6af('0x31')],qs['fields'](_0x80473c[_0xd6af('0x32')][_0xd6af('0x37')]));_0x5733cf[_0xd6af('0x36')]=_0x5733cf[_0xd6af('0x36')][_0xd6af('0x38')]?_0x5733cf[_0xd6af('0x36')]:_0x5115db['model'];if(!_0x80473c[_0xd6af('0x32')][_0xd6af('0x39')](_0xd6af('0x3a'))){_0x5733cf['limit']=qs[_0xd6af('0x3b')](_0x80473c[_0xd6af('0x32')][_0xd6af('0x3b')]);_0x5733cf[_0xd6af('0x1e')]=qs[_0xd6af('0x1e')](_0x80473c[_0xd6af('0x32')]['offset']);}_0x5733cf['order']=qs[_0xd6af('0x3c')](_0x80473c[_0xd6af('0x32')][_0xd6af('0x3c')]);_0x5733cf['where']=qs['filters'](_[_0xd6af('0x3d')](_0x80473c[_0xd6af('0x32')],_0x5115db[_0xd6af('0x34')]),_0x501ded);if(_0x80473c[_0xd6af('0x32')][_0xd6af('0x3e')]){_0x5733cf['where']=_['merge'](_0x5733cf[_0xd6af('0x3f')],{'$or':_[_0xd6af('0x2b')](_0x501ded,function(_0x35834e){if(_0x35834e['type']!==_0xd6af('0x40')){var _0x4b7fd9={};_0x4b7fd9[_0x35834e[_0xd6af('0x28')]]={'$like':'%'+_0x80473c['query'][_0xd6af('0x3e')]+'%'};return _0x4b7fd9;}})});}_0x5733cf=_['merge']({},_0x5733cf,_0x80473c[_0xd6af('0x41')]);var _0x24f2bd={'where':_0x5733cf[_0xd6af('0x3f')]};return db['Automation'][_0xd6af('0x1d')](_0x24f2bd)[_0xd6af('0x23')](function(_0x4d3938){_0x307056[_0xd6af('0x1d')]=_0x4d3938;if(_0x80473c[_0xd6af('0x32')]['includeAll']){_0x5733cf[_0xd6af('0x42')]=[{'all':!![]}];}return db[_0xd6af('0x2c')][_0xd6af('0x43')](_0x5733cf);})['then'](function(_0xa888d8){_0x307056['rows']=_0xa888d8;return _0x307056;})[_0xd6af('0x23')](respondWithFilteredResult(_0x55fec1,_0x5733cf))[_0xd6af('0x44')](handleError(_0x55fec1,null));};exports[_0xd6af('0x45')]=function(_0x7e8dad,_0x32d9f7){var _0x5b15de={'raw':![],'where':{'id':_0x7e8dad[_0xd6af('0x46')]['id']}},_0x4a779a={};_0x4a779a[_0xd6af('0x31')]=_[_0xd6af('0x33')](db[_0xd6af('0x2c')]['rawAttributes']);_0x4a779a[_0xd6af('0x32')]=_[_0xd6af('0x33')](_0x7e8dad['query']);_0x4a779a[_0xd6af('0x34')]=_[_0xd6af('0x35')](_0x4a779a['model'],_0x4a779a[_0xd6af('0x32')]);_0x5b15de['attributes']=_[_0xd6af('0x35')](_0x4a779a[_0xd6af('0x31')],qs[_0xd6af('0x37')](_0x7e8dad[_0xd6af('0x32')][_0xd6af('0x37')]));_0x5b15de[_0xd6af('0x36')]=_0x5b15de[_0xd6af('0x36')]['length']?_0x5b15de[_0xd6af('0x36')]:_0x4a779a[_0xd6af('0x31')];if(_0x7e8dad[_0xd6af('0x32')][_0xd6af('0x47')]){_0x5b15de['include']=[{'all':!![]}];}_0x5b15de=_[_0xd6af('0x48')]({},_0x5b15de,_0x7e8dad[_0xd6af('0x41')]);return db[_0xd6af('0x2c')][_0xd6af('0x49')](_0x5b15de)[_0xd6af('0x23')](handleEntityNotFound(_0x32d9f7,null))['then'](respondWithResult(_0x32d9f7,null))[_0xd6af('0x44')](handleError(_0x32d9f7,null));};exports[_0xd6af('0x4a')]=function(_0x3c027a,_0xecdf66){return db[_0xd6af('0x2c')][_0xd6af('0x4a')](_0x3c027a[_0xd6af('0x4b')],{})[_0xd6af('0x23')](respondWithResult(_0xecdf66,0xc9))[_0xd6af('0x44')](handleError(_0xecdf66,null));};exports[_0xd6af('0x22')]=function(_0x2443ae,_0x32d88d){if(_0x2443ae[_0xd6af('0x4b')]['id']){delete _0x2443ae[_0xd6af('0x4b')]['id'];}return db[_0xd6af('0x2c')][_0xd6af('0x49')]({'where':{'id':_0x2443ae[_0xd6af('0x46')]['id']}})[_0xd6af('0x23')](handleEntityNotFound(_0x32d88d,null))[_0xd6af('0x23')](saveUpdates(_0x2443ae[_0xd6af('0x4b')],null))['then'](respondWithResult(_0x32d88d,null))['catch'](handleError(_0x32d88d,null));};exports['destroy']=function(_0x5f31d3,_0x3ee435){return db['Automation']['find']({'where':{'id':_0x5f31d3[_0xd6af('0x46')]['id']}})[_0xd6af('0x23')](handleEntityNotFound(_0x3ee435,null))['then'](removeEntity(_0x3ee435,null))['catch'](handleError(_0x3ee435,null));};exports[_0xd6af('0x4c')]=function(_0x7e72f0,_0x3db635,_0x4baee8){return db[_0xd6af('0x4d')][_0xd6af('0x49')]({'where':{'id':_0x7e72f0[_0xd6af('0x46')]['id']}})[_0xd6af('0x23')](handleEntityNotFound(_0x3db635,null))[_0xd6af('0x23')](function(_0x5116f1){if(_0x5116f1){return _0x5116f1[_0xd6af('0x4c')](_0x7e72f0[_0xd6af('0x4b')][_0xd6af('0x4e')],_[_0xd6af('0x4f')](_0x7e72f0[_0xd6af('0x4b')],[_0xd6af('0x4e'),'id'])||{});}})[_0xd6af('0x23')](respondWithResult(_0x3db635,null))[_0xd6af('0x44')](handleError(_0x3db635,null));};exports[_0xd6af('0x50')]=function(_0x20d84f,_0x2b2971,_0x27457f){var _0x487d17={};var _0x3e3572={};var _0x53dad8;var _0x5e82f4;return db[_0xd6af('0x2c')][_0xd6af('0x51')]({'where':{'id':_0x20d84f['params']['id']}})[_0xd6af('0x23')](handleEntityNotFound(_0x2b2971,null))[_0xd6af('0x23')](function(_0x4a6911){if(_0x4a6911){_0x53dad8=_0x4a6911;_0x3e3572[_0xd6af('0x31')]=_[_0xd6af('0x33')](db[_0xd6af('0x4d')][_0xd6af('0x2d')]);_0x3e3572[_0xd6af('0x32')]=_[_0xd6af('0x33')](_0x20d84f[_0xd6af('0x32')]);_0x3e3572[_0xd6af('0x34')]=_[_0xd6af('0x35')](_0x3e3572[_0xd6af('0x31')],_0x3e3572[_0xd6af('0x32')]);_0x487d17[_0xd6af('0x36')]=_[_0xd6af('0x35')](_0x3e3572[_0xd6af('0x31')],qs[_0xd6af('0x37')](_0x20d84f[_0xd6af('0x32')][_0xd6af('0x37')]));_0x487d17[_0xd6af('0x36')]=_0x487d17[_0xd6af('0x36')][_0xd6af('0x38')]?_0x487d17[_0xd6af('0x36')]:_0x3e3572[_0xd6af('0x31')];_0x487d17[_0xd6af('0x52')]=qs[_0xd6af('0x3c')](_0x20d84f[_0xd6af('0x32')][_0xd6af('0x3c')]);_0x487d17[_0xd6af('0x3f')]=qs[_0xd6af('0x34')](_[_0xd6af('0x3d')](_0x20d84f[_0xd6af('0x32')],_0x3e3572[_0xd6af('0x34')]));if(_0x20d84f[_0xd6af('0x32')][_0xd6af('0x3e')]){_0x487d17[_0xd6af('0x3f')]=_['merge'](_0x487d17['where'],{'$or':_[_0xd6af('0x2b')](_0x487d17[_0xd6af('0x36')],function(_0x19f82a){var _0x1c3ad5={};_0x1c3ad5[_0x19f82a]={'$like':'%'+_0x20d84f[_0xd6af('0x32')][_0xd6af('0x3e')]+'%'};return _0x1c3ad5;})});}_0x487d17=_[_0xd6af('0x48')]({},_0x487d17,_0x20d84f[_0xd6af('0x41')]);return _0x53dad8[_0xd6af('0x50')](_0x487d17);}})['then'](function(_0x1a702f){if(_0x1a702f){_0x5e82f4=_0x1a702f['length'];if(!_0x20d84f[_0xd6af('0x32')]['hasOwnProperty'](_0xd6af('0x3a'))){_0x487d17[_0xd6af('0x3b')]=qs[_0xd6af('0x3b')](_0x20d84f['query']['limit']);_0x487d17[_0xd6af('0x1e')]=qs['offset'](_0x20d84f[_0xd6af('0x32')]['offset']);}return _0x53dad8['getConditions'](_0x487d17);}})[_0xd6af('0x23')](function(_0x21f776){if(_0x21f776){return _0x21f776?{'count':_0x5e82f4,'rows':_0x21f776}:null;}})[_0xd6af('0x23')](respondWithResult(_0x2b2971,null))[_0xd6af('0x44')](handleError(_0x2b2971,null));};exports[_0xd6af('0x53')]=function(_0x5a3071,_0xc257d4,_0x1fcd9d){return db[_0xd6af('0x54')][_0xd6af('0x49')]({'where':{'id':_0x5a3071[_0xd6af('0x46')]['id']}})['then'](handleEntityNotFound(_0xc257d4,null))['then'](function(_0x3430f9){if(_0x3430f9){return _0x3430f9[_0xd6af('0x53')](_0x5a3071[_0xd6af('0x4b')][_0xd6af('0x4e')],_['omit'](_0x5a3071[_0xd6af('0x4b')],[_0xd6af('0x4e'),'id'])||{});}})[_0xd6af('0x23')](respondWithResult(_0xc257d4,null))[_0xd6af('0x44')](handleError(_0xc257d4,null));};exports[_0xd6af('0x55')]=function(_0x5dfdeb,_0x34ddf7,_0x8048a8){var _0xf9b84f={};var _0x5c677c={};var _0x134e7e;var _0x54b104;return db['Automation'][_0xd6af('0x51')]({'where':{'id':_0x5dfdeb[_0xd6af('0x46')]['id']}})['then'](handleEntityNotFound(_0x34ddf7,null))[_0xd6af('0x23')](function(_0x371dbc){if(_0x371dbc){_0x134e7e=_0x371dbc;_0x5c677c[_0xd6af('0x31')]=_['keys'](db[_0xd6af('0x54')][_0xd6af('0x2d')]);_0x5c677c[_0xd6af('0x32')]=_[_0xd6af('0x33')](_0x5dfdeb[_0xd6af('0x32')]);_0x5c677c['filters']=_[_0xd6af('0x35')](_0x5c677c[_0xd6af('0x31')],_0x5c677c['query']);_0xf9b84f[_0xd6af('0x36')]=_[_0xd6af('0x35')](_0x5c677c[_0xd6af('0x31')],qs[_0xd6af('0x37')](_0x5dfdeb[_0xd6af('0x32')][_0xd6af('0x37')]));_0xf9b84f['attributes']=_0xf9b84f[_0xd6af('0x36')][_0xd6af('0x38')]?_0xf9b84f['attributes']:_0x5c677c[_0xd6af('0x31')];_0xf9b84f[_0xd6af('0x52')]=qs[_0xd6af('0x3c')](_0x5dfdeb[_0xd6af('0x32')]['sort']);_0xf9b84f['where']=qs[_0xd6af('0x34')](_[_0xd6af('0x3d')](_0x5dfdeb[_0xd6af('0x32')],_0x5c677c['filters']));if(_0x5dfdeb[_0xd6af('0x32')][_0xd6af('0x3e')]){_0xf9b84f[_0xd6af('0x3f')]=_['merge'](_0xf9b84f[_0xd6af('0x3f')],{'$or':_[_0xd6af('0x2b')](_0xf9b84f[_0xd6af('0x36')],function(_0x47008d){var _0x238f6d={};_0x238f6d[_0x47008d]={'$like':'%'+_0x5dfdeb[_0xd6af('0x32')][_0xd6af('0x3e')]+'%'};return _0x238f6d;})});}_0xf9b84f=_[_0xd6af('0x48')]({},_0xf9b84f,_0x5dfdeb['options']);return _0x134e7e[_0xd6af('0x55')](_0xf9b84f);}})[_0xd6af('0x23')](function(_0x3a027f){if(_0x3a027f){_0x54b104=_0x3a027f[_0xd6af('0x38')];if(!_0x5dfdeb[_0xd6af('0x32')][_0xd6af('0x39')]('nolimit')){_0xf9b84f[_0xd6af('0x3b')]=qs[_0xd6af('0x3b')](_0x5dfdeb[_0xd6af('0x32')][_0xd6af('0x3b')]);_0xf9b84f[_0xd6af('0x1e')]=qs[_0xd6af('0x1e')](_0x5dfdeb[_0xd6af('0x32')][_0xd6af('0x1e')]);}return _0x134e7e['getActions'](_0xf9b84f);}})['then'](function(_0x2cf0b1){if(_0x2cf0b1){return _0x2cf0b1?{'count':_0x54b104,'rows':_0x2cf0b1}:null;}})[_0xd6af('0x23')](respondWithResult(_0x34ddf7,null))['catch'](handleError(_0x34ddf7,null));}; \ No newline at end of file +var _0xcac2=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','addConditions','ids','omit','findOne','Condition','getConditions','nolimit','addActions','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status'];(function(_0x9528f5,_0x21156b){var _0x194bd7=function(_0xb9f796){while(--_0xb9f796){_0x9528f5['push'](_0x9528f5['shift']());}};_0x194bd7(++_0x21156b);}(_0xcac2,0x8e));var _0x2cac=function(_0x3e73f5,_0xce0766){_0x3e73f5=_0x3e73f5-0x0;var _0x3c5c06=_0xcac2[_0x3e73f5];return _0x3c5c06;};'use strict';var pdf=require(_0x2cac('0x0'));var emlformat=require(_0x2cac('0x1'));var rimraf=require(_0x2cac('0x2'));var zipdir=require(_0x2cac('0x3'));var jsonpatch=require(_0x2cac('0x4'));var rp=require('request-promise');var moment=require(_0x2cac('0x5'));var BPromise=require(_0x2cac('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2cac('0x7'));var sox=require('sox');var csv=require(_0x2cac('0x8'));var ejs=require(_0x2cac('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cac('0xa'));var squel=require(_0x2cac('0xb'));var crypto=require(_0x2cac('0xc'));var jsforce=require(_0x2cac('0xd'));var deskjs=require(_0x2cac('0xe'));var toCsv=require(_0x2cac('0x8'));var querystring=require(_0x2cac('0xf'));var Papa=require(_0x2cac('0x10'));var Redis=require(_0x2cac('0x11'));var authService=require(_0x2cac('0x12'));var qs=require(_0x2cac('0x13'));var as=require(_0x2cac('0x14'));var hardwareService=require(_0x2cac('0x15'));var logger=require('../../config/logger')(_0x2cac('0x16'));var utils=require('../../config/utils');var config=require(_0x2cac('0x17'));var licenseUtil=require(_0x2cac('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x227777,_0x37bc08){_0x37bc08=_0x37bc08||0xcc;return function(_0x4b686c){if(_0x4b686c){return _0x227777[_0x2cac('0x19')](_0x37bc08);}return _0x227777['status'](_0x37bc08)[_0x2cac('0x1a')]();};}function respondWithResult(_0x18c78e,_0x1aabad){_0x1aabad=_0x1aabad||0xc8;return function(_0x412173){if(_0x412173){return _0x18c78e[_0x2cac('0x1b')](_0x1aabad)[_0x2cac('0x1c')](_0x412173);}};}function respondWithFilteredResult(_0x15e870,_0x5ebb14){return function(_0x2fecd5){if(_0x2fecd5){var _0x1d0b93=_0x2fecd5[_0x2cac('0x1d')],_0x1d03fe=_0x5ebb14[_0x2cac('0x1e')],_0x20f6f4=_0x5ebb14[_0x2cac('0x1e')]+_0x5ebb14[_0x2cac('0x1f')],_0x4f1c9c;if(_0x20f6f4>=_0x1d0b93){_0x20f6f4=_0x1d0b93;_0x4f1c9c=0xc8;}else{_0x4f1c9c=0xce;}_0x15e870[_0x2cac('0x1b')](_0x4f1c9c);return _0x15e870[_0x2cac('0x20')](_0x2cac('0x21'),_0x1d03fe+'-'+_0x20f6f4+'/'+_0x1d0b93)['json'](_0x2fecd5);}return null;};}function patchUpdates(_0x892d4b){return function(_0xeed072){try{jsonpatch[_0x2cac('0x22')](_0xeed072,_0x892d4b,!![]);}catch(_0x21de8a){return BPromise[_0x2cac('0x23')](_0x21de8a);}return _0xeed072[_0x2cac('0x24')]();};}function saveUpdates(_0x2e41f8,_0x4c1806){return function(_0x94c47f){if(_0x94c47f){return _0x94c47f[_0x2cac('0x25')](_0x2e41f8)[_0x2cac('0x26')](function(_0x29d56a){return _0x29d56a;});}return null;};}function removeEntity(_0x2ceedc,_0x3a8297){return function(_0x346003){if(_0x346003){return _0x346003[_0x2cac('0x27')]()[_0x2cac('0x26')](function(){_0x2ceedc[_0x2cac('0x1b')](0xcc)[_0x2cac('0x1a')]();});}};}function handleEntityNotFound(_0x413099,_0x19790e){return function(_0x58f3eb){if(!_0x58f3eb){_0x413099['sendStatus'](0x194);}return _0x58f3eb;};}function handleError(_0x161d92,_0x5c8a0b){_0x5c8a0b=_0x5c8a0b||0x1f4;return function(_0x548f7f){logger[_0x2cac('0x28')](_0x548f7f[_0x2cac('0x29')]);if(_0x548f7f['name']){delete _0x548f7f[_0x2cac('0x2a')];}_0x161d92[_0x2cac('0x1b')](_0x5c8a0b)['send'](_0x548f7f);};}exports['index']=function(_0x181f35,_0x1b9456){var _0x457186={},_0x2940bc={},_0x32c44c={'count':0x0,'rows':[]};var _0x3f7e3a=_[_0x2cac('0x2b')](db[_0x2cac('0x2c')][_0x2cac('0x2d')],function(_0x5443ba){return{'name':_0x5443ba[_0x2cac('0x2e')],'type':_0x5443ba[_0x2cac('0x2f')][_0x2cac('0x30')]};});_0x2940bc[_0x2cac('0x31')]=_[_0x2cac('0x2b')](_0x3f7e3a,_0x2cac('0x2a'));_0x2940bc[_0x2cac('0x32')]=_[_0x2cac('0x33')](_0x181f35[_0x2cac('0x32')]);_0x2940bc['filters']=_[_0x2cac('0x34')](_0x2940bc[_0x2cac('0x31')],_0x2940bc['query']);_0x457186[_0x2cac('0x35')]=_[_0x2cac('0x34')](_0x2940bc[_0x2cac('0x31')],qs[_0x2cac('0x36')](_0x181f35[_0x2cac('0x32')][_0x2cac('0x36')]));_0x457186[_0x2cac('0x35')]=_0x457186[_0x2cac('0x35')][_0x2cac('0x37')]?_0x457186[_0x2cac('0x35')]:_0x2940bc['model'];if(!_0x181f35[_0x2cac('0x32')][_0x2cac('0x38')]('nolimit')){_0x457186[_0x2cac('0x1f')]=qs[_0x2cac('0x1f')](_0x181f35[_0x2cac('0x32')]['limit']);_0x457186[_0x2cac('0x1e')]=qs[_0x2cac('0x1e')](_0x181f35[_0x2cac('0x32')][_0x2cac('0x1e')]);}_0x457186[_0x2cac('0x39')]=qs[_0x2cac('0x3a')](_0x181f35[_0x2cac('0x32')][_0x2cac('0x3a')]);_0x457186[_0x2cac('0x3b')]=qs[_0x2cac('0x3c')](_[_0x2cac('0x3d')](_0x181f35[_0x2cac('0x32')],_0x2940bc[_0x2cac('0x3c')]),_0x3f7e3a);if(_0x181f35[_0x2cac('0x32')][_0x2cac('0x3e')]){_0x457186[_0x2cac('0x3b')]=_['merge'](_0x457186['where'],{'$or':_[_0x2cac('0x2b')](_0x3f7e3a,function(_0x4d4be5){if(_0x4d4be5[_0x2cac('0x2f')]!==_0x2cac('0x3f')){var _0x3b1e5d={};_0x3b1e5d[_0x4d4be5[_0x2cac('0x2a')]]={'$like':'%'+_0x181f35[_0x2cac('0x32')][_0x2cac('0x3e')]+'%'};return _0x3b1e5d;}})});}_0x457186=_[_0x2cac('0x40')]({},_0x457186,_0x181f35[_0x2cac('0x41')]);var _0x5cf5a2={'where':_0x457186[_0x2cac('0x3b')]};return db[_0x2cac('0x2c')][_0x2cac('0x1d')](_0x5cf5a2)[_0x2cac('0x26')](function(_0x514864){_0x32c44c['count']=_0x514864;if(_0x181f35[_0x2cac('0x32')][_0x2cac('0x42')]){_0x457186['include']=[{'all':!![]}];}return db[_0x2cac('0x2c')][_0x2cac('0x43')](_0x457186);})[_0x2cac('0x26')](function(_0x22a5a2){_0x32c44c['rows']=_0x22a5a2;return _0x32c44c;})['then'](respondWithFilteredResult(_0x1b9456,_0x457186))[_0x2cac('0x44')](handleError(_0x1b9456,null));};exports[_0x2cac('0x45')]=function(_0x27efbb,_0x97756e){var _0x1cbc1a={'raw':![],'where':{'id':_0x27efbb[_0x2cac('0x46')]['id']}},_0x2849de={};_0x2849de['model']=_['keys'](db[_0x2cac('0x2c')]['rawAttributes']);_0x2849de['query']=_[_0x2cac('0x33')](_0x27efbb[_0x2cac('0x32')]);_0x2849de[_0x2cac('0x3c')]=_[_0x2cac('0x34')](_0x2849de[_0x2cac('0x31')],_0x2849de[_0x2cac('0x32')]);_0x1cbc1a['attributes']=_['intersection'](_0x2849de[_0x2cac('0x31')],qs['fields'](_0x27efbb[_0x2cac('0x32')][_0x2cac('0x36')]));_0x1cbc1a[_0x2cac('0x35')]=_0x1cbc1a[_0x2cac('0x35')][_0x2cac('0x37')]?_0x1cbc1a[_0x2cac('0x35')]:_0x2849de[_0x2cac('0x31')];if(_0x27efbb[_0x2cac('0x32')]['includeAll']){_0x1cbc1a[_0x2cac('0x47')]=[{'all':!![]}];}_0x1cbc1a=_[_0x2cac('0x40')]({},_0x1cbc1a,_0x27efbb[_0x2cac('0x41')]);return db['Automation'][_0x2cac('0x48')](_0x1cbc1a)[_0x2cac('0x26')](handleEntityNotFound(_0x97756e,null))[_0x2cac('0x26')](respondWithResult(_0x97756e,null))[_0x2cac('0x44')](handleError(_0x97756e,null));};exports[_0x2cac('0x49')]=function(_0xea0032,_0x381267){return db['Automation'][_0x2cac('0x49')](_0xea0032[_0x2cac('0x4a')],{})['then'](respondWithResult(_0x381267,0xc9))['catch'](handleError(_0x381267,null));};exports['update']=function(_0x4e5a6d,_0x5c9b3c){if(_0x4e5a6d['body']['id']){delete _0x4e5a6d[_0x2cac('0x4a')]['id'];}return db[_0x2cac('0x2c')][_0x2cac('0x48')]({'where':{'id':_0x4e5a6d['params']['id']}})['then'](handleEntityNotFound(_0x5c9b3c,null))[_0x2cac('0x26')](saveUpdates(_0x4e5a6d[_0x2cac('0x4a')],null))[_0x2cac('0x26')](respondWithResult(_0x5c9b3c,null))['catch'](handleError(_0x5c9b3c,null));};exports['destroy']=function(_0x5d3d1e,_0x305826){return db[_0x2cac('0x2c')][_0x2cac('0x48')]({'where':{'id':_0x5d3d1e[_0x2cac('0x46')]['id']}})[_0x2cac('0x26')](handleEntityNotFound(_0x305826,null))['then'](removeEntity(_0x305826,null))[_0x2cac('0x44')](handleError(_0x305826,null));};exports[_0x2cac('0x4b')]=function(_0x10e015,_0x3e7752,_0x2ccf98){return db['Condition'][_0x2cac('0x48')]({'where':{'id':_0x10e015[_0x2cac('0x46')]['id']}})[_0x2cac('0x26')](handleEntityNotFound(_0x3e7752,null))[_0x2cac('0x26')](function(_0x124db0){if(_0x124db0){return _0x124db0['addConditions'](_0x10e015['body'][_0x2cac('0x4c')],_[_0x2cac('0x4d')](_0x10e015['body'],[_0x2cac('0x4c'),'id'])||{});}})[_0x2cac('0x26')](respondWithResult(_0x3e7752,null))['catch'](handleError(_0x3e7752,null));};exports['getConditions']=function(_0x1b4a41,_0x3db25c,_0x16429a){var _0x59f68a={};var _0x2d59ad={};var _0xd16f67;var _0x3cc119;return db[_0x2cac('0x2c')][_0x2cac('0x4e')]({'where':{'id':_0x1b4a41['params']['id']}})[_0x2cac('0x26')](handleEntityNotFound(_0x3db25c,null))[_0x2cac('0x26')](function(_0x1df056){if(_0x1df056){_0xd16f67=_0x1df056;_0x2d59ad[_0x2cac('0x31')]=_[_0x2cac('0x33')](db[_0x2cac('0x4f')][_0x2cac('0x2d')]);_0x2d59ad[_0x2cac('0x32')]=_['keys'](_0x1b4a41[_0x2cac('0x32')]);_0x2d59ad['filters']=_[_0x2cac('0x34')](_0x2d59ad[_0x2cac('0x31')],_0x2d59ad[_0x2cac('0x32')]);_0x59f68a[_0x2cac('0x35')]=_[_0x2cac('0x34')](_0x2d59ad[_0x2cac('0x31')],qs[_0x2cac('0x36')](_0x1b4a41[_0x2cac('0x32')]['fields']));_0x59f68a[_0x2cac('0x35')]=_0x59f68a[_0x2cac('0x35')][_0x2cac('0x37')]?_0x59f68a[_0x2cac('0x35')]:_0x2d59ad[_0x2cac('0x31')];_0x59f68a[_0x2cac('0x39')]=qs['sort'](_0x1b4a41[_0x2cac('0x32')][_0x2cac('0x3a')]);_0x59f68a['where']=qs['filters'](_['pick'](_0x1b4a41['query'],_0x2d59ad['filters']));if(_0x1b4a41[_0x2cac('0x32')][_0x2cac('0x3e')]){_0x59f68a[_0x2cac('0x3b')]=_[_0x2cac('0x40')](_0x59f68a[_0x2cac('0x3b')],{'$or':_[_0x2cac('0x2b')](_0x59f68a['attributes'],function(_0x5c108e){var _0x368e1d={};_0x368e1d[_0x5c108e]={'$like':'%'+_0x1b4a41[_0x2cac('0x32')][_0x2cac('0x3e')]+'%'};return _0x368e1d;})});}_0x59f68a=_[_0x2cac('0x40')]({},_0x59f68a,_0x1b4a41[_0x2cac('0x41')]);return _0xd16f67[_0x2cac('0x50')](_0x59f68a);}})[_0x2cac('0x26')](function(_0x257d9c){if(_0x257d9c){_0x3cc119=_0x257d9c[_0x2cac('0x37')];if(!_0x1b4a41[_0x2cac('0x32')][_0x2cac('0x38')](_0x2cac('0x51'))){_0x59f68a['limit']=qs[_0x2cac('0x1f')](_0x1b4a41[_0x2cac('0x32')][_0x2cac('0x1f')]);_0x59f68a['offset']=qs[_0x2cac('0x1e')](_0x1b4a41['query']['offset']);}return _0xd16f67[_0x2cac('0x50')](_0x59f68a);}})[_0x2cac('0x26')](function(_0x266461){if(_0x266461){return _0x266461?{'count':_0x3cc119,'rows':_0x266461}:null;}})[_0x2cac('0x26')](respondWithResult(_0x3db25c,null))[_0x2cac('0x44')](handleError(_0x3db25c,null));};exports[_0x2cac('0x52')]=function(_0x21445b,_0x282a60,_0x55eb2a){return db[_0x2cac('0x53')]['find']({'where':{'id':_0x21445b[_0x2cac('0x46')]['id']}})[_0x2cac('0x26')](handleEntityNotFound(_0x282a60,null))['then'](function(_0x31df91){if(_0x31df91){return _0x31df91[_0x2cac('0x52')](_0x21445b[_0x2cac('0x4a')]['ids'],_[_0x2cac('0x4d')](_0x21445b[_0x2cac('0x4a')],[_0x2cac('0x4c'),'id'])||{});}})[_0x2cac('0x26')](respondWithResult(_0x282a60,null))[_0x2cac('0x44')](handleError(_0x282a60,null));};exports[_0x2cac('0x54')]=function(_0x4753f2,_0x2a444f,_0x3a1e27){var _0x383910={};var _0x1aeaee={};var _0x4ea739;var _0x967cca;return db['Automation'][_0x2cac('0x4e')]({'where':{'id':_0x4753f2[_0x2cac('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a444f,null))[_0x2cac('0x26')](function(_0x372c54){if(_0x372c54){_0x4ea739=_0x372c54;_0x1aeaee[_0x2cac('0x31')]=_[_0x2cac('0x33')](db[_0x2cac('0x53')][_0x2cac('0x2d')]);_0x1aeaee[_0x2cac('0x32')]=_['keys'](_0x4753f2['query']);_0x1aeaee[_0x2cac('0x3c')]=_[_0x2cac('0x34')](_0x1aeaee[_0x2cac('0x31')],_0x1aeaee[_0x2cac('0x32')]);_0x383910[_0x2cac('0x35')]=_['intersection'](_0x1aeaee[_0x2cac('0x31')],qs[_0x2cac('0x36')](_0x4753f2[_0x2cac('0x32')][_0x2cac('0x36')]));_0x383910[_0x2cac('0x35')]=_0x383910[_0x2cac('0x35')][_0x2cac('0x37')]?_0x383910[_0x2cac('0x35')]:_0x1aeaee[_0x2cac('0x31')];_0x383910[_0x2cac('0x39')]=qs[_0x2cac('0x3a')](_0x4753f2[_0x2cac('0x32')][_0x2cac('0x3a')]);_0x383910[_0x2cac('0x3b')]=qs[_0x2cac('0x3c')](_[_0x2cac('0x3d')](_0x4753f2[_0x2cac('0x32')],_0x1aeaee[_0x2cac('0x3c')]));if(_0x4753f2[_0x2cac('0x32')]['filter']){_0x383910['where']=_[_0x2cac('0x40')](_0x383910[_0x2cac('0x3b')],{'$or':_['map'](_0x383910['attributes'],function(_0x3637a8){var _0x296d8b={};_0x296d8b[_0x3637a8]={'$like':'%'+_0x4753f2[_0x2cac('0x32')][_0x2cac('0x3e')]+'%'};return _0x296d8b;})});}_0x383910=_[_0x2cac('0x40')]({},_0x383910,_0x4753f2['options']);return _0x4ea739[_0x2cac('0x54')](_0x383910);}})[_0x2cac('0x26')](function(_0xe5e0af){if(_0xe5e0af){_0x967cca=_0xe5e0af['length'];if(!_0x4753f2[_0x2cac('0x32')]['hasOwnProperty']('nolimit')){_0x383910['limit']=qs[_0x2cac('0x1f')](_0x4753f2[_0x2cac('0x32')][_0x2cac('0x1f')]);_0x383910[_0x2cac('0x1e')]=qs[_0x2cac('0x1e')](_0x4753f2[_0x2cac('0x32')][_0x2cac('0x1e')]);}return _0x4ea739[_0x2cac('0x54')](_0x383910);}})[_0x2cac('0x26')](function(_0x257b74){if(_0x257b74){return _0x257b74?{'count':_0x967cca,'rows':_0x257b74}:null;}})[_0x2cac('0x26')](respondWithResult(_0x2a444f,null))[_0x2cac('0x44')](handleError(_0x2a444f,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 6830cca..545caf6 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 _0x5981=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Automation','tools_automations','lodash'];(function(_0x538a3d,_0x39470e){var _0x5e63d0=function(_0x290ee4){while(--_0x290ee4){_0x538a3d['push'](_0x538a3d['shift']());}};_0x5e63d0(++_0x39470e);}(_0x5981,0xa7));var _0x1598=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5981[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1598('0x0'));var util=require(_0x1598('0x1'));var logger=require(_0x1598('0x2'))(_0x1598('0x3'));var moment=require(_0x1598('0x4'));var BPromise=require(_0x1598('0x5'));var rp=require(_0x1598('0x6'));var fs=require('fs');var path=require(_0x1598('0x7'));var rimraf=require(_0x1598('0x8'));var config=require(_0x1598('0x9'));var attributes=require('./automation.attributes');module[_0x1598('0xa')]=function(_0x4af2c2,_0xead3f4){return _0x4af2c2[_0x1598('0xb')](_0x1598('0xc'),attributes,{'tableName':_0x1598('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25c9=['rimraf','./automation.attributes','exports','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5cdc37,_0x56feaa){var _0x39fc0d=function(_0x45bb83){while(--_0x45bb83){_0x5cdc37['push'](_0x5cdc37['shift']());}};_0x39fc0d(++_0x56feaa);}(_0x25c9,0x1d9));var _0x925c=function(_0x3cb029,_0xf77ced){_0x3cb029=_0x3cb029-0x0;var _0x59616e=_0x25c9[_0x3cb029];return _0x59616e;};'use strict';var _=require(_0x925c('0x0'));var util=require(_0x925c('0x1'));var logger=require(_0x925c('0x2'))(_0x925c('0x3'));var moment=require(_0x925c('0x4'));var BPromise=require(_0x925c('0x5'));var rp=require(_0x925c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x925c('0x7'));var config=require('../../config/environment');var attributes=require(_0x925c('0x8'));module[_0x925c('0x9')]=function(_0x479e60,_0x18ddd9){return _0x479e60['define'](_0x925c('0xa'),attributes,{'tableName':_0x925c('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 22bfda9..d93da21 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 _0xdeb2=['error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xdeb2,0xd3));var _0x2deb=function(_0x5ce043,_0x52cfdb){_0x5ce043=_0x5ce043-0x0;var _0x5e6530=_0xdeb2[_0x5ce043];return _0x5e6530;};'use strict';var _=require(_0x2deb('0x0'));var util=require(_0x2deb('0x1'));var moment=require(_0x2deb('0x2'));var BPromise=require(_0x2deb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2deb('0x4'));var db=require(_0x2deb('0x5'))['db'];var utils=require(_0x2deb('0x6'));var logger=require(_0x2deb('0x7'))(_0x2deb('0x8'));var config=require(_0x2deb('0x9'));var jayson=require(_0x2deb('0xa'));var client=jayson[_0x2deb('0xb')][_0x2deb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x394f94,_0x53c01a,_0xa47d30){return new BPromise(function(_0x262ea6,_0x57e28c){return client[_0x2deb('0xd')](_0x394f94,_0xa47d30)['then'](function(_0x3de43d){logger[_0x2deb('0xe')](_0x2deb('0xf'),_0x53c01a,_0x2deb('0x10'));logger['debug'](_0x2deb('0x11'),_0x53c01a,_0x2deb('0x10'),JSON[_0x2deb('0x12')](_0x3de43d));if(_0x3de43d['error']){if(_0x3de43d[_0x2deb('0x13')][_0x2deb('0x14')]===0x1f4){logger[_0x2deb('0x13')](_0x2deb('0xf'),_0x53c01a,_0x3de43d[_0x2deb('0x13')][_0x2deb('0x15')]);return _0x57e28c(_0x3de43d[_0x2deb('0x13')]['message']);}logger[_0x2deb('0x13')]('Automation,\x20%s,\x20%s',_0x53c01a,_0x3de43d['error'][_0x2deb('0x15')]);return _0x262ea6(_0x3de43d[_0x2deb('0x13')][_0x2deb('0x15')]);}else{logger[_0x2deb('0xe')]('Automation,\x20%s,\x20%s',_0x53c01a,_0x2deb('0x10'));_0x262ea6(_0x3de43d['result'][_0x2deb('0x15')]);}})[_0x2deb('0x16')](function(_0x41e149){logger[_0x2deb('0x13')](_0x2deb('0xf'),_0x53c01a,_0x41e149);_0x57e28c(_0x41e149);});});} \ No newline at end of file +var _0x72d9=['moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x125e59,_0xb7f659){var _0x1025ff=function(_0x25ca75){while(--_0x25ca75){_0x125e59['push'](_0x125e59['shift']());}};_0x1025ff(++_0xb7f659);}(_0x72d9,0x19c));var _0x972d=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x72d9[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x972d('0x0'));var util=require(_0x972d('0x1'));var moment=require(_0x972d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x972d('0x3'));var db=require(_0x972d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x972d('0x5'))('rpc');var config=require(_0x972d('0x6'));var jayson=require(_0x972d('0x7'));var client=jayson['client'][_0x972d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ad382,_0x2954c8,_0x3f9bcf){return new BPromise(function(_0x564adc,_0x1e300d){return client['request'](_0x4ad382,_0x3f9bcf)['then'](function(_0x403f85){logger[_0x972d('0x9')](_0x972d('0xa'),_0x2954c8,_0x972d('0xb'));logger['debug'](_0x972d('0xc'),_0x2954c8,'request\x20sent',JSON[_0x972d('0xd')](_0x403f85));if(_0x403f85[_0x972d('0xe')]){if(_0x403f85['error']['code']===0x1f4){logger['error'](_0x972d('0xa'),_0x2954c8,_0x403f85[_0x972d('0xe')][_0x972d('0xf')]);return _0x1e300d(_0x403f85[_0x972d('0xe')]['message']);}logger[_0x972d('0xe')]('Automation,\x20%s,\x20%s',_0x2954c8,_0x403f85[_0x972d('0xe')][_0x972d('0xf')]);return _0x564adc(_0x403f85[_0x972d('0xe')][_0x972d('0xf')]);}else{logger[_0x972d('0x9')](_0x972d('0xa'),_0x2954c8,_0x972d('0xb'));_0x564adc(_0x403f85[_0x972d('0x10')]['message']);}})[_0x972d('0x11')](function(_0x4d1fba){logger[_0x972d('0xe')](_0x972d('0xa'),_0x2954c8,_0x4d1fba);_0x1e300d(_0x4d1fba);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 3b6f724..457f51c 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 _0xc4bc=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getActions','post','create','addConditions','/:id/actions','addActions','put','/:id','update','destroy','exports','multer','path'];(function(_0x4cc51a,_0x13da08){var _0x16c6da=function(_0x1231b0){while(--_0x1231b0){_0x4cc51a['push'](_0x4cc51a['shift']());}};_0x16c6da(++_0x13da08);}(_0xc4bc,0x1e2));var _0xcc4b=function(_0x41c78d,_0x4c3628){_0x41c78d=_0x41c78d-0x0;var _0x26d028=_0xc4bc[_0x41c78d];return _0x26d028;};'use strict';var multer=require(_0xcc4b('0x0'));var util=require('util');var path=require(_0xcc4b('0x1'));var timeout=require(_0xcc4b('0x2'));var express=require('express');var router=express[_0xcc4b('0x3')]();var fs_extra=require(_0xcc4b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcc4b('0x5'));var config=require(_0xcc4b('0x6'));var controller=require('./automation.controller');router[_0xcc4b('0x7')]('/',auth[_0xcc4b('0x8')](),controller[_0xcc4b('0x9')]);router[_0xcc4b('0x7')]('/:id',auth[_0xcc4b('0x8')](),controller[_0xcc4b('0xa')]);router[_0xcc4b('0x7')]('/:id/conditions',auth[_0xcc4b('0x8')](),controller['getConditions']);router[_0xcc4b('0x7')]('/:id/actions',auth['isAuthenticated'](),controller[_0xcc4b('0xb')]);router[_0xcc4b('0xc')]('/',auth[_0xcc4b('0x8')](),controller[_0xcc4b('0xd')]);router[_0xcc4b('0xc')]('/:id/conditions',auth[_0xcc4b('0x8')](),controller[_0xcc4b('0xe')]);router[_0xcc4b('0xc')](_0xcc4b('0xf'),auth[_0xcc4b('0x8')](),controller[_0xcc4b('0x10')]);router[_0xcc4b('0x11')](_0xcc4b('0x12'),auth[_0xcc4b('0x8')](),controller[_0xcc4b('0x13')]);router['delete'](_0xcc4b('0x12'),auth[_0xcc4b('0x8')](),controller[_0xcc4b('0x14')]);module[_0xcc4b('0x15')]=router; \ No newline at end of file +var _0x9a41=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','/:id/actions','post','create','addConditions','addActions','put','update','delete','destroy','multer','util','path'];(function(_0x14afda,_0x512394){var _0x1923af=function(_0x6919df){while(--_0x6919df){_0x14afda['push'](_0x14afda['shift']());}};_0x1923af(++_0x512394);}(_0x9a41,0x184));var _0x19a4=function(_0x2b6224,_0x43cd1e){_0x2b6224=_0x2b6224-0x0;var _0x417d2e=_0x9a41[_0x2b6224];return _0x417d2e;};'use strict';var multer=require(_0x19a4('0x0'));var util=require(_0x19a4('0x1'));var path=require(_0x19a4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x19a4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x19a4('0x4'));var interaction=require(_0x19a4('0x5'));var config=require(_0x19a4('0x6'));var controller=require(_0x19a4('0x7'));router[_0x19a4('0x8')]('/',auth[_0x19a4('0x9')](),controller[_0x19a4('0xa')]);router[_0x19a4('0x8')](_0x19a4('0xb'),auth['isAuthenticated'](),controller[_0x19a4('0xc')]);router['get']('/:id/conditions',auth[_0x19a4('0x9')](),controller[_0x19a4('0xd')]);router[_0x19a4('0x8')](_0x19a4('0xe'),auth[_0x19a4('0x9')](),controller['getActions']);router[_0x19a4('0xf')]('/',auth[_0x19a4('0x9')](),controller[_0x19a4('0x10')]);router[_0x19a4('0xf')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x19a4('0x11')]);router[_0x19a4('0xf')]('/:id/actions',auth['isAuthenticated'](),controller[_0x19a4('0x12')]);router[_0x19a4('0x13')](_0x19a4('0xb'),auth['isAuthenticated'](),controller[_0x19a4('0x14')]);router[_0x19a4('0x15')](_0x19a4('0xb'),auth[_0x19a4('0x9')](),controller[_0x19a4('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 60a9141..e1fffa1 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 _0x2a77=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#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)','Cut\x20Digit\x20(min:1,\x20max:15)','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)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x51272f,_0x40b67c){var _0x3ce31b=function(_0x186db1){while(--_0x186db1){_0x51272f['push'](_0x51272f['shift']());}};_0x3ce31b(++_0x40b67c);}(_0x2a77,0x73));var _0x72a7=function(_0x29975a,_0x2ca253){_0x29975a=_0x29975a-0x0;var _0x41bcac=_0x2a77[_0x29975a];return _0x41bcac;};'use strict';var Sequelize=require(_0x72a7('0x0'));module[_0x72a7('0x1')]={'name':{'type':Sequelize[_0x72a7('0x2')],'unique':_0x72a7('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x72a7('0x4')},'description':{'type':Sequelize[_0x72a7('0x2')]},'active':{'type':Sequelize[_0x72a7('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x72a7('0x6')](0x4)[_0x72a7('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x72a7('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x72a7('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x72a7('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72a7('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72a7('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)[_0x72a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72a7('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)[_0x72a7('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x72a7('0xf')},'dialTimezone':{'type':Sequelize[_0x72a7('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x72a7('0x2')],'defaultValue':_0x72a7('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x72a7('0x11')](_0x72a7('0x12'),_0x72a7('0x13'),'onlyIfOpen'),'defaultValue':_0x72a7('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x72a7('0x6')](0x9)[_0x72a7('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x72a7('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x72a7('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x72a7('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x72a7('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x72a7('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x72a7('0x6')](0x9)[_0x72a7('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x72a7('0x6')](0x9)[_0x72a7('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x72a7('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x72a7('0x6')](0x9)[_0x72a7('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x72a7('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x72a7('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x72a7('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x72a7('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x72a7('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x72a7('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x72a7('0x11')](_0x72a7('0x1b'),_0x72a7('0x1c')),'defaultValue':_0x72a7('0x1b')},'dialPrefix':{'type':Sequelize[_0x72a7('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x72a7('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x72a7('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x72a7('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x72a7('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)[_0x72a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)[_0x72a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72a7('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)[_0x72a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72a7('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)[_0x72a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0x25')}}; \ No newline at end of file +var _0x3849=['#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\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,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','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)'];(function(_0x5adeac,_0x46d1f0){var _0xcdccd7=function(_0x1f6abf){while(--_0x1f6abf){_0x5adeac['push'](_0x5adeac['shift']());}};_0xcdccd7(++_0x46d1f0);}(_0x3849,0x189));var _0x9384=function(_0x4421b5,_0x13d0f6){_0x4421b5=_0x4421b5-0x0;var _0x26cca3=_0x3849[_0x4421b5];return _0x26cca3;};'use strict';var Sequelize=require('sequelize');module[_0x9384('0x0')]={'name':{'type':Sequelize[_0x9384('0x1')],'unique':_0x9384('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9384('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x9384('0x4')},'description':{'type':Sequelize[_0x9384('0x1')]},'active':{'type':Sequelize[_0x9384('0x5')],'defaultValue':0x0,'comment':_0x9384('0x6')},'limitCalls':{'type':Sequelize[_0x9384('0x7')](0x4)[_0x9384('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x9384('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9384('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x9384('0x7')](0x3)[_0x9384('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9384('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9384('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9384('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9384('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9384('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x9384('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x9384('0x7')](0x5)[_0x9384('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9384('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9384('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x9384('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9384('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9384('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9384('0x7')](0x3)[_0x9384('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9384('0x10')},'dialTimezone':{'type':Sequelize[_0x9384('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9384('0x1')],'defaultValue':_0x9384('0x11')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never',_0x9384('0x12')),'defaultValue':_0x9384('0x13')},'dialAMDActive':{'type':Sequelize[_0x9384('0x5')],'defaultValue':0x0,'comment':_0x9384('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9384('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9384('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x9384('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9384('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9384('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x9384('0x7')](0x9)[_0x9384('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9384('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9384('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9384('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9384('0x7')](0x9)[_0x9384('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9384('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x9384('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9384('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9384('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9384('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x9384('0x1c')),'defaultValue':_0x9384('0x1d')},'dialPrefix':{'type':Sequelize[_0x9384('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9384('0x7')](0x3)[_0x9384('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x9384('0x7')](0x3)[_0x9384('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9384('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9384('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9384('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9384('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x9384('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9384('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9384('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9384('0x7')](0x3)[_0x9384('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9384('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9384('0x7')](0x5)[_0x9384('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9384('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x9384('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9384('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9384('0x7')](0x5)[_0x9384('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9384('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9384('0x7')](0x3)[_0x9384('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9384('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9384('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index f83af23..ce8036a 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 _0xa9e0=['ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','scheduledAt','CmListId','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','name','send','index','map','Campaign','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','autoAssociation','update','getHoppers','findOne','hasOwnProperty','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','ListId','select','field','phone','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL'];(function(_0x214a03,_0x2e4061){var _0xda476a=function(_0x1c46b2){while(--_0x1c46b2){_0x214a03['push'](_0x214a03['shift']());}};_0xda476a(++_0x2e4061);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];function respondWithStatusCode(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xcc;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['sendStatus'](_0x32d742);}return _0x26d672[_0x0a9e('0x16')](_0x32d742)[_0x0a9e('0x17')]();};}function respondWithResult(_0x2b4227,_0x281129){_0x281129=_0x281129||0xc8;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x16')](_0x281129)['json'](_0x44dcfd);}};}function respondWithFilteredResult(_0x22dccb,_0x5d0880){return function(_0x1985b6){if(_0x1985b6){var _0x519dfd=_0x1985b6[_0x0a9e('0x18')],_0x16033c=_0x5d0880['offset'],_0x12066b=_0x5d0880[_0x0a9e('0x19')]+_0x5d0880[_0x0a9e('0x1a')],_0x48f32d;if(_0x12066b>=_0x519dfd){_0x12066b=_0x519dfd;_0x48f32d=0xc8;}else{_0x48f32d=0xce;}_0x22dccb[_0x0a9e('0x16')](_0x48f32d);return _0x22dccb[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x16033c+'-'+_0x12066b+'/'+_0x519dfd)[_0x0a9e('0x1d')](_0x1985b6);}return null;};}function patchUpdates(_0x530eb7){return function(_0x20559e){try{jsonpatch[_0x0a9e('0x1e')](_0x20559e,_0x530eb7,!![]);}catch(_0x112016){return BPromise[_0x0a9e('0x1f')](_0x112016);}return _0x20559e[_0x0a9e('0x20')]();};}function saveUpdates(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['update'](_0x4bb1e3)[_0x0a9e('0x21')](function(_0x5a09ef){return _0x5a09ef;});}return null;};}function removeEntity(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x22')]()[_0x0a9e('0x21')](function(){var _0x4abc77=_0x432e56[_0x0a9e('0x23')]({'plain':!![]});var _0x2fb0e4=_0x0a9e('0x24');return db[_0x0a9e('0x25')][_0x0a9e('0x22')]({'where':{'type':_0x2fb0e4,'resourceId':_0x4abc77['id']}})[_0x0a9e('0x21')](function(){return _0x432e56;});})[_0x0a9e('0x21')](function(){_0x588269['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197ec0,_0x3a8e58){return function(_0x40c424){if(!_0x40c424){_0x197ec0[_0x0a9e('0x26')](0x194);}return _0x40c424;};}function handleError(_0x526cf3,_0x384319){_0x384319=_0x384319||0x1f4;return function(_0x479bc4){logger[_0x0a9e('0x27')](_0x479bc4['stack']);if(_0x479bc4[_0x0a9e('0x28')]){delete _0x479bc4[_0x0a9e('0x28')];}_0x526cf3[_0x0a9e('0x16')](_0x384319)[_0x0a9e('0x29')](_0x479bc4);};}exports[_0x0a9e('0x2a')]=function(_0x1538a4,_0x11c3b6){var _0x14de77={},_0x5a101a={},_0x3652a7={'count':0x0,'rows':[]};var _0x468813=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')]['rawAttributes'],function(_0x15b200){return{'name':_0x15b200[_0x0a9e('0x2d')],'type':_0x15b200[_0x0a9e('0x2e')][_0x0a9e('0x2f')]};});_0x5a101a[_0x0a9e('0x30')]=_[_0x0a9e('0x2b')](_0x468813,_0x0a9e('0x28'));_0x5a101a[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x1538a4['query']);_0x5a101a[_0x0a9e('0x33')]=_['intersection'](_0x5a101a[_0x0a9e('0x30')],_0x5a101a[_0x0a9e('0x31')]);_0x14de77[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x5a101a[_0x0a9e('0x30')],qs['fields'](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x14de77[_0x0a9e('0x34')]=_0x14de77[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x14de77[_0x0a9e('0x34')]:_0x5a101a[_0x0a9e('0x30')];if(!_0x1538a4[_0x0a9e('0x31')]['hasOwnProperty'](_0x0a9e('0x38'))){_0x14de77['limit']=qs[_0x0a9e('0x1a')](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x14de77[_0x0a9e('0x19')]=qs['offset'](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x19')]);}_0x14de77[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x1538a4['query']['sort']);_0x14de77[_0x0a9e('0x3b')]=qs['filters'](_[_0x0a9e('0x3c')](_0x1538a4[_0x0a9e('0x31')],_0x5a101a[_0x0a9e('0x33')]),_0x468813);if(_0x1538a4[_0x0a9e('0x31')]['filter']){_0x14de77[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x14de77[_0x0a9e('0x3b')],{'$or':_['map'](_0x468813,function(_0x1dbf74){if(_0x1dbf74[_0x0a9e('0x2e')]!==_0x0a9e('0x3e')){var _0x4c1c0e={};_0x4c1c0e[_0x1dbf74['name']]={'$like':'%'+_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x4c1c0e;}})});}_0x14de77=_['merge']({},_0x14de77,_0x1538a4[_0x0a9e('0x40')]);var _0x419125={'where':_0x14de77[_0x0a9e('0x3b')]};return db[_0x0a9e('0x2c')]['count'](_0x419125)['then'](function(_0x15e37d){_0x3652a7[_0x0a9e('0x18')]=_0x15e37d;if(_0x1538a4['query'][_0x0a9e('0x41')]){_0x14de77[_0x0a9e('0x42')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')]['findAll'](_0x14de77);})[_0x0a9e('0x21')](function(_0x2cfea9){_0x3652a7[_0x0a9e('0x43')]=_0x2cfea9;return _0x3652a7;})[_0x0a9e('0x21')](respondWithFilteredResult(_0x11c3b6,_0x14de77))[_0x0a9e('0x44')](handleError(_0x11c3b6,null));};exports[_0x0a9e('0x45')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x46')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x2c')][_0x0a9e('0x47')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x31')]);_0x3da2cd[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x3da2cd[_0x0a9e('0x30')],_0x3da2cd[_0x0a9e('0x31')]);_0x23b089[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x3da2cd[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x2881b3[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x23b089[_0x0a9e('0x34')]=_0x23b089['attributes'][_0x0a9e('0x37')]?_0x23b089[_0x0a9e('0x34')]:_0x3da2cd[_0x0a9e('0x30')];if(_0x2881b3[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x23b089[_0x0a9e('0x42')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x3d')]({},_0x23b089,_0x2881b3[_0x0a9e('0x40')]);return db['Campaign'][_0x0a9e('0x48')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x21')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x44')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x49')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x562fb4[_0x0a9e('0x4a')],{})[_0x0a9e('0x21')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x23')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x4b'));if(_0x45bf7f[_0x0a9e('0x4c')]===_0x0a9e('0x4d')){var _0x409789=_0x37be73[_0x0a9e('0x23')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x24');return db[_0x0a9e('0x4e')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4f')]},'raw':!![]})[_0x0a9e('0x21')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x49')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x21')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x44')](function(_0x30decb){logger[_0x0a9e('0x27')](_0x0a9e('0x50'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['clone']=function(_0x39d77d,_0x204173){var _0x14d602={'where':{'id':_0x39d77d[_0x0a9e('0x46')]['id']}},_0x5bb3ed={};_0x5bb3ed[_0x0a9e('0x30')]=_['keys'](db['Campaign'][_0x0a9e('0x47')]);_0x14d602['attributes']=_[_0x0a9e('0x35')](_0x5bb3ed['model'],qs[_0x0a9e('0x36')](_0x39d77d[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x14d602['attributes']=_0x14d602[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x14d602['attributes']:_0x5bb3ed['model'];if(_0x39d77d[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x14d602['include']=[{'all':!![]}];}_0x14d602=_[_0x0a9e('0x3d')]({},_0x14d602,_0x39d77d['options']);return db[_0x0a9e('0x2c')]['find'](_0x14d602)[_0x0a9e('0x21')](handleEntityNotFound(_0x204173,null))['then'](function(_0x5da27d){if(_0x5da27d){var _0x5df0ad=_0x5da27d[_0x0a9e('0x23')]({'plain':!![]});_0x5df0ad=qs['omit'](_0x5df0ad,['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);_0x39d77d[_0x0a9e('0x4a')]=_[_0x0a9e('0x53')](_0x39d77d[_0x0a9e('0x4a')],['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2c')]['create'](_[_0x0a9e('0x3d')](_0x5df0ad,_0x39d77d[_0x0a9e('0x4a')]),{'include':_0x39d77d[_0x0a9e('0x31')][_0x0a9e('0x41')]?[{'all':!![]}]:undefined})[_0x0a9e('0x21')](function(_0x156662){var _0x5d86e9=_0x39d77d[_0x0a9e('0x4d')][_0x0a9e('0x23')]({'plain':!![]});if(!_0x5d86e9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d86e9[_0x0a9e('0x4c')]==='user'){var _0x20c668=_0x156662['get']({'plain':!![]});var _0x4b3c1a='IvrCampaigns';return db[_0x0a9e('0x4e')]['find']({'where':{'name':_0x4b3c1a,'userProfileId':_0x5d86e9[_0x0a9e('0x4f')]},'raw':!![]})[_0x0a9e('0x21')](function(_0x261adb){if(_0x261adb&&_0x261adb[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x49')]({'name':_0x20c668['name'],'resourceId':_0x20c668['id'],'type':_0x261adb[_0x0a9e('0x28')],'sectionId':_0x261adb['id']},{})['then'](function(){return _0x156662;});}else{return _0x156662;}})[_0x0a9e('0x44')](function(_0x1f07cb){logger[_0x0a9e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f07cb);throw _0x1f07cb;});}return _0x156662;});}})[_0x0a9e('0x21')](respondWithResult(_0x204173,0xc9))[_0x0a9e('0x44')](handleError(_0x204173,null));};exports[_0x0a9e('0x55')]=function(_0x32e134,_0x497d91){if(_0x32e134[_0x0a9e('0x4a')]['id']){delete _0x32e134[_0x0a9e('0x4a')]['id'];}return db['Campaign'][_0x0a9e('0x48')]({'where':{'id':_0x32e134[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x497d91,null))[_0x0a9e('0x21')](saveUpdates(_0x32e134[_0x0a9e('0x4a')],null))['then'](respondWithResult(_0x497d91,null))[_0x0a9e('0x44')](handleError(_0x497d91,null));};exports[_0x0a9e('0x22')]=function(_0x281c7d,_0x47bb43){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x281c7d['params']['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x47bb43,null))[_0x0a9e('0x21')](removeEntity(_0x47bb43,null))[_0x0a9e('0x44')](handleError(_0x47bb43,null));};exports[_0x0a9e('0x56')]=function(_0x186f39,_0xc8c264,_0x387489){var _0x54a37d={'raw':!![],'where':{}};var _0x2d7205={};var _0x1cc4f3={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x186f39[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0xc8c264,null))[_0x0a9e('0x21')](function(_0x412a72){if(_0x412a72){_0x2d7205[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db['CmHopper'][_0x0a9e('0x47')]);_0x2d7205[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x186f39['query']);_0x2d7205[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x2d7205['model'],_0x2d7205[_0x0a9e('0x31')]);_0x54a37d[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2d7205[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x186f39['query']['fields']));_0x54a37d['attributes']=_0x54a37d[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x54a37d[_0x0a9e('0x34')]:_0x2d7205[_0x0a9e('0x30')];if(!_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x58')](_0x0a9e('0x38'))){_0x54a37d[_0x0a9e('0x1a')]=qs['limit'](_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x54a37d[_0x0a9e('0x19')]=qs['offset'](_0x186f39[_0x0a9e('0x31')]['offset']);}_0x54a37d[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x186f39['query'][_0x0a9e('0x3a')]);_0x54a37d[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x186f39['query'],_0x2d7205[_0x0a9e('0x33')]));_0x54a37d[_0x0a9e('0x3b')][_0x0a9e('0x59')]=_0x412a72['id'];if(_0x186f39[_0x0a9e('0x31')]['filter']){_0x54a37d[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x54a37d[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x54a37d['attributes'],function(_0x290d43){var _0x3511c9={};_0x3511c9[_0x290d43]={'$like':'%'+_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x3511c9;})});}_0x54a37d=_[_0x0a9e('0x3d')]({},_0x54a37d,_0x186f39[_0x0a9e('0x40')]);return db[_0x0a9e('0x5a')][_0x0a9e('0x18')]({'where':_0x54a37d[_0x0a9e('0x3b')]})[_0x0a9e('0x21')](function(_0xc4c230){_0x1cc4f3[_0x0a9e('0x18')]=_0xc4c230;if(_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x54a37d['include']=[{'all':!![]}];}return db[_0x0a9e('0x5a')][_0x0a9e('0x5b')](_0x54a37d);})[_0x0a9e('0x21')](function(_0x563627){_0x1cc4f3[_0x0a9e('0x43')]=_0x563627;return _0x1cc4f3;});}})[_0x0a9e('0x21')](respondWithFilteredResult(_0xc8c264,_0x54a37d))[_0x0a9e('0x44')](handleError(_0xc8c264,null));};exports[_0x0a9e('0x5c')]=function(_0x56d650,_0x541e80,_0x7ebea8){var _0x2bbdb5={'raw':!![],'where':{}};var _0x4c54fa={};var _0x45108c={'count':0x0,'rows':[]};return db['Campaign'][_0x0a9e('0x57')]({'where':{'id':_0x56d650[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x21')](function(_0x41cf12){if(_0x41cf12){_0x4c54fa[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x5d')][_0x0a9e('0x47')]);_0x4c54fa[_0x0a9e('0x31')]=_['keys'](_0x56d650[_0x0a9e('0x31')]);_0x4c54fa[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x4c54fa[_0x0a9e('0x30')],_0x4c54fa['query']);_0x2bbdb5[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x4c54fa['model'],qs[_0x0a9e('0x36')](_0x56d650['query'][_0x0a9e('0x36')]));_0x2bbdb5[_0x0a9e('0x34')]=_0x2bbdb5[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x2bbdb5['attributes']:_0x4c54fa['model'];if(!_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x58')](_0x0a9e('0x38'))){_0x2bbdb5['limit']=qs[_0x0a9e('0x1a')](_0x56d650[_0x0a9e('0x31')]['limit']);_0x2bbdb5['offset']=qs[_0x0a9e('0x19')](_0x56d650['query']['offset']);}_0x2bbdb5['order']=qs[_0x0a9e('0x3a')](_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x2bbdb5[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x56d650['query'],_0x4c54fa[_0x0a9e('0x33')]));_0x2bbdb5['where'][_0x0a9e('0x59')]=_0x41cf12['id'];if(_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x3f')]){_0x2bbdb5[_0x0a9e('0x3b')]=_['merge'](_0x2bbdb5[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x2bbdb5[_0x0a9e('0x34')],function(_0x5b74c3){var _0xb6e411={};_0xb6e411[_0x5b74c3]={'$like':'%'+_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0xb6e411;})});}_0x2bbdb5=_[_0x0a9e('0x3d')]({},_0x2bbdb5,_0x56d650[_0x0a9e('0x40')]);return db[_0x0a9e('0x5d')][_0x0a9e('0x18')]({'where':_0x2bbdb5[_0x0a9e('0x3b')]})['then'](function(_0x2645d6){_0x45108c[_0x0a9e('0x18')]=_0x2645d6;if(_0x56d650['query'][_0x0a9e('0x41')]){_0x2bbdb5[_0x0a9e('0x42')]=[{'all':!![]}];}return db[_0x0a9e('0x5d')]['findAll'](_0x2bbdb5);})[_0x0a9e('0x21')](function(_0x52ec10){_0x45108c[_0x0a9e('0x43')]=_0x52ec10;return _0x45108c;});}})[_0x0a9e('0x21')](respondWithFilteredResult(_0x541e80,_0x2bbdb5))[_0x0a9e('0x44')](handleError(_0x541e80,null));};exports[_0x0a9e('0x5e')]=function(_0x842d6f,_0x16341a,_0x16a039){var _0x3a9a85={'raw':!![],'where':{}};var _0x501050={};var _0x329d88={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x842d6f[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x16341a,null))[_0x0a9e('0x21')](function(_0x6803d6){if(_0x6803d6){_0x501050[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x5f')][_0x0a9e('0x47')]);_0x501050[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x842d6f['query']);_0x501050[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x501050[_0x0a9e('0x30')],_0x501050[_0x0a9e('0x31')]);_0x3a9a85[_0x0a9e('0x34')]=_['intersection'](_0x501050[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x842d6f['query'][_0x0a9e('0x36')]));_0x3a9a85['attributes']=_0x3a9a85[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x3a9a85[_0x0a9e('0x34')]:_0x501050[_0x0a9e('0x30')];if(!_0x842d6f['query'][_0x0a9e('0x58')]('nolimit')){_0x3a9a85[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x842d6f['query'][_0x0a9e('0x1a')]);_0x3a9a85[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x842d6f['query']['offset']);}_0x3a9a85[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x842d6f[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x3a9a85[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x842d6f[_0x0a9e('0x31')],_0x501050[_0x0a9e('0x33')]));_0x3a9a85['where'][_0x0a9e('0x59')]=_0x6803d6['id'];if(_0x842d6f['query'][_0x0a9e('0x3f')]){_0x3a9a85[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x3a9a85[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x3a9a85['attributes'],function(_0x436313){var _0x4667bf={};_0x4667bf[_0x436313]={'$like':'%'+_0x842d6f[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x4667bf;})});}_0x3a9a85=_[_0x0a9e('0x3d')]({},_0x3a9a85,_0x842d6f['options']);return db['CmHopperFinal'][_0x0a9e('0x18')]({'where':_0x3a9a85['where']})[_0x0a9e('0x21')](function(_0x4658df){_0x329d88[_0x0a9e('0x18')]=_0x4658df;if(_0x842d6f[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x3a9a85[_0x0a9e('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x3a9a85);})[_0x0a9e('0x21')](function(_0x5dfbe2){_0x329d88[_0x0a9e('0x43')]=_0x5dfbe2;return _0x329d88;});}})['then'](respondWithFilteredResult(_0x16341a,_0x3a9a85))[_0x0a9e('0x44')](handleError(_0x16341a,null));};exports['getHopperBlacks']=function(_0x558d60,_0x1c49dc,_0xb8db59){var _0x5e9b0b={'raw':!![],'where':{}};var _0x170af6={};var _0x17cb30={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x558d60[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c49dc,null))['then'](function(_0x16449b){if(_0x16449b){_0x170af6[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x60')][_0x0a9e('0x47')]);_0x170af6['query']=_[_0x0a9e('0x32')](_0x558d60[_0x0a9e('0x31')]);_0x170af6['filters']=_[_0x0a9e('0x35')](_0x170af6[_0x0a9e('0x30')],_0x170af6[_0x0a9e('0x31')]);_0x5e9b0b[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x170af6[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x5e9b0b[_0x0a9e('0x34')]=_0x5e9b0b['attributes'][_0x0a9e('0x37')]?_0x5e9b0b[_0x0a9e('0x34')]:_0x170af6[_0x0a9e('0x30')];if(!_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x58')]('nolimit')){_0x5e9b0b['limit']=qs[_0x0a9e('0x1a')](_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x5e9b0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x558d60['query'][_0x0a9e('0x19')]);}_0x5e9b0b[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x558d60['query'][_0x0a9e('0x3a')]);_0x5e9b0b['where']=qs[_0x0a9e('0x33')](_['pick'](_0x558d60[_0x0a9e('0x31')],_0x170af6[_0x0a9e('0x33')]));_0x5e9b0b[_0x0a9e('0x3b')]['CampaignId']=_0x16449b['id'];if(_0x558d60[_0x0a9e('0x31')]['filter']){_0x5e9b0b[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x5e9b0b[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x5e9b0b[_0x0a9e('0x34')],function(_0x1bee04){var _0x4014c7={};_0x4014c7[_0x1bee04]={'$like':'%'+_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x4014c7;})});}_0x5e9b0b=_[_0x0a9e('0x3d')]({},_0x5e9b0b,_0x558d60[_0x0a9e('0x40')]);return db[_0x0a9e('0x60')][_0x0a9e('0x18')]({'where':_0x5e9b0b[_0x0a9e('0x3b')]})[_0x0a9e('0x21')](function(_0x248368){_0x17cb30['count']=_0x248368;if(_0x558d60['query'][_0x0a9e('0x41')]){_0x5e9b0b['include']=[{'all':!![]}];}return db[_0x0a9e('0x60')][_0x0a9e('0x5b')](_0x5e9b0b);})['then'](function(_0x1a3754){_0x17cb30[_0x0a9e('0x43')]=_0x1a3754;return _0x17cb30;});}})[_0x0a9e('0x21')](respondWithFilteredResult(_0x1c49dc,_0x5e9b0b))[_0x0a9e('0x44')](handleError(_0x1c49dc,null));};exports['getLists']=function(_0x148fd9,_0x26cb76,_0x374f0b){var _0x34a791={};var _0x5d0e1f={};var _0x19e9ed;var _0x1a0b08;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x148fd9[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x26cb76,null))[_0x0a9e('0x21')](function(_0x54b107){if(_0x54b107){_0x19e9ed=_0x54b107;_0x5d0e1f[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x61')][_0x0a9e('0x47')]);_0x5d0e1f[_0x0a9e('0x31')]=_['keys'](_0x148fd9[_0x0a9e('0x31')]);_0x5d0e1f[_0x0a9e('0x33')]=_['intersection'](_0x5d0e1f[_0x0a9e('0x30')],_0x5d0e1f[_0x0a9e('0x31')]);_0x34a791[_0x0a9e('0x34')]=_['intersection'](_0x5d0e1f['model'],qs['fields'](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x34a791['attributes']=_0x34a791[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x34a791[_0x0a9e('0x34')]:_0x5d0e1f['model'];_0x34a791[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x34a791[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x148fd9[_0x0a9e('0x31')],_0x5d0e1f[_0x0a9e('0x33')]));if(_0x148fd9['query'][_0x0a9e('0x3f')]){_0x34a791['where']=_[_0x0a9e('0x3d')](_0x34a791[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x34a791[_0x0a9e('0x34')],function(_0x407e9d){var _0x344cd4={};_0x344cd4[_0x407e9d]={'$like':'%'+_0x148fd9['query'][_0x0a9e('0x3f')]+'%'};return _0x344cd4;})});}_0x34a791=_[_0x0a9e('0x3d')]({},_0x34a791,_0x148fd9[_0x0a9e('0x40')]);return _0x19e9ed[_0x0a9e('0x62')](_0x34a791);}})['then'](function(_0x2e4887){if(_0x2e4887){_0x1a0b08=_0x2e4887[_0x0a9e('0x37')];if(!_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x58')](_0x0a9e('0x38'))){_0x34a791[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x34a791[_0x0a9e('0x19')]=qs['offset'](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x19')]);}return _0x19e9ed[_0x0a9e('0x62')](_0x34a791);}})[_0x0a9e('0x21')](function(_0xea8bd1){if(_0xea8bd1){return _0xea8bd1?{'count':_0x1a0b08,'rows':_0xea8bd1}:null;}})[_0x0a9e('0x21')](respondWithResult(_0x26cb76,null))[_0x0a9e('0x44')](handleError(_0x26cb76,null));};exports[_0x0a9e('0x63')]=function(_0x566b90,_0x3b581c,_0xd2391){var _0x1a9ef1,_0x5c65fc;return db[_0x0a9e('0x2c')][_0x0a9e('0x48')]({'where':{'id':_0x566b90[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x3b581c,null))[_0x0a9e('0x21')](function(_0x1ba457){if(_0x1ba457){_0x5c65fc=_0x1ba457;return _0x1ba457[_0x0a9e('0x63')](_0x566b90[_0x0a9e('0x4a')][_0x0a9e('0x64')],_[_0x0a9e('0x53')](_0x566b90['body'],[_0x0a9e('0x64'),'id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x15a9ed){var _0x3db98f;_0x1a9ef1=_0x15a9ed||[];var _0x2b624e=[];if(_0x15a9ed){for(var _0x3942fd=0x0;_0x3942fd<_0x15a9ed['length'];_0x3942fd+=0x1){var _0x382687=_0x15a9ed[_0x3942fd]['get']({'plain':!![]});_0x5c65fc['dialCheckDuplicateType']=_0x566b90['body'][_0x0a9e('0x66')]?_0x566b90[_0x0a9e('0x4a')][_0x0a9e('0x66')]:_0x5c65fc[_0x0a9e('0x66')];switch(_0x5c65fc['dialCheckDuplicateType']){case _0x0a9e('0x67'):_0x3db98f=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x6a'))[_0x0a9e('0x6b')](['phone','scheduledAt',_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x59'),'createdAt',_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')]('phone',_0x0a9e('0x70'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),'scheduledAt')[_0x0a9e('0x6f')]('id',_0x0a9e('0x6c'))[_0x0a9e('0x6f')](_0x382687['CmListId']['toString'](),'ListId')[_0x0a9e('0x6f')](_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')](),_0x0a9e('0x59'))['field'](_0x0a9e('0x71'),'createdAt')[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x52'))['from'](_0x0a9e('0x73'))[_0x0a9e('0x3b')](_0x0a9e('0x74'))['where'](_0x0a9e('0x75'),_0x382687['CmListId'][_0x0a9e('0x72')]())['where'](_0x0a9e('0x76'))['where'](_0x0a9e('0x77'),squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x78'))[_0x0a9e('0x79')](_0x0a9e('0x7a'))[_0x0a9e('0x3b')]('CampaignId\x20=\x20?',_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')]()))['where'](_0x0a9e('0x77'),squel[_0x0a9e('0x6e')]()['field'](_0x0a9e('0x7b'))[_0x0a9e('0x79')](_0x0a9e('0x6a'))['where'](_0x0a9e('0x7c'),_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')]())))[_0x0a9e('0x72')]();break;case _0x0a9e('0x7d'):_0x3db98f=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x6a'))[_0x0a9e('0x6b')]([_0x0a9e('0x70'),'scheduledAt',_0x0a9e('0x6c'),'ListId',_0x0a9e('0x59'),_0x0a9e('0x51'),_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x70'),'phone')[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x7e'))['field']('id',_0x0a9e('0x6c'))[_0x0a9e('0x6f')](_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')](),_0x0a9e('0x6d'))[_0x0a9e('0x6f')](_0x566b90[_0x0a9e('0x46')]['id']['toString'](),_0x0a9e('0x59'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x51'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x52'))['from']('cm_contacts')[_0x0a9e('0x3b')](_0x0a9e('0x74'))[_0x0a9e('0x3b')](_0x0a9e('0x75'),_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')]())[_0x0a9e('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3b')](_0x0a9e('0x77'),squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x7b'))[_0x0a9e('0x79')](_0x0a9e('0x6a'))['where'](_0x0a9e('0x7c'),_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')]())))['toString']();break;default:_0x3db98f=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x6a'))[_0x0a9e('0x6b')](['phone',_0x0a9e('0x7e'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x59'),_0x0a9e('0x51'),_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')]('phone',_0x0a9e('0x70'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x7e'))['field']('id','ContactId')[_0x0a9e('0x6f')](_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')](),'ListId')[_0x0a9e('0x6f')](_0x566b90[_0x0a9e('0x46')]['id']['toString'](),_0x0a9e('0x59'))['field'](_0x0a9e('0x71'),'createdAt')['field']('NOW()',_0x0a9e('0x52'))[_0x0a9e('0x79')](_0x0a9e('0x73'))[_0x0a9e('0x3b')](_0x0a9e('0x74'))[_0x0a9e('0x3b')]('ListId\x20=\x20?',_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')]())[_0x0a9e('0x3b')](_0x0a9e('0x76')))[_0x0a9e('0x72')]();}_0x2b624e[_0x0a9e('0x80')](db[_0x0a9e('0x81')]['query'](_0x3db98f));}return BPromise['all'](_0x2b624e);}})[_0x0a9e('0x21')](function(){return _0x1a9ef1;})['then'](respondWithResult(_0x3b581c,null))[_0x0a9e('0x44')](handleError(_0x3b581c,null));};exports[_0x0a9e('0x82')]=function(_0x1f0318,_0xa3695f,_0x37a448){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x1f0318[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0xa3695f,null))['then'](function(_0x504403){if(_0x504403){return _0x504403['removeLists'](_0x1f0318[_0x0a9e('0x31')]['ids']);}})['then'](function(_0x26223f){if(_0x26223f){return db['CmHopper'][_0x0a9e('0x22')]({'where':{'ListId':_0x1f0318[_0x0a9e('0x31')][_0x0a9e('0x64')],'CampaignId':_0x1f0318['params']['id']}})[_0x0a9e('0x21')](function(){return _0x26223f;});}})[_0x0a9e('0x21')](respondWithStatusCode(_0xa3695f,null))[_0x0a9e('0x44')](handleError(_0xa3695f,null));};exports['getBlackLists']=function(_0x5236c9,_0xdc77d,_0x948aab){var _0x89d2cb={};var _0x2f79fb={};var _0x3b0db2;var _0x376b97;return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x5236c9[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0xdc77d,null))['then'](function(_0x51fa33){if(_0x51fa33){_0x3b0db2=_0x51fa33;_0x2f79fb['model']=_[_0x0a9e('0x32')](db[_0x0a9e('0x61')][_0x0a9e('0x47')]);_0x2f79fb[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x5236c9[_0x0a9e('0x31')]);_0x2f79fb[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x2f79fb['model'],_0x2f79fb['query']);_0x89d2cb[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2f79fb['model'],qs[_0x0a9e('0x36')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x89d2cb[_0x0a9e('0x34')]=_0x89d2cb[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x89d2cb[_0x0a9e('0x34')]:_0x2f79fb[_0x0a9e('0x30')];_0x89d2cb[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x89d2cb['where']=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x5236c9[_0x0a9e('0x31')],_0x2f79fb[_0x0a9e('0x33')]));if(_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x3f')]){_0x89d2cb[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x89d2cb[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x89d2cb[_0x0a9e('0x34')],function(_0x3ba472){var _0x4e6eb9={};_0x4e6eb9[_0x3ba472]={'$like':'%'+_0x5236c9['query'][_0x0a9e('0x3f')]+'%'};return _0x4e6eb9;})});}_0x89d2cb=_[_0x0a9e('0x3d')]({},_0x89d2cb,_0x5236c9[_0x0a9e('0x40')]);return _0x3b0db2[_0x0a9e('0x83')](_0x89d2cb);}})[_0x0a9e('0x21')](function(_0x1e29e2){if(_0x1e29e2){_0x376b97=_0x1e29e2[_0x0a9e('0x37')];if(!_0x5236c9['query'][_0x0a9e('0x58')]('nolimit')){_0x89d2cb[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x89d2cb[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x19')]);}return _0x3b0db2[_0x0a9e('0x83')](_0x89d2cb);}})[_0x0a9e('0x21')](function(_0x39d367){if(_0x39d367){return _0x39d367?{'count':_0x376b97,'rows':_0x39d367}:null;}})[_0x0a9e('0x21')](respondWithResult(_0xdc77d,null))[_0x0a9e('0x44')](handleError(_0xdc77d,null));};exports[_0x0a9e('0x84')]=function(_0x3c8a9a,_0x2d5e00,_0x5b78a8){var _0x54cf62,_0x9dc1de;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3c8a9a['params']['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x2d5e00,null))[_0x0a9e('0x21')](function(_0x3304a1){if(_0x3304a1){_0x9dc1de=_0x3304a1;return _0x3304a1['addBlackLists'](_0x3c8a9a[_0x0a9e('0x4a')]['ids'],_[_0x0a9e('0x53')](_0x3c8a9a['body'],[_0x0a9e('0x64'),'id'])||{});}return null;})['spread'](function(_0x122e7d){var _0x21e210;_0x54cf62=_0x122e7d||[];var _0x1d5432=[];if(_0x122e7d){for(var _0x50e7cc=0x0;_0x50e7cc<_0x122e7d[_0x0a9e('0x37')];_0x50e7cc+=0x1){var _0x497fda=_0x122e7d[_0x50e7cc]['get']({'plain':!![]});_0x21e210=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x85'))[_0x0a9e('0x6b')]([_0x0a9e('0x70'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x59'),_0x0a9e('0x51'),_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x70'))[_0x0a9e('0x6f')]('id',_0x0a9e('0x6c'))[_0x0a9e('0x6f')](_0x497fda[_0x0a9e('0x7f')][_0x0a9e('0x72')](),'ListId')[_0x0a9e('0x6f')](_0x3c8a9a[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')](),_0x0a9e('0x59'))['field']('NOW()','createdAt')[_0x0a9e('0x6f')]('NOW()',_0x0a9e('0x52'))[_0x0a9e('0x79')](_0x0a9e('0x73'))[_0x0a9e('0x3b')](_0x0a9e('0x74'))[_0x0a9e('0x3b')](_0x0a9e('0x75'),_0x497fda[_0x0a9e('0x7f')][_0x0a9e('0x72')]())[_0x0a9e('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x72')]();_0x1d5432['push'](db[_0x0a9e('0x81')]['query'](_0x21e210));}return BPromise[_0x0a9e('0x86')](_0x1d5432);}})[_0x0a9e('0x21')](function(){return _0x54cf62;})[_0x0a9e('0x21')](respondWithResult(_0x2d5e00,null))['catch'](handleError(_0x2d5e00,null));};exports[_0x0a9e('0x87')]=function(_0x2571ae,_0x531377,_0x53c4f0){return db[_0x0a9e('0x2c')][_0x0a9e('0x48')]({'where':{'id':_0x2571ae[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x531377,null))['then'](function(_0x4869c1){if(_0x4869c1){return _0x4869c1[_0x0a9e('0x87')](_0x2571ae[_0x0a9e('0x31')][_0x0a9e('0x64')]);}})[_0x0a9e('0x21')](function(_0x3d4349){if(_0x3d4349){return db[_0x0a9e('0x60')][_0x0a9e('0x22')]({'where':{'ListId':_0x2571ae[_0x0a9e('0x31')][_0x0a9e('0x64')],'CampaignId':_0x2571ae[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](function(){return _0x3d4349;});}})[_0x0a9e('0x21')](respondWithStatusCode(_0x531377,null))[_0x0a9e('0x44')](handleError(_0x531377,null));}; \ No newline at end of file +var _0xa9e0=['ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','scheduledAt','CmListId','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','name','send','index','map','Campaign','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','autoAssociation','update','getHoppers','findOne','hasOwnProperty','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','ListId','select','field','phone','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL'];(function(_0x20498d,_0x12b87f){var _0xb34430=function(_0x1d3fdb){while(--_0x1d3fdb){_0x20498d['push'](_0x20498d['shift']());}};_0xb34430(++_0x12b87f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];function respondWithStatusCode(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xcc;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['sendStatus'](_0x32d742);}return _0x26d672[_0x0a9e('0x16')](_0x32d742)[_0x0a9e('0x17')]();};}function respondWithResult(_0x2b4227,_0x281129){_0x281129=_0x281129||0xc8;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x16')](_0x281129)['json'](_0x44dcfd);}};}function respondWithFilteredResult(_0x22dccb,_0x5d0880){return function(_0x1985b6){if(_0x1985b6){var _0x519dfd=_0x1985b6[_0x0a9e('0x18')],_0x16033c=_0x5d0880['offset'],_0x12066b=_0x5d0880[_0x0a9e('0x19')]+_0x5d0880[_0x0a9e('0x1a')],_0x48f32d;if(_0x12066b>=_0x519dfd){_0x12066b=_0x519dfd;_0x48f32d=0xc8;}else{_0x48f32d=0xce;}_0x22dccb[_0x0a9e('0x16')](_0x48f32d);return _0x22dccb[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x16033c+'-'+_0x12066b+'/'+_0x519dfd)[_0x0a9e('0x1d')](_0x1985b6);}return null;};}function patchUpdates(_0x530eb7){return function(_0x20559e){try{jsonpatch[_0x0a9e('0x1e')](_0x20559e,_0x530eb7,!![]);}catch(_0x112016){return BPromise[_0x0a9e('0x1f')](_0x112016);}return _0x20559e[_0x0a9e('0x20')]();};}function saveUpdates(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['update'](_0x4bb1e3)[_0x0a9e('0x21')](function(_0x5a09ef){return _0x5a09ef;});}return null;};}function removeEntity(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x22')]()[_0x0a9e('0x21')](function(){var _0x4abc77=_0x432e56[_0x0a9e('0x23')]({'plain':!![]});var _0x2fb0e4=_0x0a9e('0x24');return db[_0x0a9e('0x25')][_0x0a9e('0x22')]({'where':{'type':_0x2fb0e4,'resourceId':_0x4abc77['id']}})[_0x0a9e('0x21')](function(){return _0x432e56;});})[_0x0a9e('0x21')](function(){_0x588269['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197ec0,_0x3a8e58){return function(_0x40c424){if(!_0x40c424){_0x197ec0[_0x0a9e('0x26')](0x194);}return _0x40c424;};}function handleError(_0x526cf3,_0x384319){_0x384319=_0x384319||0x1f4;return function(_0x479bc4){logger[_0x0a9e('0x27')](_0x479bc4['stack']);if(_0x479bc4[_0x0a9e('0x28')]){delete _0x479bc4[_0x0a9e('0x28')];}_0x526cf3[_0x0a9e('0x16')](_0x384319)[_0x0a9e('0x29')](_0x479bc4);};}exports[_0x0a9e('0x2a')]=function(_0x1538a4,_0x11c3b6){var _0x14de77={},_0x5a101a={},_0x3652a7={'count':0x0,'rows':[]};var _0x468813=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')]['rawAttributes'],function(_0x15b200){return{'name':_0x15b200[_0x0a9e('0x2d')],'type':_0x15b200[_0x0a9e('0x2e')][_0x0a9e('0x2f')]};});_0x5a101a[_0x0a9e('0x30')]=_[_0x0a9e('0x2b')](_0x468813,_0x0a9e('0x28'));_0x5a101a[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x1538a4['query']);_0x5a101a[_0x0a9e('0x33')]=_['intersection'](_0x5a101a[_0x0a9e('0x30')],_0x5a101a[_0x0a9e('0x31')]);_0x14de77[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x5a101a[_0x0a9e('0x30')],qs['fields'](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x14de77[_0x0a9e('0x34')]=_0x14de77[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x14de77[_0x0a9e('0x34')]:_0x5a101a[_0x0a9e('0x30')];if(!_0x1538a4[_0x0a9e('0x31')]['hasOwnProperty'](_0x0a9e('0x38'))){_0x14de77['limit']=qs[_0x0a9e('0x1a')](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x14de77[_0x0a9e('0x19')]=qs['offset'](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x19')]);}_0x14de77[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x1538a4['query']['sort']);_0x14de77[_0x0a9e('0x3b')]=qs['filters'](_[_0x0a9e('0x3c')](_0x1538a4[_0x0a9e('0x31')],_0x5a101a[_0x0a9e('0x33')]),_0x468813);if(_0x1538a4[_0x0a9e('0x31')]['filter']){_0x14de77[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x14de77[_0x0a9e('0x3b')],{'$or':_['map'](_0x468813,function(_0x1dbf74){if(_0x1dbf74[_0x0a9e('0x2e')]!==_0x0a9e('0x3e')){var _0x4c1c0e={};_0x4c1c0e[_0x1dbf74['name']]={'$like':'%'+_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x4c1c0e;}})});}_0x14de77=_['merge']({},_0x14de77,_0x1538a4[_0x0a9e('0x40')]);var _0x419125={'where':_0x14de77[_0x0a9e('0x3b')]};return db[_0x0a9e('0x2c')]['count'](_0x419125)['then'](function(_0x15e37d){_0x3652a7[_0x0a9e('0x18')]=_0x15e37d;if(_0x1538a4['query'][_0x0a9e('0x41')]){_0x14de77[_0x0a9e('0x42')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')]['findAll'](_0x14de77);})[_0x0a9e('0x21')](function(_0x2cfea9){_0x3652a7[_0x0a9e('0x43')]=_0x2cfea9;return _0x3652a7;})[_0x0a9e('0x21')](respondWithFilteredResult(_0x11c3b6,_0x14de77))[_0x0a9e('0x44')](handleError(_0x11c3b6,null));};exports[_0x0a9e('0x45')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x46')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x2c')][_0x0a9e('0x47')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x31')]);_0x3da2cd[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x3da2cd[_0x0a9e('0x30')],_0x3da2cd[_0x0a9e('0x31')]);_0x23b089[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x3da2cd[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x2881b3[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x23b089[_0x0a9e('0x34')]=_0x23b089['attributes'][_0x0a9e('0x37')]?_0x23b089[_0x0a9e('0x34')]:_0x3da2cd[_0x0a9e('0x30')];if(_0x2881b3[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x23b089[_0x0a9e('0x42')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x3d')]({},_0x23b089,_0x2881b3[_0x0a9e('0x40')]);return db['Campaign'][_0x0a9e('0x48')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x21')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x44')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x49')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x562fb4[_0x0a9e('0x4a')],{})[_0x0a9e('0x21')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x23')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x4b'));if(_0x45bf7f[_0x0a9e('0x4c')]===_0x0a9e('0x4d')){var _0x409789=_0x37be73[_0x0a9e('0x23')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x24');return db[_0x0a9e('0x4e')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4f')]},'raw':!![]})[_0x0a9e('0x21')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x49')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x21')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x44')](function(_0x30decb){logger[_0x0a9e('0x27')](_0x0a9e('0x50'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['clone']=function(_0x39d77d,_0x204173){var _0x14d602={'where':{'id':_0x39d77d[_0x0a9e('0x46')]['id']}},_0x5bb3ed={};_0x5bb3ed[_0x0a9e('0x30')]=_['keys'](db['Campaign'][_0x0a9e('0x47')]);_0x14d602['attributes']=_[_0x0a9e('0x35')](_0x5bb3ed['model'],qs[_0x0a9e('0x36')](_0x39d77d[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x14d602['attributes']=_0x14d602[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x14d602['attributes']:_0x5bb3ed['model'];if(_0x39d77d[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x14d602['include']=[{'all':!![]}];}_0x14d602=_[_0x0a9e('0x3d')]({},_0x14d602,_0x39d77d['options']);return db[_0x0a9e('0x2c')]['find'](_0x14d602)[_0x0a9e('0x21')](handleEntityNotFound(_0x204173,null))['then'](function(_0x5da27d){if(_0x5da27d){var _0x5df0ad=_0x5da27d[_0x0a9e('0x23')]({'plain':!![]});_0x5df0ad=qs['omit'](_0x5df0ad,['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);_0x39d77d[_0x0a9e('0x4a')]=_[_0x0a9e('0x53')](_0x39d77d[_0x0a9e('0x4a')],['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2c')]['create'](_[_0x0a9e('0x3d')](_0x5df0ad,_0x39d77d[_0x0a9e('0x4a')]),{'include':_0x39d77d[_0x0a9e('0x31')][_0x0a9e('0x41')]?[{'all':!![]}]:undefined})[_0x0a9e('0x21')](function(_0x156662){var _0x5d86e9=_0x39d77d[_0x0a9e('0x4d')][_0x0a9e('0x23')]({'plain':!![]});if(!_0x5d86e9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d86e9[_0x0a9e('0x4c')]==='user'){var _0x20c668=_0x156662['get']({'plain':!![]});var _0x4b3c1a='IvrCampaigns';return db[_0x0a9e('0x4e')]['find']({'where':{'name':_0x4b3c1a,'userProfileId':_0x5d86e9[_0x0a9e('0x4f')]},'raw':!![]})[_0x0a9e('0x21')](function(_0x261adb){if(_0x261adb&&_0x261adb[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x49')]({'name':_0x20c668['name'],'resourceId':_0x20c668['id'],'type':_0x261adb[_0x0a9e('0x28')],'sectionId':_0x261adb['id']},{})['then'](function(){return _0x156662;});}else{return _0x156662;}})[_0x0a9e('0x44')](function(_0x1f07cb){logger[_0x0a9e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f07cb);throw _0x1f07cb;});}return _0x156662;});}})[_0x0a9e('0x21')](respondWithResult(_0x204173,0xc9))[_0x0a9e('0x44')](handleError(_0x204173,null));};exports[_0x0a9e('0x55')]=function(_0x32e134,_0x497d91){if(_0x32e134[_0x0a9e('0x4a')]['id']){delete _0x32e134[_0x0a9e('0x4a')]['id'];}return db['Campaign'][_0x0a9e('0x48')]({'where':{'id':_0x32e134[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x497d91,null))[_0x0a9e('0x21')](saveUpdates(_0x32e134[_0x0a9e('0x4a')],null))['then'](respondWithResult(_0x497d91,null))[_0x0a9e('0x44')](handleError(_0x497d91,null));};exports[_0x0a9e('0x22')]=function(_0x281c7d,_0x47bb43){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x281c7d['params']['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x47bb43,null))[_0x0a9e('0x21')](removeEntity(_0x47bb43,null))[_0x0a9e('0x44')](handleError(_0x47bb43,null));};exports[_0x0a9e('0x56')]=function(_0x186f39,_0xc8c264,_0x387489){var _0x54a37d={'raw':!![],'where':{}};var _0x2d7205={};var _0x1cc4f3={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x186f39[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0xc8c264,null))[_0x0a9e('0x21')](function(_0x412a72){if(_0x412a72){_0x2d7205[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db['CmHopper'][_0x0a9e('0x47')]);_0x2d7205[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x186f39['query']);_0x2d7205[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x2d7205['model'],_0x2d7205[_0x0a9e('0x31')]);_0x54a37d[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2d7205[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x186f39['query']['fields']));_0x54a37d['attributes']=_0x54a37d[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x54a37d[_0x0a9e('0x34')]:_0x2d7205[_0x0a9e('0x30')];if(!_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x58')](_0x0a9e('0x38'))){_0x54a37d[_0x0a9e('0x1a')]=qs['limit'](_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x54a37d[_0x0a9e('0x19')]=qs['offset'](_0x186f39[_0x0a9e('0x31')]['offset']);}_0x54a37d[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x186f39['query'][_0x0a9e('0x3a')]);_0x54a37d[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x186f39['query'],_0x2d7205[_0x0a9e('0x33')]));_0x54a37d[_0x0a9e('0x3b')][_0x0a9e('0x59')]=_0x412a72['id'];if(_0x186f39[_0x0a9e('0x31')]['filter']){_0x54a37d[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x54a37d[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x54a37d['attributes'],function(_0x290d43){var _0x3511c9={};_0x3511c9[_0x290d43]={'$like':'%'+_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x3511c9;})});}_0x54a37d=_[_0x0a9e('0x3d')]({},_0x54a37d,_0x186f39[_0x0a9e('0x40')]);return db[_0x0a9e('0x5a')][_0x0a9e('0x18')]({'where':_0x54a37d[_0x0a9e('0x3b')]})[_0x0a9e('0x21')](function(_0xc4c230){_0x1cc4f3[_0x0a9e('0x18')]=_0xc4c230;if(_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x54a37d['include']=[{'all':!![]}];}return db[_0x0a9e('0x5a')][_0x0a9e('0x5b')](_0x54a37d);})[_0x0a9e('0x21')](function(_0x563627){_0x1cc4f3[_0x0a9e('0x43')]=_0x563627;return _0x1cc4f3;});}})[_0x0a9e('0x21')](respondWithFilteredResult(_0xc8c264,_0x54a37d))[_0x0a9e('0x44')](handleError(_0xc8c264,null));};exports[_0x0a9e('0x5c')]=function(_0x56d650,_0x541e80,_0x7ebea8){var _0x2bbdb5={'raw':!![],'where':{}};var _0x4c54fa={};var _0x45108c={'count':0x0,'rows':[]};return db['Campaign'][_0x0a9e('0x57')]({'where':{'id':_0x56d650[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x21')](function(_0x41cf12){if(_0x41cf12){_0x4c54fa[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x5d')][_0x0a9e('0x47')]);_0x4c54fa[_0x0a9e('0x31')]=_['keys'](_0x56d650[_0x0a9e('0x31')]);_0x4c54fa[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x4c54fa[_0x0a9e('0x30')],_0x4c54fa['query']);_0x2bbdb5[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x4c54fa['model'],qs[_0x0a9e('0x36')](_0x56d650['query'][_0x0a9e('0x36')]));_0x2bbdb5[_0x0a9e('0x34')]=_0x2bbdb5[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x2bbdb5['attributes']:_0x4c54fa['model'];if(!_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x58')](_0x0a9e('0x38'))){_0x2bbdb5['limit']=qs[_0x0a9e('0x1a')](_0x56d650[_0x0a9e('0x31')]['limit']);_0x2bbdb5['offset']=qs[_0x0a9e('0x19')](_0x56d650['query']['offset']);}_0x2bbdb5['order']=qs[_0x0a9e('0x3a')](_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x2bbdb5[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x56d650['query'],_0x4c54fa[_0x0a9e('0x33')]));_0x2bbdb5['where'][_0x0a9e('0x59')]=_0x41cf12['id'];if(_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x3f')]){_0x2bbdb5[_0x0a9e('0x3b')]=_['merge'](_0x2bbdb5[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x2bbdb5[_0x0a9e('0x34')],function(_0x5b74c3){var _0xb6e411={};_0xb6e411[_0x5b74c3]={'$like':'%'+_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0xb6e411;})});}_0x2bbdb5=_[_0x0a9e('0x3d')]({},_0x2bbdb5,_0x56d650[_0x0a9e('0x40')]);return db[_0x0a9e('0x5d')][_0x0a9e('0x18')]({'where':_0x2bbdb5[_0x0a9e('0x3b')]})['then'](function(_0x2645d6){_0x45108c[_0x0a9e('0x18')]=_0x2645d6;if(_0x56d650['query'][_0x0a9e('0x41')]){_0x2bbdb5[_0x0a9e('0x42')]=[{'all':!![]}];}return db[_0x0a9e('0x5d')]['findAll'](_0x2bbdb5);})[_0x0a9e('0x21')](function(_0x52ec10){_0x45108c[_0x0a9e('0x43')]=_0x52ec10;return _0x45108c;});}})[_0x0a9e('0x21')](respondWithFilteredResult(_0x541e80,_0x2bbdb5))[_0x0a9e('0x44')](handleError(_0x541e80,null));};exports[_0x0a9e('0x5e')]=function(_0x842d6f,_0x16341a,_0x16a039){var _0x3a9a85={'raw':!![],'where':{}};var _0x501050={};var _0x329d88={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x842d6f[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x16341a,null))[_0x0a9e('0x21')](function(_0x6803d6){if(_0x6803d6){_0x501050[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x5f')][_0x0a9e('0x47')]);_0x501050[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x842d6f['query']);_0x501050[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x501050[_0x0a9e('0x30')],_0x501050[_0x0a9e('0x31')]);_0x3a9a85[_0x0a9e('0x34')]=_['intersection'](_0x501050[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x842d6f['query'][_0x0a9e('0x36')]));_0x3a9a85['attributes']=_0x3a9a85[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x3a9a85[_0x0a9e('0x34')]:_0x501050[_0x0a9e('0x30')];if(!_0x842d6f['query'][_0x0a9e('0x58')]('nolimit')){_0x3a9a85[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x842d6f['query'][_0x0a9e('0x1a')]);_0x3a9a85[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x842d6f['query']['offset']);}_0x3a9a85[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x842d6f[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x3a9a85[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x842d6f[_0x0a9e('0x31')],_0x501050[_0x0a9e('0x33')]));_0x3a9a85['where'][_0x0a9e('0x59')]=_0x6803d6['id'];if(_0x842d6f['query'][_0x0a9e('0x3f')]){_0x3a9a85[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x3a9a85[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x3a9a85['attributes'],function(_0x436313){var _0x4667bf={};_0x4667bf[_0x436313]={'$like':'%'+_0x842d6f[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x4667bf;})});}_0x3a9a85=_[_0x0a9e('0x3d')]({},_0x3a9a85,_0x842d6f['options']);return db['CmHopperFinal'][_0x0a9e('0x18')]({'where':_0x3a9a85['where']})[_0x0a9e('0x21')](function(_0x4658df){_0x329d88[_0x0a9e('0x18')]=_0x4658df;if(_0x842d6f[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x3a9a85[_0x0a9e('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x3a9a85);})[_0x0a9e('0x21')](function(_0x5dfbe2){_0x329d88[_0x0a9e('0x43')]=_0x5dfbe2;return _0x329d88;});}})['then'](respondWithFilteredResult(_0x16341a,_0x3a9a85))[_0x0a9e('0x44')](handleError(_0x16341a,null));};exports['getHopperBlacks']=function(_0x558d60,_0x1c49dc,_0xb8db59){var _0x5e9b0b={'raw':!![],'where':{}};var _0x170af6={};var _0x17cb30={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x558d60[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c49dc,null))['then'](function(_0x16449b){if(_0x16449b){_0x170af6[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x60')][_0x0a9e('0x47')]);_0x170af6['query']=_[_0x0a9e('0x32')](_0x558d60[_0x0a9e('0x31')]);_0x170af6['filters']=_[_0x0a9e('0x35')](_0x170af6[_0x0a9e('0x30')],_0x170af6[_0x0a9e('0x31')]);_0x5e9b0b[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x170af6[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x5e9b0b[_0x0a9e('0x34')]=_0x5e9b0b['attributes'][_0x0a9e('0x37')]?_0x5e9b0b[_0x0a9e('0x34')]:_0x170af6[_0x0a9e('0x30')];if(!_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x58')]('nolimit')){_0x5e9b0b['limit']=qs[_0x0a9e('0x1a')](_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x5e9b0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x558d60['query'][_0x0a9e('0x19')]);}_0x5e9b0b[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x558d60['query'][_0x0a9e('0x3a')]);_0x5e9b0b['where']=qs[_0x0a9e('0x33')](_['pick'](_0x558d60[_0x0a9e('0x31')],_0x170af6[_0x0a9e('0x33')]));_0x5e9b0b[_0x0a9e('0x3b')]['CampaignId']=_0x16449b['id'];if(_0x558d60[_0x0a9e('0x31')]['filter']){_0x5e9b0b[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x5e9b0b[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x5e9b0b[_0x0a9e('0x34')],function(_0x1bee04){var _0x4014c7={};_0x4014c7[_0x1bee04]={'$like':'%'+_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x4014c7;})});}_0x5e9b0b=_[_0x0a9e('0x3d')]({},_0x5e9b0b,_0x558d60[_0x0a9e('0x40')]);return db[_0x0a9e('0x60')][_0x0a9e('0x18')]({'where':_0x5e9b0b[_0x0a9e('0x3b')]})[_0x0a9e('0x21')](function(_0x248368){_0x17cb30['count']=_0x248368;if(_0x558d60['query'][_0x0a9e('0x41')]){_0x5e9b0b['include']=[{'all':!![]}];}return db[_0x0a9e('0x60')][_0x0a9e('0x5b')](_0x5e9b0b);})['then'](function(_0x1a3754){_0x17cb30[_0x0a9e('0x43')]=_0x1a3754;return _0x17cb30;});}})[_0x0a9e('0x21')](respondWithFilteredResult(_0x1c49dc,_0x5e9b0b))[_0x0a9e('0x44')](handleError(_0x1c49dc,null));};exports['getLists']=function(_0x148fd9,_0x26cb76,_0x374f0b){var _0x34a791={};var _0x5d0e1f={};var _0x19e9ed;var _0x1a0b08;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x148fd9[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x26cb76,null))[_0x0a9e('0x21')](function(_0x54b107){if(_0x54b107){_0x19e9ed=_0x54b107;_0x5d0e1f[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x61')][_0x0a9e('0x47')]);_0x5d0e1f[_0x0a9e('0x31')]=_['keys'](_0x148fd9[_0x0a9e('0x31')]);_0x5d0e1f[_0x0a9e('0x33')]=_['intersection'](_0x5d0e1f[_0x0a9e('0x30')],_0x5d0e1f[_0x0a9e('0x31')]);_0x34a791[_0x0a9e('0x34')]=_['intersection'](_0x5d0e1f['model'],qs['fields'](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x34a791['attributes']=_0x34a791[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x34a791[_0x0a9e('0x34')]:_0x5d0e1f['model'];_0x34a791[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x34a791[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x148fd9[_0x0a9e('0x31')],_0x5d0e1f[_0x0a9e('0x33')]));if(_0x148fd9['query'][_0x0a9e('0x3f')]){_0x34a791['where']=_[_0x0a9e('0x3d')](_0x34a791[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x34a791[_0x0a9e('0x34')],function(_0x407e9d){var _0x344cd4={};_0x344cd4[_0x407e9d]={'$like':'%'+_0x148fd9['query'][_0x0a9e('0x3f')]+'%'};return _0x344cd4;})});}_0x34a791=_[_0x0a9e('0x3d')]({},_0x34a791,_0x148fd9[_0x0a9e('0x40')]);return _0x19e9ed[_0x0a9e('0x62')](_0x34a791);}})['then'](function(_0x2e4887){if(_0x2e4887){_0x1a0b08=_0x2e4887[_0x0a9e('0x37')];if(!_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x58')](_0x0a9e('0x38'))){_0x34a791[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x34a791[_0x0a9e('0x19')]=qs['offset'](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x19')]);}return _0x19e9ed[_0x0a9e('0x62')](_0x34a791);}})[_0x0a9e('0x21')](function(_0xea8bd1){if(_0xea8bd1){return _0xea8bd1?{'count':_0x1a0b08,'rows':_0xea8bd1}:null;}})[_0x0a9e('0x21')](respondWithResult(_0x26cb76,null))[_0x0a9e('0x44')](handleError(_0x26cb76,null));};exports[_0x0a9e('0x63')]=function(_0x566b90,_0x3b581c,_0xd2391){var _0x1a9ef1,_0x5c65fc;return db[_0x0a9e('0x2c')][_0x0a9e('0x48')]({'where':{'id':_0x566b90[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x3b581c,null))[_0x0a9e('0x21')](function(_0x1ba457){if(_0x1ba457){_0x5c65fc=_0x1ba457;return _0x1ba457[_0x0a9e('0x63')](_0x566b90[_0x0a9e('0x4a')][_0x0a9e('0x64')],_[_0x0a9e('0x53')](_0x566b90['body'],[_0x0a9e('0x64'),'id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x15a9ed){var _0x3db98f;_0x1a9ef1=_0x15a9ed||[];var _0x2b624e=[];if(_0x15a9ed){for(var _0x3942fd=0x0;_0x3942fd<_0x15a9ed['length'];_0x3942fd+=0x1){var _0x382687=_0x15a9ed[_0x3942fd]['get']({'plain':!![]});_0x5c65fc['dialCheckDuplicateType']=_0x566b90['body'][_0x0a9e('0x66')]?_0x566b90[_0x0a9e('0x4a')][_0x0a9e('0x66')]:_0x5c65fc[_0x0a9e('0x66')];switch(_0x5c65fc['dialCheckDuplicateType']){case _0x0a9e('0x67'):_0x3db98f=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x6a'))[_0x0a9e('0x6b')](['phone','scheduledAt',_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x59'),'createdAt',_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')]('phone',_0x0a9e('0x70'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),'scheduledAt')[_0x0a9e('0x6f')]('id',_0x0a9e('0x6c'))[_0x0a9e('0x6f')](_0x382687['CmListId']['toString'](),'ListId')[_0x0a9e('0x6f')](_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')](),_0x0a9e('0x59'))['field'](_0x0a9e('0x71'),'createdAt')[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x52'))['from'](_0x0a9e('0x73'))[_0x0a9e('0x3b')](_0x0a9e('0x74'))['where'](_0x0a9e('0x75'),_0x382687['CmListId'][_0x0a9e('0x72')]())['where'](_0x0a9e('0x76'))['where'](_0x0a9e('0x77'),squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x78'))[_0x0a9e('0x79')](_0x0a9e('0x7a'))[_0x0a9e('0x3b')]('CampaignId\x20=\x20?',_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')]()))['where'](_0x0a9e('0x77'),squel[_0x0a9e('0x6e')]()['field'](_0x0a9e('0x7b'))[_0x0a9e('0x79')](_0x0a9e('0x6a'))['where'](_0x0a9e('0x7c'),_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')]())))[_0x0a9e('0x72')]();break;case _0x0a9e('0x7d'):_0x3db98f=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x6a'))[_0x0a9e('0x6b')]([_0x0a9e('0x70'),'scheduledAt',_0x0a9e('0x6c'),'ListId',_0x0a9e('0x59'),_0x0a9e('0x51'),_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x70'),'phone')[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x7e'))['field']('id',_0x0a9e('0x6c'))[_0x0a9e('0x6f')](_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')](),_0x0a9e('0x6d'))[_0x0a9e('0x6f')](_0x566b90[_0x0a9e('0x46')]['id']['toString'](),_0x0a9e('0x59'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x51'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x52'))['from']('cm_contacts')[_0x0a9e('0x3b')](_0x0a9e('0x74'))[_0x0a9e('0x3b')](_0x0a9e('0x75'),_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')]())[_0x0a9e('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3b')](_0x0a9e('0x77'),squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x7b'))[_0x0a9e('0x79')](_0x0a9e('0x6a'))['where'](_0x0a9e('0x7c'),_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')]())))['toString']();break;default:_0x3db98f=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x6a'))[_0x0a9e('0x6b')](['phone',_0x0a9e('0x7e'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x59'),_0x0a9e('0x51'),_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')]('phone',_0x0a9e('0x70'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x7e'))['field']('id','ContactId')[_0x0a9e('0x6f')](_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')](),'ListId')[_0x0a9e('0x6f')](_0x566b90[_0x0a9e('0x46')]['id']['toString'](),_0x0a9e('0x59'))['field'](_0x0a9e('0x71'),'createdAt')['field']('NOW()',_0x0a9e('0x52'))[_0x0a9e('0x79')](_0x0a9e('0x73'))[_0x0a9e('0x3b')](_0x0a9e('0x74'))[_0x0a9e('0x3b')]('ListId\x20=\x20?',_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')]())[_0x0a9e('0x3b')](_0x0a9e('0x76')))[_0x0a9e('0x72')]();}_0x2b624e[_0x0a9e('0x80')](db[_0x0a9e('0x81')]['query'](_0x3db98f));}return BPromise['all'](_0x2b624e);}})[_0x0a9e('0x21')](function(){return _0x1a9ef1;})['then'](respondWithResult(_0x3b581c,null))[_0x0a9e('0x44')](handleError(_0x3b581c,null));};exports[_0x0a9e('0x82')]=function(_0x1f0318,_0xa3695f,_0x37a448){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x1f0318[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0xa3695f,null))['then'](function(_0x504403){if(_0x504403){return _0x504403['removeLists'](_0x1f0318[_0x0a9e('0x31')]['ids']);}})['then'](function(_0x26223f){if(_0x26223f){return db['CmHopper'][_0x0a9e('0x22')]({'where':{'ListId':_0x1f0318[_0x0a9e('0x31')][_0x0a9e('0x64')],'CampaignId':_0x1f0318['params']['id']}})[_0x0a9e('0x21')](function(){return _0x26223f;});}})[_0x0a9e('0x21')](respondWithStatusCode(_0xa3695f,null))[_0x0a9e('0x44')](handleError(_0xa3695f,null));};exports['getBlackLists']=function(_0x5236c9,_0xdc77d,_0x948aab){var _0x89d2cb={};var _0x2f79fb={};var _0x3b0db2;var _0x376b97;return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x5236c9[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0xdc77d,null))['then'](function(_0x51fa33){if(_0x51fa33){_0x3b0db2=_0x51fa33;_0x2f79fb['model']=_[_0x0a9e('0x32')](db[_0x0a9e('0x61')][_0x0a9e('0x47')]);_0x2f79fb[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x5236c9[_0x0a9e('0x31')]);_0x2f79fb[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x2f79fb['model'],_0x2f79fb['query']);_0x89d2cb[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2f79fb['model'],qs[_0x0a9e('0x36')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x89d2cb[_0x0a9e('0x34')]=_0x89d2cb[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x89d2cb[_0x0a9e('0x34')]:_0x2f79fb[_0x0a9e('0x30')];_0x89d2cb[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x89d2cb['where']=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x5236c9[_0x0a9e('0x31')],_0x2f79fb[_0x0a9e('0x33')]));if(_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x3f')]){_0x89d2cb[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x89d2cb[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x89d2cb[_0x0a9e('0x34')],function(_0x3ba472){var _0x4e6eb9={};_0x4e6eb9[_0x3ba472]={'$like':'%'+_0x5236c9['query'][_0x0a9e('0x3f')]+'%'};return _0x4e6eb9;})});}_0x89d2cb=_[_0x0a9e('0x3d')]({},_0x89d2cb,_0x5236c9[_0x0a9e('0x40')]);return _0x3b0db2[_0x0a9e('0x83')](_0x89d2cb);}})[_0x0a9e('0x21')](function(_0x1e29e2){if(_0x1e29e2){_0x376b97=_0x1e29e2[_0x0a9e('0x37')];if(!_0x5236c9['query'][_0x0a9e('0x58')]('nolimit')){_0x89d2cb[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x89d2cb[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x19')]);}return _0x3b0db2[_0x0a9e('0x83')](_0x89d2cb);}})[_0x0a9e('0x21')](function(_0x39d367){if(_0x39d367){return _0x39d367?{'count':_0x376b97,'rows':_0x39d367}:null;}})[_0x0a9e('0x21')](respondWithResult(_0xdc77d,null))[_0x0a9e('0x44')](handleError(_0xdc77d,null));};exports[_0x0a9e('0x84')]=function(_0x3c8a9a,_0x2d5e00,_0x5b78a8){var _0x54cf62,_0x9dc1de;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3c8a9a['params']['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x2d5e00,null))[_0x0a9e('0x21')](function(_0x3304a1){if(_0x3304a1){_0x9dc1de=_0x3304a1;return _0x3304a1['addBlackLists'](_0x3c8a9a[_0x0a9e('0x4a')]['ids'],_[_0x0a9e('0x53')](_0x3c8a9a['body'],[_0x0a9e('0x64'),'id'])||{});}return null;})['spread'](function(_0x122e7d){var _0x21e210;_0x54cf62=_0x122e7d||[];var _0x1d5432=[];if(_0x122e7d){for(var _0x50e7cc=0x0;_0x50e7cc<_0x122e7d[_0x0a9e('0x37')];_0x50e7cc+=0x1){var _0x497fda=_0x122e7d[_0x50e7cc]['get']({'plain':!![]});_0x21e210=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x85'))[_0x0a9e('0x6b')]([_0x0a9e('0x70'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x59'),_0x0a9e('0x51'),_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x70'))[_0x0a9e('0x6f')]('id',_0x0a9e('0x6c'))[_0x0a9e('0x6f')](_0x497fda[_0x0a9e('0x7f')][_0x0a9e('0x72')](),'ListId')[_0x0a9e('0x6f')](_0x3c8a9a[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')](),_0x0a9e('0x59'))['field']('NOW()','createdAt')[_0x0a9e('0x6f')]('NOW()',_0x0a9e('0x52'))[_0x0a9e('0x79')](_0x0a9e('0x73'))[_0x0a9e('0x3b')](_0x0a9e('0x74'))[_0x0a9e('0x3b')](_0x0a9e('0x75'),_0x497fda[_0x0a9e('0x7f')][_0x0a9e('0x72')]())[_0x0a9e('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x72')]();_0x1d5432['push'](db[_0x0a9e('0x81')]['query'](_0x21e210));}return BPromise[_0x0a9e('0x86')](_0x1d5432);}})[_0x0a9e('0x21')](function(){return _0x54cf62;})[_0x0a9e('0x21')](respondWithResult(_0x2d5e00,null))['catch'](handleError(_0x2d5e00,null));};exports[_0x0a9e('0x87')]=function(_0x2571ae,_0x531377,_0x53c4f0){return db[_0x0a9e('0x2c')][_0x0a9e('0x48')]({'where':{'id':_0x2571ae[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x531377,null))['then'](function(_0x4869c1){if(_0x4869c1){return _0x4869c1[_0x0a9e('0x87')](_0x2571ae[_0x0a9e('0x31')][_0x0a9e('0x64')]);}})[_0x0a9e('0x21')](function(_0x3d4349){if(_0x3d4349){return db[_0x0a9e('0x60')][_0x0a9e('0x22')]({'where':{'ListId':_0x2571ae[_0x0a9e('0x31')][_0x0a9e('0x64')],'CampaignId':_0x2571ae[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](function(){return _0x3d4349;});}})[_0x0a9e('0x21')](respondWithStatusCode(_0x531377,null))[_0x0a9e('0x44')](handleError(_0x531377,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index e3266e7..51f5b30 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 _0xf828=['request-promise','./campaign.attributes','exports','define','Campaign','campaigns','lodash','../../config/logger','moment','bluebird'];(function(_0x4f6e4f,_0x4dd2d5){var _0x13ba8f=function(_0x568054){while(--_0x568054){_0x4f6e4f['push'](_0x4f6e4f['shift']());}};_0x13ba8f(++_0x4dd2d5);}(_0xf828,0x146));var _0x8f82=function(_0x4d4c10,_0x37a7f6){_0x4d4c10=_0x4d4c10-0x0;var _0x152e03=_0xf828[_0x4d4c10];return _0x152e03;};'use strict';var _=require(_0x8f82('0x0'));var util=require('util');var logger=require(_0x8f82('0x1'))('api');var moment=require(_0x8f82('0x2'));var BPromise=require(_0x8f82('0x3'));var rp=require(_0x8f82('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8f82('0x5'));module[_0x8f82('0x6')]=function(_0x45d50a,_0x58af70){return _0x45d50a[_0x8f82('0x7')](_0x8f82('0x8'),attributes,{'tableName':_0x8f82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cff=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./campaign.attributes','Campaign','lodash'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0x2cff,0x10d));var _0xf2cf=function(_0x57bb29,_0x4233ea){_0x57bb29=_0x57bb29-0x0;var _0x1dfe9a=_0x2cff[_0x57bb29];return _0x1dfe9a;};'use strict';var _=require(_0xf2cf('0x0'));var util=require(_0xf2cf('0x1'));var logger=require(_0xf2cf('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf2cf('0x3'));var rp=require(_0xf2cf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2cf('0x5'));var config=require(_0xf2cf('0x6'));var attributes=require(_0xf2cf('0x7'));module['exports']=function(_0x457124,_0xe41399){return _0x457124['define'](_0xf2cf('0x8'),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 d2fc678..1bc2bbc 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 _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x35641f,_0xcf9399){var _0xeadfe8=function(_0x32ceb4){while(--_0x32ceb4){_0x35641f['push'](_0x35641f['shift']());}};_0xeadfe8(++_0xcf9399);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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['GetCampaign']=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')]));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x3ffc95,_0x299691){var _0x6b38cd=function(_0x417987){while(--_0x417987){_0x3ffc95['push'](_0x3ffc95['shift']());}};_0x6b38cd(++_0x299691);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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['GetCampaign']=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')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 759ae29..19e61af 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 _0xf3eb=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/lists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','put','update','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x48de9e,_0x144e00){var _0x20e60f=function(_0x2f65a3){while(--_0x2f65a3){_0x48de9e['push'](_0x48de9e['shift']());}};_0x20e60f(++_0x144e00);}(_0xf3eb,0xf7));var _0xbf3e=function(_0x111dca,_0x4edf9c){_0x111dca=_0x111dca-0x0;var _0x53b7ff=_0xf3eb[_0x111dca];return _0x53b7ff;};'use strict';var multer=require('multer');var util=require(_0xbf3e('0x0'));var path=require(_0xbf3e('0x1'));var timeout=require(_0xbf3e('0x2'));var express=require(_0xbf3e('0x3'));var router=express[_0xbf3e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf3e('0x5'));var config=require(_0xbf3e('0x6'));var controller=require('./campaign.controller');router['get']('/',auth[_0xbf3e('0x7')](),controller[_0xbf3e('0x8')]);router[_0xbf3e('0x9')](_0xbf3e('0xa'),auth[_0xbf3e('0x7')](),controller[_0xbf3e('0xb')]);router[_0xbf3e('0x9')]('/:id/hoppers',auth[_0xbf3e('0x7')](),controller[_0xbf3e('0xc')]);router[_0xbf3e('0x9')]('/:id/hopper_histories',auth[_0xbf3e('0x7')](),controller[_0xbf3e('0xd')]);router[_0xbf3e('0x9')](_0xbf3e('0xe'),auth[_0xbf3e('0x7')](),controller['getHopperFinals']);router[_0xbf3e('0x9')]('/:id/hopper_black',auth[_0xbf3e('0x7')](),controller[_0xbf3e('0xf')]);router[_0xbf3e('0x9')](_0xbf3e('0x10'),auth[_0xbf3e('0x7')](),controller['getLists']);router['get']('/:id/blacklists',auth[_0xbf3e('0x7')](),controller[_0xbf3e('0x11')]);router[_0xbf3e('0x12')]('/',auth[_0xbf3e('0x7')](),controller[_0xbf3e('0x13')]);router['post'](_0xbf3e('0x14'),auth[_0xbf3e('0x7')](),controller[_0xbf3e('0x15')]);router[_0xbf3e('0x12')](_0xbf3e('0x10'),auth[_0xbf3e('0x7')](),controller[_0xbf3e('0x16')]);router['post'](_0xbf3e('0x17'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0xbf3e('0x18')](_0xbf3e('0xa'),auth[_0xbf3e('0x7')](),controller[_0xbf3e('0x19')]);router['delete'](_0xbf3e('0xa'),auth[_0xbf3e('0x7')](),controller['destroy']);router[_0xbf3e('0x1a')](_0xbf3e('0x10'),auth[_0xbf3e('0x7')](),controller['removeLists']);router[_0xbf3e('0x1a')]('/:id/blacklists',auth[_0xbf3e('0x7')](),controller['removeBlackLists']);module[_0xbf3e('0x1b')]=router; \ No newline at end of file +var _0x7491=['isAuthenticated','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','/:id/blacklists','addBlackLists','/:id','update','delete','removeLists','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x7491,0x1c9));var _0x1749=function(_0x4388a5,_0x3d83e0){_0x4388a5=_0x4388a5-0x0;var _0x35246b=_0x7491[_0x4388a5];return _0x35246b;};'use strict';var multer=require(_0x1749('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1749('0x1'));var router=express[_0x1749('0x2')]();var fs_extra=require(_0x1749('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1749('0x4'));var config=require(_0x1749('0x5'));var controller=require(_0x1749('0x6'));router[_0x1749('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1749('0x7')]('/:id',auth[_0x1749('0x8')](),controller[_0x1749('0x9')]);router[_0x1749('0x7')](_0x1749('0xa'),auth['isAuthenticated'](),controller['getHoppers']);router[_0x1749('0x7')](_0x1749('0xb'),auth[_0x1749('0x8')](),controller[_0x1749('0xc')]);router[_0x1749('0x7')](_0x1749('0xd'),auth['isAuthenticated'](),controller[_0x1749('0xe')]);router['get'](_0x1749('0xf'),auth[_0x1749('0x8')](),controller[_0x1749('0x10')]);router[_0x1749('0x7')](_0x1749('0x11'),auth[_0x1749('0x8')](),controller[_0x1749('0x12')]);router[_0x1749('0x7')]('/:id/blacklists',auth[_0x1749('0x8')](),controller[_0x1749('0x13')]);router[_0x1749('0x14')]('/',auth[_0x1749('0x8')](),controller[_0x1749('0x15')]);router[_0x1749('0x14')](_0x1749('0x16'),auth[_0x1749('0x8')](),controller[_0x1749('0x17')]);router[_0x1749('0x14')](_0x1749('0x11'),auth[_0x1749('0x8')](),controller['addLists']);router[_0x1749('0x14')](_0x1749('0x18'),auth[_0x1749('0x8')](),controller[_0x1749('0x19')]);router['put'](_0x1749('0x1a'),auth[_0x1749('0x8')](),controller[_0x1749('0x1b')]);router[_0x1749('0x1c')]('/:id',auth[_0x1749('0x8')](),controller['destroy']);router['delete'](_0x1749('0x11'),auth[_0x1749('0x8')](),controller[_0x1749('0x1d')]);router[_0x1749('0x1c')]('/:id/blacklists',auth[_0x1749('0x8')](),controller['removeBlackLists']);module[_0x1749('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 61c7809..08786b4 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 _0xa024=['VIRTUAL','getDataValue','key','sequelize','exports','STRING','TEXT'];(function(_0x330376,_0x70a3f){var _0xb7f093=function(_0x3f2586){while(--_0x3f2586){_0x330376['push'](_0x330376['shift']());}};_0xb7f093(++_0x70a3f);}(_0xa024,0x1ae));var _0x4a02=function(_0x52e5a8,_0x347fe8){_0x52e5a8=_0x52e5a8-0x0;var _0x293ba5=_0xa024[_0x52e5a8];return _0x293ba5;};'use strict';var Sequelize=require(_0x4a02('0x0'));module[_0x4a02('0x1')]={'key':{'type':Sequelize[_0x4a02('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x4a02('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x4a02('0x2')]},'name':{'type':Sequelize[_0x4a02('0x4')],'get':function(){return this[_0x4a02('0x5')](_0x4a02('0x6'));}}}; \ No newline at end of file +var _0xc8a3=['exports','STRING','VIRTUAL','getDataValue','key','sequelize'];(function(_0x1be3ed,_0x5a01ca){var _0x1fac22=function(_0x3f4a15){while(--_0x3f4a15){_0x1be3ed['push'](_0x1be3ed['shift']());}};_0x1fac22(++_0x5a01ca);}(_0xc8a3,0xa7));var _0x3c8a=function(_0x58aea4,_0x44acda){_0x58aea4=_0x58aea4-0x0;var _0x30dcdf=_0xc8a3[_0x58aea4];return _0x30dcdf;};'use strict';var Sequelize=require(_0x3c8a('0x0'));module[_0x3c8a('0x1')]={'key':{'type':Sequelize[_0x3c8a('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x3c8a('0x2')]},'name':{'type':Sequelize[_0x3c8a('0x3')],'get':function(){return this[_0x3c8a('0x4')](_0x3c8a('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 538515f..e884c0d 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 _0xba5e=['VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','path','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','UserProfileResource','stack','name','index','map','CannedAnswer','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','merge','where'];(function(_0x1d2157,_0x48382d){var _0x41fa1f=function(_0x39cc04){while(--_0x39cc04){_0x1d2157['push'](_0x1d2157['shift']());}};_0x41fa1f(++_0x48382d);}(_0xba5e,0xc3));var _0xeba5=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xba5e[_0x46e363];return _0x3fb059;};'use strict';var pdf=require(_0xeba5('0x0'));var emlformat=require(_0xeba5('0x1'));var rimraf=require(_0xeba5('0x2'));var zipdir=require(_0xeba5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeba5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeba5('0x5'));var util=require('util');var path=require(_0xeba5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeba5('0x7'));var fs=require('fs');var fs_extra=require(_0xeba5('0x8'));var _=require('lodash');var squel=require(_0xeba5('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeba5('0xa'));var toCsv=require(_0xeba5('0xb'));var querystring=require(_0xeba5('0xc'));var Papa=require(_0xeba5('0xd'));var Redis=require('ioredis');var authService=require(_0xeba5('0xe'));var qs=require(_0xeba5('0xf'));var as=require(_0xeba5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xeba5('0x11'));var config=require(_0xeba5('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xeba5('0x13'))['db'];function respondWithStatusCode(_0x32176d,_0x5c280f){_0x5c280f=_0x5c280f||0xcc;return function(_0x134362){if(_0x134362){return _0x32176d[_0xeba5('0x14')](_0x5c280f);}return _0x32176d[_0xeba5('0x15')](_0x5c280f)[_0xeba5('0x16')]();};}function respondWithResult(_0x11998e,_0x1c5eab){_0x1c5eab=_0x1c5eab||0xc8;return function(_0x4c3558){if(_0x4c3558){return _0x11998e[_0xeba5('0x15')](_0x1c5eab)['json'](_0x4c3558);}};}function respondWithFilteredResult(_0x364380,_0x4f1f91){return function(_0x3d555d){if(_0x3d555d){var _0x3d4052=_0x3d555d[_0xeba5('0x17')],_0x5aff2a=_0x4f1f91[_0xeba5('0x18')],_0x5ddf1b=_0x4f1f91[_0xeba5('0x18')]+_0x4f1f91[_0xeba5('0x19')],_0x1cebaa;if(_0x5ddf1b>=_0x3d4052){_0x5ddf1b=_0x3d4052;_0x1cebaa=0xc8;}else{_0x1cebaa=0xce;}_0x364380[_0xeba5('0x15')](_0x1cebaa);return _0x364380[_0xeba5('0x1a')](_0xeba5('0x1b'),_0x5aff2a+'-'+_0x5ddf1b+'/'+_0x3d4052)[_0xeba5('0x1c')](_0x3d555d);}return null;};}function patchUpdates(_0x1c968b){return function(_0x29199d){try{jsonpatch['apply'](_0x29199d,_0x1c968b,!![]);}catch(_0x1e8dd2){return BPromise[_0xeba5('0x1d')](_0x1e8dd2);}return _0x29199d[_0xeba5('0x1e')]();};}function saveUpdates(_0x591ec8,_0x47cdcb){return function(_0x27aa5e){if(_0x27aa5e){return _0x27aa5e[_0xeba5('0x1f')](_0x591ec8)[_0xeba5('0x20')](function(_0x31e41d){return _0x31e41d;});}return null;};}function removeEntity(_0x4f1506,_0x53e69c){return function(_0x301548){if(_0x301548){return _0x301548[_0xeba5('0x21')]()[_0xeba5('0x20')](function(){var _0xa482ec=_0x301548['get']({'plain':!![]});var _0x4b50d9='CannedAnswers';return db[_0xeba5('0x22')][_0xeba5('0x21')]({'where':{'type':_0x4b50d9,'resourceId':_0xa482ec['id']}})['then'](function(){return _0x301548;});})[_0xeba5('0x20')](function(){_0x4f1506[_0xeba5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a580,_0x466cd8){return function(_0x28c65e){if(!_0x28c65e){_0x55a580[_0xeba5('0x14')](0x194);}return _0x28c65e;};}function handleError(_0x19b654,_0x3329b8){_0x3329b8=_0x3329b8||0x1f4;return function(_0x2efe01){logger['error'](_0x2efe01[_0xeba5('0x23')]);if(_0x2efe01[_0xeba5('0x24')]){delete _0x2efe01[_0xeba5('0x24')];}_0x19b654[_0xeba5('0x15')](_0x3329b8)['send'](_0x2efe01);};}exports[_0xeba5('0x25')]=function(_0x5a456e,_0x3fa613){var _0x3a2cc7={},_0x1299ae={},_0x3c7568={'count':0x0,'rows':[]};var _0x133462=_[_0xeba5('0x26')](db[_0xeba5('0x27')][_0xeba5('0x28')],function(_0x26c929){return{'name':_0x26c929['fieldName'],'type':_0x26c929[_0xeba5('0x29')][_0xeba5('0x2a')]};});_0x1299ae[_0xeba5('0x2b')]=_[_0xeba5('0x26')](_0x133462,_0xeba5('0x24'));_0x1299ae['query']=_[_0xeba5('0x2c')](_0x5a456e[_0xeba5('0x2d')]);_0x1299ae[_0xeba5('0x2e')]=_['intersection'](_0x1299ae['model'],_0x1299ae[_0xeba5('0x2d')]);_0x3a2cc7[_0xeba5('0x2f')]=_[_0xeba5('0x30')](_0x1299ae[_0xeba5('0x2b')],qs[_0xeba5('0x31')](_0x5a456e['query'][_0xeba5('0x31')]));_0x3a2cc7[_0xeba5('0x2f')]=_0x3a2cc7[_0xeba5('0x2f')][_0xeba5('0x32')]?_0x3a2cc7[_0xeba5('0x2f')]:_0x1299ae[_0xeba5('0x2b')];if(!_0x5a456e['query'][_0xeba5('0x33')](_0xeba5('0x34'))){_0x3a2cc7[_0xeba5('0x19')]=qs[_0xeba5('0x19')](_0x5a456e['query'][_0xeba5('0x19')]);_0x3a2cc7[_0xeba5('0x18')]=qs[_0xeba5('0x18')](_0x5a456e['query']['offset']);}_0x3a2cc7[_0xeba5('0x35')]=qs['sort'](_0x5a456e[_0xeba5('0x2d')]['sort']);_0x3a2cc7['where']=qs[_0xeba5('0x2e')](_[_0xeba5('0x36')](_0x5a456e[_0xeba5('0x2d')],_0x1299ae['filters']),_0x133462);if(_0x5a456e[_0xeba5('0x2d')]['filter']){_0x3a2cc7['where']=_[_0xeba5('0x37')](_0x3a2cc7[_0xeba5('0x38')],{'$or':_[_0xeba5('0x26')](_0x133462,function(_0x1a3615){if(_0x1a3615[_0xeba5('0x29')]!==_0xeba5('0x39')){var _0x2868b1={};_0x2868b1[_0x1a3615[_0xeba5('0x24')]]={'$like':'%'+_0x5a456e['query'][_0xeba5('0x3a')]+'%'};return _0x2868b1;}})});}_0x3a2cc7=_[_0xeba5('0x37')]({},_0x3a2cc7,_0x5a456e['options']);var _0x653119={'where':_0x3a2cc7[_0xeba5('0x38')]};return db[_0xeba5('0x27')][_0xeba5('0x17')](_0x653119)[_0xeba5('0x20')](function(_0x1d1ae6){_0x3c7568['count']=_0x1d1ae6;if(_0x5a456e[_0xeba5('0x2d')][_0xeba5('0x3b')]){_0x3a2cc7[_0xeba5('0x3c')]=[{'all':!![]}];}return db[_0xeba5('0x27')]['findAll'](_0x3a2cc7);})[_0xeba5('0x20')](function(_0x1ce066){_0x3c7568[_0xeba5('0x3d')]=_0x1ce066;return _0x3c7568;})[_0xeba5('0x20')](respondWithFilteredResult(_0x3fa613,_0x3a2cc7))[_0xeba5('0x3e')](handleError(_0x3fa613,null));};exports[_0xeba5('0x3f')]=function(_0x4b8bd8,_0x43e7c1){var _0x495b1e={'raw':!![],'where':{'id':_0x4b8bd8[_0xeba5('0x40')]['id']}},_0xf9c2bd={};_0xf9c2bd[_0xeba5('0x2b')]=_[_0xeba5('0x2c')](db['CannedAnswer']['rawAttributes']);_0xf9c2bd[_0xeba5('0x2d')]=_[_0xeba5('0x2c')](_0x4b8bd8[_0xeba5('0x2d')]);_0xf9c2bd[_0xeba5('0x2e')]=_[_0xeba5('0x30')](_0xf9c2bd[_0xeba5('0x2b')],_0xf9c2bd[_0xeba5('0x2d')]);_0x495b1e[_0xeba5('0x2f')]=_['intersection'](_0xf9c2bd[_0xeba5('0x2b')],qs[_0xeba5('0x31')](_0x4b8bd8[_0xeba5('0x2d')][_0xeba5('0x31')]));_0x495b1e['attributes']=_0x495b1e[_0xeba5('0x2f')][_0xeba5('0x32')]?_0x495b1e[_0xeba5('0x2f')]:_0xf9c2bd[_0xeba5('0x2b')];if(_0x4b8bd8[_0xeba5('0x2d')]['includeAll']){_0x495b1e[_0xeba5('0x3c')]=[{'all':!![]}];}_0x495b1e=_[_0xeba5('0x37')]({},_0x495b1e,_0x4b8bd8[_0xeba5('0x41')]);return db[_0xeba5('0x27')][_0xeba5('0x42')](_0x495b1e)['then'](handleEntityNotFound(_0x43e7c1,null))[_0xeba5('0x20')](respondWithResult(_0x43e7c1,null))[_0xeba5('0x3e')](handleError(_0x43e7c1,null));};exports['update']=function(_0x5b6805,_0x51d284){if(_0x5b6805[_0xeba5('0x43')]['id']){delete _0x5b6805[_0xeba5('0x43')]['id'];}return db[_0xeba5('0x27')][_0xeba5('0x42')]({'where':{'id':_0x5b6805['params']['id']}})[_0xeba5('0x20')](handleEntityNotFound(_0x51d284,null))['then'](saveUpdates(_0x5b6805[_0xeba5('0x43')],null))[_0xeba5('0x20')](respondWithResult(_0x51d284,null))[_0xeba5('0x3e')](handleError(_0x51d284,null));};exports['destroy']=function(_0x2e04da,_0x32e719){return db[_0xeba5('0x27')]['find']({'where':{'id':_0x2e04da[_0xeba5('0x40')]['id']}})[_0xeba5('0x20')](handleEntityNotFound(_0x32e719,null))[_0xeba5('0x20')](removeEntity(_0x32e719,null))[_0xeba5('0x3e')](handleError(_0x32e719,null));};exports['create']=function(_0x240d12,_0x305017){var _0x5118ce={'key':_0x240d12[_0xeba5('0x43')][_0xeba5('0x2a')]};if(_0x240d12[_0xeba5('0x43')]['MailAccountId']){_0x5118ce[_0xeba5('0x44')]=_0x240d12['body'][_0xeba5('0x44')];}else if(_0x240d12[_0xeba5('0x43')][_0xeba5('0x45')]){_0x5118ce[_0xeba5('0x45')]=_0x240d12[_0xeba5('0x43')]['SmsAccountId'];}else if(_0x240d12[_0xeba5('0x43')]['OpenchannelAccountId']){_0x5118ce['OpenchannelAccountId']=_0x240d12[_0xeba5('0x43')][_0xeba5('0x46')];}else if(_0x240d12[_0xeba5('0x43')][_0xeba5('0x47')]){_0x5118ce[_0xeba5('0x47')]=_0x240d12[_0xeba5('0x43')]['ChatWebsiteId'];}return db[_0xeba5('0x27')]['find']({'where':_0x5118ce})['then'](function(_0x1b1573){if(_0x1b1573){throw new db['Sequelize'][(_0xeba5('0x48'))](_0xeba5('0x49'));}return db[_0xeba5('0x27')][_0xeba5('0x4a')](_0x240d12[_0xeba5('0x43')]);})[_0xeba5('0x20')](function(_0x4ea253){var _0x9e91fe=_0x240d12[_0xeba5('0x4b')][_0xeba5('0x4c')]({'plain':!![]});if(!_0x9e91fe)throw new Error(_0xeba5('0x4d'));if(_0x9e91fe['role']===_0xeba5('0x4b')){var _0x5e1126=_0x4ea253[_0xeba5('0x4c')]({'plain':!![]});return db[_0xeba5('0x4e')][_0xeba5('0x42')]({'where':{'name':_0xeba5('0x4f'),'userProfileId':_0x9e91fe[_0xeba5('0x50')]},'raw':!![]})[_0xeba5('0x20')](function(_0x18691c){if(_0x18691c&&_0x18691c[_0xeba5('0x51')]===0x0){return db[_0xeba5('0x22')]['create']({'name':_0x5e1126[_0xeba5('0x24')],'resourceId':_0x5e1126['id'],'type':_0x18691c[_0xeba5('0x24')],'sectionId':_0x18691c['id']},{})[_0xeba5('0x20')](function(){return _0x4ea253;});}else{return _0x4ea253;}})['catch'](function(_0x409249){logger[_0xeba5('0x52')](_0xeba5('0x53'),_0x409249);throw _0x409249;});}return _0x4ea253;})['then'](respondWithResult(_0x305017,0xc9))[_0xeba5('0x3e')](handleError(_0x305017,null));}; \ No newline at end of file +var _0xdac6=['end','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','limit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','save','update','then','get','CannedAnswers','UserProfileResource','destroy'];(function(_0x5b29f7,_0x335b71){var _0x47d235=function(_0x5bf7b7){while(--_0x5bf7b7){_0x5b29f7['push'](_0x5b29f7['shift']());}};_0x47d235(++_0x335b71);}(_0xdac6,0x84));var _0x6dac=function(_0x4955be,_0x8353b7){_0x4955be=_0x4955be-0x0;var _0x4d108d=_0xdac6[_0x4955be];return _0x4d108d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6dac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6dac('0x1'));var jsonpatch=require(_0x6dac('0x2'));var rp=require('request-promise');var moment=require(_0x6dac('0x3'));var BPromise=require(_0x6dac('0x4'));var Mustache=require(_0x6dac('0x5'));var util=require(_0x6dac('0x6'));var path=require(_0x6dac('0x7'));var sox=require(_0x6dac('0x8'));var csv=require(_0x6dac('0x9'));var ejs=require(_0x6dac('0xa'));var fs=require('fs');var fs_extra=require(_0x6dac('0xb'));var _=require(_0x6dac('0xc'));var squel=require(_0x6dac('0xd'));var crypto=require(_0x6dac('0xe'));var jsforce=require(_0x6dac('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6dac('0x10'));var Papa=require(_0x6dac('0x11'));var Redis=require('ioredis');var authService=require(_0x6dac('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6dac('0x13'));var logger=require(_0x6dac('0x14'))('api');var utils=require(_0x6dac('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6dac('0x16'));var db=require(_0x6dac('0x17'))['db'];function respondWithStatusCode(_0x5d09d3,_0x2c0cf7){_0x2c0cf7=_0x2c0cf7||0xcc;return function(_0x2f1464){if(_0x2f1464){return _0x5d09d3[_0x6dac('0x18')](_0x2c0cf7);}return _0x5d09d3['status'](_0x2c0cf7)['end']();};}function respondWithResult(_0x395fff,_0x4b54b6){_0x4b54b6=_0x4b54b6||0xc8;return function(_0x2c1e7f){if(_0x2c1e7f){return _0x395fff[_0x6dac('0x19')](_0x4b54b6)[_0x6dac('0x1a')](_0x2c1e7f);}};}function respondWithFilteredResult(_0x31e81c,_0x3f54ae){return function(_0x5e1b9c){if(_0x5e1b9c){var _0x210322=_0x5e1b9c[_0x6dac('0x1b')],_0x12dc27=_0x3f54ae[_0x6dac('0x1c')],_0x27f83c=_0x3f54ae[_0x6dac('0x1c')]+_0x3f54ae['limit'],_0x48a93c;if(_0x27f83c>=_0x210322){_0x27f83c=_0x210322;_0x48a93c=0xc8;}else{_0x48a93c=0xce;}_0x31e81c['status'](_0x48a93c);return _0x31e81c[_0x6dac('0x1d')](_0x6dac('0x1e'),_0x12dc27+'-'+_0x27f83c+'/'+_0x210322)[_0x6dac('0x1a')](_0x5e1b9c);}return null;};}function patchUpdates(_0x389132){return function(_0x40d25a){try{jsonpatch['apply'](_0x40d25a,_0x389132,!![]);}catch(_0x3bfb94){return BPromise['reject'](_0x3bfb94);}return _0x40d25a[_0x6dac('0x1f')]();};}function saveUpdates(_0x3eb5f9,_0x2db7bf){return function(_0xd5afc6){if(_0xd5afc6){return _0xd5afc6[_0x6dac('0x20')](_0x3eb5f9)[_0x6dac('0x21')](function(_0x5edf4a){return _0x5edf4a;});}return null;};}function removeEntity(_0x2364bf,_0x58e853){return function(_0x27b969){if(_0x27b969){return _0x27b969['destroy']()[_0x6dac('0x21')](function(){var _0xc4de9d=_0x27b969[_0x6dac('0x22')]({'plain':!![]});var _0xc0a119=_0x6dac('0x23');return db[_0x6dac('0x24')][_0x6dac('0x25')]({'where':{'type':_0xc0a119,'resourceId':_0xc4de9d['id']}})[_0x6dac('0x21')](function(){return _0x27b969;});})[_0x6dac('0x21')](function(){_0x2364bf[_0x6dac('0x19')](0xcc)[_0x6dac('0x26')]();});}};}function handleEntityNotFound(_0x17751a,_0x35aac2){return function(_0x443547){if(!_0x443547){_0x17751a[_0x6dac('0x18')](0x194);}return _0x443547;};}function handleError(_0xd0d3b0,_0x4226cf){_0x4226cf=_0x4226cf||0x1f4;return function(_0x1daaf6){logger[_0x6dac('0x27')](_0x1daaf6[_0x6dac('0x28')]);if(_0x1daaf6[_0x6dac('0x29')]){delete _0x1daaf6['name'];}_0xd0d3b0[_0x6dac('0x19')](_0x4226cf)[_0x6dac('0x2a')](_0x1daaf6);};}exports[_0x6dac('0x2b')]=function(_0x59e03e,_0x37b2da){var _0x346a22={},_0x146c15={},_0x37c689={'count':0x0,'rows':[]};var _0x3ee689=_[_0x6dac('0x2c')](db[_0x6dac('0x2d')][_0x6dac('0x2e')],function(_0x313366){return{'name':_0x313366[_0x6dac('0x2f')],'type':_0x313366[_0x6dac('0x30')][_0x6dac('0x31')]};});_0x146c15['model']=_['map'](_0x3ee689,'name');_0x146c15[_0x6dac('0x32')]=_[_0x6dac('0x33')](_0x59e03e[_0x6dac('0x32')]);_0x146c15[_0x6dac('0x34')]=_['intersection'](_0x146c15[_0x6dac('0x35')],_0x146c15[_0x6dac('0x32')]);_0x346a22[_0x6dac('0x36')]=_[_0x6dac('0x37')](_0x146c15['model'],qs[_0x6dac('0x38')](_0x59e03e[_0x6dac('0x32')][_0x6dac('0x38')]));_0x346a22[_0x6dac('0x36')]=_0x346a22[_0x6dac('0x36')][_0x6dac('0x39')]?_0x346a22[_0x6dac('0x36')]:_0x146c15['model'];if(!_0x59e03e['query']['hasOwnProperty'](_0x6dac('0x3a'))){_0x346a22[_0x6dac('0x3b')]=qs[_0x6dac('0x3b')](_0x59e03e[_0x6dac('0x32')][_0x6dac('0x3b')]);_0x346a22[_0x6dac('0x1c')]=qs['offset'](_0x59e03e[_0x6dac('0x32')]['offset']);}_0x346a22['order']=qs['sort'](_0x59e03e[_0x6dac('0x32')]['sort']);_0x346a22[_0x6dac('0x3c')]=qs['filters'](_[_0x6dac('0x3d')](_0x59e03e[_0x6dac('0x32')],_0x146c15['filters']),_0x3ee689);if(_0x59e03e[_0x6dac('0x32')][_0x6dac('0x3e')]){_0x346a22['where']=_[_0x6dac('0x3f')](_0x346a22[_0x6dac('0x3c')],{'$or':_[_0x6dac('0x2c')](_0x3ee689,function(_0x33855a){if(_0x33855a[_0x6dac('0x30')]!==_0x6dac('0x40')){var _0x156ee2={};_0x156ee2[_0x33855a[_0x6dac('0x29')]]={'$like':'%'+_0x59e03e['query'][_0x6dac('0x3e')]+'%'};return _0x156ee2;}})});}_0x346a22=_['merge']({},_0x346a22,_0x59e03e[_0x6dac('0x41')]);var _0x3e037d={'where':_0x346a22[_0x6dac('0x3c')]};return db[_0x6dac('0x2d')][_0x6dac('0x1b')](_0x3e037d)[_0x6dac('0x21')](function(_0x187d6e){_0x37c689[_0x6dac('0x1b')]=_0x187d6e;if(_0x59e03e[_0x6dac('0x32')][_0x6dac('0x42')]){_0x346a22[_0x6dac('0x43')]=[{'all':!![]}];}return db[_0x6dac('0x2d')]['findAll'](_0x346a22);})['then'](function(_0x19689c){_0x37c689['rows']=_0x19689c;return _0x37c689;})[_0x6dac('0x21')](respondWithFilteredResult(_0x37b2da,_0x346a22))[_0x6dac('0x44')](handleError(_0x37b2da,null));};exports['show']=function(_0x445c7e,_0x37af7c){var _0x28e718={'raw':!![],'where':{'id':_0x445c7e[_0x6dac('0x45')]['id']}},_0x50b877={};_0x50b877['model']=_['keys'](db[_0x6dac('0x2d')][_0x6dac('0x2e')]);_0x50b877[_0x6dac('0x32')]=_[_0x6dac('0x33')](_0x445c7e[_0x6dac('0x32')]);_0x50b877[_0x6dac('0x34')]=_[_0x6dac('0x37')](_0x50b877['model'],_0x50b877[_0x6dac('0x32')]);_0x28e718[_0x6dac('0x36')]=_['intersection'](_0x50b877[_0x6dac('0x35')],qs['fields'](_0x445c7e[_0x6dac('0x32')][_0x6dac('0x38')]));_0x28e718[_0x6dac('0x36')]=_0x28e718[_0x6dac('0x36')]['length']?_0x28e718[_0x6dac('0x36')]:_0x50b877[_0x6dac('0x35')];if(_0x445c7e[_0x6dac('0x32')][_0x6dac('0x42')]){_0x28e718[_0x6dac('0x43')]=[{'all':!![]}];}_0x28e718=_[_0x6dac('0x3f')]({},_0x28e718,_0x445c7e[_0x6dac('0x41')]);return db[_0x6dac('0x2d')][_0x6dac('0x46')](_0x28e718)['then'](handleEntityNotFound(_0x37af7c,null))[_0x6dac('0x21')](respondWithResult(_0x37af7c,null))['catch'](handleError(_0x37af7c,null));};exports[_0x6dac('0x20')]=function(_0x3534d6,_0x28b319){if(_0x3534d6[_0x6dac('0x47')]['id']){delete _0x3534d6[_0x6dac('0x47')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x3534d6[_0x6dac('0x45')]['id']}})[_0x6dac('0x21')](handleEntityNotFound(_0x28b319,null))['then'](saveUpdates(_0x3534d6['body'],null))[_0x6dac('0x21')](respondWithResult(_0x28b319,null))[_0x6dac('0x44')](handleError(_0x28b319,null));};exports[_0x6dac('0x25')]=function(_0x1d8c1e,_0x4fe90b){return db[_0x6dac('0x2d')][_0x6dac('0x46')]({'where':{'id':_0x1d8c1e[_0x6dac('0x45')]['id']}})[_0x6dac('0x21')](handleEntityNotFound(_0x4fe90b,null))[_0x6dac('0x21')](removeEntity(_0x4fe90b,null))[_0x6dac('0x44')](handleError(_0x4fe90b,null));};exports[_0x6dac('0x48')]=function(_0xbc1b2f,_0x53dd7f){var _0x4c3bd3={'key':_0xbc1b2f[_0x6dac('0x47')][_0x6dac('0x31')]};if(_0xbc1b2f[_0x6dac('0x47')][_0x6dac('0x49')]){_0x4c3bd3[_0x6dac('0x49')]=_0xbc1b2f['body'][_0x6dac('0x49')];}else if(_0xbc1b2f[_0x6dac('0x47')]['SmsAccountId']){_0x4c3bd3[_0x6dac('0x4a')]=_0xbc1b2f[_0x6dac('0x47')][_0x6dac('0x4a')];}else if(_0xbc1b2f[_0x6dac('0x47')][_0x6dac('0x4b')]){_0x4c3bd3[_0x6dac('0x4b')]=_0xbc1b2f['body'][_0x6dac('0x4b')];}else if(_0xbc1b2f[_0x6dac('0x47')][_0x6dac('0x4c')]){_0x4c3bd3['ChatWebsiteId']=_0xbc1b2f[_0x6dac('0x47')]['ChatWebsiteId'];}return db[_0x6dac('0x2d')][_0x6dac('0x46')]({'where':_0x4c3bd3})['then'](function(_0x2d77d3){if(_0x2d77d3){throw new db['Sequelize'][(_0x6dac('0x4d'))](_0x6dac('0x4e'));}return db[_0x6dac('0x2d')]['create'](_0xbc1b2f[_0x6dac('0x47')]);})[_0x6dac('0x21')](function(_0x30f1f8){var _0x424dde=_0xbc1b2f[_0x6dac('0x4f')][_0x6dac('0x22')]({'plain':!![]});if(!_0x424dde)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x424dde[_0x6dac('0x50')]===_0x6dac('0x4f')){var _0x5e9490=_0x30f1f8[_0x6dac('0x22')]({'plain':!![]});return db[_0x6dac('0x51')][_0x6dac('0x46')]({'where':{'name':_0x6dac('0x23'),'userProfileId':_0x424dde[_0x6dac('0x52')]},'raw':!![]})[_0x6dac('0x21')](function(_0x5b90de){if(_0x5b90de&&_0x5b90de[_0x6dac('0x53')]===0x0){return db[_0x6dac('0x24')][_0x6dac('0x48')]({'name':_0x5e9490[_0x6dac('0x29')],'resourceId':_0x5e9490['id'],'type':_0x5b90de['name'],'sectionId':_0x5b90de['id']},{})['then'](function(){return _0x30f1f8;});}else{return _0x30f1f8;}})[_0x6dac('0x44')](function(_0x592c13){logger['error'](_0x6dac('0x54'),_0x592c13);throw _0x592c13;});}return _0x30f1f8;})['then'](respondWithResult(_0x53dd7f,0xc9))[_0x6dac('0x44')](handleError(_0x53dd7f,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index a76fba5..9c5ecde 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 _0x44f4=['path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird'];(function(_0x17575b,_0x1d7af7){var _0x5b6f87=function(_0x42e06){while(--_0x42e06){_0x17575b['push'](_0x17575b['shift']());}};_0x5b6f87(++_0x1d7af7);}(_0x44f4,0x140));var _0x444f=function(_0x416ea4,_0x54dd8b){_0x416ea4=_0x416ea4-0x0;var _0x15a849=_0x44f4[_0x416ea4];return _0x15a849;};'use strict';var _=require(_0x444f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x444f('0x1'));var moment=require(_0x444f('0x2'));var BPromise=require(_0x444f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x444f('0x4'));var rimraf=require('rimraf');var config=require(_0x444f('0x5'));var attributes=require(_0x444f('0x6'));module[_0x444f('0x7')]=function(_0x46dac6,_0x2588d9){return _0x46dac6[_0x444f('0x8')](_0x444f('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x444f('0xa'),'collate':_0x444f('0xb')});}; \ No newline at end of file +var _0xde9d=['api','moment','request-promise','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xd3bcf8,_0x994fdb){var _0x296170=function(_0x2f5519){while(--_0x2f5519){_0xd3bcf8['push'](_0xd3bcf8['shift']());}};_0x296170(++_0x994fdb);}(_0xde9d,0x156));var _0xdde9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde9d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var logger=require(_0xdde9('0x2'))(_0xdde9('0x3'));var moment=require(_0xdde9('0x4'));var BPromise=require('bluebird');var rp=require(_0xdde9('0x5'));var fs=require('fs');var path=require(_0xdde9('0x6'));var rimraf=require(_0xdde9('0x7'));var config=require('../../config/environment');var attributes=require(_0xdde9('0x8'));module[_0xdde9('0x9')]=function(_0x1ea43e,_0x4c10e9){return _0x1ea43e[_0xdde9('0xa')](_0xdde9('0xb'),attributes,{'tableName':_0xdde9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdde9('0xd'),'collate':_0xdde9('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 1d1925f..2715401 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 _0x8830=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x23ba2a,_0x516b14){var _0x3eca4a=function(_0x5df423){while(--_0x5df423){_0x23ba2a['push'](_0x23ba2a['shift']());}};_0x3eca4a(++_0x516b14);}(_0x8830,0x19f));var _0x0883=function(_0x4ff703,_0x184ccb){_0x4ff703=_0x4ff703-0x0;var _0x50b0c5=_0x8830[_0x4ff703];return _0x50b0c5;};'use strict';var _=require(_0x0883('0x0'));var util=require(_0x0883('0x1'));var moment=require(_0x0883('0x2'));var BPromise=require(_0x0883('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0883('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0883('0x5'));var logger=require(_0x0883('0x6'))(_0x0883('0x7'));var config=require(_0x0883('0x8'));var jayson=require(_0x0883('0x9'));var client=jayson[_0x0883('0xa')][_0x0883('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cd98e,_0x495cf7,_0x2ecb7d){return new BPromise(function(_0x11dbb0,_0x1e4db9){return client['request'](_0x3cd98e,_0x2ecb7d)[_0x0883('0xc')](function(_0x5903e5){logger[_0x0883('0xd')](_0x0883('0xe'),_0x495cf7,_0x0883('0xf'));logger[_0x0883('0x10')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x495cf7,_0x0883('0xf'),JSON[_0x0883('0x11')](_0x5903e5));if(_0x5903e5[_0x0883('0x12')]){if(_0x5903e5[_0x0883('0x12')]['code']===0x1f4){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x495cf7,_0x5903e5[_0x0883('0x12')][_0x0883('0x13')]);return _0x1e4db9(_0x5903e5[_0x0883('0x12')][_0x0883('0x13')]);}logger[_0x0883('0x12')](_0x0883('0xe'),_0x495cf7,_0x5903e5[_0x0883('0x12')][_0x0883('0x13')]);return _0x11dbb0(_0x5903e5[_0x0883('0x12')][_0x0883('0x13')]);}else{logger[_0x0883('0xd')](_0x0883('0xe'),_0x495cf7,_0x0883('0xf'));_0x11dbb0(_0x5903e5[_0x0883('0x14')][_0x0883('0x13')]);}})[_0x0883('0x15')](function(_0x50e151){logger[_0x0883('0x12')](_0x0883('0xe'),_0x495cf7,_0x50e151);_0x1e4db9(_0x50e151);});});} \ No newline at end of file +var _0x43fc=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x43fc,0x1ba));var _0xc43f=function(_0x615996,_0x5038e4){_0x615996=_0x615996-0x0;var _0x3e5a2d=_0x43fc[_0x615996];return _0x3e5a2d;};'use strict';var _=require('lodash');var util=require(_0xc43f('0x0'));var moment=require(_0xc43f('0x1'));var BPromise=require(_0xc43f('0x2'));var rs=require(_0xc43f('0x3'));var fs=require('fs');var Redis=require(_0xc43f('0x4'));var db=require(_0xc43f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc43f('0x6'))(_0xc43f('0x7'));var config=require(_0xc43f('0x8'));var jayson=require(_0xc43f('0x9'));var client=jayson[_0xc43f('0xa')][_0xc43f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32e4a0,_0x6edb25,_0x15b63f){return new BPromise(function(_0x2e3f86,_0x4bfdaa){return client[_0xc43f('0xc')](_0x32e4a0,_0x15b63f)['then'](function(_0x4bce7a){logger[_0xc43f('0xd')](_0xc43f('0xe'),_0x6edb25,_0xc43f('0xf'));logger['debug']('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x6edb25,_0xc43f('0xf'),JSON[_0xc43f('0x10')](_0x4bce7a));if(_0x4bce7a[_0xc43f('0x11')]){if(_0x4bce7a['error'][_0xc43f('0x12')]===0x1f4){logger[_0xc43f('0x11')](_0xc43f('0xe'),_0x6edb25,_0x4bce7a[_0xc43f('0x11')][_0xc43f('0x13')]);return _0x4bfdaa(_0x4bce7a[_0xc43f('0x11')]['message']);}logger[_0xc43f('0x11')](_0xc43f('0xe'),_0x6edb25,_0x4bce7a['error'][_0xc43f('0x13')]);return _0x2e3f86(_0x4bce7a[_0xc43f('0x11')][_0xc43f('0x13')]);}else{logger[_0xc43f('0xd')](_0xc43f('0xe'),_0x6edb25,'request\x20sent');_0x2e3f86(_0x4bce7a[_0xc43f('0x14')][_0xc43f('0x13')]);}})[_0xc43f('0x15')](function(_0xdbce96){logger[_0xc43f('0x11')](_0xc43f('0xe'),_0x6edb25,_0xdbce96);_0x4bfdaa(_0xdbce96);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index e01d448..60d4eb5 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 _0xce30=['post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xce30,0xb1));var _0x0ce3=function(_0x385b04,_0x2ce85e){_0x385b04=_0x385b04-0x0;var _0x21ec67=_0xce30[_0x385b04];return _0x21ec67;};'use strict';var multer=require(_0x0ce3('0x0'));var util=require(_0x0ce3('0x1'));var path=require(_0x0ce3('0x2'));var timeout=require(_0x0ce3('0x3'));var express=require('express');var router=express[_0x0ce3('0x4')]();var fs_extra=require(_0x0ce3('0x5'));var auth=require(_0x0ce3('0x6'));var interaction=require(_0x0ce3('0x7'));var config=require(_0x0ce3('0x8'));var controller=require(_0x0ce3('0x9'));router[_0x0ce3('0xa')]('/',auth[_0x0ce3('0xb')](),controller[_0x0ce3('0xc')]);router[_0x0ce3('0xa')]('/:id',auth[_0x0ce3('0xb')](),controller['show']);router[_0x0ce3('0xd')]('/',auth[_0x0ce3('0xb')](),controller['create']);router[_0x0ce3('0xe')](_0x0ce3('0xf'),auth[_0x0ce3('0xb')](),controller[_0x0ce3('0x10')]);router['delete']('/:id',auth[_0x0ce3('0xb')](),controller[_0x0ce3('0x11')]);module[_0x0ce3('0x12')]=router; \ No newline at end of file +var _0xfd4b=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cannedAnswer.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','destroy','exports'];(function(_0x132fd7,_0x504245){var _0x7257f8=function(_0x2db126){while(--_0x2db126){_0x132fd7['push'](_0x132fd7['shift']());}};_0x7257f8(++_0x504245);}(_0xfd4b,0x10a));var _0xbfd4=function(_0x36df83,_0x180df6){_0x36df83=_0x36df83-0x0;var _0x18fdf5=_0xfd4b[_0x36df83];return _0x18fdf5;};'use strict';var multer=require('multer');var util=require(_0xbfd4('0x0'));var path=require(_0xbfd4('0x1'));var timeout=require(_0xbfd4('0x2'));var express=require(_0xbfd4('0x3'));var router=express[_0xbfd4('0x4')]();var fs_extra=require(_0xbfd4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbfd4('0x6'));var config=require('../../config/environment');var controller=require(_0xbfd4('0x7'));router['get']('/',auth[_0xbfd4('0x8')](),controller[_0xbfd4('0x9')]);router[_0xbfd4('0xa')]('/:id',auth[_0xbfd4('0x8')](),controller[_0xbfd4('0xb')]);router[_0xbfd4('0xc')]('/',auth[_0xbfd4('0x8')](),controller[_0xbfd4('0xd')]);router[_0xbfd4('0xe')](_0xbfd4('0xf'),auth[_0xbfd4('0x8')](),controller[_0xbfd4('0x10')]);router['delete'](_0xbfd4('0xf'),auth[_0xbfd4('0x8')](),controller[_0xbfd4('0x11')]);module[_0xbfd4('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 3c7705e..dffeb29 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 _0xe091=['INTEGER','sequelize','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x32def5,_0x7b0168){var _0xd0c4e1=function(_0x9ac90){while(--_0x9ac90){_0x32def5['push'](_0x32def5['shift']());}};_0xd0c4e1(++_0x7b0168);}(_0xe091,0x119));var _0x1e09=function(_0x33c228,_0x5dd746){_0x33c228=_0x33c228-0x0;var _0x4cc4b8=_0xe091[_0x33c228];return _0x4cc4b8;};'use strict';var Sequelize=require(_0x1e09('0x0'));module[_0x1e09('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x1e09('0x2')},'clid':{'type':Sequelize[_0x1e09('0x3')]},'src':{'type':Sequelize[_0x1e09('0x3')]},'dst':{'type':Sequelize[_0x1e09('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1e09('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x1e09('0x3')]},'lastdata':{'type':Sequelize[_0x1e09('0x3')]},'duration':{'type':Sequelize[_0x1e09('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x1e09('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1e09('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1e09('0x3')]},'linkedid':{'type':Sequelize[_0x1e09('0x3')]},'sequence':{'type':Sequelize[_0x1e09('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1e09('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x14e2=['STRING','INTEGER','sequelize','exports','1970-01-01\x2000:00:01'];(function(_0x4c9b33,_0x5e0308){var _0x4eb079=function(_0x4d0593){while(--_0x4d0593){_0x4c9b33['push'](_0x4c9b33['shift']());}};_0x4eb079(++_0x5e0308);}(_0x14e2,0x19c));var _0x214e=function(_0x124f88,_0x3ad501){_0x124f88=_0x124f88-0x0;var _0xed0e3b=_0x14e2[_0x124f88];return _0xed0e3b;};'use strict';var Sequelize=require(_0x214e('0x0'));module[_0x214e('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x214e('0x2')},'clid':{'type':Sequelize[_0x214e('0x3')]},'src':{'type':Sequelize[_0x214e('0x3')]},'dst':{'type':Sequelize[_0x214e('0x3')]},'dcontext':{'type':Sequelize[_0x214e('0x3')]},'channel':{'type':Sequelize[_0x214e('0x3')]},'dstchannel':{'type':Sequelize[_0x214e('0x3')]},'lastapp':{'type':Sequelize[_0x214e('0x3')]},'lastdata':{'type':Sequelize[_0x214e('0x3')]},'duration':{'type':Sequelize[_0x214e('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x214e('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x214e('0x3')]},'amaflags':{'type':Sequelize[_0x214e('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x214e('0x3')]},'linkedid':{'type':Sequelize[_0x214e('0x3')]},'sequence':{'type':Sequelize[_0x214e('0x3')]},'peeraccount':{'type':Sequelize[_0x214e('0x3')]},'type':{'type':Sequelize[_0x214e('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 171c2ea..c889993 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 _0x229a=['Content-Range','then','destroy','end','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','Cdr','includeAll','rows','catch','show','create','body','update','find','params','describe','html-pdf','eml-format','zip-dir','request-promise','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set'];(function(_0x9e46a3,_0x3af63c){var _0x33cf58=function(_0x5e03d8){while(--_0x5e03d8){_0x9e46a3['push'](_0x9e46a3['shift']());}};_0x33cf58(++_0x3af63c);}(_0x229a,0x100));var _0xa229=function(_0x92624e,_0x3ad9e0){_0x92624e=_0x92624e-0x0;var _0x592713=_0x229a[_0x92624e];return _0x592713;};'use strict';var pdf=require(_0xa229('0x0'));var emlformat=require(_0xa229('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa229('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa229('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa229('0x4'));var path=require(_0xa229('0x5'));var sox=require(_0xa229('0x6'));var csv=require(_0xa229('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa229('0x8'));var _=require(_0xa229('0x9'));var squel=require(_0xa229('0xa'));var crypto=require(_0xa229('0xb'));var jsforce=require(_0xa229('0xc'));var deskjs=require(_0xa229('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa229('0xe'));var Papa=require(_0xa229('0xf'));var Redis=require(_0xa229('0x10'));var authService=require(_0xa229('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa229('0x12'));var hardwareService=require(_0xa229('0x13'));var logger=require(_0xa229('0x14'))(_0xa229('0x15'));var utils=require(_0xa229('0x16'));var config=require(_0xa229('0x17'));var licenseUtil=require(_0xa229('0x18'));var db=require(_0xa229('0x19'))['db'];function respondWithStatusCode(_0x9121f6,_0x3e2456){_0x3e2456=_0x3e2456||0xcc;return function(_0x5e01eb){if(_0x5e01eb){return _0x9121f6['sendStatus'](_0x3e2456);}return _0x9121f6[_0xa229('0x1a')](_0x3e2456)['end']();};}function respondWithResult(_0x36ff90,_0x123683){_0x123683=_0x123683||0xc8;return function(_0x3a5f7c){if(_0x3a5f7c){return _0x36ff90[_0xa229('0x1a')](_0x123683)[_0xa229('0x1b')](_0x3a5f7c);}};}function respondWithFilteredResult(_0x39a64b,_0x10251e){return function(_0x54b9be){if(_0x54b9be){var _0x1fd991=_0x54b9be[_0xa229('0x1c')],_0x1196a2=_0x10251e['offset'],_0x292695=_0x10251e[_0xa229('0x1d')]+_0x10251e[_0xa229('0x1e')],_0x26683c;if(_0x292695>=_0x1fd991){_0x292695=_0x1fd991;_0x26683c=0xc8;}else{_0x26683c=0xce;}_0x39a64b[_0xa229('0x1a')](_0x26683c);return _0x39a64b[_0xa229('0x1f')](_0xa229('0x20'),_0x1196a2+'-'+_0x292695+'/'+_0x1fd991)[_0xa229('0x1b')](_0x54b9be);}return null;};}function patchUpdates(_0xc466c){return function(_0x196f8c){try{jsonpatch['apply'](_0x196f8c,_0xc466c,!![]);}catch(_0x16063d){return BPromise['reject'](_0x16063d);}return _0x196f8c['save']();};}function saveUpdates(_0x5c15db,_0x492ac7){return function(_0x2b0b54){if(_0x2b0b54){return _0x2b0b54['update'](_0x5c15db)[_0xa229('0x21')](function(_0x58576e){return _0x58576e;});}return null;};}function removeEntity(_0x25cc12,_0xe2b5e5){return function(_0x326032){if(_0x326032){return _0x326032[_0xa229('0x22')]()[_0xa229('0x21')](function(){_0x25cc12[_0xa229('0x1a')](0xcc)[_0xa229('0x23')]();});}};}function handleEntityNotFound(_0xf4a33a,_0x51c784){return function(_0x2a63ae){if(!_0x2a63ae){_0xf4a33a[_0xa229('0x24')](0x194);}return _0x2a63ae;};}function handleError(_0x164e5a,_0x2e5720){_0x2e5720=_0x2e5720||0x1f4;return function(_0x55aeab){logger[_0xa229('0x25')](_0x55aeab[_0xa229('0x26')]);if(_0x55aeab[_0xa229('0x27')]){delete _0x55aeab[_0xa229('0x27')];}_0x164e5a[_0xa229('0x1a')](_0x2e5720)[_0xa229('0x28')](_0x55aeab);};}exports['index']=function(_0x561c22,_0x5eb528){var _0xedfa79={},_0x44a75b={},_0x235618={'count':0x0,'rows':[]};var _0x241478=_['map'](db['Cdr'][_0xa229('0x29')],function(_0x53bf97){return{'name':_0x53bf97[_0xa229('0x2a')],'type':_0x53bf97[_0xa229('0x2b')][_0xa229('0x2c')]};});_0x44a75b['model']=_['map'](_0x241478,'name');_0x44a75b[_0xa229('0x2d')]=_[_0xa229('0x2e')](_0x561c22[_0xa229('0x2d')]);_0x44a75b['filters']=_[_0xa229('0x2f')](_0x44a75b[_0xa229('0x30')],_0x44a75b['query']);_0xedfa79[_0xa229('0x31')]=_[_0xa229('0x2f')](_0x44a75b[_0xa229('0x30')],qs[_0xa229('0x32')](_0x561c22[_0xa229('0x2d')][_0xa229('0x32')]));_0xedfa79[_0xa229('0x31')]=_0xedfa79['attributes'][_0xa229('0x33')]?_0xedfa79[_0xa229('0x31')]:_0x44a75b[_0xa229('0x30')];if(!_0x561c22[_0xa229('0x2d')]['hasOwnProperty'](_0xa229('0x34'))){_0xedfa79[_0xa229('0x1e')]=qs[_0xa229('0x1e')](_0x561c22[_0xa229('0x2d')][_0xa229('0x1e')]);_0xedfa79[_0xa229('0x1d')]=qs[_0xa229('0x1d')](_0x561c22[_0xa229('0x2d')][_0xa229('0x1d')]);}_0xedfa79[_0xa229('0x35')]=qs['sort'](_0x561c22['query'][_0xa229('0x36')]);_0xedfa79['where']=qs[_0xa229('0x37')](_['pick'](_0x561c22['query'],_0x44a75b[_0xa229('0x37')]),_0x241478);if(_0x561c22[_0xa229('0x2d')][_0xa229('0x38')]){_0xedfa79[_0xa229('0x39')]=_[_0xa229('0x3a')](_0xedfa79[_0xa229('0x39')],{'$or':_['map'](_0x241478,function(_0x112953){if(_0x112953[_0xa229('0x2b')]!==_0xa229('0x3b')){var _0x3675a4={};_0x3675a4[_0x112953[_0xa229('0x27')]]={'$like':'%'+_0x561c22[_0xa229('0x2d')][_0xa229('0x38')]+'%'};return _0x3675a4;}})});}_0xedfa79=_[_0xa229('0x3a')]({},_0xedfa79,_0x561c22[_0xa229('0x3c')]);var _0x4576ea={'where':_0xedfa79[_0xa229('0x39')]};return db[_0xa229('0x3d')]['count'](_0x4576ea)[_0xa229('0x21')](function(_0x2d0e53){_0x235618[_0xa229('0x1c')]=_0x2d0e53;if(_0x561c22[_0xa229('0x2d')][_0xa229('0x3e')]){_0xedfa79['include']=[{'all':!![]}];}return db[_0xa229('0x3d')]['findAll'](_0xedfa79);})[_0xa229('0x21')](function(_0x1cbfb9){_0x235618[_0xa229('0x3f')]=_0x1cbfb9;return _0x235618;})[_0xa229('0x21')](respondWithFilteredResult(_0x5eb528,_0xedfa79))[_0xa229('0x40')](handleError(_0x5eb528,null));};exports[_0xa229('0x41')]=function(_0x5d0a58,_0x1e4e56){var _0x22dbe3={'raw':!![],'where':{'id':_0x5d0a58['params']['id']}},_0x73fb9f={};_0x73fb9f[_0xa229('0x30')]=_[_0xa229('0x2e')](db[_0xa229('0x3d')][_0xa229('0x29')]);_0x73fb9f['query']=_[_0xa229('0x2e')](_0x5d0a58[_0xa229('0x2d')]);_0x73fb9f[_0xa229('0x37')]=_[_0xa229('0x2f')](_0x73fb9f['model'],_0x73fb9f[_0xa229('0x2d')]);_0x22dbe3['attributes']=_[_0xa229('0x2f')](_0x73fb9f[_0xa229('0x30')],qs['fields'](_0x5d0a58[_0xa229('0x2d')][_0xa229('0x32')]));_0x22dbe3[_0xa229('0x31')]=_0x22dbe3[_0xa229('0x31')][_0xa229('0x33')]?_0x22dbe3[_0xa229('0x31')]:_0x73fb9f[_0xa229('0x30')];if(_0x5d0a58[_0xa229('0x2d')][_0xa229('0x3e')]){_0x22dbe3['include']=[{'all':!![]}];}_0x22dbe3=_[_0xa229('0x3a')]({},_0x22dbe3,_0x5d0a58[_0xa229('0x3c')]);return db[_0xa229('0x3d')]['find'](_0x22dbe3)[_0xa229('0x21')](handleEntityNotFound(_0x1e4e56,null))[_0xa229('0x21')](respondWithResult(_0x1e4e56,null))[_0xa229('0x40')](handleError(_0x1e4e56,null));};exports['create']=function(_0x5ede73,_0x237536){return db[_0xa229('0x3d')][_0xa229('0x42')](_0x5ede73[_0xa229('0x43')],{})['then'](respondWithResult(_0x237536,0xc9))[_0xa229('0x40')](handleError(_0x237536,null));};exports[_0xa229('0x44')]=function(_0x28c28f,_0x3994e2){if(_0x28c28f[_0xa229('0x43')]['id']){delete _0x28c28f[_0xa229('0x43')]['id'];}return db['Cdr'][_0xa229('0x45')]({'where':{'id':_0x28c28f[_0xa229('0x46')]['id']}})[_0xa229('0x21')](handleEntityNotFound(_0x3994e2,null))[_0xa229('0x21')](saveUpdates(_0x28c28f[_0xa229('0x43')],null))[_0xa229('0x21')](respondWithResult(_0x3994e2,null))[_0xa229('0x40')](handleError(_0x3994e2,null));};exports[_0xa229('0x22')]=function(_0x3bf2f5,_0x294829){return db[_0xa229('0x3d')][_0xa229('0x45')]({'where':{'id':_0x3bf2f5[_0xa229('0x46')]['id']}})[_0xa229('0x21')](handleEntityNotFound(_0x294829,null))[_0xa229('0x21')](removeEntity(_0x294829,null))[_0xa229('0x40')](handleError(_0x294829,null));};exports['describe']=function(_0xaa5cc3,_0x5163c6){return db[_0xa229('0x3d')][_0xa229('0x47')]()[_0xa229('0x21')](respondWithResult(_0x5163c6,null))[_0xa229('0x40')](handleError(_0x5163c6,null));}; \ No newline at end of file +var _0xbc09=['jsforce','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','json','count','offset','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','Cdr','rawAttributes','type','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbc09,0xd6));var _0x9bc0=function(_0x5d8855,_0xe821d4){_0x5d8855=_0x5d8855-0x0;var _0x2f4008=_0xbc09[_0x5d8855];return _0x2f4008;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9bc0('0x0'));var rimraf=require(_0x9bc0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9bc0('0x2'));var rp=require(_0x9bc0('0x3'));var moment=require(_0x9bc0('0x4'));var BPromise=require(_0x9bc0('0x5'));var Mustache=require(_0x9bc0('0x6'));var util=require('util');var path=require(_0x9bc0('0x7'));var sox=require(_0x9bc0('0x8'));var csv=require(_0x9bc0('0x9'));var ejs=require(_0x9bc0('0xa'));var fs=require('fs');var fs_extra=require(_0x9bc0('0xb'));var _=require('lodash');var squel=require(_0x9bc0('0xc'));var crypto=require(_0x9bc0('0xd'));var jsforce=require(_0x9bc0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9bc0('0x9'));var querystring=require(_0x9bc0('0xf'));var Papa=require(_0x9bc0('0x10'));var Redis=require(_0x9bc0('0x11'));var authService=require(_0x9bc0('0x12'));var qs=require(_0x9bc0('0x13'));var as=require(_0x9bc0('0x14'));var hardwareService=require(_0x9bc0('0x15'));var logger=require(_0x9bc0('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x9bc0('0x17'));var licenseUtil=require(_0x9bc0('0x18'));var db=require(_0x9bc0('0x19'))['db'];function respondWithStatusCode(_0x60c2d1,_0x4834c7){_0x4834c7=_0x4834c7||0xcc;return function(_0x403ee1){if(_0x403ee1){return _0x60c2d1[_0x9bc0('0x1a')](_0x4834c7);}return _0x60c2d1[_0x9bc0('0x1b')](_0x4834c7)['end']();};}function respondWithResult(_0x4de079,_0x37de7b){_0x37de7b=_0x37de7b||0xc8;return function(_0x4b65c4){if(_0x4b65c4){return _0x4de079['status'](_0x37de7b)[_0x9bc0('0x1c')](_0x4b65c4);}};}function respondWithFilteredResult(_0x12febf,_0x32fdd2){return function(_0x5e3e05){if(_0x5e3e05){var _0xbd4c18=_0x5e3e05[_0x9bc0('0x1d')],_0x4f890d=_0x32fdd2[_0x9bc0('0x1e')],_0x9b7d9a=_0x32fdd2['offset']+_0x32fdd2['limit'],_0x57cd6b;if(_0x9b7d9a>=_0xbd4c18){_0x9b7d9a=_0xbd4c18;_0x57cd6b=0xc8;}else{_0x57cd6b=0xce;}_0x12febf['status'](_0x57cd6b);return _0x12febf[_0x9bc0('0x1f')](_0x9bc0('0x20'),_0x4f890d+'-'+_0x9b7d9a+'/'+_0xbd4c18)['json'](_0x5e3e05);}return null;};}function patchUpdates(_0x25700c){return function(_0x37fa3c){try{jsonpatch[_0x9bc0('0x21')](_0x37fa3c,_0x25700c,!![]);}catch(_0x373a81){return BPromise[_0x9bc0('0x22')](_0x373a81);}return _0x37fa3c['save']();};}function saveUpdates(_0x15f5f1,_0x468102){return function(_0x5a1a5a){if(_0x5a1a5a){return _0x5a1a5a[_0x9bc0('0x23')](_0x15f5f1)[_0x9bc0('0x24')](function(_0x30b1c2){return _0x30b1c2;});}return null;};}function removeEntity(_0x3549d0,_0x4d4a2f){return function(_0x45889f){if(_0x45889f){return _0x45889f['destroy']()[_0x9bc0('0x24')](function(){_0x3549d0[_0x9bc0('0x1b')](0xcc)[_0x9bc0('0x25')]();});}};}function handleEntityNotFound(_0x4a97f9,_0x2cb01b){return function(_0x2f3b7e){if(!_0x2f3b7e){_0x4a97f9['sendStatus'](0x194);}return _0x2f3b7e;};}function handleError(_0x5c480f,_0x3e6772){_0x3e6772=_0x3e6772||0x1f4;return function(_0x2a62ec){logger[_0x9bc0('0x26')](_0x2a62ec[_0x9bc0('0x27')]);if(_0x2a62ec[_0x9bc0('0x28')]){delete _0x2a62ec[_0x9bc0('0x28')];}_0x5c480f[_0x9bc0('0x1b')](_0x3e6772)[_0x9bc0('0x29')](_0x2a62ec);};}exports[_0x9bc0('0x2a')]=function(_0x3640f8,_0x2ddf39){var _0x11ed08={},_0x38544c={},_0x533e0c={'count':0x0,'rows':[]};var _0x1f886d=_['map'](db[_0x9bc0('0x2b')][_0x9bc0('0x2c')],function(_0x309c90){return{'name':_0x309c90['fieldName'],'type':_0x309c90[_0x9bc0('0x2d')][_0x9bc0('0x2e')]};});_0x38544c['model']=_[_0x9bc0('0x2f')](_0x1f886d,_0x9bc0('0x28'));_0x38544c[_0x9bc0('0x30')]=_[_0x9bc0('0x31')](_0x3640f8['query']);_0x38544c['filters']=_[_0x9bc0('0x32')](_0x38544c['model'],_0x38544c['query']);_0x11ed08[_0x9bc0('0x33')]=_[_0x9bc0('0x32')](_0x38544c[_0x9bc0('0x34')],qs[_0x9bc0('0x35')](_0x3640f8['query'][_0x9bc0('0x35')]));_0x11ed08[_0x9bc0('0x33')]=_0x11ed08[_0x9bc0('0x33')][_0x9bc0('0x36')]?_0x11ed08[_0x9bc0('0x33')]:_0x38544c[_0x9bc0('0x34')];if(!_0x3640f8[_0x9bc0('0x30')][_0x9bc0('0x37')](_0x9bc0('0x38'))){_0x11ed08['limit']=qs[_0x9bc0('0x39')](_0x3640f8[_0x9bc0('0x30')][_0x9bc0('0x39')]);_0x11ed08[_0x9bc0('0x1e')]=qs['offset'](_0x3640f8[_0x9bc0('0x30')][_0x9bc0('0x1e')]);}_0x11ed08[_0x9bc0('0x3a')]=qs[_0x9bc0('0x3b')](_0x3640f8['query'][_0x9bc0('0x3b')]);_0x11ed08[_0x9bc0('0x3c')]=qs[_0x9bc0('0x3d')](_['pick'](_0x3640f8['query'],_0x38544c[_0x9bc0('0x3d')]),_0x1f886d);if(_0x3640f8[_0x9bc0('0x30')][_0x9bc0('0x3e')]){_0x11ed08[_0x9bc0('0x3c')]=_[_0x9bc0('0x3f')](_0x11ed08[_0x9bc0('0x3c')],{'$or':_[_0x9bc0('0x2f')](_0x1f886d,function(_0x670cbe){if(_0x670cbe[_0x9bc0('0x2d')]!==_0x9bc0('0x40')){var _0x5cf62f={};_0x5cf62f[_0x670cbe['name']]={'$like':'%'+_0x3640f8[_0x9bc0('0x30')][_0x9bc0('0x3e')]+'%'};return _0x5cf62f;}})});}_0x11ed08=_[_0x9bc0('0x3f')]({},_0x11ed08,_0x3640f8[_0x9bc0('0x41')]);var _0x51fa10={'where':_0x11ed08[_0x9bc0('0x3c')]};return db['Cdr'][_0x9bc0('0x1d')](_0x51fa10)[_0x9bc0('0x24')](function(_0x1255a0){_0x533e0c[_0x9bc0('0x1d')]=_0x1255a0;if(_0x3640f8[_0x9bc0('0x30')][_0x9bc0('0x42')]){_0x11ed08[_0x9bc0('0x43')]=[{'all':!![]}];}return db[_0x9bc0('0x2b')][_0x9bc0('0x44')](_0x11ed08);})[_0x9bc0('0x24')](function(_0x143750){_0x533e0c[_0x9bc0('0x45')]=_0x143750;return _0x533e0c;})['then'](respondWithFilteredResult(_0x2ddf39,_0x11ed08))[_0x9bc0('0x46')](handleError(_0x2ddf39,null));};exports['show']=function(_0x4cc752,_0xc37d34){var _0x14ce4c={'raw':!![],'where':{'id':_0x4cc752['params']['id']}},_0x43ecb7={};_0x43ecb7[_0x9bc0('0x34')]=_['keys'](db[_0x9bc0('0x2b')][_0x9bc0('0x2c')]);_0x43ecb7[_0x9bc0('0x30')]=_[_0x9bc0('0x31')](_0x4cc752['query']);_0x43ecb7[_0x9bc0('0x3d')]=_[_0x9bc0('0x32')](_0x43ecb7['model'],_0x43ecb7['query']);_0x14ce4c[_0x9bc0('0x33')]=_['intersection'](_0x43ecb7['model'],qs[_0x9bc0('0x35')](_0x4cc752['query']['fields']));_0x14ce4c['attributes']=_0x14ce4c['attributes'][_0x9bc0('0x36')]?_0x14ce4c[_0x9bc0('0x33')]:_0x43ecb7[_0x9bc0('0x34')];if(_0x4cc752['query'][_0x9bc0('0x42')]){_0x14ce4c['include']=[{'all':!![]}];}_0x14ce4c=_[_0x9bc0('0x3f')]({},_0x14ce4c,_0x4cc752['options']);return db[_0x9bc0('0x2b')][_0x9bc0('0x47')](_0x14ce4c)[_0x9bc0('0x24')](handleEntityNotFound(_0xc37d34,null))['then'](respondWithResult(_0xc37d34,null))[_0x9bc0('0x46')](handleError(_0xc37d34,null));};exports[_0x9bc0('0x48')]=function(_0x3cc6f4,_0x50e556){return db[_0x9bc0('0x2b')][_0x9bc0('0x48')](_0x3cc6f4[_0x9bc0('0x49')],{})['then'](respondWithResult(_0x50e556,0xc9))[_0x9bc0('0x46')](handleError(_0x50e556,null));};exports['update']=function(_0x1539c5,_0x3ee807){if(_0x1539c5[_0x9bc0('0x49')]['id']){delete _0x1539c5[_0x9bc0('0x49')]['id'];}return db[_0x9bc0('0x2b')][_0x9bc0('0x47')]({'where':{'id':_0x1539c5[_0x9bc0('0x4a')]['id']}})[_0x9bc0('0x24')](handleEntityNotFound(_0x3ee807,null))['then'](saveUpdates(_0x1539c5[_0x9bc0('0x49')],null))[_0x9bc0('0x24')](respondWithResult(_0x3ee807,null))[_0x9bc0('0x46')](handleError(_0x3ee807,null));};exports['destroy']=function(_0x33240c,_0x7ccd5c){return db[_0x9bc0('0x2b')][_0x9bc0('0x47')]({'where':{'id':_0x33240c[_0x9bc0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x7ccd5c,null))[_0x9bc0('0x24')](removeEntity(_0x7ccd5c,null))['catch'](handleError(_0x7ccd5c,null));};exports[_0x9bc0('0x4b')]=function(_0x2d126a,_0x563a2d){return db[_0x9bc0('0x2b')][_0x9bc0('0x4b')]()[_0x9bc0('0x24')](respondWithResult(_0x563a2d,null))[_0x9bc0('0x46')](handleError(_0x563a2d,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index bc2c598..9c8d8a3 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 _0x6d38=['uniqueid','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./cdr.attributes','define','Cdr','accountcode','calldate','dst'];(function(_0x38be46,_0x524fe1){var _0x192474=function(_0x1ca022){while(--_0x1ca022){_0x38be46['push'](_0x38be46['shift']());}};_0x192474(++_0x524fe1);}(_0x6d38,0x1ef));var _0x86d3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6d38[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x86d3('0x9')]},{'name':_0x86d3('0xa'),'fields':[_0x86d3('0xa')]},{'name':'disposition','fields':['disposition']},{'name':_0x86d3('0xb'),'fields':[_0x86d3('0xb')]},{'name':'src','fields':['src']},{'name':_0x86d3('0xc'),'fields':[_0x86d3('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd117=['accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr'];(function(_0x671eba,_0x2bcb9a){var _0x440b7f=function(_0x46d6bc){while(--_0x46d6bc){_0x671eba['push'](_0x671eba['shift']());}};_0x440b7f(++_0x2bcb9a);}(_0xd117,0x182));var _0x7d11=function(_0x74115b,_0x31f752){_0x74115b=_0x74115b-0x0;var _0x57ebbd=_0xd117[_0x74115b];return _0x57ebbd;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));module[_0x7d11('0xb')]=function(_0x27d7e8,_0x40c3c4){return _0x27d7e8[_0x7d11('0xc')](_0x7d11('0xd'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7d11('0xe'),'fields':[_0x7d11('0xe')]},{'name':_0x7d11('0xf'),'fields':['calldate']},{'name':_0x7d11('0x10'),'fields':[_0x7d11('0x10')]},{'name':_0x7d11('0x11'),'fields':['dst']},{'name':_0x7d11('0x12'),'fields':['src']},{'name':'uniqueid','fields':[_0x7d11('0x13')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 1fbda62..85892e7 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 _0xdca6=['rpc','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0xdca6,0x185));var _0x6dca=function(_0x2b1de3,_0x42bcc0){_0x2b1de3=_0x2b1de3-0x0;var _0x117643=_0xdca6[_0x2b1de3];return _0x117643;};'use strict';var _=require(_0x6dca('0x0'));var util=require(_0x6dca('0x1'));var moment=require(_0x6dca('0x2'));var BPromise=require(_0x6dca('0x3'));var rs=require(_0x6dca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6dca('0x6'))(_0x6dca('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6dca('0x8')][_0x6dca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x248a33,_0x2c10ae,_0x5c2f2f){return new BPromise(function(_0x29547a,_0x145e85){return client[_0x6dca('0xa')](_0x248a33,_0x5c2f2f)[_0x6dca('0xb')](function(_0x281604){logger[_0x6dca('0xc')](_0x6dca('0xd'),_0x2c10ae,_0x6dca('0xe'));logger[_0x6dca('0xf')](_0x6dca('0x10'),_0x2c10ae,_0x6dca('0xe'),JSON[_0x6dca('0x11')](_0x281604));if(_0x281604[_0x6dca('0x12')]){if(_0x281604[_0x6dca('0x12')]['code']===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x2c10ae,_0x281604['error'][_0x6dca('0x13')]);return _0x145e85(_0x281604[_0x6dca('0x12')][_0x6dca('0x13')]);}logger['error'](_0x6dca('0xd'),_0x2c10ae,_0x281604[_0x6dca('0x12')][_0x6dca('0x13')]);return _0x29547a(_0x281604[_0x6dca('0x12')][_0x6dca('0x13')]);}else{logger[_0x6dca('0xc')](_0x6dca('0xd'),_0x2c10ae,_0x6dca('0xe'));_0x29547a(_0x281604[_0x6dca('0x14')][_0x6dca('0x13')]);}})[_0x6dca('0x15')](function(_0x3e061a){logger[_0x6dca('0x12')](_0x6dca('0xd'),_0x2c10ae,_0x3e061a);_0x145e85(_0x3e061a);});});} \ No newline at end of file +var _0x9964=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4ec87b,_0x99603a){var _0x246570=function(_0x4b84cb){while(--_0x4b84cb){_0x4ec87b['push'](_0x4ec87b['shift']());}};_0x246570(++_0x99603a);}(_0x9964,0x1e4));var _0x4996=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0x9964[_0x305b20];return _0x26d64a;};'use strict';var _=require(_0x4996('0x0'));var util=require('util');var moment=require(_0x4996('0x1'));var BPromise=require(_0x4996('0x2'));var rs=require(_0x4996('0x3'));var fs=require('fs');var Redis=require(_0x4996('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4996('0x5'));var logger=require(_0x4996('0x6'))(_0x4996('0x7'));var config=require(_0x4996('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4996('0x9')][_0x4996('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3960a0,_0x38be03,_0x4fd2da){return new BPromise(function(_0x2e160f,_0x4fab92){return client[_0x4996('0xb')](_0x3960a0,_0x4fd2da)[_0x4996('0xc')](function(_0x3f1afa){logger[_0x4996('0xd')](_0x4996('0xe'),_0x38be03,_0x4996('0xf'));logger[_0x4996('0x10')](_0x4996('0x11'),_0x38be03,_0x4996('0xf'),JSON[_0x4996('0x12')](_0x3f1afa));if(_0x3f1afa[_0x4996('0x13')]){if(_0x3f1afa[_0x4996('0x13')][_0x4996('0x14')]===0x1f4){logger[_0x4996('0x13')](_0x4996('0xe'),_0x38be03,_0x3f1afa[_0x4996('0x13')][_0x4996('0x15')]);return _0x4fab92(_0x3f1afa[_0x4996('0x13')]['message']);}logger[_0x4996('0x13')](_0x4996('0xe'),_0x38be03,_0x3f1afa[_0x4996('0x13')][_0x4996('0x15')]);return _0x2e160f(_0x3f1afa[_0x4996('0x13')][_0x4996('0x15')]);}else{logger[_0x4996('0xd')](_0x4996('0xe'),_0x38be03,_0x4996('0xf'));_0x2e160f(_0x3f1afa['result'][_0x4996('0x15')]);}})[_0x4996('0x16')](function(_0x39e23f){logger['error'](_0x4996('0xe'),_0x38be03,_0x39e23f);_0x4fab92(_0x39e23f);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c84ac81..03adab5 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 _0x8fad=['update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cdr.controller','isAuthenticated','index','/describe','describe','get','show','post','create','put'];(function(_0x5389a9,_0x221b3f){var _0x4f435b=function(_0x33ff2d){while(--_0x33ff2d){_0x5389a9['push'](_0x5389a9['shift']());}};_0x4f435b(++_0x221b3f);}(_0x8fad,0x193));var _0xd8fa=function(_0x3ef97f,_0x14ab21){_0x3ef97f=_0x3ef97f-0x0;var _0x3cda91=_0x8fad[_0x3ef97f];return _0x3cda91;};'use strict';var multer=require(_0xd8fa('0x0'));var util=require(_0xd8fa('0x1'));var path=require('path');var timeout=require(_0xd8fa('0x2'));var express=require('express');var router=express[_0xd8fa('0x3')]();var fs_extra=require(_0xd8fa('0x4'));var auth=require(_0xd8fa('0x5'));var interaction=require(_0xd8fa('0x6'));var config=require('../../config/environment');var controller=require(_0xd8fa('0x7'));router['get']('/',auth[_0xd8fa('0x8')](),controller[_0xd8fa('0x9')]);router['get'](_0xd8fa('0xa'),auth[_0xd8fa('0x8')](),controller[_0xd8fa('0xb')]);router[_0xd8fa('0xc')]('/:id',auth[_0xd8fa('0x8')](),controller[_0xd8fa('0xd')]);router[_0xd8fa('0xe')]('/',auth[_0xd8fa('0x8')](),controller[_0xd8fa('0xf')]);router[_0xd8fa('0x10')]('/:id',auth[_0xd8fa('0x8')](),controller[_0xd8fa('0x11')]);router[_0xd8fa('0x12')]('/:id',auth[_0xd8fa('0x8')](),controller[_0xd8fa('0x13')]);module[_0xd8fa('0x14')]=router; \ No newline at end of file +var _0x1da0=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','/describe','show','post','put','/:id','update','destroy'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x1da0,0x79));var _0x01da=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0x1da0[_0x3b2369];return _0x5a1367;};'use strict';var multer=require(_0x01da('0x0'));var util=require(_0x01da('0x1'));var path=require(_0x01da('0x2'));var timeout=require(_0x01da('0x3'));var express=require(_0x01da('0x4'));var router=express['Router']();var fs_extra=require(_0x01da('0x5'));var auth=require(_0x01da('0x6'));var interaction=require(_0x01da('0x7'));var config=require(_0x01da('0x8'));var controller=require(_0x01da('0x9'));router[_0x01da('0xa')]('/',auth[_0x01da('0xb')](),controller['index']);router[_0x01da('0xa')](_0x01da('0xc'),auth[_0x01da('0xb')](),controller['describe']);router[_0x01da('0xa')]('/:id',auth[_0x01da('0xb')](),controller[_0x01da('0xd')]);router[_0x01da('0xe')]('/',auth[_0x01da('0xb')](),controller['create']);router[_0x01da('0xf')](_0x01da('0x10'),auth[_0x01da('0xb')](),controller[_0x01da('0x11')]);router['delete'](_0x01da('0x10'),auth[_0x01da('0xb')](),controller[_0x01da('0x12')]);module[_0x01da('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 6cfa230..53959e7 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 _0x5d6f=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x1e2c81,_0x3ef0e2){var _0x166936=function(_0x13c7dc){while(--_0x13c7dc){_0x1e2c81['push'](_0x1e2c81['shift']());}};_0x166936(++_0x3ef0e2);}(_0x5d6f,0x111));var _0xf5d6=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x5d6f[_0x173452];return _0xee3fd0;};'use strict';var Sequelize=require(_0xf5d6('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf5d6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf5d6('0x2')],'allowNull':![],'defaultValue':_0xf5d6('0x3')},'appdata':{'type':Sequelize[_0xf5d6('0x4')]()},'description':{'type':Sequelize[_0xf5d6('0x2')]},'interval':{'type':Sequelize[_0xf5d6('0x2')],'defaultValue':_0xf5d6('0x5')}}; \ No newline at end of file +var _0xa825=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x10c6a2,_0x1be3b2){var _0xd4842a=function(_0x20e826){while(--_0x20e826){_0x10c6a2['push'](_0x10c6a2['shift']());}};_0xd4842a(++_0x1be3b2);}(_0xa825,0xf2));var _0x5a82=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa825[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x5a82('0x0'));module[_0x5a82('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5a82('0x2')],'allowNull':![],'defaultValue':_0x5a82('0x3')},'appdata':{'type':Sequelize[_0x5a82('0x4')]()},'description':{'type':Sequelize[_0x5a82('0x2')]},'interval':{'type':Sequelize[_0x5a82('0x2')],'defaultValue':_0x5a82('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index d1b112e..dac3cc8 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 _0x34e8=['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','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','name','send','show','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','catch','body','params','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto'];(function(_0x16d39b,_0x100769){var _0x1bf6da=function(_0x40e3e0){while(--_0x40e3e0){_0x16d39b['push'](_0x16d39b['shift']());}};_0x1bf6da(++_0x100769);}(_0x34e8,0x12c));var _0x834e=function(_0x3d1c87,_0x454ccf){_0x3d1c87=_0x3d1c87-0x0;var _0x543777=_0x34e8[_0x3d1c87];return _0x543777;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x834e('0xc'));var squel=require(_0x834e('0xd'));var crypto=require(_0x834e('0xe'));var jsforce=require(_0x834e('0xf'));var deskjs=require(_0x834e('0x10'));var toCsv=require(_0x834e('0x11'));var querystring=require(_0x834e('0x12'));var Papa=require(_0x834e('0x13'));var Redis=require(_0x834e('0x14'));var authService=require(_0x834e('0x15'));var qs=require(_0x834e('0x16'));var as=require(_0x834e('0x17'));var hardwareService=require(_0x834e('0x18'));var logger=require(_0x834e('0x19'))(_0x834e('0x1a'));var utils=require(_0x834e('0x1b'));var config=require(_0x834e('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x834e('0x1d'))['db'];function respondWithStatusCode(_0x6cd9b9,_0x58a27e){_0x58a27e=_0x58a27e||0xcc;return function(_0x23848e){if(_0x23848e){return _0x6cd9b9[_0x834e('0x1e')](_0x58a27e);}return _0x6cd9b9[_0x834e('0x1f')](_0x58a27e)[_0x834e('0x20')]();};}function respondWithResult(_0x50e860,_0x43156c){_0x43156c=_0x43156c||0xc8;return function(_0x302cbd){if(_0x302cbd){return _0x50e860['status'](_0x43156c)[_0x834e('0x21')](_0x302cbd);}};}function respondWithFilteredResult(_0x4a9cdc,_0x38a8cd){return function(_0x36d443){if(_0x36d443){var _0x478afe=_0x36d443['count'],_0x43ac41=_0x38a8cd[_0x834e('0x22')],_0x22106e=_0x38a8cd[_0x834e('0x22')]+_0x38a8cd[_0x834e('0x23')],_0x370fb5;if(_0x22106e>=_0x478afe){_0x22106e=_0x478afe;_0x370fb5=0xc8;}else{_0x370fb5=0xce;}_0x4a9cdc[_0x834e('0x1f')](_0x370fb5);return _0x4a9cdc[_0x834e('0x24')](_0x834e('0x25'),_0x43ac41+'-'+_0x22106e+'/'+_0x478afe)[_0x834e('0x21')](_0x36d443);}return null;};}function patchUpdates(_0x595515){return function(_0x2545b4){try{jsonpatch[_0x834e('0x26')](_0x2545b4,_0x595515,!![]);}catch(_0x113ff4){return BPromise[_0x834e('0x27')](_0x113ff4);}return _0x2545b4['save']();};}function saveUpdates(_0x45a630,_0x62f8f1){return function(_0x5a05c0){if(_0x5a05c0){return _0x5a05c0[_0x834e('0x28')](_0x45a630)[_0x834e('0x29')](function(_0x8d406e){return _0x8d406e;});}return null;};}function removeEntity(_0x5c55ca,_0x4e3f48){return function(_0x231619){if(_0x231619){return _0x231619[_0x834e('0x2a')]()['then'](function(){_0x5c55ca[_0x834e('0x1f')](0xcc)[_0x834e('0x20')]();});}};}function handleEntityNotFound(_0x58f4fd,_0x3bc4f7){return function(_0x2e1983){if(!_0x2e1983){_0x58f4fd[_0x834e('0x1e')](0x194);}return _0x2e1983;};}function handleError(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0x1f4;return function(_0x3e310f){logger['error'](_0x3e310f['stack']);if(_0x3e310f[_0x834e('0x2b')]){delete _0x3e310f['name'];}_0x561cd2[_0x834e('0x1f')](_0x24fcf7)[_0x834e('0x2c')](_0x3e310f);};}exports[_0x834e('0x2d')]=function(_0x2cc2eb,_0x3cd928){var _0x130cc5={'raw':!![],'where':{'id':_0x2cc2eb['params']['id']}},_0x491919={};_0x491919['model']=_['keys'](db[_0x834e('0x2e')][_0x834e('0x2f')]);_0x491919[_0x834e('0x30')]=_['keys'](_0x2cc2eb[_0x834e('0x30')]);_0x491919[_0x834e('0x31')]=_[_0x834e('0x32')](_0x491919[_0x834e('0x33')],_0x491919[_0x834e('0x30')]);_0x130cc5[_0x834e('0x34')]=_[_0x834e('0x32')](_0x491919[_0x834e('0x33')],qs[_0x834e('0x35')](_0x2cc2eb['query'][_0x834e('0x35')]));_0x130cc5['attributes']=_0x130cc5[_0x834e('0x34')][_0x834e('0x36')]?_0x130cc5[_0x834e('0x34')]:_0x491919[_0x834e('0x33')];if(_0x2cc2eb[_0x834e('0x30')][_0x834e('0x37')]){_0x130cc5[_0x834e('0x38')]=[{'all':!![]}];}_0x130cc5=_[_0x834e('0x39')]({},_0x130cc5,_0x2cc2eb[_0x834e('0x3a')]);return db[_0x834e('0x2e')]['find'](_0x130cc5)[_0x834e('0x29')](handleEntityNotFound(_0x3cd928,null))[_0x834e('0x29')](respondWithResult(_0x3cd928,null))[_0x834e('0x3b')](handleError(_0x3cd928,null));};exports[_0x834e('0x28')]=function(_0x595cc0,_0x3f88ad){if(_0x595cc0[_0x834e('0x3c')]['id']){delete _0x595cc0['body']['id'];}return db['ChatApplication']['find']({'where':{'id':_0x595cc0[_0x834e('0x3d')]['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x3f88ad,null))[_0x834e('0x29')](saveUpdates(_0x595cc0[_0x834e('0x3c')],null))[_0x834e('0x29')](respondWithResult(_0x3f88ad,null))[_0x834e('0x3b')](handleError(_0x3f88ad,null));};exports['destroy']=function(_0x2c2d94,_0x513f36){return db[_0x834e('0x2e')][_0x834e('0x3e')]({'where':{'id':_0x2c2d94['params']['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x513f36,null))[_0x834e('0x29')](removeEntity(_0x513f36,null))['catch'](handleError(_0x513f36,null));}; \ No newline at end of file +var _0x3e74=['api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','params','model','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','catch','update','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x47de9a,_0x40cf23){var _0x4b9d6c=function(_0x507054){while(--_0x507054){_0x47de9a['push'](_0x47de9a['shift']());}};_0x4b9d6c(++_0x40cf23);}(_0x3e74,0x175));var _0x43e7=function(_0x24eee9,_0x37321a){_0x24eee9=_0x24eee9-0x0;var _0x3babbb=_0x3e74[_0x24eee9];return _0x3babbb;};'use strict';var pdf=require(_0x43e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43e7('0x1'));var zipdir=require(_0x43e7('0x2'));var jsonpatch=require(_0x43e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43e7('0x4'));var Mustache=require('mustache');var util=require(_0x43e7('0x5'));var path=require(_0x43e7('0x6'));var sox=require(_0x43e7('0x7'));var csv=require(_0x43e7('0x8'));var ejs=require(_0x43e7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43e7('0xa'));var squel=require(_0x43e7('0xb'));var crypto=require(_0x43e7('0xc'));var jsforce=require(_0x43e7('0xd'));var deskjs=require(_0x43e7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x43e7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x43e7('0x10'));var qs=require(_0x43e7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43e7('0x12'));var logger=require('../../config/logger')(_0x43e7('0x13'));var utils=require(_0x43e7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x43e7('0x15'));var db=require(_0x43e7('0x16'))['db'];function respondWithStatusCode(_0x2718d3,_0x3bb83f){_0x3bb83f=_0x3bb83f||0xcc;return function(_0x4e008c){if(_0x4e008c){return _0x2718d3['sendStatus'](_0x3bb83f);}return _0x2718d3[_0x43e7('0x17')](_0x3bb83f)[_0x43e7('0x18')]();};}function respondWithResult(_0x44b0bd,_0x51b974){_0x51b974=_0x51b974||0xc8;return function(_0x5e641c){if(_0x5e641c){return _0x44b0bd[_0x43e7('0x17')](_0x51b974)[_0x43e7('0x19')](_0x5e641c);}};}function respondWithFilteredResult(_0x203378,_0x328445){return function(_0x4de324){if(_0x4de324){var _0x5c4eaa=_0x4de324['count'],_0xdf16c=_0x328445['offset'],_0x264575=_0x328445[_0x43e7('0x1a')]+_0x328445[_0x43e7('0x1b')],_0x273a32;if(_0x264575>=_0x5c4eaa){_0x264575=_0x5c4eaa;_0x273a32=0xc8;}else{_0x273a32=0xce;}_0x203378[_0x43e7('0x17')](_0x273a32);return _0x203378[_0x43e7('0x1c')](_0x43e7('0x1d'),_0xdf16c+'-'+_0x264575+'/'+_0x5c4eaa)[_0x43e7('0x19')](_0x4de324);}return null;};}function patchUpdates(_0x619236){return function(_0x1441ef){try{jsonpatch[_0x43e7('0x1e')](_0x1441ef,_0x619236,!![]);}catch(_0xab63cf){return BPromise[_0x43e7('0x1f')](_0xab63cf);}return _0x1441ef[_0x43e7('0x20')]();};}function saveUpdates(_0x4b5d64,_0xef1a5a){return function(_0x3c6625){if(_0x3c6625){return _0x3c6625['update'](_0x4b5d64)[_0x43e7('0x21')](function(_0x3e281e){return _0x3e281e;});}return null;};}function removeEntity(_0x3945bb,_0x28aacc){return function(_0x4077fb){if(_0x4077fb){return _0x4077fb[_0x43e7('0x22')]()['then'](function(){_0x3945bb[_0x43e7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c9df3,_0x47204e){return function(_0x43f4ff){if(!_0x43f4ff){_0x4c9df3['sendStatus'](0x194);}return _0x43f4ff;};}function handleError(_0x1f0673,_0x4ca5cf){_0x4ca5cf=_0x4ca5cf||0x1f4;return function(_0x326dab){logger['error'](_0x326dab[_0x43e7('0x23')]);if(_0x326dab[_0x43e7('0x24')]){delete _0x326dab[_0x43e7('0x24')];}_0x1f0673[_0x43e7('0x17')](_0x4ca5cf)['send'](_0x326dab);};}exports['show']=function(_0x805b54,_0x501551){var _0x2dd5f={'raw':!![],'where':{'id':_0x805b54[_0x43e7('0x25')]['id']}},_0x40dc8f={};_0x40dc8f[_0x43e7('0x26')]=_['keys'](db[_0x43e7('0x27')][_0x43e7('0x28')]);_0x40dc8f[_0x43e7('0x29')]=_[_0x43e7('0x2a')](_0x805b54[_0x43e7('0x29')]);_0x40dc8f[_0x43e7('0x2b')]=_[_0x43e7('0x2c')](_0x40dc8f[_0x43e7('0x26')],_0x40dc8f[_0x43e7('0x29')]);_0x2dd5f[_0x43e7('0x2d')]=_[_0x43e7('0x2c')](_0x40dc8f[_0x43e7('0x26')],qs[_0x43e7('0x2e')](_0x805b54[_0x43e7('0x29')]['fields']));_0x2dd5f[_0x43e7('0x2d')]=_0x2dd5f[_0x43e7('0x2d')][_0x43e7('0x2f')]?_0x2dd5f[_0x43e7('0x2d')]:_0x40dc8f[_0x43e7('0x26')];if(_0x805b54['query'][_0x43e7('0x30')]){_0x2dd5f[_0x43e7('0x31')]=[{'all':!![]}];}_0x2dd5f=_[_0x43e7('0x32')]({},_0x2dd5f,_0x805b54[_0x43e7('0x33')]);return db['ChatApplication']['find'](_0x2dd5f)['then'](handleEntityNotFound(_0x501551,null))[_0x43e7('0x21')](respondWithResult(_0x501551,null))[_0x43e7('0x34')](handleError(_0x501551,null));};exports[_0x43e7('0x35')]=function(_0x234fe6,_0x108313){if(_0x234fe6[_0x43e7('0x36')]['id']){delete _0x234fe6['body']['id'];}return db['ChatApplication']['find']({'where':{'id':_0x234fe6['params']['id']}})['then'](handleEntityNotFound(_0x108313,null))['then'](saveUpdates(_0x234fe6['body'],null))[_0x43e7('0x21')](respondWithResult(_0x108313,null))['catch'](handleError(_0x108313,null));};exports[_0x43e7('0x22')]=function(_0x8e9f40,_0x31bc78){return db[_0x43e7('0x27')][_0x43e7('0x37')]({'where':{'id':_0x8e9f40[_0x43e7('0x25')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x31bc78,null))['then'](removeEntity(_0x31bc78,null))['catch'](handleError(_0x31bc78,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a7b5fd9..5e90f6b 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 _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 987029d..6581066 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 _0x32b6=['client','http','info','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1794e6,_0x5b5676){var _0x1c1b66=function(_0x40082d){while(--_0x40082d){_0x1794e6['push'](_0x1794e6['shift']());}};_0x1c1b66(++_0x5b5676);}(_0x32b6,0x10f));var _0x632b=function(_0x18c560,_0x49c349){_0x18c560=_0x18c560-0x0;var _0x22f9e8=_0x32b6[_0x18c560];return _0x22f9e8;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require(_0x632b('0x2'));var BPromise=require('bluebird');var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require(_0x632b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x5'));var logger=require(_0x632b('0x6'))(_0x632b('0x7'));var config=require(_0x632b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc7a3e,_0x162a4b,_0xdcde8d){return new BPromise(function(_0x7b6ab1,_0x3adc37){return client['request'](_0xc7a3e,_0xdcde8d)['then'](function(_0x465568){logger[_0x632b('0xb')]('ChatApplication,\x20%s,\x20%s',_0x162a4b,_0x632b('0xc'));logger['debug'](_0x632b('0xd'),_0x162a4b,'request\x20sent',JSON['stringify'](_0x465568));if(_0x465568[_0x632b('0xe')]){if(_0x465568['error'][_0x632b('0xf')]===0x1f4){logger[_0x632b('0xe')](_0x632b('0x10'),_0x162a4b,_0x465568[_0x632b('0xe')][_0x632b('0x11')]);return _0x3adc37(_0x465568[_0x632b('0xe')][_0x632b('0x11')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x162a4b,_0x465568[_0x632b('0xe')]['message']);return _0x7b6ab1(_0x465568[_0x632b('0xe')][_0x632b('0x11')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x162a4b,_0x632b('0xc'));_0x7b6ab1(_0x465568[_0x632b('0x12')][_0x632b('0x11')]);}})[_0x632b('0x13')](function(_0x4f4ab8){logger['error'](_0x632b('0x10'),_0x162a4b,_0x4f4ab8);_0x3adc37(_0x4f4ab8);});});} \ No newline at end of file +var _0x15fe=['error','code','ChatApplication,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x579229,_0x169cd8){var _0x5083bb=function(_0x51fdb5){while(--_0x51fdb5){_0x579229['push'](_0x579229['shift']());}};_0x5083bb(++_0x169cd8);}(_0x15fe,0x126));var _0xe15f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe15f('0x0'));var util=require(_0xe15f('0x1'));var moment=require(_0xe15f('0x2'));var BPromise=require(_0xe15f('0x3'));var rs=require(_0xe15f('0x4'));var fs=require('fs');var Redis=require(_0xe15f('0x5'));var db=require(_0xe15f('0x6'))['db'];var utils=require(_0xe15f('0x7'));var logger=require(_0xe15f('0x8'))(_0xe15f('0x9'));var config=require(_0xe15f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe15f('0xb')][_0xe15f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1745bd,_0x5511d1,_0x58fe94){return new BPromise(function(_0x4689b6,_0x5a9dca){return client[_0xe15f('0xd')](_0x1745bd,_0x58fe94)[_0xe15f('0xe')](function(_0x3d69ad){logger[_0xe15f('0xf')]('ChatApplication,\x20%s,\x20%s',_0x5511d1,'request\x20sent');logger[_0xe15f('0x10')](_0xe15f('0x11'),_0x5511d1,'request\x20sent',JSON['stringify'](_0x3d69ad));if(_0x3d69ad[_0xe15f('0x12')]){if(_0x3d69ad[_0xe15f('0x12')][_0xe15f('0x13')]===0x1f4){logger[_0xe15f('0x12')](_0xe15f('0x14'),_0x5511d1,_0x3d69ad[_0xe15f('0x12')][_0xe15f('0x15')]);return _0x5a9dca(_0x3d69ad['error']['message']);}logger['error'](_0xe15f('0x14'),_0x5511d1,_0x3d69ad[_0xe15f('0x12')][_0xe15f('0x15')]);return _0x4689b6(_0x3d69ad[_0xe15f('0x12')]['message']);}else{logger['info'](_0xe15f('0x14'),_0x5511d1,_0xe15f('0x16'));_0x4689b6(_0x3d69ad[_0xe15f('0x17')][_0xe15f('0x15')]);}})['catch'](function(_0x246fdb){logger[_0xe15f('0x12')](_0xe15f('0x14'),_0x5511d1,_0x246fdb);_0x5a9dca(_0x246fdb);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 48f7d3d..61775f5 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 _0xe4de=['./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f67c6,_0x3ce1d3){var _0x2faa13=function(_0x293026){while(--_0x293026){_0x4f67c6['push'](_0x4f67c6['shift']());}};_0x2faa13(++_0x3ce1d3);}(_0xe4de,0xb3));var _0xee4d=function(_0x5c1f9b,_0x321904){_0x5c1f9b=_0x5c1f9b-0x0;var _0x587d4f=_0xe4de[_0x5c1f9b];return _0x587d4f;};'use strict';var multer=require(_0xee4d('0x0'));var util=require(_0xee4d('0x1'));var path=require(_0xee4d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xee4d('0x3')]();var fs_extra=require(_0xee4d('0x4'));var auth=require(_0xee4d('0x5'));var interaction=require(_0xee4d('0x6'));var config=require(_0xee4d('0x7'));var controller=require(_0xee4d('0x8'));router[_0xee4d('0x9')](_0xee4d('0xa'),auth[_0xee4d('0xb')](),controller[_0xee4d('0xc')]);router[_0xee4d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xee4d('0xe')]);router[_0xee4d('0xf')](_0xee4d('0xa'),auth[_0xee4d('0xb')](),controller[_0xee4d('0x10')]);module['exports']=router; \ No newline at end of file +var _0x98ca=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','show','put','isAuthenticated','update','delete','destroy','exports'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0x98ca,0x1e0));var _0xa98c=function(_0xc09df8,_0x579f26){_0xc09df8=_0xc09df8-0x0;var _0x431c3a=_0x98ca[_0xc09df8];return _0x431c3a;};'use strict';var multer=require(_0xa98c('0x0'));var util=require(_0xa98c('0x1'));var path=require(_0xa98c('0x2'));var timeout=require(_0xa98c('0x3'));var express=require(_0xa98c('0x4'));var router=express[_0xa98c('0x5')]();var fs_extra=require(_0xa98c('0x6'));var auth=require(_0xa98c('0x7'));var interaction=require(_0xa98c('0x8'));var config=require(_0xa98c('0x9'));var controller=require(_0xa98c('0xa'));router[_0xa98c('0xb')](_0xa98c('0xc'),auth['isAuthenticated'](),controller[_0xa98c('0xd')]);router[_0xa98c('0xe')](_0xa98c('0xc'),auth[_0xa98c('0xf')](),controller[_0xa98c('0x10')]);router[_0xa98c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa98c('0x12')]);module[_0xa98c('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 0ab274f..72dc0e7 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 _0x395d=['BOOLEAN','STRING'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x395d,0xb7));var _0xd395=function(_0xa9af82,_0x224229){_0xa9af82=_0xa9af82-0x0;var _0x2c355d=_0x395d[_0xa9af82];return _0x2c355d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd395('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xd395('0x0')]},'write':{'type':Sequelize[_0xd395('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x02f1=['STRING','BOOLEAN','sequelize'];(function(_0xa28e26,_0x2222a4){var _0xe69f4c=function(_0x2ffa24){while(--_0x2ffa24){_0xa28e26['push'](_0xa28e26['shift']());}};_0xe69f4c(++_0x2222a4);}(_0x02f1,0x9b));var _0x102f=function(_0xb1c6d7,_0xa5bef3){_0xb1c6d7=_0xb1c6d7-0x0;var _0x403072=_0x02f1[_0xb1c6d7];return _0x403072;};'use strict';var Sequelize=require(_0x102f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x102f('0x1')]},'write':{'type':Sequelize[_0x102f('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index b5d3467..099c454 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 _0xa9e0=['socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','then','end','stack','name','index','ChatGroup','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','show','params','find','create','body','update','describe','getUnread','ChatInternalMessage','user','addMembers','ids','getMembers','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x3c8499,_0x1e052e){var _0x51d346=function(_0x311729){while(--_0x311729){_0x3c8499['push'](_0x3c8499['shift']());}};_0x51d346(++_0x1e052e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);var jayson=require(_0x0a9e('0x1b'));var client=jayson[_0x0a9e('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22dccb,_0x5d0880,_0x1985b6,_0x519dfd){return new BPromise(function(_0x16033c,_0x12066b){var _0x48f32d=_0x519dfd||client;return _0x48f32d[_0x0a9e('0x1d')](_0x22dccb,_0x1985b6)['then'](function(_0x459eb1){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x5d0880,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x5d0880,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x459eb1));if(_0x459eb1[_0x0a9e('0x24')]){if(_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger[_0x0a9e('0x24')]('ChatGroup,\x20%s,\x20%s',_0x5d0880,_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x459eb1['error'][_0x0a9e('0x26')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x5d0880,_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x16033c(_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);}else{logger['info'](_0x0a9e('0x1f'),_0x5d0880,_0x0a9e('0x20'));_0x16033c(_0x459eb1[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x42ac8f){logger[_0x0a9e('0x24')]('ChatGroup,\x20%s,\x20%s',_0x5d0880,_0x42ac8f);_0x12066b(_0x42ac8f);});});}function respondWithStatusCode(_0x59181e,_0x197ec0){_0x197ec0=_0x197ec0||0xcc;return function(_0x3a8e58){if(_0x3a8e58){return _0x59181e[_0x0a9e('0x29')](_0x197ec0);}return _0x59181e[_0x0a9e('0x2a')](_0x197ec0)['end']();};}function respondWithResult(_0x384319,_0x479bc4){_0x479bc4=_0x479bc4||0xc8;return function(_0x45a1e7){if(_0x45a1e7){return _0x384319['status'](_0x479bc4)[_0x0a9e('0x2b')](_0x45a1e7);}};}function respondWithFilteredResult(_0x34dc65,_0x25fba9){return function(_0x14433c){if(_0x14433c){var _0x140511=_0x14433c['count'],_0x1538a4=_0x25fba9[_0x0a9e('0x2c')],_0x11c3b6=_0x25fba9[_0x0a9e('0x2c')]+_0x25fba9[_0x0a9e('0x2d')],_0x14de77;if(_0x11c3b6>=_0x140511){_0x11c3b6=_0x140511;_0x14de77=0xc8;}else{_0x14de77=0xce;}_0x34dc65[_0x0a9e('0x2a')](_0x14de77);return _0x34dc65['set'](_0x0a9e('0x2e'),_0x1538a4+'-'+_0x11c3b6+'/'+_0x140511)[_0x0a9e('0x2b')](_0x14433c);}return null;};}function patchUpdates(_0x1843b2){return function(_0x824a4f){try{jsonpatch[_0x0a9e('0x2f')](_0x824a4f,_0x1843b2,!![]);}catch(_0x563b45){return BPromise[_0x0a9e('0x30')](_0x563b45);}return _0x824a4f[_0x0a9e('0x31')]();};}function saveUpdates(_0x1dbde2,_0x540530){return function(_0x426950){if(_0x426950){return _0x426950['update'](_0x1dbde2)[_0x0a9e('0x32')](function(_0x3ae878){return _0x3ae878;});}return null;};}function removeEntity(_0x1122db,_0x33bdb7){return function(_0x25ce3a){if(_0x25ce3a){return _0x25ce3a['destroy']()[_0x0a9e('0x32')](function(){_0x1122db[_0x0a9e('0x2a')](0xcc)[_0x0a9e('0x33')]();});}};}function handleEntityNotFound(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(!_0x409319){_0x2da5c0[_0x0a9e('0x29')](0x194);}return _0x409319;};}function handleError(_0x39e565,_0x5583a4){_0x5583a4=_0x5583a4||0x1f4;return function(_0x44295a){logger['error'](_0x44295a[_0x0a9e('0x34')]);if(_0x44295a[_0x0a9e('0x35')]){delete _0x44295a[_0x0a9e('0x35')];}_0x39e565[_0x0a9e('0x2a')](_0x5583a4)['send'](_0x44295a);};}exports[_0x0a9e('0x36')]=function(_0xd1836d,_0x1fa90d){var _0x15de0e={},_0x4853b1={},_0x54135e={'count':0x0,'rows':[]};var _0x1e8694=_['map'](db[_0x0a9e('0x37')][_0x0a9e('0x38')],function(_0x381c37){return{'name':_0x381c37[_0x0a9e('0x39')],'type':_0x381c37['type'][_0x0a9e('0x3a')]};});_0x4853b1[_0x0a9e('0x3b')]=_[_0x0a9e('0x3c')](_0x1e8694,'name');_0x4853b1[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0xd1836d[_0x0a9e('0x3d')]);_0x4853b1['filters']=_['intersection'](_0x4853b1[_0x0a9e('0x3b')],_0x4853b1[_0x0a9e('0x3d')]);_0x15de0e['attributes']=_[_0x0a9e('0x3f')](_0x4853b1[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0xd1836d[_0x0a9e('0x3d')]['fields']));_0x15de0e['attributes']=_0x15de0e[_0x0a9e('0x41')][_0x0a9e('0x42')]?_0x15de0e['attributes']:_0x4853b1[_0x0a9e('0x3b')];if(!_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x43')]('nolimit')){_0x15de0e[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x2d')]);_0x15de0e[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}_0x15de0e[_0x0a9e('0x44')]=qs[_0x0a9e('0x45')](_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x45')]);_0x15de0e[_0x0a9e('0x46')]=qs[_0x0a9e('0x47')](_[_0x0a9e('0x48')](_0xd1836d['query'],_0x4853b1['filters']),_0x1e8694);if(_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x15de0e[_0x0a9e('0x46')]=_[_0x0a9e('0x4a')](_0x15de0e[_0x0a9e('0x46')],{'$or':_[_0x0a9e('0x3c')](_0x1e8694,function(_0x10b040){if(_0x10b040[_0x0a9e('0x4b')]!==_0x0a9e('0x4c')){var _0x25c6e6={};_0x25c6e6[_0x10b040[_0x0a9e('0x35')]]={'$like':'%'+_0xd1836d[_0x0a9e('0x3d')]['filter']+'%'};return _0x25c6e6;}})});}_0x15de0e=_[_0x0a9e('0x4a')]({},_0x15de0e,_0xd1836d[_0x0a9e('0x4d')]);var _0xdd268f={'where':_0x15de0e[_0x0a9e('0x46')]};return db[_0x0a9e('0x37')][_0x0a9e('0x4e')](_0xdd268f)[_0x0a9e('0x32')](function(_0x44dd99){_0x54135e['count']=_0x44dd99;if(_0xd1836d[_0x0a9e('0x3d')]['includeAll']){_0x15de0e[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x37')][_0x0a9e('0x50')](_0x15de0e);})['then'](function(_0x14bec2){_0x54135e[_0x0a9e('0x51')]=_0x14bec2;return _0x54135e;})[_0x0a9e('0x32')](respondWithFilteredResult(_0x1fa90d,_0x15de0e))[_0x0a9e('0x28')](handleError(_0x1fa90d,null));};exports[_0x0a9e('0x52')]=function(_0x37be73,_0x45bf7f){var _0x5bbcde={'raw':!![],'where':{'id':_0x37be73[_0x0a9e('0x53')]['id']}},_0x13f44d={};_0x13f44d[_0x0a9e('0x3b')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x37')][_0x0a9e('0x38')]);_0x13f44d[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x37be73[_0x0a9e('0x3d')]);_0x13f44d['filters']=_[_0x0a9e('0x3f')](_0x13f44d[_0x0a9e('0x3b')],_0x13f44d['query']);_0x5bbcde['attributes']=_['intersection'](_0x13f44d[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x37be73[_0x0a9e('0x3d')][_0x0a9e('0x40')]));_0x5bbcde[_0x0a9e('0x41')]=_0x5bbcde[_0x0a9e('0x41')][_0x0a9e('0x42')]?_0x5bbcde[_0x0a9e('0x41')]:_0x13f44d['model'];if(_0x37be73['query']['includeAll']){_0x5bbcde[_0x0a9e('0x4f')]=[{'all':!![]}];}_0x5bbcde=_[_0x0a9e('0x4a')]({},_0x5bbcde,_0x37be73[_0x0a9e('0x4d')]);return db['ChatGroup'][_0x0a9e('0x54')](_0x5bbcde)[_0x0a9e('0x32')](handleEntityNotFound(_0x45bf7f,null))['then'](respondWithResult(_0x45bf7f,null))['catch'](handleError(_0x45bf7f,null));};exports[_0x0a9e('0x55')]=function(_0x59c6ff,_0x443e72){return db['ChatGroup'][_0x0a9e('0x55')](_0x59c6ff[_0x0a9e('0x56')],{})[_0x0a9e('0x32')](respondWithResult(_0x443e72,0xc9))['catch'](handleError(_0x443e72,null));};exports[_0x0a9e('0x57')]=function(_0x1bf38a,_0x508b47){if(_0x1bf38a['body']['id']){delete _0x1bf38a[_0x0a9e('0x56')]['id'];}return db[_0x0a9e('0x37')]['find']({'where':{'id':_0x1bf38a[_0x0a9e('0x53')]['id']}})['then'](handleEntityNotFound(_0x508b47,null))[_0x0a9e('0x32')](saveUpdates(_0x1bf38a['body'],null))[_0x0a9e('0x32')](respondWithResult(_0x508b47,null))['catch'](handleError(_0x508b47,null));};exports['destroy']=function(_0x5df0ad,_0x2da03c){return db['ChatGroup'][_0x0a9e('0x54')]({'where':{'id':_0x5df0ad[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x2da03c,null))[_0x0a9e('0x32')](removeEntity(_0x2da03c,null))[_0x0a9e('0x28')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x58')]=function(_0xd10662,_0x28d814){return db['ChatGroup'][_0x0a9e('0x58')]()[_0x0a9e('0x32')](respondWithResult(_0x28d814,null))[_0x0a9e('0x28')](handleError(_0x28d814,null));};exports[_0x0a9e('0x59')]=function(_0xb83dfd,_0x156662,_0x5d86e9){return db[_0x0a9e('0x5a')][_0x0a9e('0x4e')]({'where':{'ChatGroupId':_0xb83dfd['params']['id'],'ToId':_0xb83dfd[_0x0a9e('0x5b')]['id'],'read':![]}})['then'](function(_0x20c668){return{'id':_['toInteger'](_0xb83dfd['params']['id']),'count':_0x20c668};})['then'](respondWithResult(_0x156662,null))[_0x0a9e('0x28')](handleError(_0x156662,null));};exports['addMembers']=function(_0x2244d6,_0x1fc70e,_0x261adb){return db[_0x0a9e('0x37')][_0x0a9e('0x54')]({'where':{'id':_0x2244d6[_0x0a9e('0x53')]['id']}})['then'](handleEntityNotFound(_0x1fc70e,null))[_0x0a9e('0x32')](function(_0x5854cc){if(_0x5854cc){return _0x5854cc[_0x0a9e('0x5c')](_0x2244d6[_0x0a9e('0x56')][_0x0a9e('0x5d')],_['omit'](_0x2244d6[_0x0a9e('0x56')],[_0x0a9e('0x5d'),'id'])||{});}})[_0x0a9e('0x32')](respondWithResult(_0x1fc70e,null))[_0x0a9e('0x28')](handleError(_0x1fc70e,null));};exports['getMembers']=function(_0x1d0dc8,_0xe05a5a,_0x54327c){var _0x797b45={};var _0x17e88c={};var _0x88dcbf;var _0x409b29;return db[_0x0a9e('0x37')]['findOne']({'where':{'id':_0x1d0dc8[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0xe05a5a,null))[_0x0a9e('0x32')](function(_0x47bb43){if(_0x47bb43){_0x88dcbf=_0x47bb43;_0x17e88c[_0x0a9e('0x3b')]=_['keys'](db['User'][_0x0a9e('0x38')]);_0x17e88c[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x1d0dc8[_0x0a9e('0x3d')]);_0x17e88c[_0x0a9e('0x47')]=_[_0x0a9e('0x3f')](_0x17e88c[_0x0a9e('0x3b')],_0x17e88c[_0x0a9e('0x3d')]);_0x797b45[_0x0a9e('0x41')]=_[_0x0a9e('0x3f')](_0x17e88c[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x1d0dc8[_0x0a9e('0x3d')][_0x0a9e('0x40')]));_0x797b45[_0x0a9e('0x41')]=_0x797b45[_0x0a9e('0x41')][_0x0a9e('0x42')]?_0x797b45[_0x0a9e('0x41')]:_0x17e88c['model'];_0x797b45[_0x0a9e('0x44')]=qs[_0x0a9e('0x45')](_0x1d0dc8[_0x0a9e('0x3d')]['sort']);_0x797b45[_0x0a9e('0x46')]=qs[_0x0a9e('0x47')](_['pick'](_0x1d0dc8[_0x0a9e('0x3d')],_0x17e88c[_0x0a9e('0x47')]));if(_0x1d0dc8[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x797b45[_0x0a9e('0x46')]=_['merge'](_0x797b45['where'],{'$or':_['map'](_0x797b45[_0x0a9e('0x41')],function(_0x18bf5d){var _0x1104ad={};_0x1104ad[_0x18bf5d]={'$like':'%'+_0x1d0dc8[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0x1104ad;})});}_0x797b45=_[_0x0a9e('0x4a')]({},_0x797b45,_0x1d0dc8[_0x0a9e('0x4d')]);return _0x88dcbf[_0x0a9e('0x5e')](_0x797b45);}})['then'](function(_0x235f8f){if(_0x235f8f){_0x409b29=_0x235f8f[_0x0a9e('0x42')];if(!_0x1d0dc8[_0x0a9e('0x3d')]['hasOwnProperty'](_0x0a9e('0x5f'))){_0x797b45['limit']=qs[_0x0a9e('0x2d')](_0x1d0dc8[_0x0a9e('0x3d')]['limit']);_0x797b45[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x1d0dc8[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}return _0x88dcbf['getMembers'](_0x797b45);}})[_0x0a9e('0x32')](function(_0x2e9552){if(_0x2e9552){return _0x2e9552?{'count':_0x409b29,'rows':_0x2e9552}:null;}})[_0x0a9e('0x32')](respondWithResult(_0xe05a5a,null))[_0x0a9e('0x28')](handleError(_0xe05a5a,null));};exports['removeMembers']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x37')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x32')](function(_0xf410e5){if(_0xf410e5){return _0xf410e5[_0x0a9e('0x60')](_0x109ccb[_0x0a9e('0x3d')][_0x0a9e('0x5d')]);}})[_0x0a9e('0x32')](respondWithStatusCode(_0x3d91db,null))[_0x0a9e('0x28')](handleError(_0x3d91db,null));};exports[_0x0a9e('0x61')]=function(_0xc4c230,_0x1f10ef,_0x25744a){if(_0xc4c230[_0x0a9e('0x56')]['id']){delete _0xc4c230['body']['id'];}return db[_0x0a9e('0x37')][_0x0a9e('0x54')]({'where':{'id':_0xc4c230[_0x0a9e('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f10ef,null))[_0x0a9e('0x32')](function(_0x33dda0){if(_0x33dda0){_0xc4c230[_0x0a9e('0x56')][_0x0a9e('0x62')]=_0x33dda0['id'];return db['ChatInternalMessage']['create'](_0xc4c230[_0x0a9e('0x56')]);}})[_0x0a9e('0x32')](respondWithResult(_0x1f10ef,null))['catch'](handleError(_0x1f10ef,null));};exports[_0x0a9e('0x63')]=function(_0x53a6a1,_0x260f4b,_0x8ebf02){var _0x5637a1={};var _0x28a942={};var _0x41cf12;var _0x2d2286;return db[_0x0a9e('0x37')][_0x0a9e('0x64')]({'where':{'id':_0x53a6a1[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x260f4b,null))['then'](function(_0x2973d3){if(_0x2973d3){_0x41cf12=_0x2973d3;_0x28a942[_0x0a9e('0x3b')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x5a')]['rawAttributes']);_0x28a942[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x53a6a1['query']);_0x28a942[_0x0a9e('0x47')]=_['intersection'](_0x28a942[_0x0a9e('0x3b')],_0x28a942[_0x0a9e('0x3d')]);_0x5637a1[_0x0a9e('0x41')]=_[_0x0a9e('0x3f')](_0x28a942['model'],qs['fields'](_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x40')]));_0x5637a1[_0x0a9e('0x41')]=_0x5637a1['attributes'][_0x0a9e('0x42')]?_0x5637a1[_0x0a9e('0x41')]:_0x28a942['model'];_0x5637a1['order']=qs[_0x0a9e('0x45')](_0x53a6a1['query']['sort']);_0x5637a1['where']=qs[_0x0a9e('0x47')](_[_0x0a9e('0x48')](_0x53a6a1[_0x0a9e('0x3d')],_0x28a942[_0x0a9e('0x47')]));if(_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x5637a1['where']=_[_0x0a9e('0x4a')](_0x5637a1['where'],{'$or':_[_0x0a9e('0x3c')](_0x5637a1[_0x0a9e('0x41')],function(_0x18ad56){var _0x4566b0={};_0x4566b0[_0x18ad56]={'$like':'%'+_0x53a6a1['query'][_0x0a9e('0x49')]+'%'};return _0x4566b0;})});}if(_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x65')]){var _0x5b74c3=_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x65')][_0x0a9e('0x66')](',');var _0x22063c={};_0x22063c[_0x5b74c3[0x0]]={'$gte':moment(_0x5b74c3[0x1])[_0x0a9e('0x67')](_0x0a9e('0x68'))};_0x5637a1[_0x0a9e('0x46')]=_[_0x0a9e('0x4a')](_0x5637a1['where'],_0x22063c);}_0x5637a1=_[_0x0a9e('0x4a')]({},_0x5637a1,_0x53a6a1[_0x0a9e('0x4d')]);return _0x41cf12['getMessages'](_0x5637a1);}})[_0x0a9e('0x32')](function(_0x982340){if(_0x982340){_0x2d2286=_0x982340[_0x0a9e('0x42')];if(!_0x53a6a1['query'][_0x0a9e('0x43')]('nolimit')){_0x5637a1[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x2d')]);_0x5637a1[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}return _0x41cf12['getMessages'](_0x5637a1);}})[_0x0a9e('0x32')](function(_0x31d25a){if(_0x31d25a){return _0x31d25a?{'count':_0x2d2286,'rows':_0x31d25a}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x260f4b,null))[_0x0a9e('0x28')](handleError(_0x260f4b,null));}; \ No newline at end of file +var _0xa9e0=['socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','then','end','stack','name','index','ChatGroup','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','show','params','find','create','body','update','describe','getUnread','ChatInternalMessage','user','addMembers','ids','getMembers','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);var jayson=require(_0x0a9e('0x1b'));var client=jayson[_0x0a9e('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22dccb,_0x5d0880,_0x1985b6,_0x519dfd){return new BPromise(function(_0x16033c,_0x12066b){var _0x48f32d=_0x519dfd||client;return _0x48f32d[_0x0a9e('0x1d')](_0x22dccb,_0x1985b6)['then'](function(_0x459eb1){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x5d0880,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x5d0880,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x459eb1));if(_0x459eb1[_0x0a9e('0x24')]){if(_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger[_0x0a9e('0x24')]('ChatGroup,\x20%s,\x20%s',_0x5d0880,_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x459eb1['error'][_0x0a9e('0x26')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x5d0880,_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x16033c(_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);}else{logger['info'](_0x0a9e('0x1f'),_0x5d0880,_0x0a9e('0x20'));_0x16033c(_0x459eb1[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x42ac8f){logger[_0x0a9e('0x24')]('ChatGroup,\x20%s,\x20%s',_0x5d0880,_0x42ac8f);_0x12066b(_0x42ac8f);});});}function respondWithStatusCode(_0x59181e,_0x197ec0){_0x197ec0=_0x197ec0||0xcc;return function(_0x3a8e58){if(_0x3a8e58){return _0x59181e[_0x0a9e('0x29')](_0x197ec0);}return _0x59181e[_0x0a9e('0x2a')](_0x197ec0)['end']();};}function respondWithResult(_0x384319,_0x479bc4){_0x479bc4=_0x479bc4||0xc8;return function(_0x45a1e7){if(_0x45a1e7){return _0x384319['status'](_0x479bc4)[_0x0a9e('0x2b')](_0x45a1e7);}};}function respondWithFilteredResult(_0x34dc65,_0x25fba9){return function(_0x14433c){if(_0x14433c){var _0x140511=_0x14433c['count'],_0x1538a4=_0x25fba9[_0x0a9e('0x2c')],_0x11c3b6=_0x25fba9[_0x0a9e('0x2c')]+_0x25fba9[_0x0a9e('0x2d')],_0x14de77;if(_0x11c3b6>=_0x140511){_0x11c3b6=_0x140511;_0x14de77=0xc8;}else{_0x14de77=0xce;}_0x34dc65[_0x0a9e('0x2a')](_0x14de77);return _0x34dc65['set'](_0x0a9e('0x2e'),_0x1538a4+'-'+_0x11c3b6+'/'+_0x140511)[_0x0a9e('0x2b')](_0x14433c);}return null;};}function patchUpdates(_0x1843b2){return function(_0x824a4f){try{jsonpatch[_0x0a9e('0x2f')](_0x824a4f,_0x1843b2,!![]);}catch(_0x563b45){return BPromise[_0x0a9e('0x30')](_0x563b45);}return _0x824a4f[_0x0a9e('0x31')]();};}function saveUpdates(_0x1dbde2,_0x540530){return function(_0x426950){if(_0x426950){return _0x426950['update'](_0x1dbde2)[_0x0a9e('0x32')](function(_0x3ae878){return _0x3ae878;});}return null;};}function removeEntity(_0x1122db,_0x33bdb7){return function(_0x25ce3a){if(_0x25ce3a){return _0x25ce3a['destroy']()[_0x0a9e('0x32')](function(){_0x1122db[_0x0a9e('0x2a')](0xcc)[_0x0a9e('0x33')]();});}};}function handleEntityNotFound(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(!_0x409319){_0x2da5c0[_0x0a9e('0x29')](0x194);}return _0x409319;};}function handleError(_0x39e565,_0x5583a4){_0x5583a4=_0x5583a4||0x1f4;return function(_0x44295a){logger['error'](_0x44295a[_0x0a9e('0x34')]);if(_0x44295a[_0x0a9e('0x35')]){delete _0x44295a[_0x0a9e('0x35')];}_0x39e565[_0x0a9e('0x2a')](_0x5583a4)['send'](_0x44295a);};}exports[_0x0a9e('0x36')]=function(_0xd1836d,_0x1fa90d){var _0x15de0e={},_0x4853b1={},_0x54135e={'count':0x0,'rows':[]};var _0x1e8694=_['map'](db[_0x0a9e('0x37')][_0x0a9e('0x38')],function(_0x381c37){return{'name':_0x381c37[_0x0a9e('0x39')],'type':_0x381c37['type'][_0x0a9e('0x3a')]};});_0x4853b1[_0x0a9e('0x3b')]=_[_0x0a9e('0x3c')](_0x1e8694,'name');_0x4853b1[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0xd1836d[_0x0a9e('0x3d')]);_0x4853b1['filters']=_['intersection'](_0x4853b1[_0x0a9e('0x3b')],_0x4853b1[_0x0a9e('0x3d')]);_0x15de0e['attributes']=_[_0x0a9e('0x3f')](_0x4853b1[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0xd1836d[_0x0a9e('0x3d')]['fields']));_0x15de0e['attributes']=_0x15de0e[_0x0a9e('0x41')][_0x0a9e('0x42')]?_0x15de0e['attributes']:_0x4853b1[_0x0a9e('0x3b')];if(!_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x43')]('nolimit')){_0x15de0e[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x2d')]);_0x15de0e[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}_0x15de0e[_0x0a9e('0x44')]=qs[_0x0a9e('0x45')](_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x45')]);_0x15de0e[_0x0a9e('0x46')]=qs[_0x0a9e('0x47')](_[_0x0a9e('0x48')](_0xd1836d['query'],_0x4853b1['filters']),_0x1e8694);if(_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x15de0e[_0x0a9e('0x46')]=_[_0x0a9e('0x4a')](_0x15de0e[_0x0a9e('0x46')],{'$or':_[_0x0a9e('0x3c')](_0x1e8694,function(_0x10b040){if(_0x10b040[_0x0a9e('0x4b')]!==_0x0a9e('0x4c')){var _0x25c6e6={};_0x25c6e6[_0x10b040[_0x0a9e('0x35')]]={'$like':'%'+_0xd1836d[_0x0a9e('0x3d')]['filter']+'%'};return _0x25c6e6;}})});}_0x15de0e=_[_0x0a9e('0x4a')]({},_0x15de0e,_0xd1836d[_0x0a9e('0x4d')]);var _0xdd268f={'where':_0x15de0e[_0x0a9e('0x46')]};return db[_0x0a9e('0x37')][_0x0a9e('0x4e')](_0xdd268f)[_0x0a9e('0x32')](function(_0x44dd99){_0x54135e['count']=_0x44dd99;if(_0xd1836d[_0x0a9e('0x3d')]['includeAll']){_0x15de0e[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x37')][_0x0a9e('0x50')](_0x15de0e);})['then'](function(_0x14bec2){_0x54135e[_0x0a9e('0x51')]=_0x14bec2;return _0x54135e;})[_0x0a9e('0x32')](respondWithFilteredResult(_0x1fa90d,_0x15de0e))[_0x0a9e('0x28')](handleError(_0x1fa90d,null));};exports[_0x0a9e('0x52')]=function(_0x37be73,_0x45bf7f){var _0x5bbcde={'raw':!![],'where':{'id':_0x37be73[_0x0a9e('0x53')]['id']}},_0x13f44d={};_0x13f44d[_0x0a9e('0x3b')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x37')][_0x0a9e('0x38')]);_0x13f44d[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x37be73[_0x0a9e('0x3d')]);_0x13f44d['filters']=_[_0x0a9e('0x3f')](_0x13f44d[_0x0a9e('0x3b')],_0x13f44d['query']);_0x5bbcde['attributes']=_['intersection'](_0x13f44d[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x37be73[_0x0a9e('0x3d')][_0x0a9e('0x40')]));_0x5bbcde[_0x0a9e('0x41')]=_0x5bbcde[_0x0a9e('0x41')][_0x0a9e('0x42')]?_0x5bbcde[_0x0a9e('0x41')]:_0x13f44d['model'];if(_0x37be73['query']['includeAll']){_0x5bbcde[_0x0a9e('0x4f')]=[{'all':!![]}];}_0x5bbcde=_[_0x0a9e('0x4a')]({},_0x5bbcde,_0x37be73[_0x0a9e('0x4d')]);return db['ChatGroup'][_0x0a9e('0x54')](_0x5bbcde)[_0x0a9e('0x32')](handleEntityNotFound(_0x45bf7f,null))['then'](respondWithResult(_0x45bf7f,null))['catch'](handleError(_0x45bf7f,null));};exports[_0x0a9e('0x55')]=function(_0x59c6ff,_0x443e72){return db['ChatGroup'][_0x0a9e('0x55')](_0x59c6ff[_0x0a9e('0x56')],{})[_0x0a9e('0x32')](respondWithResult(_0x443e72,0xc9))['catch'](handleError(_0x443e72,null));};exports[_0x0a9e('0x57')]=function(_0x1bf38a,_0x508b47){if(_0x1bf38a['body']['id']){delete _0x1bf38a[_0x0a9e('0x56')]['id'];}return db[_0x0a9e('0x37')]['find']({'where':{'id':_0x1bf38a[_0x0a9e('0x53')]['id']}})['then'](handleEntityNotFound(_0x508b47,null))[_0x0a9e('0x32')](saveUpdates(_0x1bf38a['body'],null))[_0x0a9e('0x32')](respondWithResult(_0x508b47,null))['catch'](handleError(_0x508b47,null));};exports['destroy']=function(_0x5df0ad,_0x2da03c){return db['ChatGroup'][_0x0a9e('0x54')]({'where':{'id':_0x5df0ad[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x2da03c,null))[_0x0a9e('0x32')](removeEntity(_0x2da03c,null))[_0x0a9e('0x28')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x58')]=function(_0xd10662,_0x28d814){return db['ChatGroup'][_0x0a9e('0x58')]()[_0x0a9e('0x32')](respondWithResult(_0x28d814,null))[_0x0a9e('0x28')](handleError(_0x28d814,null));};exports[_0x0a9e('0x59')]=function(_0xb83dfd,_0x156662,_0x5d86e9){return db[_0x0a9e('0x5a')][_0x0a9e('0x4e')]({'where':{'ChatGroupId':_0xb83dfd['params']['id'],'ToId':_0xb83dfd[_0x0a9e('0x5b')]['id'],'read':![]}})['then'](function(_0x20c668){return{'id':_['toInteger'](_0xb83dfd['params']['id']),'count':_0x20c668};})['then'](respondWithResult(_0x156662,null))[_0x0a9e('0x28')](handleError(_0x156662,null));};exports['addMembers']=function(_0x2244d6,_0x1fc70e,_0x261adb){return db[_0x0a9e('0x37')][_0x0a9e('0x54')]({'where':{'id':_0x2244d6[_0x0a9e('0x53')]['id']}})['then'](handleEntityNotFound(_0x1fc70e,null))[_0x0a9e('0x32')](function(_0x5854cc){if(_0x5854cc){return _0x5854cc[_0x0a9e('0x5c')](_0x2244d6[_0x0a9e('0x56')][_0x0a9e('0x5d')],_['omit'](_0x2244d6[_0x0a9e('0x56')],[_0x0a9e('0x5d'),'id'])||{});}})[_0x0a9e('0x32')](respondWithResult(_0x1fc70e,null))[_0x0a9e('0x28')](handleError(_0x1fc70e,null));};exports['getMembers']=function(_0x1d0dc8,_0xe05a5a,_0x54327c){var _0x797b45={};var _0x17e88c={};var _0x88dcbf;var _0x409b29;return db[_0x0a9e('0x37')]['findOne']({'where':{'id':_0x1d0dc8[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0xe05a5a,null))[_0x0a9e('0x32')](function(_0x47bb43){if(_0x47bb43){_0x88dcbf=_0x47bb43;_0x17e88c[_0x0a9e('0x3b')]=_['keys'](db['User'][_0x0a9e('0x38')]);_0x17e88c[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x1d0dc8[_0x0a9e('0x3d')]);_0x17e88c[_0x0a9e('0x47')]=_[_0x0a9e('0x3f')](_0x17e88c[_0x0a9e('0x3b')],_0x17e88c[_0x0a9e('0x3d')]);_0x797b45[_0x0a9e('0x41')]=_[_0x0a9e('0x3f')](_0x17e88c[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x1d0dc8[_0x0a9e('0x3d')][_0x0a9e('0x40')]));_0x797b45[_0x0a9e('0x41')]=_0x797b45[_0x0a9e('0x41')][_0x0a9e('0x42')]?_0x797b45[_0x0a9e('0x41')]:_0x17e88c['model'];_0x797b45[_0x0a9e('0x44')]=qs[_0x0a9e('0x45')](_0x1d0dc8[_0x0a9e('0x3d')]['sort']);_0x797b45[_0x0a9e('0x46')]=qs[_0x0a9e('0x47')](_['pick'](_0x1d0dc8[_0x0a9e('0x3d')],_0x17e88c[_0x0a9e('0x47')]));if(_0x1d0dc8[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x797b45[_0x0a9e('0x46')]=_['merge'](_0x797b45['where'],{'$or':_['map'](_0x797b45[_0x0a9e('0x41')],function(_0x18bf5d){var _0x1104ad={};_0x1104ad[_0x18bf5d]={'$like':'%'+_0x1d0dc8[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0x1104ad;})});}_0x797b45=_[_0x0a9e('0x4a')]({},_0x797b45,_0x1d0dc8[_0x0a9e('0x4d')]);return _0x88dcbf[_0x0a9e('0x5e')](_0x797b45);}})['then'](function(_0x235f8f){if(_0x235f8f){_0x409b29=_0x235f8f[_0x0a9e('0x42')];if(!_0x1d0dc8[_0x0a9e('0x3d')]['hasOwnProperty'](_0x0a9e('0x5f'))){_0x797b45['limit']=qs[_0x0a9e('0x2d')](_0x1d0dc8[_0x0a9e('0x3d')]['limit']);_0x797b45[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x1d0dc8[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}return _0x88dcbf['getMembers'](_0x797b45);}})[_0x0a9e('0x32')](function(_0x2e9552){if(_0x2e9552){return _0x2e9552?{'count':_0x409b29,'rows':_0x2e9552}:null;}})[_0x0a9e('0x32')](respondWithResult(_0xe05a5a,null))[_0x0a9e('0x28')](handleError(_0xe05a5a,null));};exports['removeMembers']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x37')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x32')](function(_0xf410e5){if(_0xf410e5){return _0xf410e5[_0x0a9e('0x60')](_0x109ccb[_0x0a9e('0x3d')][_0x0a9e('0x5d')]);}})[_0x0a9e('0x32')](respondWithStatusCode(_0x3d91db,null))[_0x0a9e('0x28')](handleError(_0x3d91db,null));};exports[_0x0a9e('0x61')]=function(_0xc4c230,_0x1f10ef,_0x25744a){if(_0xc4c230[_0x0a9e('0x56')]['id']){delete _0xc4c230['body']['id'];}return db[_0x0a9e('0x37')][_0x0a9e('0x54')]({'where':{'id':_0xc4c230[_0x0a9e('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f10ef,null))[_0x0a9e('0x32')](function(_0x33dda0){if(_0x33dda0){_0xc4c230[_0x0a9e('0x56')][_0x0a9e('0x62')]=_0x33dda0['id'];return db['ChatInternalMessage']['create'](_0xc4c230[_0x0a9e('0x56')]);}})[_0x0a9e('0x32')](respondWithResult(_0x1f10ef,null))['catch'](handleError(_0x1f10ef,null));};exports[_0x0a9e('0x63')]=function(_0x53a6a1,_0x260f4b,_0x8ebf02){var _0x5637a1={};var _0x28a942={};var _0x41cf12;var _0x2d2286;return db[_0x0a9e('0x37')][_0x0a9e('0x64')]({'where':{'id':_0x53a6a1[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x260f4b,null))['then'](function(_0x2973d3){if(_0x2973d3){_0x41cf12=_0x2973d3;_0x28a942[_0x0a9e('0x3b')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x5a')]['rawAttributes']);_0x28a942[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x53a6a1['query']);_0x28a942[_0x0a9e('0x47')]=_['intersection'](_0x28a942[_0x0a9e('0x3b')],_0x28a942[_0x0a9e('0x3d')]);_0x5637a1[_0x0a9e('0x41')]=_[_0x0a9e('0x3f')](_0x28a942['model'],qs['fields'](_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x40')]));_0x5637a1[_0x0a9e('0x41')]=_0x5637a1['attributes'][_0x0a9e('0x42')]?_0x5637a1[_0x0a9e('0x41')]:_0x28a942['model'];_0x5637a1['order']=qs[_0x0a9e('0x45')](_0x53a6a1['query']['sort']);_0x5637a1['where']=qs[_0x0a9e('0x47')](_[_0x0a9e('0x48')](_0x53a6a1[_0x0a9e('0x3d')],_0x28a942[_0x0a9e('0x47')]));if(_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x5637a1['where']=_[_0x0a9e('0x4a')](_0x5637a1['where'],{'$or':_[_0x0a9e('0x3c')](_0x5637a1[_0x0a9e('0x41')],function(_0x18ad56){var _0x4566b0={};_0x4566b0[_0x18ad56]={'$like':'%'+_0x53a6a1['query'][_0x0a9e('0x49')]+'%'};return _0x4566b0;})});}if(_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x65')]){var _0x5b74c3=_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x65')][_0x0a9e('0x66')](',');var _0x22063c={};_0x22063c[_0x5b74c3[0x0]]={'$gte':moment(_0x5b74c3[0x1])[_0x0a9e('0x67')](_0x0a9e('0x68'))};_0x5637a1[_0x0a9e('0x46')]=_[_0x0a9e('0x4a')](_0x5637a1['where'],_0x22063c);}_0x5637a1=_[_0x0a9e('0x4a')]({},_0x5637a1,_0x53a6a1[_0x0a9e('0x4d')]);return _0x41cf12['getMessages'](_0x5637a1);}})[_0x0a9e('0x32')](function(_0x982340){if(_0x982340){_0x2d2286=_0x982340[_0x0a9e('0x42')];if(!_0x53a6a1['query'][_0x0a9e('0x43')]('nolimit')){_0x5637a1[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x2d')]);_0x5637a1[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}return _0x41cf12['getMessages'](_0x5637a1);}})[_0x0a9e('0x32')](function(_0x31d25a){if(_0x31d25a){return _0x31d25a?{'count':_0x2d2286,'rows':_0x31d25a}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x260f4b,null))[_0x0a9e('0x28')](handleError(_0x260f4b,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index f7698c5..ccc04f9 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 _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x38d243,_0x3f2062){var _0x347634=function(_0x342e3f){while(--_0x342e3f){_0x38d243['push'](_0x38d243['shift']());}};_0x347634(++_0x3f2062);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x5a5f91,_0x3a23db){var _0x1a24ae=function(_0x45cbb3){while(--_0x45cbb3){_0x5a5f91['push'](_0x5a5f91['shift']());}};_0x1a24ae(++_0x3a23db);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 836dc77..c4fc5eb 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 _0xeedf=['exports','define','chat_groups','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xeedf,0x12c));var _0xfeed=function(_0x3d5b2c,_0x181a6c){_0x3d5b2c=_0x3d5b2c-0x0;var _0x1b4d86=_0xeedf[_0x3d5b2c];return _0x1b4d86;};'use strict';var _=require(_0xfeed('0x0'));var util=require(_0xfeed('0x1'));var logger=require(_0xfeed('0x2'))('api');var moment=require(_0xfeed('0x3'));var BPromise=require('bluebird');var rp=require(_0xfeed('0x4'));var fs=require('fs');var path=require(_0xfeed('0x5'));var rimraf=require(_0xfeed('0x6'));var config=require(_0xfeed('0x7'));var attributes=require('./chatGroup.attributes');module[_0xfeed('0x8')]=function(_0x2c211d,_0x5df4fe){return _0x2c211d[_0xfeed('0x9')]('ChatGroup',attributes,{'tableName':_0xfeed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa25a=['rimraf','exports','define','ChatGroup','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1e2ab1,_0x7a568a){var _0x1f9e4b=function(_0x54656c){while(--_0x54656c){_0x1e2ab1['push'](_0x1e2ab1['shift']());}};_0x1f9e4b(++_0x7a568a);}(_0xa25a,0x160));var _0xaa25=function(_0x452b6,_0x32473d){_0x452b6=_0x452b6-0x0;var _0x37605f=_0xa25a[_0x452b6];return _0x37605f;};'use strict';var _=require(_0xaa25('0x0'));var util=require(_0xaa25('0x1'));var logger=require(_0xaa25('0x2'))(_0xaa25('0x3'));var moment=require(_0xaa25('0x4'));var BPromise=require(_0xaa25('0x5'));var rp=require(_0xaa25('0x6'));var fs=require('fs');var path=require(_0xaa25('0x7'));var rimraf=require(_0xaa25('0x8'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0xaa25('0x9')]=function(_0x866fa1,_0x51ce9a){return _0x866fa1[_0xaa25('0xa')](_0xaa25('0xb'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index c995601..e04dffd 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 _0x7e25=['socket.io-emitter','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost'];(function(_0x5dfbd0,_0x201eb2){var _0x57cb5c=function(_0x36a5c0){while(--_0x36a5c0){_0x5dfbd0['push'](_0x5dfbd0['shift']());}};_0x57cb5c(++_0x201eb2);}(_0x7e25,0x1ef));var _0x57e2=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0x7e25[_0x10791d];return _0x1b4f9c;};'use strict';var _=require('lodash');var util=require(_0x57e2('0x0'));var moment=require(_0x57e2('0x1'));var BPromise=require(_0x57e2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57e2('0x3'));var db=require(_0x57e2('0x4'))['db'];var utils=require(_0x57e2('0x5'));var logger=require(_0x57e2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57e2('0x7')][_0x57e2('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x57e2('0x9')],{'host':_0x57e2('0xa'),'port':0x18eb});var socket=require(_0x57e2('0xb'))(new Redis(config[_0x57e2('0x9')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0xb73b33,_0x3b1725,_0x56ae80){return new BPromise(function(_0x1e09e6,_0x5cc832){return client[_0x57e2('0xc')](_0xb73b33,_0x56ae80)[_0x57e2('0xd')](function(_0x1ad638){logger[_0x57e2('0xe')](_0x57e2('0xf'),_0x3b1725,_0x57e2('0x10'));logger[_0x57e2('0x11')](_0x57e2('0x12'),_0x3b1725,_0x57e2('0x10'),JSON[_0x57e2('0x13')](_0x1ad638));if(_0x1ad638[_0x57e2('0x14')]){if(_0x1ad638['error']['code']===0x1f4){logger[_0x57e2('0x14')]('ChatGroup,\x20%s,\x20%s',_0x3b1725,_0x1ad638[_0x57e2('0x14')][_0x57e2('0x15')]);return _0x5cc832(_0x1ad638['error'][_0x57e2('0x15')]);}logger[_0x57e2('0x14')](_0x57e2('0xf'),_0x3b1725,_0x1ad638[_0x57e2('0x14')][_0x57e2('0x15')]);return _0x1e09e6(_0x1ad638[_0x57e2('0x14')]['message']);}else{logger[_0x57e2('0xe')](_0x57e2('0xf'),_0x3b1725,'request\x20sent');_0x1e09e6(_0x1ad638[_0x57e2('0x16')][_0x57e2('0x15')]);}})['catch'](function(_0x262289){logger[_0x57e2('0x14')]('ChatGroup,\x20%s,\x20%s',_0x3b1725,_0x262289);_0x5cc832(_0x262289);});});} \ No newline at end of file +var _0xc234=['stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x16ca51,_0x486cd8){var _0x28481f=function(_0x400733){while(--_0x400733){_0x16ca51['push'](_0x16ca51['shift']());}};_0x28481f(++_0x486cd8);}(_0xc234,0xef));var _0x4c23=function(_0x42cafe,_0x401d7b){_0x42cafe=_0x42cafe-0x0;var _0x517389=_0xc234[_0x42cafe];return _0x517389;};'use strict';var _=require(_0x4c23('0x0'));var util=require(_0x4c23('0x1'));var moment=require(_0x4c23('0x2'));var BPromise=require(_0x4c23('0x3'));var rs=require(_0x4c23('0x4'));var fs=require('fs');var Redis=require(_0x4c23('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c23('0x6'));var logger=require('../../config/logger')(_0x4c23('0x7'));var config=require(_0x4c23('0x8'));var jayson=require(_0x4c23('0x9'));var client=jayson[_0x4c23('0xa')][_0x4c23('0xb')]({'port':0x232a});config[_0x4c23('0xc')]=_['defaults'](config[_0x4c23('0xc')],{'host':_0x4c23('0xd'),'port':0x18eb});var socket=require(_0x4c23('0xe'))(new Redis(config[_0x4c23('0xc')]));require(_0x4c23('0xf'))[_0x4c23('0x10')](socket);function respondWithRpcPromise(_0x40f97a,_0x50d680,_0x1673ad){return new BPromise(function(_0x1aaebd,_0x5ad586){return client[_0x4c23('0x11')](_0x40f97a,_0x1673ad)[_0x4c23('0x12')](function(_0x24acde){logger[_0x4c23('0x13')]('ChatGroup,\x20%s,\x20%s',_0x50d680,_0x4c23('0x14'));logger['debug'](_0x4c23('0x15'),_0x50d680,'request\x20sent',JSON[_0x4c23('0x16')](_0x24acde));if(_0x24acde['error']){if(_0x24acde[_0x4c23('0x17')][_0x4c23('0x18')]===0x1f4){logger['error'](_0x4c23('0x19'),_0x50d680,_0x24acde[_0x4c23('0x17')]['message']);return _0x5ad586(_0x24acde['error'][_0x4c23('0x1a')]);}logger[_0x4c23('0x17')]('ChatGroup,\x20%s,\x20%s',_0x50d680,_0x24acde['error'][_0x4c23('0x1a')]);return _0x1aaebd(_0x24acde[_0x4c23('0x17')][_0x4c23('0x1a')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x50d680,_0x4c23('0x14'));_0x1aaebd(_0x24acde[_0x4c23('0x1b')][_0x4c23('0x1a')]);}})[_0x4c23('0x1c')](function(_0x20fba0){logger[_0x4c23('0x17')](_0x4c23('0x19'),_0x50d680,_0x20fba0);_0x5ad586(_0x20fba0);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index fbdd224..c109b4b 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 _0x20ad=['chatGroup:','save','update','emit','removeListener','register','length'];(function(_0x4191dc,_0x486474){var _0x37707d=function(_0x305a2c){while(--_0x305a2c){_0x4191dc['push'](_0x4191dc['shift']());}};_0x37707d(++_0x486474);}(_0x20ad,0x94));var _0xd20a=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x20ad[_0x381589];return _0x2a075d;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xd20a('0x0'),'remove',_0xd20a('0x1')];function createListener(_0x1c9ac5,_0x2820fe){return function(_0x116f4b){_0x2820fe[_0xd20a('0x2')](_0x1c9ac5,_0x116f4b);};}function removeListener(_0x4d4b61,_0x528c20){return function(){ChatGroupEvents[_0xd20a('0x3')](_0x4d4b61,_0x528c20);};}exports[_0xd20a('0x4')]=function(_0x3fc820){for(var _0x53e1f7=0x0,_0x3d49b2=events[_0xd20a('0x5')];_0x53e1f7<_0x3d49b2;_0x53e1f7++){var _0x5819e8=events[_0x53e1f7];var _0x5303bd=createListener(_0xd20a('0x6')+_0x5819e8,_0x3fc820);ChatGroupEvents['on'](_0x5819e8,_0x5303bd);}}; \ No newline at end of file +var _0x123b=['remove','emit','removeListener','length','./chatGroup.events'];(function(_0x1c21b0,_0x20a651){var _0x3bdc02=function(_0x175ac3){while(--_0x175ac3){_0x1c21b0['push'](_0x1c21b0['shift']());}};_0x3bdc02(++_0x20a651);}(_0x123b,0x14e));var _0xb123=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x123b[_0x4b055c];return _0x4b62bb;};'use strict';var ChatGroupEvents=require(_0xb123('0x0'));var events=['save',_0xb123('0x1'),'update'];function createListener(_0x435f27,_0x14e7a6){return function(_0x5c2281){_0x14e7a6[_0xb123('0x2')](_0x435f27,_0x5c2281);};}function removeListener(_0x12c473,_0x1fca43){return function(){ChatGroupEvents[_0xb123('0x3')](_0x12c473,_0x1fca43);};}exports['register']=function(_0x5d433c){for(var _0x55d15e=0x0,_0x139dcf=events[_0xb123('0x4')];_0x55d15e<_0x139dcf;_0x55d15e++){var _0x14a971=events[_0x55d15e];var _0x50dd37=createListener('chatGroup:'+_0x14a971,_0x5d433c);ChatGroupEvents['on'](_0x14a971,_0x50dd37);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 04d39ea..79e5b6a 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 _0xe6b6=['/:id/members','addMembers','update','delete','removeMembers','exports','util','path','express','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/:id','show','getUnread','getMembers','/:id/messages','getMessages','post','create'];(function(_0x2c2beb,_0x51d1af){var _0x5f392f=function(_0x1fa03e){while(--_0x1fa03e){_0x2c2beb['push'](_0x2c2beb['shift']());}};_0x5f392f(++_0x51d1af);}(_0xe6b6,0x150));var _0x6e6b=function(_0x4343ba,_0x1922e0){_0x4343ba=_0x4343ba-0x0;var _0x8d6f0e=_0xe6b6[_0x4343ba];return _0x8d6f0e;};'use strict';var multer=require('multer');var util=require(_0x6e6b('0x0'));var path=require(_0x6e6b('0x1'));var timeout=require('connect-timeout');var express=require(_0x6e6b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6e6b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6e6b('0x4'));var controller=require(_0x6e6b('0x5'));router[_0x6e6b('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6e6b('0x6')]('/describe',auth[_0x6e6b('0x7')](),controller['describe']);router['get'](_0x6e6b('0x8'),auth[_0x6e6b('0x7')](),controller[_0x6e6b('0x9')]);router[_0x6e6b('0x6')]('/:id/unread',auth[_0x6e6b('0x7')](),controller[_0x6e6b('0xa')]);router['get']('/:id/members',auth[_0x6e6b('0x7')](),controller[_0x6e6b('0xb')]);router['get'](_0x6e6b('0xc'),auth[_0x6e6b('0x7')](),controller[_0x6e6b('0xd')]);router[_0x6e6b('0xe')]('/',auth[_0x6e6b('0x7')](),controller[_0x6e6b('0xf')]);router[_0x6e6b('0xe')](_0x6e6b('0x10'),auth['isAuthenticated'](),controller[_0x6e6b('0x11')]);router[_0x6e6b('0xe')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['put'](_0x6e6b('0x8'),auth['isAuthenticated'](),controller[_0x6e6b('0x12')]);router[_0x6e6b('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x6e6b('0x13')](_0x6e6b('0x10'),auth[_0x6e6b('0x7')](),controller[_0x6e6b('0x14')]);module[_0x6e6b('0x15')]=router; \ No newline at end of file +var _0xcd30=['getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','get','describe','/:id','show','/:id/members'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0xcd30,0x1e8));var _0x0cd3=function(_0x180391,_0x55d9ff){_0x180391=_0x180391-0x0;var _0x4ded40=_0xcd30[_0x180391];return _0x4ded40;};'use strict';var multer=require(_0x0cd3('0x0'));var util=require(_0x0cd3('0x1'));var path=require(_0x0cd3('0x2'));var timeout=require(_0x0cd3('0x3'));var express=require(_0x0cd3('0x4'));var router=express[_0x0cd3('0x5')]();var fs_extra=require(_0x0cd3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0cd3('0x7'));var config=require(_0x0cd3('0x8'));var controller=require(_0x0cd3('0x9'));router['get']('/',auth[_0x0cd3('0xa')](),controller['index']);router[_0x0cd3('0xb')]('/describe',auth[_0x0cd3('0xa')](),controller[_0x0cd3('0xc')]);router[_0x0cd3('0xb')](_0x0cd3('0xd'),auth['isAuthenticated'](),controller[_0x0cd3('0xe')]);router[_0x0cd3('0xb')]('/:id/unread',auth[_0x0cd3('0xa')](),controller['getUnread']);router[_0x0cd3('0xb')](_0x0cd3('0xf'),auth[_0x0cd3('0xa')](),controller[_0x0cd3('0x10')]);router[_0x0cd3('0xb')](_0x0cd3('0x11'),auth[_0x0cd3('0xa')](),controller[_0x0cd3('0x12')]);router[_0x0cd3('0x13')]('/',auth[_0x0cd3('0xa')](),controller[_0x0cd3('0x14')]);router[_0x0cd3('0x13')](_0x0cd3('0xf'),auth[_0x0cd3('0xa')](),controller[_0x0cd3('0x15')]);router[_0x0cd3('0x13')]('/:id/messages',auth[_0x0cd3('0xa')](),controller[_0x0cd3('0x16')]);router['put'](_0x0cd3('0xd'),auth[_0x0cd3('0xa')](),controller[_0x0cd3('0x17')]);router[_0x0cd3('0x18')](_0x0cd3('0xd'),auth[_0x0cd3('0xa')](),controller[_0x0cd3('0x19')]);router['delete'](_0x0cd3('0xf'),auth[_0x0cd3('0xa')](),controller[_0x0cd3('0x1a')]);module[_0x0cd3('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index edcf43e..65669fb 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 _0xe459=['long','DATE','out','sequelize','exports','BOOLEAN','INTEGER','thumb','TEXT','STRING'];(function(_0x56f736,_0x521360){var _0x47b49e=function(_0x5707d4){while(--_0x5707d4){_0x56f736['push'](_0x56f736['shift']());}};_0x47b49e(++_0x521360);}(_0xe459,0x1cf));var _0x9e45=function(_0x372200,_0x5c484f){_0x372200=_0x372200-0x0;var _0x4de067=_0xe459[_0x372200];return _0x4de067;};'use strict';var Sequelize=require(_0x9e45('0x0'));module[_0x9e45('0x1')]={'closed':{'type':Sequelize[_0x9e45('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x9e45('0x3')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x9e45('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x9e45('0x5')]},'pathTranscript':{'type':Sequelize[_0x9e45('0x5')]},'mailTranscript':{'type':Sequelize[_0x9e45('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9e45('0x6')]},'secondDisposition':{'type':Sequelize[_0x9e45('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9e45('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x9e45('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x9e45('0x6')]},'deviceModel':{'type':Sequelize[_0x9e45('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x9e45('0x6')]},'referer':{'type':Sequelize[_0x9e45('0x5')]},'customerIp':{'type':Sequelize[_0x9e45('0x6')]},'formData':{'type':Sequelize[_0x9e45('0x5')](_0x9e45('0x7'))},'read1stAt':{'type':Sequelize[_0x9e45('0x8')]},'lastMsgAt':{'type':Sequelize[_0x9e45('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9e45('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x9e45('0x6')]},'customerPort':{'type':Sequelize[_0x9e45('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x9e45('0x5')]}}; \ No newline at end of file +var _0xf4ff=['TEXT','STRING','DATE','out','exports','BOOLEAN','INTEGER','ENUM','star'];(function(_0xd7ce3d,_0x5cf3ff){var _0x2acf1b=function(_0x4f4582){while(--_0x4f4582){_0xd7ce3d['push'](_0xd7ce3d['shift']());}};_0x2acf1b(++_0x5cf3ff);}(_0xf4ff,0x15a));var _0xff4f=function(_0x5e3f0e,_0x4713c0){_0x5e3f0e=_0x5e3f0e-0x0;var _0x4492f2=_0xf4ff[_0x5e3f0e];return _0x4492f2;};'use strict';var Sequelize=require('sequelize');module[_0xff4f('0x0')]={'closed':{'type':Sequelize[_0xff4f('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xff4f('0x2')]},'ratingType':{'type':Sequelize[_0xff4f('0x3')](_0xff4f('0x4'),'thumb'),'defaultValue':_0xff4f('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xff4f('0x5')]},'mailTranscript':{'type':Sequelize[_0xff4f('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xff4f('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xff4f('0x6')]},'thirdDisposition':{'type':Sequelize[_0xff4f('0x6')]},'note':{'type':Sequelize[_0xff4f('0x6')]},'browserName':{'type':Sequelize[_0xff4f('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xff4f('0x6')]},'osVersion':{'type':Sequelize[_0xff4f('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xff4f('0x6')]},'deviceType':{'type':Sequelize[_0xff4f('0x6')]},'referer':{'type':Sequelize[_0xff4f('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0xff4f('0x7')]},'lastMsgAt':{'type':Sequelize[_0xff4f('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xff4f('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xff4f('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xff4f('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 2d71d6e..dc99288 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 _0xe978=['describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','Attachment','attachmentDownload','closed','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','%s%d','agentAlias','customer','agentIdentifier','website_alias','System','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','nolimit','options','findAll','getMyMessages','secret','color','emit','chatInteractionTags:save','removeTags','unix','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','Account','Owner','get','mkdirSync','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','referer','customerPort','N.A.','tail','existsSync','createReadStream','createWriteStream','direction','lastName','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','fullname','TagIds','split','Tags','push','map','ChatInteraction','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','isEmpty','concat','createdAt','parse','$gte','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','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','role','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','keys','rawAttributes','includeAll','include','merge','create'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xe978,0x70));var _0x8e97=function(_0x94c2c3,_0x3c551d){_0x94c2c3=_0x94c2c3-0x0;var _0x50661d=_0xe978[_0x94c2c3];return _0x50661d;};'use strict';var pdf=require(_0x8e97('0x0'));var emlformat=require(_0x8e97('0x1'));var rimraf=require(_0x8e97('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8e97('0x3'));var moment=require(_0x8e97('0x4'));var BPromise=require(_0x8e97('0x5'));var Mustache=require(_0x8e97('0x6'));var util=require(_0x8e97('0x7'));var path=require('path');var sox=require(_0x8e97('0x8'));var csv=require(_0x8e97('0x9'));var ejs=require(_0x8e97('0xa'));var fs=require('fs');var fs_extra=require(_0x8e97('0xb'));var _=require(_0x8e97('0xc'));var squel=require('squel');var crypto=require(_0x8e97('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8e97('0xe'));var toCsv=require(_0x8e97('0x9'));var querystring=require(_0x8e97('0xf'));var Papa=require('papaparse');var Redis=require(_0x8e97('0x10'));var authService=require(_0x8e97('0x11'));var qs=require(_0x8e97('0x12'));var as=require(_0x8e97('0x13'));var hardwareService=require(_0x8e97('0x14'));var logger=require(_0x8e97('0x15'))(_0x8e97('0x16'));var utils=require(_0x8e97('0x17'));var config=require(_0x8e97('0x18'));var licenseUtil=require(_0x8e97('0x19'));var db=require(_0x8e97('0x1a'))['db'];config['redis']=_[_0x8e97('0x1b')](config[_0x8e97('0x1c')],{'host':_0x8e97('0x1d'),'port':0x18eb});var socket=require(_0x8e97('0x1e'))(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0x8e97('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x33b6b3,_0x3bb176,_0x4943c1,_0x4efaa3){return new BPromise(function(_0x185a04,_0x3f3738){var _0xb779ed=_0x4efaa3||client;return _0xb779ed[_0x8e97('0x20')](_0x33b6b3,_0x4943c1)[_0x8e97('0x21')](function(_0x2b823e){logger[_0x8e97('0x22')](_0x8e97('0x23'),_0x3bb176,_0x8e97('0x24'));logger['debug'](_0x8e97('0x25'),_0x3bb176,_0x8e97('0x24'),JSON[_0x8e97('0x26')](_0x2b823e));if(_0x2b823e[_0x8e97('0x27')]){if(_0x2b823e[_0x8e97('0x27')][_0x8e97('0x28')]===0x1f4){logger[_0x8e97('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x3bb176,_0x2b823e[_0x8e97('0x27')][_0x8e97('0x29')]);return _0x3f3738(_0x2b823e[_0x8e97('0x27')][_0x8e97('0x29')]);}logger[_0x8e97('0x27')](_0x8e97('0x23'),_0x3bb176,_0x2b823e[_0x8e97('0x27')][_0x8e97('0x29')]);return _0x185a04(_0x2b823e[_0x8e97('0x27')][_0x8e97('0x29')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x3bb176,'request\x20sent');_0x185a04(_0x2b823e[_0x8e97('0x2a')][_0x8e97('0x29')]);}})[_0x8e97('0x2b')](function(_0xcee009){logger[_0x8e97('0x27')](_0x8e97('0x23'),_0x3bb176,_0xcee009);_0x3f3738(_0xcee009);});});}function respondWithStatusCode(_0x8ffc5b,_0xc48542){_0xc48542=_0xc48542||0xcc;return function(_0x5cc6fc){if(_0x5cc6fc){return _0x8ffc5b[_0x8e97('0x2c')](_0xc48542);}return _0x8ffc5b[_0x8e97('0x2d')](_0xc48542)[_0x8e97('0x2e')]();};}function respondWithResult(_0x5bb338,_0x1ba074){_0x1ba074=_0x1ba074||0xc8;return function(_0x4ef232){if(_0x4ef232){return _0x5bb338[_0x8e97('0x2d')](_0x1ba074)[_0x8e97('0x2f')](_0x4ef232);}};}function respondWithFilteredResult(_0xa5b3de,_0x2f7919){return function(_0xb1ce05){if(_0xb1ce05){var _0x65a7b5=_0xb1ce05[_0x8e97('0x30')],_0x180b9d=_0x2f7919[_0x8e97('0x31')],_0x5b0c76=_0x2f7919[_0x8e97('0x31')]+_0x2f7919[_0x8e97('0x32')],_0x4b7003;if(_0x5b0c76>=_0x65a7b5){_0x5b0c76=_0x65a7b5;_0x4b7003=0xc8;}else{_0x4b7003=0xce;}_0xa5b3de['status'](_0x4b7003);return _0xa5b3de[_0x8e97('0x33')](_0x8e97('0x34'),_0x180b9d+'-'+_0x5b0c76+'/'+_0x65a7b5)[_0x8e97('0x2f')](_0xb1ce05);}return null;};}function patchUpdates(_0x2bab42){return function(_0x46ddaa){try{jsonpatch['apply'](_0x46ddaa,_0x2bab42,!![]);}catch(_0x1a79de){return BPromise[_0x8e97('0x35')](_0x1a79de);}return _0x46ddaa[_0x8e97('0x36')]();};}function saveUpdates(_0x105bc1,_0x1dd009){return function(_0x54356c){if(_0x54356c){return _0x54356c[_0x8e97('0x37')](_0x105bc1)['then'](function(_0x270ce6){return _0x270ce6;});}return null;};}function removeEntity(_0x117971,_0x2da570){return function(_0x2224e0){if(_0x2224e0){return _0x2224e0[_0x8e97('0x38')]()['then'](function(){_0x117971[_0x8e97('0x2d')](0xcc)[_0x8e97('0x2e')]();});}};}function handleEntityNotFound(_0x5420ac,_0x5349ed){return function(_0x30a009){if(!_0x30a009){_0x5420ac[_0x8e97('0x2c')](0x194);}return _0x30a009;};}function handleError(_0x27533d,_0x4d0f88){_0x4d0f88=_0x4d0f88||0x1f4;return function(_0x213883){logger[_0x8e97('0x27')](_0x213883[_0x8e97('0x39')]);if(_0x213883[_0x8e97('0x3a')]){delete _0x213883[_0x8e97('0x3a')];}_0x27533d['status'](_0x4d0f88)[_0x8e97('0x3b')](_0x213883);};}function getInteractionUsers(_0x5302ee,_0x21ea34){return new BPromise(function(_0x374543,_0x2441a1){try{if(_0x21ea34[_0x5302ee['id']]){_0x5302ee['Users']=_['map'](_0x21ea34[_0x5302ee['id']],function(_0x3b8fae){return{'id':_0x3b8fae['id'],'fullname':_0x3b8fae[_0x8e97('0x3c')]};});}}catch(_0x171c06){_0x2441a1(_0x171c06);}_0x374543(_0x5302ee);});}function getInteractionTags(_0x5bf0f8,_0x5b870a){return new BPromise(function(_0x423237,_0x200772){try{if(_0x5bf0f8[_0x8e97('0x3d')]){_0x5bf0f8['Tags']=[];_0x5bf0f8['TagIds'][_0x8e97('0x3e')](',')['forEach'](function(_0x1b05a9){_0x5bf0f8[_0x8e97('0x3f')][_0x8e97('0x40')](_0x5b870a[_0x1b05a9]);});}delete _0x5bf0f8[_0x8e97('0x3d')];}catch(_0x1b5bf2){_0x200772(_0x1b5bf2);}_0x423237(_0x5bf0f8);});}function updateChatInteraction(_0x13d73b,_0x41e925,_0x55d71f){return new BPromise(function(_0x305eae,_0x52f639){return getInteractionUsers(_0x13d73b,_0x55d71f)[_0x8e97('0x21')](function(_0x27185b){return getInteractionTags(_0x27185b,_0x41e925);})[_0x8e97('0x21')](function(_0x3e0e33){_0x305eae(_0x3e0e33);})[_0x8e97('0x2b')](function(_0x3287b0){_0x52f639(_0x3287b0);});});}exports['index']=function(_0xa88699,_0xf79867){var _0x8dd265={},_0x4ba89c={},_0x8e9af1={'count':0x0,'rows':[]};var _0x4e5355=_[_0x8e97('0x41')](db[_0x8e97('0x42')]['rawAttributes'],function(_0x500077){return{'name':_0x500077[_0x8e97('0x43')],'type':_0x500077[_0x8e97('0x44')][_0x8e97('0x45')]};});_0x4ba89c[_0x8e97('0x46')]=_[_0x8e97('0x41')](_0x4e5355,_0x8e97('0x3a'));_0x4ba89c[_0x8e97('0x47')]=_['keys'](_0xa88699[_0x8e97('0x47')]);_0x4ba89c[_0x8e97('0x48')]=_[_0x8e97('0x49')](_0x4ba89c[_0x8e97('0x46')],_0x4ba89c[_0x8e97('0x47')]);_0x8dd265[_0x8e97('0x4a')]=_['intersection'](_0x4ba89c[_0x8e97('0x46')],qs[_0x8e97('0x4b')](_0xa88699[_0x8e97('0x47')]['fields']));_0x8dd265['attributes']=_0x8dd265[_0x8e97('0x4a')][_0x8e97('0x4c')]?_0x8dd265[_0x8e97('0x4a')]:_0x4ba89c[_0x8e97('0x46')];if(!_0xa88699[_0x8e97('0x47')][_0x8e97('0x4d')]('nolimit')){_0x8dd265[_0x8e97('0x32')]=qs[_0x8e97('0x32')](_0xa88699[_0x8e97('0x47')][_0x8e97('0x32')]);_0x8dd265['offset']=qs[_0x8e97('0x31')](_0xa88699['query']['offset']);}_0x8dd265[_0x8e97('0x4e')]=qs[_0x8e97('0x4f')](_0xa88699[_0x8e97('0x47')][_0x8e97('0x4f')]);_0x8dd265[_0x8e97('0x50')]=qs[_0x8e97('0x48')](_[_0x8e97('0x51')](_0xa88699[_0x8e97('0x47')],_0x4ba89c[_0x8e97('0x48')]),_0x4e5355);var _0x1e3b6a=[];var _0x3efbd9=squel[_0x8e97('0x52')]()['field']('id')['field'](_0x8e97('0x3a'))[_0x8e97('0x53')]('color')[_0x8e97('0x54')]('tools_tags');var _0x291ab9=squel['select']()['field'](_0x8e97('0x55'))[_0x8e97('0x53')](_0x8e97('0x56'))[_0x8e97('0x53')](_0x8e97('0x57'))[_0x8e97('0x54')](_0x8e97('0x58'),'ui')[_0x8e97('0x59')](_0x8e97('0x5a'),'u','u.id\x20=\x20ui.UserId');var _0x4a9d99=squel[_0x8e97('0x52')]()[_0x8e97('0x54')](_0x8e97('0x5b'),'i')[_0x8e97('0x59')]('cm_contacts','c',_0x8e97('0x5c'))['left_join']('users','o',_0x8e97('0x5d'))[_0x8e97('0x59')](_0x8e97('0x5e'),'a',_0x8e97('0x5f'))['left_join'](_0x8e97('0x60'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x8e97('0x59')](_0x8e97('0x61'),'it',_0x8e97('0x62'))[_0x8e97('0x59')](_0x8e97('0x63'),'t','t.id\x20=\x20it.TagId');var _0x21c076=squel['expr']();var _0x1e49db=[];var _0x3b6512=squel['expr']();var _0x235df3;if(_0xa88699[_0x8e97('0x47')][_0x8e97('0x64')]){_0x235df3=as[_0x8e97('0x65')](_0xa88699[_0x8e97('0x47')][_0x8e97('0x64')]);var _0x1eb7a6=_0x235df3[_0x8e97('0x66')];for(var _0x1a626b=0x0;_0x1a626b<_0x235df3['conditions'][_0x8e97('0x4c')];_0x1a626b++){var _0x156517=_0x235df3[_0x8e97('0x67')][_0x1a626b];var _0x39b493='i';var _0x4db11a=_[_0x8e97('0x68')](_0x4e5355,[_0x8e97('0x3a'),_0x156517[_0x8e97('0x53')]]);if(!_0x4db11a){switch(_0x156517[_0x8e97('0x53')]){case _0x8e97('0x69'):if(_0x156517[_0x8e97('0x6a')]==0x1){_0x4a9d99[_0x8e97('0x6b')]('`'+_0x156517['field']+'`\x20=\x200');}else{_0x4a9d99['having']('`'+_0x156517[_0x8e97('0x53')]+'`\x20>\x200');}break;case'Contact':if(_0x156517[_0x8e97('0x6c')]===_0x8e97('0x6d')){if(_0x156517[_0x8e97('0x6a')][_0x8e97('0x3e')]('\x20')[_0x8e97('0x4c')]>0x1){_0x21c076[_0x1eb7a6]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8e97('0x6e')](_0x156517[_0x8e97('0x6a')]),null);}else{var _0x3bba0b='%'+_0x156517[_0x8e97('0x6a')]+'%';_0x21c076[_0x1eb7a6](_0x8e97('0x6f'),_0x3bba0b,_0x3bba0b,_0x3bba0b);}}else{_0x4db11a=_[_0x8e97('0x68')](_0x4e5355,['name',_0x8e97('0x70')]);_0x156517[_0x8e97('0x53')]=_0x8e97('0x70');_0xef2acb=as[_0x8e97('0x71')](_0x39b493,_0x4db11a[_0x8e97('0x44')],_0x156517);_0x21c076[_0x1eb7a6](_0xef2acb['text'],_0xef2acb[_0x8e97('0x6a')][_0x8e97('0x72')],_0xef2acb['value'][_0x8e97('0x2e')]);}break;case _0x8e97('0x73'):var _0x33c579=_0x156517['value']['split'](',')[_0x8e97('0x41')](function(_0x5ec6d5){return Number(_0x5ec6d5);});_0x33c579[_0x8e97('0x74')](function(_0x7424f4){_0x3b6512['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x7424f4+',%');});_0x1e49db=_[_0x8e97('0x75')](_0x1e49db,_0x33c579);break;case _0x8e97('0x76'):if(_0x156517[_0x8e97('0x6c')]===_0x8e97('0x6d')){_0x21c076[_0x1eb7a6](_0x8e97('0x77'),'%'+_0x156517[_0x8e97('0x6a')]+'%',null);}else{_0x4db11a=_[_0x8e97('0x68')](_0x4e5355,[_0x8e97('0x3a'),_0x8e97('0x78')]);_0x156517[_0x8e97('0x53')]=_0x8e97('0x78');_0xef2acb=as[_0x8e97('0x71')](_0x39b493,_0x4db11a[_0x8e97('0x44')],_0x156517);_0x21c076[_0x1eb7a6](_0xef2acb[_0x8e97('0x79')],_0xef2acb['value'][_0x8e97('0x72')],_0xef2acb[_0x8e97('0x6a')]['end']);}break;case _0x8e97('0x7a'):_0xef2acb=as['buildExpression']('me',null,_0x156517);_0x21c076[_0x1eb7a6](_0xef2acb[_0x8e97('0x79')],_0xef2acb['value'][_0x8e97('0x72')],_0xef2acb[_0x8e97('0x6a')]['end']);break;}}else{var _0xef2acb=as['buildExpression'](_0x39b493,_0x4db11a[_0x8e97('0x44')],_0x156517);_0x21c076[_0x1eb7a6](_0xef2acb[_0x8e97('0x79')],_0xef2acb['value']['start'],_0xef2acb[_0x8e97('0x6a')][_0x8e97('0x2e')]);}}}else{var _0x434adc=_(_0xa88699[_0x8e97('0x47')])['keys']()[_0x8e97('0x41')](function(_0x2055f3){return _['some'](_0x4e5355,[_0x8e97('0x3a'),_0x2055f3])?_0x2055f3:undefined;})['compact']()[_0x8e97('0x6a')]();if(!_[_0x8e97('0x7b')](_0x434adc)){_0x434adc[_0x8e97('0x74')](function(_0x59f47a){if(_0x59f47a==='ChatWebsiteId'){_0x4a9d99[_0x8e97('0x50')]('i.ChatWebsiteId\x20IN\x20?',[][_0x8e97('0x7c')](_0xa88699[_0x8e97('0x47')][_0x59f47a]));}else if(_0x59f47a===_0x8e97('0x7d')){var _0x2553ec=JSON[_0x8e97('0x7e')](_0xa88699[_0x8e97('0x47')][_0x59f47a])[_0x8e97('0x7f')];var _0x3bb03c=JSON[_0x8e97('0x7e')](_0xa88699[_0x8e97('0x47')][_0x59f47a])['$lte'];_0x4a9d99[_0x8e97('0x50')](_0x8e97('0x80'),_0x2553ec,_0x3bb03c);}else{if(_0xa88699[_0x8e97('0x47')][_0x59f47a]===_0x8e97('0x81')){_0x4a9d99[_0x8e97('0x50')]('i.'+_0x59f47a+_0x8e97('0x82'));}else{_0x4a9d99[_0x8e97('0x50')]('i.'+_0x59f47a+_0x8e97('0x83'),_0xa88699[_0x8e97('0x47')][_0x59f47a]);}}});}if(_0xa88699['query']['read']){if(_0xa88699['query'][_0x8e97('0x84')]==0x1){_0x4a9d99[_0x8e97('0x6b')](_0x8e97('0x85'));}else{_0x4a9d99[_0x8e97('0x6b')](_0x8e97('0x86'));}}if(_0xa88699[_0x8e97('0x47')][_0x8e97('0x87')]){_0x1e49db=_[_0x8e97('0x88')](_0xa88699['query'][_0x8e97('0x87')])?_0xa88699[_0x8e97('0x47')][_0x8e97('0x87')]:new Array(_0xa88699[_0x8e97('0x47')][_0x8e97('0x87')]);_0x1e49db[_0x8e97('0x74')](function(_0x154ad0){_0x3b6512['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x154ad0+',%');});}if(_0xa88699[_0x8e97('0x47')][_0x8e97('0x89')]){var _0x451b5e=_0xa88699[_0x8e97('0x47')][_0x8e97('0x89')][_0x8e97('0x8a')]('\x5c','\x5c\x5c')[_0x8e97('0x8a')](/'/g,'\x27\x27');if(qs[_0x8e97('0x8b')](_0x451b5e)){_0x21c076['or'](_0x8e97('0x8c'),_0x451b5e+'%');}else{_0x21c076['or'](_0x8e97('0x8d'),qs[_0x8e97('0x6e')](_0x451b5e))['or'](_0x8e97('0x8e'),_0x451b5e+'%');}}}_0x4a9d99[_0x8e97('0x50')](_0x21c076);_0x4a9d99['group'](_0x8e97('0x8f'));var _0x293540={'type':db['Sequelize'][_0x8e97('0x90')][_0x8e97('0x91')],'raw':!![]};var _0x33b548=_0x4a9d99[_0x8e97('0x92')]();_0x33b548[_0x8e97('0x53')]('i.id');_0x33b548[_0x8e97('0x53')](_0x8e97('0x93'),'unreadMessages');if(_0x8dd265[_0x8e97('0x4e')]){_0x8dd265[_0x8e97('0x4e')][_0x8e97('0x74')](function(_0x10171a){var _0x5c2f1a=_0x10171a[0x0]===_0x8e97('0x94')?_0x10171a[0x0]:'i.'+_0x10171a[0x0];_0x4a9d99[_0x8e97('0x4e')](_0x5c2f1a,_0x10171a[0x1]===_0x8e97('0x95')?![]:!![]);});}if(!_[_0x8e97('0x7b')](_0x1e49db)){_0x4a9d99[_0x8e97('0x6b')](_0x3b6512);_0x33b548[_0x8e97('0x50')](_0x8e97('0x96'),_0x1e49db);}BPromise[_0x8e97('0x97')]()[_0x8e97('0x21')](function(){if(!_0x235df3){if(_0xa88699['query'][_0x8e97('0x98')])return;_0x33b548[_0x8e97('0x50')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x4a9d99[_0x8e97('0x50')](_0x8e97('0x99'));return;}if(_0xa88699[_0x8e97('0x9a')]['role']!=='agent')return;return _0xa88699[_0x8e97('0x9a')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x8e97('0x21')](function(_0x308655){if(_[_0x8e97('0x7b')](_0x308655)){_0x33b548[_0x8e97('0x50')](_0x8e97('0x9b'));_0x4a9d99['where']('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x33b548['where'](_0x8e97('0x9c'),_[_0x8e97('0x41')](_0x308655,'id'));_0x4a9d99[_0x8e97('0x50')](_0x8e97('0x9c'),_[_0x8e97('0x41')](_0x308655,'id'));}});})[_0x8e97('0x21')](function(){if(_0xa88699[_0x8e97('0x9a')][_0x8e97('0x9d')]==='agent'&&!_0x235df3&&!_0xa88699[_0x8e97('0x47')][_0x8e97('0x98')])return[];return db[_0x8e97('0x9e')]['query'](_0x33b548[_0x8e97('0x9f')](),_0x293540);})[_0x8e97('0x21')](function(_0x190c26){_0x8e9af1[_0x8e97('0x30')]=_0x190c26[_0x8e97('0x4c')];if(_0x8e9af1['count']===0x0)return[];return db[_0x8e97('0x9e')][_0x8e97('0x47')](_0x3efbd9['toString'](),_0x293540)[_0x8e97('0x21')](function(_0x330ec7){_0x1e3b6a=_['keyBy'](_0x330ec7,'id');_0x293540=_['merge'](_0x293540,{'model':db[_0x8e97('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa88699[_0x8e97('0x47')][_0x8e97('0x4b')]){_0x8dd265[_0x8e97('0x4a')][_0x8e97('0x74')](function(_0x281080){_0x4a9d99[_0x8e97('0x53')]('i.'+_0x281080);});}else{_0x4a9d99[_0x8e97('0x53')](_0x8e97('0x93'),_0x8e97('0x69'));_0x4a9d99['field'](_0x8e97('0xa0'),_0x8e97('0xa1'));_0x4a9d99['field'](_0x8e97('0xa2'),_0x8e97('0xa3'));_0x4a9d99['field'](_0x8e97('0xa4'),_0x8e97('0x94'));_0x4a9d99[_0x8e97('0x53')](_0x8e97('0xa5'));_0x4a9d99[_0x8e97('0x53')]('c.firstName','Contact.firstName');_0x4a9d99[_0x8e97('0x53')](_0x8e97('0xa6'),_0x8e97('0xa7'));_0x4a9d99[_0x8e97('0x53')](_0x8e97('0xa8'),_0x8e97('0xa9'));_0x4a9d99['field'](_0x8e97('0xaa'),_0x8e97('0xab'));_0x4a9d99[_0x8e97('0x53')](_0x8e97('0xac'),_0x8e97('0xad'));_0x4a9d99[_0x8e97('0x53')]('c.fax',_0x8e97('0xae'));_0x4a9d99[_0x8e97('0x53')](_0x8e97('0xaf'),_0x8e97('0xb0'));_0x4a9d99[_0x8e97('0x53')](_0x8e97('0xb1'),_0x8e97('0xb2'));_0x4a9d99[_0x8e97('0x53')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8e97('0x3d'));}if(_0x8dd265[_0x8e97('0x32')])_0x4a9d99[_0x8e97('0x32')](_0x8dd265[_0x8e97('0x32')]);if(_0x8dd265[_0x8e97('0x31')])_0x4a9d99[_0x8e97('0x31')](_0x8dd265[_0x8e97('0x31')]);return db[_0x8e97('0x9e')][_0x8e97('0x47')](_0x4a9d99[_0x8e97('0x9f')](),_0x293540);})['then'](function(_0xe32575){_0x291ab9[_0x8e97('0x50')](_0x8e97('0xb3'),_[_0x8e97('0x41')](_0xe32575,'id'));return db['sequelize']['query'](_0x291ab9[_0x8e97('0x9f')](),_0x293540)[_0x8e97('0x21')](function(_0x404e3a){var _0x15c09a=_[_0x8e97('0xb4')](_0x404e3a,_0x8e97('0xb5'));var _0x50ab21=[];_0xe32575[_0x8e97('0x74')](function(_0x3c778c){_0x50ab21[_0x8e97('0x40')](updateChatInteraction(_0x3c778c,_0x1e3b6a,_0x15c09a));});return BPromise[_0x8e97('0xb6')](_0x50ab21);});});})[_0x8e97('0x21')](function(_0x2ce282){_0x8e9af1[_0x8e97('0xb7')]=_0x2ce282;return _0x8e9af1;})['then'](respondWithFilteredResult(_0xf79867,_0x8dd265))[_0x8e97('0x2b')](handleError(_0xf79867,null));};exports[_0x8e97('0xb8')]=function(_0x34ab23,_0x2acea4){var _0x8a2d7a={'raw':![],'where':{'id':_0x34ab23[_0x8e97('0xb9')]['id']}},_0x314818={};_0x314818['model']=_[_0x8e97('0xba')](db[_0x8e97('0x42')][_0x8e97('0xbb')]);_0x314818[_0x8e97('0x47')]=_[_0x8e97('0xba')](_0x34ab23['query']);_0x314818['filters']=_['intersection'](_0x314818[_0x8e97('0x46')],_0x314818[_0x8e97('0x47')]);_0x8a2d7a[_0x8e97('0x4a')]=_[_0x8e97('0x49')](_0x314818[_0x8e97('0x46')],qs[_0x8e97('0x4b')](_0x34ab23['query'][_0x8e97('0x4b')]));_0x8a2d7a[_0x8e97('0x4a')]=_0x8a2d7a[_0x8e97('0x4a')]['length']?_0x8a2d7a['attributes']:_0x314818['model'];if(_0x34ab23[_0x8e97('0x47')][_0x8e97('0xbc')]){_0x8a2d7a[_0x8e97('0xbd')]=[{'all':!![]}];}_0x8a2d7a=_[_0x8e97('0xbe')]({},_0x8a2d7a,_0x34ab23['options']);return db['ChatInteraction'][_0x8e97('0x68')](_0x8a2d7a)['then'](handleEntityNotFound(_0x2acea4,null))['then'](respondWithResult(_0x2acea4,null))[_0x8e97('0x2b')](handleError(_0x2acea4,null));};exports['create']=function(_0x4f19a7,_0x31b973){return db[_0x8e97('0x42')][_0x8e97('0xbf')](_0x4f19a7[_0x8e97('0x7a')],{})[_0x8e97('0x21')](respondWithResult(_0x31b973,0xc9))[_0x8e97('0x2b')](handleError(_0x31b973,null));};exports['update']=function(_0x4a04e0,_0x2ca907){if(_0x4a04e0[_0x8e97('0x7a')]['id']){delete _0x4a04e0['body']['id'];}return db[_0x8e97('0x42')][_0x8e97('0x68')]({'where':{'id':_0x4a04e0[_0x8e97('0xb9')]['id']}})[_0x8e97('0x21')](handleEntityNotFound(_0x2ca907,null))[_0x8e97('0x21')](saveUpdates(_0x4a04e0[_0x8e97('0x7a')],null))[_0x8e97('0x21')](respondWithResult(_0x2ca907,null))[_0x8e97('0x2b')](handleError(_0x2ca907,null));};exports[_0x8e97('0x38')]=function(_0x2912d3,_0x202c58){return db['ChatInteraction'][_0x8e97('0x68')]({'where':{'id':_0x2912d3[_0x8e97('0xb9')]['id']}})[_0x8e97('0x21')](handleEntityNotFound(_0x202c58,null))[_0x8e97('0x21')](removeEntity(_0x202c58,null))[_0x8e97('0x2b')](handleError(_0x202c58,null));};exports[_0x8e97('0xc0')]=function(_0x21f902,_0x5bba1b){return db[_0x8e97('0x42')][_0x8e97('0xc0')]()[_0x8e97('0x21')](respondWithResult(_0x5bba1b,null))['catch'](handleError(_0x5bba1b,null));};exports[_0x8e97('0xc1')]=function(_0x5c14c1,_0x250ee4){var _0x44bfcf=_0x5c14c1[_0x8e97('0xb9')]['id'];var _0x6ae782;var _0x1bd2e9;var _0x2e9954;return db['ChatInteraction'][_0x8e97('0xc2')]({'where':{'id':_0x44bfcf}})['then'](function(_0x1e533d){_0x6ae782=_0x1e533d;return db['ChatWebsite'][_0x8e97('0xc2')]({'where':{'id':_0x1e533d[_0x8e97('0x98')]},'attributes':['id',_0x8e97('0xc3'),'vidaooEscalation'],'raw':!![]});})[_0x8e97('0x21')](function(_0x1a3512){if(_0x1a3512&&_0x1a3512[_0x8e97('0xc3')]&&_0x1a3512[_0x8e97('0xc4')]){_0x1bd2e9=_0x1a3512;var _0x1c9c9c={'rejectUnauthorized':![],'method':'POST','uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x1a3512[_0x8e97('0xc3')]},'body':{'name':'MotionCWB:'+_0x44bfcf},'redirect':'follow','json':!![]};return rp(_0x1c9c9c);}else{throw new db[(_0x8e97('0xc5'))][(_0x8e97('0xc6'))](_0x8e97('0xc7'));}})[_0x8e97('0x21')](function(_0x235dcc){_0x2e9954=_0x235dcc;if(_0x2e9954['id']){var _0x1a9d6b={'body':_0x2e9954['join_url'],'ChatWebsiteId':_0x1bd2e9['id'],'ChatInteractionId':_0x6ae782['id'],'direction':_0x8e97('0xc8'),'UserId':_0x5c14c1[_0x8e97('0x9a')]['id']};return db[_0x8e97('0xc9')][_0x8e97('0xbf')](_0x1a9d6b,{});}else{throw new db[(_0x8e97('0xc5'))][(_0x8e97('0xc6'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x8e97('0x21')](function(){return _0x6ae782[_0x8e97('0xca')]({'vidaooSessionId':_0x2e9954['id']});})[_0x8e97('0x21')](respondWithResult(_0x250ee4,null))[_0x8e97('0x2b')](handleError(_0x250ee4,null));};exports['customUpdate']=function(_0x58a5a8,_0x5e8180){if(_0x58a5a8[_0x8e97('0x7a')]['id']){delete _0x58a5a8[_0x8e97('0x7a')]['id'];}return db[_0x8e97('0x42')][_0x8e97('0x68')]({'where':{'id':_0x58a5a8['params']['id']},'include':[{'model':db[_0x8e97('0xcb')],'as':'Contact'}]})[_0x8e97('0x21')](handleEntityNotFound(_0x5e8180,null))[_0x8e97('0x21')](saveUpdates(_0x58a5a8[_0x8e97('0x7a')],null))[_0x8e97('0x21')](respondWithResult(_0x5e8180,null))[_0x8e97('0x2b')](handleError(_0x5e8180,null));};exports[_0x8e97('0xcc')]=function(_0x207e63,_0x30ced0,_0x534bd6){if(_0x207e63[_0x8e97('0x7a')]['id']){delete _0x207e63[_0x8e97('0x7a')]['id'];}return db[_0x8e97('0x42')][_0x8e97('0x68')]({'where':{'id':_0x207e63['params']['id']}})[_0x8e97('0x21')](function(_0x457ca5){if(!_0x457ca5){logger[_0x8e97('0x27')](_0x8e97('0xcd'),_0x8e97('0xcc'),0x194,_0x8e97('0xce'));_0x30ced0[_0x8e97('0x2c')](0x194);}else{if(_0x457ca5['UserId']){throw new db[(_0x8e97('0xc5'))][(_0x8e97('0xc6'))]('Interaction\x20already\x20assigned');}}return _0x457ca5;})[_0x8e97('0x21')](function(_0x33e13a){if(_0x33e13a){return _0x33e13a[_0x8e97('0x37')]({'closed':_0x207e63[_0x8e97('0x7a')]['closed'],'disposition':_0x207e63[_0x8e97('0x7a')][_0x8e97('0xcf')]})[_0x8e97('0x21')](function(_0x5188c6){return _0x5188c6;});}})['then'](function(_0x263369){return respondWithRpcPromise(_0x8e97('0xd0'),_0x8e97('0xcc'),_0x207e63['body'],client9004);})[_0x8e97('0x21')](respondWithResult(_0x30ced0,null))[_0x8e97('0x2b')](handleError(_0x30ced0,null));};exports[_0x8e97('0xd1')]=function(_0x1573b7,_0x1855c0,_0x58338d){_0x1573b7[_0x8e97('0x7a')][_0x8e97('0x3a')]=_0x1573b7[_0x8e97('0xd2')][_0x8e97('0xd3')];_0x1573b7[_0x8e97('0x7a')][_0x8e97('0xd4')]=_0x1573b7[_0x8e97('0xd2')]['filename'];_0x1573b7[_0x8e97('0x7a')]['type']=_0x1573b7[_0x8e97('0xd2')]['mimetype'];return db[_0x8e97('0xd5')][_0x8e97('0xbf')](_0x1573b7['body'])[_0x8e97('0x21')](respondWithResult(_0x1855c0,0xc9))[_0x8e97('0x2b')](handleError(_0x1855c0,null));};exports[_0x8e97('0xd6')]=function(_0x11e68d,_0x4d2c50,_0x1f40e0){return db['ChatInteraction']['findOne']({'where':{'id':_0x11e68d[_0x8e97('0xb9')]['id']},'raw':!![]})[_0x8e97('0x21')](handleEntityNotFound(_0x4d2c50,null))[_0x8e97('0x21')](function(_0x5d5ce4){if(_0x5d5ce4){if(_0x5d5ce4[_0x8e97('0xd7')]){return _0x4d2c50['status'](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x8e97('0xd5')]['findOne']({'where':{'id':_0x11e68d[_0x8e97('0x47')][_0x8e97('0xd8')]},'raw':!![]})['then'](handleEntityNotFound(_0x4d2c50,null));}})['then'](function(_0x5b3d5d){if(_0x5b3d5d){var _0x1046db=_0x5b3d5d[_0x8e97('0xd9')]!==null;var _0x317a74=path[_0x8e97('0xda')](config[_0x8e97('0xdb')],'server/files/attachments/');if(_0x1046db){_0x317a74=path[_0x8e97('0xda')](_0x317a74,_0x8e97('0xdc'));}var _0x2b5408=path[_0x8e97('0xda')](_0x317a74,_0x5b3d5d[_0x8e97('0xd4')]);return _0x4d2c50[_0x8e97('0xdd')](_0x2b5408);}})[_0x8e97('0x2b')](handleError(_0x4d2c50,null));};exports['close']=function(_0x3e110c,_0x444117){var _0x165e28=null;var _0x155472=null;var _0x53de12=null;var _0x3567c2=null;if(_0x3e110c['body']['id']){delete _0x3e110c[_0x8e97('0x7a')]['id'];}if(_0x3e110c[_0x8e97('0x7a')][_0x8e97('0xde')]){_0x3567c2=path[_0x8e97('0xda')](config[_0x8e97('0xdb')],_0x8e97('0xdf'),util[_0x8e97('0xe0')](_0x8e97('0xe1'),Date[_0x8e97('0xe2')]()));_0x3e110c[_0x8e97('0x7a')][_0x8e97('0xe3')]=_0x3567c2;}return db[_0x8e97('0x42')]['find']({'where':{'id':_0x3e110c['params']['id']},'include':[{'model':db[_0x8e97('0xc9')],'as':_0x8e97('0xe4'),'include':[{'model':db[_0x8e97('0x76')],'as':_0x8e97('0x76')}]}]})['then'](handleEntityNotFound(_0x444117,null))[_0x8e97('0x21')](saveUpdates(_0x3e110c[_0x8e97('0x7a')],null))[_0x8e97('0x21')](function(_0x106636){if(_0x106636){_0x165e28=_0x106636;return db[_0x8e97('0xe5')][_0x8e97('0x68')]({'where':{'id':_0x165e28[_0x8e97('0x98')]}});}})[_0x8e97('0x21')](function(_0x330268){if(_0x330268){_0x53de12=_0x330268;return db[_0x8e97('0xcb')]['find']({'where':{'id':_0x165e28[_0x8e97('0x70')]}});}})[_0x8e97('0x21')](function(_0x1ed2e3){if(_0x1ed2e3){_0x155472=_0x1ed2e3;if(_0x3567c2){var _0x3ff82a=null;for(var _0x5673ea=0x1;_0x5673ea<_0x165e28[_0x8e97('0xe4')][_0x8e97('0x4c')];++_0x5673ea){_0x3ff82a=_0x165e28[_0x8e97('0xe4')][_0x5673ea];var _0x3a4f3a=_0x3ff82a['UserId']?util[_0x8e97('0xe0')](_0x8e97('0xe6'),_0x53de12[_0x8e97('0xe7')],_0x3ff82a[_0x8e97('0x78')]):'System';var _0x311153=_0x3e110c['body'][_0x8e97('0xe8')]||util['format'](_0x8e97('0xe6'),'Visitor',_0x3ff82a[_0x8e97('0x70')]);switch(_0x53de12[_0x8e97('0xe9')]){case _0x8e97('0xea'):_0x3a4f3a=_0x3ff82a['UserId']?util[_0x8e97('0xe0')](_0x8e97('0xe6'),_0x53de12[_0x8e97('0xe7')],_0x3ff82a[_0x8e97('0x78')]):_0x8e97('0xeb');break;case _0x8e97('0xec'):_0x3a4f3a=_0x3ff82a[_0x8e97('0x78')]?_0x3ff82a['User']['alias']||_0x3ff82a[_0x8e97('0x76')][_0x8e97('0x3c')]:'System';break;case _0x8e97('0xed'):_0x3a4f3a=_0x3ff82a[_0x8e97('0x78')]?_0x3ff82a[_0x8e97('0x76')][_0x8e97('0x3c')]:_0x8e97('0xeb');break;default:_0x3a4f3a=_0x3ff82a['UserId']?util[_0x8e97('0xe0')](_0x8e97('0xe6'),_0x53de12['agentAlias'],_0x3ff82a[_0x8e97('0x78')]):_0x8e97('0xeb');}var _0xdeef48=util['format'](_0x8e97('0xee'),moment(_0x3ff82a[_0x8e97('0x7d')])[_0x8e97('0xe0')]('MM/DD/YYYY\x20HH:mm:ss'),_0x3ff82a['direction']==='in'?_0x311153:_0x3a4f3a,_0x3ff82a['body']);if(!_0x3ff82a['secret']){fs[_0x8e97('0xef')](_0x3567c2,_0xdeef48);}}return db[_0x8e97('0xf0')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x8e97('0xf1')],'as':'Smtp','raw':!![]}]});}}})[_0x8e97('0x21')](function(_0x1378ab){if(_0x1378ab&&_0x1378ab['Smtp']&&_0x3e110c[_0x8e97('0x7a')]){var _0x418836={'tls':{'rejectUnauthorized':![]}};if(_0x1378ab[_0x8e97('0xf2')][_0x8e97('0xf3')]){_0x418836[_0x8e97('0xf3')]=_0x1378ab['Smtp'][_0x8e97('0xf3')];}else{_0x418836[_0x8e97('0xf4')]=_0x1378ab[_0x8e97('0xf2')][_0x8e97('0xf4')];_0x418836[_0x8e97('0xf5')]=_0x1378ab['Smtp']['port'];_0x418836[_0x8e97('0xf6')]=_0x1378ab[_0x8e97('0xf2')][_0x8e97('0xf6')];}if(_0x1378ab[_0x8e97('0xf2')][_0x8e97('0xf7')]){_0x418836['auth']={'user':_0x1378ab['Smtp']['user'],'pass':_0x1378ab[_0x8e97('0xf2')][_0x8e97('0xf8')]};}return respondWithRpcPromise(_0x8e97('0xf9'),_0x8e97('0xfa'),{'account':_0x418836,'message':{'from':util[_0x8e97('0xe0')](_0x8e97('0xfb'),_0x1378ab[_0x8e97('0x3a')],_0x1378ab[_0x8e97('0xfc')]||_0x1378ab[_0x8e97('0xf2')][_0x8e97('0x9a')]),'to':_0x3e110c['body'][_0x8e97('0xde')],'subject':'Mail\x20Transcript','text':util[_0x8e97('0xe0')](_0x8e97('0xfd'),_0x3e110c[_0x8e97('0x7a')][_0x8e97('0xde')]),'attachments':[{'path':_0x3567c2}]}})[_0x8e97('0x21')](function(){return _0x165e28;})[_0x8e97('0x2b')](function(_0x407469){console[_0x8e97('0x27')](_0x407469);});}else{return _0x165e28;}})[_0x8e97('0x21')](respondWithStatusCode(_0x444117,0xc8))[_0x8e97('0x2b')](handleError(_0x444117,null));};exports['addMessage']=function(_0x3bd311,_0x1c3a91,_0x1227c6){return db[_0x8e97('0xc9')][_0x8e97('0x68')]({'where':{'id':_0x3bd311[_0x8e97('0xb9')]['id']}})['then'](handleEntityNotFound(_0x1c3a91,null))[_0x8e97('0x21')](function(_0x122e75){if(_0x122e75){return _0x122e75[_0x8e97('0xfe')](_0x3bd311['body'][_0x8e97('0xff')],_[_0x8e97('0x100')](_0x3bd311[_0x8e97('0x7a')],['ids','id'])||{});}})[_0x8e97('0x21')](respondWithResult(_0x1c3a91,null))['catch'](handleError(_0x1c3a91,null));};exports[_0x8e97('0x101')]=function(_0x1859ae,_0x5b2097,_0x34fd9b){var _0x142345={'raw':![],'where':{}};var _0x1d0377={};var _0x388e7d={'count':0x0,'rows':[]};return db[_0x8e97('0x42')]['findOne']({'where':{'id':_0x1859ae[_0x8e97('0xb9')]['id']}})[_0x8e97('0x21')](handleEntityNotFound(_0x5b2097,null))['then'](function(_0x58e934){if(_0x58e934){_0x1d0377['model']=_[_0x8e97('0xba')](db[_0x8e97('0xc9')][_0x8e97('0xbb')]);_0x1d0377[_0x8e97('0x47')]=_['keys'](_0x1859ae[_0x8e97('0x47')]);_0x1d0377[_0x8e97('0x48')]=_[_0x8e97('0x49')](_0x1d0377[_0x8e97('0x46')],_0x1d0377[_0x8e97('0x47')]);_0x142345[_0x8e97('0x4a')]=_[_0x8e97('0x49')](_0x1d0377[_0x8e97('0x46')],qs['fields'](_0x1859ae[_0x8e97('0x47')]['fields']));_0x142345[_0x8e97('0x4a')]=_0x142345[_0x8e97('0x4a')][_0x8e97('0x4c')]?_0x142345['attributes']:_0x1d0377['model'];if(!_0x1859ae[_0x8e97('0x47')]['hasOwnProperty'](_0x8e97('0x102'))){_0x142345['limit']=qs[_0x8e97('0x32')](_0x1859ae[_0x8e97('0x47')]['limit']);_0x142345[_0x8e97('0x31')]=qs[_0x8e97('0x31')](_0x1859ae[_0x8e97('0x47')][_0x8e97('0x31')]);}_0x142345['order']=qs[_0x8e97('0x4f')](_0x1859ae['query'][_0x8e97('0x4f')]);_0x142345['where']=qs[_0x8e97('0x48')](_[_0x8e97('0x51')](_0x1859ae['query'],_0x1d0377[_0x8e97('0x48')]));_0x142345['where']['ChatInteractionId']=_0x58e934['id'];if(_0x1859ae[_0x8e97('0x47')][_0x8e97('0x89')]){_0x142345[_0x8e97('0x50')]=_[_0x8e97('0xbe')](_0x142345['where'],{'$or':_[_0x8e97('0x41')](_0x142345['attributes'],function(_0x470d28){var _0xef901c={};_0xef901c[_0x470d28]={'$like':'%'+_0x1859ae['query'][_0x8e97('0x89')]+'%'};return _0xef901c;})});}if(_0x1859ae[_0x8e97('0x47')]['$gte']){var _0x1ac748=_0x1859ae[_0x8e97('0x47')][_0x8e97('0x7f')][_0x8e97('0x3e')](',');var _0x1a6ae7={};_0x1a6ae7[_0x1ac748[0x0]]={'$gte':moment(_0x1ac748[0x1])[_0x8e97('0xe0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x142345[_0x8e97('0x50')]=_[_0x8e97('0xbe')](_0x142345[_0x8e97('0x50')],_0x1a6ae7);}_0x142345=_[_0x8e97('0xbe')]({},_0x142345,_0x1859ae[_0x8e97('0x103')]);return db[_0x8e97('0xc9')]['count']({'where':_0x142345['where']})[_0x8e97('0x21')](function(_0x2dc66b){_0x388e7d[_0x8e97('0x30')]=_0x2dc66b;if(_0x1859ae[_0x8e97('0x47')][_0x8e97('0xbc')]){_0x142345[_0x8e97('0xbd')]=[{'all':!![]}];}return db[_0x8e97('0xc9')][_0x8e97('0x104')](_0x142345);})[_0x8e97('0x21')](function(_0x51847f){_0x388e7d[_0x8e97('0xb7')]=_0x51847f;return _0x388e7d;});}})[_0x8e97('0x21')](respondWithFilteredResult(_0x5b2097,_0x142345))[_0x8e97('0x2b')](handleError(_0x5b2097,null));};exports[_0x8e97('0x105')]=function(_0x5a9826,_0x2dfa5b,_0x3dcec8){var _0x20cb6e={'where':{}},_0x264641={},_0xdfa037={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8e97('0xc2')]({'where':{'id':_0x5a9826[_0x8e97('0xb9')]['id']}})[_0x8e97('0x21')](handleEntityNotFound(_0x2dfa5b,null))[_0x8e97('0x21')](function(_0x5021c8){if(_0x5021c8){_0x264641[_0x8e97('0x46')]=_[_0x8e97('0xba')](db[_0x8e97('0xc9')][_0x8e97('0xbb')]);_0x264641['query']=_[_0x8e97('0xba')](_0x5a9826[_0x8e97('0x47')]);_0x264641[_0x8e97('0x48')]=_[_0x8e97('0x49')](_0x264641['model'],_0x264641['query']);_0x20cb6e['attributes']=_[_0x8e97('0x49')](_0x264641[_0x8e97('0x46')],qs[_0x8e97('0x4b')](_0x5a9826['query'][_0x8e97('0x4b')]));_0x20cb6e['attributes']=_0x20cb6e[_0x8e97('0x4a')][_0x8e97('0x4c')]?_0x20cb6e[_0x8e97('0x4a')]:_0x264641['model'];if(!_0x5a9826['query'][_0x8e97('0x4d')](_0x8e97('0x102'))){_0x20cb6e['limit']=qs[_0x8e97('0x32')](_0x5a9826[_0x8e97('0x47')][_0x8e97('0x32')]);_0x20cb6e[_0x8e97('0x31')]=qs[_0x8e97('0x31')](_0x5a9826[_0x8e97('0x47')]['offset']);}_0x20cb6e['order']=qs[_0x8e97('0x4f')](_0x5a9826[_0x8e97('0x47')][_0x8e97('0x4f')]);_0x20cb6e[_0x8e97('0x50')]=qs[_0x8e97('0x48')](_[_0x8e97('0x51')](_0x5a9826['query'],_0x264641[_0x8e97('0x48')]));_0x20cb6e[_0x8e97('0x50')][_0x8e97('0xb5')]=_0x5021c8['id'];if(_0x5a9826[_0x8e97('0x47')][_0x8e97('0x89')]){_0x20cb6e['where']=_['merge'](_0x20cb6e['where'],{'$or':_[_0x8e97('0x41')](_0x20cb6e[_0x8e97('0x4a')],function(_0x1bf398){var _0x3cf2f9={};_0x3cf2f9[_0x1bf398]={'$like':'%'+_0x5a9826[_0x8e97('0x47')][_0x8e97('0x89')]+'%'};return _0x3cf2f9;})});}_0x20cb6e[_0x8e97('0x50')][_0x8e97('0x106')]=![];if(_0x5a9826[_0x8e97('0x47')]['id']){_0x20cb6e[_0x8e97('0x50')]['id']={'$gt':_0x5a9826['query']['id']};}_0x20cb6e=_['merge']({},_0x20cb6e,_0x5a9826['options']);return db[_0x8e97('0xc9')]['count']({'where':_0x20cb6e[_0x8e97('0x50')]})[_0x8e97('0x21')](function(_0x85f110){_0xdfa037['count']=_0x85f110;_0x20cb6e[_0x8e97('0xbd')]=[];if(_0x5a9826[_0x8e97('0x47')]['includeAgent']){_0x20cb6e[_0x8e97('0xbd')][_0x8e97('0x40')]({'model':db[_0x8e97('0x76')],'as':_0x8e97('0x76'),'attributes':['id',_0x8e97('0x3c'),'alias']});}if(_0x5a9826[_0x8e97('0x47')][_0x8e97('0xbc')]){_0x20cb6e[_0x8e97('0xbd')]=[{'all':!![]}];}return db[_0x8e97('0xc9')][_0x8e97('0x104')](_0x20cb6e);})[_0x8e97('0x21')](function(_0x2d4710){_0xdfa037['rows']=_0x2d4710;return _0xdfa037;});}})['then'](respondWithFilteredResult(_0x2dfa5b,_0x20cb6e))[_0x8e97('0x2b')](handleError(_0x2dfa5b,null));};exports['addTags']=function(_0x43a0dd,_0x37abb1,_0xfd5409){return db[_0x8e97('0x42')]['find']({'where':{'id':_0x43a0dd[_0x8e97('0xb9')]['id']}})[_0x8e97('0x21')](handleEntityNotFound(_0x37abb1,null))['then'](function(_0x511d7a){if(_0x511d7a){return _0x511d7a['setTags'](_0x43a0dd[_0x8e97('0x7a')][_0x8e97('0xff')],_[_0x8e97('0x100')](_0x43a0dd[_0x8e97('0x7a')],[_0x8e97('0xff'),'id'])||{})['spread'](function(){return db[_0x8e97('0x73')][_0x8e97('0x104')]({'attributes':['id',_0x8e97('0x3a'),_0x8e97('0x107')],'where':{'id':_0x43a0dd[_0x8e97('0x7a')]['ids']}});})[_0x8e97('0x21')](function(_0x1c6d50){socket[_0x8e97('0x108')](_0x8e97('0x109'),{'id':Number(_0x43a0dd[_0x8e97('0xb9')]['id']),'tags':_0x1c6d50||[]});return{'id':Number(_0x43a0dd[_0x8e97('0xb9')]['id']),'tags':_0x1c6d50||[]};});}})[_0x8e97('0x21')](respondWithResult(_0x37abb1,null))[_0x8e97('0x2b')](handleError(_0x37abb1,null));};exports['removeTags']=function(_0x5e8887,_0x33d83e,_0x48f0aa){return db[_0x8e97('0x42')][_0x8e97('0x68')]({'where':{'id':_0x5e8887['params']['id']}})[_0x8e97('0x21')](handleEntityNotFound(_0x33d83e,null))[_0x8e97('0x21')](function(_0x61bccf){if(_0x61bccf){return _0x61bccf[_0x8e97('0x10a')](_0x5e8887[_0x8e97('0x47')][_0x8e97('0xff')]);}})['then'](respondWithStatusCode(_0x33d83e,null))[_0x8e97('0x2b')](handleError(_0x33d83e,null));};exports[_0x8e97('0xdd')]=function(_0x2a1ccb,_0x121e65){var _0x322ec7=moment()[_0x8e97('0x10b')]()[_0x8e97('0x9f')]();var _0x1eb175=path[_0x8e97('0xda')](config['root'],'server',_0x8e97('0x10c'),_0x8e97('0x10d'));var _0x160d67=path[_0x8e97('0xda')](config['root'],'server',_0x8e97('0x10c'),_0x8e97('0x10e'));var _0x356fa9=path['join'](_0x1eb175,_0x322ec7);var _0x32dfac=util[_0x8e97('0xe0')](_0x8e97('0x10f'),_0x2a1ccb[_0x8e97('0xb9')]['id'],_0x322ec7);var _0x11836e=path[_0x8e97('0xda')](_0x1eb175,_0x32dfac);var _0x3d3b36=[];_0x3d3b36[_0x8e97('0x40')]({'model':db[_0x8e97('0x76')],'as':_0x8e97('0x76'),'attributes':['id',_0x8e97('0x3c')],'raw':!![]});_0x3d3b36[_0x8e97('0x40')]({'model':db[_0x8e97('0xcb')],'as':_0x8e97('0x110'),'attributes':['id',_0x8e97('0x111'),'lastName'],'raw':!![]});if(_0x2a1ccb[_0x8e97('0x47')][_0x8e97('0x10e')]){_0x3d3b36[_0x8e97('0x40')]({'model':db[_0x8e97('0xd5')],'as':'Attachment','raw':!![]});}var _0x5d64e9=[{'model':db[_0x8e97('0xc9')],'as':_0x8e97('0xe4'),'attributes':['id',_0x8e97('0x7a'),'createdAt','direction',_0x8e97('0x106'),_0x8e97('0x84')],'include':_0x3d3b36}];_0x5d64e9[_0x8e97('0x40')]({'model':db[_0x8e97('0xe5')],'as':_0x8e97('0x112'),'attributes':['id',_0x8e97('0x3a')]});_0x5d64e9['push']({'model':db[_0x8e97('0x76')],'as':_0x8e97('0x113'),'attributes':['id',_0x8e97('0x3c')]});return db[_0x8e97('0x42')][_0x8e97('0x68')]({'where':{'id':_0x2a1ccb['params']['id']},'include':_0x5d64e9})[_0x8e97('0x21')](handleEntityNotFound(_0x121e65,null))['then'](function(_0x54e7a4){if(_0x54e7a4){var _0x1a0aca=_0x54e7a4[_0x8e97('0x114')]({'plain':!![]});fs[_0x8e97('0x115')](_0x356fa9);var _0x37d2e1={'format':'A4','border':'10px','header':{'height':_0x8e97('0x116'),'contents':{'first':_0x8e97('0x117')}},'footer':{'height':_0x8e97('0x118'),'contents':{'default':util[_0x8e97('0xe0')](_0x8e97('0x119'),util['format']('%s\x20#%d',_0x8e97('0x11a'),_0x1a0aca['id']),moment()['format'](_0x8e97('0x11b'))['toString']())}}};var _0x3c73d7={'channel':'Chat','account':_0x1a0aca[_0x8e97('0x112')][_0x8e97('0x3a')],'agent':_0x1a0aca[_0x8e97('0x113')]?_0x1a0aca[_0x8e97('0x113')][_0x8e97('0x3c')]:'N.A.','createdAt':moment(_0x1a0aca[_0x8e97('0x7d')])[_0x8e97('0xe0')](_0x8e97('0x11c'))[_0x8e97('0x9f')](),'closedAt':_0x1a0aca[_0x8e97('0xd7')]?moment(_0x1a0aca[_0x8e97('0x11d')])[_0x8e97('0xe0')](_0x8e97('0x11c'))[_0x8e97('0x9f')]():'','disposition':_0x1a0aca[_0x8e97('0xcf')],'chatInfo':{'browser':_0x1a0aca[_0x8e97('0x11e')],'os':_0x1a0aca['osName'],'referer':_0x1a0aca[_0x8e97('0x11f')],'customerIp':_0x1a0aca['customerIp'],'customerPort':_0x1a0aca['customerPort']?_0x1a0aca[_0x8e97('0x120')]:_0x8e97('0x121')},'messages':_(_0x1a0aca[_0x8e97('0xe4')])[_0x8e97('0x122')]()['filter']({'secret':![]})[_0x8e97('0x41')](function(_0x3abbc9){if(_0x3abbc9[_0x8e97('0xd5')]){var _0x526ae4=path[_0x8e97('0xda')](_0x160d67,_0x3abbc9[_0x8e97('0xd5')][_0x8e97('0xd4')]);if(fs[_0x8e97('0x123')](_0x526ae4)){fs[_0x8e97('0x124')](_0x526ae4)['pipe'](fs[_0x8e97('0x125')](path[_0x8e97('0xda')](_0x356fa9,_0x3abbc9[_0x8e97('0xd5')]['basename'])));}}return{'date':moment(_0x3abbc9['createdAt'])['format'](_0x8e97('0x11c'))[_0x8e97('0x9f')](),'sender':_0x3abbc9[_0x8e97('0x126')]===_0x8e97('0xc8')?_0x3abbc9['User']?_0x3abbc9['User'][_0x8e97('0x3c')]:'System':_0x3abbc9[_0x8e97('0x110')]['firstName']+(_0x3abbc9[_0x8e97('0x110')][_0x8e97('0x127')]?'\x20'+_0x3abbc9[_0x8e97('0x110')][_0x8e97('0x127')]:''),'body':_0x3abbc9[_0x8e97('0xd5')]?_0x3abbc9['Attachment']['basename']:_0x3abbc9[_0x8e97('0x7a')],'direction':_0x3abbc9[_0x8e97('0x126')]===_0x8e97('0xc8')?'A':'C','secret':_0x3abbc9[_0x8e97('0x106')],'read':_0x3abbc9[_0x8e97('0x84')],'attachment':_0x3abbc9['Attachment']};})[_0x8e97('0x6a')]()};return ejs[_0x8e97('0x128')](path['join'](config['root'],'server',_0x8e97('0x129'),_0x8e97('0x12a')),{'interaction':_0x3c73d7})[_0x8e97('0x21')](function(_0x167085){return new BPromise(function(_0x92b706,_0x391fee){pdf[_0x8e97('0xbf')](_0x167085,_0x37d2e1)[_0x8e97('0x12b')](path[_0x8e97('0xda')](_0x356fa9,'transcript-'+_0x1a0aca['id']+'-'+_0x322ec7+_0x8e97('0x12c')),function(_0x4c2465,_0x13a0d6){if(_0x4c2465)return _0x391fee(_0x4c2465);_0x92b706(_0x13a0d6);});});})['then'](function(){return new BPromise(function(_0x2e7226,_0x2fe24e){zipdir(_0x356fa9,{'saveTo':_0x11836e},function(_0x3863ea,_0x2cd8e7){if(_0x3863ea)return _0x2fe24e(_0x3863ea);return _0x2e7226(_0x2cd8e7);});})['then'](function(){return new BPromise(function(_0x52f748,_0x189084){rimraf(_0x356fa9,function(_0x2e381e){if(_0x2e381e)_0x189084(_0x2e381e);return _0x52f748();});});})[_0x8e97('0x21')](function(){return _0x121e65[_0x8e97('0xdd')](_0x11836e,_0x32dfac,function(_0x5c2c15){if(_0x5c2c15){console[_0x8e97('0x12d')](_0x8e97('0x12e'),_0x5c2c15);}else{fs[_0x8e97('0x12f')](_0x11836e);}});});});}else{return _0x121e65[_0x8e97('0x2c')](0xc8);}})[_0x8e97('0x2b')](handleError(_0x121e65,null));}; \ No newline at end of file +var _0x82c4=['agent','getChatWebsites','role','toString','sequelize','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','push','all','rows','params','includeAll','options','catch','create','body','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','disposition','AbandonInteraction','file','originalname','basename','attachmentDownload','Unauthorized','Attachment','attachId','join','root','close','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','ChatWebsite','Messages','agentAlias','System','customer','format','Visitor','agentIdentifier','website_alias','%s%d','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','filter','include','findAll','ChatInteractionId','includeAgent','setTags','chatInteractionTags:save','removeTags','download','unix','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','Owner','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','Account','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','lastName','renderFile','views','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatInteraction.socket','register','jayson/promise','client','http','then','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','sendStatus','end','count','offset','limit','status','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','Users','TagIds','split','index','map','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.ChatInteractionId','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','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','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','forEach','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','read','isArray','tag','replace','i.id\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user'];(function(_0x21144a,_0x64a9a1){var _0x2dbe4d=function(_0x585f76){while(--_0x585f76){_0x21144a['push'](_0x21144a['shift']());}};_0x2dbe4d(++_0x64a9a1);}(_0x82c4,0x1ca));var _0x482c=function(_0x49595c,_0x86f44e){_0x49595c=_0x49595c-0x0;var _0x259ca0=_0x82c4[_0x49595c];return _0x259ca0;};'use strict';var pdf=require(_0x482c('0x0'));var emlformat=require(_0x482c('0x1'));var rimraf=require(_0x482c('0x2'));var zipdir=require(_0x482c('0x3'));var jsonpatch=require(_0x482c('0x4'));var rp=require(_0x482c('0x5'));var moment=require(_0x482c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x482c('0x7'));var util=require('util');var path=require(_0x482c('0x8'));var sox=require('sox');var csv=require(_0x482c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x482c('0xa'));var _=require(_0x482c('0xb'));var squel=require(_0x482c('0xc'));var crypto=require(_0x482c('0xd'));var jsforce=require(_0x482c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x482c('0x9'));var querystring=require(_0x482c('0xf'));var Papa=require(_0x482c('0x10'));var Redis=require(_0x482c('0x11'));var authService=require(_0x482c('0x12'));var qs=require(_0x482c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x482c('0x14'));var logger=require(_0x482c('0x15'))(_0x482c('0x16'));var utils=require('../../config/utils');var config=require(_0x482c('0x17'));var licenseUtil=require(_0x482c('0x18'));var db=require(_0x482c('0x19'))['db'];config['redis']=_['defaults'](config[_0x482c('0x1a')],{'host':_0x482c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x482c('0x1c'))[_0x482c('0x1d')](socket);var jayson=require(_0x482c('0x1e'));var client=jayson[_0x482c('0x1f')][_0x482c('0x20')]({'port':0x232b});var client9004=jayson[_0x482c('0x1f')][_0x482c('0x20')]({'port':0x232c});function respondWithRpcPromise(_0xf65563,_0x3fc79c,_0x1758fb,_0x363403){return new BPromise(function(_0xedaee0,_0x4bdf15){var _0x244bb9=_0x363403||client;return _0x244bb9['request'](_0xf65563,_0x1758fb)[_0x482c('0x21')](function(_0x258148){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x3fc79c,_0x482c('0x22'));logger['debug'](_0x482c('0x23'),_0x3fc79c,_0x482c('0x22'),JSON[_0x482c('0x24')](_0x258148));if(_0x258148[_0x482c('0x25')]){if(_0x258148['error'][_0x482c('0x26')]===0x1f4){logger[_0x482c('0x25')](_0x482c('0x27'),_0x3fc79c,_0x258148[_0x482c('0x25')][_0x482c('0x28')]);return _0x4bdf15(_0x258148['error']['message']);}logger[_0x482c('0x25')](_0x482c('0x27'),_0x3fc79c,_0x258148[_0x482c('0x25')]['message']);return _0xedaee0(_0x258148[_0x482c('0x25')]['message']);}else{logger[_0x482c('0x29')](_0x482c('0x27'),_0x3fc79c,'request\x20sent');_0xedaee0(_0x258148[_0x482c('0x2a')]['message']);}})['catch'](function(_0x2165af){logger[_0x482c('0x25')](_0x482c('0x27'),_0x3fc79c,_0x2165af);_0x4bdf15(_0x2165af);});});}function respondWithStatusCode(_0x1f4501,_0x3bd5bb){_0x3bd5bb=_0x3bd5bb||0xcc;return function(_0x215826){if(_0x215826){return _0x1f4501[_0x482c('0x2b')](_0x3bd5bb);}return _0x1f4501['status'](_0x3bd5bb)[_0x482c('0x2c')]();};}function respondWithResult(_0x255417,_0x58da7c){_0x58da7c=_0x58da7c||0xc8;return function(_0xb01bc3){if(_0xb01bc3){return _0x255417['status'](_0x58da7c)['json'](_0xb01bc3);}};}function respondWithFilteredResult(_0x207441,_0x5af04c){return function(_0x1ac1c4){if(_0x1ac1c4){var _0x2c5121=_0x1ac1c4[_0x482c('0x2d')],_0x3079df=_0x5af04c[_0x482c('0x2e')],_0x11fa65=_0x5af04c[_0x482c('0x2e')]+_0x5af04c[_0x482c('0x2f')],_0x39e8aa;if(_0x11fa65>=_0x2c5121){_0x11fa65=_0x2c5121;_0x39e8aa=0xc8;}else{_0x39e8aa=0xce;}_0x207441[_0x482c('0x30')](_0x39e8aa);return _0x207441[_0x482c('0x31')](_0x482c('0x32'),_0x3079df+'-'+_0x11fa65+'/'+_0x2c5121)[_0x482c('0x33')](_0x1ac1c4);}return null;};}function patchUpdates(_0x8779c2){return function(_0x1eac87){try{jsonpatch[_0x482c('0x34')](_0x1eac87,_0x8779c2,!![]);}catch(_0x22a8be){return BPromise[_0x482c('0x35')](_0x22a8be);}return _0x1eac87['save']();};}function saveUpdates(_0x4bc837,_0x520b6b){return function(_0x2fd9d0){if(_0x2fd9d0){return _0x2fd9d0[_0x482c('0x36')](_0x4bc837)[_0x482c('0x21')](function(_0x38d3e2){return _0x38d3e2;});}return null;};}function removeEntity(_0x59905b,_0x12ad47){return function(_0x4adc43){if(_0x4adc43){return _0x4adc43[_0x482c('0x37')]()[_0x482c('0x21')](function(){_0x59905b[_0x482c('0x30')](0xcc)[_0x482c('0x2c')]();});}};}function handleEntityNotFound(_0x15223b,_0x19cfc8){return function(_0x129a31){if(!_0x129a31){_0x15223b[_0x482c('0x2b')](0x194);}return _0x129a31;};}function handleError(_0x5377ce,_0x5783a7){_0x5783a7=_0x5783a7||0x1f4;return function(_0x467a70){logger['error'](_0x467a70[_0x482c('0x38')]);if(_0x467a70[_0x482c('0x39')]){delete _0x467a70[_0x482c('0x39')];}_0x5377ce['status'](_0x5783a7)[_0x482c('0x3a')](_0x467a70);};}function getInteractionUsers(_0x2131a8,_0x67cde9){return new BPromise(function(_0x43c06e,_0x54a629){try{if(_0x67cde9[_0x2131a8['id']]){_0x2131a8[_0x482c('0x3b')]=_['map'](_0x67cde9[_0x2131a8['id']],function(_0x1de7f4){return{'id':_0x1de7f4['id'],'fullname':_0x1de7f4['fullname']};});}}catch(_0x234bd2){_0x54a629(_0x234bd2);}_0x43c06e(_0x2131a8);});}function getInteractionTags(_0x47df5d,_0xb08f78){return new BPromise(function(_0x6778d5,_0x5942d2){try{if(_0x47df5d[_0x482c('0x3c')]){_0x47df5d['Tags']=[];_0x47df5d['TagIds'][_0x482c('0x3d')](',')['forEach'](function(_0x53ba0b){_0x47df5d['Tags']['push'](_0xb08f78[_0x53ba0b]);});}delete _0x47df5d[_0x482c('0x3c')];}catch(_0xdced0){_0x5942d2(_0xdced0);}_0x6778d5(_0x47df5d);});}function updateChatInteraction(_0x39b121,_0x2fbcec,_0x4eb326){return new BPromise(function(_0x5666e9,_0x24f3b5){return getInteractionUsers(_0x39b121,_0x4eb326)[_0x482c('0x21')](function(_0x45c8c2){return getInteractionTags(_0x45c8c2,_0x2fbcec);})[_0x482c('0x21')](function(_0x5eb2f5){_0x5666e9(_0x5eb2f5);})['catch'](function(_0xa41da0){_0x24f3b5(_0xa41da0);});});}exports[_0x482c('0x3e')]=function(_0x4e4d91,_0x2d5d53){var _0x26e7f9={},_0x7c3ed3={},_0x1a7257={'count':0x0,'rows':[]};var _0x2cea98=_[_0x482c('0x3f')](db[_0x482c('0x40')][_0x482c('0x41')],function(_0x489131){return{'name':_0x489131[_0x482c('0x42')],'type':_0x489131[_0x482c('0x43')][_0x482c('0x44')]};});_0x7c3ed3[_0x482c('0x45')]=_[_0x482c('0x3f')](_0x2cea98,_0x482c('0x39'));_0x7c3ed3[_0x482c('0x46')]=_['keys'](_0x4e4d91['query']);_0x7c3ed3[_0x482c('0x47')]=_[_0x482c('0x48')](_0x7c3ed3[_0x482c('0x45')],_0x7c3ed3['query']);_0x26e7f9[_0x482c('0x49')]=_['intersection'](_0x7c3ed3[_0x482c('0x45')],qs[_0x482c('0x4a')](_0x4e4d91[_0x482c('0x46')][_0x482c('0x4a')]));_0x26e7f9['attributes']=_0x26e7f9[_0x482c('0x49')][_0x482c('0x4b')]?_0x26e7f9[_0x482c('0x49')]:_0x7c3ed3['model'];if(!_0x4e4d91[_0x482c('0x46')][_0x482c('0x4c')](_0x482c('0x4d'))){_0x26e7f9['limit']=qs['limit'](_0x4e4d91['query']['limit']);_0x26e7f9['offset']=qs['offset'](_0x4e4d91[_0x482c('0x46')]['offset']);}_0x26e7f9[_0x482c('0x4e')]=qs[_0x482c('0x4f')](_0x4e4d91[_0x482c('0x46')][_0x482c('0x4f')]);_0x26e7f9[_0x482c('0x50')]=qs[_0x482c('0x47')](_[_0x482c('0x51')](_0x4e4d91[_0x482c('0x46')],_0x7c3ed3[_0x482c('0x47')]),_0x2cea98);var _0x35eac3=[];var _0x3a8ee6=squel[_0x482c('0x52')]()[_0x482c('0x53')]('id')[_0x482c('0x53')](_0x482c('0x39'))[_0x482c('0x53')](_0x482c('0x54'))[_0x482c('0x55')](_0x482c('0x56'));var _0x495aaa=squel[_0x482c('0x52')]()[_0x482c('0x53')]('u.id')[_0x482c('0x53')](_0x482c('0x57'))[_0x482c('0x53')](_0x482c('0x58'))[_0x482c('0x55')]('user_has_chat_interactions','ui')['left_join'](_0x482c('0x59'),'u',_0x482c('0x5a'));var _0x430a86=squel[_0x482c('0x52')]()[_0x482c('0x55')](_0x482c('0x5b'),'i')[_0x482c('0x5c')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x482c('0x59'),'o',_0x482c('0x5d'))[_0x482c('0x5c')](_0x482c('0x5e'),'a',_0x482c('0x5f'))[_0x482c('0x5c')](_0x482c('0x60'),'me',_0x482c('0x61'))[_0x482c('0x5c')](_0x482c('0x62'),'it',_0x482c('0x63'))['left_join'](_0x482c('0x56'),'t',_0x482c('0x64'));var _0x1fe26e=squel[_0x482c('0x65')]();var _0x1b3a15=[];var _0x663340=squel[_0x482c('0x65')]();var _0x273bf2;if(_0x4e4d91[_0x482c('0x46')][_0x482c('0x66')]){_0x273bf2=as[_0x482c('0x67')](_0x4e4d91[_0x482c('0x46')]['search']);var _0x5f579a=_0x273bf2[_0x482c('0x68')];for(var _0xe52d69=0x0;_0xe52d69<_0x273bf2[_0x482c('0x69')][_0x482c('0x4b')];_0xe52d69++){var _0xa5ffff=_0x273bf2[_0x482c('0x69')][_0xe52d69];var _0x5382b0='i';var _0x231353=_[_0x482c('0x6a')](_0x2cea98,[_0x482c('0x39'),_0xa5ffff[_0x482c('0x53')]]);if(!_0x231353){switch(_0xa5ffff[_0x482c('0x53')]){case _0x482c('0x6b'):if(_0xa5ffff[_0x482c('0x6c')]==0x1){_0x430a86[_0x482c('0x6d')]('`'+_0xa5ffff[_0x482c('0x53')]+_0x482c('0x6e'));}else{_0x430a86[_0x482c('0x6d')]('`'+_0xa5ffff[_0x482c('0x53')]+'`\x20>\x200');}break;case _0x482c('0x6f'):if(_0xa5ffff['operator']===_0x482c('0x70')){if(_0xa5ffff[_0x482c('0x6c')][_0x482c('0x3d')]('\x20')[_0x482c('0x4b')]>0x1){_0x1fe26e[_0x5f579a](_0x482c('0x71'),qs[_0x482c('0x72')](_0xa5ffff['value']),null);}else{var _0x3e0579='%'+_0xa5ffff[_0x482c('0x6c')]+'%';_0x1fe26e[_0x5f579a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3e0579,_0x3e0579,_0x3e0579);}}else{_0x231353=_['find'](_0x2cea98,[_0x482c('0x39'),_0x482c('0x73')]);_0xa5ffff['field']=_0x482c('0x73');_0x2333da=as[_0x482c('0x74')](_0x5382b0,_0x231353[_0x482c('0x43')],_0xa5ffff);_0x1fe26e[_0x5f579a](_0x2333da[_0x482c('0x75')],_0x2333da['value'][_0x482c('0x76')],_0x2333da[_0x482c('0x6c')][_0x482c('0x2c')]);}break;case _0x482c('0x77'):var _0x3a37f5=_0xa5ffff[_0x482c('0x6c')]['split'](',')['map'](function(_0x2cace1){return Number(_0x2cace1);});_0x3a37f5[_0x482c('0x78')](function(_0x46c199){_0x663340['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x46c199+',%');});_0x1b3a15=_[_0x482c('0x79')](_0x1b3a15,_0x3a37f5);break;case _0x482c('0x7a'):if(_0xa5ffff[_0x482c('0x7b')]===_0x482c('0x70')){_0x1fe26e[_0x5f579a](_0x482c('0x7c'),'%'+_0xa5ffff[_0x482c('0x6c')]+'%',null);}else{_0x231353=_[_0x482c('0x6a')](_0x2cea98,[_0x482c('0x39'),_0x482c('0x7d')]);_0xa5ffff['field']='UserId';_0x2333da=as[_0x482c('0x74')](_0x5382b0,_0x231353[_0x482c('0x43')],_0xa5ffff);_0x1fe26e[_0x5f579a](_0x2333da['text'],_0x2333da['value'][_0x482c('0x76')],_0x2333da[_0x482c('0x6c')][_0x482c('0x2c')]);}break;case'body':_0x2333da=as['buildExpression']('me',null,_0xa5ffff);_0x1fe26e[_0x5f579a](_0x2333da['text'],_0x2333da[_0x482c('0x6c')][_0x482c('0x76')],_0x2333da[_0x482c('0x6c')][_0x482c('0x2c')]);break;}}else{var _0x2333da=as[_0x482c('0x74')](_0x5382b0,_0x231353['type'],_0xa5ffff);_0x1fe26e[_0x5f579a](_0x2333da['text'],_0x2333da[_0x482c('0x6c')][_0x482c('0x76')],_0x2333da[_0x482c('0x6c')][_0x482c('0x2c')]);}}}else{var _0x452789=_(_0x4e4d91[_0x482c('0x46')])[_0x482c('0x7e')]()[_0x482c('0x3f')](function(_0x1c771f){return _[_0x482c('0x7f')](_0x2cea98,[_0x482c('0x39'),_0x1c771f])?_0x1c771f:undefined;})[_0x482c('0x80')]()['value']();if(!_[_0x482c('0x81')](_0x452789)){_0x452789[_0x482c('0x78')](function(_0x2d5ca0){if(_0x2d5ca0==='ChatWebsiteId'){_0x430a86[_0x482c('0x50')](_0x482c('0x82'),[][_0x482c('0x83')](_0x4e4d91['query'][_0x2d5ca0]));}else if(_0x2d5ca0===_0x482c('0x84')){var _0x536f20=JSON['parse'](_0x4e4d91[_0x482c('0x46')][_0x2d5ca0])[_0x482c('0x85')];var _0x383254=JSON[_0x482c('0x86')](_0x4e4d91[_0x482c('0x46')][_0x2d5ca0])[_0x482c('0x87')];_0x430a86[_0x482c('0x50')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x536f20,_0x383254);}else{if(_0x4e4d91[_0x482c('0x46')][_0x2d5ca0]===_0x482c('0x88')){_0x430a86['where']('i.'+_0x2d5ca0+_0x482c('0x89'));}else{_0x430a86['where']('i.'+_0x2d5ca0+'\x20=\x20?',_0x4e4d91['query'][_0x2d5ca0]);}}});}if(_0x4e4d91[_0x482c('0x46')]['read']){if(_0x4e4d91['query'][_0x482c('0x8a')]==0x1){_0x430a86[_0x482c('0x6d')]('`unreadMessages`\x20=\x200');}else{_0x430a86[_0x482c('0x6d')]('`unreadMessages`\x20>\x200');}}if(_0x4e4d91['query']['tag']){_0x1b3a15=_[_0x482c('0x8b')](_0x4e4d91[_0x482c('0x46')]['tag'])?_0x4e4d91['query']['tag']:new Array(_0x4e4d91[_0x482c('0x46')][_0x482c('0x8c')]);_0x1b3a15[_0x482c('0x78')](function(_0x58eebf){_0x663340['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58eebf+',%');});}if(_0x4e4d91[_0x482c('0x46')]['filter']){var _0x46288f=_0x4e4d91[_0x482c('0x46')]['filter'][_0x482c('0x8d')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x46288f)){_0x1fe26e['or'](_0x482c('0x8e'),_0x46288f+'%');}else{_0x1fe26e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x482c('0x72')](_0x46288f))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x46288f+'%');}}}_0x430a86[_0x482c('0x50')](_0x1fe26e);_0x430a86['group'](_0x482c('0x8f'));var _0x14b6ba={'type':db[_0x482c('0x90')]['QueryTypes'][_0x482c('0x91')],'raw':!![]};var _0x36fc52=_0x430a86[_0x482c('0x92')]();_0x36fc52['field'](_0x482c('0x8f'));_0x36fc52[_0x482c('0x53')](_0x482c('0x93'),_0x482c('0x6b'));if(_0x26e7f9[_0x482c('0x4e')]){_0x26e7f9[_0x482c('0x4e')][_0x482c('0x78')](function(_0x51f549){var _0x21b701=_0x51f549[0x0]===_0x482c('0x94')?_0x51f549[0x0]:'i.'+_0x51f549[0x0];_0x430a86[_0x482c('0x4e')](_0x21b701,_0x51f549[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x1b3a15)){_0x430a86['having'](_0x663340);_0x36fc52[_0x482c('0x50')]('t.id\x20IN\x20?',_0x1b3a15);}BPromise['resolve']()[_0x482c('0x21')](function(){if(!_0x273bf2){if(_0x4e4d91['query'][_0x482c('0x95')])return;_0x36fc52[_0x482c('0x50')](_0x482c('0x96'));_0x430a86[_0x482c('0x50')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x4e4d91[_0x482c('0x97')]['role']!==_0x482c('0x98'))return;return _0x4e4d91[_0x482c('0x97')][_0x482c('0x99')]({'attributes':['id'],'raw':!![]})['then'](function(_0x590d97){if(_[_0x482c('0x81')](_0x590d97)){_0x36fc52[_0x482c('0x50')]('i.ChatWebsiteId\x20IS\x20NULL');_0x430a86[_0x482c('0x50')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x36fc52[_0x482c('0x50')](_0x482c('0x82'),_[_0x482c('0x3f')](_0x590d97,'id'));_0x430a86['where'](_0x482c('0x82'),_[_0x482c('0x3f')](_0x590d97,'id'));}});})[_0x482c('0x21')](function(){if(_0x4e4d91['user'][_0x482c('0x9a')]===_0x482c('0x98')&&!_0x273bf2&&!_0x4e4d91[_0x482c('0x46')]['ChatWebsiteId'])return[];return db['sequelize'][_0x482c('0x46')](_0x36fc52[_0x482c('0x9b')](),_0x14b6ba);})[_0x482c('0x21')](function(_0x4903f1){_0x1a7257[_0x482c('0x2d')]=_0x4903f1[_0x482c('0x4b')];if(_0x1a7257['count']===0x0)return[];return db[_0x482c('0x9c')]['query'](_0x3a8ee6[_0x482c('0x9b')](),_0x14b6ba)[_0x482c('0x21')](function(_0x3cfe7f){_0x35eac3=_[_0x482c('0x9d')](_0x3cfe7f,'id');_0x14b6ba=_[_0x482c('0x9e')](_0x14b6ba,{'model':db[_0x482c('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4e4d91['query']['fields']){_0x26e7f9[_0x482c('0x49')][_0x482c('0x78')](function(_0x2156af){_0x430a86[_0x482c('0x53')]('i.'+_0x2156af);});}else{_0x430a86[_0x482c('0x53')](_0x482c('0x93'),_0x482c('0x6b'));_0x430a86['field'](_0x482c('0x9f'),_0x482c('0xa0'));_0x430a86[_0x482c('0x53')]('a.mandatoryDisposition',_0x482c('0xa1'));_0x430a86[_0x482c('0x53')](_0x482c('0xa2'),_0x482c('0x94'));_0x430a86[_0x482c('0x53')](_0x482c('0xa3'));_0x430a86[_0x482c('0x53')]('c.firstName',_0x482c('0xa4'));_0x430a86[_0x482c('0x53')](_0x482c('0xa5'),'Contact.lastName');_0x430a86[_0x482c('0x53')]('c.email',_0x482c('0xa6'));_0x430a86[_0x482c('0x53')](_0x482c('0xa7'),_0x482c('0xa8'));_0x430a86['field'](_0x482c('0xa9'),_0x482c('0xaa'));_0x430a86[_0x482c('0x53')](_0x482c('0xab'),'Contact.fax');_0x430a86[_0x482c('0x53')](_0x482c('0xac'),_0x482c('0xad'));_0x430a86[_0x482c('0x53')](_0x482c('0xae'),'Owner.internal');_0x430a86[_0x482c('0x53')](_0x482c('0xaf'),_0x482c('0x3c'));}if(_0x26e7f9[_0x482c('0x2f')])_0x430a86[_0x482c('0x2f')](_0x26e7f9['limit']);if(_0x26e7f9[_0x482c('0x2e')])_0x430a86[_0x482c('0x2e')](_0x26e7f9[_0x482c('0x2e')]);return db['sequelize'][_0x482c('0x46')](_0x430a86[_0x482c('0x9b')](),_0x14b6ba);})[_0x482c('0x21')](function(_0x1621cb){_0x495aaa['where'](_0x482c('0xb0'),_[_0x482c('0x3f')](_0x1621cb,'id'));return db[_0x482c('0x9c')]['query'](_0x495aaa[_0x482c('0x9b')](),_0x14b6ba)[_0x482c('0x21')](function(_0x27101a){var _0x3d40ba=_['groupBy'](_0x27101a,'ChatInteractionId');var _0x47e0f6=[];_0x1621cb[_0x482c('0x78')](function(_0x21fe3a){_0x47e0f6[_0x482c('0xb1')](updateChatInteraction(_0x21fe3a,_0x35eac3,_0x3d40ba));});return BPromise[_0x482c('0xb2')](_0x47e0f6);});});})[_0x482c('0x21')](function(_0x35377e){_0x1a7257[_0x482c('0xb3')]=_0x35377e;return _0x1a7257;})['then'](respondWithFilteredResult(_0x2d5d53,_0x26e7f9))['catch'](handleError(_0x2d5d53,null));};exports['show']=function(_0xf19f95,_0x3008de){var _0x2d2662={'raw':![],'where':{'id':_0xf19f95[_0x482c('0xb4')]['id']}},_0x4134a2={};_0x4134a2[_0x482c('0x45')]=_[_0x482c('0x7e')](db[_0x482c('0x40')][_0x482c('0x41')]);_0x4134a2['query']=_[_0x482c('0x7e')](_0xf19f95[_0x482c('0x46')]);_0x4134a2[_0x482c('0x47')]=_[_0x482c('0x48')](_0x4134a2[_0x482c('0x45')],_0x4134a2[_0x482c('0x46')]);_0x2d2662[_0x482c('0x49')]=_['intersection'](_0x4134a2['model'],qs['fields'](_0xf19f95[_0x482c('0x46')]['fields']));_0x2d2662[_0x482c('0x49')]=_0x2d2662[_0x482c('0x49')]['length']?_0x2d2662[_0x482c('0x49')]:_0x4134a2[_0x482c('0x45')];if(_0xf19f95[_0x482c('0x46')][_0x482c('0xb5')]){_0x2d2662['include']=[{'all':!![]}];}_0x2d2662=_[_0x482c('0x9e')]({},_0x2d2662,_0xf19f95[_0x482c('0xb6')]);return db[_0x482c('0x40')]['find'](_0x2d2662)[_0x482c('0x21')](handleEntityNotFound(_0x3008de,null))[_0x482c('0x21')](respondWithResult(_0x3008de,null))[_0x482c('0xb7')](handleError(_0x3008de,null));};exports[_0x482c('0xb8')]=function(_0x28a24e,_0x47da5e){return db[_0x482c('0x40')][_0x482c('0xb8')](_0x28a24e['body'],{})['then'](respondWithResult(_0x47da5e,0xc9))['catch'](handleError(_0x47da5e,null));};exports['update']=function(_0x43a889,_0x5031db){if(_0x43a889[_0x482c('0xb9')]['id']){delete _0x43a889[_0x482c('0xb9')]['id'];}return db[_0x482c('0x40')][_0x482c('0x6a')]({'where':{'id':_0x43a889[_0x482c('0xb4')]['id']}})[_0x482c('0x21')](handleEntityNotFound(_0x5031db,null))[_0x482c('0x21')](saveUpdates(_0x43a889[_0x482c('0xb9')],null))[_0x482c('0x21')](respondWithResult(_0x5031db,null))[_0x482c('0xb7')](handleError(_0x5031db,null));};exports[_0x482c('0x37')]=function(_0x2f84b3,_0x1e1f6e){return db[_0x482c('0x40')][_0x482c('0x6a')]({'where':{'id':_0x2f84b3[_0x482c('0xb4')]['id']}})[_0x482c('0x21')](handleEntityNotFound(_0x1e1f6e,null))['then'](removeEntity(_0x1e1f6e,null))['catch'](handleError(_0x1e1f6e,null));};exports[_0x482c('0xba')]=function(_0x1635ee,_0x1638e4){return db[_0x482c('0x40')][_0x482c('0xba')]()[_0x482c('0x21')](respondWithResult(_0x1638e4,null))[_0x482c('0xb7')](handleError(_0x1638e4,null));};exports[_0x482c('0xbb')]=function(_0x5128a6,_0x5dffbc){var _0x3d832f=_0x5128a6['params']['id'];var _0x29fa5b;var _0x428309;var _0x1c4e1c;return db[_0x482c('0x40')][_0x482c('0xbc')]({'where':{'id':_0x3d832f}})[_0x482c('0x21')](function(_0x94d080){_0x29fa5b=_0x94d080;return db['ChatWebsite'][_0x482c('0xbc')]({'where':{'id':_0x94d080[_0x482c('0x95')]},'attributes':['id',_0x482c('0xbd'),_0x482c('0xbe')],'raw':!![]});})[_0x482c('0x21')](function(_0x5cb288){if(_0x5cb288&&_0x5cb288[_0x482c('0xbd')]&&_0x5cb288[_0x482c('0xbe')]){_0x428309=_0x5cb288;var _0xcc13e5={'rejectUnauthorized':![],'method':'POST','uri':_0x482c('0xbf'),'headers':{'X-APIKEY':_0x5cb288[_0x482c('0xbd')]},'body':{'name':_0x482c('0xc0')+_0x3d832f},'redirect':_0x482c('0xc1'),'json':!![]};return rp(_0xcc13e5);}else{throw new db[(_0x482c('0x90'))]['ValidationError'](_0x482c('0xc2'));}})[_0x482c('0x21')](function(_0x4e7fd5){_0x1c4e1c=_0x4e7fd5;if(_0x1c4e1c['id']){var _0x5d0bd9={'body':_0x1c4e1c['join_url'],'ChatWebsiteId':_0x428309['id'],'ChatInteractionId':_0x29fa5b['id'],'direction':'out','UserId':_0x5128a6[_0x482c('0x97')]['id']};return db[_0x482c('0xc3')][_0x482c('0xb8')](_0x5d0bd9,{});}else{throw new db[(_0x482c('0x90'))][(_0x482c('0xc4'))](_0x482c('0xc5'));}})['then'](function(){return _0x29fa5b[_0x482c('0xc6')]({'vidaooSessionId':_0x1c4e1c['id']});})[_0x482c('0x21')](respondWithResult(_0x5dffbc,null))['catch'](handleError(_0x5dffbc,null));};exports[_0x482c('0xc7')]=function(_0x459d23,_0x3af04f){if(_0x459d23[_0x482c('0xb9')]['id']){delete _0x459d23['body']['id'];}return db[_0x482c('0x40')]['find']({'where':{'id':_0x459d23[_0x482c('0xb4')]['id']},'include':[{'model':db[_0x482c('0xc8')],'as':_0x482c('0x6f')}]})['then'](handleEntityNotFound(_0x3af04f,null))[_0x482c('0x21')](saveUpdates(_0x459d23[_0x482c('0xb9')],null))['then'](respondWithResult(_0x3af04f,null))[_0x482c('0xb7')](handleError(_0x3af04f,null));};exports[_0x482c('0xc9')]=function(_0x58f343,_0xa1aa34,_0x29f83b){if(_0x58f343[_0x482c('0xb9')]['id']){delete _0x58f343[_0x482c('0xb9')]['id'];}return db['ChatInteraction'][_0x482c('0x6a')]({'where':{'id':_0x58f343['params']['id']}})[_0x482c('0x21')](function(_0x19883d){if(!_0x19883d){logger[_0x482c('0x25')](_0x482c('0xca'),_0x482c('0xc9'),0x194,'entity\x20not\x20found');_0xa1aa34['sendStatus'](0x194);}else{if(_0x19883d[_0x482c('0x7d')]){throw new db[(_0x482c('0x90'))]['ValidationError'](_0x482c('0xcb'));}}return _0x19883d;})[_0x482c('0x21')](function(_0x5b6932){if(_0x5b6932){return _0x5b6932['update']({'closed':_0x58f343[_0x482c('0xb9')]['closed'],'disposition':_0x58f343[_0x482c('0xb9')][_0x482c('0xcc')]})[_0x482c('0x21')](function(_0x739186){return _0x739186;});}})[_0x482c('0x21')](function(_0x2a2b67){return respondWithRpcPromise(_0x482c('0xcd'),_0x482c('0xc9'),_0x58f343[_0x482c('0xb9')],client9004);})['then'](respondWithResult(_0xa1aa34,null))[_0x482c('0xb7')](handleError(_0xa1aa34,null));};exports['attachmentUpload']=function(_0x5a8f78,_0x41927a,_0x1a26ac){_0x5a8f78['body'][_0x482c('0x39')]=_0x5a8f78[_0x482c('0xce')][_0x482c('0xcf')];_0x5a8f78['body'][_0x482c('0xd0')]=_0x5a8f78[_0x482c('0xce')]['filename'];_0x5a8f78['body'][_0x482c('0x43')]=_0x5a8f78[_0x482c('0xce')]['mimetype'];return db['Attachment'][_0x482c('0xb8')](_0x5a8f78['body'])['then'](respondWithResult(_0x41927a,0xc9))[_0x482c('0xb7')](handleError(_0x41927a,null));};exports[_0x482c('0xd1')]=function(_0x222ef8,_0x36ab42,_0x5d607c){return db[_0x482c('0x40')]['findOne']({'where':{'id':_0x222ef8[_0x482c('0xb4')]['id']},'raw':!![]})[_0x482c('0x21')](handleEntityNotFound(_0x36ab42,null))[_0x482c('0x21')](function(_0x3465f1){if(_0x3465f1){if(_0x3465f1['closed']){return _0x36ab42[_0x482c('0x30')](0x193)['json']({'status':0x193,'message':_0x482c('0xd2')});}return db[_0x482c('0xd3')][_0x482c('0xbc')]({'where':{'id':_0x222ef8['query'][_0x482c('0xd4')]},'raw':!![]})[_0x482c('0x21')](handleEntityNotFound(_0x36ab42,null));}})[_0x482c('0x21')](function(_0x28bfcf){if(_0x28bfcf){var _0x2765f8=_0x28bfcf['ChatOfflineMessageId']!==null;var _0x1296e6=path[_0x482c('0xd5')](config[_0x482c('0xd6')],'server/files/attachments/');if(_0x2765f8){_0x1296e6=path['join'](_0x1296e6,'offline-chat/');}var _0xbca91c=path[_0x482c('0xd5')](_0x1296e6,_0x28bfcf['basename']);return _0x36ab42['download'](_0xbca91c);}})[_0x482c('0xb7')](handleError(_0x36ab42,null));};exports[_0x482c('0xd7')]=function(_0x2b0593,_0x1e5538){var _0x1f1096=null;var _0x2cdc07=null;var _0x48e680=null;var _0x557d88=null;if(_0x2b0593[_0x482c('0xb9')]['id']){delete _0x2b0593[_0x482c('0xb9')]['id'];}if(_0x2b0593['body']['mailTranscript']){_0x557d88=path['join'](config['root'],_0x482c('0xd8'),util['format'](_0x482c('0xd9'),Date[_0x482c('0xda')]()));_0x2b0593[_0x482c('0xb9')][_0x482c('0xdb')]=_0x557d88;}return db[_0x482c('0x40')]['find']({'where':{'id':_0x2b0593['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db['User'],'as':'User'}]}]})[_0x482c('0x21')](handleEntityNotFound(_0x1e5538,null))['then'](saveUpdates(_0x2b0593[_0x482c('0xb9')],null))[_0x482c('0x21')](function(_0x3801bc){if(_0x3801bc){_0x1f1096=_0x3801bc;return db[_0x482c('0xdc')]['find']({'where':{'id':_0x1f1096[_0x482c('0x95')]}});}})[_0x482c('0x21')](function(_0x3accee){if(_0x3accee){_0x48e680=_0x3accee;return db[_0x482c('0xc8')][_0x482c('0x6a')]({'where':{'id':_0x1f1096['ContactId']}});}})[_0x482c('0x21')](function(_0x5bdd27){if(_0x5bdd27){_0x2cdc07=_0x5bdd27;if(_0x557d88){var _0x4cc1b0=null;for(var _0x4f7be8=0x1;_0x4f7be8<_0x1f1096[_0x482c('0xdd')][_0x482c('0x4b')];++_0x4f7be8){_0x4cc1b0=_0x1f1096[_0x482c('0xdd')][_0x4f7be8];var _0x29fce8=_0x4cc1b0['UserId']?util['format']('%s%d',_0x48e680[_0x482c('0xde')],_0x4cc1b0[_0x482c('0x7d')]):_0x482c('0xdf');var _0x39c77a=_0x2b0593[_0x482c('0xb9')][_0x482c('0xe0')]||util[_0x482c('0xe1')]('%s%d',_0x482c('0xe2'),_0x4cc1b0['ContactId']);switch(_0x48e680[_0x482c('0xe3')]){case _0x482c('0xe4'):_0x29fce8=_0x4cc1b0[_0x482c('0x7d')]?util[_0x482c('0xe1')](_0x482c('0xe5'),_0x48e680[_0x482c('0xde')],_0x4cc1b0[_0x482c('0x7d')]):_0x482c('0xdf');break;case'agent_alias':_0x29fce8=_0x4cc1b0['UserId']?_0x4cc1b0[_0x482c('0x7a')][_0x482c('0xe6')]||_0x4cc1b0[_0x482c('0x7a')][_0x482c('0xe7')]:_0x482c('0xdf');break;case _0x482c('0xe8'):_0x29fce8=_0x4cc1b0[_0x482c('0x7d')]?_0x4cc1b0[_0x482c('0x7a')][_0x482c('0xe7')]:_0x482c('0xdf');break;default:_0x29fce8=_0x4cc1b0['UserId']?util[_0x482c('0xe1')](_0x482c('0xe5'),_0x48e680[_0x482c('0xde')],_0x4cc1b0[_0x482c('0x7d')]):_0x482c('0xdf');}var _0x36954b=util[_0x482c('0xe1')](_0x482c('0xe9'),moment(_0x4cc1b0[_0x482c('0x84')])['format'](_0x482c('0xea')),_0x4cc1b0[_0x482c('0xeb')]==='in'?_0x39c77a:_0x29fce8,_0x4cc1b0[_0x482c('0xb9')]);if(!_0x4cc1b0[_0x482c('0xec')]){fs[_0x482c('0xed')](_0x557d88,_0x36954b);}}return db['MailAccount'][_0x482c('0xbc')]({'where':{'service':!![]},'include':[{'model':db[_0x482c('0xee')],'as':_0x482c('0xef'),'raw':!![]}]});}}})[_0x482c('0x21')](function(_0x22736f){if(_0x22736f&&_0x22736f[_0x482c('0xef')]&&_0x2b0593[_0x482c('0xb9')]){var _0x529a65={'tls':{'rejectUnauthorized':![]}};if(_0x22736f[_0x482c('0xef')][_0x482c('0xf0')]){_0x529a65[_0x482c('0xf0')]=_0x22736f['Smtp'][_0x482c('0xf0')];}else{_0x529a65[_0x482c('0xf1')]=_0x22736f[_0x482c('0xef')][_0x482c('0xf1')];_0x529a65[_0x482c('0xf2')]=_0x22736f['Smtp'][_0x482c('0xf2')];_0x529a65[_0x482c('0xf3')]=_0x22736f[_0x482c('0xef')][_0x482c('0xf3')];}if(_0x22736f[_0x482c('0xef')][_0x482c('0xf4')]){_0x529a65[_0x482c('0xf5')]={'user':_0x22736f[_0x482c('0xef')]['user'],'pass':_0x22736f[_0x482c('0xef')][_0x482c('0xf6')]};}return respondWithRpcPromise(_0x482c('0xf7'),_0x482c('0xf8'),{'account':_0x529a65,'message':{'from':util[_0x482c('0xe1')](_0x482c('0xf9'),_0x22736f[_0x482c('0x39')],_0x22736f['email']||_0x22736f[_0x482c('0xef')][_0x482c('0x97')]),'to':_0x2b0593[_0x482c('0xb9')][_0x482c('0xfa')],'subject':_0x482c('0xfb'),'text':util[_0x482c('0xe1')](_0x482c('0xfc'),_0x2b0593['body'][_0x482c('0xfa')]),'attachments':[{'path':_0x557d88}]}})[_0x482c('0x21')](function(){return _0x1f1096;})[_0x482c('0xb7')](function(_0x2229bc){console[_0x482c('0x25')](_0x2229bc);});}else{return _0x1f1096;}})[_0x482c('0x21')](respondWithStatusCode(_0x1e5538,0xc8))[_0x482c('0xb7')](handleError(_0x1e5538,null));};exports[_0x482c('0xfd')]=function(_0x26cf4a,_0x382d14,_0x151c83){return db[_0x482c('0xc3')][_0x482c('0x6a')]({'where':{'id':_0x26cf4a['params']['id']}})[_0x482c('0x21')](handleEntityNotFound(_0x382d14,null))[_0x482c('0x21')](function(_0x2cb7ee){if(_0x2cb7ee){return _0x2cb7ee['addMessage'](_0x26cf4a['body'][_0x482c('0xfe')],_[_0x482c('0xff')](_0x26cf4a[_0x482c('0xb9')],[_0x482c('0xfe'),'id'])||{});}})['then'](respondWithResult(_0x382d14,null))['catch'](handleError(_0x382d14,null));};exports[_0x482c('0x100')]=function(_0x5b4b90,_0x34a3b1,_0x1ecf1f){var _0x192157={'raw':![],'where':{}};var _0x3081e1={};var _0x2c910f={'count':0x0,'rows':[]};return db[_0x482c('0x40')]['findOne']({'where':{'id':_0x5b4b90['params']['id']}})[_0x482c('0x21')](handleEntityNotFound(_0x34a3b1,null))[_0x482c('0x21')](function(_0x53ffa1){if(_0x53ffa1){_0x3081e1[_0x482c('0x45')]=_[_0x482c('0x7e')](db[_0x482c('0xc3')][_0x482c('0x41')]);_0x3081e1['query']=_[_0x482c('0x7e')](_0x5b4b90[_0x482c('0x46')]);_0x3081e1[_0x482c('0x47')]=_[_0x482c('0x48')](_0x3081e1['model'],_0x3081e1[_0x482c('0x46')]);_0x192157[_0x482c('0x49')]=_[_0x482c('0x48')](_0x3081e1[_0x482c('0x45')],qs[_0x482c('0x4a')](_0x5b4b90[_0x482c('0x46')][_0x482c('0x4a')]));_0x192157[_0x482c('0x49')]=_0x192157['attributes'][_0x482c('0x4b')]?_0x192157[_0x482c('0x49')]:_0x3081e1['model'];if(!_0x5b4b90[_0x482c('0x46')][_0x482c('0x4c')](_0x482c('0x4d'))){_0x192157[_0x482c('0x2f')]=qs['limit'](_0x5b4b90[_0x482c('0x46')][_0x482c('0x2f')]);_0x192157[_0x482c('0x2e')]=qs[_0x482c('0x2e')](_0x5b4b90[_0x482c('0x46')][_0x482c('0x2e')]);}_0x192157[_0x482c('0x4e')]=qs[_0x482c('0x4f')](_0x5b4b90[_0x482c('0x46')]['sort']);_0x192157[_0x482c('0x50')]=qs[_0x482c('0x47')](_[_0x482c('0x51')](_0x5b4b90['query'],_0x3081e1[_0x482c('0x47')]));_0x192157[_0x482c('0x50')]['ChatInteractionId']=_0x53ffa1['id'];if(_0x5b4b90[_0x482c('0x46')]['filter']){_0x192157['where']=_[_0x482c('0x9e')](_0x192157[_0x482c('0x50')],{'$or':_['map'](_0x192157[_0x482c('0x49')],function(_0x17f5a6){var _0x54204b={};_0x54204b[_0x17f5a6]={'$like':'%'+_0x5b4b90[_0x482c('0x46')][_0x482c('0x101')]+'%'};return _0x54204b;})});}if(_0x5b4b90[_0x482c('0x46')]['$gte']){var _0x39a4e9=_0x5b4b90['query'][_0x482c('0x85')]['split'](',');var _0x42ef05={};_0x42ef05[_0x39a4e9[0x0]]={'$gte':moment(_0x39a4e9[0x1])[_0x482c('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x192157[_0x482c('0x50')]=_['merge'](_0x192157[_0x482c('0x50')],_0x42ef05);}_0x192157=_[_0x482c('0x9e')]({},_0x192157,_0x5b4b90[_0x482c('0xb6')]);return db['ChatMessage'][_0x482c('0x2d')]({'where':_0x192157[_0x482c('0x50')]})[_0x482c('0x21')](function(_0x4762d8){_0x2c910f[_0x482c('0x2d')]=_0x4762d8;if(_0x5b4b90[_0x482c('0x46')]['includeAll']){_0x192157[_0x482c('0x102')]=[{'all':!![]}];}return db[_0x482c('0xc3')][_0x482c('0x103')](_0x192157);})[_0x482c('0x21')](function(_0x453bf8){_0x2c910f[_0x482c('0xb3')]=_0x453bf8;return _0x2c910f;});}})[_0x482c('0x21')](respondWithFilteredResult(_0x34a3b1,_0x192157))[_0x482c('0xb7')](handleError(_0x34a3b1,null));};exports['getMyMessages']=function(_0x40936b,_0x5b77ad,_0x19edf8){var _0x4c5a2a={'where':{}},_0x1b6f96={},_0x2e955d={'count':0x0,'rows':[]};return db[_0x482c('0x40')][_0x482c('0xbc')]({'where':{'id':_0x40936b['params']['id']}})['then'](handleEntityNotFound(_0x5b77ad,null))['then'](function(_0x581ed9){if(_0x581ed9){_0x1b6f96[_0x482c('0x45')]=_[_0x482c('0x7e')](db[_0x482c('0xc3')][_0x482c('0x41')]);_0x1b6f96[_0x482c('0x46')]=_['keys'](_0x40936b[_0x482c('0x46')]);_0x1b6f96[_0x482c('0x47')]=_[_0x482c('0x48')](_0x1b6f96[_0x482c('0x45')],_0x1b6f96[_0x482c('0x46')]);_0x4c5a2a['attributes']=_[_0x482c('0x48')](_0x1b6f96[_0x482c('0x45')],qs[_0x482c('0x4a')](_0x40936b[_0x482c('0x46')][_0x482c('0x4a')]));_0x4c5a2a[_0x482c('0x49')]=_0x4c5a2a[_0x482c('0x49')][_0x482c('0x4b')]?_0x4c5a2a[_0x482c('0x49')]:_0x1b6f96[_0x482c('0x45')];if(!_0x40936b[_0x482c('0x46')]['hasOwnProperty'](_0x482c('0x4d'))){_0x4c5a2a[_0x482c('0x2f')]=qs[_0x482c('0x2f')](_0x40936b[_0x482c('0x46')][_0x482c('0x2f')]);_0x4c5a2a[_0x482c('0x2e')]=qs[_0x482c('0x2e')](_0x40936b['query']['offset']);}_0x4c5a2a[_0x482c('0x4e')]=qs['sort'](_0x40936b[_0x482c('0x46')][_0x482c('0x4f')]);_0x4c5a2a['where']=qs[_0x482c('0x47')](_[_0x482c('0x51')](_0x40936b['query'],_0x1b6f96[_0x482c('0x47')]));_0x4c5a2a[_0x482c('0x50')][_0x482c('0x104')]=_0x581ed9['id'];if(_0x40936b[_0x482c('0x46')][_0x482c('0x101')]){_0x4c5a2a[_0x482c('0x50')]=_[_0x482c('0x9e')](_0x4c5a2a['where'],{'$or':_[_0x482c('0x3f')](_0x4c5a2a['attributes'],function(_0x4dbac9){var _0x356e0d={};_0x356e0d[_0x4dbac9]={'$like':'%'+_0x40936b[_0x482c('0x46')][_0x482c('0x101')]+'%'};return _0x356e0d;})});}_0x4c5a2a[_0x482c('0x50')]['secret']=![];if(_0x40936b[_0x482c('0x46')]['id']){_0x4c5a2a['where']['id']={'$gt':_0x40936b['query']['id']};}_0x4c5a2a=_[_0x482c('0x9e')]({},_0x4c5a2a,_0x40936b[_0x482c('0xb6')]);return db[_0x482c('0xc3')][_0x482c('0x2d')]({'where':_0x4c5a2a[_0x482c('0x50')]})[_0x482c('0x21')](function(_0x2d548d){_0x2e955d[_0x482c('0x2d')]=_0x2d548d;_0x4c5a2a[_0x482c('0x102')]=[];if(_0x40936b['query'][_0x482c('0x105')]){_0x4c5a2a[_0x482c('0x102')]['push']({'model':db[_0x482c('0x7a')],'as':'User','attributes':['id',_0x482c('0xe7'),_0x482c('0xe6')]});}if(_0x40936b['query'][_0x482c('0xb5')]){_0x4c5a2a[_0x482c('0x102')]=[{'all':!![]}];}return db[_0x482c('0xc3')]['findAll'](_0x4c5a2a);})['then'](function(_0x404f87){_0x2e955d[_0x482c('0xb3')]=_0x404f87;return _0x2e955d;});}})[_0x482c('0x21')](respondWithFilteredResult(_0x5b77ad,_0x4c5a2a))[_0x482c('0xb7')](handleError(_0x5b77ad,null));};exports['addTags']=function(_0x180f0c,_0x55cce0,_0x2ad95d){return db[_0x482c('0x40')][_0x482c('0x6a')]({'where':{'id':_0x180f0c[_0x482c('0xb4')]['id']}})[_0x482c('0x21')](handleEntityNotFound(_0x55cce0,null))[_0x482c('0x21')](function(_0x30e747){if(_0x30e747){return _0x30e747[_0x482c('0x106')](_0x180f0c[_0x482c('0xb9')][_0x482c('0xfe')],_[_0x482c('0xff')](_0x180f0c[_0x482c('0xb9')],[_0x482c('0xfe'),'id'])||{})['spread'](function(){return db[_0x482c('0x77')][_0x482c('0x103')]({'attributes':['id',_0x482c('0x39'),'color'],'where':{'id':_0x180f0c[_0x482c('0xb9')][_0x482c('0xfe')]}});})[_0x482c('0x21')](function(_0x3c32fe){socket['emit'](_0x482c('0x107'),{'id':Number(_0x180f0c[_0x482c('0xb4')]['id']),'tags':_0x3c32fe||[]});return{'id':Number(_0x180f0c[_0x482c('0xb4')]['id']),'tags':_0x3c32fe||[]};});}})[_0x482c('0x21')](respondWithResult(_0x55cce0,null))['catch'](handleError(_0x55cce0,null));};exports[_0x482c('0x108')]=function(_0x2ef675,_0x4a6bc8,_0x17d784){return db[_0x482c('0x40')][_0x482c('0x6a')]({'where':{'id':_0x2ef675[_0x482c('0xb4')]['id']}})[_0x482c('0x21')](handleEntityNotFound(_0x4a6bc8,null))['then'](function(_0x471ae6){if(_0x471ae6){return _0x471ae6[_0x482c('0x108')](_0x2ef675[_0x482c('0x46')]['ids']);}})[_0x482c('0x21')](respondWithStatusCode(_0x4a6bc8,null))[_0x482c('0xb7')](handleError(_0x4a6bc8,null));};exports[_0x482c('0x109')]=function(_0x1b3c79,_0x37b380){var _0x5cd84d=moment()[_0x482c('0x10a')]()[_0x482c('0x9b')]();var _0x5da8dc=path[_0x482c('0xd5')](config[_0x482c('0xd6')],_0x482c('0x10b'),'files',_0x482c('0x10c'));var _0x4ddc55=path[_0x482c('0xd5')](config['root'],_0x482c('0x10b'),_0x482c('0x10d'),_0x482c('0x10e'));var _0x449d63=path['join'](_0x5da8dc,_0x5cd84d);var _0xf4358d=util[_0x482c('0xe1')](_0x482c('0x10f'),_0x1b3c79['params']['id'],_0x5cd84d);var _0x2a92ad=path[_0x482c('0xd5')](_0x5da8dc,_0xf4358d);var _0x16ce4b=[];_0x16ce4b[_0x482c('0xb1')]({'model':db[_0x482c('0x7a')],'as':_0x482c('0x7a'),'attributes':['id','fullname'],'raw':!![]});_0x16ce4b[_0x482c('0xb1')]({'model':db[_0x482c('0xc8')],'as':_0x482c('0x6f'),'attributes':['id',_0x482c('0x110'),'lastName'],'raw':!![]});if(_0x1b3c79['query']['attachments']){_0x16ce4b['push']({'model':db[_0x482c('0xd3')],'as':'Attachment','raw':!![]});}var _0xa48d3a=[{'model':db[_0x482c('0xc3')],'as':_0x482c('0xdd'),'attributes':['id',_0x482c('0xb9'),'createdAt','direction','secret','read'],'include':_0x16ce4b}];_0xa48d3a[_0x482c('0xb1')]({'model':db[_0x482c('0xdc')],'as':'Account','attributes':['id',_0x482c('0x39')]});_0xa48d3a[_0x482c('0xb1')]({'model':db['User'],'as':_0x482c('0x111'),'attributes':['id',_0x482c('0xe7')]});return db[_0x482c('0x40')]['find']({'where':{'id':_0x1b3c79[_0x482c('0xb4')]['id']},'include':_0xa48d3a})['then'](handleEntityNotFound(_0x37b380,null))['then'](function(_0x11b971){if(_0x11b971){var _0x63381a=_0x11b971['get']({'plain':!![]});fs[_0x482c('0x112')](_0x449d63);var _0x3fd051={'format':'A4','border':_0x482c('0x113'),'header':{'height':_0x482c('0x114'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0x482c('0x115'),'contents':{'default':util[_0x482c('0xe1')](_0x482c('0x116'),util[_0x482c('0xe1')](_0x482c('0x117'),_0x482c('0x118'),_0x63381a['id']),moment()[_0x482c('0xe1')](_0x482c('0x119'))[_0x482c('0x9b')]())}}};var _0x27923b={'channel':'Chat','account':_0x63381a[_0x482c('0x11a')][_0x482c('0x39')],'agent':_0x63381a[_0x482c('0x111')]?_0x63381a['Owner'][_0x482c('0xe7')]:_0x482c('0x11b'),'createdAt':moment(_0x63381a[_0x482c('0x84')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x482c('0x9b')](),'closedAt':_0x63381a[_0x482c('0x11c')]?moment(_0x63381a[_0x482c('0x11d')])[_0x482c('0xe1')](_0x482c('0x11e'))[_0x482c('0x9b')]():'','disposition':_0x63381a['disposition'],'chatInfo':{'browser':_0x63381a[_0x482c('0x11f')],'os':_0x63381a[_0x482c('0x120')],'referer':_0x63381a[_0x482c('0x121')],'customerIp':_0x63381a[_0x482c('0x122')],'customerPort':_0x63381a[_0x482c('0x123')]?_0x63381a[_0x482c('0x123')]:'N.A.'},'messages':_(_0x63381a[_0x482c('0xdd')])[_0x482c('0x124')]()['filter']({'secret':![]})[_0x482c('0x3f')](function(_0x271996){if(_0x271996[_0x482c('0xd3')]){var _0x402dbd=path[_0x482c('0xd5')](_0x4ddc55,_0x271996['Attachment'][_0x482c('0xd0')]);if(fs[_0x482c('0x125')](_0x402dbd)){fs['createReadStream'](_0x402dbd)[_0x482c('0x126')](fs[_0x482c('0x127')](path[_0x482c('0xd5')](_0x449d63,_0x271996['Attachment']['basename'])));}}return{'date':moment(_0x271996[_0x482c('0x84')])[_0x482c('0xe1')](_0x482c('0x11e'))[_0x482c('0x9b')](),'sender':_0x271996[_0x482c('0xeb')]==='out'?_0x271996['User']?_0x271996['User'][_0x482c('0xe7')]:_0x482c('0xdf'):_0x271996[_0x482c('0x6f')][_0x482c('0x110')]+(_0x271996[_0x482c('0x6f')][_0x482c('0x128')]?'\x20'+_0x271996[_0x482c('0x6f')][_0x482c('0x128')]:''),'body':_0x271996['Attachment']?_0x271996[_0x482c('0xd3')][_0x482c('0xd0')]:_0x271996['body'],'direction':_0x271996[_0x482c('0xeb')]==='out'?'A':'C','secret':_0x271996[_0x482c('0xec')],'read':_0x271996['read'],'attachment':_0x271996[_0x482c('0xd3')]};})[_0x482c('0x6c')]()};return ejs[_0x482c('0x129')](path[_0x482c('0xd5')](config[_0x482c('0xd6')],'server',_0x482c('0x12a'),'downloadInteraction.html'),{'interaction':_0x27923b})['then'](function(_0x22079c){return new BPromise(function(_0x281ea3,_0xbd9ff8){pdf[_0x482c('0xb8')](_0x22079c,_0x3fd051)[_0x482c('0x12b')](path[_0x482c('0xd5')](_0x449d63,_0x482c('0x12c')+_0x63381a['id']+'-'+_0x5cd84d+_0x482c('0x12d')),function(_0x1b3f43,_0xdbf63d){if(_0x1b3f43)return _0xbd9ff8(_0x1b3f43);_0x281ea3(_0xdbf63d);});});})[_0x482c('0x21')](function(){return new BPromise(function(_0x21df32,_0xa33469){zipdir(_0x449d63,{'saveTo':_0x2a92ad},function(_0x397b90,_0x1a3184){if(_0x397b90)return _0xa33469(_0x397b90);return _0x21df32(_0x1a3184);});})[_0x482c('0x21')](function(){return new BPromise(function(_0xf1d7b1,_0x3ff6d7){rimraf(_0x449d63,function(_0x5b5397){if(_0x5b5397)_0x3ff6d7(_0x5b5397);return _0xf1d7b1();});});})['then'](function(){return _0x37b380['download'](_0x2a92ad,_0xf4358d,function(_0x5166f7){if(_0x5166f7){console[_0x482c('0x12e')](_0x482c('0x12f'),_0x5166f7);}else{fs[_0x482c('0x130')](_0x2a92ad);}});});});}else{return _0x37b380[_0x482c('0x2b')](0xc8);}})[_0x482c('0xb7')](handleError(_0x37b380,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index b4b96f4..0cbadd6 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 _0x2ace=['setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','../../mysqldb','ChatInteraction'];(function(_0x1dfcae,_0x495fc1){var _0x508c60=function(_0x48b127){while(--_0x48b127){_0x1dfcae['push'](_0x1dfcae['shift']());}};_0x508c60(++_0x495fc1);}(_0x2ace,0x17e));var _0xe2ac=function(_0x14bf63,_0xdbd373){_0x14bf63=_0x14bf63-0x0;var _0x410d22=_0x2ace[_0x14bf63];return _0x410d22;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xe2ac('0x0'))['db'][_0xe2ac('0x1')];var ChatMessage=require(_0xe2ac('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xe2ac('0x2')](0x0);var events={'afterCreate':_0xe2ac('0x3'),'afterUpdate':'update','afterDestroy':_0xe2ac('0x4')};function emitEvent(_0x464ec4){return function(_0x240663,_0x2d2241,_0x386b18){_0x240663[_0xe2ac('0x5')]({'attributes':['id'],'raw':!![]})[_0xe2ac('0x6')](function(_0x391f96){_0x240663[_0xe2ac('0x7')](_0xe2ac('0x8'),_0x391f96[_0xe2ac('0x9')](function(_0x3ae734){return{'id':_0x3ae734['id']};}));return ChatMessage[_0xe2ac('0xa')]({'where':{'ChatInteractionId':_0x240663['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5e6678){_0x240663[_0xe2ac('0x7')]('unreadMessages',_0x5e6678[_0xe2ac('0xb')]);ChatInteractionEvents[_0xe2ac('0xc')](_0x464ec4+':'+_0x240663['id'],_0x240663);ChatInteractionEvents['emit'](_0x464ec4,_0x240663);_0x386b18(null);})[_0xe2ac('0xd')](_0x386b18(null));};}for(var e in events){if(events[_0xe2ac('0xe')](e)){var event=events[e];ChatInteraction[_0xe2ac('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x24fe=['../../mysqldb','ChatInteraction','setMaxListeners','update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','hook','exports','events'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x24fe,0xef));var _0xe24f=function(_0x289719,_0x2bdb64){_0x289719=_0x289719-0x0;var _0x4169bf=_0x24fe[_0x289719];return _0x4169bf;};'use strict';var EventEmitter=require(_0xe24f('0x0'));var ChatInteraction=require(_0xe24f('0x1'))['db'][_0xe24f('0x2')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xe24f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe24f('0x4'),'afterDestroy':_0xe24f('0x5')};function emitEvent(_0x24c1de){return function(_0x23123c,_0x5e31e2,_0x4db715){_0x23123c['getUsers']({'attributes':['id'],'raw':!![]})[_0xe24f('0x6')](function(_0x2ec3af){_0x23123c[_0xe24f('0x7')]('Users',_0x2ec3af[_0xe24f('0x8')](function(_0x4a2923){return{'id':_0x4a2923['id']};}));return ChatMessage[_0xe24f('0x9')]({'where':{'ChatInteractionId':_0x23123c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x32dfff){_0x23123c['setDataValue'](_0xe24f('0xa'),_0x32dfff[_0xe24f('0xb')]);ChatInteractionEvents[_0xe24f('0xc')](_0x24c1de+':'+_0x23123c['id'],_0x23123c);ChatInteractionEvents[_0xe24f('0xc')](_0x24c1de,_0x23123c);_0x4db715(null);})['catch'](_0x4db715(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xe24f('0xd')](e,emitEvent(event));}}module[_0xe24f('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 1b62001..e3e9d8d 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 _0xa14b=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closedAt'];(function(_0x1a7413,_0x3e7da0){var _0x254221=function(_0x2a29b9){while(--_0x2a29b9){_0x1a7413['push'](_0x1a7413['shift']());}};_0x254221(++_0x3e7da0);}(_0xa14b,0xf2));var _0xba14=function(_0x12c6a5,_0xccbb68){_0x12c6a5=_0x12c6a5-0x0;var _0x82618f=_0xa14b[_0x12c6a5];return _0x82618f;};'use strict';var _=require(_0xba14('0x0'));var util=require(_0xba14('0x1'));var logger=require(_0xba14('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba14('0x3'));var fs=require('fs');var path=require(_0xba14('0x4'));var rimraf=require('rimraf');var config=require(_0xba14('0x5'));var attributes=require(_0xba14('0x6'));module[_0xba14('0x7')]=function(_0x54d805,_0x50bdbb){return _0x54d805[_0xba14('0x8')](_0xba14('0x9'),attributes,{'tableName':_0xba14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20de8d,_0x443ae2,_0x54e9a0){if(_0x20de8d[_0xba14('0xb')]('closed')){_0x20de8d[_0xba14('0xc')]=moment()[_0xba14('0xd')](_0xba14('0xe'));}_0x54e9a0(null,_0x20de8d);}},'charset':_0xba14('0xf'),'collate':_0xba14('0x10')});}; \ No newline at end of file +var _0xcf9c=['utf8mb4_unicode_ci','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4d47b6,_0x1e47a6){var _0x31748e=function(_0x235195){while(--_0x235195){_0x4d47b6['push'](_0x4d47b6['shift']());}};_0x31748e(++_0x1e47a6);}(_0xcf9c,0x81));var _0xccf9=function(_0x5b9f4b,_0x117a26){_0x5b9f4b=_0x5b9f4b-0x0;var _0x474db1=_0xcf9c[_0x5b9f4b];return _0x474db1;};'use strict';var _=require(_0xccf9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xccf9('0x1'));var moment=require(_0xccf9('0x2'));var BPromise=require('bluebird');var rp=require(_0xccf9('0x3'));var fs=require('fs');var path=require(_0xccf9('0x4'));var rimraf=require(_0xccf9('0x5'));var config=require(_0xccf9('0x6'));var attributes=require(_0xccf9('0x7'));module['exports']=function(_0x64bf5c,_0x12bf7d){return _0x64bf5c[_0xccf9('0x8')](_0xccf9('0x9'),attributes,{'tableName':_0xccf9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xcb597e,_0x27b91e,_0x88e6a8){if(_0xcb597e[_0xccf9('0xb')](_0xccf9('0xc'))){_0xcb597e['closedAt']=moment()[_0xccf9('0xd')](_0xccf9('0xe'));}_0x88e6a8(null,_0xcb597e);}},'charset':'utf8mb4','collate':_0xccf9('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 8aac3df..4cac1ff 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 _0xab43=['UpdateChatInteraction','ChatInteraction','options','raw','attributes','limit','then','debug','stringify','AddTagsToChatInteraction','where','body','ids','spread','info','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0xc0a186,_0x31b7fa){var _0x453c1b=function(_0x48373e){while(--_0x48373e){_0xc0a186['push'](_0xc0a186['shift']());}};_0x453c1b(++_0x31b7fa);}(_0xab43,0x85));var _0x3ab4=function(_0x30b7b0,_0x5255cf){_0x30b7b0=_0x30b7b0-0x0;var _0x5024ef=_0xab43[_0x30b7b0];return _0x5024ef;};'use strict';var _=require(_0x3ab4('0x0'));var util=require('util');var moment=require(_0x3ab4('0x1'));var BPromise=require(_0x3ab4('0x2'));var rs=require(_0x3ab4('0x3'));var fs=require('fs');var Redis=require(_0x3ab4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ab4('0x5'));var logger=require(_0x3ab4('0x6'))(_0x3ab4('0x7'));var config=require(_0x3ab4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3ab4('0x9')][_0x3ab4('0xa')]({'port':0x232a});config['redis']=_[_0x3ab4('0xb')](config[_0x3ab4('0xc')],{'host':_0x3ab4('0xd'),'port':0x18eb});var socket=require(_0x3ab4('0xe'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x3ab4('0xf')](socket);function respondWithRpcPromise(_0x60d6b4,_0x54dea0,_0x62bb17){return new BPromise(function(_0x1d3913,_0x138e4b){return client[_0x3ab4('0x10')](_0x60d6b4,_0x62bb17)['then'](function(_0x478b92){logger['info'](_0x3ab4('0x11'),_0x54dea0,_0x3ab4('0x12'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x54dea0,'request\x20sent',JSON['stringify'](_0x478b92));if(_0x478b92[_0x3ab4('0x13')]){if(_0x478b92[_0x3ab4('0x13')][_0x3ab4('0x14')]===0x1f4){logger[_0x3ab4('0x13')](_0x3ab4('0x11'),_0x54dea0,_0x478b92[_0x3ab4('0x13')][_0x3ab4('0x15')]);return _0x138e4b(_0x478b92['error'][_0x3ab4('0x15')]);}logger[_0x3ab4('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x54dea0,_0x478b92['error']['message']);return _0x1d3913(_0x478b92[_0x3ab4('0x13')][_0x3ab4('0x15')]);}else{logger['info'](_0x3ab4('0x11'),_0x54dea0,'request\x20sent');_0x1d3913(_0x478b92['result'][_0x3ab4('0x15')]);}})[_0x3ab4('0x16')](function(_0x42b071){logger['error'](_0x3ab4('0x11'),_0x54dea0,_0x42b071);_0x138e4b(_0x42b071);});});}exports[_0x3ab4('0x17')]=function(_0x1d67dd){var _0xfa8c42=this;return new Promise(function(_0x5baf9e,_0x2bb8fa){return db[_0x3ab4('0x18')]['update'](_0x1d67dd['body'],{'raw':_0x1d67dd[_0x3ab4('0x19')]?_0x1d67dd[_0x3ab4('0x19')][_0x3ab4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d67dd[_0x3ab4('0x19')]?_0x1d67dd['options']['where']||null:null,'attributes':_0x1d67dd[_0x3ab4('0x19')]?_0x1d67dd[_0x3ab4('0x19')][_0x3ab4('0x1b')]||null:null,'limit':_0x1d67dd[_0x3ab4('0x19')]?_0x1d67dd['options'][_0x3ab4('0x1c')]||null:null})[_0x3ab4('0x1d')](function(_0x3e7bb5){logger['info'](_0x3ab4('0x17'),_0x1d67dd);logger[_0x3ab4('0x1e')]('UpdateChatInteraction',_0x1d67dd,JSON[_0x3ab4('0x1f')](_0x3e7bb5));_0x5baf9e(_0x3e7bb5);})['catch'](function(_0x4c7119){logger[_0x3ab4('0x13')](_0x3ab4('0x17'),_0x4c7119[_0x3ab4('0x15')],_0x1d67dd);_0x2bb8fa(_0xfa8c42[_0x3ab4('0x13')](0x1f4,_0x4c7119['message']));});});};exports[_0x3ab4('0x20')]=function(_0x1622c3){return new Promise(function(_0x19c62e,_0x35d4dd){return db[_0x3ab4('0x18')]['find']({'where':_0x1622c3[_0x3ab4('0x19')]?_0x1622c3['options'][_0x3ab4('0x21')]||null:null})['then'](function(_0x3a4f96){if(_0x3a4f96){return _0x3a4f96['addTags'](_0x1622c3[_0x3ab4('0x22')][_0x3ab4('0x23')],_['omit'](_0x1622c3[_0x3ab4('0x22')],['ids','id'])||{});}})[_0x3ab4('0x24')](function(_0x51ab6f){logger[_0x3ab4('0x25')](_0x3ab4('0x26'),_0x1622c3);logger['debug'](_0x3ab4('0x26'),_0x1622c3,JSON[_0x3ab4('0x1f')](_0x51ab6f));_0x19c62e(_0x51ab6f);})[_0x3ab4('0x16')](function(_0x4ccaaa){logger[_0x3ab4('0x13')](_0x3ab4('0x26'),_0x4ccaaa[_0x3ab4('0x15')],_0x1622c3);_0x35d4dd(_this[_0x3ab4('0x13')](0x1f4,_0x4ccaaa['message']));});});}; \ No newline at end of file +var _0x44ba=['result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./chatInteraction.socket','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x1a3ac3,_0x3a3b0e){var _0x5e39bf=function(_0x1e0d10){while(--_0x1e0d10){_0x1a3ac3['push'](_0x1a3ac3['shift']());}};_0x5e39bf(++_0x3a3b0e);}(_0x44ba,0x68));var _0xa44b=function(_0x566dd5,_0x491250){_0x566dd5=_0x566dd5-0x0;var _0x184612=_0x44ba[_0x566dd5];return _0x184612;};'use strict';var _=require('lodash');var util=require(_0xa44b('0x0'));var moment=require(_0xa44b('0x1'));var BPromise=require(_0xa44b('0x2'));var rs=require(_0xa44b('0x3'));var fs=require('fs');var Redis=require(_0xa44b('0x4'));var db=require(_0xa44b('0x5'))['db'];var utils=require(_0xa44b('0x6'));var logger=require(_0xa44b('0x7'))('rpc');var config=require(_0xa44b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa44b('0x9')][_0xa44b('0xa')]({'port':0x232a});config[_0xa44b('0xb')]=_[_0xa44b('0xc')](config[_0xa44b('0xb')],{'host':_0xa44b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa44b('0xb')]));require(_0xa44b('0xe'))['register'](socket);function respondWithRpcPromise(_0x30da9b,_0x28a925,_0xc56c9e){return new BPromise(function(_0x154883,_0x58d777){return client['request'](_0x30da9b,_0xc56c9e)[_0xa44b('0xf')](function(_0x4deeb8){logger[_0xa44b('0x10')](_0xa44b('0x11'),_0x28a925,'request\x20sent');logger[_0xa44b('0x12')](_0xa44b('0x13'),_0x28a925,'request\x20sent',JSON[_0xa44b('0x14')](_0x4deeb8));if(_0x4deeb8[_0xa44b('0x15')]){if(_0x4deeb8[_0xa44b('0x15')][_0xa44b('0x16')]===0x1f4){logger['error'](_0xa44b('0x11'),_0x28a925,_0x4deeb8[_0xa44b('0x15')]['message']);return _0x58d777(_0x4deeb8['error'][_0xa44b('0x17')]);}logger[_0xa44b('0x15')](_0xa44b('0x11'),_0x28a925,_0x4deeb8['error'][_0xa44b('0x17')]);return _0x154883(_0x4deeb8[_0xa44b('0x15')][_0xa44b('0x17')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x28a925,_0xa44b('0x18'));_0x154883(_0x4deeb8[_0xa44b('0x19')][_0xa44b('0x17')]);}})[_0xa44b('0x1a')](function(_0x41e51b){logger['error'](_0xa44b('0x11'),_0x28a925,_0x41e51b);_0x58d777(_0x41e51b);});});}exports[_0xa44b('0x1b')]=function(_0x292f1b){var _0x20bb43=this;return new Promise(function(_0x3ff226,_0x2524b7){return db[_0xa44b('0x1c')][_0xa44b('0x1d')](_0x292f1b[_0xa44b('0x1e')],{'raw':_0x292f1b[_0xa44b('0x1f')]?_0x292f1b[_0xa44b('0x1f')][_0xa44b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x292f1b['options']?_0x292f1b['options'][_0xa44b('0x21')]||null:null,'attributes':_0x292f1b[_0xa44b('0x1f')]?_0x292f1b['options'][_0xa44b('0x22')]||null:null,'limit':_0x292f1b[_0xa44b('0x1f')]?_0x292f1b['options'][_0xa44b('0x23')]||null:null})[_0xa44b('0xf')](function(_0x1dc701){logger[_0xa44b('0x10')](_0xa44b('0x1b'),_0x292f1b);logger['debug'](_0xa44b('0x1b'),_0x292f1b,JSON[_0xa44b('0x14')](_0x1dc701));_0x3ff226(_0x1dc701);})[_0xa44b('0x1a')](function(_0x22d839){logger['error'](_0xa44b('0x1b'),_0x22d839[_0xa44b('0x17')],_0x292f1b);_0x2524b7(_0x20bb43[_0xa44b('0x15')](0x1f4,_0x22d839[_0xa44b('0x17')]));});});};exports[_0xa44b('0x24')]=function(_0x1c1491){return new Promise(function(_0x1b2af5,_0x1edbb0){return db[_0xa44b('0x1c')][_0xa44b('0x25')]({'where':_0x1c1491['options']?_0x1c1491[_0xa44b('0x1f')][_0xa44b('0x21')]||null:null})[_0xa44b('0xf')](function(_0x584615){if(_0x584615){return _0x584615[_0xa44b('0x26')](_0x1c1491[_0xa44b('0x1e')][_0xa44b('0x27')],_[_0xa44b('0x28')](_0x1c1491[_0xa44b('0x1e')],[_0xa44b('0x27'),'id'])||{});}})[_0xa44b('0x29')](function(_0x247158){logger[_0xa44b('0x10')]('AddTags',_0x1c1491);logger[_0xa44b('0x12')]('AddTags',_0x1c1491,JSON[_0xa44b('0x14')](_0x247158));_0x1b2af5(_0x247158);})[_0xa44b('0x1a')](function(_0x495dca){logger[_0xa44b('0x15')](_0xa44b('0x2a'),_0x495dca[_0xa44b('0x17')],_0x1c1491);_0x1edbb0(_this[_0xa44b('0x15')](0x1f4,_0x495dca[_0xa44b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index e4ffe2a..d9c4cd7 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 _0x36b4=['length','save','update','emit','removeListener'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x36b4,0x1be));var _0x436b=function(_0x4d4e8a,_0x162fd7){_0x4d4e8a=_0x4d4e8a-0x0;var _0x2e304d=_0x36b4[_0x4d4e8a];return _0x2e304d;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x436b('0x0'),'remove',_0x436b('0x1')];function createListener(_0x30d10e,_0x27bdb8){return function(_0x33dee7){_0x27bdb8[_0x436b('0x2')](_0x30d10e,_0x33dee7);};}function removeListener(_0x3db80c,_0x2d6b79){return function(){ChatInteractionEvents[_0x436b('0x3')](_0x3db80c,_0x2d6b79);};}exports['register']=function(_0x3dd835){for(var _0x547d29=0x0,_0x5f10d5=events[_0x436b('0x4')];_0x547d29<_0x5f10d5;_0x547d29++){var _0x5b1c82=events[_0x547d29];var _0x37e3b8=createListener('chatInteraction:'+_0x5b1c82,_0x3dd835);ChatInteractionEvents['on'](_0x5b1c82,_0x37e3b8);}}; \ No newline at end of file +var _0xc734=['save','remove','update','emit','removeListener','register'];(function(_0x3f8a77,_0x359289){var _0x3dfc6d=function(_0x1a24b3){while(--_0x1a24b3){_0x3f8a77['push'](_0x3f8a77['shift']());}};_0x3dfc6d(++_0x359289);}(_0xc734,0x19e));var _0x4c73=function(_0x28b0a4,_0x2ea758){_0x28b0a4=_0x28b0a4-0x0;var _0x105ce6=_0xc734[_0x28b0a4];return _0x105ce6;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x4c73('0x0'),_0x4c73('0x1'),_0x4c73('0x2')];function createListener(_0xafeebe,_0x12f860){return function(_0x40c0f5){_0x12f860[_0x4c73('0x3')](_0xafeebe,_0x40c0f5);};}function removeListener(_0x54f708,_0x5f091f){return function(){ChatInteractionEvents[_0x4c73('0x4')](_0x54f708,_0x5f091f);};}exports[_0x4c73('0x5')]=function(_0x3fde17){for(var _0x524fc3=0x0,_0x5c782a=events['length'];_0x524fc3<_0x5c782a;_0x524fc3++){var _0x38a5fe=events[_0x524fc3];var _0x22ad6b=createListener('chatInteraction:'+_0x38a5fe,_0x3fde17);ChatInteractionEvents['on'](_0x38a5fe,_0x22ad6b);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 9a425ce..d499868 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 _0x7cfe=['tracked','chatinteraction:addtags','addTags','put','/:id','chat','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','getMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','root','server/files/attachments/','%s-%s','now','originalname','replace','single','file','attachmentUpload','/:id/messages','/:id/tags'];(function(_0x561af6,_0x214a22){var _0x3d6789=function(_0x41ff9a){while(--_0x41ff9a){_0x561af6['push'](_0x561af6['shift']());}};_0x3d6789(++_0x214a22);}(_0x7cfe,0xd9));var _0xe7cf=function(_0x450860,_0x196a04){_0x450860=_0x450860-0x0;var _0x110c2a=_0x7cfe[_0x450860];return _0x110c2a;};'use strict';var multer=require(_0xe7cf('0x0'));var util=require(_0xe7cf('0x1'));var path=require(_0xe7cf('0x2'));var timeout=require('connect-timeout');var express=require(_0xe7cf('0x3'));var router=express[_0xe7cf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe7cf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe7cf('0x6'));var controller=require('./chatInteraction.controller');router[_0xe7cf('0x7')]('/',auth[_0xe7cf('0x8')](),controller[_0xe7cf('0x9')]);router[_0xe7cf('0x7')](_0xe7cf('0xa'),auth[_0xe7cf('0x8')](),controller[_0xe7cf('0xb')]);router[_0xe7cf('0x7')]('/:id',auth[_0xe7cf('0xc')](),controller['show']);router[_0xe7cf('0x7')](_0xe7cf('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xe7cf('0xe')]);router[_0xe7cf('0x7')]('/:id/messages',auth[_0xe7cf('0x8')](),controller[_0xe7cf('0xf')]);router[_0xe7cf('0x7')]('/:id/my_messages',auth[_0xe7cf('0xc')](),controller['getMyMessages']);router['get'](_0xe7cf('0x10'),auth[_0xe7cf('0x8')](),controller[_0xe7cf('0x11')]);router[_0xe7cf('0x12')]('/',auth['isAuthenticated'](),controller[_0xe7cf('0x13')]);router['post'](_0xe7cf('0x14'),auth[_0xe7cf('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xe7cf('0x15')]({'destination':function(_0xbb52c8,_0x2e34a5,_0x311696){_0x311696(null,path['join'](config[_0xe7cf('0x16')],_0xe7cf('0x17')));},'filename':function(_0xc4f835,_0x57721c,_0x4e8914){_0x4e8914(null,util['format'](_0xe7cf('0x18'),Date[_0xe7cf('0x19')](),_0x57721c[_0xe7cf('0x1a')][_0xe7cf('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe7cf('0x12')]('/:id/attachment_upload',upload[_0xe7cf('0x1c')](_0xe7cf('0x1d')),controller[_0xe7cf('0x1e')]);router['post'](_0xe7cf('0x1f'),auth[_0xe7cf('0xc')](),controller['addMessage']);router[_0xe7cf('0x12')](_0xe7cf('0x20'),auth[_0xe7cf('0x8')](),interaction[_0xe7cf('0x21')]('chat',_0xe7cf('0x22')),controller[_0xe7cf('0x23')]);router[_0xe7cf('0x24')](_0xe7cf('0x25'),auth[_0xe7cf('0x8')](),interaction['tracked'](_0xe7cf('0x26'),'chatinteraction:update'),controller[_0xe7cf('0x27')]);router[_0xe7cf('0x24')](_0xe7cf('0x28'),controller[_0xe7cf('0x29')]);router['put'](_0xe7cf('0x2a'),auth[_0xe7cf('0xc')](),controller[_0xe7cf('0x2b')]);router['put'](_0xe7cf('0x2c'),controller['close']);router[_0xe7cf('0x2d')](_0xe7cf('0x25'),auth['isAuthenticated'](),interaction[_0xe7cf('0x21')]('chat',_0xe7cf('0x2e')),controller[_0xe7cf('0x2f')]);router[_0xe7cf('0x2d')](_0xe7cf('0x20'),auth[_0xe7cf('0x8')](),controller[_0xe7cf('0x30')]);module[_0xe7cf('0x31')]=router; \ No newline at end of file +var _0x66bd=['tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','close','delete','chatinteraction:destroy','removeTags','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','file','addMessage','/:id/tags'];(function(_0x1bc1b5,_0x52aff2){var _0x131a0d=function(_0x136e63){while(--_0x136e63){_0x1bc1b5['push'](_0x1bc1b5['shift']());}};_0x131a0d(++_0x52aff2);}(_0x66bd,0x10b));var _0xd66b=function(_0x388eea,_0x340518){_0x388eea=_0x388eea-0x0;var _0x4a175b=_0x66bd[_0x388eea];return _0x4a175b;};'use strict';var multer=require(_0xd66b('0x0'));var util=require(_0xd66b('0x1'));var path=require(_0xd66b('0x2'));var timeout=require('connect-timeout');var express=require(_0xd66b('0x3'));var router=express['Router']();var fs_extra=require(_0xd66b('0x4'));var auth=require(_0xd66b('0x5'));var interaction=require(_0xd66b('0x6'));var config=require(_0xd66b('0x7'));var controller=require(_0xd66b('0x8'));router[_0xd66b('0x9')]('/',auth[_0xd66b('0xa')](),controller[_0xd66b('0xb')]);router[_0xd66b('0x9')](_0xd66b('0xc'),auth['isAuthenticated'](),controller[_0xd66b('0xd')]);router[_0xd66b('0x9')](_0xd66b('0xe'),auth[_0xd66b('0xf')](),controller['show']);router[_0xd66b('0x9')](_0xd66b('0x10'),auth[_0xd66b('0xf')](),controller['attachmentDownload']);router[_0xd66b('0x9')](_0xd66b('0x11'),auth[_0xd66b('0xa')](),controller[_0xd66b('0x12')]);router[_0xd66b('0x9')](_0xd66b('0x13'),auth[_0xd66b('0xf')](),controller[_0xd66b('0x14')]);router[_0xd66b('0x9')](_0xd66b('0x15'),auth[_0xd66b('0xa')](),controller[_0xd66b('0x16')]);router[_0xd66b('0x17')]('/',auth[_0xd66b('0xa')](),controller[_0xd66b('0x18')]);router[_0xd66b('0x17')](_0xd66b('0x19'),auth[_0xd66b('0xa')](),controller[_0xd66b('0x1a')]);var upload=multer({'storage':multer[_0xd66b('0x1b')]({'destination':function(_0x3f2a95,_0x365c0d,_0x3ebc2e){_0x3ebc2e(null,path[_0xd66b('0x1c')](config[_0xd66b('0x1d')],_0xd66b('0x1e')));},'filename':function(_0x19a79a,_0x58b911,_0x333f4d){_0x333f4d(null,util[_0xd66b('0x1f')](_0xd66b('0x20'),Date[_0xd66b('0x21')](),_0x58b911[_0xd66b('0x22')][_0xd66b('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload['single'](_0xd66b('0x24')),controller['attachmentUpload']);router[_0xd66b('0x17')]('/:id/messages',auth[_0xd66b('0xf')](),controller[_0xd66b('0x25')]);router['post'](_0xd66b('0x26'),auth['isAuthenticated'](),interaction[_0xd66b('0x27')](_0xd66b('0x28'),_0xd66b('0x29')),controller['addTags']);router[_0xd66b('0x2a')](_0xd66b('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0xd66b('0x28'),_0xd66b('0x2b')),controller[_0xd66b('0x2c')]);router[_0xd66b('0x2a')](_0xd66b('0x2d'),controller[_0xd66b('0x2e')]);router[_0xd66b('0x2a')]('/:id/abandon',auth[_0xd66b('0xf')](),controller['abandon']);router['put']('/:id/close',controller[_0xd66b('0x2f')]);router[_0xd66b('0x30')](_0xd66b('0xe'),auth['isAuthenticated'](),interaction['tracked']('chat',_0xd66b('0x31')),controller['destroy']);router[_0xd66b('0x30')]('/:id/tags',auth[_0xd66b('0xa')](),controller[_0xd66b('0x32')]);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 aa8bd03..a133f4d 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 _0x5f2f=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3f04d0,_0x19fe04){var _0x3562e7=function(_0x2bdbaa){while(--_0x2bdbaa){_0x3f04d0['push'](_0x3f04d0['shift']());}};_0x3562e7(++_0x19fe04);}(_0x5f2f,0x73));var _0xf5f2=function(_0x36e22b,_0x12fdc9){_0x36e22b=_0x36e22b-0x0;var _0x41bc3d=_0x5f2f[_0x36e22b];return _0x41bc3d;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf5f2('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file +var _0x0295=['sequelize','medium'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0295,0x1f0));var _0x5029=function(_0xf915a7,_0x3c5104){_0xf915a7=_0xf915a7-0x0;var _0x714195=_0x0295[_0xf915a7];return _0x714195;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x5029('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index c5abf13..4a905c3 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 _0x6c7b=['params','create','body','find','describe','get','messages','lastMessageAt','createdAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','stack','name','index','map','ChatInternalMessage','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show'];(function(_0x4f9981,_0xacd7ab){var _0x1a93ee=function(_0x32455c){while(--_0x32455c){_0x4f9981['push'](_0x4f9981['shift']());}};_0x1a93ee(++_0xacd7ab);}(_0x6c7b,0x8d));var _0xb6c7=function(_0x5e6589,_0x3e261e){_0x5e6589=_0x5e6589-0x0;var _0x5769df=_0x6c7b[_0x5e6589];return _0x5769df;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb6c7('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6c7('0x1'));var moment=require(_0xb6c7('0x2'));var BPromise=require(_0xb6c7('0x3'));var Mustache=require(_0xb6c7('0x4'));var util=require(_0xb6c7('0x5'));var path=require(_0xb6c7('0x6'));var sox=require(_0xb6c7('0x7'));var csv=require(_0xb6c7('0x8'));var ejs=require(_0xb6c7('0x9'));var fs=require('fs');var fs_extra=require(_0xb6c7('0xa'));var _=require(_0xb6c7('0xb'));var squel=require(_0xb6c7('0xc'));var crypto=require(_0xb6c7('0xd'));var jsforce=require(_0xb6c7('0xe'));var deskjs=require(_0xb6c7('0xf'));var toCsv=require(_0xb6c7('0x8'));var querystring=require(_0xb6c7('0x10'));var Papa=require(_0xb6c7('0x11'));var Redis=require(_0xb6c7('0x12'));var authService=require(_0xb6c7('0x13'));var qs=require(_0xb6c7('0x14'));var as=require(_0xb6c7('0x15'));var hardwareService=require(_0xb6c7('0x16'));var logger=require(_0xb6c7('0x17'))(_0xb6c7('0x18'));var utils=require(_0xb6c7('0x19'));var config=require(_0xb6c7('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xb6c7('0x1b'))['db'];config[_0xb6c7('0x1c')]=_[_0xb6c7('0x1d')](config[_0xb6c7('0x1c')],{'host':_0xb6c7('0x1e'),'port':0x18eb});var socket=require(_0xb6c7('0x1f'))(new Redis(config['redis']));require(_0xb6c7('0x20'))[_0xb6c7('0x21')](socket);function respondWithStatusCode(_0x505e3b,_0xc5805b){_0xc5805b=_0xc5805b||0xcc;return function(_0x26828e){if(_0x26828e){return _0x505e3b[_0xb6c7('0x22')](_0xc5805b);}return _0x505e3b['status'](_0xc5805b)[_0xb6c7('0x23')]();};}function respondWithResult(_0x4d188f,_0x403ac7){_0x403ac7=_0x403ac7||0xc8;return function(_0x4f2ee6){if(_0x4f2ee6){return _0x4d188f[_0xb6c7('0x24')](_0x403ac7)[_0xb6c7('0x25')](_0x4f2ee6);}};}function respondWithFilteredResult(_0x57d42f,_0x27d910){return function(_0xe4b95d){if(_0xe4b95d){var _0x3f04af=_0xe4b95d[_0xb6c7('0x26')],_0x2d9561=_0x27d910[_0xb6c7('0x27')],_0x7a1148=_0x27d910['offset']+_0x27d910[_0xb6c7('0x28')],_0x4c4388;if(_0x7a1148>=_0x3f04af){_0x7a1148=_0x3f04af;_0x4c4388=0xc8;}else{_0x4c4388=0xce;}_0x57d42f[_0xb6c7('0x24')](_0x4c4388);return _0x57d42f[_0xb6c7('0x29')]('Content-Range',_0x2d9561+'-'+_0x7a1148+'/'+_0x3f04af)[_0xb6c7('0x25')](_0xe4b95d);}return null;};}function patchUpdates(_0x23cce2){return function(_0x189e50){try{jsonpatch[_0xb6c7('0x2a')](_0x189e50,_0x23cce2,!![]);}catch(_0x1ce53f){return BPromise['reject'](_0x1ce53f);}return _0x189e50[_0xb6c7('0x2b')]();};}function saveUpdates(_0x4693b8,_0x59e6d3){return function(_0x5cfb7e){if(_0x5cfb7e){return _0x5cfb7e[_0xb6c7('0x2c')](_0x4693b8)['then'](function(_0xa5c863){return _0xa5c863;});}return null;};}function removeEntity(_0x32f6d4,_0x4ff334){return function(_0x5ebc05){if(_0x5ebc05){return _0x5ebc05['destroy']()['then'](function(){_0x32f6d4['status'](0xcc)[_0xb6c7('0x23')]();});}};}function handleEntityNotFound(_0x1a0003,_0x79a0ba){return function(_0x4f861d){if(!_0x4f861d){_0x1a0003[_0xb6c7('0x22')](0x194);}return _0x4f861d;};}function handleError(_0x2a51be,_0x72e41a){_0x72e41a=_0x72e41a||0x1f4;return function(_0x501aa8){logger['error'](_0x501aa8[_0xb6c7('0x2d')]);if(_0x501aa8[_0xb6c7('0x2e')]){delete _0x501aa8[_0xb6c7('0x2e')];}_0x2a51be[_0xb6c7('0x24')](_0x72e41a)['send'](_0x501aa8);};}exports[_0xb6c7('0x2f')]=function(_0x402a61,_0x43a36a){var _0x38ce36={},_0x6641f5={},_0x5cb96b={'count':0x0,'rows':[]};var _0x581ae4=_[_0xb6c7('0x30')](db[_0xb6c7('0x31')][_0xb6c7('0x32')],function(_0x67ab3b){return{'name':_0x67ab3b['fieldName'],'type':_0x67ab3b[_0xb6c7('0x33')][_0xb6c7('0x34')]};});_0x6641f5['model']=_['map'](_0x581ae4,'name');_0x6641f5['query']=_[_0xb6c7('0x35')](_0x402a61[_0xb6c7('0x36')]);_0x6641f5[_0xb6c7('0x37')]=_[_0xb6c7('0x38')](_0x6641f5['model'],_0x6641f5[_0xb6c7('0x36')]);_0x38ce36[_0xb6c7('0x39')]=_[_0xb6c7('0x38')](_0x6641f5[_0xb6c7('0x3a')],qs['fields'](_0x402a61[_0xb6c7('0x36')][_0xb6c7('0x3b')]));_0x38ce36[_0xb6c7('0x39')]=_0x38ce36[_0xb6c7('0x39')][_0xb6c7('0x3c')]?_0x38ce36['attributes']:_0x6641f5[_0xb6c7('0x3a')];if(!_0x402a61['query'][_0xb6c7('0x3d')]('nolimit')){_0x38ce36['limit']=qs[_0xb6c7('0x28')](_0x402a61[_0xb6c7('0x36')][_0xb6c7('0x28')]);_0x38ce36['offset']=qs[_0xb6c7('0x27')](_0x402a61[_0xb6c7('0x36')]['offset']);}_0x38ce36[_0xb6c7('0x3e')]=qs[_0xb6c7('0x3f')](_0x402a61[_0xb6c7('0x36')][_0xb6c7('0x3f')]);_0x38ce36[_0xb6c7('0x40')]=qs[_0xb6c7('0x37')](_[_0xb6c7('0x41')](_0x402a61[_0xb6c7('0x36')],_0x6641f5['filters']),_0x581ae4);if(_0x402a61['query'][_0xb6c7('0x42')]){_0x38ce36[_0xb6c7('0x40')]=_[_0xb6c7('0x43')](_0x38ce36[_0xb6c7('0x40')],{'$or':_[_0xb6c7('0x30')](_0x581ae4,function(_0x508974){if(_0x508974[_0xb6c7('0x33')]!==_0xb6c7('0x44')){var _0x3395b2={};_0x3395b2[_0x508974[_0xb6c7('0x2e')]]={'$like':'%'+_0x402a61[_0xb6c7('0x36')]['filter']+'%'};return _0x3395b2;}})});}_0x38ce36=_['merge']({},_0x38ce36,_0x402a61[_0xb6c7('0x45')]);var _0x47fe44={'where':_0x38ce36[_0xb6c7('0x40')]};return db['ChatInternalMessage'][_0xb6c7('0x26')](_0x47fe44)[_0xb6c7('0x46')](function(_0x3ba679){_0x5cb96b[_0xb6c7('0x26')]=_0x3ba679;if(_0x402a61[_0xb6c7('0x36')][_0xb6c7('0x47')]){_0x38ce36[_0xb6c7('0x48')]=[{'all':!![]}];}return db[_0xb6c7('0x31')][_0xb6c7('0x49')](_0x38ce36);})[_0xb6c7('0x46')](function(_0x934431){_0x5cb96b[_0xb6c7('0x4a')]=_0x934431;return _0x5cb96b;})[_0xb6c7('0x46')](respondWithFilteredResult(_0x43a36a,_0x38ce36))[_0xb6c7('0x4b')](handleError(_0x43a36a,null));};exports[_0xb6c7('0x4c')]=function(_0x4f2544,_0x5ea4f8){var _0x2d7a82={'raw':!![],'where':{'id':_0x4f2544[_0xb6c7('0x4d')]['id']}},_0x5ab142={};_0x5ab142[_0xb6c7('0x3a')]=_['keys'](db['ChatInternalMessage'][_0xb6c7('0x32')]);_0x5ab142['query']=_[_0xb6c7('0x35')](_0x4f2544['query']);_0x5ab142[_0xb6c7('0x37')]=_[_0xb6c7('0x38')](_0x5ab142['model'],_0x5ab142[_0xb6c7('0x36')]);_0x2d7a82['attributes']=_[_0xb6c7('0x38')](_0x5ab142[_0xb6c7('0x3a')],qs[_0xb6c7('0x3b')](_0x4f2544[_0xb6c7('0x36')][_0xb6c7('0x3b')]));_0x2d7a82[_0xb6c7('0x39')]=_0x2d7a82['attributes'][_0xb6c7('0x3c')]?_0x2d7a82['attributes']:_0x5ab142[_0xb6c7('0x3a')];if(_0x4f2544[_0xb6c7('0x36')][_0xb6c7('0x47')]){_0x2d7a82[_0xb6c7('0x48')]=[{'all':!![]}];}_0x2d7a82=_['merge']({},_0x2d7a82,_0x4f2544['options']);return db[_0xb6c7('0x31')]['find'](_0x2d7a82)[_0xb6c7('0x46')](handleEntityNotFound(_0x5ea4f8,null))[_0xb6c7('0x46')](respondWithResult(_0x5ea4f8,null))['catch'](handleError(_0x5ea4f8,null));};exports[_0xb6c7('0x4e')]=function(_0x3d0189,_0x4c2b7b){return db[_0xb6c7('0x31')][_0xb6c7('0x4e')](_0x3d0189['body'],{})['then'](respondWithResult(_0x4c2b7b,0xc9))[_0xb6c7('0x4b')](handleError(_0x4c2b7b,null));};exports[_0xb6c7('0x2c')]=function(_0x894387,_0x298405){if(_0x894387['body']['id']){delete _0x894387[_0xb6c7('0x4f')]['id'];}return db[_0xb6c7('0x31')][_0xb6c7('0x50')]({'where':{'id':_0x894387[_0xb6c7('0x4d')]['id']}})[_0xb6c7('0x46')](handleEntityNotFound(_0x298405,null))['then'](saveUpdates(_0x894387[_0xb6c7('0x4f')],null))[_0xb6c7('0x46')](respondWithResult(_0x298405,null))[_0xb6c7('0x4b')](handleError(_0x298405,null));};exports['destroy']=function(_0x25d65b,_0x22c5b4){return db[_0xb6c7('0x31')][_0xb6c7('0x50')]({'where':{'id':_0x25d65b['params']['id']}})[_0xb6c7('0x46')](handleEntityNotFound(_0x22c5b4,null))[_0xb6c7('0x46')](removeEntity(_0x22c5b4,null))[_0xb6c7('0x4b')](handleError(_0x22c5b4,null));};exports[_0xb6c7('0x51')]=function(_0x1aa32d,_0x4aa479){return db[_0xb6c7('0x31')]['describe']()[_0xb6c7('0x46')](respondWithResult(_0x4aa479,null))['catch'](handleError(_0x4aa479,null));};function wrapUser(_0x33f981){return function(_0x3d09c4){var _0x1c8b91=_0x33f981[_0xb6c7('0x52')]({'plain':!![]});_0x1c8b91[_0xb6c7('0x53')]=[];if(_0x3d09c4){_0x1c8b91[_0xb6c7('0x54')]=_0x3d09c4[_0xb6c7('0x55')];_0x1c8b91['lastMessage']=_0x3d09c4;}else{_0x1c8b91[_0xb6c7('0x54')]=moment(0x0)['format'](_0xb6c7('0x56'));_0x1c8b91[_0xb6c7('0x57')]={};}return _0x1c8b91;};}exports[_0xb6c7('0x58')]=function(_0x5494cf,_0x2b8684,_0x547fec){var _0x11524e=[];return db[_0xb6c7('0x59')][_0xb6c7('0x49')]({'where':{'role':[_0xb6c7('0x5a'),_0xb6c7('0x5b'),_0xb6c7('0x5c')]},'attributes':['id',_0xb6c7('0x5d'),_0xb6c7('0x2e'),_0xb6c7('0x5e'),_0xb6c7('0x5f'),_0xb6c7('0x60'),_0xb6c7('0x61'),_0xb6c7('0x62'),_0xb6c7('0x63'),_0xb6c7('0x64')],'order':qs[_0xb6c7('0x3f')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0xb6c7('0x65'),'attributes':['id',_0xb6c7('0x2e'),_0xb6c7('0x33')],'through':{'attributes':[]}}]})[_0xb6c7('0x46')](function(_0x12dd4f){if(_0x12dd4f){var _0x4f4f93=_0x5494cf['user']['get']({'plain':!![]});if(!_0x4f4f93)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f4f93['role']===_0xb6c7('0x5c')){return db[_0xb6c7('0x66')][_0xb6c7('0x50')]({'where':{'name':_0xb6c7('0x67'),'userProfileId':_0x4f4f93[_0xb6c7('0x68')]},'raw':!![]})[_0xb6c7('0x46')](function(_0x31cc5b){if(_0x31cc5b){if(_0x31cc5b[_0xb6c7('0x69')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x31cc5b['id']},'raw':!![]})[_0xb6c7('0x46')](function(_0xaf4e0b){var _0x2674f=[];if(_[_0xb6c7('0x6a')](_0xaf4e0b)){_0x2674f=_[_0xb6c7('0x42')](_0x12dd4f,function(_0x1aa2f0){if(_0x1aa2f0[_0xb6c7('0x5e')]!==_0xb6c7('0x5a')){return _0x1aa2f0;}});return _0x2674f;}else{for(var _0x2804bc=0x0;_0x2804bc<_0x12dd4f[_0xb6c7('0x3c')];_0x2804bc++){var _0x213533=_0x12dd4f[_0x2804bc];if(_0x213533['role']===_0xb6c7('0x5a')){var _0x121161=_['find'](_0xaf4e0b,function(_0x10e459){return _0x10e459[_0xb6c7('0x6b')]===_0x213533['id'];});if(_0x121161)_0x2674f['push'](_0x213533);}else{_0x2674f[_0xb6c7('0x6c')](_0x213533);}}return _0x2674f;}});}else{return _0x12dd4f;}}else{var _0x4ff436=_['filter'](_0x12dd4f,function(_0x20fcc0){if(_0x20fcc0[_0xb6c7('0x5e')]!==_0xb6c7('0x5a')){return _0x20fcc0;}});return _0x4ff436;}});}else{return _0x12dd4f;}}})[_0xb6c7('0x46')](function(_0x3ce748){var _0x453100=[];if(_0x3ce748){_0x11524e=_0x3ce748;for(var _0x1d5a02=0x0;_0x1d5a02<_0x3ce748['length'];_0x1d5a02+=0x1){_0x11524e[_0x1d5a02][_0xb6c7('0x53')]=[];_0x453100[_0xb6c7('0x6c')](db[_0xb6c7('0x31')][_0xb6c7('0x50')]({'where':{'FromId':[_0x5494cf[_0xb6c7('0x5c')]['id'],_0x3ce748[_0x1d5a02]['id']],'ToId':[_0x5494cf[_0xb6c7('0x5c')]['id'],_0x3ce748[_0x1d5a02]['id']],'ChatGroupId':null},'attributes':['id',_0xb6c7('0x55'),'FromId','ToId','read',_0xb6c7('0x4f')],'order':qs[_0xb6c7('0x3f')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb6c7('0x46')](wrapUser(_0x3ce748[_0x1d5a02])));}return BPromise['all'](_0x453100);}return[];})[_0xb6c7('0x46')](function(_0x4f78f4){return{'rows':_0x4f78f4,'count':_0x4f78f4['length']};})[_0xb6c7('0x46')](respondWithResult(_0x2b8684,null))['catch'](handleError(_0x2b8684,null));}; \ No newline at end of file +var _0x50ef=['destroy','then','end','stack','name','send','index','ChatInternalMessage','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','create','body','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','fullname','role','userpic','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./chatInternalMessage.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update'];(function(_0x324b93,_0x2c16b8){var _0x13e774=function(_0x4552c9){while(--_0x4552c9){_0x324b93['push'](_0x324b93['shift']());}};_0x13e774(++_0x2c16b8);}(_0x50ef,0xb8));var _0xf50e=function(_0xcf3fae,_0x4d1479){_0xcf3fae=_0xcf3fae-0x0;var _0x5cd6a1=_0x50ef[_0xcf3fae];return _0x5cd6a1;};'use strict';var pdf=require(_0xf50e('0x0'));var emlformat=require(_0xf50e('0x1'));var rimraf=require(_0xf50e('0x2'));var zipdir=require(_0xf50e('0x3'));var jsonpatch=require(_0xf50e('0x4'));var rp=require(_0xf50e('0x5'));var moment=require(_0xf50e('0x6'));var BPromise=require(_0xf50e('0x7'));var Mustache=require('mustache');var util=require(_0xf50e('0x8'));var path=require(_0xf50e('0x9'));var sox=require(_0xf50e('0xa'));var csv=require(_0xf50e('0xb'));var ejs=require(_0xf50e('0xc'));var fs=require('fs');var fs_extra=require(_0xf50e('0xd'));var _=require(_0xf50e('0xe'));var squel=require(_0xf50e('0xf'));var crypto=require(_0xf50e('0x10'));var jsforce=require(_0xf50e('0x11'));var deskjs=require(_0xf50e('0x12'));var toCsv=require(_0xf50e('0xb'));var querystring=require(_0xf50e('0x13'));var Papa=require(_0xf50e('0x14'));var Redis=require(_0xf50e('0x15'));var authService=require(_0xf50e('0x16'));var qs=require(_0xf50e('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf50e('0x18'))(_0xf50e('0x19'));var utils=require(_0xf50e('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xf50e('0x1b'));var db=require(_0xf50e('0x1c'))['db'];config[_0xf50e('0x1d')]=_[_0xf50e('0x1e')](config[_0xf50e('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf50e('0x1f'))[_0xf50e('0x20')](socket);function respondWithStatusCode(_0x34eb46,_0x1cf1c5){_0x1cf1c5=_0x1cf1c5||0xcc;return function(_0x15d40a){if(_0x15d40a){return _0x34eb46[_0xf50e('0x21')](_0x1cf1c5);}return _0x34eb46[_0xf50e('0x22')](_0x1cf1c5)['end']();};}function respondWithResult(_0x523733,_0x5d5fa5){_0x5d5fa5=_0x5d5fa5||0xc8;return function(_0x20b312){if(_0x20b312){return _0x523733[_0xf50e('0x22')](_0x5d5fa5)[_0xf50e('0x23')](_0x20b312);}};}function respondWithFilteredResult(_0x18b675,_0x65bd32){return function(_0x543df3){if(_0x543df3){var _0x59b1c7=_0x543df3[_0xf50e('0x24')],_0x3e8e47=_0x65bd32[_0xf50e('0x25')],_0x5374d1=_0x65bd32['offset']+_0x65bd32[_0xf50e('0x26')],_0x234d8a;if(_0x5374d1>=_0x59b1c7){_0x5374d1=_0x59b1c7;_0x234d8a=0xc8;}else{_0x234d8a=0xce;}_0x18b675[_0xf50e('0x22')](_0x234d8a);return _0x18b675[_0xf50e('0x27')](_0xf50e('0x28'),_0x3e8e47+'-'+_0x5374d1+'/'+_0x59b1c7)[_0xf50e('0x23')](_0x543df3);}return null;};}function patchUpdates(_0x1428d2){return function(_0x538462){try{jsonpatch['apply'](_0x538462,_0x1428d2,!![]);}catch(_0x5c7f32){return BPromise[_0xf50e('0x29')](_0x5c7f32);}return _0x538462[_0xf50e('0x2a')]();};}function saveUpdates(_0x40aed0,_0x589412){return function(_0x2f184c){if(_0x2f184c){return _0x2f184c[_0xf50e('0x2b')](_0x40aed0)['then'](function(_0x177242){return _0x177242;});}return null;};}function removeEntity(_0xffb883,_0x6a0180){return function(_0x474a98){if(_0x474a98){return _0x474a98[_0xf50e('0x2c')]()[_0xf50e('0x2d')](function(){_0xffb883[_0xf50e('0x22')](0xcc)[_0xf50e('0x2e')]();});}};}function handleEntityNotFound(_0x291afb,_0x476345){return function(_0x82c9f7){if(!_0x82c9f7){_0x291afb[_0xf50e('0x21')](0x194);}return _0x82c9f7;};}function handleError(_0x1a8a97,_0x460946){_0x460946=_0x460946||0x1f4;return function(_0x2135be){logger['error'](_0x2135be[_0xf50e('0x2f')]);if(_0x2135be[_0xf50e('0x30')]){delete _0x2135be['name'];}_0x1a8a97['status'](_0x460946)[_0xf50e('0x31')](_0x2135be);};}exports[_0xf50e('0x32')]=function(_0x1473f2,_0x1106d6){var _0x5a5cd9={},_0x33f024={},_0x58bd99={'count':0x0,'rows':[]};var _0x521a77=_['map'](db[_0xf50e('0x33')]['rawAttributes'],function(_0x272893){return{'name':_0x272893[_0xf50e('0x34')],'type':_0x272893[_0xf50e('0x35')][_0xf50e('0x36')]};});_0x33f024['model']=_[_0xf50e('0x37')](_0x521a77,_0xf50e('0x30'));_0x33f024[_0xf50e('0x38')]=_[_0xf50e('0x39')](_0x1473f2['query']);_0x33f024[_0xf50e('0x3a')]=_[_0xf50e('0x3b')](_0x33f024['model'],_0x33f024['query']);_0x5a5cd9[_0xf50e('0x3c')]=_['intersection'](_0x33f024[_0xf50e('0x3d')],qs['fields'](_0x1473f2[_0xf50e('0x38')][_0xf50e('0x3e')]));_0x5a5cd9['attributes']=_0x5a5cd9[_0xf50e('0x3c')][_0xf50e('0x3f')]?_0x5a5cd9[_0xf50e('0x3c')]:_0x33f024['model'];if(!_0x1473f2[_0xf50e('0x38')][_0xf50e('0x40')](_0xf50e('0x41'))){_0x5a5cd9['limit']=qs['limit'](_0x1473f2[_0xf50e('0x38')]['limit']);_0x5a5cd9[_0xf50e('0x25')]=qs[_0xf50e('0x25')](_0x1473f2[_0xf50e('0x38')][_0xf50e('0x25')]);}_0x5a5cd9[_0xf50e('0x42')]=qs[_0xf50e('0x43')](_0x1473f2[_0xf50e('0x38')][_0xf50e('0x43')]);_0x5a5cd9['where']=qs[_0xf50e('0x3a')](_[_0xf50e('0x44')](_0x1473f2[_0xf50e('0x38')],_0x33f024[_0xf50e('0x3a')]),_0x521a77);if(_0x1473f2['query'][_0xf50e('0x45')]){_0x5a5cd9[_0xf50e('0x46')]=_[_0xf50e('0x47')](_0x5a5cd9[_0xf50e('0x46')],{'$or':_['map'](_0x521a77,function(_0x3528cb){if(_0x3528cb[_0xf50e('0x35')]!==_0xf50e('0x48')){var _0x247685={};_0x247685[_0x3528cb[_0xf50e('0x30')]]={'$like':'%'+_0x1473f2[_0xf50e('0x38')][_0xf50e('0x45')]+'%'};return _0x247685;}})});}_0x5a5cd9=_[_0xf50e('0x47')]({},_0x5a5cd9,_0x1473f2[_0xf50e('0x49')]);var _0x45326c={'where':_0x5a5cd9[_0xf50e('0x46')]};return db[_0xf50e('0x33')][_0xf50e('0x24')](_0x45326c)[_0xf50e('0x2d')](function(_0x57170d){_0x58bd99['count']=_0x57170d;if(_0x1473f2[_0xf50e('0x38')][_0xf50e('0x4a')]){_0x5a5cd9['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0xf50e('0x4b')](_0x5a5cd9);})['then'](function(_0x571b9a){_0x58bd99[_0xf50e('0x4c')]=_0x571b9a;return _0x58bd99;})[_0xf50e('0x2d')](respondWithFilteredResult(_0x1106d6,_0x5a5cd9))['catch'](handleError(_0x1106d6,null));};exports[_0xf50e('0x4d')]=function(_0x5c76bb,_0x1ef68e){var _0x3b9ec6={'raw':!![],'where':{'id':_0x5c76bb[_0xf50e('0x4e')]['id']}},_0x1aece4={};_0x1aece4[_0xf50e('0x3d')]=_['keys'](db[_0xf50e('0x33')]['rawAttributes']);_0x1aece4[_0xf50e('0x38')]=_[_0xf50e('0x39')](_0x5c76bb[_0xf50e('0x38')]);_0x1aece4[_0xf50e('0x3a')]=_[_0xf50e('0x3b')](_0x1aece4[_0xf50e('0x3d')],_0x1aece4[_0xf50e('0x38')]);_0x3b9ec6[_0xf50e('0x3c')]=_[_0xf50e('0x3b')](_0x1aece4[_0xf50e('0x3d')],qs[_0xf50e('0x3e')](_0x5c76bb[_0xf50e('0x38')][_0xf50e('0x3e')]));_0x3b9ec6[_0xf50e('0x3c')]=_0x3b9ec6[_0xf50e('0x3c')][_0xf50e('0x3f')]?_0x3b9ec6[_0xf50e('0x3c')]:_0x1aece4[_0xf50e('0x3d')];if(_0x5c76bb[_0xf50e('0x38')][_0xf50e('0x4a')]){_0x3b9ec6['include']=[{'all':!![]}];}_0x3b9ec6=_['merge']({},_0x3b9ec6,_0x5c76bb[_0xf50e('0x49')]);return db[_0xf50e('0x33')][_0xf50e('0x4f')](_0x3b9ec6)[_0xf50e('0x2d')](handleEntityNotFound(_0x1ef68e,null))['then'](respondWithResult(_0x1ef68e,null))[_0xf50e('0x50')](handleError(_0x1ef68e,null));};exports[_0xf50e('0x51')]=function(_0x284b14,_0x2084ee){return db[_0xf50e('0x33')][_0xf50e('0x51')](_0x284b14['body'],{})[_0xf50e('0x2d')](respondWithResult(_0x2084ee,0xc9))[_0xf50e('0x50')](handleError(_0x2084ee,null));};exports['update']=function(_0x21c47c,_0x3f02e1){if(_0x21c47c['body']['id']){delete _0x21c47c[_0xf50e('0x52')]['id'];}return db[_0xf50e('0x33')][_0xf50e('0x4f')]({'where':{'id':_0x21c47c[_0xf50e('0x4e')]['id']}})[_0xf50e('0x2d')](handleEntityNotFound(_0x3f02e1,null))[_0xf50e('0x2d')](saveUpdates(_0x21c47c[_0xf50e('0x52')],null))[_0xf50e('0x2d')](respondWithResult(_0x3f02e1,null))['catch'](handleError(_0x3f02e1,null));};exports[_0xf50e('0x2c')]=function(_0x35be80,_0xc6b20d){return db[_0xf50e('0x33')][_0xf50e('0x4f')]({'where':{'id':_0x35be80[_0xf50e('0x4e')]['id']}})[_0xf50e('0x2d')](handleEntityNotFound(_0xc6b20d,null))['then'](removeEntity(_0xc6b20d,null))['catch'](handleError(_0xc6b20d,null));};exports[_0xf50e('0x53')]=function(_0x438f09,_0x542219){return db[_0xf50e('0x33')][_0xf50e('0x53')]()[_0xf50e('0x2d')](respondWithResult(_0x542219,null))[_0xf50e('0x50')](handleError(_0x542219,null));};function wrapUser(_0x3bc442){return function(_0x28562e){var _0x206037=_0x3bc442[_0xf50e('0x54')]({'plain':!![]});_0x206037[_0xf50e('0x55')]=[];if(_0x28562e){_0x206037[_0xf50e('0x56')]=_0x28562e['createdAt'];_0x206037[_0xf50e('0x57')]=_0x28562e;}else{_0x206037[_0xf50e('0x56')]=moment(0x0)[_0xf50e('0x58')](_0xf50e('0x59'));_0x206037['lastMessage']={};}return _0x206037;};}exports[_0xf50e('0x5a')]=function(_0x43ace3,_0x902dd3,_0x3979c6){var _0x495835=[];return db[_0xf50e('0x5b')][_0xf50e('0x4b')]({'where':{'role':[_0xf50e('0x5c'),'admin',_0xf50e('0x5d')]},'attributes':['id',_0xf50e('0x5e'),_0xf50e('0x30'),_0xf50e('0x5f'),_0xf50e('0x60'),'internal','online','lastLoginAt',_0xf50e('0x61'),_0xf50e('0x62')],'order':qs['sort']('-online'),'include':[{'model':db[_0xf50e('0x63')],'as':_0xf50e('0x64'),'attributes':['id',_0xf50e('0x30'),'type'],'through':{'attributes':[]}}]})[_0xf50e('0x2d')](function(_0x50c8b2){if(_0x50c8b2){var _0x23ec32=_0x43ace3['user'][_0xf50e('0x54')]({'plain':!![]});if(!_0x23ec32)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23ec32[_0xf50e('0x5f')]===_0xf50e('0x5d')){return db[_0xf50e('0x65')][_0xf50e('0x4f')]({'where':{'name':_0xf50e('0x66'),'userProfileId':_0x23ec32[_0xf50e('0x67')]},'raw':!![]})['then'](function(_0x474028){if(_0x474028){if(_0x474028[_0xf50e('0x68')]===0x0){return db[_0xf50e('0x69')][_0xf50e('0x4b')]({'where':{'sectionId':_0x474028['id']},'raw':!![]})['then'](function(_0x4f6c8e){var _0x3ef47b=[];if(_[_0xf50e('0x6a')](_0x4f6c8e)){_0x3ef47b=_[_0xf50e('0x45')](_0x50c8b2,function(_0x489424){if(_0x489424[_0xf50e('0x5f')]!==_0xf50e('0x5c')){return _0x489424;}});return _0x3ef47b;}else{for(var _0x38858a=0x0;_0x38858a<_0x50c8b2[_0xf50e('0x3f')];_0x38858a++){var _0x21abd9=_0x50c8b2[_0x38858a];if(_0x21abd9[_0xf50e('0x5f')]===_0xf50e('0x5c')){var _0xbff751=_[_0xf50e('0x4f')](_0x4f6c8e,function(_0x788d66){return _0x788d66[_0xf50e('0x6b')]===_0x21abd9['id'];});if(_0xbff751)_0x3ef47b[_0xf50e('0x6c')](_0x21abd9);}else{_0x3ef47b[_0xf50e('0x6c')](_0x21abd9);}}return _0x3ef47b;}});}else{return _0x50c8b2;}}else{var _0x2b4200=_[_0xf50e('0x45')](_0x50c8b2,function(_0x2199f4){if(_0x2199f4[_0xf50e('0x5f')]!==_0xf50e('0x5c')){return _0x2199f4;}});return _0x2b4200;}});}else{return _0x50c8b2;}}})[_0xf50e('0x2d')](function(_0x55c7d4){var _0x54a4a3=[];if(_0x55c7d4){_0x495835=_0x55c7d4;for(var _0x2466b1=0x0;_0x2466b1<_0x55c7d4['length'];_0x2466b1+=0x1){_0x495835[_0x2466b1][_0xf50e('0x55')]=[];_0x54a4a3[_0xf50e('0x6c')](db[_0xf50e('0x33')]['find']({'where':{'FromId':[_0x43ace3[_0xf50e('0x5d')]['id'],_0x55c7d4[_0x2466b1]['id']],'ToId':[_0x43ace3['user']['id'],_0x55c7d4[_0x2466b1]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xf50e('0x6d'),_0xf50e('0x6e'),_0xf50e('0x6f'),'body'],'order':qs[_0xf50e('0x43')](_0xf50e('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf50e('0x2d')](wrapUser(_0x55c7d4[_0x2466b1])));}return BPromise[_0xf50e('0x71')](_0x54a4a3);}return[];})[_0xf50e('0x2d')](function(_0x214e64){return{'rows':_0x214e64,'count':_0x214e64[_0xf50e('0x3f')]};})['then'](respondWithResult(_0x902dd3,null))[_0xf50e('0x50')](handleError(_0x902dd3,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 991e381..66878ad 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 _0x27a8=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','ChatInternalMessage'];(function(_0x71db89,_0x57632){var _0x181bc5=function(_0x5a4faa){while(--_0x5a4faa){_0x71db89['push'](_0x71db89['shift']());}};_0x181bc5(++_0x57632);}(_0x27a8,0x170));var _0x827a=function(_0x48c2f4,_0x531033){_0x48c2f4=_0x48c2f4-0x0;var _0x258e2a=_0x27a8[_0x48c2f4];return _0x258e2a;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x827a('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x827a('0x1')](0x0);var events={'afterCreate':_0x827a('0x2'),'afterUpdate':_0x827a('0x3'),'afterDestroy':_0x827a('0x4')};function emitEvent(_0x300907){return function(_0x18cf5e,_0x215b35,_0x2b3486){ChatInternalMessageEvents[_0x827a('0x5')](_0x300907+':'+_0x18cf5e['id'],_0x18cf5e);ChatInternalMessageEvents[_0x827a('0x5')](_0x300907,_0x18cf5e);_0x2b3486(null);};}for(var e in events){if(events[_0x827a('0x6')](e)){var event=events[e];ChatInternalMessage[_0x827a('0x7')](e,emitEvent(event));}}module[_0x827a('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x1952=['hook','exports','../../mysqldb','ChatInternalMessage','save','remove','emit','hasOwnProperty'];(function(_0x1317a5,_0xd5c0a3){var _0x53ca23=function(_0x316f62){while(--_0x316f62){_0x1317a5['push'](_0x1317a5['shift']());}};_0x53ca23(++_0xd5c0a3);}(_0x1952,0x92));var _0x2195=function(_0x2a1cd9,_0x451f12){_0x2a1cd9=_0x2a1cd9-0x0;var _0x1ca137=_0x1952[_0x2a1cd9];return _0x1ca137;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x2195('0x0'))['db'][_0x2195('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2195('0x2'),'afterUpdate':'update','afterDestroy':_0x2195('0x3')};function emitEvent(_0x4b36ae){return function(_0x4f994a,_0x1d05d0,_0x26965d){ChatInternalMessageEvents['emit'](_0x4b36ae+':'+_0x4f994a['id'],_0x4f994a);ChatInternalMessageEvents[_0x2195('0x4')](_0x4b36ae,_0x4f994a);_0x26965d(null);};}for(var e in events){if(events[_0x2195('0x5')](e)){var event=events[e];ChatInternalMessage[_0x2195('0x6')](e,emitEvent(event));}}module[_0x2195('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 533de05..2dcb676 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 _0xaa88=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage'];(function(_0x43357f,_0x305c29){var _0x464c70=function(_0x408c20){while(--_0x408c20){_0x43357f['push'](_0x43357f['shift']());}};_0x464c70(++_0x305c29);}(_0xaa88,0x137));var _0x8aa8=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0xaa88[_0x5c2a2b];return _0x19921f;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8aa8('0xc'),'collate':_0x8aa8('0xd')});}; \ No newline at end of file +var _0xda3f=['../../config/environment','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','rimraf'];(function(_0x401e83,_0xc6d9c5){var _0x3cc505=function(_0xa53231){while(--_0xa53231){_0x401e83['push'](_0x401e83['shift']());}};_0x3cc505(++_0xc6d9c5);}(_0xda3f,0xec));var _0xfda3=function(_0xb36f62,_0x45e89c){_0xb36f62=_0xb36f62-0x0;var _0xbf0171=_0xda3f[_0xb36f62];return _0xbf0171;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfda3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var attributes=require('./chatInternalMessage.attributes');module[_0xfda3('0x5')]=function(_0x43a010,_0x47e7e2){return _0x43a010['define'](_0xfda3('0x6'),attributes,{'tableName':_0xfda3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfda3('0x8'),'collate':_0xfda3('0x9')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 6d908b3..05a37ba 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 _0xebb2=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0xb26ec4,_0x34f43d){var _0x572b66=function(_0x3eeab2){while(--_0x3eeab2){_0xb26ec4['push'](_0xb26ec4['shift']());}};_0x572b66(++_0x34f43d);}(_0xebb2,0x19d));var _0x2ebb=function(_0x30b816,_0x2f4650){_0x30b816=_0x30b816-0x0;var _0x14e76c=_0xebb2[_0x30b816];return _0x14e76c;};'use strict';var _=require(_0x2ebb('0x0'));var util=require(_0x2ebb('0x1'));var moment=require(_0x2ebb('0x2'));var BPromise=require(_0x2ebb('0x3'));var rs=require(_0x2ebb('0x4'));var fs=require('fs');var Redis=require(_0x2ebb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ebb('0x6'));var logger=require(_0x2ebb('0x7'))('rpc');var config=require(_0x2ebb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2ebb('0x9')]['http']({'port':0x232a});config[_0x2ebb('0xa')]=_[_0x2ebb('0xb')](config[_0x2ebb('0xa')],{'host':_0x2ebb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2ebb('0xd'))['register'](socket);function respondWithRpcPromise(_0x40efbf,_0x5e6aff,_0x1011c6){return new BPromise(function(_0x41bb01,_0x34b0ab){return client[_0x2ebb('0xe')](_0x40efbf,_0x1011c6)[_0x2ebb('0xf')](function(_0x26ef15){logger[_0x2ebb('0x10')](_0x2ebb('0x11'),_0x5e6aff,_0x2ebb('0x12'));logger[_0x2ebb('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5e6aff,'request\x20sent',JSON[_0x2ebb('0x14')](_0x26ef15));if(_0x26ef15['error']){if(_0x26ef15[_0x2ebb('0x15')][_0x2ebb('0x16')]===0x1f4){logger[_0x2ebb('0x15')](_0x2ebb('0x11'),_0x5e6aff,_0x26ef15[_0x2ebb('0x15')][_0x2ebb('0x17')]);return _0x34b0ab(_0x26ef15[_0x2ebb('0x15')][_0x2ebb('0x17')]);}logger[_0x2ebb('0x15')](_0x2ebb('0x11'),_0x5e6aff,_0x26ef15[_0x2ebb('0x15')]['message']);return _0x41bb01(_0x26ef15[_0x2ebb('0x15')][_0x2ebb('0x17')]);}else{logger[_0x2ebb('0x10')](_0x2ebb('0x11'),_0x5e6aff,_0x2ebb('0x12'));_0x41bb01(_0x26ef15[_0x2ebb('0x18')][_0x2ebb('0x17')]);}})[_0x2ebb('0x19')](function(_0x3a827e){logger[_0x2ebb('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x5e6aff,_0x3a827e);_0x34b0ab(_0x3a827e);});});} \ No newline at end of file +var _0x3689=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','request','info','ChatInternalMessage,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x2d1e05,_0x3d9540){var _0x53e720=function(_0x27a7d1){while(--_0x27a7d1){_0x2d1e05['push'](_0x2d1e05['shift']());}};_0x53e720(++_0x3d9540);}(_0x3689,0x1ef));var _0x9368=function(_0x1740c0,_0x3fb191){_0x1740c0=_0x1740c0-0x0;var _0x2c4f30=_0x3689[_0x1740c0];return _0x2c4f30;};'use strict';var _=require(_0x9368('0x0'));var util=require(_0x9368('0x1'));var moment=require(_0x9368('0x2'));var BPromise=require(_0x9368('0x3'));var rs=require(_0x9368('0x4'));var fs=require('fs');var Redis=require(_0x9368('0x5'));var db=require(_0x9368('0x6'))['db'];var utils=require(_0x9368('0x7'));var logger=require(_0x9368('0x8'))(_0x9368('0x9'));var config=require('../../config/environment');var jayson=require(_0x9368('0xa'));var client=jayson[_0x9368('0xb')]['http']({'port':0x232a});config[_0x9368('0xc')]=_[_0x9368('0xd')](config[_0x9368('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9368('0xe'))(new Redis(config['redis']));require(_0x9368('0xf'))['register'](socket);function respondWithRpcPromise(_0x14f29e,_0x88bda,_0x3a01ad){return new BPromise(function(_0x255b3c,_0x538b89){return client[_0x9368('0x10')](_0x14f29e,_0x3a01ad)['then'](function(_0x5a7bb4){logger[_0x9368('0x11')](_0x9368('0x12'),_0x88bda,'request\x20sent');logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x88bda,'request\x20sent',JSON[_0x9368('0x13')](_0x5a7bb4));if(_0x5a7bb4[_0x9368('0x14')]){if(_0x5a7bb4[_0x9368('0x14')][_0x9368('0x15')]===0x1f4){logger[_0x9368('0x14')](_0x9368('0x12'),_0x88bda,_0x5a7bb4[_0x9368('0x14')][_0x9368('0x16')]);return _0x538b89(_0x5a7bb4['error']['message']);}logger[_0x9368('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x88bda,_0x5a7bb4[_0x9368('0x14')][_0x9368('0x16')]);return _0x255b3c(_0x5a7bb4[_0x9368('0x14')]['message']);}else{logger[_0x9368('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x88bda,_0x9368('0x17'));_0x255b3c(_0x5a7bb4[_0x9368('0x18')][_0x9368('0x16')]);}})[_0x9368('0x19')](function(_0x4a9272){logger[_0x9368('0x14')](_0x9368('0x12'),_0x88bda,_0x4a9272);_0x538b89(_0x4a9272);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index d7f05da..9ea3454 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 _0xbc17=['./chatInternalMessage.events','save','update','emit','removeListener','length','chatInternalMessage:'];(function(_0x36a907,_0x53da75){var _0x2f0962=function(_0x464677){while(--_0x464677){_0x36a907['push'](_0x36a907['shift']());}};_0x2f0962(++_0x53da75);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x578a80,_0x412698){_0x578a80=_0x578a80-0x0;var _0x4b4ba8=_0xbc17[_0x578a80];return _0x4b4ba8;};'use strict';var ChatInternalMessageEvents=require(_0x7bc1('0x0'));var events=[_0x7bc1('0x1'),'remove',_0x7bc1('0x2')];function createListener(_0xa0421d,_0x5185e7){return function(_0x4b1479){_0x5185e7[_0x7bc1('0x3')](_0xa0421d,_0x4b1479);};}function removeListener(_0x7aa41e,_0x5dfaa8){return function(){ChatInternalMessageEvents[_0x7bc1('0x4')](_0x7aa41e,_0x5dfaa8);};}exports['register']=function(_0xba4fa8){for(var _0xcecb62=0x0,_0x1b720f=events[_0x7bc1('0x5')];_0xcecb62<_0x1b720f;_0xcecb62++){var _0x3fdce7=events[_0xcecb62];var _0x351340=createListener(_0x7bc1('0x6')+_0x3fdce7,_0xba4fa8);ChatInternalMessageEvents['on'](_0x3fdce7,_0x351340);}}; \ No newline at end of file +var _0x3098=['remove','update','emit','removeListener','register','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3098,0x86));var _0x8309=function(_0x10bcc4,_0x4400e2){_0x10bcc4=_0x10bcc4-0x0;var _0x2da988=_0x3098[_0x10bcc4];return _0x2da988;};'use strict';var ChatInternalMessageEvents=require(_0x8309('0x0'));var events=[_0x8309('0x1'),_0x8309('0x2'),_0x8309('0x3')];function createListener(_0x4b9381,_0x316d5c){return function(_0x2ebbd9){_0x316d5c[_0x8309('0x4')](_0x4b9381,_0x2ebbd9);};}function removeListener(_0x2e58f5,_0x1e658e){return function(){ChatInternalMessageEvents[_0x8309('0x5')](_0x2e58f5,_0x1e658e);};}exports[_0x8309('0x6')]=function(_0x2ddf0b){for(var _0x2aa50b=0x0,_0x1e9ac6=events['length'];_0x2aa50b<_0x1e9ac6;_0x2aa50b++){var _0x35ca92=events[_0x2aa50b];var _0x5c2cd1=createListener(_0x8309('0x7')+_0x35ca92,_0x2ddf0b);ChatInternalMessageEvents['on'](_0x35ca92,_0x5c2cd1);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7be5efa..d08d56b 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 _0xbce7=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','get','isAuthenticated','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x441c2b,_0x55b78d){var _0x2ec518=function(_0x343917){while(--_0x343917){_0x441c2b['push'](_0x441c2b['shift']());}};_0x2ec518(++_0x55b78d);}(_0xbce7,0x163));var _0x7bce=function(_0x20255b,_0x52aa07){_0x20255b=_0x20255b-0x0;var _0x81fe0a=_0xbce7[_0x20255b];return _0x81fe0a;};'use strict';var multer=require(_0x7bce('0x0'));var util=require(_0x7bce('0x1'));var path=require('path');var timeout=require(_0x7bce('0x2'));var express=require('express');var router=express[_0x7bce('0x3')]();var fs_extra=require(_0x7bce('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7bce('0x5'));var config=require(_0x7bce('0x6'));var controller=require(_0x7bce('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bce('0x8')]);router[_0x7bce('0x9')]('/describe',auth[_0x7bce('0xa')](),controller['describe']);router[_0x7bce('0x9')](_0x7bce('0xb'),auth['isAuthenticated'](),controller[_0x7bce('0xc')]);router[_0x7bce('0x9')](_0x7bce('0xd'),auth[_0x7bce('0xa')](),controller[_0x7bce('0xe')]);router[_0x7bce('0xf')]('/',auth[_0x7bce('0xa')](),controller[_0x7bce('0x10')]);router[_0x7bce('0x11')]('/:id',controller[_0x7bce('0x12')]);router[_0x7bce('0x13')](_0x7bce('0xd'),auth[_0x7bce('0xa')](),controller[_0x7bce('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb5a2=['Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','describe','getUsers','show','post','put','/:id','update','delete','multer','util','path','connect-timeout','express'];(function(_0x55dd09,_0x259fe1){var _0x4face3=function(_0xfd3b59){while(--_0xfd3b59){_0x55dd09['push'](_0x55dd09['shift']());}};_0x4face3(++_0x259fe1);}(_0xb5a2,0x73));var _0x2b5a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb5a2[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x2b5a('0x0'));var util=require(_0x2b5a('0x1'));var path=require(_0x2b5a('0x2'));var timeout=require(_0x2b5a('0x3'));var express=require(_0x2b5a('0x4'));var router=express[_0x2b5a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2b5a('0x6'));var interaction=require(_0x2b5a('0x7'));var config=require('../../config/environment');var controller=require(_0x2b5a('0x8'));router[_0x2b5a('0x9')]('/',auth[_0x2b5a('0xa')](),controller[_0x2b5a('0xb')]);router[_0x2b5a('0x9')]('/describe',auth[_0x2b5a('0xa')](),controller[_0x2b5a('0xc')]);router[_0x2b5a('0x9')]('/users',auth['isAuthenticated'](),controller[_0x2b5a('0xd')]);router[_0x2b5a('0x9')]('/:id',auth[_0x2b5a('0xa')](),controller[_0x2b5a('0xe')]);router[_0x2b5a('0xf')]('/',auth[_0x2b5a('0xa')](),controller['create']);router[_0x2b5a('0x10')](_0x2b5a('0x11'),controller[_0x2b5a('0x12')]);router[_0x2b5a('0x13')](_0x2b5a('0x11'),auth[_0x2b5a('0xa')](),controller['destroy']);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 eb6d6a4..620cf8e 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 _0x9772=['TEXT','medium','BOOLEAN','ENUM','out','DATE','exports'];(function(_0x2726ad,_0x5073b1){var _0xd87993=function(_0x1cb35b){while(--_0x1cb35b){_0x2726ad['push'](_0x2726ad['shift']());}};_0xd87993(++_0x5073b1);}(_0x9772,0xbc));var _0x2977=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x9772[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require('sequelize');module[_0x2977('0x0')]={'body':{'type':Sequelize[_0x2977('0x1')](_0x2977('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2977('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x2977('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2977('0x4')]('in','out'),'defaultValue':_0x2977('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2977('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb9aa=['DATE','STRING','TEXT','sequelize','BOOLEAN','out'];(function(_0x5dcd5f,_0x570156){var _0x39ff3b=function(_0x585223){while(--_0x585223){_0x5dcd5f['push'](_0x5dcd5f['shift']());}};_0x39ff3b(++_0x570156);}(_0xb9aa,0xe7));var _0xab9a=function(_0x1a2a2e,_0x2c2390){_0x1a2a2e=_0x1a2a2e-0x0;var _0x5b0310=_0xb9aa[_0x1a2a2e];return _0x5b0310;};'use strict';var Sequelize=require(_0xab9a('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xab9a('0x1')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xab9a('0x2')),'defaultValue':_0xab9a('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0xab9a('0x3')]},'providerName':{'type':Sequelize[_0xab9a('0x4')]},'providerResponse':{'type':Sequelize[_0xab9a('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8c866be..3be0914 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 _0xf6ef=['find','create','body','params','destroy','describe','chat-interactions','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','ChatInteractionId','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','json','count','set','Content-Range','apply','reject','save','update','end','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','type','VIRTUAL','merge','options','ChatMessage','includeAll','include','rows','show','rawAttributes'];(function(_0x25955a,_0x1383b3){var _0x2a6aca=function(_0x555130){while(--_0x555130){_0x25955a['push'](_0x25955a['shift']());}};_0x2a6aca(++_0x1383b3);}(_0xf6ef,0x117));var _0xff6e=function(_0x363dee,_0x4d1a44){_0x363dee=_0x363dee-0x0;var _0x31ae44=_0xf6ef[_0x363dee];return _0x31ae44;};'use strict';var pdf=require(_0xff6e('0x0'));var emlformat=require(_0xff6e('0x1'));var rimraf=require(_0xff6e('0x2'));var zipdir=require(_0xff6e('0x3'));var jsonpatch=require(_0xff6e('0x4'));var rp=require(_0xff6e('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xff6e('0x6'));var util=require(_0xff6e('0x7'));var path=require(_0xff6e('0x8'));var sox=require(_0xff6e('0x9'));var csv=require(_0xff6e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff6e('0xb'));var _=require('lodash');var squel=require(_0xff6e('0xc'));var crypto=require('crypto');var jsforce=require(_0xff6e('0xd'));var deskjs=require(_0xff6e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xff6e('0xf'));var Papa=require('papaparse');var Redis=require(_0xff6e('0x10'));var authService=require(_0xff6e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xff6e('0x12'));var hardwareService=require(_0xff6e('0x13'));var logger=require(_0xff6e('0x14'))(_0xff6e('0x15'));var utils=require(_0xff6e('0x16'));var config=require(_0xff6e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xff6e('0x18'))['db'];config[_0xff6e('0x19')]=_[_0xff6e('0x1a')](config[_0xff6e('0x19')],{'host':_0xff6e('0x1b'),'port':0x18eb});var socket=require(_0xff6e('0x1c'))(new Redis(config[_0xff6e('0x19')]));require(_0xff6e('0x1d'))[_0xff6e('0x1e')](socket);var jayson=require(_0xff6e('0x1f'));var client=jayson[_0xff6e('0x20')][_0xff6e('0x21')]({'port':0x232c});var client9002=jayson[_0xff6e('0x20')][_0xff6e('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5402f5,_0x534668,_0x74e08a,_0x427094){return new BPromise(function(_0x944ba6,_0x6d211a){var _0x9469be=_0x427094||client;return _0x9469be[_0xff6e('0x22')](_0x5402f5,_0x74e08a)[_0xff6e('0x23')](function(_0x249755){logger[_0xff6e('0x24')](_0xff6e('0x25'),_0x534668,'request\x20sent');logger[_0xff6e('0x26')](_0xff6e('0x27'),_0x534668,_0xff6e('0x28'),JSON['stringify'](_0x249755));if(_0x249755[_0xff6e('0x29')]){if(_0x249755[_0xff6e('0x29')]['code']===0x1f4){logger[_0xff6e('0x29')](_0xff6e('0x25'),_0x534668,_0x249755[_0xff6e('0x29')][_0xff6e('0x2a')]);return _0x6d211a(_0x249755[_0xff6e('0x29')][_0xff6e('0x2a')]);}logger[_0xff6e('0x29')]('ChatMessage,\x20%s,\x20%s',_0x534668,_0x249755[_0xff6e('0x29')][_0xff6e('0x2a')]);return _0x944ba6(_0x249755[_0xff6e('0x29')][_0xff6e('0x2a')]);}else{logger[_0xff6e('0x24')](_0xff6e('0x25'),_0x534668,_0xff6e('0x28'));_0x944ba6(_0x249755[_0xff6e('0x2b')][_0xff6e('0x2a')]);}})[_0xff6e('0x2c')](function(_0x3d0515){logger[_0xff6e('0x29')](_0xff6e('0x25'),_0x534668,_0x3d0515);_0x6d211a(_0x3d0515);});});}function respondWithStatusCode(_0x1d818e,_0x4ab195){_0x4ab195=_0x4ab195||0xcc;return function(_0x373efe){if(_0x373efe){return _0x1d818e[_0xff6e('0x2d')](_0x4ab195);}return _0x1d818e[_0xff6e('0x2e')](_0x4ab195)['end']();};}function respondWithResult(_0xdf7c1f,_0x5e3e56){_0x5e3e56=_0x5e3e56||0xc8;return function(_0x1b0b04){if(_0x1b0b04){return _0xdf7c1f[_0xff6e('0x2e')](_0x5e3e56)[_0xff6e('0x2f')](_0x1b0b04);}};}function respondWithFilteredResult(_0x47ef4c,_0x24a339){return function(_0x57829f){if(_0x57829f){var _0x3d148c=_0x57829f[_0xff6e('0x30')],_0x2dd7bf=_0x24a339['offset'],_0x4df50b=_0x24a339['offset']+_0x24a339['limit'],_0x1043f4;if(_0x4df50b>=_0x3d148c){_0x4df50b=_0x3d148c;_0x1043f4=0xc8;}else{_0x1043f4=0xce;}_0x47ef4c[_0xff6e('0x2e')](_0x1043f4);return _0x47ef4c[_0xff6e('0x31')](_0xff6e('0x32'),_0x2dd7bf+'-'+_0x4df50b+'/'+_0x3d148c)[_0xff6e('0x2f')](_0x57829f);}return null;};}function patchUpdates(_0x2be4e6){return function(_0x4c050e){try{jsonpatch[_0xff6e('0x33')](_0x4c050e,_0x2be4e6,!![]);}catch(_0x5bc304){return BPromise[_0xff6e('0x34')](_0x5bc304);}return _0x4c050e[_0xff6e('0x35')]();};}function saveUpdates(_0x50fdca,_0x17c717){return function(_0x150a08){if(_0x150a08){return _0x150a08[_0xff6e('0x36')](_0x50fdca)[_0xff6e('0x23')](function(_0x534260){return _0x534260;});}return null;};}function removeEntity(_0x4b7b23,_0x31a48b){return function(_0x476bcc){if(_0x476bcc){return _0x476bcc['destroy']()[_0xff6e('0x23')](function(){_0x4b7b23[_0xff6e('0x2e')](0xcc)[_0xff6e('0x37')]();});}};}function handleEntityNotFound(_0x2f1b50,_0x209378){return function(_0x1449f7){if(!_0x1449f7){_0x2f1b50[_0xff6e('0x2d')](0x194);}return _0x1449f7;};}function handleError(_0x5cdeb0,_0x212534){_0x212534=_0x212534||0x1f4;return function(_0x19c1e0){logger['error'](_0x19c1e0[_0xff6e('0x38')]);if(_0x19c1e0[_0xff6e('0x39')]){delete _0x19c1e0[_0xff6e('0x39')];}_0x5cdeb0[_0xff6e('0x2e')](_0x212534)[_0xff6e('0x3a')](_0x19c1e0);};}exports[_0xff6e('0x3b')]=function(_0x426d9a,_0x5648e6){var _0x13b04a={},_0x2466ee={},_0x807d73={'count':0x0,'rows':[]};var _0x52ec12=_[_0xff6e('0x3c')](db['ChatMessage']['rawAttributes'],function(_0x240a64){return{'name':_0x240a64[_0xff6e('0x3d')],'type':_0x240a64['type'][_0xff6e('0x3e')]};});_0x2466ee[_0xff6e('0x3f')]=_[_0xff6e('0x3c')](_0x52ec12,_0xff6e('0x39'));_0x2466ee[_0xff6e('0x40')]=_[_0xff6e('0x41')](_0x426d9a[_0xff6e('0x40')]);_0x2466ee[_0xff6e('0x42')]=_[_0xff6e('0x43')](_0x2466ee['model'],_0x2466ee[_0xff6e('0x40')]);_0x13b04a['attributes']=_[_0xff6e('0x43')](_0x2466ee[_0xff6e('0x3f')],qs['fields'](_0x426d9a[_0xff6e('0x40')][_0xff6e('0x44')]));_0x13b04a['attributes']=_0x13b04a[_0xff6e('0x45')][_0xff6e('0x46')]?_0x13b04a[_0xff6e('0x45')]:_0x2466ee['model'];if(!_0x426d9a['query'][_0xff6e('0x47')]('nolimit')){_0x13b04a['limit']=qs['limit'](_0x426d9a[_0xff6e('0x40')]['limit']);_0x13b04a[_0xff6e('0x48')]=qs[_0xff6e('0x48')](_0x426d9a['query'][_0xff6e('0x48')]);}_0x13b04a[_0xff6e('0x49')]=qs['sort'](_0x426d9a['query'][_0xff6e('0x4a')]);_0x13b04a[_0xff6e('0x4b')]=qs[_0xff6e('0x42')](_[_0xff6e('0x4c')](_0x426d9a[_0xff6e('0x40')],_0x2466ee['filters']),_0x52ec12);if(_0x426d9a[_0xff6e('0x40')]['filter']){_0x13b04a[_0xff6e('0x4b')]=_['merge'](_0x13b04a[_0xff6e('0x4b')],{'$or':_[_0xff6e('0x3c')](_0x52ec12,function(_0x558985){if(_0x558985[_0xff6e('0x4d')]!==_0xff6e('0x4e')){var _0x563c10={};_0x563c10[_0x558985[_0xff6e('0x39')]]={'$like':'%'+_0x426d9a[_0xff6e('0x40')]['filter']+'%'};return _0x563c10;}})});}_0x13b04a=_[_0xff6e('0x4f')]({},_0x13b04a,_0x426d9a[_0xff6e('0x50')]);var _0xe738ac={'where':_0x13b04a['where']};return db[_0xff6e('0x51')][_0xff6e('0x30')](_0xe738ac)[_0xff6e('0x23')](function(_0x32ce63){_0x807d73['count']=_0x32ce63;if(_0x426d9a[_0xff6e('0x40')][_0xff6e('0x52')]){_0x13b04a[_0xff6e('0x53')]=[{'all':!![]}];}return db[_0xff6e('0x51')]['findAll'](_0x13b04a);})['then'](function(_0x1559b0){_0x807d73[_0xff6e('0x54')]=_0x1559b0;return _0x807d73;})[_0xff6e('0x23')](respondWithFilteredResult(_0x5648e6,_0x13b04a))[_0xff6e('0x2c')](handleError(_0x5648e6,null));};exports[_0xff6e('0x55')]=function(_0x322bf1,_0x5d96c6){var _0x52111b={'raw':!![],'where':{'id':_0x322bf1['params']['id']}},_0x5efc87={};_0x5efc87[_0xff6e('0x3f')]=_[_0xff6e('0x41')](db['ChatMessage'][_0xff6e('0x56')]);_0x5efc87[_0xff6e('0x40')]=_['keys'](_0x322bf1[_0xff6e('0x40')]);_0x5efc87[_0xff6e('0x42')]=_[_0xff6e('0x43')](_0x5efc87[_0xff6e('0x3f')],_0x5efc87[_0xff6e('0x40')]);_0x52111b[_0xff6e('0x45')]=_[_0xff6e('0x43')](_0x5efc87[_0xff6e('0x3f')],qs[_0xff6e('0x44')](_0x322bf1[_0xff6e('0x40')][_0xff6e('0x44')]));_0x52111b['attributes']=_0x52111b['attributes'][_0xff6e('0x46')]?_0x52111b[_0xff6e('0x45')]:_0x5efc87[_0xff6e('0x3f')];if(_0x322bf1[_0xff6e('0x40')][_0xff6e('0x52')]){_0x52111b[_0xff6e('0x53')]=[{'all':!![]}];}_0x52111b=_[_0xff6e('0x4f')]({},_0x52111b,_0x322bf1['options']);return db['ChatMessage'][_0xff6e('0x57')](_0x52111b)['then'](handleEntityNotFound(_0x5d96c6,null))[_0xff6e('0x23')](respondWithResult(_0x5d96c6,null))['catch'](handleError(_0x5d96c6,null));};exports[_0xff6e('0x58')]=function(_0x157d52,_0x25191c){return db[_0xff6e('0x51')][_0xff6e('0x58')](_0x157d52[_0xff6e('0x59')],{})['then'](respondWithResult(_0x25191c,0xc9))[_0xff6e('0x2c')](handleError(_0x25191c,null));};exports[_0xff6e('0x36')]=function(_0x16cafa,_0x9035c1){if(_0x16cafa['body']['id']){delete _0x16cafa[_0xff6e('0x59')]['id'];}return db['ChatMessage'][_0xff6e('0x57')]({'where':{'id':_0x16cafa[_0xff6e('0x5a')]['id']}})[_0xff6e('0x23')](handleEntityNotFound(_0x9035c1,null))[_0xff6e('0x23')](saveUpdates(_0x16cafa['body'],null))[_0xff6e('0x23')](respondWithResult(_0x9035c1,null))[_0xff6e('0x2c')](handleError(_0x9035c1,null));};exports[_0xff6e('0x5b')]=function(_0x4c9c4f,_0x2bda50){return db['ChatMessage']['find']({'where':{'id':_0x4c9c4f[_0xff6e('0x5a')]['id']}})[_0xff6e('0x23')](handleEntityNotFound(_0x2bda50,null))[_0xff6e('0x23')](removeEntity(_0x2bda50,null))[_0xff6e('0x2c')](handleError(_0x2bda50,null));};exports[_0xff6e('0x5c')]=function(_0x34a85a,_0x76ac30){return db[_0xff6e('0x51')][_0xff6e('0x5c')]()[_0xff6e('0x23')](respondWithResult(_0x76ac30,null))[_0xff6e('0x2c')](handleError(_0x76ac30,null));};var interaction_log=require('../../config/logger')(_0xff6e('0x5d'));exports['accept']=function(_0x4db775,_0x4c2dc4,_0x4b6920){var _0x3a55fd={'agent':{},'channel':_0xff6e('0x5e')};if(_0x4db775[_0xff6e('0x59')]['id']){delete _0x4db775[_0xff6e('0x59')]['id'];}_0x4db775['body']['read']=!![];_0x4db775[_0xff6e('0x59')][_0xff6e('0x5f')]=moment()[_0xff6e('0x60')](_0xff6e('0x61'));_0x4db775[_0xff6e('0x59')][_0xff6e('0x62')]=_0x4db775['body']['UserId']||_0x4db775[_0xff6e('0x63')]['id'];_0x3a55fd[_0xff6e('0x64')]['id']=_0x4db775[_0xff6e('0x59')][_0xff6e('0x62')];return db[_0xff6e('0x51')][_0xff6e('0x57')]({'where':{'id':_0x4db775[_0xff6e('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0xff6e('0x65')],'as':_0xff6e('0x66')}]})[_0xff6e('0x23')](handleEntityNotFound(_0x4c2dc4,null))[_0xff6e('0x23')](saveUpdates(_0x4db775['body'],null))['then'](function(_0x4bbea3){if(_0x4bbea3){_0x3a55fd[_0xff6e('0x2a')]=_0x4bbea3['get']({'plain':!![]});return db['ChatInteraction'][_0xff6e('0x57')]({'where':{'id':_0x4bbea3[_0xff6e('0x67')]}});}return null;})[_0xff6e('0x23')](handleEntityNotFound(_0x4c2dc4,null))['then'](function(_0x1399c4){if(_0x1399c4){return _0x1399c4[_0xff6e('0x36')]({'UserId':_0x4db775[_0xff6e('0x59')][_0xff6e('0x62')],'read1stAt':_[_0xff6e('0x68')](_0x1399c4[_0xff6e('0x69')])?moment()[_0xff6e('0x60')](_0xff6e('0x61')):undefined});}return null;})['then'](function(_0x4399cb){if(_0x4399cb){_0x3a55fd[_0xff6e('0x6a')]=_0x4399cb[_0xff6e('0x6b')]({'plain':!![]});interaction_log[_0xff6e('0x24')](_0xff6e('0x6c'),_0x4db775[_0xff6e('0x63')]['id'],_0x4db775['user'][_0xff6e('0x39')],_0x4db775[_0xff6e('0x63')][_0xff6e('0x6d')],_0x3a55fd[_0xff6e('0x6a')]['id'],_0x4db775[_0xff6e('0x59')]?JSON[_0xff6e('0x6e')](_0x4db775[_0xff6e('0x59')]):_0xff6e('0x6f'));return respondWithRpcPromise(_0xff6e('0x70'),_0xff6e('0x71'),_0x3a55fd);}return null;})[_0xff6e('0x23')](function(_0x28894c){if(_0x28894c){if(_0x4db775[_0xff6e('0x59')][_0xff6e('0x72')]){_0x3a55fd[_0xff6e('0x2a')][_0xff6e('0x73')]=util[_0xff6e('0x60')](_0xff6e('0x74'),_0x4db775[_0xff6e('0x63')][_0xff6e('0x39')]);_0x3a55fd[_0xff6e('0x2a')][_0xff6e('0x75')]=_0x3a55fd['channel'];_0x3a55fd[_0xff6e('0x2a')]['event']='accept';return respondWithRpcPromise(_0xff6e('0x76'),_0xff6e('0x76'),{'event':_0xff6e('0x77'),'message':_[_0xff6e('0x4f')](_0x3a55fd[_0xff6e('0x2a')],JSON['parse'](_0x3a55fd['interaction']['formData']))},client9002)['then'](function(){return _0x3a55fd;});}return _0x3a55fd;}return null;})[_0xff6e('0x23')](respondWithResult(_0x4c2dc4,null))[_0xff6e('0x2c')](handleError(_0x4c2dc4,null));};var interaction_log=require('../../config/logger')(_0xff6e('0x5d'));exports[_0xff6e('0x34')]=function(_0x22b435,_0x45ad88,_0x398c78){var _0x1c071b={'agent':{},'channel':_0xff6e('0x5e')};if(_0x22b435[_0xff6e('0x59')]['id']){delete _0x22b435['body']['id'];}_0x22b435[_0xff6e('0x59')][_0xff6e('0x62')]=_0x22b435[_0xff6e('0x59')][_0xff6e('0x62')]||_0x22b435[_0xff6e('0x63')]['id'];_0x1c071b[_0xff6e('0x64')]['id']=_0x22b435[_0xff6e('0x59')][_0xff6e('0x62')];return db[_0xff6e('0x51')][_0xff6e('0x57')]({'where':{'id':_0x22b435[_0xff6e('0x5a')]['id'],'UserId':null}})[_0xff6e('0x23')](handleEntityNotFound(_0x45ad88,null))[_0xff6e('0x23')](function(_0xe5acdb){if(_0xe5acdb){_0x1c071b[_0xff6e('0x2a')]=_0xe5acdb[_0xff6e('0x6b')]({'plain':!![]});return db['ChatInteraction'][_0xff6e('0x57')]({'where':{'id':_0xe5acdb['ChatInteractionId']}});}return null;})[_0xff6e('0x23')](handleEntityNotFound(_0x45ad88,null))[_0xff6e('0x23')](function(_0x2f5a67){if(_0x2f5a67){_0x1c071b[_0xff6e('0x6a')]=_0x2f5a67['get']({'plain':!![]});interaction_log[_0xff6e('0x24')](_0xff6e('0x78'),_0x22b435[_0xff6e('0x63')]['id'],_0x22b435[_0xff6e('0x63')]['name'],_0x22b435[_0xff6e('0x63')]['role'],_0x1c071b[_0xff6e('0x6a')]['id'],_0x22b435[_0xff6e('0x59')]?JSON[_0xff6e('0x6e')](_0x22b435[_0xff6e('0x59')]):_0xff6e('0x6f'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1c071b);}return null;})[_0xff6e('0x23')](function(_0x33cf2e){if(_0x33cf2e){_0x33cf2e['message'][_0xff6e('0x73')]=util[_0xff6e('0x60')](_0xff6e('0x74'),_0x22b435[_0xff6e('0x63')]['name']);_0x33cf2e[_0xff6e('0x2a')][_0xff6e('0x75')]=_0x1c071b[_0xff6e('0x75')];_0x33cf2e[_0xff6e('0x2a')]['event']=_0xff6e('0x34');respondWithRpcPromise(_0xff6e('0x76'),_0xff6e('0x76'),{'event':_0xff6e('0x79'),'message':_0x33cf2e[_0xff6e('0x2a')]},client9002);return _0x1c071b;}return null;})['then'](respondWithResult(_0x45ad88,null))[_0xff6e('0x2c')](handleError(_0x45ad88,null));}; \ No newline at end of file +var _0x411b=['chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','get','ChatInteraction','ChatInteractionId','update','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','http','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','end','json','count','offset','limit','status','set','Content-Range','apply','save','sendStatus','stack','name','send','map','ChatMessage','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','params','rawAttributes','include','find','create','body','destroy','describe'];(function(_0x3e09d3,_0x3199e3){var _0x16d05c=function(_0x569009){while(--_0x569009){_0x3e09d3['push'](_0x3e09d3['shift']());}};_0x16d05c(++_0x3199e3);}(_0x411b,0x9f));var _0xb411=function(_0x8e15fd,_0x3092a2){_0x8e15fd=_0x8e15fd-0x0;var _0x43636f=_0x411b[_0x8e15fd];return _0x43636f;};'use strict';var pdf=require(_0xb411('0x0'));var emlformat=require(_0xb411('0x1'));var rimraf=require(_0xb411('0x2'));var zipdir=require(_0xb411('0x3'));var jsonpatch=require(_0xb411('0x4'));var rp=require(_0xb411('0x5'));var moment=require('moment');var BPromise=require(_0xb411('0x6'));var Mustache=require(_0xb411('0x7'));var util=require(_0xb411('0x8'));var path=require('path');var sox=require(_0xb411('0x9'));var csv=require(_0xb411('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb411('0xb'));var _=require(_0xb411('0xc'));var squel=require(_0xb411('0xd'));var crypto=require(_0xb411('0xe'));var jsforce=require(_0xb411('0xf'));var deskjs=require(_0xb411('0x10'));var toCsv=require(_0xb411('0xa'));var querystring=require(_0xb411('0x11'));var Papa=require('papaparse');var Redis=require(_0xb411('0x12'));var authService=require(_0xb411('0x13'));var qs=require(_0xb411('0x14'));var as=require(_0xb411('0x15'));var hardwareService=require(_0xb411('0x16'));var logger=require(_0xb411('0x17'))(_0xb411('0x18'));var utils=require(_0xb411('0x19'));var config=require(_0xb411('0x1a'));var licenseUtil=require(_0xb411('0x1b'));var db=require('../../mysqldb')['db'];config[_0xb411('0x1c')]=_[_0xb411('0x1d')](config[_0xb411('0x1c')],{'host':_0xb411('0x1e'),'port':0x18eb});var socket=require(_0xb411('0x1f'))(new Redis(config[_0xb411('0x1c')]));require(_0xb411('0x20'))['register'](socket);var jayson=require(_0xb411('0x21'));var client=jayson['client'][_0xb411('0x22')]({'port':0x232c});var client9002=jayson[_0xb411('0x23')][_0xb411('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x562d3b,_0x169ca7,_0x459f9e,_0x5a02f5){return new BPromise(function(_0x5c0642,_0x448253){var _0x47c8d8=_0x5a02f5||client;return _0x47c8d8[_0xb411('0x24')](_0x562d3b,_0x459f9e)[_0xb411('0x25')](function(_0x144db0){logger[_0xb411('0x26')](_0xb411('0x27'),_0x169ca7,_0xb411('0x28'));logger[_0xb411('0x29')](_0xb411('0x2a'),_0x169ca7,_0xb411('0x28'),JSON['stringify'](_0x144db0));if(_0x144db0['error']){if(_0x144db0[_0xb411('0x2b')]['code']===0x1f4){logger[_0xb411('0x2b')](_0xb411('0x27'),_0x169ca7,_0x144db0[_0xb411('0x2b')][_0xb411('0x2c')]);return _0x448253(_0x144db0[_0xb411('0x2b')][_0xb411('0x2c')]);}logger[_0xb411('0x2b')](_0xb411('0x27'),_0x169ca7,_0x144db0[_0xb411('0x2b')][_0xb411('0x2c')]);return _0x5c0642(_0x144db0[_0xb411('0x2b')][_0xb411('0x2c')]);}else{logger[_0xb411('0x26')](_0xb411('0x27'),_0x169ca7,'request\x20sent');_0x5c0642(_0x144db0[_0xb411('0x2d')][_0xb411('0x2c')]);}})[_0xb411('0x2e')](function(_0x480652){logger[_0xb411('0x2b')]('ChatMessage,\x20%s,\x20%s',_0x169ca7,_0x480652);_0x448253(_0x480652);});});}function respondWithStatusCode(_0x1ef9bb,_0x4f52ac){_0x4f52ac=_0x4f52ac||0xcc;return function(_0x512b27){if(_0x512b27){return _0x1ef9bb['sendStatus'](_0x4f52ac);}return _0x1ef9bb['status'](_0x4f52ac)[_0xb411('0x2f')]();};}function respondWithResult(_0x4edef4,_0x37d01c){_0x37d01c=_0x37d01c||0xc8;return function(_0xefb69d){if(_0xefb69d){return _0x4edef4['status'](_0x37d01c)[_0xb411('0x30')](_0xefb69d);}};}function respondWithFilteredResult(_0x2e8435,_0x35577c){return function(_0x6ae042){if(_0x6ae042){var _0x318243=_0x6ae042[_0xb411('0x31')],_0x5e47c3=_0x35577c[_0xb411('0x32')],_0x4c23af=_0x35577c[_0xb411('0x32')]+_0x35577c[_0xb411('0x33')],_0x282462;if(_0x4c23af>=_0x318243){_0x4c23af=_0x318243;_0x282462=0xc8;}else{_0x282462=0xce;}_0x2e8435[_0xb411('0x34')](_0x282462);return _0x2e8435[_0xb411('0x35')](_0xb411('0x36'),_0x5e47c3+'-'+_0x4c23af+'/'+_0x318243)['json'](_0x6ae042);}return null;};}function patchUpdates(_0x494ac4){return function(_0x210e98){try{jsonpatch[_0xb411('0x37')](_0x210e98,_0x494ac4,!![]);}catch(_0x256491){return BPromise['reject'](_0x256491);}return _0x210e98[_0xb411('0x38')]();};}function saveUpdates(_0x75c56a,_0x1fc2e1){return function(_0x2ad4b6){if(_0x2ad4b6){return _0x2ad4b6['update'](_0x75c56a)[_0xb411('0x25')](function(_0x249612){return _0x249612;});}return null;};}function removeEntity(_0x1e8bf3,_0x5b9538){return function(_0x2dc9e9){if(_0x2dc9e9){return _0x2dc9e9['destroy']()['then'](function(){_0x1e8bf3[_0xb411('0x34')](0xcc)[_0xb411('0x2f')]();});}};}function handleEntityNotFound(_0x2c076f,_0x3933ef){return function(_0x1bdd2e){if(!_0x1bdd2e){_0x2c076f[_0xb411('0x39')](0x194);}return _0x1bdd2e;};}function handleError(_0x1c8527,_0x112db2){_0x112db2=_0x112db2||0x1f4;return function(_0x1ba1d1){logger[_0xb411('0x2b')](_0x1ba1d1[_0xb411('0x3a')]);if(_0x1ba1d1[_0xb411('0x3b')]){delete _0x1ba1d1[_0xb411('0x3b')];}_0x1c8527[_0xb411('0x34')](_0x112db2)[_0xb411('0x3c')](_0x1ba1d1);};}exports['index']=function(_0x3c923f,_0x182b72){var _0x10fc74={},_0x283997={},_0x582034={'count':0x0,'rows':[]};var _0x1533ce=_[_0xb411('0x3d')](db[_0xb411('0x3e')]['rawAttributes'],function(_0x1d123e){return{'name':_0x1d123e['fieldName'],'type':_0x1d123e[_0xb411('0x3f')][_0xb411('0x40')]};});_0x283997[_0xb411('0x41')]=_[_0xb411('0x3d')](_0x1533ce,'name');_0x283997[_0xb411('0x42')]=_[_0xb411('0x43')](_0x3c923f['query']);_0x283997[_0xb411('0x44')]=_[_0xb411('0x45')](_0x283997[_0xb411('0x41')],_0x283997[_0xb411('0x42')]);_0x10fc74[_0xb411('0x46')]=_[_0xb411('0x45')](_0x283997[_0xb411('0x41')],qs[_0xb411('0x47')](_0x3c923f['query']['fields']));_0x10fc74['attributes']=_0x10fc74['attributes']['length']?_0x10fc74['attributes']:_0x283997[_0xb411('0x41')];if(!_0x3c923f[_0xb411('0x42')][_0xb411('0x48')](_0xb411('0x49'))){_0x10fc74['limit']=qs[_0xb411('0x33')](_0x3c923f[_0xb411('0x42')][_0xb411('0x33')]);_0x10fc74[_0xb411('0x32')]=qs[_0xb411('0x32')](_0x3c923f[_0xb411('0x42')]['offset']);}_0x10fc74[_0xb411('0x4a')]=qs[_0xb411('0x4b')](_0x3c923f[_0xb411('0x42')][_0xb411('0x4b')]);_0x10fc74[_0xb411('0x4c')]=qs[_0xb411('0x44')](_['pick'](_0x3c923f[_0xb411('0x42')],_0x283997[_0xb411('0x44')]),_0x1533ce);if(_0x3c923f[_0xb411('0x42')][_0xb411('0x4d')]){_0x10fc74[_0xb411('0x4c')]=_[_0xb411('0x4e')](_0x10fc74[_0xb411('0x4c')],{'$or':_[_0xb411('0x3d')](_0x1533ce,function(_0x635053){if(_0x635053[_0xb411('0x3f')]!==_0xb411('0x4f')){var _0x557230={};_0x557230[_0x635053['name']]={'$like':'%'+_0x3c923f[_0xb411('0x42')]['filter']+'%'};return _0x557230;}})});}_0x10fc74=_['merge']({},_0x10fc74,_0x3c923f[_0xb411('0x50')]);var _0x47a665={'where':_0x10fc74[_0xb411('0x4c')]};return db['ChatMessage'][_0xb411('0x31')](_0x47a665)['then'](function(_0x32bbb7){_0x582034[_0xb411('0x31')]=_0x32bbb7;if(_0x3c923f[_0xb411('0x42')][_0xb411('0x51')]){_0x10fc74['include']=[{'all':!![]}];}return db[_0xb411('0x3e')]['findAll'](_0x10fc74);})[_0xb411('0x25')](function(_0x26a5ed){_0x582034[_0xb411('0x52')]=_0x26a5ed;return _0x582034;})[_0xb411('0x25')](respondWithFilteredResult(_0x182b72,_0x10fc74))[_0xb411('0x2e')](handleError(_0x182b72,null));};exports['show']=function(_0x4cbea7,_0x550d8c){var _0x1d7a37={'raw':!![],'where':{'id':_0x4cbea7[_0xb411('0x53')]['id']}},_0x1c84ea={};_0x1c84ea[_0xb411('0x41')]=_[_0xb411('0x43')](db[_0xb411('0x3e')][_0xb411('0x54')]);_0x1c84ea[_0xb411('0x42')]=_[_0xb411('0x43')](_0x4cbea7[_0xb411('0x42')]);_0x1c84ea[_0xb411('0x44')]=_[_0xb411('0x45')](_0x1c84ea[_0xb411('0x41')],_0x1c84ea[_0xb411('0x42')]);_0x1d7a37[_0xb411('0x46')]=_['intersection'](_0x1c84ea[_0xb411('0x41')],qs[_0xb411('0x47')](_0x4cbea7[_0xb411('0x42')]['fields']));_0x1d7a37['attributes']=_0x1d7a37['attributes']['length']?_0x1d7a37[_0xb411('0x46')]:_0x1c84ea[_0xb411('0x41')];if(_0x4cbea7['query'][_0xb411('0x51')]){_0x1d7a37[_0xb411('0x55')]=[{'all':!![]}];}_0x1d7a37=_['merge']({},_0x1d7a37,_0x4cbea7['options']);return db[_0xb411('0x3e')][_0xb411('0x56')](_0x1d7a37)[_0xb411('0x25')](handleEntityNotFound(_0x550d8c,null))[_0xb411('0x25')](respondWithResult(_0x550d8c,null))[_0xb411('0x2e')](handleError(_0x550d8c,null));};exports[_0xb411('0x57')]=function(_0x96cd5e,_0x53e3f8){return db['ChatMessage'][_0xb411('0x57')](_0x96cd5e[_0xb411('0x58')],{})[_0xb411('0x25')](respondWithResult(_0x53e3f8,0xc9))['catch'](handleError(_0x53e3f8,null));};exports['update']=function(_0x2ee1a2,_0x1c8db3){if(_0x2ee1a2[_0xb411('0x58')]['id']){delete _0x2ee1a2[_0xb411('0x58')]['id'];}return db[_0xb411('0x3e')][_0xb411('0x56')]({'where':{'id':_0x2ee1a2[_0xb411('0x53')]['id']}})[_0xb411('0x25')](handleEntityNotFound(_0x1c8db3,null))[_0xb411('0x25')](saveUpdates(_0x2ee1a2[_0xb411('0x58')],null))['then'](respondWithResult(_0x1c8db3,null))[_0xb411('0x2e')](handleError(_0x1c8db3,null));};exports[_0xb411('0x59')]=function(_0x325602,_0x197127){return db[_0xb411('0x3e')][_0xb411('0x56')]({'where':{'id':_0x325602[_0xb411('0x53')]['id']}})[_0xb411('0x25')](handleEntityNotFound(_0x197127,null))[_0xb411('0x25')](removeEntity(_0x197127,null))[_0xb411('0x2e')](handleError(_0x197127,null));};exports[_0xb411('0x5a')]=function(_0x2bd09c,_0x51d378){return db[_0xb411('0x3e')][_0xb411('0x5a')]()['then'](respondWithResult(_0x51d378,null))[_0xb411('0x2e')](handleError(_0x51d378,null));};var interaction_log=require(_0xb411('0x17'))(_0xb411('0x5b'));exports[_0xb411('0x5c')]=function(_0x11f59b,_0x1b13ce,_0x18eb84){var _0x465869={'agent':{},'channel':_0xb411('0x5d')};if(_0x11f59b['body']['id']){delete _0x11f59b[_0xb411('0x58')]['id'];}_0x11f59b['body']['read']=!![];_0x11f59b[_0xb411('0x58')][_0xb411('0x5e')]=moment()[_0xb411('0x5f')](_0xb411('0x60'));_0x11f59b[_0xb411('0x58')][_0xb411('0x61')]=_0x11f59b[_0xb411('0x58')][_0xb411('0x61')]||_0x11f59b[_0xb411('0x62')]['id'];_0x465869[_0xb411('0x63')]['id']=_0x11f59b[_0xb411('0x58')][_0xb411('0x61')];return db[_0xb411('0x3e')][_0xb411('0x56')]({'where':{'id':_0x11f59b[_0xb411('0x53')]['id'],'UserId':null},'include':[{'model':db[_0xb411('0x64')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x1b13ce,null))[_0xb411('0x25')](saveUpdates(_0x11f59b[_0xb411('0x58')],null))[_0xb411('0x25')](function(_0x39aff8){if(_0x39aff8){_0x465869[_0xb411('0x2c')]=_0x39aff8[_0xb411('0x65')]({'plain':!![]});return db[_0xb411('0x66')][_0xb411('0x56')]({'where':{'id':_0x39aff8[_0xb411('0x67')]}});}return null;})[_0xb411('0x25')](handleEntityNotFound(_0x1b13ce,null))[_0xb411('0x25')](function(_0xedd100){if(_0xedd100){return _0xedd100[_0xb411('0x68')]({'UserId':_0x11f59b[_0xb411('0x58')][_0xb411('0x61')],'read1stAt':_[_0xb411('0x69')](_0xedd100[_0xb411('0x6a')])?moment()[_0xb411('0x5f')](_0xb411('0x60')):undefined});}return null;})[_0xb411('0x25')](function(_0x50c53c){if(_0x50c53c){_0x465869[_0xb411('0x6b')]=_0x50c53c[_0xb411('0x65')]({'plain':!![]});interaction_log['info'](_0xb411('0x6c'),_0x11f59b['user']['id'],_0x11f59b['user'][_0xb411('0x3b')],_0x11f59b[_0xb411('0x62')][_0xb411('0x6d')],_0x465869[_0xb411('0x6b')]['id'],_0x11f59b[_0xb411('0x58')]?JSON[_0xb411('0x6e')](_0x11f59b[_0xb411('0x58')]):'null');return respondWithRpcPromise('AcceptMessage',_0xb411('0x6f'),_0x465869);}return null;})['then'](function(_0x1f9934){if(_0x1f9934){if(_0x11f59b[_0xb411('0x58')][_0xb411('0x70')]){_0x465869[_0xb411('0x2c')][_0xb411('0x71')]=util['format']('SIP/%s',_0x11f59b[_0xb411('0x62')][_0xb411('0x3b')]);_0x465869[_0xb411('0x2c')][_0xb411('0x72')]=_0x465869[_0xb411('0x72')];_0x465869[_0xb411('0x2c')][_0xb411('0x73')]=_0xb411('0x5c');return respondWithRpcPromise(_0xb411('0x74'),_0xb411('0x74'),{'event':_0xb411('0x75'),'message':_[_0xb411('0x4e')](_0x465869['message'],JSON['parse'](_0x465869[_0xb411('0x6b')][_0xb411('0x76')]))},client9002)['then'](function(){return _0x465869;});}return _0x465869;}return null;})[_0xb411('0x25')](respondWithResult(_0x1b13ce,null))[_0xb411('0x2e')](handleError(_0x1b13ce,null));};var interaction_log=require(_0xb411('0x17'))('chat-interactions');exports[_0xb411('0x77')]=function(_0x5b5d34,_0x4f1d77,_0x5a416c){var _0x396467={'agent':{},'channel':_0xb411('0x5d')};if(_0x5b5d34[_0xb411('0x58')]['id']){delete _0x5b5d34['body']['id'];}_0x5b5d34[_0xb411('0x58')]['UserId']=_0x5b5d34['body'][_0xb411('0x61')]||_0x5b5d34[_0xb411('0x62')]['id'];_0x396467['agent']['id']=_0x5b5d34[_0xb411('0x58')][_0xb411('0x61')];return db[_0xb411('0x3e')][_0xb411('0x56')]({'where':{'id':_0x5b5d34[_0xb411('0x53')]['id'],'UserId':null}})[_0xb411('0x25')](handleEntityNotFound(_0x4f1d77,null))['then'](function(_0x4438ee){if(_0x4438ee){_0x396467[_0xb411('0x2c')]=_0x4438ee['get']({'plain':!![]});return db['ChatInteraction'][_0xb411('0x56')]({'where':{'id':_0x4438ee['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4f1d77,null))[_0xb411('0x25')](function(_0x65a4dd){if(_0x65a4dd){_0x396467[_0xb411('0x6b')]=_0x65a4dd[_0xb411('0x65')]({'plain':!![]});interaction_log[_0xb411('0x26')](_0xb411('0x78'),_0x5b5d34['user']['id'],_0x5b5d34['user'][_0xb411('0x3b')],_0x5b5d34[_0xb411('0x62')]['role'],_0x396467[_0xb411('0x6b')]['id'],_0x5b5d34['body']?JSON[_0xb411('0x6e')](_0x5b5d34['body']):_0xb411('0x79'));return respondWithRpcPromise(_0xb411('0x7a'),_0xb411('0x7b'),_0x396467);}return null;})['then'](function(_0x37e7cc){if(_0x37e7cc){_0x37e7cc['message'][_0xb411('0x71')]=util['format']('SIP/%s',_0x5b5d34[_0xb411('0x62')][_0xb411('0x3b')]);_0x37e7cc[_0xb411('0x2c')][_0xb411('0x72')]=_0x396467[_0xb411('0x72')];_0x37e7cc[_0xb411('0x2c')][_0xb411('0x73')]=_0xb411('0x77');respondWithRpcPromise('EventManager',_0xb411('0x74'),{'event':_0xb411('0x7c'),'message':_0x37e7cc['message']},client9002);return _0x396467;}return null;})[_0xb411('0x25')](respondWithResult(_0x4f1d77,null))[_0xb411('0x2e')](handleError(_0x4f1d77,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 92db6d8..427ed0c 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 _0x3405=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x39450b,_0x529781){var _0x143a51=function(_0x183343){while(--_0x183343){_0x39450b['push'](_0x39450b['shift']());}};_0x143a51(++_0x529781);}(_0x3405,0x6f));var _0x5340=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x3405[_0x45d3f0];return _0x314b79;};'use strict';var EventEmitter=require(_0x5340('0x0'));var ChatMessage=require(_0x5340('0x1'))['db'][_0x5340('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x5340('0x3')](0x0);var events={'afterCreate':_0x5340('0x4'),'afterUpdate':'update','afterDestroy':_0x5340('0x5')};function emitEvent(_0x262236){return function(_0x5f4a3f,_0x5ed5d0,_0x90ba79){ChatMessageEvents[_0x5340('0x6')](_0x262236+':'+_0x5f4a3f['id'],_0x5f4a3f);ChatMessageEvents[_0x5340('0x6')](_0x262236,_0x5f4a3f);_0x90ba79(null);};}for(var e in events){if(events[_0x5340('0x7')](e)){var event=events[e];ChatMessage[_0x5340('0x8')](e,emitEvent(event));}}module[_0x5340('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xf829=['events','../../mysqldb','setMaxListeners','save','update','emit','hook','exports'];(function(_0x52972c,_0x50aab5){var _0x528839=function(_0x1a134c){while(--_0x1a134c){_0x52972c['push'](_0x52972c['shift']());}};_0x528839(++_0x50aab5);}(_0xf829,0xd0));var _0x9f82=function(_0x3f37c8,_0x2de1ad){_0x3f37c8=_0x3f37c8-0x0;var _0x1c3bc2=_0xf829[_0x3f37c8];return _0x1c3bc2;};'use strict';var EventEmitter=require(_0x9f82('0x0'));var ChatMessage=require(_0x9f82('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9f82('0x2')](0x0);var events={'afterCreate':_0x9f82('0x3'),'afterUpdate':_0x9f82('0x4'),'afterDestroy':'remove'};function emitEvent(_0x443ecb){return function(_0x1ca239,_0x25e575,_0x459c84){ChatMessageEvents[_0x9f82('0x5')](_0x443ecb+':'+_0x1ca239['id'],_0x1ca239);ChatMessageEvents[_0x9f82('0x5')](_0x443ecb,_0x1ca239);_0x459c84(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x9f82('0x6')](e,emitEvent(event));}}module[_0x9f82('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 6fe2d24..c766245 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 _0x482c=['exports','ChatMessage','chat_messages','fti_chat_messages','models','get','toLowerCase','direction','out','isNil','ChatInteractionId','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes'];(function(_0x16987d,_0x566f27){var _0x48b8a4=function(_0x396cad){while(--_0x396cad){_0x16987d['push'](_0x16987d['shift']());}};_0x48b8a4(++_0x566f27);}(_0x482c,0x10c));var _0xc482=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x482c[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xc482('0x0'));var util=require(_0xc482('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc482('0x2'));var BPromise=require(_0xc482('0x3'));var rp=require(_0xc482('0x4'));var fs=require('fs');var path=require(_0xc482('0x5'));var rimraf=require(_0xc482('0x6'));var config=require('../../config/environment');var attributes=require(_0xc482('0x7'));module[_0xc482('0x8')]=function(_0xa773f1,_0x271dd9){return _0xa773f1['define'](_0xc482('0x9'),attributes,{'tableName':_0xc482('0xa'),'paranoid':![],'indexes':[{'name':_0xc482('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x342b76,_0x1ac7a7,_0x1fcfaa){var _0x16ed5c=_0xa773f1[_0xc482('0xc')];var _0x29a7e4=_0x342b76[_0xc482('0xd')]({'plain':!![]});if(_0x29a7e4['direction'][_0xc482('0xe')]()==='in'||_0x29a7e4[_0xc482('0xf')]['toLowerCase']()===_0xc482('0x10')&&!_0x29a7e4['secret']&&!_[_0xc482('0x11')](_0x29a7e4['UserId'])){_0x16ed5c['ChatInteraction']['findOne']({'where':{'id':_0x29a7e4[_0xc482('0x12')]}})['then'](function(_0x280a96){if(_0x280a96){_0x280a96[_0xc482('0x13')]({'lastMsgAt':_0x29a7e4['createdAt'],'lastMsgDirection':_0x29a7e4[_0xc482('0xf')][_0xc482('0xe')]()});}})[_0xc482('0x14')](function(_0x5c95e8){console['error'](_0x5c95e8);});}_0x1fcfaa();}},'charset':_0xc482('0x15'),'collate':_0xc482('0x16')});}; \ No newline at end of file +var _0x8fe1=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util'];(function(_0x426d54,_0x5e64af){var _0x4056e1=function(_0x447da5){while(--_0x447da5){_0x426d54['push'](_0x426d54['shift']());}};_0x4056e1(++_0x5e64af);}(_0x8fe1,0x1b1));var _0x18fe=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x8fe1[_0x15d18f];return _0xd12bf7;};'use strict';var _=require(_0x18fe('0x0'));var util=require(_0x18fe('0x1'));var logger=require(_0x18fe('0x2'))(_0x18fe('0x3'));var moment=require(_0x18fe('0x4'));var BPromise=require(_0x18fe('0x5'));var rp=require(_0x18fe('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x18fe('0x7'));var attributes=require(_0x18fe('0x8'));module[_0x18fe('0x9')]=function(_0x5451c7,_0x5f001b){return _0x5451c7[_0x18fe('0xa')](_0x18fe('0xb'),attributes,{'tableName':_0x18fe('0xc'),'paranoid':![],'indexes':[{'name':_0x18fe('0xd'),'fields':[_0x18fe('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a379c,_0x474bb1,_0x4d38ee){var _0x8b4ea9=_0x5451c7['models'];var _0x46b7f6=_0x1a379c['get']({'plain':!![]});if(_0x46b7f6['direction'][_0x18fe('0xf')]()==='in'||_0x46b7f6[_0x18fe('0x10')][_0x18fe('0xf')]()===_0x18fe('0x11')&&!_0x46b7f6[_0x18fe('0x12')]&&!_[_0x18fe('0x13')](_0x46b7f6[_0x18fe('0x14')])){_0x8b4ea9[_0x18fe('0x15')][_0x18fe('0x16')]({'where':{'id':_0x46b7f6[_0x18fe('0x17')]}})[_0x18fe('0x18')](function(_0x314a7e){if(_0x314a7e){_0x314a7e[_0x18fe('0x19')]({'lastMsgAt':_0x46b7f6[_0x18fe('0x1a')],'lastMsgDirection':_0x46b7f6[_0x18fe('0x10')][_0x18fe('0xf')]()});}})[_0x18fe('0x1b')](function(_0x2f109e){console['error'](_0x2f109e);});}_0x4d38ee();}},'charset':'utf8mb4','collate':_0x18fe('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 9f151c1..43a2022 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 _0x6625=['jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6625,0x107));var _0x5662=function(_0x3cc60f,_0x3411fe){_0x3cc60f=_0x3cc60f-0x0;var _0x283455=_0x6625[_0x3cc60f];return _0x283455;};'use strict';var _=require(_0x5662('0x0'));var util=require(_0x5662('0x1'));var moment=require(_0x5662('0x2'));var BPromise=require(_0x5662('0x3'));var rs=require(_0x5662('0x4'));var fs=require('fs');var Redis=require(_0x5662('0x5'));var db=require(_0x5662('0x6'))['db'];var utils=require(_0x5662('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x5662('0x8'));var jayson=require(_0x5662('0x9'));var client=jayson[_0x5662('0xa')][_0x5662('0xb')]({'port':0x232a});config[_0x5662('0xc')]=_[_0x5662('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5662('0xe'))(new Redis(config[_0x5662('0xc')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4a6d16,_0x37ff4d,_0x4a0ea7){return new BPromise(function(_0x47e1ef,_0x568065){return client[_0x5662('0xf')](_0x4a6d16,_0x4a0ea7)[_0x5662('0x10')](function(_0xaa0c4){logger['info'](_0x5662('0x11'),_0x37ff4d,_0x5662('0x12'));logger[_0x5662('0x13')](_0x5662('0x14'),_0x37ff4d,_0x5662('0x12'),JSON['stringify'](_0xaa0c4));if(_0xaa0c4[_0x5662('0x15')]){if(_0xaa0c4['error'][_0x5662('0x16')]===0x1f4){logger['error'](_0x5662('0x11'),_0x37ff4d,_0xaa0c4[_0x5662('0x15')]['message']);return _0x568065(_0xaa0c4[_0x5662('0x15')][_0x5662('0x17')]);}logger[_0x5662('0x15')](_0x5662('0x11'),_0x37ff4d,_0xaa0c4[_0x5662('0x15')][_0x5662('0x17')]);return _0x47e1ef(_0xaa0c4[_0x5662('0x15')][_0x5662('0x17')]);}else{logger[_0x5662('0x18')](_0x5662('0x11'),_0x37ff4d,_0x5662('0x12'));_0x47e1ef(_0xaa0c4[_0x5662('0x19')]['message']);}})[_0x5662('0x1a')](function(_0x2974fe){logger[_0x5662('0x15')](_0x5662('0x11'),_0x37ff4d,_0x2974fe);_0x568065(_0x2974fe);});});}exports[_0x5662('0x1b')]=function(_0x462a3d){var _0x207b96=this;return new Promise(function(_0x3cc976,_0x2e82cb){return db[_0x5662('0x1c')][_0x5662('0x1d')](_0x462a3d[_0x5662('0x1e')],{'raw':_0x462a3d[_0x5662('0x1f')]?_0x462a3d[_0x5662('0x1f')][_0x5662('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x351dcb){logger[_0x5662('0x18')]('CreateChatMessage',_0x462a3d);logger[_0x5662('0x13')](_0x5662('0x1b'),_0x462a3d,JSON[_0x5662('0x21')](_0x351dcb));_0x3cc976(_0x351dcb);})['catch'](function(_0x103ad1){logger[_0x5662('0x15')](_0x5662('0x1b'),_0x103ad1[_0x5662('0x17')],_0x462a3d);_0x2e82cb(_0x207b96[_0x5662('0x15')](0x1f4,_0x103ad1[_0x5662('0x17')]));});});}; \ No newline at end of file +var _0x75e0=['then','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0x75e0,0x1c8));var _0x075e=function(_0x3a5dba,_0x4201d4){_0x3a5dba=_0x3a5dba-0x0;var _0x432392=_0x75e0[_0x3a5dba];return _0x432392;};'use strict';var _=require(_0x075e('0x0'));var util=require(_0x075e('0x1'));var moment=require(_0x075e('0x2'));var BPromise=require('bluebird');var rs=require(_0x075e('0x3'));var fs=require('fs');var Redis=require(_0x075e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x075e('0x5'));var logger=require('../../config/logger')(_0x075e('0x6'));var config=require(_0x075e('0x7'));var jayson=require(_0x075e('0x8'));var client=jayson[_0x075e('0x9')][_0x075e('0xa')]({'port':0x232a});config[_0x075e('0xb')]=_[_0x075e('0xc')](config[_0x075e('0xb')],{'host':_0x075e('0xd'),'port':0x18eb});var socket=require(_0x075e('0xe'))(new Redis(config[_0x075e('0xb')]));require(_0x075e('0xf'))['register'](socket);function respondWithRpcPromise(_0x4d4352,_0x592e2b,_0xa76934){return new BPromise(function(_0x3d713c,_0x3fc747){return client[_0x075e('0x10')](_0x4d4352,_0xa76934)['then'](function(_0x1099b7){logger[_0x075e('0x11')](_0x075e('0x12'),_0x592e2b,'request\x20sent');logger[_0x075e('0x13')](_0x075e('0x14'),_0x592e2b,_0x075e('0x15'),JSON[_0x075e('0x16')](_0x1099b7));if(_0x1099b7['error']){if(_0x1099b7[_0x075e('0x17')][_0x075e('0x18')]===0x1f4){logger[_0x075e('0x17')](_0x075e('0x12'),_0x592e2b,_0x1099b7['error'][_0x075e('0x19')]);return _0x3fc747(_0x1099b7[_0x075e('0x17')]['message']);}logger[_0x075e('0x17')](_0x075e('0x12'),_0x592e2b,_0x1099b7[_0x075e('0x17')][_0x075e('0x19')]);return _0x3d713c(_0x1099b7[_0x075e('0x17')]['message']);}else{logger[_0x075e('0x11')](_0x075e('0x12'),_0x592e2b,_0x075e('0x15'));_0x3d713c(_0x1099b7[_0x075e('0x1a')][_0x075e('0x19')]);}})[_0x075e('0x1b')](function(_0x360965){logger[_0x075e('0x17')]('ChatMessage,\x20%s,\x20%s',_0x592e2b,_0x360965);_0x3fc747(_0x360965);});});}exports[_0x075e('0x1c')]=function(_0x2eecf2){var _0x865809=this;return new Promise(function(_0x248648,_0x472fa7){return db[_0x075e('0x1d')][_0x075e('0x1e')](_0x2eecf2[_0x075e('0x1f')],{'raw':_0x2eecf2['options']?_0x2eecf2[_0x075e('0x20')][_0x075e('0x21')]===undefined?!![]:![]:!![]})[_0x075e('0x22')](function(_0x36adfd){logger['info'](_0x075e('0x1c'),_0x2eecf2);logger['debug'](_0x075e('0x1c'),_0x2eecf2,JSON['stringify'](_0x36adfd));_0x248648(_0x36adfd);})[_0x075e('0x1b')](function(_0x12ca7d){logger[_0x075e('0x17')]('CreateChatMessage',_0x12ca7d['message'],_0x2eecf2);_0x472fa7(_0x865809[_0x075e('0x17')](0x1f4,_0x12ca7d[_0x075e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e83a1f0..9cf7317 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 _0xc1c6=['length','chatMessage:','./chatMessage.events','save','remove','emit','register'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x88ce76,_0x4dd709){_0x88ce76=_0x88ce76-0x0;var _0x46ad36=_0xc1c6[_0x88ce76];return _0x46ad36;};'use strict';var ChatMessageEvents=require(_0x6c1c('0x0'));var events=[_0x6c1c('0x1'),_0x6c1c('0x2'),'update'];function createListener(_0x114c93,_0x4c33ca){return function(_0x426398){_0x4c33ca[_0x6c1c('0x3')](_0x114c93,_0x426398);};}function removeListener(_0x265d2c,_0x59f799){return function(){ChatMessageEvents['removeListener'](_0x265d2c,_0x59f799);};}exports[_0x6c1c('0x4')]=function(_0x524a6b){for(var _0x50c1bb=0x0,_0x582bec=events[_0x6c1c('0x5')];_0x50c1bb<_0x582bec;_0x50c1bb++){var _0x2eb1ba=events[_0x50c1bb];var _0x38369d=createListener(_0x6c1c('0x6')+_0x2eb1ba,_0x524a6b);ChatMessageEvents['on'](_0x2eb1ba,_0x38369d);}}; \ No newline at end of file +var _0x430c=['register','length','chatMessage:','./chatMessage.events','update','removeListener'];(function(_0x37b234,_0x143de6){var _0x4899f0=function(_0x27d461){while(--_0x27d461){_0x37b234['push'](_0x37b234['shift']());}};_0x4899f0(++_0x143de6);}(_0x430c,0x1a1));var _0xc430=function(_0x5bd1a9,_0x313714){_0x5bd1a9=_0x5bd1a9-0x0;var _0x2ba345=_0x430c[_0x5bd1a9];return _0x2ba345;};'use strict';var ChatMessageEvents=require(_0xc430('0x0'));var events=['save','remove',_0xc430('0x1')];function createListener(_0xe2d084,_0x1d5b5e){return function(_0x503988){_0x1d5b5e['emit'](_0xe2d084,_0x503988);};}function removeListener(_0x5ccda6,_0x47d8b9){return function(){ChatMessageEvents[_0xc430('0x2')](_0x5ccda6,_0x47d8b9);};}exports[_0xc430('0x3')]=function(_0x50b256){for(var _0x42aa9c=0x0,_0x4de44f=events[_0xc430('0x4')];_0x42aa9c<_0x4de44f;_0x42aa9c++){var _0x2e51c6=events[_0x42aa9c];var _0x814a90=createListener(_0xc430('0x5')+_0x2e51c6,_0x50b256);ChatMessageEvents['on'](_0x2e51c6,_0x814a90);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index fe2eeba..18ea33b 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 _0x55ea=['../../components/interaction/service','./chatMessage.controller','/describe','isAuthenticated','describe','get','/:id','show','post','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4527a0,_0x20bdc1){var _0x4505cf=function(_0x139636){while(--_0x139636){_0x4527a0['push'](_0x4527a0['shift']());}};_0x4505cf(++_0x20bdc1);}(_0x55ea,0xc9));var _0xa55e=function(_0x1300e0,_0x5a1300){_0x1300e0=_0x1300e0-0x0;var _0x2e1ca5=_0x55ea[_0x1300e0];return _0x2e1ca5;};'use strict';var multer=require(_0xa55e('0x0'));var util=require(_0xa55e('0x1'));var path=require(_0xa55e('0x2'));var timeout=require('connect-timeout');var express=require(_0xa55e('0x3'));var router=express[_0xa55e('0x4')]();var fs_extra=require(_0xa55e('0x5'));var auth=require(_0xa55e('0x6'));var interaction=require(_0xa55e('0x7'));var config=require('../../config/environment');var controller=require(_0xa55e('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa55e('0x9'),auth[_0xa55e('0xa')](),controller[_0xa55e('0xb')]);router[_0xa55e('0xc')](_0xa55e('0xd'),auth[_0xa55e('0xa')](),controller[_0xa55e('0xe')]);router[_0xa55e('0xf')]('/',auth[_0xa55e('0xa')](),interaction['tracked']('chat',_0xa55e('0x10')),controller[_0xa55e('0x11')]);router[_0xa55e('0x12')](_0xa55e('0xd'),controller[_0xa55e('0x13')]);router['put'](_0xa55e('0x14'),auth['isAuthenticated'](),controller[_0xa55e('0x15')]);router[_0xa55e('0x12')](_0xa55e('0x16'),auth[_0xa55e('0xa')](),controller[_0xa55e('0x17')]);router[_0xa55e('0x18')](_0xa55e('0xd'),auth[_0xa55e('0xa')](),controller[_0xa55e('0x19')]);module['exports']=router; \ No newline at end of file +var _0xd7a0=['update','accept','/:id/reject','reject','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','create','put'];(function(_0x3422bf,_0x21b1da){var _0x4de668=function(_0x271cce){while(--_0x271cce){_0x3422bf['push'](_0x3422bf['shift']());}};_0x4de668(++_0x21b1da);}(_0xd7a0,0x163));var _0x0d7a=function(_0x1e77bf,_0x3f9f0e){_0x1e77bf=_0x1e77bf-0x0;var _0x19f34b=_0xd7a0[_0x1e77bf];return _0x19f34b;};'use strict';var multer=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var path=require('path');var timeout=require(_0x0d7a('0x2'));var express=require('express');var router=express[_0x0d7a('0x3')]();var fs_extra=require(_0x0d7a('0x4'));var auth=require(_0x0d7a('0x5'));var interaction=require(_0x0d7a('0x6'));var config=require(_0x0d7a('0x7'));var controller=require('./chatMessage.controller');router[_0x0d7a('0x8')]('/',auth[_0x0d7a('0x9')](),controller[_0x0d7a('0xa')]);router[_0x0d7a('0x8')](_0x0d7a('0xb'),auth[_0x0d7a('0x9')](),controller[_0x0d7a('0xc')]);router['get'](_0x0d7a('0xd'),auth[_0x0d7a('0x9')](),controller[_0x0d7a('0xe')]);router[_0x0d7a('0xf')]('/',auth['isAuthenticated'](),interaction[_0x0d7a('0x10')](_0x0d7a('0x11'),'chatmessage:create'),controller[_0x0d7a('0x12')]);router[_0x0d7a('0x13')](_0x0d7a('0xd'),controller[_0x0d7a('0x14')]);router[_0x0d7a('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0x0d7a('0x15')]);router[_0x0d7a('0x13')](_0x0d7a('0x16'),auth['isAuthenticated'](),controller[_0x0d7a('0x17')]);router['delete']('/:id',auth[_0x0d7a('0x9')](),controller['destroy']);module[_0x0d7a('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 99348bb..7a363e7 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 _0xb758=['medium','exports','TEXT'];(function(_0x56e6b6,_0x41dbce){var _0x1b1f93=function(_0x2db1f1){while(--_0x2db1f1){_0x56e6b6['push'](_0x56e6b6['shift']());}};_0x1b1f93(++_0x41dbce);}(_0xb758,0xb5));var _0x8b75=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0xb758[_0x301c34];return _0x1a8c5a;};'use strict';var Sequelize=require('sequelize');module[_0x8b75('0x0')]={'body':{'type':Sequelize[_0x8b75('0x1')](_0x8b75('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xb931=['exports','TEXT','sequelize'];(function(_0x110957,_0x226fca){var _0x4354f2=function(_0x444013){while(--_0x444013){_0x110957['push'](_0x110957['shift']());}};_0x4354f2(++_0x226fca);}(_0xb931,0x113));var _0x1b93=function(_0x6e7a66,_0x3a2cd6){_0x6e7a66=_0x6e7a66-0x0;var _0x21189b=_0xb931[_0x6e7a66];return _0x21189b;};'use strict';var Sequelize=require(_0x1b93('0x0'));module[_0x1b93('0x1')]={'body':{'type':Sequelize[_0x1b93('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 70a0a21..81d8ebf 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 _0xc24b=['name','send','map','ChatOfflineMessage','fieldName','type','key','model','query','attributes','intersection','fields','length','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','keys','includeAll','include','find','catch','create','body','params','forEach','server','files','attachments','offline-chat','basename','existsSync','describe','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','limit','set','apply','reject','save','update','then','destroy','end','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc24b,0x117));var _0xbc24=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0xc24b[_0x34d346];return _0x122d76;};'use strict';var pdf=require(_0xbc24('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbc24('0x1'));var zipdir=require(_0xbc24('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc24('0x3'));var moment=require(_0xbc24('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbc24('0x5'));var util=require(_0xbc24('0x6'));var path=require(_0xbc24('0x7'));var sox=require(_0xbc24('0x8'));var csv=require(_0xbc24('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc24('0xa'));var _=require('lodash');var squel=require(_0xbc24('0xb'));var crypto=require('crypto');var jsforce=require(_0xbc24('0xc'));var deskjs=require(_0xbc24('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbc24('0xe'));var Papa=require('papaparse');var Redis=require(_0xbc24('0xf'));var authService=require(_0xbc24('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc24('0x11'));var logger=require(_0xbc24('0x12'))(_0xbc24('0x13'));var utils=require('../../config/utils');var config=require(_0xbc24('0x14'));var licenseUtil=require(_0xbc24('0x15'));var db=require(_0xbc24('0x16'))['db'];function respondWithStatusCode(_0xc7cc05,_0x4c80eb){_0x4c80eb=_0x4c80eb||0xcc;return function(_0x4080bc){if(_0x4080bc){return _0xc7cc05[_0xbc24('0x17')](_0x4c80eb);}return _0xc7cc05[_0xbc24('0x18')](_0x4c80eb)['end']();};}function respondWithResult(_0x99c159,_0x50be57){_0x50be57=_0x50be57||0xc8;return function(_0x2ce826){if(_0x2ce826){return _0x99c159[_0xbc24('0x18')](_0x50be57)[_0xbc24('0x19')](_0x2ce826);}};}function respondWithFilteredResult(_0x1a96a0,_0x4cbdf4){return function(_0x50951f){if(_0x50951f){var _0x5c24c8=_0x50951f[_0xbc24('0x1a')],_0x220ae9=_0x4cbdf4['offset'],_0x41d32b=_0x4cbdf4['offset']+_0x4cbdf4[_0xbc24('0x1b')],_0x2bc7b0;if(_0x41d32b>=_0x5c24c8){_0x41d32b=_0x5c24c8;_0x2bc7b0=0xc8;}else{_0x2bc7b0=0xce;}_0x1a96a0[_0xbc24('0x18')](_0x2bc7b0);return _0x1a96a0[_0xbc24('0x1c')]('Content-Range',_0x220ae9+'-'+_0x41d32b+'/'+_0x5c24c8)['json'](_0x50951f);}return null;};}function patchUpdates(_0x539ee0){return function(_0x45c630){try{jsonpatch[_0xbc24('0x1d')](_0x45c630,_0x539ee0,!![]);}catch(_0x514535){return BPromise[_0xbc24('0x1e')](_0x514535);}return _0x45c630[_0xbc24('0x1f')]();};}function saveUpdates(_0x329a54,_0x118d04){return function(_0x44e246){if(_0x44e246){return _0x44e246[_0xbc24('0x20')](_0x329a54)[_0xbc24('0x21')](function(_0x4c6217){return _0x4c6217;});}return null;};}function removeEntity(_0x18d23e,_0x2d76f8){return function(_0x4526e3){if(_0x4526e3){return _0x4526e3[_0xbc24('0x22')]()[_0xbc24('0x21')](function(){_0x18d23e[_0xbc24('0x18')](0xcc)[_0xbc24('0x23')]();});}};}function handleEntityNotFound(_0xacf80,_0x366d1d){return function(_0x3f8b35){if(!_0x3f8b35){_0xacf80[_0xbc24('0x17')](0x194);}return _0x3f8b35;};}function handleError(_0x2a1424,_0x4b1e43){_0x4b1e43=_0x4b1e43||0x1f4;return function(_0x4c4b64){logger[_0xbc24('0x24')](_0x4c4b64['stack']);if(_0x4c4b64[_0xbc24('0x25')]){delete _0x4c4b64[_0xbc24('0x25')];}_0x2a1424['status'](_0x4b1e43)[_0xbc24('0x26')](_0x4c4b64);};}exports['index']=function(_0x59ecc3,_0xdb3e88){var _0x3732cb={},_0x25fd45={},_0x2f7eef={'count':0x0,'rows':[]};var _0x5e16aa=_[_0xbc24('0x27')](db[_0xbc24('0x28')]['rawAttributes'],function(_0x1dac7a){return{'name':_0x1dac7a[_0xbc24('0x29')],'type':_0x1dac7a[_0xbc24('0x2a')][_0xbc24('0x2b')]};});_0x25fd45[_0xbc24('0x2c')]=_['map'](_0x5e16aa,_0xbc24('0x25'));_0x25fd45['query']=_['keys'](_0x59ecc3[_0xbc24('0x2d')]);_0x25fd45['filters']=_['intersection'](_0x25fd45[_0xbc24('0x2c')],_0x25fd45['query']);_0x3732cb[_0xbc24('0x2e')]=_[_0xbc24('0x2f')](_0x25fd45[_0xbc24('0x2c')],qs[_0xbc24('0x30')](_0x59ecc3[_0xbc24('0x2d')][_0xbc24('0x30')]));_0x3732cb[_0xbc24('0x2e')]=_0x3732cb[_0xbc24('0x2e')][_0xbc24('0x31')]?_0x3732cb['attributes']:_0x25fd45['model'];if(!_0x59ecc3[_0xbc24('0x2d')]['hasOwnProperty']('nolimit')){_0x3732cb['limit']=qs['limit'](_0x59ecc3[_0xbc24('0x2d')]['limit']);_0x3732cb['offset']=qs[_0xbc24('0x32')](_0x59ecc3['query'][_0xbc24('0x32')]);}_0x3732cb[_0xbc24('0x33')]=qs[_0xbc24('0x34')](_0x59ecc3[_0xbc24('0x2d')][_0xbc24('0x34')]);_0x3732cb[_0xbc24('0x35')]=qs[_0xbc24('0x36')](_[_0xbc24('0x37')](_0x59ecc3['query'],_0x25fd45[_0xbc24('0x36')]),_0x5e16aa);if(_0x59ecc3[_0xbc24('0x2d')][_0xbc24('0x38')]){_0x3732cb[_0xbc24('0x35')]=_[_0xbc24('0x39')](_0x3732cb[_0xbc24('0x35')],{'$or':_[_0xbc24('0x27')](_0x5e16aa,function(_0x1c69ea){if(_0x1c69ea[_0xbc24('0x2a')]!==_0xbc24('0x3a')){var _0x14b83a={};_0x14b83a[_0x1c69ea['name']]={'$like':'%'+_0x59ecc3[_0xbc24('0x2d')][_0xbc24('0x38')]+'%'};return _0x14b83a;}})});}_0x3732cb=_['merge']({},_0x3732cb,_0x59ecc3[_0xbc24('0x3b')]);var _0x41ffd9={'where':_0x3732cb[_0xbc24('0x35')]};return db[_0xbc24('0x28')][_0xbc24('0x1a')](_0x41ffd9)[_0xbc24('0x21')](function(_0x46a986){_0x2f7eef[_0xbc24('0x1a')]=_0x46a986;if(_0x59ecc3[_0xbc24('0x2d')]['includeAll']){_0x3732cb['include']=[{'all':!![]}];}return db['ChatOfflineMessage'][_0xbc24('0x3c')](_0x3732cb);})[_0xbc24('0x21')](function(_0x22a010){_0x2f7eef[_0xbc24('0x3d')]=_0x22a010;return _0x2f7eef;})[_0xbc24('0x21')](respondWithFilteredResult(_0xdb3e88,_0x3732cb))['catch'](handleError(_0xdb3e88,null));};exports[_0xbc24('0x3e')]=function(_0x3aa9ed,_0x15c8fb){var _0x269250={'raw':!![],'where':{'id':_0x3aa9ed['params']['id']}},_0x539282={};_0x539282[_0xbc24('0x2c')]=_[_0xbc24('0x3f')](db[_0xbc24('0x28')]['rawAttributes']);_0x539282[_0xbc24('0x2d')]=_['keys'](_0x3aa9ed[_0xbc24('0x2d')]);_0x539282['filters']=_['intersection'](_0x539282['model'],_0x539282['query']);_0x269250['attributes']=_[_0xbc24('0x2f')](_0x539282['model'],qs[_0xbc24('0x30')](_0x3aa9ed[_0xbc24('0x2d')][_0xbc24('0x30')]));_0x269250[_0xbc24('0x2e')]=_0x269250[_0xbc24('0x2e')][_0xbc24('0x31')]?_0x269250['attributes']:_0x539282['model'];if(_0x3aa9ed[_0xbc24('0x2d')][_0xbc24('0x40')]){_0x269250[_0xbc24('0x41')]=[{'all':!![]}];}_0x269250=_[_0xbc24('0x39')]({},_0x269250,_0x3aa9ed[_0xbc24('0x3b')]);return db['ChatOfflineMessage'][_0xbc24('0x42')](_0x269250)[_0xbc24('0x21')](handleEntityNotFound(_0x15c8fb,null))[_0xbc24('0x21')](respondWithResult(_0x15c8fb,null))[_0xbc24('0x43')](handleError(_0x15c8fb,null));};exports[_0xbc24('0x44')]=function(_0x47f80d,_0x4fcbc7){return db['ChatOfflineMessage'][_0xbc24('0x44')](_0x47f80d[_0xbc24('0x45')],{})[_0xbc24('0x21')](respondWithResult(_0x4fcbc7,0xc9))[_0xbc24('0x43')](handleError(_0x4fcbc7,null));};exports[_0xbc24('0x20')]=function(_0x21dae4,_0xc6b02b){if(_0x21dae4[_0xbc24('0x45')]['id']){delete _0x21dae4[_0xbc24('0x45')]['id'];}return db[_0xbc24('0x28')][_0xbc24('0x42')]({'where':{'id':_0x21dae4[_0xbc24('0x46')]['id']}})['then'](handleEntityNotFound(_0xc6b02b,null))[_0xbc24('0x21')](saveUpdates(_0x21dae4[_0xbc24('0x45')],null))[_0xbc24('0x21')](respondWithResult(_0xc6b02b,null))[_0xbc24('0x43')](handleError(_0xc6b02b,null));};exports[_0xbc24('0x22')]=function(_0x3f444b,_0xdd73bf){return db['Attachment'][_0xbc24('0x3c')]({'where':{'ChatOfflineMessageId':eq[_0xbc24('0x46')]['id']},'raw':!![]})[_0xbc24('0x21')](function(_0x1d006d){_0x1d006d[_0xbc24('0x47')](function(_0xd92d20){var _0x571862=path['join'](config['root'],_0xbc24('0x48'),_0xbc24('0x49'),_0xbc24('0x4a'),_0xbc24('0x4b'),_0xd92d20[_0xbc24('0x4c')]);var _0x3d2711=fs[_0xbc24('0x4d')](_0x571862);if(_0x3d2711)fs_extra['remove'](_0x571862);});})['then'](function(){return db[_0xbc24('0x28')][_0xbc24('0x42')]({'where':{'id':_0x3f444b['params']['id']},'individualHooks':!![]});})[_0xbc24('0x21')](handleEntityNotFound(_0xdd73bf,null))[_0xbc24('0x21')](removeEntity(_0xdd73bf,null))['catch'](handleError(_0xdd73bf,null));};exports[_0xbc24('0x4e')]=function(_0x1845b9,_0x4b7400){return db['ChatOfflineMessage'][_0xbc24('0x4e')]()[_0xbc24('0x21')](respondWithResult(_0x4b7400,null))['catch'](handleError(_0x4b7400,null));}; \ No newline at end of file +var _0x4390=['includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','destroy','Attachment','forEach','root','server','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','end','error','name','index','ChatOfflineMessage','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','map','VIRTUAL','merge','options','then'];(function(_0x45621a,_0x55b6f6){var _0x17fe73=function(_0x2d2b7b){while(--_0x2d2b7b){_0x45621a['push'](_0x45621a['shift']());}};_0x17fe73(++_0x55b6f6);}(_0x4390,0x64));var _0x0439=function(_0x962de1,_0x361057){_0x962de1=_0x962de1-0x0;var _0x14085a=_0x4390[_0x962de1];return _0x14085a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0439('0x0'));var rimraf=require(_0x0439('0x1'));var zipdir=require(_0x0439('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0439('0x3'));var BPromise=require(_0x0439('0x4'));var Mustache=require(_0x0439('0x5'));var util=require(_0x0439('0x6'));var path=require(_0x0439('0x7'));var sox=require('sox');var csv=require(_0x0439('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0439('0x9'));var _=require(_0x0439('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0439('0xb'));var deskjs=require(_0x0439('0xc'));var toCsv=require(_0x0439('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0439('0xd'));var authService=require(_0x0439('0xe'));var qs=require(_0x0439('0xf'));var as=require(_0x0439('0x10'));var hardwareService=require(_0x0439('0x11'));var logger=require(_0x0439('0x12'))(_0x0439('0x13'));var utils=require(_0x0439('0x14'));var config=require(_0x0439('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bea10,_0x1acbb3){_0x1acbb3=_0x1acbb3||0xcc;return function(_0x19ff49){if(_0x19ff49){return _0x1bea10[_0x0439('0x16')](_0x1acbb3);}return _0x1bea10[_0x0439('0x17')](_0x1acbb3)['end']();};}function respondWithResult(_0x4509c1,_0x284200){_0x284200=_0x284200||0xc8;return function(_0x4238a6){if(_0x4238a6){return _0x4509c1['status'](_0x284200)[_0x0439('0x18')](_0x4238a6);}};}function respondWithFilteredResult(_0x34dd69,_0x1a0ddf){return function(_0x54d5c2){if(_0x54d5c2){var _0xe43414=_0x54d5c2[_0x0439('0x19')],_0x5b21a8=_0x1a0ddf['offset'],_0x33a4c1=_0x1a0ddf[_0x0439('0x1a')]+_0x1a0ddf[_0x0439('0x1b')],_0x59cdc4;if(_0x33a4c1>=_0xe43414){_0x33a4c1=_0xe43414;_0x59cdc4=0xc8;}else{_0x59cdc4=0xce;}_0x34dd69[_0x0439('0x17')](_0x59cdc4);return _0x34dd69[_0x0439('0x1c')](_0x0439('0x1d'),_0x5b21a8+'-'+_0x33a4c1+'/'+_0xe43414)[_0x0439('0x18')](_0x54d5c2);}return null;};}function patchUpdates(_0x55dbfa){return function(_0x4347e3){try{jsonpatch[_0x0439('0x1e')](_0x4347e3,_0x55dbfa,!![]);}catch(_0x3f39a5){return BPromise[_0x0439('0x1f')](_0x3f39a5);}return _0x4347e3[_0x0439('0x20')]();};}function saveUpdates(_0x2d32ab,_0x4086f9){return function(_0x33f653){if(_0x33f653){return _0x33f653[_0x0439('0x21')](_0x2d32ab)['then'](function(_0x5d98e5){return _0x5d98e5;});}return null;};}function removeEntity(_0x5c93dd,_0x3650b8){return function(_0x2c61b7){if(_0x2c61b7){return _0x2c61b7['destroy']()['then'](function(){_0x5c93dd[_0x0439('0x17')](0xcc)[_0x0439('0x22')]();});}};}function handleEntityNotFound(_0x106223,_0x39f431){return function(_0x352bc6){if(!_0x352bc6){_0x106223['sendStatus'](0x194);}return _0x352bc6;};}function handleError(_0x4f9067,_0x2a4026){_0x2a4026=_0x2a4026||0x1f4;return function(_0x3b4459){logger[_0x0439('0x23')](_0x3b4459['stack']);if(_0x3b4459['name']){delete _0x3b4459[_0x0439('0x24')];}_0x4f9067[_0x0439('0x17')](_0x2a4026)['send'](_0x3b4459);};}exports[_0x0439('0x25')]=function(_0xf9067b,_0x1903fe){var _0x273616={},_0xd72c08={},_0xab572c={'count':0x0,'rows':[]};var _0x75ea1d=_['map'](db[_0x0439('0x26')][_0x0439('0x27')],function(_0x24d743){return{'name':_0x24d743['fieldName'],'type':_0x24d743[_0x0439('0x28')]['key']};});_0xd72c08[_0x0439('0x29')]=_['map'](_0x75ea1d,_0x0439('0x24'));_0xd72c08[_0x0439('0x2a')]=_['keys'](_0xf9067b[_0x0439('0x2a')]);_0xd72c08[_0x0439('0x2b')]=_['intersection'](_0xd72c08['model'],_0xd72c08[_0x0439('0x2a')]);_0x273616[_0x0439('0x2c')]=_[_0x0439('0x2d')](_0xd72c08[_0x0439('0x29')],qs[_0x0439('0x2e')](_0xf9067b[_0x0439('0x2a')]['fields']));_0x273616[_0x0439('0x2c')]=_0x273616[_0x0439('0x2c')][_0x0439('0x2f')]?_0x273616[_0x0439('0x2c')]:_0xd72c08[_0x0439('0x29')];if(!_0xf9067b[_0x0439('0x2a')][_0x0439('0x30')](_0x0439('0x31'))){_0x273616[_0x0439('0x1b')]=qs[_0x0439('0x1b')](_0xf9067b[_0x0439('0x2a')][_0x0439('0x1b')]);_0x273616[_0x0439('0x1a')]=qs[_0x0439('0x1a')](_0xf9067b[_0x0439('0x2a')][_0x0439('0x1a')]);}_0x273616['order']=qs[_0x0439('0x32')](_0xf9067b[_0x0439('0x2a')][_0x0439('0x32')]);_0x273616[_0x0439('0x33')]=qs[_0x0439('0x2b')](_['pick'](_0xf9067b[_0x0439('0x2a')],_0xd72c08[_0x0439('0x2b')]),_0x75ea1d);if(_0xf9067b['query'][_0x0439('0x34')]){_0x273616[_0x0439('0x33')]=_['merge'](_0x273616[_0x0439('0x33')],{'$or':_[_0x0439('0x35')](_0x75ea1d,function(_0x11bc6c){if(_0x11bc6c[_0x0439('0x28')]!==_0x0439('0x36')){var _0x1fdb85={};_0x1fdb85[_0x11bc6c[_0x0439('0x24')]]={'$like':'%'+_0xf9067b[_0x0439('0x2a')]['filter']+'%'};return _0x1fdb85;}})});}_0x273616=_[_0x0439('0x37')]({},_0x273616,_0xf9067b[_0x0439('0x38')]);var _0x94e15e={'where':_0x273616['where']};return db['ChatOfflineMessage'][_0x0439('0x19')](_0x94e15e)[_0x0439('0x39')](function(_0x113dfa){_0xab572c[_0x0439('0x19')]=_0x113dfa;if(_0xf9067b[_0x0439('0x2a')][_0x0439('0x3a')]){_0x273616[_0x0439('0x3b')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x0439('0x3c')](_0x273616);})[_0x0439('0x39')](function(_0x2075e6){_0xab572c[_0x0439('0x3d')]=_0x2075e6;return _0xab572c;})[_0x0439('0x39')](respondWithFilteredResult(_0x1903fe,_0x273616))[_0x0439('0x3e')](handleError(_0x1903fe,null));};exports[_0x0439('0x3f')]=function(_0x2e0a80,_0x3d832a){var _0x3aad44={'raw':!![],'where':{'id':_0x2e0a80[_0x0439('0x40')]['id']}},_0x5366c5={};_0x5366c5[_0x0439('0x29')]=_[_0x0439('0x41')](db[_0x0439('0x26')][_0x0439('0x27')]);_0x5366c5[_0x0439('0x2a')]=_[_0x0439('0x41')](_0x2e0a80[_0x0439('0x2a')]);_0x5366c5['filters']=_[_0x0439('0x2d')](_0x5366c5['model'],_0x5366c5[_0x0439('0x2a')]);_0x3aad44['attributes']=_['intersection'](_0x5366c5[_0x0439('0x29')],qs[_0x0439('0x2e')](_0x2e0a80[_0x0439('0x2a')]['fields']));_0x3aad44[_0x0439('0x2c')]=_0x3aad44[_0x0439('0x2c')][_0x0439('0x2f')]?_0x3aad44['attributes']:_0x5366c5[_0x0439('0x29')];if(_0x2e0a80[_0x0439('0x2a')][_0x0439('0x3a')]){_0x3aad44[_0x0439('0x3b')]=[{'all':!![]}];}_0x3aad44=_[_0x0439('0x37')]({},_0x3aad44,_0x2e0a80['options']);return db['ChatOfflineMessage']['find'](_0x3aad44)[_0x0439('0x39')](handleEntityNotFound(_0x3d832a,null))['then'](respondWithResult(_0x3d832a,null))[_0x0439('0x3e')](handleError(_0x3d832a,null));};exports[_0x0439('0x42')]=function(_0x24efc2,_0x416b2b){return db[_0x0439('0x26')][_0x0439('0x42')](_0x24efc2[_0x0439('0x43')],{})['then'](respondWithResult(_0x416b2b,0xc9))['catch'](handleError(_0x416b2b,null));};exports[_0x0439('0x21')]=function(_0x1a3272,_0x4555ee){if(_0x1a3272[_0x0439('0x43')]['id']){delete _0x1a3272[_0x0439('0x43')]['id'];}return db[_0x0439('0x26')][_0x0439('0x44')]({'where':{'id':_0x1a3272['params']['id']}})['then'](handleEntityNotFound(_0x4555ee,null))['then'](saveUpdates(_0x1a3272[_0x0439('0x43')],null))[_0x0439('0x39')](respondWithResult(_0x4555ee,null))[_0x0439('0x3e')](handleError(_0x4555ee,null));};exports[_0x0439('0x45')]=function(_0x224fec,_0xba02e4){return db[_0x0439('0x46')][_0x0439('0x3c')]({'where':{'ChatOfflineMessageId':eq[_0x0439('0x40')]['id']},'raw':!![]})[_0x0439('0x39')](function(_0x4820c7){_0x4820c7[_0x0439('0x47')](function(_0x4fd825){var _0x8b3306=path['join'](config[_0x0439('0x48')],_0x0439('0x49'),'files',_0x0439('0x4a'),'offline-chat',_0x4fd825[_0x0439('0x4b')]);var _0x3a34b3=fs[_0x0439('0x4c')](_0x8b3306);if(_0x3a34b3)fs_extra[_0x0439('0x4d')](_0x8b3306);});})[_0x0439('0x39')](function(){return db[_0x0439('0x26')][_0x0439('0x44')]({'where':{'id':_0x224fec[_0x0439('0x40')]['id']},'individualHooks':!![]});})[_0x0439('0x39')](handleEntityNotFound(_0xba02e4,null))['then'](removeEntity(_0xba02e4,null))[_0x0439('0x3e')](handleError(_0xba02e4,null));};exports[_0x0439('0x4e')]=function(_0x415e2b,_0xdfda3c){return db[_0x0439('0x26')][_0x0439('0x4e')]()['then'](respondWithResult(_0xdfda3c,null))['catch'](handleError(_0xdfda3c,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index ba4049d..340647c 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 _0x9b9b=['path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise'];(function(_0x49b56e,_0x448f22){var _0x565d51=function(_0x5dd77c){while(--_0x5dd77c){_0x49b56e['push'](_0x49b56e['shift']());}};_0x565d51(++_0x448f22);}(_0x9b9b,0x114));var _0xb9b9=function(_0x4f89fa,_0x39546d){_0x4f89fa=_0x4f89fa-0x0;var _0x338542=_0x9b9b[_0x4f89fa];return _0x338542;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb9b9('0x1'));var BPromise=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var fs=require('fs');var path=require(_0xb9b9('0x4'));var rimraf=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var attributes=require(_0xb9b9('0x7'));module[_0xb9b9('0x8')]=function(_0x79dd,_0x3d1a95){return _0x79dd[_0xb9b9('0x9')](_0xb9b9('0xa'),attributes,{'tableName':_0xb9b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb9b9('0xc'),'collate':_0xb9b9('0xd')});}; \ No newline at end of file +var _0x0e85=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','rimraf','./chatOfflineMessage.attributes','exports','ChatOfflineMessage'];(function(_0x732609,_0x439d22){var _0x1ea48b=function(_0x7bc066){while(--_0x7bc066){_0x732609['push'](_0x732609['shift']());}};_0x1ea48b(++_0x439d22);}(_0x0e85,0x7c));var _0x50e8=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x0e85[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var logger=require('../../config/logger')(_0x50e8('0x2'));var moment=require(_0x50e8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50e8('0x4'));var config=require('../../config/environment');var attributes=require(_0x50e8('0x5'));module[_0x50e8('0x6')]=function(_0xe3151e,_0xfde42){return _0xe3151e['define'](_0x50e8('0x7'),attributes,{'tableName':_0x50e8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x50e8('0x9'),'collate':_0x50e8('0xa')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 4b0bbb2..7bb487f 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 _0x51cb=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4532e7,_0x2f125c){var _0x3d2d5e=function(_0x17b509){while(--_0x17b509){_0x4532e7['push'](_0x4532e7['shift']());}};_0x3d2d5e(++_0x2f125c);}(_0x51cb,0x1cd));var _0xb51c=function(_0x48e04f,_0x2e1ef9){_0x48e04f=_0x48e04f-0x0;var _0x1b36e5=_0x51cb[_0x48e04f];return _0x1b36e5;};'use strict';var _=require(_0xb51c('0x0'));var util=require(_0xb51c('0x1'));var moment=require(_0xb51c('0x2'));var BPromise=require(_0xb51c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb51c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb51c('0x5'));var logger=require(_0xb51c('0x6'))(_0xb51c('0x7'));var config=require('../../config/environment');var jayson=require(_0xb51c('0x8'));var client=jayson[_0xb51c('0x9')][_0xb51c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4decaa,_0x3125dc,_0x5f41b2){return new BPromise(function(_0x15c544,_0xfa18f7){return client[_0xb51c('0xb')](_0x4decaa,_0x5f41b2)['then'](function(_0x58f87b){logger['info'](_0xb51c('0xc'),_0x3125dc,_0xb51c('0xd'));logger[_0xb51c('0xe')](_0xb51c('0xf'),_0x3125dc,_0xb51c('0xd'),JSON[_0xb51c('0x10')](_0x58f87b));if(_0x58f87b['error']){if(_0x58f87b[_0xb51c('0x11')][_0xb51c('0x12')]===0x1f4){logger[_0xb51c('0x11')](_0xb51c('0xc'),_0x3125dc,_0x58f87b['error'][_0xb51c('0x13')]);return _0xfa18f7(_0x58f87b[_0xb51c('0x11')]['message']);}logger[_0xb51c('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3125dc,_0x58f87b[_0xb51c('0x11')][_0xb51c('0x13')]);return _0x15c544(_0x58f87b[_0xb51c('0x11')][_0xb51c('0x13')]);}else{logger[_0xb51c('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3125dc,_0xb51c('0xd'));_0x15c544(_0x58f87b[_0xb51c('0x15')][_0xb51c('0x13')]);}})[_0xb51c('0x16')](function(_0x5ae595){logger['error'](_0xb51c('0xc'),_0x3125dc,_0x5ae595);_0xfa18f7(_0x5ae595);});});} \ No newline at end of file +var _0x2794=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','catch'];(function(_0x3f8309,_0x38eb50){var _0xa496c7=function(_0x2fdaa1){while(--_0x2fdaa1){_0x3f8309['push'](_0x3f8309['shift']());}};_0xa496c7(++_0x38eb50);}(_0x2794,0x169));var _0x4279=function(_0x4673f1,_0x43ff8a){_0x4673f1=_0x4673f1-0x0;var _0x2d4a9f=_0x2794[_0x4673f1];return _0x2d4a9f;};'use strict';var _=require(_0x4279('0x0'));var util=require('util');var moment=require(_0x4279('0x1'));var BPromise=require('bluebird');var rs=require(_0x4279('0x2'));var fs=require('fs');var Redis=require(_0x4279('0x3'));var db=require(_0x4279('0x4'))['db'];var utils=require(_0x4279('0x5'));var logger=require('../../config/logger')(_0x4279('0x6'));var config=require(_0x4279('0x7'));var jayson=require(_0x4279('0x8'));var client=jayson[_0x4279('0x9')][_0x4279('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x334147,_0x33ca71,_0x20896e){return new BPromise(function(_0x3a2dc9,_0x5374d6){return client['request'](_0x334147,_0x20896e)[_0x4279('0xb')](function(_0x38ad38){logger[_0x4279('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x33ca71,_0x4279('0xd'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x33ca71,_0x4279('0xd'),JSON['stringify'](_0x38ad38));if(_0x38ad38[_0x4279('0xe')]){if(_0x38ad38[_0x4279('0xe')][_0x4279('0xf')]===0x1f4){logger[_0x4279('0xe')](_0x4279('0x10'),_0x33ca71,_0x38ad38[_0x4279('0xe')][_0x4279('0x11')]);return _0x5374d6(_0x38ad38['error']['message']);}logger['error'](_0x4279('0x10'),_0x33ca71,_0x38ad38[_0x4279('0xe')][_0x4279('0x11')]);return _0x3a2dc9(_0x38ad38['error'][_0x4279('0x11')]);}else{logger[_0x4279('0xc')](_0x4279('0x10'),_0x33ca71,_0x4279('0xd'));_0x3a2dc9(_0x38ad38['result']['message']);}})[_0x4279('0x12')](function(_0xb30ba6){logger[_0x4279('0xe')](_0x4279('0x10'),_0x33ca71,_0xb30ba6);_0x5374d6(_0xb30ba6);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index bc48245..e338780 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 _0x7b7c=['index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','fs-extra','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated'];(function(_0x2a06f1,_0x5d71e0){var _0x5c43b1=function(_0x20abbc){while(--_0x20abbc){_0x2a06f1['push'](_0x2a06f1['shift']());}};_0x5c43b1(++_0x5d71e0);}(_0x7b7c,0x161));var _0xc7b7=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x7b7c[_0x4154a6];return _0x3b2786;};'use strict';var multer=require('multer');var util=require(_0xc7b7('0x0'));var path=require(_0xc7b7('0x1'));var timeout=require(_0xc7b7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc7b7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc7b7('0x4'));var config=require('../../config/environment');var controller=require(_0xc7b7('0x5'));router[_0xc7b7('0x6')]('/',auth[_0xc7b7('0x7')](),controller[_0xc7b7('0x8')]);router[_0xc7b7('0x6')](_0xc7b7('0x9'),auth[_0xc7b7('0x7')](),controller[_0xc7b7('0xa')]);router['get']('/:id',auth[_0xc7b7('0x7')](),controller[_0xc7b7('0xb')]);router[_0xc7b7('0xc')]('/',auth[_0xc7b7('0x7')](),controller[_0xc7b7('0xd')]);router[_0xc7b7('0xe')](_0xc7b7('0xf'),auth[_0xc7b7('0x7')](),controller[_0xc7b7('0x10')]);router[_0xc7b7('0x11')](_0xc7b7('0xf'),auth[_0xc7b7('0x7')](),controller[_0xc7b7('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6354=['/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe'];(function(_0x15d543,_0x60ecc3){var _0x42bba6=function(_0x3493d2){while(--_0x3493d2){_0x15d543['push'](_0x15d543['shift']());}};_0x42bba6(++_0x60ecc3);}(_0x6354,0xc5));var _0x4635=function(_0x1e04c4,_0x5f5592){_0x1e04c4=_0x1e04c4-0x0;var _0x13ad93=_0x6354[_0x1e04c4];return _0x13ad93;};'use strict';var multer=require('multer');var util=require(_0x4635('0x0'));var path=require(_0x4635('0x1'));var timeout=require(_0x4635('0x2'));var express=require(_0x4635('0x3'));var router=express[_0x4635('0x4')]();var fs_extra=require(_0x4635('0x5'));var auth=require(_0x4635('0x6'));var interaction=require(_0x4635('0x7'));var config=require(_0x4635('0x8'));var controller=require(_0x4635('0x9'));router[_0x4635('0xa')]('/',auth[_0x4635('0xb')](),controller['index']);router[_0x4635('0xa')](_0x4635('0xc'),auth[_0x4635('0xb')](),controller['describe']);router[_0x4635('0xa')](_0x4635('0xd'),auth[_0x4635('0xb')](),controller[_0x4635('0xe')]);router[_0x4635('0xf')]('/',auth[_0x4635('0xb')](),controller['create']);router[_0x4635('0x10')](_0x4635('0xd'),auth[_0x4635('0xb')](),controller[_0x4635('0x11')]);router[_0x4635('0x12')](_0x4635('0xd'),auth['isAuthenticated'](),controller[_0x4635('0x13')]);module[_0x4635('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 307efc4..b10e53e 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 _0xf3e1=['exports','STRING','ENUM','mouseOver','INTEGER'];(function(_0x62cbcd,_0x1e61c7){var _0x16d7ac=function(_0x547124){while(--_0x547124){_0x62cbcd['push'](_0x62cbcd['shift']());}};_0x16d7ac(++_0x1e61c7);}(_0xf3e1,0x18b));var _0x1f3e=function(_0x43316d,_0x5ebd8f){_0x43316d=_0x43316d-0x0;var _0x52d343=_0xf3e1[_0x43316d];return _0x52d343;};'use strict';var Sequelize=require('sequelize');module[_0x1f3e('0x0')]={'name':{'type':Sequelize[_0x1f3e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1f3e('0x2')](_0x1f3e('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x1f3e('0x1')]},'timeout':{'type':Sequelize[_0x1f3e('0x4')]}}; \ No newline at end of file +var _0x788d=['ENUM','mouseOver','sequelize','STRING'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x788d,0xf6));var _0xd788=function(_0x46fafa,_0x1a98c9){_0x46fafa=_0x46fafa-0x0;var _0x467d06=_0x788d[_0x46fafa];return _0x467d06;};'use strict';var Sequelize=require(_0xd788('0x0'));module['exports']={'name':{'type':Sequelize[_0xd788('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd788('0x2')](_0xd788('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xd788('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 9c6f00d..e3014e7 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 _0xceab=['catch','create','body','destroy','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','show','model','rawAttributes','query','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','ChatProactiveAction','find'];(function(_0xc850f8,_0x2f9080){var _0x56ca2d=function(_0x49b320){while(--_0x49b320){_0xc850f8['push'](_0xc850f8['shift']());}};_0x56ca2d(++_0x2f9080);}(_0xceab,0x83));var _0xbcea=function(_0x3b637e,_0x25dc7e){_0x3b637e=_0x3b637e-0x0;var _0x56ec54=_0xceab[_0x3b637e];return _0x56ec54;};'use strict';var pdf=require(_0xbcea('0x0'));var emlformat=require(_0xbcea('0x1'));var rimraf=require(_0xbcea('0x2'));var zipdir=require(_0xbcea('0x3'));var jsonpatch=require(_0xbcea('0x4'));var rp=require(_0xbcea('0x5'));var moment=require(_0xbcea('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xbcea('0x7'));var util=require(_0xbcea('0x8'));var path=require(_0xbcea('0x9'));var sox=require(_0xbcea('0xa'));var csv=require(_0xbcea('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbcea('0xc'));var _=require(_0xbcea('0xd'));var squel=require('squel');var crypto=require(_0xbcea('0xe'));var jsforce=require(_0xbcea('0xf'));var deskjs=require(_0xbcea('0x10'));var toCsv=require(_0xbcea('0xb'));var querystring=require(_0xbcea('0x11'));var Papa=require(_0xbcea('0x12'));var Redis=require(_0xbcea('0x13'));var authService=require(_0xbcea('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xbcea('0x15'));var hardwareService=require(_0xbcea('0x16'));var logger=require('../../config/logger')(_0xbcea('0x17'));var utils=require(_0xbcea('0x18'));var config=require(_0xbcea('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x478fd7,_0x20a74e){_0x20a74e=_0x20a74e||0xcc;return function(_0x2c8421){if(_0x2c8421){return _0x478fd7[_0xbcea('0x1a')](_0x20a74e);}return _0x478fd7['status'](_0x20a74e)[_0xbcea('0x1b')]();};}function respondWithResult(_0x256140,_0x21c404){_0x21c404=_0x21c404||0xc8;return function(_0x291001){if(_0x291001){return _0x256140[_0xbcea('0x1c')](_0x21c404)['json'](_0x291001);}};}function respondWithFilteredResult(_0x58fb15,_0x466ce2){return function(_0xbd13f5){if(_0xbd13f5){var _0x337cf7=_0xbd13f5['count'],_0x497adc=_0x466ce2[_0xbcea('0x1d')],_0x4f19a0=_0x466ce2[_0xbcea('0x1d')]+_0x466ce2['limit'],_0x3b3bda;if(_0x4f19a0>=_0x337cf7){_0x4f19a0=_0x337cf7;_0x3b3bda=0xc8;}else{_0x3b3bda=0xce;}_0x58fb15[_0xbcea('0x1c')](_0x3b3bda);return _0x58fb15[_0xbcea('0x1e')](_0xbcea('0x1f'),_0x497adc+'-'+_0x4f19a0+'/'+_0x337cf7)[_0xbcea('0x20')](_0xbd13f5);}return null;};}function patchUpdates(_0x461693){return function(_0x5069d7){try{jsonpatch[_0xbcea('0x21')](_0x5069d7,_0x461693,!![]);}catch(_0x15ce2f){return BPromise[_0xbcea('0x22')](_0x15ce2f);}return _0x5069d7[_0xbcea('0x23')]();};}function saveUpdates(_0x45d9de,_0x4c73cc){return function(_0x17bfa4){if(_0x17bfa4){return _0x17bfa4[_0xbcea('0x24')](_0x45d9de)[_0xbcea('0x25')](function(_0x59a298){return _0x59a298;});}return null;};}function removeEntity(_0x2ba26a,_0x1d1d69){return function(_0x4c5d9a){if(_0x4c5d9a){return _0x4c5d9a['destroy']()['then'](function(){_0x2ba26a[_0xbcea('0x1c')](0xcc)[_0xbcea('0x1b')]();});}};}function handleEntityNotFound(_0x50c4a3,_0x2fc1d7){return function(_0xee7074){if(!_0xee7074){_0x50c4a3[_0xbcea('0x1a')](0x194);}return _0xee7074;};}function handleError(_0x5c20d2,_0x1db21c){_0x1db21c=_0x1db21c||0x1f4;return function(_0x55867d){logger[_0xbcea('0x26')](_0x55867d[_0xbcea('0x27')]);if(_0x55867d[_0xbcea('0x28')]){delete _0x55867d[_0xbcea('0x28')];}_0x5c20d2[_0xbcea('0x1c')](_0x1db21c)[_0xbcea('0x29')](_0x55867d);};}exports[_0xbcea('0x2a')]=function(_0x630501,_0x3cc1d8){var _0x2692a6={'raw':!![],'where':{'id':_0x630501['params']['id']}},_0x28e2c1={};_0x28e2c1[_0xbcea('0x2b')]=_['keys'](db['ChatProactiveAction'][_0xbcea('0x2c')]);_0x28e2c1[_0xbcea('0x2d')]=_[_0xbcea('0x2e')](_0x630501[_0xbcea('0x2d')]);_0x28e2c1[_0xbcea('0x2f')]=_[_0xbcea('0x30')](_0x28e2c1[_0xbcea('0x2b')],_0x28e2c1['query']);_0x2692a6['attributes']=_['intersection'](_0x28e2c1[_0xbcea('0x2b')],qs[_0xbcea('0x31')](_0x630501['query'][_0xbcea('0x31')]));_0x2692a6[_0xbcea('0x32')]=_0x2692a6[_0xbcea('0x32')][_0xbcea('0x33')]?_0x2692a6[_0xbcea('0x32')]:_0x28e2c1[_0xbcea('0x2b')];if(_0x630501[_0xbcea('0x2d')][_0xbcea('0x34')]){_0x2692a6[_0xbcea('0x35')]=[{'all':!![]}];}_0x2692a6=_[_0xbcea('0x36')]({},_0x2692a6,_0x630501[_0xbcea('0x37')]);return db[_0xbcea('0x38')][_0xbcea('0x39')](_0x2692a6)[_0xbcea('0x25')](handleEntityNotFound(_0x3cc1d8,null))[_0xbcea('0x25')](respondWithResult(_0x3cc1d8,null))[_0xbcea('0x3a')](handleError(_0x3cc1d8,null));};exports[_0xbcea('0x3b')]=function(_0x54976a,_0xbdca56){return db[_0xbcea('0x38')]['create'](_0x54976a[_0xbcea('0x3c')],{})[_0xbcea('0x25')](respondWithResult(_0xbdca56,0xc9))[_0xbcea('0x3a')](handleError(_0xbdca56,null));};exports['update']=function(_0x2caca2,_0x5d9e23){if(_0x2caca2[_0xbcea('0x3c')]['id']){delete _0x2caca2[_0xbcea('0x3c')]['id'];}return db[_0xbcea('0x38')][_0xbcea('0x39')]({'where':{'id':_0x2caca2['params']['id']}})['then'](handleEntityNotFound(_0x5d9e23,null))[_0xbcea('0x25')](saveUpdates(_0x2caca2['body'],null))[_0xbcea('0x25')](respondWithResult(_0x5d9e23,null))[_0xbcea('0x3a')](handleError(_0x5d9e23,null));};exports[_0xbcea('0x3d')]=function(_0x5d2ead,_0x4b95b0){return db[_0xbcea('0x38')][_0xbcea('0x39')]({'where':{'id':_0x5d2ead[_0xbcea('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4b95b0,null))[_0xbcea('0x25')](removeEntity(_0x4b95b0,null))[_0xbcea('0x3a')](handleError(_0x4b95b0,null));}; \ No newline at end of file +var _0x5538=['sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','destroy','error','name','send','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4686f2,_0x3ad978){var _0x2f54dc=function(_0x5cb482){while(--_0x5cb482){_0x4686f2['push'](_0x4686f2['shift']());}};_0x2f54dc(++_0x3ad978);}(_0x5538,0x19b));var _0x8553=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x5538[_0x504df1];return _0x1063b5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8553('0x0'));var rimraf=require(_0x8553('0x1'));var zipdir=require(_0x8553('0x2'));var jsonpatch=require(_0x8553('0x3'));var rp=require(_0x8553('0x4'));var moment=require(_0x8553('0x5'));var BPromise=require(_0x8553('0x6'));var Mustache=require(_0x8553('0x7'));var util=require(_0x8553('0x8'));var path=require('path');var sox=require(_0x8553('0x9'));var csv=require(_0x8553('0xa'));var ejs=require(_0x8553('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8553('0xc'));var squel=require('squel');var crypto=require(_0x8553('0xd'));var jsforce=require(_0x8553('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8553('0xf'));var Papa=require(_0x8553('0x10'));var Redis=require(_0x8553('0x11'));var authService=require(_0x8553('0x12'));var qs=require(_0x8553('0x13'));var as=require(_0x8553('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8553('0x15'))('api');var utils=require(_0x8553('0x16'));var config=require(_0x8553('0x17'));var licenseUtil=require(_0x8553('0x18'));var db=require(_0x8553('0x19'))['db'];function respondWithStatusCode(_0x58f6d3,_0x14bc33){_0x14bc33=_0x14bc33||0xcc;return function(_0x3dcf3f){if(_0x3dcf3f){return _0x58f6d3[_0x8553('0x1a')](_0x14bc33);}return _0x58f6d3[_0x8553('0x1b')](_0x14bc33)[_0x8553('0x1c')]();};}function respondWithResult(_0xe3306a,_0x5b1d4e){_0x5b1d4e=_0x5b1d4e||0xc8;return function(_0x20c221){if(_0x20c221){return _0xe3306a['status'](_0x5b1d4e)[_0x8553('0x1d')](_0x20c221);}};}function respondWithFilteredResult(_0x2475cd,_0x532ce7){return function(_0x2935b7){if(_0x2935b7){var _0x270d59=_0x2935b7[_0x8553('0x1e')],_0xf4302b=_0x532ce7['offset'],_0x4b02de=_0x532ce7[_0x8553('0x1f')]+_0x532ce7['limit'],_0x4117f9;if(_0x4b02de>=_0x270d59){_0x4b02de=_0x270d59;_0x4117f9=0xc8;}else{_0x4117f9=0xce;}_0x2475cd[_0x8553('0x1b')](_0x4117f9);return _0x2475cd[_0x8553('0x20')](_0x8553('0x21'),_0xf4302b+'-'+_0x4b02de+'/'+_0x270d59)[_0x8553('0x1d')](_0x2935b7);}return null;};}function patchUpdates(_0x49b06b){return function(_0x155446){try{jsonpatch['apply'](_0x155446,_0x49b06b,!![]);}catch(_0x5f1dbf){return BPromise['reject'](_0x5f1dbf);}return _0x155446[_0x8553('0x22')]();};}function saveUpdates(_0x3ab1df,_0x30a2b6){return function(_0x27c4f6){if(_0x27c4f6){return _0x27c4f6[_0x8553('0x23')](_0x3ab1df)[_0x8553('0x24')](function(_0x3b3173){return _0x3b3173;});}return null;};}function removeEntity(_0x5d6f3f,_0x5b2ed6){return function(_0x3a2fd6){if(_0x3a2fd6){return _0x3a2fd6[_0x8553('0x25')]()[_0x8553('0x24')](function(){_0x5d6f3f[_0x8553('0x1b')](0xcc)[_0x8553('0x1c')]();});}};}function handleEntityNotFound(_0x592868,_0x256ac2){return function(_0x439927){if(!_0x439927){_0x592868['sendStatus'](0x194);}return _0x439927;};}function handleError(_0xe5412d,_0x4d3628){_0x4d3628=_0x4d3628||0x1f4;return function(_0x3b0f6c){logger[_0x8553('0x26')](_0x3b0f6c['stack']);if(_0x3b0f6c['name']){delete _0x3b0f6c[_0x8553('0x27')];}_0xe5412d[_0x8553('0x1b')](_0x4d3628)[_0x8553('0x28')](_0x3b0f6c);};}exports[_0x8553('0x29')]=function(_0xdea959,_0x1154ba){var _0xb29a38={'raw':!![],'where':{'id':_0xdea959[_0x8553('0x2a')]['id']}},_0x289665={};_0x289665['model']=_[_0x8553('0x2b')](db[_0x8553('0x2c')][_0x8553('0x2d')]);_0x289665[_0x8553('0x2e')]=_[_0x8553('0x2b')](_0xdea959['query']);_0x289665[_0x8553('0x2f')]=_[_0x8553('0x30')](_0x289665[_0x8553('0x31')],_0x289665[_0x8553('0x2e')]);_0xb29a38[_0x8553('0x32')]=_[_0x8553('0x30')](_0x289665[_0x8553('0x31')],qs['fields'](_0xdea959['query'][_0x8553('0x33')]));_0xb29a38['attributes']=_0xb29a38[_0x8553('0x32')][_0x8553('0x34')]?_0xb29a38[_0x8553('0x32')]:_0x289665[_0x8553('0x31')];if(_0xdea959[_0x8553('0x2e')][_0x8553('0x35')]){_0xb29a38['include']=[{'all':!![]}];}_0xb29a38=_[_0x8553('0x36')]({},_0xb29a38,_0xdea959[_0x8553('0x37')]);return db[_0x8553('0x2c')][_0x8553('0x38')](_0xb29a38)[_0x8553('0x24')](handleEntityNotFound(_0x1154ba,null))[_0x8553('0x24')](respondWithResult(_0x1154ba,null))[_0x8553('0x39')](handleError(_0x1154ba,null));};exports[_0x8553('0x3a')]=function(_0x112fe1,_0x27ffb8){return db[_0x8553('0x2c')][_0x8553('0x3a')](_0x112fe1[_0x8553('0x3b')],{})[_0x8553('0x24')](respondWithResult(_0x27ffb8,0xc9))[_0x8553('0x39')](handleError(_0x27ffb8,null));};exports[_0x8553('0x23')]=function(_0x1dbd32,_0x520935){if(_0x1dbd32[_0x8553('0x3b')]['id']){delete _0x1dbd32[_0x8553('0x3b')]['id'];}return db[_0x8553('0x2c')][_0x8553('0x38')]({'where':{'id':_0x1dbd32[_0x8553('0x2a')]['id']}})[_0x8553('0x24')](handleEntityNotFound(_0x520935,null))['then'](saveUpdates(_0x1dbd32[_0x8553('0x3b')],null))['then'](respondWithResult(_0x520935,null))[_0x8553('0x39')](handleError(_0x520935,null));};exports[_0x8553('0x25')]=function(_0x2a7b00,_0x29fed6){return db['ChatProactiveAction']['find']({'where':{'id':_0x2a7b00[_0x8553('0x2a')]['id']}})[_0x8553('0x24')](handleEntityNotFound(_0x29fed6,null))[_0x8553('0x24')](removeEntity(_0x29fed6,null))[_0x8553('0x39')](handleError(_0x29fed6,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index ed72d63..3b08d90 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 _0x780c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x15f972,_0x4a1fc7){var _0x3d916e=function(_0x4efd86){while(--_0x4efd86){_0x15f972['push'](_0x15f972['shift']());}};_0x3d916e(++_0x4a1fc7);}(_0x780c,0x1d4));var _0xc780=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x780c[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0xc780('0x0'));var util=require(_0xc780('0x1'));var logger=require(_0xc780('0x2'))(_0xc780('0x3'));var moment=require(_0xc780('0x4'));var BPromise=require(_0xc780('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc780('0x6'));var rimraf=require(_0xc780('0x7'));var config=require(_0xc780('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0xc780('0x9')]=function(_0x386312,_0x447a02){return _0x386312[_0xc780('0xa')](_0xc780('0xb'),attributes,{'tableName':_0xc780('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf44f=['../../config/environment','exports','define','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x347c3d,_0x57849a){var _0x2d00c8=function(_0x3f9c3e){while(--_0x3f9c3e){_0x347c3d['push'](_0x347c3d['shift']());}};_0x2d00c8(++_0x57849a);}(_0xf44f,0x1d7));var _0xff44=function(_0x124798,_0x457a6d){_0x124798=_0x124798-0x0;var _0x2667f0=_0xf44f[_0x124798];return _0x2667f0;};'use strict';var _=require('lodash');var util=require(_0xff44('0x0'));var logger=require(_0xff44('0x1'))('api');var moment=require(_0xff44('0x2'));var BPromise=require(_0xff44('0x3'));var rp=require(_0xff44('0x4'));var fs=require('fs');var path=require(_0xff44('0x5'));var rimraf=require('rimraf');var config=require(_0xff44('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0xff44('0x7')]=function(_0x1a5954,_0xe82ebe){return _0x1a5954[_0xff44('0x8')]('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','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 6bb681b..f302f80 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 _0xd0b9=['then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x53e9c6,_0x460d70){var _0x23ef39=function(_0x3004d5){while(--_0x3004d5){_0x53e9c6['push'](_0x53e9c6['shift']());}};_0x23ef39(++_0x460d70);}(_0xd0b9,0x6f));var _0x9d0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0b9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d0b('0x0'));var util=require(_0x9d0b('0x1'));var moment=require(_0x9d0b('0x2'));var BPromise=require(_0x9d0b('0x3'));var rs=require(_0x9d0b('0x4'));var fs=require('fs');var Redis=require(_0x9d0b('0x5'));var db=require(_0x9d0b('0x6'))['db'];var utils=require(_0x9d0b('0x7'));var logger=require(_0x9d0b('0x8'))('rpc');var config=require(_0x9d0b('0x9'));var jayson=require(_0x9d0b('0xa'));var client=jayson[_0x9d0b('0xb')][_0x9d0b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14d76f,_0x3fce59,_0x2ee830){return new BPromise(function(_0x312fac,_0xbac113){return client[_0x9d0b('0xd')](_0x14d76f,_0x2ee830)[_0x9d0b('0xe')](function(_0xaf0dd2){logger[_0x9d0b('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x3fce59,_0x9d0b('0x10'));logger[_0x9d0b('0x11')](_0x9d0b('0x12'),_0x3fce59,'request\x20sent',JSON[_0x9d0b('0x13')](_0xaf0dd2));if(_0xaf0dd2[_0x9d0b('0x14')]){if(_0xaf0dd2[_0x9d0b('0x14')]['code']===0x1f4){logger[_0x9d0b('0x14')](_0x9d0b('0x15'),_0x3fce59,_0xaf0dd2[_0x9d0b('0x14')][_0x9d0b('0x16')]);return _0xbac113(_0xaf0dd2[_0x9d0b('0x14')][_0x9d0b('0x16')]);}logger['error'](_0x9d0b('0x15'),_0x3fce59,_0xaf0dd2[_0x9d0b('0x14')][_0x9d0b('0x16')]);return _0x312fac(_0xaf0dd2['error'][_0x9d0b('0x16')]);}else{logger[_0x9d0b('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x3fce59,'request\x20sent');_0x312fac(_0xaf0dd2[_0x9d0b('0x17')][_0x9d0b('0x16')]);}})[_0x9d0b('0x18')](function(_0x384061){logger[_0x9d0b('0x14')](_0x9d0b('0x15'),_0x3fce59,_0x384061);_0xbac113(_0x384061);});});} \ No newline at end of file +var _0xdacc=['../../config/utils','../../config/logger','rpc','../../config/environment','client','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','ioredis','../../mysqldb'];(function(_0x50ea87,_0x24791c){var _0xf7c236=function(_0x9563cd){while(--_0x9563cd){_0x50ea87['push'](_0x50ea87['shift']());}};_0xf7c236(++_0x24791c);}(_0xdacc,0x150));var _0xcdac=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdacc[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xcdac('0x0'));var moment=require(_0xcdac('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdac('0x2'));var db=require(_0xcdac('0x3'))['db'];var utils=require(_0xcdac('0x4'));var logger=require(_0xcdac('0x5'))(_0xcdac('0x6'));var config=require(_0xcdac('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcdac('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x179f56,_0x545eed,_0x30878c){return new BPromise(function(_0x17cd8f,_0x1907d8){return client['request'](_0x179f56,_0x30878c)[_0xcdac('0x9')](function(_0x34f535){logger['info'](_0xcdac('0xa'),_0x545eed,_0xcdac('0xb'));logger['debug'](_0xcdac('0xc'),_0x545eed,_0xcdac('0xb'),JSON[_0xcdac('0xd')](_0x34f535));if(_0x34f535[_0xcdac('0xe')]){if(_0x34f535['error'][_0xcdac('0xf')]===0x1f4){logger[_0xcdac('0xe')](_0xcdac('0xa'),_0x545eed,_0x34f535[_0xcdac('0xe')][_0xcdac('0x10')]);return _0x1907d8(_0x34f535[_0xcdac('0xe')][_0xcdac('0x10')]);}logger[_0xcdac('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x545eed,_0x34f535[_0xcdac('0xe')][_0xcdac('0x10')]);return _0x17cd8f(_0x34f535['error'][_0xcdac('0x10')]);}else{logger[_0xcdac('0x11')](_0xcdac('0xa'),_0x545eed,_0xcdac('0xb'));_0x17cd8f(_0x34f535[_0xcdac('0x12')][_0xcdac('0x10')]);}})[_0xcdac('0x13')](function(_0x480ecc){logger['error'](_0xcdac('0xa'),_0x545eed,_0x480ecc);_0x1907d8(_0x480ecc);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 6151272..350e65c 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 _0xc669=['show','post','create','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./chatProactiveAction.controller','/:id'];(function(_0x53b443,_0x1669f7){var _0x32b461=function(_0x347057){while(--_0x347057){_0x53b443['push'](_0x53b443['shift']());}};_0x32b461(++_0x1669f7);}(_0xc669,0xc7));var _0x9c66=function(_0x395104,_0x5de270){_0x395104=_0x395104-0x0;var _0x4360bb=_0xc669[_0x395104];return _0x4360bb;};'use strict';var multer=require(_0x9c66('0x0'));var util=require(_0x9c66('0x1'));var path=require(_0x9c66('0x2'));var timeout=require(_0x9c66('0x3'));var express=require(_0x9c66('0x4'));var router=express['Router']();var fs_extra=require(_0x9c66('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9c66('0x6'));var config=require('../../config/environment');var controller=require(_0x9c66('0x7'));router['get'](_0x9c66('0x8'),auth['isAuthenticated'](),controller[_0x9c66('0x9')]);router[_0x9c66('0xa')]('/',auth['isAuthenticated'](),controller[_0x9c66('0xb')]);router['put'](_0x9c66('0x8'),auth[_0x9c66('0xc')](),controller[_0x9c66('0xd')]);router[_0x9c66('0xe')]('/:id',auth[_0x9c66('0xc')](),controller['destroy']);module[_0x9c66('0xf')]=router; \ No newline at end of file +var _0x7169=['create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','show','post'];(function(_0x404891,_0x1a3a26){var _0x95ffbe=function(_0x21c012){while(--_0x21c012){_0x404891['push'](_0x404891['shift']());}};_0x95ffbe(++_0x1a3a26);}(_0x7169,0xe1));var _0x9716=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x7169[_0xd09668];return _0x68726;};'use strict';var multer=require(_0x9716('0x0'));var util=require(_0x9716('0x1'));var path=require(_0x9716('0x2'));var timeout=require(_0x9716('0x3'));var express=require(_0x9716('0x4'));var router=express[_0x9716('0x5')]();var fs_extra=require(_0x9716('0x6'));var auth=require(_0x9716('0x7'));var interaction=require(_0x9716('0x8'));var config=require(_0x9716('0x9'));var controller=require(_0x9716('0xa'));router[_0x9716('0xb')]('/:id',auth[_0x9716('0xc')](),controller[_0x9716('0xd')]);router[_0x9716('0xe')]('/',auth[_0x9716('0xc')](),controller[_0x9716('0xf')]);router[_0x9716('0x10')](_0x9716('0x11'),auth['isAuthenticated'](),controller[_0x9716('0x12')]);router[_0x9716('0x13')](_0x9716('0x11'),auth[_0x9716('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 78b9a72..4e5b854 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 _0x1bdd=['name','INTEGER','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x12d6de,_0xccc040){var _0x32923b=function(_0x1b150f){while(--_0x1b150f){_0x12d6de['push'](_0x12d6de['shift']());}};_0x32923b(++_0xccc040);}(_0x1bdd,0x10e));var _0xd1bd=function(_0x3e762f,_0x52155f){_0x3e762f=_0x3e762f-0x0;var _0x5277a3=_0x1bdd[_0x3e762f];return _0x5277a3;};'use strict';var Sequelize=require(_0xd1bd('0x0'));module[_0xd1bd('0x1')]={'name':{'type':Sequelize[_0xd1bd('0x2')],'unique':_0xd1bd('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd1bd('0x2')]},'timeout':{'type':Sequelize[_0xd1bd('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd1bd('0x5'),'beepall',_0xd1bd('0x6'))}}; \ No newline at end of file +var _0xa6e7=['rrmemory','beepall','sequelize','exports','STRING','name','ENUM'];(function(_0x2dcba9,_0x479cf9){var _0xfac4ca=function(_0x3f5ed3){while(--_0x3f5ed3){_0x2dcba9['push'](_0x2dcba9['shift']());}};_0xfac4ca(++_0x479cf9);}(_0xa6e7,0x191));var _0x7a6e=function(_0x2b33e8,_0x2e01fe){_0x2b33e8=_0x2b33e8-0x0;var _0x1e9cce=_0xa6e7[_0x2b33e8];return _0x1e9cce;};'use strict';var Sequelize=require(_0x7a6e('0x0'));module[_0x7a6e('0x1')]={'name':{'type':Sequelize[_0x7a6e('0x2')],'unique':_0x7a6e('0x3'),'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[_0x7a6e('0x4')](_0x7a6e('0x5'),_0x7a6e('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index f7ed889..56cead6 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 _0x6dec=['localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','index','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','include','ChatQueue','findAll','rows','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','params','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','rawAttributes','hasOwnProperty','addTeams','ids','Team','Agents','online','flatMap','sequelize','transaction','findOrCreate','forEach','userChatQueue:save','removeTeams','select','tq.TeamId','from','team_has_chat_queues','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','compact','isEmpty','omit','spread','removeAgents','isArray','emit','userChatQueue:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0x6dec,0x10e));var _0xc6de=function(_0x53706d,_0x2fd138){_0x53706d=_0x53706d-0x0;var _0x214e8b=_0x6dec[_0x53706d];return _0x214e8b;};'use strict';var pdf=require(_0xc6de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc6de('0x1'));var zipdir=require(_0xc6de('0x2'));var jsonpatch=require(_0xc6de('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc6de('0x4'));var Mustache=require(_0xc6de('0x5'));var util=require(_0xc6de('0x6'));var path=require(_0xc6de('0x7'));var sox=require(_0xc6de('0x8'));var csv=require(_0xc6de('0x9'));var ejs=require(_0xc6de('0xa'));var fs=require('fs');var fs_extra=require(_0xc6de('0xb'));var _=require(_0xc6de('0xc'));var squel=require(_0xc6de('0xd'));var crypto=require(_0xc6de('0xe'));var jsforce=require(_0xc6de('0xf'));var deskjs=require(_0xc6de('0x10'));var toCsv=require(_0xc6de('0x9'));var querystring=require(_0xc6de('0x11'));var Papa=require(_0xc6de('0x12'));var Redis=require(_0xc6de('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc6de('0x14'));var as=require(_0xc6de('0x15'));var hardwareService=require(_0xc6de('0x16'));var logger=require(_0xc6de('0x17'))(_0xc6de('0x18'));var utils=require('../../config/utils');var config=require(_0xc6de('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc6de('0x1a')]=_[_0xc6de('0x1b')](config[_0xc6de('0x1a')],{'host':_0xc6de('0x1c'),'port':0x18eb});var socket=require(_0xc6de('0x1d'))(new Redis(config[_0xc6de('0x1a')]));require(_0xc6de('0x1e'))['register'](socket);var jayson=require(_0xc6de('0x1f'));var client=jayson[_0xc6de('0x20')][_0xc6de('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2d3109,_0x53fba0,_0x290cee,_0x133117){return new BPromise(function(_0x2ec7eb,_0x3173c5){var _0x547f01=_0x133117||client;return _0x547f01['request'](_0x2d3109,_0x290cee)['then'](function(_0x5a3a05){logger[_0xc6de('0x22')](_0xc6de('0x23'),_0x53fba0,_0xc6de('0x24'));logger[_0xc6de('0x25')](_0xc6de('0x26'),_0x53fba0,_0xc6de('0x24'),JSON['stringify'](_0x5a3a05));if(_0x5a3a05[_0xc6de('0x27')]){if(_0x5a3a05[_0xc6de('0x27')][_0xc6de('0x28')]===0x1f4){logger['error'](_0xc6de('0x23'),_0x53fba0,_0x5a3a05[_0xc6de('0x27')]['message']);return _0x3173c5(_0x5a3a05[_0xc6de('0x27')][_0xc6de('0x29')]);}logger[_0xc6de('0x27')]('ChatQueue,\x20%s,\x20%s',_0x53fba0,_0x5a3a05[_0xc6de('0x27')][_0xc6de('0x29')]);return _0x2ec7eb(_0x5a3a05['error']['message']);}else{logger[_0xc6de('0x22')](_0xc6de('0x23'),_0x53fba0,'request\x20sent');_0x2ec7eb(_0x5a3a05[_0xc6de('0x2a')][_0xc6de('0x29')]);}})[_0xc6de('0x2b')](function(_0x4cec2e){logger[_0xc6de('0x27')]('ChatQueue,\x20%s,\x20%s',_0x53fba0,_0x4cec2e);_0x3173c5(_0x4cec2e);});});}function respondWithStatusCode(_0x318947,_0x39a5a7){_0x39a5a7=_0x39a5a7||0xcc;return function(_0x2c1d86){if(_0x2c1d86){return _0x318947[_0xc6de('0x2c')](_0x39a5a7);}return _0x318947[_0xc6de('0x2d')](_0x39a5a7)['end']();};}function respondWithResult(_0x125648,_0x3c737f){_0x3c737f=_0x3c737f||0xc8;return function(_0x3cdc43){if(_0x3cdc43){return _0x125648[_0xc6de('0x2d')](_0x3c737f)[_0xc6de('0x2e')](_0x3cdc43);}};}function respondWithFilteredResult(_0x4dbc32,_0x44399b){return function(_0x251465){if(_0x251465){var _0x3fb811=_0x251465[_0xc6de('0x2f')],_0x33d132=_0x44399b['offset'],_0x422c2d=_0x44399b[_0xc6de('0x30')]+_0x44399b[_0xc6de('0x31')],_0x1e8617;if(_0x422c2d>=_0x3fb811){_0x422c2d=_0x3fb811;_0x1e8617=0xc8;}else{_0x1e8617=0xce;}_0x4dbc32[_0xc6de('0x2d')](_0x1e8617);return _0x4dbc32[_0xc6de('0x32')]('Content-Range',_0x33d132+'-'+_0x422c2d+'/'+_0x3fb811)[_0xc6de('0x2e')](_0x251465);}return null;};}function patchUpdates(_0x3c7f3d){return function(_0x3fa838){try{jsonpatch[_0xc6de('0x33')](_0x3fa838,_0x3c7f3d,!![]);}catch(_0x21e6e0){return BPromise[_0xc6de('0x34')](_0x21e6e0);}return _0x3fa838[_0xc6de('0x35')]();};}function saveUpdates(_0x388ec7,_0x2e1210){return function(_0x294977){if(_0x294977){return _0x294977[_0xc6de('0x36')](_0x388ec7)[_0xc6de('0x37')](function(_0x544683){return _0x544683;});}return null;};}function removeEntity(_0x4b2561,_0x2b8bb3){return function(_0x5555e4){if(_0x5555e4){return _0x5555e4[_0xc6de('0x38')]()[_0xc6de('0x37')](function(){var _0x2b6a42=_0x5555e4[_0xc6de('0x39')]({'plain':!![]});var _0x58079a=_0xc6de('0x3a');return db[_0xc6de('0x3b')][_0xc6de('0x38')]({'where':{'type':_0x58079a,'resourceId':_0x2b6a42['id']}})['then'](function(){return _0x5555e4;});})[_0xc6de('0x37')](function(){_0x4b2561[_0xc6de('0x2d')](0xcc)[_0xc6de('0x3c')]();});}};}function handleEntityNotFound(_0x2702a3,_0x2393d3){return function(_0x569c09){if(!_0x569c09){_0x2702a3[_0xc6de('0x2c')](0x194);}return _0x569c09;};}function handleError(_0x5a9205,_0x3893a6){_0x3893a6=_0x3893a6||0x1f4;return function(_0x17cf2b){logger[_0xc6de('0x27')](_0x17cf2b[_0xc6de('0x3d')]);if(_0x17cf2b['name']){delete _0x17cf2b[_0xc6de('0x3e')];}_0x5a9205[_0xc6de('0x2d')](_0x3893a6)[_0xc6de('0x3f')](_0x17cf2b);};}exports[_0xc6de('0x40')]=function(_0xc8c262,_0x11f157){var _0x260fd0={},_0x1e6bf5={},_0x234acd={'count':0x0,'rows':[]};var _0x463876=_['map'](db['ChatQueue']['rawAttributes'],function(_0x25b20c){return{'name':_0x25b20c[_0xc6de('0x41')],'type':_0x25b20c[_0xc6de('0x42')][_0xc6de('0x43')]};});_0x1e6bf5[_0xc6de('0x44')]=_[_0xc6de('0x45')](_0x463876,'name');_0x1e6bf5['query']=_[_0xc6de('0x46')](_0xc8c262[_0xc6de('0x47')]);_0x1e6bf5[_0xc6de('0x48')]=_[_0xc6de('0x49')](_0x1e6bf5[_0xc6de('0x44')],_0x1e6bf5[_0xc6de('0x47')]);_0x260fd0[_0xc6de('0x4a')]=_[_0xc6de('0x49')](_0x1e6bf5['model'],qs[_0xc6de('0x4b')](_0xc8c262['query'][_0xc6de('0x4b')]));_0x260fd0[_0xc6de('0x4a')]=_0x260fd0[_0xc6de('0x4a')][_0xc6de('0x4c')]?_0x260fd0['attributes']:_0x1e6bf5[_0xc6de('0x44')];if(!_0xc8c262[_0xc6de('0x47')]['hasOwnProperty'](_0xc6de('0x4d'))){_0x260fd0[_0xc6de('0x31')]=qs[_0xc6de('0x31')](_0xc8c262['query']['limit']);_0x260fd0['offset']=qs['offset'](_0xc8c262[_0xc6de('0x47')][_0xc6de('0x30')]);}_0x260fd0[_0xc6de('0x4e')]=qs[_0xc6de('0x4f')](_0xc8c262['query']['sort']);_0x260fd0['where']=qs[_0xc6de('0x48')](_[_0xc6de('0x50')](_0xc8c262[_0xc6de('0x47')],_0x1e6bf5[_0xc6de('0x48')]),_0x463876);if(_0xc8c262[_0xc6de('0x47')][_0xc6de('0x51')]){_0x260fd0[_0xc6de('0x52')]=_[_0xc6de('0x53')](_0x260fd0[_0xc6de('0x52')],{'$or':_[_0xc6de('0x45')](_0x463876,function(_0x487597){if(_0x487597['type']!=='VIRTUAL'){var _0x404448={};_0x404448[_0x487597['name']]={'$like':'%'+_0xc8c262[_0xc6de('0x47')][_0xc6de('0x51')]+'%'};return _0x404448;}})});}_0x260fd0=_[_0xc6de('0x53')]({},_0x260fd0,_0xc8c262[_0xc6de('0x54')]);var _0x1010a8={'where':_0x260fd0[_0xc6de('0x52')]};return db['ChatQueue']['count'](_0x1010a8)[_0xc6de('0x37')](function(_0x4b1ce7){_0x234acd[_0xc6de('0x2f')]=_0x4b1ce7;if(_0xc8c262['query']['includeAll']){_0x260fd0[_0xc6de('0x55')]=[{'all':!![]}];}return db[_0xc6de('0x56')][_0xc6de('0x57')](_0x260fd0);})['then'](function(_0x3a6a95){_0x234acd[_0xc6de('0x58')]=_0x3a6a95;return _0x234acd;})[_0xc6de('0x37')](respondWithFilteredResult(_0x11f157,_0x260fd0))['catch'](handleError(_0x11f157,null));};exports[_0xc6de('0x59')]=function(_0xa82802,_0x1c7b43){var _0x42a1b2={'raw':!![],'where':{'id':_0xa82802['params']['id']}},_0x204cfd={};_0x204cfd['model']=_[_0xc6de('0x46')](db['ChatQueue']['rawAttributes']);_0x204cfd[_0xc6de('0x47')]=_[_0xc6de('0x46')](_0xa82802[_0xc6de('0x47')]);_0x204cfd[_0xc6de('0x48')]=_[_0xc6de('0x49')](_0x204cfd[_0xc6de('0x44')],_0x204cfd[_0xc6de('0x47')]);_0x42a1b2[_0xc6de('0x4a')]=_[_0xc6de('0x49')](_0x204cfd[_0xc6de('0x44')],qs[_0xc6de('0x4b')](_0xa82802['query'][_0xc6de('0x4b')]));_0x42a1b2[_0xc6de('0x4a')]=_0x42a1b2['attributes'][_0xc6de('0x4c')]?_0x42a1b2[_0xc6de('0x4a')]:_0x204cfd[_0xc6de('0x44')];if(_0xa82802['query'][_0xc6de('0x5a')]){_0x42a1b2[_0xc6de('0x55')]=[{'all':!![]}];}_0x42a1b2=_['merge']({},_0x42a1b2,_0xa82802[_0xc6de('0x54')]);return db[_0xc6de('0x56')][_0xc6de('0x5b')](_0x42a1b2)[_0xc6de('0x37')](handleEntityNotFound(_0x1c7b43,null))[_0xc6de('0x37')](respondWithResult(_0x1c7b43,null))['catch'](handleError(_0x1c7b43,null));};exports[_0xc6de('0x5c')]=function(_0x33f6a2,_0x591e3a){return db[_0xc6de('0x56')][_0xc6de('0x5c')](_0x33f6a2[_0xc6de('0x5d')],{})[_0xc6de('0x37')](function(_0x2c99e6){var _0x582225=_0x33f6a2[_0xc6de('0x5e')][_0xc6de('0x39')]({'plain':!![]});if(!_0x582225)throw new Error(_0xc6de('0x5f'));if(_0x582225[_0xc6de('0x60')]===_0xc6de('0x5e')){var _0x5170f6=_0x2c99e6[_0xc6de('0x39')]({'plain':!![]});var _0x49ba9b=_0xc6de('0x3a');return db[_0xc6de('0x61')][_0xc6de('0x5b')]({'where':{'name':_0x49ba9b,'userProfileId':_0x582225['userProfileId']},'raw':!![]})['then'](function(_0xedaa22){if(_0xedaa22&&_0xedaa22['autoAssociation']===0x0){return db[_0xc6de('0x3b')]['create']({'name':_0x5170f6['name'],'resourceId':_0x5170f6['id'],'type':_0xedaa22[_0xc6de('0x3e')],'sectionId':_0xedaa22['id']},{})[_0xc6de('0x37')](function(){return _0x2c99e6;});}else{return _0x2c99e6;}})[_0xc6de('0x2b')](function(_0x502f46){logger[_0xc6de('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x502f46);throw _0x502f46;});}return _0x2c99e6;})[_0xc6de('0x37')](respondWithResult(_0x591e3a,0xc9))['catch'](handleError(_0x591e3a,null));};exports['update']=function(_0x10443e,_0x45ee36){if(_0x10443e[_0xc6de('0x5d')]['id']){delete _0x10443e[_0xc6de('0x5d')]['id'];}return db[_0xc6de('0x56')]['find']({'where':{'id':_0x10443e[_0xc6de('0x62')]['id']}})[_0xc6de('0x37')](handleEntityNotFound(_0x45ee36,null))[_0xc6de('0x37')](saveUpdates(_0x10443e[_0xc6de('0x5d')],null))[_0xc6de('0x37')](respondWithResult(_0x45ee36,null))['catch'](handleError(_0x45ee36,null));};exports[_0xc6de('0x38')]=function(_0x3e758d,_0x496e04){return db[_0xc6de('0x56')][_0xc6de('0x5b')]({'where':{'id':_0x3e758d['params']['id']}})['then'](handleEntityNotFound(_0x496e04,null))['then'](removeEntity(_0x496e04,null))['catch'](handleError(_0x496e04,null));};exports[_0xc6de('0x63')]=function(_0x5d2ef5,_0x23b167){return db[_0xc6de('0x56')][_0xc6de('0x63')]()[_0xc6de('0x37')](respondWithResult(_0x23b167,null))['catch'](handleError(_0x23b167,null));};exports[_0xc6de('0x64')]=function(_0x4f4e9d,_0x19eb34,_0x41de09){var _0x3d88d1={'raw':!![],'where':{}},_0x187ca9={},_0x40ea51;return db[_0xc6de('0x56')][_0xc6de('0x65')]({'where':{'id':_0x4f4e9d[_0xc6de('0x62')]['id']}})[_0xc6de('0x37')](handleEntityNotFound(_0x19eb34,null))['then'](function(_0xb75ec3){if(_0xb75ec3){_0x40ea51=_0xb75ec3[_0xc6de('0x39')]({'plain':!![]});_0x187ca9[_0xc6de('0x44')]=_[_0xc6de('0x46')](db[_0xc6de('0x66')]['rawAttributes']);_0x187ca9['query']=_[_0xc6de('0x46')](_0x4f4e9d[_0xc6de('0x47')]);_0x187ca9[_0xc6de('0x48')]=_[_0xc6de('0x49')](_0x187ca9['model'],_0x187ca9[_0xc6de('0x47')]);_0x3d88d1[_0xc6de('0x4a')]=_[_0xc6de('0x49')](_0x187ca9[_0xc6de('0x44')],qs['fields'](_0x4f4e9d[_0xc6de('0x47')]['fields']));_0x3d88d1[_0xc6de('0x4a')]=_0x3d88d1[_0xc6de('0x4a')][_0xc6de('0x4c')]?_0x3d88d1['attributes']:_0x187ca9[_0xc6de('0x44')];if(!_0x4f4e9d[_0xc6de('0x47')]['hasOwnProperty'](_0xc6de('0x4d'))){_0x3d88d1[_0xc6de('0x31')]=qs['limit'](_0x4f4e9d[_0xc6de('0x47')][_0xc6de('0x31')]);_0x3d88d1[_0xc6de('0x30')]=qs[_0xc6de('0x30')](_0x4f4e9d[_0xc6de('0x47')][_0xc6de('0x30')]);}_0x3d88d1[_0xc6de('0x4e')]=qs[_0xc6de('0x4f')](_0x4f4e9d[_0xc6de('0x47')][_0xc6de('0x4f')]);_0x3d88d1[_0xc6de('0x52')]=qs['filters'](_[_0xc6de('0x50')](_0x4f4e9d[_0xc6de('0x47')],_0x187ca9[_0xc6de('0x48')]));_0x3d88d1[_0xc6de('0x52')][_0xc6de('0x67')]=_0xb75ec3['id'];if(_0x4f4e9d[_0xc6de('0x47')][_0xc6de('0x51')]){_0x3d88d1[_0xc6de('0x52')]=_['merge'](_0x3d88d1[_0xc6de('0x52')],{'$or':_[_0xc6de('0x45')](_0x3d88d1[_0xc6de('0x4a')],function(_0x35470d){var _0x2bbd22={};_0x2bbd22[_0x35470d]={'$like':'%'+_0x4f4e9d['query']['filter']+'%'};return _0x2bbd22;})});}_0x3d88d1=_[_0xc6de('0x53')]({},_0x3d88d1,_0x4f4e9d[_0xc6de('0x54')]);return db[_0xc6de('0x66')][_0xc6de('0x57')](_0x3d88d1);}})['then'](function(_0x4bc060){if(_0x4bc060){return db[_0xc6de('0x68')][_0xc6de('0x69')]({'where':{'id':_[_0xc6de('0x45')](_0x4bc060,_0xc6de('0x6a')),'role':_0xc6de('0x6b')},'attributes':['id',_0xc6de('0x3e'),_0xc6de('0x6c'),_0xc6de('0x6d'),_0xc6de('0x6e')]});}})[_0xc6de('0x37')](function(_0x2ae5ee){if(_0x2ae5ee){return{'count':_0x2ae5ee[_0xc6de('0x2f')],'rows':_[_0xc6de('0x45')](_0x2ae5ee[_0xc6de('0x58')],function(_0x216ab6){return{'membername':_0x216ab6[_0xc6de('0x3e')],'UserId':_0x216ab6['id'],'queue_name':_0x40ea51['name'],'ChatQueueId':_0x40ea51['id'],'interface':util['format'](_0xc6de('0x6f'),_0xc6de('0x70'),_0x216ab6[_0xc6de('0x3e')]),'penalty':0x0,'paused':_0x216ab6[_0xc6de('0x6c')],'createdAt':_0x216ab6['createdAt'],'updatedAt':_0x216ab6[_0xc6de('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x19eb34,_0x3d88d1))[_0xc6de('0x2b')](handleError(_0x19eb34,null));};exports[_0xc6de('0x71')]=function(_0x2a4912,_0x2a277e,_0x55a597){var _0x146748={};var _0x34e292={};var _0x29df39;var _0x581313;return db[_0xc6de('0x56')][_0xc6de('0x65')]({'where':{'id':_0x2a4912[_0xc6de('0x62')]['id']}})[_0xc6de('0x37')](handleEntityNotFound(_0x2a277e,null))[_0xc6de('0x37')](function(_0x29b926){if(_0x29b926){_0x29df39=_0x29b926;_0x34e292[_0xc6de('0x44')]=_['keys'](db['Team'][_0xc6de('0x72')]);_0x34e292[_0xc6de('0x47')]=_[_0xc6de('0x46')](_0x2a4912[_0xc6de('0x47')]);_0x34e292['filters']=_[_0xc6de('0x49')](_0x34e292['model'],_0x34e292[_0xc6de('0x47')]);_0x146748['attributes']=_['intersection'](_0x34e292['model'],qs[_0xc6de('0x4b')](_0x2a4912[_0xc6de('0x47')][_0xc6de('0x4b')]));_0x146748[_0xc6de('0x4a')]=_0x146748['attributes'][_0xc6de('0x4c')]?_0x146748['attributes']:_0x34e292[_0xc6de('0x44')];_0x146748['order']=qs['sort'](_0x2a4912[_0xc6de('0x47')]['sort']);_0x146748[_0xc6de('0x52')]=qs[_0xc6de('0x48')](_['pick'](_0x2a4912[_0xc6de('0x47')],_0x34e292['filters']));if(_0x2a4912[_0xc6de('0x47')]['filter']){_0x146748['where']=_[_0xc6de('0x53')](_0x146748[_0xc6de('0x52')],{'$or':_[_0xc6de('0x45')](_0x146748[_0xc6de('0x4a')],function(_0x21408d){var _0x308779={};_0x308779[_0x21408d]={'$like':'%'+_0x2a4912[_0xc6de('0x47')][_0xc6de('0x51')]+'%'};return _0x308779;})});}_0x146748=_[_0xc6de('0x53')]({},_0x146748,_0x2a4912[_0xc6de('0x54')]);return _0x29df39[_0xc6de('0x71')](_0x146748);}})['then'](function(_0x4fd4f2){if(_0x4fd4f2){_0x581313=_0x4fd4f2[_0xc6de('0x4c')];if(!_0x2a4912['query'][_0xc6de('0x73')]('nolimit')){_0x146748[_0xc6de('0x31')]=qs['limit'](_0x2a4912[_0xc6de('0x47')][_0xc6de('0x31')]);_0x146748[_0xc6de('0x30')]=qs['offset'](_0x2a4912['query'][_0xc6de('0x30')]);}return _0x29df39[_0xc6de('0x71')](_0x146748);}})['then'](function(_0x204f17){if(_0x204f17){return _0x204f17?{'count':_0x581313,'rows':_0x204f17}:null;}})[_0xc6de('0x37')](respondWithResult(_0x2a277e,null))[_0xc6de('0x2b')](handleError(_0x2a277e,null));};exports[_0xc6de('0x74')]=function(_0x491955,_0x15ab0f,_0x5cd883){var _0x400440=_0x491955['body'][_0xc6de('0x75')];return db[_0xc6de('0x76')]['findAll']({'where':{'id':_0x400440},'attributes':['id'],'include':[{'model':db[_0xc6de('0x68')],'as':_0xc6de('0x77'),'attributes':['id',_0xc6de('0x3e'),_0xc6de('0x78'),'voicePause','interface'],'raw':!![]}]})[_0xc6de('0x37')](function(_0x34eb91){if(_0x34eb91){var _0x521874=_[_0xc6de('0x79')](_0x34eb91,function(_0x46fbec){var _0x162d92=_0x46fbec[_0xc6de('0x39')]({'plain':!![]});return _0x162d92[_0xc6de('0x77')];});return db['ChatQueue'][_0xc6de('0x5b')]({'where':{'id':_0x491955[_0xc6de('0x62')]['id']}})['then'](function(_0x2d4bc9){return db[_0xc6de('0x7a')][_0xc6de('0x7b')](function(_0x177558){return _0x2d4bc9[_0xc6de('0x74')](_0x400440,{'transaction':_0x177558})[_0xc6de('0x37')](function(){return BPromise['each'](_0x521874,function(_0x28bbe7){return db[_0xc6de('0x66')][_0xc6de('0x7c')]({'where':{'UserId':_0x28bbe7['id'],'ChatQueueId':_0x491955[_0xc6de('0x62')]['id']},'transaction':_0x177558});});})['then'](function(){_0x521874[_0xc6de('0x7d')](function(_0x3d12b2){socket['emit'](_0xc6de('0x7e'),{'UserId':_0x3d12b2['id'],'ChatQueueId':_0x2d4bc9['id']});});});});});}})[_0xc6de('0x37')](respondWithStatusCode(_0x15ab0f,null))[_0xc6de('0x2b')](handleError(_0x15ab0f,null));};exports[_0xc6de('0x7f')]=function(_0x183c40,_0x2f2934,_0x5da176){return db['Team'][_0xc6de('0x57')]({'where':{'id':_0x183c40[_0xc6de('0x47')][_0xc6de('0x75')]},'attributes':['id'],'include':[{'model':db[_0xc6de('0x68')],'as':_0xc6de('0x77'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2f2934,null))['then'](function(_0x5181cb){var _0xb52123=_[_0xc6de('0x45')](_0x5181cb,'id');var _0x21e211=[];var _0x2d2617=[];var _0x30163c=squel[_0xc6de('0x80')]();_0x30163c['field'](_0xc6de('0x81'))[_0xc6de('0x82')](_0xc6de('0x83'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc6de('0x52')](_0xc6de('0x84'),_0x183c40['params']['id']);for(var _0x1d4378=0x0;_0x1d4378<_0x5181cb[_0xc6de('0x4c')];_0x1d4378+=0x1){let _0x328238=_0x5181cb[_0x1d4378];for(var _0x307b8a=0x0;_0x307b8a<_0x328238['Agents'][_0xc6de('0x4c')];_0x307b8a+=0x1){let _0x491b60=_0x328238[_0xc6de('0x77')][_0x307b8a];var _0x49b957=_0x30163c[_0xc6de('0x85')]();_0x49b957[_0xc6de('0x52')](_0xc6de('0x86'),_0x491b60['id']);_0x2d2617[_0xc6de('0x87')](db[_0xc6de('0x7a')]['query'](_0x49b957['toString'](),{'type':db[_0xc6de('0x7a')][_0xc6de('0x88')][_0xc6de('0x89')]})[_0xc6de('0x37')](function(_0x5b454b){if(_0x5b454b[_0xc6de('0x4c')]===0x1){return _0x491b60['id'];}else{var _0x1acb17=_['every'](_[_0xc6de('0x45')](_0x5b454b,_0xc6de('0x8a')),function(_0x2b05c3){return _[_0xc6de('0x8b')](_0xb52123,_0x2b05c3);});if(_0x1acb17){return _0x491b60['id'];}}}));}}return BPromise['all'](_0x2d2617)['then'](function(_0x3e4557){_0x21e211=_(_0x21e211)['union'](_0x3e4557)[_0xc6de('0x8c')]()['value']();return db[_0xc6de('0x56')]['find']({'where':{'id':_0x183c40[_0xc6de('0x62')]['id']}})[_0xc6de('0x37')](function(_0x28ad1a){return db[_0xc6de('0x7a')][_0xc6de('0x7b')](function(_0x1edf57){return _0x28ad1a[_0xc6de('0x7f')](_0x183c40['query'][_0xc6de('0x75')],{'transaction':_0x1edf57})[_0xc6de('0x37')](function(){if(!_[_0xc6de('0x8d')](_0x21e211)){return _0x28ad1a['removeAgents'](_0x21e211,{'transaction':_0x1edf57});}})['then'](function(){_0x21e211[_0xc6de('0x7d')](function(_0x186d18){socket['emit']('userChatQueue:remove',{'UserId':_0x186d18,'ChatQueueId':_0x28ad1a['id']});});});});});});})[_0xc6de('0x37')](respondWithStatusCode(_0x2f2934,null))['catch'](handleError(_0x2f2934,null));};exports['addAgents']=function(_0x225659,_0x44e37a,_0x268615){return db[_0xc6de('0x56')]['find']({'where':{'id':_0x225659[_0xc6de('0x62')]['id']}})[_0xc6de('0x37')](handleEntityNotFound(_0x44e37a,null))[_0xc6de('0x37')](function(_0x51da7b){if(_0x51da7b){return _0x51da7b['addAgents'](_0x225659[_0xc6de('0x5d')][_0xc6de('0x75')],_[_0xc6de('0x8e')](_0x225659[_0xc6de('0x5d')],[_0xc6de('0x75'),'id'])||{})[_0xc6de('0x8f')](function(_0x5f450b){for(var _0x4dca38=0x0;_0x4dca38<_0x225659[_0xc6de('0x5d')][_0xc6de('0x75')]['length'];_0x4dca38+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x225659['body'][_0xc6de('0x75')][_0x4dca38],'ChatQueueId':_0x225659[_0xc6de('0x62')]['id']});}return _0x5f450b;});}})['then'](respondWithResult(_0x44e37a,null))[_0xc6de('0x2b')](handleError(_0x44e37a,null));};exports[_0xc6de('0x90')]=function(_0x502d7e,_0x38098c,_0x66f7dc){return db[_0xc6de('0x56')][_0xc6de('0x5b')]({'where':{'id':_0x502d7e[_0xc6de('0x62')]['id']}})['then'](handleEntityNotFound(_0x38098c,null))['then'](function(_0x1e88aa){if(_0x1e88aa){return _0x1e88aa['removeAgents'](_0x502d7e['query']['ids'])['then'](function(){if(_[_0xc6de('0x91')](_0x502d7e[_0xc6de('0x47')][_0xc6de('0x75')])){for(var _0x16826d=0x0;_0x16826d<_0x502d7e[_0xc6de('0x47')][_0xc6de('0x75')][_0xc6de('0x4c')];_0x16826d+=0x1){socket[_0xc6de('0x92')](_0xc6de('0x93'),{'UserId':Number(_0x502d7e['query'][_0xc6de('0x75')][_0x16826d]),'ChatQueueId':Number(_0x502d7e[_0xc6de('0x62')]['id'])});}}else{socket['emit'](_0xc6de('0x93'),{'UserId':Number(_0x502d7e[_0xc6de('0x47')][_0xc6de('0x75')]),'ChatQueueId':Number(_0x502d7e[_0xc6de('0x62')]['id'])});}});}})[_0xc6de('0x37')](respondWithStatusCode(_0x38098c,null))[_0xc6de('0x2b')](handleError(_0x38098c,null));};exports[_0xc6de('0x94')]=function(_0x4a8e6a,_0x3555d3,_0x4c3f4a){var _0x3ba1fe={};var _0x36793a={};var _0x4743f2;var _0x4e34dd;return db['ChatQueue'][_0xc6de('0x65')]({'where':{'id':_0x4a8e6a['params']['id']}})[_0xc6de('0x37')](handleEntityNotFound(_0x3555d3,null))[_0xc6de('0x37')](function(_0x43cb3c){if(_0x43cb3c){_0x4743f2=_0x43cb3c;_0x36793a[_0xc6de('0x44')]=_[_0xc6de('0x46')](db[_0xc6de('0x68')][_0xc6de('0x72')]);_0x36793a[_0xc6de('0x47')]=_[_0xc6de('0x46')](_0x4a8e6a['query']);_0x36793a[_0xc6de('0x48')]=_[_0xc6de('0x49')](_0x36793a['model'],_0x36793a[_0xc6de('0x47')]);_0x3ba1fe[_0xc6de('0x4a')]=_[_0xc6de('0x49')](_0x36793a[_0xc6de('0x44')],qs[_0xc6de('0x4b')](_0x4a8e6a[_0xc6de('0x47')][_0xc6de('0x4b')]));_0x3ba1fe[_0xc6de('0x4a')]=_0x3ba1fe[_0xc6de('0x4a')][_0xc6de('0x4c')]?_0x3ba1fe['attributes']:_0x36793a[_0xc6de('0x44')];_0x3ba1fe[_0xc6de('0x4e')]=qs[_0xc6de('0x4f')](_0x4a8e6a[_0xc6de('0x47')][_0xc6de('0x4f')]);_0x3ba1fe[_0xc6de('0x52')]=qs['filters'](_[_0xc6de('0x50')](_0x4a8e6a[_0xc6de('0x47')],_0x36793a[_0xc6de('0x48')]));if(_0x4a8e6a[_0xc6de('0x47')][_0xc6de('0x51')]){_0x3ba1fe['where']=_[_0xc6de('0x53')](_0x3ba1fe[_0xc6de('0x52')],{'$or':_[_0xc6de('0x45')](_0x3ba1fe[_0xc6de('0x4a')],function(_0x48499e){var _0x48537c={};_0x48537c[_0x48499e]={'$like':'%'+_0x4a8e6a[_0xc6de('0x47')]['filter']+'%'};return _0x48537c;})});}_0x3ba1fe=_[_0xc6de('0x53')]({},_0x3ba1fe,_0x4a8e6a[_0xc6de('0x54')]);return _0x4743f2[_0xc6de('0x94')](_0x3ba1fe);}})[_0xc6de('0x37')](function(_0x177e62){if(_0x177e62){_0x4e34dd=_0x177e62[_0xc6de('0x4c')];if(!_0x4a8e6a[_0xc6de('0x47')]['hasOwnProperty'](_0xc6de('0x4d'))){_0x3ba1fe[_0xc6de('0x31')]=qs[_0xc6de('0x31')](_0x4a8e6a['query'][_0xc6de('0x31')]);_0x3ba1fe[_0xc6de('0x30')]=qs[_0xc6de('0x30')](_0x4a8e6a[_0xc6de('0x47')][_0xc6de('0x30')]);}return _0x4743f2[_0xc6de('0x94')](_0x3ba1fe);}})[_0xc6de('0x37')](function(_0x27925d){if(_0x27925d){return _0x27925d?{'count':_0x4e34dd,'rows':_0x27925d}:null;}})[_0xc6de('0x37')](respondWithResult(_0x3555d3,null))['catch'](handleError(_0x3555d3,null));}; \ No newline at end of file +var _0xbd51=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','map','ChatQueue','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','type','filter','options','count','includeAll','include','findAll','show','rawAttributes','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','body','describe','findOne','params','UserChatQueue','hasOwnProperty','pick','ChatQueueId','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','rows','SIP','getTeams','Team','addTeams','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','emit','userChatQueue:save','removeTeams','ids','select','field','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','SELECT','every','TeamId','union','compact','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse'];(function(_0x144b99,_0x10756c){var _0x35bc61=function(_0x4b3d79){while(--_0x4b3d79){_0x144b99['push'](_0x144b99['shift']());}};_0x35bc61(++_0x10756c);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x28a5ad,_0x45a7f9){_0x28a5ad=_0x28a5ad-0x0;var _0x515784=_0xbd51[_0x28a5ad];return _0x515784;};'use strict';var pdf=require(_0x1bd5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1bd5('0x1'));var zipdir=require(_0x1bd5('0x2'));var jsonpatch=require(_0x1bd5('0x3'));var rp=require(_0x1bd5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1bd5('0x5'));var sox=require(_0x1bd5('0x6'));var csv=require(_0x1bd5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1bd5('0x8'));var _=require(_0x1bd5('0x9'));var squel=require(_0x1bd5('0xa'));var crypto=require(_0x1bd5('0xb'));var jsforce=require(_0x1bd5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1bd5('0x7'));var querystring=require('querystring');var Papa=require(_0x1bd5('0xd'));var Redis=require(_0x1bd5('0xe'));var authService=require(_0x1bd5('0xf'));var qs=require(_0x1bd5('0x10'));var as=require(_0x1bd5('0x11'));var hardwareService=require(_0x1bd5('0x12'));var logger=require('../../config/logger')(_0x1bd5('0x13'));var utils=require('../../config/utils');var config=require(_0x1bd5('0x14'));var licenseUtil=require(_0x1bd5('0x15'));var db=require(_0x1bd5('0x16'))['db'];config[_0x1bd5('0x17')]=_[_0x1bd5('0x18')](config[_0x1bd5('0x17')],{'host':_0x1bd5('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1bd5('0x1a'))[_0x1bd5('0x1b')](socket);var jayson=require(_0x1bd5('0x1c'));var client=jayson[_0x1bd5('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5072c2,_0xa63190,_0xc7277e,_0x2b2c57){return new BPromise(function(_0x4793dd,_0x43ea3e){var _0x2d2e80=_0x2b2c57||client;return _0x2d2e80[_0x1bd5('0x1e')](_0x5072c2,_0xc7277e)[_0x1bd5('0x1f')](function(_0x4670b5){logger['info']('ChatQueue,\x20%s,\x20%s',_0xa63190,_0x1bd5('0x20'));logger[_0x1bd5('0x21')](_0x1bd5('0x22'),_0xa63190,_0x1bd5('0x20'),JSON[_0x1bd5('0x23')](_0x4670b5));if(_0x4670b5[_0x1bd5('0x24')]){if(_0x4670b5[_0x1bd5('0x24')][_0x1bd5('0x25')]===0x1f4){logger[_0x1bd5('0x24')](_0x1bd5('0x26'),_0xa63190,_0x4670b5[_0x1bd5('0x24')][_0x1bd5('0x27')]);return _0x43ea3e(_0x4670b5[_0x1bd5('0x24')][_0x1bd5('0x27')]);}logger[_0x1bd5('0x24')](_0x1bd5('0x26'),_0xa63190,_0x4670b5[_0x1bd5('0x24')][_0x1bd5('0x27')]);return _0x4793dd(_0x4670b5['error'][_0x1bd5('0x27')]);}else{logger['info'](_0x1bd5('0x26'),_0xa63190,_0x1bd5('0x20'));_0x4793dd(_0x4670b5[_0x1bd5('0x28')]['message']);}})[_0x1bd5('0x29')](function(_0x4fa37c){logger[_0x1bd5('0x24')](_0x1bd5('0x26'),_0xa63190,_0x4fa37c);_0x43ea3e(_0x4fa37c);});});}function respondWithStatusCode(_0x3dba4f,_0x430461){_0x430461=_0x430461||0xcc;return function(_0x47c84b){if(_0x47c84b){return _0x3dba4f[_0x1bd5('0x2a')](_0x430461);}return _0x3dba4f[_0x1bd5('0x2b')](_0x430461)[_0x1bd5('0x2c')]();};}function respondWithResult(_0x3b1090,_0x4cebd0){_0x4cebd0=_0x4cebd0||0xc8;return function(_0xdba332){if(_0xdba332){return _0x3b1090[_0x1bd5('0x2b')](_0x4cebd0)[_0x1bd5('0x2d')](_0xdba332);}};}function respondWithFilteredResult(_0x369b88,_0xe54b9f){return function(_0xc73670){if(_0xc73670){var _0x4e72b2=_0xc73670['count'],_0x289097=_0xe54b9f[_0x1bd5('0x2e')],_0x472b22=_0xe54b9f[_0x1bd5('0x2e')]+_0xe54b9f[_0x1bd5('0x2f')],_0x8d53ba;if(_0x472b22>=_0x4e72b2){_0x472b22=_0x4e72b2;_0x8d53ba=0xc8;}else{_0x8d53ba=0xce;}_0x369b88[_0x1bd5('0x2b')](_0x8d53ba);return _0x369b88[_0x1bd5('0x30')](_0x1bd5('0x31'),_0x289097+'-'+_0x472b22+'/'+_0x4e72b2)['json'](_0xc73670);}return null;};}function patchUpdates(_0x49ea1e){return function(_0x26be8e){try{jsonpatch[_0x1bd5('0x32')](_0x26be8e,_0x49ea1e,!![]);}catch(_0x5542aa){return BPromise[_0x1bd5('0x33')](_0x5542aa);}return _0x26be8e[_0x1bd5('0x34')]();};}function saveUpdates(_0x1efa8c,_0x24dc20){return function(_0x558452){if(_0x558452){return _0x558452[_0x1bd5('0x35')](_0x1efa8c)[_0x1bd5('0x1f')](function(_0x3ec22a){return _0x3ec22a;});}return null;};}function removeEntity(_0x233743,_0x209ce1){return function(_0x223161){if(_0x223161){return _0x223161[_0x1bd5('0x36')]()[_0x1bd5('0x1f')](function(){var _0x592255=_0x223161[_0x1bd5('0x37')]({'plain':!![]});var _0x2529c1=_0x1bd5('0x38');return db[_0x1bd5('0x39')][_0x1bd5('0x36')]({'where':{'type':_0x2529c1,'resourceId':_0x592255['id']}})[_0x1bd5('0x1f')](function(){return _0x223161;});})[_0x1bd5('0x1f')](function(){_0x233743['status'](0xcc)[_0x1bd5('0x2c')]();});}};}function handleEntityNotFound(_0x46df70,_0x44ab3a){return function(_0x2f5a48){if(!_0x2f5a48){_0x46df70[_0x1bd5('0x2a')](0x194);}return _0x2f5a48;};}function handleError(_0x192ca7,_0x1f95e9){_0x1f95e9=_0x1f95e9||0x1f4;return function(_0x4cc9ba){logger['error'](_0x4cc9ba[_0x1bd5('0x3a')]);if(_0x4cc9ba[_0x1bd5('0x3b')]){delete _0x4cc9ba[_0x1bd5('0x3b')];}_0x192ca7['status'](_0x1f95e9)[_0x1bd5('0x3c')](_0x4cc9ba);};}exports['index']=function(_0x3b5cb8,_0x3d2bc3){var _0x3ee243={},_0x3b8dab={},_0x3b3eca={'count':0x0,'rows':[]};var _0x2470ec=_[_0x1bd5('0x3d')](db[_0x1bd5('0x3e')]['rawAttributes'],function(_0x114a96){return{'name':_0x114a96[_0x1bd5('0x3f')],'type':_0x114a96['type'][_0x1bd5('0x40')]};});_0x3b8dab[_0x1bd5('0x41')]=_[_0x1bd5('0x3d')](_0x2470ec,'name');_0x3b8dab[_0x1bd5('0x42')]=_[_0x1bd5('0x43')](_0x3b5cb8[_0x1bd5('0x42')]);_0x3b8dab[_0x1bd5('0x44')]=_['intersection'](_0x3b8dab[_0x1bd5('0x41')],_0x3b8dab[_0x1bd5('0x42')]);_0x3ee243[_0x1bd5('0x45')]=_[_0x1bd5('0x46')](_0x3b8dab['model'],qs['fields'](_0x3b5cb8[_0x1bd5('0x42')][_0x1bd5('0x47')]));_0x3ee243[_0x1bd5('0x45')]=_0x3ee243['attributes'][_0x1bd5('0x48')]?_0x3ee243[_0x1bd5('0x45')]:_0x3b8dab['model'];if(!_0x3b5cb8[_0x1bd5('0x42')]['hasOwnProperty'](_0x1bd5('0x49'))){_0x3ee243[_0x1bd5('0x2f')]=qs['limit'](_0x3b5cb8[_0x1bd5('0x42')][_0x1bd5('0x2f')]);_0x3ee243[_0x1bd5('0x2e')]=qs[_0x1bd5('0x2e')](_0x3b5cb8[_0x1bd5('0x42')][_0x1bd5('0x2e')]);}_0x3ee243[_0x1bd5('0x4a')]=qs[_0x1bd5('0x4b')](_0x3b5cb8[_0x1bd5('0x42')][_0x1bd5('0x4b')]);_0x3ee243[_0x1bd5('0x4c')]=qs[_0x1bd5('0x44')](_['pick'](_0x3b5cb8[_0x1bd5('0x42')],_0x3b8dab[_0x1bd5('0x44')]),_0x2470ec);if(_0x3b5cb8[_0x1bd5('0x42')]['filter']){_0x3ee243[_0x1bd5('0x4c')]=_[_0x1bd5('0x4d')](_0x3ee243['where'],{'$or':_[_0x1bd5('0x3d')](_0x2470ec,function(_0x4d86f8){if(_0x4d86f8[_0x1bd5('0x4e')]!=='VIRTUAL'){var _0x35a876={};_0x35a876[_0x4d86f8[_0x1bd5('0x3b')]]={'$like':'%'+_0x3b5cb8['query'][_0x1bd5('0x4f')]+'%'};return _0x35a876;}})});}_0x3ee243=_['merge']({},_0x3ee243,_0x3b5cb8[_0x1bd5('0x50')]);var _0x38dced={'where':_0x3ee243[_0x1bd5('0x4c')]};return db[_0x1bd5('0x3e')][_0x1bd5('0x51')](_0x38dced)[_0x1bd5('0x1f')](function(_0x25da00){_0x3b3eca[_0x1bd5('0x51')]=_0x25da00;if(_0x3b5cb8['query'][_0x1bd5('0x52')]){_0x3ee243[_0x1bd5('0x53')]=[{'all':!![]}];}return db[_0x1bd5('0x3e')][_0x1bd5('0x54')](_0x3ee243);})[_0x1bd5('0x1f')](function(_0x1c4c20){_0x3b3eca['rows']=_0x1c4c20;return _0x3b3eca;})[_0x1bd5('0x1f')](respondWithFilteredResult(_0x3d2bc3,_0x3ee243))[_0x1bd5('0x29')](handleError(_0x3d2bc3,null));};exports[_0x1bd5('0x55')]=function(_0x4cd3cd,_0x394398){var _0x329c8c={'raw':!![],'where':{'id':_0x4cd3cd['params']['id']}},_0x1ca2eb={};_0x1ca2eb['model']=_[_0x1bd5('0x43')](db[_0x1bd5('0x3e')][_0x1bd5('0x56')]);_0x1ca2eb['query']=_[_0x1bd5('0x43')](_0x4cd3cd[_0x1bd5('0x42')]);_0x1ca2eb[_0x1bd5('0x44')]=_[_0x1bd5('0x46')](_0x1ca2eb[_0x1bd5('0x41')],_0x1ca2eb[_0x1bd5('0x42')]);_0x329c8c[_0x1bd5('0x45')]=_['intersection'](_0x1ca2eb[_0x1bd5('0x41')],qs[_0x1bd5('0x47')](_0x4cd3cd['query'][_0x1bd5('0x47')]));_0x329c8c['attributes']=_0x329c8c[_0x1bd5('0x45')]['length']?_0x329c8c[_0x1bd5('0x45')]:_0x1ca2eb[_0x1bd5('0x41')];if(_0x4cd3cd['query'][_0x1bd5('0x52')]){_0x329c8c[_0x1bd5('0x53')]=[{'all':!![]}];}_0x329c8c=_[_0x1bd5('0x4d')]({},_0x329c8c,_0x4cd3cd[_0x1bd5('0x50')]);return db[_0x1bd5('0x3e')][_0x1bd5('0x57')](_0x329c8c)[_0x1bd5('0x1f')](handleEntityNotFound(_0x394398,null))['then'](respondWithResult(_0x394398,null))[_0x1bd5('0x29')](handleError(_0x394398,null));};exports['create']=function(_0x251a2b,_0x34b890){return db[_0x1bd5('0x3e')]['create'](_0x251a2b['body'],{})[_0x1bd5('0x1f')](function(_0x1a0ada){var _0x68ff43=_0x251a2b[_0x1bd5('0x58')][_0x1bd5('0x37')]({'plain':!![]});if(!_0x68ff43)throw new Error(_0x1bd5('0x59'));if(_0x68ff43[_0x1bd5('0x5a')]===_0x1bd5('0x58')){var _0x2da3c3=_0x1a0ada[_0x1bd5('0x37')]({'plain':!![]});var _0x560419=_0x1bd5('0x38');return db['UserProfileSection'][_0x1bd5('0x57')]({'where':{'name':_0x560419,'userProfileId':_0x68ff43[_0x1bd5('0x5b')]},'raw':!![]})[_0x1bd5('0x1f')](function(_0x513b85){if(_0x513b85&&_0x513b85[_0x1bd5('0x5c')]===0x0){return db[_0x1bd5('0x39')][_0x1bd5('0x5d')]({'name':_0x2da3c3['name'],'resourceId':_0x2da3c3['id'],'type':_0x513b85[_0x1bd5('0x3b')],'sectionId':_0x513b85['id']},{})[_0x1bd5('0x1f')](function(){return _0x1a0ada;});}else{return _0x1a0ada;}})[_0x1bd5('0x29')](function(_0x197e74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x197e74);throw _0x197e74;});}return _0x1a0ada;})[_0x1bd5('0x1f')](respondWithResult(_0x34b890,0xc9))[_0x1bd5('0x29')](handleError(_0x34b890,null));};exports[_0x1bd5('0x35')]=function(_0x54a8c4,_0x4cd94e){if(_0x54a8c4[_0x1bd5('0x5e')]['id']){delete _0x54a8c4['body']['id'];}return db[_0x1bd5('0x3e')][_0x1bd5('0x57')]({'where':{'id':_0x54a8c4['params']['id']}})[_0x1bd5('0x1f')](handleEntityNotFound(_0x4cd94e,null))['then'](saveUpdates(_0x54a8c4[_0x1bd5('0x5e')],null))['then'](respondWithResult(_0x4cd94e,null))[_0x1bd5('0x29')](handleError(_0x4cd94e,null));};exports[_0x1bd5('0x36')]=function(_0x533a10,_0x2d1b1e){return db[_0x1bd5('0x3e')]['find']({'where':{'id':_0x533a10['params']['id']}})[_0x1bd5('0x1f')](handleEntityNotFound(_0x2d1b1e,null))[_0x1bd5('0x1f')](removeEntity(_0x2d1b1e,null))['catch'](handleError(_0x2d1b1e,null));};exports[_0x1bd5('0x5f')]=function(_0x40b508,_0x5da595){return db['ChatQueue'][_0x1bd5('0x5f')]()[_0x1bd5('0x1f')](respondWithResult(_0x5da595,null))[_0x1bd5('0x29')](handleError(_0x5da595,null));};exports['getMembers']=function(_0x328099,_0x27a05e,_0x5c1db7){var _0x4b317d={'raw':!![],'where':{}},_0x2db1be={},_0x1ac57e;return db[_0x1bd5('0x3e')][_0x1bd5('0x60')]({'where':{'id':_0x328099[_0x1bd5('0x61')]['id']}})['then'](handleEntityNotFound(_0x27a05e,null))[_0x1bd5('0x1f')](function(_0x509671){if(_0x509671){_0x1ac57e=_0x509671[_0x1bd5('0x37')]({'plain':!![]});_0x2db1be[_0x1bd5('0x41')]=_[_0x1bd5('0x43')](db[_0x1bd5('0x62')]['rawAttributes']);_0x2db1be['query']=_[_0x1bd5('0x43')](_0x328099[_0x1bd5('0x42')]);_0x2db1be[_0x1bd5('0x44')]=_[_0x1bd5('0x46')](_0x2db1be[_0x1bd5('0x41')],_0x2db1be[_0x1bd5('0x42')]);_0x4b317d[_0x1bd5('0x45')]=_[_0x1bd5('0x46')](_0x2db1be[_0x1bd5('0x41')],qs[_0x1bd5('0x47')](_0x328099[_0x1bd5('0x42')][_0x1bd5('0x47')]));_0x4b317d[_0x1bd5('0x45')]=_0x4b317d[_0x1bd5('0x45')][_0x1bd5('0x48')]?_0x4b317d[_0x1bd5('0x45')]:_0x2db1be[_0x1bd5('0x41')];if(!_0x328099[_0x1bd5('0x42')][_0x1bd5('0x63')](_0x1bd5('0x49'))){_0x4b317d[_0x1bd5('0x2f')]=qs[_0x1bd5('0x2f')](_0x328099[_0x1bd5('0x42')][_0x1bd5('0x2f')]);_0x4b317d['offset']=qs[_0x1bd5('0x2e')](_0x328099[_0x1bd5('0x42')][_0x1bd5('0x2e')]);}_0x4b317d[_0x1bd5('0x4a')]=qs[_0x1bd5('0x4b')](_0x328099[_0x1bd5('0x42')][_0x1bd5('0x4b')]);_0x4b317d['where']=qs[_0x1bd5('0x44')](_[_0x1bd5('0x64')](_0x328099[_0x1bd5('0x42')],_0x2db1be[_0x1bd5('0x44')]));_0x4b317d['where'][_0x1bd5('0x65')]=_0x509671['id'];if(_0x328099[_0x1bd5('0x42')][_0x1bd5('0x4f')]){_0x4b317d[_0x1bd5('0x4c')]=_[_0x1bd5('0x4d')](_0x4b317d[_0x1bd5('0x4c')],{'$or':_[_0x1bd5('0x3d')](_0x4b317d['attributes'],function(_0x42a3ea){var _0x58bbce={};_0x58bbce[_0x42a3ea]={'$like':'%'+_0x328099['query'][_0x1bd5('0x4f')]+'%'};return _0x58bbce;})});}_0x4b317d=_['merge']({},_0x4b317d,_0x328099[_0x1bd5('0x50')]);return db[_0x1bd5('0x62')]['findAll'](_0x4b317d);}})[_0x1bd5('0x1f')](function(_0xbcdba5){if(_0xbcdba5){return db[_0x1bd5('0x66')][_0x1bd5('0x67')]({'where':{'id':_[_0x1bd5('0x3d')](_0xbcdba5,_0x1bd5('0x68')),'role':'agent'},'attributes':['id',_0x1bd5('0x3b'),_0x1bd5('0x69'),_0x1bd5('0x6a'),_0x1bd5('0x6b')]});}})['then'](function(_0x574228){if(_0x574228){return{'count':_0x574228[_0x1bd5('0x51')],'rows':_[_0x1bd5('0x3d')](_0x574228[_0x1bd5('0x6c')],function(_0x34997d){return{'membername':_0x34997d['name'],'UserId':_0x34997d['id'],'queue_name':_0x1ac57e[_0x1bd5('0x3b')],'ChatQueueId':_0x1ac57e['id'],'interface':util['format']('%s/%s',_0x1bd5('0x6d'),_0x34997d['name']),'penalty':0x0,'paused':_0x34997d[_0x1bd5('0x69')],'createdAt':_0x34997d[_0x1bd5('0x6b')],'updatedAt':_0x34997d[_0x1bd5('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1bd5('0x1f')](respondWithFilteredResult(_0x27a05e,_0x4b317d))[_0x1bd5('0x29')](handleError(_0x27a05e,null));};exports[_0x1bd5('0x6e')]=function(_0x232077,_0x2b964b,_0x43d4c3){var _0x503980={};var _0x2bc9c6={};var _0x50341a;var _0x58c715;return db['ChatQueue'][_0x1bd5('0x60')]({'where':{'id':_0x232077['params']['id']}})[_0x1bd5('0x1f')](handleEntityNotFound(_0x2b964b,null))[_0x1bd5('0x1f')](function(_0x1fef79){if(_0x1fef79){_0x50341a=_0x1fef79;_0x2bc9c6[_0x1bd5('0x41')]=_[_0x1bd5('0x43')](db[_0x1bd5('0x6f')][_0x1bd5('0x56')]);_0x2bc9c6['query']=_[_0x1bd5('0x43')](_0x232077['query']);_0x2bc9c6[_0x1bd5('0x44')]=_[_0x1bd5('0x46')](_0x2bc9c6[_0x1bd5('0x41')],_0x2bc9c6['query']);_0x503980['attributes']=_[_0x1bd5('0x46')](_0x2bc9c6['model'],qs[_0x1bd5('0x47')](_0x232077['query'][_0x1bd5('0x47')]));_0x503980[_0x1bd5('0x45')]=_0x503980[_0x1bd5('0x45')][_0x1bd5('0x48')]?_0x503980[_0x1bd5('0x45')]:_0x2bc9c6[_0x1bd5('0x41')];_0x503980[_0x1bd5('0x4a')]=qs[_0x1bd5('0x4b')](_0x232077[_0x1bd5('0x42')][_0x1bd5('0x4b')]);_0x503980[_0x1bd5('0x4c')]=qs[_0x1bd5('0x44')](_[_0x1bd5('0x64')](_0x232077[_0x1bd5('0x42')],_0x2bc9c6['filters']));if(_0x232077[_0x1bd5('0x42')][_0x1bd5('0x4f')]){_0x503980[_0x1bd5('0x4c')]=_['merge'](_0x503980[_0x1bd5('0x4c')],{'$or':_[_0x1bd5('0x3d')](_0x503980['attributes'],function(_0x3a9d0b){var _0xea54cf={};_0xea54cf[_0x3a9d0b]={'$like':'%'+_0x232077[_0x1bd5('0x42')]['filter']+'%'};return _0xea54cf;})});}_0x503980=_[_0x1bd5('0x4d')]({},_0x503980,_0x232077[_0x1bd5('0x50')]);return _0x50341a[_0x1bd5('0x6e')](_0x503980);}})[_0x1bd5('0x1f')](function(_0x4cf523){if(_0x4cf523){_0x58c715=_0x4cf523[_0x1bd5('0x48')];if(!_0x232077[_0x1bd5('0x42')][_0x1bd5('0x63')]('nolimit')){_0x503980[_0x1bd5('0x2f')]=qs[_0x1bd5('0x2f')](_0x232077['query']['limit']);_0x503980[_0x1bd5('0x2e')]=qs[_0x1bd5('0x2e')](_0x232077['query']['offset']);}return _0x50341a[_0x1bd5('0x6e')](_0x503980);}})['then'](function(_0x56bb24){if(_0x56bb24){return _0x56bb24?{'count':_0x58c715,'rows':_0x56bb24}:null;}})[_0x1bd5('0x1f')](respondWithResult(_0x2b964b,null))['catch'](handleError(_0x2b964b,null));};exports[_0x1bd5('0x70')]=function(_0x2a5699,_0x5df043,_0x66914f){var _0x254c8d=_0x2a5699[_0x1bd5('0x5e')]['ids'];return db[_0x1bd5('0x6f')]['findAll']({'where':{'id':_0x254c8d},'attributes':['id'],'include':[{'model':db[_0x1bd5('0x66')],'as':_0x1bd5('0x71'),'attributes':['id',_0x1bd5('0x3b'),_0x1bd5('0x72'),_0x1bd5('0x73'),'interface'],'raw':!![]}]})[_0x1bd5('0x1f')](function(_0x4a8e67){if(_0x4a8e67){var _0x298c7c=_['flatMap'](_0x4a8e67,function(_0x4ac05b){var _0x3828e8=_0x4ac05b[_0x1bd5('0x37')]({'plain':!![]});return _0x3828e8[_0x1bd5('0x71')];});return db[_0x1bd5('0x3e')]['find']({'where':{'id':_0x2a5699[_0x1bd5('0x61')]['id']}})[_0x1bd5('0x1f')](function(_0x2ede9d){return db[_0x1bd5('0x74')][_0x1bd5('0x75')](function(_0x2f8b4f){return _0x2ede9d[_0x1bd5('0x70')](_0x254c8d,{'transaction':_0x2f8b4f})[_0x1bd5('0x1f')](function(){return BPromise[_0x1bd5('0x76')](_0x298c7c,function(_0x347d06){return db[_0x1bd5('0x62')][_0x1bd5('0x77')]({'where':{'UserId':_0x347d06['id'],'ChatQueueId':_0x2a5699[_0x1bd5('0x61')]['id']},'transaction':_0x2f8b4f});});})[_0x1bd5('0x1f')](function(){_0x298c7c['forEach'](function(_0x32b581){socket[_0x1bd5('0x78')](_0x1bd5('0x79'),{'UserId':_0x32b581['id'],'ChatQueueId':_0x2ede9d['id']});});});});});}})[_0x1bd5('0x1f')](respondWithStatusCode(_0x5df043,null))[_0x1bd5('0x29')](handleError(_0x5df043,null));};exports[_0x1bd5('0x7a')]=function(_0x28f567,_0x2a7a91,_0xf61654){return db[_0x1bd5('0x6f')][_0x1bd5('0x54')]({'where':{'id':_0x28f567['query'][_0x1bd5('0x7b')]},'attributes':['id'],'include':[{'model':db[_0x1bd5('0x66')],'as':_0x1bd5('0x71'),'attributes':['id'],'raw':!![]}]})[_0x1bd5('0x1f')](handleEntityNotFound(_0x2a7a91,null))['then'](function(_0x105e91){var _0x2d90a9=_['map'](_0x105e91,'id');var _0x51f51e=[];var _0x57ca48=[];var _0xf19816=squel[_0x1bd5('0x7c')]();_0xf19816[_0x1bd5('0x7d')]('tq.TeamId')['from'](_0x1bd5('0x7e'),'tq')[_0x1bd5('0x7f')]('user_has_teams','ut',_0x1bd5('0x80'))[_0x1bd5('0x4c')]('ChatQueueId\x20=\x20?',_0x28f567[_0x1bd5('0x61')]['id']);for(var _0x4bdfd7=0x0;_0x4bdfd7<_0x105e91[_0x1bd5('0x48')];_0x4bdfd7+=0x1){let _0xd51dea=_0x105e91[_0x4bdfd7];for(var _0x41c91b=0x0;_0x41c91b<_0xd51dea[_0x1bd5('0x71')][_0x1bd5('0x48')];_0x41c91b+=0x1){let _0x5c12ff=_0xd51dea[_0x1bd5('0x71')][_0x41c91b];var _0x435b04=_0xf19816[_0x1bd5('0x81')]();_0x435b04[_0x1bd5('0x4c')]('ut.UserId\x20=\x20?',_0x5c12ff['id']);_0x57ca48[_0x1bd5('0x82')](db[_0x1bd5('0x74')][_0x1bd5('0x42')](_0x435b04['toString'](),{'type':db[_0x1bd5('0x74')][_0x1bd5('0x83')][_0x1bd5('0x84')]})[_0x1bd5('0x1f')](function(_0x32a5f7){if(_0x32a5f7['length']===0x1){return _0x5c12ff['id'];}else{var _0x28256b=_[_0x1bd5('0x85')](_['map'](_0x32a5f7,_0x1bd5('0x86')),function(_0x3acf91){return _['includes'](_0x2d90a9,_0x3acf91);});if(_0x28256b){return _0x5c12ff['id'];}}}));}}return BPromise['all'](_0x57ca48)[_0x1bd5('0x1f')](function(_0x84cef1){_0x51f51e=_(_0x51f51e)[_0x1bd5('0x87')](_0x84cef1)[_0x1bd5('0x88')]()['value']();return db[_0x1bd5('0x3e')][_0x1bd5('0x57')]({'where':{'id':_0x28f567[_0x1bd5('0x61')]['id']}})[_0x1bd5('0x1f')](function(_0x22380d){return db[_0x1bd5('0x74')][_0x1bd5('0x75')](function(_0x9ee64d){return _0x22380d[_0x1bd5('0x7a')](_0x28f567[_0x1bd5('0x42')][_0x1bd5('0x7b')],{'transaction':_0x9ee64d})[_0x1bd5('0x1f')](function(){if(!_[_0x1bd5('0x89')](_0x51f51e)){return _0x22380d[_0x1bd5('0x8a')](_0x51f51e,{'transaction':_0x9ee64d});}})[_0x1bd5('0x1f')](function(){_0x51f51e[_0x1bd5('0x8b')](function(_0x2da319){socket['emit'](_0x1bd5('0x8c'),{'UserId':_0x2da319,'ChatQueueId':_0x22380d['id']});});});});});});})[_0x1bd5('0x1f')](respondWithStatusCode(_0x2a7a91,null))[_0x1bd5('0x29')](handleError(_0x2a7a91,null));};exports['addAgents']=function(_0x164e52,_0x37fd12,_0x118922){return db[_0x1bd5('0x3e')][_0x1bd5('0x57')]({'where':{'id':_0x164e52[_0x1bd5('0x61')]['id']}})[_0x1bd5('0x1f')](handleEntityNotFound(_0x37fd12,null))['then'](function(_0x118004){if(_0x118004){return _0x118004[_0x1bd5('0x8d')](_0x164e52[_0x1bd5('0x5e')][_0x1bd5('0x7b')],_[_0x1bd5('0x8e')](_0x164e52[_0x1bd5('0x5e')],[_0x1bd5('0x7b'),'id'])||{})[_0x1bd5('0x8f')](function(_0x218021){for(var _0x5013bd=0x0;_0x5013bd<_0x164e52[_0x1bd5('0x5e')][_0x1bd5('0x7b')][_0x1bd5('0x48')];_0x5013bd+=0x1){socket[_0x1bd5('0x78')]('userChatQueue:save',{'UserId':_0x164e52[_0x1bd5('0x5e')][_0x1bd5('0x7b')][_0x5013bd],'ChatQueueId':_0x164e52['params']['id']});}return _0x218021;});}})['then'](respondWithResult(_0x37fd12,null))[_0x1bd5('0x29')](handleError(_0x37fd12,null));};exports[_0x1bd5('0x8a')]=function(_0x13addf,_0x3bbb56,_0x139c58){return db[_0x1bd5('0x3e')]['find']({'where':{'id':_0x13addf['params']['id']}})[_0x1bd5('0x1f')](handleEntityNotFound(_0x3bbb56,null))[_0x1bd5('0x1f')](function(_0x361bd5){if(_0x361bd5){return _0x361bd5[_0x1bd5('0x8a')](_0x13addf[_0x1bd5('0x42')][_0x1bd5('0x7b')])[_0x1bd5('0x1f')](function(){if(_[_0x1bd5('0x90')](_0x13addf[_0x1bd5('0x42')][_0x1bd5('0x7b')])){for(var _0x1130c1=0x0;_0x1130c1<_0x13addf[_0x1bd5('0x42')][_0x1bd5('0x7b')][_0x1bd5('0x48')];_0x1130c1+=0x1){socket['emit'](_0x1bd5('0x8c'),{'UserId':Number(_0x13addf[_0x1bd5('0x42')][_0x1bd5('0x7b')][_0x1130c1]),'ChatQueueId':Number(_0x13addf[_0x1bd5('0x61')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x13addf[_0x1bd5('0x42')][_0x1bd5('0x7b')]),'ChatQueueId':Number(_0x13addf[_0x1bd5('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0x3bbb56,null))[_0x1bd5('0x29')](handleError(_0x3bbb56,null));};exports['getAgents']=function(_0x364ad7,_0x4554de,_0x99899b){var _0x59efaa={};var _0x529925={};var _0x213bc6;var _0x4c0179;return db['ChatQueue'][_0x1bd5('0x60')]({'where':{'id':_0x364ad7[_0x1bd5('0x61')]['id']}})[_0x1bd5('0x1f')](handleEntityNotFound(_0x4554de,null))['then'](function(_0xe74a01){if(_0xe74a01){_0x213bc6=_0xe74a01;_0x529925[_0x1bd5('0x41')]=_[_0x1bd5('0x43')](db[_0x1bd5('0x66')][_0x1bd5('0x56')]);_0x529925[_0x1bd5('0x42')]=_[_0x1bd5('0x43')](_0x364ad7[_0x1bd5('0x42')]);_0x529925[_0x1bd5('0x44')]=_[_0x1bd5('0x46')](_0x529925['model'],_0x529925[_0x1bd5('0x42')]);_0x59efaa['attributes']=_['intersection'](_0x529925[_0x1bd5('0x41')],qs['fields'](_0x364ad7[_0x1bd5('0x42')]['fields']));_0x59efaa['attributes']=_0x59efaa[_0x1bd5('0x45')]['length']?_0x59efaa['attributes']:_0x529925['model'];_0x59efaa[_0x1bd5('0x4a')]=qs[_0x1bd5('0x4b')](_0x364ad7['query'][_0x1bd5('0x4b')]);_0x59efaa['where']=qs[_0x1bd5('0x44')](_[_0x1bd5('0x64')](_0x364ad7[_0x1bd5('0x42')],_0x529925[_0x1bd5('0x44')]));if(_0x364ad7['query'][_0x1bd5('0x4f')]){_0x59efaa[_0x1bd5('0x4c')]=_[_0x1bd5('0x4d')](_0x59efaa[_0x1bd5('0x4c')],{'$or':_[_0x1bd5('0x3d')](_0x59efaa[_0x1bd5('0x45')],function(_0x1b24eb){var _0x1f726b={};_0x1f726b[_0x1b24eb]={'$like':'%'+_0x364ad7[_0x1bd5('0x42')]['filter']+'%'};return _0x1f726b;})});}_0x59efaa=_[_0x1bd5('0x4d')]({},_0x59efaa,_0x364ad7['options']);return _0x213bc6[_0x1bd5('0x91')](_0x59efaa);}})[_0x1bd5('0x1f')](function(_0x46141d){if(_0x46141d){_0x4c0179=_0x46141d[_0x1bd5('0x48')];if(!_0x364ad7[_0x1bd5('0x42')][_0x1bd5('0x63')](_0x1bd5('0x49'))){_0x59efaa['limit']=qs[_0x1bd5('0x2f')](_0x364ad7[_0x1bd5('0x42')][_0x1bd5('0x2f')]);_0x59efaa[_0x1bd5('0x2e')]=qs[_0x1bd5('0x2e')](_0x364ad7[_0x1bd5('0x42')][_0x1bd5('0x2e')]);}return _0x213bc6[_0x1bd5('0x91')](_0x59efaa);}})[_0x1bd5('0x1f')](function(_0x1833d1){if(_0x1833d1){return _0x1833d1?{'count':_0x4c0179,'rows':_0x1833d1}:null;}})['then'](respondWithResult(_0x4554de,null))[_0x1bd5('0x29')](handleError(_0x4554de,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index ec07a5f..d7a0416 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x59bed0,_0x252817){var _0x592459=function(_0x1ee1a0){while(--_0x1ee1a0){_0x59bed0['push'](_0x59bed0['shift']());}};_0x592459(++_0x252817);}(_0x5f2f,0x73));var _0xf5f2=function(_0x34f9e3,_0x2f74aa){_0x34f9e3=_0x34f9e3-0x0;var _0x7dfdeb=_0x5f2f[_0x34f9e3];return _0x7dfdeb;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x323179,_0x485191){var _0x10b052=function(_0xab78cd){while(--_0xab78cd){_0x323179['push'](_0x323179['shift']());}};_0x10b052(++_0x485191);}(_0xb10b,0x12a));var _0xbb10=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0xb10b[_0x35af23];return _0x340506;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index a26c8b2..01588a5 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 _0x0b9e=['util','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash'];(function(_0x51df35,_0x3a530d){var _0x225e66=function(_0x180515){while(--_0x180515){_0x51df35['push'](_0x51df35['shift']());}};_0x225e66(++_0x3a530d);}(_0x0b9e,0x1bb));var _0xe0b9=function(_0xba811f,_0x1f316f){_0xba811f=_0xba811f-0x0;var _0x41aaea=_0x0b9e[_0xba811f];return _0x41aaea;};'use strict';var _=require(_0xe0b9('0x0'));var util=require(_0xe0b9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe0b9('0x2'));var BPromise=require(_0xe0b9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0b9('0x4'));var rimraf=require(_0xe0b9('0x5'));var config=require(_0xe0b9('0x6'));var attributes=require(_0xe0b9('0x7'));module[_0xe0b9('0x8')]=function(_0x52e07b,_0x2ca46a){return _0x52e07b[_0xe0b9('0x9')](_0xe0b9('0xa'),attributes,{'tableName':_0xe0b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6572=['../../config/logger','api','moment','request-promise','path','../../config/environment','exports','ChatQueue','chat_queues'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6572,0x195));var _0x2657=function(_0x525d4f,_0x51afc6){_0x525d4f=_0x525d4f-0x0;var _0x1f84ab=_0x6572[_0x525d4f];return _0x1f84ab;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2657('0x0'))(_0x2657('0x1'));var moment=require(_0x2657('0x2'));var BPromise=require('bluebird');var rp=require(_0x2657('0x3'));var fs=require('fs');var path=require(_0x2657('0x4'));var rimraf=require('rimraf');var config=require(_0x2657('0x5'));var attributes=require('./chatQueue.attributes');module[_0x2657('0x6')]=function(_0x543651,_0x434682){return _0x543651['define'](_0x2657('0x7'),attributes,{'tableName':_0x2657('0x8'),'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 f7c9222..a9e440c 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 _0xbcae=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ChatQueue','findAll','options','raw','where','limit','include','map','model','attributes','GetChatQueue','find','ShowChatQueue','lodash','util','moment'];(function(_0x4d7559,_0x139f3e){var _0x40341c=function(_0x361c68){while(--_0x361c68){_0x4d7559['push'](_0x4d7559['shift']());}};_0x40341c(++_0x139f3e);}(_0xbcae,0xa9));var _0xebca=function(_0x26a31f,_0xb97bc5){_0x26a31f=_0x26a31f-0x0;var _0x39e397=_0xbcae[_0x26a31f];return _0x39e397;};'use strict';var _=require(_0xebca('0x0'));var util=require(_0xebca('0x1'));var moment=require(_0xebca('0x2'));var BPromise=require(_0xebca('0x3'));var rs=require(_0xebca('0x4'));var fs=require('fs');var Redis=require(_0xebca('0x5'));var db=require(_0xebca('0x6'))['db'];var utils=require(_0xebca('0x7'));var logger=require(_0xebca('0x8'))(_0xebca('0x9'));var config=require('../../config/environment');var jayson=require(_0xebca('0xa'));var client=jayson[_0xebca('0xb')]['http']({'port':0x232a});config[_0xebca('0xc')]=_[_0xebca('0xd')](config[_0xebca('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xebca('0xe'))(new Redis(config[_0xebca('0xc')]));require(_0xebca('0xf'))[_0xebca('0x10')](socket);function respondWithRpcPromise(_0x198c66,_0x3c0b2a,_0x4e63b0){return new BPromise(function(_0x525679,_0x5d8909){return client[_0xebca('0x11')](_0x198c66,_0x4e63b0)[_0xebca('0x12')](function(_0x31c3a1){logger[_0xebca('0x13')](_0xebca('0x14'),_0x3c0b2a,'request\x20sent');logger[_0xebca('0x15')](_0xebca('0x16'),_0x3c0b2a,_0xebca('0x17'),JSON[_0xebca('0x18')](_0x31c3a1));if(_0x31c3a1[_0xebca('0x19')]){if(_0x31c3a1[_0xebca('0x19')][_0xebca('0x1a')]===0x1f4){logger[_0xebca('0x19')]('ChatQueue,\x20%s,\x20%s',_0x3c0b2a,_0x31c3a1['error'][_0xebca('0x1b')]);return _0x5d8909(_0x31c3a1['error'][_0xebca('0x1b')]);}logger[_0xebca('0x19')](_0xebca('0x14'),_0x3c0b2a,_0x31c3a1[_0xebca('0x19')]['message']);return _0x525679(_0x31c3a1[_0xebca('0x19')][_0xebca('0x1b')]);}else{logger[_0xebca('0x13')](_0xebca('0x14'),_0x3c0b2a,'request\x20sent');_0x525679(_0x31c3a1[_0xebca('0x1c')][_0xebca('0x1b')]);}})[_0xebca('0x1d')](function(_0x4b1b1e){logger[_0xebca('0x19')](_0xebca('0x14'),_0x3c0b2a,_0x4b1b1e);_0x5d8909(_0x4b1b1e);});});}exports['GetChatQueue']=function(_0x2c0546){var _0x1a7cc0=this;return new Promise(function(_0x37b271,_0x337ebb){return db[_0xebca('0x1e')][_0xebca('0x1f')]({'raw':_0x2c0546[_0xebca('0x20')]?_0x2c0546[_0xebca('0x20')][_0xebca('0x21')]===undefined?!![]:![]:!![],'where':_0x2c0546[_0xebca('0x20')]?_0x2c0546[_0xebca('0x20')][_0xebca('0x22')]||null:null,'attributes':_0x2c0546[_0xebca('0x20')]?_0x2c0546[_0xebca('0x20')]['attributes']||null:null,'limit':_0x2c0546[_0xebca('0x20')]?_0x2c0546[_0xebca('0x20')][_0xebca('0x23')]||null:null,'include':_0x2c0546['options']?_0x2c0546['options'][_0xebca('0x24')]?_[_0xebca('0x25')](_0x2c0546['options'][_0xebca('0x24')],function(_0x163478){return{'model':db[_0x163478[_0xebca('0x26')]],'as':_0x163478['as'],'attributes':_0x163478['attributes'],'include':_0x163478[_0xebca('0x24')]?_[_0xebca('0x25')](_0x163478[_0xebca('0x24')],function(_0x2234af){return{'model':db[_0x2234af[_0xebca('0x26')]],'as':_0x2234af['as'],'attributes':_0x2234af[_0xebca('0x27')],'include':_0x2234af[_0xebca('0x24')]?_[_0xebca('0x25')](_0x2234af[_0xebca('0x24')],function(_0x98b94a){return{'model':db[_0x98b94a[_0xebca('0x26')]],'as':_0x98b94a['as'],'attributes':_0x98b94a[_0xebca('0x27')]};}):[]};}):[]};}):[]:[]})[_0xebca('0x12')](function(_0x3a49ba){logger[_0xebca('0x13')](_0xebca('0x28'),_0x2c0546);logger[_0xebca('0x15')](_0xebca('0x28'),_0x2c0546,JSON[_0xebca('0x18')](_0x3a49ba));_0x37b271(_0x3a49ba);})[_0xebca('0x1d')](function(_0x217398){logger[_0xebca('0x19')](_0xebca('0x28'),_0x217398[_0xebca('0x1b')],_0x2c0546);_0x337ebb(_0x1a7cc0[_0xebca('0x19')](0x1f4,_0x217398[_0xebca('0x1b')]));});});};exports['ShowChatQueue']=function(_0x1bdbbe){var _0xece17d=this;return new Promise(function(_0x4da32b,_0x594fbe){return db['ChatQueue'][_0xebca('0x29')]({'raw':_0x1bdbbe[_0xebca('0x20')]?_0x1bdbbe[_0xebca('0x20')][_0xebca('0x21')]===undefined?!![]:![]:!![],'where':_0x1bdbbe[_0xebca('0x20')]?_0x1bdbbe[_0xebca('0x20')][_0xebca('0x22')]||null:null,'attributes':_0x1bdbbe[_0xebca('0x20')]?_0x1bdbbe[_0xebca('0x20')][_0xebca('0x27')]||null:null,'include':_0x1bdbbe['options']?_0x1bdbbe[_0xebca('0x20')][_0xebca('0x24')]?_[_0xebca('0x25')](_0x1bdbbe[_0xebca('0x20')]['include'],function(_0x3c8eb3){return{'model':db[_0x3c8eb3[_0xebca('0x26')]],'as':_0x3c8eb3['as'],'attributes':_0x3c8eb3[_0xebca('0x27')],'include':_0x3c8eb3[_0xebca('0x24')]?_[_0xebca('0x25')](_0x3c8eb3[_0xebca('0x24')],function(_0x26c28f){return{'model':db[_0x26c28f[_0xebca('0x26')]],'as':_0x26c28f['as'],'attributes':_0x26c28f[_0xebca('0x27')],'include':_0x26c28f[_0xebca('0x24')]?_[_0xebca('0x25')](_0x26c28f[_0xebca('0x24')],function(_0x1c4a68){return{'model':db[_0x1c4a68[_0xebca('0x26')]],'as':_0x1c4a68['as'],'attributes':_0x1c4a68[_0xebca('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x176782){logger['info'](_0xebca('0x2a'),_0x1bdbbe);logger[_0xebca('0x15')]('ShowChatQueue',_0x1bdbbe,JSON[_0xebca('0x18')](_0x176782));_0x4da32b(_0x176782);})[_0xebca('0x1d')](function(_0x552fa1){logger[_0xebca('0x19')](_0xebca('0x2a'),_0x552fa1[_0xebca('0x1b')],_0x1bdbbe);_0x594fbe(_0xece17d['error'](0x1f4,_0x552fa1[_0xebca('0x1b')]));});});}; \ No newline at end of file +var _0x65da=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','GetChatQueue','ChatQueue','findAll','options','where','attributes','include','map','model','ShowChatQueue','raw','stringify','catch','lodash','moment','bluebird','randomstring'];(function(_0x54a83a,_0x501134){var _0x4dff1a=function(_0x5a18c8){while(--_0x5a18c8){_0x54a83a['push'](_0x54a83a['shift']());}};_0x4dff1a(++_0x501134);}(_0x65da,0x152));var _0xa65d=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x65da[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0xa65d('0x0'));var util=require('util');var moment=require(_0xa65d('0x1'));var BPromise=require(_0xa65d('0x2'));var rs=require(_0xa65d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa65d('0x4'))['db'];var utils=require(_0xa65d('0x5'));var logger=require(_0xa65d('0x6'))(_0xa65d('0x7'));var config=require(_0xa65d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa65d('0x9')]({'port':0x232a});config[_0xa65d('0xa')]=_[_0xa65d('0xb')](config[_0xa65d('0xa')],{'host':_0xa65d('0xc'),'port':0x18eb});var socket=require(_0xa65d('0xd'))(new Redis(config[_0xa65d('0xa')]));require('./chatQueue.socket')[_0xa65d('0xe')](socket);function respondWithRpcPromise(_0x310409,_0x4d14a7,_0x5865a7){return new BPromise(function(_0x363c9c,_0x25f889){return client[_0xa65d('0xf')](_0x310409,_0x5865a7)[_0xa65d('0x10')](function(_0x47a398){logger[_0xa65d('0x11')](_0xa65d('0x12'),_0x4d14a7,_0xa65d('0x13'));logger[_0xa65d('0x14')](_0xa65d('0x15'),_0x4d14a7,_0xa65d('0x13'),JSON['stringify'](_0x47a398));if(_0x47a398[_0xa65d('0x16')]){if(_0x47a398[_0xa65d('0x16')]['code']===0x1f4){logger[_0xa65d('0x16')]('ChatQueue,\x20%s,\x20%s',_0x4d14a7,_0x47a398[_0xa65d('0x16')]['message']);return _0x25f889(_0x47a398[_0xa65d('0x16')]['message']);}logger[_0xa65d('0x16')](_0xa65d('0x12'),_0x4d14a7,_0x47a398['error']['message']);return _0x363c9c(_0x47a398[_0xa65d('0x16')][_0xa65d('0x17')]);}else{logger[_0xa65d('0x11')](_0xa65d('0x12'),_0x4d14a7,_0xa65d('0x13'));_0x363c9c(_0x47a398[_0xa65d('0x18')][_0xa65d('0x17')]);}})['catch'](function(_0x43efa4){logger[_0xa65d('0x16')]('ChatQueue,\x20%s,\x20%s',_0x4d14a7,_0x43efa4);_0x25f889(_0x43efa4);});});}exports[_0xa65d('0x19')]=function(_0x3e3c35){var _0x1e7467=this;return new Promise(function(_0x167ed3,_0x3fa937){return db[_0xa65d('0x1a')][_0xa65d('0x1b')]({'raw':_0x3e3c35[_0xa65d('0x1c')]?_0x3e3c35['options']['raw']===undefined?!![]:![]:!![],'where':_0x3e3c35[_0xa65d('0x1c')]?_0x3e3c35['options'][_0xa65d('0x1d')]||null:null,'attributes':_0x3e3c35[_0xa65d('0x1c')]?_0x3e3c35[_0xa65d('0x1c')][_0xa65d('0x1e')]||null:null,'limit':_0x3e3c35[_0xa65d('0x1c')]?_0x3e3c35[_0xa65d('0x1c')]['limit']||null:null,'include':_0x3e3c35[_0xa65d('0x1c')]?_0x3e3c35[_0xa65d('0x1c')][_0xa65d('0x1f')]?_[_0xa65d('0x20')](_0x3e3c35[_0xa65d('0x1c')]['include'],function(_0x36db19){return{'model':db[_0x36db19[_0xa65d('0x21')]],'as':_0x36db19['as'],'attributes':_0x36db19[_0xa65d('0x1e')],'include':_0x36db19['include']?_['map'](_0x36db19[_0xa65d('0x1f')],function(_0x9b1557){return{'model':db[_0x9b1557['model']],'as':_0x9b1557['as'],'attributes':_0x9b1557[_0xa65d('0x1e')],'include':_0x9b1557[_0xa65d('0x1f')]?_[_0xa65d('0x20')](_0x9b1557['include'],function(_0xc48136){return{'model':db[_0xc48136[_0xa65d('0x21')]],'as':_0xc48136['as'],'attributes':_0xc48136['attributes']};}):[]};}):[]};}):[]:[]})[_0xa65d('0x10')](function(_0x32f2df){logger[_0xa65d('0x11')]('GetChatQueue',_0x3e3c35);logger[_0xa65d('0x14')](_0xa65d('0x19'),_0x3e3c35,JSON['stringify'](_0x32f2df));_0x167ed3(_0x32f2df);})['catch'](function(_0x558e52){logger[_0xa65d('0x16')](_0xa65d('0x19'),_0x558e52['message'],_0x3e3c35);_0x3fa937(_0x1e7467['error'](0x1f4,_0x558e52['message']));});});};exports[_0xa65d('0x22')]=function(_0x157747){var _0x281417=this;return new Promise(function(_0x1234db,_0x7bf9d0){return db['ChatQueue']['find']({'raw':_0x157747['options']?_0x157747['options'][_0xa65d('0x23')]===undefined?!![]:![]:!![],'where':_0x157747[_0xa65d('0x1c')]?_0x157747['options'][_0xa65d('0x1d')]||null:null,'attributes':_0x157747[_0xa65d('0x1c')]?_0x157747[_0xa65d('0x1c')][_0xa65d('0x1e')]||null:null,'include':_0x157747[_0xa65d('0x1c')]?_0x157747[_0xa65d('0x1c')][_0xa65d('0x1f')]?_['map'](_0x157747[_0xa65d('0x1c')][_0xa65d('0x1f')],function(_0x588540){return{'model':db[_0x588540[_0xa65d('0x21')]],'as':_0x588540['as'],'attributes':_0x588540[_0xa65d('0x1e')],'include':_0x588540[_0xa65d('0x1f')]?_[_0xa65d('0x20')](_0x588540[_0xa65d('0x1f')],function(_0x65d27f){return{'model':db[_0x65d27f[_0xa65d('0x21')]],'as':_0x65d27f['as'],'attributes':_0x65d27f[_0xa65d('0x1e')],'include':_0x65d27f[_0xa65d('0x1f')]?_['map'](_0x65d27f[_0xa65d('0x1f')],function(_0x1048e0){return{'model':db[_0x1048e0[_0xa65d('0x21')]],'as':_0x1048e0['as'],'attributes':_0x1048e0[_0xa65d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa65d('0x10')](function(_0x19d958){logger[_0xa65d('0x11')]('ShowChatQueue',_0x157747);logger[_0xa65d('0x14')](_0xa65d('0x22'),_0x157747,JSON[_0xa65d('0x24')](_0x19d958));_0x1234db(_0x19d958);})[_0xa65d('0x25')](function(_0x531833){logger[_0xa65d('0x16')]('ShowChatQueue',_0x531833[_0xa65d('0x17')],_0x157747);_0x7bf9d0(_0x281417['error'](0x1f4,_0x531833['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index e8bbb47..cb357a0 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 _0xadb5=['update','emit','register','length','chatQueue:','save'];(function(_0x20e991,_0x126d53){var _0xbe4e1f=function(_0x402109){while(--_0x402109){_0x20e991['push'](_0x20e991['shift']());}};_0xbe4e1f(++_0x126d53);}(_0xadb5,0xad));var _0x5adb=function(_0x124345,_0x2fbdbd){_0x124345=_0x124345-0x0;var _0xb5778d=_0xadb5[_0x124345];return _0xb5778d;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x5adb('0x0'),'remove',_0x5adb('0x1')];function createListener(_0x38f67f,_0x3129c3){return function(_0x4aecec){_0x3129c3[_0x5adb('0x2')](_0x38f67f,_0x4aecec);};}function removeListener(_0x31457,_0x2e3ef4){return function(){ChatQueueEvents['removeListener'](_0x31457,_0x2e3ef4);};}exports[_0x5adb('0x3')]=function(_0x168d89){for(var _0x3e2555=0x0,_0x3213e8=events[_0x5adb('0x4')];_0x3e2555<_0x3213e8;_0x3e2555++){var _0x353885=events[_0x3e2555];var _0x47228a=createListener(_0x5adb('0x5')+_0x353885,_0x168d89);ChatQueueEvents['on'](_0x353885,_0x47228a);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x128056,_0x4f314b){var _0x47da14=function(_0xf6f119){while(--_0xf6f119){_0x128056['push'](_0x128056['shift']());}};_0x47da14(++_0x4f314b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1aebdd,_0x41ed0a){_0x1aebdd=_0x1aebdd-0x0;var _0x363da2=_0x5f2f[_0x1aebdd];return _0x363da2;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index f712bc6..888ead3 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 _0x953d=['getTeams','/:id/users','getAgents','post','create','addAgents','put','update','destroy','delete','/:id/teams','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','isAuthenticated','get','/:id','show','/:id/members','getMembers'];(function(_0x55b6d1,_0xdaa810){var _0x2b04db=function(_0xe6219c){while(--_0xe6219c){_0x55b6d1['push'](_0x55b6d1['shift']());}};_0x2b04db(++_0xdaa810);}(_0x953d,0x93));var _0xd953=function(_0x92724b,_0x18e7d6){_0x92724b=_0x92724b-0x0;var _0x12e4f5=_0x953d[_0x92724b];return _0x12e4f5;};'use strict';var multer=require('multer');var util=require(_0xd953('0x0'));var path=require(_0xd953('0x1'));var timeout=require(_0xd953('0x2'));var express=require('express');var router=express[_0xd953('0x3')]();var fs_extra=require(_0xd953('0x4'));var auth=require(_0xd953('0x5'));var interaction=require(_0xd953('0x6'));var config=require(_0xd953('0x7'));var controller=require(_0xd953('0x8'));router['get']('/',auth[_0xd953('0x9')](),controller['index']);router[_0xd953('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xd953('0xb'),auth['isAuthenticated'](),controller[_0xd953('0xc')]);router[_0xd953('0xa')](_0xd953('0xd'),auth[_0xd953('0x9')](),controller[_0xd953('0xe')]);router[_0xd953('0xa')]('/:id/teams',auth[_0xd953('0x9')](),controller[_0xd953('0xf')]);router[_0xd953('0xa')](_0xd953('0x10'),auth[_0xd953('0x9')](),controller[_0xd953('0x11')]);router[_0xd953('0x12')]('/',auth[_0xd953('0x9')](),controller[_0xd953('0x13')]);router[_0xd953('0x12')]('/:id/teams',auth[_0xd953('0x9')](),controller['addTeams']);router[_0xd953('0x12')](_0xd953('0x10'),auth['isAuthenticated'](),controller[_0xd953('0x14')]);router[_0xd953('0x15')](_0xd953('0xb'),auth[_0xd953('0x9')](),controller[_0xd953('0x16')]);router['delete']('/:id',auth[_0xd953('0x9')](),controller[_0xd953('0x17')]);router[_0xd953('0x18')](_0xd953('0x19'),auth[_0xd953('0x9')](),controller['removeTeams']);router['delete'](_0xd953('0x10'),auth[_0xd953('0x9')](),controller['removeAgents']);module[_0xd953('0x1a')]=router; \ No newline at end of file +var _0x20d8=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','/:id/users','getAgents','create','post','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','fs-extra'];(function(_0x20ec45,_0x57b18f){var _0x169f4e=function(_0x3828ad){while(--_0x3828ad){_0x20ec45['push'](_0x20ec45['shift']());}};_0x169f4e(++_0x57b18f);}(_0x20d8,0xee));var _0x820d=function(_0x46bc61,_0x3ee5cc){_0x46bc61=_0x46bc61-0x0;var _0x43e57e=_0x20d8[_0x46bc61];return _0x43e57e;};'use strict';var multer=require(_0x820d('0x0'));var util=require(_0x820d('0x1'));var path=require(_0x820d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x820d('0x3')]();var fs_extra=require(_0x820d('0x4'));var auth=require(_0x820d('0x5'));var interaction=require(_0x820d('0x6'));var config=require(_0x820d('0x7'));var controller=require('./chatQueue.controller');router[_0x820d('0x8')]('/',auth[_0x820d('0x9')](),controller[_0x820d('0xa')]);router['get'](_0x820d('0xb'),auth[_0x820d('0x9')](),controller[_0x820d('0xc')]);router['get'](_0x820d('0xd'),auth['isAuthenticated'](),controller[_0x820d('0xe')]);router['get']('/:id/members',auth[_0x820d('0x9')](),controller['getMembers']);router[_0x820d('0x8')](_0x820d('0xf'),auth[_0x820d('0x9')](),controller['getTeams']);router[_0x820d('0x8')](_0x820d('0x10'),auth['isAuthenticated'](),controller[_0x820d('0x11')]);router['post']('/',auth[_0x820d('0x9')](),controller[_0x820d('0x12')]);router[_0x820d('0x13')](_0x820d('0xf'),auth[_0x820d('0x9')](),controller[_0x820d('0x14')]);router['post']('/:id/users',auth[_0x820d('0x9')](),controller['addAgents']);router[_0x820d('0x15')](_0x820d('0xd'),auth[_0x820d('0x9')](),controller['update']);router[_0x820d('0x16')](_0x820d('0xd'),auth[_0x820d('0x9')](),controller[_0x820d('0x17')]);router[_0x820d('0x16')](_0x820d('0xf'),auth[_0x820d('0x9')](),controller[_0x820d('0x18')]);router[_0x820d('0x16')](_0x820d('0x10'),auth[_0x820d('0x9')](),controller[_0x820d('0x19')]);module[_0x820d('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 3295193..2c9f1a6 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 _0xed0d=['DATE','moment','sequelize','exports','STRING'];(function(_0x35d06e,_0x2e3503){var _0x9e9053=function(_0x1546d3){while(--_0x1546d3){_0x35d06e['push'](_0x35d06e['shift']());}};_0x9e9053(++_0x2e3503);}(_0xed0d,0xc4));var _0xded0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xed0d[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xded0('0x0'));var Sequelize=require(_0xded0('0x1'));module[_0xded0('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xded0('0x3')]},'joinAt':{'type':Sequelize[_0xded0('0x4')]},'leaveAt':{'type':Sequelize[_0xded0('0x4')]},'acceptAt':{'type':Sequelize[_0xded0('0x4')]},'exitAt':{'type':Sequelize[_0xded0('0x4')]},'reason':{'type':Sequelize[_0xded0('0x3')]}}; \ No newline at end of file +var _0x30a4=['DATE','sequelize','exports','STRING'];(function(_0x4110d6,_0x53e65e){var _0x350e13=function(_0x440b58){while(--_0x440b58){_0x4110d6['push'](_0x4110d6['shift']());}};_0x350e13(++_0x53e65e);}(_0x30a4,0x161));var _0x430a=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0x30a4[_0x5179a5];return _0x15c8ce;};'use strict';var moment=require('moment');var Sequelize=require(_0x430a('0x0'));module[_0x430a('0x1')]={'uniqueid':{'type':Sequelize[_0x430a('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x430a('0x3')]},'leaveAt':{'type':Sequelize[_0x430a('0x3')]},'acceptAt':{'type':Sequelize[_0x430a('0x3')]},'exitAt':{'type':Sequelize[_0x430a('0x3')]},'reason':{'type':Sequelize[_0x430a('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 96b6aa1..c619cf3 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 _0xdeeb=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','keys','query','filters','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','find','catch','create','body','params','describe','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5e5c4c,_0x21abba){var _0x176148=function(_0x59522a){while(--_0x59522a){_0x5e5c4c['push'](_0x5e5c4c['shift']());}};_0x176148(++_0x21abba);}(_0xdeeb,0x1b4));var _0xbdee=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xdeeb[_0x1ae5ab];return _0x1ce001;};'use strict';var pdf=require(_0xbdee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbdee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbdee('0x2'));var rp=require(_0xbdee('0x3'));var moment=require('moment');var BPromise=require(_0xbdee('0x4'));var Mustache=require(_0xbdee('0x5'));var util=require(_0xbdee('0x6'));var path=require(_0xbdee('0x7'));var sox=require(_0xbdee('0x8'));var csv=require(_0xbdee('0x9'));var ejs=require(_0xbdee('0xa'));var fs=require('fs');var fs_extra=require(_0xbdee('0xb'));var _=require('lodash');var squel=require(_0xbdee('0xc'));var crypto=require('crypto');var jsforce=require(_0xbdee('0xd'));var deskjs=require(_0xbdee('0xe'));var toCsv=require(_0xbdee('0x9'));var querystring=require('querystring');var Papa=require(_0xbdee('0xf'));var Redis=require(_0xbdee('0x10'));var authService=require(_0xbdee('0x11'));var qs=require(_0xbdee('0x12'));var as=require(_0xbdee('0x13'));var hardwareService=require(_0xbdee('0x14'));var logger=require(_0xbdee('0x15'))(_0xbdee('0x16'));var utils=require(_0xbdee('0x17'));var config=require(_0xbdee('0x18'));var licenseUtil=require(_0xbdee('0x19'));var db=require(_0xbdee('0x1a'))['db'];function respondWithStatusCode(_0x99fe04,_0x26e035){_0x26e035=_0x26e035||0xcc;return function(_0x355b9e){if(_0x355b9e){return _0x99fe04['sendStatus'](_0x26e035);}return _0x99fe04[_0xbdee('0x1b')](_0x26e035)[_0xbdee('0x1c')]();};}function respondWithResult(_0x47521b,_0x560bf3){_0x560bf3=_0x560bf3||0xc8;return function(_0x297d33){if(_0x297d33){return _0x47521b[_0xbdee('0x1b')](_0x560bf3)[_0xbdee('0x1d')](_0x297d33);}};}function respondWithFilteredResult(_0x449c6c,_0x1e5e5a){return function(_0x5d9434){if(_0x5d9434){var _0x4ea595=_0x5d9434[_0xbdee('0x1e')],_0x41a6d1=_0x1e5e5a[_0xbdee('0x1f')],_0x190471=_0x1e5e5a[_0xbdee('0x1f')]+_0x1e5e5a[_0xbdee('0x20')],_0x48640e;if(_0x190471>=_0x4ea595){_0x190471=_0x4ea595;_0x48640e=0xc8;}else{_0x48640e=0xce;}_0x449c6c[_0xbdee('0x1b')](_0x48640e);return _0x449c6c[_0xbdee('0x21')](_0xbdee('0x22'),_0x41a6d1+'-'+_0x190471+'/'+_0x4ea595)['json'](_0x5d9434);}return null;};}function patchUpdates(_0x399441){return function(_0x50700d){try{jsonpatch[_0xbdee('0x23')](_0x50700d,_0x399441,!![]);}catch(_0x27dde5){return BPromise[_0xbdee('0x24')](_0x27dde5);}return _0x50700d['save']();};}function saveUpdates(_0x49fb1e,_0x2ef9d5){return function(_0x1e2e84){if(_0x1e2e84){return _0x1e2e84[_0xbdee('0x25')](_0x49fb1e)[_0xbdee('0x26')](function(_0x3800f5){return _0x3800f5;});}return null;};}function removeEntity(_0x286c34,_0x1bdf2e){return function(_0xba1ad6){if(_0xba1ad6){return _0xba1ad6[_0xbdee('0x27')]()['then'](function(){_0x286c34['status'](0xcc)[_0xbdee('0x1c')]();});}};}function handleEntityNotFound(_0x58f21d,_0x569dfb){return function(_0x2c89ee){if(!_0x2c89ee){_0x58f21d[_0xbdee('0x28')](0x194);}return _0x2c89ee;};}function handleError(_0x5898a9,_0x3707fd){_0x3707fd=_0x3707fd||0x1f4;return function(_0x41f3ff){logger[_0xbdee('0x29')](_0x41f3ff[_0xbdee('0x2a')]);if(_0x41f3ff[_0xbdee('0x2b')]){delete _0x41f3ff['name'];}_0x5898a9['status'](_0x3707fd)[_0xbdee('0x2c')](_0x41f3ff);};}exports[_0xbdee('0x2d')]=function(_0x2dbd6a,_0x17ac42){var _0x47d783={},_0x57c17c={},_0x4e4f39={'count':0x0,'rows':[]};var _0x1de45e=_[_0xbdee('0x2e')](db[_0xbdee('0x2f')][_0xbdee('0x30')],function(_0x46f805){return{'name':_0x46f805[_0xbdee('0x31')],'type':_0x46f805['type']['key']};});_0x57c17c['model']=_[_0xbdee('0x2e')](_0x1de45e,_0xbdee('0x2b'));_0x57c17c['query']=_[_0xbdee('0x32')](_0x2dbd6a[_0xbdee('0x33')]);_0x57c17c[_0xbdee('0x34')]=_['intersection'](_0x57c17c[_0xbdee('0x35')],_0x57c17c[_0xbdee('0x33')]);_0x47d783[_0xbdee('0x36')]=_['intersection'](_0x57c17c[_0xbdee('0x35')],qs[_0xbdee('0x37')](_0x2dbd6a['query'][_0xbdee('0x37')]));_0x47d783[_0xbdee('0x36')]=_0x47d783[_0xbdee('0x36')][_0xbdee('0x38')]?_0x47d783[_0xbdee('0x36')]:_0x57c17c[_0xbdee('0x35')];if(!_0x2dbd6a[_0xbdee('0x33')]['hasOwnProperty'](_0xbdee('0x39'))){_0x47d783[_0xbdee('0x20')]=qs[_0xbdee('0x20')](_0x2dbd6a[_0xbdee('0x33')][_0xbdee('0x20')]);_0x47d783[_0xbdee('0x1f')]=qs[_0xbdee('0x1f')](_0x2dbd6a[_0xbdee('0x33')][_0xbdee('0x1f')]);}_0x47d783[_0xbdee('0x3a')]=qs[_0xbdee('0x3b')](_0x2dbd6a[_0xbdee('0x33')][_0xbdee('0x3b')]);_0x47d783['where']=qs[_0xbdee('0x34')](_[_0xbdee('0x3c')](_0x2dbd6a[_0xbdee('0x33')],_0x57c17c[_0xbdee('0x34')]),_0x1de45e);if(_0x2dbd6a['query'][_0xbdee('0x3d')]){_0x47d783[_0xbdee('0x3e')]=_[_0xbdee('0x3f')](_0x47d783[_0xbdee('0x3e')],{'$or':_[_0xbdee('0x2e')](_0x1de45e,function(_0x31edd6){if(_0x31edd6[_0xbdee('0x40')]!==_0xbdee('0x41')){var _0x29b9e5={};_0x29b9e5[_0x31edd6[_0xbdee('0x2b')]]={'$like':'%'+_0x2dbd6a[_0xbdee('0x33')][_0xbdee('0x3d')]+'%'};return _0x29b9e5;}})});}_0x47d783=_[_0xbdee('0x3f')]({},_0x47d783,_0x2dbd6a[_0xbdee('0x42')]);var _0x183713={'where':_0x47d783[_0xbdee('0x3e')]};return db[_0xbdee('0x2f')][_0xbdee('0x1e')](_0x183713)['then'](function(_0x41c1bc){_0x4e4f39[_0xbdee('0x1e')]=_0x41c1bc;if(_0x2dbd6a[_0xbdee('0x33')][_0xbdee('0x43')]){_0x47d783[_0xbdee('0x44')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xbdee('0x45')](_0x47d783);})['then'](function(_0x385931){_0x4e4f39['rows']=_0x385931;return _0x4e4f39;})['then'](respondWithFilteredResult(_0x17ac42,_0x47d783))['catch'](handleError(_0x17ac42,null));};exports['show']=function(_0x3875f2,_0x2f67cf){var _0x5a2715={'raw':!![],'where':{'id':_0x3875f2['params']['id']}},_0x493634={};_0x493634[_0xbdee('0x35')]=_[_0xbdee('0x32')](db[_0xbdee('0x2f')][_0xbdee('0x30')]);_0x493634[_0xbdee('0x33')]=_[_0xbdee('0x32')](_0x3875f2[_0xbdee('0x33')]);_0x493634[_0xbdee('0x34')]=_['intersection'](_0x493634[_0xbdee('0x35')],_0x493634[_0xbdee('0x33')]);_0x5a2715[_0xbdee('0x36')]=_['intersection'](_0x493634[_0xbdee('0x35')],qs['fields'](_0x3875f2[_0xbdee('0x33')][_0xbdee('0x37')]));_0x5a2715['attributes']=_0x5a2715[_0xbdee('0x36')]['length']?_0x5a2715[_0xbdee('0x36')]:_0x493634['model'];if(_0x3875f2['query'][_0xbdee('0x43')]){_0x5a2715[_0xbdee('0x44')]=[{'all':!![]}];}_0x5a2715=_[_0xbdee('0x3f')]({},_0x5a2715,_0x3875f2[_0xbdee('0x42')]);return db[_0xbdee('0x2f')][_0xbdee('0x46')](_0x5a2715)[_0xbdee('0x26')](handleEntityNotFound(_0x2f67cf,null))['then'](respondWithResult(_0x2f67cf,null))[_0xbdee('0x47')](handleError(_0x2f67cf,null));};exports[_0xbdee('0x48')]=function(_0x459f0c,_0x2f3076){return db[_0xbdee('0x2f')][_0xbdee('0x48')](_0x459f0c[_0xbdee('0x49')],{})[_0xbdee('0x26')](respondWithResult(_0x2f3076,0xc9))[_0xbdee('0x47')](handleError(_0x2f3076,null));};exports[_0xbdee('0x25')]=function(_0x8266f0,_0x397d2e){if(_0x8266f0[_0xbdee('0x49')]['id']){delete _0x8266f0[_0xbdee('0x49')]['id'];}return db['ChatQueueReport'][_0xbdee('0x46')]({'where':{'id':_0x8266f0[_0xbdee('0x4a')]['id']}})[_0xbdee('0x26')](handleEntityNotFound(_0x397d2e,null))[_0xbdee('0x26')](saveUpdates(_0x8266f0[_0xbdee('0x49')],null))[_0xbdee('0x26')](respondWithResult(_0x397d2e,null))['catch'](handleError(_0x397d2e,null));};exports['destroy']=function(_0x40d52f,_0x3f8bbd){return db[_0xbdee('0x2f')][_0xbdee('0x46')]({'where':{'id':_0x40d52f['params']['id']}})['then'](handleEntityNotFound(_0x3f8bbd,null))[_0xbdee('0x26')](removeEntity(_0x3f8bbd,null))['catch'](handleError(_0x3f8bbd,null));};exports[_0xbdee('0x4b')]=function(_0x4c9b6e,_0x25ab35){return db[_0xbdee('0x2f')][_0xbdee('0x4b')]()[_0xbdee('0x26')](respondWithResult(_0x25ab35,null))[_0xbdee('0x47')](handleError(_0x25ab35,null));}; \ No newline at end of file +var _0x36c6=['key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','catch','params','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','count','offset','set','Content-Range','apply','update','then','destroy','end','error','stack','name','map','ChatQueueReport','rawAttributes','type'];(function(_0x114f12,_0x4e9bb1){var _0x1a2c88=function(_0x2ae216){while(--_0x2ae216){_0x114f12['push'](_0x114f12['shift']());}};_0x1a2c88(++_0x4e9bb1);}(_0x36c6,0x126));var _0x636c=function(_0xae4286,_0xe0a859){_0xae4286=_0xae4286-0x0;var _0x3dd309=_0x36c6[_0xae4286];return _0x3dd309;};'use strict';var pdf=require(_0x636c('0x0'));var emlformat=require(_0x636c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x636c('0x2'));var jsonpatch=require(_0x636c('0x3'));var rp=require(_0x636c('0x4'));var moment=require(_0x636c('0x5'));var BPromise=require(_0x636c('0x6'));var Mustache=require('mustache');var util=require(_0x636c('0x7'));var path=require(_0x636c('0x8'));var sox=require(_0x636c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x636c('0xa'));var _=require(_0x636c('0xb'));var squel=require(_0x636c('0xc'));var crypto=require('crypto');var jsforce=require(_0x636c('0xd'));var deskjs=require(_0x636c('0xe'));var toCsv=require(_0x636c('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x636c('0x10'));var qs=require(_0x636c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x636c('0x12'));var logger=require(_0x636c('0x13'))(_0x636c('0x14'));var utils=require(_0x636c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x636c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6ac2d3,_0x5078c7){_0x5078c7=_0x5078c7||0xcc;return function(_0x1072b1){if(_0x1072b1){return _0x6ac2d3[_0x636c('0x17')](_0x5078c7);}return _0x6ac2d3[_0x636c('0x18')](_0x5078c7)['end']();};}function respondWithResult(_0x147def,_0x2e1897){_0x2e1897=_0x2e1897||0xc8;return function(_0xdb99d0){if(_0xdb99d0){return _0x147def[_0x636c('0x18')](_0x2e1897)['json'](_0xdb99d0);}};}function respondWithFilteredResult(_0x5e871b,_0x155290){return function(_0x5ee913){if(_0x5ee913){var _0x3655f4=_0x5ee913[_0x636c('0x19')],_0x1015bc=_0x155290[_0x636c('0x1a')],_0x470432=_0x155290[_0x636c('0x1a')]+_0x155290['limit'],_0x2f0909;if(_0x470432>=_0x3655f4){_0x470432=_0x3655f4;_0x2f0909=0xc8;}else{_0x2f0909=0xce;}_0x5e871b[_0x636c('0x18')](_0x2f0909);return _0x5e871b[_0x636c('0x1b')](_0x636c('0x1c'),_0x1015bc+'-'+_0x470432+'/'+_0x3655f4)['json'](_0x5ee913);}return null;};}function patchUpdates(_0x3151dc){return function(_0x11ea96){try{jsonpatch[_0x636c('0x1d')](_0x11ea96,_0x3151dc,!![]);}catch(_0x3034a9){return BPromise['reject'](_0x3034a9);}return _0x11ea96['save']();};}function saveUpdates(_0xeabd3d,_0x5769fd){return function(_0x3517a0){if(_0x3517a0){return _0x3517a0[_0x636c('0x1e')](_0xeabd3d)[_0x636c('0x1f')](function(_0x3219b4){return _0x3219b4;});}return null;};}function removeEntity(_0xe5f769,_0x45fd6c){return function(_0x27433f){if(_0x27433f){return _0x27433f[_0x636c('0x20')]()[_0x636c('0x1f')](function(){_0xe5f769[_0x636c('0x18')](0xcc)[_0x636c('0x21')]();});}};}function handleEntityNotFound(_0x353e0e,_0x39f59c){return function(_0x193f98){if(!_0x193f98){_0x353e0e[_0x636c('0x17')](0x194);}return _0x193f98;};}function handleError(_0x274c77,_0x31c8e5){_0x31c8e5=_0x31c8e5||0x1f4;return function(_0xb20e0d){logger[_0x636c('0x22')](_0xb20e0d[_0x636c('0x23')]);if(_0xb20e0d[_0x636c('0x24')]){delete _0xb20e0d[_0x636c('0x24')];}_0x274c77[_0x636c('0x18')](_0x31c8e5)['send'](_0xb20e0d);};}exports['index']=function(_0x3fbeba,_0x1e84d8){var _0x3b07cc={},_0x3b243a={},_0x4ad72e={'count':0x0,'rows':[]};var _0x23178b=_[_0x636c('0x25')](db[_0x636c('0x26')][_0x636c('0x27')],function(_0x2c9e8f){return{'name':_0x2c9e8f['fieldName'],'type':_0x2c9e8f[_0x636c('0x28')][_0x636c('0x29')]};});_0x3b243a[_0x636c('0x2a')]=_[_0x636c('0x25')](_0x23178b,_0x636c('0x24'));_0x3b243a['query']=_[_0x636c('0x2b')](_0x3fbeba[_0x636c('0x2c')]);_0x3b243a['filters']=_[_0x636c('0x2d')](_0x3b243a['model'],_0x3b243a['query']);_0x3b07cc[_0x636c('0x2e')]=_[_0x636c('0x2d')](_0x3b243a['model'],qs[_0x636c('0x2f')](_0x3fbeba[_0x636c('0x2c')]['fields']));_0x3b07cc[_0x636c('0x2e')]=_0x3b07cc[_0x636c('0x2e')][_0x636c('0x30')]?_0x3b07cc[_0x636c('0x2e')]:_0x3b243a[_0x636c('0x2a')];if(!_0x3fbeba[_0x636c('0x2c')][_0x636c('0x31')](_0x636c('0x32'))){_0x3b07cc[_0x636c('0x33')]=qs[_0x636c('0x33')](_0x3fbeba[_0x636c('0x2c')]['limit']);_0x3b07cc[_0x636c('0x1a')]=qs[_0x636c('0x1a')](_0x3fbeba[_0x636c('0x2c')][_0x636c('0x1a')]);}_0x3b07cc[_0x636c('0x34')]=qs[_0x636c('0x35')](_0x3fbeba[_0x636c('0x2c')][_0x636c('0x35')]);_0x3b07cc['where']=qs[_0x636c('0x36')](_[_0x636c('0x37')](_0x3fbeba[_0x636c('0x2c')],_0x3b243a[_0x636c('0x36')]),_0x23178b);if(_0x3fbeba['query'][_0x636c('0x38')]){_0x3b07cc[_0x636c('0x39')]=_[_0x636c('0x3a')](_0x3b07cc[_0x636c('0x39')],{'$or':_['map'](_0x23178b,function(_0xd1b28e){if(_0xd1b28e[_0x636c('0x28')]!=='VIRTUAL'){var _0x182047={};_0x182047[_0xd1b28e[_0x636c('0x24')]]={'$like':'%'+_0x3fbeba[_0x636c('0x2c')][_0x636c('0x38')]+'%'};return _0x182047;}})});}_0x3b07cc=_[_0x636c('0x3a')]({},_0x3b07cc,_0x3fbeba[_0x636c('0x3b')]);var _0x3277cd={'where':_0x3b07cc[_0x636c('0x39')]};return db[_0x636c('0x26')][_0x636c('0x19')](_0x3277cd)['then'](function(_0x3707a8){_0x4ad72e['count']=_0x3707a8;if(_0x3fbeba[_0x636c('0x2c')][_0x636c('0x3c')]){_0x3b07cc[_0x636c('0x3d')]=[{'all':!![]}];}return db[_0x636c('0x26')]['findAll'](_0x3b07cc);})[_0x636c('0x1f')](function(_0x1e375c){_0x4ad72e['rows']=_0x1e375c;return _0x4ad72e;})[_0x636c('0x1f')](respondWithFilteredResult(_0x1e84d8,_0x3b07cc))[_0x636c('0x3e')](handleError(_0x1e84d8,null));};exports['show']=function(_0x58d83b,_0x22aba5){var _0x4b1878={'raw':!![],'where':{'id':_0x58d83b[_0x636c('0x3f')]['id']}},_0x5c0ea5={};_0x5c0ea5[_0x636c('0x2a')]=_[_0x636c('0x2b')](db[_0x636c('0x26')][_0x636c('0x27')]);_0x5c0ea5['query']=_['keys'](_0x58d83b[_0x636c('0x2c')]);_0x5c0ea5[_0x636c('0x36')]=_[_0x636c('0x2d')](_0x5c0ea5['model'],_0x5c0ea5['query']);_0x4b1878[_0x636c('0x2e')]=_[_0x636c('0x2d')](_0x5c0ea5[_0x636c('0x2a')],qs[_0x636c('0x2f')](_0x58d83b['query']['fields']));_0x4b1878[_0x636c('0x2e')]=_0x4b1878[_0x636c('0x2e')][_0x636c('0x30')]?_0x4b1878[_0x636c('0x2e')]:_0x5c0ea5['model'];if(_0x58d83b[_0x636c('0x2c')][_0x636c('0x3c')]){_0x4b1878[_0x636c('0x3d')]=[{'all':!![]}];}_0x4b1878=_[_0x636c('0x3a')]({},_0x4b1878,_0x58d83b[_0x636c('0x3b')]);return db[_0x636c('0x26')]['find'](_0x4b1878)[_0x636c('0x1f')](handleEntityNotFound(_0x22aba5,null))['then'](respondWithResult(_0x22aba5,null))[_0x636c('0x3e')](handleError(_0x22aba5,null));};exports['create']=function(_0x2a4250,_0x540528){return db[_0x636c('0x26')]['create'](_0x2a4250[_0x636c('0x40')],{})[_0x636c('0x1f')](respondWithResult(_0x540528,0xc9))[_0x636c('0x3e')](handleError(_0x540528,null));};exports[_0x636c('0x1e')]=function(_0x41b1ed,_0x1b9723){if(_0x41b1ed[_0x636c('0x40')]['id']){delete _0x41b1ed['body']['id'];}return db[_0x636c('0x26')][_0x636c('0x41')]({'where':{'id':_0x41b1ed[_0x636c('0x3f')]['id']}})[_0x636c('0x1f')](handleEntityNotFound(_0x1b9723,null))['then'](saveUpdates(_0x41b1ed['body'],null))['then'](respondWithResult(_0x1b9723,null))[_0x636c('0x3e')](handleError(_0x1b9723,null));};exports[_0x636c('0x20')]=function(_0x473c93,_0x4ffdb7){return db[_0x636c('0x26')][_0x636c('0x41')]({'where':{'id':_0x473c93[_0x636c('0x3f')]['id']}})[_0x636c('0x1f')](handleEntityNotFound(_0x4ffdb7,null))[_0x636c('0x1f')](removeEntity(_0x4ffdb7,null))[_0x636c('0x3e')](handleError(_0x4ffdb7,null));};exports[_0x636c('0x42')]=function(_0xa102c4,_0x40f048){return db['ChatQueueReport'][_0x636c('0x42')]()['then'](respondWithResult(_0x40f048,null))[_0x636c('0x3e')](handleError(_0x40f048,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2ff6109..5e5805f 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 _0xada5=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue'];(function(_0x4116fe,_0x1d04ad){var _0xc7ba30=function(_0x58e560){while(--_0x58e560){_0x4116fe['push'](_0x4116fe['shift']());}};_0xc7ba30(++_0x1d04ad);}(_0xada5,0x196));var _0x5ada=function(_0x2fed61,_0x4a6726){_0x2fed61=_0x2fed61-0x0;var _0x5a1924=_0xada5[_0x2fed61];return _0x5a1924;};'use strict';var _=require(_0x5ada('0x0'));var util=require(_0x5ada('0x1'));var logger=require(_0x5ada('0x2'))('api');var moment=require(_0x5ada('0x3'));var BPromise=require(_0x5ada('0x4'));var rp=require(_0x5ada('0x5'));var fs=require('fs');var path=require(_0x5ada('0x6'));var rimraf=require(_0x5ada('0x7'));var config=require(_0x5ada('0x8'));var attributes=require(_0x5ada('0x9'));module[_0x5ada('0xa')]=function(_0x361d0f,_0x186dfd){return _0x361d0f[_0x5ada('0xb')](_0x5ada('0xc'),attributes,{'tableName':_0x5ada('0xd'),'paranoid':![],'indexes':[{'name':_0x5ada('0xe'),'fields':[_0x5ada('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac2c=['report_chat_queue','uniqueid','lodash','util','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xac2c,0x12e));var _0xcac2=function(_0x4ef721,_0x1513f3){_0x4ef721=_0x4ef721-0x0;var _0x1b035e=_0xac2c[_0x4ef721];return _0x1b035e;};'use strict';var _=require(_0xcac2('0x0'));var util=require(_0xcac2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcac2('0x2'));var BPromise=require('bluebird');var rp=require(_0xcac2('0x3'));var fs=require('fs');var path=require(_0xcac2('0x4'));var rimraf=require(_0xcac2('0x5'));var config=require(_0xcac2('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x2cef13,_0x2f7c22){return _0x2cef13[_0xcac2('0x7')]('ChatQueueReport',attributes,{'tableName':_0xcac2('0x8'),'paranoid':![],'indexes':[{'name':_0xcac2('0x9'),'fields':[_0xcac2('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index c014d38..5aa7061 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 _0x6111=['UpdateChatQueueReport','update','body','raw','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','options','debug'];(function(_0x132c72,_0x45663f){var _0x12007d=function(_0xb3314b){while(--_0xb3314b){_0x132c72['push'](_0x132c72['shift']());}};_0x12007d(++_0x45663f);}(_0x6111,0x113));var _0x1611=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6111[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x1611('0x0'));var moment=require(_0x1611('0x1'));var BPromise=require(_0x1611('0x2'));var rs=require(_0x1611('0x3'));var fs=require('fs');var Redis=require(_0x1611('0x4'));var db=require(_0x1611('0x5'))['db'];var utils=require(_0x1611('0x6'));var logger=require(_0x1611('0x7'))(_0x1611('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1611('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31a919,_0x589559,_0x35b5b7){return new BPromise(function(_0x5a38ae,_0x393c94){return client['request'](_0x31a919,_0x35b5b7)[_0x1611('0xa')](function(_0x5bb1a8){logger[_0x1611('0xb')](_0x1611('0xc'),_0x589559,_0x1611('0xd'));logger['debug'](_0x1611('0xe'),_0x589559,'request\x20sent',JSON[_0x1611('0xf')](_0x5bb1a8));if(_0x5bb1a8[_0x1611('0x10')]){if(_0x5bb1a8['error'][_0x1611('0x11')]===0x1f4){logger[_0x1611('0x10')](_0x1611('0xc'),_0x589559,_0x5bb1a8[_0x1611('0x10')][_0x1611('0x12')]);return _0x393c94(_0x5bb1a8[_0x1611('0x10')][_0x1611('0x12')]);}logger[_0x1611('0x10')](_0x1611('0xc'),_0x589559,_0x5bb1a8[_0x1611('0x10')][_0x1611('0x12')]);return _0x5a38ae(_0x5bb1a8['error'][_0x1611('0x12')]);}else{logger[_0x1611('0xb')](_0x1611('0xc'),_0x589559,_0x1611('0xd'));_0x5a38ae(_0x5bb1a8[_0x1611('0x13')][_0x1611('0x12')]);}})[_0x1611('0x14')](function(_0x1e979c){logger[_0x1611('0x10')](_0x1611('0xc'),_0x589559,_0x1e979c);_0x393c94(_0x1e979c);});});}exports[_0x1611('0x15')]=function(_0x5b3df0){var _0x220ddb=this;return new Promise(function(_0x115f27,_0x67cb0){return db[_0x1611('0x16')]['create'](_0x5b3df0['body'],{'raw':_0x5b3df0[_0x1611('0x17')]?_0x5b3df0[_0x1611('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x1611('0xa')](function(_0x9b0ec3){logger[_0x1611('0xb')](_0x1611('0x15'),_0x5b3df0);logger[_0x1611('0x18')](_0x1611('0x15'),_0x5b3df0,JSON[_0x1611('0xf')](_0x9b0ec3));_0x115f27(_0x9b0ec3);})[_0x1611('0x14')](function(_0x315657){logger[_0x1611('0x10')](_0x1611('0x15'),_0x315657[_0x1611('0x12')],_0x5b3df0);_0x67cb0(_0x220ddb[_0x1611('0x10')](0x1f4,_0x315657[_0x1611('0x12')]));});});};exports[_0x1611('0x19')]=function(_0x176b80){var _0x31ab44=this;return new Promise(function(_0x4afe10,_0x3d1216){return db[_0x1611('0x16')][_0x1611('0x1a')](_0x176b80[_0x1611('0x1b')],{'raw':_0x176b80[_0x1611('0x17')]?_0x176b80[_0x1611('0x17')][_0x1611('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x176b80[_0x1611('0x17')]?_0x176b80[_0x1611('0x17')]['where']||null:null,'attributes':_0x176b80[_0x1611('0x17')]?_0x176b80[_0x1611('0x17')][_0x1611('0x1d')]||null:null,'limit':_0x176b80[_0x1611('0x17')]?_0x176b80[_0x1611('0x17')]['limit']||null:null})[_0x1611('0xa')](function(_0x3f5d78){logger[_0x1611('0xb')](_0x1611('0x19'),_0x176b80);logger[_0x1611('0x18')]('UpdateChatQueueReport',_0x176b80,JSON['stringify'](_0x3f5d78));_0x4afe10(_0x3f5d78);})[_0x1611('0x14')](function(_0x61f45){logger[_0x1611('0x10')](_0x1611('0x19'),_0x61f45[_0x1611('0x12')],_0x176b80);_0x3d1216(_0x31ab44[_0x1611('0x10')](0x1f4,_0x61f45[_0x1611('0x12')]));});});}; \ No newline at end of file +var _0x6581=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','catch','UpdateChatQueueReport','update','where','attributes','limit','then','lodash'];(function(_0x3c7596,_0x125653){var _0x59f78c=function(_0x1bebfd){while(--_0x1bebfd){_0x3c7596['push'](_0x3c7596['shift']());}};_0x59f78c(++_0x125653);}(_0x6581,0x68));var _0x1658=function(_0x30faad,_0x12ef7c){_0x30faad=_0x30faad-0x0;var _0xdbbf39=_0x6581[_0x30faad];return _0xdbbf39;};'use strict';var _=require(_0x1658('0x0'));var util=require('util');var moment=require(_0x1658('0x1'));var BPromise=require(_0x1658('0x2'));var rs=require(_0x1658('0x3'));var fs=require('fs');var Redis=require(_0x1658('0x4'));var db=require(_0x1658('0x5'))['db'];var utils=require(_0x1658('0x6'));var logger=require('../../config/logger')(_0x1658('0x7'));var config=require('../../config/environment');var jayson=require(_0x1658('0x8'));var client=jayson[_0x1658('0x9')][_0x1658('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bac5d,_0xbc43b1,_0x2d7e8a){return new BPromise(function(_0x4ece6b,_0x22b465){return client[_0x1658('0xb')](_0x3bac5d,_0x2d7e8a)['then'](function(_0x5b8596){logger[_0x1658('0xc')](_0x1658('0xd'),_0xbc43b1,_0x1658('0xe'));logger[_0x1658('0xf')](_0x1658('0x10'),_0xbc43b1,_0x1658('0xe'),JSON[_0x1658('0x11')](_0x5b8596));if(_0x5b8596['error']){if(_0x5b8596[_0x1658('0x12')][_0x1658('0x13')]===0x1f4){logger[_0x1658('0x12')](_0x1658('0xd'),_0xbc43b1,_0x5b8596['error'][_0x1658('0x14')]);return _0x22b465(_0x5b8596[_0x1658('0x12')][_0x1658('0x14')]);}logger['error'](_0x1658('0xd'),_0xbc43b1,_0x5b8596['error'][_0x1658('0x14')]);return _0x4ece6b(_0x5b8596[_0x1658('0x12')]['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0xbc43b1,_0x1658('0xe'));_0x4ece6b(_0x5b8596[_0x1658('0x15')]['message']);}})['catch'](function(_0x2d0145){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0xbc43b1,_0x2d0145);_0x22b465(_0x2d0145);});});}exports[_0x1658('0x16')]=function(_0x275eaf){var _0x2a203a=this;return new Promise(function(_0xc61be2,_0x233ed5){return db[_0x1658('0x17')][_0x1658('0x18')](_0x275eaf[_0x1658('0x19')],{'raw':_0x275eaf[_0x1658('0x1a')]?_0x275eaf[_0x1658('0x1a')][_0x1658('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x21622b){logger[_0x1658('0xc')](_0x1658('0x16'),_0x275eaf);logger[_0x1658('0xf')](_0x1658('0x16'),_0x275eaf,JSON[_0x1658('0x11')](_0x21622b));_0xc61be2(_0x21622b);})[_0x1658('0x1c')](function(_0x272a1a){logger['error'](_0x1658('0x16'),_0x272a1a[_0x1658('0x14')],_0x275eaf);_0x233ed5(_0x2a203a[_0x1658('0x12')](0x1f4,_0x272a1a[_0x1658('0x14')]));});});};exports[_0x1658('0x1d')]=function(_0x5cd015){var _0x2b2e18=this;return new Promise(function(_0x242cf1,_0x2f2c23){return db[_0x1658('0x17')][_0x1658('0x1e')](_0x5cd015[_0x1658('0x19')],{'raw':_0x5cd015['options']?_0x5cd015[_0x1658('0x1a')][_0x1658('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cd015[_0x1658('0x1a')]?_0x5cd015['options'][_0x1658('0x1f')]||null:null,'attributes':_0x5cd015['options']?_0x5cd015[_0x1658('0x1a')][_0x1658('0x20')]||null:null,'limit':_0x5cd015[_0x1658('0x1a')]?_0x5cd015[_0x1658('0x1a')][_0x1658('0x21')]||null:null})[_0x1658('0x22')](function(_0x2ebf28){logger[_0x1658('0xc')](_0x1658('0x1d'),_0x5cd015);logger[_0x1658('0xf')]('UpdateChatQueueReport',_0x5cd015,JSON['stringify'](_0x2ebf28));_0x242cf1(_0x2ebf28);})[_0x1658('0x1c')](function(_0x58bc75){logger[_0x1658('0x12')]('UpdateChatQueueReport',_0x58bc75[_0x1658('0x14')],_0x5cd015);_0x2f2c23(_0x2b2e18[_0x1658('0x12')](0x1f4,_0x58bc75['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 139d4ac..bb80625 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 _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x505191,_0x67997){var _0x4feed8=function(_0x3f928c){while(--_0x3f928c){_0x505191['push'](_0x505191['shift']());}};_0x4feed8(++_0x67997);}(_0x7a54,0x106));var _0x47a5=function(_0x3c3dc7,_0x4c82e9){_0x3c3dc7=_0x3c3dc7-0x0;var _0x211aa7=_0x7a54[_0x3c3dc7];return _0x211aa7;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','delete','exports'];(function(_0x4e231f,_0x315a9e){var _0x43a501=function(_0x58bdbb){while(--_0x58bdbb){_0x4e231f['push'](_0x4e231f['shift']());}};_0x43a501(++_0x315a9e);}(_0x326f,0xd1));var _0xf326=function(_0x2136cb,_0xc8d720){_0x2136cb=_0x2136cb-0x0;var _0x4fdf43=_0x326f[_0x2136cb];return _0x4fdf43;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 6e17ca7..1360a3b 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 _0xdc5f=['moment','sequelize','exports','STRING','account','agent','queue','DATE','NOW'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xdc5f,0xfc));var _0xfdc5=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xdc5f[_0x297fd3];return _0x2af381;};'use strict';var moment=require(_0xfdc5('0x0'));var Sequelize=require(_0xfdc5('0x1'));module[_0xfdc5('0x2')]={'uniqueid':{'type':Sequelize[_0xfdc5('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfdc5('0x4'),_0xfdc5('0x5'),_0xfdc5('0x6')),'allowNull':![],'defaultValue':_0xfdc5('0x6')},'transferredAt':{'type':Sequelize[_0xfdc5('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xfdc5('0x8')]}}; \ No newline at end of file +var _0x3231=['queue','DATE','NOW','moment','exports','STRING','ENUM','account','agent'];(function(_0x1aec54,_0x135f3f){var _0x4dc95d=function(_0x2a8e0f){while(--_0x2a8e0f){_0x1aec54['push'](_0x1aec54['shift']());}};_0x4dc95d(++_0x135f3f);}(_0x3231,0x150));var _0x1323=function(_0x3028d2,_0x1f4819){_0x3028d2=_0x3028d2-0x0;var _0x245f79=_0x3231[_0x3028d2];return _0x245f79;};'use strict';var moment=require(_0x1323('0x0'));var Sequelize=require('sequelize');module[_0x1323('0x1')]={'uniqueid':{'type':Sequelize[_0x1323('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1323('0x3')](_0x1323('0x4'),_0x1323('0x5'),_0x1323('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x1323('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x1323('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 37cbc3e..ea83e0d 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 _0xd23e=['includeAll','rows','catch','show','include','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','map','ChatTransferReport','fieldName','key','model','keys','filters','intersection','fields','query','attributes','length','order','sort','where','type','VIRTUAL'];(function(_0xd064b3,_0x53b2ed){var _0x1df7be=function(_0x33523c){while(--_0x33523c){_0xd064b3['push'](_0xd064b3['shift']());}};_0x1df7be(++_0x53b2ed);}(_0xd23e,0x99));var _0xed23=function(_0x2ceb31,_0x40ecf1){_0x2ceb31=_0x2ceb31-0x0;var _0x168859=_0xd23e[_0x2ceb31];return _0x168859;};'use strict';var pdf=require(_0xed23('0x0'));var emlformat=require(_0xed23('0x1'));var rimraf=require(_0xed23('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xed23('0x3'));var moment=require(_0xed23('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed23('0x5'));var util=require(_0xed23('0x6'));var path=require(_0xed23('0x7'));var sox=require('sox');var csv=require(_0xed23('0x8'));var ejs=require(_0xed23('0x9'));var fs=require('fs');var fs_extra=require(_0xed23('0xa'));var _=require(_0xed23('0xb'));var squel=require(_0xed23('0xc'));var crypto=require(_0xed23('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed23('0xe'));var Papa=require(_0xed23('0xf'));var Redis=require(_0xed23('0x10'));var authService=require(_0xed23('0x11'));var qs=require(_0xed23('0x12'));var as=require(_0xed23('0x13'));var hardwareService=require(_0xed23('0x14'));var logger=require(_0xed23('0x15'))(_0xed23('0x16'));var utils=require(_0xed23('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xed23('0x18'));var db=require(_0xed23('0x19'))['db'];function respondWithStatusCode(_0xf07d6,_0x2fabaf){_0x2fabaf=_0x2fabaf||0xcc;return function(_0x38594a){if(_0x38594a){return _0xf07d6[_0xed23('0x1a')](_0x2fabaf);}return _0xf07d6[_0xed23('0x1b')](_0x2fabaf)[_0xed23('0x1c')]();};}function respondWithResult(_0x5a8530,_0x377e17){_0x377e17=_0x377e17||0xc8;return function(_0x13f358){if(_0x13f358){return _0x5a8530[_0xed23('0x1b')](_0x377e17)[_0xed23('0x1d')](_0x13f358);}};}function respondWithFilteredResult(_0x2fec16,_0x4d0bae){return function(_0x36dfb2){if(_0x36dfb2){var _0x4060e6=_0x36dfb2[_0xed23('0x1e')],_0xabd182=_0x4d0bae[_0xed23('0x1f')],_0x18589a=_0x4d0bae[_0xed23('0x1f')]+_0x4d0bae[_0xed23('0x20')],_0x37568a;if(_0x18589a>=_0x4060e6){_0x18589a=_0x4060e6;_0x37568a=0xc8;}else{_0x37568a=0xce;}_0x2fec16[_0xed23('0x1b')](_0x37568a);return _0x2fec16[_0xed23('0x21')](_0xed23('0x22'),_0xabd182+'-'+_0x18589a+'/'+_0x4060e6)['json'](_0x36dfb2);}return null;};}function patchUpdates(_0x5b6848){return function(_0x234365){try{jsonpatch[_0xed23('0x23')](_0x234365,_0x5b6848,!![]);}catch(_0x50bc22){return BPromise[_0xed23('0x24')](_0x50bc22);}return _0x234365['save']();};}function saveUpdates(_0x5d4c50,_0x46405c){return function(_0x21ac70){if(_0x21ac70){return _0x21ac70[_0xed23('0x25')](_0x5d4c50)[_0xed23('0x26')](function(_0x21abe0){return _0x21abe0;});}return null;};}function removeEntity(_0x195457,_0x94ed09){return function(_0x489b2b){if(_0x489b2b){return _0x489b2b[_0xed23('0x27')]()[_0xed23('0x26')](function(){_0x195457[_0xed23('0x1b')](0xcc)[_0xed23('0x1c')]();});}};}function handleEntityNotFound(_0x4b230a,_0x1af35a){return function(_0x3ffef7){if(!_0x3ffef7){_0x4b230a['sendStatus'](0x194);}return _0x3ffef7;};}function handleError(_0x2753ae,_0x2f65c0){_0x2f65c0=_0x2f65c0||0x1f4;return function(_0xf616f7){logger[_0xed23('0x28')](_0xf616f7[_0xed23('0x29')]);if(_0xf616f7[_0xed23('0x2a')]){delete _0xf616f7['name'];}_0x2753ae[_0xed23('0x1b')](_0x2f65c0)['send'](_0xf616f7);};}exports['index']=function(_0x233934,_0x5e5796){var _0x569859={},_0x1e2b74={},_0x4d3284={'count':0x0,'rows':[]};var _0x22dd31=_[_0xed23('0x2b')](db[_0xed23('0x2c')]['rawAttributes'],function(_0x164a17){return{'name':_0x164a17[_0xed23('0x2d')],'type':_0x164a17['type'][_0xed23('0x2e')]};});_0x1e2b74[_0xed23('0x2f')]=_['map'](_0x22dd31,_0xed23('0x2a'));_0x1e2b74['query']=_[_0xed23('0x30')](_0x233934['query']);_0x1e2b74[_0xed23('0x31')]=_[_0xed23('0x32')](_0x1e2b74[_0xed23('0x2f')],_0x1e2b74['query']);_0x569859['attributes']=_[_0xed23('0x32')](_0x1e2b74[_0xed23('0x2f')],qs[_0xed23('0x33')](_0x233934[_0xed23('0x34')][_0xed23('0x33')]));_0x569859[_0xed23('0x35')]=_0x569859[_0xed23('0x35')][_0xed23('0x36')]?_0x569859[_0xed23('0x35')]:_0x1e2b74['model'];if(!_0x233934[_0xed23('0x34')]['hasOwnProperty']('nolimit')){_0x569859['limit']=qs[_0xed23('0x20')](_0x233934[_0xed23('0x34')][_0xed23('0x20')]);_0x569859[_0xed23('0x1f')]=qs['offset'](_0x233934[_0xed23('0x34')][_0xed23('0x1f')]);}_0x569859[_0xed23('0x37')]=qs[_0xed23('0x38')](_0x233934[_0xed23('0x34')]['sort']);_0x569859[_0xed23('0x39')]=qs[_0xed23('0x31')](_['pick'](_0x233934['query'],_0x1e2b74[_0xed23('0x31')]),_0x22dd31);if(_0x233934['query']['filter']){_0x569859['where']=_['merge'](_0x569859[_0xed23('0x39')],{'$or':_[_0xed23('0x2b')](_0x22dd31,function(_0x4212db){if(_0x4212db[_0xed23('0x3a')]!==_0xed23('0x3b')){var _0x35df53={};_0x35df53[_0x4212db['name']]={'$like':'%'+_0x233934[_0xed23('0x34')]['filter']+'%'};return _0x35df53;}})});}_0x569859=_['merge']({},_0x569859,_0x233934['options']);var _0x1efacb={'where':_0x569859[_0xed23('0x39')]};return db[_0xed23('0x2c')][_0xed23('0x1e')](_0x1efacb)['then'](function(_0x1fc2df){_0x4d3284[_0xed23('0x1e')]=_0x1fc2df;if(_0x233934[_0xed23('0x34')][_0xed23('0x3c')]){_0x569859['include']=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x569859);})[_0xed23('0x26')](function(_0x11f3c3){_0x4d3284[_0xed23('0x3d')]=_0x11f3c3;return _0x4d3284;})[_0xed23('0x26')](respondWithFilteredResult(_0x5e5796,_0x569859))[_0xed23('0x3e')](handleError(_0x5e5796,null));};exports[_0xed23('0x3f')]=function(_0x1ac0d2,_0x2f68dc){var _0x1f1bce={'raw':!![],'where':{'id':_0x1ac0d2['params']['id']}},_0x4b6bdc={};_0x4b6bdc[_0xed23('0x2f')]=_[_0xed23('0x30')](db[_0xed23('0x2c')]['rawAttributes']);_0x4b6bdc[_0xed23('0x34')]=_['keys'](_0x1ac0d2[_0xed23('0x34')]);_0x4b6bdc[_0xed23('0x31')]=_['intersection'](_0x4b6bdc[_0xed23('0x2f')],_0x4b6bdc[_0xed23('0x34')]);_0x1f1bce[_0xed23('0x35')]=_[_0xed23('0x32')](_0x4b6bdc[_0xed23('0x2f')],qs[_0xed23('0x33')](_0x1ac0d2[_0xed23('0x34')]['fields']));_0x1f1bce[_0xed23('0x35')]=_0x1f1bce[_0xed23('0x35')][_0xed23('0x36')]?_0x1f1bce[_0xed23('0x35')]:_0x4b6bdc[_0xed23('0x2f')];if(_0x1ac0d2[_0xed23('0x34')]['includeAll']){_0x1f1bce[_0xed23('0x40')]=[{'all':!![]}];}_0x1f1bce=_['merge']({},_0x1f1bce,_0x1ac0d2[_0xed23('0x41')]);return db['ChatTransferReport'][_0xed23('0x42')](_0x1f1bce)[_0xed23('0x26')](handleEntityNotFound(_0x2f68dc,null))['then'](respondWithResult(_0x2f68dc,null))[_0xed23('0x3e')](handleError(_0x2f68dc,null));};exports[_0xed23('0x43')]=function(_0x2e8bd7,_0x974b35){return db[_0xed23('0x2c')][_0xed23('0x43')](_0x2e8bd7[_0xed23('0x44')],{})['then'](respondWithResult(_0x974b35,0xc9))['catch'](handleError(_0x974b35,null));};exports['update']=function(_0x2b50cc,_0xfd2fd9){if(_0x2b50cc[_0xed23('0x44')]['id']){delete _0x2b50cc['body']['id'];}return db['ChatTransferReport'][_0xed23('0x42')]({'where':{'id':_0x2b50cc['params']['id']}})[_0xed23('0x26')](handleEntityNotFound(_0xfd2fd9,null))[_0xed23('0x26')](saveUpdates(_0x2b50cc[_0xed23('0x44')],null))['then'](respondWithResult(_0xfd2fd9,null))['catch'](handleError(_0xfd2fd9,null));};exports[_0xed23('0x27')]=function(_0x4ea197,_0x4379c4){return db[_0xed23('0x2c')][_0xed23('0x42')]({'where':{'id':_0x4ea197[_0xed23('0x45')]['id']}})[_0xed23('0x26')](handleEntityNotFound(_0x4379c4,null))[_0xed23('0x26')](removeEntity(_0x4379c4,null))['catch'](handleError(_0x4379c4,null));};exports[_0xed23('0x46')]=function(_0x66c169,_0x2f2af1){return db['ChatTransferReport'][_0xed23('0x46')]()[_0xed23('0x26')](respondWithResult(_0x2f2af1,null))[_0xed23('0x3e')](handleError(_0x2f2af1,null));}; \ No newline at end of file +var _0x8c89=['rows','catch','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x8c89,0x1f1));var _0x98c8=function(_0x5f2f86,_0x1a97ed){_0x5f2f86=_0x5f2f86-0x0;var _0x45aeef=_0x8c89[_0x5f2f86];return _0x45aeef;};'use strict';var pdf=require(_0x98c8('0x0'));var emlformat=require(_0x98c8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x98c8('0x2'));var jsonpatch=require(_0x98c8('0x3'));var rp=require(_0x98c8('0x4'));var moment=require(_0x98c8('0x5'));var BPromise=require(_0x98c8('0x6'));var Mustache=require(_0x98c8('0x7'));var util=require('util');var path=require(_0x98c8('0x8'));var sox=require('sox');var csv=require(_0x98c8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98c8('0xa'));var _=require(_0x98c8('0xb'));var squel=require(_0x98c8('0xc'));var crypto=require(_0x98c8('0xd'));var jsforce=require(_0x98c8('0xe'));var deskjs=require(_0x98c8('0xf'));var toCsv=require(_0x98c8('0x9'));var querystring=require('querystring');var Papa=require(_0x98c8('0x10'));var Redis=require('ioredis');var authService=require(_0x98c8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x98c8('0x12'));var hardwareService=require(_0x98c8('0x13'));var logger=require(_0x98c8('0x14'))('api');var utils=require(_0x98c8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x98c8('0x16'));var db=require(_0x98c8('0x17'))['db'];function respondWithStatusCode(_0x3e2ff0,_0xd71929){_0xd71929=_0xd71929||0xcc;return function(_0x3d5928){if(_0x3d5928){return _0x3e2ff0[_0x98c8('0x18')](_0xd71929);}return _0x3e2ff0[_0x98c8('0x19')](_0xd71929)[_0x98c8('0x1a')]();};}function respondWithResult(_0x72c5d6,_0x4e0cba){_0x4e0cba=_0x4e0cba||0xc8;return function(_0x2bae8d){if(_0x2bae8d){return _0x72c5d6['status'](_0x4e0cba)[_0x98c8('0x1b')](_0x2bae8d);}};}function respondWithFilteredResult(_0x39c9e9,_0x33b7be){return function(_0x460113){if(_0x460113){var _0x56bef6=_0x460113[_0x98c8('0x1c')],_0x2249ec=_0x33b7be[_0x98c8('0x1d')],_0x680c8e=_0x33b7be[_0x98c8('0x1d')]+_0x33b7be[_0x98c8('0x1e')],_0x12bb03;if(_0x680c8e>=_0x56bef6){_0x680c8e=_0x56bef6;_0x12bb03=0xc8;}else{_0x12bb03=0xce;}_0x39c9e9[_0x98c8('0x19')](_0x12bb03);return _0x39c9e9['set'](_0x98c8('0x1f'),_0x2249ec+'-'+_0x680c8e+'/'+_0x56bef6)[_0x98c8('0x1b')](_0x460113);}return null;};}function patchUpdates(_0x409477){return function(_0x33ea75){try{jsonpatch['apply'](_0x33ea75,_0x409477,!![]);}catch(_0x3234cc){return BPromise[_0x98c8('0x20')](_0x3234cc);}return _0x33ea75[_0x98c8('0x21')]();};}function saveUpdates(_0x20d0f2,_0x58cf27){return function(_0x54db79){if(_0x54db79){return _0x54db79[_0x98c8('0x22')](_0x20d0f2)[_0x98c8('0x23')](function(_0x3c0af2){return _0x3c0af2;});}return null;};}function removeEntity(_0x4bc1c2,_0x3f83d5){return function(_0x24c1de){if(_0x24c1de){return _0x24c1de[_0x98c8('0x24')]()[_0x98c8('0x23')](function(){_0x4bc1c2['status'](0xcc)[_0x98c8('0x1a')]();});}};}function handleEntityNotFound(_0x17f694,_0x585d24){return function(_0x327894){if(!_0x327894){_0x17f694[_0x98c8('0x18')](0x194);}return _0x327894;};}function handleError(_0x58434a,_0x289e0d){_0x289e0d=_0x289e0d||0x1f4;return function(_0x328808){logger[_0x98c8('0x25')](_0x328808[_0x98c8('0x26')]);if(_0x328808[_0x98c8('0x27')]){delete _0x328808[_0x98c8('0x27')];}_0x58434a[_0x98c8('0x19')](_0x289e0d)[_0x98c8('0x28')](_0x328808);};}exports[_0x98c8('0x29')]=function(_0x10fc78,_0x31f4ac){var _0x4b4b1a={},_0x46e7a6={},_0x329727={'count':0x0,'rows':[]};var _0xf097a4=_[_0x98c8('0x2a')](db[_0x98c8('0x2b')]['rawAttributes'],function(_0x2f22a1){return{'name':_0x2f22a1[_0x98c8('0x2c')],'type':_0x2f22a1[_0x98c8('0x2d')]['key']};});_0x46e7a6['model']=_[_0x98c8('0x2a')](_0xf097a4,_0x98c8('0x27'));_0x46e7a6[_0x98c8('0x2e')]=_[_0x98c8('0x2f')](_0x10fc78[_0x98c8('0x2e')]);_0x46e7a6[_0x98c8('0x30')]=_['intersection'](_0x46e7a6[_0x98c8('0x31')],_0x46e7a6['query']);_0x4b4b1a[_0x98c8('0x32')]=_[_0x98c8('0x33')](_0x46e7a6[_0x98c8('0x31')],qs[_0x98c8('0x34')](_0x10fc78['query'][_0x98c8('0x34')]));_0x4b4b1a[_0x98c8('0x32')]=_0x4b4b1a[_0x98c8('0x32')][_0x98c8('0x35')]?_0x4b4b1a[_0x98c8('0x32')]:_0x46e7a6[_0x98c8('0x31')];if(!_0x10fc78[_0x98c8('0x2e')]['hasOwnProperty']('nolimit')){_0x4b4b1a['limit']=qs[_0x98c8('0x1e')](_0x10fc78[_0x98c8('0x2e')][_0x98c8('0x1e')]);_0x4b4b1a[_0x98c8('0x1d')]=qs[_0x98c8('0x1d')](_0x10fc78[_0x98c8('0x2e')][_0x98c8('0x1d')]);}_0x4b4b1a[_0x98c8('0x36')]=qs[_0x98c8('0x37')](_0x10fc78[_0x98c8('0x2e')][_0x98c8('0x37')]);_0x4b4b1a[_0x98c8('0x38')]=qs['filters'](_[_0x98c8('0x39')](_0x10fc78[_0x98c8('0x2e')],_0x46e7a6[_0x98c8('0x30')]),_0xf097a4);if(_0x10fc78[_0x98c8('0x2e')][_0x98c8('0x3a')]){_0x4b4b1a[_0x98c8('0x38')]=_[_0x98c8('0x3b')](_0x4b4b1a[_0x98c8('0x38')],{'$or':_['map'](_0xf097a4,function(_0x2f9bb8){if(_0x2f9bb8[_0x98c8('0x2d')]!==_0x98c8('0x3c')){var _0x2bce24={};_0x2bce24[_0x2f9bb8['name']]={'$like':'%'+_0x10fc78[_0x98c8('0x2e')][_0x98c8('0x3a')]+'%'};return _0x2bce24;}})});}_0x4b4b1a=_['merge']({},_0x4b4b1a,_0x10fc78[_0x98c8('0x3d')]);var _0x2114cc={'where':_0x4b4b1a['where']};return db[_0x98c8('0x2b')][_0x98c8('0x1c')](_0x2114cc)[_0x98c8('0x23')](function(_0x24507e){_0x329727[_0x98c8('0x1c')]=_0x24507e;if(_0x10fc78['query']['includeAll']){_0x4b4b1a[_0x98c8('0x3e')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x4b4b1a);})[_0x98c8('0x23')](function(_0x99dee3){_0x329727[_0x98c8('0x3f')]=_0x99dee3;return _0x329727;})[_0x98c8('0x23')](respondWithFilteredResult(_0x31f4ac,_0x4b4b1a))[_0x98c8('0x40')](handleError(_0x31f4ac,null));};exports['show']=function(_0x36848f,_0x523b2f){var _0x2f93d1={'raw':!![],'where':{'id':_0x36848f[_0x98c8('0x41')]['id']}},_0x5e24c8={};_0x5e24c8[_0x98c8('0x31')]=_[_0x98c8('0x2f')](db[_0x98c8('0x2b')]['rawAttributes']);_0x5e24c8[_0x98c8('0x2e')]=_[_0x98c8('0x2f')](_0x36848f[_0x98c8('0x2e')]);_0x5e24c8['filters']=_['intersection'](_0x5e24c8[_0x98c8('0x31')],_0x5e24c8[_0x98c8('0x2e')]);_0x2f93d1[_0x98c8('0x32')]=_['intersection'](_0x5e24c8[_0x98c8('0x31')],qs[_0x98c8('0x34')](_0x36848f[_0x98c8('0x2e')][_0x98c8('0x34')]));_0x2f93d1[_0x98c8('0x32')]=_0x2f93d1[_0x98c8('0x32')][_0x98c8('0x35')]?_0x2f93d1[_0x98c8('0x32')]:_0x5e24c8[_0x98c8('0x31')];if(_0x36848f[_0x98c8('0x2e')]['includeAll']){_0x2f93d1[_0x98c8('0x3e')]=[{'all':!![]}];}_0x2f93d1=_['merge']({},_0x2f93d1,_0x36848f[_0x98c8('0x3d')]);return db['ChatTransferReport'][_0x98c8('0x42')](_0x2f93d1)[_0x98c8('0x23')](handleEntityNotFound(_0x523b2f,null))[_0x98c8('0x23')](respondWithResult(_0x523b2f,null))[_0x98c8('0x40')](handleError(_0x523b2f,null));};exports['create']=function(_0x143d1e,_0x39a6cf){return db[_0x98c8('0x2b')][_0x98c8('0x43')](_0x143d1e[_0x98c8('0x44')],{})[_0x98c8('0x23')](respondWithResult(_0x39a6cf,0xc9))[_0x98c8('0x40')](handleError(_0x39a6cf,null));};exports[_0x98c8('0x22')]=function(_0x5bfcc5,_0x54c8f5){if(_0x5bfcc5[_0x98c8('0x44')]['id']){delete _0x5bfcc5['body']['id'];}return db[_0x98c8('0x2b')][_0x98c8('0x42')]({'where':{'id':_0x5bfcc5[_0x98c8('0x41')]['id']}})[_0x98c8('0x23')](handleEntityNotFound(_0x54c8f5,null))[_0x98c8('0x23')](saveUpdates(_0x5bfcc5[_0x98c8('0x44')],null))[_0x98c8('0x23')](respondWithResult(_0x54c8f5,null))[_0x98c8('0x40')](handleError(_0x54c8f5,null));};exports[_0x98c8('0x24')]=function(_0x2eff14,_0x598259){return db[_0x98c8('0x2b')]['find']({'where':{'id':_0x2eff14['params']['id']}})[_0x98c8('0x23')](handleEntityNotFound(_0x598259,null))[_0x98c8('0x23')](removeEntity(_0x598259,null))['catch'](handleError(_0x598259,null));};exports['describe']=function(_0x4a235d,_0x2be12){return db[_0x98c8('0x2b')][_0x98c8('0x45')]()[_0x98c8('0x23')](respondWithResult(_0x2be12,null))[_0x98c8('0x40')](handleError(_0x2be12,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index a9f2a8a..a15f335 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 _0x9180=['api','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger'];(function(_0x1d7206,_0x551236){var _0x86f66=function(_0x1c82a0){while(--_0x1c82a0){_0x1d7206['push'](_0x1d7206['shift']());}};_0x86f66(++_0x551236);}(_0x9180,0xf5));var _0x0918=function(_0x5d5e85,_0x3e5533){_0x5d5e85=_0x5d5e85-0x0;var _0x119f3a=_0x9180[_0x5d5e85];return _0x119f3a;};'use strict';var _=require('lodash');var util=require(_0x0918('0x0'));var logger=require(_0x0918('0x1'))(_0x0918('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0918('0x3'));var fs=require('fs');var path=require(_0x0918('0x4'));var rimraf=require(_0x0918('0x5'));var config=require(_0x0918('0x6'));var attributes=require(_0x0918('0x7'));module[_0x0918('0x8')]=function(_0x23bf14,_0x4571d9){return _0x23bf14[_0x0918('0x9')](_0x0918('0xa'),attributes,{'tableName':_0x0918('0xb'),'paranoid':![],'indexes':[{'name':_0x0918('0xc'),'fields':[_0x0918('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe936=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x2b294d,_0x52cee9){var _0x43921a=function(_0x1fb272){while(--_0x1fb272){_0x2b294d['push'](_0x2b294d['shift']());}};_0x43921a(++_0x52cee9);}(_0xe936,0x157));var _0x6e93=function(_0x2874a5,_0x32b680){_0x2874a5=_0x2874a5-0x0;var _0x1e427a=_0xe936[_0x2874a5];return _0x1e427a;};'use strict';var _=require(_0x6e93('0x0'));var util=require(_0x6e93('0x1'));var logger=require(_0x6e93('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6e93('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e93('0x4'));var rimraf=require(_0x6e93('0x5'));var config=require('../../config/environment');var attributes=require(_0x6e93('0x6'));module['exports']=function(_0x1f60c4,_0x6fd512){return _0x1f60c4[_0x6e93('0x7')](_0x6e93('0x8'),attributes,{'tableName':_0x6e93('0x9'),'paranoid':![],'indexes':[{'name':_0x6e93('0xa'),'fields':[_0x6e93('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index f0157a8..4cad36f 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 _0x41bb=['jayson/promise','client','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5d9bca,_0x28d26f){var _0x22b41b=function(_0x425566){while(--_0x425566){_0x5d9bca['push'](_0x5d9bca['shift']());}};_0x22b41b(++_0x28d26f);}(_0x41bb,0x149));var _0xb41b=function(_0x3390c4,_0x4a23ca){_0x3390c4=_0x3390c4-0x0;var _0x214582=_0x41bb[_0x3390c4];return _0x214582;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require(_0xb41b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb41b('0x3'));var fs=require('fs');var Redis=require(_0xb41b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb41b('0x7'));var client=jayson[_0xb41b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a7c51,_0x23ca62,_0x3bcb4c){return new BPromise(function(_0x41e732,_0x4aabc4){return client['request'](_0x1a7c51,_0x3bcb4c)[_0xb41b('0x9')](function(_0x58f4ae){logger[_0xb41b('0xa')](_0xb41b('0xb'),_0x23ca62,_0xb41b('0xc'));logger[_0xb41b('0xd')](_0xb41b('0xe'),_0x23ca62,_0xb41b('0xc'),JSON[_0xb41b('0xf')](_0x58f4ae));if(_0x58f4ae['error']){if(_0x58f4ae[_0xb41b('0x10')][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')](_0xb41b('0xb'),_0x23ca62,_0x58f4ae[_0xb41b('0x10')][_0xb41b('0x12')]);return _0x4aabc4(_0x58f4ae[_0xb41b('0x10')][_0xb41b('0x12')]);}logger[_0xb41b('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x23ca62,_0x58f4ae[_0xb41b('0x10')][_0xb41b('0x12')]);return _0x41e732(_0x58f4ae[_0xb41b('0x10')]['message']);}else{logger[_0xb41b('0xa')](_0xb41b('0xb'),_0x23ca62,'request\x20sent');_0x41e732(_0x58f4ae[_0xb41b('0x13')][_0xb41b('0x12')]);}})[_0xb41b('0x14')](function(_0x613948){logger['error'](_0xb41b('0xb'),_0x23ca62,_0x613948);_0x4aabc4(_0x613948);});});} \ No newline at end of file +var _0x3688=['client','http','request','then','info','request\x20sent','debug','error','ChatTransferReport,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','../../config/logger','rpc','jayson/promise'];(function(_0x138b23,_0x31490f){var _0x1a5731=function(_0x4329dc){while(--_0x4329dc){_0x138b23['push'](_0x138b23['shift']());}};_0x1a5731(++_0x31490f);}(_0x3688,0x170));var _0x8368=function(_0x2a88a7,_0x34543c){_0x2a88a7=_0x2a88a7-0x0;var _0x498aab=_0x3688[_0x2a88a7];return _0x498aab;};'use strict';var _=require(_0x8368('0x0'));var util=require('util');var moment=require(_0x8368('0x1'));var BPromise=require(_0x8368('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8368('0x3'))(_0x8368('0x4'));var config=require('../../config/environment');var jayson=require(_0x8368('0x5'));var client=jayson[_0x8368('0x6')][_0x8368('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f15c7,_0x2ddccf,_0x2d8412){return new BPromise(function(_0x2024b3,_0x4b0881){return client[_0x8368('0x8')](_0x3f15c7,_0x2d8412)[_0x8368('0x9')](function(_0x2cfb89){logger[_0x8368('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x2ddccf,_0x8368('0xb'));logger[_0x8368('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2ddccf,_0x8368('0xb'),JSON['stringify'](_0x2cfb89));if(_0x2cfb89[_0x8368('0xd')]){if(_0x2cfb89[_0x8368('0xd')]['code']===0x1f4){logger[_0x8368('0xd')](_0x8368('0xe'),_0x2ddccf,_0x2cfb89[_0x8368('0xd')]['message']);return _0x4b0881(_0x2cfb89[_0x8368('0xd')][_0x8368('0xf')]);}logger[_0x8368('0xd')](_0x8368('0xe'),_0x2ddccf,_0x2cfb89[_0x8368('0xd')][_0x8368('0xf')]);return _0x2024b3(_0x2cfb89['error'][_0x8368('0xf')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x2ddccf,_0x8368('0xb'));_0x2024b3(_0x2cfb89['result'][_0x8368('0xf')]);}})[_0x8368('0x10')](function(_0x36b47a){logger[_0x8368('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x2ddccf,_0x36b47a);_0x4b0881(_0x36b47a);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 0021237..4568ffe 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 _0x6790=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','update','exports'];(function(_0x14f115,_0x13bf19){var _0x312445=function(_0x5dd850){while(--_0x5dd850){_0x14f115['push'](_0x14f115['shift']());}};_0x312445(++_0x13bf19);}(_0x6790,0x1ed));var _0x0679=function(_0x5a0408,_0x2084ce){_0x5a0408=_0x5a0408-0x0;var _0x410d6e=_0x6790[_0x5a0408];return _0x410d6e;};'use strict';var multer=require('multer');var util=require(_0x0679('0x0'));var path=require(_0x0679('0x1'));var timeout=require(_0x0679('0x2'));var express=require('express');var router=express[_0x0679('0x3')]();var fs_extra=require(_0x0679('0x4'));var auth=require(_0x0679('0x5'));var interaction=require(_0x0679('0x6'));var config=require('../../config/environment');var controller=require(_0x0679('0x7'));router[_0x0679('0x8')]('/',auth[_0x0679('0x9')](),controller[_0x0679('0xa')]);router[_0x0679('0x8')]('/describe',auth[_0x0679('0x9')](),controller[_0x0679('0xb')]);router[_0x0679('0x8')](_0x0679('0xc'),auth[_0x0679('0x9')](),controller['show']);router[_0x0679('0xd')]('/',auth[_0x0679('0x9')](),controller[_0x0679('0xe')]);router['put']('/:id',auth[_0x0679('0x9')](),controller[_0x0679('0xf')]);router['delete']('/:id',auth[_0x0679('0x9')](),controller['destroy']);module[_0x0679('0x10')]=router; \ No newline at end of file +var _0x9660=['isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9660,0x1f1));var _0x0966=function(_0x4307ff,_0x10ac51){_0x4307ff=_0x4307ff-0x0;var _0x4ed2fc=_0x9660[_0x4307ff];return _0x4ed2fc;};'use strict';var multer=require(_0x0966('0x0'));var util=require('util');var path=require(_0x0966('0x1'));var timeout=require(_0x0966('0x2'));var express=require(_0x0966('0x3'));var router=express['Router']();var fs_extra=require(_0x0966('0x4'));var auth=require(_0x0966('0x5'));var interaction=require(_0x0966('0x6'));var config=require(_0x0966('0x7'));var controller=require(_0x0966('0x8'));router['get']('/',auth[_0x0966('0x9')](),controller[_0x0966('0xa')]);router[_0x0966('0xb')](_0x0966('0xc'),auth[_0x0966('0x9')](),controller[_0x0966('0xd')]);router[_0x0966('0xb')]('/:id',auth[_0x0966('0x9')](),controller[_0x0966('0xe')]);router[_0x0966('0xf')]('/',auth[_0x0966('0x9')](),controller[_0x0966('0x10')]);router[_0x0966('0x11')](_0x0966('0x12'),auth[_0x0966('0x9')](),controller[_0x0966('0x13')]);router[_0x0966('0x14')]('/:id',auth[_0x0966('0x9')](),controller[_0x0966('0x15')]);module[_0x0966('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 7a67d22..98e713f 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 _0xee30=['parse','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Skip','Feedback','ENUM','thumb','star','input','name','text','getDataValue'];(function(_0x4b40ae,_0x2fc392){var _0x18c09e=function(_0x431060){while(--_0x431060){_0x4b40ae['push'](_0x4b40ae['shift']());}};_0x18c09e(++_0x2fc392);}(_0xee30,0xaa));var _0x0ee3=function(_0x49c539,_0x244204){_0x49c539=_0x49c539-0x0;var _0x3ab059=_0xee30[_0x49c539];return _0x3ab059;};'use strict';var Sequelize=require(_0x0ee3('0x0'));var rs=require(_0x0ee3('0x1'));module[_0x0ee3('0x2')]={'name':{'type':Sequelize[_0x0ee3('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x0ee3('0x3')],'allowNull':![],'unique':_0x0ee3('0x4')},'description':{'type':Sequelize[_0x0ee3('0x3')]},'mapKey':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x5')},'mapKeyOffline':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x6')},'customerAlias':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0ee3('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0ee3('0x3')],'allowNull':![],'defaultValue':_0x0ee3('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0ee3('0x3')],'allowNull':![],'defaultValue':_0x0ee3('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x0ee3('0xa'),_0x0ee3('0xb')),'defaultValue':_0x0ee3('0xa')},'header_online':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0xc')},'start_chat_button':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x0ee3('0xd')},'header_offline':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0ee3('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0ee3('0x10')]},'closingQuestion':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x13')},'noteTitle':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0ee3('0x14')},'closingMessage':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0xd')},'skipMessageButton':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x15')},'conditionAgreement':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0ee3('0x16')},'ratingType':{'type':Sequelize[_0x0ee3('0x17')]('star',_0x0ee3('0x18')),'defaultValue':_0x0ee3('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x0ee3('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0ee3('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x0ee3('0x1a'),'variable':null,'config':{'placeholder':_0x0ee3('0x1b'),'type':_0x0ee3('0x1c'),'required':!![]},'props':{'title':_0x0ee3('0x1b'),'helpText':''}},{'type':_0x0ee3('0x1a'),'props':{'title':_0x0ee3('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x0ee3('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0ee3('0x1d')]('onlineForm')?JSON[_0x0ee3('0x1e')](this[_0x0ee3('0x1d')](_0x0ee3('0x1f'))):{};},'set':function(_0xbf5d47){return this[_0x0ee3('0x20')](_0x0ee3('0x1f'),JSON[_0x0ee3('0x21')](_0xbf5d47));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x0ee3('0x21')]({'items':[{'type':_0x0ee3('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x0ee3('0x5'),'type':_0x0ee3('0x5')},'variable':null},{'type':_0x0ee3('0x22'),'config':{'placeholder':_0x0ee3('0x23')},'props':{'title':'Comments','helpText':_0x0ee3('0x24')}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0x0ee3('0x1e')](this['getDataValue']('offlineForm')):{};},'set':function(_0x41df05){return this[_0x0ee3('0x20')]('offlineForm',JSON['stringify'](_0x41df05));}},'token':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0ee3('0x3')]},'forwardOffline':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0ee3('0x3')]},'waitingTitle':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0ee3('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x0ee3('0x27')},'offlineMessageBody':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x28')},'skipUnmanaged':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x15')},'sendUnmanaged':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0ee3('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0ee3('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0ee3('0x10')],'defaultValue':function(){return _0x0ee3('0x29');}},'notificationSound':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x0ee3('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x2a')},'verticalAlignment':{'type':Sequelize[_0x0ee3('0xf')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x2b')},'defaultTitle':{'type':Sequelize[_0x0ee3('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0ee3('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0ee3('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0ee3('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x0ee3('0x2d')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0ee3('0xf')],'comment':_0x0ee3('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![],'comment':_0x0ee3('0x2f'),'set':function(_0x2954df){if(!_0x2954df)this['setDataValue'](_0x0ee3('0x30'),null);this[_0x0ee3('0x20')](_0x0ee3('0x31'),_0x2954df);}},'vidaooEscalation':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':![]},'openNewInteraction':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![],'allowNull':!![]}}; \ No newline at end of file +var _0x56c9=['BOOLEAN','ENUM','rounded','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','star','thumb','stringify','name','text','getDataValue','onlineForm','parse','setDataValue','input','textarea','Comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER'];(function(_0x30853f,_0x4aa320){var _0x3c416d=function(_0x15d3d2){while(--_0x15d3d2){_0x30853f['push'](_0x30853f['shift']());}};_0x3c416d(++_0x4aa320);}(_0x56c9,0x16f));var _0x956c=function(_0x14f16a,_0x3d025c){_0x14f16a=_0x14f16a-0x0;var _0x13a996=_0x56c9[_0x14f16a];return _0x13a996;};'use strict';var Sequelize=require(_0x956c('0x0'));var rs=require(_0x956c('0x1'));module[_0x956c('0x2')]={'name':{'type':Sequelize[_0x956c('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x956c('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x956c('0x3')]},'mapKey':{'type':Sequelize[_0x956c('0x3')],'defaultValue':_0x956c('0x4')},'mapKeyOffline':{'type':Sequelize[_0x956c('0x3')],'defaultValue':_0x956c('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x956c('0x3')],'defaultValue':_0x956c('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x956c('0x3')],'allowNull':![],'defaultValue':_0x956c('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x956c('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x956c('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x956c('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x956c('0x3')]},'animation':{'type':Sequelize[_0x956c('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x956c('0xa')](_0x956c('0xb'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x956c('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x956c('0x3')],'defaultValue':_0x956c('0xc')},'offline_chat_button':{'type':Sequelize[_0x956c('0x3')],'defaultValue':_0x956c('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x956c('0xe')},'download_transcript':{'type':Sequelize[_0x956c('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x956c('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x956c('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x956c('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x956c('0x10')]},'closingQuestion':{'type':Sequelize[_0x956c('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x956c('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x956c('0x11')},'noteTitle':{'type':Sequelize[_0x956c('0x3')],'defaultValue':_0x956c('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x956c('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x956c('0x3')],'defaultValue':_0x956c('0xd')},'skipMessageButton':{'type':Sequelize[_0x956c('0x3')],'defaultValue':_0x956c('0x14')},'conditionAgreement':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x956c('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x956c('0x15'),_0x956c('0x16')),'defaultValue':_0x956c('0x15')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x956c('0x17')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x956c('0x18'),'type':_0x956c('0x19'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0x956c('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x956c('0x4'),'type':_0x956c('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x956c('0x1a')](_0x956c('0x1b'))?JSON[_0x956c('0x1c')](this[_0x956c('0x1a')]('onlineForm')):{};},'set':function(_0x1416a7){return this[_0x956c('0x1d')]('onlineForm',JSON[_0x956c('0x17')](_0x1416a7));}},'offlineForm':{'type':Sequelize[_0x956c('0x10')],'defaultValue':function(){return JSON[_0x956c('0x17')]({'items':[{'type':_0x956c('0x1e'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x956c('0x4'),'type':_0x956c('0x4')},'variable':null},{'type':_0x956c('0x1f'),'config':{'placeholder':_0x956c('0x20')},'props':{'title':_0x956c('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x956c('0x1a')](_0x956c('0x21'))?JSON['parse'](this['getDataValue']('offlineForm')):{};},'set':function(_0x170a63){return this[_0x956c('0x1d')]('offlineForm',JSON['stringify'](_0x170a63));}},'token':{'type':Sequelize[_0x956c('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x956c('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x956c('0x3')]},'waitingTitle':{'type':Sequelize[_0x956c('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x956c('0x22')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x956c('0x23')},'offlineMessageBody':{'type':Sequelize[_0x956c('0x3')],'defaultValue':_0x956c('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x956c('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x956c('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x956c('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x956c('0x3')],'defaultValue':_0x956c('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x956c('0x10')],'defaultValue':function(){return _0x956c('0x25');}},'notificationSound':{'type':Sequelize[_0x956c('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x956c('0x3')],'defaultValue':_0x956c('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0x956c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x956c('0x3')],'defaultValue':_0x956c('0x27')},'verticalAlignment':{'type':Sequelize[_0x956c('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x956c('0x3')],'defaultValue':_0x956c('0x28')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x956c('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x956c('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x956c('0x3')],'allowNull':![],'defaultValue':_0x956c('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x956c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x956c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x956c('0x3')],'defaultValue':_0x956c('0x2a')},'systemAvatar':{'type':Sequelize[_0x956c('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x956c('0x8')],'comment':_0x956c('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![],'comment':_0x956c('0x2c'),'set':function(_0x1c0821){if(!_0x1c0821)this[_0x956c('0x1d')](_0x956c('0x2d'),null);this[_0x956c('0x1d')](_0x956c('0x2e'),_0x1c0821);}},'vidaooEscalation':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x956c('0x3')],'defaultValue':![]},'openNewInteraction':{'type':Sequelize[_0x956c('0x9')],'defaultValue':![],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index fd40e34..509d1b1 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 _0xfb21=['map','ChatWebsite','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','find','create','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','ChatWebsiteId','Disposition','getDispositions','findOne','rawAttributes','order','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sitepic','addAvatar','agentAvatar','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','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','server/files/images/avatars/system_avatar.png','notify','setUA','headers','getResult','chat','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','List','Contacts','Applications','account','applications','list','orderBy','asc','defaults','ListId','customerIp','cf-connecting-ip','x-forwarded-for','first','split','x-real-port','browser','version','format','%s\x20%s','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','firstName','lastName','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','email','from\x20is\x20mandatory','Comments','mapKeyOffline','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','bulkCreate','$promise','MailServerOut','service','host','Smtp','port','secure','authentication','SendMail','sendMail','forwardOfflineAddress','offlineMessageSubject','MailAccountId','Chat','NotifyMailAccount','notifyMail','attachments','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','Interval','../../config/license/util','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.js','remote','connection','remoteAddress','referer','replace','alignment','color_button','addApplications','sequelize','ChatApplication','findAndCountAll','priority','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Contact','Attachment','Attachments','rows','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','User','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','ChatWebsite,\x20%s,\x20%s','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause'];(function(_0x1d9ad5,_0xbb151a){var _0x318aa2=function(_0xd54381){while(--_0xd54381){_0x1d9ad5['push'](_0x1d9ad5['shift']());}};_0x318aa2(++_0xbb151a);}(_0xfb21,0xeb));var _0x1fb2=function(_0x362a1d,_0x5bd04f){_0x362a1d=_0x362a1d-0x0;var _0x53137f=_0xfb21[_0x362a1d];return _0x53137f;};'use strict';var pdf=require(_0x1fb2('0x0'));var emlformat=require(_0x1fb2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1fb2('0x2'));var rp=require(_0x1fb2('0x3'));var moment=require('moment');var BPromise=require(_0x1fb2('0x4'));var Mustache=require(_0x1fb2('0x5'));var util=require(_0x1fb2('0x6'));var path=require('path');var sox=require(_0x1fb2('0x7'));var csv=require('to-csv');var ejs=require(_0x1fb2('0x8'));var fs=require('fs');var fs_extra=require(_0x1fb2('0x9'));var _=require('lodash');var squel=require(_0x1fb2('0xa'));var crypto=require(_0x1fb2('0xb'));var jsforce=require(_0x1fb2('0xc'));var deskjs=require(_0x1fb2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1fb2('0xe'));var Papa=require(_0x1fb2('0xf'));var Redis=require('ioredis');var authService=require(_0x1fb2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fb2('0x11'))(_0x1fb2('0x12'));var utils=require('../../config/utils');var config=require(_0x1fb2('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1fb2('0x14'))['db'];config[_0x1fb2('0x15')]=_['defaults'](config[_0x1fb2('0x15')],{'host':_0x1fb2('0x16'),'port':0x18eb});var socket=require(_0x1fb2('0x17'))(new Redis(config[_0x1fb2('0x15')]));require(_0x1fb2('0x18'))['register'](socket);var jayson=require(_0x1fb2('0x19'));var client=jayson[_0x1fb2('0x1a')][_0x1fb2('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x1fb2('0x1b')]({'port':0x232a});var client9003=jayson[_0x1fb2('0x1a')][_0x1fb2('0x1b')]({'port':0x232b});var client9001=jayson[_0x1fb2('0x1a')]['http']({'port':0x2329});function respondWithRpcPromise(_0x35e5fc,_0x12b7bb,_0x16b683,_0x6a1152){return new BPromise(function(_0xafdb8d,_0x4fd194){var _0x406349=_0x6a1152||client;return _0x406349[_0x1fb2('0x1c')](_0x35e5fc,_0x16b683)[_0x1fb2('0x1d')](function(_0xbd7c14){logger[_0x1fb2('0x1e')]('ChatWebsite,\x20%s,\x20%s',_0x12b7bb,_0x1fb2('0x1f'));logger[_0x1fb2('0x20')](_0x1fb2('0x21'),_0x12b7bb,_0x1fb2('0x1f'),JSON['stringify'](_0xbd7c14));if(_0xbd7c14[_0x1fb2('0x22')]){if(_0xbd7c14[_0x1fb2('0x22')]['code']===0x1f4){logger[_0x1fb2('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x12b7bb,_0xbd7c14[_0x1fb2('0x22')][_0x1fb2('0x23')]);return _0x4fd194(_0xbd7c14['error'][_0x1fb2('0x23')]);}logger[_0x1fb2('0x22')](_0x1fb2('0x24'),_0x12b7bb,_0xbd7c14[_0x1fb2('0x22')][_0x1fb2('0x23')]);return _0xafdb8d(_0xbd7c14['error'][_0x1fb2('0x23')]);}else{logger['info'](_0x1fb2('0x24'),_0x12b7bb,_0x1fb2('0x1f'));_0xafdb8d(_0xbd7c14[_0x1fb2('0x25')][_0x1fb2('0x23')]);}})[_0x1fb2('0x26')](function(_0x1c9df1){logger['error'](_0x1fb2('0x24'),_0x12b7bb,_0x1c9df1);_0x4fd194(_0x1c9df1);});});}function respondWithStatusCode(_0x351dd6,_0x1b9e5c){_0x1b9e5c=_0x1b9e5c||0xcc;return function(_0x464296){if(_0x464296){return _0x351dd6['sendStatus'](_0x1b9e5c);}return _0x351dd6[_0x1fb2('0x27')](_0x1b9e5c)[_0x1fb2('0x28')]();};}function respondWithResult(_0x44b82d,_0x4d7fde){_0x4d7fde=_0x4d7fde||0xc8;return function(_0x33ebdd){if(_0x33ebdd){return _0x44b82d['status'](_0x4d7fde)[_0x1fb2('0x29')](_0x33ebdd);}};}function respondWithFilteredResult(_0x181d9e,_0x34cc13){return function(_0x32f4a2){if(_0x32f4a2){var _0x1c730b=_0x32f4a2[_0x1fb2('0x2a')],_0xc2a70f=_0x34cc13[_0x1fb2('0x2b')],_0xb466ff=_0x34cc13['offset']+_0x34cc13[_0x1fb2('0x2c')],_0x437ac2;if(_0xb466ff>=_0x1c730b){_0xb466ff=_0x1c730b;_0x437ac2=0xc8;}else{_0x437ac2=0xce;}_0x181d9e[_0x1fb2('0x27')](_0x437ac2);return _0x181d9e[_0x1fb2('0x2d')](_0x1fb2('0x2e'),_0xc2a70f+'-'+_0xb466ff+'/'+_0x1c730b)[_0x1fb2('0x29')](_0x32f4a2);}return null;};}function patchUpdates(_0x8a6c11){return function(_0x5251d5){try{jsonpatch[_0x1fb2('0x2f')](_0x5251d5,_0x8a6c11,!![]);}catch(_0x1fb94a){return BPromise['reject'](_0x1fb94a);}return _0x5251d5[_0x1fb2('0x30')]();};}function saveUpdates(_0xb9951f,_0x1cfa51){return function(_0x3f787f){if(_0x3f787f){return _0x3f787f['update'](_0xb9951f)[_0x1fb2('0x1d')](function(_0x5639e0){return _0x5639e0;});}return null;};}function removeEntity(_0x46f533,_0x46bd22){return function(_0x37fad4){if(_0x37fad4){return _0x37fad4['destroy']()[_0x1fb2('0x1d')](function(){var _0x5442c1=_0x37fad4[_0x1fb2('0x31')]({'plain':!![]});var _0x535da7=_0x1fb2('0x32');return db[_0x1fb2('0x33')]['destroy']({'where':{'type':_0x535da7,'resourceId':_0x5442c1['id']}})[_0x1fb2('0x1d')](function(){return _0x37fad4;});})[_0x1fb2('0x1d')](function(){_0x46f533[_0x1fb2('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8c18cf,_0x3131fb){return function(_0x1a6ab8){if(!_0x1a6ab8){_0x8c18cf[_0x1fb2('0x34')](0x194);}return _0x1a6ab8;};}function handleError(_0x4bd31b,_0x46ad62){_0x46ad62=_0x46ad62||0x1f4;return function(_0x334634){logger['error'](_0x334634[_0x1fb2('0x35')]);if(_0x334634[_0x1fb2('0x36')]){delete _0x334634[_0x1fb2('0x36')];}_0x4bd31b[_0x1fb2('0x27')](_0x46ad62)[_0x1fb2('0x37')](_0x334634);};}exports[_0x1fb2('0x38')]=function(_0x268b97,_0x14ec87){var _0xcb8268={'include':[{'model':db[_0x1fb2('0x39')],'as':_0x1fb2('0x3a')}]},_0x4e8029={},_0x45ae98={'count':0x0,'rows':[]};var _0x260558=_[_0x1fb2('0x3b')](db[_0x1fb2('0x3c')]['rawAttributes'],function(_0x1d4ffd){return{'name':_0x1d4ffd[_0x1fb2('0x3d')],'type':_0x1d4ffd[_0x1fb2('0x3e')][_0x1fb2('0x3f')]};});_0x4e8029[_0x1fb2('0x40')]=_['map'](_0x260558,'name');_0x4e8029[_0x1fb2('0x41')]=_[_0x1fb2('0x42')](_0x268b97['query']);_0x4e8029[_0x1fb2('0x43')]=_[_0x1fb2('0x44')](_0x4e8029[_0x1fb2('0x40')],_0x4e8029['query']);_0xcb8268[_0x1fb2('0x45')]=_[_0x1fb2('0x44')](_0x4e8029[_0x1fb2('0x40')],qs[_0x1fb2('0x46')](_0x268b97[_0x1fb2('0x41')][_0x1fb2('0x46')]));_0xcb8268['attributes']=_0xcb8268['attributes'][_0x1fb2('0x47')]?_0xcb8268['attributes']:_0x4e8029['model'];if(!_0x268b97[_0x1fb2('0x41')][_0x1fb2('0x48')](_0x1fb2('0x49'))){_0xcb8268[_0x1fb2('0x2c')]=qs['limit'](_0x268b97['query'][_0x1fb2('0x2c')]);_0xcb8268[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x268b97['query']['offset']);}_0xcb8268['order']=qs[_0x1fb2('0x4a')](_0x268b97[_0x1fb2('0x41')][_0x1fb2('0x4a')]);_0xcb8268[_0x1fb2('0x4b')]=qs[_0x1fb2('0x43')](_[_0x1fb2('0x4c')](_0x268b97[_0x1fb2('0x41')],_0x4e8029['filters']),_0x260558);if(_0x268b97[_0x1fb2('0x41')][_0x1fb2('0x4d')]){_0xcb8268[_0x1fb2('0x4b')]=_[_0x1fb2('0x4e')](_0xcb8268[_0x1fb2('0x4b')],{'$or':_[_0x1fb2('0x3b')](_0x260558,function(_0x5daae4){if(_0x5daae4['type']!=='VIRTUAL'){var _0x300b87={};_0x300b87[_0x5daae4[_0x1fb2('0x36')]]={'$like':'%'+_0x268b97['query']['filter']+'%'};return _0x300b87;}})});}_0xcb8268=_['merge']({},_0xcb8268,_0x268b97[_0x1fb2('0x4f')]);var _0x48635a={'where':_0xcb8268[_0x1fb2('0x4b')]};return db['ChatWebsite'][_0x1fb2('0x2a')](_0x48635a)[_0x1fb2('0x1d')](function(_0x5d5d6e){_0x45ae98[_0x1fb2('0x2a')]=_0x5d5d6e;if(_0x268b97[_0x1fb2('0x41')][_0x1fb2('0x50')]){_0xcb8268[_0x1fb2('0x51')]=[{'all':!![]}];}return db['ChatWebsite'][_0x1fb2('0x52')](_0xcb8268);})[_0x1fb2('0x1d')](function(_0x21189a){_0x45ae98['rows']=_0x21189a;return _0x45ae98;})[_0x1fb2('0x1d')](respondWithFilteredResult(_0x14ec87,_0xcb8268))[_0x1fb2('0x26')](handleError(_0x14ec87,null));};exports[_0x1fb2('0x53')]=function(_0x3e9e95,_0x3f56a5){var _0x1a7b26={'raw':![],'where':{'id':_0x3e9e95[_0x1fb2('0x54')]['id']},'include':[{'model':db[_0x1fb2('0x39')],'as':_0x1fb2('0x3a')}]},_0x3d5577={};_0x3d5577['model']=_[_0x1fb2('0x42')](db['ChatWebsite']['rawAttributes']);_0x3d5577[_0x1fb2('0x41')]=_['keys'](_0x3e9e95[_0x1fb2('0x41')]);_0x3d5577[_0x1fb2('0x43')]=_[_0x1fb2('0x44')](_0x3d5577[_0x1fb2('0x40')],_0x3d5577[_0x1fb2('0x41')]);_0x1a7b26['attributes']=_[_0x1fb2('0x44')](_0x3d5577[_0x1fb2('0x40')],qs[_0x1fb2('0x46')](_0x3e9e95[_0x1fb2('0x41')]['fields']));_0x1a7b26[_0x1fb2('0x45')]=_0x1a7b26[_0x1fb2('0x45')][_0x1fb2('0x47')]?_0x1a7b26[_0x1fb2('0x45')]:_0x3d5577['model'];if(_0x3e9e95[_0x1fb2('0x41')]['includeAll']){_0x1a7b26[_0x1fb2('0x51')]=[{'all':!![]}];}_0x1a7b26=_[_0x1fb2('0x4e')]({},_0x1a7b26,_0x3e9e95[_0x1fb2('0x4f')]);return db[_0x1fb2('0x3c')][_0x1fb2('0x55')](_0x1a7b26)[_0x1fb2('0x1d')](handleEntityNotFound(_0x3f56a5,null))[_0x1fb2('0x1d')](respondWithResult(_0x3f56a5,null))[_0x1fb2('0x26')](handleError(_0x3f56a5,null));};exports['create']=function(_0x26cfea,_0x1b4cfd){return db[_0x1fb2('0x3c')][_0x1fb2('0x56')](_0x26cfea['body'],{})[_0x1fb2('0x1d')](function(_0x4a018f){var _0x25fd97=_0x26cfea[_0x1fb2('0x57')][_0x1fb2('0x31')]({'plain':!![]});if(!_0x25fd97)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25fd97['role']===_0x1fb2('0x57')){var _0x57b83e=_0x4a018f[_0x1fb2('0x31')]({'plain':!![]});var _0x5af7c6=_0x1fb2('0x32');return db[_0x1fb2('0x58')][_0x1fb2('0x55')]({'where':{'name':_0x5af7c6,'userProfileId':_0x25fd97[_0x1fb2('0x59')]},'raw':!![]})[_0x1fb2('0x1d')](function(_0x27841b){if(_0x27841b&&_0x27841b['autoAssociation']===0x0){return db['UserProfileResource'][_0x1fb2('0x56')]({'name':_0x57b83e[_0x1fb2('0x36')],'resourceId':_0x57b83e['id'],'type':_0x27841b[_0x1fb2('0x36')],'sectionId':_0x27841b['id']},{})[_0x1fb2('0x1d')](function(){return _0x4a018f;});}else{return _0x4a018f;}})[_0x1fb2('0x26')](function(_0x4bf417){logger[_0x1fb2('0x22')](_0x1fb2('0x5a'),_0x4bf417);throw _0x4bf417;});}return _0x4a018f;})[_0x1fb2('0x1d')](respondWithResult(_0x1b4cfd,0xc9))[_0x1fb2('0x26')](handleError(_0x1b4cfd,null));};exports[_0x1fb2('0x5b')]=function(_0x1d8239,_0x3b1830){if(_0x1d8239[_0x1fb2('0x5c')]['id']){delete _0x1d8239[_0x1fb2('0x5c')]['id'];}return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x1d8239[_0x1fb2('0x54')]['id']},'include':[{'model':db[_0x1fb2('0x39')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x3b1830,null))['then'](saveUpdates(_0x1d8239[_0x1fb2('0x5c')],null))[_0x1fb2('0x1d')](respondWithResult(_0x3b1830,null))[_0x1fb2('0x26')](handleError(_0x3b1830,null));};exports[_0x1fb2('0x5d')]=function(_0x4f02f2,_0x2ef98b){return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x4f02f2[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x2ef98b,null))[_0x1fb2('0x1d')](removeEntity(_0x2ef98b,null))['catch'](handleError(_0x2ef98b,null));};exports[_0x1fb2('0x5e')]=function(_0x4cd054,_0x4e23cf){return db[_0x1fb2('0x3c')][_0x1fb2('0x5e')]()[_0x1fb2('0x1d')](respondWithResult(_0x4e23cf,null))[_0x1fb2('0x26')](handleError(_0x4e23cf,null));};exports['addDisposition']=function(_0x39389a,_0x5e661a,_0x42e6fb){if(_0x39389a[_0x1fb2('0x5c')]['id']){delete _0x39389a['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x39389a['params']['id']}})['then'](handleEntityNotFound(_0x5e661a,null))['then'](function(_0x2f1a7b){if(_0x2f1a7b){_0x39389a[_0x1fb2('0x5c')][_0x1fb2('0x5f')]=_0x2f1a7b['id'];return db[_0x1fb2('0x60')][_0x1fb2('0x56')](_0x39389a[_0x1fb2('0x5c')]);}})[_0x1fb2('0x1d')](respondWithResult(_0x5e661a,null))['catch'](handleError(_0x5e661a,null));};exports[_0x1fb2('0x61')]=function(_0x587045,_0x3d1229,_0x4790b7){var _0x13822d={'raw':![],'where':{}};var _0x168646={};var _0xdcfdf2={'count':0x0,'rows':[]};return db[_0x1fb2('0x3c')][_0x1fb2('0x62')]({'where':{'id':_0x587045['params']['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x3d1229,null))[_0x1fb2('0x1d')](function(_0x5d6dd2){if(_0x5d6dd2){_0x168646[_0x1fb2('0x40')]=_['keys'](db[_0x1fb2('0x60')][_0x1fb2('0x63')]);_0x168646[_0x1fb2('0x41')]=_[_0x1fb2('0x42')](_0x587045[_0x1fb2('0x41')]);_0x168646[_0x1fb2('0x43')]=_['intersection'](_0x168646[_0x1fb2('0x40')],_0x168646[_0x1fb2('0x41')]);_0x13822d['attributes']=_[_0x1fb2('0x44')](_0x168646['model'],qs[_0x1fb2('0x46')](_0x587045[_0x1fb2('0x41')][_0x1fb2('0x46')]));_0x13822d[_0x1fb2('0x45')]=_0x13822d[_0x1fb2('0x45')][_0x1fb2('0x47')]?_0x13822d[_0x1fb2('0x45')]:_0x168646[_0x1fb2('0x40')];if(!_0x587045['query'][_0x1fb2('0x48')](_0x1fb2('0x49'))){_0x13822d[_0x1fb2('0x2c')]=qs[_0x1fb2('0x2c')](_0x587045[_0x1fb2('0x41')][_0x1fb2('0x2c')]);_0x13822d[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x587045[_0x1fb2('0x41')][_0x1fb2('0x2b')]);}_0x13822d[_0x1fb2('0x64')]=qs[_0x1fb2('0x4a')](_0x587045[_0x1fb2('0x41')]['sort']);_0x13822d[_0x1fb2('0x4b')]=qs[_0x1fb2('0x43')](_['pick'](_0x587045[_0x1fb2('0x41')],_0x168646['filters']));_0x13822d[_0x1fb2('0x4b')][_0x1fb2('0x5f')]=_0x5d6dd2['id'];if(_0x587045[_0x1fb2('0x41')][_0x1fb2('0x4d')]){_0x13822d[_0x1fb2('0x4b')]=_[_0x1fb2('0x4e')](_0x13822d[_0x1fb2('0x4b')],{'$or':_[_0x1fb2('0x3b')](_0x13822d['attributes'],function(_0x4e6fac){var _0x54f9b3={};_0x54f9b3[_0x4e6fac]={'$like':'%'+_0x587045[_0x1fb2('0x41')][_0x1fb2('0x4d')]+'%'};return _0x54f9b3;})});}_0x13822d=_[_0x1fb2('0x4e')]({},_0x13822d,_0x587045[_0x1fb2('0x4f')]);return db[_0x1fb2('0x60')][_0x1fb2('0x2a')]({'where':_0x13822d[_0x1fb2('0x4b')]})['then'](function(_0x303e6f){_0xdcfdf2[_0x1fb2('0x2a')]=_0x303e6f;if(_0x587045[_0x1fb2('0x41')]['includeAll']){_0x13822d[_0x1fb2('0x51')]=[{'all':!![]}];}return db['Disposition'][_0x1fb2('0x52')](_0x13822d);})[_0x1fb2('0x1d')](function(_0x3380e2){_0xdcfdf2['rows']=_0x3380e2;return _0xdcfdf2;});}})[_0x1fb2('0x1d')](respondWithFilteredResult(_0x3d1229,_0x13822d))[_0x1fb2('0x26')](handleError(_0x3d1229,null));};exports['removeDispositions']=function(_0x182fd7,_0x1a2b7d,_0x4b7e23){return db[_0x1fb2('0x3c')]['find']({'where':{'id':_0x182fd7[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x1a2b7d,null))[_0x1fb2('0x1d')](function(_0x2cdfd0){if(_0x2cdfd0){return _0x2cdfd0[_0x1fb2('0x65')](_0x182fd7[_0x1fb2('0x41')][_0x1fb2('0x66')]);}})[_0x1fb2('0x1d')](respondWithStatusCode(_0x1a2b7d,null))[_0x1fb2('0x26')](handleError(_0x1a2b7d,null));};exports[_0x1fb2('0x67')]=function(_0x59cf80,_0x1e39ba,_0x4da4aa){if(_0x59cf80[_0x1fb2('0x5c')]['id']){delete _0x59cf80[_0x1fb2('0x5c')]['id'];}return db['ChatWebsite'][_0x1fb2('0x55')]({'where':{'id':_0x59cf80[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x1e39ba,null))[_0x1fb2('0x1d')](function(_0x15c1a6){if(_0x15c1a6){_0x59cf80[_0x1fb2('0x5c')]['ChatWebsiteId']=_0x15c1a6['id'];return db['CannedAnswer'][_0x1fb2('0x56')](_0x59cf80['body']);}})[_0x1fb2('0x1d')](respondWithResult(_0x1e39ba,null))[_0x1fb2('0x26')](handleError(_0x1e39ba,null));};exports['getAnswers']=function(_0x17ea86,_0x3059b8,_0x4479f0){var _0x216662={'raw':![],'where':{}};var _0x50148b={};var _0x1baecb={'count':0x0,'rows':[]};return db[_0x1fb2('0x3c')]['findOne']({'where':{'id':_0x17ea86[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x3059b8,null))[_0x1fb2('0x1d')](function(_0x5bb4fc){if(_0x5bb4fc){_0x50148b[_0x1fb2('0x40')]=_['keys'](db['CannedAnswer'][_0x1fb2('0x63')]);_0x50148b[_0x1fb2('0x41')]=_[_0x1fb2('0x42')](_0x17ea86[_0x1fb2('0x41')]);_0x50148b[_0x1fb2('0x43')]=_[_0x1fb2('0x44')](_0x50148b[_0x1fb2('0x40')],_0x50148b['query']);_0x216662['attributes']=_[_0x1fb2('0x44')](_0x50148b['model'],qs['fields'](_0x17ea86[_0x1fb2('0x41')][_0x1fb2('0x46')]));_0x216662[_0x1fb2('0x45')]=_0x216662['attributes'][_0x1fb2('0x47')]?_0x216662[_0x1fb2('0x45')]:_0x50148b[_0x1fb2('0x40')];if(!_0x17ea86['query'][_0x1fb2('0x48')]('nolimit')){_0x216662[_0x1fb2('0x2c')]=qs[_0x1fb2('0x2c')](_0x17ea86[_0x1fb2('0x41')][_0x1fb2('0x2c')]);_0x216662[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x17ea86['query'][_0x1fb2('0x2b')]);}_0x216662[_0x1fb2('0x64')]=qs['sort'](_0x17ea86['query'][_0x1fb2('0x4a')]);_0x216662[_0x1fb2('0x4b')]=qs[_0x1fb2('0x43')](_[_0x1fb2('0x4c')](_0x17ea86[_0x1fb2('0x41')],_0x50148b['filters']));_0x216662['where']['ChatWebsiteId']=_0x5bb4fc['id'];if(_0x17ea86[_0x1fb2('0x41')]['filter']){_0x216662['where']=_[_0x1fb2('0x4e')](_0x216662[_0x1fb2('0x4b')],{'$or':_[_0x1fb2('0x3b')](_0x216662[_0x1fb2('0x45')],function(_0x4d8976){var _0x4a3369={};_0x4a3369[_0x4d8976]={'$like':'%'+_0x17ea86[_0x1fb2('0x41')]['filter']+'%'};return _0x4a3369;})});}_0x216662=_['merge']({},_0x216662,_0x17ea86[_0x1fb2('0x4f')]);return db[_0x1fb2('0x68')]['count']({'where':_0x216662[_0x1fb2('0x4b')]})[_0x1fb2('0x1d')](function(_0x1e4bcc){_0x1baecb[_0x1fb2('0x2a')]=_0x1e4bcc;if(_0x17ea86['query'][_0x1fb2('0x50')]){_0x216662['include']=[{'all':!![]}];}return db[_0x1fb2('0x68')][_0x1fb2('0x52')](_0x216662);})[_0x1fb2('0x1d')](function(_0x1e3430){_0x1baecb['rows']=_0x1e3430;return _0x1baecb;});}})[_0x1fb2('0x1d')](respondWithFilteredResult(_0x3059b8,_0x216662))[_0x1fb2('0x26')](handleError(_0x3059b8,null));};exports[_0x1fb2('0x69')]=function(_0x336426,_0x38fe30,_0x5a6df5){return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x336426[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x38fe30,null))[_0x1fb2('0x1d')](function(_0x155987){if(_0x155987){return _0x155987[_0x1fb2('0x69')](_0x336426[_0x1fb2('0x41')][_0x1fb2('0x66')]);}})['then'](respondWithStatusCode(_0x38fe30,null))[_0x1fb2('0x26')](handleError(_0x38fe30,null));};exports['addLogo']=function(_0x5314c2,_0x4546ce,_0x502163){_0x5314c2[_0x1fb2('0x5c')][_0x1fb2('0x6a')]=_0x5314c2['file']['filename'];return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x5314c2['params']['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x4546ce,null))[_0x1fb2('0x1d')](saveUpdates(_0x5314c2[_0x1fb2('0x5c')],null))[_0x1fb2('0x1d')](respondWithResult(_0x4546ce,null))[_0x1fb2('0x26')](handleError(_0x4546ce,null));};exports[_0x1fb2('0x6b')]=function(_0x59136d,_0x3235a7,_0x481d1b){_0x59136d[_0x1fb2('0x5c')][_0x1fb2('0x6c')]=_0x59136d[_0x1fb2('0x6d')][_0x1fb2('0x6e')];return db['ChatWebsite']['find']({'where':{'id':_0x59136d[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x3235a7,null))[_0x1fb2('0x1d')](saveUpdates(_0x59136d[_0x1fb2('0x5c')],null))['then'](respondWithResult(_0x3235a7,null))[_0x1fb2('0x26')](handleError(_0x3235a7,null));};exports[_0x1fb2('0x6f')]=function(_0x370690,_0x1d227f,_0xaaf33a){_0x370690[_0x1fb2('0x5c')][_0x1fb2('0x70')]=_0x370690[_0x1fb2('0x6d')][_0x1fb2('0x6e')];return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x370690[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x1d227f,null))[_0x1fb2('0x1d')](saveUpdates(_0x370690[_0x1fb2('0x5c')],null))['then'](respondWithResult(_0x1d227f,null))['catch'](handleError(_0x1d227f,null));};exports[_0x1fb2('0x71')]=function(_0x2da8c4,_0x41a4c6,_0x2d3df5){_0x2da8c4[_0x1fb2('0x5c')][_0x1fb2('0x72')]=_0x2da8c4[_0x1fb2('0x6d')]['filename'];return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x2da8c4[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x41a4c6,null))[_0x1fb2('0x1d')](saveUpdates(_0x2da8c4[_0x1fb2('0x5c')],null))['then'](respondWithResult(_0x41a4c6,null))[_0x1fb2('0x26')](handleError(_0x41a4c6,null));};exports['getLogo']=function(_0x55393f,_0x371dd0,_0x59b917){var _0x27318c=path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x75'));var _0x4aae93={'where':{'id':_0x55393f[_0x1fb2('0x54')]['id']},'attributes':['id',_0x1fb2('0x6a')],'raw':!![]};var _0x2fa8f5=![];return require('../../config/license/util')[_0x1fb2('0x76')]()[_0x1fb2('0x1d')](function(_0x282d81){if(_0x282d81){_0x2fa8f5=_0x282d81[_0x1fb2('0x77')];}})[_0x1fb2('0x1d')](function(){return db['ChatWebsite'][_0x1fb2('0x55')](_0x4aae93);})[_0x1fb2('0x1d')](handleEntityNotFound(_0x371dd0,null))['then'](function(_0x44f4e3){if(_0x44f4e3){if(!_[_0x1fb2('0x78')](_0x44f4e3['sitepic'])){if(fs[_0x1fb2('0x79')](path[_0x1fb2('0x73')](config['root'],_0x1fb2('0x7a'),_0x44f4e3[_0x1fb2('0x6a')]))&&_0x2fa8f5){_0x27318c=path[_0x1fb2('0x73')](config['root'],_0x1fb2('0x7a'),_0x44f4e3[_0x1fb2('0x6a')]);}}return _0x371dd0[_0x1fb2('0x7b')](_0x27318c);}})[_0x1fb2('0x26')](handleError(_0x371dd0,null));};exports[_0x1fb2('0x7c')]=function(_0xc77443,_0x1dcf83,_0x363c67){var _0xb0cf5a=path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x7d'));var _0x4506a8={'where':{'id':_0xc77443[_0x1fb2('0x54')]['id']},'attributes':['id',_0x1fb2('0x6c')],'raw':!![]};return db[_0x1fb2('0x3c')][_0x1fb2('0x55')](_0x4506a8)[_0x1fb2('0x1d')](handleEntityNotFound(_0x1dcf83,null))[_0x1fb2('0x1d')](function(_0x4d668c){if(_0x4d668c){if(!_['isNil'](_0x4d668c[_0x1fb2('0x6c')])){if(fs[_0x1fb2('0x79')](path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x7e'),_0x4d668c[_0x1fb2('0x6c')]))){_0xb0cf5a=path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x7e'),_0x4d668c[_0x1fb2('0x6c')]);}}return _0x1dcf83[_0x1fb2('0x7b')](_0xb0cf5a);}})[_0x1fb2('0x26')](handleError(_0x1dcf83,null));};exports[_0x1fb2('0x7f')]=function(_0x2fd748,_0x5c1434,_0x57b591){var _0x2f1536=path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x80'));var _0xb38df0={'where':{'id':_0x2fd748[_0x1fb2('0x54')]['id']},'attributes':['id',_0x1fb2('0x70'),_0x1fb2('0x81')],'raw':!![]};return db[_0x1fb2('0x3c')][_0x1fb2('0x55')](_0xb38df0)[_0x1fb2('0x1d')](handleEntityNotFound(_0x5c1434,null))[_0x1fb2('0x1d')](function(_0x261e4e){if(_0x261e4e){if(!_['isNil'](_0x261e4e[_0x1fb2('0x70')])){if(fs[_0x1fb2('0x79')](path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x7e'),_0x261e4e['customerAvatar']))&&_0x261e4e[_0x1fb2('0x81')]){_0x2f1536=path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],'server/files/images/avatars/',_0x261e4e[_0x1fb2('0x70')]);}}return _0x5c1434[_0x1fb2('0x7b')](_0x2f1536);}})[_0x1fb2('0x26')](handleError(_0x5c1434,null));};exports['getSystemAvatar']=function(_0x499339,_0x525fe3,_0x5e7b2f){var _0x3cb561=path[_0x1fb2('0x73')](config['root'],_0x1fb2('0x82'));var _0xd30334={'where':{'id':_0x499339['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x1fb2('0x3c')][_0x1fb2('0x55')](_0xd30334)[_0x1fb2('0x1d')](handleEntityNotFound(_0x525fe3,null))[_0x1fb2('0x1d')](function(_0x2941d5){if(_0x2941d5){if(!_[_0x1fb2('0x78')](_0x2941d5[_0x1fb2('0x72')])){if(fs[_0x1fb2('0x79')](path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x7e'),_0x2941d5[_0x1fb2('0x72')]))){_0x3cb561=path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x7e'),_0x2941d5['systemAvatar']);}}return _0x525fe3[_0x1fb2('0x7b')](_0x3cb561);}})[_0x1fb2('0x26')](handleError(_0x525fe3,null));};exports[_0x1fb2('0x83')]=function(_0x164826,_0x3fa432,_0x43431a){var _0x5adddc=require('user-agent-parser');var _0x332017=new _0x5adddc();var _0x59ffe4=_0x332017[_0x1fb2('0x84')](_0x164826[_0x1fb2('0x85')]['user-agent'])[_0x1fb2('0x86')]();var _0x514026={'body':_0x164826[_0x1fb2('0x5c')],'channel':_0x1fb2('0x87')};var _0xe5daac=[];var _0x21c818=[];var _0x1c7138={};var _0x30d14d=![];return db[_0x1fb2('0x88')][_0x1fb2('0x5e')]()[_0x1fb2('0x1d')](function(_0xa38a92){if(!_0xa38a92){throw new db[(_0x1fb2('0x89'))][(_0x1fb2('0x8a'))]('no\x20available\x20attributes');}_0xe5daac=_[_0x1fb2('0x8b')](_['keys'](_0xa38a92),['createdAt',_0x1fb2('0x8c')]);_0x21c818=_[_0x1fb2('0x8b')](_[_0x1fb2('0x42')](_0xa38a92),[_0x1fb2('0x8d'),_0x1fb2('0x8c'),_0x1fb2('0x8e'),'ListId']);if(_0x164826[_0x1fb2('0x5c')]['id']){delete _0x164826[_0x1fb2('0x5c')]['id'];}if(_['isNil'](_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x8f')])){throw new db['Sequelize'][(_0x1fb2('0x8a'))]('from\x20is\x20mandatory');}if(_[_0x1fb2('0x78')](_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x5c')])||_0x164826['body']['body']===''){throw new db[(_0x1fb2('0x89'))][(_0x1fb2('0x8a'))](_0x1fb2('0x90'));}if(_[_0x1fb2('0x78')](_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x91')])){throw new db['Sequelize'][(_0x1fb2('0x8a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x21c818);}if(!_[_0x1fb2('0x92')](_0x21c818,_0x164826['body'][_0x1fb2('0x91')])){throw new db[(_0x1fb2('0x89'))][(_0x1fb2('0x8a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x21c818);}_0x1c7138[_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x91')]]=_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x8f')];})[_0x1fb2('0x1d')](function(){return db['ChatWebsite'][_0x1fb2('0x55')]({'where':{'id':_0x164826[_0x1fb2('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x1fb2('0x93'),'include':[{'model':db[_0x1fb2('0x88')],'as':_0x1fb2('0x94'),'where':_0x1c7138,'limit':0x1,'order':[[_0x1fb2('0x8c'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0x1fb2('0x95')}]});})[_0x1fb2('0x1d')](handleEntityNotFound(_0x3fa432,null))[_0x1fb2('0x1d')](function(_0x2eb6c1){if(_0x2eb6c1&&_0x2eb6c1[_0x1fb2('0x93')]){_0x514026[_0x1fb2('0x96')]=_0x2eb6c1;_0x514026[_0x1fb2('0x97')]=_0x2eb6c1[_0x1fb2('0x95')];_0x514026[_0x1fb2('0x98')]=_0x2eb6c1[_0x1fb2('0x93')];_0x514026[_0x1fb2('0x97')]=_[_0x1fb2('0x99')](_0x514026[_0x1fb2('0x97')],['priority'],[_0x1fb2('0x9a')]);if(_0x514026[_0x1fb2('0x96')][_0x1fb2('0x95')]){delete _0x514026[_0x1fb2('0x96')]['Applications'];}if(_0x514026['account'][_0x1fb2('0x93')]&&_0x514026[_0x1fb2('0x96')]['List'][_0x1fb2('0x94')][_0x1fb2('0x47')]){return _0x514026[_0x1fb2('0x96')][_0x1fb2('0x93')]['Contacts'][0x0];}var _0x326fa7=_[_0x1fb2('0x9b')](_0x164826[_0x1fb2('0x5c')],{'firstName':_0x164826['body']['from'],'ListId':_0x2eb6c1[_0x1fb2('0x9c')]});_0x326fa7[_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x91')]]=_0x164826[_0x1fb2('0x5c')]['from'];return db[_0x1fb2('0x88')][_0x1fb2('0x56')](_0x326fa7,{'fields':_0xe5daac,'raw':!![]});}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x3fa432,null))[_0x1fb2('0x1d')](function(_0x20e482){_0x514026['contact']=_0x20e482;var _0x5811f6=_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x9d')];if(_0x164826[_0x1fb2('0x85')][_0x1fb2('0x9e')]){_0x5811f6=_0x164826[_0x1fb2('0x85')][_0x1fb2('0x9e')];}else if(_0x164826['headers'][_0x1fb2('0x9f')]){_0x5811f6=_[_0x1fb2('0xa0')](_0x164826[_0x1fb2('0x85')]['x-forwarded-for'][_0x1fb2('0xa1')](','));}if(_0x20e482){var _0x29d2c3={'ContactId':_0x20e482['id'],'ChatWebsiteId':_0x164826[_0x1fb2('0x54')]['id'],'from':(_0x20e482['firstName']||'')+'\x20'+(_0x20e482['lastName']||''),'customerIp':_0x5811f6,'customerPort':_0x164826['headers'][_0x1fb2('0xa2')]?_0x164826[_0x1fb2('0x85')][_0x1fb2('0xa2')]:null,'referer':_0x164826[_0x1fb2('0x5c')]['referer'],'browserName':_0x59ffe4[_0x1fb2('0xa3')][_0x1fb2('0x36')]&&_0x59ffe4[_0x1fb2('0xa3')][_0x1fb2('0xa4')]?util[_0x1fb2('0xa5')](_0x1fb2('0xa6'),_0x59ffe4[_0x1fb2('0xa3')][_0x1fb2('0x36')],_0x59ffe4[_0x1fb2('0xa3')]['version']):'unknown','browserVersion':_0x59ffe4[_0x1fb2('0xa3')][_0x1fb2('0xa4')]||'unknown','osName':util[_0x1fb2('0xa5')]('%s\x20%s',_0x59ffe4['os'][_0x1fb2('0x36')],_0x59ffe4['os'][_0x1fb2('0xa4')]),'osVersion':_0x59ffe4['os'][_0x1fb2('0xa4')],'deviceModel':_0x59ffe4[_0x1fb2('0xa7')][_0x1fb2('0x40')]&&_0x59ffe4[_0x1fb2('0xa7')][_0x1fb2('0xa8')]?util[_0x1fb2('0xa5')](_0x1fb2('0xa9'),_0x59ffe4['device'][_0x1fb2('0x40')],_0x59ffe4[_0x1fb2('0xa7')][_0x1fb2('0xa8')],_0x59ffe4[_0x1fb2('0xa7')][_0x1fb2('0x3e')]):null,'deviceVendor':_0x59ffe4['device'][_0x1fb2('0xa8')],'deviceType':_0x59ffe4[_0x1fb2('0xa7')][_0x1fb2('0x3e')],'formData':JSON[_0x1fb2('0xaa')](_0x164826[_0x1fb2('0x5c')])};var _0x2c6a2e={'ChatWebsiteId':_0x164826[_0x1fb2('0x54')]['id'],'closed':![]};if(_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xab')]){_0x2c6a2e[_0x1fb2('0xab')]=_0x164826[_0x1fb2('0x5c')]['threadId'];return db[_0x1fb2('0xac')][_0x1fb2('0x55')]({'where':_0x2c6a2e})[_0x1fb2('0x1d')](function(_0x44db34){if(_0x44db34){return[_0x44db34,![]];}_0x29d2c3[_0x1fb2('0xab')]=_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xab')];_0x29d2c3[_0x1fb2('0xad')]=_0x164826['body']['externalUrl'];return db[_0x1fb2('0xac')]['create'](_0x29d2c3)['then'](function(_0x3ceb47){return[_0x3ceb47,!![]];});});}_0x2c6a2e[_0x1fb2('0xae')]=_0x20e482['id'];if(_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xaf')]&&_0x164826['body'][_0x1fb2('0xaf')]['id']){_0x2c6a2e['id']=_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xaf')]['id'];return db[_0x1fb2('0xac')]['find']({'where':_0x2c6a2e})['then'](function(_0x4c2a9d){if(_0x4c2a9d){return[_0x4c2a9d,![]];}return db[_0x1fb2('0xac')]['create'](_0x29d2c3)[_0x1fb2('0x1d')](function(_0x4e008f){return[_0x4e008f,!![]];});});}return db[_0x1fb2('0xac')]['create'](_0x29d2c3)[_0x1fb2('0x1d')](function(_0x32cd21){return[_0x32cd21,!![]];});}})[_0x1fb2('0xb0')](function(_0x3dd789,_0x13a872){if(_0x3dd789){_0x30d14d=_0x13a872;if(!_0x13a872){var _0x526f41={'from':(_0x514026[_0x1fb2('0xb1')][_0x1fb2('0xb2')]||'')+'\x20'+(_0x514026[_0x1fb2('0xb1')][_0x1fb2('0xb3')]||'')};if(_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xab')]&&_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xb4')]&&_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xab')]!=_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xb4')]){_0x526f41[_0x1fb2('0xab')]=_0x164826[_0x1fb2('0x5c')]['messageId'];}return _0x3dd789[_0x1fb2('0x5b')](_0x526f41);}else{return _0x3dd789;}}})[_0x1fb2('0x1d')](function(_0x3f36ee){_0x514026[_0x1fb2('0xaf')]=_0x3f36ee[_0x1fb2('0x31')]({'plain':!![]});_0x514026[_0x1fb2('0xaf')]['created']=_0x30d14d;if(_0x514026[_0x1fb2('0xaf')][_0x1fb2('0xb5')]){if(_0x514026['account'][_0x1fb2('0xb6')]){_0x514026['applications'][_0x1fb2('0xb7')]({'id':0x0,'priority':_0x514026[_0x1fb2('0x97')][_0x1fb2('0x47')]+0x1,'app':_0x1fb2('0xb8'),'appdata':_0x1fb2('0xb9'),'interval':'*,*,*,*'});}}return db[_0x1fb2('0xba')][_0x1fb2('0x56')]({'body':_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x5c')],'ChatWebsiteId':_0x164826[_0x1fb2('0x54')]['id'],'ChatInteractionId':_0x3f36ee['id'],'direction':'in','ContactId':_0x514026[_0x1fb2('0xb1')]['id'],'AttachmentId':_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xbb')]});})[_0x1fb2('0x1d')](function(_0x6c3006){_0x514026[_0x1fb2('0x23')]=_0x6c3006;if(_0x514026[_0x1fb2('0xaf')]['UserId']){return db['User'][_0x1fb2('0x55')]({'attributes':['id',_0x1fb2('0x36')],'where':{'id':_0x514026[_0x1fb2('0xaf')][_0x1fb2('0xbc')]}})[_0x1fb2('0x1d')](function(_0x1e5216){if(_0x1e5216){_0x514026[_0x1fb2('0x97')][_0x1fb2('0xbd')]({'id':0x0,'priority':0x0,'app':_0x1fb2('0xbe'),'appdata':_0x1e5216[_0x1fb2('0x36')]+','+(_0x514026[_0x1fb2('0x96')][_0x1fb2('0xbf')]||0xa),'interval':_0x1fb2('0xc0')});_0x514026[_0x1fb2('0xc1')]=!![];}return respondWithRpcPromise(_0x1fb2('0xc2'),_0x1fb2('0xc3'),_0x514026);});}return respondWithRpcPromise('Start',_0x1fb2('0xc3'),_0x514026);})[_0x1fb2('0x1d')](function(_0x3f4a87){respondWithRpcPromise(_0x1fb2('0xc4'),_0x1fb2('0xc4'),{'event':_0x1fb2('0x83'),'message':_0x3f4a87},client9002);return _0x3f4a87;})[_0x1fb2('0x1d')](respondWithResult(_0x3fa432,null))[_0x1fb2('0x26')](handleError(_0x3fa432,null));};exports[_0x1fb2('0xc5')]=function(_0x5424ea,_0x56401e,_0x2f3276){var _0x4f8082,_0x14a439,_0x430e7c;var _0x106898=[];var _0x34b234=[];var _0x348c70={};var _0x18bf7c=_0x5424ea[_0x1fb2('0xc6')]||[];return db[_0x1fb2('0x88')][_0x1fb2('0x5e')]()[_0x1fb2('0x1d')](function(_0x3ed7c8){if(!_0x3ed7c8){throw new db[(_0x1fb2('0x89'))][(_0x1fb2('0x8a'))]('no\x20available\x20attributes');}_0x34b234=_['difference'](_['keys'](_0x3ed7c8),[_0x1fb2('0x8d'),_0x1fb2('0x8c')]);_0x106898=_[_0x1fb2('0x8b')](_[_0x1fb2('0x42')](_0x3ed7c8),[_0x1fb2('0x8d'),'updatedAt',_0x1fb2('0x8e'),_0x1fb2('0x9c')]);if(_0x5424ea[_0x1fb2('0x5c')]['id']){delete _0x5424ea['body']['id'];}if(_['isNil'](_0x5424ea['body'][_0x1fb2('0x8f')])||_[_0x1fb2('0x78')](_0x5424ea['body'][_0x1fb2('0x5c')][_0x1fb2('0xc7')])){throw _0x56401e[_0x1fb2('0x27')](0x1f4)[_0x1fb2('0x37')](new db[(_0x1fb2('0x89'))][(_0x1fb2('0x8a'))](_0x1fb2('0xc8')));}if(_['isNil'](_0x5424ea[_0x1fb2('0x5c')]['body'])||_0x5424ea[_0x1fb2('0x5c')]['body']===''||(_['isNil'](_0x5424ea[_0x1fb2('0x5c')][_0x1fb2('0x5c')][_0x1fb2('0xc9')])||_0x5424ea[_0x1fb2('0x5c')][_0x1fb2('0x5c')][_0x1fb2('0xc9')]==='')){throw _0x56401e[_0x1fb2('0x27')](0x1f4)[_0x1fb2('0x37')](new db[(_0x1fb2('0x89'))][(_0x1fb2('0x8a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x1fb2('0x78')](_0x5424ea[_0x1fb2('0x5c')][_0x1fb2('0xca')])){throw _0x56401e[_0x1fb2('0x27')](0x1f4)[_0x1fb2('0x37')](new db['Sequelize'][(_0x1fb2('0x8a'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x106898));}if(!_[_0x1fb2('0x92')](_0x106898,_0x5424ea[_0x1fb2('0x5c')]['mapKeyOffline'])){throw _0x56401e[_0x1fb2('0x27')](0x1f4)[_0x1fb2('0x37')](new db[(_0x1fb2('0x89'))][(_0x1fb2('0x8a'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x106898));}_0x348c70[_0x5424ea[_0x1fb2('0x5c')][_0x1fb2('0xca')]]=_0x5424ea['body'][_0x1fb2('0x8f')];})['then'](function(){return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x5424ea[_0x1fb2('0x54')]['id']},'include':[{'model':db[_0x1fb2('0xcb')],'as':_0x1fb2('0x93')},{'model':db['MailAccount'],'as':_0x1fb2('0xcc')}]});})[_0x1fb2('0x1d')](handleEntityNotFound(_0x56401e,null))[_0x1fb2('0x1d')](function(_0x31fa41){if(_0x31fa41&&_0x31fa41[_0x1fb2('0x93')]){_0x14a439=_0x31fa41;var _0x3c51d1=_['defaults'](_0x5424ea['body'],{'firstName':_0x5424ea[_0x1fb2('0x5c')][_0x1fb2('0x8f')],'phone':_0x5424ea['body'][_0x1fb2('0x8f')],'ListId':_0x31fa41[_0x1fb2('0x9c')]});_0x3c51d1[_0x5424ea['body']['mapKeyOffline']]=_0x5424ea[_0x1fb2('0x5c')][_0x1fb2('0x8f')];return db[_0x1fb2('0x88')][_0x1fb2('0xcd')]({'where':_0x348c70,'defaults':_0x3c51d1});}})[_0x1fb2('0xb0')](function(_0x1b4bde){if(_0x1b4bde){_0x430e7c=_0x1b4bde;var _0x3fed69=fs[_0x1fb2('0xce')](path[_0x1fb2('0x73')](config['root'],_0x1fb2('0xcf')),_0x1fb2('0xd0'));var _0x2b29a1=ejs[_0x1fb2('0xd1')](_0x3fed69,{'body':_[_0x1fb2('0xd2')](_0x5424ea[_0x1fb2('0x5c')][_0x1fb2('0x5c')]),'bodyTitle':_0x14a439[_0x1fb2('0xd3')]});return db[_0x1fb2('0xd4')][_0x1fb2('0x56')]({'body':_0x2b29a1,'ContactId':_0x1b4bde['id'],'ChatWebsiteId':_0x14a439['id']});}})['then'](function(_0x56120d){if(!_[_0x1fb2('0x78')](_0x5424ea[_0x1fb2('0xc6')])){var _0x4c190d=_0x18bf7c['map'](function(_0xb283d5){return{'name':_0xb283d5[_0x1fb2('0xd5')],'basename':_0xb283d5['filename'],'type':_0xb283d5[_0x1fb2('0xd6')],'ChatOfflineMessageId':_0x56120d['id']};});db['Attachment'][_0x1fb2('0xd7')](_0x4c190d)[_0x1fb2('0xd8')];}return _0x56120d;})[_0x1fb2('0x1d')](function(_0x2903be){if(_0x2903be){_0x4f8082=_0x2903be;return db[_0x1fb2('0xcc')][_0x1fb2('0x62')]({'where':{'service':!![]},'include':[{'model':db[_0x1fb2('0xd9')],'as':'Smtp','raw':!![]}]});}})[_0x1fb2('0x1d')](function(_0x2aa924){if(_0x2aa924&&_0x2aa924['Smtp']&&_0x14a439['forwardOffline']&&_0x14a439['forwardOfflineAddress']){var _0x38ee9d={'tls':{'rejectUnauthorized':![]}};if(_0x2aa924['Smtp'][_0x1fb2('0xda')]){_0x38ee9d['service']=_0x2aa924['Smtp']['service'];}else{_0x38ee9d[_0x1fb2('0xdb')]=_0x2aa924[_0x1fb2('0xdc')]['host'];_0x38ee9d[_0x1fb2('0xdd')]=_0x2aa924['Smtp']['port'];_0x38ee9d[_0x1fb2('0xde')]=_0x2aa924[_0x1fb2('0xdc')]['secure'];}if(_0x2aa924[_0x1fb2('0xdc')][_0x1fb2('0xdf')]){_0x38ee9d['auth']={'user':_0x2aa924[_0x1fb2('0xdc')]['user'],'pass':_0x2aa924[_0x1fb2('0xdc')]['pass']};}return respondWithRpcPromise(_0x1fb2('0xe0'),_0x1fb2('0xe1'),{'account':_0x38ee9d,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2aa924[_0x1fb2('0x36')],_0x2aa924[_0x1fb2('0xc7')]||_0x2aa924[_0x1fb2('0xdc')][_0x1fb2('0x57')]),'to':_0x14a439[_0x1fb2('0xe2')],'subject':_0x14a439[_0x1fb2('0xe3')],'text':_0x4f8082[_0x1fb2('0x5c')],'attachments':!_[_0x1fb2('0x78')](_0x5424ea[_0x1fb2('0xc6')])?_0x18bf7c:[]}},client9003)[_0x1fb2('0x1d')](function(){return _0x4f8082;})[_0x1fb2('0x26')](function(_0x2a8552){console[_0x1fb2('0x22')](_0x2a8552);});}})[_0x1fb2('0x1d')](function(){if(_0x14a439&&_0x14a439['openNewInteraction']&&_0x14a439[_0x1fb2('0xe4')]){var _0x49f366={'from':_0x430e7c['email'],'firstName':_0x430e7c[_0x1fb2('0xb2')],'lastName':_0x430e7c[_0x1fb2('0xb3')],'mapKey':_0x1fb2('0xc7'),'message':{'from':_0x430e7c['email'],'to':_0x14a439[_0x1fb2('0xcc')][_0x1fb2('0xc7')],'cc':'','subject':_0x14a439[_0x1fb2('0xe3')],'messageId':'','sentAt':new Date(),'attach':!_[_0x1fb2('0x78')](_0x5424ea[_0x1fb2('0xc6')]),'attachments':!_['isNil'](_0x5424ea[_0x1fb2('0xc6')])?_0x18bf7c:[],'originChannel':_0x1fb2('0xe5'),'ChatWebsiteId':_0x14a439['id'],'ChatOfflineMessageId':_0x4f8082['id'],'originTo':_0x14a439[_0x1fb2('0xcc')][_0x1fb2('0xc7')]},'body':_0x4f8082[_0x1fb2('0x5c')]};var _0x418b1e={'account':{'id':_0x14a439['MailAccountId']},'body':_0x49f366,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x1fb2('0xe6'),_0x1fb2('0xe7'),_0x418b1e,client9001)['then'](function(){return _0x4f8082;})[_0x1fb2('0x26')](function(_0x3b5e31){console[_0x1fb2('0x22')](_0x3b5e31);});}return;})[_0x1fb2('0x1d')](function(){if(_0x4f8082){return _0x4f8082;}})[_0x1fb2('0x1d')](respondWithResult(_0x56401e,null))[_0x1fb2('0x26')](function(_0x38664c){console[_0x1fb2('0x22')]('catch',_0x38664c);for(var _0x30a070 of _0x18bf7c){var _0x11c684=path[_0x1fb2('0x73')](config['root'],_0x1fb2('0xc6'),_0x1fb2('0xe8'),_0x1fb2('0xe9'),_0x30a070['filename']);fs_extra[_0x1fb2('0xea')](_0x11c684)[_0x1fb2('0x26')](function(_0x2cfbfe){console[_0x1fb2('0x22')](_0x1fb2('0xeb'),_0x11c684,_0x2cfbfe);});}});};exports[_0x1fb2('0xec')]=function(_0x5906d6,_0x256500,_0x33e809){return db['ChatInteraction'][_0x1fb2('0x55')]({'where':{'id':_0x5906d6[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x256500,null))[_0x1fb2('0x1d')](function(_0x3709dc){if(_0x3709dc){return _0x3709dc[_0x1fb2('0xec')](_0x5906d6[_0x1fb2('0x5c')][_0x1fb2('0x66')],_[_0x1fb2('0xed')](_0x5906d6[_0x1fb2('0x5c')],[_0x1fb2('0x66'),'id'])||{});}})[_0x1fb2('0x1d')](respondWithResult(_0x256500,null))['catch'](handleError(_0x256500,null));};exports['getInteractions']=function(_0x16ba05,_0x4cc19d,_0xd9672d){var _0x45dd45={'raw':![],'where':{}};var _0x3826a9={};var _0x4e828d={'count':0x0,'rows':[]};return db[_0x1fb2('0x3c')][_0x1fb2('0x62')]({'where':{'id':_0x16ba05['params']['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x4cc19d,null))[_0x1fb2('0x1d')](function(_0x6d7ef2){if(_0x6d7ef2){_0x3826a9[_0x1fb2('0x40')]=_[_0x1fb2('0x42')](db['ChatInteraction'][_0x1fb2('0x63')]);_0x3826a9['query']=_[_0x1fb2('0x42')](_0x16ba05['query']);_0x3826a9['filters']=_[_0x1fb2('0x44')](_0x3826a9[_0x1fb2('0x40')],_0x3826a9[_0x1fb2('0x41')]);_0x45dd45['attributes']=_[_0x1fb2('0x44')](_0x3826a9['model'],qs[_0x1fb2('0x46')](_0x16ba05[_0x1fb2('0x41')][_0x1fb2('0x46')]));_0x45dd45[_0x1fb2('0x45')]=_0x45dd45[_0x1fb2('0x45')][_0x1fb2('0x47')]?_0x45dd45[_0x1fb2('0x45')]:_0x3826a9[_0x1fb2('0x40')];if(!_0x16ba05[_0x1fb2('0x41')][_0x1fb2('0x48')](_0x1fb2('0x49'))){_0x45dd45[_0x1fb2('0x2c')]=qs['limit'](_0x16ba05[_0x1fb2('0x41')][_0x1fb2('0x2c')]);_0x45dd45[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x16ba05[_0x1fb2('0x41')]['offset']);}_0x45dd45[_0x1fb2('0x64')]=qs[_0x1fb2('0x4a')](_0x16ba05[_0x1fb2('0x41')][_0x1fb2('0x4a')]);_0x45dd45[_0x1fb2('0x4b')]=qs[_0x1fb2('0x43')](_[_0x1fb2('0x4c')](_0x16ba05[_0x1fb2('0x41')],_0x3826a9[_0x1fb2('0x43')]));_0x45dd45['where']['ChatWebsiteId']=_0x6d7ef2['id'];if(_0x16ba05[_0x1fb2('0x41')][_0x1fb2('0x4d')]){_0x45dd45[_0x1fb2('0x4b')]=_[_0x1fb2('0x4e')](_0x45dd45[_0x1fb2('0x4b')],{'$or':_[_0x1fb2('0x3b')](_0x45dd45['attributes'],function(_0x1f2cab){var _0x30ef2e={};_0x30ef2e[_0x1f2cab]={'$like':'%'+_0x16ba05[_0x1fb2('0x41')]['filter']+'%'};return _0x30ef2e;})});}_0x45dd45=_[_0x1fb2('0x4e')]({},_0x45dd45,_0x16ba05['options']);return db['ChatInteraction'][_0x1fb2('0x2a')]({'where':_0x45dd45[_0x1fb2('0x4b')]})['then'](function(_0x5493fb){_0x4e828d[_0x1fb2('0x2a')]=_0x5493fb;if(_0x16ba05['query'][_0x1fb2('0x50')]){_0x45dd45['include']=[{'model':db[_0x1fb2('0x88')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x1fb2('0x36'),_0x1fb2('0xee'),_0x1fb2('0xef')],'required':![]},{'model':db[_0x1fb2('0xf0')],'as':_0x1fb2('0xf1'),'attributes':['id','name',_0x1fb2('0xf2')],'where':_0x16ba05['query'][_0x1fb2('0xf3')]?{'id':_0x16ba05[_0x1fb2('0x41')][_0x1fb2('0xf3')]}:undefined,'required':_0x16ba05[_0x1fb2('0x41')][_0x1fb2('0xf3')]?!![]:![]}];}return db[_0x1fb2('0xac')][_0x1fb2('0x52')](_0x45dd45);})[_0x1fb2('0x1d')](function(_0x9cee5c){_0x4e828d['rows']=_0x9cee5c;return _0x4e828d;});}})[_0x1fb2('0x1d')](respondWithFilteredResult(_0x4cc19d,_0x45dd45))[_0x1fb2('0x26')](handleError(_0x4cc19d,null));};function iftimePromise(_0x774cb5,_0x11f3d2){return respondWithRpcPromise('Command',_0x1fb2('0xf4'),{'command':_0x11f3d2[_0x1fb2('0xf5')]?util['format']('iftime\x20%s,%s',_0x774cb5[_0x1fb2('0xf6')],_0x11f3d2[_0x1fb2('0xf5')]):util[_0x1fb2('0xa5')](_0x1fb2('0xf7'),_0x774cb5['interval'])},client9002)['then'](function(_0x2c1401){var _0x14490e=_0x2c1401&&_0x2c1401['indexOf'](_0x1fb2('0xf8'))>=0x0?!![]:![];logger[_0x1fb2('0x1e')](_0x1fb2('0xf9'),_0x11f3d2['id'],_0x774cb5['id'],_0x774cb5['interval'],_0x14490e?_0x1fb2('0xfa'):'OFFLINE',_0x11f3d2[_0x1fb2('0xf5')]?_0x11f3d2['timezone']:_0x1fb2('0xfb'));return _0x14490e;})['catch'](function(_0x4c41eb){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x11f3d2['id'],_0x774cb5['id'],_0x774cb5[_0x1fb2('0xf6')],util['inspect'](_0x4c41eb,{'showHidden':![],'depth':null}),_0x11f3d2['timezone']?_0x11f3d2['timezone']:_0x1fb2('0xfb'));return![];});}exports[_0x1fb2('0xf4')]=function(_0x4427f3,_0x51c20c,_0x5e52d4){var _0x453bc1=0x0;var _0x47cc31=0x0;var _0x40ce22=![];var _0x2a4fe5;var _0x27994c;return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x4427f3[_0x1fb2('0x54')]['id']},'include':[{'model':db['Interval'],'as':_0x1fb2('0xfc'),'include':[{'model':db[_0x1fb2('0xfc')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0x1fb2('0x1d')](handleEntityNotFound(_0x51c20c,null))[_0x1fb2('0x1d')](function(_0x4147c8){if(_0x4147c8){_0x2a4fe5=_0x4147c8;return _0x4147c8['getProactiveActions']({'raw':!![]});}})[_0x1fb2('0x1d')](function(_0x5f4bfb){if(_0x2a4fe5){if(_0x5f4bfb){_0x27994c=_0x5f4bfb;}}return require(_0x1fb2('0xfd'))['getLicense']();})[_0x1fb2('0x1d')](function(_0x4116f9){if(_0x4116f9){_0x47cc31=_0x4116f9['virtual'];_0x40ce22=_0x4116f9[_0x1fb2('0x77')];}})[_0x1fb2('0x1d')](function(){return db[_0x1fb2('0xac')][_0x1fb2('0x2a')]({'where':{'closed':![]}});})[_0x1fb2('0x1d')](function(_0x364b2d){_0x453bc1=_0x364b2d;if(_0x47cc31&&_0x364b2d>_0x47cc31){return db['License'][_0x1fb2('0x62')]({'where':{'id':0x1}})[_0x1fb2('0x1d')](function(_0x196129){if(_0x196129){_0x196129['increment'](_0x1fb2('0xfe'));}});}})[_0x1fb2('0x1d')](function(){if(_0x2a4fe5[_0x1fb2('0xfc')]&&_0x2a4fe5[_0x1fb2('0xfc')][_0x1fb2('0xff')]){var _0x150069=[];for(var _0xaae17b=0x0;_0xaae17b<_0x2a4fe5[_0x1fb2('0xfc')][_0x1fb2('0xff')]['length'];_0xaae17b++){var _0x4e8bb1=_0x2a4fe5[_0x1fb2('0xfc')][_0x1fb2('0xff')][_0xaae17b][_0x1fb2('0x31')]({'plain':!![]});_0x150069['push'](iftimePromise(_0x4e8bb1,_0x2a4fe5));}return BPromise[_0x1fb2('0x100')](_0x150069)[_0x1fb2('0x1d')](function(_0x41e1a2){return _[_0x1fb2('0x101')](_0x41e1a2);});}else{return!![];}})[_0x1fb2('0x1d')](function(_0x3d72bf){var _0x4e4d06=fs[_0x1fb2('0xce')](path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x102')),'utf8');var _0x254c76={'remote':_0x2a4fe5[_0x1fb2('0x103')],'query':querystring['stringify'](_[_0x1fb2('0x4e')](_0x2a4fe5[_0x1fb2('0x31')]({'plain':!![]}),{'customerIp':_0x4427f3[_0x1fb2('0x85')][_0x1fb2('0x9f')]||_0x4427f3[_0x1fb2('0x85')]['x-real-ip']||_0x4427f3[_0x1fb2('0x104')][_0x1fb2('0x105')]||_0x4427f3['ip'],'referer':_0x4427f3[_0x1fb2('0x85')][_0x1fb2('0x106')],'openedInteractions':_0x453bc1,'maxInteractions':_0x47cc31,'virtual':_0x40ce22['virtual'],'online':_0x3d72bf,'custom':_0x40ce22}))[_0x1fb2('0x107')](/'/g,'\x5c\x27')};_0x51c20c[_0x1fb2('0x37')](ejs[_0x1fb2('0xd1')](Mustache[_0x1fb2('0xd1')](_0x4e4d06,_0x254c76),{'proactiveActions':_0x27994c,'alignment':_0x2a4fe5[_0x1fb2('0x108')],'verticalAlignment':_0x2a4fe5['verticalAlignment'],'div_color':_0x2a4fe5[_0x1fb2('0xf2')],'text_color':_0x2a4fe5['textColor'],'button_color':_0x2a4fe5[_0x1fb2('0x109')],'background_color':_0x2a4fe5['backgroundColor']}));})[_0x1fb2('0x26')](handleError(_0x51c20c,null));};exports[_0x1fb2('0x10a')]=function(_0x5ba168,_0x430435,_0x15c6ae){return db[_0x1fb2('0x3c')][_0x1fb2('0x62')]({'where':{'id':_0x5ba168[_0x1fb2('0x54')]['id']}})['then'](handleEntityNotFound(_0x430435,null))[_0x1fb2('0x1d')](function(_0x168e8a){if(_0x168e8a){return db[_0x1fb2('0x10b')]['transaction'](function(_0xc84ddb){return db['ChatApplication'][_0x1fb2('0x5d')]({'where':{'ChatWebsiteId':_0x5ba168[_0x1fb2('0x54')]['id']},'transaction':_0xc84ddb})[_0x1fb2('0x1d')](function(_0x2e7267){var _0x480a18=_[_0x1fb2('0x3b')](_0x5ba168['body'],function(_0x34c981){_0x34c981[_0x1fb2('0x5f')]=_0x5ba168[_0x1fb2('0x54')]['id'];return _0x34c981;});return db[_0x1fb2('0x10c')][_0x1fb2('0xd7')](_0x480a18,{'transaction':_0xc84ddb});});})[_0x1fb2('0x1d')](function(){return db['ChatApplication'][_0x1fb2('0x10d')]({'where':{'ChatWebsiteId':_0x5ba168[_0x1fb2('0x54')]['id']},'order':_0x1fb2('0x10e')});});}})[_0x1fb2('0x1d')](respondWithResult(_0x430435,null))['catch'](handleError(_0x430435,null));};exports[_0x1fb2('0x10f')]=function(_0x509f2d,_0x2724b7,_0x30d4f8){var _0x2e543c={};var _0x77675e={};var _0x33c134;var _0x416bec;return db[_0x1fb2('0x3c')][_0x1fb2('0x62')]({'where':{'id':_0x509f2d[_0x1fb2('0x54')]['id']}})['then'](handleEntityNotFound(_0x2724b7,null))['then'](function(_0x104cda){if(_0x104cda){_0x33c134=_0x104cda;_0x77675e[_0x1fb2('0x40')]=_[_0x1fb2('0x42')](db[_0x1fb2('0x10c')]['rawAttributes']);_0x77675e['query']=_[_0x1fb2('0x42')](_0x509f2d[_0x1fb2('0x41')]);_0x77675e[_0x1fb2('0x43')]=_[_0x1fb2('0x44')](_0x77675e[_0x1fb2('0x40')],_0x77675e[_0x1fb2('0x41')]);_0x2e543c[_0x1fb2('0x45')]=_[_0x1fb2('0x44')](_0x77675e[_0x1fb2('0x40')],qs['fields'](_0x509f2d[_0x1fb2('0x41')][_0x1fb2('0x46')]));_0x2e543c[_0x1fb2('0x45')]=_0x2e543c[_0x1fb2('0x45')][_0x1fb2('0x47')]?_0x2e543c[_0x1fb2('0x45')]:_0x77675e[_0x1fb2('0x40')];_0x2e543c[_0x1fb2('0x64')]=qs[_0x1fb2('0x4a')](_0x509f2d['query'][_0x1fb2('0x4a')]);_0x2e543c[_0x1fb2('0x4b')]=qs[_0x1fb2('0x43')](_[_0x1fb2('0x4c')](_0x509f2d[_0x1fb2('0x41')],_0x77675e['filters']));if(_0x509f2d[_0x1fb2('0x41')][_0x1fb2('0x4d')]){_0x2e543c[_0x1fb2('0x4b')]=_[_0x1fb2('0x4e')](_0x2e543c['where'],{'$or':_[_0x1fb2('0x3b')](_0x2e543c[_0x1fb2('0x45')],function(_0x26e8ce){var _0x5cefc2={};_0x5cefc2[_0x26e8ce]={'$like':'%'+_0x509f2d[_0x1fb2('0x41')][_0x1fb2('0x4d')]+'%'};return _0x5cefc2;})});}_0x2e543c=_[_0x1fb2('0x4e')]({},_0x2e543c,_0x509f2d[_0x1fb2('0x4f')]);return _0x33c134[_0x1fb2('0x10f')](_0x2e543c);}})['then'](function(_0x392821){if(_0x392821){_0x416bec=_0x392821['length'];if(!_0x509f2d[_0x1fb2('0x41')][_0x1fb2('0x48')](_0x1fb2('0x49'))){_0x2e543c[_0x1fb2('0x2c')]=qs[_0x1fb2('0x2c')](_0x509f2d['query'][_0x1fb2('0x2c')]);_0x2e543c[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x509f2d[_0x1fb2('0x41')][_0x1fb2('0x2b')]);}return _0x33c134[_0x1fb2('0x10f')](_0x2e543c);}})[_0x1fb2('0x1d')](function(_0x2e298b){if(_0x2e298b){return _0x2e298b?{'count':_0x416bec,'rows':_0x2e298b}:null;}})['then'](respondWithResult(_0x2724b7,null))[_0x1fb2('0x26')](handleError(_0x2724b7,null));};exports[_0x1fb2('0x110')]=function(_0x140dd4,_0xe371b8,_0x477171){return db['chatProactiveAction'][_0x1fb2('0x55')]({'where':{'id':_0x140dd4[_0x1fb2('0x54')]['id']}})['then'](handleEntityNotFound(_0xe371b8,null))[_0x1fb2('0x1d')](function(_0x3d078d){if(_0x3d078d){return _0x3d078d['addProactiveActions'](_0x140dd4[_0x1fb2('0x5c')][_0x1fb2('0x66')],_[_0x1fb2('0xed')](_0x140dd4[_0x1fb2('0x5c')],[_0x1fb2('0x66'),'id'])||{});}})[_0x1fb2('0x1d')](respondWithResult(_0xe371b8,null))[_0x1fb2('0x26')](handleError(_0xe371b8,null));};exports[_0x1fb2('0x111')]=function(_0x258c8c,_0x458ced,_0x2336c0){var _0x197e15={};var _0x13a1ec={};var _0xe5a3f7;var _0x4af29b;return db[_0x1fb2('0x3c')][_0x1fb2('0x62')]({'where':{'id':_0x258c8c[_0x1fb2('0x54')]['id']}})['then'](handleEntityNotFound(_0x458ced,null))[_0x1fb2('0x1d')](function(_0x106f57){if(_0x106f57){_0xe5a3f7=_0x106f57;_0x13a1ec[_0x1fb2('0x40')]=_[_0x1fb2('0x42')](db[_0x1fb2('0x112')][_0x1fb2('0x63')]);_0x13a1ec[_0x1fb2('0x41')]=_[_0x1fb2('0x42')](_0x258c8c[_0x1fb2('0x41')]);_0x13a1ec[_0x1fb2('0x43')]=_['intersection'](_0x13a1ec[_0x1fb2('0x40')],_0x13a1ec['query']);_0x197e15['attributes']=_[_0x1fb2('0x44')](_0x13a1ec[_0x1fb2('0x40')],qs[_0x1fb2('0x46')](_0x258c8c[_0x1fb2('0x41')][_0x1fb2('0x46')]));_0x197e15[_0x1fb2('0x45')]=_0x197e15[_0x1fb2('0x45')][_0x1fb2('0x47')]?_0x197e15[_0x1fb2('0x45')]:_0x13a1ec[_0x1fb2('0x40')];_0x197e15[_0x1fb2('0x64')]=qs[_0x1fb2('0x4a')](_0x258c8c[_0x1fb2('0x41')][_0x1fb2('0x4a')]);_0x197e15[_0x1fb2('0x4b')]=qs['filters'](_['pick'](_0x258c8c[_0x1fb2('0x41')],_0x13a1ec[_0x1fb2('0x43')]));if(_0x258c8c[_0x1fb2('0x41')]['filter']){_0x197e15[_0x1fb2('0x4b')]=_['merge'](_0x197e15[_0x1fb2('0x4b')],{'$or':_[_0x1fb2('0x3b')](_0x197e15['attributes'],function(_0x4e4518){var _0x1bd12c={};_0x1bd12c[_0x4e4518]={'$like':'%'+_0x258c8c[_0x1fb2('0x41')]['filter']+'%'};return _0x1bd12c;})});}_0x197e15=_[_0x1fb2('0x4e')]({},_0x197e15,_0x258c8c[_0x1fb2('0x4f')]);return _0xe5a3f7[_0x1fb2('0x111')](_0x197e15);}})[_0x1fb2('0x1d')](function(_0x4da589){if(_0x4da589){_0x4af29b=_0x4da589[_0x1fb2('0x47')];if(!_0x258c8c[_0x1fb2('0x41')][_0x1fb2('0x48')](_0x1fb2('0x49'))){_0x197e15[_0x1fb2('0x2c')]=qs[_0x1fb2('0x2c')](_0x258c8c[_0x1fb2('0x41')][_0x1fb2('0x2c')]);_0x197e15[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x258c8c[_0x1fb2('0x41')]['offset']);}return _0xe5a3f7['getProactiveActions'](_0x197e15);}})[_0x1fb2('0x1d')](function(_0x10ca9d){if(_0x10ca9d){return _0x10ca9d?{'count':_0x4af29b,'rows':_0x10ca9d}:null;}})['then'](respondWithResult(_0x458ced,null))['catch'](handleError(_0x458ced,null));};exports[_0x1fb2('0x113')]=function(_0x39348c,_0xdc270,_0x4e1239){var _0x3848b3=_0x39348c[_0x1fb2('0x41')][_0x1fb2('0x114')]===_0x1fb2('0x115')?_0x1fb2('0x116'):_0x1fb2('0x117');return db[_0x1fb2('0x3c')]['find']({'attributes':['id',_0x3848b3],'where':{'id':_0x39348c[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0xdc270,null))[_0x1fb2('0x1d')](function(_0xc80913){if(_0xc80913){var _0x29bff5=_0xc80913[_0x3848b3];var _0x13559d=_0x29bff5&&_0x29bff5[_0x1fb2('0x118')]?_0x29bff5[_0x1fb2('0x118')]:[];_0xdc270[_0x1fb2('0x37')]({'fromKey':_[_0x1fb2('0x78')](_0x29bff5[_0x1fb2('0x119')])?undefined:_0x29bff5[_0x1fb2('0x119')],'count':_0x13559d['length'],'rows':_0x13559d});}})['catch'](handleError(_0xdc270,null));};exports['getOfflineMessages']=function(_0x47f4a5,_0x268b93,_0x564c54){var _0x42c351={'raw':![],'where':{}};var _0x4e6f98={};var _0x3bcc11={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x47f4a5[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x268b93,null))[_0x1fb2('0x1d')](function(_0x3499b0){if(_0x3499b0){_0x4e6f98['model']=_[_0x1fb2('0x42')](db[_0x1fb2('0xd4')][_0x1fb2('0x63')]);_0x4e6f98[_0x1fb2('0x41')]=_[_0x1fb2('0x42')](_0x47f4a5[_0x1fb2('0x41')]);_0x4e6f98[_0x1fb2('0x43')]=_[_0x1fb2('0x44')](_0x4e6f98['model'],_0x4e6f98['query']);_0x42c351[_0x1fb2('0x45')]=_['intersection'](_0x4e6f98[_0x1fb2('0x40')],qs['fields'](_0x47f4a5[_0x1fb2('0x41')][_0x1fb2('0x46')]));_0x42c351[_0x1fb2('0x45')]=_0x42c351[_0x1fb2('0x45')][_0x1fb2('0x47')]?_0x42c351[_0x1fb2('0x45')]:_0x4e6f98[_0x1fb2('0x40')];if(!_0x47f4a5[_0x1fb2('0x41')][_0x1fb2('0x48')](_0x1fb2('0x49'))){_0x42c351[_0x1fb2('0x2c')]=qs['limit'](_0x47f4a5['query'][_0x1fb2('0x2c')]);_0x42c351[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x47f4a5[_0x1fb2('0x41')][_0x1fb2('0x2b')]);}_0x42c351[_0x1fb2('0x64')]=qs[_0x1fb2('0x4a')](_0x47f4a5[_0x1fb2('0x41')][_0x1fb2('0x4a')]);_0x42c351[_0x1fb2('0x4b')]=qs[_0x1fb2('0x43')](_['pick'](_0x47f4a5['query'],_0x4e6f98[_0x1fb2('0x43')]));_0x42c351[_0x1fb2('0x4b')][_0x1fb2('0x5f')]=_0x3499b0['id'];if(_0x47f4a5[_0x1fb2('0x41')][_0x1fb2('0x4d')]){_0x42c351['where']=_[_0x1fb2('0x4e')](_0x42c351[_0x1fb2('0x4b')],{'$or':_[_0x1fb2('0x3b')](_0x42c351[_0x1fb2('0x45')],function(_0x4a7523){var _0x58c8f6={};_0x58c8f6[_0x4a7523]={'$like':'%'+_0x47f4a5[_0x1fb2('0x41')][_0x1fb2('0x4d')]+'%'};return _0x58c8f6;})});}_0x42c351=_[_0x1fb2('0x4e')]({},_0x42c351,_0x47f4a5[_0x1fb2('0x4f')]);return db[_0x1fb2('0xd4')][_0x1fb2('0x2a')]({'where':_0x42c351[_0x1fb2('0x4b')]})['then'](function(_0x37fb91){_0x3bcc11[_0x1fb2('0x2a')]=_0x37fb91;if(_0x47f4a5[_0x1fb2('0x41')][_0x1fb2('0x50')]){_0x42c351[_0x1fb2('0x51')]=[{'all':!![]}];}else{_0x42c351[_0x1fb2('0x51')]=[{'model':db[_0x1fb2('0x88')],'as':_0x1fb2('0x11a'),'required':![]},{'model':db[_0x1fb2('0x11b')],'as':_0x1fb2('0x11c'),'required':![]}];}return db[_0x1fb2('0xd4')][_0x1fb2('0x52')](_0x42c351);})[_0x1fb2('0x1d')](function(_0x22fe56){_0x3bcc11[_0x1fb2('0x11d')]=_0x22fe56;return _0x3bcc11;});}})[_0x1fb2('0x1d')](respondWithFilteredResult(_0x268b93,_0x42c351))['catch'](handleError(_0x268b93,null));};exports['addAgents']=function(_0x2b0d82,_0x111a98,_0x5368e4){return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x2b0d82[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x111a98,null))[_0x1fb2('0x1d')](function(_0x5e3e6c){if(_0x5e3e6c){return _0x5e3e6c[_0x1fb2('0x11e')](_0x2b0d82[_0x1fb2('0x5c')]['ids'],_[_0x1fb2('0xed')](_0x2b0d82['body'],[_0x1fb2('0x66'),'id'])||{})[_0x1fb2('0xb0')](function(_0x157a56){for(var _0x5c3492=0x0;_0x5c3492<_0x2b0d82['body'][_0x1fb2('0x66')][_0x1fb2('0x47')];_0x5c3492+=0x1){socket[_0x1fb2('0x11f')](_0x1fb2('0x120'),{'UserId':_0x2b0d82[_0x1fb2('0x5c')][_0x1fb2('0x66')][_0x5c3492],'ChatWebsiteId':_0x2b0d82[_0x1fb2('0x54')]['id']});}return _0x157a56;});}})[_0x1fb2('0x1d')](respondWithResult(_0x111a98,null))[_0x1fb2('0x26')](handleError(_0x111a98,null));};exports[_0x1fb2('0x121')]=function(_0x42eecb,_0x4c3613,_0xc83ae9){return db[_0x1fb2('0x3c')]['find']({'where':{'id':_0x42eecb[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x4c3613,null))[_0x1fb2('0x1d')](function(_0x1a5653){if(_0x1a5653){return _0x1a5653[_0x1fb2('0x121')](_0x42eecb[_0x1fb2('0x41')][_0x1fb2('0x66')])[_0x1fb2('0x1d')](function(){if(_[_0x1fb2('0x122')](_0x42eecb[_0x1fb2('0x41')][_0x1fb2('0x66')])){for(var _0x5d0b21=0x0;_0x5d0b21<_0x42eecb['query']['ids'][_0x1fb2('0x47')];_0x5d0b21+=0x1){socket['emit'](_0x1fb2('0x123'),{'UserId':Number(_0x42eecb[_0x1fb2('0x41')][_0x1fb2('0x66')][_0x5d0b21]),'ChatWebsiteId':Number(_0x42eecb[_0x1fb2('0x54')]['id'])});}}else{socket[_0x1fb2('0x11f')](_0x1fb2('0x123'),{'UserId':Number(_0x42eecb[_0x1fb2('0x41')][_0x1fb2('0x66')]),'ChatWebsiteId':Number(_0x42eecb[_0x1fb2('0x54')]['id'])});}});}})[_0x1fb2('0x1d')](respondWithStatusCode(_0x4c3613,null))[_0x1fb2('0x26')](handleError(_0x4c3613,null));};exports['getAgents']=function(_0x429d4c,_0x479566,_0x599abe){var _0x3ea25f={};var _0x4028f4={};var _0x9ae01b;var _0x2af4cb;return db[_0x1fb2('0x3c')][_0x1fb2('0x62')]({'where':{'id':_0x429d4c[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x479566,null))[_0x1fb2('0x1d')](function(_0x2bdf2e){if(_0x2bdf2e){_0x9ae01b=_0x2bdf2e;_0x4028f4[_0x1fb2('0x40')]=_[_0x1fb2('0x42')](db[_0x1fb2('0x124')][_0x1fb2('0x63')]);_0x4028f4[_0x1fb2('0x41')]=_[_0x1fb2('0x42')](_0x429d4c['query']);_0x4028f4[_0x1fb2('0x43')]=_['intersection'](_0x4028f4['model'],_0x4028f4['query']);_0x3ea25f[_0x1fb2('0x45')]=_['intersection'](_0x4028f4[_0x1fb2('0x40')],qs['fields'](_0x429d4c[_0x1fb2('0x41')]['fields']));_0x3ea25f[_0x1fb2('0x45')]=_0x3ea25f[_0x1fb2('0x45')][_0x1fb2('0x47')]?_0x3ea25f[_0x1fb2('0x45')]:_0x4028f4[_0x1fb2('0x40')];_0x3ea25f[_0x1fb2('0x64')]=qs[_0x1fb2('0x4a')](_0x429d4c[_0x1fb2('0x41')][_0x1fb2('0x4a')]);_0x3ea25f[_0x1fb2('0x4b')]=qs[_0x1fb2('0x43')](_[_0x1fb2('0x4c')](_0x429d4c[_0x1fb2('0x41')],_0x4028f4[_0x1fb2('0x43')]));if(_0x429d4c[_0x1fb2('0x41')]['filter']){_0x3ea25f[_0x1fb2('0x4b')]=_['merge'](_0x3ea25f[_0x1fb2('0x4b')],{'$or':_[_0x1fb2('0x3b')](_0x3ea25f[_0x1fb2('0x45')],function(_0x4f1bd4){var _0x2132d3={};_0x2132d3[_0x4f1bd4]={'$like':'%'+_0x429d4c[_0x1fb2('0x41')][_0x1fb2('0x4d')]+'%'};return _0x2132d3;})});}_0x3ea25f=_[_0x1fb2('0x4e')]({},_0x3ea25f,_0x429d4c[_0x1fb2('0x4f')]);return _0x9ae01b[_0x1fb2('0x125')](_0x3ea25f);}})[_0x1fb2('0x1d')](function(_0x5ddedc){if(_0x5ddedc){_0x2af4cb=_0x5ddedc[_0x1fb2('0x47')];if(!_0x429d4c['query'][_0x1fb2('0x48')](_0x1fb2('0x49'))){_0x3ea25f['limit']=qs[_0x1fb2('0x2c')](_0x429d4c[_0x1fb2('0x41')][_0x1fb2('0x2c')]);_0x3ea25f[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x429d4c['query'][_0x1fb2('0x2b')]);}return _0x9ae01b[_0x1fb2('0x125')](_0x3ea25f);}})['then'](function(_0xaf6a72){if(_0xaf6a72){return _0xaf6a72?{'count':_0x2af4cb,'rows':_0xaf6a72}:null;}})['then'](respondWithResult(_0x479566,null))[_0x1fb2('0x26')](handleError(_0x479566,null));}; \ No newline at end of file +var _0x4343=['firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','offline','files','ListId','email','Comments','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','Attachment','bulkCreate','MailServerOut','Smtp','service','host','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','openNewInteraction','MailAccountId','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','attachments','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','fullname','internal','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s','interval','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','increment','all','server/files/chat/iframe.js','utf8','x-real-ip','connection','replace','alignment','verticalAlignment','textColor','addApplications','transaction','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','omit','spread','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','findOne','pick','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split'];(function(_0x337e55,_0x2d50a0){var _0x38f3c8=function(_0x328b8d){while(--_0x328b8d){_0x337e55['push'](_0x337e55['shift']());}};_0x38f3c8(++_0x2d50a0);}(_0x4343,0x1ae));var _0x3434=function(_0x44f481,_0x5ab497){_0x44f481=_0x44f481-0x0;var _0xda19e0=_0x4343[_0x44f481];return _0xda19e0;};'use strict';var pdf=require(_0x3434('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3434('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3434('0x2'));var rp=require(_0x3434('0x3'));var moment=require('moment');var BPromise=require(_0x3434('0x4'));var Mustache=require('mustache');var util=require(_0x3434('0x5'));var path=require(_0x3434('0x6'));var sox=require(_0x3434('0x7'));var csv=require(_0x3434('0x8'));var ejs=require(_0x3434('0x9'));var fs=require('fs');var fs_extra=require(_0x3434('0xa'));var _=require(_0x3434('0xb'));var squel=require(_0x3434('0xc'));var crypto=require(_0x3434('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3434('0xe'));var toCsv=require(_0x3434('0x8'));var querystring=require(_0x3434('0xf'));var Papa=require(_0x3434('0x10'));var Redis=require(_0x3434('0x11'));var authService=require(_0x3434('0x12'));var qs=require(_0x3434('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3434('0x14'));var logger=require(_0x3434('0x15'))(_0x3434('0x16'));var utils=require(_0x3434('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3434('0x18'));var db=require(_0x3434('0x19'))['db'];config[_0x3434('0x1a')]=_[_0x3434('0x1b')](config[_0x3434('0x1a')],{'host':_0x3434('0x1c'),'port':0x18eb});var socket=require(_0x3434('0x1d'))(new Redis(config[_0x3434('0x1a')]));require('./chatWebsite.socket')[_0x3434('0x1e')](socket);var jayson=require(_0x3434('0x1f'));var client=jayson[_0x3434('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x3434('0x20')][_0x3434('0x21')]({'port':0x232a});var client9003=jayson[_0x3434('0x20')][_0x3434('0x21')]({'port':0x232b});var client9001=jayson[_0x3434('0x20')][_0x3434('0x21')]({'port':0x2329});function respondWithRpcPromise(_0x293b0f,_0x16d048,_0x2fff72,_0x497e6b){return new BPromise(function(_0x5d222c,_0x153951){var _0x191877=_0x497e6b||client;return _0x191877[_0x3434('0x22')](_0x293b0f,_0x2fff72)[_0x3434('0x23')](function(_0x23ce67){logger[_0x3434('0x24')](_0x3434('0x25'),_0x16d048,_0x3434('0x26'));logger['debug'](_0x3434('0x27'),_0x16d048,_0x3434('0x26'),JSON[_0x3434('0x28')](_0x23ce67));if(_0x23ce67[_0x3434('0x29')]){if(_0x23ce67[_0x3434('0x29')][_0x3434('0x2a')]===0x1f4){logger[_0x3434('0x29')]('ChatWebsite,\x20%s,\x20%s',_0x16d048,_0x23ce67[_0x3434('0x29')][_0x3434('0x2b')]);return _0x153951(_0x23ce67[_0x3434('0x29')][_0x3434('0x2b')]);}logger[_0x3434('0x29')]('ChatWebsite,\x20%s,\x20%s',_0x16d048,_0x23ce67['error'][_0x3434('0x2b')]);return _0x5d222c(_0x23ce67[_0x3434('0x29')][_0x3434('0x2b')]);}else{logger[_0x3434('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x16d048,'request\x20sent');_0x5d222c(_0x23ce67[_0x3434('0x2c')]['message']);}})[_0x3434('0x2d')](function(_0x3620e3){logger['error'](_0x3434('0x25'),_0x16d048,_0x3620e3);_0x153951(_0x3620e3);});});}function respondWithStatusCode(_0x2015a0,_0x115606){_0x115606=_0x115606||0xcc;return function(_0x232ae4){if(_0x232ae4){return _0x2015a0[_0x3434('0x2e')](_0x115606);}return _0x2015a0[_0x3434('0x2f')](_0x115606)[_0x3434('0x30')]();};}function respondWithResult(_0x50421b,_0x304825){_0x304825=_0x304825||0xc8;return function(_0x1cd1c4){if(_0x1cd1c4){return _0x50421b[_0x3434('0x2f')](_0x304825)[_0x3434('0x31')](_0x1cd1c4);}};}function respondWithFilteredResult(_0x31061a,_0x11f5f4){return function(_0x3e3dd0){if(_0x3e3dd0){var _0x20c543=_0x3e3dd0[_0x3434('0x32')],_0x2be175=_0x11f5f4[_0x3434('0x33')],_0x4d055c=_0x11f5f4[_0x3434('0x33')]+_0x11f5f4[_0x3434('0x34')],_0xbf96d2;if(_0x4d055c>=_0x20c543){_0x4d055c=_0x20c543;_0xbf96d2=0xc8;}else{_0xbf96d2=0xce;}_0x31061a[_0x3434('0x2f')](_0xbf96d2);return _0x31061a[_0x3434('0x35')](_0x3434('0x36'),_0x2be175+'-'+_0x4d055c+'/'+_0x20c543)[_0x3434('0x31')](_0x3e3dd0);}return null;};}function patchUpdates(_0x7077fd){return function(_0x3be92f){try{jsonpatch['apply'](_0x3be92f,_0x7077fd,!![]);}catch(_0x2af465){return BPromise[_0x3434('0x37')](_0x2af465);}return _0x3be92f[_0x3434('0x38')]();};}function saveUpdates(_0x75420c,_0x1b69e7){return function(_0x8dd6cb){if(_0x8dd6cb){return _0x8dd6cb[_0x3434('0x39')](_0x75420c)[_0x3434('0x23')](function(_0x574cd0){return _0x574cd0;});}return null;};}function removeEntity(_0x5935d6,_0x4b2aea){return function(_0x1d6d07){if(_0x1d6d07){return _0x1d6d07['destroy']()['then'](function(){var _0x575abc=_0x1d6d07[_0x3434('0x3a')]({'plain':!![]});var _0x2995dd=_0x3434('0x3b');return db[_0x3434('0x3c')]['destroy']({'where':{'type':_0x2995dd,'resourceId':_0x575abc['id']}})[_0x3434('0x23')](function(){return _0x1d6d07;});})[_0x3434('0x23')](function(){_0x5935d6[_0x3434('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x176d3c,_0x2cb4b1){return function(_0xedcebf){if(!_0xedcebf){_0x176d3c[_0x3434('0x2e')](0x194);}return _0xedcebf;};}function handleError(_0x1d3f71,_0x1df9d1){_0x1df9d1=_0x1df9d1||0x1f4;return function(_0x490da6){logger[_0x3434('0x29')](_0x490da6[_0x3434('0x3d')]);if(_0x490da6[_0x3434('0x3e')]){delete _0x490da6[_0x3434('0x3e')];}_0x1d3f71[_0x3434('0x2f')](_0x1df9d1)[_0x3434('0x3f')](_0x490da6);};}exports[_0x3434('0x40')]=function(_0x491745,_0x52659c){var _0x139e7c={'include':[{'model':db[_0x3434('0x41')],'as':_0x3434('0x42')}]},_0xe3c95d={},_0x308063={'count':0x0,'rows':[]};var _0x354283=_[_0x3434('0x43')](db[_0x3434('0x44')][_0x3434('0x45')],function(_0x5b1d26){return{'name':_0x5b1d26['fieldName'],'type':_0x5b1d26[_0x3434('0x46')][_0x3434('0x47')]};});_0xe3c95d['model']=_[_0x3434('0x43')](_0x354283,_0x3434('0x3e'));_0xe3c95d[_0x3434('0x48')]=_[_0x3434('0x49')](_0x491745['query']);_0xe3c95d['filters']=_[_0x3434('0x4a')](_0xe3c95d[_0x3434('0x4b')],_0xe3c95d[_0x3434('0x48')]);_0x139e7c[_0x3434('0x4c')]=_[_0x3434('0x4a')](_0xe3c95d[_0x3434('0x4b')],qs[_0x3434('0x4d')](_0x491745[_0x3434('0x48')][_0x3434('0x4d')]));_0x139e7c['attributes']=_0x139e7c[_0x3434('0x4c')][_0x3434('0x4e')]?_0x139e7c[_0x3434('0x4c')]:_0xe3c95d['model'];if(!_0x491745[_0x3434('0x48')][_0x3434('0x4f')]('nolimit')){_0x139e7c['limit']=qs[_0x3434('0x34')](_0x491745[_0x3434('0x48')][_0x3434('0x34')]);_0x139e7c['offset']=qs[_0x3434('0x33')](_0x491745['query']['offset']);}_0x139e7c[_0x3434('0x50')]=qs[_0x3434('0x51')](_0x491745[_0x3434('0x48')]['sort']);_0x139e7c[_0x3434('0x52')]=qs[_0x3434('0x53')](_['pick'](_0x491745[_0x3434('0x48')],_0xe3c95d[_0x3434('0x53')]),_0x354283);if(_0x491745[_0x3434('0x48')][_0x3434('0x54')]){_0x139e7c[_0x3434('0x52')]=_[_0x3434('0x55')](_0x139e7c[_0x3434('0x52')],{'$or':_[_0x3434('0x43')](_0x354283,function(_0x47d9ad){if(_0x47d9ad[_0x3434('0x46')]!=='VIRTUAL'){var _0x1f7f08={};_0x1f7f08[_0x47d9ad[_0x3434('0x3e')]]={'$like':'%'+_0x491745['query'][_0x3434('0x54')]+'%'};return _0x1f7f08;}})});}_0x139e7c=_[_0x3434('0x55')]({},_0x139e7c,_0x491745[_0x3434('0x56')]);var _0x4b0a03={'where':_0x139e7c[_0x3434('0x52')]};return db['ChatWebsite'][_0x3434('0x32')](_0x4b0a03)['then'](function(_0x504db8){_0x308063['count']=_0x504db8;if(_0x491745[_0x3434('0x48')][_0x3434('0x57')]){_0x139e7c[_0x3434('0x58')]=[{'all':!![]}];}return db[_0x3434('0x44')][_0x3434('0x59')](_0x139e7c);})[_0x3434('0x23')](function(_0x185621){_0x308063[_0x3434('0x5a')]=_0x185621;return _0x308063;})[_0x3434('0x23')](respondWithFilteredResult(_0x52659c,_0x139e7c))[_0x3434('0x2d')](handleError(_0x52659c,null));};exports[_0x3434('0x5b')]=function(_0xa975f2,_0x4e0987){var _0x3f687c={'raw':![],'where':{'id':_0xa975f2[_0x3434('0x5c')]['id']},'include':[{'model':db[_0x3434('0x41')],'as':_0x3434('0x42')}]},_0x24f6f1={};_0x24f6f1[_0x3434('0x4b')]=_[_0x3434('0x49')](db[_0x3434('0x44')][_0x3434('0x45')]);_0x24f6f1[_0x3434('0x48')]=_[_0x3434('0x49')](_0xa975f2[_0x3434('0x48')]);_0x24f6f1[_0x3434('0x53')]=_[_0x3434('0x4a')](_0x24f6f1[_0x3434('0x4b')],_0x24f6f1[_0x3434('0x48')]);_0x3f687c[_0x3434('0x4c')]=_[_0x3434('0x4a')](_0x24f6f1[_0x3434('0x4b')],qs[_0x3434('0x4d')](_0xa975f2[_0x3434('0x48')]['fields']));_0x3f687c[_0x3434('0x4c')]=_0x3f687c['attributes'][_0x3434('0x4e')]?_0x3f687c[_0x3434('0x4c')]:_0x24f6f1[_0x3434('0x4b')];if(_0xa975f2[_0x3434('0x48')]['includeAll']){_0x3f687c[_0x3434('0x58')]=[{'all':!![]}];}_0x3f687c=_[_0x3434('0x55')]({},_0x3f687c,_0xa975f2['options']);return db[_0x3434('0x44')][_0x3434('0x5d')](_0x3f687c)['then'](handleEntityNotFound(_0x4e0987,null))[_0x3434('0x23')](respondWithResult(_0x4e0987,null))['catch'](handleError(_0x4e0987,null));};exports[_0x3434('0x5e')]=function(_0x2ca14e,_0x5cbff5){return db['ChatWebsite'][_0x3434('0x5e')](_0x2ca14e[_0x3434('0x5f')],{})[_0x3434('0x23')](function(_0x248ae1){var _0x33274d=_0x2ca14e[_0x3434('0x60')]['get']({'plain':!![]});if(!_0x33274d)throw new Error(_0x3434('0x61'));if(_0x33274d[_0x3434('0x62')]===_0x3434('0x60')){var _0x44d96b=_0x248ae1[_0x3434('0x3a')]({'plain':!![]});var _0x33ad22=_0x3434('0x3b');return db[_0x3434('0x63')][_0x3434('0x5d')]({'where':{'name':_0x33ad22,'userProfileId':_0x33274d[_0x3434('0x64')]},'raw':!![]})['then'](function(_0x104a4f){if(_0x104a4f&&_0x104a4f[_0x3434('0x65')]===0x0){return db['UserProfileResource'][_0x3434('0x5e')]({'name':_0x44d96b['name'],'resourceId':_0x44d96b['id'],'type':_0x104a4f['name'],'sectionId':_0x104a4f['id']},{})['then'](function(){return _0x248ae1;});}else{return _0x248ae1;}})[_0x3434('0x2d')](function(_0x43866a){logger[_0x3434('0x29')](_0x3434('0x66'),_0x43866a);throw _0x43866a;});}return _0x248ae1;})[_0x3434('0x23')](respondWithResult(_0x5cbff5,0xc9))['catch'](handleError(_0x5cbff5,null));};exports[_0x3434('0x39')]=function(_0x251c1c,_0x444e5f){if(_0x251c1c[_0x3434('0x5f')]['id']){delete _0x251c1c[_0x3434('0x5f')]['id'];}return db['ChatWebsite'][_0x3434('0x5d')]({'where':{'id':_0x251c1c[_0x3434('0x5c')]['id']},'include':[{'model':db[_0x3434('0x41')],'as':_0x3434('0x42')}]})[_0x3434('0x23')](handleEntityNotFound(_0x444e5f,null))['then'](saveUpdates(_0x251c1c[_0x3434('0x5f')],null))['then'](respondWithResult(_0x444e5f,null))[_0x3434('0x2d')](handleError(_0x444e5f,null));};exports[_0x3434('0x67')]=function(_0x228330,_0x553875){return db[_0x3434('0x44')][_0x3434('0x5d')]({'where':{'id':_0x228330['params']['id']}})[_0x3434('0x23')](handleEntityNotFound(_0x553875,null))[_0x3434('0x23')](removeEntity(_0x553875,null))[_0x3434('0x2d')](handleError(_0x553875,null));};exports['describe']=function(_0x26165f,_0x168bd0){return db[_0x3434('0x44')][_0x3434('0x68')]()[_0x3434('0x23')](respondWithResult(_0x168bd0,null))['catch'](handleError(_0x168bd0,null));};exports[_0x3434('0x69')]=function(_0x5416d1,_0x2f38d6,_0xcc3e9f){if(_0x5416d1['body']['id']){delete _0x5416d1[_0x3434('0x5f')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x5416d1['params']['id']}})['then'](handleEntityNotFound(_0x2f38d6,null))[_0x3434('0x23')](function(_0x33a781){if(_0x33a781){_0x5416d1[_0x3434('0x5f')][_0x3434('0x6a')]=_0x33a781['id'];return db[_0x3434('0x6b')][_0x3434('0x5e')](_0x5416d1[_0x3434('0x5f')]);}})['then'](respondWithResult(_0x2f38d6,null))['catch'](handleError(_0x2f38d6,null));};exports[_0x3434('0x6c')]=function(_0x396494,_0x53bb3c,_0x2b434b){var _0x480ef2={'raw':![],'where':{}};var _0x5d6ec4={};var _0x492dc3={'count':0x0,'rows':[]};return db[_0x3434('0x44')]['findOne']({'where':{'id':_0x396494['params']['id']}})[_0x3434('0x23')](handleEntityNotFound(_0x53bb3c,null))[_0x3434('0x23')](function(_0x1cd9ac){if(_0x1cd9ac){_0x5d6ec4[_0x3434('0x4b')]=_[_0x3434('0x49')](db[_0x3434('0x6b')][_0x3434('0x45')]);_0x5d6ec4[_0x3434('0x48')]=_['keys'](_0x396494[_0x3434('0x48')]);_0x5d6ec4['filters']=_[_0x3434('0x4a')](_0x5d6ec4['model'],_0x5d6ec4['query']);_0x480ef2['attributes']=_[_0x3434('0x4a')](_0x5d6ec4[_0x3434('0x4b')],qs['fields'](_0x396494['query'][_0x3434('0x4d')]));_0x480ef2['attributes']=_0x480ef2['attributes'][_0x3434('0x4e')]?_0x480ef2[_0x3434('0x4c')]:_0x5d6ec4[_0x3434('0x4b')];if(!_0x396494[_0x3434('0x48')]['hasOwnProperty'](_0x3434('0x6d'))){_0x480ef2[_0x3434('0x34')]=qs[_0x3434('0x34')](_0x396494['query'][_0x3434('0x34')]);_0x480ef2[_0x3434('0x33')]=qs[_0x3434('0x33')](_0x396494[_0x3434('0x48')][_0x3434('0x33')]);}_0x480ef2[_0x3434('0x50')]=qs['sort'](_0x396494[_0x3434('0x48')][_0x3434('0x51')]);_0x480ef2[_0x3434('0x52')]=qs[_0x3434('0x53')](_['pick'](_0x396494['query'],_0x5d6ec4[_0x3434('0x53')]));_0x480ef2[_0x3434('0x52')][_0x3434('0x6a')]=_0x1cd9ac['id'];if(_0x396494[_0x3434('0x48')]['filter']){_0x480ef2[_0x3434('0x52')]=_[_0x3434('0x55')](_0x480ef2['where'],{'$or':_[_0x3434('0x43')](_0x480ef2['attributes'],function(_0x4c1f41){var _0x4d1f4c={};_0x4d1f4c[_0x4c1f41]={'$like':'%'+_0x396494['query']['filter']+'%'};return _0x4d1f4c;})});}_0x480ef2=_[_0x3434('0x55')]({},_0x480ef2,_0x396494[_0x3434('0x56')]);return db['Disposition'][_0x3434('0x32')]({'where':_0x480ef2['where']})[_0x3434('0x23')](function(_0x457ddc){_0x492dc3[_0x3434('0x32')]=_0x457ddc;if(_0x396494[_0x3434('0x48')][_0x3434('0x57')]){_0x480ef2[_0x3434('0x58')]=[{'all':!![]}];}return db[_0x3434('0x6b')][_0x3434('0x59')](_0x480ef2);})[_0x3434('0x23')](function(_0x11bcad){_0x492dc3['rows']=_0x11bcad;return _0x492dc3;});}})[_0x3434('0x23')](respondWithFilteredResult(_0x53bb3c,_0x480ef2))[_0x3434('0x2d')](handleError(_0x53bb3c,null));};exports['removeDispositions']=function(_0x232b60,_0x8c5977,_0x3eeecb){return db[_0x3434('0x44')][_0x3434('0x5d')]({'where':{'id':_0x232b60[_0x3434('0x5c')]['id']}})['then'](handleEntityNotFound(_0x8c5977,null))['then'](function(_0x5329e0){if(_0x5329e0){return _0x5329e0[_0x3434('0x6e')](_0x232b60[_0x3434('0x48')][_0x3434('0x6f')]);}})['then'](respondWithStatusCode(_0x8c5977,null))[_0x3434('0x2d')](handleError(_0x8c5977,null));};exports[_0x3434('0x70')]=function(_0x25cb42,_0x94f65e,_0x28ec2c){if(_0x25cb42[_0x3434('0x5f')]['id']){delete _0x25cb42['body']['id'];}return db[_0x3434('0x44')][_0x3434('0x5d')]({'where':{'id':_0x25cb42[_0x3434('0x5c')]['id']}})['then'](handleEntityNotFound(_0x94f65e,null))[_0x3434('0x23')](function(_0x18b5bb){if(_0x18b5bb){_0x25cb42['body']['ChatWebsiteId']=_0x18b5bb['id'];return db[_0x3434('0x71')]['create'](_0x25cb42[_0x3434('0x5f')]);}})['then'](respondWithResult(_0x94f65e,null))[_0x3434('0x2d')](handleError(_0x94f65e,null));};exports['getAnswers']=function(_0x3e0b43,_0x408433,_0x49a2ca){var _0x42130e={'raw':![],'where':{}};var _0x452c79={};var _0x492d3a={'count':0x0,'rows':[]};return db[_0x3434('0x44')][_0x3434('0x72')]({'where':{'id':_0x3e0b43[_0x3434('0x5c')]['id']}})[_0x3434('0x23')](handleEntityNotFound(_0x408433,null))['then'](function(_0x865cf8){if(_0x865cf8){_0x452c79[_0x3434('0x4b')]=_['keys'](db[_0x3434('0x71')][_0x3434('0x45')]);_0x452c79[_0x3434('0x48')]=_[_0x3434('0x49')](_0x3e0b43[_0x3434('0x48')]);_0x452c79[_0x3434('0x53')]=_[_0x3434('0x4a')](_0x452c79[_0x3434('0x4b')],_0x452c79[_0x3434('0x48')]);_0x42130e[_0x3434('0x4c')]=_[_0x3434('0x4a')](_0x452c79[_0x3434('0x4b')],qs[_0x3434('0x4d')](_0x3e0b43[_0x3434('0x48')]['fields']));_0x42130e[_0x3434('0x4c')]=_0x42130e[_0x3434('0x4c')][_0x3434('0x4e')]?_0x42130e[_0x3434('0x4c')]:_0x452c79['model'];if(!_0x3e0b43[_0x3434('0x48')][_0x3434('0x4f')](_0x3434('0x6d'))){_0x42130e[_0x3434('0x34')]=qs[_0x3434('0x34')](_0x3e0b43['query'][_0x3434('0x34')]);_0x42130e[_0x3434('0x33')]=qs[_0x3434('0x33')](_0x3e0b43[_0x3434('0x48')][_0x3434('0x33')]);}_0x42130e[_0x3434('0x50')]=qs[_0x3434('0x51')](_0x3e0b43[_0x3434('0x48')][_0x3434('0x51')]);_0x42130e['where']=qs[_0x3434('0x53')](_[_0x3434('0x73')](_0x3e0b43[_0x3434('0x48')],_0x452c79[_0x3434('0x53')]));_0x42130e[_0x3434('0x52')][_0x3434('0x6a')]=_0x865cf8['id'];if(_0x3e0b43[_0x3434('0x48')][_0x3434('0x54')]){_0x42130e[_0x3434('0x52')]=_[_0x3434('0x55')](_0x42130e['where'],{'$or':_[_0x3434('0x43')](_0x42130e[_0x3434('0x4c')],function(_0x1a4710){var _0x408b34={};_0x408b34[_0x1a4710]={'$like':'%'+_0x3e0b43['query']['filter']+'%'};return _0x408b34;})});}_0x42130e=_[_0x3434('0x55')]({},_0x42130e,_0x3e0b43['options']);return db['CannedAnswer'][_0x3434('0x32')]({'where':_0x42130e[_0x3434('0x52')]})[_0x3434('0x23')](function(_0x3a586e){_0x492d3a[_0x3434('0x32')]=_0x3a586e;if(_0x3e0b43['query'][_0x3434('0x57')]){_0x42130e[_0x3434('0x58')]=[{'all':!![]}];}return db[_0x3434('0x71')]['findAll'](_0x42130e);})[_0x3434('0x23')](function(_0x2d25b1){_0x492d3a['rows']=_0x2d25b1;return _0x492d3a;});}})[_0x3434('0x23')](respondWithFilteredResult(_0x408433,_0x42130e))[_0x3434('0x2d')](handleError(_0x408433,null));};exports[_0x3434('0x74')]=function(_0x4af2fa,_0x176c30,_0x261449){return db['ChatWebsite']['find']({'where':{'id':_0x4af2fa[_0x3434('0x5c')]['id']}})[_0x3434('0x23')](handleEntityNotFound(_0x176c30,null))[_0x3434('0x23')](function(_0x16d5c8){if(_0x16d5c8){return _0x16d5c8['removeAnswers'](_0x4af2fa[_0x3434('0x48')][_0x3434('0x6f')]);}})[_0x3434('0x23')](respondWithStatusCode(_0x176c30,null))[_0x3434('0x2d')](handleError(_0x176c30,null));};exports[_0x3434('0x75')]=function(_0x3d8d1b,_0x833f0a,_0x5ef9db){_0x3d8d1b[_0x3434('0x5f')]['sitepic']=_0x3d8d1b[_0x3434('0x76')][_0x3434('0x77')];return db[_0x3434('0x44')]['find']({'where':{'id':_0x3d8d1b[_0x3434('0x5c')]['id']}})['then'](handleEntityNotFound(_0x833f0a,null))[_0x3434('0x23')](saveUpdates(_0x3d8d1b[_0x3434('0x5f')],null))[_0x3434('0x23')](respondWithResult(_0x833f0a,null))['catch'](handleError(_0x833f0a,null));};exports[_0x3434('0x78')]=function(_0x23bb9a,_0x36c58d,_0x29008d){_0x23bb9a['body'][_0x3434('0x79')]=_0x23bb9a[_0x3434('0x76')][_0x3434('0x77')];return db[_0x3434('0x44')][_0x3434('0x5d')]({'where':{'id':_0x23bb9a[_0x3434('0x5c')]['id']}})['then'](handleEntityNotFound(_0x36c58d,null))[_0x3434('0x23')](saveUpdates(_0x23bb9a[_0x3434('0x5f')],null))[_0x3434('0x23')](respondWithResult(_0x36c58d,null))['catch'](handleError(_0x36c58d,null));};exports[_0x3434('0x7a')]=function(_0x4d0cc4,_0x4c2a03,_0x3710b3){_0x4d0cc4[_0x3434('0x5f')][_0x3434('0x7b')]=_0x4d0cc4[_0x3434('0x76')][_0x3434('0x77')];return db[_0x3434('0x44')][_0x3434('0x5d')]({'where':{'id':_0x4d0cc4[_0x3434('0x5c')]['id']}})[_0x3434('0x23')](handleEntityNotFound(_0x4c2a03,null))[_0x3434('0x23')](saveUpdates(_0x4d0cc4[_0x3434('0x5f')],null))[_0x3434('0x23')](respondWithResult(_0x4c2a03,null))[_0x3434('0x2d')](handleError(_0x4c2a03,null));};exports[_0x3434('0x7c')]=function(_0x1b67cb,_0x71c8d6,_0x4a7ae0){_0x1b67cb['body'][_0x3434('0x7d')]=_0x1b67cb['file'][_0x3434('0x77')];return db[_0x3434('0x44')][_0x3434('0x5d')]({'where':{'id':_0x1b67cb[_0x3434('0x5c')]['id']}})['then'](handleEntityNotFound(_0x71c8d6,null))['then'](saveUpdates(_0x1b67cb['body'],null))[_0x3434('0x23')](respondWithResult(_0x71c8d6,null))[_0x3434('0x2d')](handleError(_0x71c8d6,null));};exports[_0x3434('0x7e')]=function(_0x1da8ff,_0x2093e6,_0x26f4a6){var _0x37da6b=path[_0x3434('0x7f')](config[_0x3434('0x80')],_0x3434('0x81'));var _0x5edd5a={'where':{'id':_0x1da8ff[_0x3434('0x5c')]['id']},'attributes':['id',_0x3434('0x82')],'raw':!![]};var _0xc34fee=![];return require(_0x3434('0x18'))[_0x3434('0x83')]()[_0x3434('0x23')](function(_0x59c8bc){if(_0x59c8bc){_0xc34fee=_0x59c8bc[_0x3434('0x84')];}})['then'](function(){return db[_0x3434('0x44')][_0x3434('0x5d')](_0x5edd5a);})[_0x3434('0x23')](handleEntityNotFound(_0x2093e6,null))['then'](function(_0x54db76){if(_0x54db76){if(!_[_0x3434('0x85')](_0x54db76['sitepic'])){if(fs[_0x3434('0x86')](path[_0x3434('0x7f')](config[_0x3434('0x80')],_0x3434('0x87'),_0x54db76['sitepic']))&&_0xc34fee){_0x37da6b=path[_0x3434('0x7f')](config[_0x3434('0x80')],'server/files/images/logos/',_0x54db76[_0x3434('0x82')]);}}return _0x2093e6[_0x3434('0x88')](_0x37da6b);}})['catch'](handleError(_0x2093e6,null));};exports['getAvatar']=function(_0x57503c,_0x5cab41,_0x239c60){var _0x22cc27=path[_0x3434('0x7f')](config[_0x3434('0x80')],_0x3434('0x89'));var _0x41f655={'where':{'id':_0x57503c[_0x3434('0x5c')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0x3434('0x5d')](_0x41f655)['then'](handleEntityNotFound(_0x5cab41,null))[_0x3434('0x23')](function(_0x18d90c){if(_0x18d90c){if(!_['isNil'](_0x18d90c[_0x3434('0x79')])){if(fs[_0x3434('0x86')](path[_0x3434('0x7f')](config[_0x3434('0x80')],_0x3434('0x8a'),_0x18d90c[_0x3434('0x79')]))){_0x22cc27=path[_0x3434('0x7f')](config['root'],_0x3434('0x8a'),_0x18d90c[_0x3434('0x79')]);}}return _0x5cab41[_0x3434('0x88')](_0x22cc27);}})[_0x3434('0x2d')](handleError(_0x5cab41,null));};exports[_0x3434('0x8b')]=function(_0xd5c68f,_0x125699,_0x5d804a){var _0x4ba8ba=path['join'](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x46ad9c={'where':{'id':_0xd5c68f[_0x3434('0x5c')]['id']},'attributes':['id',_0x3434('0x7b'),_0x3434('0x8c')],'raw':!![]};return db['ChatWebsite']['find'](_0x46ad9c)['then'](handleEntityNotFound(_0x125699,null))[_0x3434('0x23')](function(_0x567489){if(_0x567489){if(!_[_0x3434('0x85')](_0x567489[_0x3434('0x7b')])){if(fs[_0x3434('0x86')](path[_0x3434('0x7f')](config[_0x3434('0x80')],_0x3434('0x8a'),_0x567489[_0x3434('0x7b')]))&&_0x567489[_0x3434('0x8c')]){_0x4ba8ba=path[_0x3434('0x7f')](config[_0x3434('0x80')],_0x3434('0x8a'),_0x567489[_0x3434('0x7b')]);}}return _0x125699[_0x3434('0x88')](_0x4ba8ba);}})[_0x3434('0x2d')](handleError(_0x125699,null));};exports[_0x3434('0x8d')]=function(_0x4418f7,_0x3a3539,_0x339972){var _0x38ecb2=path[_0x3434('0x7f')](config['root'],_0x3434('0x8e'));var _0x2498a0={'where':{'id':_0x4418f7[_0x3434('0x5c')]['id']},'attributes':['id',_0x3434('0x7d')],'raw':!![]};return db['ChatWebsite'][_0x3434('0x5d')](_0x2498a0)[_0x3434('0x23')](handleEntityNotFound(_0x3a3539,null))['then'](function(_0x135d2e){if(_0x135d2e){if(!_['isNil'](_0x135d2e['systemAvatar'])){if(fs['existsSync'](path[_0x3434('0x7f')](config['root'],_0x3434('0x8a'),_0x135d2e[_0x3434('0x7d')]))){_0x38ecb2=path[_0x3434('0x7f')](config[_0x3434('0x80')],_0x3434('0x8a'),_0x135d2e[_0x3434('0x7d')]);}}return _0x3a3539[_0x3434('0x88')](_0x38ecb2);}})[_0x3434('0x2d')](handleError(_0x3a3539,null));};exports[_0x3434('0x8f')]=function(_0x2541a0,_0x2514c7,_0x18e82d){var _0x1e32aa=require(_0x3434('0x90'));var _0x238f4f=new _0x1e32aa();var _0x202adc=_0x238f4f[_0x3434('0x91')](_0x2541a0[_0x3434('0x92')]['user-agent'])[_0x3434('0x93')]();var _0x573f9b={'body':_0x2541a0[_0x3434('0x5f')],'channel':_0x3434('0x94')};var _0x4683fd=[];var _0x452d53=[];var _0x2cd6bc={};var _0x3c483e=![];return db[_0x3434('0x95')]['describe']()[_0x3434('0x23')](function(_0x43d428){if(!_0x43d428){throw new db['Sequelize'][(_0x3434('0x96'))](_0x3434('0x97'));}_0x4683fd=_[_0x3434('0x98')](_['keys'](_0x43d428),['createdAt',_0x3434('0x99')]);_0x452d53=_[_0x3434('0x98')](_['keys'](_0x43d428),[_0x3434('0x9a'),'updatedAt','CompanyId','ListId']);if(_0x2541a0[_0x3434('0x5f')]['id']){delete _0x2541a0[_0x3434('0x5f')]['id'];}if(_['isNil'](_0x2541a0[_0x3434('0x5f')][_0x3434('0x9b')])){throw new db['Sequelize'][(_0x3434('0x96'))](_0x3434('0x9c'));}if(_[_0x3434('0x85')](_0x2541a0[_0x3434('0x5f')][_0x3434('0x5f')])||_0x2541a0[_0x3434('0x5f')][_0x3434('0x5f')]===''){throw new db['Sequelize'][(_0x3434('0x96'))](_0x3434('0x9d'));}if(_['isNil'](_0x2541a0[_0x3434('0x5f')][_0x3434('0x9e')])){throw new db[(_0x3434('0x9f'))]['ValidationError'](_0x3434('0xa0')+_0x452d53);}if(!_['includes'](_0x452d53,_0x2541a0['body']['mapKey'])){throw new db[(_0x3434('0x9f'))]['ValidationError'](_0x3434('0xa1')+_0x452d53);}_0x2cd6bc[_0x2541a0['body'][_0x3434('0x9e')]]=_0x2541a0[_0x3434('0x5f')][_0x3434('0x9b')];})[_0x3434('0x23')](function(){return db[_0x3434('0x44')][_0x3434('0x5d')]({'where':{'id':_0x2541a0[_0x3434('0x5c')]['id']},'include':[{'model':db[_0x3434('0xa2')],'as':_0x3434('0xa3'),'include':[{'model':db[_0x3434('0x95')],'as':_0x3434('0xa4'),'where':_0x2cd6bc,'limit':0x1,'order':[[_0x3434('0x99'),_0x3434('0xa5')]]}]},{'model':db[_0x3434('0xa6')],'as':_0x3434('0xa7')}]});})[_0x3434('0x23')](handleEntityNotFound(_0x2514c7,null))[_0x3434('0x23')](function(_0x1e62b7){if(_0x1e62b7&&_0x1e62b7[_0x3434('0xa3')]){_0x573f9b[_0x3434('0xa8')]=_0x1e62b7;_0x573f9b[_0x3434('0xa9')]=_0x1e62b7[_0x3434('0xa7')];_0x573f9b[_0x3434('0xaa')]=_0x1e62b7[_0x3434('0xa3')];_0x573f9b[_0x3434('0xa9')]=_[_0x3434('0xab')](_0x573f9b[_0x3434('0xa9')],[_0x3434('0xac')],[_0x3434('0xad')]);if(_0x573f9b['account'][_0x3434('0xa7')]){delete _0x573f9b[_0x3434('0xa8')][_0x3434('0xa7')];}if(_0x573f9b[_0x3434('0xa8')][_0x3434('0xa3')]&&_0x573f9b[_0x3434('0xa8')][_0x3434('0xa3')][_0x3434('0xa4')][_0x3434('0x4e')]){return _0x573f9b[_0x3434('0xa8')][_0x3434('0xa3')][_0x3434('0xa4')][0x0];}var _0x375bd2=_[_0x3434('0x1b')](_0x2541a0[_0x3434('0x5f')],{'firstName':_0x2541a0[_0x3434('0x5f')][_0x3434('0x9b')],'ListId':_0x1e62b7['ListId']});_0x375bd2[_0x2541a0['body'][_0x3434('0x9e')]]=_0x2541a0[_0x3434('0x5f')][_0x3434('0x9b')];return db[_0x3434('0x95')][_0x3434('0x5e')](_0x375bd2,{'fields':_0x4683fd,'raw':!![]});}})[_0x3434('0x23')](handleEntityNotFound(_0x2514c7,null))[_0x3434('0x23')](function(_0x138d0e){_0x573f9b[_0x3434('0xae')]=_0x138d0e;var _0x5f14f3=_0x2541a0[_0x3434('0x5f')][_0x3434('0xaf')];if(_0x2541a0[_0x3434('0x92')][_0x3434('0xb0')]){_0x5f14f3=_0x2541a0[_0x3434('0x92')][_0x3434('0xb0')];}else if(_0x2541a0[_0x3434('0x92')][_0x3434('0xb1')]){_0x5f14f3=_[_0x3434('0xb2')](_0x2541a0[_0x3434('0x92')]['x-forwarded-for'][_0x3434('0xb3')](','));}if(_0x138d0e){var _0x35d484={'ContactId':_0x138d0e['id'],'ChatWebsiteId':_0x2541a0[_0x3434('0x5c')]['id'],'from':(_0x138d0e[_0x3434('0xb4')]||'')+'\x20'+(_0x138d0e[_0x3434('0xb5')]||''),'customerIp':_0x5f14f3,'customerPort':_0x2541a0['headers'][_0x3434('0xb6')]?_0x2541a0[_0x3434('0x92')][_0x3434('0xb6')]:null,'referer':_0x2541a0[_0x3434('0x5f')][_0x3434('0xb7')],'browserName':_0x202adc[_0x3434('0xb8')][_0x3434('0x3e')]&&_0x202adc[_0x3434('0xb8')][_0x3434('0xb9')]?util[_0x3434('0xba')]('%s\x20%s',_0x202adc[_0x3434('0xb8')][_0x3434('0x3e')],_0x202adc[_0x3434('0xb8')][_0x3434('0xb9')]):_0x3434('0xbb'),'browserVersion':_0x202adc[_0x3434('0xb8')][_0x3434('0xb9')]||_0x3434('0xbb'),'osName':util[_0x3434('0xba')](_0x3434('0xbc'),_0x202adc['os'][_0x3434('0x3e')],_0x202adc['os'][_0x3434('0xb9')]),'osVersion':_0x202adc['os'][_0x3434('0xb9')],'deviceModel':_0x202adc[_0x3434('0xbd')][_0x3434('0x4b')]&&_0x202adc[_0x3434('0xbd')][_0x3434('0xbe')]?util[_0x3434('0xba')]('%s\x20%s\x20%s',_0x202adc[_0x3434('0xbd')][_0x3434('0x4b')],_0x202adc['device']['vendor'],_0x202adc[_0x3434('0xbd')]['type']):null,'deviceVendor':_0x202adc['device'][_0x3434('0xbe')],'deviceType':_0x202adc['device'][_0x3434('0x46')],'formData':JSON[_0x3434('0x28')](_0x2541a0[_0x3434('0x5f')])};var _0x486952={'ChatWebsiteId':_0x2541a0[_0x3434('0x5c')]['id'],'closed':![]};if(_0x2541a0[_0x3434('0x5f')][_0x3434('0xbf')]){_0x486952[_0x3434('0xbf')]=_0x2541a0[_0x3434('0x5f')]['threadId'];return db[_0x3434('0xc0')]['find']({'where':_0x486952})[_0x3434('0x23')](function(_0x31c75e){if(_0x31c75e){return[_0x31c75e,![]];}_0x35d484[_0x3434('0xbf')]=_0x2541a0[_0x3434('0x5f')]['threadId'];_0x35d484[_0x3434('0xc1')]=_0x2541a0[_0x3434('0x5f')][_0x3434('0xc1')];return db['ChatInteraction'][_0x3434('0x5e')](_0x35d484)[_0x3434('0x23')](function(_0x25ee06){return[_0x25ee06,!![]];});});}_0x486952[_0x3434('0xc2')]=_0x138d0e['id'];if(_0x2541a0[_0x3434('0x5f')][_0x3434('0xc3')]&&_0x2541a0[_0x3434('0x5f')]['interaction']['id']){_0x486952['id']=_0x2541a0[_0x3434('0x5f')]['interaction']['id'];return db[_0x3434('0xc0')][_0x3434('0x5d')]({'where':_0x486952})['then'](function(_0x51255f){if(_0x51255f){return[_0x51255f,![]];}return db[_0x3434('0xc0')]['create'](_0x35d484)[_0x3434('0x23')](function(_0x4706a3){return[_0x4706a3,!![]];});});}return db[_0x3434('0xc0')][_0x3434('0x5e')](_0x35d484)[_0x3434('0x23')](function(_0x5ec3e2){return[_0x5ec3e2,!![]];});}})['spread'](function(_0x34978c,_0x498281){if(_0x34978c){_0x3c483e=_0x498281;if(!_0x498281){var _0x4ebacb={'from':(_0x573f9b[_0x3434('0xae')]['firstName']||'')+'\x20'+(_0x573f9b[_0x3434('0xae')][_0x3434('0xb5')]||'')};if(_0x2541a0[_0x3434('0x5f')]['threadId']&&_0x2541a0[_0x3434('0x5f')]['messageId']&&_0x2541a0[_0x3434('0x5f')][_0x3434('0xbf')]!=_0x2541a0['body']['messageId']){_0x4ebacb[_0x3434('0xbf')]=_0x2541a0[_0x3434('0x5f')][_0x3434('0xc4')];}return _0x34978c['update'](_0x4ebacb);}else{return _0x34978c;}}})[_0x3434('0x23')](function(_0x1ca734){_0x573f9b[_0x3434('0xc3')]=_0x1ca734[_0x3434('0x3a')]({'plain':!![]});_0x573f9b[_0x3434('0xc3')][_0x3434('0xc5')]=_0x3c483e;if(_0x573f9b[_0x3434('0xc3')][_0x3434('0xc5')]){if(_0x573f9b[_0x3434('0xa8')][_0x3434('0xc6')]){_0x573f9b[_0x3434('0xa9')][_0x3434('0xc7')]({'id':0x0,'priority':_0x573f9b[_0x3434('0xa9')]['length']+0x1,'app':'close','appdata':_0x3434('0xc8'),'interval':_0x3434('0xc9')});}}return db[_0x3434('0xca')][_0x3434('0x5e')]({'body':_0x2541a0[_0x3434('0x5f')][_0x3434('0x5f')],'ChatWebsiteId':_0x2541a0[_0x3434('0x5c')]['id'],'ChatInteractionId':_0x1ca734['id'],'direction':'in','ContactId':_0x573f9b[_0x3434('0xae')]['id'],'AttachmentId':_0x2541a0[_0x3434('0x5f')][_0x3434('0xcb')]});})[_0x3434('0x23')](function(_0x349ed2){_0x573f9b[_0x3434('0x2b')]=_0x349ed2;if(_0x573f9b[_0x3434('0xc3')]['UserId']){return db[_0x3434('0xcc')]['find']({'attributes':['id',_0x3434('0x3e')],'where':{'id':_0x573f9b['interaction']['UserId']}})[_0x3434('0x23')](function(_0x91982f){if(_0x91982f){_0x573f9b[_0x3434('0xa9')][_0x3434('0xcd')]({'id':0x0,'priority':0x0,'app':_0x3434('0xce'),'appdata':_0x91982f[_0x3434('0x3e')]+','+(_0x573f9b['account'][_0x3434('0xcf')]||0xa),'interval':_0x3434('0xc9')});_0x573f9b[_0x3434('0xd0')]=!![];}return respondWithRpcPromise(_0x3434('0xd1'),'startRouting',_0x573f9b);});}return respondWithRpcPromise(_0x3434('0xd1'),_0x3434('0xd2'),_0x573f9b);})[_0x3434('0x23')](function(_0x24179d){respondWithRpcPromise('EventManager','EventManager',{'event':_0x3434('0x8f'),'message':_0x24179d},client9002);return _0x24179d;})[_0x3434('0x23')](respondWithResult(_0x2514c7,null))['catch'](handleError(_0x2514c7,null));};exports[_0x3434('0xd3')]=function(_0x3bd146,_0x490d61,_0x1e2e07){var _0x598b4a,_0x44de73,_0x1c70ad;var _0x4f0329=[];var _0x58956c=[];var _0x207ea7={};var _0x134fa7=_0x3bd146[_0x3434('0xd4')]||[];return db[_0x3434('0x95')][_0x3434('0x68')]()[_0x3434('0x23')](function(_0x2940bb){if(!_0x2940bb){throw new db[(_0x3434('0x9f'))][(_0x3434('0x96'))](_0x3434('0x97'));}_0x58956c=_['difference'](_['keys'](_0x2940bb),[_0x3434('0x9a'),'updatedAt']);_0x4f0329=_[_0x3434('0x98')](_[_0x3434('0x49')](_0x2940bb),[_0x3434('0x9a'),_0x3434('0x99'),'CompanyId',_0x3434('0xd5')]);if(_0x3bd146[_0x3434('0x5f')]['id']){delete _0x3bd146[_0x3434('0x5f')]['id'];}if(_[_0x3434('0x85')](_0x3bd146['body']['from'])||_[_0x3434('0x85')](_0x3bd146[_0x3434('0x5f')][_0x3434('0x5f')][_0x3434('0xd6')])){throw _0x490d61[_0x3434('0x2f')](0x1f4)[_0x3434('0x3f')](new db[(_0x3434('0x9f'))][(_0x3434('0x96'))]('from\x20is\x20mandatory'));}if(_[_0x3434('0x85')](_0x3bd146[_0x3434('0x5f')][_0x3434('0x5f')])||_0x3bd146[_0x3434('0x5f')][_0x3434('0x5f')]===''||(_[_0x3434('0x85')](_0x3bd146[_0x3434('0x5f')]['body']['Comments'])||_0x3bd146[_0x3434('0x5f')]['body'][_0x3434('0xd7')]==='')){throw _0x490d61[_0x3434('0x2f')](0x1f4)[_0x3434('0x3f')](new db[(_0x3434('0x9f'))][(_0x3434('0x96'))](_0x3434('0x9d')));}if(_[_0x3434('0x85')](_0x3bd146[_0x3434('0x5f')][_0x3434('0xd8')])){throw _0x490d61[_0x3434('0x2f')](0x1f4)[_0x3434('0x3f')](new db['Sequelize'][(_0x3434('0x96'))](_0x3434('0xd9')+_0x4f0329));}if(!_['includes'](_0x4f0329,_0x3bd146['body'][_0x3434('0xd8')])){throw _0x490d61[_0x3434('0x2f')](0x1f4)['send'](new db[(_0x3434('0x9f'))][(_0x3434('0x96'))](_0x3434('0xda')+_0x4f0329));}_0x207ea7[_0x3bd146[_0x3434('0x5f')][_0x3434('0xd8')]]=_0x3bd146['body']['from'];})['then'](function(){return db[_0x3434('0x44')]['find']({'where':{'id':_0x3bd146['params']['id']},'include':[{'model':db[_0x3434('0xa2')],'as':_0x3434('0xa3')},{'model':db[_0x3434('0xdb')],'as':_0x3434('0xdb')}]});})[_0x3434('0x23')](handleEntityNotFound(_0x490d61,null))['then'](function(_0x4398d0){if(_0x4398d0&&_0x4398d0[_0x3434('0xa3')]){_0x44de73=_0x4398d0;var _0x15c150=_[_0x3434('0x1b')](_0x3bd146['body'],{'firstName':_0x3bd146[_0x3434('0x5f')]['from'],'phone':_0x3bd146[_0x3434('0x5f')][_0x3434('0x9b')],'ListId':_0x4398d0[_0x3434('0xd5')]});_0x15c150[_0x3bd146[_0x3434('0x5f')]['mapKeyOffline']]=_0x3bd146[_0x3434('0x5f')][_0x3434('0x9b')];return db[_0x3434('0x95')][_0x3434('0xdc')]({'where':_0x207ea7,'defaults':_0x15c150});}})['spread'](function(_0x208d72){if(_0x208d72){_0x1c70ad=_0x208d72;var _0x3286ff=fs['readFileSync'](path[_0x3434('0x7f')](config[_0x3434('0x80')],_0x3434('0xdd')),'utf8');var _0x58e1ed=ejs[_0x3434('0xde')](_0x3286ff,{'body':_[_0x3434('0xdf')](_0x3bd146[_0x3434('0x5f')][_0x3434('0x5f')]),'bodyTitle':_0x44de73[_0x3434('0xe0')]});return db[_0x3434('0xe1')][_0x3434('0x5e')]({'body':_0x58e1ed,'ContactId':_0x208d72['id'],'ChatWebsiteId':_0x44de73['id']});}})[_0x3434('0x23')](function(_0x2c4b4f){if(!_[_0x3434('0x85')](_0x3bd146[_0x3434('0xd4')])){var _0x358013=_0x134fa7['map'](function(_0xaee7e4){return{'name':_0xaee7e4[_0x3434('0xe2')],'basename':_0xaee7e4[_0x3434('0x77')],'type':_0xaee7e4[_0x3434('0xe3')],'ChatOfflineMessageId':_0x2c4b4f['id']};});db[_0x3434('0xe4')][_0x3434('0xe5')](_0x358013)['$promise'];}return _0x2c4b4f;})['then'](function(_0x28ef33){if(_0x28ef33){_0x598b4a=_0x28ef33;return db[_0x3434('0xdb')][_0x3434('0x72')]({'where':{'service':!![]},'include':[{'model':db[_0x3434('0xe6')],'as':_0x3434('0xe7'),'raw':!![]}]});}})[_0x3434('0x23')](function(_0x6e9e12){if(_0x6e9e12&&_0x6e9e12[_0x3434('0xe7')]&&_0x44de73['forwardOffline']&&_0x44de73['forwardOfflineAddress']){var _0x1eb11a={'tls':{'rejectUnauthorized':![]}};if(_0x6e9e12['Smtp']['service']){_0x1eb11a[_0x3434('0xe8')]=_0x6e9e12[_0x3434('0xe7')][_0x3434('0xe8')];}else{_0x1eb11a['host']=_0x6e9e12[_0x3434('0xe7')][_0x3434('0xe9')];_0x1eb11a['port']=_0x6e9e12[_0x3434('0xe7')]['port'];_0x1eb11a[_0x3434('0xea')]=_0x6e9e12[_0x3434('0xe7')][_0x3434('0xea')];}if(_0x6e9e12[_0x3434('0xe7')][_0x3434('0xeb')]){_0x1eb11a[_0x3434('0xec')]={'user':_0x6e9e12[_0x3434('0xe7')][_0x3434('0x60')],'pass':_0x6e9e12[_0x3434('0xe7')][_0x3434('0xed')]};}return respondWithRpcPromise(_0x3434('0xee'),'sendMail',{'account':_0x1eb11a,'message':{'from':util[_0x3434('0xba')](_0x3434('0xef'),_0x6e9e12[_0x3434('0x3e')],_0x6e9e12[_0x3434('0xd6')]||_0x6e9e12[_0x3434('0xe7')][_0x3434('0x60')]),'to':_0x44de73['forwardOfflineAddress'],'subject':_0x44de73['offlineMessageSubject'],'text':_0x598b4a['body'],'attachments':!_[_0x3434('0x85')](_0x3bd146[_0x3434('0xd4')])?_0x134fa7:[]}},client9003)[_0x3434('0x23')](function(){return _0x598b4a;})[_0x3434('0x2d')](function(_0x133bc8){console[_0x3434('0x29')](_0x133bc8);});}})[_0x3434('0x23')](function(){if(_0x44de73&&_0x44de73[_0x3434('0xf0')]&&_0x44de73[_0x3434('0xf1')]){var _0x14edc2={'from':_0x1c70ad[_0x3434('0xd6')],'firstName':_0x1c70ad[_0x3434('0xb4')],'lastName':_0x1c70ad[_0x3434('0xb5')],'mapKey':_0x3434('0xd6'),'message':{'from':_0x1c70ad['email'],'to':_0x44de73[_0x3434('0xdb')][_0x3434('0xd6')],'cc':'','subject':_0x44de73[_0x3434('0xf2')],'messageId':'','sentAt':new Date(),'attach':!_[_0x3434('0x85')](_0x3bd146['files']),'attachments':!_[_0x3434('0x85')](_0x3bd146[_0x3434('0xd4')])?_0x134fa7:[],'originChannel':_0x3434('0xf3'),'ChatWebsiteId':_0x44de73['id'],'ChatOfflineMessageId':_0x598b4a['id'],'originTo':_0x44de73[_0x3434('0xdb')][_0x3434('0xd6')]},'body':_0x598b4a[_0x3434('0x5f')]};var _0xf7190e={'account':{'id':_0x44de73[_0x3434('0xf1')]},'body':_0x14edc2,'log':_0x3434('0xf4')};return respondWithRpcPromise('NotifyMailAccount',_0x3434('0xf5'),_0xf7190e,client9001)['then'](function(){return _0x598b4a;})[_0x3434('0x2d')](function(_0x3d0bca){console[_0x3434('0x29')](_0x3d0bca);});}return;})[_0x3434('0x23')](function(){if(_0x598b4a){return _0x598b4a;}})[_0x3434('0x23')](respondWithResult(_0x490d61,null))[_0x3434('0x2d')](function(_0x21a966){console[_0x3434('0x29')](_0x3434('0x2d'),_0x21a966);for(var _0xf094b of _0x134fa7){var _0xa726a0=path[_0x3434('0x7f')](config[_0x3434('0x80')],_0x3434('0xd4'),_0x3434('0xf6'),_0x3434('0xf7'),_0xf094b[_0x3434('0x77')]);fs_extra[_0x3434('0xf8')](_0xa726a0)[_0x3434('0x2d')](function(_0x27fc8b){console['error'](_0x3434('0xf9'),_0xa726a0,_0x27fc8b);});}});};exports[_0x3434('0xfa')]=function(_0x42b77d,_0x277e75,_0x343e7a){return db[_0x3434('0xc0')]['find']({'where':{'id':_0x42b77d['params']['id']}})[_0x3434('0x23')](handleEntityNotFound(_0x277e75,null))[_0x3434('0x23')](function(_0x3d8f26){if(_0x3d8f26){return _0x3d8f26[_0x3434('0xfa')](_0x42b77d['body']['ids'],_['omit'](_0x42b77d[_0x3434('0x5f')],['ids','id'])||{});}})[_0x3434('0x23')](respondWithResult(_0x277e75,null))[_0x3434('0x2d')](handleError(_0x277e75,null));};exports[_0x3434('0xfb')]=function(_0x30c45c,_0x37801d,_0x3ebcdc){var _0x5b5629={'raw':![],'where':{}};var _0x11ef63={};var _0x7f2012={'count':0x0,'rows':[]};return db[_0x3434('0x44')][_0x3434('0x72')]({'where':{'id':_0x30c45c['params']['id']}})[_0x3434('0x23')](handleEntityNotFound(_0x37801d,null))[_0x3434('0x23')](function(_0x4b04fe){if(_0x4b04fe){_0x11ef63[_0x3434('0x4b')]=_[_0x3434('0x49')](db['ChatInteraction'][_0x3434('0x45')]);_0x11ef63[_0x3434('0x48')]=_[_0x3434('0x49')](_0x30c45c['query']);_0x11ef63[_0x3434('0x53')]=_[_0x3434('0x4a')](_0x11ef63[_0x3434('0x4b')],_0x11ef63['query']);_0x5b5629[_0x3434('0x4c')]=_[_0x3434('0x4a')](_0x11ef63[_0x3434('0x4b')],qs[_0x3434('0x4d')](_0x30c45c[_0x3434('0x48')]['fields']));_0x5b5629['attributes']=_0x5b5629[_0x3434('0x4c')][_0x3434('0x4e')]?_0x5b5629[_0x3434('0x4c')]:_0x11ef63[_0x3434('0x4b')];if(!_0x30c45c[_0x3434('0x48')]['hasOwnProperty'](_0x3434('0x6d'))){_0x5b5629[_0x3434('0x34')]=qs['limit'](_0x30c45c[_0x3434('0x48')][_0x3434('0x34')]);_0x5b5629[_0x3434('0x33')]=qs[_0x3434('0x33')](_0x30c45c[_0x3434('0x48')]['offset']);}_0x5b5629[_0x3434('0x50')]=qs[_0x3434('0x51')](_0x30c45c['query'][_0x3434('0x51')]);_0x5b5629[_0x3434('0x52')]=qs[_0x3434('0x53')](_[_0x3434('0x73')](_0x30c45c[_0x3434('0x48')],_0x11ef63[_0x3434('0x53')]));_0x5b5629[_0x3434('0x52')][_0x3434('0x6a')]=_0x4b04fe['id'];if(_0x30c45c[_0x3434('0x48')][_0x3434('0x54')]){_0x5b5629[_0x3434('0x52')]=_[_0x3434('0x55')](_0x5b5629[_0x3434('0x52')],{'$or':_['map'](_0x5b5629[_0x3434('0x4c')],function(_0x38f6aa){var _0x50f764={};_0x50f764[_0x38f6aa]={'$like':'%'+_0x30c45c[_0x3434('0x48')][_0x3434('0x54')]+'%'};return _0x50f764;})});}_0x5b5629=_[_0x3434('0x55')]({},_0x5b5629,_0x30c45c[_0x3434('0x56')]);return db[_0x3434('0xc0')][_0x3434('0x32')]({'where':_0x5b5629[_0x3434('0x52')]})[_0x3434('0x23')](function(_0x457b7c){_0x7f2012['count']=_0x457b7c;if(_0x30c45c[_0x3434('0x48')]['includeAll']){_0x5b5629[_0x3434('0x58')]=[{'model':db[_0x3434('0x95')],'as':_0x3434('0xfc'),'required':![]},{'model':db[_0x3434('0xcc')],'as':'Owner','attributes':['name',_0x3434('0xfd'),_0x3434('0xfe')],'required':![]},{'model':db['Tag'],'as':_0x3434('0xff'),'attributes':['id',_0x3434('0x3e'),_0x3434('0x100')],'where':_0x30c45c['query'][_0x3434('0x101')]?{'id':_0x30c45c['query']['tag']}:undefined,'required':_0x30c45c[_0x3434('0x48')][_0x3434('0x101')]?!![]:![]}];}return db['ChatInteraction'][_0x3434('0x59')](_0x5b5629);})[_0x3434('0x23')](function(_0x29f703){_0x7f2012[_0x3434('0x5a')]=_0x29f703;return _0x7f2012;});}})[_0x3434('0x23')](respondWithFilteredResult(_0x37801d,_0x5b5629))['catch'](handleError(_0x37801d,null));};function iftimePromise(_0x2ecc96,_0x5ae0ce){return respondWithRpcPromise(_0x3434('0x102'),_0x3434('0x103'),{'command':_0x5ae0ce[_0x3434('0x104')]?util[_0x3434('0xba')]('iftime\x20%s,%s',_0x2ecc96['interval'],_0x5ae0ce['timezone']):util[_0x3434('0xba')](_0x3434('0x105'),_0x2ecc96[_0x3434('0x106')])},client9002)[_0x3434('0x23')](function(_0x45be68){var _0x174a14=_0x45be68&&_0x45be68['indexOf']('true')>=0x0?!![]:![];logger[_0x3434('0x24')](_0x3434('0x107'),_0x5ae0ce['id'],_0x2ecc96['id'],_0x2ecc96[_0x3434('0x106')],_0x174a14?_0x3434('0x108'):_0x3434('0x109'),_0x5ae0ce['timezone']?_0x5ae0ce[_0x3434('0x104')]:_0x3434('0x10a'));return _0x174a14;})[_0x3434('0x2d')](function(_0x5469ec){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5ae0ce['id'],_0x2ecc96['id'],_0x2ecc96[_0x3434('0x106')],util[_0x3434('0x10b')](_0x5469ec,{'showHidden':![],'depth':null}),_0x5ae0ce[_0x3434('0x104')]?_0x5ae0ce[_0x3434('0x104')]:_0x3434('0x10a'));return![];});}exports['getSnippet']=function(_0x1bcc68,_0x262b60,_0x2f02f7){var _0x54a100=0x0;var _0x56f55a=0x0;var _0x505d70=![];var _0x145a9d;var _0x427e8d;return db[_0x3434('0x44')][_0x3434('0x5d')]({'where':{'id':_0x1bcc68[_0x3434('0x5c')]['id']},'include':[{'model':db[_0x3434('0x10c')],'as':'Interval','include':[{'model':db[_0x3434('0x10c')],'as':_0x3434('0x10d'),'attributes':['id',_0x3434('0x106')],'raw':!![]}]}]})[_0x3434('0x23')](handleEntityNotFound(_0x262b60,null))[_0x3434('0x23')](function(_0x3d603d){if(_0x3d603d){_0x145a9d=_0x3d603d;return _0x3d603d[_0x3434('0x10e')]({'raw':!![]});}})['then'](function(_0x59a352){if(_0x145a9d){if(_0x59a352){_0x427e8d=_0x59a352;}}return require(_0x3434('0x18'))[_0x3434('0x83')]();})[_0x3434('0x23')](function(_0x53f546){if(_0x53f546){_0x56f55a=_0x53f546[_0x3434('0x10f')];_0x505d70=_0x53f546[_0x3434('0x84')];}})[_0x3434('0x23')](function(){return db[_0x3434('0xc0')][_0x3434('0x32')]({'where':{'closed':![]}});})['then'](function(_0x48ee17){_0x54a100=_0x48ee17;if(_0x56f55a&&_0x48ee17>_0x56f55a){return db['License'][_0x3434('0x72')]({'where':{'id':0x1}})['then'](function(_0x4b391e){if(_0x4b391e){_0x4b391e[_0x3434('0x110')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x145a9d[_0x3434('0x10c')]&&_0x145a9d[_0x3434('0x10c')][_0x3434('0x10d')]){var _0x102cbc=[];for(var _0x1159b7=0x0;_0x1159b7<_0x145a9d[_0x3434('0x10c')][_0x3434('0x10d')]['length'];_0x1159b7++){var _0x48527c=_0x145a9d['Interval'][_0x3434('0x10d')][_0x1159b7][_0x3434('0x3a')]({'plain':!![]});_0x102cbc[_0x3434('0xc7')](iftimePromise(_0x48527c,_0x145a9d));}return BPromise[_0x3434('0x111')](_0x102cbc)['then'](function(_0x487844){return _['some'](_0x487844);});}else{return!![];}})[_0x3434('0x23')](function(_0x499838){var _0x4fc358=fs['readFileSync'](path[_0x3434('0x7f')](config['root'],_0x3434('0x112')),_0x3434('0x113'));var _0x45083b={'remote':_0x145a9d['remote'],'query':querystring[_0x3434('0x28')](_[_0x3434('0x55')](_0x145a9d['get']({'plain':!![]}),{'customerIp':_0x1bcc68['headers'][_0x3434('0xb1')]||_0x1bcc68[_0x3434('0x92')][_0x3434('0x114')]||_0x1bcc68[_0x3434('0x115')]['remoteAddress']||_0x1bcc68['ip'],'referer':_0x1bcc68[_0x3434('0x92')][_0x3434('0xb7')],'openedInteractions':_0x54a100,'maxInteractions':_0x56f55a,'virtual':_0x505d70[_0x3434('0x10f')],'online':_0x499838,'custom':_0x505d70}))[_0x3434('0x116')](/'/g,'\x5c\x27')};_0x262b60['send'](ejs['render'](Mustache[_0x3434('0xde')](_0x4fc358,_0x45083b),{'proactiveActions':_0x427e8d,'alignment':_0x145a9d[_0x3434('0x117')],'verticalAlignment':_0x145a9d[_0x3434('0x118')],'div_color':_0x145a9d[_0x3434('0x100')],'text_color':_0x145a9d[_0x3434('0x119')],'button_color':_0x145a9d['color_button'],'background_color':_0x145a9d['backgroundColor']}));})['catch'](handleError(_0x262b60,null));};exports[_0x3434('0x11a')]=function(_0xb13560,_0x586012,_0x65f590){return db[_0x3434('0x44')][_0x3434('0x72')]({'where':{'id':_0xb13560[_0x3434('0x5c')]['id']}})[_0x3434('0x23')](handleEntityNotFound(_0x586012,null))['then'](function(_0x27f052){if(_0x27f052){return db['sequelize'][_0x3434('0x11b')](function(_0xd5ad8b){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0xb13560['params']['id']},'transaction':_0xd5ad8b})[_0x3434('0x23')](function(_0x9f0ad2){var _0x49940c=_[_0x3434('0x43')](_0xb13560[_0x3434('0x5f')],function(_0x221da8){_0x221da8[_0x3434('0x6a')]=_0xb13560[_0x3434('0x5c')]['id'];return _0x221da8;});return db[_0x3434('0xa6')][_0x3434('0xe5')](_0x49940c,{'transaction':_0xd5ad8b});});})[_0x3434('0x23')](function(){return db[_0x3434('0xa6')][_0x3434('0x11c')]({'where':{'ChatWebsiteId':_0xb13560[_0x3434('0x5c')]['id']},'order':_0x3434('0xac')});});}})[_0x3434('0x23')](respondWithResult(_0x586012,null))['catch'](handleError(_0x586012,null));};exports[_0x3434('0x11d')]=function(_0x2ff1ae,_0xb73c77,_0x330df4){var _0x4128fa={};var _0x129092={};var _0x8525f2;var _0x5266a4;return db[_0x3434('0x44')][_0x3434('0x72')]({'where':{'id':_0x2ff1ae[_0x3434('0x5c')]['id']}})['then'](handleEntityNotFound(_0xb73c77,null))[_0x3434('0x23')](function(_0x147c0d){if(_0x147c0d){_0x8525f2=_0x147c0d;_0x129092['model']=_[_0x3434('0x49')](db['ChatApplication'][_0x3434('0x45')]);_0x129092[_0x3434('0x48')]=_[_0x3434('0x49')](_0x2ff1ae['query']);_0x129092[_0x3434('0x53')]=_[_0x3434('0x4a')](_0x129092[_0x3434('0x4b')],_0x129092['query']);_0x4128fa[_0x3434('0x4c')]=_[_0x3434('0x4a')](_0x129092[_0x3434('0x4b')],qs[_0x3434('0x4d')](_0x2ff1ae['query']['fields']));_0x4128fa[_0x3434('0x4c')]=_0x4128fa[_0x3434('0x4c')][_0x3434('0x4e')]?_0x4128fa[_0x3434('0x4c')]:_0x129092[_0x3434('0x4b')];_0x4128fa[_0x3434('0x50')]=qs[_0x3434('0x51')](_0x2ff1ae[_0x3434('0x48')][_0x3434('0x51')]);_0x4128fa[_0x3434('0x52')]=qs[_0x3434('0x53')](_['pick'](_0x2ff1ae[_0x3434('0x48')],_0x129092[_0x3434('0x53')]));if(_0x2ff1ae[_0x3434('0x48')][_0x3434('0x54')]){_0x4128fa[_0x3434('0x52')]=_[_0x3434('0x55')](_0x4128fa['where'],{'$or':_[_0x3434('0x43')](_0x4128fa[_0x3434('0x4c')],function(_0x34e552){var _0x359da={};_0x359da[_0x34e552]={'$like':'%'+_0x2ff1ae[_0x3434('0x48')][_0x3434('0x54')]+'%'};return _0x359da;})});}_0x4128fa=_[_0x3434('0x55')]({},_0x4128fa,_0x2ff1ae[_0x3434('0x56')]);return _0x8525f2[_0x3434('0x11d')](_0x4128fa);}})[_0x3434('0x23')](function(_0x5a02c9){if(_0x5a02c9){_0x5266a4=_0x5a02c9[_0x3434('0x4e')];if(!_0x2ff1ae['query'][_0x3434('0x4f')](_0x3434('0x6d'))){_0x4128fa['limit']=qs[_0x3434('0x34')](_0x2ff1ae[_0x3434('0x48')]['limit']);_0x4128fa[_0x3434('0x33')]=qs[_0x3434('0x33')](_0x2ff1ae[_0x3434('0x48')][_0x3434('0x33')]);}return _0x8525f2[_0x3434('0x11d')](_0x4128fa);}})[_0x3434('0x23')](function(_0x22c55f){if(_0x22c55f){return _0x22c55f?{'count':_0x5266a4,'rows':_0x22c55f}:null;}})[_0x3434('0x23')](respondWithResult(_0xb73c77,null))[_0x3434('0x2d')](handleError(_0xb73c77,null));};exports['addProactiveActions']=function(_0x3e0225,_0x400fe7,_0x47804e){return db['chatProactiveAction'][_0x3434('0x5d')]({'where':{'id':_0x3e0225['params']['id']}})[_0x3434('0x23')](handleEntityNotFound(_0x400fe7,null))[_0x3434('0x23')](function(_0x75b26d){if(_0x75b26d){return _0x75b26d[_0x3434('0x11e')](_0x3e0225['body'][_0x3434('0x6f')],_['omit'](_0x3e0225[_0x3434('0x5f')],['ids','id'])||{});}})[_0x3434('0x23')](respondWithResult(_0x400fe7,null))[_0x3434('0x2d')](handleError(_0x400fe7,null));};exports[_0x3434('0x10e')]=function(_0x2189c1,_0x46642c,_0x5d4cd3){var _0x3f8c6d={};var _0x4d0cfc={};var _0x3069e9;var _0x2cca97;return db[_0x3434('0x44')][_0x3434('0x72')]({'where':{'id':_0x2189c1[_0x3434('0x5c')]['id']}})[_0x3434('0x23')](handleEntityNotFound(_0x46642c,null))[_0x3434('0x23')](function(_0x1e66f6){if(_0x1e66f6){_0x3069e9=_0x1e66f6;_0x4d0cfc['model']=_['keys'](db[_0x3434('0x11f')]['rawAttributes']);_0x4d0cfc['query']=_['keys'](_0x2189c1['query']);_0x4d0cfc[_0x3434('0x53')]=_[_0x3434('0x4a')](_0x4d0cfc[_0x3434('0x4b')],_0x4d0cfc[_0x3434('0x48')]);_0x3f8c6d[_0x3434('0x4c')]=_['intersection'](_0x4d0cfc[_0x3434('0x4b')],qs[_0x3434('0x4d')](_0x2189c1[_0x3434('0x48')]['fields']));_0x3f8c6d[_0x3434('0x4c')]=_0x3f8c6d[_0x3434('0x4c')][_0x3434('0x4e')]?_0x3f8c6d[_0x3434('0x4c')]:_0x4d0cfc[_0x3434('0x4b')];_0x3f8c6d[_0x3434('0x50')]=qs[_0x3434('0x51')](_0x2189c1['query'][_0x3434('0x51')]);_0x3f8c6d['where']=qs[_0x3434('0x53')](_[_0x3434('0x73')](_0x2189c1['query'],_0x4d0cfc['filters']));if(_0x2189c1[_0x3434('0x48')]['filter']){_0x3f8c6d[_0x3434('0x52')]=_['merge'](_0x3f8c6d[_0x3434('0x52')],{'$or':_[_0x3434('0x43')](_0x3f8c6d[_0x3434('0x4c')],function(_0x34d178){var _0x359079={};_0x359079[_0x34d178]={'$like':'%'+_0x2189c1[_0x3434('0x48')]['filter']+'%'};return _0x359079;})});}_0x3f8c6d=_['merge']({},_0x3f8c6d,_0x2189c1[_0x3434('0x56')]);return _0x3069e9[_0x3434('0x10e')](_0x3f8c6d);}})['then'](function(_0x4efa08){if(_0x4efa08){_0x2cca97=_0x4efa08[_0x3434('0x4e')];if(!_0x2189c1[_0x3434('0x48')][_0x3434('0x4f')](_0x3434('0x6d'))){_0x3f8c6d[_0x3434('0x34')]=qs[_0x3434('0x34')](_0x2189c1[_0x3434('0x48')][_0x3434('0x34')]);_0x3f8c6d['offset']=qs[_0x3434('0x33')](_0x2189c1[_0x3434('0x48')][_0x3434('0x33')]);}return _0x3069e9[_0x3434('0x10e')](_0x3f8c6d);}})[_0x3434('0x23')](function(_0x3296fb){if(_0x3296fb){return _0x3296fb?{'count':_0x2cca97,'rows':_0x3296fb}:null;}})[_0x3434('0x23')](respondWithResult(_0x46642c,null))[_0x3434('0x2d')](handleError(_0x46642c,null));};exports[_0x3434('0x120')]=function(_0x31803a,_0x559fa7,_0x2ae9cb){var _0x2743d7=_0x31803a[_0x3434('0x48')][_0x3434('0x121')]===_0x3434('0x122')?_0x3434('0x123'):_0x3434('0x124');return db[_0x3434('0x44')][_0x3434('0x5d')]({'attributes':['id',_0x2743d7],'where':{'id':_0x31803a[_0x3434('0x5c')]['id']}})[_0x3434('0x23')](handleEntityNotFound(_0x559fa7,null))[_0x3434('0x23')](function(_0x3e203c){if(_0x3e203c){var _0x24866b=_0x3e203c[_0x2743d7];var _0x281ddd=_0x24866b&&_0x24866b[_0x3434('0x125')]?_0x24866b['items']:[];_0x559fa7[_0x3434('0x3f')]({'fromKey':_[_0x3434('0x85')](_0x24866b[_0x3434('0x126')])?undefined:_0x24866b[_0x3434('0x126')],'count':_0x281ddd[_0x3434('0x4e')],'rows':_0x281ddd});}})[_0x3434('0x2d')](handleError(_0x559fa7,null));};exports[_0x3434('0x127')]=function(_0x24431f,_0x4bfdc0,_0x25a027){var _0x13504f={'raw':![],'where':{}};var _0x3729ed={};var _0x21e232={'count':0x0,'rows':[]};return db[_0x3434('0x44')][_0x3434('0x72')]({'where':{'id':_0x24431f[_0x3434('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4bfdc0,null))['then'](function(_0x19c0af){if(_0x19c0af){_0x3729ed[_0x3434('0x4b')]=_[_0x3434('0x49')](db[_0x3434('0xe1')]['rawAttributes']);_0x3729ed[_0x3434('0x48')]=_['keys'](_0x24431f[_0x3434('0x48')]);_0x3729ed[_0x3434('0x53')]=_[_0x3434('0x4a')](_0x3729ed[_0x3434('0x4b')],_0x3729ed[_0x3434('0x48')]);_0x13504f[_0x3434('0x4c')]=_[_0x3434('0x4a')](_0x3729ed['model'],qs['fields'](_0x24431f[_0x3434('0x48')][_0x3434('0x4d')]));_0x13504f['attributes']=_0x13504f['attributes'][_0x3434('0x4e')]?_0x13504f[_0x3434('0x4c')]:_0x3729ed[_0x3434('0x4b')];if(!_0x24431f[_0x3434('0x48')][_0x3434('0x4f')](_0x3434('0x6d'))){_0x13504f[_0x3434('0x34')]=qs['limit'](_0x24431f['query'][_0x3434('0x34')]);_0x13504f['offset']=qs['offset'](_0x24431f[_0x3434('0x48')][_0x3434('0x33')]);}_0x13504f[_0x3434('0x50')]=qs[_0x3434('0x51')](_0x24431f[_0x3434('0x48')]['sort']);_0x13504f[_0x3434('0x52')]=qs[_0x3434('0x53')](_[_0x3434('0x73')](_0x24431f['query'],_0x3729ed[_0x3434('0x53')]));_0x13504f['where'][_0x3434('0x6a')]=_0x19c0af['id'];if(_0x24431f['query'][_0x3434('0x54')]){_0x13504f['where']=_[_0x3434('0x55')](_0x13504f[_0x3434('0x52')],{'$or':_[_0x3434('0x43')](_0x13504f[_0x3434('0x4c')],function(_0x4e6bfb){var _0x539ba9={};_0x539ba9[_0x4e6bfb]={'$like':'%'+_0x24431f[_0x3434('0x48')][_0x3434('0x54')]+'%'};return _0x539ba9;})});}_0x13504f=_['merge']({},_0x13504f,_0x24431f[_0x3434('0x56')]);return db[_0x3434('0xe1')][_0x3434('0x32')]({'where':_0x13504f[_0x3434('0x52')]})[_0x3434('0x23')](function(_0x4db947){_0x21e232[_0x3434('0x32')]=_0x4db947;if(_0x24431f[_0x3434('0x48')][_0x3434('0x57')]){_0x13504f[_0x3434('0x58')]=[{'all':!![]}];}else{_0x13504f[_0x3434('0x58')]=[{'model':db[_0x3434('0x95')],'as':'Contact','required':![]},{'model':db[_0x3434('0xe4')],'as':_0x3434('0x128'),'required':![]}];}return db[_0x3434('0xe1')][_0x3434('0x59')](_0x13504f);})[_0x3434('0x23')](function(_0x2a722a){_0x21e232[_0x3434('0x5a')]=_0x2a722a;return _0x21e232;});}})[_0x3434('0x23')](respondWithFilteredResult(_0x4bfdc0,_0x13504f))['catch'](handleError(_0x4bfdc0,null));};exports['addAgents']=function(_0x6c3e88,_0x5f155b,_0x3cfa31){return db[_0x3434('0x44')]['find']({'where':{'id':_0x6c3e88[_0x3434('0x5c')]['id']}})[_0x3434('0x23')](handleEntityNotFound(_0x5f155b,null))[_0x3434('0x23')](function(_0x4ab554){if(_0x4ab554){return _0x4ab554[_0x3434('0x129')](_0x6c3e88[_0x3434('0x5f')][_0x3434('0x6f')],_[_0x3434('0x12a')](_0x6c3e88[_0x3434('0x5f')],[_0x3434('0x6f'),'id'])||{})[_0x3434('0x12b')](function(_0x31ac1b){for(var _0x5af090=0x0;_0x5af090<_0x6c3e88['body'][_0x3434('0x6f')][_0x3434('0x4e')];_0x5af090+=0x1){socket[_0x3434('0x12c')](_0x3434('0x12d'),{'UserId':_0x6c3e88[_0x3434('0x5f')]['ids'][_0x5af090],'ChatWebsiteId':_0x6c3e88['params']['id']});}return _0x31ac1b;});}})[_0x3434('0x23')](respondWithResult(_0x5f155b,null))[_0x3434('0x2d')](handleError(_0x5f155b,null));};exports[_0x3434('0x12e')]=function(_0x630e26,_0x26819f,_0x332b08){return db[_0x3434('0x44')][_0x3434('0x5d')]({'where':{'id':_0x630e26[_0x3434('0x5c')]['id']}})['then'](handleEntityNotFound(_0x26819f,null))['then'](function(_0x12f9f5){if(_0x12f9f5){return _0x12f9f5[_0x3434('0x12e')](_0x630e26[_0x3434('0x48')][_0x3434('0x6f')])[_0x3434('0x23')](function(){if(_['isArray'](_0x630e26[_0x3434('0x48')][_0x3434('0x6f')])){for(var _0x33b37d=0x0;_0x33b37d<_0x630e26[_0x3434('0x48')][_0x3434('0x6f')][_0x3434('0x4e')];_0x33b37d+=0x1){socket[_0x3434('0x12c')](_0x3434('0x12f'),{'UserId':Number(_0x630e26['query'][_0x3434('0x6f')][_0x33b37d]),'ChatWebsiteId':Number(_0x630e26[_0x3434('0x5c')]['id'])});}}else{socket[_0x3434('0x12c')]('userChatWebsite:remove',{'UserId':Number(_0x630e26[_0x3434('0x48')][_0x3434('0x6f')]),'ChatWebsiteId':Number(_0x630e26['params']['id'])});}});}})[_0x3434('0x23')](respondWithStatusCode(_0x26819f,null))[_0x3434('0x2d')](handleError(_0x26819f,null));};exports['getAgents']=function(_0x2e2ba1,_0x2a5ce9,_0x4669c1){var _0x569ea9={};var _0x178c24={};var _0x274d2a;var _0xb8e322;return db['ChatWebsite'][_0x3434('0x72')]({'where':{'id':_0x2e2ba1['params']['id']}})[_0x3434('0x23')](handleEntityNotFound(_0x2a5ce9,null))[_0x3434('0x23')](function(_0x5708d2){if(_0x5708d2){_0x274d2a=_0x5708d2;_0x178c24[_0x3434('0x4b')]=_[_0x3434('0x49')](db[_0x3434('0xcc')][_0x3434('0x45')]);_0x178c24[_0x3434('0x48')]=_[_0x3434('0x49')](_0x2e2ba1[_0x3434('0x48')]);_0x178c24[_0x3434('0x53')]=_[_0x3434('0x4a')](_0x178c24[_0x3434('0x4b')],_0x178c24['query']);_0x569ea9[_0x3434('0x4c')]=_[_0x3434('0x4a')](_0x178c24['model'],qs[_0x3434('0x4d')](_0x2e2ba1[_0x3434('0x48')][_0x3434('0x4d')]));_0x569ea9['attributes']=_0x569ea9[_0x3434('0x4c')]['length']?_0x569ea9['attributes']:_0x178c24['model'];_0x569ea9['order']=qs[_0x3434('0x51')](_0x2e2ba1[_0x3434('0x48')][_0x3434('0x51')]);_0x569ea9[_0x3434('0x52')]=qs[_0x3434('0x53')](_['pick'](_0x2e2ba1[_0x3434('0x48')],_0x178c24['filters']));if(_0x2e2ba1[_0x3434('0x48')][_0x3434('0x54')]){_0x569ea9[_0x3434('0x52')]=_[_0x3434('0x55')](_0x569ea9[_0x3434('0x52')],{'$or':_[_0x3434('0x43')](_0x569ea9[_0x3434('0x4c')],function(_0x16ed24){var _0x1a38b7={};_0x1a38b7[_0x16ed24]={'$like':'%'+_0x2e2ba1['query'][_0x3434('0x54')]+'%'};return _0x1a38b7;})});}_0x569ea9=_[_0x3434('0x55')]({},_0x569ea9,_0x2e2ba1[_0x3434('0x56')]);return _0x274d2a[_0x3434('0x130')](_0x569ea9);}})[_0x3434('0x23')](function(_0x436701){if(_0x436701){_0xb8e322=_0x436701[_0x3434('0x4e')];if(!_0x2e2ba1[_0x3434('0x48')]['hasOwnProperty'](_0x3434('0x6d'))){_0x569ea9[_0x3434('0x34')]=qs[_0x3434('0x34')](_0x2e2ba1[_0x3434('0x48')]['limit']);_0x569ea9[_0x3434('0x33')]=qs[_0x3434('0x33')](_0x2e2ba1[_0x3434('0x48')][_0x3434('0x33')]);}return _0x274d2a[_0x3434('0x130')](_0x569ea9);}})[_0x3434('0x23')](function(_0x25012b){if(_0x25012b){return _0x25012b?{'count':_0xb8e322,'rows':_0x25012b}:null;}})[_0x3434('0x23')](respondWithResult(_0x2a5ce9,null))[_0x3434('0x2d')](handleError(_0x2a5ce9,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 32ed2d0..b403f04 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 _0xc576=['hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','emit'];(function(_0x3a9e6e,_0x2d4a75){var _0x7b4ead=function(_0x544e02){while(--_0x544e02){_0x3a9e6e['push'](_0x3a9e6e['shift']());}};_0x7b4ead(++_0x2d4a75);}(_0xc576,0x1ea));var _0x6c57=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0xc576[_0x30cc1a];return _0xb3f18f;};'use strict';var EventEmitter=require(_0x6c57('0x0'));var ChatWebsite=require(_0x6c57('0x1'))['db'][_0x6c57('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6c57('0x3')](0x0);var events={'afterCreate':_0x6c57('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x10a252){return function(_0x4e5df7,_0x31ab9f,_0x23861f){ChatWebsiteEvents['emit'](_0x10a252+':'+_0x4e5df7['id'],_0x4e5df7);ChatWebsiteEvents[_0x6c57('0x5')](_0x10a252,_0x4e5df7);_0x23861f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x6c57('0x6')](e,emitEvent(event));}}module[_0x6c57('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xb898=['hook','events','ChatWebsite','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xb898,0xa9));var _0x8b89=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xb898[_0x3ab9ee];return _0x82ee88;};'use strict';var EventEmitter=require(_0x8b89('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x8b89('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8b89('0x2')](0x0);var events={'afterCreate':_0x8b89('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x21123e){return function(_0x53b04c,_0x5aecd7,_0x574ffa){ChatWebsiteEvents[_0x8b89('0x4')](_0x21123e+':'+_0x53b04c['id'],_0x53b04c);ChatWebsiteEvents['emit'](_0x21123e,_0x53b04c);_0x574ffa(null);};}for(var e in events){if(events[_0x8b89('0x5')](e)){var event=events[e];ChatWebsite[_0x8b89('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 9beb3b8..7fa034e 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 _0xd3d1=['../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x295a92,_0x7d70dc){var _0x3f5dac=function(_0x47b9e8){while(--_0x47b9e8){_0x295a92['push'](_0x295a92['shift']());}};_0x3f5dac(++_0x7d70dc);}(_0xd3d1,0x172));var _0x1d3d=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xd3d1[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1d3d('0x2'));var BPromise=require(_0x1d3d('0x3'));var rp=require(_0x1d3d('0x4'));var fs=require('fs');var path=require(_0x1d3d('0x5'));var rimraf=require(_0x1d3d('0x6'));var config=require(_0x1d3d('0x7'));var attributes=require(_0x1d3d('0x8'));module[_0x1d3d('0x9')]=function(_0x1cbe06,_0x449475){return _0x1cbe06[_0x1d3d('0xa')](_0x1d3d('0xb'),attributes,{'tableName':_0x1d3d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4483=['define','ChatWebsite','chat_websites','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports'];(function(_0x12e679,_0x39cc73){var _0xc99b75=function(_0x108cfb){while(--_0x108cfb){_0x12e679['push'](_0x12e679['shift']());}};_0xc99b75(++_0x39cc73);}(_0x4483,0x1a3));var _0x3448=function(_0x36fcae,_0x37d2e3){_0x36fcae=_0x36fcae-0x0;var _0x5b2c12=_0x4483[_0x36fcae];return _0x5b2c12;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var logger=require(_0x3448('0x2'))('api');var moment=require(_0x3448('0x3'));var BPromise=require(_0x3448('0x4'));var rp=require(_0x3448('0x5'));var fs=require('fs');var path=require(_0x3448('0x6'));var rimraf=require(_0x3448('0x7'));var config=require('../../config/environment');var attributes=require(_0x3448('0x8'));module[_0x3448('0x9')]=function(_0x1b05db,_0xd3606d){return _0x1b05db[_0x3448('0xa')](_0x3448('0xb'),attributes,{'tableName':_0x3448('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index d36dddf..a077be2 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 _0x896e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x52bff2,_0x2ea2a8){var _0x25574e=function(_0x3dc63b){while(--_0x3dc63b){_0x52bff2['push'](_0x52bff2['shift']());}};_0x25574e(++_0x2ea2a8);}(_0x896e,0x1e9));var _0xe896=function(_0x301a6b,_0x48274b){_0x301a6b=_0x301a6b-0x0;var _0x11d969=_0x896e[_0x301a6b];return _0x11d969;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});config[_0xe896('0xd')]=_[_0xe896('0xe')](config[_0xe896('0xd')],{'host':_0xe896('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe896('0xd')]));require(_0xe896('0x10'))[_0xe896('0x11')](socket);function respondWithRpcPromise(_0x4afd3f,_0x305616,_0x48251e){return new BPromise(function(_0x45b15b,_0x5be679){return client[_0xe896('0x12')](_0x4afd3f,_0x48251e)[_0xe896('0x13')](function(_0xa00ae9){logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));logger[_0xe896('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x305616,_0xe896('0x15'),JSON[_0xe896('0x17')](_0xa00ae9));if(_0xa00ae9[_0xe896('0x18')]){if(_0xa00ae9['error'][_0xe896('0x19')]===0x1f4){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0xa00ae9['error']['message']);return _0x5be679(_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x305616,_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);return _0x45b15b(_0xa00ae9['error'][_0xe896('0x1a')]);}else{logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));_0x45b15b(_0xa00ae9[_0xe896('0x1b')]['message']);}})[_0xe896('0x1c')](function(_0x9714f1){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0x9714f1);_0x5be679(_0x9714f1);});});} \ No newline at end of file +var _0xba34=['then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register'];(function(_0x1a05fe,_0x45a3f8){var _0x467698=function(_0x36022c){while(--_0x36022c){_0x1a05fe['push'](_0x1a05fe['shift']());}};_0x467698(++_0x45a3f8);}(_0xba34,0x119));var _0x4ba3=function(_0x3e0d83,_0x48c31e){_0x3e0d83=_0x3e0d83-0x0;var _0x29578a=_0xba34[_0x3e0d83];return _0x29578a;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});config[_0x4ba3('0xb')]=_['defaults'](config[_0x4ba3('0xb')],{'host':_0x4ba3('0xc'),'port':0x18eb});var socket=require(_0x4ba3('0xd'))(new Redis(config[_0x4ba3('0xb')]));require(_0x4ba3('0xe'))[_0x4ba3('0xf')](socket);function respondWithRpcPromise(_0x292f58,_0x3f653c,_0x2ed106){return new BPromise(function(_0x14ebf2,_0x2d215b){return client['request'](_0x292f58,_0x2ed106)[_0x4ba3('0x10')](function(_0x9071){logger['info'](_0x4ba3('0x11'),_0x3f653c,'request\x20sent');logger[_0x4ba3('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3f653c,_0x4ba3('0x13'),JSON[_0x4ba3('0x14')](_0x9071));if(_0x9071[_0x4ba3('0x15')]){if(_0x9071[_0x4ba3('0x15')][_0x4ba3('0x16')]===0x1f4){logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);return _0x2d215b(_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);}logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);return _0x14ebf2(_0x9071[_0x4ba3('0x15')]['message']);}else{logger[_0x4ba3('0x18')](_0x4ba3('0x11'),_0x3f653c,_0x4ba3('0x13'));_0x14ebf2(_0x9071[_0x4ba3('0x19')]['message']);}})[_0x4ba3('0x1a')](function(_0xe4eff9){logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0xe4eff9);_0x2d215b(_0xe4eff9);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index aefc0af..cb6fe69 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 _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0xc0c89a,_0x1a93ce){var _0x2de380=function(_0x429851){while(--_0x429851){_0xc0c89a['push'](_0xc0c89a['shift']());}};_0x2de380(++_0x1a93ce);}(_0x7a54,0x106));var _0x47a5=function(_0x18347b,_0xb0e425){_0x18347b=_0x18347b-0x0;var _0x5646a0=_0x7a54[_0x18347b];return _0x5646a0;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x558e45,_0x4f5e4f){var _0x3e9075=function(_0x289725){while(--_0x289725){_0x558e45['push'](_0x558e45['shift']());}};_0x3e9075(++_0x4f5e4f);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ca9f1,_0xff9bd3){_0x2ca9f1=_0x2ca9f1-0x0;var _0x73f4a7=_0xb10b[_0x2ca9f1];return _0x73f4a7;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 28d0c5e..4d646a1 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 _0xd117=['./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/logo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getOfflineMessages','/:id/users','getAgents','post','/:id/canned_answers','addAnswer','diskStorage','root','%s-%s','now','originalname','single','file','format','addAvatar','server/files/images/avatars/','notify','join','server/files','offline-chat','replace','/:id/offline','any','offline','addInteraction','addApplications','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xd117,0x182));var _0x7d11=function(_0xcfcbaa,_0x369d95){_0xcfcbaa=_0xcfcbaa-0x0;var _0x157ed0=_0xd117[_0xcfcbaa];return _0x157ed0;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0xb')](_0x7d11('0x12'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['get']('/:id/canned_answers',auth[_0x7d11('0xc')](),controller['getAnswers']);router['get'](_0x7d11('0x14'),controller['getLogo']);router[_0x7d11('0xb')](_0x7d11('0x15'),controller['getAvatar']);router[_0x7d11('0xb')](_0x7d11('0x16'),controller['getCustomerAvatar']);router[_0x7d11('0xb')](_0x7d11('0x17'),controller[_0x7d11('0x18')]);router[_0x7d11('0xb')](_0x7d11('0x19'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x1a')]);router[_0x7d11('0xb')]('/:id/snippet',controller[_0x7d11('0x1b')]);router[_0x7d11('0xb')](_0x7d11('0x1c'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x1d')]);router['get'](_0x7d11('0x1e'),auth[_0x7d11('0xc')](),controller['getProactiveActions']);router['get'](_0x7d11('0x1f'),controller['getFields']);router[_0x7d11('0xb')]('/:id/offline_messages',auth[_0x7d11('0xc')](),controller[_0x7d11('0x20')]);router[_0x7d11('0xb')](_0x7d11('0x21'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x22')]);router[_0x7d11('0x23')]('/',auth[_0x7d11('0xc')](),controller['create']);router[_0x7d11('0x23')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x7d11('0x23')](_0x7d11('0x24'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x25')]);var upload=multer({'storage':multer[_0x7d11('0x26')]({'destination':function(_0xd938df,_0x282e5c,_0x1c1edd){_0x1c1edd(null,path['join'](config[_0x7d11('0x27')],'server/files/images/logos/'));},'filename':function(_0x4bfa76,_0x5126cf,_0x3ba092){_0x3ba092(null,util['format'](_0x7d11('0x28'),Date[_0x7d11('0x29')](),_0x5126cf[_0x7d11('0x2a')]));}})});router['post'](_0x7d11('0x14'),upload[_0x7d11('0x2b')](_0x7d11('0x2c')),controller['addLogo']);var upload=multer({'storage':multer[_0x7d11('0x26')]({'destination':function(_0x35a789,_0x18c049,_0x38f1be){_0x38f1be(null,path['join'](config[_0x7d11('0x27')],'server/files/images/avatars/'));},'filename':function(_0x1bc218,_0x509164,_0x31866d){_0x31866d(null,util[_0x7d11('0x2d')](_0x7d11('0x28'),Date['now'](),_0x509164['originalname']));}})});router[_0x7d11('0x23')](_0x7d11('0x15'),upload['single'](_0x7d11('0x2c')),controller[_0x7d11('0x2e')]);var upload=multer({'storage':multer[_0x7d11('0x26')]({'destination':function(_0x53ec4c,_0x9c6609,_0x553117){_0x553117(null,path['join'](config[_0x7d11('0x27')],'server/files/images/avatars/'));},'filename':function(_0x1d5d4e,_0x38fbd3,_0x34f3b6){_0x34f3b6(null,util[_0x7d11('0x2d')]('%s-%s',Date[_0x7d11('0x29')](),_0x38fbd3[_0x7d11('0x2a')]));}})});router['post']('/:id/customer_avatar',upload[_0x7d11('0x2b')](_0x7d11('0x2c')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x7d11('0x26')]({'destination':function(_0x5ac591,_0x5c0113,_0x1286d6){_0x1286d6(null,path['join'](config['root'],_0x7d11('0x2f')));},'filename':function(_0x30e2fa,_0x1b96d8,_0x2e426b){_0x2e426b(null,util[_0x7d11('0x2d')](_0x7d11('0x28'),Date[_0x7d11('0x29')](),_0x1b96d8[_0x7d11('0x2a')]));}})});router[_0x7d11('0x23')](_0x7d11('0x17'),upload[_0x7d11('0x2b')](_0x7d11('0x2c')),controller['addSystemAvatar']);router[_0x7d11('0x23')]('/:id/notify',controller[_0x7d11('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0x7d11('0x26')]({'destination':function(_0x36be62,_0xa37410,_0x4f8fd2){const _0xd36cd3=path[_0x7d11('0x31')](config[_0x7d11('0x27')],_0x7d11('0x32'),'attachments',_0x7d11('0x33'));fs_extra['ensureDir'](_0xd36cd3,function(){_0x4f8fd2(null,_0xd36cd3);});},'filename':function(_0x2e05e8,_0x4d89c3,_0xede1cc){const _0x622725=_0x4d89c3[_0x7d11('0x2a')][_0x7d11('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x52c28b=path['extname'](_0x622725);const _0x1b24af=Date[_0x7d11('0x29')]()+'-'+_0x622725['replace'](_0x52c28b,'')+_0x52c28b;_0xede1cc(null,_0x1b24af);}})});router[_0x7d11('0x23')](_0x7d11('0x35'),offlineUploadMulter[_0x7d11('0x36')](),controller[_0x7d11('0x37')]);router[_0x7d11('0x23')](_0x7d11('0x19'),auth['isAuthenticated'](),controller[_0x7d11('0x38')]);router['post'](_0x7d11('0x1c'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x39')]);router[_0x7d11('0x23')](_0x7d11('0x1e'),auth[_0x7d11('0xc')](),controller['addProactiveActions']);router['post']('/:id/users',auth[_0x7d11('0xc')](),controller[_0x7d11('0x3a')]);router[_0x7d11('0x3b')](_0x7d11('0x10'),auth[_0x7d11('0xc')](),controller['update']);router[_0x7d11('0x3c')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x3d')]);router[_0x7d11('0x3c')](_0x7d11('0x12'),auth['isAuthenticated'](),controller[_0x7d11('0x3e')]);router[_0x7d11('0x3c')](_0x7d11('0x24'),auth['isAuthenticated'](),controller[_0x7d11('0x3f')]);router['delete'](_0x7d11('0x21'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x40')]);module[_0x7d11('0x41')]=router; \ No newline at end of file +var _0x3914=['extname','replace','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','isAuthenticated','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','create','post','addDisposition','addAnswer','diskStorage','join','root','format','%s-%s','now','file','addLogo','server/files/images/avatars/','originalname','single','addAvatar','/:id/notify','notify','server/files'];(function(_0x32f823,_0x3e388e){var _0x5727a5=function(_0x5bf6b4){while(--_0x5bf6b4){_0x32f823['push'](_0x32f823['shift']());}};_0x5727a5(++_0x3e388e);}(_0x3914,0xeb));var _0x4391=function(_0x5b8310,_0x77ea6f){_0x5b8310=_0x5b8310-0x0;var _0xd3ebc1=_0x3914[_0x5b8310];return _0xd3ebc1;};'use strict';var multer=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var path=require('path');var timeout=require(_0x4391('0x2'));var express=require(_0x4391('0x3'));var router=express['Router']();var fs_extra=require(_0x4391('0x4'));var auth=require(_0x4391('0x5'));var interaction=require(_0x4391('0x6'));var config=require('../../config/environment');var controller=require(_0x4391('0x7'));router[_0x4391('0x8')]('/',auth['isAuthenticated'](),controller[_0x4391('0x9')]);router['get'](_0x4391('0xa'),auth['isAuthenticated'](),controller[_0x4391('0xb')]);router[_0x4391('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4391('0xc')]);router[_0x4391('0x8')](_0x4391('0xd'),auth['isAuthenticated'](),controller[_0x4391('0xe')]);router[_0x4391('0x8')](_0x4391('0xf'),auth[_0x4391('0x10')](),controller['getAnswers']);router[_0x4391('0x8')](_0x4391('0x11'),controller[_0x4391('0x12')]);router[_0x4391('0x8')](_0x4391('0x13'),controller[_0x4391('0x14')]);router[_0x4391('0x8')](_0x4391('0x15'),controller['getCustomerAvatar']);router[_0x4391('0x8')](_0x4391('0x16'),controller[_0x4391('0x17')]);router[_0x4391('0x8')]('/:id/interactions',auth[_0x4391('0x10')](),controller['getInteractions']);router[_0x4391('0x8')](_0x4391('0x18'),controller[_0x4391('0x19')]);router[_0x4391('0x8')](_0x4391('0x1a'),auth[_0x4391('0x10')](),controller[_0x4391('0x1b')]);router[_0x4391('0x8')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x4391('0x1c')]);router['get'](_0x4391('0x1d'),controller[_0x4391('0x1e')]);router[_0x4391('0x8')](_0x4391('0x1f'),auth[_0x4391('0x10')](),controller['getOfflineMessages']);router['get'](_0x4391('0x20'),auth[_0x4391('0x10')](),controller[_0x4391('0x21')]);router['post']('/',auth[_0x4391('0x10')](),controller[_0x4391('0x22')]);router[_0x4391('0x23')](_0x4391('0xd'),auth['isAuthenticated'](),controller[_0x4391('0x24')]);router[_0x4391('0x23')](_0x4391('0xf'),auth[_0x4391('0x10')](),controller[_0x4391('0x25')]);var upload=multer({'storage':multer[_0x4391('0x26')]({'destination':function(_0x55759a,_0x474666,_0x224e13){_0x224e13(null,path[_0x4391('0x27')](config[_0x4391('0x28')],'server/files/images/logos/'));},'filename':function(_0x4b0c28,_0x11c859,_0x3aa79f){_0x3aa79f(null,util[_0x4391('0x29')](_0x4391('0x2a'),Date[_0x4391('0x2b')](),_0x11c859['originalname']));}})});router['post']('/:id/logo',upload['single'](_0x4391('0x2c')),controller[_0x4391('0x2d')]);var upload=multer({'storage':multer[_0x4391('0x26')]({'destination':function(_0x2f7b18,_0x49aa36,_0x34059f){_0x34059f(null,path[_0x4391('0x27')](config[_0x4391('0x28')],_0x4391('0x2e')));},'filename':function(_0x74036e,_0x47b39a,_0x1a8df0){_0x1a8df0(null,util[_0x4391('0x29')](_0x4391('0x2a'),Date[_0x4391('0x2b')](),_0x47b39a[_0x4391('0x2f')]));}})});router[_0x4391('0x23')](_0x4391('0x13'),upload[_0x4391('0x30')](_0x4391('0x2c')),controller[_0x4391('0x31')]);var upload=multer({'storage':multer[_0x4391('0x26')]({'destination':function(_0x4dad76,_0x46db4c,_0x50bd4c){_0x50bd4c(null,path[_0x4391('0x27')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x174788,_0xf8313b,_0x55eb39){_0x55eb39(null,util[_0x4391('0x29')](_0x4391('0x2a'),Date[_0x4391('0x2b')](),_0xf8313b[_0x4391('0x2f')]));}})});router['post'](_0x4391('0x15'),upload['single'](_0x4391('0x2c')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x4391('0x26')]({'destination':function(_0x11e3ae,_0x12cea0,_0x3224dc){_0x3224dc(null,path[_0x4391('0x27')](config[_0x4391('0x28')],_0x4391('0x2e')));},'filename':function(_0x4235b3,_0x420fdf,_0x1b4fab){_0x1b4fab(null,util[_0x4391('0x29')](_0x4391('0x2a'),Date[_0x4391('0x2b')](),_0x420fdf[_0x4391('0x2f')]));}})});router[_0x4391('0x23')](_0x4391('0x16'),upload[_0x4391('0x30')](_0x4391('0x2c')),controller['addSystemAvatar']);router['post'](_0x4391('0x32'),controller[_0x4391('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0x4391('0x26')]({'destination':function(_0x469c71,_0x127d6c,_0x1c716c){const _0x1ea628=path[_0x4391('0x27')](config['root'],_0x4391('0x34'),'attachments','offline-chat');fs_extra['ensureDir'](_0x1ea628,function(){_0x1c716c(null,_0x1ea628);});},'filename':function(_0x4977cc,_0xc38353,_0x4073e8){const _0x33736a=_0xc38353[_0x4391('0x2f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x50f983=path[_0x4391('0x35')](_0x33736a);const _0x57feea=Date[_0x4391('0x2b')]()+'-'+_0x33736a[_0x4391('0x36')](_0x50f983,'')+_0x50f983;_0x4073e8(null,_0x57feea);}})});router[_0x4391('0x23')](_0x4391('0x37'),offlineUploadMulter[_0x4391('0x38')](),controller[_0x4391('0x39')]);router['post'](_0x4391('0x3a'),auth[_0x4391('0x10')](),controller[_0x4391('0x3b')]);router[_0x4391('0x23')](_0x4391('0x1a'),auth[_0x4391('0x10')](),controller[_0x4391('0x3c')]);router['post'](_0x4391('0x3d'),auth[_0x4391('0x10')](),controller[_0x4391('0x3e')]);router[_0x4391('0x23')](_0x4391('0x20'),auth[_0x4391('0x10')](),controller[_0x4391('0x3f')]);router['put'](_0x4391('0x40'),auth['isAuthenticated'](),controller[_0x4391('0x41')]);router[_0x4391('0x42')](_0x4391('0x40'),auth[_0x4391('0x10')](),controller[_0x4391('0x43')]);router[_0x4391('0x42')](_0x4391('0xd'),auth[_0x4391('0x10')](),controller[_0x4391('0x44')]);router[_0x4391('0x42')](_0x4391('0xf'),auth[_0x4391('0x10')](),controller[_0x4391('0x45')]);router['delete']('/:id/users',auth[_0x4391('0x10')](),controller[_0x4391('0x46')]);module[_0x4391('0x47')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 1038231..63f7d7f 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 _0xca84=['sequelize','exports','STRING','AmazonAWS','Google'];(function(_0x427b29,_0x248470){var _0x346eb1=function(_0xe0985){while(--_0xe0985){_0x427b29['push'](_0x427b29['shift']());}};_0x346eb1(++_0x248470);}(_0xca84,0xf5));var _0x4ca8=function(_0x57fd67,_0x4a14ba){_0x57fd67=_0x57fd67-0x0;var _0x4a45d1=_0xca84[_0x57fd67];return _0x4a45d1;};'use strict';var Sequelize=require(_0x4ca8('0x0'));module[_0x4ca8('0x1')]={'name':{'type':Sequelize[_0x4ca8('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x4ca8('0x3'),_0x4ca8('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x4ca8('0x2')]}}; \ No newline at end of file +var _0xc99e=['AmazonAWS','Google','sequelize','exports','STRING','ENUM'];(function(_0x2be7f8,_0x20aa22){var _0xf41ace=function(_0x5b8ffa){while(--_0x5b8ffa){_0x2be7f8['push'](_0x2be7f8['shift']());}};_0xf41ace(++_0x20aa22);}(_0xc99e,0x6e));var _0xec99=function(_0x53245c,_0x1adc42){_0x53245c=_0x53245c-0x0;var _0x1058b3=_0xc99e[_0x53245c];return _0x1058b3;};'use strict';var Sequelize=require(_0xec99('0x0'));module[_0xec99('0x1')]={'name':{'type':Sequelize[_0xec99('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xec99('0x3')](_0xec99('0x4'),_0xec99('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xec99('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index ce022fc..4b9401a 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 _0x1f52=['json','count','offset','limit','set','Content-Range','apply','reject','save','then','name','send','index','map','CloudProvider','rawAttributes','fieldName','model','keys','filters','intersection','attributes','fields','query','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','destroy','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0xfece2c,_0x351bf8){var _0x27c70c=function(_0x57c5c1){while(--_0x57c5c1){_0xfece2c['push'](_0xfece2c['shift']());}};_0x27c70c(++_0x351bf8);}(_0x1f52,0x74));var _0x21f5=function(_0x6088d5,_0xfaf001){_0x6088d5=_0x6088d5-0x0;var _0x57160b=_0x1f52[_0x6088d5];return _0x57160b;};'use strict';var pdf=require(_0x21f5('0x0'));var emlformat=require(_0x21f5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x21f5('0x2'));var jsonpatch=require(_0x21f5('0x3'));var rp=require(_0x21f5('0x4'));var moment=require('moment');var BPromise=require(_0x21f5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x21f5('0x6'));var csv=require(_0x21f5('0x7'));var ejs=require(_0x21f5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21f5('0x9'));var squel=require('squel');var crypto=require(_0x21f5('0xa'));var jsforce=require(_0x21f5('0xb'));var deskjs=require(_0x21f5('0xc'));var toCsv=require(_0x21f5('0x7'));var querystring=require(_0x21f5('0xd'));var Papa=require(_0x21f5('0xe'));var Redis=require(_0x21f5('0xf'));var authService=require(_0x21f5('0x10'));var qs=require(_0x21f5('0x11'));var as=require(_0x21f5('0x12'));var hardwareService=require(_0x21f5('0x13'));var logger=require('../../config/logger')(_0x21f5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x21f5('0x15'));var db=require(_0x21f5('0x16'))['db'];function respondWithStatusCode(_0x43fb75,_0x113d6d){_0x113d6d=_0x113d6d||0xcc;return function(_0x9716c3){if(_0x9716c3){return _0x43fb75[_0x21f5('0x17')](_0x113d6d);}return _0x43fb75[_0x21f5('0x18')](_0x113d6d)[_0x21f5('0x19')]();};}function respondWithResult(_0x4bb48e,_0x4493cf){_0x4493cf=_0x4493cf||0xc8;return function(_0x111338){if(_0x111338){return _0x4bb48e[_0x21f5('0x18')](_0x4493cf)[_0x21f5('0x1a')](_0x111338);}};}function respondWithFilteredResult(_0x40f713,_0x43074c){return function(_0x492cec){if(_0x492cec){var _0x7860cf=_0x492cec[_0x21f5('0x1b')],_0x5c2d9d=_0x43074c[_0x21f5('0x1c')],_0x213d6c=_0x43074c[_0x21f5('0x1c')]+_0x43074c[_0x21f5('0x1d')],_0x4fda91;if(_0x213d6c>=_0x7860cf){_0x213d6c=_0x7860cf;_0x4fda91=0xc8;}else{_0x4fda91=0xce;}_0x40f713['status'](_0x4fda91);return _0x40f713[_0x21f5('0x1e')](_0x21f5('0x1f'),_0x5c2d9d+'-'+_0x213d6c+'/'+_0x7860cf)[_0x21f5('0x1a')](_0x492cec);}return null;};}function patchUpdates(_0x5c8e47){return function(_0x1b9bf7){try{jsonpatch[_0x21f5('0x20')](_0x1b9bf7,_0x5c8e47,!![]);}catch(_0x4a24ff){return BPromise[_0x21f5('0x21')](_0x4a24ff);}return _0x1b9bf7[_0x21f5('0x22')]();};}function saveUpdates(_0x1549e4,_0x338218){return function(_0x3b4466){if(_0x3b4466){return _0x3b4466['update'](_0x1549e4)[_0x21f5('0x23')](function(_0x14deb0){return _0x14deb0;});}return null;};}function removeEntity(_0x4feefd,_0x14cc66){return function(_0x4309cf){if(_0x4309cf){return _0x4309cf['destroy']()[_0x21f5('0x23')](function(){_0x4feefd[_0x21f5('0x18')](0xcc)[_0x21f5('0x19')]();});}};}function handleEntityNotFound(_0x9ef1a6,_0x7337d8){return function(_0x102f56){if(!_0x102f56){_0x9ef1a6['sendStatus'](0x194);}return _0x102f56;};}function handleError(_0x2815db,_0x4b8757){_0x4b8757=_0x4b8757||0x1f4;return function(_0x2badc3){logger['error'](_0x2badc3['stack']);if(_0x2badc3[_0x21f5('0x24')]){delete _0x2badc3[_0x21f5('0x24')];}_0x2815db[_0x21f5('0x18')](_0x4b8757)[_0x21f5('0x25')](_0x2badc3);};}exports[_0x21f5('0x26')]=function(_0x5abeea,_0x50776a){var _0x3f4738={},_0x5c2e65={},_0x423362={'count':0x0,'rows':[]};var _0x38288b=_[_0x21f5('0x27')](db[_0x21f5('0x28')][_0x21f5('0x29')],function(_0x4d5348){return{'name':_0x4d5348[_0x21f5('0x2a')],'type':_0x4d5348['type']['key']};});_0x5c2e65[_0x21f5('0x2b')]=_[_0x21f5('0x27')](_0x38288b,_0x21f5('0x24'));_0x5c2e65['query']=_[_0x21f5('0x2c')](_0x5abeea['query']);_0x5c2e65[_0x21f5('0x2d')]=_[_0x21f5('0x2e')](_0x5c2e65[_0x21f5('0x2b')],_0x5c2e65['query']);_0x3f4738[_0x21f5('0x2f')]=_['intersection'](_0x5c2e65[_0x21f5('0x2b')],qs[_0x21f5('0x30')](_0x5abeea[_0x21f5('0x31')][_0x21f5('0x30')]));_0x3f4738[_0x21f5('0x2f')]=_0x3f4738['attributes'][_0x21f5('0x32')]?_0x3f4738[_0x21f5('0x2f')]:_0x5c2e65['model'];if(!_0x5abeea[_0x21f5('0x31')]['hasOwnProperty'](_0x21f5('0x33'))){_0x3f4738[_0x21f5('0x1d')]=qs[_0x21f5('0x1d')](_0x5abeea['query'][_0x21f5('0x1d')]);_0x3f4738[_0x21f5('0x1c')]=qs[_0x21f5('0x1c')](_0x5abeea['query'][_0x21f5('0x1c')]);}_0x3f4738[_0x21f5('0x34')]=qs[_0x21f5('0x35')](_0x5abeea['query'][_0x21f5('0x35')]);_0x3f4738[_0x21f5('0x36')]=qs['filters'](_[_0x21f5('0x37')](_0x5abeea['query'],_0x5c2e65[_0x21f5('0x2d')]),_0x38288b);if(_0x5abeea['query'][_0x21f5('0x38')]){_0x3f4738['where']=_[_0x21f5('0x39')](_0x3f4738[_0x21f5('0x36')],{'$or':_[_0x21f5('0x27')](_0x38288b,function(_0x843571){if(_0x843571[_0x21f5('0x3a')]!==_0x21f5('0x3b')){var _0x22c3eb={};_0x22c3eb[_0x843571[_0x21f5('0x24')]]={'$like':'%'+_0x5abeea[_0x21f5('0x31')][_0x21f5('0x38')]+'%'};return _0x22c3eb;}})});}_0x3f4738=_[_0x21f5('0x39')]({},_0x3f4738,_0x5abeea[_0x21f5('0x3c')]);var _0x284fdb={'where':_0x3f4738[_0x21f5('0x36')]};return db[_0x21f5('0x28')][_0x21f5('0x1b')](_0x284fdb)[_0x21f5('0x23')](function(_0x126d37){_0x423362[_0x21f5('0x1b')]=_0x126d37;if(_0x5abeea[_0x21f5('0x31')][_0x21f5('0x3d')]){_0x3f4738[_0x21f5('0x3e')]=[{'all':!![]}];}return db['CloudProvider'][_0x21f5('0x3f')](_0x3f4738);})[_0x21f5('0x23')](function(_0xc9d00b){_0x423362[_0x21f5('0x40')]=_0xc9d00b;return _0x423362;})['then'](respondWithFilteredResult(_0x50776a,_0x3f4738))[_0x21f5('0x41')](handleError(_0x50776a,null));};exports['show']=function(_0x90ef4,_0x42590a){var _0x11271a={'raw':!![],'where':{'id':_0x90ef4['params']['id']}},_0x13cdff={};_0x13cdff[_0x21f5('0x2b')]=_[_0x21f5('0x2c')](db[_0x21f5('0x28')][_0x21f5('0x29')]);_0x13cdff[_0x21f5('0x31')]=_[_0x21f5('0x2c')](_0x90ef4['query']);_0x13cdff[_0x21f5('0x2d')]=_[_0x21f5('0x2e')](_0x13cdff[_0x21f5('0x2b')],_0x13cdff[_0x21f5('0x31')]);_0x11271a[_0x21f5('0x2f')]=_[_0x21f5('0x2e')](_0x13cdff[_0x21f5('0x2b')],qs[_0x21f5('0x30')](_0x90ef4[_0x21f5('0x31')][_0x21f5('0x30')]));_0x11271a[_0x21f5('0x2f')]=_0x11271a['attributes']['length']?_0x11271a['attributes']:_0x13cdff[_0x21f5('0x2b')];if(_0x90ef4[_0x21f5('0x31')][_0x21f5('0x3d')]){_0x11271a[_0x21f5('0x3e')]=[{'all':!![]}];}_0x11271a=_[_0x21f5('0x39')]({},_0x11271a,_0x90ef4[_0x21f5('0x3c')]);return db[_0x21f5('0x28')][_0x21f5('0x42')](_0x11271a)[_0x21f5('0x23')](handleEntityNotFound(_0x42590a,null))[_0x21f5('0x23')](respondWithResult(_0x42590a,null))[_0x21f5('0x41')](handleError(_0x42590a,null));};exports[_0x21f5('0x43')]=function(_0x2f80c7,_0xa30139){return db['CloudProvider']['create'](_0x2f80c7[_0x21f5('0x44')],{})[_0x21f5('0x23')](respondWithResult(_0xa30139,0xc9))[_0x21f5('0x41')](handleError(_0xa30139,null));};exports['update']=function(_0x44c0d5,_0x4a4693){if(_0x44c0d5[_0x21f5('0x44')]['id']){delete _0x44c0d5['body']['id'];}return db[_0x21f5('0x28')][_0x21f5('0x42')]({'where':{'id':_0x44c0d5['params']['id']}})[_0x21f5('0x23')](handleEntityNotFound(_0x4a4693,null))[_0x21f5('0x23')](saveUpdates(_0x44c0d5[_0x21f5('0x44')],null))[_0x21f5('0x23')](respondWithResult(_0x4a4693,null))[_0x21f5('0x41')](handleError(_0x4a4693,null));};exports[_0x21f5('0x45')]=function(_0x4af98d,_0x41484c){return db['CloudProvider']['find']({'where':{'id':_0x4af98d[_0x21f5('0x46')]['id']}})[_0x21f5('0x23')](handleEntityNotFound(_0x41484c,null))['then'](removeEntity(_0x41484c,null))['catch'](handleError(_0x41484c,null));}; \ No newline at end of file +var _0x8d41=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','map','CloudProvider','rawAttributes','fieldName','type','model','name','keys','query','intersection','attributes','fields','hasOwnProperty','sort','filters','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x8d41,0x1aa));var _0x18d4=function(_0x3ddb4e,_0x5d9ecf){_0x3ddb4e=_0x3ddb4e-0x0;var _0x16202e=_0x8d41[_0x3ddb4e];return _0x16202e;};'use strict';var pdf=require(_0x18d4('0x0'));var emlformat=require(_0x18d4('0x1'));var rimraf=require(_0x18d4('0x2'));var zipdir=require(_0x18d4('0x3'));var jsonpatch=require(_0x18d4('0x4'));var rp=require('request-promise');var moment=require(_0x18d4('0x5'));var BPromise=require(_0x18d4('0x6'));var Mustache=require(_0x18d4('0x7'));var util=require(_0x18d4('0x8'));var path=require(_0x18d4('0x9'));var sox=require('sox');var csv=require(_0x18d4('0xa'));var ejs=require(_0x18d4('0xb'));var fs=require('fs');var fs_extra=require(_0x18d4('0xc'));var _=require(_0x18d4('0xd'));var squel=require('squel');var crypto=require(_0x18d4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x18d4('0xf'));var toCsv=require(_0x18d4('0xa'));var querystring=require(_0x18d4('0x10'));var Papa=require(_0x18d4('0x11'));var Redis=require(_0x18d4('0x12'));var authService=require(_0x18d4('0x13'));var qs=require(_0x18d4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18d4('0x15'));var logger=require(_0x18d4('0x16'))(_0x18d4('0x17'));var utils=require(_0x18d4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x18d4('0x19'));var db=require(_0x18d4('0x1a'))['db'];function respondWithStatusCode(_0x493163,_0x3d2433){_0x3d2433=_0x3d2433||0xcc;return function(_0x1d6ce2){if(_0x1d6ce2){return _0x493163[_0x18d4('0x1b')](_0x3d2433);}return _0x493163[_0x18d4('0x1c')](_0x3d2433)['end']();};}function respondWithResult(_0x356bc8,_0x3dace8){_0x3dace8=_0x3dace8||0xc8;return function(_0x1a118a){if(_0x1a118a){return _0x356bc8[_0x18d4('0x1c')](_0x3dace8)[_0x18d4('0x1d')](_0x1a118a);}};}function respondWithFilteredResult(_0x80187c,_0x2a2f9a){return function(_0x43b532){if(_0x43b532){var _0x434a8d=_0x43b532['count'],_0x5a0dc5=_0x2a2f9a[_0x18d4('0x1e')],_0x4876b6=_0x2a2f9a[_0x18d4('0x1e')]+_0x2a2f9a[_0x18d4('0x1f')],_0x29eb2f;if(_0x4876b6>=_0x434a8d){_0x4876b6=_0x434a8d;_0x29eb2f=0xc8;}else{_0x29eb2f=0xce;}_0x80187c[_0x18d4('0x1c')](_0x29eb2f);return _0x80187c[_0x18d4('0x20')](_0x18d4('0x21'),_0x5a0dc5+'-'+_0x4876b6+'/'+_0x434a8d)[_0x18d4('0x1d')](_0x43b532);}return null;};}function patchUpdates(_0x3a991e){return function(_0x1ca753){try{jsonpatch[_0x18d4('0x22')](_0x1ca753,_0x3a991e,!![]);}catch(_0x393d99){return BPromise[_0x18d4('0x23')](_0x393d99);}return _0x1ca753['save']();};}function saveUpdates(_0x1919ed,_0x2acdc2){return function(_0x508068){if(_0x508068){return _0x508068[_0x18d4('0x24')](_0x1919ed)[_0x18d4('0x25')](function(_0x2f8ed4){return _0x2f8ed4;});}return null;};}function removeEntity(_0x14a6b2,_0x1f08e2){return function(_0x3f85ac){if(_0x3f85ac){return _0x3f85ac[_0x18d4('0x26')]()[_0x18d4('0x25')](function(){_0x14a6b2[_0x18d4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35a605,_0x23091d){return function(_0x49fbd3){if(!_0x49fbd3){_0x35a605[_0x18d4('0x1b')](0x194);}return _0x49fbd3;};}function handleError(_0x2081f7,_0x49914c){_0x49914c=_0x49914c||0x1f4;return function(_0x406521){logger[_0x18d4('0x27')](_0x406521[_0x18d4('0x28')]);if(_0x406521['name']){delete _0x406521['name'];}_0x2081f7[_0x18d4('0x1c')](_0x49914c)[_0x18d4('0x29')](_0x406521);};}exports['index']=function(_0x4f7dd7,_0x28c907){var _0x50762b={},_0x22b6df={},_0x320415={'count':0x0,'rows':[]};var _0x53ae70=_[_0x18d4('0x2a')](db[_0x18d4('0x2b')][_0x18d4('0x2c')],function(_0x4a12e1){return{'name':_0x4a12e1[_0x18d4('0x2d')],'type':_0x4a12e1[_0x18d4('0x2e')]['key']};});_0x22b6df[_0x18d4('0x2f')]=_[_0x18d4('0x2a')](_0x53ae70,_0x18d4('0x30'));_0x22b6df['query']=_[_0x18d4('0x31')](_0x4f7dd7[_0x18d4('0x32')]);_0x22b6df['filters']=_[_0x18d4('0x33')](_0x22b6df[_0x18d4('0x2f')],_0x22b6df[_0x18d4('0x32')]);_0x50762b[_0x18d4('0x34')]=_[_0x18d4('0x33')](_0x22b6df[_0x18d4('0x2f')],qs['fields'](_0x4f7dd7[_0x18d4('0x32')][_0x18d4('0x35')]));_0x50762b[_0x18d4('0x34')]=_0x50762b[_0x18d4('0x34')]['length']?_0x50762b[_0x18d4('0x34')]:_0x22b6df[_0x18d4('0x2f')];if(!_0x4f7dd7[_0x18d4('0x32')][_0x18d4('0x36')]('nolimit')){_0x50762b[_0x18d4('0x1f')]=qs[_0x18d4('0x1f')](_0x4f7dd7[_0x18d4('0x32')][_0x18d4('0x1f')]);_0x50762b['offset']=qs[_0x18d4('0x1e')](_0x4f7dd7['query']['offset']);}_0x50762b['order']=qs[_0x18d4('0x37')](_0x4f7dd7['query']['sort']);_0x50762b['where']=qs[_0x18d4('0x38')](_[_0x18d4('0x39')](_0x4f7dd7[_0x18d4('0x32')],_0x22b6df[_0x18d4('0x38')]),_0x53ae70);if(_0x4f7dd7[_0x18d4('0x32')][_0x18d4('0x3a')]){_0x50762b[_0x18d4('0x3b')]=_[_0x18d4('0x3c')](_0x50762b[_0x18d4('0x3b')],{'$or':_[_0x18d4('0x2a')](_0x53ae70,function(_0x4f7f4a){if(_0x4f7f4a[_0x18d4('0x2e')]!==_0x18d4('0x3d')){var _0x53e002={};_0x53e002[_0x4f7f4a[_0x18d4('0x30')]]={'$like':'%'+_0x4f7dd7[_0x18d4('0x32')][_0x18d4('0x3a')]+'%'};return _0x53e002;}})});}_0x50762b=_['merge']({},_0x50762b,_0x4f7dd7['options']);var _0x282a80={'where':_0x50762b[_0x18d4('0x3b')]};return db[_0x18d4('0x2b')]['count'](_0x282a80)[_0x18d4('0x25')](function(_0x5cf3ef){_0x320415[_0x18d4('0x3e')]=_0x5cf3ef;if(_0x4f7dd7[_0x18d4('0x32')][_0x18d4('0x3f')]){_0x50762b[_0x18d4('0x40')]=[{'all':!![]}];}return db['CloudProvider'][_0x18d4('0x41')](_0x50762b);})[_0x18d4('0x25')](function(_0x37f05b){_0x320415[_0x18d4('0x42')]=_0x37f05b;return _0x320415;})[_0x18d4('0x25')](respondWithFilteredResult(_0x28c907,_0x50762b))[_0x18d4('0x43')](handleError(_0x28c907,null));};exports[_0x18d4('0x44')]=function(_0x1e8180,_0x48e894){var _0x1c92cd={'raw':!![],'where':{'id':_0x1e8180[_0x18d4('0x45')]['id']}},_0x588db0={};_0x588db0[_0x18d4('0x2f')]=_[_0x18d4('0x31')](db[_0x18d4('0x2b')][_0x18d4('0x2c')]);_0x588db0[_0x18d4('0x32')]=_['keys'](_0x1e8180[_0x18d4('0x32')]);_0x588db0['filters']=_['intersection'](_0x588db0[_0x18d4('0x2f')],_0x588db0[_0x18d4('0x32')]);_0x1c92cd[_0x18d4('0x34')]=_[_0x18d4('0x33')](_0x588db0['model'],qs[_0x18d4('0x35')](_0x1e8180[_0x18d4('0x32')][_0x18d4('0x35')]));_0x1c92cd['attributes']=_0x1c92cd[_0x18d4('0x34')]['length']?_0x1c92cd[_0x18d4('0x34')]:_0x588db0['model'];if(_0x1e8180[_0x18d4('0x32')][_0x18d4('0x3f')]){_0x1c92cd[_0x18d4('0x40')]=[{'all':!![]}];}_0x1c92cd=_['merge']({},_0x1c92cd,_0x1e8180[_0x18d4('0x46')]);return db[_0x18d4('0x2b')]['find'](_0x1c92cd)[_0x18d4('0x25')](handleEntityNotFound(_0x48e894,null))[_0x18d4('0x25')](respondWithResult(_0x48e894,null))[_0x18d4('0x43')](handleError(_0x48e894,null));};exports[_0x18d4('0x47')]=function(_0x50432f,_0x294553){return db[_0x18d4('0x2b')][_0x18d4('0x47')](_0x50432f[_0x18d4('0x48')],{})[_0x18d4('0x25')](respondWithResult(_0x294553,0xc9))[_0x18d4('0x43')](handleError(_0x294553,null));};exports[_0x18d4('0x24')]=function(_0x31cb9b,_0x3b2a34){if(_0x31cb9b[_0x18d4('0x48')]['id']){delete _0x31cb9b['body']['id'];}return db[_0x18d4('0x2b')][_0x18d4('0x49')]({'where':{'id':_0x31cb9b[_0x18d4('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b2a34,null))[_0x18d4('0x25')](saveUpdates(_0x31cb9b[_0x18d4('0x48')],null))[_0x18d4('0x25')](respondWithResult(_0x3b2a34,null))[_0x18d4('0x43')](handleError(_0x3b2a34,null));};exports['destroy']=function(_0x30fecd,_0x548a6c){return db['CloudProvider']['find']({'where':{'id':_0x30fecd[_0x18d4('0x45')]['id']}})[_0x18d4('0x25')](handleEntityNotFound(_0x548a6c,null))[_0x18d4('0x25')](removeEntity(_0x548a6c,null))[_0x18d4('0x43')](handleError(_0x548a6c,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 55916f3..f6ec1df 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 _0xf8a7=['exports','define','CloudProvider','util','api','moment','request-promise','rimraf','./cloudProvider.attributes'];(function(_0x227b64,_0x1c6f72){var _0xc84cb5=function(_0x12e690){while(--_0x12e690){_0x227b64['push'](_0x227b64['shift']());}};_0xc84cb5(++_0x1c6f72);}(_0xf8a7,0x147));var _0x7f8a=function(_0x6b09f6,_0x869c74){_0x6b09f6=_0x6b09f6-0x0;var _0x29903b=_0xf8a7[_0x6b09f6];return _0x29903b;};'use strict';var _=require('lodash');var util=require(_0x7f8a('0x0'));var logger=require('../../config/logger')(_0x7f8a('0x1'));var moment=require(_0x7f8a('0x2'));var BPromise=require('bluebird');var rp=require(_0x7f8a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f8a('0x4'));var config=require('../../config/environment');var attributes=require(_0x7f8a('0x5'));module[_0x7f8a('0x6')]=function(_0x5de62e,_0x1b8ca9){return _0x5de62e[_0x7f8a('0x7')](_0x7f8a('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4639=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x4639,0x1ac));var _0x9463=function(_0x17141f,_0x4d7c4b){_0x17141f=_0x17141f-0x0;var _0x3ee900=_0x4639[_0x17141f];return _0x3ee900;};'use strict';var _=require(_0x9463('0x0'));var util=require(_0x9463('0x1'));var logger=require(_0x9463('0x2'))(_0x9463('0x3'));var moment=require(_0x9463('0x4'));var BPromise=require(_0x9463('0x5'));var rp=require(_0x9463('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9463('0x7'));var attributes=require(_0x9463('0x8'));module[_0x9463('0x9')]=function(_0x217af9,_0x5f5613){return _0x217af9[_0x9463('0xa')](_0x9463('0xb'),attributes,{'tableName':_0x9463('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index ba5a734..601e9e4 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 _0x31d2=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3e3c7a,_0x381151){var _0x25436a=function(_0x44f95c){while(--_0x44f95c){_0x3e3c7a['push'](_0x3e3c7a['shift']());}};_0x25436a(++_0x381151);}(_0x31d2,0xe5));var _0x231d=function(_0x25b558,_0x18c669){_0x25b558=_0x25b558-0x0;var _0x3c2769=_0x31d2[_0x25b558];return _0x3c2769;};'use strict';var _=require('lodash');var util=require(_0x231d('0x0'));var moment=require('moment');var BPromise=require(_0x231d('0x1'));var rs=require(_0x231d('0x2'));var fs=require('fs');var Redis=require(_0x231d('0x3'));var db=require(_0x231d('0x4'))['db'];var utils=require(_0x231d('0x5'));var logger=require('../../config/logger')(_0x231d('0x6'));var config=require(_0x231d('0x7'));var jayson=require(_0x231d('0x8'));var client=jayson[_0x231d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f13be,_0x250ed5,_0x295b05){return new BPromise(function(_0x4a543f,_0x2f9190){return client[_0x231d('0xa')](_0x3f13be,_0x295b05)['then'](function(_0x174256){logger[_0x231d('0xb')](_0x231d('0xc'),_0x250ed5,_0x231d('0xd'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x250ed5,_0x231d('0xd'),JSON[_0x231d('0xe')](_0x174256));if(_0x174256['error']){if(_0x174256[_0x231d('0xf')][_0x231d('0x10')]===0x1f4){logger[_0x231d('0xf')](_0x231d('0xc'),_0x250ed5,_0x174256[_0x231d('0xf')][_0x231d('0x11')]);return _0x2f9190(_0x174256[_0x231d('0xf')][_0x231d('0x11')]);}logger[_0x231d('0xf')](_0x231d('0xc'),_0x250ed5,_0x174256['error'][_0x231d('0x11')]);return _0x4a543f(_0x174256[_0x231d('0xf')][_0x231d('0x11')]);}else{logger[_0x231d('0xb')](_0x231d('0xc'),_0x250ed5,_0x231d('0xd'));_0x4a543f(_0x174256[_0x231d('0x12')][_0x231d('0x11')]);}})[_0x231d('0x13')](function(_0x213710){logger[_0x231d('0xf')]('CloudProvider,\x20%s,\x20%s',_0x250ed5,_0x213710);_0x2f9190(_0x213710);});});} \ No newline at end of file +var _0x3206=['then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x3206,0xdc));var _0x6320=function(_0x22d6d9,_0x4ac1c1){_0x22d6d9=_0x22d6d9-0x0;var _0x258886=_0x3206[_0x22d6d9];return _0x258886;};'use strict';var _=require(_0x6320('0x0'));var util=require('util');var moment=require(_0x6320('0x1'));var BPromise=require(_0x6320('0x2'));var rs=require(_0x6320('0x3'));var fs=require('fs');var Redis=require(_0x6320('0x4'));var db=require(_0x6320('0x5'))['db'];var utils=require(_0x6320('0x6'));var logger=require(_0x6320('0x7'))(_0x6320('0x8'));var config=require(_0x6320('0x9'));var jayson=require(_0x6320('0xa'));var client=jayson[_0x6320('0xb')][_0x6320('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13e3ce,_0x2c43e0,_0x525f3d){return new BPromise(function(_0xaa72ba,_0x44875c){return client[_0x6320('0xd')](_0x13e3ce,_0x525f3d)[_0x6320('0xe')](function(_0x335433){logger[_0x6320('0xf')](_0x6320('0x10'),_0x2c43e0,'request\x20sent');logger[_0x6320('0x11')](_0x6320('0x12'),_0x2c43e0,'request\x20sent',JSON[_0x6320('0x13')](_0x335433));if(_0x335433[_0x6320('0x14')]){if(_0x335433[_0x6320('0x14')][_0x6320('0x15')]===0x1f4){logger[_0x6320('0x14')](_0x6320('0x10'),_0x2c43e0,_0x335433[_0x6320('0x14')][_0x6320('0x16')]);return _0x44875c(_0x335433[_0x6320('0x14')][_0x6320('0x16')]);}logger['error'](_0x6320('0x10'),_0x2c43e0,_0x335433[_0x6320('0x14')][_0x6320('0x16')]);return _0xaa72ba(_0x335433[_0x6320('0x14')][_0x6320('0x16')]);}else{logger[_0x6320('0xf')](_0x6320('0x10'),_0x2c43e0,_0x6320('0x17'));_0xaa72ba(_0x335433[_0x6320('0x18')][_0x6320('0x16')]);}})[_0x6320('0x19')](function(_0x151140){logger[_0x6320('0x14')](_0x6320('0x10'),_0x2c43e0,_0x151140);_0x44875c(_0x151140);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 7b279d7..28e6892 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 _0x49a1=['multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','/:id','update','destroy','exports'];(function(_0x149155,_0x4668d9){var _0x154d7a=function(_0xa1a287){while(--_0xa1a287){_0x149155['push'](_0x149155['shift']());}};_0x154d7a(++_0x4668d9);}(_0x49a1,0x190));var _0x149a=function(_0x4ac58f,_0x4c18f7){_0x4ac58f=_0x4ac58f-0x0;var _0x5c9a88=_0x49a1[_0x4ac58f];return _0x5c9a88;};'use strict';var multer=require(_0x149a('0x0'));var util=require(_0x149a('0x1'));var path=require(_0x149a('0x2'));var timeout=require(_0x149a('0x3'));var express=require(_0x149a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x149a('0x5'));var config=require(_0x149a('0x6'));var controller=require('./cloudProvider.controller');router[_0x149a('0x7')]('/',auth[_0x149a('0x8')](),controller['index']);router[_0x149a('0x7')]('/:id',auth[_0x149a('0x8')](),controller[_0x149a('0x9')]);router['post']('/',auth[_0x149a('0x8')](),controller[_0x149a('0xa')]);router[_0x149a('0xb')](_0x149a('0xc'),auth[_0x149a('0x8')](),controller[_0x149a('0xd')]);router['delete']('/:id',auth[_0x149a('0x8')](),controller[_0x149a('0xe')]);module[_0x149a('0xf')]=router; \ No newline at end of file +var _0x7890=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','post','isAuthenticated','put','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra'];(function(_0x5066a4,_0x2aa89f){var _0x1c2f52=function(_0xbee47f){while(--_0xbee47f){_0x5066a4['push'](_0x5066a4['shift']());}};_0x1c2f52(++_0x2aa89f);}(_0x7890,0x1d7));var _0x0789=function(_0x28a0f5,_0xc9ac99){_0x28a0f5=_0x28a0f5-0x0;var _0x5aa17f=_0x7890[_0x28a0f5];return _0x5aa17f;};'use strict';var multer=require(_0x0789('0x0'));var util=require(_0x0789('0x1'));var path=require('path');var timeout=require(_0x0789('0x2'));var express=require('express');var router=express[_0x0789('0x3')]();var fs_extra=require(_0x0789('0x4'));var auth=require(_0x0789('0x5'));var interaction=require(_0x0789('0x6'));var config=require(_0x0789('0x7'));var controller=require('./cloudProvider.controller');router[_0x0789('0x8')]('/',auth['isAuthenticated'](),controller[_0x0789('0x9')]);router[_0x0789('0x8')](_0x0789('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0789('0xb')]('/',auth[_0x0789('0xc')](),controller['create']);router[_0x0789('0xd')](_0x0789('0xa'),auth[_0x0789('0xc')](),controller[_0x0789('0xe')]);router[_0x0789('0xf')]('/:id',auth[_0x0789('0xc')](),controller[_0x0789('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 651d890..51f4ed4 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 _0xfb6c=['name','STRING','sequelize'];(function(_0x15fce8,_0x7612b7){var _0x3f54aa=function(_0x4c1752){while(--_0x4c1752){_0x15fce8['push'](_0x15fce8['shift']());}};_0x3f54aa(++_0x7612b7);}(_0xfb6c,0x152));var _0xcfb6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfb6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcfb6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xcfb6('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xcfb6('0x2')]},'website':{'type':Sequelize[_0xcfb6('0x2')]},'phone':{'type':Sequelize[_0xcfb6('0x2')]},'fax':{'type':Sequelize[_0xcfb6('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xcfb6('0x2')]},'postalCode':{'type':Sequelize[_0xcfb6('0x2')]},'city':{'type':Sequelize[_0xcfb6('0x2')]},'country':{'type':Sequelize[_0xcfb6('0x2')]},'email':{'type':Sequelize[_0xcfb6('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xcfb6('0x2')]},'sStreet':{'type':Sequelize[_0xcfb6('0x2')]},'sPostalCode':{'type':Sequelize[_0xcfb6('0x2')]},'sCity':{'type':Sequelize[_0xcfb6('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf0a7=['exports','STRING'];(function(_0x424960,_0x220539){var _0x5c7128=function(_0x4a437c){while(--_0x4a437c){_0x424960['push'](_0x424960['shift']());}};_0x5c7128(++_0x220539);}(_0xf0a7,0x118));var _0x7f0a=function(_0x4b5409,_0x472b71){_0x4b5409=_0x4b5409-0x0;var _0x90b623=_0xf0a7[_0x4b5409];return _0x90b623;};'use strict';var Sequelize=require('sequelize');module[_0x7f0a('0x0')]={'name':{'type':Sequelize[_0x7f0a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x7f0a('0x1')]},'fax':{'type':Sequelize[_0x7f0a('0x1')]},'type':{'type':Sequelize[_0x7f0a('0x1')]},'street':{'type':Sequelize[_0x7f0a('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x7f0a('0x1')]},'country':{'type':Sequelize[_0x7f0a('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x7f0a('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x7f0a('0x1')]},'description':{'type':Sequelize[_0x7f0a('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 4afa02a..7cc1b7c 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 _0x1a8f=['json','apply','save','destroy','get','Companies','UserProfileResource','then','error','stack','name','CmCompany','describe','model','query','keys','filters','intersection','attributes','fields','order','sort','merge','map','filter','options','where','include','findAll','rows','catch','show','params','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','CmContact','addContacts','ids','getContacts','pick','hasOwnProperty','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range'];(function(_0x152256,_0x28772e){var _0x2ebc99=function(_0x28c063){while(--_0x28c063){_0x152256['push'](_0x152256['shift']());}};_0x2ebc99(++_0x28772e);}(_0x1a8f,0x88));var _0xf1a8=function(_0x1df378,_0x2c4af3){_0x1df378=_0x1df378-0x0;var _0x2cb9fe=_0x1a8f[_0x1df378];return _0x2cb9fe;};'use strict';var pdf=require(_0xf1a8('0x0'));var emlformat=require(_0xf1a8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf1a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf1a8('0x3'));var moment=require(_0xf1a8('0x4'));var BPromise=require(_0xf1a8('0x5'));var Mustache=require('mustache');var util=require(_0xf1a8('0x6'));var path=require(_0xf1a8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf1a8('0x8'));var fs=require('fs');var fs_extra=require(_0xf1a8('0x9'));var _=require(_0xf1a8('0xa'));var squel=require(_0xf1a8('0xb'));var crypto=require(_0xf1a8('0xc'));var jsforce=require(_0xf1a8('0xd'));var deskjs=require(_0xf1a8('0xe'));var toCsv=require(_0xf1a8('0xf'));var querystring=require(_0xf1a8('0x10'));var Papa=require(_0xf1a8('0x11'));var Redis=require(_0xf1a8('0x12'));var authService=require(_0xf1a8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf1a8('0x14'));var hardwareService=require(_0xf1a8('0x15'));var logger=require(_0xf1a8('0x16'))(_0xf1a8('0x17'));var utils=require(_0xf1a8('0x18'));var config=require(_0xf1a8('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32b22b,_0x2151ab){_0x2151ab=_0x2151ab||0xcc;return function(_0x5e28f0){if(_0x5e28f0){return _0x32b22b[_0xf1a8('0x1a')](_0x2151ab);}return _0x32b22b[_0xf1a8('0x1b')](_0x2151ab)[_0xf1a8('0x1c')]();};}function respondWithResult(_0x1fedf3,_0x110e06){_0x110e06=_0x110e06||0xc8;return function(_0x78b03a){if(_0x78b03a){return _0x1fedf3[_0xf1a8('0x1b')](_0x110e06)['json'](_0x78b03a);}};}function respondWithFilteredResult(_0x2d9440,_0x28aca3){return function(_0x35285c){if(_0x35285c){var _0x2f18cc=_0x35285c[_0xf1a8('0x1d')],_0x405c58=_0x28aca3[_0xf1a8('0x1e')],_0x8fd875=_0x28aca3[_0xf1a8('0x1e')]+_0x28aca3[_0xf1a8('0x1f')],_0x47e5d0;if(_0x8fd875>=_0x2f18cc){_0x8fd875=_0x2f18cc;_0x47e5d0=0xc8;}else{_0x47e5d0=0xce;}_0x2d9440[_0xf1a8('0x1b')](_0x47e5d0);return _0x2d9440[_0xf1a8('0x20')](_0xf1a8('0x21'),_0x405c58+'-'+_0x8fd875+'/'+_0x2f18cc)[_0xf1a8('0x22')](_0x35285c);}return null;};}function patchUpdates(_0x392a0d){return function(_0x3fb17d){try{jsonpatch[_0xf1a8('0x23')](_0x3fb17d,_0x392a0d,!![]);}catch(_0x10adb7){return BPromise['reject'](_0x10adb7);}return _0x3fb17d[_0xf1a8('0x24')]();};}function saveUpdates(_0x5ce5c5,_0x562383){return function(_0x102483){if(_0x102483){return _0x102483['update'](_0x5ce5c5)['then'](function(_0x26a707){return _0x26a707;});}return null;};}function removeEntity(_0xae686e,_0x45d6cb){return function(_0x154ac6){if(_0x154ac6){return _0x154ac6[_0xf1a8('0x25')]()['then'](function(){var _0x2feec7=_0x154ac6[_0xf1a8('0x26')]({'plain':!![]});var _0x41a502=_0xf1a8('0x27');return db[_0xf1a8('0x28')]['destroy']({'where':{'type':_0x41a502,'resourceId':_0x2feec7['id']}})['then'](function(){return _0x154ac6;});})[_0xf1a8('0x29')](function(){_0xae686e[_0xf1a8('0x1b')](0xcc)[_0xf1a8('0x1c')]();});}};}function handleEntityNotFound(_0x11b828,_0x2781cd){return function(_0x49fe35){if(!_0x49fe35){_0x11b828['sendStatus'](0x194);}return _0x49fe35;};}function handleError(_0x3ceaba,_0x1d700f){_0x1d700f=_0x1d700f||0x1f4;return function(_0x2e1268){logger[_0xf1a8('0x2a')](_0x2e1268[_0xf1a8('0x2b')]);if(_0x2e1268['name']){delete _0x2e1268[_0xf1a8('0x2c')];}_0x3ceaba[_0xf1a8('0x1b')](_0x1d700f)['send'](_0x2e1268);};}exports['index']=function(_0x5df91a,_0x376d62){var _0x1c0c50={},_0x42d729={},_0x1c711a={'count':0x0,'rows':[]};return db[_0xf1a8('0x2d')][_0xf1a8('0x2e')]()[_0xf1a8('0x29')](function(_0x2c8fa2){_0x42d729[_0xf1a8('0x2f')]=_['keys'](_0x2c8fa2);_0x42d729[_0xf1a8('0x30')]=_[_0xf1a8('0x31')](_0x5df91a[_0xf1a8('0x30')]);_0x42d729[_0xf1a8('0x32')]=_[_0xf1a8('0x33')](_0x42d729[_0xf1a8('0x2f')],_0x42d729[_0xf1a8('0x30')]);_0x1c0c50[_0xf1a8('0x34')]=_[_0xf1a8('0x33')](_0x42d729['model'],qs[_0xf1a8('0x35')](_0x5df91a[_0xf1a8('0x30')][_0xf1a8('0x35')]));_0x1c0c50[_0xf1a8('0x34')]=_0x1c0c50[_0xf1a8('0x34')]['length']?_0x1c0c50[_0xf1a8('0x34')]:_0x42d729[_0xf1a8('0x2f')];if(!_0x5df91a['query']['hasOwnProperty']('nolimit')){_0x1c0c50[_0xf1a8('0x1f')]=qs['limit'](_0x5df91a[_0xf1a8('0x30')][_0xf1a8('0x1f')]);_0x1c0c50['offset']=qs[_0xf1a8('0x1e')](_0x5df91a[_0xf1a8('0x30')][_0xf1a8('0x1e')]);}_0x1c0c50[_0xf1a8('0x36')]=qs[_0xf1a8('0x37')](_0x5df91a[_0xf1a8('0x30')]['sort']);_0x1c0c50['where']=qs[_0xf1a8('0x32')](_['pick'](_0x5df91a[_0xf1a8('0x30')],_0x42d729[_0xf1a8('0x32')]),_0x2c8fa2);if(_0x5df91a[_0xf1a8('0x30')]['filter']){_0x1c0c50['where']=_[_0xf1a8('0x38')](_0x1c0c50['where'],{'$or':_[_0xf1a8('0x39')](_0x1c0c50[_0xf1a8('0x34')],function(_0xa9e11c){var _0x25ba3f={};_0x25ba3f[_0xa9e11c]={'$like':'%'+_0x5df91a['query'][_0xf1a8('0x3a')]+'%'};return _0x25ba3f;})});}_0x1c0c50=_['merge']({},_0x1c0c50,_0x5df91a[_0xf1a8('0x3b')]);var _0x5d56d4={'where':_0x1c0c50[_0xf1a8('0x3c')]};return db['CmCompany']['count'](_0x5d56d4)[_0xf1a8('0x29')](function(_0xb55113){_0x1c711a[_0xf1a8('0x1d')]=_0xb55113;if(_0x5df91a[_0xf1a8('0x30')]['includeAll']){_0x1c0c50[_0xf1a8('0x3d')]=[{'all':!![]}];}return db[_0xf1a8('0x2d')][_0xf1a8('0x3e')](_0x1c0c50);})[_0xf1a8('0x29')](function(_0x2482b0){_0x1c711a[_0xf1a8('0x3f')]=_0x2482b0;return _0x1c711a;})[_0xf1a8('0x29')](respondWithFilteredResult(_0x376d62,_0x1c0c50))[_0xf1a8('0x40')](handleError(_0x376d62,null));})[_0xf1a8('0x40')](handleError(_0x376d62,null));};exports[_0xf1a8('0x41')]=function(_0x5dd4e4,_0x524bb9){var _0x22366f={'raw':![],'where':{'id':_0x5dd4e4[_0xf1a8('0x42')]['id']}},_0x90d98e={};_0x90d98e[_0xf1a8('0x2f')]=_[_0xf1a8('0x31')](db[_0xf1a8('0x2d')]['rawAttributes']);_0x90d98e['query']=_[_0xf1a8('0x31')](_0x5dd4e4['query']);_0x90d98e[_0xf1a8('0x32')]=_[_0xf1a8('0x33')](_0x90d98e[_0xf1a8('0x2f')],_0x90d98e[_0xf1a8('0x30')]);_0x22366f[_0xf1a8('0x34')]=_['intersection'](_0x90d98e['model'],qs['fields'](_0x5dd4e4['query'][_0xf1a8('0x35')]));_0x22366f[_0xf1a8('0x34')]=_0x22366f[_0xf1a8('0x34')][_0xf1a8('0x43')]?_0x22366f[_0xf1a8('0x34')]:_0x90d98e[_0xf1a8('0x2f')];if(_0x5dd4e4[_0xf1a8('0x30')][_0xf1a8('0x44')]){_0x22366f[_0xf1a8('0x3d')]=[{'all':!![]}];}_0x22366f=_[_0xf1a8('0x38')]({},_0x22366f,_0x5dd4e4[_0xf1a8('0x3b')]);return db[_0xf1a8('0x2d')][_0xf1a8('0x45')](_0x22366f)[_0xf1a8('0x29')](handleEntityNotFound(_0x524bb9,null))[_0xf1a8('0x29')](respondWithResult(_0x524bb9,null))[_0xf1a8('0x40')](handleError(_0x524bb9,null));};exports[_0xf1a8('0x46')]=function(_0x4a50a7,_0x5722bc){return db[_0xf1a8('0x2d')][_0xf1a8('0x46')](_0x4a50a7['body'],{})[_0xf1a8('0x29')](function(_0x138185){var _0x2e12aa=_0x4a50a7[_0xf1a8('0x47')][_0xf1a8('0x26')]({'plain':!![]});if(!_0x2e12aa)throw new Error(_0xf1a8('0x48'));if(_0x2e12aa[_0xf1a8('0x49')]===_0xf1a8('0x47')){var _0x1d5757=_0x138185[_0xf1a8('0x26')]({'plain':!![]});var _0x17440c=_0xf1a8('0x27');return db[_0xf1a8('0x4a')][_0xf1a8('0x45')]({'where':{'name':_0x17440c,'userProfileId':_0x2e12aa[_0xf1a8('0x4b')]},'raw':!![]})[_0xf1a8('0x29')](function(_0x7119c){if(_0x7119c&&_0x7119c['autoAssociation']===0x0){return db[_0xf1a8('0x28')][_0xf1a8('0x46')]({'name':_0x1d5757['name'],'resourceId':_0x1d5757['id'],'type':_0x7119c[_0xf1a8('0x2c')],'sectionId':_0x7119c['id']},{})[_0xf1a8('0x29')](function(){return _0x138185;});}else{return _0x138185;}})[_0xf1a8('0x40')](function(_0x16d155){logger[_0xf1a8('0x2a')](_0xf1a8('0x4c'),_0x16d155);throw _0x16d155;});}return _0x138185;})['then'](respondWithResult(_0x5722bc,0xc9))[_0xf1a8('0x40')](handleError(_0x5722bc,null));};exports[_0xf1a8('0x4d')]=function(_0x523a21,_0x3ec70a){if(_0x523a21[_0xf1a8('0x4e')]['id']){delete _0x523a21['body']['id'];}return db[_0xf1a8('0x2d')][_0xf1a8('0x45')]({'where':{'id':_0x523a21[_0xf1a8('0x42')]['id']}})[_0xf1a8('0x29')](handleEntityNotFound(_0x3ec70a,null))[_0xf1a8('0x29')](saveUpdates(_0x523a21[_0xf1a8('0x4e')],null))[_0xf1a8('0x29')](respondWithResult(_0x3ec70a,null))['catch'](handleError(_0x3ec70a,null));};exports[_0xf1a8('0x25')]=function(_0x27b2e6,_0x3cee8e){return db[_0xf1a8('0x2d')][_0xf1a8('0x45')]({'where':{'id':_0x27b2e6[_0xf1a8('0x42')]['id']}})[_0xf1a8('0x29')](handleEntityNotFound(_0x3cee8e,null))[_0xf1a8('0x29')](removeEntity(_0x3cee8e,null))[_0xf1a8('0x40')](handleError(_0x3cee8e,null));};exports[_0xf1a8('0x2e')]=function(_0x2cbe8b,_0x24cb5f){return db[_0xf1a8('0x2d')][_0xf1a8('0x2e')]()[_0xf1a8('0x29')](respondWithResult(_0x24cb5f,null))[_0xf1a8('0x40')](handleError(_0x24cb5f,null));};exports['addContacts']=function(_0x4bfc55,_0x215742,_0x5dafc8){return db[_0xf1a8('0x4f')][_0xf1a8('0x45')]({'where':{'id':_0x4bfc55['params']['id']}})[_0xf1a8('0x29')](handleEntityNotFound(_0x215742,null))[_0xf1a8('0x29')](function(_0x47276e){if(_0x47276e){return _0x47276e[_0xf1a8('0x50')](_0x4bfc55[_0xf1a8('0x4e')]['ids'],_['omit'](_0x4bfc55[_0xf1a8('0x4e')],[_0xf1a8('0x51'),'id'])||{});}})['then'](respondWithResult(_0x215742,null))[_0xf1a8('0x40')](handleError(_0x215742,null));};exports[_0xf1a8('0x52')]=function(_0x20d670,_0x67ce85,_0x3d4ae4){var _0x47c92d={};var _0x5247b2={};var _0x4c68fa;var _0x4c761c;return db[_0xf1a8('0x2d')]['findOne']({'where':{'id':_0x20d670[_0xf1a8('0x42')]['id']}})[_0xf1a8('0x29')](handleEntityNotFound(_0x67ce85,null))[_0xf1a8('0x29')](function(_0x19811d){if(_0x19811d){_0x4c68fa=_0x19811d;_0x5247b2[_0xf1a8('0x2f')]=_[_0xf1a8('0x31')](db[_0xf1a8('0x4f')]['rawAttributes']);_0x5247b2[_0xf1a8('0x30')]=_[_0xf1a8('0x31')](_0x20d670[_0xf1a8('0x30')]);_0x5247b2[_0xf1a8('0x32')]=_['intersection'](_0x5247b2['model'],_0x5247b2['query']);_0x47c92d[_0xf1a8('0x34')]=_[_0xf1a8('0x33')](_0x5247b2[_0xf1a8('0x2f')],qs[_0xf1a8('0x35')](_0x20d670['query'][_0xf1a8('0x35')]));_0x47c92d['attributes']=_0x47c92d[_0xf1a8('0x34')][_0xf1a8('0x43')]?_0x47c92d[_0xf1a8('0x34')]:_0x5247b2[_0xf1a8('0x2f')];_0x47c92d['order']=qs[_0xf1a8('0x37')](_0x20d670['query'][_0xf1a8('0x37')]);_0x47c92d[_0xf1a8('0x3c')]=qs[_0xf1a8('0x32')](_[_0xf1a8('0x53')](_0x20d670[_0xf1a8('0x30')],_0x5247b2[_0xf1a8('0x32')]));if(_0x20d670[_0xf1a8('0x30')][_0xf1a8('0x3a')]){_0x47c92d[_0xf1a8('0x3c')]=_[_0xf1a8('0x38')](_0x47c92d['where'],{'$or':_[_0xf1a8('0x39')](_0x47c92d[_0xf1a8('0x34')],function(_0x4e69a8){var _0x24df03={};_0x24df03[_0x4e69a8]={'$like':'%'+_0x20d670[_0xf1a8('0x30')][_0xf1a8('0x3a')]+'%'};return _0x24df03;})});}_0x47c92d=_[_0xf1a8('0x38')]({},_0x47c92d,_0x20d670[_0xf1a8('0x3b')]);return _0x4c68fa[_0xf1a8('0x52')](_0x47c92d);}})[_0xf1a8('0x29')](function(_0x26fedc){if(_0x26fedc){_0x4c761c=_0x26fedc[_0xf1a8('0x43')];if(!_0x20d670['query'][_0xf1a8('0x54')]('nolimit')){_0x47c92d[_0xf1a8('0x1f')]=qs[_0xf1a8('0x1f')](_0x20d670[_0xf1a8('0x30')]['limit']);_0x47c92d[_0xf1a8('0x1e')]=qs[_0xf1a8('0x1e')](_0x20d670[_0xf1a8('0x30')][_0xf1a8('0x1e')]);}return _0x4c68fa[_0xf1a8('0x52')](_0x47c92d);}})[_0xf1a8('0x29')](function(_0x1cbca8){if(_0x1cbca8){return _0x1cbca8?{'count':_0x4c761c,'rows':_0x1cbca8}:null;}})[_0xf1a8('0x29')](respondWithResult(_0x67ce85,null))[_0xf1a8('0x40')](handleError(_0x67ce85,null));}; \ No newline at end of file +var _0x1317=['attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','merge','options','include','rows','catch','params','rawAttributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContact','addContacts','omit','getContacts','findOne','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters'];(function(_0x21ace8,_0x1e5717){var _0x8ae75b=function(_0x48b54c){while(--_0x48b54c){_0x21ace8['push'](_0x21ace8['shift']());}};_0x8ae75b(++_0x1e5717);}(_0x1317,0x1bb));var _0x7131=function(_0x3bb9a9,_0x204b00){_0x3bb9a9=_0x3bb9a9-0x0;var _0x4ada4b=_0x1317[_0x3bb9a9];return _0x4ada4b;};'use strict';var pdf=require(_0x7131('0x0'));var emlformat=require(_0x7131('0x1'));var rimraf=require(_0x7131('0x2'));var zipdir=require(_0x7131('0x3'));var jsonpatch=require(_0x7131('0x4'));var rp=require(_0x7131('0x5'));var moment=require(_0x7131('0x6'));var BPromise=require(_0x7131('0x7'));var Mustache=require('mustache');var util=require(_0x7131('0x8'));var path=require(_0x7131('0x9'));var sox=require(_0x7131('0xa'));var csv=require('to-csv');var ejs=require(_0x7131('0xb'));var fs=require('fs');var fs_extra=require(_0x7131('0xc'));var _=require(_0x7131('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7131('0xe'));var querystring=require(_0x7131('0xf'));var Papa=require(_0x7131('0x10'));var Redis=require(_0x7131('0x11'));var authService=require(_0x7131('0x12'));var qs=require(_0x7131('0x13'));var as=require(_0x7131('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7131('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x7131('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b20a0,_0x1bb9f7){_0x1bb9f7=_0x1bb9f7||0xcc;return function(_0x1f2f3f){if(_0x1f2f3f){return _0x3b20a0['sendStatus'](_0x1bb9f7);}return _0x3b20a0[_0x7131('0x17')](_0x1bb9f7)[_0x7131('0x18')]();};}function respondWithResult(_0x3dab31,_0x18fec1){_0x18fec1=_0x18fec1||0xc8;return function(_0xfc404d){if(_0xfc404d){return _0x3dab31['status'](_0x18fec1)[_0x7131('0x19')](_0xfc404d);}};}function respondWithFilteredResult(_0x33890d,_0x312252){return function(_0x2c0e4e){if(_0x2c0e4e){var _0x25449e=_0x2c0e4e[_0x7131('0x1a')],_0x423cc8=_0x312252['offset'],_0x3a2b18=_0x312252[_0x7131('0x1b')]+_0x312252['limit'],_0x3cd883;if(_0x3a2b18>=_0x25449e){_0x3a2b18=_0x25449e;_0x3cd883=0xc8;}else{_0x3cd883=0xce;}_0x33890d['status'](_0x3cd883);return _0x33890d[_0x7131('0x1c')](_0x7131('0x1d'),_0x423cc8+'-'+_0x3a2b18+'/'+_0x25449e)[_0x7131('0x19')](_0x2c0e4e);}return null;};}function patchUpdates(_0x3a61a1){return function(_0x11e88a){try{jsonpatch['apply'](_0x11e88a,_0x3a61a1,!![]);}catch(_0x55449a){return BPromise[_0x7131('0x1e')](_0x55449a);}return _0x11e88a[_0x7131('0x1f')]();};}function saveUpdates(_0x44332d,_0x3e879c){return function(_0x3cbe3b){if(_0x3cbe3b){return _0x3cbe3b[_0x7131('0x20')](_0x44332d)[_0x7131('0x21')](function(_0x173a11){return _0x173a11;});}return null;};}function removeEntity(_0x420125,_0x1f03fc){return function(_0x14233f){if(_0x14233f){return _0x14233f[_0x7131('0x22')]()[_0x7131('0x21')](function(){var _0x25d424=_0x14233f[_0x7131('0x23')]({'plain':!![]});var _0x1c1a7f=_0x7131('0x24');return db[_0x7131('0x25')][_0x7131('0x22')]({'where':{'type':_0x1c1a7f,'resourceId':_0x25d424['id']}})[_0x7131('0x21')](function(){return _0x14233f;});})['then'](function(){_0x420125[_0x7131('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd4187b,_0x239917){return function(_0x4a8e0d){if(!_0x4a8e0d){_0xd4187b['sendStatus'](0x194);}return _0x4a8e0d;};}function handleError(_0x55bd8a,_0x516194){_0x516194=_0x516194||0x1f4;return function(_0x2dfa01){logger[_0x7131('0x26')](_0x2dfa01[_0x7131('0x27')]);if(_0x2dfa01[_0x7131('0x28')]){delete _0x2dfa01[_0x7131('0x28')];}_0x55bd8a[_0x7131('0x17')](_0x516194)[_0x7131('0x29')](_0x2dfa01);};}exports[_0x7131('0x2a')]=function(_0x3186a0,_0x3cd53a){var _0x969c6d={},_0x1d4ae9={},_0x53ba96={'count':0x0,'rows':[]};return db[_0x7131('0x2b')][_0x7131('0x2c')]()['then'](function(_0x49ada9){_0x1d4ae9[_0x7131('0x2d')]=_[_0x7131('0x2e')](_0x49ada9);_0x1d4ae9[_0x7131('0x2f')]=_[_0x7131('0x2e')](_0x3186a0[_0x7131('0x2f')]);_0x1d4ae9[_0x7131('0x30')]=_['intersection'](_0x1d4ae9[_0x7131('0x2d')],_0x1d4ae9[_0x7131('0x2f')]);_0x969c6d[_0x7131('0x31')]=_[_0x7131('0x32')](_0x1d4ae9[_0x7131('0x2d')],qs['fields'](_0x3186a0[_0x7131('0x2f')][_0x7131('0x33')]));_0x969c6d['attributes']=_0x969c6d[_0x7131('0x31')]['length']?_0x969c6d[_0x7131('0x31')]:_0x1d4ae9['model'];if(!_0x3186a0[_0x7131('0x2f')]['hasOwnProperty'](_0x7131('0x34'))){_0x969c6d[_0x7131('0x35')]=qs[_0x7131('0x35')](_0x3186a0['query'][_0x7131('0x35')]);_0x969c6d[_0x7131('0x1b')]=qs[_0x7131('0x1b')](_0x3186a0[_0x7131('0x2f')][_0x7131('0x1b')]);}_0x969c6d[_0x7131('0x36')]=qs[_0x7131('0x37')](_0x3186a0['query']['sort']);_0x969c6d[_0x7131('0x38')]=qs[_0x7131('0x30')](_[_0x7131('0x39')](_0x3186a0[_0x7131('0x2f')],_0x1d4ae9['filters']),_0x49ada9);if(_0x3186a0['query'][_0x7131('0x3a')]){_0x969c6d[_0x7131('0x38')]=_[_0x7131('0x3b')](_0x969c6d[_0x7131('0x38')],{'$or':_['map'](_0x969c6d[_0x7131('0x31')],function(_0x10e20d){var _0x2fd7ef={};_0x2fd7ef[_0x10e20d]={'$like':'%'+_0x3186a0['query'][_0x7131('0x3a')]+'%'};return _0x2fd7ef;})});}_0x969c6d=_['merge']({},_0x969c6d,_0x3186a0[_0x7131('0x3c')]);var _0x2614d6={'where':_0x969c6d[_0x7131('0x38')]};return db[_0x7131('0x2b')][_0x7131('0x1a')](_0x2614d6)[_0x7131('0x21')](function(_0x14b65e){_0x53ba96[_0x7131('0x1a')]=_0x14b65e;if(_0x3186a0[_0x7131('0x2f')]['includeAll']){_0x969c6d[_0x7131('0x3d')]=[{'all':!![]}];}return db[_0x7131('0x2b')]['findAll'](_0x969c6d);})[_0x7131('0x21')](function(_0x335091){_0x53ba96[_0x7131('0x3e')]=_0x335091;return _0x53ba96;})[_0x7131('0x21')](respondWithFilteredResult(_0x3cd53a,_0x969c6d))[_0x7131('0x3f')](handleError(_0x3cd53a,null));})[_0x7131('0x3f')](handleError(_0x3cd53a,null));};exports['show']=function(_0x1eadc6,_0x186d7a){var _0x14487a={'raw':![],'where':{'id':_0x1eadc6[_0x7131('0x40')]['id']}},_0x507889={};_0x507889[_0x7131('0x2d')]=_[_0x7131('0x2e')](db[_0x7131('0x2b')][_0x7131('0x41')]);_0x507889[_0x7131('0x2f')]=_[_0x7131('0x2e')](_0x1eadc6['query']);_0x507889[_0x7131('0x30')]=_[_0x7131('0x32')](_0x507889[_0x7131('0x2d')],_0x507889['query']);_0x14487a['attributes']=_[_0x7131('0x32')](_0x507889[_0x7131('0x2d')],qs[_0x7131('0x33')](_0x1eadc6[_0x7131('0x2f')][_0x7131('0x33')]));_0x14487a[_0x7131('0x31')]=_0x14487a['attributes'][_0x7131('0x42')]?_0x14487a[_0x7131('0x31')]:_0x507889[_0x7131('0x2d')];if(_0x1eadc6['query']['includeAll']){_0x14487a['include']=[{'all':!![]}];}_0x14487a=_['merge']({},_0x14487a,_0x1eadc6[_0x7131('0x3c')]);return db['CmCompany'][_0x7131('0x43')](_0x14487a)['then'](handleEntityNotFound(_0x186d7a,null))[_0x7131('0x21')](respondWithResult(_0x186d7a,null))[_0x7131('0x3f')](handleError(_0x186d7a,null));};exports[_0x7131('0x44')]=function(_0x206f0a,_0x5469ad){return db[_0x7131('0x2b')][_0x7131('0x44')](_0x206f0a['body'],{})[_0x7131('0x21')](function(_0x4259c3){var _0x42cdde=_0x206f0a[_0x7131('0x45')][_0x7131('0x23')]({'plain':!![]});if(!_0x42cdde)throw new Error(_0x7131('0x46'));if(_0x42cdde['role']===_0x7131('0x45')){var _0x365fb9=_0x4259c3[_0x7131('0x23')]({'plain':!![]});var _0x5f20c6=_0x7131('0x24');return db[_0x7131('0x47')]['find']({'where':{'name':_0x5f20c6,'userProfileId':_0x42cdde[_0x7131('0x48')]},'raw':!![]})[_0x7131('0x21')](function(_0x56d74c){if(_0x56d74c&&_0x56d74c[_0x7131('0x49')]===0x0){return db['UserProfileResource'][_0x7131('0x44')]({'name':_0x365fb9[_0x7131('0x28')],'resourceId':_0x365fb9['id'],'type':_0x56d74c['name'],'sectionId':_0x56d74c['id']},{})[_0x7131('0x21')](function(){return _0x4259c3;});}else{return _0x4259c3;}})[_0x7131('0x3f')](function(_0x5de654){logger[_0x7131('0x26')](_0x7131('0x4a'),_0x5de654);throw _0x5de654;});}return _0x4259c3;})[_0x7131('0x21')](respondWithResult(_0x5469ad,0xc9))[_0x7131('0x3f')](handleError(_0x5469ad,null));};exports[_0x7131('0x20')]=function(_0x4a7f10,_0x5d2c15){if(_0x4a7f10[_0x7131('0x4b')]['id']){delete _0x4a7f10[_0x7131('0x4b')]['id'];}return db[_0x7131('0x2b')]['find']({'where':{'id':_0x4a7f10['params']['id']}})[_0x7131('0x21')](handleEntityNotFound(_0x5d2c15,null))[_0x7131('0x21')](saveUpdates(_0x4a7f10[_0x7131('0x4b')],null))[_0x7131('0x21')](respondWithResult(_0x5d2c15,null))[_0x7131('0x3f')](handleError(_0x5d2c15,null));};exports[_0x7131('0x22')]=function(_0x40fa44,_0x4d60da){return db[_0x7131('0x2b')][_0x7131('0x43')]({'where':{'id':_0x40fa44[_0x7131('0x40')]['id']}})['then'](handleEntityNotFound(_0x4d60da,null))[_0x7131('0x21')](removeEntity(_0x4d60da,null))[_0x7131('0x3f')](handleError(_0x4d60da,null));};exports['describe']=function(_0x321e81,_0x4fba2b){return db[_0x7131('0x2b')][_0x7131('0x2c')]()[_0x7131('0x21')](respondWithResult(_0x4fba2b,null))['catch'](handleError(_0x4fba2b,null));};exports['addContacts']=function(_0x10258a,_0x161c70,_0x45d2ec){return db[_0x7131('0x4c')]['find']({'where':{'id':_0x10258a[_0x7131('0x40')]['id']}})[_0x7131('0x21')](handleEntityNotFound(_0x161c70,null))[_0x7131('0x21')](function(_0x82007e){if(_0x82007e){return _0x82007e[_0x7131('0x4d')](_0x10258a[_0x7131('0x4b')]['ids'],_[_0x7131('0x4e')](_0x10258a[_0x7131('0x4b')],['ids','id'])||{});}})['then'](respondWithResult(_0x161c70,null))[_0x7131('0x3f')](handleError(_0x161c70,null));};exports[_0x7131('0x4f')]=function(_0x53ccd2,_0x1624f8,_0x1ea0b8){var _0x206628={};var _0x579eb7={};var _0x2ff714;var _0x4002ef;return db[_0x7131('0x2b')][_0x7131('0x50')]({'where':{'id':_0x53ccd2[_0x7131('0x40')]['id']}})[_0x7131('0x21')](handleEntityNotFound(_0x1624f8,null))[_0x7131('0x21')](function(_0x1479f1){if(_0x1479f1){_0x2ff714=_0x1479f1;_0x579eb7[_0x7131('0x2d')]=_['keys'](db['CmContact'][_0x7131('0x41')]);_0x579eb7[_0x7131('0x2f')]=_['keys'](_0x53ccd2[_0x7131('0x2f')]);_0x579eb7['filters']=_['intersection'](_0x579eb7[_0x7131('0x2d')],_0x579eb7[_0x7131('0x2f')]);_0x206628[_0x7131('0x31')]=_[_0x7131('0x32')](_0x579eb7[_0x7131('0x2d')],qs[_0x7131('0x33')](_0x53ccd2[_0x7131('0x2f')][_0x7131('0x33')]));_0x206628[_0x7131('0x31')]=_0x206628[_0x7131('0x31')][_0x7131('0x42')]?_0x206628['attributes']:_0x579eb7[_0x7131('0x2d')];_0x206628[_0x7131('0x36')]=qs['sort'](_0x53ccd2[_0x7131('0x2f')]['sort']);_0x206628[_0x7131('0x38')]=qs[_0x7131('0x30')](_['pick'](_0x53ccd2[_0x7131('0x2f')],_0x579eb7[_0x7131('0x30')]));if(_0x53ccd2[_0x7131('0x2f')][_0x7131('0x3a')]){_0x206628[_0x7131('0x38')]=_[_0x7131('0x3b')](_0x206628['where'],{'$or':_[_0x7131('0x51')](_0x206628['attributes'],function(_0x59489a){var _0x5a1019={};_0x5a1019[_0x59489a]={'$like':'%'+_0x53ccd2[_0x7131('0x2f')][_0x7131('0x3a')]+'%'};return _0x5a1019;})});}_0x206628=_[_0x7131('0x3b')]({},_0x206628,_0x53ccd2['options']);return _0x2ff714[_0x7131('0x4f')](_0x206628);}})[_0x7131('0x21')](function(_0xe46217){if(_0xe46217){_0x4002ef=_0xe46217['length'];if(!_0x53ccd2[_0x7131('0x2f')]['hasOwnProperty'](_0x7131('0x34'))){_0x206628['limit']=qs[_0x7131('0x35')](_0x53ccd2[_0x7131('0x2f')][_0x7131('0x35')]);_0x206628[_0x7131('0x1b')]=qs[_0x7131('0x1b')](_0x53ccd2['query'][_0x7131('0x1b')]);}return _0x2ff714[_0x7131('0x4f')](_0x206628);}})[_0x7131('0x21')](function(_0x9fe007){if(_0x9fe007){return _0x9fe007?{'count':_0x4002ef,'rows':_0x9fe007}:null;}})['then'](respondWithResult(_0x1624f8,null))[_0x7131('0x3f')](handleError(_0x1624f8,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index f62823b..e03e6b1 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 _0x1501=['bluebird','request-promise','path','rimraf','./cmCompany.attributes','define','CmCompany','cm_companies','util','../../config/logger','api'];(function(_0x404c49,_0x17c931){var _0x5969ae=function(_0x2e6f4b){while(--_0x2e6f4b){_0x404c49['push'](_0x404c49['shift']());}};_0x5969ae(++_0x17c931);}(_0x1501,0x126));var _0x1150=function(_0x2b2514,_0x25e672){_0x2b2514=_0x2b2514-0x0;var _0x542e61=_0x1501[_0x2b2514];return _0x542e61;};'use strict';var _=require('lodash');var util=require(_0x1150('0x0'));var logger=require(_0x1150('0x1'))(_0x1150('0x2'));var moment=require('moment');var BPromise=require(_0x1150('0x3'));var rp=require(_0x1150('0x4'));var fs=require('fs');var path=require(_0x1150('0x5'));var rimraf=require(_0x1150('0x6'));var config=require('../../config/environment');var attributes=require(_0x1150('0x7'));module['exports']=function(_0x63c724,_0x316a7d){return _0x63c724[_0x1150('0x8')](_0x1150('0x9'),attributes,{'tableName':_0x1150('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe132=['CmCompany','cm_companies','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x1e67d0,_0x2fcb30){var _0x551f3a=function(_0x2189fb){while(--_0x2189fb){_0x1e67d0['push'](_0x1e67d0['shift']());}};_0x551f3a(++_0x2fcb30);}(_0xe132,0x162));var _0x2e13=function(_0x2ec3df,_0x2b723b){_0x2ec3df=_0x2ec3df-0x0;var _0x5db042=_0xe132[_0x2ec3df];return _0x5db042;};'use strict';var _=require(_0x2e13('0x0'));var util=require('util');var logger=require(_0x2e13('0x1'))(_0x2e13('0x2'));var moment=require(_0x2e13('0x3'));var BPromise=require(_0x2e13('0x4'));var rp=require(_0x2e13('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e13('0x6'));var config=require(_0x2e13('0x7'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x260dc1,_0x2f9d00){return _0x260dc1[_0x2e13('0x8')](_0x2e13('0x9'),attributes,{'tableName':_0x2e13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 80bc6a4..ea87924 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 _0xd7bf=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','catch','util','moment'];(function(_0x1a0303,_0x6508d3){var _0x4f9bee=function(_0x6d0f04){while(--_0x6d0f04){_0x1a0303['push'](_0x1a0303['shift']());}};_0x4f9bee(++_0x6508d3);}(_0xd7bf,0xb2));var _0xfd7b=function(_0x40a38e,_0x56a98e){_0x40a38e=_0x40a38e-0x0;var _0x186105=_0xd7bf[_0x40a38e];return _0x186105;};'use strict';var _=require('lodash');var util=require(_0xfd7b('0x0'));var moment=require(_0xfd7b('0x1'));var BPromise=require(_0xfd7b('0x2'));var rs=require(_0xfd7b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd7b('0x4'))['db'];var utils=require(_0xfd7b('0x5'));var logger=require(_0xfd7b('0x6'))('rpc');var config=require(_0xfd7b('0x7'));var jayson=require(_0xfd7b('0x8'));var client=jayson[_0xfd7b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x364dc7,_0x4d1aad,_0x5bca22){return new BPromise(function(_0x348580,_0x2d9241){return client[_0xfd7b('0xa')](_0x364dc7,_0x5bca22)['then'](function(_0x284e33){logger[_0xfd7b('0xb')]('CmCompany,\x20%s,\x20%s',_0x4d1aad,_0xfd7b('0xc'));logger[_0xfd7b('0xd')](_0xfd7b('0xe'),_0x4d1aad,_0xfd7b('0xc'),JSON[_0xfd7b('0xf')](_0x284e33));if(_0x284e33[_0xfd7b('0x10')]){if(_0x284e33[_0xfd7b('0x10')]['code']===0x1f4){logger[_0xfd7b('0x10')](_0xfd7b('0x11'),_0x4d1aad,_0x284e33[_0xfd7b('0x10')][_0xfd7b('0x12')]);return _0x2d9241(_0x284e33['error']['message']);}logger['error']('CmCompany,\x20%s,\x20%s',_0x4d1aad,_0x284e33['error'][_0xfd7b('0x12')]);return _0x348580(_0x284e33[_0xfd7b('0x10')]['message']);}else{logger[_0xfd7b('0xb')]('CmCompany,\x20%s,\x20%s',_0x4d1aad,_0xfd7b('0xc'));_0x348580(_0x284e33['result'][_0xfd7b('0x12')]);}})[_0xfd7b('0x13')](function(_0x839463){logger[_0xfd7b('0x10')](_0xfd7b('0x11'),_0x4d1aad,_0x839463);_0x2d9241(_0x839463);});});} \ No newline at end of file +var _0x1d78=['../../config/environment','jayson/promise','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x340165,_0x36ff7e){var _0x247006=function(_0x134ae5){while(--_0x134ae5){_0x340165['push'](_0x340165['shift']());}};_0x247006(++_0x36ff7e);}(_0x1d78,0x76));var _0x81d7=function(_0x53bd0f,_0x5ccc0a){_0x53bd0f=_0x53bd0f-0x0;var _0x365774=_0x1d78[_0x53bd0f];return _0x365774;};'use strict';var _=require(_0x81d7('0x0'));var util=require(_0x81d7('0x1'));var moment=require('moment');var BPromise=require(_0x81d7('0x2'));var rs=require(_0x81d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81d7('0x4'))['db'];var utils=require(_0x81d7('0x5'));var logger=require(_0x81d7('0x6'))(_0x81d7('0x7'));var config=require(_0x81d7('0x8'));var jayson=require(_0x81d7('0x9'));var client=jayson['client'][_0x81d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x332625,_0x400b30,_0x27b97c){return new BPromise(function(_0xb4ef71,_0x366dad){return client['request'](_0x332625,_0x27b97c)[_0x81d7('0xb')](function(_0x411752){logger[_0x81d7('0xc')](_0x81d7('0xd'),_0x400b30,_0x81d7('0xe'));logger[_0x81d7('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x400b30,'request\x20sent',JSON[_0x81d7('0x10')](_0x411752));if(_0x411752[_0x81d7('0x11')]){if(_0x411752['error']['code']===0x1f4){logger[_0x81d7('0x11')]('CmCompany,\x20%s,\x20%s',_0x400b30,_0x411752[_0x81d7('0x11')][_0x81d7('0x12')]);return _0x366dad(_0x411752[_0x81d7('0x11')][_0x81d7('0x12')]);}logger[_0x81d7('0x11')](_0x81d7('0xd'),_0x400b30,_0x411752[_0x81d7('0x11')][_0x81d7('0x12')]);return _0xb4ef71(_0x411752[_0x81d7('0x11')][_0x81d7('0x12')]);}else{logger[_0x81d7('0xc')](_0x81d7('0xd'),_0x400b30,_0x81d7('0xe'));_0xb4ef71(_0x411752[_0x81d7('0x13')]['message']);}})[_0x81d7('0x14')](function(_0x349daa){logger['error'](_0x81d7('0xd'),_0x400b30,_0x349daa);_0x366dad(_0x349daa);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 8a46d5c..a5002d9 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 _0xfa6f=['/:id','post','create','addContacts','put','update','exports','util','Router','fs-extra','../../components/interaction/service','./cmCompany.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x38c699,_0x56fea7){var _0x3b1ded=function(_0x100851){while(--_0x100851){_0x38c699['push'](_0x38c699['shift']());}};_0x3b1ded(++_0x56fea7);}(_0xfa6f,0x15b));var _0xffa6=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xfa6f[_0x341e0f];return _0x59555a;};'use strict';var multer=require('multer');var util=require(_0xffa6('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xffa6('0x1')]();var fs_extra=require(_0xffa6('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xffa6('0x3'));var config=require('../../config/environment');var controller=require(_0xffa6('0x4'));router['get']('/',auth[_0xffa6('0x5')](),controller[_0xffa6('0x6')]);router[_0xffa6('0x7')](_0xffa6('0x8'),auth[_0xffa6('0x5')](),controller[_0xffa6('0x9')]);router['get'](_0xffa6('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xffa6('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0xffa6('0xb')]('/',auth['isAuthenticated'](),controller[_0xffa6('0xc')]);router[_0xffa6('0xb')]('/:id/contacts',auth[_0xffa6('0x5')](),controller[_0xffa6('0xd')]);router[_0xffa6('0xe')](_0xffa6('0xa'),auth[_0xffa6('0x5')](),controller[_0xffa6('0xf')]);router['delete'](_0xffa6('0xa'),auth[_0xffa6('0x5')](),controller['destroy']);module[_0xffa6('0x10')]=router; \ No newline at end of file +var _0x1ca6=['show','/:id/contacts','getContacts','create','post','addContacts','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id'];(function(_0x4fa696,_0x34d8ec){var _0x4806d2=function(_0x1753d0){while(--_0x1753d0){_0x4fa696['push'](_0x4fa696['shift']());}};_0x4806d2(++_0x34d8ec);}(_0x1ca6,0x15a));var _0x61ca=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0x1ca6[_0x152121];return _0x592a85;};'use strict';var multer=require(_0x61ca('0x0'));var util=require(_0x61ca('0x1'));var path=require(_0x61ca('0x2'));var timeout=require(_0x61ca('0x3'));var express=require(_0x61ca('0x4'));var router=express[_0x61ca('0x5')]();var fs_extra=require(_0x61ca('0x6'));var auth=require(_0x61ca('0x7'));var interaction=require(_0x61ca('0x8'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x61ca('0x9')]('/',auth[_0x61ca('0xa')](),controller['index']);router['get'](_0x61ca('0xb'),auth[_0x61ca('0xa')](),controller[_0x61ca('0xc')]);router[_0x61ca('0x9')](_0x61ca('0xd'),auth[_0x61ca('0xa')](),controller[_0x61ca('0xe')]);router['get'](_0x61ca('0xf'),auth[_0x61ca('0xa')](),controller[_0x61ca('0x10')]);router['post']('/',auth[_0x61ca('0xa')](),controller[_0x61ca('0x11')]);router[_0x61ca('0x12')](_0x61ca('0xf'),auth[_0x61ca('0xa')](),controller[_0x61ca('0x13')]);router[_0x61ca('0x14')](_0x61ca('0xd'),auth[_0x61ca('0xa')](),controller[_0x61ca('0x15')]);router['delete'](_0x61ca('0xd'),auth[_0x61ca('0xa')](),controller[_0x61ca('0x16')]);module[_0x61ca('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 4067f96..9489f1e 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 _0x121e=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x212a78,_0x5a5afa){var _0x5685cf=function(_0x59c99f){while(--_0x59c99f){_0x212a78['push'](_0x212a78['shift']());}};_0x5685cf(++_0x5a5afa);}(_0x121e,0x198));var _0xe121=function(_0xf93b6d,_0x2cc413){_0xf93b6d=_0xf93b6d-0x0;var _0x2e83db=_0x121e[_0xf93b6d];return _0x2e83db;};'use strict';var _=require('lodash');var Sequelize=require(_0xe121('0x0'));module[_0xe121('0x1')]={'firstName':{'type':Sequelize[_0xe121('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xe121('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xe121('0x2')]},'country':{'type':Sequelize[_0xe121('0x2')]},'dateOfBirth':{'type':Sequelize[_0xe121('0x2')]},'description':{'type':Sequelize[_0xe121('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xe121('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xe121('0x2')]},'facebook':{'type':Sequelize[_0xe121('0x2')]},'fb_data':{'type':Sequelize[_0xe121('0x2')]},'twitter':{'type':Sequelize[_0xe121('0x2')]},'skype':{'type':Sequelize[_0xe121('0x2')]},'teams':{'type':Sequelize[_0xe121('0x2')]},'viber':{'type':Sequelize[_0xe121('0x2')]},'line':{'type':Sequelize[_0xe121('0x2')]},'wechat':{'type':Sequelize[_0xe121('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xe121('0x4')]},'priority':{'type':Sequelize[_0xe121('0x4')](0x2)[_0xe121('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x1ff8=['INTEGER','UNSIGNED','DATE','NOW','lodash','exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1ff8,0x154));var _0x81ff=function(_0x4b90b3,_0x164fb2){_0x4b90b3=_0x4b90b3-0x0;var _0x45472e=_0x1ff8[_0x4b90b3];return _0x45472e;};'use strict';var _=require(_0x81ff('0x0'));var Sequelize=require('sequelize');module[_0x81ff('0x1')]={'firstName':{'type':Sequelize[_0x81ff('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x81ff('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x81ff('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x81ff('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x81ff('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x81ff('0x2')]},'facebook':{'type':Sequelize[_0x81ff('0x2')]},'fb_data':{'type':Sequelize[_0x81ff('0x2')]},'twitter':{'type':Sequelize[_0x81ff('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x81ff('0x2')]},'viber':{'type':Sequelize[_0x81ff('0x2')]},'line':{'type':Sequelize[_0x81ff('0x2')]},'wechat':{'type':Sequelize[_0x81ff('0x2')]},'telegram':{'type':Sequelize[_0x81ff('0x2')]},'UserId':{'type':Sequelize[_0x81ff('0x3')]},'priority':{'type':Sequelize[_0x81ff('0x3')](0x2)[_0x81ff('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x81ff('0x5')],'defaultValue':Sequelize[_0x81ff('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 0201edf..449601c 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 _0x6202=['OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappMessage','WhatsappQueueReport','bulkCreate','each','duplicates','findOrCreate','spread','params','$and','format','cf_%d','pickBy','setFields','toParam','phone','rawAttributes','getTags','nolimit','setTags','ids','getHoppers','options','includeAll','rows','ContactId','include','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','upload','createReadStream','parse','meta','import','binding','No\x20phone\x20column\x20specified','stringify','start\x20child\x20process\x20correctly!','error\x20child\x20process','getJourney','mail','sms','openchannel','fax','whatsapp','voice','-createdAt','includes','toLowerCase','Invalid\x20channel','channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','callerid','starttime','endtime','duration','note','createdAt','userDisposition','fullname','DESC','findAndCountAll','startCase','chat','Website','closed','disposition','Account','key','Owner','customerIp','customerPort','deviceModel','osName','ratingValue','referer','substatus','externalUrl','threadId','flatten','sortBy','slice','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/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','sendStatus','end','status','count','offset','Content-Range','json','apply','save','then','destroy','error','stack','name','index','CmContact','keys','startsWith','cf_','CmCustomField','findOne','trimStart','all','length','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','select','field','color','from','tools_tags','left_join','cm_user_has_contacts','cm_contact_has_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','castTo','buildExpression','text','start','filter','isNil','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','getFullTextValue','c.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','isEmpty','having','t.id\x20IN\x20?','resolve','user','role','agent','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.ListId','TagIds','Tags','push','catch','describe','tags','columnName','displayName','findAll','alias','values','body','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x6202,0x19c));var _0x2620=function(_0x19f9e6,_0x4f59a6){_0x19f9e6=_0x19f9e6-0x0;var _0x45c862=_0x6202[_0x19f9e6];return _0x45c862;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2620('0x0'));var rimraf=require(_0x2620('0x1'));var zipdir=require(_0x2620('0x2'));var jsonpatch=require(_0x2620('0x3'));var rp=require(_0x2620('0x4'));var moment=require(_0x2620('0x5'));var BPromise=require(_0x2620('0x6'));var Mustache=require(_0x2620('0x7'));var util=require(_0x2620('0x8'));var path=require(_0x2620('0x9'));var sox=require('sox');var csv=require(_0x2620('0xa'));var ejs=require(_0x2620('0xb'));var fs=require('fs');var fs_extra=require(_0x2620('0xc'));var _=require(_0x2620('0xd'));var squel=require('squel');var crypto=require(_0x2620('0xe'));var jsforce=require(_0x2620('0xf'));var deskjs=require(_0x2620('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2620('0x11'));var Papa=require(_0x2620('0x12'));var Redis=require(_0x2620('0x13'));var authService=require(_0x2620('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2620('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2620('0x16'))(_0x2620('0x17'));var utils=require(_0x2620('0x18'));var config=require(_0x2620('0x19'));var licenseUtil=require(_0x2620('0x1a'));var db=require(_0x2620('0x1b'))['db'];config[_0x2620('0x1c')]=_[_0x2620('0x1d')](config[_0x2620('0x1c')],{'host':_0x2620('0x1e'),'port':0x18eb});var socket=require(_0x2620('0x1f'))(new Redis(config['redis']));require(_0x2620('0x20'))['register'](socket);function respondWithStatusCode(_0x2c5651,_0x178ff0){_0x178ff0=_0x178ff0||0xcc;return function(_0x58dd38){if(_0x58dd38){return _0x2c5651[_0x2620('0x21')](_0x178ff0);}return _0x2c5651['status'](_0x178ff0)[_0x2620('0x22')]();};}function respondWithResult(_0xc7bc31,_0xfa49ae){_0xfa49ae=_0xfa49ae||0xc8;return function(_0x28059e){if(_0x28059e){return _0xc7bc31[_0x2620('0x23')](_0xfa49ae)['json'](_0x28059e);}};}function respondWithFilteredResult(_0x511b7a,_0x555b81){return function(_0x3edcb9){if(_0x3edcb9){var _0xf0f4ac=_0x3edcb9[_0x2620('0x24')],_0x53b252=_0x555b81[_0x2620('0x25')],_0x53106a=_0x555b81['offset']+_0x555b81['limit'],_0x48f29c;if(_0x53106a>=_0xf0f4ac){_0x53106a=_0xf0f4ac;_0x48f29c=0xc8;}else{_0x48f29c=0xce;}_0x511b7a[_0x2620('0x23')](_0x48f29c);return _0x511b7a['set'](_0x2620('0x26'),_0x53b252+'-'+_0x53106a+'/'+_0xf0f4ac)[_0x2620('0x27')](_0x3edcb9);}return null;};}function patchUpdates(_0x585f1e){return function(_0x308d26){try{jsonpatch[_0x2620('0x28')](_0x308d26,_0x585f1e,!![]);}catch(_0x33a904){return BPromise['reject'](_0x33a904);}return _0x308d26[_0x2620('0x29')]();};}function saveUpdates(_0x5219d8,_0x72fd09){return function(_0x2d6fd1){if(_0x2d6fd1){return _0x2d6fd1['update'](_0x5219d8)[_0x2620('0x2a')](function(_0x444edd){return _0x444edd;});}return null;};}function removeEntity(_0x471206,_0x55f14e){return function(_0x2d4c1a){if(_0x2d4c1a){return _0x2d4c1a[_0x2620('0x2b')]()[_0x2620('0x2a')](function(){_0x471206[_0x2620('0x23')](0xcc)[_0x2620('0x22')]();});}};}function handleEntityNotFound(_0x2d5a1d,_0x5703a3){return function(_0x3436ca){if(!_0x3436ca){_0x2d5a1d[_0x2620('0x21')](0x194);}return _0x3436ca;};}function handleError(_0x3e9828,_0x4060d1){_0x4060d1=_0x4060d1||0x1f4;return function(_0x4e11f5){logger[_0x2620('0x2c')](_0x4e11f5[_0x2620('0x2d')]);if(_0x4e11f5[_0x2620('0x2e')]){delete _0x4e11f5[_0x2620('0x2e')];}_0x3e9828['status'](_0x4060d1)['send'](_0x4e11f5);};}exports[_0x2620('0x2f')]=function(_0x3f66ae,_0x431e89){var _0x13b085={},_0x5d0ec4={},_0x2424b8={'count':0x0,'rows':[]};return db[_0x2620('0x30')]['describe']()[_0x2620('0x2a')](function(_0x28e97a){var _0xe13572=[];for(var _0x105ca0=0x0;_0x105ca00x1){_0x202061['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2620('0x6d')](_0x3139aa),null);}else{if(qs['isNumeric'](_0x3139aa)){_0x202061['or'](_0x2620('0x6e'),_0x3139aa+'%');_0x202061['or']('c.phone\x20LIKE\x20?',_0x3139aa+'%');_0x202061['or']('c.mobile\x20LIKE\x20?',_0x3139aa+'%');_0x202061['or']('c.fax\x20LIKE\x20?',_0x3139aa+'%');}else if(qs[_0x2620('0x6f')](_0x3139aa)){_0x202061['or'](_0x2620('0x70'),_0x3139aa+'%');}else{_0x202061['or'](_0x2620('0x71'),'%'+_0x3139aa+'%');_0x202061['or']('c.lastName\x20LIKE\x20?','%'+_0x3139aa+'%');_0x202061['or']('c.email\x20LIKE\x20?','%'+_0x3139aa+'%');}}}}_0x8b832a[_0x2620('0x45')](_0x202061);_0x8b832a[_0x2620('0x72')](_0x2620('0x73'));var _0x28e214={'type':db[_0x2620('0x74')][_0x2620('0x75')][_0x2620('0x76')],'raw':!![]};var _0x3b8f7e=_0x8b832a[_0x2620('0x77')]()[_0x2620('0x48')]('c.id');if(_0x13b085[_0x2620('0x43')]){_0x13b085[_0x2620('0x43')][_0x2620('0x58')](function(_0xceada8){_0x8b832a[_0x2620('0x43')]('c.'+_0xceada8[0x0],_0xceada8[0x1]==='DESC'?![]:!![]);});}if(!_[_0x2620('0x78')](_0x5d0ca9)){_0x8b832a[_0x2620('0x79')](_0x2fd04a);_0x3b8f7e[_0x2620('0x45')](_0x2620('0x7a'),_0x5d0ca9);}BPromise[_0x2620('0x7b')]()[_0x2620('0x2a')](function(){if(!_0x53afc6)return;if(_0x3f66ae[_0x2620('0x7c')][_0x2620('0x7d')]!==_0x2620('0x7e'))return;if(!_['some'](_0x53afc6[_0x2620('0x52')],[_0x2620('0x48'),_0x2620('0x5b')])){return _0x3f66ae[_0x2620('0x7c')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x56dec9){if(_[_0x2620('0x78')](_0x56dec9)){_0x3b8f7e[_0x2620('0x45')](_0x2620('0x7f'));_0x8b832a[_0x2620('0x45')](_0x2620('0x7f'));}else{_0x3b8f7e['where'](_0x2620('0x67'),_[_0x2620('0x57')](_0x56dec9,'id'));_0x8b832a[_0x2620('0x45')](_0x2620('0x67'),_[_0x2620('0x57')](_0x56dec9,'id'));}});}})[_0x2620('0x2a')](function(){if(_0x3f66ae[_0x2620('0x7c')][_0x2620('0x7d')]==='agent'&&!_0x53afc6&&!_0x3f66ae[_0x2620('0x3c')][_0x2620('0x66')])return[];return db[_0x2620('0x80')][_0x2620('0x3c')](_0x3b8f7e[_0x2620('0x81')](),_0x28e214);})[_0x2620('0x2a')](function(_0x2c4cdc){_0x2424b8['count']=_0x2c4cdc[_0x2620('0x38')];if(_0x2424b8[_0x2620('0x24')]===0x0)return[];return db['sequelize'][_0x2620('0x3c')](_0x299d60[_0x2620('0x81')](),_0x28e214)[_0x2620('0x2a')](function(_0x48131e){_0x148bc5=_[_0x2620('0x82')](_0x48131e,'id');_0x28e214=_[_0x2620('0x83')](_0x28e214,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f66ae[_0x2620('0x3c')][_0x2620('0x40')]){_0x13b085[_0x2620('0x3f')][_0x2620('0x58')](function(_0x467e97){_0x8b832a[_0x2620('0x48')]('c.'+_0x467e97);});}else{_0x8b832a[_0x2620('0x48')](_0x2620('0x73'));_0x8b832a[_0x2620('0x48')](_0x2620('0x84'));_0x8b832a[_0x2620('0x48')](_0x2620('0x85'));_0x8b832a[_0x2620('0x48')](_0x2620('0x86'));_0x8b832a[_0x2620('0x48')](_0x2620('0x87'));_0x8b832a['field']('c.fax');_0x8b832a[_0x2620('0x48')]('c.email');_0x8b832a['field'](_0x2620('0x88'));_0x8b832a[_0x2620('0x48')]('c.createdAt');_0x8b832a[_0x2620('0x48')]('c.deletedAt');_0x8b832a[_0x2620('0x48')]('c.CompanyId');_0x8b832a[_0x2620('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2620('0x89'));}if(_0x13b085[_0x2620('0x42')])_0x8b832a[_0x2620('0x42')](_0x13b085[_0x2620('0x42')]);if(_0x13b085['offset'])_0x8b832a[_0x2620('0x25')](_0x13b085[_0x2620('0x25')]);return db[_0x2620('0x80')]['query'](_0x8b832a[_0x2620('0x81')](),_0x28e214);});})['then'](function(_0x3b156f){_0x3b156f['forEach'](function(_0xd02512){if(_0xd02512['TagIds']){_0xd02512[_0x2620('0x8a')]=[];_0xd02512[_0x2620('0x89')][_0x2620('0x56')](',')[_0x2620('0x58')](function(_0x4ae486){_0xd02512['Tags'][_0x2620('0x8b')](_0x148bc5[_0x4ae486]);});}delete _0xd02512['TagIds'];});_0x2424b8['rows']=_0x3b156f;return _0x2424b8;})[_0x2620('0x2a')](respondWithFilteredResult(_0x431e89,_0x13b085));})[_0x2620('0x8c')](handleError(_0x431e89,null));};exports[_0x2620('0x2b')]=function(_0x3a980d,_0x4c9935){return db['CmContact']['find']({'where':{'id':_0x3a980d['params']['id']}})['then'](handleEntityNotFound(_0x4c9935,null))[_0x2620('0x2a')](removeEntity(_0x4c9935,null))[_0x2620('0x8c')](handleError(_0x4c9935,null));};exports[_0x2620('0x8d')]=function(_0x360002,_0xc9c87a){return db['CmContact'][_0x2620('0x8d')]()[_0x2620('0x2a')](function(_0xb21069){delete _0xb21069[_0x2620('0x8e')];for(var _0x439efc=0x0;_0x439efc=_0x3ecd4e){_0x62238=_0x3ecd4e;_0x599592=0xc8;}else{_0x599592=0xce;}_0x12bdb8['status'](_0x599592);return _0x12bdb8[_0xd590('0x23')](_0xd590('0x24'),_0x3a7231+'-'+_0x62238+'/'+_0x3ecd4e)[_0xd590('0x1f')](_0x18c3b3);}return null;};}function patchUpdates(_0x5acc32){return function(_0x2ad46a){try{jsonpatch['apply'](_0x2ad46a,_0x5acc32,!![]);}catch(_0x1f577a){return BPromise['reject'](_0x1f577a);}return _0x2ad46a[_0xd590('0x25')]();};}function saveUpdates(_0x26d068,_0x3c63ad){return function(_0x1a3546){if(_0x1a3546){return _0x1a3546['update'](_0x26d068)[_0xd590('0x26')](function(_0x3c47a4){return _0x3c47a4;});}return null;};}function removeEntity(_0x310e0a,_0x49ef9c){return function(_0x280160){if(_0x280160){return _0x280160[_0xd590('0x27')]()[_0xd590('0x26')](function(){_0x310e0a[_0xd590('0x1d')](0xcc)[_0xd590('0x1e')]();});}};}function handleEntityNotFound(_0x1c3cda,_0x30d593){return function(_0xe6018d){if(!_0xe6018d){_0x1c3cda[_0xd590('0x1c')](0x194);}return _0xe6018d;};}function handleError(_0x2ff0fd,_0x31461e){_0x31461e=_0x31461e||0x1f4;return function(_0x2b4f98){logger[_0xd590('0x28')](_0x2b4f98[_0xd590('0x29')]);if(_0x2b4f98[_0xd590('0x2a')]){delete _0x2b4f98[_0xd590('0x2a')];}_0x2ff0fd[_0xd590('0x1d')](_0x31461e)[_0xd590('0x2b')](_0x2b4f98);};}exports[_0xd590('0x2c')]=function(_0x5267d5,_0x5da9ef){var _0x468336={},_0x2b9a59={},_0x5904c3={'count':0x0,'rows':[]};return db[_0xd590('0x2d')][_0xd590('0x2e')]()[_0xd590('0x26')](function(_0xa0e005){var _0x3d0f24=[];for(var _0x172801=0x0;_0x1728010x1){_0x1cc6f6['or'](_0xd590('0x6e'),qs[_0xd590('0x6f')](_0x181bdc),null);}else{if(qs[_0xd590('0x70')](_0x181bdc)){_0x1cc6f6['or'](_0xd590('0x71'),_0x181bdc+'%');_0x1cc6f6['or']('c.phone\x20LIKE\x20?',_0x181bdc+'%');_0x1cc6f6['or'](_0xd590('0x72'),_0x181bdc+'%');_0x1cc6f6['or']('c.fax\x20LIKE\x20?',_0x181bdc+'%');}else if(qs[_0xd590('0x73')](_0x181bdc)){_0x1cc6f6['or'](_0xd590('0x74'),_0x181bdc+'%');}else{_0x1cc6f6['or'](_0xd590('0x75'),'%'+_0x181bdc+'%');_0x1cc6f6['or'](_0xd590('0x76'),'%'+_0x181bdc+'%');_0x1cc6f6['or']('c.email\x20LIKE\x20?','%'+_0x181bdc+'%');}}}}_0x443f05['where'](_0x1cc6f6);_0x443f05[_0xd590('0x77')](_0xd590('0x78'));var _0x5c8c42={'type':db[_0xd590('0x79')][_0xd590('0x7a')]['SELECT'],'raw':!![]};var _0x19b7b0=_0x443f05[_0xd590('0x7b')]()[_0xd590('0x43')]('c.id');if(_0x468336['order']){_0x468336[_0xd590('0x7c')][_0xd590('0x58')](function(_0x4f1db0){_0x443f05[_0xd590('0x7c')]('c.'+_0x4f1db0[0x0],_0x4f1db0[0x1]===_0xd590('0x7d')?![]:!![]);});}if(!_[_0xd590('0x65')](_0x4396fc)){_0x443f05[_0xd590('0x7e')](_0x348e9e);_0x19b7b0[_0xd590('0x4d')](_0xd590('0x7f'),_0x4396fc);}BPromise[_0xd590('0x80')]()[_0xd590('0x26')](function(){if(!_0x11d6d0)return;if(_0x5267d5['user'][_0xd590('0x81')]!==_0xd590('0x82'))return;if(!_[_0xd590('0x83')](_0x11d6d0[_0xd590('0x53')],['field',_0xd590('0x84')])){return _0x5267d5[_0xd590('0x85')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x4800ec){if(_[_0xd590('0x65')](_0x4800ec)){_0x19b7b0['where'](_0xd590('0x86'));_0x443f05[_0xd590('0x4d')](_0xd590('0x86'));}else{_0x19b7b0['where'](_0xd590('0x66'),_['map'](_0x4800ec,'id'));_0x443f05['where']('c.ListId\x20IN\x20?',_[_0xd590('0x57')](_0x4800ec,'id'));}});}})['then'](function(){if(_0x5267d5[_0xd590('0x85')][_0xd590('0x81')]===_0xd590('0x82')&&!_0x11d6d0&&!_0x5267d5[_0xd590('0x3c')][_0xd590('0x87')])return[];return db[_0xd590('0x88')][_0xd590('0x3c')](_0x19b7b0[_0xd590('0x89')](),_0x5c8c42);})[_0xd590('0x26')](function(_0x26b41b){_0x5904c3[_0xd590('0x20')]=_0x26b41b[_0xd590('0x36')];if(_0x5904c3[_0xd590('0x20')]===0x0)return[];return db[_0xd590('0x88')]['query'](_0x356c50[_0xd590('0x89')](),_0x5c8c42)[_0xd590('0x26')](function(_0x2c00b7){_0x5d6556=_[_0xd590('0x8a')](_0x2c00b7,'id');_0x5c8c42=_[_0xd590('0x8b')](_0x5c8c42,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5267d5[_0xd590('0x3c')][_0xd590('0x3b')]){_0x468336['attributes'][_0xd590('0x58')](function(_0x256008){_0x443f05[_0xd590('0x43')]('c.'+_0x256008);});}else{_0x443f05[_0xd590('0x43')](_0xd590('0x78'));_0x443f05[_0xd590('0x43')](_0xd590('0x8c'));_0x443f05[_0xd590('0x43')](_0xd590('0x8d'));_0x443f05[_0xd590('0x43')](_0xd590('0x8e'));_0x443f05[_0xd590('0x43')](_0xd590('0x8f'));_0x443f05['field']('c.fax');_0x443f05[_0xd590('0x43')](_0xd590('0x90'));_0x443f05['field']('c.ListId');_0x443f05[_0xd590('0x43')](_0xd590('0x91'));_0x443f05[_0xd590('0x43')](_0xd590('0x92'));_0x443f05[_0xd590('0x43')](_0xd590('0x93'));_0x443f05[_0xd590('0x43')](_0xd590('0x94'),'TagIds');}if(_0x468336[_0xd590('0x22')])_0x443f05['limit'](_0x468336[_0xd590('0x22')]);if(_0x468336[_0xd590('0x21')])_0x443f05[_0xd590('0x21')](_0x468336['offset']);return db[_0xd590('0x88')][_0xd590('0x3c')](_0x443f05[_0xd590('0x89')](),_0x5c8c42);});})[_0xd590('0x26')](function(_0x41991e){_0x41991e[_0xd590('0x58')](function(_0x400b95){if(_0x400b95[_0xd590('0x95')]){_0x400b95[_0xd590('0x96')]=[];_0x400b95[_0xd590('0x95')]['split'](',')['forEach'](function(_0x10a876){_0x400b95[_0xd590('0x96')][_0xd590('0x32')](_0x5d6556[_0x10a876]);});}delete _0x400b95[_0xd590('0x95')];});_0x5904c3[_0xd590('0x97')]=_0x41991e;return _0x5904c3;})['then'](respondWithFilteredResult(_0x5da9ef,_0x468336));})[_0xd590('0x98')](handleError(_0x5da9ef,null));};exports[_0xd590('0x27')]=function(_0x48c714,_0x3679e3){return db['CmContact'][_0xd590('0x54')]({'where':{'id':_0x48c714[_0xd590('0x99')]['id']}})[_0xd590('0x26')](handleEntityNotFound(_0x3679e3,null))['then'](removeEntity(_0x3679e3,null))[_0xd590('0x98')](handleError(_0x3679e3,null));};exports[_0xd590('0x2e')]=function(_0x8f15b3,_0x551fb8){return db[_0xd590('0x2d')][_0xd590('0x2e')]()[_0xd590('0x26')](function(_0x430d82){delete _0x430d82['tags'];for(var _0x2d5723=0x0;_0x2d5723{}\s\\|]/g,'-');_0x33883c(null,util['format'](_0x9cc2('0x24'),path[_0x9cc2('0x25')](_0x5d882f[_0x9cc2('0x22')],path[_0x9cc2('0x26')](_0x5d882f[_0x9cc2('0x22')])),Date[_0x9cc2('0x27')](),path['extname'](_0x5d882f[_0x9cc2('0x22')])));}})});router[_0x9cc2('0x1b')](_0x9cc2('0x28'),upload[_0x9cc2('0x29')](_0x9cc2('0x2a')),controller[_0x9cc2('0x2b')]);var upload=multer({'storage':multer[_0x9cc2('0x20')]({'destination':function(_0x24b5e6,_0x2a0070,_0x4de8d5){_0x4de8d5(null,path[_0x9cc2('0x2c')](config[_0x9cc2('0x21')],_0x9cc2('0x2d')));},'filename':function(_0x48d0ac,_0x579a44,_0x5268ae){_0x579a44[_0x9cc2('0x22')]=_0x579a44['originalname'][_0x9cc2('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5268ae(null,util['format'](_0x9cc2('0x24'),path[_0x9cc2('0x25')](_0x579a44[_0x9cc2('0x22')],path['extname'](_0x579a44['originalname'])),Date['now'](),path[_0x9cc2('0x26')](_0x579a44[_0x9cc2('0x22')])));}})});router[_0x9cc2('0x1b')](_0x9cc2('0x2e'),upload[_0x9cc2('0x29')](_0x9cc2('0x2a')),controller['upload']);router[_0x9cc2('0x1b')]('/upload/:id',auth[_0x9cc2('0xb')](),controller[_0x9cc2('0x2f')]);router[_0x9cc2('0x30')](_0x9cc2('0xf'),auth[_0x9cc2('0xb')](),controller[_0x9cc2('0x31')]);router[_0x9cc2('0x32')](_0x9cc2('0xf'),auth[_0x9cc2('0xb')](),controller[_0x9cc2('0x33')]);module[_0x9cc2('0x34')]=router; \ No newline at end of file +var _0x330f=['/:id/tags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','/merge','merge','post','create','/create_many','bulkCreate','diskStorage','root','server/files/tmp','originalname','replace','format','%s-%s%s','extname','now','file','join','basename','/upload','upload','/upload/:id','import','put','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x112a2f,_0x3f8290){var _0x45456a=function(_0x4b625a){while(--_0x4b625a){_0x112a2f['push'](_0x112a2f['shift']());}};_0x45456a(++_0x3f8290);}(_0x330f,0xe3));var _0xf330=function(_0xd1f854,_0x532346){_0xd1f854=_0xd1f854-0x0;var _0x548294=_0x330f[_0xd1f854];return _0x548294;};'use strict';var multer=require(_0xf330('0x0'));var util=require(_0xf330('0x1'));var path=require('path');var timeout=require(_0xf330('0x2'));var express=require(_0xf330('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf330('0x4'));var config=require('../../config/environment');var controller=require(_0xf330('0x5'));router[_0xf330('0x6')]('/',auth[_0xf330('0x7')](),controller[_0xf330('0x8')]);router[_0xf330('0x6')](_0xf330('0x9'),auth['isAuthenticated'](),controller[_0xf330('0xa')]);router[_0xf330('0x6')](_0xf330('0xb'),auth['isAuthenticated'](),controller[_0xf330('0xc')]);router[_0xf330('0x6')](_0xf330('0xd'),auth['isAuthenticated'](),controller['getTags']);router[_0xf330('0x6')](_0xf330('0xe'),auth[_0xf330('0x7')](),controller[_0xf330('0xf')]);router['get'](_0xf330('0x10'),auth[_0xf330('0x7')](),controller[_0xf330('0x11')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0xf330('0x12')]);router[_0xf330('0x6')](_0xf330('0x13'),auth[_0xf330('0x7')](),controller[_0xf330('0x14')]);router[_0xf330('0x6')](_0xf330('0x15'),auth[_0xf330('0x7')](),controller[_0xf330('0x16')]);router['post'](_0xf330('0x17'),auth[_0xf330('0x7')](),controller[_0xf330('0x18')]);router[_0xf330('0x19')]('/',auth[_0xf330('0x7')](),controller[_0xf330('0x1a')]);router['post'](_0xf330('0x1b'),auth[_0xf330('0x7')](),controller[_0xf330('0x1c')]);router[_0xf330('0x19')](_0xf330('0xd'),auth[_0xf330('0x7')](),controller['setTags']);var upload=multer({'storage':multer[_0xf330('0x1d')]({'destination':function(_0x3ff682,_0x4e051b,_0x1ed9d8){_0x1ed9d8(null,path['join'](config[_0xf330('0x1e')],_0xf330('0x1f')));},'filename':function(_0x425da2,_0x566cbe,_0x39810c){_0x566cbe[_0xf330('0x20')]=_0x566cbe['originalname'][_0xf330('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x39810c(null,util[_0xf330('0x22')](_0xf330('0x23'),path['basename'](_0x566cbe['originalname'],path[_0xf330('0x24')](_0x566cbe[_0xf330('0x20')])),Date[_0xf330('0x25')](),path[_0xf330('0x24')](_0x566cbe[_0xf330('0x20')])));}})});router['post']('/csv',upload['single'](_0xf330('0x26')),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3d663f,_0x10a361,_0x44d7a6){_0x44d7a6(null,path[_0xf330('0x27')](config[_0xf330('0x1e')],_0xf330('0x1f')));},'filename':function(_0x16a510,_0x4451ce,_0x2f70fa){_0x4451ce[_0xf330('0x20')]=_0x4451ce['originalname'][_0xf330('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2f70fa(null,util[_0xf330('0x22')](_0xf330('0x23'),path[_0xf330('0x28')](_0x4451ce['originalname'],path[_0xf330('0x24')](_0x4451ce[_0xf330('0x20')])),Date['now'](),path[_0xf330('0x24')](_0x4451ce['originalname'])));}})});router[_0xf330('0x19')](_0xf330('0x29'),upload['single'](_0xf330('0x26')),controller[_0xf330('0x2a')]);router[_0xf330('0x19')](_0xf330('0x2b'),auth['isAuthenticated'](),controller[_0xf330('0x2c')]);router[_0xf330('0x2d')]('/:id',auth[_0xf330('0x7')](),controller['update']);router['delete'](_0xf330('0xb'),auth[_0xf330('0x7')](),controller[_0xf330('0x2e')]);module[_0xf330('0x2f')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index fb2d3c3..7f12502 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 _0x5301=['stringify','BOOLEAN','voice','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','TEXT','type','select','parse','values','isArray'];(function(_0x5671b7,_0x144a67){var _0x49e7b0=function(_0x3f87e8){while(--_0x3f87e8){_0x5671b7['push'](_0x5671b7['shift']());}};_0x49e7b0(++_0x144a67);}(_0x5301,0x157));var _0x1530=function(_0x1b038a,_0x3ab0d4){_0x1b038a=_0x1b038a-0x0;var _0x367904=_0x5301[_0x1b038a];return _0x367904;};'use strict';var Sequelize=require('sequelize');var _=require(_0x1530('0x0'));module[_0x1530('0x1')]={'name':{'type':Sequelize[_0x1530('0x2')],'get':function(_0x126400){return this[_0x1530('0x3')]('alias');}},'alias':{'type':Sequelize[_0x1530('0x4')],'allowNull':![],'set':function(_0x639c58){this[_0x1530('0x5')](_0x1530('0x6'),_0x639c58?_0x639c58:this['getDataValue'](_0x1530('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x1530('0x8')]('long'),'get':function(){if(this[_0x1530('0x3')](_0x1530('0x9'))===_0x1530('0xa')){return JSON[_0x1530('0xb')](this[_0x1530('0x3')]('values'));}else{return this['getDataValue'](_0x1530('0xc'));}},'set':function(_0x46fc58){if(Array[_0x1530('0xd')](_0x46fc58)){this[_0x1530('0x5')]('values',JSON[_0x1530('0xe')](_0x46fc58));}else{this[_0x1530('0x5')](_0x1530('0xc'),_0x46fc58);}}},'required':{'type':Sequelize[_0x1530('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x1530('0x10'))}}; \ No newline at end of file +var _0x35aa=['BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','alias','STRING','setDataValue','getDataValue','name','long','type','select','parse','values','isArray'];(function(_0x41b563,_0xf0e551){var _0x272c49=function(_0x242c62){while(--_0x242c62){_0x41b563['push'](_0x41b563['shift']());}};_0x272c49(++_0xf0e551);}(_0x35aa,0xbe));var _0xa35a=function(_0x261c53,_0x497f83){_0x261c53=_0x261c53-0x0;var _0xa39042=_0x35aa[_0x261c53];return _0xa39042;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa35a('0x0'));module[_0xa35a('0x1')]={'name':{'type':Sequelize[_0xa35a('0x2')],'get':function(_0x3518ac){return this['getDataValue'](_0xa35a('0x3'));}},'alias':{'type':Sequelize[_0xa35a('0x4')],'allowNull':![],'set':function(_0x24cc2){this[_0xa35a('0x5')](_0xa35a('0x3'),_0x24cc2?_0x24cc2:this[_0xa35a('0x6')](_0xa35a('0x7')));}},'type':{'type':Sequelize[_0xa35a('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xa35a('0x8')),'get':function(){if(this['getDataValue'](_0xa35a('0x9'))===_0xa35a('0xa')){return JSON[_0xa35a('0xb')](this[_0xa35a('0x6')](_0xa35a('0xc')));}else{return this[_0xa35a('0x6')]('values');}},'set':function(_0x1eb174){if(Array[_0xa35a('0xd')](_0x1eb174)){this[_0xa35a('0x5')](_0xa35a('0xc'),JSON['stringify'](_0x1eb174));}else{this[_0xa35a('0x5')](_0xa35a('0xc'),_0x1eb174);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa35a('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa35a('0xf')](_0xa35a('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index bfdc033..24d20fb 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 _0x27e8=['status','end','json','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','catch','params','keys','find','body','create','transaction','Sequelize','TEXT','switch','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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','../../mysqldb','sendStatus'];(function(_0x5bce6d,_0x3d3b72){var _0x4ee73c=function(_0x23dc99){while(--_0x23dc99){_0x5bce6d['push'](_0x5bce6d['shift']());}};_0x4ee73c(++_0x3d3b72);}(_0x27e8,0x8d));var _0x827e=function(_0x387c30,_0x4c2cea){_0x387c30=_0x387c30-0x0;var _0x48754e=_0x27e8[_0x387c30];return _0x48754e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x827e('0x0'));var zipdir=require(_0x827e('0x1'));var jsonpatch=require(_0x827e('0x2'));var rp=require(_0x827e('0x3'));var moment=require(_0x827e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x827e('0x5'));var util=require(_0x827e('0x6'));var path=require('path');var sox=require(_0x827e('0x7'));var csv=require('to-csv');var ejs=require(_0x827e('0x8'));var fs=require('fs');var fs_extra=require(_0x827e('0x9'));var _=require(_0x827e('0xa'));var squel=require(_0x827e('0xb'));var crypto=require(_0x827e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x827e('0xd'));var toCsv=require(_0x827e('0xe'));var querystring=require(_0x827e('0xf'));var Papa=require(_0x827e('0x10'));var Redis=require(_0x827e('0x11'));var authService=require(_0x827e('0x12'));var qs=require(_0x827e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x827e('0x14'));var logger=require('../../config/logger')(_0x827e('0x15'));var utils=require(_0x827e('0x16'));var config=require(_0x827e('0x17'));var licenseUtil=require(_0x827e('0x18'));var db=require(_0x827e('0x19'))['db'];function respondWithStatusCode(_0x392fbe,_0x28e398){_0x28e398=_0x28e398||0xcc;return function(_0x4a5c66){if(_0x4a5c66){return _0x392fbe[_0x827e('0x1a')](_0x28e398);}return _0x392fbe[_0x827e('0x1b')](_0x28e398)[_0x827e('0x1c')]();};}function respondWithResult(_0x3b2bf1,_0x25622b){_0x25622b=_0x25622b||0xc8;return function(_0x40982d){if(_0x40982d){return _0x3b2bf1['status'](_0x25622b)[_0x827e('0x1d')](_0x40982d);}};}function respondWithFilteredResult(_0x199f3c,_0x3eaa8c){return function(_0x2612c6){if(_0x2612c6){var _0x18957c=_0x2612c6['count'],_0x344c51=_0x3eaa8c['offset'],_0x18ad00=_0x3eaa8c['offset']+_0x3eaa8c[_0x827e('0x1e')],_0x1dc947;if(_0x18ad00>=_0x18957c){_0x18ad00=_0x18957c;_0x1dc947=0xc8;}else{_0x1dc947=0xce;}_0x199f3c[_0x827e('0x1b')](_0x1dc947);return _0x199f3c['set']('Content-Range',_0x344c51+'-'+_0x18ad00+'/'+_0x18957c)[_0x827e('0x1d')](_0x2612c6);}return null;};}function patchUpdates(_0x1ee87e){return function(_0x4163e7){try{jsonpatch[_0x827e('0x1f')](_0x4163e7,_0x1ee87e,!![]);}catch(_0x553335){return BPromise[_0x827e('0x20')](_0x553335);}return _0x4163e7[_0x827e('0x21')]();};}function saveUpdates(_0x1efe5b,_0x5df986){return function(_0x266418){if(_0x266418){return _0x266418[_0x827e('0x22')](_0x1efe5b)[_0x827e('0x23')](function(_0x668c){return _0x668c;});}return null;};}function removeEntity(_0xd1220a,_0x5e7442){return function(_0x16ddbd){if(_0x16ddbd){return _0x16ddbd[_0x827e('0x24')]()[_0x827e('0x23')](function(){_0xd1220a[_0x827e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28ca2c,_0x29889e){return function(_0x5d07c8){if(!_0x5d07c8){_0x28ca2c[_0x827e('0x1a')](0x194);}return _0x5d07c8;};}function handleError(_0x208547,_0x294c05){_0x294c05=_0x294c05||0x1f4;return function(_0x30bd30){logger[_0x827e('0x25')](_0x30bd30[_0x827e('0x26')]);if(_0x30bd30[_0x827e('0x27')]){delete _0x30bd30[_0x827e('0x27')];}_0x208547[_0x827e('0x1b')](_0x294c05)[_0x827e('0x28')](_0x30bd30);};}exports[_0x827e('0x29')]=function(_0x435685,_0x193783){var _0x346a41={},_0x12dd9b={},_0x36fca4={'count':0x0,'rows':[]};var _0x5ebf8b=_[_0x827e('0x2a')](db[_0x827e('0x2b')][_0x827e('0x2c')],function(_0x34669c){return{'name':_0x34669c[_0x827e('0x2d')],'type':_0x34669c[_0x827e('0x2e')][_0x827e('0x2f')]};});_0x12dd9b[_0x827e('0x30')]=_['differenceBy'](_['map'](_0x5ebf8b,_0x827e('0x27')),[_0x827e('0x27')]);_0x12dd9b[_0x827e('0x31')]=_['keys'](_0x435685['query']);_0x12dd9b[_0x827e('0x32')]=_[_0x827e('0x33')](_0x12dd9b[_0x827e('0x30')],_0x12dd9b[_0x827e('0x31')]);_0x346a41[_0x827e('0x34')]=_[_0x827e('0x33')](_0x12dd9b[_0x827e('0x30')],qs[_0x827e('0x35')](_0x435685[_0x827e('0x31')][_0x827e('0x35')]));_0x346a41[_0x827e('0x34')]=_0x346a41['attributes'][_0x827e('0x36')]?_0x346a41[_0x827e('0x34')]:_0x12dd9b[_0x827e('0x30')];if(!_0x435685[_0x827e('0x31')][_0x827e('0x37')]('nolimit')){_0x346a41['limit']=qs['limit'](_0x435685[_0x827e('0x31')][_0x827e('0x1e')]);_0x346a41[_0x827e('0x38')]=qs[_0x827e('0x38')](_0x435685[_0x827e('0x31')][_0x827e('0x38')]);}_0x346a41[_0x827e('0x39')]=qs[_0x827e('0x3a')](_0x435685[_0x827e('0x31')][_0x827e('0x3a')]);_0x346a41[_0x827e('0x3b')]=qs['filters'](_[_0x827e('0x3c')](_0x435685[_0x827e('0x31')],_0x12dd9b[_0x827e('0x32')]),_0x5ebf8b);if(_0x435685[_0x827e('0x31')]['filter']){_0x346a41[_0x827e('0x3b')]=_[_0x827e('0x3d')](_0x346a41['where'],{'$or':_[_0x827e('0x2a')](_0x5ebf8b,function(_0x4548e5){if(_0x4548e5[_0x827e('0x2e')]!==_0x827e('0x3e')){var _0x359d58={};_0x359d58[_0x4548e5[_0x827e('0x27')]]={'$like':'%'+_0x435685[_0x827e('0x31')][_0x827e('0x3f')]+'%'};return _0x359d58;}})});}_0x346a41=_['merge']({},_0x346a41,_0x435685['options']);var _0x3ada0b={'where':_0x346a41[_0x827e('0x3b')]};return db[_0x827e('0x2b')]['count'](_0x3ada0b)[_0x827e('0x23')](function(_0x1b77b7){_0x36fca4[_0x827e('0x40')]=_0x1b77b7;if(_0x435685['query'][_0x827e('0x41')]){_0x346a41[_0x827e('0x42')]=[{'all':!![]}];}return db[_0x827e('0x2b')][_0x827e('0x43')](_0x346a41);})['then'](function(_0x3b34b6){_0x36fca4['rows']=_0x3b34b6;return _0x36fca4;})[_0x827e('0x23')](respondWithFilteredResult(_0x193783,_0x346a41))[_0x827e('0x44')](handleError(_0x193783,null));};exports['show']=function(_0x16606d,_0x4d9f9a){var _0xe40fcd={'raw':!![],'where':{'id':_0x16606d[_0x827e('0x45')]['id']}},_0x7b4eac={};_0x7b4eac[_0x827e('0x30')]=_[_0x827e('0x46')](db[_0x827e('0x2b')]['rawAttributes']);_0x7b4eac[_0x827e('0x31')]=_['keys'](_0x16606d[_0x827e('0x31')]);_0x7b4eac[_0x827e('0x32')]=_[_0x827e('0x33')](_0x7b4eac[_0x827e('0x30')],_0x7b4eac[_0x827e('0x31')]);_0xe40fcd[_0x827e('0x34')]=_[_0x827e('0x33')](_0x7b4eac['model'],qs[_0x827e('0x35')](_0x16606d[_0x827e('0x31')][_0x827e('0x35')]));_0xe40fcd[_0x827e('0x34')]=_0xe40fcd['attributes'][_0x827e('0x36')]?_0xe40fcd[_0x827e('0x34')]:_0x7b4eac[_0x827e('0x30')];if(_0x16606d[_0x827e('0x31')][_0x827e('0x41')]){_0xe40fcd[_0x827e('0x42')]=[{'all':!![]}];}_0xe40fcd=_[_0x827e('0x3d')]({},_0xe40fcd,_0x16606d['options']);return db[_0x827e('0x2b')][_0x827e('0x47')](_0xe40fcd)['then'](handleEntityNotFound(_0x4d9f9a,null))[_0x827e('0x23')](respondWithResult(_0x4d9f9a,null))[_0x827e('0x44')](handleError(_0x4d9f9a,null));};exports[_0x827e('0x22')]=function(_0x1cf9e0,_0x51971d){if(_0x1cf9e0['body']['id']){delete _0x1cf9e0[_0x827e('0x48')]['id'];}return db[_0x827e('0x2b')][_0x827e('0x47')]({'where':{'id':_0x1cf9e0[_0x827e('0x45')]['id']}})['then'](handleEntityNotFound(_0x51971d,null))[_0x827e('0x23')](saveUpdates(_0x1cf9e0[_0x827e('0x48')],null))[_0x827e('0x23')](respondWithResult(_0x51971d,null))[_0x827e('0x44')](handleError(_0x51971d,null));};exports['destroy']=function(_0x115db6,_0x65e0b2){return db[_0x827e('0x2b')][_0x827e('0x47')]({'where':{'id':_0x115db6[_0x827e('0x45')]['id']}})['then'](handleEntityNotFound(_0x65e0b2,null))['then'](removeEntity(_0x65e0b2,null))['catch'](handleError(_0x65e0b2,null));};exports[_0x827e('0x49')]=function(_0x452d39,_0x340567){var _0x2f2947;return db['sequelize'][_0x827e('0x4a')](function(_0x1f5e4b){return db[_0x827e('0x2b')][_0x827e('0x49')](_0x452d39[_0x827e('0x48')],{'transaction':_0x1f5e4b})['then'](function(_0x36e80b){_0x2f2947=_0x36e80b;var _0x3498a1={'type':db[_0x827e('0x4b')][_0x827e('0x4c')],'transaction':_0x1f5e4b};switch(_0x452d39[_0x827e('0x48')]['type']){case'text':_0x3498a1[_0x827e('0x2e')]=db[_0x827e('0x4b')][_0x827e('0x4c')];break;case'number':_0x3498a1[_0x827e('0x2e')]=db[_0x827e('0x4b')]['INTEGER'];break;case _0x827e('0x4d'):_0x3498a1[_0x827e('0x2e')]=db[_0x827e('0x4b')][_0x827e('0x4e')];_0x3498a1['defaultValue']=![];break;default:}return db[_0x827e('0x4f')][_0x827e('0x50')][_0x827e('0x51')](_0x827e('0x52'),util['format'](_0x827e('0x53'),_0x2f2947['id']),_0x3498a1);})['then'](function(){return _0x2f2947;});})[_0x827e('0x23')](respondWithResult(_0x340567,0xc9))['catch'](handleError(_0x340567,null));}; \ No newline at end of file +var _0xf0aa=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','status','set','Content-Range','json','reject','then','destroy','stack','name','index','fieldName','type','model','differenceBy','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','CmCustomField','includeAll','include','findAll','rows','show','params','rawAttributes','catch','update','body','find','create','sequelize','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils'];(function(_0x40d5cc,_0xf9d2c7){var _0x6950af=function(_0x295221){while(--_0x295221){_0x40d5cc['push'](_0x40d5cc['shift']());}};_0x6950af(++_0xf9d2c7);}(_0xf0aa,0x198));var _0xaf0a=function(_0x50e70e,_0x43e5a2){_0x50e70e=_0x50e70e-0x0;var _0x4170bb=_0xf0aa[_0x50e70e];return _0x4170bb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaf0a('0x0'));var rimraf=require(_0xaf0a('0x1'));var zipdir=require(_0xaf0a('0x2'));var jsonpatch=require(_0xaf0a('0x3'));var rp=require(_0xaf0a('0x4'));var moment=require(_0xaf0a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaf0a('0x6'));var util=require(_0xaf0a('0x7'));var path=require(_0xaf0a('0x8'));var sox=require('sox');var csv=require(_0xaf0a('0x9'));var ejs=require(_0xaf0a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf0a('0xb'));var squel=require(_0xaf0a('0xc'));var crypto=require(_0xaf0a('0xd'));var jsforce=require(_0xaf0a('0xe'));var deskjs=require(_0xaf0a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaf0a('0x10'));var Redis=require(_0xaf0a('0x11'));var authService=require(_0xaf0a('0x12'));var qs=require(_0xaf0a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf0a('0x14'))('api');var utils=require(_0xaf0a('0x15'));var config=require(_0xaf0a('0x16'));var licenseUtil=require(_0xaf0a('0x17'));var db=require(_0xaf0a('0x18'))['db'];function respondWithStatusCode(_0x246480,_0x4ada76){_0x4ada76=_0x4ada76||0xcc;return function(_0x538bd1){if(_0x538bd1){return _0x246480[_0xaf0a('0x19')](_0x4ada76);}return _0x246480['status'](_0x4ada76)[_0xaf0a('0x1a')]();};}function respondWithResult(_0x2552a4,_0x147395){_0x147395=_0x147395||0xc8;return function(_0x34c970){if(_0x34c970){return _0x2552a4['status'](_0x147395)['json'](_0x34c970);}};}function respondWithFilteredResult(_0x52c483,_0x1ff3ec){return function(_0x54a4f2){if(_0x54a4f2){var _0x5945fa=_0x54a4f2[_0xaf0a('0x1b')],_0x192e79=_0x1ff3ec['offset'],_0x1fcf74=_0x1ff3ec[_0xaf0a('0x1c')]+_0x1ff3ec[_0xaf0a('0x1d')],_0xe973b3;if(_0x1fcf74>=_0x5945fa){_0x1fcf74=_0x5945fa;_0xe973b3=0xc8;}else{_0xe973b3=0xce;}_0x52c483[_0xaf0a('0x1e')](_0xe973b3);return _0x52c483[_0xaf0a('0x1f')](_0xaf0a('0x20'),_0x192e79+'-'+_0x1fcf74+'/'+_0x5945fa)[_0xaf0a('0x21')](_0x54a4f2);}return null;};}function patchUpdates(_0x162ce0){return function(_0x4b7544){try{jsonpatch['apply'](_0x4b7544,_0x162ce0,!![]);}catch(_0x350327){return BPromise[_0xaf0a('0x22')](_0x350327);}return _0x4b7544['save']();};}function saveUpdates(_0x4593b5,_0x209c20){return function(_0x5e5eaf){if(_0x5e5eaf){return _0x5e5eaf['update'](_0x4593b5)[_0xaf0a('0x23')](function(_0x1804d3){return _0x1804d3;});}return null;};}function removeEntity(_0x4a3e00,_0x568d52){return function(_0x27869d){if(_0x27869d){return _0x27869d[_0xaf0a('0x24')]()[_0xaf0a('0x23')](function(){_0x4a3e00[_0xaf0a('0x1e')](0xcc)[_0xaf0a('0x1a')]();});}};}function handleEntityNotFound(_0x4a8277,_0x5dbc54){return function(_0x3e3234){if(!_0x3e3234){_0x4a8277[_0xaf0a('0x19')](0x194);}return _0x3e3234;};}function handleError(_0x4ce809,_0x9b57da){_0x9b57da=_0x9b57da||0x1f4;return function(_0x796ba0){logger['error'](_0x796ba0[_0xaf0a('0x25')]);if(_0x796ba0[_0xaf0a('0x26')]){delete _0x796ba0[_0xaf0a('0x26')];}_0x4ce809[_0xaf0a('0x1e')](_0x9b57da)['send'](_0x796ba0);};}exports[_0xaf0a('0x27')]=function(_0x21ea7a,_0x444a14){var _0x534ec4={},_0x5decdf={},_0x5a8be1={'count':0x0,'rows':[]};var _0x20d9e2=_['map'](db['CmCustomField']['rawAttributes'],function(_0x2afd3b){return{'name':_0x2afd3b[_0xaf0a('0x28')],'type':_0x2afd3b[_0xaf0a('0x29')]['key']};});_0x5decdf[_0xaf0a('0x2a')]=_[_0xaf0a('0x2b')](_[_0xaf0a('0x2c')](_0x20d9e2,_0xaf0a('0x26')),[_0xaf0a('0x26')]);_0x5decdf['query']=_[_0xaf0a('0x2d')](_0x21ea7a[_0xaf0a('0x2e')]);_0x5decdf['filters']=_['intersection'](_0x5decdf[_0xaf0a('0x2a')],_0x5decdf[_0xaf0a('0x2e')]);_0x534ec4[_0xaf0a('0x2f')]=_[_0xaf0a('0x30')](_0x5decdf['model'],qs[_0xaf0a('0x31')](_0x21ea7a['query']['fields']));_0x534ec4[_0xaf0a('0x2f')]=_0x534ec4[_0xaf0a('0x2f')][_0xaf0a('0x32')]?_0x534ec4[_0xaf0a('0x2f')]:_0x5decdf['model'];if(!_0x21ea7a['query'][_0xaf0a('0x33')](_0xaf0a('0x34'))){_0x534ec4[_0xaf0a('0x1d')]=qs[_0xaf0a('0x1d')](_0x21ea7a[_0xaf0a('0x2e')]['limit']);_0x534ec4['offset']=qs[_0xaf0a('0x1c')](_0x21ea7a[_0xaf0a('0x2e')]['offset']);}_0x534ec4['order']=qs['sort'](_0x21ea7a[_0xaf0a('0x2e')][_0xaf0a('0x35')]);_0x534ec4[_0xaf0a('0x36')]=qs[_0xaf0a('0x37')](_[_0xaf0a('0x38')](_0x21ea7a[_0xaf0a('0x2e')],_0x5decdf[_0xaf0a('0x37')]),_0x20d9e2);if(_0x21ea7a[_0xaf0a('0x2e')][_0xaf0a('0x39')]){_0x534ec4[_0xaf0a('0x36')]=_['merge'](_0x534ec4[_0xaf0a('0x36')],{'$or':_[_0xaf0a('0x2c')](_0x20d9e2,function(_0x1a455f){if(_0x1a455f[_0xaf0a('0x29')]!==_0xaf0a('0x3a')){var _0xb00737={};_0xb00737[_0x1a455f[_0xaf0a('0x26')]]={'$like':'%'+_0x21ea7a[_0xaf0a('0x2e')]['filter']+'%'};return _0xb00737;}})});}_0x534ec4=_[_0xaf0a('0x3b')]({},_0x534ec4,_0x21ea7a['options']);var _0x151d5b={'where':_0x534ec4['where']};return db[_0xaf0a('0x3c')]['count'](_0x151d5b)['then'](function(_0x25f28b){_0x5a8be1[_0xaf0a('0x1b')]=_0x25f28b;if(_0x21ea7a[_0xaf0a('0x2e')][_0xaf0a('0x3d')]){_0x534ec4[_0xaf0a('0x3e')]=[{'all':!![]}];}return db[_0xaf0a('0x3c')][_0xaf0a('0x3f')](_0x534ec4);})[_0xaf0a('0x23')](function(_0x2f198a){_0x5a8be1[_0xaf0a('0x40')]=_0x2f198a;return _0x5a8be1;})['then'](respondWithFilteredResult(_0x444a14,_0x534ec4))['catch'](handleError(_0x444a14,null));};exports[_0xaf0a('0x41')]=function(_0x522d37,_0x252a89){var _0x3ba90a={'raw':!![],'where':{'id':_0x522d37[_0xaf0a('0x42')]['id']}},_0x50019={};_0x50019[_0xaf0a('0x2a')]=_[_0xaf0a('0x2d')](db[_0xaf0a('0x3c')][_0xaf0a('0x43')]);_0x50019[_0xaf0a('0x2e')]=_['keys'](_0x522d37[_0xaf0a('0x2e')]);_0x50019[_0xaf0a('0x37')]=_[_0xaf0a('0x30')](_0x50019[_0xaf0a('0x2a')],_0x50019[_0xaf0a('0x2e')]);_0x3ba90a['attributes']=_['intersection'](_0x50019[_0xaf0a('0x2a')],qs['fields'](_0x522d37['query'][_0xaf0a('0x31')]));_0x3ba90a[_0xaf0a('0x2f')]=_0x3ba90a[_0xaf0a('0x2f')]['length']?_0x3ba90a[_0xaf0a('0x2f')]:_0x50019['model'];if(_0x522d37['query'][_0xaf0a('0x3d')]){_0x3ba90a[_0xaf0a('0x3e')]=[{'all':!![]}];}_0x3ba90a=_[_0xaf0a('0x3b')]({},_0x3ba90a,_0x522d37['options']);return db['CmCustomField']['find'](_0x3ba90a)[_0xaf0a('0x23')](handleEntityNotFound(_0x252a89,null))[_0xaf0a('0x23')](respondWithResult(_0x252a89,null))[_0xaf0a('0x44')](handleError(_0x252a89,null));};exports[_0xaf0a('0x45')]=function(_0x3f9c79,_0x3bbab3){if(_0x3f9c79[_0xaf0a('0x46')]['id']){delete _0x3f9c79[_0xaf0a('0x46')]['id'];}return db[_0xaf0a('0x3c')][_0xaf0a('0x47')]({'where':{'id':_0x3f9c79[_0xaf0a('0x42')]['id']}})['then'](handleEntityNotFound(_0x3bbab3,null))[_0xaf0a('0x23')](saveUpdates(_0x3f9c79[_0xaf0a('0x46')],null))[_0xaf0a('0x23')](respondWithResult(_0x3bbab3,null))[_0xaf0a('0x44')](handleError(_0x3bbab3,null));};exports[_0xaf0a('0x24')]=function(_0x41ffa5,_0x96847c){return db[_0xaf0a('0x3c')][_0xaf0a('0x47')]({'where':{'id':_0x41ffa5[_0xaf0a('0x42')]['id']}})['then'](handleEntityNotFound(_0x96847c,null))[_0xaf0a('0x23')](removeEntity(_0x96847c,null))[_0xaf0a('0x44')](handleError(_0x96847c,null));};exports[_0xaf0a('0x48')]=function(_0x3b2503,_0x48f5b8){var _0x743aaa;return db[_0xaf0a('0x49')]['transaction'](function(_0x596fe4){return db[_0xaf0a('0x3c')][_0xaf0a('0x48')](_0x3b2503[_0xaf0a('0x46')],{'transaction':_0x596fe4})[_0xaf0a('0x23')](function(_0x55ca21){_0x743aaa=_0x55ca21;var _0x292fd2={'type':db[_0xaf0a('0x4a')]['TEXT'],'transaction':_0x596fe4};switch(_0x3b2503[_0xaf0a('0x46')][_0xaf0a('0x29')]){case _0xaf0a('0x4b'):_0x292fd2[_0xaf0a('0x29')]=db[_0xaf0a('0x4a')][_0xaf0a('0x4c')];break;case _0xaf0a('0x4d'):_0x292fd2[_0xaf0a('0x29')]=db[_0xaf0a('0x4a')][_0xaf0a('0x4e')];break;case _0xaf0a('0x4f'):_0x292fd2[_0xaf0a('0x29')]=db[_0xaf0a('0x4a')][_0xaf0a('0x50')];_0x292fd2[_0xaf0a('0x51')]=![];break;default:}return db[_0xaf0a('0x49')]['queryInterface'][_0xaf0a('0x52')](_0xaf0a('0x53'),util[_0xaf0a('0x54')](_0xaf0a('0x55'),_0x743aaa['id']),_0x292fd2);})[_0xaf0a('0x23')](function(){return _0x743aaa;});})[_0xaf0a('0x23')](respondWithResult(_0x48f5b8,0xc9))[_0xaf0a('0x44')](handleError(_0x48f5b8,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 8f69a87..6dfa21b 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 _0x9f9d=['../../config/logger','moment','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x9f9d,0x1c2));var _0xd9f9=function(_0x41535b,_0x2082d3){_0x41535b=_0x41535b-0x0;var _0x525357=_0x9f9d[_0x41535b];return _0x525357;};'use strict';var _=require(_0xd9f9('0x0'));var util=require('util');var logger=require(_0xd9f9('0x1'))('api');var moment=require(_0xd9f9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9f9('0x3'));var rimraf=require(_0xd9f9('0x4'));var config=require(_0xd9f9('0x5'));var attributes=require(_0xd9f9('0x6'));module[_0xd9f9('0x7')]=function(_0x1dec53,_0x3c3aa2){return _0x1dec53[_0xd9f9('0x8')](_0xd9f9('0x9'),attributes,{'tableName':_0xd9f9('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33a5=['path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24fa1a,_0x16d9c2){var _0xc5621f=function(_0x5616ac){while(--_0x5616ac){_0x24fa1a['push'](_0x24fa1a['shift']());}};_0xc5621f(++_0x16d9c2);}(_0x33a5,0x125));var _0x533a=function(_0x5d0c08,_0x546538){_0x5d0c08=_0x5d0c08-0x0;var _0x44b5f1=_0x33a5[_0x5d0c08];return _0x44b5f1;};'use strict';var _=require(_0x533a('0x0'));var util=require(_0x533a('0x1'));var logger=require(_0x533a('0x2'))(_0x533a('0x3'));var moment=require(_0x533a('0x4'));var BPromise=require(_0x533a('0x5'));var rp=require(_0x533a('0x6'));var fs=require('fs');var path=require(_0x533a('0x7'));var rimraf=require(_0x533a('0x8'));var config=require(_0x533a('0x9'));var attributes=require(_0x533a('0xa'));module[_0x533a('0xb')]=function(_0x1bacf2,_0x4ea14d){return _0x1bacf2[_0x533a('0xc')](_0x533a('0xd'),attributes,{'tableName':_0x533a('0xe'),'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 e60d519..e3a3cea 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 _0x0a9a=['CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x39194a,_0x10366c){var _0x21af77=function(_0x6e421b){while(--_0x6e421b){_0x39194a['push'](_0x39194a['shift']());}};_0x21af77(++_0x10366c);}(_0x0a9a,0x183));var _0xa0a9=function(_0xf55335,_0x498bdf){_0xf55335=_0xf55335-0x0;var _0x37a947=_0x0a9a[_0xf55335];return _0x37a947;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('CmCustomField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('CmCustomField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file +var _0x6f0d=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x41fad1,_0x63daef){var _0x3efaea=function(_0x4d30c3){while(--_0x4d30c3){_0x41fad1['push'](_0x41fad1['shift']());}};_0x3efaea(++_0x63daef);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x59c5ca,_0x222cb0){_0x59c5ca=_0x59c5ca-0x0;var _0xe3edda=_0x6f0d[_0x59c5ca];return _0xe3edda;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('CmCustomField,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 91f4ac4..3a2452b 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 _0x9f13=['isAuthenticated','index','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get'];(function(_0x1bd26e,_0x3f93bc){var _0x536979=function(_0x4b061f){while(--_0x4b061f){_0x1bd26e['push'](_0x1bd26e['shift']());}};_0x536979(++_0x3f93bc);}(_0x9f13,0x117));var _0x39f1=function(_0x38cb44,_0x2cfb6a){_0x38cb44=_0x38cb44-0x0;var _0x2d08ab=_0x9f13[_0x38cb44];return _0x2d08ab;};'use strict';var multer=require(_0x39f1('0x0'));var util=require(_0x39f1('0x1'));var path=require(_0x39f1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x39f1('0x3')]();var fs_extra=require(_0x39f1('0x4'));var auth=require(_0x39f1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x39f1('0x6'));var controller=require(_0x39f1('0x7'));router[_0x39f1('0x8')]('/',auth[_0x39f1('0x9')](),controller[_0x39f1('0xa')]);router['get']('/:id',auth[_0x39f1('0x9')](),controller['show']);router[_0x39f1('0xb')]('/',auth[_0x39f1('0x9')](),controller[_0x39f1('0xc')]);router[_0x39f1('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x39f1('0xe')]);router[_0x39f1('0xf')]('/:id',auth[_0x39f1('0x9')](),controller[_0x39f1('0x10')]);module[_0x39f1('0x11')]=router; \ No newline at end of file +var _0x7294=['create','put','update','delete','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post'];(function(_0x4bf760,_0x960da5){var _0x7395e9=function(_0x15ad3b){while(--_0x15ad3b){_0x4bf760['push'](_0x4bf760['shift']());}};_0x7395e9(++_0x960da5);}(_0x7294,0x114));var _0x4729=function(_0x3eba18,_0x11f581){_0x3eba18=_0x3eba18-0x0;var _0x3ba32e=_0x7294[_0x3eba18];return _0x3ba32e;};'use strict';var multer=require(_0x4729('0x0'));var util=require(_0x4729('0x1'));var path=require(_0x4729('0x2'));var timeout=require(_0x4729('0x3'));var express=require(_0x4729('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4729('0x5'));var config=require(_0x4729('0x6'));var controller=require('./cmCustomField.controller');router[_0x4729('0x7')]('/',auth[_0x4729('0x8')](),controller[_0x4729('0x9')]);router[_0x4729('0x7')](_0x4729('0xa'),auth[_0x4729('0x8')](),controller['show']);router[_0x4729('0xb')]('/',auth[_0x4729('0x8')](),controller[_0x4729('0xc')]);router[_0x4729('0xd')](_0x4729('0xa'),auth['isAuthenticated'](),controller[_0x4729('0xe')]);router[_0x4729('0xf')](_0x4729('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index bdcd29b..a830a7f 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 _0x826a=['BOOLEAN','UNSIGNED','contactListQueue','sequelize','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x575ba8,_0x8e6048){var _0x487763=function(_0x3f6292){while(--_0x3f6292){_0x575ba8['push'](_0x575ba8['shift']());}};_0x487763(++_0x8e6048);}(_0x826a,0x1aa));var _0xa826=function(_0x1688ef,_0x250113){_0x1688ef=_0x1688ef-0x0;var _0x512784=_0x826a[_0x1688ef];return _0x512784;};'use strict';var moment=require('moment');var Sequelize=require(_0xa826('0x0'));module['exports']={'phone':{'type':Sequelize[_0xa826('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa826('0x2')],'defaultValue':moment()[_0xa826('0x3')](_0xa826('0x4'))},'countbusyretry':{'type':Sequelize[_0xa826('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa826('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa826('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa826('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa826('0x2')]},'priority':{'type':Sequelize[_0xa826('0x5')](0x2)[_0xa826('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa826('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa826('0x5')],'unique':_0xa826('0x8')},'ListId':{'type':Sequelize[_0xa826('0x5')],'unique':_0xa826('0x8')},'UserId':{'type':Sequelize[_0xa826('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xa826('0x5')],'unique':_0xa826('0x8')},'CampaignId':{'type':Sequelize[_0xa826('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xa826('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa826('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa826('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcd59=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x37a786,_0x184e77){var _0x3cdd86=function(_0x44e7bc){while(--_0x44e7bc){_0x37a786['push'](_0x37a786['shift']());}};_0x3cdd86(++_0x184e77);}(_0xcd59,0x14b));var _0x9cd5=function(_0x272156,_0x5e4b0d){_0x272156=_0x272156-0x0;var _0x1071d0=_0xcd59[_0x272156];return _0x1071d0;};'use strict';var moment=require(_0x9cd5('0x0'));var Sequelize=require(_0x9cd5('0x1'));module[_0x9cd5('0x2')]={'phone':{'type':Sequelize[_0x9cd5('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x9cd5('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9cd5('0x5')],'defaultValue':moment()['format'](_0x9cd5('0x6'))},'countbusyretry':{'type':Sequelize[_0x9cd5('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9cd5('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9cd5('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9cd5('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9cd5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9cd5('0x5')]},'priority':{'type':Sequelize[_0x9cd5('0x7')](0x2)[_0x9cd5('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9cd5('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x9cd5('0x9')},'ListId':{'type':Sequelize[_0x9cd5('0x7')],'unique':_0x9cd5('0x9')},'UserId':{'type':Sequelize[_0x9cd5('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x9cd5('0x7')],'unique':_0x9cd5('0x9')},'CampaignId':{'type':Sequelize[_0x9cd5('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x9cd5('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9cd5('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9cd5('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9cd5('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index e41b5be..8549615 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 _0x6455=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$notBetween','$notIn','$notLike','$notILike','$like','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','format','prev','hopperIds','priority','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','scheduledAt','sequelize','literal','findOne','LOCK','Contact','CmCompany','Company','CmList','List','Queue','dialActive','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found'];(function(_0x3b51cb,_0x1871ee){var _0x1ca685=function(_0x1c9442){while(--_0x1c9442){_0x3b51cb['push'](_0x3b51cb['shift']());}};_0x1ca685(++_0x1871ee);}(_0x6455,0x97));var _0x5645=function(_0x1bc57e,_0xe62fd8){_0x1bc57e=_0x1bc57e-0x0;var _0x51621d=_0x6455[_0x1bc57e];return _0x51621d;};'use strict';var pdf=require(_0x5645('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5645('0x1'));var zipdir=require(_0x5645('0x2'));var jsonpatch=require(_0x5645('0x3'));var rp=require(_0x5645('0x4'));var moment=require(_0x5645('0x5'));var BPromise=require(_0x5645('0x6'));var Mustache=require('mustache');var util=require(_0x5645('0x7'));var path=require(_0x5645('0x8'));var sox=require(_0x5645('0x9'));var csv=require(_0x5645('0xa'));var ejs=require(_0x5645('0xb'));var fs=require('fs');var fs_extra=require(_0x5645('0xc'));var _=require(_0x5645('0xd'));var squel=require(_0x5645('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5645('0xf'));var toCsv=require(_0x5645('0xa'));var querystring=require(_0x5645('0x10'));var Papa=require(_0x5645('0x11'));var Redis=require(_0x5645('0x12'));var authService=require(_0x5645('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5645('0x14'));var hardwareService=require(_0x5645('0x15'));var logger=require(_0x5645('0x16'))(_0x5645('0x17'));var utils=require('../../config/utils');var config=require(_0x5645('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5645('0x19'))['db'];function respondWithStatusCode(_0x4014c5,_0x42b0b0){_0x42b0b0=_0x42b0b0||0xcc;return function(_0x21b018){if(_0x21b018){return _0x4014c5[_0x5645('0x1a')](_0x42b0b0);}return _0x4014c5[_0x5645('0x1b')](_0x42b0b0)[_0x5645('0x1c')]();};}function respondWithResult(_0x2270a1,_0x50449c){_0x50449c=_0x50449c||0xc8;return function(_0x2da9c5){if(_0x2da9c5){return _0x2270a1[_0x5645('0x1b')](_0x50449c)[_0x5645('0x1d')](_0x2da9c5);}};}function respondWithFilteredResult(_0x4cbd46,_0x4b3be6){return function(_0x439b55){if(_0x439b55){var _0x361cfd=_0x439b55[_0x5645('0x1e')],_0x511aed=_0x4b3be6['offset'],_0x35e0c7=_0x4b3be6[_0x5645('0x1f')]+_0x4b3be6[_0x5645('0x20')],_0x3fe599;if(_0x35e0c7>=_0x361cfd){_0x35e0c7=_0x361cfd;_0x3fe599=0xc8;}else{_0x3fe599=0xce;}_0x4cbd46[_0x5645('0x1b')](_0x3fe599);return _0x4cbd46[_0x5645('0x21')]('Content-Range',_0x511aed+'-'+_0x35e0c7+'/'+_0x361cfd)[_0x5645('0x1d')](_0x439b55);}return null;};}function patchUpdates(_0x52ac46){return function(_0x557ad2){try{jsonpatch[_0x5645('0x22')](_0x557ad2,_0x52ac46,!![]);}catch(_0x1e2cba){return BPromise[_0x5645('0x23')](_0x1e2cba);}return _0x557ad2['save']();};}function saveUpdates(_0x35a672,_0x50ed38){return function(_0x2b8cc8){if(_0x2b8cc8){return _0x2b8cc8['update'](_0x35a672)['then'](function(_0x1ee2fb){return _0x1ee2fb;});}return null;};}function removeEntity(_0x53d763,_0x465a01){return function(_0x379cbd){if(_0x379cbd){return _0x379cbd['destroy']()[_0x5645('0x24')](function(){_0x53d763[_0x5645('0x1b')](0xcc)[_0x5645('0x1c')]();});}};}function handleEntityNotFound(_0x50fa82,_0x1e70ad){return function(_0xc38038){if(!_0xc38038){_0x50fa82[_0x5645('0x1a')](0x194);}return _0xc38038;};}function handleError(_0x46b33a,_0x568fd6){_0x568fd6=_0x568fd6||0x1f4;return function(_0x4bc484){logger['error'](_0x4bc484['stack']);if(_0x4bc484[_0x5645('0x25')]){delete _0x4bc484['name'];}_0x46b33a['status'](_0x568fd6)[_0x5645('0x26')](_0x4bc484);};}exports[_0x5645('0x27')]=function(_0x357388,_0x308991){var _0x3a5c61={},_0x351cbb={},_0x3b9d8e={'count':0x0,'rows':[]};var _0xc585f3=_[_0x5645('0x28')](db[_0x5645('0x29')][_0x5645('0x2a')],function(_0x2154a7){return{'name':_0x2154a7[_0x5645('0x2b')],'type':_0x2154a7[_0x5645('0x2c')]['key']};});_0x351cbb[_0x5645('0x2d')]=_['map'](_0xc585f3,_0x5645('0x25'));_0x351cbb[_0x5645('0x2e')]=_[_0x5645('0x2f')](_0x357388[_0x5645('0x2e')]);_0x351cbb[_0x5645('0x30')]=_[_0x5645('0x31')](_0x351cbb['model'],_0x351cbb['query']);_0x351cbb[_0x5645('0x30')]=_[_0x5645('0x32')](_0x351cbb[_0x5645('0x30')],[_0x5645('0x33'),_0x5645('0x34'),_0x5645('0x35'),_0x5645('0x36'),_0x5645('0x37'),_0x5645('0x38'),_0x5645('0x39'),_0x5645('0x3a'),'$not','$between',_0x5645('0x3b'),'$in',_0x5645('0x3c'),'$like',_0x5645('0x3d'),'$iLike',_0x5645('0x3e'),_0x5645('0x3f'),_0x5645('0x40'),_0x5645('0x41'),_0x5645('0x42'),_0x5645('0x43')]);_0x3a5c61['attributes']=_[_0x5645('0x31')](_0x351cbb[_0x5645('0x2d')],qs[_0x5645('0x44')](_0x357388[_0x5645('0x2e')][_0x5645('0x44')]));_0x3a5c61[_0x5645('0x45')]=_0x3a5c61[_0x5645('0x45')][_0x5645('0x46')]?_0x3a5c61['attributes']:_0x351cbb[_0x5645('0x2d')];if(!_0x357388['query'][_0x5645('0x47')](_0x5645('0x48'))){_0x3a5c61[_0x5645('0x20')]=qs[_0x5645('0x20')](_0x357388[_0x5645('0x2e')]['limit']);_0x3a5c61[_0x5645('0x1f')]=qs[_0x5645('0x1f')](_0x357388[_0x5645('0x2e')][_0x5645('0x1f')]);}_0x3a5c61[_0x5645('0x49')]=qs[_0x5645('0x4a')](_0x357388[_0x5645('0x2e')][_0x5645('0x4a')]);_0x3a5c61[_0x5645('0x4b')]=qs[_0x5645('0x30')](_[_0x5645('0x4c')](_0x357388[_0x5645('0x2e')],_0x351cbb[_0x5645('0x30')]),_0xc585f3);if(_0x357388[_0x5645('0x2e')][_0x5645('0x4d')]){_0x3a5c61[_0x5645('0x4b')]=_['merge'](_0x3a5c61[_0x5645('0x4b')],{'$or':_[_0x5645('0x28')](_0xc585f3,function(_0x488a72){if(_0x488a72[_0x5645('0x2c')]!==_0x5645('0x4e')){var _0x5e841a={};_0x5e841a[_0x488a72[_0x5645('0x25')]]={'$like':'%'+_0x357388[_0x5645('0x2e')][_0x5645('0x4d')]+'%'};return _0x5e841a;}})});}_0x3a5c61=_[_0x5645('0x4f')]({},_0x3a5c61,_0x357388[_0x5645('0x50')]);var _0x2a72c8={'where':_0x3a5c61[_0x5645('0x4b')]};return db['CmHopper']['count'](_0x2a72c8)[_0x5645('0x24')](function(_0x1ffbd4){_0x3b9d8e[_0x5645('0x1e')]=_0x1ffbd4;if(_0x357388[_0x5645('0x2e')][_0x5645('0x51')]){_0x3a5c61[_0x5645('0x52')]=[{'all':!![]}];}return db[_0x5645('0x29')][_0x5645('0x53')](_0x3a5c61);})[_0x5645('0x24')](function(_0x240d42){_0x3b9d8e[_0x5645('0x54')]=_0x240d42;return _0x3b9d8e;})[_0x5645('0x24')](respondWithFilteredResult(_0x308991,_0x3a5c61))[_0x5645('0x55')](handleError(_0x308991,null));};exports[_0x5645('0x56')]=function(_0x47227f,_0x2a94af){var _0x3c83cf={'raw':!![],'where':{'id':_0x47227f['params']['id']}},_0x56d7e9={};_0x56d7e9['model']=_['keys'](db[_0x5645('0x29')][_0x5645('0x2a')]);_0x56d7e9[_0x5645('0x2e')]=_[_0x5645('0x2f')](_0x47227f[_0x5645('0x2e')]);_0x56d7e9['filters']=_[_0x5645('0x31')](_0x56d7e9[_0x5645('0x2d')],_0x56d7e9[_0x5645('0x2e')]);_0x3c83cf[_0x5645('0x45')]=_[_0x5645('0x31')](_0x56d7e9['model'],qs[_0x5645('0x44')](_0x47227f[_0x5645('0x2e')][_0x5645('0x44')]));_0x3c83cf[_0x5645('0x45')]=_0x3c83cf[_0x5645('0x45')][_0x5645('0x46')]?_0x3c83cf[_0x5645('0x45')]:_0x56d7e9[_0x5645('0x2d')];if(_0x47227f['query']['includeAll']){_0x3c83cf[_0x5645('0x52')]=[{'all':!![]}];}_0x3c83cf=_[_0x5645('0x4f')]({},_0x3c83cf,_0x47227f['options']);return db['CmHopper'][_0x5645('0x57')](_0x3c83cf)['then'](handleEntityNotFound(_0x2a94af,null))[_0x5645('0x24')](respondWithResult(_0x2a94af,null))[_0x5645('0x55')](handleError(_0x2a94af,null));};exports[_0x5645('0x58')]=function(_0x3e282d,_0x1aaa46){return db['CmHopper'][_0x5645('0x58')](_0x3e282d['body'],{})['then'](respondWithResult(_0x1aaa46,0xc9))[_0x5645('0x55')](handleError(_0x1aaa46,null));};exports[_0x5645('0x59')]=function(_0x275a6f,_0x46637f){if(_0x275a6f[_0x5645('0x5a')]['id']){delete _0x275a6f[_0x5645('0x5a')]['id'];}return db[_0x5645('0x29')][_0x5645('0x57')]({'where':{'id':_0x275a6f[_0x5645('0x5b')]['id']}})[_0x5645('0x24')](handleEntityNotFound(_0x46637f,null))[_0x5645('0x24')](saveUpdates(_0x275a6f[_0x5645('0x5a')],null))['then'](respondWithResult(_0x46637f,null))['catch'](handleError(_0x46637f,null));};exports[_0x5645('0x5c')]=function(_0x4b159c,_0x14f55e){return db[_0x5645('0x29')][_0x5645('0x5c')]()['then'](respondWithResult(_0x14f55e,null))[_0x5645('0x55')](handleError(_0x14f55e,null));};exports[_0x5645('0x5d')]=function(_0x4d7050,_0x341f37){var _0x12a577;return db[_0x5645('0x29')][_0x5645('0x57')]({'where':{'id':_0x4d7050[_0x5645('0x5b')]['id']}})['then'](handleEntityNotFound(_0x341f37,null))[_0x5645('0x24')](function(_0xd1f0b){if(_0xd1f0b){return _0xd1f0b[_0x5645('0x5d')]()[_0x5645('0x24')](function(_0x5c9d57){return _0x5c9d57;});}})[_0x5645('0x24')](function(_0x1ab204){_0x12a577=_0x1ab204;if(_0x1ab204){if(_0x1ab204[_0x5645('0x5e')]||_0x1ab204[_0x5645('0x5f')]){return db[_0x1ab204[_0x5645('0x5e')]?_0x5645('0x60'):_0x5645('0x61')][_0x5645('0x57')]({'where':{'id':_0x1ab204[_0x5645('0x5e')]?_0x1ab204['VoiceQueueId']:_0x1ab204[_0x5645('0x5f')]},'attributes':['id',_0x5645('0x25')],'raw':!![]});}}})['then'](function(_0x5d90a6){var _0x457b4d={};if(_0x5d90a6){_['merge'](_0x457b4d,_[_0x5645('0x62')](_0x12a577[_0x5645('0x63')],[_0x5645('0x64'),_0x5645('0x65'),'id']));_0x457b4d[_0x5645('0x66')]=0x15;_0x457b4d[_0x5645('0x67')]=_0x5645('0x68');_0x457b4d['campaign']=_0x5d90a6[_0x5645('0x25')];_0x457b4d[_0x5645('0x69')]=_0x4d7050[_0x5645('0x6a')][_0x5645('0x25')];_0x457b4d[_0x5645('0x6b')]=_0x4d7050[_0x5645('0x6a')]['id'];_0x457b4d[_0x5645('0x68')]=!![];_0x457b4d[_0x5645('0x6c')]=moment()['format'](_0x5645('0x6d'));_0x457b4d[_0x5645('0x6e')]=_0x12a577[_0x5645('0x6f')];_0x457b4d[_0x5645('0x70')]=_0x12a577['VoiceQueueId']?_0x5645('0x71'):_0x5645('0x72');return db[_0x5645('0x73')][_0x5645('0x57')]({'where':{'id':_0x457b4d[_0x5645('0x74')]},'attributes':[_0x5645('0x75'),_0x5645('0x76')]})[_0x5645('0x24')](function(_0x498acc){if(!_[_0x5645('0x77')](_0x341f37)&&!_[_0x5645('0x77')](_0x498acc[_0x5645('0x75')])){_0x457b4d[_0x5645('0x78')]=_0x498acc[_0x5645('0x75')];if(!_[_0x5645('0x77')](_0x498acc['lastName'])){_0x457b4d[_0x5645('0x78')]+='\x20'+_0x498acc[_0x5645('0x76')];}}})[_0x5645('0x79')](function(){return db[_0x5645('0x7a')]['create'](_0x457b4d);});}})['then'](function(){return _0x341f37[_0x5645('0x1b')](0xcc)[_0x5645('0x1c')]();})[_0x5645('0x55')](handleError(_0x341f37,null));};exports['getPreview']=function(_0xa322de,_0x254650,_0x253d87){var _0x6da5f9=[];return db[_0x5645('0x73')][_0x5645('0x5c')]()[_0x5645('0x24')](function(_0x1772dc){_0x6da5f9=_['keys'](_0x1772dc);return _0xa322de[_0x5645('0x6a')][_0x5645('0x7b')]({'where':{'type':_0x5645('0x7c'),'dialActive':!![],'dialMethod':_0x5645('0x7d')},'attributes':['id',_0x5645('0x7e')],'raw':!![]});})['then'](function(_0x595c78){if(_0x595c78&&_0x595c78[_0x5645('0x46')]){return db['sequelize']['transaction'](function(_0x5cf90c){var _0x2dcf56={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5645('0x7f')](_0x5645('0x6d'))},'VoiceQueueId':{'$in':_[_0x5645('0x28')](_0x595c78,'id')},'$or':[{'UserId':null},{'UserId':_0xa322de[_0x5645('0x6a')]['id']}]};var _0x4f34bd=[];if(_0xa322de[_0x5645('0x5a')]['direction']&&_0xa322de[_0x5645('0x5a')]['direction']===_0x5645('0x80')){if(!_['isEmpty'](_0xa322de['body'][_0x5645('0x81')])){_0x2dcf56['id']={'$in':_0xa322de['body'][_0x5645('0x81')]};}_0x4f34bd=[[_0x5645('0x82'),_0x5645('0x83')],['scheduledAt',_0x595c78[0x0][_0x5645('0x7e')]===_0x5645('0x83')?'DESC':'ASC'],db['sequelize']['literal'](_0x5645('0x84')),['id',_0x5645('0x85')]];}else{if(!_['isEmpty'](_0xa322de[_0x5645('0x5a')][_0x5645('0x81')])){_0x2dcf56['id']={'$notIn':_0xa322de[_0x5645('0x5a')][_0x5645('0x81')]};}_0x4f34bd=[[_0x5645('0x82'),_0x5645('0x85')],[_0x5645('0x86'),_0x595c78[0x0][_0x5645('0x7e')]],db[_0x5645('0x87')][_0x5645('0x88')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x5645('0x83')]];}return db['CmHopper'][_0x5645('0x89')]({'attributes':['id','scheduledat'],'where':_0x2dcf56,'order':_0x4f34bd,'transaction':_0x5cf90c,'lock':_0x5cf90c[_0x5645('0x8a')]['UPDATE'],'include':[{'model':db[_0x5645('0x73')],'as':_0x5645('0x8b'),'attributes':_0x6da5f9,'include':[{'model':db[_0x5645('0x8c')],'as':_0x5645('0x8d'),'attributes':['id',_0x5645('0x25')]}]},{'model':db[_0x5645('0x8e')],'as':_0x5645('0x8f'),'attributes':['id',_0x5645('0x25')]},{'model':db[_0x5645('0x60')],'as':_0x5645('0x90'),'attributes':['id',_0x5645('0x25'),_0x5645('0x91')]}]})[_0x5645('0x24')](function(_0x12475e){if(_0x12475e){return _0x12475e['update']({'UserId':_0xa322de[_0x5645('0x6a')]['id']},{'transaction':_0x5cf90c});}});});}})[_0x5645('0x24')](handleEntityNotFound(_0x254650,null))[_0x5645('0x24')](respondWithResult(_0x254650,null))['catch'](handleError(_0x254650,null));};exports['getOpenContacts']=function(_0x38cfb2,_0x57d7d2,_0x5a1009){return _0x38cfb2[_0x5645('0x6a')][_0x5645('0x7b')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x5645('0x7d')},'attributes':['id'],'raw':!![]})[_0x5645('0x24')](function(_0x7726d3){if(_0x7726d3&&_0x7726d3[_0x5645('0x46')]){return db[_0x5645('0x29')][_0x5645('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5645('0x7f')](_0x5645('0x6d'))},'VoiceQueueId':{'$in':_[_0x5645('0x28')](_0x7726d3,'id')},'$or':[{'UserId':null},{'UserId':_0x38cfb2[_0x5645('0x6a')]['id']}]}});}return 0x0;})[_0x5645('0x24')](function(_0x101e9a){if(!_['isNil'](_0x101e9a)&&_[_0x5645('0x92')](_0x101e9a)){return _0x57d7d2[_0x5645('0x1b')](0xc8)['json']({'contacts':_0x101e9a});}else{logger[_0x5645('0x93')](_0x5645('0x94'),_0x5645('0x95'),0x194,_0x5645('0x96'));_0x57d7d2['sendStatus'](0x194);}})['catch'](handleError(_0x57d7d2,null));}; \ No newline at end of file +var _0xf981=['$like','$notLike','$iLike','$notILike','$overlap','$contains','attributes','fields','length','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','keys','intersection','find','create','update','body','params','describe','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','createdAt','updatedAt','state','statedesc','campaign','membername','user','UserId','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ContactId','firstName','lastName','isNil','calleridname','finally','getPreview','CmContact','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','findOne','scheduledat','LOCK','UPDATE','Contact','Company','CmList','dialActive','getOpenContacts','outbound','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','destroy','then','stack','name','send','index','map','CmHopper','rawAttributes','type','key','model','query','filters','concat','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xf981,0xe6));var _0x1f98=function(_0x540525,_0x16c127){_0x540525=_0x540525-0x0;var _0x3fdaf5=_0xf981[_0x540525];return _0x3fdaf5;};'use strict';var pdf=require(_0x1f98('0x0'));var emlformat=require(_0x1f98('0x1'));var rimraf=require(_0x1f98('0x2'));var zipdir=require(_0x1f98('0x3'));var jsonpatch=require(_0x1f98('0x4'));var rp=require(_0x1f98('0x5'));var moment=require(_0x1f98('0x6'));var BPromise=require(_0x1f98('0x7'));var Mustache=require('mustache');var util=require(_0x1f98('0x8'));var path=require(_0x1f98('0x9'));var sox=require(_0x1f98('0xa'));var csv=require(_0x1f98('0xb'));var ejs=require(_0x1f98('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1f98('0xd'));var crypto=require('crypto');var jsforce=require(_0x1f98('0xe'));var deskjs=require(_0x1f98('0xf'));var toCsv=require(_0x1f98('0xb'));var querystring=require(_0x1f98('0x10'));var Papa=require(_0x1f98('0x11'));var Redis=require('ioredis');var authService=require(_0x1f98('0x12'));var qs=require(_0x1f98('0x13'));var as=require(_0x1f98('0x14'));var hardwareService=require(_0x1f98('0x15'));var logger=require('../../config/logger')(_0x1f98('0x16'));var utils=require('../../config/utils');var config=require(_0x1f98('0x17'));var licenseUtil=require(_0x1f98('0x18'));var db=require(_0x1f98('0x19'))['db'];function respondWithStatusCode(_0x4d14ae,_0x5e34f9){_0x5e34f9=_0x5e34f9||0xcc;return function(_0x5b18c6){if(_0x5b18c6){return _0x4d14ae[_0x1f98('0x1a')](_0x5e34f9);}return _0x4d14ae[_0x1f98('0x1b')](_0x5e34f9)[_0x1f98('0x1c')]();};}function respondWithResult(_0x2d9c83,_0x87ffbd){_0x87ffbd=_0x87ffbd||0xc8;return function(_0xc095e9){if(_0xc095e9){return _0x2d9c83[_0x1f98('0x1b')](_0x87ffbd)['json'](_0xc095e9);}};}function respondWithFilteredResult(_0x1a21cd,_0x547b5c){return function(_0x2fc335){if(_0x2fc335){var _0x539334=_0x2fc335[_0x1f98('0x1d')],_0x4534d7=_0x547b5c[_0x1f98('0x1e')],_0xf711c3=_0x547b5c[_0x1f98('0x1e')]+_0x547b5c[_0x1f98('0x1f')],_0x30bb88;if(_0xf711c3>=_0x539334){_0xf711c3=_0x539334;_0x30bb88=0xc8;}else{_0x30bb88=0xce;}_0x1a21cd['status'](_0x30bb88);return _0x1a21cd[_0x1f98('0x20')]('Content-Range',_0x4534d7+'-'+_0xf711c3+'/'+_0x539334)[_0x1f98('0x21')](_0x2fc335);}return null;};}function patchUpdates(_0x23221d){return function(_0xd0529a){try{jsonpatch[_0x1f98('0x22')](_0xd0529a,_0x23221d,!![]);}catch(_0x3c8b4e){return BPromise[_0x1f98('0x23')](_0x3c8b4e);}return _0xd0529a[_0x1f98('0x24')]();};}function saveUpdates(_0x3b9e54,_0x356ac8){return function(_0x56f46c){if(_0x56f46c){return _0x56f46c['update'](_0x3b9e54)['then'](function(_0xa07804){return _0xa07804;});}return null;};}function removeEntity(_0x431958,_0x46582d){return function(_0x56feb8){if(_0x56feb8){return _0x56feb8[_0x1f98('0x25')]()[_0x1f98('0x26')](function(){_0x431958['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1de1cd,_0x596914){return function(_0x20bf86){if(!_0x20bf86){_0x1de1cd['sendStatus'](0x194);}return _0x20bf86;};}function handleError(_0x488497,_0x48a5dc){_0x48a5dc=_0x48a5dc||0x1f4;return function(_0x2ceeac){logger['error'](_0x2ceeac[_0x1f98('0x27')]);if(_0x2ceeac[_0x1f98('0x28')]){delete _0x2ceeac[_0x1f98('0x28')];}_0x488497[_0x1f98('0x1b')](_0x48a5dc)[_0x1f98('0x29')](_0x2ceeac);};}exports[_0x1f98('0x2a')]=function(_0x401606,_0x1721fc){var _0x48819d={},_0x10069b={},_0x4aef13={'count':0x0,'rows':[]};var _0x18d13b=_[_0x1f98('0x2b')](db[_0x1f98('0x2c')][_0x1f98('0x2d')],function(_0x5213a9){return{'name':_0x5213a9['fieldName'],'type':_0x5213a9[_0x1f98('0x2e')][_0x1f98('0x2f')]};});_0x10069b[_0x1f98('0x30')]=_[_0x1f98('0x2b')](_0x18d13b,'name');_0x10069b[_0x1f98('0x31')]=_['keys'](_0x401606[_0x1f98('0x31')]);_0x10069b['filters']=_['intersection'](_0x10069b[_0x1f98('0x30')],_0x10069b[_0x1f98('0x31')]);_0x10069b[_0x1f98('0x32')]=_[_0x1f98('0x33')](_0x10069b[_0x1f98('0x32')],[_0x1f98('0x34'),'$or',_0x1f98('0x35'),_0x1f98('0x36'),_0x1f98('0x37'),_0x1f98('0x38'),_0x1f98('0x39'),_0x1f98('0x3a'),_0x1f98('0x3b'),_0x1f98('0x3c'),_0x1f98('0x3d'),_0x1f98('0x3e'),_0x1f98('0x3f'),_0x1f98('0x40'),_0x1f98('0x41'),_0x1f98('0x42'),_0x1f98('0x43'),_0x1f98('0x40'),_0x1f98('0x44'),_0x1f98('0x45'),'$contained','$any']);_0x48819d[_0x1f98('0x46')]=_['intersection'](_0x10069b[_0x1f98('0x30')],qs['fields'](_0x401606[_0x1f98('0x31')][_0x1f98('0x47')]));_0x48819d[_0x1f98('0x46')]=_0x48819d[_0x1f98('0x46')][_0x1f98('0x48')]?_0x48819d[_0x1f98('0x46')]:_0x10069b['model'];if(!_0x401606[_0x1f98('0x31')]['hasOwnProperty']('nolimit')){_0x48819d[_0x1f98('0x1f')]=qs[_0x1f98('0x1f')](_0x401606[_0x1f98('0x31')][_0x1f98('0x1f')]);_0x48819d[_0x1f98('0x1e')]=qs['offset'](_0x401606[_0x1f98('0x31')][_0x1f98('0x1e')]);}_0x48819d[_0x1f98('0x49')]=qs[_0x1f98('0x4a')](_0x401606[_0x1f98('0x31')][_0x1f98('0x4a')]);_0x48819d[_0x1f98('0x4b')]=qs[_0x1f98('0x32')](_['pick'](_0x401606[_0x1f98('0x31')],_0x10069b[_0x1f98('0x32')]),_0x18d13b);if(_0x401606[_0x1f98('0x31')][_0x1f98('0x4c')]){_0x48819d['where']=_['merge'](_0x48819d[_0x1f98('0x4b')],{'$or':_['map'](_0x18d13b,function(_0x1fd703){if(_0x1fd703[_0x1f98('0x2e')]!==_0x1f98('0x4d')){var _0x43b457={};_0x43b457[_0x1fd703['name']]={'$like':'%'+_0x401606['query']['filter']+'%'};return _0x43b457;}})});}_0x48819d=_[_0x1f98('0x4e')]({},_0x48819d,_0x401606[_0x1f98('0x4f')]);var _0x341aa1={'where':_0x48819d[_0x1f98('0x4b')]};return db[_0x1f98('0x2c')]['count'](_0x341aa1)[_0x1f98('0x26')](function(_0x44829d){_0x4aef13[_0x1f98('0x1d')]=_0x44829d;if(_0x401606[_0x1f98('0x31')][_0x1f98('0x50')]){_0x48819d['include']=[{'all':!![]}];}return db[_0x1f98('0x2c')][_0x1f98('0x51')](_0x48819d);})[_0x1f98('0x26')](function(_0x46663c){_0x4aef13['rows']=_0x46663c;return _0x4aef13;})['then'](respondWithFilteredResult(_0x1721fc,_0x48819d))[_0x1f98('0x52')](handleError(_0x1721fc,null));};exports[_0x1f98('0x53')]=function(_0x19936a,_0x408a51){var _0x22dd05={'raw':!![],'where':{'id':_0x19936a['params']['id']}},_0x1a7ffe={};_0x1a7ffe[_0x1f98('0x30')]=_[_0x1f98('0x54')](db[_0x1f98('0x2c')][_0x1f98('0x2d')]);_0x1a7ffe['query']=_[_0x1f98('0x54')](_0x19936a[_0x1f98('0x31')]);_0x1a7ffe[_0x1f98('0x32')]=_['intersection'](_0x1a7ffe[_0x1f98('0x30')],_0x1a7ffe[_0x1f98('0x31')]);_0x22dd05[_0x1f98('0x46')]=_[_0x1f98('0x55')](_0x1a7ffe[_0x1f98('0x30')],qs[_0x1f98('0x47')](_0x19936a['query'][_0x1f98('0x47')]));_0x22dd05[_0x1f98('0x46')]=_0x22dd05['attributes'][_0x1f98('0x48')]?_0x22dd05[_0x1f98('0x46')]:_0x1a7ffe[_0x1f98('0x30')];if(_0x19936a[_0x1f98('0x31')]['includeAll']){_0x22dd05['include']=[{'all':!![]}];}_0x22dd05=_[_0x1f98('0x4e')]({},_0x22dd05,_0x19936a[_0x1f98('0x4f')]);return db[_0x1f98('0x2c')][_0x1f98('0x56')](_0x22dd05)[_0x1f98('0x26')](handleEntityNotFound(_0x408a51,null))[_0x1f98('0x26')](respondWithResult(_0x408a51,null))['catch'](handleError(_0x408a51,null));};exports['create']=function(_0x1dbb0b,_0x4b187d){return db[_0x1f98('0x2c')][_0x1f98('0x57')](_0x1dbb0b['body'],{})[_0x1f98('0x26')](respondWithResult(_0x4b187d,0xc9))[_0x1f98('0x52')](handleError(_0x4b187d,null));};exports[_0x1f98('0x58')]=function(_0x5acf44,_0xd57aad){if(_0x5acf44[_0x1f98('0x59')]['id']){delete _0x5acf44[_0x1f98('0x59')]['id'];}return db[_0x1f98('0x2c')]['find']({'where':{'id':_0x5acf44[_0x1f98('0x5a')]['id']}})['then'](handleEntityNotFound(_0xd57aad,null))[_0x1f98('0x26')](saveUpdates(_0x5acf44['body'],null))[_0x1f98('0x26')](respondWithResult(_0xd57aad,null))[_0x1f98('0x52')](handleError(_0xd57aad,null));};exports[_0x1f98('0x5b')]=function(_0xe4ba08,_0x1bb8ac){return db['CmHopper']['describe']()[_0x1f98('0x26')](respondWithResult(_0x1bb8ac,null))['catch'](handleError(_0x1bb8ac,null));};exports[_0x1f98('0x25')]=function(_0x5dde3b,_0x61c4f){var _0xb09e02;return db[_0x1f98('0x2c')][_0x1f98('0x56')]({'where':{'id':_0x5dde3b[_0x1f98('0x5a')]['id']}})[_0x1f98('0x26')](handleEntityNotFound(_0x61c4f,null))[_0x1f98('0x26')](function(_0x1a8f36){if(_0x1a8f36){return _0x1a8f36[_0x1f98('0x25')]()[_0x1f98('0x26')](function(_0x232ee6){return _0x232ee6;});}})[_0x1f98('0x26')](function(_0x4e34f6){_0xb09e02=_0x4e34f6;if(_0x4e34f6){if(_0x4e34f6['VoiceQueueId']||_0x4e34f6[_0x1f98('0x5c')]){return db[_0x4e34f6['VoiceQueueId']?_0x1f98('0x5d'):_0x1f98('0x5e')]['find']({'where':{'id':_0x4e34f6['VoiceQueueId']?_0x4e34f6[_0x1f98('0x5f')]:_0x4e34f6[_0x1f98('0x5c')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x5cd6e2){var _0x4837fe={};if(_0x5cd6e2){_[_0x1f98('0x4e')](_0x4837fe,_[_0x1f98('0x60')](_0xb09e02['dataValues'],[_0x1f98('0x61'),_0x1f98('0x62'),'id']));_0x4837fe[_0x1f98('0x63')]=0x15;_0x4837fe[_0x1f98('0x64')]='deleted';_0x4837fe[_0x1f98('0x65')]=_0x5cd6e2[_0x1f98('0x28')];_0x4837fe[_0x1f98('0x66')]=_0x5dde3b[_0x1f98('0x67')][_0x1f98('0x28')];_0x4837fe[_0x1f98('0x68')]=_0x5dde3b['user']['id'];_0x4837fe['deleted']=!![];_0x4837fe['deletedat']=moment()['format'](_0x1f98('0x69'));_0x4837fe[_0x1f98('0x6a')]=_0xb09e02[_0x1f98('0x6b')];_0x4837fe['campaigntype']=_0xb09e02[_0x1f98('0x5f')]?_0x1f98('0x6c'):'ivr';return db['CmContact']['find']({'where':{'id':_0x4837fe[_0x1f98('0x6d')]},'attributes':[_0x1f98('0x6e'),_0x1f98('0x6f')]})[_0x1f98('0x26')](function(_0x28786c){if(!_['isNil'](_0x61c4f)&&!_[_0x1f98('0x70')](_0x28786c['firstName'])){_0x4837fe['calleridname']=_0x28786c[_0x1f98('0x6e')];if(!_[_0x1f98('0x70')](_0x28786c[_0x1f98('0x6f')])){_0x4837fe[_0x1f98('0x71')]+='\x20'+_0x28786c[_0x1f98('0x6f')];}}})[_0x1f98('0x72')](function(){return db['CmHopperFinal'][_0x1f98('0x57')](_0x4837fe);});}})[_0x1f98('0x26')](function(){return _0x61c4f[_0x1f98('0x1b')](0xcc)[_0x1f98('0x1c')]();})[_0x1f98('0x52')](handleError(_0x61c4f,null));};exports[_0x1f98('0x73')]=function(_0x3453da,_0x138668,_0x4486ac){var _0x26d28c=[];return db[_0x1f98('0x74')][_0x1f98('0x5b')]()[_0x1f98('0x26')](function(_0x11d375){_0x26d28c=_[_0x1f98('0x54')](_0x11d375);return _0x3453da[_0x1f98('0x67')][_0x1f98('0x75')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x1f98('0x76')},'attributes':['id',_0x1f98('0x77')],'raw':!![]});})[_0x1f98('0x26')](function(_0x582ac8){if(_0x582ac8&&_0x582ac8[_0x1f98('0x48')]){return db[_0x1f98('0x78')][_0x1f98('0x79')](function(_0x2b28df){var _0x2a95c9={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1f98('0x7a')](_0x1f98('0x69'))},'VoiceQueueId':{'$in':_[_0x1f98('0x2b')](_0x582ac8,'id')},'$or':[{'UserId':null},{'UserId':_0x3453da[_0x1f98('0x67')]['id']}]};var _0x3058fd=[];if(_0x3453da[_0x1f98('0x59')][_0x1f98('0x7b')]&&_0x3453da[_0x1f98('0x59')][_0x1f98('0x7b')]===_0x1f98('0x7c')){if(!_['isEmpty'](_0x3453da['body'][_0x1f98('0x7d')])){_0x2a95c9['id']={'$in':_0x3453da[_0x1f98('0x59')]['hopperIds']};}_0x3058fd=[[_0x1f98('0x7e'),_0x1f98('0x7f')],[_0x1f98('0x80'),_0x582ac8[0x0][_0x1f98('0x77')]===_0x1f98('0x7f')?_0x1f98('0x81'):_0x1f98('0x7f')],db[_0x1f98('0x78')][_0x1f98('0x82')](_0x1f98('0x83')),['id','DESC']];}else{if(!_[_0x1f98('0x84')](_0x3453da[_0x1f98('0x59')]['hopperIds'])){_0x2a95c9['id']={'$notIn':_0x3453da[_0x1f98('0x59')][_0x1f98('0x7d')]};}_0x3058fd=[[_0x1f98('0x7e'),_0x1f98('0x81')],['scheduledAt',_0x582ac8[0x0][_0x1f98('0x77')]],db[_0x1f98('0x78')][_0x1f98('0x82')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x1f98('0x7f')]];}return db[_0x1f98('0x2c')][_0x1f98('0x85')]({'attributes':['id',_0x1f98('0x86')],'where':_0x2a95c9,'order':_0x3058fd,'transaction':_0x2b28df,'lock':_0x2b28df[_0x1f98('0x87')][_0x1f98('0x88')],'include':[{'model':db[_0x1f98('0x74')],'as':_0x1f98('0x89'),'attributes':_0x26d28c,'include':[{'model':db['CmCompany'],'as':_0x1f98('0x8a'),'attributes':['id','name']}]},{'model':db[_0x1f98('0x8b')],'as':'List','attributes':['id',_0x1f98('0x28')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x1f98('0x28'),_0x1f98('0x8c')]}]})[_0x1f98('0x26')](function(_0x388d39){if(_0x388d39){return _0x388d39[_0x1f98('0x58')]({'UserId':_0x3453da['user']['id']},{'transaction':_0x2b28df});}});});}})['then'](handleEntityNotFound(_0x138668,null))[_0x1f98('0x26')](respondWithResult(_0x138668,null))['catch'](handleError(_0x138668,null));};exports[_0x1f98('0x8d')]=function(_0x2f4c6d,_0x396dcb,_0x1bc958){return _0x2f4c6d[_0x1f98('0x67')][_0x1f98('0x75')]({'where':{'type':_0x1f98('0x8e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x1f98('0x26')](function(_0x12e4a3){if(_0x12e4a3&&_0x12e4a3['length']){return db[_0x1f98('0x2c')][_0x1f98('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1f98('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x1f98('0x2b')](_0x12e4a3,'id')},'$or':[{'UserId':null},{'UserId':_0x2f4c6d[_0x1f98('0x67')]['id']}]}});}return 0x0;})['then'](function(_0x1e1b19){if(!_[_0x1f98('0x70')](_0x1e1b19)&&_[_0x1f98('0x8f')](_0x1e1b19)){return _0x396dcb['status'](0xc8)[_0x1f98('0x21')]({'contacts':_0x1e1b19});}else{logger[_0x1f98('0x90')](_0x1f98('0x91'),_0x1f98('0x8d'),0x194,_0x1f98('0x92'));_0x396dcb[_0x1f98('0x1a')](0x194);}})[_0x1f98('0x52')](handleError(_0x396dcb,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index dc9588f..1b84e8c 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 _0xe292=['priority','api','moment','bluebird','request-promise','rimraf','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone'];(function(_0x39ccaf,_0x1ea3d4){var _0x41285a=function(_0xfd942a){while(--_0xfd942a){_0x39ccaf['push'](_0x39ccaf['shift']());}};_0x41285a(++_0x1ea3d4);}(_0xe292,0x115));var _0x2e29=function(_0x1ba212,_0x5a91cf){_0x1ba212=_0x1ba212-0x0;var _0x1b1b97=_0xe292[_0x1ba212];return _0x1b1b97;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2e29('0x0'));var moment=require(_0x2e29('0x1'));var BPromise=require(_0x2e29('0x2'));var rp=require(_0x2e29('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e29('0x4'));var config=require('../../config/environment');var attributes=require(_0x2e29('0x5'));module[_0x2e29('0x6')]=function(_0x4665de,_0x382bb0){return _0x4665de[_0x2e29('0x7')](_0x2e29('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x2e29('0x9')]},{'name':_0x2e29('0xa'),'fields':[_0x2e29('0xa')]},{'name':'priority','fields':[_0x2e29('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb9c=['phone','priority','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat'];(function(_0x4d7b74,_0x333f5a){var _0x64c562=function(_0x27a5b9){while(--_0x27a5b9){_0x4d7b74['push'](_0x4d7b74['shift']());}};_0x64c562(++_0x333f5a);}(_0xfb9c,0x1b5));var _0xcfb9=function(_0x4fca8e,_0x4c2162){_0x4fca8e=_0x4fca8e-0x0;var _0x23f51d=_0xfb9c[_0x4fca8e];return _0x23f51d;};'use strict';var _=require(_0xcfb9('0x0'));var util=require(_0xcfb9('0x1'));var logger=require('../../config/logger')(_0xcfb9('0x2'));var moment=require('moment');var BPromise=require(_0xcfb9('0x3'));var rp=require(_0xcfb9('0x4'));var fs=require('fs');var path=require(_0xcfb9('0x5'));var rimraf=require(_0xcfb9('0x6'));var config=require(_0xcfb9('0x7'));var attributes=require(_0xcfb9('0x8'));module[_0xcfb9('0x9')]=function(_0x334a3f,_0x104f96){return _0x334a3f[_0xcfb9('0xa')](_0xcfb9('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0xcfb9('0xc')]},{'name':_0xcfb9('0xd'),'fields':['phone']},{'name':'priority','fields':[_0xcfb9('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 f95e404..9db2cb4 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 _0x288b=['model','debug','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','limit','DestroyCmHopper','destroy','GetContactDialer','describe','transaction','LOCK','UPDATE','Contact','keys','name','voicePause','length','includes','push','UserId','update','all','MoveContactManagedDialer','sequelize','CmHopperFinal','literal','`scheduledat`\x20>=\x20','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','CmContact','order','GetContactRecallMe','GetCmHopper','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CmHopper','findAll','options','raw','where','include','map','attributes'];(function(_0x584a33,_0x560caf){var _0x53ded7=function(_0x16ba1b){while(--_0x16ba1b){_0x584a33['push'](_0x584a33['shift']());}};_0x53ded7(++_0x560caf);}(_0x288b,0x18b));var _0xb288=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x288b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb288('0x0'));var moment=require(_0xb288('0x1'));var BPromise=require(_0xb288('0x2'));var rs=require(_0xb288('0x3'));var fs=require('fs');var Redis=require(_0xb288('0x4'));var db=require(_0xb288('0x5'))['db'];var utils=require(_0xb288('0x6'));var logger=require(_0xb288('0x7'))(_0xb288('0x8'));var config=require(_0xb288('0x9'));var jayson=require(_0xb288('0xa'));var client=jayson[_0xb288('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cd75e,_0x2ad463,_0x1de6f2){return new BPromise(function(_0x2685e8,_0x513a63){return client[_0xb288('0xc')](_0x2cd75e,_0x1de6f2)[_0xb288('0xd')](function(_0x57fc54){logger[_0xb288('0xe')](_0xb288('0xf'),_0x2ad463,_0xb288('0x10'));logger['debug'](_0xb288('0x11'),_0x2ad463,_0xb288('0x10'),JSON[_0xb288('0x12')](_0x57fc54));if(_0x57fc54[_0xb288('0x13')]){if(_0x57fc54[_0xb288('0x13')][_0xb288('0x14')]===0x1f4){logger[_0xb288('0x13')]('CmHopper,\x20%s,\x20%s',_0x2ad463,_0x57fc54['error']['message']);return _0x513a63(_0x57fc54[_0xb288('0x13')][_0xb288('0x15')]);}logger['error'](_0xb288('0xf'),_0x2ad463,_0x57fc54[_0xb288('0x13')]['message']);return _0x2685e8(_0x57fc54[_0xb288('0x13')][_0xb288('0x15')]);}else{logger[_0xb288('0xe')]('CmHopper,\x20%s,\x20%s',_0x2ad463,_0xb288('0x10'));_0x2685e8(_0x57fc54['result'][_0xb288('0x15')]);}})[_0xb288('0x16')](function(_0x55d5ef){logger['error'](_0xb288('0xf'),_0x2ad463,_0x55d5ef);_0x513a63(_0x55d5ef);});});}exports['GetCmHopper']=function(_0x3fb0f6){var _0x36b305=this;return new Promise(function(_0x192c62,_0x5280c1){return db[_0xb288('0x17')][_0xb288('0x18')]({'raw':_0x3fb0f6['options']?_0x3fb0f6[_0xb288('0x19')][_0xb288('0x1a')]===undefined?!![]:![]:!![],'where':_0x3fb0f6['options']?_0x3fb0f6['options'][_0xb288('0x1b')]||null:null,'attributes':_0x3fb0f6[_0xb288('0x19')]?_0x3fb0f6['options']['attributes']||null:null,'limit':_0x3fb0f6[_0xb288('0x19')]?_0x3fb0f6[_0xb288('0x19')]['limit']||null:null,'include':_0x3fb0f6[_0xb288('0x19')]?_0x3fb0f6['options'][_0xb288('0x1c')]?_[_0xb288('0x1d')](_0x3fb0f6['options'][_0xb288('0x1c')],function(_0x4bc636){return{'model':db[_0x4bc636['model']],'as':_0x4bc636['as'],'attributes':_0x4bc636[_0xb288('0x1e')],'include':_0x4bc636['include']?_[_0xb288('0x1d')](_0x4bc636[_0xb288('0x1c')],function(_0x19c539){return{'model':db[_0x19c539[_0xb288('0x1f')]],'as':_0x19c539['as'],'attributes':_0x19c539[_0xb288('0x1e')],'include':_0x19c539[_0xb288('0x1c')]?_[_0xb288('0x1d')](_0x19c539[_0xb288('0x1c')],function(_0x4dff6b){return{'model':db[_0x4dff6b['model']],'as':_0x4dff6b['as'],'attributes':_0x4dff6b[_0xb288('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14b53a){logger[_0xb288('0xe')]('GetCmHopper',_0x3fb0f6);logger[_0xb288('0x20')]('GetCmHopper',_0x3fb0f6,JSON[_0xb288('0x12')](_0x14b53a));_0x192c62(_0x14b53a);})[_0xb288('0x16')](function(_0x928dd9){logger[_0xb288('0x13')]('GetCmHopper',_0x928dd9[_0xb288('0x15')],_0x3fb0f6);_0x5280c1(_0x36b305['error'](0x1f4,_0x928dd9['message']));});});};exports[_0xb288('0x21')]=function(_0x54c46e){var _0x5e9642=this;return new Promise(function(_0x3ec3eb,_0x451bb9){return db['CmHopper'][_0xb288('0x22')]({'raw':_0x54c46e[_0xb288('0x19')]?_0x54c46e[_0xb288('0x19')][_0xb288('0x1a')]===undefined?!![]:![]:!![],'where':_0x54c46e['options']?_0x54c46e[_0xb288('0x19')]['where']||null:null,'attributes':_0x54c46e[_0xb288('0x19')]?_0x54c46e['options'][_0xb288('0x1e')]||null:null,'include':_0x54c46e[_0xb288('0x19')]?_0x54c46e[_0xb288('0x19')][_0xb288('0x1c')]?_['map'](_0x54c46e[_0xb288('0x19')][_0xb288('0x1c')],function(_0x17d23f){return{'model':db[_0x17d23f['model']],'as':_0x17d23f['as'],'attributes':_0x17d23f[_0xb288('0x1e')],'include':_0x17d23f[_0xb288('0x1c')]?_[_0xb288('0x1d')](_0x17d23f['include'],function(_0x2231cc){return{'model':db[_0x2231cc[_0xb288('0x1f')]],'as':_0x2231cc['as'],'attributes':_0x2231cc['attributes'],'include':_0x2231cc['include']?_[_0xb288('0x1d')](_0x2231cc[_0xb288('0x1c')],function(_0x1a3744){return{'model':db[_0x1a3744[_0xb288('0x1f')]],'as':_0x1a3744['as'],'attributes':_0x1a3744[_0xb288('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17fc43){logger[_0xb288('0xe')](_0xb288('0x21'),_0x54c46e);logger['debug'](_0xb288('0x21'),_0x54c46e,JSON[_0xb288('0x12')](_0x17fc43));_0x3ec3eb(_0x17fc43);})['catch'](function(_0x6af638){logger['error'](_0xb288('0x21'),_0x6af638[_0xb288('0x15')],_0x54c46e);_0x451bb9(_0x5e9642[_0xb288('0x13')](0x1f4,_0x6af638[_0xb288('0x15')]));});});};exports[_0xb288('0x23')]=function(_0x5b6118){var _0x432992=this;return new Promise(function(_0x228030,_0x281b1d){return db[_0xb288('0x17')][_0xb288('0x24')](_0x5b6118[_0xb288('0x25')],{'raw':_0x5b6118['options']?_0x5b6118[_0xb288('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x219dd9){logger[_0xb288('0xe')]('CreateCmHopper',_0x5b6118);logger['debug'](_0xb288('0x23'),_0x5b6118,JSON[_0xb288('0x12')](_0x219dd9));_0x228030(_0x219dd9);})[_0xb288('0x16')](function(_0x5c72a7){logger[_0xb288('0x13')](_0xb288('0x23'),_0x5c72a7[_0xb288('0x15')],_0x5b6118);_0x281b1d(_0x432992['error'](0x1f4,_0x5c72a7[_0xb288('0x15')]));});});};exports[_0xb288('0x26')]=function(_0x381276){var _0x2d86e2=this;return new Promise(function(_0x132759,_0x5f26b9){return db['CmHopper']['update'](_0x381276[_0xb288('0x25')],{'raw':_0x381276[_0xb288('0x19')]?_0x381276['options'][_0xb288('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x381276[_0xb288('0x19')]?_0x381276[_0xb288('0x19')][_0xb288('0x1b')]||null:null,'attributes':_0x381276[_0xb288('0x19')]?_0x381276[_0xb288('0x19')]['attributes']||null:null,'limit':_0x381276[_0xb288('0x19')]?_0x381276[_0xb288('0x19')][_0xb288('0x27')]||null:null})[_0xb288('0xd')](function(_0x2f9504){logger['info'](_0xb288('0x26'),_0x381276);logger['debug']('UpdateCmHopper',_0x381276,JSON[_0xb288('0x12')](_0x2f9504));_0x132759(_0x2f9504);})[_0xb288('0x16')](function(_0x5f4640){logger['error'](_0xb288('0x26'),_0x5f4640[_0xb288('0x15')],_0x381276);_0x5f26b9(_0x2d86e2[_0xb288('0x13')](0x1f4,_0x5f4640['message']));});});};exports[_0xb288('0x28')]=function(_0x13ff73){var _0x3574a2=this;return new Promise(function(_0x2777e1,_0x100ce9){return db['CmHopper'][_0xb288('0x29')]({'where':_0x13ff73[_0xb288('0x19')]?_0x13ff73['options'][_0xb288('0x1b')]||null:null})['then'](function(_0xde8f59){logger[_0xb288('0xe')](_0xb288('0x28'),_0x13ff73);logger[_0xb288('0x20')]('DestroyCmHopper',_0x13ff73,JSON['stringify'](_0xde8f59));_0x2777e1(_0xde8f59);})[_0xb288('0x16')](function(_0x4bfdc6){logger[_0xb288('0x13')](_0xb288('0x28'),_0x4bfdc6['message'],_0x13ff73);_0x100ce9(_0x3574a2['error'](0x1f4,_0x4bfdc6['message']));});});};exports[_0xb288('0x2a')]=function(_0x5c0380){var _0x50a798=this;return new Promise(function(_0x440b17,_0x548d20){return db['CmContact'][_0xb288('0x2b')]()[_0xb288('0xd')](function(_0x360b8){return db['sequelize'][_0xb288('0x2c')](function(_0x1b3dfb){return db[_0xb288('0x17')]['findAll']({'where':_0x5c0380[_0xb288('0x19')]?_0x5c0380['options'][_0xb288('0x1b')]||null:null,'attributes':_0x5c0380['options']?_0x5c0380['options'][_0xb288('0x1e')]||null:null,'limit':_0x5c0380[_0xb288('0x19')]?_0x5c0380[_0xb288('0x19')][_0xb288('0x27')]||null:null,'order':_0x5c0380[_0xb288('0x19')]?_0x5c0380[_0xb288('0x19')]['order']||null:null,'transaction':_0x1b3dfb,'lock':_0x1b3dfb[_0xb288('0x2d')][_0xb288('0x2e')],'include':[{'model':db['CmContact'],'as':_0xb288('0x2f'),'attributes':_[_0xb288('0x30')](_0x360b8)},{'model':db['User'],'as':'Agent','attributes':['id',_0xb288('0x31'),_0xb288('0x32')]}]})[_0xb288('0xd')](function(_0x17a7ef){var _0x510400=[];var _0x43046d=[];for(var _0x3ffbda=0x0;_0x3ffbda<_0x17a7ef[_0xb288('0x33')];_0x3ffbda+=0x1){if(!_0x43046d[_0xb288('0x34')](_0x17a7ef[_0x3ffbda]['UserId'])){_0x43046d[_0xb288('0x35')](_0x17a7ef[_0x3ffbda][_0xb288('0x36')]);_0x510400['push'](_0x17a7ef[_0x3ffbda][_0xb288('0x37')](_0x5c0380['body'],{'transaction':_0x1b3dfb}));}}return BPromise[_0xb288('0x38')](_0x510400);});})[_0xb288('0xd')](function(_0x41310a){logger['info']('GetContactDialer',_0x5c0380);logger[_0xb288('0x20')](_0xb288('0x2a'),_0x5c0380,JSON['stringify'](_0x41310a));_0x440b17(_0x41310a);})[_0xb288('0x16')](function(_0x213d46){logger['error'](_0xb288('0x2a'),_0x213d46[_0xb288('0x15')],_0x5c0380);_0x548d20(_0x50a798[_0xb288('0x13')](0x1f4,_0x213d46[_0xb288('0x15')]));});});});};exports[_0xb288('0x39')]=function(_0x38418b){var _0xf96e63=this;return new Promise(function(_0x39b43b,_0x136950){return db[_0xb288('0x3a')]['transaction'](function(_0x2103f8){return db[_0xb288('0x3b')][_0xb288('0x24')](_0x38418b[_0xb288('0x25')],{'raw':_0x38418b[_0xb288('0x19')]?_0x38418b[_0xb288('0x19')]['raw']===undefined?!![]:![]:!![],'transaction':_0x2103f8})[_0xb288('0xd')](function(){return db[_0xb288('0x17')][_0xb288('0x29')]({'where':_0x38418b['options']?_0x38418b[_0xb288('0x19')][_0xb288('0x1b')]||null:null,'transaction':_0x2103f8});});})[_0xb288('0xd')](function(_0x2c4509){logger[_0xb288('0xe')](_0xb288('0x39'),_0x38418b);logger[_0xb288('0x20')](_0xb288('0x39'),_0x38418b,JSON['stringify'](_0x2c4509));_0x39b43b(_0x2c4509);})[_0xb288('0x16')](function(_0x473204){logger[_0xb288('0x13')](_0xb288('0x39'),_0x473204[_0xb288('0x15')],_0x38418b);_0x136950(_0xf96e63['error'](0x1f4,_0x473204[_0xb288('0x15')]));});});};exports['CountReScheduled']=function(_0x58cf28){var _0x3cd632=this;return new Promise(function(_0x2560c3,_0xd41320){return db[_0xb288('0x17')]['findAll']({'raw':_0x58cf28['options']?_0x58cf28[_0xb288('0x19')][_0xb288('0x1a')]===undefined?!![]:![]:!![],'where':_0x58cf28[_0xb288('0x19')]?_0x58cf28['options'][_0xb288('0x1b')]||null:null,'attributes':[[db[_0xb288('0x3a')]['fn']('COUNT',db[_0xb288('0x3a')]['fn']('IF',db[_0xb288('0x3a')][_0xb288('0x3c')](_0xb288('0x3d')+util['format'](_0xb288('0x3e'),moment()['format'](_0xb288('0x3f')))+_0xb288('0x40')))),_0xb288('0x41')]]})[_0xb288('0xd')](function(_0x3e59d1){logger[_0xb288('0xe')]('CountReScheduled',_0x58cf28);logger[_0xb288('0x20')](_0xb288('0x42'),_0x58cf28,JSON[_0xb288('0x12')](_0x3e59d1));_0x2560c3(_0x3e59d1);})[_0xb288('0x16')](function(_0x3282bb){logger[_0xb288('0x13')]('CountReScheduled',_0x3282bb[_0xb288('0x15')],_0x58cf28);_0xd41320(_0x3cd632[_0xb288('0x13')](0x1f4,_0x3282bb[_0xb288('0x15')]));});});};exports['GetContactRecallMe']=function(_0x51df07){var _0x6ba5f1=this;return new Promise(function(_0x39d5e4,_0x57a865){return db[_0xb288('0x43')]['describe']()[_0xb288('0xd')](function(_0x46720a){return db[_0xb288('0x3a')]['transaction'](function(_0x4b0058){return db[_0xb288('0x17')][_0xb288('0x18')]({'where':_0x51df07[_0xb288('0x19')]?_0x51df07[_0xb288('0x19')][_0xb288('0x1b')]||null:null,'attributes':_0x51df07[_0xb288('0x19')]?_0x51df07[_0xb288('0x19')][_0xb288('0x1e')]||null:null,'limit':0x1,'order':_0x51df07['options']?_0x51df07[_0xb288('0x19')][_0xb288('0x44')]||null:null,'group':db[_0xb288('0x17')][_0xb288('0x36')],'transaction':_0x4b0058,'lock':_0x4b0058[_0xb288('0x2d')][_0xb288('0x2e')],'include':_0x51df07[_0xb288('0x19')]?_0x51df07[_0xb288('0x19')]['include']?_[_0xb288('0x1d')](_0x51df07[_0xb288('0x19')][_0xb288('0x1c')],function(_0x8d39b1){return{'model':db[_0x8d39b1[_0xb288('0x1f')]],'as':_0x8d39b1['as'],'attributes':_0x8d39b1['attributes'],'include':_0x8d39b1[_0xb288('0x1c')]?_[_0xb288('0x1d')](_0x8d39b1['include'],function(_0x10f947){return{'model':db[_0x10f947[_0xb288('0x1f')]],'as':_0x10f947['as'],'attributes':_0x10f947[_0xb288('0x1e')],'include':_0x10f947[_0xb288('0x1c')]?_[_0xb288('0x1d')](_0x10f947['include'],function(_0x17b706){return{'model':db[_0x17b706[_0xb288('0x1f')]],'as':_0x17b706['as'],'attributes':_0x17b706[_0xb288('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d29df){var _0x1e074d=[];for(var _0x11367c=0x0;_0x11367c<_0x4d29df['length'];_0x11367c+=0x1){_0x1e074d[_0xb288('0x35')](_0x4d29df[_0x11367c][_0xb288('0x37')](_0x51df07[_0xb288('0x25')],{'transaction':_0x4b0058}));}return BPromise[_0xb288('0x38')](_0x1e074d);});})[_0xb288('0xd')](function(_0x17fc0c){logger['info'](_0xb288('0x45'),_0x51df07);logger[_0xb288('0x20')](_0xb288('0x45'),_0x51df07,JSON[_0xb288('0x12')](_0x17fc0c));_0x39d5e4(_0x17fc0c);})[_0xb288('0x16')](function(_0x27990d){logger['error'](_0xb288('0x45'),_0x27990d['message'],_0x51df07);_0x57a865(_0x6ba5f1['error'](0x1f4,_0x27990d[_0xb288('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x545455){var _0x422386=this;return new Promise(function(_0x4c0403,_0x18ea74){db[_0xb288('0x43')]['describe']()[_0xb288('0xd')](function(_0x609b85){return db[_0xb288('0x17')][_0xb288('0x18')]({'raw':_0x545455[_0xb288('0x19')]?_0x545455[_0xb288('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x545455['options']?_0x545455[_0xb288('0x19')]['where']||null:null,'attributes':_0x545455['options']?_0x545455[_0xb288('0x19')][_0xb288('0x1e')]||null:null,'limit':_0x545455[_0xb288('0x19')]?_0x545455[_0xb288('0x19')]['limit']||null:null,'include':_0x545455[_0xb288('0x19')]?_0x545455[_0xb288('0x19')][_0xb288('0x1c')]?_[_0xb288('0x1d')](_0x545455['options'][_0xb288('0x1c')],function(_0x3f1bb1){return{'model':db[_0x3f1bb1[_0xb288('0x1f')]],'as':_0x3f1bb1['as'],'attributes':_0x3f1bb1['as']==='Contact'?_[_0xb288('0x30')](_0x609b85):_0x3f1bb1[_0xb288('0x1e')],'include':_0x3f1bb1[_0xb288('0x1c')]?_['map'](_0x3f1bb1[_0xb288('0x1c')],function(_0x261112){return{'model':db[_0x261112[_0xb288('0x1f')]],'as':_0x261112['as'],'attributes':_0x261112['attributes'],'include':_0x261112[_0xb288('0x1c')]?_[_0xb288('0x1d')](_0x261112[_0xb288('0x1c')],function(_0x313c31){return{'model':db[_0x313c31['model']],'as':_0x313c31['as'],'attributes':_0x313c31[_0xb288('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb288('0xd')](function(_0x5f57e8){logger[_0xb288('0xe')]('GetCmHopper',_0x545455);logger[_0xb288('0x20')](_0xb288('0x46'),_0x545455,JSON[_0xb288('0x12')](_0x5f57e8));_0x4c0403(_0x5f57e8);})[_0xb288('0x16')](function(_0x5a7584){logger[_0xb288('0x13')]('GetCmHopper',_0x5a7584[_0xb288('0x15')],_0x545455);_0x18ea74(_0x422386[_0xb288('0x13')](0x1f4,_0x5a7584[_0xb288('0x15')]));});});});}; \ No newline at end of file +var _0xd86d=['body','DestroyCmHopper','destroy','CmContact','describe','transaction','limit','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','UserId','GetContactDialer','CmHopperFinal','create','MoveContactManagedDialer','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','all','GetContactRecallMe','GetCmHopperPreview','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','model','map','debug','ShowCmHopper','find','then','CreateCmHopper','UpdateCmHopper','update'];(function(_0x2b3b26,_0x3e5008){var _0x18e797=function(_0x55e01e){while(--_0x55e01e){_0x2b3b26['push'](_0x2b3b26['shift']());}};_0x18e797(++_0x3e5008);}(_0xd86d,0xfb));var _0xdd86=function(_0x511a99,_0x21e00a){_0x511a99=_0x511a99-0x0;var _0x52ed04=_0xd86d[_0x511a99];return _0x52ed04;};'use strict';var _=require(_0xdd86('0x0'));var util=require('util');var moment=require(_0xdd86('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd86('0x2'));var fs=require('fs');var Redis=require(_0xdd86('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdd86('0x4'))(_0xdd86('0x5'));var config=require(_0xdd86('0x6'));var jayson=require(_0xdd86('0x7'));var client=jayson[_0xdd86('0x8')][_0xdd86('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eb626,_0x348ba3,_0x5c7102){return new BPromise(function(_0x161cac,_0x25550b){return client[_0xdd86('0xa')](_0x2eb626,_0x5c7102)['then'](function(_0x54a9cc){logger['info'](_0xdd86('0xb'),_0x348ba3,'request\x20sent');logger['debug'](_0xdd86('0xc'),_0x348ba3,_0xdd86('0xd'),JSON[_0xdd86('0xe')](_0x54a9cc));if(_0x54a9cc['error']){if(_0x54a9cc[_0xdd86('0xf')][_0xdd86('0x10')]===0x1f4){logger[_0xdd86('0xf')]('CmHopper,\x20%s,\x20%s',_0x348ba3,_0x54a9cc['error'][_0xdd86('0x11')]);return _0x25550b(_0x54a9cc[_0xdd86('0xf')][_0xdd86('0x11')]);}logger[_0xdd86('0xf')](_0xdd86('0xb'),_0x348ba3,_0x54a9cc[_0xdd86('0xf')][_0xdd86('0x11')]);return _0x161cac(_0x54a9cc[_0xdd86('0xf')]['message']);}else{logger[_0xdd86('0x12')](_0xdd86('0xb'),_0x348ba3,_0xdd86('0xd'));_0x161cac(_0x54a9cc['result'][_0xdd86('0x11')]);}})[_0xdd86('0x13')](function(_0x369c8d){logger['error'](_0xdd86('0xb'),_0x348ba3,_0x369c8d);_0x25550b(_0x369c8d);});});}exports[_0xdd86('0x14')]=function(_0x344979){var _0x5279d7=this;return new Promise(function(_0x5df1a1,_0xccc3ab){return db[_0xdd86('0x15')][_0xdd86('0x16')]({'raw':_0x344979[_0xdd86('0x17')]?_0x344979[_0xdd86('0x17')][_0xdd86('0x18')]===undefined?!![]:![]:!![],'where':_0x344979[_0xdd86('0x17')]?_0x344979['options'][_0xdd86('0x19')]||null:null,'attributes':_0x344979[_0xdd86('0x17')]?_0x344979[_0xdd86('0x17')][_0xdd86('0x1a')]||null:null,'limit':_0x344979[_0xdd86('0x17')]?_0x344979[_0xdd86('0x17')]['limit']||null:null,'include':_0x344979['options']?_0x344979[_0xdd86('0x17')][_0xdd86('0x1b')]?_['map'](_0x344979[_0xdd86('0x17')]['include'],function(_0x599023){return{'model':db[_0x599023[_0xdd86('0x1c')]],'as':_0x599023['as'],'attributes':_0x599023[_0xdd86('0x1a')],'include':_0x599023[_0xdd86('0x1b')]?_['map'](_0x599023[_0xdd86('0x1b')],function(_0x218cdc){return{'model':db[_0x218cdc[_0xdd86('0x1c')]],'as':_0x218cdc['as'],'attributes':_0x218cdc[_0xdd86('0x1a')],'include':_0x218cdc['include']?_[_0xdd86('0x1d')](_0x218cdc['include'],function(_0x104ed1){return{'model':db[_0x104ed1[_0xdd86('0x1c')]],'as':_0x104ed1['as'],'attributes':_0x104ed1[_0xdd86('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e096e){logger[_0xdd86('0x12')]('GetCmHopper',_0x344979);logger[_0xdd86('0x1e')](_0xdd86('0x14'),_0x344979,JSON[_0xdd86('0xe')](_0x3e096e));_0x5df1a1(_0x3e096e);})[_0xdd86('0x13')](function(_0x48f8d5){logger[_0xdd86('0xf')](_0xdd86('0x14'),_0x48f8d5['message'],_0x344979);_0xccc3ab(_0x5279d7['error'](0x1f4,_0x48f8d5[_0xdd86('0x11')]));});});};exports[_0xdd86('0x1f')]=function(_0x3e197f){var _0x18d1ac=this;return new Promise(function(_0x344ec2,_0x5f1221){return db[_0xdd86('0x15')][_0xdd86('0x20')]({'raw':_0x3e197f[_0xdd86('0x17')]?_0x3e197f[_0xdd86('0x17')][_0xdd86('0x18')]===undefined?!![]:![]:!![],'where':_0x3e197f[_0xdd86('0x17')]?_0x3e197f[_0xdd86('0x17')][_0xdd86('0x19')]||null:null,'attributes':_0x3e197f['options']?_0x3e197f['options']['attributes']||null:null,'include':_0x3e197f[_0xdd86('0x17')]?_0x3e197f[_0xdd86('0x17')][_0xdd86('0x1b')]?_['map'](_0x3e197f[_0xdd86('0x17')][_0xdd86('0x1b')],function(_0x637af7){return{'model':db[_0x637af7[_0xdd86('0x1c')]],'as':_0x637af7['as'],'attributes':_0x637af7[_0xdd86('0x1a')],'include':_0x637af7[_0xdd86('0x1b')]?_[_0xdd86('0x1d')](_0x637af7['include'],function(_0x233a4a){return{'model':db[_0x233a4a[_0xdd86('0x1c')]],'as':_0x233a4a['as'],'attributes':_0x233a4a[_0xdd86('0x1a')],'include':_0x233a4a[_0xdd86('0x1b')]?_['map'](_0x233a4a[_0xdd86('0x1b')],function(_0x27f0ba){return{'model':db[_0x27f0ba[_0xdd86('0x1c')]],'as':_0x27f0ba['as'],'attributes':_0x27f0ba[_0xdd86('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdd86('0x21')](function(_0x384f85){logger[_0xdd86('0x12')]('ShowCmHopper',_0x3e197f);logger[_0xdd86('0x1e')](_0xdd86('0x1f'),_0x3e197f,JSON[_0xdd86('0xe')](_0x384f85));_0x344ec2(_0x384f85);})[_0xdd86('0x13')](function(_0x93bf36){logger[_0xdd86('0xf')](_0xdd86('0x1f'),_0x93bf36['message'],_0x3e197f);_0x5f1221(_0x18d1ac[_0xdd86('0xf')](0x1f4,_0x93bf36[_0xdd86('0x11')]));});});};exports[_0xdd86('0x22')]=function(_0x40a3fa){var _0x25b1f8=this;return new Promise(function(_0x20b173,_0x536f02){return db[_0xdd86('0x15')]['create'](_0x40a3fa['body'],{'raw':_0x40a3fa[_0xdd86('0x17')]?_0x40a3fa[_0xdd86('0x17')][_0xdd86('0x18')]===undefined?!![]:![]:!![]})[_0xdd86('0x21')](function(_0x5e77a8){logger[_0xdd86('0x12')](_0xdd86('0x22'),_0x40a3fa);logger[_0xdd86('0x1e')]('CreateCmHopper',_0x40a3fa,JSON[_0xdd86('0xe')](_0x5e77a8));_0x20b173(_0x5e77a8);})['catch'](function(_0x59d53d){logger[_0xdd86('0xf')]('CreateCmHopper',_0x59d53d['message'],_0x40a3fa);_0x536f02(_0x25b1f8[_0xdd86('0xf')](0x1f4,_0x59d53d[_0xdd86('0x11')]));});});};exports[_0xdd86('0x23')]=function(_0xd2ac23){var _0x21dfae=this;return new Promise(function(_0x26286f,_0x22009d){return db['CmHopper'][_0xdd86('0x24')](_0xd2ac23[_0xdd86('0x25')],{'raw':_0xd2ac23[_0xdd86('0x17')]?_0xd2ac23[_0xdd86('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd2ac23['options']?_0xd2ac23[_0xdd86('0x17')][_0xdd86('0x19')]||null:null,'attributes':_0xd2ac23[_0xdd86('0x17')]?_0xd2ac23[_0xdd86('0x17')][_0xdd86('0x1a')]||null:null,'limit':_0xd2ac23[_0xdd86('0x17')]?_0xd2ac23['options']['limit']||null:null})[_0xdd86('0x21')](function(_0x16d5c0){logger[_0xdd86('0x12')](_0xdd86('0x23'),_0xd2ac23);logger[_0xdd86('0x1e')]('UpdateCmHopper',_0xd2ac23,JSON['stringify'](_0x16d5c0));_0x26286f(_0x16d5c0);})[_0xdd86('0x13')](function(_0x31dafb){logger['error'](_0xdd86('0x23'),_0x31dafb[_0xdd86('0x11')],_0xd2ac23);_0x22009d(_0x21dfae[_0xdd86('0xf')](0x1f4,_0x31dafb[_0xdd86('0x11')]));});});};exports[_0xdd86('0x26')]=function(_0x45980b){var _0x40f4a2=this;return new Promise(function(_0x2b7752,_0x567797){return db[_0xdd86('0x15')][_0xdd86('0x27')]({'where':_0x45980b[_0xdd86('0x17')]?_0x45980b[_0xdd86('0x17')][_0xdd86('0x19')]||null:null})[_0xdd86('0x21')](function(_0x4e630b){logger[_0xdd86('0x12')](_0xdd86('0x26'),_0x45980b);logger[_0xdd86('0x1e')](_0xdd86('0x26'),_0x45980b,JSON[_0xdd86('0xe')](_0x4e630b));_0x2b7752(_0x4e630b);})['catch'](function(_0x242932){logger['error'](_0xdd86('0x26'),_0x242932[_0xdd86('0x11')],_0x45980b);_0x567797(_0x40f4a2[_0xdd86('0xf')](0x1f4,_0x242932['message']));});});};exports['GetContactDialer']=function(_0x53df3b){var _0x4074d1=this;return new Promise(function(_0x28ee2c,_0x27d5a7){return db[_0xdd86('0x28')][_0xdd86('0x29')]()['then'](function(_0x21d279){return db['sequelize'][_0xdd86('0x2a')](function(_0x34559c){return db[_0xdd86('0x15')][_0xdd86('0x16')]({'where':_0x53df3b[_0xdd86('0x17')]?_0x53df3b['options'][_0xdd86('0x19')]||null:null,'attributes':_0x53df3b[_0xdd86('0x17')]?_0x53df3b['options']['attributes']||null:null,'limit':_0x53df3b[_0xdd86('0x17')]?_0x53df3b['options'][_0xdd86('0x2b')]||null:null,'order':_0x53df3b[_0xdd86('0x17')]?_0x53df3b[_0xdd86('0x17')][_0xdd86('0x2c')]||null:null,'transaction':_0x34559c,'lock':_0x34559c[_0xdd86('0x2d')][_0xdd86('0x2e')],'include':[{'model':db[_0xdd86('0x28')],'as':_0xdd86('0x2f'),'attributes':_[_0xdd86('0x30')](_0x21d279)},{'model':db[_0xdd86('0x31')],'as':_0xdd86('0x32'),'attributes':['id',_0xdd86('0x33'),_0xdd86('0x34')]}]})[_0xdd86('0x21')](function(_0x1fb82b){var _0x96b5df=[];var _0x2035bf=[];for(var _0x54956d=0x0;_0x54956d<_0x1fb82b[_0xdd86('0x35')];_0x54956d+=0x1){if(!_0x2035bf['includes'](_0x1fb82b[_0x54956d]['UserId'])){_0x2035bf[_0xdd86('0x36')](_0x1fb82b[_0x54956d][_0xdd86('0x37')]);_0x96b5df[_0xdd86('0x36')](_0x1fb82b[_0x54956d]['update'](_0x53df3b[_0xdd86('0x25')],{'transaction':_0x34559c}));}}return BPromise['all'](_0x96b5df);});})[_0xdd86('0x21')](function(_0x2d7e65){logger[_0xdd86('0x12')](_0xdd86('0x38'),_0x53df3b);logger[_0xdd86('0x1e')]('GetContactDialer',_0x53df3b,JSON[_0xdd86('0xe')](_0x2d7e65));_0x28ee2c(_0x2d7e65);})[_0xdd86('0x13')](function(_0x23875e){logger[_0xdd86('0xf')](_0xdd86('0x38'),_0x23875e['message'],_0x53df3b);_0x27d5a7(_0x4074d1[_0xdd86('0xf')](0x1f4,_0x23875e[_0xdd86('0x11')]));});});});};exports['MoveContactManagedDialer']=function(_0x213ce3){var _0x116ab1=this;return new Promise(function(_0xf8224b,_0x8ff64d){return db['sequelize'][_0xdd86('0x2a')](function(_0x56ee75){return db[_0xdd86('0x39')][_0xdd86('0x3a')](_0x213ce3[_0xdd86('0x25')],{'raw':_0x213ce3[_0xdd86('0x17')]?_0x213ce3['options'][_0xdd86('0x18')]===undefined?!![]:![]:!![],'transaction':_0x56ee75})[_0xdd86('0x21')](function(){return db[_0xdd86('0x15')][_0xdd86('0x27')]({'where':_0x213ce3[_0xdd86('0x17')]?_0x213ce3[_0xdd86('0x17')][_0xdd86('0x19')]||null:null,'transaction':_0x56ee75});});})[_0xdd86('0x21')](function(_0x5707a6){logger[_0xdd86('0x12')](_0xdd86('0x3b'),_0x213ce3);logger[_0xdd86('0x1e')](_0xdd86('0x3b'),_0x213ce3,JSON[_0xdd86('0xe')](_0x5707a6));_0xf8224b(_0x5707a6);})['catch'](function(_0x1a3bc9){logger[_0xdd86('0xf')](_0xdd86('0x3b'),_0x1a3bc9[_0xdd86('0x11')],_0x213ce3);_0x8ff64d(_0x116ab1[_0xdd86('0xf')](0x1f4,_0x1a3bc9[_0xdd86('0x11')]));});});};exports['CountReScheduled']=function(_0x36278c){var _0x1f6bf2=this;return new Promise(function(_0xabae46,_0x400df0){return db[_0xdd86('0x15')][_0xdd86('0x16')]({'raw':_0x36278c['options']?_0x36278c['options'][_0xdd86('0x18')]===undefined?!![]:![]:!![],'where':_0x36278c['options']?_0x36278c[_0xdd86('0x17')][_0xdd86('0x19')]||null:null,'attributes':[[db[_0xdd86('0x3c')]['fn'](_0xdd86('0x3d'),db[_0xdd86('0x3c')]['fn']('IF',db['sequelize'][_0xdd86('0x3e')](_0xdd86('0x3f')+util[_0xdd86('0x40')](_0xdd86('0x41'),moment()[_0xdd86('0x40')](_0xdd86('0x42')))+_0xdd86('0x43')))),'contactsRescheduled']]})[_0xdd86('0x21')](function(_0x118932){logger[_0xdd86('0x12')]('CountReScheduled',_0x36278c);logger[_0xdd86('0x1e')](_0xdd86('0x44'),_0x36278c,JSON[_0xdd86('0xe')](_0x118932));_0xabae46(_0x118932);})[_0xdd86('0x13')](function(_0x190a3e){logger[_0xdd86('0xf')](_0xdd86('0x44'),_0x190a3e['message'],_0x36278c);_0x400df0(_0x1f6bf2[_0xdd86('0xf')](0x1f4,_0x190a3e['message']));});});};exports['GetContactRecallMe']=function(_0x65ecd4){var _0x56391a=this;return new Promise(function(_0x4c8a83,_0x1e4e5b){return db[_0xdd86('0x28')][_0xdd86('0x29')]()[_0xdd86('0x21')](function(_0x2bf722){return db[_0xdd86('0x3c')][_0xdd86('0x2a')](function(_0x4df701){return db['CmHopper']['findAll']({'where':_0x65ecd4['options']?_0x65ecd4['options'][_0xdd86('0x19')]||null:null,'attributes':_0x65ecd4['options']?_0x65ecd4[_0xdd86('0x17')][_0xdd86('0x1a')]||null:null,'limit':0x1,'order':_0x65ecd4[_0xdd86('0x17')]?_0x65ecd4['options'][_0xdd86('0x2c')]||null:null,'group':db[_0xdd86('0x15')]['UserId'],'transaction':_0x4df701,'lock':_0x4df701[_0xdd86('0x2d')][_0xdd86('0x2e')],'include':_0x65ecd4[_0xdd86('0x17')]?_0x65ecd4['options'][_0xdd86('0x1b')]?_[_0xdd86('0x1d')](_0x65ecd4['options'][_0xdd86('0x1b')],function(_0x227e8c){return{'model':db[_0x227e8c[_0xdd86('0x1c')]],'as':_0x227e8c['as'],'attributes':_0x227e8c[_0xdd86('0x1a')],'include':_0x227e8c[_0xdd86('0x1b')]?_[_0xdd86('0x1d')](_0x227e8c[_0xdd86('0x1b')],function(_0x54686c){return{'model':db[_0x54686c[_0xdd86('0x1c')]],'as':_0x54686c['as'],'attributes':_0x54686c['attributes'],'include':_0x54686c[_0xdd86('0x1b')]?_[_0xdd86('0x1d')](_0x54686c[_0xdd86('0x1b')],function(_0x2a6094){return{'model':db[_0x2a6094[_0xdd86('0x1c')]],'as':_0x2a6094['as'],'attributes':_0x2a6094[_0xdd86('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a5e10){var _0x31688a=[];for(var _0xb25db8=0x0;_0xb25db8<_0x3a5e10['length'];_0xb25db8+=0x1){_0x31688a[_0xdd86('0x36')](_0x3a5e10[_0xb25db8]['update'](_0x65ecd4['body'],{'transaction':_0x4df701}));}return BPromise[_0xdd86('0x45')](_0x31688a);});})[_0xdd86('0x21')](function(_0x5bf4df){logger[_0xdd86('0x12')](_0xdd86('0x46'),_0x65ecd4);logger[_0xdd86('0x1e')]('GetContactRecallMe',_0x65ecd4,JSON[_0xdd86('0xe')](_0x5bf4df));_0x4c8a83(_0x5bf4df);})[_0xdd86('0x13')](function(_0x11c7c4){logger['error'](_0xdd86('0x46'),_0x11c7c4[_0xdd86('0x11')],_0x65ecd4);_0x1e4e5b(_0x56391a[_0xdd86('0xf')](0x1f4,_0x11c7c4[_0xdd86('0x11')]));});});});};exports[_0xdd86('0x47')]=function(_0x41f618){var _0x19784d=this;return new Promise(function(_0x4f3b6f,_0x13d183){db[_0xdd86('0x28')]['describe']()['then'](function(_0xbfce97){return db[_0xdd86('0x15')][_0xdd86('0x16')]({'raw':_0x41f618[_0xdd86('0x17')]?_0x41f618['options'][_0xdd86('0x18')]===undefined?!![]:![]:!![],'where':_0x41f618['options']?_0x41f618[_0xdd86('0x17')]['where']||null:null,'attributes':_0x41f618[_0xdd86('0x17')]?_0x41f618[_0xdd86('0x17')][_0xdd86('0x1a')]||null:null,'limit':_0x41f618[_0xdd86('0x17')]?_0x41f618[_0xdd86('0x17')][_0xdd86('0x2b')]||null:null,'include':_0x41f618[_0xdd86('0x17')]?_0x41f618['options'][_0xdd86('0x1b')]?_[_0xdd86('0x1d')](_0x41f618[_0xdd86('0x17')][_0xdd86('0x1b')],function(_0x5cff1c){return{'model':db[_0x5cff1c['model']],'as':_0x5cff1c['as'],'attributes':_0x5cff1c['as']===_0xdd86('0x2f')?_[_0xdd86('0x30')](_0xbfce97):_0x5cff1c[_0xdd86('0x1a')],'include':_0x5cff1c['include']?_[_0xdd86('0x1d')](_0x5cff1c[_0xdd86('0x1b')],function(_0x356cc4){return{'model':db[_0x356cc4[_0xdd86('0x1c')]],'as':_0x356cc4['as'],'attributes':_0x356cc4[_0xdd86('0x1a')],'include':_0x356cc4[_0xdd86('0x1b')]?_['map'](_0x356cc4[_0xdd86('0x1b')],function(_0xe4ccf6){return{'model':db[_0xe4ccf6[_0xdd86('0x1c')]],'as':_0xe4ccf6['as'],'attributes':_0xe4ccf6[_0xdd86('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdd86('0x21')](function(_0x909aee){logger[_0xdd86('0x12')](_0xdd86('0x14'),_0x41f618);logger['debug'](_0xdd86('0x14'),_0x41f618,JSON['stringify'](_0x909aee));_0x4f3b6f(_0x909aee);})[_0xdd86('0x13')](function(_0x1adbdc){logger[_0xdd86('0xf')]('GetCmHopper',_0x1adbdc[_0xdd86('0x11')],_0x41f618);_0x13d183(_0x19784d[_0xdd86('0xf')](0x1f4,_0x1adbdc[_0xdd86('0x11')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 508846a..9c25e3d 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 _0xb2ff=['describe','/opencontacts','post','create','/preview','getPreview','put','/:id','update','delete','exports','multer','util','connect-timeout','../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe'];(function(_0x3d7fb5,_0x16eb5c){var _0x3a9642=function(_0x3f5b2a){while(--_0x3f5b2a){_0x3d7fb5['push'](_0x3d7fb5['shift']());}};_0x3a9642(++_0x16eb5c);}(_0xb2ff,0x123));var _0xfb2f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb2ff[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var path=require('path');var timeout=require(_0xfb2f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfb2f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfb2f('0x4'));var controller=require(_0xfb2f('0x5'));router[_0xfb2f('0x6')]('/',auth[_0xfb2f('0x7')](),controller['index']);router['get'](_0xfb2f('0x8'),auth['isAuthenticated'](),controller[_0xfb2f('0x9')]);router[_0xfb2f('0x6')](_0xfb2f('0xa'),auth[_0xfb2f('0x7')](),controller['getOpenContacts']);router[_0xfb2f('0x6')]('/:id',auth[_0xfb2f('0x7')](),controller['show']);router[_0xfb2f('0xb')]('/',auth[_0xfb2f('0x7')](),controller[_0xfb2f('0xc')]);router[_0xfb2f('0xb')](_0xfb2f('0xd'),auth['isAuthenticated'](),controller[_0xfb2f('0xe')]);router[_0xfb2f('0xf')](_0xfb2f('0x10'),auth[_0xfb2f('0x7')](),controller[_0xfb2f('0x11')]);router[_0xfb2f('0x12')](_0xfb2f('0x10'),auth[_0xfb2f('0x7')](),controller['destroy']);module[_0xfb2f('0x13')]=router; \ No newline at end of file +var _0xb717=['fs-extra','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','describe','getOpenContacts','/:id','show','post','getPreview','put','delete','destroy','multer','path','express','Router'];(function(_0x3aa8d7,_0x14bacf){var _0x41711e=function(_0x3d1301){while(--_0x3d1301){_0x3aa8d7['push'](_0x3aa8d7['shift']());}};_0x41711e(++_0x14bacf);}(_0xb717,0x1b4));var _0x7b71=function(_0x4716f8,_0x51b0c3){_0x4716f8=_0x4716f8-0x0;var _0x3f6f3=_0xb717[_0x4716f8];return _0x3f6f3;};'use strict';var multer=require(_0x7b71('0x0'));var util=require('util');var path=require(_0x7b71('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b71('0x2'));var router=express[_0x7b71('0x3')]();var fs_extra=require(_0x7b71('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7b71('0x5'));var config=require(_0x7b71('0x6'));var controller=require(_0x7b71('0x7'));router[_0x7b71('0x8')]('/',auth[_0x7b71('0x9')](),controller['index']);router[_0x7b71('0x8')](_0x7b71('0xa'),auth[_0x7b71('0x9')](),controller[_0x7b71('0xb')]);router[_0x7b71('0x8')]('/opencontacts',auth[_0x7b71('0x9')](),controller[_0x7b71('0xc')]);router['get'](_0x7b71('0xd'),auth[_0x7b71('0x9')](),controller[_0x7b71('0xe')]);router['post']('/',auth[_0x7b71('0x9')](),controller['create']);router[_0x7b71('0xf')]('/preview',auth[_0x7b71('0x9')](),controller[_0x7b71('0x10')]);router[_0x7b71('0x11')](_0x7b71('0xd'),auth[_0x7b71('0x9')](),controller['update']);router[_0x7b71('0x12')]('/:id',auth[_0x7b71('0x9')](),controller[_0x7b71('0x13')]);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 f1d8127..0c893dc 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 _0xc99a=['exports','INTEGER','contactListQueue','moment','sequelize'];(function(_0x5d0e2c,_0x31b210){var _0x1d17f3=function(_0x4d18e9){while(--_0x4d18e9){_0x5d0e2c['push'](_0x5d0e2c['shift']());}};_0x1d17f3(++_0x31b210);}(_0xc99a,0x94));var _0xac99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc99a[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xac99('0x0'));var Sequelize=require(_0xac99('0x1'));module[_0xac99('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xac99('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xac99('0x3')],'unique':_0xac99('0x4')},'VoiceQueueId':{'type':Sequelize[_0xac99('0x3')],'unique':_0xac99('0x4')}}; \ No newline at end of file +var _0x57dd=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x43ead2,_0x4e79f0){var _0x4b7c63=function(_0xb439f){while(--_0xb439f){_0x43ead2['push'](_0x43ead2['shift']());}};_0x4b7c63(++_0x4e79f0);}(_0x57dd,0x70));var _0xd57d=function(_0x37f289,_0x4acd63){_0x37f289=_0x37f289-0x0;var _0x461ce6=_0x57dd[_0x37f289];return _0x461ce6;};'use strict';var moment=require(_0xd57d('0x0'));var Sequelize=require(_0xd57d('0x1'));module[_0xd57d('0x2')]={'phone':{'type':Sequelize[_0xd57d('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd57d('0x4')],'unique':_0xd57d('0x5')},'ListId':{'type':Sequelize[_0xd57d('0x4')],'unique':_0xd57d('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 5747da0..1661000 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 _0x84d7=['include','find','body','describe','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params'];(function(_0x5a1cb1,_0x3aefc7){var _0x526a4e=function(_0x128487){while(--_0x128487){_0x5a1cb1['push'](_0x5a1cb1['shift']());}};_0x526a4e(++_0x3aefc7);}(_0x84d7,0x1c0));var _0x784d=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x84d7[_0x55abd9];return _0x3e5669;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x784d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x784d('0x1'));var moment=require(_0x784d('0x2'));var BPromise=require(_0x784d('0x3'));var Mustache=require(_0x784d('0x4'));var util=require('util');var path=require(_0x784d('0x5'));var sox=require(_0x784d('0x6'));var csv=require(_0x784d('0x7'));var ejs=require(_0x784d('0x8'));var fs=require('fs');var fs_extra=require(_0x784d('0x9'));var _=require(_0x784d('0xa'));var squel=require(_0x784d('0xb'));var crypto=require(_0x784d('0xc'));var jsforce=require(_0x784d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x784d('0x7'));var querystring=require(_0x784d('0xe'));var Papa=require(_0x784d('0xf'));var Redis=require(_0x784d('0x10'));var authService=require(_0x784d('0x11'));var qs=require(_0x784d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x784d('0x13'));var utils=require(_0x784d('0x14'));var config=require(_0x784d('0x15'));var licenseUtil=require(_0x784d('0x16'));var db=require(_0x784d('0x17'))['db'];function respondWithStatusCode(_0x49db31,_0x10ca49){_0x10ca49=_0x10ca49||0xcc;return function(_0x4c6f19){if(_0x4c6f19){return _0x49db31[_0x784d('0x18')](_0x10ca49);}return _0x49db31[_0x784d('0x19')](_0x10ca49)[_0x784d('0x1a')]();};}function respondWithResult(_0x43a71a,_0xf7d093){_0xf7d093=_0xf7d093||0xc8;return function(_0xac096){if(_0xac096){return _0x43a71a['status'](_0xf7d093)[_0x784d('0x1b')](_0xac096);}};}function respondWithFilteredResult(_0xf6591b,_0x4fd26c){return function(_0x1bca1e){if(_0x1bca1e){var _0x10d091=_0x1bca1e['count'],_0x19bd52=_0x4fd26c[_0x784d('0x1c')],_0x3e5da2=_0x4fd26c[_0x784d('0x1c')]+_0x4fd26c[_0x784d('0x1d')],_0x2994f9;if(_0x3e5da2>=_0x10d091){_0x3e5da2=_0x10d091;_0x2994f9=0xc8;}else{_0x2994f9=0xce;}_0xf6591b[_0x784d('0x19')](_0x2994f9);return _0xf6591b[_0x784d('0x1e')]('Content-Range',_0x19bd52+'-'+_0x3e5da2+'/'+_0x10d091)[_0x784d('0x1b')](_0x1bca1e);}return null;};}function patchUpdates(_0x155110){return function(_0x3df34b){try{jsonpatch[_0x784d('0x1f')](_0x3df34b,_0x155110,!![]);}catch(_0x6aceb){return BPromise['reject'](_0x6aceb);}return _0x3df34b[_0x784d('0x20')]();};}function saveUpdates(_0x42c55a,_0x33f30f){return function(_0x39ee82){if(_0x39ee82){return _0x39ee82[_0x784d('0x21')](_0x42c55a)[_0x784d('0x22')](function(_0x240caf){return _0x240caf;});}return null;};}function removeEntity(_0x1550c1,_0x467e44){return function(_0xe9ff2e){if(_0xe9ff2e){return _0xe9ff2e[_0x784d('0x23')]()[_0x784d('0x22')](function(){_0x1550c1[_0x784d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x390ac7,_0x21edcf){return function(_0x112e39){if(!_0x112e39){_0x390ac7[_0x784d('0x18')](0x194);}return _0x112e39;};}function handleError(_0x171481,_0x38ac40){_0x38ac40=_0x38ac40||0x1f4;return function(_0x15ff0d){logger[_0x784d('0x24')](_0x15ff0d[_0x784d('0x25')]);if(_0x15ff0d[_0x784d('0x26')]){delete _0x15ff0d['name'];}_0x171481[_0x784d('0x19')](_0x38ac40)[_0x784d('0x27')](_0x15ff0d);};}exports['index']=function(_0x358efd,_0x18029a){var _0x5df20a={},_0x597d11={},_0x2b6c5f={'count':0x0,'rows':[]};var _0x104560=_[_0x784d('0x28')](db[_0x784d('0x29')][_0x784d('0x2a')],function(_0xecdef4){return{'name':_0xecdef4[_0x784d('0x2b')],'type':_0xecdef4[_0x784d('0x2c')][_0x784d('0x2d')]};});_0x597d11[_0x784d('0x2e')]=_['map'](_0x104560,_0x784d('0x26'));_0x597d11[_0x784d('0x2f')]=_[_0x784d('0x30')](_0x358efd[_0x784d('0x2f')]);_0x597d11[_0x784d('0x31')]=_[_0x784d('0x32')](_0x597d11[_0x784d('0x2e')],_0x597d11[_0x784d('0x2f')]);_0x5df20a[_0x784d('0x33')]=_[_0x784d('0x32')](_0x597d11['model'],qs['fields'](_0x358efd[_0x784d('0x2f')][_0x784d('0x34')]));_0x5df20a[_0x784d('0x33')]=_0x5df20a['attributes'][_0x784d('0x35')]?_0x5df20a[_0x784d('0x33')]:_0x597d11[_0x784d('0x2e')];if(!_0x358efd[_0x784d('0x2f')][_0x784d('0x36')](_0x784d('0x37'))){_0x5df20a[_0x784d('0x1d')]=qs[_0x784d('0x1d')](_0x358efd['query'][_0x784d('0x1d')]);_0x5df20a['offset']=qs['offset'](_0x358efd[_0x784d('0x2f')][_0x784d('0x1c')]);}_0x5df20a[_0x784d('0x38')]=qs[_0x784d('0x39')](_0x358efd[_0x784d('0x2f')][_0x784d('0x39')]);_0x5df20a[_0x784d('0x3a')]=qs[_0x784d('0x31')](_[_0x784d('0x3b')](_0x358efd['query'],_0x597d11['filters']),_0x104560);if(_0x358efd['query'][_0x784d('0x3c')]){_0x5df20a[_0x784d('0x3a')]=_[_0x784d('0x3d')](_0x5df20a[_0x784d('0x3a')],{'$or':_[_0x784d('0x28')](_0x104560,function(_0xb5252){if(_0xb5252[_0x784d('0x2c')]!==_0x784d('0x3e')){var _0x1e63d0={};_0x1e63d0[_0xb5252['name']]={'$like':'%'+_0x358efd[_0x784d('0x2f')][_0x784d('0x3c')]+'%'};return _0x1e63d0;}})});}_0x5df20a=_['merge']({},_0x5df20a,_0x358efd[_0x784d('0x3f')]);var _0x3d1bbf={'where':_0x5df20a[_0x784d('0x3a')]};return db[_0x784d('0x29')][_0x784d('0x40')](_0x3d1bbf)[_0x784d('0x22')](function(_0x168437){_0x2b6c5f[_0x784d('0x40')]=_0x168437;if(_0x358efd[_0x784d('0x2f')][_0x784d('0x41')]){_0x5df20a['include']=[{'all':!![]}];}return db[_0x784d('0x29')][_0x784d('0x42')](_0x5df20a);})[_0x784d('0x22')](function(_0x43086d){_0x2b6c5f[_0x784d('0x43')]=_0x43086d;return _0x2b6c5f;})[_0x784d('0x22')](respondWithFilteredResult(_0x18029a,_0x5df20a))[_0x784d('0x44')](handleError(_0x18029a,null));};exports['show']=function(_0x12b3d5,_0x42aac7){var _0x2f4bb1={'raw':!![],'where':{'id':_0x12b3d5[_0x784d('0x45')]['id']}},_0x1b53d5={};_0x1b53d5[_0x784d('0x2e')]=_[_0x784d('0x30')](db['CmHopperBlack'][_0x784d('0x2a')]);_0x1b53d5[_0x784d('0x2f')]=_['keys'](_0x12b3d5['query']);_0x1b53d5[_0x784d('0x31')]=_[_0x784d('0x32')](_0x1b53d5[_0x784d('0x2e')],_0x1b53d5['query']);_0x2f4bb1[_0x784d('0x33')]=_[_0x784d('0x32')](_0x1b53d5[_0x784d('0x2e')],qs[_0x784d('0x34')](_0x12b3d5[_0x784d('0x2f')][_0x784d('0x34')]));_0x2f4bb1[_0x784d('0x33')]=_0x2f4bb1['attributes']['length']?_0x2f4bb1['attributes']:_0x1b53d5[_0x784d('0x2e')];if(_0x12b3d5['query'][_0x784d('0x41')]){_0x2f4bb1[_0x784d('0x46')]=[{'all':!![]}];}_0x2f4bb1=_[_0x784d('0x3d')]({},_0x2f4bb1,_0x12b3d5['options']);return db[_0x784d('0x29')][_0x784d('0x47')](_0x2f4bb1)[_0x784d('0x22')](handleEntityNotFound(_0x42aac7,null))[_0x784d('0x22')](respondWithResult(_0x42aac7,null))['catch'](handleError(_0x42aac7,null));};exports[_0x784d('0x21')]=function(_0x3f60eb,_0x3b9b48){if(_0x3f60eb['body']['id']){delete _0x3f60eb['body']['id'];}return db['CmHopperBlack'][_0x784d('0x47')]({'where':{'id':_0x3f60eb[_0x784d('0x45')]['id']}})[_0x784d('0x22')](handleEntityNotFound(_0x3b9b48,null))[_0x784d('0x22')](saveUpdates(_0x3f60eb[_0x784d('0x48')],null))[_0x784d('0x22')](respondWithResult(_0x3b9b48,null))[_0x784d('0x44')](handleError(_0x3b9b48,null));};exports[_0x784d('0x23')]=function(_0x45e32d,_0x16a41a){return db['CmHopperBlack'][_0x784d('0x47')]({'where':{'id':_0x45e32d[_0x784d('0x45')]['id']}})[_0x784d('0x22')](handleEntityNotFound(_0x16a41a,null))['then'](removeEntity(_0x16a41a,null))[_0x784d('0x44')](handleError(_0x16a41a,null));};exports[_0x784d('0x49')]=function(_0x263e90,_0x5bfa00){return db[_0x784d('0x29')][_0x784d('0x49')]()['then'](respondWithResult(_0x5bfa00,null))[_0x784d('0x44')](handleError(_0x5bfa00,null));}; \ No newline at end of file +var _0x38c3=['fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','rows','show','params','keys','includeAll','include','catch','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','error','name','map','CmHopperBlack','rawAttributes'];(function(_0x1d528e,_0x586077){var _0x2d5ba5=function(_0x113919){while(--_0x113919){_0x1d528e['push'](_0x1d528e['shift']());}};_0x2d5ba5(++_0x586077);}(_0x38c3,0x13c));var _0x338c=function(_0xcdfc4f,_0x8a111a){_0xcdfc4f=_0xcdfc4f-0x0;var _0x3f70d1=_0x38c3[_0xcdfc4f];return _0x3f70d1;};'use strict';var pdf=require(_0x338c('0x0'));var emlformat=require(_0x338c('0x1'));var rimraf=require(_0x338c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x338c('0x3'));var rp=require(_0x338c('0x4'));var moment=require(_0x338c('0x5'));var BPromise=require(_0x338c('0x6'));var Mustache=require('mustache');var util=require(_0x338c('0x7'));var path=require(_0x338c('0x8'));var sox=require(_0x338c('0x9'));var csv=require(_0x338c('0xa'));var ejs=require(_0x338c('0xb'));var fs=require('fs');var fs_extra=require(_0x338c('0xc'));var _=require(_0x338c('0xd'));var squel=require('squel');var crypto=require(_0x338c('0xe'));var jsforce=require(_0x338c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x338c('0x10'));var Redis=require(_0x338c('0x11'));var authService=require(_0x338c('0x12'));var qs=require(_0x338c('0x13'));var as=require(_0x338c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x338c('0x15'));var utils=require(_0x338c('0x16'));var config=require(_0x338c('0x17'));var licenseUtil=require(_0x338c('0x18'));var db=require(_0x338c('0x19'))['db'];function respondWithStatusCode(_0x5b9bd5,_0x4ddf2f){_0x4ddf2f=_0x4ddf2f||0xcc;return function(_0x822a5c){if(_0x822a5c){return _0x5b9bd5[_0x338c('0x1a')](_0x4ddf2f);}return _0x5b9bd5[_0x338c('0x1b')](_0x4ddf2f)[_0x338c('0x1c')]();};}function respondWithResult(_0x3532be,_0x33d2c5){_0x33d2c5=_0x33d2c5||0xc8;return function(_0x1444bb){if(_0x1444bb){return _0x3532be[_0x338c('0x1b')](_0x33d2c5)['json'](_0x1444bb);}};}function respondWithFilteredResult(_0x15a90b,_0x5d5a34){return function(_0x56b6c5){if(_0x56b6c5){var _0x3e2a13=_0x56b6c5[_0x338c('0x1d')],_0x3abb68=_0x5d5a34[_0x338c('0x1e')],_0x4c0b0c=_0x5d5a34['offset']+_0x5d5a34[_0x338c('0x1f')],_0x196509;if(_0x4c0b0c>=_0x3e2a13){_0x4c0b0c=_0x3e2a13;_0x196509=0xc8;}else{_0x196509=0xce;}_0x15a90b[_0x338c('0x1b')](_0x196509);return _0x15a90b[_0x338c('0x20')](_0x338c('0x21'),_0x3abb68+'-'+_0x4c0b0c+'/'+_0x3e2a13)[_0x338c('0x22')](_0x56b6c5);}return null;};}function patchUpdates(_0xf73c02){return function(_0x1829a4){try{jsonpatch['apply'](_0x1829a4,_0xf73c02,!![]);}catch(_0x59edf5){return BPromise[_0x338c('0x23')](_0x59edf5);}return _0x1829a4[_0x338c('0x24')]();};}function saveUpdates(_0x37c155,_0x1490c3){return function(_0x1291df){if(_0x1291df){return _0x1291df[_0x338c('0x25')](_0x37c155)['then'](function(_0x448705){return _0x448705;});}return null;};}function removeEntity(_0x39593b,_0xabf72){return function(_0x532228){if(_0x532228){return _0x532228['destroy']()[_0x338c('0x26')](function(){_0x39593b[_0x338c('0x1b')](0xcc)[_0x338c('0x1c')]();});}};}function handleEntityNotFound(_0x111385,_0x2adbc7){return function(_0x351a5d){if(!_0x351a5d){_0x111385[_0x338c('0x1a')](0x194);}return _0x351a5d;};}function handleError(_0x6b43c9,_0x56cea7){_0x56cea7=_0x56cea7||0x1f4;return function(_0x5a3670){logger[_0x338c('0x27')](_0x5a3670['stack']);if(_0x5a3670[_0x338c('0x28')]){delete _0x5a3670['name'];}_0x6b43c9[_0x338c('0x1b')](_0x56cea7)['send'](_0x5a3670);};}exports['index']=function(_0x158f92,_0x172be1){var _0x360388={},_0x436d20={},_0x6e61ae={'count':0x0,'rows':[]};var _0x43af18=_[_0x338c('0x29')](db[_0x338c('0x2a')][_0x338c('0x2b')],function(_0xcdc599){return{'name':_0xcdc599[_0x338c('0x2c')],'type':_0xcdc599[_0x338c('0x2d')][_0x338c('0x2e')]};});_0x436d20['model']=_[_0x338c('0x29')](_0x43af18,_0x338c('0x28'));_0x436d20['query']=_['keys'](_0x158f92[_0x338c('0x2f')]);_0x436d20[_0x338c('0x30')]=_[_0x338c('0x31')](_0x436d20[_0x338c('0x32')],_0x436d20[_0x338c('0x2f')]);_0x360388[_0x338c('0x33')]=_[_0x338c('0x31')](_0x436d20[_0x338c('0x32')],qs['fields'](_0x158f92[_0x338c('0x2f')][_0x338c('0x34')]));_0x360388['attributes']=_0x360388[_0x338c('0x33')][_0x338c('0x35')]?_0x360388[_0x338c('0x33')]:_0x436d20[_0x338c('0x32')];if(!_0x158f92[_0x338c('0x2f')][_0x338c('0x36')](_0x338c('0x37'))){_0x360388['limit']=qs[_0x338c('0x1f')](_0x158f92[_0x338c('0x2f')][_0x338c('0x1f')]);_0x360388['offset']=qs[_0x338c('0x1e')](_0x158f92[_0x338c('0x2f')]['offset']);}_0x360388[_0x338c('0x38')]=qs[_0x338c('0x39')](_0x158f92['query'][_0x338c('0x39')]);_0x360388['where']=qs[_0x338c('0x30')](_[_0x338c('0x3a')](_0x158f92[_0x338c('0x2f')],_0x436d20[_0x338c('0x30')]),_0x43af18);if(_0x158f92['query'][_0x338c('0x3b')]){_0x360388[_0x338c('0x3c')]=_[_0x338c('0x3d')](_0x360388['where'],{'$or':_[_0x338c('0x29')](_0x43af18,function(_0x98c45f){if(_0x98c45f['type']!==_0x338c('0x3e')){var _0x395563={};_0x395563[_0x98c45f[_0x338c('0x28')]]={'$like':'%'+_0x158f92['query'][_0x338c('0x3b')]+'%'};return _0x395563;}})});}_0x360388=_['merge']({},_0x360388,_0x158f92['options']);var _0x31bb16={'where':_0x360388[_0x338c('0x3c')]};return db[_0x338c('0x2a')][_0x338c('0x1d')](_0x31bb16)['then'](function(_0x100f38){_0x6e61ae['count']=_0x100f38;if(_0x158f92[_0x338c('0x2f')]['includeAll']){_0x360388['include']=[{'all':!![]}];}return db[_0x338c('0x2a')]['findAll'](_0x360388);})[_0x338c('0x26')](function(_0x51bea3){_0x6e61ae[_0x338c('0x3f')]=_0x51bea3;return _0x6e61ae;})['then'](respondWithFilteredResult(_0x172be1,_0x360388))['catch'](handleError(_0x172be1,null));};exports[_0x338c('0x40')]=function(_0x2f8fa2,_0x6c2529){var _0x4728c9={'raw':!![],'where':{'id':_0x2f8fa2[_0x338c('0x41')]['id']}},_0x1c82a3={};_0x1c82a3[_0x338c('0x32')]=_[_0x338c('0x42')](db[_0x338c('0x2a')][_0x338c('0x2b')]);_0x1c82a3[_0x338c('0x2f')]=_[_0x338c('0x42')](_0x2f8fa2['query']);_0x1c82a3[_0x338c('0x30')]=_[_0x338c('0x31')](_0x1c82a3[_0x338c('0x32')],_0x1c82a3[_0x338c('0x2f')]);_0x4728c9[_0x338c('0x33')]=_[_0x338c('0x31')](_0x1c82a3[_0x338c('0x32')],qs[_0x338c('0x34')](_0x2f8fa2[_0x338c('0x2f')][_0x338c('0x34')]));_0x4728c9[_0x338c('0x33')]=_0x4728c9[_0x338c('0x33')][_0x338c('0x35')]?_0x4728c9[_0x338c('0x33')]:_0x1c82a3[_0x338c('0x32')];if(_0x2f8fa2[_0x338c('0x2f')][_0x338c('0x43')]){_0x4728c9[_0x338c('0x44')]=[{'all':!![]}];}_0x4728c9=_['merge']({},_0x4728c9,_0x2f8fa2['options']);return db[_0x338c('0x2a')]['find'](_0x4728c9)[_0x338c('0x26')](handleEntityNotFound(_0x6c2529,null))['then'](respondWithResult(_0x6c2529,null))[_0x338c('0x45')](handleError(_0x6c2529,null));};exports['update']=function(_0x387b4a,_0x5a39cb){if(_0x387b4a[_0x338c('0x46')]['id']){delete _0x387b4a[_0x338c('0x46')]['id'];}return db['CmHopperBlack'][_0x338c('0x47')]({'where':{'id':_0x387b4a[_0x338c('0x41')]['id']}})[_0x338c('0x26')](handleEntityNotFound(_0x5a39cb,null))[_0x338c('0x26')](saveUpdates(_0x387b4a[_0x338c('0x46')],null))[_0x338c('0x26')](respondWithResult(_0x5a39cb,null))[_0x338c('0x45')](handleError(_0x5a39cb,null));};exports['destroy']=function(_0x4cc5b8,_0x6945da){return db['CmHopperBlack'][_0x338c('0x47')]({'where':{'id':_0x4cc5b8[_0x338c('0x41')]['id']}})[_0x338c('0x26')](handleEntityNotFound(_0x6945da,null))[_0x338c('0x26')](removeEntity(_0x6945da,null))[_0x338c('0x45')](handleError(_0x6945da,null));};exports['describe']=function(_0x2d9e84,_0x3edf7f){return db[_0x338c('0x2a')]['describe']()['then'](respondWithResult(_0x3edf7f,null))[_0x338c('0x45')](handleError(_0x3edf7f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 846fa53..82afe51 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 _0xb6fe=['../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','bluebird','request-promise','path'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xb6fe,0xb5));var _0xeb6f=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xb6fe[_0x2ca9d4];return _0x258956;};'use strict';var _=require(_0xeb6f('0x0'));var util=require(_0xeb6f('0x1'));var logger=require('../../config/logger')(_0xeb6f('0x2'));var moment=require('moment');var BPromise=require(_0xeb6f('0x3'));var rp=require(_0xeb6f('0x4'));var fs=require('fs');var path=require(_0xeb6f('0x5'));var rimraf=require('rimraf');var config=require(_0xeb6f('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0xeb6f('0x7')]=function(_0x3ec811,_0x2f1424){return _0x3ec811[_0xeb6f('0x8')](_0xeb6f('0x9'),attributes,{'tableName':_0xeb6f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cfc=['exports','define','cm_hopper_black','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cmHopperBlack.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4cfc,0x121));var _0xc4cf=function(_0x4dd4fe,_0x5c649f){_0x4dd4fe=_0x4dd4fe-0x0;var _0x2ef6cf=_0x4cfc[_0x4dd4fe];return _0x2ef6cf;};'use strict';var _=require('lodash');var util=require(_0xc4cf('0x0'));var logger=require(_0xc4cf('0x1'))(_0xc4cf('0x2'));var moment=require(_0xc4cf('0x3'));var BPromise=require('bluebird');var rp=require(_0xc4cf('0x4'));var fs=require('fs');var path=require(_0xc4cf('0x5'));var rimraf=require('rimraf');var config=require(_0xc4cf('0x6'));var attributes=require(_0xc4cf('0x7'));module[_0xc4cf('0x8')]=function(_0xd4ddb9,_0x506a66){return _0xd4ddb9[_0xc4cf('0x9')]('CmHopperBlack',attributes,{'tableName':_0xc4cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 3d4ae76..b2787e3 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 _0xf5b1=['GetCmHopperBlack','CmHopperBlack','findAll','raw','options','attributes','limit','include','map','model','catch','UpdateCmHopperBlack','update','body','destroy','where','DestroyCmHopperBlack','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5b1,0x19d));var _0x1f5b=function(_0xd5f9db,_0x688103){_0xd5f9db=_0xd5f9db-0x0;var _0x1228b0=_0xf5b1[_0xd5f9db];return _0x1228b0;};'use strict';var _=require(_0x1f5b('0x0'));var util=require('util');var moment=require(_0x1f5b('0x1'));var BPromise=require(_0x1f5b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f5b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1f5b('0x4'))(_0x1f5b('0x5'));var config=require(_0x1f5b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1f5b('0x7')][_0x1f5b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xce7575,_0x4f5016,_0x5bf144){return new BPromise(function(_0x4f11ad,_0x48fe45){return client['request'](_0xce7575,_0x5bf144)[_0x1f5b('0x9')](function(_0x22561b){logger[_0x1f5b('0xa')](_0x1f5b('0xb'),_0x4f5016,'request\x20sent');logger[_0x1f5b('0xc')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x4f5016,_0x1f5b('0xd'),JSON[_0x1f5b('0xe')](_0x22561b));if(_0x22561b['error']){if(_0x22561b[_0x1f5b('0xf')][_0x1f5b('0x10')]===0x1f4){logger[_0x1f5b('0xf')](_0x1f5b('0xb'),_0x4f5016,_0x22561b['error'][_0x1f5b('0x11')]);return _0x48fe45(_0x22561b[_0x1f5b('0xf')][_0x1f5b('0x11')]);}logger['error'](_0x1f5b('0xb'),_0x4f5016,_0x22561b[_0x1f5b('0xf')][_0x1f5b('0x11')]);return _0x4f11ad(_0x22561b[_0x1f5b('0xf')][_0x1f5b('0x11')]);}else{logger[_0x1f5b('0xa')](_0x1f5b('0xb'),_0x4f5016,_0x1f5b('0xd'));_0x4f11ad(_0x22561b[_0x1f5b('0x12')][_0x1f5b('0x11')]);}})['catch'](function(_0x4b9f5e){logger[_0x1f5b('0xf')](_0x1f5b('0xb'),_0x4f5016,_0x4b9f5e);_0x48fe45(_0x4b9f5e);});});}exports[_0x1f5b('0x13')]=function(_0x43aa88){var _0xb97322=this;return new Promise(function(_0x229168,_0x491852){return db[_0x1f5b('0x14')][_0x1f5b('0x15')]({'raw':_0x43aa88['options']?_0x43aa88['options'][_0x1f5b('0x16')]===undefined?!![]:![]:!![],'where':_0x43aa88[_0x1f5b('0x17')]?_0x43aa88['options']['where']||null:null,'attributes':_0x43aa88[_0x1f5b('0x17')]?_0x43aa88[_0x1f5b('0x17')][_0x1f5b('0x18')]||null:null,'limit':_0x43aa88[_0x1f5b('0x17')]?_0x43aa88[_0x1f5b('0x17')][_0x1f5b('0x19')]||null:null,'include':_0x43aa88[_0x1f5b('0x17')]?_0x43aa88[_0x1f5b('0x17')][_0x1f5b('0x1a')]?_[_0x1f5b('0x1b')](_0x43aa88[_0x1f5b('0x17')][_0x1f5b('0x1a')],function(_0xb50f58){return{'model':db[_0xb50f58['model']],'as':_0xb50f58['as'],'attributes':_0xb50f58['attributes'],'include':_0xb50f58['include']?_['map'](_0xb50f58[_0x1f5b('0x1a')],function(_0x20b036){return{'model':db[_0x20b036[_0x1f5b('0x1c')]],'as':_0x20b036['as'],'attributes':_0x20b036[_0x1f5b('0x18')],'include':_0x20b036[_0x1f5b('0x1a')]?_[_0x1f5b('0x1b')](_0x20b036[_0x1f5b('0x1a')],function(_0x3d1214){return{'model':db[_0x3d1214['model']],'as':_0x3d1214['as'],'attributes':_0x3d1214['attributes']};}):[]};}):[]};}):[]:[]})[_0x1f5b('0x9')](function(_0x5be674){logger[_0x1f5b('0xa')](_0x1f5b('0x13'),_0x43aa88);logger[_0x1f5b('0xc')]('GetCmHopperBlack',_0x43aa88,JSON[_0x1f5b('0xe')](_0x5be674));_0x229168(_0x5be674);})[_0x1f5b('0x1d')](function(_0x4cdd7d){logger[_0x1f5b('0xf')](_0x1f5b('0x13'),_0x4cdd7d[_0x1f5b('0x11')],_0x43aa88);_0x491852(_0xb97322[_0x1f5b('0xf')](0x1f4,_0x4cdd7d[_0x1f5b('0x11')]));});});};exports[_0x1f5b('0x1e')]=function(_0x3bef45){var _0x3c12a2=this;return new Promise(function(_0x25525f,_0x4d19e0){return db[_0x1f5b('0x14')][_0x1f5b('0x1f')](_0x3bef45[_0x1f5b('0x20')],{'raw':_0x3bef45['options']?_0x3bef45[_0x1f5b('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bef45[_0x1f5b('0x17')]?_0x3bef45['options']['where']||null:null,'attributes':_0x3bef45[_0x1f5b('0x17')]?_0x3bef45[_0x1f5b('0x17')]['attributes']||null:null,'limit':_0x3bef45[_0x1f5b('0x17')]?_0x3bef45[_0x1f5b('0x17')][_0x1f5b('0x19')]||null:null})[_0x1f5b('0x9')](function(_0x949a9e){logger[_0x1f5b('0xa')](_0x1f5b('0x1e'),_0x3bef45);logger[_0x1f5b('0xc')](_0x1f5b('0x1e'),_0x3bef45,JSON[_0x1f5b('0xe')](_0x949a9e));_0x25525f(_0x949a9e);})[_0x1f5b('0x1d')](function(_0x2c2e22){logger['error'](_0x1f5b('0x1e'),_0x2c2e22['message'],_0x3bef45);_0x4d19e0(_0x3c12a2['error'](0x1f4,_0x2c2e22[_0x1f5b('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x1d7b94){var _0x3f03fd=this;return new Promise(function(_0x242d55,_0x4cc35f){return db[_0x1f5b('0x14')][_0x1f5b('0x21')]({'where':_0x1d7b94[_0x1f5b('0x17')]?_0x1d7b94['options'][_0x1f5b('0x22')]||null:null})[_0x1f5b('0x9')](function(_0x532bd1){logger[_0x1f5b('0xa')](_0x1f5b('0x23'),_0x1d7b94);logger[_0x1f5b('0xc')]('DestroyCmHopperBlack',_0x1d7b94,JSON['stringify'](_0x532bd1));_0x242d55(_0x532bd1);})[_0x1f5b('0x1d')](function(_0x46d0d6){logger[_0x1f5b('0xf')](_0x1f5b('0x23'),_0x46d0d6[_0x1f5b('0x11')],_0x1d7b94);_0x4cc35f(_0x3f03fd[_0x1f5b('0xf')](0x1f4,_0x46d0d6['message']));});});}; \ No newline at end of file +var _0x6d11=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','include','map','model','then','CmHopperBlack','limit','UpdateCmHopperBlack','DestroyCmHopperBlack','bluebird','ioredis'];(function(_0x3bf62d,_0x3d7bae){var _0x438e78=function(_0xd8b851){while(--_0xd8b851){_0x3bf62d['push'](_0x3bf62d['shift']());}};_0x438e78(++_0x3d7bae);}(_0x6d11,0x18a));var _0x16d1=function(_0x110153,_0x3ede7d){_0x110153=_0x110153-0x0;var _0x538583=_0x6d11[_0x110153];return _0x538583;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x16d1('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16d1('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x16d1('0x2'));var logger=require(_0x16d1('0x3'))('rpc');var config=require(_0x16d1('0x4'));var jayson=require(_0x16d1('0x5'));var client=jayson[_0x16d1('0x6')][_0x16d1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x204f49,_0x5074ed,_0x545dc7){return new BPromise(function(_0x18b273,_0x460871){return client[_0x16d1('0x8')](_0x204f49,_0x545dc7)['then'](function(_0x2d95c8){logger[_0x16d1('0x9')](_0x16d1('0xa'),_0x5074ed,_0x16d1('0xb'));logger[_0x16d1('0xc')](_0x16d1('0xd'),_0x5074ed,'request\x20sent',JSON[_0x16d1('0xe')](_0x2d95c8));if(_0x2d95c8[_0x16d1('0xf')]){if(_0x2d95c8['error']['code']===0x1f4){logger[_0x16d1('0xf')](_0x16d1('0xa'),_0x5074ed,_0x2d95c8[_0x16d1('0xf')][_0x16d1('0x10')]);return _0x460871(_0x2d95c8[_0x16d1('0xf')]['message']);}logger['error'](_0x16d1('0xa'),_0x5074ed,_0x2d95c8[_0x16d1('0xf')]['message']);return _0x18b273(_0x2d95c8[_0x16d1('0xf')][_0x16d1('0x10')]);}else{logger[_0x16d1('0x9')](_0x16d1('0xa'),_0x5074ed,_0x16d1('0xb'));_0x18b273(_0x2d95c8[_0x16d1('0x11')][_0x16d1('0x10')]);}})[_0x16d1('0x12')](function(_0x44e0da){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x5074ed,_0x44e0da);_0x460871(_0x44e0da);});});}exports[_0x16d1('0x13')]=function(_0x5ef992){var _0x109007=this;return new Promise(function(_0x4661c4,_0x790b09){return db['CmHopperBlack'][_0x16d1('0x14')]({'raw':_0x5ef992['options']?_0x5ef992[_0x16d1('0x15')][_0x16d1('0x16')]===undefined?!![]:![]:!![],'where':_0x5ef992[_0x16d1('0x15')]?_0x5ef992[_0x16d1('0x15')][_0x16d1('0x17')]||null:null,'attributes':_0x5ef992[_0x16d1('0x15')]?_0x5ef992[_0x16d1('0x15')][_0x16d1('0x18')]||null:null,'limit':_0x5ef992['options']?_0x5ef992[_0x16d1('0x15')]['limit']||null:null,'include':_0x5ef992[_0x16d1('0x15')]?_0x5ef992[_0x16d1('0x15')][_0x16d1('0x19')]?_[_0x16d1('0x1a')](_0x5ef992[_0x16d1('0x15')][_0x16d1('0x19')],function(_0x1c3493){return{'model':db[_0x1c3493['model']],'as':_0x1c3493['as'],'attributes':_0x1c3493[_0x16d1('0x18')],'include':_0x1c3493[_0x16d1('0x19')]?_['map'](_0x1c3493[_0x16d1('0x19')],function(_0x2dfb22){return{'model':db[_0x2dfb22[_0x16d1('0x1b')]],'as':_0x2dfb22['as'],'attributes':_0x2dfb22['attributes'],'include':_0x2dfb22[_0x16d1('0x19')]?_['map'](_0x2dfb22[_0x16d1('0x19')],function(_0x1f29ff){return{'model':db[_0x1f29ff[_0x16d1('0x1b')]],'as':_0x1f29ff['as'],'attributes':_0x1f29ff[_0x16d1('0x18')]};}):[]};}):[]};}):[]:[]})[_0x16d1('0x1c')](function(_0x530aaf){logger[_0x16d1('0x9')]('GetCmHopperBlack',_0x5ef992);logger['debug'](_0x16d1('0x13'),_0x5ef992,JSON[_0x16d1('0xe')](_0x530aaf));_0x4661c4(_0x530aaf);})[_0x16d1('0x12')](function(_0x3790cd){logger[_0x16d1('0xf')](_0x16d1('0x13'),_0x3790cd['message'],_0x5ef992);_0x790b09(_0x109007[_0x16d1('0xf')](0x1f4,_0x3790cd[_0x16d1('0x10')]));});});};exports['UpdateCmHopperBlack']=function(_0x5af309){var _0x31080e=this;return new Promise(function(_0x48f2f8,_0x25fb7b){return db[_0x16d1('0x1d')]['update'](_0x5af309['body'],{'raw':_0x5af309[_0x16d1('0x15')]?_0x5af309[_0x16d1('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5af309['options']?_0x5af309[_0x16d1('0x15')][_0x16d1('0x17')]||null:null,'attributes':_0x5af309[_0x16d1('0x15')]?_0x5af309[_0x16d1('0x15')]['attributes']||null:null,'limit':_0x5af309[_0x16d1('0x15')]?_0x5af309[_0x16d1('0x15')][_0x16d1('0x1e')]||null:null})['then'](function(_0x2c5105){logger[_0x16d1('0x9')](_0x16d1('0x1f'),_0x5af309);logger['debug'](_0x16d1('0x1f'),_0x5af309,JSON['stringify'](_0x2c5105));_0x48f2f8(_0x2c5105);})[_0x16d1('0x12')](function(_0x50215c){logger[_0x16d1('0xf')](_0x16d1('0x1f'),_0x50215c[_0x16d1('0x10')],_0x5af309);_0x25fb7b(_0x31080e[_0x16d1('0xf')](0x1f4,_0x50215c['message']));});});};exports[_0x16d1('0x20')]=function(_0x38dc2f){var _0x28a4f1=this;return new Promise(function(_0x3aeb36,_0x1699ad){return db['CmHopperBlack']['destroy']({'where':_0x38dc2f[_0x16d1('0x15')]?_0x38dc2f['options'][_0x16d1('0x17')]||null:null})[_0x16d1('0x1c')](function(_0x3dbd49){logger['info'](_0x16d1('0x20'),_0x38dc2f);logger[_0x16d1('0xc')]('DestroyCmHopperBlack',_0x38dc2f,JSON[_0x16d1('0xe')](_0x3dbd49));_0x3aeb36(_0x3dbd49);})[_0x16d1('0x12')](function(_0x31a9cc){logger[_0x16d1('0xf')](_0x16d1('0x20'),_0x31a9cc[_0x16d1('0x10')],_0x38dc2f);_0x1699ad(_0x28a4f1[_0x16d1('0xf')](0x1f4,_0x31a9cc[_0x16d1('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 4cc1915..de7055d 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 _0xc6ac=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x163b61,_0x17d248){_0x163b61=_0x163b61-0x0;var _0x48b542=_0xc6ac[_0x163b61];return _0x48b542;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')](_0xcc6a('0x10'),auth['isAuthenticated'](),controller[_0xcc6a('0x13')]);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth['isAuthenticated'](),controller[_0xcc6a('0x15')]);module[_0xcc6a('0x16')]=router; \ No newline at end of file +var _0xa23f=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','update','destroy','exports','multer','util','express','Router'];(function(_0x4d52e2,_0x41865b){var _0x27dcf9=function(_0x2ab6a6){while(--_0x2ab6a6){_0x4d52e2['push'](_0x4d52e2['shift']());}};_0x27dcf9(++_0x41865b);}(_0xa23f,0x7c));var _0xfa23=function(_0x1ec1b9,_0x1d7494){_0x1ec1b9=_0x1ec1b9-0x0;var _0x3fccce=_0xa23f[_0x1ec1b9];return _0x3fccce;};'use strict';var multer=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa23('0x2'));var router=express[_0xfa23('0x3')]();var fs_extra=require(_0xfa23('0x4'));var auth=require(_0xfa23('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa23('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xfa23('0x7')]('/',auth[_0xfa23('0x8')](),controller[_0xfa23('0x9')]);router[_0xfa23('0x7')]('/describe',auth[_0xfa23('0x8')](),controller['describe']);router[_0xfa23('0x7')](_0xfa23('0xa'),auth[_0xfa23('0x8')](),controller[_0xfa23('0xb')]);router[_0xfa23('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xfa23('0xd')]);router['delete'](_0xfa23('0xa'),auth['isAuthenticated'](),controller[_0xfa23('0xe')]);module[_0xfa23('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 48a747d..4bed973 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 _0xa9e3=['seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x16fe01,_0x5039e1){var _0x56c48a=function(_0x419884){while(--_0x419884){_0x16fe01['push'](_0x16fe01['shift']());}};_0x56c48a(++_0x5039e1);}(_0xa9e3,0x113));var _0x3a9e=function(_0x36ff20,_0x2f79b4){_0x36ff20=_0x36ff20-0x0;var _0x18a001=_0xa9e3[_0x36ff20];return _0x18a001;};'use strict';var Sequelize=require(_0x3a9e('0x0'));var moment=require(_0x3a9e('0x1'));module[_0x3a9e('0x2')]={'state':{'type':Sequelize[_0x3a9e('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x3a9e('0x4')]},'scheduledat':{'type':Sequelize[_0x3a9e('0x5')]},'countbusyretry':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3a9e('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3a9e('0x4')]},'calleridname':{'type':Sequelize[_0x3a9e('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3a9e('0x5')]},'answertime':{'type':Sequelize[_0x3a9e('0x5')]},'droptime':{'type':Sequelize[_0x3a9e('0x5')]},'endtime':{'type':Sequelize[_0x3a9e('0x5')]},'ringtime':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3a9e('0x4')]},'campaign':{'type':Sequelize[_0x3a9e('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3a9e('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x3a9e('0x4')]},'secondDisposition':{'type':Sequelize[_0x3a9e('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x3a9e('0x5')],'set':function(_0x29e109){var _0x3f86d9=this[_0x3a9e('0x6')](_0x3a9e('0x7'));if(_0x3f86d9&&_0x29e109){this[_0x3a9e('0x8')](_0x3a9e('0x9'),moment(_0x29e109)[_0x3a9e('0xa')](moment(_0x3f86d9),_0x3a9e('0xb')));}return this[_0x3a9e('0x8')]('dispositionat',_0x29e109);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x3a9e('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x3a9e('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3a9e('0x5')]},'callback':{'type':Sequelize[_0x3a9e('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3a9e('0x5')]},'deleted':{'type':Sequelize[_0x3a9e('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3a9e('0x5')]},'recallme':{'type':Sequelize[_0x3a9e('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x04b6=['sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','seconds','dispositionat','BOOLEAN'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x04b6,0x1e0));var _0x604b=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0x04b6[_0x1911ed];return _0x11edaa;};'use strict';var Sequelize=require(_0x604b('0x0'));var moment=require('moment');module[_0x604b('0x1')]={'state':{'type':Sequelize[_0x604b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x604b('0x3')]},'scheduledat':{'type':Sequelize[_0x604b('0x4')]},'countbusyretry':{'type':Sequelize[_0x604b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x604b('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x604b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x604b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x604b('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x604b('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x604b('0x3')]},'calleridname':{'type':Sequelize[_0x604b('0x3')]},'starttime':{'type':Sequelize[_0x604b('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x604b('0x4')]},'droptime':{'type':Sequelize[_0x604b('0x4')]},'endtime':{'type':Sequelize[_0x604b('0x4')]},'ringtime':{'type':Sequelize[_0x604b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x604b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x604b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x604b('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x604b('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x604b('0x3')]},'membername':{'type':Sequelize[_0x604b('0x3')]},'reason':{'type':Sequelize[_0x604b('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x604b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x604b('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4c3d7d){var _0x316242=this[_0x604b('0x5')](_0x604b('0x6'));if(_0x316242&&_0x4c3d7d){this[_0x604b('0x7')](_0x604b('0x8'),moment(_0x4c3d7d)['diff'](moment(_0x316242),_0x604b('0x9')));}return this[_0x604b('0x7')](_0x604b('0xa'),_0x4c3d7d);}},'amd':{'type':Sequelize[_0x604b('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x604b('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x604b('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x604b('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x604b('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x604b('0x4')]},'deleted':{'type':Sequelize[_0x604b('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x604b('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x604b('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 2f1371b..4415932 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 _0xf65a=['ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','phone','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ListId','NOW()','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','includeAll','CmHopperFinal','rows','catch','show','keys','length','find','describe','body','uniqueid','params','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','`state`\x20=\x208,\x201,\x20null','congestionContacts','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)'];(function(_0xa0ac05,_0x4a7da8){var _0x6ea8b4=function(_0x501c8d){while(--_0x501c8d){_0xa0ac05['push'](_0xa0ac05['shift']());}};_0x6ea8b4(++_0x4a7da8);}(_0xf65a,0x19b));var _0xaf65=function(_0x1f879f,_0x2b5702){_0x1f879f=_0x1f879f-0x0;var _0x1a2a0d=_0xf65a[_0x1f879f];return _0x1a2a0d;};'use strict';var pdf=require(_0xaf65('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xaf65('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf65('0x2'));var rp=require(_0xaf65('0x3'));var moment=require(_0xaf65('0x4'));var BPromise=require(_0xaf65('0x5'));var Mustache=require(_0xaf65('0x6'));var util=require(_0xaf65('0x7'));var path=require('path');var sox=require(_0xaf65('0x8'));var csv=require(_0xaf65('0x9'));var ejs=require(_0xaf65('0xa'));var fs=require('fs');var fs_extra=require(_0xaf65('0xb'));var _=require('lodash');var squel=require(_0xaf65('0xc'));var crypto=require(_0xaf65('0xd'));var jsforce=require(_0xaf65('0xe'));var deskjs=require(_0xaf65('0xf'));var toCsv=require(_0xaf65('0x9'));var querystring=require(_0xaf65('0x10'));var Papa=require(_0xaf65('0x11'));var Redis=require(_0xaf65('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xaf65('0x13'));var as=require(_0xaf65('0x14'));var hardwareService=require(_0xaf65('0x15'));var logger=require('../../config/logger')(_0xaf65('0x16'));var utils=require(_0xaf65('0x17'));var config=require(_0xaf65('0x18'));var licenseUtil=require(_0xaf65('0x19'));var db=require(_0xaf65('0x1a'))['db'];function respondWithStatusCode(_0x1cdc1a,_0x321db3){_0x321db3=_0x321db3||0xcc;return function(_0x412b26){if(_0x412b26){return _0x1cdc1a[_0xaf65('0x1b')](_0x321db3);}return _0x1cdc1a[_0xaf65('0x1c')](_0x321db3)[_0xaf65('0x1d')]();};}function respondWithResult(_0x2e6729,_0xb4aef1){_0xb4aef1=_0xb4aef1||0xc8;return function(_0x400dde){if(_0x400dde){return _0x2e6729[_0xaf65('0x1c')](_0xb4aef1)[_0xaf65('0x1e')](_0x400dde);}};}function respondWithFilteredResult(_0x95518f,_0x258897){return function(_0x56973f){if(_0x56973f){var _0x5592b9=_0x56973f[_0xaf65('0x1f')],_0x57f9bf=_0x258897[_0xaf65('0x20')],_0x4a7405=_0x258897[_0xaf65('0x20')]+_0x258897[_0xaf65('0x21')],_0x5593d0;if(_0x4a7405>=_0x5592b9){_0x4a7405=_0x5592b9;_0x5593d0=0xc8;}else{_0x5593d0=0xce;}_0x95518f[_0xaf65('0x1c')](_0x5593d0);return _0x95518f[_0xaf65('0x22')](_0xaf65('0x23'),_0x57f9bf+'-'+_0x4a7405+'/'+_0x5592b9)[_0xaf65('0x1e')](_0x56973f);}return null;};}function patchUpdates(_0x235789){return function(_0x1898e7){try{jsonpatch[_0xaf65('0x24')](_0x1898e7,_0x235789,!![]);}catch(_0x317115){return BPromise['reject'](_0x317115);}return _0x1898e7['save']();};}function saveUpdates(_0x2d0d9d,_0xaa7f0b){return function(_0x1b7ea0){if(_0x1b7ea0){return _0x1b7ea0[_0xaf65('0x25')](_0x2d0d9d)[_0xaf65('0x26')](function(_0x295edd){return _0x295edd;});}return null;};}function removeEntity(_0x5b9e9c,_0x4fa75b){return function(_0x1cb231){if(_0x1cb231){return _0x1cb231[_0xaf65('0x27')]()[_0xaf65('0x26')](function(){_0x5b9e9c[_0xaf65('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x71af65,_0x469d5c){return function(_0x39c474){if(!_0x39c474){_0x71af65[_0xaf65('0x1b')](0x194);}return _0x39c474;};}function handleError(_0x2462df,_0xd718ac){_0xd718ac=_0xd718ac||0x1f4;return function(_0x18c6fc){logger[_0xaf65('0x28')](_0x18c6fc[_0xaf65('0x29')]);if(_0x18c6fc[_0xaf65('0x2a')]){delete _0x18c6fc[_0xaf65('0x2a')];}_0x2462df[_0xaf65('0x1c')](_0xd718ac)[_0xaf65('0x2b')](_0x18c6fc);};}exports['index']=function(_0x7bea85,_0x56b143){var _0x47f557={},_0x106ea3={},_0x4083fe={'count':0x0,'rows':[]};var _0x4c1d10=_[_0xaf65('0x2c')](db['CmHopperFinal'][_0xaf65('0x2d')],function(_0x363db5){return{'name':_0x363db5['fieldName'],'type':_0x363db5[_0xaf65('0x2e')][_0xaf65('0x2f')]};});_0x106ea3[_0xaf65('0x30')]=_['map'](_0x4c1d10,_0xaf65('0x2a'));_0x106ea3[_0xaf65('0x31')]=_['keys'](_0x7bea85[_0xaf65('0x31')]);_0x106ea3[_0xaf65('0x32')]=_['intersection'](_0x106ea3[_0xaf65('0x30')],_0x106ea3[_0xaf65('0x31')]);_0x47f557['attributes']=_[_0xaf65('0x33')](_0x106ea3['model'],qs[_0xaf65('0x34')](_0x7bea85['query'][_0xaf65('0x34')]));_0x47f557[_0xaf65('0x35')]=_0x47f557[_0xaf65('0x35')]['length']?_0x47f557['attributes']:_0x106ea3[_0xaf65('0x30')];if(!_0x7bea85[_0xaf65('0x31')][_0xaf65('0x36')]('nolimit')){_0x47f557[_0xaf65('0x21')]=qs[_0xaf65('0x21')](_0x7bea85[_0xaf65('0x31')]['limit']);_0x47f557[_0xaf65('0x20')]=qs[_0xaf65('0x20')](_0x7bea85[_0xaf65('0x31')][_0xaf65('0x20')]);}_0x47f557[_0xaf65('0x37')]=qs['sort'](_0x7bea85['query'][_0xaf65('0x38')]);_0x47f557[_0xaf65('0x39')]=qs[_0xaf65('0x32')](_['pick'](_0x7bea85['query'],_0x106ea3[_0xaf65('0x32')]),_0x4c1d10);if(_0x7bea85['query']['filter']){_0x47f557[_0xaf65('0x39')]=_['merge'](_0x47f557['where'],{'$or':_[_0xaf65('0x2c')](_0x4c1d10,function(_0x93926d){if(_0x93926d['type']!=='VIRTUAL'){var _0xa85ab3={};_0xa85ab3[_0x93926d['name']]={'$like':'%'+_0x7bea85['query'][_0xaf65('0x3a')]+'%'};return _0xa85ab3;}})});}_0x47f557=_[_0xaf65('0x3b')]({},_0x47f557,_0x7bea85['options']);var _0x3e92cf={'where':_0x47f557['where']};return db['CmHopperFinal'][_0xaf65('0x1f')](_0x3e92cf)[_0xaf65('0x26')](function(_0x3e8bc6){_0x4083fe[_0xaf65('0x1f')]=_0x3e8bc6;if(_0x7bea85[_0xaf65('0x31')][_0xaf65('0x3c')]){_0x47f557['include']=[{'all':!![]}];}return db[_0xaf65('0x3d')]['findAll'](_0x47f557);})[_0xaf65('0x26')](function(_0x4d9015){_0x4083fe[_0xaf65('0x3e')]=_0x4d9015;return _0x4083fe;})['then'](respondWithFilteredResult(_0x56b143,_0x47f557))[_0xaf65('0x3f')](handleError(_0x56b143,null));};exports[_0xaf65('0x40')]=function(_0x5f390f,_0x3d3f5a){var _0xc98ae3={'raw':!![],'where':{'id':_0x5f390f['params']['id']}},_0x4e0f76={};_0x4e0f76[_0xaf65('0x30')]=_['keys'](db[_0xaf65('0x3d')]['rawAttributes']);_0x4e0f76[_0xaf65('0x31')]=_[_0xaf65('0x41')](_0x5f390f[_0xaf65('0x31')]);_0x4e0f76[_0xaf65('0x32')]=_[_0xaf65('0x33')](_0x4e0f76[_0xaf65('0x30')],_0x4e0f76[_0xaf65('0x31')]);_0xc98ae3[_0xaf65('0x35')]=_[_0xaf65('0x33')](_0x4e0f76['model'],qs['fields'](_0x5f390f[_0xaf65('0x31')]['fields']));_0xc98ae3[_0xaf65('0x35')]=_0xc98ae3[_0xaf65('0x35')][_0xaf65('0x42')]?_0xc98ae3[_0xaf65('0x35')]:_0x4e0f76[_0xaf65('0x30')];if(_0x5f390f['query'][_0xaf65('0x3c')]){_0xc98ae3['include']=[{'all':!![]}];}_0xc98ae3=_['merge']({},_0xc98ae3,_0x5f390f['options']);return db[_0xaf65('0x3d')][_0xaf65('0x43')](_0xc98ae3)[_0xaf65('0x26')](handleEntityNotFound(_0x3d3f5a,null))[_0xaf65('0x26')](respondWithResult(_0x3d3f5a,null))[_0xaf65('0x3f')](handleError(_0x3d3f5a,null));};exports[_0xaf65('0x44')]=function(_0x1da796,_0x57577b){return db[_0xaf65('0x3d')][_0xaf65('0x44')]()[_0xaf65('0x26')](respondWithResult(_0x57577b,null))[_0xaf65('0x3f')](handleError(_0x57577b,null));};exports['update']=function(_0x23635b,_0x4371f5){if(_0x23635b[_0xaf65('0x45')][_0xaf65('0x46')]){delete _0x23635b['body'][_0xaf65('0x46')];}return db[_0xaf65('0x3d')][_0xaf65('0x43')]({'where':{'uniqueid':_0x23635b[_0xaf65('0x47')]['id']}})[_0xaf65('0x26')](handleEntityNotFound(_0x4371f5,null))[_0xaf65('0x26')](saveUpdates(_0x23635b[_0xaf65('0x45')],null))[_0xaf65('0x26')](respondWithResult(_0x4371f5,null))[_0xaf65('0x3f')](handleError(_0x4371f5,null));};exports[_0xaf65('0x48')]=function(_0x156924,_0x557a93,_0x25fa94){return db['CmHopperFinal'][_0xaf65('0x49')]({'raw':![],'where':{'VoiceQueueId':_0x156924[_0xaf65('0x47')]['id']},'attributes':[[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x4d')))),'noSuchContacts'],[db['sequelize']['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x4e')))),_0xaf65('0x4f')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db['sequelize']['fn']('IF',db[_0xaf65('0x4a')]['literal'](_0xaf65('0x50')))),_0xaf65('0x51')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x52')))),_0xaf65('0x53')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x54')))),'abandonedContacts'],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x55')))),_0xaf65('0x56')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db['sequelize'][_0xaf65('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0xaf65('0x57')]]})[_0xaf65('0x26')](handleEntityNotFound(_0x557a93,null))['then'](respondWithResult(_0x557a93,null))[_0xaf65('0x3f')](handleError(_0x557a93,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x493985,_0x8e3ed0,_0xaea82e){return db[_0xaf65('0x3d')][_0xaf65('0x49')]({'raw':![],'where':{'CampaignId':_0x493985[_0xaf65('0x47')]['id']},'attributes':[[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x4d')))),'noSuchContacts'],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')]['literal'](_0xaf65('0x4e')))),_0xaf65('0x4f')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db['sequelize'][_0xaf65('0x4c')](_0xaf65('0x50')))),_0xaf65('0x51')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db['sequelize']['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x58')))),_0xaf65('0x59')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')]['literal'](_0xaf65('0x52')))),_0xaf65('0x53')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db['sequelize'][_0xaf65('0x4c')](_0xaf65('0x54')))),_0xaf65('0x5a')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db['sequelize']['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x5b')))),_0xaf65('0x57')]]})['then'](handleEntityNotFound(_0x8e3ed0,null))[_0xaf65('0x26')](respondWithResult(_0x8e3ed0,null))[_0xaf65('0x3f')](handleError(_0x8e3ed0,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2036de,_0x2a7f11,_0x51e704){return db[_0xaf65('0x5c')]['find']({'where':{'id':_0x2036de[_0xaf65('0x47')]['id']}})[_0xaf65('0x26')](handleEntityNotFound(_0x2a7f11,null))[_0xaf65('0x26')](function(_0xd345fa){var _0x5d1b39;if(_0xd345fa){_0x5d1b39=squel[_0xaf65('0x5d')]()[_0xaf65('0x5e')](_0xaf65('0x5f'))['fromQuery'](['phone',_0xaf65('0x60'),_0xaf65('0x61'),'ListId',_0xaf65('0x62'),_0xaf65('0x63'),_0xaf65('0x64')],squel[_0xaf65('0x65')]()[_0xaf65('0x66')](_0xaf65('0x67'),'phone')['field']('NOW()',_0xaf65('0x60'))[_0xaf65('0x66')](_0xaf65('0x68'),'ContactId')['field'](_0xaf65('0x69'),'ListId')[_0xaf65('0x66')](_0xaf65('0x6a'),_0xaf65('0x62'))[_0xaf65('0x66')]('NOW()',_0xaf65('0x63'))[_0xaf65('0x66')]('NOW()',_0xaf65('0x64'))[_0xaf65('0x6b')](_0xaf65('0x6c'))['where']('VoiceQueueId\x20=\x20?',_0x2036de[_0xaf65('0x47')]['id']['toString']())[_0xaf65('0x39')](_0xaf65('0x6d'),_0x2036de['body'][_0xaf65('0x6e')][_0xaf65('0x6f')]())[_0xaf65('0x39')](_0xaf65('0x70'))[_0xaf65('0x39')](_0xaf65('0x71'),squel[_0xaf65('0x65')]()['field'](_0xaf65('0x72'))[_0xaf65('0x6b')](_0xaf65('0x5f'))['where'](_0xaf65('0x73'),_0x2036de[_0xaf65('0x47')]['id'][_0xaf65('0x6f')]()))[_0xaf65('0x39')](_0xaf65('0x71'),squel['select']()['field'](_0xaf65('0x74'))[_0xaf65('0x6b')](_0xaf65('0x6c'))[_0xaf65('0x39')]('VoiceQueueId\x20=\x20?',_0x2036de[_0xaf65('0x47')]['id'][_0xaf65('0x6f')]())[_0xaf65('0x39')](_0xaf65('0x75')))[_0xaf65('0x76')]('ContactId'))[_0xaf65('0x6f')]();return db['sequelize']['query'](_0x5d1b39);}return[];})[_0xaf65('0x26')](respondWithResult(_0x2a7f11,null))[_0xaf65('0x3f')](handleError(_0x2a7f11,null));};exports[_0xaf65('0x77')]=function(_0x5a4e7c,_0x2eba14,_0x1b3d39){return db[_0xaf65('0x78')][_0xaf65('0x43')]({'where':{'id':_0x5a4e7c['params']['id']}})[_0xaf65('0x26')](handleEntityNotFound(_0x2eba14,null))[_0xaf65('0x26')](function(_0x16e3cc){var _0x22aad1;if(_0x16e3cc){_0x22aad1=squel[_0xaf65('0x5d')]()['into'](_0xaf65('0x5f'))['fromQuery']([_0xaf65('0x72'),_0xaf65('0x60'),'ContactId',_0xaf65('0x79'),'CampaignId','createdAt',_0xaf65('0x64')],squel['select']()[_0xaf65('0x66')]('ANY_VALUE(calleridnum)','phone')[_0xaf65('0x66')](_0xaf65('0x7a'),'scheduledAt')[_0xaf65('0x66')](_0xaf65('0x68'),_0xaf65('0x61'))[_0xaf65('0x66')](_0xaf65('0x69'),'ListId')[_0xaf65('0x66')](_0xaf65('0x7b'),_0xaf65('0x7c'))[_0xaf65('0x66')](_0xaf65('0x7a'),_0xaf65('0x63'))[_0xaf65('0x66')](_0xaf65('0x7a'),_0xaf65('0x64'))[_0xaf65('0x6b')](_0xaf65('0x6c'))[_0xaf65('0x39')](_0xaf65('0x7d'),_0x5a4e7c['params']['id'][_0xaf65('0x6f')]())[_0xaf65('0x39')](_0xaf65('0x6d'),_0x5a4e7c[_0xaf65('0x45')][_0xaf65('0x6e')][_0xaf65('0x6f')]())['where'](_0xaf65('0x70'))[_0xaf65('0x39')](_0xaf65('0x71'),squel[_0xaf65('0x65')]()['field']('phone')['from'](_0xaf65('0x5f'))[_0xaf65('0x39')](_0xaf65('0x7d'),_0x5a4e7c[_0xaf65('0x47')]['id'][_0xaf65('0x6f')]()))['where'](_0xaf65('0x71'),squel['select']()[_0xaf65('0x66')](_0xaf65('0x74'))[_0xaf65('0x6b')](_0xaf65('0x6c'))[_0xaf65('0x39')]('CampaignId\x20=\x20?',_0x5a4e7c[_0xaf65('0x47')]['id']['toString']())[_0xaf65('0x39')]('state\x20=\x204'))[_0xaf65('0x76')]('ContactId'))['toString']();return db['sequelize'][_0xaf65('0x31')](_0x22aad1);}return[];})[_0xaf65('0x26')](respondWithResult(_0x2eba14,null))[_0xaf65('0x3f')](handleError(_0x2eba14,null));};exports[_0xaf65('0x7e')]=function(_0x21f33d,_0x4acd4b,_0x1ca824){return db[_0xaf65('0x7f')][_0xaf65('0x80')]({'where':{'VoiceQueueId':_0x21f33d['body']['VoiceQueueId'],'CampaignId':_0x21f33d[_0xaf65('0x45')][_0xaf65('0x7c')],'ContactId':_0x21f33d[_0xaf65('0x45')]['ContactId']}})[_0xaf65('0x26')](handleEntityNotFound(_0x4acd4b,null))['then'](function(_0x4f1c5f){if(_0x4f1c5f){return _0x4f1c5f;}return null;})[_0xaf65('0x26')](respondWithResult(_0x4acd4b,null))['catch'](handleError(_0x4acd4b,null));}; \ No newline at end of file +var _0xaffa=['group','ContactId','Campaign','cm_hopper','fromQuery','phone','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','CampaignId','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','include','merge','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','scheduledAt','createdAt','field','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','toString','state\x20=\x204'];(function(_0xce1a87,_0x372c44){var _0x26669d=function(_0x215038){while(--_0x215038){_0xce1a87['push'](_0xce1a87['shift']());}};_0x26669d(++_0x372c44);}(_0xaffa,0x11d));var _0xaaff=function(_0x12595a,_0x2af6b5){_0x12595a=_0x12595a-0x0;var _0x54ddfa=_0xaffa[_0x12595a];return _0x54ddfa;};'use strict';var pdf=require(_0xaaff('0x0'));var emlformat=require(_0xaaff('0x1'));var rimraf=require(_0xaaff('0x2'));var zipdir=require(_0xaaff('0x3'));var jsonpatch=require(_0xaaff('0x4'));var rp=require(_0xaaff('0x5'));var moment=require(_0xaaff('0x6'));var BPromise=require(_0xaaff('0x7'));var Mustache=require(_0xaaff('0x8'));var util=require(_0xaaff('0x9'));var path=require(_0xaaff('0xa'));var sox=require(_0xaaff('0xb'));var csv=require(_0xaaff('0xc'));var ejs=require(_0xaaff('0xd'));var fs=require('fs');var fs_extra=require(_0xaaff('0xe'));var _=require(_0xaaff('0xf'));var squel=require(_0xaaff('0x10'));var crypto=require(_0xaaff('0x11'));var jsforce=require(_0xaaff('0x12'));var deskjs=require(_0xaaff('0x13'));var toCsv=require(_0xaaff('0xc'));var querystring=require('querystring');var Papa=require(_0xaaff('0x14'));var Redis=require('ioredis');var authService=require(_0xaaff('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xaaff('0x16'));var hardwareService=require(_0xaaff('0x17'));var logger=require('../../config/logger')(_0xaaff('0x18'));var utils=require('../../config/utils');var config=require(_0xaaff('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x509312,_0x5c97a9){_0x5c97a9=_0x5c97a9||0xcc;return function(_0x5f5b4a){if(_0x5f5b4a){return _0x509312[_0xaaff('0x1a')](_0x5c97a9);}return _0x509312[_0xaaff('0x1b')](_0x5c97a9)[_0xaaff('0x1c')]();};}function respondWithResult(_0x1e8c4e,_0x2925e4){_0x2925e4=_0x2925e4||0xc8;return function(_0x159142){if(_0x159142){return _0x1e8c4e['status'](_0x2925e4)[_0xaaff('0x1d')](_0x159142);}};}function respondWithFilteredResult(_0x5e10bd,_0x573678){return function(_0x5f51d7){if(_0x5f51d7){var _0x2311fe=_0x5f51d7[_0xaaff('0x1e')],_0x31599e=_0x573678[_0xaaff('0x1f')],_0x26a964=_0x573678['offset']+_0x573678[_0xaaff('0x20')],_0x2b8eb0;if(_0x26a964>=_0x2311fe){_0x26a964=_0x2311fe;_0x2b8eb0=0xc8;}else{_0x2b8eb0=0xce;}_0x5e10bd[_0xaaff('0x1b')](_0x2b8eb0);return _0x5e10bd[_0xaaff('0x21')]('Content-Range',_0x31599e+'-'+_0x26a964+'/'+_0x2311fe)[_0xaaff('0x1d')](_0x5f51d7);}return null;};}function patchUpdates(_0x477cfe){return function(_0x50fed5){try{jsonpatch[_0xaaff('0x22')](_0x50fed5,_0x477cfe,!![]);}catch(_0x55d88f){return BPromise['reject'](_0x55d88f);}return _0x50fed5[_0xaaff('0x23')]();};}function saveUpdates(_0x311af4,_0x9d3642){return function(_0x1ac56c){if(_0x1ac56c){return _0x1ac56c[_0xaaff('0x24')](_0x311af4)[_0xaaff('0x25')](function(_0x141fe0){return _0x141fe0;});}return null;};}function removeEntity(_0x113a3e,_0x8cdf3f){return function(_0x98eb26){if(_0x98eb26){return _0x98eb26['destroy']()[_0xaaff('0x25')](function(){_0x113a3e[_0xaaff('0x1b')](0xcc)[_0xaaff('0x1c')]();});}};}function handleEntityNotFound(_0x2f8753,_0x487ae0){return function(_0x1dc7de){if(!_0x1dc7de){_0x2f8753[_0xaaff('0x1a')](0x194);}return _0x1dc7de;};}function handleError(_0x129eb7,_0x137595){_0x137595=_0x137595||0x1f4;return function(_0x5c7fec){logger[_0xaaff('0x26')](_0x5c7fec[_0xaaff('0x27')]);if(_0x5c7fec[_0xaaff('0x28')]){delete _0x5c7fec[_0xaaff('0x28')];}_0x129eb7['status'](_0x137595)[_0xaaff('0x29')](_0x5c7fec);};}exports[_0xaaff('0x2a')]=function(_0x54c03b,_0x566edc){var _0x15827d={},_0x2610af={},_0x15435e={'count':0x0,'rows':[]};var _0x2ae8c1=_[_0xaaff('0x2b')](db[_0xaaff('0x2c')][_0xaaff('0x2d')],function(_0x421b64){return{'name':_0x421b64[_0xaaff('0x2e')],'type':_0x421b64[_0xaaff('0x2f')][_0xaaff('0x30')]};});_0x2610af[_0xaaff('0x31')]=_[_0xaaff('0x2b')](_0x2ae8c1,_0xaaff('0x28'));_0x2610af[_0xaaff('0x32')]=_[_0xaaff('0x33')](_0x54c03b[_0xaaff('0x32')]);_0x2610af[_0xaaff('0x34')]=_[_0xaaff('0x35')](_0x2610af[_0xaaff('0x31')],_0x2610af[_0xaaff('0x32')]);_0x15827d[_0xaaff('0x36')]=_[_0xaaff('0x35')](_0x2610af[_0xaaff('0x31')],qs[_0xaaff('0x37')](_0x54c03b['query'][_0xaaff('0x37')]));_0x15827d[_0xaaff('0x36')]=_0x15827d[_0xaaff('0x36')][_0xaaff('0x38')]?_0x15827d[_0xaaff('0x36')]:_0x2610af[_0xaaff('0x31')];if(!_0x54c03b[_0xaaff('0x32')][_0xaaff('0x39')](_0xaaff('0x3a'))){_0x15827d[_0xaaff('0x20')]=qs[_0xaaff('0x20')](_0x54c03b[_0xaaff('0x32')][_0xaaff('0x20')]);_0x15827d[_0xaaff('0x1f')]=qs['offset'](_0x54c03b['query'][_0xaaff('0x1f')]);}_0x15827d[_0xaaff('0x3b')]=qs[_0xaaff('0x3c')](_0x54c03b['query'][_0xaaff('0x3c')]);_0x15827d[_0xaaff('0x3d')]=qs[_0xaaff('0x34')](_['pick'](_0x54c03b['query'],_0x2610af[_0xaaff('0x34')]),_0x2ae8c1);if(_0x54c03b[_0xaaff('0x32')][_0xaaff('0x3e')]){_0x15827d[_0xaaff('0x3d')]=_['merge'](_0x15827d[_0xaaff('0x3d')],{'$or':_[_0xaaff('0x2b')](_0x2ae8c1,function(_0x1df4fb){if(_0x1df4fb[_0xaaff('0x2f')]!==_0xaaff('0x3f')){var _0x17a09a={};_0x17a09a[_0x1df4fb[_0xaaff('0x28')]]={'$like':'%'+_0x54c03b['query'][_0xaaff('0x3e')]+'%'};return _0x17a09a;}})});}_0x15827d=_['merge']({},_0x15827d,_0x54c03b[_0xaaff('0x40')]);var _0x1f842e={'where':_0x15827d[_0xaaff('0x3d')]};return db[_0xaaff('0x2c')][_0xaaff('0x1e')](_0x1f842e)['then'](function(_0x2d0416){_0x15435e[_0xaaff('0x1e')]=_0x2d0416;if(_0x54c03b[_0xaaff('0x32')][_0xaaff('0x41')]){_0x15827d['include']=[{'all':!![]}];}return db[_0xaaff('0x2c')][_0xaaff('0x42')](_0x15827d);})[_0xaaff('0x25')](function(_0x39985c){_0x15435e[_0xaaff('0x43')]=_0x39985c;return _0x15435e;})['then'](respondWithFilteredResult(_0x566edc,_0x15827d))['catch'](handleError(_0x566edc,null));};exports[_0xaaff('0x44')]=function(_0x3a6438,_0x49e0df){var _0x5d914a={'raw':!![],'where':{'id':_0x3a6438[_0xaaff('0x45')]['id']}},_0x286754={};_0x286754[_0xaaff('0x31')]=_[_0xaaff('0x33')](db['CmHopperFinal'][_0xaaff('0x2d')]);_0x286754['query']=_[_0xaaff('0x33')](_0x3a6438[_0xaaff('0x32')]);_0x286754[_0xaaff('0x34')]=_[_0xaaff('0x35')](_0x286754[_0xaaff('0x31')],_0x286754[_0xaaff('0x32')]);_0x5d914a[_0xaaff('0x36')]=_[_0xaaff('0x35')](_0x286754['model'],qs[_0xaaff('0x37')](_0x3a6438[_0xaaff('0x32')][_0xaaff('0x37')]));_0x5d914a['attributes']=_0x5d914a[_0xaaff('0x36')][_0xaaff('0x38')]?_0x5d914a[_0xaaff('0x36')]:_0x286754[_0xaaff('0x31')];if(_0x3a6438['query'][_0xaaff('0x41')]){_0x5d914a[_0xaaff('0x46')]=[{'all':!![]}];}_0x5d914a=_[_0xaaff('0x47')]({},_0x5d914a,_0x3a6438[_0xaaff('0x40')]);return db[_0xaaff('0x2c')][_0xaaff('0x48')](_0x5d914a)[_0xaaff('0x25')](handleEntityNotFound(_0x49e0df,null))[_0xaaff('0x25')](respondWithResult(_0x49e0df,null))[_0xaaff('0x49')](handleError(_0x49e0df,null));};exports[_0xaaff('0x4a')]=function(_0x29c40b,_0xc7527e){return db[_0xaaff('0x2c')][_0xaaff('0x4a')]()['then'](respondWithResult(_0xc7527e,null))[_0xaaff('0x49')](handleError(_0xc7527e,null));};exports[_0xaaff('0x24')]=function(_0x23b5e3,_0x39ee7d){if(_0x23b5e3[_0xaaff('0x4b')][_0xaaff('0x4c')]){delete _0x23b5e3['body'][_0xaaff('0x4c')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x23b5e3[_0xaaff('0x45')]['id']}})['then'](handleEntityNotFound(_0x39ee7d,null))[_0xaaff('0x25')](saveUpdates(_0x23b5e3['body'],null))[_0xaaff('0x25')](respondWithResult(_0x39ee7d,null))[_0xaaff('0x49')](handleError(_0x39ee7d,null));};exports[_0xaaff('0x4d')]=function(_0x106671,_0x49b636,_0x386f08){return db[_0xaaff('0x2c')][_0xaaff('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x106671[_0xaaff('0x45')]['id']},'attributes':[[db[_0xaaff('0x4e')]['fn'](_0xaaff('0x4f'),db[_0xaaff('0x4e')]['fn']('IF',db['sequelize'][_0xaaff('0x50')](_0xaaff('0x51')))),_0xaaff('0x52')],[db[_0xaaff('0x4e')]['fn']('COUNT',db[_0xaaff('0x4e')]['fn']('IF',db[_0xaaff('0x4e')][_0xaaff('0x50')](_0xaaff('0x53')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xaaff('0x4f'),db['sequelize']['fn']('IF',db[_0xaaff('0x4e')][_0xaaff('0x50')](_0xaaff('0x54')))),_0xaaff('0x55')],[db[_0xaaff('0x4e')]['fn'](_0xaaff('0x4f'),db[_0xaaff('0x4e')]['fn']('IF',db[_0xaaff('0x4e')][_0xaaff('0x50')](_0xaaff('0x56')))),'congestionContacts'],[db[_0xaaff('0x4e')]['fn'](_0xaaff('0x4f'),db['sequelize']['fn']('IF',db[_0xaaff('0x4e')][_0xaaff('0x50')](_0xaaff('0x57')))),'dropContacts'],[db['sequelize']['fn'](_0xaaff('0x4f'),db[_0xaaff('0x4e')]['fn']('IF',db[_0xaaff('0x4e')][_0xaaff('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xaaff('0x58')],[db[_0xaaff('0x4e')]['fn'](_0xaaff('0x4f'),db[_0xaaff('0x4e')]['fn']('IF',db[_0xaaff('0x4e')][_0xaaff('0x50')](_0xaaff('0x59')))),_0xaaff('0x5a')],[db[_0xaaff('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xaaff('0x4e')][_0xaaff('0x50')](_0xaaff('0x5b')))),_0xaaff('0x5c')]]})[_0xaaff('0x25')](handleEntityNotFound(_0x49b636,null))[_0xaaff('0x25')](respondWithResult(_0x49b636,null))['catch'](handleError(_0x49b636,null));};exports[_0xaaff('0x5d')]=function(_0xa16808,_0x5eee8a,_0xa5aef4){return db[_0xaaff('0x2c')]['findAll']({'raw':![],'where':{'CampaignId':_0xa16808['params']['id']},'attributes':[[db['sequelize']['fn'](_0xaaff('0x4f'),db[_0xaaff('0x4e')]['fn']('IF',db[_0xaaff('0x4e')][_0xaaff('0x50')](_0xaaff('0x51')))),_0xaaff('0x52')],[db['sequelize']['fn'](_0xaaff('0x4f'),db[_0xaaff('0x4e')]['fn']('IF',db[_0xaaff('0x4e')][_0xaaff('0x50')](_0xaaff('0x53')))),_0xaaff('0x5e')],[db[_0xaaff('0x4e')]['fn'](_0xaaff('0x4f'),db[_0xaaff('0x4e')]['fn']('IF',db[_0xaaff('0x4e')][_0xaaff('0x50')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0xaaff('0x4e')]['fn'](_0xaaff('0x4f'),db['sequelize']['fn']('IF',db[_0xaaff('0x4e')][_0xaaff('0x50')](_0xaaff('0x56')))),_0xaaff('0x5f')],[db[_0xaaff('0x4e')]['fn'](_0xaaff('0x4f'),db[_0xaaff('0x4e')]['fn']('IF',db[_0xaaff('0x4e')][_0xaaff('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xaaff('0x60')],[db['sequelize']['fn'](_0xaaff('0x4f'),db[_0xaaff('0x4e')]['fn']('IF',db[_0xaaff('0x4e')][_0xaaff('0x50')](_0xaaff('0x61')))),_0xaaff('0x58')],[db[_0xaaff('0x4e')]['fn'](_0xaaff('0x4f'),db[_0xaaff('0x4e')]['fn']('IF',db[_0xaaff('0x4e')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0xaaff('0x5a')],[db[_0xaaff('0x4e')]['fn']('COUNT',db[_0xaaff('0x4e')]['fn']('IF',db[_0xaaff('0x4e')][_0xaaff('0x50')]('`state`\x20=\x2019,\x201,\x20null'))),_0xaaff('0x5c')]]})['then'](handleEntityNotFound(_0x5eee8a,null))['then'](respondWithResult(_0x5eee8a,null))[_0xaaff('0x49')](handleError(_0x5eee8a,null));};exports[_0xaaff('0x62')]=function(_0x87a0da,_0xe6e8,_0x406b5c){return db[_0xaaff('0x63')]['find']({'where':{'id':_0x87a0da['params']['id']}})['then'](handleEntityNotFound(_0xe6e8,null))[_0xaaff('0x25')](function(_0x346a8e){var _0x39bf77;if(_0x346a8e){_0x39bf77=squel[_0xaaff('0x64')]()[_0xaaff('0x65')]('cm_hopper')['fromQuery'](['phone',_0xaaff('0x66'),'ContactId','ListId','VoiceQueueId',_0xaaff('0x67'),'updatedAt'],squel['select']()[_0xaaff('0x68')]('ANY_VALUE(calleridnum)','phone')[_0xaaff('0x68')]('NOW()','scheduledAt')[_0xaaff('0x68')]('ANY_VALUE(ContactId)','ContactId')[_0xaaff('0x68')]('ANY_VALUE(ListId)',_0xaaff('0x69'))[_0xaaff('0x68')](_0xaaff('0x6a'),_0xaaff('0x6b'))[_0xaaff('0x68')]('NOW()',_0xaaff('0x67'))['field'](_0xaaff('0x6c'),_0xaaff('0x6d'))[_0xaaff('0x6e')](_0xaaff('0x6f'))[_0xaaff('0x3d')](_0xaaff('0x70'),_0x87a0da[_0xaaff('0x45')]['id']['toString']())['where'](_0xaaff('0x71'),_0x87a0da[_0xaaff('0x4b')][_0xaaff('0x72')]['toString']())['where'](_0xaaff('0x73'))['where'](_0xaaff('0x74'),squel[_0xaaff('0x75')]()['field']('phone')[_0xaaff('0x6e')]('cm_hopper')[_0xaaff('0x3d')](_0xaaff('0x70'),_0x87a0da[_0xaaff('0x45')]['id'][_0xaaff('0x76')]()))[_0xaaff('0x3d')](_0xaaff('0x74'),squel['select']()[_0xaaff('0x68')]('calleridnum')[_0xaaff('0x6e')]('cm_hopper_final')['where'](_0xaaff('0x70'),_0x87a0da['params']['id'][_0xaaff('0x76')]())['where'](_0xaaff('0x77')))[_0xaaff('0x78')](_0xaaff('0x79')))[_0xaaff('0x76')]();return db[_0xaaff('0x4e')][_0xaaff('0x32')](_0x39bf77);}return[];})[_0xaaff('0x25')](respondWithResult(_0xe6e8,null))[_0xaaff('0x49')](handleError(_0xe6e8,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x2a92b3,_0x51f068,_0x411825){return db[_0xaaff('0x7a')][_0xaaff('0x48')]({'where':{'id':_0x2a92b3[_0xaaff('0x45')]['id']}})[_0xaaff('0x25')](handleEntityNotFound(_0x51f068,null))['then'](function(_0x3aa0fa){var _0x418d1a;if(_0x3aa0fa){_0x418d1a=squel[_0xaaff('0x64')]()[_0xaaff('0x65')](_0xaaff('0x7b'))[_0xaaff('0x7c')]([_0xaaff('0x7d'),_0xaaff('0x66'),_0xaaff('0x79'),_0xaaff('0x69'),'CampaignId',_0xaaff('0x67'),_0xaaff('0x6d')],squel[_0xaaff('0x75')]()[_0xaaff('0x68')](_0xaaff('0x7e'),_0xaaff('0x7d'))[_0xaaff('0x68')](_0xaaff('0x6c'),_0xaaff('0x66'))[_0xaaff('0x68')](_0xaaff('0x7f'),_0xaaff('0x79'))[_0xaaff('0x68')](_0xaaff('0x80'),_0xaaff('0x69'))[_0xaaff('0x68')]('ANY_VALUE(CampaignId)',_0xaaff('0x81'))[_0xaaff('0x68')](_0xaaff('0x6c'),_0xaaff('0x67'))[_0xaaff('0x68')](_0xaaff('0x6c'),_0xaaff('0x6d'))[_0xaaff('0x6e')](_0xaaff('0x6f'))['where'](_0xaaff('0x82'),_0x2a92b3[_0xaaff('0x45')]['id'][_0xaaff('0x76')]())[_0xaaff('0x3d')](_0xaaff('0x71'),_0x2a92b3['body'][_0xaaff('0x72')]['toString']())[_0xaaff('0x3d')](_0xaaff('0x73'))[_0xaaff('0x3d')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xaaff('0x75')]()['field']('phone')[_0xaaff('0x6e')](_0xaaff('0x7b'))[_0xaaff('0x3d')](_0xaaff('0x82'),_0x2a92b3[_0xaaff('0x45')]['id'][_0xaaff('0x76')]()))[_0xaaff('0x3d')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xaaff('0x68')](_0xaaff('0x83'))['from'](_0xaaff('0x6f'))['where'](_0xaaff('0x82'),_0x2a92b3[_0xaaff('0x45')]['id']['toString']())['where'](_0xaaff('0x77')))['group']('ContactId'))['toString']();return db[_0xaaff('0x4e')][_0xaaff('0x32')](_0x418d1a);}return[];})[_0xaaff('0x25')](respondWithResult(_0x51f068,null))[_0xaaff('0x49')](handleError(_0x51f068,null));};exports[_0xaaff('0x84')]=function(_0x365b18,_0x5d1409,_0x4cdc03){return db[_0xaaff('0x85')][_0xaaff('0x86')]({'where':{'VoiceQueueId':_0x365b18[_0xaaff('0x4b')]['VoiceQueueId'],'CampaignId':_0x365b18[_0xaaff('0x4b')][_0xaaff('0x81')],'ContactId':_0x365b18['body'][_0xaaff('0x79')]}})[_0xaaff('0x25')](handleEntityNotFound(_0x5d1409,null))[_0xaaff('0x25')](function(_0x5c8028){if(_0x5c8028){return _0x5c8028;}return null;})[_0xaaff('0x25')](respondWithResult(_0x5d1409,null))['catch'](handleError(_0x5d1409,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 6ebdb5f..129beb2 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 _0x2782=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util'];(function(_0x251b2f,_0x1d8eb7){var _0xffe34c=function(_0x387c72){while(--_0x387c72){_0x251b2f['push'](_0x251b2f['shift']());}};_0xffe34c(++_0x1d8eb7);}(_0x2782,0xee));var _0x2278=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x2782[_0x695b76];return _0x1dc21f;};'use strict';var _=require(_0x2278('0x0'));var util=require(_0x2278('0x1'));var logger=require(_0x2278('0x2'))(_0x2278('0x3'));var moment=require('moment');var BPromise=require(_0x2278('0x4'));var rp=require(_0x2278('0x5'));var fs=require('fs');var path=require(_0x2278('0x6'));var rimraf=require(_0x2278('0x7'));var config=require(_0x2278('0x8'));var attributes=require(_0x2278('0x9'));module[_0x2278('0xa')]=function(_0x349013,_0x400796){return _0x349013[_0x2278('0xb')](_0x2278('0xc'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x2278('0xd'),'fields':[_0x2278('0xd')]},{'name':_0x2278('0xe'),'fields':[_0x2278('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc646=['../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api','moment','request-promise','path'];(function(_0xd042e8,_0x111505){var _0x137e8b=function(_0x1c3f44){while(--_0x1c3f44){_0xd042e8['push'](_0xd042e8['shift']());}};_0x137e8b(++_0x111505);}(_0xc646,0x158));var _0x6c64=function(_0xdf5fc5,_0x37255b){_0xdf5fc5=_0xdf5fc5-0x0;var _0x52f5a5=_0xc646[_0xdf5fc5];return _0x52f5a5;};'use strict';var _=require('lodash');var util=require(_0x6c64('0x0'));var logger=require(_0x6c64('0x1'))(_0x6c64('0x2'));var moment=require(_0x6c64('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c64('0x4'));var fs=require('fs');var path=require(_0x6c64('0x5'));var rimraf=require('rimraf');var config=require(_0x6c64('0x6'));var attributes=require(_0x6c64('0x7'));module[_0x6c64('0x8')]=function(_0x3bdc67,_0x5d912d){return _0x3bdc67[_0x6c64('0x9')](_0x6c64('0xa'),attributes,{'tableName':_0x6c64('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x6c64('0xc')]},{'name':_0x6c64('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 2620926..0547de3 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 _0x85f5=['error','code','message','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s'];(function(_0xe9b70f,_0x5cd0f9){var _0x57aab9=function(_0xe4ddc3){while(--_0xe4ddc3){_0xe9b70f['push'](_0xe9b70f['shift']());}};_0x57aab9(++_0x5cd0f9);}(_0x85f5,0x167));var _0x585f=function(_0x26658e,_0x1bb1a9){_0x26658e=_0x26658e-0x0;var _0x572802=_0x85f5[_0x26658e];return _0x572802;};'use strict';var _=require(_0x585f('0x0'));var util=require('util');var moment=require(_0x585f('0x1'));var BPromise=require(_0x585f('0x2'));var rs=require(_0x585f('0x3'));var fs=require('fs');var Redis=require(_0x585f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x585f('0x5'));var logger=require(_0x585f('0x6'))(_0x585f('0x7'));var config=require(_0x585f('0x8'));var jayson=require(_0x585f('0x9'));var client=jayson['client'][_0x585f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11a16f,_0x550ad5,_0x35f1ce){return new BPromise(function(_0x4b6a63,_0x48a8e4){return client[_0x585f('0xb')](_0x11a16f,_0x35f1ce)[_0x585f('0xc')](function(_0x2d602d){logger[_0x585f('0xd')](_0x585f('0xe'),_0x550ad5,_0x585f('0xf'));logger[_0x585f('0x10')](_0x585f('0x11'),_0x550ad5,'request\x20sent',JSON['stringify'](_0x2d602d));if(_0x2d602d[_0x585f('0x12')]){if(_0x2d602d['error'][_0x585f('0x13')]===0x1f4){logger[_0x585f('0x12')](_0x585f('0xe'),_0x550ad5,_0x2d602d[_0x585f('0x12')][_0x585f('0x14')]);return _0x48a8e4(_0x2d602d[_0x585f('0x12')][_0x585f('0x14')]);}logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x550ad5,_0x2d602d[_0x585f('0x12')]['message']);return _0x4b6a63(_0x2d602d[_0x585f('0x12')][_0x585f('0x14')]);}else{logger[_0x585f('0xd')](_0x585f('0xe'),_0x550ad5,_0x585f('0xf'));_0x4b6a63(_0x2d602d['result'][_0x585f('0x14')]);}})[_0x585f('0x15')](function(_0x3686a4){logger[_0x585f('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x550ad5,_0x3686a4);_0x48a8e4(_0x3686a4);});});}exports[_0x585f('0x16')]=function(_0x72f935){var _0x771416=this;return new Promise(function(_0x9fef18,_0x1e8824){return db[_0x585f('0x17')][_0x585f('0x18')](_0x72f935[_0x585f('0x19')],{'raw':_0x72f935[_0x585f('0x1a')]?_0x72f935[_0x585f('0x1a')][_0x585f('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x466b46){logger['info'](_0x585f('0x16'),_0x72f935);logger[_0x585f('0x10')]('CreateCmHopperFinal',_0x72f935,JSON[_0x585f('0x1c')](_0x466b46));_0x9fef18(_0x466b46);})[_0x585f('0x15')](function(_0x5477f9){logger[_0x585f('0x12')](_0x585f('0x16'),_0x5477f9['message'],_0x72f935);_0x1e8824(_0x771416['error'](0x1f4,_0x5477f9['message']));});});}; \ No newline at end of file +var _0x6d1a=['CreateCmHopperFinal','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','CmHopperFinal','create','body','options','raw'];(function(_0x4d2e07,_0xcee858){var _0xc9563a=function(_0x170216){while(--_0x170216){_0x4d2e07['push'](_0x4d2e07['shift']());}};_0xc9563a(++_0xcee858);}(_0x6d1a,0x198));var _0xa6d1=function(_0x18facc,_0x19c3e8){_0x18facc=_0x18facc-0x0;var _0xe7d080=_0x6d1a[_0x18facc];return _0xe7d080;};'use strict';var _=require(_0xa6d1('0x0'));var util=require(_0xa6d1('0x1'));var moment=require(_0xa6d1('0x2'));var BPromise=require('bluebird');var rs=require(_0xa6d1('0x3'));var fs=require('fs');var Redis=require(_0xa6d1('0x4'));var db=require(_0xa6d1('0x5'))['db'];var utils=require(_0xa6d1('0x6'));var logger=require(_0xa6d1('0x7'))(_0xa6d1('0x8'));var config=require(_0xa6d1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa6d1('0xa')][_0xa6d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e3e40,_0x164032,_0x157ec9){return new BPromise(function(_0x5bf8ab,_0x5ec016){return client[_0xa6d1('0xc')](_0x2e3e40,_0x157ec9)[_0xa6d1('0xd')](function(_0x387e98){logger['info'](_0xa6d1('0xe'),_0x164032,'request\x20sent');logger[_0xa6d1('0xf')](_0xa6d1('0x10'),_0x164032,_0xa6d1('0x11'),JSON['stringify'](_0x387e98));if(_0x387e98[_0xa6d1('0x12')]){if(_0x387e98['error']['code']===0x1f4){logger[_0xa6d1('0x12')](_0xa6d1('0xe'),_0x164032,_0x387e98[_0xa6d1('0x12')][_0xa6d1('0x13')]);return _0x5ec016(_0x387e98[_0xa6d1('0x12')][_0xa6d1('0x13')]);}logger[_0xa6d1('0x12')](_0xa6d1('0xe'),_0x164032,_0x387e98['error'][_0xa6d1('0x13')]);return _0x5bf8ab(_0x387e98[_0xa6d1('0x12')]['message']);}else{logger[_0xa6d1('0x14')](_0xa6d1('0xe'),_0x164032,_0xa6d1('0x11'));_0x5bf8ab(_0x387e98['result'][_0xa6d1('0x13')]);}})[_0xa6d1('0x15')](function(_0x24d4ba){logger[_0xa6d1('0x12')](_0xa6d1('0xe'),_0x164032,_0x24d4ba);_0x5ec016(_0x24d4ba);});});}exports['CreateCmHopperFinal']=function(_0x408b2c){var _0x39dc78=this;return new Promise(function(_0xa61c96,_0x164ed5){return db[_0xa6d1('0x16')][_0xa6d1('0x17')](_0x408b2c[_0xa6d1('0x18')],{'raw':_0x408b2c[_0xa6d1('0x19')]?_0x408b2c[_0xa6d1('0x19')][_0xa6d1('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5b951f){logger['info'](_0xa6d1('0x1b'),_0x408b2c);logger['debug']('CreateCmHopperFinal',_0x408b2c,JSON[_0xa6d1('0x1c')](_0x5b951f));_0xa61c96(_0x5b951f);})['catch'](function(_0x2c924d){logger[_0xa6d1('0x12')](_0xa6d1('0x1b'),_0x2c924d[_0xa6d1('0x13')],_0x408b2c);_0x164ed5(_0x39dc78['error'](0x1f4,_0x2c924d['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 727c6b0..c2117cf 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 _0xd106=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2d1f7a,_0x454291){var _0x37d187=function(_0x5b4784){while(--_0x5b4784){_0x2d1f7a['push'](_0x2d1f7a['shift']());}};_0x37d187(++_0x454291);}(_0xd106,0x181));var _0x6d10=function(_0x487c58,_0x2b5552){_0x487c58=_0x487c58-0x0;var _0x23b47b=_0xd106[_0x487c58];return _0x23b47b;};'use strict';var multer=require(_0x6d10('0x0'));var util=require('util');var path=require(_0x6d10('0x1'));var timeout=require(_0x6d10('0x2'));var express=require('express');var router=express[_0x6d10('0x3')]();var fs_extra=require(_0x6d10('0x4'));var auth=require(_0x6d10('0x5'));var interaction=require(_0x6d10('0x6'));var config=require(_0x6d10('0x7'));var controller=require(_0x6d10('0x8'));router[_0x6d10('0x9')]('/',auth[_0x6d10('0xa')](),controller['index']);router[_0x6d10('0x9')](_0x6d10('0xb'),auth[_0x6d10('0xa')](),controller[_0x6d10('0xc')]);router[_0x6d10('0x9')](_0x6d10('0xd'),auth[_0x6d10('0xa')](),controller['show']);router[_0x6d10('0x9')]('/voice/queue/countAttributes/:id',auth[_0x6d10('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x6d10('0x9')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x6d10('0xe')]);router[_0x6d10('0xf')](_0x6d10('0x10'),auth['isAuthenticated'](),controller[_0x6d10('0x11')]);router[_0x6d10('0xf')](_0x6d10('0x12'),auth[_0x6d10('0xa')](),controller[_0x6d10('0x13')]);router[_0x6d10('0xf')](_0x6d10('0x14'),auth[_0x6d10('0xa')](),controller['checkContactHopper']);router[_0x6d10('0x15')](_0x6d10('0xd'),auth[_0x6d10('0xa')](),controller['update']);module[_0x6d10('0x16')]=router; \ No newline at end of file +var _0xd5df=['/describe','describe','/:id','isAuthenticated','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get'];(function(_0x1c6d8c,_0x99ecf5){var _0x3c0de4=function(_0x5d8067){while(--_0x5d8067){_0x1c6d8c['push'](_0x1c6d8c['shift']());}};_0x3c0de4(++_0x99ecf5);}(_0xd5df,0x151));var _0xfd5d=function(_0x572cd7,_0x2740b2){_0x572cd7=_0x572cd7-0x0;var _0x123ac2=_0xd5df[_0x572cd7];return _0x123ac2;};'use strict';var multer=require(_0xfd5d('0x0'));var util=require('util');var path=require(_0xfd5d('0x1'));var timeout=require(_0xfd5d('0x2'));var express=require('express');var router=express[_0xfd5d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfd5d('0x4'));var config=require(_0xfd5d('0x5'));var controller=require(_0xfd5d('0x6'));router[_0xfd5d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfd5d('0x7')](_0xfd5d('0x8'),auth['isAuthenticated'](),controller[_0xfd5d('0x9')]);router['get'](_0xfd5d('0xa'),auth[_0xfd5d('0xb')](),controller[_0xfd5d('0xc')]);router[_0xfd5d('0x7')]('/voice/queue/countAttributes/:id',auth[_0xfd5d('0xb')](),controller[_0xfd5d('0xd')]);router[_0xfd5d('0x7')](_0xfd5d('0xe'),auth[_0xfd5d('0xb')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xfd5d('0xf')]('/voice/queue/moveContacts/:id',auth[_0xfd5d('0xb')](),controller[_0xfd5d('0x10')]);router[_0xfd5d('0xf')](_0xfd5d('0x11'),auth['isAuthenticated'](),controller[_0xfd5d('0x12')]);router[_0xfd5d('0xf')](_0xfd5d('0x13'),auth[_0xfd5d('0xb')](),controller[_0xfd5d('0x14')]);router['put'](_0xfd5d('0xa'),auth[_0xfd5d('0xb')](),controller[_0xfd5d('0x15')]);module[_0xfd5d('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index c0229a4..1ca6d97 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 _0xd8b7=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x1b1f04,_0xc66e12){var _0x1c0109=function(_0x3306e2){while(--_0x3306e2){_0x1b1f04['push'](_0x1b1f04['shift']());}};_0x1c0109(++_0xc66e12);}(_0xd8b7,0x97));var _0x7d8b=function(_0x6c49c6,_0x1b6f3a){_0x6c49c6=_0x6c49c6-0x0;var _0x241b46=_0xd8b7[_0x6c49c6];return _0x241b46;};'use strict';var Sequelize=require(_0x7d8b('0x0'));module[_0x7d8b('0x1')]={'state':{'type':Sequelize[_0x7d8b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7d8b('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7d8b('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x7d8b('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7d8b('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x7d8b('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x7d8b('0x4')]},'endtime':{'type':Sequelize[_0x7d8b('0x4')]},'ringtime':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7d8b('0x3')]},'campaign':{'type':Sequelize[_0x7d8b('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7d8b('0x3')]},'reason':{'type':Sequelize[_0x7d8b('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x7d8b('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7d8b('0x4')]},'recallme':{'type':Sequelize[_0x7d8b('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x7d8b('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaac6=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0x4f9387,_0x48c816){var _0x4c30a4=function(_0x3167ed){while(--_0x3167ed){_0x4f9387['push'](_0x4f9387['shift']());}};_0x4c30a4(++_0x48c816);}(_0xaac6,0x1a6));var _0x6aac=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0xaac6[_0x4fbb15];return _0x436338;};'use strict';var Sequelize=require(_0x6aac('0x0'));module['exports']={'state':{'type':Sequelize[_0x6aac('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x6aac('0x2')]},'scheduledat':{'type':Sequelize[_0x6aac('0x3')]},'countbusyretry':{'type':Sequelize[_0x6aac('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6aac('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6aac('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6aac('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x6aac('0x2')]},'originatecalleridname':{'type':Sequelize[_0x6aac('0x2')]},'calleridnum':{'type':Sequelize[_0x6aac('0x2')]},'calleridname':{'type':Sequelize[_0x6aac('0x2')]},'starttime':{'type':Sequelize[_0x6aac('0x3')]},'responsetime':{'type':Sequelize[_0x6aac('0x3')]},'answertime':{'type':Sequelize[_0x6aac('0x3')]},'droptime':{'type':Sequelize[_0x6aac('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6aac('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6aac('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x6aac('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x6aac('0x2')]},'amd':{'type':Sequelize[_0x6aac('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6aac('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x6aac('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6aac('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6aac('0x3')]},'edited':{'type':Sequelize[_0x6aac('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x6aac('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6aac('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6aac('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6aac('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index d18baac..f9fcb58 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 _0x4165=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','send','index','map','CmHopperHistory','fieldName','key','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','find','create','update','body','uniqueid','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis'];(function(_0x3aa106,_0x33e4f0){var _0x47561d=function(_0x23278c){while(--_0x23278c){_0x3aa106['push'](_0x3aa106['shift']());}};_0x47561d(++_0x33e4f0);}(_0x4165,0x16e));var _0x5416=function(_0x3be874,_0x580bc2){_0x3be874=_0x3be874-0x0;var _0x40772a=_0x4165[_0x3be874];return _0x40772a;};'use strict';var pdf=require(_0x5416('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5416('0x1'));var zipdir=require(_0x5416('0x2'));var jsonpatch=require(_0x5416('0x3'));var rp=require(_0x5416('0x4'));var moment=require(_0x5416('0x5'));var BPromise=require(_0x5416('0x6'));var Mustache=require(_0x5416('0x7'));var util=require(_0x5416('0x8'));var path=require(_0x5416('0x9'));var sox=require(_0x5416('0xa'));var csv=require(_0x5416('0xb'));var ejs=require(_0x5416('0xc'));var fs=require('fs');var fs_extra=require(_0x5416('0xd'));var _=require('lodash');var squel=require(_0x5416('0xe'));var crypto=require(_0x5416('0xf'));var jsforce=require(_0x5416('0x10'));var deskjs=require(_0x5416('0x11'));var toCsv=require(_0x5416('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5416('0x12'));var authService=require(_0x5416('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5416('0x14'));var hardwareService=require(_0x5416('0x15'));var logger=require('../../config/logger')(_0x5416('0x16'));var utils=require(_0x5416('0x17'));var config=require(_0x5416('0x18'));var licenseUtil=require(_0x5416('0x19'));var db=require(_0x5416('0x1a'))['db'];function respondWithStatusCode(_0x5b469f,_0x46f4c2){_0x46f4c2=_0x46f4c2||0xcc;return function(_0x212128){if(_0x212128){return _0x5b469f[_0x5416('0x1b')](_0x46f4c2);}return _0x5b469f['status'](_0x46f4c2)['end']();};}function respondWithResult(_0x10c995,_0x551ee5){_0x551ee5=_0x551ee5||0xc8;return function(_0x34cf8e){if(_0x34cf8e){return _0x10c995[_0x5416('0x1c')](_0x551ee5)[_0x5416('0x1d')](_0x34cf8e);}};}function respondWithFilteredResult(_0x46aae0,_0x40b99a){return function(_0x3f4c0f){if(_0x3f4c0f){var _0x56bd18=_0x3f4c0f[_0x5416('0x1e')],_0x2f866b=_0x40b99a[_0x5416('0x1f')],_0x419a7d=_0x40b99a[_0x5416('0x1f')]+_0x40b99a[_0x5416('0x20')],_0x212040;if(_0x419a7d>=_0x56bd18){_0x419a7d=_0x56bd18;_0x212040=0xc8;}else{_0x212040=0xce;}_0x46aae0[_0x5416('0x1c')](_0x212040);return _0x46aae0[_0x5416('0x21')](_0x5416('0x22'),_0x2f866b+'-'+_0x419a7d+'/'+_0x56bd18)[_0x5416('0x1d')](_0x3f4c0f);}return null;};}function patchUpdates(_0x2b9c97){return function(_0x2a465){try{jsonpatch[_0x5416('0x23')](_0x2a465,_0x2b9c97,!![]);}catch(_0x33fcea){return BPromise[_0x5416('0x24')](_0x33fcea);}return _0x2a465[_0x5416('0x25')]();};}function saveUpdates(_0x2fcf0c,_0x3015eb){return function(_0x7d1626){if(_0x7d1626){return _0x7d1626['update'](_0x2fcf0c)[_0x5416('0x26')](function(_0x530d6f){return _0x530d6f;});}return null;};}function removeEntity(_0x4de5a8,_0xa1678b){return function(_0x53f384){if(_0x53f384){return _0x53f384[_0x5416('0x27')]()[_0x5416('0x26')](function(){_0x4de5a8[_0x5416('0x1c')](0xcc)[_0x5416('0x28')]();});}};}function handleEntityNotFound(_0x419fa9,_0x1307ba){return function(_0x48fd64){if(!_0x48fd64){_0x419fa9[_0x5416('0x1b')](0x194);}return _0x48fd64;};}function handleError(_0x1cde64,_0x572c36){_0x572c36=_0x572c36||0x1f4;return function(_0x2101f9){logger['error'](_0x2101f9['stack']);if(_0x2101f9['name']){delete _0x2101f9['name'];}_0x1cde64['status'](_0x572c36)[_0x5416('0x29')](_0x2101f9);};}exports[_0x5416('0x2a')]=function(_0x2c507d,_0xe89dff){var _0x3b6ae6={},_0x3d2b8e={},_0xe7f592={'count':0x0,'rows':[]};var _0x27b6f0=_[_0x5416('0x2b')](db[_0x5416('0x2c')]['rawAttributes'],function(_0x502d3d){return{'name':_0x502d3d[_0x5416('0x2d')],'type':_0x502d3d['type'][_0x5416('0x2e')]};});_0x3d2b8e['model']=_[_0x5416('0x2b')](_0x27b6f0,_0x5416('0x2f'));_0x3d2b8e[_0x5416('0x30')]=_[_0x5416('0x31')](_0x2c507d[_0x5416('0x30')]);_0x3d2b8e[_0x5416('0x32')]=_[_0x5416('0x33')](_0x3d2b8e[_0x5416('0x34')],_0x3d2b8e['query']);_0x3b6ae6[_0x5416('0x35')]=_[_0x5416('0x33')](_0x3d2b8e[_0x5416('0x34')],qs[_0x5416('0x36')](_0x2c507d['query']['fields']));_0x3b6ae6['attributes']=_0x3b6ae6[_0x5416('0x35')]['length']?_0x3b6ae6[_0x5416('0x35')]:_0x3d2b8e[_0x5416('0x34')];if(!_0x2c507d[_0x5416('0x30')]['hasOwnProperty'](_0x5416('0x37'))){_0x3b6ae6[_0x5416('0x20')]=qs[_0x5416('0x20')](_0x2c507d['query'][_0x5416('0x20')]);_0x3b6ae6[_0x5416('0x1f')]=qs[_0x5416('0x1f')](_0x2c507d[_0x5416('0x30')][_0x5416('0x1f')]);}_0x3b6ae6[_0x5416('0x38')]=qs[_0x5416('0x39')](_0x2c507d['query']['sort']);_0x3b6ae6[_0x5416('0x3a')]=qs[_0x5416('0x32')](_['pick'](_0x2c507d['query'],_0x3d2b8e[_0x5416('0x32')]),_0x27b6f0);if(_0x2c507d[_0x5416('0x30')][_0x5416('0x3b')]){_0x3b6ae6[_0x5416('0x3a')]=_[_0x5416('0x3c')](_0x3b6ae6[_0x5416('0x3a')],{'$or':_[_0x5416('0x2b')](_0x27b6f0,function(_0x2d4075){if(_0x2d4075[_0x5416('0x3d')]!==_0x5416('0x3e')){var _0x331b7f={};_0x331b7f[_0x2d4075[_0x5416('0x2f')]]={'$like':'%'+_0x2c507d[_0x5416('0x30')][_0x5416('0x3b')]+'%'};return _0x331b7f;}})});}_0x3b6ae6=_[_0x5416('0x3c')]({},_0x3b6ae6,_0x2c507d[_0x5416('0x3f')]);var _0x18e4d0={'where':_0x3b6ae6[_0x5416('0x3a')]};return db[_0x5416('0x2c')]['count'](_0x18e4d0)[_0x5416('0x26')](function(_0xf7fae6){_0xe7f592[_0x5416('0x1e')]=_0xf7fae6;if(_0x2c507d['query']['includeAll']){_0x3b6ae6[_0x5416('0x40')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x5416('0x41')](_0x3b6ae6);})[_0x5416('0x26')](function(_0x49644d){_0xe7f592[_0x5416('0x42')]=_0x49644d;return _0xe7f592;})['then'](respondWithFilteredResult(_0xe89dff,_0x3b6ae6))[_0x5416('0x43')](handleError(_0xe89dff,null));};exports[_0x5416('0x44')]=function(_0x1740c5,_0x4e71d4){var _0x14d6cf={'raw':!![],'where':{'id':_0x1740c5['params']['id']}},_0x1b99aa={};_0x1b99aa[_0x5416('0x34')]=_[_0x5416('0x31')](db[_0x5416('0x2c')]['rawAttributes']);_0x1b99aa[_0x5416('0x30')]=_[_0x5416('0x31')](_0x1740c5['query']);_0x1b99aa[_0x5416('0x32')]=_[_0x5416('0x33')](_0x1b99aa[_0x5416('0x34')],_0x1b99aa[_0x5416('0x30')]);_0x14d6cf[_0x5416('0x35')]=_['intersection'](_0x1b99aa[_0x5416('0x34')],qs[_0x5416('0x36')](_0x1740c5[_0x5416('0x30')][_0x5416('0x36')]));_0x14d6cf[_0x5416('0x35')]=_0x14d6cf[_0x5416('0x35')][_0x5416('0x45')]?_0x14d6cf[_0x5416('0x35')]:_0x1b99aa['model'];if(_0x1740c5[_0x5416('0x30')][_0x5416('0x46')]){_0x14d6cf['include']=[{'all':!![]}];}_0x14d6cf=_[_0x5416('0x3c')]({},_0x14d6cf,_0x1740c5[_0x5416('0x3f')]);return db[_0x5416('0x2c')][_0x5416('0x47')](_0x14d6cf)['then'](handleEntityNotFound(_0x4e71d4,null))[_0x5416('0x26')](respondWithResult(_0x4e71d4,null))[_0x5416('0x43')](handleError(_0x4e71d4,null));};exports[_0x5416('0x48')]=function(_0x447600,_0x39cf50){return db[_0x5416('0x2c')][_0x5416('0x48')](_0x447600['body'],{})['then'](respondWithResult(_0x39cf50,0xc9))[_0x5416('0x43')](handleError(_0x39cf50,null));};exports['describe']=function(_0xba5633,_0x2021f2){return db[_0x5416('0x2c')]['describe']()[_0x5416('0x26')](respondWithResult(_0x2021f2,null))['catch'](handleError(_0x2021f2,null));};exports[_0x5416('0x49')]=function(_0x564d3b,_0xc2755){if(_0x564d3b[_0x5416('0x4a')][_0x5416('0x4b')]){delete _0x564d3b['body'][_0x5416('0x4b')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x564d3b[_0x5416('0x4c')]['id']}})[_0x5416('0x26')](handleEntityNotFound(_0xc2755,null))[_0x5416('0x26')](saveUpdates(_0x564d3b[_0x5416('0x4a')],null))[_0x5416('0x26')](respondWithResult(_0xc2755,null))['catch'](handleError(_0xc2755,null));}; \ No newline at end of file +var _0x7e69=['offset','Content-Range','apply','reject','save','update','then','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','uniqueid','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x424322,_0x4d61bc){var _0x186f12=function(_0x38f69c){while(--_0x38f69c){_0x424322['push'](_0x424322['shift']());}};_0x186f12(++_0x4d61bc);}(_0x7e69,0x105));var _0x97e6=function(_0xb87f20,_0x4ae8f5){_0xb87f20=_0xb87f20-0x0;var _0x5e02bb=_0x7e69[_0xb87f20];return _0x5e02bb;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x97e6('0x0'));var zipdir=require(_0x97e6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x97e6('0x2'));var Mustache=require('mustache');var util=require(_0x97e6('0x3'));var path=require(_0x97e6('0x4'));var sox=require(_0x97e6('0x5'));var csv=require(_0x97e6('0x6'));var ejs=require(_0x97e6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97e6('0x8'));var squel=require(_0x97e6('0x9'));var crypto=require(_0x97e6('0xa'));var jsforce=require(_0x97e6('0xb'));var deskjs=require(_0x97e6('0xc'));var toCsv=require(_0x97e6('0x6'));var querystring=require(_0x97e6('0xd'));var Papa=require(_0x97e6('0xe'));var Redis=require('ioredis');var authService=require(_0x97e6('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97e6('0x10'));var logger=require(_0x97e6('0x11'))(_0x97e6('0x12'));var utils=require(_0x97e6('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x97e6('0x14'));var db=require(_0x97e6('0x15'))['db'];function respondWithStatusCode(_0x3c92f2,_0x49fab0){_0x49fab0=_0x49fab0||0xcc;return function(_0x560070){if(_0x560070){return _0x3c92f2[_0x97e6('0x16')](_0x49fab0);}return _0x3c92f2[_0x97e6('0x17')](_0x49fab0)[_0x97e6('0x18')]();};}function respondWithResult(_0x274034,_0x1e1b26){_0x1e1b26=_0x1e1b26||0xc8;return function(_0x36a66a){if(_0x36a66a){return _0x274034[_0x97e6('0x17')](_0x1e1b26)[_0x97e6('0x19')](_0x36a66a);}};}function respondWithFilteredResult(_0xd3603c,_0x4e7f7f){return function(_0x44b5bd){if(_0x44b5bd){var _0x58d327=_0x44b5bd[_0x97e6('0x1a')],_0x3b6b5b=_0x4e7f7f[_0x97e6('0x1b')],_0x4175c6=_0x4e7f7f[_0x97e6('0x1b')]+_0x4e7f7f['limit'],_0x48132d;if(_0x4175c6>=_0x58d327){_0x4175c6=_0x58d327;_0x48132d=0xc8;}else{_0x48132d=0xce;}_0xd3603c['status'](_0x48132d);return _0xd3603c['set'](_0x97e6('0x1c'),_0x3b6b5b+'-'+_0x4175c6+'/'+_0x58d327)[_0x97e6('0x19')](_0x44b5bd);}return null;};}function patchUpdates(_0x345f47){return function(_0x484c39){try{jsonpatch[_0x97e6('0x1d')](_0x484c39,_0x345f47,!![]);}catch(_0x341608){return BPromise[_0x97e6('0x1e')](_0x341608);}return _0x484c39[_0x97e6('0x1f')]();};}function saveUpdates(_0x5f0da7,_0x58fdd3){return function(_0x53f872){if(_0x53f872){return _0x53f872[_0x97e6('0x20')](_0x5f0da7)[_0x97e6('0x21')](function(_0x2389a3){return _0x2389a3;});}return null;};}function removeEntity(_0x4b4a90,_0x1d7996){return function(_0x3e34c6){if(_0x3e34c6){return _0x3e34c6['destroy']()[_0x97e6('0x21')](function(){_0x4b4a90[_0x97e6('0x17')](0xcc)[_0x97e6('0x18')]();});}};}function handleEntityNotFound(_0x53f49a,_0x33a8cd){return function(_0x10d99f){if(!_0x10d99f){_0x53f49a[_0x97e6('0x16')](0x194);}return _0x10d99f;};}function handleError(_0x469731,_0x288d2d){_0x288d2d=_0x288d2d||0x1f4;return function(_0x1a3489){logger['error'](_0x1a3489[_0x97e6('0x22')]);if(_0x1a3489[_0x97e6('0x23')]){delete _0x1a3489[_0x97e6('0x23')];}_0x469731['status'](_0x288d2d)[_0x97e6('0x24')](_0x1a3489);};}exports[_0x97e6('0x25')]=function(_0x27293b,_0x2ad8a0){var _0x57aaba={},_0x514711={},_0xf86eeb={'count':0x0,'rows':[]};var _0x238cb3=_['map'](db[_0x97e6('0x26')][_0x97e6('0x27')],function(_0x35a6a8){return{'name':_0x35a6a8[_0x97e6('0x28')],'type':_0x35a6a8[_0x97e6('0x29')]['key']};});_0x514711[_0x97e6('0x2a')]=_['map'](_0x238cb3,_0x97e6('0x23'));_0x514711[_0x97e6('0x2b')]=_[_0x97e6('0x2c')](_0x27293b[_0x97e6('0x2b')]);_0x514711[_0x97e6('0x2d')]=_['intersection'](_0x514711[_0x97e6('0x2a')],_0x514711['query']);_0x57aaba[_0x97e6('0x2e')]=_[_0x97e6('0x2f')](_0x514711[_0x97e6('0x2a')],qs['fields'](_0x27293b[_0x97e6('0x2b')]['fields']));_0x57aaba[_0x97e6('0x2e')]=_0x57aaba['attributes']['length']?_0x57aaba[_0x97e6('0x2e')]:_0x514711['model'];if(!_0x27293b[_0x97e6('0x2b')][_0x97e6('0x30')](_0x97e6('0x31'))){_0x57aaba[_0x97e6('0x32')]=qs[_0x97e6('0x32')](_0x27293b['query'][_0x97e6('0x32')]);_0x57aaba[_0x97e6('0x1b')]=qs[_0x97e6('0x1b')](_0x27293b['query']['offset']);}_0x57aaba[_0x97e6('0x33')]=qs[_0x97e6('0x34')](_0x27293b[_0x97e6('0x2b')]['sort']);_0x57aaba[_0x97e6('0x35')]=qs[_0x97e6('0x2d')](_[_0x97e6('0x36')](_0x27293b['query'],_0x514711[_0x97e6('0x2d')]),_0x238cb3);if(_0x27293b[_0x97e6('0x2b')][_0x97e6('0x37')]){_0x57aaba[_0x97e6('0x35')]=_[_0x97e6('0x38')](_0x57aaba['where'],{'$or':_['map'](_0x238cb3,function(_0x1f196d){if(_0x1f196d['type']!==_0x97e6('0x39')){var _0x5bb7a3={};_0x5bb7a3[_0x1f196d['name']]={'$like':'%'+_0x27293b['query'][_0x97e6('0x37')]+'%'};return _0x5bb7a3;}})});}_0x57aaba=_[_0x97e6('0x38')]({},_0x57aaba,_0x27293b[_0x97e6('0x3a')]);var _0xfb307e={'where':_0x57aaba[_0x97e6('0x35')]};return db['CmHopperHistory'][_0x97e6('0x1a')](_0xfb307e)[_0x97e6('0x21')](function(_0x2b039a){_0xf86eeb[_0x97e6('0x1a')]=_0x2b039a;if(_0x27293b['query'][_0x97e6('0x3b')]){_0x57aaba[_0x97e6('0x3c')]=[{'all':!![]}];}return db[_0x97e6('0x26')][_0x97e6('0x3d')](_0x57aaba);})[_0x97e6('0x21')](function(_0x34f61b){_0xf86eeb[_0x97e6('0x3e')]=_0x34f61b;return _0xf86eeb;})['then'](respondWithFilteredResult(_0x2ad8a0,_0x57aaba))[_0x97e6('0x3f')](handleError(_0x2ad8a0,null));};exports[_0x97e6('0x40')]=function(_0x21443f,_0x45c8a4){var _0x55be29={'raw':!![],'where':{'id':_0x21443f[_0x97e6('0x41')]['id']}},_0x577bf8={};_0x577bf8[_0x97e6('0x2a')]=_[_0x97e6('0x2c')](db['CmHopperHistory']['rawAttributes']);_0x577bf8[_0x97e6('0x2b')]=_[_0x97e6('0x2c')](_0x21443f['query']);_0x577bf8[_0x97e6('0x2d')]=_['intersection'](_0x577bf8[_0x97e6('0x2a')],_0x577bf8[_0x97e6('0x2b')]);_0x55be29['attributes']=_['intersection'](_0x577bf8['model'],qs[_0x97e6('0x42')](_0x21443f['query'][_0x97e6('0x42')]));_0x55be29[_0x97e6('0x2e')]=_0x55be29[_0x97e6('0x2e')]['length']?_0x55be29[_0x97e6('0x2e')]:_0x577bf8[_0x97e6('0x2a')];if(_0x21443f[_0x97e6('0x2b')]['includeAll']){_0x55be29[_0x97e6('0x3c')]=[{'all':!![]}];}_0x55be29=_['merge']({},_0x55be29,_0x21443f[_0x97e6('0x3a')]);return db[_0x97e6('0x26')][_0x97e6('0x43')](_0x55be29)[_0x97e6('0x21')](handleEntityNotFound(_0x45c8a4,null))[_0x97e6('0x21')](respondWithResult(_0x45c8a4,null))[_0x97e6('0x3f')](handleError(_0x45c8a4,null));};exports[_0x97e6('0x44')]=function(_0x1c4318,_0x487ea6){return db[_0x97e6('0x26')][_0x97e6('0x44')](_0x1c4318[_0x97e6('0x45')],{})[_0x97e6('0x21')](respondWithResult(_0x487ea6,0xc9))[_0x97e6('0x3f')](handleError(_0x487ea6,null));};exports[_0x97e6('0x46')]=function(_0x38d2a4,_0x5da06b){return db[_0x97e6('0x26')]['describe']()['then'](respondWithResult(_0x5da06b,null))[_0x97e6('0x3f')](handleError(_0x5da06b,null));};exports[_0x97e6('0x20')]=function(_0x4317d9,_0x5aa532){if(_0x4317d9[_0x97e6('0x45')][_0x97e6('0x47')]){delete _0x4317d9[_0x97e6('0x45')][_0x97e6('0x47')];}return db[_0x97e6('0x26')][_0x97e6('0x43')]({'where':{'uniqueid':_0x4317d9[_0x97e6('0x41')]['id']}})[_0x97e6('0x21')](handleEntityNotFound(_0x5aa532,null))[_0x97e6('0x21')](saveUpdates(_0x4317d9['body'],null))[_0x97e6('0x21')](respondWithResult(_0x5aa532,null))[_0x97e6('0x3f')](handleError(_0x5aa532,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 449c2e6..89db6fa 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 _0xe9db=['define','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x326361,_0xdec62c){var _0x3dc681=function(_0x241199){while(--_0x241199){_0x326361['push'](_0x326361['shift']());}};_0x3dc681(++_0xdec62c);}(_0xe9db,0x1f1));var _0xbe9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbe9d('0x0'));var util=require(_0xbe9d('0x1'));var logger=require(_0xbe9d('0x2'))(_0xbe9d('0x3'));var moment=require(_0xbe9d('0x4'));var BPromise=require(_0xbe9d('0x5'));var rp=require(_0xbe9d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe9d('0x7'));var config=require(_0xbe9d('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0xbe9d('0x9')]=function(_0x5876ba,_0x3ac87c){return _0x5876ba[_0xbe9d('0xa')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xbe9d('0xb'),'fields':[_0xbe9d('0xb')]},{'name':_0xbe9d('0xc'),'fields':[_0xbe9d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaad2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','CmHopperHistory','cm_hopper_history','uniqueid','util','../../config/logger'];(function(_0x293232,_0x3fe050){var _0x198856=function(_0xdeb167){while(--_0xdeb167){_0x293232['push'](_0x293232['shift']());}};_0x198856(++_0x3fe050);}(_0xaad2,0xa7));var _0x2aad=function(_0xe1b5f6,_0x210c09){_0xe1b5f6=_0xe1b5f6-0x0;var _0x44636e=_0xaad2[_0xe1b5f6];return _0x44636e;};'use strict';var _=require('lodash');var util=require(_0x2aad('0x0'));var logger=require(_0x2aad('0x1'))(_0x2aad('0x2'));var moment=require(_0x2aad('0x3'));var BPromise=require(_0x2aad('0x4'));var rp=require(_0x2aad('0x5'));var fs=require('fs');var path=require(_0x2aad('0x6'));var rimraf=require(_0x2aad('0x7'));var config=require(_0x2aad('0x8'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x4b7e31,_0x14383f){return _0x4b7e31[_0x2aad('0x9')](_0x2aad('0xa'),attributes,{'tableName':_0x2aad('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x2aad('0xc'),'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 7ff5664..14a180a 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 _0xe717=['literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','result','catch','CmHopperHistory','body','options','raw','then','info','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls'];(function(_0x49f051,_0x298ebe){var _0x5588e6=function(_0x3ff791){while(--_0x3ff791){_0x49f051['push'](_0x49f051['shift']());}};_0x5588e6(++_0x298ebe);}(_0xe717,0xf9));var _0x7e71=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe717[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7e71('0x0'));var util=require(_0x7e71('0x1'));var moment=require(_0x7e71('0x2'));var BPromise=require(_0x7e71('0x3'));var rs=require(_0x7e71('0x4'));var fs=require('fs');var Redis=require(_0x7e71('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e71('0x6'));var logger=require(_0x7e71('0x7'))(_0x7e71('0x8'));var config=require(_0x7e71('0x9'));var jayson=require(_0x7e71('0xa'));var client=jayson['client'][_0x7e71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b2d56,_0x2e9b36,_0x4e0171){return new BPromise(function(_0x5e0a99,_0x3d3160){return client[_0x7e71('0xc')](_0x5b2d56,_0x4e0171)['then'](function(_0xddabea){logger['info'](_0x7e71('0xd'),_0x2e9b36,_0x7e71('0xe'));logger[_0x7e71('0xf')](_0x7e71('0x10'),_0x2e9b36,_0x7e71('0xe'),JSON['stringify'](_0xddabea));if(_0xddabea['error']){if(_0xddabea[_0x7e71('0x11')]['code']===0x1f4){logger[_0x7e71('0x11')](_0x7e71('0xd'),_0x2e9b36,_0xddabea[_0x7e71('0x11')]['message']);return _0x3d3160(_0xddabea[_0x7e71('0x11')][_0x7e71('0x12')]);}logger[_0x7e71('0x11')](_0x7e71('0xd'),_0x2e9b36,_0xddabea[_0x7e71('0x11')][_0x7e71('0x12')]);return _0x5e0a99(_0xddabea['error']['message']);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x2e9b36,_0x7e71('0xe'));_0x5e0a99(_0xddabea[_0x7e71('0x13')][_0x7e71('0x12')]);}})[_0x7e71('0x14')](function(_0x1fc5b6){logger[_0x7e71('0x11')](_0x7e71('0xd'),_0x2e9b36,_0x1fc5b6);_0x3d3160(_0x1fc5b6);});});}exports['CreateCmHopperHistory']=function(_0x5334f6){var _0x1ce36e=this;return new Promise(function(_0x3f3f4c,_0x214b61){return db[_0x7e71('0x15')]['create'](_0x5334f6[_0x7e71('0x16')],{'raw':_0x5334f6[_0x7e71('0x17')]?_0x5334f6[_0x7e71('0x17')][_0x7e71('0x18')]===undefined?!![]:![]:!![]})[_0x7e71('0x19')](function(_0x5d884b){logger[_0x7e71('0x1a')](_0x7e71('0x1b'),_0x5334f6);logger[_0x7e71('0xf')]('CreateCmHopperHistory',_0x5334f6,JSON['stringify'](_0x5d884b));_0x3f3f4c(_0x5d884b);})['catch'](function(_0x50ce8f){logger[_0x7e71('0x11')](_0x7e71('0x1b'),_0x50ce8f[_0x7e71('0x12')],_0x5334f6);_0x214b61(_0x1ce36e[_0x7e71('0x11')](0x1f4,_0x50ce8f['message']));});});};exports[_0x7e71('0x1c')]=function(_0x47b03c){var _0x1efb37=this;return new Promise(function(_0x561148,_0x43f944){return db['CmHopperHistory'][_0x7e71('0x1d')]({'raw':_0x47b03c[_0x7e71('0x17')]?_0x47b03c[_0x7e71('0x17')][_0x7e71('0x18')]===undefined?!![]:![]:!![],'where':_0x47b03c[_0x7e71('0x17')]?_0x47b03c['options'][_0x7e71('0x1e')]||null:null,'attributes':[[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')][_0x7e71('0x21')]('id')),_0x7e71('0x22')],[db['sequelize']['fn'](_0x7e71('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x7e71('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x7e71('0x24')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')]('`state`\x20=\x2010,\x201,\x20null'))),_0x7e71('0x25')],[db['sequelize']['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')]('`state`\x20=\x2011,\x201,\x20null'))),_0x7e71('0x26')],[db[_0x7e71('0x1f')]['fn']('AVG',db[_0x7e71('0x1f')]['fn']('IF',db['sequelize'][_0x7e71('0x23')](_0x7e71('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x28'),db['sequelize']['fn']('IF',db['sequelize'][_0x7e71('0x23')](_0x7e71('0x29')))),_0x7e71('0x2a')]]})[_0x7e71('0x19')](function(_0x3fd086){logger[_0x7e71('0x1a')](_0x7e71('0x1c'),_0x47b03c);logger[_0x7e71('0xf')](_0x7e71('0x1c'),_0x47b03c,JSON['stringify'](_0x3fd086));_0x561148(_0x3fd086);})[_0x7e71('0x14')](function(_0x55a519){logger[_0x7e71('0x11')](_0x7e71('0x1c'),_0x55a519[_0x7e71('0x12')],_0x47b03c);_0x43f944(_0x1efb37[_0x7e71('0x11')](0x1f4,_0x55a519[_0x7e71('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4ef768){var _0x14fc9d=this;return new Promise(function(_0x414ab9,_0x5d2a54){return db[_0x7e71('0x15')][_0x7e71('0x1d')]({'raw':_0x4ef768[_0x7e71('0x17')]?_0x4ef768[_0x7e71('0x17')][_0x7e71('0x18')]===undefined?!![]:![]:!![],'where':_0x4ef768[_0x7e71('0x17')]?_0x4ef768[_0x7e71('0x17')][_0x7e71('0x1e')]||null:null,'attributes':[[_0x7e71('0x2b'),'name'],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')](_0x7e71('0x2c')))),_0x7e71('0x2d')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')]('`state`\x20=\x203,\x201,\x20null'))),_0x7e71('0x2e')],[db['sequelize']['fn'](_0x7e71('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7e71('0x2f')))),_0x7e71('0x30')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')](_0x7e71('0x31')))),_0x7e71('0x32')],[db[_0x7e71('0x1f')]['fn']('COUNT',db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x7e71('0x33')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')](_0x7e71('0x34')))),_0x7e71('0x35')],[db['sequelize']['fn']('COUNT',db[_0x7e71('0x1f')]['fn']('IF',db['sequelize'][_0x7e71('0x23')](_0x7e71('0x36')))),_0x7e71('0x37')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')](_0x7e71('0x38')))),_0x7e71('0x39')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')](_0x7e71('0x3a')))),'outboundBlacklistCallsDay'],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')]('`state`\x20=\x2014,\x201,\x20null'))),_0x7e71('0x3b')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db['sequelize']['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db['sequelize'][_0x7e71('0x23')](_0x7e71('0x3c')))),_0x7e71('0x3d')],[db['sequelize']['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')](_0x7e71('0x3e')))),'outboundRejectCallsDay'],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db['sequelize']['fn']('IF',db[_0x7e71('0x1f')]['literal'](_0x7e71('0x3f')))),_0x7e71('0x40')]],'group':[_0x7e71('0x2b')]})[_0x7e71('0x19')](function(_0x16a0b0){logger['info'](_0x7e71('0x41'),_0x4ef768);logger['debug'](_0x7e71('0x41'),_0x4ef768,JSON['stringify'](_0x16a0b0));_0x414ab9(_0x16a0b0);})[_0x7e71('0x14')](function(_0x13f109){logger[_0x7e71('0x11')](_0x7e71('0x41'),_0x13f109[_0x7e71('0x12')],_0x4ef768);_0x5d2a54(_0x14fc9d[_0x7e71('0x11')](0x1f4,_0x13f109[_0x7e71('0x12')]));});});};exports[_0x7e71('0x42')]=function(_0x3394f5){var _0x2fac9f=this;return new Promise(function(_0x42c6ad,_0x340875){return db[_0x7e71('0x15')][_0x7e71('0x1d')]({'raw':_0x3394f5['options']?_0x3394f5[_0x7e71('0x17')][_0x7e71('0x18')]===undefined?!![]:![]:!![],'where':_0x3394f5[_0x7e71('0x17')]?_0x3394f5['options'][_0x7e71('0x1e')]||null:null,'attributes':[[_0x7e71('0x2b'),_0x7e71('0x43')],[db[_0x7e71('0x1f')]['fn']('COUNT',db[_0x7e71('0x1f')][_0x7e71('0x21')]('id')),_0x7e71('0x44')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')](_0x7e71('0x2f')))),_0x7e71('0x45')]],'group':[_0x7e71('0x2b')]})['then'](function(_0x5f3fb1){logger['info']('GetCampaignHopperHistory',_0x3394f5);logger[_0x7e71('0xf')]('GetCampaignHopperHistory',_0x3394f5,JSON[_0x7e71('0x46')](_0x5f3fb1));_0x42c6ad(_0x5f3fb1);})[_0x7e71('0x14')](function(_0x74771d){logger[_0x7e71('0x11')]('GetCampaignHopperHistory',_0x74771d[_0x7e71('0x12')],_0x3394f5);_0x340875(_0x2fac9f['error'](0x1f4,_0x74771d[_0x7e71('0x12')]));});});}; \ No newline at end of file +var _0x97fa=['bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','request','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','info','findAll','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment'];(function(_0x432514,_0x3f7a3a){var _0x3b781b=function(_0x212901){while(--_0x212901){_0x432514['push'](_0x432514['shift']());}};_0x3b781b(++_0x3f7a3a);}(_0x97fa,0xcf));var _0xa97f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x97fa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa97f('0x0'));var util=require(_0xa97f('0x1'));var moment=require(_0xa97f('0x2'));var BPromise=require(_0xa97f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa97f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa97f('0x5'));var logger=require('../../config/logger')(_0xa97f('0x6'));var config=require(_0xa97f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa97f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b3d62,_0x292bd4,_0x3cba2c){return new BPromise(function(_0x3822a9,_0x229b1e){return client[_0xa97f('0x9')](_0x5b3d62,_0x3cba2c)['then'](function(_0x17d7ad){logger['info'](_0xa97f('0xa'),_0x292bd4,_0xa97f('0xb'));logger[_0xa97f('0xc')](_0xa97f('0xd'),_0x292bd4,_0xa97f('0xb'),JSON[_0xa97f('0xe')](_0x17d7ad));if(_0x17d7ad[_0xa97f('0xf')]){if(_0x17d7ad[_0xa97f('0xf')][_0xa97f('0x10')]===0x1f4){logger[_0xa97f('0xf')](_0xa97f('0xa'),_0x292bd4,_0x17d7ad['error'][_0xa97f('0x11')]);return _0x229b1e(_0x17d7ad[_0xa97f('0xf')]['message']);}logger[_0xa97f('0xf')](_0xa97f('0xa'),_0x292bd4,_0x17d7ad[_0xa97f('0xf')][_0xa97f('0x11')]);return _0x3822a9(_0x17d7ad[_0xa97f('0xf')]['message']);}else{logger['info'](_0xa97f('0xa'),_0x292bd4,_0xa97f('0xb'));_0x3822a9(_0x17d7ad[_0xa97f('0x12')][_0xa97f('0x11')]);}})[_0xa97f('0x13')](function(_0x45df8d){logger['error'](_0xa97f('0xa'),_0x292bd4,_0x45df8d);_0x229b1e(_0x45df8d);});});}exports[_0xa97f('0x14')]=function(_0x5c5400){var _0x2b70b7=this;return new Promise(function(_0x4c6cb9,_0x20a3c0){return db[_0xa97f('0x15')][_0xa97f('0x16')](_0x5c5400[_0xa97f('0x17')],{'raw':_0x5c5400['options']?_0x5c5400[_0xa97f('0x18')][_0xa97f('0x19')]===undefined?!![]:![]:!![]})[_0xa97f('0x1a')](function(_0x206f0d){logger[_0xa97f('0x1b')](_0xa97f('0x14'),_0x5c5400);logger[_0xa97f('0xc')]('CreateCmHopperHistory',_0x5c5400,JSON[_0xa97f('0xe')](_0x206f0d));_0x4c6cb9(_0x206f0d);})['catch'](function(_0x2b213c){logger['error'](_0xa97f('0x14'),_0x2b213c[_0xa97f('0x11')],_0x5c5400);_0x20a3c0(_0x2b70b7['error'](0x1f4,_0x2b213c[_0xa97f('0x11')]));});});};exports['AvgHandleTime']=function(_0x9ab42a){var _0x28bdc5=this;return new Promise(function(_0x23c868,_0x374eac){return db[_0xa97f('0x15')][_0xa97f('0x1c')]({'raw':_0x9ab42a[_0xa97f('0x18')]?_0x9ab42a[_0xa97f('0x18')][_0xa97f('0x19')]===undefined?!![]:![]:!![],'where':_0x9ab42a[_0xa97f('0x18')]?_0x9ab42a['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xa97f('0x1d'),db[_0xa97f('0x1e')][_0xa97f('0x1f')]('id')),_0xa97f('0x20')],[db[_0xa97f('0x1e')]['fn'](_0xa97f('0x1d'),db[_0xa97f('0x1e')]['fn']('IF',db['sequelize'][_0xa97f('0x21')](_0xa97f('0x22')))),_0xa97f('0x23')],[db[_0xa97f('0x1e')]['fn'](_0xa97f('0x1d'),db[_0xa97f('0x1e')]['fn']('IF',db[_0xa97f('0x1e')][_0xa97f('0x21')](_0xa97f('0x24')))),_0xa97f('0x25')],[db['sequelize']['fn'](_0xa97f('0x1d'),db[_0xa97f('0x1e')]['fn']('IF',db['sequelize'][_0xa97f('0x21')](_0xa97f('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0xa97f('0x27'),db['sequelize']['fn']('IF',db[_0xa97f('0x1e')][_0xa97f('0x21')](_0xa97f('0x28')))),_0xa97f('0x29')],[db[_0xa97f('0x1e')]['fn']('AVG',db[_0xa97f('0x1e')]['fn']('IF',db[_0xa97f('0x1e')]['literal'](_0xa97f('0x2a')))),_0xa97f('0x2b')]]})[_0xa97f('0x1a')](function(_0x384faf){logger['info']('AvgHandleTime',_0x9ab42a);logger['debug'](_0xa97f('0x2c'),_0x9ab42a,JSON[_0xa97f('0xe')](_0x384faf));_0x23c868(_0x384faf);})['catch'](function(_0x52015f){logger[_0xa97f('0xf')](_0xa97f('0x2c'),_0x52015f['message'],_0x9ab42a);_0x374eac(_0x28bdc5[_0xa97f('0xf')](0x1f4,_0x52015f[_0xa97f('0x11')]));});});};exports[_0xa97f('0x2d')]=function(_0x13f902){var _0x4a4767=this;return new Promise(function(_0x3d9720,_0x52fa76){return db['CmHopperHistory']['findAll']({'raw':_0x13f902[_0xa97f('0x18')]?_0x13f902[_0xa97f('0x18')][_0xa97f('0x19')]===undefined?!![]:![]:!![],'where':_0x13f902[_0xa97f('0x18')]?_0x13f902[_0xa97f('0x18')][_0xa97f('0x2e')]||null:null,'attributes':[[_0xa97f('0x2f'),_0xa97f('0x30')],[db[_0xa97f('0x1e')]['fn'](_0xa97f('0x1d'),db[_0xa97f('0x1e')]['fn']('IF',db[_0xa97f('0x1e')][_0xa97f('0x21')](_0xa97f('0x31')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0xa97f('0x1d'),db[_0xa97f('0x1e')]['fn']('IF',db['sequelize'][_0xa97f('0x21')](_0xa97f('0x32')))),_0xa97f('0x33')],[db[_0xa97f('0x1e')]['fn'](_0xa97f('0x1d'),db[_0xa97f('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xa97f('0x22')))),_0xa97f('0x34')],[db[_0xa97f('0x1e')]['fn'](_0xa97f('0x1d'),db[_0xa97f('0x1e')]['fn']('IF',db[_0xa97f('0x1e')]['literal'](_0xa97f('0x35')))),_0xa97f('0x36')],[db[_0xa97f('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa97f('0x1e')][_0xa97f('0x21')]('`state`\x20=\x208,\x201,\x20null'))),_0xa97f('0x37')],[db[_0xa97f('0x1e')]['fn'](_0xa97f('0x1d'),db[_0xa97f('0x1e')]['fn']('IF',db[_0xa97f('0x1e')][_0xa97f('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0xa97f('0x1e')]['fn']('COUNT',db[_0xa97f('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xa97f('0x38')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0xa97f('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0xa97f('0x39')],[db[_0xa97f('0x1e')]['fn']('COUNT',db[_0xa97f('0x1e')]['fn']('IF',db[_0xa97f('0x1e')][_0xa97f('0x21')](_0xa97f('0x3a')))),_0xa97f('0x3b')],[db['sequelize']['fn'](_0xa97f('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0xa97f('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0xa97f('0x3c')],[db[_0xa97f('0x1e')]['fn'](_0xa97f('0x1d'),db[_0xa97f('0x1e')]['fn']('IF',db[_0xa97f('0x1e')][_0xa97f('0x21')](_0xa97f('0x3d')))),_0xa97f('0x3e')],[db[_0xa97f('0x1e')]['fn']('COUNT',db[_0xa97f('0x1e')]['fn']('IF',db[_0xa97f('0x1e')][_0xa97f('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),_0xa97f('0x3f')],[db[_0xa97f('0x1e')]['fn'](_0xa97f('0x1d'),db[_0xa97f('0x1e')]['fn']('IF',db['sequelize'][_0xa97f('0x21')](_0xa97f('0x40')))),_0xa97f('0x3e')],[db[_0xa97f('0x1e')]['fn'](_0xa97f('0x1d'),db[_0xa97f('0x1e')]['fn']('IF',db[_0xa97f('0x1e')]['literal'](_0xa97f('0x41')))),_0xa97f('0x42')]],'group':['campaign']})[_0xa97f('0x1a')](function(_0x54787c){logger[_0xa97f('0x1b')]('GetVoiceQueueHopperHistory',_0x13f902);logger[_0xa97f('0xc')](_0xa97f('0x2d'),_0x13f902,JSON[_0xa97f('0xe')](_0x54787c));_0x3d9720(_0x54787c);})[_0xa97f('0x13')](function(_0x3d4bae){logger[_0xa97f('0xf')](_0xa97f('0x2d'),_0x3d4bae[_0xa97f('0x11')],_0x13f902);_0x52fa76(_0x4a4767[_0xa97f('0xf')](0x1f4,_0x3d4bae[_0xa97f('0x11')]));});});};exports['GetCampaignHopperHistory']=function(_0x161d94){var _0xbc5e12=this;return new Promise(function(_0x169cea,_0x33124e){return db[_0xa97f('0x15')][_0xa97f('0x1c')]({'raw':_0x161d94['options']?_0x161d94[_0xa97f('0x18')][_0xa97f('0x19')]===undefined?!![]:![]:!![],'where':_0x161d94[_0xa97f('0x18')]?_0x161d94[_0xa97f('0x18')]['where']||null:null,'attributes':[['campaign',_0xa97f('0x30')],[db[_0xa97f('0x1e')]['fn'](_0xa97f('0x1d'),db[_0xa97f('0x1e')]['col']('id')),_0xa97f('0x43')],[db[_0xa97f('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa97f('0x1e')][_0xa97f('0x21')](_0xa97f('0x22')))),_0xa97f('0x44')]],'group':['campaign']})[_0xa97f('0x1a')](function(_0x472c92){logger[_0xa97f('0x1b')]('GetCampaignHopperHistory',_0x161d94);logger[_0xa97f('0xc')](_0xa97f('0x45'),_0x161d94,JSON[_0xa97f('0xe')](_0x472c92));_0x169cea(_0x472c92);})[_0xa97f('0x13')](function(_0x185215){logger[_0xa97f('0xf')]('GetCampaignHopperHistory',_0x185215[_0xa97f('0x11')],_0x161d94);_0x33124e(_0xbc5e12['error'](0x1f4,_0x185215['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index e362fc4..4bdf836 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 _0xaf10=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','Router'];(function(_0x5083f9,_0x5b94f2){var _0x5de96e=function(_0x32c245){while(--_0x32c245){_0x5083f9['push'](_0x5083f9['shift']());}};_0x5de96e(++_0x5b94f2);}(_0xaf10,0xd8));var _0x0af1=function(_0x1cdcfd,_0x35421c){_0x1cdcfd=_0x1cdcfd-0x0;var _0x1c05dd=_0xaf10[_0x1cdcfd];return _0x1c05dd;};'use strict';var multer=require(_0x0af1('0x0'));var util=require('util');var path=require(_0x0af1('0x1'));var timeout=require(_0x0af1('0x2'));var express=require('express');var router=express[_0x0af1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0af1('0x4'));var interaction=require(_0x0af1('0x5'));var config=require(_0x0af1('0x6'));var controller=require(_0x0af1('0x7'));router['get']('/',auth[_0x0af1('0x8')](),controller[_0x0af1('0x9')]);router[_0x0af1('0xa')](_0x0af1('0xb'),auth[_0x0af1('0x8')](),controller[_0x0af1('0xc')]);router['get'](_0x0af1('0xd'),auth[_0x0af1('0x8')](),controller[_0x0af1('0xe')]);router[_0x0af1('0xf')]('/',auth['isAuthenticated'](),controller[_0x0af1('0x10')]);router[_0x0af1('0x11')](_0x0af1('0xd'),auth[_0x0af1('0x8')](),controller[_0x0af1('0x12')]);module[_0x0af1('0x13')]=router; \ No newline at end of file +var _0x79ab=['/:id','show','post','update','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x4c46be,_0x3ff563){var _0x4677b5=function(_0x319cf6){while(--_0x319cf6){_0x4c46be['push'](_0x4c46be['shift']());}};_0x4677b5(++_0x3ff563);}(_0x79ab,0x1ea));var _0xb79a=function(_0xe9f4a2,_0x50f0c4){_0xe9f4a2=_0xe9f4a2-0x0;var _0x25e066=_0x79ab[_0xe9f4a2];return _0x25e066;};'use strict';var multer=require(_0xb79a('0x0'));var util=require('util');var path=require(_0xb79a('0x1'));var timeout=require(_0xb79a('0x2'));var express=require('express');var router=express[_0xb79a('0x3')]();var fs_extra=require(_0xb79a('0x4'));var auth=require(_0xb79a('0x5'));var interaction=require(_0xb79a('0x6'));var config=require(_0xb79a('0x7'));var controller=require(_0xb79a('0x8'));router[_0xb79a('0x9')]('/',auth[_0xb79a('0xa')](),controller[_0xb79a('0xb')]);router['get'](_0xb79a('0xc'),auth[_0xb79a('0xa')](),controller[_0xb79a('0xd')]);router[_0xb79a('0x9')](_0xb79a('0xe'),auth[_0xb79a('0xa')](),controller[_0xb79a('0xf')]);router[_0xb79a('0x10')]('/',auth[_0xb79a('0xa')](),controller['create']);router['put'](_0xb79a('0xe'),auth[_0xb79a('0xa')](),controller[_0xb79a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index edde96b..96aae12 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 _0xad31=['exports','STRING','sequelize'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xad31,0x1dc));var _0x1ad3=function(_0x396d2c,_0x35123d){_0x396d2c=_0x396d2c-0x0;var _0x2864a5=_0xad31[_0x396d2c];return _0x2864a5;};'use strict';var Sequelize=require(_0x1ad3('0x0'));module[_0x1ad3('0x1')]={'name':{'type':Sequelize[_0x1ad3('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1ad3('0x2')]},'dialPrefix':{'type':Sequelize[_0x1ad3('0x2')]}}; \ No newline at end of file +var _0x3935=['STRING','name','exports'];(function(_0xb14b26,_0x38cf9f){var _0xfdb28a=function(_0x380d1c){while(--_0x380d1c){_0xb14b26['push'](_0xb14b26['shift']());}};_0xfdb28a(++_0x38cf9f);}(_0x3935,0x13a));var _0x5393=function(_0x4ffa64,_0x271035){_0x4ffa64=_0x4ffa64-0x0;var _0x5da001=_0x3935[_0x4ffa64];return _0x5da001;};'use strict';var Sequelize=require('sequelize');module[_0x5393('0x0')]={'name':{'type':Sequelize[_0x5393('0x1')],'unique':_0x5393('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5393('0x1')]},'dialPrefix':{'type':Sequelize[_0x5393('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index d3699f2..9a4bd05 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 _0x9e1c=['filters','pick','filter','map','VIRTUAL','options','params','length','includeAll','find','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','ListId','Disposition','getDispositions','findOne','hasOwnProperty','merge','findAll','rows','removeDispositions','ids','addContacts','CmContact','describe','isArray','tags','join','push','each','omit','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','concat','isEmpty','now','setHeader','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:remove','User','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','status','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','Lists','UserProfileResource','end','sendStatus','error','stack','name','index','CmList','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','nolimit','order','sort','where'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x9e1c,0x168));var _0xc9e1=function(_0x135543,_0x214cee){_0x135543=_0x135543-0x0;var _0x43e003=_0x9e1c[_0x135543];return _0x43e003;};'use strict';var pdf=require(_0xc9e1('0x0'));var emlformat=require(_0xc9e1('0x1'));var rimraf=require(_0xc9e1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc9e1('0x3'));var rp=require(_0xc9e1('0x4'));var moment=require('moment');var BPromise=require(_0xc9e1('0x5'));var Mustache=require(_0xc9e1('0x6'));var util=require('util');var path=require(_0xc9e1('0x7'));var sox=require(_0xc9e1('0x8'));var csv=require('to-csv');var ejs=require(_0xc9e1('0x9'));var fs=require('fs');var fs_extra=require(_0xc9e1('0xa'));var _=require(_0xc9e1('0xb'));var squel=require('squel');var crypto=require(_0xc9e1('0xc'));var jsforce=require(_0xc9e1('0xd'));var deskjs=require(_0xc9e1('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc9e1('0xf'));var qs=require(_0xc9e1('0x10'));var as=require(_0xc9e1('0x11'));var hardwareService=require(_0xc9e1('0x12'));var logger=require(_0xc9e1('0x13'))(_0xc9e1('0x14'));var utils=require(_0xc9e1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc9e1('0x16'))['db'];config[_0xc9e1('0x17')]=_['defaults'](config[_0xc9e1('0x17')],{'host':_0xc9e1('0x18'),'port':0x18eb});var socket=require(_0xc9e1('0x19'))(new Redis(config[_0xc9e1('0x17')]));require(_0xc9e1('0x1a'))[_0xc9e1('0x1b')](socket);function respondWithStatusCode(_0x1845c5,_0x3c9105){_0x3c9105=_0x3c9105||0xcc;return function(_0x6f6c2f){if(_0x6f6c2f){return _0x1845c5['sendStatus'](_0x3c9105);}return _0x1845c5[_0xc9e1('0x1c')](_0x3c9105)['end']();};}function respondWithResult(_0x3ca426,_0x222fe3){_0x222fe3=_0x222fe3||0xc8;return function(_0x48afc1){if(_0x48afc1){return _0x3ca426[_0xc9e1('0x1c')](_0x222fe3)[_0xc9e1('0x1d')](_0x48afc1);}};}function respondWithFilteredResult(_0x3a2b13,_0x196d6a){return function(_0x98d285){if(_0x98d285){var _0xb1efef=_0x98d285[_0xc9e1('0x1e')],_0x528c92=_0x196d6a[_0xc9e1('0x1f')],_0x278ee9=_0x196d6a[_0xc9e1('0x1f')]+_0x196d6a[_0xc9e1('0x20')],_0x47c309;if(_0x278ee9>=_0xb1efef){_0x278ee9=_0xb1efef;_0x47c309=0xc8;}else{_0x47c309=0xce;}_0x3a2b13[_0xc9e1('0x1c')](_0x47c309);return _0x3a2b13[_0xc9e1('0x21')](_0xc9e1('0x22'),_0x528c92+'-'+_0x278ee9+'/'+_0xb1efef)[_0xc9e1('0x1d')](_0x98d285);}return null;};}function patchUpdates(_0x41451b){return function(_0x2d2dbe){try{jsonpatch['apply'](_0x2d2dbe,_0x41451b,!![]);}catch(_0x5ca4d8){return BPromise['reject'](_0x5ca4d8);}return _0x2d2dbe[_0xc9e1('0x23')]();};}function saveUpdates(_0x254f15,_0x1d8a15){return function(_0x4dd74f){if(_0x4dd74f){return _0x4dd74f[_0xc9e1('0x24')](_0x254f15)[_0xc9e1('0x25')](function(_0x2b55f1){return _0x2b55f1;});}return null;};}function removeEntity(_0x1106b5,_0x1e7f10){return function(_0x25d77f){if(_0x25d77f){return _0x25d77f[_0xc9e1('0x26')]()[_0xc9e1('0x25')](function(){var _0x29aaa1=_0x25d77f[_0xc9e1('0x27')]({'plain':!![]});var _0x517f93=_0xc9e1('0x28');return db[_0xc9e1('0x29')][_0xc9e1('0x26')]({'where':{'type':_0x517f93,'resourceId':_0x29aaa1['id']}})[_0xc9e1('0x25')](function(){return _0x25d77f;});})['then'](function(){_0x1106b5[_0xc9e1('0x1c')](0xcc)[_0xc9e1('0x2a')]();});}};}function handleEntityNotFound(_0x57cede,_0x144a9a){return function(_0x12894d){if(!_0x12894d){_0x57cede[_0xc9e1('0x2b')](0x194);}return _0x12894d;};}function handleError(_0x3cd0fc,_0x49fb07){_0x49fb07=_0x49fb07||0x1f4;return function(_0x5387c1){logger[_0xc9e1('0x2c')](_0x5387c1[_0xc9e1('0x2d')]);if(_0x5387c1[_0xc9e1('0x2e')]){delete _0x5387c1[_0xc9e1('0x2e')];}_0x3cd0fc[_0xc9e1('0x1c')](_0x49fb07)['send'](_0x5387c1);};}exports[_0xc9e1('0x2f')]=function(_0x44ae01,_0x1eb6e9){var _0x469b9c={},_0x5412d5={},_0x26cd34={'count':0x0,'rows':[]};var _0x597fd7=_['map'](db[_0xc9e1('0x30')][_0xc9e1('0x31')],function(_0x27b286){return{'name':_0x27b286[_0xc9e1('0x32')],'type':_0x27b286[_0xc9e1('0x33')][_0xc9e1('0x34')]};});_0x5412d5['model']=_['map'](_0x597fd7,'name');_0x5412d5[_0xc9e1('0x35')]=_[_0xc9e1('0x36')](_0x44ae01[_0xc9e1('0x35')]);_0x5412d5['filters']=_['intersection'](_0x5412d5[_0xc9e1('0x37')],_0x5412d5['query']);_0x469b9c[_0xc9e1('0x38')]=_[_0xc9e1('0x39')](_0x5412d5['model'],qs[_0xc9e1('0x3a')](_0x44ae01['query'][_0xc9e1('0x3a')]));_0x469b9c[_0xc9e1('0x38')]=_0x469b9c[_0xc9e1('0x38')]['length']?_0x469b9c[_0xc9e1('0x38')]:_0x5412d5['model'];if(!_0x44ae01[_0xc9e1('0x35')]['hasOwnProperty'](_0xc9e1('0x3b'))){_0x469b9c[_0xc9e1('0x20')]=qs[_0xc9e1('0x20')](_0x44ae01['query']['limit']);_0x469b9c[_0xc9e1('0x1f')]=qs[_0xc9e1('0x1f')](_0x44ae01[_0xc9e1('0x35')][_0xc9e1('0x1f')]);}_0x469b9c[_0xc9e1('0x3c')]=qs[_0xc9e1('0x3d')](_0x44ae01['query'][_0xc9e1('0x3d')]);_0x469b9c[_0xc9e1('0x3e')]=qs[_0xc9e1('0x3f')](_[_0xc9e1('0x40')](_0x44ae01[_0xc9e1('0x35')],_0x5412d5[_0xc9e1('0x3f')]),_0x597fd7);if(_0x44ae01['query'][_0xc9e1('0x41')]){_0x469b9c[_0xc9e1('0x3e')]=_['merge'](_0x469b9c['where'],{'$or':_[_0xc9e1('0x42')](_0x597fd7,function(_0x40a977){if(_0x40a977[_0xc9e1('0x33')]!==_0xc9e1('0x43')){var _0x5dadf2={};_0x5dadf2[_0x40a977[_0xc9e1('0x2e')]]={'$like':'%'+_0x44ae01['query'][_0xc9e1('0x41')]+'%'};return _0x5dadf2;}})});}_0x469b9c=_['merge']({},_0x469b9c,_0x44ae01[_0xc9e1('0x44')]);var _0x113056={'where':_0x469b9c[_0xc9e1('0x3e')]};return db[_0xc9e1('0x30')]['count'](_0x113056)[_0xc9e1('0x25')](function(_0x485dfe){_0x26cd34['count']=_0x485dfe;if(_0x44ae01[_0xc9e1('0x35')]['includeAll']){_0x469b9c['include']=[{'all':!![]}];}return db[_0xc9e1('0x30')]['findAll'](_0x469b9c);})[_0xc9e1('0x25')](function(_0x4fdba6){_0x26cd34['rows']=_0x4fdba6;return _0x26cd34;})[_0xc9e1('0x25')](respondWithFilteredResult(_0x1eb6e9,_0x469b9c))['catch'](handleError(_0x1eb6e9,null));};exports['show']=function(_0x35c0f4,_0x414606){var _0x56d1b6={'raw':![],'where':{'id':_0x35c0f4[_0xc9e1('0x45')]['id']}},_0x5387ce={};_0x5387ce['model']=_[_0xc9e1('0x36')](db[_0xc9e1('0x30')][_0xc9e1('0x31')]);_0x5387ce['query']=_['keys'](_0x35c0f4[_0xc9e1('0x35')]);_0x5387ce[_0xc9e1('0x3f')]=_[_0xc9e1('0x39')](_0x5387ce[_0xc9e1('0x37')],_0x5387ce[_0xc9e1('0x35')]);_0x56d1b6[_0xc9e1('0x38')]=_[_0xc9e1('0x39')](_0x5387ce['model'],qs[_0xc9e1('0x3a')](_0x35c0f4['query'][_0xc9e1('0x3a')]));_0x56d1b6['attributes']=_0x56d1b6[_0xc9e1('0x38')][_0xc9e1('0x46')]?_0x56d1b6['attributes']:_0x5387ce[_0xc9e1('0x37')];if(_0x35c0f4[_0xc9e1('0x35')][_0xc9e1('0x47')]){_0x56d1b6['include']=[{'all':!![]}];}_0x56d1b6=_['merge']({},_0x56d1b6,_0x35c0f4[_0xc9e1('0x44')]);return db[_0xc9e1('0x30')][_0xc9e1('0x48')](_0x56d1b6)['then'](handleEntityNotFound(_0x414606,null))[_0xc9e1('0x25')](respondWithResult(_0x414606,null))['catch'](handleError(_0x414606,null));};exports[_0xc9e1('0x49')]=function(_0x113521,_0x9d533d){return db[_0xc9e1('0x30')]['create'](_0x113521[_0xc9e1('0x4a')],{})[_0xc9e1('0x25')](function(_0x34502b){var _0x562dd9=_0x113521['user'][_0xc9e1('0x27')]({'plain':!![]});if(!_0x562dd9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x562dd9[_0xc9e1('0x4b')]===_0xc9e1('0x4c')){var _0x46e32b=_0x34502b['get']({'plain':!![]});var _0x5ab51d=_0xc9e1('0x28');return db[_0xc9e1('0x4d')][_0xc9e1('0x48')]({'where':{'name':_0x5ab51d,'userProfileId':_0x562dd9[_0xc9e1('0x4e')]},'raw':!![]})[_0xc9e1('0x25')](function(_0x4e2d08){if(_0x4e2d08&&_0x4e2d08['autoAssociation']===0x0){return db[_0xc9e1('0x29')][_0xc9e1('0x49')]({'name':_0x46e32b[_0xc9e1('0x2e')],'resourceId':_0x46e32b['id'],'type':_0x4e2d08[_0xc9e1('0x2e')],'sectionId':_0x4e2d08['id']},{})['then'](function(){return _0x34502b;});}else{return _0x34502b;}})['catch'](function(_0x504d8d){logger[_0xc9e1('0x2c')](_0xc9e1('0x4f'),_0x504d8d);throw _0x504d8d;});}return _0x34502b;})[_0xc9e1('0x25')](respondWithResult(_0x9d533d,0xc9))[_0xc9e1('0x50')](handleError(_0x9d533d,null));};exports[_0xc9e1('0x24')]=function(_0x52f98d,_0x3800d6){if(_0x52f98d[_0xc9e1('0x4a')]['id']){delete _0x52f98d[_0xc9e1('0x4a')]['id'];}return db[_0xc9e1('0x30')][_0xc9e1('0x48')]({'where':{'id':_0x52f98d[_0xc9e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x3800d6,null))[_0xc9e1('0x25')](saveUpdates(_0x52f98d['body'],null))[_0xc9e1('0x25')](respondWithResult(_0x3800d6,null))[_0xc9e1('0x50')](handleError(_0x3800d6,null));};exports['destroy']=function(_0x469420,_0x63dc0c){return db[_0xc9e1('0x30')][_0xc9e1('0x48')]({'where':{'id':_0x469420[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x63dc0c,null))[_0xc9e1('0x25')](removeEntity(_0x63dc0c,null))[_0xc9e1('0x50')](handleError(_0x63dc0c,null));};exports['describe']=function(_0x36ec30,_0x1d54a7){return db[_0xc9e1('0x30')]['describe']()['then'](respondWithResult(_0x1d54a7,null))[_0xc9e1('0x50')](handleError(_0x1d54a7,null));};exports['addDisposition']=function(_0x5d62aa,_0x1d1368,_0x25065c){if(_0x5d62aa['body']['id']){delete _0x5d62aa['body']['id'];}return db[_0xc9e1('0x30')][_0xc9e1('0x48')]({'where':{'id':_0x5d62aa[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x1d1368,null))[_0xc9e1('0x25')](function(_0xc07a21){if(_0xc07a21){_0x5d62aa[_0xc9e1('0x4a')][_0xc9e1('0x51')]=_0xc07a21['id'];return db[_0xc9e1('0x52')]['create'](_0x5d62aa[_0xc9e1('0x4a')]);}})['then'](respondWithResult(_0x1d1368,null))[_0xc9e1('0x50')](handleError(_0x1d1368,null));};exports[_0xc9e1('0x53')]=function(_0x1466e6,_0x4c42de,_0x454fa9){var _0x587adb={'raw':![],'where':{}};var _0x32c130={};var _0x457222={'count':0x0,'rows':[]};return db['CmList'][_0xc9e1('0x54')]({'where':{'id':_0x1466e6[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x4c42de,null))[_0xc9e1('0x25')](function(_0x2531d7){if(_0x2531d7){_0x32c130[_0xc9e1('0x37')]=_[_0xc9e1('0x36')](db['Disposition'][_0xc9e1('0x31')]);_0x32c130['query']=_[_0xc9e1('0x36')](_0x1466e6['query']);_0x32c130['filters']=_['intersection'](_0x32c130[_0xc9e1('0x37')],_0x32c130[_0xc9e1('0x35')]);_0x587adb[_0xc9e1('0x38')]=_[_0xc9e1('0x39')](_0x32c130[_0xc9e1('0x37')],qs[_0xc9e1('0x3a')](_0x1466e6[_0xc9e1('0x35')][_0xc9e1('0x3a')]));_0x587adb[_0xc9e1('0x38')]=_0x587adb[_0xc9e1('0x38')][_0xc9e1('0x46')]?_0x587adb['attributes']:_0x32c130[_0xc9e1('0x37')];if(!_0x1466e6['query'][_0xc9e1('0x55')](_0xc9e1('0x3b'))){_0x587adb['limit']=qs[_0xc9e1('0x20')](_0x1466e6[_0xc9e1('0x35')][_0xc9e1('0x20')]);_0x587adb[_0xc9e1('0x1f')]=qs[_0xc9e1('0x1f')](_0x1466e6['query'][_0xc9e1('0x1f')]);}_0x587adb['order']=qs[_0xc9e1('0x3d')](_0x1466e6[_0xc9e1('0x35')]['sort']);_0x587adb[_0xc9e1('0x3e')]=qs['filters'](_[_0xc9e1('0x40')](_0x1466e6[_0xc9e1('0x35')],_0x32c130[_0xc9e1('0x3f')]));_0x587adb['where'][_0xc9e1('0x51')]=_0x2531d7['id'];if(_0x1466e6['query'][_0xc9e1('0x41')]){_0x587adb[_0xc9e1('0x3e')]=_[_0xc9e1('0x56')](_0x587adb['where'],{'$or':_['map'](_0x587adb[_0xc9e1('0x38')],function(_0x5cbd0d){var _0x5d4dd3={};_0x5d4dd3[_0x5cbd0d]={'$like':'%'+_0x1466e6[_0xc9e1('0x35')]['filter']+'%'};return _0x5d4dd3;})});}_0x587adb=_['merge']({},_0x587adb,_0x1466e6['options']);return db[_0xc9e1('0x52')][_0xc9e1('0x1e')]({'where':_0x587adb[_0xc9e1('0x3e')]})[_0xc9e1('0x25')](function(_0x248dc7){_0x457222[_0xc9e1('0x1e')]=_0x248dc7;if(_0x1466e6[_0xc9e1('0x35')]['includeAll']){_0x587adb['include']=[{'all':!![]}];}return db[_0xc9e1('0x52')][_0xc9e1('0x57')](_0x587adb);})[_0xc9e1('0x25')](function(_0x388002){_0x457222[_0xc9e1('0x58')]=_0x388002;return _0x457222;});}})[_0xc9e1('0x25')](respondWithFilteredResult(_0x4c42de,_0x587adb))[_0xc9e1('0x50')](handleError(_0x4c42de,null));};exports[_0xc9e1('0x59')]=function(_0x3192d3,_0x4416a0,_0x52e279){return db[_0xc9e1('0x30')]['find']({'where':{'id':_0x3192d3[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x4416a0,null))[_0xc9e1('0x25')](function(_0x4d1901){if(_0x4d1901){return _0x4d1901['removeDispositions'](_0x3192d3[_0xc9e1('0x35')][_0xc9e1('0x5a')]);}})[_0xc9e1('0x25')](respondWithStatusCode(_0x4416a0,null))[_0xc9e1('0x50')](handleError(_0x4416a0,null));};exports[_0xc9e1('0x5b')]=function(_0xef22a5,_0x4c84f9,_0xf6efb3){return db[_0xc9e1('0x30')]['find']({'where':{'id':_0xef22a5[_0xc9e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c84f9,null))['then'](function(_0x51c39f){if(_0x51c39f){var _0x3673f0=[];var _0x5129e2={'success':[],'errors':[]};return db[_0xc9e1('0x5c')][_0xc9e1('0x5d')]()[_0xc9e1('0x25')](function(_0x3fb709){if(_0xef22a5[_0xc9e1('0x4a')]['tags']&&_[_0xc9e1('0x5e')](_0xef22a5['body']['tags'])){if(_0xef22a5['body'][_0xc9e1('0x5f')][_0xc9e1('0x46')]){_0xef22a5[_0xc9e1('0x4a')][_0xc9e1('0x5f')]=_0xef22a5[_0xc9e1('0x4a')][_0xc9e1('0x5f')][_0xc9e1('0x60')](';')+';';}else{_0xef22a5['body']['tags']=null;}}else{_0xef22a5['body'][_0xc9e1('0x5f')]=null;}if(_0xef22a5[_0xc9e1('0x4a')]&&_[_0xc9e1('0x5e')](_0xef22a5[_0xc9e1('0x4a')])){for(var _0x550e9a=0x0;_0x550e9a<_0xef22a5[_0xc9e1('0x4a')][_0xc9e1('0x46')];_0x550e9a+=0x1){_0xef22a5['body'][_0x550e9a][_0xc9e1('0x51')]=_0xef22a5[_0xc9e1('0x45')]['id'];_0x3673f0[_0xc9e1('0x61')](_0xef22a5[_0xc9e1('0x4a')][_0x550e9a]);}return BPromise[_0xc9e1('0x62')](_0x3673f0,function(_0x1af863){return db[_0xc9e1('0x5c')][_0xc9e1('0x49')](_[_0xc9e1('0x63')](_0x1af863,['ids','id'])||{},{'fields':_[_0xc9e1('0x36')](_0x3fb709),'raw':!![]})['then'](function(_0x5263c4){_0x5129e2[_0xc9e1('0x64')][_0xc9e1('0x61')](_0x5263c4[_0xc9e1('0x65')]);})[_0xc9e1('0x50')](function(_0x2a20b2){_0x5129e2[_0xc9e1('0x66')][_0xc9e1('0x61')]({'data':_0x1af863,'error':_0x2a20b2['message']});});})['then'](function(_0x3eee7d){return _0x5129e2;})['catch'](function(_0x2f270b){return _0x2f270b;});}else{_0x4c84f9['status'](0x190)['json']({'message':_0xc9e1('0x67')});}});}})[_0xc9e1('0x25')](respondWithResult(_0x4c84f9,null))[_0xc9e1('0x50')](handleError(_0x4c84f9,null));};exports[_0xc9e1('0x68')]=function(_0x35e0b0,_0xd39c32,_0x4d39c3){var _0x1c010e;return db[_0xc9e1('0x30')][_0xc9e1('0x48')]({'where':{'id':_0x35e0b0[_0xc9e1('0x45')]['id']},'include':[{'model':db[_0xc9e1('0x69')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0xd39c32,null))[_0xc9e1('0x25')](function(_0x22459f){if(_0x22459f){_0x1c010e=_0x22459f;return db[_0xc9e1('0x5c')][_0xc9e1('0x31')];}})[_0xc9e1('0x25')](function(_0x2456a6){if(_0x2456a6){var _0x364212={};var _0x291413={};_0x291413[_0xc9e1('0x37')]=_['concat'](_[_0xc9e1('0x36')](_0x2456a6),_[_0xc9e1('0x42')](_0x1c010e[_0xc9e1('0x6a')],function(_0x46b082){return util[_0xc9e1('0x6b')](_0xc9e1('0x6c'),_0x46b082['id']);}));_0x291413[_0xc9e1('0x35')]=_[_0xc9e1('0x36')](_0x35e0b0[_0xc9e1('0x35')]);_0x291413[_0xc9e1('0x3f')]=_[_0xc9e1('0x39')](_0x291413['model'],_0x291413[_0xc9e1('0x35')]);_0x364212[_0xc9e1('0x38')]=_[_0xc9e1('0x39')](_0x291413[_0xc9e1('0x37')],qs[_0xc9e1('0x3a')](_0x35e0b0[_0xc9e1('0x35')][_0xc9e1('0x3a')]));_0x364212[_0xc9e1('0x38')]=_0x364212[_0xc9e1('0x38')][_0xc9e1('0x46')]?_0x364212['attributes']:_0x291413[_0xc9e1('0x37')];if(!_0x35e0b0['query']['hasOwnProperty']('nolimit')){_0x364212['limit']=qs[_0xc9e1('0x20')](_0x35e0b0[_0xc9e1('0x35')][_0xc9e1('0x20')]);_0x364212[_0xc9e1('0x1f')]=qs['offset'](_0x35e0b0[_0xc9e1('0x35')]['offset']);}_0x364212['order']=qs[_0xc9e1('0x3d')](_0x35e0b0[_0xc9e1('0x35')][_0xc9e1('0x3d')]);_0x364212['where']=qs[_0xc9e1('0x3f')](_[_0xc9e1('0x40')](_0x35e0b0['query'],_0x291413['filters']));_0x364212[_0xc9e1('0x6d')]=!![];if(_0x35e0b0['query'][_0xc9e1('0x41')]){_0x364212['where']=_[_0xc9e1('0x56')](_0x364212[_0xc9e1('0x3e')],{'$or':_[_0xc9e1('0x42')](_0x364212[_0xc9e1('0x38')],function(_0x4cf36f){var _0x3d3d9b={};_0x3d3d9b[_0x4cf36f]={'$like':'%'+_0x35e0b0[_0xc9e1('0x35')]['filter']+'%'};return _0x3d3d9b;})});}_0x364212=_[_0xc9e1('0x56')]({},_0x364212,_0x35e0b0[_0xc9e1('0x44')]);return _0x1c010e['getContacts'](_0x364212);}})[_0xc9e1('0x25')](respondWithResult(_0xd39c32,null))[_0xc9e1('0x50')](handleError(_0xd39c32,null));};exports[_0xc9e1('0x6e')]=function(_0x38b56a,_0x16e25f,_0x2e0e93){var _0x60cefd;return db['CmList']['find']({'where':{'id':_0x38b56a['params']['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x16e25f,null))[_0xc9e1('0x25')](function(_0xf4f2d3){if(_0xf4f2d3){_0x60cefd=_0xf4f2d3;return db[_0xc9e1('0x5c')][_0xc9e1('0x31')];}})[_0xc9e1('0x25')](function(_0xdfeb73){if(_0xdfeb73){var _0x5c9f56={};var _0x22d84d={};_0x22d84d[_0xc9e1('0x37')]=_[_0xc9e1('0x6f')](_['keys'](_0xdfeb73),_[_0xc9e1('0x42')](_0x60cefd[_0xc9e1('0x6a')],function(_0x3ef78a){return util[_0xc9e1('0x6b')](_0xc9e1('0x6c'),_0x3ef78a['id']);}));_0x22d84d['query']=_[_0xc9e1('0x36')](_0x38b56a[_0xc9e1('0x35')]);_0x22d84d['filters']=_[_0xc9e1('0x39')](_0x22d84d['model'],_0x22d84d[_0xc9e1('0x35')]);_0x5c9f56[_0xc9e1('0x38')]=_[_0xc9e1('0x39')](_0x22d84d[_0xc9e1('0x37')],qs[_0xc9e1('0x3a')](_0x38b56a[_0xc9e1('0x35')][_0xc9e1('0x3a')]));_0x5c9f56[_0xc9e1('0x38')]=_0x5c9f56[_0xc9e1('0x38')][_0xc9e1('0x46')]?_0x5c9f56[_0xc9e1('0x38')]:_0x22d84d['model'];if(!_0x38b56a['query'][_0xc9e1('0x55')](_0xc9e1('0x3b'))){_0x5c9f56[_0xc9e1('0x20')]=qs[_0xc9e1('0x20')](_0x38b56a['query'][_0xc9e1('0x20')]);_0x5c9f56[_0xc9e1('0x1f')]=qs['offset'](_0x38b56a['query']['offset']);}_0x5c9f56[_0xc9e1('0x3c')]=qs[_0xc9e1('0x3d')](_0x38b56a['query'][_0xc9e1('0x3d')]);_0x5c9f56['where']=qs[_0xc9e1('0x3f')](_[_0xc9e1('0x40')](_0x38b56a[_0xc9e1('0x35')],_0x22d84d[_0xc9e1('0x3f')]));_0x5c9f56['raw']=!![];if(_0x38b56a['query'][_0xc9e1('0x41')]){_0x5c9f56[_0xc9e1('0x3e')]=_['merge'](_0x5c9f56['where'],{'$or':_[_0xc9e1('0x42')](_0x5c9f56['attributes'],function(_0x5048e7){var _0x3f6fad={};_0x3f6fad[_0x5048e7]={'$like':'%'+_0x38b56a[_0xc9e1('0x35')]['filter']+'%'};return _0x3f6fad;})});}_0x5c9f56=_[_0xc9e1('0x56')]({},_0x5c9f56,_0x38b56a[_0xc9e1('0x44')]);return _0x60cefd['getContacts'](_0x5c9f56);}})[_0xc9e1('0x25')](function(_0x38a969){if(!_[_0xc9e1('0x70')](_0x38a969)){var _0x459a29=toCsv(_0x38a969);var _0x271525=Date[_0xc9e1('0x71')]();fs['writeFileSync'](util[_0xc9e1('0x6b')]('/tmp/list_%d_%s.csv',_0x60cefd['id'],_0x271525),_0x459a29);_0x16e25f[_0xc9e1('0x72')]('Content-disposition',_0xc9e1('0x73')+util[_0xc9e1('0x6b')]('list_%d_%s.csv',_0x60cefd['id'],_0x271525));_0x16e25f[_0xc9e1('0x72')](_0xc9e1('0x74'),_0xc9e1('0x75'));return _0x16e25f[_0xc9e1('0x76')](util[_0xc9e1('0x6b')]('/tmp/list_%d_%s.csv',_0x60cefd['id'],_0x271525));}else{return _0x16e25f[_0xc9e1('0x2b')](0xcc);}})['catch'](handleError(_0x16e25f,null));};exports[_0xc9e1('0x77')]=function(_0x3dfd52,_0x5bf400,_0x401de0){var _0x3ec58d;delete _0x3dfd52[_0xc9e1('0x4a')]['id'];return db[_0xc9e1('0x30')][_0xc9e1('0x54')]({'where':{'id':_0x3dfd52['params']['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x5bf400,null))[_0xc9e1('0x25')](function(_0x33c06d){if(_0x33c06d){return db['sequelize'][_0xc9e1('0x78')](function(_0xd53f1f){return db[_0xc9e1('0x69')]['create'](_0x3dfd52['body'],{'transaction':_0xd53f1f})['then'](function(_0x3a785c){_0x3ec58d=_0x3a785c;return _0x33c06d['addCustomFields'](_0x3a785c,{'transaction':_0xd53f1f});})[_0xc9e1('0x25')](function(){var _0x2b0c3c={'type':db[_0xc9e1('0x79')][_0xc9e1('0x7a')],'transaction':_0xd53f1f};switch(_0x3dfd52['body'][_0xc9e1('0x33')]){case'text':_0x2b0c3c[_0xc9e1('0x33')]=db[_0xc9e1('0x79')]['TEXT'];break;case _0xc9e1('0x7b'):_0x2b0c3c['type']=db['Sequelize'][_0xc9e1('0x7c')];break;case _0xc9e1('0x7d'):_0x2b0c3c[_0xc9e1('0x33')]=db[_0xc9e1('0x79')][_0xc9e1('0x7e')];_0x2b0c3c[_0xc9e1('0x7f')]=![];break;default:}return db[_0xc9e1('0x80')][_0xc9e1('0x81')][_0xc9e1('0x82')](_0xc9e1('0x83'),util[_0xc9e1('0x6b')](_0xc9e1('0x84'),_0x3ec58d['id']),_0x2b0c3c);})[_0xc9e1('0x25')](function(){return _0x3ec58d;});});}})[_0xc9e1('0x25')](respondWithResult(_0x5bf400,null))['catch'](handleError(_0x5bf400,null));};exports[_0xc9e1('0x85')]=function(_0x1c70df,_0x1db259,_0x441a91){var _0x39953a={};var _0x18bd20={};var _0x21c1a1;var _0x790939;return db[_0xc9e1('0x30')][_0xc9e1('0x54')]({'where':{'id':_0x1c70df[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x1db259,null))[_0xc9e1('0x25')](function(_0x395c50){if(_0x395c50){_0x21c1a1=_0x395c50;_0x18bd20[_0xc9e1('0x37')]=_[_0xc9e1('0x36')](db[_0xc9e1('0x69')]['rawAttributes']);_0x18bd20['query']=_['keys'](_0x1c70df['query']);_0x18bd20[_0xc9e1('0x3f')]=_[_0xc9e1('0x39')](_0x18bd20[_0xc9e1('0x37')],_0x18bd20[_0xc9e1('0x35')]);_0x39953a['attributes']=_[_0xc9e1('0x39')](_0x18bd20['model'],qs['fields'](_0x1c70df['query']['fields']));_0x39953a[_0xc9e1('0x38')]=_0x39953a[_0xc9e1('0x38')][_0xc9e1('0x46')]?_0x39953a[_0xc9e1('0x38')]:_0x18bd20['model'];_0x39953a[_0xc9e1('0x3c')]=qs[_0xc9e1('0x3d')](_0x1c70df[_0xc9e1('0x35')][_0xc9e1('0x3d')]);_0x39953a[_0xc9e1('0x3e')]=qs[_0xc9e1('0x3f')](_[_0xc9e1('0x40')](_0x1c70df[_0xc9e1('0x35')],_0x18bd20['filters']));_0x39953a[_0xc9e1('0x3e')]=_[_0xc9e1('0x56')](_0x39953a[_0xc9e1('0x3e')],{'$or':[{'ListId':_0x395c50['id']},{'ListId':null}]});if(_0x1c70df[_0xc9e1('0x35')][_0xc9e1('0x41')]){_0x39953a[_0xc9e1('0x3e')]=_[_0xc9e1('0x56')](_0x39953a[_0xc9e1('0x3e')],{'$or':_['map'](_0x39953a[_0xc9e1('0x38')],function(_0x1a6d6d){var _0x198ae2={};_0x198ae2[_0x1a6d6d]={'$like':'%'+_0x1c70df['query'][_0xc9e1('0x41')]+'%'};return _0x198ae2;})});}_0x39953a=_[_0xc9e1('0x56')]({},_0x39953a,_0x1c70df[_0xc9e1('0x44')]);return db[_0xc9e1('0x69')][_0xc9e1('0x86')](_0x39953a);}})[_0xc9e1('0x25')](respondWithResult(_0x1db259,null))[_0xc9e1('0x50')](handleError(_0x1db259,null));};exports[_0xc9e1('0x87')]=function(_0x460fa4,_0x475904,_0x5a6577){return db[_0xc9e1('0x30')]['find']({'where':{'id':_0x460fa4[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x475904,null))[_0xc9e1('0x25')](function(_0x2e0e91){if(_0x2e0e91){return _0x2e0e91['addAgents'](_0x460fa4[_0xc9e1('0x4a')][_0xc9e1('0x5a')],_['omit'](_0x460fa4[_0xc9e1('0x4a')],[_0xc9e1('0x5a'),'id'])||{})[_0xc9e1('0x88')](function(_0x4020fc){for(var _0x5c631d=0x0;_0x5c631d<_0x460fa4[_0xc9e1('0x4a')][_0xc9e1('0x5a')][_0xc9e1('0x46')];_0x5c631d+=0x1){socket[_0xc9e1('0x89')]('userCmList:save',{'UserId':_0x460fa4[_0xc9e1('0x4a')]['ids'][_0x5c631d],'CmListId':_0x460fa4[_0xc9e1('0x45')]['id']});}return _0x4020fc;});}})[_0xc9e1('0x25')](respondWithResult(_0x475904,null))[_0xc9e1('0x50')](handleError(_0x475904,null));};exports['removeAgents']=function(_0x15f867,_0x4320af,_0x321d58){return db[_0xc9e1('0x30')][_0xc9e1('0x48')]({'where':{'id':_0x15f867[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x4320af,null))[_0xc9e1('0x25')](function(_0x14edf7){if(_0x14edf7){return _0x14edf7['removeAgents'](_0x15f867[_0xc9e1('0x35')][_0xc9e1('0x5a')])[_0xc9e1('0x25')](function(){if(_[_0xc9e1('0x5e')](_0x15f867['query'][_0xc9e1('0x5a')])){for(var _0x2e023a=0x0;_0x2e023a<_0x15f867[_0xc9e1('0x35')][_0xc9e1('0x5a')][_0xc9e1('0x46')];_0x2e023a+=0x1){socket[_0xc9e1('0x89')](_0xc9e1('0x8a'),{'UserId':Number(_0x15f867[_0xc9e1('0x35')][_0xc9e1('0x5a')][_0x2e023a]),'CmListId':Number(_0x15f867['params']['id'])});}}else{socket[_0xc9e1('0x89')](_0xc9e1('0x8a'),{'UserId':Number(_0x15f867[_0xc9e1('0x35')]['ids']),'CmListId':Number(_0x15f867[_0xc9e1('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x4320af,null))[_0xc9e1('0x50')](handleError(_0x4320af,null));};exports['getAgents']=function(_0x578d57,_0x3f968d,_0x476ef8){var _0x5b3513={};var _0x405b9e={};var _0x561cb7;var _0x13c292;return db[_0xc9e1('0x30')]['findOne']({'where':{'id':_0x578d57[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x3f968d,null))[_0xc9e1('0x25')](function(_0x9d7ef3){if(_0x9d7ef3){_0x561cb7=_0x9d7ef3;_0x405b9e['model']=_[_0xc9e1('0x36')](db[_0xc9e1('0x8b')][_0xc9e1('0x31')]);_0x405b9e[_0xc9e1('0x35')]=_[_0xc9e1('0x36')](_0x578d57[_0xc9e1('0x35')]);_0x405b9e[_0xc9e1('0x3f')]=_[_0xc9e1('0x39')](_0x405b9e['model'],_0x405b9e['query']);_0x5b3513[_0xc9e1('0x38')]=_[_0xc9e1('0x39')](_0x405b9e[_0xc9e1('0x37')],qs[_0xc9e1('0x3a')](_0x578d57[_0xc9e1('0x35')][_0xc9e1('0x3a')]));_0x5b3513[_0xc9e1('0x38')]=_0x5b3513[_0xc9e1('0x38')][_0xc9e1('0x46')]?_0x5b3513[_0xc9e1('0x38')]:_0x405b9e[_0xc9e1('0x37')];_0x5b3513[_0xc9e1('0x3c')]=qs[_0xc9e1('0x3d')](_0x578d57[_0xc9e1('0x35')][_0xc9e1('0x3d')]);_0x5b3513[_0xc9e1('0x3e')]=qs[_0xc9e1('0x3f')](_['pick'](_0x578d57['query'],_0x405b9e['filters']));if(_0x578d57[_0xc9e1('0x35')][_0xc9e1('0x41')]){_0x5b3513[_0xc9e1('0x3e')]=_[_0xc9e1('0x56')](_0x5b3513['where'],{'$or':_[_0xc9e1('0x42')](_0x5b3513['attributes'],function(_0x3dd975){var _0x332873={};_0x332873[_0x3dd975]={'$like':'%'+_0x578d57[_0xc9e1('0x35')][_0xc9e1('0x41')]+'%'};return _0x332873;})});}_0x5b3513=_[_0xc9e1('0x56')]({},_0x5b3513,_0x578d57[_0xc9e1('0x44')]);return _0x561cb7['getAgents'](_0x5b3513);}})[_0xc9e1('0x25')](function(_0x11fd10){if(_0x11fd10){_0x13c292=_0x11fd10[_0xc9e1('0x46')];if(!_0x578d57[_0xc9e1('0x35')][_0xc9e1('0x55')]('nolimit')){_0x5b3513[_0xc9e1('0x20')]=qs[_0xc9e1('0x20')](_0x578d57[_0xc9e1('0x35')][_0xc9e1('0x20')]);_0x5b3513['offset']=qs['offset'](_0x578d57[_0xc9e1('0x35')][_0xc9e1('0x1f')]);}return _0x561cb7[_0xc9e1('0x8c')](_0x5b3513);}})[_0xc9e1('0x25')](function(_0x4cda91){if(_0x4cda91){return _0x4cda91?{'count':_0x13c292,'rows':_0x4cda91}:null;}})[_0xc9e1('0x25')](respondWithResult(_0x3f968d,null))['catch'](handleError(_0x3f968d,null));}; \ No newline at end of file +var _0x8f46=['describe','addDisposition','ListId','Disposition','keys','length','includeAll','include','removeDispositions','addContacts','tags','isArray','join','push','each','CmContact','omit','ids','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','raw','getContactsCsv','cf_%d','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','/tmp/list_%d_%s.csv','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','get','Lists','error','stack','name','index','map','CmList','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','find'];(function(_0x5f6aa8,_0x249788){var _0x560c9a=function(_0x25e006){while(--_0x25e006){_0x5f6aa8['push'](_0x5f6aa8['shift']());}};_0x560c9a(++_0x249788);}(_0x8f46,0x1ee));var _0x68f4=function(_0x56a1a9,_0x3f2473){_0x56a1a9=_0x56a1a9-0x0;var _0x26b6fe=_0x8f46[_0x56a1a9];return _0x26b6fe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x68f4('0x0'));var rimraf=require(_0x68f4('0x1'));var zipdir=require(_0x68f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68f4('0x3'));var moment=require(_0x68f4('0x4'));var BPromise=require(_0x68f4('0x5'));var Mustache=require(_0x68f4('0x6'));var util=require('util');var path=require(_0x68f4('0x7'));var sox=require(_0x68f4('0x8'));var csv=require(_0x68f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68f4('0xa'));var _=require(_0x68f4('0xb'));var squel=require(_0x68f4('0xc'));var crypto=require(_0x68f4('0xd'));var jsforce=require(_0x68f4('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x68f4('0xf'));var Papa=require(_0x68f4('0x10'));var Redis=require('ioredis');var authService=require(_0x68f4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68f4('0x12'));var logger=require('../../config/logger')(_0x68f4('0x13'));var utils=require(_0x68f4('0x14'));var config=require(_0x68f4('0x15'));var licenseUtil=require(_0x68f4('0x16'));var db=require('../../mysqldb')['db'];config[_0x68f4('0x17')]=_[_0x68f4('0x18')](config[_0x68f4('0x17')],{'host':_0x68f4('0x19'),'port':0x18eb});var socket=require(_0x68f4('0x1a'))(new Redis(config[_0x68f4('0x17')]));require('./cmList.socket')[_0x68f4('0x1b')](socket);function respondWithStatusCode(_0x3d1da1,_0x10c107){_0x10c107=_0x10c107||0xcc;return function(_0x4c665a){if(_0x4c665a){return _0x3d1da1[_0x68f4('0x1c')](_0x10c107);}return _0x3d1da1[_0x68f4('0x1d')](_0x10c107)[_0x68f4('0x1e')]();};}function respondWithResult(_0x2c22e8,_0x2488b1){_0x2488b1=_0x2488b1||0xc8;return function(_0x1cfffc){if(_0x1cfffc){return _0x2c22e8['status'](_0x2488b1)[_0x68f4('0x1f')](_0x1cfffc);}};}function respondWithFilteredResult(_0x322278,_0x28fa9c){return function(_0x284448){if(_0x284448){var _0x296d39=_0x284448[_0x68f4('0x20')],_0x4006cd=_0x28fa9c[_0x68f4('0x21')],_0x3794a6=_0x28fa9c[_0x68f4('0x21')]+_0x28fa9c[_0x68f4('0x22')],_0x32b7b6;if(_0x3794a6>=_0x296d39){_0x3794a6=_0x296d39;_0x32b7b6=0xc8;}else{_0x32b7b6=0xce;}_0x322278[_0x68f4('0x1d')](_0x32b7b6);return _0x322278['set'](_0x68f4('0x23'),_0x4006cd+'-'+_0x3794a6+'/'+_0x296d39)[_0x68f4('0x1f')](_0x284448);}return null;};}function patchUpdates(_0x28f389){return function(_0x1cc9f6){try{jsonpatch[_0x68f4('0x24')](_0x1cc9f6,_0x28f389,!![]);}catch(_0x28e64d){return BPromise[_0x68f4('0x25')](_0x28e64d);}return _0x1cc9f6['save']();};}function saveUpdates(_0x226c2c,_0x4954a0){return function(_0x513841){if(_0x513841){return _0x513841[_0x68f4('0x26')](_0x226c2c)['then'](function(_0x166667){return _0x166667;});}return null;};}function removeEntity(_0x5eaef7,_0x501d49){return function(_0x44812d){if(_0x44812d){return _0x44812d[_0x68f4('0x27')]()[_0x68f4('0x28')](function(){var _0x352f88=_0x44812d[_0x68f4('0x29')]({'plain':!![]});var _0xe13948=_0x68f4('0x2a');return db['UserProfileResource'][_0x68f4('0x27')]({'where':{'type':_0xe13948,'resourceId':_0x352f88['id']}})[_0x68f4('0x28')](function(){return _0x44812d;});})['then'](function(){_0x5eaef7['status'](0xcc)[_0x68f4('0x1e')]();});}};}function handleEntityNotFound(_0x256f9,_0x3b28ed){return function(_0x1be480){if(!_0x1be480){_0x256f9['sendStatus'](0x194);}return _0x1be480;};}function handleError(_0x131cba,_0x2630c5){_0x2630c5=_0x2630c5||0x1f4;return function(_0x1e99d9){logger[_0x68f4('0x2b')](_0x1e99d9[_0x68f4('0x2c')]);if(_0x1e99d9[_0x68f4('0x2d')]){delete _0x1e99d9[_0x68f4('0x2d')];}_0x131cba[_0x68f4('0x1d')](_0x2630c5)['send'](_0x1e99d9);};}exports[_0x68f4('0x2e')]=function(_0x39a7fe,_0x359eb7){var _0x366b98={},_0x5ebb1a={},_0x4523a2={'count':0x0,'rows':[]};var _0x39b690=_[_0x68f4('0x2f')](db[_0x68f4('0x30')][_0x68f4('0x31')],function(_0x9411f){return{'name':_0x9411f[_0x68f4('0x32')],'type':_0x9411f[_0x68f4('0x33')][_0x68f4('0x34')]};});_0x5ebb1a['model']=_['map'](_0x39b690,_0x68f4('0x2d'));_0x5ebb1a[_0x68f4('0x35')]=_['keys'](_0x39a7fe[_0x68f4('0x35')]);_0x5ebb1a[_0x68f4('0x36')]=_[_0x68f4('0x37')](_0x5ebb1a[_0x68f4('0x38')],_0x5ebb1a[_0x68f4('0x35')]);_0x366b98[_0x68f4('0x39')]=_[_0x68f4('0x37')](_0x5ebb1a[_0x68f4('0x38')],qs[_0x68f4('0x3a')](_0x39a7fe[_0x68f4('0x35')][_0x68f4('0x3a')]));_0x366b98['attributes']=_0x366b98[_0x68f4('0x39')]['length']?_0x366b98[_0x68f4('0x39')]:_0x5ebb1a[_0x68f4('0x38')];if(!_0x39a7fe[_0x68f4('0x35')][_0x68f4('0x3b')](_0x68f4('0x3c'))){_0x366b98[_0x68f4('0x22')]=qs[_0x68f4('0x22')](_0x39a7fe['query'][_0x68f4('0x22')]);_0x366b98[_0x68f4('0x21')]=qs[_0x68f4('0x21')](_0x39a7fe['query'][_0x68f4('0x21')]);}_0x366b98[_0x68f4('0x3d')]=qs[_0x68f4('0x3e')](_0x39a7fe[_0x68f4('0x35')]['sort']);_0x366b98[_0x68f4('0x3f')]=qs['filters'](_[_0x68f4('0x40')](_0x39a7fe[_0x68f4('0x35')],_0x5ebb1a[_0x68f4('0x36')]),_0x39b690);if(_0x39a7fe[_0x68f4('0x35')]['filter']){_0x366b98[_0x68f4('0x3f')]=_[_0x68f4('0x41')](_0x366b98[_0x68f4('0x3f')],{'$or':_[_0x68f4('0x2f')](_0x39b690,function(_0x290dbf){if(_0x290dbf['type']!==_0x68f4('0x42')){var _0x21b1bc={};_0x21b1bc[_0x290dbf[_0x68f4('0x2d')]]={'$like':'%'+_0x39a7fe[_0x68f4('0x35')][_0x68f4('0x43')]+'%'};return _0x21b1bc;}})});}_0x366b98=_[_0x68f4('0x41')]({},_0x366b98,_0x39a7fe[_0x68f4('0x44')]);var _0x3687aa={'where':_0x366b98[_0x68f4('0x3f')]};return db[_0x68f4('0x30')][_0x68f4('0x20')](_0x3687aa)['then'](function(_0x369be9){_0x4523a2['count']=_0x369be9;if(_0x39a7fe[_0x68f4('0x35')]['includeAll']){_0x366b98['include']=[{'all':!![]}];}return db[_0x68f4('0x30')][_0x68f4('0x45')](_0x366b98);})[_0x68f4('0x28')](function(_0x3ef976){_0x4523a2[_0x68f4('0x46')]=_0x3ef976;return _0x4523a2;})['then'](respondWithFilteredResult(_0x359eb7,_0x366b98))[_0x68f4('0x47')](handleError(_0x359eb7,null));};exports['show']=function(_0x392076,_0x52add6){var _0x36eca2={'raw':![],'where':{'id':_0x392076[_0x68f4('0x48')]['id']}},_0x1d7c01={};_0x1d7c01[_0x68f4('0x38')]=_['keys'](db[_0x68f4('0x30')]['rawAttributes']);_0x1d7c01[_0x68f4('0x35')]=_['keys'](_0x392076[_0x68f4('0x35')]);_0x1d7c01['filters']=_[_0x68f4('0x37')](_0x1d7c01['model'],_0x1d7c01[_0x68f4('0x35')]);_0x36eca2['attributes']=_['intersection'](_0x1d7c01[_0x68f4('0x38')],qs[_0x68f4('0x3a')](_0x392076[_0x68f4('0x35')][_0x68f4('0x3a')]));_0x36eca2['attributes']=_0x36eca2['attributes']['length']?_0x36eca2[_0x68f4('0x39')]:_0x1d7c01[_0x68f4('0x38')];if(_0x392076[_0x68f4('0x35')]['includeAll']){_0x36eca2['include']=[{'all':!![]}];}_0x36eca2=_[_0x68f4('0x41')]({},_0x36eca2,_0x392076[_0x68f4('0x44')]);return db[_0x68f4('0x30')]['find'](_0x36eca2)[_0x68f4('0x28')](handleEntityNotFound(_0x52add6,null))[_0x68f4('0x28')](respondWithResult(_0x52add6,null))[_0x68f4('0x47')](handleError(_0x52add6,null));};exports[_0x68f4('0x49')]=function(_0x4155dc,_0x3244c2){return db['CmList'][_0x68f4('0x49')](_0x4155dc[_0x68f4('0x4a')],{})[_0x68f4('0x28')](function(_0x24601b){var _0x2f0cd4=_0x4155dc['user'][_0x68f4('0x29')]({'plain':!![]});if(!_0x2f0cd4)throw new Error(_0x68f4('0x4b'));if(_0x2f0cd4[_0x68f4('0x4c')]===_0x68f4('0x4d')){var _0x4f9261=_0x24601b['get']({'plain':!![]});var _0x8a6df2=_0x68f4('0x2a');return db[_0x68f4('0x4e')]['find']({'where':{'name':_0x8a6df2,'userProfileId':_0x2f0cd4[_0x68f4('0x4f')]},'raw':!![]})[_0x68f4('0x28')](function(_0x2bec03){if(_0x2bec03&&_0x2bec03[_0x68f4('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f9261['name'],'resourceId':_0x4f9261['id'],'type':_0x2bec03['name'],'sectionId':_0x2bec03['id']},{})[_0x68f4('0x28')](function(){return _0x24601b;});}else{return _0x24601b;}})[_0x68f4('0x47')](function(_0x10dd61){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10dd61);throw _0x10dd61;});}return _0x24601b;})[_0x68f4('0x28')](respondWithResult(_0x3244c2,0xc9))[_0x68f4('0x47')](handleError(_0x3244c2,null));};exports[_0x68f4('0x26')]=function(_0x3a6e44,_0x4ee348){if(_0x3a6e44[_0x68f4('0x4a')]['id']){delete _0x3a6e44[_0x68f4('0x4a')]['id'];}return db[_0x68f4('0x30')][_0x68f4('0x51')]({'where':{'id':_0x3a6e44[_0x68f4('0x48')]['id']}})['then'](handleEntityNotFound(_0x4ee348,null))['then'](saveUpdates(_0x3a6e44[_0x68f4('0x4a')],null))[_0x68f4('0x28')](respondWithResult(_0x4ee348,null))[_0x68f4('0x47')](handleError(_0x4ee348,null));};exports['destroy']=function(_0xe9af8b,_0x591456){return db[_0x68f4('0x30')]['find']({'where':{'id':_0xe9af8b[_0x68f4('0x48')]['id']}})[_0x68f4('0x28')](handleEntityNotFound(_0x591456,null))[_0x68f4('0x28')](removeEntity(_0x591456,null))[_0x68f4('0x47')](handleError(_0x591456,null));};exports['describe']=function(_0x131984,_0x21150d){return db['CmList'][_0x68f4('0x52')]()['then'](respondWithResult(_0x21150d,null))[_0x68f4('0x47')](handleError(_0x21150d,null));};exports[_0x68f4('0x53')]=function(_0x474f28,_0x208a86,_0x357ad0){if(_0x474f28['body']['id']){delete _0x474f28[_0x68f4('0x4a')]['id'];}return db[_0x68f4('0x30')][_0x68f4('0x51')]({'where':{'id':_0x474f28[_0x68f4('0x48')]['id']}})['then'](handleEntityNotFound(_0x208a86,null))[_0x68f4('0x28')](function(_0x437442){if(_0x437442){_0x474f28[_0x68f4('0x4a')][_0x68f4('0x54')]=_0x437442['id'];return db[_0x68f4('0x55')][_0x68f4('0x49')](_0x474f28[_0x68f4('0x4a')]);}})['then'](respondWithResult(_0x208a86,null))[_0x68f4('0x47')](handleError(_0x208a86,null));};exports['getDispositions']=function(_0x5499b9,_0x40e315,_0x50d27f){var _0x490286={'raw':![],'where':{}};var _0x224cab={};var _0x4ff256={'count':0x0,'rows':[]};return db[_0x68f4('0x30')]['findOne']({'where':{'id':_0x5499b9[_0x68f4('0x48')]['id']}})[_0x68f4('0x28')](handleEntityNotFound(_0x40e315,null))[_0x68f4('0x28')](function(_0x15988){if(_0x15988){_0x224cab[_0x68f4('0x38')]=_[_0x68f4('0x56')](db['Disposition'][_0x68f4('0x31')]);_0x224cab[_0x68f4('0x35')]=_[_0x68f4('0x56')](_0x5499b9[_0x68f4('0x35')]);_0x224cab[_0x68f4('0x36')]=_[_0x68f4('0x37')](_0x224cab[_0x68f4('0x38')],_0x224cab['query']);_0x490286['attributes']=_[_0x68f4('0x37')](_0x224cab['model'],qs[_0x68f4('0x3a')](_0x5499b9['query'][_0x68f4('0x3a')]));_0x490286[_0x68f4('0x39')]=_0x490286['attributes'][_0x68f4('0x57')]?_0x490286[_0x68f4('0x39')]:_0x224cab[_0x68f4('0x38')];if(!_0x5499b9[_0x68f4('0x35')][_0x68f4('0x3b')](_0x68f4('0x3c'))){_0x490286[_0x68f4('0x22')]=qs[_0x68f4('0x22')](_0x5499b9['query']['limit']);_0x490286['offset']=qs['offset'](_0x5499b9[_0x68f4('0x35')]['offset']);}_0x490286[_0x68f4('0x3d')]=qs['sort'](_0x5499b9[_0x68f4('0x35')]['sort']);_0x490286['where']=qs[_0x68f4('0x36')](_[_0x68f4('0x40')](_0x5499b9[_0x68f4('0x35')],_0x224cab[_0x68f4('0x36')]));_0x490286[_0x68f4('0x3f')][_0x68f4('0x54')]=_0x15988['id'];if(_0x5499b9[_0x68f4('0x35')][_0x68f4('0x43')]){_0x490286[_0x68f4('0x3f')]=_[_0x68f4('0x41')](_0x490286[_0x68f4('0x3f')],{'$or':_['map'](_0x490286[_0x68f4('0x39')],function(_0x210fd2){var _0x26f973={};_0x26f973[_0x210fd2]={'$like':'%'+_0x5499b9[_0x68f4('0x35')][_0x68f4('0x43')]+'%'};return _0x26f973;})});}_0x490286=_[_0x68f4('0x41')]({},_0x490286,_0x5499b9[_0x68f4('0x44')]);return db[_0x68f4('0x55')]['count']({'where':_0x490286[_0x68f4('0x3f')]})[_0x68f4('0x28')](function(_0xf94cd6){_0x4ff256[_0x68f4('0x20')]=_0xf94cd6;if(_0x5499b9[_0x68f4('0x35')][_0x68f4('0x58')]){_0x490286[_0x68f4('0x59')]=[{'all':!![]}];}return db[_0x68f4('0x55')][_0x68f4('0x45')](_0x490286);})['then'](function(_0x554394){_0x4ff256[_0x68f4('0x46')]=_0x554394;return _0x4ff256;});}})[_0x68f4('0x28')](respondWithFilteredResult(_0x40e315,_0x490286))[_0x68f4('0x47')](handleError(_0x40e315,null));};exports[_0x68f4('0x5a')]=function(_0x5d61b8,_0x5884e4,_0x1c96d4){return db[_0x68f4('0x30')][_0x68f4('0x51')]({'where':{'id':_0x5d61b8[_0x68f4('0x48')]['id']}})[_0x68f4('0x28')](handleEntityNotFound(_0x5884e4,null))[_0x68f4('0x28')](function(_0x491725){if(_0x491725){return _0x491725[_0x68f4('0x5a')](_0x5d61b8['query']['ids']);}})[_0x68f4('0x28')](respondWithStatusCode(_0x5884e4,null))['catch'](handleError(_0x5884e4,null));};exports[_0x68f4('0x5b')]=function(_0x27be9,_0x1c1cf0,_0x122b3b){return db[_0x68f4('0x30')][_0x68f4('0x51')]({'where':{'id':_0x27be9['params']['id']}})[_0x68f4('0x28')](handleEntityNotFound(_0x1c1cf0,null))[_0x68f4('0x28')](function(_0x2aa619){if(_0x2aa619){var _0x2cac65=[];var _0x4b3849={'success':[],'errors':[]};return db['CmContact'][_0x68f4('0x52')]()[_0x68f4('0x28')](function(_0x307ea1){if(_0x27be9[_0x68f4('0x4a')][_0x68f4('0x5c')]&&_[_0x68f4('0x5d')](_0x27be9[_0x68f4('0x4a')]['tags'])){if(_0x27be9[_0x68f4('0x4a')]['tags']['length']){_0x27be9[_0x68f4('0x4a')]['tags']=_0x27be9[_0x68f4('0x4a')][_0x68f4('0x5c')][_0x68f4('0x5e')](';')+';';}else{_0x27be9[_0x68f4('0x4a')][_0x68f4('0x5c')]=null;}}else{_0x27be9[_0x68f4('0x4a')]['tags']=null;}if(_0x27be9[_0x68f4('0x4a')]&&_[_0x68f4('0x5d')](_0x27be9[_0x68f4('0x4a')])){for(var _0x47e0a1=0x0;_0x47e0a1<_0x27be9[_0x68f4('0x4a')][_0x68f4('0x57')];_0x47e0a1+=0x1){_0x27be9[_0x68f4('0x4a')][_0x47e0a1][_0x68f4('0x54')]=_0x27be9[_0x68f4('0x48')]['id'];_0x2cac65[_0x68f4('0x5f')](_0x27be9[_0x68f4('0x4a')][_0x47e0a1]);}return BPromise[_0x68f4('0x60')](_0x2cac65,function(_0x1c4b34){return db[_0x68f4('0x61')]['create'](_[_0x68f4('0x62')](_0x1c4b34,[_0x68f4('0x63'),'id'])||{},{'fields':_[_0x68f4('0x56')](_0x307ea1),'raw':!![]})['then'](function(_0x2de64a){_0x4b3849['success'][_0x68f4('0x5f')](_0x2de64a[_0x68f4('0x64')]);})[_0x68f4('0x47')](function(_0x39e1f0){_0x4b3849[_0x68f4('0x65')][_0x68f4('0x5f')]({'data':_0x1c4b34,'error':_0x39e1f0[_0x68f4('0x66')]});});})['then'](function(_0x40ee07){return _0x4b3849;})[_0x68f4('0x47')](function(_0x4a9f57){return _0x4a9f57;});}else{_0x1c1cf0[_0x68f4('0x1d')](0x190)[_0x68f4('0x1f')]({'message':_0x68f4('0x67')});}});}})[_0x68f4('0x28')](respondWithResult(_0x1c1cf0,null))[_0x68f4('0x47')](handleError(_0x1c1cf0,null));};exports[_0x68f4('0x68')]=function(_0x218105,_0x57f732,_0x1816de){var _0x3485bd;return db[_0x68f4('0x30')]['find']({'where':{'id':_0x218105['params']['id']},'include':[{'model':db[_0x68f4('0x69')],'as':_0x68f4('0x6a')}]})[_0x68f4('0x28')](handleEntityNotFound(_0x57f732,null))[_0x68f4('0x28')](function(_0x55a743){if(_0x55a743){_0x3485bd=_0x55a743;return db['CmContact'][_0x68f4('0x31')];}})[_0x68f4('0x28')](function(_0x43e93c){if(_0x43e93c){var _0x569a9b={};var _0x41e2cd={};_0x41e2cd[_0x68f4('0x38')]=_[_0x68f4('0x6b')](_[_0x68f4('0x56')](_0x43e93c),_[_0x68f4('0x2f')](_0x3485bd[_0x68f4('0x6a')],function(_0xa48588){return util[_0x68f4('0x6c')]('cf_%d',_0xa48588['id']);}));_0x41e2cd['query']=_[_0x68f4('0x56')](_0x218105['query']);_0x41e2cd[_0x68f4('0x36')]=_[_0x68f4('0x37')](_0x41e2cd['model'],_0x41e2cd[_0x68f4('0x35')]);_0x569a9b[_0x68f4('0x39')]=_[_0x68f4('0x37')](_0x41e2cd[_0x68f4('0x38')],qs[_0x68f4('0x3a')](_0x218105[_0x68f4('0x35')][_0x68f4('0x3a')]));_0x569a9b[_0x68f4('0x39')]=_0x569a9b['attributes'][_0x68f4('0x57')]?_0x569a9b['attributes']:_0x41e2cd[_0x68f4('0x38')];if(!_0x218105['query'][_0x68f4('0x3b')](_0x68f4('0x3c'))){_0x569a9b[_0x68f4('0x22')]=qs[_0x68f4('0x22')](_0x218105[_0x68f4('0x35')]['limit']);_0x569a9b[_0x68f4('0x21')]=qs[_0x68f4('0x21')](_0x218105['query'][_0x68f4('0x21')]);}_0x569a9b[_0x68f4('0x3d')]=qs['sort'](_0x218105[_0x68f4('0x35')][_0x68f4('0x3e')]);_0x569a9b[_0x68f4('0x3f')]=qs[_0x68f4('0x36')](_['pick'](_0x218105[_0x68f4('0x35')],_0x41e2cd[_0x68f4('0x36')]));_0x569a9b[_0x68f4('0x6d')]=!![];if(_0x218105['query'][_0x68f4('0x43')]){_0x569a9b[_0x68f4('0x3f')]=_[_0x68f4('0x41')](_0x569a9b[_0x68f4('0x3f')],{'$or':_[_0x68f4('0x2f')](_0x569a9b['attributes'],function(_0x3a999a){var _0xfd31f6={};_0xfd31f6[_0x3a999a]={'$like':'%'+_0x218105[_0x68f4('0x35')]['filter']+'%'};return _0xfd31f6;})});}_0x569a9b=_[_0x68f4('0x41')]({},_0x569a9b,_0x218105[_0x68f4('0x44')]);return _0x3485bd['getContacts'](_0x569a9b);}})[_0x68f4('0x28')](respondWithResult(_0x57f732,null))[_0x68f4('0x47')](handleError(_0x57f732,null));};exports[_0x68f4('0x6e')]=function(_0xedb35e,_0x8dd2ca,_0x25f32d){var _0x5eb84e;return db[_0x68f4('0x30')]['find']({'where':{'id':_0xedb35e[_0x68f4('0x48')]['id']},'include':[{'model':db[_0x68f4('0x69')],'as':_0x68f4('0x6a')}]})[_0x68f4('0x28')](handleEntityNotFound(_0x8dd2ca,null))['then'](function(_0x2afe0a){if(_0x2afe0a){_0x5eb84e=_0x2afe0a;return db['CmContact'][_0x68f4('0x31')];}})['then'](function(_0x53fa3b){if(_0x53fa3b){var _0x573d22={};var _0x3e5a7b={};_0x3e5a7b[_0x68f4('0x38')]=_[_0x68f4('0x6b')](_[_0x68f4('0x56')](_0x53fa3b),_[_0x68f4('0x2f')](_0x5eb84e[_0x68f4('0x6a')],function(_0x42c1ce){return util['format'](_0x68f4('0x6f'),_0x42c1ce['id']);}));_0x3e5a7b[_0x68f4('0x35')]=_[_0x68f4('0x56')](_0xedb35e['query']);_0x3e5a7b['filters']=_[_0x68f4('0x37')](_0x3e5a7b[_0x68f4('0x38')],_0x3e5a7b['query']);_0x573d22[_0x68f4('0x39')]=_[_0x68f4('0x37')](_0x3e5a7b[_0x68f4('0x38')],qs[_0x68f4('0x3a')](_0xedb35e[_0x68f4('0x35')]['fields']));_0x573d22[_0x68f4('0x39')]=_0x573d22[_0x68f4('0x39')]['length']?_0x573d22[_0x68f4('0x39')]:_0x3e5a7b['model'];if(!_0xedb35e[_0x68f4('0x35')][_0x68f4('0x3b')](_0x68f4('0x3c'))){_0x573d22[_0x68f4('0x22')]=qs[_0x68f4('0x22')](_0xedb35e[_0x68f4('0x35')][_0x68f4('0x22')]);_0x573d22[_0x68f4('0x21')]=qs[_0x68f4('0x21')](_0xedb35e['query'][_0x68f4('0x21')]);}_0x573d22[_0x68f4('0x3d')]=qs[_0x68f4('0x3e')](_0xedb35e[_0x68f4('0x35')][_0x68f4('0x3e')]);_0x573d22[_0x68f4('0x3f')]=qs[_0x68f4('0x36')](_['pick'](_0xedb35e['query'],_0x3e5a7b['filters']));_0x573d22[_0x68f4('0x6d')]=!![];if(_0xedb35e[_0x68f4('0x35')]['filter']){_0x573d22[_0x68f4('0x3f')]=_[_0x68f4('0x41')](_0x573d22[_0x68f4('0x3f')],{'$or':_['map'](_0x573d22['attributes'],function(_0x49561f){var _0x571a5b={};_0x571a5b[_0x49561f]={'$like':'%'+_0xedb35e[_0x68f4('0x35')][_0x68f4('0x43')]+'%'};return _0x571a5b;})});}_0x573d22=_[_0x68f4('0x41')]({},_0x573d22,_0xedb35e[_0x68f4('0x44')]);return _0x5eb84e['getContacts'](_0x573d22);}})[_0x68f4('0x28')](function(_0x4f7bb9){if(!_['isEmpty'](_0x4f7bb9)){var _0x49a8e7=toCsv(_0x4f7bb9);var _0x530571=Date[_0x68f4('0x70')]();fs[_0x68f4('0x71')](util[_0x68f4('0x6c')]('/tmp/list_%d_%s.csv',_0x5eb84e['id'],_0x530571),_0x49a8e7);_0x8dd2ca[_0x68f4('0x72')](_0x68f4('0x73'),_0x68f4('0x74')+util['format'](_0x68f4('0x75'),_0x5eb84e['id'],_0x530571));_0x8dd2ca[_0x68f4('0x72')](_0x68f4('0x76'),_0x68f4('0x77'));return _0x8dd2ca['download'](util[_0x68f4('0x6c')](_0x68f4('0x78'),_0x5eb84e['id'],_0x530571));}else{return _0x8dd2ca[_0x68f4('0x1c')](0xcc);}})['catch'](handleError(_0x8dd2ca,null));};exports[_0x68f4('0x79')]=function(_0x45c2d5,_0x5bd5f6,_0x5b7fa6){var _0x14dee4;delete _0x45c2d5['body']['id'];return db[_0x68f4('0x30')][_0x68f4('0x7a')]({'where':{'id':_0x45c2d5['params']['id']}})['then'](handleEntityNotFound(_0x5bd5f6,null))[_0x68f4('0x28')](function(_0x15337d){if(_0x15337d){return db[_0x68f4('0x7b')][_0x68f4('0x7c')](function(_0x1a8c3d){return db[_0x68f4('0x69')][_0x68f4('0x49')](_0x45c2d5['body'],{'transaction':_0x1a8c3d})[_0x68f4('0x28')](function(_0x395b8d){_0x14dee4=_0x395b8d;return _0x15337d[_0x68f4('0x7d')](_0x395b8d,{'transaction':_0x1a8c3d});})[_0x68f4('0x28')](function(){var _0x184de8={'type':db[_0x68f4('0x7e')][_0x68f4('0x7f')],'transaction':_0x1a8c3d};switch(_0x45c2d5[_0x68f4('0x4a')][_0x68f4('0x33')]){case'text':_0x184de8[_0x68f4('0x33')]=db[_0x68f4('0x7e')][_0x68f4('0x7f')];break;case'number':_0x184de8[_0x68f4('0x33')]=db[_0x68f4('0x7e')][_0x68f4('0x80')];break;case _0x68f4('0x81'):_0x184de8[_0x68f4('0x33')]=db[_0x68f4('0x7e')]['BOOLEAN'];_0x184de8[_0x68f4('0x82')]=![];break;default:}return db[_0x68f4('0x7b')][_0x68f4('0x83')]['addColumn'](_0x68f4('0x84'),util[_0x68f4('0x6c')](_0x68f4('0x85'),_0x14dee4['id']),_0x184de8);})[_0x68f4('0x28')](function(){return _0x14dee4;});});}})[_0x68f4('0x28')](respondWithResult(_0x5bd5f6,null))[_0x68f4('0x47')](handleError(_0x5bd5f6,null));};exports[_0x68f4('0x86')]=function(_0x23de8d,_0x83785,_0x6cf402){var _0xbfead0={};var _0x53e6a4={};var _0x354db8;var _0x1173ae;return db[_0x68f4('0x30')][_0x68f4('0x7a')]({'where':{'id':_0x23de8d[_0x68f4('0x48')]['id']}})[_0x68f4('0x28')](handleEntityNotFound(_0x83785,null))[_0x68f4('0x28')](function(_0x1d227d){if(_0x1d227d){_0x354db8=_0x1d227d;_0x53e6a4[_0x68f4('0x38')]=_[_0x68f4('0x56')](db[_0x68f4('0x69')][_0x68f4('0x31')]);_0x53e6a4[_0x68f4('0x35')]=_[_0x68f4('0x56')](_0x23de8d['query']);_0x53e6a4[_0x68f4('0x36')]=_[_0x68f4('0x37')](_0x53e6a4[_0x68f4('0x38')],_0x53e6a4[_0x68f4('0x35')]);_0xbfead0['attributes']=_['intersection'](_0x53e6a4['model'],qs[_0x68f4('0x3a')](_0x23de8d[_0x68f4('0x35')][_0x68f4('0x3a')]));_0xbfead0['attributes']=_0xbfead0[_0x68f4('0x39')][_0x68f4('0x57')]?_0xbfead0[_0x68f4('0x39')]:_0x53e6a4['model'];_0xbfead0['order']=qs[_0x68f4('0x3e')](_0x23de8d[_0x68f4('0x35')]['sort']);_0xbfead0['where']=qs[_0x68f4('0x36')](_[_0x68f4('0x40')](_0x23de8d['query'],_0x53e6a4['filters']));_0xbfead0[_0x68f4('0x3f')]=_[_0x68f4('0x41')](_0xbfead0['where'],{'$or':[{'ListId':_0x1d227d['id']},{'ListId':null}]});if(_0x23de8d[_0x68f4('0x35')][_0x68f4('0x43')]){_0xbfead0[_0x68f4('0x3f')]=_[_0x68f4('0x41')](_0xbfead0[_0x68f4('0x3f')],{'$or':_['map'](_0xbfead0[_0x68f4('0x39')],function(_0x36e36c){var _0x417987={};_0x417987[_0x36e36c]={'$like':'%'+_0x23de8d[_0x68f4('0x35')][_0x68f4('0x43')]+'%'};return _0x417987;})});}_0xbfead0=_[_0x68f4('0x41')]({},_0xbfead0,_0x23de8d[_0x68f4('0x44')]);return db[_0x68f4('0x69')][_0x68f4('0x87')](_0xbfead0);}})[_0x68f4('0x28')](respondWithResult(_0x83785,null))[_0x68f4('0x47')](handleError(_0x83785,null));};exports['addAgents']=function(_0x3e6469,_0x38b5d0,_0x1c9d2b){return db[_0x68f4('0x30')][_0x68f4('0x51')]({'where':{'id':_0x3e6469[_0x68f4('0x48')]['id']}})[_0x68f4('0x28')](handleEntityNotFound(_0x38b5d0,null))[_0x68f4('0x28')](function(_0x3d3561){if(_0x3d3561){return _0x3d3561[_0x68f4('0x88')](_0x3e6469[_0x68f4('0x4a')][_0x68f4('0x63')],_[_0x68f4('0x62')](_0x3e6469[_0x68f4('0x4a')],['ids','id'])||{})[_0x68f4('0x89')](function(_0x343eac){for(var _0x1c4d81=0x0;_0x1c4d81<_0x3e6469['body'][_0x68f4('0x63')][_0x68f4('0x57')];_0x1c4d81+=0x1){socket[_0x68f4('0x8a')](_0x68f4('0x8b'),{'UserId':_0x3e6469[_0x68f4('0x4a')][_0x68f4('0x63')][_0x1c4d81],'CmListId':_0x3e6469[_0x68f4('0x48')]['id']});}return _0x343eac;});}})[_0x68f4('0x28')](respondWithResult(_0x38b5d0,null))['catch'](handleError(_0x38b5d0,null));};exports['removeAgents']=function(_0x5dedf7,_0x6cbb36,_0x13f6a4){return db['CmList']['find']({'where':{'id':_0x5dedf7[_0x68f4('0x48')]['id']}})[_0x68f4('0x28')](handleEntityNotFound(_0x6cbb36,null))['then'](function(_0x1c4f4a){if(_0x1c4f4a){return _0x1c4f4a[_0x68f4('0x8c')](_0x5dedf7[_0x68f4('0x35')][_0x68f4('0x63')])[_0x68f4('0x28')](function(){if(_[_0x68f4('0x5d')](_0x5dedf7[_0x68f4('0x35')]['ids'])){for(var _0x3823d1=0x0;_0x3823d1<_0x5dedf7[_0x68f4('0x35')]['ids'][_0x68f4('0x57')];_0x3823d1+=0x1){socket[_0x68f4('0x8a')](_0x68f4('0x8d'),{'UserId':Number(_0x5dedf7['query'][_0x68f4('0x63')][_0x3823d1]),'CmListId':Number(_0x5dedf7[_0x68f4('0x48')]['id'])});}}else{socket['emit'](_0x68f4('0x8d'),{'UserId':Number(_0x5dedf7[_0x68f4('0x35')][_0x68f4('0x63')]),'CmListId':Number(_0x5dedf7[_0x68f4('0x48')]['id'])});}});}})[_0x68f4('0x28')](respondWithStatusCode(_0x6cbb36,null))[_0x68f4('0x47')](handleError(_0x6cbb36,null));};exports[_0x68f4('0x8e')]=function(_0xe5b2c2,_0x45f6c4,_0x3e24a4){var _0x3e9468={};var _0x4a05a2={};var _0x1770f0;var _0xf59546;return db[_0x68f4('0x30')]['findOne']({'where':{'id':_0xe5b2c2[_0x68f4('0x48')]['id']}})[_0x68f4('0x28')](handleEntityNotFound(_0x45f6c4,null))[_0x68f4('0x28')](function(_0x36ccae){if(_0x36ccae){_0x1770f0=_0x36ccae;_0x4a05a2[_0x68f4('0x38')]=_[_0x68f4('0x56')](db[_0x68f4('0x8f')][_0x68f4('0x31')]);_0x4a05a2[_0x68f4('0x35')]=_[_0x68f4('0x56')](_0xe5b2c2[_0x68f4('0x35')]);_0x4a05a2['filters']=_['intersection'](_0x4a05a2[_0x68f4('0x38')],_0x4a05a2[_0x68f4('0x35')]);_0x3e9468['attributes']=_[_0x68f4('0x37')](_0x4a05a2[_0x68f4('0x38')],qs[_0x68f4('0x3a')](_0xe5b2c2['query']['fields']));_0x3e9468[_0x68f4('0x39')]=_0x3e9468[_0x68f4('0x39')][_0x68f4('0x57')]?_0x3e9468[_0x68f4('0x39')]:_0x4a05a2[_0x68f4('0x38')];_0x3e9468[_0x68f4('0x3d')]=qs[_0x68f4('0x3e')](_0xe5b2c2[_0x68f4('0x35')]['sort']);_0x3e9468['where']=qs[_0x68f4('0x36')](_[_0x68f4('0x40')](_0xe5b2c2['query'],_0x4a05a2['filters']));if(_0xe5b2c2[_0x68f4('0x35')]['filter']){_0x3e9468[_0x68f4('0x3f')]=_[_0x68f4('0x41')](_0x3e9468[_0x68f4('0x3f')],{'$or':_[_0x68f4('0x2f')](_0x3e9468[_0x68f4('0x39')],function(_0x22f833){var _0x317476={};_0x317476[_0x22f833]={'$like':'%'+_0xe5b2c2[_0x68f4('0x35')][_0x68f4('0x43')]+'%'};return _0x317476;})});}_0x3e9468=_[_0x68f4('0x41')]({},_0x3e9468,_0xe5b2c2[_0x68f4('0x44')]);return _0x1770f0[_0x68f4('0x8e')](_0x3e9468);}})['then'](function(_0x3f4e93){if(_0x3f4e93){_0xf59546=_0x3f4e93[_0x68f4('0x57')];if(!_0xe5b2c2[_0x68f4('0x35')]['hasOwnProperty'](_0x68f4('0x3c'))){_0x3e9468[_0x68f4('0x22')]=qs['limit'](_0xe5b2c2[_0x68f4('0x35')]['limit']);_0x3e9468[_0x68f4('0x21')]=qs[_0x68f4('0x21')](_0xe5b2c2[_0x68f4('0x35')][_0x68f4('0x21')]);}return _0x1770f0[_0x68f4('0x8e')](_0x3e9468);}})[_0x68f4('0x28')](function(_0x3c14a1){if(_0x3c14a1){return _0x3c14a1?{'count':_0xf59546,'rows':_0x3c14a1}:null;}})[_0x68f4('0x28')](respondWithResult(_0x45f6c4,null))[_0x68f4('0x47')](handleError(_0x45f6c4,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 895ece9..95de1eb 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 _0xa578=['exports','../../mysqldb','CmList','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x46af65,_0x3f0001){var _0x553b4e=function(_0x313e14){while(--_0x313e14){_0x46af65['push'](_0x46af65['shift']());}};_0x553b4e(++_0x3f0001);}(_0xa578,0xe1));var _0x8a57=function(_0x4a17d8,_0xd43f37){_0x4a17d8=_0x4a17d8-0x0;var _0x13a7df=_0xa578[_0x4a17d8];return _0x13a7df;};'use strict';var EventEmitter=require('events');var CmList=require(_0x8a57('0x0'))['db'][_0x8a57('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x8a57('0x2')](0x0);var events={'afterCreate':_0x8a57('0x3'),'afterUpdate':'update','afterDestroy':_0x8a57('0x4')};function emitEvent(_0x3ac6cf){return function(_0x3c7802,_0x3a6c38,_0x1ca9aa){CmListEvents[_0x8a57('0x5')](_0x3ac6cf+':'+_0x3c7802['id'],_0x3c7802);CmListEvents[_0x8a57('0x5')](_0x3ac6cf,_0x3c7802);_0x1ca9aa(null);};}for(var e in events){if(events[_0x8a57('0x6')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x8a57('0x7')]=CmListEvents; \ No newline at end of file +var _0xb98e=['emit','hasOwnProperty','hook','exports','../../mysqldb','CmList','setMaxListeners'];(function(_0x1e919e,_0x392e9f){var _0x130e56=function(_0x4756a7){while(--_0x4756a7){_0x1e919e['push'](_0x1e919e['shift']());}};_0x130e56(++_0x392e9f);}(_0xb98e,0x90));var _0xeb98=function(_0x5fadc3,_0x32b6be){_0x5fadc3=_0x5fadc3-0x0;var _0x19be99=_0xb98e[_0x5fadc3];return _0x19be99;};'use strict';var EventEmitter=require('events');var CmList=require(_0xeb98('0x0'))['db'][_0xeb98('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0xeb98('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2df642){return function(_0x4a7cff,_0x2545e1,_0x3b97d6){CmListEvents[_0xeb98('0x3')](_0x2df642+':'+_0x4a7cff['id'],_0x4a7cff);CmListEvents['emit'](_0x2df642,_0x4a7cff);_0x3b97d6(null);};}for(var e in events){if(events[_0xeb98('0x4')](e)){var event=events[e];CmList[_0xeb98('0x5')](e,emitEvent(event));}}module[_0xeb98('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 5620ad5..e24c9f6 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 _0xa1bb=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x25ae6c,_0x16af0e){var _0x42f510=function(_0x1a84b8){while(--_0x1a84b8){_0x25ae6c['push'](_0x25ae6c['shift']());}};_0x42f510(++_0x16af0e);}(_0xa1bb,0x162));var _0xba1b=function(_0x4b1c9c,_0x5f3098){_0x4b1c9c=_0x4b1c9c-0x0;var _0x865a10=_0xa1bb[_0x4b1c9c];return _0x865a10;};'use strict';var _=require(_0xba1b('0x0'));var util=require(_0xba1b('0x1'));var logger=require(_0xba1b('0x2'))(_0xba1b('0x3'));var moment=require(_0xba1b('0x4'));var BPromise=require('bluebird');var rp=require(_0xba1b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba1b('0x6'));var config=require(_0xba1b('0x7'));var attributes=require(_0xba1b('0x8'));module[_0xba1b('0x9')]=function(_0x595111,_0x2e31a1){return _0x595111[_0xba1b('0xa')](_0xba1b('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4a3=['exports','define','cm_lists','util','api','bluebird','rimraf','./cmList.attributes'];(function(_0x17db44,_0x5431cf){var _0x2ad94d=function(_0x50b26e){while(--_0x50b26e){_0x17db44['push'](_0x17db44['shift']());}};_0x2ad94d(++_0x5431cf);}(_0xc4a3,0x193));var _0x3c4a=function(_0xe7400f,_0x573b7d){_0xe7400f=_0xe7400f-0x0;var _0x2990f7=_0xc4a3[_0xe7400f];return _0x2990f7;};'use strict';var _=require('lodash');var util=require(_0x3c4a('0x0'));var logger=require('../../config/logger')(_0x3c4a('0x1'));var moment=require('moment');var BPromise=require(_0x3c4a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3c4a('0x3'));var config=require('../../config/environment');var attributes=require(_0x3c4a('0x4'));module[_0x3c4a('0x5')]=function(_0xf2c24a,_0x562434){return _0xf2c24a[_0x3c4a('0x6')]('CmList',attributes,{'tableName':_0x3c4a('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 a5953c9..4ced181 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 _0x8b66=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch'];(function(_0x4e86f7,_0x1650a1){var _0x3886d8=function(_0x5dae93){while(--_0x5dae93){_0x4e86f7['push'](_0x4e86f7['shift']());}};_0x3886d8(++_0x1650a1);}(_0x8b66,0x91));var _0x68b6=function(_0x385669,_0x43d386){_0x385669=_0x385669-0x0;var _0x11e2d2=_0x8b66[_0x385669];return _0x11e2d2;};'use strict';var _=require(_0x68b6('0x0'));var util=require(_0x68b6('0x1'));var moment=require(_0x68b6('0x2'));var BPromise=require(_0x68b6('0x3'));var rs=require(_0x68b6('0x4'));var fs=require('fs');var Redis=require(_0x68b6('0x5'));var db=require(_0x68b6('0x6'))['db'];var utils=require(_0x68b6('0x7'));var logger=require(_0x68b6('0x8'))(_0x68b6('0x9'));var config=require('../../config/environment');var jayson=require(_0x68b6('0xa'));var client=jayson[_0x68b6('0xb')][_0x68b6('0xc')]({'port':0x232a});config['redis']=_[_0x68b6('0xd')](config[_0x68b6('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x68b6('0xf'))(new Redis(config[_0x68b6('0xe')]));require('./cmList.socket')[_0x68b6('0x10')](socket);function respondWithRpcPromise(_0x141e17,_0x20764c,_0x3fac95){return new BPromise(function(_0x4fc595,_0x294775){return client[_0x68b6('0x11')](_0x141e17,_0x3fac95)[_0x68b6('0x12')](function(_0x5920a1){logger[_0x68b6('0x13')](_0x68b6('0x14'),_0x20764c,'request\x20sent');logger[_0x68b6('0x15')](_0x68b6('0x16'),_0x20764c,'request\x20sent',JSON[_0x68b6('0x17')](_0x5920a1));if(_0x5920a1[_0x68b6('0x18')]){if(_0x5920a1[_0x68b6('0x18')][_0x68b6('0x19')]===0x1f4){logger['error'](_0x68b6('0x14'),_0x20764c,_0x5920a1['error']['message']);return _0x294775(_0x5920a1['error']['message']);}logger['error'](_0x68b6('0x14'),_0x20764c,_0x5920a1['error']['message']);return _0x4fc595(_0x5920a1['error'][_0x68b6('0x1a')]);}else{logger['info'](_0x68b6('0x14'),_0x20764c,_0x68b6('0x1b'));_0x4fc595(_0x5920a1['result']['message']);}})[_0x68b6('0x1c')](function(_0xccb5be){logger[_0x68b6('0x18')]('CmList,\x20%s,\x20%s',_0x20764c,_0xccb5be);_0x294775(_0xccb5be);});});} \ No newline at end of file +var _0x7ced=['../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','debug','request\x20sent','error','code','CmList,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/utils'];(function(_0x450f78,_0x3be22d){var _0x340f73=function(_0x2bb450){while(--_0x2bb450){_0x450f78['push'](_0x450f78['shift']());}};_0x340f73(++_0x3be22d);}(_0x7ced,0x91));var _0xd7ce=function(_0x261a4a,_0x389a4f){_0x261a4a=_0x261a4a-0x0;var _0xc8d5b4=_0x7ced[_0x261a4a];return _0xc8d5b4;};'use strict';var _=require(_0xd7ce('0x0'));var util=require(_0xd7ce('0x1'));var moment=require(_0xd7ce('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7ce('0x3'))['db'];var utils=require(_0xd7ce('0x4'));var logger=require(_0xd7ce('0x5'))('rpc');var config=require(_0xd7ce('0x6'));var jayson=require(_0xd7ce('0x7'));var client=jayson['client'][_0xd7ce('0x8')]({'port':0x232a});config[_0xd7ce('0x9')]=_[_0xd7ce('0xa')](config[_0xd7ce('0x9')],{'host':_0xd7ce('0xb'),'port':0x18eb});var socket=require(_0xd7ce('0xc'))(new Redis(config[_0xd7ce('0x9')]));require(_0xd7ce('0xd'))[_0xd7ce('0xe')](socket);function respondWithRpcPromise(_0x59100f,_0x217ea5,_0x2a1304){return new BPromise(function(_0x66793a,_0x5e5bdb){return client[_0xd7ce('0xf')](_0x59100f,_0x2a1304)['then'](function(_0x1cca0e){logger['info']('CmList,\x20%s,\x20%s',_0x217ea5,'request\x20sent');logger[_0xd7ce('0x10')]('CmList,\x20%s,\x20%s,\x20%s',_0x217ea5,_0xd7ce('0x11'),JSON['stringify'](_0x1cca0e));if(_0x1cca0e[_0xd7ce('0x12')]){if(_0x1cca0e['error'][_0xd7ce('0x13')]===0x1f4){logger['error'](_0xd7ce('0x14'),_0x217ea5,_0x1cca0e['error']['message']);return _0x5e5bdb(_0x1cca0e[_0xd7ce('0x12')]['message']);}logger['error'](_0xd7ce('0x14'),_0x217ea5,_0x1cca0e['error'][_0xd7ce('0x15')]);return _0x66793a(_0x1cca0e[_0xd7ce('0x12')][_0xd7ce('0x15')]);}else{logger[_0xd7ce('0x16')](_0xd7ce('0x14'),_0x217ea5,_0xd7ce('0x11'));_0x66793a(_0x1cca0e[_0xd7ce('0x17')][_0xd7ce('0x15')]);}})[_0xd7ce('0x18')](function(_0x56abcd){logger['error'](_0xd7ce('0x14'),_0x217ea5,_0x56abcd);_0x5e5bdb(_0x56abcd);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index f424a81..24b615f 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 _0xf072=['save','remove','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x3aae07,_0x36cecf){var _0x530551=function(_0x39169f){while(--_0x39169f){_0x3aae07['push'](_0x3aae07['shift']());}};_0x530551(++_0x36cecf);}(_0xf072,0x1cf));var _0x2f07=function(_0x5cdb8d,_0xad2c83){_0x5cdb8d=_0x5cdb8d-0x0;var _0x596af4=_0xf072[_0x5cdb8d];return _0x596af4;};'use strict';var CmListEvents=require(_0x2f07('0x0'));var events=[_0x2f07('0x1'),_0x2f07('0x2'),'update'];function createListener(_0x3c1c25,_0x5f20e3){return function(_0x19cbb9){_0x5f20e3[_0x2f07('0x3')](_0x3c1c25,_0x19cbb9);};}function removeListener(_0x1536c3,_0x48d7b6){return function(){CmListEvents[_0x2f07('0x4')](_0x1536c3,_0x48d7b6);};}exports[_0x2f07('0x5')]=function(_0x3643bb){for(var _0x2e6422=0x0,_0x235418=events[_0x2f07('0x6')];_0x2e6422<_0x235418;_0x2e6422++){var _0x33b99c=events[_0x2e6422];var _0x379b2e=createListener(_0x2f07('0x7')+_0x33b99c,_0x3643bb);CmListEvents['on'](_0x33b99c,_0x379b2e);}}; \ No newline at end of file +var _0x7c1f=['save','remove','update','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x92de2b,_0xebb9ef){var _0x36a515=function(_0x4865ed){while(--_0x4865ed){_0x92de2b['push'](_0x92de2b['shift']());}};_0x36a515(++_0xebb9ef);}(_0x7c1f,0x194));var _0xf7c1=function(_0x35d41c,_0x41c600){_0x35d41c=_0x35d41c-0x0;var _0x1eb478=_0x7c1f[_0x35d41c];return _0x1eb478;};'use strict';var CmListEvents=require(_0xf7c1('0x0'));var events=[_0xf7c1('0x1'),_0xf7c1('0x2'),_0xf7c1('0x3')];function createListener(_0x3ca7b6,_0x568116){return function(_0x1e3254){_0x568116[_0xf7c1('0x4')](_0x3ca7b6,_0x1e3254);};}function removeListener(_0x18f5a9,_0x485d8d){return function(){CmListEvents[_0xf7c1('0x5')](_0x18f5a9,_0x485d8d);};}exports[_0xf7c1('0x6')]=function(_0x3c21cf){for(var _0x136e1e=0x0,_0x5423bf=events[_0xf7c1('0x7')];_0x136e1e<_0x5423bf;_0x136e1e++){var _0x1a342b=events[_0x136e1e];var _0x329050=createListener(_0xf7c1('0x8')+_0x1a342b,_0x3c21cf);CmListEvents['on'](_0x1a342b,_0x329050);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index b15912d..f0cab1d 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 _0x91b3=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','getDispositions','/:id/contacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','update','delete','destroy','removeDispositions','removeAgents'];(function(_0x588f1e,_0x239528){var _0x2bcf27=function(_0x505371){while(--_0x505371){_0x588f1e['push'](_0x588f1e['shift']());}};_0x2bcf27(++_0x239528);}(_0x91b3,0x1e1));var _0x391b=function(_0x54a003,_0x182386){_0x54a003=_0x54a003-0x0;var _0x481012=_0x91b3[_0x54a003];return _0x481012;};'use strict';var multer=require(_0x391b('0x0'));var util=require(_0x391b('0x1'));var path=require('path');var timeout=require(_0x391b('0x2'));var express=require(_0x391b('0x3'));var router=express[_0x391b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x391b('0x5'));var interaction=require(_0x391b('0x6'));var config=require('../../config/environment');var controller=require(_0x391b('0x7'));router[_0x391b('0x8')]('/',auth[_0x391b('0x9')](),controller[_0x391b('0xa')]);router[_0x391b('0x8')](_0x391b('0xb'),auth[_0x391b('0x9')](),controller[_0x391b('0xc')]);router[_0x391b('0x8')](_0x391b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x391b('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x391b('0xe')]);router[_0x391b('0x8')](_0x391b('0xf'),auth['isAuthenticated'](),controller['getContacts']);router[_0x391b('0x8')](_0x391b('0x10'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x391b('0x8')](_0x391b('0x11'),auth[_0x391b('0x9')](),controller[_0x391b('0x12')]);router[_0x391b('0x8')](_0x391b('0x13'),auth[_0x391b('0x9')](),controller['getAgents']);router[_0x391b('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x391b('0x14')](_0x391b('0x15'),auth[_0x391b('0x9')](),controller[_0x391b('0x16')]);router[_0x391b('0x14')](_0x391b('0xf'),auth['isAuthenticated'](),controller[_0x391b('0x17')]);router[_0x391b('0x14')](_0x391b('0x11'),auth[_0x391b('0x9')](),controller[_0x391b('0x18')]);router[_0x391b('0x14')](_0x391b('0x13'),auth[_0x391b('0x9')](),controller[_0x391b('0x19')]);router['put'](_0x391b('0xd'),auth[_0x391b('0x9')](),controller[_0x391b('0x1a')]);router[_0x391b('0x1b')](_0x391b('0xd'),auth[_0x391b('0x9')](),controller[_0x391b('0x1c')]);router[_0x391b('0x1b')](_0x391b('0x15'),auth[_0x391b('0x9')](),controller[_0x391b('0x1d')]);router[_0x391b('0x1b')](_0x391b('0x13'),auth[_0x391b('0x9')](),controller[_0x391b('0x1e')]);module[_0x391b('0x1f')]=router; \ No newline at end of file +var _0x1f73=['express','Router','fs-extra','../../components/auth/service','./cmList.controller','get','/describe','isAuthenticated','describe','/:id','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer','path','connect-timeout'];(function(_0x4547c0,_0x584cb4){var _0x15a1a2=function(_0x35e7e5){while(--_0x35e7e5){_0x4547c0['push'](_0x4547c0['shift']());}};_0x15a1a2(++_0x584cb4);}(_0x1f73,0x89));var _0x31f7=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1f73[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x31f7('0x0'));var util=require('util');var path=require(_0x31f7('0x1'));var timeout=require(_0x31f7('0x2'));var express=require(_0x31f7('0x3'));var router=express[_0x31f7('0x4')]();var fs_extra=require(_0x31f7('0x5'));var auth=require(_0x31f7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x31f7('0x7'));router[_0x31f7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x31f7('0x8')](_0x31f7('0x9'),auth[_0x31f7('0xa')](),controller[_0x31f7('0xb')]);router[_0x31f7('0x8')](_0x31f7('0xc'),auth[_0x31f7('0xa')](),controller['show']);router[_0x31f7('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x31f7('0xd')]);router['get'](_0x31f7('0xe'),auth[_0x31f7('0xa')](),controller[_0x31f7('0xf')]);router[_0x31f7('0x8')](_0x31f7('0x10'),auth['isAuthenticated'](),controller[_0x31f7('0x11')]);router[_0x31f7('0x8')](_0x31f7('0x12'),auth[_0x31f7('0xa')](),controller[_0x31f7('0x13')]);router[_0x31f7('0x8')](_0x31f7('0x14'),auth[_0x31f7('0xa')](),controller[_0x31f7('0x15')]);router[_0x31f7('0x16')]('/',auth['isAuthenticated'](),controller[_0x31f7('0x17')]);router['post'](_0x31f7('0x18'),auth[_0x31f7('0xa')](),controller[_0x31f7('0x19')]);router[_0x31f7('0x16')](_0x31f7('0xe'),auth[_0x31f7('0xa')](),controller[_0x31f7('0x1a')]);router[_0x31f7('0x16')]('/:id/fields',auth[_0x31f7('0xa')](),controller[_0x31f7('0x1b')]);router[_0x31f7('0x16')](_0x31f7('0x14'),auth['isAuthenticated'](),controller[_0x31f7('0x1c')]);router[_0x31f7('0x1d')](_0x31f7('0xc'),auth[_0x31f7('0xa')](),controller[_0x31f7('0x1e')]);router[_0x31f7('0x1f')]('/:id',auth[_0x31f7('0xa')](),controller[_0x31f7('0x20')]);router[_0x31f7('0x1f')](_0x31f7('0x18'),auth[_0x31f7('0xa')](),controller[_0x31f7('0x21')]);router[_0x31f7('0x1f')](_0x31f7('0x14'),auth[_0x31f7('0xa')](),controller[_0x31f7('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index be4756d..da9a819 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 _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x342f88,_0x31a678){var _0xfa8bb3=function(_0x549303){while(--_0x549303){_0x342f88['push'](_0x342f88['shift']());}};_0xfa8bb3(++_0x31a678);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x45459d,_0x54505c){var _0x15b999=function(_0x1e2604){while(--_0x1e2604){_0x45459d['push'](_0x45459d['shift']());}};_0x15b999(++_0x54505c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 946fcbd..84b814e 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 _0x2ce0=['catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','Content-Range','apply','save','update','then','destroy','end','stack','name','send','body','Condition','find','params'];(function(_0x10eb6b,_0x3fe155){var _0x3a3ab1=function(_0x467f24){while(--_0x467f24){_0x10eb6b['push'](_0x10eb6b['shift']());}};_0x3a3ab1(++_0x3fe155);}(_0x2ce0,0x82));var _0x02ce=function(_0x450c60,_0x3888b0){_0x450c60=_0x450c60-0x0;var _0xf8a601=_0x2ce0[_0x450c60];return _0xf8a601;};'use strict';var pdf=require(_0x02ce('0x0'));var emlformat=require(_0x02ce('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x02ce('0x2'));var jsonpatch=require(_0x02ce('0x3'));var rp=require(_0x02ce('0x4'));var moment=require(_0x02ce('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x02ce('0x6'));var util=require(_0x02ce('0x7'));var path=require(_0x02ce('0x8'));var sox=require(_0x02ce('0x9'));var csv=require(_0x02ce('0xa'));var ejs=require(_0x02ce('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x02ce('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x02ce('0xd'));var deskjs=require(_0x02ce('0xe'));var toCsv=require('to-csv');var querystring=require(_0x02ce('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x02ce('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x02ce('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x02ce('0x12'))(_0x02ce('0x13'));var utils=require(_0x02ce('0x14'));var config=require(_0x02ce('0x15'));var licenseUtil=require(_0x02ce('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f609d,_0x1607c8){_0x1607c8=_0x1607c8||0xcc;return function(_0x1095d9){if(_0x1095d9){return _0x1f609d[_0x02ce('0x17')](_0x1607c8);}return _0x1f609d[_0x02ce('0x18')](_0x1607c8)['end']();};}function respondWithResult(_0x6a5390,_0x18bc55){_0x18bc55=_0x18bc55||0xc8;return function(_0x48244f){if(_0x48244f){return _0x6a5390[_0x02ce('0x18')](_0x18bc55)[_0x02ce('0x19')](_0x48244f);}};}function respondWithFilteredResult(_0x4008c0,_0x411b59){return function(_0x198f25){if(_0x198f25){var _0x7939e7=_0x198f25[_0x02ce('0x1a')],_0x36c132=_0x411b59[_0x02ce('0x1b')],_0x302c54=_0x411b59[_0x02ce('0x1b')]+_0x411b59['limit'],_0x52d074;if(_0x302c54>=_0x7939e7){_0x302c54=_0x7939e7;_0x52d074=0xc8;}else{_0x52d074=0xce;}_0x4008c0['status'](_0x52d074);return _0x4008c0['set'](_0x02ce('0x1c'),_0x36c132+'-'+_0x302c54+'/'+_0x7939e7)[_0x02ce('0x19')](_0x198f25);}return null;};}function patchUpdates(_0x4a0e1c){return function(_0x55f9b0){try{jsonpatch[_0x02ce('0x1d')](_0x55f9b0,_0x4a0e1c,!![]);}catch(_0x544f1f){return BPromise['reject'](_0x544f1f);}return _0x55f9b0[_0x02ce('0x1e')]();};}function saveUpdates(_0x3df87e,_0x155835){return function(_0x2e59ec){if(_0x2e59ec){return _0x2e59ec[_0x02ce('0x1f')](_0x3df87e)[_0x02ce('0x20')](function(_0x20cb09){return _0x20cb09;});}return null;};}function removeEntity(_0x4933b7,_0x2ac14a){return function(_0x22d937){if(_0x22d937){return _0x22d937[_0x02ce('0x21')]()['then'](function(){_0x4933b7[_0x02ce('0x18')](0xcc)[_0x02ce('0x22')]();});}};}function handleEntityNotFound(_0x1fb4c9,_0x16a178){return function(_0x58d1b5){if(!_0x58d1b5){_0x1fb4c9['sendStatus'](0x194);}return _0x58d1b5;};}function handleError(_0x55535c,_0x120fb7){_0x120fb7=_0x120fb7||0x1f4;return function(_0x3f266f){logger['error'](_0x3f266f[_0x02ce('0x23')]);if(_0x3f266f[_0x02ce('0x24')]){delete _0x3f266f[_0x02ce('0x24')];}_0x55535c['status'](_0x120fb7)[_0x02ce('0x25')](_0x3f266f);};}exports[_0x02ce('0x1f')]=function(_0x39f1b1,_0x4ef67b){if(_0x39f1b1[_0x02ce('0x26')]['id']){delete _0x39f1b1[_0x02ce('0x26')]['id'];}return db[_0x02ce('0x27')][_0x02ce('0x28')]({'where':{'id':_0x39f1b1[_0x02ce('0x29')]['id']}})[_0x02ce('0x20')](handleEntityNotFound(_0x4ef67b,null))[_0x02ce('0x20')](saveUpdates(_0x39f1b1[_0x02ce('0x26')],null))['then'](respondWithResult(_0x4ef67b,null))[_0x02ce('0x2a')](handleError(_0x4ef67b,null));};exports[_0x02ce('0x21')]=function(_0x2831ca,_0x28cfe9){return db[_0x02ce('0x27')][_0x02ce('0x28')]({'where':{'id':_0x2831ca[_0x02ce('0x29')]['id']}})[_0x02ce('0x20')](handleEntityNotFound(_0x28cfe9,null))['then'](removeEntity(_0x28cfe9,null))[_0x02ce('0x2a')](handleError(_0x28cfe9,null));}; \ No newline at end of file +var _0x5041=['status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','body','find','catch','destroy','Condition','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x5041,0x1ce));var _0x1504=function(_0x2b8f25,_0x494682){_0x2b8f25=_0x2b8f25-0x0;var _0xdb4d96=_0x5041[_0x2b8f25];return _0xdb4d96;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1504('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1504('0x1'));var jsonpatch=require(_0x1504('0x2'));var rp=require('request-promise');var moment=require(_0x1504('0x3'));var BPromise=require(_0x1504('0x4'));var Mustache=require(_0x1504('0x5'));var util=require(_0x1504('0x6'));var path=require(_0x1504('0x7'));var sox=require(_0x1504('0x8'));var csv=require(_0x1504('0x9'));var ejs=require(_0x1504('0xa'));var fs=require('fs');var fs_extra=require(_0x1504('0xb'));var _=require(_0x1504('0xc'));var squel=require('squel');var crypto=require(_0x1504('0xd'));var jsforce=require(_0x1504('0xe'));var deskjs=require(_0x1504('0xf'));var toCsv=require(_0x1504('0x9'));var querystring=require('querystring');var Papa=require(_0x1504('0x10'));var Redis=require(_0x1504('0x11'));var authService=require(_0x1504('0x12'));var qs=require(_0x1504('0x13'));var as=require(_0x1504('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1504('0x15'))(_0x1504('0x16'));var utils=require(_0x1504('0x17'));var config=require(_0x1504('0x18'));var licenseUtil=require(_0x1504('0x19'));var db=require(_0x1504('0x1a'))['db'];function respondWithStatusCode(_0x318788,_0x1d7afa){_0x1d7afa=_0x1d7afa||0xcc;return function(_0x20aebf){if(_0x20aebf){return _0x318788[_0x1504('0x1b')](_0x1d7afa);}return _0x318788[_0x1504('0x1c')](_0x1d7afa)[_0x1504('0x1d')]();};}function respondWithResult(_0x485ca5,_0x1f6198){_0x1f6198=_0x1f6198||0xc8;return function(_0x54ffdd){if(_0x54ffdd){return _0x485ca5['status'](_0x1f6198)[_0x1504('0x1e')](_0x54ffdd);}};}function respondWithFilteredResult(_0x6bb3f9,_0x65e992){return function(_0x228cfc){if(_0x228cfc){var _0x4b4b15=_0x228cfc[_0x1504('0x1f')],_0x97dca3=_0x65e992[_0x1504('0x20')],_0xc33cd3=_0x65e992[_0x1504('0x20')]+_0x65e992[_0x1504('0x21')],_0x3718c5;if(_0xc33cd3>=_0x4b4b15){_0xc33cd3=_0x4b4b15;_0x3718c5=0xc8;}else{_0x3718c5=0xce;}_0x6bb3f9['status'](_0x3718c5);return _0x6bb3f9[_0x1504('0x22')](_0x1504('0x23'),_0x97dca3+'-'+_0xc33cd3+'/'+_0x4b4b15)[_0x1504('0x1e')](_0x228cfc);}return null;};}function patchUpdates(_0x5a89fc){return function(_0x28172a){try{jsonpatch[_0x1504('0x24')](_0x28172a,_0x5a89fc,!![]);}catch(_0xb526a0){return BPromise[_0x1504('0x25')](_0xb526a0);}return _0x28172a[_0x1504('0x26')]();};}function saveUpdates(_0x4ee846,_0x6519ff){return function(_0x3eef7a){if(_0x3eef7a){return _0x3eef7a[_0x1504('0x27')](_0x4ee846)['then'](function(_0x38357e){return _0x38357e;});}return null;};}function removeEntity(_0x1a65ee,_0x41f133){return function(_0x5b6a66){if(_0x5b6a66){return _0x5b6a66['destroy']()[_0x1504('0x28')](function(){_0x1a65ee[_0x1504('0x1c')](0xcc)[_0x1504('0x1d')]();});}};}function handleEntityNotFound(_0x5c22d8,_0x3c351a){return function(_0x2e73e7){if(!_0x2e73e7){_0x5c22d8[_0x1504('0x1b')](0x194);}return _0x2e73e7;};}function handleError(_0x5c14a6,_0x53db9e){_0x53db9e=_0x53db9e||0x1f4;return function(_0x473b00){logger['error'](_0x473b00[_0x1504('0x29')]);if(_0x473b00[_0x1504('0x2a')]){delete _0x473b00['name'];}_0x5c14a6[_0x1504('0x1c')](_0x53db9e)[_0x1504('0x2b')](_0x473b00);};}exports[_0x1504('0x27')]=function(_0x449e0b,_0x18c0bd){if(_0x449e0b[_0x1504('0x2c')]['id']){delete _0x449e0b[_0x1504('0x2c')]['id'];}return db['Condition'][_0x1504('0x2d')]({'where':{'id':_0x449e0b['params']['id']}})['then'](handleEntityNotFound(_0x18c0bd,null))[_0x1504('0x28')](saveUpdates(_0x449e0b[_0x1504('0x2c')],null))[_0x1504('0x28')](respondWithResult(_0x18c0bd,null))[_0x1504('0x2e')](handleError(_0x18c0bd,null));};exports[_0x1504('0x2f')]=function(_0x5b2950,_0x1142c2){return db[_0x1504('0x30')][_0x1504('0x2d')]({'where':{'id':_0x5b2950['params']['id']}})[_0x1504('0x28')](handleEntityNotFound(_0x1142c2,null))['then'](removeEntity(_0x1142c2,null))[_0x1504('0x2e')](handleError(_0x1142c2,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index d06406a..281a62a 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 _0xf881=['moment','bluebird','../../config/environment','exports','define','Condition','util','../../config/logger'];(function(_0x47169b,_0x4bc0d1){var _0x11a275=function(_0x3eea55){while(--_0x3eea55){_0x47169b['push'](_0x47169b['shift']());}};_0x11a275(++_0x4bc0d1);}(_0xf881,0xde));var _0x1f88=function(_0x27bed4,_0xf17e71){_0x27bed4=_0x27bed4-0x0;var _0x412e9d=_0xf881[_0x27bed4];return _0x412e9d;};'use strict';var _=require('lodash');var util=require(_0x1f88('0x0'));var logger=require(_0x1f88('0x1'))('api');var moment=require(_0x1f88('0x2'));var BPromise=require(_0x1f88('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1f88('0x4'));var attributes=require('./condition.attributes');module[_0x1f88('0x5')]=function(_0x5e09c6,_0x1f694b){return _0x5e09c6[_0x1f88('0x6')](_0x1f88('0x7'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x681c=['define','Condition','tools_conditions','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes'];(function(_0x42030e,_0x30983c){var _0xb286e=function(_0x1a11c4){while(--_0x1a11c4){_0x42030e['push'](_0x42030e['shift']());}};_0xb286e(++_0x30983c);}(_0x681c,0x92));var _0xc681=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x681c[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0xc681('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc681('0x1'));var moment=require(_0xc681('0x2'));var BPromise=require(_0xc681('0x3'));var rp=require(_0xc681('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc681('0x5'));var config=require(_0xc681('0x6'));var attributes=require(_0xc681('0x7'));module['exports']=function(_0x39d05e,_0x997bd7){return _0x39d05e[_0xc681('0x8')](_0xc681('0x9'),attributes,{'tableName':_0xc681('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index aad8788..4a6eb5d 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 _0x259e=['message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x259e,0x1de));var _0xe259=function(_0x2389ab,_0x5ac976){_0x2389ab=_0x2389ab-0x0;var _0x101346=_0x259e[_0x2389ab];return _0x101346;};'use strict';var _=require(_0xe259('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe259('0x1'));var rs=require(_0xe259('0x2'));var fs=require('fs');var Redis=require(_0xe259('0x3'));var db=require(_0xe259('0x4'))['db'];var utils=require(_0xe259('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe259('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe259('0x7')][_0xe259('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5040d6,_0x16c068,_0x4fe214){return new BPromise(function(_0x413150,_0x710bd8){return client[_0xe259('0x9')](_0x5040d6,_0x4fe214)['then'](function(_0x583aa7){logger[_0xe259('0xa')](_0xe259('0xb'),_0x16c068,_0xe259('0xc'));logger[_0xe259('0xd')](_0xe259('0xe'),_0x16c068,'request\x20sent',JSON['stringify'](_0x583aa7));if(_0x583aa7['error']){if(_0x583aa7['error']['code']===0x1f4){logger[_0xe259('0xf')]('Condition,\x20%s,\x20%s',_0x16c068,_0x583aa7['error']['message']);return _0x710bd8(_0x583aa7[_0xe259('0xf')][_0xe259('0x10')]);}logger['error']('Condition,\x20%s,\x20%s',_0x16c068,_0x583aa7[_0xe259('0xf')][_0xe259('0x10')]);return _0x413150(_0x583aa7[_0xe259('0xf')][_0xe259('0x10')]);}else{logger[_0xe259('0xa')](_0xe259('0xb'),_0x16c068,'request\x20sent');_0x413150(_0x583aa7[_0xe259('0x11')][_0xe259('0x10')]);}})[_0xe259('0x12')](function(_0x5ca36f){logger[_0xe259('0xf')]('Condition,\x20%s,\x20%s',_0x16c068,_0x5ca36f);_0x710bd8(_0x5ca36f);});});} \ No newline at end of file +var _0xad85=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','Condition,\x20%s,\x20%s'];(function(_0x3af037,_0x544072){var _0x3057e7=function(_0x43aeb2){while(--_0x43aeb2){_0x3af037['push'](_0x3af037['shift']());}};_0x3057e7(++_0x544072);}(_0xad85,0x17a));var _0x5ad8=function(_0x89c40f,_0xd92eb2){_0x89c40f=_0x89c40f-0x0;var _0x17acbb=_0xad85[_0x89c40f];return _0x17acbb;};'use strict';var _=require(_0x5ad8('0x0'));var util=require(_0x5ad8('0x1'));var moment=require(_0x5ad8('0x2'));var BPromise=require(_0x5ad8('0x3'));var rs=require(_0x5ad8('0x4'));var fs=require('fs');var Redis=require(_0x5ad8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ad8('0x6'));var logger=require(_0x5ad8('0x7'))(_0x5ad8('0x8'));var config=require(_0x5ad8('0x9'));var jayson=require(_0x5ad8('0xa'));var client=jayson[_0x5ad8('0xb')][_0x5ad8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12f658,_0x1284f6,_0x4507ed){return new BPromise(function(_0x56dcf3,_0x3dd2d9){return client[_0x5ad8('0xd')](_0x12f658,_0x4507ed)[_0x5ad8('0xe')](function(_0x357bc7){logger[_0x5ad8('0xf')]('Condition,\x20%s,\x20%s',_0x1284f6,_0x5ad8('0x10'));logger[_0x5ad8('0x11')](_0x5ad8('0x12'),_0x1284f6,'request\x20sent',JSON['stringify'](_0x357bc7));if(_0x357bc7[_0x5ad8('0x13')]){if(_0x357bc7[_0x5ad8('0x13')][_0x5ad8('0x14')]===0x1f4){logger[_0x5ad8('0x13')](_0x5ad8('0x15'),_0x1284f6,_0x357bc7[_0x5ad8('0x13')][_0x5ad8('0x16')]);return _0x3dd2d9(_0x357bc7[_0x5ad8('0x13')][_0x5ad8('0x16')]);}logger['error'](_0x5ad8('0x15'),_0x1284f6,_0x357bc7['error'][_0x5ad8('0x16')]);return _0x56dcf3(_0x357bc7[_0x5ad8('0x13')][_0x5ad8('0x16')]);}else{logger[_0x5ad8('0xf')]('Condition,\x20%s,\x20%s',_0x1284f6,_0x5ad8('0x10'));_0x56dcf3(_0x357bc7[_0x5ad8('0x17')][_0x5ad8('0x16')]);}})[_0x5ad8('0x18')](function(_0x31a4ee){logger[_0x5ad8('0x13')](_0x5ad8('0x15'),_0x1284f6,_0x31a4ee);_0x3dd2d9(_0x31a4ee);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 0e9aaa0..fac3e50 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 _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','delete','/:id','destroy','multer','util','path','express'];(function(_0xc054d2,_0x32143b){var _0x41dab1=function(_0x3494ef){while(--_0x3494ef){_0xc054d2['push'](_0xc054d2['shift']());}};_0x41dab1(++_0x32143b);}(_0x7a54,0x106));var _0x47a5=function(_0x29aa7e,_0x4aeb15){_0x29aa7e=_0x29aa7e-0x0;var _0x37b1d9=_0x7a54[_0x29aa7e];return _0x37b1d9;};'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')]('/:id',auth[_0x47a5('0xa')](),controller['update']);router[_0x47a5('0xb')](_0x47a5('0xc'),auth['isAuthenticated'](),controller[_0x47a5('0xd')]);module['exports']=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 87ed0e6..bb3705f 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 _0x046e=['sequelize','STRING'];(function(_0x12651a,_0x31a09c){var _0x556667=function(_0x5b7056){while(--_0x5b7056){_0x12651a['push'](_0x12651a['shift']());}};_0x556667(++_0x31a09c);}(_0x046e,0x1b4));var _0xe046=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x046e[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0xe046('0x0'));module['exports']={'name':{'type':Sequelize[_0xe046('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xe046('0x1')]}}; \ No newline at end of file +var _0x0e17=['STRING','name','sequelize','exports'];(function(_0x27b852,_0x3f9a79){var _0x45c6a7=function(_0x157bf2){while(--_0x157bf2){_0x27b852['push'](_0x27b852['shift']());}};_0x45c6a7(++_0x3f9a79);}(_0x0e17,0xd6));var _0x70e1=function(_0x2b6bbe,_0x41fc96){_0x2b6bbe=_0x2b6bbe-0x0;var _0x2b34f0=_0x0e17[_0x2b6bbe];return _0x2b34f0;};'use strict';var Sequelize=require(_0x70e1('0x0'));module[_0x70e1('0x1')]={'name':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'unique':_0x70e1('0x3')},'description':{'type':Sequelize[_0x70e1('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 4b296ba..2adc543 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 _0x4cc4=['createdAt','updatedAt','type','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','findOne','DashboardItem','getItems','nolimit','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','./dashboard.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','end','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','Dashboard','includeAll','include','rows','catch','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit'];(function(_0x22a570,_0x41643a){var _0x3f9172=function(_0x33846c){while(--_0x33846c){_0x22a570['push'](_0x22a570['shift']());}};_0x3f9172(++_0x41643a);}(_0x4cc4,0x96));var _0x44cc=function(_0x1627a5,_0x1794e6){_0x1627a5=_0x1627a5-0x0;var _0x1d2718=_0x4cc4[_0x1627a5];return _0x1d2718;};'use strict';var pdf=require(_0x44cc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x44cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x44cc('0x2'));var rp=require(_0x44cc('0x3'));var moment=require(_0x44cc('0x4'));var BPromise=require(_0x44cc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x44cc('0x6'));var sox=require(_0x44cc('0x7'));var csv=require('to-csv');var ejs=require(_0x44cc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x44cc('0x9'));var squel=require(_0x44cc('0xa'));var crypto=require(_0x44cc('0xb'));var jsforce=require(_0x44cc('0xc'));var deskjs=require(_0x44cc('0xd'));var toCsv=require(_0x44cc('0xe'));var querystring=require(_0x44cc('0xf'));var Papa=require('papaparse');var Redis=require(_0x44cc('0x10'));var authService=require(_0x44cc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x44cc('0x12'));var hardwareService=require(_0x44cc('0x13'));var logger=require('../../config/logger')(_0x44cc('0x14'));var utils=require('../../config/utils');var config=require(_0x44cc('0x15'));var licenseUtil=require(_0x44cc('0x16'));var db=require(_0x44cc('0x17'))['db'];config[_0x44cc('0x18')]=_['defaults'](config[_0x44cc('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x44cc('0x18')]));require(_0x44cc('0x19'))[_0x44cc('0x1a')](socket);function respondWithStatusCode(_0x1998e1,_0x37cbd5){_0x37cbd5=_0x37cbd5||0xcc;return function(_0x3caf7c){if(_0x3caf7c){return _0x1998e1[_0x44cc('0x1b')](_0x37cbd5);}return _0x1998e1[_0x44cc('0x1c')](_0x37cbd5)['end']();};}function respondWithResult(_0x39f9d3,_0x22d467){_0x22d467=_0x22d467||0xc8;return function(_0x9d458f){if(_0x9d458f){return _0x39f9d3[_0x44cc('0x1c')](_0x22d467)[_0x44cc('0x1d')](_0x9d458f);}};}function respondWithFilteredResult(_0x1b2f88,_0x3f366f){return function(_0xcf7509){if(_0xcf7509){var _0x3230a8=_0xcf7509[_0x44cc('0x1e')],_0x567a9e=_0x3f366f['offset'],_0x946d13=_0x3f366f[_0x44cc('0x1f')]+_0x3f366f[_0x44cc('0x20')],_0x571ad8;if(_0x946d13>=_0x3230a8){_0x946d13=_0x3230a8;_0x571ad8=0xc8;}else{_0x571ad8=0xce;}_0x1b2f88[_0x44cc('0x1c')](_0x571ad8);return _0x1b2f88[_0x44cc('0x21')](_0x44cc('0x22'),_0x567a9e+'-'+_0x946d13+'/'+_0x3230a8)['json'](_0xcf7509);}return null;};}function patchUpdates(_0x5e589e){return function(_0x1b8ff5){try{jsonpatch['apply'](_0x1b8ff5,_0x5e589e,!![]);}catch(_0x25d62e){return BPromise[_0x44cc('0x23')](_0x25d62e);}return _0x1b8ff5[_0x44cc('0x24')]();};}function saveUpdates(_0x2318b7,_0x5139fe){return function(_0x7b76ed){if(_0x7b76ed){return _0x7b76ed[_0x44cc('0x25')](_0x2318b7)[_0x44cc('0x26')](function(_0xab705a){return _0xab705a;});}return null;};}function removeEntity(_0x11d281,_0x21247b){return function(_0x5c3e71){if(_0x5c3e71){return _0x5c3e71[_0x44cc('0x27')]()['then'](function(){var _0x5e5b65=_0x5c3e71[_0x44cc('0x28')]({'plain':!![]});var _0x1759a8=_0x44cc('0x29');return db[_0x44cc('0x2a')][_0x44cc('0x27')]({'where':{'type':_0x1759a8,'resourceId':_0x5e5b65['id']}})['then'](function(){return _0x5c3e71;});})[_0x44cc('0x26')](function(){_0x11d281['status'](0xcc)[_0x44cc('0x2b')]();});}};}function handleEntityNotFound(_0x522dd1,_0xe3b06c){return function(_0x225a8a){if(!_0x225a8a){_0x522dd1[_0x44cc('0x1b')](0x194);}return _0x225a8a;};}function handleError(_0x50cb24,_0x47bde2){_0x47bde2=_0x47bde2||0x1f4;return function(_0x50e0f6){logger['error'](_0x50e0f6[_0x44cc('0x2c')]);if(_0x50e0f6[_0x44cc('0x2d')]){delete _0x50e0f6[_0x44cc('0x2d')];}_0x50cb24[_0x44cc('0x1c')](_0x47bde2)['send'](_0x50e0f6);};}exports[_0x44cc('0x2e')]=function(_0x595782,_0x2948e8){var _0x1b716f={},_0x38ff9b={},_0x182df4={'count':0x0,'rows':[]};var _0x187408=_[_0x44cc('0x2f')](db['Dashboard'][_0x44cc('0x30')],function(_0xa8b33d){return{'name':_0xa8b33d[_0x44cc('0x31')],'type':_0xa8b33d['type'][_0x44cc('0x32')]};});_0x38ff9b[_0x44cc('0x33')]=_[_0x44cc('0x2f')](_0x187408,_0x44cc('0x2d'));_0x38ff9b[_0x44cc('0x34')]=_['keys'](_0x595782[_0x44cc('0x34')]);_0x38ff9b[_0x44cc('0x35')]=_['intersection'](_0x38ff9b[_0x44cc('0x33')],_0x38ff9b[_0x44cc('0x34')]);_0x1b716f[_0x44cc('0x36')]=_[_0x44cc('0x37')](_0x38ff9b[_0x44cc('0x33')],qs[_0x44cc('0x38')](_0x595782[_0x44cc('0x34')][_0x44cc('0x38')]));_0x1b716f['attributes']=_0x1b716f[_0x44cc('0x36')][_0x44cc('0x39')]?_0x1b716f['attributes']:_0x38ff9b[_0x44cc('0x33')];if(!_0x595782[_0x44cc('0x34')][_0x44cc('0x3a')]('nolimit')){_0x1b716f[_0x44cc('0x20')]=qs[_0x44cc('0x20')](_0x595782[_0x44cc('0x34')]['limit']);_0x1b716f['offset']=qs[_0x44cc('0x1f')](_0x595782['query'][_0x44cc('0x1f')]);}_0x1b716f[_0x44cc('0x3b')]=qs[_0x44cc('0x3c')](_0x595782[_0x44cc('0x34')]['sort']);_0x1b716f[_0x44cc('0x3d')]=qs['filters'](_[_0x44cc('0x3e')](_0x595782[_0x44cc('0x34')],_0x38ff9b[_0x44cc('0x35')]),_0x187408);if(_0x595782['query']['filter']){_0x1b716f[_0x44cc('0x3d')]=_[_0x44cc('0x3f')](_0x1b716f[_0x44cc('0x3d')],{'$or':_[_0x44cc('0x2f')](_0x187408,function(_0x4c2685){if(_0x4c2685['type']!==_0x44cc('0x40')){var _0x392979={};_0x392979[_0x4c2685[_0x44cc('0x2d')]]={'$like':'%'+_0x595782[_0x44cc('0x34')][_0x44cc('0x41')]+'%'};return _0x392979;}})});}_0x1b716f=_[_0x44cc('0x3f')]({},_0x1b716f,_0x595782['options']);var _0x14364f={'where':_0x1b716f['where']};return db[_0x44cc('0x42')]['count'](_0x14364f)[_0x44cc('0x26')](function(_0x403f61){_0x182df4[_0x44cc('0x1e')]=_0x403f61;if(_0x595782[_0x44cc('0x34')][_0x44cc('0x43')]){_0x1b716f[_0x44cc('0x44')]=[{'all':!![]}];}return db[_0x44cc('0x42')]['findAll'](_0x1b716f);})[_0x44cc('0x26')](function(_0x484880){_0x182df4[_0x44cc('0x45')]=_0x484880;return _0x182df4;})[_0x44cc('0x26')](respondWithFilteredResult(_0x2948e8,_0x1b716f))[_0x44cc('0x46')](handleError(_0x2948e8,null));};exports['show']=function(_0x22e6b3,_0x5755e2){var _0x4a93be={'raw':![],'where':{'id':_0x22e6b3['params']['id']}},_0xeeeedc={};_0xeeeedc[_0x44cc('0x33')]=_[_0x44cc('0x47')](db['Dashboard'][_0x44cc('0x30')]);_0xeeeedc[_0x44cc('0x34')]=_[_0x44cc('0x47')](_0x22e6b3[_0x44cc('0x34')]);_0xeeeedc[_0x44cc('0x35')]=_['intersection'](_0xeeeedc['model'],_0xeeeedc['query']);_0x4a93be[_0x44cc('0x36')]=_['intersection'](_0xeeeedc[_0x44cc('0x33')],qs[_0x44cc('0x38')](_0x22e6b3[_0x44cc('0x34')]['fields']));_0x4a93be[_0x44cc('0x36')]=_0x4a93be['attributes'][_0x44cc('0x39')]?_0x4a93be[_0x44cc('0x36')]:_0xeeeedc[_0x44cc('0x33')];if(_0x22e6b3['query'][_0x44cc('0x43')]){_0x4a93be[_0x44cc('0x44')]=[{'all':!![]}];}_0x4a93be=_['merge']({},_0x4a93be,_0x22e6b3[_0x44cc('0x48')]);return db[_0x44cc('0x42')]['find'](_0x4a93be)[_0x44cc('0x26')](handleEntityNotFound(_0x5755e2,null))[_0x44cc('0x26')](respondWithResult(_0x5755e2,null))['catch'](handleError(_0x5755e2,null));};exports[_0x44cc('0x49')]=function(_0x5c167d,_0x3039d3){return db[_0x44cc('0x42')]['create'](_0x5c167d[_0x44cc('0x4a')],{})['then'](function(_0x46cd69){var _0x15107d=_0x5c167d[_0x44cc('0x4b')]['get']({'plain':!![]});if(!_0x15107d)throw new Error(_0x44cc('0x4c'));if(_0x15107d[_0x44cc('0x4d')]===_0x44cc('0x4b')){var _0xd9b9bb=_0x46cd69['get']({'plain':!![]});var _0x4d0c33=_0x44cc('0x29');return db[_0x44cc('0x4e')][_0x44cc('0x4f')]({'where':{'name':_0x4d0c33,'userProfileId':_0x15107d[_0x44cc('0x50')]},'raw':!![]})['then'](function(_0x203bcb){if(_0x203bcb&&_0x203bcb[_0x44cc('0x51')]===0x0){return db[_0x44cc('0x2a')]['create']({'name':_0xd9b9bb[_0x44cc('0x2d')],'resourceId':_0xd9b9bb['id'],'type':_0x203bcb[_0x44cc('0x2d')],'sectionId':_0x203bcb['id']},{})[_0x44cc('0x26')](function(){return _0x46cd69;});}else{return _0x46cd69;}})[_0x44cc('0x46')](function(_0xa043af){logger[_0x44cc('0x52')](_0x44cc('0x53'),_0xa043af);throw _0xa043af;});}return _0x46cd69;})[_0x44cc('0x26')](respondWithResult(_0x3039d3,0xc9))['catch'](handleError(_0x3039d3,null));};exports['clone']=function(_0x3769da,_0x328ac6){var _0x25a7f8={'where':{'id':_0x3769da[_0x44cc('0x54')]['id']}},_0x22ffbf={};_0x22ffbf[_0x44cc('0x33')]=_[_0x44cc('0x47')](db['Dashboard']['rawAttributes']);_0x25a7f8[_0x44cc('0x36')]=_[_0x44cc('0x37')](_0x22ffbf['model'],qs[_0x44cc('0x38')](_0x3769da[_0x44cc('0x34')]['fields']));_0x25a7f8[_0x44cc('0x36')]=_0x25a7f8['attributes']['length']?_0x25a7f8[_0x44cc('0x36')]:_0x22ffbf[_0x44cc('0x33')];if(_0x3769da[_0x44cc('0x34')][_0x44cc('0x43')]){_0x25a7f8['include']=[{'all':!![]}];}_0x25a7f8=_[_0x44cc('0x3f')]({},_0x25a7f8,_0x3769da['options']);return db[_0x44cc('0x42')]['find'](_0x25a7f8)['then'](handleEntityNotFound(_0x328ac6,null))[_0x44cc('0x26')](function(_0x3dd1ae){if(_0x3dd1ae){var _0x260a6d=_0x3dd1ae[_0x44cc('0x28')]({'plain':!![]});_0x260a6d=qs[_0x44cc('0x55')](_0x260a6d,['id',_0x44cc('0x56'),'updatedAt']);_0x3769da[_0x44cc('0x4a')]=_[_0x44cc('0x55')](_0x3769da[_0x44cc('0x4a')],['id','createdAt',_0x44cc('0x57')]);return db[_0x44cc('0x42')][_0x44cc('0x49')](_[_0x44cc('0x3f')](_0x260a6d,_0x3769da['body']),{'include':_0x3769da[_0x44cc('0x34')][_0x44cc('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x48b10d){var _0x183da1=_0x3769da[_0x44cc('0x4b')]['get']({'plain':!![]});if(!_0x183da1)throw new Error(_0x44cc('0x4c'));if(_0x183da1[_0x44cc('0x4d')]===_0x44cc('0x4b')){var _0x2c99b4=_0x48b10d[_0x44cc('0x28')]({'plain':!![]});var _0x330e50=_0x44cc('0x29');return db[_0x44cc('0x4e')][_0x44cc('0x4f')]({'where':{'name':_0x330e50,'userProfileId':_0x183da1[_0x44cc('0x50')]},'raw':!![]})[_0x44cc('0x26')](function(_0x3b297b){if(_0x3b297b&&_0x3b297b[_0x44cc('0x51')]===0x0){return db[_0x44cc('0x2a')][_0x44cc('0x49')]({'name':_0x2c99b4['name'],'resourceId':_0x2c99b4['id'],'type':_0x3b297b[_0x44cc('0x2d')],'sectionId':_0x3b297b['id']},{})[_0x44cc('0x26')](function(){return _0x48b10d;});}else{return _0x48b10d;}})[_0x44cc('0x46')](function(_0x1d7c0f){logger[_0x44cc('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d7c0f);throw _0x1d7c0f;});}return _0x48b10d;});}})[_0x44cc('0x26')](respondWithResult(_0x328ac6,0xc9))[_0x44cc('0x46')](handleError(_0x328ac6,null));};exports[_0x44cc('0x25')]=function(_0x16e583,_0x42c2b2){if(_0x16e583[_0x44cc('0x4a')]['id']){delete _0x16e583[_0x44cc('0x4a')]['id'];}return db[_0x44cc('0x42')]['find']({'where':{'id':_0x16e583[_0x44cc('0x54')]['id']}})[_0x44cc('0x26')](handleEntityNotFound(_0x42c2b2,null))[_0x44cc('0x26')](saveUpdates(_0x16e583['body'],null))[_0x44cc('0x26')](respondWithResult(_0x42c2b2,null))[_0x44cc('0x46')](handleError(_0x42c2b2,null));};exports['destroy']=function(_0x491242,_0x5b52ba){return db[_0x44cc('0x42')][_0x44cc('0x4f')]({'where':{'id':_0x491242['params']['id']}})[_0x44cc('0x26')](handleEntityNotFound(_0x5b52ba,null))['then'](removeEntity(_0x5b52ba,null))[_0x44cc('0x46')](handleError(_0x5b52ba,null));};function widgetAttributes(_0x29ddd6){try{switch(_0x29ddd6[_0x44cc('0x58')]){case _0x44cc('0x59'):return[{'name':_0x44cc('0x5a'),'value':_0x29ddd6[_0x44cc('0x5a')]||(_0x29ddd6[_0x44cc('0x5b')]&&_0x29ddd6[_0x44cc('0x5b')][0x0]?_0x29ddd6[_0x44cc('0x5b')][0x0]['value']:undefined)||'https://'}];case _0x44cc('0x5c'):return[{'name':_0x44cc('0x5d'),'value':_0x29ddd6['attrPath']||(_0x29ddd6[_0x44cc('0x5b')]&&_0x29ddd6['attrs'][0x0]?_0x29ddd6['attrs'][0x0][_0x44cc('0x5e')]:undefined)||''}];case _0x44cc('0x5f'):return[{'name':'attrHourFormat','value':_0x29ddd6[_0x44cc('0x60')]||(_0x29ddd6['attrs']&&_0x29ddd6['attrs'][0x0]?_0x29ddd6[_0x44cc('0x5b')][0x0][_0x44cc('0x5e')]:undefined)||_0x44cc('0x61')},{'name':_0x44cc('0x62'),'value':_0x29ddd6[_0x44cc('0x62')]||(_0x29ddd6['attrs']&&_0x29ddd6['attrs'][0x1]?_0x29ddd6[_0x44cc('0x5b')][0x1][_0x44cc('0x5e')]:undefined)||_0x44cc('0x63')},{'name':_0x44cc('0x64'),'value':_0x29ddd6[_0x44cc('0x64')]||(_0x29ddd6['attrs']&&_0x29ddd6[_0x44cc('0x5b')][0x2]?_0x29ddd6[_0x44cc('0x5b')][0x2][_0x44cc('0x5e')]:undefined)||0xc}];case _0x44cc('0x65'):return[{'name':_0x44cc('0x66'),'value':_0x29ddd6['attrMetric']||(_0x29ddd6[_0x44cc('0x5b')]&&_0x29ddd6[_0x44cc('0x5b')][0x0]?_0x29ddd6[_0x44cc('0x5b')][0x0][_0x44cc('0x5e')]:undefined)||_0x44cc('0x67')},{'name':'attrVoiceQueues','value':_0x29ddd6[_0x44cc('0x68')]||(_0x29ddd6['attrs']&&_0x29ddd6['attrs'][0x1]?_0x29ddd6[_0x44cc('0x5b')][0x1]['value']:undefined)||[]},{'name':_0x44cc('0x64'),'value':_0x29ddd6[_0x44cc('0x64')]||(_0x29ddd6['attrs']&&_0x29ddd6[_0x44cc('0x5b')][0x2]?_0x29ddd6['attrs'][0x2][_0x44cc('0x5e')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x29ddd6[_0x44cc('0x69')]||(_0x29ddd6[_0x44cc('0x5b')]&&_0x29ddd6[_0x44cc('0x5b')][0x0]?_0x29ddd6[_0x44cc('0x5b')][0x0][_0x44cc('0x5e')]:undefined)||_0x44cc('0x67')},{'name':_0x44cc('0x6a'),'value':_0x29ddd6[_0x44cc('0x6a')]||(_0x29ddd6[_0x44cc('0x5b')]&&_0x29ddd6['attrs'][0x1]?_0x29ddd6[_0x44cc('0x5b')][0x1][_0x44cc('0x5e')]:undefined)||null},{'name':_0x44cc('0x6b'),'value':_0x29ddd6[_0x44cc('0x6b')]||(_0x29ddd6['attrs']&&_0x29ddd6['attrs'][0x2]?_0x29ddd6[_0x44cc('0x5b')][0x2][_0x44cc('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x29ddd6[_0x44cc('0x68')]||(_0x29ddd6['attrs']&&_0x29ddd6['attrs'][0x3]?_0x29ddd6['attrs'][0x3]['value']:undefined)||[]}];case _0x44cc('0x6c'):return[{'name':_0x44cc('0x6d'),'type':_0x29ddd6['reportType']||(_0x29ddd6['attrs']&&_0x29ddd6[_0x44cc('0x5b')][0x0]?_0x29ddd6[_0x44cc('0x5b')][0x0]['type']:undefined)||null,'value':_0x29ddd6[_0x44cc('0x6d')]||(_0x29ddd6['attrs']&&_0x29ddd6[_0x44cc('0x5b')][0x0]?_0x29ddd6[_0x44cc('0x5b')][0x0]['value']:undefined)||null},{'name':_0x44cc('0x6e'),'value':_0x29ddd6[_0x44cc('0x6e')]||(_0x29ddd6[_0x44cc('0x5b')]&&_0x29ddd6[_0x44cc('0x5b')][0x1]?_0x29ddd6[_0x44cc('0x5b')][0x1][_0x44cc('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x2b92cc){logger[_0x44cc('0x52')](_0x44cc('0x6f'),JSON[_0x44cc('0x70')](_0x2b92cc));return[];}}exports[_0x44cc('0x71')]=function(_0x401370,_0x3278df,_0x352923){if(_0x401370['body']['id']){delete _0x401370[_0x44cc('0x4a')]['id'];}return db[_0x44cc('0x42')][_0x44cc('0x4f')]({'where':{'id':_0x401370['params']['id']}})['then'](handleEntityNotFound(_0x3278df,null))['then'](function(_0x5e209f){if(_0x5e209f){_0x401370[_0x44cc('0x4a')]['DashboardId']=_0x5e209f['id'];_0x401370[_0x44cc('0x4a')]['attrs']=widgetAttributes(_0x401370[_0x44cc('0x4a')]);return db['DashboardItem'][_0x44cc('0x49')](_0x401370['body']);}})[_0x44cc('0x26')](respondWithResult(_0x3278df,null))[_0x44cc('0x46')](handleError(_0x3278df,null));};exports['getItems']=function(_0x95fbed,_0x139e9f,_0x31f11e){var _0x439b45={};var _0x3333bb={};var _0x17c710;var _0x321281;return db[_0x44cc('0x42')][_0x44cc('0x72')]({'where':{'id':_0x95fbed[_0x44cc('0x54')]['id']}})[_0x44cc('0x26')](handleEntityNotFound(_0x139e9f,null))[_0x44cc('0x26')](function(_0x595e68){if(_0x595e68){_0x17c710=_0x595e68;_0x3333bb['model']=_['keys'](db[_0x44cc('0x73')]['rawAttributes']);_0x3333bb[_0x44cc('0x34')]=_[_0x44cc('0x47')](_0x95fbed[_0x44cc('0x34')]);_0x3333bb[_0x44cc('0x35')]=_[_0x44cc('0x37')](_0x3333bb['model'],_0x3333bb[_0x44cc('0x34')]);_0x439b45[_0x44cc('0x36')]=_['intersection'](_0x3333bb[_0x44cc('0x33')],qs['fields'](_0x95fbed[_0x44cc('0x34')][_0x44cc('0x38')]));_0x439b45['attributes']=_0x439b45[_0x44cc('0x36')][_0x44cc('0x39')]?_0x439b45[_0x44cc('0x36')]:_0x3333bb[_0x44cc('0x33')];_0x439b45[_0x44cc('0x3b')]=qs[_0x44cc('0x3c')](_0x95fbed['query'][_0x44cc('0x3c')]);_0x439b45[_0x44cc('0x3d')]=qs[_0x44cc('0x35')](_['pick'](_0x95fbed['query'],_0x3333bb['filters']));if(_0x95fbed[_0x44cc('0x34')]['filter']){_0x439b45[_0x44cc('0x3d')]=_[_0x44cc('0x3f')](_0x439b45[_0x44cc('0x3d')],{'$or':_[_0x44cc('0x2f')](_0x439b45[_0x44cc('0x36')],function(_0x35bd89){var _0x336956={};_0x336956[_0x35bd89]={'$like':'%'+_0x95fbed['query'][_0x44cc('0x41')]+'%'};return _0x336956;})});}_0x439b45=_['merge']({},_0x439b45,_0x95fbed[_0x44cc('0x48')]);return _0x17c710[_0x44cc('0x74')](_0x439b45);}})['then'](function(_0x196151){if(_0x196151){_0x321281=_0x196151['length'];if(!_0x95fbed[_0x44cc('0x34')][_0x44cc('0x3a')](_0x44cc('0x75'))){_0x439b45['limit']=qs[_0x44cc('0x20')](_0x95fbed['query'][_0x44cc('0x20')]);_0x439b45[_0x44cc('0x1f')]=qs[_0x44cc('0x1f')](_0x95fbed[_0x44cc('0x34')]['offset']);}return _0x17c710['getItems'](_0x439b45);}})[_0x44cc('0x26')](function(_0x276aad){if(_0x276aad){return _0x276aad?{'count':_0x321281,'rows':_0x276aad}:null;}})[_0x44cc('0x26')](respondWithResult(_0x139e9f,null))[_0x44cc('0x46')](handleError(_0x139e9f,null));}; \ No newline at end of file +var _0xc2d2=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','status','count','offset','set','apply','reject','update','then','get','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','Dashboard','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','rows','catch','show','params','keys','length','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','body','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','pick','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x8ee1b,_0x980f8b){var _0x46de37=function(_0x2d263c){while(--_0x2d263c){_0x8ee1b['push'](_0x8ee1b['shift']());}};_0x46de37(++_0x980f8b);}(_0xc2d2,0x66));var _0x2c2d=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0xc2d2[_0x7d62cb];return _0x3a6266;};'use strict';var pdf=require(_0x2c2d('0x0'));var emlformat=require(_0x2c2d('0x1'));var rimraf=require(_0x2c2d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c2d('0x3'));var rp=require(_0x2c2d('0x4'));var moment=require(_0x2c2d('0x5'));var BPromise=require(_0x2c2d('0x6'));var Mustache=require(_0x2c2d('0x7'));var util=require(_0x2c2d('0x8'));var path=require(_0x2c2d('0x9'));var sox=require(_0x2c2d('0xa'));var csv=require(_0x2c2d('0xb'));var ejs=require(_0x2c2d('0xc'));var fs=require('fs');var fs_extra=require(_0x2c2d('0xd'));var _=require(_0x2c2d('0xe'));var squel=require('squel');var crypto=require(_0x2c2d('0xf'));var jsforce=require(_0x2c2d('0x10'));var deskjs=require(_0x2c2d('0x11'));var toCsv=require(_0x2c2d('0xb'));var querystring=require(_0x2c2d('0x12'));var Papa=require(_0x2c2d('0x13'));var Redis=require(_0x2c2d('0x14'));var authService=require(_0x2c2d('0x15'));var qs=require(_0x2c2d('0x16'));var as=require(_0x2c2d('0x17'));var hardwareService=require(_0x2c2d('0x18'));var logger=require('../../config/logger')(_0x2c2d('0x19'));var utils=require(_0x2c2d('0x1a'));var config=require(_0x2c2d('0x1b'));var licenseUtil=require(_0x2c2d('0x1c'));var db=require(_0x2c2d('0x1d'))['db'];config[_0x2c2d('0x1e')]=_[_0x2c2d('0x1f')](config['redis'],{'host':_0x2c2d('0x20'),'port':0x18eb});var socket=require(_0x2c2d('0x21'))(new Redis(config[_0x2c2d('0x1e')]));require(_0x2c2d('0x22'))['register'](socket);function respondWithStatusCode(_0x4967ce,_0x5c8ee6){_0x5c8ee6=_0x5c8ee6||0xcc;return function(_0x59097c){if(_0x59097c){return _0x4967ce['sendStatus'](_0x5c8ee6);}return _0x4967ce['status'](_0x5c8ee6)['end']();};}function respondWithResult(_0x4f9308,_0x50f690){_0x50f690=_0x50f690||0xc8;return function(_0x121a93){if(_0x121a93){return _0x4f9308[_0x2c2d('0x23')](_0x50f690)['json'](_0x121a93);}};}function respondWithFilteredResult(_0x72fa3b,_0x11e7f6){return function(_0x2b7794){if(_0x2b7794){var _0x26b0f5=_0x2b7794[_0x2c2d('0x24')],_0x26ad6b=_0x11e7f6['offset'],_0xa83a36=_0x11e7f6[_0x2c2d('0x25')]+_0x11e7f6['limit'],_0x1de0a2;if(_0xa83a36>=_0x26b0f5){_0xa83a36=_0x26b0f5;_0x1de0a2=0xc8;}else{_0x1de0a2=0xce;}_0x72fa3b['status'](_0x1de0a2);return _0x72fa3b[_0x2c2d('0x26')]('Content-Range',_0x26ad6b+'-'+_0xa83a36+'/'+_0x26b0f5)['json'](_0x2b7794);}return null;};}function patchUpdates(_0x341138){return function(_0xaa90bf){try{jsonpatch[_0x2c2d('0x27')](_0xaa90bf,_0x341138,!![]);}catch(_0x2f2ae2){return BPromise[_0x2c2d('0x28')](_0x2f2ae2);}return _0xaa90bf['save']();};}function saveUpdates(_0x2aeeff,_0x2468bf){return function(_0x1294bc){if(_0x1294bc){return _0x1294bc[_0x2c2d('0x29')](_0x2aeeff)[_0x2c2d('0x2a')](function(_0x13de0e){return _0x13de0e;});}return null;};}function removeEntity(_0x547ef3,_0x111daf){return function(_0x10e724){if(_0x10e724){return _0x10e724['destroy']()[_0x2c2d('0x2a')](function(){var _0x1e2fee=_0x10e724[_0x2c2d('0x2b')]({'plain':!![]});var _0x5b2040='CustomDashboards';return db[_0x2c2d('0x2c')][_0x2c2d('0x2d')]({'where':{'type':_0x5b2040,'resourceId':_0x1e2fee['id']}})[_0x2c2d('0x2a')](function(){return _0x10e724;});})[_0x2c2d('0x2a')](function(){_0x547ef3[_0x2c2d('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x489500,_0x4b7115){return function(_0x2d327d){if(!_0x2d327d){_0x489500[_0x2c2d('0x2e')](0x194);}return _0x2d327d;};}function handleError(_0x1cf157,_0x3496d3){_0x3496d3=_0x3496d3||0x1f4;return function(_0x9be45b){logger['error'](_0x9be45b[_0x2c2d('0x2f')]);if(_0x9be45b[_0x2c2d('0x30')]){delete _0x9be45b[_0x2c2d('0x30')];}_0x1cf157[_0x2c2d('0x23')](_0x3496d3)[_0x2c2d('0x31')](_0x9be45b);};}exports[_0x2c2d('0x32')]=function(_0x2e04b0,_0xc50f45){var _0x20229b={},_0x2a6af8={},_0x47181b={'count':0x0,'rows':[]};var _0x279e96=_[_0x2c2d('0x33')](db[_0x2c2d('0x34')][_0x2c2d('0x35')],function(_0x32412d){return{'name':_0x32412d['fieldName'],'type':_0x32412d[_0x2c2d('0x36')][_0x2c2d('0x37')]};});_0x2a6af8[_0x2c2d('0x38')]=_[_0x2c2d('0x33')](_0x279e96,'name');_0x2a6af8['query']=_['keys'](_0x2e04b0[_0x2c2d('0x39')]);_0x2a6af8[_0x2c2d('0x3a')]=_[_0x2c2d('0x3b')](_0x2a6af8['model'],_0x2a6af8[_0x2c2d('0x39')]);_0x20229b[_0x2c2d('0x3c')]=_[_0x2c2d('0x3b')](_0x2a6af8[_0x2c2d('0x38')],qs[_0x2c2d('0x3d')](_0x2e04b0['query'][_0x2c2d('0x3d')]));_0x20229b[_0x2c2d('0x3c')]=_0x20229b[_0x2c2d('0x3c')]['length']?_0x20229b[_0x2c2d('0x3c')]:_0x2a6af8[_0x2c2d('0x38')];if(!_0x2e04b0['query'][_0x2c2d('0x3e')](_0x2c2d('0x3f'))){_0x20229b[_0x2c2d('0x40')]=qs[_0x2c2d('0x40')](_0x2e04b0[_0x2c2d('0x39')][_0x2c2d('0x40')]);_0x20229b['offset']=qs[_0x2c2d('0x25')](_0x2e04b0[_0x2c2d('0x39')][_0x2c2d('0x25')]);}_0x20229b[_0x2c2d('0x41')]=qs[_0x2c2d('0x42')](_0x2e04b0[_0x2c2d('0x39')][_0x2c2d('0x42')]);_0x20229b[_0x2c2d('0x43')]=qs[_0x2c2d('0x3a')](_['pick'](_0x2e04b0[_0x2c2d('0x39')],_0x2a6af8[_0x2c2d('0x3a')]),_0x279e96);if(_0x2e04b0[_0x2c2d('0x39')]['filter']){_0x20229b[_0x2c2d('0x43')]=_['merge'](_0x20229b[_0x2c2d('0x43')],{'$or':_['map'](_0x279e96,function(_0x52df58){if(_0x52df58[_0x2c2d('0x36')]!=='VIRTUAL'){var _0x36ac70={};_0x36ac70[_0x52df58[_0x2c2d('0x30')]]={'$like':'%'+_0x2e04b0[_0x2c2d('0x39')][_0x2c2d('0x44')]+'%'};return _0x36ac70;}})});}_0x20229b=_[_0x2c2d('0x45')]({},_0x20229b,_0x2e04b0[_0x2c2d('0x46')]);var _0x1f3f5a={'where':_0x20229b[_0x2c2d('0x43')]};return db[_0x2c2d('0x34')][_0x2c2d('0x24')](_0x1f3f5a)['then'](function(_0x307e05){_0x47181b[_0x2c2d('0x24')]=_0x307e05;if(_0x2e04b0[_0x2c2d('0x39')]['includeAll']){_0x20229b['include']=[{'all':!![]}];}return db[_0x2c2d('0x34')]['findAll'](_0x20229b);})['then'](function(_0x52e69f){_0x47181b[_0x2c2d('0x47')]=_0x52e69f;return _0x47181b;})['then'](respondWithFilteredResult(_0xc50f45,_0x20229b))[_0x2c2d('0x48')](handleError(_0xc50f45,null));};exports[_0x2c2d('0x49')]=function(_0x4909ce,_0x3b6126){var _0x239221={'raw':![],'where':{'id':_0x4909ce[_0x2c2d('0x4a')]['id']}},_0x5e7b8a={};_0x5e7b8a[_0x2c2d('0x38')]=_[_0x2c2d('0x4b')](db[_0x2c2d('0x34')][_0x2c2d('0x35')]);_0x5e7b8a[_0x2c2d('0x39')]=_[_0x2c2d('0x4b')](_0x4909ce[_0x2c2d('0x39')]);_0x5e7b8a[_0x2c2d('0x3a')]=_[_0x2c2d('0x3b')](_0x5e7b8a['model'],_0x5e7b8a[_0x2c2d('0x39')]);_0x239221['attributes']=_[_0x2c2d('0x3b')](_0x5e7b8a[_0x2c2d('0x38')],qs[_0x2c2d('0x3d')](_0x4909ce['query'][_0x2c2d('0x3d')]));_0x239221[_0x2c2d('0x3c')]=_0x239221[_0x2c2d('0x3c')][_0x2c2d('0x4c')]?_0x239221['attributes']:_0x5e7b8a[_0x2c2d('0x38')];if(_0x4909ce[_0x2c2d('0x39')][_0x2c2d('0x4d')]){_0x239221[_0x2c2d('0x4e')]=[{'all':!![]}];}_0x239221=_['merge']({},_0x239221,_0x4909ce[_0x2c2d('0x46')]);return db['Dashboard'][_0x2c2d('0x4f')](_0x239221)[_0x2c2d('0x2a')](handleEntityNotFound(_0x3b6126,null))['then'](respondWithResult(_0x3b6126,null))[_0x2c2d('0x48')](handleError(_0x3b6126,null));};exports[_0x2c2d('0x50')]=function(_0x225c22,_0xb39a95){return db['Dashboard'][_0x2c2d('0x50')](_0x225c22['body'],{})[_0x2c2d('0x2a')](function(_0x3e38ee){var _0x23a27b=_0x225c22[_0x2c2d('0x51')][_0x2c2d('0x2b')]({'plain':!![]});if(!_0x23a27b)throw new Error(_0x2c2d('0x52'));if(_0x23a27b['role']===_0x2c2d('0x51')){var _0x2722f1=_0x3e38ee[_0x2c2d('0x2b')]({'plain':!![]});var _0x4be898=_0x2c2d('0x53');return db[_0x2c2d('0x54')][_0x2c2d('0x4f')]({'where':{'name':_0x4be898,'userProfileId':_0x23a27b[_0x2c2d('0x55')]},'raw':!![]})[_0x2c2d('0x2a')](function(_0x19acfb){if(_0x19acfb&&_0x19acfb[_0x2c2d('0x56')]===0x0){return db[_0x2c2d('0x2c')][_0x2c2d('0x50')]({'name':_0x2722f1[_0x2c2d('0x30')],'resourceId':_0x2722f1['id'],'type':_0x19acfb['name'],'sectionId':_0x19acfb['id']},{})['then'](function(){return _0x3e38ee;});}else{return _0x3e38ee;}})[_0x2c2d('0x48')](function(_0x53f525){logger[_0x2c2d('0x57')](_0x2c2d('0x58'),_0x53f525);throw _0x53f525;});}return _0x3e38ee;})['then'](respondWithResult(_0xb39a95,0xc9))['catch'](handleError(_0xb39a95,null));};exports['clone']=function(_0x1acfd8,_0x3a3f1f){var _0x3a0756={'where':{'id':_0x1acfd8['params']['id']}},_0x18e692={};_0x18e692[_0x2c2d('0x38')]=_[_0x2c2d('0x4b')](db[_0x2c2d('0x34')][_0x2c2d('0x35')]);_0x3a0756[_0x2c2d('0x3c')]=_[_0x2c2d('0x3b')](_0x18e692[_0x2c2d('0x38')],qs['fields'](_0x1acfd8[_0x2c2d('0x39')][_0x2c2d('0x3d')]));_0x3a0756[_0x2c2d('0x3c')]=_0x3a0756[_0x2c2d('0x3c')][_0x2c2d('0x4c')]?_0x3a0756['attributes']:_0x18e692[_0x2c2d('0x38')];if(_0x1acfd8['query'][_0x2c2d('0x4d')]){_0x3a0756[_0x2c2d('0x4e')]=[{'all':!![]}];}_0x3a0756=_[_0x2c2d('0x45')]({},_0x3a0756,_0x1acfd8[_0x2c2d('0x46')]);return db[_0x2c2d('0x34')][_0x2c2d('0x4f')](_0x3a0756)[_0x2c2d('0x2a')](handleEntityNotFound(_0x3a3f1f,null))[_0x2c2d('0x2a')](function(_0xeba297){if(_0xeba297){var _0xd1f913=_0xeba297[_0x2c2d('0x2b')]({'plain':!![]});_0xd1f913=qs['omit'](_0xd1f913,['id',_0x2c2d('0x59'),_0x2c2d('0x5a')]);_0x1acfd8['body']=_[_0x2c2d('0x5b')](_0x1acfd8[_0x2c2d('0x5c')],['id',_0x2c2d('0x59'),_0x2c2d('0x5a')]);return db[_0x2c2d('0x34')][_0x2c2d('0x50')](_[_0x2c2d('0x45')](_0xd1f913,_0x1acfd8[_0x2c2d('0x5c')]),{'include':_0x1acfd8[_0x2c2d('0x39')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x58e680){var _0x561eed=_0x1acfd8[_0x2c2d('0x51')][_0x2c2d('0x2b')]({'plain':!![]});if(!_0x561eed)throw new Error(_0x2c2d('0x52'));if(_0x561eed['role']===_0x2c2d('0x51')){var _0x5309c0=_0x58e680['get']({'plain':!![]});var _0x5da9a0=_0x2c2d('0x53');return db[_0x2c2d('0x54')][_0x2c2d('0x4f')]({'where':{'name':_0x5da9a0,'userProfileId':_0x561eed[_0x2c2d('0x55')]},'raw':!![]})[_0x2c2d('0x2a')](function(_0x46f334){if(_0x46f334&&_0x46f334['autoAssociation']===0x0){return db['UserProfileResource'][_0x2c2d('0x50')]({'name':_0x5309c0[_0x2c2d('0x30')],'resourceId':_0x5309c0['id'],'type':_0x46f334[_0x2c2d('0x30')],'sectionId':_0x46f334['id']},{})[_0x2c2d('0x2a')](function(){return _0x58e680;});}else{return _0x58e680;}})[_0x2c2d('0x48')](function(_0x3c5e3b){logger[_0x2c2d('0x57')](_0x2c2d('0x58'),_0x3c5e3b);throw _0x3c5e3b;});}return _0x58e680;});}})[_0x2c2d('0x2a')](respondWithResult(_0x3a3f1f,0xc9))[_0x2c2d('0x48')](handleError(_0x3a3f1f,null));};exports[_0x2c2d('0x29')]=function(_0xc77cf,_0x4a72fa){if(_0xc77cf[_0x2c2d('0x5c')]['id']){delete _0xc77cf['body']['id'];}return db[_0x2c2d('0x34')][_0x2c2d('0x4f')]({'where':{'id':_0xc77cf[_0x2c2d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a72fa,null))[_0x2c2d('0x2a')](saveUpdates(_0xc77cf[_0x2c2d('0x5c')],null))[_0x2c2d('0x2a')](respondWithResult(_0x4a72fa,null))[_0x2c2d('0x48')](handleError(_0x4a72fa,null));};exports[_0x2c2d('0x2d')]=function(_0x40bc94,_0x5c109b){return db['Dashboard'][_0x2c2d('0x4f')]({'where':{'id':_0x40bc94[_0x2c2d('0x4a')]['id']}})[_0x2c2d('0x2a')](handleEntityNotFound(_0x5c109b,null))[_0x2c2d('0x2a')](removeEntity(_0x5c109b,null))[_0x2c2d('0x48')](handleError(_0x5c109b,null));};function widgetAttributes(_0x48b60c){try{switch(_0x48b60c['type']){case'iframe':return[{'name':'attrUrl','value':_0x48b60c[_0x2c2d('0x5d')]||(_0x48b60c[_0x2c2d('0x5e')]&&_0x48b60c['attrs'][0x0]?_0x48b60c[_0x2c2d('0x5e')][0x0][_0x2c2d('0x5f')]:undefined)||_0x2c2d('0x60')}];case'custom':return[{'name':'attrPath','value':_0x48b60c[_0x2c2d('0x61')]||(_0x48b60c[_0x2c2d('0x5e')]&&_0x48b60c['attrs'][0x0]?_0x48b60c['attrs'][0x0][_0x2c2d('0x5f')]:undefined)||''}];case _0x2c2d('0x62'):return[{'name':_0x2c2d('0x63'),'value':_0x48b60c[_0x2c2d('0x63')]||(_0x48b60c['attrs']&&_0x48b60c[_0x2c2d('0x5e')][0x0]?_0x48b60c[_0x2c2d('0x5e')][0x0]['value']:undefined)||_0x2c2d('0x64')},{'name':'attrTimezone','value':_0x48b60c['attrTimezone']||(_0x48b60c[_0x2c2d('0x5e')]&&_0x48b60c['attrs'][0x1]?_0x48b60c[_0x2c2d('0x5e')][0x1][_0x2c2d('0x5f')]:undefined)||'0.00'},{'name':_0x2c2d('0x65'),'value':_0x48b60c[_0x2c2d('0x65')]||(_0x48b60c['attrs']&&_0x48b60c[_0x2c2d('0x5e')][0x2]?_0x48b60c[_0x2c2d('0x5e')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x48b60c[_0x2c2d('0x66')]||(_0x48b60c[_0x2c2d('0x5e')]&&_0x48b60c[_0x2c2d('0x5e')][0x0]?_0x48b60c[_0x2c2d('0x5e')][0x0][_0x2c2d('0x5f')]:undefined)||_0x2c2d('0x67')},{'name':_0x2c2d('0x68'),'value':_0x48b60c[_0x2c2d('0x68')]||(_0x48b60c['attrs']&&_0x48b60c[_0x2c2d('0x5e')][0x1]?_0x48b60c[_0x2c2d('0x5e')][0x1][_0x2c2d('0x5f')]:undefined)||[]},{'name':_0x2c2d('0x65'),'value':_0x48b60c[_0x2c2d('0x65')]||(_0x48b60c['attrs']&&_0x48b60c[_0x2c2d('0x5e')][0x2]?_0x48b60c[_0x2c2d('0x5e')][0x2][_0x2c2d('0x5f')]:undefined)||0x14}];case _0x2c2d('0x69'):case _0x2c2d('0x6a'):return[{'name':_0x2c2d('0x6b'),'value':_0x48b60c[_0x2c2d('0x6b')]||(_0x48b60c['attrs']&&_0x48b60c['attrs'][0x0]?_0x48b60c[_0x2c2d('0x5e')][0x0]['value']:undefined)||_0x2c2d('0x67')},{'name':_0x2c2d('0x6c'),'value':_0x48b60c['attrSerie2']||(_0x48b60c['attrs']&&_0x48b60c[_0x2c2d('0x5e')][0x1]?_0x48b60c['attrs'][0x1][_0x2c2d('0x5f')]:undefined)||null},{'name':_0x2c2d('0x6d'),'value':_0x48b60c[_0x2c2d('0x6d')]||(_0x48b60c[_0x2c2d('0x5e')]&&_0x48b60c[_0x2c2d('0x5e')][0x2]?_0x48b60c['attrs'][0x2][_0x2c2d('0x5f')]:undefined)||null},{'name':_0x2c2d('0x68'),'value':_0x48b60c[_0x2c2d('0x68')]||(_0x48b60c[_0x2c2d('0x5e')]&&_0x48b60c[_0x2c2d('0x5e')][0x3]?_0x48b60c[_0x2c2d('0x5e')][0x3][_0x2c2d('0x5f')]:undefined)||[]}];case _0x2c2d('0x6e'):return[{'name':_0x2c2d('0x6f'),'type':_0x48b60c['reportType']||(_0x48b60c[_0x2c2d('0x5e')]&&_0x48b60c[_0x2c2d('0x5e')][0x0]?_0x48b60c[_0x2c2d('0x5e')][0x0]['type']:undefined)||null,'value':_0x48b60c[_0x2c2d('0x6f')]||(_0x48b60c[_0x2c2d('0x5e')]&&_0x48b60c[_0x2c2d('0x5e')][0x0]?_0x48b60c[_0x2c2d('0x5e')][0x0][_0x2c2d('0x5f')]:undefined)||null},{'name':_0x2c2d('0x70'),'value':_0x48b60c['attrRefresh']||(_0x48b60c[_0x2c2d('0x5e')]&&_0x48b60c[_0x2c2d('0x5e')][0x1]?_0x48b60c[_0x2c2d('0x5e')][0x1][_0x2c2d('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x5055a9){logger[_0x2c2d('0x57')](_0x2c2d('0x71'),JSON[_0x2c2d('0x72')](_0x5055a9));return[];}}exports[_0x2c2d('0x73')]=function(_0x56826b,_0x2f49be,_0x3cfa17){if(_0x56826b[_0x2c2d('0x5c')]['id']){delete _0x56826b[_0x2c2d('0x5c')]['id'];}return db[_0x2c2d('0x34')][_0x2c2d('0x4f')]({'where':{'id':_0x56826b[_0x2c2d('0x4a')]['id']}})[_0x2c2d('0x2a')](handleEntityNotFound(_0x2f49be,null))[_0x2c2d('0x2a')](function(_0x4d444){if(_0x4d444){_0x56826b[_0x2c2d('0x5c')]['DashboardId']=_0x4d444['id'];_0x56826b[_0x2c2d('0x5c')][_0x2c2d('0x5e')]=widgetAttributes(_0x56826b['body']);return db[_0x2c2d('0x74')]['create'](_0x56826b[_0x2c2d('0x5c')]);}})[_0x2c2d('0x2a')](respondWithResult(_0x2f49be,null))[_0x2c2d('0x48')](handleError(_0x2f49be,null));};exports[_0x2c2d('0x75')]=function(_0x25b6a1,_0x57b913,_0x735095){var _0x207440={};var _0x39ae51={};var _0x2ca9a7;var _0x5172bb;return db[_0x2c2d('0x34')][_0x2c2d('0x76')]({'where':{'id':_0x25b6a1['params']['id']}})[_0x2c2d('0x2a')](handleEntityNotFound(_0x57b913,null))['then'](function(_0x196467){if(_0x196467){_0x2ca9a7=_0x196467;_0x39ae51[_0x2c2d('0x38')]=_[_0x2c2d('0x4b')](db[_0x2c2d('0x74')]['rawAttributes']);_0x39ae51[_0x2c2d('0x39')]=_['keys'](_0x25b6a1[_0x2c2d('0x39')]);_0x39ae51[_0x2c2d('0x3a')]=_[_0x2c2d('0x3b')](_0x39ae51[_0x2c2d('0x38')],_0x39ae51[_0x2c2d('0x39')]);_0x207440[_0x2c2d('0x3c')]=_['intersection'](_0x39ae51[_0x2c2d('0x38')],qs[_0x2c2d('0x3d')](_0x25b6a1[_0x2c2d('0x39')]['fields']));_0x207440[_0x2c2d('0x3c')]=_0x207440[_0x2c2d('0x3c')][_0x2c2d('0x4c')]?_0x207440[_0x2c2d('0x3c')]:_0x39ae51[_0x2c2d('0x38')];_0x207440[_0x2c2d('0x41')]=qs[_0x2c2d('0x42')](_0x25b6a1[_0x2c2d('0x39')][_0x2c2d('0x42')]);_0x207440[_0x2c2d('0x43')]=qs[_0x2c2d('0x3a')](_[_0x2c2d('0x77')](_0x25b6a1[_0x2c2d('0x39')],_0x39ae51[_0x2c2d('0x3a')]));if(_0x25b6a1[_0x2c2d('0x39')][_0x2c2d('0x44')]){_0x207440[_0x2c2d('0x43')]=_['merge'](_0x207440[_0x2c2d('0x43')],{'$or':_['map'](_0x207440[_0x2c2d('0x3c')],function(_0x375bfb){var _0x3e1bbc={};_0x3e1bbc[_0x375bfb]={'$like':'%'+_0x25b6a1[_0x2c2d('0x39')][_0x2c2d('0x44')]+'%'};return _0x3e1bbc;})});}_0x207440=_[_0x2c2d('0x45')]({},_0x207440,_0x25b6a1['options']);return _0x2ca9a7[_0x2c2d('0x75')](_0x207440);}})[_0x2c2d('0x2a')](function(_0x5251e7){if(_0x5251e7){_0x5172bb=_0x5251e7['length'];if(!_0x25b6a1[_0x2c2d('0x39')]['hasOwnProperty']('nolimit')){_0x207440['limit']=qs['limit'](_0x25b6a1[_0x2c2d('0x39')][_0x2c2d('0x40')]);_0x207440[_0x2c2d('0x25')]=qs[_0x2c2d('0x25')](_0x25b6a1[_0x2c2d('0x39')][_0x2c2d('0x25')]);}return _0x2ca9a7[_0x2c2d('0x75')](_0x207440);}})['then'](function(_0x4bb7d9){if(_0x4bb7d9){return _0x4bb7d9?{'count':_0x5172bb,'rows':_0x4bb7d9}:null;}})[_0x2c2d('0x2a')](respondWithResult(_0x57b913,null))[_0x2c2d('0x48')](handleError(_0x57b913,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 2810d54..2585aee 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 _0xadee=['../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4c0671,_0x438300){var _0x360a25=function(_0x12cfdc){while(--_0x12cfdc){_0x4c0671['push'](_0x4c0671['shift']());}};_0x360a25(++_0x438300);}(_0xadee,0xfc));var _0xeade=function(_0x5d8c83,_0x25226d){_0x5d8c83=_0x5d8c83-0x0;var _0x161056=_0xadee[_0x5d8c83];return _0x161056;};'use strict';var EventEmitter=require(_0xeade('0x0'));var Dashboard=require(_0xeade('0x1'))['db'][_0xeade('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xeade('0x3')](0x0);var events={'afterCreate':_0xeade('0x4'),'afterUpdate':_0xeade('0x5'),'afterDestroy':_0xeade('0x6')};function emitEvent(_0x18f828){return function(_0x30bf91,_0x391058,_0x4b2ea9){DashboardEvents[_0xeade('0x7')](_0x18f828+':'+_0x30bf91['id'],_0x30bf91);DashboardEvents['emit'](_0x18f828,_0x30bf91);_0x4b2ea9(null);};}for(var e in events){if(events[_0xeade('0x8')](e)){var event=events[e];Dashboard[_0xeade('0x9')](e,emitEvent(event));}}module[_0xeade('0xa')]=DashboardEvents; \ No newline at end of file +var _0x0c17=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update'];(function(_0x5d3bac,_0x2eb657){var _0x2c8242=function(_0x5047f0){while(--_0x5047f0){_0x5d3bac['push'](_0x5d3bac['shift']());}};_0x2c8242(++_0x2eb657);}(_0x0c17,0x9a));var _0x70c1=function(_0x4f98f2,_0x35d270){_0x4f98f2=_0x4f98f2-0x0;var _0x595a12=_0x0c17[_0x4f98f2];return _0x595a12;};'use strict';var EventEmitter=require(_0x70c1('0x0'));var Dashboard=require(_0x70c1('0x1'))['db'][_0x70c1('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x70c1('0x3')](0x0);var events={'afterCreate':_0x70c1('0x4'),'afterUpdate':_0x70c1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x28e562){return function(_0x420e87,_0x2ccb31,_0x339200){DashboardEvents[_0x70c1('0x6')](_0x28e562+':'+_0x420e87['id'],_0x420e87);DashboardEvents[_0x70c1('0x6')](_0x28e562,_0x420e87);_0x339200(null);};}for(var e in events){if(events[_0x70c1('0x7')](e)){var event=events[e];Dashboard[_0x70c1('0x8')](e,emitEvent(event));}}module[_0x70c1('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 8e4d1f4..ad9aba5 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 _0x912a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash'];(function(_0x37308e,_0xbfbcd5){var _0x5a02fe=function(_0x4cab11){while(--_0x4cab11){_0x37308e['push'](_0x37308e['shift']());}};_0x5a02fe(++_0xbfbcd5);}(_0x912a,0x125));var _0xa912=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x912a[_0x1e3671];return _0x48d5f5;};'use strict';var _=require(_0xa912('0x0'));var util=require('util');var logger=require(_0xa912('0x1'))(_0xa912('0x2'));var moment=require(_0xa912('0x3'));var BPromise=require(_0xa912('0x4'));var rp=require(_0xa912('0x5'));var fs=require('fs');var path=require(_0xa912('0x6'));var rimraf=require(_0xa912('0x7'));var config=require(_0xa912('0x8'));var attributes=require(_0xa912('0x9'));module[_0xa912('0xa')]=function(_0x3aba18,_0x4a943a){return _0x3aba18[_0xa912('0xb')](_0xa912('0xc'),attributes,{'tableName':_0xa912('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe80f=['api','bluebird','request-promise','path','rimraf','./dashboard.attributes','define','Dashboard','lodash','util','../../config/logger'];(function(_0x5d04ee,_0x2a38ca){var _0x4a666a=function(_0x1883e4){while(--_0x1883e4){_0x5d04ee['push'](_0x5d04ee['shift']());}};_0x4a666a(++_0x2a38ca);}(_0xe80f,0x6b));var _0xfe80=function(_0x49c84d,_0x37ebbd){_0x49c84d=_0x49c84d-0x0;var _0x30fe66=_0xe80f[_0x49c84d];return _0x30fe66;};'use strict';var _=require(_0xfe80('0x0'));var util=require(_0xfe80('0x1'));var logger=require(_0xfe80('0x2'))(_0xfe80('0x3'));var moment=require('moment');var BPromise=require(_0xfe80('0x4'));var rp=require(_0xfe80('0x5'));var fs=require('fs');var path=require(_0xfe80('0x6'));var rimraf=require(_0xfe80('0x7'));var config=require('../../config/environment');var attributes=require(_0xfe80('0x8'));module['exports']=function(_0x387e02,_0x198b43){return _0x387e02[_0xfe80('0x9')](_0xfe80('0xa'),attributes,{'tableName':'dashboards','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 50783a3..ea4e146 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 _0xb8ab=['Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','then','info'];(function(_0x1afabf,_0x56fdcc){var _0x497ff1=function(_0x2f6104){while(--_0x2f6104){_0x1afabf['push'](_0x1afabf['shift']());}};_0x497ff1(++_0x56fdcc);}(_0xb8ab,0x1ea));var _0xbb8a=function(_0x2d0efc,_0x513420){_0x2d0efc=_0x2d0efc-0x0;var _0xcef0f0=_0xb8ab[_0x2d0efc];return _0xcef0f0;};'use strict';var _=require(_0xbb8a('0x0'));var util=require('util');var moment=require(_0xbb8a('0x1'));var BPromise=require('bluebird');var rs=require(_0xbb8a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb8a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb8a('0x4'))(_0xbb8a('0x5'));var config=require(_0xbb8a('0x6'));var jayson=require(_0xbb8a('0x7'));var client=jayson[_0xbb8a('0x8')][_0xbb8a('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbb8a('0xa')],{'host':_0xbb8a('0xb'),'port':0x18eb});var socket=require(_0xbb8a('0xc'))(new Redis(config[_0xbb8a('0xa')]));require(_0xbb8a('0xd'))['register'](socket);function respondWithRpcPromise(_0xbcdd6e,_0x6a7048,_0x3ca139){return new BPromise(function(_0x3a4909,_0x5b8ce4){return client['request'](_0xbcdd6e,_0x3ca139)[_0xbb8a('0xe')](function(_0x394f84){logger[_0xbb8a('0xf')](_0xbb8a('0x10'),_0x6a7048,_0xbb8a('0x11'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x6a7048,_0xbb8a('0x11'),JSON[_0xbb8a('0x12')](_0x394f84));if(_0x394f84[_0xbb8a('0x13')]){if(_0x394f84[_0xbb8a('0x13')]['code']===0x1f4){logger[_0xbb8a('0x13')](_0xbb8a('0x10'),_0x6a7048,_0x394f84[_0xbb8a('0x13')][_0xbb8a('0x14')]);return _0x5b8ce4(_0x394f84[_0xbb8a('0x13')]['message']);}logger[_0xbb8a('0x13')](_0xbb8a('0x10'),_0x6a7048,_0x394f84[_0xbb8a('0x13')][_0xbb8a('0x14')]);return _0x3a4909(_0x394f84[_0xbb8a('0x13')][_0xbb8a('0x14')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x6a7048,_0xbb8a('0x11'));_0x3a4909(_0x394f84[_0xbb8a('0x15')]['message']);}})['catch'](function(_0x585c50){logger[_0xbb8a('0x13')](_0xbb8a('0x10'),_0x6a7048,_0x585c50);_0x5b8ce4(_0x585c50);});});} \ No newline at end of file +var _0xc09f=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4e1e3d,_0x22d682){var _0x76eba4=function(_0x4a824a){while(--_0x4a824a){_0x4e1e3d['push'](_0x4e1e3d['shift']());}};_0x76eba4(++_0x22d682);}(_0xc09f,0xe4));var _0xfc09=function(_0x59522a,_0x14d1e5){_0x59522a=_0x59522a-0x0;var _0x30f09d=_0xc09f[_0x59522a];return _0x30f09d;};'use strict';var _=require(_0xfc09('0x0'));var util=require(_0xfc09('0x1'));var moment=require('moment');var BPromise=require(_0xfc09('0x2'));var rs=require(_0xfc09('0x3'));var fs=require('fs');var Redis=require(_0xfc09('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc09('0x5'));var logger=require('../../config/logger')(_0xfc09('0x6'));var config=require(_0xfc09('0x7'));var jayson=require(_0xfc09('0x8'));var client=jayson[_0xfc09('0x9')]['http']({'port':0x232a});config[_0xfc09('0xa')]=_[_0xfc09('0xb')](config[_0xfc09('0xa')],{'host':_0xfc09('0xc'),'port':0x18eb});var socket=require(_0xfc09('0xd'))(new Redis(config[_0xfc09('0xa')]));require(_0xfc09('0xe'))[_0xfc09('0xf')](socket);function respondWithRpcPromise(_0x3afa04,_0x4304e8,_0x43e3fc){return new BPromise(function(_0x4bffce,_0x1eac43){return client[_0xfc09('0x10')](_0x3afa04,_0x43e3fc)['then'](function(_0x4bdde5){logger[_0xfc09('0x11')](_0xfc09('0x12'),_0x4304e8,_0xfc09('0x13'));logger[_0xfc09('0x14')](_0xfc09('0x15'),_0x4304e8,'request\x20sent',JSON[_0xfc09('0x16')](_0x4bdde5));if(_0x4bdde5[_0xfc09('0x17')]){if(_0x4bdde5['error']['code']===0x1f4){logger[_0xfc09('0x17')](_0xfc09('0x12'),_0x4304e8,_0x4bdde5[_0xfc09('0x17')]['message']);return _0x1eac43(_0x4bdde5[_0xfc09('0x17')][_0xfc09('0x18')]);}logger[_0xfc09('0x17')](_0xfc09('0x12'),_0x4304e8,_0x4bdde5[_0xfc09('0x17')][_0xfc09('0x18')]);return _0x4bffce(_0x4bdde5[_0xfc09('0x17')][_0xfc09('0x18')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x4304e8,_0xfc09('0x13'));_0x4bffce(_0x4bdde5[_0xfc09('0x19')][_0xfc09('0x18')]);}})['catch'](function(_0x26952){logger[_0xfc09('0x17')](_0xfc09('0x12'),_0x4304e8,_0x26952);_0x1eac43(_0x26952);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 5c8f1e6..7d840ff 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 _0xbf35=['./dashboard.events','save','update','removeListener','register','length','dashboard:'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbf35,0xfc));var _0x5bf3=function(_0x3c0387,_0x122f61){_0x3c0387=_0x3c0387-0x0;var _0x350727=_0xbf35[_0x3c0387];return _0x350727;};'use strict';var DashboardEvents=require(_0x5bf3('0x0'));var events=[_0x5bf3('0x1'),'remove',_0x5bf3('0x2')];function createListener(_0x223100,_0x237d35){return function(_0x497432){_0x237d35['emit'](_0x223100,_0x497432);};}function removeListener(_0x2e10f6,_0x364017){return function(){DashboardEvents[_0x5bf3('0x3')](_0x2e10f6,_0x364017);};}exports[_0x5bf3('0x4')]=function(_0x965017){for(var _0x18c7af=0x0,_0x6ef85d=events[_0x5bf3('0x5')];_0x18c7af<_0x6ef85d;_0x18c7af++){var _0x4aa084=events[_0x18c7af];var _0x266d61=createListener(_0x5bf3('0x6')+_0x4aa084,_0x965017);DashboardEvents['on'](_0x4aa084,_0x266d61);}}; \ No newline at end of file +var _0xc1b0=['update','emit','removeListener','length','dashboard:','./dashboard.events','save','remove'];(function(_0x10f6f0,_0x43c1ac){var _0x20ec46=function(_0x3b79b1){while(--_0x3b79b1){_0x10f6f0['push'](_0x10f6f0['shift']());}};_0x20ec46(++_0x43c1ac);}(_0xc1b0,0x15d));var _0x0c1b=function(_0x2f1343,_0x59bd6a){_0x2f1343=_0x2f1343-0x0;var _0x2d8268=_0xc1b0[_0x2f1343];return _0x2d8268;};'use strict';var DashboardEvents=require(_0x0c1b('0x0'));var events=[_0x0c1b('0x1'),_0x0c1b('0x2'),_0x0c1b('0x3')];function createListener(_0x5b2d9a,_0x11e8c5){return function(_0x378f3e){_0x11e8c5[_0x0c1b('0x4')](_0x5b2d9a,_0x378f3e);};}function removeListener(_0xd64434,_0x2b5092){return function(){DashboardEvents[_0x0c1b('0x5')](_0xd64434,_0x2b5092);};}exports['register']=function(_0x201fad){for(var _0x53d73b=0x0,_0x183191=events[_0x0c1b('0x6')];_0x53d73b<_0x183191;_0x53d73b++){var _0x123206=events[_0x53d73b];var _0x5c4cd9=createListener(_0x0c1b('0x7')+_0x123206,_0x201fad);DashboardEvents['on'](_0x123206,_0x5c4cd9);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2420f0e..06c21a4 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 _0x008c=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','getItems','post','/:id/clone','/:id/items','addItem','put','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x579668,_0x2731b4){var _0x7428e3=function(_0x7c7b5){while(--_0x7c7b5){_0x579668['push'](_0x579668['shift']());}};_0x7428e3(++_0x2731b4);}(_0x008c,0x188));var _0xc008=function(_0x287aba,_0x2b05a3){_0x287aba=_0x287aba-0x0;var _0x25d2ea=_0x008c[_0x287aba];return _0x25d2ea;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/items',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['clone']);router[_0xc008('0xe')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')](_0xc008('0x13'),auth[_0xc008('0xb')](),controller['update']);router['delete'](_0xc008('0x13'),auth['isAuthenticated'](),controller[_0xc008('0x14')]);module[_0xc008('0x15')]=router; \ No newline at end of file +var _0xbd50=['create','/:id/clone','post','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','/:id/items','getItems'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbd50,0x196));var _0x0bd5=function(_0x562ec2,_0x33932b){_0x562ec2=_0x562ec2-0x0;var _0xd3a205=_0xbd50[_0x562ec2];return _0xd3a205;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['show']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['post'](_0x0bd5('0xf'),auth[_0x0bd5('0x8')](),controller['clone']);router[_0x0bd5('0x10')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['addItem']);router[_0x0bd5('0x11')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x12')]);router[_0x0bd5('0x13')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index e272883..ecb4212 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 _0xd957=['parse','attrs','setDataValue','INTEGER','sequelize','exports','STRING','TEXT','long'];(function(_0x38b643,_0x14dc0d){var _0x23cf24=function(_0x39e013){while(--_0x39e013){_0x38b643['push'](_0x38b643['shift']());}};_0x23cf24(++_0x14dc0d);}(_0xd957,0x17e));var _0x7d95=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd957[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x7d95('0x0'));var squel=require('squel');var _=require('lodash');module[_0x7d95('0x1')]={'title':{'type':Sequelize[_0x7d95('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7d95('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7d95('0x3')](_0x7d95('0x4')),'get':function(){try{return JSON[_0x7d95('0x5')](this['getDataValue'](_0x7d95('0x6')));}catch(_0x5c3511){return[];}},'set':function(_0x1c66b5){try{this[_0x7d95('0x7')](_0x7d95('0x6'),JSON['stringify'](_0x1c66b5));}catch(_0x4be2e0){this[_0x7d95('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x7d95('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7d95('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7d95('0x8')]},'col':{'type':Sequelize[_0x7d95('0x8')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7d95('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7d95('0x2')]},'titleFontSize':{'type':Sequelize[_0x7d95('0x8')],'defaultValue':0xc}}; \ No newline at end of file +var _0xd212=['lodash','exports','STRING','TEXT','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x274797,_0x56be87){var _0x5671b3=function(_0x5638fe){while(--_0x5638fe){_0x274797['push'](_0x274797['shift']());}};_0x5671b3(++_0x56be87);}(_0xd212,0x143));var _0x2d21=function(_0x2abf7f,_0x23b05a){_0x2abf7f=_0x2abf7f-0x0;var _0x248bce=_0xd212[_0x2abf7f];return _0x248bce;};'use strict';var Sequelize=require(_0x2d21('0x0'));var squel=require('squel');var _=require(_0x2d21('0x1'));module[_0x2d21('0x2')]={'title':{'type':Sequelize[_0x2d21('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x2d21('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x2d21('0x4')]('long'),'get':function(){try{return JSON['parse'](this[_0x2d21('0x5')](_0x2d21('0x6')));}catch(_0x50010e){return[];}},'set':function(_0x312c7e){try{this[_0x2d21('0x7')](_0x2d21('0x6'),JSON['stringify'](_0x312c7e));}catch(_0xf61aa4){this[_0x2d21('0x7')](_0x2d21('0x6'),JSON[_0x2d21('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x2d21('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x2d21('0x9')]},'col':{'type':Sequelize[_0x2d21('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2d21('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x2d21('0x3')],'allowNull':![],'defaultValue':_0x2d21('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x2d21('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 bd005ec..2403466 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 _0x8ff4=['total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','body','create','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','merge','options','DashboardItem','find','catch','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric'];(function(_0x457fd1,_0x1ff7dd){var _0x455839=function(_0xf63390){while(--_0xf63390){_0x457fd1['push'](_0x457fd1['shift']());}};_0x455839(++_0x1ff7dd);}(_0x8ff4,0x11f));var _0x48ff=function(_0x3b9570,_0x4ead31){_0x3b9570=_0x3b9570-0x0;var _0x28acdd=_0x8ff4[_0x3b9570];return _0x28acdd;};'use strict';var pdf=require(_0x48ff('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x48ff('0x1'));var jsonpatch=require(_0x48ff('0x2'));var rp=require('request-promise');var moment=require(_0x48ff('0x3'));var BPromise=require(_0x48ff('0x4'));var Mustache=require(_0x48ff('0x5'));var util=require(_0x48ff('0x6'));var path=require(_0x48ff('0x7'));var sox=require(_0x48ff('0x8'));var csv=require(_0x48ff('0x9'));var ejs=require(_0x48ff('0xa'));var fs=require('fs');var fs_extra=require(_0x48ff('0xb'));var _=require(_0x48ff('0xc'));var squel=require(_0x48ff('0xd'));var crypto=require(_0x48ff('0xe'));var jsforce=require(_0x48ff('0xf'));var deskjs=require(_0x48ff('0x10'));var toCsv=require('to-csv');var querystring=require(_0x48ff('0x11'));var Papa=require(_0x48ff('0x12'));var Redis=require('ioredis');var authService=require(_0x48ff('0x13'));var qs=require(_0x48ff('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48ff('0x15'));var logger=require(_0x48ff('0x16'))('api');var utils=require(_0x48ff('0x17'));var config=require(_0x48ff('0x18'));var licenseUtil=require(_0x48ff('0x19'));var db=require(_0x48ff('0x1a'))['db'];config[_0x48ff('0x1b')]=_[_0x48ff('0x1c')](config[_0x48ff('0x1b')],{'host':_0x48ff('0x1d'),'port':0x18eb});var socket=require(_0x48ff('0x1e'))(new Redis(config[_0x48ff('0x1b')]));require(_0x48ff('0x1f'))[_0x48ff('0x20')](socket);function respondWithStatusCode(_0x4eb8dd,_0x71ca07){_0x71ca07=_0x71ca07||0xcc;return function(_0x5b2696){if(_0x5b2696){return _0x4eb8dd[_0x48ff('0x21')](_0x71ca07);}return _0x4eb8dd[_0x48ff('0x22')](_0x71ca07)['end']();};}function respondWithResult(_0x265e6e,_0x2f8d8a){_0x2f8d8a=_0x2f8d8a||0xc8;return function(_0x637378){if(_0x637378){return _0x265e6e['status'](_0x2f8d8a)[_0x48ff('0x23')](_0x637378);}};}function respondWithFilteredResult(_0x3dad8e,_0x563821){return function(_0x29012c){if(_0x29012c){var _0x3c3728=_0x29012c['count'],_0x5d310a=_0x563821[_0x48ff('0x24')],_0x24d4fb=_0x563821[_0x48ff('0x24')]+_0x563821[_0x48ff('0x25')],_0xdf042d;if(_0x24d4fb>=_0x3c3728){_0x24d4fb=_0x3c3728;_0xdf042d=0xc8;}else{_0xdf042d=0xce;}_0x3dad8e['status'](_0xdf042d);return _0x3dad8e['set'](_0x48ff('0x26'),_0x5d310a+'-'+_0x24d4fb+'/'+_0x3c3728)['json'](_0x29012c);}return null;};}function patchUpdates(_0x7d9299){return function(_0x3541cd){try{jsonpatch[_0x48ff('0x27')](_0x3541cd,_0x7d9299,!![]);}catch(_0x16582b){return BPromise[_0x48ff('0x28')](_0x16582b);}return _0x3541cd[_0x48ff('0x29')]();};}function saveUpdates(_0x1ba41e,_0x2a1ab8){return function(_0x540eea){if(_0x540eea){return _0x540eea[_0x48ff('0x2a')](_0x1ba41e)[_0x48ff('0x2b')](function(_0x5166ee){return _0x5166ee;});}return null;};}function removeEntity(_0x421c11,_0x15551d){return function(_0xd7b9b2){if(_0xd7b9b2){return _0xd7b9b2[_0x48ff('0x2c')]()[_0x48ff('0x2b')](function(){_0x421c11[_0x48ff('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fc525,_0x38167f){return function(_0x50b27c){if(!_0x50b27c){_0x3fc525[_0x48ff('0x21')](0x194);}return _0x50b27c;};}function handleError(_0x179a7f,_0x39088f){_0x39088f=_0x39088f||0x1f4;return function(_0xb3da23){logger[_0x48ff('0x2d')](_0xb3da23[_0x48ff('0x2e')]);if(_0xb3da23[_0x48ff('0x2f')]){delete _0xb3da23[_0x48ff('0x2f')];}_0x179a7f[_0x48ff('0x22')](_0x39088f)[_0x48ff('0x30')](_0xb3da23);};}exports[_0x48ff('0x31')]=function(_0x4d45fd,_0x34def7){var _0x360acd={'raw':![],'where':{'id':_0x4d45fd[_0x48ff('0x32')]['id']}},_0xcc79c3={};_0xcc79c3['model']=_[_0x48ff('0x33')](db['DashboardItem'][_0x48ff('0x34')]);_0xcc79c3['query']=_[_0x48ff('0x33')](_0x4d45fd[_0x48ff('0x35')]);_0xcc79c3[_0x48ff('0x36')]=_[_0x48ff('0x37')](_0xcc79c3[_0x48ff('0x38')],_0xcc79c3[_0x48ff('0x35')]);_0x360acd['attributes']=_[_0x48ff('0x37')](_0xcc79c3[_0x48ff('0x38')],qs[_0x48ff('0x39')](_0x4d45fd[_0x48ff('0x35')][_0x48ff('0x39')]));_0x360acd[_0x48ff('0x3a')]=_0x360acd[_0x48ff('0x3a')]['length']?_0x360acd[_0x48ff('0x3a')]:_0xcc79c3[_0x48ff('0x38')];if(_0x4d45fd['query'][_0x48ff('0x3b')]){_0x360acd[_0x48ff('0x3c')]=[{'all':!![]}];}_0x360acd=_[_0x48ff('0x3d')]({},_0x360acd,_0x4d45fd[_0x48ff('0x3e')]);return db[_0x48ff('0x3f')][_0x48ff('0x40')](_0x360acd)[_0x48ff('0x2b')](handleEntityNotFound(_0x34def7,null))[_0x48ff('0x2b')](respondWithResult(_0x34def7,null))[_0x48ff('0x41')](handleError(_0x34def7,null));};exports[_0x48ff('0x2c')]=function(_0x393820,_0x23d70f){return db[_0x48ff('0x3f')][_0x48ff('0x40')]({'where':{'id':_0x393820['params']['id']}})[_0x48ff('0x2b')](handleEntityNotFound(_0x23d70f,null))[_0x48ff('0x2b')](removeEntity(_0x23d70f,null))[_0x48ff('0x41')](handleError(_0x23d70f,null));};function widgetAttributes(_0x32e7dc){try{switch(_0x32e7dc['type']){case'iframe':return[{'name':_0x48ff('0x42'),'value':_0x32e7dc['attrUrl']||(_0x32e7dc['attrs']&&_0x32e7dc[_0x48ff('0x43')][0x0]?_0x32e7dc[_0x48ff('0x43')][0x0][_0x48ff('0x44')]:undefined)||_0x48ff('0x45')}];case'custom':return[{'name':_0x48ff('0x46'),'value':_0x32e7dc[_0x48ff('0x46')]||(_0x32e7dc['attrs']&&_0x32e7dc[_0x48ff('0x43')][0x0]?_0x32e7dc[_0x48ff('0x43')][0x0]['value']:undefined)||''}];case _0x48ff('0x47'):return[{'name':'attrHourFormat','value':_0x32e7dc[_0x48ff('0x48')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x0]?_0x32e7dc[_0x48ff('0x43')][0x0][_0x48ff('0x44')]:undefined)||'HH:mm:ss'},{'name':_0x48ff('0x49'),'value':_0x32e7dc['attrTimezone']||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x1]?_0x32e7dc['attrs'][0x1]['value']:undefined)||_0x48ff('0x4a')},{'name':'attrFontSize','value':_0x32e7dc[_0x48ff('0x4b')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x2]?_0x32e7dc[_0x48ff('0x43')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x48ff('0x4c'),'value':_0x32e7dc[_0x48ff('0x4c')]||(_0x32e7dc['attrs']&&_0x32e7dc[_0x48ff('0x43')][0x0]?_0x32e7dc[_0x48ff('0x43')][0x0][_0x48ff('0x44')]:undefined)||_0x48ff('0x4d')},{'name':_0x48ff('0x4e'),'value':_0x32e7dc[_0x48ff('0x4e')]||(_0x32e7dc['attrs']&&_0x32e7dc[_0x48ff('0x43')][0x1]?_0x32e7dc[_0x48ff('0x43')][0x1][_0x48ff('0x44')]:undefined)||[]},{'name':'attrFontSize','value':_0x32e7dc[_0x48ff('0x4b')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x2]?_0x32e7dc['attrs'][0x2][_0x48ff('0x44')]:undefined)||0x14}];case _0x48ff('0x4f'):case _0x48ff('0x50'):return[{'name':_0x48ff('0x51'),'value':_0x32e7dc[_0x48ff('0x51')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc['attrs'][0x0]?_0x32e7dc['attrs'][0x0][_0x48ff('0x44')]:undefined)||_0x48ff('0x4d')},{'name':'attrSerie2','value':_0x32e7dc['attrSerie2']||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x1]?_0x32e7dc[_0x48ff('0x43')][0x1]['value']:undefined)||null},{'name':_0x48ff('0x52'),'value':_0x32e7dc['attrSerie3']||(_0x32e7dc['attrs']&&_0x32e7dc[_0x48ff('0x43')][0x2]?_0x32e7dc[_0x48ff('0x43')][0x2][_0x48ff('0x44')]:undefined)||null},{'name':_0x48ff('0x4e'),'value':_0x32e7dc[_0x48ff('0x4e')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x3]?_0x32e7dc[_0x48ff('0x43')][0x3]['value']:undefined)||[]}];case _0x48ff('0x53'):return[{'name':_0x48ff('0x54'),'type':_0x32e7dc[_0x48ff('0x55')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc['attrs'][0x0]?_0x32e7dc['attrs'][0x0][_0x48ff('0x56')]:undefined)||null,'value':_0x32e7dc[_0x48ff('0x54')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x0]?_0x32e7dc['attrs'][0x0][_0x48ff('0x44')]:undefined)||null},{'name':_0x48ff('0x57'),'value':_0x32e7dc[_0x48ff('0x57')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x1]?_0x32e7dc[_0x48ff('0x43')][0x1][_0x48ff('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x3826b0){logger[_0x48ff('0x2d')](_0x48ff('0x58'),JSON['stringify'](_0x3826b0));return[];}}exports['create']=function(_0x43ecc7,_0x4ea6b1){if(_0x43ecc7[_0x48ff('0x59')]){_0x43ecc7['body'][_0x48ff('0x43')]=widgetAttributes(_0x43ecc7['body']);}return db[_0x48ff('0x3f')][_0x48ff('0x5a')](_0x43ecc7['body'],{})['then'](respondWithResult(_0x4ea6b1,0xc9))['catch'](handleError(_0x4ea6b1,null));};exports[_0x48ff('0x2a')]=function(_0xcd61f,_0x43470c){if(_0xcd61f[_0x48ff('0x59')]['id']){delete _0xcd61f[_0x48ff('0x59')]['id'];}_0xcd61f[_0x48ff('0x59')][_0x48ff('0x43')]=widgetAttributes(_0xcd61f[_0x48ff('0x59')]);return db['DashboardItem'][_0x48ff('0x40')]({'where':{'id':_0xcd61f[_0x48ff('0x32')]['id']}})[_0x48ff('0x2b')](handleEntityNotFound(_0x43470c,null))[_0x48ff('0x2b')](saveUpdates(_0xcd61f[_0x48ff('0x59')],null))[_0x48ff('0x2b')](respondWithResult(_0x43470c,null))[_0x48ff('0x41')](handleError(_0x43470c,null));}; \ No newline at end of file +var _0xeae6=['custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','params','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','https://'];(function(_0x39f36c,_0x13179e){var _0x180120=function(_0x4fa074){while(--_0x4fa074){_0x39f36c['push'](_0x39f36c['shift']());}};_0x180120(++_0x13179e);}(_0xeae6,0xc3));var _0x6eae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeae6[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x6eae('0x0'));var emlformat=require(_0x6eae('0x1'));var rimraf=require(_0x6eae('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6eae('0x3'));var moment=require('moment');var BPromise=require(_0x6eae('0x4'));var Mustache=require(_0x6eae('0x5'));var util=require(_0x6eae('0x6'));var path=require(_0x6eae('0x7'));var sox=require(_0x6eae('0x8'));var csv=require(_0x6eae('0x9'));var ejs=require(_0x6eae('0xa'));var fs=require('fs');var fs_extra=require(_0x6eae('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6eae('0xc'));var jsforce=require(_0x6eae('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6eae('0x9'));var querystring=require(_0x6eae('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6eae('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6eae('0x10'))(_0x6eae('0x11'));var utils=require('../../config/utils');var config=require(_0x6eae('0x12'));var licenseUtil=require(_0x6eae('0x13'));var db=require(_0x6eae('0x14'))['db'];config[_0x6eae('0x15')]=_[_0x6eae('0x16')](config[_0x6eae('0x15')],{'host':_0x6eae('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6eae('0x15')]));require(_0x6eae('0x18'))[_0x6eae('0x19')](socket);function respondWithStatusCode(_0x275024,_0x18c008){_0x18c008=_0x18c008||0xcc;return function(_0x3828a4){if(_0x3828a4){return _0x275024[_0x6eae('0x1a')](_0x18c008);}return _0x275024[_0x6eae('0x1b')](_0x18c008)[_0x6eae('0x1c')]();};}function respondWithResult(_0x18cb2d,_0x36b0fd){_0x36b0fd=_0x36b0fd||0xc8;return function(_0x309190){if(_0x309190){return _0x18cb2d[_0x6eae('0x1b')](_0x36b0fd)[_0x6eae('0x1d')](_0x309190);}};}function respondWithFilteredResult(_0x2c0752,_0x455a62){return function(_0x46ddc6){if(_0x46ddc6){var _0x220e49=_0x46ddc6[_0x6eae('0x1e')],_0x1d50d2=_0x455a62[_0x6eae('0x1f')],_0x227e4d=_0x455a62[_0x6eae('0x1f')]+_0x455a62[_0x6eae('0x20')],_0x3b1803;if(_0x227e4d>=_0x220e49){_0x227e4d=_0x220e49;_0x3b1803=0xc8;}else{_0x3b1803=0xce;}_0x2c0752[_0x6eae('0x1b')](_0x3b1803);return _0x2c0752[_0x6eae('0x21')](_0x6eae('0x22'),_0x1d50d2+'-'+_0x227e4d+'/'+_0x220e49)['json'](_0x46ddc6);}return null;};}function patchUpdates(_0x2ca50c){return function(_0x2225a1){try{jsonpatch[_0x6eae('0x23')](_0x2225a1,_0x2ca50c,!![]);}catch(_0x15991f){return BPromise[_0x6eae('0x24')](_0x15991f);}return _0x2225a1[_0x6eae('0x25')]();};}function saveUpdates(_0x5a43c1,_0x1d89c4){return function(_0x3d2b0a){if(_0x3d2b0a){return _0x3d2b0a[_0x6eae('0x26')](_0x5a43c1)[_0x6eae('0x27')](function(_0x39e6d0){return _0x39e6d0;});}return null;};}function removeEntity(_0x4468db,_0x4367eb){return function(_0x156fb2){if(_0x156fb2){return _0x156fb2[_0x6eae('0x28')]()[_0x6eae('0x27')](function(){_0x4468db['status'](0xcc)[_0x6eae('0x1c')]();});}};}function handleEntityNotFound(_0x1e7d0f,_0x4cc829){return function(_0x12a641){if(!_0x12a641){_0x1e7d0f['sendStatus'](0x194);}return _0x12a641;};}function handleError(_0x88c67,_0x5d9d0f){_0x5d9d0f=_0x5d9d0f||0x1f4;return function(_0xc6fee5){logger[_0x6eae('0x29')](_0xc6fee5[_0x6eae('0x2a')]);if(_0xc6fee5[_0x6eae('0x2b')]){delete _0xc6fee5[_0x6eae('0x2b')];}_0x88c67[_0x6eae('0x1b')](_0x5d9d0f)['send'](_0xc6fee5);};}exports['show']=function(_0x41b30e,_0x59eaed){var _0x592710={'raw':![],'where':{'id':_0x41b30e['params']['id']}},_0x20ea6a={};_0x20ea6a[_0x6eae('0x2c')]=_[_0x6eae('0x2d')](db['DashboardItem']['rawAttributes']);_0x20ea6a[_0x6eae('0x2e')]=_['keys'](_0x41b30e[_0x6eae('0x2e')]);_0x20ea6a[_0x6eae('0x2f')]=_[_0x6eae('0x30')](_0x20ea6a[_0x6eae('0x2c')],_0x20ea6a[_0x6eae('0x2e')]);_0x592710[_0x6eae('0x31')]=_[_0x6eae('0x30')](_0x20ea6a['model'],qs[_0x6eae('0x32')](_0x41b30e[_0x6eae('0x2e')][_0x6eae('0x32')]));_0x592710[_0x6eae('0x31')]=_0x592710[_0x6eae('0x31')][_0x6eae('0x33')]?_0x592710[_0x6eae('0x31')]:_0x20ea6a['model'];if(_0x41b30e[_0x6eae('0x2e')][_0x6eae('0x34')]){_0x592710[_0x6eae('0x35')]=[{'all':!![]}];}_0x592710=_['merge']({},_0x592710,_0x41b30e['options']);return db[_0x6eae('0x36')][_0x6eae('0x37')](_0x592710)['then'](handleEntityNotFound(_0x59eaed,null))[_0x6eae('0x27')](respondWithResult(_0x59eaed,null))[_0x6eae('0x38')](handleError(_0x59eaed,null));};exports[_0x6eae('0x28')]=function(_0x49c943,_0x344d78){return db[_0x6eae('0x36')][_0x6eae('0x37')]({'where':{'id':_0x49c943['params']['id']}})['then'](handleEntityNotFound(_0x344d78,null))['then'](removeEntity(_0x344d78,null))['catch'](handleError(_0x344d78,null));};function widgetAttributes(_0x11c19d){try{switch(_0x11c19d[_0x6eae('0x39')]){case _0x6eae('0x3a'):return[{'name':_0x6eae('0x3b'),'value':_0x11c19d[_0x6eae('0x3b')]||(_0x11c19d[_0x6eae('0x3c')]&&_0x11c19d[_0x6eae('0x3c')][0x0]?_0x11c19d['attrs'][0x0][_0x6eae('0x3d')]:undefined)||_0x6eae('0x3e')}];case _0x6eae('0x3f'):return[{'name':_0x6eae('0x40'),'value':_0x11c19d[_0x6eae('0x40')]||(_0x11c19d['attrs']&&_0x11c19d['attrs'][0x0]?_0x11c19d[_0x6eae('0x3c')][0x0][_0x6eae('0x3d')]:undefined)||''}];case _0x6eae('0x41'):return[{'name':_0x6eae('0x42'),'value':_0x11c19d[_0x6eae('0x42')]||(_0x11c19d[_0x6eae('0x3c')]&&_0x11c19d[_0x6eae('0x3c')][0x0]?_0x11c19d[_0x6eae('0x3c')][0x0][_0x6eae('0x3d')]:undefined)||_0x6eae('0x43')},{'name':_0x6eae('0x44'),'value':_0x11c19d['attrTimezone']||(_0x11c19d[_0x6eae('0x3c')]&&_0x11c19d[_0x6eae('0x3c')][0x1]?_0x11c19d['attrs'][0x1][_0x6eae('0x3d')]:undefined)||'0.00'},{'name':_0x6eae('0x45'),'value':_0x11c19d[_0x6eae('0x45')]||(_0x11c19d['attrs']&&_0x11c19d['attrs'][0x2]?_0x11c19d[_0x6eae('0x3c')][0x2][_0x6eae('0x3d')]:undefined)||0xc}];case _0x6eae('0x46'):return[{'name':_0x6eae('0x47'),'value':_0x11c19d[_0x6eae('0x47')]||(_0x11c19d[_0x6eae('0x3c')]&&_0x11c19d[_0x6eae('0x3c')][0x0]?_0x11c19d['attrs'][0x0][_0x6eae('0x3d')]:undefined)||_0x6eae('0x48')},{'name':_0x6eae('0x49'),'value':_0x11c19d[_0x6eae('0x49')]||(_0x11c19d[_0x6eae('0x3c')]&&_0x11c19d[_0x6eae('0x3c')][0x1]?_0x11c19d['attrs'][0x1][_0x6eae('0x3d')]:undefined)||[]},{'name':'attrFontSize','value':_0x11c19d[_0x6eae('0x45')]||(_0x11c19d[_0x6eae('0x3c')]&&_0x11c19d[_0x6eae('0x3c')][0x2]?_0x11c19d[_0x6eae('0x3c')][0x2][_0x6eae('0x3d')]:undefined)||0x14}];case'multibar-chart':case _0x6eae('0x4a'):return[{'name':_0x6eae('0x4b'),'value':_0x11c19d['attrSerie1']||(_0x11c19d[_0x6eae('0x3c')]&&_0x11c19d['attrs'][0x0]?_0x11c19d[_0x6eae('0x3c')][0x0]['value']:undefined)||'total'},{'name':_0x6eae('0x4c'),'value':_0x11c19d[_0x6eae('0x4c')]||(_0x11c19d[_0x6eae('0x3c')]&&_0x11c19d['attrs'][0x1]?_0x11c19d[_0x6eae('0x3c')][0x1][_0x6eae('0x3d')]:undefined)||null},{'name':'attrSerie3','value':_0x11c19d[_0x6eae('0x4d')]||(_0x11c19d[_0x6eae('0x3c')]&&_0x11c19d['attrs'][0x2]?_0x11c19d[_0x6eae('0x3c')][0x2][_0x6eae('0x3d')]:undefined)||null},{'name':_0x6eae('0x49'),'value':_0x11c19d[_0x6eae('0x49')]||(_0x11c19d['attrs']&&_0x11c19d[_0x6eae('0x3c')][0x3]?_0x11c19d[_0x6eae('0x3c')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0x6eae('0x4e'),'type':_0x11c19d[_0x6eae('0x4f')]||(_0x11c19d[_0x6eae('0x3c')]&&_0x11c19d[_0x6eae('0x3c')][0x0]?_0x11c19d[_0x6eae('0x3c')][0x0]['type']:undefined)||null,'value':_0x11c19d[_0x6eae('0x4e')]||(_0x11c19d[_0x6eae('0x3c')]&&_0x11c19d[_0x6eae('0x3c')][0x0]?_0x11c19d[_0x6eae('0x3c')][0x0][_0x6eae('0x3d')]:undefined)||null},{'name':'attrRefresh','value':_0x11c19d[_0x6eae('0x50')]||(_0x11c19d[_0x6eae('0x3c')]&&_0x11c19d[_0x6eae('0x3c')][0x1]?_0x11c19d['attrs'][0x1][_0x6eae('0x3d')]:undefined)||0x0}];default:return[];}}catch(_0x540120){logger[_0x6eae('0x29')](_0x6eae('0x51'),JSON[_0x6eae('0x52')](_0x540120));return[];}}exports['create']=function(_0x5015dd,_0x3bb9ab){if(_0x5015dd['body']){_0x5015dd['body'][_0x6eae('0x3c')]=widgetAttributes(_0x5015dd[_0x6eae('0x53')]);}return db[_0x6eae('0x36')][_0x6eae('0x54')](_0x5015dd[_0x6eae('0x53')],{})[_0x6eae('0x27')](respondWithResult(_0x3bb9ab,0xc9))['catch'](handleError(_0x3bb9ab,null));};exports['update']=function(_0x12b5cc,_0x3cdc31){if(_0x12b5cc[_0x6eae('0x53')]['id']){delete _0x12b5cc[_0x6eae('0x53')]['id'];}_0x12b5cc[_0x6eae('0x53')][_0x6eae('0x3c')]=widgetAttributes(_0x12b5cc[_0x6eae('0x53')]);return db[_0x6eae('0x36')][_0x6eae('0x37')]({'where':{'id':_0x12b5cc[_0x6eae('0x55')]['id']}})[_0x6eae('0x27')](handleEntityNotFound(_0x3cdc31,null))[_0x6eae('0x27')](saveUpdates(_0x12b5cc['body'],null))[_0x6eae('0x27')](respondWithResult(_0x3cdc31,null))[_0x6eae('0x38')](handleError(_0x3cdc31,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index c210df8..14f2dfe 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 _0xf029=['remove','emit','hook','exports','events','setMaxListeners','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf029,0x6d));var _0x9f02=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xf029[_0x4ae6ef];return _0x3cbb4e;};'use strict';var EventEmitter=require(_0x9f02('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9f02('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9f02('0x2'),'afterDestroy':_0x9f02('0x3')};function emitEvent(_0x142ef3){return function(_0x33ba1b,_0x360207,_0x24b1c5){DashboardItemEvents[_0x9f02('0x4')](_0x142ef3+':'+_0x33ba1b['id'],_0x33ba1b);DashboardItemEvents[_0x9f02('0x4')](_0x142ef3,_0x33ba1b);_0x24b1c5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x9f02('0x5')](e,emitEvent(event));}}module[_0x9f02('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x3f10=['emit','hasOwnProperty','hook','events','save','update'];(function(_0xd8c45b,_0xf93d5f){var _0x42add7=function(_0x427ae2){while(--_0x427ae2){_0xd8c45b['push'](_0xd8c45b['shift']());}};_0x42add7(++_0xf93d5f);}(_0x3f10,0x69));var _0x03f1=function(_0x173527,_0x5f4130){_0x173527=_0x173527-0x0;var _0x180287=_0x3f10[_0x173527];return _0x180287;};'use strict';var EventEmitter=require(_0x03f1('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x03f1('0x1'),'afterUpdate':_0x03f1('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4e0f36){return function(_0x49458c,_0x181f56,_0x55e4b5){DashboardItemEvents[_0x03f1('0x3')](_0x4e0f36+':'+_0x49458c['id'],_0x49458c);DashboardItemEvents[_0x03f1('0x3')](_0x4e0f36,_0x49458c);_0x55e4b5(null);};}for(var e in events){if(events[_0x03f1('0x4')](e)){var event=events[e];DashboardItem[_0x03f1('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index c4bd8bb..3acf6cd 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 _0xd295=['moment','request-promise','rimraf','../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api'];(function(_0x40ca50,_0x41472b){var _0x2c3638=function(_0xf5afdf){while(--_0xf5afdf){_0x40ca50['push'](_0x40ca50['shift']());}};_0x2c3638(++_0x41472b);}(_0xd295,0x15d));var _0x5d29=function(_0xeb3c81,_0x3a432a){_0xeb3c81=_0xeb3c81-0x0;var _0x3a7630=_0xd295[_0xeb3c81];return _0x3a7630;};'use strict';var _=require(_0x5d29('0x0'));var util=require('util');var logger=require(_0x5d29('0x1'))(_0x5d29('0x2'));var moment=require(_0x5d29('0x3'));var BPromise=require('bluebird');var rp=require(_0x5d29('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d29('0x5'));var config=require(_0x5d29('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x5d29('0x7')]=function(_0x30e17d,_0x52eea8){return _0x30e17d[_0x5d29('0x8')](_0x5d29('0x9'),attributes,{'tableName':_0x5d29('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cfa=['define','DashboardItem','../../config/logger','api','moment','bluebird','path','rimraf','./dashboardItem.attributes','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9cfa,0x106));var _0xa9cf=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9cfa[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa9cf('0x0'))(_0xa9cf('0x1'));var moment=require(_0xa9cf('0x2'));var BPromise=require(_0xa9cf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9cf('0x4'));var rimraf=require(_0xa9cf('0x5'));var config=require('../../config/environment');var attributes=require(_0xa9cf('0x6'));module[_0xa9cf('0x7')]=function(_0x4c45c3,_0x5baa27){return _0x4c45c3[_0xa9cf('0x8')](_0xa9cf('0x9'),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 4fb74ec..4c1c9ae 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 _0xc740=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register','then','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc740,0x181));var _0x0c74=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xc740[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0c74('0x0'));var util=require(_0x0c74('0x1'));var moment=require('moment');var BPromise=require(_0x0c74('0x2'));var rs=require(_0x0c74('0x3'));var fs=require('fs');var Redis=require(_0x0c74('0x4'));var db=require(_0x0c74('0x5'))['db'];var utils=require(_0x0c74('0x6'));var logger=require(_0x0c74('0x7'))(_0x0c74('0x8'));var config=require(_0x0c74('0x9'));var jayson=require(_0x0c74('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0c74('0xb')](config[_0x0c74('0xc')],{'host':_0x0c74('0xd'),'port':0x18eb});var socket=require(_0x0c74('0xe'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x0c74('0xf')](socket);function respondWithRpcPromise(_0x58e53c,_0x45b771,_0x4c564e){return new BPromise(function(_0x1ab6dd,_0x5c1594){return client['request'](_0x58e53c,_0x4c564e)[_0x0c74('0x10')](function(_0x2354b5){logger['info'](_0x0c74('0x11'),_0x45b771,_0x0c74('0x12'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x45b771,_0x0c74('0x12'),JSON[_0x0c74('0x13')](_0x2354b5));if(_0x2354b5[_0x0c74('0x14')]){if(_0x2354b5['error']['code']===0x1f4){logger['error'](_0x0c74('0x11'),_0x45b771,_0x2354b5['error'][_0x0c74('0x15')]);return _0x5c1594(_0x2354b5['error'][_0x0c74('0x15')]);}logger[_0x0c74('0x14')](_0x0c74('0x11'),_0x45b771,_0x2354b5[_0x0c74('0x14')][_0x0c74('0x15')]);return _0x1ab6dd(_0x2354b5[_0x0c74('0x14')][_0x0c74('0x15')]);}else{logger['info'](_0x0c74('0x11'),_0x45b771,_0x0c74('0x12'));_0x1ab6dd(_0x2354b5[_0x0c74('0x16')][_0x0c74('0x15')]);}})[_0x0c74('0x17')](function(_0x2b720a){logger['error']('DashboardItem,\x20%s,\x20%s',_0x45b771,_0x2b720a);_0x5c1594(_0x2b720a);});});} \ No newline at end of file +var _0x9e58=['lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0x9e58,0x73));var _0x89e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e58[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x89e5('0x0'));var util=require(_0x89e5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x89e5('0x2'));var fs=require('fs');var Redis=require(_0x89e5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x89e5('0x4'));var logger=require(_0x89e5('0x5'))(_0x89e5('0x6'));var config=require(_0x89e5('0x7'));var jayson=require(_0x89e5('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x89e5('0x9')]=_[_0x89e5('0xa')](config[_0x89e5('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x89e5('0x9')]));require(_0x89e5('0xb'))[_0x89e5('0xc')](socket);function respondWithRpcPromise(_0x10efa5,_0x4dd50,_0x1cbc32){return new BPromise(function(_0x2648ba,_0x5a6d1d){return client[_0x89e5('0xd')](_0x10efa5,_0x1cbc32)[_0x89e5('0xe')](function(_0x487402){logger[_0x89e5('0xf')](_0x89e5('0x10'),_0x4dd50,_0x89e5('0x11'));logger[_0x89e5('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4dd50,_0x89e5('0x11'),JSON['stringify'](_0x487402));if(_0x487402[_0x89e5('0x13')]){if(_0x487402[_0x89e5('0x13')]['code']===0x1f4){logger[_0x89e5('0x13')](_0x89e5('0x10'),_0x4dd50,_0x487402['error'][_0x89e5('0x14')]);return _0x5a6d1d(_0x487402['error'][_0x89e5('0x14')]);}logger[_0x89e5('0x13')]('DashboardItem,\x20%s,\x20%s',_0x4dd50,_0x487402[_0x89e5('0x13')]['message']);return _0x2648ba(_0x487402[_0x89e5('0x13')][_0x89e5('0x14')]);}else{logger[_0x89e5('0xf')]('DashboardItem,\x20%s,\x20%s',_0x4dd50,_0x89e5('0x11'));_0x2648ba(_0x487402[_0x89e5('0x15')][_0x89e5('0x14')]);}})[_0x89e5('0x16')](function(_0x5cb0b5){logger[_0x89e5('0x13')](_0x89e5('0x10'),_0x4dd50,_0x5cb0b5);_0x5a6d1d(_0x5cb0b5);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index fd821e6..0332bed 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 _0x9455=['emit','removeListener','register','length','./dashboardItem.events','save','update'];(function(_0xb2b7f5,_0x4630c6){var _0xaf55f7=function(_0x36a7a9){while(--_0x36a7a9){_0xb2b7f5['push'](_0xb2b7f5['shift']());}};_0xaf55f7(++_0x4630c6);}(_0x9455,0x1b6));var _0x5945=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9455[_0x50a0c2];return _0x5ebadd;};'use strict';var DashboardItemEvents=require(_0x5945('0x0'));var events=[_0x5945('0x1'),'remove',_0x5945('0x2')];function createListener(_0x1bcd85,_0x5aa9e1){return function(_0x467b2d){_0x5aa9e1[_0x5945('0x3')](_0x1bcd85,_0x467b2d);};}function removeListener(_0x4e7eaf,_0x3401ae){return function(){DashboardItemEvents[_0x5945('0x4')](_0x4e7eaf,_0x3401ae);};}exports[_0x5945('0x5')]=function(_0x2d68c9){for(var _0x175653=0x0,_0x481dfc=events[_0x5945('0x6')];_0x175653<_0x481dfc;_0x175653++){var _0x5d823d=events[_0x175653];var _0x461e01=createListener('dashboardItem:'+_0x5d823d,_0x2d68c9);DashboardItemEvents['on'](_0x5d823d,_0x461e01);}}; \ No newline at end of file +var _0x8fc4=['register','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x402a39,_0x53b618){var _0x57e5c4=function(_0x3a35fb){while(--_0x3a35fb){_0x402a39['push'](_0x402a39['shift']());}};_0x57e5c4(++_0x53b618);}(_0x8fc4,0xb7));var _0x48fc=function(_0x45dcc5,_0x9b2e93){_0x45dcc5=_0x45dcc5-0x0;var _0xbb0024=_0x8fc4[_0x45dcc5];return _0xbb0024;};'use strict';var DashboardItemEvents=require(_0x48fc('0x0'));var events=[_0x48fc('0x1'),_0x48fc('0x2'),_0x48fc('0x3')];function createListener(_0x55e086,_0x1292e4){return function(_0x38d180){_0x1292e4[_0x48fc('0x4')](_0x55e086,_0x38d180);};}function removeListener(_0x2849d1,_0x4b4a6f){return function(){DashboardItemEvents[_0x48fc('0x5')](_0x2849d1,_0x4b4a6f);};}exports[_0x48fc('0x6')]=function(_0x1147fb){for(var _0x158948=0x0,_0x13bed9=events[_0x48fc('0x7')];_0x158948<_0x13bed9;_0x158948++){var _0x33ceee=events[_0x158948];var _0x165495=createListener(_0x48fc('0x8')+_0x33ceee,_0x1147fb);DashboardItemEvents['on'](_0x33ceee,_0x165495);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c99e52f..2a1acf6 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 _0xcc43=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','put','update','delete','destroy'];(function(_0x166aeb,_0x5e4ee6){var _0x3969c9=function(_0x2d1a91){while(--_0x2d1a91){_0x166aeb['push'](_0x166aeb['shift']());}};_0x3969c9(++_0x5e4ee6);}(_0xcc43,0x159));var _0x3cc4=function(_0x2f3570,_0x14fcab){_0x2f3570=_0x2f3570-0x0;var _0xa87edc=_0xcc43[_0x2f3570];return _0xa87edc;};'use strict';var multer=require(_0x3cc4('0x0'));var util=require(_0x3cc4('0x1'));var path=require('path');var timeout=require(_0x3cc4('0x2'));var express=require(_0x3cc4('0x3'));var router=express[_0x3cc4('0x4')]();var fs_extra=require(_0x3cc4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3cc4('0x6'));var config=require(_0x3cc4('0x7'));var controller=require('./dashboardItem.controller');router[_0x3cc4('0x8')](_0x3cc4('0x9'),auth[_0x3cc4('0xa')](),controller['show']);router['post']('/',auth[_0x3cc4('0xa')](),controller['create']);router[_0x3cc4('0xb')](_0x3cc4('0x9'),auth[_0x3cc4('0xa')](),controller[_0x3cc4('0xc')]);router[_0x3cc4('0xd')](_0x3cc4('0x9'),auth[_0x3cc4('0xa')](),controller[_0x3cc4('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa395=['isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id'];(function(_0x29a6c7,_0x3429b5){var _0xbaa852=function(_0x4cb486){while(--_0x4cb486){_0x29a6c7['push'](_0x29a6c7['shift']());}};_0xbaa852(++_0x3429b5);}(_0xa395,0x7a));var _0x5a39=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa395[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x5a39('0x0'));var util=require(_0x5a39('0x1'));var path=require(_0x5a39('0x2'));var timeout=require(_0x5a39('0x3'));var express=require(_0x5a39('0x4'));var router=express[_0x5a39('0x5')]();var fs_extra=require(_0x5a39('0x6'));var auth=require(_0x5a39('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5a39('0x8'));var controller=require('./dashboardItem.controller');router[_0x5a39('0x9')](_0x5a39('0xa'),auth[_0x5a39('0xb')](),controller['show']);router[_0x5a39('0xc')]('/',auth['isAuthenticated'](),controller[_0x5a39('0xd')]);router[_0x5a39('0xe')](_0x5a39('0xa'),auth['isAuthenticated'](),controller[_0x5a39('0xf')]);router[_0x5a39('0x10')](_0x5a39('0xa'),auth['isAuthenticated'](),controller[_0x5a39('0x11')]);module[_0x5a39('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index e6bb274..4cddb51 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 _0x9dfc=['STRING','second','first','sequelize','exports'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x9dfc,0x1c5));var _0xc9df=function(_0x43f0c8,_0x2469f3){_0x43f0c8=_0x43f0c8-0x0;var _0x5efec4=_0x9dfc[_0x43f0c8];return _0x5efec4;};'use strict';var Sequelize=require(_0xc9df('0x0'));module[_0xc9df('0x1')]={'name':{'type':Sequelize[_0xc9df('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0xc9df('0x3'),'third'),'allowNull':![],'defaultValue':_0xc9df('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb72e=['third','first','sequelize','exports','STRING','ENUM','second'];(function(_0x590181,_0x2966d0){var _0x565b14=function(_0x3d38ed){while(--_0x3d38ed){_0x590181['push'](_0x590181['shift']());}};_0x565b14(++_0x2966d0);}(_0xb72e,0x8e));var _0xeb72=function(_0x173818,_0x135874){_0x173818=_0x173818-0x0;var _0x305251=_0xb72e[_0x173818];return _0x305251;};'use strict';var Sequelize=require(_0xeb72('0x0'));module[_0xeb72('0x1')]={'name':{'type':Sequelize[_0xeb72('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xeb72('0x3')]('first',_0xeb72('0x4'),_0xeb72('0x5')),'allowNull':![],'defaultValue':_0xeb72('0x6')},'description':{'type':Sequelize[_0xeb72('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 42d935e..fe14f0b 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 _0x0972=['VIRTUAL','filter','options','Disposition','includeAll','include','findAll','rows','catch','show','body','user','role','find','userProfileId','UserProfileResource','create','params','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','destroy','then','get','Dispositions','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','limit','order','sort','where','merge','map'];(function(_0x5abb40,_0x311825){var _0x3dd16c=function(_0x19915c){while(--_0x19915c){_0x5abb40['push'](_0x5abb40['shift']());}};_0x3dd16c(++_0x311825);}(_0x0972,0x64));var _0x2097=function(_0x424cd7,_0x368165){_0x424cd7=_0x424cd7-0x0;var _0x4ef99e=_0x0972[_0x424cd7];return _0x4ef99e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2097('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2097('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2097('0x2'));var moment=require(_0x2097('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2097('0x4'));var util=require(_0x2097('0x5'));var path=require(_0x2097('0x6'));var sox=require(_0x2097('0x7'));var csv=require(_0x2097('0x8'));var ejs=require(_0x2097('0x9'));var fs=require('fs');var fs_extra=require(_0x2097('0xa'));var _=require('lodash');var squel=require(_0x2097('0xb'));var crypto=require(_0x2097('0xc'));var jsforce=require(_0x2097('0xd'));var deskjs=require(_0x2097('0xe'));var toCsv=require(_0x2097('0x8'));var querystring=require('querystring');var Papa=require(_0x2097('0xf'));var Redis=require(_0x2097('0x10'));var authService=require(_0x2097('0x11'));var qs=require(_0x2097('0x12'));var as=require(_0x2097('0x13'));var hardwareService=require(_0x2097('0x14'));var logger=require(_0x2097('0x15'))(_0x2097('0x16'));var utils=require(_0x2097('0x17'));var config=require(_0x2097('0x18'));var licenseUtil=require(_0x2097('0x19'));var db=require(_0x2097('0x1a'))['db'];function respondWithStatusCode(_0x170005,_0x16871b){_0x16871b=_0x16871b||0xcc;return function(_0x24ca42){if(_0x24ca42){return _0x170005[_0x2097('0x1b')](_0x16871b);}return _0x170005[_0x2097('0x1c')](_0x16871b)[_0x2097('0x1d')]();};}function respondWithResult(_0x2c3e41,_0x354387){_0x354387=_0x354387||0xc8;return function(_0x5d0a43){if(_0x5d0a43){return _0x2c3e41[_0x2097('0x1c')](_0x354387)[_0x2097('0x1e')](_0x5d0a43);}};}function respondWithFilteredResult(_0x4d31bc,_0x4eec05){return function(_0x4fc8c5){if(_0x4fc8c5){var _0x409deb=_0x4fc8c5[_0x2097('0x1f')],_0x588396=_0x4eec05[_0x2097('0x20')],_0x28c35c=_0x4eec05[_0x2097('0x20')]+_0x4eec05['limit'],_0xb12c94;if(_0x28c35c>=_0x409deb){_0x28c35c=_0x409deb;_0xb12c94=0xc8;}else{_0xb12c94=0xce;}_0x4d31bc[_0x2097('0x1c')](_0xb12c94);return _0x4d31bc[_0x2097('0x21')](_0x2097('0x22'),_0x588396+'-'+_0x28c35c+'/'+_0x409deb)[_0x2097('0x1e')](_0x4fc8c5);}return null;};}function patchUpdates(_0x1d3804){return function(_0x235304){try{jsonpatch[_0x2097('0x23')](_0x235304,_0x1d3804,!![]);}catch(_0x46b5e0){return BPromise['reject'](_0x46b5e0);}return _0x235304['save']();};}function saveUpdates(_0xf65dc6,_0x569c21){return function(_0x227c00){if(_0x227c00){return _0x227c00[_0x2097('0x24')](_0xf65dc6)['then'](function(_0x442db7){return _0x442db7;});}return null;};}function removeEntity(_0x5b0582,_0x2e17c8){return function(_0xf32d3f){if(_0xf32d3f){return _0xf32d3f[_0x2097('0x25')]()[_0x2097('0x26')](function(){var _0x36b15e=_0xf32d3f[_0x2097('0x27')]({'plain':!![]});var _0x56390a=_0x2097('0x28');return db['UserProfileResource'][_0x2097('0x25')]({'where':{'type':_0x56390a,'resourceId':_0x36b15e['id']}})[_0x2097('0x26')](function(){return _0xf32d3f;});})[_0x2097('0x26')](function(){_0x5b0582[_0x2097('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d683a,_0x80c5ee){return function(_0x56af3b){if(!_0x56af3b){_0x2d683a[_0x2097('0x1b')](0x194);}return _0x56af3b;};}function handleError(_0x5ed0fa,_0x29b879){_0x29b879=_0x29b879||0x1f4;return function(_0x48ae06){logger[_0x2097('0x29')](_0x48ae06[_0x2097('0x2a')]);if(_0x48ae06[_0x2097('0x2b')]){delete _0x48ae06[_0x2097('0x2b')];}_0x5ed0fa[_0x2097('0x1c')](_0x29b879)[_0x2097('0x2c')](_0x48ae06);};}exports[_0x2097('0x2d')]=function(_0x4b443d,_0x11242f){var _0x14d964={},_0x5cce55={},_0x1398d0={'count':0x0,'rows':[]};var _0x41487d=_['map'](db['Disposition'][_0x2097('0x2e')],function(_0x11b051){return{'name':_0x11b051[_0x2097('0x2f')],'type':_0x11b051[_0x2097('0x30')][_0x2097('0x31')]};});_0x5cce55[_0x2097('0x32')]=_['map'](_0x41487d,_0x2097('0x2b'));_0x5cce55['query']=_[_0x2097('0x33')](_0x4b443d[_0x2097('0x34')]);_0x5cce55[_0x2097('0x35')]=_[_0x2097('0x36')](_0x5cce55[_0x2097('0x32')],_0x5cce55[_0x2097('0x34')]);_0x14d964[_0x2097('0x37')]=_[_0x2097('0x36')](_0x5cce55[_0x2097('0x32')],qs['fields'](_0x4b443d[_0x2097('0x34')][_0x2097('0x38')]));_0x14d964[_0x2097('0x37')]=_0x14d964['attributes'][_0x2097('0x39')]?_0x14d964[_0x2097('0x37')]:_0x5cce55[_0x2097('0x32')];if(!_0x4b443d[_0x2097('0x34')]['hasOwnProperty']('nolimit')){_0x14d964['limit']=qs[_0x2097('0x3a')](_0x4b443d[_0x2097('0x34')][_0x2097('0x3a')]);_0x14d964[_0x2097('0x20')]=qs[_0x2097('0x20')](_0x4b443d[_0x2097('0x34')]['offset']);}_0x14d964[_0x2097('0x3b')]=qs[_0x2097('0x3c')](_0x4b443d[_0x2097('0x34')][_0x2097('0x3c')]);_0x14d964[_0x2097('0x3d')]=qs[_0x2097('0x35')](_['pick'](_0x4b443d[_0x2097('0x34')],_0x5cce55[_0x2097('0x35')]),_0x41487d);if(_0x4b443d[_0x2097('0x34')]['filter']){_0x14d964['where']=_[_0x2097('0x3e')](_0x14d964[_0x2097('0x3d')],{'$or':_[_0x2097('0x3f')](_0x41487d,function(_0x85b01e){if(_0x85b01e[_0x2097('0x30')]!==_0x2097('0x40')){var _0x14547f={};_0x14547f[_0x85b01e[_0x2097('0x2b')]]={'$like':'%'+_0x4b443d[_0x2097('0x34')][_0x2097('0x41')]+'%'};return _0x14547f;}})});}_0x14d964=_[_0x2097('0x3e')]({},_0x14d964,_0x4b443d[_0x2097('0x42')]);var _0x47cac4={'where':_0x14d964[_0x2097('0x3d')]};return db[_0x2097('0x43')][_0x2097('0x1f')](_0x47cac4)['then'](function(_0x1394df){_0x1398d0[_0x2097('0x1f')]=_0x1394df;if(_0x4b443d[_0x2097('0x34')][_0x2097('0x44')]){_0x14d964[_0x2097('0x45')]=[{'all':!![]}];}return db[_0x2097('0x43')][_0x2097('0x46')](_0x14d964);})[_0x2097('0x26')](function(_0x5ab893){_0x1398d0[_0x2097('0x47')]=_0x5ab893;return _0x1398d0;})[_0x2097('0x26')](respondWithFilteredResult(_0x11242f,_0x14d964))[_0x2097('0x48')](handleError(_0x11242f,null));};exports[_0x2097('0x49')]=function(_0x12e0e2,_0xe3ac1b){var _0x1f2add={'raw':!![],'where':{'id':_0x12e0e2['params']['id']}},_0x280ecd={};_0x280ecd[_0x2097('0x32')]=_['keys'](db[_0x2097('0x43')][_0x2097('0x2e')]);_0x280ecd[_0x2097('0x34')]=_[_0x2097('0x33')](_0x12e0e2[_0x2097('0x34')]);_0x280ecd['filters']=_[_0x2097('0x36')](_0x280ecd[_0x2097('0x32')],_0x280ecd[_0x2097('0x34')]);_0x1f2add[_0x2097('0x37')]=_[_0x2097('0x36')](_0x280ecd['model'],qs[_0x2097('0x38')](_0x12e0e2[_0x2097('0x34')][_0x2097('0x38')]));_0x1f2add[_0x2097('0x37')]=_0x1f2add[_0x2097('0x37')][_0x2097('0x39')]?_0x1f2add[_0x2097('0x37')]:_0x280ecd[_0x2097('0x32')];if(_0x12e0e2['query'][_0x2097('0x44')]){_0x1f2add[_0x2097('0x45')]=[{'all':!![]}];}_0x1f2add=_[_0x2097('0x3e')]({},_0x1f2add,_0x12e0e2[_0x2097('0x42')]);return db['Disposition']['find'](_0x1f2add)['then'](handleEntityNotFound(_0xe3ac1b,null))[_0x2097('0x26')](respondWithResult(_0xe3ac1b,null))[_0x2097('0x48')](handleError(_0xe3ac1b,null));};exports['create']=function(_0x10577d,_0x3f3798){return db['Disposition']['create'](_0x10577d[_0x2097('0x4a')],{})[_0x2097('0x26')](function(_0x1b4de6){var _0x5a0c05=_0x10577d[_0x2097('0x4b')][_0x2097('0x27')]({'plain':!![]});if(!_0x5a0c05)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a0c05[_0x2097('0x4c')]===_0x2097('0x4b')){var _0xdfea21=_0x1b4de6[_0x2097('0x27')]({'plain':!![]});var _0x4457a4='Dispositions';return db['UserProfileSection'][_0x2097('0x4d')]({'where':{'name':_0x4457a4,'userProfileId':_0x5a0c05[_0x2097('0x4e')]},'raw':!![]})[_0x2097('0x26')](function(_0x57a45c){if(_0x57a45c&&_0x57a45c['autoAssociation']===0x0){return db[_0x2097('0x4f')][_0x2097('0x50')]({'name':_0xdfea21['name'],'resourceId':_0xdfea21['id'],'type':_0x57a45c[_0x2097('0x2b')],'sectionId':_0x57a45c['id']},{})[_0x2097('0x26')](function(){return _0x1b4de6;});}else{return _0x1b4de6;}})[_0x2097('0x48')](function(_0x33490e){logger[_0x2097('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33490e);throw _0x33490e;});}return _0x1b4de6;})[_0x2097('0x26')](respondWithResult(_0x3f3798,0xc9))[_0x2097('0x48')](handleError(_0x3f3798,null));};exports[_0x2097('0x24')]=function(_0x54fe12,_0x4a25e2){if(_0x54fe12[_0x2097('0x4a')]['id']){delete _0x54fe12['body']['id'];}return db[_0x2097('0x43')]['find']({'where':{'id':_0x54fe12[_0x2097('0x51')]['id']}})['then'](handleEntityNotFound(_0x4a25e2,null))['then'](saveUpdates(_0x54fe12['body'],null))[_0x2097('0x26')](respondWithResult(_0x4a25e2,null))['catch'](handleError(_0x4a25e2,null));};exports['destroy']=function(_0x11e37f,_0x52af14){return db[_0x2097('0x43')][_0x2097('0x4d')]({'where':{'id':_0x11e37f['params']['id']}})[_0x2097('0x26')](handleEntityNotFound(_0x52af14,null))[_0x2097('0x26')](removeEntity(_0x52af14,null))[_0x2097('0x48')](handleError(_0x52af14,null));}; \ No newline at end of file +var _0x6e6c=['fieldName','type','key','model','query','keys','filters','fields','attributes','limit','order','sort','where','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','intersection','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Dispositions','error','stack','name','send','index','map','Disposition','rawAttributes'];(function(_0x2c4a9c,_0x2649c9){var _0x3effe1=function(_0x13ef22){while(--_0x13ef22){_0x2c4a9c['push'](_0x2c4a9c['shift']());}};_0x3effe1(++_0x2649c9);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xc6e6('0x0'));var emlformat=require(_0xc6e6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc6e6('0x2'));var jsonpatch=require(_0xc6e6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc6e6('0x4'));var Mustache=require('mustache');var util=require(_0xc6e6('0x5'));var path=require('path');var sox=require(_0xc6e6('0x6'));var csv=require(_0xc6e6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc6e6('0x8'));var _=require(_0xc6e6('0x9'));var squel=require('squel');var crypto=require(_0xc6e6('0xa'));var jsforce=require(_0xc6e6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc6e6('0x7'));var querystring=require('querystring');var Papa=require(_0xc6e6('0xc'));var Redis=require(_0xc6e6('0xd'));var authService=require(_0xc6e6('0xe'));var qs=require(_0xc6e6('0xf'));var as=require(_0xc6e6('0x10'));var hardwareService=require(_0xc6e6('0x11'));var logger=require(_0xc6e6('0x12'))(_0xc6e6('0x13'));var utils=require(_0xc6e6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc6e6('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a30ce,_0x314d0f){_0x314d0f=_0x314d0f||0xcc;return function(_0x33aea0){if(_0x33aea0){return _0x3a30ce[_0xc6e6('0x16')](_0x314d0f);}return _0x3a30ce['status'](_0x314d0f)[_0xc6e6('0x17')]();};}function respondWithResult(_0x2bfe7d,_0x13be73){_0x13be73=_0x13be73||0xc8;return function(_0x1b6ca9){if(_0x1b6ca9){return _0x2bfe7d[_0xc6e6('0x18')](_0x13be73)['json'](_0x1b6ca9);}};}function respondWithFilteredResult(_0x413cf8,_0x178b34){return function(_0x569474){if(_0x569474){var _0x2f11b0=_0x569474['count'],_0x144039=_0x178b34['offset'],_0xedf127=_0x178b34[_0xc6e6('0x19')]+_0x178b34['limit'],_0x4c978d;if(_0xedf127>=_0x2f11b0){_0xedf127=_0x2f11b0;_0x4c978d=0xc8;}else{_0x4c978d=0xce;}_0x413cf8[_0xc6e6('0x18')](_0x4c978d);return _0x413cf8[_0xc6e6('0x1a')](_0xc6e6('0x1b'),_0x144039+'-'+_0xedf127+'/'+_0x2f11b0)[_0xc6e6('0x1c')](_0x569474);}return null;};}function patchUpdates(_0x19e1e4){return function(_0x3a0d83){try{jsonpatch[_0xc6e6('0x1d')](_0x3a0d83,_0x19e1e4,!![]);}catch(_0x2761c4){return BPromise[_0xc6e6('0x1e')](_0x2761c4);}return _0x3a0d83[_0xc6e6('0x1f')]();};}function saveUpdates(_0x4a36b6,_0x428401){return function(_0x4ad70e){if(_0x4ad70e){return _0x4ad70e[_0xc6e6('0x20')](_0x4a36b6)[_0xc6e6('0x21')](function(_0x2be6fc){return _0x2be6fc;});}return null;};}function removeEntity(_0x2f69f1,_0x4f1d68){return function(_0x35253d){if(_0x35253d){return _0x35253d[_0xc6e6('0x22')]()[_0xc6e6('0x21')](function(){var _0x36ebfa=_0x35253d[_0xc6e6('0x23')]({'plain':!![]});var _0x4c35ae=_0xc6e6('0x24');return db['UserProfileResource'][_0xc6e6('0x22')]({'where':{'type':_0x4c35ae,'resourceId':_0x36ebfa['id']}})[_0xc6e6('0x21')](function(){return _0x35253d;});})[_0xc6e6('0x21')](function(){_0x2f69f1[_0xc6e6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ff8a4,_0x5a5e47){return function(_0x28577b){if(!_0x28577b){_0x3ff8a4['sendStatus'](0x194);}return _0x28577b;};}function handleError(_0x267c6a,_0x16dcd9){_0x16dcd9=_0x16dcd9||0x1f4;return function(_0x348888){logger[_0xc6e6('0x25')](_0x348888[_0xc6e6('0x26')]);if(_0x348888['name']){delete _0x348888[_0xc6e6('0x27')];}_0x267c6a[_0xc6e6('0x18')](_0x16dcd9)[_0xc6e6('0x28')](_0x348888);};}exports[_0xc6e6('0x29')]=function(_0x4d1284,_0x34ae96){var _0x50b735={},_0x29411c={},_0x7d7890={'count':0x0,'rows':[]};var _0x12c616=_[_0xc6e6('0x2a')](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')],function(_0x43ff9c){return{'name':_0x43ff9c[_0xc6e6('0x2d')],'type':_0x43ff9c[_0xc6e6('0x2e')][_0xc6e6('0x2f')]};});_0x29411c[_0xc6e6('0x30')]=_[_0xc6e6('0x2a')](_0x12c616,_0xc6e6('0x27'));_0x29411c[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x4d1284[_0xc6e6('0x31')]);_0x29411c[_0xc6e6('0x33')]=_['intersection'](_0x29411c[_0xc6e6('0x30')],_0x29411c[_0xc6e6('0x31')]);_0x50b735['attributes']=_['intersection'](_0x29411c[_0xc6e6('0x30')],qs[_0xc6e6('0x34')](_0x4d1284[_0xc6e6('0x31')][_0xc6e6('0x34')]));_0x50b735[_0xc6e6('0x35')]=_0x50b735[_0xc6e6('0x35')]['length']?_0x50b735[_0xc6e6('0x35')]:_0x29411c[_0xc6e6('0x30')];if(!_0x4d1284[_0xc6e6('0x31')]['hasOwnProperty']('nolimit')){_0x50b735[_0xc6e6('0x36')]=qs[_0xc6e6('0x36')](_0x4d1284[_0xc6e6('0x31')][_0xc6e6('0x36')]);_0x50b735['offset']=qs['offset'](_0x4d1284[_0xc6e6('0x31')]['offset']);}_0x50b735[_0xc6e6('0x37')]=qs['sort'](_0x4d1284[_0xc6e6('0x31')][_0xc6e6('0x38')]);_0x50b735[_0xc6e6('0x39')]=qs[_0xc6e6('0x33')](_['pick'](_0x4d1284['query'],_0x29411c[_0xc6e6('0x33')]),_0x12c616);if(_0x4d1284[_0xc6e6('0x31')][_0xc6e6('0x3a')]){_0x50b735[_0xc6e6('0x39')]=_['merge'](_0x50b735['where'],{'$or':_[_0xc6e6('0x2a')](_0x12c616,function(_0x1326c7){if(_0x1326c7[_0xc6e6('0x2e')]!==_0xc6e6('0x3b')){var _0x58143f={};_0x58143f[_0x1326c7[_0xc6e6('0x27')]]={'$like':'%'+_0x4d1284[_0xc6e6('0x31')]['filter']+'%'};return _0x58143f;}})});}_0x50b735=_['merge']({},_0x50b735,_0x4d1284[_0xc6e6('0x3c')]);var _0x550971={'where':_0x50b735[_0xc6e6('0x39')]};return db[_0xc6e6('0x2b')]['count'](_0x550971)[_0xc6e6('0x21')](function(_0x50c96d){_0x7d7890[_0xc6e6('0x3d')]=_0x50c96d;if(_0x4d1284['query'][_0xc6e6('0x3e')]){_0x50b735[_0xc6e6('0x3f')]=[{'all':!![]}];}return db[_0xc6e6('0x2b')][_0xc6e6('0x40')](_0x50b735);})[_0xc6e6('0x21')](function(_0xcf70c8){_0x7d7890[_0xc6e6('0x41')]=_0xcf70c8;return _0x7d7890;})[_0xc6e6('0x21')](respondWithFilteredResult(_0x34ae96,_0x50b735))[_0xc6e6('0x42')](handleError(_0x34ae96,null));};exports['show']=function(_0x3e3da6,_0x2b494f){var _0x118644={'raw':!![],'where':{'id':_0x3e3da6['params']['id']}},_0x1dd7ad={};_0x1dd7ad[_0xc6e6('0x30')]=_[_0xc6e6('0x32')](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')]);_0x1dd7ad['query']=_[_0xc6e6('0x32')](_0x3e3da6[_0xc6e6('0x31')]);_0x1dd7ad[_0xc6e6('0x33')]=_[_0xc6e6('0x43')](_0x1dd7ad[_0xc6e6('0x30')],_0x1dd7ad['query']);_0x118644[_0xc6e6('0x35')]=_['intersection'](_0x1dd7ad[_0xc6e6('0x30')],qs['fields'](_0x3e3da6[_0xc6e6('0x31')][_0xc6e6('0x34')]));_0x118644[_0xc6e6('0x35')]=_0x118644[_0xc6e6('0x35')][_0xc6e6('0x44')]?_0x118644[_0xc6e6('0x35')]:_0x1dd7ad[_0xc6e6('0x30')];if(_0x3e3da6[_0xc6e6('0x31')]['includeAll']){_0x118644[_0xc6e6('0x3f')]=[{'all':!![]}];}_0x118644=_[_0xc6e6('0x45')]({},_0x118644,_0x3e3da6[_0xc6e6('0x3c')]);return db['Disposition'][_0xc6e6('0x46')](_0x118644)[_0xc6e6('0x21')](handleEntityNotFound(_0x2b494f,null))[_0xc6e6('0x21')](respondWithResult(_0x2b494f,null))[_0xc6e6('0x42')](handleError(_0x2b494f,null));};exports[_0xc6e6('0x47')]=function(_0xefd557,_0x10f407){return db[_0xc6e6('0x2b')][_0xc6e6('0x47')](_0xefd557[_0xc6e6('0x48')],{})[_0xc6e6('0x21')](function(_0x470167){var _0x3e0117=_0xefd557[_0xc6e6('0x49')]['get']({'plain':!![]});if(!_0x3e0117)throw new Error(_0xc6e6('0x4a'));if(_0x3e0117['role']===_0xc6e6('0x49')){var _0x45f4ee=_0x470167['get']({'plain':!![]});var _0x5ccbec='Dispositions';return db['UserProfileSection']['find']({'where':{'name':_0x5ccbec,'userProfileId':_0x3e0117[_0xc6e6('0x4b')]},'raw':!![]})[_0xc6e6('0x21')](function(_0x1dcfbf){if(_0x1dcfbf&&_0x1dcfbf[_0xc6e6('0x4c')]===0x0){return db[_0xc6e6('0x4d')]['create']({'name':_0x45f4ee['name'],'resourceId':_0x45f4ee['id'],'type':_0x1dcfbf[_0xc6e6('0x27')],'sectionId':_0x1dcfbf['id']},{})[_0xc6e6('0x21')](function(){return _0x470167;});}else{return _0x470167;}})[_0xc6e6('0x42')](function(_0x48ba2e){logger['error'](_0xc6e6('0x4e'),_0x48ba2e);throw _0x48ba2e;});}return _0x470167;})[_0xc6e6('0x21')](respondWithResult(_0x10f407,0xc9))[_0xc6e6('0x42')](handleError(_0x10f407,null));};exports[_0xc6e6('0x20')]=function(_0x2a63d7,_0x4e50e5){if(_0x2a63d7[_0xc6e6('0x48')]['id']){delete _0x2a63d7[_0xc6e6('0x48')]['id'];}return db[_0xc6e6('0x2b')]['find']({'where':{'id':_0x2a63d7[_0xc6e6('0x4f')]['id']}})[_0xc6e6('0x21')](handleEntityNotFound(_0x4e50e5,null))[_0xc6e6('0x21')](saveUpdates(_0x2a63d7[_0xc6e6('0x48')],null))[_0xc6e6('0x21')](respondWithResult(_0x4e50e5,null))['catch'](handleError(_0x4e50e5,null));};exports[_0xc6e6('0x22')]=function(_0x1de5ca,_0x7c088c){return db[_0xc6e6('0x2b')][_0xc6e6('0x46')]({'where':{'id':_0x1de5ca['params']['id']}})['then'](handleEntityNotFound(_0x7c088c,null))['then'](removeEntity(_0x7c088c,null))[_0xc6e6('0x42')](handleError(_0x7c088c,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 3588402..a7926d1 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 _0x1696=['bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','../../config/logger','api','moment'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x1696,0x79));var _0x6169=function(_0x4874d8,_0x5a7ee4){_0x4874d8=_0x4874d8-0x0;var _0x5c3bce=_0x1696[_0x4874d8];return _0x5c3bce;};'use strict';var _=require(_0x6169('0x0'));var util=require('util');var logger=require(_0x6169('0x1'))(_0x6169('0x2'));var moment=require(_0x6169('0x3'));var BPromise=require(_0x6169('0x4'));var rp=require(_0x6169('0x5'));var fs=require('fs');var path=require(_0x6169('0x6'));var rimraf=require(_0x6169('0x7'));var config=require(_0x6169('0x8'));var attributes=require(_0x6169('0x9'));module['exports']=function(_0x3569ff,_0x128cf1){return _0x3569ff[_0x6169('0xa')](_0x6169('0xb'),attributes,{'tableName':_0x6169('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x6169('0xd'),'fields':[_0x6169('0xe'),'ListId']},{'unique':!![],'name':_0x6169('0xf'),'fields':['name',_0x6169('0x10')]},{'unique':!![],'name':_0x6169('0x11'),'fields':['name',_0x6169('0x12')]},{'unique':!![],'name':_0x6169('0x13'),'fields':[_0x6169('0xe'),_0x6169('0x14')]},{'unique':!![],'name':'name_fax','fields':['name',_0x6169('0x15')]},{'unique':!![],'name':_0x6169('0x16'),'fields':['name',_0x6169('0x17')]},{'unique':!![],'name':_0x6169('0x18'),'fields':[_0x6169('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xedf2=['MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','tools_dispositions','name','name_chat','ChatWebsiteId','name_mail'];(function(_0x1e94b3,_0x3f7f09){var _0x30f70e=function(_0x17e7c7){while(--_0x17e7c7){_0x1e94b3['push'](_0x1e94b3['shift']());}};_0x30f70e(++_0x3f7f09);}(_0xedf2,0x1ac));var _0x2edf=function(_0x106f5c,_0x235178){_0x106f5c=_0x106f5c-0x0;var _0x2759b3=_0xedf2[_0x106f5c];return _0x2759b3;};'use strict';var _=require('lodash');var util=require(_0x2edf('0x0'));var logger=require(_0x2edf('0x1'))(_0x2edf('0x2'));var moment=require('moment');var BPromise=require(_0x2edf('0x3'));var rp=require(_0x2edf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2edf('0x5'));var config=require(_0x2edf('0x6'));var attributes=require('./disposition.attributes');module['exports']=function(_0x3cfc52,_0x3601aa){return _0x3cfc52['define']('Disposition',attributes,{'tableName':_0x2edf('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x2edf('0x8'),'ListId']},{'unique':!![],'name':_0x2edf('0x9'),'fields':[_0x2edf('0x8'),_0x2edf('0xa')]},{'unique':!![],'name':_0x2edf('0xb'),'fields':[_0x2edf('0x8'),_0x2edf('0xc')]},{'unique':!![],'name':_0x2edf('0xd'),'fields':[_0x2edf('0x8'),_0x2edf('0xe')]},{'unique':!![],'name':'name_fax','fields':[_0x2edf('0x8'),_0x2edf('0xf')]},{'unique':!![],'name':_0x2edf('0x10'),'fields':[_0x2edf('0x8'),_0x2edf('0x11')]},{'unique':!![],'name':_0x2edf('0x12'),'fields':['name',_0x2edf('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 0b71271..a9b754c 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 _0xf07d=['message','info','result','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4206f5,_0x21f338){var _0xa29cf3=function(_0x2d35d7){while(--_0x2d35d7){_0x4206f5['push'](_0x4206f5['shift']());}};_0xa29cf3(++_0x21f338);}(_0xf07d,0x81));var _0xdf07=function(_0x581fff,_0x3de514){_0x581fff=_0x581fff-0x0;var _0x572220=_0xf07d[_0x581fff];return _0x572220;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdf07('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf07('0x1'));var db=require(_0xdf07('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf07('0x3'))(_0xdf07('0x4'));var config=require(_0xdf07('0x5'));var jayson=require(_0xdf07('0x6'));var client=jayson[_0xdf07('0x7')][_0xdf07('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x252d6c,_0x4a0225,_0x480859){return new BPromise(function(_0x6ab110,_0x603091){return client[_0xdf07('0x9')](_0x252d6c,_0x480859)[_0xdf07('0xa')](function(_0x434950){logger['info'](_0xdf07('0xb'),_0x4a0225,_0xdf07('0xc'));logger[_0xdf07('0xd')](_0xdf07('0xe'),_0x4a0225,'request\x20sent',JSON[_0xdf07('0xf')](_0x434950));if(_0x434950[_0xdf07('0x10')]){if(_0x434950[_0xdf07('0x10')][_0xdf07('0x11')]===0x1f4){logger[_0xdf07('0x10')]('Disposition,\x20%s,\x20%s',_0x4a0225,_0x434950[_0xdf07('0x10')][_0xdf07('0x12')]);return _0x603091(_0x434950['error'][_0xdf07('0x12')]);}logger[_0xdf07('0x10')](_0xdf07('0xb'),_0x4a0225,_0x434950[_0xdf07('0x10')][_0xdf07('0x12')]);return _0x6ab110(_0x434950[_0xdf07('0x10')][_0xdf07('0x12')]);}else{logger[_0xdf07('0x13')]('Disposition,\x20%s,\x20%s',_0x4a0225,_0xdf07('0xc'));_0x6ab110(_0x434950[_0xdf07('0x14')][_0xdf07('0x12')]);}})['catch'](function(_0x28c881){logger['error'](_0xdf07('0xb'),_0x4a0225,_0x28c881);_0x603091(_0x28c881);});});} \ No newline at end of file +var _0x9e92=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x493b11,_0x4736ee){var _0x179815=function(_0x219a7d){while(--_0x219a7d){_0x493b11['push'](_0x493b11['shift']());}};_0x179815(++_0x4736ee);}(_0x9e92,0x1b6));var _0x29e9=function(_0x1807d4,_0x13cb54){_0x1807d4=_0x1807d4-0x0;var _0x1d39ef=_0x9e92[_0x1807d4];return _0x1d39ef;};'use strict';var _=require(_0x29e9('0x0'));var util=require(_0x29e9('0x1'));var moment=require(_0x29e9('0x2'));var BPromise=require('bluebird');var rs=require(_0x29e9('0x3'));var fs=require('fs');var Redis=require(_0x29e9('0x4'));var db=require(_0x29e9('0x5'))['db'];var utils=require(_0x29e9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x29e9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x29e9('0x8')][_0x29e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11fff0,_0x39a4a8,_0x2972e6){return new BPromise(function(_0x5f1a61,_0x20231a){return client[_0x29e9('0xa')](_0x11fff0,_0x2972e6)[_0x29e9('0xb')](function(_0x3e4ab0){logger[_0x29e9('0xc')](_0x29e9('0xd'),_0x39a4a8,_0x29e9('0xe'));logger[_0x29e9('0xf')](_0x29e9('0x10'),_0x39a4a8,_0x29e9('0xe'),JSON[_0x29e9('0x11')](_0x3e4ab0));if(_0x3e4ab0[_0x29e9('0x12')]){if(_0x3e4ab0['error'][_0x29e9('0x13')]===0x1f4){logger[_0x29e9('0x12')](_0x29e9('0xd'),_0x39a4a8,_0x3e4ab0['error'][_0x29e9('0x14')]);return _0x20231a(_0x3e4ab0[_0x29e9('0x12')][_0x29e9('0x14')]);}logger[_0x29e9('0x12')](_0x29e9('0xd'),_0x39a4a8,_0x3e4ab0['error']['message']);return _0x5f1a61(_0x3e4ab0[_0x29e9('0x12')]['message']);}else{logger['info'](_0x29e9('0xd'),_0x39a4a8,'request\x20sent');_0x5f1a61(_0x3e4ab0[_0x29e9('0x15')][_0x29e9('0x14')]);}})['catch'](function(_0xe212f9){logger[_0x29e9('0x12')]('Disposition,\x20%s,\x20%s',_0x39a4a8,_0xe212f9);_0x20231a(_0xe212f9);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 3a2a32f..48f2235 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 _0x4dc2=['/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put'];(function(_0x10b2c,_0x1a3a5f){var _0x137771=function(_0xf8d2ae){while(--_0xf8d2ae){_0x10b2c['push'](_0x10b2c['shift']());}};_0x137771(++_0x1a3a5f);}(_0x4dc2,0x89));var _0x24dc=function(_0x384113,_0xccc4b0){_0x384113=_0x384113-0x0;var _0x3fc9f1=_0x4dc2[_0x384113];return _0x3fc9f1;};'use strict';var multer=require(_0x24dc('0x0'));var util=require(_0x24dc('0x1'));var path=require('path');var timeout=require(_0x24dc('0x2'));var express=require(_0x24dc('0x3'));var router=express[_0x24dc('0x4')]();var fs_extra=require(_0x24dc('0x5'));var auth=require(_0x24dc('0x6'));var interaction=require(_0x24dc('0x7'));var config=require(_0x24dc('0x8'));var controller=require('./disposition.controller');router[_0x24dc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x24dc('0x9')]('/:id',auth[_0x24dc('0xa')](),controller[_0x24dc('0xb')]);router[_0x24dc('0xc')]('/',auth['isAuthenticated'](),controller[_0x24dc('0xd')]);router[_0x24dc('0xe')](_0x24dc('0xf'),auth[_0x24dc('0xa')](),controller[_0x24dc('0x10')]);router[_0x24dc('0x11')](_0x24dc('0xf'),auth[_0x24dc('0xa')](),controller['destroy']);module[_0x24dc('0x12')]=router; \ No newline at end of file +var _0x5d57=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x5d57,0xa5));var _0x75d5=function(_0x2b2007,_0xb700f6){_0x2b2007=_0x2b2007-0x0;var _0x362550=_0x5d57[_0x2b2007];return _0x362550;};'use strict';var multer=require(_0x75d5('0x0'));var util=require('util');var path=require(_0x75d5('0x1'));var timeout=require(_0x75d5('0x2'));var express=require(_0x75d5('0x3'));var router=express['Router']();var fs_extra=require(_0x75d5('0x4'));var auth=require(_0x75d5('0x5'));var interaction=require(_0x75d5('0x6'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x75d5('0x7')]('/',auth[_0x75d5('0x8')](),controller[_0x75d5('0x9')]);router['get'](_0x75d5('0xa'),auth[_0x75d5('0x8')](),controller[_0x75d5('0xb')]);router['post']('/',auth[_0x75d5('0x8')](),controller[_0x75d5('0xc')]);router[_0x75d5('0xd')](_0x75d5('0xa'),auth[_0x75d5('0x8')](),controller[_0x75d5('0xe')]);router[_0x75d5('0xf')](_0x75d5('0xa'),auth[_0x75d5('0x8')](),controller[_0x75d5('0x10')]);module[_0x75d5('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index b4c845d..a2df280 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 _0xc6ed=['exports','STRING','yes','localstationid','ENUM','2400','4800','7200','9600','14400','SIP','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x98b288,_0x1e9204){var _0x588bbb=function(_0x27b3ec){while(--_0x27b3ec){_0x98b288['push'](_0x98b288['shift']());}};_0x588bbb(++_0x1e9204);}(_0xc6ed,0x64));var _0xdc6e=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xc6ed[_0x44946b];return _0x249bc4;};'use strict';var Sequelize=require('sequelize');module[_0xdc6e('0x0')]={'name':{'type':Sequelize[_0xdc6e('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdc6e('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0xdc6e('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xdc6e('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0xdc6e('0x3')},'minrate':{'type':Sequelize[_0xdc6e('0x4')](_0xdc6e('0x5'),_0xdc6e('0x6'),_0xdc6e('0x7'),_0xdc6e('0x8'),'12000','14400'),'defaultValue':_0xdc6e('0x6')},'maxrate':{'type':Sequelize[_0xdc6e('0x4')](_0xdc6e('0x5'),_0xdc6e('0x6'),'7200',_0xdc6e('0x8'),'12000',_0xdc6e('0x9')),'defaultValue':_0xdc6e('0x9')},'modem':{'type':Sequelize[_0xdc6e('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xdc6e('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xdc6e('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xdc6e('0x4')](_0xdc6e('0xa'),'IAX','DADHI',_0xdc6e('0xb')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xdc6e('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xdc6e('0xc')],'defaultValue':function(){return _0xdc6e('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdc6e('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdc6e('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdc6e('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdc6e('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdc6e('0xf')],'allowNull':!![],'defaultValue':null,'comment':_0xdc6e('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xdc6e('0xe')],'defaultValue':![],'comment':_0xdc6e('0x11'),'set':function(_0x341a1a){if(!_0x341a1a)this[_0xdc6e('0x12')](_0xdc6e('0x13'),null);this[_0xdc6e('0x12')]('mandatoryDisposition',_0x341a1a);}}}; \ No newline at end of file +var _0x0e2f=['STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','DADHI','KHOMP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e2f,0x16f));var _0xf0e2=function(_0x2792ca,_0x41303b){_0x2792ca=_0x2792ca-0x0;var _0xfdc6b1=_0x0e2f[_0x2792ca];return _0xfdc6b1;};'use strict';var Sequelize=require(_0xf0e2('0x0'));module['exports']={'name':{'type':Sequelize[_0xf0e2('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf0e2('0x1')]},'ecm':{'type':Sequelize[_0xf0e2('0x2')](_0xf0e2('0x3'),'no'),'defaultValue':_0xf0e2('0x3')},'headerinfo':{'type':Sequelize[_0xf0e2('0x1')],'defaultValue':_0xf0e2('0x4')},'localstationid':{'type':Sequelize[_0xf0e2('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0xf0e2('0x5'),_0xf0e2('0x6'),_0xf0e2('0x7'),_0xf0e2('0x8'),_0xf0e2('0x9'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0xf0e2('0x5'),_0xf0e2('0x6'),'7200',_0xf0e2('0x8'),'12000',_0xf0e2('0xa')),'defaultValue':_0xf0e2('0xa')},'modem':{'type':Sequelize[_0xf0e2('0x1')],'defaultValue':_0xf0e2('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf0e2('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf0e2('0x2')](_0xf0e2('0xc'),'IAX',_0xf0e2('0xd'),_0xf0e2('0xe')),'defaultValue':_0xf0e2('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf0e2('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf0e2('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf0e2('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf0e2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf0e2('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf0e2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf0e2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf0e2('0x11')],'allowNull':!![],'defaultValue':null,'comment':_0xf0e2('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xf0e2('0x10')],'defaultValue':![],'comment':_0xf0e2('0x13'),'set':function(_0x33e49f){if(!_0x33e49f)this['setDataValue'](_0xf0e2('0x14'),null);this[_0xf0e2('0x15')](_0xf0e2('0x16'),_0x33e49f);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index c37e826..59c09e1 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 _0x1bb2=['update','FaxAccounts','UserProfileResource','destroy','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','limit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','nolimit','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','appdata','push','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','from','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./faxAccount.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','Content-Range','reject'];(function(_0xe629c4,_0x55c318){var _0x510bbf=function(_0x535074){while(--_0x535074){_0xe629c4['push'](_0xe629c4['shift']());}};_0x510bbf(++_0x55c318);}(_0x1bb2,0x152));var _0x21bb=function(_0x1b07ba,_0x5a71ef){_0x1b07ba=_0x1b07ba-0x0;var _0x51b969=_0x1bb2[_0x1b07ba];return _0x51b969;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x21bb('0x0'));var rimraf=require(_0x21bb('0x1'));var zipdir=require(_0x21bb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x21bb('0x3'));var BPromise=require(_0x21bb('0x4'));var Mustache=require(_0x21bb('0x5'));var util=require(_0x21bb('0x6'));var path=require(_0x21bb('0x7'));var sox=require(_0x21bb('0x8'));var csv=require(_0x21bb('0x9'));var ejs=require(_0x21bb('0xa'));var fs=require('fs');var fs_extra=require(_0x21bb('0xb'));var _=require(_0x21bb('0xc'));var squel=require(_0x21bb('0xd'));var crypto=require(_0x21bb('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x21bb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x21bb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x21bb('0x11'));var qs=require(_0x21bb('0x12'));var as=require(_0x21bb('0x13'));var hardwareService=require(_0x21bb('0x14'));var logger=require(_0x21bb('0x15'))(_0x21bb('0x16'));var utils=require(_0x21bb('0x17'));var config=require(_0x21bb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x21bb('0x19'))['db'];config[_0x21bb('0x1a')]=_['defaults'](config[_0x21bb('0x1a')],{'host':_0x21bb('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21bb('0x1a')]));require(_0x21bb('0x1c'))[_0x21bb('0x1d')](socket);var jayson=require(_0x21bb('0x1e'));var client=jayson['client'][_0x21bb('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18daa7,_0x1ef9a5,_0x2a8656,_0x465f5e){return new BPromise(function(_0x29991a,_0x412d50){var _0x3497cf=_0x465f5e||client;return _0x3497cf[_0x21bb('0x20')](_0x18daa7,_0x2a8656)[_0x21bb('0x21')](function(_0x17ee1d){logger[_0x21bb('0x22')]('FaxAccount,\x20%s,\x20%s',_0x1ef9a5,_0x21bb('0x23'));logger[_0x21bb('0x24')](_0x21bb('0x25'),_0x1ef9a5,'request\x20sent',JSON[_0x21bb('0x26')](_0x17ee1d));if(_0x17ee1d[_0x21bb('0x27')]){if(_0x17ee1d[_0x21bb('0x27')][_0x21bb('0x28')]===0x1f4){logger[_0x21bb('0x27')](_0x21bb('0x29'),_0x1ef9a5,_0x17ee1d[_0x21bb('0x27')][_0x21bb('0x2a')]);return _0x412d50(_0x17ee1d[_0x21bb('0x27')][_0x21bb('0x2a')]);}logger[_0x21bb('0x27')](_0x21bb('0x29'),_0x1ef9a5,_0x17ee1d['error'][_0x21bb('0x2a')]);return _0x29991a(_0x17ee1d[_0x21bb('0x27')][_0x21bb('0x2a')]);}else{logger['info'](_0x21bb('0x29'),_0x1ef9a5,_0x21bb('0x23'));_0x29991a(_0x17ee1d[_0x21bb('0x2b')][_0x21bb('0x2a')]);}})[_0x21bb('0x2c')](function(_0x3239e2){logger[_0x21bb('0x27')](_0x21bb('0x29'),_0x1ef9a5,_0x3239e2);_0x412d50(_0x3239e2);});});}function respondWithStatusCode(_0x4db3ad,_0x22a467){_0x22a467=_0x22a467||0xcc;return function(_0xed3ab2){if(_0xed3ab2){return _0x4db3ad[_0x21bb('0x2d')](_0x22a467);}return _0x4db3ad[_0x21bb('0x2e')](_0x22a467)['end']();};}function respondWithResult(_0x44d720,_0x26c46a){_0x26c46a=_0x26c46a||0xc8;return function(_0x22a91f){if(_0x22a91f){return _0x44d720[_0x21bb('0x2e')](_0x26c46a)[_0x21bb('0x2f')](_0x22a91f);}};}function respondWithFilteredResult(_0x2c09d6,_0x20de34){return function(_0x256974){if(_0x256974){var _0x5c5cae=_0x256974[_0x21bb('0x30')],_0x301aac=_0x20de34[_0x21bb('0x31')],_0xfd3327=_0x20de34[_0x21bb('0x31')]+_0x20de34['limit'],_0x4fc34d;if(_0xfd3327>=_0x5c5cae){_0xfd3327=_0x5c5cae;_0x4fc34d=0xc8;}else{_0x4fc34d=0xce;}_0x2c09d6[_0x21bb('0x2e')](_0x4fc34d);return _0x2c09d6['set'](_0x21bb('0x32'),_0x301aac+'-'+_0xfd3327+'/'+_0x5c5cae)[_0x21bb('0x2f')](_0x256974);}return null;};}function patchUpdates(_0xa113b0){return function(_0x3c58d5){try{jsonpatch['apply'](_0x3c58d5,_0xa113b0,!![]);}catch(_0x32b374){return BPromise[_0x21bb('0x33')](_0x32b374);}return _0x3c58d5['save']();};}function saveUpdates(_0x34f27a,_0x14d6fe){return function(_0x78133b){if(_0x78133b){return _0x78133b[_0x21bb('0x34')](_0x34f27a)[_0x21bb('0x21')](function(_0x2e8d63){return _0x2e8d63;});}return null;};}function removeEntity(_0x57e6a4,_0x4166a5){return function(_0x2bf5bc){if(_0x2bf5bc){return _0x2bf5bc['destroy']()[_0x21bb('0x21')](function(){var _0x68cbd5=_0x2bf5bc['get']({'plain':!![]});var _0xe74f9a=_0x21bb('0x35');return db[_0x21bb('0x36')][_0x21bb('0x37')]({'where':{'type':_0xe74f9a,'resourceId':_0x68cbd5['id']}})['then'](function(){return _0x2bf5bc;});})['then'](function(){_0x57e6a4[_0x21bb('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41a772,_0x59aedf){return function(_0x2a50d7){if(!_0x2a50d7){_0x41a772[_0x21bb('0x2d')](0x194);}return _0x2a50d7;};}function handleError(_0x420495,_0x7a0ab8){_0x7a0ab8=_0x7a0ab8||0x1f4;return function(_0x3049ea){logger['error'](_0x3049ea['stack']);if(_0x3049ea[_0x21bb('0x38')]){delete _0x3049ea[_0x21bb('0x38')];}_0x420495[_0x21bb('0x2e')](_0x7a0ab8)[_0x21bb('0x39')](_0x3049ea);};}exports[_0x21bb('0x3a')]=function(_0x5a6bc7,_0x59a47a){var _0x46e228={'include':[{'model':db['Pause'],'as':_0x21bb('0x3b')}]},_0x6a9981={},_0x16022e={'count':0x0,'rows':[]};var _0x540ac8=_[_0x21bb('0x3c')](db[_0x21bb('0x3d')][_0x21bb('0x3e')],function(_0x55fa1f){return{'name':_0x55fa1f['fieldName'],'type':_0x55fa1f[_0x21bb('0x3f')][_0x21bb('0x40')]};});_0x6a9981[_0x21bb('0x41')]=_[_0x21bb('0x3c')](_0x540ac8,'name');_0x6a9981[_0x21bb('0x42')]=_[_0x21bb('0x43')](_0x5a6bc7['query']);_0x6a9981['filters']=_['intersection'](_0x6a9981[_0x21bb('0x41')],_0x6a9981[_0x21bb('0x42')]);_0x46e228[_0x21bb('0x44')]=_[_0x21bb('0x45')](_0x6a9981[_0x21bb('0x41')],qs[_0x21bb('0x46')](_0x5a6bc7[_0x21bb('0x42')][_0x21bb('0x46')]));_0x46e228[_0x21bb('0x44')]=_0x46e228['attributes'][_0x21bb('0x47')]?_0x46e228[_0x21bb('0x44')]:_0x6a9981[_0x21bb('0x41')];if(!_0x5a6bc7['query']['hasOwnProperty']('nolimit')){_0x46e228[_0x21bb('0x48')]=qs['limit'](_0x5a6bc7[_0x21bb('0x42')][_0x21bb('0x48')]);_0x46e228[_0x21bb('0x31')]=qs['offset'](_0x5a6bc7[_0x21bb('0x42')]['offset']);}_0x46e228[_0x21bb('0x49')]=qs[_0x21bb('0x4a')](_0x5a6bc7['query'][_0x21bb('0x4a')]);_0x46e228[_0x21bb('0x4b')]=qs[_0x21bb('0x4c')](_[_0x21bb('0x4d')](_0x5a6bc7[_0x21bb('0x42')],_0x6a9981[_0x21bb('0x4c')]),_0x540ac8);if(_0x5a6bc7[_0x21bb('0x42')]['filter']){_0x46e228[_0x21bb('0x4b')]=_['merge'](_0x46e228['where'],{'$or':_['map'](_0x540ac8,function(_0x2bec5d){if(_0x2bec5d[_0x21bb('0x3f')]!==_0x21bb('0x4e')){var _0x10dbf7={};_0x10dbf7[_0x2bec5d[_0x21bb('0x38')]]={'$like':'%'+_0x5a6bc7[_0x21bb('0x42')][_0x21bb('0x4f')]+'%'};return _0x10dbf7;}})});}_0x46e228=_[_0x21bb('0x50')]({},_0x46e228,_0x5a6bc7[_0x21bb('0x51')]);var _0x42e1e4={'where':_0x46e228[_0x21bb('0x4b')]};return db['FaxAccount'][_0x21bb('0x30')](_0x42e1e4)[_0x21bb('0x21')](function(_0x280106){_0x16022e[_0x21bb('0x30')]=_0x280106;if(_0x5a6bc7[_0x21bb('0x42')][_0x21bb('0x52')]){_0x46e228[_0x21bb('0x53')]=[{'all':!![]}];}return db['FaxAccount'][_0x21bb('0x54')](_0x46e228);})[_0x21bb('0x21')](function(_0x2c7e54){_0x16022e[_0x21bb('0x55')]=_0x2c7e54;return _0x16022e;})[_0x21bb('0x21')](respondWithFilteredResult(_0x59a47a,_0x46e228))['catch'](handleError(_0x59a47a,null));};exports[_0x21bb('0x56')]=function(_0x3fad82,_0x2f40ba){var _0x348c42={'raw':![],'where':{'id':_0x3fad82[_0x21bb('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x21bb('0x3b')}]},_0x503edc={};_0x503edc[_0x21bb('0x41')]=_[_0x21bb('0x43')](db[_0x21bb('0x3d')][_0x21bb('0x3e')]);_0x503edc['query']=_['keys'](_0x3fad82[_0x21bb('0x42')]);_0x503edc[_0x21bb('0x4c')]=_[_0x21bb('0x45')](_0x503edc[_0x21bb('0x41')],_0x503edc[_0x21bb('0x42')]);_0x348c42[_0x21bb('0x44')]=_[_0x21bb('0x45')](_0x503edc[_0x21bb('0x41')],qs[_0x21bb('0x46')](_0x3fad82[_0x21bb('0x42')][_0x21bb('0x46')]));_0x348c42['attributes']=_0x348c42[_0x21bb('0x44')][_0x21bb('0x47')]?_0x348c42[_0x21bb('0x44')]:_0x503edc[_0x21bb('0x41')];if(_0x3fad82[_0x21bb('0x42')][_0x21bb('0x52')]){_0x348c42['include']=[{'all':!![]}];}_0x348c42=_[_0x21bb('0x50')]({},_0x348c42,_0x3fad82[_0x21bb('0x51')]);return db['FaxAccount'][_0x21bb('0x58')](_0x348c42)['then'](handleEntityNotFound(_0x2f40ba,null))[_0x21bb('0x21')](respondWithResult(_0x2f40ba,null))[_0x21bb('0x2c')](handleError(_0x2f40ba,null));};exports[_0x21bb('0x59')]=function(_0x56f59c,_0x707925){return db[_0x21bb('0x3d')][_0x21bb('0x59')](_0x56f59c[_0x21bb('0x5a')],{})[_0x21bb('0x21')](function(_0x3d0e21){var _0x238a8e=_0x56f59c[_0x21bb('0x5b')][_0x21bb('0x5c')]({'plain':!![]});if(!_0x238a8e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x238a8e[_0x21bb('0x5d')]===_0x21bb('0x5b')){var _0x217030=_0x3d0e21[_0x21bb('0x5c')]({'plain':!![]});var _0x29555c=_0x21bb('0x35');return db['UserProfileSection']['find']({'where':{'name':_0x29555c,'userProfileId':_0x238a8e[_0x21bb('0x5e')]},'raw':!![]})[_0x21bb('0x21')](function(_0x1d83d5){if(_0x1d83d5&&_0x1d83d5[_0x21bb('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x217030[_0x21bb('0x38')],'resourceId':_0x217030['id'],'type':_0x1d83d5['name'],'sectionId':_0x1d83d5['id']},{})['then'](function(){return _0x3d0e21;});}else{return _0x3d0e21;}})[_0x21bb('0x2c')](function(_0x27f7ae){logger[_0x21bb('0x27')](_0x21bb('0x60'),_0x27f7ae);throw _0x27f7ae;});}return _0x3d0e21;})[_0x21bb('0x21')](respondWithResult(_0x707925,0xc9))[_0x21bb('0x2c')](handleError(_0x707925,null));};exports[_0x21bb('0x34')]=function(_0x521623,_0x1ee986){if(_0x521623[_0x21bb('0x5a')]['id']){delete _0x521623[_0x21bb('0x5a')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x521623[_0x21bb('0x57')]['id']},'include':[{'model':db[_0x21bb('0x61')],'as':_0x21bb('0x3b')}]})[_0x21bb('0x21')](handleEntityNotFound(_0x1ee986,null))['then'](saveUpdates(_0x521623[_0x21bb('0x5a')],null))['then'](respondWithResult(_0x1ee986,null))['catch'](handleError(_0x1ee986,null));};exports[_0x21bb('0x37')]=function(_0xe791eb,_0x4ee4b1){return db[_0x21bb('0x3d')]['find']({'where':{'id':_0xe791eb[_0x21bb('0x57')]['id']}})['then'](handleEntityNotFound(_0x4ee4b1,null))[_0x21bb('0x21')](removeEntity(_0x4ee4b1,null))[_0x21bb('0x2c')](handleError(_0x4ee4b1,null));};exports[_0x21bb('0x62')]=function(_0x1cf029,_0x1de11d){return db[_0x21bb('0x3d')][_0x21bb('0x62')]()[_0x21bb('0x21')](respondWithResult(_0x1de11d,null))['catch'](handleError(_0x1de11d,null));};exports[_0x21bb('0x63')]=function(_0x20a495,_0x2819e4,_0x4fd2ae){if(_0x20a495[_0x21bb('0x5a')]['id']){delete _0x20a495['body']['id'];}return db[_0x21bb('0x3d')][_0x21bb('0x58')]({'where':{'id':_0x20a495[_0x21bb('0x57')]['id']}})['then'](handleEntityNotFound(_0x2819e4,null))[_0x21bb('0x21')](function(_0x2b4724){if(_0x2b4724){_0x20a495[_0x21bb('0x5a')][_0x21bb('0x64')]=_0x2b4724['id'];return db[_0x21bb('0x65')]['create'](_0x20a495['body']);}})[_0x21bb('0x21')](respondWithResult(_0x2819e4,null))[_0x21bb('0x2c')](handleError(_0x2819e4,null));};exports[_0x21bb('0x66')]=function(_0x3b27bb,_0x3c3eb5,_0x5d495b){var _0x3a60b9={'raw':![],'where':{}};var _0x1a7a33={};var _0x12babf={'count':0x0,'rows':[]};return db[_0x21bb('0x3d')]['findOne']({'where':{'id':_0x3b27bb[_0x21bb('0x57')]['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x3c3eb5,null))[_0x21bb('0x21')](function(_0x1f070d){if(_0x1f070d){_0x1a7a33['model']=_['keys'](db[_0x21bb('0x65')][_0x21bb('0x3e')]);_0x1a7a33[_0x21bb('0x42')]=_['keys'](_0x3b27bb[_0x21bb('0x42')]);_0x1a7a33[_0x21bb('0x4c')]=_[_0x21bb('0x45')](_0x1a7a33[_0x21bb('0x41')],_0x1a7a33[_0x21bb('0x42')]);_0x3a60b9['attributes']=_[_0x21bb('0x45')](_0x1a7a33['model'],qs['fields'](_0x3b27bb[_0x21bb('0x42')][_0x21bb('0x46')]));_0x3a60b9[_0x21bb('0x44')]=_0x3a60b9[_0x21bb('0x44')]['length']?_0x3a60b9[_0x21bb('0x44')]:_0x1a7a33['model'];if(!_0x3b27bb[_0x21bb('0x42')][_0x21bb('0x67')]('nolimit')){_0x3a60b9[_0x21bb('0x48')]=qs[_0x21bb('0x48')](_0x3b27bb['query'][_0x21bb('0x48')]);_0x3a60b9['offset']=qs[_0x21bb('0x31')](_0x3b27bb[_0x21bb('0x42')][_0x21bb('0x31')]);}_0x3a60b9[_0x21bb('0x49')]=qs[_0x21bb('0x4a')](_0x3b27bb[_0x21bb('0x42')]['sort']);_0x3a60b9[_0x21bb('0x4b')]=qs['filters'](_['pick'](_0x3b27bb[_0x21bb('0x42')],_0x1a7a33['filters']));_0x3a60b9[_0x21bb('0x4b')][_0x21bb('0x64')]=_0x1f070d['id'];if(_0x3b27bb[_0x21bb('0x42')][_0x21bb('0x4f')]){_0x3a60b9[_0x21bb('0x4b')]=_[_0x21bb('0x50')](_0x3a60b9[_0x21bb('0x4b')],{'$or':_[_0x21bb('0x3c')](_0x3a60b9[_0x21bb('0x44')],function(_0x35c614){var _0x45a0fe={};_0x45a0fe[_0x35c614]={'$like':'%'+_0x3b27bb[_0x21bb('0x42')][_0x21bb('0x4f')]+'%'};return _0x45a0fe;})});}_0x3a60b9=_[_0x21bb('0x50')]({},_0x3a60b9,_0x3b27bb['options']);return db[_0x21bb('0x65')][_0x21bb('0x30')]({'where':_0x3a60b9['where']})[_0x21bb('0x21')](function(_0x239669){_0x12babf[_0x21bb('0x30')]=_0x239669;if(_0x3b27bb[_0x21bb('0x42')][_0x21bb('0x52')]){_0x3a60b9[_0x21bb('0x53')]=[{'all':!![]}];}return db[_0x21bb('0x65')]['findAll'](_0x3a60b9);})[_0x21bb('0x21')](function(_0x45eb11){_0x12babf[_0x21bb('0x55')]=_0x45eb11;return _0x12babf;});}})[_0x21bb('0x21')](respondWithFilteredResult(_0x3c3eb5,_0x3a60b9))[_0x21bb('0x2c')](handleError(_0x3c3eb5,null));};exports['removeDispositions']=function(_0x4aaae6,_0x5f3de3,_0x460987){return db[_0x21bb('0x3d')]['find']({'where':{'id':_0x4aaae6[_0x21bb('0x57')]['id']}})['then'](handleEntityNotFound(_0x5f3de3,null))[_0x21bb('0x21')](function(_0x480864){if(_0x480864){return _0x480864[_0x21bb('0x68')](_0x4aaae6[_0x21bb('0x42')][_0x21bb('0x69')]);}})[_0x21bb('0x21')](respondWithStatusCode(_0x5f3de3,null))[_0x21bb('0x2c')](handleError(_0x5f3de3,null));};exports[_0x21bb('0x6a')]=function(_0x513590,_0x15e85f,_0x2adde5){if(_0x513590[_0x21bb('0x5a')]['id']){delete _0x513590[_0x21bb('0x5a')]['id'];}return db[_0x21bb('0x3d')][_0x21bb('0x58')]({'where':{'id':_0x513590[_0x21bb('0x57')]['id']}})['then'](handleEntityNotFound(_0x15e85f,null))[_0x21bb('0x21')](function(_0x496966){if(_0x496966){_0x513590['body']['FaxAccountId']=_0x496966['id'];return db[_0x21bb('0x6b')][_0x21bb('0x59')](_0x513590['body']);}})[_0x21bb('0x21')](respondWithResult(_0x15e85f,null))[_0x21bb('0x2c')](handleError(_0x15e85f,null));};exports[_0x21bb('0x6c')]=function(_0x1a41ce,_0x16fb0f,_0x3cb5fd){var _0x26fa9a={'raw':![],'where':{}};var _0x3b83c0={};var _0x43e204={'count':0x0,'rows':[]};return db['FaxAccount'][_0x21bb('0x6d')]({'where':{'id':_0x1a41ce[_0x21bb('0x57')]['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x16fb0f,null))[_0x21bb('0x21')](function(_0x38f305){if(_0x38f305){_0x3b83c0[_0x21bb('0x41')]=_['keys'](db[_0x21bb('0x6b')]['rawAttributes']);_0x3b83c0[_0x21bb('0x42')]=_[_0x21bb('0x43')](_0x1a41ce['query']);_0x3b83c0[_0x21bb('0x4c')]=_[_0x21bb('0x45')](_0x3b83c0[_0x21bb('0x41')],_0x3b83c0[_0x21bb('0x42')]);_0x26fa9a['attributes']=_[_0x21bb('0x45')](_0x3b83c0['model'],qs['fields'](_0x1a41ce[_0x21bb('0x42')]['fields']));_0x26fa9a[_0x21bb('0x44')]=_0x26fa9a[_0x21bb('0x44')]['length']?_0x26fa9a[_0x21bb('0x44')]:_0x3b83c0[_0x21bb('0x41')];if(!_0x1a41ce[_0x21bb('0x42')][_0x21bb('0x67')](_0x21bb('0x6e'))){_0x26fa9a[_0x21bb('0x48')]=qs[_0x21bb('0x48')](_0x1a41ce[_0x21bb('0x42')][_0x21bb('0x48')]);_0x26fa9a[_0x21bb('0x31')]=qs[_0x21bb('0x31')](_0x1a41ce[_0x21bb('0x42')][_0x21bb('0x31')]);}_0x26fa9a[_0x21bb('0x49')]=qs['sort'](_0x1a41ce[_0x21bb('0x42')][_0x21bb('0x4a')]);_0x26fa9a[_0x21bb('0x4b')]=qs['filters'](_[_0x21bb('0x4d')](_0x1a41ce[_0x21bb('0x42')],_0x3b83c0['filters']));_0x26fa9a[_0x21bb('0x4b')][_0x21bb('0x64')]=_0x38f305['id'];if(_0x1a41ce[_0x21bb('0x42')][_0x21bb('0x4f')]){_0x26fa9a[_0x21bb('0x4b')]=_[_0x21bb('0x50')](_0x26fa9a['where'],{'$or':_[_0x21bb('0x3c')](_0x26fa9a[_0x21bb('0x44')],function(_0xc4f3f0){var _0x2822c9={};_0x2822c9[_0xc4f3f0]={'$like':'%'+_0x1a41ce[_0x21bb('0x42')][_0x21bb('0x4f')]+'%'};return _0x2822c9;})});}_0x26fa9a=_['merge']({},_0x26fa9a,_0x1a41ce[_0x21bb('0x51')]);return db[_0x21bb('0x6b')][_0x21bb('0x30')]({'where':_0x26fa9a[_0x21bb('0x4b')]})[_0x21bb('0x21')](function(_0x5aa874){_0x43e204[_0x21bb('0x30')]=_0x5aa874;if(_0x1a41ce[_0x21bb('0x42')][_0x21bb('0x52')]){_0x26fa9a[_0x21bb('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x21bb('0x54')](_0x26fa9a);})[_0x21bb('0x21')](function(_0x4d5da0){_0x43e204[_0x21bb('0x55')]=_0x4d5da0;return _0x43e204;});}})[_0x21bb('0x21')](respondWithFilteredResult(_0x16fb0f,_0x26fa9a))[_0x21bb('0x2c')](handleError(_0x16fb0f,null));};exports[_0x21bb('0x6f')]=function(_0x1ec6f3,_0xdce08c,_0x15e306){return db[_0x21bb('0x3d')][_0x21bb('0x58')]({'where':{'id':_0x1ec6f3[_0x21bb('0x57')]['id']}})['then'](handleEntityNotFound(_0xdce08c,null))[_0x21bb('0x21')](function(_0x4e2d4f){if(_0x4e2d4f){return _0x4e2d4f['removeAnswers'](_0x1ec6f3[_0x21bb('0x42')][_0x21bb('0x69')]);}})['then'](respondWithStatusCode(_0xdce08c,null))[_0x21bb('0x2c')](handleError(_0xdce08c,null));};exports[_0x21bb('0x70')]=function(_0x173191,_0x47edb9,_0x34d240){return db[_0x21bb('0x71')][_0x21bb('0x58')]({'where':{'id':_0x173191['params']['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x47edb9,null))[_0x21bb('0x21')](function(_0x30493f){if(_0x30493f){return _0x30493f[_0x21bb('0x70')](_0x173191[_0x21bb('0x5a')][_0x21bb('0x69')],_[_0x21bb('0x72')](_0x173191[_0x21bb('0x5a')],[_0x21bb('0x69'),'id'])||{});}})[_0x21bb('0x21')](respondWithResult(_0x47edb9,null))[_0x21bb('0x2c')](handleError(_0x47edb9,null));};exports[_0x21bb('0x73')]=function(_0x6da778,_0x3d416f,_0x287a8f){var _0xb518a8={'raw':![],'where':{}};var _0x2dc7c6={};var _0x1890bc={'count':0x0,'rows':[]};return db[_0x21bb('0x3d')][_0x21bb('0x6d')]({'where':{'id':_0x6da778['params']['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x3d416f,null))[_0x21bb('0x21')](function(_0x4ac496){if(_0x4ac496){_0x2dc7c6[_0x21bb('0x41')]=_['keys'](db[_0x21bb('0x71')][_0x21bb('0x3e')]);_0x2dc7c6[_0x21bb('0x42')]=_[_0x21bb('0x43')](_0x6da778[_0x21bb('0x42')]);_0x2dc7c6['filters']=_['intersection'](_0x2dc7c6[_0x21bb('0x41')],_0x2dc7c6[_0x21bb('0x42')]);_0xb518a8[_0x21bb('0x44')]=_[_0x21bb('0x45')](_0x2dc7c6[_0x21bb('0x41')],qs['fields'](_0x6da778[_0x21bb('0x42')][_0x21bb('0x46')]));_0xb518a8[_0x21bb('0x44')]=_0xb518a8[_0x21bb('0x44')][_0x21bb('0x47')]?_0xb518a8[_0x21bb('0x44')]:_0x2dc7c6[_0x21bb('0x41')];if(!_0x6da778[_0x21bb('0x42')][_0x21bb('0x67')](_0x21bb('0x6e'))){_0xb518a8[_0x21bb('0x48')]=qs['limit'](_0x6da778[_0x21bb('0x42')][_0x21bb('0x48')]);_0xb518a8[_0x21bb('0x31')]=qs[_0x21bb('0x31')](_0x6da778[_0x21bb('0x42')]['offset']);}_0xb518a8[_0x21bb('0x49')]=qs[_0x21bb('0x4a')](_0x6da778[_0x21bb('0x42')]['sort']);_0xb518a8[_0x21bb('0x4b')]=qs[_0x21bb('0x4c')](_[_0x21bb('0x4d')](_0x6da778[_0x21bb('0x42')],_0x2dc7c6[_0x21bb('0x4c')]));_0xb518a8['where'][_0x21bb('0x64')]=_0x4ac496['id'];if(_0x6da778['query'][_0x21bb('0x4f')]){_0xb518a8[_0x21bb('0x4b')]=_['merge'](_0xb518a8[_0x21bb('0x4b')],{'$or':_['map'](_0xb518a8[_0x21bb('0x44')],function(_0xe71316){var _0x207264={};_0x207264[_0xe71316]={'$like':'%'+_0x6da778[_0x21bb('0x42')][_0x21bb('0x4f')]+'%'};return _0x207264;})});}_0xb518a8=_[_0x21bb('0x50')]({},_0xb518a8,_0x6da778[_0x21bb('0x51')]);return db[_0x21bb('0x71')]['count']({'where':_0xb518a8[_0x21bb('0x4b')]})[_0x21bb('0x21')](function(_0x58163b){_0x1890bc['count']=_0x58163b;if(_0x6da778[_0x21bb('0x42')][_0x21bb('0x52')]){_0xb518a8[_0x21bb('0x53')]=[{'model':db['CmContact'],'as':_0x21bb('0x74'),'required':![]},{'model':db[_0x21bb('0x75')],'as':_0x21bb('0x76'),'attributes':[_0x21bb('0x38'),_0x21bb('0x77'),_0x21bb('0x78')],'required':![]},{'model':db[_0x21bb('0x79')],'as':_0x21bb('0x7a'),'attributes':['id',_0x21bb('0x38'),_0x21bb('0x7b')],'where':_0x6da778[_0x21bb('0x42')][_0x21bb('0x7c')]?{'id':_0x6da778[_0x21bb('0x42')]['tag']}:undefined,'required':_0x6da778['query'][_0x21bb('0x7c')]?!![]:![]}];}return db[_0x21bb('0x71')][_0x21bb('0x54')](_0xb518a8);})[_0x21bb('0x21')](function(_0x41529a){_0x1890bc[_0x21bb('0x55')]=_0x41529a;return _0x1890bc;});}})[_0x21bb('0x21')](respondWithFilteredResult(_0x3d416f,_0xb518a8))[_0x21bb('0x2c')](handleError(_0x3d416f,null));};exports[_0x21bb('0x7d')]=function(_0x40fb8,_0x3b95ac,_0x8d73fe){return db[_0x21bb('0x3d')][_0x21bb('0x6d')]({'where':{'id':_0x40fb8[_0x21bb('0x57')]['id']}})['then'](handleEntityNotFound(_0x3b95ac,null))[_0x21bb('0x21')](function(_0x2765f1){if(_0x2765f1){return db[_0x21bb('0x7e')][_0x21bb('0x7f')](function(_0x477106){return db[_0x21bb('0x80')]['destroy']({'where':{'FaxAccountId':_0x40fb8[_0x21bb('0x57')]['id']},'transaction':_0x477106})['then'](function(_0x594c8f){var _0x492781=_['map'](_0x40fb8[_0x21bb('0x5a')],function(_0xfde673){_0xfde673[_0x21bb('0x64')]=_0x40fb8[_0x21bb('0x57')]['id'];return _0xfde673;});return db[_0x21bb('0x80')][_0x21bb('0x81')](_0x492781,{'transaction':_0x477106});});})[_0x21bb('0x21')](function(){return db[_0x21bb('0x80')][_0x21bb('0x82')]({'where':{'FaxAccountId':_0x40fb8[_0x21bb('0x57')]['id']},'order':_0x21bb('0x83')});});}})[_0x21bb('0x21')](respondWithResult(_0x3b95ac,null))[_0x21bb('0x2c')](handleError(_0x3b95ac,null));};exports[_0x21bb('0x84')]=function(_0x24fa6c,_0x1b26c2,_0x137170){var _0x2c6df6={};var _0x3c132d={};var _0x538c43;var _0x1ca3c6;return db['FaxAccount'][_0x21bb('0x6d')]({'where':{'id':_0x24fa6c[_0x21bb('0x57')]['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x1b26c2,null))[_0x21bb('0x21')](function(_0x257738){if(_0x257738){_0x538c43=_0x257738;_0x3c132d['model']=_[_0x21bb('0x43')](db[_0x21bb('0x80')][_0x21bb('0x3e')]);_0x3c132d[_0x21bb('0x42')]=_['keys'](_0x24fa6c[_0x21bb('0x42')]);_0x3c132d['filters']=_[_0x21bb('0x45')](_0x3c132d[_0x21bb('0x41')],_0x3c132d[_0x21bb('0x42')]);_0x2c6df6[_0x21bb('0x44')]=_[_0x21bb('0x45')](_0x3c132d[_0x21bb('0x41')],qs[_0x21bb('0x46')](_0x24fa6c[_0x21bb('0x42')][_0x21bb('0x46')]));_0x2c6df6[_0x21bb('0x44')]=_0x2c6df6[_0x21bb('0x44')][_0x21bb('0x47')]?_0x2c6df6['attributes']:_0x3c132d[_0x21bb('0x41')];_0x2c6df6[_0x21bb('0x49')]=qs[_0x21bb('0x4a')](_0x24fa6c[_0x21bb('0x42')]['sort']);_0x2c6df6[_0x21bb('0x4b')]=qs[_0x21bb('0x4c')](_[_0x21bb('0x4d')](_0x24fa6c[_0x21bb('0x42')],_0x3c132d[_0x21bb('0x4c')]));if(_0x24fa6c[_0x21bb('0x42')]['filter']){_0x2c6df6[_0x21bb('0x4b')]=_[_0x21bb('0x50')](_0x2c6df6['where'],{'$or':_[_0x21bb('0x3c')](_0x2c6df6[_0x21bb('0x44')],function(_0x2b9a4b){var _0x21421d={};_0x21421d[_0x2b9a4b]={'$like':'%'+_0x24fa6c[_0x21bb('0x42')]['filter']+'%'};return _0x21421d;})});}_0x2c6df6=_[_0x21bb('0x50')]({},_0x2c6df6,_0x24fa6c[_0x21bb('0x51')]);return _0x538c43[_0x21bb('0x84')](_0x2c6df6);}})['then'](function(_0x3b374f){if(_0x3b374f){_0x1ca3c6=_0x3b374f['length'];if(!_0x24fa6c['query']['hasOwnProperty'](_0x21bb('0x6e'))){_0x2c6df6[_0x21bb('0x48')]=qs['limit'](_0x24fa6c['query'][_0x21bb('0x48')]);_0x2c6df6['offset']=qs[_0x21bb('0x31')](_0x24fa6c[_0x21bb('0x42')][_0x21bb('0x31')]);}return _0x538c43['getApplications'](_0x2c6df6);}})[_0x21bb('0x21')](function(_0x479b0b){if(_0x479b0b){return _0x479b0b?{'count':_0x1ca3c6,'rows':_0x479b0b}:null;}})['then'](respondWithResult(_0x1b26c2,null))[_0x21bb('0x2c')](handleError(_0x1b26c2,null));};function Extension(_0x36c666,_0x3ad209,_0x534219,_0x496b02){this[_0x21bb('0x85')]=_0x21bb('0x86');this[_0x21bb('0x87')]=_0x36c666[_0x21bb('0x88')];this[_0x21bb('0x89')]=_0x496b02;this['type']=_0x21bb('0x8a');this[_0x21bb('0x8b')]='Fax\x20Extension';this[_0x21bb('0x64')]=_0x36c666['id'];this['priority']=_0x3ad209;this[_0x21bb('0x8c')]=_0x534219;}function createExtensionsReciveFax(_0x41043b){var _0x11f98d=0x1;var _0x1b47dd=[];_0x1b47dd[_0x21bb('0x8d')](new Extension(_0x41043b,_0x11f98d,'','Answer'));_0x11f98d+=0x1;_0x1b47dd['push'](new Extension(_0x41043b,_0x11f98d,_0x21bb('0x8e'),_0x21bb('0x8f')));_0x11f98d+=0x1;for(var _0x5af769 in _0x41043b){if(_0x41043b[_0x21bb('0x67')](_0x5af769)&&(_0x5af769===_0x21bb('0x90')||_0x5af769===_0x21bb('0x88')||_0x5af769==='gateway'||_0x5af769===_0x21bb('0x91')||_0x5af769===_0x21bb('0x92')||_0x5af769==='maxrate'||_0x5af769===_0x21bb('0x93')||_0x5af769===_0x21bb('0x94')||_0x5af769==='t38timeout')){_0x1b47dd[_0x21bb('0x8d')](new Extension(_0x41043b,_0x11f98d,_0x21bb('0x95')+_0x5af769+')='+_0x41043b[_0x5af769],_0x21bb('0x8f')));_0x11f98d+=0x1;}}_0x1b47dd[_0x21bb('0x8d')](new Extension(_0x41043b,_0x11f98d,'6',_0x21bb('0x96')));_0x11f98d+=0x1;_0x1b47dd[_0x21bb('0x8d')](new Extension(_0x41043b,_0x11f98d,_0x21bb('0x97'),_0x21bb('0x98')));_0x11f98d=0x0;return _0x1b47dd;}exports[_0x21bb('0x99')]=function(_0x1d5144,_0x17bd49,_0x5be2f4){var _0x202518;return db[_0x21bb('0x7e')][_0x21bb('0x7f')](function(_0x54054b){return db[_0x21bb('0x3d')]['create'](_0x1d5144[_0x21bb('0x5a')],{'transaction':_0x54054b})['then'](function(_0x245e11){_0x202518=_0x245e11[_0x21bb('0x5c')]({'plain':!![]});return db[_0x21bb('0x9a')][_0x21bb('0x81')](createExtensionsReciveFax(_0x202518),{'transaction':_0x54054b});});})[_0x21bb('0x21')](function(){return _0x202518;})[_0x21bb('0x21')](respondWithResult(_0x17bd49,null))[_0x21bb('0x2c')](handleError(_0x17bd49,null));};exports[_0x21bb('0x9b')]=function(_0x369a78,_0x336db,_0x5ac94b){var _0x14a24b;return db[_0x21bb('0x7e')][_0x21bb('0x7f')](function(_0x26460e){return db[_0x21bb('0x3d')][_0x21bb('0x34')](_0x369a78['body'],{'where':{'id':_0x369a78[_0x21bb('0x5a')]['id']},'transaction':_0x26460e})[_0x21bb('0x21')](function(_0x39497f){return db[_0x21bb('0x9a')][_0x21bb('0x37')]({'where':{'FaxAccountId':_0x369a78[_0x21bb('0x5a')]['id']},'transaction':_0x26460e})[_0x21bb('0x21')](function(_0xa2874d){return db[_0x21bb('0x9a')][_0x21bb('0x81')](createExtensionsReciveFax(_[_0x21bb('0x72')](_0x369a78[_0x21bb('0x5a')],[_0x21bb('0x9c'),_0x21bb('0x40'),_0x21bb('0x9d'),_0x21bb('0x9e'),_0x21bb('0x9f'),_0x21bb('0xa0')])),{'transaction':_0x26460e});});});})[_0x21bb('0x21')](function(){return db[_0x21bb('0x3d')]['findById'](_0x369a78[_0x21bb('0x5a')]['id']);})['then'](respondWithResult(_0x336db,null))[_0x21bb('0x2c')](handleError(_0x336db,null));};exports[_0x21bb('0xa1')]=function(_0x54a869,_0x26bf9d,_0x3b8747){var _0x2b7d4f={'raw':!![],'where':{}};var _0xf86067={};var _0x43969c={'count':0x0,'rows':[]};return db['FaxAccount'][_0x21bb('0x6d')]({'where':{'id':_0x54a869[_0x21bb('0x57')]['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x26bf9d,null))[_0x21bb('0x21')](function(_0x10d97a){if(_0x10d97a){_0xf86067[_0x21bb('0x41')]=_['keys'](db[_0x21bb('0xa2')][_0x21bb('0x3e')]);_0xf86067['query']=_[_0x21bb('0x43')](_0x54a869['query']);_0xf86067['filters']=_['intersection'](_0xf86067['model'],_0xf86067[_0x21bb('0x42')]);_0x2b7d4f['attributes']=_['intersection'](_0xf86067['model'],qs[_0x21bb('0x46')](_0x54a869['query'][_0x21bb('0x46')]));_0x2b7d4f[_0x21bb('0x44')]=_0x2b7d4f[_0x21bb('0x44')][_0x21bb('0x47')]?_0x2b7d4f[_0x21bb('0x44')]:_0xf86067[_0x21bb('0x41')];if(!_0x54a869[_0x21bb('0x42')][_0x21bb('0x67')](_0x21bb('0x6e'))){_0x2b7d4f[_0x21bb('0x48')]=qs[_0x21bb('0x48')](_0x54a869[_0x21bb('0x42')]['limit']);_0x2b7d4f['offset']=qs[_0x21bb('0x31')](_0x54a869['query']['offset']);}_0x2b7d4f[_0x21bb('0x49')]=qs[_0x21bb('0x4a')](_0x54a869[_0x21bb('0x42')][_0x21bb('0x4a')]);_0x2b7d4f['where']=qs[_0x21bb('0x4c')](_[_0x21bb('0x4d')](_0x54a869[_0x21bb('0x42')],_0xf86067[_0x21bb('0x4c')]));_0x2b7d4f['where'][_0x21bb('0x64')]=_0x10d97a['id'];if(_0x54a869[_0x21bb('0x42')][_0x21bb('0x4f')]){_0x2b7d4f['where']=_[_0x21bb('0x50')](_0x2b7d4f[_0x21bb('0x4b')],{'$or':_[_0x21bb('0x3c')](_0x2b7d4f['attributes'],function(_0x5ca9cc){var _0x38b886={};_0x38b886[_0x5ca9cc]={'$like':'%'+_0x54a869[_0x21bb('0x42')][_0x21bb('0x4f')]+'%'};return _0x38b886;})});}if(_0x54a869[_0x21bb('0x42')]['$gte']){var _0x10429e=_0x54a869[_0x21bb('0x42')]['$gte'][_0x21bb('0xa3')](',');var _0x525fb0={};_0x525fb0[_0x10429e[0x0]]={'$gte':moment(_0x10429e[0x1])[_0x21bb('0xa4')](_0x21bb('0xa5'))};_0x2b7d4f[_0x21bb('0x4b')]=_['merge'](_0x2b7d4f['where'],_0x525fb0);}_0x2b7d4f=_[_0x21bb('0x50')]({},_0x2b7d4f,_0x54a869[_0x21bb('0x51')]);return db[_0x21bb('0xa2')][_0x21bb('0x30')]({'where':_0x2b7d4f[_0x21bb('0x4b')]})[_0x21bb('0x21')](function(_0x21102a){_0x43969c['count']=_0x21102a;if(_0x54a869[_0x21bb('0x42')][_0x21bb('0x52')]){_0x2b7d4f[_0x21bb('0x53')]=[{'all':!![]}];}return db[_0x21bb('0xa2')][_0x21bb('0x54')](_0x2b7d4f);})[_0x21bb('0x21')](function(_0x39a398){_0x43969c[_0x21bb('0x55')]=_0x39a398;return _0x43969c;});}})[_0x21bb('0x21')](respondWithFilteredResult(_0x26bf9d,_0x2b7d4f))[_0x21bb('0x2c')](handleError(_0x26bf9d,null));};exports[_0x21bb('0x39')]=function(_0x796652,_0x32d012,_0x4a5db9){var _0x98d9c,_0x13a0de={},_0x1f61e9;if(_0x796652[_0x21bb('0x5a')]['to']){_0x1f61e9=_0x796652[_0x21bb('0x5a')]['to'][0x0];}return db[_0x21bb('0x3d')][_0x21bb('0x58')]({'where':{'id':_0x796652[_0x21bb('0x57')]['id']},'include':[{'model':db[_0x21bb('0xa6')],'as':_0x21bb('0xa7'),'include':[{'model':db[_0x21bb('0xa8')],'as':_0x21bb('0xa9'),'where':{'fax':_0x1f61e9},'limit':0x1,'order':[[_0x21bb('0x9e'),_0x21bb('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x32d012,null))[_0x21bb('0x21')](function(_0x2bcb56){_0x98d9c=_0x2bcb56;if(_0x796652[_0x21bb('0x5a')]['attachments']&&_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][_0x21bb('0x47')]){for(var _0x43477a=0x0;_0x43477a<_0x796652['body'][_0x21bb('0xab')][_0x21bb('0x47')];_0x43477a+=0x1){_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][_0x43477a]={'filename':_0x796652[_0x21bb('0x5a')]['attachments'][_0x43477a][_0x21bb('0x38')],'id':_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][_0x43477a]['id'],'path':path['join'](config[_0x21bb('0xac')],_0x21bb('0xad'),_0x796652[_0x21bb('0x5a')]['attachments'][_0x43477a]['basename'])};}}return respondWithRpcPromise(_0x21bb('0xae'),'CheckAfterSend',{'FaxAccountId':_[_0x21bb('0xaf')](_0x796652[_0x21bb('0x57')]['id'])?undefined:_0x796652[_0x21bb('0x57')]['id'],'path':_[_0x21bb('0xaf')](_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][0x0][_0x21bb('0x7')])?undefined:_0x796652['body'][_0x21bb('0xab')][0x0][_0x21bb('0x7')],'fax':_[_0x21bb('0xaf')](_0x796652[_0x21bb('0x5a')]['to'][0x0])?undefined:_0x796652[_0x21bb('0x5a')]['to'][0x0]},client9002);})[_0x21bb('0x21')](function(){if(_0x98d9c){if(_[_0x21bb('0xaf')](_0x796652[_0x21bb('0x5a')][_0x21bb('0xb0')])){_0x796652[_0x21bb('0x5a')][_0x21bb('0xb0')]=util[_0x21bb('0xa4')]('\x22%s\x22\x20<%s>',_0x98d9c[_0x21bb('0x38')],_0x98d9c[_0x21bb('0xb1')]);}if(_0x98d9c[_0x21bb('0xa7')]){if(_0x98d9c['List'][_0x21bb('0xa9')][_0x21bb('0x47')]){return _0x98d9c[_0x21bb('0xa7')][_0x21bb('0xa9')][0x0];}else{return db[_0x21bb('0xa8')][_0x21bb('0x59')](_[_0x21bb('0xb2')](_0x796652[_0x21bb('0x5a')],{'firstName':_0x796652[_0x21bb('0x5a')]['to'][0x0],'phone':_0x796652[_0x21bb('0x5a')]['to'][0x0],'fax':_0x796652['body']['to'][0x0],'ListId':_0x98d9c[_0x21bb('0xa0')]}));}}else{throw new Error(_0x21bb('0xb3'));}}else{throw new Error(_0x21bb('0xb4'));}})['then'](function(_0x36c224){if(_0x36c224){return db[_0x21bb('0x71')][_0x21bb('0x58')]({'where':{'ContactId':_0x36c224['id'],'closed':![],'FaxAccountId':_0x98d9c['id']}})[_0x21bb('0x21')](function(_0x283fcb){if(_0x283fcb){return[_0x283fcb,![]];}return db[_0x21bb('0x71')][_0x21bb('0x59')]({'UserId':_0x796652['user']['id'],'ContactId':_0x36c224['id'],'FaxAccountId':_0x98d9c['id'],'fax':_0x796652[_0x21bb('0x5a')]['to'][0x0],'firstMsgDirection':_0x21bb('0xb5'),'Messages':[_[_0x21bb('0x50')](_0x796652[_0x21bb('0x5a')],{'read':![],'body':_0x796652[_0x21bb('0x5a')]['attachments'][0x0][_0x21bb('0xb6')],'FaxAccountId':_0x98d9c['id'],'UserId':_0x796652[_0x21bb('0x5b')]['id'],'ContactId':_0x36c224['id'],'AttachmentId':_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][0x0]['id']})]},{'include':[{'model':db[_0x21bb('0xa2')],'as':'Messages'}]})[_0x21bb('0x21')](function(_0x286f5e){return[_0x286f5e,!![]];});});}else{throw new Error(_0x21bb('0xb7'));}})['spread'](function(_0x71da22,_0x524c21){if(_0x524c21){return _0x71da22;}return db[_0x21bb('0xa2')][_0x21bb('0x59')]({'direction':_0x21bb('0xb5'),'read':![],'body':_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][0x0]['filename'],'FaxAccountId':_0x98d9c['id'],'FaxInteractionId':_0x71da22['id'],'UserId':_0x796652[_0x21bb('0x5b')]['id'],'ContactId':_0x71da22[_0x21bb('0xb8')],'AttachmentId':_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][0x0]['id']})[_0x21bb('0x21')](function(_0xa15077){_0x71da22['dataValues']['Messages']=[];_0x71da22['dataValues']['Messages']['push'](_0xa15077[_0x21bb('0xb9')]);return _0x71da22;});})[_0x21bb('0x21')](function(_0x17db78){respondWithRpcPromise('SendFax',_0x21bb('0xba'),{'FaxAccountId':_['isNil'](_0x796652[_0x21bb('0x57')]['id'])?undefined:_0x796652[_0x21bb('0x57')]['id'],'path':_[_0x21bb('0xaf')](_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][0x0]['path'])?undefined:_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][0x0]['path'],'fax':_[_0x21bb('0xaf')](_0x796652[_0x21bb('0x5a')]['to'][0x0])?undefined:_0x796652[_0x21bb('0x5a')]['to'][0x0],'AttachmentId':_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][0x0]['id']},client9002)[_0x21bb('0x21')](function(_0x2f1d64){logger[_0x21bb('0x22')]('SendFaxRpc,\x20%s',_0x2f1d64);})[_0x21bb('0x2c')](function(_0x247253){logger[_0x21bb('0x22')](_0x21bb('0xbb'),_0x247253);});return _0x17db78;})[_0x21bb('0x21')](respondWithResult(_0x32d012,null))[_0x21bb('0x2c')](handleError(_0x32d012,null));};exports[_0x21bb('0xbc')]=function(_0x400245,_0x3e4bea,_0x51fad8){return db[_0x21bb('0x3d')]['find']({'where':{'id':_0x400245[_0x21bb('0x57')]['id']}})['then'](handleEntityNotFound(_0x3e4bea,null))[_0x21bb('0x21')](function(_0x18c1d4){if(_0x18c1d4){return _0x18c1d4[_0x21bb('0xbc')](_0x400245[_0x21bb('0x5a')][_0x21bb('0x69')],_[_0x21bb('0x72')](_0x400245['body'],[_0x21bb('0x69'),'id'])||{})[_0x21bb('0xbd')](function(_0x49cd90){for(var _0x10aaa0=0x0;_0x10aaa0<_0x400245['body'][_0x21bb('0x69')][_0x21bb('0x47')];_0x10aaa0+=0x1){socket['emit'](_0x21bb('0xbe'),{'UserId':_0x400245['body'][_0x21bb('0x69')][_0x10aaa0],'FaxAccountId':_0x400245[_0x21bb('0x57')]['id']});}return _0x49cd90;});}})[_0x21bb('0x21')](respondWithResult(_0x3e4bea,null))[_0x21bb('0x2c')](handleError(_0x3e4bea,null));};exports['removeAgents']=function(_0x4cd0dc,_0x4d2608,_0x18d33e){return db[_0x21bb('0x3d')]['find']({'where':{'id':_0x4cd0dc[_0x21bb('0x57')]['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x4d2608,null))[_0x21bb('0x21')](function(_0x1365f7){if(_0x1365f7){return _0x1365f7[_0x21bb('0xbf')](_0x4cd0dc[_0x21bb('0x42')][_0x21bb('0x69')])[_0x21bb('0x21')](function(){if(_['isArray'](_0x4cd0dc[_0x21bb('0x42')][_0x21bb('0x69')])){for(var _0x45a0a9=0x0;_0x45a0a9<_0x4cd0dc[_0x21bb('0x42')][_0x21bb('0x69')][_0x21bb('0x47')];_0x45a0a9+=0x1){socket[_0x21bb('0xc0')](_0x21bb('0xc1'),{'UserId':Number(_0x4cd0dc['query'][_0x21bb('0x69')][_0x45a0a9]),'FaxAccountId':Number(_0x4cd0dc['params']['id'])});}}else{socket[_0x21bb('0xc0')](_0x21bb('0xc1'),{'UserId':Number(_0x4cd0dc[_0x21bb('0x42')][_0x21bb('0x69')]),'FaxAccountId':Number(_0x4cd0dc[_0x21bb('0x57')]['id'])});}});}})[_0x21bb('0x21')](respondWithStatusCode(_0x4d2608,null))[_0x21bb('0x2c')](handleError(_0x4d2608,null));};exports[_0x21bb('0xc2')]=function(_0xd02aab,_0x1b9eb4,_0x1000c3){var _0xd0fe1c={};var _0x15b315={};var _0x5dbeee;var _0x27cc7a;return db[_0x21bb('0x3d')]['findOne']({'where':{'id':_0xd02aab[_0x21bb('0x57')]['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x1b9eb4,null))[_0x21bb('0x21')](function(_0x3970c7){if(_0x3970c7){_0x5dbeee=_0x3970c7;_0x15b315[_0x21bb('0x41')]=_[_0x21bb('0x43')](db[_0x21bb('0x75')][_0x21bb('0x3e')]);_0x15b315[_0x21bb('0x42')]=_[_0x21bb('0x43')](_0xd02aab[_0x21bb('0x42')]);_0x15b315['filters']=_['intersection'](_0x15b315[_0x21bb('0x41')],_0x15b315['query']);_0xd0fe1c[_0x21bb('0x44')]=_[_0x21bb('0x45')](_0x15b315['model'],qs[_0x21bb('0x46')](_0xd02aab['query']['fields']));_0xd0fe1c[_0x21bb('0x44')]=_0xd0fe1c['attributes'][_0x21bb('0x47')]?_0xd0fe1c[_0x21bb('0x44')]:_0x15b315['model'];_0xd0fe1c[_0x21bb('0x49')]=qs[_0x21bb('0x4a')](_0xd02aab[_0x21bb('0x42')][_0x21bb('0x4a')]);_0xd0fe1c[_0x21bb('0x4b')]=qs[_0x21bb('0x4c')](_['pick'](_0xd02aab[_0x21bb('0x42')],_0x15b315[_0x21bb('0x4c')]));if(_0xd02aab['query'][_0x21bb('0x4f')]){_0xd0fe1c[_0x21bb('0x4b')]=_['merge'](_0xd0fe1c[_0x21bb('0x4b')],{'$or':_['map'](_0xd0fe1c[_0x21bb('0x44')],function(_0x203795){var _0x38c9cd={};_0x38c9cd[_0x203795]={'$like':'%'+_0xd02aab[_0x21bb('0x42')][_0x21bb('0x4f')]+'%'};return _0x38c9cd;})});}_0xd0fe1c=_['merge']({},_0xd0fe1c,_0xd02aab['options']);return _0x5dbeee[_0x21bb('0xc2')](_0xd0fe1c);}})['then'](function(_0x394281){if(_0x394281){_0x27cc7a=_0x394281[_0x21bb('0x47')];if(!_0xd02aab['query'][_0x21bb('0x67')]('nolimit')){_0xd0fe1c[_0x21bb('0x48')]=qs[_0x21bb('0x48')](_0xd02aab['query'][_0x21bb('0x48')]);_0xd0fe1c[_0x21bb('0x31')]=qs[_0x21bb('0x31')](_0xd02aab[_0x21bb('0x42')][_0x21bb('0x31')]);}return _0x5dbeee[_0x21bb('0xc2')](_0xd0fe1c);}})[_0x21bb('0x21')](function(_0x10c157){if(_0x10c157){return _0x10c157?{'count':_0x27cc7a,'rows':_0x10c157}:null;}})[_0x21bb('0x21')](respondWithResult(_0x1b9eb4,null))['catch'](handleError(_0x1b9eb4,null));}; \ No newline at end of file +var _0xd0b5=['color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','localstationid','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','minrate','t38timeout','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','basename','isNil','from','fax','ListId','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','end','count','offset','set','json','apply','reject','destroy','get','FaxAccounts','UserProfileResource','sendStatus','name','send','Pause','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','limit','sort','where','pick','merge','type','VIRTUAL','options','FaxAccount','includeAll','include','findAll','rows','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','FaxAccountId','findOne','Disposition','hasOwnProperty','nolimit','order','filter','map','removeDispositions','ids','CannedAnswer','addInteraction','FaxInteraction','omit','CmContact','Contact','User','Owner','fullname','Tags'];(function(_0x20f6c8,_0x3063d1){var _0x52f894=function(_0x1151fe){while(--_0x1151fe){_0x20f6c8['push'](_0x20f6c8['shift']());}};_0x52f894(++_0x3063d1);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x5f4dec,_0xfe817d){_0x5f4dec=_0x5f4dec-0x0;var _0x4e97f7=_0xd0b5[_0x5f4dec];return _0x4e97f7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5d0b('0x0'));var zipdir=require(_0x5d0b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d0b('0x2'));var moment=require(_0x5d0b('0x3'));var BPromise=require(_0x5d0b('0x4'));var Mustache=require(_0x5d0b('0x5'));var util=require(_0x5d0b('0x6'));var path=require(_0x5d0b('0x7'));var sox=require(_0x5d0b('0x8'));var csv=require(_0x5d0b('0x9'));var ejs=require(_0x5d0b('0xa'));var fs=require('fs');var fs_extra=require(_0x5d0b('0xb'));var _=require(_0x5d0b('0xc'));var squel=require(_0x5d0b('0xd'));var crypto=require(_0x5d0b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5d0b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5d0b('0x10'));var Redis=require(_0x5d0b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5d0b('0x12'));var as=require(_0x5d0b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d0b('0x14'))(_0x5d0b('0x15'));var utils=require(_0x5d0b('0x16'));var config=require(_0x5d0b('0x17'));var licenseUtil=require(_0x5d0b('0x18'));var db=require(_0x5d0b('0x19'))['db'];config['redis']=_[_0x5d0b('0x1a')](config[_0x5d0b('0x1b')],{'host':_0x5d0b('0x1c'),'port':0x18eb});var socket=require(_0x5d0b('0x1d'))(new Redis(config['redis']));require(_0x5d0b('0x1e'))[_0x5d0b('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5d0b('0x20')]['http']({'port':0x232c});var client9002=jayson['client'][_0x5d0b('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x411ed2,_0x3bd719,_0x2937db,_0x4892a4){return new BPromise(function(_0x4e0fb9,_0x4732d8){var _0x191589=_0x4892a4||client;return _0x191589[_0x5d0b('0x22')](_0x411ed2,_0x2937db)[_0x5d0b('0x23')](function(_0x2299ad){logger[_0x5d0b('0x24')](_0x5d0b('0x25'),_0x3bd719,_0x5d0b('0x26'));logger[_0x5d0b('0x27')](_0x5d0b('0x28'),_0x3bd719,_0x5d0b('0x26'),JSON[_0x5d0b('0x29')](_0x2299ad));if(_0x2299ad['error']){if(_0x2299ad['error'][_0x5d0b('0x2a')]===0x1f4){logger[_0x5d0b('0x2b')](_0x5d0b('0x25'),_0x3bd719,_0x2299ad[_0x5d0b('0x2b')][_0x5d0b('0x2c')]);return _0x4732d8(_0x2299ad['error'][_0x5d0b('0x2c')]);}logger[_0x5d0b('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x3bd719,_0x2299ad[_0x5d0b('0x2b')][_0x5d0b('0x2c')]);return _0x4e0fb9(_0x2299ad[_0x5d0b('0x2b')][_0x5d0b('0x2c')]);}else{logger[_0x5d0b('0x24')]('FaxAccount,\x20%s,\x20%s',_0x3bd719,_0x5d0b('0x26'));_0x4e0fb9(_0x2299ad[_0x5d0b('0x2d')][_0x5d0b('0x2c')]);}})[_0x5d0b('0x2e')](function(_0x2d9d8b){logger[_0x5d0b('0x2b')](_0x5d0b('0x25'),_0x3bd719,_0x2d9d8b);_0x4732d8(_0x2d9d8b);});});}function respondWithStatusCode(_0x482525,_0x3ca47f){_0x3ca47f=_0x3ca47f||0xcc;return function(_0x5b2adc){if(_0x5b2adc){return _0x482525['sendStatus'](_0x3ca47f);}return _0x482525[_0x5d0b('0x2f')](_0x3ca47f)[_0x5d0b('0x30')]();};}function respondWithResult(_0x300528,_0x53b080){_0x53b080=_0x53b080||0xc8;return function(_0x33e3e1){if(_0x33e3e1){return _0x300528[_0x5d0b('0x2f')](_0x53b080)['json'](_0x33e3e1);}};}function respondWithFilteredResult(_0x20e28b,_0x15e418){return function(_0x2504b8){if(_0x2504b8){var _0x54e3d1=_0x2504b8[_0x5d0b('0x31')],_0x33607d=_0x15e418[_0x5d0b('0x32')],_0xe387d2=_0x15e418[_0x5d0b('0x32')]+_0x15e418['limit'],_0x3a6f22;if(_0xe387d2>=_0x54e3d1){_0xe387d2=_0x54e3d1;_0x3a6f22=0xc8;}else{_0x3a6f22=0xce;}_0x20e28b[_0x5d0b('0x2f')](_0x3a6f22);return _0x20e28b[_0x5d0b('0x33')]('Content-Range',_0x33607d+'-'+_0xe387d2+'/'+_0x54e3d1)[_0x5d0b('0x34')](_0x2504b8);}return null;};}function patchUpdates(_0x21ad29){return function(_0x427bc3){try{jsonpatch[_0x5d0b('0x35')](_0x427bc3,_0x21ad29,!![]);}catch(_0x1a51fb){return BPromise[_0x5d0b('0x36')](_0x1a51fb);}return _0x427bc3['save']();};}function saveUpdates(_0x17b739,_0x13372b){return function(_0x3e5d8f){if(_0x3e5d8f){return _0x3e5d8f['update'](_0x17b739)['then'](function(_0x20af63){return _0x20af63;});}return null;};}function removeEntity(_0x3b1b10,_0x5a9313){return function(_0x37c879){if(_0x37c879){return _0x37c879[_0x5d0b('0x37')]()[_0x5d0b('0x23')](function(){var _0x437de8=_0x37c879[_0x5d0b('0x38')]({'plain':!![]});var _0x2dd746=_0x5d0b('0x39');return db[_0x5d0b('0x3a')]['destroy']({'where':{'type':_0x2dd746,'resourceId':_0x437de8['id']}})[_0x5d0b('0x23')](function(){return _0x37c879;});})['then'](function(){_0x3b1b10['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55d185,_0x5e0ba9){return function(_0x14f3b2){if(!_0x14f3b2){_0x55d185[_0x5d0b('0x3b')](0x194);}return _0x14f3b2;};}function handleError(_0x48432e,_0x1b5a09){_0x1b5a09=_0x1b5a09||0x1f4;return function(_0x3ea09a){logger[_0x5d0b('0x2b')](_0x3ea09a['stack']);if(_0x3ea09a[_0x5d0b('0x3c')]){delete _0x3ea09a[_0x5d0b('0x3c')];}_0x48432e[_0x5d0b('0x2f')](_0x1b5a09)[_0x5d0b('0x3d')](_0x3ea09a);};}exports['index']=function(_0xcd5746,_0x41055f){var _0x445a33={'include':[{'model':db[_0x5d0b('0x3e')],'as':'mandatoryDispositionPause'}]},_0x41df46={},_0x6e0df9={'count':0x0,'rows':[]};var _0x3c88a2=_['map'](db['FaxAccount'][_0x5d0b('0x3f')],function(_0x4b448e){return{'name':_0x4b448e['fieldName'],'type':_0x4b448e['type'][_0x5d0b('0x40')]};});_0x41df46['model']=_['map'](_0x3c88a2,'name');_0x41df46[_0x5d0b('0x41')]=_[_0x5d0b('0x42')](_0xcd5746[_0x5d0b('0x41')]);_0x41df46[_0x5d0b('0x43')]=_[_0x5d0b('0x44')](_0x41df46['model'],_0x41df46['query']);_0x445a33[_0x5d0b('0x45')]=_[_0x5d0b('0x44')](_0x41df46[_0x5d0b('0x46')],qs[_0x5d0b('0x47')](_0xcd5746[_0x5d0b('0x41')]['fields']));_0x445a33[_0x5d0b('0x45')]=_0x445a33['attributes'][_0x5d0b('0x48')]?_0x445a33[_0x5d0b('0x45')]:_0x41df46['model'];if(!_0xcd5746[_0x5d0b('0x41')]['hasOwnProperty']('nolimit')){_0x445a33[_0x5d0b('0x49')]=qs['limit'](_0xcd5746[_0x5d0b('0x41')]['limit']);_0x445a33[_0x5d0b('0x32')]=qs['offset'](_0xcd5746['query']['offset']);}_0x445a33['order']=qs[_0x5d0b('0x4a')](_0xcd5746[_0x5d0b('0x41')][_0x5d0b('0x4a')]);_0x445a33[_0x5d0b('0x4b')]=qs[_0x5d0b('0x43')](_[_0x5d0b('0x4c')](_0xcd5746[_0x5d0b('0x41')],_0x41df46['filters']),_0x3c88a2);if(_0xcd5746[_0x5d0b('0x41')]['filter']){_0x445a33[_0x5d0b('0x4b')]=_[_0x5d0b('0x4d')](_0x445a33['where'],{'$or':_['map'](_0x3c88a2,function(_0x47dac6){if(_0x47dac6[_0x5d0b('0x4e')]!==_0x5d0b('0x4f')){var _0x32395b={};_0x32395b[_0x47dac6[_0x5d0b('0x3c')]]={'$like':'%'+_0xcd5746[_0x5d0b('0x41')]['filter']+'%'};return _0x32395b;}})});}_0x445a33=_[_0x5d0b('0x4d')]({},_0x445a33,_0xcd5746[_0x5d0b('0x50')]);var _0x1aa75e={'where':_0x445a33[_0x5d0b('0x4b')]};return db[_0x5d0b('0x51')][_0x5d0b('0x31')](_0x1aa75e)[_0x5d0b('0x23')](function(_0x3e62cd){_0x6e0df9[_0x5d0b('0x31')]=_0x3e62cd;if(_0xcd5746[_0x5d0b('0x41')][_0x5d0b('0x52')]){_0x445a33[_0x5d0b('0x53')]=[{'all':!![]}];}return db['FaxAccount'][_0x5d0b('0x54')](_0x445a33);})[_0x5d0b('0x23')](function(_0x5e2b0a){_0x6e0df9[_0x5d0b('0x55')]=_0x5e2b0a;return _0x6e0df9;})['then'](respondWithFilteredResult(_0x41055f,_0x445a33))[_0x5d0b('0x2e')](handleError(_0x41055f,null));};exports['show']=function(_0x4a65ce,_0x29b4d3){var _0x3d2f54={'raw':![],'where':{'id':_0x4a65ce['params']['id']},'include':[{'model':db['Pause'],'as':_0x5d0b('0x56')}]},_0x3f75d2={};_0x3f75d2[_0x5d0b('0x46')]=_['keys'](db[_0x5d0b('0x51')][_0x5d0b('0x3f')]);_0x3f75d2[_0x5d0b('0x41')]=_[_0x5d0b('0x42')](_0x4a65ce[_0x5d0b('0x41')]);_0x3f75d2[_0x5d0b('0x43')]=_[_0x5d0b('0x44')](_0x3f75d2[_0x5d0b('0x46')],_0x3f75d2[_0x5d0b('0x41')]);_0x3d2f54[_0x5d0b('0x45')]=_[_0x5d0b('0x44')](_0x3f75d2[_0x5d0b('0x46')],qs['fields'](_0x4a65ce[_0x5d0b('0x41')][_0x5d0b('0x47')]));_0x3d2f54[_0x5d0b('0x45')]=_0x3d2f54[_0x5d0b('0x45')][_0x5d0b('0x48')]?_0x3d2f54[_0x5d0b('0x45')]:_0x3f75d2[_0x5d0b('0x46')];if(_0x4a65ce[_0x5d0b('0x41')][_0x5d0b('0x52')]){_0x3d2f54[_0x5d0b('0x53')]=[{'all':!![]}];}_0x3d2f54=_[_0x5d0b('0x4d')]({},_0x3d2f54,_0x4a65ce['options']);return db[_0x5d0b('0x51')][_0x5d0b('0x57')](_0x3d2f54)[_0x5d0b('0x23')](handleEntityNotFound(_0x29b4d3,null))[_0x5d0b('0x23')](respondWithResult(_0x29b4d3,null))[_0x5d0b('0x2e')](handleError(_0x29b4d3,null));};exports['create']=function(_0x5d19dd,_0x3ade16){return db[_0x5d0b('0x51')][_0x5d0b('0x58')](_0x5d19dd[_0x5d0b('0x59')],{})[_0x5d0b('0x23')](function(_0x549ad1){var _0x4187f2=_0x5d19dd[_0x5d0b('0x5a')]['get']({'plain':!![]});if(!_0x4187f2)throw new Error(_0x5d0b('0x5b'));if(_0x4187f2[_0x5d0b('0x5c')]===_0x5d0b('0x5a')){var _0x291ef7=_0x549ad1[_0x5d0b('0x38')]({'plain':!![]});var _0xd8a0b9=_0x5d0b('0x39');return db[_0x5d0b('0x5d')][_0x5d0b('0x57')]({'where':{'name':_0xd8a0b9,'userProfileId':_0x4187f2[_0x5d0b('0x5e')]},'raw':!![]})['then'](function(_0x4f7385){if(_0x4f7385&&_0x4f7385[_0x5d0b('0x5f')]===0x0){return db[_0x5d0b('0x3a')][_0x5d0b('0x58')]({'name':_0x291ef7[_0x5d0b('0x3c')],'resourceId':_0x291ef7['id'],'type':_0x4f7385[_0x5d0b('0x3c')],'sectionId':_0x4f7385['id']},{})[_0x5d0b('0x23')](function(){return _0x549ad1;});}else{return _0x549ad1;}})['catch'](function(_0x50ae2a){logger[_0x5d0b('0x2b')](_0x5d0b('0x60'),_0x50ae2a);throw _0x50ae2a;});}return _0x549ad1;})[_0x5d0b('0x23')](respondWithResult(_0x3ade16,0xc9))['catch'](handleError(_0x3ade16,null));};exports[_0x5d0b('0x61')]=function(_0x393dea,_0x1beebe){if(_0x393dea[_0x5d0b('0x59')]['id']){delete _0x393dea[_0x5d0b('0x59')]['id'];}return db[_0x5d0b('0x51')]['find']({'where':{'id':_0x393dea[_0x5d0b('0x62')]['id']},'include':[{'model':db[_0x5d0b('0x3e')],'as':_0x5d0b('0x56')}]})[_0x5d0b('0x23')](handleEntityNotFound(_0x1beebe,null))[_0x5d0b('0x23')](saveUpdates(_0x393dea[_0x5d0b('0x59')],null))[_0x5d0b('0x23')](respondWithResult(_0x1beebe,null))[_0x5d0b('0x2e')](handleError(_0x1beebe,null));};exports[_0x5d0b('0x37')]=function(_0x243126,_0x429e18){return db['FaxAccount'][_0x5d0b('0x57')]({'where':{'id':_0x243126[_0x5d0b('0x62')]['id']}})[_0x5d0b('0x23')](handleEntityNotFound(_0x429e18,null))[_0x5d0b('0x23')](removeEntity(_0x429e18,null))[_0x5d0b('0x2e')](handleError(_0x429e18,null));};exports[_0x5d0b('0x63')]=function(_0x52445e,_0x54827c){return db[_0x5d0b('0x51')][_0x5d0b('0x63')]()[_0x5d0b('0x23')](respondWithResult(_0x54827c,null))[_0x5d0b('0x2e')](handleError(_0x54827c,null));};exports[_0x5d0b('0x64')]=function(_0x42837a,_0x51e6a9,_0x2a6717){if(_0x42837a[_0x5d0b('0x59')]['id']){delete _0x42837a['body']['id'];}return db[_0x5d0b('0x51')][_0x5d0b('0x57')]({'where':{'id':_0x42837a['params']['id']}})['then'](handleEntityNotFound(_0x51e6a9,null))[_0x5d0b('0x23')](function(_0x2f3bc3){if(_0x2f3bc3){_0x42837a['body'][_0x5d0b('0x65')]=_0x2f3bc3['id'];return db['Disposition'][_0x5d0b('0x58')](_0x42837a[_0x5d0b('0x59')]);}})[_0x5d0b('0x23')](respondWithResult(_0x51e6a9,null))[_0x5d0b('0x2e')](handleError(_0x51e6a9,null));};exports['getDispositions']=function(_0x24c6be,_0x45ce74,_0x3e82f7){var _0x3f465d={'raw':![],'where':{}};var _0x3fc279={};var _0x14f159={'count':0x0,'rows':[]};return db[_0x5d0b('0x51')][_0x5d0b('0x66')]({'where':{'id':_0x24c6be[_0x5d0b('0x62')]['id']}})[_0x5d0b('0x23')](handleEntityNotFound(_0x45ce74,null))['then'](function(_0x5392d5){if(_0x5392d5){_0x3fc279[_0x5d0b('0x46')]=_[_0x5d0b('0x42')](db[_0x5d0b('0x67')][_0x5d0b('0x3f')]);_0x3fc279['query']=_[_0x5d0b('0x42')](_0x24c6be[_0x5d0b('0x41')]);_0x3fc279[_0x5d0b('0x43')]=_[_0x5d0b('0x44')](_0x3fc279['model'],_0x3fc279[_0x5d0b('0x41')]);_0x3f465d[_0x5d0b('0x45')]=_[_0x5d0b('0x44')](_0x3fc279[_0x5d0b('0x46')],qs[_0x5d0b('0x47')](_0x24c6be[_0x5d0b('0x41')][_0x5d0b('0x47')]));_0x3f465d[_0x5d0b('0x45')]=_0x3f465d[_0x5d0b('0x45')][_0x5d0b('0x48')]?_0x3f465d[_0x5d0b('0x45')]:_0x3fc279['model'];if(!_0x24c6be['query'][_0x5d0b('0x68')](_0x5d0b('0x69'))){_0x3f465d[_0x5d0b('0x49')]=qs[_0x5d0b('0x49')](_0x24c6be[_0x5d0b('0x41')]['limit']);_0x3f465d['offset']=qs['offset'](_0x24c6be[_0x5d0b('0x41')]['offset']);}_0x3f465d[_0x5d0b('0x6a')]=qs[_0x5d0b('0x4a')](_0x24c6be[_0x5d0b('0x41')]['sort']);_0x3f465d['where']=qs[_0x5d0b('0x43')](_['pick'](_0x24c6be[_0x5d0b('0x41')],_0x3fc279['filters']));_0x3f465d[_0x5d0b('0x4b')]['FaxAccountId']=_0x5392d5['id'];if(_0x24c6be[_0x5d0b('0x41')][_0x5d0b('0x6b')]){_0x3f465d['where']=_['merge'](_0x3f465d['where'],{'$or':_[_0x5d0b('0x6c')](_0x3f465d[_0x5d0b('0x45')],function(_0x2d3b17){var _0x33857a={};_0x33857a[_0x2d3b17]={'$like':'%'+_0x24c6be[_0x5d0b('0x41')][_0x5d0b('0x6b')]+'%'};return _0x33857a;})});}_0x3f465d=_[_0x5d0b('0x4d')]({},_0x3f465d,_0x24c6be[_0x5d0b('0x50')]);return db[_0x5d0b('0x67')]['count']({'where':_0x3f465d['where']})[_0x5d0b('0x23')](function(_0x30a2e1){_0x14f159['count']=_0x30a2e1;if(_0x24c6be[_0x5d0b('0x41')]['includeAll']){_0x3f465d['include']=[{'all':!![]}];}return db[_0x5d0b('0x67')][_0x5d0b('0x54')](_0x3f465d);})[_0x5d0b('0x23')](function(_0x5afe25){_0x14f159[_0x5d0b('0x55')]=_0x5afe25;return _0x14f159;});}})['then'](respondWithFilteredResult(_0x45ce74,_0x3f465d))[_0x5d0b('0x2e')](handleError(_0x45ce74,null));};exports[_0x5d0b('0x6d')]=function(_0x5ced0f,_0x867205,_0x3cc485){return db['FaxAccount'][_0x5d0b('0x57')]({'where':{'id':_0x5ced0f[_0x5d0b('0x62')]['id']}})[_0x5d0b('0x23')](handleEntityNotFound(_0x867205,null))[_0x5d0b('0x23')](function(_0x18d8fd){if(_0x18d8fd){return _0x18d8fd[_0x5d0b('0x6d')](_0x5ced0f[_0x5d0b('0x41')][_0x5d0b('0x6e')]);}})[_0x5d0b('0x23')](respondWithStatusCode(_0x867205,null))[_0x5d0b('0x2e')](handleError(_0x867205,null));};exports['addAnswer']=function(_0x59f702,_0x6e71ce,_0x523f50){if(_0x59f702[_0x5d0b('0x59')]['id']){delete _0x59f702[_0x5d0b('0x59')]['id'];}return db['FaxAccount'][_0x5d0b('0x57')]({'where':{'id':_0x59f702['params']['id']}})['then'](handleEntityNotFound(_0x6e71ce,null))['then'](function(_0x546eb7){if(_0x546eb7){_0x59f702[_0x5d0b('0x59')]['FaxAccountId']=_0x546eb7['id'];return db[_0x5d0b('0x6f')][_0x5d0b('0x58')](_0x59f702[_0x5d0b('0x59')]);}})[_0x5d0b('0x23')](respondWithResult(_0x6e71ce,null))[_0x5d0b('0x2e')](handleError(_0x6e71ce,null));};exports['getAnswers']=function(_0xbbc2d,_0x46e415,_0x4b81da){var _0x39153b={'raw':![],'where':{}};var _0x245bfe={};var _0x3ad013={'count':0x0,'rows':[]};return db[_0x5d0b('0x51')][_0x5d0b('0x66')]({'where':{'id':_0xbbc2d[_0x5d0b('0x62')]['id']}})[_0x5d0b('0x23')](handleEntityNotFound(_0x46e415,null))[_0x5d0b('0x23')](function(_0x16251b){if(_0x16251b){_0x245bfe[_0x5d0b('0x46')]=_[_0x5d0b('0x42')](db[_0x5d0b('0x6f')][_0x5d0b('0x3f')]);_0x245bfe[_0x5d0b('0x41')]=_[_0x5d0b('0x42')](_0xbbc2d[_0x5d0b('0x41')]);_0x245bfe[_0x5d0b('0x43')]=_[_0x5d0b('0x44')](_0x245bfe['model'],_0x245bfe['query']);_0x39153b['attributes']=_['intersection'](_0x245bfe[_0x5d0b('0x46')],qs[_0x5d0b('0x47')](_0xbbc2d[_0x5d0b('0x41')]['fields']));_0x39153b[_0x5d0b('0x45')]=_0x39153b[_0x5d0b('0x45')][_0x5d0b('0x48')]?_0x39153b[_0x5d0b('0x45')]:_0x245bfe[_0x5d0b('0x46')];if(!_0xbbc2d[_0x5d0b('0x41')][_0x5d0b('0x68')]('nolimit')){_0x39153b[_0x5d0b('0x49')]=qs[_0x5d0b('0x49')](_0xbbc2d[_0x5d0b('0x41')][_0x5d0b('0x49')]);_0x39153b[_0x5d0b('0x32')]=qs['offset'](_0xbbc2d[_0x5d0b('0x41')][_0x5d0b('0x32')]);}_0x39153b[_0x5d0b('0x6a')]=qs[_0x5d0b('0x4a')](_0xbbc2d[_0x5d0b('0x41')][_0x5d0b('0x4a')]);_0x39153b[_0x5d0b('0x4b')]=qs[_0x5d0b('0x43')](_[_0x5d0b('0x4c')](_0xbbc2d[_0x5d0b('0x41')],_0x245bfe[_0x5d0b('0x43')]));_0x39153b['where'][_0x5d0b('0x65')]=_0x16251b['id'];if(_0xbbc2d[_0x5d0b('0x41')][_0x5d0b('0x6b')]){_0x39153b['where']=_['merge'](_0x39153b[_0x5d0b('0x4b')],{'$or':_[_0x5d0b('0x6c')](_0x39153b[_0x5d0b('0x45')],function(_0x20bdcf){var _0x44de5f={};_0x44de5f[_0x20bdcf]={'$like':'%'+_0xbbc2d[_0x5d0b('0x41')][_0x5d0b('0x6b')]+'%'};return _0x44de5f;})});}_0x39153b=_[_0x5d0b('0x4d')]({},_0x39153b,_0xbbc2d[_0x5d0b('0x50')]);return db[_0x5d0b('0x6f')]['count']({'where':_0x39153b['where']})[_0x5d0b('0x23')](function(_0x2be670){_0x3ad013['count']=_0x2be670;if(_0xbbc2d[_0x5d0b('0x41')]['includeAll']){_0x39153b[_0x5d0b('0x53')]=[{'all':!![]}];}return db[_0x5d0b('0x6f')][_0x5d0b('0x54')](_0x39153b);})['then'](function(_0x495c14){_0x3ad013[_0x5d0b('0x55')]=_0x495c14;return _0x3ad013;});}})[_0x5d0b('0x23')](respondWithFilteredResult(_0x46e415,_0x39153b))[_0x5d0b('0x2e')](handleError(_0x46e415,null));};exports['removeAnswers']=function(_0x4a1dca,_0x2e72ff,_0x223d38){return db['FaxAccount'][_0x5d0b('0x57')]({'where':{'id':_0x4a1dca[_0x5d0b('0x62')]['id']}})['then'](handleEntityNotFound(_0x2e72ff,null))['then'](function(_0x49d354){if(_0x49d354){return _0x49d354['removeAnswers'](_0x4a1dca['query'][_0x5d0b('0x6e')]);}})[_0x5d0b('0x23')](respondWithStatusCode(_0x2e72ff,null))[_0x5d0b('0x2e')](handleError(_0x2e72ff,null));};exports[_0x5d0b('0x70')]=function(_0x29ec10,_0x199c7a,_0xa209a3){return db[_0x5d0b('0x71')][_0x5d0b('0x57')]({'where':{'id':_0x29ec10[_0x5d0b('0x62')]['id']}})['then'](handleEntityNotFound(_0x199c7a,null))[_0x5d0b('0x23')](function(_0x41855c){if(_0x41855c){return _0x41855c[_0x5d0b('0x70')](_0x29ec10['body'][_0x5d0b('0x6e')],_[_0x5d0b('0x72')](_0x29ec10['body'],[_0x5d0b('0x6e'),'id'])||{});}})[_0x5d0b('0x23')](respondWithResult(_0x199c7a,null))[_0x5d0b('0x2e')](handleError(_0x199c7a,null));};exports['getInteractions']=function(_0x5b7a6d,_0x4b6c02,_0x3413b0){var _0x5de1c4={'raw':![],'where':{}};var _0x5cab28={};var _0x509b5c={'count':0x0,'rows':[]};return db[_0x5d0b('0x51')][_0x5d0b('0x66')]({'where':{'id':_0x5b7a6d[_0x5d0b('0x62')]['id']}})['then'](handleEntityNotFound(_0x4b6c02,null))[_0x5d0b('0x23')](function(_0x56d51){if(_0x56d51){_0x5cab28[_0x5d0b('0x46')]=_[_0x5d0b('0x42')](db[_0x5d0b('0x71')][_0x5d0b('0x3f')]);_0x5cab28[_0x5d0b('0x41')]=_['keys'](_0x5b7a6d[_0x5d0b('0x41')]);_0x5cab28[_0x5d0b('0x43')]=_[_0x5d0b('0x44')](_0x5cab28[_0x5d0b('0x46')],_0x5cab28[_0x5d0b('0x41')]);_0x5de1c4[_0x5d0b('0x45')]=_[_0x5d0b('0x44')](_0x5cab28[_0x5d0b('0x46')],qs[_0x5d0b('0x47')](_0x5b7a6d[_0x5d0b('0x41')][_0x5d0b('0x47')]));_0x5de1c4[_0x5d0b('0x45')]=_0x5de1c4[_0x5d0b('0x45')][_0x5d0b('0x48')]?_0x5de1c4[_0x5d0b('0x45')]:_0x5cab28[_0x5d0b('0x46')];if(!_0x5b7a6d[_0x5d0b('0x41')][_0x5d0b('0x68')](_0x5d0b('0x69'))){_0x5de1c4[_0x5d0b('0x49')]=qs[_0x5d0b('0x49')](_0x5b7a6d['query'][_0x5d0b('0x49')]);_0x5de1c4['offset']=qs['offset'](_0x5b7a6d[_0x5d0b('0x41')][_0x5d0b('0x32')]);}_0x5de1c4[_0x5d0b('0x6a')]=qs['sort'](_0x5b7a6d[_0x5d0b('0x41')][_0x5d0b('0x4a')]);_0x5de1c4[_0x5d0b('0x4b')]=qs['filters'](_['pick'](_0x5b7a6d[_0x5d0b('0x41')],_0x5cab28[_0x5d0b('0x43')]));_0x5de1c4[_0x5d0b('0x4b')][_0x5d0b('0x65')]=_0x56d51['id'];if(_0x5b7a6d[_0x5d0b('0x41')][_0x5d0b('0x6b')]){_0x5de1c4[_0x5d0b('0x4b')]=_[_0x5d0b('0x4d')](_0x5de1c4['where'],{'$or':_['map'](_0x5de1c4['attributes'],function(_0x49a9f9){var _0xbb8b58={};_0xbb8b58[_0x49a9f9]={'$like':'%'+_0x5b7a6d['query'][_0x5d0b('0x6b')]+'%'};return _0xbb8b58;})});}_0x5de1c4=_['merge']({},_0x5de1c4,_0x5b7a6d[_0x5d0b('0x50')]);return db[_0x5d0b('0x71')][_0x5d0b('0x31')]({'where':_0x5de1c4['where']})[_0x5d0b('0x23')](function(_0x18dca9){_0x509b5c[_0x5d0b('0x31')]=_0x18dca9;if(_0x5b7a6d[_0x5d0b('0x41')][_0x5d0b('0x52')]){_0x5de1c4[_0x5d0b('0x53')]=[{'model':db[_0x5d0b('0x73')],'as':_0x5d0b('0x74'),'required':![]},{'model':db[_0x5d0b('0x75')],'as':_0x5d0b('0x76'),'attributes':[_0x5d0b('0x3c'),_0x5d0b('0x77'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x5d0b('0x78'),'attributes':['id',_0x5d0b('0x3c'),_0x5d0b('0x79')],'where':_0x5b7a6d['query'][_0x5d0b('0x7a')]?{'id':_0x5b7a6d[_0x5d0b('0x41')][_0x5d0b('0x7a')]}:undefined,'required':_0x5b7a6d[_0x5d0b('0x41')][_0x5d0b('0x7a')]?!![]:![]}];}return db['FaxInteraction'][_0x5d0b('0x54')](_0x5de1c4);})[_0x5d0b('0x23')](function(_0x1278d8){_0x509b5c[_0x5d0b('0x55')]=_0x1278d8;return _0x509b5c;});}})[_0x5d0b('0x23')](respondWithFilteredResult(_0x4b6c02,_0x5de1c4))['catch'](handleError(_0x4b6c02,null));};exports[_0x5d0b('0x7b')]=function(_0x2fac7e,_0x44459a,_0x1b999a){return db[_0x5d0b('0x51')][_0x5d0b('0x66')]({'where':{'id':_0x2fac7e['params']['id']}})[_0x5d0b('0x23')](handleEntityNotFound(_0x44459a,null))[_0x5d0b('0x23')](function(_0x2493e2){if(_0x2493e2){return db[_0x5d0b('0x7c')][_0x5d0b('0x7d')](function(_0x4c66ba){return db[_0x5d0b('0x7e')][_0x5d0b('0x37')]({'where':{'FaxAccountId':_0x2fac7e[_0x5d0b('0x62')]['id']},'transaction':_0x4c66ba})[_0x5d0b('0x23')](function(_0x1df650){var _0x469671=_['map'](_0x2fac7e['body'],function(_0x5d8b0d){_0x5d8b0d[_0x5d0b('0x65')]=_0x2fac7e[_0x5d0b('0x62')]['id'];return _0x5d8b0d;});return db[_0x5d0b('0x7e')][_0x5d0b('0x7f')](_0x469671,{'transaction':_0x4c66ba});});})[_0x5d0b('0x23')](function(){return db[_0x5d0b('0x7e')]['findAndCountAll']({'where':{'FaxAccountId':_0x2fac7e[_0x5d0b('0x62')]['id']},'order':_0x5d0b('0x80')});});}})[_0x5d0b('0x23')](respondWithResult(_0x44459a,null))['catch'](handleError(_0x44459a,null));};exports[_0x5d0b('0x81')]=function(_0x302f96,_0x2756ea,_0x1647ac){var _0x3b8c10={};var _0x5999d0={};var _0x2ed956;var _0x4aea86;return db['FaxAccount'][_0x5d0b('0x66')]({'where':{'id':_0x302f96[_0x5d0b('0x62')]['id']}})[_0x5d0b('0x23')](handleEntityNotFound(_0x2756ea,null))[_0x5d0b('0x23')](function(_0x751352){if(_0x751352){_0x2ed956=_0x751352;_0x5999d0[_0x5d0b('0x46')]=_[_0x5d0b('0x42')](db[_0x5d0b('0x7e')][_0x5d0b('0x3f')]);_0x5999d0[_0x5d0b('0x41')]=_[_0x5d0b('0x42')](_0x302f96[_0x5d0b('0x41')]);_0x5999d0['filters']=_[_0x5d0b('0x44')](_0x5999d0[_0x5d0b('0x46')],_0x5999d0[_0x5d0b('0x41')]);_0x3b8c10[_0x5d0b('0x45')]=_[_0x5d0b('0x44')](_0x5999d0[_0x5d0b('0x46')],qs[_0x5d0b('0x47')](_0x302f96[_0x5d0b('0x41')][_0x5d0b('0x47')]));_0x3b8c10[_0x5d0b('0x45')]=_0x3b8c10[_0x5d0b('0x45')]['length']?_0x3b8c10[_0x5d0b('0x45')]:_0x5999d0[_0x5d0b('0x46')];_0x3b8c10['order']=qs[_0x5d0b('0x4a')](_0x302f96[_0x5d0b('0x41')][_0x5d0b('0x4a')]);_0x3b8c10['where']=qs['filters'](_[_0x5d0b('0x4c')](_0x302f96[_0x5d0b('0x41')],_0x5999d0[_0x5d0b('0x43')]));if(_0x302f96[_0x5d0b('0x41')][_0x5d0b('0x6b')]){_0x3b8c10['where']=_[_0x5d0b('0x4d')](_0x3b8c10[_0x5d0b('0x4b')],{'$or':_[_0x5d0b('0x6c')](_0x3b8c10[_0x5d0b('0x45')],function(_0x56c463){var _0x3a9b75={};_0x3a9b75[_0x56c463]={'$like':'%'+_0x302f96[_0x5d0b('0x41')][_0x5d0b('0x6b')]+'%'};return _0x3a9b75;})});}_0x3b8c10=_[_0x5d0b('0x4d')]({},_0x3b8c10,_0x302f96[_0x5d0b('0x50')]);return _0x2ed956['getApplications'](_0x3b8c10);}})[_0x5d0b('0x23')](function(_0x16b988){if(_0x16b988){_0x4aea86=_0x16b988['length'];if(!_0x302f96[_0x5d0b('0x41')]['hasOwnProperty'](_0x5d0b('0x69'))){_0x3b8c10[_0x5d0b('0x49')]=qs['limit'](_0x302f96[_0x5d0b('0x41')][_0x5d0b('0x49')]);_0x3b8c10[_0x5d0b('0x32')]=qs[_0x5d0b('0x32')](_0x302f96[_0x5d0b('0x41')][_0x5d0b('0x32')]);}return _0x2ed956[_0x5d0b('0x81')](_0x3b8c10);}})[_0x5d0b('0x23')](function(_0x6eaefd){if(_0x6eaefd){return _0x6eaefd?{'count':_0x4aea86,'rows':_0x6eaefd}:null;}})[_0x5d0b('0x23')](respondWithResult(_0x2756ea,null))['catch'](handleError(_0x2756ea,null));};function Extension(_0x3cb365,_0x2c7a0d,_0x46763e,_0x2fa636){this[_0x5d0b('0x82')]=_0x5d0b('0x83');this['exten']=_0x3cb365[_0x5d0b('0x84')];this['app']=_0x2fa636;this['type']='system';this[_0x5d0b('0x85')]=_0x5d0b('0x86');this['FaxAccountId']=_0x3cb365['id'];this[_0x5d0b('0x80')]=_0x2c7a0d;this[_0x5d0b('0x87')]=_0x46763e;}function createExtensionsReciveFax(_0x3259a4){var _0x4eb81d=0x1;var _0x3884b7=[];_0x3884b7['push'](new Extension(_0x3259a4,_0x4eb81d,'',_0x5d0b('0x88')));_0x4eb81d+=0x1;_0x3884b7[_0x5d0b('0x89')](new Extension(_0x3259a4,_0x4eb81d,_0x5d0b('0x8a'),_0x5d0b('0x8b')));_0x4eb81d+=0x1;for(var _0x40d15a in _0x3259a4){if(_0x3259a4['hasOwnProperty'](_0x40d15a)&&(_0x40d15a==='ecm'||_0x40d15a===_0x5d0b('0x84')||_0x40d15a===_0x5d0b('0x8c')||_0x40d15a===_0x5d0b('0x8d')||_0x40d15a===_0x5d0b('0x8e')||_0x40d15a==='maxrate'||_0x40d15a===_0x5d0b('0x8f')||_0x40d15a==='modem'||_0x40d15a===_0x5d0b('0x90'))){_0x3884b7[_0x5d0b('0x89')](new Extension(_0x3259a4,_0x4eb81d,'FAXOPT('+_0x40d15a+')='+_0x3259a4[_0x40d15a],_0x5d0b('0x8b')));_0x4eb81d+=0x1;}}_0x3884b7[_0x5d0b('0x89')](new Extension(_0x3259a4,_0x4eb81d,'6','Wait'));_0x4eb81d+=0x1;_0x3884b7['push'](new Extension(_0x3259a4,_0x4eb81d,'/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',_0x5d0b('0x91')));_0x4eb81d=0x0;return _0x3884b7;}exports[_0x5d0b('0x92')]=function(_0x3f33c6,_0x4fde0e,_0x10ca46){var _0x4f1979;return db[_0x5d0b('0x7c')][_0x5d0b('0x7d')](function(_0x310aaf){return db[_0x5d0b('0x51')][_0x5d0b('0x58')](_0x3f33c6[_0x5d0b('0x59')],{'transaction':_0x310aaf})[_0x5d0b('0x23')](function(_0x7312e4){_0x4f1979=_0x7312e4[_0x5d0b('0x38')]({'plain':!![]});return db['VoiceExtension'][_0x5d0b('0x7f')](createExtensionsReciveFax(_0x4f1979),{'transaction':_0x310aaf});});})[_0x5d0b('0x23')](function(){return _0x4f1979;})[_0x5d0b('0x23')](respondWithResult(_0x4fde0e,null))['catch'](handleError(_0x4fde0e,null));};exports[_0x5d0b('0x93')]=function(_0x848533,_0x2ec252,_0x3b4a1e){var _0x2c0802;return db['sequelize']['transaction'](function(_0x556102){return db['FaxAccount'][_0x5d0b('0x61')](_0x848533['body'],{'where':{'id':_0x848533[_0x5d0b('0x59')]['id']},'transaction':_0x556102})[_0x5d0b('0x23')](function(_0x37fe2f){return db[_0x5d0b('0x94')][_0x5d0b('0x37')]({'where':{'FaxAccountId':_0x848533[_0x5d0b('0x59')]['id']},'transaction':_0x556102})['then'](function(_0x4b972a){return db[_0x5d0b('0x94')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x848533[_0x5d0b('0x59')],[_0x5d0b('0x95'),_0x5d0b('0x40'),_0x5d0b('0x96'),_0x5d0b('0x97'),_0x5d0b('0x98'),'ListId'])),{'transaction':_0x556102});});});})['then'](function(){return db['FaxAccount'][_0x5d0b('0x99')](_0x848533[_0x5d0b('0x59')]['id']);})['then'](respondWithResult(_0x2ec252,null))[_0x5d0b('0x2e')](handleError(_0x2ec252,null));};exports[_0x5d0b('0x9a')]=function(_0x4eeb57,_0x4bb09d,_0x2658b6){var _0x321a46={'raw':!![],'where':{}};var _0x33b987={};var _0x487453={'count':0x0,'rows':[]};return db['FaxAccount'][_0x5d0b('0x66')]({'where':{'id':_0x4eeb57['params']['id']}})[_0x5d0b('0x23')](handleEntityNotFound(_0x4bb09d,null))[_0x5d0b('0x23')](function(_0x168ea2){if(_0x168ea2){_0x33b987[_0x5d0b('0x46')]=_[_0x5d0b('0x42')](db[_0x5d0b('0x9b')]['rawAttributes']);_0x33b987['query']=_[_0x5d0b('0x42')](_0x4eeb57[_0x5d0b('0x41')]);_0x33b987[_0x5d0b('0x43')]=_[_0x5d0b('0x44')](_0x33b987[_0x5d0b('0x46')],_0x33b987[_0x5d0b('0x41')]);_0x321a46['attributes']=_[_0x5d0b('0x44')](_0x33b987[_0x5d0b('0x46')],qs['fields'](_0x4eeb57[_0x5d0b('0x41')][_0x5d0b('0x47')]));_0x321a46['attributes']=_0x321a46[_0x5d0b('0x45')][_0x5d0b('0x48')]?_0x321a46['attributes']:_0x33b987[_0x5d0b('0x46')];if(!_0x4eeb57[_0x5d0b('0x41')]['hasOwnProperty']('nolimit')){_0x321a46[_0x5d0b('0x49')]=qs['limit'](_0x4eeb57[_0x5d0b('0x41')][_0x5d0b('0x49')]);_0x321a46[_0x5d0b('0x32')]=qs[_0x5d0b('0x32')](_0x4eeb57['query'][_0x5d0b('0x32')]);}_0x321a46[_0x5d0b('0x6a')]=qs['sort'](_0x4eeb57['query']['sort']);_0x321a46['where']=qs['filters'](_[_0x5d0b('0x4c')](_0x4eeb57[_0x5d0b('0x41')],_0x33b987[_0x5d0b('0x43')]));_0x321a46[_0x5d0b('0x4b')]['FaxAccountId']=_0x168ea2['id'];if(_0x4eeb57[_0x5d0b('0x41')][_0x5d0b('0x6b')]){_0x321a46[_0x5d0b('0x4b')]=_[_0x5d0b('0x4d')](_0x321a46[_0x5d0b('0x4b')],{'$or':_[_0x5d0b('0x6c')](_0x321a46[_0x5d0b('0x45')],function(_0x12ff42){var _0x1a6836={};_0x1a6836[_0x12ff42]={'$like':'%'+_0x4eeb57[_0x5d0b('0x41')][_0x5d0b('0x6b')]+'%'};return _0x1a6836;})});}if(_0x4eeb57[_0x5d0b('0x41')][_0x5d0b('0x9c')]){var _0x257819=_0x4eeb57[_0x5d0b('0x41')][_0x5d0b('0x9c')][_0x5d0b('0x9d')](',');var _0x5c6134={};_0x5c6134[_0x257819[0x0]]={'$gte':moment(_0x257819[0x1])['format'](_0x5d0b('0x9e'))};_0x321a46['where']=_[_0x5d0b('0x4d')](_0x321a46[_0x5d0b('0x4b')],_0x5c6134);}_0x321a46=_[_0x5d0b('0x4d')]({},_0x321a46,_0x4eeb57['options']);return db[_0x5d0b('0x9b')][_0x5d0b('0x31')]({'where':_0x321a46[_0x5d0b('0x4b')]})[_0x5d0b('0x23')](function(_0x417852){_0x487453[_0x5d0b('0x31')]=_0x417852;if(_0x4eeb57[_0x5d0b('0x41')][_0x5d0b('0x52')]){_0x321a46[_0x5d0b('0x53')]=[{'all':!![]}];}return db[_0x5d0b('0x9b')][_0x5d0b('0x54')](_0x321a46);})[_0x5d0b('0x23')](function(_0x5aa374){_0x487453[_0x5d0b('0x55')]=_0x5aa374;return _0x487453;});}})[_0x5d0b('0x23')](respondWithFilteredResult(_0x4bb09d,_0x321a46))['catch'](handleError(_0x4bb09d,null));};exports[_0x5d0b('0x3d')]=function(_0x2a7933,_0x173f73,_0x503321){var _0x35c2fd,_0x26f1dc={},_0x2ce099;if(_0x2a7933[_0x5d0b('0x59')]['to']){_0x2ce099=_0x2a7933[_0x5d0b('0x59')]['to'][0x0];}return db[_0x5d0b('0x51')][_0x5d0b('0x57')]({'where':{'id':_0x2a7933['params']['id']},'include':[{'model':db[_0x5d0b('0x9f')],'as':_0x5d0b('0xa0'),'include':[{'model':db['CmContact'],'as':_0x5d0b('0xa1'),'where':{'fax':_0x2ce099},'limit':0x1,'order':[[_0x5d0b('0x97'),_0x5d0b('0xa2')]]}]}]})[_0x5d0b('0x23')](handleEntityNotFound(_0x173f73,null))['then'](function(_0x13687d){_0x35c2fd=_0x13687d;if(_0x2a7933[_0x5d0b('0x59')][_0x5d0b('0xa3')]&&_0x2a7933[_0x5d0b('0x59')]['attachments'][_0x5d0b('0x48')]){for(var _0x3a5890=0x0;_0x3a5890<_0x2a7933[_0x5d0b('0x59')][_0x5d0b('0xa3')][_0x5d0b('0x48')];_0x3a5890+=0x1){_0x2a7933[_0x5d0b('0x59')][_0x5d0b('0xa3')][_0x3a5890]={'filename':_0x2a7933[_0x5d0b('0x59')][_0x5d0b('0xa3')][_0x3a5890][_0x5d0b('0x3c')],'id':_0x2a7933['body'][_0x5d0b('0xa3')][_0x3a5890]['id'],'path':path[_0x5d0b('0xa4')](config[_0x5d0b('0xa5')],'server/files/attachments',_0x2a7933['body'][_0x5d0b('0xa3')][_0x3a5890][_0x5d0b('0xa6')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_['isNil'](_0x2a7933['params']['id'])?undefined:_0x2a7933[_0x5d0b('0x62')]['id'],'path':_['isNil'](_0x2a7933['body'][_0x5d0b('0xa3')][0x0][_0x5d0b('0x7')])?undefined:_0x2a7933['body'][_0x5d0b('0xa3')][0x0][_0x5d0b('0x7')],'fax':_[_0x5d0b('0xa7')](_0x2a7933['body']['to'][0x0])?undefined:_0x2a7933[_0x5d0b('0x59')]['to'][0x0]},client9002);})['then'](function(){if(_0x35c2fd){if(_[_0x5d0b('0xa7')](_0x2a7933[_0x5d0b('0x59')][_0x5d0b('0xa8')])){_0x2a7933[_0x5d0b('0x59')]['from']=util['format']('\x22%s\x22\x20<%s>',_0x35c2fd[_0x5d0b('0x3c')],_0x35c2fd[_0x5d0b('0xa9')]);}if(_0x35c2fd[_0x5d0b('0xa0')]){if(_0x35c2fd['List'][_0x5d0b('0xa1')]['length']){return _0x35c2fd[_0x5d0b('0xa0')][_0x5d0b('0xa1')][0x0];}else{return db[_0x5d0b('0x73')]['create'](_[_0x5d0b('0x1a')](_0x2a7933[_0x5d0b('0x59')],{'firstName':_0x2a7933[_0x5d0b('0x59')]['to'][0x0],'phone':_0x2a7933[_0x5d0b('0x59')]['to'][0x0],'fax':_0x2a7933[_0x5d0b('0x59')]['to'][0x0],'ListId':_0x35c2fd[_0x5d0b('0xaa')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x5d0b('0xab'));}})[_0x5d0b('0x23')](function(_0x1e69ac){if(_0x1e69ac){return db['FaxInteraction'][_0x5d0b('0x57')]({'where':{'ContactId':_0x1e69ac['id'],'closed':![],'FaxAccountId':_0x35c2fd['id']}})[_0x5d0b('0x23')](function(_0x38331a){if(_0x38331a){return[_0x38331a,![]];}return db[_0x5d0b('0x71')][_0x5d0b('0x58')]({'UserId':_0x2a7933[_0x5d0b('0x5a')]['id'],'ContactId':_0x1e69ac['id'],'FaxAccountId':_0x35c2fd['id'],'fax':_0x2a7933[_0x5d0b('0x59')]['to'][0x0],'firstMsgDirection':_0x5d0b('0xac'),'Messages':[_[_0x5d0b('0x4d')](_0x2a7933['body'],{'read':![],'body':_0x2a7933[_0x5d0b('0x59')][_0x5d0b('0xa3')][0x0][_0x5d0b('0xad')],'FaxAccountId':_0x35c2fd['id'],'UserId':_0x2a7933[_0x5d0b('0x5a')]['id'],'ContactId':_0x1e69ac['id'],'AttachmentId':_0x2a7933[_0x5d0b('0x59')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})['then'](function(_0x263478){return[_0x263478,!![]];});});}else{throw new Error(_0x5d0b('0xae'));}})[_0x5d0b('0xaf')](function(_0x2720ac,_0x2d86fe){if(_0x2d86fe){return _0x2720ac;}return db[_0x5d0b('0x9b')]['create']({'direction':_0x5d0b('0xac'),'read':![],'body':_0x2a7933[_0x5d0b('0x59')][_0x5d0b('0xa3')][0x0][_0x5d0b('0xad')],'FaxAccountId':_0x35c2fd['id'],'FaxInteractionId':_0x2720ac['id'],'UserId':_0x2a7933[_0x5d0b('0x5a')]['id'],'ContactId':_0x2720ac['ContactId'],'AttachmentId':_0x2a7933[_0x5d0b('0x59')][_0x5d0b('0xa3')][0x0]['id']})[_0x5d0b('0x23')](function(_0x4c9a14){_0x2720ac['dataValues'][_0x5d0b('0xb0')]=[];_0x2720ac[_0x5d0b('0xb1')]['Messages']['push'](_0x4c9a14[_0x5d0b('0xb1')]);return _0x2720ac;});})[_0x5d0b('0x23')](function(_0x4d5d12){respondWithRpcPromise(_0x5d0b('0xb2'),_0x5d0b('0xb2'),{'FaxAccountId':_[_0x5d0b('0xa7')](_0x2a7933[_0x5d0b('0x62')]['id'])?undefined:_0x2a7933[_0x5d0b('0x62')]['id'],'path':_[_0x5d0b('0xa7')](_0x2a7933['body'][_0x5d0b('0xa3')][0x0][_0x5d0b('0x7')])?undefined:_0x2a7933[_0x5d0b('0x59')][_0x5d0b('0xa3')][0x0][_0x5d0b('0x7')],'fax':_[_0x5d0b('0xa7')](_0x2a7933[_0x5d0b('0x59')]['to'][0x0])?undefined:_0x2a7933[_0x5d0b('0x59')]['to'][0x0],'AttachmentId':_0x2a7933[_0x5d0b('0x59')][_0x5d0b('0xa3')][0x0]['id']},client9002)[_0x5d0b('0x23')](function(_0x22a2f7){logger[_0x5d0b('0x24')](_0x5d0b('0xb3'),_0x22a2f7);})[_0x5d0b('0x2e')](function(_0x4a3f02){logger['info'](_0x5d0b('0xb3'),_0x4a3f02);});return _0x4d5d12;})['then'](respondWithResult(_0x173f73,null))[_0x5d0b('0x2e')](handleError(_0x173f73,null));};exports[_0x5d0b('0xb4')]=function(_0x1dd4cc,_0x2ebee3,_0x36b7ca){return db['FaxAccount'][_0x5d0b('0x57')]({'where':{'id':_0x1dd4cc[_0x5d0b('0x62')]['id']}})['then'](handleEntityNotFound(_0x2ebee3,null))[_0x5d0b('0x23')](function(_0x5bcbd0){if(_0x5bcbd0){return _0x5bcbd0['addAgents'](_0x1dd4cc[_0x5d0b('0x59')][_0x5d0b('0x6e')],_[_0x5d0b('0x72')](_0x1dd4cc['body'],[_0x5d0b('0x6e'),'id'])||{})[_0x5d0b('0xaf')](function(_0x3c94c6){for(var _0x261b6a=0x0;_0x261b6a<_0x1dd4cc[_0x5d0b('0x59')][_0x5d0b('0x6e')][_0x5d0b('0x48')];_0x261b6a+=0x1){socket[_0x5d0b('0xb5')](_0x5d0b('0xb6'),{'UserId':_0x1dd4cc[_0x5d0b('0x59')][_0x5d0b('0x6e')][_0x261b6a],'FaxAccountId':_0x1dd4cc['params']['id']});}return _0x3c94c6;});}})[_0x5d0b('0x23')](respondWithResult(_0x2ebee3,null))[_0x5d0b('0x2e')](handleError(_0x2ebee3,null));};exports[_0x5d0b('0xb7')]=function(_0x31fe2f,_0x5801ac,_0x180103){return db[_0x5d0b('0x51')][_0x5d0b('0x57')]({'where':{'id':_0x31fe2f[_0x5d0b('0x62')]['id']}})['then'](handleEntityNotFound(_0x5801ac,null))['then'](function(_0x33f103){if(_0x33f103){return _0x33f103[_0x5d0b('0xb7')](_0x31fe2f[_0x5d0b('0x41')][_0x5d0b('0x6e')])['then'](function(){if(_[_0x5d0b('0xb8')](_0x31fe2f[_0x5d0b('0x41')][_0x5d0b('0x6e')])){for(var _0x30b438=0x0;_0x30b438<_0x31fe2f[_0x5d0b('0x41')]['ids'][_0x5d0b('0x48')];_0x30b438+=0x1){socket['emit'](_0x5d0b('0xb9'),{'UserId':Number(_0x31fe2f['query']['ids'][_0x30b438]),'FaxAccountId':Number(_0x31fe2f[_0x5d0b('0x62')]['id'])});}}else{socket[_0x5d0b('0xb5')](_0x5d0b('0xb9'),{'UserId':Number(_0x31fe2f[_0x5d0b('0x41')][_0x5d0b('0x6e')]),'FaxAccountId':Number(_0x31fe2f[_0x5d0b('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x5801ac,null))['catch'](handleError(_0x5801ac,null));};exports[_0x5d0b('0xba')]=function(_0x11ba3e,_0x5dd2a2,_0x15ceb0){var _0x4e6408={};var _0x356bcb={};var _0x550808;var _0x223856;return db[_0x5d0b('0x51')][_0x5d0b('0x66')]({'where':{'id':_0x11ba3e[_0x5d0b('0x62')]['id']}})['then'](handleEntityNotFound(_0x5dd2a2,null))[_0x5d0b('0x23')](function(_0x2e32b1){if(_0x2e32b1){_0x550808=_0x2e32b1;_0x356bcb[_0x5d0b('0x46')]=_['keys'](db[_0x5d0b('0x75')][_0x5d0b('0x3f')]);_0x356bcb['query']=_[_0x5d0b('0x42')](_0x11ba3e[_0x5d0b('0x41')]);_0x356bcb['filters']=_[_0x5d0b('0x44')](_0x356bcb[_0x5d0b('0x46')],_0x356bcb[_0x5d0b('0x41')]);_0x4e6408['attributes']=_[_0x5d0b('0x44')](_0x356bcb[_0x5d0b('0x46')],qs[_0x5d0b('0x47')](_0x11ba3e[_0x5d0b('0x41')][_0x5d0b('0x47')]));_0x4e6408[_0x5d0b('0x45')]=_0x4e6408[_0x5d0b('0x45')][_0x5d0b('0x48')]?_0x4e6408[_0x5d0b('0x45')]:_0x356bcb[_0x5d0b('0x46')];_0x4e6408['order']=qs[_0x5d0b('0x4a')](_0x11ba3e[_0x5d0b('0x41')][_0x5d0b('0x4a')]);_0x4e6408[_0x5d0b('0x4b')]=qs[_0x5d0b('0x43')](_[_0x5d0b('0x4c')](_0x11ba3e[_0x5d0b('0x41')],_0x356bcb['filters']));if(_0x11ba3e[_0x5d0b('0x41')][_0x5d0b('0x6b')]){_0x4e6408[_0x5d0b('0x4b')]=_[_0x5d0b('0x4d')](_0x4e6408[_0x5d0b('0x4b')],{'$or':_[_0x5d0b('0x6c')](_0x4e6408[_0x5d0b('0x45')],function(_0x1b8dbc){var _0x4b5284={};_0x4b5284[_0x1b8dbc]={'$like':'%'+_0x11ba3e['query']['filter']+'%'};return _0x4b5284;})});}_0x4e6408=_[_0x5d0b('0x4d')]({},_0x4e6408,_0x11ba3e[_0x5d0b('0x50')]);return _0x550808[_0x5d0b('0xba')](_0x4e6408);}})[_0x5d0b('0x23')](function(_0x3e4e49){if(_0x3e4e49){_0x223856=_0x3e4e49[_0x5d0b('0x48')];if(!_0x11ba3e[_0x5d0b('0x41')][_0x5d0b('0x68')](_0x5d0b('0x69'))){_0x4e6408[_0x5d0b('0x49')]=qs[_0x5d0b('0x49')](_0x11ba3e[_0x5d0b('0x41')][_0x5d0b('0x49')]);_0x4e6408[_0x5d0b('0x32')]=qs['offset'](_0x11ba3e['query'][_0x5d0b('0x32')]);}return _0x550808[_0x5d0b('0xba')](_0x4e6408);}})['then'](function(_0x2da883){if(_0x2da883){return _0x2da883?{'count':_0x223856,'rows':_0x2da883}:null;}})[_0x5d0b('0x23')](respondWithResult(_0x5dd2a2,null))['catch'](handleError(_0x5dd2a2,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index d252897..a601c6c 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 _0x8388=['emit','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x27c478,_0x17925d){var _0x36b19c=function(_0x20b9ea){while(--_0x20b9ea){_0x27c478['push'](_0x27c478['shift']());}};_0x36b19c(++_0x17925d);}(_0x8388,0x110));var _0x8838=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0x8388[_0x87239];return _0x53af1e;};'use strict';var EventEmitter=require(_0x8838('0x0'));var FaxAccount=require(_0x8838('0x1'))['db'][_0x8838('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x8838('0x3')](0x0);var events={'afterCreate':_0x8838('0x4'),'afterUpdate':_0x8838('0x5'),'afterDestroy':_0x8838('0x6')};function emitEvent(_0x31742e){return function(_0x496d10,_0x4c52e9,_0x2ea456){FaxAccountEvents[_0x8838('0x7')](_0x31742e+':'+_0x496d10['id'],_0x496d10);FaxAccountEvents[_0x8838('0x7')](_0x31742e,_0x496d10);_0x2ea456(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x8838('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x90ab=['update','remove','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x90ab,0x1f3));var _0xb90a=function(_0xe5efcb,_0x473f01){_0xe5efcb=_0xe5efcb-0x0;var _0x782d72=_0x90ab[_0xe5efcb];return _0x782d72;};'use strict';var EventEmitter=require(_0xb90a('0x0'));var FaxAccount=require(_0xb90a('0x1'))['db'][_0xb90a('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb90a('0x3')](0x0);var events={'afterCreate':_0xb90a('0x4'),'afterUpdate':_0xb90a('0x5'),'afterDestroy':_0xb90a('0x6')};function emitEvent(_0x232334){return function(_0x4341ea,_0x337f0c,_0x40ed48){FaxAccountEvents['emit'](_0x232334+':'+_0x4341ea['id'],_0x4341ea);FaxAccountEvents['emit'](_0x232334,_0x4341ea);_0x40ed48(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xb90a('0x7')](e,emitEvent(event));}}module[_0xb90a('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index a9eb6fa..cdd1e3f 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 _0xe8a3=['path','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','../../config/logger','api','moment'];(function(_0x499f6f,_0x3bf9f4){var _0x56abe1=function(_0x655d86){while(--_0x655d86){_0x499f6f['push'](_0x499f6f['shift']());}};_0x56abe1(++_0x3bf9f4);}(_0xe8a3,0x182));var _0x3e8a=function(_0x31752d,_0x2efff8){_0x31752d=_0x31752d-0x0;var _0x29da67=_0xe8a3[_0x31752d];return _0x29da67;};'use strict';var _=require(_0x3e8a('0x0'));var util=require('util');var logger=require(_0x3e8a('0x1'))(_0x3e8a('0x2'));var moment=require(_0x3e8a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e8a('0x4'));var rimraf=require('rimraf');var config=require(_0x3e8a('0x5'));var attributes=require(_0x3e8a('0x6'));module[_0x3e8a('0x7')]=function(_0x47d2a9,_0x4af06e){return _0x47d2a9[_0x3e8a('0x8')]('FaxAccount',attributes,{'tableName':_0x3e8a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfeb3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','fax_accounts','lodash','../../config/logger','api'];(function(_0x21c14a,_0x3b87bd){var _0x31bd22=function(_0x1ab199){while(--_0x1ab199){_0x21c14a['push'](_0x21c14a['shift']());}};_0x31bd22(++_0x3b87bd);}(_0xfeb3,0x129));var _0x3feb=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xfeb3[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x3feb('0x0'));var util=require('util');var logger=require(_0x3feb('0x1'))(_0x3feb('0x2'));var moment=require(_0x3feb('0x3'));var BPromise=require(_0x3feb('0x4'));var rp=require(_0x3feb('0x5'));var fs=require('fs');var path=require(_0x3feb('0x6'));var rimraf=require(_0x3feb('0x7'));var config=require(_0x3feb('0x8'));var attributes=require(_0x3feb('0x9'));module[_0x3feb('0xa')]=function(_0x387314,_0x4381ec){return _0x387314['define']('FaxAccount',attributes,{'tableName':_0x3feb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 362949e..880a510 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 _0x0cdc=['difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','DESC','FaxApplication','Applications','get','applications','list','priority','asc','Contacts','length','create','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','unshift','agent','name','Start','startRouting','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','map','model','include','catch','CmContact','describe','Sequelize','ValidationError'];(function(_0x4018cb,_0x550827){var _0x17a239=function(_0x574986){while(--_0x574986){_0x4018cb['push'](_0x4018cb['shift']());}};_0x17a239(++_0x550827);}(_0x0cdc,0x1e7));var _0xc0cd=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x0cdc[_0x2df507];return _0x1f7167;};'use strict';var _=require('lodash');var util=require(_0xc0cd('0x0'));var moment=require('moment');var BPromise=require(_0xc0cd('0x1'));var rs=require(_0xc0cd('0x2'));var fs=require('fs');var Redis=require(_0xc0cd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0cd('0x4'));var logger=require('../../config/logger')(_0xc0cd('0x5'));var config=require(_0xc0cd('0x6'));var jayson=require(_0xc0cd('0x7'));var client=jayson[_0xc0cd('0x8')][_0xc0cd('0x9')]({'port':0x232c});config['redis']=_[_0xc0cd('0xa')](config[_0xc0cd('0xb')],{'host':_0xc0cd('0xc'),'port':0x18eb});var socket=require(_0xc0cd('0xd'))(new Redis(config[_0xc0cd('0xb')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x36313c,_0x2f40e4,_0x36497b){return new BPromise(function(_0x53252a,_0x4a867e){return client[_0xc0cd('0xe')](_0x36313c,_0x36497b)[_0xc0cd('0xf')](function(_0x39db94){logger[_0xc0cd('0x10')](_0xc0cd('0x11'),_0x2f40e4,_0xc0cd('0x12'));logger[_0xc0cd('0x13')](_0xc0cd('0x14'),_0x2f40e4,_0xc0cd('0x12'),JSON[_0xc0cd('0x15')](_0x39db94));if(_0x39db94[_0xc0cd('0x16')]){if(_0x39db94[_0xc0cd('0x16')][_0xc0cd('0x17')]===0x1f4){logger[_0xc0cd('0x16')](_0xc0cd('0x11'),_0x2f40e4,_0x39db94[_0xc0cd('0x16')][_0xc0cd('0x18')]);return _0x4a867e(_0x39db94[_0xc0cd('0x16')][_0xc0cd('0x18')]);}logger[_0xc0cd('0x16')](_0xc0cd('0x11'),_0x2f40e4,_0x39db94[_0xc0cd('0x16')][_0xc0cd('0x18')]);return _0x53252a(_0x39db94['error']['message']);}else{logger[_0xc0cd('0x10')](_0xc0cd('0x11'),_0x2f40e4,'request\x20sent');_0x53252a(_0x39db94[_0xc0cd('0x19')]['message']);}})['catch'](function(_0x47b2d8){logger[_0xc0cd('0x16')](_0xc0cd('0x11'),_0x2f40e4,_0x47b2d8);_0x4a867e(_0x47b2d8);});});}exports[_0xc0cd('0x1a')]=function(_0x31b3f2){var _0x40e66e=this;return new Promise(function(_0x4538f4,_0x587a50){return db[_0xc0cd('0x1b')][_0xc0cd('0x1c')]({'raw':_0x31b3f2[_0xc0cd('0x1d')]?_0x31b3f2[_0xc0cd('0x1d')][_0xc0cd('0x1e')]===undefined?!![]:![]:!![],'where':_0x31b3f2[_0xc0cd('0x1d')]?_0x31b3f2[_0xc0cd('0x1d')]['where']||null:null,'attributes':_0x31b3f2[_0xc0cd('0x1d')]?_0x31b3f2[_0xc0cd('0x1d')][_0xc0cd('0x1f')]||null:null,'limit':_0x31b3f2[_0xc0cd('0x1d')]?_0x31b3f2[_0xc0cd('0x1d')][_0xc0cd('0x20')]||null:null,'include':_0x31b3f2[_0xc0cd('0x1d')]?_0x31b3f2[_0xc0cd('0x1d')]['include']?_[_0xc0cd('0x21')](_0x31b3f2[_0xc0cd('0x1d')]['include'],function(_0x363b19){return{'model':db[_0x363b19[_0xc0cd('0x22')]],'as':_0x363b19['as'],'attributes':_0x363b19[_0xc0cd('0x1f')],'include':_0x363b19['include']?_[_0xc0cd('0x21')](_0x363b19['include'],function(_0x461b62){return{'model':db[_0x461b62[_0xc0cd('0x22')]],'as':_0x461b62['as'],'attributes':_0x461b62['attributes'],'include':_0x461b62[_0xc0cd('0x23')]?_['map'](_0x461b62[_0xc0cd('0x23')],function(_0x2e467f){return{'model':db[_0x2e467f[_0xc0cd('0x22')]],'as':_0x2e467f['as'],'attributes':_0x2e467f[_0xc0cd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc0cd('0xf')](function(_0x349e6d){logger['info'](_0xc0cd('0x1a'),_0x31b3f2);logger['debug'](_0xc0cd('0x1a'),_0x31b3f2,JSON[_0xc0cd('0x15')](_0x349e6d));_0x4538f4(_0x349e6d);})[_0xc0cd('0x24')](function(_0x4ad073){logger[_0xc0cd('0x16')](_0xc0cd('0x1a'),_0x4ad073[_0xc0cd('0x18')],_0x31b3f2);_0x587a50(_0x40e66e[_0xc0cd('0x16')](0x1f4,_0x4ad073[_0xc0cd('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x2dbe0e,_0x45a403,_0xed72e4){var _0x3fc665=this;return new Promise(function(_0x44bc94,_0x2a966e){var _0x1aa4fa={'body':_0x2dbe0e['body'],'channel':'fax'};var _0xde77e2=[];var _0x365241=[];var _0x4ed042={};return db[_0xc0cd('0x25')][_0xc0cd('0x26')]()[_0xc0cd('0xf')](function(_0x5d10d8){if(!_0x5d10d8){throw new db[(_0xc0cd('0x27'))][(_0xc0cd('0x28'))]('no\x20available\x20attributes');}_0xde77e2=_[_0xc0cd('0x29')](_[_0xc0cd('0x2a')](_0x5d10d8),[_0xc0cd('0x2b'),_0xc0cd('0x2c')]);_0x365241=_[_0xc0cd('0x29')](_[_0xc0cd('0x2a')](_0x5d10d8),[_0xc0cd('0x2b'),_0xc0cd('0x2c'),_0xc0cd('0x2d'),_0xc0cd('0x2e')]);if(_0x2dbe0e['body']['id']){delete _0x2dbe0e[_0xc0cd('0x2f')]['id'];}if(_[_0xc0cd('0x30')](_0x2dbe0e[_0xc0cd('0x2f')]['from'])){throw new db[(_0xc0cd('0x27'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x2dbe0e[_0xc0cd('0x2f')][_0xc0cd('0x2f')])||_0x2dbe0e[_0xc0cd('0x2f')][_0xc0cd('0x2f')]===''){throw new db['Sequelize'][(_0xc0cd('0x28'))](_0xc0cd('0x31'));}if(_[_0xc0cd('0x30')](_0x2dbe0e['body'][_0xc0cd('0x32')])){throw new db[(_0xc0cd('0x27'))][(_0xc0cd('0x28'))](_0xc0cd('0x33')+_0x365241);}if(!_[_0xc0cd('0x34')](_0x365241,_0x2dbe0e[_0xc0cd('0x2f')][_0xc0cd('0x32')])){throw new db[(_0xc0cd('0x27'))][(_0xc0cd('0x28'))](_0xc0cd('0x35')+_0x365241);}_0x4ed042[_0x2dbe0e['body']['mapKey']]=_0x2dbe0e[_0xc0cd('0x2f')][_0xc0cd('0x36')];})[_0xc0cd('0xf')](function(){return db['FaxAccount'][_0xc0cd('0x37')]({'where':{'id':_0x2dbe0e[_0xc0cd('0x38')]['id']},'include':[{'model':db[_0xc0cd('0x39')],'as':_0xc0cd('0x3a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4ed042,'limit':0x1,'order':[['updatedAt',_0xc0cd('0x3b')]]}]},{'model':db[_0xc0cd('0x3c')],'as':_0xc0cd('0x3d')}]});})[_0xc0cd('0xf')](function(_0x1dfa18){if(_0x1dfa18&&_0x1dfa18['List']){var _0x47dbd5=_0x1dfa18[_0xc0cd('0x3e')]({'plain':!![]});_0x1aa4fa[_0xc0cd('0x38')]=_0x47dbd5;_0x1aa4fa[_0xc0cd('0x3f')]=_0x47dbd5[_0xc0cd('0x3d')];_0x1aa4fa[_0xc0cd('0x40')]=_0x47dbd5[_0xc0cd('0x3a')];_0x1aa4fa['applications']=_['orderBy'](_0x1aa4fa[_0xc0cd('0x3f')],[_0xc0cd('0x41')],[_0xc0cd('0x42')]);if(_0x1aa4fa[_0xc0cd('0x38')][_0xc0cd('0x3d')]){delete _0x1aa4fa['account'][_0xc0cd('0x3d')];}if(_0x1aa4fa[_0xc0cd('0x38')][_0xc0cd('0x3a')]&&_0x1aa4fa['account']['List'][_0xc0cd('0x43')][_0xc0cd('0x44')]){return _0x1aa4fa[_0xc0cd('0x38')][_0xc0cd('0x3a')][_0xc0cd('0x43')][0x0];}var _0x1b8546=_[_0xc0cd('0xa')](_0x2dbe0e[_0xc0cd('0x2f')],{'firstName':_0x2dbe0e[_0xc0cd('0x2f')][_0xc0cd('0x36')],'ListId':_0x47dbd5['ListId']});_0x1b8546[_0x2dbe0e[_0xc0cd('0x2f')][_0xc0cd('0x32')]]=_0x2dbe0e['body'][_0xc0cd('0x36')];return db['CmContact'][_0xc0cd('0x45')](_0x1b8546,{'fields':_0xde77e2,'raw':!![]});}})['then'](function(_0x103139){_0x1aa4fa['contact']=_0x103139;if(_0x103139){var _0x587493={'ContactId':_0x103139['id'],'FaxAccountId':_0x2dbe0e[_0xc0cd('0x38')]['id'],'fax':_0x103139[_0xc0cd('0x46')]};return db[_0xc0cd('0x47')]['find']({'where':{'ContactId':_0x103139['id'],'closed':![],'FaxAccountId':_0x2dbe0e[_0xc0cd('0x38')]['id']}})[_0xc0cd('0xf')](function(_0x1b1b79){if(_0x1b1b79){return[_0x1b1b79,![]];}return db['FaxInteraction']['create'](_0x587493)[_0xc0cd('0xf')](function(_0x18e67e){return[_0x18e67e,!![]];});});}else{throw new Error(_0xc0cd('0x48'));}})[_0xc0cd('0x49')](function(_0x42d55b,_0x2622b0){var _0x1f1f25=_0x42d55b[_0xc0cd('0x3e')]({'plain':!![]});if(_0x2622b0){if(_0x1aa4fa['account'][_0xc0cd('0x4a')]){_0x1aa4fa[_0xc0cd('0x3f')]['push']({'id':0x0,'priority':_0x1aa4fa['applications'][_0xc0cd('0x44')]+0x1,'app':_0xc0cd('0x4b'),'appdata':_0xc0cd('0x4c'),'interval':_0xc0cd('0x4d')});}_0x1f1f25[_0xc0cd('0x4e')]=!![];}else{_0x1f1f25[_0xc0cd('0x4e')]=![];}_0x1aa4fa[_0xc0cd('0x4f')]=_0x1f1f25;return db[_0xc0cd('0x50')]['create']({'body':_0x2dbe0e[_0xc0cd('0x2f')][_0xc0cd('0x2f')],'FaxAccountId':_0x2dbe0e[_0xc0cd('0x38')]['id'],'FaxInteractionId':_0x42d55b['id'],'direction':'in','ContactId':_0x42d55b[_0xc0cd('0x51')],'AttachmentId':_0x2dbe0e[_0xc0cd('0x2f')]['AttachmentId']});})[_0xc0cd('0xf')](function(_0x25ce68){_0x1aa4fa['message']=_0x25ce68;if(_0x1aa4fa[_0xc0cd('0x4f')][_0xc0cd('0x52')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x1aa4fa[_0xc0cd('0x4f')][_0xc0cd('0x52')]}})['then'](function(_0x5e201d){if(_0x5e201d){_0x1aa4fa[_0xc0cd('0x3f')][_0xc0cd('0x53')]({'id':0x0,'priority':0x0,'app':_0xc0cd('0x54'),'appdata':_0x5e201d[_0xc0cd('0x55')]+','+(_0x1aa4fa[_0xc0cd('0x38')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc0cd('0x56'),_0xc0cd('0x57'),_0x1aa4fa);});}return respondWithRpcPromise(_0xc0cd('0x56'),_0xc0cd('0x57'),_0x1aa4fa);})[_0xc0cd('0xf')](function(_0x169c7a){_0x44bc94(_0x169c7a);})['catch'](function(_0x226264){_0x2a966e(_0x3fc665['error'](0x1f4,_0x226264[_0xc0cd('0x18')]));});});}; \ No newline at end of file +var _0x212f=['FaxInteraction','Contact\x20not\x20found','autoclose','push','close','unmanaged','*,*,*,*','FaxMessage','ContactId','UserId','interaction','startRouting','Start','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','map','include','model','attributes','then','NotifyFaxAccount','body','CmContact','describe','no\x20available\x20attributes','createdAt','updatedAt','ListId','Sequelize','from\x20is\x20mandatory','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','find','CmList','List','Contacts','DESC','FaxApplication','get','account','Applications','list','applications','orderBy','priority','length','defaults','from','create','fax'];(function(_0x49a96a,_0xa76a44){var _0x33fb57=function(_0x37946c){while(--_0x37946c){_0x49a96a['push'](_0x49a96a['shift']());}};_0x33fb57(++_0xa76a44);}(_0x212f,0x1f3));var _0xf212=function(_0x1921d8,_0x641b2d){_0x1921d8=_0x1921d8-0x0;var _0x53e14e=_0x212f[_0x1921d8];return _0x53e14e;};'use strict';var _=require('lodash');var util=require(_0xf212('0x0'));var moment=require(_0xf212('0x1'));var BPromise=require('bluebird');var rs=require(_0xf212('0x2'));var fs=require('fs');var Redis=require(_0xf212('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf212('0x4'));var logger=require('../../config/logger')(_0xf212('0x5'));var config=require(_0xf212('0x6'));var jayson=require(_0xf212('0x7'));var client=jayson[_0xf212('0x8')][_0xf212('0x9')]({'port':0x232c});config[_0xf212('0xa')]=_['defaults'](config[_0xf212('0xa')],{'host':_0xf212('0xb'),'port':0x18eb});var socket=require(_0xf212('0xc'))(new Redis(config[_0xf212('0xa')]));require('./faxAccount.socket')[_0xf212('0xd')](socket);function respondWithRpcPromise(_0x20566d,_0x59a057,_0x5e2cd3){return new BPromise(function(_0x3e3900,_0x4eb3d5){return client[_0xf212('0xe')](_0x20566d,_0x5e2cd3)['then'](function(_0x497a81){logger[_0xf212('0xf')](_0xf212('0x10'),_0x59a057,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x59a057,_0xf212('0x11'),JSON[_0xf212('0x12')](_0x497a81));if(_0x497a81[_0xf212('0x13')]){if(_0x497a81['error'][_0xf212('0x14')]===0x1f4){logger['error'](_0xf212('0x10'),_0x59a057,_0x497a81[_0xf212('0x13')][_0xf212('0x15')]);return _0x4eb3d5(_0x497a81[_0xf212('0x13')][_0xf212('0x15')]);}logger[_0xf212('0x13')](_0xf212('0x10'),_0x59a057,_0x497a81[_0xf212('0x13')][_0xf212('0x15')]);return _0x3e3900(_0x497a81[_0xf212('0x13')]['message']);}else{logger[_0xf212('0xf')]('FaxAccount,\x20%s,\x20%s',_0x59a057,_0xf212('0x11'));_0x3e3900(_0x497a81[_0xf212('0x16')][_0xf212('0x15')]);}})[_0xf212('0x17')](function(_0x5b928f){logger['error'](_0xf212('0x10'),_0x59a057,_0x5b928f);_0x4eb3d5(_0x5b928f);});});}exports[_0xf212('0x18')]=function(_0x178661){var _0x573fae=this;return new Promise(function(_0x194138,_0x161e6f){return db[_0xf212('0x19')][_0xf212('0x1a')]({'raw':_0x178661[_0xf212('0x1b')]?_0x178661[_0xf212('0x1b')][_0xf212('0x1c')]===undefined?!![]:![]:!![],'where':_0x178661[_0xf212('0x1b')]?_0x178661[_0xf212('0x1b')][_0xf212('0x1d')]||null:null,'attributes':_0x178661[_0xf212('0x1b')]?_0x178661[_0xf212('0x1b')]['attributes']||null:null,'limit':_0x178661[_0xf212('0x1b')]?_0x178661['options']['limit']||null:null,'include':_0x178661[_0xf212('0x1b')]?_0x178661['options']['include']?_[_0xf212('0x1e')](_0x178661[_0xf212('0x1b')][_0xf212('0x1f')],function(_0x1ecd9c){return{'model':db[_0x1ecd9c[_0xf212('0x20')]],'as':_0x1ecd9c['as'],'attributes':_0x1ecd9c['attributes'],'include':_0x1ecd9c['include']?_['map'](_0x1ecd9c[_0xf212('0x1f')],function(_0x44195d){return{'model':db[_0x44195d['model']],'as':_0x44195d['as'],'attributes':_0x44195d['attributes'],'include':_0x44195d[_0xf212('0x1f')]?_[_0xf212('0x1e')](_0x44195d[_0xf212('0x1f')],function(_0x276c58){return{'model':db[_0x276c58['model']],'as':_0x276c58['as'],'attributes':_0x276c58[_0xf212('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf212('0x22')](function(_0x5becd8){logger[_0xf212('0xf')](_0xf212('0x18'),_0x178661);logger['debug'](_0xf212('0x18'),_0x178661,JSON[_0xf212('0x12')](_0x5becd8));_0x194138(_0x5becd8);})[_0xf212('0x17')](function(_0x18daa5){logger[_0xf212('0x13')](_0xf212('0x18'),_0x18daa5[_0xf212('0x15')],_0x178661);_0x161e6f(_0x573fae[_0xf212('0x13')](0x1f4,_0x18daa5['message']));});});};exports[_0xf212('0x23')]=function(_0x495cb5,_0x4d2368,_0x4b55e8){var _0x32404f=this;return new Promise(function(_0x232aac,_0x18cd7a){var _0xd88909={'body':_0x495cb5[_0xf212('0x24')],'channel':'fax'};var _0x407aaf=[];var _0x55fb0c=[];var _0x225e5a={};return db[_0xf212('0x25')][_0xf212('0x26')]()[_0xf212('0x22')](function(_0x5f107f){if(!_0x5f107f){throw new db['Sequelize']['ValidationError'](_0xf212('0x27'));}_0x407aaf=_['difference'](_['keys'](_0x5f107f),[_0xf212('0x28'),_0xf212('0x29')]);_0x55fb0c=_['difference'](_['keys'](_0x5f107f),[_0xf212('0x28'),_0xf212('0x29'),'CompanyId',_0xf212('0x2a')]);if(_0x495cb5[_0xf212('0x24')]['id']){delete _0x495cb5['body']['id'];}if(_['isNil'](_0x495cb5[_0xf212('0x24')]['from'])){throw new db[(_0xf212('0x2b'))]['ValidationError'](_0xf212('0x2c'));}if(_[_0xf212('0x2d')](_0x495cb5['body'][_0xf212('0x24')])||_0x495cb5[_0xf212('0x24')]['body']===''){throw new db[(_0xf212('0x2b'))][(_0xf212('0x2e'))](_0xf212('0x2f'));}if(_[_0xf212('0x2d')](_0x495cb5[_0xf212('0x24')][_0xf212('0x30')])){throw new db[(_0xf212('0x2b'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x55fb0c);}if(!_[_0xf212('0x31')](_0x55fb0c,_0x495cb5[_0xf212('0x24')]['mapKey'])){throw new db[(_0xf212('0x2b'))][(_0xf212('0x2e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x55fb0c);}_0x225e5a[_0x495cb5[_0xf212('0x24')]['mapKey']]=_0x495cb5[_0xf212('0x24')]['from'];})[_0xf212('0x22')](function(){return db[_0xf212('0x19')][_0xf212('0x32')]({'where':{'id':_0x495cb5['account']['id']},'include':[{'model':db[_0xf212('0x33')],'as':_0xf212('0x34'),'include':[{'model':db[_0xf212('0x25')],'as':_0xf212('0x35'),'where':_0x225e5a,'limit':0x1,'order':[[_0xf212('0x29'),_0xf212('0x36')]]}]},{'model':db[_0xf212('0x37')],'as':'Applications'}]});})[_0xf212('0x22')](function(_0x525dbb){if(_0x525dbb&&_0x525dbb['List']){var _0x4f09a5=_0x525dbb[_0xf212('0x38')]({'plain':!![]});_0xd88909[_0xf212('0x39')]=_0x4f09a5;_0xd88909['applications']=_0x4f09a5[_0xf212('0x3a')];_0xd88909[_0xf212('0x3b')]=_0x4f09a5[_0xf212('0x34')];_0xd88909[_0xf212('0x3c')]=_[_0xf212('0x3d')](_0xd88909['applications'],[_0xf212('0x3e')],['asc']);if(_0xd88909[_0xf212('0x39')][_0xf212('0x3a')]){delete _0xd88909[_0xf212('0x39')]['Applications'];}if(_0xd88909['account'][_0xf212('0x34')]&&_0xd88909[_0xf212('0x39')][_0xf212('0x34')][_0xf212('0x35')][_0xf212('0x3f')]){return _0xd88909['account']['List'][_0xf212('0x35')][0x0];}var _0x32aef7=_[_0xf212('0x40')](_0x495cb5[_0xf212('0x24')],{'firstName':_0x495cb5[_0xf212('0x24')]['from'],'ListId':_0x4f09a5['ListId']});_0x32aef7[_0x495cb5[_0xf212('0x24')][_0xf212('0x30')]]=_0x495cb5['body'][_0xf212('0x41')];return db[_0xf212('0x25')][_0xf212('0x42')](_0x32aef7,{'fields':_0x407aaf,'raw':!![]});}})['then'](function(_0x579587){_0xd88909['contact']=_0x579587;if(_0x579587){var _0x5c7a42={'ContactId':_0x579587['id'],'FaxAccountId':_0x495cb5['account']['id'],'fax':_0x579587[_0xf212('0x43')]};return db[_0xf212('0x44')][_0xf212('0x32')]({'where':{'ContactId':_0x579587['id'],'closed':![],'FaxAccountId':_0x495cb5[_0xf212('0x39')]['id']}})['then'](function(_0x3085c8){if(_0x3085c8){return[_0x3085c8,![]];}return db['FaxInteraction']['create'](_0x5c7a42)[_0xf212('0x22')](function(_0x109469){return[_0x109469,!![]];});});}else{throw new Error(_0xf212('0x45'));}})['spread'](function(_0x1d0957,_0x52dc0f){var _0x2974fd=_0x1d0957['get']({'plain':!![]});if(_0x52dc0f){if(_0xd88909[_0xf212('0x39')][_0xf212('0x46')]){_0xd88909[_0xf212('0x3c')][_0xf212('0x47')]({'id':0x0,'priority':_0xd88909[_0xf212('0x3c')]['length']+0x1,'app':_0xf212('0x48'),'appdata':_0xf212('0x49'),'interval':_0xf212('0x4a')});}_0x2974fd['created']=!![];}else{_0x2974fd['created']=![];}_0xd88909['interaction']=_0x2974fd;return db[_0xf212('0x4b')][_0xf212('0x42')]({'body':_0x495cb5[_0xf212('0x24')][_0xf212('0x24')],'FaxAccountId':_0x495cb5['account']['id'],'FaxInteractionId':_0x1d0957['id'],'direction':'in','ContactId':_0x1d0957[_0xf212('0x4c')],'AttachmentId':_0x495cb5[_0xf212('0x24')]['AttachmentId']});})[_0xf212('0x22')](function(_0x15d835){_0xd88909[_0xf212('0x15')]=_0x15d835;if(_0xd88909['interaction'][_0xf212('0x4d')]){return db['User'][_0xf212('0x32')]({'attributes':['id','name'],'where':{'id':_0xd88909[_0xf212('0x4e')][_0xf212('0x4d')]}})[_0xf212('0x22')](function(_0x107fff){if(_0x107fff){_0xd88909[_0xf212('0x3c')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x107fff['name']+','+(_0xd88909[_0xf212('0x39')]['waitForTheAssignedAgent']||0xa),'interval':_0xf212('0x4a')});}return respondWithRpcPromise('Start',_0xf212('0x4f'),_0xd88909);});}return respondWithRpcPromise(_0xf212('0x50'),'startRouting',_0xd88909);})[_0xf212('0x22')](function(_0x1719e4){_0x232aac(_0x1719e4);})[_0xf212('0x17')](function(_0x3ca9a7){_0x18cd7a(_0x32404f[_0xf212('0x13')](0x1f4,_0x3ca9a7['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 8c5fa58..8734c70 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 _0xa46e=['./faxAccount.events','save','update','emit','register','faxAccount:'];(function(_0x26356f,_0x1a118c){var _0x1908db=function(_0x305b43){while(--_0x305b43){_0x26356f['push'](_0x26356f['shift']());}};_0x1908db(++_0x1a118c);}(_0xa46e,0x8a));var _0xea46=function(_0x160248,_0x2a57e6){_0x160248=_0x160248-0x0;var _0x4e589d=_0xa46e[_0x160248];return _0x4e589d;};'use strict';var FaxAccountEvents=require(_0xea46('0x0'));var events=[_0xea46('0x1'),'remove',_0xea46('0x2')];function createListener(_0x2f69cc,_0x12deba){return function(_0x4cc9a2){_0x12deba[_0xea46('0x3')](_0x2f69cc,_0x4cc9a2);};}function removeListener(_0x4b6e4a,_0x3a2209){return function(){FaxAccountEvents['removeListener'](_0x4b6e4a,_0x3a2209);};}exports[_0xea46('0x4')]=function(_0x528404){for(var _0x10bee5=0x0,_0x3dc26f=events['length'];_0x10bee5<_0x3dc26f;_0x10bee5++){var _0x2d1b30=events[_0x10bee5];var _0x42771a=createListener(_0xea46('0x5')+_0x2d1b30,_0x528404);FaxAccountEvents['on'](_0x2d1b30,_0x42771a);}}; \ No newline at end of file +var _0xc6ac=['removeListener','register','length','./faxAccount.events','save','remove','update','emit'];(function(_0x465ce3,_0xc85d75){var _0x5f3cef=function(_0x585fe1){while(--_0x585fe1){_0x465ce3['push'](_0x465ce3['shift']());}};_0x5f3cef(++_0xc85d75);}(_0xc6ac,0x15b));var _0xcc6a=function(_0xe0b960,_0x5e1a6c){_0xe0b960=_0xe0b960-0x0;var _0x3849d5=_0xc6ac[_0xe0b960];return _0x3849d5;};'use strict';var FaxAccountEvents=require(_0xcc6a('0x0'));var events=[_0xcc6a('0x1'),_0xcc6a('0x2'),_0xcc6a('0x3')];function createListener(_0x276972,_0x279d85){return function(_0x17d786){_0x279d85[_0xcc6a('0x4')](_0x276972,_0x17d786);};}function removeListener(_0x297643,_0x22ee99){return function(){FaxAccountEvents[_0xcc6a('0x5')](_0x297643,_0x22ee99);};}exports[_0xcc6a('0x6')]=function(_0x12330e){for(var _0x197bd7=0x0,_0x5f3887=events[_0xcc6a('0x7')];_0x197bd7<_0x5f3887;_0x197bd7++){var _0x11b919=events[_0x197bd7];var _0xf02261=createListener('faxAccount:'+_0x11b919,_0x12330e);FaxAccountEvents['on'](_0x11b919,_0xf02261);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 4823590..00d7918 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 _0xd5e5=['/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','/:id/send','send','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd5e5,0x1df));var _0x5d5e=function(_0x539feb,_0x250bc9){_0x539feb=_0x539feb-0x0;var _0x3ec2e5=_0xd5e5[_0x539feb];return _0x3ec2e5;};'use strict';var multer=require(_0x5d5e('0x0'));var util=require(_0x5d5e('0x1'));var path=require(_0x5d5e('0x2'));var timeout=require(_0x5d5e('0x3'));var express=require(_0x5d5e('0x4'));var router=express[_0x5d5e('0x5')]();var fs_extra=require(_0x5d5e('0x6'));var auth=require(_0x5d5e('0x7'));var interaction=require(_0x5d5e('0x8'));var config=require(_0x5d5e('0x9'));var controller=require('./faxAccount.controller');router[_0x5d5e('0xa')]('/',auth[_0x5d5e('0xb')](),controller[_0x5d5e('0xc')]);router[_0x5d5e('0xa')](_0x5d5e('0xd'),auth[_0x5d5e('0xb')](),controller['describe']);router[_0x5d5e('0xa')](_0x5d5e('0xe'),auth['isAuthenticated'](),controller[_0x5d5e('0xf')]);router[_0x5d5e('0xa')](_0x5d5e('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x5d5e('0xa')](_0x5d5e('0x11'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x12')]);router[_0x5d5e('0xa')](_0x5d5e('0x13'),auth['isAuthenticated'](),controller[_0x5d5e('0x14')]);router[_0x5d5e('0xa')](_0x5d5e('0x15'),auth['isAuthenticated'](),controller[_0x5d5e('0x16')]);router[_0x5d5e('0xa')](_0x5d5e('0x17'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x18')]);router[_0x5d5e('0xa')](_0x5d5e('0x19'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x1a')]);router[_0x5d5e('0x1b')]('/',auth['isAuthenticated'](),controller[_0x5d5e('0x1c')]);router['post']('/:id/dispositions',auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x1d')]);router[_0x5d5e('0x1b')](_0x5d5e('0x11'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x1e')]);router['post']('/:id/interactions',auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x1f')]);router[_0x5d5e('0x1b')](_0x5d5e('0x15'),auth[_0x5d5e('0xb')](),controller['addApplications']);router[_0x5d5e('0x1b')]('/addaccountapplications',auth[_0x5d5e('0xb')](),controller['addAccountApplications']);router[_0x5d5e('0x1b')]('/updateaccountapplications',auth[_0x5d5e('0xb')](),controller['updateAccountApplications']);router[_0x5d5e('0x1b')](_0x5d5e('0x20'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x21')]);router[_0x5d5e('0x1b')](_0x5d5e('0x19'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x22')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5d5e('0x23')]);router[_0x5d5e('0x24')](_0x5d5e('0xe'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x25')]);router['delete'](_0x5d5e('0x10'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x26')]);router[_0x5d5e('0x24')](_0x5d5e('0x11'),auth[_0x5d5e('0xb')](),controller['removeAnswers']);router[_0x5d5e('0x24')]('/:id/users',auth['isAuthenticated'](),controller[_0x5d5e('0x27')]);module[_0x5d5e('0x28')]=router; \ No newline at end of file +var _0x0bd6=['addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','/:id','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','Router','fs-extra','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition'];(function(_0x2f833f,_0x520e5a){var _0x5ad658=function(_0x486d00){while(--_0x486d00){_0x2f833f['push'](_0x2f833f['shift']());}};_0x5ad658(++_0x520e5a);}(_0x0bd6,0xe5));var _0x60bd=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0bd6[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x60bd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x60bd('0x1')]();var fs_extra=require(_0x60bd('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x60bd('0x3'));var controller=require(_0x60bd('0x4'));router[_0x60bd('0x5')]('/',auth[_0x60bd('0x6')](),controller[_0x60bd('0x7')]);router[_0x60bd('0x5')](_0x60bd('0x8'),auth['isAuthenticated'](),controller[_0x60bd('0x9')]);router[_0x60bd('0x5')]('/:id',auth[_0x60bd('0x6')](),controller['show']);router[_0x60bd('0x5')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x60bd('0x6')](),controller[_0x60bd('0xa')]);router[_0x60bd('0x5')](_0x60bd('0xb'),auth[_0x60bd('0x6')](),controller[_0x60bd('0xc')]);router[_0x60bd('0x5')](_0x60bd('0xd'),auth[_0x60bd('0x6')](),controller[_0x60bd('0xe')]);router[_0x60bd('0x5')](_0x60bd('0xf'),auth[_0x60bd('0x6')](),controller[_0x60bd('0x10')]);router[_0x60bd('0x5')](_0x60bd('0x11'),auth['isAuthenticated'](),controller[_0x60bd('0x12')]);router[_0x60bd('0x13')]('/',auth[_0x60bd('0x6')](),controller[_0x60bd('0x14')]);router['post'](_0x60bd('0x15'),auth[_0x60bd('0x6')](),controller[_0x60bd('0x16')]);router[_0x60bd('0x13')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x60bd('0x17')]);router['post'](_0x60bd('0xb'),auth[_0x60bd('0x6')](),controller[_0x60bd('0x18')]);router[_0x60bd('0x13')]('/:id/applications',auth[_0x60bd('0x6')](),controller[_0x60bd('0x19')]);router['post'](_0x60bd('0x1a'),auth['isAuthenticated'](),controller[_0x60bd('0x1b')]);router[_0x60bd('0x13')](_0x60bd('0x1c'),auth[_0x60bd('0x6')](),controller[_0x60bd('0x1d')]);router['post'](_0x60bd('0x1e'),auth[_0x60bd('0x6')](),controller[_0x60bd('0x1f')]);router[_0x60bd('0x13')](_0x60bd('0x11'),auth[_0x60bd('0x6')](),controller[_0x60bd('0x20')]);router['put'](_0x60bd('0x21'),auth['isAuthenticated'](),controller[_0x60bd('0x22')]);router[_0x60bd('0x23')](_0x60bd('0x21'),auth[_0x60bd('0x6')](),controller[_0x60bd('0x24')]);router['delete']('/:id/dispositions',auth[_0x60bd('0x6')](),controller[_0x60bd('0x25')]);router[_0x60bd('0x23')](_0x60bd('0x26'),auth[_0x60bd('0x6')](),controller[_0x60bd('0x27')]);router[_0x60bd('0x23')](_0x60bd('0x11'),auth[_0x60bd('0x6')](),controller[_0x60bd('0x28')]);module[_0x60bd('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 6104b6e..018f3d7 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 _0x5853=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x540620,_0x2b6fe0){var _0x22b894=function(_0x18fd25){while(--_0x18fd25){_0x540620['push'](_0x540620['shift']());}};_0x22b894(++_0x2b6fe0);}(_0x5853,0x113));var _0x3585=function(_0x507056,_0xe16b72){_0x507056=_0x507056-0x0;var _0x4eaecc=_0x5853[_0x507056];return _0x4eaecc;};'use strict';var Sequelize=require(_0x3585('0x0'));module[_0x3585('0x1')]={'priority':{'type':Sequelize[_0x3585('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3585('0x3')],'allowNull':![],'defaultValue':_0x3585('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3585('0x3')]},'interval':{'type':Sequelize[_0x3585('0x3')],'defaultValue':_0x3585('0x5')}}; \ No newline at end of file +var _0xb2f2=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x501f36,_0x62dc5b){var _0x21b79b=function(_0x197dc9){while(--_0x197dc9){_0x501f36['push'](_0x501f36['shift']());}};_0x21b79b(++_0x62dc5b);}(_0xb2f2,0xc8));var _0x2b2f=function(_0x7ebd01,_0x5caaed){_0x7ebd01=_0x7ebd01-0x0;var _0x5982f6=_0xb2f2[_0x7ebd01];return _0x5982f6;};'use strict';var Sequelize=require(_0x2b2f('0x0'));module[_0x2b2f('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2b2f('0x2')],'allowNull':![],'defaultValue':_0x2b2f('0x3')},'appdata':{'type':Sequelize[_0x2b2f('0x4')]()},'description':{'type':Sequelize[_0x2b2f('0x2')]},'interval':{'type':Sequelize[_0x2b2f('0x2')],'defaultValue':_0x2b2f('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 5592404..2157f76 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 _0xb21f=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','set','reject','then','error','stack','send','map','FaxApplication','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','keys','rawAttributes','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x52715d,_0x28927d){var _0x344e39=function(_0x2d9fb5){while(--_0x2d9fb5){_0x52715d['push'](_0x52715d['shift']());}};_0x344e39(++_0x28927d);}(_0xb21f,0xf9));var _0xfb21=function(_0x24875d,_0x4fb24d){_0x24875d=_0x24875d-0x0;var _0x181471=_0xb21f[_0x24875d];return _0x181471;};'use strict';var pdf=require(_0xfb21('0x0'));var emlformat=require(_0xfb21('0x1'));var rimraf=require(_0xfb21('0x2'));var zipdir=require(_0xfb21('0x3'));var jsonpatch=require(_0xfb21('0x4'));var rp=require('request-promise');var moment=require(_0xfb21('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfb21('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfb21('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb21('0x8'));var squel=require(_0xfb21('0x9'));var crypto=require('crypto');var jsforce=require(_0xfb21('0xa'));var deskjs=require(_0xfb21('0xb'));var toCsv=require(_0xfb21('0xc'));var querystring=require(_0xfb21('0xd'));var Papa=require(_0xfb21('0xe'));var Redis=require(_0xfb21('0xf'));var authService=require(_0xfb21('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb21('0x11'));var logger=require(_0xfb21('0x12'))(_0xfb21('0x13'));var utils=require(_0xfb21('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfb21('0x15'));var db=require(_0xfb21('0x16'))['db'];function respondWithStatusCode(_0x43e594,_0x159908){_0x159908=_0x159908||0xcc;return function(_0x2fb1a8){if(_0x2fb1a8){return _0x43e594[_0xfb21('0x17')](_0x159908);}return _0x43e594['status'](_0x159908)[_0xfb21('0x18')]();};}function respondWithResult(_0x1c0ed9,_0x1605ef){_0x1605ef=_0x1605ef||0xc8;return function(_0x243a40){if(_0x243a40){return _0x1c0ed9[_0xfb21('0x19')](_0x1605ef)[_0xfb21('0x1a')](_0x243a40);}};}function respondWithFilteredResult(_0x132ab0,_0x3ced28){return function(_0x373190){if(_0x373190){var _0x478818=_0x373190[_0xfb21('0x1b')],_0x4f95c7=_0x3ced28['offset'],_0x88f34f=_0x3ced28['offset']+_0x3ced28['limit'],_0x3c67c7;if(_0x88f34f>=_0x478818){_0x88f34f=_0x478818;_0x3c67c7=0xc8;}else{_0x3c67c7=0xce;}_0x132ab0[_0xfb21('0x19')](_0x3c67c7);return _0x132ab0[_0xfb21('0x1c')]('Content-Range',_0x4f95c7+'-'+_0x88f34f+'/'+_0x478818)[_0xfb21('0x1a')](_0x373190);}return null;};}function patchUpdates(_0x58f16d){return function(_0x2de891){try{jsonpatch['apply'](_0x2de891,_0x58f16d,!![]);}catch(_0x52ae83){return BPromise[_0xfb21('0x1d')](_0x52ae83);}return _0x2de891['save']();};}function saveUpdates(_0x51d3d8,_0x5ef6c0){return function(_0x4d663b){if(_0x4d663b){return _0x4d663b['update'](_0x51d3d8)['then'](function(_0x54ff39){return _0x54ff39;});}return null;};}function removeEntity(_0x49aa08,_0x4e0f61){return function(_0x30d0bd){if(_0x30d0bd){return _0x30d0bd['destroy']()[_0xfb21('0x1e')](function(){_0x49aa08[_0xfb21('0x19')](0xcc)[_0xfb21('0x18')]();});}};}function handleEntityNotFound(_0x276825,_0x317abe){return function(_0x554786){if(!_0x554786){_0x276825[_0xfb21('0x17')](0x194);}return _0x554786;};}function handleError(_0x4fc63f,_0x106ae4){_0x106ae4=_0x106ae4||0x1f4;return function(_0x578eb6){logger[_0xfb21('0x1f')](_0x578eb6[_0xfb21('0x20')]);if(_0x578eb6['name']){delete _0x578eb6['name'];}_0x4fc63f[_0xfb21('0x19')](_0x106ae4)[_0xfb21('0x21')](_0x578eb6);};}exports['index']=function(_0x2e173c,_0x6afd2){var _0x3fd4c7={},_0x311c83={},_0x8073c7={'count':0x0,'rows':[]};var _0x558159=_[_0xfb21('0x22')](db[_0xfb21('0x23')]['rawAttributes'],function(_0x58617e){return{'name':_0x58617e[_0xfb21('0x24')],'type':_0x58617e[_0xfb21('0x25')][_0xfb21('0x26')]};});_0x311c83[_0xfb21('0x27')]=_[_0xfb21('0x22')](_0x558159,'name');_0x311c83['query']=_['keys'](_0x2e173c[_0xfb21('0x28')]);_0x311c83['filters']=_[_0xfb21('0x29')](_0x311c83[_0xfb21('0x27')],_0x311c83['query']);_0x3fd4c7[_0xfb21('0x2a')]=_[_0xfb21('0x29')](_0x311c83[_0xfb21('0x27')],qs['fields'](_0x2e173c['query'][_0xfb21('0x2b')]));_0x3fd4c7[_0xfb21('0x2a')]=_0x3fd4c7[_0xfb21('0x2a')][_0xfb21('0x2c')]?_0x3fd4c7[_0xfb21('0x2a')]:_0x311c83['model'];if(!_0x2e173c[_0xfb21('0x28')]['hasOwnProperty'](_0xfb21('0x2d'))){_0x3fd4c7[_0xfb21('0x2e')]=qs[_0xfb21('0x2e')](_0x2e173c[_0xfb21('0x28')][_0xfb21('0x2e')]);_0x3fd4c7['offset']=qs[_0xfb21('0x2f')](_0x2e173c['query'][_0xfb21('0x2f')]);}_0x3fd4c7[_0xfb21('0x30')]=qs[_0xfb21('0x31')](_0x2e173c[_0xfb21('0x28')][_0xfb21('0x31')]);_0x3fd4c7[_0xfb21('0x32')]=qs[_0xfb21('0x33')](_[_0xfb21('0x34')](_0x2e173c[_0xfb21('0x28')],_0x311c83[_0xfb21('0x33')]),_0x558159);if(_0x2e173c['query'][_0xfb21('0x35')]){_0x3fd4c7[_0xfb21('0x32')]=_[_0xfb21('0x36')](_0x3fd4c7[_0xfb21('0x32')],{'$or':_[_0xfb21('0x22')](_0x558159,function(_0x3e3358){if(_0x3e3358[_0xfb21('0x25')]!==_0xfb21('0x37')){var _0x515150={};_0x515150[_0x3e3358['name']]={'$like':'%'+_0x2e173c[_0xfb21('0x28')][_0xfb21('0x35')]+'%'};return _0x515150;}})});}_0x3fd4c7=_[_0xfb21('0x36')]({},_0x3fd4c7,_0x2e173c[_0xfb21('0x38')]);var _0x5a65f9={'where':_0x3fd4c7['where']};return db[_0xfb21('0x23')][_0xfb21('0x1b')](_0x5a65f9)[_0xfb21('0x1e')](function(_0x3bfca1){_0x8073c7[_0xfb21('0x1b')]=_0x3bfca1;if(_0x2e173c[_0xfb21('0x28')][_0xfb21('0x39')]){_0x3fd4c7[_0xfb21('0x3a')]=[{'all':!![]}];}return db[_0xfb21('0x23')]['findAll'](_0x3fd4c7);})['then'](function(_0x2db3d8){_0x8073c7['rows']=_0x2db3d8;return _0x8073c7;})['then'](respondWithFilteredResult(_0x6afd2,_0x3fd4c7))['catch'](handleError(_0x6afd2,null));};exports[_0xfb21('0x3b')]=function(_0x57b01c,_0x32a38f){var _0x291494={'raw':!![],'where':{'id':_0x57b01c[_0xfb21('0x3c')]['id']}},_0x3729b2={};_0x3729b2[_0xfb21('0x27')]=_[_0xfb21('0x3d')](db[_0xfb21('0x23')][_0xfb21('0x3e')]);_0x3729b2[_0xfb21('0x28')]=_['keys'](_0x57b01c[_0xfb21('0x28')]);_0x3729b2[_0xfb21('0x33')]=_[_0xfb21('0x29')](_0x3729b2[_0xfb21('0x27')],_0x3729b2[_0xfb21('0x28')]);_0x291494[_0xfb21('0x2a')]=_[_0xfb21('0x29')](_0x3729b2[_0xfb21('0x27')],qs[_0xfb21('0x2b')](_0x57b01c[_0xfb21('0x28')][_0xfb21('0x2b')]));_0x291494[_0xfb21('0x2a')]=_0x291494[_0xfb21('0x2a')][_0xfb21('0x2c')]?_0x291494[_0xfb21('0x2a')]:_0x3729b2[_0xfb21('0x27')];if(_0x57b01c[_0xfb21('0x28')]['includeAll']){_0x291494['include']=[{'all':!![]}];}_0x291494=_[_0xfb21('0x36')]({},_0x291494,_0x57b01c[_0xfb21('0x38')]);return db[_0xfb21('0x23')]['find'](_0x291494)['then'](handleEntityNotFound(_0x32a38f,null))[_0xfb21('0x1e')](respondWithResult(_0x32a38f,null))[_0xfb21('0x3f')](handleError(_0x32a38f,null));};exports[_0xfb21('0x40')]=function(_0x39ae3f,_0x173144){return db[_0xfb21('0x23')][_0xfb21('0x40')](_0x39ae3f[_0xfb21('0x41')],{})[_0xfb21('0x1e')](respondWithResult(_0x173144,0xc9))[_0xfb21('0x3f')](handleError(_0x173144,null));};exports['update']=function(_0x202f0b,_0x3b0ccd){if(_0x202f0b[_0xfb21('0x41')]['id']){delete _0x202f0b[_0xfb21('0x41')]['id'];}return db[_0xfb21('0x23')][_0xfb21('0x42')]({'where':{'id':_0x202f0b[_0xfb21('0x3c')]['id']}})[_0xfb21('0x1e')](handleEntityNotFound(_0x3b0ccd,null))['then'](saveUpdates(_0x202f0b['body'],null))['then'](respondWithResult(_0x3b0ccd,null))['catch'](handleError(_0x3b0ccd,null));};exports['destroy']=function(_0xfca196,_0x3f9942){return db[_0xfb21('0x23')]['find']({'where':{'id':_0xfca196[_0xfb21('0x3c')]['id']}})[_0xfb21('0x1e')](handleEntityNotFound(_0x3f9942,null))[_0xfb21('0x1e')](removeEntity(_0x3f9942,null))[_0xfb21('0x3f')](handleError(_0x3f9942,null));}; \ No newline at end of file +var _0x486c=['destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','stack','name','index','map','FaxApplication','rawAttributes','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','fields','include','find','create','body'];(function(_0x1dc8fd,_0x3d9770){var _0x1cfd32=function(_0x42f2fa){while(--_0x42f2fa){_0x1dc8fd['push'](_0x1dc8fd['shift']());}};_0x1cfd32(++_0x3d9770);}(_0x486c,0x97));var _0xc486=function(_0x2aaa17,_0x402daa){_0x2aaa17=_0x2aaa17-0x0;var _0x2b5678=_0x486c[_0x2aaa17];return _0x2b5678;};'use strict';var pdf=require(_0xc486('0x0'));var emlformat=require(_0xc486('0x1'));var rimraf=require(_0xc486('0x2'));var zipdir=require(_0xc486('0x3'));var jsonpatch=require(_0xc486('0x4'));var rp=require(_0xc486('0x5'));var moment=require(_0xc486('0x6'));var BPromise=require(_0xc486('0x7'));var Mustache=require(_0xc486('0x8'));var util=require(_0xc486('0x9'));var path=require('path');var sox=require(_0xc486('0xa'));var csv=require('to-csv');var ejs=require(_0xc486('0xb'));var fs=require('fs');var fs_extra=require(_0xc486('0xc'));var _=require('lodash');var squel=require(_0xc486('0xd'));var crypto=require('crypto');var jsforce=require(_0xc486('0xe'));var deskjs=require(_0xc486('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc486('0x10'));var Papa=require(_0xc486('0x11'));var Redis=require(_0xc486('0x12'));var authService=require(_0xc486('0x13'));var qs=require(_0xc486('0x14'));var as=require(_0xc486('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc486('0x16'))(_0xc486('0x17'));var utils=require(_0xc486('0x18'));var config=require(_0xc486('0x19'));var licenseUtil=require(_0xc486('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48b2c3,_0x309e05){_0x309e05=_0x309e05||0xcc;return function(_0x430751){if(_0x430751){return _0x48b2c3[_0xc486('0x1b')](_0x309e05);}return _0x48b2c3['status'](_0x309e05)[_0xc486('0x1c')]();};}function respondWithResult(_0x37e615,_0x22a665){_0x22a665=_0x22a665||0xc8;return function(_0x43e11d){if(_0x43e11d){return _0x37e615[_0xc486('0x1d')](_0x22a665)[_0xc486('0x1e')](_0x43e11d);}};}function respondWithFilteredResult(_0x108a5b,_0x39a298){return function(_0xa23350){if(_0xa23350){var _0x5c36d2=_0xa23350[_0xc486('0x1f')],_0x53e86e=_0x39a298[_0xc486('0x20')],_0x249edc=_0x39a298[_0xc486('0x20')]+_0x39a298[_0xc486('0x21')],_0x42c6e3;if(_0x249edc>=_0x5c36d2){_0x249edc=_0x5c36d2;_0x42c6e3=0xc8;}else{_0x42c6e3=0xce;}_0x108a5b[_0xc486('0x1d')](_0x42c6e3);return _0x108a5b[_0xc486('0x22')](_0xc486('0x23'),_0x53e86e+'-'+_0x249edc+'/'+_0x5c36d2)[_0xc486('0x1e')](_0xa23350);}return null;};}function patchUpdates(_0x400cf6){return function(_0x5c25f9){try{jsonpatch[_0xc486('0x24')](_0x5c25f9,_0x400cf6,!![]);}catch(_0xcdf07d){return BPromise[_0xc486('0x25')](_0xcdf07d);}return _0x5c25f9[_0xc486('0x26')]();};}function saveUpdates(_0x592882,_0x12be77){return function(_0x3e8189){if(_0x3e8189){return _0x3e8189['update'](_0x592882)[_0xc486('0x27')](function(_0x5ece75){return _0x5ece75;});}return null;};}function removeEntity(_0x4b935c,_0x30e190){return function(_0x1db959){if(_0x1db959){return _0x1db959['destroy']()[_0xc486('0x27')](function(){_0x4b935c[_0xc486('0x1d')](0xcc)[_0xc486('0x1c')]();});}};}function handleEntityNotFound(_0x25f3fd,_0x21e57c){return function(_0xb49524){if(!_0xb49524){_0x25f3fd[_0xc486('0x1b')](0x194);}return _0xb49524;};}function handleError(_0x389399,_0x588f90){_0x588f90=_0x588f90||0x1f4;return function(_0x5dacd8){logger['error'](_0x5dacd8[_0xc486('0x28')]);if(_0x5dacd8[_0xc486('0x29')]){delete _0x5dacd8[_0xc486('0x29')];}_0x389399['status'](_0x588f90)['send'](_0x5dacd8);};}exports[_0xc486('0x2a')]=function(_0x5c8622,_0x3c83e0){var _0x35fe6b={},_0x4801f2={},_0x3c5e89={'count':0x0,'rows':[]};var _0xfcbbd5=_[_0xc486('0x2b')](db[_0xc486('0x2c')][_0xc486('0x2d')],function(_0x3fbc92){return{'name':_0x3fbc92['fieldName'],'type':_0x3fbc92['type'][_0xc486('0x2e')]};});_0x4801f2[_0xc486('0x2f')]=_[_0xc486('0x2b')](_0xfcbbd5,_0xc486('0x29'));_0x4801f2[_0xc486('0x30')]=_[_0xc486('0x31')](_0x5c8622[_0xc486('0x30')]);_0x4801f2[_0xc486('0x32')]=_[_0xc486('0x33')](_0x4801f2[_0xc486('0x2f')],_0x4801f2[_0xc486('0x30')]);_0x35fe6b['attributes']=_[_0xc486('0x33')](_0x4801f2['model'],qs['fields'](_0x5c8622['query']['fields']));_0x35fe6b[_0xc486('0x34')]=_0x35fe6b[_0xc486('0x34')][_0xc486('0x35')]?_0x35fe6b[_0xc486('0x34')]:_0x4801f2[_0xc486('0x2f')];if(!_0x5c8622[_0xc486('0x30')][_0xc486('0x36')](_0xc486('0x37'))){_0x35fe6b[_0xc486('0x21')]=qs['limit'](_0x5c8622['query'][_0xc486('0x21')]);_0x35fe6b[_0xc486('0x20')]=qs[_0xc486('0x20')](_0x5c8622[_0xc486('0x30')][_0xc486('0x20')]);}_0x35fe6b[_0xc486('0x38')]=qs[_0xc486('0x39')](_0x5c8622[_0xc486('0x30')][_0xc486('0x39')]);_0x35fe6b[_0xc486('0x3a')]=qs[_0xc486('0x32')](_['pick'](_0x5c8622[_0xc486('0x30')],_0x4801f2['filters']),_0xfcbbd5);if(_0x5c8622['query'][_0xc486('0x3b')]){_0x35fe6b[_0xc486('0x3a')]=_[_0xc486('0x3c')](_0x35fe6b[_0xc486('0x3a')],{'$or':_['map'](_0xfcbbd5,function(_0x26553e){if(_0x26553e[_0xc486('0x3d')]!==_0xc486('0x3e')){var _0x5bd1ce={};_0x5bd1ce[_0x26553e[_0xc486('0x29')]]={'$like':'%'+_0x5c8622['query'][_0xc486('0x3b')]+'%'};return _0x5bd1ce;}})});}_0x35fe6b=_['merge']({},_0x35fe6b,_0x5c8622[_0xc486('0x3f')]);var _0x39e9fb={'where':_0x35fe6b[_0xc486('0x3a')]};return db[_0xc486('0x2c')]['count'](_0x39e9fb)[_0xc486('0x27')](function(_0x319c3d){_0x3c5e89[_0xc486('0x1f')]=_0x319c3d;if(_0x5c8622['query']['includeAll']){_0x35fe6b['include']=[{'all':!![]}];}return db['FaxApplication'][_0xc486('0x40')](_0x35fe6b);})[_0xc486('0x27')](function(_0x574592){_0x3c5e89[_0xc486('0x41')]=_0x574592;return _0x3c5e89;})[_0xc486('0x27')](respondWithFilteredResult(_0x3c83e0,_0x35fe6b))[_0xc486('0x42')](handleError(_0x3c83e0,null));};exports[_0xc486('0x43')]=function(_0x2b5210,_0x2c15be){var _0x40342a={'raw':!![],'where':{'id':_0x2b5210[_0xc486('0x44')]['id']}},_0x3a3c0d={};_0x3a3c0d[_0xc486('0x2f')]=_[_0xc486('0x31')](db[_0xc486('0x2c')][_0xc486('0x2d')]);_0x3a3c0d['query']=_[_0xc486('0x31')](_0x2b5210[_0xc486('0x30')]);_0x3a3c0d['filters']=_[_0xc486('0x33')](_0x3a3c0d[_0xc486('0x2f')],_0x3a3c0d[_0xc486('0x30')]);_0x40342a['attributes']=_[_0xc486('0x33')](_0x3a3c0d[_0xc486('0x2f')],qs[_0xc486('0x45')](_0x2b5210[_0xc486('0x30')][_0xc486('0x45')]));_0x40342a[_0xc486('0x34')]=_0x40342a[_0xc486('0x34')][_0xc486('0x35')]?_0x40342a[_0xc486('0x34')]:_0x3a3c0d[_0xc486('0x2f')];if(_0x2b5210['query']['includeAll']){_0x40342a[_0xc486('0x46')]=[{'all':!![]}];}_0x40342a=_[_0xc486('0x3c')]({},_0x40342a,_0x2b5210[_0xc486('0x3f')]);return db[_0xc486('0x2c')][_0xc486('0x47')](_0x40342a)[_0xc486('0x27')](handleEntityNotFound(_0x2c15be,null))[_0xc486('0x27')](respondWithResult(_0x2c15be,null))[_0xc486('0x42')](handleError(_0x2c15be,null));};exports['create']=function(_0x4891fc,_0x2df03c){return db[_0xc486('0x2c')][_0xc486('0x48')](_0x4891fc[_0xc486('0x49')],{})[_0xc486('0x27')](respondWithResult(_0x2df03c,0xc9))[_0xc486('0x42')](handleError(_0x2df03c,null));};exports['update']=function(_0x3f01ee,_0x333f59){if(_0x3f01ee['body']['id']){delete _0x3f01ee[_0xc486('0x49')]['id'];}return db[_0xc486('0x2c')][_0xc486('0x47')]({'where':{'id':_0x3f01ee[_0xc486('0x44')]['id']}})[_0xc486('0x27')](handleEntityNotFound(_0x333f59,null))[_0xc486('0x27')](saveUpdates(_0x3f01ee[_0xc486('0x49')],null))[_0xc486('0x27')](respondWithResult(_0x333f59,null))[_0xc486('0x42')](handleError(_0x333f59,null));};exports[_0xc486('0x4a')]=function(_0x45f25d,_0x75c2be){return db['FaxApplication'][_0xc486('0x47')]({'where':{'id':_0x45f25d[_0xc486('0x44')]['id']}})['then'](handleEntityNotFound(_0x75c2be,null))[_0xc486('0x27')](removeEntity(_0x75c2be,null))['catch'](handleError(_0x75c2be,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 9b535d4..09d7a70 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 _0xa2c3=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xb3fe4b,_0x1bde5c){var _0x42027f=function(_0x25edf5){while(--_0x25edf5){_0xb3fe4b['push'](_0xb3fe4b['shift']());}};_0x42027f(++_0x1bde5c);}(_0xa2c3,0xcf));var _0x3a2c=function(_0x1db72a,_0x22f6bc){_0x1db72a=_0x1db72a-0x0;var _0x1c7ee7=_0xa2c3[_0x1db72a];return _0x1c7ee7;};'use strict';var _=require(_0x3a2c('0x0'));var util=require(_0x3a2c('0x1'));var logger=require(_0x3a2c('0x2'))(_0x3a2c('0x3'));var moment=require(_0x3a2c('0x4'));var BPromise=require(_0x3a2c('0x5'));var rp=require(_0x3a2c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a2c('0x7'));var config=require(_0x3a2c('0x8'));var attributes=require('./faxApplication.attributes');module[_0x3a2c('0x9')]=function(_0x18aed2,_0x2764d3){return _0x18aed2[_0x3a2c('0xa')](_0x3a2c('0xb'),attributes,{'tableName':_0x3a2c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3a2c('0xd')});}; \ No newline at end of file +var _0xe15b=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0xe15b,0x188));var _0xbe15=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xe15b[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0xbe15('0x0'));var util=require(_0xbe15('0x1'));var logger=require(_0xbe15('0x2'))(_0xbe15('0x3'));var moment=require(_0xbe15('0x4'));var BPromise=require(_0xbe15('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe15('0x6'));var rimraf=require(_0xbe15('0x7'));var config=require(_0xbe15('0x8'));var attributes=require('./faxApplication.attributes');module[_0xbe15('0x9')]=function(_0x4c8810,_0x21fd29){return _0x4c8810[_0xbe15('0xa')](_0xbe15('0xb'),attributes,{'tableName':_0xbe15('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe15('0xd'),'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 7888ab8..cd16732 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 _0xca9f=['limit','debug','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','update','body','options','raw','where','attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xca9f,0x15e));var _0xfca9=function(_0x5cb139,_0x1a5f77){_0x5cb139=_0x5cb139-0x0;var _0x816e2b=_0xca9f[_0x5cb139];return _0x816e2b;};'use strict';var _=require(_0xfca9('0x0'));var util=require(_0xfca9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfca9('0x2'));var fs=require('fs');var Redis=require(_0xfca9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfca9('0x4'));var logger=require(_0xfca9('0x5'))('rpc');var config=require(_0xfca9('0x6'));var jayson=require(_0xfca9('0x7'));var client=jayson['client'][_0xfca9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d200d,_0x2ff57b,_0x524d0e){return new BPromise(function(_0x338caf,_0x255caf){return client[_0xfca9('0x9')](_0x5d200d,_0x524d0e)[_0xfca9('0xa')](function(_0x40b28d){logger[_0xfca9('0xb')](_0xfca9('0xc'),_0x2ff57b,_0xfca9('0xd'));logger['debug'](_0xfca9('0xe'),_0x2ff57b,_0xfca9('0xd'),JSON[_0xfca9('0xf')](_0x40b28d));if(_0x40b28d['error']){if(_0x40b28d[_0xfca9('0x10')]['code']===0x1f4){logger[_0xfca9('0x10')]('FaxApplication,\x20%s,\x20%s',_0x2ff57b,_0x40b28d[_0xfca9('0x10')][_0xfca9('0x11')]);return _0x255caf(_0x40b28d[_0xfca9('0x10')]['message']);}logger['error'](_0xfca9('0xc'),_0x2ff57b,_0x40b28d[_0xfca9('0x10')][_0xfca9('0x11')]);return _0x338caf(_0x40b28d[_0xfca9('0x10')][_0xfca9('0x11')]);}else{logger[_0xfca9('0xb')](_0xfca9('0xc'),_0x2ff57b,_0xfca9('0xd'));_0x338caf(_0x40b28d[_0xfca9('0x12')][_0xfca9('0x11')]);}})[_0xfca9('0x13')](function(_0x19145c){logger[_0xfca9('0x10')](_0xfca9('0xc'),_0x2ff57b,_0x19145c);_0x255caf(_0x19145c);});});}exports[_0xfca9('0x14')]=function(_0x13141b){var _0x571fd2=this;return new Promise(function(_0x4a9958,_0x5e0f10){return db['FaxApplication'][_0xfca9('0x15')](_0x13141b[_0xfca9('0x16')],{'raw':_0x13141b[_0xfca9('0x17')]?_0x13141b[_0xfca9('0x17')][_0xfca9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13141b[_0xfca9('0x17')]?_0x13141b[_0xfca9('0x17')][_0xfca9('0x19')]||null:null,'attributes':_0x13141b['options']?_0x13141b['options'][_0xfca9('0x1a')]||null:null,'limit':_0x13141b[_0xfca9('0x17')]?_0x13141b[_0xfca9('0x17')][_0xfca9('0x1b')]||null:null})[_0xfca9('0xa')](function(_0x1af107){logger[_0xfca9('0xb')]('UpdateFaxApplication',_0x13141b);logger[_0xfca9('0x1c')](_0xfca9('0x14'),_0x13141b,JSON['stringify'](_0x1af107));_0x4a9958(_0x1af107);})[_0xfca9('0x13')](function(_0x4814f0){logger[_0xfca9('0x10')](_0xfca9('0x14'),_0x4814f0['message'],_0x13141b);_0x5e0f10(_0x571fd2[_0xfca9('0x10')](0x1f4,_0x4814f0['message']));});});}; \ No newline at end of file +var _0xc22b=['jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3ee42f,_0x1da1ef){var _0x3d3c5e=function(_0x50ca9e){while(--_0x50ca9e){_0x3ee42f['push'](_0x3ee42f['shift']());}};_0x3d3c5e(++_0x1da1ef);}(_0xc22b,0x177));var _0xbc22=function(_0x5dd652,_0x281708){_0x5dd652=_0x5dd652-0x0;var _0x504f6a=_0xc22b[_0x5dd652];return _0x504f6a;};'use strict';var _=require(_0xbc22('0x0'));var util=require('util');var moment=require(_0xbc22('0x1'));var BPromise=require(_0xbc22('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc22('0x3'));var db=require(_0xbc22('0x4'))['db'];var utils=require(_0xbc22('0x5'));var logger=require(_0xbc22('0x6'))(_0xbc22('0x7'));var config=require(_0xbc22('0x8'));var jayson=require(_0xbc22('0x9'));var client=jayson[_0xbc22('0xa')][_0xbc22('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36e382,_0x52de74,_0x134748){return new BPromise(function(_0x580ef3,_0x584d7b){return client[_0xbc22('0xc')](_0x36e382,_0x134748)[_0xbc22('0xd')](function(_0x14ae84){logger[_0xbc22('0xe')]('FaxApplication,\x20%s,\x20%s',_0x52de74,_0xbc22('0xf'));logger[_0xbc22('0x10')](_0xbc22('0x11'),_0x52de74,_0xbc22('0xf'),JSON['stringify'](_0x14ae84));if(_0x14ae84[_0xbc22('0x12')]){if(_0x14ae84[_0xbc22('0x12')][_0xbc22('0x13')]===0x1f4){logger[_0xbc22('0x12')](_0xbc22('0x14'),_0x52de74,_0x14ae84['error'][_0xbc22('0x15')]);return _0x584d7b(_0x14ae84['error'][_0xbc22('0x15')]);}logger[_0xbc22('0x12')](_0xbc22('0x14'),_0x52de74,_0x14ae84['error'][_0xbc22('0x15')]);return _0x580ef3(_0x14ae84[_0xbc22('0x12')]['message']);}else{logger[_0xbc22('0xe')](_0xbc22('0x14'),_0x52de74,_0xbc22('0xf'));_0x580ef3(_0x14ae84[_0xbc22('0x16')][_0xbc22('0x15')]);}})[_0xbc22('0x17')](function(_0x345a12){logger[_0xbc22('0x12')]('FaxApplication,\x20%s,\x20%s',_0x52de74,_0x345a12);_0x584d7b(_0x345a12);});});}exports[_0xbc22('0x18')]=function(_0xc5e82){var _0xa4fbf1=this;return new Promise(function(_0x5b0d86,_0x57a368){return db[_0xbc22('0x19')][_0xbc22('0x1a')](_0xc5e82[_0xbc22('0x1b')],{'raw':_0xc5e82[_0xbc22('0x1c')]?_0xc5e82[_0xbc22('0x1c')][_0xbc22('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc5e82[_0xbc22('0x1c')]?_0xc5e82[_0xbc22('0x1c')][_0xbc22('0x1e')]||null:null,'attributes':_0xc5e82['options']?_0xc5e82[_0xbc22('0x1c')]['attributes']||null:null,'limit':_0xc5e82[_0xbc22('0x1c')]?_0xc5e82['options'][_0xbc22('0x1f')]||null:null})[_0xbc22('0xd')](function(_0x410c8a){logger[_0xbc22('0xe')](_0xbc22('0x18'),_0xc5e82);logger[_0xbc22('0x10')](_0xbc22('0x18'),_0xc5e82,JSON['stringify'](_0x410c8a));_0x5b0d86(_0x410c8a);})[_0xbc22('0x17')](function(_0x505506){logger[_0xbc22('0x12')]('UpdateFaxApplication',_0x505506[_0xbc22('0x15')],_0xc5e82);_0x57a368(_0xa4fbf1['error'](0x1f4,_0x505506['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index bda0c6b..3895a88 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 _0x931c=['fs-extra','../../components/auth/service','./faxApplication.controller','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','path','connect-timeout','Router'];(function(_0x52bbc9,_0xb342e0){var _0x5909d0=function(_0x24370d){while(--_0x24370d){_0x52bbc9['push'](_0x52bbc9['shift']());}};_0x5909d0(++_0xb342e0);}(_0x931c,0x1bc));var _0xc931=function(_0x1cb246,_0x5b3a30){_0x1cb246=_0x1cb246-0x0;var _0x492130=_0x931c[_0x1cb246];return _0x492130;};'use strict';var multer=require(_0xc931('0x0'));var util=require('util');var path=require(_0xc931('0x1'));var timeout=require(_0xc931('0x2'));var express=require('express');var router=express[_0xc931('0x3')]();var fs_extra=require(_0xc931('0x4'));var auth=require(_0xc931('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc931('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc931('0x7')]);router['get'](_0xc931('0x8'),auth[_0xc931('0x9')](),controller['show']);router[_0xc931('0xa')]('/',auth[_0xc931('0x9')](),controller[_0xc931('0xb')]);router[_0xc931('0xc')](_0xc931('0x8'),auth[_0xc931('0x9')](),controller[_0xc931('0xd')]);router[_0xc931('0xe')](_0xc931('0x8'),auth[_0xc931('0x9')](),controller[_0xc931('0xf')]);module['exports']=router; \ No newline at end of file +var _0x73bb=['isAuthenticated','put','/:id','update','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index'];(function(_0x29b756,_0xfeb77a){var _0x2b464a=function(_0x3af0e3){while(--_0x3af0e3){_0x29b756['push'](_0x29b756['shift']());}};_0x2b464a(++_0xfeb77a);}(_0x73bb,0xb5));var _0xb73b=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x73bb[_0x466af7];return _0x348c96;};'use strict';var multer=require(_0xb73b('0x0'));var util=require(_0xb73b('0x1'));var path=require(_0xb73b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb73b('0x3'));var router=express['Router']();var fs_extra=require(_0xb73b('0x4'));var auth=require(_0xb73b('0x5'));var interaction=require(_0xb73b('0x6'));var config=require(_0xb73b('0x7'));var controller=require(_0xb73b('0x8'));router[_0xb73b('0x9')]('/',auth['isAuthenticated'](),controller[_0xb73b('0xa')]);router[_0xb73b('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb73b('0xb')](),controller['create']);router[_0xb73b('0xc')](_0xb73b('0xd'),auth['isAuthenticated'](),controller[_0xb73b('0xe')]);router[_0xb73b('0xf')]('/:id',auth[_0xb73b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 1fd0e2d..4bccde1 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 _0xf69d=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x3bd86e,_0x49e4e0){var _0x1ef3c3=function(_0x4becf3){while(--_0x4becf3){_0x3bd86e['push'](_0x3bd86e['shift']());}};_0x1ef3c3(++_0x49e4e0);}(_0xf69d,0xd3));var _0xdf69=function(_0x25d921,_0x5398d2){_0x25d921=_0x25d921-0x0;var _0x106736=_0xf69d[_0x25d921];return _0x106736;};'use strict';var Sequelize=require(_0xdf69('0x0'));module[_0xdf69('0x1')]={'closed':{'type':Sequelize[_0xdf69('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdf69('0x3')]},'disposition':{'type':Sequelize[_0xdf69('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xdf69('0x4')]},'note':{'type':Sequelize[_0xdf69('0x4')]},'read1stAt':{'type':Sequelize[_0xdf69('0x3')]},'fax':{'type':Sequelize[_0xdf69('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xdf69('0x5')]('in',_0xdf69('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdf69('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xdf69('0x5')]('in',_0xdf69('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xc0a4=['STRING','out','ENUM','exports','BOOLEAN','DATE'];(function(_0x4c251e,_0x3d0c69){var _0xa9379b=function(_0x2ac9f4){while(--_0x2ac9f4){_0x4c251e['push'](_0x4c251e['shift']());}};_0xa9379b(++_0x3d0c69);}(_0xc0a4,0x147));var _0x4c0a=function(_0x55e018,_0x20d977){_0x55e018=_0x55e018-0x0;var _0xb4d449=_0xc0a4[_0x55e018];return _0xb4d449;};'use strict';var Sequelize=require('sequelize');module[_0x4c0a('0x0')]={'closed':{'type':Sequelize[_0x4c0a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4c0a('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4c0a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4c0a('0x3')]},'note':{'type':Sequelize[_0x4c0a('0x3')]},'read1stAt':{'type':Sequelize[_0x4c0a('0x2')]},'fax':{'type':Sequelize[_0x4c0a('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4c0a('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4c0a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4c0a('0x5')]('in',_0x4c0a('0x4')),'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 a89b010..e7c0073 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 _0x8185=['send','fullname','TagIds','Tags','split','forEach','push','catch','map','FaxInteraction','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','select','tools_tags','u.id','field','ui.FaxInteractionId','from','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','unreadMessages','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.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','rows','options','create','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','addTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createReadStream','log','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','./faxInteraction.socket','register','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','stack','name'];(function(_0x1867d9,_0x5605a9){var _0x18fcd3=function(_0x4e8cba){while(--_0x4e8cba){_0x1867d9['push'](_0x1867d9['shift']());}};_0x18fcd3(++_0x5605a9);}(_0x8185,0x188));var _0x5818=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x8185[_0x4b055c];return _0x4b62bb;};'use strict';var pdf=require(_0x5818('0x0'));var emlformat=require(_0x5818('0x1'));var rimraf=require(_0x5818('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5818('0x3'));var rp=require(_0x5818('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5818('0x5'));var util=require(_0x5818('0x6'));var path=require('path');var sox=require(_0x5818('0x7'));var csv=require(_0x5818('0x8'));var ejs=require(_0x5818('0x9'));var fs=require('fs');var fs_extra=require(_0x5818('0xa'));var _=require(_0x5818('0xb'));var squel=require(_0x5818('0xc'));var crypto=require(_0x5818('0xd'));var jsforce=require(_0x5818('0xe'));var deskjs=require(_0x5818('0xf'));var toCsv=require(_0x5818('0x8'));var querystring=require(_0x5818('0x10'));var Papa=require(_0x5818('0x11'));var Redis=require(_0x5818('0x12'));var authService=require(_0x5818('0x13'));var qs=require(_0x5818('0x14'));var as=require(_0x5818('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5818('0x16'))(_0x5818('0x17'));var utils=require('../../config/utils');var config=require(_0x5818('0x18'));var licenseUtil=require(_0x5818('0x19'));var db=require('../../mysqldb')['db'];config[_0x5818('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5818('0x1b'))(new Redis(config['redis']));require(_0x5818('0x1c'))[_0x5818('0x1d')](socket);function respondWithStatusCode(_0x3562a0,_0x3f5b25){_0x3f5b25=_0x3f5b25||0xcc;return function(_0x47f349){if(_0x47f349){return _0x3562a0['sendStatus'](_0x3f5b25);}return _0x3562a0['status'](_0x3f5b25)['end']();};}function respondWithResult(_0x382135,_0x30f623){_0x30f623=_0x30f623||0xc8;return function(_0x2b4f83){if(_0x2b4f83){return _0x382135[_0x5818('0x1e')](_0x30f623)[_0x5818('0x1f')](_0x2b4f83);}};}function respondWithFilteredResult(_0x30c7cf,_0x2e013b){return function(_0x484a45){if(_0x484a45){var _0x125ac5=_0x484a45[_0x5818('0x20')],_0xdfd964=_0x2e013b[_0x5818('0x21')],_0x4b48da=_0x2e013b[_0x5818('0x21')]+_0x2e013b['limit'],_0x1c40bc;if(_0x4b48da>=_0x125ac5){_0x4b48da=_0x125ac5;_0x1c40bc=0xc8;}else{_0x1c40bc=0xce;}_0x30c7cf[_0x5818('0x1e')](_0x1c40bc);return _0x30c7cf[_0x5818('0x22')](_0x5818('0x23'),_0xdfd964+'-'+_0x4b48da+'/'+_0x125ac5)['json'](_0x484a45);}return null;};}function patchUpdates(_0x48a48d){return function(_0x5d31cf){try{jsonpatch[_0x5818('0x24')](_0x5d31cf,_0x48a48d,!![]);}catch(_0x335800){return BPromise[_0x5818('0x25')](_0x335800);}return _0x5d31cf[_0x5818('0x26')]();};}function saveUpdates(_0x3d39df,_0x3107f9){return function(_0x357400){if(_0x357400){return _0x357400[_0x5818('0x27')](_0x3d39df)['then'](function(_0x491b79){return _0x491b79;});}return null;};}function removeEntity(_0x2c6199,_0x258b50){return function(_0x58c937){if(_0x58c937){return _0x58c937[_0x5818('0x28')]()[_0x5818('0x29')](function(){_0x2c6199[_0x5818('0x1e')](0xcc)[_0x5818('0x2a')]();});}};}function handleEntityNotFound(_0x54c395,_0x19a91d){return function(_0x2b39e2){if(!_0x2b39e2){_0x54c395[_0x5818('0x2b')](0x194);}return _0x2b39e2;};}function handleError(_0x4e876b,_0x1c57e9){_0x1c57e9=_0x1c57e9||0x1f4;return function(_0x12b1bc){logger['error'](_0x12b1bc[_0x5818('0x2c')]);if(_0x12b1bc['name']){delete _0x12b1bc[_0x5818('0x2d')];}_0x4e876b[_0x5818('0x1e')](_0x1c57e9)[_0x5818('0x2e')](_0x12b1bc);};}function getInteractionUsers(_0x58746f,_0x2dcbd6){return new BPromise(function(_0x5e2e59,_0x37131d){try{if(_0x2dcbd6[_0x58746f['id']]){_0x58746f['Users']=_['map'](_0x2dcbd6[_0x58746f['id']],function(_0x424593){return{'id':_0x424593['id'],'fullname':_0x424593[_0x5818('0x2f')]};});}}catch(_0x3ef78c){_0x37131d(_0x3ef78c);}_0x5e2e59(_0x58746f);});}function getInteractionTags(_0x422bfe,_0x2cc28b){return new BPromise(function(_0x31cacd,_0x801dd0){try{if(_0x422bfe[_0x5818('0x30')]){_0x422bfe[_0x5818('0x31')]=[];_0x422bfe[_0x5818('0x30')][_0x5818('0x32')](',')[_0x5818('0x33')](function(_0x2d2d02){_0x422bfe[_0x5818('0x31')][_0x5818('0x34')](_0x2cc28b[_0x2d2d02]);});}delete _0x422bfe[_0x5818('0x30')];}catch(_0x34ecd3){_0x801dd0(_0x34ecd3);}_0x31cacd(_0x422bfe);});}function updateFaxInteraction(_0x5780a4,_0x3ec8ad,_0x21b143){return new BPromise(function(_0x275818,_0xc58643){return getInteractionUsers(_0x5780a4,_0x21b143)[_0x5818('0x29')](function(_0x583809){return getInteractionTags(_0x583809,_0x3ec8ad);})[_0x5818('0x29')](function(_0x25552f){_0x275818(_0x25552f);})[_0x5818('0x35')](function(_0xe2e2b4){_0xc58643(_0xe2e2b4);});});}exports['index']=function(_0x3faca0,_0x436c34){var _0x9eaf20={},_0x57b66d={},_0x581087={'count':0x0,'rows':[]};var _0x54f522=_[_0x5818('0x36')](db[_0x5818('0x37')][_0x5818('0x38')],function(_0x302dae){return{'name':_0x302dae['fieldName'],'type':_0x302dae['type'][_0x5818('0x39')]};});_0x57b66d[_0x5818('0x3a')]=_[_0x5818('0x36')](_0x54f522,_0x5818('0x2d'));_0x57b66d[_0x5818('0x3b')]=_[_0x5818('0x3c')](_0x3faca0[_0x5818('0x3b')]);_0x57b66d[_0x5818('0x3d')]=_[_0x5818('0x3e')](_0x57b66d['model'],_0x57b66d[_0x5818('0x3b')]);_0x9eaf20[_0x5818('0x3f')]=_['intersection'](_0x57b66d[_0x5818('0x3a')],qs['fields'](_0x3faca0[_0x5818('0x3b')][_0x5818('0x40')]));_0x9eaf20['attributes']=_0x9eaf20[_0x5818('0x3f')][_0x5818('0x41')]?_0x9eaf20[_0x5818('0x3f')]:_0x57b66d[_0x5818('0x3a')];if(!_0x3faca0[_0x5818('0x3b')][_0x5818('0x42')](_0x5818('0x43'))){_0x9eaf20[_0x5818('0x44')]=qs[_0x5818('0x44')](_0x3faca0[_0x5818('0x3b')][_0x5818('0x44')]);_0x9eaf20[_0x5818('0x21')]=qs[_0x5818('0x21')](_0x3faca0[_0x5818('0x3b')]['offset']);}_0x9eaf20['order']=qs['sort'](_0x3faca0[_0x5818('0x3b')][_0x5818('0x45')]);_0x9eaf20[_0x5818('0x46')]=qs[_0x5818('0x3d')](_[_0x5818('0x47')](_0x3faca0[_0x5818('0x3b')],_0x57b66d['filters']),_0x54f522);var _0x3064fe=[];var _0x59dd75=squel[_0x5818('0x48')]()['field']('id')['field'](_0x5818('0x2d'))['field']('color')['from'](_0x5818('0x49'));var _0x1d2274=squel['select']()['field'](_0x5818('0x4a'))['field']('u.fullname')[_0x5818('0x4b')](_0x5818('0x4c'))[_0x5818('0x4d')](_0x5818('0x4e'),'ui')['left_join'](_0x5818('0x4f'),'u',_0x5818('0x50'));var _0x2db8c5=squel['select']()[_0x5818('0x4d')](_0x5818('0x51'),'i')[_0x5818('0x52')]('cm_contacts','c',_0x5818('0x53'))['left_join'](_0x5818('0x4f'),'o',_0x5818('0x54'))['left_join'](_0x5818('0x55'),'a',_0x5818('0x56'))[_0x5818('0x52')](_0x5818('0x57'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x5818('0x52')]('fax_interaction_has_tags','it',_0x5818('0x58'))[_0x5818('0x52')](_0x5818('0x49'),'t',_0x5818('0x59'));var _0x1cc029=squel[_0x5818('0x5a')]();var _0x4c6921=[];var _0x70a4d7=squel['expr']();var _0x3e6565;if(_0x3faca0['query']['search']){_0x3e6565=as[_0x5818('0x5b')](_0x3faca0[_0x5818('0x3b')][_0x5818('0x5c')]);var _0x16b1a4=_0x3e6565[_0x5818('0x5d')];for(var _0x1292de=0x0;_0x1292de<_0x3e6565[_0x5818('0x5e')]['length'];_0x1292de++){var _0x70723d=_0x3e6565[_0x5818('0x5e')][_0x1292de];var _0x5c39ce='i';var _0x5a7769=_[_0x5818('0x5f')](_0x54f522,[_0x5818('0x2d'),_0x70723d['field']]);if(!_0x5a7769){switch(_0x70723d[_0x5818('0x4b')]){case'unreadMessages':if(_0x70723d['value']==0x1){_0x2db8c5['having']('`'+_0x70723d[_0x5818('0x4b')]+_0x5818('0x60'));}else{_0x2db8c5[_0x5818('0x61')]('`'+_0x70723d['field']+_0x5818('0x62'));}break;case _0x5818('0x63'):if(_0x70723d[_0x5818('0x64')]===_0x5818('0x65')){if(_0x70723d[_0x5818('0x66')][_0x5818('0x32')]('\x20')[_0x5818('0x41')]>0x1){_0x1cc029[_0x16b1a4](_0x5818('0x67'),qs[_0x5818('0x68')](_0x70723d[_0x5818('0x66')]),null);}else{var _0xc6c7b2='%'+_0x70723d['value']+'%';_0x1cc029[_0x16b1a4](_0x5818('0x69'),_0xc6c7b2,_0xc6c7b2,_0xc6c7b2);}}else{_0x5a7769=_[_0x5818('0x5f')](_0x54f522,[_0x5818('0x2d'),_0x5818('0x6a')]);_0x70723d[_0x5818('0x4b')]=_0x5818('0x6a');_0x42244f=as[_0x5818('0x6b')](_0x5c39ce,_0x5a7769[_0x5818('0x6c')],_0x70723d);_0x1cc029[_0x16b1a4](_0x42244f['text'],_0x42244f[_0x5818('0x66')][_0x5818('0x6d')],_0x42244f['value']['end']);}break;case _0x5818('0x6e'):var _0x512fe9=_0x70723d['value'][_0x5818('0x32')](',')[_0x5818('0x36')](function(_0x2c5544){return Number(_0x2c5544);});_0x512fe9[_0x5818('0x33')](function(_0x571012){_0x70a4d7['or'](_0x5818('0x6f'),'%,'+_0x571012+',%');});_0x4c6921=_[_0x5818('0x70')](_0x4c6921,_0x512fe9);break;case _0x5818('0x71'):if(_0x70723d[_0x5818('0x64')]===_0x5818('0x65')){_0x1cc029[_0x16b1a4](_0x5818('0x72'),'%'+_0x70723d['value']+'%',null);}else{_0x5a7769=_[_0x5818('0x5f')](_0x54f522,['name','UserId']);_0x70723d[_0x5818('0x4b')]=_0x5818('0x73');_0x42244f=as[_0x5818('0x6b')](_0x5c39ce,_0x5a7769['type'],_0x70723d);_0x1cc029[_0x16b1a4](_0x42244f[_0x5818('0x74')],_0x42244f[_0x5818('0x66')]['start'],_0x42244f[_0x5818('0x66')][_0x5818('0x2a')]);}break;case _0x5818('0x75'):_0x42244f=as[_0x5818('0x6b')]('me',null,_0x70723d);_0x1cc029[_0x16b1a4](_0x42244f[_0x5818('0x74')],_0x42244f['value'][_0x5818('0x6d')],_0x42244f[_0x5818('0x66')][_0x5818('0x2a')]);break;}}else{var _0x42244f=as[_0x5818('0x6b')](_0x5c39ce,_0x5a7769[_0x5818('0x6c')],_0x70723d);_0x1cc029[_0x16b1a4](_0x42244f[_0x5818('0x74')],_0x42244f[_0x5818('0x66')][_0x5818('0x6d')],_0x42244f[_0x5818('0x66')][_0x5818('0x2a')]);}}}else{var _0x5101ba=_(_0x3faca0[_0x5818('0x3b')])[_0x5818('0x3c')]()['map'](function(_0x4c9322){return _['some'](_0x54f522,[_0x5818('0x2d'),_0x4c9322])?_0x4c9322:undefined;})['compact']()[_0x5818('0x66')]();if(!_[_0x5818('0x76')](_0x5101ba)){_0x5101ba[_0x5818('0x33')](function(_0x400a36){if(_0x400a36===_0x5818('0x77')){_0x2db8c5[_0x5818('0x46')](_0x5818('0x78'),[][_0x5818('0x79')](_0x3faca0[_0x5818('0x3b')][_0x400a36]));}else if(_0x400a36===_0x5818('0x7a')){var _0x35e1cb=JSON['parse'](_0x3faca0[_0x5818('0x3b')][_0x400a36])[_0x5818('0x7b')];var _0x412daa=JSON[_0x5818('0x7c')](_0x3faca0[_0x5818('0x3b')][_0x400a36])[_0x5818('0x7d')];_0x2db8c5[_0x5818('0x46')](_0x5818('0x7e'),_0x35e1cb,_0x412daa);}else{if(_0x3faca0[_0x5818('0x3b')][_0x400a36]===_0x5818('0x7f')){_0x2db8c5['where']('i.'+_0x400a36+'\x20IS\x20NULL');}else{_0x2db8c5[_0x5818('0x46')]('i.'+_0x400a36+_0x5818('0x80'),_0x3faca0[_0x5818('0x3b')][_0x400a36]);}}});}if(_0x3faca0[_0x5818('0x3b')][_0x5818('0x81')]){if(_0x3faca0[_0x5818('0x3b')]['read']==0x1){_0x2db8c5[_0x5818('0x61')](_0x5818('0x82'));}else{_0x2db8c5['having'](_0x5818('0x83'));}}if(_0x3faca0[_0x5818('0x3b')][_0x5818('0x84')]){_0x4c6921=_[_0x5818('0x85')](_0x3faca0[_0x5818('0x3b')][_0x5818('0x84')])?_0x3faca0[_0x5818('0x3b')][_0x5818('0x84')]:new Array(_0x3faca0[_0x5818('0x3b')]['tag']);_0x4c6921[_0x5818('0x33')](function(_0x51c830){_0x70a4d7['or'](_0x5818('0x6f'),'%,'+_0x51c830+',%');});}if(_0x3faca0[_0x5818('0x3b')]['filter']){var _0x4475e2=_0x3faca0[_0x5818('0x3b')][_0x5818('0x86')][_0x5818('0x87')]('\x5c','\x5c\x5c')[_0x5818('0x87')](/'/g,'\x27\x27');if(qs[_0x5818('0x88')](_0x4475e2)){_0x1cc029['or'](_0x5818('0x89'),_0x4475e2+'%')['or'](_0x5818('0x8a'),_0x4475e2+'%');}_0x1cc029['or'](_0x5818('0x8b'),_0x4475e2+'%');}}_0x2db8c5[_0x5818('0x46')](_0x1cc029);_0x2db8c5[_0x5818('0x8c')](_0x5818('0x8d'));var _0x21e28d={'type':db['Sequelize'][_0x5818('0x8e')][_0x5818('0x8f')],'raw':!![]};var _0x4a3b3b=_0x2db8c5[_0x5818('0x90')]();_0x4a3b3b[_0x5818('0x4b')](_0x5818('0x8d'));_0x4a3b3b[_0x5818('0x4b')](_0x5818('0x91'),'unreadMessages');if(_0x9eaf20['order']){_0x9eaf20['order'][_0x5818('0x33')](function(_0x550704){var _0x1beb88=_0x550704[0x0]==='contactName'?_0x550704[0x0]:'i.'+_0x550704[0x0];_0x2db8c5[_0x5818('0x92')](_0x1beb88,_0x550704[0x1]===_0x5818('0x93')?![]:!![]);});}if(!_[_0x5818('0x76')](_0x4c6921)){_0x2db8c5[_0x5818('0x61')](_0x70a4d7);_0x4a3b3b[_0x5818('0x46')](_0x5818('0x94'),_0x4c6921);}BPromise[_0x5818('0x95')]()[_0x5818('0x29')](function(){if(!_0x3e6565){if(_0x3faca0[_0x5818('0x3b')][_0x5818('0x77')])return;_0x4a3b3b[_0x5818('0x46')](_0x5818('0x96'));_0x2db8c5[_0x5818('0x46')](_0x5818('0x96'));return;}if(_0x3faca0['user'][_0x5818('0x97')]!==_0x5818('0x98'))return;return _0x3faca0['user'][_0x5818('0x99')]({'attributes':['id'],'raw':!![]})['then'](function(_0xb3c549){if(_[_0x5818('0x76')](_0xb3c549)){_0x4a3b3b[_0x5818('0x46')](_0x5818('0x9a'));_0x2db8c5[_0x5818('0x46')](_0x5818('0x9a'));}else{_0x4a3b3b[_0x5818('0x46')](_0x5818('0x78'),_[_0x5818('0x36')](_0xb3c549,'id'));_0x2db8c5[_0x5818('0x46')]('i.FaxAccountId\x20IN\x20?',_[_0x5818('0x36')](_0xb3c549,'id'));}});})['then'](function(){if(_0x3faca0['user'][_0x5818('0x97')]===_0x5818('0x98')&&!_0x3e6565&&!_0x3faca0[_0x5818('0x3b')][_0x5818('0x77')])return[];return db[_0x5818('0x9b')]['query'](_0x4a3b3b[_0x5818('0x9c')](),_0x21e28d);})[_0x5818('0x29')](function(_0x4fdfd7){_0x581087[_0x5818('0x20')]=_0x4fdfd7[_0x5818('0x41')];if(_0x581087[_0x5818('0x20')]===0x0)return[];return db[_0x5818('0x9b')]['query'](_0x59dd75[_0x5818('0x9c')](),_0x21e28d)[_0x5818('0x29')](function(_0x25e8ea){_0x3064fe=_[_0x5818('0x9d')](_0x25e8ea,'id');_0x21e28d=_[_0x5818('0x9e')](_0x21e28d,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3faca0[_0x5818('0x3b')]['fields']){_0x9eaf20[_0x5818('0x3f')][_0x5818('0x33')](function(_0x2cab79){_0x2db8c5[_0x5818('0x4b')]('i.'+_0x2cab79);});}else{_0x2db8c5['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5818('0x9f'));_0x2db8c5['field']('a.key',_0x5818('0xa0'));_0x2db8c5[_0x5818('0x4b')]('a.mandatoryDisposition',_0x5818('0xa1'));_0x2db8c5[_0x5818('0x4b')](_0x5818('0xa2'),_0x5818('0xa3'));_0x2db8c5[_0x5818('0x4b')](_0x5818('0xa4'));_0x2db8c5[_0x5818('0x4b')](_0x5818('0xa5'),_0x5818('0xa6'));_0x2db8c5[_0x5818('0x4b')](_0x5818('0xa7'),_0x5818('0xa8'));_0x2db8c5['field'](_0x5818('0xa9'),_0x5818('0xaa'));_0x2db8c5[_0x5818('0x4b')]('c.phone','Contact.phone');_0x2db8c5['field'](_0x5818('0xab'),_0x5818('0xac'));_0x2db8c5[_0x5818('0x4b')](_0x5818('0xad'),'Contact.fax');_0x2db8c5[_0x5818('0x4b')](_0x5818('0xae'),'Owner.fullname');_0x2db8c5['field'](_0x5818('0xaf'),_0x5818('0xb0'));_0x2db8c5[_0x5818('0x4b')](_0x5818('0xb1'),_0x5818('0x30'));}if(_0x9eaf20[_0x5818('0x44')])_0x2db8c5[_0x5818('0x44')](_0x9eaf20['limit']);if(_0x9eaf20['offset'])_0x2db8c5[_0x5818('0x21')](_0x9eaf20[_0x5818('0x21')]);return db[_0x5818('0x9b')][_0x5818('0x3b')](_0x2db8c5['toString'](),_0x21e28d);})[_0x5818('0x29')](function(_0x4e5db6){_0x1d2274[_0x5818('0x46')](_0x5818('0xb2'),_[_0x5818('0x36')](_0x4e5db6,'id'));return db[_0x5818('0x9b')]['query'](_0x1d2274['toString'](),_0x21e28d)[_0x5818('0x29')](function(_0x4c4739){var _0x4ce393=_['groupBy'](_0x4c4739,_0x5818('0xb3'));var _0x1ba922=[];_0x4e5db6[_0x5818('0x33')](function(_0x4dd315){_0x1ba922[_0x5818('0x34')](updateFaxInteraction(_0x4dd315,_0x3064fe,_0x4ce393));});return BPromise['all'](_0x1ba922);});});})['then'](function(_0x449233){_0x581087[_0x5818('0xb4')]=_0x449233;return _0x581087;})['then'](respondWithFilteredResult(_0x436c34,_0x9eaf20))[_0x5818('0x35')](handleError(_0x436c34,null));};exports['show']=function(_0x188be4,_0x45fcb1){var _0x289a45={'raw':![],'where':{'id':_0x188be4['params']['id']}},_0x1ed23a={};_0x1ed23a['model']=_[_0x5818('0x3c')](db[_0x5818('0x37')][_0x5818('0x38')]);_0x1ed23a['query']=_[_0x5818('0x3c')](_0x188be4[_0x5818('0x3b')]);_0x1ed23a['filters']=_[_0x5818('0x3e')](_0x1ed23a[_0x5818('0x3a')],_0x1ed23a[_0x5818('0x3b')]);_0x289a45[_0x5818('0x3f')]=_['intersection'](_0x1ed23a[_0x5818('0x3a')],qs[_0x5818('0x40')](_0x188be4['query'][_0x5818('0x40')]));_0x289a45['attributes']=_0x289a45[_0x5818('0x3f')]['length']?_0x289a45[_0x5818('0x3f')]:_0x1ed23a['model'];if(_0x188be4['query']['includeAll']){_0x289a45['include']=[{'all':!![]}];}_0x289a45=_['merge']({},_0x289a45,_0x188be4[_0x5818('0xb5')]);return db[_0x5818('0x37')][_0x5818('0x5f')](_0x289a45)['then'](handleEntityNotFound(_0x45fcb1,null))[_0x5818('0x29')](respondWithResult(_0x45fcb1,null))[_0x5818('0x35')](handleError(_0x45fcb1,null));};exports[_0x5818('0xb6')]=function(_0x359b1c,_0x196819){return db['FaxInteraction'][_0x5818('0xb6')](_0x359b1c[_0x5818('0x75')],{})['then'](respondWithResult(_0x196819,0xc9))[_0x5818('0x35')](handleError(_0x196819,null));};exports['update']=function(_0x3e3512,_0x372a5b){if(_0x3e3512[_0x5818('0x75')]['id']){delete _0x3e3512['body']['id'];}return db[_0x5818('0x37')][_0x5818('0x5f')]({'where':{'id':_0x3e3512[_0x5818('0xb7')]['id']}})['then'](handleEntityNotFound(_0x372a5b,null))['then'](saveUpdates(_0x3e3512[_0x5818('0x75')],null))[_0x5818('0x29')](respondWithResult(_0x372a5b,null))[_0x5818('0x35')](handleError(_0x372a5b,null));};exports[_0x5818('0x28')]=function(_0x33d4fe,_0xae2f3){return db[_0x5818('0x37')][_0x5818('0x5f')]({'where':{'id':_0x33d4fe['params']['id']}})['then'](handleEntityNotFound(_0xae2f3,null))[_0x5818('0x29')](removeEntity(_0xae2f3,null))[_0x5818('0x35')](handleError(_0xae2f3,null));};exports[_0x5818('0xb8')]=function(_0x2a315e,_0x47d91a){return db[_0x5818('0x37')][_0x5818('0xb8')]()[_0x5818('0x29')](respondWithResult(_0x47d91a,null))['catch'](handleError(_0x47d91a,null));};exports[_0x5818('0xb9')]=function(_0x592b2d,_0x288700,_0x378571){return db[_0x5818('0xba')][_0x5818('0x5f')]({'where':{'id':_0x592b2d['params']['id']}})[_0x5818('0x29')](handleEntityNotFound(_0x288700,null))['then'](function(_0x3e26df){if(_0x3e26df){return _0x3e26df['addMessage'](_0x592b2d[_0x5818('0x75')][_0x5818('0xbb')],_[_0x5818('0xbc')](_0x592b2d[_0x5818('0x75')],[_0x5818('0xbb'),'id'])||{});}})[_0x5818('0x29')](respondWithResult(_0x288700,null))[_0x5818('0x35')](handleError(_0x288700,null));};exports[_0x5818('0xbd')]=function(_0x196060,_0x188da6,_0x4d05b1){var _0x716182={'raw':![],'where':{}};var _0x1f6f66={};var _0x3f4479={'count':0x0,'rows':[]};return db[_0x5818('0x37')][_0x5818('0xbe')]({'where':{'id':_0x196060['params']['id']}})[_0x5818('0x29')](handleEntityNotFound(_0x188da6,null))[_0x5818('0x29')](function(_0x57e19a){if(_0x57e19a){_0x1f6f66[_0x5818('0x3a')]=_[_0x5818('0x3c')](db[_0x5818('0xba')][_0x5818('0x38')]);_0x1f6f66[_0x5818('0x3b')]=_[_0x5818('0x3c')](_0x196060[_0x5818('0x3b')]);_0x1f6f66[_0x5818('0x3d')]=_[_0x5818('0x3e')](_0x1f6f66[_0x5818('0x3a')],_0x1f6f66['query']);_0x716182[_0x5818('0x3f')]=_[_0x5818('0x3e')](_0x1f6f66[_0x5818('0x3a')],qs[_0x5818('0x40')](_0x196060[_0x5818('0x3b')][_0x5818('0x40')]));_0x716182[_0x5818('0x3f')]=_0x716182[_0x5818('0x3f')][_0x5818('0x41')]?_0x716182[_0x5818('0x3f')]:_0x1f6f66[_0x5818('0x3a')];if(!_0x196060[_0x5818('0x3b')][_0x5818('0x42')](_0x5818('0x43'))){_0x716182['limit']=qs['limit'](_0x196060[_0x5818('0x3b')][_0x5818('0x44')]);_0x716182[_0x5818('0x21')]=qs['offset'](_0x196060[_0x5818('0x3b')][_0x5818('0x21')]);}_0x716182['order']=qs[_0x5818('0x45')](_0x196060[_0x5818('0x3b')][_0x5818('0x45')]);_0x716182[_0x5818('0x46')]=qs[_0x5818('0x3d')](_['pick'](_0x196060[_0x5818('0x3b')],_0x1f6f66['filters']));_0x716182[_0x5818('0x46')][_0x5818('0xb3')]=_0x57e19a['id'];if(_0x196060[_0x5818('0x3b')][_0x5818('0x86')]){_0x716182[_0x5818('0x46')]=_[_0x5818('0x9e')](_0x716182[_0x5818('0x46')],{'$or':_['map'](_0x716182[_0x5818('0x3f')],function(_0x4a2728){var _0x47faee={};_0x47faee[_0x4a2728]={'$like':'%'+_0x196060[_0x5818('0x3b')]['filter']+'%'};return _0x47faee;})});}if(_0x196060[_0x5818('0x3b')][_0x5818('0x7b')]){var _0x578932=_0x196060[_0x5818('0x3b')][_0x5818('0x7b')]['split'](',');var _0x1e41d7={};_0x1e41d7[_0x578932[0x0]]={'$gte':moment(_0x578932[0x1])[_0x5818('0xbf')](_0x5818('0xc0'))};_0x716182['where']=_['merge'](_0x716182['where'],_0x1e41d7);}_0x716182=_[_0x5818('0x9e')]({},_0x716182,_0x196060[_0x5818('0xb5')]);return db[_0x5818('0xba')][_0x5818('0x20')]({'where':_0x716182[_0x5818('0x46')]})[_0x5818('0x29')](function(_0x55418b){_0x3f4479['count']=_0x55418b;if(_0x196060['query'][_0x5818('0xc1')]){_0x716182[_0x5818('0xc2')]=[{'all':!![]}];}return db[_0x5818('0xba')][_0x5818('0xc3')](_0x716182);})['then'](function(_0x2b1ecc){_0x3f4479[_0x5818('0xb4')]=_0x2b1ecc;return _0x3f4479;});}})[_0x5818('0x29')](respondWithFilteredResult(_0x188da6,_0x716182))[_0x5818('0x35')](handleError(_0x188da6,null));};exports[_0x5818('0xc4')]=function(_0x184ab3,_0x5f4df4,_0x5e0753){return db['FaxInteraction']['find']({'where':{'id':_0x184ab3[_0x5818('0xb7')]['id']}})[_0x5818('0x29')](handleEntityNotFound(_0x5f4df4,null))['then'](function(_0x4db2ed){if(_0x4db2ed){return _0x4db2ed['setTags'](_0x184ab3[_0x5818('0x75')][_0x5818('0xbb')],_[_0x5818('0xbc')](_0x184ab3[_0x5818('0x75')],[_0x5818('0xbb'),'id'])||{})[_0x5818('0xc5')](function(){return db[_0x5818('0x6e')]['findAll']({'attributes':['id','name',_0x5818('0xc6')],'where':{'id':_0x184ab3['body']['ids']}});})[_0x5818('0x29')](function(_0x3b89e7){socket[_0x5818('0xc7')](_0x5818('0xc8'),{'id':Number(_0x184ab3[_0x5818('0xb7')]['id']),'tags':_0x3b89e7||[]});return{'id':Number(_0x184ab3[_0x5818('0xb7')]['id']),'tags':_0x3b89e7||[]};});}})[_0x5818('0x29')](respondWithResult(_0x5f4df4,null))[_0x5818('0x35')](handleError(_0x5f4df4,null));};exports[_0x5818('0xc9')]=function(_0x46dff1,_0x4b6fbd,_0x3a264f){return db[_0x5818('0x37')][_0x5818('0x5f')]({'where':{'id':_0x46dff1['params']['id']}})[_0x5818('0x29')](handleEntityNotFound(_0x4b6fbd,null))[_0x5818('0x29')](function(_0x172752){if(_0x172752){return _0x172752[_0x5818('0xc9')](_0x46dff1[_0x5818('0x3b')][_0x5818('0xbb')]);}})[_0x5818('0x29')](respondWithStatusCode(_0x4b6fbd,null))['catch'](handleError(_0x4b6fbd,null));};exports[_0x5818('0xca')]=function(_0x268694,_0x2376a2){var _0x3dbf14=moment()[_0x5818('0xcb')]()[_0x5818('0x9c')]();var _0x1c69e9=path['join'](config['root'],_0x5818('0xcc'),_0x5818('0xcd'),_0x5818('0xce'));var _0x4e5c6a=path[_0x5818('0xcf')](config[_0x5818('0xd0')],_0x5818('0xcc'),_0x5818('0xcd'),_0x5818('0xd1'));var _0x3dcff4=path['join'](_0x1c69e9,_0x3dbf14);var _0x5dc816=util[_0x5818('0xbf')](_0x5818('0xd2'),_0x268694['params']['id'],_0x3dbf14);var _0xe077c9=path['join'](_0x1c69e9,_0x5dc816);var _0x6cc455=[];_0x6cc455[_0x5818('0x34')]({'model':db[_0x5818('0xd3')],'as':_0x5818('0xd3'),'raw':!![]});var _0x3dc8af=[{'model':db[_0x5818('0xba')],'as':'Messages','attributes':['id',_0x5818('0x75'),'createdAt'],'include':_0x6cc455}];return db['FaxInteraction'][_0x5818('0x5f')]({'where':{'id':_0x268694['params']['id']},'include':_0x3dc8af})[_0x5818('0x29')](handleEntityNotFound(_0x2376a2,null))['then'](function(_0x5277b1){if(_0x5277b1&&_0x5277b1[_0x5818('0xd4')]){var _0x174811=_0x5277b1[_0x5818('0xd5')]({'plain':!![]});fs[_0x5818('0xd6')](_0x3dcff4);for(var _0x1f25ee=0x0;_0x1f25ee<_0x174811[_0x5818('0xd4')]['length'];_0x1f25ee++){var _0x558be8=_0x174811[_0x5818('0xd4')][_0x1f25ee][_0x5818('0xd3')];if(_0x558be8){var _0x25009f=path['join'](_0x4e5c6a,_0x558be8[_0x5818('0xd7')]);if(fs['existsSync'](_0x25009f)){fs[_0x5818('0xd8')](_0x25009f)['pipe'](fs['createWriteStream'](path[_0x5818('0xcf')](_0x3dcff4,_0x558be8[_0x5818('0xd7')])));}}}return BPromise['resolve']()[_0x5818('0x29')](function(){return new BPromise(function(_0x2050d2,_0x25c46a){zipdir(_0x3dcff4,{'saveTo':_0xe077c9},function(_0x169a52,_0x4a86c6){if(_0x169a52)return _0x25c46a(_0x169a52);return _0x2050d2(_0x4a86c6);});})['then'](function(){return new BPromise(function(_0x2fd569,_0xb0cbdf){rimraf(_0x3dcff4,function(_0x1ac86a){if(_0x1ac86a)_0xb0cbdf(_0x1ac86a);return _0x2fd569();});});})[_0x5818('0x29')](function(){return _0x2376a2[_0x5818('0xca')](_0xe077c9,_0x5dc816,function(_0x40a52e){if(_0x40a52e){console[_0x5818('0xd9')]('err',_0x40a52e);}else{fs[_0x5818('0xda')](_0xe077c9);}});});});}else{return _0x2376a2['sendStatus'](0xc8);}})['catch'](handleError(_0x2376a2,null));}; \ No newline at end of file +var _0x5f50=['socket.io-emitter','redis','./faxInteraction.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','map','fullname','Tags','TagIds','split','forEach','push','catch','FaxInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','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','start','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','FaxAccountId','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','unreadMessages','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','c.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','include','options','body','params','addMessage','FaxMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','setTags','spread','emit','removeTags','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachment','Messages','get','existsSync','createReadStream','pipe','createWriteStream','basename','download','log','html-pdf','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','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost'];(function(_0xf96523,_0x57f616){var _0x4fd350=function(_0x296f94){while(--_0x296f94){_0xf96523['push'](_0xf96523['shift']());}};_0x4fd350(++_0x57f616);}(_0x5f50,0xbb));var _0x05f5=function(_0x5d3761,_0x352104){_0x5d3761=_0x5d3761-0x0;var _0x1c86ec=_0x5f50[_0x5d3761];return _0x1c86ec;};'use strict';var pdf=require(_0x05f5('0x0'));var emlformat=require(_0x05f5('0x1'));var rimraf=require(_0x05f5('0x2'));var zipdir=require(_0x05f5('0x3'));var jsonpatch=require(_0x05f5('0x4'));var rp=require(_0x05f5('0x5'));var moment=require(_0x05f5('0x6'));var BPromise=require(_0x05f5('0x7'));var Mustache=require(_0x05f5('0x8'));var util=require(_0x05f5('0x9'));var path=require(_0x05f5('0xa'));var sox=require(_0x05f5('0xb'));var csv=require(_0x05f5('0xc'));var ejs=require(_0x05f5('0xd'));var fs=require('fs');var fs_extra=require(_0x05f5('0xe'));var _=require(_0x05f5('0xf'));var squel=require(_0x05f5('0x10'));var crypto=require('crypto');var jsforce=require(_0x05f5('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x05f5('0xc'));var querystring=require(_0x05f5('0x12'));var Papa=require(_0x05f5('0x13'));var Redis=require(_0x05f5('0x14'));var authService=require(_0x05f5('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x05f5('0x16'))(_0x05f5('0x17'));var utils=require(_0x05f5('0x18'));var config=require(_0x05f5('0x19'));var licenseUtil=require(_0x05f5('0x1a'));var db=require(_0x05f5('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x05f5('0x1c'),'port':0x18eb});var socket=require(_0x05f5('0x1d'))(new Redis(config[_0x05f5('0x1e')]));require(_0x05f5('0x1f'))[_0x05f5('0x20')](socket);function respondWithStatusCode(_0x16c940,_0x495308){_0x495308=_0x495308||0xcc;return function(_0x3239c1){if(_0x3239c1){return _0x16c940['sendStatus'](_0x495308);}return _0x16c940[_0x05f5('0x21')](_0x495308)[_0x05f5('0x22')]();};}function respondWithResult(_0x42e155,_0x7bf3f8){_0x7bf3f8=_0x7bf3f8||0xc8;return function(_0x1a05aa){if(_0x1a05aa){return _0x42e155[_0x05f5('0x21')](_0x7bf3f8)[_0x05f5('0x23')](_0x1a05aa);}};}function respondWithFilteredResult(_0x3fe0c2,_0x3528c8){return function(_0x387462){if(_0x387462){var _0x30d870=_0x387462[_0x05f5('0x24')],_0x1ce0a6=_0x3528c8['offset'],_0x7cd552=_0x3528c8[_0x05f5('0x25')]+_0x3528c8[_0x05f5('0x26')],_0x3be629;if(_0x7cd552>=_0x30d870){_0x7cd552=_0x30d870;_0x3be629=0xc8;}else{_0x3be629=0xce;}_0x3fe0c2[_0x05f5('0x21')](_0x3be629);return _0x3fe0c2[_0x05f5('0x27')](_0x05f5('0x28'),_0x1ce0a6+'-'+_0x7cd552+'/'+_0x30d870)[_0x05f5('0x23')](_0x387462);}return null;};}function patchUpdates(_0xe788d8){return function(_0x280293){try{jsonpatch[_0x05f5('0x29')](_0x280293,_0xe788d8,!![]);}catch(_0x5c0767){return BPromise[_0x05f5('0x2a')](_0x5c0767);}return _0x280293[_0x05f5('0x2b')]();};}function saveUpdates(_0x3dfc01,_0x2b9bd5){return function(_0x40656f){if(_0x40656f){return _0x40656f[_0x05f5('0x2c')](_0x3dfc01)[_0x05f5('0x2d')](function(_0x3e1bf7){return _0x3e1bf7;});}return null;};}function removeEntity(_0x576d17,_0x17037e){return function(_0x73515f){if(_0x73515f){return _0x73515f[_0x05f5('0x2e')]()[_0x05f5('0x2d')](function(){_0x576d17[_0x05f5('0x21')](0xcc)[_0x05f5('0x22')]();});}};}function handleEntityNotFound(_0x4d0d52,_0x6854a){return function(_0x14099c){if(!_0x14099c){_0x4d0d52[_0x05f5('0x2f')](0x194);}return _0x14099c;};}function handleError(_0x1d0a6d,_0x5bb665){_0x5bb665=_0x5bb665||0x1f4;return function(_0x4ac964){logger['error'](_0x4ac964[_0x05f5('0x30')]);if(_0x4ac964[_0x05f5('0x31')]){delete _0x4ac964[_0x05f5('0x31')];}_0x1d0a6d['status'](_0x5bb665)['send'](_0x4ac964);};}function getInteractionUsers(_0x114b8d,_0x5e7652){return new BPromise(function(_0xdec973,_0x5e0702){try{if(_0x5e7652[_0x114b8d['id']]){_0x114b8d['Users']=_[_0x05f5('0x32')](_0x5e7652[_0x114b8d['id']],function(_0x2eb1f8){return{'id':_0x2eb1f8['id'],'fullname':_0x2eb1f8[_0x05f5('0x33')]};});}}catch(_0xbcd816){_0x5e0702(_0xbcd816);}_0xdec973(_0x114b8d);});}function getInteractionTags(_0x3213a7,_0x3baee9){return new BPromise(function(_0x4c6ff6,_0x4ad174){try{if(_0x3213a7['TagIds']){_0x3213a7[_0x05f5('0x34')]=[];_0x3213a7[_0x05f5('0x35')][_0x05f5('0x36')](',')[_0x05f5('0x37')](function(_0x1f867c){_0x3213a7[_0x05f5('0x34')][_0x05f5('0x38')](_0x3baee9[_0x1f867c]);});}delete _0x3213a7[_0x05f5('0x35')];}catch(_0x5a2bd8){_0x4ad174(_0x5a2bd8);}_0x4c6ff6(_0x3213a7);});}function updateFaxInteraction(_0xc6cf4b,_0x1ff5a3,_0x5362a6){return new BPromise(function(_0x531942,_0x2be078){return getInteractionUsers(_0xc6cf4b,_0x5362a6)[_0x05f5('0x2d')](function(_0xe1011a){return getInteractionTags(_0xe1011a,_0x1ff5a3);})[_0x05f5('0x2d')](function(_0x473bc4){_0x531942(_0x473bc4);})[_0x05f5('0x39')](function(_0x27fb0f){_0x2be078(_0x27fb0f);});});}exports['index']=function(_0x1259df,_0x2af3fb){var _0x125870={},_0x5359c0={},_0x21734b={'count':0x0,'rows':[]};var _0x299b91=_[_0x05f5('0x32')](db[_0x05f5('0x3a')][_0x05f5('0x3b')],function(_0x11a33f){return{'name':_0x11a33f[_0x05f5('0x3c')],'type':_0x11a33f[_0x05f5('0x3d')]['key']};});_0x5359c0[_0x05f5('0x3e')]=_[_0x05f5('0x32')](_0x299b91,_0x05f5('0x31'));_0x5359c0[_0x05f5('0x3f')]=_[_0x05f5('0x40')](_0x1259df['query']);_0x5359c0[_0x05f5('0x41')]=_[_0x05f5('0x42')](_0x5359c0['model'],_0x5359c0['query']);_0x125870[_0x05f5('0x43')]=_[_0x05f5('0x42')](_0x5359c0[_0x05f5('0x3e')],qs[_0x05f5('0x44')](_0x1259df[_0x05f5('0x3f')]['fields']));_0x125870['attributes']=_0x125870[_0x05f5('0x43')][_0x05f5('0x45')]?_0x125870[_0x05f5('0x43')]:_0x5359c0[_0x05f5('0x3e')];if(!_0x1259df[_0x05f5('0x3f')][_0x05f5('0x46')](_0x05f5('0x47'))){_0x125870['limit']=qs[_0x05f5('0x26')](_0x1259df[_0x05f5('0x3f')]['limit']);_0x125870[_0x05f5('0x25')]=qs[_0x05f5('0x25')](_0x1259df[_0x05f5('0x3f')][_0x05f5('0x25')]);}_0x125870[_0x05f5('0x48')]=qs['sort'](_0x1259df[_0x05f5('0x3f')][_0x05f5('0x49')]);_0x125870[_0x05f5('0x4a')]=qs[_0x05f5('0x41')](_[_0x05f5('0x4b')](_0x1259df[_0x05f5('0x3f')],_0x5359c0[_0x05f5('0x41')]),_0x299b91);var _0x3ade59=[];var _0x279ccb=squel[_0x05f5('0x4c')]()['field']('id')[_0x05f5('0x4d')](_0x05f5('0x31'))[_0x05f5('0x4d')](_0x05f5('0x4e'))[_0x05f5('0x4f')](_0x05f5('0x50'));var _0x158b01=squel[_0x05f5('0x4c')]()[_0x05f5('0x4d')](_0x05f5('0x51'))[_0x05f5('0x4d')](_0x05f5('0x52'))[_0x05f5('0x4d')]('ui.FaxInteractionId')['from'](_0x05f5('0x53'),'ui')[_0x05f5('0x54')](_0x05f5('0x55'),'u',_0x05f5('0x56'));var _0xd69010=squel[_0x05f5('0x4c')]()[_0x05f5('0x4f')](_0x05f5('0x57'),'i')[_0x05f5('0x54')](_0x05f5('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x05f5('0x54')](_0x05f5('0x55'),'o',_0x05f5('0x59'))[_0x05f5('0x54')](_0x05f5('0x5a'),'a','a.id\x20=\x20i.FaxAccountId')[_0x05f5('0x54')](_0x05f5('0x5b'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x05f5('0x54')](_0x05f5('0x5c'),'it',_0x05f5('0x5d'))[_0x05f5('0x54')](_0x05f5('0x50'),'t',_0x05f5('0x5e'));var _0x40b291=squel['expr']();var _0xd11e0a=[];var _0x372735=squel[_0x05f5('0x5f')]();var _0x402573;if(_0x1259df[_0x05f5('0x3f')][_0x05f5('0x60')]){_0x402573=as[_0x05f5('0x61')](_0x1259df[_0x05f5('0x3f')][_0x05f5('0x60')]);var _0x242f27=_0x402573[_0x05f5('0x62')];for(var _0x10ff68=0x0;_0x10ff68<_0x402573[_0x05f5('0x63')]['length'];_0x10ff68++){var _0x3d5a3f=_0x402573['conditions'][_0x10ff68];var _0x50b067='i';var _0x34215b=_['find'](_0x299b91,[_0x05f5('0x31'),_0x3d5a3f[_0x05f5('0x4d')]]);if(!_0x34215b){switch(_0x3d5a3f[_0x05f5('0x4d')]){case'unreadMessages':if(_0x3d5a3f[_0x05f5('0x64')]==0x1){_0xd69010[_0x05f5('0x65')]('`'+_0x3d5a3f[_0x05f5('0x4d')]+_0x05f5('0x66'));}else{_0xd69010[_0x05f5('0x65')]('`'+_0x3d5a3f[_0x05f5('0x4d')]+_0x05f5('0x67'));}break;case _0x05f5('0x68'):if(_0x3d5a3f[_0x05f5('0x69')]==='$substring'){if(_0x3d5a3f[_0x05f5('0x64')][_0x05f5('0x36')]('\x20')[_0x05f5('0x45')]>0x1){_0x40b291[_0x242f27](_0x05f5('0x6a'),qs['getFullTextValue'](_0x3d5a3f['value']),null);}else{var _0x591eca='%'+_0x3d5a3f['value']+'%';_0x40b291[_0x242f27](_0x05f5('0x6b'),_0x591eca,_0x591eca,_0x591eca);}}else{_0x34215b=_[_0x05f5('0x6c')](_0x299b91,[_0x05f5('0x31'),'ContactId']);_0x3d5a3f[_0x05f5('0x4d')]=_0x05f5('0x6d');_0x367880=as[_0x05f5('0x6e')](_0x50b067,_0x34215b[_0x05f5('0x3d')],_0x3d5a3f);_0x40b291[_0x242f27](_0x367880[_0x05f5('0x6f')],_0x367880['value'][_0x05f5('0x70')],_0x367880[_0x05f5('0x64')]['end']);}break;case'Tag':var _0x4ac994=_0x3d5a3f['value'][_0x05f5('0x36')](',')['map'](function(_0x95125d){return Number(_0x95125d);});_0x4ac994[_0x05f5('0x37')](function(_0x4c90f0){_0x372735['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4c90f0+',%');});_0xd11e0a=_['union'](_0xd11e0a,_0x4ac994);break;case _0x05f5('0x71'):if(_0x3d5a3f[_0x05f5('0x69')]===_0x05f5('0x72')){_0x40b291[_0x242f27](_0x05f5('0x73'),'%'+_0x3d5a3f[_0x05f5('0x64')]+'%',null);}else{_0x34215b=_[_0x05f5('0x6c')](_0x299b91,['name','UserId']);_0x3d5a3f[_0x05f5('0x4d')]=_0x05f5('0x74');_0x367880=as[_0x05f5('0x6e')](_0x50b067,_0x34215b[_0x05f5('0x3d')],_0x3d5a3f);_0x40b291[_0x242f27](_0x367880[_0x05f5('0x6f')],_0x367880[_0x05f5('0x64')][_0x05f5('0x70')],_0x367880[_0x05f5('0x64')][_0x05f5('0x22')]);}break;case'body':_0x367880=as['buildExpression']('me',null,_0x3d5a3f);_0x40b291[_0x242f27](_0x367880[_0x05f5('0x6f')],_0x367880[_0x05f5('0x64')]['start'],_0x367880[_0x05f5('0x64')][_0x05f5('0x22')]);break;}}else{var _0x367880=as[_0x05f5('0x6e')](_0x50b067,_0x34215b[_0x05f5('0x3d')],_0x3d5a3f);_0x40b291[_0x242f27](_0x367880[_0x05f5('0x6f')],_0x367880[_0x05f5('0x64')][_0x05f5('0x70')],_0x367880[_0x05f5('0x64')][_0x05f5('0x22')]);}}}else{var _0x1ecd84=_(_0x1259df[_0x05f5('0x3f')])[_0x05f5('0x40')]()[_0x05f5('0x32')](function(_0x5d081c){return _[_0x05f5('0x75')](_0x299b91,[_0x05f5('0x31'),_0x5d081c])?_0x5d081c:undefined;})[_0x05f5('0x76')]()[_0x05f5('0x64')]();if(!_[_0x05f5('0x77')](_0x1ecd84)){_0x1ecd84[_0x05f5('0x37')](function(_0xc55f51){if(_0xc55f51===_0x05f5('0x78')){_0xd69010[_0x05f5('0x4a')]('i.FaxAccountId\x20IN\x20?',[][_0x05f5('0x79')](_0x1259df['query'][_0xc55f51]));}else if(_0xc55f51===_0x05f5('0x7a')){var _0x183bc2=JSON['parse'](_0x1259df[_0x05f5('0x3f')][_0xc55f51])[_0x05f5('0x7b')];var _0x557083=JSON[_0x05f5('0x7c')](_0x1259df['query'][_0xc55f51])[_0x05f5('0x7d')];_0xd69010['where'](_0x05f5('0x7e'),_0x183bc2,_0x557083);}else{if(_0x1259df[_0x05f5('0x3f')][_0xc55f51]==='null'){_0xd69010[_0x05f5('0x4a')]('i.'+_0xc55f51+_0x05f5('0x7f'));}else{_0xd69010[_0x05f5('0x4a')]('i.'+_0xc55f51+'\x20=\x20?',_0x1259df[_0x05f5('0x3f')][_0xc55f51]);}}});}if(_0x1259df[_0x05f5('0x3f')][_0x05f5('0x80')]){if(_0x1259df[_0x05f5('0x3f')][_0x05f5('0x80')]==0x1){_0xd69010[_0x05f5('0x65')](_0x05f5('0x81'));}else{_0xd69010['having'](_0x05f5('0x82'));}}if(_0x1259df[_0x05f5('0x3f')][_0x05f5('0x83')]){_0xd11e0a=_['isArray'](_0x1259df[_0x05f5('0x3f')]['tag'])?_0x1259df[_0x05f5('0x3f')]['tag']:new Array(_0x1259df[_0x05f5('0x3f')]['tag']);_0xd11e0a[_0x05f5('0x37')](function(_0x58c78e){_0x372735['or'](_0x05f5('0x84'),'%,'+_0x58c78e+',%');});}if(_0x1259df[_0x05f5('0x3f')][_0x05f5('0x85')]){var _0x56d860=_0x1259df['query'][_0x05f5('0x85')][_0x05f5('0x86')]('\x5c','\x5c\x5c')[_0x05f5('0x86')](/'/g,'\x27\x27');if(qs[_0x05f5('0x87')](_0x56d860)){_0x40b291['or'](_0x05f5('0x88'),_0x56d860+'%')['or'](_0x05f5('0x89'),_0x56d860+'%');}_0x40b291['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x56d860+'%');}}_0xd69010[_0x05f5('0x4a')](_0x40b291);_0xd69010['group'](_0x05f5('0x8a'));var _0x8c688b={'type':db['Sequelize'][_0x05f5('0x8b')][_0x05f5('0x8c')],'raw':!![]};var _0x49c8a4=_0xd69010[_0x05f5('0x8d')]();_0x49c8a4[_0x05f5('0x4d')]('i.id');_0x49c8a4[_0x05f5('0x4d')](_0x05f5('0x8e'),'unreadMessages');if(_0x125870[_0x05f5('0x48')]){_0x125870['order'][_0x05f5('0x37')](function(_0x3934ed){var _0x2de3b6=_0x3934ed[0x0]===_0x05f5('0x8f')?_0x3934ed[0x0]:'i.'+_0x3934ed[0x0];_0xd69010['order'](_0x2de3b6,_0x3934ed[0x1]===_0x05f5('0x90')?![]:!![]);});}if(!_[_0x05f5('0x77')](_0xd11e0a)){_0xd69010[_0x05f5('0x65')](_0x372735);_0x49c8a4[_0x05f5('0x4a')](_0x05f5('0x91'),_0xd11e0a);}BPromise[_0x05f5('0x92')]()[_0x05f5('0x2d')](function(){if(!_0x402573){if(_0x1259df['query']['FaxAccountId'])return;_0x49c8a4['where'](_0x05f5('0x93'));_0xd69010[_0x05f5('0x4a')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1259df['user'][_0x05f5('0x94')]!==_0x05f5('0x95'))return;return _0x1259df[_0x05f5('0x96')][_0x05f5('0x97')]({'attributes':['id'],'raw':!![]})[_0x05f5('0x2d')](function(_0x4720fb){if(_[_0x05f5('0x77')](_0x4720fb)){_0x49c8a4[_0x05f5('0x4a')]('i.FaxAccountId\x20IS\x20NULL');_0xd69010[_0x05f5('0x4a')](_0x05f5('0x98'));}else{_0x49c8a4[_0x05f5('0x4a')](_0x05f5('0x99'),_[_0x05f5('0x32')](_0x4720fb,'id'));_0xd69010[_0x05f5('0x4a')](_0x05f5('0x99'),_[_0x05f5('0x32')](_0x4720fb,'id'));}});})[_0x05f5('0x2d')](function(){if(_0x1259df[_0x05f5('0x96')][_0x05f5('0x94')]===_0x05f5('0x95')&&!_0x402573&&!_0x1259df['query']['FaxAccountId'])return[];return db[_0x05f5('0x9a')]['query'](_0x49c8a4[_0x05f5('0x9b')](),_0x8c688b);})[_0x05f5('0x2d')](function(_0x47f18a){_0x21734b['count']=_0x47f18a[_0x05f5('0x45')];if(_0x21734b[_0x05f5('0x24')]===0x0)return[];return db['sequelize']['query'](_0x279ccb[_0x05f5('0x9b')](),_0x8c688b)[_0x05f5('0x2d')](function(_0x183e39){_0x3ade59=_[_0x05f5('0x9c')](_0x183e39,'id');_0x8c688b=_[_0x05f5('0x9d')](_0x8c688b,{'model':db[_0x05f5('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1259df[_0x05f5('0x3f')][_0x05f5('0x44')]){_0x125870[_0x05f5('0x43')][_0x05f5('0x37')](function(_0x9b1650){_0xd69010[_0x05f5('0x4d')]('i.'+_0x9b1650);});}else{_0xd69010[_0x05f5('0x4d')](_0x05f5('0x8e'),_0x05f5('0x9e'));_0xd69010['field'](_0x05f5('0x9f'),_0x05f5('0xa0'));_0xd69010[_0x05f5('0x4d')](_0x05f5('0xa1'),'Account.mandatoryDisposition');_0xd69010['field'](_0x05f5('0xa2'),'contactName');_0xd69010[_0x05f5('0x4d')](_0x05f5('0xa3'));_0xd69010[_0x05f5('0x4d')](_0x05f5('0xa4'),_0x05f5('0xa5'));_0xd69010['field']('c.lastName','Contact.lastName');_0xd69010[_0x05f5('0x4d')](_0x05f5('0xa6'),_0x05f5('0xa7'));_0xd69010[_0x05f5('0x4d')](_0x05f5('0xa8'),'Contact.phone');_0xd69010['field'](_0x05f5('0xa9'),'Contact.mobile');_0xd69010[_0x05f5('0x4d')](_0x05f5('0xaa'),'Contact.fax');_0xd69010[_0x05f5('0x4d')]('o.fullname',_0x05f5('0xab'));_0xd69010['field'](_0x05f5('0xac'),_0x05f5('0xad'));_0xd69010['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x05f5('0x35'));}if(_0x125870[_0x05f5('0x26')])_0xd69010['limit'](_0x125870['limit']);if(_0x125870[_0x05f5('0x25')])_0xd69010[_0x05f5('0x25')](_0x125870['offset']);return db['sequelize'][_0x05f5('0x3f')](_0xd69010[_0x05f5('0x9b')](),_0x8c688b);})[_0x05f5('0x2d')](function(_0x1a9ed7){_0x158b01[_0x05f5('0x4a')](_0x05f5('0xae'),_[_0x05f5('0x32')](_0x1a9ed7,'id'));return db[_0x05f5('0x9a')][_0x05f5('0x3f')](_0x158b01[_0x05f5('0x9b')](),_0x8c688b)[_0x05f5('0x2d')](function(_0x596ec0){var _0x59e376=_[_0x05f5('0xaf')](_0x596ec0,_0x05f5('0xb0'));var _0x21110e=[];_0x1a9ed7[_0x05f5('0x37')](function(_0x32d3a0){_0x21110e['push'](updateFaxInteraction(_0x32d3a0,_0x3ade59,_0x59e376));});return BPromise[_0x05f5('0xb1')](_0x21110e);});});})['then'](function(_0x350399){_0x21734b[_0x05f5('0xb2')]=_0x350399;return _0x21734b;})[_0x05f5('0x2d')](respondWithFilteredResult(_0x2af3fb,_0x125870))['catch'](handleError(_0x2af3fb,null));};exports[_0x05f5('0xb3')]=function(_0x1b4c02,_0x2b2675){var _0x22667a={'raw':![],'where':{'id':_0x1b4c02['params']['id']}},_0x433c67={};_0x433c67['model']=_[_0x05f5('0x40')](db[_0x05f5('0x3a')]['rawAttributes']);_0x433c67[_0x05f5('0x3f')]=_[_0x05f5('0x40')](_0x1b4c02[_0x05f5('0x3f')]);_0x433c67[_0x05f5('0x41')]=_[_0x05f5('0x42')](_0x433c67['model'],_0x433c67['query']);_0x22667a['attributes']=_[_0x05f5('0x42')](_0x433c67[_0x05f5('0x3e')],qs[_0x05f5('0x44')](_0x1b4c02[_0x05f5('0x3f')][_0x05f5('0x44')]));_0x22667a[_0x05f5('0x43')]=_0x22667a['attributes'][_0x05f5('0x45')]?_0x22667a[_0x05f5('0x43')]:_0x433c67['model'];if(_0x1b4c02[_0x05f5('0x3f')]['includeAll']){_0x22667a[_0x05f5('0xb4')]=[{'all':!![]}];}_0x22667a=_['merge']({},_0x22667a,_0x1b4c02[_0x05f5('0xb5')]);return db['FaxInteraction'][_0x05f5('0x6c')](_0x22667a)[_0x05f5('0x2d')](handleEntityNotFound(_0x2b2675,null))['then'](respondWithResult(_0x2b2675,null))[_0x05f5('0x39')](handleError(_0x2b2675,null));};exports['create']=function(_0x25d02e,_0x4207db){return db[_0x05f5('0x3a')]['create'](_0x25d02e['body'],{})[_0x05f5('0x2d')](respondWithResult(_0x4207db,0xc9))['catch'](handleError(_0x4207db,null));};exports[_0x05f5('0x2c')]=function(_0x3a792d,_0x52aa55){if(_0x3a792d[_0x05f5('0xb6')]['id']){delete _0x3a792d[_0x05f5('0xb6')]['id'];}return db[_0x05f5('0x3a')][_0x05f5('0x6c')]({'where':{'id':_0x3a792d[_0x05f5('0xb7')]['id']}})[_0x05f5('0x2d')](handleEntityNotFound(_0x52aa55,null))[_0x05f5('0x2d')](saveUpdates(_0x3a792d[_0x05f5('0xb6')],null))[_0x05f5('0x2d')](respondWithResult(_0x52aa55,null))['catch'](handleError(_0x52aa55,null));};exports['destroy']=function(_0x496028,_0x3a95c6){return db[_0x05f5('0x3a')][_0x05f5('0x6c')]({'where':{'id':_0x496028[_0x05f5('0xb7')]['id']}})[_0x05f5('0x2d')](handleEntityNotFound(_0x3a95c6,null))['then'](removeEntity(_0x3a95c6,null))[_0x05f5('0x39')](handleError(_0x3a95c6,null));};exports['describe']=function(_0x5b3278,_0x7cf47a){return db[_0x05f5('0x3a')]['describe']()[_0x05f5('0x2d')](respondWithResult(_0x7cf47a,null))[_0x05f5('0x39')](handleError(_0x7cf47a,null));};exports[_0x05f5('0xb8')]=function(_0x119ef4,_0x433013,_0x52f0b8){return db[_0x05f5('0xb9')]['find']({'where':{'id':_0x119ef4[_0x05f5('0xb7')]['id']}})[_0x05f5('0x2d')](handleEntityNotFound(_0x433013,null))['then'](function(_0x6981ad){if(_0x6981ad){return _0x6981ad[_0x05f5('0xb8')](_0x119ef4[_0x05f5('0xb6')][_0x05f5('0xba')],_[_0x05f5('0xbb')](_0x119ef4[_0x05f5('0xb6')],['ids','id'])||{});}})[_0x05f5('0x2d')](respondWithResult(_0x433013,null))[_0x05f5('0x39')](handleError(_0x433013,null));};exports[_0x05f5('0xbc')]=function(_0x1ba3bd,_0x3d7129,_0x31839f){var _0x3268e4={'raw':![],'where':{}};var _0x469b62={};var _0xbd74a2={'count':0x0,'rows':[]};return db[_0x05f5('0x3a')][_0x05f5('0xbd')]({'where':{'id':_0x1ba3bd[_0x05f5('0xb7')]['id']}})['then'](handleEntityNotFound(_0x3d7129,null))[_0x05f5('0x2d')](function(_0x2d099d){if(_0x2d099d){_0x469b62[_0x05f5('0x3e')]=_[_0x05f5('0x40')](db['FaxMessage'][_0x05f5('0x3b')]);_0x469b62[_0x05f5('0x3f')]=_['keys'](_0x1ba3bd[_0x05f5('0x3f')]);_0x469b62[_0x05f5('0x41')]=_['intersection'](_0x469b62['model'],_0x469b62[_0x05f5('0x3f')]);_0x3268e4['attributes']=_[_0x05f5('0x42')](_0x469b62[_0x05f5('0x3e')],qs[_0x05f5('0x44')](_0x1ba3bd[_0x05f5('0x3f')][_0x05f5('0x44')]));_0x3268e4[_0x05f5('0x43')]=_0x3268e4[_0x05f5('0x43')][_0x05f5('0x45')]?_0x3268e4[_0x05f5('0x43')]:_0x469b62[_0x05f5('0x3e')];if(!_0x1ba3bd[_0x05f5('0x3f')][_0x05f5('0x46')](_0x05f5('0x47'))){_0x3268e4['limit']=qs['limit'](_0x1ba3bd[_0x05f5('0x3f')][_0x05f5('0x26')]);_0x3268e4[_0x05f5('0x25')]=qs[_0x05f5('0x25')](_0x1ba3bd[_0x05f5('0x3f')]['offset']);}_0x3268e4['order']=qs[_0x05f5('0x49')](_0x1ba3bd[_0x05f5('0x3f')][_0x05f5('0x49')]);_0x3268e4[_0x05f5('0x4a')]=qs[_0x05f5('0x41')](_[_0x05f5('0x4b')](_0x1ba3bd[_0x05f5('0x3f')],_0x469b62[_0x05f5('0x41')]));_0x3268e4[_0x05f5('0x4a')][_0x05f5('0xb0')]=_0x2d099d['id'];if(_0x1ba3bd['query'][_0x05f5('0x85')]){_0x3268e4[_0x05f5('0x4a')]=_[_0x05f5('0x9d')](_0x3268e4[_0x05f5('0x4a')],{'$or':_[_0x05f5('0x32')](_0x3268e4[_0x05f5('0x43')],function(_0x2f0140){var _0x53c249={};_0x53c249[_0x2f0140]={'$like':'%'+_0x1ba3bd['query']['filter']+'%'};return _0x53c249;})});}if(_0x1ba3bd[_0x05f5('0x3f')][_0x05f5('0x7b')]){var _0x41035f=_0x1ba3bd[_0x05f5('0x3f')][_0x05f5('0x7b')][_0x05f5('0x36')](',');var _0x385f4a={};_0x385f4a[_0x41035f[0x0]]={'$gte':moment(_0x41035f[0x1])[_0x05f5('0xbe')](_0x05f5('0xbf'))};_0x3268e4[_0x05f5('0x4a')]=_['merge'](_0x3268e4[_0x05f5('0x4a')],_0x385f4a);}_0x3268e4=_[_0x05f5('0x9d')]({},_0x3268e4,_0x1ba3bd['options']);return db[_0x05f5('0xb9')]['count']({'where':_0x3268e4[_0x05f5('0x4a')]})[_0x05f5('0x2d')](function(_0x386f9f){_0xbd74a2[_0x05f5('0x24')]=_0x386f9f;if(_0x1ba3bd[_0x05f5('0x3f')][_0x05f5('0xc0')]){_0x3268e4[_0x05f5('0xb4')]=[{'all':!![]}];}return db['FaxMessage'][_0x05f5('0xc1')](_0x3268e4);})[_0x05f5('0x2d')](function(_0x129c90){_0xbd74a2['rows']=_0x129c90;return _0xbd74a2;});}})[_0x05f5('0x2d')](respondWithFilteredResult(_0x3d7129,_0x3268e4))[_0x05f5('0x39')](handleError(_0x3d7129,null));};exports['addTags']=function(_0x22058b,_0x13d36d,_0x36e40b){return db['FaxInteraction'][_0x05f5('0x6c')]({'where':{'id':_0x22058b[_0x05f5('0xb7')]['id']}})['then'](handleEntityNotFound(_0x13d36d,null))[_0x05f5('0x2d')](function(_0x1fdd46){if(_0x1fdd46){return _0x1fdd46[_0x05f5('0xc2')](_0x22058b[_0x05f5('0xb6')]['ids'],_['omit'](_0x22058b['body'],['ids','id'])||{})[_0x05f5('0xc3')](function(){return db['Tag']['findAll']({'attributes':['id',_0x05f5('0x31'),_0x05f5('0x4e')],'where':{'id':_0x22058b[_0x05f5('0xb6')][_0x05f5('0xba')]}});})[_0x05f5('0x2d')](function(_0x398a64){socket[_0x05f5('0xc4')]('faxInteractionTags:save',{'id':Number(_0x22058b['params']['id']),'tags':_0x398a64||[]});return{'id':Number(_0x22058b[_0x05f5('0xb7')]['id']),'tags':_0x398a64||[]};});}})[_0x05f5('0x2d')](respondWithResult(_0x13d36d,null))[_0x05f5('0x39')](handleError(_0x13d36d,null));};exports[_0x05f5('0xc5')]=function(_0x42bd5f,_0x400784,_0x41af9d){return db[_0x05f5('0x3a')][_0x05f5('0x6c')]({'where':{'id':_0x42bd5f['params']['id']}})[_0x05f5('0x2d')](handleEntityNotFound(_0x400784,null))[_0x05f5('0x2d')](function(_0x44eae2){if(_0x44eae2){return _0x44eae2[_0x05f5('0xc5')](_0x42bd5f[_0x05f5('0x3f')][_0x05f5('0xba')]);}})['then'](respondWithStatusCode(_0x400784,null))[_0x05f5('0x39')](handleError(_0x400784,null));};exports['download']=function(_0x1bb107,_0x258799){var _0x20d818=moment()[_0x05f5('0xc6')]()[_0x05f5('0x9b')]();var _0x91253e=path[_0x05f5('0xc7')](config[_0x05f5('0xc8')],'server',_0x05f5('0xc9'),_0x05f5('0xca'));var _0x5c6763=path[_0x05f5('0xc7')](config[_0x05f5('0xc8')],_0x05f5('0xcb'),_0x05f5('0xc9'),_0x05f5('0xcc'));var _0x510589=path['join'](_0x91253e,_0x20d818);var _0x709e30=util['format'](_0x05f5('0xcd'),_0x1bb107[_0x05f5('0xb7')]['id'],_0x20d818);var _0x3e7c93=path['join'](_0x91253e,_0x709e30);var _0x4ac4f5=[];_0x4ac4f5['push']({'model':db[_0x05f5('0xce')],'as':_0x05f5('0xce'),'raw':!![]});var _0x50d6fb=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0x05f5('0xb6'),_0x05f5('0x7a')],'include':_0x4ac4f5}];return db['FaxInteraction'][_0x05f5('0x6c')]({'where':{'id':_0x1bb107['params']['id']},'include':_0x50d6fb})['then'](handleEntityNotFound(_0x258799,null))[_0x05f5('0x2d')](function(_0x426167){if(_0x426167&&_0x426167[_0x05f5('0xcf')]){var _0x5ec837=_0x426167[_0x05f5('0xd0')]({'plain':!![]});fs['mkdirSync'](_0x510589);for(var _0x3b7d40=0x0;_0x3b7d40<_0x5ec837['Messages'][_0x05f5('0x45')];_0x3b7d40++){var _0x351f7b=_0x5ec837['Messages'][_0x3b7d40][_0x05f5('0xce')];if(_0x351f7b){var _0x1526a2=path[_0x05f5('0xc7')](_0x5c6763,_0x351f7b['basename']);if(fs[_0x05f5('0xd1')](_0x1526a2)){fs[_0x05f5('0xd2')](_0x1526a2)[_0x05f5('0xd3')](fs[_0x05f5('0xd4')](path[_0x05f5('0xc7')](_0x510589,_0x351f7b[_0x05f5('0xd5')])));}}}return BPromise['resolve']()[_0x05f5('0x2d')](function(){return new BPromise(function(_0x4aeb4f,_0x19b6d0){zipdir(_0x510589,{'saveTo':_0x3e7c93},function(_0x3d69bd,_0x48a517){if(_0x3d69bd)return _0x19b6d0(_0x3d69bd);return _0x4aeb4f(_0x48a517);});})[_0x05f5('0x2d')](function(){return new BPromise(function(_0x4f6e1d,_0xb951fc){rimraf(_0x510589,function(_0x49d348){if(_0x49d348)_0xb951fc(_0x49d348);return _0x4f6e1d();});});})[_0x05f5('0x2d')](function(){return _0x258799[_0x05f5('0xd6')](_0x3e7c93,_0x709e30,function(_0x487cfb){if(_0x487cfb){console[_0x05f5('0xd7')]('err',_0x487cfb);}else{fs['unlinkSync'](_0x3e7c93);}});});});}else{return _0x258799['sendStatus'](0xc8);}})[_0x05f5('0x39')](handleError(_0x258799,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index e44b017..08c5af8 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 _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x5228cf,_0x10dfab){var _0x425485=function(_0x14b7e4){while(--_0x14b7e4){_0x5228cf['push'](_0x5228cf['shift']());}};_0x425485(++_0x10dfab);}(_0xadb5,0xad));var _0x5adb=function(_0x45c37e,_0x262a2a){_0x45c37e=_0x45c37e-0x0;var _0x345f8a=_0xadb5[_0x45c37e];return _0x345f8a;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x5adb('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return FaxMessage[_0x5adb('0xa')]({'where':{'FaxInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);FaxInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);FaxInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x57e661,_0xbff7d9){var _0x5eef45=function(_0x56a144){while(--_0x56a144){_0x57e661['push'](_0x57e661['shift']());}};_0x5eef45(++_0xbff7d9);}(_0x1261,0x144));var _0x1126=function(_0x288d33,_0x58ee36){_0x288d33=_0x288d33-0x0;var _0x1033bd=_0x1261[_0x288d33];return _0x1033bd;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 665566f..a9833cf 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 _0xe83f=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','closed','format','lodash'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0xe83f,0x1e9));var _0xfe83=function(_0x4cd5bb,_0x5d1d80){_0x4cd5bb=_0x4cd5bb-0x0;var _0x23e03a=_0xe83f[_0x4cd5bb];return _0x23e03a;};'use strict';var _=require(_0xfe83('0x0'));var util=require(_0xfe83('0x1'));var logger=require(_0xfe83('0x2'))(_0xfe83('0x3'));var moment=require('moment');var BPromise=require(_0xfe83('0x4'));var rp=require(_0xfe83('0x5'));var fs=require('fs');var path=require(_0xfe83('0x6'));var rimraf=require(_0xfe83('0x7'));var config=require('../../config/environment');var attributes=require(_0xfe83('0x8'));module['exports']=function(_0xaf11c5,_0x1769c3){return _0xaf11c5[_0xfe83('0x9')](_0xfe83('0xa'),attributes,{'tableName':_0xfe83('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3929f3,_0x41cdaf,_0x4f6538){if(_0x3929f3['changed'](_0xfe83('0xc'))){_0x3929f3['closedAt']=moment()[_0xfe83('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4f6538(null,_0x3929f3);}}});}; \ No newline at end of file +var _0x2d66=['changed','closed','format','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x2d66,0x17a));var _0x62d6=function(_0x5ea5c4,_0x19bd85){_0x5ea5c4=_0x5ea5c4-0x0;var _0x56367a=_0x2d66[_0x5ea5c4];return _0x56367a;};'use strict';var _=require(_0x62d6('0x0'));var util=require(_0x62d6('0x1'));var logger=require('../../config/logger')(_0x62d6('0x2'));var moment=require(_0x62d6('0x3'));var BPromise=require(_0x62d6('0x4'));var rp=require(_0x62d6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x62d6('0x6'));var attributes=require(_0x62d6('0x7'));module[_0x62d6('0x8')]=function(_0x2c166a,_0x12a087){return _0x2c166a[_0x62d6('0x9')](_0x62d6('0xa'),attributes,{'tableName':_0x62d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f41d8,_0x4489b2,_0x534eab){if(_0x3f41d8[_0x62d6('0xc')](_0x62d6('0xd'))){_0x3f41d8['closedAt']=moment()[_0x62d6('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x534eab(null,_0x3f41d8);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 30f4d37..f754c3b 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 _0x1b94=['stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','find','addTags','omit','ids','debug','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3bc022,_0x398082){var _0x4a19c6=function(_0x1e3281){while(--_0x1e3281){_0x3bc022['push'](_0x3bc022['shift']());}};_0x4a19c6(++_0x398082);}(_0x1b94,0x110));var _0x41b9=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x1b94[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0x41b9('0x0'));var util=require(_0x41b9('0x1'));var moment=require(_0x41b9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41b9('0x3'));var db=require(_0x41b9('0x4'))['db'];var utils=require(_0x41b9('0x5'));var logger=require(_0x41b9('0x6'))(_0x41b9('0x7'));var config=require(_0x41b9('0x8'));var jayson=require(_0x41b9('0x9'));var client=jayson[_0x41b9('0xa')][_0x41b9('0xb')]({'port':0x232a});config[_0x41b9('0xc')]=_[_0x41b9('0xd')](config[_0x41b9('0xc')],{'host':_0x41b9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41b9('0xc')]));require(_0x41b9('0xf'))[_0x41b9('0x10')](socket);function respondWithRpcPromise(_0x590e0c,_0x1eb94d,_0x578441){return new BPromise(function(_0x1bf437,_0x328996){return client['request'](_0x590e0c,_0x578441)[_0x41b9('0x11')](function(_0x585f1e){logger[_0x41b9('0x12')](_0x41b9('0x13'),_0x1eb94d,'request\x20sent');logger['debug'](_0x41b9('0x14'),_0x1eb94d,_0x41b9('0x15'),JSON[_0x41b9('0x16')](_0x585f1e));if(_0x585f1e[_0x41b9('0x17')]){if(_0x585f1e[_0x41b9('0x17')][_0x41b9('0x18')]===0x1f4){logger[_0x41b9('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x1eb94d,_0x585f1e[_0x41b9('0x17')][_0x41b9('0x19')]);return _0x328996(_0x585f1e[_0x41b9('0x17')]['message']);}logger['error'](_0x41b9('0x13'),_0x1eb94d,_0x585f1e[_0x41b9('0x17')][_0x41b9('0x19')]);return _0x1bf437(_0x585f1e[_0x41b9('0x17')][_0x41b9('0x19')]);}else{logger['info'](_0x41b9('0x13'),_0x1eb94d,'request\x20sent');_0x1bf437(_0x585f1e[_0x41b9('0x1a')][_0x41b9('0x19')]);}})[_0x41b9('0x1b')](function(_0x4a21a4){logger['error'](_0x41b9('0x13'),_0x1eb94d,_0x4a21a4);_0x328996(_0x4a21a4);});});}exports[_0x41b9('0x1c')]=function(_0x2a3924){var _0xb34149=this;return new Promise(function(_0x5ee66f,_0x594773){return db[_0x41b9('0x1d')][_0x41b9('0x1e')](_0x2a3924[_0x41b9('0x1f')],{'raw':_0x2a3924['options']?_0x2a3924[_0x41b9('0x20')][_0x41b9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a3924[_0x41b9('0x20')]?_0x2a3924[_0x41b9('0x20')]['where']||null:null,'attributes':_0x2a3924[_0x41b9('0x20')]?_0x2a3924['options'][_0x41b9('0x22')]||null:null,'limit':_0x2a3924['options']?_0x2a3924[_0x41b9('0x20')][_0x41b9('0x23')]||null:null})[_0x41b9('0x11')](function(_0x20935b){logger[_0x41b9('0x12')](_0x41b9('0x1c'),_0x2a3924);logger['debug'](_0x41b9('0x1c'),_0x2a3924,JSON[_0x41b9('0x16')](_0x20935b));_0x5ee66f(_0x20935b);})[_0x41b9('0x1b')](function(_0x15ebf5){logger[_0x41b9('0x17')]('UpdateFaxInteraction',_0x15ebf5[_0x41b9('0x19')],_0x2a3924);_0x594773(_0xb34149[_0x41b9('0x17')](0x1f4,_0x15ebf5[_0x41b9('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x61e228){return new Promise(function(_0x232ae8,_0x53b53a){return db[_0x41b9('0x1d')][_0x41b9('0x24')]({'where':_0x61e228[_0x41b9('0x20')]?_0x61e228[_0x41b9('0x20')]['where']||null:null})['then'](function(_0x2d76ea){if(_0x2d76ea){return _0x2d76ea[_0x41b9('0x25')](_0x61e228['body']['ids'],_[_0x41b9('0x26')](_0x61e228['body'],[_0x41b9('0x27'),'id'])||{});}})['spread'](function(_0x13515c){logger[_0x41b9('0x12')]('AddTags',_0x61e228);logger[_0x41b9('0x28')](_0x41b9('0x29'),_0x61e228,JSON[_0x41b9('0x16')](_0x13515c));_0x232ae8(_0x13515c);})[_0x41b9('0x1b')](function(_0x1f1884){logger[_0x41b9('0x17')](_0x41b9('0x29'),_0x1f1884[_0x41b9('0x19')],_0x61e228);_0x53b53a(_this['error'](0x1f4,_0x1f1884[_0x41b9('0x19')]));});});}; \ No newline at end of file +var _0x7a7a=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','UpdateFaxInteraction','update','options','raw','attributes','limit','AddTagsToFaxInteraction','FaxInteraction','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0xc492a3,_0x2b42ee){var _0x414593=function(_0x4489ad){while(--_0x4489ad){_0xc492a3['push'](_0xc492a3['shift']());}};_0x414593(++_0x2b42ee);}(_0x7a7a,0x15e));var _0xa7a7=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x7a7a[_0x455c6c];return _0x488242;};'use strict';var _=require(_0xa7a7('0x0'));var util=require(_0xa7a7('0x1'));var moment=require(_0xa7a7('0x2'));var BPromise=require(_0xa7a7('0x3'));var rs=require(_0xa7a7('0x4'));var fs=require('fs');var Redis=require(_0xa7a7('0x5'));var db=require(_0xa7a7('0x6'))['db'];var utils=require(_0xa7a7('0x7'));var logger=require(_0xa7a7('0x8'))('rpc');var config=require(_0xa7a7('0x9'));var jayson=require(_0xa7a7('0xa'));var client=jayson[_0xa7a7('0xb')][_0xa7a7('0xc')]({'port':0x232a});config[_0xa7a7('0xd')]=_[_0xa7a7('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa7a7('0xf'))(new Redis(config[_0xa7a7('0xd')]));require(_0xa7a7('0x10'))['register'](socket);function respondWithRpcPromise(_0x3030d6,_0x4e4e5f,_0x423b7e){return new BPromise(function(_0x3bba00,_0x89c384){return client['request'](_0x3030d6,_0x423b7e)[_0xa7a7('0x11')](function(_0x1e6d68){logger[_0xa7a7('0x12')](_0xa7a7('0x13'),_0x4e4e5f,'request\x20sent');logger[_0xa7a7('0x14')](_0xa7a7('0x15'),_0x4e4e5f,'request\x20sent',JSON[_0xa7a7('0x16')](_0x1e6d68));if(_0x1e6d68[_0xa7a7('0x17')]){if(_0x1e6d68['error'][_0xa7a7('0x18')]===0x1f4){logger[_0xa7a7('0x17')](_0xa7a7('0x13'),_0x4e4e5f,_0x1e6d68[_0xa7a7('0x17')][_0xa7a7('0x19')]);return _0x89c384(_0x1e6d68[_0xa7a7('0x17')]['message']);}logger[_0xa7a7('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x4e4e5f,_0x1e6d68[_0xa7a7('0x17')]['message']);return _0x3bba00(_0x1e6d68[_0xa7a7('0x17')][_0xa7a7('0x19')]);}else{logger[_0xa7a7('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x4e4e5f,_0xa7a7('0x1a'));_0x3bba00(_0x1e6d68['result'][_0xa7a7('0x19')]);}})[_0xa7a7('0x1b')](function(_0x45cecb){logger[_0xa7a7('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x4e4e5f,_0x45cecb);_0x89c384(_0x45cecb);});});}exports[_0xa7a7('0x1c')]=function(_0x36bd33){var _0x4146db=this;return new Promise(function(_0x107ffd,_0x1fb1ee){return db['FaxInteraction'][_0xa7a7('0x1d')](_0x36bd33['body'],{'raw':_0x36bd33[_0xa7a7('0x1e')]?_0x36bd33[_0xa7a7('0x1e')][_0xa7a7('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36bd33['options']?_0x36bd33[_0xa7a7('0x1e')]['where']||null:null,'attributes':_0x36bd33['options']?_0x36bd33[_0xa7a7('0x1e')][_0xa7a7('0x20')]||null:null,'limit':_0x36bd33[_0xa7a7('0x1e')]?_0x36bd33[_0xa7a7('0x1e')][_0xa7a7('0x21')]||null:null})['then'](function(_0xcf02c5){logger[_0xa7a7('0x12')]('UpdateFaxInteraction',_0x36bd33);logger[_0xa7a7('0x14')](_0xa7a7('0x1c'),_0x36bd33,JSON[_0xa7a7('0x16')](_0xcf02c5));_0x107ffd(_0xcf02c5);})[_0xa7a7('0x1b')](function(_0x1466b3){logger[_0xa7a7('0x17')](_0xa7a7('0x1c'),_0x1466b3[_0xa7a7('0x19')],_0x36bd33);_0x1fb1ee(_0x4146db[_0xa7a7('0x17')](0x1f4,_0x1466b3[_0xa7a7('0x19')]));});});};exports[_0xa7a7('0x22')]=function(_0x49eb42){return new Promise(function(_0xa4641e,_0x29bd89){return db[_0xa7a7('0x23')]['find']({'where':_0x49eb42[_0xa7a7('0x1e')]?_0x49eb42[_0xa7a7('0x1e')]['where']||null:null})[_0xa7a7('0x11')](function(_0x1a0c45){if(_0x1a0c45){return _0x1a0c45['addTags'](_0x49eb42[_0xa7a7('0x24')]['ids'],_['omit'](_0x49eb42['body'],[_0xa7a7('0x25'),'id'])||{});}})[_0xa7a7('0x26')](function(_0x4571c5){logger[_0xa7a7('0x12')](_0xa7a7('0x27'),_0x49eb42);logger[_0xa7a7('0x14')]('AddTags',_0x49eb42,JSON[_0xa7a7('0x16')](_0x4571c5));_0xa4641e(_0x4571c5);})[_0xa7a7('0x1b')](function(_0x26cfad){logger[_0xa7a7('0x17')](_0xa7a7('0x27'),_0x26cfad[_0xa7a7('0x19')],_0x49eb42);_0x29bd89(_this[_0xa7a7('0x17')](0x1f4,_0x26cfad[_0xa7a7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 6053d23..59c594b 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 _0xd978=['length','./faxInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x103678,_0x1154e1){var _0x455829=function(_0x31ad31){while(--_0x31ad31){_0x103678['push'](_0x103678['shift']());}};_0x455829(++_0x1154e1);}(_0xd978,0x141));var _0x8d97=function(_0x9be508,_0x10c8ba){_0x9be508=_0x9be508-0x0;var _0x16f3c3=_0xd978[_0x9be508];return _0x16f3c3;};'use strict';var FaxInteractionEvents=require(_0x8d97('0x0'));var events=[_0x8d97('0x1'),_0x8d97('0x2'),_0x8d97('0x3')];function createListener(_0xe910c1,_0x400777){return function(_0x4aadbe){_0x400777[_0x8d97('0x4')](_0xe910c1,_0x4aadbe);};}function removeListener(_0x4d0649,_0x3d1a01){return function(){FaxInteractionEvents[_0x8d97('0x5')](_0x4d0649,_0x3d1a01);};}exports[_0x8d97('0x6')]=function(_0x9e0bf0){for(var _0x568a41=0x0,_0x378a8=events[_0x8d97('0x7')];_0x568a41<_0x378a8;_0x568a41++){var _0x5d6e43=events[_0x568a41];var _0x4d7e24=createListener('faxInteraction:'+_0x5d6e43,_0x9e0bf0);FaxInteractionEvents['on'](_0x5d6e43,_0x4d7e24);}}; \ No newline at end of file +var _0xebca=['register','length','faxInteraction:','./faxInteraction.events','save','emit'];(function(_0x5c1cdc,_0x322014){var _0x2e8317=function(_0x2e9dfa){while(--_0x2e9dfa){_0x5c1cdc['push'](_0x5c1cdc['shift']());}};_0x2e8317(++_0x322014);}(_0xebca,0x1bf));var _0xaebc=function(_0x24eab8,_0x2f471c){_0x24eab8=_0x24eab8-0x0;var _0x41d883=_0xebca[_0x24eab8];return _0x41d883;};'use strict';var FaxInteractionEvents=require(_0xaebc('0x0'));var events=[_0xaebc('0x1'),'remove','update'];function createListener(_0x1da0e8,_0x12ce9e){return function(_0x322694){_0x12ce9e[_0xaebc('0x2')](_0x1da0e8,_0x322694);};}function removeListener(_0x49ce9b,_0x33a13a){return function(){FaxInteractionEvents['removeListener'](_0x49ce9b,_0x33a13a);};}exports[_0xaebc('0x3')]=function(_0x27a518){for(var _0x8ab3f5=0x0,_0x35398d=events[_0xaebc('0x4')];_0x8ab3f5<_0x35398d;_0x8ab3f5++){var _0x5b00f6=events[_0x8ab3f5];var _0x4cd55c=createListener(_0xaebc('0x5')+_0x5b00f6,_0x27a518);FaxInteractionEvents['on'](_0x5b00f6,_0x4cd55c);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 4eeb1fb..a7f80d0 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 _0x9f5b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','fax','faxinteraction:addtags','addTags','put','tracked','update','faxinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1740df,_0x27069c){var _0x4c45d0=function(_0x3da545){while(--_0x3da545){_0x1740df['push'](_0x1740df['shift']());}};_0x4c45d0(++_0x27069c);}(_0x9f5b,0xcb));var _0xb9f5=function(_0x5f2ed0,_0xaf721b){_0x5f2ed0=_0x5f2ed0-0x0;var _0x4f2eed=_0x9f5b[_0x5f2ed0];return _0x4f2eed;};'use strict';var multer=require(_0xb9f5('0x0'));var util=require(_0xb9f5('0x1'));var path=require(_0xb9f5('0x2'));var timeout=require(_0xb9f5('0x3'));var express=require(_0xb9f5('0x4'));var router=express[_0xb9f5('0x5')]();var fs_extra=require(_0xb9f5('0x6'));var auth=require(_0xb9f5('0x7'));var interaction=require(_0xb9f5('0x8'));var config=require(_0xb9f5('0x9'));var controller=require(_0xb9f5('0xa'));router[_0xb9f5('0xb')]('/',auth[_0xb9f5('0xc')](),controller['index']);router[_0xb9f5('0xb')]('/describe',auth[_0xb9f5('0xc')](),controller[_0xb9f5('0xd')]);router[_0xb9f5('0xb')](_0xb9f5('0xe'),auth[_0xb9f5('0xc')](),controller[_0xb9f5('0xf')]);router[_0xb9f5('0xb')](_0xb9f5('0x10'),auth[_0xb9f5('0xc')](),controller[_0xb9f5('0x11')]);router[_0xb9f5('0xb')](_0xb9f5('0x12'),auth[_0xb9f5('0xc')](),controller[_0xb9f5('0x13')]);router[_0xb9f5('0x14')]('/',auth['isAuthenticated'](),controller[_0xb9f5('0x15')]);router[_0xb9f5('0x14')](_0xb9f5('0x10'),auth[_0xb9f5('0xc')](),controller[_0xb9f5('0x16')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xb9f5('0x17'),_0xb9f5('0x18')),controller[_0xb9f5('0x19')]);router[_0xb9f5('0x1a')](_0xb9f5('0xe'),auth[_0xb9f5('0xc')](),interaction[_0xb9f5('0x1b')]('fax','faxinteraction:update'),controller[_0xb9f5('0x1c')]);router['delete'](_0xb9f5('0xe'),auth[_0xb9f5('0xc')](),interaction['tracked'](_0xb9f5('0x17'),_0xb9f5('0x1d')),controller[_0xb9f5('0x1e')]);router[_0xb9f5('0x1f')](_0xb9f5('0x20'),auth[_0xb9f5('0xc')](),controller[_0xb9f5('0x21')]);module[_0xb9f5('0x22')]=router; \ No newline at end of file +var _0x0213=['faxinteraction:addtags','addTags','fax','update','delete','destroy','removeTags','exports','multer','path','express','fs-extra','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked'];(function(_0x3e478c,_0x152670){var _0x29ef89=function(_0x3d0d77){while(--_0x3d0d77){_0x3e478c['push'](_0x3e478c['shift']());}};_0x29ef89(++_0x152670);}(_0x0213,0x1ac));var _0x3021=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0x0213[_0x52f159];return _0x156799;};'use strict';var multer=require(_0x3021('0x0'));var util=require('util');var path=require(_0x3021('0x1'));var timeout=require('connect-timeout');var express=require(_0x3021('0x2'));var router=express['Router']();var fs_extra=require(_0x3021('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3021('0x4'));var config=require('../../config/environment');var controller=require(_0x3021('0x5'));router[_0x3021('0x6')]('/',auth[_0x3021('0x7')](),controller[_0x3021('0x8')]);router[_0x3021('0x6')](_0x3021('0x9'),auth[_0x3021('0x7')](),controller[_0x3021('0xa')]);router[_0x3021('0x6')]('/:id',auth[_0x3021('0x7')](),controller[_0x3021('0xb')]);router[_0x3021('0x6')](_0x3021('0xc'),auth[_0x3021('0x7')](),controller[_0x3021('0xd')]);router['get'](_0x3021('0xe'),auth['isAuthenticated'](),controller[_0x3021('0xf')]);router[_0x3021('0x10')]('/',auth['isAuthenticated'](),controller[_0x3021('0x11')]);router[_0x3021('0x10')](_0x3021('0xc'),auth[_0x3021('0x7')](),controller['addMessage']);router[_0x3021('0x10')](_0x3021('0x12'),auth[_0x3021('0x7')](),interaction[_0x3021('0x13')]('fax',_0x3021('0x14')),controller[_0x3021('0x15')]);router['put']('/:id',auth[_0x3021('0x7')](),interaction[_0x3021('0x13')](_0x3021('0x16'),'faxinteraction:update'),controller[_0x3021('0x17')]);router[_0x3021('0x18')]('/:id',auth[_0x3021('0x7')](),interaction[_0x3021('0x13')]('fax','faxinteraction:destroy'),controller[_0x3021('0x19')]);router[_0x3021('0x18')](_0x3021('0x12'),auth['isAuthenticated'](),controller[_0x3021('0x1a')]);module[_0x3021('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 1425d1e..dae8689 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 _0x53fc=['out','TEXT','DATE','ENUM'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x53fc,0xa3));var _0xc53f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x53fc[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc53f('0x0')]('in',_0xc53f('0x1')),'defaultValue':_0xc53f('0x1'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xc53f('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xc53f('0x3')]}}; \ No newline at end of file +var _0x8354=['medium','ENUM','out','TEXT','DATE','exports'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x8354,0x1bb));var _0x4835=function(_0x1038b0,_0x4c2b89){_0x1038b0=_0x1038b0-0x0;var _0x27cfbc=_0x8354[_0x1038b0];return _0x27cfbc;};'use strict';var Sequelize=require('sequelize');module[_0x4835('0x0')]={'body':{'type':Sequelize['TEXT'](_0x4835('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4835('0x2')]('in',_0x4835('0x3')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x4835('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0x4835('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index a99365a..8d62038 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 _0xb51c=['acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','get','role','rejectmessage','create','findOne','ContactId','Attachment','AttachmentId','SendFax','isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','join','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','register','jayson/promise','client','http','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','attributes','intersection','fields','query','nolimit','order','sort','where','pick','merge','VIRTUAL','name','filter','options','FaxMessage','include','findAll','rows','show','params','includeAll','find','body','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','FaxInteractionId','format','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage'];(function(_0x1de41b,_0x1ddfe9){var _0x58d016=function(_0x5bdd66){while(--_0x5bdd66){_0x1de41b['push'](_0x1de41b['shift']());}};_0x58d016(++_0x1ddfe9);}(_0xb51c,0x12a));var _0xcb51=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xb51c[_0x5c351c];return _0x26f3b3;};'use strict';var pdf=require(_0xcb51('0x0'));var emlformat=require(_0xcb51('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcb51('0x2'));var jsonpatch=require(_0xcb51('0x3'));var rp=require(_0xcb51('0x4'));var moment=require('moment');var BPromise=require(_0xcb51('0x5'));var Mustache=require(_0xcb51('0x6'));var util=require(_0xcb51('0x7'));var path=require(_0xcb51('0x8'));var sox=require(_0xcb51('0x9'));var csv=require(_0xcb51('0xa'));var ejs=require(_0xcb51('0xb'));var fs=require('fs');var fs_extra=require(_0xcb51('0xc'));var _=require(_0xcb51('0xd'));var squel=require(_0xcb51('0xe'));var crypto=require('crypto');var jsforce=require(_0xcb51('0xf'));var deskjs=require(_0xcb51('0x10'));var toCsv=require(_0xcb51('0xa'));var querystring=require(_0xcb51('0x11'));var Papa=require(_0xcb51('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb51('0x13'));var logger=require(_0xcb51('0x14'))(_0xcb51('0x15'));var utils=require('../../config/utils');var config=require(_0xcb51('0x16'));var licenseUtil=require(_0xcb51('0x17'));var db=require(_0xcb51('0x18'))['db'];config['redis']=_[_0xcb51('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcb51('0x1a'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xcb51('0x1b')](socket);var jayson=require(_0xcb51('0x1c'));var client=jayson[_0xcb51('0x1d')][_0xcb51('0x1e')]({'port':0x232c});var client9002=jayson[_0xcb51('0x1d')][_0xcb51('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3cb3e0,_0x3cd88b,_0x395031,_0x3d1ded){return new BPromise(function(_0x1bb968,_0x4f8269){var _0x440538=_0x3d1ded||client;return _0x440538['request'](_0x3cb3e0,_0x395031)['then'](function(_0x249815){logger[_0xcb51('0x1f')](_0xcb51('0x20'),_0x3cd88b,_0xcb51('0x21'));logger[_0xcb51('0x22')](_0xcb51('0x23'),_0x3cd88b,_0xcb51('0x21'),JSON[_0xcb51('0x24')](_0x249815));if(_0x249815[_0xcb51('0x25')]){if(_0x249815[_0xcb51('0x25')][_0xcb51('0x26')]===0x1f4){logger[_0xcb51('0x25')](_0xcb51('0x20'),_0x3cd88b,_0x249815['error']['message']);return _0x4f8269(_0x249815[_0xcb51('0x25')][_0xcb51('0x27')]);}logger[_0xcb51('0x25')]('FaxMessage,\x20%s,\x20%s',_0x3cd88b,_0x249815[_0xcb51('0x25')][_0xcb51('0x27')]);return _0x1bb968(_0x249815[_0xcb51('0x25')]['message']);}else{logger[_0xcb51('0x1f')](_0xcb51('0x20'),_0x3cd88b,'request\x20sent');_0x1bb968(_0x249815['result'][_0xcb51('0x27')]);}})[_0xcb51('0x28')](function(_0x3167fa){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3cd88b,_0x3167fa);_0x4f8269(_0x3167fa);});});}function respondWithStatusCode(_0x39c59d,_0x20b4a0){_0x20b4a0=_0x20b4a0||0xcc;return function(_0x31353c){if(_0x31353c){return _0x39c59d['sendStatus'](_0x20b4a0);}return _0x39c59d[_0xcb51('0x29')](_0x20b4a0)[_0xcb51('0x2a')]();};}function respondWithResult(_0x17e63f,_0x2b9cfe){_0x2b9cfe=_0x2b9cfe||0xc8;return function(_0x50623a){if(_0x50623a){return _0x17e63f[_0xcb51('0x29')](_0x2b9cfe)[_0xcb51('0x2b')](_0x50623a);}};}function respondWithFilteredResult(_0x30a803,_0x18ec1f){return function(_0x42e2e9){if(_0x42e2e9){var _0x20b4bb=_0x42e2e9[_0xcb51('0x2c')],_0x30dc96=_0x18ec1f[_0xcb51('0x2d')],_0x9bd3de=_0x18ec1f[_0xcb51('0x2d')]+_0x18ec1f[_0xcb51('0x2e')],_0x548eb5;if(_0x9bd3de>=_0x20b4bb){_0x9bd3de=_0x20b4bb;_0x548eb5=0xc8;}else{_0x548eb5=0xce;}_0x30a803[_0xcb51('0x29')](_0x548eb5);return _0x30a803[_0xcb51('0x2f')](_0xcb51('0x30'),_0x30dc96+'-'+_0x9bd3de+'/'+_0x20b4bb)['json'](_0x42e2e9);}return null;};}function patchUpdates(_0x1f7371){return function(_0x532a54){try{jsonpatch[_0xcb51('0x31')](_0x532a54,_0x1f7371,!![]);}catch(_0x3a4fc8){return BPromise[_0xcb51('0x32')](_0x3a4fc8);}return _0x532a54[_0xcb51('0x33')]();};}function saveUpdates(_0x16e1a2,_0x33c907){return function(_0x32423b){if(_0x32423b){return _0x32423b[_0xcb51('0x34')](_0x16e1a2)[_0xcb51('0x35')](function(_0x1eda07){return _0x1eda07;});}return null;};}function removeEntity(_0x47a33d,_0x40cef0){return function(_0x1e3086){if(_0x1e3086){return _0x1e3086[_0xcb51('0x36')]()[_0xcb51('0x35')](function(){_0x47a33d[_0xcb51('0x29')](0xcc)[_0xcb51('0x2a')]();});}};}function handleEntityNotFound(_0x257d48,_0x32b52c){return function(_0x4eefbc){if(!_0x4eefbc){_0x257d48[_0xcb51('0x37')](0x194);}return _0x4eefbc;};}function handleError(_0x1e2556,_0x1f1c18){_0x1f1c18=_0x1f1c18||0x1f4;return function(_0x510b0b){logger[_0xcb51('0x25')](_0x510b0b['stack']);if(_0x510b0b['name']){delete _0x510b0b['name'];}_0x1e2556['status'](_0x1f1c18)[_0xcb51('0x38')](_0x510b0b);};}exports[_0xcb51('0x39')]=function(_0x5573b2,_0x21784){var _0x3257ee={},_0x371fe5={},_0x5ea12c={'count':0x0,'rows':[]};var _0x4d81f4=_[_0xcb51('0x3a')](db['FaxMessage'][_0xcb51('0x3b')],function(_0xb51cbf){return{'name':_0xb51cbf[_0xcb51('0x3c')],'type':_0xb51cbf[_0xcb51('0x3d')][_0xcb51('0x3e')]};});_0x371fe5[_0xcb51('0x3f')]=_[_0xcb51('0x3a')](_0x4d81f4,'name');_0x371fe5['query']=_[_0xcb51('0x40')](_0x5573b2['query']);_0x371fe5[_0xcb51('0x41')]=_['intersection'](_0x371fe5[_0xcb51('0x3f')],_0x371fe5['query']);_0x3257ee[_0xcb51('0x42')]=_[_0xcb51('0x43')](_0x371fe5[_0xcb51('0x3f')],qs[_0xcb51('0x44')](_0x5573b2[_0xcb51('0x45')][_0xcb51('0x44')]));_0x3257ee[_0xcb51('0x42')]=_0x3257ee[_0xcb51('0x42')]['length']?_0x3257ee[_0xcb51('0x42')]:_0x371fe5['model'];if(!_0x5573b2[_0xcb51('0x45')]['hasOwnProperty'](_0xcb51('0x46'))){_0x3257ee[_0xcb51('0x2e')]=qs[_0xcb51('0x2e')](_0x5573b2[_0xcb51('0x45')][_0xcb51('0x2e')]);_0x3257ee[_0xcb51('0x2d')]=qs[_0xcb51('0x2d')](_0x5573b2['query']['offset']);}_0x3257ee[_0xcb51('0x47')]=qs[_0xcb51('0x48')](_0x5573b2[_0xcb51('0x45')][_0xcb51('0x48')]);_0x3257ee[_0xcb51('0x49')]=qs['filters'](_[_0xcb51('0x4a')](_0x5573b2[_0xcb51('0x45')],_0x371fe5[_0xcb51('0x41')]),_0x4d81f4);if(_0x5573b2[_0xcb51('0x45')]['filter']){_0x3257ee['where']=_[_0xcb51('0x4b')](_0x3257ee['where'],{'$or':_[_0xcb51('0x3a')](_0x4d81f4,function(_0x2331d6){if(_0x2331d6[_0xcb51('0x3d')]!==_0xcb51('0x4c')){var _0x282831={};_0x282831[_0x2331d6[_0xcb51('0x4d')]]={'$like':'%'+_0x5573b2[_0xcb51('0x45')][_0xcb51('0x4e')]+'%'};return _0x282831;}})});}_0x3257ee=_[_0xcb51('0x4b')]({},_0x3257ee,_0x5573b2[_0xcb51('0x4f')]);var _0x50da5a={'where':_0x3257ee[_0xcb51('0x49')]};return db[_0xcb51('0x50')]['count'](_0x50da5a)[_0xcb51('0x35')](function(_0x9244d4){_0x5ea12c[_0xcb51('0x2c')]=_0x9244d4;if(_0x5573b2[_0xcb51('0x45')]['includeAll']){_0x3257ee[_0xcb51('0x51')]=[{'all':!![]}];}return db[_0xcb51('0x50')][_0xcb51('0x52')](_0x3257ee);})[_0xcb51('0x35')](function(_0x1b0661){_0x5ea12c[_0xcb51('0x53')]=_0x1b0661;return _0x5ea12c;})[_0xcb51('0x35')](respondWithFilteredResult(_0x21784,_0x3257ee))[_0xcb51('0x28')](handleError(_0x21784,null));};exports[_0xcb51('0x54')]=function(_0x1840f8,_0x2fb8e3){var _0x17160e={'raw':!![],'where':{'id':_0x1840f8[_0xcb51('0x55')]['id']}},_0x370d1d={};_0x370d1d[_0xcb51('0x3f')]=_[_0xcb51('0x40')](db['FaxMessage'][_0xcb51('0x3b')]);_0x370d1d['query']=_[_0xcb51('0x40')](_0x1840f8['query']);_0x370d1d[_0xcb51('0x41')]=_[_0xcb51('0x43')](_0x370d1d[_0xcb51('0x3f')],_0x370d1d[_0xcb51('0x45')]);_0x17160e[_0xcb51('0x42')]=_['intersection'](_0x370d1d[_0xcb51('0x3f')],qs['fields'](_0x1840f8[_0xcb51('0x45')]['fields']));_0x17160e['attributes']=_0x17160e[_0xcb51('0x42')]['length']?_0x17160e[_0xcb51('0x42')]:_0x370d1d[_0xcb51('0x3f')];if(_0x1840f8[_0xcb51('0x45')][_0xcb51('0x56')]){_0x17160e[_0xcb51('0x51')]=[{'all':!![]}];}_0x17160e=_['merge']({},_0x17160e,_0x1840f8['options']);return db[_0xcb51('0x50')][_0xcb51('0x57')](_0x17160e)[_0xcb51('0x35')](handleEntityNotFound(_0x2fb8e3,null))[_0xcb51('0x35')](respondWithResult(_0x2fb8e3,null))[_0xcb51('0x28')](handleError(_0x2fb8e3,null));};exports['update']=function(_0x331e8a,_0x505e50){if(_0x331e8a[_0xcb51('0x58')]['id']){delete _0x331e8a[_0xcb51('0x58')]['id'];}return db[_0xcb51('0x50')][_0xcb51('0x57')]({'where':{'id':_0x331e8a[_0xcb51('0x55')]['id']}})[_0xcb51('0x35')](handleEntityNotFound(_0x505e50,null))[_0xcb51('0x35')](saveUpdates(_0x331e8a[_0xcb51('0x58')],null))[_0xcb51('0x35')](respondWithResult(_0x505e50,null))[_0xcb51('0x28')](handleError(_0x505e50,null));};exports[_0xcb51('0x36')]=function(_0x407dd0,_0x15e78f){return db['FaxMessage'][_0xcb51('0x57')]({'where':{'id':_0x407dd0['params']['id']}})['then'](handleEntityNotFound(_0x15e78f,null))[_0xcb51('0x35')](removeEntity(_0x15e78f,null))['catch'](handleError(_0x15e78f,null));};exports[_0xcb51('0x59')]=function(_0x1d63fc,_0x4306ce){return db[_0xcb51('0x50')]['describe']()[_0xcb51('0x35')](respondWithResult(_0x4306ce,null))[_0xcb51('0x28')](handleError(_0x4306ce,null));};var interaction_log=require(_0xcb51('0x14'))(_0xcb51('0x5a'));exports[_0xcb51('0x5b')]=function(_0x467b23,_0x4832c5,_0x4cda28){var _0x21a6ce={'agent':{},'channel':_0xcb51('0x5c')};if(_0x467b23['body']['id']){delete _0x467b23[_0xcb51('0x58')]['id'];}_0x467b23[_0xcb51('0x58')][_0xcb51('0x5d')]=!![];_0x467b23[_0xcb51('0x58')][_0xcb51('0x5e')]=moment()['format'](_0xcb51('0x5f'));_0x467b23[_0xcb51('0x58')][_0xcb51('0x60')]=_0x467b23[_0xcb51('0x58')]['UserId']||_0x467b23[_0xcb51('0x61')]['id'];_0x21a6ce['agent']['id']=_0x467b23[_0xcb51('0x58')][_0xcb51('0x60')];return db[_0xcb51('0x50')][_0xcb51('0x57')]({'where':{'id':_0x467b23[_0xcb51('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xcb51('0x62')],'as':_0xcb51('0x63')}]})[_0xcb51('0x35')](handleEntityNotFound(_0x4832c5,null))[_0xcb51('0x35')](saveUpdates(_0x467b23[_0xcb51('0x58')],null))[_0xcb51('0x35')](function(_0x564a84){if(_0x564a84){_0x21a6ce['message']=_0x564a84['get']({'plain':!![]});return db[_0xcb51('0x64')][_0xcb51('0x57')]({'where':{'id':_0x564a84[_0xcb51('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x4832c5,null))[_0xcb51('0x35')](function(_0x5e075b){if(_0x5e075b){return _0x5e075b['update']({'UserId':_0x467b23[_0xcb51('0x58')][_0xcb51('0x60')],'read1stAt':_['isNil'](_0x5e075b['read1stAt'])?moment()[_0xcb51('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xcb51('0x35')](function(_0x51c559){if(_0x51c559){_0x21a6ce['interaction']=_0x51c559['get']({'plain':!![]});interaction_log[_0xcb51('0x1f')](_0xcb51('0x67'),_0x467b23['user']['id'],_0x467b23['user'][_0xcb51('0x4d')],_0x467b23[_0xcb51('0x61')]['role'],_0x21a6ce[_0xcb51('0x68')]['id'],_0x467b23[_0xcb51('0x58')]?JSON[_0xcb51('0x24')](_0x467b23[_0xcb51('0x58')]):_0xcb51('0x69'));return respondWithRpcPromise(_0xcb51('0x6a'),_0xcb51('0x6b'),_0x21a6ce);}return null;})['then'](function(_0x15cb2f){if(_0x15cb2f){if(_0x467b23['body'][_0xcb51('0x6c')]){_0x21a6ce[_0xcb51('0x27')][_0xcb51('0x6d')]=util[_0xcb51('0x66')](_0xcb51('0x6e'),_0x467b23[_0xcb51('0x61')][_0xcb51('0x4d')]);_0x21a6ce[_0xcb51('0x27')][_0xcb51('0x6f')]=_0x21a6ce[_0xcb51('0x6f')];_0x21a6ce[_0xcb51('0x27')][_0xcb51('0x70')]=_0xcb51('0x5b');return respondWithRpcPromise(_0xcb51('0x71'),'EventManager',{'event':_0xcb51('0x72'),'message':_0x21a6ce[_0xcb51('0x27')]},client9002)[_0xcb51('0x35')](function(){return _0x21a6ce;});}return _0x21a6ce;}return null;})['then'](respondWithResult(_0x4832c5,null))[_0xcb51('0x28')](handleError(_0x4832c5,null));};var interaction_log=require('../../config/logger')(_0xcb51('0x5a'));exports[_0xcb51('0x32')]=function(_0x4e83ed,_0x348700,_0xa450b9){var _0x348a21={'agent':{},'channel':_0xcb51('0x5c')};if(_0x4e83ed[_0xcb51('0x58')]['id']){delete _0x4e83ed[_0xcb51('0x58')]['id'];}_0x4e83ed[_0xcb51('0x58')]['UserId']=_0x4e83ed[_0xcb51('0x58')][_0xcb51('0x60')]||_0x4e83ed[_0xcb51('0x61')]['id'];_0x348a21[_0xcb51('0x73')]['id']=_0x4e83ed['body'][_0xcb51('0x60')];return db[_0xcb51('0x50')]['find']({'where':{'id':_0x4e83ed['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x348700,null))[_0xcb51('0x35')](function(_0x8743aa){if(_0x8743aa){_0x348a21[_0xcb51('0x27')]=_0x8743aa[_0xcb51('0x74')]({'plain':!![]});return db[_0xcb51('0x64')]['find']({'where':{'id':_0x8743aa[_0xcb51('0x65')]}});}return null;})[_0xcb51('0x35')](handleEntityNotFound(_0x348700,null))['then'](function(_0x45b597){if(_0x45b597){_0x348a21['interaction']=_0x45b597['get']({'plain':!![]});interaction_log[_0xcb51('0x1f')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e83ed['user']['id'],_0x4e83ed[_0xcb51('0x61')][_0xcb51('0x4d')],_0x4e83ed[_0xcb51('0x61')][_0xcb51('0x75')],_0x348a21[_0xcb51('0x68')]['id'],_0x4e83ed['body']?JSON[_0xcb51('0x24')](_0x4e83ed[_0xcb51('0x58')]):_0xcb51('0x69'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x348a21);}return null;})[_0xcb51('0x35')](function(_0x1b5908){if(_0x1b5908){_0x1b5908['message'][_0xcb51('0x6d')]=util['format'](_0xcb51('0x6e'),_0x4e83ed['user'][_0xcb51('0x4d')]);_0x1b5908['message'][_0xcb51('0x6f')]=_0x348a21['channel'];_0x1b5908[_0xcb51('0x27')]['event']='reject';respondWithRpcPromise(_0xcb51('0x71'),_0xcb51('0x71'),{'event':_0xcb51('0x76'),'message':_0x1b5908['message']},client9002);return _0x348a21;}return null;})[_0xcb51('0x35')](respondWithResult(_0x348700,null))['catch'](handleError(_0x348700,null));};exports[_0xcb51('0x77')]=function(_0x262d49,_0x33f18f){var _0x3db9a5;return db['FaxMessage'][_0xcb51('0x77')](_0x262d49[_0xcb51('0x58')],{})[_0xcb51('0x35')](function(_0x20fd77){_0x3db9a5=_0x20fd77;return db[_0xcb51('0x62')][_0xcb51('0x78')]({'where':{'id':_0x3db9a5[_0xcb51('0x79')]}});})[_0xcb51('0x35')](function(_0x41e399){if(_['isNil'](_0x41e399)){return;}else{_0x3db9a5[_0xcb51('0x5c')]=_0x41e399[_0xcb51('0x5c')];return db[_0xcb51('0x7a')][_0xcb51('0x78')]({'where':{'id':_0x3db9a5[_0xcb51('0x7b')]}});}})[_0xcb51('0x35')](function(_0x461fe4){return respondWithRpcPromise(_0xcb51('0x7c'),_0xcb51('0x7c'),{'FaxAccountId':_[_0xcb51('0x7d')](_0x262d49[_0xcb51('0x58')])?undefined:_0x262d49[_0xcb51('0x58')][_0xcb51('0x7e')],'path':_[_0xcb51('0x7d')](_0x461fe4)?undefined:util[_0xcb51('0x66')](_0xcb51('0x7f'),_0x461fe4[_0xcb51('0x80')]),'fax':_['isNil'](_0x3db9a5[_0xcb51('0x5c')])?undefined:_0x3db9a5[_0xcb51('0x5c')],'AttachmentId':_0x3db9a5[_0xcb51('0x7b')]},client9002);})[_0xcb51('0x35')](respondWithResult(_0x33f18f,0xc9))['catch'](handleError(_0x33f18f,null));};exports[_0xcb51('0x81')]=function(_0x2040d7,_0x14a27b){var _0x27ddeb=path['join'](config[_0xcb51('0x82')],_0xcb51('0x83'),_0xcb51('0x84'),_0xcb51('0x85'));return db[_0xcb51('0x50')]['find']({'where':{'id':_0x2040d7[_0xcb51('0x55')]['id']},'include':[{'model':db[_0xcb51('0x7a')],'as':_0xcb51('0x7a')}]})[_0xcb51('0x35')](handleEntityNotFound(_0x14a27b,null))[_0xcb51('0x35')](function(_0x4fc95f){if(_0x4fc95f){return _0x14a27b[_0xcb51('0x81')](path[_0xcb51('0x86')](_0x27ddeb,_0x4fc95f[_0xcb51('0x7a')][_0xcb51('0x80')]));}})[_0xcb51('0x28')](handleError(_0x14a27b,null));}; \ No newline at end of file +var _0x58a7=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','sendStatus','end','count','offset','limit','set','Content-Range','json','status','name','map','FaxMessage','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','params','rawAttributes','length','includeAll','find','update','body','destroy','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','isNil','read1stAt','get','AcceptMessage','interface','SIP/%s','channel','event','EventManager','../../config/logger','fax','FaxInteraction','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','reject','rejectmessage','create','CmContact','findOne','ContactId','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','download','join','server','attachments','basename','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5f1f94,_0x52b739){var _0x286341=function(_0xc8611d){while(--_0xc8611d){_0x5f1f94['push'](_0x5f1f94['shift']());}};_0x286341(++_0x52b739);}(_0x58a7,0x1e7));var _0x758a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x58a7[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x758a('0x0'));var emlformat=require(_0x758a('0x1'));var rimraf=require(_0x758a('0x2'));var zipdir=require(_0x758a('0x3'));var jsonpatch=require(_0x758a('0x4'));var rp=require(_0x758a('0x5'));var moment=require(_0x758a('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x758a('0x7'));var csv=require('to-csv');var ejs=require(_0x758a('0x8'));var fs=require('fs');var fs_extra=require(_0x758a('0x9'));var _=require(_0x758a('0xa'));var squel=require(_0x758a('0xb'));var crypto=require(_0x758a('0xc'));var jsforce=require(_0x758a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x758a('0xe'));var querystring=require(_0x758a('0xf'));var Papa=require(_0x758a('0x10'));var Redis=require(_0x758a('0x11'));var authService=require(_0x758a('0x12'));var qs=require(_0x758a('0x13'));var as=require(_0x758a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x758a('0x15'));var utils=require(_0x758a('0x16'));var config=require(_0x758a('0x17'));var licenseUtil=require(_0x758a('0x18'));var db=require(_0x758a('0x19'))['db'];config[_0x758a('0x1a')]=_[_0x758a('0x1b')](config[_0x758a('0x1a')],{'host':_0x758a('0x1c'),'port':0x18eb});var socket=require(_0x758a('0x1d'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x758a('0x1e')](socket);var jayson=require(_0x758a('0x1f'));var client=jayson[_0x758a('0x20')][_0x758a('0x21')]({'port':0x232c});var client9002=jayson[_0x758a('0x20')][_0x758a('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x405eb3,_0x80b24c,_0x1f075f,_0x469722){return new BPromise(function(_0x469572,_0x175219){var _0x2fb114=_0x469722||client;return _0x2fb114['request'](_0x405eb3,_0x1f075f)[_0x758a('0x22')](function(_0x46b358){logger['info'](_0x758a('0x23'),_0x80b24c,_0x758a('0x24'));logger[_0x758a('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x80b24c,_0x758a('0x24'),JSON[_0x758a('0x26')](_0x46b358));if(_0x46b358['error']){if(_0x46b358['error']['code']===0x1f4){logger[_0x758a('0x27')]('FaxMessage,\x20%s,\x20%s',_0x80b24c,_0x46b358[_0x758a('0x27')][_0x758a('0x28')]);return _0x175219(_0x46b358[_0x758a('0x27')][_0x758a('0x28')]);}logger['error'](_0x758a('0x23'),_0x80b24c,_0x46b358['error']['message']);return _0x469572(_0x46b358[_0x758a('0x27')][_0x758a('0x28')]);}else{logger[_0x758a('0x29')]('FaxMessage,\x20%s,\x20%s',_0x80b24c,_0x758a('0x24'));_0x469572(_0x46b358['result'][_0x758a('0x28')]);}})[_0x758a('0x2a')](function(_0x1c4ad0){logger[_0x758a('0x27')]('FaxMessage,\x20%s,\x20%s',_0x80b24c,_0x1c4ad0);_0x175219(_0x1c4ad0);});});}function respondWithStatusCode(_0x5b538b,_0x39aa9b){_0x39aa9b=_0x39aa9b||0xcc;return function(_0x5e0518){if(_0x5e0518){return _0x5b538b[_0x758a('0x2b')](_0x39aa9b);}return _0x5b538b['status'](_0x39aa9b)[_0x758a('0x2c')]();};}function respondWithResult(_0x33d7fa,_0x410815){_0x410815=_0x410815||0xc8;return function(_0x231003){if(_0x231003){return _0x33d7fa['status'](_0x410815)['json'](_0x231003);}};}function respondWithFilteredResult(_0x84b0,_0x29a0c2){return function(_0x530e9e){if(_0x530e9e){var _0x35db60=_0x530e9e[_0x758a('0x2d')],_0x37ecc3=_0x29a0c2[_0x758a('0x2e')],_0x5dbc5d=_0x29a0c2[_0x758a('0x2e')]+_0x29a0c2[_0x758a('0x2f')],_0x338cc6;if(_0x5dbc5d>=_0x35db60){_0x5dbc5d=_0x35db60;_0x338cc6=0xc8;}else{_0x338cc6=0xce;}_0x84b0['status'](_0x338cc6);return _0x84b0[_0x758a('0x30')](_0x758a('0x31'),_0x37ecc3+'-'+_0x5dbc5d+'/'+_0x35db60)[_0x758a('0x32')](_0x530e9e);}return null;};}function patchUpdates(_0x388e43){return function(_0x2547a3){try{jsonpatch['apply'](_0x2547a3,_0x388e43,!![]);}catch(_0x460271){return BPromise['reject'](_0x460271);}return _0x2547a3['save']();};}function saveUpdates(_0x5664fc,_0x2a820c){return function(_0x4c4a17){if(_0x4c4a17){return _0x4c4a17['update'](_0x5664fc)['then'](function(_0x105115){return _0x105115;});}return null;};}function removeEntity(_0x5048b1,_0x51772f){return function(_0x5ae4c7){if(_0x5ae4c7){return _0x5ae4c7['destroy']()[_0x758a('0x22')](function(){_0x5048b1[_0x758a('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eba3,_0x157ef7){return function(_0x5f25fd){if(!_0x5f25fd){_0x2eba3['sendStatus'](0x194);}return _0x5f25fd;};}function handleError(_0x722a82,_0x1317cd){_0x1317cd=_0x1317cd||0x1f4;return function(_0x4c7a6e){logger[_0x758a('0x27')](_0x4c7a6e['stack']);if(_0x4c7a6e['name']){delete _0x4c7a6e[_0x758a('0x34')];}_0x722a82[_0x758a('0x33')](_0x1317cd)['send'](_0x4c7a6e);};}exports['index']=function(_0x1d8697,_0x39871b){var _0x287271={},_0x4897d0={},_0x29af63={'count':0x0,'rows':[]};var _0x575ba0=_[_0x758a('0x35')](db[_0x758a('0x36')]['rawAttributes'],function(_0x49ea2d){return{'name':_0x49ea2d[_0x758a('0x37')],'type':_0x49ea2d[_0x758a('0x38')][_0x758a('0x39')]};});_0x4897d0['model']=_[_0x758a('0x35')](_0x575ba0,_0x758a('0x34'));_0x4897d0['query']=_[_0x758a('0x3a')](_0x1d8697[_0x758a('0x3b')]);_0x4897d0[_0x758a('0x3c')]=_['intersection'](_0x4897d0[_0x758a('0x3d')],_0x4897d0[_0x758a('0x3b')]);_0x287271[_0x758a('0x3e')]=_[_0x758a('0x3f')](_0x4897d0[_0x758a('0x3d')],qs[_0x758a('0x40')](_0x1d8697['query'][_0x758a('0x40')]));_0x287271['attributes']=_0x287271['attributes']['length']?_0x287271[_0x758a('0x3e')]:_0x4897d0[_0x758a('0x3d')];if(!_0x1d8697['query']['hasOwnProperty'](_0x758a('0x41'))){_0x287271['limit']=qs[_0x758a('0x2f')](_0x1d8697[_0x758a('0x3b')][_0x758a('0x2f')]);_0x287271[_0x758a('0x2e')]=qs['offset'](_0x1d8697['query'][_0x758a('0x2e')]);}_0x287271[_0x758a('0x42')]=qs[_0x758a('0x43')](_0x1d8697['query']['sort']);_0x287271[_0x758a('0x44')]=qs[_0x758a('0x3c')](_['pick'](_0x1d8697['query'],_0x4897d0[_0x758a('0x3c')]),_0x575ba0);if(_0x1d8697['query']['filter']){_0x287271[_0x758a('0x44')]=_['merge'](_0x287271[_0x758a('0x44')],{'$or':_['map'](_0x575ba0,function(_0x23074d){if(_0x23074d[_0x758a('0x38')]!=='VIRTUAL'){var _0x1dd58d={};_0x1dd58d[_0x23074d['name']]={'$like':'%'+_0x1d8697['query'][_0x758a('0x45')]+'%'};return _0x1dd58d;}})});}_0x287271=_[_0x758a('0x46')]({},_0x287271,_0x1d8697[_0x758a('0x47')]);var _0x47df17={'where':_0x287271['where']};return db['FaxMessage'][_0x758a('0x2d')](_0x47df17)[_0x758a('0x22')](function(_0x18c1dd){_0x29af63['count']=_0x18c1dd;if(_0x1d8697[_0x758a('0x3b')]['includeAll']){_0x287271[_0x758a('0x48')]=[{'all':!![]}];}return db[_0x758a('0x36')][_0x758a('0x49')](_0x287271);})['then'](function(_0x235db1){_0x29af63[_0x758a('0x4a')]=_0x235db1;return _0x29af63;})[_0x758a('0x22')](respondWithFilteredResult(_0x39871b,_0x287271))[_0x758a('0x2a')](handleError(_0x39871b,null));};exports['show']=function(_0x431b72,_0x15ac86){var _0x2b977e={'raw':!![],'where':{'id':_0x431b72[_0x758a('0x4b')]['id']}},_0x3c2d07={};_0x3c2d07[_0x758a('0x3d')]=_[_0x758a('0x3a')](db[_0x758a('0x36')][_0x758a('0x4c')]);_0x3c2d07[_0x758a('0x3b')]=_['keys'](_0x431b72['query']);_0x3c2d07[_0x758a('0x3c')]=_[_0x758a('0x3f')](_0x3c2d07[_0x758a('0x3d')],_0x3c2d07[_0x758a('0x3b')]);_0x2b977e[_0x758a('0x3e')]=_[_0x758a('0x3f')](_0x3c2d07[_0x758a('0x3d')],qs[_0x758a('0x40')](_0x431b72[_0x758a('0x3b')][_0x758a('0x40')]));_0x2b977e[_0x758a('0x3e')]=_0x2b977e[_0x758a('0x3e')][_0x758a('0x4d')]?_0x2b977e[_0x758a('0x3e')]:_0x3c2d07[_0x758a('0x3d')];if(_0x431b72[_0x758a('0x3b')][_0x758a('0x4e')]){_0x2b977e['include']=[{'all':!![]}];}_0x2b977e=_[_0x758a('0x46')]({},_0x2b977e,_0x431b72[_0x758a('0x47')]);return db[_0x758a('0x36')][_0x758a('0x4f')](_0x2b977e)[_0x758a('0x22')](handleEntityNotFound(_0x15ac86,null))[_0x758a('0x22')](respondWithResult(_0x15ac86,null))['catch'](handleError(_0x15ac86,null));};exports[_0x758a('0x50')]=function(_0x38d523,_0x16dfd2){if(_0x38d523[_0x758a('0x51')]['id']){delete _0x38d523[_0x758a('0x51')]['id'];}return db[_0x758a('0x36')][_0x758a('0x4f')]({'where':{'id':_0x38d523[_0x758a('0x4b')]['id']}})[_0x758a('0x22')](handleEntityNotFound(_0x16dfd2,null))[_0x758a('0x22')](saveUpdates(_0x38d523['body'],null))[_0x758a('0x22')](respondWithResult(_0x16dfd2,null))[_0x758a('0x2a')](handleError(_0x16dfd2,null));};exports[_0x758a('0x52')]=function(_0x392b50,_0x27c1e1){return db[_0x758a('0x36')]['find']({'where':{'id':_0x392b50[_0x758a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x27c1e1,null))[_0x758a('0x22')](removeEntity(_0x27c1e1,null))[_0x758a('0x2a')](handleError(_0x27c1e1,null));};exports[_0x758a('0x53')]=function(_0x1b130a,_0x2ad4b5){return db[_0x758a('0x36')][_0x758a('0x53')]()[_0x758a('0x22')](respondWithResult(_0x2ad4b5,null))[_0x758a('0x2a')](handleError(_0x2ad4b5,null));};var interaction_log=require('../../config/logger')(_0x758a('0x54'));exports[_0x758a('0x55')]=function(_0x1b0406,_0x1a09f8,_0x3174dc){var _0x4b7d23={'agent':{},'channel':'fax'};if(_0x1b0406[_0x758a('0x51')]['id']){delete _0x1b0406[_0x758a('0x51')]['id'];}_0x1b0406['body'][_0x758a('0x56')]=!![];_0x1b0406[_0x758a('0x51')][_0x758a('0x57')]=moment()[_0x758a('0x58')](_0x758a('0x59'));_0x1b0406['body'][_0x758a('0x5a')]=_0x1b0406[_0x758a('0x51')]['UserId']||_0x1b0406[_0x758a('0x5b')]['id'];_0x4b7d23[_0x758a('0x5c')]['id']=_0x1b0406['body'][_0x758a('0x5a')];return db[_0x758a('0x36')][_0x758a('0x4f')]({'where':{'id':_0x1b0406[_0x758a('0x4b')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x758a('0x5d')}]})[_0x758a('0x22')](handleEntityNotFound(_0x1a09f8,null))[_0x758a('0x22')](saveUpdates(_0x1b0406[_0x758a('0x51')],null))[_0x758a('0x22')](function(_0x42eef8){if(_0x42eef8){_0x4b7d23[_0x758a('0x28')]=_0x42eef8['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x42eef8['FaxInteractionId']}});}return null;})[_0x758a('0x22')](handleEntityNotFound(_0x1a09f8,null))['then'](function(_0x375b70){if(_0x375b70){return _0x375b70['update']({'UserId':_0x1b0406[_0x758a('0x51')][_0x758a('0x5a')],'read1stAt':_[_0x758a('0x5e')](_0x375b70[_0x758a('0x5f')])?moment()[_0x758a('0x58')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x758a('0x22')](function(_0x476b8f){if(_0x476b8f){_0x4b7d23['interaction']=_0x476b8f[_0x758a('0x60')]({'plain':!![]});interaction_log[_0x758a('0x29')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b0406['user']['id'],_0x1b0406[_0x758a('0x5b')][_0x758a('0x34')],_0x1b0406[_0x758a('0x5b')]['role'],_0x4b7d23['interaction']['id'],_0x1b0406['body']?JSON[_0x758a('0x26')](_0x1b0406[_0x758a('0x51')]):'null');return respondWithRpcPromise(_0x758a('0x61'),'acceptMessage',_0x4b7d23);}return null;})['then'](function(_0x7c2e21){if(_0x7c2e21){if(_0x1b0406[_0x758a('0x51')]['manual']){_0x4b7d23[_0x758a('0x28')][_0x758a('0x62')]=util[_0x758a('0x58')](_0x758a('0x63'),_0x1b0406[_0x758a('0x5b')]['name']);_0x4b7d23[_0x758a('0x28')][_0x758a('0x64')]=_0x4b7d23['channel'];_0x4b7d23['message'][_0x758a('0x65')]='accept';return respondWithRpcPromise(_0x758a('0x66'),_0x758a('0x66'),{'event':'acceptmessage','message':_0x4b7d23[_0x758a('0x28')]},client9002)['then'](function(){return _0x4b7d23;});}return _0x4b7d23;}return null;})[_0x758a('0x22')](respondWithResult(_0x1a09f8,null))[_0x758a('0x2a')](handleError(_0x1a09f8,null));};var interaction_log=require(_0x758a('0x67'))(_0x758a('0x54'));exports['reject']=function(_0x5b128a,_0x2385bf,_0x4ed4f7){var _0x183e90={'agent':{},'channel':_0x758a('0x68')};if(_0x5b128a['body']['id']){delete _0x5b128a[_0x758a('0x51')]['id'];}_0x5b128a[_0x758a('0x51')][_0x758a('0x5a')]=_0x5b128a['body']['UserId']||_0x5b128a[_0x758a('0x5b')]['id'];_0x183e90[_0x758a('0x5c')]['id']=_0x5b128a[_0x758a('0x51')]['UserId'];return db[_0x758a('0x36')][_0x758a('0x4f')]({'where':{'id':_0x5b128a[_0x758a('0x4b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2385bf,null))[_0x758a('0x22')](function(_0x521671){if(_0x521671){_0x183e90['message']=_0x521671[_0x758a('0x60')]({'plain':!![]});return db[_0x758a('0x69')]['find']({'where':{'id':_0x521671[_0x758a('0x6a')]}});}return null;})[_0x758a('0x22')](handleEntityNotFound(_0x2385bf,null))[_0x758a('0x22')](function(_0x320abd){if(_0x320abd){_0x183e90['interaction']=_0x320abd[_0x758a('0x60')]({'plain':!![]});interaction_log[_0x758a('0x29')](_0x758a('0x6b'),_0x5b128a['user']['id'],_0x5b128a['user'][_0x758a('0x34')],_0x5b128a[_0x758a('0x5b')][_0x758a('0x6c')],_0x183e90['interaction']['id'],_0x5b128a[_0x758a('0x51')]?JSON[_0x758a('0x26')](_0x5b128a[_0x758a('0x51')]):_0x758a('0x6d'));return respondWithRpcPromise(_0x758a('0x6e'),_0x758a('0x6f'),_0x183e90);}return null;})[_0x758a('0x22')](function(_0x9e4df){if(_0x9e4df){_0x9e4df['message']['interface']=util[_0x758a('0x58')]('SIP/%s',_0x5b128a[_0x758a('0x5b')][_0x758a('0x34')]);_0x9e4df['message'][_0x758a('0x64')]=_0x183e90[_0x758a('0x64')];_0x9e4df[_0x758a('0x28')][_0x758a('0x65')]=_0x758a('0x70');respondWithRpcPromise(_0x758a('0x66'),_0x758a('0x66'),{'event':_0x758a('0x71'),'message':_0x9e4df[_0x758a('0x28')]},client9002);return _0x183e90;}return null;})['then'](respondWithResult(_0x2385bf,null))[_0x758a('0x2a')](handleError(_0x2385bf,null));};exports[_0x758a('0x72')]=function(_0xcd6123,_0xb10fbb){var _0x43aef9;return db['FaxMessage'][_0x758a('0x72')](_0xcd6123[_0x758a('0x51')],{})['then'](function(_0x43f7bc){_0x43aef9=_0x43f7bc;return db[_0x758a('0x73')][_0x758a('0x74')]({'where':{'id':_0x43aef9[_0x758a('0x75')]}});})[_0x758a('0x22')](function(_0x4be255){if(_['isNil'](_0x4be255)){return;}else{_0x43aef9[_0x758a('0x68')]=_0x4be255['fax'];return db[_0x758a('0x76')][_0x758a('0x74')]({'where':{'id':_0x43aef9[_0x758a('0x77')]}});}})[_0x758a('0x22')](function(_0x2819cd){return respondWithRpcPromise(_0x758a('0x78'),_0x758a('0x78'),{'FaxAccountId':_[_0x758a('0x5e')](_0xcd6123[_0x758a('0x51')])?undefined:_0xcd6123['body']['FaxAccountId'],'path':_['isNil'](_0x2819cd)?undefined:util[_0x758a('0x58')](_0x758a('0x79'),_0x2819cd['basename']),'fax':_['isNil'](_0x43aef9[_0x758a('0x68')])?undefined:_0x43aef9[_0x758a('0x68')],'AttachmentId':_0x43aef9[_0x758a('0x77')]},client9002);})[_0x758a('0x22')](respondWithResult(_0xb10fbb,0xc9))[_0x758a('0x2a')](handleError(_0xb10fbb,null));};exports[_0x758a('0x7a')]=function(_0x409049,_0x170c10){var _0xcddb7e=path[_0x758a('0x7b')](config['root'],_0x758a('0x7c'),'files',_0x758a('0x7d'));return db['FaxMessage'][_0x758a('0x4f')]({'where':{'id':_0x409049[_0x758a('0x4b')]['id']},'include':[{'model':db[_0x758a('0x76')],'as':_0x758a('0x76')}]})[_0x758a('0x22')](handleEntityNotFound(_0x170c10,null))[_0x758a('0x22')](function(_0x4c3adf){if(_0x4c3adf){return _0x170c10['download'](path[_0x758a('0x7b')](_0xcddb7e,_0x4c3adf[_0x758a('0x76')][_0x758a('0x7e')]));}})['catch'](handleError(_0x170c10,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 5424366..26cac42 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 _0x3e74=['hasOwnProperty','exports','events','FaxMessage','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x4a1b3f,_0x4f28d5){_0x4a1b3f=_0x4a1b3f-0x0;var _0x50c860=_0x3e74[_0x4a1b3f];return _0x50c860;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x43e7('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){FaxMessageEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);FaxMessageEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x5fc3,0xa8));var _0x35fc=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0x5fc3[_0x25fc41];return _0x1371d1;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var FaxMessage=require(_0x35fc('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){FaxMessageEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);FaxMessageEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 32f577d..d62adfc 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 _0x43e0=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','define','FaxMessage','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','findOne','FaxInteractionId','then','update','catch','error','utf8mb4_unicode_ci','lodash'];(function(_0x1bfe44,_0x4e410e){var _0x1103cb=function(_0x1e850e){while(--_0x1e850e){_0x1bfe44['push'](_0x1bfe44['shift']());}};_0x1103cb(++_0x4e410e);}(_0x43e0,0x16b));var _0x043e=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x43e0[_0x1b6186];return _0x186121;};'use strict';var _=require(_0x043e('0x0'));var util=require(_0x043e('0x1'));var logger=require(_0x043e('0x2'))(_0x043e('0x3'));var moment=require(_0x043e('0x4'));var BPromise=require(_0x043e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x043e('0x6'));var rimraf=require('rimraf');var config=require(_0x043e('0x7'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0xd22665,_0x45e08e){return _0xd22665[_0x043e('0x8')](_0x043e('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x043e('0xa'),'fields':[_0x043e('0xb')],'type':_0x043e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x52764f,_0x514451,_0x7a70a7){var _0x41ea38=_0xd22665['models'];var _0x81bb54=_0x52764f[_0x043e('0xd')]({'plain':!![]});if(_0x81bb54[_0x043e('0xe')][_0x043e('0xf')]()==='in'||_0x81bb54['direction'][_0x043e('0xf')]()===_0x043e('0x10')&&!_0x81bb54[_0x043e('0x11')]&&!_['isNil'](_0x81bb54[_0x043e('0x12')])){_0x41ea38['FaxInteraction'][_0x043e('0x13')]({'where':{'id':_0x81bb54[_0x043e('0x14')]}})[_0x043e('0x15')](function(_0x13c06c){if(_0x13c06c){_0x13c06c[_0x043e('0x16')]({'lastMsgAt':_0x81bb54['createdAt'],'lastMsgDirection':_0x81bb54[_0x043e('0xe')][_0x043e('0xf')]()});}})[_0x043e('0x17')](function(_0x45ef11){console[_0x043e('0x18')](_0x45ef11);});}_0x7a70a7();}},'charset':'utf8mb4','collate':_0x043e('0x19')});}; \ No newline at end of file +var _0xa432=['findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction'];(function(_0x3993f0,_0x40c90e){var _0x4545d9=function(_0x2c6b8a){while(--_0x2c6b8a){_0x3993f0['push'](_0x3993f0['shift']());}};_0x4545d9(++_0x40c90e);}(_0xa432,0xc1));var _0x2a43=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xa432[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x2a43('0x0'));var util=require(_0x2a43('0x1'));var logger=require(_0x2a43('0x2'))(_0x2a43('0x3'));var moment=require(_0x2a43('0x4'));var BPromise=require(_0x2a43('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a43('0x6'));var rimraf=require(_0x2a43('0x7'));var config=require(_0x2a43('0x8'));var attributes=require(_0x2a43('0x9'));module['exports']=function(_0x2632a4,_0x5b18e0){return _0x2632a4[_0x2a43('0xa')](_0x2a43('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x2a43('0xc'),'fields':[_0x2a43('0xd')],'type':_0x2a43('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22505a,_0x372d6c,_0xeffe48){var _0x499d72=_0x2632a4[_0x2a43('0xf')];var _0x4527a4=_0x22505a[_0x2a43('0x10')]({'plain':!![]});if(_0x4527a4[_0x2a43('0x11')][_0x2a43('0x12')]()==='in'||_0x4527a4[_0x2a43('0x11')][_0x2a43('0x12')]()===_0x2a43('0x13')&&!_0x4527a4[_0x2a43('0x14')]&&!_[_0x2a43('0x15')](_0x4527a4[_0x2a43('0x16')])){_0x499d72[_0x2a43('0x17')][_0x2a43('0x18')]({'where':{'id':_0x4527a4[_0x2a43('0x19')]}})[_0x2a43('0x1a')](function(_0xa042cd){if(_0xa042cd){_0xa042cd[_0x2a43('0x1b')]({'lastMsgAt':_0x4527a4[_0x2a43('0x1c')],'lastMsgDirection':_0x4527a4[_0x2a43('0x11')][_0x2a43('0x12')]()});}})[_0x2a43('0x1d')](function(_0x203ed2){console['error'](_0x203ed2);});}_0xeffe48();}},'charset':'utf8mb4','collate':_0x2a43('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 23d37a4..07e126e 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 _0x24d1=['localhost','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','UpdateFaxMessage','body','where','attributes','limit','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','redis','defaults'];(function(_0x18201c,_0x24399f){var _0xdcbc4=function(_0x48046c){while(--_0x48046c){_0x18201c['push'](_0x18201c['shift']());}};_0xdcbc4(++_0x24399f);}(_0x24d1,0x141));var _0x124d=function(_0x4e8440,_0x561ab4){_0x4e8440=_0x4e8440-0x0;var _0x21fcf2=_0x24d1[_0x4e8440];return _0x21fcf2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x124d('0x0'));var BPromise=require(_0x124d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x124d('0x2'));var db=require(_0x124d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x124d('0x4'));var config=require('../../config/environment');var jayson=require(_0x124d('0x5'));var client=jayson[_0x124d('0x6')]['http']({'port':0x232a});config[_0x124d('0x7')]=_[_0x124d('0x8')](config[_0x124d('0x7')],{'host':_0x124d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x124d('0xa'))[_0x124d('0xb')](socket);function respondWithRpcPromise(_0x175ddb,_0x5b1ddb,_0x154cbb){return new BPromise(function(_0x21fc14,_0x5f325c){return client['request'](_0x175ddb,_0x154cbb)[_0x124d('0xc')](function(_0x55121d){logger['info'](_0x124d('0xd'),_0x5b1ddb,'request\x20sent');logger[_0x124d('0xe')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5b1ddb,_0x124d('0xf'),JSON[_0x124d('0x10')](_0x55121d));if(_0x55121d[_0x124d('0x11')]){if(_0x55121d[_0x124d('0x11')][_0x124d('0x12')]===0x1f4){logger[_0x124d('0x11')](_0x124d('0xd'),_0x5b1ddb,_0x55121d[_0x124d('0x11')][_0x124d('0x13')]);return _0x5f325c(_0x55121d[_0x124d('0x11')][_0x124d('0x13')]);}logger[_0x124d('0x11')](_0x124d('0xd'),_0x5b1ddb,_0x55121d[_0x124d('0x11')][_0x124d('0x13')]);return _0x21fc14(_0x55121d[_0x124d('0x11')][_0x124d('0x13')]);}else{logger[_0x124d('0x14')](_0x124d('0xd'),_0x5b1ddb,_0x124d('0xf'));_0x21fc14(_0x55121d[_0x124d('0x15')]['message']);}})[_0x124d('0x16')](function(_0xac0428){logger[_0x124d('0x11')](_0x124d('0xd'),_0x5b1ddb,_0xac0428);_0x5f325c(_0xac0428);});});}exports[_0x124d('0x17')]=function(_0x36e7fb){var _0xbdff4=this;return new Promise(function(_0x5c37d2,_0x5578a1){return db[_0x124d('0x18')][_0x124d('0x19')](_0x36e7fb['body'],{'raw':_0x36e7fb[_0x124d('0x1a')]?_0x36e7fb[_0x124d('0x1a')][_0x124d('0x1b')]===undefined?!![]:![]:!![]})[_0x124d('0xc')](function(_0x584165){logger[_0x124d('0x14')](_0x124d('0x17'),_0x36e7fb);logger[_0x124d('0xe')](_0x124d('0x17'),_0x36e7fb,JSON['stringify'](_0x584165));_0x5c37d2(_0x584165);})[_0x124d('0x16')](function(_0x45e558){logger[_0x124d('0x11')](_0x124d('0x17'),_0x45e558[_0x124d('0x13')],_0x36e7fb);_0x5578a1(_0xbdff4[_0x124d('0x11')](0x1f4,_0x45e558[_0x124d('0x13')]));});});};exports[_0x124d('0x1c')]=function(_0x1fe1e3){var _0x1cd9aa=this;return new Promise(function(_0x2514f7,_0x4e0048){return db['FaxMessage']['update'](_0x1fe1e3[_0x124d('0x1d')],{'raw':_0x1fe1e3['options']?_0x1fe1e3[_0x124d('0x1a')][_0x124d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fe1e3[_0x124d('0x1a')]?_0x1fe1e3['options'][_0x124d('0x1e')]||null:null,'attributes':_0x1fe1e3[_0x124d('0x1a')]?_0x1fe1e3[_0x124d('0x1a')][_0x124d('0x1f')]||null:null,'limit':_0x1fe1e3[_0x124d('0x1a')]?_0x1fe1e3[_0x124d('0x1a')][_0x124d('0x20')]||null:null})[_0x124d('0xc')](function(_0x22ad40){logger[_0x124d('0x14')]('UpdateFaxMessage',_0x1fe1e3);logger[_0x124d('0xe')](_0x124d('0x1c'),_0x1fe1e3,JSON[_0x124d('0x10')](_0x22ad40));_0x2514f7(_0x22ad40);})['catch'](function(_0x2496df){logger[_0x124d('0x11')]('UpdateFaxMessage',_0x2496df['message'],_0x1fe1e3);_0x4e0048(_0x1cd9aa[_0x124d('0x11')](0x1f4,_0x2496df['message']));});});}; \ No newline at end of file +var _0xb55e=['catch','CreateFaxMessage','FaxMessage','create','body','options','update','raw','UpdateFaxMessage','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x965463,_0xe13ed0){var _0x376361=function(_0x5cd5c1){while(--_0x5cd5c1){_0x965463['push'](_0x965463['shift']());}};_0x376361(++_0xe13ed0);}(_0xb55e,0x17f));var _0xeb55=function(_0x349d3e,_0x38254c){_0x349d3e=_0x349d3e-0x0;var _0x5d9024=_0xb55e[_0x349d3e];return _0x5d9024;};'use strict';var _=require(_0xeb55('0x0'));var util=require(_0xeb55('0x1'));var moment=require('moment');var BPromise=require(_0xeb55('0x2'));var rs=require(_0xeb55('0x3'));var fs=require('fs');var Redis=require(_0xeb55('0x4'));var db=require(_0xeb55('0x5'))['db'];var utils=require(_0xeb55('0x6'));var logger=require(_0xeb55('0x7'))(_0xeb55('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeb55('0x9')][_0xeb55('0xa')]({'port':0x232a});config[_0xeb55('0xb')]=_[_0xeb55('0xc')](config[_0xeb55('0xb')],{'host':_0xeb55('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb55('0xb')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x298a98,_0x498751,_0x3effa6){return new BPromise(function(_0xe26c66,_0x258bd3){return client[_0xeb55('0xe')](_0x298a98,_0x3effa6)[_0xeb55('0xf')](function(_0x925249){logger[_0xeb55('0x10')](_0xeb55('0x11'),_0x498751,_0xeb55('0x12'));logger[_0xeb55('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x498751,_0xeb55('0x12'),JSON[_0xeb55('0x14')](_0x925249));if(_0x925249[_0xeb55('0x15')]){if(_0x925249[_0xeb55('0x15')][_0xeb55('0x16')]===0x1f4){logger[_0xeb55('0x15')]('FaxMessage,\x20%s,\x20%s',_0x498751,_0x925249[_0xeb55('0x15')][_0xeb55('0x17')]);return _0x258bd3(_0x925249['error'][_0xeb55('0x17')]);}logger[_0xeb55('0x15')](_0xeb55('0x11'),_0x498751,_0x925249[_0xeb55('0x15')]['message']);return _0xe26c66(_0x925249[_0xeb55('0x15')][_0xeb55('0x17')]);}else{logger[_0xeb55('0x10')](_0xeb55('0x11'),_0x498751,_0xeb55('0x12'));_0xe26c66(_0x925249[_0xeb55('0x18')][_0xeb55('0x17')]);}})[_0xeb55('0x19')](function(_0x8576a6){logger['error']('FaxMessage,\x20%s,\x20%s',_0x498751,_0x8576a6);_0x258bd3(_0x8576a6);});});}exports[_0xeb55('0x1a')]=function(_0x103a68){var _0x31d111=this;return new Promise(function(_0x789662,_0x5ba3cf){return db[_0xeb55('0x1b')][_0xeb55('0x1c')](_0x103a68[_0xeb55('0x1d')],{'raw':_0x103a68[_0xeb55('0x1e')]?_0x103a68[_0xeb55('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xeb55('0xf')](function(_0x54dd80){logger[_0xeb55('0x10')](_0xeb55('0x1a'),_0x103a68);logger[_0xeb55('0x13')](_0xeb55('0x1a'),_0x103a68,JSON[_0xeb55('0x14')](_0x54dd80));_0x789662(_0x54dd80);})[_0xeb55('0x19')](function(_0x23ecc8){logger[_0xeb55('0x15')](_0xeb55('0x1a'),_0x23ecc8['message'],_0x103a68);_0x5ba3cf(_0x31d111[_0xeb55('0x15')](0x1f4,_0x23ecc8[_0xeb55('0x17')]));});});};exports['UpdateFaxMessage']=function(_0x33e019){var _0x17786c=this;return new Promise(function(_0x21992d,_0x461cc8){return db['FaxMessage'][_0xeb55('0x1f')](_0x33e019[_0xeb55('0x1d')],{'raw':_0x33e019['options']?_0x33e019[_0xeb55('0x1e')][_0xeb55('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33e019[_0xeb55('0x1e')]?_0x33e019[_0xeb55('0x1e')]['where']||null:null,'attributes':_0x33e019[_0xeb55('0x1e')]?_0x33e019[_0xeb55('0x1e')]['attributes']||null:null,'limit':_0x33e019[_0xeb55('0x1e')]?_0x33e019[_0xeb55('0x1e')]['limit']||null:null})[_0xeb55('0xf')](function(_0x26c21c){logger[_0xeb55('0x10')](_0xeb55('0x21'),_0x33e019);logger[_0xeb55('0x13')]('UpdateFaxMessage',_0x33e019,JSON['stringify'](_0x26c21c));_0x21992d(_0x26c21c);})['catch'](function(_0x15ab08){logger[_0xeb55('0x15')](_0xeb55('0x21'),_0x15ab08[_0xeb55('0x17')],_0x33e019);_0x461cc8(_0x17786c[_0xeb55('0x15')](0x1f4,_0x15ab08[_0xeb55('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b92e411..c6e5487 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 _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var FaxMessageEvents=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(){FaxMessageEvents[_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);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ad6aed1..438535d 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 _0xa600=['show','/:id/download','download','post','tracked','faxmessage:create','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa600,0xa9));var _0x0a60=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0xa600[_0x13cab0];return _0x38804f;};'use strict';var multer=require(_0x0a60('0x0'));var util=require(_0x0a60('0x1'));var path=require(_0x0a60('0x2'));var timeout=require(_0x0a60('0x3'));var express=require(_0x0a60('0x4'));var router=express[_0x0a60('0x5')]();var fs_extra=require(_0x0a60('0x6'));var auth=require(_0x0a60('0x7'));var interaction=require(_0x0a60('0x8'));var config=require(_0x0a60('0x9'));var controller=require(_0x0a60('0xa'));router[_0x0a60('0xb')]('/',auth[_0x0a60('0xc')](),controller[_0x0a60('0xd')]);router[_0x0a60('0xb')](_0x0a60('0xe'),auth[_0x0a60('0xc')](),controller[_0x0a60('0xf')]);router['get'](_0x0a60('0x10'),auth['isAuthenticated'](),controller[_0x0a60('0x11')]);router[_0x0a60('0xb')](_0x0a60('0x12'),auth[_0x0a60('0xc')](),controller[_0x0a60('0x13')]);router[_0x0a60('0x14')]('/',auth['isAuthenticated'](),interaction[_0x0a60('0x15')]('fax',_0x0a60('0x16')),controller['create']);router['put']('/:id',auth[_0x0a60('0xc')](),controller[_0x0a60('0x17')]);router[_0x0a60('0x18')](_0x0a60('0x19'),auth[_0x0a60('0xc')](),controller[_0x0a60('0x1a')]);router[_0x0a60('0x18')](_0x0a60('0x1b'),auth[_0x0a60('0xc')](),controller[_0x0a60('0x1c')]);router[_0x0a60('0x1d')]('/:id',auth[_0x0a60('0xc')](),controller['destroy']);module[_0x0a60('0x1e')]=router; \ No newline at end of file +var _0x92e1=['/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','isAuthenticated','index','get','describe','/:id','show','download','post','tracked','faxmessage:create','create','put','update'];(function(_0x3e8527,_0x390be2){var _0x1a43da=function(_0x3975c9){while(--_0x3975c9){_0x3e8527['push'](_0x3e8527['shift']());}};_0x1a43da(++_0x390be2);}(_0x92e1,0xa8));var _0x192e=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x92e1[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0x192e('0x0'));var util=require(_0x192e('0x1'));var path=require(_0x192e('0x2'));var timeout=require(_0x192e('0x3'));var express=require('express');var router=express[_0x192e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x192e('0x5'));var interaction=require(_0x192e('0x6'));var config=require('../../config/environment');var controller=require(_0x192e('0x7'));router['get']('/',auth[_0x192e('0x8')](),controller[_0x192e('0x9')]);router[_0x192e('0xa')]('/describe',auth[_0x192e('0x8')](),controller[_0x192e('0xb')]);router[_0x192e('0xa')](_0x192e('0xc'),auth[_0x192e('0x8')](),controller[_0x192e('0xd')]);router['get']('/:id/download',auth[_0x192e('0x8')](),controller[_0x192e('0xe')]);router[_0x192e('0xf')]('/',auth[_0x192e('0x8')](),interaction[_0x192e('0x10')]('fax',_0x192e('0x11')),controller[_0x192e('0x12')]);router[_0x192e('0x13')]('/:id',auth[_0x192e('0x8')](),controller[_0x192e('0x14')]);router['put'](_0x192e('0x15'),auth['isAuthenticated'](),controller[_0x192e('0x16')]);router['put'](_0x192e('0x17'),auth[_0x192e('0x8')](),controller[_0x192e('0x18')]);router['delete'](_0x192e('0xc'),auth[_0x192e('0x8')](),controller[_0x192e('0x19')]);module[_0x192e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a264e85..547c3d1 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 _0xa68b=['roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x31c44d,_0x4d5b35){var _0x871f2a=function(_0x25fb1d){while(--_0x25fb1d){_0x31c44d['push'](_0x31c44d['shift']());}};_0x871f2a(++_0x4d5b35);}(_0xa68b,0xf6));var _0xba68=function(_0x292423,_0x1759b7){_0x292423=_0x292423-0x0;var _0x2801cb=_0xa68b[_0x292423];return _0x2801cb;};'use strict';var Sequelize=require('sequelize');module[_0xba68('0x0')]={'name':{'type':Sequelize[_0xba68('0x1')],'unique':_0xba68('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xba68('0x1')]},'timeout':{'type':Sequelize[_0xba68('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xba68('0x4')](_0xba68('0x5'),'beepall',_0xba68('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xba68('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc092=['STRING','name','INTEGER','roundrobin','exports'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0xc092,0x171));var _0x2c09=function(_0x54006d,_0x304eb7){_0x54006d=_0x54006d-0x0;var _0x3b7a53=_0xc092[_0x54006d];return _0x3b7a53;};'use strict';var Sequelize=require('sequelize');module[_0x2c09('0x0')]={'name':{'type':Sequelize[_0x2c09('0x1')],'unique':_0x2c09('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2c09('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0x2c09('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 05f372a..2eb66a7 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 _0x3fec=['removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','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','describe','getMembers','findOne','UserFaxQueue','nolimit','FaxQueueId','User','findAndCountAll','agent','faxPause','updatedAt','rows','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','every','TeamId','includes','all','union','compact','removeTeams','isEmpty'];(function(_0x226dce,_0x5ca412){var _0x2f0ff6=function(_0x3acb16){while(--_0x3acb16){_0x226dce['push'](_0x226dce['shift']());}};_0x2f0ff6(++_0x5ca412);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fec[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xc3fe('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3fe('0x1'));var jsonpatch=require(_0xc3fe('0x2'));var rp=require('request-promise');var moment=require(_0xc3fe('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc3fe('0x4'));var path=require('path');var sox=require(_0xc3fe('0x5'));var csv=require(_0xc3fe('0x6'));var ejs=require(_0xc3fe('0x7'));var fs=require('fs');var fs_extra=require(_0xc3fe('0x8'));var _=require(_0xc3fe('0x9'));var squel=require(_0xc3fe('0xa'));var crypto=require(_0xc3fe('0xb'));var jsforce=require(_0xc3fe('0xc'));var deskjs=require(_0xc3fe('0xd'));var toCsv=require(_0xc3fe('0x6'));var querystring=require(_0xc3fe('0xe'));var Papa=require(_0xc3fe('0xf'));var Redis=require(_0xc3fe('0x10'));var authService=require(_0xc3fe('0x11'));var qs=require(_0xc3fe('0x12'));var as=require(_0xc3fe('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3fe('0x14'))(_0xc3fe('0x15'));var utils=require('../../config/utils');var config=require(_0xc3fe('0x16'));var licenseUtil=require(_0xc3fe('0x17'));var db=require(_0xc3fe('0x18'))['db'];config[_0xc3fe('0x19')]=_[_0xc3fe('0x1a')](config[_0xc3fe('0x19')],{'host':_0xc3fe('0x1b'),'port':0x18eb});var socket=require(_0xc3fe('0x1c'))(new Redis(config[_0xc3fe('0x19')]));require(_0xc3fe('0x1d'))['register'](socket);function respondWithStatusCode(_0x400476,_0x531fa5){_0x531fa5=_0x531fa5||0xcc;return function(_0x10091c){if(_0x10091c){return _0x400476[_0xc3fe('0x1e')](_0x531fa5);}return _0x400476[_0xc3fe('0x1f')](_0x531fa5)[_0xc3fe('0x20')]();};}function respondWithResult(_0x17edb6,_0x39705c){_0x39705c=_0x39705c||0xc8;return function(_0x1e291f){if(_0x1e291f){return _0x17edb6[_0xc3fe('0x1f')](_0x39705c)[_0xc3fe('0x21')](_0x1e291f);}};}function respondWithFilteredResult(_0x8d0835,_0x376fff){return function(_0x442fbd){if(_0x442fbd){var _0x423447=_0x442fbd[_0xc3fe('0x22')],_0x31d639=_0x376fff[_0xc3fe('0x23')],_0x3a86f2=_0x376fff[_0xc3fe('0x23')]+_0x376fff['limit'],_0x5ea00d;if(_0x3a86f2>=_0x423447){_0x3a86f2=_0x423447;_0x5ea00d=0xc8;}else{_0x5ea00d=0xce;}_0x8d0835[_0xc3fe('0x1f')](_0x5ea00d);return _0x8d0835[_0xc3fe('0x24')]('Content-Range',_0x31d639+'-'+_0x3a86f2+'/'+_0x423447)['json'](_0x442fbd);}return null;};}function patchUpdates(_0x3333ad){return function(_0x434eb8){try{jsonpatch[_0xc3fe('0x25')](_0x434eb8,_0x3333ad,!![]);}catch(_0x574efd){return BPromise[_0xc3fe('0x26')](_0x574efd);}return _0x434eb8[_0xc3fe('0x27')]();};}function saveUpdates(_0x3f9418,_0x3c0ac4){return function(_0x2a6635){if(_0x2a6635){return _0x2a6635[_0xc3fe('0x28')](_0x3f9418)[_0xc3fe('0x29')](function(_0x6b57a6){return _0x6b57a6;});}return null;};}function removeEntity(_0x2c4727,_0x30657f){return function(_0x3b4423){if(_0x3b4423){return _0x3b4423[_0xc3fe('0x2a')]()['then'](function(){var _0x3220e7=_0x3b4423[_0xc3fe('0x2b')]({'plain':!![]});var _0x1d3c16=_0xc3fe('0x2c');return db[_0xc3fe('0x2d')]['destroy']({'where':{'type':_0x1d3c16,'resourceId':_0x3220e7['id']}})[_0xc3fe('0x29')](function(){return _0x3b4423;});})[_0xc3fe('0x29')](function(){_0x2c4727[_0xc3fe('0x1f')](0xcc)[_0xc3fe('0x20')]();});}};}function handleEntityNotFound(_0x820b7f,_0xaa64ad){return function(_0x2dac90){if(!_0x2dac90){_0x820b7f[_0xc3fe('0x1e')](0x194);}return _0x2dac90;};}function handleError(_0xa74edf,_0xd2b14d){_0xd2b14d=_0xd2b14d||0x1f4;return function(_0x391167){logger[_0xc3fe('0x2e')](_0x391167[_0xc3fe('0x2f')]);if(_0x391167[_0xc3fe('0x30')]){delete _0x391167[_0xc3fe('0x30')];}_0xa74edf[_0xc3fe('0x1f')](_0xd2b14d)[_0xc3fe('0x31')](_0x391167);};}exports[_0xc3fe('0x32')]=function(_0x5ac845,_0x1e8a38){var _0x19d353={},_0x4658c5={},_0x246621={'count':0x0,'rows':[]};var _0x11a44e=_[_0xc3fe('0x33')](db[_0xc3fe('0x34')][_0xc3fe('0x35')],function(_0x6fe063){return{'name':_0x6fe063[_0xc3fe('0x36')],'type':_0x6fe063[_0xc3fe('0x37')]['key']};});_0x4658c5['model']=_['map'](_0x11a44e,_0xc3fe('0x30'));_0x4658c5[_0xc3fe('0x38')]=_['keys'](_0x5ac845[_0xc3fe('0x38')]);_0x4658c5[_0xc3fe('0x39')]=_['intersection'](_0x4658c5['model'],_0x4658c5[_0xc3fe('0x38')]);_0x19d353[_0xc3fe('0x3a')]=_[_0xc3fe('0x3b')](_0x4658c5[_0xc3fe('0x3c')],qs['fields'](_0x5ac845['query'][_0xc3fe('0x3d')]));_0x19d353[_0xc3fe('0x3a')]=_0x19d353[_0xc3fe('0x3a')][_0xc3fe('0x3e')]?_0x19d353['attributes']:_0x4658c5[_0xc3fe('0x3c')];if(!_0x5ac845['query'][_0xc3fe('0x3f')]('nolimit')){_0x19d353[_0xc3fe('0x40')]=qs[_0xc3fe('0x40')](_0x5ac845['query'][_0xc3fe('0x40')]);_0x19d353[_0xc3fe('0x23')]=qs['offset'](_0x5ac845[_0xc3fe('0x38')]['offset']);}_0x19d353[_0xc3fe('0x41')]=qs[_0xc3fe('0x42')](_0x5ac845[_0xc3fe('0x38')][_0xc3fe('0x42')]);_0x19d353[_0xc3fe('0x43')]=qs['filters'](_[_0xc3fe('0x44')](_0x5ac845[_0xc3fe('0x38')],_0x4658c5[_0xc3fe('0x39')]),_0x11a44e);if(_0x5ac845[_0xc3fe('0x38')][_0xc3fe('0x45')]){_0x19d353[_0xc3fe('0x43')]=_[_0xc3fe('0x46')](_0x19d353['where'],{'$or':_[_0xc3fe('0x33')](_0x11a44e,function(_0xfc37e3){if(_0xfc37e3[_0xc3fe('0x37')]!==_0xc3fe('0x47')){var _0x587c96={};_0x587c96[_0xfc37e3[_0xc3fe('0x30')]]={'$like':'%'+_0x5ac845[_0xc3fe('0x38')]['filter']+'%'};return _0x587c96;}})});}_0x19d353=_['merge']({},_0x19d353,_0x5ac845[_0xc3fe('0x48')]);var _0x59c596={'where':_0x19d353['where']};return db[_0xc3fe('0x34')][_0xc3fe('0x22')](_0x59c596)[_0xc3fe('0x29')](function(_0x16f11b){_0x246621['count']=_0x16f11b;if(_0x5ac845[_0xc3fe('0x38')][_0xc3fe('0x49')]){_0x19d353[_0xc3fe('0x4a')]=[{'all':!![]}];}return db['FaxQueue'][_0xc3fe('0x4b')](_0x19d353);})[_0xc3fe('0x29')](function(_0x2f8117){_0x246621['rows']=_0x2f8117;return _0x246621;})['then'](respondWithFilteredResult(_0x1e8a38,_0x19d353))['catch'](handleError(_0x1e8a38,null));};exports[_0xc3fe('0x4c')]=function(_0x1530ff,_0xb0777){var _0x271a4a={'raw':!![],'where':{'id':_0x1530ff[_0xc3fe('0x4d')]['id']}},_0x159148={};_0x159148[_0xc3fe('0x3c')]=_['keys'](db[_0xc3fe('0x34')][_0xc3fe('0x35')]);_0x159148[_0xc3fe('0x38')]=_[_0xc3fe('0x4e')](_0x1530ff[_0xc3fe('0x38')]);_0x159148[_0xc3fe('0x39')]=_['intersection'](_0x159148[_0xc3fe('0x3c')],_0x159148[_0xc3fe('0x38')]);_0x271a4a[_0xc3fe('0x3a')]=_[_0xc3fe('0x3b')](_0x159148[_0xc3fe('0x3c')],qs[_0xc3fe('0x3d')](_0x1530ff[_0xc3fe('0x38')][_0xc3fe('0x3d')]));_0x271a4a[_0xc3fe('0x3a')]=_0x271a4a[_0xc3fe('0x3a')]['length']?_0x271a4a[_0xc3fe('0x3a')]:_0x159148[_0xc3fe('0x3c')];if(_0x1530ff[_0xc3fe('0x38')][_0xc3fe('0x49')]){_0x271a4a[_0xc3fe('0x4a')]=[{'all':!![]}];}_0x271a4a=_[_0xc3fe('0x46')]({},_0x271a4a,_0x1530ff[_0xc3fe('0x48')]);return db[_0xc3fe('0x34')][_0xc3fe('0x4f')](_0x271a4a)[_0xc3fe('0x29')](handleEntityNotFound(_0xb0777,null))[_0xc3fe('0x29')](respondWithResult(_0xb0777,null))[_0xc3fe('0x50')](handleError(_0xb0777,null));};exports[_0xc3fe('0x51')]=function(_0x91221e,_0x5cee33){return db[_0xc3fe('0x34')][_0xc3fe('0x51')](_0x91221e[_0xc3fe('0x52')],{})['then'](function(_0x1700e9){var _0x1b3e53=_0x91221e[_0xc3fe('0x53')][_0xc3fe('0x2b')]({'plain':!![]});if(!_0x1b3e53)throw new Error(_0xc3fe('0x54'));if(_0x1b3e53['role']==='user'){var _0x25eef3=_0x1700e9[_0xc3fe('0x2b')]({'plain':!![]});var _0x5efdba=_0xc3fe('0x2c');return db[_0xc3fe('0x55')]['find']({'where':{'name':_0x5efdba,'userProfileId':_0x1b3e53[_0xc3fe('0x56')]},'raw':!![]})[_0xc3fe('0x29')](function(_0x109911){if(_0x109911&&_0x109911[_0xc3fe('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x25eef3[_0xc3fe('0x30')],'resourceId':_0x25eef3['id'],'type':_0x109911[_0xc3fe('0x30')],'sectionId':_0x109911['id']},{})[_0xc3fe('0x29')](function(){return _0x1700e9;});}else{return _0x1700e9;}})['catch'](function(_0x1a491b){logger[_0xc3fe('0x2e')](_0xc3fe('0x58'),_0x1a491b);throw _0x1a491b;});}return _0x1700e9;})['then'](respondWithResult(_0x5cee33,0xc9))[_0xc3fe('0x50')](handleError(_0x5cee33,null));};exports[_0xc3fe('0x28')]=function(_0x5caf49,_0x228482){if(_0x5caf49[_0xc3fe('0x52')]['id']){delete _0x5caf49[_0xc3fe('0x52')]['id'];}return db[_0xc3fe('0x34')][_0xc3fe('0x4f')]({'where':{'id':_0x5caf49[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](handleEntityNotFound(_0x228482,null))[_0xc3fe('0x29')](saveUpdates(_0x5caf49[_0xc3fe('0x52')],null))['then'](respondWithResult(_0x228482,null))[_0xc3fe('0x50')](handleError(_0x228482,null));};exports['destroy']=function(_0x3d6045,_0x2f6e28){return db['FaxQueue'][_0xc3fe('0x4f')]({'where':{'id':_0x3d6045[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](handleEntityNotFound(_0x2f6e28,null))['then'](removeEntity(_0x2f6e28,null))[_0xc3fe('0x50')](handleError(_0x2f6e28,null));};exports[_0xc3fe('0x59')]=function(_0x13dc16,_0x591007){return db[_0xc3fe('0x34')][_0xc3fe('0x59')]()[_0xc3fe('0x29')](respondWithResult(_0x591007,null))[_0xc3fe('0x50')](handleError(_0x591007,null));};exports[_0xc3fe('0x5a')]=function(_0x398edb,_0x35f07a,_0x5caf99){var _0x11e5bf={'raw':!![],'where':{}},_0x224d97={},_0x1ab9c8;return db[_0xc3fe('0x34')][_0xc3fe('0x5b')]({'where':{'id':_0x398edb[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](handleEntityNotFound(_0x35f07a,null))[_0xc3fe('0x29')](function(_0x43adb4){if(_0x43adb4){_0x1ab9c8=_0x43adb4[_0xc3fe('0x2b')]({'plain':!![]});_0x224d97[_0xc3fe('0x3c')]=_['keys'](db[_0xc3fe('0x5c')][_0xc3fe('0x35')]);_0x224d97['query']=_[_0xc3fe('0x4e')](_0x398edb['query']);_0x224d97[_0xc3fe('0x39')]=_[_0xc3fe('0x3b')](_0x224d97[_0xc3fe('0x3c')],_0x224d97[_0xc3fe('0x38')]);_0x11e5bf[_0xc3fe('0x3a')]=_['intersection'](_0x224d97[_0xc3fe('0x3c')],qs['fields'](_0x398edb[_0xc3fe('0x38')]['fields']));_0x11e5bf[_0xc3fe('0x3a')]=_0x11e5bf[_0xc3fe('0x3a')]['length']?_0x11e5bf[_0xc3fe('0x3a')]:_0x224d97[_0xc3fe('0x3c')];if(!_0x398edb[_0xc3fe('0x38')][_0xc3fe('0x3f')](_0xc3fe('0x5d'))){_0x11e5bf[_0xc3fe('0x40')]=qs[_0xc3fe('0x40')](_0x398edb[_0xc3fe('0x38')]['limit']);_0x11e5bf[_0xc3fe('0x23')]=qs[_0xc3fe('0x23')](_0x398edb[_0xc3fe('0x38')][_0xc3fe('0x23')]);}_0x11e5bf['order']=qs['sort'](_0x398edb[_0xc3fe('0x38')][_0xc3fe('0x42')]);_0x11e5bf[_0xc3fe('0x43')]=qs[_0xc3fe('0x39')](_[_0xc3fe('0x44')](_0x398edb[_0xc3fe('0x38')],_0x224d97[_0xc3fe('0x39')]));_0x11e5bf[_0xc3fe('0x43')][_0xc3fe('0x5e')]=_0x43adb4['id'];if(_0x398edb['query'][_0xc3fe('0x45')]){_0x11e5bf[_0xc3fe('0x43')]=_[_0xc3fe('0x46')](_0x11e5bf['where'],{'$or':_[_0xc3fe('0x33')](_0x11e5bf[_0xc3fe('0x3a')],function(_0x22e05f){var _0x1ffcdf={};_0x1ffcdf[_0x22e05f]={'$like':'%'+_0x398edb[_0xc3fe('0x38')][_0xc3fe('0x45')]+'%'};return _0x1ffcdf;})});}_0x11e5bf=_[_0xc3fe('0x46')]({},_0x11e5bf,_0x398edb[_0xc3fe('0x48')]);return db[_0xc3fe('0x5c')][_0xc3fe('0x4b')](_0x11e5bf);}})[_0xc3fe('0x29')](function(_0x432e09){if(_0x432e09){return db[_0xc3fe('0x5f')][_0xc3fe('0x60')]({'where':{'id':_['map'](_0x432e09,'UserId'),'role':_0xc3fe('0x61')},'attributes':['id','name',_0xc3fe('0x62'),_0xc3fe('0x63'),'createdAt']});}})[_0xc3fe('0x29')](function(_0x48abcb){if(_0x48abcb){return{'count':_0x48abcb[_0xc3fe('0x22')],'rows':_['map'](_0x48abcb[_0xc3fe('0x64')],function(_0x13f3c4){return{'membername':_0x13f3c4['name'],'UserId':_0x13f3c4['id'],'queue_name':_0x1ab9c8[_0xc3fe('0x30')],'FaxQueueId':_0x1ab9c8['id'],'interface':util[_0xc3fe('0x65')](_0xc3fe('0x66'),_0xc3fe('0x67'),_0x13f3c4['name']),'penalty':0x0,'paused':_0x13f3c4[_0xc3fe('0x62')],'createdAt':_0x13f3c4['createdAt'],'updatedAt':_0x13f3c4[_0xc3fe('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc3fe('0x29')](respondWithFilteredResult(_0x35f07a,_0x11e5bf))['catch'](handleError(_0x35f07a,null));};exports[_0xc3fe('0x68')]=function(_0x365e1a,_0x4969f3,_0x2a8f70){var _0xbf8386={};var _0x37c877={};var _0x2ea2b6;var _0x3e8f0;return db['FaxQueue'][_0xc3fe('0x5b')]({'where':{'id':_0x365e1a[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](handleEntityNotFound(_0x4969f3,null))['then'](function(_0xf2fe30){if(_0xf2fe30){_0x2ea2b6=_0xf2fe30;_0x37c877['model']=_[_0xc3fe('0x4e')](db['Team']['rawAttributes']);_0x37c877['query']=_['keys'](_0x365e1a['query']);_0x37c877[_0xc3fe('0x39')]=_[_0xc3fe('0x3b')](_0x37c877[_0xc3fe('0x3c')],_0x37c877[_0xc3fe('0x38')]);_0xbf8386['attributes']=_['intersection'](_0x37c877[_0xc3fe('0x3c')],qs[_0xc3fe('0x3d')](_0x365e1a[_0xc3fe('0x38')][_0xc3fe('0x3d')]));_0xbf8386[_0xc3fe('0x3a')]=_0xbf8386[_0xc3fe('0x3a')][_0xc3fe('0x3e')]?_0xbf8386[_0xc3fe('0x3a')]:_0x37c877[_0xc3fe('0x3c')];_0xbf8386['order']=qs[_0xc3fe('0x42')](_0x365e1a[_0xc3fe('0x38')][_0xc3fe('0x42')]);_0xbf8386['where']=qs[_0xc3fe('0x39')](_[_0xc3fe('0x44')](_0x365e1a[_0xc3fe('0x38')],_0x37c877[_0xc3fe('0x39')]));if(_0x365e1a['query'][_0xc3fe('0x45')]){_0xbf8386[_0xc3fe('0x43')]=_['merge'](_0xbf8386['where'],{'$or':_[_0xc3fe('0x33')](_0xbf8386['attributes'],function(_0x3d33c3){var _0x5b1c65={};_0x5b1c65[_0x3d33c3]={'$like':'%'+_0x365e1a[_0xc3fe('0x38')]['filter']+'%'};return _0x5b1c65;})});}_0xbf8386=_[_0xc3fe('0x46')]({},_0xbf8386,_0x365e1a[_0xc3fe('0x48')]);return _0x2ea2b6[_0xc3fe('0x68')](_0xbf8386);}})[_0xc3fe('0x29')](function(_0x65d2c){if(_0x65d2c){_0x3e8f0=_0x65d2c['length'];if(!_0x365e1a[_0xc3fe('0x38')]['hasOwnProperty']('nolimit')){_0xbf8386['limit']=qs['limit'](_0x365e1a['query'][_0xc3fe('0x40')]);_0xbf8386[_0xc3fe('0x23')]=qs[_0xc3fe('0x23')](_0x365e1a[_0xc3fe('0x38')][_0xc3fe('0x23')]);}return _0x2ea2b6[_0xc3fe('0x68')](_0xbf8386);}})[_0xc3fe('0x29')](function(_0xede06a){if(_0xede06a){return _0xede06a?{'count':_0x3e8f0,'rows':_0xede06a}:null;}})['then'](respondWithResult(_0x4969f3,null))[_0xc3fe('0x50')](handleError(_0x4969f3,null));};exports[_0xc3fe('0x69')]=function(_0xbdb269,_0x594ca0,_0x76befc){var _0x3174bb=_0xbdb269[_0xc3fe('0x52')][_0xc3fe('0x6a')];return db[_0xc3fe('0x6b')]['findAll']({'where':{'id':_0x3174bb},'attributes':['id'],'include':[{'model':db[_0xc3fe('0x5f')],'as':_0xc3fe('0x6c'),'attributes':['id',_0xc3fe('0x30'),_0xc3fe('0x6d'),_0xc3fe('0x6e'),_0xc3fe('0x6f')],'raw':!![]}]})['then'](function(_0x365503){if(_0x365503){var _0x5c33de=_['flatMap'](_0x365503,function(_0x12a482){var _0x1bba5f=_0x12a482[_0xc3fe('0x2b')]({'plain':!![]});return _0x1bba5f['Agents'];});return db[_0xc3fe('0x34')]['find']({'where':{'id':_0xbdb269[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](function(_0x442c41){return db['sequelize'][_0xc3fe('0x70')](function(_0x2d24b5){return _0x442c41[_0xc3fe('0x69')](_0x3174bb,{'transaction':_0x2d24b5})['then'](function(){return BPromise[_0xc3fe('0x71')](_0x5c33de,function(_0x381edb){return db['UserFaxQueue'][_0xc3fe('0x72')]({'where':{'UserId':_0x381edb['id'],'FaxQueueId':_0xbdb269[_0xc3fe('0x4d')]['id']},'transaction':_0x2d24b5});});})['then'](function(){_0x5c33de[_0xc3fe('0x73')](function(_0xf65acb){socket[_0xc3fe('0x74')](_0xc3fe('0x75'),{'UserId':_0xf65acb['id'],'FaxQueueId':_0x442c41['id']});});});});});}})[_0xc3fe('0x29')](respondWithStatusCode(_0x594ca0,null))[_0xc3fe('0x50')](handleError(_0x594ca0,null));};exports['removeTeams']=function(_0x267e54,_0x149ea6,_0x37161d){return db[_0xc3fe('0x6b')][_0xc3fe('0x4b')]({'where':{'id':_0x267e54[_0xc3fe('0x38')][_0xc3fe('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xc3fe('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc3fe('0x29')](handleEntityNotFound(_0x149ea6,null))[_0xc3fe('0x29')](function(_0x53dd2d){var _0x10c297=_[_0xc3fe('0x33')](_0x53dd2d,'id');var _0x4e1b78=[];var _0x15f1f5=[];var _0x18fa65=squel[_0xc3fe('0x76')]();_0x18fa65[_0xc3fe('0x77')](_0xc3fe('0x78'))['from'](_0xc3fe('0x79'),'tq')[_0xc3fe('0x7a')](_0xc3fe('0x7b'),'ut',_0xc3fe('0x7c'))[_0xc3fe('0x43')](_0xc3fe('0x7d'),_0x267e54['params']['id']);for(var _0x408569=0x0;_0x408569<_0x53dd2d['length'];_0x408569+=0x1){let _0x535b2d=_0x53dd2d[_0x408569];for(var _0x50180d=0x0;_0x50180d<_0x535b2d[_0xc3fe('0x6c')][_0xc3fe('0x3e')];_0x50180d+=0x1){let _0x4fef1c=_0x535b2d[_0xc3fe('0x6c')][_0x50180d];var _0xb17034=_0x18fa65['clone']();_0xb17034[_0xc3fe('0x43')](_0xc3fe('0x7e'),_0x4fef1c['id']);_0x15f1f5[_0xc3fe('0x7f')](db[_0xc3fe('0x80')][_0xc3fe('0x38')](_0xb17034[_0xc3fe('0x81')](),{'type':db[_0xc3fe('0x80')]['QueryTypes']['SELECT']})[_0xc3fe('0x29')](function(_0x52bbaa){if(_0x52bbaa[_0xc3fe('0x3e')]===0x1){return _0x4fef1c['id'];}else{var _0x255164=_[_0xc3fe('0x82')](_[_0xc3fe('0x33')](_0x52bbaa,_0xc3fe('0x83')),function(_0x5d1c47){return _[_0xc3fe('0x84')](_0x10c297,_0x5d1c47);});if(_0x255164){return _0x4fef1c['id'];}}}));}}return BPromise[_0xc3fe('0x85')](_0x15f1f5)[_0xc3fe('0x29')](function(_0x2b482b){_0x4e1b78=_(_0x4e1b78)[_0xc3fe('0x86')](_0x2b482b)[_0xc3fe('0x87')]()['value']();return db[_0xc3fe('0x34')][_0xc3fe('0x4f')]({'where':{'id':_0x267e54[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](function(_0x1f01b7){return db[_0xc3fe('0x80')][_0xc3fe('0x70')](function(_0x1d1a6c){return _0x1f01b7[_0xc3fe('0x88')](_0x267e54[_0xc3fe('0x38')]['ids'],{'transaction':_0x1d1a6c})['then'](function(){if(!_[_0xc3fe('0x89')](_0x4e1b78)){return _0x1f01b7[_0xc3fe('0x8a')](_0x4e1b78,{'transaction':_0x1d1a6c});}})[_0xc3fe('0x29')](function(){_0x4e1b78[_0xc3fe('0x73')](function(_0xa5f641){socket['emit'](_0xc3fe('0x8b'),{'UserId':_0xa5f641,'FaxQueueId':_0x1f01b7['id']});});});});});});})[_0xc3fe('0x29')](respondWithStatusCode(_0x149ea6,null))[_0xc3fe('0x50')](handleError(_0x149ea6,null));};exports[_0xc3fe('0x8c')]=function(_0x26bfff,_0x4cf865,_0x9c1439){return db[_0xc3fe('0x34')]['find']({'where':{'id':_0x26bfff['params']['id']}})[_0xc3fe('0x29')](handleEntityNotFound(_0x4cf865,null))[_0xc3fe('0x29')](function(_0x5f2de0){if(_0x5f2de0){return _0x5f2de0[_0xc3fe('0x8c')](_0x26bfff[_0xc3fe('0x52')][_0xc3fe('0x6a')],_[_0xc3fe('0x8d')](_0x26bfff[_0xc3fe('0x52')],[_0xc3fe('0x6a'),'id'])||{})[_0xc3fe('0x8e')](function(_0x10ce79){for(var _0x339e6a=0x0;_0x339e6a<_0x26bfff[_0xc3fe('0x52')]['ids']['length'];_0x339e6a+=0x1){socket['emit']('userFaxQueue:save',{'UserId':_0x26bfff[_0xc3fe('0x52')][_0xc3fe('0x6a')][_0x339e6a],'FaxQueueId':_0x26bfff[_0xc3fe('0x4d')]['id']});}return _0x10ce79;});}})[_0xc3fe('0x29')](respondWithResult(_0x4cf865,null))[_0xc3fe('0x50')](handleError(_0x4cf865,null));};exports['removeAgents']=function(_0x21ebeb,_0x12c82c,_0x56f819){return db[_0xc3fe('0x34')][_0xc3fe('0x4f')]({'where':{'id':_0x21ebeb[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](handleEntityNotFound(_0x12c82c,null))[_0xc3fe('0x29')](function(_0x44eaa8){if(_0x44eaa8){return _0x44eaa8[_0xc3fe('0x8a')](_0x21ebeb['query'][_0xc3fe('0x6a')])['then'](function(){if(_[_0xc3fe('0x8f')](_0x21ebeb['query'][_0xc3fe('0x6a')])){for(var _0x48faac=0x0;_0x48faac<_0x21ebeb[_0xc3fe('0x38')][_0xc3fe('0x6a')][_0xc3fe('0x3e')];_0x48faac+=0x1){socket[_0xc3fe('0x74')](_0xc3fe('0x8b'),{'UserId':Number(_0x21ebeb[_0xc3fe('0x38')]['ids'][_0x48faac]),'FaxQueueId':Number(_0x21ebeb['params']['id'])});}}else{socket[_0xc3fe('0x74')](_0xc3fe('0x8b'),{'UserId':Number(_0x21ebeb[_0xc3fe('0x38')][_0xc3fe('0x6a')]),'FaxQueueId':Number(_0x21ebeb[_0xc3fe('0x4d')]['id'])});}});}})[_0xc3fe('0x29')](respondWithStatusCode(_0x12c82c,null))[_0xc3fe('0x50')](handleError(_0x12c82c,null));};exports['getAgents']=function(_0x1048ba,_0x30791f,_0x138967){var _0x565e26={};var _0x49514c={};var _0xbc717;var _0x5cf48a;return db[_0xc3fe('0x34')][_0xc3fe('0x5b')]({'where':{'id':_0x1048ba[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](handleEntityNotFound(_0x30791f,null))[_0xc3fe('0x29')](function(_0x465f49){if(_0x465f49){_0xbc717=_0x465f49;_0x49514c['model']=_[_0xc3fe('0x4e')](db[_0xc3fe('0x5f')][_0xc3fe('0x35')]);_0x49514c[_0xc3fe('0x38')]=_['keys'](_0x1048ba['query']);_0x49514c[_0xc3fe('0x39')]=_[_0xc3fe('0x3b')](_0x49514c[_0xc3fe('0x3c')],_0x49514c[_0xc3fe('0x38')]);_0x565e26[_0xc3fe('0x3a')]=_[_0xc3fe('0x3b')](_0x49514c['model'],qs['fields'](_0x1048ba[_0xc3fe('0x38')]['fields']));_0x565e26[_0xc3fe('0x3a')]=_0x565e26[_0xc3fe('0x3a')][_0xc3fe('0x3e')]?_0x565e26[_0xc3fe('0x3a')]:_0x49514c[_0xc3fe('0x3c')];_0x565e26['order']=qs[_0xc3fe('0x42')](_0x1048ba[_0xc3fe('0x38')][_0xc3fe('0x42')]);_0x565e26[_0xc3fe('0x43')]=qs[_0xc3fe('0x39')](_[_0xc3fe('0x44')](_0x1048ba['query'],_0x49514c[_0xc3fe('0x39')]));if(_0x1048ba[_0xc3fe('0x38')][_0xc3fe('0x45')]){_0x565e26[_0xc3fe('0x43')]=_[_0xc3fe('0x46')](_0x565e26[_0xc3fe('0x43')],{'$or':_[_0xc3fe('0x33')](_0x565e26['attributes'],function(_0x27a964){var _0x75d97b={};_0x75d97b[_0x27a964]={'$like':'%'+_0x1048ba['query']['filter']+'%'};return _0x75d97b;})});}_0x565e26=_['merge']({},_0x565e26,_0x1048ba['options']);return _0xbc717[_0xc3fe('0x90')](_0x565e26);}})[_0xc3fe('0x29')](function(_0x361e01){if(_0x361e01){_0x5cf48a=_0x361e01[_0xc3fe('0x3e')];if(!_0x1048ba[_0xc3fe('0x38')][_0xc3fe('0x3f')]('nolimit')){_0x565e26[_0xc3fe('0x40')]=qs[_0xc3fe('0x40')](_0x1048ba[_0xc3fe('0x38')][_0xc3fe('0x40')]);_0x565e26[_0xc3fe('0x23')]=qs['offset'](_0x1048ba[_0xc3fe('0x38')]['offset']);}return _0xbc717['getAgents'](_0x565e26);}})[_0xc3fe('0x29')](function(_0x5a4d05){if(_0x5a4d05){return _0x5a4d05?{'count':_0x5cf48a,'rows':_0x5a4d05}:null;}})['then'](respondWithResult(_0x30791f,null))['catch'](handleError(_0x30791f,null));}; \ No newline at end of file +var _0x99e9=['updatedAt','getTeams','findOne','rawAttributes','addTeams','ids','Team','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','toString','SELECT','TeamId','all','union','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','status','end','count','limit','set','json','apply','reject','save','update','destroy','then','get','FaxQueues','UserProfileResource','sendStatus','error','stack','name','send','index','FaxQueue','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','length','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserFaxQueue','hasOwnProperty','offset','sort','FaxQueueId','agent','faxPause','createdAt','format','%s/%s'];(function(_0x4786cd,_0x22f9e2){var _0x471385=function(_0xe6d34b){while(--_0xe6d34b){_0x4786cd['push'](_0x4786cd['shift']());}};_0x471385(++_0x22f9e2);}(_0x99e9,0xb4));var _0x999e=function(_0x288325,_0x26e4ff){_0x288325=_0x288325-0x0;var _0x3b9fd7=_0x99e9[_0x288325];return _0x3b9fd7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x999e('0x0'));var rimraf=require(_0x999e('0x1'));var zipdir=require(_0x999e('0x2'));var jsonpatch=require(_0x999e('0x3'));var rp=require('request-promise');var moment=require(_0x999e('0x4'));var BPromise=require(_0x999e('0x5'));var Mustache=require(_0x999e('0x6'));var util=require('util');var path=require(_0x999e('0x7'));var sox=require('sox');var csv=require(_0x999e('0x8'));var ejs=require(_0x999e('0x9'));var fs=require('fs');var fs_extra=require(_0x999e('0xa'));var _=require(_0x999e('0xb'));var squel=require('squel');var crypto=require(_0x999e('0xc'));var jsforce=require(_0x999e('0xd'));var deskjs=require(_0x999e('0xe'));var toCsv=require(_0x999e('0x8'));var querystring=require(_0x999e('0xf'));var Papa=require(_0x999e('0x10'));var Redis=require(_0x999e('0x11'));var authService=require(_0x999e('0x12'));var qs=require(_0x999e('0x13'));var as=require(_0x999e('0x14'));var hardwareService=require(_0x999e('0x15'));var logger=require(_0x999e('0x16'))(_0x999e('0x17'));var utils=require(_0x999e('0x18'));var config=require(_0x999e('0x19'));var licenseUtil=require(_0x999e('0x1a'));var db=require(_0x999e('0x1b'))['db'];config['redis']=_[_0x999e('0x1c')](config['redis'],{'host':_0x999e('0x1d'),'port':0x18eb});var socket=require(_0x999e('0x1e'))(new Redis(config[_0x999e('0x1f')]));require('./faxQueue.socket')[_0x999e('0x20')](socket);function respondWithStatusCode(_0x4d1716,_0xa44e4c){_0xa44e4c=_0xa44e4c||0xcc;return function(_0x539598){if(_0x539598){return _0x4d1716['sendStatus'](_0xa44e4c);}return _0x4d1716[_0x999e('0x21')](_0xa44e4c)[_0x999e('0x22')]();};}function respondWithResult(_0x2dd5f4,_0x289e0e){_0x289e0e=_0x289e0e||0xc8;return function(_0x1e9bff){if(_0x1e9bff){return _0x2dd5f4[_0x999e('0x21')](_0x289e0e)['json'](_0x1e9bff);}};}function respondWithFilteredResult(_0x5bb27e,_0x4fcdfb){return function(_0x3153ce){if(_0x3153ce){var _0x43b09e=_0x3153ce[_0x999e('0x23')],_0xc4ef74=_0x4fcdfb['offset'],_0x302f52=_0x4fcdfb['offset']+_0x4fcdfb[_0x999e('0x24')],_0x229673;if(_0x302f52>=_0x43b09e){_0x302f52=_0x43b09e;_0x229673=0xc8;}else{_0x229673=0xce;}_0x5bb27e[_0x999e('0x21')](_0x229673);return _0x5bb27e[_0x999e('0x25')]('Content-Range',_0xc4ef74+'-'+_0x302f52+'/'+_0x43b09e)[_0x999e('0x26')](_0x3153ce);}return null;};}function patchUpdates(_0x42e167){return function(_0x3b73f0){try{jsonpatch[_0x999e('0x27')](_0x3b73f0,_0x42e167,!![]);}catch(_0x373b80){return BPromise[_0x999e('0x28')](_0x373b80);}return _0x3b73f0[_0x999e('0x29')]();};}function saveUpdates(_0x4d4474,_0x54ad83){return function(_0x11a6bf){if(_0x11a6bf){return _0x11a6bf[_0x999e('0x2a')](_0x4d4474)['then'](function(_0x452acd){return _0x452acd;});}return null;};}function removeEntity(_0xe324d8,_0x3f548e){return function(_0x13027c){if(_0x13027c){return _0x13027c[_0x999e('0x2b')]()[_0x999e('0x2c')](function(){var _0x4f8406=_0x13027c[_0x999e('0x2d')]({'plain':!![]});var _0x4199ff=_0x999e('0x2e');return db[_0x999e('0x2f')][_0x999e('0x2b')]({'where':{'type':_0x4199ff,'resourceId':_0x4f8406['id']}})[_0x999e('0x2c')](function(){return _0x13027c;});})[_0x999e('0x2c')](function(){_0xe324d8['status'](0xcc)[_0x999e('0x22')]();});}};}function handleEntityNotFound(_0x5ba8b0,_0x4fed13){return function(_0x3dff6b){if(!_0x3dff6b){_0x5ba8b0[_0x999e('0x30')](0x194);}return _0x3dff6b;};}function handleError(_0x1f89f2,_0x555ca0){_0x555ca0=_0x555ca0||0x1f4;return function(_0x1ea0e4){logger[_0x999e('0x31')](_0x1ea0e4[_0x999e('0x32')]);if(_0x1ea0e4[_0x999e('0x33')]){delete _0x1ea0e4[_0x999e('0x33')];}_0x1f89f2[_0x999e('0x21')](_0x555ca0)[_0x999e('0x34')](_0x1ea0e4);};}exports[_0x999e('0x35')]=function(_0x27102b,_0x3ddacb){var _0x53ece1={},_0x1c8feb={},_0x1cd206={'count':0x0,'rows':[]};var _0x371613=_['map'](db[_0x999e('0x36')]['rawAttributes'],function(_0x5dce40){return{'name':_0x5dce40[_0x999e('0x37')],'type':_0x5dce40[_0x999e('0x38')]['key']};});_0x1c8feb['model']=_[_0x999e('0x39')](_0x371613,_0x999e('0x33'));_0x1c8feb[_0x999e('0x3a')]=_[_0x999e('0x3b')](_0x27102b['query']);_0x1c8feb[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x1c8feb[_0x999e('0x3e')],_0x1c8feb[_0x999e('0x3a')]);_0x53ece1['attributes']=_['intersection'](_0x1c8feb[_0x999e('0x3e')],qs['fields'](_0x27102b[_0x999e('0x3a')][_0x999e('0x3f')]));_0x53ece1[_0x999e('0x40')]=_0x53ece1[_0x999e('0x40')]['length']?_0x53ece1[_0x999e('0x40')]:_0x1c8feb[_0x999e('0x3e')];if(!_0x27102b['query']['hasOwnProperty'](_0x999e('0x41'))){_0x53ece1['limit']=qs[_0x999e('0x24')](_0x27102b['query']['limit']);_0x53ece1['offset']=qs['offset'](_0x27102b[_0x999e('0x3a')]['offset']);}_0x53ece1[_0x999e('0x42')]=qs['sort'](_0x27102b['query']['sort']);_0x53ece1[_0x999e('0x43')]=qs[_0x999e('0x3c')](_[_0x999e('0x44')](_0x27102b[_0x999e('0x3a')],_0x1c8feb[_0x999e('0x3c')]),_0x371613);if(_0x27102b[_0x999e('0x3a')][_0x999e('0x45')]){_0x53ece1[_0x999e('0x43')]=_['merge'](_0x53ece1[_0x999e('0x43')],{'$or':_[_0x999e('0x39')](_0x371613,function(_0x1e1229){if(_0x1e1229[_0x999e('0x38')]!=='VIRTUAL'){var _0x141358={};_0x141358[_0x1e1229['name']]={'$like':'%'+_0x27102b[_0x999e('0x3a')][_0x999e('0x45')]+'%'};return _0x141358;}})});}_0x53ece1=_[_0x999e('0x46')]({},_0x53ece1,_0x27102b[_0x999e('0x47')]);var _0x49ddb8={'where':_0x53ece1[_0x999e('0x43')]};return db[_0x999e('0x36')][_0x999e('0x23')](_0x49ddb8)['then'](function(_0x58dfb2){_0x1cd206[_0x999e('0x23')]=_0x58dfb2;if(_0x27102b[_0x999e('0x3a')][_0x999e('0x48')]){_0x53ece1[_0x999e('0x49')]=[{'all':!![]}];}return db[_0x999e('0x36')][_0x999e('0x4a')](_0x53ece1);})[_0x999e('0x2c')](function(_0x417086){_0x1cd206[_0x999e('0x4b')]=_0x417086;return _0x1cd206;})[_0x999e('0x2c')](respondWithFilteredResult(_0x3ddacb,_0x53ece1))['catch'](handleError(_0x3ddacb,null));};exports['show']=function(_0xa5742d,_0x30a60d){var _0x27ea5c={'raw':!![],'where':{'id':_0xa5742d[_0x999e('0x4c')]['id']}},_0xd37b6e={};_0xd37b6e[_0x999e('0x3e')]=_['keys'](db[_0x999e('0x36')]['rawAttributes']);_0xd37b6e['query']=_[_0x999e('0x3b')](_0xa5742d['query']);_0xd37b6e['filters']=_['intersection'](_0xd37b6e['model'],_0xd37b6e[_0x999e('0x3a')]);_0x27ea5c[_0x999e('0x40')]=_['intersection'](_0xd37b6e[_0x999e('0x3e')],qs[_0x999e('0x3f')](_0xa5742d[_0x999e('0x3a')]['fields']));_0x27ea5c['attributes']=_0x27ea5c[_0x999e('0x40')][_0x999e('0x4d')]?_0x27ea5c[_0x999e('0x40')]:_0xd37b6e['model'];if(_0xa5742d['query']['includeAll']){_0x27ea5c['include']=[{'all':!![]}];}_0x27ea5c=_[_0x999e('0x46')]({},_0x27ea5c,_0xa5742d['options']);return db['FaxQueue'][_0x999e('0x4e')](_0x27ea5c)[_0x999e('0x2c')](handleEntityNotFound(_0x30a60d,null))['then'](respondWithResult(_0x30a60d,null))[_0x999e('0x4f')](handleError(_0x30a60d,null));};exports[_0x999e('0x50')]=function(_0x5603a8,_0x2aa072){return db['FaxQueue'][_0x999e('0x50')](_0x5603a8[_0x999e('0x51')],{})['then'](function(_0x210f1e){var _0xdc94ea=_0x5603a8['user']['get']({'plain':!![]});if(!_0xdc94ea)throw new Error(_0x999e('0x52'));if(_0xdc94ea['role']==='user'){var _0x4de2e8=_0x210f1e[_0x999e('0x2d')]({'plain':!![]});var _0x3b2023=_0x999e('0x2e');return db[_0x999e('0x53')][_0x999e('0x4e')]({'where':{'name':_0x3b2023,'userProfileId':_0xdc94ea[_0x999e('0x54')]},'raw':!![]})['then'](function(_0x14f8de){if(_0x14f8de&&_0x14f8de[_0x999e('0x55')]===0x0){return db['UserProfileResource'][_0x999e('0x50')]({'name':_0x4de2e8[_0x999e('0x33')],'resourceId':_0x4de2e8['id'],'type':_0x14f8de[_0x999e('0x33')],'sectionId':_0x14f8de['id']},{})[_0x999e('0x2c')](function(){return _0x210f1e;});}else{return _0x210f1e;}})[_0x999e('0x4f')](function(_0x334d19){logger[_0x999e('0x31')](_0x999e('0x56'),_0x334d19);throw _0x334d19;});}return _0x210f1e;})[_0x999e('0x2c')](respondWithResult(_0x2aa072,0xc9))['catch'](handleError(_0x2aa072,null));};exports[_0x999e('0x2a')]=function(_0x45b61a,_0x39ae4b){if(_0x45b61a[_0x999e('0x51')]['id']){delete _0x45b61a['body']['id'];}return db[_0x999e('0x36')][_0x999e('0x4e')]({'where':{'id':_0x45b61a[_0x999e('0x4c')]['id']}})[_0x999e('0x2c')](handleEntityNotFound(_0x39ae4b,null))[_0x999e('0x2c')](saveUpdates(_0x45b61a[_0x999e('0x51')],null))[_0x999e('0x2c')](respondWithResult(_0x39ae4b,null))[_0x999e('0x4f')](handleError(_0x39ae4b,null));};exports['destroy']=function(_0x56368e,_0xd118f9){return db[_0x999e('0x36')][_0x999e('0x4e')]({'where':{'id':_0x56368e[_0x999e('0x4c')]['id']}})[_0x999e('0x2c')](handleEntityNotFound(_0xd118f9,null))[_0x999e('0x2c')](removeEntity(_0xd118f9,null))[_0x999e('0x4f')](handleError(_0xd118f9,null));};exports['describe']=function(_0x5579c4,_0xb9d60b){return db[_0x999e('0x36')][_0x999e('0x57')]()[_0x999e('0x2c')](respondWithResult(_0xb9d60b,null))[_0x999e('0x4f')](handleError(_0xb9d60b,null));};exports['getMembers']=function(_0x10f82f,_0x1e7ad2,_0x30a49d){var _0x3c8ecf={'raw':!![],'where':{}},_0x502c9={},_0x434e13;return db[_0x999e('0x36')]['findOne']({'where':{'id':_0x10f82f[_0x999e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1e7ad2,null))[_0x999e('0x2c')](function(_0x43217e){if(_0x43217e){_0x434e13=_0x43217e[_0x999e('0x2d')]({'plain':!![]});_0x502c9[_0x999e('0x3e')]=_[_0x999e('0x3b')](db[_0x999e('0x58')]['rawAttributes']);_0x502c9[_0x999e('0x3a')]=_[_0x999e('0x3b')](_0x10f82f[_0x999e('0x3a')]);_0x502c9[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x502c9[_0x999e('0x3e')],_0x502c9[_0x999e('0x3a')]);_0x3c8ecf[_0x999e('0x40')]=_[_0x999e('0x3d')](_0x502c9[_0x999e('0x3e')],qs[_0x999e('0x3f')](_0x10f82f[_0x999e('0x3a')][_0x999e('0x3f')]));_0x3c8ecf[_0x999e('0x40')]=_0x3c8ecf[_0x999e('0x40')]['length']?_0x3c8ecf[_0x999e('0x40')]:_0x502c9[_0x999e('0x3e')];if(!_0x10f82f[_0x999e('0x3a')][_0x999e('0x59')]('nolimit')){_0x3c8ecf['limit']=qs[_0x999e('0x24')](_0x10f82f[_0x999e('0x3a')][_0x999e('0x24')]);_0x3c8ecf[_0x999e('0x5a')]=qs[_0x999e('0x5a')](_0x10f82f[_0x999e('0x3a')][_0x999e('0x5a')]);}_0x3c8ecf[_0x999e('0x42')]=qs[_0x999e('0x5b')](_0x10f82f['query'][_0x999e('0x5b')]);_0x3c8ecf['where']=qs[_0x999e('0x3c')](_[_0x999e('0x44')](_0x10f82f['query'],_0x502c9[_0x999e('0x3c')]));_0x3c8ecf[_0x999e('0x43')][_0x999e('0x5c')]=_0x43217e['id'];if(_0x10f82f[_0x999e('0x3a')][_0x999e('0x45')]){_0x3c8ecf['where']=_[_0x999e('0x46')](_0x3c8ecf[_0x999e('0x43')],{'$or':_['map'](_0x3c8ecf['attributes'],function(_0x47d08c){var _0x43ec04={};_0x43ec04[_0x47d08c]={'$like':'%'+_0x10f82f[_0x999e('0x3a')][_0x999e('0x45')]+'%'};return _0x43ec04;})});}_0x3c8ecf=_[_0x999e('0x46')]({},_0x3c8ecf,_0x10f82f[_0x999e('0x47')]);return db['UserFaxQueue']['findAll'](_0x3c8ecf);}})['then'](function(_0x49293d){if(_0x49293d){return db['User']['findAndCountAll']({'where':{'id':_[_0x999e('0x39')](_0x49293d,'UserId'),'role':_0x999e('0x5d')},'attributes':['id',_0x999e('0x33'),_0x999e('0x5e'),'updatedAt',_0x999e('0x5f')]});}})[_0x999e('0x2c')](function(_0x2ddf00){if(_0x2ddf00){return{'count':_0x2ddf00[_0x999e('0x23')],'rows':_[_0x999e('0x39')](_0x2ddf00[_0x999e('0x4b')],function(_0x259f73){return{'membername':_0x259f73['name'],'UserId':_0x259f73['id'],'queue_name':_0x434e13[_0x999e('0x33')],'FaxQueueId':_0x434e13['id'],'interface':util[_0x999e('0x60')](_0x999e('0x61'),'SIP',_0x259f73[_0x999e('0x33')]),'penalty':0x0,'paused':_0x259f73[_0x999e('0x5e')],'createdAt':_0x259f73['createdAt'],'updatedAt':_0x259f73[_0x999e('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x999e('0x2c')](respondWithFilteredResult(_0x1e7ad2,_0x3c8ecf))[_0x999e('0x4f')](handleError(_0x1e7ad2,null));};exports[_0x999e('0x63')]=function(_0xc02339,_0xd85ed7,_0x42f36f){var _0x28c6b6={};var _0x127812={};var _0x58fb9e;var _0xe27738;return db[_0x999e('0x36')][_0x999e('0x64')]({'where':{'id':_0xc02339['params']['id']}})[_0x999e('0x2c')](handleEntityNotFound(_0xd85ed7,null))['then'](function(_0x14f13a){if(_0x14f13a){_0x58fb9e=_0x14f13a;_0x127812[_0x999e('0x3e')]=_[_0x999e('0x3b')](db['Team'][_0x999e('0x65')]);_0x127812[_0x999e('0x3a')]=_[_0x999e('0x3b')](_0xc02339[_0x999e('0x3a')]);_0x127812[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x127812['model'],_0x127812[_0x999e('0x3a')]);_0x28c6b6['attributes']=_[_0x999e('0x3d')](_0x127812['model'],qs['fields'](_0xc02339[_0x999e('0x3a')]['fields']));_0x28c6b6[_0x999e('0x40')]=_0x28c6b6[_0x999e('0x40')]['length']?_0x28c6b6[_0x999e('0x40')]:_0x127812[_0x999e('0x3e')];_0x28c6b6['order']=qs[_0x999e('0x5b')](_0xc02339[_0x999e('0x3a')][_0x999e('0x5b')]);_0x28c6b6[_0x999e('0x43')]=qs[_0x999e('0x3c')](_[_0x999e('0x44')](_0xc02339[_0x999e('0x3a')],_0x127812[_0x999e('0x3c')]));if(_0xc02339['query']['filter']){_0x28c6b6[_0x999e('0x43')]=_[_0x999e('0x46')](_0x28c6b6[_0x999e('0x43')],{'$or':_[_0x999e('0x39')](_0x28c6b6[_0x999e('0x40')],function(_0x4be2fa){var _0x56dcc0={};_0x56dcc0[_0x4be2fa]={'$like':'%'+_0xc02339[_0x999e('0x3a')][_0x999e('0x45')]+'%'};return _0x56dcc0;})});}_0x28c6b6=_['merge']({},_0x28c6b6,_0xc02339[_0x999e('0x47')]);return _0x58fb9e[_0x999e('0x63')](_0x28c6b6);}})[_0x999e('0x2c')](function(_0x54742b){if(_0x54742b){_0xe27738=_0x54742b[_0x999e('0x4d')];if(!_0xc02339[_0x999e('0x3a')][_0x999e('0x59')]('nolimit')){_0x28c6b6[_0x999e('0x24')]=qs[_0x999e('0x24')](_0xc02339[_0x999e('0x3a')]['limit']);_0x28c6b6['offset']=qs[_0x999e('0x5a')](_0xc02339['query'][_0x999e('0x5a')]);}return _0x58fb9e[_0x999e('0x63')](_0x28c6b6);}})[_0x999e('0x2c')](function(_0x2203f7){if(_0x2203f7){return _0x2203f7?{'count':_0xe27738,'rows':_0x2203f7}:null;}})[_0x999e('0x2c')](respondWithResult(_0xd85ed7,null))[_0x999e('0x4f')](handleError(_0xd85ed7,null));};exports[_0x999e('0x66')]=function(_0x523231,_0x11e5d3,_0x540a9e){var _0x5a65c8=_0x523231[_0x999e('0x51')][_0x999e('0x67')];return db[_0x999e('0x68')][_0x999e('0x4a')]({'where':{'id':_0x5a65c8},'attributes':['id'],'include':[{'model':db[_0x999e('0x69')],'as':_0x999e('0x6a'),'attributes':['id','name',_0x999e('0x6b'),'voicePause',_0x999e('0x6c')],'raw':!![]}]})[_0x999e('0x2c')](function(_0x3f82db){if(_0x3f82db){var _0x55cd53=_[_0x999e('0x6d')](_0x3f82db,function(_0x50fc6b){var _0x1c3448=_0x50fc6b[_0x999e('0x2d')]({'plain':!![]});return _0x1c3448[_0x999e('0x6a')];});return db[_0x999e('0x36')][_0x999e('0x4e')]({'where':{'id':_0x523231['params']['id']}})['then'](function(_0x3f556d){return db[_0x999e('0x6e')][_0x999e('0x6f')](function(_0x283d61){return _0x3f556d[_0x999e('0x66')](_0x5a65c8,{'transaction':_0x283d61})[_0x999e('0x2c')](function(){return BPromise[_0x999e('0x70')](_0x55cd53,function(_0x3c57cb){return db['UserFaxQueue'][_0x999e('0x71')]({'where':{'UserId':_0x3c57cb['id'],'FaxQueueId':_0x523231[_0x999e('0x4c')]['id']},'transaction':_0x283d61});});})[_0x999e('0x2c')](function(){_0x55cd53[_0x999e('0x72')](function(_0xfa465c){socket[_0x999e('0x73')](_0x999e('0x74'),{'UserId':_0xfa465c['id'],'FaxQueueId':_0x3f556d['id']});});});});});}})[_0x999e('0x2c')](respondWithStatusCode(_0x11e5d3,null))['catch'](handleError(_0x11e5d3,null));};exports[_0x999e('0x75')]=function(_0x460805,_0xd8ad2e,_0xd49ad8){return db[_0x999e('0x68')][_0x999e('0x4a')]({'where':{'id':_0x460805[_0x999e('0x3a')][_0x999e('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x999e('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x999e('0x2c')](handleEntityNotFound(_0xd8ad2e,null))[_0x999e('0x2c')](function(_0x4b0d85){var _0x2b036d=_[_0x999e('0x39')](_0x4b0d85,'id');var _0x3b5b20=[];var _0x2cd575=[];var _0x35fcd5=squel[_0x999e('0x76')]();_0x35fcd5[_0x999e('0x77')](_0x999e('0x78'))[_0x999e('0x79')]('team_has_fax_queues','tq')[_0x999e('0x7a')](_0x999e('0x7b'),'ut',_0x999e('0x7c'))['where']('FaxQueueId\x20=\x20?',_0x460805[_0x999e('0x4c')]['id']);for(var _0xd2178f=0x0;_0xd2178f<_0x4b0d85[_0x999e('0x4d')];_0xd2178f+=0x1){let _0x544755=_0x4b0d85[_0xd2178f];for(var _0x3c93e4=0x0;_0x3c93e4<_0x544755[_0x999e('0x6a')][_0x999e('0x4d')];_0x3c93e4+=0x1){let _0x47fbb8=_0x544755[_0x999e('0x6a')][_0x3c93e4];var _0x3519d1=_0x35fcd5['clone']();_0x3519d1[_0x999e('0x43')]('ut.UserId\x20=\x20?',_0x47fbb8['id']);_0x2cd575['push'](db[_0x999e('0x6e')][_0x999e('0x3a')](_0x3519d1[_0x999e('0x7d')](),{'type':db[_0x999e('0x6e')]['QueryTypes'][_0x999e('0x7e')]})[_0x999e('0x2c')](function(_0x76015d){if(_0x76015d[_0x999e('0x4d')]===0x1){return _0x47fbb8['id'];}else{var _0x1c38c7=_['every'](_[_0x999e('0x39')](_0x76015d,_0x999e('0x7f')),function(_0x3b1a00){return _['includes'](_0x2b036d,_0x3b1a00);});if(_0x1c38c7){return _0x47fbb8['id'];}}}));}}return BPromise[_0x999e('0x80')](_0x2cd575)[_0x999e('0x2c')](function(_0x32c3ba){_0x3b5b20=_(_0x3b5b20)[_0x999e('0x81')](_0x32c3ba)[_0x999e('0x82')]()[_0x999e('0x83')]();return db[_0x999e('0x36')][_0x999e('0x4e')]({'where':{'id':_0x460805['params']['id']}})[_0x999e('0x2c')](function(_0x288c57){return db[_0x999e('0x6e')][_0x999e('0x6f')](function(_0x4787d3){return _0x288c57[_0x999e('0x75')](_0x460805[_0x999e('0x3a')][_0x999e('0x67')],{'transaction':_0x4787d3})[_0x999e('0x2c')](function(){if(!_[_0x999e('0x84')](_0x3b5b20)){return _0x288c57['removeAgents'](_0x3b5b20,{'transaction':_0x4787d3});}})[_0x999e('0x2c')](function(){_0x3b5b20[_0x999e('0x72')](function(_0x1e7bbf){socket[_0x999e('0x73')](_0x999e('0x85'),{'UserId':_0x1e7bbf,'FaxQueueId':_0x288c57['id']});});});});});});})[_0x999e('0x2c')](respondWithStatusCode(_0xd8ad2e,null))['catch'](handleError(_0xd8ad2e,null));};exports['addAgents']=function(_0x2b2368,_0x1bbb83,_0x57a547){return db[_0x999e('0x36')][_0x999e('0x4e')]({'where':{'id':_0x2b2368['params']['id']}})[_0x999e('0x2c')](handleEntityNotFound(_0x1bbb83,null))[_0x999e('0x2c')](function(_0x131123){if(_0x131123){return _0x131123[_0x999e('0x86')](_0x2b2368[_0x999e('0x51')]['ids'],_[_0x999e('0x87')](_0x2b2368[_0x999e('0x51')],[_0x999e('0x67'),'id'])||{})[_0x999e('0x88')](function(_0x18f68f){for(var _0x9361d5=0x0;_0x9361d5<_0x2b2368[_0x999e('0x51')]['ids'][_0x999e('0x4d')];_0x9361d5+=0x1){socket['emit'](_0x999e('0x74'),{'UserId':_0x2b2368[_0x999e('0x51')][_0x999e('0x67')][_0x9361d5],'FaxQueueId':_0x2b2368[_0x999e('0x4c')]['id']});}return _0x18f68f;});}})[_0x999e('0x2c')](respondWithResult(_0x1bbb83,null))[_0x999e('0x4f')](handleError(_0x1bbb83,null));};exports[_0x999e('0x89')]=function(_0x431e6f,_0x38238b,_0x5a0e84){return db[_0x999e('0x36')]['find']({'where':{'id':_0x431e6f[_0x999e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x38238b,null))[_0x999e('0x2c')](function(_0x4bd5d3){if(_0x4bd5d3){return _0x4bd5d3['removeAgents'](_0x431e6f[_0x999e('0x3a')][_0x999e('0x67')])['then'](function(){if(_['isArray'](_0x431e6f[_0x999e('0x3a')][_0x999e('0x67')])){for(var _0x168202=0x0;_0x168202<_0x431e6f[_0x999e('0x3a')][_0x999e('0x67')]['length'];_0x168202+=0x1){socket[_0x999e('0x73')]('userFaxQueue:remove',{'UserId':Number(_0x431e6f[_0x999e('0x3a')][_0x999e('0x67')][_0x168202]),'FaxQueueId':Number(_0x431e6f[_0x999e('0x4c')]['id'])});}}else{socket[_0x999e('0x73')]('userFaxQueue:remove',{'UserId':Number(_0x431e6f[_0x999e('0x3a')][_0x999e('0x67')]),'FaxQueueId':Number(_0x431e6f[_0x999e('0x4c')]['id'])});}});}})[_0x999e('0x2c')](respondWithStatusCode(_0x38238b,null))[_0x999e('0x4f')](handleError(_0x38238b,null));};exports[_0x999e('0x8a')]=function(_0x2bfb2b,_0x23d5fb,_0x1190af){var _0x590cd2={};var _0x1af087={};var _0x1f0d55;var _0x2fd5cd;return db[_0x999e('0x36')][_0x999e('0x64')]({'where':{'id':_0x2bfb2b[_0x999e('0x4c')]['id']}})[_0x999e('0x2c')](handleEntityNotFound(_0x23d5fb,null))[_0x999e('0x2c')](function(_0x516d4d){if(_0x516d4d){_0x1f0d55=_0x516d4d;_0x1af087[_0x999e('0x3e')]=_['keys'](db[_0x999e('0x69')][_0x999e('0x65')]);_0x1af087['query']=_[_0x999e('0x3b')](_0x2bfb2b[_0x999e('0x3a')]);_0x1af087[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x1af087[_0x999e('0x3e')],_0x1af087['query']);_0x590cd2[_0x999e('0x40')]=_['intersection'](_0x1af087['model'],qs[_0x999e('0x3f')](_0x2bfb2b[_0x999e('0x3a')][_0x999e('0x3f')]));_0x590cd2['attributes']=_0x590cd2[_0x999e('0x40')][_0x999e('0x4d')]?_0x590cd2[_0x999e('0x40')]:_0x1af087[_0x999e('0x3e')];_0x590cd2[_0x999e('0x42')]=qs[_0x999e('0x5b')](_0x2bfb2b[_0x999e('0x3a')]['sort']);_0x590cd2[_0x999e('0x43')]=qs[_0x999e('0x3c')](_['pick'](_0x2bfb2b[_0x999e('0x3a')],_0x1af087['filters']));if(_0x2bfb2b[_0x999e('0x3a')][_0x999e('0x45')]){_0x590cd2['where']=_['merge'](_0x590cd2['where'],{'$or':_['map'](_0x590cd2['attributes'],function(_0x5adea7){var _0x3a94aa={};_0x3a94aa[_0x5adea7]={'$like':'%'+_0x2bfb2b[_0x999e('0x3a')][_0x999e('0x45')]+'%'};return _0x3a94aa;})});}_0x590cd2=_[_0x999e('0x46')]({},_0x590cd2,_0x2bfb2b[_0x999e('0x47')]);return _0x1f0d55[_0x999e('0x8a')](_0x590cd2);}})[_0x999e('0x2c')](function(_0x308833){if(_0x308833){_0x2fd5cd=_0x308833[_0x999e('0x4d')];if(!_0x2bfb2b[_0x999e('0x3a')]['hasOwnProperty'](_0x999e('0x41'))){_0x590cd2[_0x999e('0x24')]=qs[_0x999e('0x24')](_0x2bfb2b[_0x999e('0x3a')][_0x999e('0x24')]);_0x590cd2[_0x999e('0x5a')]=qs[_0x999e('0x5a')](_0x2bfb2b[_0x999e('0x3a')][_0x999e('0x5a')]);}return _0x1f0d55[_0x999e('0x8a')](_0x590cd2);}})[_0x999e('0x2c')](function(_0x1dcd7e){if(_0x1dcd7e){return _0x1dcd7e?{'count':_0x2fd5cd,'rows':_0x1dcd7e}:null;}})[_0x999e('0x2c')](respondWithResult(_0x23d5fb,null))[_0x999e('0x4f')](handleError(_0x23d5fb,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 5314eb5..c12d2e9 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 _0x3cd4=['hook','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1fe48b,_0x276862){var _0x827be2=function(_0x30b372){while(--_0x30b372){_0x1fe48b['push'](_0x1fe48b['shift']());}};_0x827be2(++_0x276862);}(_0x3cd4,0xeb));var _0x43cd=function(_0x4136c6,_0x2ed2fe){_0x4136c6=_0x4136c6-0x0;var _0x305aa1=_0x3cd4[_0x4136c6];return _0x305aa1;};'use strict';var EventEmitter=require(_0x43cd('0x0'));var FaxQueue=require(_0x43cd('0x1'))['db'][_0x43cd('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x43cd('0x3')](0x0);var events={'afterCreate':_0x43cd('0x4'),'afterUpdate':_0x43cd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3bd316){return function(_0x41529b,_0x51443c,_0x1fde12){FaxQueueEvents[_0x43cd('0x6')](_0x3bd316+':'+_0x41529b['id'],_0x41529b);FaxQueueEvents['emit'](_0x3bd316,_0x41529b);_0x1fde12(null);};}for(var e in events){if(events[_0x43cd('0x7')](e)){var event=events[e];FaxQueue[_0x43cd('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xc763=['hook','exports','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x56a3ff,_0x7b6a4f){var _0x27fc14=function(_0xc31f8c){while(--_0xc31f8c){_0x56a3ff['push'](_0x56a3ff['shift']());}};_0x27fc14(++_0x7b6a4f);}(_0xc763,0x9a));var _0x3c76=function(_0x4264f8,_0x1cc302){_0x4264f8=_0x4264f8-0x0;var _0x3fccca=_0xc763[_0x4264f8];return _0x3fccca;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x3c76('0x0')](0x0);var events={'afterCreate':_0x3c76('0x1'),'afterUpdate':_0x3c76('0x2'),'afterDestroy':_0x3c76('0x3')};function emitEvent(_0x26c277){return function(_0x1ace87,_0x26acb8,_0x5f3db0){FaxQueueEvents[_0x3c76('0x4')](_0x26c277+':'+_0x1ace87['id'],_0x1ace87);FaxQueueEvents[_0x3c76('0x4')](_0x26c277,_0x1ace87);_0x5f3db0(null);};}for(var e in events){if(events[_0x3c76('0x5')](e)){var event=events[e];FaxQueue[_0x3c76('0x6')](e,emitEvent(event));}}module[_0x3c76('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 752a7f7..8b96b7c 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 _0xced9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxQueue','fax_queues','util','../../config/logger'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xced9,0x106));var _0x9ced=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xced9[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require(_0x9ced('0x0'));var logger=require(_0x9ced('0x1'))(_0x9ced('0x2'));var moment=require(_0x9ced('0x3'));var BPromise=require(_0x9ced('0x4'));var rp=require(_0x9ced('0x5'));var fs=require('fs');var path=require(_0x9ced('0x6'));var rimraf=require(_0x9ced('0x7'));var config=require(_0x9ced('0x8'));var attributes=require('./faxQueue.attributes');module[_0x9ced('0x9')]=function(_0x1d64f3,_0x4a87ab){return _0x1d64f3['define'](_0x9ced('0xa'),attributes,{'tableName':_0x9ced('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bed=['FaxQueue','fax_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x17c5c7,_0xabfe52){var _0x581dd3=function(_0x2c3ec9){while(--_0x2c3ec9){_0x17c5c7['push'](_0x17c5c7['shift']());}};_0x581dd3(++_0xabfe52);}(_0x8bed,0x9e));var _0xd8be=function(_0x5da440,_0x50fe36){_0x5da440=_0x5da440-0x0;var _0x231f3b=_0x8bed[_0x5da440];return _0x231f3b;};'use strict';var _=require('lodash');var util=require(_0xd8be('0x0'));var logger=require(_0xd8be('0x1'))(_0xd8be('0x2'));var moment=require(_0xd8be('0x3'));var BPromise=require(_0xd8be('0x4'));var rp=require(_0xd8be('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd8be('0x6'));var config=require(_0xd8be('0x7'));var attributes=require('./faxQueue.attributes');module[_0xd8be('0x8')]=function(_0x57524d,_0x7fd620){return _0x57524d[_0xd8be('0x9')](_0xd8be('0xa'),attributes,{'tableName':_0xd8be('0xb'),'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 b56a8c1..7ffc5c9 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 _0x3b0b=['FaxQueue','findAll','options','attributes','limit','include','map','model','GetFaxQueue','debug','find','raw','where','ShowFaxQueue','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','localhost','socket.io-emitter','redis','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0xcc4aed,_0x229370){var _0x53d96e=function(_0x3bb6c8){while(--_0x3bb6c8){_0xcc4aed['push'](_0xcc4aed['shift']());}};_0x53d96e(++_0x229370);}(_0x3b0b,0x19e));var _0xb3b0=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x3b0b[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0xb3b0('0x0'));var util=require(_0xb3b0('0x1'));var moment=require('moment');var BPromise=require(_0xb3b0('0x2'));var rs=require(_0xb3b0('0x3'));var fs=require('fs');var Redis=require(_0xb3b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3b0('0x5'));var logger=require(_0xb3b0('0x6'))('rpc');var config=require(_0xb3b0('0x7'));var jayson=require(_0xb3b0('0x8'));var client=jayson[_0xb3b0('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xb3b0('0xa'),'port':0x18eb});var socket=require(_0xb3b0('0xb'))(new Redis(config[_0xb3b0('0xc')]));require(_0xb3b0('0xd'))[_0xb3b0('0xe')](socket);function respondWithRpcPromise(_0x169268,_0x28c62b,_0x36ec98){return new BPromise(function(_0x2888a8,_0x323840){return client[_0xb3b0('0xf')](_0x169268,_0x36ec98)[_0xb3b0('0x10')](function(_0x5bf3ae){logger[_0xb3b0('0x11')](_0xb3b0('0x12'),_0x28c62b,_0xb3b0('0x13'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x28c62b,_0xb3b0('0x13'),JSON[_0xb3b0('0x14')](_0x5bf3ae));if(_0x5bf3ae[_0xb3b0('0x15')]){if(_0x5bf3ae['error'][_0xb3b0('0x16')]===0x1f4){logger['error'](_0xb3b0('0x12'),_0x28c62b,_0x5bf3ae[_0xb3b0('0x15')][_0xb3b0('0x17')]);return _0x323840(_0x5bf3ae[_0xb3b0('0x15')][_0xb3b0('0x17')]);}logger[_0xb3b0('0x15')]('FaxQueue,\x20%s,\x20%s',_0x28c62b,_0x5bf3ae[_0xb3b0('0x15')][_0xb3b0('0x17')]);return _0x2888a8(_0x5bf3ae['error'][_0xb3b0('0x17')]);}else{logger[_0xb3b0('0x11')](_0xb3b0('0x12'),_0x28c62b,'request\x20sent');_0x2888a8(_0x5bf3ae[_0xb3b0('0x18')][_0xb3b0('0x17')]);}})[_0xb3b0('0x19')](function(_0x5590c8){logger[_0xb3b0('0x15')](_0xb3b0('0x12'),_0x28c62b,_0x5590c8);_0x323840(_0x5590c8);});});}exports['GetFaxQueue']=function(_0x4bce17){var _0x93ccea=this;return new Promise(function(_0x30d726,_0x4355fd){return db[_0xb3b0('0x1a')][_0xb3b0('0x1b')]({'raw':_0x4bce17['options']?_0x4bce17[_0xb3b0('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4bce17['options']?_0x4bce17[_0xb3b0('0x1c')]['where']||null:null,'attributes':_0x4bce17[_0xb3b0('0x1c')]?_0x4bce17[_0xb3b0('0x1c')][_0xb3b0('0x1d')]||null:null,'limit':_0x4bce17[_0xb3b0('0x1c')]?_0x4bce17['options'][_0xb3b0('0x1e')]||null:null,'include':_0x4bce17['options']?_0x4bce17[_0xb3b0('0x1c')][_0xb3b0('0x1f')]?_[_0xb3b0('0x20')](_0x4bce17[_0xb3b0('0x1c')][_0xb3b0('0x1f')],function(_0x23a9a6){return{'model':db[_0x23a9a6[_0xb3b0('0x21')]],'as':_0x23a9a6['as'],'attributes':_0x23a9a6[_0xb3b0('0x1d')],'include':_0x23a9a6[_0xb3b0('0x1f')]?_[_0xb3b0('0x20')](_0x23a9a6['include'],function(_0x541c7c){return{'model':db[_0x541c7c[_0xb3b0('0x21')]],'as':_0x541c7c['as'],'attributes':_0x541c7c[_0xb3b0('0x1d')],'include':_0x541c7c[_0xb3b0('0x1f')]?_['map'](_0x541c7c[_0xb3b0('0x1f')],function(_0x1b339a){return{'model':db[_0x1b339a[_0xb3b0('0x21')]],'as':_0x1b339a['as'],'attributes':_0x1b339a[_0xb3b0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29b460){logger[_0xb3b0('0x11')](_0xb3b0('0x22'),_0x4bce17);logger[_0xb3b0('0x23')](_0xb3b0('0x22'),_0x4bce17,JSON[_0xb3b0('0x14')](_0x29b460));_0x30d726(_0x29b460);})['catch'](function(_0x30ce6b){logger[_0xb3b0('0x15')](_0xb3b0('0x22'),_0x30ce6b['message'],_0x4bce17);_0x4355fd(_0x93ccea[_0xb3b0('0x15')](0x1f4,_0x30ce6b[_0xb3b0('0x17')]));});});};exports['ShowFaxQueue']=function(_0x18ed47){var _0x556c47=this;return new Promise(function(_0x569df2,_0x3a83cd){return db['FaxQueue'][_0xb3b0('0x24')]({'raw':_0x18ed47[_0xb3b0('0x1c')]?_0x18ed47[_0xb3b0('0x1c')][_0xb3b0('0x25')]===undefined?!![]:![]:!![],'where':_0x18ed47[_0xb3b0('0x1c')]?_0x18ed47[_0xb3b0('0x1c')][_0xb3b0('0x26')]||null:null,'attributes':_0x18ed47['options']?_0x18ed47['options']['attributes']||null:null,'include':_0x18ed47[_0xb3b0('0x1c')]?_0x18ed47['options']['include']?_[_0xb3b0('0x20')](_0x18ed47['options'][_0xb3b0('0x1f')],function(_0x5f2727){return{'model':db[_0x5f2727[_0xb3b0('0x21')]],'as':_0x5f2727['as'],'attributes':_0x5f2727['attributes'],'include':_0x5f2727['include']?_[_0xb3b0('0x20')](_0x5f2727['include'],function(_0x2c0fc0){return{'model':db[_0x2c0fc0[_0xb3b0('0x21')]],'as':_0x2c0fc0['as'],'attributes':_0x2c0fc0[_0xb3b0('0x1d')],'include':_0x2c0fc0[_0xb3b0('0x1f')]?_[_0xb3b0('0x20')](_0x2c0fc0['include'],function(_0x19da2e){return{'model':db[_0x19da2e[_0xb3b0('0x21')]],'as':_0x19da2e['as'],'attributes':_0x19da2e[_0xb3b0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb3b0('0x10')](function(_0x5456ed){logger['info'](_0xb3b0('0x27'),_0x18ed47);logger[_0xb3b0('0x23')](_0xb3b0('0x27'),_0x18ed47,JSON['stringify'](_0x5456ed));_0x569df2(_0x5456ed);})[_0xb3b0('0x19')](function(_0x4f8503){logger[_0xb3b0('0x15')](_0xb3b0('0x27'),_0x4f8503[_0xb3b0('0x17')],_0x18ed47);_0x3a83cd(_0x556c47['error'](0x1f4,_0x4f8503[_0xb3b0('0x17')]));});});}; \ No newline at end of file +var _0xdcbf=['result','GetFaxQueue','FaxQueue','options','where','attributes','limit','include','map','model','stringify','catch','ShowFaxQueue','raw','lodash','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','FaxQueue,\x20%s,\x20%s'];(function(_0x261351,_0x2110b8){var _0x454b3c=function(_0x5758bf){while(--_0x5758bf){_0x261351['push'](_0x261351['shift']());}};_0x454b3c(++_0x2110b8);}(_0xdcbf,0x15b));var _0xfdcb=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xdcbf[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xfdcb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfdcb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdcb('0x2'));var db=require(_0xfdcb('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfdcb('0x4'));var config=require(_0xfdcb('0x5'));var jayson=require(_0xfdcb('0x6'));var client=jayson['client'][_0xfdcb('0x7')]({'port':0x232a});config[_0xfdcb('0x8')]=_[_0xfdcb('0x9')](config[_0xfdcb('0x8')],{'host':_0xfdcb('0xa'),'port':0x18eb});var socket=require(_0xfdcb('0xb'))(new Redis(config[_0xfdcb('0x8')]));require(_0xfdcb('0xc'))[_0xfdcb('0xd')](socket);function respondWithRpcPromise(_0x17890c,_0x53277d,_0x71ec21){return new BPromise(function(_0x430570,_0x431c96){return client['request'](_0x17890c,_0x71ec21)[_0xfdcb('0xe')](function(_0x2d6eba){logger[_0xfdcb('0xf')]('FaxQueue,\x20%s,\x20%s',_0x53277d,_0xfdcb('0x10'));logger[_0xfdcb('0x11')](_0xfdcb('0x12'),_0x53277d,'request\x20sent',JSON['stringify'](_0x2d6eba));if(_0x2d6eba[_0xfdcb('0x13')]){if(_0x2d6eba[_0xfdcb('0x13')][_0xfdcb('0x14')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x53277d,_0x2d6eba[_0xfdcb('0x13')]['message']);return _0x431c96(_0x2d6eba[_0xfdcb('0x13')][_0xfdcb('0x15')]);}logger['error'](_0xfdcb('0x16'),_0x53277d,_0x2d6eba[_0xfdcb('0x13')][_0xfdcb('0x15')]);return _0x430570(_0x2d6eba['error'][_0xfdcb('0x15')]);}else{logger[_0xfdcb('0xf')]('FaxQueue,\x20%s,\x20%s',_0x53277d,_0xfdcb('0x10'));_0x430570(_0x2d6eba[_0xfdcb('0x17')]['message']);}})['catch'](function(_0x453370){logger[_0xfdcb('0x13')](_0xfdcb('0x16'),_0x53277d,_0x453370);_0x431c96(_0x453370);});});}exports[_0xfdcb('0x18')]=function(_0x8ae261){var _0x2eefd2=this;return new Promise(function(_0x23d4ab,_0x328b67){return db[_0xfdcb('0x19')]['findAll']({'raw':_0x8ae261[_0xfdcb('0x1a')]?_0x8ae261[_0xfdcb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x8ae261[_0xfdcb('0x1a')]?_0x8ae261[_0xfdcb('0x1a')][_0xfdcb('0x1b')]||null:null,'attributes':_0x8ae261[_0xfdcb('0x1a')]?_0x8ae261[_0xfdcb('0x1a')][_0xfdcb('0x1c')]||null:null,'limit':_0x8ae261[_0xfdcb('0x1a')]?_0x8ae261[_0xfdcb('0x1a')][_0xfdcb('0x1d')]||null:null,'include':_0x8ae261[_0xfdcb('0x1a')]?_0x8ae261[_0xfdcb('0x1a')][_0xfdcb('0x1e')]?_[_0xfdcb('0x1f')](_0x8ae261['options'][_0xfdcb('0x1e')],function(_0x25c66f){return{'model':db[_0x25c66f[_0xfdcb('0x20')]],'as':_0x25c66f['as'],'attributes':_0x25c66f['attributes'],'include':_0x25c66f[_0xfdcb('0x1e')]?_[_0xfdcb('0x1f')](_0x25c66f[_0xfdcb('0x1e')],function(_0x47f676){return{'model':db[_0x47f676[_0xfdcb('0x20')]],'as':_0x47f676['as'],'attributes':_0x47f676[_0xfdcb('0x1c')],'include':_0x47f676[_0xfdcb('0x1e')]?_[_0xfdcb('0x1f')](_0x47f676['include'],function(_0x1dd59d){return{'model':db[_0x1dd59d['model']],'as':_0x1dd59d['as'],'attributes':_0x1dd59d['attributes']};}):[]};}):[]};}):[]:[]})[_0xfdcb('0xe')](function(_0x2544b3){logger[_0xfdcb('0xf')](_0xfdcb('0x18'),_0x8ae261);logger['debug'](_0xfdcb('0x18'),_0x8ae261,JSON[_0xfdcb('0x21')](_0x2544b3));_0x23d4ab(_0x2544b3);})[_0xfdcb('0x22')](function(_0x395ba3){logger[_0xfdcb('0x13')](_0xfdcb('0x18'),_0x395ba3['message'],_0x8ae261);_0x328b67(_0x2eefd2[_0xfdcb('0x13')](0x1f4,_0x395ba3[_0xfdcb('0x15')]));});});};exports[_0xfdcb('0x23')]=function(_0x5be207){var _0x415125=this;return new Promise(function(_0x3d06ea,_0x40b9bb){return db[_0xfdcb('0x19')]['find']({'raw':_0x5be207[_0xfdcb('0x1a')]?_0x5be207['options'][_0xfdcb('0x24')]===undefined?!![]:![]:!![],'where':_0x5be207[_0xfdcb('0x1a')]?_0x5be207[_0xfdcb('0x1a')][_0xfdcb('0x1b')]||null:null,'attributes':_0x5be207['options']?_0x5be207[_0xfdcb('0x1a')][_0xfdcb('0x1c')]||null:null,'include':_0x5be207[_0xfdcb('0x1a')]?_0x5be207['options']['include']?_[_0xfdcb('0x1f')](_0x5be207[_0xfdcb('0x1a')][_0xfdcb('0x1e')],function(_0x42a229){return{'model':db[_0x42a229[_0xfdcb('0x20')]],'as':_0x42a229['as'],'attributes':_0x42a229[_0xfdcb('0x1c')],'include':_0x42a229['include']?_[_0xfdcb('0x1f')](_0x42a229['include'],function(_0x191736){return{'model':db[_0x191736[_0xfdcb('0x20')]],'as':_0x191736['as'],'attributes':_0x191736[_0xfdcb('0x1c')],'include':_0x191736['include']?_[_0xfdcb('0x1f')](_0x191736[_0xfdcb('0x1e')],function(_0x43f9b6){return{'model':db[_0x43f9b6[_0xfdcb('0x20')]],'as':_0x43f9b6['as'],'attributes':_0x43f9b6[_0xfdcb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfdcb('0xe')](function(_0x19049e){logger['info']('ShowFaxQueue',_0x5be207);logger['debug'](_0xfdcb('0x23'),_0x5be207,JSON[_0xfdcb('0x21')](_0x19049e));_0x3d06ea(_0x19049e);})[_0xfdcb('0x22')](function(_0x49f0d7){logger[_0xfdcb('0x13')](_0xfdcb('0x23'),_0x49f0d7[_0xfdcb('0x15')],_0x5be207);_0x40b9bb(_0x415125[_0xfdcb('0x13')](0x1f4,_0x49f0d7['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d1394ab..d9adc11 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 _0x1a31=['register','faxQueue:','update','emit'];(function(_0x4016d8,_0x207c7f){var _0x63d7e1=function(_0x493cda){while(--_0x493cda){_0x4016d8['push'](_0x4016d8['shift']());}};_0x63d7e1(++_0x207c7f);}(_0x1a31,0xca));var _0x11a3=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x1a31[_0x4e676e];return _0x336a3c;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save','remove',_0x11a3('0x0')];function createListener(_0x5d45cd,_0x3ab1ab){return function(_0x46eed4){_0x3ab1ab[_0x11a3('0x1')](_0x5d45cd,_0x46eed4);};}function removeListener(_0xba22ce,_0x2b2168){return function(){FaxQueueEvents['removeListener'](_0xba22ce,_0x2b2168);};}exports[_0x11a3('0x2')]=function(_0x3849a6){for(var _0x3ed527=0x0,_0x2ab9fd=events['length'];_0x3ed527<_0x2ab9fd;_0x3ed527++){var _0xe26ee4=events[_0x3ed527];var _0x407e6b=createListener(_0x11a3('0x3')+_0xe26ee4,_0x3849a6);FaxQueueEvents['on'](_0xe26ee4,_0x407e6b);}}; \ No newline at end of file +var _0xe200=['remove','update','emit','register','faxQueue:','save'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0xe200,0x10d));var _0x0e20=function(_0x2da3c4,_0x2275a3){_0x2da3c4=_0x2da3c4-0x0;var _0x176597=_0xe200[_0x2da3c4];return _0x176597;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x0e20('0x0'),_0x0e20('0x1'),_0x0e20('0x2')];function createListener(_0xf22308,_0x47b392){return function(_0x29f1bd){_0x47b392[_0x0e20('0x3')](_0xf22308,_0x29f1bd);};}function removeListener(_0x28ff42,_0x5df565){return function(){FaxQueueEvents['removeListener'](_0x28ff42,_0x5df565);};}exports[_0x0e20('0x4')]=function(_0x552ba1){for(var _0x4ccfa7=0x0,_0x4b8762=events['length'];_0x4ccfa7<_0x4b8762;_0x4ccfa7++){var _0xefcbe0=events[_0x4ccfa7];var _0x4f34e5=createListener(_0x0e20('0x5')+_0xefcbe0,_0x552ba1);FaxQueueEvents['on'](_0xefcbe0,_0x4f34e5);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 4e403f9..726baf0 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 _0xfc2c=['post','/:id/users','addAgents','put','/:id','update','delete','removeTeams','removeAgents','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','addTeams'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xfc2c,0x13d));var _0xcfc2=function(_0x377d73,_0x1faa82){_0x377d73=_0x377d73-0x0;var _0x110966=_0xfc2c[_0x377d73];return _0x110966;};'use strict';var multer=require('multer');var util=require(_0xcfc2('0x0'));var path=require('path');var timeout=require(_0xcfc2('0x1'));var express=require('express');var router=express[_0xcfc2('0x2')]();var fs_extra=require(_0xcfc2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcfc2('0x4'));var config=require('../../config/environment');var controller=require(_0xcfc2('0x5'));router[_0xcfc2('0x6')]('/',auth[_0xcfc2('0x7')](),controller[_0xcfc2('0x8')]);router['get'](_0xcfc2('0x9'),auth[_0xcfc2('0x7')](),controller[_0xcfc2('0xa')]);router['get']('/:id',auth[_0xcfc2('0x7')](),controller[_0xcfc2('0xb')]);router[_0xcfc2('0x6')](_0xcfc2('0xc'),auth[_0xcfc2('0x7')](),controller[_0xcfc2('0xd')]);router[_0xcfc2('0x6')](_0xcfc2('0xe'),auth[_0xcfc2('0x7')](),controller[_0xcfc2('0xf')]);router[_0xcfc2('0x6')]('/:id/users',auth[_0xcfc2('0x7')](),controller[_0xcfc2('0x10')]);router['post']('/',auth[_0xcfc2('0x7')](),controller[_0xcfc2('0x11')]);router['post'](_0xcfc2('0xe'),auth[_0xcfc2('0x7')](),controller[_0xcfc2('0x12')]);router[_0xcfc2('0x13')](_0xcfc2('0x14'),auth['isAuthenticated'](),controller[_0xcfc2('0x15')]);router[_0xcfc2('0x16')](_0xcfc2('0x17'),auth['isAuthenticated'](),controller[_0xcfc2('0x18')]);router[_0xcfc2('0x19')](_0xcfc2('0x17'),auth[_0xcfc2('0x7')](),controller['destroy']);router[_0xcfc2('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xcfc2('0x1a')]);router[_0xcfc2('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0xcfc2('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xdd08=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer'];(function(_0xcdac34,_0x43f665){var _0x269d23=function(_0x3f2d6f){while(--_0x3f2d6f){_0xcdac34['push'](_0xcdac34['shift']());}};_0x269d23(++_0x43f665);}(_0xdd08,0x149));var _0x8dd0=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xdd08[_0x55d8c5];return _0x225ae5;};'use strict';var multer=require(_0x8dd0('0x0'));var util=require('util');var path=require(_0x8dd0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8dd0('0x2')]();var fs_extra=require(_0x8dd0('0x3'));var auth=require(_0x8dd0('0x4'));var interaction=require(_0x8dd0('0x5'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x8dd0('0x6')]('/',auth[_0x8dd0('0x7')](),controller[_0x8dd0('0x8')]);router['get'](_0x8dd0('0x9'),auth['isAuthenticated'](),controller[_0x8dd0('0xa')]);router[_0x8dd0('0x6')]('/:id',auth[_0x8dd0('0x7')](),controller[_0x8dd0('0xb')]);router['get'](_0x8dd0('0xc'),auth[_0x8dd0('0x7')](),controller[_0x8dd0('0xd')]);router[_0x8dd0('0x6')](_0x8dd0('0xe'),auth['isAuthenticated'](),controller[_0x8dd0('0xf')]);router[_0x8dd0('0x6')](_0x8dd0('0x10'),auth[_0x8dd0('0x7')](),controller[_0x8dd0('0x11')]);router[_0x8dd0('0x12')]('/',auth[_0x8dd0('0x7')](),controller[_0x8dd0('0x13')]);router[_0x8dd0('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8dd0('0x14')]);router[_0x8dd0('0x12')](_0x8dd0('0x10'),auth[_0x8dd0('0x7')](),controller[_0x8dd0('0x15')]);router[_0x8dd0('0x16')](_0x8dd0('0x17'),auth[_0x8dd0('0x7')](),controller[_0x8dd0('0x18')]);router[_0x8dd0('0x19')](_0x8dd0('0x17'),auth[_0x8dd0('0x7')](),controller[_0x8dd0('0x1a')]);router[_0x8dd0('0x19')](_0x8dd0('0xe'),auth[_0x8dd0('0x7')](),controller[_0x8dd0('0x1b')]);router[_0x8dd0('0x19')](_0x8dd0('0x10'),auth['isAuthenticated'](),controller[_0x8dd0('0x1c')]);module[_0x8dd0('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 9a592de..b8f3feb 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 _0xb5de=['sequelize','STRING','DATE','moment'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xb5de,0x1e3));var _0xeb5d=function(_0x29a9c0,_0xa4858b){_0x29a9c0=_0x29a9c0-0x0;var _0x4b8dd3=_0xb5de[_0x29a9c0];return _0x4b8dd3;};'use strict';var moment=require(_0xeb5d('0x0'));var Sequelize=require(_0xeb5d('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xeb5d('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xeb5d('0x3')]},'leaveAt':{'type':Sequelize[_0xeb5d('0x3')]},'acceptAt':{'type':Sequelize[_0xeb5d('0x3')]},'exitAt':{'type':Sequelize[_0xeb5d('0x3')]},'reason':{'type':Sequelize[_0xeb5d('0x2')]}}; \ No newline at end of file +var _0xbb97=['exports','STRING','DATE','sequelize'];(function(_0x5b09f1,_0x4b3e5e){var _0x408156=function(_0x39cc85){while(--_0x39cc85){_0x5b09f1['push'](_0x5b09f1['shift']());}};_0x408156(++_0x4b3e5e);}(_0xbb97,0x11f));var _0x7bb9=function(_0x3efdfc,_0x1a23d0){_0x3efdfc=_0x3efdfc-0x0;var _0x50faf3=_0xbb97[_0x3efdfc];return _0x50faf3;};'use strict';var moment=require('moment');var Sequelize=require(_0x7bb9('0x0'));module[_0x7bb9('0x1')]={'uniqueid':{'type':Sequelize[_0x7bb9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7bb9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7bb9('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7bb9('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 2b61369..a9ee08e 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 _0x9f67=['mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','nolimit','limit','order','pick','filter','where','merge','includeAll','findAll','catch','show','params','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x3a1f7e,_0x9449c4){var _0x3f1742=function(_0x52f333){while(--_0x52f333){_0x3a1f7e['push'](_0x3a1f7e['shift']());}};_0x3f1742(++_0x9449c4);}(_0x9f67,0xcd));var _0x79f6=function(_0xb6b2c1,_0x140d6b){_0xb6b2c1=_0xb6b2c1-0x0;var _0x297888=_0x9f67[_0xb6b2c1];return _0x297888;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x79f6('0x0'));var zipdir=require(_0x79f6('0x1'));var jsonpatch=require(_0x79f6('0x2'));var rp=require(_0x79f6('0x3'));var moment=require('moment');var BPromise=require(_0x79f6('0x4'));var Mustache=require(_0x79f6('0x5'));var util=require(_0x79f6('0x6'));var path=require('path');var sox=require(_0x79f6('0x7'));var csv=require(_0x79f6('0x8'));var ejs=require(_0x79f6('0x9'));var fs=require('fs');var fs_extra=require(_0x79f6('0xa'));var _=require('lodash');var squel=require(_0x79f6('0xb'));var crypto=require(_0x79f6('0xc'));var jsforce=require(_0x79f6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x79f6('0x8'));var querystring=require(_0x79f6('0xe'));var Papa=require(_0x79f6('0xf'));var Redis=require(_0x79f6('0x10'));var authService=require(_0x79f6('0x11'));var qs=require(_0x79f6('0x12'));var as=require(_0x79f6('0x13'));var hardwareService=require(_0x79f6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x79f6('0x15'));var config=require(_0x79f6('0x16'));var licenseUtil=require(_0x79f6('0x17'));var db=require(_0x79f6('0x18'))['db'];function respondWithStatusCode(_0x2a6b6f,_0x37e538){_0x37e538=_0x37e538||0xcc;return function(_0x4ca2d8){if(_0x4ca2d8){return _0x2a6b6f[_0x79f6('0x19')](_0x37e538);}return _0x2a6b6f[_0x79f6('0x1a')](_0x37e538)[_0x79f6('0x1b')]();};}function respondWithResult(_0x5acc02,_0x43b0e2){_0x43b0e2=_0x43b0e2||0xc8;return function(_0x2976ec){if(_0x2976ec){return _0x5acc02['status'](_0x43b0e2)[_0x79f6('0x1c')](_0x2976ec);}};}function respondWithFilteredResult(_0x116d08,_0x3c1236){return function(_0x45b2f5){if(_0x45b2f5){var _0x4bc3ef=_0x45b2f5[_0x79f6('0x1d')],_0x1314bf=_0x3c1236[_0x79f6('0x1e')],_0x47c66b=_0x3c1236['offset']+_0x3c1236['limit'],_0x57bad0;if(_0x47c66b>=_0x4bc3ef){_0x47c66b=_0x4bc3ef;_0x57bad0=0xc8;}else{_0x57bad0=0xce;}_0x116d08[_0x79f6('0x1a')](_0x57bad0);return _0x116d08['set'](_0x79f6('0x1f'),_0x1314bf+'-'+_0x47c66b+'/'+_0x4bc3ef)[_0x79f6('0x1c')](_0x45b2f5);}return null;};}function patchUpdates(_0x223dd3){return function(_0x2e7e26){try{jsonpatch[_0x79f6('0x20')](_0x2e7e26,_0x223dd3,!![]);}catch(_0x8c7548){return BPromise[_0x79f6('0x21')](_0x8c7548);}return _0x2e7e26[_0x79f6('0x22')]();};}function saveUpdates(_0x5469d7,_0x577253){return function(_0x38380e){if(_0x38380e){return _0x38380e[_0x79f6('0x23')](_0x5469d7)[_0x79f6('0x24')](function(_0x2ce0da){return _0x2ce0da;});}return null;};}function removeEntity(_0xadf737,_0x17829c){return function(_0x5a1c95){if(_0x5a1c95){return _0x5a1c95[_0x79f6('0x25')]()[_0x79f6('0x24')](function(){_0xadf737[_0x79f6('0x1a')](0xcc)[_0x79f6('0x1b')]();});}};}function handleEntityNotFound(_0x52cded,_0x10536c){return function(_0x40062d){if(!_0x40062d){_0x52cded[_0x79f6('0x19')](0x194);}return _0x40062d;};}function handleError(_0x402662,_0x581132){_0x581132=_0x581132||0x1f4;return function(_0x48e12d){logger['error'](_0x48e12d['stack']);if(_0x48e12d['name']){delete _0x48e12d[_0x79f6('0x26')];}_0x402662[_0x79f6('0x1a')](_0x581132)[_0x79f6('0x27')](_0x48e12d);};}exports[_0x79f6('0x28')]=function(_0x265d06,_0x367854){var _0x36caf3={},_0x3b12c6={},_0x206142={'count':0x0,'rows':[]};var _0x245dc3=_[_0x79f6('0x29')](db[_0x79f6('0x2a')][_0x79f6('0x2b')],function(_0x10a8a4){return{'name':_0x10a8a4[_0x79f6('0x2c')],'type':_0x10a8a4[_0x79f6('0x2d')][_0x79f6('0x2e')]};});_0x3b12c6['model']=_[_0x79f6('0x29')](_0x245dc3,_0x79f6('0x26'));_0x3b12c6[_0x79f6('0x2f')]=_[_0x79f6('0x30')](_0x265d06[_0x79f6('0x2f')]);_0x3b12c6[_0x79f6('0x31')]=_['intersection'](_0x3b12c6[_0x79f6('0x32')],_0x3b12c6[_0x79f6('0x2f')]);_0x36caf3[_0x79f6('0x33')]=_['intersection'](_0x3b12c6['model'],qs['fields'](_0x265d06[_0x79f6('0x2f')][_0x79f6('0x34')]));_0x36caf3['attributes']=_0x36caf3[_0x79f6('0x33')]['length']?_0x36caf3['attributes']:_0x3b12c6['model'];if(!_0x265d06[_0x79f6('0x2f')]['hasOwnProperty'](_0x79f6('0x35'))){_0x36caf3[_0x79f6('0x36')]=qs[_0x79f6('0x36')](_0x265d06[_0x79f6('0x2f')][_0x79f6('0x36')]);_0x36caf3[_0x79f6('0x1e')]=qs['offset'](_0x265d06['query'][_0x79f6('0x1e')]);}_0x36caf3[_0x79f6('0x37')]=qs['sort'](_0x265d06[_0x79f6('0x2f')]['sort']);_0x36caf3['where']=qs[_0x79f6('0x31')](_[_0x79f6('0x38')](_0x265d06['query'],_0x3b12c6[_0x79f6('0x31')]),_0x245dc3);if(_0x265d06[_0x79f6('0x2f')][_0x79f6('0x39')]){_0x36caf3[_0x79f6('0x3a')]=_[_0x79f6('0x3b')](_0x36caf3[_0x79f6('0x3a')],{'$or':_['map'](_0x245dc3,function(_0x598af2){if(_0x598af2[_0x79f6('0x2d')]!=='VIRTUAL'){var _0x168254={};_0x168254[_0x598af2[_0x79f6('0x26')]]={'$like':'%'+_0x265d06[_0x79f6('0x2f')]['filter']+'%'};return _0x168254;}})});}_0x36caf3=_['merge']({},_0x36caf3,_0x265d06['options']);var _0x389cf3={'where':_0x36caf3[_0x79f6('0x3a')]};return db[_0x79f6('0x2a')][_0x79f6('0x1d')](_0x389cf3)[_0x79f6('0x24')](function(_0x73bff7){_0x206142['count']=_0x73bff7;if(_0x265d06['query'][_0x79f6('0x3c')]){_0x36caf3['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x79f6('0x3d')](_0x36caf3);})['then'](function(_0x513875){_0x206142['rows']=_0x513875;return _0x206142;})[_0x79f6('0x24')](respondWithFilteredResult(_0x367854,_0x36caf3))[_0x79f6('0x3e')](handleError(_0x367854,null));};exports[_0x79f6('0x3f')]=function(_0xdcd751,_0x23d48a){var _0x1ca2fe={'raw':!![],'where':{'id':_0xdcd751[_0x79f6('0x40')]['id']}},_0x112bd7={};_0x112bd7[_0x79f6('0x32')]=_[_0x79f6('0x30')](db[_0x79f6('0x2a')][_0x79f6('0x2b')]);_0x112bd7[_0x79f6('0x2f')]=_[_0x79f6('0x30')](_0xdcd751['query']);_0x112bd7[_0x79f6('0x31')]=_['intersection'](_0x112bd7[_0x79f6('0x32')],_0x112bd7[_0x79f6('0x2f')]);_0x1ca2fe[_0x79f6('0x33')]=_['intersection'](_0x112bd7[_0x79f6('0x32')],qs[_0x79f6('0x34')](_0xdcd751[_0x79f6('0x2f')][_0x79f6('0x34')]));_0x1ca2fe[_0x79f6('0x33')]=_0x1ca2fe[_0x79f6('0x33')][_0x79f6('0x41')]?_0x1ca2fe['attributes']:_0x112bd7[_0x79f6('0x32')];if(_0xdcd751[_0x79f6('0x2f')][_0x79f6('0x3c')]){_0x1ca2fe['include']=[{'all':!![]}];}_0x1ca2fe=_[_0x79f6('0x3b')]({},_0x1ca2fe,_0xdcd751['options']);return db[_0x79f6('0x2a')][_0x79f6('0x42')](_0x1ca2fe)[_0x79f6('0x24')](handleEntityNotFound(_0x23d48a,null))[_0x79f6('0x24')](respondWithResult(_0x23d48a,null))[_0x79f6('0x3e')](handleError(_0x23d48a,null));};exports[_0x79f6('0x43')]=function(_0x39cb50,_0x562bda){return db[_0x79f6('0x2a')][_0x79f6('0x43')](_0x39cb50[_0x79f6('0x44')],{})['then'](respondWithResult(_0x562bda,0xc9))[_0x79f6('0x3e')](handleError(_0x562bda,null));};exports[_0x79f6('0x23')]=function(_0x170e7f,_0x12c4a4){if(_0x170e7f[_0x79f6('0x44')]['id']){delete _0x170e7f[_0x79f6('0x44')]['id'];}return db[_0x79f6('0x2a')]['find']({'where':{'id':_0x170e7f['params']['id']}})['then'](handleEntityNotFound(_0x12c4a4,null))['then'](saveUpdates(_0x170e7f[_0x79f6('0x44')],null))[_0x79f6('0x24')](respondWithResult(_0x12c4a4,null))[_0x79f6('0x3e')](handleError(_0x12c4a4,null));};exports[_0x79f6('0x25')]=function(_0x1f0d0b,_0x3ceab3){return db['FaxQueueReport']['find']({'where':{'id':_0x1f0d0b[_0x79f6('0x40')]['id']}})['then'](handleEntityNotFound(_0x3ceab3,null))[_0x79f6('0x24')](removeEntity(_0x3ceab3,null))[_0x79f6('0x3e')](handleError(_0x3ceab3,null));};exports[_0x79f6('0x45')]=function(_0xf77a70,_0x2da22e){return db[_0x79f6('0x2a')]['describe']()[_0x79f6('0x24')](respondWithResult(_0x2da22e,null))[_0x79f6('0x3e')](handleError(_0x2da22e,null));}; \ No newline at end of file +var _0x5f8c=['limit','set','Content-Range','json','apply','update','then','error','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','params','destroy','describe','html-pdf','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset'];(function(_0x82f299,_0x508c09){var _0x3bf2b4=function(_0x5f41ba){while(--_0x5f41ba){_0x82f299['push'](_0x82f299['shift']());}};_0x3bf2b4(++_0x508c09);}(_0x5f8c,0xb2));var _0xc5f8=function(_0x1033b3,_0x2278c2){_0x1033b3=_0x1033b3-0x0;var _0x4deb09=_0x5f8c[_0x1033b3];return _0x4deb09;};'use strict';var pdf=require(_0xc5f8('0x0'));var emlformat=require(_0xc5f8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc5f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc5f8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc5f8('0x4'));var util=require(_0xc5f8('0x5'));var path=require(_0xc5f8('0x6'));var sox=require(_0xc5f8('0x7'));var csv=require(_0xc5f8('0x8'));var ejs=require(_0xc5f8('0x9'));var fs=require('fs');var fs_extra=require(_0xc5f8('0xa'));var _=require(_0xc5f8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5f8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc5f8('0x8'));var querystring=require(_0xc5f8('0xd'));var Papa=require(_0xc5f8('0xe'));var Redis=require(_0xc5f8('0xf'));var authService=require(_0xc5f8('0x10'));var qs=require(_0xc5f8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc5f8('0x12'))(_0xc5f8('0x13'));var utils=require('../../config/utils');var config=require(_0xc5f8('0x14'));var licenseUtil=require(_0xc5f8('0x15'));var db=require(_0xc5f8('0x16'))['db'];function respondWithStatusCode(_0x346b40,_0x21d746){_0x21d746=_0x21d746||0xcc;return function(_0x4c5582){if(_0x4c5582){return _0x346b40['sendStatus'](_0x21d746);}return _0x346b40['status'](_0x21d746)['end']();};}function respondWithResult(_0x36e5a8,_0xebb27e){_0xebb27e=_0xebb27e||0xc8;return function(_0x41983c){if(_0x41983c){return _0x36e5a8[_0xc5f8('0x17')](_0xebb27e)['json'](_0x41983c);}};}function respondWithFilteredResult(_0x1081e8,_0x662b8){return function(_0xc5b8ad){if(_0xc5b8ad){var _0x261f4c=_0xc5b8ad[_0xc5f8('0x18')],_0x257931=_0x662b8['offset'],_0x84e186=_0x662b8[_0xc5f8('0x19')]+_0x662b8[_0xc5f8('0x1a')],_0x253aba;if(_0x84e186>=_0x261f4c){_0x84e186=_0x261f4c;_0x253aba=0xc8;}else{_0x253aba=0xce;}_0x1081e8[_0xc5f8('0x17')](_0x253aba);return _0x1081e8[_0xc5f8('0x1b')](_0xc5f8('0x1c'),_0x257931+'-'+_0x84e186+'/'+_0x261f4c)[_0xc5f8('0x1d')](_0xc5b8ad);}return null;};}function patchUpdates(_0x5a6328){return function(_0x2d3226){try{jsonpatch[_0xc5f8('0x1e')](_0x2d3226,_0x5a6328,!![]);}catch(_0x3277b3){return BPromise['reject'](_0x3277b3);}return _0x2d3226['save']();};}function saveUpdates(_0x4a5cdb,_0x497090){return function(_0xc93c40){if(_0xc93c40){return _0xc93c40[_0xc5f8('0x1f')](_0x4a5cdb)[_0xc5f8('0x20')](function(_0xbcd74e){return _0xbcd74e;});}return null;};}function removeEntity(_0x4038f2,_0x3f08d9){return function(_0x2a8db2){if(_0x2a8db2){return _0x2a8db2['destroy']()[_0xc5f8('0x20')](function(){_0x4038f2[_0xc5f8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2235af,_0xcca5f0){return function(_0xcce900){if(!_0xcce900){_0x2235af['sendStatus'](0x194);}return _0xcce900;};}function handleError(_0x35f221,_0x238ff7){_0x238ff7=_0x238ff7||0x1f4;return function(_0x2ddcee){logger[_0xc5f8('0x21')](_0x2ddcee['stack']);if(_0x2ddcee['name']){delete _0x2ddcee[_0xc5f8('0x22')];}_0x35f221['status'](_0x238ff7)[_0xc5f8('0x23')](_0x2ddcee);};}exports[_0xc5f8('0x24')]=function(_0xb81d02,_0x154ea4){var _0x212a79={},_0x570b1b={},_0x305ac2={'count':0x0,'rows':[]};var _0x51ba79=_['map'](db[_0xc5f8('0x25')][_0xc5f8('0x26')],function(_0x1818fd){return{'name':_0x1818fd[_0xc5f8('0x27')],'type':_0x1818fd[_0xc5f8('0x28')]['key']};});_0x570b1b[_0xc5f8('0x29')]=_['map'](_0x51ba79,_0xc5f8('0x22'));_0x570b1b[_0xc5f8('0x2a')]=_[_0xc5f8('0x2b')](_0xb81d02[_0xc5f8('0x2a')]);_0x570b1b[_0xc5f8('0x2c')]=_[_0xc5f8('0x2d')](_0x570b1b['model'],_0x570b1b[_0xc5f8('0x2a')]);_0x212a79['attributes']=_['intersection'](_0x570b1b[_0xc5f8('0x29')],qs[_0xc5f8('0x2e')](_0xb81d02['query']['fields']));_0x212a79['attributes']=_0x212a79['attributes']['length']?_0x212a79[_0xc5f8('0x2f')]:_0x570b1b[_0xc5f8('0x29')];if(!_0xb81d02['query']['hasOwnProperty'](_0xc5f8('0x30'))){_0x212a79[_0xc5f8('0x1a')]=qs[_0xc5f8('0x1a')](_0xb81d02[_0xc5f8('0x2a')][_0xc5f8('0x1a')]);_0x212a79['offset']=qs['offset'](_0xb81d02[_0xc5f8('0x2a')][_0xc5f8('0x19')]);}_0x212a79[_0xc5f8('0x31')]=qs['sort'](_0xb81d02[_0xc5f8('0x2a')]['sort']);_0x212a79[_0xc5f8('0x32')]=qs[_0xc5f8('0x2c')](_[_0xc5f8('0x33')](_0xb81d02[_0xc5f8('0x2a')],_0x570b1b['filters']),_0x51ba79);if(_0xb81d02['query'][_0xc5f8('0x34')]){_0x212a79[_0xc5f8('0x32')]=_[_0xc5f8('0x35')](_0x212a79['where'],{'$or':_['map'](_0x51ba79,function(_0x3a92d7){if(_0x3a92d7[_0xc5f8('0x28')]!==_0xc5f8('0x36')){var _0x587653={};_0x587653[_0x3a92d7['name']]={'$like':'%'+_0xb81d02[_0xc5f8('0x2a')][_0xc5f8('0x34')]+'%'};return _0x587653;}})});}_0x212a79=_[_0xc5f8('0x35')]({},_0x212a79,_0xb81d02[_0xc5f8('0x37')]);var _0x58b469={'where':_0x212a79['where']};return db[_0xc5f8('0x25')][_0xc5f8('0x18')](_0x58b469)[_0xc5f8('0x20')](function(_0x1704f1){_0x305ac2[_0xc5f8('0x18')]=_0x1704f1;if(_0xb81d02[_0xc5f8('0x2a')][_0xc5f8('0x38')]){_0x212a79[_0xc5f8('0x39')]=[{'all':!![]}];}return db[_0xc5f8('0x25')][_0xc5f8('0x3a')](_0x212a79);})[_0xc5f8('0x20')](function(_0x4670f7){_0x305ac2['rows']=_0x4670f7;return _0x305ac2;})[_0xc5f8('0x20')](respondWithFilteredResult(_0x154ea4,_0x212a79))[_0xc5f8('0x3b')](handleError(_0x154ea4,null));};exports[_0xc5f8('0x3c')]=function(_0x4d8b70,_0x30b658){var _0x5b376b={'raw':!![],'where':{'id':_0x4d8b70['params']['id']}},_0x1ba961={};_0x1ba961[_0xc5f8('0x29')]=_[_0xc5f8('0x2b')](db[_0xc5f8('0x25')][_0xc5f8('0x26')]);_0x1ba961['query']=_[_0xc5f8('0x2b')](_0x4d8b70[_0xc5f8('0x2a')]);_0x1ba961[_0xc5f8('0x2c')]=_[_0xc5f8('0x2d')](_0x1ba961['model'],_0x1ba961[_0xc5f8('0x2a')]);_0x5b376b[_0xc5f8('0x2f')]=_['intersection'](_0x1ba961[_0xc5f8('0x29')],qs[_0xc5f8('0x2e')](_0x4d8b70[_0xc5f8('0x2a')][_0xc5f8('0x2e')]));_0x5b376b['attributes']=_0x5b376b[_0xc5f8('0x2f')][_0xc5f8('0x3d')]?_0x5b376b[_0xc5f8('0x2f')]:_0x1ba961[_0xc5f8('0x29')];if(_0x4d8b70[_0xc5f8('0x2a')]['includeAll']){_0x5b376b[_0xc5f8('0x39')]=[{'all':!![]}];}_0x5b376b=_[_0xc5f8('0x35')]({},_0x5b376b,_0x4d8b70[_0xc5f8('0x37')]);return db['FaxQueueReport'][_0xc5f8('0x3e')](_0x5b376b)[_0xc5f8('0x20')](handleEntityNotFound(_0x30b658,null))[_0xc5f8('0x20')](respondWithResult(_0x30b658,null))[_0xc5f8('0x3b')](handleError(_0x30b658,null));};exports[_0xc5f8('0x3f')]=function(_0x5296c6,_0x5b6389){return db[_0xc5f8('0x25')][_0xc5f8('0x3f')](_0x5296c6[_0xc5f8('0x40')],{})[_0xc5f8('0x20')](respondWithResult(_0x5b6389,0xc9))[_0xc5f8('0x3b')](handleError(_0x5b6389,null));};exports['update']=function(_0x414c77,_0x49cf49){if(_0x414c77[_0xc5f8('0x40')]['id']){delete _0x414c77[_0xc5f8('0x40')]['id'];}return db[_0xc5f8('0x25')][_0xc5f8('0x3e')]({'where':{'id':_0x414c77[_0xc5f8('0x41')]['id']}})[_0xc5f8('0x20')](handleEntityNotFound(_0x49cf49,null))['then'](saveUpdates(_0x414c77[_0xc5f8('0x40')],null))[_0xc5f8('0x20')](respondWithResult(_0x49cf49,null))[_0xc5f8('0x3b')](handleError(_0x49cf49,null));};exports[_0xc5f8('0x42')]=function(_0x3956f9,_0x5f5554){return db[_0xc5f8('0x25')]['find']({'where':{'id':_0x3956f9[_0xc5f8('0x41')]['id']}})['then'](handleEntityNotFound(_0x5f5554,null))[_0xc5f8('0x20')](removeEntity(_0x5f5554,null))[_0xc5f8('0x3b')](handleError(_0x5f5554,null));};exports['describe']=function(_0x47cece,_0x4889e5){return db[_0xc5f8('0x25')][_0xc5f8('0x43')]()['then'](respondWithResult(_0x4889e5,null))[_0xc5f8('0x3b')](handleError(_0x4889e5,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index e7e0ad7..cf3c6a2 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 _0xb09c=['api','moment','bluebird','request-promise','path','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x4079c0,_0x2eda63){var _0x591474=function(_0x373bb4){while(--_0x373bb4){_0x4079c0['push'](_0x4079c0['shift']());}};_0x591474(++_0x2eda63);}(_0xb09c,0x148));var _0xcb09=function(_0x3a09fe,_0x2c7078){_0x3a09fe=_0x3a09fe-0x0;var _0x38f47f=_0xb09c[_0x3a09fe];return _0x38f47f;};'use strict';var _=require(_0xcb09('0x0'));var util=require('util');var logger=require(_0xcb09('0x1'))(_0xcb09('0x2'));var moment=require(_0xcb09('0x3'));var BPromise=require(_0xcb09('0x4'));var rp=require(_0xcb09('0x5'));var fs=require('fs');var path=require(_0xcb09('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x309990,_0x33b1c0){return _0x309990[_0xcb09('0x7')](_0xcb09('0x8'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xcb09('0x9'),'fields':[_0xcb09('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7e09=['request-promise','path','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x556634,_0x520958){var _0x4429fd=function(_0x1e7eb9){while(--_0x1e7eb9){_0x556634['push'](_0x556634['shift']());}};_0x4429fd(++_0x520958);}(_0x7e09,0xa3));var _0x97e0=function(_0x3ba3cb,_0x2c6437){_0x3ba3cb=_0x3ba3cb-0x0;var _0x151389=_0x7e09[_0x3ba3cb];return _0x151389;};'use strict';var _=require(_0x97e0('0x0'));var util=require('util');var logger=require(_0x97e0('0x1'))(_0x97e0('0x2'));var moment=require(_0x97e0('0x3'));var BPromise=require(_0x97e0('0x4'));var rp=require(_0x97e0('0x5'));var fs=require('fs');var path=require(_0x97e0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x97e0('0x7'));module[_0x97e0('0x8')]=function(_0xdeba12,_0x5f46d1){return _0xdeba12['define'](_0x97e0('0x9'),attributes,{'tableName':_0x97e0('0xa'),'paranoid':![],'indexes':[{'name':_0x97e0('0xb'),'fields':[_0x97e0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 229dcb2..9737ff9 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 _0xea02=['rpc','../../config/environment','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateFaxQueueReport','FaxQueueReport','create','body','raw','update','options','where','limit','UpdateFaxQueueReport','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1d3fdc,_0x2b5c54){var _0x128bb0=function(_0x3b7184){while(--_0x3b7184){_0x1d3fdc['push'](_0x1d3fdc['shift']());}};_0x128bb0(++_0x2b5c54);}(_0xea02,0x110));var _0x2ea0=function(_0x1f02c7,_0x53ffa1){_0x1f02c7=_0x1f02c7-0x0;var _0x3f76d2=_0xea02[_0x1f02c7];return _0x3f76d2;};'use strict';var _=require(_0x2ea0('0x0'));var util=require(_0x2ea0('0x1'));var moment=require(_0x2ea0('0x2'));var BPromise=require(_0x2ea0('0x3'));var rs=require(_0x2ea0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ea0('0x5'))['db'];var utils=require(_0x2ea0('0x6'));var logger=require(_0x2ea0('0x7'))(_0x2ea0('0x8'));var config=require(_0x2ea0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2ea0('0xa')][_0x2ea0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bc35a,_0x4d6f52,_0xf6ed0c){return new BPromise(function(_0x420366,_0x343985){return client[_0x2ea0('0xc')](_0x3bc35a,_0xf6ed0c)[_0x2ea0('0xd')](function(_0x3570e3){logger['info'](_0x2ea0('0xe'),_0x4d6f52,_0x2ea0('0xf'));logger[_0x2ea0('0x10')](_0x2ea0('0x11'),_0x4d6f52,_0x2ea0('0xf'),JSON[_0x2ea0('0x12')](_0x3570e3));if(_0x3570e3[_0x2ea0('0x13')]){if(_0x3570e3[_0x2ea0('0x13')][_0x2ea0('0x14')]===0x1f4){logger[_0x2ea0('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x4d6f52,_0x3570e3['error']['message']);return _0x343985(_0x3570e3[_0x2ea0('0x13')][_0x2ea0('0x15')]);}logger['error'](_0x2ea0('0xe'),_0x4d6f52,_0x3570e3[_0x2ea0('0x13')][_0x2ea0('0x15')]);return _0x420366(_0x3570e3[_0x2ea0('0x13')][_0x2ea0('0x15')]);}else{logger[_0x2ea0('0x16')]('FaxQueueReport,\x20%s,\x20%s',_0x4d6f52,_0x2ea0('0xf'));_0x420366(_0x3570e3[_0x2ea0('0x17')][_0x2ea0('0x15')]);}})['catch'](function(_0x4eacfd){logger[_0x2ea0('0x13')](_0x2ea0('0xe'),_0x4d6f52,_0x4eacfd);_0x343985(_0x4eacfd);});});}exports[_0x2ea0('0x18')]=function(_0x5dccbb){var _0x3e0efb=this;return new Promise(function(_0x1431da,_0x331b6a){return db[_0x2ea0('0x19')][_0x2ea0('0x1a')](_0x5dccbb[_0x2ea0('0x1b')],{'raw':_0x5dccbb['options']?_0x5dccbb['options'][_0x2ea0('0x1c')]===undefined?!![]:![]:!![]})[_0x2ea0('0xd')](function(_0x26ab85){logger[_0x2ea0('0x16')]('CreateFaxQueueReport',_0x5dccbb);logger[_0x2ea0('0x10')]('CreateFaxQueueReport',_0x5dccbb,JSON[_0x2ea0('0x12')](_0x26ab85));_0x1431da(_0x26ab85);})['catch'](function(_0x112efc){logger[_0x2ea0('0x13')]('CreateFaxQueueReport',_0x112efc['message'],_0x5dccbb);_0x331b6a(_0x3e0efb[_0x2ea0('0x13')](0x1f4,_0x112efc['message']));});});};exports['UpdateFaxQueueReport']=function(_0x207065){var _0x3b3ae4=this;return new Promise(function(_0x20511f,_0x22c9c4){return db[_0x2ea0('0x19')][_0x2ea0('0x1d')](_0x207065[_0x2ea0('0x1b')],{'raw':_0x207065[_0x2ea0('0x1e')]?_0x207065[_0x2ea0('0x1e')][_0x2ea0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x207065[_0x2ea0('0x1e')]?_0x207065[_0x2ea0('0x1e')][_0x2ea0('0x1f')]||null:null,'attributes':_0x207065['options']?_0x207065[_0x2ea0('0x1e')]['attributes']||null:null,'limit':_0x207065['options']?_0x207065[_0x2ea0('0x1e')][_0x2ea0('0x20')]||null:null})[_0x2ea0('0xd')](function(_0x23c85c){logger['info'](_0x2ea0('0x21'),_0x207065);logger[_0x2ea0('0x10')](_0x2ea0('0x21'),_0x207065,JSON[_0x2ea0('0x12')](_0x23c85c));_0x20511f(_0x23c85c);})[_0x2ea0('0x22')](function(_0xa5c65a){logger[_0x2ea0('0x13')]('UpdateFaxQueueReport',_0xa5c65a[_0x2ea0('0x15')],_0x207065);_0x22c9c4(_0x3b3ae4[_0x2ea0('0x13')](0x1f4,_0xa5c65a['message']));});});}; \ No newline at end of file +var _0x4208=['client','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxQueueReport','FaxQueueReport','create','options','then','UpdateFaxQueueReport','update','body','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x17c8cc,_0x5e5647){var _0x3db4eb=function(_0x2082db){while(--_0x2082db){_0x17c8cc['push'](_0x17c8cc['shift']());}};_0x3db4eb(++_0x5e5647);}(_0x4208,0x157));var _0x8420=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x4208[_0x57d13b];return _0x467696;};'use strict';var _=require(_0x8420('0x0'));var util=require(_0x8420('0x1'));var moment=require(_0x8420('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8420('0x3'));var db=require(_0x8420('0x4'))['db'];var utils=require(_0x8420('0x5'));var logger=require('../../config/logger')(_0x8420('0x6'));var config=require(_0x8420('0x7'));var jayson=require(_0x8420('0x8'));var client=jayson[_0x8420('0x9')][_0x8420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd6acb0,_0x29bdca,_0x5bd6ae){return new BPromise(function(_0x4a18d7,_0x50beda){return client['request'](_0xd6acb0,_0x5bd6ae)['then'](function(_0x5cf9c3){logger[_0x8420('0xb')](_0x8420('0xc'),_0x29bdca,_0x8420('0xd'));logger[_0x8420('0xe')](_0x8420('0xf'),_0x29bdca,_0x8420('0xd'),JSON[_0x8420('0x10')](_0x5cf9c3));if(_0x5cf9c3['error']){if(_0x5cf9c3[_0x8420('0x11')][_0x8420('0x12')]===0x1f4){logger[_0x8420('0x11')](_0x8420('0xc'),_0x29bdca,_0x5cf9c3[_0x8420('0x11')][_0x8420('0x13')]);return _0x50beda(_0x5cf9c3[_0x8420('0x11')][_0x8420('0x13')]);}logger[_0x8420('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x29bdca,_0x5cf9c3[_0x8420('0x11')][_0x8420('0x13')]);return _0x4a18d7(_0x5cf9c3[_0x8420('0x11')][_0x8420('0x13')]);}else{logger[_0x8420('0xb')](_0x8420('0xc'),_0x29bdca,_0x8420('0xd'));_0x4a18d7(_0x5cf9c3['result']['message']);}})[_0x8420('0x14')](function(_0x128c35){logger['error'](_0x8420('0xc'),_0x29bdca,_0x128c35);_0x50beda(_0x128c35);});});}exports[_0x8420('0x15')]=function(_0x3c7d45){var _0x5c8636=this;return new Promise(function(_0x176707,_0x57979f){return db[_0x8420('0x16')][_0x8420('0x17')](_0x3c7d45['body'],{'raw':_0x3c7d45[_0x8420('0x18')]?_0x3c7d45['options']['raw']===undefined?!![]:![]:!![]})[_0x8420('0x19')](function(_0x523f7d){logger[_0x8420('0xb')](_0x8420('0x15'),_0x3c7d45);logger['debug'](_0x8420('0x15'),_0x3c7d45,JSON[_0x8420('0x10')](_0x523f7d));_0x176707(_0x523f7d);})['catch'](function(_0x425e05){logger[_0x8420('0x11')](_0x8420('0x15'),_0x425e05[_0x8420('0x13')],_0x3c7d45);_0x57979f(_0x5c8636[_0x8420('0x11')](0x1f4,_0x425e05[_0x8420('0x13')]));});});};exports[_0x8420('0x1a')]=function(_0x12fecc){var _0x164c61=this;return new Promise(function(_0x222726,_0x33430f){return db[_0x8420('0x16')][_0x8420('0x1b')](_0x12fecc[_0x8420('0x1c')],{'raw':_0x12fecc[_0x8420('0x18')]?_0x12fecc[_0x8420('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12fecc[_0x8420('0x18')]?_0x12fecc['options'][_0x8420('0x1d')]||null:null,'attributes':_0x12fecc[_0x8420('0x18')]?_0x12fecc['options'][_0x8420('0x1e')]||null:null,'limit':_0x12fecc['options']?_0x12fecc[_0x8420('0x18')][_0x8420('0x1f')]||null:null})[_0x8420('0x19')](function(_0x2a9ba9){logger[_0x8420('0xb')](_0x8420('0x1a'),_0x12fecc);logger[_0x8420('0xe')](_0x8420('0x1a'),_0x12fecc,JSON[_0x8420('0x10')](_0x2a9ba9));_0x222726(_0x2a9ba9);})[_0x8420('0x14')](function(_0x3c9f4e){logger[_0x8420('0x11')]('UpdateFaxQueueReport',_0x3c9f4e[_0x8420('0x13')],_0x12fecc);_0x33430f(_0x164c61[_0x8420('0x11')](0x1f4,_0x3c9f4e[_0x8420('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 5eb5bf3..554e135 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 _0x8f69=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','index','get','/describe','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3bb3e1,_0xf69c2a){var _0x59f298=function(_0x3b08c0){while(--_0x3b08c0){_0x3bb3e1['push'](_0x3bb3e1['shift']());}};_0x59f298(++_0xf69c2a);}(_0x8f69,0x1ca));var _0x98f6=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0x8f69[_0x1d8119];return _0x3e30f6;};'use strict';var multer=require(_0x98f6('0x0'));var util=require(_0x98f6('0x1'));var path=require(_0x98f6('0x2'));var timeout=require(_0x98f6('0x3'));var express=require('express');var router=express[_0x98f6('0x4')]();var fs_extra=require(_0x98f6('0x5'));var auth=require(_0x98f6('0x6'));var interaction=require(_0x98f6('0x7'));var config=require(_0x98f6('0x8'));var controller=require(_0x98f6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x98f6('0xa')]);router[_0x98f6('0xb')](_0x98f6('0xc'),auth[_0x98f6('0xd')](),controller['describe']);router['get']('/:id',auth[_0x98f6('0xd')](),controller['show']);router['post']('/',auth[_0x98f6('0xd')](),controller[_0x98f6('0xe')]);router[_0x98f6('0xf')](_0x98f6('0x10'),auth[_0x98f6('0xd')](),controller[_0x98f6('0x11')]);router[_0x98f6('0x12')](_0x98f6('0x10'),auth[_0x98f6('0xd')](),controller[_0x98f6('0x13')]);module[_0x98f6('0x14')]=router; \ No newline at end of file +var _0x4b37=['./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x116adf,_0x2aea27){var _0xd8c37=function(_0x4ce3a0){while(--_0x4ce3a0){_0x116adf['push'](_0x116adf['shift']());}};_0xd8c37(++_0x2aea27);}(_0x4b37,0x103));var _0x74b3=function(_0x1c5194,_0x3a9ee3){_0x1c5194=_0x1c5194-0x0;var _0x1b4e99=_0x4b37[_0x1c5194];return _0x1b4e99;};'use strict';var multer=require(_0x74b3('0x0'));var util=require(_0x74b3('0x1'));var path=require(_0x74b3('0x2'));var timeout=require('connect-timeout');var express=require(_0x74b3('0x3'));var router=express[_0x74b3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x74b3('0x5'));var config=require(_0x74b3('0x6'));var controller=require(_0x74b3('0x7'));router[_0x74b3('0x8')]('/',auth[_0x74b3('0x9')](),controller[_0x74b3('0xa')]);router[_0x74b3('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x74b3('0xb')]);router[_0x74b3('0x8')](_0x74b3('0xc'),auth[_0x74b3('0x9')](),controller[_0x74b3('0xd')]);router[_0x74b3('0xe')]('/',auth['isAuthenticated'](),controller[_0x74b3('0xf')]);router[_0x74b3('0x10')](_0x74b3('0xc'),auth[_0x74b3('0x9')](),controller['update']);router[_0x74b3('0x11')]('/:id',auth[_0x74b3('0x9')](),controller['destroy']);module[_0x74b3('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index a446e36..b21cd43 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 _0xdf5e=['account','queue','DATE','sequelize','ENUM'];(function(_0x3dddc5,_0x31effa){var _0x3fa8cc=function(_0x538643){while(--_0x538643){_0x3dddc5['push'](_0x3dddc5['shift']());}};_0x3fa8cc(++_0x31effa);}(_0xdf5e,0x17f));var _0xedf5=function(_0x4b9978,_0x58eb71){_0x4b9978=_0x4b9978-0x0;var _0x42f0e5=_0xdf5e[_0x4b9978];return _0x42f0e5;};'use strict';var moment=require('moment');var Sequelize=require(_0xedf5('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xedf5('0x1')](_0xedf5('0x2'),'agent','queue'),'allowNull':![],'defaultValue':_0xedf5('0x3')},'transferredAt':{'type':Sequelize[_0xedf5('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xc912=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x5f35b3,_0x57b86e){var _0x3e22c2=function(_0x36f586){while(--_0x36f586){_0x5f35b3['push'](_0x5f35b3['shift']());}};_0x3e22c2(++_0x57b86e);}(_0xc912,0x1ac));var _0x2c91=function(_0x3b9b7c,_0x4b8f58){_0x3b9b7c=_0x3b9b7c-0x0;var _0x1b5c4=_0xc912[_0x3b9b7c];return _0x1b5c4;};'use strict';var moment=require('moment');var Sequelize=require(_0x2c91('0x0'));module[_0x2c91('0x1')]={'uniqueid':{'type':Sequelize[_0x2c91('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2c91('0x3')](_0x2c91('0x4'),_0x2c91('0x5'),_0x2c91('0x6')),'allowNull':![],'defaultValue':_0x2c91('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x2c91('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 7759b23..2adcbcd 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 _0x0b0e=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','map','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','keys','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','limit','apply','reject','update','then','destroy','sendStatus','error','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','query'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0x0b0e[_0x2e655a];return _0x26f13b;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe0b0('0xd'));var jsforce=require(_0xe0b0('0xe'));var deskjs=require(_0xe0b0('0xf'));var toCsv=require(_0xe0b0('0xa'));var querystring=require('querystring');var Papa=require(_0xe0b0('0x10'));var Redis=require(_0xe0b0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe0b0('0x12'));var as=require(_0xe0b0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0b0('0x14'))(_0xe0b0('0x15'));var utils=require(_0xe0b0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe0b0('0x17'));var db=require(_0xe0b0('0x18'))['db'];function respondWithStatusCode(_0x3cc19a,_0x45f914){_0x45f914=_0x45f914||0xcc;return function(_0x34fed4){if(_0x34fed4){return _0x3cc19a['sendStatus'](_0x45f914);}return _0x3cc19a[_0xe0b0('0x19')](_0x45f914)[_0xe0b0('0x1a')]();};}function respondWithResult(_0x743318,_0x24babd){_0x24babd=_0x24babd||0xc8;return function(_0x177c24){if(_0x177c24){return _0x743318['status'](_0x24babd)[_0xe0b0('0x1b')](_0x177c24);}};}function respondWithFilteredResult(_0x5adb01,_0x35cb40){return function(_0xadee6e){if(_0xadee6e){var _0x519ae8=_0xadee6e[_0xe0b0('0x1c')],_0x11fdca=_0x35cb40['offset'],_0x4a4cc0=_0x35cb40['offset']+_0x35cb40[_0xe0b0('0x1d')],_0x2d6fb6;if(_0x4a4cc0>=_0x519ae8){_0x4a4cc0=_0x519ae8;_0x2d6fb6=0xc8;}else{_0x2d6fb6=0xce;}_0x5adb01['status'](_0x2d6fb6);return _0x5adb01['set']('Content-Range',_0x11fdca+'-'+_0x4a4cc0+'/'+_0x519ae8)[_0xe0b0('0x1b')](_0xadee6e);}return null;};}function patchUpdates(_0x50fa4a){return function(_0x52598b){try{jsonpatch[_0xe0b0('0x1e')](_0x52598b,_0x50fa4a,!![]);}catch(_0x59dff5){return BPromise[_0xe0b0('0x1f')](_0x59dff5);}return _0x52598b['save']();};}function saveUpdates(_0x2c84cc,_0x1cd7c4){return function(_0x3e10b3){if(_0x3e10b3){return _0x3e10b3[_0xe0b0('0x20')](_0x2c84cc)[_0xe0b0('0x21')](function(_0x58b804){return _0x58b804;});}return null;};}function removeEntity(_0x4cae54,_0x2fa820){return function(_0x5512bb){if(_0x5512bb){return _0x5512bb[_0xe0b0('0x22')]()[_0xe0b0('0x21')](function(){_0x4cae54['status'](0xcc)[_0xe0b0('0x1a')]();});}};}function handleEntityNotFound(_0x503883,_0x2208d0){return function(_0x49a727){if(!_0x49a727){_0x503883[_0xe0b0('0x23')](0x194);}return _0x49a727;};}function handleError(_0x576352,_0x3e5c88){_0x3e5c88=_0x3e5c88||0x1f4;return function(_0x4de537){logger[_0xe0b0('0x24')](_0x4de537['stack']);if(_0x4de537[_0xe0b0('0x25')]){delete _0x4de537['name'];}_0x576352[_0xe0b0('0x19')](_0x3e5c88)[_0xe0b0('0x26')](_0x4de537);};}exports[_0xe0b0('0x27')]=function(_0x1d91ad,_0x3ec2){var _0x10745d={},_0x5200a6={},_0x1444b9={'count':0x0,'rows':[]};var _0x1b8aa8=_['map'](db[_0xe0b0('0x28')][_0xe0b0('0x29')],function(_0x36d137){return{'name':_0x36d137[_0xe0b0('0x2a')],'type':_0x36d137[_0xe0b0('0x2b')][_0xe0b0('0x2c')]};});_0x5200a6[_0xe0b0('0x2d')]=_['map'](_0x1b8aa8,_0xe0b0('0x25'));_0x5200a6[_0xe0b0('0x2e')]=_['keys'](_0x1d91ad['query']);_0x5200a6[_0xe0b0('0x2f')]=_[_0xe0b0('0x30')](_0x5200a6[_0xe0b0('0x2d')],_0x5200a6[_0xe0b0('0x2e')]);_0x10745d[_0xe0b0('0x31')]=_['intersection'](_0x5200a6[_0xe0b0('0x2d')],qs[_0xe0b0('0x32')](_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x32')]));_0x10745d[_0xe0b0('0x31')]=_0x10745d['attributes'][_0xe0b0('0x33')]?_0x10745d[_0xe0b0('0x31')]:_0x5200a6[_0xe0b0('0x2d')];if(!_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x34')](_0xe0b0('0x35'))){_0x10745d[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x10745d[_0xe0b0('0x36')]=qs[_0xe0b0('0x36')](_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x36')]);}_0x10745d[_0xe0b0('0x37')]=qs['sort'](_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x10745d[_0xe0b0('0x39')]=qs[_0xe0b0('0x2f')](_[_0xe0b0('0x3a')](_0x1d91ad[_0xe0b0('0x2e')],_0x5200a6[_0xe0b0('0x2f')]),_0x1b8aa8);if(_0x1d91ad['query']['filter']){_0x10745d['where']=_['merge'](_0x10745d[_0xe0b0('0x39')],{'$or':_[_0xe0b0('0x3b')](_0x1b8aa8,function(_0xe6f635){if(_0xe6f635['type']!==_0xe0b0('0x3c')){var _0x352c09={};_0x352c09[_0xe6f635[_0xe0b0('0x25')]]={'$like':'%'+_0x1d91ad[_0xe0b0('0x2e')]['filter']+'%'};return _0x352c09;}})});}_0x10745d=_[_0xe0b0('0x3d')]({},_0x10745d,_0x1d91ad[_0xe0b0('0x3e')]);var _0x43d352={'where':_0x10745d[_0xe0b0('0x39')]};return db[_0xe0b0('0x28')][_0xe0b0('0x1c')](_0x43d352)[_0xe0b0('0x21')](function(_0x115a69){_0x1444b9[_0xe0b0('0x1c')]=_0x115a69;if(_0x1d91ad['query'][_0xe0b0('0x3f')]){_0x10745d['include']=[{'all':!![]}];}return db[_0xe0b0('0x28')][_0xe0b0('0x40')](_0x10745d);})[_0xe0b0('0x21')](function(_0x74f3fa){_0x1444b9['rows']=_0x74f3fa;return _0x1444b9;})[_0xe0b0('0x21')](respondWithFilteredResult(_0x3ec2,_0x10745d))[_0xe0b0('0x41')](handleError(_0x3ec2,null));};exports[_0xe0b0('0x42')]=function(_0x402a0e,_0x19c80e){var _0x1c12bd={'raw':!![],'where':{'id':_0x402a0e[_0xe0b0('0x43')]['id']}},_0x3ad564={};_0x3ad564['model']=_[_0xe0b0('0x44')](db[_0xe0b0('0x28')]['rawAttributes']);_0x3ad564['query']=_[_0xe0b0('0x44')](_0x402a0e[_0xe0b0('0x2e')]);_0x3ad564['filters']=_[_0xe0b0('0x30')](_0x3ad564[_0xe0b0('0x2d')],_0x3ad564[_0xe0b0('0x2e')]);_0x1c12bd[_0xe0b0('0x31')]=_[_0xe0b0('0x30')](_0x3ad564['model'],qs['fields'](_0x402a0e['query'][_0xe0b0('0x32')]));_0x1c12bd[_0xe0b0('0x31')]=_0x1c12bd['attributes'][_0xe0b0('0x33')]?_0x1c12bd[_0xe0b0('0x31')]:_0x3ad564[_0xe0b0('0x2d')];if(_0x402a0e[_0xe0b0('0x2e')][_0xe0b0('0x3f')]){_0x1c12bd['include']=[{'all':!![]}];}_0x1c12bd=_['merge']({},_0x1c12bd,_0x402a0e[_0xe0b0('0x3e')]);return db[_0xe0b0('0x28')][_0xe0b0('0x45')](_0x1c12bd)[_0xe0b0('0x21')](handleEntityNotFound(_0x19c80e,null))[_0xe0b0('0x21')](respondWithResult(_0x19c80e,null))['catch'](handleError(_0x19c80e,null));};exports[_0xe0b0('0x46')]=function(_0x11d4fd,_0x534340){return db['FaxTransferReport']['create'](_0x11d4fd[_0xe0b0('0x47')],{})[_0xe0b0('0x21')](respondWithResult(_0x534340,0xc9))[_0xe0b0('0x41')](handleError(_0x534340,null));};exports[_0xe0b0('0x20')]=function(_0x5b1756,_0x2e2b10){if(_0x5b1756[_0xe0b0('0x47')]['id']){delete _0x5b1756['body']['id'];}return db['FaxTransferReport'][_0xe0b0('0x45')]({'where':{'id':_0x5b1756[_0xe0b0('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e2b10,null))[_0xe0b0('0x21')](saveUpdates(_0x5b1756[_0xe0b0('0x47')],null))['then'](respondWithResult(_0x2e2b10,null))['catch'](handleError(_0x2e2b10,null));};exports[_0xe0b0('0x22')]=function(_0x511679,_0x165dc8){return db[_0xe0b0('0x28')][_0xe0b0('0x45')]({'where':{'id':_0x511679[_0xe0b0('0x43')]['id']}})[_0xe0b0('0x21')](handleEntityNotFound(_0x165dc8,null))[_0xe0b0('0x21')](removeEntity(_0x165dc8,null))['catch'](handleError(_0x165dc8,null));};exports['describe']=function(_0x2ef908,_0x5d380a){return db['FaxTransferReport'][_0xe0b0('0x48')]()[_0xe0b0('0x21')](respondWithResult(_0x5d380a,null))['catch'](handleError(_0x5d380a,null));}; \ No newline at end of file +var _0xda2d=['name','send','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','count','includeAll','include','rows','catch','show','keys','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x3e90f5,_0x114faf){var _0x3c9863=function(_0x55e54d){while(--_0x55e54d){_0x3e90f5['push'](_0x3e90f5['shift']());}};_0x3c9863(++_0x114faf);}(_0xda2d,0x102));var _0xdda2=function(_0x37c004,_0x1042fc){_0x37c004=_0x37c004-0x0;var _0x5399e4=_0xda2d[_0x37c004];return _0x5399e4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdda2('0x0'));var rimraf=require(_0xdda2('0x1'));var zipdir=require(_0xdda2('0x2'));var jsonpatch=require(_0xdda2('0x3'));var rp=require(_0xdda2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdda2('0x5'));var path=require(_0xdda2('0x6'));var sox=require(_0xdda2('0x7'));var csv=require(_0xdda2('0x8'));var ejs=require(_0xdda2('0x9'));var fs=require('fs');var fs_extra=require(_0xdda2('0xa'));var _=require(_0xdda2('0xb'));var squel=require(_0xdda2('0xc'));var crypto=require(_0xdda2('0xd'));var jsforce=require(_0xdda2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdda2('0x8'));var querystring=require(_0xdda2('0xf'));var Papa=require('papaparse');var Redis=require(_0xdda2('0x10'));var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa6446b,_0x320f73){_0x320f73=_0x320f73||0xcc;return function(_0x3518b9){if(_0x3518b9){return _0xa6446b[_0xdda2('0x18')](_0x320f73);}return _0xa6446b[_0xdda2('0x19')](_0x320f73)[_0xdda2('0x1a')]();};}function respondWithResult(_0x3490f1,_0x4df902){_0x4df902=_0x4df902||0xc8;return function(_0x79c6d4){if(_0x79c6d4){return _0x3490f1['status'](_0x4df902)[_0xdda2('0x1b')](_0x79c6d4);}};}function respondWithFilteredResult(_0xb6b01e,_0x3553d5){return function(_0x457764){if(_0x457764){var _0x1922b1=_0x457764['count'],_0x5d8a83=_0x3553d5[_0xdda2('0x1c')],_0x55d674=_0x3553d5[_0xdda2('0x1c')]+_0x3553d5[_0xdda2('0x1d')],_0x43f67b;if(_0x55d674>=_0x1922b1){_0x55d674=_0x1922b1;_0x43f67b=0xc8;}else{_0x43f67b=0xce;}_0xb6b01e[_0xdda2('0x19')](_0x43f67b);return _0xb6b01e[_0xdda2('0x1e')](_0xdda2('0x1f'),_0x5d8a83+'-'+_0x55d674+'/'+_0x1922b1)[_0xdda2('0x1b')](_0x457764);}return null;};}function patchUpdates(_0x351151){return function(_0x3c02a4){try{jsonpatch[_0xdda2('0x20')](_0x3c02a4,_0x351151,!![]);}catch(_0x312ef1){return BPromise[_0xdda2('0x21')](_0x312ef1);}return _0x3c02a4['save']();};}function saveUpdates(_0x41fe7d,_0x5dfce7){return function(_0xc4567c){if(_0xc4567c){return _0xc4567c[_0xdda2('0x22')](_0x41fe7d)[_0xdda2('0x23')](function(_0x4c5226){return _0x4c5226;});}return null;};}function removeEntity(_0x347ee6,_0x5a9bb8){return function(_0x425489){if(_0x425489){return _0x425489[_0xdda2('0x24')]()['then'](function(){_0x347ee6[_0xdda2('0x19')](0xcc)[_0xdda2('0x1a')]();});}};}function handleEntityNotFound(_0x2528d7,_0x13b0f3){return function(_0x45ee9d){if(!_0x45ee9d){_0x2528d7['sendStatus'](0x194);}return _0x45ee9d;};}function handleError(_0x38cdf,_0x4be5ea){_0x4be5ea=_0x4be5ea||0x1f4;return function(_0x2391a5){logger[_0xdda2('0x25')](_0x2391a5['stack']);if(_0x2391a5['name']){delete _0x2391a5[_0xdda2('0x26')];}_0x38cdf[_0xdda2('0x19')](_0x4be5ea)[_0xdda2('0x27')](_0x2391a5);};}exports['index']=function(_0x90d919,_0x5d26ae){var _0x2e755b={},_0xe53dee={},_0xe16ec7={'count':0x0,'rows':[]};var _0x91b41a=_['map'](db[_0xdda2('0x28')][_0xdda2('0x29')],function(_0x53acb5){return{'name':_0x53acb5[_0xdda2('0x2a')],'type':_0x53acb5[_0xdda2('0x2b')][_0xdda2('0x2c')]};});_0xe53dee[_0xdda2('0x2d')]=_['map'](_0x91b41a,_0xdda2('0x26'));_0xe53dee[_0xdda2('0x2e')]=_['keys'](_0x90d919[_0xdda2('0x2e')]);_0xe53dee['filters']=_[_0xdda2('0x2f')](_0xe53dee['model'],_0xe53dee['query']);_0x2e755b['attributes']=_[_0xdda2('0x2f')](_0xe53dee['model'],qs[_0xdda2('0x30')](_0x90d919['query']['fields']));_0x2e755b['attributes']=_0x2e755b[_0xdda2('0x31')][_0xdda2('0x32')]?_0x2e755b[_0xdda2('0x31')]:_0xe53dee[_0xdda2('0x2d')];if(!_0x90d919[_0xdda2('0x2e')][_0xdda2('0x33')](_0xdda2('0x34'))){_0x2e755b[_0xdda2('0x1d')]=qs[_0xdda2('0x1d')](_0x90d919[_0xdda2('0x2e')]['limit']);_0x2e755b[_0xdda2('0x1c')]=qs[_0xdda2('0x1c')](_0x90d919[_0xdda2('0x2e')][_0xdda2('0x1c')]);}_0x2e755b[_0xdda2('0x35')]=qs[_0xdda2('0x36')](_0x90d919[_0xdda2('0x2e')]['sort']);_0x2e755b['where']=qs[_0xdda2('0x37')](_[_0xdda2('0x38')](_0x90d919[_0xdda2('0x2e')],_0xe53dee['filters']),_0x91b41a);if(_0x90d919['query'][_0xdda2('0x39')]){_0x2e755b[_0xdda2('0x3a')]=_[_0xdda2('0x3b')](_0x2e755b[_0xdda2('0x3a')],{'$or':_[_0xdda2('0x3c')](_0x91b41a,function(_0x5ab419){if(_0x5ab419[_0xdda2('0x2b')]!==_0xdda2('0x3d')){var _0x497302={};_0x497302[_0x5ab419['name']]={'$like':'%'+_0x90d919[_0xdda2('0x2e')][_0xdda2('0x39')]+'%'};return _0x497302;}})});}_0x2e755b=_[_0xdda2('0x3b')]({},_0x2e755b,_0x90d919[_0xdda2('0x3e')]);var _0x20969d={'where':_0x2e755b['where']};return db[_0xdda2('0x28')][_0xdda2('0x3f')](_0x20969d)[_0xdda2('0x23')](function(_0x1a7262){_0xe16ec7['count']=_0x1a7262;if(_0x90d919['query'][_0xdda2('0x40')]){_0x2e755b[_0xdda2('0x41')]=[{'all':!![]}];}return db[_0xdda2('0x28')]['findAll'](_0x2e755b);})[_0xdda2('0x23')](function(_0x542ceb){_0xe16ec7[_0xdda2('0x42')]=_0x542ceb;return _0xe16ec7;})['then'](respondWithFilteredResult(_0x5d26ae,_0x2e755b))[_0xdda2('0x43')](handleError(_0x5d26ae,null));};exports[_0xdda2('0x44')]=function(_0x1db762,_0x2eec64){var _0x57bd0e={'raw':!![],'where':{'id':_0x1db762['params']['id']}},_0x1c5195={};_0x1c5195[_0xdda2('0x2d')]=_['keys'](db[_0xdda2('0x28')][_0xdda2('0x29')]);_0x1c5195[_0xdda2('0x2e')]=_[_0xdda2('0x45')](_0x1db762[_0xdda2('0x2e')]);_0x1c5195['filters']=_[_0xdda2('0x2f')](_0x1c5195[_0xdda2('0x2d')],_0x1c5195['query']);_0x57bd0e[_0xdda2('0x31')]=_['intersection'](_0x1c5195[_0xdda2('0x2d')],qs[_0xdda2('0x30')](_0x1db762[_0xdda2('0x2e')][_0xdda2('0x30')]));_0x57bd0e[_0xdda2('0x31')]=_0x57bd0e[_0xdda2('0x31')][_0xdda2('0x32')]?_0x57bd0e[_0xdda2('0x31')]:_0x1c5195[_0xdda2('0x2d')];if(_0x1db762[_0xdda2('0x2e')][_0xdda2('0x40')]){_0x57bd0e[_0xdda2('0x41')]=[{'all':!![]}];}_0x57bd0e=_[_0xdda2('0x3b')]({},_0x57bd0e,_0x1db762['options']);return db['FaxTransferReport']['find'](_0x57bd0e)[_0xdda2('0x23')](handleEntityNotFound(_0x2eec64,null))[_0xdda2('0x23')](respondWithResult(_0x2eec64,null))['catch'](handleError(_0x2eec64,null));};exports[_0xdda2('0x46')]=function(_0x18f229,_0x22a99e){return db['FaxTransferReport'][_0xdda2('0x46')](_0x18f229[_0xdda2('0x47')],{})['then'](respondWithResult(_0x22a99e,0xc9))['catch'](handleError(_0x22a99e,null));};exports[_0xdda2('0x22')]=function(_0x5efd20,_0x17a9db){if(_0x5efd20['body']['id']){delete _0x5efd20[_0xdda2('0x47')]['id'];}return db[_0xdda2('0x28')]['find']({'where':{'id':_0x5efd20['params']['id']}})[_0xdda2('0x23')](handleEntityNotFound(_0x17a9db,null))[_0xdda2('0x23')](saveUpdates(_0x5efd20[_0xdda2('0x47')],null))[_0xdda2('0x23')](respondWithResult(_0x17a9db,null))['catch'](handleError(_0x17a9db,null));};exports[_0xdda2('0x24')]=function(_0x3bba94,_0x3d2cb0){return db[_0xdda2('0x28')][_0xdda2('0x48')]({'where':{'id':_0x3bba94['params']['id']}})[_0xdda2('0x23')](handleEntityNotFound(_0x3d2cb0,null))[_0xdda2('0x23')](removeEntity(_0x3d2cb0,null))['catch'](handleError(_0x3d2cb0,null));};exports[_0xdda2('0x49')]=function(_0x123c2d,_0x143670){return db[_0xdda2('0x28')][_0xdda2('0x49')]()[_0xdda2('0x23')](respondWithResult(_0x143670,null))['catch'](handleError(_0x143670,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 82c5ef5..df58ef9 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 _0xb666=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','report_fax_transfer','uniqueid','lodash'];(function(_0x1bf04d,_0x44cc80){var _0x4857dd=function(_0x4788be){while(--_0x4788be){_0x1bf04d['push'](_0x1bf04d['shift']());}};_0x4857dd(++_0x44cc80);}(_0xb666,0x1e3));var _0x6b66=function(_0x226212,_0x3471a3){_0x226212=_0x226212-0x0;var _0x37e7bf=_0xb666[_0x226212];return _0x37e7bf;};'use strict';var _=require(_0x6b66('0x0'));var util=require(_0x6b66('0x1'));var logger=require(_0x6b66('0x2'))(_0x6b66('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6b66('0x4'));var fs=require('fs');var path=require(_0x6b66('0x5'));var rimraf=require(_0x6b66('0x6'));var config=require(_0x6b66('0x7'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x4c92bf,_0x10cd52){return _0x4c92bf[_0x6b66('0x8')]('FaxTransferReport',attributes,{'tableName':_0x6b66('0x9'),'paranoid':![],'indexes':[{'name':_0x6b66('0xa'),'fields':[_0x6b66('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x67c2=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x5cb720,_0x3c4ed2){var _0x2bcaca=function(_0x23ca87){while(--_0x23ca87){_0x5cb720['push'](_0x5cb720['shift']());}};_0x2bcaca(++_0x3c4ed2);}(_0x67c2,0x195));var _0x267c=function(_0x54fdbf,_0x18b73f){_0x54fdbf=_0x54fdbf-0x0;var _0x3bd45f=_0x67c2[_0x54fdbf];return _0x3bd45f;};'use strict';var _=require(_0x267c('0x0'));var util=require(_0x267c('0x1'));var logger=require(_0x267c('0x2'))(_0x267c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x267c('0x4'));var fs=require('fs');var path=require(_0x267c('0x5'));var rimraf=require(_0x267c('0x6'));var config=require(_0x267c('0x7'));var attributes=require(_0x267c('0x8'));module[_0x267c('0x9')]=function(_0xaa3d0,_0x2fc221){return _0xaa3d0[_0x267c('0xa')]('FaxTransferReport',attributes,{'tableName':_0x267c('0xb'),'paranoid':![],'indexes':[{'name':_0x267c('0xc'),'fields':[_0x267c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 2a3638f..f2cebed 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 _0x3a94=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','stringify','code','error','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird'];(function(_0x933e38,_0x2cd6cf){var _0x4fba2c=function(_0x3052f7){while(--_0x3052f7){_0x933e38['push'](_0x933e38['shift']());}};_0x4fba2c(++_0x2cd6cf);}(_0x3a94,0x14c));var _0x43a9=function(_0x201fe0,_0x29a776){_0x201fe0=_0x201fe0-0x0;var _0x2eeb30=_0x3a94[_0x201fe0];return _0x2eeb30;};'use strict';var _=require(_0x43a9('0x0'));var util=require(_0x43a9('0x1'));var moment=require(_0x43a9('0x2'));var BPromise=require(_0x43a9('0x3'));var rs=require(_0x43a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43a9('0x5'))['db'];var utils=require(_0x43a9('0x6'));var logger=require(_0x43a9('0x7'))(_0x43a9('0x8'));var config=require(_0x43a9('0x9'));var jayson=require(_0x43a9('0xa'));var client=jayson[_0x43a9('0xb')][_0x43a9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3eeb15,_0x1fea75,_0x50fa34){return new BPromise(function(_0x15ad52,_0x96eb6){return client[_0x43a9('0xd')](_0x3eeb15,_0x50fa34)[_0x43a9('0xe')](function(_0x58ade4){logger['info'](_0x43a9('0xf'),_0x1fea75,'request\x20sent');logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x1fea75,'request\x20sent',JSON[_0x43a9('0x10')](_0x58ade4));if(_0x58ade4['error']){if(_0x58ade4['error'][_0x43a9('0x11')]===0x1f4){logger[_0x43a9('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x1fea75,_0x58ade4[_0x43a9('0x12')][_0x43a9('0x13')]);return _0x96eb6(_0x58ade4[_0x43a9('0x12')][_0x43a9('0x13')]);}logger[_0x43a9('0x12')](_0x43a9('0xf'),_0x1fea75,_0x58ade4['error'][_0x43a9('0x13')]);return _0x15ad52(_0x58ade4[_0x43a9('0x12')][_0x43a9('0x13')]);}else{logger[_0x43a9('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x1fea75,_0x43a9('0x15'));_0x15ad52(_0x58ade4[_0x43a9('0x16')][_0x43a9('0x13')]);}})[_0x43a9('0x17')](function(_0xe7bd48){logger[_0x43a9('0x12')](_0x43a9('0xf'),_0x1fea75,_0xe7bd48);_0x96eb6(_0xe7bd48);});});} \ No newline at end of file +var _0x3971=['debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2f5278,_0x20907e){var _0x347ab5=function(_0x4bfb1f){while(--_0x4bfb1f){_0x2f5278['push'](_0x2f5278['shift']());}};_0x347ab5(++_0x20907e);}(_0x3971,0x178));var _0x1397=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0x3971[_0x1fa759];return _0x2da9f4;};'use strict';var _=require(_0x1397('0x0'));var util=require(_0x1397('0x1'));var moment=require('moment');var BPromise=require(_0x1397('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1397('0x3'));var db=require(_0x1397('0x4'))['db'];var utils=require(_0x1397('0x5'));var logger=require(_0x1397('0x6'))(_0x1397('0x7'));var config=require(_0x1397('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1397('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x395efe,_0x52d307,_0x19b76a){return new BPromise(function(_0x8da98c,_0x33974d){return client[_0x1397('0xa')](_0x395efe,_0x19b76a)[_0x1397('0xb')](function(_0x3c3648){logger[_0x1397('0xc')](_0x1397('0xd'),_0x52d307,_0x1397('0xe'));logger[_0x1397('0xf')](_0x1397('0x10'),_0x52d307,_0x1397('0xe'),JSON[_0x1397('0x11')](_0x3c3648));if(_0x3c3648[_0x1397('0x12')]){if(_0x3c3648['error'][_0x1397('0x13')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x52d307,_0x3c3648[_0x1397('0x12')]['message']);return _0x33974d(_0x3c3648[_0x1397('0x12')][_0x1397('0x14')]);}logger[_0x1397('0x12')](_0x1397('0xd'),_0x52d307,_0x3c3648[_0x1397('0x12')][_0x1397('0x14')]);return _0x8da98c(_0x3c3648[_0x1397('0x12')]['message']);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x52d307,_0x1397('0xe'));_0x8da98c(_0x3c3648[_0x1397('0x15')][_0x1397('0x14')]);}})[_0x1397('0x16')](function(_0x378a52){logger['error'](_0x1397('0xd'),_0x52d307,_0x378a52);_0x33974d(_0x378a52);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 214d1ae..b52b1fc 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 _0x6e3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','isAuthenticated','/:id','show','post','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x6e3c,0x182));var _0xc6e3=function(_0x342ba6,_0x3ffa29){_0x342ba6=_0x342ba6-0x0;var _0x3d77d6=_0x6e3c[_0x342ba6];return _0x3d77d6;};'use strict';var multer=require('multer');var util=require(_0xc6e3('0x0'));var path=require(_0xc6e3('0x1'));var timeout=require(_0xc6e3('0x2'));var express=require('express');var router=express[_0xc6e3('0x3')]();var fs_extra=require(_0xc6e3('0x4'));var auth=require(_0xc6e3('0x5'));var interaction=require(_0xc6e3('0x6'));var config=require(_0xc6e3('0x7'));var controller=require(_0xc6e3('0x8'));router[_0xc6e3('0x9')]('/',auth['isAuthenticated'](),controller[_0xc6e3('0xa')]);router['get']('/describe',auth[_0xc6e3('0xb')](),controller['describe']);router[_0xc6e3('0x9')](_0xc6e3('0xc'),auth[_0xc6e3('0xb')](),controller[_0xc6e3('0xd')]);router[_0xc6e3('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc6e3('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc6e3('0xc'),auth['isAuthenticated'](),controller[_0xc6e3('0xf')]);module[_0xc6e3('0x10')]=router; \ No newline at end of file +var _0xbaee=['post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x54fc1f,_0x1703c2){var _0x53f699=function(_0x3fad74){while(--_0x3fad74){_0x54fc1f['push'](_0x54fc1f['shift']());}};_0x53f699(++_0x1703c2);}(_0xbaee,0x194));var _0xebae=function(_0x32e903,_0x51b914){_0x32e903=_0x32e903-0x0;var _0x2d6bbc=_0xbaee[_0x32e903];return _0x2d6bbc;};'use strict';var multer=require(_0xebae('0x0'));var util=require(_0xebae('0x1'));var path=require(_0xebae('0x2'));var timeout=require(_0xebae('0x3'));var express=require(_0xebae('0x4'));var router=express['Router']();var fs_extra=require(_0xebae('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xebae('0x6'));var config=require(_0xebae('0x7'));var controller=require(_0xebae('0x8'));router[_0xebae('0x9')]('/',auth[_0xebae('0xa')](),controller[_0xebae('0xb')]);router[_0xebae('0x9')](_0xebae('0xc'),auth[_0xebae('0xa')](),controller[_0xebae('0xd')]);router[_0xebae('0x9')](_0xebae('0xe'),auth[_0xebae('0xa')](),controller[_0xebae('0xf')]);router[_0xebae('0x10')]('/',auth[_0xebae('0xa')](),controller['create']);router[_0xebae('0x11')](_0xebae('0xe'),auth[_0xebae('0xa')](),controller['update']);router[_0xebae('0x12')](_0xebae('0xe'),auth[_0xebae('0xa')](),controller[_0xebae('0x13')]);module[_0xebae('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 4aeee94..3dc0f94 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 _0x8cd8=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','create'];(function(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0x8cd8,0x100));var _0x88cd=function(_0x4acae1,_0x1389f4){_0x4acae1=_0x4acae1-0x0;var _0x37120f=_0x8cd8[_0x4acae1];return _0x37120f;};'use strict';var multer=require(_0x88cd('0x0'));var util=require(_0x88cd('0x1'));var path=require(_0x88cd('0x2'));var timeout=require(_0x88cd('0x3'));var express=require(_0x88cd('0x4'));var router=express[_0x88cd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x88cd('0x6'));var interaction=require(_0x88cd('0x7'));var config=require('../../config/environment');var controller=require(_0x88cd('0x8'));router[_0x88cd('0x9')]('/',auth[_0x88cd('0xa')](),controller[_0x88cd('0xb')]);router['get'](_0x88cd('0xc'),auth[_0x88cd('0xa')](),controller['show']);router[_0x88cd('0x9')](_0x88cd('0xd'),auth[_0x88cd('0xa')](),controller['getConfigurations']);router[_0x88cd('0x9')](_0x88cd('0xe'),auth[_0x88cd('0xa')](),controller['getFields']);router[_0x88cd('0xf')]('/',auth[_0x88cd('0xa')](),controller[_0x88cd('0x10')]);router[_0x88cd('0xf')]('/:id/configurations',auth[_0x88cd('0xa')](),controller['addConfiguration']);router[_0x88cd('0x11')]('/:id',auth[_0x88cd('0xa')](),controller[_0x88cd('0x12')]);router[_0x88cd('0x13')](_0x88cd('0xc'),auth[_0x88cd('0xa')](),controller[_0x88cd('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc1a8=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','update','delete','destroy','exports','multer'];(function(_0x5d2657,_0x443333){var _0x391133=function(_0x13daa6){while(--_0x13daa6){_0x5d2657['push'](_0x5d2657['shift']());}};_0x391133(++_0x443333);}(_0xc1a8,0xe6));var _0x8c1a=function(_0x27c068,_0x342981){_0x27c068=_0x27c068-0x0;var _0xe5a67f=_0xc1a8[_0x27c068];return _0xe5a67f;};'use strict';var multer=require(_0x8c1a('0x0'));var util=require(_0x8c1a('0x1'));var path=require(_0x8c1a('0x2'));var timeout=require(_0x8c1a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8c1a('0x4'));var config=require(_0x8c1a('0x5'));var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8c1a('0x6')]);router[_0x8c1a('0x7')](_0x8c1a('0x8'),auth[_0x8c1a('0x9')](),controller['show']);router['get'](_0x8c1a('0xa'),auth[_0x8c1a('0x9')](),controller[_0x8c1a('0xb')]);router['get'](_0x8c1a('0xc'),auth[_0x8c1a('0x9')](),controller[_0x8c1a('0xd')]);router['post']('/',auth[_0x8c1a('0x9')](),controller[_0x8c1a('0xe')]);router[_0x8c1a('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x8c1a('0x10')](_0x8c1a('0x8'),auth[_0x8c1a('0x9')](),controller[_0x8c1a('0x11')]);router[_0x8c1a('0x12')](_0x8c1a('0x8'),auth[_0x8c1a('0x9')](),controller[_0x8c1a('0x13')]);module[_0x8c1a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 3888654..000fa18 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 _0xa0a3=['exports','STRING','ENUM','basic','integrationTab'];(function(_0x3ba577,_0x4c3ea0){var _0x583dfa=function(_0x20f929){while(--_0x20f929){_0x3ba577['push'](_0x3ba577['shift']());}};_0x583dfa(++_0x4c3ea0);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0xb471d2,_0x5b6a4a){_0xb471d2=_0xb471d2-0x0;var _0x50f608=_0xa0a3[_0xb471d2];return _0x50f608;};'use strict';var Sequelize=require('sequelize');module[_0x3a0a('0x0')]={'name':{'type':Sequelize[_0x3a0a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3a0a('0x1')]},'remoteUri':{'type':Sequelize[_0x3a0a('0x1')]},'authType':{'type':Sequelize[_0x3a0a('0x2')](_0x3a0a('0x3')),'defaultValue':_0x3a0a('0x3')},'password':{'type':Sequelize[_0x3a0a('0x1')]},'consumerKey':{'type':Sequelize[_0x3a0a('0x1')]},'consumerSecret':{'type':Sequelize[_0x3a0a('0x1')]},'token':{'type':Sequelize[_0x3a0a('0x1')]},'tokenSecret':{'type':Sequelize[_0x3a0a('0x1')]},'serverUrl':{'type':Sequelize[_0x3a0a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3a0a('0x2')](_0x3a0a('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x7292=['exports','STRING','ENUM','basic','integrationTab','sequelize'];(function(_0x354495,_0x5ec6f9){var _0x519b37=function(_0x295de2){while(--_0x295de2){_0x354495['push'](_0x354495['shift']());}};_0x519b37(++_0x5ec6f9);}(_0x7292,0x107));var _0x2729=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x7292[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0x2729('0x0'));module[_0x2729('0x1')]={'name':{'type':Sequelize[_0x2729('0x2')]},'description':{'type':Sequelize[_0x2729('0x2')]},'username':{'type':Sequelize[_0x2729('0x2')]},'remoteUri':{'type':Sequelize[_0x2729('0x2')]},'authType':{'type':Sequelize[_0x2729('0x3')]('basic'),'defaultValue':_0x2729('0x4')},'password':{'type':Sequelize[_0x2729('0x2')]},'consumerKey':{'type':Sequelize[_0x2729('0x2')]},'consumerSecret':{'type':Sequelize[_0x2729('0x2')]},'token':{'type':Sequelize[_0x2729('0x2')]},'tokenSecret':{'type':Sequelize[_0x2729('0x2')]},'serverUrl':{'type':Sequelize[_0x2729('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2729('0x3')](_0x2729('0x5'),'newTab'),'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 ab21ec6..2eee092 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 _0x5ce3=['fields','attributes','length','order','where','pick','filter','VIRTUAL','options','include','rows','params','includeAll','find','body','getConfigurations','findOne','DeskConfiguration','sort','merge','nolimit','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','create','DeskField','Descriptions','getFields','priority','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','lastIndexOf','format','%s/custom_fields','application/json','headers','Basic\x20%s','%s:%s','username','password','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x5ce3,0x19d));var _0x35ce=function(_0x2c93e2,_0x4fb5e2){_0x2c93e2=_0x2c93e2-0x0;var _0x57264e=_0x5ce3[_0x2c93e2];return _0x57264e;};'use strict';var pdf=require(_0x35ce('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x35ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35ce('0x2'));var rp=require('request-promise');var moment=require(_0x35ce('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x35ce('0x4'));var util=require(_0x35ce('0x5'));var path=require(_0x35ce('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x35ce('0x7'));var fs=require('fs');var fs_extra=require(_0x35ce('0x8'));var _=require('lodash');var squel=require(_0x35ce('0x9'));var crypto=require(_0x35ce('0xa'));var jsforce=require(_0x35ce('0xb'));var deskjs=require(_0x35ce('0xc'));var toCsv=require(_0x35ce('0xd'));var querystring=require(_0x35ce('0xe'));var Papa=require('papaparse');var Redis=require(_0x35ce('0xf'));var authService=require(_0x35ce('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x35ce('0x11'));var hardwareService=require(_0x35ce('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x35ce('0x13'));var config=require(_0x35ce('0x14'));var licenseUtil=require(_0x35ce('0x15'));var db=require(_0x35ce('0x16'))['db'];var integrations=require(_0x35ce('0x17'));var jayson=require(_0x35ce('0x18'));var client=jayson[_0x35ce('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x297984,_0x3929d8,_0x189ef1,_0x49f81a){return new BPromise(function(_0x5099b5,_0x5bf562){var _0x37ab18=_0x49f81a||client;return _0x37ab18['request'](_0x297984,_0x189ef1)[_0x35ce('0x1a')](function(_0x27046b){logger[_0x35ce('0x1b')](_0x35ce('0x1c'),_0x3929d8,_0x35ce('0x1d'));logger[_0x35ce('0x1e')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3929d8,'request\x20sent',JSON[_0x35ce('0x1f')](_0x27046b));if(_0x27046b['error']){if(_0x27046b[_0x35ce('0x20')][_0x35ce('0x21')]===0x1f4){logger[_0x35ce('0x20')](_0x35ce('0x1c'),_0x3929d8,_0x27046b[_0x35ce('0x20')][_0x35ce('0x22')]);return _0x5bf562(_0x27046b[_0x35ce('0x20')][_0x35ce('0x22')]);}logger[_0x35ce('0x20')]('DeskAccount,\x20%s,\x20%s',_0x3929d8,_0x27046b[_0x35ce('0x20')]['message']);return _0x5099b5(_0x27046b[_0x35ce('0x20')][_0x35ce('0x22')]);}else{logger['info'](_0x35ce('0x1c'),_0x3929d8,'request\x20sent');_0x5099b5(_0x27046b[_0x35ce('0x23')][_0x35ce('0x22')]);}})[_0x35ce('0x24')](function(_0x2f88c4){logger[_0x35ce('0x20')](_0x35ce('0x1c'),_0x3929d8,_0x2f88c4);_0x5bf562(_0x2f88c4);});});}function respondWithStatusCode(_0x4057ce,_0x4c265e){_0x4c265e=_0x4c265e||0xcc;return function(_0x646985){if(_0x646985){return _0x4057ce[_0x35ce('0x25')](_0x4c265e);}return _0x4057ce[_0x35ce('0x26')](_0x4c265e)[_0x35ce('0x27')]();};}function respondWithResult(_0x3238cc,_0x409724){_0x409724=_0x409724||0xc8;return function(_0xfb7a28){if(_0xfb7a28){return _0x3238cc[_0x35ce('0x26')](_0x409724)[_0x35ce('0x28')](_0xfb7a28);}};}function respondWithFilteredResult(_0x2658a9,_0x59407b){return function(_0x525130){if(_0x525130){var _0x16120d=_0x525130[_0x35ce('0x29')],_0x2fad14=_0x59407b['offset'],_0x3365ce=_0x59407b[_0x35ce('0x2a')]+_0x59407b[_0x35ce('0x2b')],_0x358e07;if(_0x3365ce>=_0x16120d){_0x3365ce=_0x16120d;_0x358e07=0xc8;}else{_0x358e07=0xce;}_0x2658a9[_0x35ce('0x26')](_0x358e07);return _0x2658a9['set']('Content-Range',_0x2fad14+'-'+_0x3365ce+'/'+_0x16120d)['json'](_0x525130);}return null;};}function patchUpdates(_0x1760a6){return function(_0x88f5d2){try{jsonpatch[_0x35ce('0x2c')](_0x88f5d2,_0x1760a6,!![]);}catch(_0x595a35){return BPromise[_0x35ce('0x2d')](_0x595a35);}return _0x88f5d2[_0x35ce('0x2e')]();};}function saveUpdates(_0x517883,_0x2d13f8){return function(_0x154eab){if(_0x154eab){return _0x154eab[_0x35ce('0x2f')](_0x517883)[_0x35ce('0x1a')](function(_0x23146a){return _0x23146a;});}return null;};}function removeEntity(_0xc2474e,_0x274d03){return function(_0x32b4f5){if(_0x32b4f5){return _0x32b4f5[_0x35ce('0x30')]()['then'](function(){_0xc2474e[_0x35ce('0x26')](0xcc)[_0x35ce('0x27')]();});}};}function handleEntityNotFound(_0x43ebbb,_0x1d5d3f){return function(_0x508db1){if(!_0x508db1){_0x43ebbb['sendStatus'](0x194);}return _0x508db1;};}function handleError(_0x2dbe6d,_0x6643aa){_0x6643aa=_0x6643aa||0x1f4;return function(_0x50f59b){logger[_0x35ce('0x20')](_0x50f59b[_0x35ce('0x31')]);if(_0x50f59b[_0x35ce('0x32')]){delete _0x50f59b[_0x35ce('0x32')];}_0x2dbe6d[_0x35ce('0x26')](_0x6643aa)[_0x35ce('0x33')](_0x50f59b);};}exports['index']=function(_0x23e965,_0xd0d69c){var _0x34a2a2={},_0x2c4694={},_0x57f6de={'count':0x0,'rows':[]};var _0x501b3e=_[_0x35ce('0x34')](db[_0x35ce('0x35')][_0x35ce('0x36')],function(_0x4b0b43){return{'name':_0x4b0b43[_0x35ce('0x37')],'type':_0x4b0b43[_0x35ce('0x38')][_0x35ce('0x39')]};});_0x2c4694[_0x35ce('0x3a')]=_[_0x35ce('0x34')](_0x501b3e,_0x35ce('0x32'));_0x2c4694[_0x35ce('0x3b')]=_[_0x35ce('0x3c')](_0x23e965[_0x35ce('0x3b')]);_0x2c4694[_0x35ce('0x3d')]=_['intersection'](_0x2c4694[_0x35ce('0x3a')],_0x2c4694['query']);_0x34a2a2['attributes']=_[_0x35ce('0x3e')](_0x2c4694[_0x35ce('0x3a')],qs[_0x35ce('0x3f')](_0x23e965[_0x35ce('0x3b')]['fields']));_0x34a2a2['attributes']=_0x34a2a2[_0x35ce('0x40')][_0x35ce('0x41')]?_0x34a2a2[_0x35ce('0x40')]:_0x2c4694[_0x35ce('0x3a')];if(!_0x23e965['query']['hasOwnProperty']('nolimit')){_0x34a2a2[_0x35ce('0x2b')]=qs['limit'](_0x23e965[_0x35ce('0x3b')][_0x35ce('0x2b')]);_0x34a2a2[_0x35ce('0x2a')]=qs['offset'](_0x23e965[_0x35ce('0x3b')][_0x35ce('0x2a')]);}_0x34a2a2[_0x35ce('0x42')]=qs['sort'](_0x23e965[_0x35ce('0x3b')]['sort']);_0x34a2a2[_0x35ce('0x43')]=qs[_0x35ce('0x3d')](_[_0x35ce('0x44')](_0x23e965[_0x35ce('0x3b')],_0x2c4694[_0x35ce('0x3d')]),_0x501b3e);if(_0x23e965[_0x35ce('0x3b')][_0x35ce('0x45')]){_0x34a2a2[_0x35ce('0x43')]=_['merge'](_0x34a2a2[_0x35ce('0x43')],{'$or':_['map'](_0x501b3e,function(_0x35efb9){if(_0x35efb9[_0x35ce('0x38')]!==_0x35ce('0x46')){var _0x357c2e={};_0x357c2e[_0x35efb9[_0x35ce('0x32')]]={'$like':'%'+_0x23e965[_0x35ce('0x3b')]['filter']+'%'};return _0x357c2e;}})});}_0x34a2a2=_['merge']({},_0x34a2a2,_0x23e965[_0x35ce('0x47')]);var _0x4540ae={'where':_0x34a2a2[_0x35ce('0x43')]};return db[_0x35ce('0x35')][_0x35ce('0x29')](_0x4540ae)[_0x35ce('0x1a')](function(_0x859cc){_0x57f6de['count']=_0x859cc;if(_0x23e965['query']['includeAll']){_0x34a2a2[_0x35ce('0x48')]=[{'all':!![]}];}return db[_0x35ce('0x35')]['findAll'](_0x34a2a2);})[_0x35ce('0x1a')](function(_0xc450c7){_0x57f6de[_0x35ce('0x49')]=_0xc450c7;return _0x57f6de;})[_0x35ce('0x1a')](respondWithFilteredResult(_0xd0d69c,_0x34a2a2))[_0x35ce('0x24')](handleError(_0xd0d69c,null));};exports['show']=function(_0x11572c,_0x1d0378){var _0x35ff01={'raw':![],'where':{'id':_0x11572c[_0x35ce('0x4a')]['id']}},_0x5ce698={};_0x5ce698[_0x35ce('0x3a')]=_[_0x35ce('0x3c')](db[_0x35ce('0x35')]['rawAttributes']);_0x5ce698['query']=_['keys'](_0x11572c[_0x35ce('0x3b')]);_0x5ce698[_0x35ce('0x3d')]=_['intersection'](_0x5ce698[_0x35ce('0x3a')],_0x5ce698[_0x35ce('0x3b')]);_0x35ff01[_0x35ce('0x40')]=_[_0x35ce('0x3e')](_0x5ce698[_0x35ce('0x3a')],qs[_0x35ce('0x3f')](_0x11572c[_0x35ce('0x3b')][_0x35ce('0x3f')]));_0x35ff01['attributes']=_0x35ff01[_0x35ce('0x40')][_0x35ce('0x41')]?_0x35ff01[_0x35ce('0x40')]:_0x5ce698[_0x35ce('0x3a')];if(_0x11572c[_0x35ce('0x3b')][_0x35ce('0x4b')]){_0x35ff01[_0x35ce('0x48')]=[{'all':!![]}];}_0x35ff01=_['merge']({},_0x35ff01,_0x11572c['options']);return db[_0x35ce('0x35')][_0x35ce('0x4c')](_0x35ff01)[_0x35ce('0x1a')](handleEntityNotFound(_0x1d0378,null))[_0x35ce('0x1a')](respondWithResult(_0x1d0378,null))[_0x35ce('0x24')](handleError(_0x1d0378,null));};exports['create']=function(_0x3479fe,_0x3cff41){return db[_0x35ce('0x35')]['create'](_0x3479fe[_0x35ce('0x4d')],{})[_0x35ce('0x1a')](respondWithResult(_0x3cff41,0xc9))[_0x35ce('0x24')](handleError(_0x3cff41,null));};exports['update']=function(_0x309239,_0xe5bcd3){if(_0x309239[_0x35ce('0x4d')]['id']){delete _0x309239[_0x35ce('0x4d')]['id'];}return db['DeskAccount'][_0x35ce('0x4c')]({'where':{'id':_0x309239['params']['id']}})['then'](handleEntityNotFound(_0xe5bcd3,null))[_0x35ce('0x1a')](saveUpdates(_0x309239[_0x35ce('0x4d')],null))[_0x35ce('0x1a')](respondWithResult(_0xe5bcd3,null))[_0x35ce('0x24')](handleError(_0xe5bcd3,null));};exports[_0x35ce('0x30')]=function(_0x2cc59b,_0x4e2592){return db[_0x35ce('0x35')][_0x35ce('0x4c')]({'where':{'id':_0x2cc59b['params']['id']}})[_0x35ce('0x1a')](handleEntityNotFound(_0x4e2592,null))[_0x35ce('0x1a')](removeEntity(_0x4e2592,null))[_0x35ce('0x24')](handleError(_0x4e2592,null));};exports[_0x35ce('0x4e')]=function(_0x437621,_0x2a7b02,_0x2b794b){var _0xe99b7d={};var _0x4fbb62={};var _0x3b0296;var _0x168f41;return db[_0x35ce('0x35')][_0x35ce('0x4f')]({'where':{'id':_0x437621[_0x35ce('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a7b02,null))['then'](function(_0x2070f4){if(_0x2070f4){_0x3b0296=_0x2070f4;_0x4fbb62[_0x35ce('0x3a')]=_['keys'](db[_0x35ce('0x50')][_0x35ce('0x36')]);_0x4fbb62[_0x35ce('0x3b')]=_['keys'](_0x437621[_0x35ce('0x3b')]);_0x4fbb62[_0x35ce('0x3d')]=_['intersection'](_0x4fbb62[_0x35ce('0x3a')],_0x4fbb62[_0x35ce('0x3b')]);_0xe99b7d[_0x35ce('0x40')]=_['intersection'](_0x4fbb62[_0x35ce('0x3a')],qs[_0x35ce('0x3f')](_0x437621['query'][_0x35ce('0x3f')]));_0xe99b7d[_0x35ce('0x40')]=_0xe99b7d['attributes'][_0x35ce('0x41')]?_0xe99b7d[_0x35ce('0x40')]:_0x4fbb62[_0x35ce('0x3a')];_0xe99b7d[_0x35ce('0x42')]=qs[_0x35ce('0x51')](_0x437621['query']['sort']);_0xe99b7d[_0x35ce('0x43')]=qs['filters'](_['pick'](_0x437621[_0x35ce('0x3b')],_0x4fbb62[_0x35ce('0x3d')]));if(_0x437621[_0x35ce('0x3b')][_0x35ce('0x45')]){_0xe99b7d[_0x35ce('0x43')]=_[_0x35ce('0x52')](_0xe99b7d['where'],{'$or':_[_0x35ce('0x34')](_0xe99b7d[_0x35ce('0x40')],function(_0x335003){var _0x105017={};_0x105017[_0x335003]={'$like':'%'+_0x437621[_0x35ce('0x3b')]['filter']+'%'};return _0x105017;})});}_0xe99b7d=_['merge']({},_0xe99b7d,_0x437621[_0x35ce('0x47')]);return _0x3b0296[_0x35ce('0x4e')](_0xe99b7d);}})[_0x35ce('0x1a')](function(_0x44682b){if(_0x44682b){_0x168f41=_0x44682b[_0x35ce('0x41')];if(!_0x437621[_0x35ce('0x3b')]['hasOwnProperty'](_0x35ce('0x53'))){_0xe99b7d[_0x35ce('0x2b')]=qs[_0x35ce('0x2b')](_0x437621['query'][_0x35ce('0x2b')]);_0xe99b7d[_0x35ce('0x2a')]=qs['offset'](_0x437621[_0x35ce('0x3b')][_0x35ce('0x2a')]);}return _0x3b0296[_0x35ce('0x4e')](_0xe99b7d);}})[_0x35ce('0x1a')](function(_0x5229c1){if(_0x5229c1){return _0x5229c1?{'count':_0x168f41,'rows':_0x5229c1}:null;}})[_0x35ce('0x1a')](respondWithResult(_0x2a7b02,null))[_0x35ce('0x24')](handleError(_0x2a7b02,null));};exports[_0x35ce('0x54')]=function(_0x41884b,_0x3cc29b,_0x425a6f){if(_0x41884b[_0x35ce('0x4d')]['id']){delete _0x41884b[_0x35ce('0x4d')]['id'];}return db['DeskAccount'][_0x35ce('0x4f')]({'where':{'id':_0x41884b[_0x35ce('0x4a')]['id']}})[_0x35ce('0x1a')](handleEntityNotFound(_0x3cc29b,null))['then'](function(_0x226890){if(_0x226890){_0x41884b['body'][_0x35ce('0x55')]=_0x226890['id'];_0x41884b[_0x35ce('0x4d')][_0x35ce('0x56')]=integrations[_0x35ce('0x57')](_0x41884b[_0x35ce('0x4d')]['channel'],_0x41884b[_0x35ce('0x4d')]['type']);_0x41884b['body']['Descriptions']=integrations[_0x35ce('0x58')](_0x41884b[_0x35ce('0x4d')][_0x35ce('0x59')],_0x41884b[_0x35ce('0x4d')]['type']);return db[_0x35ce('0x50')][_0x35ce('0x5a')](_0x41884b['body'],{'include':[{'model':db[_0x35ce('0x5b')],'as':_0x35ce('0x56')},{'model':db['DeskField'],'as':_0x35ce('0x5c')}]});}return null;})['then'](respondWithResult(_0x3cc29b,null))[_0x35ce('0x24')](handleError(_0x3cc29b,null));};exports[_0x35ce('0x5d')]=function(_0x4217e6,_0x3dec0,_0x5e265d){var _0x565221=[{'name':_0x35ce('0x5e'),'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 _0x2adce7='';return db[_0x35ce('0x35')][_0x35ce('0x4f')]({'where':{'id':_0x4217e6[_0x35ce('0x4a')]['id']},'attributes':['id',_0x35ce('0x5f'),_0x35ce('0x60'),'username','password',_0x35ce('0x61'),_0x35ce('0x62'),_0x35ce('0x63'),_0x35ce('0x64')]})[_0x35ce('0x1a')](handleEntityNotFound(_0x3dec0,null))[_0x35ce('0x1a')](function(_0x47d212){if(_0x47d212){_0x2adce7=_0x47d212[_0x35ce('0x5f')];var _0xcad3cc=_0x2adce7['slice'](-0x1);if(_0xcad3cc==='/'){_0x2adce7=_0x2adce7['substring'](0x0,_0x2adce7[_0x35ce('0x65')](_0xcad3cc));}var _0x23f2ba={'method':'GET','uri':util[_0x35ce('0x66')](_0x35ce('0x67'),_0x2adce7),'headers':{'Content-Type':_0x35ce('0x68'),'Accept':_0x35ce('0x68')},'json':!![]};if(_0x47d212[_0x35ce('0x60')]==='basic'){_0x23f2ba[_0x35ce('0x69')]['Authorization']=util[_0x35ce('0x66')](_0x35ce('0x6a'),new Buffer(util[_0x35ce('0x66')](_0x35ce('0x6b'),_0x47d212[_0x35ce('0x6c')],_0x47d212[_0x35ce('0x6d')]))[_0x35ce('0x6e')](_0x35ce('0x6f')));}return rp(_0x23f2ba)[_0x35ce('0x1a')](function(_0x3ba48b){return _0x565221[_0x35ce('0x70')](_[_0x35ce('0x34')](_0x3ba48b[_0x35ce('0x71')][_0x35ce('0x72')],function(_0x5abb02){return{'id':_0x5abb02[_0x35ce('0x32')],'name':_0x5abb02['name'],'type':_0x5abb02[_0x35ce('0x38')],'active':_0x5abb02['active'],'label':_0x5abb02[_0x35ce('0x73')],'custom':!![]};}));});}})['then'](function(_0x11a29b){return{'count':_0x11a29b[_0x35ce('0x41')],'rows':_0x11a29b};})[_0x35ce('0x1a')](respondWithResult(_0x3dec0,null))['catch'](function(_0x3322b5){var _0x2e0b5b=_0x4217e6[_0x35ce('0x3b')][_0x35ce('0x74')]?0x1f4:_0x3322b5[_0x35ce('0x75')]||0x1f4;logger[_0x35ce('0x20')](_0x35ce('0x76'),_0x35ce('0x5d'),_0x2e0b5b,JSON[_0x35ce('0x1f')](_0x3322b5));delete _0x3322b5[_0x35ce('0x32')];if(_0x2e0b5b===0x191){_0x2e0b5b=0x190;}_0x3dec0[_0x35ce('0x26')](_0x2e0b5b)['send'](_0x4217e6[_0x35ce('0x3b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3322b5[_0x35ce('0x75')]}:_0x3322b5);});}; \ No newline at end of file +var _0x695a=['username','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','password','toString','concat','_embedded','entries','active','label','test','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','findAll','rows','show','options','find','create','body','getConfigurations','findOne','params','DeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType'];(function(_0x4bd043,_0x2ae539){var _0x4333f0=function(_0x55a839){while(--_0x55a839){_0x4bd043['push'](_0x4bd043['shift']());}};_0x4333f0(++_0x2ae539);}(_0x695a,0x9a));var _0xa695=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x695a[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0xa695('0x0'));var emlformat=require(_0xa695('0x1'));var rimraf=require(_0xa695('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa695('0x3'));var rp=require(_0xa695('0x4'));var moment=require(_0xa695('0x5'));var BPromise=require(_0xa695('0x6'));var Mustache=require(_0xa695('0x7'));var util=require('util');var path=require(_0xa695('0x8'));var sox=require(_0xa695('0x9'));var csv=require(_0xa695('0xa'));var ejs=require(_0xa695('0xb'));var fs=require('fs');var fs_extra=require(_0xa695('0xc'));var _=require(_0xa695('0xd'));var squel=require(_0xa695('0xe'));var crypto=require('crypto');var jsforce=require(_0xa695('0xf'));var deskjs=require(_0xa695('0x10'));var toCsv=require(_0xa695('0xa'));var querystring=require('querystring');var Papa=require(_0xa695('0x11'));var Redis=require(_0xa695('0x12'));var authService=require(_0xa695('0x13'));var qs=require(_0xa695('0x14'));var as=require(_0xa695('0x15'));var hardwareService=require(_0xa695('0x16'));var logger=require(_0xa695('0x17'))(_0xa695('0x18'));var utils=require(_0xa695('0x19'));var config=require(_0xa695('0x1a'));var licenseUtil=require(_0xa695('0x1b'));var db=require(_0xa695('0x1c'))['db'];var integrations=require(_0xa695('0x1d'));var jayson=require(_0xa695('0x1e'));var client=jayson[_0xa695('0x1f')][_0xa695('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5d05c3,_0x1839e8,_0x402c0e,_0x2287e1){return new BPromise(function(_0x328778,_0x3bdbaa){var _0x28b0af=_0x2287e1||client;return _0x28b0af[_0xa695('0x21')](_0x5d05c3,_0x402c0e)[_0xa695('0x22')](function(_0xe71279){logger[_0xa695('0x23')](_0xa695('0x24'),_0x1839e8,_0xa695('0x25'));logger[_0xa695('0x26')](_0xa695('0x27'),_0x1839e8,'request\x20sent',JSON[_0xa695('0x28')](_0xe71279));if(_0xe71279[_0xa695('0x29')]){if(_0xe71279['error']['code']===0x1f4){logger[_0xa695('0x29')](_0xa695('0x24'),_0x1839e8,_0xe71279[_0xa695('0x29')]['message']);return _0x3bdbaa(_0xe71279[_0xa695('0x29')][_0xa695('0x2a')]);}logger['error'](_0xa695('0x24'),_0x1839e8,_0xe71279[_0xa695('0x29')][_0xa695('0x2a')]);return _0x328778(_0xe71279[_0xa695('0x29')][_0xa695('0x2a')]);}else{logger[_0xa695('0x23')](_0xa695('0x24'),_0x1839e8,'request\x20sent');_0x328778(_0xe71279['result'][_0xa695('0x2a')]);}})[_0xa695('0x2b')](function(_0x34aead){logger['error'](_0xa695('0x24'),_0x1839e8,_0x34aead);_0x3bdbaa(_0x34aead);});});}function respondWithStatusCode(_0x2ea117,_0x87d33f){_0x87d33f=_0x87d33f||0xcc;return function(_0x56df90){if(_0x56df90){return _0x2ea117['sendStatus'](_0x87d33f);}return _0x2ea117[_0xa695('0x2c')](_0x87d33f)['end']();};}function respondWithResult(_0xfb83c7,_0x2fb968){_0x2fb968=_0x2fb968||0xc8;return function(_0x4251fe){if(_0x4251fe){return _0xfb83c7[_0xa695('0x2c')](_0x2fb968)[_0xa695('0x2d')](_0x4251fe);}};}function respondWithFilteredResult(_0x5f05db,_0x123cd1){return function(_0x10b8a3){if(_0x10b8a3){var _0x92d92b=_0x10b8a3[_0xa695('0x2e')],_0x44f533=_0x123cd1['offset'],_0x3bc6ad=_0x123cd1[_0xa695('0x2f')]+_0x123cd1[_0xa695('0x30')],_0x1b5bdb;if(_0x3bc6ad>=_0x92d92b){_0x3bc6ad=_0x92d92b;_0x1b5bdb=0xc8;}else{_0x1b5bdb=0xce;}_0x5f05db[_0xa695('0x2c')](_0x1b5bdb);return _0x5f05db['set'](_0xa695('0x31'),_0x44f533+'-'+_0x3bc6ad+'/'+_0x92d92b)['json'](_0x10b8a3);}return null;};}function patchUpdates(_0x24fe45){return function(_0x2552cf){try{jsonpatch[_0xa695('0x32')](_0x2552cf,_0x24fe45,!![]);}catch(_0x590a8a){return BPromise[_0xa695('0x33')](_0x590a8a);}return _0x2552cf[_0xa695('0x34')]();};}function saveUpdates(_0x547a55,_0x25b5d2){return function(_0x22207a){if(_0x22207a){return _0x22207a[_0xa695('0x35')](_0x547a55)['then'](function(_0x14715c){return _0x14715c;});}return null;};}function removeEntity(_0x5d20e6,_0x534f16){return function(_0x2c5bee){if(_0x2c5bee){return _0x2c5bee[_0xa695('0x36')]()['then'](function(){_0x5d20e6[_0xa695('0x2c')](0xcc)[_0xa695('0x37')]();});}};}function handleEntityNotFound(_0x40f8ac,_0x546d6c){return function(_0x3af22a){if(!_0x3af22a){_0x40f8ac[_0xa695('0x38')](0x194);}return _0x3af22a;};}function handleError(_0x410fe8,_0x4750d0){_0x4750d0=_0x4750d0||0x1f4;return function(_0x5830aa){logger['error'](_0x5830aa[_0xa695('0x39')]);if(_0x5830aa[_0xa695('0x3a')]){delete _0x5830aa[_0xa695('0x3a')];}_0x410fe8[_0xa695('0x2c')](_0x4750d0)[_0xa695('0x3b')](_0x5830aa);};}exports[_0xa695('0x3c')]=function(_0x1fa220,_0x1b6b71){var _0x333bde={},_0x392a8a={},_0x1574d5={'count':0x0,'rows':[]};var _0x402200=_[_0xa695('0x3d')](db[_0xa695('0x3e')][_0xa695('0x3f')],function(_0x48d8fd){return{'name':_0x48d8fd['fieldName'],'type':_0x48d8fd[_0xa695('0x40')][_0xa695('0x41')]};});_0x392a8a[_0xa695('0x42')]=_[_0xa695('0x3d')](_0x402200,_0xa695('0x3a'));_0x392a8a[_0xa695('0x43')]=_[_0xa695('0x44')](_0x1fa220[_0xa695('0x43')]);_0x392a8a[_0xa695('0x45')]=_['intersection'](_0x392a8a[_0xa695('0x42')],_0x392a8a[_0xa695('0x43')]);_0x333bde[_0xa695('0x46')]=_[_0xa695('0x47')](_0x392a8a[_0xa695('0x42')],qs[_0xa695('0x48')](_0x1fa220[_0xa695('0x43')][_0xa695('0x48')]));_0x333bde[_0xa695('0x46')]=_0x333bde[_0xa695('0x46')][_0xa695('0x49')]?_0x333bde[_0xa695('0x46')]:_0x392a8a['model'];if(!_0x1fa220['query'][_0xa695('0x4a')](_0xa695('0x4b'))){_0x333bde['limit']=qs['limit'](_0x1fa220[_0xa695('0x43')]['limit']);_0x333bde[_0xa695('0x2f')]=qs['offset'](_0x1fa220[_0xa695('0x43')][_0xa695('0x2f')]);}_0x333bde[_0xa695('0x4c')]=qs[_0xa695('0x4d')](_0x1fa220[_0xa695('0x43')][_0xa695('0x4d')]);_0x333bde[_0xa695('0x4e')]=qs[_0xa695('0x45')](_['pick'](_0x1fa220['query'],_0x392a8a[_0xa695('0x45')]),_0x402200);if(_0x1fa220[_0xa695('0x43')][_0xa695('0x4f')]){_0x333bde['where']=_[_0xa695('0x50')](_0x333bde[_0xa695('0x4e')],{'$or':_[_0xa695('0x3d')](_0x402200,function(_0x159475){if(_0x159475[_0xa695('0x40')]!=='VIRTUAL'){var _0x3340e2={};_0x3340e2[_0x159475['name']]={'$like':'%'+_0x1fa220[_0xa695('0x43')][_0xa695('0x4f')]+'%'};return _0x3340e2;}})});}_0x333bde=_[_0xa695('0x50')]({},_0x333bde,_0x1fa220['options']);var _0x2ebda0={'where':_0x333bde['where']};return db[_0xa695('0x3e')]['count'](_0x2ebda0)[_0xa695('0x22')](function(_0x1824f2){_0x1574d5[_0xa695('0x2e')]=_0x1824f2;if(_0x1fa220['query']['includeAll']){_0x333bde[_0xa695('0x51')]=[{'all':!![]}];}return db[_0xa695('0x3e')][_0xa695('0x52')](_0x333bde);})[_0xa695('0x22')](function(_0x5c3c7d){_0x1574d5[_0xa695('0x53')]=_0x5c3c7d;return _0x1574d5;})[_0xa695('0x22')](respondWithFilteredResult(_0x1b6b71,_0x333bde))[_0xa695('0x2b')](handleError(_0x1b6b71,null));};exports[_0xa695('0x54')]=function(_0x3d1edd,_0x46bc0b){var _0x2af84c={'raw':![],'where':{'id':_0x3d1edd['params']['id']}},_0x254a08={};_0x254a08[_0xa695('0x42')]=_[_0xa695('0x44')](db['DeskAccount'][_0xa695('0x3f')]);_0x254a08[_0xa695('0x43')]=_[_0xa695('0x44')](_0x3d1edd[_0xa695('0x43')]);_0x254a08[_0xa695('0x45')]=_[_0xa695('0x47')](_0x254a08[_0xa695('0x42')],_0x254a08[_0xa695('0x43')]);_0x2af84c['attributes']=_[_0xa695('0x47')](_0x254a08['model'],qs['fields'](_0x3d1edd[_0xa695('0x43')][_0xa695('0x48')]));_0x2af84c[_0xa695('0x46')]=_0x2af84c[_0xa695('0x46')]['length']?_0x2af84c[_0xa695('0x46')]:_0x254a08['model'];if(_0x3d1edd[_0xa695('0x43')]['includeAll']){_0x2af84c[_0xa695('0x51')]=[{'all':!![]}];}_0x2af84c=_[_0xa695('0x50')]({},_0x2af84c,_0x3d1edd[_0xa695('0x55')]);return db[_0xa695('0x3e')][_0xa695('0x56')](_0x2af84c)[_0xa695('0x22')](handleEntityNotFound(_0x46bc0b,null))[_0xa695('0x22')](respondWithResult(_0x46bc0b,null))[_0xa695('0x2b')](handleError(_0x46bc0b,null));};exports[_0xa695('0x57')]=function(_0x5bea92,_0x3d2b72){return db[_0xa695('0x3e')][_0xa695('0x57')](_0x5bea92[_0xa695('0x58')],{})[_0xa695('0x22')](respondWithResult(_0x3d2b72,0xc9))[_0xa695('0x2b')](handleError(_0x3d2b72,null));};exports['update']=function(_0x5e0820,_0x2fc4cb){if(_0x5e0820[_0xa695('0x58')]['id']){delete _0x5e0820[_0xa695('0x58')]['id'];}return db[_0xa695('0x3e')][_0xa695('0x56')]({'where':{'id':_0x5e0820['params']['id']}})[_0xa695('0x22')](handleEntityNotFound(_0x2fc4cb,null))[_0xa695('0x22')](saveUpdates(_0x5e0820[_0xa695('0x58')],null))[_0xa695('0x22')](respondWithResult(_0x2fc4cb,null))[_0xa695('0x2b')](handleError(_0x2fc4cb,null));};exports[_0xa695('0x36')]=function(_0x3244d7,_0x446abe){return db[_0xa695('0x3e')]['find']({'where':{'id':_0x3244d7['params']['id']}})[_0xa695('0x22')](handleEntityNotFound(_0x446abe,null))[_0xa695('0x22')](removeEntity(_0x446abe,null))['catch'](handleError(_0x446abe,null));};exports[_0xa695('0x59')]=function(_0x5970f3,_0xa02638,_0xa32c5f){var _0xf4950f={};var _0x1b0b64={};var _0x593e12;var _0x2eab39;return db[_0xa695('0x3e')][_0xa695('0x5a')]({'where':{'id':_0x5970f3[_0xa695('0x5b')]['id']}})[_0xa695('0x22')](handleEntityNotFound(_0xa02638,null))[_0xa695('0x22')](function(_0x5cd634){if(_0x5cd634){_0x593e12=_0x5cd634;_0x1b0b64['model']=_['keys'](db[_0xa695('0x5c')]['rawAttributes']);_0x1b0b64[_0xa695('0x43')]=_[_0xa695('0x44')](_0x5970f3[_0xa695('0x43')]);_0x1b0b64[_0xa695('0x45')]=_[_0xa695('0x47')](_0x1b0b64[_0xa695('0x42')],_0x1b0b64[_0xa695('0x43')]);_0xf4950f[_0xa695('0x46')]=_[_0xa695('0x47')](_0x1b0b64['model'],qs[_0xa695('0x48')](_0x5970f3[_0xa695('0x43')][_0xa695('0x48')]));_0xf4950f[_0xa695('0x46')]=_0xf4950f['attributes'][_0xa695('0x49')]?_0xf4950f[_0xa695('0x46')]:_0x1b0b64[_0xa695('0x42')];_0xf4950f['order']=qs[_0xa695('0x4d')](_0x5970f3[_0xa695('0x43')]['sort']);_0xf4950f[_0xa695('0x4e')]=qs['filters'](_[_0xa695('0x5d')](_0x5970f3[_0xa695('0x43')],_0x1b0b64[_0xa695('0x45')]));if(_0x5970f3[_0xa695('0x43')][_0xa695('0x4f')]){_0xf4950f[_0xa695('0x4e')]=_[_0xa695('0x50')](_0xf4950f['where'],{'$or':_[_0xa695('0x3d')](_0xf4950f[_0xa695('0x46')],function(_0x227f46){var _0x1252de={};_0x1252de[_0x227f46]={'$like':'%'+_0x5970f3[_0xa695('0x43')][_0xa695('0x4f')]+'%'};return _0x1252de;})});}_0xf4950f=_[_0xa695('0x50')]({},_0xf4950f,_0x5970f3['options']);return _0x593e12[_0xa695('0x59')](_0xf4950f);}})[_0xa695('0x22')](function(_0x57117d){if(_0x57117d){_0x2eab39=_0x57117d[_0xa695('0x49')];if(!_0x5970f3[_0xa695('0x43')][_0xa695('0x4a')]('nolimit')){_0xf4950f[_0xa695('0x30')]=qs[_0xa695('0x30')](_0x5970f3[_0xa695('0x43')]['limit']);_0xf4950f['offset']=qs[_0xa695('0x2f')](_0x5970f3[_0xa695('0x43')][_0xa695('0x2f')]);}return _0x593e12[_0xa695('0x59')](_0xf4950f);}})[_0xa695('0x22')](function(_0x4df728){if(_0x4df728){return _0x4df728?{'count':_0x2eab39,'rows':_0x4df728}:null;}})['then'](respondWithResult(_0xa02638,null))['catch'](handleError(_0xa02638,null));};exports[_0xa695('0x5e')]=function(_0x4b9804,_0x13d7f2,_0x257e02){if(_0x4b9804['body']['id']){delete _0x4b9804[_0xa695('0x58')]['id'];}return db[_0xa695('0x3e')][_0xa695('0x5a')]({'where':{'id':_0x4b9804[_0xa695('0x5b')]['id']}})[_0xa695('0x22')](handleEntityNotFound(_0x13d7f2,null))[_0xa695('0x22')](function(_0x2ffefe){if(_0x2ffefe){_0x4b9804[_0xa695('0x58')][_0xa695('0x5f')]=_0x2ffefe['id'];_0x4b9804[_0xa695('0x58')][_0xa695('0x60')]=integrations[_0xa695('0x61')](_0x4b9804[_0xa695('0x58')][_0xa695('0x62')],_0x4b9804[_0xa695('0x58')][_0xa695('0x40')]);_0x4b9804[_0xa695('0x58')][_0xa695('0x63')]=integrations[_0xa695('0x64')](_0x4b9804[_0xa695('0x58')]['channel'],_0x4b9804[_0xa695('0x58')][_0xa695('0x40')]);return db[_0xa695('0x5c')][_0xa695('0x57')](_0x4b9804[_0xa695('0x58')],{'include':[{'model':db[_0xa695('0x65')],'as':_0xa695('0x60')},{'model':db[_0xa695('0x65')],'as':_0xa695('0x63')}]});}return null;})['then'](respondWithResult(_0x13d7f2,null))['catch'](handleError(_0x13d7f2,null));};exports[_0xa695('0x66')]=function(_0x31a223,_0x50f8a8,_0x208e41){var _0x5ebd71=[{'name':'priority','label':_0xa695('0x67'),'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 _0x5b44ce='';return db['DeskAccount'][_0xa695('0x5a')]({'where':{'id':_0x31a223[_0xa695('0x5b')]['id']},'attributes':['id',_0xa695('0x68'),_0xa695('0x69'),_0xa695('0x6a'),'password','consumerKey',_0xa695('0x6b'),_0xa695('0x6c'),_0xa695('0x6d')]})[_0xa695('0x22')](handleEntityNotFound(_0x50f8a8,null))[_0xa695('0x22')](function(_0x4e7f72){if(_0x4e7f72){_0x5b44ce=_0x4e7f72[_0xa695('0x68')];var _0x845a20=_0x5b44ce['slice'](-0x1);if(_0x845a20==='/'){_0x5b44ce=_0x5b44ce[_0xa695('0x6e')](0x0,_0x5b44ce[_0xa695('0x6f')](_0x845a20));}var _0x393261={'method':_0xa695('0x70'),'uri':util[_0xa695('0x71')](_0xa695('0x72'),_0x5b44ce),'headers':{'Content-Type':_0xa695('0x73'),'Accept':_0xa695('0x73')},'json':!![]};if(_0x4e7f72[_0xa695('0x69')]===_0xa695('0x74')){_0x393261[_0xa695('0x75')]['Authorization']=util['format'](_0xa695('0x76'),new Buffer(util[_0xa695('0x71')](_0xa695('0x77'),_0x4e7f72[_0xa695('0x6a')],_0x4e7f72[_0xa695('0x78')]))[_0xa695('0x79')]('base64'));}return rp(_0x393261)[_0xa695('0x22')](function(_0x491a60){return _0x5ebd71[_0xa695('0x7a')](_[_0xa695('0x3d')](_0x491a60[_0xa695('0x7b')][_0xa695('0x7c')],function(_0xbea060){return{'id':_0xbea060[_0xa695('0x3a')],'name':_0xbea060[_0xa695('0x3a')],'type':_0xbea060[_0xa695('0x40')],'active':_0xbea060[_0xa695('0x7d')],'label':_0xbea060[_0xa695('0x7e')],'custom':!![]};}));});}})['then'](function(_0x1b101e){return{'count':_0x1b101e[_0xa695('0x49')],'rows':_0x1b101e};})[_0xa695('0x22')](respondWithResult(_0x50f8a8,null))[_0xa695('0x2b')](function(_0x49ef44){var _0x5ddc9c=_0x31a223[_0xa695('0x43')][_0xa695('0x7f')]?0x1f4:_0x49ef44['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xa695('0x66'),_0x5ddc9c,JSON[_0xa695('0x28')](_0x49ef44));delete _0x49ef44[_0xa695('0x3a')];if(_0x5ddc9c===0x191){_0x5ddc9c=0x190;}_0x50f8a8[_0xa695('0x2c')](_0x5ddc9c)['send'](_0x31a223[_0xa695('0x43')][_0xa695('0x7f')]?{'message':_0xa695('0x80'),'statusCode':_0x49ef44[_0xa695('0x81')]}:_0x49ef44);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 2c27466..791f916 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 _0x375d=['int_desk_accounts','util','api','moment','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount'];(function(_0x32ee50,_0x564493){var _0x12a1b3=function(_0x3d6bc8){while(--_0x3d6bc8){_0x32ee50['push'](_0x32ee50['shift']());}};_0x12a1b3(++_0x564493);}(_0x375d,0xd3));var _0xd375=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x375d[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xd375('0x0'));var logger=require('../../config/logger')(_0xd375('0x1'));var moment=require(_0xd375('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd375('0x3'));var config=require(_0xd375('0x4'));var attributes=require(_0xd375('0x5'));var integrations=require(_0xd375('0x6'));module[_0xd375('0x7')]=function(_0x2a3b52,_0x6e9b95){return _0x2a3b52['define'](_0xd375('0x8'),attributes,{'tableName':_0xd375('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2098=['path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','int_desk_accounts','lodash','util','api','moment','bluebird'];(function(_0x765f11,_0x3a7171){var _0x2a5b10=function(_0x48e8f4){while(--_0x48e8f4){_0x765f11['push'](_0x765f11['shift']());}};_0x2a5b10(++_0x3a7171);}(_0x2098,0x1f3));var _0x8209=function(_0x4500b6,_0x454690){_0x4500b6=_0x4500b6-0x0;var _0x15cb63=_0x2098[_0x4500b6];return _0x15cb63;};'use strict';var _=require(_0x8209('0x0'));var util=require(_0x8209('0x1'));var logger=require('../../config/logger')(_0x8209('0x2'));var moment=require(_0x8209('0x3'));var BPromise=require(_0x8209('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8209('0x5'));var rimraf=require(_0x8209('0x6'));var config=require(_0x8209('0x7'));var attributes=require(_0x8209('0x8'));var integrations=require(_0x8209('0x9'));module[_0x8209('0xa')]=function(_0xfad5cb,_0x22f751){return _0xfad5cb['define']('DeskAccount',attributes,{'tableName':_0x8209('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 62f8082..b0f2827 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 _0xe73d=['DeskAccount','find','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetDeskAccount','options','raw','attributes','limit','include','map','model','ShowDeskAccount'];(function(_0x581b3e,_0x222e35){var _0x457586=function(_0xd1d8a3){while(--_0xd1d8a3){_0x581b3e['push'](_0x581b3e['shift']());}};_0x457586(++_0x222e35);}(_0xe73d,0x19b));var _0xde73=function(_0x5b3ef8,_0x5f32df){_0x5b3ef8=_0x5b3ef8-0x0;var _0xd4ef43=_0xe73d[_0x5b3ef8];return _0xd4ef43;};'use strict';var _=require(_0xde73('0x0'));var util=require('util');var moment=require(_0xde73('0x1'));var BPromise=require('bluebird');var rs=require(_0xde73('0x2'));var fs=require('fs');var Redis=require(_0xde73('0x3'));var db=require(_0xde73('0x4'))['db'];var utils=require(_0xde73('0x5'));var logger=require('../../config/logger')(_0xde73('0x6'));var config=require(_0xde73('0x7'));var jayson=require(_0xde73('0x8'));var client=jayson['client'][_0xde73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ab85f,_0x2ee144,_0x40cded){return new BPromise(function(_0x2660b6,_0x16185c){return client[_0xde73('0xa')](_0x1ab85f,_0x40cded)[_0xde73('0xb')](function(_0x44c55f){logger[_0xde73('0xc')](_0xde73('0xd'),_0x2ee144,_0xde73('0xe'));logger[_0xde73('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2ee144,_0xde73('0xe'),JSON[_0xde73('0x10')](_0x44c55f));if(_0x44c55f[_0xde73('0x11')]){if(_0x44c55f[_0xde73('0x11')][_0xde73('0x12')]===0x1f4){logger[_0xde73('0x11')]('DeskAccount,\x20%s,\x20%s',_0x2ee144,_0x44c55f[_0xde73('0x11')][_0xde73('0x13')]);return _0x16185c(_0x44c55f[_0xde73('0x11')][_0xde73('0x13')]);}logger[_0xde73('0x11')](_0xde73('0xd'),_0x2ee144,_0x44c55f[_0xde73('0x11')][_0xde73('0x13')]);return _0x2660b6(_0x44c55f['error']['message']);}else{logger['info'](_0xde73('0xd'),_0x2ee144,'request\x20sent');_0x2660b6(_0x44c55f[_0xde73('0x14')]['message']);}})[_0xde73('0x15')](function(_0x1c84e3){logger[_0xde73('0x11')](_0xde73('0xd'),_0x2ee144,_0x1c84e3);_0x16185c(_0x1c84e3);});});}exports[_0xde73('0x16')]=function(_0x13fde6){var _0x505980=this;return new Promise(function(_0x59fc61,_0x374dd2){return db['DeskAccount']['findAll']({'raw':_0x13fde6[_0xde73('0x17')]?_0x13fde6[_0xde73('0x17')][_0xde73('0x18')]===undefined?!![]:![]:!![],'where':_0x13fde6[_0xde73('0x17')]?_0x13fde6[_0xde73('0x17')]['where']||null:null,'attributes':_0x13fde6[_0xde73('0x17')]?_0x13fde6[_0xde73('0x17')][_0xde73('0x19')]||null:null,'limit':_0x13fde6[_0xde73('0x17')]?_0x13fde6['options'][_0xde73('0x1a')]||null:null,'include':_0x13fde6[_0xde73('0x17')]?_0x13fde6[_0xde73('0x17')][_0xde73('0x1b')]?_[_0xde73('0x1c')](_0x13fde6['options'][_0xde73('0x1b')],function(_0x291b3a){return{'model':db[_0x291b3a[_0xde73('0x1d')]],'as':_0x291b3a['as'],'attributes':_0x291b3a['attributes'],'include':_0x291b3a[_0xde73('0x1b')]?_[_0xde73('0x1c')](_0x291b3a['include'],function(_0x2788a0){return{'model':db[_0x2788a0[_0xde73('0x1d')]],'as':_0x2788a0['as'],'attributes':_0x2788a0[_0xde73('0x19')],'include':_0x2788a0[_0xde73('0x1b')]?_[_0xde73('0x1c')](_0x2788a0[_0xde73('0x1b')],function(_0x2d6c0a){return{'model':db[_0x2d6c0a['model']],'as':_0x2d6c0a['as'],'attributes':_0x2d6c0a[_0xde73('0x19')]};}):[]};}):[]};}):[]:[]})[_0xde73('0xb')](function(_0x2f25d1){logger[_0xde73('0xc')](_0xde73('0x16'),_0x13fde6);logger[_0xde73('0xf')](_0xde73('0x16'),_0x13fde6,JSON['stringify'](_0x2f25d1));_0x59fc61(_0x2f25d1);})[_0xde73('0x15')](function(_0x1ded39){logger[_0xde73('0x11')](_0xde73('0x16'),_0x1ded39[_0xde73('0x13')],_0x13fde6);_0x374dd2(_0x505980[_0xde73('0x11')](0x1f4,_0x1ded39['message']));});});};exports[_0xde73('0x1e')]=function(_0x3888e4){var _0x48d32c=this;return new Promise(function(_0x1d8fb9,_0x4db3b0){return db[_0xde73('0x1f')][_0xde73('0x20')]({'raw':_0x3888e4['options']?_0x3888e4[_0xde73('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3888e4['options']?_0x3888e4[_0xde73('0x17')][_0xde73('0x21')]||null:null,'attributes':_0x3888e4[_0xde73('0x17')]?_0x3888e4[_0xde73('0x17')]['attributes']||null:null,'include':_0x3888e4[_0xde73('0x17')]?_0x3888e4['options'][_0xde73('0x1b')]?_[_0xde73('0x1c')](_0x3888e4[_0xde73('0x17')][_0xde73('0x1b')],function(_0x5bff01){return{'model':db[_0x5bff01['model']],'as':_0x5bff01['as'],'attributes':_0x5bff01[_0xde73('0x19')],'include':_0x5bff01[_0xde73('0x1b')]?_[_0xde73('0x1c')](_0x5bff01[_0xde73('0x1b')],function(_0x1f4dfc){return{'model':db[_0x1f4dfc[_0xde73('0x1d')]],'as':_0x1f4dfc['as'],'attributes':_0x1f4dfc[_0xde73('0x19')],'include':_0x1f4dfc['include']?_[_0xde73('0x1c')](_0x1f4dfc[_0xde73('0x1b')],function(_0xf1843d){return{'model':db[_0xf1843d[_0xde73('0x1d')]],'as':_0xf1843d['as'],'attributes':_0xf1843d[_0xde73('0x19')]};}):[]};}):[]};}):[]:[]})[_0xde73('0xb')](function(_0x7116dc){logger[_0xde73('0xc')](_0xde73('0x1e'),_0x3888e4);logger['debug'](_0xde73('0x1e'),_0x3888e4,JSON[_0xde73('0x10')](_0x7116dc));_0x1d8fb9(_0x7116dc);})[_0xde73('0x15')](function(_0x31b21d){logger[_0xde73('0x11')]('ShowDeskAccount',_0x31b21d[_0xde73('0x13')],_0x3888e4);_0x4db3b0(_0x48d32c[_0xde73('0x11')](0x1f4,_0x31b21d['message']));});});}; \ No newline at end of file +var _0xb873=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','attributes','limit','include','map','model','ShowDeskAccount','find','where','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x528133,_0x16adbf){var _0x3bd49d=function(_0x5d5aa5){while(--_0x5d5aa5){_0x528133['push'](_0x528133['shift']());}};_0x3bd49d(++_0x16adbf);}(_0xb873,0x162));var _0x3b87=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xb873[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x3b87('0x0'));var util=require(_0x3b87('0x1'));var moment=require(_0x3b87('0x2'));var BPromise=require(_0x3b87('0x3'));var rs=require(_0x3b87('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3b87('0x5'));var logger=require(_0x3b87('0x6'))(_0x3b87('0x7'));var config=require(_0x3b87('0x8'));var jayson=require(_0x3b87('0x9'));var client=jayson['client'][_0x3b87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1da142,_0x560ccd,_0x581a6e){return new BPromise(function(_0xa74267,_0xe678cc){return client[_0x3b87('0xb')](_0x1da142,_0x581a6e)[_0x3b87('0xc')](function(_0x5c12b1){logger[_0x3b87('0xd')](_0x3b87('0xe'),_0x560ccd,_0x3b87('0xf'));logger[_0x3b87('0x10')](_0x3b87('0x11'),_0x560ccd,'request\x20sent',JSON[_0x3b87('0x12')](_0x5c12b1));if(_0x5c12b1['error']){if(_0x5c12b1[_0x3b87('0x13')][_0x3b87('0x14')]===0x1f4){logger[_0x3b87('0x13')](_0x3b87('0xe'),_0x560ccd,_0x5c12b1[_0x3b87('0x13')][_0x3b87('0x15')]);return _0xe678cc(_0x5c12b1['error'][_0x3b87('0x15')]);}logger['error'](_0x3b87('0xe'),_0x560ccd,_0x5c12b1[_0x3b87('0x13')]['message']);return _0xa74267(_0x5c12b1[_0x3b87('0x13')][_0x3b87('0x15')]);}else{logger[_0x3b87('0xd')](_0x3b87('0xe'),_0x560ccd,_0x3b87('0xf'));_0xa74267(_0x5c12b1[_0x3b87('0x16')][_0x3b87('0x15')]);}})[_0x3b87('0x17')](function(_0x47f30b){logger[_0x3b87('0x13')](_0x3b87('0xe'),_0x560ccd,_0x47f30b);_0xe678cc(_0x47f30b);});});}exports[_0x3b87('0x18')]=function(_0x54b0d2){var _0x420924=this;return new Promise(function(_0x568324,_0x290188){return db[_0x3b87('0x19')]['findAll']({'raw':_0x54b0d2[_0x3b87('0x1a')]?_0x54b0d2[_0x3b87('0x1a')][_0x3b87('0x1b')]===undefined?!![]:![]:!![],'where':_0x54b0d2['options']?_0x54b0d2['options']['where']||null:null,'attributes':_0x54b0d2[_0x3b87('0x1a')]?_0x54b0d2[_0x3b87('0x1a')][_0x3b87('0x1c')]||null:null,'limit':_0x54b0d2[_0x3b87('0x1a')]?_0x54b0d2[_0x3b87('0x1a')][_0x3b87('0x1d')]||null:null,'include':_0x54b0d2[_0x3b87('0x1a')]?_0x54b0d2[_0x3b87('0x1a')][_0x3b87('0x1e')]?_[_0x3b87('0x1f')](_0x54b0d2[_0x3b87('0x1a')]['include'],function(_0x5f0f5f){return{'model':db[_0x5f0f5f[_0x3b87('0x20')]],'as':_0x5f0f5f['as'],'attributes':_0x5f0f5f[_0x3b87('0x1c')],'include':_0x5f0f5f[_0x3b87('0x1e')]?_[_0x3b87('0x1f')](_0x5f0f5f[_0x3b87('0x1e')],function(_0x107260){return{'model':db[_0x107260[_0x3b87('0x20')]],'as':_0x107260['as'],'attributes':_0x107260[_0x3b87('0x1c')],'include':_0x107260[_0x3b87('0x1e')]?_[_0x3b87('0x1f')](_0x107260['include'],function(_0x164732){return{'model':db[_0x164732['model']],'as':_0x164732['as'],'attributes':_0x164732['attributes']};}):[]};}):[]};}):[]:[]})[_0x3b87('0xc')](function(_0x1acbc9){logger[_0x3b87('0xd')](_0x3b87('0x18'),_0x54b0d2);logger[_0x3b87('0x10')]('GetDeskAccount',_0x54b0d2,JSON[_0x3b87('0x12')](_0x1acbc9));_0x568324(_0x1acbc9);})[_0x3b87('0x17')](function(_0x142e55){logger['error'](_0x3b87('0x18'),_0x142e55[_0x3b87('0x15')],_0x54b0d2);_0x290188(_0x420924['error'](0x1f4,_0x142e55['message']));});});};exports[_0x3b87('0x21')]=function(_0x1d8c6f){var _0x4cfad1=this;return new Promise(function(_0x41ea2f,_0x4ae878){return db[_0x3b87('0x19')][_0x3b87('0x22')]({'raw':_0x1d8c6f['options']?_0x1d8c6f[_0x3b87('0x1a')][_0x3b87('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d8c6f['options']?_0x1d8c6f[_0x3b87('0x1a')][_0x3b87('0x23')]||null:null,'attributes':_0x1d8c6f[_0x3b87('0x1a')]?_0x1d8c6f[_0x3b87('0x1a')][_0x3b87('0x1c')]||null:null,'include':_0x1d8c6f['options']?_0x1d8c6f['options'][_0x3b87('0x1e')]?_[_0x3b87('0x1f')](_0x1d8c6f[_0x3b87('0x1a')][_0x3b87('0x1e')],function(_0x4d0e22){return{'model':db[_0x4d0e22[_0x3b87('0x20')]],'as':_0x4d0e22['as'],'attributes':_0x4d0e22['attributes'],'include':_0x4d0e22[_0x3b87('0x1e')]?_[_0x3b87('0x1f')](_0x4d0e22[_0x3b87('0x1e')],function(_0x27726b){return{'model':db[_0x27726b[_0x3b87('0x20')]],'as':_0x27726b['as'],'attributes':_0x27726b['attributes'],'include':_0x27726b['include']?_[_0x3b87('0x1f')](_0x27726b[_0x3b87('0x1e')],function(_0x1d4c4a){return{'model':db[_0x1d4c4a[_0x3b87('0x20')]],'as':_0x1d4c4a['as'],'attributes':_0x1d4c4a[_0x3b87('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3b87('0xc')](function(_0x2c4689){logger[_0x3b87('0xd')](_0x3b87('0x21'),_0x1d8c6f);logger['debug'](_0x3b87('0x21'),_0x1d8c6f,JSON[_0x3b87('0x12')](_0x2c4689));_0x41ea2f(_0x2c4689);})[_0x3b87('0x17')](function(_0x575b92){logger[_0x3b87('0x13')]('ShowDeskAccount',_0x575b92['message'],_0x1d8c6f);_0x4ae878(_0x4cfad1[_0x3b87('0x13')](0x1f4,_0x575b92[_0x3b87('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 0d00e88..571972e 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 _0x6008=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x2cfced,_0x133626){var _0x55aa1f=function(_0x4d6a06){while(--_0x4d6a06){_0x2cfced['push'](_0x2cfced['shift']());}};_0x55aa1f(++_0x133626);}(_0x6008,0x125));var _0x8600=function(_0x4a1e27,_0x4fa470){_0x4a1e27=_0x4a1e27-0x0;var _0x126b66=_0x6008[_0x4a1e27];return _0x126b66;};'use strict';var multer=require(_0x8600('0x0'));var util=require(_0x8600('0x1'));var path=require(_0x8600('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8600('0x3')]();var fs_extra=require(_0x8600('0x4'));var auth=require(_0x8600('0x5'));var interaction=require(_0x8600('0x6'));var config=require('../../config/environment');var controller=require('./intDeskConfiguration.controller');router[_0x8600('0x7')]('/',auth[_0x8600('0x8')](),controller[_0x8600('0x9')]);router['get'](_0x8600('0xa'),auth[_0x8600('0x8')](),controller[_0x8600('0xb')]);router[_0x8600('0x7')](_0x8600('0xc'),auth[_0x8600('0x8')](),controller['getFields']);router[_0x8600('0x7')](_0x8600('0xd'),auth['isAuthenticated'](),controller[_0x8600('0xe')]);router[_0x8600('0x7')](_0x8600('0xf'),auth[_0x8600('0x8')](),controller[_0x8600('0x10')]);router[_0x8600('0x7')]('/:id/tags',auth[_0x8600('0x8')](),controller[_0x8600('0x11')]);router[_0x8600('0x12')]('/',auth[_0x8600('0x8')](),controller[_0x8600('0x13')]);router[_0x8600('0x12')](_0x8600('0x14'),auth[_0x8600('0x8')](),controller[_0x8600('0x15')]);router[_0x8600('0x16')]('/:id',auth[_0x8600('0x8')](),controller[_0x8600('0x17')]);router[_0x8600('0x18')](_0x8600('0xa'),auth[_0x8600('0x8')](),controller[_0x8600('0x19')]);module[_0x8600('0x1a')]=router; \ No newline at end of file +var _0x5b8d=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','delete','destroy','multer'];(function(_0x61245c,_0x12f55f){var _0x442588=function(_0x33f89e){while(--_0x33f89e){_0x61245c['push'](_0x61245c['shift']());}};_0x442588(++_0x12f55f);}(_0x5b8d,0x72));var _0xd5b8=function(_0x551ce7,_0x3c05d7){_0x551ce7=_0x551ce7-0x0;var _0x11ce51=_0x5b8d[_0x551ce7];return _0x11ce51;};'use strict';var multer=require(_0xd5b8('0x0'));var util=require(_0xd5b8('0x1'));var path=require(_0xd5b8('0x2'));var timeout=require('connect-timeout');var express=require(_0xd5b8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd5b8('0x4'));var interaction=require(_0xd5b8('0x5'));var config=require(_0xd5b8('0x6'));var controller=require(_0xd5b8('0x7'));router[_0xd5b8('0x8')]('/',auth[_0xd5b8('0x9')](),controller[_0xd5b8('0xa')]);router[_0xd5b8('0x8')](_0xd5b8('0xb'),auth[_0xd5b8('0x9')](),controller[_0xd5b8('0xc')]);router['get']('/:id/fields',auth[_0xd5b8('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth[_0xd5b8('0x9')](),controller['getSubjects']);router[_0xd5b8('0x8')](_0xd5b8('0xd'),auth['isAuthenticated'](),controller[_0xd5b8('0xe')]);router[_0xd5b8('0x8')](_0xd5b8('0xf'),auth['isAuthenticated'](),controller[_0xd5b8('0x10')]);router[_0xd5b8('0x11')]('/',auth[_0xd5b8('0x9')](),controller[_0xd5b8('0x12')]);router[_0xd5b8('0x11')]('/:id/tags',auth[_0xd5b8('0x9')](),controller['setTags']);router[_0xd5b8('0x13')](_0xd5b8('0xb'),auth[_0xd5b8('0x9')](),controller[_0xd5b8('0x14')]);router[_0xd5b8('0x15')](_0xd5b8('0xb'),auth['isAuthenticated'](),controller[_0xd5b8('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index e266136..b075462 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 _0x005e=['STRING'];(function(_0x4e9d95,_0x40784d){var _0x1654f7=function(_0x34f7fc){while(--_0x34f7fc){_0x4e9d95['push'](_0x4e9d95['shift']());}};_0x1654f7(++_0x40784d);}(_0x005e,0x11f));var _0xe005=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x005e[_0x3bab09];return _0x164376;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe005('0x0')]},'description':{'type':Sequelize[_0xe005('0x0')]}}; \ No newline at end of file +var _0x9eeb=['sequelize','exports','STRING'];(function(_0x51ad85,_0x2c6852){var _0x44ea75=function(_0x3ba743){while(--_0x3ba743){_0x51ad85['push'](_0x51ad85['shift']());}};_0x44ea75(++_0x2c6852);}(_0x9eeb,0xd8));var _0xb9ee=function(_0x2de99c,_0x3235b4){_0x2de99c=_0x2de99c-0x0;var _0x5b32e3=_0x9eeb[_0x2de99c];return _0x5b32e3;};'use strict';var Sequelize=require(_0xb9ee('0x0'));module[_0xb9ee('0x1')]={'name':{'type':Sequelize[_0xb9ee('0x2')]},'description':{'type':Sequelize[_0xb9ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 2db0697..e5fb0d8 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 _0xd8f3=['then','destroy','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','DeskConfiguration','includeAll','params','keys','include','find','create','body','DeskField','length','order','getFields','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0xd8f3,0x88));var _0x3d8f=function(_0x1ca22e,_0x561ca6){_0x1ca22e=_0x1ca22e-0x0;var _0x5c53b3=_0xd8f3[_0x1ca22e];return _0x5c53b3;};'use strict';var pdf=require(_0x3d8f('0x0'));var emlformat=require(_0x3d8f('0x1'));var rimraf=require(_0x3d8f('0x2'));var zipdir=require(_0x3d8f('0x3'));var jsonpatch=require(_0x3d8f('0x4'));var rp=require(_0x3d8f('0x5'));var moment=require(_0x3d8f('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3d8f('0x7'));var util=require('util');var path=require(_0x3d8f('0x8'));var sox=require('sox');var csv=require(_0x3d8f('0x9'));var ejs=require(_0x3d8f('0xa'));var fs=require('fs');var fs_extra=require(_0x3d8f('0xb'));var _=require(_0x3d8f('0xc'));var squel=require(_0x3d8f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3d8f('0x9'));var querystring=require(_0x3d8f('0xe'));var Papa=require('papaparse');var Redis=require(_0x3d8f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3d8f('0x10'));var as=require(_0x3d8f('0x11'));var hardwareService=require(_0x3d8f('0x12'));var logger=require(_0x3d8f('0x13'))(_0x3d8f('0x14'));var utils=require(_0x3d8f('0x15'));var config=require(_0x3d8f('0x16'));var licenseUtil=require(_0x3d8f('0x17'));var db=require(_0x3d8f('0x18'))['db'];var jayson=require(_0x3d8f('0x19'));var client=jayson['client'][_0x3d8f('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x41d263,_0x4f776c,_0x1afd1c,_0x12a181){return new BPromise(function(_0x4f1ede,_0x223e55){var _0x2d27c0=_0x12a181||client;return _0x2d27c0[_0x3d8f('0x1b')](_0x41d263,_0x1afd1c)['then'](function(_0x515f80){logger[_0x3d8f('0x1c')](_0x3d8f('0x1d'),_0x4f776c,_0x3d8f('0x1e'));logger[_0x3d8f('0x1f')](_0x3d8f('0x20'),_0x4f776c,'request\x20sent',JSON[_0x3d8f('0x21')](_0x515f80));if(_0x515f80[_0x3d8f('0x22')]){if(_0x515f80[_0x3d8f('0x22')][_0x3d8f('0x23')]===0x1f4){logger[_0x3d8f('0x22')](_0x3d8f('0x1d'),_0x4f776c,_0x515f80[_0x3d8f('0x22')][_0x3d8f('0x24')]);return _0x223e55(_0x515f80[_0x3d8f('0x22')][_0x3d8f('0x24')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4f776c,_0x515f80[_0x3d8f('0x22')][_0x3d8f('0x24')]);return _0x4f1ede(_0x515f80[_0x3d8f('0x22')]['message']);}else{logger[_0x3d8f('0x1c')](_0x3d8f('0x1d'),_0x4f776c,_0x3d8f('0x1e'));_0x4f1ede(_0x515f80[_0x3d8f('0x25')]['message']);}})[_0x3d8f('0x26')](function(_0x41d388){logger[_0x3d8f('0x22')](_0x3d8f('0x1d'),_0x4f776c,_0x41d388);_0x223e55(_0x41d388);});});}function respondWithStatusCode(_0x2b6491,_0x8b06f6){_0x8b06f6=_0x8b06f6||0xcc;return function(_0x14aac6){if(_0x14aac6){return _0x2b6491[_0x3d8f('0x27')](_0x8b06f6);}return _0x2b6491[_0x3d8f('0x28')](_0x8b06f6)[_0x3d8f('0x29')]();};}function respondWithResult(_0x36f9db,_0x1dca31){_0x1dca31=_0x1dca31||0xc8;return function(_0x2d562e){if(_0x2d562e){return _0x36f9db['status'](_0x1dca31)['json'](_0x2d562e);}};}function respondWithFilteredResult(_0x283d4f,_0x72cbab){return function(_0x496fc5){if(_0x496fc5){var _0x246d8d=_0x496fc5[_0x3d8f('0x2a')],_0x3b1d3d=_0x72cbab[_0x3d8f('0x2b')],_0x2a07ca=_0x72cbab[_0x3d8f('0x2b')]+_0x72cbab[_0x3d8f('0x2c')],_0x5b32c7;if(_0x2a07ca>=_0x246d8d){_0x2a07ca=_0x246d8d;_0x5b32c7=0xc8;}else{_0x5b32c7=0xce;}_0x283d4f[_0x3d8f('0x28')](_0x5b32c7);return _0x283d4f[_0x3d8f('0x2d')](_0x3d8f('0x2e'),_0x3b1d3d+'-'+_0x2a07ca+'/'+_0x246d8d)[_0x3d8f('0x2f')](_0x496fc5);}return null;};}function patchUpdates(_0x1b6267){return function(_0x3c1d1c){try{jsonpatch[_0x3d8f('0x30')](_0x3c1d1c,_0x1b6267,!![]);}catch(_0x7e7ce6){return BPromise[_0x3d8f('0x31')](_0x7e7ce6);}return _0x3c1d1c[_0x3d8f('0x32')]();};}function saveUpdates(_0x33385d,_0x1a95f4){return function(_0x5e61ed){if(_0x5e61ed){return _0x5e61ed[_0x3d8f('0x33')](_0x33385d)[_0x3d8f('0x34')](function(_0x448649){return _0x448649;});}return null;};}function removeEntity(_0x572224,_0x489d2d){return function(_0x99a7f3){if(_0x99a7f3){return _0x99a7f3[_0x3d8f('0x35')]()[_0x3d8f('0x34')](function(){_0x572224[_0x3d8f('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e5782,_0x4af51d){return function(_0x261896){if(!_0x261896){_0x4e5782[_0x3d8f('0x27')](0x194);}return _0x261896;};}function handleError(_0x3ab812,_0x1d32d4){_0x1d32d4=_0x1d32d4||0x1f4;return function(_0x3c6767){logger[_0x3d8f('0x22')](_0x3c6767['stack']);if(_0x3c6767[_0x3d8f('0x36')]){delete _0x3c6767[_0x3d8f('0x36')];}_0x3ab812['status'](_0x1d32d4)[_0x3d8f('0x37')](_0x3c6767);};}exports[_0x3d8f('0x38')]=function(_0x434323,_0x1763ea){var _0x2d180f={},_0x3ede87={},_0x36027e={'count':0x0,'rows':[]};var _0x243728=_[_0x3d8f('0x39')](db['DeskConfiguration'][_0x3d8f('0x3a')],function(_0x412545){return{'name':_0x412545[_0x3d8f('0x3b')],'type':_0x412545[_0x3d8f('0x3c')]['key']};});_0x3ede87[_0x3d8f('0x3d')]=_[_0x3d8f('0x39')](_0x243728,_0x3d8f('0x36'));_0x3ede87[_0x3d8f('0x3e')]=_['keys'](_0x434323[_0x3d8f('0x3e')]);_0x3ede87[_0x3d8f('0x3f')]=_[_0x3d8f('0x40')](_0x3ede87['model'],_0x3ede87[_0x3d8f('0x3e')]);_0x2d180f[_0x3d8f('0x41')]=_['intersection'](_0x3ede87['model'],qs[_0x3d8f('0x42')](_0x434323[_0x3d8f('0x3e')][_0x3d8f('0x42')]));_0x2d180f[_0x3d8f('0x41')]=_0x2d180f[_0x3d8f('0x41')]['length']?_0x2d180f[_0x3d8f('0x41')]:_0x3ede87[_0x3d8f('0x3d')];if(!_0x434323[_0x3d8f('0x3e')][_0x3d8f('0x43')](_0x3d8f('0x44'))){_0x2d180f[_0x3d8f('0x2c')]=qs[_0x3d8f('0x2c')](_0x434323[_0x3d8f('0x3e')]['limit']);_0x2d180f[_0x3d8f('0x2b')]=qs[_0x3d8f('0x2b')](_0x434323[_0x3d8f('0x3e')][_0x3d8f('0x2b')]);}_0x2d180f['order']=qs[_0x3d8f('0x45')](_0x434323[_0x3d8f('0x3e')]['sort']);_0x2d180f['where']=qs[_0x3d8f('0x3f')](_[_0x3d8f('0x46')](_0x434323[_0x3d8f('0x3e')],_0x3ede87[_0x3d8f('0x3f')]),_0x243728);if(_0x434323[_0x3d8f('0x3e')]['filter']){_0x2d180f[_0x3d8f('0x47')]=_['merge'](_0x2d180f[_0x3d8f('0x47')],{'$or':_[_0x3d8f('0x39')](_0x243728,function(_0x55a41e){if(_0x55a41e[_0x3d8f('0x3c')]!==_0x3d8f('0x48')){var _0x4f733e={};_0x4f733e[_0x55a41e[_0x3d8f('0x36')]]={'$like':'%'+_0x434323[_0x3d8f('0x3e')][_0x3d8f('0x49')]+'%'};return _0x4f733e;}})});}_0x2d180f=_[_0x3d8f('0x4a')]({},_0x2d180f,_0x434323[_0x3d8f('0x4b')]);var _0x1309b6={'where':_0x2d180f[_0x3d8f('0x47')]};return db[_0x3d8f('0x4c')][_0x3d8f('0x2a')](_0x1309b6)['then'](function(_0x19d35d){_0x36027e[_0x3d8f('0x2a')]=_0x19d35d;if(_0x434323[_0x3d8f('0x3e')][_0x3d8f('0x4d')]){_0x2d180f['include']=[{'all':!![]}];}return db[_0x3d8f('0x4c')]['findAll'](_0x2d180f);})[_0x3d8f('0x34')](function(_0x4cade6){_0x36027e['rows']=_0x4cade6;return _0x36027e;})['then'](respondWithFilteredResult(_0x1763ea,_0x2d180f))[_0x3d8f('0x26')](handleError(_0x1763ea,null));};exports['show']=function(_0x137039,_0x54533b){var _0x2471b1={'raw':![],'where':{'id':_0x137039[_0x3d8f('0x4e')]['id']}},_0x316b42={};_0x316b42[_0x3d8f('0x3d')]=_[_0x3d8f('0x4f')](db[_0x3d8f('0x4c')][_0x3d8f('0x3a')]);_0x316b42[_0x3d8f('0x3e')]=_[_0x3d8f('0x4f')](_0x137039[_0x3d8f('0x3e')]);_0x316b42['filters']=_[_0x3d8f('0x40')](_0x316b42[_0x3d8f('0x3d')],_0x316b42['query']);_0x2471b1[_0x3d8f('0x41')]=_[_0x3d8f('0x40')](_0x316b42[_0x3d8f('0x3d')],qs[_0x3d8f('0x42')](_0x137039[_0x3d8f('0x3e')][_0x3d8f('0x42')]));_0x2471b1['attributes']=_0x2471b1['attributes']['length']?_0x2471b1[_0x3d8f('0x41')]:_0x316b42[_0x3d8f('0x3d')];if(_0x137039[_0x3d8f('0x3e')]['includeAll']){_0x2471b1[_0x3d8f('0x50')]=[{'all':!![]}];}_0x2471b1=_['merge']({},_0x2471b1,_0x137039['options']);return db[_0x3d8f('0x4c')][_0x3d8f('0x51')](_0x2471b1)['then'](handleEntityNotFound(_0x54533b,null))[_0x3d8f('0x34')](respondWithResult(_0x54533b,null))[_0x3d8f('0x26')](handleError(_0x54533b,null));};exports['create']=function(_0xc76e3,_0x610046){return db['DeskConfiguration'][_0x3d8f('0x52')](_0xc76e3['body'],{})[_0x3d8f('0x34')](respondWithResult(_0x610046,0xc9))[_0x3d8f('0x26')](handleError(_0x610046,null));};exports[_0x3d8f('0x33')]=function(_0x52d1ae,_0x3dd4cc){if(_0x52d1ae[_0x3d8f('0x53')]['id']){delete _0x52d1ae[_0x3d8f('0x53')]['id'];}return db['DeskConfiguration'][_0x3d8f('0x51')]({'where':{'id':_0x52d1ae['params']['id']}})['then'](handleEntityNotFound(_0x3dd4cc,null))['then'](saveUpdates(_0x52d1ae['body'],null))[_0x3d8f('0x34')](respondWithResult(_0x3dd4cc,null))[_0x3d8f('0x26')](handleError(_0x3dd4cc,null));};exports[_0x3d8f('0x35')]=function(_0x28018c,_0x1adb6d){return db[_0x3d8f('0x4c')][_0x3d8f('0x51')]({'where':{'id':_0x28018c[_0x3d8f('0x4e')]['id']}})[_0x3d8f('0x34')](handleEntityNotFound(_0x1adb6d,null))['then'](removeEntity(_0x1adb6d,null))[_0x3d8f('0x26')](handleError(_0x1adb6d,null));};exports['getFields']=function(_0x1f9551,_0x57ef45,_0x238375){var _0x541b8d={};var _0x58eeb2={};var _0xcaf922;var _0x5578d4;return db['DeskConfiguration']['findOne']({'where':{'id':_0x1f9551[_0x3d8f('0x4e')]['id']}})[_0x3d8f('0x34')](handleEntityNotFound(_0x57ef45,null))[_0x3d8f('0x34')](function(_0x14380e){if(_0x14380e){_0xcaf922=_0x14380e;_0x58eeb2[_0x3d8f('0x3d')]=_[_0x3d8f('0x4f')](db[_0x3d8f('0x54')]['rawAttributes']);_0x58eeb2['query']=_[_0x3d8f('0x4f')](_0x1f9551[_0x3d8f('0x3e')]);_0x58eeb2['filters']=_[_0x3d8f('0x40')](_0x58eeb2[_0x3d8f('0x3d')],_0x58eeb2[_0x3d8f('0x3e')]);_0x541b8d['attributes']=_[_0x3d8f('0x40')](_0x58eeb2[_0x3d8f('0x3d')],qs[_0x3d8f('0x42')](_0x1f9551[_0x3d8f('0x3e')][_0x3d8f('0x42')]));_0x541b8d['attributes']=_0x541b8d[_0x3d8f('0x41')][_0x3d8f('0x55')]?_0x541b8d[_0x3d8f('0x41')]:_0x58eeb2[_0x3d8f('0x3d')];_0x541b8d[_0x3d8f('0x56')]=qs[_0x3d8f('0x45')](_0x1f9551[_0x3d8f('0x3e')]['sort']);_0x541b8d[_0x3d8f('0x47')]=qs[_0x3d8f('0x3f')](_[_0x3d8f('0x46')](_0x1f9551[_0x3d8f('0x3e')],_0x58eeb2[_0x3d8f('0x3f')]));if(_0x1f9551[_0x3d8f('0x3e')]['filter']){_0x541b8d[_0x3d8f('0x47')]=_[_0x3d8f('0x4a')](_0x541b8d[_0x3d8f('0x47')],{'$or':_['map'](_0x541b8d[_0x3d8f('0x41')],function(_0x1af0cd){var _0x55c12a={};_0x55c12a[_0x1af0cd]={'$like':'%'+_0x1f9551['query'][_0x3d8f('0x49')]+'%'};return _0x55c12a;})});}_0x541b8d=_[_0x3d8f('0x4a')]({},_0x541b8d,_0x1f9551['options']);return _0xcaf922[_0x3d8f('0x57')](_0x541b8d);}})['then'](function(_0x494e05){if(_0x494e05){_0x5578d4=_0x494e05[_0x3d8f('0x55')];if(!_0x1f9551['query'][_0x3d8f('0x43')](_0x3d8f('0x44'))){_0x541b8d[_0x3d8f('0x2c')]=qs[_0x3d8f('0x2c')](_0x1f9551[_0x3d8f('0x3e')][_0x3d8f('0x2c')]);_0x541b8d[_0x3d8f('0x2b')]=qs['offset'](_0x1f9551[_0x3d8f('0x3e')][_0x3d8f('0x2b')]);}return _0xcaf922[_0x3d8f('0x57')](_0x541b8d);}})[_0x3d8f('0x34')](function(_0x343e00){if(_0x343e00){return _0x343e00?{'count':_0x5578d4,'rows':_0x343e00}:null;}})[_0x3d8f('0x34')](respondWithResult(_0x57ef45,null))[_0x3d8f('0x26')](handleError(_0x57ef45,null));};exports[_0x3d8f('0x58')]=function(_0xf684e5,_0x179fcb,_0x259d17){var _0x56c731={};var _0x7a327b={};var _0x20b88;var _0xe41444;return db[_0x3d8f('0x4c')][_0x3d8f('0x59')]({'where':{'id':_0xf684e5[_0x3d8f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x179fcb,null))[_0x3d8f('0x34')](function(_0x82b11){if(_0x82b11){_0x20b88=_0x82b11;_0x7a327b[_0x3d8f('0x3d')]=_[_0x3d8f('0x4f')](db[_0x3d8f('0x54')][_0x3d8f('0x3a')]);_0x7a327b[_0x3d8f('0x3e')]=_['keys'](_0xf684e5[_0x3d8f('0x3e')]);_0x7a327b[_0x3d8f('0x3f')]=_[_0x3d8f('0x40')](_0x7a327b['model'],_0x7a327b[_0x3d8f('0x3e')]);_0x56c731[_0x3d8f('0x41')]=_['intersection'](_0x7a327b[_0x3d8f('0x3d')],qs[_0x3d8f('0x42')](_0xf684e5[_0x3d8f('0x3e')][_0x3d8f('0x42')]));_0x56c731[_0x3d8f('0x41')]=_0x56c731['attributes'][_0x3d8f('0x55')]?_0x56c731[_0x3d8f('0x41')]:_0x7a327b[_0x3d8f('0x3d')];_0x56c731[_0x3d8f('0x56')]=qs[_0x3d8f('0x45')](_0xf684e5['query'][_0x3d8f('0x45')]);_0x56c731[_0x3d8f('0x47')]=qs[_0x3d8f('0x3f')](_[_0x3d8f('0x46')](_0xf684e5[_0x3d8f('0x3e')],_0x7a327b[_0x3d8f('0x3f')]));if(_0xf684e5[_0x3d8f('0x3e')][_0x3d8f('0x49')]){_0x56c731[_0x3d8f('0x47')]=_[_0x3d8f('0x4a')](_0x56c731[_0x3d8f('0x47')],{'$or':_['map'](_0x56c731['attributes'],function(_0x586ebe){var _0x2df1e7={};_0x2df1e7[_0x586ebe]={'$like':'%'+_0xf684e5[_0x3d8f('0x3e')][_0x3d8f('0x49')]+'%'};return _0x2df1e7;})});}_0x56c731=_[_0x3d8f('0x4a')]({},_0x56c731,_0xf684e5[_0x3d8f('0x4b')]);return _0x20b88[_0x3d8f('0x58')](_0x56c731);}})[_0x3d8f('0x34')](function(_0x385e77){if(_0x385e77){_0xe41444=_0x385e77[_0x3d8f('0x55')];if(!_0xf684e5[_0x3d8f('0x3e')][_0x3d8f('0x43')](_0x3d8f('0x44'))){_0x56c731['limit']=qs[_0x3d8f('0x2c')](_0xf684e5[_0x3d8f('0x3e')]['limit']);_0x56c731[_0x3d8f('0x2b')]=qs[_0x3d8f('0x2b')](_0xf684e5['query'][_0x3d8f('0x2b')]);}return _0x20b88['getSubjects'](_0x56c731);}})[_0x3d8f('0x34')](function(_0xbb46){if(_0xbb46){return _0xbb46?{'count':_0xe41444,'rows':_0xbb46}:null;}})['then'](respondWithResult(_0x179fcb,null))[_0x3d8f('0x26')](handleError(_0x179fcb,null));};exports['getDescriptions']=function(_0x3e53f4,_0x1c3b3f,_0x323aa4){var _0x6fc693={};var _0x55d1dd={};var _0x7ab573;var _0x409648;return db['DeskConfiguration'][_0x3d8f('0x59')]({'where':{'id':_0x3e53f4['params']['id']}})[_0x3d8f('0x34')](handleEntityNotFound(_0x1c3b3f,null))[_0x3d8f('0x34')](function(_0x480ae2){if(_0x480ae2){_0x7ab573=_0x480ae2;_0x55d1dd[_0x3d8f('0x3d')]=_[_0x3d8f('0x4f')](db[_0x3d8f('0x54')][_0x3d8f('0x3a')]);_0x55d1dd['query']=_[_0x3d8f('0x4f')](_0x3e53f4[_0x3d8f('0x3e')]);_0x55d1dd[_0x3d8f('0x3f')]=_[_0x3d8f('0x40')](_0x55d1dd[_0x3d8f('0x3d')],_0x55d1dd[_0x3d8f('0x3e')]);_0x6fc693[_0x3d8f('0x41')]=_[_0x3d8f('0x40')](_0x55d1dd[_0x3d8f('0x3d')],qs[_0x3d8f('0x42')](_0x3e53f4[_0x3d8f('0x3e')]['fields']));_0x6fc693[_0x3d8f('0x41')]=_0x6fc693['attributes'][_0x3d8f('0x55')]?_0x6fc693[_0x3d8f('0x41')]:_0x55d1dd[_0x3d8f('0x3d')];_0x6fc693['order']=qs[_0x3d8f('0x45')](_0x3e53f4['query']['sort']);_0x6fc693[_0x3d8f('0x47')]=qs['filters'](_[_0x3d8f('0x46')](_0x3e53f4[_0x3d8f('0x3e')],_0x55d1dd[_0x3d8f('0x3f')]));if(_0x3e53f4[_0x3d8f('0x3e')][_0x3d8f('0x49')]){_0x6fc693['where']=_[_0x3d8f('0x4a')](_0x6fc693[_0x3d8f('0x47')],{'$or':_[_0x3d8f('0x39')](_0x6fc693[_0x3d8f('0x41')],function(_0x51450e){var _0x4422ed={};_0x4422ed[_0x51450e]={'$like':'%'+_0x3e53f4[_0x3d8f('0x3e')][_0x3d8f('0x49')]+'%'};return _0x4422ed;})});}_0x6fc693=_['merge']({},_0x6fc693,_0x3e53f4[_0x3d8f('0x4b')]);return _0x7ab573[_0x3d8f('0x5a')](_0x6fc693);}})[_0x3d8f('0x34')](function(_0x3e7817){if(_0x3e7817){_0x409648=_0x3e7817[_0x3d8f('0x55')];if(!_0x3e53f4[_0x3d8f('0x3e')][_0x3d8f('0x43')](_0x3d8f('0x44'))){_0x6fc693[_0x3d8f('0x2c')]=qs[_0x3d8f('0x2c')](_0x3e53f4[_0x3d8f('0x3e')][_0x3d8f('0x2c')]);_0x6fc693[_0x3d8f('0x2b')]=qs[_0x3d8f('0x2b')](_0x3e53f4[_0x3d8f('0x3e')][_0x3d8f('0x2b')]);}return _0x7ab573[_0x3d8f('0x5a')](_0x6fc693);}})['then'](function(_0x4967d6){if(_0x4967d6){return _0x4967d6?{'count':_0x409648,'rows':_0x4967d6}:null;}})[_0x3d8f('0x34')](respondWithResult(_0x1c3b3f,null))[_0x3d8f('0x26')](handleError(_0x1c3b3f,null));};exports[_0x3d8f('0x5b')]=function(_0x136a96,_0x470151,_0x1ca606){var _0x44c5b4={};var _0x2e45fe={};var _0x14d65d;var _0x250dd8;return db[_0x3d8f('0x4c')][_0x3d8f('0x59')]({'where':{'id':_0x136a96['params']['id']}})[_0x3d8f('0x34')](handleEntityNotFound(_0x470151,null))[_0x3d8f('0x34')](function(_0x2b81df){if(_0x2b81df){_0x14d65d=_0x2b81df;_0x2e45fe[_0x3d8f('0x3d')]=_['keys'](db[_0x3d8f('0x5c')][_0x3d8f('0x3a')]);_0x2e45fe['query']=_[_0x3d8f('0x4f')](_0x136a96['query']);_0x2e45fe[_0x3d8f('0x3f')]=_['intersection'](_0x2e45fe[_0x3d8f('0x3d')],_0x2e45fe[_0x3d8f('0x3e')]);_0x44c5b4['attributes']=_[_0x3d8f('0x40')](_0x2e45fe[_0x3d8f('0x3d')],qs[_0x3d8f('0x42')](_0x136a96[_0x3d8f('0x3e')]['fields']));_0x44c5b4[_0x3d8f('0x41')]=_0x44c5b4['attributes'][_0x3d8f('0x55')]?_0x44c5b4[_0x3d8f('0x41')]:_0x2e45fe[_0x3d8f('0x3d')];_0x44c5b4['order']=qs[_0x3d8f('0x45')](_0x136a96[_0x3d8f('0x3e')][_0x3d8f('0x45')]);_0x44c5b4[_0x3d8f('0x47')]=qs[_0x3d8f('0x3f')](_[_0x3d8f('0x46')](_0x136a96[_0x3d8f('0x3e')],_0x2e45fe[_0x3d8f('0x3f')]));if(_0x136a96[_0x3d8f('0x3e')]['filter']){_0x44c5b4['where']=_[_0x3d8f('0x4a')](_0x44c5b4[_0x3d8f('0x47')],{'$or':_[_0x3d8f('0x39')](_0x44c5b4[_0x3d8f('0x41')],function(_0x2e637f){var _0xc49693={};_0xc49693[_0x2e637f]={'$like':'%'+_0x136a96['query'][_0x3d8f('0x49')]+'%'};return _0xc49693;})});}_0x44c5b4=_['merge']({},_0x44c5b4,_0x136a96[_0x3d8f('0x4b')]);return _0x14d65d['getTags'](_0x44c5b4);}})[_0x3d8f('0x34')](function(_0x55c134){if(_0x55c134){_0x250dd8=_0x55c134[_0x3d8f('0x55')];if(!_0x136a96['query']['hasOwnProperty'](_0x3d8f('0x44'))){_0x44c5b4[_0x3d8f('0x2c')]=qs[_0x3d8f('0x2c')](_0x136a96[_0x3d8f('0x3e')][_0x3d8f('0x2c')]);_0x44c5b4[_0x3d8f('0x2b')]=qs['offset'](_0x136a96[_0x3d8f('0x3e')][_0x3d8f('0x2b')]);}return _0x14d65d[_0x3d8f('0x5b')](_0x44c5b4);}})[_0x3d8f('0x34')](function(_0x5c3890){if(_0x5c3890){return _0x5c3890?{'count':_0x250dd8,'rows':_0x5c3890}:null;}})['then'](respondWithResult(_0x470151,null))[_0x3d8f('0x26')](handleError(_0x470151,null));};exports[_0x3d8f('0x5d')]=function(_0x4553fa,_0xf83d14,_0x4c8ee6){if(_0x4553fa['body']['id']){delete _0x4553fa[_0x3d8f('0x53')]['id'];}return db[_0x3d8f('0x4c')][_0x3d8f('0x59')]({'where':{'id':_0x4553fa[_0x3d8f('0x4e')]['id']}})[_0x3d8f('0x34')](handleEntityNotFound(_0xf83d14,null))[_0x3d8f('0x34')](function(_0x33da2d){if(_0x33da2d){return _0x33da2d[_0x3d8f('0x5d')](_0x4553fa[_0x3d8f('0x53')]['ids']||[]);}return null;})['then'](respondWithResult(_0xf83d14,null))['catch'](handleError(_0xf83d14,null));}; \ No newline at end of file +var _0xa50e=['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','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','sendStatus','stack','name','index','map','DeskConfiguration','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','fields','find','create','body','findOne','DeskField','getFields','getSubjects','rawAttributes','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x17cded,_0xa51b6b){var _0x41b11f=function(_0xa647a){while(--_0xa647a){_0x17cded['push'](_0x17cded['shift']());}};_0x41b11f(++_0xa51b6b);}(_0xa50e,0x1ea));var _0xea50=function(_0x5d0d6c,_0x4e0a00){_0x5d0d6c=_0x5d0d6c-0x0;var _0x4b74e2=_0xa50e[_0x5d0d6c];return _0x4b74e2;};'use strict';var pdf=require(_0xea50('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xea50('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea50('0x2'));var rp=require(_0xea50('0x3'));var moment=require(_0xea50('0x4'));var BPromise=require(_0xea50('0x5'));var Mustache=require(_0xea50('0x6'));var util=require(_0xea50('0x7'));var path=require(_0xea50('0x8'));var sox=require(_0xea50('0x9'));var csv=require(_0xea50('0xa'));var ejs=require(_0xea50('0xb'));var fs=require('fs');var fs_extra=require(_0xea50('0xc'));var _=require(_0xea50('0xd'));var squel=require(_0xea50('0xe'));var crypto=require(_0xea50('0xf'));var jsforce=require(_0xea50('0x10'));var deskjs=require(_0xea50('0x11'));var toCsv=require(_0xea50('0xa'));var querystring=require(_0xea50('0x12'));var Papa=require(_0xea50('0x13'));var Redis=require(_0xea50('0x14'));var authService=require(_0xea50('0x15'));var qs=require(_0xea50('0x16'));var as=require(_0xea50('0x17'));var hardwareService=require(_0xea50('0x18'));var logger=require(_0xea50('0x19'))(_0xea50('0x1a'));var utils=require(_0xea50('0x1b'));var config=require(_0xea50('0x1c'));var licenseUtil=require(_0xea50('0x1d'));var db=require(_0xea50('0x1e'))['db'];var jayson=require(_0xea50('0x1f'));var client=jayson[_0xea50('0x20')][_0xea50('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5f8cd,_0xa3f266,_0x28ffbc,_0x53acbc){return new BPromise(function(_0x57258c,_0x3a09a7){var _0x165f45=_0x53acbc||client;return _0x165f45[_0xea50('0x22')](_0x5f8cd,_0x28ffbc)[_0xea50('0x23')](function(_0x1ade58){logger[_0xea50('0x24')](_0xea50('0x25'),_0xa3f266,_0xea50('0x26'));logger[_0xea50('0x27')](_0xea50('0x28'),_0xa3f266,_0xea50('0x26'),JSON['stringify'](_0x1ade58));if(_0x1ade58[_0xea50('0x29')]){if(_0x1ade58[_0xea50('0x29')][_0xea50('0x2a')]===0x1f4){logger[_0xea50('0x29')](_0xea50('0x25'),_0xa3f266,_0x1ade58[_0xea50('0x29')][_0xea50('0x2b')]);return _0x3a09a7(_0x1ade58[_0xea50('0x29')]['message']);}logger['error'](_0xea50('0x25'),_0xa3f266,_0x1ade58[_0xea50('0x29')][_0xea50('0x2b')]);return _0x57258c(_0x1ade58[_0xea50('0x29')][_0xea50('0x2b')]);}else{logger['info'](_0xea50('0x25'),_0xa3f266,_0xea50('0x26'));_0x57258c(_0x1ade58[_0xea50('0x2c')][_0xea50('0x2b')]);}})['catch'](function(_0x112a31){logger[_0xea50('0x29')](_0xea50('0x25'),_0xa3f266,_0x112a31);_0x3a09a7(_0x112a31);});});}function respondWithStatusCode(_0x38acbe,_0x4e9660){_0x4e9660=_0x4e9660||0xcc;return function(_0x64ba69){if(_0x64ba69){return _0x38acbe['sendStatus'](_0x4e9660);}return _0x38acbe[_0xea50('0x2d')](_0x4e9660)[_0xea50('0x2e')]();};}function respondWithResult(_0x242d4d,_0x2da722){_0x2da722=_0x2da722||0xc8;return function(_0x3dcabc){if(_0x3dcabc){return _0x242d4d[_0xea50('0x2d')](_0x2da722)[_0xea50('0x2f')](_0x3dcabc);}};}function respondWithFilteredResult(_0x47d2f5,_0x1a2bcc){return function(_0x1f3f77){if(_0x1f3f77){var _0x184a86=_0x1f3f77[_0xea50('0x30')],_0x5e0cfe=_0x1a2bcc[_0xea50('0x31')],_0x19ddb6=_0x1a2bcc['offset']+_0x1a2bcc[_0xea50('0x32')],_0x33954f;if(_0x19ddb6>=_0x184a86){_0x19ddb6=_0x184a86;_0x33954f=0xc8;}else{_0x33954f=0xce;}_0x47d2f5[_0xea50('0x2d')](_0x33954f);return _0x47d2f5[_0xea50('0x33')](_0xea50('0x34'),_0x5e0cfe+'-'+_0x19ddb6+'/'+_0x184a86)[_0xea50('0x2f')](_0x1f3f77);}return null;};}function patchUpdates(_0x48e80b){return function(_0x43a736){try{jsonpatch['apply'](_0x43a736,_0x48e80b,!![]);}catch(_0x321b25){return BPromise['reject'](_0x321b25);}return _0x43a736[_0xea50('0x35')]();};}function saveUpdates(_0x17ed83,_0x56f95b){return function(_0x56bc01){if(_0x56bc01){return _0x56bc01[_0xea50('0x36')](_0x17ed83)[_0xea50('0x23')](function(_0x3bc70f){return _0x3bc70f;});}return null;};}function removeEntity(_0x2467e1,_0x128dc8){return function(_0x328ac9){if(_0x328ac9){return _0x328ac9[_0xea50('0x37')]()[_0xea50('0x23')](function(){_0x2467e1[_0xea50('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x75a4a4,_0x20f972){return function(_0x241d33){if(!_0x241d33){_0x75a4a4[_0xea50('0x38')](0x194);}return _0x241d33;};}function handleError(_0x1bbc35,_0x52e33e){_0x52e33e=_0x52e33e||0x1f4;return function(_0x1a8a36){logger[_0xea50('0x29')](_0x1a8a36[_0xea50('0x39')]);if(_0x1a8a36[_0xea50('0x3a')]){delete _0x1a8a36['name'];}_0x1bbc35[_0xea50('0x2d')](_0x52e33e)['send'](_0x1a8a36);};}exports[_0xea50('0x3b')]=function(_0xccdb69,_0x199846){var _0xc0a8d3={},_0x2c7aa8={},_0x21f9c6={'count':0x0,'rows':[]};var _0xb2b1ea=_[_0xea50('0x3c')](db[_0xea50('0x3d')]['rawAttributes'],function(_0x190f60){return{'name':_0x190f60[_0xea50('0x3e')],'type':_0x190f60[_0xea50('0x3f')][_0xea50('0x40')]};});_0x2c7aa8[_0xea50('0x41')]=_[_0xea50('0x3c')](_0xb2b1ea,'name');_0x2c7aa8['query']=_[_0xea50('0x42')](_0xccdb69[_0xea50('0x43')]);_0x2c7aa8[_0xea50('0x44')]=_[_0xea50('0x45')](_0x2c7aa8['model'],_0x2c7aa8[_0xea50('0x43')]);_0xc0a8d3[_0xea50('0x46')]=_[_0xea50('0x45')](_0x2c7aa8[_0xea50('0x41')],qs['fields'](_0xccdb69[_0xea50('0x43')]['fields']));_0xc0a8d3[_0xea50('0x46')]=_0xc0a8d3[_0xea50('0x46')][_0xea50('0x47')]?_0xc0a8d3['attributes']:_0x2c7aa8['model'];if(!_0xccdb69['query'][_0xea50('0x48')](_0xea50('0x49'))){_0xc0a8d3[_0xea50('0x32')]=qs[_0xea50('0x32')](_0xccdb69['query'][_0xea50('0x32')]);_0xc0a8d3[_0xea50('0x31')]=qs['offset'](_0xccdb69[_0xea50('0x43')][_0xea50('0x31')]);}_0xc0a8d3[_0xea50('0x4a')]=qs['sort'](_0xccdb69[_0xea50('0x43')][_0xea50('0x4b')]);_0xc0a8d3[_0xea50('0x4c')]=qs[_0xea50('0x44')](_[_0xea50('0x4d')](_0xccdb69[_0xea50('0x43')],_0x2c7aa8[_0xea50('0x44')]),_0xb2b1ea);if(_0xccdb69['query'][_0xea50('0x4e')]){_0xc0a8d3[_0xea50('0x4c')]=_[_0xea50('0x4f')](_0xc0a8d3[_0xea50('0x4c')],{'$or':_['map'](_0xb2b1ea,function(_0x1a5629){if(_0x1a5629[_0xea50('0x3f')]!==_0xea50('0x50')){var _0x27ee01={};_0x27ee01[_0x1a5629[_0xea50('0x3a')]]={'$like':'%'+_0xccdb69[_0xea50('0x43')]['filter']+'%'};return _0x27ee01;}})});}_0xc0a8d3=_[_0xea50('0x4f')]({},_0xc0a8d3,_0xccdb69[_0xea50('0x51')]);var _0x5d73c4={'where':_0xc0a8d3[_0xea50('0x4c')]};return db['DeskConfiguration']['count'](_0x5d73c4)['then'](function(_0x2848ed){_0x21f9c6[_0xea50('0x30')]=_0x2848ed;if(_0xccdb69['query'][_0xea50('0x52')]){_0xc0a8d3['include']=[{'all':!![]}];}return db[_0xea50('0x3d')][_0xea50('0x53')](_0xc0a8d3);})[_0xea50('0x23')](function(_0x5e604a){_0x21f9c6['rows']=_0x5e604a;return _0x21f9c6;})[_0xea50('0x23')](respondWithFilteredResult(_0x199846,_0xc0a8d3))[_0xea50('0x54')](handleError(_0x199846,null));};exports[_0xea50('0x55')]=function(_0x449403,_0x1e9dfd){var _0x3cbfe0={'raw':![],'where':{'id':_0x449403[_0xea50('0x56')]['id']}},_0x23b08d={};_0x23b08d[_0xea50('0x41')]=_[_0xea50('0x42')](db['DeskConfiguration']['rawAttributes']);_0x23b08d[_0xea50('0x43')]=_['keys'](_0x449403[_0xea50('0x43')]);_0x23b08d[_0xea50('0x44')]=_[_0xea50('0x45')](_0x23b08d[_0xea50('0x41')],_0x23b08d[_0xea50('0x43')]);_0x3cbfe0[_0xea50('0x46')]=_[_0xea50('0x45')](_0x23b08d[_0xea50('0x41')],qs[_0xea50('0x57')](_0x449403[_0xea50('0x43')][_0xea50('0x57')]));_0x3cbfe0[_0xea50('0x46')]=_0x3cbfe0[_0xea50('0x46')][_0xea50('0x47')]?_0x3cbfe0[_0xea50('0x46')]:_0x23b08d[_0xea50('0x41')];if(_0x449403[_0xea50('0x43')][_0xea50('0x52')]){_0x3cbfe0['include']=[{'all':!![]}];}_0x3cbfe0=_[_0xea50('0x4f')]({},_0x3cbfe0,_0x449403['options']);return db[_0xea50('0x3d')][_0xea50('0x58')](_0x3cbfe0)[_0xea50('0x23')](handleEntityNotFound(_0x1e9dfd,null))[_0xea50('0x23')](respondWithResult(_0x1e9dfd,null))[_0xea50('0x54')](handleError(_0x1e9dfd,null));};exports[_0xea50('0x59')]=function(_0x4ace44,_0x392a8a){return db[_0xea50('0x3d')][_0xea50('0x59')](_0x4ace44[_0xea50('0x5a')],{})[_0xea50('0x23')](respondWithResult(_0x392a8a,0xc9))[_0xea50('0x54')](handleError(_0x392a8a,null));};exports[_0xea50('0x36')]=function(_0x4c0ac9,_0x170a9a){if(_0x4c0ac9[_0xea50('0x5a')]['id']){delete _0x4c0ac9[_0xea50('0x5a')]['id'];}return db['DeskConfiguration'][_0xea50('0x58')]({'where':{'id':_0x4c0ac9[_0xea50('0x56')]['id']}})[_0xea50('0x23')](handleEntityNotFound(_0x170a9a,null))[_0xea50('0x23')](saveUpdates(_0x4c0ac9[_0xea50('0x5a')],null))[_0xea50('0x23')](respondWithResult(_0x170a9a,null))[_0xea50('0x54')](handleError(_0x170a9a,null));};exports[_0xea50('0x37')]=function(_0x1658cd,_0x2caed2){return db[_0xea50('0x3d')][_0xea50('0x58')]({'where':{'id':_0x1658cd['params']['id']}})[_0xea50('0x23')](handleEntityNotFound(_0x2caed2,null))[_0xea50('0x23')](removeEntity(_0x2caed2,null))[_0xea50('0x54')](handleError(_0x2caed2,null));};exports['getFields']=function(_0x5d77a5,_0x551a83,_0x469ef0){var _0x46f6a0={};var _0xa1f0db={};var _0x3a2efd;var _0x1b35b5;return db['DeskConfiguration'][_0xea50('0x5b')]({'where':{'id':_0x5d77a5[_0xea50('0x56')]['id']}})[_0xea50('0x23')](handleEntityNotFound(_0x551a83,null))[_0xea50('0x23')](function(_0x4a3561){if(_0x4a3561){_0x3a2efd=_0x4a3561;_0xa1f0db['model']=_[_0xea50('0x42')](db[_0xea50('0x5c')]['rawAttributes']);_0xa1f0db[_0xea50('0x43')]=_[_0xea50('0x42')](_0x5d77a5[_0xea50('0x43')]);_0xa1f0db['filters']=_[_0xea50('0x45')](_0xa1f0db['model'],_0xa1f0db[_0xea50('0x43')]);_0x46f6a0[_0xea50('0x46')]=_[_0xea50('0x45')](_0xa1f0db['model'],qs['fields'](_0x5d77a5['query']['fields']));_0x46f6a0[_0xea50('0x46')]=_0x46f6a0[_0xea50('0x46')]['length']?_0x46f6a0['attributes']:_0xa1f0db[_0xea50('0x41')];_0x46f6a0[_0xea50('0x4a')]=qs['sort'](_0x5d77a5['query']['sort']);_0x46f6a0['where']=qs['filters'](_[_0xea50('0x4d')](_0x5d77a5[_0xea50('0x43')],_0xa1f0db[_0xea50('0x44')]));if(_0x5d77a5[_0xea50('0x43')]['filter']){_0x46f6a0[_0xea50('0x4c')]=_[_0xea50('0x4f')](_0x46f6a0[_0xea50('0x4c')],{'$or':_['map'](_0x46f6a0['attributes'],function(_0x7a0ebc){var _0x1e6f39={};_0x1e6f39[_0x7a0ebc]={'$like':'%'+_0x5d77a5[_0xea50('0x43')][_0xea50('0x4e')]+'%'};return _0x1e6f39;})});}_0x46f6a0=_[_0xea50('0x4f')]({},_0x46f6a0,_0x5d77a5[_0xea50('0x51')]);return _0x3a2efd[_0xea50('0x5d')](_0x46f6a0);}})[_0xea50('0x23')](function(_0x2498af){if(_0x2498af){_0x1b35b5=_0x2498af[_0xea50('0x47')];if(!_0x5d77a5[_0xea50('0x43')][_0xea50('0x48')](_0xea50('0x49'))){_0x46f6a0[_0xea50('0x32')]=qs[_0xea50('0x32')](_0x5d77a5['query'][_0xea50('0x32')]);_0x46f6a0[_0xea50('0x31')]=qs[_0xea50('0x31')](_0x5d77a5[_0xea50('0x43')][_0xea50('0x31')]);}return _0x3a2efd[_0xea50('0x5d')](_0x46f6a0);}})[_0xea50('0x23')](function(_0x5562bc){if(_0x5562bc){return _0x5562bc?{'count':_0x1b35b5,'rows':_0x5562bc}:null;}})[_0xea50('0x23')](respondWithResult(_0x551a83,null))[_0xea50('0x54')](handleError(_0x551a83,null));};exports[_0xea50('0x5e')]=function(_0x13b2f2,_0x2677a1,_0x4db1dd){var _0x46e055={};var _0x1d6bce={};var _0x3ec45c;var _0x5361d7;return db[_0xea50('0x3d')]['findOne']({'where':{'id':_0x13b2f2[_0xea50('0x56')]['id']}})[_0xea50('0x23')](handleEntityNotFound(_0x2677a1,null))[_0xea50('0x23')](function(_0x294f38){if(_0x294f38){_0x3ec45c=_0x294f38;_0x1d6bce[_0xea50('0x41')]=_[_0xea50('0x42')](db['DeskField'][_0xea50('0x5f')]);_0x1d6bce[_0xea50('0x43')]=_[_0xea50('0x42')](_0x13b2f2['query']);_0x1d6bce[_0xea50('0x44')]=_[_0xea50('0x45')](_0x1d6bce[_0xea50('0x41')],_0x1d6bce['query']);_0x46e055[_0xea50('0x46')]=_[_0xea50('0x45')](_0x1d6bce[_0xea50('0x41')],qs['fields'](_0x13b2f2[_0xea50('0x43')][_0xea50('0x57')]));_0x46e055[_0xea50('0x46')]=_0x46e055[_0xea50('0x46')][_0xea50('0x47')]?_0x46e055[_0xea50('0x46')]:_0x1d6bce['model'];_0x46e055[_0xea50('0x4a')]=qs['sort'](_0x13b2f2[_0xea50('0x43')][_0xea50('0x4b')]);_0x46e055['where']=qs[_0xea50('0x44')](_['pick'](_0x13b2f2[_0xea50('0x43')],_0x1d6bce[_0xea50('0x44')]));if(_0x13b2f2[_0xea50('0x43')]['filter']){_0x46e055[_0xea50('0x4c')]=_[_0xea50('0x4f')](_0x46e055[_0xea50('0x4c')],{'$or':_['map'](_0x46e055[_0xea50('0x46')],function(_0x3c72f6){var _0x2b713d={};_0x2b713d[_0x3c72f6]={'$like':'%'+_0x13b2f2['query']['filter']+'%'};return _0x2b713d;})});}_0x46e055=_[_0xea50('0x4f')]({},_0x46e055,_0x13b2f2[_0xea50('0x51')]);return _0x3ec45c[_0xea50('0x5e')](_0x46e055);}})[_0xea50('0x23')](function(_0x5c9528){if(_0x5c9528){_0x5361d7=_0x5c9528[_0xea50('0x47')];if(!_0x13b2f2[_0xea50('0x43')][_0xea50('0x48')](_0xea50('0x49'))){_0x46e055[_0xea50('0x32')]=qs[_0xea50('0x32')](_0x13b2f2[_0xea50('0x43')][_0xea50('0x32')]);_0x46e055[_0xea50('0x31')]=qs[_0xea50('0x31')](_0x13b2f2[_0xea50('0x43')][_0xea50('0x31')]);}return _0x3ec45c[_0xea50('0x5e')](_0x46e055);}})[_0xea50('0x23')](function(_0x21c736){if(_0x21c736){return _0x21c736?{'count':_0x5361d7,'rows':_0x21c736}:null;}})[_0xea50('0x23')](respondWithResult(_0x2677a1,null))[_0xea50('0x54')](handleError(_0x2677a1,null));};exports['getDescriptions']=function(_0x5ef9ed,_0xa0a8b0,_0x306a62){var _0x161de5={};var _0x4b0716={};var _0x2ba776;var _0x3b0b21;return db['DeskConfiguration'][_0xea50('0x5b')]({'where':{'id':_0x5ef9ed[_0xea50('0x56')]['id']}})[_0xea50('0x23')](handleEntityNotFound(_0xa0a8b0,null))['then'](function(_0x160417){if(_0x160417){_0x2ba776=_0x160417;_0x4b0716[_0xea50('0x41')]=_['keys'](db[_0xea50('0x5c')]['rawAttributes']);_0x4b0716[_0xea50('0x43')]=_['keys'](_0x5ef9ed[_0xea50('0x43')]);_0x4b0716['filters']=_['intersection'](_0x4b0716[_0xea50('0x41')],_0x4b0716[_0xea50('0x43')]);_0x161de5[_0xea50('0x46')]=_[_0xea50('0x45')](_0x4b0716[_0xea50('0x41')],qs[_0xea50('0x57')](_0x5ef9ed[_0xea50('0x43')][_0xea50('0x57')]));_0x161de5[_0xea50('0x46')]=_0x161de5[_0xea50('0x46')][_0xea50('0x47')]?_0x161de5[_0xea50('0x46')]:_0x4b0716[_0xea50('0x41')];_0x161de5[_0xea50('0x4a')]=qs[_0xea50('0x4b')](_0x5ef9ed[_0xea50('0x43')][_0xea50('0x4b')]);_0x161de5['where']=qs[_0xea50('0x44')](_[_0xea50('0x4d')](_0x5ef9ed[_0xea50('0x43')],_0x4b0716[_0xea50('0x44')]));if(_0x5ef9ed[_0xea50('0x43')]['filter']){_0x161de5[_0xea50('0x4c')]=_[_0xea50('0x4f')](_0x161de5['where'],{'$or':_[_0xea50('0x3c')](_0x161de5[_0xea50('0x46')],function(_0x4f7dc7){var _0xed12af={};_0xed12af[_0x4f7dc7]={'$like':'%'+_0x5ef9ed[_0xea50('0x43')][_0xea50('0x4e')]+'%'};return _0xed12af;})});}_0x161de5=_['merge']({},_0x161de5,_0x5ef9ed[_0xea50('0x51')]);return _0x2ba776[_0xea50('0x60')](_0x161de5);}})[_0xea50('0x23')](function(_0x4cce33){if(_0x4cce33){_0x3b0b21=_0x4cce33['length'];if(!_0x5ef9ed[_0xea50('0x43')][_0xea50('0x48')]('nolimit')){_0x161de5['limit']=qs[_0xea50('0x32')](_0x5ef9ed[_0xea50('0x43')]['limit']);_0x161de5[_0xea50('0x31')]=qs[_0xea50('0x31')](_0x5ef9ed['query'][_0xea50('0x31')]);}return _0x2ba776[_0xea50('0x60')](_0x161de5);}})['then'](function(_0x4c4183){if(_0x4c4183){return _0x4c4183?{'count':_0x3b0b21,'rows':_0x4c4183}:null;}})['then'](respondWithResult(_0xa0a8b0,null))[_0xea50('0x54')](handleError(_0xa0a8b0,null));};exports[_0xea50('0x61')]=function(_0x15a42c,_0x1d5069,_0x29569f){var _0x47bd50={};var _0x5c8674={};var _0x33eb9d;var _0x2f7934;return db[_0xea50('0x3d')][_0xea50('0x5b')]({'where':{'id':_0x15a42c[_0xea50('0x56')]['id']}})['then'](handleEntityNotFound(_0x1d5069,null))[_0xea50('0x23')](function(_0x54c9d6){if(_0x54c9d6){_0x33eb9d=_0x54c9d6;_0x5c8674[_0xea50('0x41')]=_[_0xea50('0x42')](db[_0xea50('0x62')]['rawAttributes']);_0x5c8674['query']=_[_0xea50('0x42')](_0x15a42c[_0xea50('0x43')]);_0x5c8674['filters']=_[_0xea50('0x45')](_0x5c8674[_0xea50('0x41')],_0x5c8674['query']);_0x47bd50[_0xea50('0x46')]=_[_0xea50('0x45')](_0x5c8674[_0xea50('0x41')],qs['fields'](_0x15a42c['query']['fields']));_0x47bd50[_0xea50('0x46')]=_0x47bd50['attributes'][_0xea50('0x47')]?_0x47bd50[_0xea50('0x46')]:_0x5c8674[_0xea50('0x41')];_0x47bd50['order']=qs['sort'](_0x15a42c['query'][_0xea50('0x4b')]);_0x47bd50['where']=qs['filters'](_['pick'](_0x15a42c[_0xea50('0x43')],_0x5c8674[_0xea50('0x44')]));if(_0x15a42c['query'][_0xea50('0x4e')]){_0x47bd50[_0xea50('0x4c')]=_[_0xea50('0x4f')](_0x47bd50[_0xea50('0x4c')],{'$or':_[_0xea50('0x3c')](_0x47bd50[_0xea50('0x46')],function(_0x4caf10){var _0x349cb3={};_0x349cb3[_0x4caf10]={'$like':'%'+_0x15a42c[_0xea50('0x43')]['filter']+'%'};return _0x349cb3;})});}_0x47bd50=_['merge']({},_0x47bd50,_0x15a42c['options']);return _0x33eb9d['getTags'](_0x47bd50);}})[_0xea50('0x23')](function(_0x1f554a){if(_0x1f554a){_0x2f7934=_0x1f554a[_0xea50('0x47')];if(!_0x15a42c[_0xea50('0x43')]['hasOwnProperty'](_0xea50('0x49'))){_0x47bd50['limit']=qs[_0xea50('0x32')](_0x15a42c[_0xea50('0x43')][_0xea50('0x32')]);_0x47bd50['offset']=qs[_0xea50('0x31')](_0x15a42c[_0xea50('0x43')][_0xea50('0x31')]);}return _0x33eb9d[_0xea50('0x61')](_0x47bd50);}})['then'](function(_0x41f30a){if(_0x41f30a){return _0x41f30a?{'count':_0x2f7934,'rows':_0x41f30a}:null;}})['then'](respondWithResult(_0x1d5069,null))[_0xea50('0x54')](handleError(_0x1d5069,null));};exports[_0xea50('0x63')]=function(_0x6d9745,_0x5bbc4b,_0x26437b){if(_0x6d9745[_0xea50('0x5a')]['id']){delete _0x6d9745['body']['id'];}return db[_0xea50('0x3d')]['findOne']({'where':{'id':_0x6d9745['params']['id']}})[_0xea50('0x23')](handleEntityNotFound(_0x5bbc4b,null))[_0xea50('0x23')](function(_0xc98a1e){if(_0xc98a1e){return _0xc98a1e[_0xea50('0x63')](_0x6d9745[_0xea50('0x5a')][_0xea50('0x64')]||[]);}return null;})[_0xea50('0x23')](respondWithResult(_0x5bbc4b,null))[_0xea50('0x54')](handleError(_0x5bbc4b,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 83475c7..c5bf115 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 _0xbb26=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','lodash','util','../../config/logger'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xbb26,0x1e1));var _0x6bb2=function(_0x399436,_0x526646){_0x399436=_0x399436-0x0;var _0x3ce959=_0xbb26[_0x399436];return _0x3ce959;};'use strict';var _=require(_0x6bb2('0x0'));var util=require(_0x6bb2('0x1'));var logger=require(_0x6bb2('0x2'))(_0x6bb2('0x3'));var moment=require(_0x6bb2('0x4'));var BPromise=require(_0x6bb2('0x5'));var rp=require(_0x6bb2('0x6'));var fs=require('fs');var path=require(_0x6bb2('0x7'));var rimraf=require('rimraf');var config=require(_0x6bb2('0x8'));var attributes=require('./intDeskConfiguration.attributes');module[_0x6bb2('0x9')]=function(_0xb43603,_0x2c319d){return _0xb43603[_0x6bb2('0xa')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d18=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','moment'];(function(_0x2ba9dd,_0x32f4a5){var _0xe1f56c=function(_0x3a1844){while(--_0x3a1844){_0x2ba9dd['push'](_0x2ba9dd['shift']());}};_0xe1f56c(++_0x32f4a5);}(_0x3d18,0xa4));var _0x83d1=function(_0x7beff7,_0x130999){_0x7beff7=_0x7beff7-0x0;var _0x4e7c95=_0x3d18[_0x7beff7];return _0x4e7c95;};'use strict';var _=require(_0x83d1('0x0'));var util=require(_0x83d1('0x1'));var logger=require(_0x83d1('0x2'))('api');var moment=require(_0x83d1('0x3'));var BPromise=require(_0x83d1('0x4'));var rp=require(_0x83d1('0x5'));var fs=require('fs');var path=require(_0x83d1('0x6'));var rimraf=require(_0x83d1('0x7'));var config=require(_0x83d1('0x8'));var attributes=require(_0x83d1('0x9'));module[_0x83d1('0xa')]=function(_0x28aaa3,_0x3351cc){return _0x28aaa3[_0x83d1('0xb')](_0x83d1('0xc'),attributes,{'tableName':_0x83d1('0xd'),'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 7fef495..82e7bc1 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 _0xf089=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','DeskConfiguration,\x20%s,\x20%s','message','util','moment','randomstring','ioredis'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xf089,0xba));var _0x9f08=function(_0x4fb283,_0x15dbfb){_0x4fb283=_0x4fb283-0x0;var _0x2e4b47=_0xf089[_0x4fb283];return _0x2e4b47;};'use strict';var _=require('lodash');var util=require(_0x9f08('0x0'));var moment=require(_0x9f08('0x1'));var BPromise=require('bluebird');var rs=require(_0x9f08('0x2'));var fs=require('fs');var Redis=require(_0x9f08('0x3'));var db=require(_0x9f08('0x4'))['db'];var utils=require(_0x9f08('0x5'));var logger=require('../../config/logger')(_0x9f08('0x6'));var config=require(_0x9f08('0x7'));var jayson=require(_0x9f08('0x8'));var client=jayson[_0x9f08('0x9')][_0x9f08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39abe2,_0x5341c9,_0x9cfade){return new BPromise(function(_0x4b37fc,_0x39e238){return client['request'](_0x39abe2,_0x9cfade)[_0x9f08('0xb')](function(_0x286809){logger[_0x9f08('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x5341c9,_0x9f08('0xd'));logger[_0x9f08('0xe')](_0x9f08('0xf'),_0x5341c9,'request\x20sent',JSON['stringify'](_0x286809));if(_0x286809[_0x9f08('0x10')]){if(_0x286809[_0x9f08('0x10')]['code']===0x1f4){logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x286809[_0x9f08('0x10')]['message']);return _0x39e238(_0x286809['error'][_0x9f08('0x12')]);}logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x286809[_0x9f08('0x10')]['message']);return _0x4b37fc(_0x286809[_0x9f08('0x10')][_0x9f08('0x12')]);}else{logger[_0x9f08('0xc')](_0x9f08('0x11'),_0x5341c9,_0x9f08('0xd'));_0x4b37fc(_0x286809['result'][_0x9f08('0x12')]);}})['catch'](function(_0x5a562c){logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x5a562c);_0x39e238(_0x5a562c);});});} \ No newline at end of file +var _0x131e=['info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','DeskConfiguration,\x20%s,\x20%s','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x50a463,_0x517a1a){var _0x2971df=function(_0x1f9cf1){while(--_0x1f9cf1){_0x50a463['push'](_0x50a463['shift']());}};_0x2971df(++_0x517a1a);}(_0x131e,0x1ec));var _0xe131=function(_0x32dab4,_0x1399be){_0x32dab4=_0x32dab4-0x0;var _0x4f44c5=_0x131e[_0x32dab4];return _0x4f44c5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe131('0x0'));var rs=require(_0xe131('0x1'));var fs=require('fs');var Redis=require(_0xe131('0x2'));var db=require(_0xe131('0x3'))['db'];var utils=require(_0xe131('0x4'));var logger=require(_0xe131('0x5'))('rpc');var config=require(_0xe131('0x6'));var jayson=require(_0xe131('0x7'));var client=jayson[_0xe131('0x8')][_0xe131('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1002a6,_0x48a90e,_0x5c4eb5){return new BPromise(function(_0x562617,_0x4bf386){return client[_0xe131('0xa')](_0x1002a6,_0x5c4eb5)[_0xe131('0xb')](function(_0x530ecb){logger[_0xe131('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x48a90e,_0xe131('0xd'));logger[_0xe131('0xe')](_0xe131('0xf'),_0x48a90e,_0xe131('0xd'),JSON[_0xe131('0x10')](_0x530ecb));if(_0x530ecb[_0xe131('0x11')]){if(_0x530ecb[_0xe131('0x11')]['code']===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x48a90e,_0x530ecb['error'][_0xe131('0x12')]);return _0x4bf386(_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);}logger[_0xe131('0x11')](_0xe131('0x13'),_0x48a90e,_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);return _0x562617(_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x48a90e,'request\x20sent');_0x562617(_0x530ecb['result']['message']);}})[_0xe131('0x14')](function(_0x32091b){logger[_0xe131('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x48a90e,_0x32091b);_0x4bf386(_0x32091b);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 4207078..12fc696 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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x7a54,0x106));var _0x47a5=function(_0x1afdbc,_0x130a0b){_0x1afdbc=_0x1afdbc-0x0;var _0x1c9b52=_0x7a54[_0x1afdbc];return _0x1c9b52;};'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','./intDeskField.controller','get'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x7a54,0x106));var _0x47a5=function(_0x5d6bc9,_0x58d1b2){_0x5d6bc9=_0x5d6bc9-0x0;var _0x31a324=_0x7a54[_0x5d6bc9];return _0x31a324;};'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/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 733cbd4..1fb2e97 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 _0x77c3=['picklist','STRING','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x26a7d1,_0x2df4ad){var _0x4c60bd=function(_0x592412){while(--_0x592412){_0x26a7d1['push'](_0x26a7d1['shift']());}};_0x4c60bd(++_0x2df4ad);}(_0x77c3,0x152));var _0x377c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77c3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x377c('0x0'));module['exports']={'type':{'type':Sequelize[_0x377c('0x1')](_0x377c('0x2'),_0x377c('0x3'),_0x377c('0x4'),_0x377c('0x5'),_0x377c('0x6')),'defaultValue':_0x377c('0x2')},'content':{'type':Sequelize[_0x377c('0x7')]},'key':{'type':Sequelize[_0x377c('0x7')]},'keyType':{'type':Sequelize[_0x377c('0x1')]('string','variable',_0x377c('0x4'))},'keyContent':{'type':Sequelize[_0x377c('0x7')]},'idField':{'type':Sequelize[_0x377c('0x7')]},'nameField':{'type':Sequelize[_0x377c('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x377c('0x7')]}}; \ No newline at end of file +var _0xe080=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0xe080,0x186));var _0x0e08=function(_0x38e394,_0x5e3dc8){_0x38e394=_0x38e394-0x0;var _0x273c2a=_0xe080[_0x38e394];return _0x273c2a;};'use strict';var Sequelize=require(_0x0e08('0x0'));module[_0x0e08('0x1')]={'type':{'type':Sequelize[_0x0e08('0x2')](_0x0e08('0x3'),_0x0e08('0x4'),_0x0e08('0x5'),_0x0e08('0x6'),_0x0e08('0x7')),'defaultValue':_0x0e08('0x3')},'content':{'type':Sequelize[_0x0e08('0x8')]},'key':{'type':Sequelize[_0x0e08('0x8')]},'keyType':{'type':Sequelize[_0x0e08('0x2')](_0x0e08('0x3'),_0x0e08('0x4'),_0x0e08('0x5'))},'keyContent':{'type':Sequelize[_0x0e08('0x8')]},'idField':{'type':Sequelize[_0x0e08('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0e08('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index bb78553..3fad284 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 _0x101e=['query','attributes','intersection','model','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','DeskField','rawAttributes','type','key'];(function(_0x45a25e,_0x57838f){var _0x187960=function(_0x247f1a){while(--_0x247f1a){_0x45a25e['push'](_0x45a25e['shift']());}};_0x187960(++_0x57838f);}(_0x101e,0xa5));var _0xe101=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x101e[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe101('0x0'));var rimraf=require(_0xe101('0x1'));var zipdir=require(_0xe101('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe101('0x3'));var moment=require('moment');var BPromise=require(_0xe101('0x4'));var Mustache=require(_0xe101('0x5'));var util=require(_0xe101('0x6'));var path=require(_0xe101('0x7'));var sox=require(_0xe101('0x8'));var csv=require(_0xe101('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe101('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe101('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe101('0xc'));var toCsv=require(_0xe101('0x9'));var querystring=require(_0xe101('0xd'));var Papa=require(_0xe101('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe101('0xf'));var as=require(_0xe101('0x10'));var hardwareService=require(_0xe101('0x11'));var logger=require(_0xe101('0x12'))(_0xe101('0x13'));var utils=require('../../config/utils');var config=require(_0xe101('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe101('0x15'))['db'];function respondWithStatusCode(_0x4e4f17,_0x2ccc0e){_0x2ccc0e=_0x2ccc0e||0xcc;return function(_0x1ebf25){if(_0x1ebf25){return _0x4e4f17[_0xe101('0x16')](_0x2ccc0e);}return _0x4e4f17[_0xe101('0x17')](_0x2ccc0e)[_0xe101('0x18')]();};}function respondWithResult(_0xc746ce,_0x55f71d){_0x55f71d=_0x55f71d||0xc8;return function(_0x8185c9){if(_0x8185c9){return _0xc746ce[_0xe101('0x17')](_0x55f71d)[_0xe101('0x19')](_0x8185c9);}};}function respondWithFilteredResult(_0x5d4ae7,_0x3f4d41){return function(_0x10c193){if(_0x10c193){var _0x578b08=_0x10c193[_0xe101('0x1a')],_0x20dbe6=_0x3f4d41[_0xe101('0x1b')],_0x22d698=_0x3f4d41['offset']+_0x3f4d41[_0xe101('0x1c')],_0x37b736;if(_0x22d698>=_0x578b08){_0x22d698=_0x578b08;_0x37b736=0xc8;}else{_0x37b736=0xce;}_0x5d4ae7[_0xe101('0x17')](_0x37b736);return _0x5d4ae7['set'](_0xe101('0x1d'),_0x20dbe6+'-'+_0x22d698+'/'+_0x578b08)['json'](_0x10c193);}return null;};}function patchUpdates(_0x40a212){return function(_0x13c1ab){try{jsonpatch[_0xe101('0x1e')](_0x13c1ab,_0x40a212,!![]);}catch(_0x1e2ee8){return BPromise[_0xe101('0x1f')](_0x1e2ee8);}return _0x13c1ab[_0xe101('0x20')]();};}function saveUpdates(_0x597fde,_0x592811){return function(_0xccdd8){if(_0xccdd8){return _0xccdd8[_0xe101('0x21')](_0x597fde)[_0xe101('0x22')](function(_0x4a7478){return _0x4a7478;});}return null;};}function removeEntity(_0x5775cc,_0x576685){return function(_0x1315d5){if(_0x1315d5){return _0x1315d5[_0xe101('0x23')]()['then'](function(){_0x5775cc[_0xe101('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16c43b,_0x527bb4){return function(_0x1f9392){if(!_0x1f9392){_0x16c43b[_0xe101('0x16')](0x194);}return _0x1f9392;};}function handleError(_0xab4b2,_0x393c6b){_0x393c6b=_0x393c6b||0x1f4;return function(_0x4b2fd1){logger[_0xe101('0x24')](_0x4b2fd1['stack']);if(_0x4b2fd1['name']){delete _0x4b2fd1[_0xe101('0x25')];}_0xab4b2['status'](_0x393c6b)[_0xe101('0x26')](_0x4b2fd1);};}exports[_0xe101('0x27')]=function(_0x125d9a,_0x515039){var _0x1e5dba={},_0x1beb22={},_0x1db4cf={'count':0x0,'rows':[]};var _0x3c7eda=_[_0xe101('0x28')](db[_0xe101('0x29')][_0xe101('0x2a')],function(_0x1f637a){return{'name':_0x1f637a['fieldName'],'type':_0x1f637a[_0xe101('0x2b')][_0xe101('0x2c')]};});_0x1beb22['model']=_[_0xe101('0x28')](_0x3c7eda,'name');_0x1beb22[_0xe101('0x2d')]=_['keys'](_0x125d9a['query']);_0x1beb22['filters']=_['intersection'](_0x1beb22['model'],_0x1beb22[_0xe101('0x2d')]);_0x1e5dba[_0xe101('0x2e')]=_[_0xe101('0x2f')](_0x1beb22[_0xe101('0x30')],qs[_0xe101('0x31')](_0x125d9a[_0xe101('0x2d')][_0xe101('0x31')]));_0x1e5dba[_0xe101('0x2e')]=_0x1e5dba[_0xe101('0x2e')][_0xe101('0x32')]?_0x1e5dba[_0xe101('0x2e')]:_0x1beb22[_0xe101('0x30')];if(!_0x125d9a[_0xe101('0x2d')]['hasOwnProperty'](_0xe101('0x33'))){_0x1e5dba[_0xe101('0x1c')]=qs['limit'](_0x125d9a[_0xe101('0x2d')]['limit']);_0x1e5dba[_0xe101('0x1b')]=qs[_0xe101('0x1b')](_0x125d9a[_0xe101('0x2d')][_0xe101('0x1b')]);}_0x1e5dba[_0xe101('0x34')]=qs[_0xe101('0x35')](_0x125d9a[_0xe101('0x2d')][_0xe101('0x35')]);_0x1e5dba[_0xe101('0x36')]=qs[_0xe101('0x37')](_['pick'](_0x125d9a[_0xe101('0x2d')],_0x1beb22['filters']),_0x3c7eda);if(_0x125d9a[_0xe101('0x2d')]['filter']){_0x1e5dba['where']=_[_0xe101('0x38')](_0x1e5dba['where'],{'$or':_['map'](_0x3c7eda,function(_0x4b04a7){if(_0x4b04a7[_0xe101('0x2b')]!==_0xe101('0x39')){var _0x7e466a={};_0x7e466a[_0x4b04a7[_0xe101('0x25')]]={'$like':'%'+_0x125d9a[_0xe101('0x2d')][_0xe101('0x3a')]+'%'};return _0x7e466a;}})});}_0x1e5dba=_[_0xe101('0x38')]({},_0x1e5dba,_0x125d9a[_0xe101('0x3b')]);var _0xbaef5b={'where':_0x1e5dba['where']};return db[_0xe101('0x29')][_0xe101('0x1a')](_0xbaef5b)[_0xe101('0x22')](function(_0x3806b0){_0x1db4cf[_0xe101('0x1a')]=_0x3806b0;if(_0x125d9a[_0xe101('0x2d')]['includeAll']){_0x1e5dba['include']=[{'all':!![]}];}return db[_0xe101('0x29')][_0xe101('0x3c')](_0x1e5dba);})[_0xe101('0x22')](function(_0x173c3d){_0x1db4cf[_0xe101('0x3d')]=_0x173c3d;return _0x1db4cf;})[_0xe101('0x22')](respondWithFilteredResult(_0x515039,_0x1e5dba))[_0xe101('0x3e')](handleError(_0x515039,null));};exports['show']=function(_0x20af2b,_0x5d6ec7){var _0x188d16={'raw':!![],'where':{'id':_0x20af2b[_0xe101('0x3f')]['id']}},_0x2736d5={};_0x2736d5['model']=_[_0xe101('0x40')](db[_0xe101('0x29')][_0xe101('0x2a')]);_0x2736d5['query']=_[_0xe101('0x40')](_0x20af2b[_0xe101('0x2d')]);_0x2736d5[_0xe101('0x37')]=_[_0xe101('0x2f')](_0x2736d5['model'],_0x2736d5[_0xe101('0x2d')]);_0x188d16[_0xe101('0x2e')]=_[_0xe101('0x2f')](_0x2736d5[_0xe101('0x30')],qs[_0xe101('0x31')](_0x20af2b[_0xe101('0x2d')][_0xe101('0x31')]));_0x188d16['attributes']=_0x188d16[_0xe101('0x2e')]['length']?_0x188d16['attributes']:_0x2736d5[_0xe101('0x30')];if(_0x20af2b[_0xe101('0x2d')][_0xe101('0x41')]){_0x188d16[_0xe101('0x42')]=[{'all':!![]}];}_0x188d16=_[_0xe101('0x38')]({},_0x188d16,_0x20af2b[_0xe101('0x3b')]);return db[_0xe101('0x29')][_0xe101('0x43')](_0x188d16)[_0xe101('0x22')](handleEntityNotFound(_0x5d6ec7,null))[_0xe101('0x22')](respondWithResult(_0x5d6ec7,null))[_0xe101('0x3e')](handleError(_0x5d6ec7,null));};exports['create']=function(_0x8c22af,_0x284847){return db[_0xe101('0x29')][_0xe101('0x44')](_0x8c22af[_0xe101('0x45')],{})[_0xe101('0x22')](respondWithResult(_0x284847,0xc9))['catch'](handleError(_0x284847,null));};exports[_0xe101('0x21')]=function(_0xb5839b,_0x27d1d8){if(_0xb5839b[_0xe101('0x45')]['id']){delete _0xb5839b['body']['id'];}return db['DeskField'][_0xe101('0x43')]({'where':{'id':_0xb5839b[_0xe101('0x3f')]['id']}})[_0xe101('0x22')](handleEntityNotFound(_0x27d1d8,null))[_0xe101('0x22')](saveUpdates(_0xb5839b[_0xe101('0x45')],null))[_0xe101('0x22')](respondWithResult(_0x27d1d8,null))[_0xe101('0x3e')](handleError(_0x27d1d8,null));};exports[_0xe101('0x23')]=function(_0x443fc7,_0x1c4884){return db[_0xe101('0x29')][_0xe101('0x43')]({'where':{'id':_0x443fc7['params']['id']}})['then'](handleEntityNotFound(_0x1c4884,null))[_0xe101('0x22')](removeEntity(_0x1c4884,null))[_0xe101('0x3e')](handleError(_0x1c4884,null));}; \ No newline at end of file +var _0x57df=['zip-dir','fast-json-patch','request-promise','moment','mustache','path','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','Content-Range','reject','then','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','find','create','body','update','destroy','html-pdf','eml-format'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x57df,0x190));var _0xf57d=function(_0x578bec,_0x4a93f9){_0x578bec=_0x578bec-0x0;var _0x98610e=_0x57df[_0x578bec];return _0x98610e;};'use strict';var pdf=require(_0xf57d('0x0'));var emlformat=require(_0xf57d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf57d('0x2'));var jsonpatch=require(_0xf57d('0x3'));var rp=require(_0xf57d('0x4'));var moment=require(_0xf57d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf57d('0x6'));var util=require('util');var path=require(_0xf57d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf57d('0x8'));var _=require(_0xf57d('0x9'));var squel=require(_0xf57d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf57d('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf57d('0xc'));var Papa=require(_0xf57d('0xd'));var Redis=require(_0xf57d('0xe'));var authService=require(_0xf57d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf57d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf57d('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xf57d('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xf57d('0x13'))['db'];function respondWithStatusCode(_0x4d28b8,_0x3468bd){_0x3468bd=_0x3468bd||0xcc;return function(_0xa50bc7){if(_0xa50bc7){return _0x4d28b8['sendStatus'](_0x3468bd);}return _0x4d28b8[_0xf57d('0x14')](_0x3468bd)[_0xf57d('0x15')]();};}function respondWithResult(_0x73e7f8,_0x814996){_0x814996=_0x814996||0xc8;return function(_0x8c320b){if(_0x8c320b){return _0x73e7f8['status'](_0x814996)[_0xf57d('0x16')](_0x8c320b);}};}function respondWithFilteredResult(_0x417648,_0x4d8223){return function(_0x9148d8){if(_0x9148d8){var _0x1a9580=_0x9148d8[_0xf57d('0x17')],_0x3a2ecf=_0x4d8223[_0xf57d('0x18')],_0x2b1d8f=_0x4d8223[_0xf57d('0x18')]+_0x4d8223['limit'],_0xe2b1ac;if(_0x2b1d8f>=_0x1a9580){_0x2b1d8f=_0x1a9580;_0xe2b1ac=0xc8;}else{_0xe2b1ac=0xce;}_0x417648['status'](_0xe2b1ac);return _0x417648['set'](_0xf57d('0x19'),_0x3a2ecf+'-'+_0x2b1d8f+'/'+_0x1a9580)['json'](_0x9148d8);}return null;};}function patchUpdates(_0x16b581){return function(_0x419507){try{jsonpatch['apply'](_0x419507,_0x16b581,!![]);}catch(_0x41ca95){return BPromise[_0xf57d('0x1a')](_0x41ca95);}return _0x419507['save']();};}function saveUpdates(_0x268485,_0x3d1cdc){return function(_0x193caa){if(_0x193caa){return _0x193caa['update'](_0x268485)['then'](function(_0x1bdeb7){return _0x1bdeb7;});}return null;};}function removeEntity(_0x265719,_0x475897){return function(_0x173b5d){if(_0x173b5d){return _0x173b5d['destroy']()[_0xf57d('0x1b')](function(){_0x265719[_0xf57d('0x14')](0xcc)[_0xf57d('0x15')]();});}};}function handleEntityNotFound(_0x13997d,_0x48c40a){return function(_0x4950aa){if(!_0x4950aa){_0x13997d['sendStatus'](0x194);}return _0x4950aa;};}function handleError(_0x5d996b,_0x5040cf){_0x5040cf=_0x5040cf||0x1f4;return function(_0x19f94f){logger[_0xf57d('0x1c')](_0x19f94f[_0xf57d('0x1d')]);if(_0x19f94f[_0xf57d('0x1e')]){delete _0x19f94f[_0xf57d('0x1e')];}_0x5d996b[_0xf57d('0x14')](_0x5040cf)[_0xf57d('0x1f')](_0x19f94f);};}exports[_0xf57d('0x20')]=function(_0x4fee92,_0x1221fb){var _0x46acde={},_0x4f5be7={},_0x4588a7={'count':0x0,'rows':[]};var _0x8d713b=_[_0xf57d('0x21')](db[_0xf57d('0x22')][_0xf57d('0x23')],function(_0x5c8d66){return{'name':_0x5c8d66[_0xf57d('0x24')],'type':_0x5c8d66[_0xf57d('0x25')]['key']};});_0x4f5be7['model']=_[_0xf57d('0x21')](_0x8d713b,_0xf57d('0x1e'));_0x4f5be7[_0xf57d('0x26')]=_[_0xf57d('0x27')](_0x4fee92[_0xf57d('0x26')]);_0x4f5be7[_0xf57d('0x28')]=_[_0xf57d('0x29')](_0x4f5be7[_0xf57d('0x2a')],_0x4f5be7[_0xf57d('0x26')]);_0x46acde[_0xf57d('0x2b')]=_[_0xf57d('0x29')](_0x4f5be7[_0xf57d('0x2a')],qs['fields'](_0x4fee92[_0xf57d('0x26')][_0xf57d('0x2c')]));_0x46acde[_0xf57d('0x2b')]=_0x46acde['attributes'][_0xf57d('0x2d')]?_0x46acde[_0xf57d('0x2b')]:_0x4f5be7[_0xf57d('0x2a')];if(!_0x4fee92['query'][_0xf57d('0x2e')](_0xf57d('0x2f'))){_0x46acde[_0xf57d('0x30')]=qs[_0xf57d('0x30')](_0x4fee92['query']['limit']);_0x46acde[_0xf57d('0x18')]=qs['offset'](_0x4fee92[_0xf57d('0x26')][_0xf57d('0x18')]);}_0x46acde[_0xf57d('0x31')]=qs[_0xf57d('0x32')](_0x4fee92[_0xf57d('0x26')][_0xf57d('0x32')]);_0x46acde[_0xf57d('0x33')]=qs[_0xf57d('0x28')](_[_0xf57d('0x34')](_0x4fee92[_0xf57d('0x26')],_0x4f5be7[_0xf57d('0x28')]),_0x8d713b);if(_0x4fee92[_0xf57d('0x26')][_0xf57d('0x35')]){_0x46acde[_0xf57d('0x33')]=_[_0xf57d('0x36')](_0x46acde['where'],{'$or':_[_0xf57d('0x21')](_0x8d713b,function(_0x14f94e){if(_0x14f94e[_0xf57d('0x25')]!==_0xf57d('0x37')){var _0x305f5b={};_0x305f5b[_0x14f94e['name']]={'$like':'%'+_0x4fee92[_0xf57d('0x26')]['filter']+'%'};return _0x305f5b;}})});}_0x46acde=_['merge']({},_0x46acde,_0x4fee92[_0xf57d('0x38')]);var _0x54ed14={'where':_0x46acde[_0xf57d('0x33')]};return db[_0xf57d('0x22')][_0xf57d('0x17')](_0x54ed14)[_0xf57d('0x1b')](function(_0x3c507e){_0x4588a7['count']=_0x3c507e;if(_0x4fee92[_0xf57d('0x26')]['includeAll']){_0x46acde[_0xf57d('0x39')]=[{'all':!![]}];}return db[_0xf57d('0x22')]['findAll'](_0x46acde);})[_0xf57d('0x1b')](function(_0x268fd7){_0x4588a7[_0xf57d('0x3a')]=_0x268fd7;return _0x4588a7;})[_0xf57d('0x1b')](respondWithFilteredResult(_0x1221fb,_0x46acde))[_0xf57d('0x3b')](handleError(_0x1221fb,null));};exports[_0xf57d('0x3c')]=function(_0x165804,_0x543426){var _0x45a8cf={'raw':!![],'where':{'id':_0x165804[_0xf57d('0x3d')]['id']}},_0x27eaad={};_0x27eaad[_0xf57d('0x2a')]=_[_0xf57d('0x27')](db['DeskField'][_0xf57d('0x23')]);_0x27eaad[_0xf57d('0x26')]=_['keys'](_0x165804[_0xf57d('0x26')]);_0x27eaad[_0xf57d('0x28')]=_[_0xf57d('0x29')](_0x27eaad[_0xf57d('0x2a')],_0x27eaad[_0xf57d('0x26')]);_0x45a8cf['attributes']=_[_0xf57d('0x29')](_0x27eaad[_0xf57d('0x2a')],qs['fields'](_0x165804[_0xf57d('0x26')][_0xf57d('0x2c')]));_0x45a8cf[_0xf57d('0x2b')]=_0x45a8cf[_0xf57d('0x2b')][_0xf57d('0x2d')]?_0x45a8cf[_0xf57d('0x2b')]:_0x27eaad[_0xf57d('0x2a')];if(_0x165804[_0xf57d('0x26')]['includeAll']){_0x45a8cf[_0xf57d('0x39')]=[{'all':!![]}];}_0x45a8cf=_['merge']({},_0x45a8cf,_0x165804[_0xf57d('0x38')]);return db[_0xf57d('0x22')][_0xf57d('0x3e')](_0x45a8cf)[_0xf57d('0x1b')](handleEntityNotFound(_0x543426,null))[_0xf57d('0x1b')](respondWithResult(_0x543426,null))[_0xf57d('0x3b')](handleError(_0x543426,null));};exports[_0xf57d('0x3f')]=function(_0x83fba7,_0x5458be){return db[_0xf57d('0x22')][_0xf57d('0x3f')](_0x83fba7[_0xf57d('0x40')],{})[_0xf57d('0x1b')](respondWithResult(_0x5458be,0xc9))[_0xf57d('0x3b')](handleError(_0x5458be,null));};exports[_0xf57d('0x41')]=function(_0x2a7cb9,_0x29ec31){if(_0x2a7cb9[_0xf57d('0x40')]['id']){delete _0x2a7cb9[_0xf57d('0x40')]['id'];}return db[_0xf57d('0x22')][_0xf57d('0x3e')]({'where':{'id':_0x2a7cb9[_0xf57d('0x3d')]['id']}})[_0xf57d('0x1b')](handleEntityNotFound(_0x29ec31,null))[_0xf57d('0x1b')](saveUpdates(_0x2a7cb9[_0xf57d('0x40')],null))['then'](respondWithResult(_0x29ec31,null))[_0xf57d('0x3b')](handleError(_0x29ec31,null));};exports[_0xf57d('0x42')]=function(_0x443243,_0x1a060b){return db[_0xf57d('0x22')][_0xf57d('0x3e')]({'where':{'id':_0x443243[_0xf57d('0x3d')]['id']}})[_0xf57d('0x1b')](handleEntityNotFound(_0x1a060b,null))['then'](removeEntity(_0x1a060b,null))['catch'](handleError(_0x1a060b,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index da89051..024e20c 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 _0x14b3=['desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','DeskField','int_desk_fields'];(function(_0x435ced,_0x516581){var _0x16e19f=function(_0x5a85d3){while(--_0x5a85d3){_0x435ced['push'](_0x435ced['shift']());}};_0x16e19f(++_0x516581);}(_0x14b3,0x6c));var _0x314b=function(_0x279b1a,_0x2bb6df){_0x279b1a=_0x279b1a-0x0;var _0x316364=_0x14b3[_0x279b1a];return _0x316364;};'use strict';var _=require(_0x314b('0x0'));var util=require(_0x314b('0x1'));var logger=require(_0x314b('0x2'))(_0x314b('0x3'));var moment=require('moment');var BPromise=require(_0x314b('0x4'));var rp=require(_0x314b('0x5'));var fs=require('fs');var path=require(_0x314b('0x6'));var rimraf=require(_0x314b('0x7'));var config=require(_0x314b('0x8'));var attributes=require('./intDeskField.attributes');module[_0x314b('0x9')]=function(_0x3b5cc4,_0x4f2ce7){return _0x3b5cc4['define'](_0x314b('0xa'),attributes,{'tableName':_0x314b('0xb'),'paranoid':![],'indexes':[{'name':_0x314b('0xc'),'fields':[_0x314b('0xd'),_0x314b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc0c4=['desk_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','DeskField','int_desk_fields'];(function(_0x5a28c6,_0x29e72f){var _0x27b168=function(_0x44086b){while(--_0x44086b){_0x5a28c6['push'](_0x5a28c6['shift']());}};_0x27b168(++_0x29e72f);}(_0xc0c4,0x8e));var _0x4c0c=function(_0x9c6a89,_0x29b6e0){_0x9c6a89=_0x9c6a89-0x0;var _0x5ef4fa=_0xc0c4[_0x9c6a89];return _0x5ef4fa;};'use strict';var _=require(_0x4c0c('0x0'));var util=require(_0x4c0c('0x1'));var logger=require(_0x4c0c('0x2'))(_0x4c0c('0x3'));var moment=require('moment');var BPromise=require(_0x4c0c('0x4'));var rp=require(_0x4c0c('0x5'));var fs=require('fs');var path=require(_0x4c0c('0x6'));var rimraf=require(_0x4c0c('0x7'));var config=require('../../config/environment');var attributes=require(_0x4c0c('0x8'));module[_0x4c0c('0x9')]=function(_0x2b0912,_0x53bd59){return _0x2b0912['define'](_0x4c0c('0xa'),attributes,{'tableName':_0x4c0c('0xb'),'paranoid':![],'indexes':[{'name':_0x4c0c('0xc'),'fields':[_0x4c0c('0xd'),'FieldId'],'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 2a86706..efc9a51 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 _0x2b7c=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskField,\x20%s,\x20%s'];(function(_0x5c9008,_0x4bb3a6){var _0x31a5e0=function(_0x3f7f1d){while(--_0x3f7f1d){_0x5c9008['push'](_0x5c9008['shift']());}};_0x31a5e0(++_0x4bb3a6);}(_0x2b7c,0x1ab));var _0xc2b7=function(_0x223e99,_0x2b1f3b){_0x223e99=_0x223e99-0x0;var _0x22db24=_0x2b7c[_0x223e99];return _0x22db24;};'use strict';var _=require(_0xc2b7('0x0'));var util=require(_0xc2b7('0x1'));var moment=require(_0xc2b7('0x2'));var BPromise=require(_0xc2b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2b7('0x4'))['db'];var utils=require(_0xc2b7('0x5'));var logger=require(_0xc2b7('0x6'))(_0xc2b7('0x7'));var config=require(_0xc2b7('0x8'));var jayson=require(_0xc2b7('0x9'));var client=jayson[_0xc2b7('0xa')][_0xc2b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b2cd9,_0x23c1fc,_0x5c5505){return new BPromise(function(_0x3f53b8,_0x5ae16e){return client[_0xc2b7('0xc')](_0x4b2cd9,_0x5c5505)[_0xc2b7('0xd')](function(_0x1090d4){logger[_0xc2b7('0xe')]('DeskField,\x20%s,\x20%s',_0x23c1fc,_0xc2b7('0xf'));logger[_0xc2b7('0x10')](_0xc2b7('0x11'),_0x23c1fc,'request\x20sent',JSON[_0xc2b7('0x12')](_0x1090d4));if(_0x1090d4['error']){if(_0x1090d4[_0xc2b7('0x13')][_0xc2b7('0x14')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x23c1fc,_0x1090d4[_0xc2b7('0x13')]['message']);return _0x5ae16e(_0x1090d4['error'][_0xc2b7('0x15')]);}logger[_0xc2b7('0x13')](_0xc2b7('0x16'),_0x23c1fc,_0x1090d4[_0xc2b7('0x13')][_0xc2b7('0x15')]);return _0x3f53b8(_0x1090d4['error'][_0xc2b7('0x15')]);}else{logger[_0xc2b7('0xe')](_0xc2b7('0x16'),_0x23c1fc,_0xc2b7('0xf'));_0x3f53b8(_0x1090d4[_0xc2b7('0x17')][_0xc2b7('0x15')]);}})[_0xc2b7('0x18')](function(_0x246df9){logger[_0xc2b7('0x13')](_0xc2b7('0x16'),_0x23c1fc,_0x246df9);_0x5ae16e(_0x246df9);});});} \ No newline at end of file +var _0xe137=['code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xe137,0x71));var _0x7e13=function(_0x34a8c8,_0x31e259){_0x34a8c8=_0x34a8c8-0x0;var _0x1fe6e5=_0xe137[_0x34a8c8];return _0x1fe6e5;};'use strict';var _=require(_0x7e13('0x0'));var util=require(_0x7e13('0x1'));var moment=require(_0x7e13('0x2'));var BPromise=require(_0x7e13('0x3'));var rs=require(_0x7e13('0x4'));var fs=require('fs');var Redis=require(_0x7e13('0x5'));var db=require(_0x7e13('0x6'))['db'];var utils=require(_0x7e13('0x7'));var logger=require(_0x7e13('0x8'))(_0x7e13('0x9'));var config=require(_0x7e13('0xa'));var jayson=require(_0x7e13('0xb'));var client=jayson[_0x7e13('0xc')][_0x7e13('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5a9899,_0x3f7301,_0x3a438c){return new BPromise(function(_0x297f2a,_0x3cb60e){return client[_0x7e13('0xe')](_0x5a9899,_0x3a438c)[_0x7e13('0xf')](function(_0xd1bbba){logger[_0x7e13('0x10')](_0x7e13('0x11'),_0x3f7301,'request\x20sent');logger[_0x7e13('0x12')](_0x7e13('0x13'),_0x3f7301,_0x7e13('0x14'),JSON[_0x7e13('0x15')](_0xd1bbba));if(_0xd1bbba['error']){if(_0xd1bbba['error'][_0x7e13('0x16')]===0x1f4){logger[_0x7e13('0x17')](_0x7e13('0x11'),_0x3f7301,_0xd1bbba[_0x7e13('0x17')]['message']);return _0x3cb60e(_0xd1bbba[_0x7e13('0x17')][_0x7e13('0x18')]);}logger[_0x7e13('0x17')](_0x7e13('0x11'),_0x3f7301,_0xd1bbba[_0x7e13('0x17')]['message']);return _0x297f2a(_0xd1bbba[_0x7e13('0x17')][_0x7e13('0x18')]);}else{logger[_0x7e13('0x10')]('DeskField,\x20%s,\x20%s',_0x3f7301,'request\x20sent');_0x297f2a(_0xd1bbba[_0x7e13('0x19')]['message']);}})[_0x7e13('0x1a')](function(_0x3d5258){logger[_0x7e13('0x17')]('DeskField,\x20%s,\x20%s',_0x3f7301,_0x3d5258);_0x3cb60e(_0x3d5258);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 64aa2d4..5f74f8d 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 _0xa2c4=['exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','post','create','put','update','delete','destroy'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xa2c4,0x1a5));var _0x4a2c=function(_0x34ca8d,_0x1b9c33){_0x34ca8d=_0x34ca8d-0x0;var _0x58f8c1=_0xa2c4[_0x34ca8d];return _0x58f8c1;};'use strict';var multer=require(_0x4a2c('0x0'));var util=require(_0x4a2c('0x1'));var path=require(_0x4a2c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4a2c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4a2c('0x4'));var config=require(_0x4a2c('0x5'));var controller=require(_0x4a2c('0x6'));router[_0x4a2c('0x7')]('/',auth['isAuthenticated'](),controller[_0x4a2c('0x8')]);router['get'](_0x4a2c('0x9'),auth[_0x4a2c('0xa')](),controller['show']);router[_0x4a2c('0x7')]('/:id/configurations',auth[_0x4a2c('0xa')](),controller[_0x4a2c('0xb')]);router[_0x4a2c('0x7')](_0x4a2c('0xc'),auth[_0x4a2c('0xa')](),controller['getFields']);router[_0x4a2c('0xd')]('/',auth[_0x4a2c('0xa')](),controller[_0x4a2c('0xe')]);router['post']('/:id/configurations',auth[_0x4a2c('0xa')](),controller['addConfiguration']);router[_0x4a2c('0xf')](_0x4a2c('0x9'),auth[_0x4a2c('0xa')](),controller[_0x4a2c('0x10')]);router[_0x4a2c('0x11')](_0x4a2c('0x9'),auth[_0x4a2c('0xa')](),controller[_0x4a2c('0x12')]);module[_0x4a2c('0x13')]=router; \ No newline at end of file +var _0x577b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','connect-timeout','express'];(function(_0x132d12,_0x2c9799){var _0x1c3163=function(_0x7d9136){while(--_0x7d9136){_0x132d12['push'](_0x132d12['shift']());}};_0x1c3163(++_0x2c9799);}(_0x577b,0x11e));var _0xb577=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x577b[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb577('0x0'));var express=require(_0xb577('0x1'));var router=express[_0xb577('0x2')]();var fs_extra=require(_0xb577('0x3'));var auth=require(_0xb577('0x4'));var interaction=require(_0xb577('0x5'));var config=require(_0xb577('0x6'));var controller=require(_0xb577('0x7'));router[_0xb577('0x8')]('/',auth[_0xb577('0x9')](),controller[_0xb577('0xa')]);router[_0xb577('0x8')](_0xb577('0xb'),auth[_0xb577('0x9')](),controller[_0xb577('0xc')]);router[_0xb577('0x8')](_0xb577('0xd'),auth['isAuthenticated'](),controller[_0xb577('0xe')]);router[_0xb577('0x8')](_0xb577('0xf'),auth[_0xb577('0x9')](),controller[_0xb577('0x10')]);router[_0xb577('0x11')]('/',auth['isAuthenticated'](),controller[_0xb577('0x12')]);router[_0xb577('0x11')](_0xb577('0xd'),auth['isAuthenticated'](),controller[_0xb577('0x13')]);router[_0xb577('0x14')](_0xb577('0xb'),auth[_0xb577('0x9')](),controller[_0xb577('0x15')]);router['delete'](_0xb577('0xb'),auth[_0xb577('0x9')](),controller[_0xb577('0x16')]);module[_0xb577('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index e5268b6..a5f1193 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 _0xc939=['STRING'];(function(_0x317ee8,_0x97ac10){var _0x43dbe5=function(_0x5c1511){while(--_0x5c1511){_0x317ee8['push'](_0x317ee8['shift']());}};_0x43dbe5(++_0x97ac10);}(_0xc939,0xb2));var _0x9c93=function(_0x30a54f,_0x20a0f4){_0x30a54f=_0x30a54f-0x0;var _0x547099=_0xc939[_0x30a54f];return _0x547099;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9c93('0x0')]},'username':{'type':Sequelize[_0x9c93('0x0')]},'password':{'type':Sequelize[_0x9c93('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x9c93('0x0')]},'clientId':{'type':Sequelize[_0x9c93('0x0')]},'clientSecret':{'type':Sequelize[_0x9c93('0x0')]},'serverUrl':{'type':Sequelize[_0x9c93('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x9c93('0x0')]}}; \ No newline at end of file +var _0x4341=['exports','STRING'];(function(_0xee0468,_0x543e3e){var _0x3cf37c=function(_0x553249){while(--_0x553249){_0xee0468['push'](_0xee0468['shift']());}};_0x3cf37c(++_0x543e3e);}(_0x4341,0x15c));var _0x1434=function(_0x5ec454,_0xfcd77e){_0x5ec454=_0x5ec454-0x0;var _0x5ebf50=_0x4341[_0x5ec454];return _0x5ebf50;};'use strict';var Sequelize=require('sequelize');module[_0x1434('0x0')]={'name':{'type':Sequelize[_0x1434('0x1')]},'username':{'type':Sequelize[_0x1434('0x1')]},'password':{'type':Sequelize[_0x1434('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x1434('0x1')]},'clientSecret':{'type':Sequelize[_0x1434('0x1')]},'serverUrl':{'type':Sequelize[_0x1434('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1434('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index d94ed77..9c875b9 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 _0x3c9f=['subject','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdon','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','clientId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','@odata.type','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Attributes(','true','FalseOption',')/Microsoft.Dynamics.CRM.','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','name','send','Dynamics365Account','rawAttributes','fieldName','type','model','map','keys','query','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','filters','intersection','length','catch','create','body','find','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','getDescriptions','Subjects','Descriptions','getFields','ticketType','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode'];(function(_0x481af3,_0x483fac){var _0x3354ea=function(_0x2e3de5){while(--_0x2e3de5){_0x481af3['push'](_0x481af3['shift']());}};_0x3354ea(++_0x483fac);}(_0x3c9f,0x148));var _0xf3c9=function(_0x4506b9,_0x254d36){_0x4506b9=_0x4506b9-0x0;var _0x1e91b7=_0x3c9f[_0x4506b9];return _0x1e91b7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf3c9('0x0'));var rimraf=require(_0xf3c9('0x1'));var zipdir=require(_0xf3c9('0x2'));var jsonpatch=require(_0xf3c9('0x3'));var rp=require(_0xf3c9('0x4'));var moment=require(_0xf3c9('0x5'));var BPromise=require(_0xf3c9('0x6'));var Mustache=require('mustache');var util=require(_0xf3c9('0x7'));var path=require(_0xf3c9('0x8'));var sox=require(_0xf3c9('0x9'));var csv=require(_0xf3c9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3c9('0xb'));var _=require('lodash');var squel=require(_0xf3c9('0xc'));var crypto=require(_0xf3c9('0xd'));var jsforce=require(_0xf3c9('0xe'));var deskjs=require(_0xf3c9('0xf'));var toCsv=require(_0xf3c9('0xa'));var querystring=require(_0xf3c9('0x10'));var Papa=require(_0xf3c9('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf3c9('0x12'));var as=require(_0xf3c9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3c9('0x14'))(_0xf3c9('0x15'));var utils=require(_0xf3c9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf3c9('0x17'));var db=require(_0xf3c9('0x18'))['db'];var integrations=require(_0xf3c9('0x19'));var jayson=require(_0xf3c9('0x1a'));var client=jayson[_0xf3c9('0x1b')][_0xf3c9('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x546f8f,_0x5c03dd,_0x131e2d,_0x4a98ea){return new BPromise(function(_0x4164b4,_0x1d0084){var _0x1f26d4=_0x4a98ea||client;return _0x1f26d4['request'](_0x546f8f,_0x131e2d)[_0xf3c9('0x1d')](function(_0x5b2dcc){logger[_0xf3c9('0x1e')](_0xf3c9('0x1f'),_0x5c03dd,_0xf3c9('0x20'));logger[_0xf3c9('0x21')](_0xf3c9('0x22'),_0x5c03dd,_0xf3c9('0x20'),JSON['stringify'](_0x5b2dcc));if(_0x5b2dcc[_0xf3c9('0x23')]){if(_0x5b2dcc[_0xf3c9('0x23')][_0xf3c9('0x24')]===0x1f4){logger[_0xf3c9('0x23')]('Dynamics365Account,\x20%s,\x20%s',_0x5c03dd,_0x5b2dcc['error'][_0xf3c9('0x25')]);return _0x1d0084(_0x5b2dcc[_0xf3c9('0x23')][_0xf3c9('0x25')]);}logger[_0xf3c9('0x23')]('Dynamics365Account,\x20%s,\x20%s',_0x5c03dd,_0x5b2dcc['error'][_0xf3c9('0x25')]);return _0x4164b4(_0x5b2dcc[_0xf3c9('0x23')][_0xf3c9('0x25')]);}else{logger['info'](_0xf3c9('0x1f'),_0x5c03dd,'request\x20sent');_0x4164b4(_0x5b2dcc[_0xf3c9('0x26')]['message']);}})['catch'](function(_0x4e55dd){logger[_0xf3c9('0x23')](_0xf3c9('0x1f'),_0x5c03dd,_0x4e55dd);_0x1d0084(_0x4e55dd);});});}function respondWithStatusCode(_0x59f725,_0x3b42c3){_0x3b42c3=_0x3b42c3||0xcc;return function(_0x18b49f){if(_0x18b49f){return _0x59f725[_0xf3c9('0x27')](_0x3b42c3);}return _0x59f725[_0xf3c9('0x28')](_0x3b42c3)[_0xf3c9('0x29')]();};}function respondWithResult(_0x49f93a,_0x37725b){_0x37725b=_0x37725b||0xc8;return function(_0x542f60){if(_0x542f60){return _0x49f93a[_0xf3c9('0x28')](_0x37725b)[_0xf3c9('0x2a')](_0x542f60);}};}function respondWithFilteredResult(_0xad8afb,_0x2aa3cd){return function(_0x324122){if(_0x324122){var _0xcc4cbd=_0x324122[_0xf3c9('0x2b')],_0x3a6052=_0x2aa3cd['offset'],_0x4fd342=_0x2aa3cd[_0xf3c9('0x2c')]+_0x2aa3cd['limit'],_0xd7a817;if(_0x4fd342>=_0xcc4cbd){_0x4fd342=_0xcc4cbd;_0xd7a817=0xc8;}else{_0xd7a817=0xce;}_0xad8afb[_0xf3c9('0x28')](_0xd7a817);return _0xad8afb[_0xf3c9('0x2d')](_0xf3c9('0x2e'),_0x3a6052+'-'+_0x4fd342+'/'+_0xcc4cbd)['json'](_0x324122);}return null;};}function patchUpdates(_0x2ccdbd){return function(_0x5dcd6c){try{jsonpatch[_0xf3c9('0x2f')](_0x5dcd6c,_0x2ccdbd,!![]);}catch(_0x190b28){return BPromise['reject'](_0x190b28);}return _0x5dcd6c[_0xf3c9('0x30')]();};}function saveUpdates(_0x283c68,_0x38365b){return function(_0x5912ab){if(_0x5912ab){return _0x5912ab[_0xf3c9('0x31')](_0x283c68)['then'](function(_0x491f96){return _0x491f96;});}return null;};}function removeEntity(_0x52d3b7,_0x5773e3){return function(_0x1d5b7a){if(_0x1d5b7a){return _0x1d5b7a[_0xf3c9('0x32')]()[_0xf3c9('0x1d')](function(){_0x52d3b7[_0xf3c9('0x28')](0xcc)[_0xf3c9('0x29')]();});}};}function handleEntityNotFound(_0x56a0ed,_0x388697){return function(_0x39a6fc){if(!_0x39a6fc){_0x56a0ed['sendStatus'](0x194);}return _0x39a6fc;};}function handleError(_0x49b93c,_0x333011){_0x333011=_0x333011||0x1f4;return function(_0x40867e){logger[_0xf3c9('0x23')](_0x40867e['stack']);if(_0x40867e[_0xf3c9('0x33')]){delete _0x40867e[_0xf3c9('0x33')];}_0x49b93c[_0xf3c9('0x28')](_0x333011)[_0xf3c9('0x34')](_0x40867e);};}exports['index']=function(_0x23bc38,_0x55c887){var _0x44cb75={},_0x4e4df4={},_0x15b76d={'count':0x0,'rows':[]};var _0xb13206=_['map'](db[_0xf3c9('0x35')][_0xf3c9('0x36')],function(_0x5b0fdc){return{'name':_0x5b0fdc[_0xf3c9('0x37')],'type':_0x5b0fdc[_0xf3c9('0x38')]['key']};});_0x4e4df4[_0xf3c9('0x39')]=_[_0xf3c9('0x3a')](_0xb13206,_0xf3c9('0x33'));_0x4e4df4['query']=_[_0xf3c9('0x3b')](_0x23bc38[_0xf3c9('0x3c')]);_0x4e4df4['filters']=_['intersection'](_0x4e4df4[_0xf3c9('0x39')],_0x4e4df4['query']);_0x44cb75[_0xf3c9('0x3d')]=_['intersection'](_0x4e4df4['model'],qs[_0xf3c9('0x3e')](_0x23bc38['query']['fields']));_0x44cb75['attributes']=_0x44cb75['attributes']['length']?_0x44cb75[_0xf3c9('0x3d')]:_0x4e4df4[_0xf3c9('0x39')];if(!_0x23bc38[_0xf3c9('0x3c')]['hasOwnProperty'](_0xf3c9('0x3f'))){_0x44cb75[_0xf3c9('0x40')]=qs['limit'](_0x23bc38['query'][_0xf3c9('0x40')]);_0x44cb75[_0xf3c9('0x2c')]=qs[_0xf3c9('0x2c')](_0x23bc38[_0xf3c9('0x3c')][_0xf3c9('0x2c')]);}_0x44cb75[_0xf3c9('0x41')]=qs['sort'](_0x23bc38['query'][_0xf3c9('0x42')]);_0x44cb75[_0xf3c9('0x43')]=qs['filters'](_[_0xf3c9('0x44')](_0x23bc38[_0xf3c9('0x3c')],_0x4e4df4['filters']),_0xb13206);if(_0x23bc38['query'][_0xf3c9('0x45')]){_0x44cb75['where']=_[_0xf3c9('0x46')](_0x44cb75[_0xf3c9('0x43')],{'$or':_[_0xf3c9('0x3a')](_0xb13206,function(_0x494007){if(_0x494007[_0xf3c9('0x38')]!==_0xf3c9('0x47')){var _0x3c2b14={};_0x3c2b14[_0x494007[_0xf3c9('0x33')]]={'$like':'%'+_0x23bc38[_0xf3c9('0x3c')]['filter']+'%'};return _0x3c2b14;}})});}_0x44cb75=_[_0xf3c9('0x46')]({},_0x44cb75,_0x23bc38[_0xf3c9('0x48')]);var _0x31071e={'where':_0x44cb75[_0xf3c9('0x43')]};return db['Dynamics365Account'][_0xf3c9('0x2b')](_0x31071e)[_0xf3c9('0x1d')](function(_0x1274ae){_0x15b76d[_0xf3c9('0x2b')]=_0x1274ae;if(_0x23bc38[_0xf3c9('0x3c')][_0xf3c9('0x49')]){_0x44cb75['include']=[{'all':!![]}];}return db[_0xf3c9('0x35')][_0xf3c9('0x4a')](_0x44cb75);})['then'](function(_0x25c7bb){_0x15b76d['rows']=_0x25c7bb;return _0x15b76d;})[_0xf3c9('0x1d')](respondWithFilteredResult(_0x55c887,_0x44cb75))['catch'](handleError(_0x55c887,null));};exports[_0xf3c9('0x4b')]=function(_0x2e35cc,_0x5bd7a9){var _0x2de3f9={'raw':![],'where':{'id':_0x2e35cc[_0xf3c9('0x4c')]['id']}},_0x2c1b7f={};_0x2c1b7f[_0xf3c9('0x39')]=_[_0xf3c9('0x3b')](db[_0xf3c9('0x35')][_0xf3c9('0x36')]);_0x2c1b7f['query']=_['keys'](_0x2e35cc[_0xf3c9('0x3c')]);_0x2c1b7f[_0xf3c9('0x4d')]=_[_0xf3c9('0x4e')](_0x2c1b7f[_0xf3c9('0x39')],_0x2c1b7f[_0xf3c9('0x3c')]);_0x2de3f9[_0xf3c9('0x3d')]=_[_0xf3c9('0x4e')](_0x2c1b7f[_0xf3c9('0x39')],qs[_0xf3c9('0x3e')](_0x2e35cc[_0xf3c9('0x3c')][_0xf3c9('0x3e')]));_0x2de3f9[_0xf3c9('0x3d')]=_0x2de3f9[_0xf3c9('0x3d')][_0xf3c9('0x4f')]?_0x2de3f9['attributes']:_0x2c1b7f[_0xf3c9('0x39')];if(_0x2e35cc[_0xf3c9('0x3c')][_0xf3c9('0x49')]){_0x2de3f9['include']=[{'all':!![]}];}_0x2de3f9=_[_0xf3c9('0x46')]({},_0x2de3f9,_0x2e35cc[_0xf3c9('0x48')]);return db['Dynamics365Account']['find'](_0x2de3f9)[_0xf3c9('0x1d')](handleEntityNotFound(_0x5bd7a9,null))['then'](respondWithResult(_0x5bd7a9,null))[_0xf3c9('0x50')](handleError(_0x5bd7a9,null));};exports[_0xf3c9('0x51')]=function(_0x1af130,_0x563b27){return db[_0xf3c9('0x35')]['create'](_0x1af130[_0xf3c9('0x52')],{})['then'](respondWithResult(_0x563b27,0xc9))['catch'](handleError(_0x563b27,null));};exports[_0xf3c9('0x31')]=function(_0x167138,_0x2c7b0c){if(_0x167138[_0xf3c9('0x52')]['id']){delete _0x167138[_0xf3c9('0x52')]['id'];}return db['Dynamics365Account'][_0xf3c9('0x53')]({'where':{'id':_0x167138[_0xf3c9('0x4c')]['id']}})[_0xf3c9('0x1d')](handleEntityNotFound(_0x2c7b0c,null))[_0xf3c9('0x1d')](saveUpdates(_0x167138[_0xf3c9('0x52')],null))[_0xf3c9('0x1d')](respondWithResult(_0x2c7b0c,null))[_0xf3c9('0x50')](handleError(_0x2c7b0c,null));};exports[_0xf3c9('0x32')]=function(_0x30374a,_0x230cc9){return db[_0xf3c9('0x35')][_0xf3c9('0x53')]({'where':{'id':_0x30374a['params']['id']}})[_0xf3c9('0x1d')](handleEntityNotFound(_0x230cc9,null))[_0xf3c9('0x1d')](removeEntity(_0x230cc9,null))[_0xf3c9('0x50')](handleError(_0x230cc9,null));};exports[_0xf3c9('0x54')]=function(_0x4a3485,_0x42d138,_0x45a30d){var _0x27b39e={};var _0x5f844c={};var _0x5753ef;var _0x4c492b;return db[_0xf3c9('0x35')][_0xf3c9('0x55')]({'where':{'id':_0x4a3485[_0xf3c9('0x4c')]['id']}})[_0xf3c9('0x1d')](handleEntityNotFound(_0x42d138,null))[_0xf3c9('0x1d')](function(_0xf2d243){if(_0xf2d243){_0x5753ef=_0xf2d243;_0x5f844c[_0xf3c9('0x39')]=_[_0xf3c9('0x3b')](db[_0xf3c9('0x56')][_0xf3c9('0x36')]);_0x5f844c[_0xf3c9('0x3c')]=_[_0xf3c9('0x3b')](_0x4a3485[_0xf3c9('0x3c')]);_0x5f844c['filters']=_[_0xf3c9('0x4e')](_0x5f844c[_0xf3c9('0x39')],_0x5f844c['query']);_0x27b39e[_0xf3c9('0x3d')]=_[_0xf3c9('0x4e')](_0x5f844c[_0xf3c9('0x39')],qs[_0xf3c9('0x3e')](_0x4a3485[_0xf3c9('0x3c')][_0xf3c9('0x3e')]));_0x27b39e[_0xf3c9('0x3d')]=_0x27b39e[_0xf3c9('0x3d')][_0xf3c9('0x4f')]?_0x27b39e[_0xf3c9('0x3d')]:_0x5f844c[_0xf3c9('0x39')];_0x27b39e[_0xf3c9('0x41')]=qs[_0xf3c9('0x42')](_0x4a3485['query'][_0xf3c9('0x42')]);_0x27b39e[_0xf3c9('0x43')]=qs['filters'](_['pick'](_0x4a3485[_0xf3c9('0x3c')],_0x5f844c[_0xf3c9('0x4d')]));if(_0x4a3485[_0xf3c9('0x3c')]['filter']){_0x27b39e[_0xf3c9('0x43')]=_[_0xf3c9('0x46')](_0x27b39e['where'],{'$or':_[_0xf3c9('0x3a')](_0x27b39e['attributes'],function(_0x1a5157){var _0x2baca9={};_0x2baca9[_0x1a5157]={'$like':'%'+_0x4a3485[_0xf3c9('0x3c')][_0xf3c9('0x45')]+'%'};return _0x2baca9;})});}_0x27b39e=_['merge']({},_0x27b39e,_0x4a3485[_0xf3c9('0x48')]);return _0x5753ef[_0xf3c9('0x54')](_0x27b39e);}})[_0xf3c9('0x1d')](function(_0x56be8c){if(_0x56be8c){_0x4c492b=_0x56be8c['length'];if(!_0x4a3485[_0xf3c9('0x3c')][_0xf3c9('0x57')](_0xf3c9('0x3f'))){_0x27b39e[_0xf3c9('0x40')]=qs['limit'](_0x4a3485['query'][_0xf3c9('0x40')]);_0x27b39e[_0xf3c9('0x2c')]=qs['offset'](_0x4a3485[_0xf3c9('0x3c')][_0xf3c9('0x2c')]);}return _0x5753ef['getConfigurations'](_0x27b39e);}})['then'](function(_0x432b42){if(_0x432b42){return _0x432b42?{'count':_0x4c492b,'rows':_0x432b42}:null;}})[_0xf3c9('0x1d')](respondWithResult(_0x42d138,null))[_0xf3c9('0x50')](handleError(_0x42d138,null));};exports[_0xf3c9('0x58')]=function(_0x4319b1,_0x1cd4bd,_0x2f357b){if(_0x4319b1['body']['id']){delete _0x4319b1['body']['id'];}return db[_0xf3c9('0x35')][_0xf3c9('0x55')]({'where':{'id':_0x4319b1[_0xf3c9('0x4c')]['id']}})[_0xf3c9('0x1d')](handleEntityNotFound(_0x1cd4bd,null))[_0xf3c9('0x1d')](function(_0x4f4b6c){if(_0x4f4b6c){_0x4319b1[_0xf3c9('0x52')][_0xf3c9('0x59')]=_0x4f4b6c['id'];_0x4319b1[_0xf3c9('0x52')]['Subjects']=integrations[_0xf3c9('0x5a')](_0x4319b1[_0xf3c9('0x52')][_0xf3c9('0x5b')],_0x4319b1[_0xf3c9('0x52')]['type']);_0x4319b1[_0xf3c9('0x52')]['Descriptions']=integrations[_0xf3c9('0x5c')](_0x4319b1['body'][_0xf3c9('0x5b')],_0x4319b1[_0xf3c9('0x52')][_0xf3c9('0x38')]);return db[_0xf3c9('0x56')][_0xf3c9('0x51')](_0x4319b1['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0xf3c9('0x5d')},{'model':db['Dynamics365Field'],'as':_0xf3c9('0x5e')}]});}return null;})[_0xf3c9('0x1d')](respondWithResult(_0x1cd4bd,null))['catch'](handleError(_0x1cd4bd,null));};exports[_0xf3c9('0x5f')]=function(_0x4ce750,_0x577868,_0x34d400){var _0x5e8a61=_0x4ce750['query'][_0xf3c9('0x60')];var _0xcba346=_0x5e8a61==='incident'?_0xf3c9('0x61'):_0xf3c9('0x62');var _0x512a7f='';var _0x1fd705='';var _0x371934='';var _0x5703d2='';var _0x5a1494='';var _0x4e9355='';var _0x487f44='';var _0x5c35d5='';var _0x576619=[_0xf3c9('0x63'),_0xf3c9('0x64'),_0xf3c9('0x65'),_0xf3c9('0x66'),_0xf3c9('0x67'),_0xf3c9('0x68'),'phonenumber','regardingobjectid','directioncode',_0xf3c9('0x69')];var _0xd0d20b=['accountidname',_0xf3c9('0x6a'),_0xf3c9('0x6b'),_0xf3c9('0x6c'),_0xf3c9('0x6d'),_0xf3c9('0x6e'),'contractdetailidname',_0xf3c9('0x6f'),'createdbyexternalpartyname',_0xf3c9('0x70'),'createdbyname',_0xf3c9('0x71'),_0xf3c9('0x72'),'createdonbehalfbyname','createdonbehalfbyyominame',_0xf3c9('0x73'),'customeridtype',_0xf3c9('0x74'),_0xf3c9('0x75'),_0xf3c9('0x76'),_0xf3c9('0x77'),_0xf3c9('0x78'),_0xf3c9('0x79'),'exchangerate',_0xf3c9('0x7a'),_0xf3c9('0x7b'),_0xf3c9('0x7c'),'influencescore',_0xf3c9('0x7d'),_0xf3c9('0x7e'),_0xf3c9('0x7f'),_0xf3c9('0x80'),_0xf3c9('0x81'),_0xf3c9('0x82'),_0xf3c9('0x83'),_0xf3c9('0x84'),_0xf3c9('0x85'),_0xf3c9('0x86'),_0xf3c9('0x87'),_0xf3c9('0x88'),_0xf3c9('0x89'),_0xf3c9('0x8a'),_0xf3c9('0x8b'),_0xf3c9('0x8c'),_0xf3c9('0x8d'),_0xf3c9('0x8e'),_0xf3c9('0x8f'),_0xf3c9('0x90'),'primarycontactidyominame',_0xf3c9('0x91'),_0xf3c9('0x92'),'productserialnumber',_0xf3c9('0x93'),'resolvebykpiidname',_0xf3c9('0x94'),_0xf3c9('0x95'),_0xf3c9('0x96'),'sentimentvalue',_0xf3c9('0x97'),'slaname','socialprofileidname','statecode',_0xf3c9('0x98'),_0xf3c9('0x99'),_0xf3c9('0x9a'),'timezoneruleversionnumber',_0xf3c9('0x9b'),_0xf3c9('0x9c'),_0xf3c9('0x9d'),_0xf3c9('0x9e')];var _0xdc64dc=_0x576619[_0xf3c9('0x9f')](_0xd0d20b);return db[_0xf3c9('0x35')]['findOne']({'where':{'id':_0x4ce750[_0xf3c9('0x4c')]['id']},'attributes':['id',_0xf3c9('0xa0'),_0xf3c9('0xa1'),_0xf3c9('0xa2'),'tenantId','clientId',_0xf3c9('0xa3')]})[_0xf3c9('0x1d')](handleEntityNotFound(_0x577868,null))[_0xf3c9('0x1d')](function(_0x4770a8){if(_0x4770a8){_0x5c35d5=_0x4770a8[_0xf3c9('0xa2')];var _0x53b3a8=_0x5c35d5[_0xf3c9('0xa4')](-0x1);if(_0x53b3a8==='/'){_0x5c35d5=_0x5c35d5[_0xf3c9('0xa5')](0x0,_0x5c35d5[_0xf3c9('0xa6')](_0x53b3a8));}_0x487f44=util[_0xf3c9('0xa7')](_0xf3c9('0xa8'),_0x5c35d5);var _0x14c447={'method':'POST','uri':_0xf3c9('0xa9')+_0x4770a8['tenantId']+_0xf3c9('0xaa'),'form':{'client_id':_0x4770a8[_0xf3c9('0xab')],'resource':_0x5c35d5,'username':_0x4770a8[_0xf3c9('0xa0')],'password':_0x4770a8[_0xf3c9('0xa1')],'grant_type':_0xf3c9('0xa1'),'client_secret':_0x4770a8[_0xf3c9('0xa3')]},'json':!![]};return rp(_0x14c447);}})[_0xf3c9('0x1d')](function(_0x36fcd8){_0x4e9355=_0x36fcd8[_0xf3c9('0xac')];var _0x1dc2ae={'method':_0xf3c9('0xad'),'uri':encodeURI(_0x487f44+_0xf3c9('0xae')+_0xcba346+'\x27'),'headers':{'Authorization':_0xf3c9('0xaf')+_0x4e9355,'If-None-Match':null,'OData-Version':_0xf3c9('0xb0')},'json':!![]};return rp(_0x1dc2ae);})[_0xf3c9('0x1d')](function(_0x37e835){var _0x4e599c=_0x37e835[_0xf3c9('0xb1')][0x0];var _0x4f9b48=_0x4e599c[_0xf3c9('0xb2')];var _0x2e3bf8={'method':'GET','uri':_0x487f44+_0xf3c9('0xb3')+_0x4f9b48+_0xf3c9('0xb4'),'headers':{'Authorization':_0xf3c9('0xaf')+_0x4e9355,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2e3bf8);})[_0xf3c9('0x1d')](function(_0x297d7c){_0x512a7f=_0x297d7c;_0x1fd705=_0x512a7f[_0xf3c9('0xb5')];_0x1fd705=_[_0xf3c9('0xb6')](_0x1fd705,function(_0x566ec0){return!_0xdc64dc[_0xf3c9('0xb7')](_0x566ec0['LogicalName']);});var _0x1f933d=[];var _0x2a6a18=[];_0x1fd705['forEach'](function(_0x17873e){if(_0x17873e['@odata.type']){var _0x1c6e88=_0x17873e[_0xf3c9('0xb8')][_0xf3c9('0xa5')](_0x17873e['@odata.type'][_0xf3c9('0xa6')]('.')+0x1);if(_0x1c6e88===_0xf3c9('0xb9')){_0x1f933d[_0xf3c9('0xba')](getSelectList(_0x487f44,_0x5e8a61,_0x2a6a18,_0x512a7f[_0xf3c9('0xb2')],_0x17873e[_0xf3c9('0xb2')],_0x4e9355));}}});return Promise[_0xf3c9('0xbb')](_0x1f933d);})[_0xf3c9('0x1d')](function(_0x3f392b){_0x371934=_0x3f392b[0x0];var _0x500117=[];var _0x183dc5=[];_0x1fd705[_0xf3c9('0xbc')](function(_0x3649e0){if(!_[_0xf3c9('0xbd')](_0x3649e0[_0xf3c9('0xb8')])){var _0x6195d1=_0x3649e0['@odata.type']['substring'](_0x3649e0[_0xf3c9('0xb8')]['lastIndexOf']('.')+0x1);if(_0x6195d1===_0xf3c9('0xbe')){_0x500117[_0xf3c9('0xba')](getBooleanList(_0x487f44,_0x5e8a61,_0x183dc5,_0x512a7f[_0xf3c9('0xb2')],_0x3649e0[_0xf3c9('0xb2')],_0x4e9355));}}});return Promise[_0xf3c9('0xbb')](_0x500117);})[_0xf3c9('0x1d')](function(_0x19ef50){_0x5703d2=_0x19ef50[0x0];var _0x307993=[];var _0x538c57=[];_0x1fd705['forEach'](function(_0x4a1264){if(_0x4a1264[_0xf3c9('0xb8')]){var _0x341f33=_0x4a1264['@odata.type']['substring'](_0x4a1264['@odata.type'][_0xf3c9('0xa6')]('.')+0x1);if(_0x341f33===_0xf3c9('0xbf')||_0x341f33===_0xf3c9('0xc0')||_0x341f33===_0xf3c9('0xc1')||_0x341f33==='IntegerAttributeMetadata'||_0x341f33===_0xf3c9('0xc2')||_0x341f33===_0xf3c9('0xc3')||_0x341f33===_0xf3c9('0xc4')||_0x341f33===_0xf3c9('0xc5')||_0x341f33===_0xf3c9('0xc6')||_0x341f33===_0xf3c9('0xc7')){_0x307993[_0xf3c9('0xba')](getInputList(_0x487f44,_0x5e8a61,_0x341f33,_0x538c57,_0x512a7f[_0xf3c9('0xb2')],_0x4a1264[_0xf3c9('0xb2')],_0x4e9355));}}});return Promise['all'](_0x307993);})[_0xf3c9('0x1d')](function(_0x559370){_0x5a1494=_0x559370[0x0];var _0x4502a8=_0x371934[_0xf3c9('0x9f')](_0x5703d2)[_0xf3c9('0x9f')](_0x5a1494);var _0x1db2d2={'count':_0x4502a8[_0xf3c9('0x4f')],'rows':_0x4502a8};return _0x1db2d2;})['then'](respondWithResult(_0x577868,null))[_0xf3c9('0x50')](function(_0x1d099b){var _0x413993=_0x4ce750['query'][_0xf3c9('0xc8')]?0x1f4:_0x1d099b[_0xf3c9('0xc9')]||0x1f4;logger[_0xf3c9('0x23')](_0x1d099b['stack']);delete _0x1d099b['name'];if(_0x413993===0x191){_0x413993=0x190;}_0x577868[_0xf3c9('0x28')](_0x413993)[_0xf3c9('0x34')](_0x4ce750[_0xf3c9('0x3c')][_0xf3c9('0xc8')]?{'message':_0xf3c9('0xca'),'statusCode':_0x1d099b[_0xf3c9('0xc9')]}:_0x1d099b);});};function getSelectList(_0x161bed,_0x311cfd,_0x42c738,_0x8a2714,_0x17b5c3,_0x547312){var _0x5248c5={'method':'GET','uri':_0x161bed+_0xf3c9('0xb3')+_0x8a2714+')/Attributes('+_0x17b5c3+_0xf3c9('0xcb')+_0xf3c9('0xcc'),'headers':{'Authorization':_0xf3c9('0xaf')+_0x547312,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5248c5)[_0xf3c9('0x1d')](function(_0x35116a){var _0x88d01e=[];var _0x36dbc4=_0x35116a[_0xf3c9('0xcd')][_0xf3c9('0xce')];_0x36dbc4[_0xf3c9('0xbc')](function(_0x2244a0){_0x88d01e[_0xf3c9('0xba')]({'name':_0x2244a0[_0xf3c9('0xcf')][_0xf3c9('0xd0')]['Label'],'value':String(_0x2244a0[_0xf3c9('0xd1')])});});var _0x5d5142={'id':_0x311cfd+'_'+_0x35116a[_0xf3c9('0xd2')],'name':_0x35116a[_0xf3c9('0xd3')][_0xf3c9('0xd0')][_0xf3c9('0xcf')],'custom':![],'options':_0x88d01e};_0x42c738[_0xf3c9('0xba')](_0x5d5142);return _0x42c738;});}function getBooleanList(_0x4abaf2,_0x2e1159,_0x343b65,_0x1b0dc7,_0x2b670e,_0x206087){var _0x36c835={'method':'GET','uri':_0x4abaf2+_0xf3c9('0xb3')+_0x1b0dc7+_0xf3c9('0xd4')+_0x2b670e+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x206087,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x36c835)[_0xf3c9('0x1d')](function(_0x5e29b1){var _0xbbc21=[];_0xbbc21[_0xf3c9('0xba')]({'name':_0x5e29b1[_0xf3c9('0xcd')]['TrueOption'][_0xf3c9('0xcf')][_0xf3c9('0xd0')][_0xf3c9('0xcf')],'value':_0xf3c9('0xd5')},{'name':_0x5e29b1[_0xf3c9('0xcd')][_0xf3c9('0xd6')]['Label'][_0xf3c9('0xd0')][_0xf3c9('0xcf')],'value':'false'});var _0x3b67eb={'id':_0x2e1159+'_'+_0x5e29b1[_0xf3c9('0xd2')],'name':_0x5e29b1[_0xf3c9('0xd3')][_0xf3c9('0xd0')][_0xf3c9('0xcf')],'custom':![],'options':_0xbbc21};_0x343b65[_0xf3c9('0xba')](_0x3b67eb);return _0x343b65;});}function getInputList(_0x1d9396,_0x1d2525,_0x4f63eb,_0x5f2b51,_0x2bf121,_0x2cd993,_0x4759ef){var _0x2b2da1={'method':_0xf3c9('0xad'),'uri':_0x1d9396+_0xf3c9('0xb3')+_0x2bf121+')/Attributes('+_0x2cd993+_0xf3c9('0xd7')+_0x4f63eb+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x4759ef,'If-None-Match':null,'OData-Version':_0xf3c9('0xb0')},'json':!![]};return rp(_0x2b2da1)[_0xf3c9('0x1d')](function(_0x18d17a){var _0x21ef1e={'id':_0x1d2525+'_'+_0x18d17a[_0xf3c9('0xd2')],'name':_0x18d17a[_0xf3c9('0xd3')][_0xf3c9('0xd0')]?_0x18d17a[_0xf3c9('0xd3')][_0xf3c9('0xd0')]['Label']:_0x18d17a[_0xf3c9('0xd2')],'custom':![],'options':[]};_0x5f2b51[_0xf3c9('0xba')](_0x21ef1e);return _0x5f2b51;});} \ No newline at end of file +var _0x8753=['PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel','GET',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','Dynamics365Account','includeAll','include','findAll','rows','show','params','keys','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','username','password','remoteUri','tenantId','clientId','clientSecret','substring','lastIndexOf','format','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','includes','LogicalName','forEach','@odata.type'];(function(_0x2deb01,_0x4e741c){var _0x3920b3=function(_0x391a64){while(--_0x391a64){_0x2deb01['push'](_0x2deb01['shift']());}};_0x3920b3(++_0x4e741c);}(_0x8753,0x1d2));var _0x3875=function(_0x2b618f,_0x4171b0){_0x2b618f=_0x2b618f-0x0;var _0x5a1164=_0x8753[_0x2b618f];return _0x5a1164;};'use strict';var pdf=require(_0x3875('0x0'));var emlformat=require(_0x3875('0x1'));var rimraf=require(_0x3875('0x2'));var zipdir=require(_0x3875('0x3'));var jsonpatch=require(_0x3875('0x4'));var rp=require(_0x3875('0x5'));var moment=require(_0x3875('0x6'));var BPromise=require(_0x3875('0x7'));var Mustache=require(_0x3875('0x8'));var util=require(_0x3875('0x9'));var path=require(_0x3875('0xa'));var sox=require(_0x3875('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3875('0xc'));var squel=require(_0x3875('0xd'));var crypto=require(_0x3875('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3875('0xf'));var toCsv=require(_0x3875('0x10'));var querystring=require('querystring');var Papa=require(_0x3875('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3875('0x12'));var as=require(_0x3875('0x13'));var hardwareService=require(_0x3875('0x14'));var logger=require(_0x3875('0x15'))('api');var utils=require(_0x3875('0x16'));var config=require(_0x3875('0x17'));var licenseUtil=require(_0x3875('0x18'));var db=require(_0x3875('0x19'))['db'];var integrations=require(_0x3875('0x1a'));var jayson=require(_0x3875('0x1b'));var client=jayson[_0x3875('0x1c')][_0x3875('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x98ed6,_0x4b45d3,_0x7c63df,_0x3dd336){return new BPromise(function(_0x439808,_0x50de23){var _0x51a27e=_0x3dd336||client;return _0x51a27e['request'](_0x98ed6,_0x7c63df)[_0x3875('0x1e')](function(_0x5e28fa){logger[_0x3875('0x1f')](_0x3875('0x20'),_0x4b45d3,_0x3875('0x21'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4b45d3,'request\x20sent',JSON[_0x3875('0x22')](_0x5e28fa));if(_0x5e28fa[_0x3875('0x23')]){if(_0x5e28fa[_0x3875('0x23')][_0x3875('0x24')]===0x1f4){logger[_0x3875('0x23')](_0x3875('0x20'),_0x4b45d3,_0x5e28fa[_0x3875('0x23')][_0x3875('0x25')]);return _0x50de23(_0x5e28fa['error']['message']);}logger[_0x3875('0x23')]('Dynamics365Account,\x20%s,\x20%s',_0x4b45d3,_0x5e28fa[_0x3875('0x23')]['message']);return _0x439808(_0x5e28fa['error'][_0x3875('0x25')]);}else{logger[_0x3875('0x1f')](_0x3875('0x20'),_0x4b45d3,_0x3875('0x21'));_0x439808(_0x5e28fa[_0x3875('0x26')]['message']);}})[_0x3875('0x27')](function(_0x4e1f83){logger[_0x3875('0x23')](_0x3875('0x20'),_0x4b45d3,_0x4e1f83);_0x50de23(_0x4e1f83);});});}function respondWithStatusCode(_0x2e858f,_0x3f2975){_0x3f2975=_0x3f2975||0xcc;return function(_0x5d59b7){if(_0x5d59b7){return _0x2e858f[_0x3875('0x28')](_0x3f2975);}return _0x2e858f[_0x3875('0x29')](_0x3f2975)[_0x3875('0x2a')]();};}function respondWithResult(_0x3ad3d2,_0x49e2dd){_0x49e2dd=_0x49e2dd||0xc8;return function(_0x2b7734){if(_0x2b7734){return _0x3ad3d2[_0x3875('0x29')](_0x49e2dd)[_0x3875('0x2b')](_0x2b7734);}};}function respondWithFilteredResult(_0x4d831e,_0x6ef88b){return function(_0x4452d9){if(_0x4452d9){var _0x305db4=_0x4452d9[_0x3875('0x2c')],_0xd6cbad=_0x6ef88b[_0x3875('0x2d')],_0x4fe716=_0x6ef88b[_0x3875('0x2d')]+_0x6ef88b[_0x3875('0x2e')],_0xb1c152;if(_0x4fe716>=_0x305db4){_0x4fe716=_0x305db4;_0xb1c152=0xc8;}else{_0xb1c152=0xce;}_0x4d831e['status'](_0xb1c152);return _0x4d831e[_0x3875('0x2f')](_0x3875('0x30'),_0xd6cbad+'-'+_0x4fe716+'/'+_0x305db4)[_0x3875('0x2b')](_0x4452d9);}return null;};}function patchUpdates(_0x3aef1c){return function(_0x1f7d26){try{jsonpatch[_0x3875('0x31')](_0x1f7d26,_0x3aef1c,!![]);}catch(_0x460eaf){return BPromise['reject'](_0x460eaf);}return _0x1f7d26[_0x3875('0x32')]();};}function saveUpdates(_0x5a3595,_0x237095){return function(_0x17d46d){if(_0x17d46d){return _0x17d46d[_0x3875('0x33')](_0x5a3595)[_0x3875('0x1e')](function(_0x5f0736){return _0x5f0736;});}return null;};}function removeEntity(_0x21b6ed,_0x186b56){return function(_0x10bdcb){if(_0x10bdcb){return _0x10bdcb[_0x3875('0x34')]()[_0x3875('0x1e')](function(){_0x21b6ed[_0x3875('0x29')](0xcc)[_0x3875('0x2a')]();});}};}function handleEntityNotFound(_0x5b0ef1,_0x5aab41){return function(_0x427257){if(!_0x427257){_0x5b0ef1[_0x3875('0x28')](0x194);}return _0x427257;};}function handleError(_0x128c64,_0x3d5fb5){_0x3d5fb5=_0x3d5fb5||0x1f4;return function(_0x5bad4c){logger[_0x3875('0x23')](_0x5bad4c[_0x3875('0x35')]);if(_0x5bad4c['name']){delete _0x5bad4c[_0x3875('0x36')];}_0x128c64['status'](_0x3d5fb5)[_0x3875('0x37')](_0x5bad4c);};}exports[_0x3875('0x38')]=function(_0x1fb527,_0x3146fd){var _0x48558a={},_0x2648f7={},_0x3224e4={'count':0x0,'rows':[]};var _0x3bbb1f=_[_0x3875('0x39')](db['Dynamics365Account'][_0x3875('0x3a')],function(_0x1d5773){return{'name':_0x1d5773[_0x3875('0x3b')],'type':_0x1d5773[_0x3875('0x3c')][_0x3875('0x3d')]};});_0x2648f7[_0x3875('0x3e')]=_['map'](_0x3bbb1f,_0x3875('0x36'));_0x2648f7[_0x3875('0x3f')]=_['keys'](_0x1fb527[_0x3875('0x3f')]);_0x2648f7['filters']=_[_0x3875('0x40')](_0x2648f7[_0x3875('0x3e')],_0x2648f7['query']);_0x48558a[_0x3875('0x41')]=_[_0x3875('0x40')](_0x2648f7[_0x3875('0x3e')],qs[_0x3875('0x42')](_0x1fb527[_0x3875('0x3f')][_0x3875('0x42')]));_0x48558a[_0x3875('0x41')]=_0x48558a['attributes'][_0x3875('0x43')]?_0x48558a[_0x3875('0x41')]:_0x2648f7[_0x3875('0x3e')];if(!_0x1fb527[_0x3875('0x3f')][_0x3875('0x44')](_0x3875('0x45'))){_0x48558a['limit']=qs[_0x3875('0x2e')](_0x1fb527[_0x3875('0x3f')]['limit']);_0x48558a[_0x3875('0x2d')]=qs['offset'](_0x1fb527['query'][_0x3875('0x2d')]);}_0x48558a[_0x3875('0x46')]=qs[_0x3875('0x47')](_0x1fb527[_0x3875('0x3f')][_0x3875('0x47')]);_0x48558a[_0x3875('0x48')]=qs['filters'](_[_0x3875('0x49')](_0x1fb527[_0x3875('0x3f')],_0x2648f7[_0x3875('0x4a')]),_0x3bbb1f);if(_0x1fb527[_0x3875('0x3f')][_0x3875('0x4b')]){_0x48558a[_0x3875('0x48')]=_[_0x3875('0x4c')](_0x48558a[_0x3875('0x48')],{'$or':_[_0x3875('0x39')](_0x3bbb1f,function(_0x15658a){if(_0x15658a[_0x3875('0x3c')]!=='VIRTUAL'){var _0x4b17e2={};_0x4b17e2[_0x15658a[_0x3875('0x36')]]={'$like':'%'+_0x1fb527[_0x3875('0x3f')]['filter']+'%'};return _0x4b17e2;}})});}_0x48558a=_[_0x3875('0x4c')]({},_0x48558a,_0x1fb527[_0x3875('0x4d')]);var _0x2e34f3={'where':_0x48558a['where']};return db[_0x3875('0x4e')]['count'](_0x2e34f3)['then'](function(_0x1393f2){_0x3224e4['count']=_0x1393f2;if(_0x1fb527[_0x3875('0x3f')][_0x3875('0x4f')]){_0x48558a[_0x3875('0x50')]=[{'all':!![]}];}return db[_0x3875('0x4e')][_0x3875('0x51')](_0x48558a);})[_0x3875('0x1e')](function(_0x2cebae){_0x3224e4[_0x3875('0x52')]=_0x2cebae;return _0x3224e4;})[_0x3875('0x1e')](respondWithFilteredResult(_0x3146fd,_0x48558a))[_0x3875('0x27')](handleError(_0x3146fd,null));};exports[_0x3875('0x53')]=function(_0x55ae0e,_0x7da336){var _0x29cd02={'raw':![],'where':{'id':_0x55ae0e[_0x3875('0x54')]['id']}},_0x5beeb9={};_0x5beeb9[_0x3875('0x3e')]=_[_0x3875('0x55')](db['Dynamics365Account'][_0x3875('0x3a')]);_0x5beeb9['query']=_['keys'](_0x55ae0e[_0x3875('0x3f')]);_0x5beeb9[_0x3875('0x4a')]=_[_0x3875('0x40')](_0x5beeb9[_0x3875('0x3e')],_0x5beeb9['query']);_0x29cd02[_0x3875('0x41')]=_[_0x3875('0x40')](_0x5beeb9['model'],qs[_0x3875('0x42')](_0x55ae0e[_0x3875('0x3f')]['fields']));_0x29cd02[_0x3875('0x41')]=_0x29cd02[_0x3875('0x41')]['length']?_0x29cd02[_0x3875('0x41')]:_0x5beeb9['model'];if(_0x55ae0e[_0x3875('0x3f')][_0x3875('0x4f')]){_0x29cd02[_0x3875('0x50')]=[{'all':!![]}];}_0x29cd02=_[_0x3875('0x4c')]({},_0x29cd02,_0x55ae0e[_0x3875('0x4d')]);return db[_0x3875('0x4e')][_0x3875('0x56')](_0x29cd02)['then'](handleEntityNotFound(_0x7da336,null))[_0x3875('0x1e')](respondWithResult(_0x7da336,null))[_0x3875('0x27')](handleError(_0x7da336,null));};exports[_0x3875('0x57')]=function(_0x314d29,_0x4db5ca){return db[_0x3875('0x4e')][_0x3875('0x57')](_0x314d29['body'],{})['then'](respondWithResult(_0x4db5ca,0xc9))[_0x3875('0x27')](handleError(_0x4db5ca,null));};exports['update']=function(_0x485857,_0x470c78){if(_0x485857[_0x3875('0x58')]['id']){delete _0x485857[_0x3875('0x58')]['id'];}return db[_0x3875('0x4e')]['find']({'where':{'id':_0x485857[_0x3875('0x54')]['id']}})[_0x3875('0x1e')](handleEntityNotFound(_0x470c78,null))['then'](saveUpdates(_0x485857[_0x3875('0x58')],null))[_0x3875('0x1e')](respondWithResult(_0x470c78,null))['catch'](handleError(_0x470c78,null));};exports[_0x3875('0x34')]=function(_0x3c306a,_0x525b4b){return db[_0x3875('0x4e')][_0x3875('0x56')]({'where':{'id':_0x3c306a[_0x3875('0x54')]['id']}})['then'](handleEntityNotFound(_0x525b4b,null))[_0x3875('0x1e')](removeEntity(_0x525b4b,null))['catch'](handleError(_0x525b4b,null));};exports[_0x3875('0x59')]=function(_0x588f89,_0x2865ba,_0x36e167){var _0x132058={};var _0xc850aa={};var _0x145641;var _0x1aa0cb;return db[_0x3875('0x4e')][_0x3875('0x5a')]({'where':{'id':_0x588f89[_0x3875('0x54')]['id']}})[_0x3875('0x1e')](handleEntityNotFound(_0x2865ba,null))['then'](function(_0x34f7db){if(_0x34f7db){_0x145641=_0x34f7db;_0xc850aa[_0x3875('0x3e')]=_[_0x3875('0x55')](db[_0x3875('0x5b')]['rawAttributes']);_0xc850aa[_0x3875('0x3f')]=_[_0x3875('0x55')](_0x588f89[_0x3875('0x3f')]);_0xc850aa[_0x3875('0x4a')]=_[_0x3875('0x40')](_0xc850aa[_0x3875('0x3e')],_0xc850aa[_0x3875('0x3f')]);_0x132058[_0x3875('0x41')]=_[_0x3875('0x40')](_0xc850aa[_0x3875('0x3e')],qs[_0x3875('0x42')](_0x588f89['query'][_0x3875('0x42')]));_0x132058[_0x3875('0x41')]=_0x132058['attributes'][_0x3875('0x43')]?_0x132058[_0x3875('0x41')]:_0xc850aa[_0x3875('0x3e')];_0x132058[_0x3875('0x46')]=qs[_0x3875('0x47')](_0x588f89[_0x3875('0x3f')][_0x3875('0x47')]);_0x132058['where']=qs[_0x3875('0x4a')](_[_0x3875('0x49')](_0x588f89[_0x3875('0x3f')],_0xc850aa[_0x3875('0x4a')]));if(_0x588f89[_0x3875('0x3f')][_0x3875('0x4b')]){_0x132058['where']=_[_0x3875('0x4c')](_0x132058[_0x3875('0x48')],{'$or':_[_0x3875('0x39')](_0x132058[_0x3875('0x41')],function(_0x4591ac){var _0x243668={};_0x243668[_0x4591ac]={'$like':'%'+_0x588f89[_0x3875('0x3f')][_0x3875('0x4b')]+'%'};return _0x243668;})});}_0x132058=_[_0x3875('0x4c')]({},_0x132058,_0x588f89[_0x3875('0x4d')]);return _0x145641['getConfigurations'](_0x132058);}})[_0x3875('0x1e')](function(_0xeda2ff){if(_0xeda2ff){_0x1aa0cb=_0xeda2ff[_0x3875('0x43')];if(!_0x588f89[_0x3875('0x3f')]['hasOwnProperty'](_0x3875('0x45'))){_0x132058[_0x3875('0x2e')]=qs[_0x3875('0x2e')](_0x588f89[_0x3875('0x3f')][_0x3875('0x2e')]);_0x132058[_0x3875('0x2d')]=qs[_0x3875('0x2d')](_0x588f89[_0x3875('0x3f')][_0x3875('0x2d')]);}return _0x145641['getConfigurations'](_0x132058);}})[_0x3875('0x1e')](function(_0x40e825){if(_0x40e825){return _0x40e825?{'count':_0x1aa0cb,'rows':_0x40e825}:null;}})[_0x3875('0x1e')](respondWithResult(_0x2865ba,null))['catch'](handleError(_0x2865ba,null));};exports[_0x3875('0x5c')]=function(_0x1eb467,_0xf4eba6,_0x462f35){if(_0x1eb467[_0x3875('0x58')]['id']){delete _0x1eb467['body']['id'];}return db[_0x3875('0x4e')][_0x3875('0x5a')]({'where':{'id':_0x1eb467[_0x3875('0x54')]['id']}})[_0x3875('0x1e')](handleEntityNotFound(_0xf4eba6,null))[_0x3875('0x1e')](function(_0x4989c1){if(_0x4989c1){_0x1eb467[_0x3875('0x58')][_0x3875('0x5d')]=_0x4989c1['id'];_0x1eb467[_0x3875('0x58')][_0x3875('0x5e')]=integrations[_0x3875('0x5f')](_0x1eb467['body'][_0x3875('0x60')],_0x1eb467[_0x3875('0x58')][_0x3875('0x3c')]);_0x1eb467[_0x3875('0x58')][_0x3875('0x61')]=integrations['getDescriptions'](_0x1eb467[_0x3875('0x58')]['channel'],_0x1eb467[_0x3875('0x58')][_0x3875('0x3c')]);return db[_0x3875('0x5b')][_0x3875('0x57')](_0x1eb467[_0x3875('0x58')],{'include':[{'model':db[_0x3875('0x62')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x3875('0x1e')](respondWithResult(_0xf4eba6,null))[_0x3875('0x27')](handleError(_0xf4eba6,null));};exports[_0x3875('0x63')]=function(_0x126d0b,_0x17c666,_0x192be4){var _0x1c4bd8=_0x126d0b['query'][_0x3875('0x64')];var _0x181269=_0x1c4bd8===_0x3875('0x65')?_0x3875('0x66'):_0x3875('0x67');var _0x13a191='';var _0x478998='';var _0x413393='';var _0x50735f='';var _0x49b5c4='';var _0x26043d='';var _0x232b4c='';var _0x49f317='';var _0x287d84=['title','description',_0x3875('0x68'),_0x3875('0x69'),'caseorigincode',_0x3875('0x6a'),_0x3875('0x6b'),_0x3875('0x6c'),_0x3875('0x6d'),_0x3875('0x6e')];var _0x4a769d=['accountidname',_0x3875('0x6f'),_0x3875('0x70'),_0x3875('0x71'),_0x3875('0x72'),_0x3875('0x73'),_0x3875('0x74'),'contractidname',_0x3875('0x75'),'createdbyexternalpartyyominame',_0x3875('0x76'),'createdbyyominame',_0x3875('0x77'),_0x3875('0x78'),_0x3875('0x79'),_0x3875('0x7a'),_0x3875('0x7b'),_0x3875('0x7c'),_0x3875('0x7d'),'entitlementidname','entityimage_timestamp',_0x3875('0x7e'),_0x3875('0x7f'),_0x3875('0x80'),_0x3875('0x81'),_0x3875('0x82'),_0x3875('0x83'),'influencescore',_0x3875('0x84'),'lastonholdtime',_0x3875('0x85'),'modifiedbyexternalpartyname',_0x3875('0x86'),_0x3875('0x87'),_0x3875('0x88'),_0x3875('0x89'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x3875('0x8a'),'numberofchildincidents',_0x3875('0x8b'),_0x3875('0x8c'),_0x3875('0x8d'),_0x3875('0x8e'),_0x3875('0x8f'),_0x3875('0x90'),_0x3875('0x91'),'primarycontactidyominame','prioritycodename',_0x3875('0x92'),_0x3875('0x93'),_0x3875('0x94'),'resolvebykpiidname',_0x3875('0x95'),_0x3875('0x96'),_0x3875('0x97'),_0x3875('0x98'),_0x3875('0x99'),_0x3875('0x9a'),_0x3875('0x9b'),'statecode',_0x3875('0x9c'),_0x3875('0x9d'),'ticketnumber',_0x3875('0x9e'),_0x3875('0x9f'),_0x3875('0xa0'),'utcconversiontimezonecode','versionnumber'];var _0x522e44=_0x287d84['concat'](_0x4a769d);return db[_0x3875('0x4e')][_0x3875('0x5a')]({'where':{'id':_0x126d0b['params']['id']},'attributes':['id',_0x3875('0xa1'),_0x3875('0xa2'),_0x3875('0xa3'),_0x3875('0xa4'),_0x3875('0xa5'),_0x3875('0xa6')]})[_0x3875('0x1e')](handleEntityNotFound(_0x17c666,null))[_0x3875('0x1e')](function(_0x153d6d){if(_0x153d6d){_0x49f317=_0x153d6d[_0x3875('0xa3')];var _0x1e9187=_0x49f317['slice'](-0x1);if(_0x1e9187==='/'){_0x49f317=_0x49f317[_0x3875('0xa7')](0x0,_0x49f317[_0x3875('0xa8')](_0x1e9187));}_0x232b4c=util[_0x3875('0xa9')]('%s/api/data/v9.0/',_0x49f317);var _0x2c3862={'method':_0x3875('0xaa'),'uri':_0x3875('0xab')+_0x153d6d[_0x3875('0xa4')]+_0x3875('0xac'),'form':{'client_id':_0x153d6d[_0x3875('0xa5')],'resource':_0x49f317,'username':_0x153d6d[_0x3875('0xa1')],'password':_0x153d6d[_0x3875('0xa2')],'grant_type':_0x3875('0xa2'),'client_secret':_0x153d6d[_0x3875('0xa6')]},'json':!![]};return rp(_0x2c3862);}})['then'](function(_0x2351ab){_0x26043d=_0x2351ab[_0x3875('0xad')];var _0x3329c5={'method':'GET','uri':encodeURI(_0x232b4c+_0x3875('0xae')+_0x181269+'\x27'),'headers':{'Authorization':_0x3875('0xaf')+_0x26043d,'If-None-Match':null,'OData-Version':_0x3875('0xb0')},'json':!![]};return rp(_0x3329c5);})[_0x3875('0x1e')](function(_0x5a8f10){var _0x15e647=_0x5a8f10[_0x3875('0xb1')][0x0];var _0x59a69b=_0x15e647[_0x3875('0xb2')];var _0x3246d9={'method':'GET','uri':_0x232b4c+_0x3875('0xb3')+_0x59a69b+_0x3875('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0x26043d,'If-None-Match':null,'OData-Version':_0x3875('0xb0')},'json':!![]};return rp(_0x3246d9);})['then'](function(_0x41bc02){_0x13a191=_0x41bc02;_0x478998=_0x13a191['Attributes'];_0x478998=_['remove'](_0x478998,function(_0x4ee47a){return!_0x522e44[_0x3875('0xb5')](_0x4ee47a[_0x3875('0xb6')]);});var _0x1e1e01=[];var _0x144128=[];_0x478998[_0x3875('0xb7')](function(_0x310179){if(_0x310179[_0x3875('0xb8')]){var _0x15f005=_0x310179[_0x3875('0xb8')][_0x3875('0xa7')](_0x310179[_0x3875('0xb8')][_0x3875('0xa8')]('.')+0x1);if(_0x15f005===_0x3875('0xb9')){_0x1e1e01[_0x3875('0xba')](getSelectList(_0x232b4c,_0x1c4bd8,_0x144128,_0x13a191['MetadataId'],_0x310179[_0x3875('0xb2')],_0x26043d));}}});return Promise[_0x3875('0xbb')](_0x1e1e01);})[_0x3875('0x1e')](function(_0x4cdfbe){_0x413393=_0x4cdfbe[0x0];var _0x3b0a6f=[];var _0x58b633=[];_0x478998[_0x3875('0xb7')](function(_0x29d6c8){if(!_[_0x3875('0xbc')](_0x29d6c8[_0x3875('0xb8')])){var _0x54dc96=_0x29d6c8['@odata.type'][_0x3875('0xa7')](_0x29d6c8[_0x3875('0xb8')]['lastIndexOf']('.')+0x1);if(_0x54dc96==='BooleanAttributeMetadata'){_0x3b0a6f[_0x3875('0xba')](getBooleanList(_0x232b4c,_0x1c4bd8,_0x58b633,_0x13a191[_0x3875('0xb2')],_0x29d6c8[_0x3875('0xb2')],_0x26043d));}}});return Promise[_0x3875('0xbb')](_0x3b0a6f);})[_0x3875('0x1e')](function(_0x80b8bb){_0x50735f=_0x80b8bb[0x0];var _0x2f79de=[];var _0x43c540=[];_0x478998['forEach'](function(_0x37d727){if(_0x37d727[_0x3875('0xb8')]){var _0x37221d=_0x37d727['@odata.type'][_0x3875('0xa7')](_0x37d727['@odata.type'][_0x3875('0xa8')]('.')+0x1);if(_0x37221d===_0x3875('0xbd')||_0x37221d===_0x3875('0xbe')||_0x37221d==='BigIntAttributeMetadata'||_0x37221d===_0x3875('0xbf')||_0x37221d===_0x3875('0xc0')||_0x37221d===_0x3875('0xc1')||_0x37221d===_0x3875('0xc2')||_0x37221d===_0x3875('0xc3')||_0x37221d===_0x3875('0xc4')||_0x37221d===_0x3875('0xc5')){_0x2f79de[_0x3875('0xba')](getInputList(_0x232b4c,_0x1c4bd8,_0x37221d,_0x43c540,_0x13a191['MetadataId'],_0x37d727[_0x3875('0xb2')],_0x26043d));}}});return Promise[_0x3875('0xbb')](_0x2f79de);})[_0x3875('0x1e')](function(_0x495a48){_0x49b5c4=_0x495a48[0x0];var _0x43bfd0=_0x413393['concat'](_0x50735f)[_0x3875('0xc6')](_0x49b5c4);var _0x5c9acf={'count':_0x43bfd0[_0x3875('0x43')],'rows':_0x43bfd0};return _0x5c9acf;})[_0x3875('0x1e')](respondWithResult(_0x17c666,null))[_0x3875('0x27')](function(_0x44e90f){var _0x1c7a7e=_0x126d0b[_0x3875('0x3f')][_0x3875('0xc7')]?0x1f4:_0x44e90f[_0x3875('0xc8')]||0x1f4;logger[_0x3875('0x23')](_0x44e90f['stack']);delete _0x44e90f[_0x3875('0x36')];if(_0x1c7a7e===0x191){_0x1c7a7e=0x190;}_0x17c666[_0x3875('0x29')](_0x1c7a7e)['send'](_0x126d0b['query'][_0x3875('0xc7')]?{'message':_0x3875('0xc9'),'statusCode':_0x44e90f[_0x3875('0xc8')]}:_0x44e90f);});};function getSelectList(_0x396d1d,_0x180b68,_0x4628c3,_0x6b503e,_0x1de98c,_0x1d5aff){var _0x276c13={'method':'GET','uri':_0x396d1d+_0x3875('0xb3')+_0x6b503e+_0x3875('0xca')+_0x1de98c+_0x3875('0xcb')+_0x3875('0xcc'),'headers':{'Authorization':_0x3875('0xaf')+_0x1d5aff,'If-None-Match':null,'OData-Version':_0x3875('0xb0')},'json':!![]};return rp(_0x276c13)[_0x3875('0x1e')](function(_0x6d547b){var _0x4215d8=[];var _0x405a38=_0x6d547b[_0x3875('0xcd')][_0x3875('0xce')];_0x405a38[_0x3875('0xb7')](function(_0x84c2f3){_0x4215d8[_0x3875('0xba')]({'name':_0x84c2f3[_0x3875('0xcf')]['UserLocalizedLabel'][_0x3875('0xcf')],'value':String(_0x84c2f3[_0x3875('0xd0')])});});var _0x38cb1d={'id':_0x180b68+'_'+_0x6d547b[_0x3875('0xb6')],'name':_0x6d547b[_0x3875('0xd1')][_0x3875('0xd2')][_0x3875('0xcf')],'custom':![],'options':_0x4215d8};_0x4628c3['push'](_0x38cb1d);return _0x4628c3;});}function getBooleanList(_0x5d635e,_0x4e73f3,_0x41b4b3,_0x52ef43,_0x1836bd,_0x14adb0){var _0x7a58f8={'method':_0x3875('0xd3'),'uri':_0x5d635e+'EntityDefinitions('+_0x52ef43+_0x3875('0xca')+_0x1836bd+_0x3875('0xd4'),'headers':{'Authorization':_0x3875('0xaf')+_0x14adb0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x7a58f8)[_0x3875('0x1e')](function(_0x3d3e9c){var _0x28b80d=[];_0x28b80d[_0x3875('0xba')]({'name':_0x3d3e9c[_0x3875('0xcd')]['TrueOption'][_0x3875('0xcf')][_0x3875('0xd2')]['Label'],'value':_0x3875('0xd5')},{'name':_0x3d3e9c['OptionSet'][_0x3875('0xd6')][_0x3875('0xcf')][_0x3875('0xd2')]['Label'],'value':'false'});var _0xd017f3={'id':_0x4e73f3+'_'+_0x3d3e9c[_0x3875('0xb6')],'name':_0x3d3e9c[_0x3875('0xd1')]['UserLocalizedLabel'][_0x3875('0xcf')],'custom':![],'options':_0x28b80d};_0x41b4b3[_0x3875('0xba')](_0xd017f3);return _0x41b4b3;});}function getInputList(_0x12316f,_0xbfa6bf,_0x4b4c50,_0x4ff97c,_0x194571,_0x401278,_0x364dec){var _0x54729d={'method':_0x3875('0xd3'),'uri':_0x12316f+_0x3875('0xb3')+_0x194571+_0x3875('0xca')+_0x401278+_0x3875('0xd7')+_0x4b4c50+_0x3875('0xd8'),'headers':{'Authorization':_0x3875('0xaf')+_0x364dec,'If-None-Match':null,'OData-Version':_0x3875('0xb0')},'json':!![]};return rp(_0x54729d)[_0x3875('0x1e')](function(_0x2d01c2){var _0x3b268d={'id':_0xbfa6bf+'_'+_0x2d01c2[_0x3875('0xb6')],'name':_0x2d01c2[_0x3875('0xd1')]['UserLocalizedLabel']?_0x2d01c2[_0x3875('0xd1')][_0x3875('0xd2')][_0x3875('0xcf')]:_0x2d01c2[_0x3875('0xb6')],'custom':![],'options':[]};_0x4ff97c['push'](_0x3b268d);return _0x4ff97c;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 1b192ad..50a6a5b 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 _0x38ca=['./intDynamics365Account.attributes','../../components/integrations/configuration','exports','Dynamics365Account','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x3b554d,_0x4f4ad1){var _0x5c8925=function(_0x48c8aa){while(--_0x48c8aa){_0x3b554d['push'](_0x3b554d['shift']());}};_0x5c8925(++_0x4f4ad1);}(_0x38ca,0x16c));var _0xa38c=function(_0x455279,_0xa2a66a){_0x455279=_0x455279-0x0;var _0x103cdf=_0x38ca[_0x455279];return _0x103cdf;};'use strict';var _=require(_0xa38c('0x0'));var util=require(_0xa38c('0x1'));var logger=require(_0xa38c('0x2'))(_0xa38c('0x3'));var moment=require('moment');var BPromise=require(_0xa38c('0x4'));var rp=require(_0xa38c('0x5'));var fs=require('fs');var path=require(_0xa38c('0x6'));var rimraf=require('rimraf');var config=require(_0xa38c('0x7'));var attributes=require(_0xa38c('0x8'));var integrations=require(_0xa38c('0x9'));module[_0xa38c('0xa')]=function(_0x198a66,_0x3bb910){return _0x198a66['define'](_0xa38c('0xb'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb870=['define','Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports'];(function(_0x3f9b54,_0x35bb05){var _0x537027=function(_0x1678c5){while(--_0x1678c5){_0x3f9b54['push'](_0x3f9b54['shift']());}};_0x537027(++_0x35bb05);}(_0xb870,0x1d4));var _0x0b87=function(_0x2d2e85,_0x22faa9){_0x2d2e85=_0x2d2e85-0x0;var _0x3e9f5e=_0xb870[_0x2d2e85];return _0x3e9f5e;};'use strict';var _=require('lodash');var util=require(_0x0b87('0x0'));var logger=require(_0x0b87('0x1'))(_0x0b87('0x2'));var moment=require(_0x0b87('0x3'));var BPromise=require(_0x0b87('0x4'));var rp=require(_0x0b87('0x5'));var fs=require('fs');var path=require(_0x0b87('0x6'));var rimraf=require(_0x0b87('0x7'));var config=require(_0x0b87('0x8'));var attributes=require(_0x0b87('0x9'));var integrations=require(_0x0b87('0xa'));module[_0x0b87('0xb')]=function(_0x243a8c,_0x58366a){return _0x243a8c[_0x0b87('0xc')](_0x0b87('0xd'),attributes,{'tableName':_0x0b87('0xe'),'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 3fa188c..ba87285 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 _0x4ca4=['jayson/promise','client','http','request','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message','Dynamics365Account,\x20%s,\x20%s','info','result','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','map','include','model','then','find','ShowDynamics365Account','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4ca4,0x100));var _0x44ca=function(_0x2c5fb9,_0x25613a){_0x2c5fb9=_0x2c5fb9-0x0;var _0x4e12e6=_0x4ca4[_0x2c5fb9];return _0x4e12e6;};'use strict';var _=require(_0x44ca('0x0'));var util=require(_0x44ca('0x1'));var moment=require(_0x44ca('0x2'));var BPromise=require(_0x44ca('0x3'));var rs=require(_0x44ca('0x4'));var fs=require('fs');var Redis=require(_0x44ca('0x5'));var db=require(_0x44ca('0x6'))['db'];var utils=require(_0x44ca('0x7'));var logger=require('../../config/logger')(_0x44ca('0x8'));var config=require(_0x44ca('0x9'));var jayson=require(_0x44ca('0xa'));var client=jayson[_0x44ca('0xb')][_0x44ca('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32097f,_0x4ce88d,_0x5d7a35){return new BPromise(function(_0x5c1475,_0x140f00){return client[_0x44ca('0xd')](_0x32097f,_0x5d7a35)['then'](function(_0x3c0999){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4ce88d,_0x44ca('0xe'));logger[_0x44ca('0xf')](_0x44ca('0x10'),_0x4ce88d,_0x44ca('0xe'),JSON[_0x44ca('0x11')](_0x3c0999));if(_0x3c0999['error']){if(_0x3c0999['error'][_0x44ca('0x12')]===0x1f4){logger[_0x44ca('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x4ce88d,_0x3c0999['error'][_0x44ca('0x14')]);return _0x140f00(_0x3c0999[_0x44ca('0x13')][_0x44ca('0x14')]);}logger[_0x44ca('0x13')](_0x44ca('0x15'),_0x4ce88d,_0x3c0999[_0x44ca('0x13')][_0x44ca('0x14')]);return _0x5c1475(_0x3c0999[_0x44ca('0x13')]['message']);}else{logger[_0x44ca('0x16')](_0x44ca('0x15'),_0x4ce88d,'request\x20sent');_0x5c1475(_0x3c0999[_0x44ca('0x17')][_0x44ca('0x14')]);}})['catch'](function(_0x1248a4){logger[_0x44ca('0x13')](_0x44ca('0x15'),_0x4ce88d,_0x1248a4);_0x140f00(_0x1248a4);});});}exports[_0x44ca('0x18')]=function(_0x3bea76){var _0x3b4626=this;return new Promise(function(_0x1fe960,_0x342a08){return db[_0x44ca('0x19')]['findAll']({'raw':_0x3bea76[_0x44ca('0x1a')]?_0x3bea76[_0x44ca('0x1a')][_0x44ca('0x1b')]===undefined?!![]:![]:!![],'where':_0x3bea76[_0x44ca('0x1a')]?_0x3bea76['options'][_0x44ca('0x1c')]||null:null,'attributes':_0x3bea76['options']?_0x3bea76[_0x44ca('0x1a')][_0x44ca('0x1d')]||null:null,'limit':_0x3bea76['options']?_0x3bea76[_0x44ca('0x1a')][_0x44ca('0x1e')]||null:null,'include':_0x3bea76[_0x44ca('0x1a')]?_0x3bea76[_0x44ca('0x1a')]['include']?_[_0x44ca('0x1f')](_0x3bea76['options'][_0x44ca('0x20')],function(_0x36c49e){return{'model':db[_0x36c49e['model']],'as':_0x36c49e['as'],'attributes':_0x36c49e['attributes'],'include':_0x36c49e['include']?_['map'](_0x36c49e[_0x44ca('0x20')],function(_0x15c454){return{'model':db[_0x15c454['model']],'as':_0x15c454['as'],'attributes':_0x15c454[_0x44ca('0x1d')],'include':_0x15c454[_0x44ca('0x20')]?_[_0x44ca('0x1f')](_0x15c454[_0x44ca('0x20')],function(_0x43008b){return{'model':db[_0x43008b[_0x44ca('0x21')]],'as':_0x43008b['as'],'attributes':_0x43008b[_0x44ca('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x44ca('0x22')](function(_0x70635b){logger[_0x44ca('0x16')](_0x44ca('0x18'),_0x3bea76);logger[_0x44ca('0xf')]('GetDynamics365Account',_0x3bea76,JSON[_0x44ca('0x11')](_0x70635b));_0x1fe960(_0x70635b);})['catch'](function(_0x38187b){logger['error'](_0x44ca('0x18'),_0x38187b[_0x44ca('0x14')],_0x3bea76);_0x342a08(_0x3b4626['error'](0x1f4,_0x38187b[_0x44ca('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x4e0a2b){var _0x2c7283=this;return new Promise(function(_0x4e0669,_0x1567e2){return db[_0x44ca('0x19')][_0x44ca('0x23')]({'raw':_0x4e0a2b['options']?_0x4e0a2b['options']['raw']===undefined?!![]:![]:!![],'where':_0x4e0a2b[_0x44ca('0x1a')]?_0x4e0a2b[_0x44ca('0x1a')]['where']||null:null,'attributes':_0x4e0a2b[_0x44ca('0x1a')]?_0x4e0a2b['options'][_0x44ca('0x1d')]||null:null,'include':_0x4e0a2b[_0x44ca('0x1a')]?_0x4e0a2b[_0x44ca('0x1a')][_0x44ca('0x20')]?_[_0x44ca('0x1f')](_0x4e0a2b[_0x44ca('0x1a')][_0x44ca('0x20')],function(_0x29b75d){return{'model':db[_0x29b75d[_0x44ca('0x21')]],'as':_0x29b75d['as'],'attributes':_0x29b75d[_0x44ca('0x1d')],'include':_0x29b75d[_0x44ca('0x20')]?_[_0x44ca('0x1f')](_0x29b75d[_0x44ca('0x20')],function(_0x41f02e){return{'model':db[_0x41f02e['model']],'as':_0x41f02e['as'],'attributes':_0x41f02e['attributes'],'include':_0x41f02e[_0x44ca('0x20')]?_['map'](_0x41f02e[_0x44ca('0x20')],function(_0x4b70bd){return{'model':db[_0x4b70bd[_0x44ca('0x21')]],'as':_0x4b70bd['as'],'attributes':_0x4b70bd[_0x44ca('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x44ca('0x22')](function(_0x43e217){logger[_0x44ca('0x16')](_0x44ca('0x24'),_0x4e0a2b);logger[_0x44ca('0xf')](_0x44ca('0x24'),_0x4e0a2b,JSON[_0x44ca('0x11')](_0x43e217));_0x4e0669(_0x43e217);})[_0x44ca('0x25')](function(_0x142154){logger[_0x44ca('0x13')](_0x44ca('0x24'),_0x142154[_0x44ca('0x14')],_0x4e0a2b);_0x1567e2(_0x2c7283[_0x44ca('0x13')](0x1f4,_0x142154[_0x44ca('0x14')]));});});}; \ No newline at end of file +var _0x8f6b=['ioredis','../../config/utils','../../config/logger','../../config/environment','client','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','limit','include','map','model','ShowDynamics365Account','find','lodash','util','moment','randomstring'];(function(_0x46e9dd,_0x1c3a1c){var _0xfe5a27=function(_0x419eaa){while(--_0x419eaa){_0x46e9dd['push'](_0x46e9dd['shift']());}};_0xfe5a27(++_0x1c3a1c);}(_0x8f6b,0x146));var _0xb8f6=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x8f6b[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0xb8f6('0x0'));var util=require(_0xb8f6('0x1'));var moment=require(_0xb8f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xb8f6('0x3'));var fs=require('fs');var Redis=require(_0xb8f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb8f6('0x5'));var logger=require(_0xb8f6('0x6'))('rpc');var config=require(_0xb8f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb8f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x207add,_0x4f0488,_0x1426d1){return new BPromise(function(_0x11b65b,_0x4c5443){return client['request'](_0x207add,_0x1426d1)[_0xb8f6('0x9')](function(_0x186050){logger[_0xb8f6('0xa')](_0xb8f6('0xb'),_0x4f0488,_0xb8f6('0xc'));logger[_0xb8f6('0xd')](_0xb8f6('0xe'),_0x4f0488,_0xb8f6('0xc'),JSON[_0xb8f6('0xf')](_0x186050));if(_0x186050[_0xb8f6('0x10')]){if(_0x186050[_0xb8f6('0x10')][_0xb8f6('0x11')]===0x1f4){logger['error'](_0xb8f6('0xb'),_0x4f0488,_0x186050[_0xb8f6('0x10')]['message']);return _0x4c5443(_0x186050[_0xb8f6('0x10')][_0xb8f6('0x12')]);}logger[_0xb8f6('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x4f0488,_0x186050[_0xb8f6('0x10')]['message']);return _0x11b65b(_0x186050[_0xb8f6('0x10')][_0xb8f6('0x12')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4f0488,_0xb8f6('0xc'));_0x11b65b(_0x186050[_0xb8f6('0x13')][_0xb8f6('0x12')]);}})[_0xb8f6('0x14')](function(_0x293f0c){logger[_0xb8f6('0x10')](_0xb8f6('0xb'),_0x4f0488,_0x293f0c);_0x4c5443(_0x293f0c);});});}exports[_0xb8f6('0x15')]=function(_0x3592a5){var _0x537d5e=this;return new Promise(function(_0x5c36ec,_0x247599){return db[_0xb8f6('0x16')][_0xb8f6('0x17')]({'raw':_0x3592a5[_0xb8f6('0x18')]?_0x3592a5[_0xb8f6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3592a5[_0xb8f6('0x18')]?_0x3592a5[_0xb8f6('0x18')][_0xb8f6('0x19')]||null:null,'attributes':_0x3592a5[_0xb8f6('0x18')]?_0x3592a5['options'][_0xb8f6('0x1a')]||null:null,'limit':_0x3592a5[_0xb8f6('0x18')]?_0x3592a5[_0xb8f6('0x18')][_0xb8f6('0x1b')]||null:null,'include':_0x3592a5[_0xb8f6('0x18')]?_0x3592a5[_0xb8f6('0x18')][_0xb8f6('0x1c')]?_[_0xb8f6('0x1d')](_0x3592a5['options'][_0xb8f6('0x1c')],function(_0x16c880){return{'model':db[_0x16c880[_0xb8f6('0x1e')]],'as':_0x16c880['as'],'attributes':_0x16c880[_0xb8f6('0x1a')],'include':_0x16c880['include']?_[_0xb8f6('0x1d')](_0x16c880[_0xb8f6('0x1c')],function(_0x4fea2e){return{'model':db[_0x4fea2e[_0xb8f6('0x1e')]],'as':_0x4fea2e['as'],'attributes':_0x4fea2e['attributes'],'include':_0x4fea2e[_0xb8f6('0x1c')]?_[_0xb8f6('0x1d')](_0x4fea2e[_0xb8f6('0x1c')],function(_0x1b0f80){return{'model':db[_0x1b0f80['model']],'as':_0x1b0f80['as'],'attributes':_0x1b0f80[_0xb8f6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb8f6('0x9')](function(_0x26d3c1){logger['info'](_0xb8f6('0x15'),_0x3592a5);logger[_0xb8f6('0xd')](_0xb8f6('0x15'),_0x3592a5,JSON[_0xb8f6('0xf')](_0x26d3c1));_0x5c36ec(_0x26d3c1);})[_0xb8f6('0x14')](function(_0x47ffb2){logger['error'](_0xb8f6('0x15'),_0x47ffb2['message'],_0x3592a5);_0x247599(_0x537d5e[_0xb8f6('0x10')](0x1f4,_0x47ffb2['message']));});});};exports[_0xb8f6('0x1f')]=function(_0x40268c){var _0xb1f317=this;return new Promise(function(_0x3796f9,_0x32b960){return db[_0xb8f6('0x16')][_0xb8f6('0x20')]({'raw':_0x40268c[_0xb8f6('0x18')]?_0x40268c[_0xb8f6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x40268c[_0xb8f6('0x18')]?_0x40268c[_0xb8f6('0x18')][_0xb8f6('0x19')]||null:null,'attributes':_0x40268c[_0xb8f6('0x18')]?_0x40268c['options'][_0xb8f6('0x1a')]||null:null,'include':_0x40268c['options']?_0x40268c[_0xb8f6('0x18')][_0xb8f6('0x1c')]?_[_0xb8f6('0x1d')](_0x40268c[_0xb8f6('0x18')]['include'],function(_0x12cd14){return{'model':db[_0x12cd14['model']],'as':_0x12cd14['as'],'attributes':_0x12cd14[_0xb8f6('0x1a')],'include':_0x12cd14['include']?_[_0xb8f6('0x1d')](_0x12cd14['include'],function(_0x2bf4d2){return{'model':db[_0x2bf4d2[_0xb8f6('0x1e')]],'as':_0x2bf4d2['as'],'attributes':_0x2bf4d2[_0xb8f6('0x1a')],'include':_0x2bf4d2['include']?_[_0xb8f6('0x1d')](_0x2bf4d2['include'],function(_0x216fd4){return{'model':db[_0x216fd4[_0xb8f6('0x1e')]],'as':_0x216fd4['as'],'attributes':_0x216fd4['attributes']};}):[]};}):[]};}):[]:[]})[_0xb8f6('0x9')](function(_0xd7a6a3){logger['info'](_0xb8f6('0x1f'),_0x40268c);logger[_0xb8f6('0xd')]('ShowDynamics365Account',_0x40268c,JSON['stringify'](_0xd7a6a3));_0x3796f9(_0xd7a6a3);})[_0xb8f6('0x14')](function(_0x5f33e9){logger[_0xb8f6('0x10')](_0xb8f6('0x1f'),_0x5f33e9[_0xb8f6('0x12')],_0x40268c);_0x32b960(_0xb1f317[_0xb8f6('0x10')](0x1f4,_0x5f33e9['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 0b50944..8543578 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 _0x2aee=['show','get','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','./intDynamics365Configuration.controller','isAuthenticated','index'];(function(_0x369fc4,_0x5e94f9){var _0x1fb362=function(_0x5451f4){while(--_0x5451f4){_0x369fc4['push'](_0x369fc4['shift']());}};_0x1fb362(++_0x5e94f9);}(_0x2aee,0x124));var _0xe2ae=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0x2aee[_0x35a140];return _0x30ab82;};'use strict';var multer=require(_0xe2ae('0x0'));var util=require('util');var path=require(_0xe2ae('0x1'));var timeout=require('connect-timeout');var express=require(_0xe2ae('0x2'));var router=express[_0xe2ae('0x3')]();var fs_extra=require(_0xe2ae('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe2ae('0x5'));router['get']('/',auth[_0xe2ae('0x6')](),controller[_0xe2ae('0x7')]);router['get']('/:id',auth[_0xe2ae('0x6')](),controller[_0xe2ae('0x8')]);router[_0xe2ae('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xe2ae('0x9')]('/:id/subjects',auth[_0xe2ae('0x6')](),controller[_0xe2ae('0xa')]);router[_0xe2ae('0x9')](_0xe2ae('0xb'),auth[_0xe2ae('0x6')](),controller[_0xe2ae('0xc')]);router['post']('/',auth[_0xe2ae('0x6')](),controller[_0xe2ae('0xd')]);router[_0xe2ae('0xe')](_0xe2ae('0xf'),auth['isAuthenticated'](),controller[_0xe2ae('0x10')]);router[_0xe2ae('0x11')](_0xe2ae('0xf'),auth['isAuthenticated'](),controller[_0xe2ae('0x12')]);module[_0xe2ae('0x13')]=router; \ No newline at end of file +var _0xa31a=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','/:id','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x484945,_0x44c47d){var _0x5de501=function(_0xc3ac8e){while(--_0xc3ac8e){_0x484945['push'](_0x484945['shift']());}};_0x5de501(++_0x44c47d);}(_0xa31a,0xe1));var _0xaa31=function(_0x4c76b7,_0x1de269){_0x4c76b7=_0x4c76b7-0x0;var _0x45e244=_0xa31a[_0x4c76b7];return _0x45e244;};'use strict';var multer=require(_0xaa31('0x0'));var util=require(_0xaa31('0x1'));var path=require(_0xaa31('0x2'));var timeout=require(_0xaa31('0x3'));var express=require(_0xaa31('0x4'));var router=express[_0xaa31('0x5')]();var fs_extra=require(_0xaa31('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xaa31('0x7'));var config=require(_0xaa31('0x8'));var controller=require(_0xaa31('0x9'));router[_0xaa31('0xa')]('/',auth[_0xaa31('0xb')](),controller[_0xaa31('0xc')]);router[_0xaa31('0xa')]('/:id',auth[_0xaa31('0xb')](),controller[_0xaa31('0xd')]);router[_0xaa31('0xa')](_0xaa31('0xe'),auth[_0xaa31('0xb')](),controller[_0xaa31('0xf')]);router[_0xaa31('0xa')](_0xaa31('0x10'),auth[_0xaa31('0xb')](),controller[_0xaa31('0x11')]);router['get'](_0xaa31('0x12'),auth[_0xaa31('0xb')](),controller[_0xaa31('0x13')]);router[_0xaa31('0x14')]('/',auth['isAuthenticated'](),controller[_0xaa31('0x15')]);router['put']('/:id',auth[_0xaa31('0xb')](),controller['update']);router[_0xaa31('0x16')](_0xaa31('0x17'),auth[_0xaa31('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 337ec66..f6ceb9d 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 _0x8f13=['phonecall','sequelize','exports','STRING','ENUM','incident'];(function(_0xc77eb5,_0x2d1c34){var _0x13ec09=function(_0xe02000){while(--_0xe02000){_0xc77eb5['push'](_0xc77eb5['shift']());}};_0x13ec09(++_0x2d1c34);}(_0x8f13,0x163));var _0x38f1=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x8f13[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x38f1('0x0'));module[_0x38f1('0x1')]={'name':{'type':Sequelize[_0x38f1('0x2')]},'description':{'type':Sequelize[_0x38f1('0x2')]},'ticketType':{'type':Sequelize[_0x38f1('0x3')](_0x38f1('0x4'),_0x38f1('0x5')),'defaultValue':_0x38f1('0x4')}}; \ No newline at end of file +var _0x5ea2=['sequelize','exports','STRING','ENUM'];(function(_0x227783,_0x5a41a2){var _0x528afd=function(_0x55b0b8){while(--_0x55b0b8){_0x227783['push'](_0x227783['shift']());}};_0x528afd(++_0x5a41a2);}(_0x5ea2,0x188));var _0x25ea=function(_0x187884,_0x579ab0){_0x187884=_0x187884-0x0;var _0x1b0cc8=_0x5ea2[_0x187884];return _0x1b0cc8;};'use strict';var Sequelize=require(_0x25ea('0x0'));module[_0x25ea('0x1')]={'name':{'type':Sequelize[_0x25ea('0x2')]},'description':{'type':Sequelize[_0x25ea('0x2')]},'ticketType':{'type':Sequelize[_0x25ea('0x3')]('incident','phonecall'),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index a054e45..53b03c3 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 _0x8875=['rows','show','options','create','body','update','find','params','getFields','Dynamics365Field','getSubjects','getDescriptions','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','http','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include'];(function(_0x324d02,_0x6d9c0b){var _0x3d4f59=function(_0x279f6b){while(--_0x279f6b){_0x324d02['push'](_0x324d02['shift']());}};_0x3d4f59(++_0x6d9c0b);}(_0x8875,0x67));var _0x5887=function(_0x563b8d,_0x31f0cd){_0x563b8d=_0x563b8d-0x0;var _0x258753=_0x8875[_0x563b8d];return _0x258753;};'use strict';var pdf=require(_0x5887('0x0'));var emlformat=require(_0x5887('0x1'));var rimraf=require(_0x5887('0x2'));var zipdir=require(_0x5887('0x3'));var jsonpatch=require(_0x5887('0x4'));var rp=require(_0x5887('0x5'));var moment=require(_0x5887('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5887('0x7'));var util=require(_0x5887('0x8'));var path=require('path');var sox=require(_0x5887('0x9'));var csv=require(_0x5887('0xa'));var ejs=require(_0x5887('0xb'));var fs=require('fs');var fs_extra=require(_0x5887('0xc'));var _=require('lodash');var squel=require(_0x5887('0xd'));var crypto=require('crypto');var jsforce=require(_0x5887('0xe'));var deskjs=require(_0x5887('0xf'));var toCsv=require(_0x5887('0xa'));var querystring=require('querystring');var Papa=require(_0x5887('0x10'));var Redis=require(_0x5887('0x11'));var authService=require(_0x5887('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5887('0x13'));var logger=require(_0x5887('0x14'))(_0x5887('0x15'));var utils=require(_0x5887('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5887('0x17'));var db=require(_0x5887('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x5887('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x29cf4d,_0x3f13af,_0x1d2755,_0x5c8747){return new BPromise(function(_0xb6d150,_0x52c0a9){var _0x58826c=_0x5c8747||client;return _0x58826c[_0x5887('0x1a')](_0x29cf4d,_0x1d2755)[_0x5887('0x1b')](function(_0x1cd00f){logger[_0x5887('0x1c')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3f13af,_0x5887('0x1d'));logger[_0x5887('0x1e')](_0x5887('0x1f'),_0x3f13af,_0x5887('0x1d'),JSON[_0x5887('0x20')](_0x1cd00f));if(_0x1cd00f['error']){if(_0x1cd00f[_0x5887('0x21')]['code']===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x3f13af,_0x1cd00f[_0x5887('0x21')][_0x5887('0x22')]);return _0x52c0a9(_0x1cd00f[_0x5887('0x21')][_0x5887('0x22')]);}logger['error'](_0x5887('0x23'),_0x3f13af,_0x1cd00f[_0x5887('0x21')][_0x5887('0x22')]);return _0xb6d150(_0x1cd00f[_0x5887('0x21')]['message']);}else{logger[_0x5887('0x1c')](_0x5887('0x23'),_0x3f13af,'request\x20sent');_0xb6d150(_0x1cd00f[_0x5887('0x24')][_0x5887('0x22')]);}})[_0x5887('0x25')](function(_0x506ea1){logger[_0x5887('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3f13af,_0x506ea1);_0x52c0a9(_0x506ea1);});});}function respondWithStatusCode(_0x5bd46f,_0x36dd53){_0x36dd53=_0x36dd53||0xcc;return function(_0x3d9883){if(_0x3d9883){return _0x5bd46f[_0x5887('0x26')](_0x36dd53);}return _0x5bd46f[_0x5887('0x27')](_0x36dd53)[_0x5887('0x28')]();};}function respondWithResult(_0x58fbf6,_0x23cb77){_0x23cb77=_0x23cb77||0xc8;return function(_0x1afd84){if(_0x1afd84){return _0x58fbf6[_0x5887('0x27')](_0x23cb77)[_0x5887('0x29')](_0x1afd84);}};}function respondWithFilteredResult(_0x497e3e,_0x2a4bae){return function(_0x37707c){if(_0x37707c){var _0x4bcf33=_0x37707c[_0x5887('0x2a')],_0x3a84c6=_0x2a4bae[_0x5887('0x2b')],_0x1ef057=_0x2a4bae[_0x5887('0x2b')]+_0x2a4bae[_0x5887('0x2c')],_0x78e81f;if(_0x1ef057>=_0x4bcf33){_0x1ef057=_0x4bcf33;_0x78e81f=0xc8;}else{_0x78e81f=0xce;}_0x497e3e['status'](_0x78e81f);return _0x497e3e['set'](_0x5887('0x2d'),_0x3a84c6+'-'+_0x1ef057+'/'+_0x4bcf33)['json'](_0x37707c);}return null;};}function patchUpdates(_0x51f79a){return function(_0x3218b0){try{jsonpatch[_0x5887('0x2e')](_0x3218b0,_0x51f79a,!![]);}catch(_0x5e5280){return BPromise[_0x5887('0x2f')](_0x5e5280);}return _0x3218b0[_0x5887('0x30')]();};}function saveUpdates(_0x2fe748,_0x5e3bde){return function(_0x28680a){if(_0x28680a){return _0x28680a['update'](_0x2fe748)['then'](function(_0x3160ca){return _0x3160ca;});}return null;};}function removeEntity(_0x31bf72,_0x107e5f){return function(_0x167109){if(_0x167109){return _0x167109['destroy']()[_0x5887('0x1b')](function(){_0x31bf72[_0x5887('0x27')](0xcc)[_0x5887('0x28')]();});}};}function handleEntityNotFound(_0x28828e,_0x474b94){return function(_0x3dc09c){if(!_0x3dc09c){_0x28828e['sendStatus'](0x194);}return _0x3dc09c;};}function handleError(_0x4e2857,_0x4cee56){_0x4cee56=_0x4cee56||0x1f4;return function(_0x3c7ff4){logger[_0x5887('0x21')](_0x3c7ff4[_0x5887('0x31')]);if(_0x3c7ff4[_0x5887('0x32')]){delete _0x3c7ff4[_0x5887('0x32')];}_0x4e2857['status'](_0x4cee56)[_0x5887('0x33')](_0x3c7ff4);};}exports[_0x5887('0x34')]=function(_0x127599,_0xd138d0){var _0x4d47f6={},_0x3c6a99={},_0x406f17={'count':0x0,'rows':[]};var _0x48a92e=_[_0x5887('0x35')](db[_0x5887('0x36')][_0x5887('0x37')],function(_0x284ebc){return{'name':_0x284ebc[_0x5887('0x38')],'type':_0x284ebc['type'][_0x5887('0x39')]};});_0x3c6a99['model']=_[_0x5887('0x35')](_0x48a92e,_0x5887('0x32'));_0x3c6a99['query']=_[_0x5887('0x3a')](_0x127599[_0x5887('0x3b')]);_0x3c6a99[_0x5887('0x3c')]=_['intersection'](_0x3c6a99[_0x5887('0x3d')],_0x3c6a99[_0x5887('0x3b')]);_0x4d47f6['attributes']=_[_0x5887('0x3e')](_0x3c6a99[_0x5887('0x3d')],qs[_0x5887('0x3f')](_0x127599[_0x5887('0x3b')][_0x5887('0x3f')]));_0x4d47f6[_0x5887('0x40')]=_0x4d47f6['attributes'][_0x5887('0x41')]?_0x4d47f6[_0x5887('0x40')]:_0x3c6a99[_0x5887('0x3d')];if(!_0x127599['query'][_0x5887('0x42')](_0x5887('0x43'))){_0x4d47f6[_0x5887('0x2c')]=qs[_0x5887('0x2c')](_0x127599[_0x5887('0x3b')]['limit']);_0x4d47f6[_0x5887('0x2b')]=qs[_0x5887('0x2b')](_0x127599[_0x5887('0x3b')][_0x5887('0x2b')]);}_0x4d47f6[_0x5887('0x44')]=qs[_0x5887('0x45')](_0x127599[_0x5887('0x3b')][_0x5887('0x45')]);_0x4d47f6[_0x5887('0x46')]=qs[_0x5887('0x3c')](_[_0x5887('0x47')](_0x127599[_0x5887('0x3b')],_0x3c6a99[_0x5887('0x3c')]),_0x48a92e);if(_0x127599[_0x5887('0x3b')][_0x5887('0x48')]){_0x4d47f6['where']=_[_0x5887('0x49')](_0x4d47f6['where'],{'$or':_[_0x5887('0x35')](_0x48a92e,function(_0x23400c){if(_0x23400c[_0x5887('0x4a')]!==_0x5887('0x4b')){var _0x2d85ff={};_0x2d85ff[_0x23400c[_0x5887('0x32')]]={'$like':'%'+_0x127599[_0x5887('0x3b')]['filter']+'%'};return _0x2d85ff;}})});}_0x4d47f6=_[_0x5887('0x49')]({},_0x4d47f6,_0x127599['options']);var _0x1d7a32={'where':_0x4d47f6['where']};return db[_0x5887('0x36')]['count'](_0x1d7a32)[_0x5887('0x1b')](function(_0x13d983){_0x406f17[_0x5887('0x2a')]=_0x13d983;if(_0x127599[_0x5887('0x3b')]['includeAll']){_0x4d47f6[_0x5887('0x4c')]=[{'all':!![]}];}return db[_0x5887('0x36')]['findAll'](_0x4d47f6);})[_0x5887('0x1b')](function(_0xcd4e68){_0x406f17[_0x5887('0x4d')]=_0xcd4e68;return _0x406f17;})[_0x5887('0x1b')](respondWithFilteredResult(_0xd138d0,_0x4d47f6))[_0x5887('0x25')](handleError(_0xd138d0,null));};exports[_0x5887('0x4e')]=function(_0x411d04,_0x593796){var _0x195dcb={'raw':![],'where':{'id':_0x411d04['params']['id']}},_0x2f8e00={};_0x2f8e00['model']=_[_0x5887('0x3a')](db[_0x5887('0x36')][_0x5887('0x37')]);_0x2f8e00[_0x5887('0x3b')]=_[_0x5887('0x3a')](_0x411d04[_0x5887('0x3b')]);_0x2f8e00[_0x5887('0x3c')]=_['intersection'](_0x2f8e00[_0x5887('0x3d')],_0x2f8e00[_0x5887('0x3b')]);_0x195dcb['attributes']=_[_0x5887('0x3e')](_0x2f8e00[_0x5887('0x3d')],qs[_0x5887('0x3f')](_0x411d04['query'][_0x5887('0x3f')]));_0x195dcb[_0x5887('0x40')]=_0x195dcb[_0x5887('0x40')][_0x5887('0x41')]?_0x195dcb[_0x5887('0x40')]:_0x2f8e00[_0x5887('0x3d')];if(_0x411d04[_0x5887('0x3b')]['includeAll']){_0x195dcb['include']=[{'all':!![]}];}_0x195dcb=_[_0x5887('0x49')]({},_0x195dcb,_0x411d04[_0x5887('0x4f')]);return db[_0x5887('0x36')]['find'](_0x195dcb)[_0x5887('0x1b')](handleEntityNotFound(_0x593796,null))[_0x5887('0x1b')](respondWithResult(_0x593796,null))['catch'](handleError(_0x593796,null));};exports[_0x5887('0x50')]=function(_0x256182,_0x260d27){return db[_0x5887('0x36')]['create'](_0x256182[_0x5887('0x51')],{})['then'](respondWithResult(_0x260d27,0xc9))[_0x5887('0x25')](handleError(_0x260d27,null));};exports[_0x5887('0x52')]=function(_0x4f0771,_0x1dec46){if(_0x4f0771['body']['id']){delete _0x4f0771['body']['id'];}return db['Dynamics365Configuration'][_0x5887('0x53')]({'where':{'id':_0x4f0771[_0x5887('0x54')]['id']}})[_0x5887('0x1b')](handleEntityNotFound(_0x1dec46,null))['then'](saveUpdates(_0x4f0771[_0x5887('0x51')],null))[_0x5887('0x1b')](respondWithResult(_0x1dec46,null))[_0x5887('0x25')](handleError(_0x1dec46,null));};exports['destroy']=function(_0x22f18a,_0x3a5762){return db[_0x5887('0x36')]['find']({'where':{'id':_0x22f18a['params']['id']}})[_0x5887('0x1b')](handleEntityNotFound(_0x3a5762,null))['then'](removeEntity(_0x3a5762,null))['catch'](handleError(_0x3a5762,null));};exports[_0x5887('0x55')]=function(_0x580de0,_0x12a01d,_0x399f85){var _0x170e9f={};var _0x544a55={};var _0xbf9876;var _0x587351;return db[_0x5887('0x36')]['findOne']({'where':{'id':_0x580de0['params']['id']}})[_0x5887('0x1b')](handleEntityNotFound(_0x12a01d,null))[_0x5887('0x1b')](function(_0x2118c6){if(_0x2118c6){_0xbf9876=_0x2118c6;_0x544a55['model']=_[_0x5887('0x3a')](db[_0x5887('0x56')][_0x5887('0x37')]);_0x544a55[_0x5887('0x3b')]=_[_0x5887('0x3a')](_0x580de0[_0x5887('0x3b')]);_0x544a55[_0x5887('0x3c')]=_['intersection'](_0x544a55[_0x5887('0x3d')],_0x544a55['query']);_0x170e9f[_0x5887('0x40')]=_['intersection'](_0x544a55[_0x5887('0x3d')],qs[_0x5887('0x3f')](_0x580de0[_0x5887('0x3b')][_0x5887('0x3f')]));_0x170e9f[_0x5887('0x40')]=_0x170e9f[_0x5887('0x40')][_0x5887('0x41')]?_0x170e9f[_0x5887('0x40')]:_0x544a55[_0x5887('0x3d')];_0x170e9f[_0x5887('0x44')]=qs[_0x5887('0x45')](_0x580de0[_0x5887('0x3b')]['sort']);_0x170e9f[_0x5887('0x46')]=qs[_0x5887('0x3c')](_[_0x5887('0x47')](_0x580de0[_0x5887('0x3b')],_0x544a55[_0x5887('0x3c')]));if(_0x580de0['query'][_0x5887('0x48')]){_0x170e9f['where']=_[_0x5887('0x49')](_0x170e9f[_0x5887('0x46')],{'$or':_[_0x5887('0x35')](_0x170e9f[_0x5887('0x40')],function(_0x52b549){var _0x7b9011={};_0x7b9011[_0x52b549]={'$like':'%'+_0x580de0['query'][_0x5887('0x48')]+'%'};return _0x7b9011;})});}_0x170e9f=_[_0x5887('0x49')]({},_0x170e9f,_0x580de0['options']);return _0xbf9876[_0x5887('0x55')](_0x170e9f);}})['then'](function(_0x3b55f2){if(_0x3b55f2){_0x587351=_0x3b55f2['length'];if(!_0x580de0[_0x5887('0x3b')][_0x5887('0x42')]('nolimit')){_0x170e9f[_0x5887('0x2c')]=qs[_0x5887('0x2c')](_0x580de0[_0x5887('0x3b')]['limit']);_0x170e9f['offset']=qs[_0x5887('0x2b')](_0x580de0[_0x5887('0x3b')][_0x5887('0x2b')]);}return _0xbf9876[_0x5887('0x55')](_0x170e9f);}})[_0x5887('0x1b')](function(_0x341ff9){if(_0x341ff9){return _0x341ff9?{'count':_0x587351,'rows':_0x341ff9}:null;}})[_0x5887('0x1b')](respondWithResult(_0x12a01d,null))[_0x5887('0x25')](handleError(_0x12a01d,null));};exports[_0x5887('0x57')]=function(_0x265e48,_0x351bce,_0x57cfd5){var _0x3a4004={};var _0x23eb11={};var _0xaf95a1;var _0x57a77f;return db[_0x5887('0x36')]['findOne']({'where':{'id':_0x265e48[_0x5887('0x54')]['id']}})[_0x5887('0x1b')](handleEntityNotFound(_0x351bce,null))[_0x5887('0x1b')](function(_0x2bc895){if(_0x2bc895){_0xaf95a1=_0x2bc895;_0x23eb11[_0x5887('0x3d')]=_[_0x5887('0x3a')](db[_0x5887('0x56')][_0x5887('0x37')]);_0x23eb11[_0x5887('0x3b')]=_[_0x5887('0x3a')](_0x265e48[_0x5887('0x3b')]);_0x23eb11['filters']=_['intersection'](_0x23eb11['model'],_0x23eb11['query']);_0x3a4004[_0x5887('0x40')]=_[_0x5887('0x3e')](_0x23eb11['model'],qs[_0x5887('0x3f')](_0x265e48[_0x5887('0x3b')][_0x5887('0x3f')]));_0x3a4004['attributes']=_0x3a4004[_0x5887('0x40')]['length']?_0x3a4004[_0x5887('0x40')]:_0x23eb11[_0x5887('0x3d')];_0x3a4004[_0x5887('0x44')]=qs['sort'](_0x265e48[_0x5887('0x3b')][_0x5887('0x45')]);_0x3a4004[_0x5887('0x46')]=qs[_0x5887('0x3c')](_[_0x5887('0x47')](_0x265e48['query'],_0x23eb11[_0x5887('0x3c')]));if(_0x265e48[_0x5887('0x3b')][_0x5887('0x48')]){_0x3a4004[_0x5887('0x46')]=_[_0x5887('0x49')](_0x3a4004[_0x5887('0x46')],{'$or':_[_0x5887('0x35')](_0x3a4004[_0x5887('0x40')],function(_0x5c07e7){var _0x5c3387={};_0x5c3387[_0x5c07e7]={'$like':'%'+_0x265e48[_0x5887('0x3b')][_0x5887('0x48')]+'%'};return _0x5c3387;})});}_0x3a4004=_['merge']({},_0x3a4004,_0x265e48[_0x5887('0x4f')]);return _0xaf95a1[_0x5887('0x57')](_0x3a4004);}})[_0x5887('0x1b')](function(_0x24115e){if(_0x24115e){_0x57a77f=_0x24115e['length'];if(!_0x265e48[_0x5887('0x3b')][_0x5887('0x42')](_0x5887('0x43'))){_0x3a4004[_0x5887('0x2c')]=qs[_0x5887('0x2c')](_0x265e48[_0x5887('0x3b')]['limit']);_0x3a4004['offset']=qs[_0x5887('0x2b')](_0x265e48[_0x5887('0x3b')][_0x5887('0x2b')]);}return _0xaf95a1[_0x5887('0x57')](_0x3a4004);}})[_0x5887('0x1b')](function(_0x476829){if(_0x476829){return _0x476829?{'count':_0x57a77f,'rows':_0x476829}:null;}})[_0x5887('0x1b')](respondWithResult(_0x351bce,null))[_0x5887('0x25')](handleError(_0x351bce,null));};exports[_0x5887('0x58')]=function(_0x47b7c5,_0x153349,_0x1e16fc){var _0x4ccfb8={};var _0x4419d0={};var _0x2a43e8;var _0x6cde50;return db[_0x5887('0x36')][_0x5887('0x59')]({'where':{'id':_0x47b7c5[_0x5887('0x54')]['id']}})[_0x5887('0x1b')](handleEntityNotFound(_0x153349,null))['then'](function(_0xd1be74){if(_0xd1be74){_0x2a43e8=_0xd1be74;_0x4419d0['model']=_['keys'](db[_0x5887('0x56')][_0x5887('0x37')]);_0x4419d0['query']=_[_0x5887('0x3a')](_0x47b7c5[_0x5887('0x3b')]);_0x4419d0[_0x5887('0x3c')]=_['intersection'](_0x4419d0['model'],_0x4419d0[_0x5887('0x3b')]);_0x4ccfb8['attributes']=_[_0x5887('0x3e')](_0x4419d0[_0x5887('0x3d')],qs[_0x5887('0x3f')](_0x47b7c5['query'][_0x5887('0x3f')]));_0x4ccfb8['attributes']=_0x4ccfb8[_0x5887('0x40')][_0x5887('0x41')]?_0x4ccfb8[_0x5887('0x40')]:_0x4419d0[_0x5887('0x3d')];_0x4ccfb8[_0x5887('0x44')]=qs[_0x5887('0x45')](_0x47b7c5[_0x5887('0x3b')][_0x5887('0x45')]);_0x4ccfb8[_0x5887('0x46')]=qs[_0x5887('0x3c')](_[_0x5887('0x47')](_0x47b7c5['query'],_0x4419d0['filters']));if(_0x47b7c5[_0x5887('0x3b')][_0x5887('0x48')]){_0x4ccfb8[_0x5887('0x46')]=_['merge'](_0x4ccfb8[_0x5887('0x46')],{'$or':_['map'](_0x4ccfb8[_0x5887('0x40')],function(_0x4ffc00){var _0x4d56c2={};_0x4d56c2[_0x4ffc00]={'$like':'%'+_0x47b7c5['query'][_0x5887('0x48')]+'%'};return _0x4d56c2;})});}_0x4ccfb8=_['merge']({},_0x4ccfb8,_0x47b7c5[_0x5887('0x4f')]);return _0x2a43e8[_0x5887('0x58')](_0x4ccfb8);}})['then'](function(_0x494fd7){if(_0x494fd7){_0x6cde50=_0x494fd7['length'];if(!_0x47b7c5[_0x5887('0x3b')][_0x5887('0x42')](_0x5887('0x43'))){_0x4ccfb8[_0x5887('0x2c')]=qs[_0x5887('0x2c')](_0x47b7c5[_0x5887('0x3b')]['limit']);_0x4ccfb8['offset']=qs[_0x5887('0x2b')](_0x47b7c5[_0x5887('0x3b')][_0x5887('0x2b')]);}return _0x2a43e8[_0x5887('0x58')](_0x4ccfb8);}})['then'](function(_0x543b52){if(_0x543b52){return _0x543b52?{'count':_0x6cde50,'rows':_0x543b52}:null;}})[_0x5887('0x1b')](respondWithResult(_0x153349,null))['catch'](handleError(_0x153349,null));}; \ No newline at end of file +var _0xf33b=['zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','destroy','end','stack','name','map','Dynamics365Configuration','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','then','findAll','show','keys','includeAll','include','find','create','update','body','params','findOne','rawAttributes','order','getFields','nolimit','Dynamics365Field','getSubjects','getDescriptions','html-pdf','rimraf'];(function(_0x20b035,_0x33e530){var _0x26d5ec=function(_0x34fafa){while(--_0x34fafa){_0x20b035['push'](_0x20b035['shift']());}};_0x26d5ec(++_0x33e530);}(_0xf33b,0xac));var _0xbf33=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0xf33b[_0x590851];return _0x3b0115;};'use strict';var pdf=require(_0xbf33('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbf33('0x1'));var zipdir=require(_0xbf33('0x2'));var jsonpatch=require(_0xbf33('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbf33('0x4'));var Mustache=require(_0xbf33('0x5'));var util=require(_0xbf33('0x6'));var path=require(_0xbf33('0x7'));var sox=require('sox');var csv=require(_0xbf33('0x8'));var ejs=require(_0xbf33('0x9'));var fs=require('fs');var fs_extra=require(_0xbf33('0xa'));var _=require(_0xbf33('0xb'));var squel=require(_0xbf33('0xc'));var crypto=require(_0xbf33('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf33('0x8'));var querystring=require(_0xbf33('0xe'));var Papa=require(_0xbf33('0xf'));var Redis=require('ioredis');var authService=require(_0xbf33('0x10'));var qs=require(_0xbf33('0x11'));var as=require(_0xbf33('0x12'));var hardwareService=require(_0xbf33('0x13'));var logger=require(_0xbf33('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xbf33('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf33('0x16'))['db'];var jayson=require(_0xbf33('0x17'));var client=jayson[_0xbf33('0x18')][_0xbf33('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x599366,_0x265895,_0x4f301d,_0x1dfd87){return new BPromise(function(_0x383ef6,_0x27e85f){var _0x164035=_0x1dfd87||client;return _0x164035[_0xbf33('0x1a')](_0x599366,_0x4f301d)['then'](function(_0x36b14b){logger[_0xbf33('0x1b')](_0xbf33('0x1c'),_0x265895,_0xbf33('0x1d'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x265895,_0xbf33('0x1d'),JSON[_0xbf33('0x1e')](_0x36b14b));if(_0x36b14b[_0xbf33('0x1f')]){if(_0x36b14b[_0xbf33('0x1f')][_0xbf33('0x20')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x265895,_0x36b14b['error'][_0xbf33('0x21')]);return _0x27e85f(_0x36b14b['error']['message']);}logger[_0xbf33('0x1f')](_0xbf33('0x1c'),_0x265895,_0x36b14b[_0xbf33('0x1f')][_0xbf33('0x21')]);return _0x383ef6(_0x36b14b['error'][_0xbf33('0x21')]);}else{logger[_0xbf33('0x1b')](_0xbf33('0x1c'),_0x265895,_0xbf33('0x1d'));_0x383ef6(_0x36b14b['result'][_0xbf33('0x21')]);}})[_0xbf33('0x22')](function(_0x44e0a2){logger[_0xbf33('0x1f')]('Dynamics365Configuration,\x20%s,\x20%s',_0x265895,_0x44e0a2);_0x27e85f(_0x44e0a2);});});}function respondWithStatusCode(_0x4a2af2,_0x37c1bc){_0x37c1bc=_0x37c1bc||0xcc;return function(_0x99cdeb){if(_0x99cdeb){return _0x4a2af2[_0xbf33('0x23')](_0x37c1bc);}return _0x4a2af2[_0xbf33('0x24')](_0x37c1bc)['end']();};}function respondWithResult(_0x205808,_0x29ff4f){_0x29ff4f=_0x29ff4f||0xc8;return function(_0x36a396){if(_0x36a396){return _0x205808[_0xbf33('0x24')](_0x29ff4f)[_0xbf33('0x25')](_0x36a396);}};}function respondWithFilteredResult(_0x5e7820,_0xc3e18a){return function(_0x351538){if(_0x351538){var _0x3770a5=_0x351538[_0xbf33('0x26')],_0x5c05a3=_0xc3e18a[_0xbf33('0x27')],_0x49b962=_0xc3e18a['offset']+_0xc3e18a[_0xbf33('0x28')],_0x503701;if(_0x49b962>=_0x3770a5){_0x49b962=_0x3770a5;_0x503701=0xc8;}else{_0x503701=0xce;}_0x5e7820[_0xbf33('0x24')](_0x503701);return _0x5e7820['set'](_0xbf33('0x29'),_0x5c05a3+'-'+_0x49b962+'/'+_0x3770a5)[_0xbf33('0x25')](_0x351538);}return null;};}function patchUpdates(_0x4f8ab5){return function(_0x5ea1b7){try{jsonpatch[_0xbf33('0x2a')](_0x5ea1b7,_0x4f8ab5,!![]);}catch(_0x5b12f9){return BPromise[_0xbf33('0x2b')](_0x5b12f9);}return _0x5ea1b7[_0xbf33('0x2c')]();};}function saveUpdates(_0x48775b,_0x48dec8){return function(_0x463d64){if(_0x463d64){return _0x463d64['update'](_0x48775b)['then'](function(_0x5919f6){return _0x5919f6;});}return null;};}function removeEntity(_0xb15a3,_0x46ae8d){return function(_0x609c97){if(_0x609c97){return _0x609c97[_0xbf33('0x2d')]()['then'](function(){_0xb15a3[_0xbf33('0x24')](0xcc)[_0xbf33('0x2e')]();});}};}function handleEntityNotFound(_0x1239fd,_0x1d3227){return function(_0x588aac){if(!_0x588aac){_0x1239fd[_0xbf33('0x23')](0x194);}return _0x588aac;};}function handleError(_0x14407b,_0x435cad){_0x435cad=_0x435cad||0x1f4;return function(_0x396b56){logger[_0xbf33('0x1f')](_0x396b56[_0xbf33('0x2f')]);if(_0x396b56[_0xbf33('0x30')]){delete _0x396b56[_0xbf33('0x30')];}_0x14407b[_0xbf33('0x24')](_0x435cad)['send'](_0x396b56);};}exports['index']=function(_0x128ff2,_0x40598b){var _0x465439={},_0x1ff141={},_0x13d0d6={'count':0x0,'rows':[]};var _0x4dc8cb=_[_0xbf33('0x31')](db[_0xbf33('0x32')]['rawAttributes'],function(_0x120d04){return{'name':_0x120d04[_0xbf33('0x33')],'type':_0x120d04[_0xbf33('0x34')]['key']};});_0x1ff141[_0xbf33('0x35')]=_[_0xbf33('0x31')](_0x4dc8cb,_0xbf33('0x30'));_0x1ff141[_0xbf33('0x36')]=_['keys'](_0x128ff2['query']);_0x1ff141[_0xbf33('0x37')]=_[_0xbf33('0x38')](_0x1ff141[_0xbf33('0x35')],_0x1ff141[_0xbf33('0x36')]);_0x465439[_0xbf33('0x39')]=_[_0xbf33('0x38')](_0x1ff141[_0xbf33('0x35')],qs[_0xbf33('0x3a')](_0x128ff2[_0xbf33('0x36')]['fields']));_0x465439[_0xbf33('0x39')]=_0x465439[_0xbf33('0x39')][_0xbf33('0x3b')]?_0x465439['attributes']:_0x1ff141[_0xbf33('0x35')];if(!_0x128ff2[_0xbf33('0x36')][_0xbf33('0x3c')]('nolimit')){_0x465439['limit']=qs[_0xbf33('0x28')](_0x128ff2[_0xbf33('0x36')][_0xbf33('0x28')]);_0x465439[_0xbf33('0x27')]=qs[_0xbf33('0x27')](_0x128ff2[_0xbf33('0x36')][_0xbf33('0x27')]);}_0x465439['order']=qs[_0xbf33('0x3d')](_0x128ff2[_0xbf33('0x36')][_0xbf33('0x3d')]);_0x465439[_0xbf33('0x3e')]=qs['filters'](_[_0xbf33('0x3f')](_0x128ff2[_0xbf33('0x36')],_0x1ff141[_0xbf33('0x37')]),_0x4dc8cb);if(_0x128ff2['query'][_0xbf33('0x40')]){_0x465439[_0xbf33('0x3e')]=_[_0xbf33('0x41')](_0x465439[_0xbf33('0x3e')],{'$or':_[_0xbf33('0x31')](_0x4dc8cb,function(_0x455484){if(_0x455484[_0xbf33('0x34')]!==_0xbf33('0x42')){var _0x3f576d={};_0x3f576d[_0x455484[_0xbf33('0x30')]]={'$like':'%'+_0x128ff2[_0xbf33('0x36')][_0xbf33('0x40')]+'%'};return _0x3f576d;}})});}_0x465439=_[_0xbf33('0x41')]({},_0x465439,_0x128ff2[_0xbf33('0x43')]);var _0x5796fd={'where':_0x465439['where']};return db[_0xbf33('0x32')][_0xbf33('0x26')](_0x5796fd)[_0xbf33('0x44')](function(_0x54c8d9){_0x13d0d6['count']=_0x54c8d9;if(_0x128ff2['query']['includeAll']){_0x465439['include']=[{'all':!![]}];}return db[_0xbf33('0x32')][_0xbf33('0x45')](_0x465439);})[_0xbf33('0x44')](function(_0x720a28){_0x13d0d6['rows']=_0x720a28;return _0x13d0d6;})[_0xbf33('0x44')](respondWithFilteredResult(_0x40598b,_0x465439))[_0xbf33('0x22')](handleError(_0x40598b,null));};exports[_0xbf33('0x46')]=function(_0x36a538,_0x5a091c){var _0x2a7187={'raw':![],'where':{'id':_0x36a538['params']['id']}},_0xaaf708={};_0xaaf708[_0xbf33('0x35')]=_[_0xbf33('0x47')](db[_0xbf33('0x32')]['rawAttributes']);_0xaaf708[_0xbf33('0x36')]=_[_0xbf33('0x47')](_0x36a538[_0xbf33('0x36')]);_0xaaf708[_0xbf33('0x37')]=_[_0xbf33('0x38')](_0xaaf708[_0xbf33('0x35')],_0xaaf708[_0xbf33('0x36')]);_0x2a7187[_0xbf33('0x39')]=_[_0xbf33('0x38')](_0xaaf708[_0xbf33('0x35')],qs[_0xbf33('0x3a')](_0x36a538['query'][_0xbf33('0x3a')]));_0x2a7187['attributes']=_0x2a7187[_0xbf33('0x39')][_0xbf33('0x3b')]?_0x2a7187[_0xbf33('0x39')]:_0xaaf708[_0xbf33('0x35')];if(_0x36a538[_0xbf33('0x36')][_0xbf33('0x48')]){_0x2a7187[_0xbf33('0x49')]=[{'all':!![]}];}_0x2a7187=_[_0xbf33('0x41')]({},_0x2a7187,_0x36a538[_0xbf33('0x43')]);return db[_0xbf33('0x32')][_0xbf33('0x4a')](_0x2a7187)[_0xbf33('0x44')](handleEntityNotFound(_0x5a091c,null))[_0xbf33('0x44')](respondWithResult(_0x5a091c,null))['catch'](handleError(_0x5a091c,null));};exports[_0xbf33('0x4b')]=function(_0x51b32f,_0x608189){return db[_0xbf33('0x32')][_0xbf33('0x4b')](_0x51b32f['body'],{})[_0xbf33('0x44')](respondWithResult(_0x608189,0xc9))['catch'](handleError(_0x608189,null));};exports[_0xbf33('0x4c')]=function(_0x3d4b2a,_0x343e27){if(_0x3d4b2a[_0xbf33('0x4d')]['id']){delete _0x3d4b2a['body']['id'];}return db[_0xbf33('0x32')][_0xbf33('0x4a')]({'where':{'id':_0x3d4b2a[_0xbf33('0x4e')]['id']}})['then'](handleEntityNotFound(_0x343e27,null))[_0xbf33('0x44')](saveUpdates(_0x3d4b2a[_0xbf33('0x4d')],null))[_0xbf33('0x44')](respondWithResult(_0x343e27,null))['catch'](handleError(_0x343e27,null));};exports['destroy']=function(_0x4f9c1c,_0x1e690f){return db['Dynamics365Configuration'][_0xbf33('0x4a')]({'where':{'id':_0x4f9c1c[_0xbf33('0x4e')]['id']}})[_0xbf33('0x44')](handleEntityNotFound(_0x1e690f,null))['then'](removeEntity(_0x1e690f,null))[_0xbf33('0x22')](handleError(_0x1e690f,null));};exports['getFields']=function(_0x4698e6,_0x4300c1,_0x5ebc7d){var _0x5ea8fd={};var _0x3ff823={};var _0x59aa4a;var _0x2b3bca;return db[_0xbf33('0x32')][_0xbf33('0x4f')]({'where':{'id':_0x4698e6['params']['id']}})['then'](handleEntityNotFound(_0x4300c1,null))[_0xbf33('0x44')](function(_0x53be89){if(_0x53be89){_0x59aa4a=_0x53be89;_0x3ff823[_0xbf33('0x35')]=_[_0xbf33('0x47')](db['Dynamics365Field'][_0xbf33('0x50')]);_0x3ff823[_0xbf33('0x36')]=_[_0xbf33('0x47')](_0x4698e6[_0xbf33('0x36')]);_0x3ff823[_0xbf33('0x37')]=_['intersection'](_0x3ff823['model'],_0x3ff823[_0xbf33('0x36')]);_0x5ea8fd[_0xbf33('0x39')]=_[_0xbf33('0x38')](_0x3ff823['model'],qs['fields'](_0x4698e6['query']['fields']));_0x5ea8fd[_0xbf33('0x39')]=_0x5ea8fd[_0xbf33('0x39')][_0xbf33('0x3b')]?_0x5ea8fd[_0xbf33('0x39')]:_0x3ff823[_0xbf33('0x35')];_0x5ea8fd[_0xbf33('0x51')]=qs[_0xbf33('0x3d')](_0x4698e6['query'][_0xbf33('0x3d')]);_0x5ea8fd['where']=qs[_0xbf33('0x37')](_['pick'](_0x4698e6['query'],_0x3ff823[_0xbf33('0x37')]));if(_0x4698e6[_0xbf33('0x36')][_0xbf33('0x40')]){_0x5ea8fd[_0xbf33('0x3e')]=_[_0xbf33('0x41')](_0x5ea8fd[_0xbf33('0x3e')],{'$or':_['map'](_0x5ea8fd[_0xbf33('0x39')],function(_0x3255a5){var _0x7e84ea={};_0x7e84ea[_0x3255a5]={'$like':'%'+_0x4698e6['query'][_0xbf33('0x40')]+'%'};return _0x7e84ea;})});}_0x5ea8fd=_[_0xbf33('0x41')]({},_0x5ea8fd,_0x4698e6[_0xbf33('0x43')]);return _0x59aa4a[_0xbf33('0x52')](_0x5ea8fd);}})[_0xbf33('0x44')](function(_0x148cb6){if(_0x148cb6){_0x2b3bca=_0x148cb6['length'];if(!_0x4698e6[_0xbf33('0x36')][_0xbf33('0x3c')](_0xbf33('0x53'))){_0x5ea8fd[_0xbf33('0x28')]=qs[_0xbf33('0x28')](_0x4698e6['query'][_0xbf33('0x28')]);_0x5ea8fd[_0xbf33('0x27')]=qs[_0xbf33('0x27')](_0x4698e6[_0xbf33('0x36')]['offset']);}return _0x59aa4a['getFields'](_0x5ea8fd);}})[_0xbf33('0x44')](function(_0x4e9bfc){if(_0x4e9bfc){return _0x4e9bfc?{'count':_0x2b3bca,'rows':_0x4e9bfc}:null;}})[_0xbf33('0x44')](respondWithResult(_0x4300c1,null))[_0xbf33('0x22')](handleError(_0x4300c1,null));};exports['getSubjects']=function(_0x3b6149,_0x5aa963,_0x57e317){var _0x118dbc={};var _0x23a9fd={};var _0x2add76;var _0x214243;return db[_0xbf33('0x32')][_0xbf33('0x4f')]({'where':{'id':_0x3b6149[_0xbf33('0x4e')]['id']}})[_0xbf33('0x44')](handleEntityNotFound(_0x5aa963,null))[_0xbf33('0x44')](function(_0x276708){if(_0x276708){_0x2add76=_0x276708;_0x23a9fd[_0xbf33('0x35')]=_[_0xbf33('0x47')](db[_0xbf33('0x54')][_0xbf33('0x50')]);_0x23a9fd[_0xbf33('0x36')]=_[_0xbf33('0x47')](_0x3b6149[_0xbf33('0x36')]);_0x23a9fd[_0xbf33('0x37')]=_['intersection'](_0x23a9fd[_0xbf33('0x35')],_0x23a9fd[_0xbf33('0x36')]);_0x118dbc[_0xbf33('0x39')]=_[_0xbf33('0x38')](_0x23a9fd['model'],qs['fields'](_0x3b6149[_0xbf33('0x36')][_0xbf33('0x3a')]));_0x118dbc[_0xbf33('0x39')]=_0x118dbc[_0xbf33('0x39')]['length']?_0x118dbc['attributes']:_0x23a9fd[_0xbf33('0x35')];_0x118dbc['order']=qs[_0xbf33('0x3d')](_0x3b6149[_0xbf33('0x36')]['sort']);_0x118dbc[_0xbf33('0x3e')]=qs['filters'](_[_0xbf33('0x3f')](_0x3b6149[_0xbf33('0x36')],_0x23a9fd[_0xbf33('0x37')]));if(_0x3b6149[_0xbf33('0x36')][_0xbf33('0x40')]){_0x118dbc[_0xbf33('0x3e')]=_[_0xbf33('0x41')](_0x118dbc[_0xbf33('0x3e')],{'$or':_[_0xbf33('0x31')](_0x118dbc[_0xbf33('0x39')],function(_0x3dbf8d){var _0x46cf92={};_0x46cf92[_0x3dbf8d]={'$like':'%'+_0x3b6149[_0xbf33('0x36')][_0xbf33('0x40')]+'%'};return _0x46cf92;})});}_0x118dbc=_[_0xbf33('0x41')]({},_0x118dbc,_0x3b6149['options']);return _0x2add76[_0xbf33('0x55')](_0x118dbc);}})[_0xbf33('0x44')](function(_0x4a5947){if(_0x4a5947){_0x214243=_0x4a5947[_0xbf33('0x3b')];if(!_0x3b6149[_0xbf33('0x36')]['hasOwnProperty'](_0xbf33('0x53'))){_0x118dbc[_0xbf33('0x28')]=qs[_0xbf33('0x28')](_0x3b6149[_0xbf33('0x36')][_0xbf33('0x28')]);_0x118dbc['offset']=qs[_0xbf33('0x27')](_0x3b6149['query'][_0xbf33('0x27')]);}return _0x2add76[_0xbf33('0x55')](_0x118dbc);}})[_0xbf33('0x44')](function(_0x7534a7){if(_0x7534a7){return _0x7534a7?{'count':_0x214243,'rows':_0x7534a7}:null;}})[_0xbf33('0x44')](respondWithResult(_0x5aa963,null))[_0xbf33('0x22')](handleError(_0x5aa963,null));};exports[_0xbf33('0x56')]=function(_0x1ec914,_0x3df6a9,_0x33396e){var _0xfb00b3={};var _0x5882c6={};var _0x4c8e9e;var _0x3c4ac0;return db[_0xbf33('0x32')]['findOne']({'where':{'id':_0x1ec914['params']['id']}})[_0xbf33('0x44')](handleEntityNotFound(_0x3df6a9,null))[_0xbf33('0x44')](function(_0x59330b){if(_0x59330b){_0x4c8e9e=_0x59330b;_0x5882c6['model']=_[_0xbf33('0x47')](db[_0xbf33('0x54')]['rawAttributes']);_0x5882c6[_0xbf33('0x36')]=_['keys'](_0x1ec914['query']);_0x5882c6[_0xbf33('0x37')]=_[_0xbf33('0x38')](_0x5882c6['model'],_0x5882c6[_0xbf33('0x36')]);_0xfb00b3['attributes']=_[_0xbf33('0x38')](_0x5882c6['model'],qs[_0xbf33('0x3a')](_0x1ec914[_0xbf33('0x36')][_0xbf33('0x3a')]));_0xfb00b3[_0xbf33('0x39')]=_0xfb00b3[_0xbf33('0x39')][_0xbf33('0x3b')]?_0xfb00b3[_0xbf33('0x39')]:_0x5882c6['model'];_0xfb00b3[_0xbf33('0x51')]=qs[_0xbf33('0x3d')](_0x1ec914[_0xbf33('0x36')][_0xbf33('0x3d')]);_0xfb00b3[_0xbf33('0x3e')]=qs[_0xbf33('0x37')](_[_0xbf33('0x3f')](_0x1ec914[_0xbf33('0x36')],_0x5882c6[_0xbf33('0x37')]));if(_0x1ec914[_0xbf33('0x36')]['filter']){_0xfb00b3['where']=_[_0xbf33('0x41')](_0xfb00b3[_0xbf33('0x3e')],{'$or':_['map'](_0xfb00b3[_0xbf33('0x39')],function(_0x5aa762){var _0x4d12b6={};_0x4d12b6[_0x5aa762]={'$like':'%'+_0x1ec914['query'][_0xbf33('0x40')]+'%'};return _0x4d12b6;})});}_0xfb00b3=_['merge']({},_0xfb00b3,_0x1ec914['options']);return _0x4c8e9e[_0xbf33('0x56')](_0xfb00b3);}})['then'](function(_0x390126){if(_0x390126){_0x3c4ac0=_0x390126['length'];if(!_0x1ec914[_0xbf33('0x36')][_0xbf33('0x3c')](_0xbf33('0x53'))){_0xfb00b3[_0xbf33('0x28')]=qs[_0xbf33('0x28')](_0x1ec914['query'][_0xbf33('0x28')]);_0xfb00b3[_0xbf33('0x27')]=qs[_0xbf33('0x27')](_0x1ec914['query'][_0xbf33('0x27')]);}return _0x4c8e9e['getDescriptions'](_0xfb00b3);}})['then'](function(_0x231bc0){if(_0x231bc0){return _0x231bc0?{'count':_0x3c4ac0,'rows':_0x231bc0}:null;}})[_0xbf33('0x44')](respondWithResult(_0x3df6a9,null))[_0xbf33('0x22')](handleError(_0x3df6a9,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 9a5ac1c..031fd9c 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 _0xa69f=['define','int_dynamics365_configurations','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x58b087,_0x81ed6d){var _0x5bdd81=function(_0x23b360){while(--_0x23b360){_0x58b087['push'](_0x58b087['shift']());}};_0x5bdd81(++_0x81ed6d);}(_0xa69f,0x182));var _0xfa69=function(_0x43cac7,_0x33fe31){_0x43cac7=_0x43cac7-0x0;var _0x375885=_0xa69f[_0x43cac7];return _0x375885;};'use strict';var _=require(_0xfa69('0x0'));var util=require('util');var logger=require(_0xfa69('0x1'))(_0xfa69('0x2'));var moment=require('moment');var BPromise=require(_0xfa69('0x3'));var rp=require(_0xfa69('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa69('0x5'));var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x1f3f4c,_0x2c283e){return _0x1f3f4c[_0xfa69('0x6')]('Dynamics365Configuration',attributes,{'tableName':_0xfa69('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3b5=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x2a9d67,_0x12113c){var _0x181855=function(_0x472d70){while(--_0x472d70){_0x2a9d67['push'](_0x2a9d67['shift']());}};_0x181855(++_0x12113c);}(_0xb3b5,0x160));var _0x5b3b=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0xb3b5[_0x2cef86];return _0x46dfd6;};'use strict';var _=require(_0x5b3b('0x0'));var util=require(_0x5b3b('0x1'));var logger=require(_0x5b3b('0x2'))(_0x5b3b('0x3'));var moment=require(_0x5b3b('0x4'));var BPromise=require(_0x5b3b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b3b('0x6'));var rimraf=require(_0x5b3b('0x7'));var config=require(_0x5b3b('0x8'));var attributes=require(_0x5b3b('0x9'));module[_0x5b3b('0xa')]=function(_0x8e2dd7,_0x512f09){return _0x8e2dd7[_0x5b3b('0xb')](_0x5b3b('0xc'),attributes,{'tableName':_0x5b3b('0xd'),'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 f144d32..7c28bc5 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 _0xa650=['request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x4294c0,_0x19dab2){var _0x488559=function(_0x1dda90){while(--_0x1dda90){_0x4294c0['push'](_0x4294c0['shift']());}};_0x488559(++_0x19dab2);}(_0xa650,0x117));var _0x0a65=function(_0x5003a9,_0x450f86){_0x5003a9=_0x5003a9-0x0;var _0x567049=_0xa650[_0x5003a9];return _0x567049;};'use strict';var _=require(_0x0a65('0x0'));var util=require(_0x0a65('0x1'));var moment=require(_0x0a65('0x2'));var BPromise=require(_0x0a65('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a65('0x4'));var db=require(_0x0a65('0x5'))['db'];var utils=require(_0x0a65('0x6'));var logger=require(_0x0a65('0x7'))(_0x0a65('0x8'));var config=require(_0x0a65('0x9'));var jayson=require(_0x0a65('0xa'));var client=jayson['client'][_0x0a65('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bc783,_0x1cbacd,_0x5794b7){return new BPromise(function(_0x56c8f0,_0x5bb032){return client[_0x0a65('0xc')](_0x3bc783,_0x5794b7)['then'](function(_0x33269e){logger[_0x0a65('0xd')](_0x0a65('0xe'),_0x1cbacd,_0x0a65('0xf'));logger[_0x0a65('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1cbacd,_0x0a65('0xf'),JSON['stringify'](_0x33269e));if(_0x33269e[_0x0a65('0x11')]){if(_0x33269e[_0x0a65('0x11')][_0x0a65('0x12')]===0x1f4){logger['error'](_0x0a65('0xe'),_0x1cbacd,_0x33269e[_0x0a65('0x11')][_0x0a65('0x13')]);return _0x5bb032(_0x33269e[_0x0a65('0x11')][_0x0a65('0x13')]);}logger[_0x0a65('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1cbacd,_0x33269e['error'][_0x0a65('0x13')]);return _0x56c8f0(_0x33269e[_0x0a65('0x11')][_0x0a65('0x13')]);}else{logger[_0x0a65('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1cbacd,_0x0a65('0xf'));_0x56c8f0(_0x33269e[_0x0a65('0x14')][_0x0a65('0x13')]);}})['catch'](function(_0x254a17){logger[_0x0a65('0x11')](_0x0a65('0xe'),_0x1cbacd,_0x254a17);_0x5bb032(_0x254a17);});});} \ No newline at end of file +var _0x6245=['error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6245,0x83));var _0x5624=function(_0x343090,_0x433a80){_0x343090=_0x343090-0x0;var _0x3ff3e8=_0x6245[_0x343090];return _0x3ff3e8;};'use strict';var _=require(_0x5624('0x0'));var util=require(_0x5624('0x1'));var moment=require('moment');var BPromise=require(_0x5624('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5624('0x3'));var db=require(_0x5624('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5624('0x5'))(_0x5624('0x6'));var config=require(_0x5624('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5624('0x8')][_0x5624('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3475fa,_0x2ad3af,_0x53d367){return new BPromise(function(_0x20bc93,_0x26f9e8){return client[_0x5624('0xa')](_0x3475fa,_0x53d367)['then'](function(_0x22566a){logger[_0x5624('0xb')](_0x5624('0xc'),_0x2ad3af,_0x5624('0xd'));logger[_0x5624('0xe')](_0x5624('0xf'),_0x2ad3af,_0x5624('0xd'),JSON['stringify'](_0x22566a));if(_0x22566a[_0x5624('0x10')]){if(_0x22566a['error'][_0x5624('0x11')]===0x1f4){logger[_0x5624('0x10')](_0x5624('0xc'),_0x2ad3af,_0x22566a['error']['message']);return _0x26f9e8(_0x22566a[_0x5624('0x10')][_0x5624('0x12')]);}logger[_0x5624('0x10')](_0x5624('0xc'),_0x2ad3af,_0x22566a[_0x5624('0x10')][_0x5624('0x12')]);return _0x20bc93(_0x22566a[_0x5624('0x10')][_0x5624('0x12')]);}else{logger[_0x5624('0xb')](_0x5624('0xc'),_0x2ad3af,_0x5624('0xd'));_0x20bc93(_0x22566a[_0x5624('0x13')][_0x5624('0x12')]);}})[_0x5624('0x14')](function(_0x49f202){logger[_0x5624('0x10')](_0x5624('0xc'),_0x2ad3af,_0x49f202);_0x26f9e8(_0x49f202);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 6f711d4..1e753af 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 _0x477a=['create','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x386f48,_0x5a23e9){var _0x2a5fad=function(_0x5a84ab){while(--_0x5a84ab){_0x386f48['push'](_0x386f48['shift']());}};_0x2a5fad(++_0x5a23e9);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa477('0x0'));var util=require('util');var path=require(_0xa477('0x1'));var timeout=require(_0xa477('0x2'));var express=require('express');var router=express[_0xa477('0x3')]();var fs_extra=require(_0xa477('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa477('0x5'));var controller=require(_0xa477('0x6'));router['get']('/',auth[_0xa477('0x7')](),controller[_0xa477('0x8')]);router[_0xa477('0x9')](_0xa477('0xa'),auth[_0xa477('0x7')](),controller[_0xa477('0xb')]);router[_0xa477('0xc')]('/',auth[_0xa477('0x7')](),controller[_0xa477('0xd')]);router['put'](_0xa477('0xa'),auth[_0xa477('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa477('0xe')]=router; \ No newline at end of file +var _0xab55=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0xab55,0x139));var _0x5ab5=function(_0x71de52,_0x3f071c){_0x71de52=_0x71de52-0x0;var _0x5e71f0=_0xab55[_0x71de52];return _0x5e71f0;};'use strict';var multer=require(_0x5ab5('0x0'));var util=require(_0x5ab5('0x1'));var path=require(_0x5ab5('0x2'));var timeout=require(_0x5ab5('0x3'));var express=require('express');var router=express[_0x5ab5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5ab5('0x5'));var interaction=require(_0x5ab5('0x6'));var config=require(_0x5ab5('0x7'));var controller=require(_0x5ab5('0x8'));router[_0x5ab5('0x9')]('/',auth[_0x5ab5('0xa')](),controller[_0x5ab5('0xb')]);router[_0x5ab5('0x9')](_0x5ab5('0xc'),auth[_0x5ab5('0xa')](),controller[_0x5ab5('0xd')]);router[_0x5ab5('0xe')]('/',auth[_0x5ab5('0xa')](),controller[_0x5ab5('0xf')]);router[_0x5ab5('0x10')](_0x5ab5('0xc'),auth['isAuthenticated'](),controller[_0x5ab5('0x11')]);router[_0x5ab5('0x12')]('/:id',auth[_0x5ab5('0xa')](),controller[_0x5ab5('0x13')]);module[_0x5ab5('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index b2764cd..d37528e 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 _0x6334=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x32d414,_0x4d23da){var _0x4e0bca=function(_0x15d397){while(--_0x15d397){_0x32d414['push'](_0x32d414['shift']());}};_0x4e0bca(++_0x4d23da);}(_0x6334,0x119));var _0x4633=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0x6334[_0x10f68e];return _0x4c8372;};'use strict';var Sequelize=require(_0x4633('0x0'));module[_0x4633('0x1')]={'type':{'type':Sequelize[_0x4633('0x2')](_0x4633('0x3'),_0x4633('0x4'),_0x4633('0x5'),'keyValue',_0x4633('0x6')),'defaultValue':_0x4633('0x3')},'content':{'type':Sequelize[_0x4633('0x7')]},'key':{'type':Sequelize[_0x4633('0x7')]},'keyType':{'type':Sequelize[_0x4633('0x2')](_0x4633('0x3'),_0x4633('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x4633('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4633('0x7')]},'customField':{'type':Sequelize[_0x4633('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdbf5=['exports','variable','customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN'];(function(_0xaa4f3,_0x37be20){var _0x163cc9=function(_0x4fa98c){while(--_0x4fa98c){_0xaa4f3['push'](_0xaa4f3['shift']());}};_0x163cc9(++_0x37be20);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1c87d9,_0x4446c9){_0x1c87d9=_0x1c87d9-0x0;var _0x3adcce=_0xdbf5[_0x1c87d9];return _0x3adcce;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x5dbf('0x1'),_0x5dbf('0x2'),_0x5dbf('0x3'),_0x5dbf('0x4')),'defaultValue':_0x5dbf('0x5')},'content':{'type':Sequelize[_0x5dbf('0x6')]},'key':{'type':Sequelize[_0x5dbf('0x6')]},'keyType':{'type':Sequelize[_0x5dbf('0x7')](_0x5dbf('0x5'),_0x5dbf('0x1'),_0x5dbf('0x2'))},'keyContent':{'type':Sequelize[_0x5dbf('0x6')]},'idField':{'type':Sequelize[_0x5dbf('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5dbf('0x8')],'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 b2f40a0..61b3f05 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 _0x08b8=['save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Dynamics365Field','includeAll','findAll','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','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','sendStatus','status','count','offset','limit','set','apply','reject'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x08b8,0x150));var _0x808b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x08b8[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x808b('0x0'));var emlformat=require(_0x808b('0x1'));var rimraf=require(_0x808b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x808b('0x3'));var rp=require(_0x808b('0x4'));var moment=require(_0x808b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x808b('0x6'));var util=require(_0x808b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x808b('0x8'));var ejs=require(_0x808b('0x9'));var fs=require('fs');var fs_extra=require(_0x808b('0xa'));var _=require('lodash');var squel=require(_0x808b('0xb'));var crypto=require(_0x808b('0xc'));var jsforce=require(_0x808b('0xd'));var deskjs=require(_0x808b('0xe'));var toCsv=require(_0x808b('0x8'));var querystring=require(_0x808b('0xf'));var Papa=require(_0x808b('0x10'));var Redis=require(_0x808b('0x11'));var authService=require(_0x808b('0x12'));var qs=require(_0x808b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x808b('0x14'));var logger=require(_0x808b('0x15'))(_0x808b('0x16'));var utils=require(_0x808b('0x17'));var config=require(_0x808b('0x18'));var licenseUtil=require(_0x808b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f595f,_0x447fe0){_0x447fe0=_0x447fe0||0xcc;return function(_0x2da52a){if(_0x2da52a){return _0x2f595f[_0x808b('0x1a')](_0x447fe0);}return _0x2f595f['status'](_0x447fe0)['end']();};}function respondWithResult(_0x4d4e98,_0x49d2e9){_0x49d2e9=_0x49d2e9||0xc8;return function(_0x508c97){if(_0x508c97){return _0x4d4e98[_0x808b('0x1b')](_0x49d2e9)['json'](_0x508c97);}};}function respondWithFilteredResult(_0x5d2751,_0x57bf70){return function(_0x433132){if(_0x433132){var _0x1458d5=_0x433132[_0x808b('0x1c')],_0x54d732=_0x57bf70[_0x808b('0x1d')],_0x26c414=_0x57bf70[_0x808b('0x1d')]+_0x57bf70[_0x808b('0x1e')],_0x13398c;if(_0x26c414>=_0x1458d5){_0x26c414=_0x1458d5;_0x13398c=0xc8;}else{_0x13398c=0xce;}_0x5d2751[_0x808b('0x1b')](_0x13398c);return _0x5d2751[_0x808b('0x1f')]('Content-Range',_0x54d732+'-'+_0x26c414+'/'+_0x1458d5)['json'](_0x433132);}return null;};}function patchUpdates(_0x45cbc8){return function(_0x523784){try{jsonpatch[_0x808b('0x20')](_0x523784,_0x45cbc8,!![]);}catch(_0x56962e){return BPromise[_0x808b('0x21')](_0x56962e);}return _0x523784[_0x808b('0x22')]();};}function saveUpdates(_0x544bd9,_0x22e3a0){return function(_0x1d2c6b){if(_0x1d2c6b){return _0x1d2c6b[_0x808b('0x23')](_0x544bd9)[_0x808b('0x24')](function(_0x278159){return _0x278159;});}return null;};}function removeEntity(_0x3eb514,_0x537cf9){return function(_0x4c396c){if(_0x4c396c){return _0x4c396c[_0x808b('0x25')]()[_0x808b('0x24')](function(){_0x3eb514[_0x808b('0x1b')](0xcc)[_0x808b('0x26')]();});}};}function handleEntityNotFound(_0x2b88e9,_0x1fa3da){return function(_0x553aec){if(!_0x553aec){_0x2b88e9[_0x808b('0x1a')](0x194);}return _0x553aec;};}function handleError(_0x1ed487,_0x4f2958){_0x4f2958=_0x4f2958||0x1f4;return function(_0x33e8f1){logger[_0x808b('0x27')](_0x33e8f1[_0x808b('0x28')]);if(_0x33e8f1[_0x808b('0x29')]){delete _0x33e8f1['name'];}_0x1ed487[_0x808b('0x1b')](_0x4f2958)[_0x808b('0x2a')](_0x33e8f1);};}exports['index']=function(_0x450e1f,_0x403d92){var _0x45560e={},_0x3a55fa={},_0x46d951={'count':0x0,'rows':[]};var _0x5a4648=_[_0x808b('0x2b')](db['Dynamics365Field'][_0x808b('0x2c')],function(_0x5ec3a2){return{'name':_0x5ec3a2[_0x808b('0x2d')],'type':_0x5ec3a2[_0x808b('0x2e')][_0x808b('0x2f')]};});_0x3a55fa[_0x808b('0x30')]=_[_0x808b('0x2b')](_0x5a4648,_0x808b('0x29'));_0x3a55fa[_0x808b('0x31')]=_[_0x808b('0x32')](_0x450e1f[_0x808b('0x31')]);_0x3a55fa[_0x808b('0x33')]=_[_0x808b('0x34')](_0x3a55fa[_0x808b('0x30')],_0x3a55fa[_0x808b('0x31')]);_0x45560e[_0x808b('0x35')]=_[_0x808b('0x34')](_0x3a55fa[_0x808b('0x30')],qs[_0x808b('0x36')](_0x450e1f[_0x808b('0x31')]['fields']));_0x45560e[_0x808b('0x35')]=_0x45560e[_0x808b('0x35')][_0x808b('0x37')]?_0x45560e['attributes']:_0x3a55fa[_0x808b('0x30')];if(!_0x450e1f['query'][_0x808b('0x38')](_0x808b('0x39'))){_0x45560e[_0x808b('0x1e')]=qs['limit'](_0x450e1f['query']['limit']);_0x45560e[_0x808b('0x1d')]=qs[_0x808b('0x1d')](_0x450e1f[_0x808b('0x31')][_0x808b('0x1d')]);}_0x45560e[_0x808b('0x3a')]=qs['sort'](_0x450e1f[_0x808b('0x31')][_0x808b('0x3b')]);_0x45560e[_0x808b('0x3c')]=qs['filters'](_[_0x808b('0x3d')](_0x450e1f[_0x808b('0x31')],_0x3a55fa[_0x808b('0x33')]),_0x5a4648);if(_0x450e1f[_0x808b('0x31')][_0x808b('0x3e')]){_0x45560e['where']=_['merge'](_0x45560e['where'],{'$or':_[_0x808b('0x2b')](_0x5a4648,function(_0x4fd2a3){if(_0x4fd2a3[_0x808b('0x2e')]!=='VIRTUAL'){var _0x1b093c={};_0x1b093c[_0x4fd2a3['name']]={'$like':'%'+_0x450e1f[_0x808b('0x31')][_0x808b('0x3e')]+'%'};return _0x1b093c;}})});}_0x45560e=_[_0x808b('0x3f')]({},_0x45560e,_0x450e1f[_0x808b('0x40')]);var _0x5b8a6a={'where':_0x45560e[_0x808b('0x3c')]};return db[_0x808b('0x41')]['count'](_0x5b8a6a)[_0x808b('0x24')](function(_0x250d9a){_0x46d951[_0x808b('0x1c')]=_0x250d9a;if(_0x450e1f[_0x808b('0x31')][_0x808b('0x42')]){_0x45560e['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x808b('0x43')](_0x45560e);})[_0x808b('0x24')](function(_0x28f223){_0x46d951['rows']=_0x28f223;return _0x46d951;})[_0x808b('0x24')](respondWithFilteredResult(_0x403d92,_0x45560e))[_0x808b('0x44')](handleError(_0x403d92,null));};exports[_0x808b('0x45')]=function(_0x5c0eda,_0x2f8f71){var _0x2166ab={'raw':!![],'where':{'id':_0x5c0eda[_0x808b('0x46')]['id']}},_0xe1ba8a={};_0xe1ba8a[_0x808b('0x30')]=_['keys'](db['Dynamics365Field'][_0x808b('0x2c')]);_0xe1ba8a[_0x808b('0x31')]=_[_0x808b('0x32')](_0x5c0eda[_0x808b('0x31')]);_0xe1ba8a[_0x808b('0x33')]=_[_0x808b('0x34')](_0xe1ba8a['model'],_0xe1ba8a[_0x808b('0x31')]);_0x2166ab[_0x808b('0x35')]=_[_0x808b('0x34')](_0xe1ba8a[_0x808b('0x30')],qs[_0x808b('0x36')](_0x5c0eda[_0x808b('0x31')][_0x808b('0x36')]));_0x2166ab[_0x808b('0x35')]=_0x2166ab[_0x808b('0x35')][_0x808b('0x37')]?_0x2166ab[_0x808b('0x35')]:_0xe1ba8a[_0x808b('0x30')];if(_0x5c0eda[_0x808b('0x31')][_0x808b('0x42')]){_0x2166ab['include']=[{'all':!![]}];}_0x2166ab=_[_0x808b('0x3f')]({},_0x2166ab,_0x5c0eda['options']);return db[_0x808b('0x41')][_0x808b('0x47')](_0x2166ab)[_0x808b('0x24')](handleEntityNotFound(_0x2f8f71,null))[_0x808b('0x24')](respondWithResult(_0x2f8f71,null))['catch'](handleError(_0x2f8f71,null));};exports[_0x808b('0x48')]=function(_0x153dcf,_0x481a60){return db[_0x808b('0x41')]['create'](_0x153dcf[_0x808b('0x49')],{})[_0x808b('0x24')](respondWithResult(_0x481a60,0xc9))[_0x808b('0x44')](handleError(_0x481a60,null));};exports[_0x808b('0x23')]=function(_0x35ae74,_0xf5d0e7){if(_0x35ae74['body']['id']){delete _0x35ae74['body']['id'];}return db[_0x808b('0x41')]['find']({'where':{'id':_0x35ae74['params']['id']}})[_0x808b('0x24')](handleEntityNotFound(_0xf5d0e7,null))[_0x808b('0x24')](saveUpdates(_0x35ae74['body'],null))[_0x808b('0x24')](respondWithResult(_0xf5d0e7,null))[_0x808b('0x44')](handleError(_0xf5d0e7,null));};exports['destroy']=function(_0x142ae4,_0x190150){return db[_0x808b('0x41')][_0x808b('0x47')]({'where':{'id':_0x142ae4['params']['id']}})['then'](handleEntityNotFound(_0x190150,null))['then'](removeEntity(_0x190150,null))[_0x808b('0x44')](handleError(_0x190150,null));}; \ No newline at end of file +var _0xd7bf=['Dynamics365Field','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map'];(function(_0x482b74,_0x4ff641){var _0x3c478f=function(_0x5ba3cd){while(--_0x5ba3cd){_0x482b74['push'](_0x482b74['shift']());}};_0x3c478f(++_0x4ff641);}(_0xd7bf,0x6f));var _0xfd7b=function(_0x5e6ad3,_0x15fc2a){_0x5e6ad3=_0x5e6ad3-0x0;var _0x4b86bd=_0xd7bf[_0x5e6ad3];return _0x4b86bd;};'use strict';var pdf=require(_0xfd7b('0x0'));var emlformat=require(_0xfd7b('0x1'));var rimraf=require(_0xfd7b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd7b('0x3'));var rp=require(_0xfd7b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfd7b('0x5'));var util=require(_0xfd7b('0x6'));var path=require(_0xfd7b('0x7'));var sox=require(_0xfd7b('0x8'));var csv=require(_0xfd7b('0x9'));var ejs=require(_0xfd7b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd7b('0xb'));var squel=require(_0xfd7b('0xc'));var crypto=require(_0xfd7b('0xd'));var jsforce=require(_0xfd7b('0xe'));var deskjs=require(_0xfd7b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfd7b('0x10'));var Redis=require(_0xfd7b('0x11'));var authService=require(_0xfd7b('0x12'));var qs=require(_0xfd7b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd7b('0x14'));var logger=require(_0xfd7b('0x15'))(_0xfd7b('0x16'));var utils=require(_0xfd7b('0x17'));var config=require(_0xfd7b('0x18'));var licenseUtil=require(_0xfd7b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e9ace,_0x263963){_0x263963=_0x263963||0xcc;return function(_0x2a708d){if(_0x2a708d){return _0x5e9ace[_0xfd7b('0x1a')](_0x263963);}return _0x5e9ace[_0xfd7b('0x1b')](_0x263963)[_0xfd7b('0x1c')]();};}function respondWithResult(_0x2f40ec,_0x123f6f){_0x123f6f=_0x123f6f||0xc8;return function(_0x542836){if(_0x542836){return _0x2f40ec[_0xfd7b('0x1b')](_0x123f6f)['json'](_0x542836);}};}function respondWithFilteredResult(_0x5f21ca,_0x418849){return function(_0x52c74f){if(_0x52c74f){var _0x134e12=_0x52c74f[_0xfd7b('0x1d')],_0x3902dc=_0x418849[_0xfd7b('0x1e')],_0x44d810=_0x418849[_0xfd7b('0x1e')]+_0x418849[_0xfd7b('0x1f')],_0x3160df;if(_0x44d810>=_0x134e12){_0x44d810=_0x134e12;_0x3160df=0xc8;}else{_0x3160df=0xce;}_0x5f21ca[_0xfd7b('0x1b')](_0x3160df);return _0x5f21ca[_0xfd7b('0x20')](_0xfd7b('0x21'),_0x3902dc+'-'+_0x44d810+'/'+_0x134e12)[_0xfd7b('0x22')](_0x52c74f);}return null;};}function patchUpdates(_0x1603b8){return function(_0x163348){try{jsonpatch[_0xfd7b('0x23')](_0x163348,_0x1603b8,!![]);}catch(_0x6166a7){return BPromise[_0xfd7b('0x24')](_0x6166a7);}return _0x163348[_0xfd7b('0x25')]();};}function saveUpdates(_0x2c9cdc,_0x2c5ea1){return function(_0x53154a){if(_0x53154a){return _0x53154a['update'](_0x2c9cdc)[_0xfd7b('0x26')](function(_0x494fd9){return _0x494fd9;});}return null;};}function removeEntity(_0x10ae04,_0x2e2723){return function(_0x369df5){if(_0x369df5){return _0x369df5['destroy']()[_0xfd7b('0x26')](function(){_0x10ae04['status'](0xcc)[_0xfd7b('0x1c')]();});}};}function handleEntityNotFound(_0x21dc4c,_0x41a5a0){return function(_0xbf0472){if(!_0xbf0472){_0x21dc4c[_0xfd7b('0x1a')](0x194);}return _0xbf0472;};}function handleError(_0x2e6f45,_0x43c815){_0x43c815=_0x43c815||0x1f4;return function(_0x53454d){logger[_0xfd7b('0x27')](_0x53454d[_0xfd7b('0x28')]);if(_0x53454d[_0xfd7b('0x29')]){delete _0x53454d[_0xfd7b('0x29')];}_0x2e6f45[_0xfd7b('0x1b')](_0x43c815)[_0xfd7b('0x2a')](_0x53454d);};}exports[_0xfd7b('0x2b')]=function(_0x2ab837,_0x277cfa){var _0x398f11={},_0x3d9580={},_0x49aad9={'count':0x0,'rows':[]};var _0x3f894d=_[_0xfd7b('0x2c')](db[_0xfd7b('0x2d')][_0xfd7b('0x2e')],function(_0x49fc9a){return{'name':_0x49fc9a[_0xfd7b('0x2f')],'type':_0x49fc9a[_0xfd7b('0x30')]['key']};});_0x3d9580['model']=_['map'](_0x3f894d,_0xfd7b('0x29'));_0x3d9580[_0xfd7b('0x31')]=_['keys'](_0x2ab837['query']);_0x3d9580[_0xfd7b('0x32')]=_[_0xfd7b('0x33')](_0x3d9580[_0xfd7b('0x34')],_0x3d9580['query']);_0x398f11[_0xfd7b('0x35')]=_[_0xfd7b('0x33')](_0x3d9580[_0xfd7b('0x34')],qs['fields'](_0x2ab837['query'][_0xfd7b('0x36')]));_0x398f11['attributes']=_0x398f11[_0xfd7b('0x35')]['length']?_0x398f11[_0xfd7b('0x35')]:_0x3d9580[_0xfd7b('0x34')];if(!_0x2ab837[_0xfd7b('0x31')][_0xfd7b('0x37')](_0xfd7b('0x38'))){_0x398f11[_0xfd7b('0x1f')]=qs[_0xfd7b('0x1f')](_0x2ab837[_0xfd7b('0x31')][_0xfd7b('0x1f')]);_0x398f11[_0xfd7b('0x1e')]=qs[_0xfd7b('0x1e')](_0x2ab837[_0xfd7b('0x31')][_0xfd7b('0x1e')]);}_0x398f11[_0xfd7b('0x39')]=qs['sort'](_0x2ab837[_0xfd7b('0x31')][_0xfd7b('0x3a')]);_0x398f11['where']=qs['filters'](_[_0xfd7b('0x3b')](_0x2ab837[_0xfd7b('0x31')],_0x3d9580[_0xfd7b('0x32')]),_0x3f894d);if(_0x2ab837[_0xfd7b('0x31')][_0xfd7b('0x3c')]){_0x398f11[_0xfd7b('0x3d')]=_[_0xfd7b('0x3e')](_0x398f11[_0xfd7b('0x3d')],{'$or':_[_0xfd7b('0x2c')](_0x3f894d,function(_0x230186){if(_0x230186[_0xfd7b('0x30')]!==_0xfd7b('0x3f')){var _0x51c746={};_0x51c746[_0x230186[_0xfd7b('0x29')]]={'$like':'%'+_0x2ab837['query']['filter']+'%'};return _0x51c746;}})});}_0x398f11=_[_0xfd7b('0x3e')]({},_0x398f11,_0x2ab837[_0xfd7b('0x40')]);var _0x24e328={'where':_0x398f11['where']};return db[_0xfd7b('0x2d')][_0xfd7b('0x1d')](_0x24e328)[_0xfd7b('0x26')](function(_0x1e61ca){_0x49aad9[_0xfd7b('0x1d')]=_0x1e61ca;if(_0x2ab837[_0xfd7b('0x31')][_0xfd7b('0x41')]){_0x398f11[_0xfd7b('0x42')]=[{'all':!![]}];}return db[_0xfd7b('0x2d')][_0xfd7b('0x43')](_0x398f11);})[_0xfd7b('0x26')](function(_0x251e54){_0x49aad9[_0xfd7b('0x44')]=_0x251e54;return _0x49aad9;})[_0xfd7b('0x26')](respondWithFilteredResult(_0x277cfa,_0x398f11))[_0xfd7b('0x45')](handleError(_0x277cfa,null));};exports[_0xfd7b('0x46')]=function(_0x4385db,_0xd887ac){var _0x39fbb7={'raw':!![],'where':{'id':_0x4385db[_0xfd7b('0x47')]['id']}},_0x40ec4b={};_0x40ec4b[_0xfd7b('0x34')]=_[_0xfd7b('0x48')](db[_0xfd7b('0x2d')][_0xfd7b('0x2e')]);_0x40ec4b[_0xfd7b('0x31')]=_[_0xfd7b('0x48')](_0x4385db[_0xfd7b('0x31')]);_0x40ec4b[_0xfd7b('0x32')]=_[_0xfd7b('0x33')](_0x40ec4b[_0xfd7b('0x34')],_0x40ec4b['query']);_0x39fbb7[_0xfd7b('0x35')]=_[_0xfd7b('0x33')](_0x40ec4b['model'],qs[_0xfd7b('0x36')](_0x4385db[_0xfd7b('0x31')][_0xfd7b('0x36')]));_0x39fbb7['attributes']=_0x39fbb7[_0xfd7b('0x35')][_0xfd7b('0x49')]?_0x39fbb7[_0xfd7b('0x35')]:_0x40ec4b['model'];if(_0x4385db[_0xfd7b('0x31')]['includeAll']){_0x39fbb7['include']=[{'all':!![]}];}_0x39fbb7=_[_0xfd7b('0x3e')]({},_0x39fbb7,_0x4385db[_0xfd7b('0x40')]);return db[_0xfd7b('0x2d')][_0xfd7b('0x4a')](_0x39fbb7)[_0xfd7b('0x26')](handleEntityNotFound(_0xd887ac,null))[_0xfd7b('0x26')](respondWithResult(_0xd887ac,null))[_0xfd7b('0x45')](handleError(_0xd887ac,null));};exports['create']=function(_0x1c86a0,_0x5d4fcb){return db[_0xfd7b('0x2d')][_0xfd7b('0x4b')](_0x1c86a0[_0xfd7b('0x4c')],{})[_0xfd7b('0x26')](respondWithResult(_0x5d4fcb,0xc9))[_0xfd7b('0x45')](handleError(_0x5d4fcb,null));};exports[_0xfd7b('0x4d')]=function(_0x2cd23c,_0x191fe7){if(_0x2cd23c[_0xfd7b('0x4c')]['id']){delete _0x2cd23c[_0xfd7b('0x4c')]['id'];}return db['Dynamics365Field'][_0xfd7b('0x4a')]({'where':{'id':_0x2cd23c[_0xfd7b('0x47')]['id']}})[_0xfd7b('0x26')](handleEntityNotFound(_0x191fe7,null))[_0xfd7b('0x26')](saveUpdates(_0x2cd23c[_0xfd7b('0x4c')],null))['then'](respondWithResult(_0x191fe7,null))['catch'](handleError(_0x191fe7,null));};exports['destroy']=function(_0x54c812,_0x18fac5){return db[_0xfd7b('0x2d')][_0xfd7b('0x4a')]({'where':{'id':_0x54c812['params']['id']}})['then'](handleEntityNotFound(_0x18fac5,null))[_0xfd7b('0x26')](removeEntity(_0x18fac5,null))[_0xfd7b('0x45')](handleError(_0x18fac5,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index fc01075..483eb7e 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 _0x4485=['util','../../config/logger','api','moment','bluebird','path','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash'];(function(_0x242a24,_0x42fa1c){var _0x516d91=function(_0xb53ffc){while(--_0xb53ffc){_0x242a24['push'](_0x242a24['shift']());}};_0x516d91(++_0x42fa1c);}(_0x4485,0x1e9));var _0x5448=function(_0x3bb859,_0x589816){_0x3bb859=_0x3bb859-0x0;var _0x3bf534=_0x4485[_0x3bb859];return _0x3bf534;};'use strict';var _=require(_0x5448('0x0'));var util=require(_0x5448('0x1'));var logger=require(_0x5448('0x2'))(_0x5448('0x3'));var moment=require(_0x5448('0x4'));var BPromise=require(_0x5448('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5448('0x6'));var rimraf=require(_0x5448('0x7'));var config=require('../../config/environment');var attributes=require(_0x5448('0x8'));module[_0x5448('0x9')]=function(_0x28970a,_0x170119){return _0x28970a['define'](_0x5448('0xa'),attributes,{'tableName':_0x5448('0xb'),'paranoid':![],'indexes':[{'name':_0x5448('0xc'),'fields':['idField',_0x5448('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1966=['api','moment','bluebird','request-promise','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash'];(function(_0x4bdff2,_0x261485){var _0x7254dd=function(_0x590be1){while(--_0x590be1){_0x4bdff2['push'](_0x4bdff2['shift']());}};_0x7254dd(++_0x261485);}(_0x1966,0x1af));var _0x6196=function(_0x3d7060,_0xf0c1fd){_0x3d7060=_0x3d7060-0x0;var _0xf4e5d2=_0x1966[_0x3d7060];return _0xf4e5d2;};'use strict';var _=require(_0x6196('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6196('0x1'));var moment=require(_0x6196('0x2'));var BPromise=require(_0x6196('0x3'));var rp=require(_0x6196('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6196('0x5'));var attributes=require(_0x6196('0x6'));module['exports']=function(_0x47178f,_0x3d806a){return _0x47178f[_0x6196('0x7')](_0x6196('0x8'),attributes,{'tableName':_0x6196('0x9'),'paranoid':![],'indexes':[{'name':_0x6196('0xa'),'fields':[_0x6196('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 9119a86..cfaf36b 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 _0x2d72=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','code','Dynamics365Field,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x57a400,_0x499033){var _0x5ae512=function(_0x16e01d){while(--_0x16e01d){_0x57a400['push'](_0x57a400['shift']());}};_0x5ae512(++_0x499033);}(_0x2d72,0xa8));var _0x22d7=function(_0x3a9bda,_0x3eb9be){_0x3a9bda=_0x3a9bda-0x0;var _0x36e1ce=_0x2d72[_0x3a9bda];return _0x36e1ce;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var moment=require(_0x22d7('0x2'));var BPromise=require(_0x22d7('0x3'));var rs=require(_0x22d7('0x4'));var fs=require('fs');var Redis=require(_0x22d7('0x5'));var db=require(_0x22d7('0x6'))['db'];var utils=require(_0x22d7('0x7'));var logger=require(_0x22d7('0x8'))(_0x22d7('0x9'));var config=require(_0x22d7('0xa'));var jayson=require(_0x22d7('0xb'));var client=jayson[_0x22d7('0xc')][_0x22d7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x52a3e3,_0x23a731,_0x3791d6){return new BPromise(function(_0x492ca8,_0x3b12cd){return client[_0x22d7('0xe')](_0x52a3e3,_0x3791d6)[_0x22d7('0xf')](function(_0x3c694f){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x23a731,_0x22d7('0x10'));logger[_0x22d7('0x11')](_0x22d7('0x12'),_0x23a731,_0x22d7('0x10'),JSON[_0x22d7('0x13')](_0x3c694f));if(_0x3c694f['error']){if(_0x3c694f['error'][_0x22d7('0x14')]===0x1f4){logger['error'](_0x22d7('0x15'),_0x23a731,_0x3c694f[_0x22d7('0x16')]['message']);return _0x3b12cd(_0x3c694f[_0x22d7('0x16')][_0x22d7('0x17')]);}logger[_0x22d7('0x16')](_0x22d7('0x15'),_0x23a731,_0x3c694f[_0x22d7('0x16')][_0x22d7('0x17')]);return _0x492ca8(_0x3c694f[_0x22d7('0x16')][_0x22d7('0x17')]);}else{logger['info'](_0x22d7('0x15'),_0x23a731,_0x22d7('0x10'));_0x492ca8(_0x3c694f[_0x22d7('0x18')]['message']);}})['catch'](function(_0x52b21c){logger[_0x22d7('0x16')](_0x22d7('0x15'),_0x23a731,_0x52b21c);_0x3b12cd(_0x52b21c);});});} \ No newline at end of file +var _0x71ab=['http','request','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Field,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3cb0d5,_0x44ef95){var _0x1e3265=function(_0x384792){while(--_0x384792){_0x3cb0d5['push'](_0x3cb0d5['shift']());}};_0x1e3265(++_0x44ef95);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a84e,_0x4358ce,_0x2a4c86){return new BPromise(function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xb')](_0x35a84e,_0x2a4c86)[_0xb71a('0xc')](function(_0x378c96){logger[_0xb71a('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x4358ce,_0xb71a('0xe'));logger['debug'](_0xb71a('0xf'),_0x4358ce,_0xb71a('0xe'),JSON[_0xb71a('0x10')](_0x378c96));if(_0x378c96['error']){if(_0x378c96[_0xb71a('0x11')]['code']===0x1f4){logger[_0xb71a('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x4358ce,_0x378c96['error'][_0xb71a('0x12')]);return _0x471ab6(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}logger[_0xb71a('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x4358ce,_0x378c96['error']['message']);return _0x43ca14(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}else{logger[_0xb71a('0xd')](_0xb71a('0x13'),_0x4358ce,_0xb71a('0xe'));_0x43ca14(_0x378c96[_0xb71a('0x14')][_0xb71a('0x12')]);}})[_0xb71a('0x15')](function(_0x7710a8){logger['error'](_0xb71a('0x13'),_0x4358ce,_0x7710a8);_0x471ab6(_0x7710a8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 30dca07..b5780c8 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 _0x2a35=['/:id','update','delete','destroy','exports','multer','Router','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x56b2f6,_0x3f87fd){var _0x31b484=function(_0x3f1136){while(--_0x3f1136){_0x56b2f6['push'](_0x56b2f6['shift']());}};_0x31b484(++_0x3f87fd);}(_0x2a35,0x16d));var _0x52a3=function(_0x594c47,_0x27c0c3){_0x594c47=_0x594c47-0x0;var _0x44c9fd=_0x2a35[_0x594c47];return _0x44c9fd;};'use strict';var multer=require(_0x52a3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x52a3('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x52a3('0x2'));var config=require('../../config/environment');var controller=require(_0x52a3('0x3'));router[_0x52a3('0x4')]('/',auth[_0x52a3('0x5')](),controller[_0x52a3('0x6')]);router[_0x52a3('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x52a3('0x7')]);router[_0x52a3('0x4')](_0x52a3('0x8'),auth['isAuthenticated'](),controller[_0x52a3('0x9')]);router[_0x52a3('0x4')](_0x52a3('0xa'),auth[_0x52a3('0x5')](),controller[_0x52a3('0xb')]);router[_0x52a3('0xc')]('/',auth[_0x52a3('0x5')](),controller['create']);router[_0x52a3('0xc')](_0x52a3('0x8'),auth[_0x52a3('0x5')](),controller['addConfiguration']);router['put'](_0x52a3('0xd'),auth[_0x52a3('0x5')](),controller[_0x52a3('0xe')]);router[_0x52a3('0xf')](_0x52a3('0xd'),auth['isAuthenticated'](),controller[_0x52a3('0x10')]);module[_0x52a3('0x11')]=router; \ No newline at end of file +var _0x884a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util'];(function(_0x4ab2e0,_0x4c98d5){var _0x51243c=function(_0x59dcce){while(--_0x59dcce){_0x4ab2e0['push'](_0x4ab2e0['shift']());}};_0x51243c(++_0x4c98d5);}(_0x884a,0x76));var _0xa884=function(_0x4b8733,_0x3171b3){_0x4b8733=_0x4b8733-0x0;var _0x29b0c3=_0x884a[_0x4b8733];return _0x29b0c3;};'use strict';var multer=require(_0xa884('0x0'));var util=require(_0xa884('0x1'));var path=require('path');var timeout=require(_0xa884('0x2'));var express=require(_0xa884('0x3'));var router=express[_0xa884('0x4')]();var fs_extra=require(_0xa884('0x5'));var auth=require(_0xa884('0x6'));var interaction=require(_0xa884('0x7'));var config=require(_0xa884('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0xa884('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa884('0x9')](_0xa884('0xa'),auth[_0xa884('0xb')](),controller[_0xa884('0xc')]);router['get'](_0xa884('0xd'),auth[_0xa884('0xb')](),controller[_0xa884('0xe')]);router[_0xa884('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xa884('0xf')]);router[_0xa884('0x10')]('/',auth[_0xa884('0xb')](),controller[_0xa884('0x11')]);router[_0xa884('0x10')](_0xa884('0xd'),auth[_0xa884('0xb')](),controller[_0xa884('0x12')]);router[_0xa884('0x13')](_0xa884('0xa'),auth['isAuthenticated'](),controller[_0xa884('0x14')]);router[_0xa884('0x15')]('/:id',auth[_0xa884('0xb')](),controller[_0xa884('0x16')]);module[_0xa884('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 def8d21..473ebae 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 _0x61e4=['remoteUri','sequelize','exports','STRING'];(function(_0x292250,_0x59ef95){var _0x3424f8=function(_0xb4bb9a){while(--_0xb4bb9a){_0x292250['push'](_0x292250['shift']());}};_0x3424f8(++_0x59ef95);}(_0x61e4,0x71));var _0x461e=function(_0x37a902,_0x50579a){_0x37a902=_0x37a902-0x0;var _0x566d4f=_0x61e4[_0x37a902];return _0x566d4f;};'use strict';var Sequelize=require(_0x461e('0x0'));module[_0x461e('0x1')]={'name':{'type':Sequelize[_0x461e('0x2')]},'description':{'type':Sequelize[_0x461e('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x461e('0x2')]},'remoteUri':{'type':Sequelize[_0x461e('0x2')],'unique':_0x461e('0x3')},'serverUrl':{'type':Sequelize[_0x461e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7b9a=['STRING','username','remoteUri','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7b9a,0x1bf));var _0xa7b9=function(_0x315a63,_0x3b94ff){_0x315a63=_0x315a63-0x0;var _0x4bdb58=_0x7b9a[_0x315a63];return _0x4bdb58;};'use strict';var Sequelize=require('sequelize');module[_0xa7b9('0x0')]={'name':{'type':Sequelize[_0xa7b9('0x1')]},'description':{'type':Sequelize[_0xa7b9('0x1')]},'username':{'type':Sequelize[_0xa7b9('0x1')],'unique':_0xa7b9('0x2')},'apiKey':{'type':Sequelize[_0xa7b9('0x1')]},'remoteUri':{'type':Sequelize[_0xa7b9('0x1')],'unique':_0xa7b9('0x3')},'serverUrl':{'type':Sequelize[_0xa7b9('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 8657681..6dae677 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 _0x5e37=['stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','FreshdeskAccount','rawAttributes','type','key','model','map','query','keys','attributes','fields','length','nolimit','order','sort','filters','pick','merge','where','filter','options','count','includeAll','include','show','params','intersection','find','create','body','findOne','FreshdeskConfiguration','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','slice','substring','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','apiKey','toString','base64','requester','agent','group','source','ticket_type','includes','default','custom_dropdown','label','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x53e225,_0x3d944c){var _0x2743e0=function(_0x58a64b){while(--_0x58a64b){_0x53e225['push'](_0x53e225['shift']());}};_0x2743e0(++_0x3d944c);}(_0x5e37,0x146));var _0x75e3=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x5e37[_0x246148];return _0x453d94;};'use strict';var pdf=require(_0x75e3('0x0'));var emlformat=require(_0x75e3('0x1'));var rimraf=require(_0x75e3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x75e3('0x3'));var BPromise=require(_0x75e3('0x4'));var Mustache=require('mustache');var util=require(_0x75e3('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x75e3('0x6'));var ejs=require(_0x75e3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x75e3('0x8'));var crypto=require(_0x75e3('0x9'));var jsforce=require(_0x75e3('0xa'));var deskjs=require(_0x75e3('0xb'));var toCsv=require('to-csv');var querystring=require(_0x75e3('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x75e3('0xd'));var qs=require(_0x75e3('0xe'));var as=require(_0x75e3('0xf'));var hardwareService=require(_0x75e3('0x10'));var logger=require('../../config/logger')(_0x75e3('0x11'));var utils=require(_0x75e3('0x12'));var config=require(_0x75e3('0x13'));var licenseUtil=require(_0x75e3('0x14'));var db=require(_0x75e3('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x75e3('0x16'));var client=jayson['client'][_0x75e3('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x3cf8ca,_0x330fd5,_0x23fdb4,_0x54fbcd){return new BPromise(function(_0x4eb250,_0x1dc710){var _0x1f2263=_0x54fbcd||client;return _0x1f2263[_0x75e3('0x18')](_0x3cf8ca,_0x23fdb4)[_0x75e3('0x19')](function(_0x2d760a){logger[_0x75e3('0x1a')](_0x75e3('0x1b'),_0x330fd5,_0x75e3('0x1c'));logger[_0x75e3('0x1d')](_0x75e3('0x1e'),_0x330fd5,_0x75e3('0x1c'),JSON[_0x75e3('0x1f')](_0x2d760a));if(_0x2d760a[_0x75e3('0x20')]){if(_0x2d760a[_0x75e3('0x20')][_0x75e3('0x21')]===0x1f4){logger['error'](_0x75e3('0x1b'),_0x330fd5,_0x2d760a['error'][_0x75e3('0x22')]);return _0x1dc710(_0x2d760a[_0x75e3('0x20')][_0x75e3('0x22')]);}logger['error'](_0x75e3('0x1b'),_0x330fd5,_0x2d760a[_0x75e3('0x20')][_0x75e3('0x22')]);return _0x4eb250(_0x2d760a[_0x75e3('0x20')][_0x75e3('0x22')]);}else{logger[_0x75e3('0x1a')](_0x75e3('0x1b'),_0x330fd5,_0x75e3('0x1c'));_0x4eb250(_0x2d760a[_0x75e3('0x23')][_0x75e3('0x22')]);}})[_0x75e3('0x24')](function(_0x569672){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x330fd5,_0x569672);_0x1dc710(_0x569672);});});}function respondWithStatusCode(_0x55f0a2,_0x1efff2){_0x1efff2=_0x1efff2||0xcc;return function(_0x1d6a43){if(_0x1d6a43){return _0x55f0a2[_0x75e3('0x25')](_0x1efff2);}return _0x55f0a2[_0x75e3('0x26')](_0x1efff2)['end']();};}function respondWithResult(_0x34077e,_0x55cc96){_0x55cc96=_0x55cc96||0xc8;return function(_0x49239c){if(_0x49239c){return _0x34077e[_0x75e3('0x26')](_0x55cc96)[_0x75e3('0x27')](_0x49239c);}};}function respondWithFilteredResult(_0x12429f,_0x597413){return function(_0x49584b){if(_0x49584b){var _0xb6ed87=_0x49584b['count'],_0x1fa092=_0x597413[_0x75e3('0x28')],_0xac7ee7=_0x597413['offset']+_0x597413[_0x75e3('0x29')],_0x224b38;if(_0xac7ee7>=_0xb6ed87){_0xac7ee7=_0xb6ed87;_0x224b38=0xc8;}else{_0x224b38=0xce;}_0x12429f[_0x75e3('0x26')](_0x224b38);return _0x12429f[_0x75e3('0x2a')](_0x75e3('0x2b'),_0x1fa092+'-'+_0xac7ee7+'/'+_0xb6ed87)[_0x75e3('0x27')](_0x49584b);}return null;};}function patchUpdates(_0x6471ca){return function(_0x49107b){try{jsonpatch[_0x75e3('0x2c')](_0x49107b,_0x6471ca,!![]);}catch(_0x28ee19){return BPromise[_0x75e3('0x2d')](_0x28ee19);}return _0x49107b[_0x75e3('0x2e')]();};}function saveUpdates(_0x2ad74b,_0x581b58){return function(_0x5ba02d){if(_0x5ba02d){return _0x5ba02d[_0x75e3('0x2f')](_0x2ad74b)[_0x75e3('0x19')](function(_0x2bb3e3){return _0x2bb3e3;});}return null;};}function removeEntity(_0x4de93e,_0x55dc5a){return function(_0x59aa07){if(_0x59aa07){return _0x59aa07[_0x75e3('0x30')]()[_0x75e3('0x19')](function(){_0x4de93e[_0x75e3('0x26')](0xcc)[_0x75e3('0x31')]();});}};}function handleEntityNotFound(_0x3e787b,_0x68832b){return function(_0x3442c0){if(!_0x3442c0){_0x3e787b[_0x75e3('0x25')](0x194);}return _0x3442c0;};}function handleError(_0x5b453e,_0x198b72){_0x198b72=_0x198b72||0x1f4;return function(_0x3597c8){logger[_0x75e3('0x20')](_0x3597c8[_0x75e3('0x32')]);if(_0x3597c8[_0x75e3('0x33')]){delete _0x3597c8['name'];}_0x5b453e['status'](_0x198b72)[_0x75e3('0x34')](_0x3597c8);};}exports['index']=function(_0x530bfe,_0x19ac25){var _0x398911={},_0x136c90={},_0x5b1c91={'count':0x0,'rows':[]};var _0x179339=_['map'](db[_0x75e3('0x35')][_0x75e3('0x36')],function(_0x20cf96){return{'name':_0x20cf96['fieldName'],'type':_0x20cf96[_0x75e3('0x37')][_0x75e3('0x38')]};});_0x136c90[_0x75e3('0x39')]=_[_0x75e3('0x3a')](_0x179339,_0x75e3('0x33'));_0x136c90[_0x75e3('0x3b')]=_[_0x75e3('0x3c')](_0x530bfe[_0x75e3('0x3b')]);_0x136c90['filters']=_['intersection'](_0x136c90[_0x75e3('0x39')],_0x136c90[_0x75e3('0x3b')]);_0x398911[_0x75e3('0x3d')]=_['intersection'](_0x136c90['model'],qs['fields'](_0x530bfe[_0x75e3('0x3b')][_0x75e3('0x3e')]));_0x398911[_0x75e3('0x3d')]=_0x398911['attributes'][_0x75e3('0x3f')]?_0x398911[_0x75e3('0x3d')]:_0x136c90[_0x75e3('0x39')];if(!_0x530bfe[_0x75e3('0x3b')]['hasOwnProperty'](_0x75e3('0x40'))){_0x398911[_0x75e3('0x29')]=qs[_0x75e3('0x29')](_0x530bfe[_0x75e3('0x3b')][_0x75e3('0x29')]);_0x398911[_0x75e3('0x28')]=qs[_0x75e3('0x28')](_0x530bfe[_0x75e3('0x3b')][_0x75e3('0x28')]);}_0x398911[_0x75e3('0x41')]=qs[_0x75e3('0x42')](_0x530bfe[_0x75e3('0x3b')][_0x75e3('0x42')]);_0x398911['where']=qs[_0x75e3('0x43')](_[_0x75e3('0x44')](_0x530bfe[_0x75e3('0x3b')],_0x136c90['filters']),_0x179339);if(_0x530bfe[_0x75e3('0x3b')]['filter']){_0x398911['where']=_[_0x75e3('0x45')](_0x398911[_0x75e3('0x46')],{'$or':_['map'](_0x179339,function(_0x4fe955){if(_0x4fe955[_0x75e3('0x37')]!=='VIRTUAL'){var _0x46630f={};_0x46630f[_0x4fe955[_0x75e3('0x33')]]={'$like':'%'+_0x530bfe['query'][_0x75e3('0x47')]+'%'};return _0x46630f;}})});}_0x398911=_[_0x75e3('0x45')]({},_0x398911,_0x530bfe[_0x75e3('0x48')]);var _0x548c09={'where':_0x398911[_0x75e3('0x46')]};return db[_0x75e3('0x35')][_0x75e3('0x49')](_0x548c09)['then'](function(_0x5528fd){_0x5b1c91['count']=_0x5528fd;if(_0x530bfe[_0x75e3('0x3b')][_0x75e3('0x4a')]){_0x398911[_0x75e3('0x4b')]=[{'all':!![]}];}return db[_0x75e3('0x35')]['findAll'](_0x398911);})['then'](function(_0x56a75e){_0x5b1c91['rows']=_0x56a75e;return _0x5b1c91;})[_0x75e3('0x19')](respondWithFilteredResult(_0x19ac25,_0x398911))[_0x75e3('0x24')](handleError(_0x19ac25,null));};exports[_0x75e3('0x4c')]=function(_0x5c9e32,_0x34a447){var _0x345e6a={'raw':![],'where':{'id':_0x5c9e32[_0x75e3('0x4d')]['id']}},_0xcdd9a4={};_0xcdd9a4[_0x75e3('0x39')]=_[_0x75e3('0x3c')](db[_0x75e3('0x35')][_0x75e3('0x36')]);_0xcdd9a4['query']=_[_0x75e3('0x3c')](_0x5c9e32['query']);_0xcdd9a4[_0x75e3('0x43')]=_[_0x75e3('0x4e')](_0xcdd9a4[_0x75e3('0x39')],_0xcdd9a4[_0x75e3('0x3b')]);_0x345e6a['attributes']=_['intersection'](_0xcdd9a4[_0x75e3('0x39')],qs['fields'](_0x5c9e32[_0x75e3('0x3b')][_0x75e3('0x3e')]));_0x345e6a['attributes']=_0x345e6a[_0x75e3('0x3d')][_0x75e3('0x3f')]?_0x345e6a[_0x75e3('0x3d')]:_0xcdd9a4['model'];if(_0x5c9e32[_0x75e3('0x3b')][_0x75e3('0x4a')]){_0x345e6a[_0x75e3('0x4b')]=[{'all':!![]}];}_0x345e6a=_[_0x75e3('0x45')]({},_0x345e6a,_0x5c9e32[_0x75e3('0x48')]);return db['FreshdeskAccount'][_0x75e3('0x4f')](_0x345e6a)[_0x75e3('0x19')](handleEntityNotFound(_0x34a447,null))[_0x75e3('0x19')](respondWithResult(_0x34a447,null))[_0x75e3('0x24')](handleError(_0x34a447,null));};exports['create']=function(_0x16ddcd,_0x120182){return db[_0x75e3('0x35')][_0x75e3('0x50')](_0x16ddcd['body'],{})[_0x75e3('0x19')](respondWithResult(_0x120182,0xc9))['catch'](handleError(_0x120182,null));};exports[_0x75e3('0x2f')]=function(_0x3767f3,_0x3f64f3){if(_0x3767f3[_0x75e3('0x51')]['id']){delete _0x3767f3[_0x75e3('0x51')]['id'];}return db['FreshdeskAccount'][_0x75e3('0x4f')]({'where':{'id':_0x3767f3[_0x75e3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3f64f3,null))[_0x75e3('0x19')](saveUpdates(_0x3767f3['body'],null))['then'](respondWithResult(_0x3f64f3,null))[_0x75e3('0x24')](handleError(_0x3f64f3,null));};exports[_0x75e3('0x30')]=function(_0x2d7eaa,_0x10c4a0){return db[_0x75e3('0x35')]['find']({'where':{'id':_0x2d7eaa['params']['id']}})[_0x75e3('0x19')](handleEntityNotFound(_0x10c4a0,null))[_0x75e3('0x19')](removeEntity(_0x10c4a0,null))[_0x75e3('0x24')](handleError(_0x10c4a0,null));};exports['getConfigurations']=function(_0x120474,_0x179f59,_0x2b7632){var _0x2574ea={};var _0x3ef4c2={};var _0x1deacf;var _0x52e601;return db[_0x75e3('0x35')][_0x75e3('0x52')]({'where':{'id':_0x120474[_0x75e3('0x4d')]['id']}})[_0x75e3('0x19')](handleEntityNotFound(_0x179f59,null))[_0x75e3('0x19')](function(_0x572650){if(_0x572650){_0x1deacf=_0x572650;_0x3ef4c2[_0x75e3('0x39')]=_[_0x75e3('0x3c')](db[_0x75e3('0x53')]['rawAttributes']);_0x3ef4c2['query']=_[_0x75e3('0x3c')](_0x120474[_0x75e3('0x3b')]);_0x3ef4c2['filters']=_[_0x75e3('0x4e')](_0x3ef4c2[_0x75e3('0x39')],_0x3ef4c2[_0x75e3('0x3b')]);_0x2574ea[_0x75e3('0x3d')]=_[_0x75e3('0x4e')](_0x3ef4c2[_0x75e3('0x39')],qs[_0x75e3('0x3e')](_0x120474['query'][_0x75e3('0x3e')]));_0x2574ea[_0x75e3('0x3d')]=_0x2574ea[_0x75e3('0x3d')][_0x75e3('0x3f')]?_0x2574ea['attributes']:_0x3ef4c2[_0x75e3('0x39')];_0x2574ea[_0x75e3('0x41')]=qs[_0x75e3('0x42')](_0x120474[_0x75e3('0x3b')][_0x75e3('0x42')]);_0x2574ea[_0x75e3('0x46')]=qs[_0x75e3('0x43')](_[_0x75e3('0x44')](_0x120474['query'],_0x3ef4c2[_0x75e3('0x43')]));if(_0x120474[_0x75e3('0x3b')][_0x75e3('0x47')]){_0x2574ea[_0x75e3('0x46')]=_[_0x75e3('0x45')](_0x2574ea[_0x75e3('0x46')],{'$or':_[_0x75e3('0x3a')](_0x2574ea[_0x75e3('0x3d')],function(_0x545905){var _0x2ed72f={};_0x2ed72f[_0x545905]={'$like':'%'+_0x120474[_0x75e3('0x3b')][_0x75e3('0x47')]+'%'};return _0x2ed72f;})});}_0x2574ea=_['merge']({},_0x2574ea,_0x120474['options']);return _0x1deacf[_0x75e3('0x54')](_0x2574ea);}})[_0x75e3('0x19')](function(_0x19706f){if(_0x19706f){_0x52e601=_0x19706f['length'];if(!_0x120474[_0x75e3('0x3b')][_0x75e3('0x55')](_0x75e3('0x40'))){_0x2574ea[_0x75e3('0x29')]=qs['limit'](_0x120474[_0x75e3('0x3b')]['limit']);_0x2574ea[_0x75e3('0x28')]=qs[_0x75e3('0x28')](_0x120474[_0x75e3('0x3b')][_0x75e3('0x28')]);}return _0x1deacf[_0x75e3('0x54')](_0x2574ea);}})[_0x75e3('0x19')](function(_0x26f178){if(_0x26f178){return _0x26f178?{'count':_0x52e601,'rows':_0x26f178}:null;}})[_0x75e3('0x19')](respondWithResult(_0x179f59,null))[_0x75e3('0x24')](handleError(_0x179f59,null));};exports['addConfiguration']=function(_0x11c7a9,_0xaaf3a6,_0x57b7eb){if(_0x11c7a9['body']['id']){delete _0x11c7a9[_0x75e3('0x51')]['id'];}return db[_0x75e3('0x35')]['findOne']({'where':{'id':_0x11c7a9['params']['id']}})['then'](handleEntityNotFound(_0xaaf3a6,null))['then'](function(_0x1300d7){if(_0x1300d7){_0x11c7a9[_0x75e3('0x51')][_0x75e3('0x56')]=_0x1300d7['id'];_0x11c7a9[_0x75e3('0x51')][_0x75e3('0x57')]=integrations[_0x75e3('0x58')](_0x11c7a9[_0x75e3('0x51')][_0x75e3('0x59')],_0x11c7a9[_0x75e3('0x51')][_0x75e3('0x37')]);_0x11c7a9[_0x75e3('0x51')][_0x75e3('0x5a')]=integrations[_0x75e3('0x5b')](_0x11c7a9[_0x75e3('0x51')][_0x75e3('0x59')],_0x11c7a9[_0x75e3('0x51')][_0x75e3('0x37')]);return db[_0x75e3('0x53')][_0x75e3('0x50')](_0x11c7a9[_0x75e3('0x51')],{'include':[{'model':db[_0x75e3('0x5c')],'as':_0x75e3('0x57')},{'model':db[_0x75e3('0x5c')],'as':_0x75e3('0x5a')}]});}return null;})['then'](respondWithResult(_0xaaf3a6,null))[_0x75e3('0x24')](handleError(_0xaaf3a6,null));};exports['getFields']=function(_0x31b6ad,_0x171cb7,_0x575c4){var _0xee80bd='';return db['FreshdeskAccount'][_0x75e3('0x52')]({'where':{'id':_0x31b6ad['params']['id']},'attributes':['id',_0x75e3('0x5d'),'apiKey']})[_0x75e3('0x19')](handleEntityNotFound(_0x171cb7,null))[_0x75e3('0x19')](function(_0x48d22a){if(_0x48d22a){_0xee80bd=_0x48d22a[_0x75e3('0x5d')];var _0xa3d206=_0xee80bd[_0x75e3('0x5e')](-0x1);if(_0xa3d206==='/'){_0xee80bd=_0xee80bd[_0x75e3('0x5f')](0x0,_0xee80bd['lastIndexOf'](_0xa3d206));}return rp({'method':'GET','uri':util['format'](_0x75e3('0x60'),_0xee80bd,_0x75e3('0x61')),'headers':{'Authorization':util[_0x75e3('0x62')](_0x75e3('0x63'),new Buffer(util[_0x75e3('0x62')](_0x75e3('0x64'),_0x48d22a[_0x75e3('0x65')]))[_0x75e3('0x66')](_0x75e3('0x67')))},'json':!![]});}})[_0x75e3('0x19')](function(_0x558560){if(_0x558560){var _0x421329=[_0x75e3('0x68'),'subject',_0x75e3('0x69'),'description',_0x75e3('0x26'),'priority',_0x75e3('0x6a'),_0x75e3('0x6b'),_0x75e3('0x6c'),_0x75e3('0x6a'),'company'];_['remove'](_0x558560,function(_0x3b7479){return _0x421329[_0x75e3('0x6d')](_0x3b7479[_0x75e3('0x33')])||!_0x3b7479[_0x75e3('0x6e')]&&_0x3b7479[_0x75e3('0x37')]!=='custom_text'&&_0x3b7479[_0x75e3('0x37')]!==_0x75e3('0x6f');});return{'count':_0x558560[_0x75e3('0x3f')],'rows':_[_0x75e3('0x3a')](_0x558560,function(_0x555c96){return{'id':_0x555c96[_0x75e3('0x33')],'name':_0x555c96[_0x75e3('0x70')],'custom':!_0x555c96['default'],'options':_0x555c96[_0x75e3('0x71')]?_['map'](_0x555c96[_0x75e3('0x71')],function(_0x2a6cf1){return{'name':_['capitalize'](_0x2a6cf1),'value':_0x2a6cf1};}):[]};})};}})[_0x75e3('0x19')](respondWithResult(_0x171cb7,null))[_0x75e3('0x24')](function(_0x573cfd){var _0x587459=_0x31b6ad[_0x75e3('0x3b')]['test']?0x1f4:_0x573cfd[_0x75e3('0x72')]||0x1f4;logger[_0x75e3('0x20')](_0x75e3('0x73'),_0x75e3('0x74'),_0x587459,JSON['stringify'](_0x573cfd));delete _0x573cfd[_0x75e3('0x33')];if(_0x587459===0x191){_0x587459=0x190;}_0x171cb7[_0x75e3('0x26')](_0x587459)[_0x75e3('0x34')](_0x31b6ad[_0x75e3('0x3b')][_0x75e3('0x75')]?{'message':_0x75e3('0x76'),'statusCode':_0x573cfd[_0x75e3('0x72')]}:_0x573cfd);});}; \ No newline at end of file +var _0xbdfc=['capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','request','then','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','FreshdeskAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','limit','set','Content-Range','save','update','destroy','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','length','hasOwnProperty','offset','sort','where','pick','filter','merge','options','include','findAll','params','fields','includeAll','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','order','nolimit','AccountId','Subjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','subject','agent','group','source','ticket_type','company','remove','includes','custom_dropdown','label','default'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0xbdfc,0xfa));var _0xcbdf=function(_0x49866c,_0x379439){_0x49866c=_0x49866c-0x0;var _0x4bebbd=_0xbdfc[_0x49866c];return _0x4bebbd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcbdf('0x0'));var rimraf=require(_0xcbdf('0x1'));var zipdir=require(_0xcbdf('0x2'));var jsonpatch=require(_0xcbdf('0x3'));var rp=require(_0xcbdf('0x4'));var moment=require(_0xcbdf('0x5'));var BPromise=require(_0xcbdf('0x6'));var Mustache=require(_0xcbdf('0x7'));var util=require(_0xcbdf('0x8'));var path=require(_0xcbdf('0x9'));var sox=require(_0xcbdf('0xa'));var csv=require(_0xcbdf('0xb'));var ejs=require(_0xcbdf('0xc'));var fs=require('fs');var fs_extra=require(_0xcbdf('0xd'));var _=require('lodash');var squel=require(_0xcbdf('0xe'));var crypto=require('crypto');var jsforce=require(_0xcbdf('0xf'));var deskjs=require(_0xcbdf('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcbdf('0x11'));var Redis=require(_0xcbdf('0x12'));var authService=require(_0xcbdf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcbdf('0x14'));var hardwareService=require(_0xcbdf('0x15'));var logger=require(_0xcbdf('0x16'))(_0xcbdf('0x17'));var utils=require(_0xcbdf('0x18'));var config=require(_0xcbdf('0x19'));var licenseUtil=require(_0xcbdf('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xcbdf('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0xcbdf('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50478d,_0x32b0fd,_0x8733f9,_0x38e703){return new BPromise(function(_0x339bc2,_0x31ddea){var _0x4d05e9=_0x38e703||client;return _0x4d05e9[_0xcbdf('0x1d')](_0x50478d,_0x8733f9)[_0xcbdf('0x1e')](function(_0x951687){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x32b0fd,_0xcbdf('0x1f'));logger[_0xcbdf('0x20')](_0xcbdf('0x21'),_0x32b0fd,_0xcbdf('0x1f'),JSON['stringify'](_0x951687));if(_0x951687['error']){if(_0x951687[_0xcbdf('0x22')]['code']===0x1f4){logger[_0xcbdf('0x22')](_0xcbdf('0x23'),_0x32b0fd,_0x951687['error'][_0xcbdf('0x24')]);return _0x31ddea(_0x951687[_0xcbdf('0x22')]['message']);}logger[_0xcbdf('0x22')]('FreshdeskAccount,\x20%s,\x20%s',_0x32b0fd,_0x951687['error'][_0xcbdf('0x24')]);return _0x339bc2(_0x951687['error'][_0xcbdf('0x24')]);}else{logger['info'](_0xcbdf('0x23'),_0x32b0fd,_0xcbdf('0x1f'));_0x339bc2(_0x951687['result'][_0xcbdf('0x24')]);}})[_0xcbdf('0x25')](function(_0xdab4a8){logger[_0xcbdf('0x22')](_0xcbdf('0x23'),_0x32b0fd,_0xdab4a8);_0x31ddea(_0xdab4a8);});});}function respondWithStatusCode(_0x5bb1e5,_0x100d9f){_0x100d9f=_0x100d9f||0xcc;return function(_0x2c4d25){if(_0x2c4d25){return _0x5bb1e5[_0xcbdf('0x26')](_0x100d9f);}return _0x5bb1e5[_0xcbdf('0x27')](_0x100d9f)[_0xcbdf('0x28')]();};}function respondWithResult(_0x39d3c9,_0x1acd52){_0x1acd52=_0x1acd52||0xc8;return function(_0x170f03){if(_0x170f03){return _0x39d3c9[_0xcbdf('0x27')](_0x1acd52)[_0xcbdf('0x29')](_0x170f03);}};}function respondWithFilteredResult(_0x4211af,_0x304a7e){return function(_0x5c8cde){if(_0x5c8cde){var _0xdb3795=_0x5c8cde[_0xcbdf('0x2a')],_0x3fb6b7=_0x304a7e['offset'],_0x47bf0c=_0x304a7e['offset']+_0x304a7e[_0xcbdf('0x2b')],_0x2a8d11;if(_0x47bf0c>=_0xdb3795){_0x47bf0c=_0xdb3795;_0x2a8d11=0xc8;}else{_0x2a8d11=0xce;}_0x4211af[_0xcbdf('0x27')](_0x2a8d11);return _0x4211af[_0xcbdf('0x2c')](_0xcbdf('0x2d'),_0x3fb6b7+'-'+_0x47bf0c+'/'+_0xdb3795)[_0xcbdf('0x29')](_0x5c8cde);}return null;};}function patchUpdates(_0x17e574){return function(_0x2a62e5){try{jsonpatch['apply'](_0x2a62e5,_0x17e574,!![]);}catch(_0x125e78){return BPromise['reject'](_0x125e78);}return _0x2a62e5[_0xcbdf('0x2e')]();};}function saveUpdates(_0x1baaad,_0x32d910){return function(_0xe1b4be){if(_0xe1b4be){return _0xe1b4be[_0xcbdf('0x2f')](_0x1baaad)[_0xcbdf('0x1e')](function(_0x4c048f){return _0x4c048f;});}return null;};}function removeEntity(_0x5e3e64,_0x79b907){return function(_0x3068b6){if(_0x3068b6){return _0x3068b6[_0xcbdf('0x30')]()[_0xcbdf('0x1e')](function(){_0x5e3e64[_0xcbdf('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58f890,_0x30f0aa){return function(_0xe0443a){if(!_0xe0443a){_0x58f890[_0xcbdf('0x26')](0x194);}return _0xe0443a;};}function handleError(_0x2fd230,_0x43ece9){_0x43ece9=_0x43ece9||0x1f4;return function(_0x29b119){logger[_0xcbdf('0x22')](_0x29b119['stack']);if(_0x29b119['name']){delete _0x29b119[_0xcbdf('0x31')];}_0x2fd230[_0xcbdf('0x27')](_0x43ece9)[_0xcbdf('0x32')](_0x29b119);};}exports[_0xcbdf('0x33')]=function(_0x6acb49,_0x16462d){var _0x580102={},_0x1c0629={},_0x41ace6={'count':0x0,'rows':[]};var _0x34c2e3=_[_0xcbdf('0x34')](db[_0xcbdf('0x35')][_0xcbdf('0x36')],function(_0xcc9a09){return{'name':_0xcc9a09[_0xcbdf('0x37')],'type':_0xcc9a09[_0xcbdf('0x38')][_0xcbdf('0x39')]};});_0x1c0629['model']=_['map'](_0x34c2e3,'name');_0x1c0629['query']=_[_0xcbdf('0x3a')](_0x6acb49['query']);_0x1c0629[_0xcbdf('0x3b')]=_[_0xcbdf('0x3c')](_0x1c0629[_0xcbdf('0x3d')],_0x1c0629['query']);_0x580102['attributes']=_['intersection'](_0x1c0629['model'],qs['fields'](_0x6acb49[_0xcbdf('0x3e')]['fields']));_0x580102[_0xcbdf('0x3f')]=_0x580102[_0xcbdf('0x3f')][_0xcbdf('0x40')]?_0x580102[_0xcbdf('0x3f')]:_0x1c0629['model'];if(!_0x6acb49[_0xcbdf('0x3e')][_0xcbdf('0x41')]('nolimit')){_0x580102[_0xcbdf('0x2b')]=qs['limit'](_0x6acb49[_0xcbdf('0x3e')][_0xcbdf('0x2b')]);_0x580102['offset']=qs[_0xcbdf('0x42')](_0x6acb49[_0xcbdf('0x3e')][_0xcbdf('0x42')]);}_0x580102['order']=qs[_0xcbdf('0x43')](_0x6acb49['query'][_0xcbdf('0x43')]);_0x580102[_0xcbdf('0x44')]=qs[_0xcbdf('0x3b')](_[_0xcbdf('0x45')](_0x6acb49['query'],_0x1c0629[_0xcbdf('0x3b')]),_0x34c2e3);if(_0x6acb49[_0xcbdf('0x3e')][_0xcbdf('0x46')]){_0x580102[_0xcbdf('0x44')]=_[_0xcbdf('0x47')](_0x580102[_0xcbdf('0x44')],{'$or':_[_0xcbdf('0x34')](_0x34c2e3,function(_0xe159d0){if(_0xe159d0[_0xcbdf('0x38')]!=='VIRTUAL'){var _0x2d0331={};_0x2d0331[_0xe159d0[_0xcbdf('0x31')]]={'$like':'%'+_0x6acb49['query'][_0xcbdf('0x46')]+'%'};return _0x2d0331;}})});}_0x580102=_['merge']({},_0x580102,_0x6acb49[_0xcbdf('0x48')]);var _0x1082e3={'where':_0x580102[_0xcbdf('0x44')]};return db[_0xcbdf('0x35')][_0xcbdf('0x2a')](_0x1082e3)[_0xcbdf('0x1e')](function(_0x5d2a5a){_0x41ace6[_0xcbdf('0x2a')]=_0x5d2a5a;if(_0x6acb49['query']['includeAll']){_0x580102[_0xcbdf('0x49')]=[{'all':!![]}];}return db[_0xcbdf('0x35')][_0xcbdf('0x4a')](_0x580102);})[_0xcbdf('0x1e')](function(_0x349f65){_0x41ace6['rows']=_0x349f65;return _0x41ace6;})[_0xcbdf('0x1e')](respondWithFilteredResult(_0x16462d,_0x580102))[_0xcbdf('0x25')](handleError(_0x16462d,null));};exports['show']=function(_0x2eedd8,_0x44b91f){var _0x68a45={'raw':![],'where':{'id':_0x2eedd8[_0xcbdf('0x4b')]['id']}},_0xe40c3d={};_0xe40c3d[_0xcbdf('0x3d')]=_[_0xcbdf('0x3a')](db['FreshdeskAccount'][_0xcbdf('0x36')]);_0xe40c3d[_0xcbdf('0x3e')]=_['keys'](_0x2eedd8[_0xcbdf('0x3e')]);_0xe40c3d['filters']=_[_0xcbdf('0x3c')](_0xe40c3d[_0xcbdf('0x3d')],_0xe40c3d[_0xcbdf('0x3e')]);_0x68a45[_0xcbdf('0x3f')]=_[_0xcbdf('0x3c')](_0xe40c3d[_0xcbdf('0x3d')],qs['fields'](_0x2eedd8['query'][_0xcbdf('0x4c')]));_0x68a45[_0xcbdf('0x3f')]=_0x68a45[_0xcbdf('0x3f')]['length']?_0x68a45['attributes']:_0xe40c3d[_0xcbdf('0x3d')];if(_0x2eedd8[_0xcbdf('0x3e')][_0xcbdf('0x4d')]){_0x68a45['include']=[{'all':!![]}];}_0x68a45=_[_0xcbdf('0x47')]({},_0x68a45,_0x2eedd8[_0xcbdf('0x48')]);return db[_0xcbdf('0x35')][_0xcbdf('0x4e')](_0x68a45)[_0xcbdf('0x1e')](handleEntityNotFound(_0x44b91f,null))[_0xcbdf('0x1e')](respondWithResult(_0x44b91f,null))[_0xcbdf('0x25')](handleError(_0x44b91f,null));};exports[_0xcbdf('0x4f')]=function(_0xa88955,_0x2b745c){return db[_0xcbdf('0x35')][_0xcbdf('0x4f')](_0xa88955[_0xcbdf('0x50')],{})[_0xcbdf('0x1e')](respondWithResult(_0x2b745c,0xc9))['catch'](handleError(_0x2b745c,null));};exports[_0xcbdf('0x2f')]=function(_0x2e38c8,_0x4a53e9){if(_0x2e38c8[_0xcbdf('0x50')]['id']){delete _0x2e38c8[_0xcbdf('0x50')]['id'];}return db[_0xcbdf('0x35')]['find']({'where':{'id':_0x2e38c8[_0xcbdf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a53e9,null))['then'](saveUpdates(_0x2e38c8[_0xcbdf('0x50')],null))['then'](respondWithResult(_0x4a53e9,null))[_0xcbdf('0x25')](handleError(_0x4a53e9,null));};exports['destroy']=function(_0x197801,_0x395951){return db[_0xcbdf('0x35')][_0xcbdf('0x4e')]({'where':{'id':_0x197801['params']['id']}})['then'](handleEntityNotFound(_0x395951,null))[_0xcbdf('0x1e')](removeEntity(_0x395951,null))[_0xcbdf('0x25')](handleError(_0x395951,null));};exports[_0xcbdf('0x51')]=function(_0x4faece,_0x2b34d6,_0x475bc2){var _0x38b0dd={};var _0x5fb24={};var _0x2b97a8;var _0x58ae4d;return db[_0xcbdf('0x35')][_0xcbdf('0x52')]({'where':{'id':_0x4faece['params']['id']}})['then'](handleEntityNotFound(_0x2b34d6,null))[_0xcbdf('0x1e')](function(_0x2f2dba){if(_0x2f2dba){_0x2b97a8=_0x2f2dba;_0x5fb24[_0xcbdf('0x3d')]=_['keys'](db[_0xcbdf('0x53')][_0xcbdf('0x36')]);_0x5fb24[_0xcbdf('0x3e')]=_['keys'](_0x4faece['query']);_0x5fb24[_0xcbdf('0x3b')]=_[_0xcbdf('0x3c')](_0x5fb24[_0xcbdf('0x3d')],_0x5fb24['query']);_0x38b0dd[_0xcbdf('0x3f')]=_[_0xcbdf('0x3c')](_0x5fb24[_0xcbdf('0x3d')],qs[_0xcbdf('0x4c')](_0x4faece[_0xcbdf('0x3e')][_0xcbdf('0x4c')]));_0x38b0dd['attributes']=_0x38b0dd[_0xcbdf('0x3f')][_0xcbdf('0x40')]?_0x38b0dd[_0xcbdf('0x3f')]:_0x5fb24['model'];_0x38b0dd[_0xcbdf('0x54')]=qs[_0xcbdf('0x43')](_0x4faece[_0xcbdf('0x3e')][_0xcbdf('0x43')]);_0x38b0dd['where']=qs[_0xcbdf('0x3b')](_['pick'](_0x4faece[_0xcbdf('0x3e')],_0x5fb24[_0xcbdf('0x3b')]));if(_0x4faece[_0xcbdf('0x3e')][_0xcbdf('0x46')]){_0x38b0dd[_0xcbdf('0x44')]=_['merge'](_0x38b0dd[_0xcbdf('0x44')],{'$or':_[_0xcbdf('0x34')](_0x38b0dd[_0xcbdf('0x3f')],function(_0x2f21b1){var _0x190aeb={};_0x190aeb[_0x2f21b1]={'$like':'%'+_0x4faece[_0xcbdf('0x3e')][_0xcbdf('0x46')]+'%'};return _0x190aeb;})});}_0x38b0dd=_[_0xcbdf('0x47')]({},_0x38b0dd,_0x4faece['options']);return _0x2b97a8['getConfigurations'](_0x38b0dd);}})['then'](function(_0x3abff8){if(_0x3abff8){_0x58ae4d=_0x3abff8[_0xcbdf('0x40')];if(!_0x4faece['query']['hasOwnProperty'](_0xcbdf('0x55'))){_0x38b0dd['limit']=qs[_0xcbdf('0x2b')](_0x4faece[_0xcbdf('0x3e')][_0xcbdf('0x2b')]);_0x38b0dd[_0xcbdf('0x42')]=qs[_0xcbdf('0x42')](_0x4faece[_0xcbdf('0x3e')][_0xcbdf('0x42')]);}return _0x2b97a8[_0xcbdf('0x51')](_0x38b0dd);}})[_0xcbdf('0x1e')](function(_0x533db0){if(_0x533db0){return _0x533db0?{'count':_0x58ae4d,'rows':_0x533db0}:null;}})[_0xcbdf('0x1e')](respondWithResult(_0x2b34d6,null))[_0xcbdf('0x25')](handleError(_0x2b34d6,null));};exports['addConfiguration']=function(_0xcf07a5,_0x5bd9fd,_0x5e3341){if(_0xcf07a5[_0xcbdf('0x50')]['id']){delete _0xcf07a5['body']['id'];}return db[_0xcbdf('0x35')]['findOne']({'where':{'id':_0xcf07a5[_0xcbdf('0x4b')]['id']}})[_0xcbdf('0x1e')](handleEntityNotFound(_0x5bd9fd,null))[_0xcbdf('0x1e')](function(_0x11f693){if(_0x11f693){_0xcf07a5[_0xcbdf('0x50')][_0xcbdf('0x56')]=_0x11f693['id'];_0xcf07a5[_0xcbdf('0x50')][_0xcbdf('0x57')]=integrations['getSubjects'](_0xcf07a5[_0xcbdf('0x50')][_0xcbdf('0x58')],_0xcf07a5['body'][_0xcbdf('0x38')]);_0xcf07a5[_0xcbdf('0x50')]['Descriptions']=integrations[_0xcbdf('0x59')](_0xcf07a5[_0xcbdf('0x50')]['channel'],_0xcf07a5[_0xcbdf('0x50')]['type']);return db[_0xcbdf('0x53')][_0xcbdf('0x4f')](_0xcf07a5[_0xcbdf('0x50')],{'include':[{'model':db[_0xcbdf('0x5a')],'as':_0xcbdf('0x57')},{'model':db[_0xcbdf('0x5a')],'as':_0xcbdf('0x5b')}]});}return null;})[_0xcbdf('0x1e')](respondWithResult(_0x5bd9fd,null))[_0xcbdf('0x25')](handleError(_0x5bd9fd,null));};exports[_0xcbdf('0x5c')]=function(_0x215900,_0x4283b9,_0x3a21ad){var _0x2060b3='';return db[_0xcbdf('0x35')][_0xcbdf('0x52')]({'where':{'id':_0x215900[_0xcbdf('0x4b')]['id']},'attributes':['id',_0xcbdf('0x5d'),'apiKey']})[_0xcbdf('0x1e')](handleEntityNotFound(_0x4283b9,null))['then'](function(_0x3affad){if(_0x3affad){_0x2060b3=_0x3affad[_0xcbdf('0x5d')];var _0x1062a8=_0x2060b3[_0xcbdf('0x5e')](-0x1);if(_0x1062a8==='/'){_0x2060b3=_0x2060b3[_0xcbdf('0x5f')](0x0,_0x2060b3[_0xcbdf('0x60')](_0x1062a8));}return rp({'method':_0xcbdf('0x61'),'uri':util[_0xcbdf('0x62')]('%s/%s',_0x2060b3,_0xcbdf('0x63')),'headers':{'Authorization':util[_0xcbdf('0x62')](_0xcbdf('0x64'),new Buffer(util[_0xcbdf('0x62')](_0xcbdf('0x65'),_0x3affad[_0xcbdf('0x66')]))[_0xcbdf('0x67')](_0xcbdf('0x68')))},'json':!![]});}})['then'](function(_0x523469){if(_0x523469){var _0x22412f=['requester',_0xcbdf('0x69'),_0xcbdf('0x6a'),'description','status','priority',_0xcbdf('0x6b'),_0xcbdf('0x6c'),_0xcbdf('0x6d'),_0xcbdf('0x6b'),_0xcbdf('0x6e')];_[_0xcbdf('0x6f')](_0x523469,function(_0x558c7a){return _0x22412f[_0xcbdf('0x70')](_0x558c7a[_0xcbdf('0x31')])||!_0x558c7a['default']&&_0x558c7a['type']!=='custom_text'&&_0x558c7a[_0xcbdf('0x38')]!==_0xcbdf('0x71');});return{'count':_0x523469[_0xcbdf('0x40')],'rows':_[_0xcbdf('0x34')](_0x523469,function(_0x6b8a35){return{'id':_0x6b8a35[_0xcbdf('0x31')],'name':_0x6b8a35[_0xcbdf('0x72')],'custom':!_0x6b8a35[_0xcbdf('0x73')],'options':_0x6b8a35['choices']?_['map'](_0x6b8a35['choices'],function(_0x411d4c){return{'name':_[_0xcbdf('0x74')](_0x411d4c),'value':_0x411d4c};}):[]};})};}})[_0xcbdf('0x1e')](respondWithResult(_0x4283b9,null))[_0xcbdf('0x25')](function(_0x579d1e){var _0x4105a0=_0x215900['query']['test']?0x1f4:_0x579d1e[_0xcbdf('0x75')]||0x1f4;logger[_0xcbdf('0x22')](_0xcbdf('0x76'),_0xcbdf('0x5c'),_0x4105a0,JSON[_0xcbdf('0x77')](_0x579d1e));delete _0x579d1e[_0xcbdf('0x31')];if(_0x4105a0===0x191){_0x4105a0=0x190;}_0x4283b9[_0xcbdf('0x27')](_0x4105a0)[_0xcbdf('0x32')](_0x215900['query'][_0xcbdf('0x78')]?{'message':_0xcbdf('0x79'),'statusCode':_0x579d1e[_0xcbdf('0x75')]}:_0x579d1e);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index c486e9b..d23528b 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 _0x9433=['lodash','util','../../config/logger','moment','bluebird','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x1cb2b2,_0x4867a8){var _0x13e068=function(_0x5cc0a7){while(--_0x5cc0a7){_0x1cb2b2['push'](_0x1cb2b2['shift']());}};_0x13e068(++_0x4867a8);}(_0x9433,0x114));var _0x3943=function(_0x447b2b,_0x5bbcc5){_0x447b2b=_0x447b2b-0x0;var _0x471d98=_0x9433[_0x447b2b];return _0x471d98;};'use strict';var _=require(_0x3943('0x0'));var util=require(_0x3943('0x1'));var logger=require(_0x3943('0x2'))('api');var moment=require(_0x3943('0x3'));var BPromise=require(_0x3943('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3943('0x5'));var config=require('../../config/environment');var attributes=require(_0x3943('0x6'));var integrations=require(_0x3943('0x7'));module[_0x3943('0x8')]=function(_0x6a6161,_0x3f3511){return _0x6a6161[_0x3943('0x9')](_0x3943('0xa'),attributes,{'tableName':_0x3943('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6517=['int_freshdesk_accounts','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0x4f6996,_0x284e75){var _0x280a4e=function(_0x19c292){while(--_0x19c292){_0x4f6996['push'](_0x4f6996['shift']());}};_0x280a4e(++_0x284e75);}(_0x6517,0xe5));var _0x7651=function(_0x39d0e8,_0x2327d6){_0x39d0e8=_0x39d0e8-0x0;var _0x21f7f7=_0x6517[_0x39d0e8];return _0x21f7f7;};'use strict';var _=require(_0x7651('0x0'));var util=require('util');var logger=require(_0x7651('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7651('0x2'));var rp=require(_0x7651('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7651('0x4'));var config=require(_0x7651('0x5'));var attributes=require(_0x7651('0x6'));var integrations=require(_0x7651('0x7'));module[_0x7651('0x8')]=function(_0x283abc,_0x115f97){return _0x283abc[_0x7651('0x9')](_0x7651('0xa'),attributes,{'tableName':_0x7651('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index c2189f5..cd65a91 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 _0x0e2e=['result','GetFreshdeskAccount','FreshdeskAccount','options','where','limit','map','include','attributes','model','info','catch','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','FreshdeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x0e2e,0xed));var _0xe0e2=function(_0x40a53c,_0x44a52f){_0x40a53c=_0x40a53c-0x0;var _0x27a53b=_0x0e2e[_0x40a53c];return _0x27a53b;};'use strict';var _=require(_0xe0e2('0x0'));var util=require(_0xe0e2('0x1'));var moment=require(_0xe0e2('0x2'));var BPromise=require(_0xe0e2('0x3'));var rs=require(_0xe0e2('0x4'));var fs=require('fs');var Redis=require(_0xe0e2('0x5'));var db=require(_0xe0e2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe0e2('0x7'));var config=require(_0xe0e2('0x8'));var jayson=require(_0xe0e2('0x9'));var client=jayson[_0xe0e2('0xa')][_0xe0e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25236c,_0x40c93f,_0x141a2d){return new BPromise(function(_0x2d4db8,_0x8e73e9){return client['request'](_0x25236c,_0x141a2d)[_0xe0e2('0xc')](function(_0x2048bd){logger['info'](_0xe0e2('0xd'),_0x40c93f,'request\x20sent');logger[_0xe0e2('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x40c93f,_0xe0e2('0xf'),JSON[_0xe0e2('0x10')](_0x2048bd));if(_0x2048bd[_0xe0e2('0x11')]){if(_0x2048bd[_0xe0e2('0x11')]['code']===0x1f4){logger[_0xe0e2('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x40c93f,_0x2048bd[_0xe0e2('0x11')][_0xe0e2('0x12')]);return _0x8e73e9(_0x2048bd[_0xe0e2('0x11')]['message']);}logger[_0xe0e2('0x11')](_0xe0e2('0xd'),_0x40c93f,_0x2048bd[_0xe0e2('0x11')]['message']);return _0x2d4db8(_0x2048bd[_0xe0e2('0x11')][_0xe0e2('0x12')]);}else{logger['info'](_0xe0e2('0xd'),_0x40c93f,_0xe0e2('0xf'));_0x2d4db8(_0x2048bd[_0xe0e2('0x13')][_0xe0e2('0x12')]);}})['catch'](function(_0x2cf288){logger[_0xe0e2('0x11')](_0xe0e2('0xd'),_0x40c93f,_0x2cf288);_0x8e73e9(_0x2cf288);});});}exports[_0xe0e2('0x14')]=function(_0x4ee11a){var _0x2a2a2b=this;return new Promise(function(_0x228cb5,_0x3bdfff){return db[_0xe0e2('0x15')]['findAll']({'raw':_0x4ee11a[_0xe0e2('0x16')]?_0x4ee11a['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ee11a[_0xe0e2('0x16')]?_0x4ee11a[_0xe0e2('0x16')][_0xe0e2('0x17')]||null:null,'attributes':_0x4ee11a['options']?_0x4ee11a['options']['attributes']||null:null,'limit':_0x4ee11a[_0xe0e2('0x16')]?_0x4ee11a['options'][_0xe0e2('0x18')]||null:null,'include':_0x4ee11a['options']?_0x4ee11a[_0xe0e2('0x16')]['include']?_[_0xe0e2('0x19')](_0x4ee11a[_0xe0e2('0x16')][_0xe0e2('0x1a')],function(_0x2ce68a){return{'model':db[_0x2ce68a['model']],'as':_0x2ce68a['as'],'attributes':_0x2ce68a['attributes'],'include':_0x2ce68a[_0xe0e2('0x1a')]?_[_0xe0e2('0x19')](_0x2ce68a['include'],function(_0x38a657){return{'model':db[_0x38a657['model']],'as':_0x38a657['as'],'attributes':_0x38a657[_0xe0e2('0x1b')],'include':_0x38a657[_0xe0e2('0x1a')]?_['map'](_0x38a657[_0xe0e2('0x1a')],function(_0x476418){return{'model':db[_0x476418[_0xe0e2('0x1c')]],'as':_0x476418['as'],'attributes':_0x476418[_0xe0e2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0e2('0xc')](function(_0x2ee98d){logger[_0xe0e2('0x1d')](_0xe0e2('0x14'),_0x4ee11a);logger[_0xe0e2('0xe')](_0xe0e2('0x14'),_0x4ee11a,JSON[_0xe0e2('0x10')](_0x2ee98d));_0x228cb5(_0x2ee98d);})[_0xe0e2('0x1e')](function(_0x392a35){logger['error'](_0xe0e2('0x14'),_0x392a35[_0xe0e2('0x12')],_0x4ee11a);_0x3bdfff(_0x2a2a2b['error'](0x1f4,_0x392a35[_0xe0e2('0x12')]));});});};exports[_0xe0e2('0x1f')]=function(_0x24a79a){var _0xa5965=this;return new Promise(function(_0x33c7f2,_0x5c4106){return db['FreshdeskAccount']['find']({'raw':_0x24a79a['options']?_0x24a79a[_0xe0e2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x24a79a[_0xe0e2('0x16')]?_0x24a79a[_0xe0e2('0x16')]['where']||null:null,'attributes':_0x24a79a['options']?_0x24a79a[_0xe0e2('0x16')][_0xe0e2('0x1b')]||null:null,'include':_0x24a79a[_0xe0e2('0x16')]?_0x24a79a['options'][_0xe0e2('0x1a')]?_['map'](_0x24a79a[_0xe0e2('0x16')]['include'],function(_0x2243a5){return{'model':db[_0x2243a5[_0xe0e2('0x1c')]],'as':_0x2243a5['as'],'attributes':_0x2243a5[_0xe0e2('0x1b')],'include':_0x2243a5[_0xe0e2('0x1a')]?_['map'](_0x2243a5[_0xe0e2('0x1a')],function(_0x222b30){return{'model':db[_0x222b30[_0xe0e2('0x1c')]],'as':_0x222b30['as'],'attributes':_0x222b30[_0xe0e2('0x1b')],'include':_0x222b30[_0xe0e2('0x1a')]?_[_0xe0e2('0x19')](_0x222b30['include'],function(_0x59e4ee){return{'model':db[_0x59e4ee[_0xe0e2('0x1c')]],'as':_0x59e4ee['as'],'attributes':_0x59e4ee[_0xe0e2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0e2('0xc')](function(_0x4c3370){logger[_0xe0e2('0x1d')]('ShowFreshdeskAccount',_0x24a79a);logger[_0xe0e2('0xe')](_0xe0e2('0x1f'),_0x24a79a,JSON[_0xe0e2('0x10')](_0x4c3370));_0x33c7f2(_0x4c3370);})[_0xe0e2('0x1e')](function(_0xd3e7be){logger[_0xe0e2('0x11')](_0xe0e2('0x1f'),_0xd3e7be[_0xe0e2('0x12')],_0x24a79a);_0x5c4106(_0xa5965[_0xe0e2('0x11')](0x1f4,_0xd3e7be[_0xe0e2('0x12')]));});});}; \ No newline at end of file +var _0xf3bd=['catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','include','model','attributes','map','then','ShowFreshdeskAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf3bd,0xe0));var _0xdf3b=function(_0x62f358,_0x46c579){_0x62f358=_0x62f358-0x0;var _0x585b85=_0xf3bd[_0x62f358];return _0x585b85;};'use strict';var _=require(_0xdf3b('0x0'));var util=require(_0xdf3b('0x1'));var moment=require(_0xdf3b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf3b('0x3'));var db=require(_0xdf3b('0x4'))['db'];var utils=require(_0xdf3b('0x5'));var logger=require(_0xdf3b('0x6'))(_0xdf3b('0x7'));var config=require(_0xdf3b('0x8'));var jayson=require(_0xdf3b('0x9'));var client=jayson[_0xdf3b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26fa0e,_0x37a579,_0x5a2d58){return new BPromise(function(_0x43a10b,_0x3a7341){return client[_0xdf3b('0xb')](_0x26fa0e,_0x5a2d58)['then'](function(_0x3ec6c1){logger[_0xdf3b('0xc')](_0xdf3b('0xd'),_0x37a579,_0xdf3b('0xe'));logger[_0xdf3b('0xf')](_0xdf3b('0x10'),_0x37a579,_0xdf3b('0xe'),JSON[_0xdf3b('0x11')](_0x3ec6c1));if(_0x3ec6c1[_0xdf3b('0x12')]){if(_0x3ec6c1[_0xdf3b('0x12')][_0xdf3b('0x13')]===0x1f4){logger[_0xdf3b('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x37a579,_0x3ec6c1[_0xdf3b('0x12')]['message']);return _0x3a7341(_0x3ec6c1['error']['message']);}logger[_0xdf3b('0x12')](_0xdf3b('0xd'),_0x37a579,_0x3ec6c1[_0xdf3b('0x12')][_0xdf3b('0x14')]);return _0x43a10b(_0x3ec6c1[_0xdf3b('0x12')][_0xdf3b('0x14')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x37a579,_0xdf3b('0xe'));_0x43a10b(_0x3ec6c1['result'][_0xdf3b('0x14')]);}})[_0xdf3b('0x15')](function(_0x203747){logger[_0xdf3b('0x12')](_0xdf3b('0xd'),_0x37a579,_0x203747);_0x3a7341(_0x203747);});});}exports[_0xdf3b('0x16')]=function(_0x2f6fc){var _0x4f09e4=this;return new Promise(function(_0xcdc20d,_0x3319b8){return db[_0xdf3b('0x17')][_0xdf3b('0x18')]({'raw':_0x2f6fc[_0xdf3b('0x19')]?_0x2f6fc[_0xdf3b('0x19')][_0xdf3b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f6fc[_0xdf3b('0x19')]?_0x2f6fc[_0xdf3b('0x19')][_0xdf3b('0x1b')]||null:null,'attributes':_0x2f6fc[_0xdf3b('0x19')]?_0x2f6fc['options']['attributes']||null:null,'limit':_0x2f6fc[_0xdf3b('0x19')]?_0x2f6fc[_0xdf3b('0x19')][_0xdf3b('0x1c')]||null:null,'include':_0x2f6fc[_0xdf3b('0x19')]?_0x2f6fc[_0xdf3b('0x19')][_0xdf3b('0x1d')]?_['map'](_0x2f6fc[_0xdf3b('0x19')][_0xdf3b('0x1d')],function(_0x5c2e15){return{'model':db[_0x5c2e15[_0xdf3b('0x1e')]],'as':_0x5c2e15['as'],'attributes':_0x5c2e15[_0xdf3b('0x1f')],'include':_0x5c2e15[_0xdf3b('0x1d')]?_[_0xdf3b('0x20')](_0x5c2e15['include'],function(_0x452084){return{'model':db[_0x452084[_0xdf3b('0x1e')]],'as':_0x452084['as'],'attributes':_0x452084[_0xdf3b('0x1f')],'include':_0x452084[_0xdf3b('0x1d')]?_[_0xdf3b('0x20')](_0x452084[_0xdf3b('0x1d')],function(_0x45daba){return{'model':db[_0x45daba[_0xdf3b('0x1e')]],'as':_0x45daba['as'],'attributes':_0x45daba[_0xdf3b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdf3b('0x21')](function(_0x3c2e18){logger[_0xdf3b('0xc')](_0xdf3b('0x16'),_0x2f6fc);logger[_0xdf3b('0xf')](_0xdf3b('0x16'),_0x2f6fc,JSON[_0xdf3b('0x11')](_0x3c2e18));_0xcdc20d(_0x3c2e18);})['catch'](function(_0x26d638){logger[_0xdf3b('0x12')](_0xdf3b('0x16'),_0x26d638[_0xdf3b('0x14')],_0x2f6fc);_0x3319b8(_0x4f09e4[_0xdf3b('0x12')](0x1f4,_0x26d638[_0xdf3b('0x14')]));});});};exports[_0xdf3b('0x22')]=function(_0x2b5aec){var _0x10768c=this;return new Promise(function(_0x2cbb8a,_0x312e2b){return db[_0xdf3b('0x17')]['find']({'raw':_0x2b5aec[_0xdf3b('0x19')]?_0x2b5aec['options'][_0xdf3b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b5aec[_0xdf3b('0x19')]?_0x2b5aec[_0xdf3b('0x19')][_0xdf3b('0x1b')]||null:null,'attributes':_0x2b5aec[_0xdf3b('0x19')]?_0x2b5aec[_0xdf3b('0x19')][_0xdf3b('0x1f')]||null:null,'include':_0x2b5aec['options']?_0x2b5aec[_0xdf3b('0x19')][_0xdf3b('0x1d')]?_['map'](_0x2b5aec[_0xdf3b('0x19')]['include'],function(_0x5b673b){return{'model':db[_0x5b673b[_0xdf3b('0x1e')]],'as':_0x5b673b['as'],'attributes':_0x5b673b[_0xdf3b('0x1f')],'include':_0x5b673b[_0xdf3b('0x1d')]?_['map'](_0x5b673b[_0xdf3b('0x1d')],function(_0x595547){return{'model':db[_0x595547[_0xdf3b('0x1e')]],'as':_0x595547['as'],'attributes':_0x595547[_0xdf3b('0x1f')],'include':_0x595547[_0xdf3b('0x1d')]?_['map'](_0x595547['include'],function(_0x228205){return{'model':db[_0x228205[_0xdf3b('0x1e')]],'as':_0x228205['as'],'attributes':_0x228205[_0xdf3b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13e47f){logger[_0xdf3b('0xc')](_0xdf3b('0x22'),_0x2b5aec);logger[_0xdf3b('0xf')](_0xdf3b('0x22'),_0x2b5aec,JSON[_0xdf3b('0x11')](_0x13e47f));_0x2cbb8a(_0x13e47f);})['catch'](function(_0x1d12f8){logger['error'](_0xdf3b('0x22'),_0x1d12f8[_0xdf3b('0x14')],_0x2b5aec);_0x312e2b(_0x10768c['error'](0x1f4,_0x1d12f8[_0xdf3b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index cc2d63c..df33981 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 _0xa583=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','setTags','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa583,0xb4));var _0x3a58=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa583[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x3a58('0x0'));var util=require(_0x3a58('0x1'));var path=require(_0x3a58('0x2'));var timeout=require(_0x3a58('0x3'));var express=require('express');var router=express[_0x3a58('0x4')]();var fs_extra=require(_0x3a58('0x5'));var auth=require(_0x3a58('0x6'));var interaction=require(_0x3a58('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x3a58('0x8')](),controller[_0x3a58('0x9')]);router[_0x3a58('0xa')](_0x3a58('0xb'),auth[_0x3a58('0x8')](),controller['show']);router[_0x3a58('0xa')](_0x3a58('0xc'),auth['isAuthenticated'](),controller[_0x3a58('0xd')]);router[_0x3a58('0xa')](_0x3a58('0xe'),auth[_0x3a58('0x8')](),controller['getSubjects']);router[_0x3a58('0xa')]('/:id/descriptions',auth[_0x3a58('0x8')](),controller[_0x3a58('0xf')]);router[_0x3a58('0xa')]('/:id/tags',auth[_0x3a58('0x8')](),controller['getTags']);router[_0x3a58('0x10')]('/',auth[_0x3a58('0x8')](),controller[_0x3a58('0x11')]);router[_0x3a58('0x10')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3a58('0x12')]);router[_0x3a58('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3a58('0x14')]);router['delete'](_0x3a58('0xb'),auth[_0x3a58('0x8')](),controller[_0x3a58('0x15')]);module[_0x3a58('0x16')]=router; \ No newline at end of file +var _0xe3fc=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','show','getSubjects','/:id/descriptions','getDescriptions','post','setTags','put','update','delete','destroy','exports'];(function(_0x5734e1,_0x3e1d75){var _0x22c784=function(_0x4fe1eb){while(--_0x4fe1eb){_0x5734e1['push'](_0x5734e1['shift']());}};_0x22c784(++_0x3e1d75);}(_0xe3fc,0xc0));var _0xce3f=function(_0x12254f,_0x100cfe){_0x12254f=_0x12254f-0x0;var _0x3a4fa2=_0xe3fc[_0x12254f];return _0x3a4fa2;};'use strict';var multer=require(_0xce3f('0x0'));var util=require(_0xce3f('0x1'));var path=require('path');var timeout=require(_0xce3f('0x2'));var express=require('express');var router=express[_0xce3f('0x3')]();var fs_extra=require(_0xce3f('0x4'));var auth=require(_0xce3f('0x5'));var interaction=require(_0xce3f('0x6'));var config=require(_0xce3f('0x7'));var controller=require(_0xce3f('0x8'));router[_0xce3f('0x9')]('/',auth['isAuthenticated'](),controller[_0xce3f('0xa')]);router[_0xce3f('0x9')](_0xce3f('0xb'),auth[_0xce3f('0xc')](),controller[_0xce3f('0xd')]);router[_0xce3f('0x9')]('/:id/fields',auth[_0xce3f('0xc')](),controller['getFields']);router[_0xce3f('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xce3f('0xe')]);router['get'](_0xce3f('0xf'),auth[_0xce3f('0xc')](),controller[_0xce3f('0x10')]);router[_0xce3f('0x9')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xce3f('0x11')]('/',auth[_0xce3f('0xc')](),controller['create']);router['post']('/:id/tags',auth[_0xce3f('0xc')](),controller[_0xce3f('0x12')]);router[_0xce3f('0x13')](_0xce3f('0xb'),auth[_0xce3f('0xc')](),controller[_0xce3f('0x14')]);router[_0xce3f('0x15')]('/:id',auth[_0xce3f('0xc')](),controller[_0xce3f('0x16')]);module[_0xce3f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ced3920..d70b30a 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 _0x3056=['sequelize','exports','STRING'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x3056,0xb1));var _0x6305=function(_0x28b9d2,_0x56a019){_0x28b9d2=_0x28b9d2-0x0;var _0x55f4b8=_0x3056[_0x28b9d2];return _0x55f4b8;};'use strict';var Sequelize=require(_0x6305('0x0'));module[_0x6305('0x1')]={'name':{'type':Sequelize[_0x6305('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1220=['STRING','sequelize'];(function(_0x3fc4b1,_0x2b3f55){var _0x57058a=function(_0x57d4e4){while(--_0x57d4e4){_0x3fc4b1['push'](_0x3fc4b1['shift']());}};_0x57058a(++_0x2b3f55);}(_0x1220,0x1ef));var _0x0122=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x1220[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x0122('0x0'));module['exports']={'name':{'type':Sequelize[_0x0122('0x1')]},'description':{'type':Sequelize[_0x0122('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index cbce30d..387f553 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 _0x0764=['fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','reject','update','stack','name','map','FreshdeskConfiguration','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getFields','findOne','FreshdeskField','pick','getSubjects','hasOwnProperty','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir'];(function(_0xcbbf98,_0x1961ca){var _0x56dce4=function(_0x5eb5e0){while(--_0x5eb5e0){_0xcbbf98['push'](_0xcbbf98['shift']());}};_0x56dce4(++_0x1961ca);}(_0x0764,0x174));var _0x4076=function(_0xeff6d4,_0x686596){_0xeff6d4=_0xeff6d4-0x0;var _0x3f5223=_0x0764[_0xeff6d4];return _0x3f5223;};'use strict';var pdf=require(_0x4076('0x0'));var emlformat=require(_0x4076('0x1'));var rimraf=require(_0x4076('0x2'));var zipdir=require(_0x4076('0x3'));var jsonpatch=require(_0x4076('0x4'));var rp=require('request-promise');var moment=require(_0x4076('0x5'));var BPromise=require(_0x4076('0x6'));var Mustache=require(_0x4076('0x7'));var util=require(_0x4076('0x8'));var path=require(_0x4076('0x9'));var sox=require('sox');var csv=require(_0x4076('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4076('0xb'));var _=require(_0x4076('0xc'));var squel=require(_0x4076('0xd'));var crypto=require(_0x4076('0xe'));var jsforce=require(_0x4076('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4076('0xa'));var querystring=require(_0x4076('0x10'));var Papa=require('papaparse');var Redis=require(_0x4076('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4076('0x12'));var as=require(_0x4076('0x13'));var hardwareService=require(_0x4076('0x14'));var logger=require(_0x4076('0x15'))(_0x4076('0x16'));var utils=require(_0x4076('0x17'));var config=require(_0x4076('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x4076('0x19'));var client=jayson[_0x4076('0x1a')][_0x4076('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4d586f,_0x344477,_0x2c0e63,_0xfdd247){return new BPromise(function(_0x595721,_0x19de92){var _0x4b9577=_0xfdd247||client;return _0x4b9577[_0x4076('0x1c')](_0x4d586f,_0x2c0e63)[_0x4076('0x1d')](function(_0x10e848){logger[_0x4076('0x1e')](_0x4076('0x1f'),_0x344477,_0x4076('0x20'));logger[_0x4076('0x21')](_0x4076('0x22'),_0x344477,_0x4076('0x20'),JSON[_0x4076('0x23')](_0x10e848));if(_0x10e848[_0x4076('0x24')]){if(_0x10e848[_0x4076('0x24')][_0x4076('0x25')]===0x1f4){logger[_0x4076('0x24')](_0x4076('0x1f'),_0x344477,_0x10e848['error'][_0x4076('0x26')]);return _0x19de92(_0x10e848[_0x4076('0x24')][_0x4076('0x26')]);}logger['error'](_0x4076('0x1f'),_0x344477,_0x10e848[_0x4076('0x24')][_0x4076('0x26')]);return _0x595721(_0x10e848[_0x4076('0x24')][_0x4076('0x26')]);}else{logger[_0x4076('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x344477,_0x4076('0x20'));_0x595721(_0x10e848[_0x4076('0x27')][_0x4076('0x26')]);}})['catch'](function(_0x37723a){logger[_0x4076('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x344477,_0x37723a);_0x19de92(_0x37723a);});});}function respondWithStatusCode(_0x7ee618,_0x11ed88){_0x11ed88=_0x11ed88||0xcc;return function(_0x54b684){if(_0x54b684){return _0x7ee618[_0x4076('0x28')](_0x11ed88);}return _0x7ee618[_0x4076('0x29')](_0x11ed88)[_0x4076('0x2a')]();};}function respondWithResult(_0x2e6ad9,_0x394670){_0x394670=_0x394670||0xc8;return function(_0x4b4911){if(_0x4b4911){return _0x2e6ad9['status'](_0x394670)[_0x4076('0x2b')](_0x4b4911);}};}function respondWithFilteredResult(_0x1bc29b,_0x1c9d45){return function(_0x2556c7){if(_0x2556c7){var _0x675d2=_0x2556c7[_0x4076('0x2c')],_0x58e5a5=_0x1c9d45[_0x4076('0x2d')],_0x937929=_0x1c9d45[_0x4076('0x2d')]+_0x1c9d45[_0x4076('0x2e')],_0x1c76bd;if(_0x937929>=_0x675d2){_0x937929=_0x675d2;_0x1c76bd=0xc8;}else{_0x1c76bd=0xce;}_0x1bc29b['status'](_0x1c76bd);return _0x1bc29b['set']('Content-Range',_0x58e5a5+'-'+_0x937929+'/'+_0x675d2)[_0x4076('0x2b')](_0x2556c7);}return null;};}function patchUpdates(_0x268134){return function(_0x4ba34d){try{jsonpatch['apply'](_0x4ba34d,_0x268134,!![]);}catch(_0x152156){return BPromise[_0x4076('0x2f')](_0x152156);}return _0x4ba34d['save']();};}function saveUpdates(_0x4ec9a2,_0x1afbc5){return function(_0xa5bb88){if(_0xa5bb88){return _0xa5bb88[_0x4076('0x30')](_0x4ec9a2)[_0x4076('0x1d')](function(_0x46c5ac){return _0x46c5ac;});}return null;};}function removeEntity(_0x2010eb,_0x5701f8){return function(_0x40ee16){if(_0x40ee16){return _0x40ee16['destroy']()[_0x4076('0x1d')](function(){_0x2010eb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x182c53,_0x49d99e){return function(_0x72bfac){if(!_0x72bfac){_0x182c53[_0x4076('0x28')](0x194);}return _0x72bfac;};}function handleError(_0x533a2d,_0x19328d){_0x19328d=_0x19328d||0x1f4;return function(_0x459a95){logger[_0x4076('0x24')](_0x459a95[_0x4076('0x31')]);if(_0x459a95[_0x4076('0x32')]){delete _0x459a95[_0x4076('0x32')];}_0x533a2d['status'](_0x19328d)['send'](_0x459a95);};}exports['index']=function(_0x12abd1,_0x2dfc17){var _0x202e3a={},_0x5ef0ac={},_0x55a0fb={'count':0x0,'rows':[]};var _0x45b6b9=_[_0x4076('0x33')](db[_0x4076('0x34')][_0x4076('0x35')],function(_0x3a4284){return{'name':_0x3a4284['fieldName'],'type':_0x3a4284[_0x4076('0x36')][_0x4076('0x37')]};});_0x5ef0ac[_0x4076('0x38')]=_['map'](_0x45b6b9,_0x4076('0x32'));_0x5ef0ac['query']=_[_0x4076('0x39')](_0x12abd1[_0x4076('0x3a')]);_0x5ef0ac['filters']=_['intersection'](_0x5ef0ac[_0x4076('0x38')],_0x5ef0ac[_0x4076('0x3a')]);_0x202e3a[_0x4076('0x3b')]=_[_0x4076('0x3c')](_0x5ef0ac[_0x4076('0x38')],qs[_0x4076('0x3d')](_0x12abd1[_0x4076('0x3a')][_0x4076('0x3d')]));_0x202e3a[_0x4076('0x3b')]=_0x202e3a[_0x4076('0x3b')][_0x4076('0x3e')]?_0x202e3a[_0x4076('0x3b')]:_0x5ef0ac[_0x4076('0x38')];if(!_0x12abd1[_0x4076('0x3a')]['hasOwnProperty'](_0x4076('0x3f'))){_0x202e3a['limit']=qs['limit'](_0x12abd1[_0x4076('0x3a')][_0x4076('0x2e')]);_0x202e3a[_0x4076('0x2d')]=qs[_0x4076('0x2d')](_0x12abd1[_0x4076('0x3a')][_0x4076('0x2d')]);}_0x202e3a[_0x4076('0x40')]=qs[_0x4076('0x41')](_0x12abd1['query'][_0x4076('0x41')]);_0x202e3a['where']=qs['filters'](_['pick'](_0x12abd1[_0x4076('0x3a')],_0x5ef0ac[_0x4076('0x42')]),_0x45b6b9);if(_0x12abd1[_0x4076('0x3a')][_0x4076('0x43')]){_0x202e3a[_0x4076('0x44')]=_['merge'](_0x202e3a[_0x4076('0x44')],{'$or':_[_0x4076('0x33')](_0x45b6b9,function(_0x53b739){if(_0x53b739[_0x4076('0x36')]!==_0x4076('0x45')){var _0x2dd4a1={};_0x2dd4a1[_0x53b739['name']]={'$like':'%'+_0x12abd1[_0x4076('0x3a')][_0x4076('0x43')]+'%'};return _0x2dd4a1;}})});}_0x202e3a=_[_0x4076('0x46')]({},_0x202e3a,_0x12abd1[_0x4076('0x47')]);var _0x58237d={'where':_0x202e3a[_0x4076('0x44')]};return db['FreshdeskConfiguration'][_0x4076('0x2c')](_0x58237d)[_0x4076('0x1d')](function(_0x22acba){_0x55a0fb[_0x4076('0x2c')]=_0x22acba;if(_0x12abd1[_0x4076('0x3a')][_0x4076('0x48')]){_0x202e3a[_0x4076('0x49')]=[{'all':!![]}];}return db[_0x4076('0x34')][_0x4076('0x4a')](_0x202e3a);})[_0x4076('0x1d')](function(_0x17d468){_0x55a0fb[_0x4076('0x4b')]=_0x17d468;return _0x55a0fb;})[_0x4076('0x1d')](respondWithFilteredResult(_0x2dfc17,_0x202e3a))[_0x4076('0x4c')](handleError(_0x2dfc17,null));};exports[_0x4076('0x4d')]=function(_0x51eb12,_0xcc4342){var _0x752783={'raw':![],'where':{'id':_0x51eb12[_0x4076('0x4e')]['id']}},_0x192aea={};_0x192aea[_0x4076('0x38')]=_[_0x4076('0x39')](db[_0x4076('0x34')][_0x4076('0x35')]);_0x192aea['query']=_['keys'](_0x51eb12[_0x4076('0x3a')]);_0x192aea[_0x4076('0x42')]=_['intersection'](_0x192aea['model'],_0x192aea[_0x4076('0x3a')]);_0x752783[_0x4076('0x3b')]=_[_0x4076('0x3c')](_0x192aea[_0x4076('0x38')],qs[_0x4076('0x3d')](_0x51eb12['query'][_0x4076('0x3d')]));_0x752783[_0x4076('0x3b')]=_0x752783[_0x4076('0x3b')]['length']?_0x752783['attributes']:_0x192aea[_0x4076('0x38')];if(_0x51eb12[_0x4076('0x3a')][_0x4076('0x48')]){_0x752783[_0x4076('0x49')]=[{'all':!![]}];}_0x752783=_[_0x4076('0x46')]({},_0x752783,_0x51eb12['options']);return db[_0x4076('0x34')][_0x4076('0x4f')](_0x752783)['then'](handleEntityNotFound(_0xcc4342,null))[_0x4076('0x1d')](respondWithResult(_0xcc4342,null))['catch'](handleError(_0xcc4342,null));};exports[_0x4076('0x50')]=function(_0x55e825,_0x4fa9a7){return db[_0x4076('0x34')][_0x4076('0x50')](_0x55e825[_0x4076('0x51')],{})['then'](respondWithResult(_0x4fa9a7,0xc9))['catch'](handleError(_0x4fa9a7,null));};exports[_0x4076('0x30')]=function(_0xe3752,_0x9b3408){if(_0xe3752[_0x4076('0x51')]['id']){delete _0xe3752[_0x4076('0x51')]['id'];}return db[_0x4076('0x34')]['find']({'where':{'id':_0xe3752[_0x4076('0x4e')]['id']}})['then'](handleEntityNotFound(_0x9b3408,null))[_0x4076('0x1d')](saveUpdates(_0xe3752[_0x4076('0x51')],null))['then'](respondWithResult(_0x9b3408,null))[_0x4076('0x4c')](handleError(_0x9b3408,null));};exports[_0x4076('0x52')]=function(_0x3c99b7,_0x3b6d12){return db['FreshdeskConfiguration'][_0x4076('0x4f')]({'where':{'id':_0x3c99b7[_0x4076('0x4e')]['id']}})[_0x4076('0x1d')](handleEntityNotFound(_0x3b6d12,null))[_0x4076('0x1d')](removeEntity(_0x3b6d12,null))[_0x4076('0x4c')](handleError(_0x3b6d12,null));};exports[_0x4076('0x53')]=function(_0x3f3f7a,_0x70eb1d,_0x40d8ff){var _0x39ca6a={};var _0x108ecd={};var _0x3ffe9f;var _0x2f9699;return db[_0x4076('0x34')][_0x4076('0x54')]({'where':{'id':_0x3f3f7a[_0x4076('0x4e')]['id']}})['then'](handleEntityNotFound(_0x70eb1d,null))[_0x4076('0x1d')](function(_0x101c86){if(_0x101c86){_0x3ffe9f=_0x101c86;_0x108ecd['model']=_[_0x4076('0x39')](db[_0x4076('0x55')][_0x4076('0x35')]);_0x108ecd[_0x4076('0x3a')]=_[_0x4076('0x39')](_0x3f3f7a[_0x4076('0x3a')]);_0x108ecd[_0x4076('0x42')]=_[_0x4076('0x3c')](_0x108ecd[_0x4076('0x38')],_0x108ecd['query']);_0x39ca6a[_0x4076('0x3b')]=_[_0x4076('0x3c')](_0x108ecd['model'],qs[_0x4076('0x3d')](_0x3f3f7a[_0x4076('0x3a')][_0x4076('0x3d')]));_0x39ca6a['attributes']=_0x39ca6a[_0x4076('0x3b')][_0x4076('0x3e')]?_0x39ca6a[_0x4076('0x3b')]:_0x108ecd[_0x4076('0x38')];_0x39ca6a[_0x4076('0x40')]=qs['sort'](_0x3f3f7a[_0x4076('0x3a')][_0x4076('0x41')]);_0x39ca6a[_0x4076('0x44')]=qs[_0x4076('0x42')](_[_0x4076('0x56')](_0x3f3f7a['query'],_0x108ecd[_0x4076('0x42')]));if(_0x3f3f7a[_0x4076('0x3a')][_0x4076('0x43')]){_0x39ca6a[_0x4076('0x44')]=_[_0x4076('0x46')](_0x39ca6a['where'],{'$or':_[_0x4076('0x33')](_0x39ca6a[_0x4076('0x3b')],function(_0x5b30a1){var _0x214b9d={};_0x214b9d[_0x5b30a1]={'$like':'%'+_0x3f3f7a['query'][_0x4076('0x43')]+'%'};return _0x214b9d;})});}_0x39ca6a=_[_0x4076('0x46')]({},_0x39ca6a,_0x3f3f7a[_0x4076('0x47')]);return _0x3ffe9f['getFields'](_0x39ca6a);}})[_0x4076('0x1d')](function(_0x46dabf){if(_0x46dabf){_0x2f9699=_0x46dabf['length'];if(!_0x3f3f7a[_0x4076('0x3a')]['hasOwnProperty'](_0x4076('0x3f'))){_0x39ca6a[_0x4076('0x2e')]=qs[_0x4076('0x2e')](_0x3f3f7a[_0x4076('0x3a')][_0x4076('0x2e')]);_0x39ca6a['offset']=qs[_0x4076('0x2d')](_0x3f3f7a[_0x4076('0x3a')][_0x4076('0x2d')]);}return _0x3ffe9f[_0x4076('0x53')](_0x39ca6a);}})[_0x4076('0x1d')](function(_0x5a98a6){if(_0x5a98a6){return _0x5a98a6?{'count':_0x2f9699,'rows':_0x5a98a6}:null;}})[_0x4076('0x1d')](respondWithResult(_0x70eb1d,null))[_0x4076('0x4c')](handleError(_0x70eb1d,null));};exports[_0x4076('0x57')]=function(_0x350f92,_0x3ff2ba,_0x61336){var _0x2d9eda={};var _0x370b1d={};var _0x3021b2;var _0x4b2340;return db[_0x4076('0x34')]['findOne']({'where':{'id':_0x350f92[_0x4076('0x4e')]['id']}})[_0x4076('0x1d')](handleEntityNotFound(_0x3ff2ba,null))[_0x4076('0x1d')](function(_0x3ef53c){if(_0x3ef53c){_0x3021b2=_0x3ef53c;_0x370b1d['model']=_[_0x4076('0x39')](db[_0x4076('0x55')][_0x4076('0x35')]);_0x370b1d['query']=_[_0x4076('0x39')](_0x350f92[_0x4076('0x3a')]);_0x370b1d['filters']=_['intersection'](_0x370b1d['model'],_0x370b1d[_0x4076('0x3a')]);_0x2d9eda[_0x4076('0x3b')]=_[_0x4076('0x3c')](_0x370b1d[_0x4076('0x38')],qs[_0x4076('0x3d')](_0x350f92[_0x4076('0x3a')][_0x4076('0x3d')]));_0x2d9eda[_0x4076('0x3b')]=_0x2d9eda[_0x4076('0x3b')][_0x4076('0x3e')]?_0x2d9eda[_0x4076('0x3b')]:_0x370b1d['model'];_0x2d9eda['order']=qs[_0x4076('0x41')](_0x350f92[_0x4076('0x3a')][_0x4076('0x41')]);_0x2d9eda[_0x4076('0x44')]=qs[_0x4076('0x42')](_['pick'](_0x350f92[_0x4076('0x3a')],_0x370b1d[_0x4076('0x42')]));if(_0x350f92[_0x4076('0x3a')][_0x4076('0x43')]){_0x2d9eda[_0x4076('0x44')]=_[_0x4076('0x46')](_0x2d9eda[_0x4076('0x44')],{'$or':_['map'](_0x2d9eda[_0x4076('0x3b')],function(_0xfe0a02){var _0x12739b={};_0x12739b[_0xfe0a02]={'$like':'%'+_0x350f92[_0x4076('0x3a')][_0x4076('0x43')]+'%'};return _0x12739b;})});}_0x2d9eda=_['merge']({},_0x2d9eda,_0x350f92[_0x4076('0x47')]);return _0x3021b2['getSubjects'](_0x2d9eda);}})['then'](function(_0x96fe3){if(_0x96fe3){_0x4b2340=_0x96fe3['length'];if(!_0x350f92[_0x4076('0x3a')][_0x4076('0x58')](_0x4076('0x3f'))){_0x2d9eda[_0x4076('0x2e')]=qs[_0x4076('0x2e')](_0x350f92[_0x4076('0x3a')][_0x4076('0x2e')]);_0x2d9eda[_0x4076('0x2d')]=qs[_0x4076('0x2d')](_0x350f92[_0x4076('0x3a')][_0x4076('0x2d')]);}return _0x3021b2[_0x4076('0x57')](_0x2d9eda);}})[_0x4076('0x1d')](function(_0x3847b0){if(_0x3847b0){return _0x3847b0?{'count':_0x4b2340,'rows':_0x3847b0}:null;}})[_0x4076('0x1d')](respondWithResult(_0x3ff2ba,null))[_0x4076('0x4c')](handleError(_0x3ff2ba,null));};exports[_0x4076('0x59')]=function(_0xff5e23,_0xf358d7,_0x2184e0){var _0x2c7604={};var _0xb223e4={};var _0x2b6fad;var _0x5adb6d;return db[_0x4076('0x34')][_0x4076('0x54')]({'where':{'id':_0xff5e23[_0x4076('0x4e')]['id']}})[_0x4076('0x1d')](handleEntityNotFound(_0xf358d7,null))['then'](function(_0x16c0f0){if(_0x16c0f0){_0x2b6fad=_0x16c0f0;_0xb223e4[_0x4076('0x38')]=_['keys'](db[_0x4076('0x55')]['rawAttributes']);_0xb223e4[_0x4076('0x3a')]=_['keys'](_0xff5e23[_0x4076('0x3a')]);_0xb223e4[_0x4076('0x42')]=_['intersection'](_0xb223e4['model'],_0xb223e4[_0x4076('0x3a')]);_0x2c7604[_0x4076('0x3b')]=_[_0x4076('0x3c')](_0xb223e4[_0x4076('0x38')],qs[_0x4076('0x3d')](_0xff5e23[_0x4076('0x3a')]['fields']));_0x2c7604['attributes']=_0x2c7604[_0x4076('0x3b')][_0x4076('0x3e')]?_0x2c7604[_0x4076('0x3b')]:_0xb223e4[_0x4076('0x38')];_0x2c7604[_0x4076('0x40')]=qs['sort'](_0xff5e23[_0x4076('0x3a')][_0x4076('0x41')]);_0x2c7604[_0x4076('0x44')]=qs[_0x4076('0x42')](_[_0x4076('0x56')](_0xff5e23[_0x4076('0x3a')],_0xb223e4[_0x4076('0x42')]));if(_0xff5e23[_0x4076('0x3a')]['filter']){_0x2c7604[_0x4076('0x44')]=_[_0x4076('0x46')](_0x2c7604[_0x4076('0x44')],{'$or':_['map'](_0x2c7604[_0x4076('0x3b')],function(_0x45618a){var _0x536f23={};_0x536f23[_0x45618a]={'$like':'%'+_0xff5e23['query']['filter']+'%'};return _0x536f23;})});}_0x2c7604=_['merge']({},_0x2c7604,_0xff5e23[_0x4076('0x47')]);return _0x2b6fad[_0x4076('0x59')](_0x2c7604);}})[_0x4076('0x1d')](function(_0x469190){if(_0x469190){_0x5adb6d=_0x469190[_0x4076('0x3e')];if(!_0xff5e23[_0x4076('0x3a')][_0x4076('0x58')]('nolimit')){_0x2c7604[_0x4076('0x2e')]=qs[_0x4076('0x2e')](_0xff5e23['query'][_0x4076('0x2e')]);_0x2c7604[_0x4076('0x2d')]=qs[_0x4076('0x2d')](_0xff5e23[_0x4076('0x3a')][_0x4076('0x2d')]);}return _0x2b6fad['getDescriptions'](_0x2c7604);}})[_0x4076('0x1d')](function(_0x44db86){if(_0x44db86){return _0x44db86?{'count':_0x5adb6d,'rows':_0x44db86}:null;}})[_0x4076('0x1d')](respondWithResult(_0xf358d7,null))[_0x4076('0x4c')](handleError(_0xf358d7,null));};exports['getTags']=function(_0x29c0bb,_0x694059,_0x3974a9){var _0x58cfb5={};var _0x1b0635={};var _0x13a5c3;var _0xb1e256;return db[_0x4076('0x34')]['findOne']({'where':{'id':_0x29c0bb[_0x4076('0x4e')]['id']}})[_0x4076('0x1d')](handleEntityNotFound(_0x694059,null))[_0x4076('0x1d')](function(_0x537160){if(_0x537160){_0x13a5c3=_0x537160;_0x1b0635[_0x4076('0x38')]=_['keys'](db[_0x4076('0x5a')][_0x4076('0x35')]);_0x1b0635[_0x4076('0x3a')]=_[_0x4076('0x39')](_0x29c0bb[_0x4076('0x3a')]);_0x1b0635[_0x4076('0x42')]=_[_0x4076('0x3c')](_0x1b0635[_0x4076('0x38')],_0x1b0635['query']);_0x58cfb5[_0x4076('0x3b')]=_[_0x4076('0x3c')](_0x1b0635['model'],qs['fields'](_0x29c0bb[_0x4076('0x3a')][_0x4076('0x3d')]));_0x58cfb5[_0x4076('0x3b')]=_0x58cfb5[_0x4076('0x3b')][_0x4076('0x3e')]?_0x58cfb5[_0x4076('0x3b')]:_0x1b0635[_0x4076('0x38')];_0x58cfb5[_0x4076('0x40')]=qs[_0x4076('0x41')](_0x29c0bb['query']['sort']);_0x58cfb5['where']=qs[_0x4076('0x42')](_[_0x4076('0x56')](_0x29c0bb['query'],_0x1b0635[_0x4076('0x42')]));if(_0x29c0bb['query'][_0x4076('0x43')]){_0x58cfb5[_0x4076('0x44')]=_['merge'](_0x58cfb5[_0x4076('0x44')],{'$or':_[_0x4076('0x33')](_0x58cfb5['attributes'],function(_0x22aa1b){var _0x156293={};_0x156293[_0x22aa1b]={'$like':'%'+_0x29c0bb[_0x4076('0x3a')][_0x4076('0x43')]+'%'};return _0x156293;})});}_0x58cfb5=_['merge']({},_0x58cfb5,_0x29c0bb[_0x4076('0x47')]);return _0x13a5c3[_0x4076('0x5b')](_0x58cfb5);}})[_0x4076('0x1d')](function(_0x4f2cc6){if(_0x4f2cc6){_0xb1e256=_0x4f2cc6['length'];if(!_0x29c0bb[_0x4076('0x3a')][_0x4076('0x58')](_0x4076('0x3f'))){_0x58cfb5[_0x4076('0x2e')]=qs[_0x4076('0x2e')](_0x29c0bb[_0x4076('0x3a')][_0x4076('0x2e')]);_0x58cfb5[_0x4076('0x2d')]=qs[_0x4076('0x2d')](_0x29c0bb[_0x4076('0x3a')][_0x4076('0x2d')]);}return _0x13a5c3['getTags'](_0x58cfb5);}})[_0x4076('0x1d')](function(_0x4a5da1){if(_0x4a5da1){return _0x4a5da1?{'count':_0xb1e256,'rows':_0x4a5da1}:null;}})['then'](respondWithResult(_0x694059,null))[_0x4076('0x4c')](handleError(_0x694059,null));};exports[_0x4076('0x5c')]=function(_0x2be357,_0x1e1d89,_0x29b9b6){if(_0x2be357[_0x4076('0x51')]['id']){delete _0x2be357['body']['id'];}return db[_0x4076('0x34')][_0x4076('0x54')]({'where':{'id':_0x2be357[_0x4076('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1e1d89,null))[_0x4076('0x1d')](function(_0x438211){if(_0x438211){return _0x438211['setTags'](_0x2be357[_0x4076('0x51')][_0x4076('0x5d')]||[]);}return null;})[_0x4076('0x1d')](respondWithResult(_0x1e1d89,null))[_0x4076('0x4c')](handleError(_0x1e1d89,null));}; \ No newline at end of file +var _0x6e2e=['include','findAll','rows','catch','show','params','length','find','create','body','findOne','FreshdeskField','getFields','getSubjects','rawAttributes','getDescriptions','getTags','Tag','ids','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','jayson/promise','client','http','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','FreshdeskConfiguration','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll'];(function(_0x4d5cac,_0x5bf7bd){var _0x513307=function(_0x259d33){while(--_0x259d33){_0x4d5cac['push'](_0x4d5cac['shift']());}};_0x513307(++_0x5bf7bd);}(_0x6e2e,0xd9));var _0xe6e2=function(_0x2806f6,_0x294105){_0x2806f6=_0x2806f6-0x0;var _0x32ebb1=_0x6e2e[_0x2806f6];return _0x32ebb1;};'use strict';var pdf=require(_0xe6e2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe6e2('0x1'));var zipdir=require(_0xe6e2('0x2'));var jsonpatch=require(_0xe6e2('0x3'));var rp=require('request-promise');var moment=require(_0xe6e2('0x4'));var BPromise=require(_0xe6e2('0x5'));var Mustache=require(_0xe6e2('0x6'));var util=require(_0xe6e2('0x7'));var path=require(_0xe6e2('0x8'));var sox=require(_0xe6e2('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe6e2('0xa'));var _=require(_0xe6e2('0xb'));var squel=require(_0xe6e2('0xc'));var crypto=require(_0xe6e2('0xd'));var jsforce=require(_0xe6e2('0xe'));var deskjs=require(_0xe6e2('0xf'));var toCsv=require(_0xe6e2('0x10'));var querystring=require(_0xe6e2('0x11'));var Papa=require('papaparse');var Redis=require(_0xe6e2('0x12'));var authService=require(_0xe6e2('0x13'));var qs=require(_0xe6e2('0x14'));var as=require(_0xe6e2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6e2('0x16'))(_0xe6e2('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe6e2('0x18'))['db'];var jayson=require(_0xe6e2('0x19'));var client=jayson[_0xe6e2('0x1a')][_0xe6e2('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x573b55,_0x23b444,_0x313fe5,_0x45c840){return new BPromise(function(_0x140aea,_0x30ebc5){var _0xe52288=_0x45c840||client;return _0xe52288['request'](_0x573b55,_0x313fe5)['then'](function(_0x544400){logger[_0xe6e2('0x1c')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x23b444,_0xe6e2('0x1d'));logger[_0xe6e2('0x1e')](_0xe6e2('0x1f'),_0x23b444,'request\x20sent',JSON[_0xe6e2('0x20')](_0x544400));if(_0x544400['error']){if(_0x544400[_0xe6e2('0x21')][_0xe6e2('0x22')]===0x1f4){logger[_0xe6e2('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x23b444,_0x544400[_0xe6e2('0x21')][_0xe6e2('0x23')]);return _0x30ebc5(_0x544400['error'][_0xe6e2('0x23')]);}logger[_0xe6e2('0x21')](_0xe6e2('0x24'),_0x23b444,_0x544400[_0xe6e2('0x21')][_0xe6e2('0x23')]);return _0x140aea(_0x544400['error'][_0xe6e2('0x23')]);}else{logger[_0xe6e2('0x1c')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x23b444,_0xe6e2('0x1d'));_0x140aea(_0x544400[_0xe6e2('0x25')][_0xe6e2('0x23')]);}})['catch'](function(_0x4ba63a){logger[_0xe6e2('0x21')](_0xe6e2('0x24'),_0x23b444,_0x4ba63a);_0x30ebc5(_0x4ba63a);});});}function respondWithStatusCode(_0x4846b7,_0x48adf8){_0x48adf8=_0x48adf8||0xcc;return function(_0x2b2757){if(_0x2b2757){return _0x4846b7['sendStatus'](_0x48adf8);}return _0x4846b7[_0xe6e2('0x26')](_0x48adf8)[_0xe6e2('0x27')]();};}function respondWithResult(_0x23b524,_0x408b32){_0x408b32=_0x408b32||0xc8;return function(_0x263187){if(_0x263187){return _0x23b524[_0xe6e2('0x26')](_0x408b32)[_0xe6e2('0x28')](_0x263187);}};}function respondWithFilteredResult(_0x4a9344,_0x981f69){return function(_0x45e26d){if(_0x45e26d){var _0x268a03=_0x45e26d['count'],_0x48dd5e=_0x981f69['offset'],_0x269c5c=_0x981f69[_0xe6e2('0x29')]+_0x981f69[_0xe6e2('0x2a')],_0x394178;if(_0x269c5c>=_0x268a03){_0x269c5c=_0x268a03;_0x394178=0xc8;}else{_0x394178=0xce;}_0x4a9344['status'](_0x394178);return _0x4a9344[_0xe6e2('0x2b')](_0xe6e2('0x2c'),_0x48dd5e+'-'+_0x269c5c+'/'+_0x268a03)[_0xe6e2('0x28')](_0x45e26d);}return null;};}function patchUpdates(_0x3f9539){return function(_0x584970){try{jsonpatch[_0xe6e2('0x2d')](_0x584970,_0x3f9539,!![]);}catch(_0x6809c2){return BPromise[_0xe6e2('0x2e')](_0x6809c2);}return _0x584970[_0xe6e2('0x2f')]();};}function saveUpdates(_0x779857,_0x1fce16){return function(_0x377e65){if(_0x377e65){return _0x377e65[_0xe6e2('0x30')](_0x779857)[_0xe6e2('0x31')](function(_0x5ef0df){return _0x5ef0df;});}return null;};}function removeEntity(_0x2dfb48,_0x1cabdc){return function(_0x9416cb){if(_0x9416cb){return _0x9416cb[_0xe6e2('0x32')]()[_0xe6e2('0x31')](function(){_0x2dfb48['status'](0xcc)[_0xe6e2('0x27')]();});}};}function handleEntityNotFound(_0xc863cb,_0x515337){return function(_0x5604b9){if(!_0x5604b9){_0xc863cb[_0xe6e2('0x33')](0x194);}return _0x5604b9;};}function handleError(_0x8e35f2,_0x426279){_0x426279=_0x426279||0x1f4;return function(_0x433d8b){logger[_0xe6e2('0x21')](_0x433d8b[_0xe6e2('0x34')]);if(_0x433d8b[_0xe6e2('0x35')]){delete _0x433d8b[_0xe6e2('0x35')];}_0x8e35f2[_0xe6e2('0x26')](_0x426279)[_0xe6e2('0x36')](_0x433d8b);};}exports[_0xe6e2('0x37')]=function(_0x3ae4c1,_0x203392){var _0x52032a={},_0x43cf72={},_0x53af51={'count':0x0,'rows':[]};var _0x826422=_[_0xe6e2('0x38')](db[_0xe6e2('0x39')]['rawAttributes'],function(_0x254355){return{'name':_0x254355[_0xe6e2('0x3a')],'type':_0x254355[_0xe6e2('0x3b')][_0xe6e2('0x3c')]};});_0x43cf72[_0xe6e2('0x3d')]=_[_0xe6e2('0x38')](_0x826422,_0xe6e2('0x35'));_0x43cf72[_0xe6e2('0x3e')]=_[_0xe6e2('0x3f')](_0x3ae4c1[_0xe6e2('0x3e')]);_0x43cf72['filters']=_[_0xe6e2('0x40')](_0x43cf72['model'],_0x43cf72[_0xe6e2('0x3e')]);_0x52032a['attributes']=_[_0xe6e2('0x40')](_0x43cf72[_0xe6e2('0x3d')],qs[_0xe6e2('0x41')](_0x3ae4c1[_0xe6e2('0x3e')][_0xe6e2('0x41')]));_0x52032a[_0xe6e2('0x42')]=_0x52032a['attributes']['length']?_0x52032a[_0xe6e2('0x42')]:_0x43cf72[_0xe6e2('0x3d')];if(!_0x3ae4c1[_0xe6e2('0x3e')][_0xe6e2('0x43')](_0xe6e2('0x44'))){_0x52032a[_0xe6e2('0x2a')]=qs[_0xe6e2('0x2a')](_0x3ae4c1['query'][_0xe6e2('0x2a')]);_0x52032a[_0xe6e2('0x29')]=qs[_0xe6e2('0x29')](_0x3ae4c1['query']['offset']);}_0x52032a[_0xe6e2('0x45')]=qs[_0xe6e2('0x46')](_0x3ae4c1['query'][_0xe6e2('0x46')]);_0x52032a[_0xe6e2('0x47')]=qs[_0xe6e2('0x48')](_[_0xe6e2('0x49')](_0x3ae4c1['query'],_0x43cf72[_0xe6e2('0x48')]),_0x826422);if(_0x3ae4c1[_0xe6e2('0x3e')][_0xe6e2('0x4a')]){_0x52032a[_0xe6e2('0x47')]=_['merge'](_0x52032a['where'],{'$or':_[_0xe6e2('0x38')](_0x826422,function(_0x423180){if(_0x423180[_0xe6e2('0x3b')]!==_0xe6e2('0x4b')){var _0x55a677={};_0x55a677[_0x423180[_0xe6e2('0x35')]]={'$like':'%'+_0x3ae4c1[_0xe6e2('0x3e')][_0xe6e2('0x4a')]+'%'};return _0x55a677;}})});}_0x52032a=_[_0xe6e2('0x4c')]({},_0x52032a,_0x3ae4c1[_0xe6e2('0x4d')]);var _0x45eeb5={'where':_0x52032a[_0xe6e2('0x47')]};return db[_0xe6e2('0x39')][_0xe6e2('0x4e')](_0x45eeb5)['then'](function(_0x52506b){_0x53af51[_0xe6e2('0x4e')]=_0x52506b;if(_0x3ae4c1[_0xe6e2('0x3e')][_0xe6e2('0x4f')]){_0x52032a[_0xe6e2('0x50')]=[{'all':!![]}];}return db[_0xe6e2('0x39')][_0xe6e2('0x51')](_0x52032a);})[_0xe6e2('0x31')](function(_0x4e0990){_0x53af51[_0xe6e2('0x52')]=_0x4e0990;return _0x53af51;})[_0xe6e2('0x31')](respondWithFilteredResult(_0x203392,_0x52032a))[_0xe6e2('0x53')](handleError(_0x203392,null));};exports[_0xe6e2('0x54')]=function(_0x42a6ac,_0x49aa73){var _0x500683={'raw':![],'where':{'id':_0x42a6ac[_0xe6e2('0x55')]['id']}},_0x483667={};_0x483667['model']=_[_0xe6e2('0x3f')](db[_0xe6e2('0x39')]['rawAttributes']);_0x483667[_0xe6e2('0x3e')]=_[_0xe6e2('0x3f')](_0x42a6ac['query']);_0x483667[_0xe6e2('0x48')]=_[_0xe6e2('0x40')](_0x483667[_0xe6e2('0x3d')],_0x483667[_0xe6e2('0x3e')]);_0x500683[_0xe6e2('0x42')]=_[_0xe6e2('0x40')](_0x483667[_0xe6e2('0x3d')],qs[_0xe6e2('0x41')](_0x42a6ac[_0xe6e2('0x3e')]['fields']));_0x500683['attributes']=_0x500683[_0xe6e2('0x42')][_0xe6e2('0x56')]?_0x500683[_0xe6e2('0x42')]:_0x483667['model'];if(_0x42a6ac['query'][_0xe6e2('0x4f')]){_0x500683[_0xe6e2('0x50')]=[{'all':!![]}];}_0x500683=_[_0xe6e2('0x4c')]({},_0x500683,_0x42a6ac[_0xe6e2('0x4d')]);return db['FreshdeskConfiguration'][_0xe6e2('0x57')](_0x500683)[_0xe6e2('0x31')](handleEntityNotFound(_0x49aa73,null))['then'](respondWithResult(_0x49aa73,null))[_0xe6e2('0x53')](handleError(_0x49aa73,null));};exports[_0xe6e2('0x58')]=function(_0x5b8474,_0x2aaaff){return db[_0xe6e2('0x39')][_0xe6e2('0x58')](_0x5b8474[_0xe6e2('0x59')],{})[_0xe6e2('0x31')](respondWithResult(_0x2aaaff,0xc9))[_0xe6e2('0x53')](handleError(_0x2aaaff,null));};exports[_0xe6e2('0x30')]=function(_0x5210e0,_0x35a534){if(_0x5210e0['body']['id']){delete _0x5210e0[_0xe6e2('0x59')]['id'];}return db['FreshdeskConfiguration'][_0xe6e2('0x57')]({'where':{'id':_0x5210e0[_0xe6e2('0x55')]['id']}})['then'](handleEntityNotFound(_0x35a534,null))['then'](saveUpdates(_0x5210e0[_0xe6e2('0x59')],null))[_0xe6e2('0x31')](respondWithResult(_0x35a534,null))[_0xe6e2('0x53')](handleError(_0x35a534,null));};exports['destroy']=function(_0x2f1c77,_0x435f69){return db[_0xe6e2('0x39')][_0xe6e2('0x57')]({'where':{'id':_0x2f1c77[_0xe6e2('0x55')]['id']}})[_0xe6e2('0x31')](handleEntityNotFound(_0x435f69,null))[_0xe6e2('0x31')](removeEntity(_0x435f69,null))[_0xe6e2('0x53')](handleError(_0x435f69,null));};exports['getFields']=function(_0x5538dd,_0x39a5be,_0xd20701){var _0xc2b6a5={};var _0x244b4b={};var _0x319a7d;var _0x27ec40;return db[_0xe6e2('0x39')][_0xe6e2('0x5a')]({'where':{'id':_0x5538dd[_0xe6e2('0x55')]['id']}})[_0xe6e2('0x31')](handleEntityNotFound(_0x39a5be,null))[_0xe6e2('0x31')](function(_0x541a04){if(_0x541a04){_0x319a7d=_0x541a04;_0x244b4b[_0xe6e2('0x3d')]=_[_0xe6e2('0x3f')](db[_0xe6e2('0x5b')]['rawAttributes']);_0x244b4b[_0xe6e2('0x3e')]=_[_0xe6e2('0x3f')](_0x5538dd[_0xe6e2('0x3e')]);_0x244b4b[_0xe6e2('0x48')]=_[_0xe6e2('0x40')](_0x244b4b[_0xe6e2('0x3d')],_0x244b4b['query']);_0xc2b6a5[_0xe6e2('0x42')]=_['intersection'](_0x244b4b[_0xe6e2('0x3d')],qs['fields'](_0x5538dd['query'][_0xe6e2('0x41')]));_0xc2b6a5[_0xe6e2('0x42')]=_0xc2b6a5['attributes'][_0xe6e2('0x56')]?_0xc2b6a5['attributes']:_0x244b4b['model'];_0xc2b6a5['order']=qs[_0xe6e2('0x46')](_0x5538dd['query'][_0xe6e2('0x46')]);_0xc2b6a5[_0xe6e2('0x47')]=qs[_0xe6e2('0x48')](_[_0xe6e2('0x49')](_0x5538dd[_0xe6e2('0x3e')],_0x244b4b['filters']));if(_0x5538dd[_0xe6e2('0x3e')][_0xe6e2('0x4a')]){_0xc2b6a5[_0xe6e2('0x47')]=_[_0xe6e2('0x4c')](_0xc2b6a5[_0xe6e2('0x47')],{'$or':_['map'](_0xc2b6a5[_0xe6e2('0x42')],function(_0x2629cb){var _0x313caf={};_0x313caf[_0x2629cb]={'$like':'%'+_0x5538dd[_0xe6e2('0x3e')][_0xe6e2('0x4a')]+'%'};return _0x313caf;})});}_0xc2b6a5=_[_0xe6e2('0x4c')]({},_0xc2b6a5,_0x5538dd['options']);return _0x319a7d[_0xe6e2('0x5c')](_0xc2b6a5);}})[_0xe6e2('0x31')](function(_0x1fde34){if(_0x1fde34){_0x27ec40=_0x1fde34['length'];if(!_0x5538dd['query'][_0xe6e2('0x43')](_0xe6e2('0x44'))){_0xc2b6a5['limit']=qs[_0xe6e2('0x2a')](_0x5538dd['query']['limit']);_0xc2b6a5[_0xe6e2('0x29')]=qs['offset'](_0x5538dd['query'][_0xe6e2('0x29')]);}return _0x319a7d['getFields'](_0xc2b6a5);}})[_0xe6e2('0x31')](function(_0xf50a60){if(_0xf50a60){return _0xf50a60?{'count':_0x27ec40,'rows':_0xf50a60}:null;}})[_0xe6e2('0x31')](respondWithResult(_0x39a5be,null))[_0xe6e2('0x53')](handleError(_0x39a5be,null));};exports[_0xe6e2('0x5d')]=function(_0x55e15c,_0x67916d,_0x3e85d1){var _0x2818ca={};var _0x24df2d={};var _0x9cbba8;var _0x45044b;return db[_0xe6e2('0x39')][_0xe6e2('0x5a')]({'where':{'id':_0x55e15c[_0xe6e2('0x55')]['id']}})[_0xe6e2('0x31')](handleEntityNotFound(_0x67916d,null))[_0xe6e2('0x31')](function(_0x241ebd){if(_0x241ebd){_0x9cbba8=_0x241ebd;_0x24df2d[_0xe6e2('0x3d')]=_[_0xe6e2('0x3f')](db['FreshdeskField'][_0xe6e2('0x5e')]);_0x24df2d['query']=_[_0xe6e2('0x3f')](_0x55e15c[_0xe6e2('0x3e')]);_0x24df2d[_0xe6e2('0x48')]=_['intersection'](_0x24df2d[_0xe6e2('0x3d')],_0x24df2d[_0xe6e2('0x3e')]);_0x2818ca[_0xe6e2('0x42')]=_[_0xe6e2('0x40')](_0x24df2d[_0xe6e2('0x3d')],qs['fields'](_0x55e15c[_0xe6e2('0x3e')][_0xe6e2('0x41')]));_0x2818ca[_0xe6e2('0x42')]=_0x2818ca[_0xe6e2('0x42')][_0xe6e2('0x56')]?_0x2818ca['attributes']:_0x24df2d[_0xe6e2('0x3d')];_0x2818ca[_0xe6e2('0x45')]=qs[_0xe6e2('0x46')](_0x55e15c['query'][_0xe6e2('0x46')]);_0x2818ca['where']=qs[_0xe6e2('0x48')](_[_0xe6e2('0x49')](_0x55e15c[_0xe6e2('0x3e')],_0x24df2d[_0xe6e2('0x48')]));if(_0x55e15c['query'][_0xe6e2('0x4a')]){_0x2818ca['where']=_[_0xe6e2('0x4c')](_0x2818ca[_0xe6e2('0x47')],{'$or':_[_0xe6e2('0x38')](_0x2818ca[_0xe6e2('0x42')],function(_0x382eef){var _0x50ebb9={};_0x50ebb9[_0x382eef]={'$like':'%'+_0x55e15c['query'][_0xe6e2('0x4a')]+'%'};return _0x50ebb9;})});}_0x2818ca=_[_0xe6e2('0x4c')]({},_0x2818ca,_0x55e15c[_0xe6e2('0x4d')]);return _0x9cbba8['getSubjects'](_0x2818ca);}})['then'](function(_0x371010){if(_0x371010){_0x45044b=_0x371010[_0xe6e2('0x56')];if(!_0x55e15c[_0xe6e2('0x3e')][_0xe6e2('0x43')](_0xe6e2('0x44'))){_0x2818ca[_0xe6e2('0x2a')]=qs[_0xe6e2('0x2a')](_0x55e15c[_0xe6e2('0x3e')][_0xe6e2('0x2a')]);_0x2818ca[_0xe6e2('0x29')]=qs[_0xe6e2('0x29')](_0x55e15c['query'][_0xe6e2('0x29')]);}return _0x9cbba8[_0xe6e2('0x5d')](_0x2818ca);}})['then'](function(_0x2dce8a){if(_0x2dce8a){return _0x2dce8a?{'count':_0x45044b,'rows':_0x2dce8a}:null;}})['then'](respondWithResult(_0x67916d,null))['catch'](handleError(_0x67916d,null));};exports[_0xe6e2('0x5f')]=function(_0x5ccbcf,_0x2142b2,_0x1bf86e){var _0x4ba7d7={};var _0x4a3265={};var _0xb76137;var _0x12f2aa;return db[_0xe6e2('0x39')]['findOne']({'where':{'id':_0x5ccbcf['params']['id']}})[_0xe6e2('0x31')](handleEntityNotFound(_0x2142b2,null))['then'](function(_0x300586){if(_0x300586){_0xb76137=_0x300586;_0x4a3265[_0xe6e2('0x3d')]=_[_0xe6e2('0x3f')](db[_0xe6e2('0x5b')]['rawAttributes']);_0x4a3265[_0xe6e2('0x3e')]=_[_0xe6e2('0x3f')](_0x5ccbcf[_0xe6e2('0x3e')]);_0x4a3265['filters']=_[_0xe6e2('0x40')](_0x4a3265[_0xe6e2('0x3d')],_0x4a3265[_0xe6e2('0x3e')]);_0x4ba7d7[_0xe6e2('0x42')]=_['intersection'](_0x4a3265[_0xe6e2('0x3d')],qs[_0xe6e2('0x41')](_0x5ccbcf['query']['fields']));_0x4ba7d7[_0xe6e2('0x42')]=_0x4ba7d7['attributes'][_0xe6e2('0x56')]?_0x4ba7d7[_0xe6e2('0x42')]:_0x4a3265[_0xe6e2('0x3d')];_0x4ba7d7[_0xe6e2('0x45')]=qs[_0xe6e2('0x46')](_0x5ccbcf[_0xe6e2('0x3e')][_0xe6e2('0x46')]);_0x4ba7d7[_0xe6e2('0x47')]=qs[_0xe6e2('0x48')](_[_0xe6e2('0x49')](_0x5ccbcf[_0xe6e2('0x3e')],_0x4a3265[_0xe6e2('0x48')]));if(_0x5ccbcf[_0xe6e2('0x3e')][_0xe6e2('0x4a')]){_0x4ba7d7[_0xe6e2('0x47')]=_[_0xe6e2('0x4c')](_0x4ba7d7['where'],{'$or':_[_0xe6e2('0x38')](_0x4ba7d7[_0xe6e2('0x42')],function(_0x318bcf){var _0x3b448f={};_0x3b448f[_0x318bcf]={'$like':'%'+_0x5ccbcf[_0xe6e2('0x3e')]['filter']+'%'};return _0x3b448f;})});}_0x4ba7d7=_[_0xe6e2('0x4c')]({},_0x4ba7d7,_0x5ccbcf[_0xe6e2('0x4d')]);return _0xb76137[_0xe6e2('0x5f')](_0x4ba7d7);}})['then'](function(_0x14cd46){if(_0x14cd46){_0x12f2aa=_0x14cd46[_0xe6e2('0x56')];if(!_0x5ccbcf['query'][_0xe6e2('0x43')](_0xe6e2('0x44'))){_0x4ba7d7[_0xe6e2('0x2a')]=qs['limit'](_0x5ccbcf[_0xe6e2('0x3e')][_0xe6e2('0x2a')]);_0x4ba7d7[_0xe6e2('0x29')]=qs[_0xe6e2('0x29')](_0x5ccbcf[_0xe6e2('0x3e')][_0xe6e2('0x29')]);}return _0xb76137[_0xe6e2('0x5f')](_0x4ba7d7);}})[_0xe6e2('0x31')](function(_0x1e1be3){if(_0x1e1be3){return _0x1e1be3?{'count':_0x12f2aa,'rows':_0x1e1be3}:null;}})[_0xe6e2('0x31')](respondWithResult(_0x2142b2,null))[_0xe6e2('0x53')](handleError(_0x2142b2,null));};exports[_0xe6e2('0x60')]=function(_0x436e31,_0x315aab,_0x325acf){var _0x609c26={};var _0x184d40={};var _0x40372a;var _0x1c9922;return db[_0xe6e2('0x39')][_0xe6e2('0x5a')]({'where':{'id':_0x436e31[_0xe6e2('0x55')]['id']}})[_0xe6e2('0x31')](handleEntityNotFound(_0x315aab,null))[_0xe6e2('0x31')](function(_0x14c1f3){if(_0x14c1f3){_0x40372a=_0x14c1f3;_0x184d40[_0xe6e2('0x3d')]=_[_0xe6e2('0x3f')](db[_0xe6e2('0x61')][_0xe6e2('0x5e')]);_0x184d40['query']=_[_0xe6e2('0x3f')](_0x436e31[_0xe6e2('0x3e')]);_0x184d40['filters']=_[_0xe6e2('0x40')](_0x184d40[_0xe6e2('0x3d')],_0x184d40[_0xe6e2('0x3e')]);_0x609c26[_0xe6e2('0x42')]=_['intersection'](_0x184d40[_0xe6e2('0x3d')],qs[_0xe6e2('0x41')](_0x436e31[_0xe6e2('0x3e')][_0xe6e2('0x41')]));_0x609c26['attributes']=_0x609c26[_0xe6e2('0x42')][_0xe6e2('0x56')]?_0x609c26[_0xe6e2('0x42')]:_0x184d40[_0xe6e2('0x3d')];_0x609c26[_0xe6e2('0x45')]=qs[_0xe6e2('0x46')](_0x436e31[_0xe6e2('0x3e')][_0xe6e2('0x46')]);_0x609c26['where']=qs[_0xe6e2('0x48')](_['pick'](_0x436e31['query'],_0x184d40[_0xe6e2('0x48')]));if(_0x436e31[_0xe6e2('0x3e')]['filter']){_0x609c26[_0xe6e2('0x47')]=_[_0xe6e2('0x4c')](_0x609c26[_0xe6e2('0x47')],{'$or':_['map'](_0x609c26[_0xe6e2('0x42')],function(_0x4eb9c1){var _0x428a98={};_0x428a98[_0x4eb9c1]={'$like':'%'+_0x436e31[_0xe6e2('0x3e')][_0xe6e2('0x4a')]+'%'};return _0x428a98;})});}_0x609c26=_[_0xe6e2('0x4c')]({},_0x609c26,_0x436e31['options']);return _0x40372a['getTags'](_0x609c26);}})['then'](function(_0x5efd25){if(_0x5efd25){_0x1c9922=_0x5efd25[_0xe6e2('0x56')];if(!_0x436e31[_0xe6e2('0x3e')][_0xe6e2('0x43')](_0xe6e2('0x44'))){_0x609c26[_0xe6e2('0x2a')]=qs[_0xe6e2('0x2a')](_0x436e31[_0xe6e2('0x3e')][_0xe6e2('0x2a')]);_0x609c26[_0xe6e2('0x29')]=qs['offset'](_0x436e31['query'][_0xe6e2('0x29')]);}return _0x40372a[_0xe6e2('0x60')](_0x609c26);}})[_0xe6e2('0x31')](function(_0x1991af){if(_0x1991af){return _0x1991af?{'count':_0x1c9922,'rows':_0x1991af}:null;}})[_0xe6e2('0x31')](respondWithResult(_0x315aab,null))[_0xe6e2('0x53')](handleError(_0x315aab,null));};exports['setTags']=function(_0x48e219,_0x2dc092,_0x3f1221){if(_0x48e219[_0xe6e2('0x59')]['id']){delete _0x48e219[_0xe6e2('0x59')]['id'];}return db[_0xe6e2('0x39')][_0xe6e2('0x5a')]({'where':{'id':_0x48e219[_0xe6e2('0x55')]['id']}})[_0xe6e2('0x31')](handleEntityNotFound(_0x2dc092,null))[_0xe6e2('0x31')](function(_0x1ca222){if(_0x1ca222){return _0x1ca222['setTags'](_0x48e219[_0xe6e2('0x59')][_0xe6e2('0x62')]||[]);}return null;})['then'](respondWithResult(_0x2dc092,null))[_0xe6e2('0x53')](handleError(_0x2dc092,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index edd88a1..320cbf2 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 _0x6aaf=['./intFreshdeskConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6aaf,0xe9));var _0xf6aa=function(_0x2dc96f,_0x459058){_0x2dc96f=_0x2dc96f-0x0;var _0xd012da=_0x6aaf[_0x2dc96f];return _0xd012da;};'use strict';var _=require(_0xf6aa('0x0'));var util=require(_0xf6aa('0x1'));var logger=require(_0xf6aa('0x2'))(_0xf6aa('0x3'));var moment=require(_0xf6aa('0x4'));var BPromise=require(_0xf6aa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6aa('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf6aa('0x7'));module[_0xf6aa('0x8')]=function(_0x469356,_0x5742dc){return _0x469356[_0xf6aa('0x9')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1aea=['bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','../../config/logger','moment'];(function(_0x38a38c,_0x102980){var _0x20a3e5=function(_0x57ba6e){while(--_0x57ba6e){_0x38a38c['push'](_0x38a38c['shift']());}};_0x20a3e5(++_0x102980);}(_0x1aea,0x148));var _0xa1ae=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x1aea[_0x35f7f5];return _0x5567a4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa1ae('0x0'))('api');var moment=require(_0xa1ae('0x1'));var BPromise=require(_0xa1ae('0x2'));var rp=require(_0xa1ae('0x3'));var fs=require('fs');var path=require(_0xa1ae('0x4'));var rimraf=require(_0xa1ae('0x5'));var config=require('../../config/environment');var attributes=require(_0xa1ae('0x6'));module[_0xa1ae('0x7')]=function(_0x48487c,_0x499bb4){return _0x48487c[_0xa1ae('0x8')](_0xa1ae('0x9'),attributes,{'tableName':_0xa1ae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index e90ff18..b09b513 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 _0xce6f=['stringify','error','code','message','result','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xce6f,0x116));var _0xfce6=function(_0x224367,_0x21a31f){_0x224367=_0x224367-0x0;var _0x3bb6f8=_0xce6f[_0x224367];return _0x3bb6f8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfce6('0x0'));var rs=require(_0xfce6('0x1'));var fs=require('fs');var Redis=require(_0xfce6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfce6('0x3'));var logger=require(_0xfce6('0x4'))('rpc');var config=require(_0xfce6('0x5'));var jayson=require(_0xfce6('0x6'));var client=jayson[_0xfce6('0x7')][_0xfce6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b35ff,_0x2ffdfb,_0x5044a1){return new BPromise(function(_0x18320e,_0x5164ac){return client[_0xfce6('0x9')](_0x2b35ff,_0x5044a1)[_0xfce6('0xa')](function(_0x4344b4){logger[_0xfce6('0xb')](_0xfce6('0xc'),_0x2ffdfb,_0xfce6('0xd'));logger[_0xfce6('0xe')](_0xfce6('0xf'),_0x2ffdfb,_0xfce6('0xd'),JSON[_0xfce6('0x10')](_0x4344b4));if(_0x4344b4[_0xfce6('0x11')]){if(_0x4344b4[_0xfce6('0x11')][_0xfce6('0x12')]===0x1f4){logger[_0xfce6('0x11')](_0xfce6('0xc'),_0x2ffdfb,_0x4344b4[_0xfce6('0x11')][_0xfce6('0x13')]);return _0x5164ac(_0x4344b4[_0xfce6('0x11')]['message']);}logger[_0xfce6('0x11')](_0xfce6('0xc'),_0x2ffdfb,_0x4344b4[_0xfce6('0x11')]['message']);return _0x18320e(_0x4344b4['error'][_0xfce6('0x13')]);}else{logger[_0xfce6('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2ffdfb,'request\x20sent');_0x18320e(_0x4344b4[_0xfce6('0x14')]['message']);}})['catch'](function(_0xc7ac31){logger[_0xfce6('0x11')](_0xfce6('0xc'),_0x2ffdfb,_0xc7ac31);_0x5164ac(_0xc7ac31);});});} \ No newline at end of file +var _0x9409=['debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x8c07df,_0x107719){var _0x55c285=function(_0x25a91a){while(--_0x25a91a){_0x8c07df['push'](_0x8c07df['shift']());}};_0x55c285(++_0x107719);}(_0x9409,0x17d));var _0x9940=function(_0x43ac7e,_0x69d02){_0x43ac7e=_0x43ac7e-0x0;var _0x404460=_0x9409[_0x43ac7e];return _0x404460;};'use strict';var _=require(_0x9940('0x0'));var util=require(_0x9940('0x1'));var moment=require(_0x9940('0x2'));var BPromise=require(_0x9940('0x3'));var rs=require(_0x9940('0x4'));var fs=require('fs');var Redis=require(_0x9940('0x5'));var db=require(_0x9940('0x6'))['db'];var utils=require(_0x9940('0x7'));var logger=require(_0x9940('0x8'))(_0x9940('0x9'));var config=require(_0x9940('0xa'));var jayson=require(_0x9940('0xb'));var client=jayson[_0x9940('0xc')][_0x9940('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x27e412,_0x265f81,_0x4bb034){return new BPromise(function(_0x4448a7,_0x880957){return client[_0x9940('0xe')](_0x27e412,_0x4bb034)[_0x9940('0xf')](function(_0x26c276){logger[_0x9940('0x10')](_0x9940('0x11'),_0x265f81,_0x9940('0x12'));logger[_0x9940('0x13')](_0x9940('0x14'),_0x265f81,_0x9940('0x12'),JSON[_0x9940('0x15')](_0x26c276));if(_0x26c276[_0x9940('0x16')]){if(_0x26c276[_0x9940('0x16')]['code']===0x1f4){logger[_0x9940('0x16')](_0x9940('0x11'),_0x265f81,_0x26c276[_0x9940('0x16')]['message']);return _0x880957(_0x26c276['error'][_0x9940('0x17')]);}logger[_0x9940('0x16')](_0x9940('0x11'),_0x265f81,_0x26c276['error'][_0x9940('0x17')]);return _0x4448a7(_0x26c276['error']['message']);}else{logger[_0x9940('0x10')](_0x9940('0x11'),_0x265f81,'request\x20sent');_0x4448a7(_0x26c276[_0x9940('0x18')][_0x9940('0x17')]);}})['catch'](function(_0x32f97f){logger[_0x9940('0x16')](_0x9940('0x11'),_0x265f81,_0x32f97f);_0x880957(_0x32f97f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 314ce3a..813be2a 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 _0x6049=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x6049,0x7d));var _0x9604=function(_0x3dac7a,_0x10a776){_0x3dac7a=_0x3dac7a-0x0;var _0x5a1681=_0x6049[_0x3dac7a];return _0x5a1681;};'use strict';var multer=require(_0x9604('0x0'));var util=require('util');var path=require(_0x9604('0x1'));var timeout=require(_0x9604('0x2'));var express=require(_0x9604('0x3'));var router=express['Router']();var fs_extra=require(_0x9604('0x4'));var auth=require(_0x9604('0x5'));var interaction=require(_0x9604('0x6'));var config=require(_0x9604('0x7'));var controller=require(_0x9604('0x8'));router[_0x9604('0x9')]('/',auth[_0x9604('0xa')](),controller[_0x9604('0xb')]);router[_0x9604('0x9')](_0x9604('0xc'),auth[_0x9604('0xa')](),controller['show']);router[_0x9604('0xd')]('/',auth['isAuthenticated'](),controller[_0x9604('0xe')]);router[_0x9604('0xf')](_0x9604('0xc'),auth[_0x9604('0xa')](),controller[_0x9604('0x10')]);router[_0x9604('0x11')](_0x9604('0xc'),auth[_0x9604('0xa')](),controller[_0x9604('0x12')]);module[_0x9604('0x13')]=router; \ No newline at end of file +var _0x73b5=['index','get','/:id','show','post','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated'];(function(_0xdabd59,_0x55e984){var _0x4af920=function(_0x7e5f46){while(--_0x7e5f46){_0xdabd59['push'](_0xdabd59['shift']());}};_0x4af920(++_0x55e984);}(_0x73b5,0x14b));var _0x573b=function(_0x35ace7,_0xbd1eaa){_0x35ace7=_0x35ace7-0x0;var _0x203523=_0x73b5[_0x35ace7];return _0x203523;};'use strict';var multer=require(_0x573b('0x0'));var util=require(_0x573b('0x1'));var path=require('path');var timeout=require(_0x573b('0x2'));var express=require(_0x573b('0x3'));var router=express[_0x573b('0x4')]();var fs_extra=require(_0x573b('0x5'));var auth=require(_0x573b('0x6'));var interaction=require(_0x573b('0x7'));var config=require(_0x573b('0x8'));var controller=require(_0x573b('0x9'));router['get']('/',auth[_0x573b('0xa')](),controller[_0x573b('0xb')]);router[_0x573b('0xc')](_0x573b('0xd'),auth[_0x573b('0xa')](),controller[_0x573b('0xe')]);router[_0x573b('0xf')]('/',auth[_0x573b('0xa')](),controller['create']);router[_0x573b('0x10')]('/:id',auth[_0x573b('0xa')](),controller['update']);router['delete'](_0x573b('0xd'),auth[_0x573b('0xa')](),controller[_0x573b('0x11')]);module[_0x573b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 759c566..c14dcce 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 _0x4944=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x4e68c2,_0x322a2d){var _0x4ff4ff=function(_0x1f623f){while(--_0x1f623f){_0x4e68c2['push'](_0x4e68c2['shift']());}};_0x4ff4ff(++_0x322a2d);}(_0x4944,0x6d));var _0x4494=function(_0x2a34b4,_0x4e20d0){_0x2a34b4=_0x2a34b4-0x0;var _0x261e83=_0x4944[_0x2a34b4];return _0x261e83;};'use strict';var Sequelize=require(_0x4494('0x0'));module['exports']={'type':{'type':Sequelize[_0x4494('0x1')](_0x4494('0x2'),_0x4494('0x3'),_0x4494('0x4'),_0x4494('0x5'),'picklist'),'defaultValue':_0x4494('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4494('0x6')]},'keyType':{'type':Sequelize[_0x4494('0x1')](_0x4494('0x2'),_0x4494('0x3'),_0x4494('0x4'))},'keyContent':{'type':Sequelize[_0x4494('0x6')]},'idField':{'type':Sequelize[_0x4494('0x6')]},'nameField':{'type':Sequelize[_0x4494('0x6')]},'customField':{'type':Sequelize[_0x4494('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xae79=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0xae79,0x1d3));var _0x9ae7=function(_0x5be6b4,_0x291fe2){_0x5be6b4=_0x5be6b4-0x0;var _0x51d386=_0xae79[_0x5be6b4];return _0x51d386;};'use strict';var Sequelize=require(_0x9ae7('0x0'));module[_0x9ae7('0x1')]={'type':{'type':Sequelize[_0x9ae7('0x2')](_0x9ae7('0x3'),_0x9ae7('0x4'),_0x9ae7('0x5'),_0x9ae7('0x6'),_0x9ae7('0x7')),'defaultValue':_0x9ae7('0x3')},'content':{'type':Sequelize[_0x9ae7('0x8')]},'key':{'type':Sequelize[_0x9ae7('0x8')]},'keyType':{'type':Sequelize[_0x9ae7('0x2')](_0x9ae7('0x3'),_0x9ae7('0x4'),_0x9ae7('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9ae7('0x8')]},'nameField':{'type':Sequelize[_0x9ae7('0x8')]},'customField':{'type':Sequelize[_0x9ae7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9ae7('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 366c1c8..37043fa 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 _0xda19=['show','params','keys','options','find','create','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','status','error','stack','name','FreshdeskField','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','includeAll','include','catch'];(function(_0x2e07e9,_0xebe81f){var _0x35a43d=function(_0x40fe21){while(--_0x40fe21){_0x2e07e9['push'](_0x2e07e9['shift']());}};_0x35a43d(++_0xebe81f);}(_0xda19,0xd5));var _0x9da1=function(_0x352b6f,_0x55fab5){_0x352b6f=_0x352b6f-0x0;var _0x3f9e3c=_0xda19[_0x352b6f];return _0x3f9e3c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9da1('0x0'));var rimraf=require(_0x9da1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9da1('0x2'));var rp=require('request-promise');var moment=require(_0x9da1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9da1('0x4'));var util=require(_0x9da1('0x5'));var path=require(_0x9da1('0x6'));var sox=require(_0x9da1('0x7'));var csv=require(_0x9da1('0x8'));var ejs=require(_0x9da1('0x9'));var fs=require('fs');var fs_extra=require(_0x9da1('0xa'));var _=require(_0x9da1('0xb'));var squel=require(_0x9da1('0xc'));var crypto=require(_0x9da1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9da1('0xe'));var Papa=require('papaparse');var Redis=require(_0x9da1('0xf'));var authService=require(_0x9da1('0x10'));var qs=require(_0x9da1('0x11'));var as=require(_0x9da1('0x12'));var hardwareService=require(_0x9da1('0x13'));var logger=require(_0x9da1('0x14'))(_0x9da1('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9da1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4735c7,_0x1d93f8){_0x1d93f8=_0x1d93f8||0xcc;return function(_0xd2d225){if(_0xd2d225){return _0x4735c7[_0x9da1('0x17')](_0x1d93f8);}return _0x4735c7['status'](_0x1d93f8)[_0x9da1('0x18')]();};}function respondWithResult(_0x535a13,_0x4d17e1){_0x4d17e1=_0x4d17e1||0xc8;return function(_0x40ba9d){if(_0x40ba9d){return _0x535a13['status'](_0x4d17e1)[_0x9da1('0x19')](_0x40ba9d);}};}function respondWithFilteredResult(_0x43c093,_0x37653d){return function(_0x1a1a6b){if(_0x1a1a6b){var _0x7f1a64=_0x1a1a6b[_0x9da1('0x1a')],_0x514d8e=_0x37653d[_0x9da1('0x1b')],_0x16f75a=_0x37653d[_0x9da1('0x1b')]+_0x37653d[_0x9da1('0x1c')],_0x116a76;if(_0x16f75a>=_0x7f1a64){_0x16f75a=_0x7f1a64;_0x116a76=0xc8;}else{_0x116a76=0xce;}_0x43c093['status'](_0x116a76);return _0x43c093['set'](_0x9da1('0x1d'),_0x514d8e+'-'+_0x16f75a+'/'+_0x7f1a64)[_0x9da1('0x19')](_0x1a1a6b);}return null;};}function patchUpdates(_0x1b0e7f){return function(_0x41e555){try{jsonpatch[_0x9da1('0x1e')](_0x41e555,_0x1b0e7f,!![]);}catch(_0x3b1645){return BPromise[_0x9da1('0x1f')](_0x3b1645);}return _0x41e555['save']();};}function saveUpdates(_0x1a459c,_0x554845){return function(_0x9c3b37){if(_0x9c3b37){return _0x9c3b37[_0x9da1('0x20')](_0x1a459c)[_0x9da1('0x21')](function(_0x4e9d7d){return _0x4e9d7d;});}return null;};}function removeEntity(_0x5454d3,_0x14793b){return function(_0x3e6f85){if(_0x3e6f85){return _0x3e6f85[_0x9da1('0x22')]()[_0x9da1('0x21')](function(){_0x5454d3[_0x9da1('0x23')](0xcc)[_0x9da1('0x18')]();});}};}function handleEntityNotFound(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(!_0x3bfa40){_0x4c60aa['sendStatus'](0x194);}return _0x3bfa40;};}function handleError(_0x45fcce,_0x3f5680){_0x3f5680=_0x3f5680||0x1f4;return function(_0x534210){logger[_0x9da1('0x24')](_0x534210[_0x9da1('0x25')]);if(_0x534210['name']){delete _0x534210[_0x9da1('0x26')];}_0x45fcce[_0x9da1('0x23')](_0x3f5680)['send'](_0x534210);};}exports['index']=function(_0x67dbc8,_0x47055e){var _0x5eca5b={},_0x27c6e2={},_0x5db5c2={'count':0x0,'rows':[]};var _0x5a6f2d=_['map'](db[_0x9da1('0x27')][_0x9da1('0x28')],function(_0x24c6d5){return{'name':_0x24c6d5[_0x9da1('0x29')],'type':_0x24c6d5[_0x9da1('0x2a')]['key']};});_0x27c6e2[_0x9da1('0x2b')]=_['map'](_0x5a6f2d,_0x9da1('0x26'));_0x27c6e2[_0x9da1('0x2c')]=_['keys'](_0x67dbc8[_0x9da1('0x2c')]);_0x27c6e2[_0x9da1('0x2d')]=_['intersection'](_0x27c6e2[_0x9da1('0x2b')],_0x27c6e2[_0x9da1('0x2c')]);_0x5eca5b[_0x9da1('0x2e')]=_[_0x9da1('0x2f')](_0x27c6e2['model'],qs['fields'](_0x67dbc8[_0x9da1('0x2c')][_0x9da1('0x30')]));_0x5eca5b[_0x9da1('0x2e')]=_0x5eca5b[_0x9da1('0x2e')][_0x9da1('0x31')]?_0x5eca5b['attributes']:_0x27c6e2[_0x9da1('0x2b')];if(!_0x67dbc8[_0x9da1('0x2c')][_0x9da1('0x32')](_0x9da1('0x33'))){_0x5eca5b[_0x9da1('0x1c')]=qs[_0x9da1('0x1c')](_0x67dbc8['query'][_0x9da1('0x1c')]);_0x5eca5b['offset']=qs['offset'](_0x67dbc8[_0x9da1('0x2c')]['offset']);}_0x5eca5b[_0x9da1('0x34')]=qs[_0x9da1('0x35')](_0x67dbc8[_0x9da1('0x2c')][_0x9da1('0x35')]);_0x5eca5b[_0x9da1('0x36')]=qs[_0x9da1('0x2d')](_[_0x9da1('0x37')](_0x67dbc8[_0x9da1('0x2c')],_0x27c6e2['filters']),_0x5a6f2d);if(_0x67dbc8[_0x9da1('0x2c')]['filter']){_0x5eca5b[_0x9da1('0x36')]=_['merge'](_0x5eca5b['where'],{'$or':_[_0x9da1('0x38')](_0x5a6f2d,function(_0x4d1d2e){if(_0x4d1d2e[_0x9da1('0x2a')]!==_0x9da1('0x39')){var _0x5dea20={};_0x5dea20[_0x4d1d2e[_0x9da1('0x26')]]={'$like':'%'+_0x67dbc8[_0x9da1('0x2c')][_0x9da1('0x3a')]+'%'};return _0x5dea20;}})});}_0x5eca5b=_[_0x9da1('0x3b')]({},_0x5eca5b,_0x67dbc8['options']);var _0x257c2e={'where':_0x5eca5b['where']};return db[_0x9da1('0x27')]['count'](_0x257c2e)[_0x9da1('0x21')](function(_0x46c176){_0x5db5c2['count']=_0x46c176;if(_0x67dbc8[_0x9da1('0x2c')][_0x9da1('0x3c')]){_0x5eca5b[_0x9da1('0x3d')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x5eca5b);})['then'](function(_0x27e78c){_0x5db5c2['rows']=_0x27e78c;return _0x5db5c2;})[_0x9da1('0x21')](respondWithFilteredResult(_0x47055e,_0x5eca5b))[_0x9da1('0x3e')](handleError(_0x47055e,null));};exports[_0x9da1('0x3f')]=function(_0x43c064,_0x54f188){var _0x42dbd8={'raw':!![],'where':{'id':_0x43c064[_0x9da1('0x40')]['id']}},_0x2e1b8b={};_0x2e1b8b[_0x9da1('0x2b')]=_[_0x9da1('0x41')](db[_0x9da1('0x27')][_0x9da1('0x28')]);_0x2e1b8b['query']=_[_0x9da1('0x41')](_0x43c064['query']);_0x2e1b8b[_0x9da1('0x2d')]=_['intersection'](_0x2e1b8b[_0x9da1('0x2b')],_0x2e1b8b[_0x9da1('0x2c')]);_0x42dbd8['attributes']=_[_0x9da1('0x2f')](_0x2e1b8b[_0x9da1('0x2b')],qs['fields'](_0x43c064[_0x9da1('0x2c')]['fields']));_0x42dbd8[_0x9da1('0x2e')]=_0x42dbd8[_0x9da1('0x2e')]['length']?_0x42dbd8['attributes']:_0x2e1b8b[_0x9da1('0x2b')];if(_0x43c064[_0x9da1('0x2c')][_0x9da1('0x3c')]){_0x42dbd8[_0x9da1('0x3d')]=[{'all':!![]}];}_0x42dbd8=_[_0x9da1('0x3b')]({},_0x42dbd8,_0x43c064[_0x9da1('0x42')]);return db[_0x9da1('0x27')][_0x9da1('0x43')](_0x42dbd8)['then'](handleEntityNotFound(_0x54f188,null))[_0x9da1('0x21')](respondWithResult(_0x54f188,null))[_0x9da1('0x3e')](handleError(_0x54f188,null));};exports[_0x9da1('0x44')]=function(_0x5cf7ef,_0xd5b3da){return db[_0x9da1('0x27')][_0x9da1('0x44')](_0x5cf7ef['body'],{})[_0x9da1('0x21')](respondWithResult(_0xd5b3da,0xc9))[_0x9da1('0x3e')](handleError(_0xd5b3da,null));};exports[_0x9da1('0x20')]=function(_0x516bdd,_0xd243a4){if(_0x516bdd['body']['id']){delete _0x516bdd['body']['id'];}return db[_0x9da1('0x27')][_0x9da1('0x43')]({'where':{'id':_0x516bdd['params']['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0xd243a4,null))[_0x9da1('0x21')](saveUpdates(_0x516bdd['body'],null))[_0x9da1('0x21')](respondWithResult(_0xd243a4,null))[_0x9da1('0x3e')](handleError(_0xd243a4,null));};exports[_0x9da1('0x22')]=function(_0x3a529d,_0x4780ca){return db[_0x9da1('0x27')][_0x9da1('0x43')]({'where':{'id':_0x3a529d[_0x9da1('0x40')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4780ca,null))['then'](removeEntity(_0x4780ca,null))[_0x9da1('0x3e')](handleError(_0x4780ca,null));}; \ No newline at end of file +var _0xf2ca=['util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','error','stack','name','send','index','FreshdeskField','rawAttributes','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','intersection','create','body','find','destroy','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4d0df6,_0x4634f3){var _0x4e2615=function(_0x5285e2){while(--_0x5285e2){_0x4d0df6['push'](_0x4d0df6['shift']());}};_0x4e2615(++_0x4634f3);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0xf2ca[_0x879e31];return _0x3467e8;};'use strict';var pdf=require(_0xaf2c('0x0'));var emlformat=require(_0xaf2c('0x1'));var rimraf=require(_0xaf2c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf2c('0x3'));var rp=require(_0xaf2c('0x4'));var moment=require(_0xaf2c('0x5'));var BPromise=require(_0xaf2c('0x6'));var Mustache=require(_0xaf2c('0x7'));var util=require(_0xaf2c('0x8'));var path=require('path');var sox=require(_0xaf2c('0x9'));var csv=require(_0xaf2c('0xa'));var ejs=require(_0xaf2c('0xb'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xc'));var _=require('lodash');var squel=require(_0xaf2c('0xd'));var crypto=require(_0xaf2c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xaf2c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xaf2c('0x10'));var Papa=require('papaparse');var Redis=require(_0xaf2c('0x11'));var authService=require(_0xaf2c('0x12'));var qs=require(_0xaf2c('0x13'));var as=require(_0xaf2c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaf2c('0x15'));var utils=require(_0xaf2c('0x16'));var config=require(_0xaf2c('0x17'));var licenseUtil=require(_0xaf2c('0x18'));var db=require(_0xaf2c('0x19'))['db'];function respondWithStatusCode(_0x59a59b,_0x590126){_0x590126=_0x590126||0xcc;return function(_0x15ccb4){if(_0x15ccb4){return _0x59a59b[_0xaf2c('0x1a')](_0x590126);}return _0x59a59b[_0xaf2c('0x1b')](_0x590126)[_0xaf2c('0x1c')]();};}function respondWithResult(_0x293ca6,_0x152c73){_0x152c73=_0x152c73||0xc8;return function(_0x214f47){if(_0x214f47){return _0x293ca6[_0xaf2c('0x1b')](_0x152c73)[_0xaf2c('0x1d')](_0x214f47);}};}function respondWithFilteredResult(_0x1d0633,_0x6ac8e){return function(_0x2b4d13){if(_0x2b4d13){var _0x26bf7b=_0x2b4d13[_0xaf2c('0x1e')],_0x3432e4=_0x6ac8e['offset'],_0x705d09=_0x6ac8e[_0xaf2c('0x1f')]+_0x6ac8e[_0xaf2c('0x20')],_0x54c34a;if(_0x705d09>=_0x26bf7b){_0x705d09=_0x26bf7b;_0x54c34a=0xc8;}else{_0x54c34a=0xce;}_0x1d0633[_0xaf2c('0x1b')](_0x54c34a);return _0x1d0633['set'](_0xaf2c('0x21'),_0x3432e4+'-'+_0x705d09+'/'+_0x26bf7b)[_0xaf2c('0x1d')](_0x2b4d13);}return null;};}function patchUpdates(_0x1fec4c){return function(_0x20000b){try{jsonpatch[_0xaf2c('0x22')](_0x20000b,_0x1fec4c,!![]);}catch(_0x1b7f07){return BPromise['reject'](_0x1b7f07);}return _0x20000b[_0xaf2c('0x23')]();};}function saveUpdates(_0x164bcb,_0x8ffe13){return function(_0x3bfd3f){if(_0x3bfd3f){return _0x3bfd3f[_0xaf2c('0x24')](_0x164bcb)['then'](function(_0x396646){return _0x396646;});}return null;};}function removeEntity(_0xbf6f62,_0x18153c){return function(_0x4be6ed){if(_0x4be6ed){return _0x4be6ed['destroy']()[_0xaf2c('0x25')](function(){_0xbf6f62[_0xaf2c('0x1b')](0xcc)[_0xaf2c('0x1c')]();});}};}function handleEntityNotFound(_0x99f78d,_0x591aff){return function(_0x2b8f1a){if(!_0x2b8f1a){_0x99f78d[_0xaf2c('0x1a')](0x194);}return _0x2b8f1a;};}function handleError(_0x3a0145,_0x3c1ae6){_0x3c1ae6=_0x3c1ae6||0x1f4;return function(_0xe929b5){logger[_0xaf2c('0x26')](_0xe929b5[_0xaf2c('0x27')]);if(_0xe929b5['name']){delete _0xe929b5[_0xaf2c('0x28')];}_0x3a0145[_0xaf2c('0x1b')](_0x3c1ae6)[_0xaf2c('0x29')](_0xe929b5);};}exports[_0xaf2c('0x2a')]=function(_0x4b7cf2,_0x3fb190){var _0x589d47={},_0x38db1b={},_0x42f980={'count':0x0,'rows':[]};var _0x15466b=_['map'](db[_0xaf2c('0x2b')][_0xaf2c('0x2c')],function(_0x3baee2){return{'name':_0x3baee2['fieldName'],'type':_0x3baee2[_0xaf2c('0x2d')][_0xaf2c('0x2e')]};});_0x38db1b[_0xaf2c('0x2f')]=_[_0xaf2c('0x30')](_0x15466b,'name');_0x38db1b[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x4b7cf2[_0xaf2c('0x31')]);_0x38db1b['filters']=_['intersection'](_0x38db1b[_0xaf2c('0x2f')],_0x38db1b['query']);_0x589d47[_0xaf2c('0x33')]=_['intersection'](_0x38db1b[_0xaf2c('0x2f')],qs[_0xaf2c('0x34')](_0x4b7cf2['query'][_0xaf2c('0x34')]));_0x589d47[_0xaf2c('0x33')]=_0x589d47['attributes'][_0xaf2c('0x35')]?_0x589d47[_0xaf2c('0x33')]:_0x38db1b[_0xaf2c('0x2f')];if(!_0x4b7cf2[_0xaf2c('0x31')][_0xaf2c('0x36')](_0xaf2c('0x37'))){_0x589d47['limit']=qs[_0xaf2c('0x20')](_0x4b7cf2['query'][_0xaf2c('0x20')]);_0x589d47['offset']=qs[_0xaf2c('0x1f')](_0x4b7cf2['query'][_0xaf2c('0x1f')]);}_0x589d47['order']=qs[_0xaf2c('0x38')](_0x4b7cf2['query'][_0xaf2c('0x38')]);_0x589d47[_0xaf2c('0x39')]=qs[_0xaf2c('0x3a')](_[_0xaf2c('0x3b')](_0x4b7cf2[_0xaf2c('0x31')],_0x38db1b['filters']),_0x15466b);if(_0x4b7cf2['query'][_0xaf2c('0x3c')]){_0x589d47[_0xaf2c('0x39')]=_[_0xaf2c('0x3d')](_0x589d47[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x30')](_0x15466b,function(_0x316238){if(_0x316238['type']!==_0xaf2c('0x3e')){var _0x1a080d={};_0x1a080d[_0x316238['name']]={'$like':'%'+_0x4b7cf2[_0xaf2c('0x31')][_0xaf2c('0x3c')]+'%'};return _0x1a080d;}})});}_0x589d47=_[_0xaf2c('0x3d')]({},_0x589d47,_0x4b7cf2[_0xaf2c('0x3f')]);var _0x2954d2={'where':_0x589d47[_0xaf2c('0x39')]};return db[_0xaf2c('0x2b')][_0xaf2c('0x1e')](_0x2954d2)[_0xaf2c('0x25')](function(_0x106eb9){_0x42f980[_0xaf2c('0x1e')]=_0x106eb9;if(_0x4b7cf2[_0xaf2c('0x31')][_0xaf2c('0x40')]){_0x589d47['include']=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x589d47);})[_0xaf2c('0x25')](function(_0x3cb075){_0x42f980[_0xaf2c('0x41')]=_0x3cb075;return _0x42f980;})[_0xaf2c('0x25')](respondWithFilteredResult(_0x3fb190,_0x589d47))[_0xaf2c('0x42')](handleError(_0x3fb190,null));};exports[_0xaf2c('0x43')]=function(_0x51c441,_0x1d58bd){var _0x78632a={'raw':!![],'where':{'id':_0x51c441['params']['id']}},_0xc59393={};_0xc59393['model']=_[_0xaf2c('0x32')](db['FreshdeskField'][_0xaf2c('0x2c')]);_0xc59393[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x51c441[_0xaf2c('0x31')]);_0xc59393['filters']=_[_0xaf2c('0x44')](_0xc59393['model'],_0xc59393[_0xaf2c('0x31')]);_0x78632a[_0xaf2c('0x33')]=_['intersection'](_0xc59393[_0xaf2c('0x2f')],qs['fields'](_0x51c441[_0xaf2c('0x31')][_0xaf2c('0x34')]));_0x78632a[_0xaf2c('0x33')]=_0x78632a[_0xaf2c('0x33')][_0xaf2c('0x35')]?_0x78632a[_0xaf2c('0x33')]:_0xc59393[_0xaf2c('0x2f')];if(_0x51c441[_0xaf2c('0x31')][_0xaf2c('0x40')]){_0x78632a['include']=[{'all':!![]}];}_0x78632a=_['merge']({},_0x78632a,_0x51c441[_0xaf2c('0x3f')]);return db['FreshdeskField']['find'](_0x78632a)['then'](handleEntityNotFound(_0x1d58bd,null))[_0xaf2c('0x25')](respondWithResult(_0x1d58bd,null))[_0xaf2c('0x42')](handleError(_0x1d58bd,null));};exports[_0xaf2c('0x45')]=function(_0x35315e,_0x599b2d){return db[_0xaf2c('0x2b')]['create'](_0x35315e[_0xaf2c('0x46')],{})['then'](respondWithResult(_0x599b2d,0xc9))[_0xaf2c('0x42')](handleError(_0x599b2d,null));};exports[_0xaf2c('0x24')]=function(_0x2d01b7,_0x11e054){if(_0x2d01b7[_0xaf2c('0x46')]['id']){delete _0x2d01b7['body']['id'];}return db[_0xaf2c('0x2b')][_0xaf2c('0x47')]({'where':{'id':_0x2d01b7['params']['id']}})['then'](handleEntityNotFound(_0x11e054,null))[_0xaf2c('0x25')](saveUpdates(_0x2d01b7['body'],null))[_0xaf2c('0x25')](respondWithResult(_0x11e054,null))[_0xaf2c('0x42')](handleError(_0x11e054,null));};exports[_0xaf2c('0x48')]=function(_0x315b9f,_0x367112){return db[_0xaf2c('0x2b')][_0xaf2c('0x47')]({'where':{'id':_0x315b9f[_0xaf2c('0x49')]['id']}})[_0xaf2c('0x25')](handleEntityNotFound(_0x367112,null))[_0xaf2c('0x25')](removeEntity(_0x367112,null))[_0xaf2c('0x42')](handleError(_0x367112,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index b077234..eb85a73 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 _0xdee7=['exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x178e71,_0x5c6c7d){var _0x3eec6c=function(_0x406d3f){while(--_0x406d3f){_0x178e71['push'](_0x178e71['shift']());}};_0x3eec6c(++_0x5c6c7d);}(_0xdee7,0x17f));var _0x7dee=function(_0xc3d38f,_0x41df2c){_0xc3d38f=_0xc3d38f-0x0;var _0x2b6fab=_0xdee7[_0xc3d38f];return _0x2b6fab;};'use strict';var _=require(_0x7dee('0x0'));var util=require(_0x7dee('0x1'));var logger=require(_0x7dee('0x2'))(_0x7dee('0x3'));var moment=require('moment');var BPromise=require(_0x7dee('0x4'));var rp=require(_0x7dee('0x5'));var fs=require('fs');var path=require(_0x7dee('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x7dee('0x7')]=function(_0x5e25c6,_0x3fdf81){return _0x5e25c6[_0x7dee('0x8')](_0x7dee('0x9'),attributes,{'tableName':_0x7dee('0xa'),'paranoid':![],'indexes':[{'name':_0x7dee('0xb'),'fields':['idField',_0x7dee('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0026=['path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1fdd8f,_0x4ca5a0){var _0x599d33=function(_0x2c77b6){while(--_0x2c77b6){_0x1fdd8f['push'](_0x1fdd8f['shift']());}};_0x599d33(++_0x4ca5a0);}(_0x0026,0x1e8));var _0x6002=function(_0x31be44,_0x22d8ad){_0x31be44=_0x31be44-0x0;var _0x25c887=_0x0026[_0x31be44];return _0x25c887;};'use strict';var _=require(_0x6002('0x0'));var util=require(_0x6002('0x1'));var logger=require(_0x6002('0x2'))(_0x6002('0x3'));var moment=require(_0x6002('0x4'));var BPromise=require(_0x6002('0x5'));var rp=require(_0x6002('0x6'));var fs=require('fs');var path=require(_0x6002('0x7'));var rimraf=require(_0x6002('0x8'));var config=require(_0x6002('0x9'));var attributes=require(_0x6002('0xa'));module[_0x6002('0xb')]=function(_0x496ed9,_0x548115){return _0x496ed9['define'](_0x6002('0xc'),attributes,{'tableName':_0x6002('0xd'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x6002('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index ea13a18..3740300 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 _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x31e6fa,_0x4a8365){_0x31e6fa=_0x31e6fa-0x0;var _0x9148b1=_0x7a54[_0x31e6fa];return _0x9148b1;};'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')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x8966a5,_0x1a1ed3){var _0x43a11e=function(_0x6e7eeb){while(--_0x6e7eeb){_0x8966a5['push'](_0x8966a5['shift']());}};_0x43a11e(++_0x1a1ed3);}(_0xb10b,0x12a));var _0xbb10=function(_0x11167c,_0xb0ff07){_0x11167c=_0x11167c-0x0;var _0x34bdb0=_0xb10b[_0x11167c];return _0x34bdb0;};'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);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 49cd277..d943ae1 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 _0x17a0=['/:id','show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index'];(function(_0x4d351a,_0x3428e1){var _0x5f261e=function(_0x39b9d0){while(--_0x39b9d0){_0x4d351a['push'](_0x4d351a['shift']());}};_0x5f261e(++_0x3428e1);}(_0x17a0,0x165));var _0x017a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x17a0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x017a('0x0'));var path=require(_0x017a('0x1'));var timeout=require(_0x017a('0x2'));var express=require('express');var router=express[_0x017a('0x3')]();var fs_extra=require(_0x017a('0x4'));var auth=require(_0x017a('0x5'));var interaction=require(_0x017a('0x6'));var config=require('../../config/environment');var controller=require(_0x017a('0x7'));router[_0x017a('0x8')]('/',auth[_0x017a('0x9')](),controller[_0x017a('0xa')]);router[_0x017a('0x8')](_0x017a('0xb'),auth[_0x017a('0x9')](),controller[_0x017a('0xc')]);router[_0x017a('0x8')]('/:id/configurations',auth[_0x017a('0x9')](),controller[_0x017a('0xd')]);router['get'](_0x017a('0xe'),auth['isAuthenticated'](),controller[_0x017a('0xf')]);router['post']('/',auth[_0x017a('0x9')](),controller[_0x017a('0x10')]);router[_0x017a('0x11')](_0x017a('0x12'),auth[_0x017a('0x9')](),controller[_0x017a('0x13')]);router[_0x017a('0x14')](_0x017a('0xb'),auth[_0x017a('0x9')](),controller['update']);router[_0x017a('0x15')](_0x017a('0xb'),auth[_0x017a('0x9')](),controller[_0x017a('0x16')]);module['exports']=router; \ No newline at end of file +var _0x81a8=['getConfigurations','/:id/fields','create','/:id/configurations','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x81a8,0x151));var _0x881a=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x81a8[_0x454018];return _0x24697d;};'use strict';var multer=require(_0x881a('0x0'));var util=require('util');var path=require(_0x881a('0x1'));var timeout=require(_0x881a('0x2'));var express=require(_0x881a('0x3'));var router=express[_0x881a('0x4')]();var fs_extra=require(_0x881a('0x5'));var auth=require(_0x881a('0x6'));var interaction=require(_0x881a('0x7'));var config=require(_0x881a('0x8'));var controller=require(_0x881a('0x9'));router[_0x881a('0xa')]('/',auth[_0x881a('0xb')](),controller[_0x881a('0xc')]);router[_0x881a('0xa')](_0x881a('0xd'),auth[_0x881a('0xb')](),controller[_0x881a('0xe')]);router['get']('/:id/configurations',auth[_0x881a('0xb')](),controller[_0x881a('0xf')]);router[_0x881a('0xa')](_0x881a('0x10'),auth[_0x881a('0xb')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x881a('0x11')]);router['post'](_0x881a('0x12'),auth[_0x881a('0xb')](),controller['addConfiguration']);router['put']('/:id',auth[_0x881a('0xb')](),controller[_0x881a('0x13')]);router[_0x881a('0x14')]('/:id',auth[_0x881a('0xb')](),controller[_0x881a('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 437616b..b2e0611 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 _0xe9b3=['STRING','remoteUri','exports','username'];(function(_0x1ef5fb,_0x1b1bce){var _0x629ef2=function(_0x43c0b9){while(--_0x43c0b9){_0x1ef5fb['push'](_0x1ef5fb['shift']());}};_0x629ef2(++_0x1b1bce);}(_0xe9b3,0x72));var _0x3e9b=function(_0x4bba6f,_0x33716d){_0x4bba6f=_0x4bba6f-0x0;var _0x3cfa2d=_0xe9b3[_0x4bba6f];return _0x3cfa2d;};'use strict';var Sequelize=require('sequelize');module[_0x3e9b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x3e9b('0x1')},'apiKey':{'type':Sequelize[_0x3e9b('0x2')]},'remoteUri':{'type':Sequelize[_0x3e9b('0x2')],'unique':_0x3e9b('0x3')},'serverUrl':{'type':Sequelize[_0x3e9b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5336=['STRING','sequelize','exports'];(function(_0x289d3e,_0x451def){var _0x37a72b=function(_0x3da909){while(--_0x3da909){_0x289d3e['push'](_0x289d3e['shift']());}};_0x37a72b(++_0x451def);}(_0x5336,0x7f));var _0x6533=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x5336[_0x17928f];return _0x500b63;};'use strict';var Sequelize=require(_0x6533('0x0'));module[_0x6533('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6533('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x6533('0x2')]},'remoteUri':{'type':Sequelize[_0x6533('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6533('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index aeba024..ebacc06 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 _0xc9a6=['findAll','rows','catch','show','params','find','create','body','getConfigurations','FreshsalesConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','%s%s','/api/selector/owners','users','Requested\x20Resource\x20not\x20Found','test','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x5d0f97,_0x25009f){var _0xc7236=function(_0xa7353f){while(--_0xa7353f){_0x5d0f97['push'](_0x5d0f97['shift']());}};_0xc7236(++_0x25009f);}(_0xc9a6,0x170));var _0x6c9a=function(_0x54867e,_0x122e1e){_0x54867e=_0x54867e-0x0;var _0x4182d4=_0xc9a6[_0x54867e];return _0x4182d4;};'use strict';var pdf=require(_0x6c9a('0x0'));var emlformat=require(_0x6c9a('0x1'));var rimraf=require(_0x6c9a('0x2'));var zipdir=require(_0x6c9a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c9a('0x4'));var moment=require(_0x6c9a('0x5'));var BPromise=require(_0x6c9a('0x6'));var Mustache=require(_0x6c9a('0x7'));var util=require('util');var path=require(_0x6c9a('0x8'));var sox=require('sox');var csv=require(_0x6c9a('0x9'));var ejs=require(_0x6c9a('0xa'));var fs=require('fs');var fs_extra=require(_0x6c9a('0xb'));var _=require(_0x6c9a('0xc'));var squel=require(_0x6c9a('0xd'));var crypto=require(_0x6c9a('0xe'));var jsforce=require(_0x6c9a('0xf'));var deskjs=require(_0x6c9a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6c9a('0x11'));var Papa=require('papaparse');var Redis=require(_0x6c9a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6c9a('0x13'));var as=require(_0x6c9a('0x14'));var hardwareService=require(_0x6c9a('0x15'));var logger=require('../../config/logger')(_0x6c9a('0x16'));var utils=require(_0x6c9a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6c9a('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6c9a('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x6c9a('0x1a')][_0x6c9a('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x96a5b3,_0xcdb655,_0x88d174,_0x41f5cb){return new BPromise(function(_0x51e2d7,_0x3a5aba){var _0xd5efb=_0x41f5cb||client;return _0xd5efb[_0x6c9a('0x1c')](_0x96a5b3,_0x88d174)[_0x6c9a('0x1d')](function(_0x3e72c0){logger[_0x6c9a('0x1e')](_0x6c9a('0x1f'),_0xcdb655,'request\x20sent');logger['debug'](_0x6c9a('0x20'),_0xcdb655,'request\x20sent',JSON[_0x6c9a('0x21')](_0x3e72c0));if(_0x3e72c0['error']){if(_0x3e72c0[_0x6c9a('0x22')]['code']===0x1f4){logger[_0x6c9a('0x22')]('FreshsalesAccount,\x20%s,\x20%s',_0xcdb655,_0x3e72c0[_0x6c9a('0x22')][_0x6c9a('0x23')]);return _0x3a5aba(_0x3e72c0['error'][_0x6c9a('0x23')]);}logger[_0x6c9a('0x22')](_0x6c9a('0x1f'),_0xcdb655,_0x3e72c0[_0x6c9a('0x22')][_0x6c9a('0x23')]);return _0x51e2d7(_0x3e72c0['error'][_0x6c9a('0x23')]);}else{logger[_0x6c9a('0x1e')](_0x6c9a('0x1f'),_0xcdb655,_0x6c9a('0x24'));_0x51e2d7(_0x3e72c0[_0x6c9a('0x25')][_0x6c9a('0x23')]);}})['catch'](function(_0x27df13){logger[_0x6c9a('0x22')](_0x6c9a('0x1f'),_0xcdb655,_0x27df13);_0x3a5aba(_0x27df13);});});}function respondWithStatusCode(_0x3f6ec3,_0x9193b8){_0x9193b8=_0x9193b8||0xcc;return function(_0x3c28f5){if(_0x3c28f5){return _0x3f6ec3[_0x6c9a('0x26')](_0x9193b8);}return _0x3f6ec3[_0x6c9a('0x27')](_0x9193b8)['end']();};}function respondWithResult(_0x18f63f,_0x268e5c){_0x268e5c=_0x268e5c||0xc8;return function(_0x393469){if(_0x393469){return _0x18f63f[_0x6c9a('0x27')](_0x268e5c)[_0x6c9a('0x28')](_0x393469);}};}function respondWithFilteredResult(_0x49d089,_0x4504d1){return function(_0x5e9964){if(_0x5e9964){var _0xb8195c=_0x5e9964[_0x6c9a('0x29')],_0x60c06c=_0x4504d1['offset'],_0x39625c=_0x4504d1[_0x6c9a('0x2a')]+_0x4504d1[_0x6c9a('0x2b')],_0x5d67cf;if(_0x39625c>=_0xb8195c){_0x39625c=_0xb8195c;_0x5d67cf=0xc8;}else{_0x5d67cf=0xce;}_0x49d089[_0x6c9a('0x27')](_0x5d67cf);return _0x49d089[_0x6c9a('0x2c')]('Content-Range',_0x60c06c+'-'+_0x39625c+'/'+_0xb8195c)[_0x6c9a('0x28')](_0x5e9964);}return null;};}function patchUpdates(_0xf77226){return function(_0xbc99ef){try{jsonpatch[_0x6c9a('0x2d')](_0xbc99ef,_0xf77226,!![]);}catch(_0x1de9cd){return BPromise[_0x6c9a('0x2e')](_0x1de9cd);}return _0xbc99ef[_0x6c9a('0x2f')]();};}function saveUpdates(_0x35751d,_0x4a6cc4){return function(_0x29872f){if(_0x29872f){return _0x29872f[_0x6c9a('0x30')](_0x35751d)[_0x6c9a('0x1d')](function(_0xa2cdaf){return _0xa2cdaf;});}return null;};}function removeEntity(_0x15d292,_0x1eee05){return function(_0x33de65){if(_0x33de65){return _0x33de65[_0x6c9a('0x31')]()[_0x6c9a('0x1d')](function(){_0x15d292[_0x6c9a('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c68ee,_0x3ff4ff){return function(_0x4de342){if(!_0x4de342){_0x5c68ee[_0x6c9a('0x26')](0x194);}return _0x4de342;};}function handleError(_0x2d8a58,_0x5826bb){_0x5826bb=_0x5826bb||0x1f4;return function(_0x47c674){logger[_0x6c9a('0x22')](_0x47c674[_0x6c9a('0x32')]);if(_0x47c674[_0x6c9a('0x33')]){delete _0x47c674[_0x6c9a('0x33')];}_0x2d8a58['status'](_0x5826bb)[_0x6c9a('0x34')](_0x47c674);};}exports[_0x6c9a('0x35')]=function(_0xbc7732,_0x1faedb){var _0x3aefe8={},_0x20095d={},_0x8c4716={'count':0x0,'rows':[]};var _0x29a39c=_[_0x6c9a('0x36')](db[_0x6c9a('0x37')][_0x6c9a('0x38')],function(_0xfaf811){return{'name':_0xfaf811[_0x6c9a('0x39')],'type':_0xfaf811[_0x6c9a('0x3a')][_0x6c9a('0x3b')]};});_0x20095d[_0x6c9a('0x3c')]=_[_0x6c9a('0x36')](_0x29a39c,'name');_0x20095d['query']=_[_0x6c9a('0x3d')](_0xbc7732[_0x6c9a('0x3e')]);_0x20095d[_0x6c9a('0x3f')]=_['intersection'](_0x20095d[_0x6c9a('0x3c')],_0x20095d[_0x6c9a('0x3e')]);_0x3aefe8[_0x6c9a('0x40')]=_[_0x6c9a('0x41')](_0x20095d[_0x6c9a('0x3c')],qs[_0x6c9a('0x42')](_0xbc7732['query'][_0x6c9a('0x42')]));_0x3aefe8[_0x6c9a('0x40')]=_0x3aefe8['attributes'][_0x6c9a('0x43')]?_0x3aefe8[_0x6c9a('0x40')]:_0x20095d['model'];if(!_0xbc7732['query'][_0x6c9a('0x44')](_0x6c9a('0x45'))){_0x3aefe8[_0x6c9a('0x2b')]=qs[_0x6c9a('0x2b')](_0xbc7732[_0x6c9a('0x3e')][_0x6c9a('0x2b')]);_0x3aefe8[_0x6c9a('0x2a')]=qs['offset'](_0xbc7732[_0x6c9a('0x3e')][_0x6c9a('0x2a')]);}_0x3aefe8[_0x6c9a('0x46')]=qs[_0x6c9a('0x47')](_0xbc7732[_0x6c9a('0x3e')]['sort']);_0x3aefe8[_0x6c9a('0x48')]=qs[_0x6c9a('0x3f')](_[_0x6c9a('0x49')](_0xbc7732['query'],_0x20095d['filters']),_0x29a39c);if(_0xbc7732[_0x6c9a('0x3e')][_0x6c9a('0x4a')]){_0x3aefe8[_0x6c9a('0x48')]=_[_0x6c9a('0x4b')](_0x3aefe8[_0x6c9a('0x48')],{'$or':_['map'](_0x29a39c,function(_0x2752e2){if(_0x2752e2[_0x6c9a('0x3a')]!==_0x6c9a('0x4c')){var _0x1fa05c={};_0x1fa05c[_0x2752e2[_0x6c9a('0x33')]]={'$like':'%'+_0xbc7732[_0x6c9a('0x3e')][_0x6c9a('0x4a')]+'%'};return _0x1fa05c;}})});}_0x3aefe8=_[_0x6c9a('0x4b')]({},_0x3aefe8,_0xbc7732[_0x6c9a('0x4d')]);var _0x1a5508={'where':_0x3aefe8[_0x6c9a('0x48')]};return db[_0x6c9a('0x37')][_0x6c9a('0x29')](_0x1a5508)[_0x6c9a('0x1d')](function(_0x33b87a){_0x8c4716[_0x6c9a('0x29')]=_0x33b87a;if(_0xbc7732[_0x6c9a('0x3e')][_0x6c9a('0x4e')]){_0x3aefe8[_0x6c9a('0x4f')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x6c9a('0x50')](_0x3aefe8);})['then'](function(_0x3622ff){_0x8c4716[_0x6c9a('0x51')]=_0x3622ff;return _0x8c4716;})[_0x6c9a('0x1d')](respondWithFilteredResult(_0x1faedb,_0x3aefe8))[_0x6c9a('0x52')](handleError(_0x1faedb,null));};exports[_0x6c9a('0x53')]=function(_0x16ba08,_0x34a824){var _0x75def9={'raw':![],'where':{'id':_0x16ba08[_0x6c9a('0x54')]['id']}},_0x335200={};_0x335200[_0x6c9a('0x3c')]=_[_0x6c9a('0x3d')](db[_0x6c9a('0x37')][_0x6c9a('0x38')]);_0x335200['query']=_[_0x6c9a('0x3d')](_0x16ba08[_0x6c9a('0x3e')]);_0x335200[_0x6c9a('0x3f')]=_['intersection'](_0x335200['model'],_0x335200[_0x6c9a('0x3e')]);_0x75def9[_0x6c9a('0x40')]=_[_0x6c9a('0x41')](_0x335200[_0x6c9a('0x3c')],qs[_0x6c9a('0x42')](_0x16ba08[_0x6c9a('0x3e')]['fields']));_0x75def9[_0x6c9a('0x40')]=_0x75def9['attributes'][_0x6c9a('0x43')]?_0x75def9[_0x6c9a('0x40')]:_0x335200[_0x6c9a('0x3c')];if(_0x16ba08[_0x6c9a('0x3e')][_0x6c9a('0x4e')]){_0x75def9[_0x6c9a('0x4f')]=[{'all':!![]}];}_0x75def9=_['merge']({},_0x75def9,_0x16ba08[_0x6c9a('0x4d')]);return db[_0x6c9a('0x37')][_0x6c9a('0x55')](_0x75def9)[_0x6c9a('0x1d')](handleEntityNotFound(_0x34a824,null))[_0x6c9a('0x1d')](respondWithResult(_0x34a824,null))['catch'](handleError(_0x34a824,null));};exports[_0x6c9a('0x56')]=function(_0x33f2fd,_0xe35e8b){return db['FreshsalesAccount'][_0x6c9a('0x56')](_0x33f2fd[_0x6c9a('0x57')],{})[_0x6c9a('0x1d')](respondWithResult(_0xe35e8b,0xc9))[_0x6c9a('0x52')](handleError(_0xe35e8b,null));};exports['update']=function(_0x2a4f20,_0x407a6d){if(_0x2a4f20[_0x6c9a('0x57')]['id']){delete _0x2a4f20[_0x6c9a('0x57')]['id'];}return db[_0x6c9a('0x37')]['find']({'where':{'id':_0x2a4f20['params']['id']}})['then'](handleEntityNotFound(_0x407a6d,null))['then'](saveUpdates(_0x2a4f20[_0x6c9a('0x57')],null))['then'](respondWithResult(_0x407a6d,null))[_0x6c9a('0x52')](handleError(_0x407a6d,null));};exports['destroy']=function(_0x372ea4,_0x1ec5b0){return db['FreshsalesAccount'][_0x6c9a('0x55')]({'where':{'id':_0x372ea4[_0x6c9a('0x54')]['id']}})[_0x6c9a('0x1d')](handleEntityNotFound(_0x1ec5b0,null))['then'](removeEntity(_0x1ec5b0,null))[_0x6c9a('0x52')](handleError(_0x1ec5b0,null));};exports[_0x6c9a('0x58')]=function(_0x208f2b,_0x484c7a,_0xc41915){var _0x36876c={};var _0x4e90e1={};var _0x5b5c8e;var _0x2482ff;return db[_0x6c9a('0x37')]['findOne']({'where':{'id':_0x208f2b[_0x6c9a('0x54')]['id']}})['then'](handleEntityNotFound(_0x484c7a,null))[_0x6c9a('0x1d')](function(_0x3f41df){if(_0x3f41df){_0x5b5c8e=_0x3f41df;_0x4e90e1[_0x6c9a('0x3c')]=_[_0x6c9a('0x3d')](db[_0x6c9a('0x59')][_0x6c9a('0x38')]);_0x4e90e1[_0x6c9a('0x3e')]=_[_0x6c9a('0x3d')](_0x208f2b[_0x6c9a('0x3e')]);_0x4e90e1['filters']=_[_0x6c9a('0x41')](_0x4e90e1[_0x6c9a('0x3c')],_0x4e90e1[_0x6c9a('0x3e')]);_0x36876c['attributes']=_[_0x6c9a('0x41')](_0x4e90e1[_0x6c9a('0x3c')],qs[_0x6c9a('0x42')](_0x208f2b[_0x6c9a('0x3e')][_0x6c9a('0x42')]));_0x36876c['attributes']=_0x36876c[_0x6c9a('0x40')][_0x6c9a('0x43')]?_0x36876c[_0x6c9a('0x40')]:_0x4e90e1['model'];_0x36876c[_0x6c9a('0x46')]=qs[_0x6c9a('0x47')](_0x208f2b[_0x6c9a('0x3e')][_0x6c9a('0x47')]);_0x36876c[_0x6c9a('0x48')]=qs['filters'](_['pick'](_0x208f2b[_0x6c9a('0x3e')],_0x4e90e1[_0x6c9a('0x3f')]));if(_0x208f2b[_0x6c9a('0x3e')][_0x6c9a('0x4a')]){_0x36876c[_0x6c9a('0x48')]=_[_0x6c9a('0x4b')](_0x36876c[_0x6c9a('0x48')],{'$or':_['map'](_0x36876c[_0x6c9a('0x40')],function(_0x4cfbd8){var _0x4e1638={};_0x4e1638[_0x4cfbd8]={'$like':'%'+_0x208f2b[_0x6c9a('0x3e')][_0x6c9a('0x4a')]+'%'};return _0x4e1638;})});}_0x36876c=_[_0x6c9a('0x4b')]({},_0x36876c,_0x208f2b[_0x6c9a('0x4d')]);return _0x5b5c8e['getConfigurations'](_0x36876c);}})['then'](function(_0x2c329d){if(_0x2c329d){_0x2482ff=_0x2c329d[_0x6c9a('0x43')];if(!_0x208f2b[_0x6c9a('0x3e')][_0x6c9a('0x44')](_0x6c9a('0x45'))){_0x36876c[_0x6c9a('0x2b')]=qs[_0x6c9a('0x2b')](_0x208f2b[_0x6c9a('0x3e')][_0x6c9a('0x2b')]);_0x36876c[_0x6c9a('0x2a')]=qs['offset'](_0x208f2b['query']['offset']);}return _0x5b5c8e['getConfigurations'](_0x36876c);}})['then'](function(_0x55f051){if(_0x55f051){return _0x55f051?{'count':_0x2482ff,'rows':_0x55f051}:null;}})[_0x6c9a('0x1d')](respondWithResult(_0x484c7a,null))[_0x6c9a('0x52')](handleError(_0x484c7a,null));};exports[_0x6c9a('0x5a')]=function(_0x4ee8b6,_0x5c5cb2,_0x6df05){if(_0x4ee8b6['body']['id']){delete _0x4ee8b6[_0x6c9a('0x57')]['id'];}return db['FreshsalesAccount'][_0x6c9a('0x5b')]({'where':{'id':_0x4ee8b6['params']['id']}})['then'](handleEntityNotFound(_0x5c5cb2,null))[_0x6c9a('0x1d')](function(_0xc03d9a){if(_0xc03d9a){_0x4ee8b6[_0x6c9a('0x57')][_0x6c9a('0x5c')]=_0xc03d9a['id'];_0x4ee8b6[_0x6c9a('0x57')][_0x6c9a('0x5d')]=integrations[_0x6c9a('0x5e')](_0x4ee8b6[_0x6c9a('0x57')][_0x6c9a('0x5f')],_0x4ee8b6[_0x6c9a('0x57')][_0x6c9a('0x3a')]);_0x4ee8b6[_0x6c9a('0x57')][_0x6c9a('0x60')]=integrations['getDescriptions'](_0x4ee8b6['body'][_0x6c9a('0x5f')],_0x4ee8b6['body'][_0x6c9a('0x3a')]);return db[_0x6c9a('0x59')][_0x6c9a('0x56')](_0x4ee8b6[_0x6c9a('0x57')],{'include':[{'model':db[_0x6c9a('0x61')],'as':_0x6c9a('0x5d')},{'model':db[_0x6c9a('0x61')],'as':_0x6c9a('0x60')}]});}return null;})[_0x6c9a('0x1d')](respondWithResult(_0x5c5cb2,null))[_0x6c9a('0x52')](handleError(_0x5c5cb2,null));};exports[_0x6c9a('0x62')]=function(_0x4b4f0f,_0x261415,_0xf58ba6){var _0x38f115='';var _0x1b6398='';return db['FreshsalesAccount'][_0x6c9a('0x5b')]({'where':{'id':_0x4b4f0f[_0x6c9a('0x54')]['id']},'attributes':['id',_0x6c9a('0x63'),_0x6c9a('0x64'),_0x6c9a('0x65')]})[_0x6c9a('0x1d')](handleEntityNotFound(_0x261415,null))[_0x6c9a('0x1d')](function(_0x172a8d){if(_0x172a8d){_0x1b6398=_0x172a8d['username'];_0x38f115=_0x172a8d[_0x6c9a('0x64')];var _0x33ac0b=_0x172a8d[_0x6c9a('0x64')][_0x6c9a('0x66')](-0x1);if(_0x33ac0b==='/'){_0x38f115=_0x38f115[_0x6c9a('0x67')](0x0,_0x38f115[_0x6c9a('0x68')](_0x33ac0b));}return rp({'method':'GET','uri':util['format'](_0x6c9a('0x69'),_0x38f115,_0x6c9a('0x6a')),'headers':{'Authorization':'Token\x20token='+_0x172a8d[_0x6c9a('0x65')]},'json':!![]});}})[_0x6c9a('0x1d')](function(_0x43e6ff){if(_0x43e6ff){var _0xa694fa=_0x43e6ff[_0x6c9a('0x6b')];var _0x5d4030=![];var _0x5da27b=null;for(_0x5da27b=0x0;_0x5da27b<_0xa694fa[_0x6c9a('0x43')];_0x5da27b++){if(_0xa694fa[_0x5da27b]['email']===_0x1b6398){_0x5d4030=!![];}}if(_0x5d4030){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x6c9a('0x6c')});}}})[_0x6c9a('0x1d')](respondWithResult(_0x261415,null))[_0x6c9a('0x52')](function(_0x3a4071){var _0x2545b8=_0x4b4f0f[_0x6c9a('0x3e')][_0x6c9a('0x6d')]?0x1f4:_0x3a4071['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2545b8,JSON[_0x6c9a('0x21')](_0x3a4071));delete _0x3a4071['name'];if(_0x2545b8===0x191){_0x2545b8=0x190;}_0x261415['status'](_0x2545b8)['send'](_0x4b4f0f[_0x6c9a('0x3e')][_0x6c9a('0x6d')]?{'message':_0x6c9a('0x6e'),'statusCode':_0x3a4071[_0x6c9a('0x6f')]}:_0x3a4071);});}; \ No newline at end of file +var _0x2d8d=['jayson/promise','client','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','update','then','stack','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','name','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','include','show','params','includeAll','options','find','create','body','destroy','findOne','keys','FreshsalesConfiguration','filter','limit','getConfigurations','AccountId','channel','Descriptions','FreshsalesField','Subjects','getFields','username','remoteUri','GET','format','/api/selector/owners','length','email','Requested\x20Resource\x20not\x20Found','test','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2d8d,0x179));var _0xd2d8=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0x2d8d[_0x5cc8];return _0x450661;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd2d8('0x0'));var rimraf=require(_0xd2d8('0x1'));var zipdir=require(_0xd2d8('0x2'));var jsonpatch=require(_0xd2d8('0x3'));var rp=require('request-promise');var moment=require(_0xd2d8('0x4'));var BPromise=require(_0xd2d8('0x5'));var Mustache=require('mustache');var util=require(_0xd2d8('0x6'));var path=require(_0xd2d8('0x7'));var sox=require(_0xd2d8('0x8'));var csv=require(_0xd2d8('0x9'));var ejs=require(_0xd2d8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd2d8('0xb'));var crypto=require(_0xd2d8('0xc'));var jsforce=require(_0xd2d8('0xd'));var deskjs=require(_0xd2d8('0xe'));var toCsv=require(_0xd2d8('0x9'));var querystring=require('querystring');var Papa=require(_0xd2d8('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd2d8('0x10'));var as=require(_0xd2d8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2d8('0x12'))('api');var utils=require(_0xd2d8('0x13'));var config=require(_0xd2d8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd2d8('0x15'))['db'];var integrations=require(_0xd2d8('0x16'));var jayson=require(_0xd2d8('0x17'));var client=jayson[_0xd2d8('0x18')][_0xd2d8('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xebcc64,_0xb97b78,_0x594d4b,_0x3e6ddf){return new BPromise(function(_0x4266a9,_0x297a03){var _0x3724a4=_0x3e6ddf||client;return _0x3724a4['request'](_0xebcc64,_0x594d4b)['then'](function(_0x186f94){logger[_0xd2d8('0x1a')](_0xd2d8('0x1b'),_0xb97b78,_0xd2d8('0x1c'));logger[_0xd2d8('0x1d')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0xb97b78,_0xd2d8('0x1c'),JSON[_0xd2d8('0x1e')](_0x186f94));if(_0x186f94[_0xd2d8('0x1f')]){if(_0x186f94[_0xd2d8('0x1f')]['code']===0x1f4){logger[_0xd2d8('0x1f')](_0xd2d8('0x1b'),_0xb97b78,_0x186f94[_0xd2d8('0x1f')][_0xd2d8('0x20')]);return _0x297a03(_0x186f94[_0xd2d8('0x1f')][_0xd2d8('0x20')]);}logger['error'](_0xd2d8('0x1b'),_0xb97b78,_0x186f94['error'][_0xd2d8('0x20')]);return _0x4266a9(_0x186f94['error']['message']);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0xb97b78,_0xd2d8('0x1c'));_0x4266a9(_0x186f94[_0xd2d8('0x21')][_0xd2d8('0x20')]);}})[_0xd2d8('0x22')](function(_0x46b642){logger[_0xd2d8('0x1f')](_0xd2d8('0x1b'),_0xb97b78,_0x46b642);_0x297a03(_0x46b642);});});}function respondWithStatusCode(_0x3f5652,_0x52995a){_0x52995a=_0x52995a||0xcc;return function(_0x5316d3){if(_0x5316d3){return _0x3f5652[_0xd2d8('0x23')](_0x52995a);}return _0x3f5652[_0xd2d8('0x24')](_0x52995a)[_0xd2d8('0x25')]();};}function respondWithResult(_0xaf3775,_0x4de89e){_0x4de89e=_0x4de89e||0xc8;return function(_0x762090){if(_0x762090){return _0xaf3775[_0xd2d8('0x24')](_0x4de89e)[_0xd2d8('0x26')](_0x762090);}};}function respondWithFilteredResult(_0x12f622,_0x21f7e){return function(_0x4d4f1a){if(_0x4d4f1a){var _0x4df964=_0x4d4f1a[_0xd2d8('0x27')],_0x4253c1=_0x21f7e[_0xd2d8('0x28')],_0x18731a=_0x21f7e['offset']+_0x21f7e['limit'],_0x52260e;if(_0x18731a>=_0x4df964){_0x18731a=_0x4df964;_0x52260e=0xc8;}else{_0x52260e=0xce;}_0x12f622[_0xd2d8('0x24')](_0x52260e);return _0x12f622[_0xd2d8('0x29')](_0xd2d8('0x2a'),_0x4253c1+'-'+_0x18731a+'/'+_0x4df964)[_0xd2d8('0x26')](_0x4d4f1a);}return null;};}function patchUpdates(_0x29ce21){return function(_0x54a194){try{jsonpatch['apply'](_0x54a194,_0x29ce21,!![]);}catch(_0x4d85f4){return BPromise[_0xd2d8('0x2b')](_0x4d85f4);}return _0x54a194['save']();};}function saveUpdates(_0x455590,_0x3fd91c){return function(_0x52d21c){if(_0x52d21c){return _0x52d21c[_0xd2d8('0x2c')](_0x455590)[_0xd2d8('0x2d')](function(_0x17f70f){return _0x17f70f;});}return null;};}function removeEntity(_0x537466,_0x3b5ca2){return function(_0x1d77fc){if(_0x1d77fc){return _0x1d77fc['destroy']()[_0xd2d8('0x2d')](function(){_0x537466['status'](0xcc)[_0xd2d8('0x25')]();});}};}function handleEntityNotFound(_0x2613f8,_0x53f114){return function(_0x33dafc){if(!_0x33dafc){_0x2613f8[_0xd2d8('0x23')](0x194);}return _0x33dafc;};}function handleError(_0x819721,_0x20479c){_0x20479c=_0x20479c||0x1f4;return function(_0x157061){logger[_0xd2d8('0x1f')](_0x157061[_0xd2d8('0x2e')]);if(_0x157061['name']){delete _0x157061['name'];}_0x819721['status'](_0x20479c)['send'](_0x157061);};}exports[_0xd2d8('0x2f')]=function(_0x3d31bd,_0x3b676f){var _0x4d676a={},_0xc172cd={},_0x21913b={'count':0x0,'rows':[]};var _0x123f2f=_['map'](db[_0xd2d8('0x30')][_0xd2d8('0x31')],function(_0x3da270){return{'name':_0x3da270[_0xd2d8('0x32')],'type':_0x3da270[_0xd2d8('0x33')][_0xd2d8('0x34')]};});_0xc172cd[_0xd2d8('0x35')]=_[_0xd2d8('0x36')](_0x123f2f,_0xd2d8('0x37'));_0xc172cd['query']=_['keys'](_0x3d31bd[_0xd2d8('0x38')]);_0xc172cd['filters']=_[_0xd2d8('0x39')](_0xc172cd[_0xd2d8('0x35')],_0xc172cd[_0xd2d8('0x38')]);_0x4d676a[_0xd2d8('0x3a')]=_['intersection'](_0xc172cd[_0xd2d8('0x35')],qs[_0xd2d8('0x3b')](_0x3d31bd[_0xd2d8('0x38')][_0xd2d8('0x3b')]));_0x4d676a[_0xd2d8('0x3a')]=_0x4d676a[_0xd2d8('0x3a')]['length']?_0x4d676a[_0xd2d8('0x3a')]:_0xc172cd[_0xd2d8('0x35')];if(!_0x3d31bd[_0xd2d8('0x38')][_0xd2d8('0x3c')](_0xd2d8('0x3d'))){_0x4d676a['limit']=qs['limit'](_0x3d31bd[_0xd2d8('0x38')]['limit']);_0x4d676a[_0xd2d8('0x28')]=qs[_0xd2d8('0x28')](_0x3d31bd[_0xd2d8('0x38')][_0xd2d8('0x28')]);}_0x4d676a[_0xd2d8('0x3e')]=qs[_0xd2d8('0x3f')](_0x3d31bd[_0xd2d8('0x38')][_0xd2d8('0x3f')]);_0x4d676a[_0xd2d8('0x40')]=qs[_0xd2d8('0x41')](_[_0xd2d8('0x42')](_0x3d31bd[_0xd2d8('0x38')],_0xc172cd[_0xd2d8('0x41')]),_0x123f2f);if(_0x3d31bd[_0xd2d8('0x38')]['filter']){_0x4d676a[_0xd2d8('0x40')]=_['merge'](_0x4d676a[_0xd2d8('0x40')],{'$or':_[_0xd2d8('0x36')](_0x123f2f,function(_0x1e5f63){if(_0x1e5f63['type']!==_0xd2d8('0x43')){var _0xa5fa4f={};_0xa5fa4f[_0x1e5f63[_0xd2d8('0x37')]]={'$like':'%'+_0x3d31bd[_0xd2d8('0x38')]['filter']+'%'};return _0xa5fa4f;}})});}_0x4d676a=_[_0xd2d8('0x44')]({},_0x4d676a,_0x3d31bd['options']);var _0x5d2468={'where':_0x4d676a['where']};return db[_0xd2d8('0x30')]['count'](_0x5d2468)[_0xd2d8('0x2d')](function(_0x44ee7b){_0x21913b[_0xd2d8('0x27')]=_0x44ee7b;if(_0x3d31bd['query']['includeAll']){_0x4d676a[_0xd2d8('0x45')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x4d676a);})[_0xd2d8('0x2d')](function(_0x53ce21){_0x21913b['rows']=_0x53ce21;return _0x21913b;})[_0xd2d8('0x2d')](respondWithFilteredResult(_0x3b676f,_0x4d676a))[_0xd2d8('0x22')](handleError(_0x3b676f,null));};exports[_0xd2d8('0x46')]=function(_0x412629,_0x5635d6){var _0x5cee4a={'raw':![],'where':{'id':_0x412629[_0xd2d8('0x47')]['id']}},_0x3e0173={};_0x3e0173[_0xd2d8('0x35')]=_['keys'](db['FreshsalesAccount'][_0xd2d8('0x31')]);_0x3e0173[_0xd2d8('0x38')]=_['keys'](_0x412629[_0xd2d8('0x38')]);_0x3e0173[_0xd2d8('0x41')]=_['intersection'](_0x3e0173['model'],_0x3e0173[_0xd2d8('0x38')]);_0x5cee4a[_0xd2d8('0x3a')]=_[_0xd2d8('0x39')](_0x3e0173['model'],qs['fields'](_0x412629[_0xd2d8('0x38')][_0xd2d8('0x3b')]));_0x5cee4a[_0xd2d8('0x3a')]=_0x5cee4a[_0xd2d8('0x3a')]['length']?_0x5cee4a[_0xd2d8('0x3a')]:_0x3e0173['model'];if(_0x412629[_0xd2d8('0x38')][_0xd2d8('0x48')]){_0x5cee4a[_0xd2d8('0x45')]=[{'all':!![]}];}_0x5cee4a=_['merge']({},_0x5cee4a,_0x412629[_0xd2d8('0x49')]);return db[_0xd2d8('0x30')][_0xd2d8('0x4a')](_0x5cee4a)[_0xd2d8('0x2d')](handleEntityNotFound(_0x5635d6,null))['then'](respondWithResult(_0x5635d6,null))[_0xd2d8('0x22')](handleError(_0x5635d6,null));};exports[_0xd2d8('0x4b')]=function(_0x13f25e,_0x186f6e){return db['FreshsalesAccount'][_0xd2d8('0x4b')](_0x13f25e[_0xd2d8('0x4c')],{})[_0xd2d8('0x2d')](respondWithResult(_0x186f6e,0xc9))[_0xd2d8('0x22')](handleError(_0x186f6e,null));};exports[_0xd2d8('0x2c')]=function(_0x12808c,_0x7decb2){if(_0x12808c[_0xd2d8('0x4c')]['id']){delete _0x12808c['body']['id'];}return db[_0xd2d8('0x30')][_0xd2d8('0x4a')]({'where':{'id':_0x12808c[_0xd2d8('0x47')]['id']}})[_0xd2d8('0x2d')](handleEntityNotFound(_0x7decb2,null))[_0xd2d8('0x2d')](saveUpdates(_0x12808c[_0xd2d8('0x4c')],null))[_0xd2d8('0x2d')](respondWithResult(_0x7decb2,null))[_0xd2d8('0x22')](handleError(_0x7decb2,null));};exports[_0xd2d8('0x4d')]=function(_0x58a376,_0x3da815){return db[_0xd2d8('0x30')][_0xd2d8('0x4a')]({'where':{'id':_0x58a376[_0xd2d8('0x47')]['id']}})[_0xd2d8('0x2d')](handleEntityNotFound(_0x3da815,null))[_0xd2d8('0x2d')](removeEntity(_0x3da815,null))[_0xd2d8('0x22')](handleError(_0x3da815,null));};exports['getConfigurations']=function(_0x4eae47,_0x1e20aa,_0x2d06d2){var _0x5aafc9={};var _0x1290fd={};var _0x5bb781;var _0x5e96d2;return db[_0xd2d8('0x30')][_0xd2d8('0x4e')]({'where':{'id':_0x4eae47['params']['id']}})['then'](handleEntityNotFound(_0x1e20aa,null))[_0xd2d8('0x2d')](function(_0x5131fa){if(_0x5131fa){_0x5bb781=_0x5131fa;_0x1290fd[_0xd2d8('0x35')]=_[_0xd2d8('0x4f')](db[_0xd2d8('0x50')]['rawAttributes']);_0x1290fd['query']=_[_0xd2d8('0x4f')](_0x4eae47[_0xd2d8('0x38')]);_0x1290fd[_0xd2d8('0x41')]=_[_0xd2d8('0x39')](_0x1290fd['model'],_0x1290fd[_0xd2d8('0x38')]);_0x5aafc9[_0xd2d8('0x3a')]=_[_0xd2d8('0x39')](_0x1290fd['model'],qs[_0xd2d8('0x3b')](_0x4eae47[_0xd2d8('0x38')][_0xd2d8('0x3b')]));_0x5aafc9[_0xd2d8('0x3a')]=_0x5aafc9[_0xd2d8('0x3a')]['length']?_0x5aafc9['attributes']:_0x1290fd['model'];_0x5aafc9['order']=qs[_0xd2d8('0x3f')](_0x4eae47[_0xd2d8('0x38')][_0xd2d8('0x3f')]);_0x5aafc9['where']=qs['filters'](_[_0xd2d8('0x42')](_0x4eae47[_0xd2d8('0x38')],_0x1290fd[_0xd2d8('0x41')]));if(_0x4eae47['query']['filter']){_0x5aafc9[_0xd2d8('0x40')]=_[_0xd2d8('0x44')](_0x5aafc9[_0xd2d8('0x40')],{'$or':_[_0xd2d8('0x36')](_0x5aafc9[_0xd2d8('0x3a')],function(_0x4fb5d9){var _0x2878db={};_0x2878db[_0x4fb5d9]={'$like':'%'+_0x4eae47[_0xd2d8('0x38')][_0xd2d8('0x51')]+'%'};return _0x2878db;})});}_0x5aafc9=_['merge']({},_0x5aafc9,_0x4eae47[_0xd2d8('0x49')]);return _0x5bb781['getConfigurations'](_0x5aafc9);}})[_0xd2d8('0x2d')](function(_0xdf702c){if(_0xdf702c){_0x5e96d2=_0xdf702c['length'];if(!_0x4eae47[_0xd2d8('0x38')][_0xd2d8('0x3c')](_0xd2d8('0x3d'))){_0x5aafc9['limit']=qs['limit'](_0x4eae47[_0xd2d8('0x38')][_0xd2d8('0x52')]);_0x5aafc9[_0xd2d8('0x28')]=qs[_0xd2d8('0x28')](_0x4eae47['query'][_0xd2d8('0x28')]);}return _0x5bb781[_0xd2d8('0x53')](_0x5aafc9);}})['then'](function(_0x3754c8){if(_0x3754c8){return _0x3754c8?{'count':_0x5e96d2,'rows':_0x3754c8}:null;}})['then'](respondWithResult(_0x1e20aa,null))[_0xd2d8('0x22')](handleError(_0x1e20aa,null));};exports['addConfiguration']=function(_0x1f110d,_0x35d359,_0x3d76ec){if(_0x1f110d[_0xd2d8('0x4c')]['id']){delete _0x1f110d[_0xd2d8('0x4c')]['id'];}return db[_0xd2d8('0x30')][_0xd2d8('0x4e')]({'where':{'id':_0x1f110d['params']['id']}})[_0xd2d8('0x2d')](handleEntityNotFound(_0x35d359,null))['then'](function(_0x3a330b){if(_0x3a330b){_0x1f110d[_0xd2d8('0x4c')][_0xd2d8('0x54')]=_0x3a330b['id'];_0x1f110d['body']['Subjects']=integrations['getSubjects'](_0x1f110d[_0xd2d8('0x4c')][_0xd2d8('0x55')],_0x1f110d[_0xd2d8('0x4c')]['type']);_0x1f110d[_0xd2d8('0x4c')][_0xd2d8('0x56')]=integrations['getDescriptions'](_0x1f110d[_0xd2d8('0x4c')][_0xd2d8('0x55')],_0x1f110d[_0xd2d8('0x4c')][_0xd2d8('0x33')]);return db[_0xd2d8('0x50')][_0xd2d8('0x4b')](_0x1f110d[_0xd2d8('0x4c')],{'include':[{'model':db[_0xd2d8('0x57')],'as':_0xd2d8('0x58')},{'model':db['FreshsalesField'],'as':_0xd2d8('0x56')}]});}return null;})['then'](respondWithResult(_0x35d359,null))['catch'](handleError(_0x35d359,null));};exports[_0xd2d8('0x59')]=function(_0x401d15,_0x318f0a,_0x2a789d){var _0x27c610='';var _0x2f9ee4='';return db['FreshsalesAccount'][_0xd2d8('0x4e')]({'where':{'id':_0x401d15[_0xd2d8('0x47')]['id']},'attributes':['id',_0xd2d8('0x5a'),_0xd2d8('0x5b'),'apiKey']})[_0xd2d8('0x2d')](handleEntityNotFound(_0x318f0a,null))['then'](function(_0x16182e){if(_0x16182e){_0x2f9ee4=_0x16182e[_0xd2d8('0x5a')];_0x27c610=_0x16182e[_0xd2d8('0x5b')];var _0x208653=_0x16182e['remoteUri']['slice'](-0x1);if(_0x208653==='/'){_0x27c610=_0x27c610['substring'](0x0,_0x27c610['lastIndexOf'](_0x208653));}return rp({'method':_0xd2d8('0x5c'),'uri':util[_0xd2d8('0x5d')]('%s%s',_0x27c610,_0xd2d8('0x5e')),'headers':{'Authorization':'Token\x20token='+_0x16182e['apiKey']},'json':!![]});}})['then'](function(_0x13b0da){if(_0x13b0da){var _0x592513=_0x13b0da['users'];var _0x32d2b7=![];var _0x2262df=null;for(_0x2262df=0x0;_0x2262df<_0x592513[_0xd2d8('0x5f')];_0x2262df++){if(_0x592513[_0x2262df][_0xd2d8('0x60')]===_0x2f9ee4){_0x32d2b7=!![];}}if(_0x32d2b7){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xd2d8('0x61')});}}})[_0xd2d8('0x2d')](respondWithResult(_0x318f0a,null))[_0xd2d8('0x22')](function(_0x762e){var _0xaa21f0=_0x401d15[_0xd2d8('0x38')][_0xd2d8('0x62')]?0x1f4:_0x762e[_0xd2d8('0x63')]||0x1f4;logger[_0xd2d8('0x1f')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xaa21f0,JSON[_0xd2d8('0x1e')](_0x762e));delete _0x762e[_0xd2d8('0x37')];if(_0xaa21f0===0x191){_0xaa21f0=0x190;}_0x318f0a['status'](_0xaa21f0)['send'](_0x401d15[_0xd2d8('0x38')][_0xd2d8('0x62')]?{'message':'Wrong\x20credentials','statusCode':_0x762e[_0xd2d8('0x63')]}:_0x762e);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 57691f1..4bb0bed 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 _0x31f5=['./intFreshsalesAccount.attributes','exports','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x31f5,0x1a4));var _0x531f=function(_0x560638,_0x55cb9c){_0x560638=_0x560638-0x0;var _0x23b648=_0x31f5[_0x560638];return _0x23b648;};'use strict';var _=require('lodash');var util=require(_0x531f('0x0'));var logger=require(_0x531f('0x1'))(_0x531f('0x2'));var moment=require(_0x531f('0x3'));var BPromise=require(_0x531f('0x4'));var rp=require(_0x531f('0x5'));var fs=require('fs');var path=require(_0x531f('0x6'));var rimraf=require(_0x531f('0x7'));var config=require(_0x531f('0x8'));var attributes=require(_0x531f('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x531f('0xa')]=function(_0x1d82f0,_0x7e634c){return _0x1d82f0['define'](_0x531f('0xb'),attributes,{'tableName':_0x531f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d53=['request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x427cc0,_0x2e6d47){var _0x20f99d=function(_0x1f4a2e){while(--_0x1f4a2e){_0x427cc0['push'](_0x427cc0['shift']());}};_0x20f99d(++_0x2e6d47);}(_0x2d53,0xae));var _0x32d5=function(_0x39439f,_0x5de32c){_0x39439f=_0x39439f-0x0;var _0x5bb4d7=_0x2d53[_0x39439f];return _0x5bb4d7;};'use strict';var _=require(_0x32d5('0x0'));var util=require(_0x32d5('0x1'));var logger=require(_0x32d5('0x2'))(_0x32d5('0x3'));var moment=require(_0x32d5('0x4'));var BPromise=require(_0x32d5('0x5'));var rp=require(_0x32d5('0x6'));var fs=require('fs');var path=require(_0x32d5('0x7'));var rimraf=require(_0x32d5('0x8'));var config=require(_0x32d5('0x9'));var attributes=require(_0x32d5('0xa'));var integrations=require(_0x32d5('0xb'));module[_0x32d5('0xc')]=function(_0x9c837c,_0x297ddd){return _0x9c837c[_0x32d5('0xd')]('FreshsalesAccount',attributes,{'tableName':_0x32d5('0xe'),'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 55830dc..37ff1ca 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 _0x0c8d=['randomstring','ioredis','../../config/environment','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','util','moment','bluebird'];(function(_0x19ad66,_0x432764){var _0x696309=function(_0x420019){while(--_0x420019){_0x19ad66['push'](_0x19ad66['shift']());}};_0x696309(++_0x432764);}(_0x0c8d,0x79));var _0xd0c8=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x0c8d[_0x29d94e];return _0x106237;};'use strict';var _=require('lodash');var util=require(_0xd0c8('0x0'));var moment=require(_0xd0c8('0x1'));var BPromise=require(_0xd0c8('0x2'));var rs=require(_0xd0c8('0x3'));var fs=require('fs');var Redis=require(_0xd0c8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd0c8('0x5'));var jayson=require(_0xd0c8('0x6'));var client=jayson[_0xd0c8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16d1c1,_0x5f0027,_0x415439){return new BPromise(function(_0x34e3d5,_0x2f6200){return client[_0xd0c8('0x8')](_0x16d1c1,_0x415439)[_0xd0c8('0x9')](function(_0x5678f9){logger[_0xd0c8('0xa')](_0xd0c8('0xb'),_0x5f0027,_0xd0c8('0xc'));logger[_0xd0c8('0xd')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5f0027,'request\x20sent',JSON[_0xd0c8('0xe')](_0x5678f9));if(_0x5678f9[_0xd0c8('0xf')]){if(_0x5678f9['error']['code']===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x5f0027,_0x5678f9['error'][_0xd0c8('0x10')]);return _0x2f6200(_0x5678f9[_0xd0c8('0xf')]['message']);}logger[_0xd0c8('0xf')](_0xd0c8('0xb'),_0x5f0027,_0x5678f9[_0xd0c8('0xf')][_0xd0c8('0x10')]);return _0x34e3d5(_0x5678f9[_0xd0c8('0xf')][_0xd0c8('0x10')]);}else{logger[_0xd0c8('0xa')](_0xd0c8('0xb'),_0x5f0027,_0xd0c8('0xc'));_0x34e3d5(_0x5678f9[_0xd0c8('0x11')][_0xd0c8('0x10')]);}})[_0xd0c8('0x12')](function(_0x58c3e0){logger[_0xd0c8('0xf')](_0xd0c8('0xb'),_0x5f0027,_0x58c3e0);_0x2f6200(_0x58c3e0);});});}exports[_0xd0c8('0x13')]=function(_0x5d02a5){var _0x59b06f=this;return new Promise(function(_0x32e360,_0x4bca93){return db['FreshsalesAccount'][_0xd0c8('0x14')]({'raw':_0x5d02a5[_0xd0c8('0x15')]?_0x5d02a5['options'][_0xd0c8('0x16')]===undefined?!![]:![]:!![],'where':_0x5d02a5[_0xd0c8('0x15')]?_0x5d02a5['options'][_0xd0c8('0x17')]||null:null,'attributes':_0x5d02a5[_0xd0c8('0x15')]?_0x5d02a5[_0xd0c8('0x15')][_0xd0c8('0x18')]||null:null,'limit':_0x5d02a5[_0xd0c8('0x15')]?_0x5d02a5[_0xd0c8('0x15')][_0xd0c8('0x19')]||null:null,'include':_0x5d02a5[_0xd0c8('0x15')]?_0x5d02a5[_0xd0c8('0x15')][_0xd0c8('0x1a')]?_[_0xd0c8('0x1b')](_0x5d02a5[_0xd0c8('0x15')][_0xd0c8('0x1a')],function(_0x4100d2){return{'model':db[_0x4100d2[_0xd0c8('0x1c')]],'as':_0x4100d2['as'],'attributes':_0x4100d2[_0xd0c8('0x18')],'include':_0x4100d2[_0xd0c8('0x1a')]?_[_0xd0c8('0x1b')](_0x4100d2[_0xd0c8('0x1a')],function(_0x5dde87){return{'model':db[_0x5dde87['model']],'as':_0x5dde87['as'],'attributes':_0x5dde87[_0xd0c8('0x18')],'include':_0x5dde87[_0xd0c8('0x1a')]?_[_0xd0c8('0x1b')](_0x5dde87[_0xd0c8('0x1a')],function(_0x1c84e5){return{'model':db[_0x1c84e5[_0xd0c8('0x1c')]],'as':_0x1c84e5['as'],'attributes':_0x1c84e5[_0xd0c8('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd0c8('0x9')](function(_0xdc380c){logger['info'](_0xd0c8('0x13'),_0x5d02a5);logger[_0xd0c8('0xd')](_0xd0c8('0x13'),_0x5d02a5,JSON['stringify'](_0xdc380c));_0x32e360(_0xdc380c);})['catch'](function(_0x4fa819){logger[_0xd0c8('0xf')]('GetFreshsalesAccount',_0x4fa819[_0xd0c8('0x10')],_0x5d02a5);_0x4bca93(_0x59b06f['error'](0x1f4,_0x4fa819[_0xd0c8('0x10')]));});});};exports[_0xd0c8('0x1d')]=function(_0x4abb89){var _0x30336a=this;return new Promise(function(_0x35f033,_0x3ee706){return db['FreshsalesAccount'][_0xd0c8('0x1e')]({'raw':_0x4abb89[_0xd0c8('0x15')]?_0x4abb89[_0xd0c8('0x15')][_0xd0c8('0x16')]===undefined?!![]:![]:!![],'where':_0x4abb89[_0xd0c8('0x15')]?_0x4abb89[_0xd0c8('0x15')][_0xd0c8('0x17')]||null:null,'attributes':_0x4abb89[_0xd0c8('0x15')]?_0x4abb89[_0xd0c8('0x15')][_0xd0c8('0x18')]||null:null,'include':_0x4abb89['options']?_0x4abb89['options']['include']?_[_0xd0c8('0x1b')](_0x4abb89['options'][_0xd0c8('0x1a')],function(_0x54d8cf){return{'model':db[_0x54d8cf[_0xd0c8('0x1c')]],'as':_0x54d8cf['as'],'attributes':_0x54d8cf[_0xd0c8('0x18')],'include':_0x54d8cf[_0xd0c8('0x1a')]?_[_0xd0c8('0x1b')](_0x54d8cf[_0xd0c8('0x1a')],function(_0x2e94a6){return{'model':db[_0x2e94a6[_0xd0c8('0x1c')]],'as':_0x2e94a6['as'],'attributes':_0x2e94a6['attributes'],'include':_0x2e94a6[_0xd0c8('0x1a')]?_[_0xd0c8('0x1b')](_0x2e94a6['include'],function(_0x2ac901){return{'model':db[_0x2ac901[_0xd0c8('0x1c')]],'as':_0x2ac901['as'],'attributes':_0x2ac901[_0xd0c8('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd0c8('0x9')](function(_0x3916d2){logger[_0xd0c8('0xa')]('ShowFreshsalesAccount',_0x4abb89);logger[_0xd0c8('0xd')](_0xd0c8('0x1d'),_0x4abb89,JSON[_0xd0c8('0xe')](_0x3916d2));_0x35f033(_0x3916d2);})[_0xd0c8('0x12')](function(_0x109ebc){logger[_0xd0c8('0xf')](_0xd0c8('0x1d'),_0x109ebc['message'],_0x4abb89);_0x3ee706(_0x30336a[_0xd0c8('0xf')](0x1f4,_0x109ebc[_0xd0c8('0x10')]));});});}; \ No newline at end of file +var _0xaebd=['GetFreshsalesAccount','findAll','options','raw','attributes','include','map','model','debug','ShowFreshsalesAccount','FreshsalesAccount','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshsalesAccount,\x20%s,\x20%s','catch'];(function(_0x1b52ac,_0x4b7eb7){var _0x3dc66=function(_0x51c03c){while(--_0x51c03c){_0x1b52ac['push'](_0x1b52ac['shift']());}};_0x3dc66(++_0x4b7eb7);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x458d18,_0x415811){_0x458d18=_0x458d18-0x0;var _0x5362c3=_0xaebd[_0x458d18];return _0x5362c3;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var moment=require(_0xdaeb('0x1'));var BPromise=require(_0xdaeb('0x2'));var rs=require(_0xdaeb('0x3'));var fs=require('fs');var Redis=require(_0xdaeb('0x4'));var db=require(_0xdaeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaeb('0x6'))(_0xdaeb('0x7'));var config=require(_0xdaeb('0x8'));var jayson=require(_0xdaeb('0x9'));var client=jayson[_0xdaeb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea090,_0x3f7ba1,_0x52c717){return new BPromise(function(_0x550bd9,_0x1b9d37){return client[_0xdaeb('0xb')](_0x3ea090,_0x52c717)[_0xdaeb('0xc')](function(_0x5e0ae9){logger[_0xdaeb('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x3f7ba1,_0xdaeb('0xe'));logger['debug'](_0xdaeb('0xf'),_0x3f7ba1,'request\x20sent',JSON[_0xdaeb('0x10')](_0x5e0ae9));if(_0x5e0ae9[_0xdaeb('0x11')]){if(_0x5e0ae9['error']['code']===0x1f4){logger[_0xdaeb('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);return _0x1b9d37(_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);}logger[_0xdaeb('0x11')](_0xdaeb('0x13'),_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')]['message']);return _0x550bd9(_0x5e0ae9['error'][_0xdaeb('0x12')]);}else{logger[_0xdaeb('0xd')](_0xdaeb('0x13'),_0x3f7ba1,_0xdaeb('0xe'));_0x550bd9(_0x5e0ae9['result']['message']);}})[_0xdaeb('0x14')](function(_0x4dd803){logger['error'](_0xdaeb('0x13'),_0x3f7ba1,_0x4dd803);_0x1b9d37(_0x4dd803);});});}exports[_0xdaeb('0x15')]=function(_0x1b5243){var _0x1fe84e=this;return new Promise(function(_0x2d8f11,_0x36f9ac){return db['FreshsalesAccount'][_0xdaeb('0x16')]({'raw':_0x1b5243['options']?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![],'where':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243['options']['where']||null:null,'attributes':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x19')]||null:null,'limit':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243[_0xdaeb('0x17')]['limit']||null:null,'include':_0x1b5243['options']?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x1a')]?_[_0xdaeb('0x1b')](_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x1a')],function(_0x55c825){return{'model':db[_0x55c825[_0xdaeb('0x1c')]],'as':_0x55c825['as'],'attributes':_0x55c825['attributes'],'include':_0x55c825[_0xdaeb('0x1a')]?_[_0xdaeb('0x1b')](_0x55c825[_0xdaeb('0x1a')],function(_0x3b0770){return{'model':db[_0x3b0770[_0xdaeb('0x1c')]],'as':_0x3b0770['as'],'attributes':_0x3b0770['attributes'],'include':_0x3b0770[_0xdaeb('0x1a')]?_[_0xdaeb('0x1b')](_0x3b0770[_0xdaeb('0x1a')],function(_0x4eb719){return{'model':db[_0x4eb719['model']],'as':_0x4eb719['as'],'attributes':_0x4eb719[_0xdaeb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5045f8){logger[_0xdaeb('0xd')](_0xdaeb('0x15'),_0x1b5243);logger[_0xdaeb('0x1d')]('GetFreshsalesAccount',_0x1b5243,JSON['stringify'](_0x5045f8));_0x2d8f11(_0x5045f8);})[_0xdaeb('0x14')](function(_0x440022){logger[_0xdaeb('0x11')]('GetFreshsalesAccount',_0x440022[_0xdaeb('0x12')],_0x1b5243);_0x36f9ac(_0x1fe84e['error'](0x1f4,_0x440022['message']));});});};exports[_0xdaeb('0x1e')]=function(_0x21f6cf){var _0x2fb019=this;return new Promise(function(_0x28c15c,_0x3276c2){return db[_0xdaeb('0x1f')][_0xdaeb('0x20')]({'raw':_0x21f6cf['options']?_0x21f6cf[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![],'where':_0x21f6cf[_0xdaeb('0x17')]?_0x21f6cf[_0xdaeb('0x17')][_0xdaeb('0x21')]||null:null,'attributes':_0x21f6cf['options']?_0x21f6cf[_0xdaeb('0x17')][_0xdaeb('0x19')]||null:null,'include':_0x21f6cf['options']?_0x21f6cf[_0xdaeb('0x17')][_0xdaeb('0x1a')]?_[_0xdaeb('0x1b')](_0x21f6cf[_0xdaeb('0x17')][_0xdaeb('0x1a')],function(_0x1628b8){return{'model':db[_0x1628b8[_0xdaeb('0x1c')]],'as':_0x1628b8['as'],'attributes':_0x1628b8[_0xdaeb('0x19')],'include':_0x1628b8[_0xdaeb('0x1a')]?_[_0xdaeb('0x1b')](_0x1628b8['include'],function(_0x53b6c4){return{'model':db[_0x53b6c4[_0xdaeb('0x1c')]],'as':_0x53b6c4['as'],'attributes':_0x53b6c4['attributes'],'include':_0x53b6c4[_0xdaeb('0x1a')]?_[_0xdaeb('0x1b')](_0x53b6c4[_0xdaeb('0x1a')],function(_0x331624){return{'model':db[_0x331624[_0xdaeb('0x1c')]],'as':_0x331624['as'],'attributes':_0x331624[_0xdaeb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f4dcb){logger[_0xdaeb('0xd')](_0xdaeb('0x1e'),_0x21f6cf);logger['debug'](_0xdaeb('0x1e'),_0x21f6cf,JSON[_0xdaeb('0x10')](_0x1f4dcb));_0x28c15c(_0x1f4dcb);})[_0xdaeb('0x14')](function(_0x104c90){logger[_0xdaeb('0x11')](_0xdaeb('0x1e'),_0x104c90[_0xdaeb('0x12')],_0x21f6cf);_0x3276c2(_0x2fb019['error'](0x1f4,_0x104c90[_0xdaeb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 93b837d..94160b3 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 _0x7914=['../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x46ca42,_0x493798){var _0x36ffd8=function(_0x5eba6f){while(--_0x5eba6f){_0x46ca42['push'](_0x46ca42['shift']());}};_0x36ffd8(++_0x493798);}(_0x7914,0x107));var _0x4791=function(_0x1522b7,_0x490c09){_0x1522b7=_0x1522b7-0x0;var _0x41b57f=_0x7914[_0x1522b7];return _0x41b57f;};'use strict';var multer=require(_0x4791('0x0'));var util=require(_0x4791('0x1'));var path=require('path');var timeout=require(_0x4791('0x2'));var express=require(_0x4791('0x3'));var router=express[_0x4791('0x4')]();var fs_extra=require(_0x4791('0x5'));var auth=require(_0x4791('0x6'));var interaction=require(_0x4791('0x7'));var config=require(_0x4791('0x8'));var controller=require(_0x4791('0x9'));router[_0x4791('0xa')]('/',auth[_0x4791('0xb')](),controller['index']);router[_0x4791('0xa')]('/:id',auth[_0x4791('0xb')](),controller[_0x4791('0xc')]);router[_0x4791('0xa')](_0x4791('0xd'),auth[_0x4791('0xb')](),controller[_0x4791('0xe')]);router[_0x4791('0xa')](_0x4791('0xf'),auth['isAuthenticated'](),controller[_0x4791('0x10')]);router[_0x4791('0xa')](_0x4791('0x11'),auth[_0x4791('0xb')](),controller[_0x4791('0x12')]);router[_0x4791('0x13')]('/',auth['isAuthenticated'](),controller[_0x4791('0x14')]);router[_0x4791('0x15')]('/:id',auth[_0x4791('0xb')](),controller[_0x4791('0x16')]);router[_0x4791('0x17')](_0x4791('0x18'),auth[_0x4791('0xb')](),controller[_0x4791('0x19')]);module[_0x4791('0x1a')]=router; \ No newline at end of file +var _0x3a8d=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshsalesConfiguration.controller','get','index','/:id','show','/:id/subjects','isAuthenticated','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update'];(function(_0x2c40bf,_0x5ce37a){var _0x31ab19=function(_0x56303){while(--_0x56303){_0x2c40bf['push'](_0x2c40bf['shift']());}};_0x31ab19(++_0x5ce37a);}(_0x3a8d,0x150));var _0xd3a8=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0x3a8d[_0xd9f102];return _0x2652e4;};'use strict';var multer=require(_0xd3a8('0x0'));var util=require('util');var path=require(_0xd3a8('0x1'));var timeout=require(_0xd3a8('0x2'));var express=require(_0xd3a8('0x3'));var router=express['Router']();var fs_extra=require(_0xd3a8('0x4'));var auth=require(_0xd3a8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd3a8('0x6'));router[_0xd3a8('0x7')]('/',auth['isAuthenticated'](),controller[_0xd3a8('0x8')]);router['get'](_0xd3a8('0x9'),auth['isAuthenticated'](),controller[_0xd3a8('0xa')]);router[_0xd3a8('0x7')](_0xd3a8('0xb'),auth[_0xd3a8('0xc')](),controller['getSubjects']);router[_0xd3a8('0x7')](_0xd3a8('0xd'),auth[_0xd3a8('0xc')](),controller[_0xd3a8('0xe')]);router['get'](_0xd3a8('0xf'),auth['isAuthenticated'](),controller[_0xd3a8('0x10')]);router[_0xd3a8('0x11')]('/',auth[_0xd3a8('0xc')](),controller[_0xd3a8('0x12')]);router[_0xd3a8('0x13')](_0xd3a8('0x9'),auth['isAuthenticated'](),controller[_0xd3a8('0x14')]);router['delete'](_0xd3a8('0x9'),auth[_0xd3a8('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index f811af9..06c9e76 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 _0x8c57=['exports','sequelize'];(function(_0x2d643c,_0x5b9204){var _0x17d037=function(_0xf7194b){while(--_0xf7194b){_0x2d643c['push'](_0x2d643c['shift']());}};_0x17d037(++_0x5b9204);}(_0x8c57,0xe9));var _0x78c5=function(_0x29793d,_0x201df4){_0x29793d=_0x29793d-0x0;var _0x1e6ecb=_0x8c57[_0x29793d];return _0x1e6ecb;};'use strict';var Sequelize=require(_0x78c5('0x0'));module[_0x78c5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x51c3=['STRING'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x51c3,0x73));var _0x351c=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x51c3[_0x411add];return _0x238242;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x351c('0x0')]},'description':{'type':Sequelize[_0x351c('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 7538e92..4b3fc7f 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 _0x5f2f=['merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','getSubjects','findOne','keys','FreshsalesField','length','getDescriptions','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','index','FreshsalesConfiguration','rawAttributes','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where'];(function(_0x271c34,_0x266fa2){var _0x3d60d1=function(_0x3e6781){while(--_0x3e6781){_0x271c34['push'](_0x271c34['shift']());}};_0x3d60d1(++_0x266fa2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1d0e11,_0x3c0d89){_0x1d0e11=_0x1d0e11-0x0;var _0x511d6e=_0x5f2f[_0x1d0e11];return _0x511d6e;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xc'));var _=require(_0xf5f2('0xd'));var squel=require('squel');var crypto=require(_0xf5f2('0xe'));var jsforce=require(_0xf5f2('0xf'));var deskjs=require(_0xf5f2('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf5f2('0x11'));var Papa=require(_0xf5f2('0x12'));var Redis=require(_0xf5f2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf5f2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5f2('0x15'))(_0xf5f2('0x16'));var utils=require('../../config/utils');var config=require(_0xf5f2('0x17'));var licenseUtil=require(_0xf5f2('0x18'));var db=require(_0xf5f2('0x19'))['db'];var jayson=require(_0xf5f2('0x1a'));var client=jayson[_0xf5f2('0x1b')][_0xf5f2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5c01b8,_0x5850f4,_0xea612c,_0x269909){return new BPromise(function(_0x1c1a5c,_0x422b55){var _0x4d97fc=_0x269909||client;return _0x4d97fc[_0xf5f2('0x1d')](_0x5c01b8,_0xea612c)[_0xf5f2('0x1e')](function(_0x17d656){logger[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x5850f4,_0xf5f2('0x21'));logger[_0xf5f2('0x22')](_0xf5f2('0x23'),_0x5850f4,_0xf5f2('0x21'),JSON[_0xf5f2('0x24')](_0x17d656));if(_0x17d656[_0xf5f2('0x25')]){if(_0x17d656[_0xf5f2('0x25')][_0xf5f2('0x26')]===0x1f4){logger[_0xf5f2('0x25')](_0xf5f2('0x20'),_0x5850f4,_0x17d656[_0xf5f2('0x25')][_0xf5f2('0x27')]);return _0x422b55(_0x17d656['error'][_0xf5f2('0x27')]);}logger[_0xf5f2('0x25')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5850f4,_0x17d656['error'][_0xf5f2('0x27')]);return _0x1c1a5c(_0x17d656[_0xf5f2('0x25')]['message']);}else{logger[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x5850f4,_0xf5f2('0x21'));_0x1c1a5c(_0x17d656[_0xf5f2('0x28')][_0xf5f2('0x27')]);}})['catch'](function(_0x21cd91){logger[_0xf5f2('0x25')](_0xf5f2('0x20'),_0x5850f4,_0x21cd91);_0x422b55(_0x21cd91);});});}function respondWithStatusCode(_0x2833fe,_0x287ad5){_0x287ad5=_0x287ad5||0xcc;return function(_0x5bdf4a){if(_0x5bdf4a){return _0x2833fe['sendStatus'](_0x287ad5);}return _0x2833fe[_0xf5f2('0x29')](_0x287ad5)[_0xf5f2('0x2a')]();};}function respondWithResult(_0x13da6f,_0x1a5bb3){_0x1a5bb3=_0x1a5bb3||0xc8;return function(_0xf6c58d){if(_0xf6c58d){return _0x13da6f[_0xf5f2('0x29')](_0x1a5bb3)[_0xf5f2('0x2b')](_0xf6c58d);}};}function respondWithFilteredResult(_0x281ec8,_0x294414){return function(_0x4ab014){if(_0x4ab014){var _0xaa2602=_0x4ab014[_0xf5f2('0x2c')],_0x102449=_0x294414[_0xf5f2('0x2d')],_0x375ca8=_0x294414['offset']+_0x294414['limit'],_0x31bfcb;if(_0x375ca8>=_0xaa2602){_0x375ca8=_0xaa2602;_0x31bfcb=0xc8;}else{_0x31bfcb=0xce;}_0x281ec8[_0xf5f2('0x29')](_0x31bfcb);return _0x281ec8[_0xf5f2('0x2e')](_0xf5f2('0x2f'),_0x102449+'-'+_0x375ca8+'/'+_0xaa2602)['json'](_0x4ab014);}return null;};}function patchUpdates(_0x5a2c7e){return function(_0x29571b){try{jsonpatch[_0xf5f2('0x30')](_0x29571b,_0x5a2c7e,!![]);}catch(_0x17394a){return BPromise[_0xf5f2('0x31')](_0x17394a);}return _0x29571b[_0xf5f2('0x32')]();};}function saveUpdates(_0x54c0c8,_0x52e959){return function(_0x2f4778){if(_0x2f4778){return _0x2f4778['update'](_0x54c0c8)[_0xf5f2('0x1e')](function(_0x58a4df){return _0x58a4df;});}return null;};}function removeEntity(_0x45b643,_0x31087c){return function(_0x7b6817){if(_0x7b6817){return _0x7b6817[_0xf5f2('0x33')]()[_0xf5f2('0x1e')](function(){_0x45b643[_0xf5f2('0x29')](0xcc)[_0xf5f2('0x2a')]();});}};}function handleEntityNotFound(_0x2c0e05,_0x5ca917){return function(_0x4149e6){if(!_0x4149e6){_0x2c0e05[_0xf5f2('0x34')](0x194);}return _0x4149e6;};}function handleError(_0x4590ec,_0x43c77d){_0x43c77d=_0x43c77d||0x1f4;return function(_0x1408b9){logger[_0xf5f2('0x25')](_0x1408b9[_0xf5f2('0x35')]);if(_0x1408b9['name']){delete _0x1408b9[_0xf5f2('0x36')];}_0x4590ec[_0xf5f2('0x29')](_0x43c77d)['send'](_0x1408b9);};}exports[_0xf5f2('0x37')]=function(_0x4b8c42,_0x18ae07){var _0x3930fb={},_0x2a2c31={},_0x2e3cca={'count':0x0,'rows':[]};var _0x59a6dd=_['map'](db[_0xf5f2('0x38')][_0xf5f2('0x39')],function(_0x20eb74){return{'name':_0x20eb74['fieldName'],'type':_0x20eb74[_0xf5f2('0x3a')]['key']};});_0x2a2c31[_0xf5f2('0x3b')]=_['map'](_0x59a6dd,_0xf5f2('0x36'));_0x2a2c31[_0xf5f2('0x3c')]=_['keys'](_0x4b8c42[_0xf5f2('0x3c')]);_0x2a2c31[_0xf5f2('0x3d')]=_[_0xf5f2('0x3e')](_0x2a2c31[_0xf5f2('0x3b')],_0x2a2c31['query']);_0x3930fb['attributes']=_[_0xf5f2('0x3e')](_0x2a2c31[_0xf5f2('0x3b')],qs[_0xf5f2('0x3f')](_0x4b8c42[_0xf5f2('0x3c')][_0xf5f2('0x3f')]));_0x3930fb[_0xf5f2('0x40')]=_0x3930fb[_0xf5f2('0x40')]['length']?_0x3930fb[_0xf5f2('0x40')]:_0x2a2c31[_0xf5f2('0x3b')];if(!_0x4b8c42['query'][_0xf5f2('0x41')](_0xf5f2('0x42'))){_0x3930fb[_0xf5f2('0x43')]=qs[_0xf5f2('0x43')](_0x4b8c42[_0xf5f2('0x3c')][_0xf5f2('0x43')]);_0x3930fb[_0xf5f2('0x2d')]=qs[_0xf5f2('0x2d')](_0x4b8c42['query'][_0xf5f2('0x2d')]);}_0x3930fb[_0xf5f2('0x44')]=qs[_0xf5f2('0x45')](_0x4b8c42['query']['sort']);_0x3930fb['where']=qs[_0xf5f2('0x3d')](_[_0xf5f2('0x46')](_0x4b8c42['query'],_0x2a2c31[_0xf5f2('0x3d')]),_0x59a6dd);if(_0x4b8c42[_0xf5f2('0x3c')][_0xf5f2('0x47')]){_0x3930fb[_0xf5f2('0x48')]=_[_0xf5f2('0x49')](_0x3930fb[_0xf5f2('0x48')],{'$or':_[_0xf5f2('0x4a')](_0x59a6dd,function(_0x212e90){if(_0x212e90[_0xf5f2('0x3a')]!==_0xf5f2('0x4b')){var _0x444317={};_0x444317[_0x212e90[_0xf5f2('0x36')]]={'$like':'%'+_0x4b8c42[_0xf5f2('0x3c')][_0xf5f2('0x47')]+'%'};return _0x444317;}})});}_0x3930fb=_['merge']({},_0x3930fb,_0x4b8c42[_0xf5f2('0x4c')]);var _0x578c93={'where':_0x3930fb[_0xf5f2('0x48')]};return db[_0xf5f2('0x38')][_0xf5f2('0x2c')](_0x578c93)[_0xf5f2('0x1e')](function(_0x31bf0e){_0x2e3cca[_0xf5f2('0x2c')]=_0x31bf0e;if(_0x4b8c42['query'][_0xf5f2('0x4d')]){_0x3930fb[_0xf5f2('0x4e')]=[{'all':!![]}];}return db[_0xf5f2('0x38')][_0xf5f2('0x4f')](_0x3930fb);})[_0xf5f2('0x1e')](function(_0x10753a){_0x2e3cca[_0xf5f2('0x50')]=_0x10753a;return _0x2e3cca;})[_0xf5f2('0x1e')](respondWithFilteredResult(_0x18ae07,_0x3930fb))['catch'](handleError(_0x18ae07,null));};exports[_0xf5f2('0x51')]=function(_0x33ec29,_0x45db9a){var _0x492eea={'raw':![],'where':{'id':_0x33ec29[_0xf5f2('0x52')]['id']}},_0x1177ba={};_0x1177ba[_0xf5f2('0x3b')]=_['keys'](db['FreshsalesConfiguration'][_0xf5f2('0x39')]);_0x1177ba[_0xf5f2('0x3c')]=_['keys'](_0x33ec29[_0xf5f2('0x3c')]);_0x1177ba['filters']=_[_0xf5f2('0x3e')](_0x1177ba['model'],_0x1177ba[_0xf5f2('0x3c')]);_0x492eea['attributes']=_[_0xf5f2('0x3e')](_0x1177ba[_0xf5f2('0x3b')],qs[_0xf5f2('0x3f')](_0x33ec29[_0xf5f2('0x3c')]['fields']));_0x492eea[_0xf5f2('0x40')]=_0x492eea[_0xf5f2('0x40')]['length']?_0x492eea['attributes']:_0x1177ba[_0xf5f2('0x3b')];if(_0x33ec29[_0xf5f2('0x3c')]['includeAll']){_0x492eea[_0xf5f2('0x4e')]=[{'all':!![]}];}_0x492eea=_[_0xf5f2('0x49')]({},_0x492eea,_0x33ec29[_0xf5f2('0x4c')]);return db[_0xf5f2('0x38')]['find'](_0x492eea)['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x1e')](respondWithResult(_0x45db9a,null))[_0xf5f2('0x53')](handleError(_0x45db9a,null));};exports['create']=function(_0x40eef,_0x43fc49){return db[_0xf5f2('0x38')][_0xf5f2('0x54')](_0x40eef[_0xf5f2('0x55')],{})[_0xf5f2('0x1e')](respondWithResult(_0x43fc49,0xc9))[_0xf5f2('0x53')](handleError(_0x43fc49,null));};exports['update']=function(_0x59e8ef,_0x330730){if(_0x59e8ef[_0xf5f2('0x55')]['id']){delete _0x59e8ef[_0xf5f2('0x55')]['id'];}return db[_0xf5f2('0x38')][_0xf5f2('0x56')]({'where':{'id':_0x59e8ef['params']['id']}})[_0xf5f2('0x1e')](handleEntityNotFound(_0x330730,null))[_0xf5f2('0x1e')](saveUpdates(_0x59e8ef[_0xf5f2('0x55')],null))['then'](respondWithResult(_0x330730,null))[_0xf5f2('0x53')](handleError(_0x330730,null));};exports['destroy']=function(_0x78f1d2,_0x1a8d33){return db[_0xf5f2('0x38')][_0xf5f2('0x56')]({'where':{'id':_0x78f1d2['params']['id']}})['then'](handleEntityNotFound(_0x1a8d33,null))[_0xf5f2('0x1e')](removeEntity(_0x1a8d33,null))['catch'](handleError(_0x1a8d33,null));};exports[_0xf5f2('0x57')]=function(_0x1f1916,_0x572ec1,_0x3f0579){var _0xa4c0be={};var _0x2a8f6d={};var _0x51ef09;var _0x397b99;return db[_0xf5f2('0x38')][_0xf5f2('0x58')]({'where':{'id':_0x1f1916[_0xf5f2('0x52')]['id']}})['then'](handleEntityNotFound(_0x572ec1,null))[_0xf5f2('0x1e')](function(_0x506fe5){if(_0x506fe5){_0x51ef09=_0x506fe5;_0x2a8f6d[_0xf5f2('0x3b')]=_[_0xf5f2('0x59')](db[_0xf5f2('0x5a')][_0xf5f2('0x39')]);_0x2a8f6d[_0xf5f2('0x3c')]=_['keys'](_0x1f1916[_0xf5f2('0x3c')]);_0x2a8f6d[_0xf5f2('0x3d')]=_[_0xf5f2('0x3e')](_0x2a8f6d[_0xf5f2('0x3b')],_0x2a8f6d[_0xf5f2('0x3c')]);_0xa4c0be['attributes']=_[_0xf5f2('0x3e')](_0x2a8f6d['model'],qs['fields'](_0x1f1916[_0xf5f2('0x3c')]['fields']));_0xa4c0be[_0xf5f2('0x40')]=_0xa4c0be[_0xf5f2('0x40')][_0xf5f2('0x5b')]?_0xa4c0be[_0xf5f2('0x40')]:_0x2a8f6d['model'];_0xa4c0be[_0xf5f2('0x44')]=qs[_0xf5f2('0x45')](_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x45')]);_0xa4c0be[_0xf5f2('0x48')]=qs[_0xf5f2('0x3d')](_[_0xf5f2('0x46')](_0x1f1916['query'],_0x2a8f6d[_0xf5f2('0x3d')]));if(_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x47')]){_0xa4c0be[_0xf5f2('0x48')]=_['merge'](_0xa4c0be[_0xf5f2('0x48')],{'$or':_['map'](_0xa4c0be[_0xf5f2('0x40')],function(_0x1c7f06){var _0x5588cf={};_0x5588cf[_0x1c7f06]={'$like':'%'+_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x47')]+'%'};return _0x5588cf;})});}_0xa4c0be=_[_0xf5f2('0x49')]({},_0xa4c0be,_0x1f1916[_0xf5f2('0x4c')]);return _0x51ef09[_0xf5f2('0x57')](_0xa4c0be);}})['then'](function(_0x3e821c){if(_0x3e821c){_0x397b99=_0x3e821c[_0xf5f2('0x5b')];if(!_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x41')](_0xf5f2('0x42'))){_0xa4c0be[_0xf5f2('0x43')]=qs['limit'](_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x43')]);_0xa4c0be['offset']=qs[_0xf5f2('0x2d')](_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x2d')]);}return _0x51ef09['getSubjects'](_0xa4c0be);}})['then'](function(_0x4f3df6){if(_0x4f3df6){return _0x4f3df6?{'count':_0x397b99,'rows':_0x4f3df6}:null;}})[_0xf5f2('0x1e')](respondWithResult(_0x572ec1,null))[_0xf5f2('0x53')](handleError(_0x572ec1,null));};exports[_0xf5f2('0x5c')]=function(_0x450691,_0x55da4d,_0x4d878e){var _0x278b76={};var _0x3a98b4={};var _0xc10cf3;var _0xe8a9b7;return db[_0xf5f2('0x38')][_0xf5f2('0x58')]({'where':{'id':_0x450691[_0xf5f2('0x52')]['id']}})[_0xf5f2('0x1e')](handleEntityNotFound(_0x55da4d,null))[_0xf5f2('0x1e')](function(_0x1f35ef){if(_0x1f35ef){_0xc10cf3=_0x1f35ef;_0x3a98b4[_0xf5f2('0x3b')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x3a98b4[_0xf5f2('0x3c')]=_[_0xf5f2('0x59')](_0x450691[_0xf5f2('0x3c')]);_0x3a98b4[_0xf5f2('0x3d')]=_[_0xf5f2('0x3e')](_0x3a98b4['model'],_0x3a98b4[_0xf5f2('0x3c')]);_0x278b76[_0xf5f2('0x40')]=_[_0xf5f2('0x3e')](_0x3a98b4[_0xf5f2('0x3b')],qs[_0xf5f2('0x3f')](_0x450691['query'][_0xf5f2('0x3f')]));_0x278b76[_0xf5f2('0x40')]=_0x278b76['attributes'][_0xf5f2('0x5b')]?_0x278b76[_0xf5f2('0x40')]:_0x3a98b4[_0xf5f2('0x3b')];_0x278b76[_0xf5f2('0x44')]=qs['sort'](_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x45')]);_0x278b76[_0xf5f2('0x48')]=qs[_0xf5f2('0x3d')](_[_0xf5f2('0x46')](_0x450691['query'],_0x3a98b4['filters']));if(_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x47')]){_0x278b76[_0xf5f2('0x48')]=_[_0xf5f2('0x49')](_0x278b76['where'],{'$or':_['map'](_0x278b76[_0xf5f2('0x40')],function(_0x4f2fcc){var _0x4c4420={};_0x4c4420[_0x4f2fcc]={'$like':'%'+_0x450691['query']['filter']+'%'};return _0x4c4420;})});}_0x278b76=_[_0xf5f2('0x49')]({},_0x278b76,_0x450691[_0xf5f2('0x4c')]);return _0xc10cf3[_0xf5f2('0x5c')](_0x278b76);}})[_0xf5f2('0x1e')](function(_0x3de508){if(_0x3de508){_0xe8a9b7=_0x3de508[_0xf5f2('0x5b')];if(!_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x41')](_0xf5f2('0x42'))){_0x278b76[_0xf5f2('0x43')]=qs[_0xf5f2('0x43')](_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x43')]);_0x278b76[_0xf5f2('0x2d')]=qs[_0xf5f2('0x2d')](_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x2d')]);}return _0xc10cf3[_0xf5f2('0x5c')](_0x278b76);}})['then'](function(_0xe7ac8){if(_0xe7ac8){return _0xe7ac8?{'count':_0xe8a9b7,'rows':_0xe7ac8}:null;}})[_0xf5f2('0x1e')](respondWithResult(_0x55da4d,null))[_0xf5f2('0x53')](handleError(_0x55da4d,null));};exports[_0xf5f2('0x5d')]=function(_0x18c353,_0x308220,_0x16491c){var _0xcf48eb={};var _0x5bf8fe={};var _0x38675d;var _0x57b50f;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x18c353['params']['id']}})['then'](handleEntityNotFound(_0x308220,null))['then'](function(_0x161890){if(_0x161890){_0x38675d=_0x161890;_0x5bf8fe[_0xf5f2('0x3b')]=_[_0xf5f2('0x59')](db[_0xf5f2('0x5a')][_0xf5f2('0x39')]);_0x5bf8fe[_0xf5f2('0x3c')]=_['keys'](_0x18c353['query']);_0x5bf8fe[_0xf5f2('0x3d')]=_['intersection'](_0x5bf8fe[_0xf5f2('0x3b')],_0x5bf8fe[_0xf5f2('0x3c')]);_0xcf48eb['attributes']=_['intersection'](_0x5bf8fe[_0xf5f2('0x3b')],qs[_0xf5f2('0x3f')](_0x18c353['query'][_0xf5f2('0x3f')]));_0xcf48eb[_0xf5f2('0x40')]=_0xcf48eb['attributes'][_0xf5f2('0x5b')]?_0xcf48eb[_0xf5f2('0x40')]:_0x5bf8fe[_0xf5f2('0x3b')];_0xcf48eb['order']=qs[_0xf5f2('0x45')](_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x45')]);_0xcf48eb[_0xf5f2('0x48')]=qs[_0xf5f2('0x3d')](_[_0xf5f2('0x46')](_0x18c353[_0xf5f2('0x3c')],_0x5bf8fe[_0xf5f2('0x3d')]));if(_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x47')]){_0xcf48eb[_0xf5f2('0x48')]=_[_0xf5f2('0x49')](_0xcf48eb[_0xf5f2('0x48')],{'$or':_[_0xf5f2('0x4a')](_0xcf48eb[_0xf5f2('0x40')],function(_0x28b9cd){var _0x1902c6={};_0x1902c6[_0x28b9cd]={'$like':'%'+_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x47')]+'%'};return _0x1902c6;})});}_0xcf48eb=_[_0xf5f2('0x49')]({},_0xcf48eb,_0x18c353[_0xf5f2('0x4c')]);return _0x38675d['getFields'](_0xcf48eb);}})[_0xf5f2('0x1e')](function(_0x33c864){if(_0x33c864){_0x57b50f=_0x33c864['length'];if(!_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x41')]('nolimit')){_0xcf48eb[_0xf5f2('0x43')]=qs[_0xf5f2('0x43')](_0x18c353[_0xf5f2('0x3c')]['limit']);_0xcf48eb['offset']=qs[_0xf5f2('0x2d')](_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x2d')]);}return _0x38675d['getFields'](_0xcf48eb);}})['then'](function(_0x2572c0){if(_0x2572c0){return _0x2572c0?{'count':_0x57b50f,'rows':_0x2572c0}:null;}})[_0xf5f2('0x1e')](respondWithResult(_0x308220,null))[_0xf5f2('0x53')](handleError(_0x308220,null));}; \ No newline at end of file +var _0xadb5=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','key','map','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','length','include','create','body','find','destroy','getSubjects','findOne','intersection','order','pick','getDescriptions','FreshsalesField','getFields','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x20c235,_0xa9f78c){var _0x3ae19d=function(_0xb9d413){while(--_0xb9d413){_0x20c235['push'](_0x20c235['shift']());}};_0x3ae19d(++_0xa9f78c);}(_0xadb5,0xad));var _0x5adb=function(_0x2b55ae,_0x530a03){_0x2b55ae=_0x2b55ae-0x0;var _0x3e9d98=_0xadb5[_0x2b55ae];return _0x3e9d98;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var fs_extra=require(_0x5adb('0xa'));var _=require(_0x5adb('0xb'));var squel=require(_0x5adb('0xc'));var crypto=require(_0x5adb('0xd'));var jsforce=require(_0x5adb('0xe'));var deskjs=require(_0x5adb('0xf'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0x10'));var Papa=require(_0x5adb('0x11'));var Redis=require(_0x5adb('0x12'));var authService=require(_0x5adb('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5adb('0x14'));var logger=require(_0x5adb('0x15'))(_0x5adb('0x16'));var utils=require('../../config/utils');var config=require(_0x5adb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5adb('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5adb('0x19')][_0x5adb('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x44abe3,_0x5c929a,_0x2a545b,_0x34af2c){return new BPromise(function(_0xf82f72,_0x5263ec){var _0x2312de=_0x34af2c||client;return _0x2312de['request'](_0x44abe3,_0x2a545b)[_0x5adb('0x1b')](function(_0x42a482){logger[_0x5adb('0x1c')](_0x5adb('0x1d'),_0x5c929a,_0x5adb('0x1e'));logger[_0x5adb('0x1f')](_0x5adb('0x20'),_0x5c929a,_0x5adb('0x1e'),JSON[_0x5adb('0x21')](_0x42a482));if(_0x42a482['error']){if(_0x42a482[_0x5adb('0x22')]['code']===0x1f4){logger[_0x5adb('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5c929a,_0x42a482[_0x5adb('0x22')]['message']);return _0x5263ec(_0x42a482['error'][_0x5adb('0x23')]);}logger[_0x5adb('0x22')](_0x5adb('0x1d'),_0x5c929a,_0x42a482[_0x5adb('0x22')][_0x5adb('0x23')]);return _0xf82f72(_0x42a482['error'][_0x5adb('0x23')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5c929a,_0x5adb('0x1e'));_0xf82f72(_0x42a482[_0x5adb('0x24')][_0x5adb('0x23')]);}})[_0x5adb('0x25')](function(_0x1e9ccf){logger[_0x5adb('0x22')](_0x5adb('0x1d'),_0x5c929a,_0x1e9ccf);_0x5263ec(_0x1e9ccf);});});}function respondWithStatusCode(_0x4ca150,_0x4b1957){_0x4b1957=_0x4b1957||0xcc;return function(_0x373cc3){if(_0x373cc3){return _0x4ca150[_0x5adb('0x26')](_0x4b1957);}return _0x4ca150[_0x5adb('0x27')](_0x4b1957)[_0x5adb('0x28')]();};}function respondWithResult(_0x49f203,_0x2fee18){_0x2fee18=_0x2fee18||0xc8;return function(_0x2e1e63){if(_0x2e1e63){return _0x49f203['status'](_0x2fee18)[_0x5adb('0x29')](_0x2e1e63);}};}function respondWithFilteredResult(_0x1ded9f,_0x1a0acd){return function(_0x55b40a){if(_0x55b40a){var _0x13ad1d=_0x55b40a[_0x5adb('0x2a')],_0xbe21b1=_0x1a0acd[_0x5adb('0x2b')],_0x3a4fca=_0x1a0acd['offset']+_0x1a0acd['limit'],_0x2c64a3;if(_0x3a4fca>=_0x13ad1d){_0x3a4fca=_0x13ad1d;_0x2c64a3=0xc8;}else{_0x2c64a3=0xce;}_0x1ded9f['status'](_0x2c64a3);return _0x1ded9f[_0x5adb('0x2c')](_0x5adb('0x2d'),_0xbe21b1+'-'+_0x3a4fca+'/'+_0x13ad1d)[_0x5adb('0x29')](_0x55b40a);}return null;};}function patchUpdates(_0x512bab){return function(_0x137a5c){try{jsonpatch['apply'](_0x137a5c,_0x512bab,!![]);}catch(_0x11ec2a){return BPromise[_0x5adb('0x2e')](_0x11ec2a);}return _0x137a5c[_0x5adb('0x2f')]();};}function saveUpdates(_0x3b1fed,_0x450169){return function(_0x3145f2){if(_0x3145f2){return _0x3145f2[_0x5adb('0x30')](_0x3b1fed)[_0x5adb('0x1b')](function(_0x138bf6){return _0x138bf6;});}return null;};}function removeEntity(_0x260295,_0x4790f1){return function(_0x2e46ce){if(_0x2e46ce){return _0x2e46ce['destroy']()[_0x5adb('0x1b')](function(){_0x260295[_0x5adb('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x226390,_0xe389ca){return function(_0x461a39){if(!_0x461a39){_0x226390['sendStatus'](0x194);}return _0x461a39;};}function handleError(_0x173789,_0x14cf00){_0x14cf00=_0x14cf00||0x1f4;return function(_0x4b5887){logger['error'](_0x4b5887[_0x5adb('0x31')]);if(_0x4b5887['name']){delete _0x4b5887[_0x5adb('0x32')];}_0x173789[_0x5adb('0x27')](_0x14cf00)[_0x5adb('0x33')](_0x4b5887);};}exports[_0x5adb('0x34')]=function(_0x9bdece,_0x5ece39){var _0x2f7abe={},_0x215b88={},_0x1c3a5c={'count':0x0,'rows':[]};var _0x54851b=_['map'](db[_0x5adb('0x35')][_0x5adb('0x36')],function(_0x586820){return{'name':_0x586820[_0x5adb('0x37')],'type':_0x586820['type'][_0x5adb('0x38')]};});_0x215b88['model']=_[_0x5adb('0x39')](_0x54851b,'name');_0x215b88[_0x5adb('0x3a')]=_[_0x5adb('0x3b')](_0x9bdece['query']);_0x215b88[_0x5adb('0x3c')]=_['intersection'](_0x215b88[_0x5adb('0x3d')],_0x215b88[_0x5adb('0x3a')]);_0x2f7abe[_0x5adb('0x3e')]=_['intersection'](_0x215b88[_0x5adb('0x3d')],qs[_0x5adb('0x3f')](_0x9bdece[_0x5adb('0x3a')][_0x5adb('0x3f')]));_0x2f7abe[_0x5adb('0x3e')]=_0x2f7abe['attributes']['length']?_0x2f7abe['attributes']:_0x215b88['model'];if(!_0x9bdece[_0x5adb('0x3a')][_0x5adb('0x40')](_0x5adb('0x41'))){_0x2f7abe[_0x5adb('0x42')]=qs[_0x5adb('0x42')](_0x9bdece[_0x5adb('0x3a')][_0x5adb('0x42')]);_0x2f7abe[_0x5adb('0x2b')]=qs['offset'](_0x9bdece['query'][_0x5adb('0x2b')]);}_0x2f7abe['order']=qs[_0x5adb('0x43')](_0x9bdece[_0x5adb('0x3a')][_0x5adb('0x43')]);_0x2f7abe[_0x5adb('0x44')]=qs[_0x5adb('0x3c')](_['pick'](_0x9bdece[_0x5adb('0x3a')],_0x215b88[_0x5adb('0x3c')]),_0x54851b);if(_0x9bdece['query'][_0x5adb('0x45')]){_0x2f7abe[_0x5adb('0x44')]=_['merge'](_0x2f7abe[_0x5adb('0x44')],{'$or':_[_0x5adb('0x39')](_0x54851b,function(_0x1d6bef){if(_0x1d6bef[_0x5adb('0x46')]!==_0x5adb('0x47')){var _0x4362ec={};_0x4362ec[_0x1d6bef[_0x5adb('0x32')]]={'$like':'%'+_0x9bdece['query']['filter']+'%'};return _0x4362ec;}})});}_0x2f7abe=_[_0x5adb('0x48')]({},_0x2f7abe,_0x9bdece[_0x5adb('0x49')]);var _0x1cd0a3={'where':_0x2f7abe[_0x5adb('0x44')]};return db['FreshsalesConfiguration']['count'](_0x1cd0a3)[_0x5adb('0x1b')](function(_0x4d7d86){_0x1c3a5c[_0x5adb('0x2a')]=_0x4d7d86;if(_0x9bdece[_0x5adb('0x3a')][_0x5adb('0x4a')]){_0x2f7abe['include']=[{'all':!![]}];}return db[_0x5adb('0x35')][_0x5adb('0x4b')](_0x2f7abe);})['then'](function(_0x7786c4){_0x1c3a5c[_0x5adb('0x4c')]=_0x7786c4;return _0x1c3a5c;})[_0x5adb('0x1b')](respondWithFilteredResult(_0x5ece39,_0x2f7abe))[_0x5adb('0x25')](handleError(_0x5ece39,null));};exports[_0x5adb('0x4d')]=function(_0x3a5409,_0x39840e){var _0x54252={'raw':![],'where':{'id':_0x3a5409[_0x5adb('0x4e')]['id']}},_0x49e1a1={};_0x49e1a1['model']=_['keys'](db['FreshsalesConfiguration'][_0x5adb('0x36')]);_0x49e1a1[_0x5adb('0x3a')]=_[_0x5adb('0x3b')](_0x3a5409['query']);_0x49e1a1[_0x5adb('0x3c')]=_['intersection'](_0x49e1a1[_0x5adb('0x3d')],_0x49e1a1[_0x5adb('0x3a')]);_0x54252[_0x5adb('0x3e')]=_['intersection'](_0x49e1a1[_0x5adb('0x3d')],qs['fields'](_0x3a5409[_0x5adb('0x3a')][_0x5adb('0x3f')]));_0x54252['attributes']=_0x54252[_0x5adb('0x3e')][_0x5adb('0x4f')]?_0x54252[_0x5adb('0x3e')]:_0x49e1a1[_0x5adb('0x3d')];if(_0x3a5409[_0x5adb('0x3a')]['includeAll']){_0x54252[_0x5adb('0x50')]=[{'all':!![]}];}_0x54252=_[_0x5adb('0x48')]({},_0x54252,_0x3a5409[_0x5adb('0x49')]);return db[_0x5adb('0x35')]['find'](_0x54252)[_0x5adb('0x1b')](handleEntityNotFound(_0x39840e,null))[_0x5adb('0x1b')](respondWithResult(_0x39840e,null))[_0x5adb('0x25')](handleError(_0x39840e,null));};exports['create']=function(_0x2b34a8,_0xd0e5b7){return db[_0x5adb('0x35')][_0x5adb('0x51')](_0x2b34a8['body'],{})[_0x5adb('0x1b')](respondWithResult(_0xd0e5b7,0xc9))[_0x5adb('0x25')](handleError(_0xd0e5b7,null));};exports[_0x5adb('0x30')]=function(_0x2cee37,_0xa25ac3){if(_0x2cee37['body']['id']){delete _0x2cee37[_0x5adb('0x52')]['id'];}return db['FreshsalesConfiguration'][_0x5adb('0x53')]({'where':{'id':_0x2cee37['params']['id']}})[_0x5adb('0x1b')](handleEntityNotFound(_0xa25ac3,null))[_0x5adb('0x1b')](saveUpdates(_0x2cee37[_0x5adb('0x52')],null))[_0x5adb('0x1b')](respondWithResult(_0xa25ac3,null))['catch'](handleError(_0xa25ac3,null));};exports[_0x5adb('0x54')]=function(_0x229ae2,_0x24b1f1){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x229ae2['params']['id']}})[_0x5adb('0x1b')](handleEntityNotFound(_0x24b1f1,null))[_0x5adb('0x1b')](removeEntity(_0x24b1f1,null))[_0x5adb('0x25')](handleError(_0x24b1f1,null));};exports[_0x5adb('0x55')]=function(_0xa833f4,_0xb06bee,_0x204b9b){var _0x8d7810={};var _0xc880af={};var _0x380d76;var _0x452767;return db[_0x5adb('0x35')][_0x5adb('0x56')]({'where':{'id':_0xa833f4['params']['id']}})['then'](handleEntityNotFound(_0xb06bee,null))[_0x5adb('0x1b')](function(_0x27a8e4){if(_0x27a8e4){_0x380d76=_0x27a8e4;_0xc880af[_0x5adb('0x3d')]=_[_0x5adb('0x3b')](db['FreshsalesField'][_0x5adb('0x36')]);_0xc880af[_0x5adb('0x3a')]=_['keys'](_0xa833f4[_0x5adb('0x3a')]);_0xc880af[_0x5adb('0x3c')]=_[_0x5adb('0x57')](_0xc880af['model'],_0xc880af[_0x5adb('0x3a')]);_0x8d7810[_0x5adb('0x3e')]=_[_0x5adb('0x57')](_0xc880af[_0x5adb('0x3d')],qs[_0x5adb('0x3f')](_0xa833f4[_0x5adb('0x3a')]['fields']));_0x8d7810[_0x5adb('0x3e')]=_0x8d7810[_0x5adb('0x3e')][_0x5adb('0x4f')]?_0x8d7810['attributes']:_0xc880af[_0x5adb('0x3d')];_0x8d7810[_0x5adb('0x58')]=qs[_0x5adb('0x43')](_0xa833f4['query'][_0x5adb('0x43')]);_0x8d7810['where']=qs[_0x5adb('0x3c')](_[_0x5adb('0x59')](_0xa833f4[_0x5adb('0x3a')],_0xc880af['filters']));if(_0xa833f4[_0x5adb('0x3a')][_0x5adb('0x45')]){_0x8d7810['where']=_[_0x5adb('0x48')](_0x8d7810[_0x5adb('0x44')],{'$or':_[_0x5adb('0x39')](_0x8d7810[_0x5adb('0x3e')],function(_0x55cd0a){var _0x4290bb={};_0x4290bb[_0x55cd0a]={'$like':'%'+_0xa833f4[_0x5adb('0x3a')][_0x5adb('0x45')]+'%'};return _0x4290bb;})});}_0x8d7810=_[_0x5adb('0x48')]({},_0x8d7810,_0xa833f4['options']);return _0x380d76['getSubjects'](_0x8d7810);}})[_0x5adb('0x1b')](function(_0x531e20){if(_0x531e20){_0x452767=_0x531e20['length'];if(!_0xa833f4['query'][_0x5adb('0x40')](_0x5adb('0x41'))){_0x8d7810['limit']=qs[_0x5adb('0x42')](_0xa833f4[_0x5adb('0x3a')][_0x5adb('0x42')]);_0x8d7810[_0x5adb('0x2b')]=qs[_0x5adb('0x2b')](_0xa833f4[_0x5adb('0x3a')][_0x5adb('0x2b')]);}return _0x380d76[_0x5adb('0x55')](_0x8d7810);}})['then'](function(_0x4b9e80){if(_0x4b9e80){return _0x4b9e80?{'count':_0x452767,'rows':_0x4b9e80}:null;}})['then'](respondWithResult(_0xb06bee,null))[_0x5adb('0x25')](handleError(_0xb06bee,null));};exports[_0x5adb('0x5a')]=function(_0x3a0d1b,_0x2a55a3,_0x1f59bb){var _0x2f6ef7={};var _0x386c76={};var _0x25f761;var _0x58455b;return db['FreshsalesConfiguration'][_0x5adb('0x56')]({'where':{'id':_0x3a0d1b[_0x5adb('0x4e')]['id']}})[_0x5adb('0x1b')](handleEntityNotFound(_0x2a55a3,null))[_0x5adb('0x1b')](function(_0x2146f0){if(_0x2146f0){_0x25f761=_0x2146f0;_0x386c76[_0x5adb('0x3d')]=_[_0x5adb('0x3b')](db[_0x5adb('0x5b')][_0x5adb('0x36')]);_0x386c76[_0x5adb('0x3a')]=_['keys'](_0x3a0d1b[_0x5adb('0x3a')]);_0x386c76[_0x5adb('0x3c')]=_[_0x5adb('0x57')](_0x386c76['model'],_0x386c76[_0x5adb('0x3a')]);_0x2f6ef7[_0x5adb('0x3e')]=_['intersection'](_0x386c76[_0x5adb('0x3d')],qs['fields'](_0x3a0d1b[_0x5adb('0x3a')][_0x5adb('0x3f')]));_0x2f6ef7['attributes']=_0x2f6ef7[_0x5adb('0x3e')][_0x5adb('0x4f')]?_0x2f6ef7[_0x5adb('0x3e')]:_0x386c76[_0x5adb('0x3d')];_0x2f6ef7[_0x5adb('0x58')]=qs[_0x5adb('0x43')](_0x3a0d1b[_0x5adb('0x3a')][_0x5adb('0x43')]);_0x2f6ef7['where']=qs[_0x5adb('0x3c')](_[_0x5adb('0x59')](_0x3a0d1b[_0x5adb('0x3a')],_0x386c76['filters']));if(_0x3a0d1b['query'][_0x5adb('0x45')]){_0x2f6ef7['where']=_[_0x5adb('0x48')](_0x2f6ef7[_0x5adb('0x44')],{'$or':_[_0x5adb('0x39')](_0x2f6ef7['attributes'],function(_0x3a9735){var _0x288e4f={};_0x288e4f[_0x3a9735]={'$like':'%'+_0x3a0d1b[_0x5adb('0x3a')][_0x5adb('0x45')]+'%'};return _0x288e4f;})});}_0x2f6ef7=_[_0x5adb('0x48')]({},_0x2f6ef7,_0x3a0d1b['options']);return _0x25f761[_0x5adb('0x5a')](_0x2f6ef7);}})[_0x5adb('0x1b')](function(_0xcdd477){if(_0xcdd477){_0x58455b=_0xcdd477[_0x5adb('0x4f')];if(!_0x3a0d1b['query'][_0x5adb('0x40')](_0x5adb('0x41'))){_0x2f6ef7[_0x5adb('0x42')]=qs[_0x5adb('0x42')](_0x3a0d1b[_0x5adb('0x3a')][_0x5adb('0x42')]);_0x2f6ef7[_0x5adb('0x2b')]=qs['offset'](_0x3a0d1b[_0x5adb('0x3a')][_0x5adb('0x2b')]);}return _0x25f761['getDescriptions'](_0x2f6ef7);}})[_0x5adb('0x1b')](function(_0x2f8468){if(_0x2f8468){return _0x2f8468?{'count':_0x58455b,'rows':_0x2f8468}:null;}})['then'](respondWithResult(_0x2a55a3,null))[_0x5adb('0x25')](handleError(_0x2a55a3,null));};exports['getFields']=function(_0x372354,_0x268df2,_0x4a2ebc){var _0x167432={};var _0x54c2c8={};var _0x2f6415;var _0x118968;return db[_0x5adb('0x35')][_0x5adb('0x56')]({'where':{'id':_0x372354[_0x5adb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x268df2,null))[_0x5adb('0x1b')](function(_0x337577){if(_0x337577){_0x2f6415=_0x337577;_0x54c2c8[_0x5adb('0x3d')]=_[_0x5adb('0x3b')](db['FreshsalesField']['rawAttributes']);_0x54c2c8[_0x5adb('0x3a')]=_[_0x5adb('0x3b')](_0x372354[_0x5adb('0x3a')]);_0x54c2c8[_0x5adb('0x3c')]=_[_0x5adb('0x57')](_0x54c2c8[_0x5adb('0x3d')],_0x54c2c8[_0x5adb('0x3a')]);_0x167432['attributes']=_[_0x5adb('0x57')](_0x54c2c8[_0x5adb('0x3d')],qs[_0x5adb('0x3f')](_0x372354[_0x5adb('0x3a')]['fields']));_0x167432[_0x5adb('0x3e')]=_0x167432[_0x5adb('0x3e')][_0x5adb('0x4f')]?_0x167432[_0x5adb('0x3e')]:_0x54c2c8[_0x5adb('0x3d')];_0x167432[_0x5adb('0x58')]=qs[_0x5adb('0x43')](_0x372354[_0x5adb('0x3a')][_0x5adb('0x43')]);_0x167432['where']=qs[_0x5adb('0x3c')](_[_0x5adb('0x59')](_0x372354['query'],_0x54c2c8[_0x5adb('0x3c')]));if(_0x372354[_0x5adb('0x3a')][_0x5adb('0x45')]){_0x167432[_0x5adb('0x44')]=_[_0x5adb('0x48')](_0x167432[_0x5adb('0x44')],{'$or':_[_0x5adb('0x39')](_0x167432[_0x5adb('0x3e')],function(_0x57f557){var _0x11d9ce={};_0x11d9ce[_0x57f557]={'$like':'%'+_0x372354[_0x5adb('0x3a')]['filter']+'%'};return _0x11d9ce;})});}_0x167432=_[_0x5adb('0x48')]({},_0x167432,_0x372354[_0x5adb('0x49')]);return _0x2f6415[_0x5adb('0x5c')](_0x167432);}})['then'](function(_0x4cba81){if(_0x4cba81){_0x118968=_0x4cba81[_0x5adb('0x4f')];if(!_0x372354[_0x5adb('0x3a')][_0x5adb('0x40')]('nolimit')){_0x167432[_0x5adb('0x42')]=qs[_0x5adb('0x42')](_0x372354[_0x5adb('0x3a')][_0x5adb('0x42')]);_0x167432[_0x5adb('0x2b')]=qs[_0x5adb('0x2b')](_0x372354[_0x5adb('0x3a')][_0x5adb('0x2b')]);}return _0x2f6415[_0x5adb('0x5c')](_0x167432);}})[_0x5adb('0x1b')](function(_0x423b80){if(_0x423b80){return _0x423b80?{'count':_0x118968,'rows':_0x423b80}:null;}})[_0x5adb('0x1b')](respondWithResult(_0x268df2,null))['catch'](handleError(_0x268df2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index f019e0f..dcd149e 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 _0x894f=['exports','define','FreshsalesConfiguration','lodash','util','../../config/logger','api','request-promise','path','./intFreshsalesConfiguration.attributes'];(function(_0x1743a9,_0xfd1e46){var _0x126e50=function(_0x11f0d4){while(--_0x11f0d4){_0x1743a9['push'](_0x1743a9['shift']());}};_0x126e50(++_0xfd1e46);}(_0x894f,0x14d));var _0xf894=function(_0x2851b7,_0x3bf406){_0x2851b7=_0x2851b7-0x0;var _0x4b69b4=_0x894f[_0x2851b7];return _0x4b69b4;};'use strict';var _=require(_0xf894('0x0'));var util=require(_0xf894('0x1'));var logger=require(_0xf894('0x2'))(_0xf894('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf894('0x4'));var fs=require('fs');var path=require(_0xf894('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf894('0x6'));module[_0xf894('0x7')]=function(_0x4e2af3,_0x5814d3){return _0x4e2af3[_0xf894('0x8')](_0xf894('0x9'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a0f=['./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5e2cf9,_0x16e589){var _0x2c1a38=function(_0x473c52){while(--_0x473c52){_0x5e2cf9['push'](_0x5e2cf9['shift']());}};_0x2c1a38(++_0x16e589);}(_0x3a0f,0x75));var _0xf3a0=function(_0x10fda8,_0x472893){_0x10fda8=_0x10fda8-0x0;var _0x1dc6dd=_0x3a0f[_0x10fda8];return _0x1dc6dd;};'use strict';var _=require(_0xf3a0('0x0'));var util=require(_0xf3a0('0x1'));var logger=require(_0xf3a0('0x2'))('api');var moment=require(_0xf3a0('0x3'));var BPromise=require(_0xf3a0('0x4'));var rp=require(_0xf3a0('0x5'));var fs=require('fs');var path=require(_0xf3a0('0x6'));var rimraf=require(_0xf3a0('0x7'));var config=require(_0xf3a0('0x8'));var attributes=require(_0xf3a0('0x9'));module[_0xf3a0('0xa')]=function(_0x3e9566,_0xadce3f){return _0x3e9566[_0xf3a0('0xb')](_0xf3a0('0xc'),attributes,{'tableName':_0xf3a0('0xd'),'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 6ddc901..74b745d 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 _0xab3a=['FreshsalesConfiguration,\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','client','request','then','info'];(function(_0x43703c,_0x5538d0){var _0x452021=function(_0x5adf15){while(--_0x5adf15){_0x43703c['push'](_0x43703c['shift']());}};_0x452021(++_0x5538d0);}(_0xab3a,0x1d3));var _0xaab3=function(_0x4147e6,_0x57174e){_0x4147e6=_0x4147e6-0x0;var _0x3305ba=_0xab3a[_0x4147e6];return _0x3305ba;};'use strict';var _=require(_0xaab3('0x0'));var util=require(_0xaab3('0x1'));var moment=require(_0xaab3('0x2'));var BPromise=require(_0xaab3('0x3'));var rs=require(_0xaab3('0x4'));var fs=require('fs');var Redis=require(_0xaab3('0x5'));var db=require(_0xaab3('0x6'))['db'];var utils=require(_0xaab3('0x7'));var logger=require(_0xaab3('0x8'))(_0xaab3('0x9'));var config=require(_0xaab3('0xa'));var jayson=require(_0xaab3('0xb'));var client=jayson[_0xaab3('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5760e8,_0x501657,_0x1fd19f){return new BPromise(function(_0x146453,_0x21527a){return client[_0xaab3('0xd')](_0x5760e8,_0x1fd19f)[_0xaab3('0xe')](function(_0x15841e){logger[_0xaab3('0xf')](_0xaab3('0x10'),_0x501657,_0xaab3('0x11'));logger[_0xaab3('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x501657,'request\x20sent',JSON[_0xaab3('0x13')](_0x15841e));if(_0x15841e[_0xaab3('0x14')]){if(_0x15841e[_0xaab3('0x14')][_0xaab3('0x15')]===0x1f4){logger['error'](_0xaab3('0x10'),_0x501657,_0x15841e['error'][_0xaab3('0x16')]);return _0x21527a(_0x15841e['error'][_0xaab3('0x16')]);}logger[_0xaab3('0x14')](_0xaab3('0x10'),_0x501657,_0x15841e['error'][_0xaab3('0x16')]);return _0x146453(_0x15841e[_0xaab3('0x14')]['message']);}else{logger[_0xaab3('0xf')](_0xaab3('0x10'),_0x501657,_0xaab3('0x11'));_0x146453(_0x15841e['result']['message']);}})['catch'](function(_0x484dc5){logger[_0xaab3('0x14')](_0xaab3('0x10'),_0x501657,_0x484dc5);_0x21527a(_0x484dc5);});});} \ No newline at end of file +var _0xb09d=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0xe84983,_0x4d83f5){var _0xb2533d=function(_0x37433a){while(--_0x37433a){_0xe84983['push'](_0xe84983['shift']());}};_0xb2533d(++_0x4d83f5);}(_0xb09d,0xed));var _0xdb09=function(_0x4d62e6,_0x441bb6){_0x4d62e6=_0x4d62e6-0x0;var _0x3272d6=_0xb09d[_0x4d62e6];return _0x3272d6;};'use strict';var _=require(_0xdb09('0x0'));var util=require(_0xdb09('0x1'));var moment=require(_0xdb09('0x2'));var BPromise=require(_0xdb09('0x3'));var rs=require(_0xdb09('0x4'));var fs=require('fs');var Redis=require(_0xdb09('0x5'));var db=require(_0xdb09('0x6'))['db'];var utils=require(_0xdb09('0x7'));var logger=require('../../config/logger')(_0xdb09('0x8'));var config=require(_0xdb09('0x9'));var jayson=require(_0xdb09('0xa'));var client=jayson[_0xdb09('0xb')][_0xdb09('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20a6ef,_0xa0e24,_0x332ab2){return new BPromise(function(_0x3bbf9b,_0x1e6e67){return client[_0xdb09('0xd')](_0x20a6ef,_0x332ab2)['then'](function(_0x4b6e2e){logger[_0xdb09('0xe')](_0xdb09('0xf'),_0xa0e24,_0xdb09('0x10'));logger[_0xdb09('0x11')](_0xdb09('0x12'),_0xa0e24,_0xdb09('0x10'),JSON['stringify'](_0x4b6e2e));if(_0x4b6e2e['error']){if(_0x4b6e2e[_0xdb09('0x13')]['code']===0x1f4){logger[_0xdb09('0x13')](_0xdb09('0xf'),_0xa0e24,_0x4b6e2e[_0xdb09('0x13')][_0xdb09('0x14')]);return _0x1e6e67(_0x4b6e2e[_0xdb09('0x13')][_0xdb09('0x14')]);}logger['error'](_0xdb09('0xf'),_0xa0e24,_0x4b6e2e[_0xdb09('0x13')][_0xdb09('0x14')]);return _0x3bbf9b(_0x4b6e2e[_0xdb09('0x13')][_0xdb09('0x14')]);}else{logger[_0xdb09('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xa0e24,_0xdb09('0x10'));_0x3bbf9b(_0x4b6e2e['result']['message']);}})['catch'](function(_0x29a116){logger[_0xdb09('0x13')](_0xdb09('0xf'),_0xa0e24,_0x29a116);_0x1e6e67(_0x29a116);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 654eb9c..78ba60a 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 _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xcd432,_0x4e7a7e){var _0x324ab4=function(_0x13554e){while(--_0x13554e){_0xcd432['push'](_0xcd432['shift']());}};_0x324ab4(++_0x4e7a7e);}(_0xac4a,0x13f));var _0xaac4=function(_0x23e1cf,_0x31bb4e){_0x23e1cf=_0x23e1cf-0x0;var _0x2db8ea=_0xac4a[_0x23e1cf];return _0x2db8ea;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file +var _0xe605=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x16c18d,_0x2efdc2){var _0x556eba=function(_0x13c968){while(--_0x13c968){_0x16c18d['push'](_0x16c18d['shift']());}};_0x556eba(++_0x2efdc2);}(_0xe605,0x92));var _0x5e60=function(_0x2e89ce,_0x146c26){_0x2e89ce=_0x2e89ce-0x0;var _0x15c9bf=_0xe605[_0x2e89ce];return _0x15c9bf;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/:id',auth[_0x5e60('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5e60('0xd')]);router[_0x5e60('0xe')](_0x5e60('0xf'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x10')]);router[_0x5e60('0x11')]('/:id',auth[_0x5e60('0xb')](),controller['destroy']);module[_0x5e60('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 114f0be..d20c6b8 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 _0x1b20=['STRING','variable','BOOLEAN','exports','ENUM','customVariable','keyValue','picklist','string'];(function(_0x47708d,_0x4313c8){var _0x5b2c78=function(_0xe94693){while(--_0xe94693){_0x47708d['push'](_0x47708d['shift']());}};_0x5b2c78(++_0x4313c8);}(_0x1b20,0x66));var _0x01b2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1b20[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x01b2('0x0')]={'type':{'type':Sequelize[_0x01b2('0x1')]('string','variable',_0x01b2('0x2'),_0x01b2('0x3'),_0x01b2('0x4')),'defaultValue':_0x01b2('0x5')},'content':{'type':Sequelize[_0x01b2('0x6')]},'key':{'type':Sequelize[_0x01b2('0x6')]},'keyType':{'type':Sequelize[_0x01b2('0x1')](_0x01b2('0x5'),_0x01b2('0x7'),_0x01b2('0x2'))},'keyContent':{'type':Sequelize[_0x01b2('0x6')]},'idField':{'type':Sequelize[_0x01b2('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x01b2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x84e7=['picklist','string','STRING','exports','ENUM','variable','customVariable'];(function(_0x397127,_0x31429d){var _0x1d5516=function(_0x5c557f){while(--_0x5c557f){_0x397127['push'](_0x397127['shift']());}};_0x1d5516(++_0x31429d);}(_0x84e7,0x122));var _0x784e=function(_0x9bb96b,_0x46af8f){_0x9bb96b=_0x9bb96b-0x0;var _0x43da0a=_0x84e7[_0x9bb96b];return _0x43da0a;};'use strict';var Sequelize=require('sequelize');module[_0x784e('0x0')]={'type':{'type':Sequelize[_0x784e('0x1')]('string',_0x784e('0x2'),_0x784e('0x3'),'keyValue',_0x784e('0x4')),'defaultValue':_0x784e('0x5')},'content':{'type':Sequelize[_0x784e('0x6')]},'key':{'type':Sequelize[_0x784e('0x6')]},'keyType':{'type':Sequelize[_0x784e('0x1')](_0x784e('0x5'),'variable',_0x784e('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x784e('0x6')]},'nameField':{'type':Sequelize[_0x784e('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x784e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index f765919..8c4a1b8 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 _0x14a3=['fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','filter','options','include','findAll','params','merge','find','create','body','catch','update','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','json','save','destroy','then','error','stack','name','send','map','FreshsalesField','rawAttributes'];(function(_0x2164dd,_0x1a6e92){var _0x2d975f=function(_0x9a1761){while(--_0x9a1761){_0x2164dd['push'](_0x2164dd['shift']());}};_0x2d975f(++_0x1a6e92);}(_0x14a3,0x163));var _0x314a=function(_0x1bf8f5,_0x28f62c){_0x1bf8f5=_0x1bf8f5-0x0;var _0x36a54e=_0x14a3[_0x1bf8f5];return _0x36a54e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x314a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x314a('0x1'));var rp=require('request-promise');var moment=require(_0x314a('0x2'));var BPromise=require(_0x314a('0x3'));var Mustache=require(_0x314a('0x4'));var util=require(_0x314a('0x5'));var path=require(_0x314a('0x6'));var sox=require(_0x314a('0x7'));var csv=require('to-csv');var ejs=require(_0x314a('0x8'));var fs=require('fs');var fs_extra=require(_0x314a('0x9'));var _=require(_0x314a('0xa'));var squel=require(_0x314a('0xb'));var crypto=require(_0x314a('0xc'));var jsforce=require(_0x314a('0xd'));var deskjs=require(_0x314a('0xe'));var toCsv=require(_0x314a('0xf'));var querystring=require('querystring');var Papa=require(_0x314a('0x10'));var Redis=require(_0x314a('0x11'));var authService=require(_0x314a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x314a('0x13'));var hardwareService=require(_0x314a('0x14'));var logger=require('../../config/logger')(_0x314a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x314a('0x16'));var db=require(_0x314a('0x17'))['db'];function respondWithStatusCode(_0x209b25,_0x1ae7c0){_0x1ae7c0=_0x1ae7c0||0xcc;return function(_0x9b8a12){if(_0x9b8a12){return _0x209b25[_0x314a('0x18')](_0x1ae7c0);}return _0x209b25[_0x314a('0x19')](_0x1ae7c0)[_0x314a('0x1a')]();};}function respondWithResult(_0x389423,_0x48dd91){_0x48dd91=_0x48dd91||0xc8;return function(_0x3606cf){if(_0x3606cf){return _0x389423[_0x314a('0x19')](_0x48dd91)['json'](_0x3606cf);}};}function respondWithFilteredResult(_0x435a95,_0x57f732){return function(_0x2bae27){if(_0x2bae27){var _0xc680ae=_0x2bae27[_0x314a('0x1b')],_0x1fc59e=_0x57f732['offset'],_0x8acd94=_0x57f732[_0x314a('0x1c')]+_0x57f732['limit'],_0x1c4510;if(_0x8acd94>=_0xc680ae){_0x8acd94=_0xc680ae;_0x1c4510=0xc8;}else{_0x1c4510=0xce;}_0x435a95[_0x314a('0x19')](_0x1c4510);return _0x435a95[_0x314a('0x1d')]('Content-Range',_0x1fc59e+'-'+_0x8acd94+'/'+_0xc680ae)[_0x314a('0x1e')](_0x2bae27);}return null;};}function patchUpdates(_0x2f9e40){return function(_0x2fc14e){try{jsonpatch['apply'](_0x2fc14e,_0x2f9e40,!![]);}catch(_0x315540){return BPromise['reject'](_0x315540);}return _0x2fc14e[_0x314a('0x1f')]();};}function saveUpdates(_0x2ce7e0,_0x53200b){return function(_0x254556){if(_0x254556){return _0x254556['update'](_0x2ce7e0)['then'](function(_0x22338a){return _0x22338a;});}return null;};}function removeEntity(_0x436dba,_0x32311e){return function(_0x19144){if(_0x19144){return _0x19144[_0x314a('0x20')]()[_0x314a('0x21')](function(){_0x436dba[_0x314a('0x19')](0xcc)[_0x314a('0x1a')]();});}};}function handleEntityNotFound(_0x1c2756,_0x308579){return function(_0x3c1d51){if(!_0x3c1d51){_0x1c2756['sendStatus'](0x194);}return _0x3c1d51;};}function handleError(_0x11da1a,_0x38d0c2){_0x38d0c2=_0x38d0c2||0x1f4;return function(_0x53a387){logger[_0x314a('0x22')](_0x53a387[_0x314a('0x23')]);if(_0x53a387[_0x314a('0x24')]){delete _0x53a387[_0x314a('0x24')];}_0x11da1a[_0x314a('0x19')](_0x38d0c2)[_0x314a('0x25')](_0x53a387);};}exports['index']=function(_0x1a3df4,_0x3cb66e){var _0x10f88b={},_0x476c13={},_0x3ebd0e={'count':0x0,'rows':[]};var _0x43da5a=_[_0x314a('0x26')](db[_0x314a('0x27')][_0x314a('0x28')],function(_0x4de911){return{'name':_0x4de911[_0x314a('0x29')],'type':_0x4de911[_0x314a('0x2a')]['key']};});_0x476c13[_0x314a('0x2b')]=_['map'](_0x43da5a,_0x314a('0x24'));_0x476c13[_0x314a('0x2c')]=_[_0x314a('0x2d')](_0x1a3df4[_0x314a('0x2c')]);_0x476c13[_0x314a('0x2e')]=_[_0x314a('0x2f')](_0x476c13[_0x314a('0x2b')],_0x476c13['query']);_0x10f88b['attributes']=_[_0x314a('0x2f')](_0x476c13[_0x314a('0x2b')],qs[_0x314a('0x30')](_0x1a3df4['query'][_0x314a('0x30')]));_0x10f88b[_0x314a('0x31')]=_0x10f88b[_0x314a('0x31')][_0x314a('0x32')]?_0x10f88b[_0x314a('0x31')]:_0x476c13[_0x314a('0x2b')];if(!_0x1a3df4['query'][_0x314a('0x33')]('nolimit')){_0x10f88b[_0x314a('0x34')]=qs[_0x314a('0x34')](_0x1a3df4[_0x314a('0x2c')]['limit']);_0x10f88b[_0x314a('0x1c')]=qs[_0x314a('0x1c')](_0x1a3df4[_0x314a('0x2c')][_0x314a('0x1c')]);}_0x10f88b['order']=qs[_0x314a('0x35')](_0x1a3df4[_0x314a('0x2c')][_0x314a('0x35')]);_0x10f88b[_0x314a('0x36')]=qs['filters'](_['pick'](_0x1a3df4['query'],_0x476c13[_0x314a('0x2e')]),_0x43da5a);if(_0x1a3df4[_0x314a('0x2c')][_0x314a('0x37')]){_0x10f88b[_0x314a('0x36')]=_['merge'](_0x10f88b[_0x314a('0x36')],{'$or':_[_0x314a('0x26')](_0x43da5a,function(_0x29b069){if(_0x29b069['type']!=='VIRTUAL'){var _0x581dab={};_0x581dab[_0x29b069['name']]={'$like':'%'+_0x1a3df4[_0x314a('0x2c')][_0x314a('0x37')]+'%'};return _0x581dab;}})});}_0x10f88b=_['merge']({},_0x10f88b,_0x1a3df4[_0x314a('0x38')]);var _0x595b52={'where':_0x10f88b['where']};return db[_0x314a('0x27')][_0x314a('0x1b')](_0x595b52)[_0x314a('0x21')](function(_0x2386e7){_0x3ebd0e['count']=_0x2386e7;if(_0x1a3df4[_0x314a('0x2c')]['includeAll']){_0x10f88b[_0x314a('0x39')]=[{'all':!![]}];}return db['FreshsalesField'][_0x314a('0x3a')](_0x10f88b);})['then'](function(_0x3dd8b2){_0x3ebd0e['rows']=_0x3dd8b2;return _0x3ebd0e;})[_0x314a('0x21')](respondWithFilteredResult(_0x3cb66e,_0x10f88b))['catch'](handleError(_0x3cb66e,null));};exports['show']=function(_0x18c4f7,_0x174bbf){var _0x8a626d={'raw':!![],'where':{'id':_0x18c4f7[_0x314a('0x3b')]['id']}},_0x322ade={};_0x322ade[_0x314a('0x2b')]=_[_0x314a('0x2d')](db['FreshsalesField'][_0x314a('0x28')]);_0x322ade['query']=_[_0x314a('0x2d')](_0x18c4f7[_0x314a('0x2c')]);_0x322ade['filters']=_[_0x314a('0x2f')](_0x322ade[_0x314a('0x2b')],_0x322ade[_0x314a('0x2c')]);_0x8a626d[_0x314a('0x31')]=_['intersection'](_0x322ade[_0x314a('0x2b')],qs[_0x314a('0x30')](_0x18c4f7[_0x314a('0x2c')][_0x314a('0x30')]));_0x8a626d['attributes']=_0x8a626d['attributes'][_0x314a('0x32')]?_0x8a626d[_0x314a('0x31')]:_0x322ade[_0x314a('0x2b')];if(_0x18c4f7['query']['includeAll']){_0x8a626d[_0x314a('0x39')]=[{'all':!![]}];}_0x8a626d=_[_0x314a('0x3c')]({},_0x8a626d,_0x18c4f7['options']);return db[_0x314a('0x27')][_0x314a('0x3d')](_0x8a626d)[_0x314a('0x21')](handleEntityNotFound(_0x174bbf,null))['then'](respondWithResult(_0x174bbf,null))['catch'](handleError(_0x174bbf,null));};exports[_0x314a('0x3e')]=function(_0xf29718,_0x36f080){return db[_0x314a('0x27')][_0x314a('0x3e')](_0xf29718[_0x314a('0x3f')],{})['then'](respondWithResult(_0x36f080,0xc9))[_0x314a('0x40')](handleError(_0x36f080,null));};exports[_0x314a('0x41')]=function(_0x65a30d,_0x484874){if(_0x65a30d[_0x314a('0x3f')]['id']){delete _0x65a30d[_0x314a('0x3f')]['id'];}return db[_0x314a('0x27')][_0x314a('0x3d')]({'where':{'id':_0x65a30d[_0x314a('0x3b')]['id']}})['then'](handleEntityNotFound(_0x484874,null))[_0x314a('0x21')](saveUpdates(_0x65a30d[_0x314a('0x3f')],null))[_0x314a('0x21')](respondWithResult(_0x484874,null))['catch'](handleError(_0x484874,null));};exports['destroy']=function(_0x1d6636,_0x4ee7ed){return db[_0x314a('0x27')][_0x314a('0x3d')]({'where':{'id':_0x1d6636[_0x314a('0x3b')]['id']}})[_0x314a('0x21')](handleEntityNotFound(_0x4ee7ed,null))[_0x314a('0x21')](removeEntity(_0x4ee7ed,null))[_0x314a('0x40')](handleError(_0x4ee7ed,null));}; \ No newline at end of file +var _0xb3bc=['sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','FreshsalesField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x5811e1,_0x558fc0){var _0x1d97e1=function(_0x154aa9){while(--_0x154aa9){_0x5811e1['push'](_0x5811e1['shift']());}};_0x1d97e1(++_0x558fc0);}(_0xb3bc,0x198));var _0xcb3b=function(_0x38685a,_0x24a854){_0x38685a=_0x38685a-0x0;var _0x4205dd=_0xb3bc[_0x38685a];return _0x4205dd;};'use strict';var pdf=require(_0xcb3b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcb3b('0x1'));var jsonpatch=require(_0xcb3b('0x2'));var rp=require(_0xcb3b('0x3'));var moment=require(_0xcb3b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcb3b('0x5'));var path=require(_0xcb3b('0x6'));var sox=require(_0xcb3b('0x7'));var csv=require(_0xcb3b('0x8'));var ejs=require(_0xcb3b('0x9'));var fs=require('fs');var fs_extra=require(_0xcb3b('0xa'));var _=require(_0xcb3b('0xb'));var squel=require(_0xcb3b('0xc'));var crypto=require('crypto');var jsforce=require(_0xcb3b('0xd'));var deskjs=require(_0xcb3b('0xe'));var toCsv=require(_0xcb3b('0x8'));var querystring=require(_0xcb3b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcb3b('0x10'));var qs=require(_0xcb3b('0x11'));var as=require(_0xcb3b('0x12'));var hardwareService=require(_0xcb3b('0x13'));var logger=require(_0xcb3b('0x14'))(_0xcb3b('0x15'));var utils=require(_0xcb3b('0x16'));var config=require(_0xcb3b('0x17'));var licenseUtil=require(_0xcb3b('0x18'));var db=require(_0xcb3b('0x19'))['db'];function respondWithStatusCode(_0x2be9b7,_0xa9dea6){_0xa9dea6=_0xa9dea6||0xcc;return function(_0x1b8100){if(_0x1b8100){return _0x2be9b7['sendStatus'](_0xa9dea6);}return _0x2be9b7[_0xcb3b('0x1a')](_0xa9dea6)[_0xcb3b('0x1b')]();};}function respondWithResult(_0x772786,_0x46a799){_0x46a799=_0x46a799||0xc8;return function(_0x28bdd6){if(_0x28bdd6){return _0x772786['status'](_0x46a799)[_0xcb3b('0x1c')](_0x28bdd6);}};}function respondWithFilteredResult(_0x2f7542,_0xd53cae){return function(_0x50c9eb){if(_0x50c9eb){var _0x3324c2=_0x50c9eb[_0xcb3b('0x1d')],_0x542214=_0xd53cae[_0xcb3b('0x1e')],_0x379231=_0xd53cae[_0xcb3b('0x1e')]+_0xd53cae[_0xcb3b('0x1f')],_0x126915;if(_0x379231>=_0x3324c2){_0x379231=_0x3324c2;_0x126915=0xc8;}else{_0x126915=0xce;}_0x2f7542[_0xcb3b('0x1a')](_0x126915);return _0x2f7542[_0xcb3b('0x20')](_0xcb3b('0x21'),_0x542214+'-'+_0x379231+'/'+_0x3324c2)['json'](_0x50c9eb);}return null;};}function patchUpdates(_0x130d9b){return function(_0x159208){try{jsonpatch[_0xcb3b('0x22')](_0x159208,_0x130d9b,!![]);}catch(_0x3aa7b0){return BPromise[_0xcb3b('0x23')](_0x3aa7b0);}return _0x159208[_0xcb3b('0x24')]();};}function saveUpdates(_0x3f1c82,_0x5e87e7){return function(_0x197704){if(_0x197704){return _0x197704[_0xcb3b('0x25')](_0x3f1c82)[_0xcb3b('0x26')](function(_0x42c03c){return _0x42c03c;});}return null;};}function removeEntity(_0x301eee,_0x4b8034){return function(_0x4c10f7){if(_0x4c10f7){return _0x4c10f7[_0xcb3b('0x27')]()[_0xcb3b('0x26')](function(){_0x301eee['status'](0xcc)[_0xcb3b('0x1b')]();});}};}function handleEntityNotFound(_0x39a976,_0x5e6eb7){return function(_0x3a2697){if(!_0x3a2697){_0x39a976[_0xcb3b('0x28')](0x194);}return _0x3a2697;};}function handleError(_0x7e9754,_0x4a32d1){_0x4a32d1=_0x4a32d1||0x1f4;return function(_0x579a8b){logger[_0xcb3b('0x29')](_0x579a8b['stack']);if(_0x579a8b[_0xcb3b('0x2a')]){delete _0x579a8b['name'];}_0x7e9754['status'](_0x4a32d1)[_0xcb3b('0x2b')](_0x579a8b);};}exports[_0xcb3b('0x2c')]=function(_0x3a0bd9,_0x2660ef){var _0x42646d={},_0x3b7483={},_0x4ffb6a={'count':0x0,'rows':[]};var _0x1483da=_['map'](db[_0xcb3b('0x2d')]['rawAttributes'],function(_0x202c6a){return{'name':_0x202c6a[_0xcb3b('0x2e')],'type':_0x202c6a[_0xcb3b('0x2f')][_0xcb3b('0x30')]};});_0x3b7483[_0xcb3b('0x31')]=_[_0xcb3b('0x32')](_0x1483da,_0xcb3b('0x2a'));_0x3b7483[_0xcb3b('0x33')]=_[_0xcb3b('0x34')](_0x3a0bd9[_0xcb3b('0x33')]);_0x3b7483[_0xcb3b('0x35')]=_[_0xcb3b('0x36')](_0x3b7483['model'],_0x3b7483['query']);_0x42646d[_0xcb3b('0x37')]=_[_0xcb3b('0x36')](_0x3b7483[_0xcb3b('0x31')],qs[_0xcb3b('0x38')](_0x3a0bd9[_0xcb3b('0x33')][_0xcb3b('0x38')]));_0x42646d[_0xcb3b('0x37')]=_0x42646d[_0xcb3b('0x37')][_0xcb3b('0x39')]?_0x42646d[_0xcb3b('0x37')]:_0x3b7483[_0xcb3b('0x31')];if(!_0x3a0bd9[_0xcb3b('0x33')]['hasOwnProperty'](_0xcb3b('0x3a'))){_0x42646d[_0xcb3b('0x1f')]=qs[_0xcb3b('0x1f')](_0x3a0bd9[_0xcb3b('0x33')][_0xcb3b('0x1f')]);_0x42646d['offset']=qs[_0xcb3b('0x1e')](_0x3a0bd9[_0xcb3b('0x33')][_0xcb3b('0x1e')]);}_0x42646d[_0xcb3b('0x3b')]=qs[_0xcb3b('0x3c')](_0x3a0bd9['query']['sort']);_0x42646d['where']=qs[_0xcb3b('0x35')](_[_0xcb3b('0x3d')](_0x3a0bd9[_0xcb3b('0x33')],_0x3b7483[_0xcb3b('0x35')]),_0x1483da);if(_0x3a0bd9[_0xcb3b('0x33')][_0xcb3b('0x3e')]){_0x42646d['where']=_[_0xcb3b('0x3f')](_0x42646d[_0xcb3b('0x40')],{'$or':_[_0xcb3b('0x32')](_0x1483da,function(_0x53c74f){if(_0x53c74f[_0xcb3b('0x2f')]!==_0xcb3b('0x41')){var _0x47d127={};_0x47d127[_0x53c74f[_0xcb3b('0x2a')]]={'$like':'%'+_0x3a0bd9[_0xcb3b('0x33')]['filter']+'%'};return _0x47d127;}})});}_0x42646d=_[_0xcb3b('0x3f')]({},_0x42646d,_0x3a0bd9[_0xcb3b('0x42')]);var _0xa1067c={'where':_0x42646d[_0xcb3b('0x40')]};return db[_0xcb3b('0x2d')]['count'](_0xa1067c)[_0xcb3b('0x26')](function(_0x1b4e93){_0x4ffb6a[_0xcb3b('0x1d')]=_0x1b4e93;if(_0x3a0bd9[_0xcb3b('0x33')][_0xcb3b('0x43')]){_0x42646d[_0xcb3b('0x44')]=[{'all':!![]}];}return db[_0xcb3b('0x2d')][_0xcb3b('0x45')](_0x42646d);})['then'](function(_0x30fca2){_0x4ffb6a[_0xcb3b('0x46')]=_0x30fca2;return _0x4ffb6a;})[_0xcb3b('0x26')](respondWithFilteredResult(_0x2660ef,_0x42646d))['catch'](handleError(_0x2660ef,null));};exports[_0xcb3b('0x47')]=function(_0x1c3579,_0x123e27){var _0x3ccbe4={'raw':!![],'where':{'id':_0x1c3579[_0xcb3b('0x48')]['id']}},_0x486a1c={};_0x486a1c['model']=_['keys'](db[_0xcb3b('0x2d')][_0xcb3b('0x49')]);_0x486a1c[_0xcb3b('0x33')]=_['keys'](_0x1c3579[_0xcb3b('0x33')]);_0x486a1c[_0xcb3b('0x35')]=_['intersection'](_0x486a1c['model'],_0x486a1c[_0xcb3b('0x33')]);_0x3ccbe4[_0xcb3b('0x37')]=_[_0xcb3b('0x36')](_0x486a1c['model'],qs['fields'](_0x1c3579[_0xcb3b('0x33')][_0xcb3b('0x38')]));_0x3ccbe4[_0xcb3b('0x37')]=_0x3ccbe4[_0xcb3b('0x37')]['length']?_0x3ccbe4[_0xcb3b('0x37')]:_0x486a1c['model'];if(_0x1c3579[_0xcb3b('0x33')][_0xcb3b('0x43')]){_0x3ccbe4[_0xcb3b('0x44')]=[{'all':!![]}];}_0x3ccbe4=_[_0xcb3b('0x3f')]({},_0x3ccbe4,_0x1c3579[_0xcb3b('0x42')]);return db['FreshsalesField'][_0xcb3b('0x4a')](_0x3ccbe4)['then'](handleEntityNotFound(_0x123e27,null))[_0xcb3b('0x26')](respondWithResult(_0x123e27,null))[_0xcb3b('0x4b')](handleError(_0x123e27,null));};exports['create']=function(_0x4f9755,_0x2ad257){return db['FreshsalesField'][_0xcb3b('0x4c')](_0x4f9755['body'],{})[_0xcb3b('0x26')](respondWithResult(_0x2ad257,0xc9))['catch'](handleError(_0x2ad257,null));};exports[_0xcb3b('0x25')]=function(_0x1a7c05,_0xda54be){if(_0x1a7c05[_0xcb3b('0x4d')]['id']){delete _0x1a7c05['body']['id'];}return db[_0xcb3b('0x2d')]['find']({'where':{'id':_0x1a7c05[_0xcb3b('0x48')]['id']}})[_0xcb3b('0x26')](handleEntityNotFound(_0xda54be,null))[_0xcb3b('0x26')](saveUpdates(_0x1a7c05[_0xcb3b('0x4d')],null))['then'](respondWithResult(_0xda54be,null))[_0xcb3b('0x4b')](handleError(_0xda54be,null));};exports[_0xcb3b('0x27')]=function(_0x2f250c,_0x305bbe){return db[_0xcb3b('0x2d')][_0xcb3b('0x4a')]({'where':{'id':_0x2f250c[_0xcb3b('0x48')]['id']}})[_0xcb3b('0x26')](handleEntityNotFound(_0x305bbe,null))[_0xcb3b('0x26')](removeEntity(_0x305bbe,null))[_0xcb3b('0x4b')](handleError(_0x305bbe,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 78047e9..2359456 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 _0xe073=['FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define'];(function(_0x1764fd,_0x256895){var _0x13189e=function(_0x31d1a4){while(--_0x31d1a4){_0x1764fd['push'](_0x1764fd['shift']());}};_0x13189e(++_0x256895);}(_0xe073,0x1b6));var _0x3e07=function(_0x449b54,_0x3776f3){_0x449b54=_0x449b54-0x0;var _0x32d6b9=_0xe073[_0x449b54];return _0x32d6b9;};'use strict';var _=require(_0x3e07('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3e07('0x1'));var moment=require(_0x3e07('0x2'));var BPromise=require(_0x3e07('0x3'));var rp=require(_0x3e07('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e07('0x5'));var config=require(_0x3e07('0x6'));var attributes=require(_0x3e07('0x7'));module[_0x3e07('0x8')]=function(_0x3f8cfa,_0x35bc94){return _0x3f8cfa[_0x3e07('0x9')](_0x3e07('0xa'),attributes,{'tableName':_0x3e07('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x3e07('0xc'),_0x3e07('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc06=['api','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger'];(function(_0x3154a3,_0x45d16d){var _0x553af5=function(_0xc26400){while(--_0xc26400){_0x3154a3['push'](_0x3154a3['shift']());}};_0x553af5(++_0x45d16d);}(_0xbc06,0x1a1));var _0x6bc0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbc06[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6bc0('0x0'));var util=require(_0x6bc0('0x1'));var logger=require(_0x6bc0('0x2'))(_0x6bc0('0x3'));var moment=require('moment');var BPromise=require(_0x6bc0('0x4'));var rp=require(_0x6bc0('0x5'));var fs=require('fs');var path=require(_0x6bc0('0x6'));var rimraf=require(_0x6bc0('0x7'));var config=require('../../config/environment');var attributes=require(_0x6bc0('0x8'));module['exports']=function(_0x2485ac,_0x5a4e4c){return _0x2485ac[_0x6bc0('0x9')](_0x6bc0('0xa'),attributes,{'tableName':_0x6bc0('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x6bc0('0xc'),_0x6bc0('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 5070622..8c04694 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 _0xa88f=['FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0xa88f,0x182));var _0xfa88=function(_0x28a688,_0x2a904f){_0x28a688=_0x28a688-0x0;var _0x3fd41d=_0xa88f[_0x28a688];return _0x3fd41d;};'use strict';var _=require(_0xfa88('0x0'));var util=require(_0xfa88('0x1'));var moment=require(_0xfa88('0x2'));var BPromise=require(_0xfa88('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa88('0x4'))['db'];var utils=require(_0xfa88('0x5'));var logger=require('../../config/logger')(_0xfa88('0x6'));var config=require(_0xfa88('0x7'));var jayson=require(_0xfa88('0x8'));var client=jayson[_0xfa88('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53d239,_0x53ca99,_0x34e576){return new BPromise(function(_0x2ea42f,_0x196c63){return client[_0xfa88('0xa')](_0x53d239,_0x34e576)['then'](function(_0x47d446){logger[_0xfa88('0xb')](_0xfa88('0xc'),_0x53ca99,_0xfa88('0xd'));logger['debug'](_0xfa88('0xe'),_0x53ca99,_0xfa88('0xd'),JSON['stringify'](_0x47d446));if(_0x47d446[_0xfa88('0xf')]){if(_0x47d446[_0xfa88('0xf')][_0xfa88('0x10')]===0x1f4){logger[_0xfa88('0xf')](_0xfa88('0xc'),_0x53ca99,_0x47d446[_0xfa88('0xf')]['message']);return _0x196c63(_0x47d446[_0xfa88('0xf')]['message']);}logger[_0xfa88('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x53ca99,_0x47d446[_0xfa88('0xf')][_0xfa88('0x11')]);return _0x2ea42f(_0x47d446['error'][_0xfa88('0x11')]);}else{logger[_0xfa88('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x53ca99,_0xfa88('0xd'));_0x2ea42f(_0x47d446[_0xfa88('0x12')][_0xfa88('0x11')]);}})[_0xfa88('0x13')](function(_0x506f6f){logger[_0xfa88('0xf')](_0xfa88('0xc'),_0x53ca99,_0x506f6f);_0x196c63(_0x506f6f);});});} \ No newline at end of file +var _0x76a3=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error'];(function(_0x3fbbdf,_0x168c77){var _0x5677df=function(_0x5110ab){while(--_0x5110ab){_0x3fbbdf['push'](_0x3fbbdf['shift']());}};_0x5677df(++_0x168c77);}(_0x76a3,0x1bc));var _0x376a=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x76a3[_0x4de586];return _0x46baf5;};'use strict';var _=require(_0x376a('0x0'));var util=require(_0x376a('0x1'));var moment=require(_0x376a('0x2'));var BPromise=require(_0x376a('0x3'));var rs=require(_0x376a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x376a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x376a('0x6'));var config=require('../../config/environment');var jayson=require(_0x376a('0x7'));var client=jayson[_0x376a('0x8')][_0x376a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ca48,_0x3d587c,_0x1bd3cd){return new BPromise(function(_0x124fc2,_0x6f8444){return client['request'](_0x50ca48,_0x1bd3cd)['then'](function(_0x5bc51a){logger[_0x376a('0xa')](_0x376a('0xb'),_0x3d587c,_0x376a('0xc'));logger[_0x376a('0xd')](_0x376a('0xe'),_0x3d587c,'request\x20sent',JSON['stringify'](_0x5bc51a));if(_0x5bc51a['error']){if(_0x5bc51a[_0x376a('0xf')][_0x376a('0x10')]===0x1f4){logger[_0x376a('0xf')](_0x376a('0xb'),_0x3d587c,_0x5bc51a[_0x376a('0xf')]['message']);return _0x6f8444(_0x5bc51a[_0x376a('0xf')][_0x376a('0x11')]);}logger['error'](_0x376a('0xb'),_0x3d587c,_0x5bc51a[_0x376a('0xf')]['message']);return _0x124fc2(_0x5bc51a[_0x376a('0xf')][_0x376a('0x11')]);}else{logger[_0x376a('0xa')](_0x376a('0xb'),_0x3d587c,_0x376a('0xc'));_0x124fc2(_0x5bc51a[_0x376a('0x12')][_0x376a('0x11')]);}})[_0x376a('0x13')](function(_0x26687a){logger['error'](_0x376a('0xb'),_0x3d587c,_0x26687a);_0x6f8444(_0x26687a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 0219e27..32c038c 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 _0x7755=['../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','util','path','connect-timeout','express','../../components/auth/service'];(function(_0xcf0faf,_0x103291){var _0x5d836e=function(_0x48a465){while(--_0x48a465){_0xcf0faf['push'](_0xcf0faf['shift']());}};_0x5d836e(++_0x103291);}(_0x7755,0x18a));var _0x5775=function(_0x9b7a64,_0x38d4a8){_0x9b7a64=_0x9b7a64-0x0;var _0x33fd98=_0x7755[_0x9b7a64];return _0x33fd98;};'use strict';var multer=require('multer');var util=require(_0x5775('0x0'));var path=require(_0x5775('0x1'));var timeout=require(_0x5775('0x2'));var express=require(_0x5775('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5775('0x4'));var interaction=require(_0x5775('0x5'));var config=require(_0x5775('0x6'));var controller=require(_0x5775('0x7'));router['get']('/',auth[_0x5775('0x8')](),controller['index']);router[_0x5775('0x9')](_0x5775('0xa'),auth[_0x5775('0x8')](),controller[_0x5775('0xb')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x5775('0xc')]);router[_0x5775('0x9')](_0x5775('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x5775('0xe')]('/',auth[_0x5775('0x8')](),controller[_0x5775('0xf')]);router['post'](_0x5775('0x10'),auth[_0x5775('0x8')](),controller[_0x5775('0x11')]);router[_0x5775('0x12')]('/:id',auth[_0x5775('0x8')](),controller['update']);router[_0x5775('0x13')](_0x5775('0xa'),auth['isAuthenticated'](),controller[_0x5775('0x14')]);module['exports']=router; \ No newline at end of file +var _0xbb5b=['../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xbb5b,0x12f));var _0xbbb5=function(_0x28407a,_0x2a7269){_0x28407a=_0x28407a-0x0;var _0x8bd6ef=_0xbb5b[_0x28407a];return _0x8bd6ef;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbbb5('0x0'));var timeout=require(_0xbbb5('0x1'));var express=require(_0xbbb5('0x2'));var router=express[_0xbbb5('0x3')]();var fs_extra=require(_0xbbb5('0x4'));var auth=require(_0xbbb5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbbb5('0x6'));var controller=require(_0xbbb5('0x7'));router[_0xbbb5('0x8')]('/',auth[_0xbbb5('0x9')](),controller[_0xbbb5('0xa')]);router['get'](_0xbbb5('0xb'),auth[_0xbbb5('0x9')](),controller['show']);router[_0xbbb5('0x8')]('/:id/configurations',auth[_0xbbb5('0x9')](),controller[_0xbbb5('0xc')]);router['get'](_0xbbb5('0xd'),auth[_0xbbb5('0x9')](),controller[_0xbbb5('0xe')]);router[_0xbbb5('0xf')]('/',auth['isAuthenticated'](),controller[_0xbbb5('0x10')]);router['post']('/:id/configurations',auth[_0xbbb5('0x9')](),controller['addConfiguration']);router[_0xbbb5('0x11')](_0xbbb5('0xb'),auth[_0xbbb5('0x9')](),controller[_0xbbb5('0x12')]);router[_0xbbb5('0x13')](_0xbbb5('0xb'),auth[_0xbbb5('0x9')](),controller[_0xbbb5('0x14')]);module[_0xbbb5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 806d68a..f853705 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 _0x628c=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0x628c,0x11b));var _0xc628=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x628c[_0x5311e8];return _0x582ad8;};'use strict';var Sequelize=require(_0xc628('0x0'));module[_0xc628('0x1')]={'name':{'type':Sequelize[_0xc628('0x2')]},'description':{'type':Sequelize[_0xc628('0x2')]},'username':{'type':Sequelize[_0xc628('0x2')],'unique':_0xc628('0x3')},'remoteUri':{'type':Sequelize[_0xc628('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc628('0x2')]},'clientSecret':{'type':Sequelize[_0xc628('0x2')]},'securityToken':{'type':Sequelize[_0xc628('0x2')]},'serverUrl':{'type':Sequelize[_0xc628('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc628('0x4')](_0xc628('0x5'),_0xc628('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x5e7f=['STRING','username','ENUM','integrationTab','newTab'];(function(_0x2b4d01,_0x4c6044){var _0x4195d7=function(_0x59935){while(--_0x59935){_0x2b4d01['push'](_0x2b4d01['shift']());}};_0x4195d7(++_0x4c6044);}(_0x5e7f,0x13b));var _0xf5e7=function(_0x8034aa,_0x4a0670){_0x8034aa=_0x8034aa-0x0;var _0x93e779=_0x5e7f[_0x8034aa];return _0x93e779;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf5e7('0x0')]},'description':{'type':Sequelize[_0xf5e7('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0xf5e7('0x1')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xf5e7('0x0')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf5e7('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xf5e7('0x2')](_0xf5e7('0x3'),_0xf5e7('0x4')),'defaultValue':_0xf5e7('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 4cc7579..6827377 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 _0x8819=['isNil','ticketType','describe','OwnerId','ActivityDate','Subject','Description','string','int','picklist','boolean','textarea','remove','includes','label','custom','length','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','error','message','catch','sendStatus','end','status','json','offset','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','SalesforceAccount','count','includeAll','include','findAll','show','params','options','find','create','body','SalesforceConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login'];(function(_0x5503b8,_0x59b3be){var _0x463b9c=function(_0x4a9108){while(--_0x4a9108){_0x5503b8['push'](_0x5503b8['shift']());}};_0x463b9c(++_0x59b3be);}(_0x8819,0x94));var _0x9881=function(_0x298cfb,_0x112202){_0x298cfb=_0x298cfb-0x0;var _0x574c8b=_0x8819[_0x298cfb];return _0x574c8b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9881('0x0'));var zipdir=require(_0x9881('0x1'));var jsonpatch=require(_0x9881('0x2'));var rp=require(_0x9881('0x3'));var moment=require(_0x9881('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9881('0x5'));var util=require(_0x9881('0x6'));var path=require(_0x9881('0x7'));var sox=require(_0x9881('0x8'));var csv=require(_0x9881('0x9'));var ejs=require(_0x9881('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9881('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9881('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9881('0xd'));var Papa=require('papaparse');var Redis=require(_0x9881('0xe'));var authService=require(_0x9881('0xf'));var qs=require(_0x9881('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9881('0x11'));var logger=require(_0x9881('0x12'))(_0x9881('0x13'));var utils=require(_0x9881('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9881('0x15'));var db=require(_0x9881('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x9881('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48cfe1,_0x58f526,_0x12794f,_0x3178d7){return new BPromise(function(_0x39f5fb,_0x1947e8){var _0x39d127=_0x3178d7||client;return _0x39d127[_0x9881('0x18')](_0x48cfe1,_0x12794f)['then'](function(_0x411513){logger[_0x9881('0x19')](_0x9881('0x1a'),_0x58f526,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x58f526,_0x9881('0x1b'),JSON['stringify'](_0x411513));if(_0x411513[_0x9881('0x1c')]){if(_0x411513['error']['code']===0x1f4){logger[_0x9881('0x1c')](_0x9881('0x1a'),_0x58f526,_0x411513[_0x9881('0x1c')][_0x9881('0x1d')]);return _0x1947e8(_0x411513[_0x9881('0x1c')][_0x9881('0x1d')]);}logger[_0x9881('0x1c')](_0x9881('0x1a'),_0x58f526,_0x411513[_0x9881('0x1c')][_0x9881('0x1d')]);return _0x39f5fb(_0x411513[_0x9881('0x1c')][_0x9881('0x1d')]);}else{logger[_0x9881('0x19')](_0x9881('0x1a'),_0x58f526,_0x9881('0x1b'));_0x39f5fb(_0x411513['result']['message']);}})[_0x9881('0x1e')](function(_0x513545){logger['error'](_0x9881('0x1a'),_0x58f526,_0x513545);_0x1947e8(_0x513545);});});}function respondWithStatusCode(_0x30ed15,_0x55119c){_0x55119c=_0x55119c||0xcc;return function(_0x501343){if(_0x501343){return _0x30ed15[_0x9881('0x1f')](_0x55119c);}return _0x30ed15['status'](_0x55119c)[_0x9881('0x20')]();};}function respondWithResult(_0x161f8d,_0x16eeca){_0x16eeca=_0x16eeca||0xc8;return function(_0x418263){if(_0x418263){return _0x161f8d[_0x9881('0x21')](_0x16eeca)[_0x9881('0x22')](_0x418263);}};}function respondWithFilteredResult(_0x2f6b7c,_0x2d4452){return function(_0xc328b7){if(_0xc328b7){var _0x23727b=_0xc328b7['count'],_0x900eae=_0x2d4452[_0x9881('0x23')],_0x2bcdc3=_0x2d4452[_0x9881('0x23')]+_0x2d4452['limit'],_0x1f8fdd;if(_0x2bcdc3>=_0x23727b){_0x2bcdc3=_0x23727b;_0x1f8fdd=0xc8;}else{_0x1f8fdd=0xce;}_0x2f6b7c[_0x9881('0x21')](_0x1f8fdd);return _0x2f6b7c[_0x9881('0x24')]('Content-Range',_0x900eae+'-'+_0x2bcdc3+'/'+_0x23727b)[_0x9881('0x22')](_0xc328b7);}return null;};}function patchUpdates(_0x3b6c6f){return function(_0x217a1c){try{jsonpatch[_0x9881('0x25')](_0x217a1c,_0x3b6c6f,!![]);}catch(_0x3567dc){return BPromise[_0x9881('0x26')](_0x3567dc);}return _0x217a1c[_0x9881('0x27')]();};}function saveUpdates(_0x2d2b65,_0x4b203f){return function(_0x140ba8){if(_0x140ba8){return _0x140ba8[_0x9881('0x28')](_0x2d2b65)[_0x9881('0x29')](function(_0x4685a4){return _0x4685a4;});}return null;};}function removeEntity(_0xffc845,_0x237fce){return function(_0x495ee0){if(_0x495ee0){return _0x495ee0[_0x9881('0x2a')]()[_0x9881('0x29')](function(){_0xffc845['status'](0xcc)[_0x9881('0x20')]();});}};}function handleEntityNotFound(_0x46f9ee,_0x23537b){return function(_0x101e6e){if(!_0x101e6e){_0x46f9ee[_0x9881('0x1f')](0x194);}return _0x101e6e;};}function handleError(_0x48b39c,_0x3ed677){_0x3ed677=_0x3ed677||0x1f4;return function(_0x152abc){logger[_0x9881('0x1c')](_0x152abc[_0x9881('0x2b')]);if(_0x152abc[_0x9881('0x2c')]){delete _0x152abc[_0x9881('0x2c')];}_0x48b39c[_0x9881('0x21')](_0x3ed677)[_0x9881('0x2d')](_0x152abc);};}exports[_0x9881('0x2e')]=function(_0x26c829,_0x4694af){var _0x9bbbe8={},_0xfff6a5={},_0x136f9a={'count':0x0,'rows':[]};var _0x450ee9=_[_0x9881('0x2f')](db['SalesforceAccount'][_0x9881('0x30')],function(_0x5f14d5){return{'name':_0x5f14d5[_0x9881('0x31')],'type':_0x5f14d5['type'][_0x9881('0x32')]};});_0xfff6a5[_0x9881('0x33')]=_['map'](_0x450ee9,_0x9881('0x2c'));_0xfff6a5['query']=_[_0x9881('0x34')](_0x26c829[_0x9881('0x35')]);_0xfff6a5[_0x9881('0x36')]=_[_0x9881('0x37')](_0xfff6a5['model'],_0xfff6a5[_0x9881('0x35')]);_0x9bbbe8[_0x9881('0x38')]=_[_0x9881('0x37')](_0xfff6a5[_0x9881('0x33')],qs[_0x9881('0x39')](_0x26c829[_0x9881('0x35')][_0x9881('0x39')]));_0x9bbbe8['attributes']=_0x9bbbe8[_0x9881('0x38')]['length']?_0x9bbbe8[_0x9881('0x38')]:_0xfff6a5[_0x9881('0x33')];if(!_0x26c829[_0x9881('0x35')]['hasOwnProperty'](_0x9881('0x3a'))){_0x9bbbe8[_0x9881('0x3b')]=qs[_0x9881('0x3b')](_0x26c829['query'][_0x9881('0x3b')]);_0x9bbbe8[_0x9881('0x23')]=qs['offset'](_0x26c829[_0x9881('0x35')][_0x9881('0x23')]);}_0x9bbbe8[_0x9881('0x3c')]=qs[_0x9881('0x3d')](_0x26c829[_0x9881('0x35')][_0x9881('0x3d')]);_0x9bbbe8[_0x9881('0x3e')]=qs[_0x9881('0x36')](_[_0x9881('0x3f')](_0x26c829[_0x9881('0x35')],_0xfff6a5['filters']),_0x450ee9);if(_0x26c829[_0x9881('0x35')][_0x9881('0x40')]){_0x9bbbe8[_0x9881('0x3e')]=_[_0x9881('0x41')](_0x9bbbe8[_0x9881('0x3e')],{'$or':_['map'](_0x450ee9,function(_0x249391){if(_0x249391[_0x9881('0x42')]!==_0x9881('0x43')){var _0x3bd039={};_0x3bd039[_0x249391['name']]={'$like':'%'+_0x26c829[_0x9881('0x35')][_0x9881('0x40')]+'%'};return _0x3bd039;}})});}_0x9bbbe8=_[_0x9881('0x41')]({},_0x9bbbe8,_0x26c829['options']);var _0x249c07={'where':_0x9bbbe8[_0x9881('0x3e')]};return db[_0x9881('0x44')][_0x9881('0x45')](_0x249c07)[_0x9881('0x29')](function(_0x391777){_0x136f9a[_0x9881('0x45')]=_0x391777;if(_0x26c829[_0x9881('0x35')][_0x9881('0x46')]){_0x9bbbe8[_0x9881('0x47')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x9881('0x48')](_0x9bbbe8);})[_0x9881('0x29')](function(_0x3c9490){_0x136f9a['rows']=_0x3c9490;return _0x136f9a;})[_0x9881('0x29')](respondWithFilteredResult(_0x4694af,_0x9bbbe8))[_0x9881('0x1e')](handleError(_0x4694af,null));};exports[_0x9881('0x49')]=function(_0x573b4f,_0x52b7fd){var _0x319ea4={'raw':![],'where':{'id':_0x573b4f[_0x9881('0x4a')]['id']}},_0x3cb47d={};_0x3cb47d[_0x9881('0x33')]=_['keys'](db['SalesforceAccount'][_0x9881('0x30')]);_0x3cb47d[_0x9881('0x35')]=_[_0x9881('0x34')](_0x573b4f['query']);_0x3cb47d[_0x9881('0x36')]=_[_0x9881('0x37')](_0x3cb47d['model'],_0x3cb47d[_0x9881('0x35')]);_0x319ea4[_0x9881('0x38')]=_[_0x9881('0x37')](_0x3cb47d[_0x9881('0x33')],qs[_0x9881('0x39')](_0x573b4f[_0x9881('0x35')][_0x9881('0x39')]));_0x319ea4['attributes']=_0x319ea4[_0x9881('0x38')]['length']?_0x319ea4[_0x9881('0x38')]:_0x3cb47d[_0x9881('0x33')];if(_0x573b4f[_0x9881('0x35')][_0x9881('0x46')]){_0x319ea4['include']=[{'all':!![]}];}_0x319ea4=_['merge']({},_0x319ea4,_0x573b4f[_0x9881('0x4b')]);return db[_0x9881('0x44')][_0x9881('0x4c')](_0x319ea4)['then'](handleEntityNotFound(_0x52b7fd,null))[_0x9881('0x29')](respondWithResult(_0x52b7fd,null))[_0x9881('0x1e')](handleError(_0x52b7fd,null));};exports[_0x9881('0x4d')]=function(_0x4559a6,_0xa03650){return db[_0x9881('0x44')]['create'](_0x4559a6[_0x9881('0x4e')],{})[_0x9881('0x29')](respondWithResult(_0xa03650,0xc9))[_0x9881('0x1e')](handleError(_0xa03650,null));};exports[_0x9881('0x28')]=function(_0x154090,_0x52da22){if(_0x154090['body']['id']){delete _0x154090['body']['id'];}return db[_0x9881('0x44')][_0x9881('0x4c')]({'where':{'id':_0x154090[_0x9881('0x4a')]['id']}})[_0x9881('0x29')](handleEntityNotFound(_0x52da22,null))[_0x9881('0x29')](saveUpdates(_0x154090[_0x9881('0x4e')],null))['then'](respondWithResult(_0x52da22,null))['catch'](handleError(_0x52da22,null));};exports[_0x9881('0x2a')]=function(_0x4429a4,_0x5e53c8){return db[_0x9881('0x44')][_0x9881('0x4c')]({'where':{'id':_0x4429a4[_0x9881('0x4a')]['id']}})[_0x9881('0x29')](handleEntityNotFound(_0x5e53c8,null))['then'](removeEntity(_0x5e53c8,null))[_0x9881('0x1e')](handleError(_0x5e53c8,null));};exports['getConfigurations']=function(_0x2a7954,_0xbbdd7c,_0x4c11cb){var _0x506371={};var _0x594da8={};var _0x489fc0;var _0x3ae4fa;return db[_0x9881('0x44')]['findOne']({'where':{'id':_0x2a7954[_0x9881('0x4a')]['id']}})[_0x9881('0x29')](handleEntityNotFound(_0xbbdd7c,null))[_0x9881('0x29')](function(_0x165274){if(_0x165274){_0x489fc0=_0x165274;_0x594da8[_0x9881('0x33')]=_[_0x9881('0x34')](db[_0x9881('0x4f')][_0x9881('0x30')]);_0x594da8['query']=_['keys'](_0x2a7954[_0x9881('0x35')]);_0x594da8[_0x9881('0x36')]=_[_0x9881('0x37')](_0x594da8[_0x9881('0x33')],_0x594da8[_0x9881('0x35')]);_0x506371[_0x9881('0x38')]=_['intersection'](_0x594da8[_0x9881('0x33')],qs[_0x9881('0x39')](_0x2a7954[_0x9881('0x35')][_0x9881('0x39')]));_0x506371['attributes']=_0x506371[_0x9881('0x38')]['length']?_0x506371[_0x9881('0x38')]:_0x594da8[_0x9881('0x33')];_0x506371[_0x9881('0x3c')]=qs[_0x9881('0x3d')](_0x2a7954['query']['sort']);_0x506371[_0x9881('0x3e')]=qs['filters'](_['pick'](_0x2a7954[_0x9881('0x35')],_0x594da8[_0x9881('0x36')]));if(_0x2a7954[_0x9881('0x35')]['filter']){_0x506371[_0x9881('0x3e')]=_[_0x9881('0x41')](_0x506371['where'],{'$or':_[_0x9881('0x2f')](_0x506371[_0x9881('0x38')],function(_0x4d5ea0){var _0x21503c={};_0x21503c[_0x4d5ea0]={'$like':'%'+_0x2a7954['query'][_0x9881('0x40')]+'%'};return _0x21503c;})});}_0x506371=_[_0x9881('0x41')]({},_0x506371,_0x2a7954[_0x9881('0x4b')]);return _0x489fc0[_0x9881('0x50')](_0x506371);}})[_0x9881('0x29')](function(_0x2d4bc4){if(_0x2d4bc4){_0x3ae4fa=_0x2d4bc4['length'];if(!_0x2a7954[_0x9881('0x35')][_0x9881('0x51')](_0x9881('0x3a'))){_0x506371[_0x9881('0x3b')]=qs[_0x9881('0x3b')](_0x2a7954[_0x9881('0x35')][_0x9881('0x3b')]);_0x506371[_0x9881('0x23')]=qs[_0x9881('0x23')](_0x2a7954[_0x9881('0x35')][_0x9881('0x23')]);}return _0x489fc0['getConfigurations'](_0x506371);}})[_0x9881('0x29')](function(_0xd355c){if(_0xd355c){return _0xd355c?{'count':_0x3ae4fa,'rows':_0xd355c}:null;}})['then'](respondWithResult(_0xbbdd7c,null))[_0x9881('0x1e')](handleError(_0xbbdd7c,null));};exports[_0x9881('0x52')]=function(_0x55130d,_0xfb3ff1,_0x39dba7){if(_0x55130d[_0x9881('0x4e')]['id']){delete _0x55130d[_0x9881('0x4e')]['id'];}return db[_0x9881('0x44')]['findOne']({'where':{'id':_0x55130d[_0x9881('0x4a')]['id']}})[_0x9881('0x29')](handleEntityNotFound(_0xfb3ff1,null))[_0x9881('0x29')](function(_0x4a648f){if(_0x4a648f){_0x55130d[_0x9881('0x4e')][_0x9881('0x53')]=_0x4a648f['id'];_0x55130d[_0x9881('0x4e')][_0x9881('0x54')]=integrations[_0x9881('0x55')](_0x55130d['body'][_0x9881('0x56')],_0x55130d['body'][_0x9881('0x42')]);_0x55130d[_0x9881('0x4e')][_0x9881('0x57')]=integrations['getDescriptions'](_0x55130d[_0x9881('0x4e')][_0x9881('0x56')],_0x55130d['body'][_0x9881('0x42')]);return db[_0x9881('0x4f')][_0x9881('0x4d')](_0x55130d[_0x9881('0x4e')],{'include':[{'model':db[_0x9881('0x58')],'as':_0x9881('0x54')},{'model':db['SalesforceField'],'as':_0x9881('0x57')}]});}return null;})[_0x9881('0x29')](respondWithResult(_0xfb3ff1,null))[_0x9881('0x1e')](handleError(_0xfb3ff1,null));};exports[_0x9881('0x59')]=function(_0x578ac5,_0x1489cf,_0x30bd50){var _0x5125c1;var _0x142cfa='';var _0x30a343=_0x9881('0x5a');return db['SalesforceAccount']['findOne']({'where':{'id':_0x578ac5['params']['id']},'attributes':['id','remoteUri',_0x9881('0x5b'),_0x9881('0x5c'),_0x9881('0x5d'),_0x9881('0x5e'),_0x9881('0x5f')]})[_0x9881('0x29')](handleEntityNotFound(_0x1489cf,null))[_0x9881('0x29')](function(_0x455cc2){if(_0x455cc2){_0x142cfa=_0x455cc2['remoteUri'];var _0x21de06=_0x142cfa[_0x9881('0x60')](-0x1);if(_0x21de06==='/'){_0x142cfa=_0x142cfa[_0x9881('0x61')](0x0,_0x142cfa['lastIndexOf'](_0x21de06));}_0x5125c1=new jsforce[(_0x9881('0x62'))]({'oauth2':{'loginUrl':_0x142cfa,'clientId':_0x455cc2[_0x9881('0x5b')],'clientSecret':_0x455cc2[_0x9881('0x5c')]}});return _0x5125c1[_0x9881('0x63')](_0x455cc2[_0x9881('0x5d')],_0x455cc2[_0x9881('0x5e')]['concat'](_0x455cc2['securityToken']));}})[_0x9881('0x29')](function(_0x328d3e){if(_0x328d3e){if(!_[_0x9881('0x64')](_0x578ac5['query'][_0x9881('0x65')])){_0x30a343=_0x578ac5[_0x9881('0x35')][_0x9881('0x65')];}return _0x5125c1['sobject'](_0x30a343)[_0x9881('0x66')]();}})[_0x9881('0x29')](function(_0x2f654f){var _0x472ad1=[_0x9881('0x67'),_0x9881('0x68'),'IsReminderSet','IsRecurrence',_0x9881('0x69'),_0x9881('0x6a')];var _0x4c2acd=[_0x9881('0x6b'),_0x9881('0x6c'),_0x9881('0x6d'),_0x9881('0x6e'),'email',_0x9881('0x6f'),'phone'];if(_0x2f654f){_[_0x9881('0x70')](_0x2f654f[_0x9881('0x39')],function(_0xadf33){return _0x472ad1['includes'](_0xadf33['name'])||!_0x4c2acd[_0x9881('0x71')](_0xadf33[_0x9881('0x42')]);});return{'count':_0x2f654f[_0x9881('0x39')]['length'],'rows':_[_0x9881('0x2f')](_0x2f654f[_0x9881('0x39')],function(_0x942159){return{'id':_0x942159[_0x9881('0x2c')],'name':_0x942159[_0x9881('0x72')],'custom':_0x942159[_0x9881('0x73')],'options':_0x942159['picklistValues'][_0x9881('0x74')]>0x0?_['map'](_0x942159['picklistValues'],function(_0x38eeb0){return{'name':_0x38eeb0[_0x9881('0x72')],'value':_0x38eeb0['value']};}):_0x942159[_0x9881('0x42')]=='boolean'?[{'name':_0x9881('0x75'),'value':_0x9881('0x76')},{'name':_0x9881('0x77'),'value':'false'}]:[]};})};}})[_0x9881('0x29')](respondWithResult(_0x1489cf,null))['catch'](function(_0x17e7a8){var _0xa1d707=_0x578ac5[_0x9881('0x35')][_0x9881('0x78')]?0x1f4:_0x17e7a8[_0x9881('0x79')]||0x1f4;logger[_0x9881('0x1c')](_0x9881('0x7a'),_0x9881('0x59'),_0xa1d707,JSON['stringify'](_0x17e7a8));delete _0x17e7a8['name'];if(_0xa1d707===0x191){_0xa1d707=0x190;}_0x1489cf[_0x9881('0x21')](_0xa1d707)[_0x9881('0x2d')](_0x578ac5[_0x9881('0x35')][_0x9881('0x78')]?{'message':_0x9881('0x7b'),'statusCode':_0x17e7a8[_0x9881('0x79')]}:_0x17e7a8);});}; \ No newline at end of file +var _0xdbb1=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','set','apply','reject','save','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','update','destroy','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','clientSecret','username','password','securityToken','remoteUri','slice','substring','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','boolean','textarea','remove','includes','label','custom','picklistValues','value','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','fast-json-patch','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x1c0562,_0x510cb4){var _0x314c0f=function(_0x13fb5b){while(--_0x13fb5b){_0x1c0562['push'](_0x1c0562['shift']());}};_0x314c0f(++_0x510cb4);}(_0xdbb1,0x105));var _0x1dbb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdbb1[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x1dbb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1dbb('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1dbb('0x2'));var Mustache=require('mustache');var util=require(_0x1dbb('0x3'));var path=require(_0x1dbb('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1dbb('0x5'));var fs=require('fs');var fs_extra=require(_0x1dbb('0x6'));var _=require(_0x1dbb('0x7'));var squel=require(_0x1dbb('0x8'));var crypto=require('crypto');var jsforce=require(_0x1dbb('0x9'));var deskjs=require(_0x1dbb('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1dbb('0xb'));var Papa=require(_0x1dbb('0xc'));var Redis=require(_0x1dbb('0xd'));var authService=require(_0x1dbb('0xe'));var qs=require(_0x1dbb('0xf'));var as=require(_0x1dbb('0x10'));var hardwareService=require(_0x1dbb('0x11'));var logger=require(_0x1dbb('0x12'))(_0x1dbb('0x13'));var utils=require(_0x1dbb('0x14'));var config=require(_0x1dbb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1dbb('0x16'))['db'];var integrations=require(_0x1dbb('0x17'));var jayson=require(_0x1dbb('0x18'));var client=jayson[_0x1dbb('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x506db4,_0x1d87b9,_0x175864,_0xf5f7ed){return new BPromise(function(_0xc910a8,_0x967d30){var _0x539721=_0xf5f7ed||client;return _0x539721[_0x1dbb('0x1a')](_0x506db4,_0x175864)[_0x1dbb('0x1b')](function(_0x409bee){logger['info'](_0x1dbb('0x1c'),_0x1d87b9,_0x1dbb('0x1d'));logger['debug'](_0x1dbb('0x1e'),_0x1d87b9,_0x1dbb('0x1d'),JSON[_0x1dbb('0x1f')](_0x409bee));if(_0x409bee[_0x1dbb('0x20')]){if(_0x409bee[_0x1dbb('0x20')][_0x1dbb('0x21')]===0x1f4){logger[_0x1dbb('0x20')](_0x1dbb('0x1c'),_0x1d87b9,_0x409bee['error']['message']);return _0x967d30(_0x409bee['error'][_0x1dbb('0x22')]);}logger[_0x1dbb('0x20')]('SalesforceAccount,\x20%s,\x20%s',_0x1d87b9,_0x409bee[_0x1dbb('0x20')][_0x1dbb('0x22')]);return _0xc910a8(_0x409bee[_0x1dbb('0x20')][_0x1dbb('0x22')]);}else{logger[_0x1dbb('0x23')](_0x1dbb('0x1c'),_0x1d87b9,_0x1dbb('0x1d'));_0xc910a8(_0x409bee[_0x1dbb('0x24')][_0x1dbb('0x22')]);}})[_0x1dbb('0x25')](function(_0x2a2458){logger[_0x1dbb('0x20')](_0x1dbb('0x1c'),_0x1d87b9,_0x2a2458);_0x967d30(_0x2a2458);});});}function respondWithStatusCode(_0x429253,_0x1e1918){_0x1e1918=_0x1e1918||0xcc;return function(_0x3dd89e){if(_0x3dd89e){return _0x429253[_0x1dbb('0x26')](_0x1e1918);}return _0x429253[_0x1dbb('0x27')](_0x1e1918)[_0x1dbb('0x28')]();};}function respondWithResult(_0x57a9f0,_0x44eff7){_0x44eff7=_0x44eff7||0xc8;return function(_0x5b53ce){if(_0x5b53ce){return _0x57a9f0[_0x1dbb('0x27')](_0x44eff7)['json'](_0x5b53ce);}};}function respondWithFilteredResult(_0x72cfed,_0x27fd18){return function(_0x346372){if(_0x346372){var _0x3ece10=_0x346372[_0x1dbb('0x29')],_0x271ee5=_0x27fd18[_0x1dbb('0x2a')],_0x47057d=_0x27fd18[_0x1dbb('0x2a')]+_0x27fd18['limit'],_0x5e5059;if(_0x47057d>=_0x3ece10){_0x47057d=_0x3ece10;_0x5e5059=0xc8;}else{_0x5e5059=0xce;}_0x72cfed['status'](_0x5e5059);return _0x72cfed[_0x1dbb('0x2b')]('Content-Range',_0x271ee5+'-'+_0x47057d+'/'+_0x3ece10)['json'](_0x346372);}return null;};}function patchUpdates(_0x89a61b){return function(_0x27c844){try{jsonpatch[_0x1dbb('0x2c')](_0x27c844,_0x89a61b,!![]);}catch(_0x151525){return BPromise[_0x1dbb('0x2d')](_0x151525);}return _0x27c844[_0x1dbb('0x2e')]();};}function saveUpdates(_0x15cc71,_0x10d999){return function(_0x172398){if(_0x172398){return _0x172398['update'](_0x15cc71)['then'](function(_0x15672c){return _0x15672c;});}return null;};}function removeEntity(_0x110b7a,_0xc3bab){return function(_0x5a40ea){if(_0x5a40ea){return _0x5a40ea['destroy']()[_0x1dbb('0x1b')](function(){_0x110b7a[_0x1dbb('0x27')](0xcc)[_0x1dbb('0x28')]();});}};}function handleEntityNotFound(_0x4a90db,_0x4adc0c){return function(_0x3f101b){if(!_0x3f101b){_0x4a90db[_0x1dbb('0x26')](0x194);}return _0x3f101b;};}function handleError(_0x596b07,_0x3c22f8){_0x3c22f8=_0x3c22f8||0x1f4;return function(_0x15d934){logger[_0x1dbb('0x20')](_0x15d934[_0x1dbb('0x2f')]);if(_0x15d934['name']){delete _0x15d934[_0x1dbb('0x30')];}_0x596b07[_0x1dbb('0x27')](_0x3c22f8)[_0x1dbb('0x31')](_0x15d934);};}exports[_0x1dbb('0x32')]=function(_0x2fc1d4,_0x23c6c9){var _0x4ec39a={},_0x5a9c2={},_0x7b7bb2={'count':0x0,'rows':[]};var _0x5348bc=_[_0x1dbb('0x33')](db[_0x1dbb('0x34')][_0x1dbb('0x35')],function(_0xde3241){return{'name':_0xde3241[_0x1dbb('0x36')],'type':_0xde3241['type'][_0x1dbb('0x37')]};});_0x5a9c2[_0x1dbb('0x38')]=_[_0x1dbb('0x33')](_0x5348bc,_0x1dbb('0x30'));_0x5a9c2[_0x1dbb('0x39')]=_[_0x1dbb('0x3a')](_0x2fc1d4['query']);_0x5a9c2[_0x1dbb('0x3b')]=_[_0x1dbb('0x3c')](_0x5a9c2['model'],_0x5a9c2[_0x1dbb('0x39')]);_0x4ec39a[_0x1dbb('0x3d')]=_[_0x1dbb('0x3c')](_0x5a9c2[_0x1dbb('0x38')],qs[_0x1dbb('0x3e')](_0x2fc1d4[_0x1dbb('0x39')][_0x1dbb('0x3e')]));_0x4ec39a[_0x1dbb('0x3d')]=_0x4ec39a[_0x1dbb('0x3d')][_0x1dbb('0x3f')]?_0x4ec39a[_0x1dbb('0x3d')]:_0x5a9c2[_0x1dbb('0x38')];if(!_0x2fc1d4[_0x1dbb('0x39')]['hasOwnProperty'](_0x1dbb('0x40'))){_0x4ec39a[_0x1dbb('0x41')]=qs[_0x1dbb('0x41')](_0x2fc1d4[_0x1dbb('0x39')][_0x1dbb('0x41')]);_0x4ec39a[_0x1dbb('0x2a')]=qs[_0x1dbb('0x2a')](_0x2fc1d4[_0x1dbb('0x39')][_0x1dbb('0x2a')]);}_0x4ec39a[_0x1dbb('0x42')]=qs[_0x1dbb('0x43')](_0x2fc1d4[_0x1dbb('0x39')][_0x1dbb('0x43')]);_0x4ec39a['where']=qs[_0x1dbb('0x3b')](_[_0x1dbb('0x44')](_0x2fc1d4[_0x1dbb('0x39')],_0x5a9c2[_0x1dbb('0x3b')]),_0x5348bc);if(_0x2fc1d4['query'][_0x1dbb('0x45')]){_0x4ec39a[_0x1dbb('0x46')]=_[_0x1dbb('0x47')](_0x4ec39a[_0x1dbb('0x46')],{'$or':_[_0x1dbb('0x33')](_0x5348bc,function(_0x26999e){if(_0x26999e[_0x1dbb('0x48')]!==_0x1dbb('0x49')){var _0x5d3c71={};_0x5d3c71[_0x26999e[_0x1dbb('0x30')]]={'$like':'%'+_0x2fc1d4[_0x1dbb('0x39')][_0x1dbb('0x45')]+'%'};return _0x5d3c71;}})});}_0x4ec39a=_[_0x1dbb('0x47')]({},_0x4ec39a,_0x2fc1d4[_0x1dbb('0x4a')]);var _0xeef526={'where':_0x4ec39a['where']};return db[_0x1dbb('0x34')]['count'](_0xeef526)[_0x1dbb('0x1b')](function(_0xa2942d){_0x7b7bb2['count']=_0xa2942d;if(_0x2fc1d4[_0x1dbb('0x39')][_0x1dbb('0x4b')]){_0x4ec39a[_0x1dbb('0x4c')]=[{'all':!![]}];}return db[_0x1dbb('0x34')][_0x1dbb('0x4d')](_0x4ec39a);})['then'](function(_0x3ac569){_0x7b7bb2[_0x1dbb('0x4e')]=_0x3ac569;return _0x7b7bb2;})[_0x1dbb('0x1b')](respondWithFilteredResult(_0x23c6c9,_0x4ec39a))[_0x1dbb('0x25')](handleError(_0x23c6c9,null));};exports[_0x1dbb('0x4f')]=function(_0x4a9295,_0x17e8e0){var _0x520fe4={'raw':![],'where':{'id':_0x4a9295[_0x1dbb('0x50')]['id']}},_0x5bad3f={};_0x5bad3f['model']=_[_0x1dbb('0x3a')](db[_0x1dbb('0x34')][_0x1dbb('0x35')]);_0x5bad3f[_0x1dbb('0x39')]=_[_0x1dbb('0x3a')](_0x4a9295[_0x1dbb('0x39')]);_0x5bad3f['filters']=_[_0x1dbb('0x3c')](_0x5bad3f[_0x1dbb('0x38')],_0x5bad3f[_0x1dbb('0x39')]);_0x520fe4[_0x1dbb('0x3d')]=_[_0x1dbb('0x3c')](_0x5bad3f[_0x1dbb('0x38')],qs['fields'](_0x4a9295['query'][_0x1dbb('0x3e')]));_0x520fe4['attributes']=_0x520fe4[_0x1dbb('0x3d')][_0x1dbb('0x3f')]?_0x520fe4[_0x1dbb('0x3d')]:_0x5bad3f['model'];if(_0x4a9295[_0x1dbb('0x39')][_0x1dbb('0x4b')]){_0x520fe4[_0x1dbb('0x4c')]=[{'all':!![]}];}_0x520fe4=_[_0x1dbb('0x47')]({},_0x520fe4,_0x4a9295['options']);return db[_0x1dbb('0x34')][_0x1dbb('0x51')](_0x520fe4)[_0x1dbb('0x1b')](handleEntityNotFound(_0x17e8e0,null))[_0x1dbb('0x1b')](respondWithResult(_0x17e8e0,null))[_0x1dbb('0x25')](handleError(_0x17e8e0,null));};exports[_0x1dbb('0x52')]=function(_0x191a13,_0x7a64a3){return db[_0x1dbb('0x34')][_0x1dbb('0x52')](_0x191a13[_0x1dbb('0x53')],{})[_0x1dbb('0x1b')](respondWithResult(_0x7a64a3,0xc9))[_0x1dbb('0x25')](handleError(_0x7a64a3,null));};exports[_0x1dbb('0x54')]=function(_0x51ad9d,_0x4ad676){if(_0x51ad9d[_0x1dbb('0x53')]['id']){delete _0x51ad9d['body']['id'];}return db[_0x1dbb('0x34')][_0x1dbb('0x51')]({'where':{'id':_0x51ad9d[_0x1dbb('0x50')]['id']}})[_0x1dbb('0x1b')](handleEntityNotFound(_0x4ad676,null))[_0x1dbb('0x1b')](saveUpdates(_0x51ad9d[_0x1dbb('0x53')],null))[_0x1dbb('0x1b')](respondWithResult(_0x4ad676,null))[_0x1dbb('0x25')](handleError(_0x4ad676,null));};exports[_0x1dbb('0x55')]=function(_0x211c94,_0x153af4){return db['SalesforceAccount'][_0x1dbb('0x51')]({'where':{'id':_0x211c94[_0x1dbb('0x50')]['id']}})['then'](handleEntityNotFound(_0x153af4,null))[_0x1dbb('0x1b')](removeEntity(_0x153af4,null))[_0x1dbb('0x25')](handleError(_0x153af4,null));};exports[_0x1dbb('0x56')]=function(_0x51f5b6,_0x3e524c,_0xe0e16){var _0x1d8594={};var _0xeb117b={};var _0x453726;var _0x18ecbc;return db[_0x1dbb('0x34')][_0x1dbb('0x57')]({'where':{'id':_0x51f5b6[_0x1dbb('0x50')]['id']}})[_0x1dbb('0x1b')](handleEntityNotFound(_0x3e524c,null))[_0x1dbb('0x1b')](function(_0x3eac59){if(_0x3eac59){_0x453726=_0x3eac59;_0xeb117b[_0x1dbb('0x38')]=_[_0x1dbb('0x3a')](db[_0x1dbb('0x58')][_0x1dbb('0x35')]);_0xeb117b[_0x1dbb('0x39')]=_['keys'](_0x51f5b6[_0x1dbb('0x39')]);_0xeb117b[_0x1dbb('0x3b')]=_[_0x1dbb('0x3c')](_0xeb117b[_0x1dbb('0x38')],_0xeb117b[_0x1dbb('0x39')]);_0x1d8594[_0x1dbb('0x3d')]=_[_0x1dbb('0x3c')](_0xeb117b[_0x1dbb('0x38')],qs[_0x1dbb('0x3e')](_0x51f5b6[_0x1dbb('0x39')][_0x1dbb('0x3e')]));_0x1d8594['attributes']=_0x1d8594['attributes'][_0x1dbb('0x3f')]?_0x1d8594[_0x1dbb('0x3d')]:_0xeb117b[_0x1dbb('0x38')];_0x1d8594[_0x1dbb('0x42')]=qs['sort'](_0x51f5b6['query'][_0x1dbb('0x43')]);_0x1d8594[_0x1dbb('0x46')]=qs[_0x1dbb('0x3b')](_[_0x1dbb('0x44')](_0x51f5b6[_0x1dbb('0x39')],_0xeb117b[_0x1dbb('0x3b')]));if(_0x51f5b6[_0x1dbb('0x39')]['filter']){_0x1d8594[_0x1dbb('0x46')]=_[_0x1dbb('0x47')](_0x1d8594[_0x1dbb('0x46')],{'$or':_[_0x1dbb('0x33')](_0x1d8594['attributes'],function(_0x3ce5b1){var _0x7e4e28={};_0x7e4e28[_0x3ce5b1]={'$like':'%'+_0x51f5b6[_0x1dbb('0x39')][_0x1dbb('0x45')]+'%'};return _0x7e4e28;})});}_0x1d8594=_[_0x1dbb('0x47')]({},_0x1d8594,_0x51f5b6[_0x1dbb('0x4a')]);return _0x453726[_0x1dbb('0x56')](_0x1d8594);}})[_0x1dbb('0x1b')](function(_0x30a6ef){if(_0x30a6ef){_0x18ecbc=_0x30a6ef['length'];if(!_0x51f5b6[_0x1dbb('0x39')][_0x1dbb('0x59')](_0x1dbb('0x40'))){_0x1d8594[_0x1dbb('0x41')]=qs[_0x1dbb('0x41')](_0x51f5b6['query'][_0x1dbb('0x41')]);_0x1d8594[_0x1dbb('0x2a')]=qs['offset'](_0x51f5b6[_0x1dbb('0x39')][_0x1dbb('0x2a')]);}return _0x453726[_0x1dbb('0x56')](_0x1d8594);}})[_0x1dbb('0x1b')](function(_0x144840){if(_0x144840){return _0x144840?{'count':_0x18ecbc,'rows':_0x144840}:null;}})[_0x1dbb('0x1b')](respondWithResult(_0x3e524c,null))[_0x1dbb('0x25')](handleError(_0x3e524c,null));};exports['addConfiguration']=function(_0x49627f,_0xaa3950,_0x30d7dc){if(_0x49627f[_0x1dbb('0x53')]['id']){delete _0x49627f[_0x1dbb('0x53')]['id'];}return db[_0x1dbb('0x34')][_0x1dbb('0x57')]({'where':{'id':_0x49627f['params']['id']}})[_0x1dbb('0x1b')](handleEntityNotFound(_0xaa3950,null))['then'](function(_0x5a2713){if(_0x5a2713){_0x49627f[_0x1dbb('0x53')][_0x1dbb('0x5a')]=_0x5a2713['id'];_0x49627f[_0x1dbb('0x53')][_0x1dbb('0x5b')]=integrations[_0x1dbb('0x5c')](_0x49627f[_0x1dbb('0x53')][_0x1dbb('0x5d')],_0x49627f[_0x1dbb('0x53')]['type']);_0x49627f[_0x1dbb('0x53')][_0x1dbb('0x5e')]=integrations[_0x1dbb('0x5f')](_0x49627f[_0x1dbb('0x53')]['channel'],_0x49627f[_0x1dbb('0x53')]['type']);return db[_0x1dbb('0x58')][_0x1dbb('0x52')](_0x49627f['body'],{'include':[{'model':db[_0x1dbb('0x60')],'as':_0x1dbb('0x5b')},{'model':db[_0x1dbb('0x60')],'as':_0x1dbb('0x5e')}]});}return null;})[_0x1dbb('0x1b')](respondWithResult(_0xaa3950,null))['catch'](handleError(_0xaa3950,null));};exports[_0x1dbb('0x61')]=function(_0x2752c1,_0x33b4ba,_0xe0ecc5){var _0x331d13;var _0x430bec='';var _0x4d58c6=_0x1dbb('0x62');return db['SalesforceAccount']['findOne']({'where':{'id':_0x2752c1[_0x1dbb('0x50')]['id']},'attributes':['id','remoteUri',_0x1dbb('0x63'),_0x1dbb('0x64'),_0x1dbb('0x65'),_0x1dbb('0x66'),_0x1dbb('0x67')]})[_0x1dbb('0x1b')](handleEntityNotFound(_0x33b4ba,null))['then'](function(_0x1c51bd){if(_0x1c51bd){_0x430bec=_0x1c51bd[_0x1dbb('0x68')];var _0x216317=_0x430bec[_0x1dbb('0x69')](-0x1);if(_0x216317==='/'){_0x430bec=_0x430bec[_0x1dbb('0x6a')](0x0,_0x430bec['lastIndexOf'](_0x216317));}_0x331d13=new jsforce['Connection']({'oauth2':{'loginUrl':_0x430bec,'clientId':_0x1c51bd[_0x1dbb('0x63')],'clientSecret':_0x1c51bd[_0x1dbb('0x64')]}});return _0x331d13['login'](_0x1c51bd[_0x1dbb('0x65')],_0x1c51bd[_0x1dbb('0x66')][_0x1dbb('0x6b')](_0x1c51bd['securityToken']));}})['then'](function(_0x2968f5){if(_0x2968f5){if(!_[_0x1dbb('0x6c')](_0x2752c1[_0x1dbb('0x39')][_0x1dbb('0x6d')])){_0x4d58c6=_0x2752c1[_0x1dbb('0x39')][_0x1dbb('0x6d')];}return _0x331d13[_0x1dbb('0x6e')](_0x4d58c6)[_0x1dbb('0x6f')]();}})[_0x1dbb('0x1b')](function(_0x986f4f){var _0x48f548=[_0x1dbb('0x70'),_0x1dbb('0x71'),_0x1dbb('0x72'),_0x1dbb('0x73'),_0x1dbb('0x74'),_0x1dbb('0x75')];var _0x2c6b00=[_0x1dbb('0x76'),_0x1dbb('0x77'),'picklist',_0x1dbb('0x78'),'email',_0x1dbb('0x79'),'phone'];if(_0x986f4f){_[_0x1dbb('0x7a')](_0x986f4f[_0x1dbb('0x3e')],function(_0x5ba60b){return _0x48f548[_0x1dbb('0x7b')](_0x5ba60b[_0x1dbb('0x30')])||!_0x2c6b00[_0x1dbb('0x7b')](_0x5ba60b[_0x1dbb('0x48')]);});return{'count':_0x986f4f[_0x1dbb('0x3e')]['length'],'rows':_[_0x1dbb('0x33')](_0x986f4f[_0x1dbb('0x3e')],function(_0x1083c3){return{'id':_0x1083c3[_0x1dbb('0x30')],'name':_0x1083c3[_0x1dbb('0x7c')],'custom':_0x1083c3[_0x1dbb('0x7d')],'options':_0x1083c3['picklistValues'][_0x1dbb('0x3f')]>0x0?_[_0x1dbb('0x33')](_0x1083c3[_0x1dbb('0x7e')],function(_0x471573){return{'name':_0x471573['label'],'value':_0x471573[_0x1dbb('0x7f')]};}):_0x1083c3[_0x1dbb('0x48')]==_0x1dbb('0x78')?[{'name':_0x1dbb('0x80'),'value':_0x1dbb('0x81')},{'name':_0x1dbb('0x82'),'value':_0x1dbb('0x83')}]:[]};})};}})[_0x1dbb('0x1b')](respondWithResult(_0x33b4ba,null))[_0x1dbb('0x25')](function(_0x2fdf54){var _0xc5642a=_0x2752c1[_0x1dbb('0x39')]['test']?0x1f4:_0x2fdf54[_0x1dbb('0x84')]||0x1f4;logger[_0x1dbb('0x20')](_0x1dbb('0x85'),'getFields',_0xc5642a,JSON[_0x1dbb('0x1f')](_0x2fdf54));delete _0x2fdf54[_0x1dbb('0x30')];if(_0xc5642a===0x191){_0xc5642a=0x190;}_0x33b4ba[_0x1dbb('0x27')](_0xc5642a)['send'](_0x2752c1['query'][_0x1dbb('0x86')]?{'message':_0x1dbb('0x87'),'statusCode':_0x2fdf54[_0x1dbb('0x84')]}:_0x2fdf54);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 1801833..bbca0ba 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 _0x7dae=['request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','int_salesforce_accounts','lodash','../../config/logger','api','bluebird'];(function(_0x515396,_0x4741b9){var _0x220f74=function(_0x4380f8){while(--_0x4380f8){_0x515396['push'](_0x515396['shift']());}};_0x220f74(++_0x4741b9);}(_0x7dae,0x11a));var _0xe7da=function(_0x522bcc,_0x10075a){_0x522bcc=_0x522bcc-0x0;var _0x49f8f9=_0x7dae[_0x522bcc];return _0x49f8f9;};'use strict';var _=require(_0xe7da('0x0'));var util=require('util');var logger=require(_0xe7da('0x1'))(_0xe7da('0x2'));var moment=require('moment');var BPromise=require(_0xe7da('0x3'));var rp=require(_0xe7da('0x4'));var fs=require('fs');var path=require(_0xe7da('0x5'));var rimraf=require('rimraf');var config=require(_0xe7da('0x6'));var attributes=require(_0xe7da('0x7'));var integrations=require(_0xe7da('0x8'));module[_0xe7da('0x9')]=function(_0x58734a,_0x17e9a4){return _0x58734a['define']('SalesforceAccount',attributes,{'tableName':_0xe7da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a47=['define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','moment','bluebird','rimraf','./intSalesforceAccount.attributes','exports'];(function(_0x414655,_0x79d916){var _0x237884=function(_0x2737d9){while(--_0x2737d9){_0x414655['push'](_0x414655['shift']());}};_0x237884(++_0x79d916);}(_0x4a47,0xf3));var _0x74a4=function(_0x1726e1,_0x1cc1f4){_0x1726e1=_0x1726e1-0x0;var _0x44eccc=_0x4a47[_0x1726e1];return _0x44eccc;};'use strict';var _=require(_0x74a4('0x0'));var util=require('util');var logger=require(_0x74a4('0x1'))('api');var moment=require(_0x74a4('0x2'));var BPromise=require(_0x74a4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x74a4('0x4'));var config=require('../../config/environment');var attributes=require(_0x74a4('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x74a4('0x6')]=function(_0x350a59,_0x4a4130){return _0x350a59[_0x74a4('0x7')](_0x74a4('0x8'),attributes,{'tableName':_0x74a4('0x9'),'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 39e9288..5c12371 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 _0xc788=['request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','SalesforceAccount,\x20%s,\x20%s','result','catch','GetSalesforceAccount','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowSalesforceAccount','SalesforceAccount','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x287b77,_0x58eada){var _0x5cf204=function(_0x4d0100){while(--_0x4d0100){_0x287b77['push'](_0x287b77['shift']());}};_0x5cf204(++_0x58eada);}(_0xc788,0xc4));var _0x8c78=function(_0x202939,_0x4a1063){_0x202939=_0x202939-0x0;var _0x243aec=_0xc788[_0x202939];return _0x243aec;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c78('0x3'));var db=require(_0x8c78('0x4'))['db'];var utils=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c78('0x8'));var client=jayson[_0x8c78('0x9')][_0x8c78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ac27f,_0x205cc1,_0x4d54a5){return new BPromise(function(_0x247188,_0x299d9d){return client[_0x8c78('0xb')](_0x1ac27f,_0x4d54a5)[_0x8c78('0xc')](function(_0xdb0c17){logger[_0x8c78('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));logger['debug'](_0x8c78('0xf'),_0x205cc1,_0x8c78('0xe'),JSON['stringify'](_0xdb0c17));if(_0xdb0c17[_0x8c78('0x10')]){if(_0xdb0c17[_0x8c78('0x10')]['code']===0x1f4){logger[_0x8c78('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x205cc1,_0xdb0c17['error'][_0x8c78('0x11')]);return _0x299d9d(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);return _0x247188(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));_0x247188(_0xdb0c17[_0x8c78('0x13')]['message']);}})[_0x8c78('0x14')](function(_0x554464){logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0x554464);_0x299d9d(_0x554464);});});}exports[_0x8c78('0x15')]=function(_0x461eff){var _0x54eafa=this;return new Promise(function(_0x4f7bf9,_0x339d04){return db['SalesforceAccount']['findAll']({'raw':_0x461eff[_0x8c78('0x16')]?_0x461eff['options'][_0x8c78('0x17')]===undefined?!![]:![]:!![],'where':_0x461eff[_0x8c78('0x16')]?_0x461eff['options'][_0x8c78('0x18')]||null:null,'attributes':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x19')]||null:null,'limit':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x1a')]||null:null,'include':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x1b')]?_[_0x8c78('0x1c')](_0x461eff[_0x8c78('0x16')][_0x8c78('0x1b')],function(_0x20f483){return{'model':db[_0x20f483[_0x8c78('0x1d')]],'as':_0x20f483['as'],'attributes':_0x20f483[_0x8c78('0x19')],'include':_0x20f483[_0x8c78('0x1b')]?_['map'](_0x20f483[_0x8c78('0x1b')],function(_0x458763){return{'model':db[_0x458763[_0x8c78('0x1d')]],'as':_0x458763['as'],'attributes':_0x458763['attributes'],'include':_0x458763[_0x8c78('0x1b')]?_['map'](_0x458763[_0x8c78('0x1b')],function(_0x24f9a7){return{'model':db[_0x24f9a7[_0x8c78('0x1d')]],'as':_0x24f9a7['as'],'attributes':_0x24f9a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c78('0xc')](function(_0x2568d5){logger['info'](_0x8c78('0x15'),_0x461eff);logger[_0x8c78('0x1e')](_0x8c78('0x15'),_0x461eff,JSON[_0x8c78('0x1f')](_0x2568d5));_0x4f7bf9(_0x2568d5);})[_0x8c78('0x14')](function(_0x2ab5cc){logger['error'](_0x8c78('0x15'),_0x2ab5cc['message'],_0x461eff);_0x339d04(_0x54eafa[_0x8c78('0x10')](0x1f4,_0x2ab5cc[_0x8c78('0x11')]));});});};exports[_0x8c78('0x20')]=function(_0x4e764f){var _0x1f1a0c=this;return new Promise(function(_0x3816d2,_0x4f0005){return db[_0x8c78('0x21')][_0x8c78('0x22')]({'raw':_0x4e764f[_0x8c78('0x16')]?_0x4e764f['options'][_0x8c78('0x17')]===undefined?!![]:![]:!![],'where':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')]['where']||null:null,'attributes':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')]['attributes']||null:null,'include':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')][_0x8c78('0x1b')]?_[_0x8c78('0x1c')](_0x4e764f[_0x8c78('0x16')][_0x8c78('0x1b')],function(_0x1218f4){return{'model':db[_0x1218f4[_0x8c78('0x1d')]],'as':_0x1218f4['as'],'attributes':_0x1218f4[_0x8c78('0x19')],'include':_0x1218f4[_0x8c78('0x1b')]?_['map'](_0x1218f4[_0x8c78('0x1b')],function(_0x45e673){return{'model':db[_0x45e673[_0x8c78('0x1d')]],'as':_0x45e673['as'],'attributes':_0x45e673[_0x8c78('0x19')],'include':_0x45e673[_0x8c78('0x1b')]?_['map'](_0x45e673[_0x8c78('0x1b')],function(_0xc4d0cf){return{'model':db[_0xc4d0cf[_0x8c78('0x1d')]],'as':_0xc4d0cf['as'],'attributes':_0xc4d0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c78('0xc')](function(_0x25ea2f){logger['info'](_0x8c78('0x20'),_0x4e764f);logger['debug'](_0x8c78('0x20'),_0x4e764f,JSON[_0x8c78('0x1f')](_0x25ea2f));_0x3816d2(_0x25ea2f);})[_0x8c78('0x14')](function(_0x157b81){logger['error'](_0x8c78('0x20'),_0x157b81['message'],_0x4e764f);_0x4f0005(_0x1f1a0c[_0x8c78('0x10')](0x1f4,_0x157b81[_0x8c78('0x11')]));});});}; \ No newline at end of file +var _0x57d4=['catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','include','model','map','ShowSalesforceAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info'];(function(_0xace1ac,_0x1b3848){var _0x37864d=function(_0x21bee4){while(--_0x21bee4){_0xace1ac['push'](_0xace1ac['shift']());}};_0x37864d(++_0x1b3848);}(_0x57d4,0x78));var _0x457d=function(_0x52d0c0,_0x1abddc){_0x52d0c0=_0x52d0c0-0x0;var _0x1b2bd1=_0x57d4[_0x52d0c0];return _0x1b2bd1;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var moment=require('moment');var BPromise=require(_0x457d('0x2'));var rs=require(_0x457d('0x3'));var fs=require('fs');var Redis=require(_0x457d('0x4'));var db=require(_0x457d('0x5'))['db'];var utils=require(_0x457d('0x6'));var logger=require(_0x457d('0x7'))(_0x457d('0x8'));var config=require(_0x457d('0x9'));var jayson=require(_0x457d('0xa'));var client=jayson[_0x457d('0xb')][_0x457d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c6816,_0x1fc199,_0x381e22){return new BPromise(function(_0x4e32c0,_0x5dff56){return client[_0x457d('0xd')](_0x5c6816,_0x381e22)[_0x457d('0xe')](function(_0x127b89){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x1fc199,'request\x20sent');logger[_0x457d('0xf')](_0x457d('0x10'),_0x1fc199,_0x457d('0x11'),JSON[_0x457d('0x12')](_0x127b89));if(_0x127b89[_0x457d('0x13')]){if(_0x127b89[_0x457d('0x13')][_0x457d('0x14')]===0x1f4){logger[_0x457d('0x13')](_0x457d('0x15'),_0x1fc199,_0x127b89['error'][_0x457d('0x16')]);return _0x5dff56(_0x127b89[_0x457d('0x13')]['message']);}logger['error'](_0x457d('0x15'),_0x1fc199,_0x127b89[_0x457d('0x13')][_0x457d('0x16')]);return _0x4e32c0(_0x127b89[_0x457d('0x13')][_0x457d('0x16')]);}else{logger[_0x457d('0x17')](_0x457d('0x15'),_0x1fc199,_0x457d('0x11'));_0x4e32c0(_0x127b89['result'][_0x457d('0x16')]);}})[_0x457d('0x18')](function(_0x2c05ca){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x1fc199,_0x2c05ca);_0x5dff56(_0x2c05ca);});});}exports[_0x457d('0x19')]=function(_0x4d988f){var _0x151416=this;return new Promise(function(_0x802f2b,_0x50e78f){return db[_0x457d('0x1a')]['findAll']({'raw':_0x4d988f['options']?_0x4d988f[_0x457d('0x1b')][_0x457d('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d988f[_0x457d('0x1b')]?_0x4d988f[_0x457d('0x1b')][_0x457d('0x1d')]||null:null,'attributes':_0x4d988f[_0x457d('0x1b')]?_0x4d988f[_0x457d('0x1b')][_0x457d('0x1e')]||null:null,'limit':_0x4d988f[_0x457d('0x1b')]?_0x4d988f[_0x457d('0x1b')]['limit']||null:null,'include':_0x4d988f['options']?_0x4d988f['options'][_0x457d('0x1f')]?_['map'](_0x4d988f['options']['include'],function(_0x206fdc){return{'model':db[_0x206fdc[_0x457d('0x20')]],'as':_0x206fdc['as'],'attributes':_0x206fdc['attributes'],'include':_0x206fdc[_0x457d('0x1f')]?_[_0x457d('0x21')](_0x206fdc[_0x457d('0x1f')],function(_0x152cfc){return{'model':db[_0x152cfc['model']],'as':_0x152cfc['as'],'attributes':_0x152cfc['attributes'],'include':_0x152cfc[_0x457d('0x1f')]?_['map'](_0x152cfc[_0x457d('0x1f')],function(_0x21a102){return{'model':db[_0x21a102[_0x457d('0x20')]],'as':_0x21a102['as'],'attributes':_0x21a102[_0x457d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x298dd4){logger['info']('GetSalesforceAccount',_0x4d988f);logger[_0x457d('0xf')](_0x457d('0x19'),_0x4d988f,JSON['stringify'](_0x298dd4));_0x802f2b(_0x298dd4);})[_0x457d('0x18')](function(_0x2d69d2){logger['error'](_0x457d('0x19'),_0x2d69d2[_0x457d('0x16')],_0x4d988f);_0x50e78f(_0x151416[_0x457d('0x13')](0x1f4,_0x2d69d2[_0x457d('0x16')]));});});};exports[_0x457d('0x22')]=function(_0x1efd5f){var _0x397f54=this;return new Promise(function(_0x123b58,_0x272d40){return db[_0x457d('0x1a')][_0x457d('0x23')]({'raw':_0x1efd5f[_0x457d('0x1b')]?_0x1efd5f[_0x457d('0x1b')][_0x457d('0x1c')]===undefined?!![]:![]:!![],'where':_0x1efd5f[_0x457d('0x1b')]?_0x1efd5f[_0x457d('0x1b')][_0x457d('0x1d')]||null:null,'attributes':_0x1efd5f[_0x457d('0x1b')]?_0x1efd5f['options'][_0x457d('0x1e')]||null:null,'include':_0x1efd5f[_0x457d('0x1b')]?_0x1efd5f['options']['include']?_[_0x457d('0x21')](_0x1efd5f[_0x457d('0x1b')]['include'],function(_0x306ece){return{'model':db[_0x306ece[_0x457d('0x20')]],'as':_0x306ece['as'],'attributes':_0x306ece[_0x457d('0x1e')],'include':_0x306ece[_0x457d('0x1f')]?_[_0x457d('0x21')](_0x306ece[_0x457d('0x1f')],function(_0x17f011){return{'model':db[_0x17f011[_0x457d('0x20')]],'as':_0x17f011['as'],'attributes':_0x17f011[_0x457d('0x1e')],'include':_0x17f011[_0x457d('0x1f')]?_[_0x457d('0x21')](_0x17f011[_0x457d('0x1f')],function(_0x237be1){return{'model':db[_0x237be1[_0x457d('0x20')]],'as':_0x237be1['as'],'attributes':_0x237be1[_0x457d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27811b){logger['info']('ShowSalesforceAccount',_0x1efd5f);logger['debug'](_0x457d('0x22'),_0x1efd5f,JSON['stringify'](_0x27811b));_0x123b58(_0x27811b);})[_0x457d('0x18')](function(_0x55e580){logger['error'](_0x457d('0x22'),_0x55e580[_0x457d('0x16')],_0x1efd5f);_0x272d40(_0x397f54[_0x457d('0x13')](0x1f4,_0x55e580[_0x457d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index af87d1f..a68b7aa 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 _0xbf48=['/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','post','put'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xbf48,0x1e7));var _0x8bf4=function(_0x367caa,_0x3bf1c2){_0x367caa=_0x367caa-0x0;var _0x521513=_0xbf48[_0x367caa];return _0x521513;};'use strict';var multer=require(_0x8bf4('0x0'));var util=require(_0x8bf4('0x1'));var path=require(_0x8bf4('0x2'));var timeout=require(_0x8bf4('0x3'));var express=require(_0x8bf4('0x4'));var router=express['Router']();var fs_extra=require(_0x8bf4('0x5'));var auth=require(_0x8bf4('0x6'));var interaction=require(_0x8bf4('0x7'));var config=require(_0x8bf4('0x8'));var controller=require(_0x8bf4('0x9'));router[_0x8bf4('0xa')]('/',auth[_0x8bf4('0xb')](),controller[_0x8bf4('0xc')]);router[_0x8bf4('0xa')]('/:id',auth[_0x8bf4('0xb')](),controller[_0x8bf4('0xd')]);router['get'](_0x8bf4('0xe'),auth[_0x8bf4('0xb')](),controller[_0x8bf4('0xf')]);router[_0x8bf4('0xa')]('/:id/subjects',auth[_0x8bf4('0xb')](),controller[_0x8bf4('0x10')]);router['get']('/:id/descriptions',auth[_0x8bf4('0xb')](),controller['getDescriptions']);router[_0x8bf4('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8bf4('0x12')](_0x8bf4('0x13'),auth[_0x8bf4('0xb')](),controller[_0x8bf4('0x14')]);router[_0x8bf4('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8bf4('0x16')]);module['exports']=router; \ No newline at end of file +var _0x27d9=['create','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x360808,_0x38982d){var _0x5b02a1=function(_0x200fd5){while(--_0x200fd5){_0x360808['push'](_0x360808['shift']());}};_0x5b02a1(++_0x38982d);}(_0x27d9,0x65));var _0x927d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x27d9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x927d('0x0'));var path=require(_0x927d('0x1'));var timeout=require('connect-timeout');var express=require(_0x927d('0x2'));var router=express[_0x927d('0x3')]();var fs_extra=require(_0x927d('0x4'));var auth=require(_0x927d('0x5'));var interaction=require(_0x927d('0x6'));var config=require(_0x927d('0x7'));var controller=require('./intSalesforceConfiguration.controller');router['get']('/',auth[_0x927d('0x8')](),controller['index']);router['get'](_0x927d('0x9'),auth[_0x927d('0x8')](),controller[_0x927d('0xa')]);router[_0x927d('0xb')](_0x927d('0xc'),auth[_0x927d('0x8')](),controller[_0x927d('0xd')]);router['get'](_0x927d('0xe'),auth[_0x927d('0x8')](),controller[_0x927d('0xf')]);router[_0x927d('0xb')](_0x927d('0x10'),auth[_0x927d('0x8')](),controller[_0x927d('0x11')]);router[_0x927d('0x12')]('/',auth['isAuthenticated'](),controller[_0x927d('0x13')]);router[_0x927d('0x14')](_0x927d('0x9'),auth[_0x927d('0x8')](),controller['update']);router[_0x927d('0x15')](_0x927d('0x9'),auth[_0x927d('0x8')](),controller[_0x927d('0x16')]);module[_0x927d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 1e7f2c5..3b03609 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 _0x3124=['Case','contact_lead','contact','lead','nothing','STRING','ENUM','Task'];(function(_0x3d7444,_0xadd16e){var _0xb20c74=function(_0x37e764){while(--_0x37e764){_0x3d7444['push'](_0x3d7444['shift']());}};_0xb20c74(++_0xadd16e);}(_0x3124,0x15d));var _0x4312=function(_0x5b692c,_0x281ad7){_0x5b692c=_0x5b692c-0x0;var _0x347c25=_0x3124[_0x5b692c];return _0x347c25;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4312('0x0')]},'description':{'type':Sequelize[_0x4312('0x0')]},'ticketType':{'type':Sequelize[_0x4312('0x1')](_0x4312('0x2'),_0x4312('0x3')),'defaultValue':_0x4312('0x2')},'moduleSearch':{'type':Sequelize[_0x4312('0x1')](_0x4312('0x4'),_0x4312('0x5'),_0x4312('0x6')),'defaultValue':_0x4312('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x4312('0x7'),_0x4312('0x5'),_0x4312('0x6')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1b91=['sequelize','exports','STRING','Task','Case','ENUM','contact_lead','contact','lead'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0x1b91,0x171));var _0x11b9=function(_0x33b0a1,_0x27496e){_0x33b0a1=_0x33b0a1-0x0;var _0x15eb1f=_0x1b91[_0x33b0a1];return _0x15eb1f;};'use strict';var Sequelize=require(_0x11b9('0x0'));module[_0x11b9('0x1')]={'name':{'type':Sequelize[_0x11b9('0x2')]},'description':{'type':Sequelize[_0x11b9('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x11b9('0x3'),_0x11b9('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x11b9('0x5')](_0x11b9('0x6'),_0x11b9('0x7'),_0x11b9('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x11b9('0x5')]('nothing',_0x11b9('0x7'),_0x11b9('0x8')),'defaultValue':_0x11b9('0x8')},'leadId':{'type':Sequelize[_0x11b9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index f584f3c..cfc21c3 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 _0x4497=['getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','type','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','SalesforceConfiguration','findAll','rows','show','params','options','find','create','body','getFields','findOne','order','getSubjects','SalesforceField'];(function(_0x3ecadc,_0x88fad3){var _0x3d5b07=function(_0x2ab621){while(--_0x2ab621){_0x3ecadc['push'](_0x3ecadc['shift']());}};_0x3d5b07(++_0x88fad3);}(_0x4497,0x16d));var _0x7449=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x4497[_0x4ab3fb];return _0x34fe1e;};'use strict';var pdf=require(_0x7449('0x0'));var emlformat=require(_0x7449('0x1'));var rimraf=require(_0x7449('0x2'));var zipdir=require(_0x7449('0x3'));var jsonpatch=require(_0x7449('0x4'));var rp=require(_0x7449('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7449('0x6'));var util=require(_0x7449('0x7'));var path=require(_0x7449('0x8'));var sox=require(_0x7449('0x9'));var csv=require(_0x7449('0xa'));var ejs=require(_0x7449('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7449('0xc'));var squel=require(_0x7449('0xd'));var crypto=require('crypto');var jsforce=require(_0x7449('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7449('0xa'));var querystring=require('querystring');var Papa=require(_0x7449('0xf'));var Redis=require(_0x7449('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7449('0x11'));var as=require(_0x7449('0x12'));var hardwareService=require(_0x7449('0x13'));var logger=require('../../config/logger')(_0x7449('0x14'));var utils=require(_0x7449('0x15'));var config=require(_0x7449('0x16'));var licenseUtil=require(_0x7449('0x17'));var db=require(_0x7449('0x18'))['db'];var jayson=require(_0x7449('0x19'));var client=jayson[_0x7449('0x1a')][_0x7449('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x560d92,_0x41eb4c,_0x2e9b4d,_0xd454d0){return new BPromise(function(_0x5d3d40,_0x304f93){var _0x56138d=_0xd454d0||client;return _0x56138d['request'](_0x560d92,_0x2e9b4d)['then'](function(_0x480c90){logger[_0x7449('0x1c')](_0x7449('0x1d'),_0x41eb4c,_0x7449('0x1e'));logger[_0x7449('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x41eb4c,_0x7449('0x1e'),JSON[_0x7449('0x20')](_0x480c90));if(_0x480c90[_0x7449('0x21')]){if(_0x480c90[_0x7449('0x21')][_0x7449('0x22')]===0x1f4){logger['error'](_0x7449('0x1d'),_0x41eb4c,_0x480c90[_0x7449('0x21')][_0x7449('0x23')]);return _0x304f93(_0x480c90[_0x7449('0x21')][_0x7449('0x23')]);}logger[_0x7449('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x41eb4c,_0x480c90[_0x7449('0x21')][_0x7449('0x23')]);return _0x5d3d40(_0x480c90[_0x7449('0x21')][_0x7449('0x23')]);}else{logger[_0x7449('0x1c')](_0x7449('0x1d'),_0x41eb4c,_0x7449('0x1e'));_0x5d3d40(_0x480c90[_0x7449('0x24')][_0x7449('0x23')]);}})[_0x7449('0x25')](function(_0x903d81){logger[_0x7449('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x41eb4c,_0x903d81);_0x304f93(_0x903d81);});});}function respondWithStatusCode(_0xb6ce18,_0x138274){_0x138274=_0x138274||0xcc;return function(_0x90f58c){if(_0x90f58c){return _0xb6ce18[_0x7449('0x26')](_0x138274);}return _0xb6ce18['status'](_0x138274)[_0x7449('0x27')]();};}function respondWithResult(_0x465d16,_0x40f64d){_0x40f64d=_0x40f64d||0xc8;return function(_0x1b7335){if(_0x1b7335){return _0x465d16[_0x7449('0x28')](_0x40f64d)[_0x7449('0x29')](_0x1b7335);}};}function respondWithFilteredResult(_0x5ed262,_0x511eb1){return function(_0x259e55){if(_0x259e55){var _0x2215ac=_0x259e55[_0x7449('0x2a')],_0x3de861=_0x511eb1[_0x7449('0x2b')],_0x57a924=_0x511eb1[_0x7449('0x2b')]+_0x511eb1[_0x7449('0x2c')],_0x5d84f3;if(_0x57a924>=_0x2215ac){_0x57a924=_0x2215ac;_0x5d84f3=0xc8;}else{_0x5d84f3=0xce;}_0x5ed262[_0x7449('0x28')](_0x5d84f3);return _0x5ed262['set'](_0x7449('0x2d'),_0x3de861+'-'+_0x57a924+'/'+_0x2215ac)['json'](_0x259e55);}return null;};}function patchUpdates(_0x47b9f2){return function(_0x4c7da7){try{jsonpatch[_0x7449('0x2e')](_0x4c7da7,_0x47b9f2,!![]);}catch(_0x2551b2){return BPromise[_0x7449('0x2f')](_0x2551b2);}return _0x4c7da7[_0x7449('0x30')]();};}function saveUpdates(_0x129233,_0x2d5940){return function(_0x437e12){if(_0x437e12){return _0x437e12[_0x7449('0x31')](_0x129233)[_0x7449('0x32')](function(_0x30adda){return _0x30adda;});}return null;};}function removeEntity(_0x5bffc5,_0x1ea745){return function(_0x444c70){if(_0x444c70){return _0x444c70[_0x7449('0x33')]()[_0x7449('0x32')](function(){_0x5bffc5['status'](0xcc)[_0x7449('0x27')]();});}};}function handleEntityNotFound(_0x25b915,_0x2da117){return function(_0x31d90d){if(!_0x31d90d){_0x25b915[_0x7449('0x26')](0x194);}return _0x31d90d;};}function handleError(_0x2fba30,_0x4f5a27){_0x4f5a27=_0x4f5a27||0x1f4;return function(_0x19a5ca){logger[_0x7449('0x21')](_0x19a5ca[_0x7449('0x34')]);if(_0x19a5ca[_0x7449('0x35')]){delete _0x19a5ca[_0x7449('0x35')];}_0x2fba30[_0x7449('0x28')](_0x4f5a27)[_0x7449('0x36')](_0x19a5ca);};}exports['index']=function(_0x5b47ee,_0x3cd23c){var _0x2bc0ee={},_0x2660ce={},_0xb07ced={'count':0x0,'rows':[]};var _0x29fbe5=_['map'](db['SalesforceConfiguration'][_0x7449('0x37')],function(_0x4d5560){return{'name':_0x4d5560['fieldName'],'type':_0x4d5560[_0x7449('0x38')]['key']};});_0x2660ce[_0x7449('0x39')]=_[_0x7449('0x3a')](_0x29fbe5,_0x7449('0x35'));_0x2660ce[_0x7449('0x3b')]=_[_0x7449('0x3c')](_0x5b47ee[_0x7449('0x3b')]);_0x2660ce[_0x7449('0x3d')]=_[_0x7449('0x3e')](_0x2660ce[_0x7449('0x39')],_0x2660ce[_0x7449('0x3b')]);_0x2bc0ee['attributes']=_['intersection'](_0x2660ce[_0x7449('0x39')],qs[_0x7449('0x3f')](_0x5b47ee[_0x7449('0x3b')][_0x7449('0x3f')]));_0x2bc0ee['attributes']=_0x2bc0ee['attributes'][_0x7449('0x40')]?_0x2bc0ee[_0x7449('0x41')]:_0x2660ce['model'];if(!_0x5b47ee[_0x7449('0x3b')][_0x7449('0x42')](_0x7449('0x43'))){_0x2bc0ee[_0x7449('0x2c')]=qs[_0x7449('0x2c')](_0x5b47ee[_0x7449('0x3b')]['limit']);_0x2bc0ee[_0x7449('0x2b')]=qs['offset'](_0x5b47ee[_0x7449('0x3b')]['offset']);}_0x2bc0ee['order']=qs[_0x7449('0x44')](_0x5b47ee[_0x7449('0x3b')][_0x7449('0x44')]);_0x2bc0ee['where']=qs['filters'](_[_0x7449('0x45')](_0x5b47ee['query'],_0x2660ce[_0x7449('0x3d')]),_0x29fbe5);if(_0x5b47ee[_0x7449('0x3b')][_0x7449('0x46')]){_0x2bc0ee[_0x7449('0x47')]=_[_0x7449('0x48')](_0x2bc0ee[_0x7449('0x47')],{'$or':_[_0x7449('0x3a')](_0x29fbe5,function(_0x55d205){if(_0x55d205[_0x7449('0x38')]!==_0x7449('0x49')){var _0x180b03={};_0x180b03[_0x55d205[_0x7449('0x35')]]={'$like':'%'+_0x5b47ee[_0x7449('0x3b')]['filter']+'%'};return _0x180b03;}})});}_0x2bc0ee=_['merge']({},_0x2bc0ee,_0x5b47ee['options']);var _0x493ffd={'where':_0x2bc0ee['where']};return db['SalesforceConfiguration'][_0x7449('0x2a')](_0x493ffd)[_0x7449('0x32')](function(_0x1fb8e1){_0xb07ced[_0x7449('0x2a')]=_0x1fb8e1;if(_0x5b47ee[_0x7449('0x3b')][_0x7449('0x4a')]){_0x2bc0ee[_0x7449('0x4b')]=[{'all':!![]}];}return db[_0x7449('0x4c')][_0x7449('0x4d')](_0x2bc0ee);})[_0x7449('0x32')](function(_0x171581){_0xb07ced[_0x7449('0x4e')]=_0x171581;return _0xb07ced;})[_0x7449('0x32')](respondWithFilteredResult(_0x3cd23c,_0x2bc0ee))[_0x7449('0x25')](handleError(_0x3cd23c,null));};exports[_0x7449('0x4f')]=function(_0x56c6ff,_0x47a303){var _0x181d54={'raw':![],'where':{'id':_0x56c6ff[_0x7449('0x50')]['id']}},_0x2eab1f={};_0x2eab1f['model']=_[_0x7449('0x3c')](db[_0x7449('0x4c')][_0x7449('0x37')]);_0x2eab1f[_0x7449('0x3b')]=_['keys'](_0x56c6ff['query']);_0x2eab1f[_0x7449('0x3d')]=_['intersection'](_0x2eab1f[_0x7449('0x39')],_0x2eab1f[_0x7449('0x3b')]);_0x181d54[_0x7449('0x41')]=_[_0x7449('0x3e')](_0x2eab1f[_0x7449('0x39')],qs[_0x7449('0x3f')](_0x56c6ff[_0x7449('0x3b')]['fields']));_0x181d54['attributes']=_0x181d54[_0x7449('0x41')][_0x7449('0x40')]?_0x181d54[_0x7449('0x41')]:_0x2eab1f[_0x7449('0x39')];if(_0x56c6ff[_0x7449('0x3b')]['includeAll']){_0x181d54['include']=[{'all':!![]}];}_0x181d54=_[_0x7449('0x48')]({},_0x181d54,_0x56c6ff[_0x7449('0x51')]);return db[_0x7449('0x4c')][_0x7449('0x52')](_0x181d54)[_0x7449('0x32')](handleEntityNotFound(_0x47a303,null))[_0x7449('0x32')](respondWithResult(_0x47a303,null))['catch'](handleError(_0x47a303,null));};exports[_0x7449('0x53')]=function(_0x1cb76f,_0x43ad28){return db[_0x7449('0x4c')][_0x7449('0x53')](_0x1cb76f['body'],{})[_0x7449('0x32')](respondWithResult(_0x43ad28,0xc9))[_0x7449('0x25')](handleError(_0x43ad28,null));};exports['update']=function(_0x6e7dc3,_0x2db2a5){if(_0x6e7dc3['body']['id']){delete _0x6e7dc3[_0x7449('0x54')]['id'];}return db[_0x7449('0x4c')]['find']({'where':{'id':_0x6e7dc3[_0x7449('0x50')]['id']}})['then'](handleEntityNotFound(_0x2db2a5,null))[_0x7449('0x32')](saveUpdates(_0x6e7dc3['body'],null))[_0x7449('0x32')](respondWithResult(_0x2db2a5,null))[_0x7449('0x25')](handleError(_0x2db2a5,null));};exports['destroy']=function(_0x1f8100,_0x4ef66c){return db[_0x7449('0x4c')][_0x7449('0x52')]({'where':{'id':_0x1f8100['params']['id']}})[_0x7449('0x32')](handleEntityNotFound(_0x4ef66c,null))[_0x7449('0x32')](removeEntity(_0x4ef66c,null))[_0x7449('0x25')](handleError(_0x4ef66c,null));};exports[_0x7449('0x55')]=function(_0x2ccdd8,_0x5cf595,_0x49d97f){var _0xc768f8={};var _0x3899f3={};var _0x58a71a;var _0x438ee3;return db[_0x7449('0x4c')][_0x7449('0x56')]({'where':{'id':_0x2ccdd8[_0x7449('0x50')]['id']}})['then'](handleEntityNotFound(_0x5cf595,null))[_0x7449('0x32')](function(_0x40f07f){if(_0x40f07f){_0x58a71a=_0x40f07f;_0x3899f3['model']=_['keys'](db['SalesforceField']['rawAttributes']);_0x3899f3['query']=_[_0x7449('0x3c')](_0x2ccdd8[_0x7449('0x3b')]);_0x3899f3[_0x7449('0x3d')]=_[_0x7449('0x3e')](_0x3899f3[_0x7449('0x39')],_0x3899f3[_0x7449('0x3b')]);_0xc768f8[_0x7449('0x41')]=_['intersection'](_0x3899f3[_0x7449('0x39')],qs[_0x7449('0x3f')](_0x2ccdd8[_0x7449('0x3b')][_0x7449('0x3f')]));_0xc768f8[_0x7449('0x41')]=_0xc768f8[_0x7449('0x41')]['length']?_0xc768f8[_0x7449('0x41')]:_0x3899f3[_0x7449('0x39')];_0xc768f8[_0x7449('0x57')]=qs[_0x7449('0x44')](_0x2ccdd8[_0x7449('0x3b')]['sort']);_0xc768f8[_0x7449('0x47')]=qs[_0x7449('0x3d')](_[_0x7449('0x45')](_0x2ccdd8[_0x7449('0x3b')],_0x3899f3['filters']));if(_0x2ccdd8[_0x7449('0x3b')][_0x7449('0x46')]){_0xc768f8[_0x7449('0x47')]=_[_0x7449('0x48')](_0xc768f8[_0x7449('0x47')],{'$or':_['map'](_0xc768f8['attributes'],function(_0x34503a){var _0x3a1f49={};_0x3a1f49[_0x34503a]={'$like':'%'+_0x2ccdd8[_0x7449('0x3b')][_0x7449('0x46')]+'%'};return _0x3a1f49;})});}_0xc768f8=_[_0x7449('0x48')]({},_0xc768f8,_0x2ccdd8[_0x7449('0x51')]);return _0x58a71a[_0x7449('0x55')](_0xc768f8);}})[_0x7449('0x32')](function(_0x3dc024){if(_0x3dc024){_0x438ee3=_0x3dc024[_0x7449('0x40')];if(!_0x2ccdd8[_0x7449('0x3b')][_0x7449('0x42')](_0x7449('0x43'))){_0xc768f8['limit']=qs[_0x7449('0x2c')](_0x2ccdd8[_0x7449('0x3b')][_0x7449('0x2c')]);_0xc768f8[_0x7449('0x2b')]=qs[_0x7449('0x2b')](_0x2ccdd8[_0x7449('0x3b')]['offset']);}return _0x58a71a[_0x7449('0x55')](_0xc768f8);}})[_0x7449('0x32')](function(_0x456830){if(_0x456830){return _0x456830?{'count':_0x438ee3,'rows':_0x456830}:null;}})[_0x7449('0x32')](respondWithResult(_0x5cf595,null))[_0x7449('0x25')](handleError(_0x5cf595,null));};exports[_0x7449('0x58')]=function(_0x26c489,_0x39d50f,_0x32d955){var _0x11160e={};var _0x521b92={};var _0x231819;var _0x539044;return db['SalesforceConfiguration'][_0x7449('0x56')]({'where':{'id':_0x26c489[_0x7449('0x50')]['id']}})['then'](handleEntityNotFound(_0x39d50f,null))[_0x7449('0x32')](function(_0x4b3241){if(_0x4b3241){_0x231819=_0x4b3241;_0x521b92['model']=_['keys'](db[_0x7449('0x59')]['rawAttributes']);_0x521b92[_0x7449('0x3b')]=_[_0x7449('0x3c')](_0x26c489['query']);_0x521b92['filters']=_[_0x7449('0x3e')](_0x521b92['model'],_0x521b92['query']);_0x11160e[_0x7449('0x41')]=_[_0x7449('0x3e')](_0x521b92['model'],qs[_0x7449('0x3f')](_0x26c489[_0x7449('0x3b')][_0x7449('0x3f')]));_0x11160e[_0x7449('0x41')]=_0x11160e[_0x7449('0x41')][_0x7449('0x40')]?_0x11160e[_0x7449('0x41')]:_0x521b92[_0x7449('0x39')];_0x11160e['order']=qs[_0x7449('0x44')](_0x26c489[_0x7449('0x3b')][_0x7449('0x44')]);_0x11160e[_0x7449('0x47')]=qs[_0x7449('0x3d')](_[_0x7449('0x45')](_0x26c489['query'],_0x521b92[_0x7449('0x3d')]));if(_0x26c489['query'][_0x7449('0x46')]){_0x11160e[_0x7449('0x47')]=_[_0x7449('0x48')](_0x11160e[_0x7449('0x47')],{'$or':_['map'](_0x11160e['attributes'],function(_0x271d20){var _0x523adc={};_0x523adc[_0x271d20]={'$like':'%'+_0x26c489[_0x7449('0x3b')][_0x7449('0x46')]+'%'};return _0x523adc;})});}_0x11160e=_[_0x7449('0x48')]({},_0x11160e,_0x26c489[_0x7449('0x51')]);return _0x231819[_0x7449('0x58')](_0x11160e);}})[_0x7449('0x32')](function(_0x1e34f5){if(_0x1e34f5){_0x539044=_0x1e34f5['length'];if(!_0x26c489[_0x7449('0x3b')]['hasOwnProperty'](_0x7449('0x43'))){_0x11160e[_0x7449('0x2c')]=qs[_0x7449('0x2c')](_0x26c489[_0x7449('0x3b')]['limit']);_0x11160e[_0x7449('0x2b')]=qs[_0x7449('0x2b')](_0x26c489[_0x7449('0x3b')]['offset']);}return _0x231819[_0x7449('0x58')](_0x11160e);}})[_0x7449('0x32')](function(_0xf4d4ce){if(_0xf4d4ce){return _0xf4d4ce?{'count':_0x539044,'rows':_0xf4d4ce}:null;}})[_0x7449('0x32')](respondWithResult(_0x39d50f,null))[_0x7449('0x25')](handleError(_0x39d50f,null));};exports['getDescriptions']=function(_0x15587e,_0xdfe286,_0x432bfc){var _0x49558f={};var _0x2e6dcf={};var _0x4fbea1;var _0x54a6e1;return db[_0x7449('0x4c')]['findOne']({'where':{'id':_0x15587e[_0x7449('0x50')]['id']}})['then'](handleEntityNotFound(_0xdfe286,null))['then'](function(_0x4c2b45){if(_0x4c2b45){_0x4fbea1=_0x4c2b45;_0x2e6dcf['model']=_[_0x7449('0x3c')](db[_0x7449('0x59')][_0x7449('0x37')]);_0x2e6dcf[_0x7449('0x3b')]=_[_0x7449('0x3c')](_0x15587e[_0x7449('0x3b')]);_0x2e6dcf[_0x7449('0x3d')]=_[_0x7449('0x3e')](_0x2e6dcf[_0x7449('0x39')],_0x2e6dcf[_0x7449('0x3b')]);_0x49558f['attributes']=_[_0x7449('0x3e')](_0x2e6dcf[_0x7449('0x39')],qs['fields'](_0x15587e[_0x7449('0x3b')][_0x7449('0x3f')]));_0x49558f[_0x7449('0x41')]=_0x49558f[_0x7449('0x41')][_0x7449('0x40')]?_0x49558f[_0x7449('0x41')]:_0x2e6dcf[_0x7449('0x39')];_0x49558f[_0x7449('0x57')]=qs[_0x7449('0x44')](_0x15587e['query'][_0x7449('0x44')]);_0x49558f[_0x7449('0x47')]=qs[_0x7449('0x3d')](_[_0x7449('0x45')](_0x15587e[_0x7449('0x3b')],_0x2e6dcf['filters']));if(_0x15587e[_0x7449('0x3b')]['filter']){_0x49558f[_0x7449('0x47')]=_[_0x7449('0x48')](_0x49558f[_0x7449('0x47')],{'$or':_['map'](_0x49558f['attributes'],function(_0x3213d0){var _0x4eef43={};_0x4eef43[_0x3213d0]={'$like':'%'+_0x15587e[_0x7449('0x3b')][_0x7449('0x46')]+'%'};return _0x4eef43;})});}_0x49558f=_[_0x7449('0x48')]({},_0x49558f,_0x15587e[_0x7449('0x51')]);return _0x4fbea1['getDescriptions'](_0x49558f);}})['then'](function(_0xd44b87){if(_0xd44b87){_0x54a6e1=_0xd44b87[_0x7449('0x40')];if(!_0x15587e[_0x7449('0x3b')][_0x7449('0x42')]('nolimit')){_0x49558f[_0x7449('0x2c')]=qs[_0x7449('0x2c')](_0x15587e[_0x7449('0x3b')][_0x7449('0x2c')]);_0x49558f['offset']=qs[_0x7449('0x2b')](_0x15587e['query']['offset']);}return _0x4fbea1[_0x7449('0x5a')](_0x49558f);}})[_0x7449('0x32')](function(_0x2b754b){if(_0x2b754b){return _0x2b754b?{'count':_0x54a6e1,'rows':_0x2b754b}:null;}})['then'](respondWithResult(_0xdfe286,null))[_0x7449('0x25')](handleError(_0xdfe286,null));}; \ No newline at end of file +var _0x129a=['model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','merge','find','create','body','findOne','SalesforceField','getFields','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','SalesforceConfiguration','fieldName','type','key','keys','query','filters','intersection'];(function(_0x240193,_0x2d31f6){var _0x5c6b7e=function(_0x68e765){while(--_0x68e765){_0x240193['push'](_0x240193['shift']());}};_0x5c6b7e(++_0x2d31f6);}(_0x129a,0x134));var _0xa129=function(_0x5dcc52,_0x32ca74){_0x5dcc52=_0x5dcc52-0x0;var _0x20573b=_0x129a[_0x5dcc52];return _0x20573b;};'use strict';var pdf=require(_0xa129('0x0'));var emlformat=require(_0xa129('0x1'));var rimraf=require(_0xa129('0x2'));var zipdir=require(_0xa129('0x3'));var jsonpatch=require(_0xa129('0x4'));var rp=require(_0xa129('0x5'));var moment=require(_0xa129('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa129('0x7'));var path=require(_0xa129('0x8'));var sox=require('sox');var csv=require(_0xa129('0x9'));var ejs=require(_0xa129('0xa'));var fs=require('fs');var fs_extra=require(_0xa129('0xb'));var _=require('lodash');var squel=require(_0xa129('0xc'));var crypto=require(_0xa129('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa129('0xe'));var Papa=require(_0xa129('0xf'));var Redis=require('ioredis');var authService=require(_0xa129('0x10'));var qs=require(_0xa129('0x11'));var as=require(_0xa129('0x12'));var hardwareService=require(_0xa129('0x13'));var logger=require(_0xa129('0x14'))('api');var utils=require(_0xa129('0x15'));var config=require(_0xa129('0x16'));var licenseUtil=require(_0xa129('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa129('0x18'));var client=jayson[_0xa129('0x19')][_0xa129('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5fc305,_0xe5a0fd,_0x5148b9,_0x1dd1f4){return new BPromise(function(_0x36bb59,_0x2f4d10){var _0x2d58f3=_0x1dd1f4||client;return _0x2d58f3[_0xa129('0x1b')](_0x5fc305,_0x5148b9)[_0xa129('0x1c')](function(_0xd70da5){logger[_0xa129('0x1d')](_0xa129('0x1e'),_0xe5a0fd,_0xa129('0x1f'));logger['debug'](_0xa129('0x20'),_0xe5a0fd,_0xa129('0x1f'),JSON[_0xa129('0x21')](_0xd70da5));if(_0xd70da5[_0xa129('0x22')]){if(_0xd70da5[_0xa129('0x22')]['code']===0x1f4){logger[_0xa129('0x22')](_0xa129('0x1e'),_0xe5a0fd,_0xd70da5[_0xa129('0x22')][_0xa129('0x23')]);return _0x2f4d10(_0xd70da5[_0xa129('0x22')]['message']);}logger[_0xa129('0x22')]('SalesforceConfiguration,\x20%s,\x20%s',_0xe5a0fd,_0xd70da5['error'][_0xa129('0x23')]);return _0x36bb59(_0xd70da5[_0xa129('0x22')][_0xa129('0x23')]);}else{logger[_0xa129('0x1d')](_0xa129('0x1e'),_0xe5a0fd,'request\x20sent');_0x36bb59(_0xd70da5[_0xa129('0x24')][_0xa129('0x23')]);}})[_0xa129('0x25')](function(_0x390f94){logger[_0xa129('0x22')](_0xa129('0x1e'),_0xe5a0fd,_0x390f94);_0x2f4d10(_0x390f94);});});}function respondWithStatusCode(_0x29bbd8,_0x300123){_0x300123=_0x300123||0xcc;return function(_0x576b51){if(_0x576b51){return _0x29bbd8[_0xa129('0x26')](_0x300123);}return _0x29bbd8[_0xa129('0x27')](_0x300123)[_0xa129('0x28')]();};}function respondWithResult(_0x28e3a1,_0x1e4a83){_0x1e4a83=_0x1e4a83||0xc8;return function(_0x196dc4){if(_0x196dc4){return _0x28e3a1['status'](_0x1e4a83)[_0xa129('0x29')](_0x196dc4);}};}function respondWithFilteredResult(_0x1abde6,_0x55aeb6){return function(_0x5367aa){if(_0x5367aa){var _0x3710ea=_0x5367aa[_0xa129('0x2a')],_0x5028fe=_0x55aeb6[_0xa129('0x2b')],_0x24389f=_0x55aeb6['offset']+_0x55aeb6[_0xa129('0x2c')],_0x23f881;if(_0x24389f>=_0x3710ea){_0x24389f=_0x3710ea;_0x23f881=0xc8;}else{_0x23f881=0xce;}_0x1abde6[_0xa129('0x27')](_0x23f881);return _0x1abde6[_0xa129('0x2d')](_0xa129('0x2e'),_0x5028fe+'-'+_0x24389f+'/'+_0x3710ea)[_0xa129('0x29')](_0x5367aa);}return null;};}function patchUpdates(_0xec65b9){return function(_0x4a9295){try{jsonpatch[_0xa129('0x2f')](_0x4a9295,_0xec65b9,!![]);}catch(_0x29ee24){return BPromise[_0xa129('0x30')](_0x29ee24);}return _0x4a9295[_0xa129('0x31')]();};}function saveUpdates(_0x48559e,_0x20604f){return function(_0x2643d4){if(_0x2643d4){return _0x2643d4[_0xa129('0x32')](_0x48559e)['then'](function(_0x352677){return _0x352677;});}return null;};}function removeEntity(_0x5278b5,_0x4fa79b){return function(_0x3c69dd){if(_0x3c69dd){return _0x3c69dd[_0xa129('0x33')]()[_0xa129('0x1c')](function(){_0x5278b5[_0xa129('0x27')](0xcc)[_0xa129('0x28')]();});}};}function handleEntityNotFound(_0x5350fa,_0x2fc8de){return function(_0x5818a3){if(!_0x5818a3){_0x5350fa[_0xa129('0x26')](0x194);}return _0x5818a3;};}function handleError(_0x176ce5,_0x3058d2){_0x3058d2=_0x3058d2||0x1f4;return function(_0x5d73e6){logger[_0xa129('0x22')](_0x5d73e6[_0xa129('0x34')]);if(_0x5d73e6[_0xa129('0x35')]){delete _0x5d73e6[_0xa129('0x35')];}_0x176ce5[_0xa129('0x27')](_0x3058d2)['send'](_0x5d73e6);};}exports[_0xa129('0x36')]=function(_0x473281,_0x558c88){var _0x5c8abf={},_0x145339={},_0x2c34a2={'count':0x0,'rows':[]};var _0x509a9e=_[_0xa129('0x37')](db[_0xa129('0x38')]['rawAttributes'],function(_0x4ed2ac){return{'name':_0x4ed2ac[_0xa129('0x39')],'type':_0x4ed2ac[_0xa129('0x3a')][_0xa129('0x3b')]};});_0x145339['model']=_[_0xa129('0x37')](_0x509a9e,_0xa129('0x35'));_0x145339['query']=_[_0xa129('0x3c')](_0x473281[_0xa129('0x3d')]);_0x145339[_0xa129('0x3e')]=_[_0xa129('0x3f')](_0x145339[_0xa129('0x40')],_0x145339[_0xa129('0x3d')]);_0x5c8abf[_0xa129('0x41')]=_['intersection'](_0x145339['model'],qs[_0xa129('0x42')](_0x473281['query'][_0xa129('0x42')]));_0x5c8abf[_0xa129('0x41')]=_0x5c8abf['attributes']['length']?_0x5c8abf[_0xa129('0x41')]:_0x145339[_0xa129('0x40')];if(!_0x473281['query'][_0xa129('0x43')]('nolimit')){_0x5c8abf[_0xa129('0x2c')]=qs[_0xa129('0x2c')](_0x473281[_0xa129('0x3d')][_0xa129('0x2c')]);_0x5c8abf[_0xa129('0x2b')]=qs[_0xa129('0x2b')](_0x473281[_0xa129('0x3d')][_0xa129('0x2b')]);}_0x5c8abf[_0xa129('0x44')]=qs[_0xa129('0x45')](_0x473281[_0xa129('0x3d')][_0xa129('0x45')]);_0x5c8abf[_0xa129('0x46')]=qs[_0xa129('0x3e')](_[_0xa129('0x47')](_0x473281[_0xa129('0x3d')],_0x145339['filters']),_0x509a9e);if(_0x473281[_0xa129('0x3d')][_0xa129('0x48')]){_0x5c8abf[_0xa129('0x46')]=_['merge'](_0x5c8abf[_0xa129('0x46')],{'$or':_[_0xa129('0x37')](_0x509a9e,function(_0x54a46f){if(_0x54a46f[_0xa129('0x3a')]!==_0xa129('0x49')){var _0x9efb39={};_0x9efb39[_0x54a46f[_0xa129('0x35')]]={'$like':'%'+_0x473281[_0xa129('0x3d')][_0xa129('0x48')]+'%'};return _0x9efb39;}})});}_0x5c8abf=_['merge']({},_0x5c8abf,_0x473281[_0xa129('0x4a')]);var _0x4d4a7d={'where':_0x5c8abf['where']};return db[_0xa129('0x38')]['count'](_0x4d4a7d)['then'](function(_0x54cb88){_0x2c34a2['count']=_0x54cb88;if(_0x473281[_0xa129('0x3d')][_0xa129('0x4b')]){_0x5c8abf[_0xa129('0x4c')]=[{'all':!![]}];}return db[_0xa129('0x38')][_0xa129('0x4d')](_0x5c8abf);})[_0xa129('0x1c')](function(_0x32eb0b){_0x2c34a2[_0xa129('0x4e')]=_0x32eb0b;return _0x2c34a2;})[_0xa129('0x1c')](respondWithFilteredResult(_0x558c88,_0x5c8abf))[_0xa129('0x25')](handleError(_0x558c88,null));};exports[_0xa129('0x4f')]=function(_0x5b0e42,_0x3fa22f){var _0xf17be0={'raw':![],'where':{'id':_0x5b0e42[_0xa129('0x50')]['id']}},_0xb9f372={};_0xb9f372[_0xa129('0x40')]=_[_0xa129('0x3c')](db[_0xa129('0x38')][_0xa129('0x51')]);_0xb9f372[_0xa129('0x3d')]=_['keys'](_0x5b0e42[_0xa129('0x3d')]);_0xb9f372[_0xa129('0x3e')]=_[_0xa129('0x3f')](_0xb9f372[_0xa129('0x40')],_0xb9f372['query']);_0xf17be0[_0xa129('0x41')]=_[_0xa129('0x3f')](_0xb9f372[_0xa129('0x40')],qs[_0xa129('0x42')](_0x5b0e42[_0xa129('0x3d')][_0xa129('0x42')]));_0xf17be0[_0xa129('0x41')]=_0xf17be0[_0xa129('0x41')][_0xa129('0x52')]?_0xf17be0[_0xa129('0x41')]:_0xb9f372[_0xa129('0x40')];if(_0x5b0e42[_0xa129('0x3d')][_0xa129('0x4b')]){_0xf17be0['include']=[{'all':!![]}];}_0xf17be0=_[_0xa129('0x53')]({},_0xf17be0,_0x5b0e42[_0xa129('0x4a')]);return db['SalesforceConfiguration'][_0xa129('0x54')](_0xf17be0)[_0xa129('0x1c')](handleEntityNotFound(_0x3fa22f,null))[_0xa129('0x1c')](respondWithResult(_0x3fa22f,null))[_0xa129('0x25')](handleError(_0x3fa22f,null));};exports[_0xa129('0x55')]=function(_0x357827,_0x385984){return db['SalesforceConfiguration'][_0xa129('0x55')](_0x357827[_0xa129('0x56')],{})[_0xa129('0x1c')](respondWithResult(_0x385984,0xc9))[_0xa129('0x25')](handleError(_0x385984,null));};exports[_0xa129('0x32')]=function(_0x4175da,_0x488193){if(_0x4175da[_0xa129('0x56')]['id']){delete _0x4175da[_0xa129('0x56')]['id'];}return db[_0xa129('0x38')][_0xa129('0x54')]({'where':{'id':_0x4175da['params']['id']}})[_0xa129('0x1c')](handleEntityNotFound(_0x488193,null))[_0xa129('0x1c')](saveUpdates(_0x4175da['body'],null))[_0xa129('0x1c')](respondWithResult(_0x488193,null))[_0xa129('0x25')](handleError(_0x488193,null));};exports['destroy']=function(_0x233b92,_0x4f9bd3){return db[_0xa129('0x38')][_0xa129('0x54')]({'where':{'id':_0x233b92[_0xa129('0x50')]['id']}})[_0xa129('0x1c')](handleEntityNotFound(_0x4f9bd3,null))[_0xa129('0x1c')](removeEntity(_0x4f9bd3,null))[_0xa129('0x25')](handleError(_0x4f9bd3,null));};exports['getFields']=function(_0x4cdcbe,_0x1e17b6,_0x221a28){var _0x20582c={};var _0x4a5918={};var _0x445d89;var _0x1f072d;return db[_0xa129('0x38')][_0xa129('0x57')]({'where':{'id':_0x4cdcbe[_0xa129('0x50')]['id']}})[_0xa129('0x1c')](handleEntityNotFound(_0x1e17b6,null))[_0xa129('0x1c')](function(_0x17b237){if(_0x17b237){_0x445d89=_0x17b237;_0x4a5918[_0xa129('0x40')]=_['keys'](db[_0xa129('0x58')][_0xa129('0x51')]);_0x4a5918['query']=_[_0xa129('0x3c')](_0x4cdcbe[_0xa129('0x3d')]);_0x4a5918[_0xa129('0x3e')]=_[_0xa129('0x3f')](_0x4a5918[_0xa129('0x40')],_0x4a5918[_0xa129('0x3d')]);_0x20582c[_0xa129('0x41')]=_['intersection'](_0x4a5918[_0xa129('0x40')],qs[_0xa129('0x42')](_0x4cdcbe[_0xa129('0x3d')][_0xa129('0x42')]));_0x20582c[_0xa129('0x41')]=_0x20582c[_0xa129('0x41')][_0xa129('0x52')]?_0x20582c['attributes']:_0x4a5918[_0xa129('0x40')];_0x20582c['order']=qs['sort'](_0x4cdcbe[_0xa129('0x3d')][_0xa129('0x45')]);_0x20582c[_0xa129('0x46')]=qs[_0xa129('0x3e')](_[_0xa129('0x47')](_0x4cdcbe['query'],_0x4a5918[_0xa129('0x3e')]));if(_0x4cdcbe[_0xa129('0x3d')][_0xa129('0x48')]){_0x20582c[_0xa129('0x46')]=_['merge'](_0x20582c['where'],{'$or':_[_0xa129('0x37')](_0x20582c[_0xa129('0x41')],function(_0x276c64){var _0x42aca6={};_0x42aca6[_0x276c64]={'$like':'%'+_0x4cdcbe[_0xa129('0x3d')][_0xa129('0x48')]+'%'};return _0x42aca6;})});}_0x20582c=_[_0xa129('0x53')]({},_0x20582c,_0x4cdcbe[_0xa129('0x4a')]);return _0x445d89[_0xa129('0x59')](_0x20582c);}})[_0xa129('0x1c')](function(_0x2fd212){if(_0x2fd212){_0x1f072d=_0x2fd212['length'];if(!_0x4cdcbe[_0xa129('0x3d')][_0xa129('0x43')](_0xa129('0x5a'))){_0x20582c['limit']=qs['limit'](_0x4cdcbe[_0xa129('0x3d')][_0xa129('0x2c')]);_0x20582c['offset']=qs['offset'](_0x4cdcbe['query'][_0xa129('0x2b')]);}return _0x445d89['getFields'](_0x20582c);}})[_0xa129('0x1c')](function(_0xe4c733){if(_0xe4c733){return _0xe4c733?{'count':_0x1f072d,'rows':_0xe4c733}:null;}})[_0xa129('0x1c')](respondWithResult(_0x1e17b6,null))[_0xa129('0x25')](handleError(_0x1e17b6,null));};exports[_0xa129('0x5b')]=function(_0xa7634b,_0x50f97d,_0x1b00f5){var _0x556fb1={};var _0x54e0c1={};var _0x573260;var _0x405ac5;return db[_0xa129('0x38')]['findOne']({'where':{'id':_0xa7634b[_0xa129('0x50')]['id']}})[_0xa129('0x1c')](handleEntityNotFound(_0x50f97d,null))[_0xa129('0x1c')](function(_0xb7d07b){if(_0xb7d07b){_0x573260=_0xb7d07b;_0x54e0c1[_0xa129('0x40')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x54e0c1[_0xa129('0x3d')]=_['keys'](_0xa7634b[_0xa129('0x3d')]);_0x54e0c1[_0xa129('0x3e')]=_[_0xa129('0x3f')](_0x54e0c1['model'],_0x54e0c1[_0xa129('0x3d')]);_0x556fb1[_0xa129('0x41')]=_['intersection'](_0x54e0c1[_0xa129('0x40')],qs[_0xa129('0x42')](_0xa7634b[_0xa129('0x3d')][_0xa129('0x42')]));_0x556fb1[_0xa129('0x41')]=_0x556fb1['attributes'][_0xa129('0x52')]?_0x556fb1['attributes']:_0x54e0c1[_0xa129('0x40')];_0x556fb1['order']=qs[_0xa129('0x45')](_0xa7634b[_0xa129('0x3d')][_0xa129('0x45')]);_0x556fb1[_0xa129('0x46')]=qs['filters'](_[_0xa129('0x47')](_0xa7634b[_0xa129('0x3d')],_0x54e0c1['filters']));if(_0xa7634b['query'][_0xa129('0x48')]){_0x556fb1[_0xa129('0x46')]=_['merge'](_0x556fb1['where'],{'$or':_[_0xa129('0x37')](_0x556fb1[_0xa129('0x41')],function(_0x4b5f94){var _0x35750c={};_0x35750c[_0x4b5f94]={'$like':'%'+_0xa7634b['query'][_0xa129('0x48')]+'%'};return _0x35750c;})});}_0x556fb1=_[_0xa129('0x53')]({},_0x556fb1,_0xa7634b['options']);return _0x573260[_0xa129('0x5b')](_0x556fb1);}})[_0xa129('0x1c')](function(_0x4024c8){if(_0x4024c8){_0x405ac5=_0x4024c8['length'];if(!_0xa7634b[_0xa129('0x3d')]['hasOwnProperty'](_0xa129('0x5a'))){_0x556fb1[_0xa129('0x2c')]=qs[_0xa129('0x2c')](_0xa7634b[_0xa129('0x3d')]['limit']);_0x556fb1['offset']=qs['offset'](_0xa7634b[_0xa129('0x3d')][_0xa129('0x2b')]);}return _0x573260[_0xa129('0x5b')](_0x556fb1);}})[_0xa129('0x1c')](function(_0x5605ce){if(_0x5605ce){return _0x5605ce?{'count':_0x405ac5,'rows':_0x5605ce}:null;}})[_0xa129('0x1c')](respondWithResult(_0x50f97d,null))[_0xa129('0x25')](handleError(_0x50f97d,null));};exports[_0xa129('0x5c')]=function(_0x3ba52f,_0x541a77,_0x4aeaef){var _0x287be3={};var _0x372a48={};var _0x3c0c4c;var _0x41c001;return db[_0xa129('0x38')][_0xa129('0x57')]({'where':{'id':_0x3ba52f[_0xa129('0x50')]['id']}})[_0xa129('0x1c')](handleEntityNotFound(_0x541a77,null))[_0xa129('0x1c')](function(_0x3938c2){if(_0x3938c2){_0x3c0c4c=_0x3938c2;_0x372a48[_0xa129('0x40')]=_[_0xa129('0x3c')](db[_0xa129('0x58')][_0xa129('0x51')]);_0x372a48[_0xa129('0x3d')]=_[_0xa129('0x3c')](_0x3ba52f[_0xa129('0x3d')]);_0x372a48[_0xa129('0x3e')]=_[_0xa129('0x3f')](_0x372a48[_0xa129('0x40')],_0x372a48[_0xa129('0x3d')]);_0x287be3[_0xa129('0x41')]=_[_0xa129('0x3f')](_0x372a48[_0xa129('0x40')],qs['fields'](_0x3ba52f['query']['fields']));_0x287be3[_0xa129('0x41')]=_0x287be3['attributes'][_0xa129('0x52')]?_0x287be3['attributes']:_0x372a48['model'];_0x287be3[_0xa129('0x44')]=qs[_0xa129('0x45')](_0x3ba52f[_0xa129('0x3d')][_0xa129('0x45')]);_0x287be3[_0xa129('0x46')]=qs[_0xa129('0x3e')](_[_0xa129('0x47')](_0x3ba52f[_0xa129('0x3d')],_0x372a48[_0xa129('0x3e')]));if(_0x3ba52f[_0xa129('0x3d')][_0xa129('0x48')]){_0x287be3[_0xa129('0x46')]=_[_0xa129('0x53')](_0x287be3['where'],{'$or':_[_0xa129('0x37')](_0x287be3[_0xa129('0x41')],function(_0x26f900){var _0x3b7044={};_0x3b7044[_0x26f900]={'$like':'%'+_0x3ba52f[_0xa129('0x3d')][_0xa129('0x48')]+'%'};return _0x3b7044;})});}_0x287be3=_[_0xa129('0x53')]({},_0x287be3,_0x3ba52f[_0xa129('0x4a')]);return _0x3c0c4c[_0xa129('0x5c')](_0x287be3);}})['then'](function(_0x50f955){if(_0x50f955){_0x41c001=_0x50f955[_0xa129('0x52')];if(!_0x3ba52f['query']['hasOwnProperty']('nolimit')){_0x287be3['limit']=qs['limit'](_0x3ba52f[_0xa129('0x3d')][_0xa129('0x2c')]);_0x287be3[_0xa129('0x2b')]=qs['offset'](_0x3ba52f['query'][_0xa129('0x2b')]);}return _0x3c0c4c[_0xa129('0x5c')](_0x287be3);}})[_0xa129('0x1c')](function(_0x117f50){if(_0x117f50){return _0x117f50?{'count':_0x41c001,'rows':_0x117f50}:null;}})[_0xa129('0x1c')](respondWithResult(_0x541a77,null))['catch'](handleError(_0x541a77,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7761d3e..cf752d0 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 _0x28b5=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util'];(function(_0x2299a9,_0x5ab754){var _0x3b9ff9=function(_0x5d2203){while(--_0x5d2203){_0x2299a9['push'](_0x2299a9['shift']());}};_0x3b9ff9(++_0x5ab754);}(_0x28b5,0x132));var _0x528b=function(_0x43593d,_0x4a904e){_0x43593d=_0x43593d-0x0;var _0x2e6284=_0x28b5[_0x43593d];return _0x2e6284;};'use strict';var _=require(_0x528b('0x0'));var util=require(_0x528b('0x1'));var logger=require(_0x528b('0x2'))('api');var moment=require(_0x528b('0x3'));var BPromise=require(_0x528b('0x4'));var rp=require(_0x528b('0x5'));var fs=require('fs');var path=require(_0x528b('0x6'));var rimraf=require(_0x528b('0x7'));var config=require(_0x528b('0x8'));var attributes=require(_0x528b('0x9'));module[_0x528b('0xa')]=function(_0x346e88,_0x22e3ea){return _0x346e88[_0x528b('0xb')](_0x528b('0xc'),attributes,{'tableName':_0x528b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x947e=['path','../../config/environment','./intSalesforceConfiguration.attributes','SalesforceConfiguration','lodash','util','../../config/logger','moment','bluebird'];(function(_0xecaf2f,_0x1c411d){var _0x53d3c0=function(_0x1112c6){while(--_0x1112c6){_0xecaf2f['push'](_0xecaf2f['shift']());}};_0x53d3c0(++_0x1c411d);}(_0x947e,0x136));var _0xe947=function(_0x415895,_0xe75e18){_0x415895=_0x415895-0x0;var _0x330f13=_0x947e[_0x415895];return _0x330f13;};'use strict';var _=require(_0xe947('0x0'));var util=require(_0xe947('0x1'));var logger=require(_0xe947('0x2'))('api');var moment=require(_0xe947('0x3'));var BPromise=require(_0xe947('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe947('0x5'));var rimraf=require('rimraf');var config=require(_0xe947('0x6'));var attributes=require(_0xe947('0x7'));module['exports']=function(_0x3befb3,_0x5ccab6){return _0x3befb3['define'](_0xe947('0x8'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 9a79459..8c69bc9 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 _0x7103=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','util'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7103,0x125));var _0x3710=function(_0x4e6ca2,_0x135ba1){_0x4e6ca2=_0x4e6ca2-0x0;var _0x1e92c8=_0x7103[_0x4e6ca2];return _0x1e92c8;};'use strict';var _=require('lodash');var util=require(_0x3710('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3710('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3710('0x2'))['db'];var utils=require(_0x3710('0x3'));var logger=require(_0x3710('0x4'))('rpc');var config=require(_0x3710('0x5'));var jayson=require(_0x3710('0x6'));var client=jayson[_0x3710('0x7')][_0x3710('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x304519,_0x2a5ff8,_0x5bc967){return new BPromise(function(_0x1139d9,_0x2462ef){return client[_0x3710('0x9')](_0x304519,_0x5bc967)[_0x3710('0xa')](function(_0x3ee2cb){logger[_0x3710('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2a5ff8,_0x3710('0xc'));logger[_0x3710('0xd')](_0x3710('0xe'),_0x2a5ff8,_0x3710('0xc'),JSON[_0x3710('0xf')](_0x3ee2cb));if(_0x3ee2cb[_0x3710('0x10')]){if(_0x3ee2cb[_0x3710('0x10')][_0x3710('0x11')]===0x1f4){logger[_0x3710('0x10')](_0x3710('0x12'),_0x2a5ff8,_0x3ee2cb['error'][_0x3710('0x13')]);return _0x2462ef(_0x3ee2cb['error'][_0x3710('0x13')]);}logger[_0x3710('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2a5ff8,_0x3ee2cb[_0x3710('0x10')][_0x3710('0x13')]);return _0x1139d9(_0x3ee2cb[_0x3710('0x10')][_0x3710('0x13')]);}else{logger[_0x3710('0xb')](_0x3710('0x12'),_0x2a5ff8,_0x3710('0xc'));_0x1139d9(_0x3ee2cb[_0x3710('0x14')][_0x3710('0x13')]);}})['catch'](function(_0x50a812){logger[_0x3710('0x10')](_0x3710('0x12'),_0x2a5ff8,_0x50a812);_0x2462ef(_0x50a812);});});} \ No newline at end of file +var _0xc2df=['stringify','error','message','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x467e37,_0x4692ff){var _0x555200=function(_0x4ae25a){while(--_0x4ae25a){_0x467e37['push'](_0x467e37['shift']());}};_0x555200(++_0x4692ff);}(_0xc2df,0xeb));var _0xfc2d=function(_0x3515ec,_0x35912c){_0x3515ec=_0x3515ec-0x0;var _0x1aa5bb=_0xc2df[_0x3515ec];return _0x1aa5bb;};'use strict';var _=require('lodash');var util=require(_0xfc2d('0x0'));var moment=require(_0xfc2d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc2d('0x2'));var db=require(_0xfc2d('0x3'))['db'];var utils=require(_0xfc2d('0x4'));var logger=require(_0xfc2d('0x5'))(_0xfc2d('0x6'));var config=require(_0xfc2d('0x7'));var jayson=require(_0xfc2d('0x8'));var client=jayson[_0xfc2d('0x9')][_0xfc2d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b3c6f,_0x22f7cb,_0x2a6fe9){return new BPromise(function(_0xdaa913,_0x4f305f){return client['request'](_0x3b3c6f,_0x2a6fe9)[_0xfc2d('0xb')](function(_0xfeffb1){logger[_0xfc2d('0xc')](_0xfc2d('0xd'),_0x22f7cb,'request\x20sent');logger[_0xfc2d('0xe')](_0xfc2d('0xf'),_0x22f7cb,_0xfc2d('0x10'),JSON[_0xfc2d('0x11')](_0xfeffb1));if(_0xfeffb1[_0xfc2d('0x12')]){if(_0xfeffb1[_0xfc2d('0x12')]['code']===0x1f4){logger[_0xfc2d('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x22f7cb,_0xfeffb1[_0xfc2d('0x12')][_0xfc2d('0x13')]);return _0x4f305f(_0xfeffb1[_0xfc2d('0x12')]['message']);}logger['error'](_0xfc2d('0xd'),_0x22f7cb,_0xfeffb1[_0xfc2d('0x12')][_0xfc2d('0x13')]);return _0xdaa913(_0xfeffb1[_0xfc2d('0x12')]['message']);}else{logger[_0xfc2d('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x22f7cb,_0xfc2d('0x10'));_0xdaa913(_0xfeffb1['result']['message']);}})[_0xfc2d('0x14')](function(_0xeacb4f){logger[_0xfc2d('0x12')](_0xfc2d('0xd'),_0x22f7cb,_0xeacb4f);_0x4f305f(_0xeacb4f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 04a18fb..eba2712 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 _0x9ab8=['get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller'];(function(_0xec3d9b,_0x56ede3){var _0x303494=function(_0x25117d){while(--_0x25117d){_0xec3d9b['push'](_0xec3d9b['shift']());}};_0x303494(++_0x56ede3);}(_0x9ab8,0x81));var _0x89ab=function(_0x292410,_0x54b1de){_0x292410=_0x292410-0x0;var _0x4ccc59=_0x9ab8[_0x292410];return _0x4ccc59;};'use strict';var multer=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var path=require(_0x89ab('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x89ab('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x89ab('0x4'));var interaction=require(_0x89ab('0x5'));var config=require('../../config/environment');var controller=require(_0x89ab('0x6'));router[_0x89ab('0x7')]('/',auth[_0x89ab('0x8')](),controller[_0x89ab('0x9')]);router[_0x89ab('0x7')](_0x89ab('0xa'),auth[_0x89ab('0x8')](),controller[_0x89ab('0xb')]);router[_0x89ab('0xc')]('/',auth[_0x89ab('0x8')](),controller[_0x89ab('0xd')]);router[_0x89ab('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x89ab('0x8')](),controller[_0x89ab('0xf')]);module[_0x89ab('0x10')]=router; \ No newline at end of file +var _0x3cd0=['../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x3cd0,0x8a));var _0x03cd=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x3cd0[_0x374ada];return _0x449ed8;};'use strict';var multer=require(_0x03cd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x03cd('0x1'));var express=require('express');var router=express[_0x03cd('0x2')]();var fs_extra=require(_0x03cd('0x3'));var auth=require(_0x03cd('0x4'));var interaction=require(_0x03cd('0x5'));var config=require(_0x03cd('0x6'));var controller=require('./intSalesforceField.controller');router[_0x03cd('0x7')]('/',auth[_0x03cd('0x8')](),controller[_0x03cd('0x9')]);router[_0x03cd('0x7')](_0x03cd('0xa'),auth['isAuthenticated'](),controller[_0x03cd('0xb')]);router['post']('/',auth[_0x03cd('0x8')](),controller[_0x03cd('0xc')]);router[_0x03cd('0xd')](_0x03cd('0xa'),auth['isAuthenticated'](),controller[_0x03cd('0xe')]);router[_0x03cd('0xf')](_0x03cd('0xa'),auth[_0x03cd('0x8')](),controller[_0x03cd('0x10')]);module[_0x03cd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 51b13b0..92fd05c 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 _0x34e8=['picklist','STRING','variable','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x8242a1,_0x2914cb){var _0x70ad87=function(_0x2306bf){while(--_0x2306bf){_0x8242a1['push'](_0x8242a1['shift']());}};_0x70ad87(++_0x2914cb);}(_0x34e8,0x12c));var _0x834e=function(_0x58ea08,_0xa021b8){_0x58ea08=_0x58ea08-0x0;var _0x5d228f=_0x34e8[_0x58ea08];return _0x5d228f;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'type':{'type':Sequelize[_0x834e('0x2')](_0x834e('0x3'),'variable',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'defaultValue':_0x834e('0x3')},'content':{'type':Sequelize[_0x834e('0x7')]},'key':{'type':Sequelize[_0x834e('0x7')]},'keyType':{'type':Sequelize[_0x834e('0x2')]('string',_0x834e('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x834e('0x7')]},'idField':{'type':Sequelize[_0x834e('0x7')]},'variableName':{'type':Sequelize[_0x834e('0x7')]}}; \ No newline at end of file +var _0xedd9=['customVariable','keyValue','picklist','STRING','exports','ENUM','string','variable'];(function(_0x47a771,_0x2733ad){var _0x3537c9=function(_0x492aa9){while(--_0x492aa9){_0x47a771['push'](_0x47a771['shift']());}};_0x3537c9(++_0x2733ad);}(_0xedd9,0xfc));var _0x9edd=function(_0x4b6226,_0x3ed227){_0x4b6226=_0x4b6226-0x0;var _0xf4056f=_0xedd9[_0x4b6226];return _0xf4056f;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'type':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2'),_0x9edd('0x3'),_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'defaultValue':_0x9edd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9edd('0x7')]},'keyType':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2'),_0x9edd('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x9edd('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index f9ffd1d..bb74bab 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 _0x8d0e=['intersection','attributes','model','fields','length','nolimit','offset','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','params','include','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','set','Content-Range','apply','update','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','query','keys'];(function(_0x3be7c3,_0x494f27){var _0x34b1b9=function(_0x2855c2){while(--_0x2855c2){_0x3be7c3['push'](_0x3be7c3['shift']());}};_0x34b1b9(++_0x494f27);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x4ddda1,_0x5833ce){_0x4ddda1=_0x4ddda1-0x0;var _0x41b39f=_0x8d0e[_0x4ddda1];return _0x41b39f;};'use strict';var pdf=require(_0xe8d0('0x0'));var emlformat=require(_0xe8d0('0x1'));var rimraf=require(_0xe8d0('0x2'));var zipdir=require(_0xe8d0('0x3'));var jsonpatch=require(_0xe8d0('0x4'));var rp=require(_0xe8d0('0x5'));var moment=require(_0xe8d0('0x6'));var BPromise=require(_0xe8d0('0x7'));var Mustache=require(_0xe8d0('0x8'));var util=require('util');var path=require(_0xe8d0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe8d0('0xa'));var fs=require('fs');var fs_extra=require(_0xe8d0('0xb'));var _=require(_0xe8d0('0xc'));var squel=require(_0xe8d0('0xd'));var crypto=require(_0xe8d0('0xe'));var jsforce=require(_0xe8d0('0xf'));var deskjs=require(_0xe8d0('0x10'));var toCsv=require(_0xe8d0('0x11'));var querystring=require('querystring');var Papa=require(_0xe8d0('0x12'));var Redis=require(_0xe8d0('0x13'));var authService=require(_0xe8d0('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe8d0('0x15'));var logger=require(_0xe8d0('0x16'))(_0xe8d0('0x17'));var utils=require(_0xe8d0('0x18'));var config=require(_0xe8d0('0x19'));var licenseUtil=require(_0xe8d0('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38fac0,_0x15b9e5){_0x15b9e5=_0x15b9e5||0xcc;return function(_0x533b42){if(_0x533b42){return _0x38fac0[_0xe8d0('0x1b')](_0x15b9e5);}return _0x38fac0['status'](_0x15b9e5)['end']();};}function respondWithResult(_0x90a1ea,_0x2aa906){_0x2aa906=_0x2aa906||0xc8;return function(_0x1aa725){if(_0x1aa725){return _0x90a1ea[_0xe8d0('0x1c')](_0x2aa906)[_0xe8d0('0x1d')](_0x1aa725);}};}function respondWithFilteredResult(_0x7151c6,_0x52818a){return function(_0x6ccffa){if(_0x6ccffa){var _0x49554d=_0x6ccffa['count'],_0x6d932b=_0x52818a['offset'],_0x3c526c=_0x52818a['offset']+_0x52818a[_0xe8d0('0x1e')],_0xfe8a4;if(_0x3c526c>=_0x49554d){_0x3c526c=_0x49554d;_0xfe8a4=0xc8;}else{_0xfe8a4=0xce;}_0x7151c6[_0xe8d0('0x1c')](_0xfe8a4);return _0x7151c6[_0xe8d0('0x1f')](_0xe8d0('0x20'),_0x6d932b+'-'+_0x3c526c+'/'+_0x49554d)[_0xe8d0('0x1d')](_0x6ccffa);}return null;};}function patchUpdates(_0x588133){return function(_0x105861){try{jsonpatch[_0xe8d0('0x21')](_0x105861,_0x588133,!![]);}catch(_0x524b00){return BPromise['reject'](_0x524b00);}return _0x105861['save']();};}function saveUpdates(_0x384a60,_0x35d131){return function(_0x25363b){if(_0x25363b){return _0x25363b[_0xe8d0('0x22')](_0x384a60)[_0xe8d0('0x23')](function(_0x23a945){return _0x23a945;});}return null;};}function removeEntity(_0x1bd25c,_0x28a6b5){return function(_0x32e39a){if(_0x32e39a){return _0x32e39a['destroy']()[_0xe8d0('0x23')](function(){_0x1bd25c[_0xe8d0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x106614,_0x2e69d1){return function(_0x274cac){if(!_0x274cac){_0x106614[_0xe8d0('0x1b')](0x194);}return _0x274cac;};}function handleError(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0x1f4;return function(_0x31519b){logger[_0xe8d0('0x24')](_0x31519b[_0xe8d0('0x25')]);if(_0x31519b[_0xe8d0('0x26')]){delete _0x31519b[_0xe8d0('0x26')];}_0x146783['status'](_0x149dfd)[_0xe8d0('0x27')](_0x31519b);};}exports[_0xe8d0('0x28')]=function(_0x10dec2,_0x486f49){var _0x10a30b={},_0x343b08={},_0x526240={'count':0x0,'rows':[]};var _0x1519e2=_[_0xe8d0('0x29')](db[_0xe8d0('0x2a')][_0xe8d0('0x2b')],function(_0x3cf3d6){return{'name':_0x3cf3d6['fieldName'],'type':_0x3cf3d6[_0xe8d0('0x2c')]['key']};});_0x343b08['model']=_['map'](_0x1519e2,_0xe8d0('0x26'));_0x343b08[_0xe8d0('0x2d')]=_[_0xe8d0('0x2e')](_0x10dec2['query']);_0x343b08['filters']=_[_0xe8d0('0x2f')](_0x343b08['model'],_0x343b08[_0xe8d0('0x2d')]);_0x10a30b[_0xe8d0('0x30')]=_[_0xe8d0('0x2f')](_0x343b08[_0xe8d0('0x31')],qs[_0xe8d0('0x32')](_0x10dec2['query'][_0xe8d0('0x32')]));_0x10a30b[_0xe8d0('0x30')]=_0x10a30b[_0xe8d0('0x30')][_0xe8d0('0x33')]?_0x10a30b['attributes']:_0x343b08[_0xe8d0('0x31')];if(!_0x10dec2[_0xe8d0('0x2d')]['hasOwnProperty'](_0xe8d0('0x34'))){_0x10a30b['limit']=qs[_0xe8d0('0x1e')](_0x10dec2['query'][_0xe8d0('0x1e')]);_0x10a30b['offset']=qs[_0xe8d0('0x35')](_0x10dec2[_0xe8d0('0x2d')][_0xe8d0('0x35')]);}_0x10a30b[_0xe8d0('0x36')]=qs['sort'](_0x10dec2[_0xe8d0('0x2d')][_0xe8d0('0x37')]);_0x10a30b[_0xe8d0('0x38')]=qs['filters'](_[_0xe8d0('0x39')](_0x10dec2[_0xe8d0('0x2d')],_0x343b08[_0xe8d0('0x3a')]),_0x1519e2);if(_0x10dec2[_0xe8d0('0x2d')][_0xe8d0('0x3b')]){_0x10a30b['where']=_[_0xe8d0('0x3c')](_0x10a30b[_0xe8d0('0x38')],{'$or':_[_0xe8d0('0x29')](_0x1519e2,function(_0x3d76d5){if(_0x3d76d5[_0xe8d0('0x2c')]!==_0xe8d0('0x3d')){var _0xbb9620={};_0xbb9620[_0x3d76d5[_0xe8d0('0x26')]]={'$like':'%'+_0x10dec2['query']['filter']+'%'};return _0xbb9620;}})});}_0x10a30b=_[_0xe8d0('0x3c')]({},_0x10a30b,_0x10dec2[_0xe8d0('0x3e')]);var _0x45e2dc={'where':_0x10a30b[_0xe8d0('0x38')]};return db[_0xe8d0('0x2a')]['count'](_0x45e2dc)[_0xe8d0('0x23')](function(_0x4bd7a2){_0x526240[_0xe8d0('0x3f')]=_0x4bd7a2;if(_0x10dec2[_0xe8d0('0x2d')][_0xe8d0('0x40')]){_0x10a30b['include']=[{'all':!![]}];}return db[_0xe8d0('0x2a')][_0xe8d0('0x41')](_0x10a30b);})[_0xe8d0('0x23')](function(_0x230a90){_0x526240[_0xe8d0('0x42')]=_0x230a90;return _0x526240;})['then'](respondWithFilteredResult(_0x486f49,_0x10a30b))['catch'](handleError(_0x486f49,null));};exports['show']=function(_0x4cf0da,_0x14ffb6){var _0x52f288={'raw':!![],'where':{'id':_0x4cf0da[_0xe8d0('0x43')]['id']}},_0x1e6e8f={};_0x1e6e8f[_0xe8d0('0x31')]=_[_0xe8d0('0x2e')](db[_0xe8d0('0x2a')][_0xe8d0('0x2b')]);_0x1e6e8f[_0xe8d0('0x2d')]=_[_0xe8d0('0x2e')](_0x4cf0da['query']);_0x1e6e8f[_0xe8d0('0x3a')]=_[_0xe8d0('0x2f')](_0x1e6e8f['model'],_0x1e6e8f['query']);_0x52f288[_0xe8d0('0x30')]=_[_0xe8d0('0x2f')](_0x1e6e8f[_0xe8d0('0x31')],qs['fields'](_0x4cf0da[_0xe8d0('0x2d')][_0xe8d0('0x32')]));_0x52f288['attributes']=_0x52f288[_0xe8d0('0x30')][_0xe8d0('0x33')]?_0x52f288['attributes']:_0x1e6e8f[_0xe8d0('0x31')];if(_0x4cf0da[_0xe8d0('0x2d')][_0xe8d0('0x40')]){_0x52f288[_0xe8d0('0x44')]=[{'all':!![]}];}_0x52f288=_[_0xe8d0('0x3c')]({},_0x52f288,_0x4cf0da[_0xe8d0('0x3e')]);return db[_0xe8d0('0x2a')][_0xe8d0('0x45')](_0x52f288)['then'](handleEntityNotFound(_0x14ffb6,null))[_0xe8d0('0x23')](respondWithResult(_0x14ffb6,null))[_0xe8d0('0x46')](handleError(_0x14ffb6,null));};exports[_0xe8d0('0x47')]=function(_0x2278ef,_0x28d38b){return db[_0xe8d0('0x2a')][_0xe8d0('0x47')](_0x2278ef[_0xe8d0('0x48')],{})[_0xe8d0('0x23')](respondWithResult(_0x28d38b,0xc9))[_0xe8d0('0x46')](handleError(_0x28d38b,null));};exports[_0xe8d0('0x22')]=function(_0x3a5987,_0x596303){if(_0x3a5987[_0xe8d0('0x48')]['id']){delete _0x3a5987[_0xe8d0('0x48')]['id'];}return db[_0xe8d0('0x2a')][_0xe8d0('0x45')]({'where':{'id':_0x3a5987[_0xe8d0('0x43')]['id']}})[_0xe8d0('0x23')](handleEntityNotFound(_0x596303,null))[_0xe8d0('0x23')](saveUpdates(_0x3a5987['body'],null))[_0xe8d0('0x23')](respondWithResult(_0x596303,null))[_0xe8d0('0x46')](handleError(_0x596303,null));};exports[_0xe8d0('0x49')]=function(_0x205933,_0x4ed47f){return db[_0xe8d0('0x2a')]['find']({'where':{'id':_0x205933[_0xe8d0('0x43')]['id']}})[_0xe8d0('0x23')](handleEntityNotFound(_0x4ed47f,null))[_0xe8d0('0x23')](removeEntity(_0x4ed47f,null))[_0xe8d0('0x46')](handleError(_0x4ed47f,null));}; \ No newline at end of file +var _0x1b4e=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','key','model','query','filters','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','keys','intersection','includeAll','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x98ea8e,_0x56c22c){var _0x405c47=function(_0x2fa350){while(--_0x2fa350){_0x98ea8e['push'](_0x98ea8e['shift']());}};_0x405c47(++_0x56c22c);}(_0x1b4e,0x1ad));var _0xe1b4=function(_0x72974d,_0x5117a6){_0x72974d=_0x72974d-0x0;var _0x3720d0=_0x1b4e[_0x72974d];return _0x3720d0;};'use strict';var pdf=require(_0xe1b4('0x0'));var emlformat=require(_0xe1b4('0x1'));var rimraf=require(_0xe1b4('0x2'));var zipdir=require(_0xe1b4('0x3'));var jsonpatch=require(_0xe1b4('0x4'));var rp=require('request-promise');var moment=require(_0xe1b4('0x5'));var BPromise=require(_0xe1b4('0x6'));var Mustache=require(_0xe1b4('0x7'));var util=require(_0xe1b4('0x8'));var path=require(_0xe1b4('0x9'));var sox=require(_0xe1b4('0xa'));var csv=require(_0xe1b4('0xb'));var ejs=require(_0xe1b4('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe1b4('0xd'));var squel=require(_0xe1b4('0xe'));var crypto=require(_0xe1b4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe1b4('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe1b4('0x11'));var Papa=require('papaparse');var Redis=require(_0xe1b4('0x12'));var authService=require(_0xe1b4('0x13'));var qs=require(_0xe1b4('0x14'));var as=require(_0xe1b4('0x15'));var hardwareService=require(_0xe1b4('0x16'));var logger=require(_0xe1b4('0x17'))(_0xe1b4('0x18'));var utils=require(_0xe1b4('0x19'));var config=require(_0xe1b4('0x1a'));var licenseUtil=require(_0xe1b4('0x1b'));var db=require(_0xe1b4('0x1c'))['db'];function respondWithStatusCode(_0x4376d7,_0x208de2){_0x208de2=_0x208de2||0xcc;return function(_0x268f85){if(_0x268f85){return _0x4376d7[_0xe1b4('0x1d')](_0x208de2);}return _0x4376d7[_0xe1b4('0x1e')](_0x208de2)[_0xe1b4('0x1f')]();};}function respondWithResult(_0x366fdf,_0x1fb3dc){_0x1fb3dc=_0x1fb3dc||0xc8;return function(_0xb66299){if(_0xb66299){return _0x366fdf[_0xe1b4('0x1e')](_0x1fb3dc)[_0xe1b4('0x20')](_0xb66299);}};}function respondWithFilteredResult(_0x605ed3,_0x58ae7d){return function(_0x27192f){if(_0x27192f){var _0x21f487=_0x27192f[_0xe1b4('0x21')],_0x1c3636=_0x58ae7d[_0xe1b4('0x22')],_0x33586a=_0x58ae7d[_0xe1b4('0x22')]+_0x58ae7d[_0xe1b4('0x23')],_0x342030;if(_0x33586a>=_0x21f487){_0x33586a=_0x21f487;_0x342030=0xc8;}else{_0x342030=0xce;}_0x605ed3[_0xe1b4('0x1e')](_0x342030);return _0x605ed3[_0xe1b4('0x24')](_0xe1b4('0x25'),_0x1c3636+'-'+_0x33586a+'/'+_0x21f487)['json'](_0x27192f);}return null;};}function patchUpdates(_0x3fd59d){return function(_0xf8cc63){try{jsonpatch[_0xe1b4('0x26')](_0xf8cc63,_0x3fd59d,!![]);}catch(_0x2a11e0){return BPromise['reject'](_0x2a11e0);}return _0xf8cc63[_0xe1b4('0x27')]();};}function saveUpdates(_0x24db4f,_0x207673){return function(_0x179e61){if(_0x179e61){return _0x179e61[_0xe1b4('0x28')](_0x24db4f)[_0xe1b4('0x29')](function(_0x8dfd8d){return _0x8dfd8d;});}return null;};}function removeEntity(_0x39e0da,_0x1f961c){return function(_0x399d22){if(_0x399d22){return _0x399d22['destroy']()[_0xe1b4('0x29')](function(){_0x39e0da[_0xe1b4('0x1e')](0xcc)[_0xe1b4('0x1f')]();});}};}function handleEntityNotFound(_0x18e7d2,_0x57c5c6){return function(_0x122ad7){if(!_0x122ad7){_0x18e7d2['sendStatus'](0x194);}return _0x122ad7;};}function handleError(_0x5ca59d,_0x51bfac){_0x51bfac=_0x51bfac||0x1f4;return function(_0x3c471f){logger[_0xe1b4('0x2a')](_0x3c471f[_0xe1b4('0x2b')]);if(_0x3c471f['name']){delete _0x3c471f[_0xe1b4('0x2c')];}_0x5ca59d['status'](_0x51bfac)[_0xe1b4('0x2d')](_0x3c471f);};}exports[_0xe1b4('0x2e')]=function(_0x49b1a6,_0x366d4){var _0xac7934={},_0x18f034={},_0x3cea8c={'count':0x0,'rows':[]};var _0x3fcafe=_[_0xe1b4('0x2f')](db[_0xe1b4('0x30')][_0xe1b4('0x31')],function(_0x14da43){return{'name':_0x14da43['fieldName'],'type':_0x14da43[_0xe1b4('0x32')][_0xe1b4('0x33')]};});_0x18f034[_0xe1b4('0x34')]=_['map'](_0x3fcafe,_0xe1b4('0x2c'));_0x18f034[_0xe1b4('0x35')]=_['keys'](_0x49b1a6['query']);_0x18f034[_0xe1b4('0x36')]=_['intersection'](_0x18f034['model'],_0x18f034[_0xe1b4('0x35')]);_0xac7934[_0xe1b4('0x37')]=_['intersection'](_0x18f034['model'],qs[_0xe1b4('0x38')](_0x49b1a6[_0xe1b4('0x35')]['fields']));_0xac7934[_0xe1b4('0x37')]=_0xac7934[_0xe1b4('0x37')][_0xe1b4('0x39')]?_0xac7934[_0xe1b4('0x37')]:_0x18f034[_0xe1b4('0x34')];if(!_0x49b1a6[_0xe1b4('0x35')]['hasOwnProperty']('nolimit')){_0xac7934[_0xe1b4('0x23')]=qs[_0xe1b4('0x23')](_0x49b1a6[_0xe1b4('0x35')][_0xe1b4('0x23')]);_0xac7934[_0xe1b4('0x22')]=qs['offset'](_0x49b1a6[_0xe1b4('0x35')][_0xe1b4('0x22')]);}_0xac7934[_0xe1b4('0x3a')]=qs[_0xe1b4('0x3b')](_0x49b1a6[_0xe1b4('0x35')]['sort']);_0xac7934[_0xe1b4('0x3c')]=qs[_0xe1b4('0x36')](_[_0xe1b4('0x3d')](_0x49b1a6[_0xe1b4('0x35')],_0x18f034[_0xe1b4('0x36')]),_0x3fcafe);if(_0x49b1a6['query'][_0xe1b4('0x3e')]){_0xac7934[_0xe1b4('0x3c')]=_[_0xe1b4('0x3f')](_0xac7934[_0xe1b4('0x3c')],{'$or':_[_0xe1b4('0x2f')](_0x3fcafe,function(_0x39cdbf){if(_0x39cdbf[_0xe1b4('0x32')]!==_0xe1b4('0x40')){var _0x501f68={};_0x501f68[_0x39cdbf[_0xe1b4('0x2c')]]={'$like':'%'+_0x49b1a6[_0xe1b4('0x35')]['filter']+'%'};return _0x501f68;}})});}_0xac7934=_['merge']({},_0xac7934,_0x49b1a6[_0xe1b4('0x41')]);var _0x893eb8={'where':_0xac7934[_0xe1b4('0x3c')]};return db[_0xe1b4('0x30')][_0xe1b4('0x21')](_0x893eb8)[_0xe1b4('0x29')](function(_0x2637ca){_0x3cea8c[_0xe1b4('0x21')]=_0x2637ca;if(_0x49b1a6[_0xe1b4('0x35')]['includeAll']){_0xac7934['include']=[{'all':!![]}];}return db['SalesforceField'][_0xe1b4('0x42')](_0xac7934);})[_0xe1b4('0x29')](function(_0x4ff849){_0x3cea8c[_0xe1b4('0x43')]=_0x4ff849;return _0x3cea8c;})[_0xe1b4('0x29')](respondWithFilteredResult(_0x366d4,_0xac7934))[_0xe1b4('0x44')](handleError(_0x366d4,null));};exports['show']=function(_0x9794c,_0x36dda7){var _0x594208={'raw':!![],'where':{'id':_0x9794c['params']['id']}},_0x4dec7d={};_0x4dec7d[_0xe1b4('0x34')]=_[_0xe1b4('0x45')](db[_0xe1b4('0x30')]['rawAttributes']);_0x4dec7d[_0xe1b4('0x35')]=_['keys'](_0x9794c[_0xe1b4('0x35')]);_0x4dec7d[_0xe1b4('0x36')]=_[_0xe1b4('0x46')](_0x4dec7d[_0xe1b4('0x34')],_0x4dec7d['query']);_0x594208[_0xe1b4('0x37')]=_[_0xe1b4('0x46')](_0x4dec7d[_0xe1b4('0x34')],qs[_0xe1b4('0x38')](_0x9794c[_0xe1b4('0x35')][_0xe1b4('0x38')]));_0x594208['attributes']=_0x594208[_0xe1b4('0x37')][_0xe1b4('0x39')]?_0x594208[_0xe1b4('0x37')]:_0x4dec7d[_0xe1b4('0x34')];if(_0x9794c[_0xe1b4('0x35')][_0xe1b4('0x47')]){_0x594208['include']=[{'all':!![]}];}_0x594208=_[_0xe1b4('0x3f')]({},_0x594208,_0x9794c[_0xe1b4('0x41')]);return db['SalesforceField']['find'](_0x594208)[_0xe1b4('0x29')](handleEntityNotFound(_0x36dda7,null))[_0xe1b4('0x29')](respondWithResult(_0x36dda7,null))[_0xe1b4('0x44')](handleError(_0x36dda7,null));};exports[_0xe1b4('0x48')]=function(_0x564275,_0x10843f){return db[_0xe1b4('0x30')][_0xe1b4('0x48')](_0x564275[_0xe1b4('0x49')],{})[_0xe1b4('0x29')](respondWithResult(_0x10843f,0xc9))[_0xe1b4('0x44')](handleError(_0x10843f,null));};exports[_0xe1b4('0x28')]=function(_0x1003b2,_0x329058){if(_0x1003b2[_0xe1b4('0x49')]['id']){delete _0x1003b2[_0xe1b4('0x49')]['id'];}return db[_0xe1b4('0x30')]['find']({'where':{'id':_0x1003b2['params']['id']}})[_0xe1b4('0x29')](handleEntityNotFound(_0x329058,null))[_0xe1b4('0x29')](saveUpdates(_0x1003b2['body'],null))[_0xe1b4('0x29')](respondWithResult(_0x329058,null))[_0xe1b4('0x44')](handleError(_0x329058,null));};exports[_0xe1b4('0x4a')]=function(_0x16233,_0x15a41e){return db[_0xe1b4('0x30')][_0xe1b4('0x4b')]({'where':{'id':_0x16233['params']['id']}})['then'](handleEntityNotFound(_0x15a41e,null))[_0xe1b4('0x29')](removeEntity(_0x15a41e,null))[_0xe1b4('0x44')](handleError(_0x15a41e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 5e05994..c4ef7a9 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 _0x10af=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x10af,0xfc));var _0xf10a=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x10af[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0xf10a('0x0'));var util=require('util');var logger=require(_0xf10a('0x1'))(_0xf10a('0x2'));var moment=require(_0xf10a('0x3'));var BPromise=require(_0xf10a('0x4'));var rp=require(_0xf10a('0x5'));var fs=require('fs');var path=require(_0xf10a('0x6'));var rimraf=require(_0xf10a('0x7'));var config=require(_0xf10a('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0xf10a('0x9')]=function(_0xf86ea1,_0x5c9a4c){return _0xf86ea1['define'](_0xf10a('0xa'),attributes,{'tableName':_0xf10a('0xb'),'paranoid':![],'indexes':[{'name':_0xf10a('0xc'),'fields':[_0xf10a('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4abf=['salesforce_unique_index','FieldId','lodash','util','api','path','rimraf','exports','define','int_salesforce_fields'];(function(_0x2f900d,_0x104558){var _0x45a5e4=function(_0x55d0d7){while(--_0x55d0d7){_0x2f900d['push'](_0x2f900d['shift']());}};_0x45a5e4(++_0x104558);}(_0x4abf,0xac));var _0xf4ab=function(_0x23dcae,_0x5ac4e2){_0x23dcae=_0x23dcae-0x0;var _0x570ecc=_0x4abf[_0x23dcae];return _0x570ecc;};'use strict';var _=require(_0xf4ab('0x0'));var util=require(_0xf4ab('0x1'));var logger=require('../../config/logger')(_0xf4ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4ab('0x3'));var rimraf=require(_0xf4ab('0x4'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0xf4ab('0x5')]=function(_0x4160fb,_0x2e6efe){return _0x4160fb[_0xf4ab('0x6')]('SalesforceField',attributes,{'tableName':_0xf4ab('0x7'),'paranoid':![],'indexes':[{'name':_0xf4ab('0x8'),'fields':['idField',_0xf4ab('0x9')],'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 ce1716d..89ac075 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 _0xe706=['http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\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(_0x374707,_0x3cb2db){var _0x36385f=function(_0x51cd80){while(--_0x51cd80){_0x374707['push'](_0x374707['shift']());}};_0x36385f(++_0x3cb2db);}(_0xe706,0xa3));var _0x6e70=function(_0x45c448,_0x326332){_0x45c448=_0x45c448-0x0;var _0x415d10=_0xe706[_0x45c448];return _0x415d10;};'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']('SalesforceField,\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']('SalesforceField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xdace=['request\x20sent','debug','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0xdace,0xc5));var _0xedac=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0xdace[_0x3e7e96];return _0x13f6f0;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('SalesforceField,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index fb625c5..4f1af19 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 _0xc900=['../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5523f8,_0x3f3b10){var _0x13518a=function(_0x186a21){while(--_0x186a21){_0x5523f8['push'](_0x5523f8['shift']());}};_0x13518a(++_0x3f3b10);}(_0xc900,0xb3));var _0x0c90=function(_0x9e54eb,_0x1a9919){_0x9e54eb=_0x9e54eb-0x0;var _0x418379=_0xc900[_0x9e54eb];return _0x418379;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var fs_extra=require(_0x0c90('0x3'));var auth=require(_0x0c90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c90('0x5'));var controller=require(_0x0c90('0x6'));router[_0x0c90('0x7')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0x7')]('/:id',auth[_0x0c90('0x8')](),controller[_0x0c90('0xa')]);router[_0x0c90('0x7')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xc')]);router[_0x0c90('0x7')](_0x0c90('0xd'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xf')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x10')]);router['post'](_0x0c90('0xb'),auth['isAuthenticated'](),controller[_0x0c90('0x11')]);router['put'](_0x0c90('0x12'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x13')]);router[_0x0c90('0x14')](_0x0c90('0x12'),auth['isAuthenticated'](),controller[_0x0c90('0x15')]);module[_0x0c90('0x16')]=router; \ No newline at end of file +var _0x8f4c=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x592f7f,_0x35799e){var _0x2cd9cb=function(_0x2f80c1){while(--_0x2f80c1){_0x592f7f['push'](_0x592f7f['shift']());}};_0x2cd9cb(++_0x35799e);}(_0x8f4c,0x113));var _0xc8f4=function(_0x5a8c77,_0x6bba75){_0x5a8c77=_0x5a8c77-0x0;var _0x155544=_0x8f4c[_0x5a8c77];return _0x155544;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./intServicenowAccount.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0x9')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router['get'](_0xc8f4('0xf'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x11')]('/',auth['isAuthenticated'](),controller[_0xc8f4('0x12')]);router['post'](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x13')]);router[_0xc8f4('0x14')](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0x15')]);router[_0xc8f4('0x16')](_0xc8f4('0xa'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x17')]);module[_0xc8f4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 7e185c1..2e3c0db 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 _0xa184=['STRING','username','remoteUri','sequelize','exports'];(function(_0x534538,_0x32a10b){var _0x2f1f0f=function(_0x52cd12){while(--_0x52cd12){_0x534538['push'](_0x534538['shift']());}};_0x2f1f0f(++_0x32a10b);}(_0xa184,0x80));var _0x4a18=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0xa184[_0x525af9];return _0x129fbf;};'use strict';var Sequelize=require(_0x4a18('0x0'));module[_0x4a18('0x1')]={'name':{'type':Sequelize[_0x4a18('0x2')]},'description':{'type':Sequelize[_0x4a18('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x4a18('0x3')},'password':{'type':Sequelize[_0x4a18('0x2')]},'email':{'type':Sequelize[_0x4a18('0x2')]},'remoteUri':{'type':Sequelize[_0x4a18('0x2')],'unique':_0x4a18('0x4')},'serverUrl':{'type':Sequelize[_0x4a18('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x860c=['username','sequelize','STRING'];(function(_0x4d74bd,_0x5d3cd4){var _0x1910c3=function(_0x47d967){while(--_0x47d967){_0x4d74bd['push'](_0x4d74bd['shift']());}};_0x1910c3(++_0x5d3cd4);}(_0x860c,0x1e1));var _0xc860=function(_0x58abee,_0x3bef90){_0x58abee=_0x58abee-0x0;var _0x27e94f=_0x860c[_0x58abee];return _0x27e94f;};'use strict';var Sequelize=require(_0xc860('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc860('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xc860('0x2')},'password':{'type':Sequelize[_0xc860('0x1')]},'email':{'type':Sequelize[_0xc860('0x1')]},'remoteUri':{'type':Sequelize[_0xc860('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc860('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 b107021..79d0b28 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 _0xcbfe=['pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','create','body','find','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','severity','category','parent','watch_list','upon_reject','child_incidents','approval_history','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','expected_start','opened_at','group_list','work_end','reopened_time','caller_id','work_notes','short_description','delivery_task','work_start','business_stc','additional_assignee_list','description','sys_class_name','close_notes','parent_incident','incident_state','urgency','problem_id','company','reassignment_count','assigned_to','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','all','TCL:\x20_object','includes','concat','ServiceNow\x20error:\x20','statusCode','stack','test','Wrong\x20credentials','true','False','false','GET','result','value','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x35a736,_0x2c5fc2){var _0x2a9eda=function(_0x145220){while(--_0x145220){_0x35a736['push'](_0x35a736['shift']());}};_0x2a9eda(++_0x2c5fc2);}(_0xcbfe,0x75));var _0xecbf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcbfe[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xecbf('0x0'));var emlformat=require(_0xecbf('0x1'));var rimraf=require(_0xecbf('0x2'));var zipdir=require(_0xecbf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecbf('0x4'));var moment=require(_0xecbf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xecbf('0x6'));var path=require(_0xecbf('0x7'));var sox=require(_0xecbf('0x8'));var csv=require(_0xecbf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xecbf('0xa'));var _=require(_0xecbf('0xb'));var squel=require(_0xecbf('0xc'));var crypto=require(_0xecbf('0xd'));var jsforce=require(_0xecbf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xecbf('0xf'));var Papa=require(_0xecbf('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xecbf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecbf('0x12'));var logger=require(_0xecbf('0x13'))(_0xecbf('0x14'));var utils=require(_0xecbf('0x15'));var config=require(_0xecbf('0x16'));var licenseUtil=require(_0xecbf('0x17'));var db=require(_0xecbf('0x18'))['db'];var integrations=require(_0xecbf('0x19'));var jayson=require('jayson/promise');var client=jayson['client'][_0xecbf('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1d856f,_0x5cdcc4,_0x47fd4f,_0x46f467){return new BPromise(function(_0xb15587,_0x11cd13){var _0x51b446=_0x46f467||client;return _0x51b446['request'](_0x1d856f,_0x47fd4f)[_0xecbf('0x1b')](function(_0x35594d){logger[_0xecbf('0x1c')](_0xecbf('0x1d'),_0x5cdcc4,_0xecbf('0x1e'));logger['debug'](_0xecbf('0x1f'),_0x5cdcc4,_0xecbf('0x1e'),JSON['stringify'](_0x35594d));if(_0x35594d[_0xecbf('0x20')]){if(_0x35594d['error'][_0xecbf('0x21')]===0x1f4){logger[_0xecbf('0x20')](_0xecbf('0x1d'),_0x5cdcc4,_0x35594d[_0xecbf('0x20')][_0xecbf('0x22')]);return _0x11cd13(_0x35594d[_0xecbf('0x20')][_0xecbf('0x22')]);}logger[_0xecbf('0x20')](_0xecbf('0x1d'),_0x5cdcc4,_0x35594d[_0xecbf('0x20')]['message']);return _0xb15587(_0x35594d[_0xecbf('0x20')][_0xecbf('0x22')]);}else{logger[_0xecbf('0x1c')](_0xecbf('0x1d'),_0x5cdcc4,_0xecbf('0x1e'));_0xb15587(_0x35594d['result'][_0xecbf('0x22')]);}})[_0xecbf('0x23')](function(_0x39a218){logger[_0xecbf('0x20')](_0xecbf('0x1d'),_0x5cdcc4,_0x39a218);_0x11cd13(_0x39a218);});});}function respondWithStatusCode(_0x282cb0,_0x3e3127){_0x3e3127=_0x3e3127||0xcc;return function(_0x32ef15){if(_0x32ef15){return _0x282cb0[_0xecbf('0x24')](_0x3e3127);}return _0x282cb0[_0xecbf('0x25')](_0x3e3127)[_0xecbf('0x26')]();};}function respondWithResult(_0x48f975,_0x1a0234){_0x1a0234=_0x1a0234||0xc8;return function(_0x3cd7d5){if(_0x3cd7d5){return _0x48f975[_0xecbf('0x25')](_0x1a0234)['json'](_0x3cd7d5);}};}function respondWithFilteredResult(_0xc7c1f9,_0x40d287){return function(_0x58b155){if(_0x58b155){var _0x5dc721=_0x58b155[_0xecbf('0x27')],_0x45617b=_0x40d287[_0xecbf('0x28')],_0x521450=_0x40d287[_0xecbf('0x28')]+_0x40d287[_0xecbf('0x29')],_0x29e9de;if(_0x521450>=_0x5dc721){_0x521450=_0x5dc721;_0x29e9de=0xc8;}else{_0x29e9de=0xce;}_0xc7c1f9[_0xecbf('0x25')](_0x29e9de);return _0xc7c1f9[_0xecbf('0x2a')](_0xecbf('0x2b'),_0x45617b+'-'+_0x521450+'/'+_0x5dc721)[_0xecbf('0x2c')](_0x58b155);}return null;};}function patchUpdates(_0x193f52){return function(_0x226bcf){try{jsonpatch['apply'](_0x226bcf,_0x193f52,!![]);}catch(_0x419f05){return BPromise[_0xecbf('0x2d')](_0x419f05);}return _0x226bcf[_0xecbf('0x2e')]();};}function saveUpdates(_0x3b095d,_0x878d09){return function(_0x52d4f3){if(_0x52d4f3){return _0x52d4f3[_0xecbf('0x2f')](_0x3b095d)['then'](function(_0x5bdade){return _0x5bdade;});}return null;};}function removeEntity(_0x10aeec,_0x183899){return function(_0x5b9838){if(_0x5b9838){return _0x5b9838[_0xecbf('0x30')]()[_0xecbf('0x1b')](function(){_0x10aeec[_0xecbf('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b96c2,_0x23dc19){return function(_0x1ddf62){if(!_0x1ddf62){_0x4b96c2[_0xecbf('0x24')](0x194);}return _0x1ddf62;};}function handleError(_0x4f8c31,_0xf9905){_0xf9905=_0xf9905||0x1f4;return function(_0x5cd47b){logger[_0xecbf('0x20')](_0x5cd47b['stack']);if(_0x5cd47b[_0xecbf('0x31')]){delete _0x5cd47b['name'];}_0x4f8c31['status'](_0xf9905)[_0xecbf('0x32')](_0x5cd47b);};}exports[_0xecbf('0x33')]=function(_0x4325be,_0x35e012){var _0x32e93a={},_0x4b4411={},_0xbe8c1b={'count':0x0,'rows':[]};var _0x194be8=_[_0xecbf('0x34')](db[_0xecbf('0x35')][_0xecbf('0x36')],function(_0x3c56be){return{'name':_0x3c56be[_0xecbf('0x37')],'type':_0x3c56be[_0xecbf('0x38')][_0xecbf('0x39')]};});_0x4b4411['model']=_[_0xecbf('0x34')](_0x194be8,'name');_0x4b4411[_0xecbf('0x3a')]=_['keys'](_0x4325be[_0xecbf('0x3a')]);_0x4b4411[_0xecbf('0x3b')]=_['intersection'](_0x4b4411[_0xecbf('0x3c')],_0x4b4411[_0xecbf('0x3a')]);_0x32e93a['attributes']=_[_0xecbf('0x3d')](_0x4b4411[_0xecbf('0x3c')],qs[_0xecbf('0x3e')](_0x4325be[_0xecbf('0x3a')]['fields']));_0x32e93a['attributes']=_0x32e93a[_0xecbf('0x3f')][_0xecbf('0x40')]?_0x32e93a[_0xecbf('0x3f')]:_0x4b4411[_0xecbf('0x3c')];if(!_0x4325be[_0xecbf('0x3a')][_0xecbf('0x41')](_0xecbf('0x42'))){_0x32e93a[_0xecbf('0x29')]=qs[_0xecbf('0x29')](_0x4325be['query'][_0xecbf('0x29')]);_0x32e93a[_0xecbf('0x28')]=qs[_0xecbf('0x28')](_0x4325be[_0xecbf('0x3a')][_0xecbf('0x28')]);}_0x32e93a[_0xecbf('0x43')]=qs['sort'](_0x4325be[_0xecbf('0x3a')][_0xecbf('0x44')]);_0x32e93a[_0xecbf('0x45')]=qs[_0xecbf('0x3b')](_[_0xecbf('0x46')](_0x4325be[_0xecbf('0x3a')],_0x4b4411['filters']),_0x194be8);if(_0x4325be[_0xecbf('0x3a')][_0xecbf('0x47')]){_0x32e93a[_0xecbf('0x45')]=_[_0xecbf('0x48')](_0x32e93a[_0xecbf('0x45')],{'$or':_['map'](_0x194be8,function(_0x200aa5){if(_0x200aa5['type']!=='VIRTUAL'){var _0x56cdb8={};_0x56cdb8[_0x200aa5[_0xecbf('0x31')]]={'$like':'%'+_0x4325be['query'][_0xecbf('0x47')]+'%'};return _0x56cdb8;}})});}_0x32e93a=_[_0xecbf('0x48')]({},_0x32e93a,_0x4325be[_0xecbf('0x49')]);var _0x49ad13={'where':_0x32e93a['where']};return db[_0xecbf('0x35')][_0xecbf('0x27')](_0x49ad13)[_0xecbf('0x1b')](function(_0x4a0988){_0xbe8c1b[_0xecbf('0x27')]=_0x4a0988;if(_0x4325be['query'][_0xecbf('0x4a')]){_0x32e93a[_0xecbf('0x4b')]=[{'all':!![]}];}return db[_0xecbf('0x35')][_0xecbf('0x4c')](_0x32e93a);})[_0xecbf('0x1b')](function(_0x45861d){_0xbe8c1b[_0xecbf('0x4d')]=_0x45861d;return _0xbe8c1b;})[_0xecbf('0x1b')](respondWithFilteredResult(_0x35e012,_0x32e93a))[_0xecbf('0x23')](handleError(_0x35e012,null));};exports[_0xecbf('0x4e')]=function(_0x178495,_0x3dd91f){var _0x5edffb={'raw':![],'where':{'id':_0x178495[_0xecbf('0x4f')]['id']}},_0x25c59d={};_0x25c59d[_0xecbf('0x3c')]=_[_0xecbf('0x50')](db[_0xecbf('0x35')][_0xecbf('0x36')]);_0x25c59d['query']=_[_0xecbf('0x50')](_0x178495['query']);_0x25c59d[_0xecbf('0x3b')]=_[_0xecbf('0x3d')](_0x25c59d[_0xecbf('0x3c')],_0x25c59d['query']);_0x5edffb['attributes']=_[_0xecbf('0x3d')](_0x25c59d['model'],qs[_0xecbf('0x3e')](_0x178495[_0xecbf('0x3a')][_0xecbf('0x3e')]));_0x5edffb[_0xecbf('0x3f')]=_0x5edffb[_0xecbf('0x3f')][_0xecbf('0x40')]?_0x5edffb['attributes']:_0x25c59d[_0xecbf('0x3c')];if(_0x178495['query'][_0xecbf('0x4a')]){_0x5edffb[_0xecbf('0x4b')]=[{'all':!![]}];}_0x5edffb=_['merge']({},_0x5edffb,_0x178495[_0xecbf('0x49')]);return db[_0xecbf('0x35')]['find'](_0x5edffb)[_0xecbf('0x1b')](handleEntityNotFound(_0x3dd91f,null))[_0xecbf('0x1b')](respondWithResult(_0x3dd91f,null))['catch'](handleError(_0x3dd91f,null));};exports['create']=function(_0x7c0a9c,_0x47645f){return db['ServicenowAccount'][_0xecbf('0x51')](_0x7c0a9c[_0xecbf('0x52')],{})[_0xecbf('0x1b')](respondWithResult(_0x47645f,0xc9))[_0xecbf('0x23')](handleError(_0x47645f,null));};exports['update']=function(_0x384c4e,_0x27349d){if(_0x384c4e['body']['id']){delete _0x384c4e[_0xecbf('0x52')]['id'];}return db[_0xecbf('0x35')]['find']({'where':{'id':_0x384c4e[_0xecbf('0x4f')]['id']}})[_0xecbf('0x1b')](handleEntityNotFound(_0x27349d,null))[_0xecbf('0x1b')](saveUpdates(_0x384c4e[_0xecbf('0x52')],null))[_0xecbf('0x1b')](respondWithResult(_0x27349d,null))[_0xecbf('0x23')](handleError(_0x27349d,null));};exports[_0xecbf('0x30')]=function(_0x15e6b7,_0xe396da){return db[_0xecbf('0x35')][_0xecbf('0x53')]({'where':{'id':_0x15e6b7[_0xecbf('0x4f')]['id']}})[_0xecbf('0x1b')](handleEntityNotFound(_0xe396da,null))[_0xecbf('0x1b')](removeEntity(_0xe396da,null))[_0xecbf('0x23')](handleError(_0xe396da,null));};exports[_0xecbf('0x54')]=function(_0x1668cf,_0x547e06,_0x1c070c){var _0x1a0ef8={};var _0x435034={};var _0x3ff11a;var _0x408cf7;return db[_0xecbf('0x35')][_0xecbf('0x55')]({'where':{'id':_0x1668cf[_0xecbf('0x4f')]['id']}})[_0xecbf('0x1b')](handleEntityNotFound(_0x547e06,null))[_0xecbf('0x1b')](function(_0x3896d4){if(_0x3896d4){_0x3ff11a=_0x3896d4;_0x435034[_0xecbf('0x3c')]=_[_0xecbf('0x50')](db[_0xecbf('0x56')][_0xecbf('0x36')]);_0x435034[_0xecbf('0x3a')]=_[_0xecbf('0x50')](_0x1668cf[_0xecbf('0x3a')]);_0x435034[_0xecbf('0x3b')]=_[_0xecbf('0x3d')](_0x435034['model'],_0x435034[_0xecbf('0x3a')]);_0x1a0ef8['attributes']=_[_0xecbf('0x3d')](_0x435034[_0xecbf('0x3c')],qs['fields'](_0x1668cf[_0xecbf('0x3a')][_0xecbf('0x3e')]));_0x1a0ef8['attributes']=_0x1a0ef8['attributes'][_0xecbf('0x40')]?_0x1a0ef8[_0xecbf('0x3f')]:_0x435034['model'];_0x1a0ef8[_0xecbf('0x43')]=qs[_0xecbf('0x44')](_0x1668cf[_0xecbf('0x3a')][_0xecbf('0x44')]);_0x1a0ef8[_0xecbf('0x45')]=qs[_0xecbf('0x3b')](_[_0xecbf('0x46')](_0x1668cf[_0xecbf('0x3a')],_0x435034[_0xecbf('0x3b')]));if(_0x1668cf['query'][_0xecbf('0x47')]){_0x1a0ef8['where']=_[_0xecbf('0x48')](_0x1a0ef8[_0xecbf('0x45')],{'$or':_['map'](_0x1a0ef8[_0xecbf('0x3f')],function(_0x400071){var _0x135747={};_0x135747[_0x400071]={'$like':'%'+_0x1668cf[_0xecbf('0x3a')][_0xecbf('0x47')]+'%'};return _0x135747;})});}_0x1a0ef8=_['merge']({},_0x1a0ef8,_0x1668cf['options']);return _0x3ff11a[_0xecbf('0x54')](_0x1a0ef8);}})[_0xecbf('0x1b')](function(_0x52149d){if(_0x52149d){_0x408cf7=_0x52149d[_0xecbf('0x40')];if(!_0x1668cf[_0xecbf('0x3a')][_0xecbf('0x41')](_0xecbf('0x42'))){_0x1a0ef8[_0xecbf('0x29')]=qs[_0xecbf('0x29')](_0x1668cf['query'][_0xecbf('0x29')]);_0x1a0ef8[_0xecbf('0x28')]=qs['offset'](_0x1668cf['query']['offset']);}return _0x3ff11a[_0xecbf('0x54')](_0x1a0ef8);}})[_0xecbf('0x1b')](function(_0x4ef906){if(_0x4ef906){return _0x4ef906?{'count':_0x408cf7,'rows':_0x4ef906}:null;}})[_0xecbf('0x1b')](respondWithResult(_0x547e06,null))[_0xecbf('0x23')](handleError(_0x547e06,null));};exports[_0xecbf('0x57')]=function(_0x50ec1e,_0x13dda6,_0x4cbfd6){if(_0x50ec1e[_0xecbf('0x52')]['id']){delete _0x50ec1e[_0xecbf('0x52')]['id'];}return db[_0xecbf('0x35')][_0xecbf('0x55')]({'where':{'id':_0x50ec1e[_0xecbf('0x4f')]['id']}})[_0xecbf('0x1b')](handleEntityNotFound(_0x13dda6,null))[_0xecbf('0x1b')](function(_0x2bfb5f){if(_0x2bfb5f){_0x50ec1e['body']['AccountId']=_0x2bfb5f['id'];_0x50ec1e[_0xecbf('0x52')][_0xecbf('0x58')]=integrations[_0xecbf('0x59')](_0x50ec1e[_0xecbf('0x52')][_0xecbf('0x5a')],_0x50ec1e['body'][_0xecbf('0x38')]);_0x50ec1e[_0xecbf('0x52')][_0xecbf('0x5b')]=integrations[_0xecbf('0x5c')](_0x50ec1e[_0xecbf('0x52')][_0xecbf('0x5a')],_0x50ec1e[_0xecbf('0x52')]['type']);return db['ServicenowConfiguration'][_0xecbf('0x51')](_0x50ec1e[_0xecbf('0x52')],{'include':[{'model':db['ServicenowField'],'as':_0xecbf('0x58')},{'model':db[_0xecbf('0x5d')],'as':_0xecbf('0x5b')}]});}return null;})['then'](respondWithResult(_0x13dda6,null))['catch'](handleError(_0x13dda6,null));};exports[_0xecbf('0x5e')]=function(_0x21adbd,_0x2cf330,_0x3214f3){var _0x2db4dd=['made_sla',_0xecbf('0x5f'),_0xecbf('0x60'),_0xecbf('0x61'),_0xecbf('0x62'),_0xecbf('0x63'),'incident_state',_0xecbf('0x64'),_0xecbf('0x65')];var _0x15512a=[_0xecbf('0x66'),'made_sla','caused_by',_0xecbf('0x67'),_0xecbf('0x68'),'sys_updated_on',_0xecbf('0x69'),_0xecbf('0x5f'),_0xecbf('0x6a'),'number','resolved_by',_0xecbf('0x6b'),_0xecbf('0x6c'),_0xecbf('0x6d'),_0xecbf('0x6e'),_0xecbf('0x6f'),'state',_0xecbf('0x70'),_0xecbf('0x60'),_0xecbf('0x43'),'calendar_stc',_0xecbf('0x71'),_0xecbf('0x72'),_0xecbf('0x73'),_0xecbf('0x74'),_0xecbf('0x75'),_0xecbf('0x76'),'business_service',_0xecbf('0x77'),_0xecbf('0x78'),'rfc','time_worked',_0xecbf('0x79'),_0xecbf('0x7a'),'business_duration',_0xecbf('0x7b'),_0xecbf('0x7c'),_0xecbf('0x7d'),'resolved_at',_0xecbf('0x7e'),'approval_set','subcategory',_0xecbf('0x7f'),_0xecbf('0x80'),_0xecbf('0x62'),'correlation_display',_0xecbf('0x81'),_0xecbf('0x82'),'assignment_group',_0xecbf('0x83'),_0xecbf('0x84'),_0xecbf('0x85'),'calendar_duration',_0xecbf('0x63'),_0xecbf('0x86'),_0xecbf('0x87'),'closed_by','follow_up',_0xecbf('0x88'),'sys_id','contact_type','reopened_by',_0xecbf('0x89'),_0xecbf('0x8a'),_0xecbf('0x8b'),_0xecbf('0x8c'),_0xecbf('0x8d'),'activity_due',_0xecbf('0x8e'),_0xecbf('0x64'),_0xecbf('0x8f'),'sla_due','approval',_0xecbf('0x90'),_0xecbf('0x91'),_0xecbf('0x92'),_0xecbf('0x93'),'sys_tags',_0xecbf('0x94'),_0xecbf('0x95'),_0xecbf('0x96'),_0xecbf('0x97'),'category'];var _0x43cf67='';var _0x200a78='';var _0x240659=[];var _0x36cfe3='';var _0x2297fb='';var _0x31ef06=[];var _0x4a2f41='';var _0x3f4aed='';var _0x471f5b={};var _0x36c5aa='';return db[_0xecbf('0x35')][_0xecbf('0x55')]({'where':{'id':_0x21adbd[_0xecbf('0x4f')]['id']},'attributes':['id',_0xecbf('0x98'),_0xecbf('0x99'),_0xecbf('0x9a'),_0xecbf('0x9b'),_0xecbf('0x9c')]})[_0xecbf('0x1b')](handleEntityNotFound(_0x2cf330,null))[_0xecbf('0x1b')](function(_0x3bd8e7){if(_0x3bd8e7){_0x36c5aa=_0x3bd8e7[_0xecbf('0x9b')];var _0x272d2f=_0x36c5aa[_0xecbf('0x9d')](-0x1);if(_0x272d2f==='/'){_0x36c5aa=_0x36c5aa[_0xecbf('0x9e')](0x0,_0x36c5aa[_0xecbf('0x9f')](_0x272d2f));}_0x3f4aed=util[_0xecbf('0xa0')](_0xecbf('0xa1'),_0x36c5aa);_0x4a2f41=util[_0xecbf('0xa0')](_0xecbf('0xa2'),_0x36c5aa);_0x471f5b={'user':_0x3bd8e7['username'],'pass':_0x3bd8e7[_0xecbf('0x99')]};var _0x3f76aa={'method':'GET','uri':_0x3f4aed+_0xecbf('0xa3'),'auth':_0x471f5b,'json':!![]};return rp(_0x3f76aa);}})[_0xecbf('0x1b')](function(_0x137b0e){if(_0x137b0e['result']['length']>0x0){_0x43cf67=_0x137b0e['result'];}console[_0xecbf('0xa4')](_0xecbf('0xa5'),_0x43cf67);_0x31ef06=[];_0x200a78=Object[_0xecbf('0xa6')]([],_0x43cf67);_[_0xecbf('0xa7')](_0x200a78,function(_0x519998){return!_0x2db4dd['includes'](_0x519998[_0xecbf('0x31')]);});_0x200a78[_0xecbf('0xa8')](function(_0x10410f){var _0x10cf86=createFieldObject(_0x4a2f41,_0x471f5b,_0x10410f[_0xecbf('0xa9')],_0x10410f[_0xecbf('0x31')],_0x10410f[_0xecbf('0xaa')],![]);_0x31ef06[_0xecbf('0xab')](_0x10cf86);});return Promise[_0xecbf('0xac')](_0x31ef06);})[_0xecbf('0x1b')](function(_0x1639b8){_0x240659=_0x1639b8;_0x36cfe3=Object['assign']([],_0x43cf67);console['log'](_0xecbf('0xad'),_0x43cf67);_[_0xecbf('0xa7')](_0x36cfe3,function(_0x5976d1){return _0x15512a[_0xecbf('0xae')](_0x5976d1[_0xecbf('0x31')]);});console[_0xecbf('0xa4')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x36cfe3);_0x31ef06=[];_0x36cfe3[_0xecbf('0xa8')](function(_0x4d3706){var _0x2b2c4f=createFieldObject(_0x4a2f41,_0x471f5b,_0x4d3706[_0xecbf('0xa9')],_0x4d3706['name'],_0x4d3706['label'],!![]);_0x31ef06[_0xecbf('0xab')](_0x2b2c4f);});return Promise[_0xecbf('0xac')](_0x31ef06);})['then'](function(_0x299364){_0x2297fb=_0x299364;var _0x20919c=_0x240659[_0xecbf('0xaf')](_0x2297fb);return{'count':_0x20919c['length'],'rows':_0x20919c};})[_0xecbf('0x1b')](respondWithResult(_0x2cf330,null))[_0xecbf('0x23')](function(_0x338355){console[_0xecbf('0xa4')](_0xecbf('0xb0')+_0x338355);var _0x2d4369=_0x21adbd[_0xecbf('0x3a')]['test']?0x1f4:_0x338355[_0xecbf('0xb1')]||0x1f4;logger[_0xecbf('0x20')](_0x338355[_0xecbf('0xb2')]);delete _0x338355[_0xecbf('0x31')];if(_0x2d4369===0x191){_0x2d4369=0x190;}_0x2cf330[_0xecbf('0x25')](_0x2d4369)[_0xecbf('0x32')](_0x21adbd[_0xecbf('0x3a')][_0xecbf('0xb3')]?{'message':_0xecbf('0xb4'),'statusCode':_0x338355[_0xecbf('0xb1')]}:_0x338355);});};function createFieldObject(_0x1ca461,_0x4a4608,_0x3f1f8e,_0x1d71d1,_0x3466cc,_0x316f89){return new Promise(function(_0x3cdb40,_0x5d2a1e){var _0x4efaf6={'id':_0x1d71d1,'name':_0x3466cc,'custom':_0x316f89};if(_0x3f1f8e==='boolean'){_0x4efaf6['options']=[{'name':'True','value':_0xecbf('0xb5')},{'name':_0xecbf('0xb6'),'value':_0xecbf('0xb7')}];_0x3cdb40(_0x4efaf6);}else{var _0x4ea1={'method':_0xecbf('0xb8'),'uri':_0x1ca461+'sys_choice?sysparm_query=name=incident^element='+_0x1d71d1,'auth':_0x4a4608,'json':!![]};return rp(_0x4ea1)['then'](function(_0xba07ac){var _0x273eb9=[];if(_0xba07ac['result'][_0xecbf('0x40')]>0x0){_0xba07ac[_0xecbf('0xb9')][_0xecbf('0xa8')](function(_0x2c2427){if(_0x2c2427['inactive']===_0xecbf('0xb7')){var _0x54b749={'name':_0x2c2427[_0xecbf('0xaa')],'value':_0x2c2427[_0xecbf('0xba')]};_0x273eb9['push'](_0x54b749);}});}_0x4efaf6[_0xecbf('0x49')]=_0x273eb9;if(_0x4efaf6[_0xecbf('0x49')][_0xecbf('0x40')]>0x0){_0x3cdb40(_0x4efaf6);}else{if(_0x316f89==![]){_0x3cdb40();}else{_0x3cdb40(_0x4efaf6);}}});}});} \ No newline at end of file +var _0x39df=['state','sys_created_by','knowledge','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','group_list','reopened_time','resolved_at','approval_set','subcategory','work_notes','correlation_display','delivery_task','work_start','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','severity','comments','sla_due','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','includes','forEach','internalType','label','push','all','assign','log','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','html-pdf','eml-format','fast-json-patch','request-promise','moment','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','../../components/integrations/configuration','jayson/promise','client','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','status','end','json','count','limit','set','apply','reject','save','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','catch','create','body','update','find','params','findOne','ServicenowConfiguration','hasOwnProperty','getConfigurations','Subjects','getSubjects','Descriptions','ServicenowField','getFields','made_sla','hold_reason','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','approval_history','number','resolved_by','sys_created_on'];(function(_0x1a085c,_0x5d0b09){var _0x2444db=function(_0x23add8){while(--_0x23add8){_0x1a085c['push'](_0x1a085c['shift']());}};_0x2444db(++_0x5d0b09);}(_0x39df,0x112));var _0xf39d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x39df[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0xf39d('0x0'));var emlformat=require(_0xf39d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf39d('0x2'));var rp=require(_0xf39d('0x3'));var moment=require(_0xf39d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf39d('0x5'));var csv=require(_0xf39d('0x6'));var ejs=require(_0xf39d('0x7'));var fs=require('fs');var fs_extra=require(_0xf39d('0x8'));var _=require(_0xf39d('0x9'));var squel=require('squel');var crypto=require(_0xf39d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf39d('0xb'));var toCsv=require(_0xf39d('0x6'));var querystring=require(_0xf39d('0xc'));var Papa=require(_0xf39d('0xd'));var Redis=require(_0xf39d('0xe'));var authService=require(_0xf39d('0xf'));var qs=require(_0xf39d('0x10'));var as=require(_0xf39d('0x11'));var hardwareService=require(_0xf39d('0x12'));var logger=require(_0xf39d('0x13'))(_0xf39d('0x14'));var utils=require(_0xf39d('0x15'));var config=require(_0xf39d('0x16'));var licenseUtil=require(_0xf39d('0x17'));var db=require(_0xf39d('0x18'))['db'];var integrations=require(_0xf39d('0x19'));var jayson=require(_0xf39d('0x1a'));var client=jayson[_0xf39d('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b8567,_0x4b1616,_0x2a2185,_0x3091f8){return new BPromise(function(_0x547e14,_0x14a137){var _0x4e0714=_0x3091f8||client;return _0x4e0714[_0xf39d('0x1c')](_0x3b8567,_0x2a2185)[_0xf39d('0x1d')](function(_0x290b6c){logger['info'](_0xf39d('0x1e'),_0x4b1616,_0xf39d('0x1f'));logger[_0xf39d('0x20')](_0xf39d('0x21'),_0x4b1616,_0xf39d('0x1f'),JSON['stringify'](_0x290b6c));if(_0x290b6c[_0xf39d('0x22')]){if(_0x290b6c[_0xf39d('0x22')][_0xf39d('0x23')]===0x1f4){logger['error'](_0xf39d('0x1e'),_0x4b1616,_0x290b6c['error'][_0xf39d('0x24')]);return _0x14a137(_0x290b6c[_0xf39d('0x22')][_0xf39d('0x24')]);}logger[_0xf39d('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x4b1616,_0x290b6c[_0xf39d('0x22')][_0xf39d('0x24')]);return _0x547e14(_0x290b6c[_0xf39d('0x22')][_0xf39d('0x24')]);}else{logger[_0xf39d('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0x4b1616,_0xf39d('0x1f'));_0x547e14(_0x290b6c['result'][_0xf39d('0x24')]);}})['catch'](function(_0x9544a2){logger[_0xf39d('0x22')](_0xf39d('0x1e'),_0x4b1616,_0x9544a2);_0x14a137(_0x9544a2);});});}function respondWithStatusCode(_0x4f17ec,_0x342669){_0x342669=_0x342669||0xcc;return function(_0xc80d86){if(_0xc80d86){return _0x4f17ec['sendStatus'](_0x342669);}return _0x4f17ec[_0xf39d('0x26')](_0x342669)[_0xf39d('0x27')]();};}function respondWithResult(_0x1fd670,_0x1bdfd6){_0x1bdfd6=_0x1bdfd6||0xc8;return function(_0x48fdf9){if(_0x48fdf9){return _0x1fd670[_0xf39d('0x26')](_0x1bdfd6)[_0xf39d('0x28')](_0x48fdf9);}};}function respondWithFilteredResult(_0x3aa507,_0xee09c1){return function(_0x15290a){if(_0x15290a){var _0x11ade4=_0x15290a[_0xf39d('0x29')],_0x57eb5a=_0xee09c1['offset'],_0x4da7ce=_0xee09c1['offset']+_0xee09c1[_0xf39d('0x2a')],_0x2ed2a5;if(_0x4da7ce>=_0x11ade4){_0x4da7ce=_0x11ade4;_0x2ed2a5=0xc8;}else{_0x2ed2a5=0xce;}_0x3aa507[_0xf39d('0x26')](_0x2ed2a5);return _0x3aa507[_0xf39d('0x2b')]('Content-Range',_0x57eb5a+'-'+_0x4da7ce+'/'+_0x11ade4)[_0xf39d('0x28')](_0x15290a);}return null;};}function patchUpdates(_0x4ee053){return function(_0x39b4d4){try{jsonpatch[_0xf39d('0x2c')](_0x39b4d4,_0x4ee053,!![]);}catch(_0x482dee){return BPromise[_0xf39d('0x2d')](_0x482dee);}return _0x39b4d4[_0xf39d('0x2e')]();};}function saveUpdates(_0x39e301,_0x561f04){return function(_0x5c2a45){if(_0x5c2a45){return _0x5c2a45['update'](_0x39e301)[_0xf39d('0x1d')](function(_0x5a4c18){return _0x5a4c18;});}return null;};}function removeEntity(_0x29c2f4,_0x2f0ec8){return function(_0x412903){if(_0x412903){return _0x412903[_0xf39d('0x2f')]()[_0xf39d('0x1d')](function(){_0x29c2f4[_0xf39d('0x26')](0xcc)[_0xf39d('0x27')]();});}};}function handleEntityNotFound(_0x4e15bd,_0x4376dc){return function(_0x170d7e){if(!_0x170d7e){_0x4e15bd['sendStatus'](0x194);}return _0x170d7e;};}function handleError(_0x1def82,_0x28dca0){_0x28dca0=_0x28dca0||0x1f4;return function(_0x784b37){logger['error'](_0x784b37[_0xf39d('0x30')]);if(_0x784b37[_0xf39d('0x31')]){delete _0x784b37[_0xf39d('0x31')];}_0x1def82[_0xf39d('0x26')](_0x28dca0)[_0xf39d('0x32')](_0x784b37);};}exports[_0xf39d('0x33')]=function(_0x3d53e2,_0xa7ff51){var _0x10512e={},_0x196fa7={},_0x32d7ff={'count':0x0,'rows':[]};var _0x2ce777=_[_0xf39d('0x34')](db[_0xf39d('0x35')][_0xf39d('0x36')],function(_0x25114a){return{'name':_0x25114a[_0xf39d('0x37')],'type':_0x25114a[_0xf39d('0x38')][_0xf39d('0x39')]};});_0x196fa7[_0xf39d('0x3a')]=_[_0xf39d('0x34')](_0x2ce777,'name');_0x196fa7['query']=_[_0xf39d('0x3b')](_0x3d53e2[_0xf39d('0x3c')]);_0x196fa7['filters']=_['intersection'](_0x196fa7[_0xf39d('0x3a')],_0x196fa7[_0xf39d('0x3c')]);_0x10512e[_0xf39d('0x3d')]=_[_0xf39d('0x3e')](_0x196fa7['model'],qs[_0xf39d('0x3f')](_0x3d53e2[_0xf39d('0x3c')][_0xf39d('0x3f')]));_0x10512e['attributes']=_0x10512e[_0xf39d('0x3d')][_0xf39d('0x40')]?_0x10512e[_0xf39d('0x3d')]:_0x196fa7[_0xf39d('0x3a')];if(!_0x3d53e2[_0xf39d('0x3c')]['hasOwnProperty'](_0xf39d('0x41'))){_0x10512e[_0xf39d('0x2a')]=qs[_0xf39d('0x2a')](_0x3d53e2[_0xf39d('0x3c')][_0xf39d('0x2a')]);_0x10512e[_0xf39d('0x42')]=qs['offset'](_0x3d53e2[_0xf39d('0x3c')][_0xf39d('0x42')]);}_0x10512e[_0xf39d('0x43')]=qs[_0xf39d('0x44')](_0x3d53e2[_0xf39d('0x3c')][_0xf39d('0x44')]);_0x10512e[_0xf39d('0x45')]=qs[_0xf39d('0x46')](_[_0xf39d('0x47')](_0x3d53e2['query'],_0x196fa7[_0xf39d('0x46')]),_0x2ce777);if(_0x3d53e2[_0xf39d('0x3c')][_0xf39d('0x48')]){_0x10512e[_0xf39d('0x45')]=_[_0xf39d('0x49')](_0x10512e[_0xf39d('0x45')],{'$or':_[_0xf39d('0x34')](_0x2ce777,function(_0x16dbeb){if(_0x16dbeb[_0xf39d('0x38')]!==_0xf39d('0x4a')){var _0x41910b={};_0x41910b[_0x16dbeb[_0xf39d('0x31')]]={'$like':'%'+_0x3d53e2['query'][_0xf39d('0x48')]+'%'};return _0x41910b;}})});}_0x10512e=_[_0xf39d('0x49')]({},_0x10512e,_0x3d53e2['options']);var _0x4753e1={'where':_0x10512e['where']};return db['ServicenowAccount'][_0xf39d('0x29')](_0x4753e1)[_0xf39d('0x1d')](function(_0x418e9d){_0x32d7ff['count']=_0x418e9d;if(_0x3d53e2[_0xf39d('0x3c')][_0xf39d('0x4b')]){_0x10512e[_0xf39d('0x4c')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xf39d('0x4d')](_0x10512e);})['then'](function(_0x50a73c){_0x32d7ff[_0xf39d('0x4e')]=_0x50a73c;return _0x32d7ff;})[_0xf39d('0x1d')](respondWithFilteredResult(_0xa7ff51,_0x10512e))['catch'](handleError(_0xa7ff51,null));};exports[_0xf39d('0x4f')]=function(_0x4f73a4,_0x157cf9){var _0x3e8595={'raw':![],'where':{'id':_0x4f73a4['params']['id']}},_0x1ad2c2={};_0x1ad2c2[_0xf39d('0x3a')]=_[_0xf39d('0x3b')](db[_0xf39d('0x35')]['rawAttributes']);_0x1ad2c2[_0xf39d('0x3c')]=_['keys'](_0x4f73a4[_0xf39d('0x3c')]);_0x1ad2c2[_0xf39d('0x46')]=_[_0xf39d('0x3e')](_0x1ad2c2[_0xf39d('0x3a')],_0x1ad2c2[_0xf39d('0x3c')]);_0x3e8595[_0xf39d('0x3d')]=_['intersection'](_0x1ad2c2[_0xf39d('0x3a')],qs[_0xf39d('0x3f')](_0x4f73a4[_0xf39d('0x3c')][_0xf39d('0x3f')]));_0x3e8595[_0xf39d('0x3d')]=_0x3e8595[_0xf39d('0x3d')][_0xf39d('0x40')]?_0x3e8595[_0xf39d('0x3d')]:_0x1ad2c2[_0xf39d('0x3a')];if(_0x4f73a4[_0xf39d('0x3c')][_0xf39d('0x4b')]){_0x3e8595['include']=[{'all':!![]}];}_0x3e8595=_[_0xf39d('0x49')]({},_0x3e8595,_0x4f73a4[_0xf39d('0x50')]);return db[_0xf39d('0x35')]['find'](_0x3e8595)['then'](handleEntityNotFound(_0x157cf9,null))[_0xf39d('0x1d')](respondWithResult(_0x157cf9,null))[_0xf39d('0x51')](handleError(_0x157cf9,null));};exports[_0xf39d('0x52')]=function(_0x45038e,_0x53cef1){return db['ServicenowAccount']['create'](_0x45038e[_0xf39d('0x53')],{})[_0xf39d('0x1d')](respondWithResult(_0x53cef1,0xc9))['catch'](handleError(_0x53cef1,null));};exports[_0xf39d('0x54')]=function(_0x17c1eb,_0x2dc7d5){if(_0x17c1eb[_0xf39d('0x53')]['id']){delete _0x17c1eb[_0xf39d('0x53')]['id'];}return db[_0xf39d('0x35')]['find']({'where':{'id':_0x17c1eb['params']['id']}})[_0xf39d('0x1d')](handleEntityNotFound(_0x2dc7d5,null))['then'](saveUpdates(_0x17c1eb['body'],null))['then'](respondWithResult(_0x2dc7d5,null))[_0xf39d('0x51')](handleError(_0x2dc7d5,null));};exports['destroy']=function(_0xcc9f8,_0x29ccc0){return db[_0xf39d('0x35')][_0xf39d('0x55')]({'where':{'id':_0xcc9f8[_0xf39d('0x56')]['id']}})['then'](handleEntityNotFound(_0x29ccc0,null))[_0xf39d('0x1d')](removeEntity(_0x29ccc0,null))[_0xf39d('0x51')](handleError(_0x29ccc0,null));};exports['getConfigurations']=function(_0x31d800,_0x5f56a3,_0x24ecfc){var _0x3faaac={};var _0x39c0f5={};var _0x2c7453;var _0x5dba92;return db[_0xf39d('0x35')][_0xf39d('0x57')]({'where':{'id':_0x31d800[_0xf39d('0x56')]['id']}})[_0xf39d('0x1d')](handleEntityNotFound(_0x5f56a3,null))['then'](function(_0x27dcda){if(_0x27dcda){_0x2c7453=_0x27dcda;_0x39c0f5[_0xf39d('0x3a')]=_[_0xf39d('0x3b')](db[_0xf39d('0x58')][_0xf39d('0x36')]);_0x39c0f5[_0xf39d('0x3c')]=_[_0xf39d('0x3b')](_0x31d800[_0xf39d('0x3c')]);_0x39c0f5['filters']=_['intersection'](_0x39c0f5['model'],_0x39c0f5[_0xf39d('0x3c')]);_0x3faaac[_0xf39d('0x3d')]=_[_0xf39d('0x3e')](_0x39c0f5[_0xf39d('0x3a')],qs[_0xf39d('0x3f')](_0x31d800['query'][_0xf39d('0x3f')]));_0x3faaac[_0xf39d('0x3d')]=_0x3faaac[_0xf39d('0x3d')][_0xf39d('0x40')]?_0x3faaac[_0xf39d('0x3d')]:_0x39c0f5[_0xf39d('0x3a')];_0x3faaac[_0xf39d('0x43')]=qs[_0xf39d('0x44')](_0x31d800['query'][_0xf39d('0x44')]);_0x3faaac[_0xf39d('0x45')]=qs[_0xf39d('0x46')](_[_0xf39d('0x47')](_0x31d800['query'],_0x39c0f5[_0xf39d('0x46')]));if(_0x31d800[_0xf39d('0x3c')][_0xf39d('0x48')]){_0x3faaac['where']=_['merge'](_0x3faaac[_0xf39d('0x45')],{'$or':_[_0xf39d('0x34')](_0x3faaac[_0xf39d('0x3d')],function(_0x5701d9){var _0x59a87f={};_0x59a87f[_0x5701d9]={'$like':'%'+_0x31d800[_0xf39d('0x3c')][_0xf39d('0x48')]+'%'};return _0x59a87f;})});}_0x3faaac=_[_0xf39d('0x49')]({},_0x3faaac,_0x31d800[_0xf39d('0x50')]);return _0x2c7453['getConfigurations'](_0x3faaac);}})[_0xf39d('0x1d')](function(_0x2e9773){if(_0x2e9773){_0x5dba92=_0x2e9773[_0xf39d('0x40')];if(!_0x31d800['query'][_0xf39d('0x59')](_0xf39d('0x41'))){_0x3faaac[_0xf39d('0x2a')]=qs['limit'](_0x31d800[_0xf39d('0x3c')][_0xf39d('0x2a')]);_0x3faaac[_0xf39d('0x42')]=qs['offset'](_0x31d800['query'][_0xf39d('0x42')]);}return _0x2c7453[_0xf39d('0x5a')](_0x3faaac);}})[_0xf39d('0x1d')](function(_0x20d87d){if(_0x20d87d){return _0x20d87d?{'count':_0x5dba92,'rows':_0x20d87d}:null;}})[_0xf39d('0x1d')](respondWithResult(_0x5f56a3,null))[_0xf39d('0x51')](handleError(_0x5f56a3,null));};exports['addConfiguration']=function(_0x3d0d5d,_0x5aef72,_0x5a23bc){if(_0x3d0d5d[_0xf39d('0x53')]['id']){delete _0x3d0d5d['body']['id'];}return db[_0xf39d('0x35')][_0xf39d('0x57')]({'where':{'id':_0x3d0d5d['params']['id']}})['then'](handleEntityNotFound(_0x5aef72,null))[_0xf39d('0x1d')](function(_0x41917e){if(_0x41917e){_0x3d0d5d[_0xf39d('0x53')]['AccountId']=_0x41917e['id'];_0x3d0d5d[_0xf39d('0x53')][_0xf39d('0x5b')]=integrations[_0xf39d('0x5c')](_0x3d0d5d[_0xf39d('0x53')]['channel'],_0x3d0d5d['body'][_0xf39d('0x38')]);_0x3d0d5d[_0xf39d('0x53')][_0xf39d('0x5d')]=integrations['getDescriptions'](_0x3d0d5d[_0xf39d('0x53')]['channel'],_0x3d0d5d[_0xf39d('0x53')][_0xf39d('0x38')]);return db['ServicenowConfiguration'][_0xf39d('0x52')](_0x3d0d5d['body'],{'include':[{'model':db[_0xf39d('0x5e')],'as':_0xf39d('0x5b')},{'model':db[_0xf39d('0x5e')],'as':_0xf39d('0x5d')}]});}return null;})[_0xf39d('0x1d')](respondWithResult(_0x5aef72,null))['catch'](handleError(_0x5aef72,null));};exports[_0xf39d('0x5f')]=function(_0x3b141e,_0x12655d,_0x4f8ee1){var _0xd3b25f=[_0xf39d('0x60'),_0xf39d('0x61'),'knowledge','subcategory',_0xf39d('0x62'),_0xf39d('0x63'),_0xf39d('0x64'),'severity',_0xf39d('0x65')];var _0x5bc5b0=[_0xf39d('0x66'),_0xf39d('0x60'),_0xf39d('0x67'),_0xf39d('0x68'),_0xf39d('0x69'),'sys_updated_on','child_incidents',_0xf39d('0x61'),_0xf39d('0x6a'),_0xf39d('0x6b'),_0xf39d('0x6c'),'sys_updated_by','opened_by','user_input',_0xf39d('0x6d'),'sys_domain',_0xf39d('0x6e'),_0xf39d('0x6f'),_0xf39d('0x70'),_0xf39d('0x43'),'calendar_stc',_0xf39d('0x71'),_0xf39d('0x72'),_0xf39d('0x73'),_0xf39d('0x74'),_0xf39d('0x75'),_0xf39d('0x76'),_0xf39d('0x77'),_0xf39d('0x78'),_0xf39d('0x79'),_0xf39d('0x7a'),_0xf39d('0x7b'),'expected_start',_0xf39d('0x7c'),'business_duration',_0xf39d('0x7d'),'work_end',_0xf39d('0x7e'),_0xf39d('0x7f'),'caller_id',_0xf39d('0x80'),_0xf39d('0x81'),_0xf39d('0x82'),'short_description',_0xf39d('0x62'),_0xf39d('0x83'),_0xf39d('0x84'),_0xf39d('0x85'),'assignment_group','business_stc',_0xf39d('0x86'),_0xf39d('0x87'),_0xf39d('0x88'),_0xf39d('0x63'),_0xf39d('0x89'),'close_notes',_0xf39d('0x8a'),_0xf39d('0x8b'),_0xf39d('0x8c'),'sys_id',_0xf39d('0x8d'),_0xf39d('0x8e'),'incident_state',_0xf39d('0x8f'),_0xf39d('0x90'),_0xf39d('0x91'),_0xf39d('0x92'),'activity_due',_0xf39d('0x93'),_0xf39d('0x94'),_0xf39d('0x95'),_0xf39d('0x96'),'approval',_0xf39d('0x97'),_0xf39d('0x98'),'sys_mod_count',_0xf39d('0x99'),_0xf39d('0x9a'),_0xf39d('0x9b'),_0xf39d('0x9c'),_0xf39d('0x9d'),_0xf39d('0x9e'),_0xf39d('0x65')];var _0x83dab8='';var _0x255528='';var _0x92bf59=[];var _0x3cc23d='';var _0x340e93='';var _0x15b70b=[];var _0x5c1f2c='';var _0x2dec41='';var _0x45e998={};var _0xca15be='';return db[_0xf39d('0x35')]['findOne']({'where':{'id':_0x3b141e[_0xf39d('0x56')]['id']},'attributes':['id',_0xf39d('0x9f'),_0xf39d('0xa0'),_0xf39d('0xa1'),_0xf39d('0xa2'),_0xf39d('0xa3')]})[_0xf39d('0x1d')](handleEntityNotFound(_0x12655d,null))['then'](function(_0x3ce4bd){if(_0x3ce4bd){_0xca15be=_0x3ce4bd['remoteUri'];var _0x505f86=_0xca15be[_0xf39d('0xa4')](-0x1);if(_0x505f86==='/'){_0xca15be=_0xca15be['substring'](0x0,_0xca15be['lastIndexOf'](_0x505f86));}_0x2dec41=util[_0xf39d('0xa5')](_0xf39d('0xa6'),_0xca15be);_0x5c1f2c=util[_0xf39d('0xa5')](_0xf39d('0xa7'),_0xca15be);_0x45e998={'user':_0x3ce4bd['username'],'pass':_0x3ce4bd['password']};var _0x398055={'method':_0xf39d('0xa8'),'uri':_0x2dec41+_0xf39d('0xa9'),'auth':_0x45e998,'json':!![]};return rp(_0x398055);}})[_0xf39d('0x1d')](function(_0xbb4359){if(_0xbb4359[_0xf39d('0xaa')][_0xf39d('0x40')]>0x0){_0x83dab8=_0xbb4359['result'];}console['log'](_0xf39d('0xab'),_0x83dab8);_0x15b70b=[];_0x255528=Object['assign']([],_0x83dab8);_['remove'](_0x255528,function(_0x29cb5a){return!_0xd3b25f[_0xf39d('0xac')](_0x29cb5a[_0xf39d('0x31')]);});_0x255528[_0xf39d('0xad')](function(_0x476f2d){var _0x388ff5=createFieldObject(_0x5c1f2c,_0x45e998,_0x476f2d[_0xf39d('0xae')],_0x476f2d[_0xf39d('0x31')],_0x476f2d[_0xf39d('0xaf')],![]);_0x15b70b[_0xf39d('0xb0')](_0x388ff5);});return Promise[_0xf39d('0xb1')](_0x15b70b);})[_0xf39d('0x1d')](function(_0x333c20){_0x92bf59=_0x333c20;_0x3cc23d=Object[_0xf39d('0xb2')]([],_0x83dab8);console[_0xf39d('0xb3')]('TCL:\x20_object',_0x83dab8);_['remove'](_0x3cc23d,function(_0x28a4f9){return _0x5bc5b0['includes'](_0x28a4f9[_0xf39d('0x31')]);});console[_0xf39d('0xb3')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3cc23d);_0x15b70b=[];_0x3cc23d[_0xf39d('0xad')](function(_0xa8d8d5){var _0xda3ac8=createFieldObject(_0x5c1f2c,_0x45e998,_0xa8d8d5[_0xf39d('0xae')],_0xa8d8d5[_0xf39d('0x31')],_0xa8d8d5[_0xf39d('0xaf')],!![]);_0x15b70b[_0xf39d('0xb0')](_0xda3ac8);});return Promise[_0xf39d('0xb1')](_0x15b70b);})[_0xf39d('0x1d')](function(_0x3ff630){_0x340e93=_0x3ff630;var _0x3fa4a2=_0x92bf59[_0xf39d('0xb4')](_0x340e93);return{'count':_0x3fa4a2[_0xf39d('0x40')],'rows':_0x3fa4a2};})['then'](respondWithResult(_0x12655d,null))[_0xf39d('0x51')](function(_0x18d468){console['log'](_0xf39d('0xb5')+_0x18d468);var _0x57b2ae=_0x3b141e[_0xf39d('0x3c')][_0xf39d('0xb6')]?0x1f4:_0x18d468[_0xf39d('0xb7')]||0x1f4;logger[_0xf39d('0x22')](_0x18d468[_0xf39d('0x30')]);delete _0x18d468['name'];if(_0x57b2ae===0x191){_0x57b2ae=0x190;}_0x12655d[_0xf39d('0x26')](_0x57b2ae)['send'](_0x3b141e[_0xf39d('0x3c')][_0xf39d('0xb6')]?{'message':_0xf39d('0xb8'),'statusCode':_0x18d468[_0xf39d('0xb7')]}:_0x18d468);});};function createFieldObject(_0x2dada0,_0x579f4c,_0x2f9a20,_0x258bcd,_0x59a494,_0xa95313){return new Promise(function(_0x25d169,_0x113e61){var _0x2c1d41={'id':_0x258bcd,'name':_0x59a494,'custom':_0xa95313};if(_0x2f9a20===_0xf39d('0xb9')){_0x2c1d41[_0xf39d('0x50')]=[{'name':_0xf39d('0xba'),'value':'true'},{'name':_0xf39d('0xbb'),'value':'false'}];_0x25d169(_0x2c1d41);}else{var _0x2da2c3={'method':_0xf39d('0xa8'),'uri':_0x2dada0+_0xf39d('0xbc')+_0x258bcd,'auth':_0x579f4c,'json':!![]};return rp(_0x2da2c3)['then'](function(_0x53ff31){var _0x5d61d4=[];if(_0x53ff31[_0xf39d('0xaa')]['length']>0x0){_0x53ff31[_0xf39d('0xaa')][_0xf39d('0xad')](function(_0x4ceee5){if(_0x4ceee5[_0xf39d('0xbd')]===_0xf39d('0xbe')){var _0x25b7cb={'name':_0x4ceee5[_0xf39d('0xaf')],'value':_0x4ceee5[_0xf39d('0xbf')]};_0x5d61d4[_0xf39d('0xb0')](_0x25b7cb);}});}_0x2c1d41[_0xf39d('0x50')]=_0x5d61d4;if(_0x2c1d41[_0xf39d('0x50')][_0xf39d('0x40')]>0x0){_0x25d169(_0x2c1d41);}else{if(_0xa95313==![]){_0x25d169();}else{_0x25d169(_0x2c1d41);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 26acfdd..dcb0e69 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 _0xee14=['ServicenowAccount','int_servicenow_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define'];(function(_0x32b642,_0x3c767e){var _0x132a27=function(_0x2066ef){while(--_0x2066ef){_0x32b642['push'](_0x32b642['shift']());}};_0x132a27(++_0x3c767e);}(_0xee14,0x13a));var _0x4ee1=function(_0x59828f,_0x4f2d86){_0x59828f=_0x59828f-0x0;var _0x52dc20=_0xee14[_0x59828f];return _0x52dc20;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var BPromise=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var fs=require('fs');var path=require(_0x4ee1('0x5'));var rimraf=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var attributes=require(_0x4ee1('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x4ee1('0x9')]=function(_0x573700,_0x327c18){return _0x573700[_0x4ee1('0xa')](_0x4ee1('0xb'),attributes,{'tableName':_0x4ee1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e85=['define','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0e85,0x7c));var _0x50e8=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x0e85[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var logger=require('../../config/logger')(_0x50e8('0x2'));var moment=require(_0x50e8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50e8('0x4'));var config=require('../../config/environment');var attributes=require(_0x50e8('0x5'));var integrations=require(_0x50e8('0x6'));module[_0x50e8('0x7')]=function(_0xfde42,_0x5e8b01){return _0xfde42[_0x50e8('0x8')](_0x50e8('0x9'),attributes,{'tableName':_0x50e8('0xa'),'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 428d99e..bd16a3e 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 _0xa84e=['map','model','then','find','ShowServicenowAccount','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include'];(function(_0x22bc7d,_0x37ce57){var _0x316f36=function(_0x56bda1){while(--_0x56bda1){_0x22bc7d['push'](_0x22bc7d['shift']());}};_0x316f36(++_0x37ce57);}(_0xa84e,0x11d));var _0xea84=function(_0x43b88c,_0x46fb04){_0x43b88c=_0x43b88c-0x0;var _0x407299=_0xa84e[_0x43b88c];return _0x407299;};'use strict';var _=require(_0xea84('0x0'));var util=require('util');var moment=require(_0xea84('0x1'));var BPromise=require(_0xea84('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea84('0x3'))['db'];var utils=require(_0xea84('0x4'));var logger=require(_0xea84('0x5'))(_0xea84('0x6'));var config=require(_0xea84('0x7'));var jayson=require(_0xea84('0x8'));var client=jayson[_0xea84('0x9')][_0xea84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54cf76,_0xcdc057,_0xc389e){return new BPromise(function(_0x2b426b,_0x43f6a5){return client[_0xea84('0xb')](_0x54cf76,_0xc389e)['then'](function(_0xa5bda6){logger[_0xea84('0xc')](_0xea84('0xd'),_0xcdc057,_0xea84('0xe'));logger[_0xea84('0xf')](_0xea84('0x10'),_0xcdc057,_0xea84('0xe'),JSON[_0xea84('0x11')](_0xa5bda6));if(_0xa5bda6[_0xea84('0x12')]){if(_0xa5bda6[_0xea84('0x12')]['code']===0x1f4){logger[_0xea84('0x12')](_0xea84('0xd'),_0xcdc057,_0xa5bda6['error']['message']);return _0x43f6a5(_0xa5bda6['error'][_0xea84('0x13')]);}logger[_0xea84('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0xcdc057,_0xa5bda6[_0xea84('0x12')][_0xea84('0x13')]);return _0x2b426b(_0xa5bda6[_0xea84('0x12')]['message']);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0xcdc057,_0xea84('0xe'));_0x2b426b(_0xa5bda6[_0xea84('0x14')][_0xea84('0x13')]);}})[_0xea84('0x15')](function(_0x3efe5d){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0xcdc057,_0x3efe5d);_0x43f6a5(_0x3efe5d);});});}exports[_0xea84('0x16')]=function(_0x5ceea9){var _0x2b0a03=this;return new Promise(function(_0x212651,_0x282f29){return db[_0xea84('0x17')][_0xea84('0x18')]({'raw':_0x5ceea9[_0xea84('0x19')]?_0x5ceea9[_0xea84('0x19')][_0xea84('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ceea9[_0xea84('0x19')]?_0x5ceea9[_0xea84('0x19')]['where']||null:null,'attributes':_0x5ceea9['options']?_0x5ceea9['options'][_0xea84('0x1b')]||null:null,'limit':_0x5ceea9[_0xea84('0x19')]?_0x5ceea9['options'][_0xea84('0x1c')]||null:null,'include':_0x5ceea9['options']?_0x5ceea9['options'][_0xea84('0x1d')]?_[_0xea84('0x1e')](_0x5ceea9[_0xea84('0x19')][_0xea84('0x1d')],function(_0x296033){return{'model':db[_0x296033[_0xea84('0x1f')]],'as':_0x296033['as'],'attributes':_0x296033[_0xea84('0x1b')],'include':_0x296033[_0xea84('0x1d')]?_[_0xea84('0x1e')](_0x296033[_0xea84('0x1d')],function(_0x492c59){return{'model':db[_0x492c59[_0xea84('0x1f')]],'as':_0x492c59['as'],'attributes':_0x492c59[_0xea84('0x1b')],'include':_0x492c59[_0xea84('0x1d')]?_[_0xea84('0x1e')](_0x492c59['include'],function(_0x3778ef){return{'model':db[_0x3778ef['model']],'as':_0x3778ef['as'],'attributes':_0x3778ef[_0xea84('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xea84('0x20')](function(_0x3ef74f){logger[_0xea84('0xc')](_0xea84('0x16'),_0x5ceea9);logger['debug']('GetServicenowAccount',_0x5ceea9,JSON[_0xea84('0x11')](_0x3ef74f));_0x212651(_0x3ef74f);})[_0xea84('0x15')](function(_0x3128f1){logger[_0xea84('0x12')](_0xea84('0x16'),_0x3128f1[_0xea84('0x13')],_0x5ceea9);_0x282f29(_0x2b0a03[_0xea84('0x12')](0x1f4,_0x3128f1[_0xea84('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x4c7040){var _0x482ab4=this;return new Promise(function(_0x3f5dc2,_0xdff95f){return db[_0xea84('0x17')][_0xea84('0x21')]({'raw':_0x4c7040[_0xea84('0x19')]?_0x4c7040[_0xea84('0x19')][_0xea84('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c7040['options']?_0x4c7040['options']['where']||null:null,'attributes':_0x4c7040[_0xea84('0x19')]?_0x4c7040[_0xea84('0x19')][_0xea84('0x1b')]||null:null,'include':_0x4c7040[_0xea84('0x19')]?_0x4c7040[_0xea84('0x19')][_0xea84('0x1d')]?_[_0xea84('0x1e')](_0x4c7040['options'][_0xea84('0x1d')],function(_0x39fa1e){return{'model':db[_0x39fa1e[_0xea84('0x1f')]],'as':_0x39fa1e['as'],'attributes':_0x39fa1e[_0xea84('0x1b')],'include':_0x39fa1e[_0xea84('0x1d')]?_[_0xea84('0x1e')](_0x39fa1e[_0xea84('0x1d')],function(_0x16932b){return{'model':db[_0x16932b[_0xea84('0x1f')]],'as':_0x16932b['as'],'attributes':_0x16932b['attributes'],'include':_0x16932b['include']?_[_0xea84('0x1e')](_0x16932b[_0xea84('0x1d')],function(_0x391ee8){return{'model':db[_0x391ee8[_0xea84('0x1f')]],'as':_0x391ee8['as'],'attributes':_0x391ee8[_0xea84('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d5f10){logger[_0xea84('0xc')](_0xea84('0x22'),_0x4c7040);logger[_0xea84('0xf')](_0xea84('0x22'),_0x4c7040,JSON[_0xea84('0x11')](_0x4d5f10));_0x3f5dc2(_0x4d5f10);})[_0xea84('0x15')](function(_0x36144c){logger[_0xea84('0x12')](_0xea84('0x22'),_0x36144c[_0xea84('0x13')],_0x4c7040);_0xdff95f(_0x482ab4[_0xea84('0x12')](0x1f4,_0x36144c[_0xea84('0x13')]));});});}; \ No newline at end of file +var _0x8d9e=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','include','map','model','stringify','ShowServicenowAccount','where','catch'];(function(_0xf1a430,_0x32b4c4){var _0x45170d=function(_0x506515){while(--_0x506515){_0xf1a430['push'](_0xf1a430['shift']());}};_0x45170d(++_0x32b4c4);}(_0x8d9e,0x1a4));var _0xe8d9=function(_0x25c8d8,_0x523bdb){_0x25c8d8=_0x25c8d8-0x0;var _0x10b3bc=_0x8d9e[_0x25c8d8];return _0x10b3bc;};'use strict';var _=require(_0xe8d9('0x0'));var util=require(_0xe8d9('0x1'));var moment=require(_0xe8d9('0x2'));var BPromise=require(_0xe8d9('0x3'));var rs=require(_0xe8d9('0x4'));var fs=require('fs');var Redis=require(_0xe8d9('0x5'));var db=require(_0xe8d9('0x6'))['db'];var utils=require(_0xe8d9('0x7'));var logger=require(_0xe8d9('0x8'))('rpc');var config=require(_0xe8d9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe8d9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a43f8,_0x1a6fc8,_0x26ffa9){return new BPromise(function(_0x135f97,_0x42c587){return client[_0xe8d9('0xb')](_0x1a43f8,_0x26ffa9)[_0xe8d9('0xc')](function(_0x23d69f){logger['info'](_0xe8d9('0xd'),_0x1a6fc8,'request\x20sent');logger[_0xe8d9('0xe')](_0xe8d9('0xf'),_0x1a6fc8,_0xe8d9('0x10'),JSON['stringify'](_0x23d69f));if(_0x23d69f[_0xe8d9('0x11')]){if(_0x23d69f[_0xe8d9('0x11')][_0xe8d9('0x12')]===0x1f4){logger[_0xe8d9('0x11')](_0xe8d9('0xd'),_0x1a6fc8,_0x23d69f[_0xe8d9('0x11')][_0xe8d9('0x13')]);return _0x42c587(_0x23d69f[_0xe8d9('0x11')]['message']);}logger[_0xe8d9('0x11')](_0xe8d9('0xd'),_0x1a6fc8,_0x23d69f[_0xe8d9('0x11')][_0xe8d9('0x13')]);return _0x135f97(_0x23d69f[_0xe8d9('0x11')]['message']);}else{logger[_0xe8d9('0x14')](_0xe8d9('0xd'),_0x1a6fc8,_0xe8d9('0x10'));_0x135f97(_0x23d69f[_0xe8d9('0x15')][_0xe8d9('0x13')]);}})['catch'](function(_0x529d32){logger['error'](_0xe8d9('0xd'),_0x1a6fc8,_0x529d32);_0x42c587(_0x529d32);});});}exports[_0xe8d9('0x16')]=function(_0x5e0452){var _0x5d7e2b=this;return new Promise(function(_0x340a37,_0x26a5b7){return db[_0xe8d9('0x17')][_0xe8d9('0x18')]({'raw':_0x5e0452[_0xe8d9('0x19')]?_0x5e0452[_0xe8d9('0x19')][_0xe8d9('0x1a')]===undefined?!![]:![]:!![],'where':_0x5e0452[_0xe8d9('0x19')]?_0x5e0452['options']['where']||null:null,'attributes':_0x5e0452[_0xe8d9('0x19')]?_0x5e0452[_0xe8d9('0x19')][_0xe8d9('0x1b')]||null:null,'limit':_0x5e0452[_0xe8d9('0x19')]?_0x5e0452[_0xe8d9('0x19')]['limit']||null:null,'include':_0x5e0452['options']?_0x5e0452[_0xe8d9('0x19')][_0xe8d9('0x1c')]?_[_0xe8d9('0x1d')](_0x5e0452['options'][_0xe8d9('0x1c')],function(_0x577911){return{'model':db[_0x577911[_0xe8d9('0x1e')]],'as':_0x577911['as'],'attributes':_0x577911['attributes'],'include':_0x577911['include']?_['map'](_0x577911[_0xe8d9('0x1c')],function(_0x16488e){return{'model':db[_0x16488e[_0xe8d9('0x1e')]],'as':_0x16488e['as'],'attributes':_0x16488e['attributes'],'include':_0x16488e[_0xe8d9('0x1c')]?_[_0xe8d9('0x1d')](_0x16488e['include'],function(_0x3a03c2){return{'model':db[_0x3a03c2['model']],'as':_0x3a03c2['as'],'attributes':_0x3a03c2[_0xe8d9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe8d9('0xc')](function(_0x12664d){logger[_0xe8d9('0x14')]('GetServicenowAccount',_0x5e0452);logger['debug'](_0xe8d9('0x16'),_0x5e0452,JSON[_0xe8d9('0x1f')](_0x12664d));_0x340a37(_0x12664d);})['catch'](function(_0x26a0c7){logger['error']('GetServicenowAccount',_0x26a0c7[_0xe8d9('0x13')],_0x5e0452);_0x26a5b7(_0x5d7e2b['error'](0x1f4,_0x26a0c7[_0xe8d9('0x13')]));});});};exports[_0xe8d9('0x20')]=function(_0x57f73f){var _0x18a235=this;return new Promise(function(_0x34a610,_0x399deb){return db[_0xe8d9('0x17')]['find']({'raw':_0x57f73f[_0xe8d9('0x19')]?_0x57f73f[_0xe8d9('0x19')][_0xe8d9('0x1a')]===undefined?!![]:![]:!![],'where':_0x57f73f[_0xe8d9('0x19')]?_0x57f73f[_0xe8d9('0x19')][_0xe8d9('0x21')]||null:null,'attributes':_0x57f73f[_0xe8d9('0x19')]?_0x57f73f[_0xe8d9('0x19')][_0xe8d9('0x1b')]||null:null,'include':_0x57f73f['options']?_0x57f73f['options']['include']?_['map'](_0x57f73f['options'][_0xe8d9('0x1c')],function(_0x196eee){return{'model':db[_0x196eee['model']],'as':_0x196eee['as'],'attributes':_0x196eee[_0xe8d9('0x1b')],'include':_0x196eee[_0xe8d9('0x1c')]?_[_0xe8d9('0x1d')](_0x196eee[_0xe8d9('0x1c')],function(_0x176fa5){return{'model':db[_0x176fa5[_0xe8d9('0x1e')]],'as':_0x176fa5['as'],'attributes':_0x176fa5['attributes'],'include':_0x176fa5[_0xe8d9('0x1c')]?_[_0xe8d9('0x1d')](_0x176fa5[_0xe8d9('0x1c')],function(_0x10b11e){return{'model':db[_0x10b11e[_0xe8d9('0x1e')]],'as':_0x10b11e['as'],'attributes':_0x10b11e[_0xe8d9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe8d9('0xc')](function(_0x29a6ed){logger[_0xe8d9('0x14')](_0xe8d9('0x20'),_0x57f73f);logger[_0xe8d9('0xe')](_0xe8d9('0x20'),_0x57f73f,JSON[_0xe8d9('0x1f')](_0x29a6ed));_0x34a610(_0x29a6ed);})[_0xe8d9('0x22')](function(_0x19cd96){logger['error'](_0xe8d9('0x20'),_0x19cd96[_0xe8d9('0x13')],_0x57f73f);_0x399deb(_0x18a235[_0xe8d9('0x11')](0x1f4,_0x19cd96[_0xe8d9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e714d3a..f072cb2 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 _0xec5d=['./intServicenowConfiguration.controller','isAuthenticated','get','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x406d36,_0x51f480){var _0x3babaf=function(_0x168241){while(--_0x168241){_0x406d36['push'](_0x406d36['shift']());}};_0x3babaf(++_0x51f480);}(_0xec5d,0x19e));var _0xdec5=function(_0xfac5dc,_0x44309a){_0xfac5dc=_0xfac5dc-0x0;var _0xaebbcc=_0xec5d[_0xfac5dc];return _0xaebbcc;};'use strict';var multer=require(_0xdec5('0x0'));var util=require(_0xdec5('0x1'));var path=require('path');var timeout=require(_0xdec5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdec5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdec5('0x4'));var config=require(_0xdec5('0x5'));var controller=require(_0xdec5('0x6'));router['get']('/',auth[_0xdec5('0x7')](),controller['index']);router[_0xdec5('0x8')](_0xdec5('0x9'),auth[_0xdec5('0x7')](),controller['show']);router[_0xdec5('0x8')](_0xdec5('0xa'),auth[_0xdec5('0x7')](),controller[_0xdec5('0xb')]);router[_0xdec5('0x8')](_0xdec5('0xc'),auth['isAuthenticated'](),controller[_0xdec5('0xd')]);router[_0xdec5('0x8')](_0xdec5('0xe'),auth[_0xdec5('0x7')](),controller[_0xdec5('0xf')]);router[_0xdec5('0x10')]('/',auth[_0xdec5('0x7')](),controller['create']);router[_0xdec5('0x11')](_0xdec5('0x9'),auth[_0xdec5('0x7')](),controller['update']);router['delete'](_0xdec5('0x9'),auth[_0xdec5('0x7')](),controller[_0xdec5('0x12')]);module[_0xdec5('0x13')]=router; \ No newline at end of file +var _0x5667=['getSubjects','/:id/descriptions','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects'];(function(_0x1db29a,_0x5263e6){var _0x53525b=function(_0x469d7d){while(--_0x469d7d){_0x1db29a['push'](_0x1db29a['shift']());}};_0x53525b(++_0x5263e6);}(_0x5667,0x17f));var _0x7566=function(_0x5af635,_0x430bd1){_0x5af635=_0x5af635-0x0;var _0x29efd6=_0x5667[_0x5af635];return _0x29efd6;};'use strict';var multer=require(_0x7566('0x0'));var util=require(_0x7566('0x1'));var path=require(_0x7566('0x2'));var timeout=require(_0x7566('0x3'));var express=require('express');var router=express[_0x7566('0x4')]();var fs_extra=require(_0x7566('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7566('0x6'));var config=require(_0x7566('0x7'));var controller=require(_0x7566('0x8'));router['get']('/',auth[_0x7566('0x9')](),controller[_0x7566('0xa')]);router[_0x7566('0xb')](_0x7566('0xc'),auth[_0x7566('0x9')](),controller[_0x7566('0xd')]);router[_0x7566('0xb')]('/:id/fields',auth[_0x7566('0x9')](),controller[_0x7566('0xe')]);router[_0x7566('0xb')](_0x7566('0xf'),auth[_0x7566('0x9')](),controller[_0x7566('0x10')]);router[_0x7566('0xb')](_0x7566('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7566('0x12')]);router[_0x7566('0x13')](_0x7566('0xc'),auth[_0x7566('0x9')](),controller['destroy']);module[_0x7566('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 6124dff..2887ca7 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 _0x3bd6=['sequelize'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x3bd6,0x6c));var _0x63bd=function(_0x4dc228,_0x53bc00){_0x4dc228=_0x4dc228-0x0;var _0x14d638=_0x3bd6[_0x4dc228];return _0x14d638;};'use strict';var Sequelize=require(_0x63bd('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd4d5=['exports','STRING'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xd4d5,0x176));var _0x5d4d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xd4d5[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x5d4d('0x0')]={'name':{'type':Sequelize[_0x5d4d('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index e5f7ab7..a6650f3 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 _0xf3f4=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','update','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','include','findAll','rows','params','intersection','create','body','destroy','find','getFields','findOne','ServicenowField','filter','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x4dc293,_0xc5a934){var _0x8ef2e0=function(_0x4d8133){while(--_0x4d8133){_0x4dc293['push'](_0x4dc293['shift']());}};_0x8ef2e0(++_0xc5a934);}(_0xf3f4,0x14d));var _0x4f3f=function(_0x1fa0da,_0x497505){_0x1fa0da=_0x1fa0da-0x0;var _0x593747=_0xf3f4[_0x1fa0da];return _0x593747;};'use strict';var pdf=require(_0x4f3f('0x0'));var emlformat=require(_0x4f3f('0x1'));var rimraf=require(_0x4f3f('0x2'));var zipdir=require(_0x4f3f('0x3'));var jsonpatch=require(_0x4f3f('0x4'));var rp=require('request-promise');var moment=require(_0x4f3f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4f3f('0x6'));var util=require(_0x4f3f('0x7'));var path=require('path');var sox=require(_0x4f3f('0x8'));var csv=require(_0x4f3f('0x9'));var ejs=require(_0x4f3f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f3f('0xb'));var squel=require(_0x4f3f('0xc'));var crypto=require(_0x4f3f('0xd'));var jsforce=require(_0x4f3f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4f3f('0x9'));var querystring=require(_0x4f3f('0xf'));var Papa=require('papaparse');var Redis=require(_0x4f3f('0x10'));var authService=require(_0x4f3f('0x11'));var qs=require(_0x4f3f('0x12'));var as=require(_0x4f3f('0x13'));var hardwareService=require(_0x4f3f('0x14'));var logger=require(_0x4f3f('0x15'))(_0x4f3f('0x16'));var utils=require(_0x4f3f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f3f('0x18'))['db'];var jayson=require(_0x4f3f('0x19'));var client=jayson['client'][_0x4f3f('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x195b65,_0x37ec45,_0x162fc0,_0x579147){return new BPromise(function(_0x455a96,_0x363c80){var _0x2b49a2=_0x579147||client;return _0x2b49a2[_0x4f3f('0x1b')](_0x195b65,_0x162fc0)[_0x4f3f('0x1c')](function(_0x1acef0){logger[_0x4f3f('0x1d')](_0x4f3f('0x1e'),_0x37ec45,_0x4f3f('0x1f'));logger[_0x4f3f('0x20')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x37ec45,_0x4f3f('0x1f'),JSON['stringify'](_0x1acef0));if(_0x1acef0[_0x4f3f('0x21')]){if(_0x1acef0[_0x4f3f('0x21')][_0x4f3f('0x22')]===0x1f4){logger['error'](_0x4f3f('0x1e'),_0x37ec45,_0x1acef0[_0x4f3f('0x21')][_0x4f3f('0x23')]);return _0x363c80(_0x1acef0[_0x4f3f('0x21')][_0x4f3f('0x23')]);}logger[_0x4f3f('0x21')](_0x4f3f('0x1e'),_0x37ec45,_0x1acef0[_0x4f3f('0x21')]['message']);return _0x455a96(_0x1acef0[_0x4f3f('0x21')][_0x4f3f('0x23')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x37ec45,_0x4f3f('0x1f'));_0x455a96(_0x1acef0[_0x4f3f('0x24')][_0x4f3f('0x23')]);}})[_0x4f3f('0x25')](function(_0xbc2636){logger[_0x4f3f('0x21')](_0x4f3f('0x1e'),_0x37ec45,_0xbc2636);_0x363c80(_0xbc2636);});});}function respondWithStatusCode(_0x21219f,_0x8a6273){_0x8a6273=_0x8a6273||0xcc;return function(_0x119c28){if(_0x119c28){return _0x21219f[_0x4f3f('0x26')](_0x8a6273);}return _0x21219f[_0x4f3f('0x27')](_0x8a6273)[_0x4f3f('0x28')]();};}function respondWithResult(_0x1a0c8c,_0x5659ba){_0x5659ba=_0x5659ba||0xc8;return function(_0x1bd37d){if(_0x1bd37d){return _0x1a0c8c[_0x4f3f('0x27')](_0x5659ba)[_0x4f3f('0x29')](_0x1bd37d);}};}function respondWithFilteredResult(_0x5140f2,_0x57df73){return function(_0x3ab527){if(_0x3ab527){var _0x2dd3d8=_0x3ab527[_0x4f3f('0x2a')],_0x3faa86=_0x57df73[_0x4f3f('0x2b')],_0x10b709=_0x57df73[_0x4f3f('0x2b')]+_0x57df73[_0x4f3f('0x2c')],_0x54f0ef;if(_0x10b709>=_0x2dd3d8){_0x10b709=_0x2dd3d8;_0x54f0ef=0xc8;}else{_0x54f0ef=0xce;}_0x5140f2[_0x4f3f('0x27')](_0x54f0ef);return _0x5140f2['set']('Content-Range',_0x3faa86+'-'+_0x10b709+'/'+_0x2dd3d8)[_0x4f3f('0x29')](_0x3ab527);}return null;};}function patchUpdates(_0x3c726c){return function(_0x27fc38){try{jsonpatch[_0x4f3f('0x2d')](_0x27fc38,_0x3c726c,!![]);}catch(_0x582137){return BPromise[_0x4f3f('0x2e')](_0x582137);}return _0x27fc38['save']();};}function saveUpdates(_0x98e6a2,_0x550d82){return function(_0x47d246){if(_0x47d246){return _0x47d246[_0x4f3f('0x2f')](_0x98e6a2)[_0x4f3f('0x1c')](function(_0x4b743a){return _0x4b743a;});}return null;};}function removeEntity(_0x280fac,_0x24b879){return function(_0x59369a){if(_0x59369a){return _0x59369a['destroy']()[_0x4f3f('0x1c')](function(){_0x280fac[_0x4f3f('0x27')](0xcc)[_0x4f3f('0x28')]();});}};}function handleEntityNotFound(_0x48ccb8,_0x1f79f4){return function(_0x4f44f2){if(!_0x4f44f2){_0x48ccb8[_0x4f3f('0x26')](0x194);}return _0x4f44f2;};}function handleError(_0x61caed,_0x176d4e){_0x176d4e=_0x176d4e||0x1f4;return function(_0xd64717){logger['error'](_0xd64717['stack']);if(_0xd64717[_0x4f3f('0x30')]){delete _0xd64717['name'];}_0x61caed[_0x4f3f('0x27')](_0x176d4e)['send'](_0xd64717);};}exports[_0x4f3f('0x31')]=function(_0xb3266e,_0x8ee4b6){var _0x4ae3fa={},_0x5eb4f4={},_0x7f8cea={'count':0x0,'rows':[]};var _0x1fbac9=_[_0x4f3f('0x32')](db['ServicenowConfiguration'][_0x4f3f('0x33')],function(_0x3b6d2b){return{'name':_0x3b6d2b[_0x4f3f('0x34')],'type':_0x3b6d2b[_0x4f3f('0x35')]['key']};});_0x5eb4f4[_0x4f3f('0x36')]=_[_0x4f3f('0x32')](_0x1fbac9,_0x4f3f('0x30'));_0x5eb4f4[_0x4f3f('0x37')]=_[_0x4f3f('0x38')](_0xb3266e[_0x4f3f('0x37')]);_0x5eb4f4[_0x4f3f('0x39')]=_['intersection'](_0x5eb4f4[_0x4f3f('0x36')],_0x5eb4f4[_0x4f3f('0x37')]);_0x4ae3fa[_0x4f3f('0x3a')]=_['intersection'](_0x5eb4f4[_0x4f3f('0x36')],qs['fields'](_0xb3266e[_0x4f3f('0x37')][_0x4f3f('0x3b')]));_0x4ae3fa[_0x4f3f('0x3a')]=_0x4ae3fa['attributes'][_0x4f3f('0x3c')]?_0x4ae3fa[_0x4f3f('0x3a')]:_0x5eb4f4['model'];if(!_0xb3266e[_0x4f3f('0x37')][_0x4f3f('0x3d')](_0x4f3f('0x3e'))){_0x4ae3fa[_0x4f3f('0x2c')]=qs[_0x4f3f('0x2c')](_0xb3266e[_0x4f3f('0x37')][_0x4f3f('0x2c')]);_0x4ae3fa[_0x4f3f('0x2b')]=qs['offset'](_0xb3266e[_0x4f3f('0x37')][_0x4f3f('0x2b')]);}_0x4ae3fa[_0x4f3f('0x3f')]=qs[_0x4f3f('0x40')](_0xb3266e[_0x4f3f('0x37')][_0x4f3f('0x40')]);_0x4ae3fa[_0x4f3f('0x41')]=qs['filters'](_[_0x4f3f('0x42')](_0xb3266e[_0x4f3f('0x37')],_0x5eb4f4[_0x4f3f('0x39')]),_0x1fbac9);if(_0xb3266e['query']['filter']){_0x4ae3fa['where']=_[_0x4f3f('0x43')](_0x4ae3fa[_0x4f3f('0x41')],{'$or':_[_0x4f3f('0x32')](_0x1fbac9,function(_0x2494ed){if(_0x2494ed[_0x4f3f('0x35')]!==_0x4f3f('0x44')){var _0x1fb9ff={};_0x1fb9ff[_0x2494ed[_0x4f3f('0x30')]]={'$like':'%'+_0xb3266e['query']['filter']+'%'};return _0x1fb9ff;}})});}_0x4ae3fa=_[_0x4f3f('0x43')]({},_0x4ae3fa,_0xb3266e[_0x4f3f('0x45')]);var _0x357c3b={'where':_0x4ae3fa[_0x4f3f('0x41')]};return db[_0x4f3f('0x46')][_0x4f3f('0x2a')](_0x357c3b)[_0x4f3f('0x1c')](function(_0xe2738c){_0x7f8cea['count']=_0xe2738c;if(_0xb3266e[_0x4f3f('0x37')][_0x4f3f('0x47')]){_0x4ae3fa[_0x4f3f('0x48')]=[{'all':!![]}];}return db[_0x4f3f('0x46')][_0x4f3f('0x49')](_0x4ae3fa);})[_0x4f3f('0x1c')](function(_0x291ae2){_0x7f8cea[_0x4f3f('0x4a')]=_0x291ae2;return _0x7f8cea;})['then'](respondWithFilteredResult(_0x8ee4b6,_0x4ae3fa))[_0x4f3f('0x25')](handleError(_0x8ee4b6,null));};exports['show']=function(_0x463809,_0x35c4c4){var _0x384db2={'raw':![],'where':{'id':_0x463809[_0x4f3f('0x4b')]['id']}},_0x12c7ce={};_0x12c7ce[_0x4f3f('0x36')]=_['keys'](db[_0x4f3f('0x46')][_0x4f3f('0x33')]);_0x12c7ce[_0x4f3f('0x37')]=_[_0x4f3f('0x38')](_0x463809['query']);_0x12c7ce[_0x4f3f('0x39')]=_[_0x4f3f('0x4c')](_0x12c7ce[_0x4f3f('0x36')],_0x12c7ce['query']);_0x384db2['attributes']=_[_0x4f3f('0x4c')](_0x12c7ce[_0x4f3f('0x36')],qs['fields'](_0x463809[_0x4f3f('0x37')]['fields']));_0x384db2[_0x4f3f('0x3a')]=_0x384db2['attributes'][_0x4f3f('0x3c')]?_0x384db2[_0x4f3f('0x3a')]:_0x12c7ce[_0x4f3f('0x36')];if(_0x463809[_0x4f3f('0x37')][_0x4f3f('0x47')]){_0x384db2[_0x4f3f('0x48')]=[{'all':!![]}];}_0x384db2=_[_0x4f3f('0x43')]({},_0x384db2,_0x463809['options']);return db[_0x4f3f('0x46')]['find'](_0x384db2)[_0x4f3f('0x1c')](handleEntityNotFound(_0x35c4c4,null))[_0x4f3f('0x1c')](respondWithResult(_0x35c4c4,null))[_0x4f3f('0x25')](handleError(_0x35c4c4,null));};exports[_0x4f3f('0x4d')]=function(_0x3c7857,_0x40ad56){return db['ServicenowConfiguration'][_0x4f3f('0x4d')](_0x3c7857[_0x4f3f('0x4e')],{})[_0x4f3f('0x1c')](respondWithResult(_0x40ad56,0xc9))[_0x4f3f('0x25')](handleError(_0x40ad56,null));};exports[_0x4f3f('0x2f')]=function(_0x293846,_0x35e85b){if(_0x293846[_0x4f3f('0x4e')]['id']){delete _0x293846[_0x4f3f('0x4e')]['id'];}return db[_0x4f3f('0x46')]['find']({'where':{'id':_0x293846['params']['id']}})['then'](handleEntityNotFound(_0x35e85b,null))['then'](saveUpdates(_0x293846['body'],null))[_0x4f3f('0x1c')](respondWithResult(_0x35e85b,null))[_0x4f3f('0x25')](handleError(_0x35e85b,null));};exports[_0x4f3f('0x4f')]=function(_0x12f190,_0x1b8b2a){return db[_0x4f3f('0x46')][_0x4f3f('0x50')]({'where':{'id':_0x12f190['params']['id']}})[_0x4f3f('0x1c')](handleEntityNotFound(_0x1b8b2a,null))[_0x4f3f('0x1c')](removeEntity(_0x1b8b2a,null))[_0x4f3f('0x25')](handleError(_0x1b8b2a,null));};exports[_0x4f3f('0x51')]=function(_0x418412,_0x51a8fd,_0x3cd2d){var _0x20de96={};var _0x40e9a8={};var _0x4fd219;var _0x6eb55c;return db['ServicenowConfiguration'][_0x4f3f('0x52')]({'where':{'id':_0x418412[_0x4f3f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51a8fd,null))[_0x4f3f('0x1c')](function(_0x1bea87){if(_0x1bea87){_0x4fd219=_0x1bea87;_0x40e9a8['model']=_['keys'](db[_0x4f3f('0x53')][_0x4f3f('0x33')]);_0x40e9a8[_0x4f3f('0x37')]=_['keys'](_0x418412[_0x4f3f('0x37')]);_0x40e9a8[_0x4f3f('0x39')]=_[_0x4f3f('0x4c')](_0x40e9a8[_0x4f3f('0x36')],_0x40e9a8[_0x4f3f('0x37')]);_0x20de96[_0x4f3f('0x3a')]=_['intersection'](_0x40e9a8['model'],qs['fields'](_0x418412[_0x4f3f('0x37')]['fields']));_0x20de96[_0x4f3f('0x3a')]=_0x20de96[_0x4f3f('0x3a')][_0x4f3f('0x3c')]?_0x20de96['attributes']:_0x40e9a8[_0x4f3f('0x36')];_0x20de96[_0x4f3f('0x3f')]=qs[_0x4f3f('0x40')](_0x418412[_0x4f3f('0x37')][_0x4f3f('0x40')]);_0x20de96[_0x4f3f('0x41')]=qs['filters'](_[_0x4f3f('0x42')](_0x418412['query'],_0x40e9a8[_0x4f3f('0x39')]));if(_0x418412[_0x4f3f('0x37')][_0x4f3f('0x54')]){_0x20de96[_0x4f3f('0x41')]=_[_0x4f3f('0x43')](_0x20de96['where'],{'$or':_[_0x4f3f('0x32')](_0x20de96[_0x4f3f('0x3a')],function(_0x4b6d8a){var _0x7cda7={};_0x7cda7[_0x4b6d8a]={'$like':'%'+_0x418412[_0x4f3f('0x37')][_0x4f3f('0x54')]+'%'};return _0x7cda7;})});}_0x20de96=_['merge']({},_0x20de96,_0x418412['options']);return _0x4fd219[_0x4f3f('0x51')](_0x20de96);}})[_0x4f3f('0x1c')](function(_0x148bfd){if(_0x148bfd){_0x6eb55c=_0x148bfd['length'];if(!_0x418412['query'][_0x4f3f('0x3d')](_0x4f3f('0x3e'))){_0x20de96[_0x4f3f('0x2c')]=qs[_0x4f3f('0x2c')](_0x418412[_0x4f3f('0x37')][_0x4f3f('0x2c')]);_0x20de96['offset']=qs[_0x4f3f('0x2b')](_0x418412['query'][_0x4f3f('0x2b')]);}return _0x4fd219['getFields'](_0x20de96);}})[_0x4f3f('0x1c')](function(_0x18fcbd){if(_0x18fcbd){return _0x18fcbd?{'count':_0x6eb55c,'rows':_0x18fcbd}:null;}})[_0x4f3f('0x1c')](respondWithResult(_0x51a8fd,null))['catch'](handleError(_0x51a8fd,null));};exports[_0x4f3f('0x55')]=function(_0x4eeccd,_0x1f4d54,_0x46c707){var _0x87e35f={};var _0x5066ab={};var _0x20e7a1;var _0x506d85;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x4eeccd[_0x4f3f('0x4b')]['id']}})[_0x4f3f('0x1c')](handleEntityNotFound(_0x1f4d54,null))[_0x4f3f('0x1c')](function(_0x2de226){if(_0x2de226){_0x20e7a1=_0x2de226;_0x5066ab['model']=_[_0x4f3f('0x38')](db[_0x4f3f('0x53')][_0x4f3f('0x33')]);_0x5066ab[_0x4f3f('0x37')]=_[_0x4f3f('0x38')](_0x4eeccd[_0x4f3f('0x37')]);_0x5066ab[_0x4f3f('0x39')]=_[_0x4f3f('0x4c')](_0x5066ab['model'],_0x5066ab[_0x4f3f('0x37')]);_0x87e35f[_0x4f3f('0x3a')]=_[_0x4f3f('0x4c')](_0x5066ab[_0x4f3f('0x36')],qs[_0x4f3f('0x3b')](_0x4eeccd[_0x4f3f('0x37')][_0x4f3f('0x3b')]));_0x87e35f[_0x4f3f('0x3a')]=_0x87e35f[_0x4f3f('0x3a')][_0x4f3f('0x3c')]?_0x87e35f[_0x4f3f('0x3a')]:_0x5066ab[_0x4f3f('0x36')];_0x87e35f['order']=qs['sort'](_0x4eeccd[_0x4f3f('0x37')]['sort']);_0x87e35f['where']=qs[_0x4f3f('0x39')](_[_0x4f3f('0x42')](_0x4eeccd['query'],_0x5066ab[_0x4f3f('0x39')]));if(_0x4eeccd[_0x4f3f('0x37')][_0x4f3f('0x54')]){_0x87e35f['where']=_[_0x4f3f('0x43')](_0x87e35f[_0x4f3f('0x41')],{'$or':_[_0x4f3f('0x32')](_0x87e35f[_0x4f3f('0x3a')],function(_0x583d32){var _0x156d8b={};_0x156d8b[_0x583d32]={'$like':'%'+_0x4eeccd[_0x4f3f('0x37')]['filter']+'%'};return _0x156d8b;})});}_0x87e35f=_[_0x4f3f('0x43')]({},_0x87e35f,_0x4eeccd[_0x4f3f('0x45')]);return _0x20e7a1['getSubjects'](_0x87e35f);}})[_0x4f3f('0x1c')](function(_0x5ea3fd){if(_0x5ea3fd){_0x506d85=_0x5ea3fd[_0x4f3f('0x3c')];if(!_0x4eeccd['query'][_0x4f3f('0x3d')]('nolimit')){_0x87e35f[_0x4f3f('0x2c')]=qs[_0x4f3f('0x2c')](_0x4eeccd[_0x4f3f('0x37')][_0x4f3f('0x2c')]);_0x87e35f['offset']=qs[_0x4f3f('0x2b')](_0x4eeccd[_0x4f3f('0x37')][_0x4f3f('0x2b')]);}return _0x20e7a1[_0x4f3f('0x55')](_0x87e35f);}})[_0x4f3f('0x1c')](function(_0x173216){if(_0x173216){return _0x173216?{'count':_0x506d85,'rows':_0x173216}:null;}})[_0x4f3f('0x1c')](respondWithResult(_0x1f4d54,null))[_0x4f3f('0x25')](handleError(_0x1f4d54,null));};exports[_0x4f3f('0x56')]=function(_0x2768b5,_0x210210,_0x5726ec){var _0x476939={};var _0x3ce883={};var _0x496a28;var _0x46d58d;return db[_0x4f3f('0x46')]['findOne']({'where':{'id':_0x2768b5[_0x4f3f('0x4b')]['id']}})[_0x4f3f('0x1c')](handleEntityNotFound(_0x210210,null))['then'](function(_0x2c81a1){if(_0x2c81a1){_0x496a28=_0x2c81a1;_0x3ce883[_0x4f3f('0x36')]=_[_0x4f3f('0x38')](db[_0x4f3f('0x53')]['rawAttributes']);_0x3ce883[_0x4f3f('0x37')]=_[_0x4f3f('0x38')](_0x2768b5['query']);_0x3ce883[_0x4f3f('0x39')]=_[_0x4f3f('0x4c')](_0x3ce883[_0x4f3f('0x36')],_0x3ce883[_0x4f3f('0x37')]);_0x476939['attributes']=_[_0x4f3f('0x4c')](_0x3ce883['model'],qs[_0x4f3f('0x3b')](_0x2768b5[_0x4f3f('0x37')][_0x4f3f('0x3b')]));_0x476939[_0x4f3f('0x3a')]=_0x476939['attributes']['length']?_0x476939[_0x4f3f('0x3a')]:_0x3ce883[_0x4f3f('0x36')];_0x476939[_0x4f3f('0x3f')]=qs[_0x4f3f('0x40')](_0x2768b5[_0x4f3f('0x37')][_0x4f3f('0x40')]);_0x476939[_0x4f3f('0x41')]=qs[_0x4f3f('0x39')](_[_0x4f3f('0x42')](_0x2768b5[_0x4f3f('0x37')],_0x3ce883[_0x4f3f('0x39')]));if(_0x2768b5[_0x4f3f('0x37')]['filter']){_0x476939[_0x4f3f('0x41')]=_[_0x4f3f('0x43')](_0x476939[_0x4f3f('0x41')],{'$or':_[_0x4f3f('0x32')](_0x476939[_0x4f3f('0x3a')],function(_0x613aec){var _0x14923d={};_0x14923d[_0x613aec]={'$like':'%'+_0x2768b5[_0x4f3f('0x37')][_0x4f3f('0x54')]+'%'};return _0x14923d;})});}_0x476939=_[_0x4f3f('0x43')]({},_0x476939,_0x2768b5[_0x4f3f('0x45')]);return _0x496a28[_0x4f3f('0x56')](_0x476939);}})[_0x4f3f('0x1c')](function(_0xdc0e18){if(_0xdc0e18){_0x46d58d=_0xdc0e18[_0x4f3f('0x3c')];if(!_0x2768b5['query'][_0x4f3f('0x3d')](_0x4f3f('0x3e'))){_0x476939[_0x4f3f('0x2c')]=qs[_0x4f3f('0x2c')](_0x2768b5[_0x4f3f('0x37')][_0x4f3f('0x2c')]);_0x476939[_0x4f3f('0x2b')]=qs[_0x4f3f('0x2b')](_0x2768b5[_0x4f3f('0x37')][_0x4f3f('0x2b')]);}return _0x496a28[_0x4f3f('0x56')](_0x476939);}})[_0x4f3f('0x1c')](function(_0x16419c){if(_0x16419c){return _0x16419c?{'count':_0x46d58d,'rows':_0x16419c}:null;}})[_0x4f3f('0x1c')](respondWithResult(_0x210210,null))[_0x4f3f('0x25')](handleError(_0x210210,null));}; \ No newline at end of file +var _0xdcd7=['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','jayson/promise','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','stack','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','params','include','create','body','find','getFields','order','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xdcd7,0x1b9));var _0x7dcd=function(_0x48653a,_0x102d74){_0x48653a=_0x48653a-0x0;var _0x3c52de=_0xdcd7[_0x48653a];return _0x3c52de;};'use strict';var pdf=require(_0x7dcd('0x0'));var emlformat=require(_0x7dcd('0x1'));var rimraf=require(_0x7dcd('0x2'));var zipdir=require(_0x7dcd('0x3'));var jsonpatch=require(_0x7dcd('0x4'));var rp=require(_0x7dcd('0x5'));var moment=require(_0x7dcd('0x6'));var BPromise=require(_0x7dcd('0x7'));var Mustache=require('mustache');var util=require(_0x7dcd('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x7dcd('0x9'));var ejs=require(_0x7dcd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7dcd('0xb'));var crypto=require(_0x7dcd('0xc'));var jsforce=require(_0x7dcd('0xd'));var deskjs=require(_0x7dcd('0xe'));var toCsv=require(_0x7dcd('0x9'));var querystring=require(_0x7dcd('0xf'));var Papa=require('papaparse');var Redis=require(_0x7dcd('0x10'));var authService=require(_0x7dcd('0x11'));var qs=require(_0x7dcd('0x12'));var as=require(_0x7dcd('0x13'));var hardwareService=require(_0x7dcd('0x14'));var logger=require(_0x7dcd('0x15'))(_0x7dcd('0x16'));var utils=require(_0x7dcd('0x17'));var config=require(_0x7dcd('0x18'));var licenseUtil=require(_0x7dcd('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7dcd('0x1a'));var client=jayson['client'][_0x7dcd('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4ddb7f,_0x3d094d,_0x4bf73e,_0x5ea84b){return new BPromise(function(_0x325251,_0x3db77a){var _0x485fe3=_0x5ea84b||client;return _0x485fe3['request'](_0x4ddb7f,_0x4bf73e)[_0x7dcd('0x1c')](function(_0x2d4658){logger[_0x7dcd('0x1d')](_0x7dcd('0x1e'),_0x3d094d,_0x7dcd('0x1f'));logger[_0x7dcd('0x20')](_0x7dcd('0x21'),_0x3d094d,_0x7dcd('0x1f'),JSON['stringify'](_0x2d4658));if(_0x2d4658[_0x7dcd('0x22')]){if(_0x2d4658[_0x7dcd('0x22')][_0x7dcd('0x23')]===0x1f4){logger['error'](_0x7dcd('0x1e'),_0x3d094d,_0x2d4658[_0x7dcd('0x22')][_0x7dcd('0x24')]);return _0x3db77a(_0x2d4658[_0x7dcd('0x22')]['message']);}logger[_0x7dcd('0x22')](_0x7dcd('0x1e'),_0x3d094d,_0x2d4658[_0x7dcd('0x22')][_0x7dcd('0x24')]);return _0x325251(_0x2d4658[_0x7dcd('0x22')][_0x7dcd('0x24')]);}else{logger[_0x7dcd('0x1d')](_0x7dcd('0x1e'),_0x3d094d,_0x7dcd('0x1f'));_0x325251(_0x2d4658[_0x7dcd('0x25')][_0x7dcd('0x24')]);}})[_0x7dcd('0x26')](function(_0x2e24e6){logger[_0x7dcd('0x22')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3d094d,_0x2e24e6);_0x3db77a(_0x2e24e6);});});}function respondWithStatusCode(_0x583aff,_0x294c63){_0x294c63=_0x294c63||0xcc;return function(_0x1dfa91){if(_0x1dfa91){return _0x583aff[_0x7dcd('0x27')](_0x294c63);}return _0x583aff[_0x7dcd('0x28')](_0x294c63)[_0x7dcd('0x29')]();};}function respondWithResult(_0x56f153,_0x511314){_0x511314=_0x511314||0xc8;return function(_0x3e3a43){if(_0x3e3a43){return _0x56f153[_0x7dcd('0x28')](_0x511314)[_0x7dcd('0x2a')](_0x3e3a43);}};}function respondWithFilteredResult(_0x52ad9d,_0x5cbe5c){return function(_0x35961c){if(_0x35961c){var _0x41e450=_0x35961c[_0x7dcd('0x2b')],_0x36d32c=_0x5cbe5c[_0x7dcd('0x2c')],_0x5a973a=_0x5cbe5c['offset']+_0x5cbe5c['limit'],_0x38de60;if(_0x5a973a>=_0x41e450){_0x5a973a=_0x41e450;_0x38de60=0xc8;}else{_0x38de60=0xce;}_0x52ad9d[_0x7dcd('0x28')](_0x38de60);return _0x52ad9d[_0x7dcd('0x2d')](_0x7dcd('0x2e'),_0x36d32c+'-'+_0x5a973a+'/'+_0x41e450)['json'](_0x35961c);}return null;};}function patchUpdates(_0x3935be){return function(_0x4d5929){try{jsonpatch[_0x7dcd('0x2f')](_0x4d5929,_0x3935be,!![]);}catch(_0x9f2e53){return BPromise['reject'](_0x9f2e53);}return _0x4d5929[_0x7dcd('0x30')]();};}function saveUpdates(_0x3556cf,_0x3b615d){return function(_0xa70db8){if(_0xa70db8){return _0xa70db8[_0x7dcd('0x31')](_0x3556cf)[_0x7dcd('0x1c')](function(_0x54daa1){return _0x54daa1;});}return null;};}function removeEntity(_0x5a8d84,_0x295c37){return function(_0x514518){if(_0x514518){return _0x514518[_0x7dcd('0x32')]()[_0x7dcd('0x1c')](function(){_0x5a8d84[_0x7dcd('0x28')](0xcc)[_0x7dcd('0x29')]();});}};}function handleEntityNotFound(_0x2047d1,_0x2d9c08){return function(_0x1d63b3){if(!_0x1d63b3){_0x2047d1['sendStatus'](0x194);}return _0x1d63b3;};}function handleError(_0xf491aa,_0x5c0640){_0x5c0640=_0x5c0640||0x1f4;return function(_0x604a30){logger['error'](_0x604a30[_0x7dcd('0x33')]);if(_0x604a30['name']){delete _0x604a30['name'];}_0xf491aa[_0x7dcd('0x28')](_0x5c0640)[_0x7dcd('0x34')](_0x604a30);};}exports[_0x7dcd('0x35')]=function(_0x2cd31a,_0x19099d){var _0x28ff77={},_0x211a47={},_0x346079={'count':0x0,'rows':[]};var _0x1e15b7=_[_0x7dcd('0x36')](db[_0x7dcd('0x37')][_0x7dcd('0x38')],function(_0x113f00){return{'name':_0x113f00[_0x7dcd('0x39')],'type':_0x113f00[_0x7dcd('0x3a')][_0x7dcd('0x3b')]};});_0x211a47[_0x7dcd('0x3c')]=_[_0x7dcd('0x36')](_0x1e15b7,_0x7dcd('0x3d'));_0x211a47['query']=_[_0x7dcd('0x3e')](_0x2cd31a['query']);_0x211a47[_0x7dcd('0x3f')]=_[_0x7dcd('0x40')](_0x211a47[_0x7dcd('0x3c')],_0x211a47['query']);_0x28ff77[_0x7dcd('0x41')]=_['intersection'](_0x211a47['model'],qs[_0x7dcd('0x42')](_0x2cd31a[_0x7dcd('0x43')][_0x7dcd('0x42')]));_0x28ff77['attributes']=_0x28ff77[_0x7dcd('0x41')][_0x7dcd('0x44')]?_0x28ff77['attributes']:_0x211a47[_0x7dcd('0x3c')];if(!_0x2cd31a[_0x7dcd('0x43')][_0x7dcd('0x45')](_0x7dcd('0x46'))){_0x28ff77[_0x7dcd('0x47')]=qs['limit'](_0x2cd31a[_0x7dcd('0x43')][_0x7dcd('0x47')]);_0x28ff77[_0x7dcd('0x2c')]=qs[_0x7dcd('0x2c')](_0x2cd31a[_0x7dcd('0x43')]['offset']);}_0x28ff77['order']=qs[_0x7dcd('0x48')](_0x2cd31a[_0x7dcd('0x43')]['sort']);_0x28ff77[_0x7dcd('0x49')]=qs['filters'](_[_0x7dcd('0x4a')](_0x2cd31a[_0x7dcd('0x43')],_0x211a47[_0x7dcd('0x3f')]),_0x1e15b7);if(_0x2cd31a[_0x7dcd('0x43')][_0x7dcd('0x4b')]){_0x28ff77[_0x7dcd('0x49')]=_[_0x7dcd('0x4c')](_0x28ff77[_0x7dcd('0x49')],{'$or':_['map'](_0x1e15b7,function(_0x208465){if(_0x208465[_0x7dcd('0x3a')]!==_0x7dcd('0x4d')){var _0x137818={};_0x137818[_0x208465[_0x7dcd('0x3d')]]={'$like':'%'+_0x2cd31a[_0x7dcd('0x43')][_0x7dcd('0x4b')]+'%'};return _0x137818;}})});}_0x28ff77=_[_0x7dcd('0x4c')]({},_0x28ff77,_0x2cd31a[_0x7dcd('0x4e')]);var _0x538a4c={'where':_0x28ff77['where']};return db['ServicenowConfiguration'][_0x7dcd('0x2b')](_0x538a4c)['then'](function(_0x5c381e){_0x346079[_0x7dcd('0x2b')]=_0x5c381e;if(_0x2cd31a[_0x7dcd('0x43')][_0x7dcd('0x4f')]){_0x28ff77['include']=[{'all':!![]}];}return db[_0x7dcd('0x37')][_0x7dcd('0x50')](_0x28ff77);})['then'](function(_0x3543f2){_0x346079['rows']=_0x3543f2;return _0x346079;})[_0x7dcd('0x1c')](respondWithFilteredResult(_0x19099d,_0x28ff77))[_0x7dcd('0x26')](handleError(_0x19099d,null));};exports['show']=function(_0xbfd77c,_0x11706d){var _0xef91e5={'raw':![],'where':{'id':_0xbfd77c[_0x7dcd('0x51')]['id']}},_0x365b45={};_0x365b45[_0x7dcd('0x3c')]=_[_0x7dcd('0x3e')](db[_0x7dcd('0x37')][_0x7dcd('0x38')]);_0x365b45['query']=_[_0x7dcd('0x3e')](_0xbfd77c['query']);_0x365b45[_0x7dcd('0x3f')]=_['intersection'](_0x365b45['model'],_0x365b45[_0x7dcd('0x43')]);_0xef91e5[_0x7dcd('0x41')]=_[_0x7dcd('0x40')](_0x365b45[_0x7dcd('0x3c')],qs[_0x7dcd('0x42')](_0xbfd77c['query'][_0x7dcd('0x42')]));_0xef91e5['attributes']=_0xef91e5[_0x7dcd('0x41')]['length']?_0xef91e5['attributes']:_0x365b45[_0x7dcd('0x3c')];if(_0xbfd77c[_0x7dcd('0x43')][_0x7dcd('0x4f')]){_0xef91e5[_0x7dcd('0x52')]=[{'all':!![]}];}_0xef91e5=_['merge']({},_0xef91e5,_0xbfd77c[_0x7dcd('0x4e')]);return db['ServicenowConfiguration']['find'](_0xef91e5)['then'](handleEntityNotFound(_0x11706d,null))[_0x7dcd('0x1c')](respondWithResult(_0x11706d,null))[_0x7dcd('0x26')](handleError(_0x11706d,null));};exports[_0x7dcd('0x53')]=function(_0x110326,_0x17edb0){return db[_0x7dcd('0x37')][_0x7dcd('0x53')](_0x110326[_0x7dcd('0x54')],{})[_0x7dcd('0x1c')](respondWithResult(_0x17edb0,0xc9))[_0x7dcd('0x26')](handleError(_0x17edb0,null));};exports[_0x7dcd('0x31')]=function(_0x36bd85,_0x527d86){if(_0x36bd85[_0x7dcd('0x54')]['id']){delete _0x36bd85[_0x7dcd('0x54')]['id'];}return db[_0x7dcd('0x37')][_0x7dcd('0x55')]({'where':{'id':_0x36bd85['params']['id']}})['then'](handleEntityNotFound(_0x527d86,null))['then'](saveUpdates(_0x36bd85[_0x7dcd('0x54')],null))[_0x7dcd('0x1c')](respondWithResult(_0x527d86,null))[_0x7dcd('0x26')](handleError(_0x527d86,null));};exports[_0x7dcd('0x32')]=function(_0x1afa89,_0x4370db){return db[_0x7dcd('0x37')][_0x7dcd('0x55')]({'where':{'id':_0x1afa89[_0x7dcd('0x51')]['id']}})['then'](handleEntityNotFound(_0x4370db,null))[_0x7dcd('0x1c')](removeEntity(_0x4370db,null))[_0x7dcd('0x26')](handleError(_0x4370db,null));};exports[_0x7dcd('0x56')]=function(_0x2ec950,_0x20aa5f,_0x1d4985){var _0x5bf7d4={};var _0x15aabf={};var _0xc8557;var _0x23339e;return db[_0x7dcd('0x37')]['findOne']({'where':{'id':_0x2ec950['params']['id']}})['then'](handleEntityNotFound(_0x20aa5f,null))[_0x7dcd('0x1c')](function(_0x50eb67){if(_0x50eb67){_0xc8557=_0x50eb67;_0x15aabf['model']=_[_0x7dcd('0x3e')](db['ServicenowField']['rawAttributes']);_0x15aabf[_0x7dcd('0x43')]=_[_0x7dcd('0x3e')](_0x2ec950[_0x7dcd('0x43')]);_0x15aabf[_0x7dcd('0x3f')]=_[_0x7dcd('0x40')](_0x15aabf[_0x7dcd('0x3c')],_0x15aabf[_0x7dcd('0x43')]);_0x5bf7d4[_0x7dcd('0x41')]=_['intersection'](_0x15aabf['model'],qs[_0x7dcd('0x42')](_0x2ec950['query'][_0x7dcd('0x42')]));_0x5bf7d4[_0x7dcd('0x41')]=_0x5bf7d4[_0x7dcd('0x41')][_0x7dcd('0x44')]?_0x5bf7d4[_0x7dcd('0x41')]:_0x15aabf[_0x7dcd('0x3c')];_0x5bf7d4[_0x7dcd('0x57')]=qs['sort'](_0x2ec950[_0x7dcd('0x43')][_0x7dcd('0x48')]);_0x5bf7d4[_0x7dcd('0x49')]=qs[_0x7dcd('0x3f')](_[_0x7dcd('0x4a')](_0x2ec950[_0x7dcd('0x43')],_0x15aabf[_0x7dcd('0x3f')]));if(_0x2ec950['query'][_0x7dcd('0x4b')]){_0x5bf7d4[_0x7dcd('0x49')]=_[_0x7dcd('0x4c')](_0x5bf7d4['where'],{'$or':_[_0x7dcd('0x36')](_0x5bf7d4[_0x7dcd('0x41')],function(_0x1ec76a){var _0x55527c={};_0x55527c[_0x1ec76a]={'$like':'%'+_0x2ec950[_0x7dcd('0x43')][_0x7dcd('0x4b')]+'%'};return _0x55527c;})});}_0x5bf7d4=_[_0x7dcd('0x4c')]({},_0x5bf7d4,_0x2ec950['options']);return _0xc8557[_0x7dcd('0x56')](_0x5bf7d4);}})['then'](function(_0x30b2ba){if(_0x30b2ba){_0x23339e=_0x30b2ba['length'];if(!_0x2ec950['query'][_0x7dcd('0x45')](_0x7dcd('0x46'))){_0x5bf7d4[_0x7dcd('0x47')]=qs[_0x7dcd('0x47')](_0x2ec950[_0x7dcd('0x43')]['limit']);_0x5bf7d4[_0x7dcd('0x2c')]=qs[_0x7dcd('0x2c')](_0x2ec950['query'][_0x7dcd('0x2c')]);}return _0xc8557[_0x7dcd('0x56')](_0x5bf7d4);}})['then'](function(_0x4de8b0){if(_0x4de8b0){return _0x4de8b0?{'count':_0x23339e,'rows':_0x4de8b0}:null;}})[_0x7dcd('0x1c')](respondWithResult(_0x20aa5f,null))[_0x7dcd('0x26')](handleError(_0x20aa5f,null));};exports[_0x7dcd('0x58')]=function(_0x3a7524,_0x2d5595,_0x51babd){var _0x2e94f4={};var _0x3d3b50={};var _0x3090c0;var _0x20ecca;return db[_0x7dcd('0x37')][_0x7dcd('0x59')]({'where':{'id':_0x3a7524[_0x7dcd('0x51')]['id']}})[_0x7dcd('0x1c')](handleEntityNotFound(_0x2d5595,null))[_0x7dcd('0x1c')](function(_0x56679a){if(_0x56679a){_0x3090c0=_0x56679a;_0x3d3b50[_0x7dcd('0x3c')]=_[_0x7dcd('0x3e')](db['ServicenowField']['rawAttributes']);_0x3d3b50[_0x7dcd('0x43')]=_['keys'](_0x3a7524[_0x7dcd('0x43')]);_0x3d3b50['filters']=_[_0x7dcd('0x40')](_0x3d3b50[_0x7dcd('0x3c')],_0x3d3b50[_0x7dcd('0x43')]);_0x2e94f4['attributes']=_[_0x7dcd('0x40')](_0x3d3b50['model'],qs[_0x7dcd('0x42')](_0x3a7524['query'][_0x7dcd('0x42')]));_0x2e94f4[_0x7dcd('0x41')]=_0x2e94f4['attributes']['length']?_0x2e94f4[_0x7dcd('0x41')]:_0x3d3b50[_0x7dcd('0x3c')];_0x2e94f4[_0x7dcd('0x57')]=qs['sort'](_0x3a7524[_0x7dcd('0x43')][_0x7dcd('0x48')]);_0x2e94f4['where']=qs['filters'](_['pick'](_0x3a7524[_0x7dcd('0x43')],_0x3d3b50['filters']));if(_0x3a7524[_0x7dcd('0x43')][_0x7dcd('0x4b')]){_0x2e94f4[_0x7dcd('0x49')]=_[_0x7dcd('0x4c')](_0x2e94f4[_0x7dcd('0x49')],{'$or':_['map'](_0x2e94f4['attributes'],function(_0x2c4793){var _0x40c11f={};_0x40c11f[_0x2c4793]={'$like':'%'+_0x3a7524[_0x7dcd('0x43')][_0x7dcd('0x4b')]+'%'};return _0x40c11f;})});}_0x2e94f4=_[_0x7dcd('0x4c')]({},_0x2e94f4,_0x3a7524[_0x7dcd('0x4e')]);return _0x3090c0[_0x7dcd('0x58')](_0x2e94f4);}})['then'](function(_0x2fc06c){if(_0x2fc06c){_0x20ecca=_0x2fc06c['length'];if(!_0x3a7524[_0x7dcd('0x43')][_0x7dcd('0x45')]('nolimit')){_0x2e94f4[_0x7dcd('0x47')]=qs[_0x7dcd('0x47')](_0x3a7524[_0x7dcd('0x43')][_0x7dcd('0x47')]);_0x2e94f4[_0x7dcd('0x2c')]=qs[_0x7dcd('0x2c')](_0x3a7524[_0x7dcd('0x43')]['offset']);}return _0x3090c0[_0x7dcd('0x58')](_0x2e94f4);}})[_0x7dcd('0x1c')](function(_0x3e4b15){if(_0x3e4b15){return _0x3e4b15?{'count':_0x20ecca,'rows':_0x3e4b15}:null;}})[_0x7dcd('0x1c')](respondWithResult(_0x2d5595,null))[_0x7dcd('0x26')](handleError(_0x2d5595,null));};exports[_0x7dcd('0x5a')]=function(_0x472b5e,_0x2ce120,_0x30aeb7){var _0x3b00b6={};var _0x4ae2d3={};var _0x554375;var _0x1250c5;return db[_0x7dcd('0x37')][_0x7dcd('0x59')]({'where':{'id':_0x472b5e[_0x7dcd('0x51')]['id']}})[_0x7dcd('0x1c')](handleEntityNotFound(_0x2ce120,null))[_0x7dcd('0x1c')](function(_0x264cf1){if(_0x264cf1){_0x554375=_0x264cf1;_0x4ae2d3[_0x7dcd('0x3c')]=_[_0x7dcd('0x3e')](db['ServicenowField'][_0x7dcd('0x38')]);_0x4ae2d3[_0x7dcd('0x43')]=_[_0x7dcd('0x3e')](_0x472b5e[_0x7dcd('0x43')]);_0x4ae2d3['filters']=_[_0x7dcd('0x40')](_0x4ae2d3[_0x7dcd('0x3c')],_0x4ae2d3[_0x7dcd('0x43')]);_0x3b00b6['attributes']=_[_0x7dcd('0x40')](_0x4ae2d3['model'],qs[_0x7dcd('0x42')](_0x472b5e[_0x7dcd('0x43')][_0x7dcd('0x42')]));_0x3b00b6[_0x7dcd('0x41')]=_0x3b00b6[_0x7dcd('0x41')][_0x7dcd('0x44')]?_0x3b00b6[_0x7dcd('0x41')]:_0x4ae2d3[_0x7dcd('0x3c')];_0x3b00b6[_0x7dcd('0x57')]=qs[_0x7dcd('0x48')](_0x472b5e[_0x7dcd('0x43')]['sort']);_0x3b00b6[_0x7dcd('0x49')]=qs[_0x7dcd('0x3f')](_[_0x7dcd('0x4a')](_0x472b5e[_0x7dcd('0x43')],_0x4ae2d3['filters']));if(_0x472b5e[_0x7dcd('0x43')][_0x7dcd('0x4b')]){_0x3b00b6['where']=_['merge'](_0x3b00b6[_0x7dcd('0x49')],{'$or':_[_0x7dcd('0x36')](_0x3b00b6[_0x7dcd('0x41')],function(_0x5eb1c){var _0x2ca07c={};_0x2ca07c[_0x5eb1c]={'$like':'%'+_0x472b5e['query']['filter']+'%'};return _0x2ca07c;})});}_0x3b00b6=_[_0x7dcd('0x4c')]({},_0x3b00b6,_0x472b5e['options']);return _0x554375[_0x7dcd('0x5a')](_0x3b00b6);}})[_0x7dcd('0x1c')](function(_0x51a33b){if(_0x51a33b){_0x1250c5=_0x51a33b[_0x7dcd('0x44')];if(!_0x472b5e[_0x7dcd('0x43')]['hasOwnProperty'](_0x7dcd('0x46'))){_0x3b00b6['limit']=qs[_0x7dcd('0x47')](_0x472b5e[_0x7dcd('0x43')][_0x7dcd('0x47')]);_0x3b00b6[_0x7dcd('0x2c')]=qs[_0x7dcd('0x2c')](_0x472b5e[_0x7dcd('0x43')][_0x7dcd('0x2c')]);}return _0x554375[_0x7dcd('0x5a')](_0x3b00b6);}})[_0x7dcd('0x1c')](function(_0x36f43a){if(_0x36f43a){return _0x36f43a?{'count':_0x1250c5,'rows':_0x36f43a}:null;}})['then'](respondWithResult(_0x2ce120,null))[_0x7dcd('0x26')](handleError(_0x2ce120,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 49b3fa4..93b010b 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 _0xd747=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x1150d8,_0xbb2e1d){var _0x54b658=function(_0x652f0c){while(--_0x652f0c){_0x1150d8['push'](_0x1150d8['shift']());}};_0x54b658(++_0xbb2e1d);}(_0xd747,0x1e3));var _0x7d74=function(_0x58a2e3,_0xf6018a){_0x58a2e3=_0x58a2e3-0x0;var _0x377775=_0xd747[_0x58a2e3];return _0x377775;};'use strict';var _=require(_0x7d74('0x0'));var util=require(_0x7d74('0x1'));var logger=require(_0x7d74('0x2'))(_0x7d74('0x3'));var moment=require(_0x7d74('0x4'));var BPromise=require(_0x7d74('0x5'));var rp=require(_0x7d74('0x6'));var fs=require('fs');var path=require(_0x7d74('0x7'));var rimraf=require(_0x7d74('0x8'));var config=require(_0x7d74('0x9'));var attributes=require(_0x7d74('0xa'));module[_0x7d74('0xb')]=function(_0x4a8f57,_0x112a48){return _0x4a8f57[_0x7d74('0xc')](_0x7d74('0xd'),attributes,{'tableName':_0x7d74('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x942d=['request-promise','path','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x59b56c,_0x1fe083){var _0x4d73e4=function(_0x43fbbe){while(--_0x43fbbe){_0x59b56c['push'](_0x59b56c['shift']());}};_0x4d73e4(++_0x1fe083);}(_0x942d,0x12f));var _0xd942=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x942d[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xd942('0x0'));var util=require(_0xd942('0x1'));var logger=require(_0xd942('0x2'))(_0xd942('0x3'));var moment=require(_0xd942('0x4'));var BPromise=require('bluebird');var rp=require(_0xd942('0x5'));var fs=require('fs');var path=require(_0xd942('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd942('0x7'));module['exports']=function(_0x356fe9,_0x3b0449){return _0x356fe9[_0xd942('0x8')](_0xd942('0x9'),attributes,{'tableName':_0xd942('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 6ad0d42..3369919 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 _0xbbc0=['then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x318d88,_0x84d20c){var _0x360f3b=function(_0x261c61){while(--_0x261c61){_0x318d88['push'](_0x318d88['shift']());}};_0x360f3b(++_0x84d20c);}(_0xbbc0,0x8f));var _0x0bbc=function(_0x2f35ce,_0x56dd4a){_0x2f35ce=_0x2f35ce-0x0;var _0x11bd3e=_0xbbc0[_0x2f35ce];return _0x11bd3e;};'use strict';var _=require(_0x0bbc('0x0'));var util=require('util');var moment=require(_0x0bbc('0x1'));var BPromise=require(_0x0bbc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bbc('0x3'));var db=require(_0x0bbc('0x4'))['db'];var utils=require(_0x0bbc('0x5'));var logger=require(_0x0bbc('0x6'))(_0x0bbc('0x7'));var config=require('../../config/environment');var jayson=require(_0x0bbc('0x8'));var client=jayson[_0x0bbc('0x9')][_0x0bbc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a72fa,_0x462a33,_0x5db859){return new BPromise(function(_0x45d665,_0x398342){return client['request'](_0x4a72fa,_0x5db859)[_0x0bbc('0xb')](function(_0x52e1a6){logger[_0x0bbc('0xc')](_0x0bbc('0xd'),_0x462a33,_0x0bbc('0xe'));logger['debug'](_0x0bbc('0xf'),_0x462a33,_0x0bbc('0xe'),JSON[_0x0bbc('0x10')](_0x52e1a6));if(_0x52e1a6['error']){if(_0x52e1a6[_0x0bbc('0x11')][_0x0bbc('0x12')]===0x1f4){logger['error'](_0x0bbc('0xd'),_0x462a33,_0x52e1a6[_0x0bbc('0x11')][_0x0bbc('0x13')]);return _0x398342(_0x52e1a6[_0x0bbc('0x11')][_0x0bbc('0x13')]);}logger[_0x0bbc('0x11')](_0x0bbc('0xd'),_0x462a33,_0x52e1a6[_0x0bbc('0x11')][_0x0bbc('0x13')]);return _0x45d665(_0x52e1a6['error'][_0x0bbc('0x13')]);}else{logger['info'](_0x0bbc('0xd'),_0x462a33,'request\x20sent');_0x45d665(_0x52e1a6[_0x0bbc('0x14')][_0x0bbc('0x13')]);}})[_0x0bbc('0x15')](function(_0x32dda3){logger[_0x0bbc('0x11')](_0x0bbc('0xd'),_0x462a33,_0x32dda3);_0x398342(_0x32dda3);});});} \ No newline at end of file +var _0x8cb4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x8cb4,0x11e));var _0x48cb=function(_0x59d731,_0x3c5719){_0x59d731=_0x59d731-0x0;var _0x18271e=_0x8cb4[_0x59d731];return _0x18271e;};'use strict';var _=require(_0x48cb('0x0'));var util=require('util');var moment=require(_0x48cb('0x1'));var BPromise=require(_0x48cb('0x2'));var rs=require(_0x48cb('0x3'));var fs=require('fs');var Redis=require(_0x48cb('0x4'));var db=require(_0x48cb('0x5'))['db'];var utils=require(_0x48cb('0x6'));var logger=require('../../config/logger')(_0x48cb('0x7'));var config=require(_0x48cb('0x8'));var jayson=require(_0x48cb('0x9'));var client=jayson[_0x48cb('0xa')][_0x48cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58de9d,_0xf74166,_0x175512){return new BPromise(function(_0x38d3b1,_0x34a975){return client[_0x48cb('0xc')](_0x58de9d,_0x175512)[_0x48cb('0xd')](function(_0x57bda3){logger[_0x48cb('0xe')](_0x48cb('0xf'),_0xf74166,_0x48cb('0x10'));logger['debug'](_0x48cb('0x11'),_0xf74166,_0x48cb('0x10'),JSON[_0x48cb('0x12')](_0x57bda3));if(_0x57bda3['error']){if(_0x57bda3[_0x48cb('0x13')][_0x48cb('0x14')]===0x1f4){logger[_0x48cb('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0xf74166,_0x57bda3[_0x48cb('0x13')][_0x48cb('0x15')]);return _0x34a975(_0x57bda3['error'][_0x48cb('0x15')]);}logger[_0x48cb('0x13')](_0x48cb('0xf'),_0xf74166,_0x57bda3['error'][_0x48cb('0x15')]);return _0x38d3b1(_0x57bda3[_0x48cb('0x13')][_0x48cb('0x15')]);}else{logger[_0x48cb('0xe')](_0x48cb('0xf'),_0xf74166,_0x48cb('0x10'));_0x38d3b1(_0x57bda3[_0x48cb('0x16')][_0x48cb('0x15')]);}})[_0x48cb('0x17')](function(_0xa4c205){logger[_0x48cb('0x13')](_0x48cb('0xf'),_0xf74166,_0xa4c205);_0x34a975(_0xa4c205);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 5d03ea1..8836154 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 _0x2c5c=['show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2c5c,0x110));var _0xc2c5=function(_0x50fd6c,_0x386caa){_0x50fd6c=_0x50fd6c-0x0;var _0x7136cf=_0x2c5c[_0x50fd6c];return _0x7136cf;};'use strict';var multer=require(_0xc2c5('0x0'));var util=require(_0xc2c5('0x1'));var path=require(_0xc2c5('0x2'));var timeout=require(_0xc2c5('0x3'));var express=require(_0xc2c5('0x4'));var router=express['Router']();var fs_extra=require(_0xc2c5('0x5'));var auth=require(_0xc2c5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc2c5('0x7'));var controller=require(_0xc2c5('0x8'));router[_0xc2c5('0x9')]('/',auth['isAuthenticated'](),controller[_0xc2c5('0xa')]);router[_0xc2c5('0x9')](_0xc2c5('0xb'),auth[_0xc2c5('0xc')](),controller[_0xc2c5('0xd')]);router['post']('/',auth[_0xc2c5('0xc')](),controller[_0xc2c5('0xe')]);router['put'](_0xc2c5('0xb'),auth[_0xc2c5('0xc')](),controller[_0xc2c5('0xf')]);router[_0xc2c5('0x10')](_0xc2c5('0xb'),auth[_0xc2c5('0xc')](),controller[_0xc2c5('0x11')]);module[_0xc2c5('0x12')]=router; \ No newline at end of file +var _0xee95=['index','isAuthenticated','show','post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get'];(function(_0x489243,_0x256a8a){var _0x70acca=function(_0x2d8834){while(--_0x2d8834){_0x489243['push'](_0x489243['shift']());}};_0x70acca(++_0x256a8a);}(_0xee95,0x1c2));var _0x5ee9=function(_0x49478e,_0x8c449d){_0x49478e=_0x49478e-0x0;var _0x39fd61=_0xee95[_0x49478e];return _0x39fd61;};'use strict';var multer=require(_0x5ee9('0x0'));var util=require(_0x5ee9('0x1'));var path=require(_0x5ee9('0x2'));var timeout=require(_0x5ee9('0x3'));var express=require('express');var router=express[_0x5ee9('0x4')]();var fs_extra=require(_0x5ee9('0x5'));var auth=require(_0x5ee9('0x6'));var interaction=require(_0x5ee9('0x7'));var config=require('../../config/environment');var controller=require(_0x5ee9('0x8'));router[_0x5ee9('0x9')]('/',auth['isAuthenticated'](),controller[_0x5ee9('0xa')]);router['get']('/:id',auth[_0x5ee9('0xb')](),controller[_0x5ee9('0xc')]);router[_0x5ee9('0xd')]('/',auth[_0x5ee9('0xb')](),controller[_0x5ee9('0xe')]);router['put']('/:id',auth[_0x5ee9('0xb')](),controller[_0x5ee9('0xf')]);router[_0x5ee9('0x10')](_0x5ee9('0x11'),auth[_0x5ee9('0xb')](),controller[_0x5ee9('0x12')]);module[_0x5ee9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 13ce330..ba1eff7 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 _0x5292=['exports','string','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x59a877,_0x54e643){var _0x1ee498=function(_0x54e059){while(--_0x54e059){_0x59a877['push'](_0x59a877['shift']());}};_0x1ee498(++_0x54e643);}(_0x5292,0xf7));var _0x2529=function(_0x30c57f,_0x4e26ca){_0x30c57f=_0x30c57f-0x0;var _0x570756=_0x5292[_0x30c57f];return _0x570756;};'use strict';var Sequelize=require(_0x2529('0x0'));module[_0x2529('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2529('0x2'),'variable',_0x2529('0x3'),_0x2529('0x4'),_0x2529('0x5')),'defaultValue':_0x2529('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2529('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x2529('0x3'))},'keyContent':{'type':Sequelize[_0x2529('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2529('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2529('0x6')]}}; \ No newline at end of file +var _0xafc4=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x5ad200,_0x606cf9){var _0x155643=function(_0x497e5b){while(--_0x497e5b){_0x5ad200['push'](_0x5ad200['shift']());}};_0x155643(++_0x606cf9);}(_0xafc4,0x69));var _0x4afc=function(_0x1666ca,_0x260417){_0x1666ca=_0x1666ca-0x0;var _0x36b177=_0xafc4[_0x1666ca];return _0x36b177;};'use strict';var Sequelize=require(_0x4afc('0x0'));module['exports']={'type':{'type':Sequelize[_0x4afc('0x1')]('string',_0x4afc('0x2'),_0x4afc('0x3'),_0x4afc('0x4'),_0x4afc('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4afc('0x1')](_0x4afc('0x6'),_0x4afc('0x2'),_0x4afc('0x3'))},'keyContent':{'type':Sequelize[_0x4afc('0x7')]},'idField':{'type':Sequelize[_0x4afc('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4afc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4afc('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index d42fde8..b45597f 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 _0x1029=['body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','includeAll','include','options','find','catch','create'];(function(_0x46372c,_0x53e176){var _0x5c503b=function(_0x3302ec){while(--_0x3302ec){_0x46372c['push'](_0x46372c['shift']());}};_0x5c503b(++_0x53e176);}(_0x1029,0x17e));var _0x9102=function(_0x4356aa,_0x1e663d){_0x4356aa=_0x4356aa-0x0;var _0x59fc2d=_0x1029[_0x4356aa];return _0x59fc2d;};'use strict';var pdf=require(_0x9102('0x0'));var emlformat=require(_0x9102('0x1'));var rimraf=require(_0x9102('0x2'));var zipdir=require(_0x9102('0x3'));var jsonpatch=require(_0x9102('0x4'));var rp=require(_0x9102('0x5'));var moment=require(_0x9102('0x6'));var BPromise=require(_0x9102('0x7'));var Mustache=require(_0x9102('0x8'));var util=require(_0x9102('0x9'));var path=require(_0x9102('0xa'));var sox=require(_0x9102('0xb'));var csv=require(_0x9102('0xc'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9102('0xd'));var _=require('lodash');var squel=require(_0x9102('0xe'));var crypto=require(_0x9102('0xf'));var jsforce=require(_0x9102('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9102('0xc'));var querystring=require(_0x9102('0x11'));var Papa=require(_0x9102('0x12'));var Redis=require(_0x9102('0x13'));var authService=require(_0x9102('0x14'));var qs=require(_0x9102('0x15'));var as=require(_0x9102('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9102('0x17'))(_0x9102('0x18'));var utils=require('../../config/utils');var config=require(_0x9102('0x19'));var licenseUtil=require(_0x9102('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x594331,_0xc3b29f){_0xc3b29f=_0xc3b29f||0xcc;return function(_0x1fa670){if(_0x1fa670){return _0x594331[_0x9102('0x1b')](_0xc3b29f);}return _0x594331[_0x9102('0x1c')](_0xc3b29f)[_0x9102('0x1d')]();};}function respondWithResult(_0x1062a8,_0x221891){_0x221891=_0x221891||0xc8;return function(_0x38efd7){if(_0x38efd7){return _0x1062a8['status'](_0x221891)['json'](_0x38efd7);}};}function respondWithFilteredResult(_0x480744,_0x118f60){return function(_0x1afabd){if(_0x1afabd){var _0x573d0d=_0x1afabd[_0x9102('0x1e')],_0x2e1e31=_0x118f60[_0x9102('0x1f')],_0x3f2a5b=_0x118f60[_0x9102('0x1f')]+_0x118f60['limit'],_0x2ae0de;if(_0x3f2a5b>=_0x573d0d){_0x3f2a5b=_0x573d0d;_0x2ae0de=0xc8;}else{_0x2ae0de=0xce;}_0x480744['status'](_0x2ae0de);return _0x480744[_0x9102('0x20')](_0x9102('0x21'),_0x2e1e31+'-'+_0x3f2a5b+'/'+_0x573d0d)[_0x9102('0x22')](_0x1afabd);}return null;};}function patchUpdates(_0x12aa04){return function(_0x59066e){try{jsonpatch[_0x9102('0x23')](_0x59066e,_0x12aa04,!![]);}catch(_0x1e7762){return BPromise[_0x9102('0x24')](_0x1e7762);}return _0x59066e[_0x9102('0x25')]();};}function saveUpdates(_0xbe12bb,_0x41951e){return function(_0x4afd94){if(_0x4afd94){return _0x4afd94[_0x9102('0x26')](_0xbe12bb)['then'](function(_0x5acb0e){return _0x5acb0e;});}return null;};}function removeEntity(_0x45cf0c,_0x43939c){return function(_0x1f6f9d){if(_0x1f6f9d){return _0x1f6f9d[_0x9102('0x27')]()[_0x9102('0x28')](function(){_0x45cf0c[_0x9102('0x1c')](0xcc)[_0x9102('0x1d')]();});}};}function handleEntityNotFound(_0x23d144,_0x421e85){return function(_0x5b5035){if(!_0x5b5035){_0x23d144[_0x9102('0x1b')](0x194);}return _0x5b5035;};}function handleError(_0x4e5432,_0x2dc387){_0x2dc387=_0x2dc387||0x1f4;return function(_0x3a394d){logger[_0x9102('0x29')](_0x3a394d['stack']);if(_0x3a394d[_0x9102('0x2a')]){delete _0x3a394d[_0x9102('0x2a')];}_0x4e5432[_0x9102('0x1c')](_0x2dc387)[_0x9102('0x2b')](_0x3a394d);};}exports[_0x9102('0x2c')]=function(_0xb49aae,_0xb24aa2){var _0x305f64={},_0x56ea7b={},_0x27b34d={'count':0x0,'rows':[]};var _0x438d75=_[_0x9102('0x2d')](db[_0x9102('0x2e')][_0x9102('0x2f')],function(_0x3f7e8c){return{'name':_0x3f7e8c[_0x9102('0x30')],'type':_0x3f7e8c[_0x9102('0x31')][_0x9102('0x32')]};});_0x56ea7b[_0x9102('0x33')]=_['map'](_0x438d75,_0x9102('0x2a'));_0x56ea7b[_0x9102('0x34')]=_[_0x9102('0x35')](_0xb49aae[_0x9102('0x34')]);_0x56ea7b['filters']=_['intersection'](_0x56ea7b[_0x9102('0x33')],_0x56ea7b[_0x9102('0x34')]);_0x305f64['attributes']=_[_0x9102('0x36')](_0x56ea7b[_0x9102('0x33')],qs[_0x9102('0x37')](_0xb49aae[_0x9102('0x34')]['fields']));_0x305f64[_0x9102('0x38')]=_0x305f64[_0x9102('0x38')][_0x9102('0x39')]?_0x305f64['attributes']:_0x56ea7b[_0x9102('0x33')];if(!_0xb49aae[_0x9102('0x34')][_0x9102('0x3a')](_0x9102('0x3b'))){_0x305f64['limit']=qs['limit'](_0xb49aae[_0x9102('0x34')][_0x9102('0x3c')]);_0x305f64['offset']=qs[_0x9102('0x1f')](_0xb49aae[_0x9102('0x34')][_0x9102('0x1f')]);}_0x305f64[_0x9102('0x3d')]=qs[_0x9102('0x3e')](_0xb49aae[_0x9102('0x34')][_0x9102('0x3e')]);_0x305f64[_0x9102('0x3f')]=qs[_0x9102('0x40')](_[_0x9102('0x41')](_0xb49aae[_0x9102('0x34')],_0x56ea7b[_0x9102('0x40')]),_0x438d75);if(_0xb49aae[_0x9102('0x34')][_0x9102('0x42')]){_0x305f64[_0x9102('0x3f')]=_[_0x9102('0x43')](_0x305f64['where'],{'$or':_[_0x9102('0x2d')](_0x438d75,function(_0x430781){if(_0x430781[_0x9102('0x31')]!=='VIRTUAL'){var _0x2f35ee={};_0x2f35ee[_0x430781[_0x9102('0x2a')]]={'$like':'%'+_0xb49aae[_0x9102('0x34')][_0x9102('0x42')]+'%'};return _0x2f35ee;}})});}_0x305f64=_[_0x9102('0x43')]({},_0x305f64,_0xb49aae['options']);var _0x1464a5={'where':_0x305f64[_0x9102('0x3f')]};return db[_0x9102('0x2e')]['count'](_0x1464a5)[_0x9102('0x28')](function(_0x1707f6){_0x27b34d['count']=_0x1707f6;if(_0xb49aae['query'][_0x9102('0x44')]){_0x305f64[_0x9102('0x45')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x305f64);})['then'](function(_0x53c3af){_0x27b34d['rows']=_0x53c3af;return _0x27b34d;})[_0x9102('0x28')](respondWithFilteredResult(_0xb24aa2,_0x305f64))['catch'](handleError(_0xb24aa2,null));};exports['show']=function(_0x13f1c3,_0x18a208){var _0x464b6e={'raw':!![],'where':{'id':_0x13f1c3['params']['id']}},_0x1858fb={};_0x1858fb[_0x9102('0x33')]=_['keys'](db['ServicenowField'][_0x9102('0x2f')]);_0x1858fb[_0x9102('0x34')]=_[_0x9102('0x35')](_0x13f1c3['query']);_0x1858fb[_0x9102('0x40')]=_[_0x9102('0x36')](_0x1858fb[_0x9102('0x33')],_0x1858fb[_0x9102('0x34')]);_0x464b6e['attributes']=_[_0x9102('0x36')](_0x1858fb[_0x9102('0x33')],qs[_0x9102('0x37')](_0x13f1c3[_0x9102('0x34')][_0x9102('0x37')]));_0x464b6e[_0x9102('0x38')]=_0x464b6e[_0x9102('0x38')][_0x9102('0x39')]?_0x464b6e[_0x9102('0x38')]:_0x1858fb[_0x9102('0x33')];if(_0x13f1c3['query'][_0x9102('0x44')]){_0x464b6e[_0x9102('0x45')]=[{'all':!![]}];}_0x464b6e=_[_0x9102('0x43')]({},_0x464b6e,_0x13f1c3[_0x9102('0x46')]);return db[_0x9102('0x2e')][_0x9102('0x47')](_0x464b6e)[_0x9102('0x28')](handleEntityNotFound(_0x18a208,null))[_0x9102('0x28')](respondWithResult(_0x18a208,null))[_0x9102('0x48')](handleError(_0x18a208,null));};exports[_0x9102('0x49')]=function(_0x2f12ad,_0x3ac8d7){return db[_0x9102('0x2e')][_0x9102('0x49')](_0x2f12ad[_0x9102('0x4a')],{})['then'](respondWithResult(_0x3ac8d7,0xc9))[_0x9102('0x48')](handleError(_0x3ac8d7,null));};exports[_0x9102('0x26')]=function(_0x26805c,_0x1c2a9e){if(_0x26805c[_0x9102('0x4a')]['id']){delete _0x26805c[_0x9102('0x4a')]['id'];}return db[_0x9102('0x2e')]['find']({'where':{'id':_0x26805c[_0x9102('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1c2a9e,null))[_0x9102('0x28')](saveUpdates(_0x26805c[_0x9102('0x4a')],null))[_0x9102('0x28')](respondWithResult(_0x1c2a9e,null))[_0x9102('0x48')](handleError(_0x1c2a9e,null));};exports['destroy']=function(_0x3bf70d,_0x3af39f){return db[_0x9102('0x2e')][_0x9102('0x47')]({'where':{'id':_0x3bf70d['params']['id']}})[_0x9102('0x28')](handleEntityNotFound(_0x3af39f,null))['then'](removeEntity(_0x3af39f,null))[_0x9102('0x48')](handleError(_0x3af39f,null));}; \ No newline at end of file +var _0x1751=['body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','reject','save','then','destroy','error','name','index','map','ServicenowField','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','options','find','create'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x1751,0xe4));var _0x1175=function(_0x52bc63,_0x278017){_0x52bc63=_0x52bc63-0x0;var _0x472459=_0x1751[_0x52bc63];return _0x472459;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1175('0x0'));var rimraf=require(_0x1175('0x1'));var zipdir=require(_0x1175('0x2'));var jsonpatch=require(_0x1175('0x3'));var rp=require(_0x1175('0x4'));var moment=require('moment');var BPromise=require(_0x1175('0x5'));var Mustache=require(_0x1175('0x6'));var util=require('util');var path=require(_0x1175('0x7'));var sox=require(_0x1175('0x8'));var csv=require(_0x1175('0x9'));var ejs=require(_0x1175('0xa'));var fs=require('fs');var fs_extra=require(_0x1175('0xb'));var _=require(_0x1175('0xc'));var squel=require(_0x1175('0xd'));var crypto=require(_0x1175('0xe'));var jsforce=require(_0x1175('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1175('0x10'));var Papa=require(_0x1175('0x11'));var Redis=require(_0x1175('0x12'));var authService=require(_0x1175('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1175('0x14'));var logger=require('../../config/logger')(_0x1175('0x15'));var utils=require(_0x1175('0x16'));var config=require(_0x1175('0x17'));var licenseUtil=require(_0x1175('0x18'));var db=require(_0x1175('0x19'))['db'];function respondWithStatusCode(_0x28c270,_0x4d60ac){_0x4d60ac=_0x4d60ac||0xcc;return function(_0x2610bd){if(_0x2610bd){return _0x28c270[_0x1175('0x1a')](_0x4d60ac);}return _0x28c270[_0x1175('0x1b')](_0x4d60ac)[_0x1175('0x1c')]();};}function respondWithResult(_0x2b8015,_0x5368c5){_0x5368c5=_0x5368c5||0xc8;return function(_0x5cb6e8){if(_0x5cb6e8){return _0x2b8015[_0x1175('0x1b')](_0x5368c5)[_0x1175('0x1d')](_0x5cb6e8);}};}function respondWithFilteredResult(_0x250200,_0x926cd4){return function(_0x3af3a1){if(_0x3af3a1){var _0x255cd3=_0x3af3a1[_0x1175('0x1e')],_0x351035=_0x926cd4['offset'],_0x3e53ca=_0x926cd4['offset']+_0x926cd4['limit'],_0x1d892a;if(_0x3e53ca>=_0x255cd3){_0x3e53ca=_0x255cd3;_0x1d892a=0xc8;}else{_0x1d892a=0xce;}_0x250200[_0x1175('0x1b')](_0x1d892a);return _0x250200[_0x1175('0x1f')](_0x1175('0x20'),_0x351035+'-'+_0x3e53ca+'/'+_0x255cd3)[_0x1175('0x1d')](_0x3af3a1);}return null;};}function patchUpdates(_0x37454b){return function(_0x5ad85e){try{jsonpatch['apply'](_0x5ad85e,_0x37454b,!![]);}catch(_0x13250f){return BPromise[_0x1175('0x21')](_0x13250f);}return _0x5ad85e[_0x1175('0x22')]();};}function saveUpdates(_0x30fe5d,_0x5ef591){return function(_0x5b552d){if(_0x5b552d){return _0x5b552d['update'](_0x30fe5d)[_0x1175('0x23')](function(_0x499f1c){return _0x499f1c;});}return null;};}function removeEntity(_0x370043,_0x19b967){return function(_0x4cdea7){if(_0x4cdea7){return _0x4cdea7[_0x1175('0x24')]()[_0x1175('0x23')](function(){_0x370043[_0x1175('0x1b')](0xcc)[_0x1175('0x1c')]();});}};}function handleEntityNotFound(_0x5db377,_0x52b9be){return function(_0x5aa373){if(!_0x5aa373){_0x5db377[_0x1175('0x1a')](0x194);}return _0x5aa373;};}function handleError(_0x497a8c,_0x9f5b56){_0x9f5b56=_0x9f5b56||0x1f4;return function(_0x3c0f1f){logger[_0x1175('0x25')](_0x3c0f1f['stack']);if(_0x3c0f1f[_0x1175('0x26')]){delete _0x3c0f1f[_0x1175('0x26')];}_0x497a8c['status'](_0x9f5b56)['send'](_0x3c0f1f);};}exports[_0x1175('0x27')]=function(_0x467ad3,_0x43c3d3){var _0x225263={},_0x1fdfc9={},_0x92a481={'count':0x0,'rows':[]};var _0xed833b=_[_0x1175('0x28')](db[_0x1175('0x29')][_0x1175('0x2a')],function(_0x464a4c){return{'name':_0x464a4c[_0x1175('0x2b')],'type':_0x464a4c[_0x1175('0x2c')]['key']};});_0x1fdfc9['model']=_[_0x1175('0x28')](_0xed833b,'name');_0x1fdfc9[_0x1175('0x2d')]=_[_0x1175('0x2e')](_0x467ad3[_0x1175('0x2d')]);_0x1fdfc9['filters']=_[_0x1175('0x2f')](_0x1fdfc9[_0x1175('0x30')],_0x1fdfc9[_0x1175('0x2d')]);_0x225263[_0x1175('0x31')]=_[_0x1175('0x2f')](_0x1fdfc9[_0x1175('0x30')],qs['fields'](_0x467ad3[_0x1175('0x2d')][_0x1175('0x32')]));_0x225263[_0x1175('0x31')]=_0x225263[_0x1175('0x31')][_0x1175('0x33')]?_0x225263['attributes']:_0x1fdfc9[_0x1175('0x30')];if(!_0x467ad3[_0x1175('0x2d')][_0x1175('0x34')]('nolimit')){_0x225263[_0x1175('0x35')]=qs[_0x1175('0x35')](_0x467ad3[_0x1175('0x2d')][_0x1175('0x35')]);_0x225263[_0x1175('0x36')]=qs[_0x1175('0x36')](_0x467ad3[_0x1175('0x2d')][_0x1175('0x36')]);}_0x225263[_0x1175('0x37')]=qs[_0x1175('0x38')](_0x467ad3[_0x1175('0x2d')]['sort']);_0x225263[_0x1175('0x39')]=qs[_0x1175('0x3a')](_[_0x1175('0x3b')](_0x467ad3[_0x1175('0x2d')],_0x1fdfc9[_0x1175('0x3a')]),_0xed833b);if(_0x467ad3[_0x1175('0x2d')][_0x1175('0x3c')]){_0x225263[_0x1175('0x39')]=_['merge'](_0x225263[_0x1175('0x39')],{'$or':_['map'](_0xed833b,function(_0xc5239){if(_0xc5239[_0x1175('0x2c')]!==_0x1175('0x3d')){var _0x4fdf93={};_0x4fdf93[_0xc5239['name']]={'$like':'%'+_0x467ad3[_0x1175('0x2d')][_0x1175('0x3c')]+'%'};return _0x4fdf93;}})});}_0x225263=_[_0x1175('0x3e')]({},_0x225263,_0x467ad3['options']);var _0x414a0e={'where':_0x225263[_0x1175('0x39')]};return db[_0x1175('0x29')]['count'](_0x414a0e)[_0x1175('0x23')](function(_0x5c5988){_0x92a481[_0x1175('0x1e')]=_0x5c5988;if(_0x467ad3[_0x1175('0x2d')][_0x1175('0x3f')]){_0x225263[_0x1175('0x40')]=[{'all':!![]}];}return db['ServicenowField'][_0x1175('0x41')](_0x225263);})['then'](function(_0x16a989){_0x92a481[_0x1175('0x42')]=_0x16a989;return _0x92a481;})[_0x1175('0x23')](respondWithFilteredResult(_0x43c3d3,_0x225263))[_0x1175('0x43')](handleError(_0x43c3d3,null));};exports[_0x1175('0x44')]=function(_0x1a909b,_0x432b86){var _0x3ec138={'raw':!![],'where':{'id':_0x1a909b['params']['id']}},_0x816680={};_0x816680[_0x1175('0x30')]=_[_0x1175('0x2e')](db[_0x1175('0x29')][_0x1175('0x2a')]);_0x816680[_0x1175('0x2d')]=_[_0x1175('0x2e')](_0x1a909b[_0x1175('0x2d')]);_0x816680[_0x1175('0x3a')]=_[_0x1175('0x2f')](_0x816680[_0x1175('0x30')],_0x816680[_0x1175('0x2d')]);_0x3ec138[_0x1175('0x31')]=_[_0x1175('0x2f')](_0x816680[_0x1175('0x30')],qs['fields'](_0x1a909b[_0x1175('0x2d')][_0x1175('0x32')]));_0x3ec138[_0x1175('0x31')]=_0x3ec138['attributes'][_0x1175('0x33')]?_0x3ec138[_0x1175('0x31')]:_0x816680['model'];if(_0x1a909b[_0x1175('0x2d')]['includeAll']){_0x3ec138[_0x1175('0x40')]=[{'all':!![]}];}_0x3ec138=_['merge']({},_0x3ec138,_0x1a909b[_0x1175('0x45')]);return db['ServicenowField'][_0x1175('0x46')](_0x3ec138)[_0x1175('0x23')](handleEntityNotFound(_0x432b86,null))['then'](respondWithResult(_0x432b86,null))[_0x1175('0x43')](handleError(_0x432b86,null));};exports[_0x1175('0x47')]=function(_0xab500a,_0x1911b0){return db['ServicenowField'][_0x1175('0x47')](_0xab500a[_0x1175('0x48')],{})[_0x1175('0x23')](respondWithResult(_0x1911b0,0xc9))['catch'](handleError(_0x1911b0,null));};exports[_0x1175('0x49')]=function(_0xbbd47d,_0x2e0847){if(_0xbbd47d[_0x1175('0x48')]['id']){delete _0xbbd47d['body']['id'];}return db['ServicenowField'][_0x1175('0x46')]({'where':{'id':_0xbbd47d['params']['id']}})[_0x1175('0x23')](handleEntityNotFound(_0x2e0847,null))['then'](saveUpdates(_0xbbd47d['body'],null))[_0x1175('0x23')](respondWithResult(_0x2e0847,null))[_0x1175('0x43')](handleError(_0x2e0847,null));};exports[_0x1175('0x24')]=function(_0x1a33e1,_0x15ca2e){return db['ServicenowField'][_0x1175('0x46')]({'where':{'id':_0x1a33e1[_0x1175('0x4a')]['id']}})[_0x1175('0x23')](handleEntityNotFound(_0x15ca2e,null))[_0x1175('0x23')](removeEntity(_0x15ca2e,null))[_0x1175('0x43')](handleError(_0x15ca2e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 3f4d0e4..fd12411 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 _0x6b86=['define','int_servicenow_fields','lodash','util','../../config/logger','api','path','rimraf','./intServicenowField.attributes','exports'];(function(_0x36bde9,_0x10858e){var _0x4b6b49=function(_0x1940ad){while(--_0x1940ad){_0x36bde9['push'](_0x36bde9['shift']());}};_0x4b6b49(++_0x10858e);}(_0x6b86,0xa2));var _0x66b8=function(_0x2e0c29,_0x3153b1){_0x2e0c29=_0x2e0c29-0x0;var _0x197545=_0x6b86[_0x2e0c29];return _0x197545;};'use strict';var _=require(_0x66b8('0x0'));var util=require(_0x66b8('0x1'));var logger=require(_0x66b8('0x2'))(_0x66b8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x66b8('0x4'));var rimraf=require(_0x66b8('0x5'));var config=require('../../config/environment');var attributes=require(_0x66b8('0x6'));module[_0x66b8('0x7')]=function(_0x1af497,_0x5f47fa){return _0x1af497[_0x66b8('0x8')]('ServicenowField',attributes,{'tableName':_0x66b8('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x805f=['rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xd6a763,_0x563229){var _0x4bf8ca=function(_0x213e83){while(--_0x213e83){_0xd6a763['push'](_0xd6a763['shift']());}};_0x4bf8ca(++_0x563229);}(_0x805f,0x13b));var _0xf805=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x805f[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xf805('0x0'));var util=require(_0xf805('0x1'));var logger=require(_0xf805('0x2'))(_0xf805('0x3'));var moment=require(_0xf805('0x4'));var BPromise=require(_0xf805('0x5'));var rp=require(_0xf805('0x6'));var fs=require('fs');var path=require(_0xf805('0x7'));var rimraf=require(_0xf805('0x8'));var config=require(_0xf805('0x9'));var attributes=require(_0xf805('0xa'));module[_0xf805('0xb')]=function(_0x35578d,_0x2a6d69){return _0x35578d[_0xf805('0xc')](_0xf805('0xd'),attributes,{'tableName':_0xf805('0xe'),'paranoid':![],'indexes':[{'name':_0xf805('0xf'),'fields':[_0xf805('0x10'),'FieldId'],'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 bf607dc..9762d80 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 _0x879e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x879e,0x104));var _0xe879=function(_0x3e2f39,_0x52276d){_0x3e2f39=_0x3e2f39-0x0;var _0x1f915c=_0x879e[_0x3e2f39];return _0x1f915c;};'use strict';var _=require(_0xe879('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe879('0x1'));var rs=require(_0xe879('0x2'));var fs=require('fs');var Redis=require(_0xe879('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe879('0x4'));var logger=require(_0xe879('0x5'))(_0xe879('0x6'));var config=require(_0xe879('0x7'));var jayson=require(_0xe879('0x8'));var client=jayson[_0xe879('0x9')][_0xe879('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x472c38,_0x21bce7,_0x2c9902){return new BPromise(function(_0x1f509a,_0x3638ba){return client[_0xe879('0xb')](_0x472c38,_0x2c9902)[_0xe879('0xc')](function(_0x344210){logger[_0xe879('0xd')](_0xe879('0xe'),_0x21bce7,_0xe879('0xf'));logger[_0xe879('0x10')](_0xe879('0x11'),_0x21bce7,_0xe879('0xf'),JSON[_0xe879('0x12')](_0x344210));if(_0x344210[_0xe879('0x13')]){if(_0x344210[_0xe879('0x13')][_0xe879('0x14')]===0x1f4){logger[_0xe879('0x13')]('ServicenowField,\x20%s,\x20%s',_0x21bce7,_0x344210['error'][_0xe879('0x15')]);return _0x3638ba(_0x344210[_0xe879('0x13')][_0xe879('0x15')]);}logger[_0xe879('0x13')]('ServicenowField,\x20%s,\x20%s',_0x21bce7,_0x344210['error'][_0xe879('0x15')]);return _0x1f509a(_0x344210['error'][_0xe879('0x15')]);}else{logger[_0xe879('0xd')](_0xe879('0xe'),_0x21bce7,_0xe879('0xf'));_0x1f509a(_0x344210[_0xe879('0x16')]['message']);}})[_0xe879('0x17')](function(_0x7713e4){logger[_0xe879('0x13')](_0xe879('0xe'),_0x21bce7,_0x7713e4);_0x3638ba(_0x7713e4);});});} \ No newline at end of file +var _0xa4db=['../../config/logger','../../config/environment','client','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa4db,0x1ed));var _0xba4d=function(_0x5189be,_0xbe97e4){_0x5189be=_0x5189be-0x0;var _0x170532=_0xa4db[_0x5189be];return _0x170532;};'use strict';var _=require(_0xba4d('0x0'));var util=require(_0xba4d('0x1'));var moment=require(_0xba4d('0x2'));var BPromise=require(_0xba4d('0x3'));var rs=require(_0xba4d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba4d('0x5'))['db'];var utils=require(_0xba4d('0x6'));var logger=require(_0xba4d('0x7'))('rpc');var config=require(_0xba4d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xba4d('0x9')][_0xba4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c330b,_0x2a097a,_0x13a345){return new BPromise(function(_0x4cc773,_0xb395){return client['request'](_0x2c330b,_0x13a345)[_0xba4d('0xb')](function(_0x2f053b){logger[_0xba4d('0xc')](_0xba4d('0xd'),_0x2a097a,_0xba4d('0xe'));logger['debug'](_0xba4d('0xf'),_0x2a097a,_0xba4d('0xe'),JSON[_0xba4d('0x10')](_0x2f053b));if(_0x2f053b[_0xba4d('0x11')]){if(_0x2f053b['error']['code']===0x1f4){logger['error'](_0xba4d('0xd'),_0x2a097a,_0x2f053b['error'][_0xba4d('0x12')]);return _0xb395(_0x2f053b[_0xba4d('0x11')]['message']);}logger['error'](_0xba4d('0xd'),_0x2a097a,_0x2f053b[_0xba4d('0x11')][_0xba4d('0x12')]);return _0x4cc773(_0x2f053b[_0xba4d('0x11')][_0xba4d('0x12')]);}else{logger[_0xba4d('0xc')](_0xba4d('0xd'),_0x2a097a,_0xba4d('0xe'));_0x4cc773(_0x2f053b[_0xba4d('0x13')]['message']);}})['catch'](function(_0x2f8a1a){logger[_0xba4d('0x11')](_0xba4d('0xd'),_0x2a097a,_0x2f8a1a);_0xb395(_0x2f8a1a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 0f5f142..709de68 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 _0xe860=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','show'];(function(_0x4872ad,_0x5c8968){var _0x3ef263=function(_0x146c08){while(--_0x146c08){_0x4872ad['push'](_0x4872ad['shift']());}};_0x3ef263(++_0x5c8968);}(_0xe860,0x15b));var _0x0e86=function(_0x4fd57e,_0x154b79){_0x4fd57e=_0x4fd57e-0x0;var _0x782aa7=_0xe860[_0x4fd57e];return _0x782aa7;};'use strict';var multer=require(_0x0e86('0x0'));var util=require(_0x0e86('0x1'));var path=require('path');var timeout=require(_0x0e86('0x2'));var express=require('express');var router=express[_0x0e86('0x3')]();var fs_extra=require(_0x0e86('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0e86('0x5'));var controller=require('./intSugarcrmAccount.controller');router[_0x0e86('0x6')]('/',auth[_0x0e86('0x7')](),controller[_0x0e86('0x8')]);router['get']('/:id',auth[_0x0e86('0x7')](),controller[_0x0e86('0x9')]);router[_0x0e86('0x6')](_0x0e86('0xa'),auth[_0x0e86('0x7')](),controller[_0x0e86('0xb')]);router[_0x0e86('0x6')](_0x0e86('0xc'),auth['isAuthenticated'](),controller[_0x0e86('0xd')]);router[_0x0e86('0xe')]('/',auth[_0x0e86('0x7')](),controller[_0x0e86('0xf')]);router[_0x0e86('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x0e86('0x10')](_0x0e86('0x11'),auth[_0x0e86('0x7')](),controller[_0x0e86('0x12')]);router[_0x0e86('0x13')]('/:id',auth[_0x0e86('0x7')](),controller['destroy']);module[_0x0e86('0x14')]=router; \ No newline at end of file +var _0xb58f=['../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5a56d3,_0x1443e6){var _0x4e2458=function(_0x2b0c7e){while(--_0x2b0c7e){_0x5a56d3['push'](_0x5a56d3['shift']());}};_0x4e2458(++_0x1443e6);}(_0xb58f,0x1b2));var _0xfb58=function(_0x43d294,_0x4d71aa){_0x43d294=_0x43d294-0x0;var _0x205d68=_0xb58f[_0x43d294];return _0x205d68;};'use strict';var multer=require(_0xfb58('0x0'));var util=require(_0xfb58('0x1'));var path=require(_0xfb58('0x2'));var timeout=require(_0xfb58('0x3'));var express=require(_0xfb58('0x4'));var router=express['Router']();var fs_extra=require(_0xfb58('0x5'));var auth=require(_0xfb58('0x6'));var interaction=require(_0xfb58('0x7'));var config=require(_0xfb58('0x8'));var controller=require(_0xfb58('0x9'));router[_0xfb58('0xa')]('/',auth[_0xfb58('0xb')](),controller[_0xfb58('0xc')]);router['get'](_0xfb58('0xd'),auth[_0xfb58('0xb')](),controller[_0xfb58('0xe')]);router['get'](_0xfb58('0xf'),auth[_0xfb58('0xb')](),controller[_0xfb58('0x10')]);router[_0xfb58('0xa')](_0xfb58('0x11'),auth['isAuthenticated'](),controller[_0xfb58('0x12')]);router[_0xfb58('0x13')]('/',auth[_0xfb58('0xb')](),controller[_0xfb58('0x14')]);router[_0xfb58('0x13')](_0xfb58('0xf'),auth[_0xfb58('0xb')](),controller[_0xfb58('0x15')]);router[_0xfb58('0x16')](_0xfb58('0xd'),auth['isAuthenticated'](),controller[_0xfb58('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xfb58('0x18')]);module[_0xfb58('0x19')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index d4682c4..9493089 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 _0xd50a=['sequelize','STRING','username','remoteUri'];(function(_0x2bb2b7,_0x4f85d2){var _0xab7dea=function(_0x3e9022){while(--_0x3e9022){_0x2bb2b7['push'](_0x2bb2b7['shift']());}};_0xab7dea(++_0x4f85d2);}(_0xd50a,0xd8));var _0xad50=function(_0x17ded1,_0x4efb57){_0x17ded1=_0x17ded1-0x0;var _0x47f0ab=_0xd50a[_0x17ded1];return _0x47f0ab;};'use strict';var Sequelize=require(_0xad50('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xad50('0x1')]},'username':{'type':Sequelize[_0xad50('0x1')],'unique':_0xad50('0x2')},'password':{'type':Sequelize[_0xad50('0x1')]},'remoteUri':{'type':Sequelize[_0xad50('0x1')],'unique':_0xad50('0x3')},'serverUrl':{'type':Sequelize[_0xad50('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x322c=['STRING','username','remoteUri','sequelize','exports'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x322c,0x80));var _0xc322=function(_0x2e07c6,_0x5a7993){_0x2e07c6=_0x2e07c6-0x0;var _0x54ff26=_0x322c[_0x2e07c6];return _0x54ff26;};'use strict';var Sequelize=require(_0xc322('0x0'));module[_0xc322('0x1')]={'name':{'type':Sequelize[_0xc322('0x2')]},'description':{'type':Sequelize[_0xc322('0x2')]},'username':{'type':Sequelize[_0xc322('0x2')],'unique':_0xc322('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc322('0x2')],'unique':_0xc322('0x4')},'serverUrl':{'type':Sequelize[_0xc322('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 0e5f5e0..78faa32 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 _0xde3d=['moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','json','offset','limit','set','reject','save','update','sendStatus','stack','name','index','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','SugarcrmAccount','count','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','destroy','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','username','remoteUri','substring','lastIndexOf','POST','format','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','remove','includes','endsWith','values','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xde3d,0xff));var _0xdde3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde3d[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xdde3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdde3('0x1'));var zipdir=require(_0xdde3('0x2'));var jsonpatch=require(_0xdde3('0x3'));var rp=require(_0xdde3('0x4'));var moment=require(_0xdde3('0x5'));var BPromise=require(_0xdde3('0x6'));var Mustache=require(_0xdde3('0x7'));var util=require(_0xdde3('0x8'));var path=require('path');var sox=require(_0xdde3('0x9'));var csv=require(_0xdde3('0xa'));var ejs=require(_0xdde3('0xb'));var fs=require('fs');var fs_extra=require(_0xdde3('0xc'));var _=require(_0xdde3('0xd'));var squel=require(_0xdde3('0xe'));var crypto=require(_0xdde3('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdde3('0xa'));var querystring=require(_0xdde3('0x10'));var Papa=require('papaparse');var Redis=require(_0xdde3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdde3('0x12'));var as=require(_0xdde3('0x13'));var hardwareService=require(_0xdde3('0x14'));var logger=require(_0xdde3('0x15'))(_0xdde3('0x16'));var utils=require(_0xdde3('0x17'));var config=require(_0xdde3('0x18'));var licenseUtil=require(_0xdde3('0x19'));var db=require(_0xdde3('0x1a'))['db'];var integrations=require(_0xdde3('0x1b'));var jayson=require(_0xdde3('0x1c'));var client=jayson[_0xdde3('0x1d')][_0xdde3('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x16c31d,_0x1b3e2b,_0x5ba8c9,_0x2837a1){return new BPromise(function(_0x15e785,_0x76b5d1){var _0x1c2034=_0x2837a1||client;return _0x1c2034['request'](_0x16c31d,_0x5ba8c9)[_0xdde3('0x1f')](function(_0x4d6d6a){logger['info'](_0xdde3('0x20'),_0x1b3e2b,'request\x20sent');logger[_0xdde3('0x21')](_0xdde3('0x22'),_0x1b3e2b,_0xdde3('0x23'),JSON[_0xdde3('0x24')](_0x4d6d6a));if(_0x4d6d6a[_0xdde3('0x25')]){if(_0x4d6d6a[_0xdde3('0x25')][_0xdde3('0x26')]===0x1f4){logger[_0xdde3('0x25')](_0xdde3('0x20'),_0x1b3e2b,_0x4d6d6a[_0xdde3('0x25')][_0xdde3('0x27')]);return _0x76b5d1(_0x4d6d6a[_0xdde3('0x25')][_0xdde3('0x27')]);}logger[_0xdde3('0x25')](_0xdde3('0x20'),_0x1b3e2b,_0x4d6d6a[_0xdde3('0x25')][_0xdde3('0x27')]);return _0x15e785(_0x4d6d6a[_0xdde3('0x25')][_0xdde3('0x27')]);}else{logger['info'](_0xdde3('0x20'),_0x1b3e2b,_0xdde3('0x23'));_0x15e785(_0x4d6d6a[_0xdde3('0x28')]['message']);}})[_0xdde3('0x29')](function(_0x194408){logger[_0xdde3('0x25')](_0xdde3('0x20'),_0x1b3e2b,_0x194408);_0x76b5d1(_0x194408);});});}function respondWithStatusCode(_0xb6c105,_0x3db29c){_0x3db29c=_0x3db29c||0xcc;return function(_0x3b701d){if(_0x3b701d){return _0xb6c105['sendStatus'](_0x3db29c);}return _0xb6c105['status'](_0x3db29c)[_0xdde3('0x2a')]();};}function respondWithResult(_0x2e1ad5,_0x4714cd){_0x4714cd=_0x4714cd||0xc8;return function(_0x186861){if(_0x186861){return _0x2e1ad5[_0xdde3('0x2b')](_0x4714cd)[_0xdde3('0x2c')](_0x186861);}};}function respondWithFilteredResult(_0x24b729,_0x28af6c){return function(_0x34c12b){if(_0x34c12b){var _0x34d739=_0x34c12b['count'],_0x1abedf=_0x28af6c[_0xdde3('0x2d')],_0x33504d=_0x28af6c[_0xdde3('0x2d')]+_0x28af6c[_0xdde3('0x2e')],_0x21ce23;if(_0x33504d>=_0x34d739){_0x33504d=_0x34d739;_0x21ce23=0xc8;}else{_0x21ce23=0xce;}_0x24b729[_0xdde3('0x2b')](_0x21ce23);return _0x24b729[_0xdde3('0x2f')]('Content-Range',_0x1abedf+'-'+_0x33504d+'/'+_0x34d739)['json'](_0x34c12b);}return null;};}function patchUpdates(_0x480008){return function(_0x346a2c){try{jsonpatch['apply'](_0x346a2c,_0x480008,!![]);}catch(_0x5a025b){return BPromise[_0xdde3('0x30')](_0x5a025b);}return _0x346a2c[_0xdde3('0x31')]();};}function saveUpdates(_0x58970b,_0x481f98){return function(_0x40385f){if(_0x40385f){return _0x40385f[_0xdde3('0x32')](_0x58970b)[_0xdde3('0x1f')](function(_0x36f410){return _0x36f410;});}return null;};}function removeEntity(_0x10ed0e,_0x5655da){return function(_0x5ed821){if(_0x5ed821){return _0x5ed821['destroy']()['then'](function(){_0x10ed0e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cec66,_0xf6822){return function(_0x382e1a){if(!_0x382e1a){_0x1cec66[_0xdde3('0x33')](0x194);}return _0x382e1a;};}function handleError(_0x107d40,_0x82bba8){_0x82bba8=_0x82bba8||0x1f4;return function(_0x37b00a){logger[_0xdde3('0x25')](_0x37b00a[_0xdde3('0x34')]);if(_0x37b00a[_0xdde3('0x35')]){delete _0x37b00a[_0xdde3('0x35')];}_0x107d40[_0xdde3('0x2b')](_0x82bba8)['send'](_0x37b00a);};}exports[_0xdde3('0x36')]=function(_0x58fc19,_0x92b65e){var _0x107757={},_0x23742b={},_0x189c13={'count':0x0,'rows':[]};var _0x21473b=_['map'](db['SugarcrmAccount']['rawAttributes'],function(_0x4dc5f1){return{'name':_0x4dc5f1['fieldName'],'type':_0x4dc5f1[_0xdde3('0x37')][_0xdde3('0x38')]};});_0x23742b[_0xdde3('0x39')]=_['map'](_0x21473b,'name');_0x23742b[_0xdde3('0x3a')]=_['keys'](_0x58fc19[_0xdde3('0x3a')]);_0x23742b[_0xdde3('0x3b')]=_[_0xdde3('0x3c')](_0x23742b[_0xdde3('0x39')],_0x23742b[_0xdde3('0x3a')]);_0x107757[_0xdde3('0x3d')]=_[_0xdde3('0x3c')](_0x23742b['model'],qs[_0xdde3('0x3e')](_0x58fc19[_0xdde3('0x3a')][_0xdde3('0x3e')]));_0x107757[_0xdde3('0x3d')]=_0x107757[_0xdde3('0x3d')][_0xdde3('0x3f')]?_0x107757[_0xdde3('0x3d')]:_0x23742b[_0xdde3('0x39')];if(!_0x58fc19['query']['hasOwnProperty'](_0xdde3('0x40'))){_0x107757[_0xdde3('0x2e')]=qs[_0xdde3('0x2e')](_0x58fc19[_0xdde3('0x3a')][_0xdde3('0x2e')]);_0x107757[_0xdde3('0x2d')]=qs[_0xdde3('0x2d')](_0x58fc19[_0xdde3('0x3a')][_0xdde3('0x2d')]);}_0x107757[_0xdde3('0x41')]=qs[_0xdde3('0x42')](_0x58fc19[_0xdde3('0x3a')]['sort']);_0x107757[_0xdde3('0x43')]=qs[_0xdde3('0x3b')](_[_0xdde3('0x44')](_0x58fc19[_0xdde3('0x3a')],_0x23742b[_0xdde3('0x3b')]),_0x21473b);if(_0x58fc19['query'][_0xdde3('0x45')]){_0x107757[_0xdde3('0x43')]=_[_0xdde3('0x46')](_0x107757['where'],{'$or':_[_0xdde3('0x47')](_0x21473b,function(_0x4748e0){if(_0x4748e0['type']!==_0xdde3('0x48')){var _0x4360d2={};_0x4360d2[_0x4748e0['name']]={'$like':'%'+_0x58fc19[_0xdde3('0x3a')][_0xdde3('0x45')]+'%'};return _0x4360d2;}})});}_0x107757=_[_0xdde3('0x46')]({},_0x107757,_0x58fc19[_0xdde3('0x49')]);var _0x13bee7={'where':_0x107757[_0xdde3('0x43')]};return db[_0xdde3('0x4a')][_0xdde3('0x4b')](_0x13bee7)[_0xdde3('0x1f')](function(_0x477d83){_0x189c13['count']=_0x477d83;if(_0x58fc19[_0xdde3('0x3a')][_0xdde3('0x4c')]){_0x107757[_0xdde3('0x4d')]=[{'all':!![]}];}return db[_0xdde3('0x4a')][_0xdde3('0x4e')](_0x107757);})[_0xdde3('0x1f')](function(_0x447b52){_0x189c13[_0xdde3('0x4f')]=_0x447b52;return _0x189c13;})[_0xdde3('0x1f')](respondWithFilteredResult(_0x92b65e,_0x107757))[_0xdde3('0x29')](handleError(_0x92b65e,null));};exports['show']=function(_0x47988d,_0x60e140){var _0x2ef551={'raw':![],'where':{'id':_0x47988d[_0xdde3('0x50')]['id']}},_0x178090={};_0x178090['model']=_[_0xdde3('0x51')](db[_0xdde3('0x4a')][_0xdde3('0x52')]);_0x178090[_0xdde3('0x3a')]=_[_0xdde3('0x51')](_0x47988d[_0xdde3('0x3a')]);_0x178090[_0xdde3('0x3b')]=_[_0xdde3('0x3c')](_0x178090[_0xdde3('0x39')],_0x178090[_0xdde3('0x3a')]);_0x2ef551[_0xdde3('0x3d')]=_[_0xdde3('0x3c')](_0x178090[_0xdde3('0x39')],qs[_0xdde3('0x3e')](_0x47988d[_0xdde3('0x3a')][_0xdde3('0x3e')]));_0x2ef551[_0xdde3('0x3d')]=_0x2ef551[_0xdde3('0x3d')][_0xdde3('0x3f')]?_0x2ef551['attributes']:_0x178090['model'];if(_0x47988d['query'][_0xdde3('0x4c')]){_0x2ef551['include']=[{'all':!![]}];}_0x2ef551=_[_0xdde3('0x46')]({},_0x2ef551,_0x47988d['options']);return db[_0xdde3('0x4a')][_0xdde3('0x53')](_0x2ef551)[_0xdde3('0x1f')](handleEntityNotFound(_0x60e140,null))[_0xdde3('0x1f')](respondWithResult(_0x60e140,null))['catch'](handleError(_0x60e140,null));};exports[_0xdde3('0x54')]=function(_0x1e6e90,_0x3a78c5){return db[_0xdde3('0x4a')][_0xdde3('0x54')](_0x1e6e90[_0xdde3('0x55')],{})['then'](respondWithResult(_0x3a78c5,0xc9))['catch'](handleError(_0x3a78c5,null));};exports['update']=function(_0xb7695a,_0x13047f){if(_0xb7695a['body']['id']){delete _0xb7695a[_0xdde3('0x55')]['id'];}return db['SugarcrmAccount'][_0xdde3('0x53')]({'where':{'id':_0xb7695a['params']['id']}})['then'](handleEntityNotFound(_0x13047f,null))[_0xdde3('0x1f')](saveUpdates(_0xb7695a[_0xdde3('0x55')],null))[_0xdde3('0x1f')](respondWithResult(_0x13047f,null))['catch'](handleError(_0x13047f,null));};exports[_0xdde3('0x56')]=function(_0x59fe2e,_0x43ba9f){return db['SugarcrmAccount'][_0xdde3('0x53')]({'where':{'id':_0x59fe2e[_0xdde3('0x50')]['id']}})[_0xdde3('0x1f')](handleEntityNotFound(_0x43ba9f,null))[_0xdde3('0x1f')](removeEntity(_0x43ba9f,null))[_0xdde3('0x29')](handleError(_0x43ba9f,null));};exports['getConfigurations']=function(_0x440624,_0xad0890,_0x7e6645){var _0x5144d8={};var _0x5e93d1={};var _0x2e1aea;var _0x2a9516;return db['SugarcrmAccount'][_0xdde3('0x57')]({'where':{'id':_0x440624[_0xdde3('0x50')]['id']}})[_0xdde3('0x1f')](handleEntityNotFound(_0xad0890,null))[_0xdde3('0x1f')](function(_0x7cc94b){if(_0x7cc94b){_0x2e1aea=_0x7cc94b;_0x5e93d1[_0xdde3('0x39')]=_[_0xdde3('0x51')](db[_0xdde3('0x58')]['rawAttributes']);_0x5e93d1['query']=_[_0xdde3('0x51')](_0x440624['query']);_0x5e93d1[_0xdde3('0x3b')]=_['intersection'](_0x5e93d1[_0xdde3('0x39')],_0x5e93d1['query']);_0x5144d8[_0xdde3('0x3d')]=_['intersection'](_0x5e93d1[_0xdde3('0x39')],qs[_0xdde3('0x3e')](_0x440624[_0xdde3('0x3a')][_0xdde3('0x3e')]));_0x5144d8[_0xdde3('0x3d')]=_0x5144d8[_0xdde3('0x3d')][_0xdde3('0x3f')]?_0x5144d8[_0xdde3('0x3d')]:_0x5e93d1[_0xdde3('0x39')];_0x5144d8[_0xdde3('0x41')]=qs['sort'](_0x440624['query'][_0xdde3('0x42')]);_0x5144d8[_0xdde3('0x43')]=qs[_0xdde3('0x3b')](_[_0xdde3('0x44')](_0x440624['query'],_0x5e93d1[_0xdde3('0x3b')]));if(_0x440624[_0xdde3('0x3a')][_0xdde3('0x45')]){_0x5144d8[_0xdde3('0x43')]=_[_0xdde3('0x46')](_0x5144d8['where'],{'$or':_[_0xdde3('0x47')](_0x5144d8[_0xdde3('0x3d')],function(_0x804c6b){var _0xa24d70={};_0xa24d70[_0x804c6b]={'$like':'%'+_0x440624[_0xdde3('0x3a')]['filter']+'%'};return _0xa24d70;})});}_0x5144d8=_['merge']({},_0x5144d8,_0x440624['options']);return _0x2e1aea['getConfigurations'](_0x5144d8);}})[_0xdde3('0x1f')](function(_0x3aef5e){if(_0x3aef5e){_0x2a9516=_0x3aef5e[_0xdde3('0x3f')];if(!_0x440624[_0xdde3('0x3a')]['hasOwnProperty'](_0xdde3('0x40'))){_0x5144d8[_0xdde3('0x2e')]=qs[_0xdde3('0x2e')](_0x440624[_0xdde3('0x3a')][_0xdde3('0x2e')]);_0x5144d8[_0xdde3('0x2d')]=qs['offset'](_0x440624['query']['offset']);}return _0x2e1aea[_0xdde3('0x59')](_0x5144d8);}})['then'](function(_0x27babd){if(_0x27babd){return _0x27babd?{'count':_0x2a9516,'rows':_0x27babd}:null;}})[_0xdde3('0x1f')](respondWithResult(_0xad0890,null))[_0xdde3('0x29')](handleError(_0xad0890,null));};exports[_0xdde3('0x5a')]=function(_0x517eda,_0x425e02,_0x11b7c0){if(_0x517eda[_0xdde3('0x55')]['id']){delete _0x517eda['body']['id'];}return db[_0xdde3('0x4a')][_0xdde3('0x57')]({'where':{'id':_0x517eda[_0xdde3('0x50')]['id']}})[_0xdde3('0x1f')](handleEntityNotFound(_0x425e02,null))[_0xdde3('0x1f')](function(_0x317841){if(_0x317841){_0x517eda[_0xdde3('0x55')][_0xdde3('0x5b')]=_0x317841['id'];_0x517eda[_0xdde3('0x55')][_0xdde3('0x5c')]=integrations['getSubjects'](_0x517eda[_0xdde3('0x55')][_0xdde3('0x5d')],_0x517eda['body'][_0xdde3('0x37')]);_0x517eda['body'][_0xdde3('0x5e')]=integrations[_0xdde3('0x5f')](_0x517eda[_0xdde3('0x55')][_0xdde3('0x5d')],_0x517eda[_0xdde3('0x55')][_0xdde3('0x37')]);return db[_0xdde3('0x58')][_0xdde3('0x54')](_0x517eda[_0xdde3('0x55')],{'include':[{'model':db[_0xdde3('0x60')],'as':_0xdde3('0x5c')},{'model':db['SugarcrmField'],'as':_0xdde3('0x5e')}]});}return null;})[_0xdde3('0x1f')](respondWithResult(_0x425e02,null))[_0xdde3('0x29')](handleError(_0x425e02,null));};exports[_0xdde3('0x61')]=function(_0x220ee7,_0x2c8d68,_0x50bf1e){var _0x1cdec='';var _0x3c05af=['id',_0xdde3('0x35'),_0xdde3('0x62'),_0xdde3('0x63'),_0xdde3('0x64'),_0xdde3('0x65'),_0xdde3('0x66'),_0xdde3('0x67'),_0xdde3('0x68'),'parent_type','parent_name','direction'];return db[_0xdde3('0x4a')]['findOne']({'where':{'id':_0x220ee7['params']['id']},'attributes':['id',_0xdde3('0x69'),'password','remoteUri']})[_0xdde3('0x1f')](handleEntityNotFound(_0x2c8d68,null))[_0xdde3('0x1f')](function(_0x217063){if(_0x217063){_0x1cdec=_0x217063[_0xdde3('0x6a')];var _0x59a4d9=_0x1cdec['slice'](-0x1);if(_0x59a4d9==='/'){_0x1cdec=_0x1cdec[_0xdde3('0x6b')](0x0,_0x1cdec[_0xdde3('0x6c')](_0x59a4d9));}return rp({'method':_0xdde3('0x6d'),'uri':util[_0xdde3('0x6e')]('%s%s',_0x1cdec,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0xdde3('0x6f'),'response_type':_0xdde3('0x6f'),'rest_data':JSON[_0xdde3('0x24')]({'user_auth':{'user_name':_0x217063[_0xdde3('0x69')],'password':_0x217063[_0xdde3('0x70')],'encryption':_0xdde3('0x71')},'application':_0xdde3('0x72')})}});}})[_0xdde3('0x1f')](function(_0x3b4de2){if(_0x3b4de2&&_0x3b4de2[_0xdde3('0x35')]!==_0xdde3('0x73')&&_0x3b4de2[_0xdde3('0x35')]!==_0xdde3('0x74')){return rp({'method':'POST','uri':util[_0xdde3('0x6e')]('%s%s',_0x1cdec,_0xdde3('0x75')),'json':!![],'form':{'method':_0xdde3('0x76'),'input_type':_0xdde3('0x6f'),'response_type':_0xdde3('0x6f'),'rest_data':JSON['stringify']({'session':_0x3b4de2['id'],'module_name':_0xdde3('0x77')})}})[_0xdde3('0x1f')](function(_0x399242){if(_0x399242){var _0x5790ac=_['values'](_0x399242['module_fields']);_[_0xdde3('0x78')](_0x5790ac,function(_0xd4b0c6){return _0x3c05af[_0xdde3('0x79')](_0xd4b0c6[_0xdde3('0x35')]);});return{'count':_0x5790ac[_0xdde3('0x3f')],'rows':_[_0xdde3('0x47')](_0x5790ac,function(_0x5c8447){return{'id':_0x5c8447[_0xdde3('0x35')],'name':_0x5c8447['label'],'custom':_[_0xdde3('0x7a')](_0x5c8447['name'],'_c')?!![]:![],'options':_0x5c8447[_0xdde3('0x49')]?_['map'](_[_0xdde3('0x7b')](_0x5c8447['options']),function(_0x343b1e){return{'name':_0x343b1e[_0xdde3('0x7c')],'value':_0x343b1e[_0xdde3('0x35')]};}):[]};})};}})[_0xdde3('0x1f')](respondWithResult(_0x2c8d68,null))[_0xdde3('0x29')](function(_0x14a021){var _0x1f330a=_0x220ee7['query']['test']?0x1f4:_0x14a021[_0xdde3('0x7d')]||0x1f4;logger['error'](_0xdde3('0x7e'),'getFields',_0x1f330a,JSON[_0xdde3('0x24')](_0x14a021));delete _0x14a021[_0xdde3('0x35')];if(_0x1f330a===0x191){_0x1f330a=0x190;}_0x2c8d68[_0xdde3('0x2b')](_0x1f330a)[_0xdde3('0x7f')](_0x220ee7[_0xdde3('0x3a')][_0xdde3('0x80')]?{'message':_0xdde3('0x81'),'statusCode':_0x14a021[_0xdde3('0x7d')]}:_0x14a021);});}else{var _0x2ea828=0x1f4;_0x2c8d68['status'](_0x2ea828)['send']({'message':_0xdde3('0x81'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xaad8=['query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','includeAll','findAll','rows','show','params','merge','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','channel','SugarcrmField','getFields','created_by','description','date_start','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','lastIndexOf','POST','format','%s%s','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','values','label','value','statusCode','send','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','json','count','offset','limit','status','set','Content-Range','reject','save','destroy','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','keys'];(function(_0x3702cc,_0x100a4d){var _0x1716a4=function(_0x5be55a){while(--_0x5be55a){_0x3702cc['push'](_0x3702cc['shift']());}};_0x1716a4(++_0x100a4d);}(_0xaad8,0x1c3));var _0x8aad=function(_0x4716e3,_0x28a5df){_0x4716e3=_0x4716e3-0x0;var _0x5ebf87=_0xaad8[_0x4716e3];return _0x5ebf87;};'use strict';var pdf=require(_0x8aad('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8aad('0x1'));var zipdir=require(_0x8aad('0x2'));var jsonpatch=require(_0x8aad('0x3'));var rp=require(_0x8aad('0x4'));var moment=require(_0x8aad('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8aad('0x6'));var util=require('util');var path=require(_0x8aad('0x7'));var sox=require(_0x8aad('0x8'));var csv=require(_0x8aad('0x9'));var ejs=require(_0x8aad('0xa'));var fs=require('fs');var fs_extra=require(_0x8aad('0xb'));var _=require(_0x8aad('0xc'));var squel=require(_0x8aad('0xd'));var crypto=require(_0x8aad('0xe'));var jsforce=require(_0x8aad('0xf'));var deskjs=require(_0x8aad('0x10'));var toCsv=require(_0x8aad('0x9'));var querystring=require(_0x8aad('0x11'));var Papa=require(_0x8aad('0x12'));var Redis=require(_0x8aad('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8aad('0x14'));var as=require(_0x8aad('0x15'));var hardwareService=require(_0x8aad('0x16'));var logger=require(_0x8aad('0x17'))(_0x8aad('0x18'));var utils=require(_0x8aad('0x19'));var config=require(_0x8aad('0x1a'));var licenseUtil=require(_0x8aad('0x1b'));var db=require(_0x8aad('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8aad('0x1d'));var client=jayson[_0x8aad('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x397f50,_0x40b90a,_0x3f2bfb,_0x65fb62){return new BPromise(function(_0x210d07,_0x1bb34d){var _0x3afce6=_0x65fb62||client;return _0x3afce6[_0x8aad('0x1f')](_0x397f50,_0x3f2bfb)[_0x8aad('0x20')](function(_0x24a571){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x40b90a,_0x8aad('0x21'));logger[_0x8aad('0x22')](_0x8aad('0x23'),_0x40b90a,_0x8aad('0x21'),JSON[_0x8aad('0x24')](_0x24a571));if(_0x24a571[_0x8aad('0x25')]){if(_0x24a571[_0x8aad('0x25')][_0x8aad('0x26')]===0x1f4){logger[_0x8aad('0x25')](_0x8aad('0x27'),_0x40b90a,_0x24a571[_0x8aad('0x25')][_0x8aad('0x28')]);return _0x1bb34d(_0x24a571[_0x8aad('0x25')][_0x8aad('0x28')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x40b90a,_0x24a571[_0x8aad('0x25')][_0x8aad('0x28')]);return _0x210d07(_0x24a571[_0x8aad('0x25')][_0x8aad('0x28')]);}else{logger[_0x8aad('0x29')](_0x8aad('0x27'),_0x40b90a,_0x8aad('0x21'));_0x210d07(_0x24a571[_0x8aad('0x2a')][_0x8aad('0x28')]);}})[_0x8aad('0x2b')](function(_0xa99bcb){logger[_0x8aad('0x25')](_0x8aad('0x27'),_0x40b90a,_0xa99bcb);_0x1bb34d(_0xa99bcb);});});}function respondWithStatusCode(_0x1670b0,_0x98817a){_0x98817a=_0x98817a||0xcc;return function(_0x25d227){if(_0x25d227){return _0x1670b0[_0x8aad('0x2c')](_0x98817a);}return _0x1670b0['status'](_0x98817a)['end']();};}function respondWithResult(_0x279a4b,_0x3ac99a){_0x3ac99a=_0x3ac99a||0xc8;return function(_0xbd720f){if(_0xbd720f){return _0x279a4b['status'](_0x3ac99a)[_0x8aad('0x2d')](_0xbd720f);}};}function respondWithFilteredResult(_0x1a22f8,_0x363735){return function(_0x4cac90){if(_0x4cac90){var _0x530824=_0x4cac90[_0x8aad('0x2e')],_0x147c55=_0x363735[_0x8aad('0x2f')],_0x3712f7=_0x363735[_0x8aad('0x2f')]+_0x363735[_0x8aad('0x30')],_0x570d6d;if(_0x3712f7>=_0x530824){_0x3712f7=_0x530824;_0x570d6d=0xc8;}else{_0x570d6d=0xce;}_0x1a22f8[_0x8aad('0x31')](_0x570d6d);return _0x1a22f8[_0x8aad('0x32')](_0x8aad('0x33'),_0x147c55+'-'+_0x3712f7+'/'+_0x530824)[_0x8aad('0x2d')](_0x4cac90);}return null;};}function patchUpdates(_0xb1459b){return function(_0x128f4c){try{jsonpatch['apply'](_0x128f4c,_0xb1459b,!![]);}catch(_0x55b55e){return BPromise[_0x8aad('0x34')](_0x55b55e);}return _0x128f4c[_0x8aad('0x35')]();};}function saveUpdates(_0x27b673,_0x5dc2e2){return function(_0x4fc66c){if(_0x4fc66c){return _0x4fc66c['update'](_0x27b673)[_0x8aad('0x20')](function(_0x592c0e){return _0x592c0e;});}return null;};}function removeEntity(_0x5ecaf5,_0x38ef2d){return function(_0x5519da){if(_0x5519da){return _0x5519da[_0x8aad('0x36')]()[_0x8aad('0x20')](function(){_0x5ecaf5[_0x8aad('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ff7da,_0x748c9f){return function(_0x4bd544){if(!_0x4bd544){_0x3ff7da['sendStatus'](0x194);}return _0x4bd544;};}function handleError(_0x16c395,_0x291d27){_0x291d27=_0x291d27||0x1f4;return function(_0x20d32e){logger['error'](_0x20d32e[_0x8aad('0x37')]);if(_0x20d32e['name']){delete _0x20d32e[_0x8aad('0x38')];}_0x16c395['status'](_0x291d27)['send'](_0x20d32e);};}exports[_0x8aad('0x39')]=function(_0x11e2d5,_0x56113b){var _0x1cfb0e={},_0x927d85={},_0x190e89={'count':0x0,'rows':[]};var _0x232966=_[_0x8aad('0x3a')](db[_0x8aad('0x3b')][_0x8aad('0x3c')],function(_0x2c7f73){return{'name':_0x2c7f73[_0x8aad('0x3d')],'type':_0x2c7f73[_0x8aad('0x3e')][_0x8aad('0x3f')]};});_0x927d85['model']=_[_0x8aad('0x3a')](_0x232966,_0x8aad('0x38'));_0x927d85['query']=_[_0x8aad('0x40')](_0x11e2d5[_0x8aad('0x41')]);_0x927d85[_0x8aad('0x42')]=_[_0x8aad('0x43')](_0x927d85[_0x8aad('0x44')],_0x927d85[_0x8aad('0x41')]);_0x1cfb0e[_0x8aad('0x45')]=_[_0x8aad('0x43')](_0x927d85[_0x8aad('0x44')],qs[_0x8aad('0x46')](_0x11e2d5['query'][_0x8aad('0x46')]));_0x1cfb0e[_0x8aad('0x45')]=_0x1cfb0e[_0x8aad('0x45')][_0x8aad('0x47')]?_0x1cfb0e[_0x8aad('0x45')]:_0x927d85[_0x8aad('0x44')];if(!_0x11e2d5[_0x8aad('0x41')][_0x8aad('0x48')](_0x8aad('0x49'))){_0x1cfb0e[_0x8aad('0x30')]=qs['limit'](_0x11e2d5[_0x8aad('0x41')][_0x8aad('0x30')]);_0x1cfb0e[_0x8aad('0x2f')]=qs[_0x8aad('0x2f')](_0x11e2d5[_0x8aad('0x41')][_0x8aad('0x2f')]);}_0x1cfb0e[_0x8aad('0x4a')]=qs['sort'](_0x11e2d5[_0x8aad('0x41')][_0x8aad('0x4b')]);_0x1cfb0e['where']=qs[_0x8aad('0x42')](_[_0x8aad('0x4c')](_0x11e2d5[_0x8aad('0x41')],_0x927d85['filters']),_0x232966);if(_0x11e2d5['query'][_0x8aad('0x4d')]){_0x1cfb0e[_0x8aad('0x4e')]=_['merge'](_0x1cfb0e[_0x8aad('0x4e')],{'$or':_['map'](_0x232966,function(_0x16dfeb){if(_0x16dfeb[_0x8aad('0x3e')]!=='VIRTUAL'){var _0x2c900e={};_0x2c900e[_0x16dfeb[_0x8aad('0x38')]]={'$like':'%'+_0x11e2d5[_0x8aad('0x41')][_0x8aad('0x4d')]+'%'};return _0x2c900e;}})});}_0x1cfb0e=_['merge']({},_0x1cfb0e,_0x11e2d5[_0x8aad('0x4f')]);var _0x4be2e4={'where':_0x1cfb0e[_0x8aad('0x4e')]};return db[_0x8aad('0x3b')][_0x8aad('0x2e')](_0x4be2e4)[_0x8aad('0x20')](function(_0x514f65){_0x190e89[_0x8aad('0x2e')]=_0x514f65;if(_0x11e2d5[_0x8aad('0x41')][_0x8aad('0x50')]){_0x1cfb0e['include']=[{'all':!![]}];}return db[_0x8aad('0x3b')][_0x8aad('0x51')](_0x1cfb0e);})[_0x8aad('0x20')](function(_0x5800a5){_0x190e89[_0x8aad('0x52')]=_0x5800a5;return _0x190e89;})[_0x8aad('0x20')](respondWithFilteredResult(_0x56113b,_0x1cfb0e))[_0x8aad('0x2b')](handleError(_0x56113b,null));};exports[_0x8aad('0x53')]=function(_0x1118a3,_0x454687){var _0x6e0ab9={'raw':![],'where':{'id':_0x1118a3[_0x8aad('0x54')]['id']}},_0x183489={};_0x183489[_0x8aad('0x44')]=_[_0x8aad('0x40')](db['SugarcrmAccount'][_0x8aad('0x3c')]);_0x183489[_0x8aad('0x41')]=_[_0x8aad('0x40')](_0x1118a3[_0x8aad('0x41')]);_0x183489[_0x8aad('0x42')]=_[_0x8aad('0x43')](_0x183489['model'],_0x183489[_0x8aad('0x41')]);_0x6e0ab9['attributes']=_[_0x8aad('0x43')](_0x183489['model'],qs['fields'](_0x1118a3['query']['fields']));_0x6e0ab9['attributes']=_0x6e0ab9[_0x8aad('0x45')][_0x8aad('0x47')]?_0x6e0ab9['attributes']:_0x183489[_0x8aad('0x44')];if(_0x1118a3[_0x8aad('0x41')][_0x8aad('0x50')]){_0x6e0ab9['include']=[{'all':!![]}];}_0x6e0ab9=_[_0x8aad('0x55')]({},_0x6e0ab9,_0x1118a3[_0x8aad('0x4f')]);return db[_0x8aad('0x3b')][_0x8aad('0x56')](_0x6e0ab9)[_0x8aad('0x20')](handleEntityNotFound(_0x454687,null))[_0x8aad('0x20')](respondWithResult(_0x454687,null))[_0x8aad('0x2b')](handleError(_0x454687,null));};exports[_0x8aad('0x57')]=function(_0x3157a8,_0x29f632){return db[_0x8aad('0x3b')][_0x8aad('0x57')](_0x3157a8[_0x8aad('0x58')],{})['then'](respondWithResult(_0x29f632,0xc9))[_0x8aad('0x2b')](handleError(_0x29f632,null));};exports[_0x8aad('0x59')]=function(_0x2aa2f7,_0x197d35){if(_0x2aa2f7['body']['id']){delete _0x2aa2f7['body']['id'];}return db[_0x8aad('0x3b')][_0x8aad('0x56')]({'where':{'id':_0x2aa2f7[_0x8aad('0x54')]['id']}})['then'](handleEntityNotFound(_0x197d35,null))['then'](saveUpdates(_0x2aa2f7[_0x8aad('0x58')],null))[_0x8aad('0x20')](respondWithResult(_0x197d35,null))[_0x8aad('0x2b')](handleError(_0x197d35,null));};exports[_0x8aad('0x36')]=function(_0x2cd623,_0x34f23d){return db['SugarcrmAccount'][_0x8aad('0x56')]({'where':{'id':_0x2cd623[_0x8aad('0x54')]['id']}})[_0x8aad('0x20')](handleEntityNotFound(_0x34f23d,null))['then'](removeEntity(_0x34f23d,null))['catch'](handleError(_0x34f23d,null));};exports[_0x8aad('0x5a')]=function(_0x2609af,_0x3b3606,_0x5d86a1){var _0x5937a7={};var _0x2eeee9={};var _0xf6078c;var _0xfa065c;return db[_0x8aad('0x3b')][_0x8aad('0x5b')]({'where':{'id':_0x2609af[_0x8aad('0x54')]['id']}})['then'](handleEntityNotFound(_0x3b3606,null))[_0x8aad('0x20')](function(_0x3aaace){if(_0x3aaace){_0xf6078c=_0x3aaace;_0x2eeee9[_0x8aad('0x44')]=_[_0x8aad('0x40')](db[_0x8aad('0x5c')]['rawAttributes']);_0x2eeee9[_0x8aad('0x41')]=_[_0x8aad('0x40')](_0x2609af[_0x8aad('0x41')]);_0x2eeee9[_0x8aad('0x42')]=_[_0x8aad('0x43')](_0x2eeee9[_0x8aad('0x44')],_0x2eeee9[_0x8aad('0x41')]);_0x5937a7['attributes']=_[_0x8aad('0x43')](_0x2eeee9[_0x8aad('0x44')],qs[_0x8aad('0x46')](_0x2609af[_0x8aad('0x41')][_0x8aad('0x46')]));_0x5937a7[_0x8aad('0x45')]=_0x5937a7[_0x8aad('0x45')][_0x8aad('0x47')]?_0x5937a7['attributes']:_0x2eeee9[_0x8aad('0x44')];_0x5937a7[_0x8aad('0x4a')]=qs['sort'](_0x2609af[_0x8aad('0x41')][_0x8aad('0x4b')]);_0x5937a7[_0x8aad('0x4e')]=qs[_0x8aad('0x42')](_[_0x8aad('0x4c')](_0x2609af[_0x8aad('0x41')],_0x2eeee9[_0x8aad('0x42')]));if(_0x2609af[_0x8aad('0x41')][_0x8aad('0x4d')]){_0x5937a7[_0x8aad('0x4e')]=_[_0x8aad('0x55')](_0x5937a7['where'],{'$or':_[_0x8aad('0x3a')](_0x5937a7[_0x8aad('0x45')],function(_0x1ace3b){var _0x365e2a={};_0x365e2a[_0x1ace3b]={'$like':'%'+_0x2609af[_0x8aad('0x41')][_0x8aad('0x4d')]+'%'};return _0x365e2a;})});}_0x5937a7=_[_0x8aad('0x55')]({},_0x5937a7,_0x2609af['options']);return _0xf6078c[_0x8aad('0x5a')](_0x5937a7);}})['then'](function(_0x2202d4){if(_0x2202d4){_0xfa065c=_0x2202d4['length'];if(!_0x2609af['query']['hasOwnProperty'](_0x8aad('0x49'))){_0x5937a7[_0x8aad('0x30')]=qs['limit'](_0x2609af[_0x8aad('0x41')]['limit']);_0x5937a7[_0x8aad('0x2f')]=qs[_0x8aad('0x2f')](_0x2609af[_0x8aad('0x41')][_0x8aad('0x2f')]);}return _0xf6078c[_0x8aad('0x5a')](_0x5937a7);}})['then'](function(_0x2d637c){if(_0x2d637c){return _0x2d637c?{'count':_0xfa065c,'rows':_0x2d637c}:null;}})[_0x8aad('0x20')](respondWithResult(_0x3b3606,null))[_0x8aad('0x2b')](handleError(_0x3b3606,null));};exports[_0x8aad('0x5d')]=function(_0x40bac0,_0xfbfec8,_0x572e1a){if(_0x40bac0[_0x8aad('0x58')]['id']){delete _0x40bac0['body']['id'];}return db[_0x8aad('0x3b')][_0x8aad('0x5b')]({'where':{'id':_0x40bac0[_0x8aad('0x54')]['id']}})['then'](handleEntityNotFound(_0xfbfec8,null))['then'](function(_0x729409){if(_0x729409){_0x40bac0[_0x8aad('0x58')]['AccountId']=_0x729409['id'];_0x40bac0[_0x8aad('0x58')][_0x8aad('0x5e')]=integrations[_0x8aad('0x5f')](_0x40bac0['body']['channel'],_0x40bac0[_0x8aad('0x58')][_0x8aad('0x3e')]);_0x40bac0[_0x8aad('0x58')][_0x8aad('0x60')]=integrations['getDescriptions'](_0x40bac0[_0x8aad('0x58')][_0x8aad('0x61')],_0x40bac0[_0x8aad('0x58')][_0x8aad('0x3e')]);return db[_0x8aad('0x5c')][_0x8aad('0x57')](_0x40bac0[_0x8aad('0x58')],{'include':[{'model':db[_0x8aad('0x62')],'as':_0x8aad('0x5e')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x8aad('0x20')](respondWithResult(_0xfbfec8,null))[_0x8aad('0x2b')](handleError(_0xfbfec8,null));};exports[_0x8aad('0x63')]=function(_0x1588a5,_0x16a11f,_0x1daa28){var _0x4dd0ae='';var _0x593daf=['id',_0x8aad('0x38'),'assigned_user_id',_0x8aad('0x64'),_0x8aad('0x65'),_0x8aad('0x66'),'duration_hours','duration_minutes',_0x8aad('0x67'),_0x8aad('0x68'),_0x8aad('0x69'),_0x8aad('0x6a')];return db[_0x8aad('0x3b')][_0x8aad('0x5b')]({'where':{'id':_0x1588a5['params']['id']},'attributes':['id',_0x8aad('0x6b'),'password',_0x8aad('0x6c')]})[_0x8aad('0x20')](handleEntityNotFound(_0x16a11f,null))[_0x8aad('0x20')](function(_0x129aa7){if(_0x129aa7){_0x4dd0ae=_0x129aa7['remoteUri'];var _0x266f4f=_0x4dd0ae[_0x8aad('0x6d')](-0x1);if(_0x266f4f==='/'){_0x4dd0ae=_0x4dd0ae['substring'](0x0,_0x4dd0ae[_0x8aad('0x6e')](_0x266f4f));}return rp({'method':_0x8aad('0x6f'),'uri':util[_0x8aad('0x70')](_0x8aad('0x71'),_0x4dd0ae,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x8aad('0x72'),'response_type':_0x8aad('0x72'),'rest_data':JSON[_0x8aad('0x24')]({'user_auth':{'user_name':_0x129aa7[_0x8aad('0x6b')],'password':_0x129aa7[_0x8aad('0x73')],'encryption':_0x8aad('0x74')},'application':_0x8aad('0x75')})}});}})[_0x8aad('0x20')](function(_0x118d49){if(_0x118d49&&_0x118d49[_0x8aad('0x38')]!=='Invalid\x20Login'&&_0x118d49['name']!==_0x8aad('0x76')){return rp({'method':_0x8aad('0x6f'),'uri':util[_0x8aad('0x70')](_0x8aad('0x71'),_0x4dd0ae,_0x8aad('0x77')),'json':!![],'form':{'method':_0x8aad('0x78'),'input_type':_0x8aad('0x72'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x118d49['id'],'module_name':_0x8aad('0x79')})}})[_0x8aad('0x20')](function(_0x5f4992){if(_0x5f4992){var _0x3f731c=_[_0x8aad('0x7a')](_0x5f4992['module_fields']);_['remove'](_0x3f731c,function(_0x26b9a0){return _0x593daf['includes'](_0x26b9a0[_0x8aad('0x38')]);});return{'count':_0x3f731c[_0x8aad('0x47')],'rows':_[_0x8aad('0x3a')](_0x3f731c,function(_0x206a45){return{'id':_0x206a45['name'],'name':_0x206a45[_0x8aad('0x7b')],'custom':_['endsWith'](_0x206a45[_0x8aad('0x38')],'_c')?!![]:![],'options':_0x206a45[_0x8aad('0x4f')]?_[_0x8aad('0x3a')](_['values'](_0x206a45['options']),function(_0x5ed07d){return{'name':_0x5ed07d[_0x8aad('0x7c')],'value':_0x5ed07d[_0x8aad('0x38')]};}):[]};})};}})[_0x8aad('0x20')](respondWithResult(_0x16a11f,null))['catch'](function(_0x4163ce){var _0x595f2f=_0x1588a5[_0x8aad('0x41')]['test']?0x1f4:_0x4163ce[_0x8aad('0x7d')]||0x1f4;logger[_0x8aad('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x8aad('0x63'),_0x595f2f,JSON[_0x8aad('0x24')](_0x4163ce));delete _0x4163ce[_0x8aad('0x38')];if(_0x595f2f===0x191){_0x595f2f=0x190;}_0x16a11f[_0x8aad('0x31')](_0x595f2f)[_0x8aad('0x7e')](_0x1588a5[_0x8aad('0x41')][_0x8aad('0x7f')]?{'message':_0x8aad('0x80'),'statusCode':_0x4163ce[_0x8aad('0x7d')]}:_0x4163ce);});}else{var _0x12e33b=0x1f4;_0x16a11f[_0x8aad('0x31')](_0x12e33b)[_0x8aad('0x7e')]({'message':'Wrong\x20credentials','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 43529f7..9a34b5a 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 _0x862b=['../../config/logger','api','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','define','lodash','util'];(function(_0x13af04,_0x34696c){var _0xd04e49=function(_0x3e5475){while(--_0x3e5475){_0x13af04['push'](_0x13af04['shift']());}};_0xd04e49(++_0x34696c);}(_0x862b,0x18a));var _0xb862=function(_0x5759e3,_0x4f1d55){_0x5759e3=_0x5759e3-0x0;var _0x602d3c=_0x862b[_0x5759e3];return _0x602d3c;};'use strict';var _=require(_0xb862('0x0'));var util=require(_0xb862('0x1'));var logger=require(_0xb862('0x2'))(_0xb862('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb862('0x4'));var rimraf=require(_0xb862('0x5'));var config=require(_0xb862('0x6'));var attributes=require(_0xb862('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x46c25c,_0x2874b2){return _0x46c25c[_0xb862('0x8')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x677b=['util','../../config/logger','moment','request-promise','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash'];(function(_0x42bd43,_0x59fb77){var _0x421e88=function(_0x485e11){while(--_0x485e11){_0x42bd43['push'](_0x42bd43['shift']());}};_0x421e88(++_0x59fb77);}(_0x677b,0x1d3));var _0xb677=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x677b[_0x3cae69];return _0x3128eb;};'use strict';var _=require(_0xb677('0x0'));var util=require(_0xb677('0x1'));var logger=require(_0xb677('0x2'))('api');var moment=require(_0xb677('0x3'));var BPromise=require('bluebird');var rp=require(_0xb677('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb677('0x5'));var attributes=require(_0xb677('0x6'));var integrations=require(_0xb677('0x7'));module[_0xb677('0x8')]=function(_0x4d251c,_0x4c3c7d){return _0x4d251c[_0xb677('0x9')](_0xb677('0xa'),attributes,{'tableName':_0xb677('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index e209e41..6666b8b 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 _0x960c=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','limit','include','map','model','attributes','ShowSugarcrmAccount','raw','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x960c,0x1ba));var _0xc960=function(_0x146a31,_0x20ad03){_0x146a31=_0x146a31-0x0;var _0x525abf=_0x960c[_0x146a31];return _0x525abf;};'use strict';var _=require(_0xc960('0x0'));var util=require(_0xc960('0x1'));var moment=require(_0xc960('0x2'));var BPromise=require(_0xc960('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc960('0x4'));var db=require(_0xc960('0x5'))['db'];var utils=require(_0xc960('0x6'));var logger=require(_0xc960('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc960('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e03eb,_0x6a7653,_0x54ca88){return new BPromise(function(_0x324710,_0x18a736){return client[_0xc960('0x9')](_0x5e03eb,_0x54ca88)[_0xc960('0xa')](function(_0x4b1959){logger[_0xc960('0xb')](_0xc960('0xc'),_0x6a7653,_0xc960('0xd'));logger['debug'](_0xc960('0xe'),_0x6a7653,'request\x20sent',JSON[_0xc960('0xf')](_0x4b1959));if(_0x4b1959['error']){if(_0x4b1959['error'][_0xc960('0x10')]===0x1f4){logger['error'](_0xc960('0xc'),_0x6a7653,_0x4b1959['error'][_0xc960('0x11')]);return _0x18a736(_0x4b1959[_0xc960('0x12')]['message']);}logger[_0xc960('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x6a7653,_0x4b1959[_0xc960('0x12')]['message']);return _0x324710(_0x4b1959[_0xc960('0x12')][_0xc960('0x11')]);}else{logger[_0xc960('0xb')](_0xc960('0xc'),_0x6a7653,'request\x20sent');_0x324710(_0x4b1959[_0xc960('0x13')][_0xc960('0x11')]);}})[_0xc960('0x14')](function(_0x19edc2){logger[_0xc960('0x12')](_0xc960('0xc'),_0x6a7653,_0x19edc2);_0x18a736(_0x19edc2);});});}exports[_0xc960('0x15')]=function(_0x633d0f){var _0x3a66d0=this;return new Promise(function(_0x477d8f,_0x1fcbcc){return db[_0xc960('0x16')][_0xc960('0x17')]({'raw':_0x633d0f['options']?_0x633d0f[_0xc960('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x633d0f[_0xc960('0x18')]?_0x633d0f[_0xc960('0x18')][_0xc960('0x19')]||null:null,'attributes':_0x633d0f['options']?_0x633d0f[_0xc960('0x18')]['attributes']||null:null,'limit':_0x633d0f[_0xc960('0x18')]?_0x633d0f[_0xc960('0x18')][_0xc960('0x1a')]||null:null,'include':_0x633d0f[_0xc960('0x18')]?_0x633d0f[_0xc960('0x18')][_0xc960('0x1b')]?_[_0xc960('0x1c')](_0x633d0f[_0xc960('0x18')][_0xc960('0x1b')],function(_0x3dbf6f){return{'model':db[_0x3dbf6f[_0xc960('0x1d')]],'as':_0x3dbf6f['as'],'attributes':_0x3dbf6f[_0xc960('0x1e')],'include':_0x3dbf6f[_0xc960('0x1b')]?_[_0xc960('0x1c')](_0x3dbf6f[_0xc960('0x1b')],function(_0x1c324b){return{'model':db[_0x1c324b[_0xc960('0x1d')]],'as':_0x1c324b['as'],'attributes':_0x1c324b[_0xc960('0x1e')],'include':_0x1c324b[_0xc960('0x1b')]?_['map'](_0x1c324b[_0xc960('0x1b')],function(_0x3d587b){return{'model':db[_0x3d587b[_0xc960('0x1d')]],'as':_0x3d587b['as'],'attributes':_0x3d587b[_0xc960('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc960('0xa')](function(_0x26de56){logger[_0xc960('0xb')]('GetSugarcrmAccount',_0x633d0f);logger['debug'](_0xc960('0x15'),_0x633d0f,JSON['stringify'](_0x26de56));_0x477d8f(_0x26de56);})[_0xc960('0x14')](function(_0x1698e6){logger[_0xc960('0x12')](_0xc960('0x15'),_0x1698e6[_0xc960('0x11')],_0x633d0f);_0x1fcbcc(_0x3a66d0['error'](0x1f4,_0x1698e6['message']));});});};exports[_0xc960('0x1f')]=function(_0x2efcee){var _0x1aa255=this;return new Promise(function(_0x4a53ee,_0x1cb9e4){return db['SugarcrmAccount']['find']({'raw':_0x2efcee['options']?_0x2efcee[_0xc960('0x18')][_0xc960('0x20')]===undefined?!![]:![]:!![],'where':_0x2efcee[_0xc960('0x18')]?_0x2efcee['options'][_0xc960('0x19')]||null:null,'attributes':_0x2efcee[_0xc960('0x18')]?_0x2efcee[_0xc960('0x18')][_0xc960('0x1e')]||null:null,'include':_0x2efcee['options']?_0x2efcee['options'][_0xc960('0x1b')]?_[_0xc960('0x1c')](_0x2efcee[_0xc960('0x18')][_0xc960('0x1b')],function(_0x5d9065){return{'model':db[_0x5d9065[_0xc960('0x1d')]],'as':_0x5d9065['as'],'attributes':_0x5d9065[_0xc960('0x1e')],'include':_0x5d9065['include']?_[_0xc960('0x1c')](_0x5d9065[_0xc960('0x1b')],function(_0x5cc575){return{'model':db[_0x5cc575[_0xc960('0x1d')]],'as':_0x5cc575['as'],'attributes':_0x5cc575[_0xc960('0x1e')],'include':_0x5cc575[_0xc960('0x1b')]?_[_0xc960('0x1c')](_0x5cc575[_0xc960('0x1b')],function(_0x443ea6){return{'model':db[_0x443ea6[_0xc960('0x1d')]],'as':_0x443ea6['as'],'attributes':_0x443ea6['attributes']};}):[]};}):[]};}):[]:[]})[_0xc960('0xa')](function(_0x560ccd){logger[_0xc960('0xb')](_0xc960('0x1f'),_0x2efcee);logger[_0xc960('0x21')](_0xc960('0x1f'),_0x2efcee,JSON['stringify'](_0x560ccd));_0x4a53ee(_0x560ccd);})[_0xc960('0x14')](function(_0x163c31){logger[_0xc960('0x12')]('ShowSugarcrmAccount',_0x163c31[_0xc960('0x11')],_0x2efcee);_0x1cb9e4(_0x1aa255['error'](0x1f4,_0x163c31[_0xc960('0x11')]));});});}; \ No newline at end of file +var _0x943e=['../../config/logger','../../config/environment','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowSugarcrmAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0x943e,0x14e));var _0xe943=function(_0x141c1a,_0xab14ca){_0x141c1a=_0x141c1a-0x0;var _0x1174b2=_0x943e[_0x141c1a];return _0x1174b2;};'use strict';var _=require(_0xe943('0x0'));var util=require('util');var moment=require(_0xe943('0x1'));var BPromise=require('bluebird');var rs=require(_0xe943('0x2'));var fs=require('fs');var Redis=require(_0xe943('0x3'));var db=require(_0xe943('0x4'))['db'];var utils=require(_0xe943('0x5'));var logger=require(_0xe943('0x6'))('rpc');var config=require(_0xe943('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54053b,_0x44368e,_0x3d3b68){return new BPromise(function(_0x5bf7b8,_0x1f0c21){return client[_0xe943('0x8')](_0x54053b,_0x3d3b68)[_0xe943('0x9')](function(_0x27d4e3){logger[_0xe943('0xa')](_0xe943('0xb'),_0x44368e,_0xe943('0xc'));logger[_0xe943('0xd')](_0xe943('0xe'),_0x44368e,_0xe943('0xc'),JSON['stringify'](_0x27d4e3));if(_0x27d4e3[_0xe943('0xf')]){if(_0x27d4e3['error'][_0xe943('0x10')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x44368e,_0x27d4e3[_0xe943('0xf')][_0xe943('0x11')]);return _0x1f0c21(_0x27d4e3[_0xe943('0xf')][_0xe943('0x11')]);}logger[_0xe943('0xf')](_0xe943('0xb'),_0x44368e,_0x27d4e3[_0xe943('0xf')][_0xe943('0x11')]);return _0x5bf7b8(_0x27d4e3['error']['message']);}else{logger['info'](_0xe943('0xb'),_0x44368e,_0xe943('0xc'));_0x5bf7b8(_0x27d4e3[_0xe943('0x12')][_0xe943('0x11')]);}})['catch'](function(_0x31e923){logger[_0xe943('0xf')](_0xe943('0xb'),_0x44368e,_0x31e923);_0x1f0c21(_0x31e923);});});}exports[_0xe943('0x13')]=function(_0x2d4363){var _0x2807e8=this;return new Promise(function(_0x5ac0f7,_0x34c72c){return db[_0xe943('0x14')][_0xe943('0x15')]({'raw':_0x2d4363['options']?_0x2d4363[_0xe943('0x16')][_0xe943('0x17')]===undefined?!![]:![]:!![],'where':_0x2d4363[_0xe943('0x16')]?_0x2d4363[_0xe943('0x16')][_0xe943('0x18')]||null:null,'attributes':_0x2d4363[_0xe943('0x16')]?_0x2d4363[_0xe943('0x16')][_0xe943('0x19')]||null:null,'limit':_0x2d4363[_0xe943('0x16')]?_0x2d4363[_0xe943('0x16')][_0xe943('0x1a')]||null:null,'include':_0x2d4363['options']?_0x2d4363[_0xe943('0x16')][_0xe943('0x1b')]?_['map'](_0x2d4363['options'][_0xe943('0x1b')],function(_0x5b8e3e){return{'model':db[_0x5b8e3e['model']],'as':_0x5b8e3e['as'],'attributes':_0x5b8e3e[_0xe943('0x19')],'include':_0x5b8e3e[_0xe943('0x1b')]?_[_0xe943('0x1c')](_0x5b8e3e['include'],function(_0x1d4f54){return{'model':db[_0x1d4f54[_0xe943('0x1d')]],'as':_0x1d4f54['as'],'attributes':_0x1d4f54[_0xe943('0x19')],'include':_0x1d4f54[_0xe943('0x1b')]?_[_0xe943('0x1c')](_0x1d4f54[_0xe943('0x1b')],function(_0x46a3f5){return{'model':db[_0x46a3f5[_0xe943('0x1d')]],'as':_0x46a3f5['as'],'attributes':_0x46a3f5[_0xe943('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x219fdc){logger[_0xe943('0xa')](_0xe943('0x13'),_0x2d4363);logger[_0xe943('0xd')](_0xe943('0x13'),_0x2d4363,JSON[_0xe943('0x1e')](_0x219fdc));_0x5ac0f7(_0x219fdc);})[_0xe943('0x1f')](function(_0x37543e){logger[_0xe943('0xf')](_0xe943('0x13'),_0x37543e[_0xe943('0x11')],_0x2d4363);_0x34c72c(_0x2807e8[_0xe943('0xf')](0x1f4,_0x37543e['message']));});});};exports[_0xe943('0x20')]=function(_0x45d910){var _0x29f46e=this;return new Promise(function(_0xc1cf06,_0x273a57){return db['SugarcrmAccount'][_0xe943('0x21')]({'raw':_0x45d910[_0xe943('0x16')]?_0x45d910[_0xe943('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x45d910[_0xe943('0x16')]?_0x45d910[_0xe943('0x16')]['where']||null:null,'attributes':_0x45d910[_0xe943('0x16')]?_0x45d910[_0xe943('0x16')][_0xe943('0x19')]||null:null,'include':_0x45d910[_0xe943('0x16')]?_0x45d910['options'][_0xe943('0x1b')]?_[_0xe943('0x1c')](_0x45d910[_0xe943('0x16')][_0xe943('0x1b')],function(_0x278dbe){return{'model':db[_0x278dbe['model']],'as':_0x278dbe['as'],'attributes':_0x278dbe[_0xe943('0x19')],'include':_0x278dbe[_0xe943('0x1b')]?_[_0xe943('0x1c')](_0x278dbe[_0xe943('0x1b')],function(_0x5a225d){return{'model':db[_0x5a225d[_0xe943('0x1d')]],'as':_0x5a225d['as'],'attributes':_0x5a225d[_0xe943('0x19')],'include':_0x5a225d['include']?_[_0xe943('0x1c')](_0x5a225d[_0xe943('0x1b')],function(_0x453aa5){return{'model':db[_0x453aa5[_0xe943('0x1d')]],'as':_0x453aa5['as'],'attributes':_0x453aa5[_0xe943('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe943('0x9')](function(_0x265420){logger['info']('ShowSugarcrmAccount',_0x45d910);logger['debug']('ShowSugarcrmAccount',_0x45d910,JSON['stringify'](_0x265420));_0xc1cf06(_0x265420);})[_0xe943('0x1f')](function(_0x40dc5d){logger[_0xe943('0xf')](_0xe943('0x20'),_0x40dc5d[_0xe943('0x11')],_0x45d910);_0x273a57(_0x29f46e['error'](0x1f4,_0x40dc5d[_0xe943('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 96ab0ce..33398a7 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 _0xd892=['../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x506d2f,_0x5ab76e){var _0x101255=function(_0x1596b1){while(--_0x1596b1){_0x506d2f['push'](_0x506d2f['shift']());}};_0x101255(++_0x5ab76e);}(_0xd892,0x124));var _0x2d89=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xd892[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x2d89('0x0'));var util=require(_0x2d89('0x1'));var path=require(_0x2d89('0x2'));var timeout=require(_0x2d89('0x3'));var express=require(_0x2d89('0x4'));var router=express[_0x2d89('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2d89('0x6'));var interaction=require(_0x2d89('0x7'));var config=require('../../config/environment');var controller=require(_0x2d89('0x8'));router[_0x2d89('0x9')]('/',auth[_0x2d89('0xa')](),controller[_0x2d89('0xb')]);router['get'](_0x2d89('0xc'),auth[_0x2d89('0xa')](),controller['show']);router[_0x2d89('0x9')](_0x2d89('0xd'),auth[_0x2d89('0xa')](),controller['getFields']);router[_0x2d89('0x9')]('/:id/subjects',auth[_0x2d89('0xa')](),controller[_0x2d89('0xe')]);router[_0x2d89('0x9')]('/:id/descriptions',auth[_0x2d89('0xa')](),controller[_0x2d89('0xf')]);router[_0x2d89('0x10')]('/',auth['isAuthenticated'](),controller[_0x2d89('0x11')]);router[_0x2d89('0x12')](_0x2d89('0xc'),auth[_0x2d89('0xa')](),controller[_0x2d89('0x13')]);router[_0x2d89('0x14')](_0x2d89('0xc'),auth[_0x2d89('0xa')](),controller[_0x2d89('0x15')]);module[_0x2d89('0x16')]=router; \ No newline at end of file +var _0xac1d=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x1c39c6,_0x370372){var _0x46fb1e=function(_0xadd134){while(--_0xadd134){_0x1c39c6['push'](_0x1c39c6['shift']());}};_0x46fb1e(++_0x370372);}(_0xac1d,0x124));var _0xdac1=function(_0x9b9573,_0x5e8b40){_0x9b9573=_0x9b9573-0x0;var _0x1881b5=_0xac1d[_0x9b9573];return _0x1881b5;};'use strict';var multer=require(_0xdac1('0x0'));var util=require('util');var path=require(_0xdac1('0x1'));var timeout=require(_0xdac1('0x2'));var express=require(_0xdac1('0x3'));var router=express[_0xdac1('0x4')]();var fs_extra=require(_0xdac1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdac1('0x6'));var config=require(_0xdac1('0x7'));var controller=require(_0xdac1('0x8'));router[_0xdac1('0x9')]('/',auth[_0xdac1('0xa')](),controller['index']);router[_0xdac1('0x9')](_0xdac1('0xb'),auth[_0xdac1('0xa')](),controller[_0xdac1('0xc')]);router[_0xdac1('0x9')](_0xdac1('0xd'),auth[_0xdac1('0xa')](),controller[_0xdac1('0xe')]);router[_0xdac1('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xdac1('0xf')]);router[_0xdac1('0x9')](_0xdac1('0x10'),auth[_0xdac1('0xa')](),controller[_0xdac1('0x11')]);router[_0xdac1('0x12')]('/',auth[_0xdac1('0xa')](),controller[_0xdac1('0x13')]);router[_0xdac1('0x14')](_0xdac1('0xb'),auth[_0xdac1('0xa')](),controller[_0xdac1('0x15')]);router[_0xdac1('0x16')]('/:id',auth[_0xdac1('0xa')](),controller[_0xdac1('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 898ee1c..bb7f579 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 _0xd35c=['exports','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd35c,0xfa));var _0xcd35=function(_0x3abe3d,_0xed0e58){_0x3abe3d=_0x3abe3d-0x0;var _0x5a62d0=_0xd35c[_0x3abe3d];return _0x5a62d0;};'use strict';var Sequelize=require('sequelize');module[_0xcd35('0x0')]={'name':{'type':Sequelize[_0xcd35('0x1')]},'description':{'type':Sequelize[_0xcd35('0x1')]}}; \ No newline at end of file +var _0xa260=['exports','STRING','sequelize'];(function(_0x598444,_0x659519){var _0x36b15b=function(_0xe68e80){while(--_0xe68e80){_0x598444['push'](_0x598444['shift']());}};_0x36b15b(++_0x659519);}(_0xa260,0x134));var _0x0a26=function(_0xff4a2,_0x522225){_0xff4a2=_0xff4a2-0x0;var _0x13ca4a=_0xa260[_0xff4a2];return _0x13ca4a;};'use strict';var Sequelize=require(_0x0a26('0x0'));module[_0x0a26('0x1')]={'name':{'type':Sequelize[_0x0a26('0x2')]},'description':{'type':Sequelize[_0x0a26('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 7fc49e1..b733c63 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 _0x887b=['params','length','includeAll','include','find','create','body','SugarcrmField','getFields','hasOwnProperty','getSubjects','findOne','getDescriptions','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SugarcrmConfiguration','findAll'];(function(_0xc5d3c8,_0x43352b){var _0x3537e4=function(_0x4bfe24){while(--_0x4bfe24){_0xc5d3c8['push'](_0xc5d3c8['shift']());}};_0x3537e4(++_0x43352b);}(_0x887b,0x1cf));var _0xb887=function(_0x16175f,_0x26c7d0){_0x16175f=_0x16175f-0x0;var _0x1deaeb=_0x887b[_0x16175f];return _0x1deaeb;};'use strict';var pdf=require(_0xb887('0x0'));var emlformat=require(_0xb887('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb887('0x2'));var moment=require(_0xb887('0x3'));var BPromise=require(_0xb887('0x4'));var Mustache=require(_0xb887('0x5'));var util=require(_0xb887('0x6'));var path=require(_0xb887('0x7'));var sox=require('sox');var csv=require(_0xb887('0x8'));var ejs=require(_0xb887('0x9'));var fs=require('fs');var fs_extra=require(_0xb887('0xa'));var _=require(_0xb887('0xb'));var squel=require(_0xb887('0xc'));var crypto=require(_0xb887('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb887('0xe'));var toCsv=require(_0xb887('0x8'));var querystring=require(_0xb887('0xf'));var Papa=require(_0xb887('0x10'));var Redis=require(_0xb887('0x11'));var authService=require(_0xb887('0x12'));var qs=require(_0xb887('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb887('0x14'));var logger=require(_0xb887('0x15'))(_0xb887('0x16'));var utils=require('../../config/utils');var config=require(_0xb887('0x17'));var licenseUtil=require(_0xb887('0x18'));var db=require(_0xb887('0x19'))['db'];var jayson=require(_0xb887('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x238f60,_0x220bf2,_0x1ba3db,_0x2c3567){return new BPromise(function(_0x54750c,_0x276d12){var _0x24020f=_0x2c3567||client;return _0x24020f[_0xb887('0x1b')](_0x238f60,_0x1ba3db)[_0xb887('0x1c')](function(_0x4adc20){logger[_0xb887('0x1d')](_0xb887('0x1e'),_0x220bf2,_0xb887('0x1f'));logger[_0xb887('0x20')](_0xb887('0x21'),_0x220bf2,_0xb887('0x1f'),JSON[_0xb887('0x22')](_0x4adc20));if(_0x4adc20[_0xb887('0x23')]){if(_0x4adc20['error'][_0xb887('0x24')]===0x1f4){logger[_0xb887('0x23')](_0xb887('0x1e'),_0x220bf2,_0x4adc20[_0xb887('0x23')][_0xb887('0x25')]);return _0x276d12(_0x4adc20['error'][_0xb887('0x25')]);}logger[_0xb887('0x23')](_0xb887('0x1e'),_0x220bf2,_0x4adc20[_0xb887('0x23')][_0xb887('0x25')]);return _0x54750c(_0x4adc20[_0xb887('0x23')][_0xb887('0x25')]);}else{logger[_0xb887('0x1d')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x220bf2,'request\x20sent');_0x54750c(_0x4adc20[_0xb887('0x26')][_0xb887('0x25')]);}})[_0xb887('0x27')](function(_0xd98e6d){logger[_0xb887('0x23')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x220bf2,_0xd98e6d);_0x276d12(_0xd98e6d);});});}function respondWithStatusCode(_0x2d0242,_0x190361){_0x190361=_0x190361||0xcc;return function(_0x244d78){if(_0x244d78){return _0x2d0242[_0xb887('0x28')](_0x190361);}return _0x2d0242[_0xb887('0x29')](_0x190361)[_0xb887('0x2a')]();};}function respondWithResult(_0x545396,_0x40fe72){_0x40fe72=_0x40fe72||0xc8;return function(_0x4cd09e){if(_0x4cd09e){return _0x545396[_0xb887('0x29')](_0x40fe72)[_0xb887('0x2b')](_0x4cd09e);}};}function respondWithFilteredResult(_0x5840a0,_0x23ef73){return function(_0x26676e){if(_0x26676e){var _0x29ca5b=_0x26676e[_0xb887('0x2c')],_0x1d1183=_0x23ef73[_0xb887('0x2d')],_0x2651af=_0x23ef73[_0xb887('0x2d')]+_0x23ef73[_0xb887('0x2e')],_0x319e37;if(_0x2651af>=_0x29ca5b){_0x2651af=_0x29ca5b;_0x319e37=0xc8;}else{_0x319e37=0xce;}_0x5840a0['status'](_0x319e37);return _0x5840a0[_0xb887('0x2f')](_0xb887('0x30'),_0x1d1183+'-'+_0x2651af+'/'+_0x29ca5b)['json'](_0x26676e);}return null;};}function patchUpdates(_0x48d599){return function(_0x459b31){try{jsonpatch['apply'](_0x459b31,_0x48d599,!![]);}catch(_0x3f3ed6){return BPromise['reject'](_0x3f3ed6);}return _0x459b31[_0xb887('0x31')]();};}function saveUpdates(_0x401415,_0x186bb0){return function(_0x5f0c7e){if(_0x5f0c7e){return _0x5f0c7e[_0xb887('0x32')](_0x401415)[_0xb887('0x1c')](function(_0x23663f){return _0x23663f;});}return null;};}function removeEntity(_0x2905e6,_0x222c47){return function(_0x8171d){if(_0x8171d){return _0x8171d[_0xb887('0x33')]()[_0xb887('0x1c')](function(){_0x2905e6[_0xb887('0x29')](0xcc)[_0xb887('0x2a')]();});}};}function handleEntityNotFound(_0x3e961a,_0x4f2b70){return function(_0x3893a9){if(!_0x3893a9){_0x3e961a[_0xb887('0x28')](0x194);}return _0x3893a9;};}function handleError(_0x2d671a,_0x1b12a5){_0x1b12a5=_0x1b12a5||0x1f4;return function(_0x570fe1){logger[_0xb887('0x23')](_0x570fe1['stack']);if(_0x570fe1[_0xb887('0x34')]){delete _0x570fe1['name'];}_0x2d671a['status'](_0x1b12a5)[_0xb887('0x35')](_0x570fe1);};}exports[_0xb887('0x36')]=function(_0x1c18af,_0x4991f2){var _0x4f161e={},_0xf79b9f={},_0x583d00={'count':0x0,'rows':[]};var _0xf66fca=_[_0xb887('0x37')](db['SugarcrmConfiguration'][_0xb887('0x38')],function(_0x37ebd8){return{'name':_0x37ebd8[_0xb887('0x39')],'type':_0x37ebd8[_0xb887('0x3a')]['key']};});_0xf79b9f[_0xb887('0x3b')]=_[_0xb887('0x37')](_0xf66fca,_0xb887('0x34'));_0xf79b9f[_0xb887('0x3c')]=_[_0xb887('0x3d')](_0x1c18af['query']);_0xf79b9f[_0xb887('0x3e')]=_[_0xb887('0x3f')](_0xf79b9f['model'],_0xf79b9f[_0xb887('0x3c')]);_0x4f161e[_0xb887('0x40')]=_['intersection'](_0xf79b9f[_0xb887('0x3b')],qs['fields'](_0x1c18af[_0xb887('0x3c')][_0xb887('0x41')]));_0x4f161e[_0xb887('0x40')]=_0x4f161e[_0xb887('0x40')]['length']?_0x4f161e[_0xb887('0x40')]:_0xf79b9f[_0xb887('0x3b')];if(!_0x1c18af['query']['hasOwnProperty'](_0xb887('0x42'))){_0x4f161e[_0xb887('0x2e')]=qs[_0xb887('0x2e')](_0x1c18af[_0xb887('0x3c')][_0xb887('0x2e')]);_0x4f161e[_0xb887('0x2d')]=qs['offset'](_0x1c18af['query']['offset']);}_0x4f161e[_0xb887('0x43')]=qs[_0xb887('0x44')](_0x1c18af['query'][_0xb887('0x44')]);_0x4f161e[_0xb887('0x45')]=qs['filters'](_[_0xb887('0x46')](_0x1c18af[_0xb887('0x3c')],_0xf79b9f['filters']),_0xf66fca);if(_0x1c18af['query']['filter']){_0x4f161e[_0xb887('0x45')]=_[_0xb887('0x47')](_0x4f161e[_0xb887('0x45')],{'$or':_[_0xb887('0x37')](_0xf66fca,function(_0x3a4469){if(_0x3a4469['type']!==_0xb887('0x48')){var _0x3234a5={};_0x3234a5[_0x3a4469['name']]={'$like':'%'+_0x1c18af['query'][_0xb887('0x49')]+'%'};return _0x3234a5;}})});}_0x4f161e=_[_0xb887('0x47')]({},_0x4f161e,_0x1c18af[_0xb887('0x4a')]);var _0x198b0d={'where':_0x4f161e[_0xb887('0x45')]};return db['SugarcrmConfiguration']['count'](_0x198b0d)['then'](function(_0x164589){_0x583d00[_0xb887('0x2c')]=_0x164589;if(_0x1c18af[_0xb887('0x3c')]['includeAll']){_0x4f161e['include']=[{'all':!![]}];}return db[_0xb887('0x4b')][_0xb887('0x4c')](_0x4f161e);})[_0xb887('0x1c')](function(_0x5c1103){_0x583d00['rows']=_0x5c1103;return _0x583d00;})['then'](respondWithFilteredResult(_0x4991f2,_0x4f161e))['catch'](handleError(_0x4991f2,null));};exports['show']=function(_0x55c4cd,_0x484b30){var _0x34b4c7={'raw':![],'where':{'id':_0x55c4cd[_0xb887('0x4d')]['id']}},_0x2ea72e={};_0x2ea72e[_0xb887('0x3b')]=_['keys'](db[_0xb887('0x4b')][_0xb887('0x38')]);_0x2ea72e[_0xb887('0x3c')]=_[_0xb887('0x3d')](_0x55c4cd[_0xb887('0x3c')]);_0x2ea72e[_0xb887('0x3e')]=_[_0xb887('0x3f')](_0x2ea72e['model'],_0x2ea72e['query']);_0x34b4c7[_0xb887('0x40')]=_['intersection'](_0x2ea72e[_0xb887('0x3b')],qs['fields'](_0x55c4cd[_0xb887('0x3c')][_0xb887('0x41')]));_0x34b4c7['attributes']=_0x34b4c7[_0xb887('0x40')][_0xb887('0x4e')]?_0x34b4c7['attributes']:_0x2ea72e['model'];if(_0x55c4cd[_0xb887('0x3c')][_0xb887('0x4f')]){_0x34b4c7[_0xb887('0x50')]=[{'all':!![]}];}_0x34b4c7=_[_0xb887('0x47')]({},_0x34b4c7,_0x55c4cd['options']);return db[_0xb887('0x4b')][_0xb887('0x51')](_0x34b4c7)[_0xb887('0x1c')](handleEntityNotFound(_0x484b30,null))['then'](respondWithResult(_0x484b30,null))[_0xb887('0x27')](handleError(_0x484b30,null));};exports[_0xb887('0x52')]=function(_0x1e300b,_0x59e9c1){return db['SugarcrmConfiguration'][_0xb887('0x52')](_0x1e300b[_0xb887('0x53')],{})[_0xb887('0x1c')](respondWithResult(_0x59e9c1,0xc9))[_0xb887('0x27')](handleError(_0x59e9c1,null));};exports[_0xb887('0x32')]=function(_0x399f28,_0x33ef28){if(_0x399f28[_0xb887('0x53')]['id']){delete _0x399f28[_0xb887('0x53')]['id'];}return db['SugarcrmConfiguration'][_0xb887('0x51')]({'where':{'id':_0x399f28[_0xb887('0x4d')]['id']}})[_0xb887('0x1c')](handleEntityNotFound(_0x33ef28,null))[_0xb887('0x1c')](saveUpdates(_0x399f28[_0xb887('0x53')],null))['then'](respondWithResult(_0x33ef28,null))[_0xb887('0x27')](handleError(_0x33ef28,null));};exports[_0xb887('0x33')]=function(_0x45172b,_0x4b86ac){return db[_0xb887('0x4b')]['find']({'where':{'id':_0x45172b[_0xb887('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4b86ac,null))['then'](removeEntity(_0x4b86ac,null))['catch'](handleError(_0x4b86ac,null));};exports['getFields']=function(_0x395fa4,_0x244c59,_0x1864a8){var _0x22843f={};var _0x50575c={};var _0x538203;var _0x5b2d18;return db[_0xb887('0x4b')]['findOne']({'where':{'id':_0x395fa4[_0xb887('0x4d')]['id']}})[_0xb887('0x1c')](handleEntityNotFound(_0x244c59,null))[_0xb887('0x1c')](function(_0x2465ad){if(_0x2465ad){_0x538203=_0x2465ad;_0x50575c[_0xb887('0x3b')]=_[_0xb887('0x3d')](db[_0xb887('0x54')][_0xb887('0x38')]);_0x50575c[_0xb887('0x3c')]=_[_0xb887('0x3d')](_0x395fa4[_0xb887('0x3c')]);_0x50575c[_0xb887('0x3e')]=_[_0xb887('0x3f')](_0x50575c[_0xb887('0x3b')],_0x50575c[_0xb887('0x3c')]);_0x22843f[_0xb887('0x40')]=_[_0xb887('0x3f')](_0x50575c['model'],qs['fields'](_0x395fa4['query'][_0xb887('0x41')]));_0x22843f[_0xb887('0x40')]=_0x22843f[_0xb887('0x40')][_0xb887('0x4e')]?_0x22843f[_0xb887('0x40')]:_0x50575c['model'];_0x22843f[_0xb887('0x43')]=qs[_0xb887('0x44')](_0x395fa4[_0xb887('0x3c')][_0xb887('0x44')]);_0x22843f[_0xb887('0x45')]=qs['filters'](_[_0xb887('0x46')](_0x395fa4[_0xb887('0x3c')],_0x50575c[_0xb887('0x3e')]));if(_0x395fa4[_0xb887('0x3c')][_0xb887('0x49')]){_0x22843f[_0xb887('0x45')]=_[_0xb887('0x47')](_0x22843f[_0xb887('0x45')],{'$or':_[_0xb887('0x37')](_0x22843f[_0xb887('0x40')],function(_0x426dec){var _0x4013f6={};_0x4013f6[_0x426dec]={'$like':'%'+_0x395fa4[_0xb887('0x3c')]['filter']+'%'};return _0x4013f6;})});}_0x22843f=_[_0xb887('0x47')]({},_0x22843f,_0x395fa4['options']);return _0x538203[_0xb887('0x55')](_0x22843f);}})[_0xb887('0x1c')](function(_0x1ac52e){if(_0x1ac52e){_0x5b2d18=_0x1ac52e[_0xb887('0x4e')];if(!_0x395fa4[_0xb887('0x3c')][_0xb887('0x56')](_0xb887('0x42'))){_0x22843f[_0xb887('0x2e')]=qs[_0xb887('0x2e')](_0x395fa4[_0xb887('0x3c')][_0xb887('0x2e')]);_0x22843f[_0xb887('0x2d')]=qs['offset'](_0x395fa4[_0xb887('0x3c')][_0xb887('0x2d')]);}return _0x538203[_0xb887('0x55')](_0x22843f);}})[_0xb887('0x1c')](function(_0x56833d){if(_0x56833d){return _0x56833d?{'count':_0x5b2d18,'rows':_0x56833d}:null;}})[_0xb887('0x1c')](respondWithResult(_0x244c59,null))['catch'](handleError(_0x244c59,null));};exports[_0xb887('0x57')]=function(_0x17d998,_0x4cf1b9,_0x418ba9){var _0x17e6b1={};var _0x2dba76={};var _0x3413f5;var _0x495e6c;return db[_0xb887('0x4b')][_0xb887('0x58')]({'where':{'id':_0x17d998['params']['id']}})[_0xb887('0x1c')](handleEntityNotFound(_0x4cf1b9,null))[_0xb887('0x1c')](function(_0x5a914f){if(_0x5a914f){_0x3413f5=_0x5a914f;_0x2dba76[_0xb887('0x3b')]=_[_0xb887('0x3d')](db[_0xb887('0x54')][_0xb887('0x38')]);_0x2dba76[_0xb887('0x3c')]=_[_0xb887('0x3d')](_0x17d998[_0xb887('0x3c')]);_0x2dba76[_0xb887('0x3e')]=_[_0xb887('0x3f')](_0x2dba76[_0xb887('0x3b')],_0x2dba76[_0xb887('0x3c')]);_0x17e6b1[_0xb887('0x40')]=_[_0xb887('0x3f')](_0x2dba76['model'],qs[_0xb887('0x41')](_0x17d998[_0xb887('0x3c')][_0xb887('0x41')]));_0x17e6b1[_0xb887('0x40')]=_0x17e6b1['attributes']['length']?_0x17e6b1['attributes']:_0x2dba76[_0xb887('0x3b')];_0x17e6b1[_0xb887('0x43')]=qs[_0xb887('0x44')](_0x17d998[_0xb887('0x3c')]['sort']);_0x17e6b1['where']=qs['filters'](_['pick'](_0x17d998[_0xb887('0x3c')],_0x2dba76[_0xb887('0x3e')]));if(_0x17d998[_0xb887('0x3c')][_0xb887('0x49')]){_0x17e6b1[_0xb887('0x45')]=_[_0xb887('0x47')](_0x17e6b1[_0xb887('0x45')],{'$or':_[_0xb887('0x37')](_0x17e6b1[_0xb887('0x40')],function(_0x93acba){var _0x3a0414={};_0x3a0414[_0x93acba]={'$like':'%'+_0x17d998[_0xb887('0x3c')][_0xb887('0x49')]+'%'};return _0x3a0414;})});}_0x17e6b1=_[_0xb887('0x47')]({},_0x17e6b1,_0x17d998['options']);return _0x3413f5[_0xb887('0x57')](_0x17e6b1);}})['then'](function(_0x1de85e){if(_0x1de85e){_0x495e6c=_0x1de85e[_0xb887('0x4e')];if(!_0x17d998[_0xb887('0x3c')][_0xb887('0x56')](_0xb887('0x42'))){_0x17e6b1[_0xb887('0x2e')]=qs[_0xb887('0x2e')](_0x17d998[_0xb887('0x3c')][_0xb887('0x2e')]);_0x17e6b1['offset']=qs['offset'](_0x17d998['query'][_0xb887('0x2d')]);}return _0x3413f5[_0xb887('0x57')](_0x17e6b1);}})[_0xb887('0x1c')](function(_0x2c9ec3){if(_0x2c9ec3){return _0x2c9ec3?{'count':_0x495e6c,'rows':_0x2c9ec3}:null;}})[_0xb887('0x1c')](respondWithResult(_0x4cf1b9,null))[_0xb887('0x27')](handleError(_0x4cf1b9,null));};exports[_0xb887('0x59')]=function(_0x4e8da0,_0x48348a,_0x599c81){var _0x9ab7ee={};var _0x5ac20d={};var _0x18ba20;var _0x2a9322;return db[_0xb887('0x4b')]['findOne']({'where':{'id':_0x4e8da0[_0xb887('0x4d')]['id']}})[_0xb887('0x1c')](handleEntityNotFound(_0x48348a,null))['then'](function(_0xa4f4e4){if(_0xa4f4e4){_0x18ba20=_0xa4f4e4;_0x5ac20d[_0xb887('0x3b')]=_['keys'](db[_0xb887('0x54')][_0xb887('0x38')]);_0x5ac20d[_0xb887('0x3c')]=_['keys'](_0x4e8da0['query']);_0x5ac20d[_0xb887('0x3e')]=_[_0xb887('0x3f')](_0x5ac20d[_0xb887('0x3b')],_0x5ac20d['query']);_0x9ab7ee[_0xb887('0x40')]=_['intersection'](_0x5ac20d[_0xb887('0x3b')],qs[_0xb887('0x41')](_0x4e8da0[_0xb887('0x3c')][_0xb887('0x41')]));_0x9ab7ee[_0xb887('0x40')]=_0x9ab7ee['attributes'][_0xb887('0x4e')]?_0x9ab7ee['attributes']:_0x5ac20d[_0xb887('0x3b')];_0x9ab7ee['order']=qs[_0xb887('0x44')](_0x4e8da0[_0xb887('0x3c')][_0xb887('0x44')]);_0x9ab7ee[_0xb887('0x45')]=qs[_0xb887('0x3e')](_[_0xb887('0x46')](_0x4e8da0[_0xb887('0x3c')],_0x5ac20d[_0xb887('0x3e')]));if(_0x4e8da0[_0xb887('0x3c')][_0xb887('0x49')]){_0x9ab7ee['where']=_['merge'](_0x9ab7ee['where'],{'$or':_[_0xb887('0x37')](_0x9ab7ee[_0xb887('0x40')],function(_0x147ad4){var _0xfa8015={};_0xfa8015[_0x147ad4]={'$like':'%'+_0x4e8da0[_0xb887('0x3c')][_0xb887('0x49')]+'%'};return _0xfa8015;})});}_0x9ab7ee=_[_0xb887('0x47')]({},_0x9ab7ee,_0x4e8da0[_0xb887('0x4a')]);return _0x18ba20[_0xb887('0x59')](_0x9ab7ee);}})[_0xb887('0x1c')](function(_0x33d978){if(_0x33d978){_0x2a9322=_0x33d978[_0xb887('0x4e')];if(!_0x4e8da0['query'][_0xb887('0x56')]('nolimit')){_0x9ab7ee[_0xb887('0x2e')]=qs[_0xb887('0x2e')](_0x4e8da0[_0xb887('0x3c')]['limit']);_0x9ab7ee[_0xb887('0x2d')]=qs[_0xb887('0x2d')](_0x4e8da0[_0xb887('0x3c')][_0xb887('0x2d')]);}return _0x18ba20[_0xb887('0x59')](_0x9ab7ee);}})[_0xb887('0x1c')](function(_0x75afe9){if(_0x75afe9){return _0x75afe9?{'count':_0x2a9322,'rows':_0x75afe9}:null;}})[_0xb887('0x1c')](respondWithResult(_0x48348a,null))[_0xb887('0x27')](handleError(_0x48348a,null));}; \ No newline at end of file +var _0xb215=['VIRTUAL','include','findAll','rawAttributes','includeAll','options','catch','create','body','find','params','destroy','findOne','getFields','getSubjects','SugarcrmField','pick','nolimit','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','index','map','SugarcrmConfiguration','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xb215,0x1d5));var _0x5b21=function(_0x1b3d38,_0x41ba29){_0x1b3d38=_0x1b3d38-0x0;var _0x32d80b=_0xb215[_0x1b3d38];return _0x32d80b;};'use strict';var pdf=require(_0x5b21('0x0'));var emlformat=require(_0x5b21('0x1'));var rimraf=require(_0x5b21('0x2'));var zipdir=require(_0x5b21('0x3'));var jsonpatch=require(_0x5b21('0x4'));var rp=require(_0x5b21('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5b21('0x6'));var util=require(_0x5b21('0x7'));var path=require(_0x5b21('0x8'));var sox=require(_0x5b21('0x9'));var csv=require(_0x5b21('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b21('0xb'));var _=require(_0x5b21('0xc'));var squel=require(_0x5b21('0xd'));var crypto=require(_0x5b21('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5b21('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5b21('0x10'));var Papa=require(_0x5b21('0x11'));var Redis=require('ioredis');var authService=require(_0x5b21('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b21('0x13'));var logger=require(_0x5b21('0x14'))(_0x5b21('0x15'));var utils=require(_0x5b21('0x16'));var config=require(_0x5b21('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b21('0x18'))['db'];var jayson=require(_0x5b21('0x19'));var client=jayson[_0x5b21('0x1a')][_0x5b21('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xfe1649,_0x441ece,_0x566ce3,_0x41b077){return new BPromise(function(_0x3b83e7,_0x167d9c){var _0x5d5e2c=_0x41b077||client;return _0x5d5e2c['request'](_0xfe1649,_0x566ce3)['then'](function(_0xe36bb1){logger[_0x5b21('0x1c')](_0x5b21('0x1d'),_0x441ece,_0x5b21('0x1e'));logger[_0x5b21('0x1f')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x441ece,'request\x20sent',JSON[_0x5b21('0x20')](_0xe36bb1));if(_0xe36bb1[_0x5b21('0x21')]){if(_0xe36bb1[_0x5b21('0x21')][_0x5b21('0x22')]===0x1f4){logger[_0x5b21('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x441ece,_0xe36bb1[_0x5b21('0x21')][_0x5b21('0x23')]);return _0x167d9c(_0xe36bb1[_0x5b21('0x21')][_0x5b21('0x23')]);}logger[_0x5b21('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x441ece,_0xe36bb1[_0x5b21('0x21')]['message']);return _0x3b83e7(_0xe36bb1[_0x5b21('0x21')]['message']);}else{logger[_0x5b21('0x1c')](_0x5b21('0x1d'),_0x441ece,'request\x20sent');_0x3b83e7(_0xe36bb1[_0x5b21('0x24')]['message']);}})['catch'](function(_0x1fd74c){logger[_0x5b21('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x441ece,_0x1fd74c);_0x167d9c(_0x1fd74c);});});}function respondWithStatusCode(_0x5b351c,_0x3bb845){_0x3bb845=_0x3bb845||0xcc;return function(_0xa19eae){if(_0xa19eae){return _0x5b351c[_0x5b21('0x25')](_0x3bb845);}return _0x5b351c[_0x5b21('0x26')](_0x3bb845)[_0x5b21('0x27')]();};}function respondWithResult(_0x223ff7,_0x2377c8){_0x2377c8=_0x2377c8||0xc8;return function(_0x174f39){if(_0x174f39){return _0x223ff7[_0x5b21('0x26')](_0x2377c8)[_0x5b21('0x28')](_0x174f39);}};}function respondWithFilteredResult(_0x1bec5e,_0x9031a8){return function(_0x2bbfa8){if(_0x2bbfa8){var _0x3985b3=_0x2bbfa8[_0x5b21('0x29')],_0x87e946=_0x9031a8['offset'],_0x39e177=_0x9031a8[_0x5b21('0x2a')]+_0x9031a8[_0x5b21('0x2b')],_0x1def6c;if(_0x39e177>=_0x3985b3){_0x39e177=_0x3985b3;_0x1def6c=0xc8;}else{_0x1def6c=0xce;}_0x1bec5e[_0x5b21('0x26')](_0x1def6c);return _0x1bec5e[_0x5b21('0x2c')](_0x5b21('0x2d'),_0x87e946+'-'+_0x39e177+'/'+_0x3985b3)[_0x5b21('0x28')](_0x2bbfa8);}return null;};}function patchUpdates(_0x40858b){return function(_0x4db9e8){try{jsonpatch['apply'](_0x4db9e8,_0x40858b,!![]);}catch(_0x9f4454){return BPromise[_0x5b21('0x2e')](_0x9f4454);}return _0x4db9e8[_0x5b21('0x2f')]();};}function saveUpdates(_0x1e83d1,_0x27bd1f){return function(_0x34ec44){if(_0x34ec44){return _0x34ec44[_0x5b21('0x30')](_0x1e83d1)['then'](function(_0x4c5547){return _0x4c5547;});}return null;};}function removeEntity(_0x9f17ce,_0xe87ce9){return function(_0xfb2a22){if(_0xfb2a22){return _0xfb2a22['destroy']()[_0x5b21('0x31')](function(){_0x9f17ce[_0x5b21('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7b5d11,_0x458652){return function(_0x1c7c49){if(!_0x1c7c49){_0x7b5d11[_0x5b21('0x25')](0x194);}return _0x1c7c49;};}function handleError(_0x7bc3e5,_0x512f7a){_0x512f7a=_0x512f7a||0x1f4;return function(_0x3436d9){logger['error'](_0x3436d9['stack']);if(_0x3436d9['name']){delete _0x3436d9['name'];}_0x7bc3e5[_0x5b21('0x26')](_0x512f7a)['send'](_0x3436d9);};}exports[_0x5b21('0x32')]=function(_0x2c7c2d,_0x579500){var _0x1481a2={},_0x4037d8={},_0x8c2de1={'count':0x0,'rows':[]};var _0x46982a=_[_0x5b21('0x33')](db[_0x5b21('0x34')]['rawAttributes'],function(_0x2cd56f){return{'name':_0x2cd56f[_0x5b21('0x35')],'type':_0x2cd56f[_0x5b21('0x36')][_0x5b21('0x37')]};});_0x4037d8[_0x5b21('0x38')]=_['map'](_0x46982a,_0x5b21('0x39'));_0x4037d8[_0x5b21('0x3a')]=_[_0x5b21('0x3b')](_0x2c7c2d[_0x5b21('0x3a')]);_0x4037d8[_0x5b21('0x3c')]=_[_0x5b21('0x3d')](_0x4037d8[_0x5b21('0x38')],_0x4037d8['query']);_0x1481a2[_0x5b21('0x3e')]=_['intersection'](_0x4037d8[_0x5b21('0x38')],qs['fields'](_0x2c7c2d[_0x5b21('0x3a')][_0x5b21('0x3f')]));_0x1481a2[_0x5b21('0x3e')]=_0x1481a2[_0x5b21('0x3e')][_0x5b21('0x40')]?_0x1481a2[_0x5b21('0x3e')]:_0x4037d8['model'];if(!_0x2c7c2d[_0x5b21('0x3a')][_0x5b21('0x41')]('nolimit')){_0x1481a2['limit']=qs[_0x5b21('0x2b')](_0x2c7c2d[_0x5b21('0x3a')][_0x5b21('0x2b')]);_0x1481a2[_0x5b21('0x2a')]=qs[_0x5b21('0x2a')](_0x2c7c2d[_0x5b21('0x3a')][_0x5b21('0x2a')]);}_0x1481a2[_0x5b21('0x42')]=qs[_0x5b21('0x43')](_0x2c7c2d[_0x5b21('0x3a')][_0x5b21('0x43')]);_0x1481a2[_0x5b21('0x44')]=qs[_0x5b21('0x3c')](_['pick'](_0x2c7c2d[_0x5b21('0x3a')],_0x4037d8['filters']),_0x46982a);if(_0x2c7c2d['query'][_0x5b21('0x45')]){_0x1481a2['where']=_[_0x5b21('0x46')](_0x1481a2['where'],{'$or':_['map'](_0x46982a,function(_0x282d90){if(_0x282d90[_0x5b21('0x36')]!==_0x5b21('0x47')){var _0x1ce4b3={};_0x1ce4b3[_0x282d90[_0x5b21('0x39')]]={'$like':'%'+_0x2c7c2d[_0x5b21('0x3a')][_0x5b21('0x45')]+'%'};return _0x1ce4b3;}})});}_0x1481a2=_[_0x5b21('0x46')]({},_0x1481a2,_0x2c7c2d['options']);var _0x48c5d5={'where':_0x1481a2[_0x5b21('0x44')]};return db[_0x5b21('0x34')][_0x5b21('0x29')](_0x48c5d5)[_0x5b21('0x31')](function(_0x4bb9f8){_0x8c2de1[_0x5b21('0x29')]=_0x4bb9f8;if(_0x2c7c2d[_0x5b21('0x3a')]['includeAll']){_0x1481a2[_0x5b21('0x48')]=[{'all':!![]}];}return db[_0x5b21('0x34')][_0x5b21('0x49')](_0x1481a2);})[_0x5b21('0x31')](function(_0x58135e){_0x8c2de1['rows']=_0x58135e;return _0x8c2de1;})['then'](respondWithFilteredResult(_0x579500,_0x1481a2))['catch'](handleError(_0x579500,null));};exports['show']=function(_0x4f30d1,_0x45ffad){var _0x531dec={'raw':![],'where':{'id':_0x4f30d1['params']['id']}},_0x1c65a0={};_0x1c65a0[_0x5b21('0x38')]=_[_0x5b21('0x3b')](db['SugarcrmConfiguration'][_0x5b21('0x4a')]);_0x1c65a0[_0x5b21('0x3a')]=_[_0x5b21('0x3b')](_0x4f30d1[_0x5b21('0x3a')]);_0x1c65a0[_0x5b21('0x3c')]=_['intersection'](_0x1c65a0[_0x5b21('0x38')],_0x1c65a0[_0x5b21('0x3a')]);_0x531dec[_0x5b21('0x3e')]=_[_0x5b21('0x3d')](_0x1c65a0[_0x5b21('0x38')],qs[_0x5b21('0x3f')](_0x4f30d1[_0x5b21('0x3a')][_0x5b21('0x3f')]));_0x531dec[_0x5b21('0x3e')]=_0x531dec[_0x5b21('0x3e')][_0x5b21('0x40')]?_0x531dec[_0x5b21('0x3e')]:_0x1c65a0[_0x5b21('0x38')];if(_0x4f30d1[_0x5b21('0x3a')][_0x5b21('0x4b')]){_0x531dec['include']=[{'all':!![]}];}_0x531dec=_[_0x5b21('0x46')]({},_0x531dec,_0x4f30d1[_0x5b21('0x4c')]);return db['SugarcrmConfiguration']['find'](_0x531dec)[_0x5b21('0x31')](handleEntityNotFound(_0x45ffad,null))[_0x5b21('0x31')](respondWithResult(_0x45ffad,null))[_0x5b21('0x4d')](handleError(_0x45ffad,null));};exports[_0x5b21('0x4e')]=function(_0x201df5,_0x957cc3){return db[_0x5b21('0x34')][_0x5b21('0x4e')](_0x201df5[_0x5b21('0x4f')],{})[_0x5b21('0x31')](respondWithResult(_0x957cc3,0xc9))['catch'](handleError(_0x957cc3,null));};exports['update']=function(_0x1203eb,_0x52a8bc){if(_0x1203eb['body']['id']){delete _0x1203eb[_0x5b21('0x4f')]['id'];}return db[_0x5b21('0x34')][_0x5b21('0x50')]({'where':{'id':_0x1203eb[_0x5b21('0x51')]['id']}})[_0x5b21('0x31')](handleEntityNotFound(_0x52a8bc,null))[_0x5b21('0x31')](saveUpdates(_0x1203eb[_0x5b21('0x4f')],null))['then'](respondWithResult(_0x52a8bc,null))['catch'](handleError(_0x52a8bc,null));};exports[_0x5b21('0x52')]=function(_0x4f454b,_0x731d5b){return db[_0x5b21('0x34')][_0x5b21('0x50')]({'where':{'id':_0x4f454b[_0x5b21('0x51')]['id']}})[_0x5b21('0x31')](handleEntityNotFound(_0x731d5b,null))[_0x5b21('0x31')](removeEntity(_0x731d5b,null))['catch'](handleError(_0x731d5b,null));};exports['getFields']=function(_0x522cf9,_0x45ba6e,_0x498d30){var _0x3dbdab={};var _0x9ad9f8={};var _0x35c7b0;var _0x356b19;return db[_0x5b21('0x34')][_0x5b21('0x53')]({'where':{'id':_0x522cf9['params']['id']}})['then'](handleEntityNotFound(_0x45ba6e,null))[_0x5b21('0x31')](function(_0x1c481c){if(_0x1c481c){_0x35c7b0=_0x1c481c;_0x9ad9f8['model']=_['keys'](db['SugarcrmField'][_0x5b21('0x4a')]);_0x9ad9f8['query']=_[_0x5b21('0x3b')](_0x522cf9[_0x5b21('0x3a')]);_0x9ad9f8[_0x5b21('0x3c')]=_[_0x5b21('0x3d')](_0x9ad9f8[_0x5b21('0x38')],_0x9ad9f8[_0x5b21('0x3a')]);_0x3dbdab[_0x5b21('0x3e')]=_[_0x5b21('0x3d')](_0x9ad9f8['model'],qs[_0x5b21('0x3f')](_0x522cf9[_0x5b21('0x3a')][_0x5b21('0x3f')]));_0x3dbdab[_0x5b21('0x3e')]=_0x3dbdab['attributes']['length']?_0x3dbdab['attributes']:_0x9ad9f8[_0x5b21('0x38')];_0x3dbdab['order']=qs[_0x5b21('0x43')](_0x522cf9[_0x5b21('0x3a')]['sort']);_0x3dbdab[_0x5b21('0x44')]=qs['filters'](_['pick'](_0x522cf9[_0x5b21('0x3a')],_0x9ad9f8['filters']));if(_0x522cf9[_0x5b21('0x3a')][_0x5b21('0x45')]){_0x3dbdab[_0x5b21('0x44')]=_[_0x5b21('0x46')](_0x3dbdab['where'],{'$or':_[_0x5b21('0x33')](_0x3dbdab[_0x5b21('0x3e')],function(_0x44ecad){var _0x2f5b06={};_0x2f5b06[_0x44ecad]={'$like':'%'+_0x522cf9[_0x5b21('0x3a')][_0x5b21('0x45')]+'%'};return _0x2f5b06;})});}_0x3dbdab=_[_0x5b21('0x46')]({},_0x3dbdab,_0x522cf9[_0x5b21('0x4c')]);return _0x35c7b0[_0x5b21('0x54')](_0x3dbdab);}})[_0x5b21('0x31')](function(_0x2357e0){if(_0x2357e0){_0x356b19=_0x2357e0[_0x5b21('0x40')];if(!_0x522cf9[_0x5b21('0x3a')][_0x5b21('0x41')]('nolimit')){_0x3dbdab[_0x5b21('0x2b')]=qs[_0x5b21('0x2b')](_0x522cf9['query']['limit']);_0x3dbdab[_0x5b21('0x2a')]=qs[_0x5b21('0x2a')](_0x522cf9[_0x5b21('0x3a')]['offset']);}return _0x35c7b0[_0x5b21('0x54')](_0x3dbdab);}})[_0x5b21('0x31')](function(_0x2b336a){if(_0x2b336a){return _0x2b336a?{'count':_0x356b19,'rows':_0x2b336a}:null;}})[_0x5b21('0x31')](respondWithResult(_0x45ba6e,null))[_0x5b21('0x4d')](handleError(_0x45ba6e,null));};exports[_0x5b21('0x55')]=function(_0x47dfa6,_0x2e8003,_0x2c36e5){var _0x2e6fbb={};var _0x627750={};var _0xfc3bed;var _0x434fb0;return db[_0x5b21('0x34')][_0x5b21('0x53')]({'where':{'id':_0x47dfa6[_0x5b21('0x51')]['id']}})[_0x5b21('0x31')](handleEntityNotFound(_0x2e8003,null))[_0x5b21('0x31')](function(_0x5db510){if(_0x5db510){_0xfc3bed=_0x5db510;_0x627750[_0x5b21('0x38')]=_[_0x5b21('0x3b')](db[_0x5b21('0x56')]['rawAttributes']);_0x627750['query']=_['keys'](_0x47dfa6[_0x5b21('0x3a')]);_0x627750[_0x5b21('0x3c')]=_[_0x5b21('0x3d')](_0x627750[_0x5b21('0x38')],_0x627750[_0x5b21('0x3a')]);_0x2e6fbb['attributes']=_[_0x5b21('0x3d')](_0x627750['model'],qs[_0x5b21('0x3f')](_0x47dfa6[_0x5b21('0x3a')]['fields']));_0x2e6fbb['attributes']=_0x2e6fbb[_0x5b21('0x3e')][_0x5b21('0x40')]?_0x2e6fbb[_0x5b21('0x3e')]:_0x627750['model'];_0x2e6fbb[_0x5b21('0x42')]=qs[_0x5b21('0x43')](_0x47dfa6['query'][_0x5b21('0x43')]);_0x2e6fbb['where']=qs[_0x5b21('0x3c')](_[_0x5b21('0x57')](_0x47dfa6[_0x5b21('0x3a')],_0x627750['filters']));if(_0x47dfa6[_0x5b21('0x3a')][_0x5b21('0x45')]){_0x2e6fbb['where']=_['merge'](_0x2e6fbb[_0x5b21('0x44')],{'$or':_[_0x5b21('0x33')](_0x2e6fbb[_0x5b21('0x3e')],function(_0x5026c3){var _0x28f230={};_0x28f230[_0x5026c3]={'$like':'%'+_0x47dfa6['query'][_0x5b21('0x45')]+'%'};return _0x28f230;})});}_0x2e6fbb=_[_0x5b21('0x46')]({},_0x2e6fbb,_0x47dfa6['options']);return _0xfc3bed['getSubjects'](_0x2e6fbb);}})[_0x5b21('0x31')](function(_0x43efd8){if(_0x43efd8){_0x434fb0=_0x43efd8[_0x5b21('0x40')];if(!_0x47dfa6[_0x5b21('0x3a')]['hasOwnProperty'](_0x5b21('0x58'))){_0x2e6fbb[_0x5b21('0x2b')]=qs['limit'](_0x47dfa6['query'][_0x5b21('0x2b')]);_0x2e6fbb[_0x5b21('0x2a')]=qs[_0x5b21('0x2a')](_0x47dfa6[_0x5b21('0x3a')][_0x5b21('0x2a')]);}return _0xfc3bed[_0x5b21('0x55')](_0x2e6fbb);}})[_0x5b21('0x31')](function(_0x10eae6){if(_0x10eae6){return _0x10eae6?{'count':_0x434fb0,'rows':_0x10eae6}:null;}})['then'](respondWithResult(_0x2e8003,null))[_0x5b21('0x4d')](handleError(_0x2e8003,null));};exports[_0x5b21('0x59')]=function(_0x15c796,_0x3d37e3,_0x6b3134){var _0x35bf98={};var _0x175e4d={};var _0x44bf7d;var _0x4ef8e4;return db[_0x5b21('0x34')][_0x5b21('0x53')]({'where':{'id':_0x15c796['params']['id']}})[_0x5b21('0x31')](handleEntityNotFound(_0x3d37e3,null))[_0x5b21('0x31')](function(_0x4f7aec){if(_0x4f7aec){_0x44bf7d=_0x4f7aec;_0x175e4d[_0x5b21('0x38')]=_[_0x5b21('0x3b')](db[_0x5b21('0x56')][_0x5b21('0x4a')]);_0x175e4d[_0x5b21('0x3a')]=_['keys'](_0x15c796['query']);_0x175e4d[_0x5b21('0x3c')]=_['intersection'](_0x175e4d['model'],_0x175e4d[_0x5b21('0x3a')]);_0x35bf98['attributes']=_['intersection'](_0x175e4d[_0x5b21('0x38')],qs[_0x5b21('0x3f')](_0x15c796[_0x5b21('0x3a')][_0x5b21('0x3f')]));_0x35bf98[_0x5b21('0x3e')]=_0x35bf98['attributes'][_0x5b21('0x40')]?_0x35bf98[_0x5b21('0x3e')]:_0x175e4d[_0x5b21('0x38')];_0x35bf98['order']=qs[_0x5b21('0x43')](_0x15c796[_0x5b21('0x3a')][_0x5b21('0x43')]);_0x35bf98[_0x5b21('0x44')]=qs[_0x5b21('0x3c')](_['pick'](_0x15c796[_0x5b21('0x3a')],_0x175e4d[_0x5b21('0x3c')]));if(_0x15c796[_0x5b21('0x3a')][_0x5b21('0x45')]){_0x35bf98['where']=_[_0x5b21('0x46')](_0x35bf98[_0x5b21('0x44')],{'$or':_[_0x5b21('0x33')](_0x35bf98[_0x5b21('0x3e')],function(_0x1fe6da){var _0x41a0b4={};_0x41a0b4[_0x1fe6da]={'$like':'%'+_0x15c796[_0x5b21('0x3a')]['filter']+'%'};return _0x41a0b4;})});}_0x35bf98=_[_0x5b21('0x46')]({},_0x35bf98,_0x15c796[_0x5b21('0x4c')]);return _0x44bf7d[_0x5b21('0x59')](_0x35bf98);}})[_0x5b21('0x31')](function(_0x5398c4){if(_0x5398c4){_0x4ef8e4=_0x5398c4[_0x5b21('0x40')];if(!_0x15c796[_0x5b21('0x3a')]['hasOwnProperty'](_0x5b21('0x58'))){_0x35bf98[_0x5b21('0x2b')]=qs['limit'](_0x15c796[_0x5b21('0x3a')][_0x5b21('0x2b')]);_0x35bf98[_0x5b21('0x2a')]=qs[_0x5b21('0x2a')](_0x15c796['query'][_0x5b21('0x2a')]);}return _0x44bf7d['getDescriptions'](_0x35bf98);}})[_0x5b21('0x31')](function(_0xac7683){if(_0xac7683){return _0xac7683?{'count':_0x4ef8e4,'rows':_0xac7683}:null;}})[_0x5b21('0x31')](respondWithResult(_0x3d37e3,null))[_0x5b21('0x4d')](handleError(_0x3d37e3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index c1d0012..a4b43a1 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 _0x17ea=['path','rimraf','../../config/environment','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17ea,0x18c));var _0xa17e=function(_0x6a8e0f,_0x312db8){_0x6a8e0f=_0x6a8e0f-0x0;var _0xa8de38=_0x17ea[_0x6a8e0f];return _0xa8de38;};'use strict';var _=require(_0xa17e('0x0'));var util=require(_0xa17e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa17e('0x2'));var BPromise=require(_0xa17e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa17e('0x4'));var rimraf=require(_0xa17e('0x5'));var config=require(_0xa17e('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xa17e('0x7')]=function(_0x926b07,_0x36b39a){return _0x926b07['define'](_0xa17e('0x8'),attributes,{'tableName':_0xa17e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5a0=['../../config/environment','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1f10d6,_0x2c45ac){var _0x4e25f7=function(_0x499128){while(--_0x499128){_0x1f10d6['push'](_0x1f10d6['shift']());}};_0x4e25f7(++_0x2c45ac);}(_0xc5a0,0xca));var _0x0c5a=function(_0x138d18,_0x7a67b9){_0x138d18=_0x138d18-0x0;var _0x51bf13=_0xc5a0[_0x138d18];return _0x51bf13;};'use strict';var _=require(_0x0c5a('0x0'));var util=require('util');var logger=require(_0x0c5a('0x1'))('api');var moment=require(_0x0c5a('0x2'));var BPromise=require(_0x0c5a('0x3'));var rp=require(_0x0c5a('0x4'));var fs=require('fs');var path=require(_0x0c5a('0x5'));var rimraf=require(_0x0c5a('0x6'));var config=require(_0x0c5a('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x0c5a('0x8')]=function(_0x25dbee,_0x53a421){return _0x25dbee['define'](_0x0c5a('0x9'),attributes,{'tableName':_0x0c5a('0xa'),'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 029129b..611e687 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 _0x792b=['lodash','moment','../../config/logger','rpc','../../config/environment','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','catch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x792b,0x140));var _0xb792=function(_0x5a92ad,_0x2219a6){_0x5a92ad=_0x5a92ad-0x0;var _0x2466f8=_0x792b[_0x5a92ad];return _0x2466f8;};'use strict';var _=require(_0xb792('0x0'));var util=require('util');var moment=require(_0xb792('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb792('0x2'))(_0xb792('0x3'));var config=require(_0xb792('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xb792('0x5')][_0xb792('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1036c4,_0x3c587b,_0x2b0cfc){return new BPromise(function(_0x57a4be,_0x187976){return client['request'](_0x1036c4,_0x2b0cfc)[_0xb792('0x7')](function(_0x789ed5){logger['info'](_0xb792('0x8'),_0x3c587b,_0xb792('0x9'));logger[_0xb792('0xa')](_0xb792('0xb'),_0x3c587b,_0xb792('0x9'),JSON['stringify'](_0x789ed5));if(_0x789ed5['error']){if(_0x789ed5[_0xb792('0xc')]['code']===0x1f4){logger[_0xb792('0xc')](_0xb792('0x8'),_0x3c587b,_0x789ed5[_0xb792('0xc')][_0xb792('0xd')]);return _0x187976(_0x789ed5[_0xb792('0xc')][_0xb792('0xd')]);}logger[_0xb792('0xc')](_0xb792('0x8'),_0x3c587b,_0x789ed5[_0xb792('0xc')][_0xb792('0xd')]);return _0x57a4be(_0x789ed5[_0xb792('0xc')]['message']);}else{logger[_0xb792('0xe')](_0xb792('0x8'),_0x3c587b,'request\x20sent');_0x57a4be(_0x789ed5['result'][_0xb792('0xd')]);}})[_0xb792('0xf')](function(_0x406985){logger[_0xb792('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3c587b,_0x406985);_0x187976(_0x406985);});});} \ No newline at end of file +var _0x18c7=['../../config/utils','../../config/logger','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3c6125,_0x3b2a9c){var _0x2f47b8=function(_0x214650){while(--_0x214650){_0x3c6125['push'](_0x3c6125['shift']());}};_0x2f47b8(++_0x3b2a9c);}(_0x18c7,0x1c8));var _0x718c=function(_0x10c1df,_0x134715){_0x10c1df=_0x10c1df-0x0;var _0x277330=_0x18c7[_0x10c1df];return _0x277330;};'use strict';var _=require(_0x718c('0x0'));var util=require(_0x718c('0x1'));var moment=require(_0x718c('0x2'));var BPromise=require('bluebird');var rs=require(_0x718c('0x3'));var fs=require('fs');var Redis=require(_0x718c('0x4'));var db=require(_0x718c('0x5'))['db'];var utils=require(_0x718c('0x6'));var logger=require(_0x718c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x718c('0x8'));var client=jayson['client'][_0x718c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57bb7f,_0x11fc89,_0x373564){return new BPromise(function(_0x3aac95,_0x298d1d){return client[_0x718c('0xa')](_0x57bb7f,_0x373564)[_0x718c('0xb')](function(_0x52af32){logger[_0x718c('0xc')](_0x718c('0xd'),_0x11fc89,'request\x20sent');logger[_0x718c('0xe')](_0x718c('0xf'),_0x11fc89,_0x718c('0x10'),JSON['stringify'](_0x52af32));if(_0x52af32[_0x718c('0x11')]){if(_0x52af32[_0x718c('0x11')][_0x718c('0x12')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x11fc89,_0x52af32[_0x718c('0x11')][_0x718c('0x13')]);return _0x298d1d(_0x52af32[_0x718c('0x11')][_0x718c('0x13')]);}logger['error'](_0x718c('0xd'),_0x11fc89,_0x52af32[_0x718c('0x11')][_0x718c('0x13')]);return _0x3aac95(_0x52af32['error'][_0x718c('0x13')]);}else{logger[_0x718c('0xc')](_0x718c('0xd'),_0x11fc89,_0x718c('0x10'));_0x3aac95(_0x52af32[_0x718c('0x14')][_0x718c('0x13')]);}})[_0x718c('0x15')](function(_0x3175e0){logger[_0x718c('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x11fc89,_0x3175e0);_0x298d1d(_0x3175e0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index c76de47..4ecc656 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 _0x6ae2=['../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x26ae31,_0x3f8239){_0x26ae31=_0x26ae31-0x0;var _0x396e9b=_0x6ae2[_0x26ae31];return _0x396e9b;};'use strict';var multer=require(_0x26ae('0x0'));var util=require(_0x26ae('0x1'));var path=require(_0x26ae('0x2'));var timeout=require(_0x26ae('0x3'));var express=require(_0x26ae('0x4'));var router=express[_0x26ae('0x5')]();var fs_extra=require(_0x26ae('0x6'));var auth=require(_0x26ae('0x7'));var interaction=require(_0x26ae('0x8'));var config=require('../../config/environment');var controller=require(_0x26ae('0x9'));router[_0x26ae('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x26ae('0xa')](_0x26ae('0xb'),auth[_0x26ae('0xc')](),controller[_0x26ae('0xd')]);router[_0x26ae('0xe')]('/',auth[_0x26ae('0xc')](),controller[_0x26ae('0xf')]);router[_0x26ae('0x10')](_0x26ae('0xb'),auth[_0x26ae('0xc')](),controller[_0x26ae('0x11')]);router[_0x26ae('0x12')]('/:id',auth[_0x26ae('0xc')](),controller['destroy']);module[_0x26ae('0x13')]=router; \ No newline at end of file +var _0x5377=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x5d7f30,_0x1998e1){var _0x1232d4=function(_0x28005c){while(--_0x28005c){_0x5d7f30['push'](_0x5d7f30['shift']());}};_0x1232d4(++_0x1998e1);}(_0x5377,0x131));var _0x7537=function(_0x39a96b,_0x231a3f){_0x39a96b=_0x39a96b-0x0;var _0x3fa410=_0x5377[_0x39a96b];return _0x3fa410;};'use strict';var multer=require('multer');var util=require(_0x7537('0x0'));var path=require(_0x7537('0x1'));var timeout=require(_0x7537('0x2'));var express=require(_0x7537('0x3'));var router=express[_0x7537('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7537('0x5'));var interaction=require(_0x7537('0x6'));var config=require(_0x7537('0x7'));var controller=require('./intSugarcrmField.controller');router[_0x7537('0x8')]('/',auth[_0x7537('0x9')](),controller[_0x7537('0xa')]);router[_0x7537('0x8')](_0x7537('0xb'),auth[_0x7537('0x9')](),controller[_0x7537('0xc')]);router[_0x7537('0xd')]('/',auth[_0x7537('0x9')](),controller[_0x7537('0xe')]);router[_0x7537('0xf')]('/:id',auth[_0x7537('0x9')](),controller[_0x7537('0x10')]);router[_0x7537('0x11')](_0x7537('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7537('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index d003b9e..b238ea7 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 _0xb49a=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x585970,_0x197dd2){var _0xa99602=function(_0x1eb7df){while(--_0x1eb7df){_0x585970['push'](_0x585970['shift']());}};_0xa99602(++_0x197dd2);}(_0xb49a,0xfb));var _0xab49=function(_0x54820c,_0xd5a2f6){_0x54820c=_0x54820c-0x0;var _0x5c60c1=_0xb49a[_0x54820c];return _0x5c60c1;};'use strict';var Sequelize=require(_0xab49('0x0'));module[_0xab49('0x1')]={'type':{'type':Sequelize[_0xab49('0x2')](_0xab49('0x3'),_0xab49('0x4'),'customVariable',_0xab49('0x5'),_0xab49('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xab49('0x7')]},'keyType':{'type':Sequelize[_0xab49('0x2')](_0xab49('0x3'),_0xab49('0x4'),_0xab49('0x8'))},'keyContent':{'type':Sequelize[_0xab49('0x7')]},'idField':{'type':Sequelize[_0xab49('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xab49('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab49('0x7')]}}; \ No newline at end of file +var _0x6308=['STRING','BOOLEAN','sequelize','ENUM','customVariable','keyValue','picklist','string'];(function(_0x1a352f,_0xb5808b){var _0x4474ac=function(_0x56fb13){while(--_0x56fb13){_0x1a352f['push'](_0x1a352f['shift']());}};_0x4474ac(++_0xb5808b);}(_0x6308,0x1f2));var _0x8630=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x6308[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0x8630('0x0'));module['exports']={'type':{'type':Sequelize[_0x8630('0x1')]('string','variable',_0x8630('0x2'),_0x8630('0x3'),_0x8630('0x4')),'defaultValue':_0x8630('0x5')},'content':{'type':Sequelize[_0x8630('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8630('0x5'),'variable',_0x8630('0x2'))},'keyContent':{'type':Sequelize[_0x8630('0x6')]},'idField':{'type':Sequelize[_0x8630('0x6')]},'nameField':{'type':Sequelize[_0x8630('0x6')]},'customField':{'type':Sequelize[_0x8630('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8630('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index e049b04..f016b7e 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 _0x16d2=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','merge','where','filter','options','includeAll','include','findAll','rows','catch','show','find','create','params','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x466a1a,_0x37933b){var _0x577165=function(_0x4c97b9){while(--_0x4c97b9){_0x466a1a['push'](_0x466a1a['shift']());}};_0x577165(++_0x37933b);}(_0x16d2,0x123));var _0x216d=function(_0x56a60a,_0xf4c330){_0x56a60a=_0x56a60a-0x0;var _0x5c4057=_0x16d2[_0x56a60a];return _0x5c4057;};'use strict';var pdf=require(_0x216d('0x0'));var emlformat=require(_0x216d('0x1'));var rimraf=require(_0x216d('0x2'));var zipdir=require(_0x216d('0x3'));var jsonpatch=require(_0x216d('0x4'));var rp=require(_0x216d('0x5'));var moment=require(_0x216d('0x6'));var BPromise=require(_0x216d('0x7'));var Mustache=require(_0x216d('0x8'));var util=require('util');var path=require(_0x216d('0x9'));var sox=require(_0x216d('0xa'));var csv=require(_0x216d('0xb'));var ejs=require(_0x216d('0xc'));var fs=require('fs');var fs_extra=require(_0x216d('0xd'));var _=require(_0x216d('0xe'));var squel=require(_0x216d('0xf'));var crypto=require(_0x216d('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x216d('0x11'));var toCsv=require(_0x216d('0xb'));var querystring=require(_0x216d('0x12'));var Papa=require(_0x216d('0x13'));var Redis=require(_0x216d('0x14'));var authService=require(_0x216d('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x216d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x216d('0x17'))(_0x216d('0x18'));var utils=require(_0x216d('0x19'));var config=require(_0x216d('0x1a'));var licenseUtil=require(_0x216d('0x1b'));var db=require(_0x216d('0x1c'))['db'];function respondWithStatusCode(_0x4c92d9,_0xb36a43){_0xb36a43=_0xb36a43||0xcc;return function(_0x4c07d0){if(_0x4c07d0){return _0x4c92d9[_0x216d('0x1d')](_0xb36a43);}return _0x4c92d9[_0x216d('0x1e')](_0xb36a43)['end']();};}function respondWithResult(_0x165c19,_0x322e4b){_0x322e4b=_0x322e4b||0xc8;return function(_0x54a816){if(_0x54a816){return _0x165c19[_0x216d('0x1e')](_0x322e4b)['json'](_0x54a816);}};}function respondWithFilteredResult(_0x448c0d,_0xf571a4){return function(_0x4631b0){if(_0x4631b0){var _0x23ff86=_0x4631b0[_0x216d('0x1f')],_0x3e5585=_0xf571a4[_0x216d('0x20')],_0x304dfa=_0xf571a4['offset']+_0xf571a4[_0x216d('0x21')],_0x467cd5;if(_0x304dfa>=_0x23ff86){_0x304dfa=_0x23ff86;_0x467cd5=0xc8;}else{_0x467cd5=0xce;}_0x448c0d['status'](_0x467cd5);return _0x448c0d['set'](_0x216d('0x22'),_0x3e5585+'-'+_0x304dfa+'/'+_0x23ff86)[_0x216d('0x23')](_0x4631b0);}return null;};}function patchUpdates(_0x574758){return function(_0x3f32e0){try{jsonpatch[_0x216d('0x24')](_0x3f32e0,_0x574758,!![]);}catch(_0x5abab0){return BPromise[_0x216d('0x25')](_0x5abab0);}return _0x3f32e0[_0x216d('0x26')]();};}function saveUpdates(_0x430e81,_0x3e9818){return function(_0x5c3e03){if(_0x5c3e03){return _0x5c3e03[_0x216d('0x27')](_0x430e81)[_0x216d('0x28')](function(_0x10f299){return _0x10f299;});}return null;};}function removeEntity(_0x438981,_0x206782){return function(_0x57cfbd){if(_0x57cfbd){return _0x57cfbd[_0x216d('0x29')]()[_0x216d('0x28')](function(){_0x438981[_0x216d('0x1e')](0xcc)[_0x216d('0x2a')]();});}};}function handleEntityNotFound(_0x6fa4b3,_0x54d96f){return function(_0x68d7){if(!_0x68d7){_0x6fa4b3[_0x216d('0x1d')](0x194);}return _0x68d7;};}function handleError(_0xb9f1e,_0x5998a1){_0x5998a1=_0x5998a1||0x1f4;return function(_0x4ec8a7){logger['error'](_0x4ec8a7['stack']);if(_0x4ec8a7['name']){delete _0x4ec8a7[_0x216d('0x2b')];}_0xb9f1e[_0x216d('0x1e')](_0x5998a1)[_0x216d('0x2c')](_0x4ec8a7);};}exports[_0x216d('0x2d')]=function(_0x46d0ef,_0x47fa6d){var _0x5b21d8={},_0xa7624a={},_0x51b2bd={'count':0x0,'rows':[]};var _0x23d1c3=_[_0x216d('0x2e')](db[_0x216d('0x2f')][_0x216d('0x30')],function(_0x307f2b){return{'name':_0x307f2b[_0x216d('0x31')],'type':_0x307f2b[_0x216d('0x32')][_0x216d('0x33')]};});_0xa7624a[_0x216d('0x34')]=_[_0x216d('0x2e')](_0x23d1c3,_0x216d('0x2b'));_0xa7624a[_0x216d('0x35')]=_[_0x216d('0x36')](_0x46d0ef['query']);_0xa7624a[_0x216d('0x37')]=_[_0x216d('0x38')](_0xa7624a[_0x216d('0x34')],_0xa7624a['query']);_0x5b21d8[_0x216d('0x39')]=_[_0x216d('0x38')](_0xa7624a[_0x216d('0x34')],qs[_0x216d('0x3a')](_0x46d0ef['query'][_0x216d('0x3a')]));_0x5b21d8[_0x216d('0x39')]=_0x5b21d8[_0x216d('0x39')][_0x216d('0x3b')]?_0x5b21d8[_0x216d('0x39')]:_0xa7624a[_0x216d('0x34')];if(!_0x46d0ef[_0x216d('0x35')][_0x216d('0x3c')](_0x216d('0x3d'))){_0x5b21d8[_0x216d('0x21')]=qs[_0x216d('0x21')](_0x46d0ef['query'][_0x216d('0x21')]);_0x5b21d8[_0x216d('0x20')]=qs[_0x216d('0x20')](_0x46d0ef['query'][_0x216d('0x20')]);}_0x5b21d8[_0x216d('0x3e')]=qs['sort'](_0x46d0ef[_0x216d('0x35')]['sort']);_0x5b21d8['where']=qs[_0x216d('0x37')](_[_0x216d('0x3f')](_0x46d0ef[_0x216d('0x35')],_0xa7624a[_0x216d('0x37')]),_0x23d1c3);if(_0x46d0ef['query']['filter']){_0x5b21d8['where']=_[_0x216d('0x40')](_0x5b21d8[_0x216d('0x41')],{'$or':_['map'](_0x23d1c3,function(_0x3ff9a0){if(_0x3ff9a0[_0x216d('0x32')]!=='VIRTUAL'){var _0xe49ba4={};_0xe49ba4[_0x3ff9a0[_0x216d('0x2b')]]={'$like':'%'+_0x46d0ef[_0x216d('0x35')][_0x216d('0x42')]+'%'};return _0xe49ba4;}})});}_0x5b21d8=_[_0x216d('0x40')]({},_0x5b21d8,_0x46d0ef[_0x216d('0x43')]);var _0x35cb6e={'where':_0x5b21d8[_0x216d('0x41')]};return db['SugarcrmField']['count'](_0x35cb6e)[_0x216d('0x28')](function(_0x2be24f){_0x51b2bd['count']=_0x2be24f;if(_0x46d0ef[_0x216d('0x35')][_0x216d('0x44')]){_0x5b21d8[_0x216d('0x45')]=[{'all':!![]}];}return db['SugarcrmField'][_0x216d('0x46')](_0x5b21d8);})[_0x216d('0x28')](function(_0x13d787){_0x51b2bd[_0x216d('0x47')]=_0x13d787;return _0x51b2bd;})['then'](respondWithFilteredResult(_0x47fa6d,_0x5b21d8))[_0x216d('0x48')](handleError(_0x47fa6d,null));};exports[_0x216d('0x49')]=function(_0x5665d7,_0x37bf4a){var _0x306e9f={'raw':!![],'where':{'id':_0x5665d7['params']['id']}},_0x590eb6={};_0x590eb6[_0x216d('0x34')]=_[_0x216d('0x36')](db[_0x216d('0x2f')]['rawAttributes']);_0x590eb6[_0x216d('0x35')]=_['keys'](_0x5665d7['query']);_0x590eb6[_0x216d('0x37')]=_[_0x216d('0x38')](_0x590eb6[_0x216d('0x34')],_0x590eb6['query']);_0x306e9f[_0x216d('0x39')]=_['intersection'](_0x590eb6[_0x216d('0x34')],qs[_0x216d('0x3a')](_0x5665d7[_0x216d('0x35')]['fields']));_0x306e9f[_0x216d('0x39')]=_0x306e9f[_0x216d('0x39')][_0x216d('0x3b')]?_0x306e9f[_0x216d('0x39')]:_0x590eb6['model'];if(_0x5665d7['query']['includeAll']){_0x306e9f[_0x216d('0x45')]=[{'all':!![]}];}_0x306e9f=_[_0x216d('0x40')]({},_0x306e9f,_0x5665d7[_0x216d('0x43')]);return db[_0x216d('0x2f')][_0x216d('0x4a')](_0x306e9f)[_0x216d('0x28')](handleEntityNotFound(_0x37bf4a,null))[_0x216d('0x28')](respondWithResult(_0x37bf4a,null))[_0x216d('0x48')](handleError(_0x37bf4a,null));};exports['create']=function(_0x3771dc,_0x2c6248){return db[_0x216d('0x2f')][_0x216d('0x4b')](_0x3771dc['body'],{})[_0x216d('0x28')](respondWithResult(_0x2c6248,0xc9))['catch'](handleError(_0x2c6248,null));};exports[_0x216d('0x27')]=function(_0x36179,_0xceb993){if(_0x36179['body']['id']){delete _0x36179['body']['id'];}return db[_0x216d('0x2f')][_0x216d('0x4a')]({'where':{'id':_0x36179[_0x216d('0x4c')]['id']}})[_0x216d('0x28')](handleEntityNotFound(_0xceb993,null))[_0x216d('0x28')](saveUpdates(_0x36179[_0x216d('0x4d')],null))['then'](respondWithResult(_0xceb993,null))['catch'](handleError(_0xceb993,null));};exports[_0x216d('0x29')]=function(_0x542630,_0x1e0dc9){return db[_0x216d('0x2f')]['find']({'where':{'id':_0x542630['params']['id']}})['then'](handleEntityNotFound(_0x1e0dc9,null))['then'](removeEntity(_0x1e0dc9,null))[_0x216d('0x48')](handleError(_0x1e0dc9,null));}; \ No newline at end of file +var _0x0713=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','name','index','map','SugarcrmField','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','create','body','find','params','rimraf','zip-dir'];(function(_0x26dcb9,_0xe7c508){var _0x430730=function(_0x1ebc98){while(--_0x1ebc98){_0x26dcb9['push'](_0x26dcb9['shift']());}};_0x430730(++_0xe7c508);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var fs_extra=require(_0x3071('0xb'));var _=require(_0x3071('0xc'));var squel=require(_0x3071('0xd'));var crypto=require(_0x3071('0xe'));var jsforce=require(_0x3071('0xf'));var deskjs=require(_0x3071('0x10'));var toCsv=require(_0x3071('0x9'));var querystring=require('querystring');var Papa=require(_0x3071('0x11'));var Redis=require(_0x3071('0x12'));var authService=require(_0x3071('0x13'));var qs=require(_0x3071('0x14'));var as=require(_0x3071('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3071('0x16'))(_0x3071('0x17'));var utils=require(_0x3071('0x18'));var config=require(_0x3071('0x19'));var licenseUtil=require(_0x3071('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5330a8,_0x1826ca){_0x1826ca=_0x1826ca||0xcc;return function(_0x5dc13b){if(_0x5dc13b){return _0x5330a8[_0x3071('0x1b')](_0x1826ca);}return _0x5330a8[_0x3071('0x1c')](_0x1826ca)['end']();};}function respondWithResult(_0x104e73,_0x4e1219){_0x4e1219=_0x4e1219||0xc8;return function(_0x2fc15d){if(_0x2fc15d){return _0x104e73[_0x3071('0x1c')](_0x4e1219)[_0x3071('0x1d')](_0x2fc15d);}};}function respondWithFilteredResult(_0x1f14e1,_0x1caa5d){return function(_0x2a6a4b){if(_0x2a6a4b){var _0x157a47=_0x2a6a4b['count'],_0x11bdc9=_0x1caa5d[_0x3071('0x1e')],_0x21aad3=_0x1caa5d[_0x3071('0x1e')]+_0x1caa5d[_0x3071('0x1f')],_0x344ea6;if(_0x21aad3>=_0x157a47){_0x21aad3=_0x157a47;_0x344ea6=0xc8;}else{_0x344ea6=0xce;}_0x1f14e1[_0x3071('0x1c')](_0x344ea6);return _0x1f14e1[_0x3071('0x20')](_0x3071('0x21'),_0x11bdc9+'-'+_0x21aad3+'/'+_0x157a47)[_0x3071('0x1d')](_0x2a6a4b);}return null;};}function patchUpdates(_0x26f113){return function(_0x502a16){try{jsonpatch[_0x3071('0x22')](_0x502a16,_0x26f113,!![]);}catch(_0x2bfa33){return BPromise[_0x3071('0x23')](_0x2bfa33);}return _0x502a16['save']();};}function saveUpdates(_0xb8f4e3,_0x5cd80d){return function(_0x833074){if(_0x833074){return _0x833074[_0x3071('0x24')](_0xb8f4e3)[_0x3071('0x25')](function(_0x457b57){return _0x457b57;});}return null;};}function removeEntity(_0x33090c,_0x34c50e){return function(_0x3c5cef){if(_0x3c5cef){return _0x3c5cef[_0x3071('0x26')]()['then'](function(){_0x33090c['status'](0xcc)[_0x3071('0x27')]();});}};}function handleEntityNotFound(_0xb05b1d,_0x412652){return function(_0x13df9f){if(!_0x13df9f){_0xb05b1d[_0x3071('0x1b')](0x194);}return _0x13df9f;};}function handleError(_0x44b45f,_0x7a4cb4){_0x7a4cb4=_0x7a4cb4||0x1f4;return function(_0x1fe727){logger[_0x3071('0x28')](_0x1fe727['stack']);if(_0x1fe727[_0x3071('0x29')]){delete _0x1fe727[_0x3071('0x29')];}_0x44b45f[_0x3071('0x1c')](_0x7a4cb4)['send'](_0x1fe727);};}exports[_0x3071('0x2a')]=function(_0x28792d,_0x163604){var _0x950fde={},_0x3fa3b8={},_0x25b96b={'count':0x0,'rows':[]};var _0x177b5f=_[_0x3071('0x2b')](db[_0x3071('0x2c')][_0x3071('0x2d')],function(_0x254fc8){return{'name':_0x254fc8['fieldName'],'type':_0x254fc8['type'][_0x3071('0x2e')]};});_0x3fa3b8[_0x3071('0x2f')]=_[_0x3071('0x2b')](_0x177b5f,_0x3071('0x29'));_0x3fa3b8[_0x3071('0x30')]=_[_0x3071('0x31')](_0x28792d[_0x3071('0x30')]);_0x3fa3b8[_0x3071('0x32')]=_['intersection'](_0x3fa3b8['model'],_0x3fa3b8['query']);_0x950fde[_0x3071('0x33')]=_[_0x3071('0x34')](_0x3fa3b8['model'],qs[_0x3071('0x35')](_0x28792d[_0x3071('0x30')][_0x3071('0x35')]));_0x950fde[_0x3071('0x33')]=_0x950fde['attributes'][_0x3071('0x36')]?_0x950fde[_0x3071('0x33')]:_0x3fa3b8[_0x3071('0x2f')];if(!_0x28792d[_0x3071('0x30')][_0x3071('0x37')](_0x3071('0x38'))){_0x950fde[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x28792d['query'][_0x3071('0x1f')]);_0x950fde['offset']=qs['offset'](_0x28792d[_0x3071('0x30')][_0x3071('0x1e')]);}_0x950fde['order']=qs[_0x3071('0x39')](_0x28792d[_0x3071('0x30')][_0x3071('0x39')]);_0x950fde[_0x3071('0x3a')]=qs[_0x3071('0x32')](_[_0x3071('0x3b')](_0x28792d['query'],_0x3fa3b8[_0x3071('0x32')]),_0x177b5f);if(_0x28792d[_0x3071('0x30')]['filter']){_0x950fde[_0x3071('0x3a')]=_['merge'](_0x950fde[_0x3071('0x3a')],{'$or':_[_0x3071('0x2b')](_0x177b5f,function(_0x5733e9){if(_0x5733e9['type']!==_0x3071('0x3c')){var _0x185f63={};_0x185f63[_0x5733e9[_0x3071('0x29')]]={'$like':'%'+_0x28792d['query'][_0x3071('0x3d')]+'%'};return _0x185f63;}})});}_0x950fde=_['merge']({},_0x950fde,_0x28792d[_0x3071('0x3e')]);var _0x4b7928={'where':_0x950fde[_0x3071('0x3a')]};return db[_0x3071('0x2c')][_0x3071('0x3f')](_0x4b7928)[_0x3071('0x25')](function(_0x30ab68){_0x25b96b['count']=_0x30ab68;if(_0x28792d['query'][_0x3071('0x40')]){_0x950fde[_0x3071('0x41')]=[{'all':!![]}];}return db[_0x3071('0x2c')][_0x3071('0x42')](_0x950fde);})['then'](function(_0x3cfc05){_0x25b96b[_0x3071('0x43')]=_0x3cfc05;return _0x25b96b;})[_0x3071('0x25')](respondWithFilteredResult(_0x163604,_0x950fde))[_0x3071('0x44')](handleError(_0x163604,null));};exports[_0x3071('0x45')]=function(_0xb9a4b8,_0x56a9d8){var _0x35a50d={'raw':!![],'where':{'id':_0xb9a4b8['params']['id']}},_0x596113={};_0x596113['model']=_['keys'](db[_0x3071('0x2c')][_0x3071('0x2d')]);_0x596113[_0x3071('0x30')]=_[_0x3071('0x31')](_0xb9a4b8[_0x3071('0x30')]);_0x596113[_0x3071('0x32')]=_[_0x3071('0x34')](_0x596113[_0x3071('0x2f')],_0x596113['query']);_0x35a50d[_0x3071('0x33')]=_[_0x3071('0x34')](_0x596113[_0x3071('0x2f')],qs[_0x3071('0x35')](_0xb9a4b8[_0x3071('0x30')]['fields']));_0x35a50d['attributes']=_0x35a50d[_0x3071('0x33')][_0x3071('0x36')]?_0x35a50d[_0x3071('0x33')]:_0x596113[_0x3071('0x2f')];if(_0xb9a4b8[_0x3071('0x30')]['includeAll']){_0x35a50d[_0x3071('0x41')]=[{'all':!![]}];}_0x35a50d=_['merge']({},_0x35a50d,_0xb9a4b8[_0x3071('0x3e')]);return db['SugarcrmField']['find'](_0x35a50d)[_0x3071('0x25')](handleEntityNotFound(_0x56a9d8,null))['then'](respondWithResult(_0x56a9d8,null))[_0x3071('0x44')](handleError(_0x56a9d8,null));};exports['create']=function(_0x717c43,_0x1d75e5){return db[_0x3071('0x2c')][_0x3071('0x46')](_0x717c43['body'],{})[_0x3071('0x25')](respondWithResult(_0x1d75e5,0xc9))['catch'](handleError(_0x1d75e5,null));};exports[_0x3071('0x24')]=function(_0x4b6bbb,_0x46924d){if(_0x4b6bbb[_0x3071('0x47')]['id']){delete _0x4b6bbb['body']['id'];}return db[_0x3071('0x2c')][_0x3071('0x48')]({'where':{'id':_0x4b6bbb[_0x3071('0x49')]['id']}})[_0x3071('0x25')](handleEntityNotFound(_0x46924d,null))[_0x3071('0x25')](saveUpdates(_0x4b6bbb[_0x3071('0x47')],null))[_0x3071('0x25')](respondWithResult(_0x46924d,null))['catch'](handleError(_0x46924d,null));};exports[_0x3071('0x26')]=function(_0x486b7a,_0x443b0e){return db[_0x3071('0x2c')]['find']({'where':{'id':_0x486b7a[_0x3071('0x49')]['id']}})[_0x3071('0x25')](handleEntityNotFound(_0x443b0e,null))[_0x3071('0x25')](removeEntity(_0x443b0e,null))[_0x3071('0x44')](handleError(_0x443b0e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 46f1195..25de365 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 _0xab47=['sugarcrm_unique_index','idField','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x1a05ee,_0x19c15e){var _0x4fabe9=function(_0x11f5f5){while(--_0x11f5f5){_0x1a05ee['push'](_0x1a05ee['shift']());}};_0x4fabe9(++_0x19c15e);}(_0xab47,0x6a));var _0x7ab4=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0xab47[_0x506d2f];return _0x101255;};'use strict';var _=require(_0x7ab4('0x0'));var util=require('util');var logger=require(_0x7ab4('0x1'))('api');var moment=require(_0x7ab4('0x2'));var BPromise=require(_0x7ab4('0x3'));var rp=require(_0x7ab4('0x4'));var fs=require('fs');var path=require(_0x7ab4('0x5'));var rimraf=require(_0x7ab4('0x6'));var config=require('../../config/environment');var attributes=require(_0x7ab4('0x7'));module['exports']=function(_0x5e79e0,_0x18a353){return _0x5e79e0[_0x7ab4('0x8')](_0x7ab4('0x9'),attributes,{'tableName':_0x7ab4('0xa'),'paranoid':![],'indexes':[{'name':_0x7ab4('0xb'),'fields':[_0x7ab4('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb48=['int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField'];(function(_0x1fa262,_0x511beb){var _0x273baa=function(_0xb82e3c){while(--_0xb82e3c){_0x1fa262['push'](_0x1fa262['shift']());}};_0x273baa(++_0x511beb);}(_0xeb48,0x1b6));var _0x8eb4=function(_0xd5900e,_0x40cd1b){_0xd5900e=_0xd5900e-0x0;var _0x3bae86=_0xeb48[_0xd5900e];return _0x3bae86;};'use strict';var _=require(_0x8eb4('0x0'));var util=require(_0x8eb4('0x1'));var logger=require(_0x8eb4('0x2'))('api');var moment=require(_0x8eb4('0x3'));var BPromise=require(_0x8eb4('0x4'));var rp=require(_0x8eb4('0x5'));var fs=require('fs');var path=require(_0x8eb4('0x6'));var rimraf=require(_0x8eb4('0x7'));var config=require(_0x8eb4('0x8'));var attributes=require(_0x8eb4('0x9'));module['exports']=function(_0x1565dd,_0x28f05c){return _0x1565dd[_0x8eb4('0xa')](_0x8eb4('0xb'),attributes,{'tableName':_0x8eb4('0xc'),'paranoid':![],'indexes':[{'name':_0x8eb4('0xd'),'fields':['idField',_0x8eb4('0xe')],'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 d1b0c7a..be41cdd 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 _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8603,0x190));var _0x3860=function(_0x4d1645,_0x5bd694){_0x4d1645=_0x4d1645-0x0;var _0x53b408=_0x8603[_0x4d1645];return _0x53b408;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file +var _0x0b0e=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug'];(function(_0x2b2c53,_0x4bcf9b){var _0x311ec2=function(_0x4a8e72){while(--_0x4a8e72){_0x2b2c53['push'](_0x2b2c53['shift']());}};_0x311ec2(++_0x4bcf9b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x211576,_0xcc41af){_0x211576=_0x211576-0x0;var _0x3ce235=_0x0b0e[_0x211576];return _0x3ce235;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f76d932..1ab81f4 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 _0x6fc4=['../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','express','../../components/interaction/service'];(function(_0x329ab4,_0xf5b6cf){var _0x12beda=function(_0x5f387a){while(--_0x5f387a){_0x329ab4['push'](_0x329ab4['shift']());}};_0x12beda(++_0xf5b6cf);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0x6fc4[_0x16938f];return _0x5c66e9;};'use strict';var multer=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x46fc('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x46fc('0x3'));var config=require(_0x46fc('0x4'));var controller=require(_0x46fc('0x5'));router[_0x46fc('0x6')]('/',auth[_0x46fc('0x7')](),controller[_0x46fc('0x8')]);router[_0x46fc('0x6')](_0x46fc('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x46fc('0x6')](_0x46fc('0xa'),auth[_0x46fc('0x7')](),controller[_0x46fc('0xb')]);router['get']('/:id/fields',auth[_0x46fc('0x7')](),controller[_0x46fc('0xc')]);router['post']('/',auth[_0x46fc('0x7')](),controller['create']);router[_0x46fc('0xd')](_0x46fc('0xa'),auth[_0x46fc('0x7')](),controller[_0x46fc('0xe')]);router[_0x46fc('0xf')](_0x46fc('0x9'),auth[_0x46fc('0x7')](),controller[_0x46fc('0x10')]);router[_0x46fc('0x11')](_0x46fc('0x9'),auth[_0x46fc('0x7')](),controller[_0x46fc('0x12')]);module[_0x46fc('0x13')]=router; \ No newline at end of file +var _0x475e=['post','create','put','update','delete','destroy','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations'];(function(_0x5a18c3,_0x5c6928){var _0x3e22e7=function(_0x1cc5a5){while(--_0x1cc5a5){_0x5a18c3['push'](_0x5a18c3['shift']());}};_0x3e22e7(++_0x5c6928);}(_0x475e,0x8b));var _0xe475=function(_0xf39d19,_0x53cccc){_0xf39d19=_0xf39d19-0x0;var _0x1c0da9=_0x475e[_0xf39d19];return _0x1c0da9;};'use strict';var multer=require(_0xe475('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe475('0x1'));var router=express['Router']();var fs_extra=require(_0xe475('0x2'));var auth=require(_0xe475('0x3'));var interaction=require(_0xe475('0x4'));var config=require(_0xe475('0x5'));var controller=require(_0xe475('0x6'));router[_0xe475('0x7')]('/',auth[_0xe475('0x8')](),controller['index']);router[_0xe475('0x7')](_0xe475('0x9'),auth['isAuthenticated'](),controller[_0xe475('0xa')]);router[_0xe475('0x7')](_0xe475('0xb'),auth['isAuthenticated'](),controller[_0xe475('0xc')]);router['get']('/:id/fields',auth[_0xe475('0x8')](),controller['getFields']);router[_0xe475('0xd')]('/',auth['isAuthenticated'](),controller[_0xe475('0xe')]);router[_0xe475('0xd')](_0xe475('0xb'),auth[_0xe475('0x8')](),controller['addConfiguration']);router[_0xe475('0xf')](_0xe475('0x9'),auth[_0xe475('0x8')](),controller[_0xe475('0x10')]);router[_0xe475('0x11')](_0xe475('0x9'),auth[_0xe475('0x8')](),controller[_0xe475('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 2f0f28c..75c966c 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 _0xf0c2=['STRING','HelpDesk','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf0c2,0x6e));var _0x2f0c=function(_0x1a151f,_0x3648c8){_0x1a151f=_0x1a151f-0x0;var _0x2a08c6=_0xf0c2[_0x1a151f];return _0x2a08c6;};'use strict';var Sequelize=require('sequelize');module[_0x2f0c('0x0')]={'name':{'type':Sequelize[_0x2f0c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2f0c('0x1')]},'username':{'type':Sequelize[_0x2f0c('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2f0c('0x1')],'allowNull':![],'defaultValue':_0x2f0c('0x2')},'remoteUri':{'type':Sequelize[_0x2f0c('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2f0c('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2f0c('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0b16=['STRING','sequelize'];(function(_0x2c9a31,_0x1bda71){var _0x2d9ad1=function(_0x4db493){while(--_0x4db493){_0x2c9a31['push'](_0x2c9a31['shift']());}};_0x2d9ad1(++_0x1bda71);}(_0x0b16,0x8f));var _0x60b1=function(_0x39d419,_0x1b8b3a){_0x39d419=_0x39d419-0x0;var _0x3275c2=_0x0b16[_0x39d419];return _0x3275c2;};'use strict';var Sequelize=require(_0x60b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x60b1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x60b1('0x1')]},'username':{'type':Sequelize[_0x60b1('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x60b1('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x60b1('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x60b1('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index e47860a..f40d4cc 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 _0x8c84=['type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','rows','params','keys','find','body','getConfigurations','findOne','filter','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','success','token','GET','describe','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','VtigerAccount','rawAttributes'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x8c84,0xc9));var _0x48c8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8c84[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x48c8('0x0'));var emlformat=require(_0x48c8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x48c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48c8('0x3'));var moment=require(_0x48c8('0x4'));var BPromise=require(_0x48c8('0x5'));var Mustache=require(_0x48c8('0x6'));var util=require(_0x48c8('0x7'));var path=require(_0x48c8('0x8'));var sox=require(_0x48c8('0x9'));var csv=require(_0x48c8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x48c8('0xb'));var _=require(_0x48c8('0xc'));var squel=require(_0x48c8('0xd'));var crypto=require('crypto');var jsforce=require(_0x48c8('0xe'));var deskjs=require(_0x48c8('0xf'));var toCsv=require(_0x48c8('0xa'));var querystring=require(_0x48c8('0x10'));var Papa=require(_0x48c8('0x11'));var Redis=require(_0x48c8('0x12'));var authService=require(_0x48c8('0x13'));var qs=require(_0x48c8('0x14'));var as=require(_0x48c8('0x15'));var hardwareService=require(_0x48c8('0x16'));var logger=require(_0x48c8('0x17'))('api');var utils=require(_0x48c8('0x18'));var config=require(_0x48c8('0x19'));var licenseUtil=require(_0x48c8('0x1a'));var db=require(_0x48c8('0x1b'))['db'];var integrations=require(_0x48c8('0x1c'));var jayson=require('jayson/promise');var client=jayson['client'][_0x48c8('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4b3bda,_0x4b8416,_0x5c567b,_0x389e70){return new BPromise(function(_0x2c217f,_0x2e2b76){var _0x3b0c3a=_0x389e70||client;return _0x3b0c3a[_0x48c8('0x1e')](_0x4b3bda,_0x5c567b)[_0x48c8('0x1f')](function(_0x39eb4a){logger[_0x48c8('0x20')](_0x48c8('0x21'),_0x4b8416,_0x48c8('0x22'));logger[_0x48c8('0x23')](_0x48c8('0x24'),_0x4b8416,_0x48c8('0x22'),JSON['stringify'](_0x39eb4a));if(_0x39eb4a[_0x48c8('0x25')]){if(_0x39eb4a['error'][_0x48c8('0x26')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4b8416,_0x39eb4a[_0x48c8('0x25')][_0x48c8('0x27')]);return _0x2e2b76(_0x39eb4a[_0x48c8('0x25')][_0x48c8('0x27')]);}logger[_0x48c8('0x25')](_0x48c8('0x21'),_0x4b8416,_0x39eb4a[_0x48c8('0x25')][_0x48c8('0x27')]);return _0x2c217f(_0x39eb4a[_0x48c8('0x25')][_0x48c8('0x27')]);}else{logger['info'](_0x48c8('0x21'),_0x4b8416,_0x48c8('0x22'));_0x2c217f(_0x39eb4a[_0x48c8('0x28')]['message']);}})[_0x48c8('0x29')](function(_0x3bec5d){logger[_0x48c8('0x25')](_0x48c8('0x21'),_0x4b8416,_0x3bec5d);_0x2e2b76(_0x3bec5d);});});}function respondWithStatusCode(_0xb66186,_0x3cf77b){_0x3cf77b=_0x3cf77b||0xcc;return function(_0x63533){if(_0x63533){return _0xb66186[_0x48c8('0x2a')](_0x3cf77b);}return _0xb66186[_0x48c8('0x2b')](_0x3cf77b)[_0x48c8('0x2c')]();};}function respondWithResult(_0x2e23e4,_0x4dd7c7){_0x4dd7c7=_0x4dd7c7||0xc8;return function(_0x176581){if(_0x176581){return _0x2e23e4['status'](_0x4dd7c7)[_0x48c8('0x2d')](_0x176581);}};}function respondWithFilteredResult(_0x4ed6b0,_0x584241){return function(_0x4d3074){if(_0x4d3074){var _0x4febe5=_0x4d3074[_0x48c8('0x2e')],_0x5d4d29=_0x584241['offset'],_0x25503b=_0x584241[_0x48c8('0x2f')]+_0x584241[_0x48c8('0x30')],_0x6e78a7;if(_0x25503b>=_0x4febe5){_0x25503b=_0x4febe5;_0x6e78a7=0xc8;}else{_0x6e78a7=0xce;}_0x4ed6b0[_0x48c8('0x2b')](_0x6e78a7);return _0x4ed6b0[_0x48c8('0x31')](_0x48c8('0x32'),_0x5d4d29+'-'+_0x25503b+'/'+_0x4febe5)[_0x48c8('0x2d')](_0x4d3074);}return null;};}function patchUpdates(_0x362f6d){return function(_0x326dba){try{jsonpatch[_0x48c8('0x33')](_0x326dba,_0x362f6d,!![]);}catch(_0x3483fb){return BPromise[_0x48c8('0x34')](_0x3483fb);}return _0x326dba[_0x48c8('0x35')]();};}function saveUpdates(_0x294ea3,_0x301eb3){return function(_0x174b5e){if(_0x174b5e){return _0x174b5e[_0x48c8('0x36')](_0x294ea3)[_0x48c8('0x1f')](function(_0x18b9d6){return _0x18b9d6;});}return null;};}function removeEntity(_0x5a04b7,_0x4a59b7){return function(_0x932a20){if(_0x932a20){return _0x932a20[_0x48c8('0x37')]()['then'](function(){_0x5a04b7[_0x48c8('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x527ed9,_0x59b3ed){return function(_0x38bcd5){if(!_0x38bcd5){_0x527ed9['sendStatus'](0x194);}return _0x38bcd5;};}function handleError(_0x5b5af2,_0x44c0cf){_0x44c0cf=_0x44c0cf||0x1f4;return function(_0x27b922){logger['error'](_0x27b922[_0x48c8('0x38')]);if(_0x27b922[_0x48c8('0x39')]){delete _0x27b922[_0x48c8('0x39')];}_0x5b5af2[_0x48c8('0x2b')](_0x44c0cf)[_0x48c8('0x3a')](_0x27b922);};}exports[_0x48c8('0x3b')]=function(_0x486f53,_0x2ce3b3){var _0x46d15c={},_0x525656={},_0x2f7393={'count':0x0,'rows':[]};var _0x5eab41=_[_0x48c8('0x3c')](db[_0x48c8('0x3d')][_0x48c8('0x3e')],function(_0x4876b3){return{'name':_0x4876b3['fieldName'],'type':_0x4876b3[_0x48c8('0x3f')][_0x48c8('0x40')]};});_0x525656[_0x48c8('0x41')]=_[_0x48c8('0x3c')](_0x5eab41,'name');_0x525656[_0x48c8('0x42')]=_['keys'](_0x486f53[_0x48c8('0x42')]);_0x525656[_0x48c8('0x43')]=_[_0x48c8('0x44')](_0x525656[_0x48c8('0x41')],_0x525656[_0x48c8('0x42')]);_0x46d15c[_0x48c8('0x45')]=_[_0x48c8('0x44')](_0x525656[_0x48c8('0x41')],qs[_0x48c8('0x46')](_0x486f53[_0x48c8('0x42')][_0x48c8('0x46')]));_0x46d15c[_0x48c8('0x45')]=_0x46d15c[_0x48c8('0x45')][_0x48c8('0x47')]?_0x46d15c[_0x48c8('0x45')]:_0x525656['model'];if(!_0x486f53[_0x48c8('0x42')]['hasOwnProperty'](_0x48c8('0x48'))){_0x46d15c[_0x48c8('0x30')]=qs[_0x48c8('0x30')](_0x486f53[_0x48c8('0x42')][_0x48c8('0x30')]);_0x46d15c['offset']=qs[_0x48c8('0x2f')](_0x486f53[_0x48c8('0x42')][_0x48c8('0x2f')]);}_0x46d15c[_0x48c8('0x49')]=qs[_0x48c8('0x4a')](_0x486f53[_0x48c8('0x42')][_0x48c8('0x4a')]);_0x46d15c[_0x48c8('0x4b')]=qs[_0x48c8('0x43')](_[_0x48c8('0x4c')](_0x486f53[_0x48c8('0x42')],_0x525656['filters']),_0x5eab41);if(_0x486f53['query']['filter']){_0x46d15c[_0x48c8('0x4b')]=_['merge'](_0x46d15c['where'],{'$or':_[_0x48c8('0x3c')](_0x5eab41,function(_0x17b847){if(_0x17b847[_0x48c8('0x3f')]!==_0x48c8('0x4d')){var _0x17af5b={};_0x17af5b[_0x17b847['name']]={'$like':'%'+_0x486f53[_0x48c8('0x42')]['filter']+'%'};return _0x17af5b;}})});}_0x46d15c=_[_0x48c8('0x4e')]({},_0x46d15c,_0x486f53[_0x48c8('0x4f')]);var _0x1a5206={'where':_0x46d15c[_0x48c8('0x4b')]};return db[_0x48c8('0x3d')]['count'](_0x1a5206)[_0x48c8('0x1f')](function(_0x448229){_0x2f7393[_0x48c8('0x2e')]=_0x448229;if(_0x486f53['query'][_0x48c8('0x50')]){_0x46d15c[_0x48c8('0x51')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x46d15c);})[_0x48c8('0x1f')](function(_0x357aab){_0x2f7393[_0x48c8('0x52')]=_0x357aab;return _0x2f7393;})[_0x48c8('0x1f')](respondWithFilteredResult(_0x2ce3b3,_0x46d15c))[_0x48c8('0x29')](handleError(_0x2ce3b3,null));};exports['show']=function(_0x559cac,_0x36a82d){var _0x7d0e5f={'raw':![],'where':{'id':_0x559cac[_0x48c8('0x53')]['id']}},_0xb4bd55={};_0xb4bd55['model']=_[_0x48c8('0x54')](db['VtigerAccount'][_0x48c8('0x3e')]);_0xb4bd55[_0x48c8('0x42')]=_['keys'](_0x559cac[_0x48c8('0x42')]);_0xb4bd55[_0x48c8('0x43')]=_['intersection'](_0xb4bd55[_0x48c8('0x41')],_0xb4bd55[_0x48c8('0x42')]);_0x7d0e5f['attributes']=_['intersection'](_0xb4bd55['model'],qs[_0x48c8('0x46')](_0x559cac['query'][_0x48c8('0x46')]));_0x7d0e5f[_0x48c8('0x45')]=_0x7d0e5f[_0x48c8('0x45')][_0x48c8('0x47')]?_0x7d0e5f[_0x48c8('0x45')]:_0xb4bd55['model'];if(_0x559cac[_0x48c8('0x42')][_0x48c8('0x50')]){_0x7d0e5f['include']=[{'all':!![]}];}_0x7d0e5f=_[_0x48c8('0x4e')]({},_0x7d0e5f,_0x559cac[_0x48c8('0x4f')]);return db[_0x48c8('0x3d')][_0x48c8('0x55')](_0x7d0e5f)[_0x48c8('0x1f')](handleEntityNotFound(_0x36a82d,null))[_0x48c8('0x1f')](respondWithResult(_0x36a82d,null))[_0x48c8('0x29')](handleError(_0x36a82d,null));};exports['create']=function(_0x4796cd,_0xba33d7){return db[_0x48c8('0x3d')]['create'](_0x4796cd['body'],{})[_0x48c8('0x1f')](respondWithResult(_0xba33d7,0xc9))[_0x48c8('0x29')](handleError(_0xba33d7,null));};exports[_0x48c8('0x36')]=function(_0x1bf79,_0x523b84){if(_0x1bf79['body']['id']){delete _0x1bf79[_0x48c8('0x56')]['id'];}return db['VtigerAccount'][_0x48c8('0x55')]({'where':{'id':_0x1bf79[_0x48c8('0x53')]['id']}})[_0x48c8('0x1f')](handleEntityNotFound(_0x523b84,null))[_0x48c8('0x1f')](saveUpdates(_0x1bf79[_0x48c8('0x56')],null))[_0x48c8('0x1f')](respondWithResult(_0x523b84,null))['catch'](handleError(_0x523b84,null));};exports['destroy']=function(_0x12b1e0,_0x24fdd6){return db['VtigerAccount'][_0x48c8('0x55')]({'where':{'id':_0x12b1e0[_0x48c8('0x53')]['id']}})[_0x48c8('0x1f')](handleEntityNotFound(_0x24fdd6,null))[_0x48c8('0x1f')](removeEntity(_0x24fdd6,null))[_0x48c8('0x29')](handleError(_0x24fdd6,null));};exports[_0x48c8('0x57')]=function(_0xcf92b1,_0x159038,_0x5eb5e2){var _0x50f873={};var _0x3cacee={};var _0x1386a5;var _0x487d3d;return db[_0x48c8('0x3d')][_0x48c8('0x58')]({'where':{'id':_0xcf92b1['params']['id']}})['then'](handleEntityNotFound(_0x159038,null))[_0x48c8('0x1f')](function(_0x5e2f06){if(_0x5e2f06){_0x1386a5=_0x5e2f06;_0x3cacee['model']=_[_0x48c8('0x54')](db['VtigerConfiguration'][_0x48c8('0x3e')]);_0x3cacee[_0x48c8('0x42')]=_[_0x48c8('0x54')](_0xcf92b1[_0x48c8('0x42')]);_0x3cacee[_0x48c8('0x43')]=_[_0x48c8('0x44')](_0x3cacee[_0x48c8('0x41')],_0x3cacee[_0x48c8('0x42')]);_0x50f873[_0x48c8('0x45')]=_[_0x48c8('0x44')](_0x3cacee[_0x48c8('0x41')],qs[_0x48c8('0x46')](_0xcf92b1[_0x48c8('0x42')][_0x48c8('0x46')]));_0x50f873[_0x48c8('0x45')]=_0x50f873[_0x48c8('0x45')]['length']?_0x50f873['attributes']:_0x3cacee[_0x48c8('0x41')];_0x50f873[_0x48c8('0x49')]=qs[_0x48c8('0x4a')](_0xcf92b1[_0x48c8('0x42')][_0x48c8('0x4a')]);_0x50f873[_0x48c8('0x4b')]=qs[_0x48c8('0x43')](_[_0x48c8('0x4c')](_0xcf92b1[_0x48c8('0x42')],_0x3cacee[_0x48c8('0x43')]));if(_0xcf92b1['query'][_0x48c8('0x59')]){_0x50f873[_0x48c8('0x4b')]=_[_0x48c8('0x4e')](_0x50f873[_0x48c8('0x4b')],{'$or':_[_0x48c8('0x3c')](_0x50f873[_0x48c8('0x45')],function(_0x13a2b4){var _0x9355c3={};_0x9355c3[_0x13a2b4]={'$like':'%'+_0xcf92b1[_0x48c8('0x42')][_0x48c8('0x59')]+'%'};return _0x9355c3;})});}_0x50f873=_['merge']({},_0x50f873,_0xcf92b1[_0x48c8('0x4f')]);return _0x1386a5[_0x48c8('0x57')](_0x50f873);}})[_0x48c8('0x1f')](function(_0x3dff26){if(_0x3dff26){_0x487d3d=_0x3dff26[_0x48c8('0x47')];if(!_0xcf92b1[_0x48c8('0x42')][_0x48c8('0x5a')](_0x48c8('0x48'))){_0x50f873[_0x48c8('0x30')]=qs[_0x48c8('0x30')](_0xcf92b1['query'][_0x48c8('0x30')]);_0x50f873[_0x48c8('0x2f')]=qs[_0x48c8('0x2f')](_0xcf92b1[_0x48c8('0x42')][_0x48c8('0x2f')]);}return _0x1386a5[_0x48c8('0x57')](_0x50f873);}})[_0x48c8('0x1f')](function(_0x5cc11b){if(_0x5cc11b){return _0x5cc11b?{'count':_0x487d3d,'rows':_0x5cc11b}:null;}})[_0x48c8('0x1f')](respondWithResult(_0x159038,null))[_0x48c8('0x29')](handleError(_0x159038,null));};exports[_0x48c8('0x5b')]=function(_0x4a468d,_0x3772f1,_0x2ce917){if(_0x4a468d[_0x48c8('0x56')]['id']){delete _0x4a468d[_0x48c8('0x56')]['id'];}return db[_0x48c8('0x3d')][_0x48c8('0x58')]({'where':{'id':_0x4a468d[_0x48c8('0x53')]['id']}})[_0x48c8('0x1f')](handleEntityNotFound(_0x3772f1,null))[_0x48c8('0x1f')](function(_0x4b0b35){if(_0x4b0b35){_0x4a468d[_0x48c8('0x56')][_0x48c8('0x5c')]=_0x4b0b35['id'];_0x4a468d[_0x48c8('0x56')][_0x48c8('0x5d')]=integrations[_0x48c8('0x5e')](_0x4a468d['body'][_0x48c8('0x5f')],_0x4a468d[_0x48c8('0x56')][_0x48c8('0x3f')]);_0x4a468d[_0x48c8('0x56')][_0x48c8('0x60')]=integrations[_0x48c8('0x61')](_0x4a468d['body'][_0x48c8('0x5f')],_0x4a468d[_0x48c8('0x56')][_0x48c8('0x3f')]);return db['VtigerConfiguration']['create'](_0x4a468d[_0x48c8('0x56')],{'include':[{'model':db[_0x48c8('0x62')],'as':_0x48c8('0x5d')},{'model':db[_0x48c8('0x62')],'as':_0x48c8('0x60')}]});}return null;})['then'](respondWithResult(_0x3772f1,null))[_0x48c8('0x29')](handleError(_0x3772f1,null));};var md5=require('md5');exports[_0x48c8('0x63')]=function(_0x3d8a9c,_0x252601,_0x1f3996){var _0x24f3ec=null;var _0x3c532f=null;var _0x36b958=null;var _0x5ad2eb=null;var _0x1e1b7a='';return db['VtigerAccount']['findOne']({'where':{'id':_0x3d8a9c[_0x48c8('0x53')]['id']},'attributes':['id','name',_0x48c8('0x64'),_0x48c8('0x65'),_0x48c8('0x66'),_0x48c8('0x67'),_0x48c8('0x68'),_0x48c8('0x69')]})[_0x48c8('0x1f')](handleEntityNotFound(_0x252601,null))[_0x48c8('0x1f')](function(_0x3e1f04){if(_0x3e1f04){_0x24f3ec=_0x3e1f04[_0x48c8('0x64')];_0x3c532f=_0x3e1f04[_0x48c8('0x69')];_0x36b958=_0x3e1f04['moduleName'];_0x1e1b7a=_0x3e1f04[_0x48c8('0x67')];var _0x4a3964=_0x1e1b7a['slice'](-0x1);if(_0x4a3964==='/'){_0x1e1b7a=_0x1e1b7a[_0x48c8('0x6a')](0x0,_0x1e1b7a[_0x48c8('0x6b')](_0x4a3964));}_0x5ad2eb=util[_0x48c8('0x6c')](_0x48c8('0x6d'),_0x1e1b7a);var _0x299f5b={'method':'GET','uri':_0x5ad2eb,'qs':{'operation':'getchallenge','username':_0x3e1f04[_0x48c8('0x64')]},'json':!![]};return rp(_0x299f5b);}})['then'](function(_0x424a22){if(_0x424a22[_0x48c8('0x6e')]){var _0x4c9b34={'method':'POST','uri':_0x5ad2eb,'form':{'operation':'login','username':_0x24f3ec,'accessKey':md5(_0x424a22[_0x48c8('0x28')][_0x48c8('0x6f')]+_0x3c532f)},'json':!![]};return rp(_0x4c9b34);}})['then'](function(_0x3d3144){if(_0x3d3144[_0x48c8('0x6e')]){var _0x2cf30c={'method':_0x48c8('0x70'),'uri':_0x5ad2eb,'qs':{'operation':_0x48c8('0x71'),'username':_0x24f3ec,'sessionName':_0x3d3144[_0x48c8('0x28')]['sessionName'],'elementType':_0x36b958},'json':!![]};return rp(_0x2cf30c);}})['then'](function(_0x5cfac8){if(_0x5cfac8['success']){var _0x3e51f4=['autogenerated',_0x48c8('0x72'),_0x48c8('0x73')];_[_0x48c8('0x74')](_0x5cfac8['result'][_0x48c8('0x46')],function(_0xda64e9){return _0x3e51f4[_0x48c8('0x75')](_0xda64e9['type'][_0x48c8('0x39')]);});_[_0x48c8('0x74')](_0x5cfac8[_0x48c8('0x28')]['fields'],function(_0x4fd36b){return _0x4fd36b[_0x48c8('0x76')]===_0x48c8('0x77');});return{'count':_0x5cfac8[_0x48c8('0x28')][_0x48c8('0x46')]['length'],'rows':_[_0x48c8('0x3c')](_0x5cfac8['result'][_0x48c8('0x46')],function(_0x2796e9){return{'id':_0x2796e9['name'],'name':_0x2796e9[_0x48c8('0x78')],'custom':_[_0x48c8('0x79')](_0x2796e9[_0x48c8('0x39')],_0x48c8('0x7a'))?!![]:![],'options':_0x2796e9[_0x48c8('0x3f')][_0x48c8('0x39')]===_0x48c8('0x7b')&&_0x2796e9[_0x48c8('0x3f')][_0x48c8('0x7c')]['length']>0x0?_[_0x48c8('0x3c')](_0x2796e9['type'][_0x48c8('0x7c')],function(_0xe1a472){return{'name':_0xe1a472['label'],'value':_0xe1a472[_0x48c8('0x7d')]};}):[]};})};}})[_0x48c8('0x1f')](respondWithResult(_0x252601,null))['catch'](function(_0x1568c6){console[_0x48c8('0x7e')]('vTiger\x20error:\x20'+_0x1568c6);var _0x24a736=_0x3d8a9c[_0x48c8('0x42')][_0x48c8('0x7f')]?0x1f4:_0x1568c6[_0x48c8('0x80')]||0x1f4;logger['error'](_0x48c8('0x81'),_0x48c8('0x63'),_0x24a736,JSON[_0x48c8('0x82')](_0x1568c6));delete _0x1568c6[_0x48c8('0x39')];if(_0x24a736===0x191){_0x24a736=0x190;}_0x252601[_0x48c8('0x2b')](_0x24a736)['send'](_0x3d8a9c[_0x48c8('0x42')]['test']?{'message':_0x48c8('0x83'),'statusCode':_0x1568c6[_0x48c8('0x80')]}:_0x1568c6);});}; \ No newline at end of file +var _0x18dd=['path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','getConfigurations','findOne','VtigerConfiguration','order','addConfiguration','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','describe','sessionName','reference','owner','remove','includes','false','label','startsWith','picklist','picklistValues','test','statusCode','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x2df387,_0x1d3ea1){var _0x3b1708=function(_0x49c05b){while(--_0x49c05b){_0x2df387['push'](_0x2df387['shift']());}};_0x3b1708(++_0x1d3ea1);}(_0x18dd,0x7a));var _0xd18d=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x18dd[_0x465a0c];return _0x1e202e;};'use strict';var pdf=require(_0xd18d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd18d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd18d('0x2'));var rp=require(_0xd18d('0x3'));var moment=require(_0xd18d('0x4'));var BPromise=require(_0xd18d('0x5'));var Mustache=require(_0xd18d('0x6'));var util=require(_0xd18d('0x7'));var path=require(_0xd18d('0x8'));var sox=require(_0xd18d('0x9'));var csv=require(_0xd18d('0xa'));var ejs=require(_0xd18d('0xb'));var fs=require('fs');var fs_extra=require(_0xd18d('0xc'));var _=require('lodash');var squel=require(_0xd18d('0xd'));var crypto=require('crypto');var jsforce=require(_0xd18d('0xe'));var deskjs=require(_0xd18d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd18d('0x10'));var Papa=require('papaparse');var Redis=require(_0xd18d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd18d('0x12'));var as=require(_0xd18d('0x13'));var hardwareService=require(_0xd18d('0x14'));var logger=require(_0xd18d('0x15'))(_0xd18d('0x16'));var utils=require(_0xd18d('0x17'));var config=require(_0xd18d('0x18'));var licenseUtil=require(_0xd18d('0x19'));var db=require(_0xd18d('0x1a'))['db'];var integrations=require(_0xd18d('0x1b'));var jayson=require(_0xd18d('0x1c'));var client=jayson['client'][_0xd18d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x518030,_0x194073,_0x4072e0,_0x484ec3){return new BPromise(function(_0x1c2cdf,_0x5631e2){var _0x2ca642=_0x484ec3||client;return _0x2ca642[_0xd18d('0x1e')](_0x518030,_0x4072e0)[_0xd18d('0x1f')](function(_0x43bbf3){logger[_0xd18d('0x20')](_0xd18d('0x21'),_0x194073,_0xd18d('0x22'));logger[_0xd18d('0x23')](_0xd18d('0x24'),_0x194073,_0xd18d('0x22'),JSON[_0xd18d('0x25')](_0x43bbf3));if(_0x43bbf3[_0xd18d('0x26')]){if(_0x43bbf3['error'][_0xd18d('0x27')]===0x1f4){logger[_0xd18d('0x26')]('VtigerAccount,\x20%s,\x20%s',_0x194073,_0x43bbf3['error'][_0xd18d('0x28')]);return _0x5631e2(_0x43bbf3['error'][_0xd18d('0x28')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x194073,_0x43bbf3[_0xd18d('0x26')][_0xd18d('0x28')]);return _0x1c2cdf(_0x43bbf3[_0xd18d('0x26')][_0xd18d('0x28')]);}else{logger[_0xd18d('0x20')](_0xd18d('0x21'),_0x194073,_0xd18d('0x22'));_0x1c2cdf(_0x43bbf3[_0xd18d('0x29')][_0xd18d('0x28')]);}})[_0xd18d('0x2a')](function(_0x2589a0){logger[_0xd18d('0x26')](_0xd18d('0x21'),_0x194073,_0x2589a0);_0x5631e2(_0x2589a0);});});}function respondWithStatusCode(_0x5f3da5,_0x484038){_0x484038=_0x484038||0xcc;return function(_0x43c41e){if(_0x43c41e){return _0x5f3da5['sendStatus'](_0x484038);}return _0x5f3da5['status'](_0x484038)[_0xd18d('0x2b')]();};}function respondWithResult(_0x5727f1,_0x877701){_0x877701=_0x877701||0xc8;return function(_0x53a2f2){if(_0x53a2f2){return _0x5727f1[_0xd18d('0x2c')](_0x877701)[_0xd18d('0x2d')](_0x53a2f2);}};}function respondWithFilteredResult(_0x21a232,_0x4fbc92){return function(_0x210412){if(_0x210412){var _0x4eb625=_0x210412[_0xd18d('0x2e')],_0x3fe2cd=_0x4fbc92['offset'],_0x4e8bd3=_0x4fbc92[_0xd18d('0x2f')]+_0x4fbc92[_0xd18d('0x30')],_0xffba68;if(_0x4e8bd3>=_0x4eb625){_0x4e8bd3=_0x4eb625;_0xffba68=0xc8;}else{_0xffba68=0xce;}_0x21a232[_0xd18d('0x2c')](_0xffba68);return _0x21a232['set']('Content-Range',_0x3fe2cd+'-'+_0x4e8bd3+'/'+_0x4eb625)['json'](_0x210412);}return null;};}function patchUpdates(_0xe85b86){return function(_0x2cf12e){try{jsonpatch[_0xd18d('0x31')](_0x2cf12e,_0xe85b86,!![]);}catch(_0x3e677b){return BPromise[_0xd18d('0x32')](_0x3e677b);}return _0x2cf12e[_0xd18d('0x33')]();};}function saveUpdates(_0x248b3c,_0x1740b0){return function(_0x54943a){if(_0x54943a){return _0x54943a[_0xd18d('0x34')](_0x248b3c)[_0xd18d('0x1f')](function(_0x463e2d){return _0x463e2d;});}return null;};}function removeEntity(_0x3a325d,_0x497d49){return function(_0x157531){if(_0x157531){return _0x157531[_0xd18d('0x35')]()[_0xd18d('0x1f')](function(){_0x3a325d[_0xd18d('0x2c')](0xcc)[_0xd18d('0x2b')]();});}};}function handleEntityNotFound(_0x481143,_0x55860d){return function(_0x28b9c5){if(!_0x28b9c5){_0x481143[_0xd18d('0x36')](0x194);}return _0x28b9c5;};}function handleError(_0x1077e6,_0x19385d){_0x19385d=_0x19385d||0x1f4;return function(_0x16381e){logger[_0xd18d('0x26')](_0x16381e[_0xd18d('0x37')]);if(_0x16381e[_0xd18d('0x38')]){delete _0x16381e[_0xd18d('0x38')];}_0x1077e6[_0xd18d('0x2c')](_0x19385d)[_0xd18d('0x39')](_0x16381e);};}exports[_0xd18d('0x3a')]=function(_0x1cabff,_0x24405e){var _0x7dc289={},_0x59abae={},_0x45efeb={'count':0x0,'rows':[]};var _0x59b463=_[_0xd18d('0x3b')](db[_0xd18d('0x3c')][_0xd18d('0x3d')],function(_0x5de70b){return{'name':_0x5de70b[_0xd18d('0x3e')],'type':_0x5de70b[_0xd18d('0x3f')][_0xd18d('0x40')]};});_0x59abae[_0xd18d('0x41')]=_['map'](_0x59b463,_0xd18d('0x38'));_0x59abae[_0xd18d('0x42')]=_[_0xd18d('0x43')](_0x1cabff['query']);_0x59abae[_0xd18d('0x44')]=_[_0xd18d('0x45')](_0x59abae['model'],_0x59abae[_0xd18d('0x42')]);_0x7dc289[_0xd18d('0x46')]=_['intersection'](_0x59abae[_0xd18d('0x41')],qs[_0xd18d('0x47')](_0x1cabff[_0xd18d('0x42')][_0xd18d('0x47')]));_0x7dc289['attributes']=_0x7dc289['attributes'][_0xd18d('0x48')]?_0x7dc289['attributes']:_0x59abae[_0xd18d('0x41')];if(!_0x1cabff[_0xd18d('0x42')]['hasOwnProperty'](_0xd18d('0x49'))){_0x7dc289['limit']=qs['limit'](_0x1cabff[_0xd18d('0x42')]['limit']);_0x7dc289[_0xd18d('0x2f')]=qs['offset'](_0x1cabff['query'][_0xd18d('0x2f')]);}_0x7dc289['order']=qs[_0xd18d('0x4a')](_0x1cabff[_0xd18d('0x42')][_0xd18d('0x4a')]);_0x7dc289[_0xd18d('0x4b')]=qs['filters'](_[_0xd18d('0x4c')](_0x1cabff['query'],_0x59abae[_0xd18d('0x44')]),_0x59b463);if(_0x1cabff[_0xd18d('0x42')][_0xd18d('0x4d')]){_0x7dc289[_0xd18d('0x4b')]=_[_0xd18d('0x4e')](_0x7dc289[_0xd18d('0x4b')],{'$or':_[_0xd18d('0x3b')](_0x59b463,function(_0x225c7b){if(_0x225c7b[_0xd18d('0x3f')]!=='VIRTUAL'){var _0xe94ab5={};_0xe94ab5[_0x225c7b['name']]={'$like':'%'+_0x1cabff[_0xd18d('0x42')][_0xd18d('0x4d')]+'%'};return _0xe94ab5;}})});}_0x7dc289=_[_0xd18d('0x4e')]({},_0x7dc289,_0x1cabff[_0xd18d('0x4f')]);var _0x53e6ed={'where':_0x7dc289[_0xd18d('0x4b')]};return db[_0xd18d('0x3c')]['count'](_0x53e6ed)['then'](function(_0x237b1b){_0x45efeb[_0xd18d('0x2e')]=_0x237b1b;if(_0x1cabff[_0xd18d('0x42')][_0xd18d('0x50')]){_0x7dc289['include']=[{'all':!![]}];}return db[_0xd18d('0x3c')][_0xd18d('0x51')](_0x7dc289);})['then'](function(_0x3abb46){_0x45efeb[_0xd18d('0x52')]=_0x3abb46;return _0x45efeb;})[_0xd18d('0x1f')](respondWithFilteredResult(_0x24405e,_0x7dc289))[_0xd18d('0x2a')](handleError(_0x24405e,null));};exports[_0xd18d('0x53')]=function(_0x3cb047,_0x4303a4){var _0x1df878={'raw':![],'where':{'id':_0x3cb047[_0xd18d('0x54')]['id']}},_0x4dfd5d={};_0x4dfd5d[_0xd18d('0x41')]=_[_0xd18d('0x43')](db[_0xd18d('0x3c')][_0xd18d('0x3d')]);_0x4dfd5d[_0xd18d('0x42')]=_[_0xd18d('0x43')](_0x3cb047[_0xd18d('0x42')]);_0x4dfd5d[_0xd18d('0x44')]=_[_0xd18d('0x45')](_0x4dfd5d['model'],_0x4dfd5d[_0xd18d('0x42')]);_0x1df878[_0xd18d('0x46')]=_[_0xd18d('0x45')](_0x4dfd5d[_0xd18d('0x41')],qs[_0xd18d('0x47')](_0x3cb047[_0xd18d('0x42')]['fields']));_0x1df878['attributes']=_0x1df878['attributes']['length']?_0x1df878[_0xd18d('0x46')]:_0x4dfd5d['model'];if(_0x3cb047[_0xd18d('0x42')][_0xd18d('0x50')]){_0x1df878[_0xd18d('0x55')]=[{'all':!![]}];}_0x1df878=_[_0xd18d('0x4e')]({},_0x1df878,_0x3cb047[_0xd18d('0x4f')]);return db[_0xd18d('0x3c')][_0xd18d('0x56')](_0x1df878)[_0xd18d('0x1f')](handleEntityNotFound(_0x4303a4,null))[_0xd18d('0x1f')](respondWithResult(_0x4303a4,null))['catch'](handleError(_0x4303a4,null));};exports[_0xd18d('0x57')]=function(_0x29c660,_0x1bac2e){return db['VtigerAccount'][_0xd18d('0x57')](_0x29c660[_0xd18d('0x58')],{})[_0xd18d('0x1f')](respondWithResult(_0x1bac2e,0xc9))['catch'](handleError(_0x1bac2e,null));};exports[_0xd18d('0x34')]=function(_0x21b0e4,_0x3f8819){if(_0x21b0e4['body']['id']){delete _0x21b0e4[_0xd18d('0x58')]['id'];}return db[_0xd18d('0x3c')]['find']({'where':{'id':_0x21b0e4[_0xd18d('0x54')]['id']}})['then'](handleEntityNotFound(_0x3f8819,null))['then'](saveUpdates(_0x21b0e4[_0xd18d('0x58')],null))[_0xd18d('0x1f')](respondWithResult(_0x3f8819,null))[_0xd18d('0x2a')](handleError(_0x3f8819,null));};exports[_0xd18d('0x35')]=function(_0x18efc6,_0xa4f7e5){return db['VtigerAccount']['find']({'where':{'id':_0x18efc6[_0xd18d('0x54')]['id']}})['then'](handleEntityNotFound(_0xa4f7e5,null))[_0xd18d('0x1f')](removeEntity(_0xa4f7e5,null))[_0xd18d('0x2a')](handleError(_0xa4f7e5,null));};exports[_0xd18d('0x59')]=function(_0x17ea5c,_0x1505bf,_0x5ba98b){var _0x25ffa4={};var _0x27aa05={};var _0x450321;var _0x483e48;return db['VtigerAccount'][_0xd18d('0x5a')]({'where':{'id':_0x17ea5c['params']['id']}})['then'](handleEntityNotFound(_0x1505bf,null))[_0xd18d('0x1f')](function(_0x2437c2){if(_0x2437c2){_0x450321=_0x2437c2;_0x27aa05[_0xd18d('0x41')]=_[_0xd18d('0x43')](db[_0xd18d('0x5b')][_0xd18d('0x3d')]);_0x27aa05[_0xd18d('0x42')]=_['keys'](_0x17ea5c[_0xd18d('0x42')]);_0x27aa05['filters']=_[_0xd18d('0x45')](_0x27aa05['model'],_0x27aa05[_0xd18d('0x42')]);_0x25ffa4[_0xd18d('0x46')]=_[_0xd18d('0x45')](_0x27aa05[_0xd18d('0x41')],qs[_0xd18d('0x47')](_0x17ea5c[_0xd18d('0x42')]['fields']));_0x25ffa4[_0xd18d('0x46')]=_0x25ffa4['attributes'][_0xd18d('0x48')]?_0x25ffa4[_0xd18d('0x46')]:_0x27aa05['model'];_0x25ffa4[_0xd18d('0x5c')]=qs[_0xd18d('0x4a')](_0x17ea5c[_0xd18d('0x42')][_0xd18d('0x4a')]);_0x25ffa4['where']=qs[_0xd18d('0x44')](_[_0xd18d('0x4c')](_0x17ea5c['query'],_0x27aa05[_0xd18d('0x44')]));if(_0x17ea5c['query']['filter']){_0x25ffa4['where']=_[_0xd18d('0x4e')](_0x25ffa4['where'],{'$or':_['map'](_0x25ffa4['attributes'],function(_0x4f9fbf){var _0x101b83={};_0x101b83[_0x4f9fbf]={'$like':'%'+_0x17ea5c[_0xd18d('0x42')]['filter']+'%'};return _0x101b83;})});}_0x25ffa4=_[_0xd18d('0x4e')]({},_0x25ffa4,_0x17ea5c[_0xd18d('0x4f')]);return _0x450321[_0xd18d('0x59')](_0x25ffa4);}})[_0xd18d('0x1f')](function(_0x1eda8e){if(_0x1eda8e){_0x483e48=_0x1eda8e[_0xd18d('0x48')];if(!_0x17ea5c[_0xd18d('0x42')]['hasOwnProperty'](_0xd18d('0x49'))){_0x25ffa4['limit']=qs['limit'](_0x17ea5c[_0xd18d('0x42')][_0xd18d('0x30')]);_0x25ffa4[_0xd18d('0x2f')]=qs['offset'](_0x17ea5c[_0xd18d('0x42')][_0xd18d('0x2f')]);}return _0x450321['getConfigurations'](_0x25ffa4);}})[_0xd18d('0x1f')](function(_0x5194aa){if(_0x5194aa){return _0x5194aa?{'count':_0x483e48,'rows':_0x5194aa}:null;}})[_0xd18d('0x1f')](respondWithResult(_0x1505bf,null))[_0xd18d('0x2a')](handleError(_0x1505bf,null));};exports[_0xd18d('0x5d')]=function(_0x137e9b,_0x14e782,_0x214090){if(_0x137e9b[_0xd18d('0x58')]['id']){delete _0x137e9b[_0xd18d('0x58')]['id'];}return db[_0xd18d('0x3c')]['findOne']({'where':{'id':_0x137e9b[_0xd18d('0x54')]['id']}})[_0xd18d('0x1f')](handleEntityNotFound(_0x14e782,null))['then'](function(_0x2d5f69){if(_0x2d5f69){_0x137e9b[_0xd18d('0x58')]['AccountId']=_0x2d5f69['id'];_0x137e9b[_0xd18d('0x58')][_0xd18d('0x5e')]=integrations[_0xd18d('0x5f')](_0x137e9b[_0xd18d('0x58')][_0xd18d('0x60')],_0x137e9b['body'][_0xd18d('0x3f')]);_0x137e9b[_0xd18d('0x58')][_0xd18d('0x61')]=integrations['getDescriptions'](_0x137e9b[_0xd18d('0x58')][_0xd18d('0x60')],_0x137e9b[_0xd18d('0x58')]['type']);return db[_0xd18d('0x5b')][_0xd18d('0x57')](_0x137e9b[_0xd18d('0x58')],{'include':[{'model':db['VtigerField'],'as':_0xd18d('0x5e')},{'model':db[_0xd18d('0x62')],'as':_0xd18d('0x61')}]});}return null;})[_0xd18d('0x1f')](respondWithResult(_0x14e782,null))[_0xd18d('0x2a')](handleError(_0x14e782,null));};var md5=require(_0xd18d('0x63'));exports[_0xd18d('0x64')]=function(_0x263a08,_0x29d8cb,_0x21cd8e){var _0x576658=null;var _0xa67633=null;var _0x4af933=null;var _0x402448=null;var _0x2d6666='';return db['VtigerAccount'][_0xd18d('0x5a')]({'where':{'id':_0x263a08[_0xd18d('0x54')]['id']},'attributes':['id',_0xd18d('0x38'),_0xd18d('0x65'),_0xd18d('0x66'),_0xd18d('0x67'),_0xd18d('0x68'),_0xd18d('0x69'),_0xd18d('0x6a')]})[_0xd18d('0x1f')](handleEntityNotFound(_0x29d8cb,null))[_0xd18d('0x1f')](function(_0x58335e){if(_0x58335e){_0x576658=_0x58335e[_0xd18d('0x65')];_0xa67633=_0x58335e[_0xd18d('0x6a')];_0x4af933=_0x58335e[_0xd18d('0x67')];_0x2d6666=_0x58335e[_0xd18d('0x68')];var _0x2ecb2e=_0x2d6666[_0xd18d('0x6b')](-0x1);if(_0x2ecb2e==='/'){_0x2d6666=_0x2d6666[_0xd18d('0x6c')](0x0,_0x2d6666[_0xd18d('0x6d')](_0x2ecb2e));}_0x402448=util[_0xd18d('0x6e')](_0xd18d('0x6f'),_0x2d6666);var _0x17aa66={'method':_0xd18d('0x70'),'uri':_0x402448,'qs':{'operation':_0xd18d('0x71'),'username':_0x58335e[_0xd18d('0x65')]},'json':!![]};return rp(_0x17aa66);}})[_0xd18d('0x1f')](function(_0x3d8e73){if(_0x3d8e73[_0xd18d('0x72')]){var _0x2176a7={'method':'POST','uri':_0x402448,'form':{'operation':_0xd18d('0x73'),'username':_0x576658,'accessKey':md5(_0x3d8e73[_0xd18d('0x29')]['token']+_0xa67633)},'json':!![]};return rp(_0x2176a7);}})['then'](function(_0x48e552){if(_0x48e552['success']){var _0x421329={'method':'GET','uri':_0x402448,'qs':{'operation':_0xd18d('0x74'),'username':_0x576658,'sessionName':_0x48e552[_0xd18d('0x29')][_0xd18d('0x75')],'elementType':_0x4af933},'json':!![]};return rp(_0x421329);}})['then'](function(_0x2c5952){if(_0x2c5952[_0xd18d('0x72')]){var _0x1c71b6=['autogenerated',_0xd18d('0x76'),_0xd18d('0x77')];_[_0xd18d('0x78')](_0x2c5952[_0xd18d('0x29')]['fields'],function(_0x58ebc3){return _0x1c71b6[_0xd18d('0x79')](_0x58ebc3[_0xd18d('0x3f')][_0xd18d('0x38')]);});_['remove'](_0x2c5952['result']['fields'],function(_0x483b0f){return _0x483b0f['editable']===_0xd18d('0x7a');});return{'count':_0x2c5952[_0xd18d('0x29')][_0xd18d('0x47')][_0xd18d('0x48')],'rows':_[_0xd18d('0x3b')](_0x2c5952['result'][_0xd18d('0x47')],function(_0x31a91e){return{'id':_0x31a91e[_0xd18d('0x38')],'name':_0x31a91e[_0xd18d('0x7b')],'custom':_[_0xd18d('0x7c')](_0x31a91e[_0xd18d('0x38')],'cf_')?!![]:![],'options':_0x31a91e['type'][_0xd18d('0x38')]===_0xd18d('0x7d')&&_0x31a91e[_0xd18d('0x3f')]['picklistValues'][_0xd18d('0x48')]>0x0?_['map'](_0x31a91e[_0xd18d('0x3f')][_0xd18d('0x7e')],function(_0x2dbd97){return{'name':_0x2dbd97[_0xd18d('0x7b')],'value':_0x2dbd97['value']};}):[]};})};}})[_0xd18d('0x1f')](respondWithResult(_0x29d8cb,null))[_0xd18d('0x2a')](function(_0x4e0a84){console['log']('vTiger\x20error:\x20'+_0x4e0a84);var _0x5a6fa9=_0x263a08['query'][_0xd18d('0x7f')]?0x1f4:_0x4e0a84[_0xd18d('0x80')]||0x1f4;logger[_0xd18d('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xd18d('0x64'),_0x5a6fa9,JSON[_0xd18d('0x25')](_0x4e0a84));delete _0x4e0a84[_0xd18d('0x38')];if(_0x5a6fa9===0x191){_0x5a6fa9=0x190;}_0x29d8cb['status'](_0x5a6fa9)[_0xd18d('0x39')](_0x263a08['query']['test']?{'message':_0xd18d('0x81'),'statusCode':_0x4e0a84[_0xd18d('0x80')]}:_0x4e0a84);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 0baae0a..c75f226 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 _0x5c9d=['define','VtigerAccount','int_vtiger_accounts','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x4d53c3,_0x2dcc46){var _0x22c8c8=function(_0x12ea5e){while(--_0x12ea5e){_0x4d53c3['push'](_0x4d53c3['shift']());}};_0x22c8c8(++_0x2dcc46);}(_0x5c9d,0x177));var _0xd5c9=function(_0x450e22,_0x3ba125){_0x450e22=_0x450e22-0x0;var _0x5e3b1d=_0x5c9d[_0x450e22];return _0x5e3b1d;};'use strict';var _=require(_0xd5c9('0x0'));var util=require(_0xd5c9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd5c9('0x2'));var BPromise=require(_0xd5c9('0x3'));var rp=require(_0xd5c9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5c9('0x5'));var config=require(_0xd5c9('0x6'));var attributes=require(_0xd5c9('0x7'));var integrations=require(_0xd5c9('0x8'));module['exports']=function(_0x15ec91,_0x521cfe){return _0x15ec91[_0xd5c9('0x9')](_0xd5c9('0xa'),attributes,{'tableName':_0xd5c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7345=['bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x24bd83,_0x1830c4){var _0x3a047e=function(_0x5d8bc4){while(--_0x5d8bc4){_0x24bd83['push'](_0x24bd83['shift']());}};_0x3a047e(++_0x1830c4);}(_0x7345,0x1ab));var _0x5734=function(_0x206c3e,_0x11f866){_0x206c3e=_0x206c3e-0x0;var _0x1aa459=_0x7345[_0x206c3e];return _0x1aa459;};'use strict';var _=require(_0x5734('0x0'));var util=require(_0x5734('0x1'));var logger=require(_0x5734('0x2'))(_0x5734('0x3'));var moment=require(_0x5734('0x4'));var BPromise=require(_0x5734('0x5'));var rp=require(_0x5734('0x6'));var fs=require('fs');var path=require(_0x5734('0x7'));var rimraf=require(_0x5734('0x8'));var config=require('../../config/environment');var attributes=require(_0x5734('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3fc01c,_0x33b68e){return _0x3fc01c['define'](_0x5734('0xa'),attributes,{'tableName':_0x5734('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 0aec0e9..5af9133 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 _0x98a4=['catch','GetVtigerAccount','VtigerAccount','options','where','attributes','limit','include','map','model','then','find','raw','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1e7b5a,_0x2f3fe6){var _0x19dfe1=function(_0x2bb9c6){while(--_0x2bb9c6){_0x1e7b5a['push'](_0x1e7b5a['shift']());}};_0x19dfe1(++_0x2f3fe6);}(_0x98a4,0x1e2));var _0x498a=function(_0x45e045,_0x265985){_0x45e045=_0x45e045-0x0;var _0x34a2f9=_0x98a4[_0x45e045];return _0x34a2f9;};'use strict';var _=require(_0x498a('0x0'));var util=require(_0x498a('0x1'));var moment=require(_0x498a('0x2'));var BPromise=require(_0x498a('0x3'));var rs=require(_0x498a('0x4'));var fs=require('fs');var Redis=require(_0x498a('0x5'));var db=require(_0x498a('0x6'))['db'];var utils=require(_0x498a('0x7'));var logger=require(_0x498a('0x8'))(_0x498a('0x9'));var config=require('../../config/environment');var jayson=require(_0x498a('0xa'));var client=jayson['client'][_0x498a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d4b2c,_0x231485,_0xe0dda1){return new BPromise(function(_0x357a53,_0x512081){return client[_0x498a('0xc')](_0x1d4b2c,_0xe0dda1)['then'](function(_0x544aea){logger[_0x498a('0xd')](_0x498a('0xe'),_0x231485,'request\x20sent');logger[_0x498a('0xf')](_0x498a('0x10'),_0x231485,_0x498a('0x11'),JSON[_0x498a('0x12')](_0x544aea));if(_0x544aea[_0x498a('0x13')]){if(_0x544aea['error'][_0x498a('0x14')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x231485,_0x544aea[_0x498a('0x13')][_0x498a('0x15')]);return _0x512081(_0x544aea[_0x498a('0x13')][_0x498a('0x15')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x231485,_0x544aea[_0x498a('0x13')]['message']);return _0x357a53(_0x544aea[_0x498a('0x13')][_0x498a('0x15')]);}else{logger['info'](_0x498a('0xe'),_0x231485,_0x498a('0x11'));_0x357a53(_0x544aea['result'][_0x498a('0x15')]);}})[_0x498a('0x16')](function(_0xece0c1){logger[_0x498a('0x13')](_0x498a('0xe'),_0x231485,_0xece0c1);_0x512081(_0xece0c1);});});}exports[_0x498a('0x17')]=function(_0x47b26d){var _0x2e3cf4=this;return new Promise(function(_0x57dcb0,_0x11a3ec){return db[_0x498a('0x18')]['findAll']({'raw':_0x47b26d[_0x498a('0x19')]?_0x47b26d[_0x498a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x47b26d[_0x498a('0x19')]?_0x47b26d[_0x498a('0x19')][_0x498a('0x1a')]||null:null,'attributes':_0x47b26d[_0x498a('0x19')]?_0x47b26d[_0x498a('0x19')][_0x498a('0x1b')]||null:null,'limit':_0x47b26d['options']?_0x47b26d[_0x498a('0x19')][_0x498a('0x1c')]||null:null,'include':_0x47b26d[_0x498a('0x19')]?_0x47b26d['options'][_0x498a('0x1d')]?_[_0x498a('0x1e')](_0x47b26d[_0x498a('0x19')]['include'],function(_0x510384){return{'model':db[_0x510384[_0x498a('0x1f')]],'as':_0x510384['as'],'attributes':_0x510384[_0x498a('0x1b')],'include':_0x510384[_0x498a('0x1d')]?_['map'](_0x510384[_0x498a('0x1d')],function(_0x127511){return{'model':db[_0x127511['model']],'as':_0x127511['as'],'attributes':_0x127511[_0x498a('0x1b')],'include':_0x127511[_0x498a('0x1d')]?_[_0x498a('0x1e')](_0x127511[_0x498a('0x1d')],function(_0x762dfa){return{'model':db[_0x762dfa[_0x498a('0x1f')]],'as':_0x762dfa['as'],'attributes':_0x762dfa[_0x498a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x498a('0x20')](function(_0x275e38){logger[_0x498a('0xd')]('GetVtigerAccount',_0x47b26d);logger[_0x498a('0xf')](_0x498a('0x17'),_0x47b26d,JSON['stringify'](_0x275e38));_0x57dcb0(_0x275e38);})[_0x498a('0x16')](function(_0x17b244){logger[_0x498a('0x13')]('GetVtigerAccount',_0x17b244[_0x498a('0x15')],_0x47b26d);_0x11a3ec(_0x2e3cf4[_0x498a('0x13')](0x1f4,_0x17b244[_0x498a('0x15')]));});});};exports['ShowVtigerAccount']=function(_0x1dcf82){var _0x3ba260=this;return new Promise(function(_0x336855,_0xdfd688){return db[_0x498a('0x18')][_0x498a('0x21')]({'raw':_0x1dcf82['options']?_0x1dcf82[_0x498a('0x19')][_0x498a('0x22')]===undefined?!![]:![]:!![],'where':_0x1dcf82[_0x498a('0x19')]?_0x1dcf82['options'][_0x498a('0x1a')]||null:null,'attributes':_0x1dcf82[_0x498a('0x19')]?_0x1dcf82['options'][_0x498a('0x1b')]||null:null,'include':_0x1dcf82[_0x498a('0x19')]?_0x1dcf82[_0x498a('0x19')]['include']?_[_0x498a('0x1e')](_0x1dcf82[_0x498a('0x19')][_0x498a('0x1d')],function(_0x1d7153){return{'model':db[_0x1d7153['model']],'as':_0x1d7153['as'],'attributes':_0x1d7153[_0x498a('0x1b')],'include':_0x1d7153['include']?_[_0x498a('0x1e')](_0x1d7153[_0x498a('0x1d')],function(_0xe9b8da){return{'model':db[_0xe9b8da[_0x498a('0x1f')]],'as':_0xe9b8da['as'],'attributes':_0xe9b8da['attributes'],'include':_0xe9b8da[_0x498a('0x1d')]?_[_0x498a('0x1e')](_0xe9b8da[_0x498a('0x1d')],function(_0x30e586){return{'model':db[_0x30e586['model']],'as':_0x30e586['as'],'attributes':_0x30e586[_0x498a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x498a('0x20')](function(_0x1b9ef2){logger[_0x498a('0xd')](_0x498a('0x23'),_0x1dcf82);logger[_0x498a('0xf')]('ShowVtigerAccount',_0x1dcf82,JSON[_0x498a('0x12')](_0x1b9ef2));_0x336855(_0x1b9ef2);})[_0x498a('0x16')](function(_0x3d639a){logger[_0x498a('0x13')](_0x498a('0x23'),_0x3d639a[_0x498a('0x15')],_0x1dcf82);_0xdfd688(_0x3ba260[_0x498a('0x13')](0x1f4,_0x3d639a[_0x498a('0x15')]));});});}; \ No newline at end of file +var _0xc34f=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','catch','ShowVtigerAccount','lodash','moment','randomstring','ioredis'];(function(_0x560561,_0x5711ba){var _0x50a631=function(_0x3ed549){while(--_0x3ed549){_0x560561['push'](_0x560561['shift']());}};_0x50a631(++_0x5711ba);}(_0xc34f,0xdc));var _0xfc34=function(_0xefe8df,_0x399303){_0xefe8df=_0xefe8df-0x0;var _0x55b239=_0xc34f[_0xefe8df];return _0x55b239;};'use strict';var _=require(_0xfc34('0x0'));var util=require('util');var moment=require(_0xfc34('0x1'));var BPromise=require('bluebird');var rs=require(_0xfc34('0x2'));var fs=require('fs');var Redis=require(_0xfc34('0x3'));var db=require(_0xfc34('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc34('0x5'))(_0xfc34('0x6'));var config=require('../../config/environment');var jayson=require(_0xfc34('0x7'));var client=jayson[_0xfc34('0x8')][_0xfc34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59b019,_0x38b586,_0xde57d8){return new BPromise(function(_0x375c6e,_0x2e16e7){return client['request'](_0x59b019,_0xde57d8)[_0xfc34('0xa')](function(_0x217849){logger[_0xfc34('0xb')](_0xfc34('0xc'),_0x38b586,'request\x20sent');logger[_0xfc34('0xd')](_0xfc34('0xe'),_0x38b586,'request\x20sent',JSON[_0xfc34('0xf')](_0x217849));if(_0x217849[_0xfc34('0x10')]){if(_0x217849[_0xfc34('0x10')][_0xfc34('0x11')]===0x1f4){logger[_0xfc34('0x10')](_0xfc34('0xc'),_0x38b586,_0x217849[_0xfc34('0x10')][_0xfc34('0x12')]);return _0x2e16e7(_0x217849[_0xfc34('0x10')][_0xfc34('0x12')]);}logger[_0xfc34('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x38b586,_0x217849['error']['message']);return _0x375c6e(_0x217849[_0xfc34('0x10')]['message']);}else{logger['info'](_0xfc34('0xc'),_0x38b586,_0xfc34('0x13'));_0x375c6e(_0x217849[_0xfc34('0x14')]['message']);}})['catch'](function(_0x3060fe){logger[_0xfc34('0x10')](_0xfc34('0xc'),_0x38b586,_0x3060fe);_0x2e16e7(_0x3060fe);});});}exports[_0xfc34('0x15')]=function(_0x1da2b3){var _0x34cdcf=this;return new Promise(function(_0x14c8f4,_0x37eed9){return db['VtigerAccount']['findAll']({'raw':_0x1da2b3[_0xfc34('0x16')]?_0x1da2b3[_0xfc34('0x16')][_0xfc34('0x17')]===undefined?!![]:![]:!![],'where':_0x1da2b3[_0xfc34('0x16')]?_0x1da2b3[_0xfc34('0x16')][_0xfc34('0x18')]||null:null,'attributes':_0x1da2b3['options']?_0x1da2b3[_0xfc34('0x16')][_0xfc34('0x19')]||null:null,'limit':_0x1da2b3['options']?_0x1da2b3['options'][_0xfc34('0x1a')]||null:null,'include':_0x1da2b3[_0xfc34('0x16')]?_0x1da2b3[_0xfc34('0x16')][_0xfc34('0x1b')]?_[_0xfc34('0x1c')](_0x1da2b3[_0xfc34('0x16')][_0xfc34('0x1b')],function(_0x3bebef){return{'model':db[_0x3bebef[_0xfc34('0x1d')]],'as':_0x3bebef['as'],'attributes':_0x3bebef[_0xfc34('0x19')],'include':_0x3bebef[_0xfc34('0x1b')]?_['map'](_0x3bebef[_0xfc34('0x1b')],function(_0x4d1def){return{'model':db[_0x4d1def[_0xfc34('0x1d')]],'as':_0x4d1def['as'],'attributes':_0x4d1def['attributes'],'include':_0x4d1def[_0xfc34('0x1b')]?_[_0xfc34('0x1c')](_0x4d1def['include'],function(_0x4c4d85){return{'model':db[_0x4c4d85[_0xfc34('0x1d')]],'as':_0x4c4d85['as'],'attributes':_0x4c4d85[_0xfc34('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfc34('0xa')](function(_0x14d5cc){logger[_0xfc34('0xb')](_0xfc34('0x15'),_0x1da2b3);logger[_0xfc34('0xd')](_0xfc34('0x15'),_0x1da2b3,JSON[_0xfc34('0xf')](_0x14d5cc));_0x14c8f4(_0x14d5cc);})[_0xfc34('0x1e')](function(_0x10d4ad){logger['error'](_0xfc34('0x15'),_0x10d4ad['message'],_0x1da2b3);_0x37eed9(_0x34cdcf[_0xfc34('0x10')](0x1f4,_0x10d4ad[_0xfc34('0x12')]));});});};exports[_0xfc34('0x1f')]=function(_0x1a6272){var _0x254be1=this;return new Promise(function(_0x22a63d,_0x308dc2){return db['VtigerAccount']['find']({'raw':_0x1a6272['options']?_0x1a6272[_0xfc34('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1a6272[_0xfc34('0x16')]?_0x1a6272['options'][_0xfc34('0x18')]||null:null,'attributes':_0x1a6272[_0xfc34('0x16')]?_0x1a6272[_0xfc34('0x16')]['attributes']||null:null,'include':_0x1a6272[_0xfc34('0x16')]?_0x1a6272[_0xfc34('0x16')]['include']?_[_0xfc34('0x1c')](_0x1a6272[_0xfc34('0x16')][_0xfc34('0x1b')],function(_0x4fa259){return{'model':db[_0x4fa259[_0xfc34('0x1d')]],'as':_0x4fa259['as'],'attributes':_0x4fa259['attributes'],'include':_0x4fa259[_0xfc34('0x1b')]?_[_0xfc34('0x1c')](_0x4fa259[_0xfc34('0x1b')],function(_0x33b7e2){return{'model':db[_0x33b7e2['model']],'as':_0x33b7e2['as'],'attributes':_0x33b7e2[_0xfc34('0x19')],'include':_0x33b7e2[_0xfc34('0x1b')]?_[_0xfc34('0x1c')](_0x33b7e2['include'],function(_0x571b72){return{'model':db[_0x571b72[_0xfc34('0x1d')]],'as':_0x571b72['as'],'attributes':_0x571b72[_0xfc34('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa8aa0d){logger[_0xfc34('0xb')]('ShowVtigerAccount',_0x1a6272);logger[_0xfc34('0xd')](_0xfc34('0x1f'),_0x1a6272,JSON[_0xfc34('0xf')](_0xa8aa0d));_0x22a63d(_0xa8aa0d);})[_0xfc34('0x1e')](function(_0x53f1ad){logger[_0xfc34('0x10')](_0xfc34('0x1f'),_0x53f1ad['message'],_0x1a6272);_0x308dc2(_0x254be1[_0xfc34('0x10')](0x1f4,_0x53f1ad[_0xfc34('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 446c9e8..c045177 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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x2a79ae,_0x2992d4){var _0x431086=function(_0xf5eec2){while(--_0xf5eec2){_0x2a79ae['push'](_0x2a79ae['shift']());}};_0x431086(++_0x2992d4);}(_0x7a54,0x106));var _0x47a5=function(_0x448104,_0x3cf4ce){_0x448104=_0x448104-0x0;var _0x2d4000=_0x7a54[_0x448104];return _0x2d4000;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0xc4aa=['getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'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['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0x12')]);router[_0xac4a('0x13')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x14')]);router[_0xac4a('0x15')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x16')]);module[_0xac4a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 5dd7d75..0d8da12 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 _0x480f=['STRING','sequelize'];(function(_0x30a761,_0x2e6e9c){var _0x9971e4=function(_0x3e4b27){while(--_0x3e4b27){_0x30a761['push'](_0x30a761['shift']());}};_0x9971e4(++_0x2e6e9c);}(_0x480f,0x117));var _0xf480=function(_0x3058bc,_0x391ddb){_0x3058bc=_0x3058bc-0x0;var _0x586a60=_0x480f[_0x3058bc];return _0x586a60;};'use strict';var Sequelize=require(_0xf480('0x0'));module['exports']={'name':{'type':Sequelize[_0xf480('0x1')]},'description':{'type':Sequelize[_0xf480('0x1')]}}; \ No newline at end of file +var _0xa632=['STRING','sequelize','exports'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0xa632,0xd3));var _0x2a63=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa632[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x2a63('0x0'));module[_0x2a63('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2a63('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 032c950..709eca8 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 _0xb7d8=['body','params','getFields','findOne','VtigerField','fields','pick','hasOwnProperty','getSubjects','getDescriptions','nolimit','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','set','apply','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','order','sort','filter','where','options','VtigerConfiguration','includeAll','include','findAll','rows','catch','show','keys','length','merge','create'];(function(_0x31a6ac,_0xe74ba3){var _0x213b09=function(_0x2946d2){while(--_0x2946d2){_0x31a6ac['push'](_0x31a6ac['shift']());}};_0x213b09(++_0xe74ba3);}(_0xb7d8,0x163));var _0x8b7d=function(_0x2b30aa,_0x4ea2b8){_0x2b30aa=_0x2b30aa-0x0;var _0x166e92=_0xb7d8[_0x2b30aa];return _0x166e92;};'use strict';var pdf=require(_0x8b7d('0x0'));var emlformat=require(_0x8b7d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8b7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8b7d('0x3'));var BPromise=require(_0x8b7d('0x4'));var Mustache=require('mustache');var util=require(_0x8b7d('0x5'));var path=require(_0x8b7d('0x6'));var sox=require(_0x8b7d('0x7'));var csv=require(_0x8b7d('0x8'));var ejs=require(_0x8b7d('0x9'));var fs=require('fs');var fs_extra=require(_0x8b7d('0xa'));var _=require(_0x8b7d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8b7d('0xc'));var deskjs=require(_0x8b7d('0xd'));var toCsv=require(_0x8b7d('0x8'));var querystring=require(_0x8b7d('0xe'));var Papa=require(_0x8b7d('0xf'));var Redis=require(_0x8b7d('0x10'));var authService=require(_0x8b7d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b7d('0x12'));var hardwareService=require(_0x8b7d('0x13'));var logger=require(_0x8b7d('0x14'))(_0x8b7d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8b7d('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x8b7d('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7f532b,_0x5c7b5c,_0x43e831,_0x41d192){return new BPromise(function(_0x166ac9,_0x4d6da0){var _0x38fec4=_0x41d192||client;return _0x38fec4[_0x8b7d('0x18')](_0x7f532b,_0x43e831)[_0x8b7d('0x19')](function(_0x1a6dc1){logger[_0x8b7d('0x1a')](_0x8b7d('0x1b'),_0x5c7b5c,'request\x20sent');logger[_0x8b7d('0x1c')](_0x8b7d('0x1d'),_0x5c7b5c,_0x8b7d('0x1e'),JSON[_0x8b7d('0x1f')](_0x1a6dc1));if(_0x1a6dc1[_0x8b7d('0x20')]){if(_0x1a6dc1[_0x8b7d('0x20')][_0x8b7d('0x21')]===0x1f4){logger['error'](_0x8b7d('0x1b'),_0x5c7b5c,_0x1a6dc1[_0x8b7d('0x20')]['message']);return _0x4d6da0(_0x1a6dc1['error'][_0x8b7d('0x22')]);}logger[_0x8b7d('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x5c7b5c,_0x1a6dc1[_0x8b7d('0x20')][_0x8b7d('0x22')]);return _0x166ac9(_0x1a6dc1[_0x8b7d('0x20')][_0x8b7d('0x22')]);}else{logger[_0x8b7d('0x1a')](_0x8b7d('0x1b'),_0x5c7b5c,_0x8b7d('0x1e'));_0x166ac9(_0x1a6dc1['result']['message']);}})['catch'](function(_0x5c82be){logger[_0x8b7d('0x20')](_0x8b7d('0x1b'),_0x5c7b5c,_0x5c82be);_0x4d6da0(_0x5c82be);});});}function respondWithStatusCode(_0x519d6e,_0x113c64){_0x113c64=_0x113c64||0xcc;return function(_0x3b435c){if(_0x3b435c){return _0x519d6e[_0x8b7d('0x23')](_0x113c64);}return _0x519d6e[_0x8b7d('0x24')](_0x113c64)[_0x8b7d('0x25')]();};}function respondWithResult(_0x2a27d4,_0x5664ef){_0x5664ef=_0x5664ef||0xc8;return function(_0x4f002a){if(_0x4f002a){return _0x2a27d4[_0x8b7d('0x24')](_0x5664ef)[_0x8b7d('0x26')](_0x4f002a);}};}function respondWithFilteredResult(_0x2f81fa,_0x1c35f7){return function(_0x492b6f){if(_0x492b6f){var _0x434231=_0x492b6f[_0x8b7d('0x27')],_0x525829=_0x1c35f7[_0x8b7d('0x28')],_0xe50704=_0x1c35f7[_0x8b7d('0x28')]+_0x1c35f7[_0x8b7d('0x29')],_0x301f80;if(_0xe50704>=_0x434231){_0xe50704=_0x434231;_0x301f80=0xc8;}else{_0x301f80=0xce;}_0x2f81fa['status'](_0x301f80);return _0x2f81fa[_0x8b7d('0x2a')]('Content-Range',_0x525829+'-'+_0xe50704+'/'+_0x434231)[_0x8b7d('0x26')](_0x492b6f);}return null;};}function patchUpdates(_0x1f45ea){return function(_0x446e6f){try{jsonpatch[_0x8b7d('0x2b')](_0x446e6f,_0x1f45ea,!![]);}catch(_0x262517){return BPromise['reject'](_0x262517);}return _0x446e6f['save']();};}function saveUpdates(_0x5cf8fd,_0x1dd29e){return function(_0x46377e){if(_0x46377e){return _0x46377e[_0x8b7d('0x2c')](_0x5cf8fd)[_0x8b7d('0x19')](function(_0x1b1d42){return _0x1b1d42;});}return null;};}function removeEntity(_0x5130e1,_0x408533){return function(_0x43ba4b){if(_0x43ba4b){return _0x43ba4b[_0x8b7d('0x2d')]()[_0x8b7d('0x19')](function(){_0x5130e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x70cbd3,_0xec9b0d){return function(_0x1e5c60){if(!_0x1e5c60){_0x70cbd3['sendStatus'](0x194);}return _0x1e5c60;};}function handleError(_0x462a1d,_0x4d5aa0){_0x4d5aa0=_0x4d5aa0||0x1f4;return function(_0x260db9){logger[_0x8b7d('0x20')](_0x260db9[_0x8b7d('0x2e')]);if(_0x260db9[_0x8b7d('0x2f')]){delete _0x260db9[_0x8b7d('0x2f')];}_0x462a1d['status'](_0x4d5aa0)[_0x8b7d('0x30')](_0x260db9);};}exports[_0x8b7d('0x31')]=function(_0x1b4b4d,_0x413dff){var _0x46ca9e={},_0x5af419={},_0x33f982={'count':0x0,'rows':[]};var _0x45e80f=_[_0x8b7d('0x32')](db['VtigerConfiguration'][_0x8b7d('0x33')],function(_0x40c069){return{'name':_0x40c069['fieldName'],'type':_0x40c069[_0x8b7d('0x34')][_0x8b7d('0x35')]};});_0x5af419[_0x8b7d('0x36')]=_[_0x8b7d('0x32')](_0x45e80f,_0x8b7d('0x2f'));_0x5af419[_0x8b7d('0x37')]=_['keys'](_0x1b4b4d['query']);_0x5af419[_0x8b7d('0x38')]=_[_0x8b7d('0x39')](_0x5af419['model'],_0x5af419[_0x8b7d('0x37')]);_0x46ca9e[_0x8b7d('0x3a')]=_[_0x8b7d('0x39')](_0x5af419[_0x8b7d('0x36')],qs['fields'](_0x1b4b4d['query']['fields']));_0x46ca9e[_0x8b7d('0x3a')]=_0x46ca9e[_0x8b7d('0x3a')]['length']?_0x46ca9e[_0x8b7d('0x3a')]:_0x5af419[_0x8b7d('0x36')];if(!_0x1b4b4d['query']['hasOwnProperty']('nolimit')){_0x46ca9e['limit']=qs[_0x8b7d('0x29')](_0x1b4b4d['query']['limit']);_0x46ca9e[_0x8b7d('0x28')]=qs[_0x8b7d('0x28')](_0x1b4b4d[_0x8b7d('0x37')][_0x8b7d('0x28')]);}_0x46ca9e[_0x8b7d('0x3b')]=qs[_0x8b7d('0x3c')](_0x1b4b4d['query']['sort']);_0x46ca9e['where']=qs[_0x8b7d('0x38')](_['pick'](_0x1b4b4d[_0x8b7d('0x37')],_0x5af419[_0x8b7d('0x38')]),_0x45e80f);if(_0x1b4b4d[_0x8b7d('0x37')][_0x8b7d('0x3d')]){_0x46ca9e['where']=_['merge'](_0x46ca9e[_0x8b7d('0x3e')],{'$or':_[_0x8b7d('0x32')](_0x45e80f,function(_0x36ca7d){if(_0x36ca7d[_0x8b7d('0x34')]!=='VIRTUAL'){var _0x9f4688={};_0x9f4688[_0x36ca7d[_0x8b7d('0x2f')]]={'$like':'%'+_0x1b4b4d[_0x8b7d('0x37')]['filter']+'%'};return _0x9f4688;}})});}_0x46ca9e=_['merge']({},_0x46ca9e,_0x1b4b4d[_0x8b7d('0x3f')]);var _0xfe9525={'where':_0x46ca9e[_0x8b7d('0x3e')]};return db[_0x8b7d('0x40')][_0x8b7d('0x27')](_0xfe9525)[_0x8b7d('0x19')](function(_0x48a028){_0x33f982[_0x8b7d('0x27')]=_0x48a028;if(_0x1b4b4d[_0x8b7d('0x37')][_0x8b7d('0x41')]){_0x46ca9e[_0x8b7d('0x42')]=[{'all':!![]}];}return db[_0x8b7d('0x40')][_0x8b7d('0x43')](_0x46ca9e);})['then'](function(_0xa5383e){_0x33f982[_0x8b7d('0x44')]=_0xa5383e;return _0x33f982;})[_0x8b7d('0x19')](respondWithFilteredResult(_0x413dff,_0x46ca9e))[_0x8b7d('0x45')](handleError(_0x413dff,null));};exports[_0x8b7d('0x46')]=function(_0x5d5a0f,_0x226ded){var _0x5f507b={'raw':![],'where':{'id':_0x5d5a0f['params']['id']}},_0x2e1429={};_0x2e1429[_0x8b7d('0x36')]=_[_0x8b7d('0x47')](db[_0x8b7d('0x40')][_0x8b7d('0x33')]);_0x2e1429[_0x8b7d('0x37')]=_[_0x8b7d('0x47')](_0x5d5a0f[_0x8b7d('0x37')]);_0x2e1429[_0x8b7d('0x38')]=_[_0x8b7d('0x39')](_0x2e1429['model'],_0x2e1429[_0x8b7d('0x37')]);_0x5f507b[_0x8b7d('0x3a')]=_[_0x8b7d('0x39')](_0x2e1429[_0x8b7d('0x36')],qs['fields'](_0x5d5a0f['query']['fields']));_0x5f507b[_0x8b7d('0x3a')]=_0x5f507b[_0x8b7d('0x3a')][_0x8b7d('0x48')]?_0x5f507b[_0x8b7d('0x3a')]:_0x2e1429[_0x8b7d('0x36')];if(_0x5d5a0f[_0x8b7d('0x37')][_0x8b7d('0x41')]){_0x5f507b[_0x8b7d('0x42')]=[{'all':!![]}];}_0x5f507b=_[_0x8b7d('0x49')]({},_0x5f507b,_0x5d5a0f[_0x8b7d('0x3f')]);return db[_0x8b7d('0x40')]['find'](_0x5f507b)['then'](handleEntityNotFound(_0x226ded,null))[_0x8b7d('0x19')](respondWithResult(_0x226ded,null))[_0x8b7d('0x45')](handleError(_0x226ded,null));};exports[_0x8b7d('0x4a')]=function(_0x15986d,_0x284d9b){return db[_0x8b7d('0x40')][_0x8b7d('0x4a')](_0x15986d['body'],{})[_0x8b7d('0x19')](respondWithResult(_0x284d9b,0xc9))[_0x8b7d('0x45')](handleError(_0x284d9b,null));};exports[_0x8b7d('0x2c')]=function(_0x2528b2,_0x4ab916){if(_0x2528b2[_0x8b7d('0x4b')]['id']){delete _0x2528b2[_0x8b7d('0x4b')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x2528b2[_0x8b7d('0x4c')]['id']}})[_0x8b7d('0x19')](handleEntityNotFound(_0x4ab916,null))[_0x8b7d('0x19')](saveUpdates(_0x2528b2[_0x8b7d('0x4b')],null))[_0x8b7d('0x19')](respondWithResult(_0x4ab916,null))[_0x8b7d('0x45')](handleError(_0x4ab916,null));};exports['destroy']=function(_0x1de0dd,_0x422172){return db[_0x8b7d('0x40')]['find']({'where':{'id':_0x1de0dd[_0x8b7d('0x4c')]['id']}})[_0x8b7d('0x19')](handleEntityNotFound(_0x422172,null))[_0x8b7d('0x19')](removeEntity(_0x422172,null))[_0x8b7d('0x45')](handleError(_0x422172,null));};exports[_0x8b7d('0x4d')]=function(_0x2c1aa2,_0x620893,_0x584694){var _0x53ab7f={};var _0x70b6bd={};var _0x362059;var _0x4dd187;return db[_0x8b7d('0x40')][_0x8b7d('0x4e')]({'where':{'id':_0x2c1aa2['params']['id']}})[_0x8b7d('0x19')](handleEntityNotFound(_0x620893,null))['then'](function(_0x34d541){if(_0x34d541){_0x362059=_0x34d541;_0x70b6bd[_0x8b7d('0x36')]=_['keys'](db[_0x8b7d('0x4f')]['rawAttributes']);_0x70b6bd[_0x8b7d('0x37')]=_[_0x8b7d('0x47')](_0x2c1aa2[_0x8b7d('0x37')]);_0x70b6bd[_0x8b7d('0x38')]=_['intersection'](_0x70b6bd[_0x8b7d('0x36')],_0x70b6bd['query']);_0x53ab7f[_0x8b7d('0x3a')]=_[_0x8b7d('0x39')](_0x70b6bd['model'],qs['fields'](_0x2c1aa2[_0x8b7d('0x37')][_0x8b7d('0x50')]));_0x53ab7f['attributes']=_0x53ab7f['attributes']['length']?_0x53ab7f[_0x8b7d('0x3a')]:_0x70b6bd[_0x8b7d('0x36')];_0x53ab7f[_0x8b7d('0x3b')]=qs[_0x8b7d('0x3c')](_0x2c1aa2['query'][_0x8b7d('0x3c')]);_0x53ab7f[_0x8b7d('0x3e')]=qs[_0x8b7d('0x38')](_[_0x8b7d('0x51')](_0x2c1aa2[_0x8b7d('0x37')],_0x70b6bd[_0x8b7d('0x38')]));if(_0x2c1aa2[_0x8b7d('0x37')][_0x8b7d('0x3d')]){_0x53ab7f['where']=_[_0x8b7d('0x49')](_0x53ab7f[_0x8b7d('0x3e')],{'$or':_[_0x8b7d('0x32')](_0x53ab7f[_0x8b7d('0x3a')],function(_0x1a4f4a){var _0x2939dd={};_0x2939dd[_0x1a4f4a]={'$like':'%'+_0x2c1aa2[_0x8b7d('0x37')]['filter']+'%'};return _0x2939dd;})});}_0x53ab7f=_['merge']({},_0x53ab7f,_0x2c1aa2[_0x8b7d('0x3f')]);return _0x362059['getFields'](_0x53ab7f);}})[_0x8b7d('0x19')](function(_0x319de9){if(_0x319de9){_0x4dd187=_0x319de9[_0x8b7d('0x48')];if(!_0x2c1aa2['query'][_0x8b7d('0x52')]('nolimit')){_0x53ab7f[_0x8b7d('0x29')]=qs['limit'](_0x2c1aa2['query']['limit']);_0x53ab7f['offset']=qs[_0x8b7d('0x28')](_0x2c1aa2[_0x8b7d('0x37')][_0x8b7d('0x28')]);}return _0x362059[_0x8b7d('0x4d')](_0x53ab7f);}})[_0x8b7d('0x19')](function(_0x696b85){if(_0x696b85){return _0x696b85?{'count':_0x4dd187,'rows':_0x696b85}:null;}})[_0x8b7d('0x19')](respondWithResult(_0x620893,null))[_0x8b7d('0x45')](handleError(_0x620893,null));};exports['getSubjects']=function(_0x29bf09,_0x5342a3,_0x54e125){var _0x500af0={};var _0x13650d={};var _0x1d3bf5;var _0x22d925;return db[_0x8b7d('0x40')]['findOne']({'where':{'id':_0x29bf09['params']['id']}})[_0x8b7d('0x19')](handleEntityNotFound(_0x5342a3,null))[_0x8b7d('0x19')](function(_0x2423ce){if(_0x2423ce){_0x1d3bf5=_0x2423ce;_0x13650d[_0x8b7d('0x36')]=_[_0x8b7d('0x47')](db[_0x8b7d('0x4f')][_0x8b7d('0x33')]);_0x13650d['query']=_[_0x8b7d('0x47')](_0x29bf09['query']);_0x13650d[_0x8b7d('0x38')]=_[_0x8b7d('0x39')](_0x13650d[_0x8b7d('0x36')],_0x13650d[_0x8b7d('0x37')]);_0x500af0['attributes']=_[_0x8b7d('0x39')](_0x13650d[_0x8b7d('0x36')],qs[_0x8b7d('0x50')](_0x29bf09[_0x8b7d('0x37')][_0x8b7d('0x50')]));_0x500af0['attributes']=_0x500af0['attributes'][_0x8b7d('0x48')]?_0x500af0[_0x8b7d('0x3a')]:_0x13650d['model'];_0x500af0['order']=qs[_0x8b7d('0x3c')](_0x29bf09['query'][_0x8b7d('0x3c')]);_0x500af0[_0x8b7d('0x3e')]=qs[_0x8b7d('0x38')](_[_0x8b7d('0x51')](_0x29bf09['query'],_0x13650d[_0x8b7d('0x38')]));if(_0x29bf09[_0x8b7d('0x37')][_0x8b7d('0x3d')]){_0x500af0['where']=_[_0x8b7d('0x49')](_0x500af0[_0x8b7d('0x3e')],{'$or':_['map'](_0x500af0[_0x8b7d('0x3a')],function(_0x34c4fe){var _0x299a61={};_0x299a61[_0x34c4fe]={'$like':'%'+_0x29bf09[_0x8b7d('0x37')][_0x8b7d('0x3d')]+'%'};return _0x299a61;})});}_0x500af0=_[_0x8b7d('0x49')]({},_0x500af0,_0x29bf09['options']);return _0x1d3bf5[_0x8b7d('0x53')](_0x500af0);}})[_0x8b7d('0x19')](function(_0x4e835e){if(_0x4e835e){_0x22d925=_0x4e835e[_0x8b7d('0x48')];if(!_0x29bf09[_0x8b7d('0x37')][_0x8b7d('0x52')]('nolimit')){_0x500af0['limit']=qs['limit'](_0x29bf09[_0x8b7d('0x37')][_0x8b7d('0x29')]);_0x500af0[_0x8b7d('0x28')]=qs[_0x8b7d('0x28')](_0x29bf09[_0x8b7d('0x37')][_0x8b7d('0x28')]);}return _0x1d3bf5[_0x8b7d('0x53')](_0x500af0);}})[_0x8b7d('0x19')](function(_0xfff897){if(_0xfff897){return _0xfff897?{'count':_0x22d925,'rows':_0xfff897}:null;}})['then'](respondWithResult(_0x5342a3,null))[_0x8b7d('0x45')](handleError(_0x5342a3,null));};exports['getDescriptions']=function(_0x19a42c,_0x2b9355,_0x200684){var _0x11c1db={};var _0x565061={};var _0x38c04c;var _0xea79c8;return db[_0x8b7d('0x40')][_0x8b7d('0x4e')]({'where':{'id':_0x19a42c[_0x8b7d('0x4c')]['id']}})[_0x8b7d('0x19')](handleEntityNotFound(_0x2b9355,null))[_0x8b7d('0x19')](function(_0x114fed){if(_0x114fed){_0x38c04c=_0x114fed;_0x565061[_0x8b7d('0x36')]=_[_0x8b7d('0x47')](db[_0x8b7d('0x4f')][_0x8b7d('0x33')]);_0x565061[_0x8b7d('0x37')]=_[_0x8b7d('0x47')](_0x19a42c[_0x8b7d('0x37')]);_0x565061['filters']=_[_0x8b7d('0x39')](_0x565061[_0x8b7d('0x36')],_0x565061[_0x8b7d('0x37')]);_0x11c1db[_0x8b7d('0x3a')]=_['intersection'](_0x565061[_0x8b7d('0x36')],qs[_0x8b7d('0x50')](_0x19a42c[_0x8b7d('0x37')]['fields']));_0x11c1db[_0x8b7d('0x3a')]=_0x11c1db['attributes'][_0x8b7d('0x48')]?_0x11c1db[_0x8b7d('0x3a')]:_0x565061[_0x8b7d('0x36')];_0x11c1db['order']=qs[_0x8b7d('0x3c')](_0x19a42c['query']['sort']);_0x11c1db[_0x8b7d('0x3e')]=qs[_0x8b7d('0x38')](_[_0x8b7d('0x51')](_0x19a42c[_0x8b7d('0x37')],_0x565061['filters']));if(_0x19a42c['query']['filter']){_0x11c1db[_0x8b7d('0x3e')]=_['merge'](_0x11c1db[_0x8b7d('0x3e')],{'$or':_[_0x8b7d('0x32')](_0x11c1db['attributes'],function(_0x5233be){var _0x43fac1={};_0x43fac1[_0x5233be]={'$like':'%'+_0x19a42c[_0x8b7d('0x37')][_0x8b7d('0x3d')]+'%'};return _0x43fac1;})});}_0x11c1db=_[_0x8b7d('0x49')]({},_0x11c1db,_0x19a42c[_0x8b7d('0x3f')]);return _0x38c04c[_0x8b7d('0x54')](_0x11c1db);}})[_0x8b7d('0x19')](function(_0x2149e0){if(_0x2149e0){_0xea79c8=_0x2149e0[_0x8b7d('0x48')];if(!_0x19a42c['query'][_0x8b7d('0x52')](_0x8b7d('0x55'))){_0x11c1db['limit']=qs['limit'](_0x19a42c[_0x8b7d('0x37')][_0x8b7d('0x29')]);_0x11c1db[_0x8b7d('0x28')]=qs['offset'](_0x19a42c[_0x8b7d('0x37')][_0x8b7d('0x28')]);}return _0x38c04c[_0x8b7d('0x54')](_0x11c1db);}})[_0x8b7d('0x19')](function(_0x132789){if(_0x132789){return _0x132789?{'count':_0xea79c8,'rows':_0x132789}:null;}})[_0x8b7d('0x19')](respondWithResult(_0x2b9355,null))[_0x8b7d('0x45')](handleError(_0x2b9355,null));}; \ No newline at end of file +var _0x4f96=['rawAttributes','create','body','update','find','findOne','VtigerField','getFields','getSubjects','pick','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','destroy','stack','name','map','VtigerConfiguration','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params'];(function(_0x1bb121,_0x5d4138){var _0x5dbb01=function(_0x3c9fa1){while(--_0x3c9fa1){_0x1bb121['push'](_0x1bb121['shift']());}};_0x5dbb01(++_0x5d4138);}(_0x4f96,0xb9));var _0x64f9=function(_0xf0c56a,_0x5a0beb){_0xf0c56a=_0xf0c56a-0x0;var _0x23b4ac=_0x4f96[_0xf0c56a];return _0x23b4ac;};'use strict';var pdf=require(_0x64f9('0x0'));var emlformat=require(_0x64f9('0x1'));var rimraf=require(_0x64f9('0x2'));var zipdir=require(_0x64f9('0x3'));var jsonpatch=require(_0x64f9('0x4'));var rp=require(_0x64f9('0x5'));var moment=require('moment');var BPromise=require(_0x64f9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x64f9('0x7'));var sox=require('sox');var csv=require(_0x64f9('0x8'));var ejs=require(_0x64f9('0x9'));var fs=require('fs');var fs_extra=require(_0x64f9('0xa'));var _=require(_0x64f9('0xb'));var squel=require(_0x64f9('0xc'));var crypto=require('crypto');var jsforce=require(_0x64f9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x64f9('0x8'));var querystring=require(_0x64f9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x64f9('0xf'));var qs=require(_0x64f9('0x10'));var as=require(_0x64f9('0x11'));var hardwareService=require(_0x64f9('0x12'));var logger=require(_0x64f9('0x13'))('api');var utils=require(_0x64f9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x64f9('0x15'));var db=require(_0x64f9('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x64f9('0x17')][_0x64f9('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x192a9b,_0xa2b65a,_0x33da78,_0x4b52b3){return new BPromise(function(_0x14febc,_0x4bc653){var _0x4a9d30=_0x4b52b3||client;return _0x4a9d30[_0x64f9('0x19')](_0x192a9b,_0x33da78)[_0x64f9('0x1a')](function(_0x5c2a12){logger[_0x64f9('0x1b')](_0x64f9('0x1c'),_0xa2b65a,'request\x20sent');logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xa2b65a,'request\x20sent',JSON[_0x64f9('0x1d')](_0x5c2a12));if(_0x5c2a12[_0x64f9('0x1e')]){if(_0x5c2a12[_0x64f9('0x1e')][_0x64f9('0x1f')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0xa2b65a,_0x5c2a12[_0x64f9('0x1e')]['message']);return _0x4bc653(_0x5c2a12[_0x64f9('0x1e')][_0x64f9('0x20')]);}logger[_0x64f9('0x1e')](_0x64f9('0x1c'),_0xa2b65a,_0x5c2a12[_0x64f9('0x1e')][_0x64f9('0x20')]);return _0x14febc(_0x5c2a12[_0x64f9('0x1e')][_0x64f9('0x20')]);}else{logger[_0x64f9('0x1b')](_0x64f9('0x1c'),_0xa2b65a,_0x64f9('0x21'));_0x14febc(_0x5c2a12[_0x64f9('0x22')]['message']);}})[_0x64f9('0x23')](function(_0x3a6d96){logger[_0x64f9('0x1e')]('VtigerConfiguration,\x20%s,\x20%s',_0xa2b65a,_0x3a6d96);_0x4bc653(_0x3a6d96);});});}function respondWithStatusCode(_0x5ce72e,_0x51544b){_0x51544b=_0x51544b||0xcc;return function(_0x5edf79){if(_0x5edf79){return _0x5ce72e[_0x64f9('0x24')](_0x51544b);}return _0x5ce72e[_0x64f9('0x25')](_0x51544b)[_0x64f9('0x26')]();};}function respondWithResult(_0x1f8e45,_0x25c7aa){_0x25c7aa=_0x25c7aa||0xc8;return function(_0x1ac533){if(_0x1ac533){return _0x1f8e45['status'](_0x25c7aa)['json'](_0x1ac533);}};}function respondWithFilteredResult(_0x32f550,_0x4e4639){return function(_0x4bad83){if(_0x4bad83){var _0x104bc8=_0x4bad83[_0x64f9('0x27')],_0x4ec97d=_0x4e4639[_0x64f9('0x28')],_0x4f9c6a=_0x4e4639[_0x64f9('0x28')]+_0x4e4639[_0x64f9('0x29')],_0x8c71e1;if(_0x4f9c6a>=_0x104bc8){_0x4f9c6a=_0x104bc8;_0x8c71e1=0xc8;}else{_0x8c71e1=0xce;}_0x32f550['status'](_0x8c71e1);return _0x32f550[_0x64f9('0x2a')](_0x64f9('0x2b'),_0x4ec97d+'-'+_0x4f9c6a+'/'+_0x104bc8)[_0x64f9('0x2c')](_0x4bad83);}return null;};}function patchUpdates(_0x5d22d0){return function(_0x1406ff){try{jsonpatch[_0x64f9('0x2d')](_0x1406ff,_0x5d22d0,!![]);}catch(_0x276714){return BPromise['reject'](_0x276714);}return _0x1406ff['save']();};}function saveUpdates(_0x4ffee7,_0x9e0bed){return function(_0x38dae1){if(_0x38dae1){return _0x38dae1['update'](_0x4ffee7)[_0x64f9('0x1a')](function(_0x198aad){return _0x198aad;});}return null;};}function removeEntity(_0x623d60,_0xc8d7f1){return function(_0x1efb9e){if(_0x1efb9e){return _0x1efb9e[_0x64f9('0x2e')]()[_0x64f9('0x1a')](function(){_0x623d60[_0x64f9('0x25')](0xcc)[_0x64f9('0x26')]();});}};}function handleEntityNotFound(_0xd51bae,_0x5b2653){return function(_0x1b60b9){if(!_0x1b60b9){_0xd51bae[_0x64f9('0x24')](0x194);}return _0x1b60b9;};}function handleError(_0x38884e,_0x1fb452){_0x1fb452=_0x1fb452||0x1f4;return function(_0x15c84b){logger['error'](_0x15c84b[_0x64f9('0x2f')]);if(_0x15c84b[_0x64f9('0x30')]){delete _0x15c84b['name'];}_0x38884e[_0x64f9('0x25')](_0x1fb452)['send'](_0x15c84b);};}exports['index']=function(_0x3d4641,_0x198c78){var _0x22319a={},_0xb31d32={},_0x328f2b={'count':0x0,'rows':[]};var _0x97002f=_[_0x64f9('0x31')](db[_0x64f9('0x32')]['rawAttributes'],function(_0x15d61c){return{'name':_0x15d61c[_0x64f9('0x33')],'type':_0x15d61c[_0x64f9('0x34')][_0x64f9('0x35')]};});_0xb31d32[_0x64f9('0x36')]=_[_0x64f9('0x31')](_0x97002f,_0x64f9('0x30'));_0xb31d32[_0x64f9('0x37')]=_[_0x64f9('0x38')](_0x3d4641[_0x64f9('0x37')]);_0xb31d32['filters']=_[_0x64f9('0x39')](_0xb31d32[_0x64f9('0x36')],_0xb31d32[_0x64f9('0x37')]);_0x22319a['attributes']=_['intersection'](_0xb31d32[_0x64f9('0x36')],qs[_0x64f9('0x3a')](_0x3d4641[_0x64f9('0x37')][_0x64f9('0x3a')]));_0x22319a['attributes']=_0x22319a[_0x64f9('0x3b')][_0x64f9('0x3c')]?_0x22319a[_0x64f9('0x3b')]:_0xb31d32[_0x64f9('0x36')];if(!_0x3d4641[_0x64f9('0x37')][_0x64f9('0x3d')](_0x64f9('0x3e'))){_0x22319a['limit']=qs[_0x64f9('0x29')](_0x3d4641['query'][_0x64f9('0x29')]);_0x22319a['offset']=qs[_0x64f9('0x28')](_0x3d4641[_0x64f9('0x37')]['offset']);}_0x22319a[_0x64f9('0x3f')]=qs['sort'](_0x3d4641[_0x64f9('0x37')][_0x64f9('0x40')]);_0x22319a[_0x64f9('0x41')]=qs['filters'](_['pick'](_0x3d4641[_0x64f9('0x37')],_0xb31d32[_0x64f9('0x42')]),_0x97002f);if(_0x3d4641['query'][_0x64f9('0x43')]){_0x22319a[_0x64f9('0x41')]=_[_0x64f9('0x44')](_0x22319a[_0x64f9('0x41')],{'$or':_[_0x64f9('0x31')](_0x97002f,function(_0x1301d3){if(_0x1301d3['type']!=='VIRTUAL'){var _0x38c449={};_0x38c449[_0x1301d3[_0x64f9('0x30')]]={'$like':'%'+_0x3d4641[_0x64f9('0x37')][_0x64f9('0x43')]+'%'};return _0x38c449;}})});}_0x22319a=_[_0x64f9('0x44')]({},_0x22319a,_0x3d4641[_0x64f9('0x45')]);var _0x1a2ba6={'where':_0x22319a[_0x64f9('0x41')]};return db['VtigerConfiguration'][_0x64f9('0x27')](_0x1a2ba6)[_0x64f9('0x1a')](function(_0x56def1){_0x328f2b[_0x64f9('0x27')]=_0x56def1;if(_0x3d4641[_0x64f9('0x37')][_0x64f9('0x46')]){_0x22319a[_0x64f9('0x47')]=[{'all':!![]}];}return db[_0x64f9('0x32')][_0x64f9('0x48')](_0x22319a);})[_0x64f9('0x1a')](function(_0x2af164){_0x328f2b[_0x64f9('0x49')]=_0x2af164;return _0x328f2b;})[_0x64f9('0x1a')](respondWithFilteredResult(_0x198c78,_0x22319a))[_0x64f9('0x23')](handleError(_0x198c78,null));};exports[_0x64f9('0x4a')]=function(_0x15f213,_0x577d9c){var _0x1cf0d0={'raw':![],'where':{'id':_0x15f213[_0x64f9('0x4b')]['id']}},_0xaf64c2={};_0xaf64c2[_0x64f9('0x36')]=_['keys'](db['VtigerConfiguration'][_0x64f9('0x4c')]);_0xaf64c2[_0x64f9('0x37')]=_[_0x64f9('0x38')](_0x15f213[_0x64f9('0x37')]);_0xaf64c2[_0x64f9('0x42')]=_[_0x64f9('0x39')](_0xaf64c2[_0x64f9('0x36')],_0xaf64c2[_0x64f9('0x37')]);_0x1cf0d0[_0x64f9('0x3b')]=_[_0x64f9('0x39')](_0xaf64c2[_0x64f9('0x36')],qs[_0x64f9('0x3a')](_0x15f213[_0x64f9('0x37')][_0x64f9('0x3a')]));_0x1cf0d0['attributes']=_0x1cf0d0[_0x64f9('0x3b')][_0x64f9('0x3c')]?_0x1cf0d0[_0x64f9('0x3b')]:_0xaf64c2['model'];if(_0x15f213['query'][_0x64f9('0x46')]){_0x1cf0d0['include']=[{'all':!![]}];}_0x1cf0d0=_[_0x64f9('0x44')]({},_0x1cf0d0,_0x15f213[_0x64f9('0x45')]);return db[_0x64f9('0x32')]['find'](_0x1cf0d0)[_0x64f9('0x1a')](handleEntityNotFound(_0x577d9c,null))[_0x64f9('0x1a')](respondWithResult(_0x577d9c,null))[_0x64f9('0x23')](handleError(_0x577d9c,null));};exports[_0x64f9('0x4d')]=function(_0x27d921,_0x1146a4){return db['VtigerConfiguration'][_0x64f9('0x4d')](_0x27d921[_0x64f9('0x4e')],{})[_0x64f9('0x1a')](respondWithResult(_0x1146a4,0xc9))[_0x64f9('0x23')](handleError(_0x1146a4,null));};exports[_0x64f9('0x4f')]=function(_0x2ef276,_0x5c2c72){if(_0x2ef276['body']['id']){delete _0x2ef276[_0x64f9('0x4e')]['id'];}return db[_0x64f9('0x32')][_0x64f9('0x50')]({'where':{'id':_0x2ef276[_0x64f9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5c2c72,null))[_0x64f9('0x1a')](saveUpdates(_0x2ef276[_0x64f9('0x4e')],null))[_0x64f9('0x1a')](respondWithResult(_0x5c2c72,null))[_0x64f9('0x23')](handleError(_0x5c2c72,null));};exports[_0x64f9('0x2e')]=function(_0x1d6d8f,_0x399ab4){return db[_0x64f9('0x32')][_0x64f9('0x50')]({'where':{'id':_0x1d6d8f[_0x64f9('0x4b')]['id']}})[_0x64f9('0x1a')](handleEntityNotFound(_0x399ab4,null))[_0x64f9('0x1a')](removeEntity(_0x399ab4,null))[_0x64f9('0x23')](handleError(_0x399ab4,null));};exports['getFields']=function(_0x13894f,_0x21d962,_0x36e0ec){var _0x4301b3={};var _0x31403c={};var _0x373f37;var _0x474fd0;return db['VtigerConfiguration'][_0x64f9('0x51')]({'where':{'id':_0x13894f[_0x64f9('0x4b')]['id']}})[_0x64f9('0x1a')](handleEntityNotFound(_0x21d962,null))[_0x64f9('0x1a')](function(_0x1fab98){if(_0x1fab98){_0x373f37=_0x1fab98;_0x31403c[_0x64f9('0x36')]=_[_0x64f9('0x38')](db[_0x64f9('0x52')][_0x64f9('0x4c')]);_0x31403c[_0x64f9('0x37')]=_[_0x64f9('0x38')](_0x13894f[_0x64f9('0x37')]);_0x31403c[_0x64f9('0x42')]=_[_0x64f9('0x39')](_0x31403c[_0x64f9('0x36')],_0x31403c[_0x64f9('0x37')]);_0x4301b3['attributes']=_[_0x64f9('0x39')](_0x31403c[_0x64f9('0x36')],qs['fields'](_0x13894f[_0x64f9('0x37')][_0x64f9('0x3a')]));_0x4301b3[_0x64f9('0x3b')]=_0x4301b3['attributes'][_0x64f9('0x3c')]?_0x4301b3[_0x64f9('0x3b')]:_0x31403c[_0x64f9('0x36')];_0x4301b3[_0x64f9('0x3f')]=qs[_0x64f9('0x40')](_0x13894f['query']['sort']);_0x4301b3[_0x64f9('0x41')]=qs[_0x64f9('0x42')](_['pick'](_0x13894f[_0x64f9('0x37')],_0x31403c[_0x64f9('0x42')]));if(_0x13894f[_0x64f9('0x37')][_0x64f9('0x43')]){_0x4301b3[_0x64f9('0x41')]=_[_0x64f9('0x44')](_0x4301b3['where'],{'$or':_[_0x64f9('0x31')](_0x4301b3[_0x64f9('0x3b')],function(_0x5f22fe){var _0x49687f={};_0x49687f[_0x5f22fe]={'$like':'%'+_0x13894f[_0x64f9('0x37')][_0x64f9('0x43')]+'%'};return _0x49687f;})});}_0x4301b3=_['merge']({},_0x4301b3,_0x13894f[_0x64f9('0x45')]);return _0x373f37[_0x64f9('0x53')](_0x4301b3);}})['then'](function(_0x108833){if(_0x108833){_0x474fd0=_0x108833[_0x64f9('0x3c')];if(!_0x13894f[_0x64f9('0x37')][_0x64f9('0x3d')](_0x64f9('0x3e'))){_0x4301b3[_0x64f9('0x29')]=qs[_0x64f9('0x29')](_0x13894f['query']['limit']);_0x4301b3['offset']=qs[_0x64f9('0x28')](_0x13894f[_0x64f9('0x37')][_0x64f9('0x28')]);}return _0x373f37[_0x64f9('0x53')](_0x4301b3);}})[_0x64f9('0x1a')](function(_0x402d12){if(_0x402d12){return _0x402d12?{'count':_0x474fd0,'rows':_0x402d12}:null;}})['then'](respondWithResult(_0x21d962,null))[_0x64f9('0x23')](handleError(_0x21d962,null));};exports[_0x64f9('0x54')]=function(_0x385cfc,_0x32a20b,_0x3c99cb){var _0x313e96={};var _0x1d0e4c={};var _0x231aff;var _0x29b0b2;return db[_0x64f9('0x32')][_0x64f9('0x51')]({'where':{'id':_0x385cfc[_0x64f9('0x4b')]['id']}})[_0x64f9('0x1a')](handleEntityNotFound(_0x32a20b,null))[_0x64f9('0x1a')](function(_0x34944a){if(_0x34944a){_0x231aff=_0x34944a;_0x1d0e4c['model']=_[_0x64f9('0x38')](db[_0x64f9('0x52')][_0x64f9('0x4c')]);_0x1d0e4c[_0x64f9('0x37')]=_[_0x64f9('0x38')](_0x385cfc[_0x64f9('0x37')]);_0x1d0e4c[_0x64f9('0x42')]=_[_0x64f9('0x39')](_0x1d0e4c[_0x64f9('0x36')],_0x1d0e4c[_0x64f9('0x37')]);_0x313e96[_0x64f9('0x3b')]=_[_0x64f9('0x39')](_0x1d0e4c[_0x64f9('0x36')],qs['fields'](_0x385cfc[_0x64f9('0x37')][_0x64f9('0x3a')]));_0x313e96[_0x64f9('0x3b')]=_0x313e96['attributes'][_0x64f9('0x3c')]?_0x313e96['attributes']:_0x1d0e4c['model'];_0x313e96['order']=qs[_0x64f9('0x40')](_0x385cfc[_0x64f9('0x37')][_0x64f9('0x40')]);_0x313e96[_0x64f9('0x41')]=qs[_0x64f9('0x42')](_[_0x64f9('0x55')](_0x385cfc[_0x64f9('0x37')],_0x1d0e4c[_0x64f9('0x42')]));if(_0x385cfc[_0x64f9('0x37')][_0x64f9('0x43')]){_0x313e96[_0x64f9('0x41')]=_[_0x64f9('0x44')](_0x313e96['where'],{'$or':_[_0x64f9('0x31')](_0x313e96[_0x64f9('0x3b')],function(_0x211a89){var _0x565c02={};_0x565c02[_0x211a89]={'$like':'%'+_0x385cfc[_0x64f9('0x37')][_0x64f9('0x43')]+'%'};return _0x565c02;})});}_0x313e96=_[_0x64f9('0x44')]({},_0x313e96,_0x385cfc[_0x64f9('0x45')]);return _0x231aff['getSubjects'](_0x313e96);}})['then'](function(_0x948b94){if(_0x948b94){_0x29b0b2=_0x948b94['length'];if(!_0x385cfc['query'][_0x64f9('0x3d')](_0x64f9('0x3e'))){_0x313e96[_0x64f9('0x29')]=qs[_0x64f9('0x29')](_0x385cfc[_0x64f9('0x37')][_0x64f9('0x29')]);_0x313e96[_0x64f9('0x28')]=qs[_0x64f9('0x28')](_0x385cfc[_0x64f9('0x37')]['offset']);}return _0x231aff[_0x64f9('0x54')](_0x313e96);}})[_0x64f9('0x1a')](function(_0x3ab548){if(_0x3ab548){return _0x3ab548?{'count':_0x29b0b2,'rows':_0x3ab548}:null;}})['then'](respondWithResult(_0x32a20b,null))['catch'](handleError(_0x32a20b,null));};exports[_0x64f9('0x56')]=function(_0x574b3a,_0x749566,_0x574317){var _0x529863={};var _0x977828={};var _0x5d351d;var _0x18b718;return db[_0x64f9('0x32')]['findOne']({'where':{'id':_0x574b3a[_0x64f9('0x4b')]['id']}})[_0x64f9('0x1a')](handleEntityNotFound(_0x749566,null))[_0x64f9('0x1a')](function(_0x10208f){if(_0x10208f){_0x5d351d=_0x10208f;_0x977828['model']=_[_0x64f9('0x38')](db[_0x64f9('0x52')][_0x64f9('0x4c')]);_0x977828['query']=_[_0x64f9('0x38')](_0x574b3a['query']);_0x977828['filters']=_[_0x64f9('0x39')](_0x977828[_0x64f9('0x36')],_0x977828[_0x64f9('0x37')]);_0x529863[_0x64f9('0x3b')]=_[_0x64f9('0x39')](_0x977828[_0x64f9('0x36')],qs['fields'](_0x574b3a[_0x64f9('0x37')][_0x64f9('0x3a')]));_0x529863[_0x64f9('0x3b')]=_0x529863[_0x64f9('0x3b')][_0x64f9('0x3c')]?_0x529863[_0x64f9('0x3b')]:_0x977828[_0x64f9('0x36')];_0x529863[_0x64f9('0x3f')]=qs[_0x64f9('0x40')](_0x574b3a['query'][_0x64f9('0x40')]);_0x529863['where']=qs['filters'](_[_0x64f9('0x55')](_0x574b3a[_0x64f9('0x37')],_0x977828[_0x64f9('0x42')]));if(_0x574b3a['query'][_0x64f9('0x43')]){_0x529863['where']=_['merge'](_0x529863[_0x64f9('0x41')],{'$or':_[_0x64f9('0x31')](_0x529863[_0x64f9('0x3b')],function(_0x5200da){var _0x1014b1={};_0x1014b1[_0x5200da]={'$like':'%'+_0x574b3a[_0x64f9('0x37')][_0x64f9('0x43')]+'%'};return _0x1014b1;})});}_0x529863=_[_0x64f9('0x44')]({},_0x529863,_0x574b3a['options']);return _0x5d351d['getDescriptions'](_0x529863);}})[_0x64f9('0x1a')](function(_0x509065){if(_0x509065){_0x18b718=_0x509065[_0x64f9('0x3c')];if(!_0x574b3a[_0x64f9('0x37')]['hasOwnProperty'](_0x64f9('0x3e'))){_0x529863[_0x64f9('0x29')]=qs[_0x64f9('0x29')](_0x574b3a[_0x64f9('0x37')][_0x64f9('0x29')]);_0x529863[_0x64f9('0x28')]=qs[_0x64f9('0x28')](_0x574b3a['query'][_0x64f9('0x28')]);}return _0x5d351d[_0x64f9('0x56')](_0x529863);}})[_0x64f9('0x1a')](function(_0x2073ee){if(_0x2073ee){return _0x2073ee?{'count':_0x18b718,'rows':_0x2073ee}:null;}})[_0x64f9('0x1a')](respondWithResult(_0x749566,null))['catch'](handleError(_0x749566,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index f73962b..fc35efb 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 _0xeb23=['../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3838af,_0x54b380){var _0x473f94=function(_0x3245c9){while(--_0x3245c9){_0x3838af['push'](_0x3838af['shift']());}};_0x473f94(++_0x54b380);}(_0xeb23,0x71));var _0x3eb2=function(_0x402f88,_0xaa6ea3){_0x402f88=_0x402f88-0x0;var _0x4a7acc=_0xeb23[_0x402f88];return _0x4a7acc;};'use strict';var _=require(_0x3eb2('0x0'));var util=require('util');var logger=require(_0x3eb2('0x1'))('api');var moment=require(_0x3eb2('0x2'));var BPromise=require(_0x3eb2('0x3'));var rp=require(_0x3eb2('0x4'));var fs=require('fs');var path=require(_0x3eb2('0x5'));var rimraf=require(_0x3eb2('0x6'));var config=require(_0x3eb2('0x7'));var attributes=require(_0x3eb2('0x8'));module['exports']=function(_0x21091d,_0x1bdb46){return _0x21091d[_0x3eb2('0x9')](_0x3eb2('0xa'),attributes,{'tableName':_0x3eb2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4cd=['api','bluebird','request-promise','../../config/environment','./intVtigerConfiguration.attributes','exports','define','lodash'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd4cd,0x8f));var _0xdd4c=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0xd4cd[_0x10c16d];return _0x5896f4;};'use strict';var _=require(_0xdd4c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdd4c('0x1'));var moment=require('moment');var BPromise=require(_0xdd4c('0x2'));var rp=require(_0xdd4c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdd4c('0x4'));var attributes=require(_0xdd4c('0x5'));module[_0xdd4c('0x6')]=function(_0xddf384,_0x51e0f2){return _0xddf384[_0xdd4c('0x7')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 4255966..f00f062 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 _0x475d=['bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','stringify','code','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x4c2958,_0x4b8be6){var _0x4135ae=function(_0x1f592e){while(--_0x1f592e){_0x4c2958['push'](_0x4c2958['shift']());}};_0x4135ae(++_0x4b8be6);}(_0x475d,0x101));var _0xd475=function(_0x27c13b,_0x53d77e){_0x27c13b=_0x27c13b-0x0;var _0x1fcd94=_0x475d[_0x27c13b];return _0x1fcd94;};'use strict';var _=require(_0xd475('0x0'));var util=require(_0xd475('0x1'));var moment=require(_0xd475('0x2'));var BPromise=require(_0xd475('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd475('0x4'))['db'];var utils=require(_0xd475('0x5'));var logger=require('../../config/logger')(_0xd475('0x6'));var config=require(_0xd475('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd475('0x8')][_0xd475('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d71cb,_0x19b790,_0x331a88){return new BPromise(function(_0x52d359,_0x57c58c){return client['request'](_0x4d71cb,_0x331a88)[_0xd475('0xa')](function(_0x2d04a4){logger[_0xd475('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x19b790,_0xd475('0xc'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x19b790,_0xd475('0xc'),JSON[_0xd475('0xd')](_0x2d04a4));if(_0x2d04a4['error']){if(_0x2d04a4['error'][_0xd475('0xe')]===0x1f4){logger[_0xd475('0xf')](_0xd475('0x10'),_0x19b790,_0x2d04a4['error']['message']);return _0x57c58c(_0x2d04a4[_0xd475('0xf')][_0xd475('0x11')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x19b790,_0x2d04a4[_0xd475('0xf')][_0xd475('0x11')]);return _0x52d359(_0x2d04a4[_0xd475('0xf')][_0xd475('0x11')]);}else{logger['info'](_0xd475('0x10'),_0x19b790,'request\x20sent');_0x52d359(_0x2d04a4[_0xd475('0x12')][_0xd475('0x11')]);}})[_0xd475('0x13')](function(_0xe25519){logger[_0xd475('0xf')](_0xd475('0x10'),_0x19b790,_0xe25519);_0x57c58c(_0xe25519);});});} \ No newline at end of file +var _0xaab7=['http','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x22f9e6,_0x55e049){var _0xb47c38=function(_0x4df215){while(--_0x4df215){_0x22f9e6['push'](_0x22f9e6['shift']());}};_0xb47c38(++_0x55e049);}(_0xaab7,0x1b1));var _0x7aab=function(_0x4fbb61,_0x179e96){_0x4fbb61=_0x4fbb61-0x0;var _0x5bd5b6=_0xaab7[_0x4fbb61];return _0x5bd5b6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7aab('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7aab('0x1'));var db=require(_0x7aab('0x2'))['db'];var utils=require(_0x7aab('0x3'));var logger=require('../../config/logger')(_0x7aab('0x4'));var config=require(_0x7aab('0x5'));var jayson=require(_0x7aab('0x6'));var client=jayson[_0x7aab('0x7')][_0x7aab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4092b2,_0x581e00,_0x5c0d3d){return new BPromise(function(_0x1cd0a3,_0x511805){return client['request'](_0x4092b2,_0x5c0d3d)[_0x7aab('0x9')](function(_0x1daeef){logger[_0x7aab('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x581e00,_0x7aab('0xb'));logger[_0x7aab('0xc')](_0x7aab('0xd'),_0x581e00,'request\x20sent',JSON[_0x7aab('0xe')](_0x1daeef));if(_0x1daeef[_0x7aab('0xf')]){if(_0x1daeef[_0x7aab('0xf')][_0x7aab('0x10')]===0x1f4){logger[_0x7aab('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x581e00,_0x1daeef[_0x7aab('0xf')][_0x7aab('0x11')]);return _0x511805(_0x1daeef[_0x7aab('0xf')][_0x7aab('0x11')]);}logger[_0x7aab('0xf')](_0x7aab('0x12'),_0x581e00,_0x1daeef['error']['message']);return _0x1cd0a3(_0x1daeef[_0x7aab('0xf')]['message']);}else{logger[_0x7aab('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x581e00,_0x7aab('0xb'));_0x1cd0a3(_0x1daeef[_0x7aab('0x13')][_0x7aab('0x11')]);}})[_0x7aab('0x14')](function(_0x49bfa5){logger[_0x7aab('0xf')](_0x7aab('0x12'),_0x581e00,_0x49bfa5);_0x511805(_0x49bfa5);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4c3a4cf..f8aaa3c 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 _0xc4aa=['connect-timeout','express','Router','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','exports','multer','util','path'];(function(_0x36af2a,_0xe472fd){var _0x5cf696=function(_0x4f8cd9){while(--_0x4f8cd9){_0x36af2a['push'](_0x36af2a['shift']());}};_0x5cf696(++_0xe472fd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'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['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['destroy']);module[_0xac4a('0x10')]=router; \ No newline at end of file +var _0x326f=['show','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id'];(function(_0x1a3fdb,_0x441c53){var _0x5a8b80=function(_0x58879f){while(--_0x58879f){_0x1a3fdb['push'](_0x1a3fdb['shift']());}};_0x5a8b80(++_0x441c53);}(_0x326f,0xd1));var _0xf326=function(_0x1db5a6,_0x2cb54d){_0x1db5a6=_0x1db5a6-0x0;var _0x39e1f6=_0x326f[_0x1db5a6];return _0x39e1f6;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf326('0xd')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a3bd860..6b0740b 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 _0xf0ba=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist'];(function(_0x28158f,_0x51146d){var _0x274ae4=function(_0x223e1b){while(--_0x223e1b){_0x28158f['push'](_0x28158f['shift']());}};_0x274ae4(++_0x51146d);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0ba[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaf0b('0x0'));module[_0xaf0b('0x1')]={'type':{'type':Sequelize[_0xaf0b('0x2')](_0xaf0b('0x3'),_0xaf0b('0x4'),'customVariable',_0xaf0b('0x5'),_0xaf0b('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xaf0b('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xaf0b('0x2')]('string','variable',_0xaf0b('0x8'))},'keyContent':{'type':Sequelize[_0xaf0b('0x7')]},'idField':{'type':Sequelize[_0xaf0b('0x7')]},'nameField':{'type':Sequelize[_0xaf0b('0x7')]},'customField':{'type':Sequelize[_0xaf0b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0faf=['sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x1025b2,_0x957bd4){var _0x2d42cc=function(_0x80fb0){while(--_0x80fb0){_0x1025b2['push'](_0x1025b2['shift']());}};_0x2d42cc(++_0x957bd4);}(_0x0faf,0x132));var _0xf0fa=function(_0x4ec520,_0x15fee2){_0x4ec520=_0x4ec520-0x0;var _0xed49d7=_0x0faf[_0x4ec520];return _0xed49d7;};'use strict';var Sequelize=require(_0xf0fa('0x0'));module['exports']={'type':{'type':Sequelize[_0xf0fa('0x1')](_0xf0fa('0x2'),_0xf0fa('0x3'),_0xf0fa('0x4'),_0xf0fa('0x5'),_0xf0fa('0x6')),'defaultValue':_0xf0fa('0x2')},'content':{'type':Sequelize[_0xf0fa('0x7')]},'key':{'type':Sequelize[_0xf0fa('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xf0fa('0x2'),_0xf0fa('0x3'),_0xf0fa('0x4'))},'keyContent':{'type':Sequelize[_0xf0fa('0x7')]},'idField':{'type':Sequelize[_0xf0fa('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf0fa('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf0fa('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 86374b0..93c45b4 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 _0x0c37=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','VtigerField','include','findAll','rows','show','params','includeAll','create','catch','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0c37,0x1f1));var _0x70c3=function(_0x3899a3,_0xcb527){_0x3899a3=_0x3899a3-0x0;var _0x13e1ce=_0x0c37[_0x3899a3];return _0x13e1ce;};'use strict';var pdf=require(_0x70c3('0x0'));var emlformat=require(_0x70c3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x70c3('0x2'));var jsonpatch=require(_0x70c3('0x3'));var rp=require(_0x70c3('0x4'));var moment=require(_0x70c3('0x5'));var BPromise=require(_0x70c3('0x6'));var Mustache=require(_0x70c3('0x7'));var util=require('util');var path=require('path');var sox=require(_0x70c3('0x8'));var csv=require(_0x70c3('0x9'));var ejs=require(_0x70c3('0xa'));var fs=require('fs');var fs_extra=require(_0x70c3('0xb'));var _=require('lodash');var squel=require(_0x70c3('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x70c3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x70c3('0xe'));var Papa=require(_0x70c3('0xf'));var Redis=require(_0x70c3('0x10'));var authService=require(_0x70c3('0x11'));var qs=require(_0x70c3('0x12'));var as=require(_0x70c3('0x13'));var hardwareService=require(_0x70c3('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x70c3('0x15'));var licenseUtil=require(_0x70c3('0x16'));var db=require(_0x70c3('0x17'))['db'];function respondWithStatusCode(_0x4c5c8d,_0x182f8a){_0x182f8a=_0x182f8a||0xcc;return function(_0x256833){if(_0x256833){return _0x4c5c8d[_0x70c3('0x18')](_0x182f8a);}return _0x4c5c8d[_0x70c3('0x19')](_0x182f8a)[_0x70c3('0x1a')]();};}function respondWithResult(_0x2100d1,_0x13eabf){_0x13eabf=_0x13eabf||0xc8;return function(_0x237251){if(_0x237251){return _0x2100d1[_0x70c3('0x19')](_0x13eabf)[_0x70c3('0x1b')](_0x237251);}};}function respondWithFilteredResult(_0x3c0be5,_0xd76329){return function(_0x23e154){if(_0x23e154){var _0x2c8dfe=_0x23e154[_0x70c3('0x1c')],_0x1c5bc2=_0xd76329[_0x70c3('0x1d')],_0x27f3fc=_0xd76329[_0x70c3('0x1d')]+_0xd76329[_0x70c3('0x1e')],_0x32bfac;if(_0x27f3fc>=_0x2c8dfe){_0x27f3fc=_0x2c8dfe;_0x32bfac=0xc8;}else{_0x32bfac=0xce;}_0x3c0be5[_0x70c3('0x19')](_0x32bfac);return _0x3c0be5[_0x70c3('0x1f')](_0x70c3('0x20'),_0x1c5bc2+'-'+_0x27f3fc+'/'+_0x2c8dfe)[_0x70c3('0x1b')](_0x23e154);}return null;};}function patchUpdates(_0x3cf103){return function(_0x283039){try{jsonpatch[_0x70c3('0x21')](_0x283039,_0x3cf103,!![]);}catch(_0x50f508){return BPromise[_0x70c3('0x22')](_0x50f508);}return _0x283039[_0x70c3('0x23')]();};}function saveUpdates(_0x48fd2a,_0xe0d65d){return function(_0x3acb20){if(_0x3acb20){return _0x3acb20[_0x70c3('0x24')](_0x48fd2a)['then'](function(_0x247f4a){return _0x247f4a;});}return null;};}function removeEntity(_0x139e09,_0x46ffce){return function(_0x2e56ca){if(_0x2e56ca){return _0x2e56ca[_0x70c3('0x25')]()[_0x70c3('0x26')](function(){_0x139e09[_0x70c3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8335,_0x5de577){return function(_0x340059){if(!_0x340059){_0x5e8335[_0x70c3('0x18')](0x194);}return _0x340059;};}function handleError(_0x3d9388,_0x1e7c03){_0x1e7c03=_0x1e7c03||0x1f4;return function(_0x314bf){logger[_0x70c3('0x27')](_0x314bf['stack']);if(_0x314bf['name']){delete _0x314bf[_0x70c3('0x28')];}_0x3d9388[_0x70c3('0x19')](_0x1e7c03)[_0x70c3('0x29')](_0x314bf);};}exports['index']=function(_0x2acf7c,_0x16eacb){var _0x59857c={},_0x2e78d3={},_0x59607f={'count':0x0,'rows':[]};var _0x2c576e=_[_0x70c3('0x2a')](db['VtigerField'][_0x70c3('0x2b')],function(_0xada659){return{'name':_0xada659[_0x70c3('0x2c')],'type':_0xada659[_0x70c3('0x2d')]['key']};});_0x2e78d3[_0x70c3('0x2e')]=_[_0x70c3('0x2a')](_0x2c576e,_0x70c3('0x28'));_0x2e78d3[_0x70c3('0x2f')]=_[_0x70c3('0x30')](_0x2acf7c['query']);_0x2e78d3[_0x70c3('0x31')]=_[_0x70c3('0x32')](_0x2e78d3[_0x70c3('0x2e')],_0x2e78d3[_0x70c3('0x2f')]);_0x59857c[_0x70c3('0x33')]=_[_0x70c3('0x32')](_0x2e78d3[_0x70c3('0x2e')],qs[_0x70c3('0x34')](_0x2acf7c[_0x70c3('0x2f')][_0x70c3('0x34')]));_0x59857c[_0x70c3('0x33')]=_0x59857c[_0x70c3('0x33')][_0x70c3('0x35')]?_0x59857c[_0x70c3('0x33')]:_0x2e78d3[_0x70c3('0x2e')];if(!_0x2acf7c[_0x70c3('0x2f')][_0x70c3('0x36')]('nolimit')){_0x59857c[_0x70c3('0x1e')]=qs[_0x70c3('0x1e')](_0x2acf7c['query'][_0x70c3('0x1e')]);_0x59857c[_0x70c3('0x1d')]=qs[_0x70c3('0x1d')](_0x2acf7c[_0x70c3('0x2f')][_0x70c3('0x1d')]);}_0x59857c[_0x70c3('0x37')]=qs[_0x70c3('0x38')](_0x2acf7c[_0x70c3('0x2f')][_0x70c3('0x38')]);_0x59857c['where']=qs[_0x70c3('0x31')](_[_0x70c3('0x39')](_0x2acf7c[_0x70c3('0x2f')],_0x2e78d3[_0x70c3('0x31')]),_0x2c576e);if(_0x2acf7c[_0x70c3('0x2f')][_0x70c3('0x3a')]){_0x59857c[_0x70c3('0x3b')]=_['merge'](_0x59857c[_0x70c3('0x3b')],{'$or':_[_0x70c3('0x2a')](_0x2c576e,function(_0x523cff){if(_0x523cff[_0x70c3('0x2d')]!==_0x70c3('0x3c')){var _0x2e9236={};_0x2e9236[_0x523cff['name']]={'$like':'%'+_0x2acf7c[_0x70c3('0x2f')][_0x70c3('0x3a')]+'%'};return _0x2e9236;}})});}_0x59857c=_[_0x70c3('0x3d')]({},_0x59857c,_0x2acf7c[_0x70c3('0x3e')]);var _0x371576={'where':_0x59857c['where']};return db[_0x70c3('0x3f')][_0x70c3('0x1c')](_0x371576)[_0x70c3('0x26')](function(_0x58a8ce){_0x59607f[_0x70c3('0x1c')]=_0x58a8ce;if(_0x2acf7c[_0x70c3('0x2f')]['includeAll']){_0x59857c[_0x70c3('0x40')]=[{'all':!![]}];}return db[_0x70c3('0x3f')][_0x70c3('0x41')](_0x59857c);})['then'](function(_0x5edc44){_0x59607f[_0x70c3('0x42')]=_0x5edc44;return _0x59607f;})['then'](respondWithFilteredResult(_0x16eacb,_0x59857c))['catch'](handleError(_0x16eacb,null));};exports[_0x70c3('0x43')]=function(_0x59720f,_0x1bfaca){var _0x16d519={'raw':!![],'where':{'id':_0x59720f[_0x70c3('0x44')]['id']}},_0x393b35={};_0x393b35[_0x70c3('0x2e')]=_[_0x70c3('0x30')](db[_0x70c3('0x3f')][_0x70c3('0x2b')]);_0x393b35[_0x70c3('0x2f')]=_[_0x70c3('0x30')](_0x59720f[_0x70c3('0x2f')]);_0x393b35[_0x70c3('0x31')]=_[_0x70c3('0x32')](_0x393b35[_0x70c3('0x2e')],_0x393b35['query']);_0x16d519['attributes']=_[_0x70c3('0x32')](_0x393b35['model'],qs[_0x70c3('0x34')](_0x59720f['query'][_0x70c3('0x34')]));_0x16d519[_0x70c3('0x33')]=_0x16d519[_0x70c3('0x33')][_0x70c3('0x35')]?_0x16d519[_0x70c3('0x33')]:_0x393b35[_0x70c3('0x2e')];if(_0x59720f[_0x70c3('0x2f')][_0x70c3('0x45')]){_0x16d519[_0x70c3('0x40')]=[{'all':!![]}];}_0x16d519=_[_0x70c3('0x3d')]({},_0x16d519,_0x59720f[_0x70c3('0x3e')]);return db['VtigerField']['find'](_0x16d519)['then'](handleEntityNotFound(_0x1bfaca,null))[_0x70c3('0x26')](respondWithResult(_0x1bfaca,null))['catch'](handleError(_0x1bfaca,null));};exports[_0x70c3('0x46')]=function(_0x473601,_0x2a05d2){return db[_0x70c3('0x3f')][_0x70c3('0x46')](_0x473601['body'],{})['then'](respondWithResult(_0x2a05d2,0xc9))[_0x70c3('0x47')](handleError(_0x2a05d2,null));};exports[_0x70c3('0x24')]=function(_0x291fce,_0x21ddc3){if(_0x291fce[_0x70c3('0x48')]['id']){delete _0x291fce[_0x70c3('0x48')]['id'];}return db[_0x70c3('0x3f')][_0x70c3('0x49')]({'where':{'id':_0x291fce[_0x70c3('0x44')]['id']}})[_0x70c3('0x26')](handleEntityNotFound(_0x21ddc3,null))['then'](saveUpdates(_0x291fce[_0x70c3('0x48')],null))[_0x70c3('0x26')](respondWithResult(_0x21ddc3,null))[_0x70c3('0x47')](handleError(_0x21ddc3,null));};exports[_0x70c3('0x25')]=function(_0x509f1b,_0xd5634a){return db[_0x70c3('0x3f')][_0x70c3('0x49')]({'where':{'id':_0x509f1b[_0x70c3('0x44')]['id']}})[_0x70c3('0x26')](handleEntityNotFound(_0xd5634a,null))['then'](removeEntity(_0xd5634a,null))['catch'](handleError(_0xd5634a,null));}; \ No newline at end of file +var _0x1567=['key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','map','type','VIRTUAL','count','includeAll','findAll','rows','catch','params','keys','include','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','set','Content-Range','reject','save','update','then','destroy','error','name','send','VtigerField','fieldName'];(function(_0x2316fa,_0x1cdcb3){var _0x5259e7=function(_0x139566){while(--_0x139566){_0x2316fa['push'](_0x2316fa['shift']());}};_0x5259e7(++_0x1cdcb3);}(_0x1567,0x184));var _0x7156=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x1567[_0x3e5086];return _0xfeb102;};'use strict';var pdf=require(_0x7156('0x0'));var emlformat=require(_0x7156('0x1'));var rimraf=require(_0x7156('0x2'));var zipdir=require(_0x7156('0x3'));var jsonpatch=require(_0x7156('0x4'));var rp=require('request-promise');var moment=require(_0x7156('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7156('0x6'));var path=require('path');var sox=require(_0x7156('0x7'));var csv=require(_0x7156('0x8'));var ejs=require(_0x7156('0x9'));var fs=require('fs');var fs_extra=require(_0x7156('0xa'));var _=require(_0x7156('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7156('0xc'));var deskjs=require(_0x7156('0xd'));var toCsv=require(_0x7156('0x8'));var querystring=require('querystring');var Papa=require(_0x7156('0xe'));var Redis=require(_0x7156('0xf'));var authService=require(_0x7156('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7156('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7156('0x12'))(_0x7156('0x13'));var utils=require('../../config/utils');var config=require(_0x7156('0x14'));var licenseUtil=require(_0x7156('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20df30,_0x599617){_0x599617=_0x599617||0xcc;return function(_0x2fa75c){if(_0x2fa75c){return _0x20df30[_0x7156('0x16')](_0x599617);}return _0x20df30['status'](_0x599617)[_0x7156('0x17')]();};}function respondWithResult(_0x5e649a,_0x98de53){_0x98de53=_0x98de53||0xc8;return function(_0x42085c){if(_0x42085c){return _0x5e649a[_0x7156('0x18')](_0x98de53)[_0x7156('0x19')](_0x42085c);}};}function respondWithFilteredResult(_0x525b2d,_0x486aac){return function(_0x57c690){if(_0x57c690){var _0x225b5f=_0x57c690['count'],_0x23fec1=_0x486aac['offset'],_0x51cbeb=_0x486aac['offset']+_0x486aac['limit'],_0x32bbe3;if(_0x51cbeb>=_0x225b5f){_0x51cbeb=_0x225b5f;_0x32bbe3=0xc8;}else{_0x32bbe3=0xce;}_0x525b2d[_0x7156('0x18')](_0x32bbe3);return _0x525b2d[_0x7156('0x1a')](_0x7156('0x1b'),_0x23fec1+'-'+_0x51cbeb+'/'+_0x225b5f)[_0x7156('0x19')](_0x57c690);}return null;};}function patchUpdates(_0x450d08){return function(_0x7adcac){try{jsonpatch['apply'](_0x7adcac,_0x450d08,!![]);}catch(_0x42e387){return BPromise[_0x7156('0x1c')](_0x42e387);}return _0x7adcac[_0x7156('0x1d')]();};}function saveUpdates(_0x440c31,_0x57ce7e){return function(_0x11679d){if(_0x11679d){return _0x11679d[_0x7156('0x1e')](_0x440c31)[_0x7156('0x1f')](function(_0x1411bf){return _0x1411bf;});}return null;};}function removeEntity(_0x6c5fd4,_0x153b29){return function(_0x56bb3e){if(_0x56bb3e){return _0x56bb3e[_0x7156('0x20')]()['then'](function(){_0x6c5fd4[_0x7156('0x18')](0xcc)[_0x7156('0x17')]();});}};}function handleEntityNotFound(_0x573a7e,_0xd3ed43){return function(_0x2fae9d){if(!_0x2fae9d){_0x573a7e[_0x7156('0x16')](0x194);}return _0x2fae9d;};}function handleError(_0x1bdc2b,_0x57f7a5){_0x57f7a5=_0x57f7a5||0x1f4;return function(_0x177e18){logger[_0x7156('0x21')](_0x177e18['stack']);if(_0x177e18[_0x7156('0x22')]){delete _0x177e18[_0x7156('0x22')];}_0x1bdc2b[_0x7156('0x18')](_0x57f7a5)[_0x7156('0x23')](_0x177e18);};}exports['index']=function(_0x2a7b41,_0x12725d){var _0x1f3e21={},_0x4509c5={},_0x5ce32e={'count':0x0,'rows':[]};var _0x31a1e5=_['map'](db[_0x7156('0x24')]['rawAttributes'],function(_0x1487dd){return{'name':_0x1487dd[_0x7156('0x25')],'type':_0x1487dd['type'][_0x7156('0x26')]};});_0x4509c5['model']=_['map'](_0x31a1e5,'name');_0x4509c5[_0x7156('0x27')]=_['keys'](_0x2a7b41[_0x7156('0x27')]);_0x4509c5[_0x7156('0x28')]=_[_0x7156('0x29')](_0x4509c5[_0x7156('0x2a')],_0x4509c5[_0x7156('0x27')]);_0x1f3e21[_0x7156('0x2b')]=_[_0x7156('0x29')](_0x4509c5[_0x7156('0x2a')],qs[_0x7156('0x2c')](_0x2a7b41[_0x7156('0x27')][_0x7156('0x2c')]));_0x1f3e21[_0x7156('0x2b')]=_0x1f3e21[_0x7156('0x2b')][_0x7156('0x2d')]?_0x1f3e21['attributes']:_0x4509c5['model'];if(!_0x2a7b41[_0x7156('0x27')][_0x7156('0x2e')](_0x7156('0x2f'))){_0x1f3e21[_0x7156('0x30')]=qs[_0x7156('0x30')](_0x2a7b41[_0x7156('0x27')][_0x7156('0x30')]);_0x1f3e21[_0x7156('0x31')]=qs[_0x7156('0x31')](_0x2a7b41[_0x7156('0x27')]['offset']);}_0x1f3e21[_0x7156('0x32')]=qs['sort'](_0x2a7b41['query'][_0x7156('0x33')]);_0x1f3e21[_0x7156('0x34')]=qs[_0x7156('0x28')](_[_0x7156('0x35')](_0x2a7b41[_0x7156('0x27')],_0x4509c5['filters']),_0x31a1e5);if(_0x2a7b41[_0x7156('0x27')][_0x7156('0x36')]){_0x1f3e21['where']=_[_0x7156('0x37')](_0x1f3e21['where'],{'$or':_[_0x7156('0x38')](_0x31a1e5,function(_0x301f30){if(_0x301f30[_0x7156('0x39')]!==_0x7156('0x3a')){var _0x306f6e={};_0x306f6e[_0x301f30['name']]={'$like':'%'+_0x2a7b41[_0x7156('0x27')][_0x7156('0x36')]+'%'};return _0x306f6e;}})});}_0x1f3e21=_['merge']({},_0x1f3e21,_0x2a7b41['options']);var _0x2208d5={'where':_0x1f3e21[_0x7156('0x34')]};return db['VtigerField'][_0x7156('0x3b')](_0x2208d5)[_0x7156('0x1f')](function(_0x1556ae){_0x5ce32e[_0x7156('0x3b')]=_0x1556ae;if(_0x2a7b41[_0x7156('0x27')][_0x7156('0x3c')]){_0x1f3e21['include']=[{'all':!![]}];}return db['VtigerField'][_0x7156('0x3d')](_0x1f3e21);})[_0x7156('0x1f')](function(_0x2a1e19){_0x5ce32e[_0x7156('0x3e')]=_0x2a1e19;return _0x5ce32e;})['then'](respondWithFilteredResult(_0x12725d,_0x1f3e21))[_0x7156('0x3f')](handleError(_0x12725d,null));};exports['show']=function(_0x1d7edd,_0xd26a55){var _0x1c5596={'raw':!![],'where':{'id':_0x1d7edd[_0x7156('0x40')]['id']}},_0x363eba={};_0x363eba[_0x7156('0x2a')]=_[_0x7156('0x41')](db[_0x7156('0x24')]['rawAttributes']);_0x363eba['query']=_[_0x7156('0x41')](_0x1d7edd['query']);_0x363eba['filters']=_[_0x7156('0x29')](_0x363eba[_0x7156('0x2a')],_0x363eba[_0x7156('0x27')]);_0x1c5596[_0x7156('0x2b')]=_[_0x7156('0x29')](_0x363eba[_0x7156('0x2a')],qs[_0x7156('0x2c')](_0x1d7edd['query'][_0x7156('0x2c')]));_0x1c5596['attributes']=_0x1c5596[_0x7156('0x2b')]['length']?_0x1c5596[_0x7156('0x2b')]:_0x363eba[_0x7156('0x2a')];if(_0x1d7edd[_0x7156('0x27')][_0x7156('0x3c')]){_0x1c5596[_0x7156('0x42')]=[{'all':!![]}];}_0x1c5596=_[_0x7156('0x37')]({},_0x1c5596,_0x1d7edd[_0x7156('0x43')]);return db[_0x7156('0x24')][_0x7156('0x44')](_0x1c5596)[_0x7156('0x1f')](handleEntityNotFound(_0xd26a55,null))['then'](respondWithResult(_0xd26a55,null))['catch'](handleError(_0xd26a55,null));};exports[_0x7156('0x45')]=function(_0x632913,_0x1d919c){return db[_0x7156('0x24')][_0x7156('0x45')](_0x632913[_0x7156('0x46')],{})[_0x7156('0x1f')](respondWithResult(_0x1d919c,0xc9))[_0x7156('0x3f')](handleError(_0x1d919c,null));};exports[_0x7156('0x1e')]=function(_0x5c6e37,_0x527ab0){if(_0x5c6e37[_0x7156('0x46')]['id']){delete _0x5c6e37[_0x7156('0x46')]['id'];}return db[_0x7156('0x24')]['find']({'where':{'id':_0x5c6e37[_0x7156('0x40')]['id']}})[_0x7156('0x1f')](handleEntityNotFound(_0x527ab0,null))['then'](saveUpdates(_0x5c6e37[_0x7156('0x46')],null))[_0x7156('0x1f')](respondWithResult(_0x527ab0,null))[_0x7156('0x3f')](handleError(_0x527ab0,null));};exports[_0x7156('0x20')]=function(_0x111000,_0x7de9ec){return db[_0x7156('0x24')][_0x7156('0x44')]({'where':{'id':_0x111000[_0x7156('0x40')]['id']}})[_0x7156('0x1f')](handleEntityNotFound(_0x7de9ec,null))[_0x7156('0x1f')](removeEntity(_0x7de9ec,null))[_0x7156('0x3f')](handleError(_0x7de9ec,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index a452f71..f787037 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 _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x260fc2,_0x1ebd89){var _0x4a8571=function(_0x4a01ff){while(--_0x4a01ff){_0x260fc2['push'](_0x260fc2['shift']());}};_0x4a8571(++_0x1ebd89);}(_0x7a54,0x106));var _0x47a5=function(_0x1f3457,_0x4ceceb){_0x1f3457=_0x1f3457-0x0;var _0x236ea9=_0x7a54[_0x1f3457];return _0x236ea9;};'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':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0xc61485,_0x16aca2){var _0x1aab10=function(_0x3bd9d7){while(--_0x3bd9d7){_0xc61485['push'](_0xc61485['shift']());}};_0x1aab10(++_0x16aca2);}(_0x7a54,0x106));var _0x47a5=function(_0x4a7bc0,_0x31eb40){_0x4a7bc0=_0x4a7bc0-0x0;var _0x485842=_0x7a54[_0x4a7bc0];return _0x485842;};'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':'vtiger_unique_index','fields':[_0x47a5('0xc'),'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 8c29212..c5d6e0a 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 _0xf12a=['info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf12a,0x8e));var _0xaf12=function(_0x405aeb,_0x5ee732){_0x405aeb=_0x405aeb-0x0;var _0x50e76a=_0xf12a[_0x405aeb];return _0x50e76a;};'use strict';var _=require(_0xaf12('0x0'));var util=require(_0xaf12('0x1'));var moment=require(_0xaf12('0x2'));var BPromise=require(_0xaf12('0x3'));var rs=require(_0xaf12('0x4'));var fs=require('fs');var Redis=require(_0xaf12('0x5'));var db=require(_0xaf12('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaf12('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf12('0x8'));var client=jayson['client'][_0xaf12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x581819,_0x38389d,_0x418c64){return new BPromise(function(_0x3b6626,_0xff1952){return client[_0xaf12('0xa')](_0x581819,_0x418c64)[_0xaf12('0xb')](function(_0x3d733d){logger[_0xaf12('0xc')]('VtigerField,\x20%s,\x20%s',_0x38389d,_0xaf12('0xd'));logger['debug'](_0xaf12('0xe'),_0x38389d,'request\x20sent',JSON[_0xaf12('0xf')](_0x3d733d));if(_0x3d733d['error']){if(_0x3d733d['error'][_0xaf12('0x10')]===0x1f4){logger[_0xaf12('0x11')](_0xaf12('0x12'),_0x38389d,_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);return _0xff1952(_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);}logger[_0xaf12('0x11')](_0xaf12('0x12'),_0x38389d,_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);return _0x3b6626(_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);}else{logger[_0xaf12('0xc')](_0xaf12('0x12'),_0x38389d,_0xaf12('0xd'));_0x3b6626(_0x3d733d[_0xaf12('0x14')]['message']);}})[_0xaf12('0x15')](function(_0x31a420){logger['error']('VtigerField,\x20%s,\x20%s',_0x38389d,_0x31a420);_0xff1952(_0x31a420);});});} \ No newline at end of file +var _0xd71d=['request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xc4f5d1,_0x42f9df){var _0x54d2de=function(_0x2c479e){while(--_0x2c479e){_0xc4f5d1['push'](_0xc4f5d1['shift']());}};_0x54d2de(++_0x42f9df);}(_0xd71d,0x1a5));var _0xdd71=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0xd71d[_0x1b25c1];return _0x1e4447;};'use strict';var _=require(_0xdd71('0x0'));var util=require(_0xdd71('0x1'));var moment=require(_0xdd71('0x2'));var BPromise=require(_0xdd71('0x3'));var rs=require(_0xdd71('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd71('0x5'))['db'];var utils=require(_0xdd71('0x6'));var logger=require(_0xdd71('0x7'))('rpc');var config=require(_0xdd71('0x8'));var jayson=require(_0xdd71('0x9'));var client=jayson[_0xdd71('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12d8a7,_0x28ec99,_0x2b3698){return new BPromise(function(_0x147f9e,_0x53be67){return client[_0xdd71('0xb')](_0x12d8a7,_0x2b3698)[_0xdd71('0xc')](function(_0x900933){logger[_0xdd71('0xd')](_0xdd71('0xe'),_0x28ec99,'request\x20sent');logger[_0xdd71('0xf')](_0xdd71('0x10'),_0x28ec99,_0xdd71('0x11'),JSON[_0xdd71('0x12')](_0x900933));if(_0x900933['error']){if(_0x900933[_0xdd71('0x13')][_0xdd71('0x14')]===0x1f4){logger[_0xdd71('0x13')](_0xdd71('0xe'),_0x28ec99,_0x900933[_0xdd71('0x13')][_0xdd71('0x15')]);return _0x53be67(_0x900933['error'][_0xdd71('0x15')]);}logger[_0xdd71('0x13')](_0xdd71('0xe'),_0x28ec99,_0x900933[_0xdd71('0x13')]['message']);return _0x147f9e(_0x900933[_0xdd71('0x13')][_0xdd71('0x15')]);}else{logger[_0xdd71('0xd')](_0xdd71('0xe'),_0x28ec99,_0xdd71('0x11'));_0x147f9e(_0x900933[_0xdd71('0x16')][_0xdd71('0x15')]);}})[_0xdd71('0x17')](function(_0x389ce1){logger[_0xdd71('0x13')](_0xdd71('0xe'),_0x28ec99,_0x389ce1);_0x53be67(_0x389ce1);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 86245fc..18e2396 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 _0x5a99=['destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','getConfigurations','/:id/fields','create','/:id/configurations','addConfiguration','put','update'];(function(_0xc0ac,_0x91375f){var _0x35490a=function(_0xf53b7d){while(--_0xf53b7d){_0xc0ac['push'](_0xc0ac['shift']());}};_0x35490a(++_0x91375f);}(_0x5a99,0xc9));var _0x95a9=function(_0x173964,_0x3f7ec6){_0x173964=_0x173964-0x0;var _0x1cba27=_0x5a99[_0x173964];return _0x1cba27;};'use strict';var multer=require(_0x95a9('0x0'));var util=require(_0x95a9('0x1'));var path=require(_0x95a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x95a9('0x3'));var router=express[_0x95a9('0x4')]();var fs_extra=require(_0x95a9('0x5'));var auth=require(_0x95a9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x95a9('0x7'));var controller=require(_0x95a9('0x8'));router[_0x95a9('0x9')]('/',auth[_0x95a9('0xa')](),controller['index']);router[_0x95a9('0x9')](_0x95a9('0xb'),auth[_0x95a9('0xa')](),controller['show']);router[_0x95a9('0x9')]('/:id/configurations',auth[_0x95a9('0xa')](),controller[_0x95a9('0xc')]);router[_0x95a9('0x9')](_0x95a9('0xd'),auth[_0x95a9('0xa')](),controller['getFields']);router['post']('/',auth[_0x95a9('0xa')](),controller[_0x95a9('0xe')]);router['post'](_0x95a9('0xf'),auth['isAuthenticated'](),controller[_0x95a9('0x10')]);router[_0x95a9('0x11')](_0x95a9('0xb'),auth[_0x95a9('0xa')](),controller[_0x95a9('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x95a9('0x13')]);module['exports']=router; \ No newline at end of file +var _0xee4a=['fs-extra','../../components/interaction/service','./intZendeskAccount.controller','isAuthenticated','get','/:id','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','exports','multer','path','connect-timeout','express'];(function(_0x4706a6,_0x5a1c63){var _0x1bb705=function(_0x484ebb){while(--_0x484ebb){_0x4706a6['push'](_0x4706a6['shift']());}};_0x1bb705(++_0x5a1c63);}(_0xee4a,0x9e));var _0xaee4=function(_0x2da14d,_0x3d158f){_0x2da14d=_0x2da14d-0x0;var _0x129d97=_0xee4a[_0x2da14d];return _0x129d97;};'use strict';var multer=require(_0xaee4('0x0'));var util=require('util');var path=require(_0xaee4('0x1'));var timeout=require(_0xaee4('0x2'));var express=require(_0xaee4('0x3'));var router=express['Router']();var fs_extra=require(_0xaee4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaee4('0x5'));var config=require('../../config/environment');var controller=require(_0xaee4('0x6'));router['get']('/',auth[_0xaee4('0x7')](),controller['index']);router[_0xaee4('0x8')](_0xaee4('0x9'),auth[_0xaee4('0x7')](),controller['show']);router[_0xaee4('0x8')](_0xaee4('0xa'),auth['isAuthenticated'](),controller[_0xaee4('0xb')]);router[_0xaee4('0x8')](_0xaee4('0xc'),auth[_0xaee4('0x7')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xaee4('0xd')]);router[_0xaee4('0xe')](_0xaee4('0xa'),auth[_0xaee4('0x7')](),controller[_0xaee4('0xf')]);router[_0xaee4('0x10')](_0xaee4('0x9'),auth[_0xaee4('0x7')](),controller['update']);router['delete'](_0xaee4('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xaee4('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index e4bae0c..32882dc 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 _0xd122=['integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM','password','token'];(function(_0x1a705d,_0x2eeefa){var _0x575083=function(_0xd58372){while(--_0xd58372){_0x1a705d['push'](_0x1a705d['shift']());}};_0x575083(++_0x2eeefa);}(_0xd122,0x9b));var _0x2d12=function(_0x4c7f76,_0x56bb63){_0x4c7f76=_0x4c7f76-0x0;var _0x56c186=_0xd122[_0x4c7f76];return _0x56c186;};'use strict';var Sequelize=require(_0x2d12('0x0'));module['exports']={'name':{'type':Sequelize[_0x2d12('0x1')]},'description':{'type':Sequelize[_0x2d12('0x1')]},'username':{'type':Sequelize[_0x2d12('0x1')],'unique':_0x2d12('0x2')},'password':{'type':Sequelize[_0x2d12('0x1')]},'token':{'type':Sequelize[_0x2d12('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2d12('0x3')},'authType':{'type':Sequelize[_0x2d12('0x4')](_0x2d12('0x5'),_0x2d12('0x6')),'defaultValue':_0x2d12('0x5')},'serverUrl':{'type':Sequelize[_0x2d12('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2d12('0x4')](_0x2d12('0x7'),_0x2d12('0x8')),'defaultValue':_0x2d12('0x7')}}; \ No newline at end of file +var _0x554a=['username','ENUM','password','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x3f2bcb,_0x3f4b4b){var _0x161176=function(_0x40ab68){while(--_0x40ab68){_0x3f2bcb['push'](_0x3f2bcb['shift']());}};_0x161176(++_0x3f4b4b);}(_0x554a,0xcd));var _0xa554=function(_0x19466c,_0x1911d5){_0x19466c=_0x19466c-0x0;var _0x3a39ac=_0x554a[_0x19466c];return _0x3a39ac;};'use strict';var Sequelize=require(_0xa554('0x0'));module[_0xa554('0x1')]={'name':{'type':Sequelize[_0xa554('0x2')]},'description':{'type':Sequelize[_0xa554('0x2')]},'username':{'type':Sequelize[_0xa554('0x2')],'unique':_0xa554('0x3')},'password':{'type':Sequelize[_0xa554('0x2')]},'token':{'type':Sequelize[_0xa554('0x2')]},'remoteUri':{'type':Sequelize[_0xa554('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xa554('0x4')](_0xa554('0x5'),'token'),'defaultValue':_0xa554('0x5')},'serverUrl':{'type':Sequelize[_0xa554('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa554('0x6'),_0xa554('0x7')),'defaultValue':_0xa554('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index df2778b..9febbcd 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 _0x425d=['client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','ZendeskAccount','includeAll','findAll','rows','show','keys','include','options','find','create','body','findOne','params','length','getConfigurations','hasOwnProperty','addConfiguration','getSubjects','channel','Descriptions','ZendeskConfiguration','ZendeskField','getFields','username','token','authType','remoteUri','slice','lastIndexOf','format','ticket_fields','password','headers','%s:%s','toString','Basic\x20%s','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','html-pdf','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','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','jayson/promise'];(function(_0x14ebbe,_0x2f6ced){var _0x335147=function(_0x57d9bf){while(--_0x57d9bf){_0x14ebbe['push'](_0x14ebbe['shift']());}};_0x335147(++_0x2f6ced);}(_0x425d,0x1e0));var _0xd425=function(_0x4298ed,_0x38e24c){_0x4298ed=_0x4298ed-0x0;var _0x206ec4=_0x425d[_0x4298ed];return _0x206ec4;};'use strict';var pdf=require(_0xd425('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd425('0x1'));var zipdir=require(_0xd425('0x2'));var jsonpatch=require(_0xd425('0x3'));var rp=require(_0xd425('0x4'));var moment=require(_0xd425('0x5'));var BPromise=require(_0xd425('0x6'));var Mustache=require(_0xd425('0x7'));var util=require('util');var path=require(_0xd425('0x8'));var sox=require(_0xd425('0x9'));var csv=require(_0xd425('0xa'));var ejs=require(_0xd425('0xb'));var fs=require('fs');var fs_extra=require(_0xd425('0xc'));var _=require(_0xd425('0xd'));var squel=require('squel');var crypto=require(_0xd425('0xe'));var jsforce=require(_0xd425('0xf'));var deskjs=require(_0xd425('0x10'));var toCsv=require(_0xd425('0xa'));var querystring=require(_0xd425('0x11'));var Papa=require(_0xd425('0x12'));var Redis=require(_0xd425('0x13'));var authService=require(_0xd425('0x14'));var qs=require(_0xd425('0x15'));var as=require(_0xd425('0x16'));var hardwareService=require(_0xd425('0x17'));var logger=require(_0xd425('0x18'))(_0xd425('0x19'));var utils=require(_0xd425('0x1a'));var config=require(_0xd425('0x1b'));var licenseUtil=require(_0xd425('0x1c'));var db=require(_0xd425('0x1d'))['db'];var integrations=require(_0xd425('0x1e'));var jayson=require(_0xd425('0x1f'));var client=jayson[_0xd425('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27318c,_0x17a498,_0x336dc3,_0x5d3d60){return new BPromise(function(_0x309263,_0x2e2e4e){var _0x643fd2=_0x5d3d60||client;return _0x643fd2[_0xd425('0x21')](_0x27318c,_0x336dc3)[_0xd425('0x22')](function(_0x538a0a){logger[_0xd425('0x23')](_0xd425('0x24'),_0x17a498,_0xd425('0x25'));logger[_0xd425('0x26')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x17a498,_0xd425('0x25'),JSON[_0xd425('0x27')](_0x538a0a));if(_0x538a0a[_0xd425('0x28')]){if(_0x538a0a[_0xd425('0x28')]['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x17a498,_0x538a0a['error'][_0xd425('0x29')]);return _0x2e2e4e(_0x538a0a[_0xd425('0x28')][_0xd425('0x29')]);}logger['error'](_0xd425('0x24'),_0x17a498,_0x538a0a[_0xd425('0x28')]['message']);return _0x309263(_0x538a0a[_0xd425('0x28')][_0xd425('0x29')]);}else{logger[_0xd425('0x23')](_0xd425('0x24'),_0x17a498,_0xd425('0x25'));_0x309263(_0x538a0a[_0xd425('0x2a')][_0xd425('0x29')]);}})[_0xd425('0x2b')](function(_0x314201){logger[_0xd425('0x28')](_0xd425('0x24'),_0x17a498,_0x314201);_0x2e2e4e(_0x314201);});});}function respondWithStatusCode(_0x40e84b,_0x47f44a){_0x47f44a=_0x47f44a||0xcc;return function(_0x369b5b){if(_0x369b5b){return _0x40e84b[_0xd425('0x2c')](_0x47f44a);}return _0x40e84b[_0xd425('0x2d')](_0x47f44a)[_0xd425('0x2e')]();};}function respondWithResult(_0x2afcdb,_0x400dd7){_0x400dd7=_0x400dd7||0xc8;return function(_0x3c3402){if(_0x3c3402){return _0x2afcdb['status'](_0x400dd7)[_0xd425('0x2f')](_0x3c3402);}};}function respondWithFilteredResult(_0x177de2,_0x1d8861){return function(_0x57c950){if(_0x57c950){var _0x27ef8a=_0x57c950[_0xd425('0x30')],_0x3ad9bd=_0x1d8861[_0xd425('0x31')],_0x433189=_0x1d8861[_0xd425('0x31')]+_0x1d8861[_0xd425('0x32')],_0x999fb9;if(_0x433189>=_0x27ef8a){_0x433189=_0x27ef8a;_0x999fb9=0xc8;}else{_0x999fb9=0xce;}_0x177de2[_0xd425('0x2d')](_0x999fb9);return _0x177de2[_0xd425('0x33')]('Content-Range',_0x3ad9bd+'-'+_0x433189+'/'+_0x27ef8a)[_0xd425('0x2f')](_0x57c950);}return null;};}function patchUpdates(_0x219ada){return function(_0x298602){try{jsonpatch[_0xd425('0x34')](_0x298602,_0x219ada,!![]);}catch(_0x3275b1){return BPromise[_0xd425('0x35')](_0x3275b1);}return _0x298602[_0xd425('0x36')]();};}function saveUpdates(_0x40c392,_0x3ec51b){return function(_0x3342bb){if(_0x3342bb){return _0x3342bb[_0xd425('0x37')](_0x40c392)['then'](function(_0x316493){return _0x316493;});}return null;};}function removeEntity(_0x2a2a9b,_0x3120a4){return function(_0x21e0bd){if(_0x21e0bd){return _0x21e0bd[_0xd425('0x38')]()['then'](function(){_0x2a2a9b[_0xd425('0x2d')](0xcc)[_0xd425('0x2e')]();});}};}function handleEntityNotFound(_0x4cfcd1,_0x574962){return function(_0x51669d){if(!_0x51669d){_0x4cfcd1[_0xd425('0x2c')](0x194);}return _0x51669d;};}function handleError(_0xfb0c8,_0x167179){_0x167179=_0x167179||0x1f4;return function(_0x2d586f){logger['error'](_0x2d586f[_0xd425('0x39')]);if(_0x2d586f[_0xd425('0x3a')]){delete _0x2d586f[_0xd425('0x3a')];}_0xfb0c8[_0xd425('0x2d')](_0x167179)[_0xd425('0x3b')](_0x2d586f);};}exports[_0xd425('0x3c')]=function(_0x35bbec,_0x533af1){var _0x363fb0={},_0x59b3d3={},_0x22df81={'count':0x0,'rows':[]};var _0x29cca9=_[_0xd425('0x3d')](db['ZendeskAccount'][_0xd425('0x3e')],function(_0x26806c){return{'name':_0x26806c[_0xd425('0x3f')],'type':_0x26806c[_0xd425('0x40')]['key']};});_0x59b3d3[_0xd425('0x41')]=_[_0xd425('0x3d')](_0x29cca9,'name');_0x59b3d3['query']=_['keys'](_0x35bbec[_0xd425('0x42')]);_0x59b3d3[_0xd425('0x43')]=_[_0xd425('0x44')](_0x59b3d3['model'],_0x59b3d3['query']);_0x363fb0['attributes']=_[_0xd425('0x44')](_0x59b3d3[_0xd425('0x41')],qs[_0xd425('0x45')](_0x35bbec[_0xd425('0x42')][_0xd425('0x45')]));_0x363fb0[_0xd425('0x46')]=_0x363fb0[_0xd425('0x46')]['length']?_0x363fb0[_0xd425('0x46')]:_0x59b3d3[_0xd425('0x41')];if(!_0x35bbec[_0xd425('0x42')]['hasOwnProperty'](_0xd425('0x47'))){_0x363fb0[_0xd425('0x32')]=qs[_0xd425('0x32')](_0x35bbec['query'][_0xd425('0x32')]);_0x363fb0[_0xd425('0x31')]=qs[_0xd425('0x31')](_0x35bbec[_0xd425('0x42')]['offset']);}_0x363fb0[_0xd425('0x48')]=qs[_0xd425('0x49')](_0x35bbec[_0xd425('0x42')][_0xd425('0x49')]);_0x363fb0[_0xd425('0x4a')]=qs[_0xd425('0x43')](_[_0xd425('0x4b')](_0x35bbec['query'],_0x59b3d3[_0xd425('0x43')]),_0x29cca9);if(_0x35bbec[_0xd425('0x42')]['filter']){_0x363fb0[_0xd425('0x4a')]=_['merge'](_0x363fb0['where'],{'$or':_[_0xd425('0x3d')](_0x29cca9,function(_0x59e893){if(_0x59e893[_0xd425('0x40')]!=='VIRTUAL'){var _0x448829={};_0x448829[_0x59e893[_0xd425('0x3a')]]={'$like':'%'+_0x35bbec[_0xd425('0x42')][_0xd425('0x4c')]+'%'};return _0x448829;}})});}_0x363fb0=_[_0xd425('0x4d')]({},_0x363fb0,_0x35bbec['options']);var _0x2e4b21={'where':_0x363fb0['where']};return db[_0xd425('0x4e')]['count'](_0x2e4b21)[_0xd425('0x22')](function(_0x16f61c){_0x22df81[_0xd425('0x30')]=_0x16f61c;if(_0x35bbec[_0xd425('0x42')][_0xd425('0x4f')]){_0x363fb0['include']=[{'all':!![]}];}return db[_0xd425('0x4e')][_0xd425('0x50')](_0x363fb0);})[_0xd425('0x22')](function(_0x4091a7){_0x22df81[_0xd425('0x51')]=_0x4091a7;return _0x22df81;})['then'](respondWithFilteredResult(_0x533af1,_0x363fb0))[_0xd425('0x2b')](handleError(_0x533af1,null));};exports[_0xd425('0x52')]=function(_0x1450f2,_0x2a2ab4){var _0x34cd86={'raw':![],'where':{'id':_0x1450f2['params']['id']}},_0xf7a74c={};_0xf7a74c[_0xd425('0x41')]=_[_0xd425('0x53')](db['ZendeskAccount'][_0xd425('0x3e')]);_0xf7a74c[_0xd425('0x42')]=_[_0xd425('0x53')](_0x1450f2[_0xd425('0x42')]);_0xf7a74c['filters']=_[_0xd425('0x44')](_0xf7a74c[_0xd425('0x41')],_0xf7a74c[_0xd425('0x42')]);_0x34cd86[_0xd425('0x46')]=_[_0xd425('0x44')](_0xf7a74c['model'],qs['fields'](_0x1450f2[_0xd425('0x42')]['fields']));_0x34cd86[_0xd425('0x46')]=_0x34cd86[_0xd425('0x46')]['length']?_0x34cd86[_0xd425('0x46')]:_0xf7a74c['model'];if(_0x1450f2['query'][_0xd425('0x4f')]){_0x34cd86[_0xd425('0x54')]=[{'all':!![]}];}_0x34cd86=_[_0xd425('0x4d')]({},_0x34cd86,_0x1450f2[_0xd425('0x55')]);return db[_0xd425('0x4e')][_0xd425('0x56')](_0x34cd86)[_0xd425('0x22')](handleEntityNotFound(_0x2a2ab4,null))[_0xd425('0x22')](respondWithResult(_0x2a2ab4,null))['catch'](handleError(_0x2a2ab4,null));};exports[_0xd425('0x57')]=function(_0x1c6141,_0x1be9bb){return db[_0xd425('0x4e')][_0xd425('0x57')](_0x1c6141[_0xd425('0x58')],{})[_0xd425('0x22')](respondWithResult(_0x1be9bb,0xc9))[_0xd425('0x2b')](handleError(_0x1be9bb,null));};exports['update']=function(_0x4a2508,_0x47976d){if(_0x4a2508[_0xd425('0x58')]['id']){delete _0x4a2508[_0xd425('0x58')]['id'];}return db[_0xd425('0x4e')][_0xd425('0x56')]({'where':{'id':_0x4a2508['params']['id']}})['then'](handleEntityNotFound(_0x47976d,null))['then'](saveUpdates(_0x4a2508['body'],null))[_0xd425('0x22')](respondWithResult(_0x47976d,null))[_0xd425('0x2b')](handleError(_0x47976d,null));};exports['destroy']=function(_0x43cb49,_0x29ba4f){return db[_0xd425('0x4e')]['find']({'where':{'id':_0x43cb49['params']['id']}})[_0xd425('0x22')](handleEntityNotFound(_0x29ba4f,null))['then'](removeEntity(_0x29ba4f,null))['catch'](handleError(_0x29ba4f,null));};exports['getConfigurations']=function(_0x4458bc,_0x259482,_0x22b00e){var _0x5b2323={};var _0x3395d8={};var _0x48bd20;var _0x1158ac;return db[_0xd425('0x4e')][_0xd425('0x59')]({'where':{'id':_0x4458bc[_0xd425('0x5a')]['id']}})[_0xd425('0x22')](handleEntityNotFound(_0x259482,null))[_0xd425('0x22')](function(_0xa21f7c){if(_0xa21f7c){_0x48bd20=_0xa21f7c;_0x3395d8[_0xd425('0x41')]=_[_0xd425('0x53')](db['ZendeskConfiguration'][_0xd425('0x3e')]);_0x3395d8[_0xd425('0x42')]=_[_0xd425('0x53')](_0x4458bc[_0xd425('0x42')]);_0x3395d8['filters']=_['intersection'](_0x3395d8[_0xd425('0x41')],_0x3395d8[_0xd425('0x42')]);_0x5b2323[_0xd425('0x46')]=_[_0xd425('0x44')](_0x3395d8[_0xd425('0x41')],qs[_0xd425('0x45')](_0x4458bc[_0xd425('0x42')][_0xd425('0x45')]));_0x5b2323[_0xd425('0x46')]=_0x5b2323[_0xd425('0x46')][_0xd425('0x5b')]?_0x5b2323[_0xd425('0x46')]:_0x3395d8[_0xd425('0x41')];_0x5b2323[_0xd425('0x48')]=qs['sort'](_0x4458bc[_0xd425('0x42')][_0xd425('0x49')]);_0x5b2323[_0xd425('0x4a')]=qs['filters'](_['pick'](_0x4458bc['query'],_0x3395d8[_0xd425('0x43')]));if(_0x4458bc[_0xd425('0x42')][_0xd425('0x4c')]){_0x5b2323['where']=_[_0xd425('0x4d')](_0x5b2323['where'],{'$or':_[_0xd425('0x3d')](_0x5b2323[_0xd425('0x46')],function(_0x21d26e){var _0x5113fc={};_0x5113fc[_0x21d26e]={'$like':'%'+_0x4458bc[_0xd425('0x42')][_0xd425('0x4c')]+'%'};return _0x5113fc;})});}_0x5b2323=_[_0xd425('0x4d')]({},_0x5b2323,_0x4458bc[_0xd425('0x55')]);return _0x48bd20[_0xd425('0x5c')](_0x5b2323);}})[_0xd425('0x22')](function(_0x38a762){if(_0x38a762){_0x1158ac=_0x38a762[_0xd425('0x5b')];if(!_0x4458bc[_0xd425('0x42')][_0xd425('0x5d')](_0xd425('0x47'))){_0x5b2323[_0xd425('0x32')]=qs[_0xd425('0x32')](_0x4458bc[_0xd425('0x42')][_0xd425('0x32')]);_0x5b2323[_0xd425('0x31')]=qs[_0xd425('0x31')](_0x4458bc[_0xd425('0x42')]['offset']);}return _0x48bd20['getConfigurations'](_0x5b2323);}})[_0xd425('0x22')](function(_0x5c333a){if(_0x5c333a){return _0x5c333a?{'count':_0x1158ac,'rows':_0x5c333a}:null;}})[_0xd425('0x22')](respondWithResult(_0x259482,null))[_0xd425('0x2b')](handleError(_0x259482,null));};exports[_0xd425('0x5e')]=function(_0x1ae1e3,_0x4c7000,_0x3187ca){if(_0x1ae1e3[_0xd425('0x58')]['id']){delete _0x1ae1e3[_0xd425('0x58')]['id'];}return db[_0xd425('0x4e')][_0xd425('0x59')]({'where':{'id':_0x1ae1e3[_0xd425('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4c7000,null))['then'](function(_0x3ccffe){if(_0x3ccffe){_0x1ae1e3[_0xd425('0x58')]['AccountId']=_0x3ccffe['id'];_0x1ae1e3[_0xd425('0x58')]['Subjects']=integrations[_0xd425('0x5f')](_0x1ae1e3[_0xd425('0x58')][_0xd425('0x60')],_0x1ae1e3[_0xd425('0x58')][_0xd425('0x40')]);_0x1ae1e3[_0xd425('0x58')][_0xd425('0x61')]=integrations['getDescriptions'](_0x1ae1e3[_0xd425('0x58')][_0xd425('0x60')],_0x1ae1e3[_0xd425('0x58')][_0xd425('0x40')]);return db[_0xd425('0x62')]['create'](_0x1ae1e3[_0xd425('0x58')],{'include':[{'model':db[_0xd425('0x63')],'as':'Subjects'},{'model':db[_0xd425('0x63')],'as':_0xd425('0x61')}]});}return null;})['then'](respondWithResult(_0x4c7000,null))[_0xd425('0x2b')](handleError(_0x4c7000,null));};exports[_0xd425('0x64')]=function(_0x74d30b,_0xd923bb,_0x1b0cef){var _0x572f23='';return db[_0xd425('0x4e')]['findOne']({'where':{'id':_0x74d30b[_0xd425('0x5a')]['id']},'attributes':['id',_0xd425('0x65'),'password',_0xd425('0x66'),_0xd425('0x67'),_0xd425('0x68')]})[_0xd425('0x22')](handleEntityNotFound(_0xd923bb,null))['then'](function(_0x4f5fc5){if(_0x4f5fc5){_0x572f23=_0x4f5fc5[_0xd425('0x68')];var _0x2312c1=_0x572f23[_0xd425('0x69')](-0x1);if(_0x2312c1==='/'){_0x572f23=_0x572f23['substring'](0x0,_0x572f23[_0xd425('0x6a')](_0x2312c1));}var _0xb1479e={'method':'GET','uri':util[_0xd425('0x6b')]('%s/%s',_0x572f23,_0xd425('0x6c')),'json':!![]};switch(_0x4f5fc5[_0xd425('0x67')]){case _0xd425('0x6d'):_0xb1479e[_0xd425('0x6e')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xd425('0x6b')](_0xd425('0x6f'),_0x4f5fc5['username'],_0x4f5fc5[_0xd425('0x6d')]))[_0xd425('0x70')]('base64'))};break;case _0xd425('0x66'):_0xb1479e[_0xd425('0x6e')]={'Authorization':util[_0xd425('0x6b')](_0xd425('0x71'),new Buffer(util[_0xd425('0x6b')](_0xd425('0x72'),_0x4f5fc5[_0xd425('0x65')],_0x4f5fc5['token']))['toString'](_0xd425('0x73')))};break;default:throw new db['Sequelize'][(_0xd425('0x74'))](_0xd425('0x75'));}return rp(_0xb1479e);}})['then'](function(_0x244789){if(_0x244789){var _0x1c1c77=['subject','description',_0xd425('0x76'),_0xd425('0x77')];_[_0xd425('0x78')](_0x244789[_0xd425('0x6c')],function(_0x247b01){return _0x1c1c77[_0xd425('0x79')](_0x247b01[_0xd425('0x40')]);});return{'count':_0x244789[_0xd425('0x6c')]['length'],'rows':_[_0xd425('0x3d')](_0x244789[_0xd425('0x6c')],function(_0x5759a5){return{'id':_0x5759a5['id'],'name':_0x5759a5[_0xd425('0x7a')]>0x7?_0x5759a5[_0xd425('0x7b')]:_0x5759a5[_0xd425('0x40')],'custom':_0x5759a5[_0xd425('0x7a')]>0x7?!![]:![],'options':_0x5759a5[_0xd425('0x7c')]?_0x5759a5[_0xd425('0x7c')]:_0x5759a5[_0xd425('0x7d')]?_0x5759a5[_0xd425('0x7d')]:[]};})};}})[_0xd425('0x22')](respondWithResult(_0xd923bb,null))[_0xd425('0x2b')](function(_0x14cebc){var _0x572452=_0x74d30b[_0xd425('0x42')]['test']?0x1f4:_0x14cebc['statusCode']||0x1f4;logger[_0xd425('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xd425('0x64'),_0x572452,JSON[_0xd425('0x27')](_0x14cebc));delete _0x14cebc[_0xd425('0x3a')];if(_0x572452===0x191){_0x572452=0x190;}_0xd923bb[_0xd425('0x2d')](_0x572452)[_0xd425('0x3b')](_0x74d30b[_0xd425('0x42')][_0xd425('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x14cebc[_0xd425('0x7f')]}:_0x14cebc);});}; \ No newline at end of file +var _0x50a6=['show','params','find','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','order','sort','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','ZendeskField','username','password','remoteUri','substring','format','%s/%s','ticket_fields','authType','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','token','ValidationError','Unknown\x20authentication\x20type','description','group','remove','includes','position','title','system_field_options','custom_field_options','statusCode','test','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','request','info','ZendeskAccount,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','filters','filter','where','merge','VIRTUAL','options','ZendeskAccount','count','includeAll','include','rows'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x50a6,0xa4));var _0x650a=function(_0x2e26e0,_0x59fc69){_0x2e26e0=_0x2e26e0-0x0;var _0x432020=_0x50a6[_0x2e26e0];return _0x432020;};'use strict';var pdf=require(_0x650a('0x0'));var emlformat=require(_0x650a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x650a('0x2'));var rp=require('request-promise');var moment=require(_0x650a('0x3'));var BPromise=require(_0x650a('0x4'));var Mustache=require(_0x650a('0x5'));var util=require('util');var path=require(_0x650a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x650a('0x7'));var fs=require('fs');var fs_extra=require(_0x650a('0x8'));var _=require(_0x650a('0x9'));var squel=require(_0x650a('0xa'));var crypto=require('crypto');var jsforce=require(_0x650a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x650a('0xc'));var querystring=require(_0x650a('0xd'));var Papa=require('papaparse');var Redis=require(_0x650a('0xe'));var authService=require(_0x650a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x650a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x650a('0x11'))('api');var utils=require(_0x650a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x650a('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x650a('0x14'));var jayson=require(_0x650a('0x15'));var client=jayson[_0x650a('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10fb8f,_0x3919a7,_0x2f727d,_0x15f2fd){return new BPromise(function(_0x35c6dc,_0x24f11f){var _0x5b7c74=_0x15f2fd||client;return _0x5b7c74[_0x650a('0x17')](_0x10fb8f,_0x2f727d)['then'](function(_0x1f94ab){logger[_0x650a('0x18')](_0x650a('0x19'),_0x3919a7,'request\x20sent');logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x3919a7,'request\x20sent',JSON[_0x650a('0x1a')](_0x1f94ab));if(_0x1f94ab[_0x650a('0x1b')]){if(_0x1f94ab[_0x650a('0x1b')][_0x650a('0x1c')]===0x1f4){logger[_0x650a('0x1b')]('ZendeskAccount,\x20%s,\x20%s',_0x3919a7,_0x1f94ab['error'][_0x650a('0x1d')]);return _0x24f11f(_0x1f94ab[_0x650a('0x1b')]['message']);}logger[_0x650a('0x1b')](_0x650a('0x19'),_0x3919a7,_0x1f94ab['error'][_0x650a('0x1d')]);return _0x35c6dc(_0x1f94ab[_0x650a('0x1b')][_0x650a('0x1d')]);}else{logger[_0x650a('0x18')](_0x650a('0x19'),_0x3919a7,'request\x20sent');_0x35c6dc(_0x1f94ab[_0x650a('0x1e')]['message']);}})[_0x650a('0x1f')](function(_0x1d471d){logger[_0x650a('0x1b')](_0x650a('0x19'),_0x3919a7,_0x1d471d);_0x24f11f(_0x1d471d);});});}function respondWithStatusCode(_0x2ed256,_0x326d60){_0x326d60=_0x326d60||0xcc;return function(_0x40117a){if(_0x40117a){return _0x2ed256[_0x650a('0x20')](_0x326d60);}return _0x2ed256[_0x650a('0x21')](_0x326d60)[_0x650a('0x22')]();};}function respondWithResult(_0xa902e6,_0x234fce){_0x234fce=_0x234fce||0xc8;return function(_0xd89a9e){if(_0xd89a9e){return _0xa902e6[_0x650a('0x21')](_0x234fce)[_0x650a('0x23')](_0xd89a9e);}};}function respondWithFilteredResult(_0x39a155,_0x15b876){return function(_0x12fdb4){if(_0x12fdb4){var _0x4c1df6=_0x12fdb4['count'],_0x2290a7=_0x15b876[_0x650a('0x24')],_0x34ce04=_0x15b876[_0x650a('0x24')]+_0x15b876[_0x650a('0x25')],_0x558002;if(_0x34ce04>=_0x4c1df6){_0x34ce04=_0x4c1df6;_0x558002=0xc8;}else{_0x558002=0xce;}_0x39a155[_0x650a('0x21')](_0x558002);return _0x39a155[_0x650a('0x26')](_0x650a('0x27'),_0x2290a7+'-'+_0x34ce04+'/'+_0x4c1df6)['json'](_0x12fdb4);}return null;};}function patchUpdates(_0x190a65){return function(_0x1c8621){try{jsonpatch[_0x650a('0x28')](_0x1c8621,_0x190a65,!![]);}catch(_0x18c197){return BPromise[_0x650a('0x29')](_0x18c197);}return _0x1c8621[_0x650a('0x2a')]();};}function saveUpdates(_0x436e28,_0x12b86a){return function(_0x5d322b){if(_0x5d322b){return _0x5d322b[_0x650a('0x2b')](_0x436e28)[_0x650a('0x2c')](function(_0x2e0370){return _0x2e0370;});}return null;};}function removeEntity(_0x5123c9,_0x12d846){return function(_0x1c0770){if(_0x1c0770){return _0x1c0770['destroy']()[_0x650a('0x2c')](function(){_0x5123c9[_0x650a('0x21')](0xcc)[_0x650a('0x22')]();});}};}function handleEntityNotFound(_0x50ad29,_0x5b4a47){return function(_0x4d5c30){if(!_0x4d5c30){_0x50ad29[_0x650a('0x20')](0x194);}return _0x4d5c30;};}function handleError(_0x27a067,_0x446f5d){_0x446f5d=_0x446f5d||0x1f4;return function(_0x475d20){logger['error'](_0x475d20[_0x650a('0x2d')]);if(_0x475d20[_0x650a('0x2e')]){delete _0x475d20['name'];}_0x27a067[_0x650a('0x21')](_0x446f5d)[_0x650a('0x2f')](_0x475d20);};}exports[_0x650a('0x30')]=function(_0xd2256b,_0x384e1c){var _0x4ada6a={},_0x14260e={},_0x4ccb6f={'count':0x0,'rows':[]};var _0x268333=_[_0x650a('0x31')](db['ZendeskAccount'][_0x650a('0x32')],function(_0xa0e8ec){return{'name':_0xa0e8ec['fieldName'],'type':_0xa0e8ec[_0x650a('0x33')][_0x650a('0x34')]};});_0x14260e[_0x650a('0x35')]=_['map'](_0x268333,_0x650a('0x2e'));_0x14260e[_0x650a('0x36')]=_[_0x650a('0x37')](_0xd2256b[_0x650a('0x36')]);_0x14260e['filters']=_[_0x650a('0x38')](_0x14260e[_0x650a('0x35')],_0x14260e[_0x650a('0x36')]);_0x4ada6a['attributes']=_['intersection'](_0x14260e[_0x650a('0x35')],qs[_0x650a('0x39')](_0xd2256b['query'][_0x650a('0x39')]));_0x4ada6a['attributes']=_0x4ada6a[_0x650a('0x3a')][_0x650a('0x3b')]?_0x4ada6a[_0x650a('0x3a')]:_0x14260e[_0x650a('0x35')];if(!_0xd2256b[_0x650a('0x36')]['hasOwnProperty'](_0x650a('0x3c'))){_0x4ada6a['limit']=qs[_0x650a('0x25')](_0xd2256b[_0x650a('0x36')][_0x650a('0x25')]);_0x4ada6a[_0x650a('0x24')]=qs[_0x650a('0x24')](_0xd2256b[_0x650a('0x36')][_0x650a('0x24')]);}_0x4ada6a['order']=qs['sort'](_0xd2256b[_0x650a('0x36')]['sort']);_0x4ada6a['where']=qs[_0x650a('0x3d')](_['pick'](_0xd2256b[_0x650a('0x36')],_0x14260e['filters']),_0x268333);if(_0xd2256b[_0x650a('0x36')][_0x650a('0x3e')]){_0x4ada6a[_0x650a('0x3f')]=_[_0x650a('0x40')](_0x4ada6a[_0x650a('0x3f')],{'$or':_[_0x650a('0x31')](_0x268333,function(_0x3bcb5c){if(_0x3bcb5c[_0x650a('0x33')]!==_0x650a('0x41')){var _0x25c0a2={};_0x25c0a2[_0x3bcb5c[_0x650a('0x2e')]]={'$like':'%'+_0xd2256b[_0x650a('0x36')]['filter']+'%'};return _0x25c0a2;}})});}_0x4ada6a=_[_0x650a('0x40')]({},_0x4ada6a,_0xd2256b[_0x650a('0x42')]);var _0x2ca163={'where':_0x4ada6a[_0x650a('0x3f')]};return db[_0x650a('0x43')][_0x650a('0x44')](_0x2ca163)['then'](function(_0x2c692b){_0x4ccb6f[_0x650a('0x44')]=_0x2c692b;if(_0xd2256b[_0x650a('0x36')][_0x650a('0x45')]){_0x4ada6a[_0x650a('0x46')]=[{'all':!![]}];}return db[_0x650a('0x43')]['findAll'](_0x4ada6a);})['then'](function(_0x3a0a9b){_0x4ccb6f[_0x650a('0x47')]=_0x3a0a9b;return _0x4ccb6f;})[_0x650a('0x2c')](respondWithFilteredResult(_0x384e1c,_0x4ada6a))['catch'](handleError(_0x384e1c,null));};exports[_0x650a('0x48')]=function(_0x5b360a,_0x6a0321){var _0x1f6454={'raw':![],'where':{'id':_0x5b360a[_0x650a('0x49')]['id']}},_0x492e70={};_0x492e70[_0x650a('0x35')]=_[_0x650a('0x37')](db['ZendeskAccount'][_0x650a('0x32')]);_0x492e70[_0x650a('0x36')]=_[_0x650a('0x37')](_0x5b360a['query']);_0x492e70[_0x650a('0x3d')]=_[_0x650a('0x38')](_0x492e70[_0x650a('0x35')],_0x492e70[_0x650a('0x36')]);_0x1f6454[_0x650a('0x3a')]=_['intersection'](_0x492e70['model'],qs[_0x650a('0x39')](_0x5b360a[_0x650a('0x36')]['fields']));_0x1f6454[_0x650a('0x3a')]=_0x1f6454[_0x650a('0x3a')][_0x650a('0x3b')]?_0x1f6454[_0x650a('0x3a')]:_0x492e70[_0x650a('0x35')];if(_0x5b360a[_0x650a('0x36')]['includeAll']){_0x1f6454[_0x650a('0x46')]=[{'all':!![]}];}_0x1f6454=_[_0x650a('0x40')]({},_0x1f6454,_0x5b360a[_0x650a('0x42')]);return db[_0x650a('0x43')][_0x650a('0x4a')](_0x1f6454)['then'](handleEntityNotFound(_0x6a0321,null))[_0x650a('0x2c')](respondWithResult(_0x6a0321,null))[_0x650a('0x1f')](handleError(_0x6a0321,null));};exports[_0x650a('0x4b')]=function(_0x23a504,_0x5d3059){return db['ZendeskAccount'][_0x650a('0x4b')](_0x23a504[_0x650a('0x4c')],{})['then'](respondWithResult(_0x5d3059,0xc9))[_0x650a('0x1f')](handleError(_0x5d3059,null));};exports[_0x650a('0x2b')]=function(_0x2020bf,_0x99febb){if(_0x2020bf[_0x650a('0x4c')]['id']){delete _0x2020bf[_0x650a('0x4c')]['id'];}return db[_0x650a('0x43')][_0x650a('0x4a')]({'where':{'id':_0x2020bf[_0x650a('0x49')]['id']}})[_0x650a('0x2c')](handleEntityNotFound(_0x99febb,null))[_0x650a('0x2c')](saveUpdates(_0x2020bf[_0x650a('0x4c')],null))[_0x650a('0x2c')](respondWithResult(_0x99febb,null))[_0x650a('0x1f')](handleError(_0x99febb,null));};exports[_0x650a('0x4d')]=function(_0x4daef0,_0x5d271b){return db[_0x650a('0x43')][_0x650a('0x4a')]({'where':{'id':_0x4daef0['params']['id']}})['then'](handleEntityNotFound(_0x5d271b,null))[_0x650a('0x2c')](removeEntity(_0x5d271b,null))['catch'](handleError(_0x5d271b,null));};exports[_0x650a('0x4e')]=function(_0x5c44e5,_0x5e0148,_0x1b2a4a){var _0x508e45={};var _0x449dbf={};var _0x308419;var _0x522445;return db[_0x650a('0x43')][_0x650a('0x4f')]({'where':{'id':_0x5c44e5[_0x650a('0x49')]['id']}})[_0x650a('0x2c')](handleEntityNotFound(_0x5e0148,null))[_0x650a('0x2c')](function(_0x2e7347){if(_0x2e7347){_0x308419=_0x2e7347;_0x449dbf['model']=_[_0x650a('0x37')](db[_0x650a('0x50')][_0x650a('0x32')]);_0x449dbf['query']=_[_0x650a('0x37')](_0x5c44e5[_0x650a('0x36')]);_0x449dbf[_0x650a('0x3d')]=_['intersection'](_0x449dbf['model'],_0x449dbf[_0x650a('0x36')]);_0x508e45[_0x650a('0x3a')]=_['intersection'](_0x449dbf[_0x650a('0x35')],qs[_0x650a('0x39')](_0x5c44e5[_0x650a('0x36')][_0x650a('0x39')]));_0x508e45[_0x650a('0x3a')]=_0x508e45[_0x650a('0x3a')]['length']?_0x508e45[_0x650a('0x3a')]:_0x449dbf[_0x650a('0x35')];_0x508e45[_0x650a('0x51')]=qs['sort'](_0x5c44e5[_0x650a('0x36')][_0x650a('0x52')]);_0x508e45['where']=qs[_0x650a('0x3d')](_['pick'](_0x5c44e5[_0x650a('0x36')],_0x449dbf['filters']));if(_0x5c44e5[_0x650a('0x36')][_0x650a('0x3e')]){_0x508e45['where']=_[_0x650a('0x40')](_0x508e45[_0x650a('0x3f')],{'$or':_[_0x650a('0x31')](_0x508e45[_0x650a('0x3a')],function(_0x3205e4){var _0x3bd508={};_0x3bd508[_0x3205e4]={'$like':'%'+_0x5c44e5[_0x650a('0x36')][_0x650a('0x3e')]+'%'};return _0x3bd508;})});}_0x508e45=_[_0x650a('0x40')]({},_0x508e45,_0x5c44e5[_0x650a('0x42')]);return _0x308419[_0x650a('0x4e')](_0x508e45);}})[_0x650a('0x2c')](function(_0xba1b88){if(_0xba1b88){_0x522445=_0xba1b88['length'];if(!_0x5c44e5['query'][_0x650a('0x53')]('nolimit')){_0x508e45[_0x650a('0x25')]=qs[_0x650a('0x25')](_0x5c44e5[_0x650a('0x36')][_0x650a('0x25')]);_0x508e45[_0x650a('0x24')]=qs[_0x650a('0x24')](_0x5c44e5['query'][_0x650a('0x24')]);}return _0x308419['getConfigurations'](_0x508e45);}})[_0x650a('0x2c')](function(_0x430b0f){if(_0x430b0f){return _0x430b0f?{'count':_0x522445,'rows':_0x430b0f}:null;}})[_0x650a('0x2c')](respondWithResult(_0x5e0148,null))[_0x650a('0x1f')](handleError(_0x5e0148,null));};exports[_0x650a('0x54')]=function(_0x4aba06,_0x3442df,_0x1fa4a9){if(_0x4aba06[_0x650a('0x4c')]['id']){delete _0x4aba06[_0x650a('0x4c')]['id'];}return db[_0x650a('0x43')][_0x650a('0x4f')]({'where':{'id':_0x4aba06[_0x650a('0x49')]['id']}})[_0x650a('0x2c')](handleEntityNotFound(_0x3442df,null))[_0x650a('0x2c')](function(_0x50f24){if(_0x50f24){_0x4aba06['body']['AccountId']=_0x50f24['id'];_0x4aba06['body'][_0x650a('0x55')]=integrations[_0x650a('0x56')](_0x4aba06['body'][_0x650a('0x57')],_0x4aba06[_0x650a('0x4c')][_0x650a('0x33')]);_0x4aba06['body'][_0x650a('0x58')]=integrations['getDescriptions'](_0x4aba06[_0x650a('0x4c')][_0x650a('0x57')],_0x4aba06[_0x650a('0x4c')][_0x650a('0x33')]);return db[_0x650a('0x50')]['create'](_0x4aba06['body'],{'include':[{'model':db[_0x650a('0x59')],'as':_0x650a('0x55')},{'model':db[_0x650a('0x59')],'as':'Descriptions'}]});}return null;})[_0x650a('0x2c')](respondWithResult(_0x3442df,null))['catch'](handleError(_0x3442df,null));};exports['getFields']=function(_0x3767e1,_0x409f8b,_0x383fb3){var _0x39b2d2='';return db[_0x650a('0x43')]['findOne']({'where':{'id':_0x3767e1[_0x650a('0x49')]['id']},'attributes':['id',_0x650a('0x5a'),_0x650a('0x5b'),'token','authType',_0x650a('0x5c')]})['then'](handleEntityNotFound(_0x409f8b,null))['then'](function(_0x48b3f4){if(_0x48b3f4){_0x39b2d2=_0x48b3f4[_0x650a('0x5c')];var _0x588b88=_0x39b2d2['slice'](-0x1);if(_0x588b88==='/'){_0x39b2d2=_0x39b2d2[_0x650a('0x5d')](0x0,_0x39b2d2['lastIndexOf'](_0x588b88));}var _0x120b3a={'method':'GET','uri':util[_0x650a('0x5e')](_0x650a('0x5f'),_0x39b2d2,_0x650a('0x60')),'json':!![]};switch(_0x48b3f4[_0x650a('0x61')]){case'password':_0x120b3a[_0x650a('0x62')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x650a('0x5e')](_0x650a('0x63'),_0x48b3f4[_0x650a('0x5a')],_0x48b3f4[_0x650a('0x5b')]))[_0x650a('0x64')](_0x650a('0x65')))};break;case'token':_0x120b3a[_0x650a('0x62')]={'Authorization':util[_0x650a('0x5e')](_0x650a('0x66'),new Buffer(util['format'](_0x650a('0x67'),_0x48b3f4[_0x650a('0x5a')],_0x48b3f4[_0x650a('0x68')]))[_0x650a('0x64')](_0x650a('0x65')))};break;default:throw new db['Sequelize'][(_0x650a('0x69'))](_0x650a('0x6a'));}return rp(_0x120b3a);}})['then'](function(_0x471c9c){if(_0x471c9c){var _0x547a08=['subject',_0x650a('0x6b'),_0x650a('0x6c'),'assignee'];_[_0x650a('0x6d')](_0x471c9c[_0x650a('0x60')],function(_0x3b28a3){return _0x547a08[_0x650a('0x6e')](_0x3b28a3[_0x650a('0x33')]);});return{'count':_0x471c9c[_0x650a('0x60')]['length'],'rows':_[_0x650a('0x31')](_0x471c9c[_0x650a('0x60')],function(_0x3b6218){return{'id':_0x3b6218['id'],'name':_0x3b6218[_0x650a('0x6f')]>0x7?_0x3b6218[_0x650a('0x70')]:_0x3b6218[_0x650a('0x33')],'custom':_0x3b6218['position']>0x7?!![]:![],'options':_0x3b6218[_0x650a('0x71')]?_0x3b6218[_0x650a('0x71')]:_0x3b6218[_0x650a('0x72')]?_0x3b6218[_0x650a('0x72')]:[]};})};}})[_0x650a('0x2c')](respondWithResult(_0x409f8b,null))[_0x650a('0x1f')](function(_0x4bd0f1){var _0x16914f=_0x3767e1[_0x650a('0x36')]['test']?0x1f4:_0x4bd0f1[_0x650a('0x73')]||0x1f4;logger[_0x650a('0x1b')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x16914f,JSON['stringify'](_0x4bd0f1));delete _0x4bd0f1[_0x650a('0x2e')];if(_0x16914f===0x191){_0x16914f=0x190;}_0x409f8b[_0x650a('0x21')](_0x16914f)[_0x650a('0x2f')](_0x3767e1['query'][_0x650a('0x74')]?{'message':_0x650a('0x75'),'statusCode':_0x4bd0f1[_0x650a('0x73')]}:_0x4bd0f1);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index da53732..115d391 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 _0x7d9f=['../../config/logger','api','moment','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash'];(function(_0x217aeb,_0x26446e){var _0x3a0222=function(_0x14f3f9){while(--_0x14f3f9){_0x217aeb['push'](_0x217aeb['shift']());}};_0x3a0222(++_0x26446e);}(_0x7d9f,0x117));var _0xf7d9=function(_0x3b6668,_0x3b3c41){_0x3b6668=_0x3b6668-0x0;var _0x4e47e6=_0x7d9f[_0x3b6668];return _0x4e47e6;};'use strict';var _=require(_0xf7d9('0x0'));var util=require('util');var logger=require(_0xf7d9('0x1'))(_0xf7d9('0x2'));var moment=require(_0xf7d9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf7d9('0x4'));var config=require(_0xf7d9('0x5'));var attributes=require(_0xf7d9('0x6'));var integrations=require(_0xf7d9('0x7'));module[_0xf7d9('0x8')]=function(_0x4cdc5f,_0x2de49d){return _0x4cdc5f[_0xf7d9('0x9')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0787=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x11b948,_0x109cf1){var _0x26db1b=function(_0x5d0326){while(--_0x5d0326){_0x11b948['push'](_0x11b948['shift']());}};_0x26db1b(++_0x109cf1);}(_0x0787,0xf0));var _0x7078=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0x0787[_0x12ca5f];return _0xfc3ae9;};'use strict';var _=require('lodash');var util=require(_0x7078('0x0'));var logger=require(_0x7078('0x1'))(_0x7078('0x2'));var moment=require(_0x7078('0x3'));var BPromise=require(_0x7078('0x4'));var rp=require(_0x7078('0x5'));var fs=require('fs');var path=require(_0x7078('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7078('0x7'));var integrations=require(_0x7078('0x8'));module[_0x7078('0x9')]=function(_0x2fa4db,_0x19ae5a){return _0x2fa4db[_0x7078('0xa')](_0x7078('0xb'),attributes,{'tableName':_0x7078('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 2dda14a..9c7543b 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 _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x21d96f,_0x58f607){var _0x5010d7=function(_0x30b8a4){while(--_0x30b8a4){_0x21d96f['push'](_0x21d96f['shift']());}};_0x5010d7(++_0x58f607);}(_0xe706,0xa3));var _0x6e70=function(_0xbbbeae,_0x4a414a){_0xbbbeae=_0xbbbeae-0x0;var _0x1cb9c9=_0xe706[_0xbbbeae];return _0x1cb9c9;};'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']('ZendeskAccount,\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']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file +var _0xb7e7=['request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x35a876,_0x21b00){var _0x278531=function(_0x39261a){while(--_0x39261a){_0x35a876['push'](_0x35a876['shift']());}};_0x278531(++_0x21b00);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xb7e7[_0x1da04e];return _0xdd8c41;};'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')]('ZendeskAccount,\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);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetZendeskAccount',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['ZendeskAccount'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowZendeskAccount',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index e37a630..bc8a104 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 _0x1f30=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index'];(function(_0x54bfa9,_0x424d55){var _0x160e13=function(_0xc77cb8){while(--_0xc77cb8){_0x54bfa9['push'](_0x54bfa9['shift']());}};_0x160e13(++_0x424d55);}(_0x1f30,0x109));var _0x01f3=function(_0x4e6089,_0x5a7ee5){_0x4e6089=_0x4e6089-0x0;var _0x2b411c=_0x1f30[_0x4e6089];return _0x2b411c;};'use strict';var multer=require('multer');var util=require(_0x01f3('0x0'));var path=require(_0x01f3('0x1'));var timeout=require(_0x01f3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x01f3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x01f3('0x4'));var config=require(_0x01f3('0x5'));var controller=require(_0x01f3('0x6'));router[_0x01f3('0x7')]('/',auth[_0x01f3('0x8')](),controller[_0x01f3('0x9')]);router[_0x01f3('0x7')](_0x01f3('0xa'),auth[_0x01f3('0x8')](),controller[_0x01f3('0xb')]);router[_0x01f3('0x7')](_0x01f3('0xc'),auth['isAuthenticated'](),controller[_0x01f3('0xd')]);router['get'](_0x01f3('0xe'),auth[_0x01f3('0x8')](),controller['getSubjects']);router[_0x01f3('0x7')](_0x01f3('0xf'),auth[_0x01f3('0x8')](),controller['getDescriptions']);router['get'](_0x01f3('0x10'),auth[_0x01f3('0x8')](),controller['getTags']);router[_0x01f3('0x11')]('/',auth[_0x01f3('0x8')](),controller[_0x01f3('0x12')]);router['post']('/:id/tags',auth[_0x01f3('0x8')](),controller[_0x01f3('0x13')]);router[_0x01f3('0x14')](_0x01f3('0xa'),auth[_0x01f3('0x8')](),controller[_0x01f3('0x15')]);router[_0x01f3('0x16')](_0x01f3('0xa'),auth[_0x01f3('0x8')](),controller[_0x01f3('0x17')]);module[_0x01f3('0x18')]=router; \ No newline at end of file +var _0x700d=['./intZendeskConfiguration.controller','index','get','/:id','isAuthenticated','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','setTags','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x58e314,_0x12d0e9){var _0x4c04ec=function(_0x4e687c){while(--_0x4e687c){_0x58e314['push'](_0x58e314['shift']());}};_0x4c04ec(++_0x12d0e9);}(_0x700d,0x153));var _0xd700=function(_0x102f92,_0x208c6a){_0x102f92=_0x102f92-0x0;var _0x544bbd=_0x700d[_0x102f92];return _0x544bbd;};'use strict';var multer=require(_0xd700('0x0'));var util=require('util');var path=require(_0xd700('0x1'));var timeout=require(_0xd700('0x2'));var express=require(_0xd700('0x3'));var router=express[_0xd700('0x4')]();var fs_extra=require(_0xd700('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd700('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xd700('0x7')]);router[_0xd700('0x8')](_0xd700('0x9'),auth[_0xd700('0xa')](),controller[_0xd700('0xb')]);router['get']('/:id/fields',auth[_0xd700('0xa')](),controller[_0xd700('0xc')]);router[_0xd700('0x8')](_0xd700('0xd'),auth[_0xd700('0xa')](),controller['getSubjects']);router[_0xd700('0x8')](_0xd700('0xe'),auth[_0xd700('0xa')](),controller[_0xd700('0xf')]);router['get'](_0xd700('0x10'),auth[_0xd700('0xa')](),controller['getTags']);router[_0xd700('0x11')]('/',auth[_0xd700('0xa')](),controller['create']);router[_0xd700('0x11')](_0xd700('0x10'),auth['isAuthenticated'](),controller[_0xd700('0x12')]);router[_0xd700('0x13')](_0xd700('0x9'),auth[_0xd700('0xa')](),controller['update']);router[_0xd700('0x14')](_0xd700('0x9'),auth[_0xd700('0xa')](),controller[_0xd700('0x15')]);module[_0xd700('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index a0c66ef..3fe5ea7 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 _0xa2f5=['exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa2f5,0x17c));var _0x5a2f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa2f5[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0x5a2f('0x0')]={'name':{'type':Sequelize[_0x5a2f('0x1')]},'description':{'type':Sequelize[_0x5a2f('0x1')]}}; \ No newline at end of file +var _0x005e=['STRING','exports'];(function(_0x1da6a0,_0x61f8ab){var _0x4d7e1f=function(_0x544a3d){while(--_0x544a3d){_0x1da6a0['push'](_0x1da6a0['shift']());}};_0x4d7e1f(++_0x61f8ab);}(_0x005e,0x147));var _0xe005=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x005e[_0x28611e];return _0x530f69;};'use strict';var Sequelize=require('sequelize');module[_0xe005('0x0')]={'name':{'type':Sequelize[_0xe005('0x1')]},'description':{'type':Sequelize[_0xe005('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4e16ceb..5cd921a 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 _0x3baf=['status','json','offset','limit','set','Content-Range','apply','save','update','destroy','end','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','length','find','create','body','findOne','getFields','getSubjects','ZendeskField','getDescriptions','Tag','getTags','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus'];(function(_0x6a9790,_0x9ac899){var _0x82c768=function(_0x363193){while(--_0x363193){_0x6a9790['push'](_0x6a9790['shift']());}};_0x82c768(++_0x9ac899);}(_0x3baf,0xf7));var _0xf3ba=function(_0x20a070,_0x2f0ff9){_0x20a070=_0x20a070-0x0;var _0x433d80=_0x3baf[_0x20a070];return _0x433d80;};'use strict';var pdf=require(_0xf3ba('0x0'));var emlformat=require(_0xf3ba('0x1'));var rimraf=require(_0xf3ba('0x2'));var zipdir=require(_0xf3ba('0x3'));var jsonpatch=require(_0xf3ba('0x4'));var rp=require(_0xf3ba('0x5'));var moment=require(_0xf3ba('0x6'));var BPromise=require(_0xf3ba('0x7'));var Mustache=require(_0xf3ba('0x8'));var util=require(_0xf3ba('0x9'));var path=require(_0xf3ba('0xa'));var sox=require(_0xf3ba('0xb'));var csv=require(_0xf3ba('0xc'));var ejs=require(_0xf3ba('0xd'));var fs=require('fs');var fs_extra=require(_0xf3ba('0xe'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf3ba('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf3ba('0xc'));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'];var jayson=require(_0xf3ba('0x1d'));var client=jayson[_0xf3ba('0x1e')][_0xf3ba('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3e44d6,_0x505b8d,_0x327675,_0x56816b){return new BPromise(function(_0x815037,_0x345fc9){var _0x4717be=_0x56816b||client;return _0x4717be[_0xf3ba('0x20')](_0x3e44d6,_0x327675)[_0xf3ba('0x21')](function(_0x53f848){logger[_0xf3ba('0x22')](_0xf3ba('0x23'),_0x505b8d,_0xf3ba('0x24'));logger['debug'](_0xf3ba('0x25'),_0x505b8d,_0xf3ba('0x24'),JSON[_0xf3ba('0x26')](_0x53f848));if(_0x53f848[_0xf3ba('0x27')]){if(_0x53f848['error'][_0xf3ba('0x28')]===0x1f4){logger[_0xf3ba('0x27')]('ZendeskConfiguration,\x20%s,\x20%s',_0x505b8d,_0x53f848['error'][_0xf3ba('0x29')]);return _0x345fc9(_0x53f848[_0xf3ba('0x27')][_0xf3ba('0x29')]);}logger['error'](_0xf3ba('0x23'),_0x505b8d,_0x53f848[_0xf3ba('0x27')][_0xf3ba('0x29')]);return _0x815037(_0x53f848[_0xf3ba('0x27')][_0xf3ba('0x29')]);}else{logger[_0xf3ba('0x22')](_0xf3ba('0x23'),_0x505b8d,'request\x20sent');_0x815037(_0x53f848['result']['message']);}})[_0xf3ba('0x2a')](function(_0x220588){logger[_0xf3ba('0x27')](_0xf3ba('0x23'),_0x505b8d,_0x220588);_0x345fc9(_0x220588);});});}function respondWithStatusCode(_0x2cc01a,_0x545ee1){_0x545ee1=_0x545ee1||0xcc;return function(_0x505560){if(_0x505560){return _0x2cc01a[_0xf3ba('0x2b')](_0x545ee1);}return _0x2cc01a[_0xf3ba('0x2c')](_0x545ee1)['end']();};}function respondWithResult(_0x1c9d6a,_0x37cba1){_0x37cba1=_0x37cba1||0xc8;return function(_0x59ce48){if(_0x59ce48){return _0x1c9d6a['status'](_0x37cba1)[_0xf3ba('0x2d')](_0x59ce48);}};}function respondWithFilteredResult(_0x7effa1,_0x5f1709){return function(_0x18a4fb){if(_0x18a4fb){var _0x318817=_0x18a4fb['count'],_0x15ac44=_0x5f1709['offset'],_0x5a880e=_0x5f1709[_0xf3ba('0x2e')]+_0x5f1709[_0xf3ba('0x2f')],_0x29ed57;if(_0x5a880e>=_0x318817){_0x5a880e=_0x318817;_0x29ed57=0xc8;}else{_0x29ed57=0xce;}_0x7effa1['status'](_0x29ed57);return _0x7effa1[_0xf3ba('0x30')](_0xf3ba('0x31'),_0x15ac44+'-'+_0x5a880e+'/'+_0x318817)['json'](_0x18a4fb);}return null;};}function patchUpdates(_0x57da3b){return function(_0x49f234){try{jsonpatch[_0xf3ba('0x32')](_0x49f234,_0x57da3b,!![]);}catch(_0x6423f){return BPromise['reject'](_0x6423f);}return _0x49f234[_0xf3ba('0x33')]();};}function saveUpdates(_0x5b2f0d,_0x48d81c){return function(_0x28dee0){if(_0x28dee0){return _0x28dee0[_0xf3ba('0x34')](_0x5b2f0d)[_0xf3ba('0x21')](function(_0x7af1e4){return _0x7af1e4;});}return null;};}function removeEntity(_0x1df823,_0xf1b77a){return function(_0x508d52){if(_0x508d52){return _0x508d52[_0xf3ba('0x35')]()['then'](function(){_0x1df823[_0xf3ba('0x2c')](0xcc)[_0xf3ba('0x36')]();});}};}function handleEntityNotFound(_0x5b8d31,_0x45a3bc){return function(_0x36b6a1){if(!_0x36b6a1){_0x5b8d31[_0xf3ba('0x2b')](0x194);}return _0x36b6a1;};}function handleError(_0xab4960,_0x4ba794){_0x4ba794=_0x4ba794||0x1f4;return function(_0x213112){logger['error'](_0x213112['stack']);if(_0x213112['name']){delete _0x213112[_0xf3ba('0x37')];}_0xab4960[_0xf3ba('0x2c')](_0x4ba794)[_0xf3ba('0x38')](_0x213112);};}exports[_0xf3ba('0x39')]=function(_0x3bab98,_0x55b29b){var _0x10fe3e={},_0x47f269={},_0x3a927e={'count':0x0,'rows':[]};var _0x4c5301=_[_0xf3ba('0x3a')](db[_0xf3ba('0x3b')][_0xf3ba('0x3c')],function(_0x1607a4){return{'name':_0x1607a4['fieldName'],'type':_0x1607a4[_0xf3ba('0x3d')][_0xf3ba('0x3e')]};});_0x47f269['model']=_[_0xf3ba('0x3a')](_0x4c5301,_0xf3ba('0x37'));_0x47f269[_0xf3ba('0x3f')]=_[_0xf3ba('0x40')](_0x3bab98[_0xf3ba('0x3f')]);_0x47f269[_0xf3ba('0x41')]=_[_0xf3ba('0x42')](_0x47f269['model'],_0x47f269[_0xf3ba('0x3f')]);_0x10fe3e['attributes']=_[_0xf3ba('0x42')](_0x47f269['model'],qs[_0xf3ba('0x43')](_0x3bab98[_0xf3ba('0x3f')][_0xf3ba('0x43')]));_0x10fe3e[_0xf3ba('0x44')]=_0x10fe3e[_0xf3ba('0x44')]['length']?_0x10fe3e['attributes']:_0x47f269[_0xf3ba('0x45')];if(!_0x3bab98[_0xf3ba('0x3f')][_0xf3ba('0x46')](_0xf3ba('0x47'))){_0x10fe3e[_0xf3ba('0x2f')]=qs[_0xf3ba('0x2f')](_0x3bab98['query'][_0xf3ba('0x2f')]);_0x10fe3e['offset']=qs[_0xf3ba('0x2e')](_0x3bab98[_0xf3ba('0x3f')][_0xf3ba('0x2e')]);}_0x10fe3e[_0xf3ba('0x48')]=qs[_0xf3ba('0x49')](_0x3bab98[_0xf3ba('0x3f')][_0xf3ba('0x49')]);_0x10fe3e[_0xf3ba('0x4a')]=qs['filters'](_[_0xf3ba('0x4b')](_0x3bab98[_0xf3ba('0x3f')],_0x47f269[_0xf3ba('0x41')]),_0x4c5301);if(_0x3bab98[_0xf3ba('0x3f')][_0xf3ba('0x4c')]){_0x10fe3e[_0xf3ba('0x4a')]=_[_0xf3ba('0x4d')](_0x10fe3e['where'],{'$or':_[_0xf3ba('0x3a')](_0x4c5301,function(_0x35481b){if(_0x35481b['type']!==_0xf3ba('0x4e')){var _0x451c64={};_0x451c64[_0x35481b[_0xf3ba('0x37')]]={'$like':'%'+_0x3bab98[_0xf3ba('0x3f')][_0xf3ba('0x4c')]+'%'};return _0x451c64;}})});}_0x10fe3e=_[_0xf3ba('0x4d')]({},_0x10fe3e,_0x3bab98[_0xf3ba('0x4f')]);var _0x166e69={'where':_0x10fe3e[_0xf3ba('0x4a')]};return db[_0xf3ba('0x3b')][_0xf3ba('0x50')](_0x166e69)[_0xf3ba('0x21')](function(_0x40c152){_0x3a927e[_0xf3ba('0x50')]=_0x40c152;if(_0x3bab98[_0xf3ba('0x3f')][_0xf3ba('0x51')]){_0x10fe3e[_0xf3ba('0x52')]=[{'all':!![]}];}return db[_0xf3ba('0x3b')]['findAll'](_0x10fe3e);})[_0xf3ba('0x21')](function(_0x1a0df2){_0x3a927e['rows']=_0x1a0df2;return _0x3a927e;})[_0xf3ba('0x21')](respondWithFilteredResult(_0x55b29b,_0x10fe3e))[_0xf3ba('0x2a')](handleError(_0x55b29b,null));};exports[_0xf3ba('0x53')]=function(_0x36f476,_0x52ef61){var _0x5d0e2a={'raw':![],'where':{'id':_0x36f476[_0xf3ba('0x54')]['id']}},_0x28ca9b={};_0x28ca9b[_0xf3ba('0x45')]=_[_0xf3ba('0x40')](db['ZendeskConfiguration'][_0xf3ba('0x3c')]);_0x28ca9b[_0xf3ba('0x3f')]=_[_0xf3ba('0x40')](_0x36f476['query']);_0x28ca9b[_0xf3ba('0x41')]=_[_0xf3ba('0x42')](_0x28ca9b[_0xf3ba('0x45')],_0x28ca9b[_0xf3ba('0x3f')]);_0x5d0e2a[_0xf3ba('0x44')]=_[_0xf3ba('0x42')](_0x28ca9b[_0xf3ba('0x45')],qs[_0xf3ba('0x43')](_0x36f476[_0xf3ba('0x3f')][_0xf3ba('0x43')]));_0x5d0e2a['attributes']=_0x5d0e2a[_0xf3ba('0x44')][_0xf3ba('0x55')]?_0x5d0e2a[_0xf3ba('0x44')]:_0x28ca9b[_0xf3ba('0x45')];if(_0x36f476['query'][_0xf3ba('0x51')]){_0x5d0e2a['include']=[{'all':!![]}];}_0x5d0e2a=_['merge']({},_0x5d0e2a,_0x36f476[_0xf3ba('0x4f')]);return db[_0xf3ba('0x3b')][_0xf3ba('0x56')](_0x5d0e2a)[_0xf3ba('0x21')](handleEntityNotFound(_0x52ef61,null))[_0xf3ba('0x21')](respondWithResult(_0x52ef61,null))[_0xf3ba('0x2a')](handleError(_0x52ef61,null));};exports[_0xf3ba('0x57')]=function(_0x787f73,_0x557fbd){return db[_0xf3ba('0x3b')][_0xf3ba('0x57')](_0x787f73[_0xf3ba('0x58')],{})[_0xf3ba('0x21')](respondWithResult(_0x557fbd,0xc9))['catch'](handleError(_0x557fbd,null));};exports['update']=function(_0x40548f,_0x31cd60){if(_0x40548f[_0xf3ba('0x58')]['id']){delete _0x40548f[_0xf3ba('0x58')]['id'];}return db[_0xf3ba('0x3b')]['find']({'where':{'id':_0x40548f[_0xf3ba('0x54')]['id']}})['then'](handleEntityNotFound(_0x31cd60,null))[_0xf3ba('0x21')](saveUpdates(_0x40548f['body'],null))[_0xf3ba('0x21')](respondWithResult(_0x31cd60,null))['catch'](handleError(_0x31cd60,null));};exports[_0xf3ba('0x35')]=function(_0x252936,_0x3f43db){return db[_0xf3ba('0x3b')][_0xf3ba('0x56')]({'where':{'id':_0x252936['params']['id']}})[_0xf3ba('0x21')](handleEntityNotFound(_0x3f43db,null))[_0xf3ba('0x21')](removeEntity(_0x3f43db,null))[_0xf3ba('0x2a')](handleError(_0x3f43db,null));};exports['getFields']=function(_0x2271cb,_0x553e9f,_0x1dde9f){var _0x14b7b1={};var _0x471f81={};var _0x21b9c6;var _0x3def85;return db[_0xf3ba('0x3b')][_0xf3ba('0x59')]({'where':{'id':_0x2271cb[_0xf3ba('0x54')]['id']}})[_0xf3ba('0x21')](handleEntityNotFound(_0x553e9f,null))[_0xf3ba('0x21')](function(_0x10cc72){if(_0x10cc72){_0x21b9c6=_0x10cc72;_0x471f81['model']=_[_0xf3ba('0x40')](db['ZendeskField'][_0xf3ba('0x3c')]);_0x471f81[_0xf3ba('0x3f')]=_[_0xf3ba('0x40')](_0x2271cb[_0xf3ba('0x3f')]);_0x471f81['filters']=_[_0xf3ba('0x42')](_0x471f81[_0xf3ba('0x45')],_0x471f81[_0xf3ba('0x3f')]);_0x14b7b1[_0xf3ba('0x44')]=_[_0xf3ba('0x42')](_0x471f81[_0xf3ba('0x45')],qs[_0xf3ba('0x43')](_0x2271cb[_0xf3ba('0x3f')][_0xf3ba('0x43')]));_0x14b7b1[_0xf3ba('0x44')]=_0x14b7b1['attributes']['length']?_0x14b7b1['attributes']:_0x471f81['model'];_0x14b7b1[_0xf3ba('0x48')]=qs[_0xf3ba('0x49')](_0x2271cb[_0xf3ba('0x3f')]['sort']);_0x14b7b1[_0xf3ba('0x4a')]=qs['filters'](_[_0xf3ba('0x4b')](_0x2271cb[_0xf3ba('0x3f')],_0x471f81['filters']));if(_0x2271cb['query'][_0xf3ba('0x4c')]){_0x14b7b1['where']=_[_0xf3ba('0x4d')](_0x14b7b1['where'],{'$or':_[_0xf3ba('0x3a')](_0x14b7b1[_0xf3ba('0x44')],function(_0xb3e3df){var _0x44b33f={};_0x44b33f[_0xb3e3df]={'$like':'%'+_0x2271cb['query'][_0xf3ba('0x4c')]+'%'};return _0x44b33f;})});}_0x14b7b1=_['merge']({},_0x14b7b1,_0x2271cb['options']);return _0x21b9c6[_0xf3ba('0x5a')](_0x14b7b1);}})[_0xf3ba('0x21')](function(_0x18b690){if(_0x18b690){_0x3def85=_0x18b690[_0xf3ba('0x55')];if(!_0x2271cb[_0xf3ba('0x3f')][_0xf3ba('0x46')]('nolimit')){_0x14b7b1[_0xf3ba('0x2f')]=qs[_0xf3ba('0x2f')](_0x2271cb[_0xf3ba('0x3f')]['limit']);_0x14b7b1[_0xf3ba('0x2e')]=qs[_0xf3ba('0x2e')](_0x2271cb[_0xf3ba('0x3f')][_0xf3ba('0x2e')]);}return _0x21b9c6['getFields'](_0x14b7b1);}})[_0xf3ba('0x21')](function(_0x21d2fd){if(_0x21d2fd){return _0x21d2fd?{'count':_0x3def85,'rows':_0x21d2fd}:null;}})[_0xf3ba('0x21')](respondWithResult(_0x553e9f,null))[_0xf3ba('0x2a')](handleError(_0x553e9f,null));};exports[_0xf3ba('0x5b')]=function(_0x5b964a,_0x25b0b7,_0x158814){var _0x2ae7cb={};var _0x1d5d2a={};var _0x33047b;var _0x33020b;return db[_0xf3ba('0x3b')][_0xf3ba('0x59')]({'where':{'id':_0x5b964a[_0xf3ba('0x54')]['id']}})[_0xf3ba('0x21')](handleEntityNotFound(_0x25b0b7,null))[_0xf3ba('0x21')](function(_0x2450c1){if(_0x2450c1){_0x33047b=_0x2450c1;_0x1d5d2a[_0xf3ba('0x45')]=_['keys'](db[_0xf3ba('0x5c')]['rawAttributes']);_0x1d5d2a[_0xf3ba('0x3f')]=_[_0xf3ba('0x40')](_0x5b964a[_0xf3ba('0x3f')]);_0x1d5d2a[_0xf3ba('0x41')]=_[_0xf3ba('0x42')](_0x1d5d2a[_0xf3ba('0x45')],_0x1d5d2a[_0xf3ba('0x3f')]);_0x2ae7cb[_0xf3ba('0x44')]=_['intersection'](_0x1d5d2a[_0xf3ba('0x45')],qs[_0xf3ba('0x43')](_0x5b964a[_0xf3ba('0x3f')]['fields']));_0x2ae7cb[_0xf3ba('0x44')]=_0x2ae7cb[_0xf3ba('0x44')][_0xf3ba('0x55')]?_0x2ae7cb[_0xf3ba('0x44')]:_0x1d5d2a[_0xf3ba('0x45')];_0x2ae7cb[_0xf3ba('0x48')]=qs[_0xf3ba('0x49')](_0x5b964a[_0xf3ba('0x3f')][_0xf3ba('0x49')]);_0x2ae7cb['where']=qs['filters'](_[_0xf3ba('0x4b')](_0x5b964a[_0xf3ba('0x3f')],_0x1d5d2a['filters']));if(_0x5b964a[_0xf3ba('0x3f')]['filter']){_0x2ae7cb[_0xf3ba('0x4a')]=_['merge'](_0x2ae7cb[_0xf3ba('0x4a')],{'$or':_[_0xf3ba('0x3a')](_0x2ae7cb['attributes'],function(_0x344bfb){var _0x57e5a6={};_0x57e5a6[_0x344bfb]={'$like':'%'+_0x5b964a[_0xf3ba('0x3f')][_0xf3ba('0x4c')]+'%'};return _0x57e5a6;})});}_0x2ae7cb=_[_0xf3ba('0x4d')]({},_0x2ae7cb,_0x5b964a[_0xf3ba('0x4f')]);return _0x33047b[_0xf3ba('0x5b')](_0x2ae7cb);}})[_0xf3ba('0x21')](function(_0x234a79){if(_0x234a79){_0x33020b=_0x234a79[_0xf3ba('0x55')];if(!_0x5b964a[_0xf3ba('0x3f')]['hasOwnProperty'](_0xf3ba('0x47'))){_0x2ae7cb[_0xf3ba('0x2f')]=qs[_0xf3ba('0x2f')](_0x5b964a[_0xf3ba('0x3f')][_0xf3ba('0x2f')]);_0x2ae7cb[_0xf3ba('0x2e')]=qs['offset'](_0x5b964a[_0xf3ba('0x3f')][_0xf3ba('0x2e')]);}return _0x33047b[_0xf3ba('0x5b')](_0x2ae7cb);}})['then'](function(_0xc30c62){if(_0xc30c62){return _0xc30c62?{'count':_0x33020b,'rows':_0xc30c62}:null;}})[_0xf3ba('0x21')](respondWithResult(_0x25b0b7,null))[_0xf3ba('0x2a')](handleError(_0x25b0b7,null));};exports[_0xf3ba('0x5d')]=function(_0x43f7b4,_0x388170,_0x5b3aef){var _0x1c7f94={};var _0x55c146={};var _0x560c1a;var _0x343e03;return db[_0xf3ba('0x3b')]['findOne']({'where':{'id':_0x43f7b4['params']['id']}})[_0xf3ba('0x21')](handleEntityNotFound(_0x388170,null))[_0xf3ba('0x21')](function(_0x385141){if(_0x385141){_0x560c1a=_0x385141;_0x55c146[_0xf3ba('0x45')]=_[_0xf3ba('0x40')](db[_0xf3ba('0x5c')][_0xf3ba('0x3c')]);_0x55c146['query']=_[_0xf3ba('0x40')](_0x43f7b4[_0xf3ba('0x3f')]);_0x55c146['filters']=_[_0xf3ba('0x42')](_0x55c146[_0xf3ba('0x45')],_0x55c146[_0xf3ba('0x3f')]);_0x1c7f94[_0xf3ba('0x44')]=_[_0xf3ba('0x42')](_0x55c146[_0xf3ba('0x45')],qs[_0xf3ba('0x43')](_0x43f7b4[_0xf3ba('0x3f')]['fields']));_0x1c7f94['attributes']=_0x1c7f94['attributes'][_0xf3ba('0x55')]?_0x1c7f94[_0xf3ba('0x44')]:_0x55c146['model'];_0x1c7f94['order']=qs['sort'](_0x43f7b4[_0xf3ba('0x3f')][_0xf3ba('0x49')]);_0x1c7f94['where']=qs[_0xf3ba('0x41')](_[_0xf3ba('0x4b')](_0x43f7b4[_0xf3ba('0x3f')],_0x55c146[_0xf3ba('0x41')]));if(_0x43f7b4[_0xf3ba('0x3f')][_0xf3ba('0x4c')]){_0x1c7f94[_0xf3ba('0x4a')]=_[_0xf3ba('0x4d')](_0x1c7f94[_0xf3ba('0x4a')],{'$or':_['map'](_0x1c7f94[_0xf3ba('0x44')],function(_0x9142b4){var _0x4ada9e={};_0x4ada9e[_0x9142b4]={'$like':'%'+_0x43f7b4[_0xf3ba('0x3f')][_0xf3ba('0x4c')]+'%'};return _0x4ada9e;})});}_0x1c7f94=_[_0xf3ba('0x4d')]({},_0x1c7f94,_0x43f7b4[_0xf3ba('0x4f')]);return _0x560c1a[_0xf3ba('0x5d')](_0x1c7f94);}})[_0xf3ba('0x21')](function(_0x44a342){if(_0x44a342){_0x343e03=_0x44a342[_0xf3ba('0x55')];if(!_0x43f7b4[_0xf3ba('0x3f')][_0xf3ba('0x46')](_0xf3ba('0x47'))){_0x1c7f94['limit']=qs[_0xf3ba('0x2f')](_0x43f7b4[_0xf3ba('0x3f')][_0xf3ba('0x2f')]);_0x1c7f94[_0xf3ba('0x2e')]=qs[_0xf3ba('0x2e')](_0x43f7b4[_0xf3ba('0x3f')]['offset']);}return _0x560c1a[_0xf3ba('0x5d')](_0x1c7f94);}})[_0xf3ba('0x21')](function(_0x69fec3){if(_0x69fec3){return _0x69fec3?{'count':_0x343e03,'rows':_0x69fec3}:null;}})[_0xf3ba('0x21')](respondWithResult(_0x388170,null))[_0xf3ba('0x2a')](handleError(_0x388170,null));};exports['getTags']=function(_0xa522f9,_0x46c4d8,_0x59df40){var _0xa74c81={};var _0x236868={};var _0x563ad1;var _0x88558e;return db[_0xf3ba('0x3b')]['findOne']({'where':{'id':_0xa522f9[_0xf3ba('0x54')]['id']}})[_0xf3ba('0x21')](handleEntityNotFound(_0x46c4d8,null))[_0xf3ba('0x21')](function(_0x3b9311){if(_0x3b9311){_0x563ad1=_0x3b9311;_0x236868['model']=_[_0xf3ba('0x40')](db[_0xf3ba('0x5e')][_0xf3ba('0x3c')]);_0x236868['query']=_[_0xf3ba('0x40')](_0xa522f9[_0xf3ba('0x3f')]);_0x236868[_0xf3ba('0x41')]=_[_0xf3ba('0x42')](_0x236868[_0xf3ba('0x45')],_0x236868[_0xf3ba('0x3f')]);_0xa74c81[_0xf3ba('0x44')]=_['intersection'](_0x236868['model'],qs[_0xf3ba('0x43')](_0xa522f9[_0xf3ba('0x3f')]['fields']));_0xa74c81['attributes']=_0xa74c81['attributes'][_0xf3ba('0x55')]?_0xa74c81[_0xf3ba('0x44')]:_0x236868['model'];_0xa74c81[_0xf3ba('0x48')]=qs[_0xf3ba('0x49')](_0xa522f9[_0xf3ba('0x3f')][_0xf3ba('0x49')]);_0xa74c81[_0xf3ba('0x4a')]=qs['filters'](_[_0xf3ba('0x4b')](_0xa522f9[_0xf3ba('0x3f')],_0x236868['filters']));if(_0xa522f9['query'][_0xf3ba('0x4c')]){_0xa74c81[_0xf3ba('0x4a')]=_[_0xf3ba('0x4d')](_0xa74c81[_0xf3ba('0x4a')],{'$or':_['map'](_0xa74c81[_0xf3ba('0x44')],function(_0x52f99d){var _0x49e0d7={};_0x49e0d7[_0x52f99d]={'$like':'%'+_0xa522f9['query']['filter']+'%'};return _0x49e0d7;})});}_0xa74c81=_[_0xf3ba('0x4d')]({},_0xa74c81,_0xa522f9[_0xf3ba('0x4f')]);return _0x563ad1[_0xf3ba('0x5f')](_0xa74c81);}})[_0xf3ba('0x21')](function(_0x3b3d36){if(_0x3b3d36){_0x88558e=_0x3b3d36[_0xf3ba('0x55')];if(!_0xa522f9['query'][_0xf3ba('0x46')]('nolimit')){_0xa74c81[_0xf3ba('0x2f')]=qs[_0xf3ba('0x2f')](_0xa522f9[_0xf3ba('0x3f')]['limit']);_0xa74c81[_0xf3ba('0x2e')]=qs[_0xf3ba('0x2e')](_0xa522f9['query'][_0xf3ba('0x2e')]);}return _0x563ad1[_0xf3ba('0x5f')](_0xa74c81);}})['then'](function(_0xb066){if(_0xb066){return _0xb066?{'count':_0x88558e,'rows':_0xb066}:null;}})[_0xf3ba('0x21')](respondWithResult(_0x46c4d8,null))[_0xf3ba('0x2a')](handleError(_0x46c4d8,null));};exports[_0xf3ba('0x60')]=function(_0x5b6965,_0xbb3e33,_0x21647a){if(_0x5b6965[_0xf3ba('0x58')]['id']){delete _0x5b6965[_0xf3ba('0x58')]['id'];}return db[_0xf3ba('0x3b')][_0xf3ba('0x59')]({'where':{'id':_0x5b6965['params']['id']}})['then'](handleEntityNotFound(_0xbb3e33,null))[_0xf3ba('0x21')](function(_0x2ee85e){if(_0x2ee85e){return _0x2ee85e[_0xf3ba('0x60')](_0x5b6965['body']['ids']||[]);}return null;})[_0xf3ba('0x21')](respondWithResult(_0xbb3e33,null))[_0xf3ba('0x2a')](handleError(_0xbb3e33,null));}; \ No newline at end of file +var _0x98a8=['fields','length','nolimit','limit','order','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','intersection','includeAll','find','create','body','getFields','findOne','pick','hasOwnProperty','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','ZendeskConfiguration','rawAttributes','model','map','query','keys','filters','attributes'];(function(_0x3abef1,_0x503996){var _0x473398=function(_0x2c5e71){while(--_0x2c5e71){_0x3abef1['push'](_0x3abef1['shift']());}};_0x473398(++_0x503996);}(_0x98a8,0x12c));var _0x898a=function(_0x536e05,_0x1ba1a3){_0x536e05=_0x536e05-0x0;var _0x482953=_0x98a8[_0x536e05];return _0x482953;};'use strict';var pdf=require(_0x898a('0x0'));var emlformat=require(_0x898a('0x1'));var rimraf=require(_0x898a('0x2'));var zipdir=require(_0x898a('0x3'));var jsonpatch=require(_0x898a('0x4'));var rp=require(_0x898a('0x5'));var moment=require(_0x898a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x898a('0x7'));var util=require(_0x898a('0x8'));var path=require(_0x898a('0x9'));var sox=require(_0x898a('0xa'));var csv=require(_0x898a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x898a('0xc'));var _=require('lodash');var squel=require(_0x898a('0xd'));var crypto=require('crypto');var jsforce=require(_0x898a('0xe'));var deskjs=require(_0x898a('0xf'));var toCsv=require(_0x898a('0xb'));var querystring=require(_0x898a('0x10'));var Papa=require(_0x898a('0x11'));var Redis=require(_0x898a('0x12'));var authService=require(_0x898a('0x13'));var qs=require(_0x898a('0x14'));var as=require(_0x898a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x898a('0x16'))('api');var utils=require(_0x898a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x898a('0x18'));var db=require(_0x898a('0x19'))['db'];var jayson=require(_0x898a('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5c9c,_0x373d53,_0x1f5be4,_0xb24335){return new BPromise(function(_0x116fbe,_0x1873e9){var _0x15177d=_0xb24335||client;return _0x15177d['request'](_0x5b5c9c,_0x1f5be4)[_0x898a('0x1b')](function(_0x53a4b8){logger[_0x898a('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s',_0x373d53,_0x898a('0x1d'));logger['debug'](_0x898a('0x1e'),_0x373d53,'request\x20sent',JSON[_0x898a('0x1f')](_0x53a4b8));if(_0x53a4b8[_0x898a('0x20')]){if(_0x53a4b8[_0x898a('0x20')]['code']===0x1f4){logger[_0x898a('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x373d53,_0x53a4b8['error'][_0x898a('0x21')]);return _0x1873e9(_0x53a4b8[_0x898a('0x20')]['message']);}logger['error'](_0x898a('0x22'),_0x373d53,_0x53a4b8[_0x898a('0x20')][_0x898a('0x21')]);return _0x116fbe(_0x53a4b8[_0x898a('0x20')][_0x898a('0x21')]);}else{logger[_0x898a('0x1c')](_0x898a('0x22'),_0x373d53,'request\x20sent');_0x116fbe(_0x53a4b8[_0x898a('0x23')][_0x898a('0x21')]);}})[_0x898a('0x24')](function(_0x3cfd9c){logger[_0x898a('0x20')](_0x898a('0x22'),_0x373d53,_0x3cfd9c);_0x1873e9(_0x3cfd9c);});});}function respondWithStatusCode(_0x4e254d,_0x274cdf){_0x274cdf=_0x274cdf||0xcc;return function(_0x16c318){if(_0x16c318){return _0x4e254d[_0x898a('0x25')](_0x274cdf);}return _0x4e254d[_0x898a('0x26')](_0x274cdf)[_0x898a('0x27')]();};}function respondWithResult(_0x1426e3,_0x5b7719){_0x5b7719=_0x5b7719||0xc8;return function(_0x20bde0){if(_0x20bde0){return _0x1426e3['status'](_0x5b7719)['json'](_0x20bde0);}};}function respondWithFilteredResult(_0x53ddb2,_0x3678be){return function(_0x1f4d86){if(_0x1f4d86){var _0x420b25=_0x1f4d86[_0x898a('0x28')],_0x40b3db=_0x3678be[_0x898a('0x29')],_0x28ae6a=_0x3678be[_0x898a('0x29')]+_0x3678be['limit'],_0x2efde2;if(_0x28ae6a>=_0x420b25){_0x28ae6a=_0x420b25;_0x2efde2=0xc8;}else{_0x2efde2=0xce;}_0x53ddb2['status'](_0x2efde2);return _0x53ddb2['set'](_0x898a('0x2a'),_0x40b3db+'-'+_0x28ae6a+'/'+_0x420b25)[_0x898a('0x2b')](_0x1f4d86);}return null;};}function patchUpdates(_0x3b7704){return function(_0x27f3ca){try{jsonpatch[_0x898a('0x2c')](_0x27f3ca,_0x3b7704,!![]);}catch(_0x560000){return BPromise[_0x898a('0x2d')](_0x560000);}return _0x27f3ca[_0x898a('0x2e')]();};}function saveUpdates(_0x18773a,_0x4287da){return function(_0x44c5d2){if(_0x44c5d2){return _0x44c5d2[_0x898a('0x2f')](_0x18773a)['then'](function(_0x7a1eb5){return _0x7a1eb5;});}return null;};}function removeEntity(_0x17a5f3,_0x26eead){return function(_0x17a980){if(_0x17a980){return _0x17a980[_0x898a('0x30')]()['then'](function(){_0x17a5f3['status'](0xcc)[_0x898a('0x27')]();});}};}function handleEntityNotFound(_0x1e2fd4,_0x1d6d66){return function(_0x4de9bf){if(!_0x4de9bf){_0x1e2fd4[_0x898a('0x25')](0x194);}return _0x4de9bf;};}function handleError(_0x339eb4,_0x5eafc7){_0x5eafc7=_0x5eafc7||0x1f4;return function(_0x2d3b3a){logger[_0x898a('0x20')](_0x2d3b3a[_0x898a('0x31')]);if(_0x2d3b3a[_0x898a('0x32')]){delete _0x2d3b3a[_0x898a('0x32')];}_0x339eb4['status'](_0x5eafc7)[_0x898a('0x33')](_0x2d3b3a);};}exports['index']=function(_0x573eb3,_0x14e2dc){var _0x58d997={},_0x3c9588={},_0x4b3aac={'count':0x0,'rows':[]};var _0x37cb11=_['map'](db[_0x898a('0x34')][_0x898a('0x35')],function(_0x101182){return{'name':_0x101182['fieldName'],'type':_0x101182['type']['key']};});_0x3c9588[_0x898a('0x36')]=_[_0x898a('0x37')](_0x37cb11,'name');_0x3c9588[_0x898a('0x38')]=_[_0x898a('0x39')](_0x573eb3[_0x898a('0x38')]);_0x3c9588[_0x898a('0x3a')]=_['intersection'](_0x3c9588['model'],_0x3c9588[_0x898a('0x38')]);_0x58d997[_0x898a('0x3b')]=_['intersection'](_0x3c9588['model'],qs[_0x898a('0x3c')](_0x573eb3[_0x898a('0x38')][_0x898a('0x3c')]));_0x58d997[_0x898a('0x3b')]=_0x58d997['attributes'][_0x898a('0x3d')]?_0x58d997[_0x898a('0x3b')]:_0x3c9588['model'];if(!_0x573eb3['query']['hasOwnProperty'](_0x898a('0x3e'))){_0x58d997[_0x898a('0x3f')]=qs[_0x898a('0x3f')](_0x573eb3[_0x898a('0x38')][_0x898a('0x3f')]);_0x58d997[_0x898a('0x29')]=qs[_0x898a('0x29')](_0x573eb3[_0x898a('0x38')][_0x898a('0x29')]);}_0x58d997[_0x898a('0x40')]=qs[_0x898a('0x41')](_0x573eb3[_0x898a('0x38')][_0x898a('0x41')]);_0x58d997[_0x898a('0x42')]=qs[_0x898a('0x3a')](_['pick'](_0x573eb3[_0x898a('0x38')],_0x3c9588[_0x898a('0x3a')]),_0x37cb11);if(_0x573eb3[_0x898a('0x38')]['filter']){_0x58d997[_0x898a('0x42')]=_[_0x898a('0x43')](_0x58d997[_0x898a('0x42')],{'$or':_[_0x898a('0x37')](_0x37cb11,function(_0x2cd3c5){if(_0x2cd3c5[_0x898a('0x44')]!==_0x898a('0x45')){var _0x46ac04={};_0x46ac04[_0x2cd3c5['name']]={'$like':'%'+_0x573eb3[_0x898a('0x38')][_0x898a('0x46')]+'%'};return _0x46ac04;}})});}_0x58d997=_[_0x898a('0x43')]({},_0x58d997,_0x573eb3[_0x898a('0x47')]);var _0x538d11={'where':_0x58d997[_0x898a('0x42')]};return db[_0x898a('0x34')]['count'](_0x538d11)[_0x898a('0x1b')](function(_0x4ce00e){_0x4b3aac[_0x898a('0x28')]=_0x4ce00e;if(_0x573eb3['query']['includeAll']){_0x58d997[_0x898a('0x48')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x898a('0x49')](_0x58d997);})[_0x898a('0x1b')](function(_0x4d6ac0){_0x4b3aac[_0x898a('0x4a')]=_0x4d6ac0;return _0x4b3aac;})[_0x898a('0x1b')](respondWithFilteredResult(_0x14e2dc,_0x58d997))['catch'](handleError(_0x14e2dc,null));};exports[_0x898a('0x4b')]=function(_0x199437,_0x11a0a3){var _0x118240={'raw':![],'where':{'id':_0x199437[_0x898a('0x4c')]['id']}},_0x5b7ff8={};_0x5b7ff8[_0x898a('0x36')]=_['keys'](db[_0x898a('0x34')][_0x898a('0x35')]);_0x5b7ff8['query']=_[_0x898a('0x39')](_0x199437['query']);_0x5b7ff8[_0x898a('0x3a')]=_[_0x898a('0x4d')](_0x5b7ff8[_0x898a('0x36')],_0x5b7ff8['query']);_0x118240[_0x898a('0x3b')]=_[_0x898a('0x4d')](_0x5b7ff8[_0x898a('0x36')],qs[_0x898a('0x3c')](_0x199437['query'][_0x898a('0x3c')]));_0x118240['attributes']=_0x118240[_0x898a('0x3b')][_0x898a('0x3d')]?_0x118240[_0x898a('0x3b')]:_0x5b7ff8['model'];if(_0x199437[_0x898a('0x38')][_0x898a('0x4e')]){_0x118240[_0x898a('0x48')]=[{'all':!![]}];}_0x118240=_['merge']({},_0x118240,_0x199437['options']);return db[_0x898a('0x34')][_0x898a('0x4f')](_0x118240)[_0x898a('0x1b')](handleEntityNotFound(_0x11a0a3,null))[_0x898a('0x1b')](respondWithResult(_0x11a0a3,null))[_0x898a('0x24')](handleError(_0x11a0a3,null));};exports[_0x898a('0x50')]=function(_0x369f33,_0x6c0f07){return db[_0x898a('0x34')][_0x898a('0x50')](_0x369f33[_0x898a('0x51')],{})['then'](respondWithResult(_0x6c0f07,0xc9))[_0x898a('0x24')](handleError(_0x6c0f07,null));};exports[_0x898a('0x2f')]=function(_0x4d304d,_0x36d7aa){if(_0x4d304d['body']['id']){delete _0x4d304d['body']['id'];}return db[_0x898a('0x34')][_0x898a('0x4f')]({'where':{'id':_0x4d304d[_0x898a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x36d7aa,null))['then'](saveUpdates(_0x4d304d[_0x898a('0x51')],null))[_0x898a('0x1b')](respondWithResult(_0x36d7aa,null))['catch'](handleError(_0x36d7aa,null));};exports[_0x898a('0x30')]=function(_0x233683,_0x4f5225){return db[_0x898a('0x34')][_0x898a('0x4f')]({'where':{'id':_0x233683[_0x898a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4f5225,null))[_0x898a('0x1b')](removeEntity(_0x4f5225,null))[_0x898a('0x24')](handleError(_0x4f5225,null));};exports[_0x898a('0x52')]=function(_0x25970f,_0xd37f94,_0x759101){var _0x4cd6fa={};var _0x22a08a={};var _0x4df5f0;var _0x253f51;return db[_0x898a('0x34')][_0x898a('0x53')]({'where':{'id':_0x25970f[_0x898a('0x4c')]['id']}})[_0x898a('0x1b')](handleEntityNotFound(_0xd37f94,null))[_0x898a('0x1b')](function(_0x2486a5){if(_0x2486a5){_0x4df5f0=_0x2486a5;_0x22a08a[_0x898a('0x36')]=_[_0x898a('0x39')](db['ZendeskField'][_0x898a('0x35')]);_0x22a08a[_0x898a('0x38')]=_[_0x898a('0x39')](_0x25970f[_0x898a('0x38')]);_0x22a08a[_0x898a('0x3a')]=_[_0x898a('0x4d')](_0x22a08a[_0x898a('0x36')],_0x22a08a[_0x898a('0x38')]);_0x4cd6fa[_0x898a('0x3b')]=_[_0x898a('0x4d')](_0x22a08a[_0x898a('0x36')],qs[_0x898a('0x3c')](_0x25970f[_0x898a('0x38')][_0x898a('0x3c')]));_0x4cd6fa[_0x898a('0x3b')]=_0x4cd6fa['attributes'][_0x898a('0x3d')]?_0x4cd6fa[_0x898a('0x3b')]:_0x22a08a['model'];_0x4cd6fa[_0x898a('0x40')]=qs[_0x898a('0x41')](_0x25970f['query'][_0x898a('0x41')]);_0x4cd6fa[_0x898a('0x42')]=qs[_0x898a('0x3a')](_[_0x898a('0x54')](_0x25970f['query'],_0x22a08a[_0x898a('0x3a')]));if(_0x25970f[_0x898a('0x38')][_0x898a('0x46')]){_0x4cd6fa[_0x898a('0x42')]=_['merge'](_0x4cd6fa[_0x898a('0x42')],{'$or':_[_0x898a('0x37')](_0x4cd6fa['attributes'],function(_0x21fdb2){var _0x3c0bf6={};_0x3c0bf6[_0x21fdb2]={'$like':'%'+_0x25970f['query'][_0x898a('0x46')]+'%'};return _0x3c0bf6;})});}_0x4cd6fa=_['merge']({},_0x4cd6fa,_0x25970f[_0x898a('0x47')]);return _0x4df5f0['getFields'](_0x4cd6fa);}})['then'](function(_0x5ed35e){if(_0x5ed35e){_0x253f51=_0x5ed35e[_0x898a('0x3d')];if(!_0x25970f[_0x898a('0x38')][_0x898a('0x55')](_0x898a('0x3e'))){_0x4cd6fa['limit']=qs['limit'](_0x25970f[_0x898a('0x38')][_0x898a('0x3f')]);_0x4cd6fa[_0x898a('0x29')]=qs[_0x898a('0x29')](_0x25970f[_0x898a('0x38')][_0x898a('0x29')]);}return _0x4df5f0[_0x898a('0x52')](_0x4cd6fa);}})[_0x898a('0x1b')](function(_0x5ce9c4){if(_0x5ce9c4){return _0x5ce9c4?{'count':_0x253f51,'rows':_0x5ce9c4}:null;}})[_0x898a('0x1b')](respondWithResult(_0xd37f94,null))[_0x898a('0x24')](handleError(_0xd37f94,null));};exports['getSubjects']=function(_0x42fda8,_0x316160,_0x253c15){var _0x2e514f={};var _0xd380ef={};var _0x286345;var _0x3bcc3d;return db[_0x898a('0x34')][_0x898a('0x53')]({'where':{'id':_0x42fda8[_0x898a('0x4c')]['id']}})[_0x898a('0x1b')](handleEntityNotFound(_0x316160,null))[_0x898a('0x1b')](function(_0x426613){if(_0x426613){_0x286345=_0x426613;_0xd380ef['model']=_[_0x898a('0x39')](db['ZendeskField'][_0x898a('0x35')]);_0xd380ef[_0x898a('0x38')]=_[_0x898a('0x39')](_0x42fda8['query']);_0xd380ef[_0x898a('0x3a')]=_[_0x898a('0x4d')](_0xd380ef[_0x898a('0x36')],_0xd380ef[_0x898a('0x38')]);_0x2e514f[_0x898a('0x3b')]=_['intersection'](_0xd380ef[_0x898a('0x36')],qs[_0x898a('0x3c')](_0x42fda8[_0x898a('0x38')][_0x898a('0x3c')]));_0x2e514f[_0x898a('0x3b')]=_0x2e514f['attributes'][_0x898a('0x3d')]?_0x2e514f[_0x898a('0x3b')]:_0xd380ef[_0x898a('0x36')];_0x2e514f[_0x898a('0x40')]=qs[_0x898a('0x41')](_0x42fda8[_0x898a('0x38')][_0x898a('0x41')]);_0x2e514f[_0x898a('0x42')]=qs['filters'](_[_0x898a('0x54')](_0x42fda8[_0x898a('0x38')],_0xd380ef['filters']));if(_0x42fda8[_0x898a('0x38')]['filter']){_0x2e514f[_0x898a('0x42')]=_['merge'](_0x2e514f[_0x898a('0x42')],{'$or':_[_0x898a('0x37')](_0x2e514f[_0x898a('0x3b')],function(_0x62b49e){var _0x109064={};_0x109064[_0x62b49e]={'$like':'%'+_0x42fda8[_0x898a('0x38')][_0x898a('0x46')]+'%'};return _0x109064;})});}_0x2e514f=_[_0x898a('0x43')]({},_0x2e514f,_0x42fda8[_0x898a('0x47')]);return _0x286345['getSubjects'](_0x2e514f);}})[_0x898a('0x1b')](function(_0xd627d0){if(_0xd627d0){_0x3bcc3d=_0xd627d0[_0x898a('0x3d')];if(!_0x42fda8[_0x898a('0x38')][_0x898a('0x55')](_0x898a('0x3e'))){_0x2e514f[_0x898a('0x3f')]=qs[_0x898a('0x3f')](_0x42fda8[_0x898a('0x38')][_0x898a('0x3f')]);_0x2e514f['offset']=qs['offset'](_0x42fda8[_0x898a('0x38')][_0x898a('0x29')]);}return _0x286345['getSubjects'](_0x2e514f);}})['then'](function(_0x34e1f2){if(_0x34e1f2){return _0x34e1f2?{'count':_0x3bcc3d,'rows':_0x34e1f2}:null;}})['then'](respondWithResult(_0x316160,null))[_0x898a('0x24')](handleError(_0x316160,null));};exports[_0x898a('0x56')]=function(_0x5dbe6c,_0x3f6815,_0x1c782e){var _0x2a08a9={};var _0x434119={};var _0x33e3fa;var _0x2d047a;return db[_0x898a('0x34')]['findOne']({'where':{'id':_0x5dbe6c[_0x898a('0x4c')]['id']}})[_0x898a('0x1b')](handleEntityNotFound(_0x3f6815,null))[_0x898a('0x1b')](function(_0x50d978){if(_0x50d978){_0x33e3fa=_0x50d978;_0x434119[_0x898a('0x36')]=_[_0x898a('0x39')](db['ZendeskField'][_0x898a('0x35')]);_0x434119['query']=_['keys'](_0x5dbe6c['query']);_0x434119[_0x898a('0x3a')]=_[_0x898a('0x4d')](_0x434119[_0x898a('0x36')],_0x434119[_0x898a('0x38')]);_0x2a08a9[_0x898a('0x3b')]=_[_0x898a('0x4d')](_0x434119[_0x898a('0x36')],qs['fields'](_0x5dbe6c[_0x898a('0x38')]['fields']));_0x2a08a9[_0x898a('0x3b')]=_0x2a08a9[_0x898a('0x3b')]['length']?_0x2a08a9[_0x898a('0x3b')]:_0x434119[_0x898a('0x36')];_0x2a08a9[_0x898a('0x40')]=qs[_0x898a('0x41')](_0x5dbe6c[_0x898a('0x38')]['sort']);_0x2a08a9['where']=qs['filters'](_[_0x898a('0x54')](_0x5dbe6c[_0x898a('0x38')],_0x434119[_0x898a('0x3a')]));if(_0x5dbe6c['query'][_0x898a('0x46')]){_0x2a08a9['where']=_['merge'](_0x2a08a9[_0x898a('0x42')],{'$or':_[_0x898a('0x37')](_0x2a08a9[_0x898a('0x3b')],function(_0x45a0db){var _0xfa340a={};_0xfa340a[_0x45a0db]={'$like':'%'+_0x5dbe6c[_0x898a('0x38')][_0x898a('0x46')]+'%'};return _0xfa340a;})});}_0x2a08a9=_[_0x898a('0x43')]({},_0x2a08a9,_0x5dbe6c[_0x898a('0x47')]);return _0x33e3fa[_0x898a('0x56')](_0x2a08a9);}})[_0x898a('0x1b')](function(_0x122682){if(_0x122682){_0x2d047a=_0x122682[_0x898a('0x3d')];if(!_0x5dbe6c[_0x898a('0x38')][_0x898a('0x55')](_0x898a('0x3e'))){_0x2a08a9['limit']=qs[_0x898a('0x3f')](_0x5dbe6c[_0x898a('0x38')][_0x898a('0x3f')]);_0x2a08a9[_0x898a('0x29')]=qs[_0x898a('0x29')](_0x5dbe6c[_0x898a('0x38')][_0x898a('0x29')]);}return _0x33e3fa[_0x898a('0x56')](_0x2a08a9);}})[_0x898a('0x1b')](function(_0x427eff){if(_0x427eff){return _0x427eff?{'count':_0x2d047a,'rows':_0x427eff}:null;}})[_0x898a('0x1b')](respondWithResult(_0x3f6815,null))[_0x898a('0x24')](handleError(_0x3f6815,null));};exports['getTags']=function(_0x116793,_0x5ba6c2,_0x39b98a){var _0x34e463={};var _0xc510c0={};var _0x4925c1;var _0x30e42f;return db[_0x898a('0x34')]['findOne']({'where':{'id':_0x116793[_0x898a('0x4c')]['id']}})[_0x898a('0x1b')](handleEntityNotFound(_0x5ba6c2,null))[_0x898a('0x1b')](function(_0x3aa0ba){if(_0x3aa0ba){_0x4925c1=_0x3aa0ba;_0xc510c0[_0x898a('0x36')]=_[_0x898a('0x39')](db['Tag']['rawAttributes']);_0xc510c0[_0x898a('0x38')]=_['keys'](_0x116793[_0x898a('0x38')]);_0xc510c0[_0x898a('0x3a')]=_[_0x898a('0x4d')](_0xc510c0[_0x898a('0x36')],_0xc510c0[_0x898a('0x38')]);_0x34e463[_0x898a('0x3b')]=_['intersection'](_0xc510c0['model'],qs[_0x898a('0x3c')](_0x116793['query'][_0x898a('0x3c')]));_0x34e463[_0x898a('0x3b')]=_0x34e463['attributes'][_0x898a('0x3d')]?_0x34e463['attributes']:_0xc510c0[_0x898a('0x36')];_0x34e463[_0x898a('0x40')]=qs[_0x898a('0x41')](_0x116793['query']['sort']);_0x34e463['where']=qs[_0x898a('0x3a')](_[_0x898a('0x54')](_0x116793[_0x898a('0x38')],_0xc510c0[_0x898a('0x3a')]));if(_0x116793[_0x898a('0x38')][_0x898a('0x46')]){_0x34e463['where']=_[_0x898a('0x43')](_0x34e463[_0x898a('0x42')],{'$or':_['map'](_0x34e463['attributes'],function(_0x16d43e){var _0x353cfe={};_0x353cfe[_0x16d43e]={'$like':'%'+_0x116793['query'][_0x898a('0x46')]+'%'};return _0x353cfe;})});}_0x34e463=_['merge']({},_0x34e463,_0x116793[_0x898a('0x47')]);return _0x4925c1[_0x898a('0x57')](_0x34e463);}})[_0x898a('0x1b')](function(_0xfa67e){if(_0xfa67e){_0x30e42f=_0xfa67e[_0x898a('0x3d')];if(!_0x116793[_0x898a('0x38')][_0x898a('0x55')](_0x898a('0x3e'))){_0x34e463[_0x898a('0x3f')]=qs[_0x898a('0x3f')](_0x116793[_0x898a('0x38')][_0x898a('0x3f')]);_0x34e463[_0x898a('0x29')]=qs[_0x898a('0x29')](_0x116793[_0x898a('0x38')]['offset']);}return _0x4925c1['getTags'](_0x34e463);}})['then'](function(_0x1d325a){if(_0x1d325a){return _0x1d325a?{'count':_0x30e42f,'rows':_0x1d325a}:null;}})['then'](respondWithResult(_0x5ba6c2,null))[_0x898a('0x24')](handleError(_0x5ba6c2,null));};exports[_0x898a('0x58')]=function(_0x41c183,_0x1d1ad9,_0x29b86f){if(_0x41c183[_0x898a('0x51')]['id']){delete _0x41c183[_0x898a('0x51')]['id'];}return db[_0x898a('0x34')]['findOne']({'where':{'id':_0x41c183[_0x898a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1d1ad9,null))['then'](function(_0x598841){if(_0x598841){return _0x598841[_0x898a('0x58')](_0x41c183['body'][_0x898a('0x59')]||[]);}return null;})[_0x898a('0x1b')](respondWithResult(_0x1d1ad9,null))[_0x898a('0x24')](handleError(_0x1d1ad9,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index e512272..5b1986a 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 _0x8bbf=['rimraf','exports','int_zendesk_configurations','lodash','api','moment','bluebird','request-promise','path'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x8bbf,0xc0));var _0xf8bb=function(_0x490418,_0x4c2852){_0x490418=_0x490418-0x0;var _0x4acba7=_0x8bbf[_0x490418];return _0x4acba7;};'use strict';var _=require(_0xf8bb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf8bb('0x1'));var moment=require(_0xf8bb('0x2'));var BPromise=require(_0xf8bb('0x3'));var rp=require(_0xf8bb('0x4'));var fs=require('fs');var path=require(_0xf8bb('0x5'));var rimraf=require(_0xf8bb('0x6'));var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0xf8bb('0x7')]=function(_0x5e633a,_0x1324b0){return _0x5e633a['define']('ZendeskConfiguration',attributes,{'tableName':_0xf8bb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1667=['rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','util','../../config/logger','api','request-promise','path'];(function(_0x31d57d,_0x3b9fc9){var _0x4359e8=function(_0x3030e8){while(--_0x3030e8){_0x31d57d['push'](_0x31d57d['shift']());}};_0x4359e8(++_0x3b9fc9);}(_0x1667,0x1a2));var _0x7166=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x1667[_0x34ad72];return _0x5c9aa8;};'use strict';var _=require('lodash');var util=require(_0x7166('0x0'));var logger=require(_0x7166('0x1'))(_0x7166('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7166('0x3'));var fs=require('fs');var path=require(_0x7166('0x4'));var rimraf=require(_0x7166('0x5'));var config=require(_0x7166('0x6'));var attributes=require(_0x7166('0x7'));module[_0x7166('0x8')]=function(_0x15cc45,_0x2fd2ce){return _0x15cc45['define']('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','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 c28159d..2172601 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 _0x046b=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x1568f8,_0x359fdc){var _0x1f6812=function(_0x9022da){while(--_0x9022da){_0x1568f8['push'](_0x1568f8['shift']());}};_0x1f6812(++_0x359fdc);}(_0x046b,0x129));var _0xb046=function(_0x4f964a,_0x41f80b){_0x4f964a=_0x4f964a-0x0;var _0x22142b=_0x046b[_0x4f964a];return _0x22142b;};'use strict';var _=require(_0xb046('0x0'));var util=require('util');var moment=require(_0xb046('0x1'));var BPromise=require(_0xb046('0x2'));var rs=require(_0xb046('0x3'));var fs=require('fs');var Redis=require(_0xb046('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb046('0x5'))(_0xb046('0x6'));var config=require(_0xb046('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb046('0x8')][_0xb046('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe26075,_0xe45985,_0x4643b0){return new BPromise(function(_0x5ee8b2,_0x47fea5){return client[_0xb046('0xa')](_0xe26075,_0x4643b0)['then'](function(_0x55f702){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0xe45985,_0xb046('0xb'));logger[_0xb046('0xc')](_0xb046('0xd'),_0xe45985,_0xb046('0xb'),JSON[_0xb046('0xe')](_0x55f702));if(_0x55f702['error']){if(_0x55f702[_0xb046('0xf')][_0xb046('0x10')]===0x1f4){logger[_0xb046('0xf')](_0xb046('0x11'),_0xe45985,_0x55f702[_0xb046('0xf')][_0xb046('0x12')]);return _0x47fea5(_0x55f702[_0xb046('0xf')][_0xb046('0x12')]);}logger[_0xb046('0xf')](_0xb046('0x11'),_0xe45985,_0x55f702[_0xb046('0xf')][_0xb046('0x12')]);return _0x5ee8b2(_0x55f702[_0xb046('0xf')][_0xb046('0x12')]);}else{logger['info'](_0xb046('0x11'),_0xe45985,'request\x20sent');_0x5ee8b2(_0x55f702[_0xb046('0x13')]['message']);}})[_0xb046('0x14')](function(_0xdce3e6){logger[_0xb046('0xf')](_0xb046('0x11'),_0xe45985,_0xdce3e6);_0x47fea5(_0xdce3e6);});});} \ No newline at end of file +var _0x93bb=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x3ccfd5,_0x45b141){var _0xbece34=function(_0x5053fe){while(--_0x5053fe){_0x3ccfd5['push'](_0x3ccfd5['shift']());}};_0xbece34(++_0x45b141);}(_0x93bb,0x1b5));var _0xb93b=function(_0x4d1e62,_0x453022){_0x4d1e62=_0x4d1e62-0x0;var _0x37adc1=_0x93bb[_0x4d1e62];return _0x37adc1;};'use strict';var _=require(_0xb93b('0x0'));var util=require(_0xb93b('0x1'));var moment=require(_0xb93b('0x2'));var BPromise=require(_0xb93b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb93b('0x4'));var db=require(_0xb93b('0x5'))['db'];var utils=require(_0xb93b('0x6'));var logger=require(_0xb93b('0x7'))(_0xb93b('0x8'));var config=require(_0xb93b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb93b('0xa')][_0xb93b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d44e6,_0x2dfc7b,_0x3a59c2){return new BPromise(function(_0x287d5a,_0x70b58c){return client['request'](_0x4d44e6,_0x3a59c2)['then'](function(_0x1f5575){logger['info'](_0xb93b('0xc'),_0x2dfc7b,_0xb93b('0xd'));logger[_0xb93b('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2dfc7b,_0xb93b('0xd'),JSON[_0xb93b('0xf')](_0x1f5575));if(_0x1f5575[_0xb93b('0x10')]){if(_0x1f5575[_0xb93b('0x10')]['code']===0x1f4){logger['error'](_0xb93b('0xc'),_0x2dfc7b,_0x1f5575[_0xb93b('0x10')][_0xb93b('0x11')]);return _0x70b58c(_0x1f5575[_0xb93b('0x10')][_0xb93b('0x11')]);}logger[_0xb93b('0x10')](_0xb93b('0xc'),_0x2dfc7b,_0x1f5575[_0xb93b('0x10')][_0xb93b('0x11')]);return _0x287d5a(_0x1f5575['error'][_0xb93b('0x11')]);}else{logger['info'](_0xb93b('0xc'),_0x2dfc7b,_0xb93b('0xd'));_0x287d5a(_0x1f5575[_0xb93b('0x12')]['message']);}})['catch'](function(_0x156bd7){logger[_0xb93b('0x10')](_0xb93b('0xc'),_0x2dfc7b,_0x156bd7);_0x70b58c(_0x156bd7);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 2086bf8..a0f1809 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 _0xfa53=['delete','exports','multer','connect-timeout','express','Router','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','put'];(function(_0x371145,_0x271b3d){var _0x583fae=function(_0x596df7){while(--_0x596df7){_0x371145['push'](_0x371145['shift']());}};_0x583fae(++_0x271b3d);}(_0xfa53,0x152));var _0x3fa5=function(_0x34f6f4,_0x80f33e){_0x34f6f4=_0x34f6f4-0x0;var _0x4b7d79=_0xfa53[_0x34f6f4];return _0x4b7d79;};'use strict';var multer=require(_0x3fa5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3fa5('0x1'));var express=require(_0x3fa5('0x2'));var router=express[_0x3fa5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3fa5('0x4'));var controller=require(_0x3fa5('0x5'));router[_0x3fa5('0x6')]('/',auth[_0x3fa5('0x7')](),controller[_0x3fa5('0x8')]);router[_0x3fa5('0x6')](_0x3fa5('0x9'),auth[_0x3fa5('0x7')](),controller[_0x3fa5('0xa')]);router['post']('/',auth[_0x3fa5('0x7')](),controller['create']);router[_0x3fa5('0xb')](_0x3fa5('0x9'),auth[_0x3fa5('0x7')](),controller['update']);router[_0x3fa5('0xc')](_0x3fa5('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x3fa5('0xd')]=router; \ No newline at end of file +var _0xa287=['express','Router','./intZendeskField.controller','get','isAuthenticated','/:id','create','update','delete','destroy','exports','multer','path'];(function(_0x266945,_0x5c5e8c){var _0x4477d5=function(_0x18c0b2){while(--_0x18c0b2){_0x266945['push'](_0x266945['shift']());}};_0x4477d5(++_0x5c5e8c);}(_0xa287,0x73));var _0x7a28=function(_0x12c3d1,_0x3c6ae7){_0x12c3d1=_0x12c3d1-0x0;var _0x282840=_0xa287[_0x12c3d1];return _0x282840;};'use strict';var multer=require(_0x7a28('0x0'));var util=require('util');var path=require(_0x7a28('0x1'));var timeout=require('connect-timeout');var express=require(_0x7a28('0x2'));var router=express[_0x7a28('0x3')]();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(_0x7a28('0x4'));router[_0x7a28('0x5')]('/',auth[_0x7a28('0x6')](),controller['index']);router[_0x7a28('0x5')](_0x7a28('0x7'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x7a28('0x8')]);router['put'](_0x7a28('0x7'),auth['isAuthenticated'](),controller[_0x7a28('0x9')]);router[_0x7a28('0xa')]('/:id',auth[_0x7a28('0x6')](),controller[_0x7a28('0xb')]);module[_0x7a28('0xc')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index bc54a6a..e6b69c0 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 _0xb66c=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xb66c,0x175));var _0xcb66=function(_0x49be7a,_0x569a87){_0x49be7a=_0x49be7a-0x0;var _0x18a404=_0xb66c[_0x49be7a];return _0x18a404;};'use strict';var Sequelize=require(_0xcb66('0x0'));module['exports']={'type':{'type':Sequelize[_0xcb66('0x1')]('string',_0xcb66('0x2'),_0xcb66('0x3'),_0xcb66('0x4'),'picklist'),'defaultValue':_0xcb66('0x5')},'content':{'type':Sequelize[_0xcb66('0x6')]},'key':{'type':Sequelize[_0xcb66('0x6')]},'keyType':{'type':Sequelize[_0xcb66('0x1')]('string','variable',_0xcb66('0x3'))},'keyContent':{'type':Sequelize[_0xcb66('0x6')]},'idField':{'type':Sequelize[_0xcb66('0x6')]},'nameField':{'type':Sequelize[_0xcb66('0x6')]},'customField':{'type':Sequelize[_0xcb66('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb647=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x149d84,_0x525f55){var _0x454905=function(_0x3412fc){while(--_0x3412fc){_0x149d84['push'](_0x149d84['shift']());}};_0x454905(++_0x525f55);}(_0xb647,0xdb));var _0x7b64=function(_0x1150cd,_0x556559){_0x1150cd=_0x1150cd-0x0;var _0x3134d1=_0xb647[_0x1150cd];return _0x3134d1;};'use strict';var Sequelize=require(_0x7b64('0x0'));module[_0x7b64('0x1')]={'type':{'type':Sequelize[_0x7b64('0x2')](_0x7b64('0x3'),_0x7b64('0x4'),_0x7b64('0x5'),_0x7b64('0x6'),_0x7b64('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7b64('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7b64('0x2')](_0x7b64('0x3'),_0x7b64('0x4'),_0x7b64('0x5'))},'keyContent':{'type':Sequelize[_0x7b64('0x8')]},'idField':{'type':Sequelize[_0x7b64('0x8')]},'nameField':{'type':Sequelize[_0x7b64('0x8')]},'customField':{'type':Sequelize[_0x7b64('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7b64('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d60a64a..f8470c0 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 _0x7217=['rawAttributes','type','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/environment','../../config/license/util','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','ZendeskField'];(function(_0x44258c,_0x219b1b){var _0x86cb97=function(_0x2b5d0c){while(--_0x2b5d0c){_0x44258c['push'](_0x44258c['shift']());}};_0x86cb97(++_0x219b1b);}(_0x7217,0x19e));var _0x7721=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x7217[_0x4154a6];return _0x3b2786;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var fs_extra=require(_0x7721('0xb'));var _=require(_0x7721('0xc'));var squel=require(_0x7721('0xd'));var crypto=require(_0x7721('0xe'));var jsforce=require(_0x7721('0xf'));var deskjs=require(_0x7721('0x10'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x11'));var Papa=require(_0x7721('0x12'));var Redis=require(_0x7721('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7721('0x14'));var as=require(_0x7721('0x15'));var hardwareService=require(_0x7721('0x16'));var logger=require(_0x7721('0x17'))(_0x7721('0x18'));var utils=require(_0x7721('0x19'));var config=require(_0x7721('0x1a'));var licenseUtil=require(_0x7721('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2911ec,_0x199930){_0x199930=_0x199930||0xcc;return function(_0x57ff6d){if(_0x57ff6d){return _0x2911ec[_0x7721('0x1c')](_0x199930);}return _0x2911ec[_0x7721('0x1d')](_0x199930)[_0x7721('0x1e')]();};}function respondWithResult(_0x2e9752,_0x5069da){_0x5069da=_0x5069da||0xc8;return function(_0x3cbce8){if(_0x3cbce8){return _0x2e9752[_0x7721('0x1d')](_0x5069da)['json'](_0x3cbce8);}};}function respondWithFilteredResult(_0x4e199a,_0x4b183e){return function(_0x5ed54){if(_0x5ed54){var _0x25a628=_0x5ed54[_0x7721('0x1f')],_0x3cc909=_0x4b183e['offset'],_0x32550d=_0x4b183e[_0x7721('0x20')]+_0x4b183e['limit'],_0x5ed94b;if(_0x32550d>=_0x25a628){_0x32550d=_0x25a628;_0x5ed94b=0xc8;}else{_0x5ed94b=0xce;}_0x4e199a[_0x7721('0x1d')](_0x5ed94b);return _0x4e199a[_0x7721('0x21')](_0x7721('0x22'),_0x3cc909+'-'+_0x32550d+'/'+_0x25a628)[_0x7721('0x23')](_0x5ed54);}return null;};}function patchUpdates(_0x2286e5){return function(_0x40af90){try{jsonpatch[_0x7721('0x24')](_0x40af90,_0x2286e5,!![]);}catch(_0x413263){return BPromise[_0x7721('0x25')](_0x413263);}return _0x40af90[_0x7721('0x26')]();};}function saveUpdates(_0x4ce1db,_0x288f7e){return function(_0x2c1583){if(_0x2c1583){return _0x2c1583[_0x7721('0x27')](_0x4ce1db)[_0x7721('0x28')](function(_0x57140c){return _0x57140c;});}return null;};}function removeEntity(_0x28f5a6,_0x512f31){return function(_0xb9e9dd){if(_0xb9e9dd){return _0xb9e9dd[_0x7721('0x29')]()[_0x7721('0x28')](function(){_0x28f5a6[_0x7721('0x1d')](0xcc)[_0x7721('0x1e')]();});}};}function handleEntityNotFound(_0x395b15,_0x2c6b7b){return function(_0x5b4d74){if(!_0x5b4d74){_0x395b15[_0x7721('0x1c')](0x194);}return _0x5b4d74;};}function handleError(_0x1abedb,_0x125564){_0x125564=_0x125564||0x1f4;return function(_0x1f67c7){logger[_0x7721('0x2a')](_0x1f67c7[_0x7721('0x2b')]);if(_0x1f67c7[_0x7721('0x2c')]){delete _0x1f67c7[_0x7721('0x2c')];}_0x1abedb[_0x7721('0x1d')](_0x125564)['send'](_0x1f67c7);};}exports[_0x7721('0x2d')]=function(_0x5b0551,_0x499b87){var _0x315202={},_0x343c19={},_0x53c904={'count':0x0,'rows':[]};var _0x158d98=_[_0x7721('0x2e')](db[_0x7721('0x2f')][_0x7721('0x30')],function(_0x1da2d8){return{'name':_0x1da2d8['fieldName'],'type':_0x1da2d8[_0x7721('0x31')][_0x7721('0x32')]};});_0x343c19['model']=_['map'](_0x158d98,_0x7721('0x2c'));_0x343c19[_0x7721('0x33')]=_['keys'](_0x5b0551[_0x7721('0x33')]);_0x343c19[_0x7721('0x34')]=_[_0x7721('0x35')](_0x343c19['model'],_0x343c19[_0x7721('0x33')]);_0x315202[_0x7721('0x36')]=_[_0x7721('0x35')](_0x343c19[_0x7721('0x37')],qs[_0x7721('0x38')](_0x5b0551['query'][_0x7721('0x38')]));_0x315202[_0x7721('0x36')]=_0x315202[_0x7721('0x36')]['length']?_0x315202[_0x7721('0x36')]:_0x343c19[_0x7721('0x37')];if(!_0x5b0551['query'][_0x7721('0x39')]('nolimit')){_0x315202[_0x7721('0x3a')]=qs[_0x7721('0x3a')](_0x5b0551[_0x7721('0x33')][_0x7721('0x3a')]);_0x315202[_0x7721('0x20')]=qs[_0x7721('0x20')](_0x5b0551[_0x7721('0x33')][_0x7721('0x20')]);}_0x315202[_0x7721('0x3b')]=qs[_0x7721('0x3c')](_0x5b0551[_0x7721('0x33')]['sort']);_0x315202[_0x7721('0x3d')]=qs['filters'](_[_0x7721('0x3e')](_0x5b0551[_0x7721('0x33')],_0x343c19[_0x7721('0x34')]),_0x158d98);if(_0x5b0551[_0x7721('0x33')][_0x7721('0x3f')]){_0x315202[_0x7721('0x3d')]=_['merge'](_0x315202['where'],{'$or':_['map'](_0x158d98,function(_0x539560){if(_0x539560[_0x7721('0x31')]!==_0x7721('0x40')){var _0x1acc72={};_0x1acc72[_0x539560[_0x7721('0x2c')]]={'$like':'%'+_0x5b0551['query'][_0x7721('0x3f')]+'%'};return _0x1acc72;}})});}_0x315202=_['merge']({},_0x315202,_0x5b0551[_0x7721('0x41')]);var _0x11f356={'where':_0x315202['where']};return db[_0x7721('0x2f')][_0x7721('0x1f')](_0x11f356)['then'](function(_0x4d0111){_0x53c904[_0x7721('0x1f')]=_0x4d0111;if(_0x5b0551[_0x7721('0x33')][_0x7721('0x42')]){_0x315202[_0x7721('0x43')]=[{'all':!![]}];}return db['ZendeskField'][_0x7721('0x44')](_0x315202);})[_0x7721('0x28')](function(_0x40ce8c){_0x53c904[_0x7721('0x45')]=_0x40ce8c;return _0x53c904;})[_0x7721('0x28')](respondWithFilteredResult(_0x499b87,_0x315202))['catch'](handleError(_0x499b87,null));};exports[_0x7721('0x46')]=function(_0x4a2c28,_0xaa3216){var _0x4a5b59={'raw':!![],'where':{'id':_0x4a2c28[_0x7721('0x47')]['id']}},_0x2333b8={};_0x2333b8[_0x7721('0x37')]=_['keys'](db[_0x7721('0x2f')][_0x7721('0x30')]);_0x2333b8[_0x7721('0x33')]=_['keys'](_0x4a2c28[_0x7721('0x33')]);_0x2333b8[_0x7721('0x34')]=_[_0x7721('0x35')](_0x2333b8[_0x7721('0x37')],_0x2333b8[_0x7721('0x33')]);_0x4a5b59[_0x7721('0x36')]=_[_0x7721('0x35')](_0x2333b8['model'],qs['fields'](_0x4a2c28[_0x7721('0x33')][_0x7721('0x38')]));_0x4a5b59[_0x7721('0x36')]=_0x4a5b59[_0x7721('0x36')][_0x7721('0x48')]?_0x4a5b59[_0x7721('0x36')]:_0x2333b8[_0x7721('0x37')];if(_0x4a2c28[_0x7721('0x33')][_0x7721('0x42')]){_0x4a5b59[_0x7721('0x43')]=[{'all':!![]}];}_0x4a5b59=_['merge']({},_0x4a5b59,_0x4a2c28['options']);return db[_0x7721('0x2f')][_0x7721('0x49')](_0x4a5b59)[_0x7721('0x28')](handleEntityNotFound(_0xaa3216,null))[_0x7721('0x28')](respondWithResult(_0xaa3216,null))['catch'](handleError(_0xaa3216,null));};exports[_0x7721('0x4a')]=function(_0x2d5a88,_0x56c3d9){return db[_0x7721('0x2f')]['create'](_0x2d5a88[_0x7721('0x4b')],{})['then'](respondWithResult(_0x56c3d9,0xc9))[_0x7721('0x4c')](handleError(_0x56c3d9,null));};exports[_0x7721('0x27')]=function(_0xf17c40,_0x4eda58){if(_0xf17c40[_0x7721('0x4b')]['id']){delete _0xf17c40[_0x7721('0x4b')]['id'];}return db['ZendeskField'][_0x7721('0x49')]({'where':{'id':_0xf17c40[_0x7721('0x47')]['id']}})[_0x7721('0x28')](handleEntityNotFound(_0x4eda58,null))['then'](saveUpdates(_0xf17c40[_0x7721('0x4b')],null))['then'](respondWithResult(_0x4eda58,null))[_0x7721('0x4c')](handleError(_0x4eda58,null));};exports[_0x7721('0x29')]=function(_0x4738ef,_0x443503){return db[_0x7721('0x2f')][_0x7721('0x49')]({'where':{'id':_0x4738ef[_0x7721('0x47')]['id']}})[_0x7721('0x28')](handleEntityNotFound(_0x443503,null))[_0x7721('0x28')](removeEntity(_0x443503,null))[_0x7721('0x4c')](handleError(_0x443503,null));}; \ No newline at end of file +var _0xabce=['set','Content-Range','reject','update','then','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','catch','show','keys','includeAll','include','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0xabce,0x103));var _0xeabc=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xabce[_0x21aec3];return _0x288bbc;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeabc('0x9'));var _=require('lodash');var squel=require(_0xeabc('0xa'));var crypto=require(_0xeabc('0xb'));var jsforce=require(_0xeabc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeabc('0x8'));var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x36a92e,_0xcfbf06){_0xcfbf06=_0xcfbf06||0xcc;return function(_0x53df9c){if(_0x53df9c){return _0x36a92e[_0xeabc('0x1a')](_0xcfbf06);}return _0x36a92e[_0xeabc('0x1b')](_0xcfbf06)[_0xeabc('0x1c')]();};}function respondWithResult(_0x55f0de,_0x5f4ee8){_0x5f4ee8=_0x5f4ee8||0xc8;return function(_0x3170ea){if(_0x3170ea){return _0x55f0de[_0xeabc('0x1b')](_0x5f4ee8)[_0xeabc('0x1d')](_0x3170ea);}};}function respondWithFilteredResult(_0x53d5cb,_0xf913d7){return function(_0x638976){if(_0x638976){var _0x49f2d8=_0x638976[_0xeabc('0x1e')],_0x53fe28=_0xf913d7[_0xeabc('0x1f')],_0x10fa8e=_0xf913d7[_0xeabc('0x1f')]+_0xf913d7[_0xeabc('0x20')],_0x581d29;if(_0x10fa8e>=_0x49f2d8){_0x10fa8e=_0x49f2d8;_0x581d29=0xc8;}else{_0x581d29=0xce;}_0x53d5cb[_0xeabc('0x1b')](_0x581d29);return _0x53d5cb[_0xeabc('0x21')](_0xeabc('0x22'),_0x53fe28+'-'+_0x10fa8e+'/'+_0x49f2d8)[_0xeabc('0x1d')](_0x638976);}return null;};}function patchUpdates(_0x5d92e5){return function(_0x1253e4){try{jsonpatch['apply'](_0x1253e4,_0x5d92e5,!![]);}catch(_0x31201a){return BPromise[_0xeabc('0x23')](_0x31201a);}return _0x1253e4['save']();};}function saveUpdates(_0x28063a,_0x41d67a){return function(_0x254590){if(_0x254590){return _0x254590[_0xeabc('0x24')](_0x28063a)[_0xeabc('0x25')](function(_0x4e99a4){return _0x4e99a4;});}return null;};}function removeEntity(_0xecdbf,_0x10c675){return function(_0x91ab00){if(_0x91ab00){return _0x91ab00['destroy']()[_0xeabc('0x25')](function(){_0xecdbf[_0xeabc('0x1b')](0xcc)[_0xeabc('0x1c')]();});}};}function handleEntityNotFound(_0x319119,_0x5b8838){return function(_0x109e1d){if(!_0x109e1d){_0x319119['sendStatus'](0x194);}return _0x109e1d;};}function handleError(_0x27dbaf,_0x4d4e29){_0x4d4e29=_0x4d4e29||0x1f4;return function(_0x811f0d){logger[_0xeabc('0x26')](_0x811f0d[_0xeabc('0x27')]);if(_0x811f0d[_0xeabc('0x28')]){delete _0x811f0d[_0xeabc('0x28')];}_0x27dbaf[_0xeabc('0x1b')](_0x4d4e29)[_0xeabc('0x29')](_0x811f0d);};}exports['index']=function(_0x5b2934,_0x459c8a){var _0x5bf8f2={},_0x3c1b5b={},_0x2b342c={'count':0x0,'rows':[]};var _0x48fb52=_[_0xeabc('0x2a')](db[_0xeabc('0x2b')][_0xeabc('0x2c')],function(_0x2f8633){return{'name':_0x2f8633[_0xeabc('0x2d')],'type':_0x2f8633[_0xeabc('0x2e')][_0xeabc('0x2f')]};});_0x3c1b5b[_0xeabc('0x30')]=_[_0xeabc('0x2a')](_0x48fb52,'name');_0x3c1b5b[_0xeabc('0x31')]=_['keys'](_0x5b2934[_0xeabc('0x31')]);_0x3c1b5b[_0xeabc('0x32')]=_[_0xeabc('0x33')](_0x3c1b5b[_0xeabc('0x30')],_0x3c1b5b[_0xeabc('0x31')]);_0x5bf8f2[_0xeabc('0x34')]=_[_0xeabc('0x33')](_0x3c1b5b['model'],qs[_0xeabc('0x35')](_0x5b2934[_0xeabc('0x31')][_0xeabc('0x35')]));_0x5bf8f2['attributes']=_0x5bf8f2[_0xeabc('0x34')][_0xeabc('0x36')]?_0x5bf8f2[_0xeabc('0x34')]:_0x3c1b5b['model'];if(!_0x5b2934[_0xeabc('0x31')][_0xeabc('0x37')](_0xeabc('0x38'))){_0x5bf8f2['limit']=qs[_0xeabc('0x20')](_0x5b2934[_0xeabc('0x31')]['limit']);_0x5bf8f2['offset']=qs[_0xeabc('0x1f')](_0x5b2934[_0xeabc('0x31')]['offset']);}_0x5bf8f2[_0xeabc('0x39')]=qs[_0xeabc('0x3a')](_0x5b2934[_0xeabc('0x31')][_0xeabc('0x3a')]);_0x5bf8f2[_0xeabc('0x3b')]=qs['filters'](_[_0xeabc('0x3c')](_0x5b2934['query'],_0x3c1b5b[_0xeabc('0x32')]),_0x48fb52);if(_0x5b2934[_0xeabc('0x31')][_0xeabc('0x3d')]){_0x5bf8f2['where']=_['merge'](_0x5bf8f2[_0xeabc('0x3b')],{'$or':_['map'](_0x48fb52,function(_0x113d5a){if(_0x113d5a['type']!=='VIRTUAL'){var _0x5ee4d2={};_0x5ee4d2[_0x113d5a['name']]={'$like':'%'+_0x5b2934[_0xeabc('0x31')]['filter']+'%'};return _0x5ee4d2;}})});}_0x5bf8f2=_[_0xeabc('0x3e')]({},_0x5bf8f2,_0x5b2934[_0xeabc('0x3f')]);var _0x5c7302={'where':_0x5bf8f2[_0xeabc('0x3b')]};return db['ZendeskField'][_0xeabc('0x1e')](_0x5c7302)['then'](function(_0xbd7f03){_0x2b342c[_0xeabc('0x1e')]=_0xbd7f03;if(_0x5b2934[_0xeabc('0x31')]['includeAll']){_0x5bf8f2['include']=[{'all':!![]}];}return db['ZendeskField'][_0xeabc('0x40')](_0x5bf8f2);})[_0xeabc('0x25')](function(_0xafa59b){_0x2b342c['rows']=_0xafa59b;return _0x2b342c;})['then'](respondWithFilteredResult(_0x459c8a,_0x5bf8f2))[_0xeabc('0x41')](handleError(_0x459c8a,null));};exports[_0xeabc('0x42')]=function(_0x5e9cb3,_0xc6af4d){var _0x5e0b78={'raw':!![],'where':{'id':_0x5e9cb3['params']['id']}},_0xf8a5dd={};_0xf8a5dd['model']=_['keys'](db[_0xeabc('0x2b')][_0xeabc('0x2c')]);_0xf8a5dd[_0xeabc('0x31')]=_[_0xeabc('0x43')](_0x5e9cb3['query']);_0xf8a5dd[_0xeabc('0x32')]=_['intersection'](_0xf8a5dd[_0xeabc('0x30')],_0xf8a5dd[_0xeabc('0x31')]);_0x5e0b78[_0xeabc('0x34')]=_[_0xeabc('0x33')](_0xf8a5dd[_0xeabc('0x30')],qs['fields'](_0x5e9cb3['query'][_0xeabc('0x35')]));_0x5e0b78['attributes']=_0x5e0b78[_0xeabc('0x34')][_0xeabc('0x36')]?_0x5e0b78['attributes']:_0xf8a5dd[_0xeabc('0x30')];if(_0x5e9cb3[_0xeabc('0x31')][_0xeabc('0x44')]){_0x5e0b78[_0xeabc('0x45')]=[{'all':!![]}];}_0x5e0b78=_[_0xeabc('0x3e')]({},_0x5e0b78,_0x5e9cb3[_0xeabc('0x3f')]);return db[_0xeabc('0x2b')]['find'](_0x5e0b78)[_0xeabc('0x25')](handleEntityNotFound(_0xc6af4d,null))[_0xeabc('0x25')](respondWithResult(_0xc6af4d,null))[_0xeabc('0x41')](handleError(_0xc6af4d,null));};exports[_0xeabc('0x46')]=function(_0x271f8c,_0x3fbc97){return db[_0xeabc('0x2b')][_0xeabc('0x46')](_0x271f8c[_0xeabc('0x47')],{})[_0xeabc('0x25')](respondWithResult(_0x3fbc97,0xc9))['catch'](handleError(_0x3fbc97,null));};exports[_0xeabc('0x24')]=function(_0x2e6efb,_0x41f5d7){if(_0x2e6efb[_0xeabc('0x47')]['id']){delete _0x2e6efb[_0xeabc('0x47')]['id'];}return db[_0xeabc('0x2b')][_0xeabc('0x48')]({'where':{'id':_0x2e6efb['params']['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x41f5d7,null))[_0xeabc('0x25')](saveUpdates(_0x2e6efb[_0xeabc('0x47')],null))[_0xeabc('0x25')](respondWithResult(_0x41f5d7,null))[_0xeabc('0x41')](handleError(_0x41f5d7,null));};exports['destroy']=function(_0x305946,_0x2b2b9c){return db[_0xeabc('0x2b')][_0xeabc('0x48')]({'where':{'id':_0x305946['params']['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x2b2b9c,null))[_0xeabc('0x25')](removeEntity(_0x2b2b9c,null))['catch'](handleError(_0x2b2b9c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index eb4f4ed..45dd142 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 _0xbca8=['path','rimraf','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1f1b15,_0x4e927c){var _0x3f2930=function(_0x2653ca){while(--_0x2653ca){_0x1f1b15['push'](_0x1f1b15['shift']());}};_0x3f2930(++_0x4e927c);}(_0xbca8,0xcc));var _0x8bca=function(_0x340dc5,_0x2a0e25){_0x340dc5=_0x340dc5-0x0;var _0x169854=_0xbca8[_0x340dc5];return _0x169854;};'use strict';var _=require(_0x8bca('0x0'));var util=require(_0x8bca('0x1'));var logger=require(_0x8bca('0x2'))(_0x8bca('0x3'));var moment=require(_0x8bca('0x4'));var BPromise=require('bluebird');var rp=require(_0x8bca('0x5'));var fs=require('fs');var path=require(_0x8bca('0x6'));var rimraf=require(_0x8bca('0x7'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0x8bca('0x8')]=function(_0x2ecf60,_0x318474){return _0x2ecf60[_0x8bca('0x9')]('ZendeskField',attributes,{'tableName':_0x8bca('0xa'),'paranoid':![],'indexes':[{'name':_0x8bca('0xb'),'fields':[_0x8bca('0xc'),_0x8bca('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb688=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x139034,_0x3dd81c){var _0x41eb12=function(_0x1b660a){while(--_0x1b660a){_0x139034['push'](_0x139034['shift']());}};_0x41eb12(++_0x3dd81c);}(_0xb688,0xcf));var _0x8b68=function(_0x3b84c2,_0x3587a9){_0x3b84c2=_0x3b84c2-0x0;var _0x25bf40=_0xb688[_0x3b84c2];return _0x25bf40;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var rp=require(_0x8b68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var attributes=require(_0x8b68('0x8'));module[_0x8b68('0x9')]=function(_0x583d16,_0x34314e){return _0x583d16['define'](_0x8b68('0xa'),attributes,{'tableName':_0x8b68('0xb'),'paranoid':![],'indexes':[{'name':_0x8b68('0xc'),'fields':[_0x8b68('0xd'),_0x8b68('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 41b7e40..bfc529e 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 _0x4404=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch'];(function(_0x5a5c0d,_0x952e87){var _0xce9729=function(_0x1477e8){while(--_0x1477e8){_0x5a5c0d['push'](_0x5a5c0d['shift']());}};_0xce9729(++_0x952e87);}(_0x4404,0x111));var _0x4440=function(_0x592f87,_0x35f49d){_0x592f87=_0x592f87-0x0;var _0x444bbb=_0x4404[_0x592f87];return _0x444bbb;};'use strict';var _=require('lodash');var util=require(_0x4440('0x0'));var moment=require(_0x4440('0x1'));var BPromise=require(_0x4440('0x2'));var rs=require(_0x4440('0x3'));var fs=require('fs');var Redis=require(_0x4440('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4440('0x5'))(_0x4440('0x6'));var config=require(_0x4440('0x7'));var jayson=require(_0x4440('0x8'));var client=jayson[_0x4440('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b612,_0xcd58f9,_0x18d5fc){return new BPromise(function(_0xa863e9,_0x3e7582){return client[_0x4440('0xa')](_0x59b612,_0x18d5fc)[_0x4440('0xb')](function(_0x5b9ce5){logger['info'](_0x4440('0xc'),_0xcd58f9,'request\x20sent');logger['debug'](_0x4440('0xd'),_0xcd58f9,'request\x20sent',JSON[_0x4440('0xe')](_0x5b9ce5));if(_0x5b9ce5['error']){if(_0x5b9ce5[_0x4440('0xf')]['code']===0x1f4){logger['error'](_0x4440('0xc'),_0xcd58f9,_0x5b9ce5[_0x4440('0xf')]['message']);return _0x3e7582(_0x5b9ce5[_0x4440('0xf')][_0x4440('0x10')]);}logger[_0x4440('0xf')](_0x4440('0xc'),_0xcd58f9,_0x5b9ce5[_0x4440('0xf')][_0x4440('0x10')]);return _0xa863e9(_0x5b9ce5[_0x4440('0xf')][_0x4440('0x10')]);}else{logger[_0x4440('0x11')]('ZendeskField,\x20%s,\x20%s',_0xcd58f9,_0x4440('0x12'));_0xa863e9(_0x5b9ce5[_0x4440('0x13')][_0x4440('0x10')]);}})[_0x4440('0x14')](function(_0x5ffbbb){logger['error'](_0x4440('0xc'),_0xcd58f9,_0x5ffbbb);_0x3e7582(_0x5ffbbb);});});} \ No newline at end of file +var _0x1443=['message','info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','ZendeskField,\x20%s,\x20%s'];(function(_0x49ab67,_0x48c509){var _0x568127=function(_0x53b3fa){while(--_0x53b3fa){_0x49ab67['push'](_0x49ab67['shift']());}};_0x568127(++_0x48c509);}(_0x1443,0xc2));var _0x3144=function(_0x4c8410,_0x5274a4){_0x4c8410=_0x4c8410-0x0;var _0x648ebe=_0x1443[_0x4c8410];return _0x648ebe;};'use strict';var _=require(_0x3144('0x0'));var util=require('util');var moment=require(_0x3144('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3144('0x2'));var db=require(_0x3144('0x3'))['db'];var utils=require(_0x3144('0x4'));var logger=require(_0x3144('0x5'))(_0x3144('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3144('0x7')][_0x3144('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xea16c5,_0x407a07,_0x462db7){return new BPromise(function(_0x4059a5,_0x3b3cbd){return client['request'](_0xea16c5,_0x462db7)[_0x3144('0x9')](function(_0x2936ba){logger['info']('ZendeskField,\x20%s,\x20%s',_0x407a07,_0x3144('0xa'));logger[_0x3144('0xb')](_0x3144('0xc'),_0x407a07,_0x3144('0xa'),JSON['stringify'](_0x2936ba));if(_0x2936ba[_0x3144('0xd')]){if(_0x2936ba['error']['code']===0x1f4){logger[_0x3144('0xd')](_0x3144('0xe'),_0x407a07,_0x2936ba[_0x3144('0xd')][_0x3144('0xf')]);return _0x3b3cbd(_0x2936ba[_0x3144('0xd')]['message']);}logger[_0x3144('0xd')]('ZendeskField,\x20%s,\x20%s',_0x407a07,_0x2936ba[_0x3144('0xd')][_0x3144('0xf')]);return _0x4059a5(_0x2936ba[_0x3144('0xd')][_0x3144('0xf')]);}else{logger[_0x3144('0x10')](_0x3144('0xe'),_0x407a07,_0x3144('0xa'));_0x4059a5(_0x2936ba[_0x3144('0x11')][_0x3144('0xf')]);}})[_0x3144('0x12')](function(_0x55a846){logger[_0x3144('0xd')](_0x3144('0xe'),_0x407a07,_0x55a846);_0x3b3cbd(_0x55a846);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 6b4eaa9..2457517 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 _0x9177=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x21fd7a,_0x153d0e){var _0x547f75=function(_0x35df2a){while(--_0x35df2a){_0x21fd7a['push'](_0x21fd7a['shift']());}};_0x547f75(++_0x153d0e);}(_0x9177,0xcb));var _0x7917=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0x9177[_0x442f02];return _0xab6ef1;};'use strict';var multer=require(_0x7917('0x0'));var util=require(_0x7917('0x1'));var path=require(_0x7917('0x2'));var timeout=require(_0x7917('0x3'));var express=require(_0x7917('0x4'));var router=express[_0x7917('0x5')]();var fs_extra=require(_0x7917('0x6'));var auth=require(_0x7917('0x7'));var interaction=require(_0x7917('0x8'));var config=require(_0x7917('0x9'));var controller=require('./intZohoAccount.controller');router[_0x7917('0xa')]('/',auth[_0x7917('0xb')](),controller[_0x7917('0xc')]);router[_0x7917('0xa')](_0x7917('0xd'),auth[_0x7917('0xb')](),controller['show']);router[_0x7917('0xa')](_0x7917('0xe'),auth[_0x7917('0xb')](),controller[_0x7917('0xf')]);router[_0x7917('0xa')](_0x7917('0x10'),auth[_0x7917('0xb')](),controller[_0x7917('0x11')]);router['post']('/',auth[_0x7917('0xb')](),controller['create']);router[_0x7917('0x12')](_0x7917('0xe'),auth[_0x7917('0xb')](),controller[_0x7917('0x13')]);router[_0x7917('0x14')](_0x7917('0xd'),auth[_0x7917('0xb')](),controller[_0x7917('0x15')]);router[_0x7917('0x16')](_0x7917('0xd'),auth[_0x7917('0xb')](),controller[_0x7917('0x17')]);module['exports']=router; \ No newline at end of file +var _0x4ee8=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','create','/:id/configurations'];(function(_0x30f47b,_0x28b299){var _0x5404e5=function(_0x59d5ad){while(--_0x59d5ad){_0x30f47b['push'](_0x30f47b['shift']());}};_0x5404e5(++_0x28b299);}(_0x4ee8,0x18b));var _0x84ee=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x4ee8[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0x84ee('0x0'));var util=require(_0x84ee('0x1'));var path=require(_0x84ee('0x2'));var timeout=require(_0x84ee('0x3'));var express=require(_0x84ee('0x4'));var router=express[_0x84ee('0x5')]();var fs_extra=require(_0x84ee('0x6'));var auth=require(_0x84ee('0x7'));var interaction=require(_0x84ee('0x8'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x84ee('0x9')]('/',auth[_0x84ee('0xa')](),controller[_0x84ee('0xb')]);router[_0x84ee('0x9')](_0x84ee('0xc'),auth[_0x84ee('0xa')](),controller[_0x84ee('0xd')]);router[_0x84ee('0x9')]('/:id/configurations',auth[_0x84ee('0xa')](),controller[_0x84ee('0xe')]);router[_0x84ee('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x84ee('0xf')]);router[_0x84ee('0x10')]('/',auth[_0x84ee('0xa')](),controller[_0x84ee('0x11')]);router['post'](_0x84ee('0x12'),auth[_0x84ee('0xa')](),controller['addConfiguration']);router[_0x84ee('0x13')]('/:id',auth[_0x84ee('0xa')](),controller[_0x84ee('0x14')]);router[_0x84ee('0x15')](_0x84ee('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x84ee('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index c2b2ddc..b325037 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 _0x6cc5=['exports','STRING'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x6cc5,0x1d2));var _0x56cc=function(_0xd47bae,_0x2112cd){_0xd47bae=_0xd47bae-0x0;var _0x1bc166=_0x6cc5[_0xd47bae];return _0x1bc166;};'use strict';var Sequelize=require('sequelize');module[_0x56cc('0x0')]={'name':{'type':Sequelize[_0x56cc('0x1')]},'description':{'type':Sequelize[_0x56cc('0x1')]},'host':{'type':Sequelize[_0x56cc('0x1')]},'zone':{'type':Sequelize[_0x56cc('0x1')]},'clientId':{'type':Sequelize[_0x56cc('0x1')]},'clientSecret':{'type':Sequelize[_0x56cc('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x56cc('0x1')]},'refreshToken':{'type':Sequelize[_0x56cc('0x1')]}}; \ No newline at end of file +var _0x3b86=['sequelize','STRING'];(function(_0x1daf88,_0x38cd7d){var _0x2a40b5=function(_0x5472c8){while(--_0x5472c8){_0x1daf88['push'](_0x1daf88['shift']());}};_0x2a40b5(++_0x38cd7d);}(_0x3b86,0x1e2));var _0x63b8=function(_0x41e6c2,_0x2d69b3){_0x41e6c2=_0x41e6c2-0x0;var _0x4dee7a=_0x3b86[_0x41e6c2];return _0x4dee7a;};'use strict';var Sequelize=require(_0x63b8('0x0'));module['exports']={'name':{'type':Sequelize[_0x63b8('0x1')]},'description':{'type':Sequelize[_0x63b8('0x1')]},'host':{'type':Sequelize[_0x63b8('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x63b8('0x1')]},'clientSecret':{'type':Sequelize[_0x63b8('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x63b8('0x1')]},'refreshToken':{'type':Sequelize[_0x63b8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5792072..f0abaa5 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 _0xd16c=['ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zoho.eu','com','serverUrl','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','stringify','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','ZohoAccount','includeAll','include','findAll','rows','show','params','fields','merge','create','body','find','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions'];(function(_0x15e75a,_0x20131a){var _0x20fcaa=function(_0x57a505){while(--_0x57a505){_0x15e75a['push'](_0x15e75a['shift']());}};_0x20fcaa(++_0x20131a);}(_0xd16c,0xb5));var _0xcd16=function(_0x395b2c,_0x2b8f56){_0x395b2c=_0x395b2c-0x0;var _0x3a55e6=_0xd16c[_0x395b2c];return _0x3a55e6;};'use strict';var pdf=require(_0xcd16('0x0'));var emlformat=require(_0xcd16('0x1'));var rimraf=require(_0xcd16('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd16('0x3'));var rp=require(_0xcd16('0x4'));var moment=require(_0xcd16('0x5'));var BPromise=require(_0xcd16('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcd16('0x7'));var sox=require(_0xcd16('0x8'));var csv=require(_0xcd16('0x9'));var ejs=require(_0xcd16('0xa'));var fs=require('fs');var fs_extra=require(_0xcd16('0xb'));var _=require(_0xcd16('0xc'));var squel=require('squel');var crypto=require(_0xcd16('0xd'));var jsforce=require(_0xcd16('0xe'));var deskjs=require(_0xcd16('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcd16('0x10'));var Papa=require(_0xcd16('0x11'));var Redis=require(_0xcd16('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd16('0x13'));var hardwareService=require(_0xcd16('0x14'));var logger=require(_0xcd16('0x15'))(_0xcd16('0x16'));var utils=require(_0xcd16('0x17'));var config=require(_0xcd16('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xcd16('0x19'));var jayson=require(_0xcd16('0x1a'));var client=jayson['client'][_0xcd16('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4cba38,_0x1d14f7,_0x312482,_0x42668a){return new BPromise(function(_0x45644c,_0x106c02){var _0xae27f3=_0x42668a||client;return _0xae27f3['request'](_0x4cba38,_0x312482)[_0xcd16('0x1c')](function(_0x582958){logger[_0xcd16('0x1d')](_0xcd16('0x1e'),_0x1d14f7,_0xcd16('0x1f'));logger[_0xcd16('0x20')](_0xcd16('0x21'),_0x1d14f7,'request\x20sent',JSON['stringify'](_0x582958));if(_0x582958[_0xcd16('0x22')]){if(_0x582958[_0xcd16('0x22')][_0xcd16('0x23')]===0x1f4){logger[_0xcd16('0x22')](_0xcd16('0x1e'),_0x1d14f7,_0x582958[_0xcd16('0x22')][_0xcd16('0x24')]);return _0x106c02(_0x582958[_0xcd16('0x22')][_0xcd16('0x24')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x1d14f7,_0x582958[_0xcd16('0x22')]['message']);return _0x45644c(_0x582958['error']['message']);}else{logger[_0xcd16('0x1d')]('ZohoAccount,\x20%s,\x20%s',_0x1d14f7,_0xcd16('0x1f'));_0x45644c(_0x582958['result']['message']);}})[_0xcd16('0x25')](function(_0x4063eb){logger[_0xcd16('0x22')](_0xcd16('0x1e'),_0x1d14f7,_0x4063eb);_0x106c02(_0x4063eb);});});}function respondWithStatusCode(_0xa2ed4a,_0x55e687){_0x55e687=_0x55e687||0xcc;return function(_0x3e1cf5){if(_0x3e1cf5){return _0xa2ed4a[_0xcd16('0x26')](_0x55e687);}return _0xa2ed4a[_0xcd16('0x27')](_0x55e687)[_0xcd16('0x28')]();};}function respondWithResult(_0x384edb,_0x1c52b6){_0x1c52b6=_0x1c52b6||0xc8;return function(_0x1b1e98){if(_0x1b1e98){return _0x384edb[_0xcd16('0x27')](_0x1c52b6)['json'](_0x1b1e98);}};}function respondWithFilteredResult(_0x4a2bb1,_0x53edf3){return function(_0x29317f){if(_0x29317f){var _0x52bb46=_0x29317f[_0xcd16('0x29')],_0x48733a=_0x53edf3[_0xcd16('0x2a')],_0xc0209c=_0x53edf3['offset']+_0x53edf3[_0xcd16('0x2b')],_0x56c211;if(_0xc0209c>=_0x52bb46){_0xc0209c=_0x52bb46;_0x56c211=0xc8;}else{_0x56c211=0xce;}_0x4a2bb1['status'](_0x56c211);return _0x4a2bb1[_0xcd16('0x2c')](_0xcd16('0x2d'),_0x48733a+'-'+_0xc0209c+'/'+_0x52bb46)[_0xcd16('0x2e')](_0x29317f);}return null;};}function patchUpdates(_0x19234e){return function(_0x2146f2){try{jsonpatch[_0xcd16('0x2f')](_0x2146f2,_0x19234e,!![]);}catch(_0x121bfe){return BPromise['reject'](_0x121bfe);}return _0x2146f2[_0xcd16('0x30')]();};}function saveUpdates(_0x3d2635,_0x2320c3){return function(_0x29022f){if(_0x29022f){return _0x29022f[_0xcd16('0x31')](_0x3d2635)[_0xcd16('0x1c')](function(_0x30ffbd){return _0x30ffbd;});}return null;};}function removeEntity(_0x180684,_0x205c8f){return function(_0x49a353){if(_0x49a353){return _0x49a353[_0xcd16('0x32')]()['then'](function(){_0x180684['status'](0xcc)[_0xcd16('0x28')]();});}};}function handleEntityNotFound(_0x13ab62,_0x493baf){return function(_0x1b3bcc){if(!_0x1b3bcc){_0x13ab62[_0xcd16('0x26')](0x194);}return _0x1b3bcc;};}function handleError(_0x2667f3,_0x1ed3f2){_0x1ed3f2=_0x1ed3f2||0x1f4;return function(_0x3629c){logger[_0xcd16('0x22')](_0x3629c[_0xcd16('0x33')]);if(_0x3629c[_0xcd16('0x34')]){delete _0x3629c[_0xcd16('0x34')];}_0x2667f3[_0xcd16('0x27')](_0x1ed3f2)[_0xcd16('0x35')](_0x3629c);};}exports[_0xcd16('0x36')]=function(_0x305fb7,_0x51a33a){var _0x1c8a3d={},_0x1ef8c7={},_0x217869={'count':0x0,'rows':[]};var _0xea3232=_['map'](db['ZohoAccount'][_0xcd16('0x37')],function(_0x3b9085){return{'name':_0x3b9085['fieldName'],'type':_0x3b9085[_0xcd16('0x38')][_0xcd16('0x39')]};});_0x1ef8c7[_0xcd16('0x3a')]=_[_0xcd16('0x3b')](_0xea3232,_0xcd16('0x34'));_0x1ef8c7['query']=_[_0xcd16('0x3c')](_0x305fb7[_0xcd16('0x3d')]);_0x1ef8c7[_0xcd16('0x3e')]=_[_0xcd16('0x3f')](_0x1ef8c7['model'],_0x1ef8c7[_0xcd16('0x3d')]);_0x1c8a3d[_0xcd16('0x40')]=_[_0xcd16('0x3f')](_0x1ef8c7['model'],qs['fields'](_0x305fb7[_0xcd16('0x3d')]['fields']));_0x1c8a3d[_0xcd16('0x40')]=_0x1c8a3d['attributes'][_0xcd16('0x41')]?_0x1c8a3d['attributes']:_0x1ef8c7[_0xcd16('0x3a')];if(!_0x305fb7[_0xcd16('0x3d')]['hasOwnProperty'](_0xcd16('0x42'))){_0x1c8a3d['limit']=qs[_0xcd16('0x2b')](_0x305fb7[_0xcd16('0x3d')][_0xcd16('0x2b')]);_0x1c8a3d[_0xcd16('0x2a')]=qs['offset'](_0x305fb7[_0xcd16('0x3d')][_0xcd16('0x2a')]);}_0x1c8a3d[_0xcd16('0x43')]=qs[_0xcd16('0x44')](_0x305fb7[_0xcd16('0x3d')][_0xcd16('0x44')]);_0x1c8a3d[_0xcd16('0x45')]=qs[_0xcd16('0x3e')](_[_0xcd16('0x46')](_0x305fb7[_0xcd16('0x3d')],_0x1ef8c7[_0xcd16('0x3e')]),_0xea3232);if(_0x305fb7[_0xcd16('0x3d')][_0xcd16('0x47')]){_0x1c8a3d[_0xcd16('0x45')]=_['merge'](_0x1c8a3d[_0xcd16('0x45')],{'$or':_['map'](_0xea3232,function(_0x3962b7){if(_0x3962b7['type']!==_0xcd16('0x48')){var _0xc79feb={};_0xc79feb[_0x3962b7['name']]={'$like':'%'+_0x305fb7[_0xcd16('0x3d')][_0xcd16('0x47')]+'%'};return _0xc79feb;}})});}_0x1c8a3d=_['merge']({},_0x1c8a3d,_0x305fb7[_0xcd16('0x49')]);var _0x815f74={'where':_0x1c8a3d[_0xcd16('0x45')]};return db[_0xcd16('0x4a')][_0xcd16('0x29')](_0x815f74)[_0xcd16('0x1c')](function(_0x3fbe36){_0x217869[_0xcd16('0x29')]=_0x3fbe36;if(_0x305fb7[_0xcd16('0x3d')][_0xcd16('0x4b')]){_0x1c8a3d[_0xcd16('0x4c')]=[{'all':!![]}];}return db[_0xcd16('0x4a')][_0xcd16('0x4d')](_0x1c8a3d);})['then'](function(_0x40b330){_0x217869[_0xcd16('0x4e')]=_0x40b330;return _0x217869;})[_0xcd16('0x1c')](respondWithFilteredResult(_0x51a33a,_0x1c8a3d))['catch'](handleError(_0x51a33a,null));};exports[_0xcd16('0x4f')]=function(_0x1297a0,_0xf8bcd1){var _0x449058={'raw':![],'where':{'id':_0x1297a0[_0xcd16('0x50')]['id']}},_0x476f24={};_0x476f24[_0xcd16('0x3a')]=_[_0xcd16('0x3c')](db['ZohoAccount'][_0xcd16('0x37')]);_0x476f24[_0xcd16('0x3d')]=_[_0xcd16('0x3c')](_0x1297a0[_0xcd16('0x3d')]);_0x476f24[_0xcd16('0x3e')]=_[_0xcd16('0x3f')](_0x476f24[_0xcd16('0x3a')],_0x476f24[_0xcd16('0x3d')]);_0x449058['attributes']=_['intersection'](_0x476f24[_0xcd16('0x3a')],qs[_0xcd16('0x51')](_0x1297a0[_0xcd16('0x3d')][_0xcd16('0x51')]));_0x449058[_0xcd16('0x40')]=_0x449058['attributes'][_0xcd16('0x41')]?_0x449058[_0xcd16('0x40')]:_0x476f24[_0xcd16('0x3a')];if(_0x1297a0[_0xcd16('0x3d')][_0xcd16('0x4b')]){_0x449058[_0xcd16('0x4c')]=[{'all':!![]}];}_0x449058=_[_0xcd16('0x52')]({},_0x449058,_0x1297a0[_0xcd16('0x49')]);return db[_0xcd16('0x4a')]['find'](_0x449058)[_0xcd16('0x1c')](handleEntityNotFound(_0xf8bcd1,null))['then'](respondWithResult(_0xf8bcd1,null))['catch'](handleError(_0xf8bcd1,null));};exports[_0xcd16('0x53')]=function(_0x49d46e,_0x492f7d){return db['ZohoAccount']['create'](_0x49d46e[_0xcd16('0x54')],{})[_0xcd16('0x1c')](respondWithResult(_0x492f7d,0xc9))[_0xcd16('0x25')](handleError(_0x492f7d,null));};exports[_0xcd16('0x31')]=function(_0x25920b,_0xf0f3ae){if(_0x25920b[_0xcd16('0x54')]['id']){delete _0x25920b[_0xcd16('0x54')]['id'];}return db[_0xcd16('0x4a')][_0xcd16('0x55')]({'where':{'id':_0x25920b['params']['id']}})[_0xcd16('0x1c')](handleEntityNotFound(_0xf0f3ae,null))[_0xcd16('0x1c')](saveUpdates(_0x25920b[_0xcd16('0x54')],null))['then'](respondWithResult(_0xf0f3ae,null))['catch'](handleError(_0xf0f3ae,null));};exports[_0xcd16('0x32')]=function(_0x2cb5bc,_0x396e0f){return db[_0xcd16('0x4a')][_0xcd16('0x55')]({'where':{'id':_0x2cb5bc['params']['id']}})['then'](handleEntityNotFound(_0x396e0f,null))['then'](removeEntity(_0x396e0f,null))[_0xcd16('0x25')](handleError(_0x396e0f,null));};exports[_0xcd16('0x56')]=function(_0x5924bf,_0xeb0c2a,_0x271a0c){var _0x4af111={};var _0x127bdb={};var _0x414ab3;var _0x441f7f;return db[_0xcd16('0x4a')]['findOne']({'where':{'id':_0x5924bf[_0xcd16('0x50')]['id']}})[_0xcd16('0x1c')](handleEntityNotFound(_0xeb0c2a,null))[_0xcd16('0x1c')](function(_0x575497){if(_0x575497){_0x414ab3=_0x575497;_0x127bdb[_0xcd16('0x3a')]=_[_0xcd16('0x3c')](db['ZohoConfiguration'][_0xcd16('0x37')]);_0x127bdb[_0xcd16('0x3d')]=_['keys'](_0x5924bf[_0xcd16('0x3d')]);_0x127bdb[_0xcd16('0x3e')]=_[_0xcd16('0x3f')](_0x127bdb[_0xcd16('0x3a')],_0x127bdb[_0xcd16('0x3d')]);_0x4af111[_0xcd16('0x40')]=_[_0xcd16('0x3f')](_0x127bdb[_0xcd16('0x3a')],qs[_0xcd16('0x51')](_0x5924bf[_0xcd16('0x3d')]['fields']));_0x4af111[_0xcd16('0x40')]=_0x4af111[_0xcd16('0x40')][_0xcd16('0x41')]?_0x4af111['attributes']:_0x127bdb[_0xcd16('0x3a')];_0x4af111[_0xcd16('0x43')]=qs[_0xcd16('0x44')](_0x5924bf[_0xcd16('0x3d')][_0xcd16('0x44')]);_0x4af111[_0xcd16('0x45')]=qs[_0xcd16('0x3e')](_[_0xcd16('0x46')](_0x5924bf[_0xcd16('0x3d')],_0x127bdb[_0xcd16('0x3e')]));if(_0x5924bf[_0xcd16('0x3d')][_0xcd16('0x47')]){_0x4af111[_0xcd16('0x45')]=_['merge'](_0x4af111[_0xcd16('0x45')],{'$or':_[_0xcd16('0x3b')](_0x4af111[_0xcd16('0x40')],function(_0x45b87a){var _0x1df335={};_0x1df335[_0x45b87a]={'$like':'%'+_0x5924bf[_0xcd16('0x3d')][_0xcd16('0x47')]+'%'};return _0x1df335;})});}_0x4af111=_[_0xcd16('0x52')]({},_0x4af111,_0x5924bf[_0xcd16('0x49')]);return _0x414ab3[_0xcd16('0x56')](_0x4af111);}})[_0xcd16('0x1c')](function(_0x7c563b){if(_0x7c563b){_0x441f7f=_0x7c563b[_0xcd16('0x41')];if(!_0x5924bf['query'][_0xcd16('0x57')]('nolimit')){_0x4af111[_0xcd16('0x2b')]=qs[_0xcd16('0x2b')](_0x5924bf[_0xcd16('0x3d')][_0xcd16('0x2b')]);_0x4af111[_0xcd16('0x2a')]=qs[_0xcd16('0x2a')](_0x5924bf['query'][_0xcd16('0x2a')]);}return _0x414ab3[_0xcd16('0x56')](_0x4af111);}})[_0xcd16('0x1c')](function(_0xec0d99){if(_0xec0d99){return _0xec0d99?{'count':_0x441f7f,'rows':_0xec0d99}:null;}})['then'](respondWithResult(_0xeb0c2a,null))['catch'](handleError(_0xeb0c2a,null));};exports[_0xcd16('0x58')]=function(_0x21102c,_0x3da07d,_0x390975){if(_0x21102c[_0xcd16('0x54')]['id']){delete _0x21102c[_0xcd16('0x54')]['id'];}return db[_0xcd16('0x4a')][_0xcd16('0x59')]({'where':{'id':_0x21102c[_0xcd16('0x50')]['id']}})[_0xcd16('0x1c')](handleEntityNotFound(_0x3da07d,null))['then'](function(_0x2d3c14){if(_0x2d3c14){_0x21102c[_0xcd16('0x54')][_0xcd16('0x5a')]=_0x2d3c14['id'];_0x21102c[_0xcd16('0x54')][_0xcd16('0x5b')]=integrations['getSubjects'](_0x21102c['body'][_0xcd16('0x5c')],_0x21102c['body'][_0xcd16('0x38')]);_0x21102c['body'][_0xcd16('0x5d')]=integrations[_0xcd16('0x5e')](_0x21102c[_0xcd16('0x54')][_0xcd16('0x5c')],_0x21102c[_0xcd16('0x54')]['type']);return db['ZohoConfiguration'][_0xcd16('0x53')](_0x21102c[_0xcd16('0x54')],{'include':[{'model':db[_0xcd16('0x5f')],'as':'Subjects'},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3da07d,null))[_0xcd16('0x25')](handleError(_0x3da07d,null));};function getAccessToken(_0x2dfe99){return new Promise(function(_0x21b6c4,_0x2619a0){var _0x56b157;switch(_0x2dfe99[_0xcd16('0x60')]){case'US':_0x56b157=_0xcd16('0x61');break;case'AU':_0x56b157='https://accounts.zoho.com.au';break;case'EU':_0x56b157=_0xcd16('0x62');break;case'IN':_0x56b157=_0xcd16('0x63');break;case'CN':_0x56b157=_0xcd16('0x64');break;default:_0x56b157=_0xcd16('0x62');break;}var _0x50e961={'method':_0xcd16('0x65'),'uri':_0x56b157+_0xcd16('0x66'),'qs':{'refresh_token':_0x2dfe99[_0xcd16('0x67')],'client_id':_0x2dfe99[_0xcd16('0x68')],'client_secret':_0x2dfe99[_0xcd16('0x69')],'grant_type':_0xcd16('0x6a')},'json':!![]};return rp(_0x50e961)[_0xcd16('0x1c')](function(_0x4b1abd){if(_0x4b1abd['access_token']){_0x21b6c4(_0x4b1abd['access_token']);}else{_0x2619a0(_0xcd16('0x6b'));}})[_0xcd16('0x25')](function(_0x7fdced){_0x2619a0(_0x7fdced);});});}exports[_0xcd16('0x6c')]=function(_0x36ffb2,_0x173346,_0x554a43){var _0x47409d,_0x1a0668,_0x1ad268,_0x5614af,_0x3650aa;return db['ZohoAccount'][_0xcd16('0x59')]({'where':{'id':_0x36ffb2[_0xcd16('0x50')]['id']},'attributes':['id',_0xcd16('0x6d'),'zone',_0xcd16('0x68'),'clientSecret','serverUrl',_0xcd16('0x23'),_0xcd16('0x67')]})['then'](handleEntityNotFound(_0x173346,null))[_0xcd16('0x1c')](function(_0x27287f){_0x3650aa=_0x27287f;_0x47409d=_0x3650aa['host'];_0x1a0668=_0x47409d===_0xcd16('0x6e')?'eu':_0xcd16('0x6f');_0x1ad268=_0x3650aa[_0xcd16('0x70')];var _0x2ea3da=_0x1ad268[_0xcd16('0x71')](-0x1);if(_0x2ea3da==='/'||_0x2ea3da==='\x5c'||_0x2ea3da===':'){_0x1ad268=_0x1ad268['substring'](0x0,_0x1ad268[_0xcd16('0x72')](_0x2ea3da));}if(!_0x3650aa[_0xcd16('0x67')]){throw new Error(_0xcd16('0x73'));}return getAccessToken(_0x3650aa);})[_0xcd16('0x1c')](function(_0x31a30f){if(_0x31a30f){return rp({'method':'GET','uri':util[_0xcd16('0x74')](_0xcd16('0x75'),_0x1a0668),'qs':{'module':_0xcd16('0x76')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x31a30f},'json':!![]});}})[_0xcd16('0x1c')](function(_0x3e6e92){if(_0x3e6e92){if(_0x3e6e92[_0xcd16('0x77')]&&_0x3e6e92[_0xcd16('0x77')]['error']){throw new Error(_0x3e6e92[_0xcd16('0x77')][_0xcd16('0x22')][_0xcd16('0x24')]);}var _0x4e8e63=[];var _0x284327=[];var _0x4f3e25=[_0xcd16('0x78'),_0xcd16('0x79'),_0xcd16('0x7a'),_0xcd16('0x7b'),_0xcd16('0x7c'),_0xcd16('0x7d'),_0xcd16('0x7e'),'Call_Type'];_0x284327=_[_0xcd16('0x7f')](_0x3e6e92[_0xcd16('0x51')],function(_0x674452){return _0x4f3e25[_0xcd16('0x80')](_0x674452['api_name']);});for(var _0x15a691=0x0;_0x15a691<_0x284327[_0xcd16('0x41')];_0x15a691++){if(_0x284327[_0x15a691]['system_mandatory']===![]){_0x4e8e63[_0xcd16('0x81')]({'id':_0x284327[_0x15a691]['id'],'name':_0x284327[_0x15a691][_0xcd16('0x82')],'custom':_0x284327[_0x15a691][_0xcd16('0x83')],'options':_0x284327[_0x15a691][_0xcd16('0x84')]===_0xcd16('0x85')&&_0x284327[_0x15a691][_0xcd16('0x86')][_0xcd16('0x41')]>-0x1?_[_0xcd16('0x3b')](_0x284327[_0x15a691][_0xcd16('0x86')],function(_0xbf87b9){return{'name':_0xbf87b9,'value':_0xbf87b9};}):[]});}}return{'count':_0x4e8e63[_0xcd16('0x41')],'rows':_0x4e8e63};}else{return{'count':0x0,'rows':[]};}})[_0xcd16('0x1c')](respondWithResult(_0x173346,null))[_0xcd16('0x25')](function(_0x5ebda3){var _0xeae4ca=_0x36ffb2['query'][_0xcd16('0x87')]?0x1f4:_0x5ebda3[_0xcd16('0x88')]||0x1f4;logger[_0xcd16('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0xcd16('0x6c'),_0xeae4ca,JSON[_0xcd16('0x89')](_0x5ebda3));delete _0x5ebda3['name'];if(_0xeae4ca===0x191){_0xeae4ca=0x190;}_0x173346[_0xcd16('0x27')](_0xeae4ca)['send'](_0x36ffb2[_0xcd16('0x3d')][_0xcd16('0x87')]?{'message':'Wrong\x20credentials','statusCode':_0x5ebda3[_0xcd16('0x88')]}:_0x5ebda3);});}; \ No newline at end of file +var _0xdeac=['Descriptions','getDescriptions','ZohoConfiguration','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientSecret','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientId','code','refreshToken','host','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','api_name','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','rows','params','find','create','body','getConfigurations','findOne','merge','addConfiguration','AccountId','getSubjects','channel'];(function(_0x442f7d,_0x4a5fc6){var _0x3f14ac=function(_0x832adc){while(--_0x832adc){_0x442f7d['push'](_0x442f7d['shift']());}};_0x3f14ac(++_0x4a5fc6);}(_0xdeac,0x146));var _0xcdea=function(_0x136ed4,_0x2cf85e){_0x136ed4=_0x136ed4-0x0;var _0x3659d4=_0xdeac[_0x136ed4];return _0x3659d4;};'use strict';var pdf=require(_0xcdea('0x0'));var emlformat=require(_0xcdea('0x1'));var rimraf=require(_0xcdea('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcdea('0x3'));var moment=require(_0xcdea('0x4'));var BPromise=require(_0xcdea('0x5'));var Mustache=require(_0xcdea('0x6'));var util=require(_0xcdea('0x7'));var path=require(_0xcdea('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdea('0x9'));var _=require(_0xcdea('0xa'));var squel=require('squel');var crypto=require(_0xcdea('0xb'));var jsforce=require(_0xcdea('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcdea('0xd'));var querystring=require(_0xcdea('0xe'));var Papa=require(_0xcdea('0xf'));var Redis=require(_0xcdea('0x10'));var authService=require(_0xcdea('0x11'));var qs=require(_0xcdea('0x12'));var as=require(_0xcdea('0x13'));var hardwareService=require(_0xcdea('0x14'));var logger=require(_0xcdea('0x15'))(_0xcdea('0x16'));var utils=require('../../config/utils');var config=require(_0xcdea('0x17'));var licenseUtil=require(_0xcdea('0x18'));var db=require(_0xcdea('0x19'))['db'];var integrations=require(_0xcdea('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0xcdea('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4df0f8,_0x10f28f,_0xe995c3,_0x5799ff){return new BPromise(function(_0x5da6a8,_0x1849d3){var _0x7095de=_0x5799ff||client;return _0x7095de[_0xcdea('0x1c')](_0x4df0f8,_0xe995c3)[_0xcdea('0x1d')](function(_0x2abd60){logger[_0xcdea('0x1e')](_0xcdea('0x1f'),_0x10f28f,_0xcdea('0x20'));logger[_0xcdea('0x21')](_0xcdea('0x22'),_0x10f28f,_0xcdea('0x20'),JSON[_0xcdea('0x23')](_0x2abd60));if(_0x2abd60['error']){if(_0x2abd60[_0xcdea('0x24')]['code']===0x1f4){logger[_0xcdea('0x24')]('ZohoAccount,\x20%s,\x20%s',_0x10f28f,_0x2abd60[_0xcdea('0x24')][_0xcdea('0x25')]);return _0x1849d3(_0x2abd60[_0xcdea('0x24')][_0xcdea('0x25')]);}logger[_0xcdea('0x24')](_0xcdea('0x1f'),_0x10f28f,_0x2abd60['error'][_0xcdea('0x25')]);return _0x5da6a8(_0x2abd60[_0xcdea('0x24')][_0xcdea('0x25')]);}else{logger[_0xcdea('0x1e')](_0xcdea('0x1f'),_0x10f28f,_0xcdea('0x20'));_0x5da6a8(_0x2abd60['result']['message']);}})[_0xcdea('0x26')](function(_0x59ab46){logger[_0xcdea('0x24')](_0xcdea('0x1f'),_0x10f28f,_0x59ab46);_0x1849d3(_0x59ab46);});});}function respondWithStatusCode(_0x3f4273,_0x4e9ed3){_0x4e9ed3=_0x4e9ed3||0xcc;return function(_0x19a565){if(_0x19a565){return _0x3f4273[_0xcdea('0x27')](_0x4e9ed3);}return _0x3f4273[_0xcdea('0x28')](_0x4e9ed3)[_0xcdea('0x29')]();};}function respondWithResult(_0x211722,_0x277c6d){_0x277c6d=_0x277c6d||0xc8;return function(_0x110cfa){if(_0x110cfa){return _0x211722[_0xcdea('0x28')](_0x277c6d)[_0xcdea('0x2a')](_0x110cfa);}};}function respondWithFilteredResult(_0x484421,_0x30a2f3){return function(_0x598a96){if(_0x598a96){var _0x1ad120=_0x598a96[_0xcdea('0x2b')],_0x536885=_0x30a2f3[_0xcdea('0x2c')],_0x3d7ce6=_0x30a2f3['offset']+_0x30a2f3[_0xcdea('0x2d')],_0x5ec94d;if(_0x3d7ce6>=_0x1ad120){_0x3d7ce6=_0x1ad120;_0x5ec94d=0xc8;}else{_0x5ec94d=0xce;}_0x484421[_0xcdea('0x28')](_0x5ec94d);return _0x484421[_0xcdea('0x2e')](_0xcdea('0x2f'),_0x536885+'-'+_0x3d7ce6+'/'+_0x1ad120)['json'](_0x598a96);}return null;};}function patchUpdates(_0x2c24e1){return function(_0x24447d){try{jsonpatch[_0xcdea('0x30')](_0x24447d,_0x2c24e1,!![]);}catch(_0x873c2a){return BPromise[_0xcdea('0x31')](_0x873c2a);}return _0x24447d[_0xcdea('0x32')]();};}function saveUpdates(_0x4bec7a,_0x2c8048){return function(_0x5dd17d){if(_0x5dd17d){return _0x5dd17d[_0xcdea('0x33')](_0x4bec7a)[_0xcdea('0x1d')](function(_0x480ca9){return _0x480ca9;});}return null;};}function removeEntity(_0x2305b1,_0x5192ae){return function(_0xe93139){if(_0xe93139){return _0xe93139[_0xcdea('0x34')]()['then'](function(){_0x2305b1[_0xcdea('0x28')](0xcc)[_0xcdea('0x29')]();});}};}function handleEntityNotFound(_0xbdf114,_0x327fe1){return function(_0x4539ee){if(!_0x4539ee){_0xbdf114[_0xcdea('0x27')](0x194);}return _0x4539ee;};}function handleError(_0x2cc01b,_0x471509){_0x471509=_0x471509||0x1f4;return function(_0x3fa439){logger[_0xcdea('0x24')](_0x3fa439['stack']);if(_0x3fa439[_0xcdea('0x35')]){delete _0x3fa439[_0xcdea('0x35')];}_0x2cc01b['status'](_0x471509)[_0xcdea('0x36')](_0x3fa439);};}exports[_0xcdea('0x37')]=function(_0x185dee,_0x1c2a2d){var _0x26daa2={},_0x4a5180={},_0x4a87c0={'count':0x0,'rows':[]};var _0x5daae9=_[_0xcdea('0x38')](db[_0xcdea('0x39')][_0xcdea('0x3a')],function(_0x29b9ca){return{'name':_0x29b9ca[_0xcdea('0x3b')],'type':_0x29b9ca[_0xcdea('0x3c')]['key']};});_0x4a5180[_0xcdea('0x3d')]=_[_0xcdea('0x38')](_0x5daae9,'name');_0x4a5180[_0xcdea('0x3e')]=_[_0xcdea('0x3f')](_0x185dee[_0xcdea('0x3e')]);_0x4a5180[_0xcdea('0x40')]=_['intersection'](_0x4a5180['model'],_0x4a5180['query']);_0x26daa2[_0xcdea('0x41')]=_[_0xcdea('0x42')](_0x4a5180[_0xcdea('0x3d')],qs[_0xcdea('0x43')](_0x185dee[_0xcdea('0x3e')][_0xcdea('0x43')]));_0x26daa2[_0xcdea('0x41')]=_0x26daa2['attributes'][_0xcdea('0x44')]?_0x26daa2[_0xcdea('0x41')]:_0x4a5180[_0xcdea('0x3d')];if(!_0x185dee[_0xcdea('0x3e')][_0xcdea('0x45')](_0xcdea('0x46'))){_0x26daa2[_0xcdea('0x2d')]=qs['limit'](_0x185dee[_0xcdea('0x3e')][_0xcdea('0x2d')]);_0x26daa2[_0xcdea('0x2c')]=qs['offset'](_0x185dee[_0xcdea('0x3e')]['offset']);}_0x26daa2[_0xcdea('0x47')]=qs[_0xcdea('0x48')](_0x185dee['query'][_0xcdea('0x48')]);_0x26daa2[_0xcdea('0x49')]=qs[_0xcdea('0x40')](_[_0xcdea('0x4a')](_0x185dee[_0xcdea('0x3e')],_0x4a5180['filters']),_0x5daae9);if(_0x185dee[_0xcdea('0x3e')][_0xcdea('0x4b')]){_0x26daa2[_0xcdea('0x49')]=_['merge'](_0x26daa2[_0xcdea('0x49')],{'$or':_[_0xcdea('0x38')](_0x5daae9,function(_0xfd4805){if(_0xfd4805[_0xcdea('0x3c')]!=='VIRTUAL'){var _0x59f60e={};_0x59f60e[_0xfd4805[_0xcdea('0x35')]]={'$like':'%'+_0x185dee['query'][_0xcdea('0x4b')]+'%'};return _0x59f60e;}})});}_0x26daa2=_['merge']({},_0x26daa2,_0x185dee[_0xcdea('0x4c')]);var _0x51dc80={'where':_0x26daa2[_0xcdea('0x49')]};return db[_0xcdea('0x39')][_0xcdea('0x2b')](_0x51dc80)[_0xcdea('0x1d')](function(_0x349a9e){_0x4a87c0['count']=_0x349a9e;if(_0x185dee[_0xcdea('0x3e')][_0xcdea('0x4d')]){_0x26daa2[_0xcdea('0x4e')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x26daa2);})['then'](function(_0x1b9bad){_0x4a87c0[_0xcdea('0x4f')]=_0x1b9bad;return _0x4a87c0;})[_0xcdea('0x1d')](respondWithFilteredResult(_0x1c2a2d,_0x26daa2))[_0xcdea('0x26')](handleError(_0x1c2a2d,null));};exports['show']=function(_0x23c1be,_0x497ae7){var _0x5650a6={'raw':![],'where':{'id':_0x23c1be[_0xcdea('0x50')]['id']}},_0x111f58={};_0x111f58[_0xcdea('0x3d')]=_[_0xcdea('0x3f')](db['ZohoAccount']['rawAttributes']);_0x111f58[_0xcdea('0x3e')]=_[_0xcdea('0x3f')](_0x23c1be[_0xcdea('0x3e')]);_0x111f58[_0xcdea('0x40')]=_[_0xcdea('0x42')](_0x111f58['model'],_0x111f58['query']);_0x5650a6[_0xcdea('0x41')]=_[_0xcdea('0x42')](_0x111f58[_0xcdea('0x3d')],qs[_0xcdea('0x43')](_0x23c1be['query'][_0xcdea('0x43')]));_0x5650a6[_0xcdea('0x41')]=_0x5650a6[_0xcdea('0x41')][_0xcdea('0x44')]?_0x5650a6[_0xcdea('0x41')]:_0x111f58[_0xcdea('0x3d')];if(_0x23c1be['query'][_0xcdea('0x4d')]){_0x5650a6['include']=[{'all':!![]}];}_0x5650a6=_['merge']({},_0x5650a6,_0x23c1be[_0xcdea('0x4c')]);return db[_0xcdea('0x39')][_0xcdea('0x51')](_0x5650a6)[_0xcdea('0x1d')](handleEntityNotFound(_0x497ae7,null))[_0xcdea('0x1d')](respondWithResult(_0x497ae7,null))[_0xcdea('0x26')](handleError(_0x497ae7,null));};exports[_0xcdea('0x52')]=function(_0x43dadd,_0x4a52a8){return db[_0xcdea('0x39')][_0xcdea('0x52')](_0x43dadd[_0xcdea('0x53')],{})[_0xcdea('0x1d')](respondWithResult(_0x4a52a8,0xc9))['catch'](handleError(_0x4a52a8,null));};exports[_0xcdea('0x33')]=function(_0x3dd098,_0xc55e18){if(_0x3dd098[_0xcdea('0x53')]['id']){delete _0x3dd098[_0xcdea('0x53')]['id'];}return db[_0xcdea('0x39')][_0xcdea('0x51')]({'where':{'id':_0x3dd098[_0xcdea('0x50')]['id']}})['then'](handleEntityNotFound(_0xc55e18,null))[_0xcdea('0x1d')](saveUpdates(_0x3dd098[_0xcdea('0x53')],null))[_0xcdea('0x1d')](respondWithResult(_0xc55e18,null))['catch'](handleError(_0xc55e18,null));};exports['destroy']=function(_0x4894c9,_0x26ea14){return db[_0xcdea('0x39')][_0xcdea('0x51')]({'where':{'id':_0x4894c9['params']['id']}})[_0xcdea('0x1d')](handleEntityNotFound(_0x26ea14,null))['then'](removeEntity(_0x26ea14,null))['catch'](handleError(_0x26ea14,null));};exports[_0xcdea('0x54')]=function(_0x306f37,_0x540371,_0xa49a72){var _0x49242a={};var _0x10abec={};var _0x3280ff;var _0x109e23;return db[_0xcdea('0x39')][_0xcdea('0x55')]({'where':{'id':_0x306f37[_0xcdea('0x50')]['id']}})[_0xcdea('0x1d')](handleEntityNotFound(_0x540371,null))[_0xcdea('0x1d')](function(_0x46b57a){if(_0x46b57a){_0x3280ff=_0x46b57a;_0x10abec[_0xcdea('0x3d')]=_[_0xcdea('0x3f')](db['ZohoConfiguration'][_0xcdea('0x3a')]);_0x10abec[_0xcdea('0x3e')]=_[_0xcdea('0x3f')](_0x306f37['query']);_0x10abec['filters']=_[_0xcdea('0x42')](_0x10abec[_0xcdea('0x3d')],_0x10abec[_0xcdea('0x3e')]);_0x49242a[_0xcdea('0x41')]=_[_0xcdea('0x42')](_0x10abec[_0xcdea('0x3d')],qs[_0xcdea('0x43')](_0x306f37[_0xcdea('0x3e')][_0xcdea('0x43')]));_0x49242a[_0xcdea('0x41')]=_0x49242a[_0xcdea('0x41')][_0xcdea('0x44')]?_0x49242a[_0xcdea('0x41')]:_0x10abec['model'];_0x49242a[_0xcdea('0x47')]=qs[_0xcdea('0x48')](_0x306f37[_0xcdea('0x3e')]['sort']);_0x49242a[_0xcdea('0x49')]=qs[_0xcdea('0x40')](_['pick'](_0x306f37[_0xcdea('0x3e')],_0x10abec['filters']));if(_0x306f37[_0xcdea('0x3e')][_0xcdea('0x4b')]){_0x49242a[_0xcdea('0x49')]=_[_0xcdea('0x56')](_0x49242a['where'],{'$or':_[_0xcdea('0x38')](_0x49242a['attributes'],function(_0x5844c8){var _0x3467b8={};_0x3467b8[_0x5844c8]={'$like':'%'+_0x306f37['query'][_0xcdea('0x4b')]+'%'};return _0x3467b8;})});}_0x49242a=_[_0xcdea('0x56')]({},_0x49242a,_0x306f37['options']);return _0x3280ff[_0xcdea('0x54')](_0x49242a);}})[_0xcdea('0x1d')](function(_0x19a7e8){if(_0x19a7e8){_0x109e23=_0x19a7e8[_0xcdea('0x44')];if(!_0x306f37[_0xcdea('0x3e')][_0xcdea('0x45')]('nolimit')){_0x49242a['limit']=qs['limit'](_0x306f37[_0xcdea('0x3e')][_0xcdea('0x2d')]);_0x49242a[_0xcdea('0x2c')]=qs[_0xcdea('0x2c')](_0x306f37[_0xcdea('0x3e')][_0xcdea('0x2c')]);}return _0x3280ff['getConfigurations'](_0x49242a);}})[_0xcdea('0x1d')](function(_0x905764){if(_0x905764){return _0x905764?{'count':_0x109e23,'rows':_0x905764}:null;}})[_0xcdea('0x1d')](respondWithResult(_0x540371,null))[_0xcdea('0x26')](handleError(_0x540371,null));};exports[_0xcdea('0x57')]=function(_0x57f6e5,_0x1a075a,_0xc7ec45){if(_0x57f6e5[_0xcdea('0x53')]['id']){delete _0x57f6e5[_0xcdea('0x53')]['id'];}return db[_0xcdea('0x39')][_0xcdea('0x55')]({'where':{'id':_0x57f6e5[_0xcdea('0x50')]['id']}})[_0xcdea('0x1d')](handleEntityNotFound(_0x1a075a,null))['then'](function(_0x415f06){if(_0x415f06){_0x57f6e5[_0xcdea('0x53')][_0xcdea('0x58')]=_0x415f06['id'];_0x57f6e5[_0xcdea('0x53')]['Subjects']=integrations[_0xcdea('0x59')](_0x57f6e5[_0xcdea('0x53')][_0xcdea('0x5a')],_0x57f6e5[_0xcdea('0x53')][_0xcdea('0x3c')]);_0x57f6e5[_0xcdea('0x53')][_0xcdea('0x5b')]=integrations[_0xcdea('0x5c')](_0x57f6e5['body']['channel'],_0x57f6e5[_0xcdea('0x53')]['type']);return db[_0xcdea('0x5d')][_0xcdea('0x52')](_0x57f6e5[_0xcdea('0x53')],{'include':[{'model':db[_0xcdea('0x5e')],'as':_0xcdea('0x5f')},{'model':db[_0xcdea('0x5e')],'as':'Descriptions'}]});}return null;})[_0xcdea('0x1d')](respondWithResult(_0x1a075a,null))['catch'](handleError(_0x1a075a,null));};function getAccessToken(_0x2e781c){return new Promise(function(_0x3dc918,_0x34ead9){var _0x280299;switch(_0x2e781c[_0xcdea('0x60')]){case'US':_0x280299=_0xcdea('0x61');break;case'AU':_0x280299=_0xcdea('0x62');break;case'EU':_0x280299=_0xcdea('0x63');break;case'IN':_0x280299=_0xcdea('0x64');break;case'CN':_0x280299='https://accounts.zoho.com.cn';break;default:_0x280299=_0xcdea('0x63');break;}var _0x384a37={'method':_0xcdea('0x65'),'uri':_0x280299+_0xcdea('0x66'),'qs':{'refresh_token':_0x2e781c['refreshToken'],'client_id':_0x2e781c['clientId'],'client_secret':_0x2e781c[_0xcdea('0x67')],'grant_type':_0xcdea('0x68')},'json':!![]};return rp(_0x384a37)[_0xcdea('0x1d')](function(_0x406587){if(_0x406587['access_token']){_0x3dc918(_0x406587['access_token']);}else{_0x34ead9(_0xcdea('0x69'));}})['catch'](function(_0x4e85d3){_0x34ead9(_0x4e85d3);});});}exports[_0xcdea('0x6a')]=function(_0x16e84b,_0x29e1ba,_0x1b5141){var _0x2ee6f2,_0x54cfce,_0x5c4b77,_0x1c2109,_0xc9400a;return db[_0xcdea('0x39')][_0xcdea('0x55')]({'where':{'id':_0x16e84b[_0xcdea('0x50')]['id']},'attributes':['id','host',_0xcdea('0x60'),_0xcdea('0x6b'),'clientSecret','serverUrl',_0xcdea('0x6c'),_0xcdea('0x6d')]})[_0xcdea('0x1d')](handleEntityNotFound(_0x29e1ba,null))[_0xcdea('0x1d')](function(_0xbb04c5){_0xc9400a=_0xbb04c5;_0x2ee6f2=_0xc9400a[_0xcdea('0x6e')];_0x54cfce=_0x2ee6f2===_0xcdea('0x6f')?'eu':_0xcdea('0x70');_0x5c4b77=_0xc9400a[_0xcdea('0x71')];var _0x39bf1b=_0x5c4b77[_0xcdea('0x72')](-0x1);if(_0x39bf1b==='/'||_0x39bf1b==='\x5c'||_0x39bf1b===':'){_0x5c4b77=_0x5c4b77[_0xcdea('0x73')](0x0,_0x5c4b77[_0xcdea('0x74')](_0x39bf1b));}if(!_0xc9400a[_0xcdea('0x6d')]){throw new Error(_0xcdea('0x75'));}return getAccessToken(_0xc9400a);})[_0xcdea('0x1d')](function(_0x4213d8){if(_0x4213d8){return rp({'method':_0xcdea('0x76'),'uri':util[_0xcdea('0x77')](_0xcdea('0x78'),_0x54cfce),'qs':{'module':_0xcdea('0x79')},'headers':{'Authorization':_0xcdea('0x7a')+_0x4213d8},'json':!![]});}})[_0xcdea('0x1d')](function(_0x244927){if(_0x244927){if(_0x244927[_0xcdea('0x7b')]&&_0x244927[_0xcdea('0x7b')]['error']){throw new Error(_0x244927[_0xcdea('0x7b')][_0xcdea('0x24')]['message']);}var _0x25392e=[];var _0x3eb5ee=[];var _0x5b8c63=['Owner','Subject',_0xcdea('0x7c'),_0xcdea('0x7d'),_0xcdea('0x7e'),_0xcdea('0x7f'),_0xcdea('0x80'),'Call_Type'];_0x3eb5ee=_['remove'](_0x244927[_0xcdea('0x43')],function(_0x5d9c09){return _0x5b8c63[_0xcdea('0x81')](_0x5d9c09[_0xcdea('0x82')]);});for(var _0x23e0f4=0x0;_0x23e0f4<_0x3eb5ee[_0xcdea('0x44')];_0x23e0f4++){if(_0x3eb5ee[_0x23e0f4]['system_mandatory']===![]){_0x25392e[_0xcdea('0x83')]({'id':_0x3eb5ee[_0x23e0f4]['id'],'name':_0x3eb5ee[_0x23e0f4][_0xcdea('0x84')],'custom':_0x3eb5ee[_0x23e0f4][_0xcdea('0x85')],'options':_0x3eb5ee[_0x23e0f4][_0xcdea('0x86')]==='picklist'&&_0x3eb5ee[_0x23e0f4][_0xcdea('0x87')][_0xcdea('0x44')]>-0x1?_[_0xcdea('0x38')](_0x3eb5ee[_0x23e0f4][_0xcdea('0x87')],function(_0x47b5bd){return{'name':_0x47b5bd,'value':_0x47b5bd};}):[]});}}return{'count':_0x25392e[_0xcdea('0x44')],'rows':_0x25392e};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x29e1ba,null))[_0xcdea('0x26')](function(_0x495378){var _0x20fe2c=_0x16e84b[_0xcdea('0x3e')][_0xcdea('0x88')]?0x1f4:_0x495378[_0xcdea('0x89')]||0x1f4;logger[_0xcdea('0x24')](_0xcdea('0x8a'),'getFields',_0x20fe2c,JSON[_0xcdea('0x23')](_0x495378));delete _0x495378[_0xcdea('0x35')];if(_0x20fe2c===0x191){_0x20fe2c=0x190;}_0x29e1ba[_0xcdea('0x28')](_0x20fe2c)[_0xcdea('0x36')](_0x16e84b[_0xcdea('0x3e')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x495378['statusCode']}:_0x495378);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 8d26a40..40fea5f 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 _0x4249=['format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','then','parse','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','refresh_token','refreshToken'];(function(_0x560821,_0x2a9a26){var _0x3496f8=function(_0x2cdb1d){while(--_0x2cdb1d){_0x560821['push'](_0x560821['shift']());}};_0x3496f8(++_0x2a9a26);}(_0x4249,0x87));var _0x9424=function(_0x569ed1,_0x2d7f71){_0x569ed1=_0x569ed1-0x0;var _0x33e50a=_0x4249[_0x569ed1];return _0x33e50a;};'use strict';var _=require(_0x9424('0x0'));var util=require(_0x9424('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9424('0x2'));var BPromise=require('bluebird');var rp=require(_0x9424('0x3'));var fs=require('fs');var path=require(_0x9424('0x4'));var rimraf=require(_0x9424('0x5'));var config=require(_0x9424('0x6'));var attributes=require(_0x9424('0x7'));var integrations=require(_0x9424('0x8'));module[_0x9424('0x9')]=function(_0x4ad522,_0x2f4b95){return _0x4ad522[_0x9424('0xa')](_0x9424('0xb'),attributes,{'tableName':_0x9424('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x35f08e,_0x41178c,_0xe37bd3){if(_0x35f08e[_0x9424('0xd')](_0x9424('0xe'))||_0x35f08e[_0x9424('0xd')](_0x9424('0xf'))||_0x35f08e[_0x9424('0xd')](_0x9424('0x10'))||_0x35f08e[_0x9424('0xd')](_0x9424('0x11'))||_0x35f08e[_0x9424('0xd')](_0x9424('0x12'))||_0x35f08e['changed'](_0x9424('0x13'))){var _0x476a77,_0x43f2ad;_0x476a77=_0x35f08e[_0x9424('0xf')];var _0x5f0710=_0x476a77[_0x9424('0x14')](-0x1);if(_0x5f0710==='/'||_0x5f0710==='\x5c'||_0x5f0710===':'){_0x476a77=_0x476a77[_0x9424('0x15')](0x0,_0x476a77[_0x9424('0x16')](_0x5f0710));}switch(_0x35f08e[_0x9424('0xe')]){case'US':_0x43f2ad=_0x9424('0x17');break;case'AU':_0x43f2ad=_0x9424('0x18');break;case'IN':_0x43f2ad=_0x9424('0x19');break;case'CN':_0x43f2ad=_0x9424('0x1a');break;default:_0x43f2ad=_0x9424('0x1b');break;}var _0xcdeeb9={'method':_0x9424('0x1c'),'uri':_0x43f2ad+_0x9424('0x1d'),'form':{'grant_type':'authorization_code','client_id':_0x35f08e['clientId'],'client_secret':_0x35f08e[_0x9424('0x11')],'redirect_uri':_0x35f08e['serverUrl'],'code':_0x35f08e[_0x9424('0x12')]},'headers':{'Content-Type':_0x9424('0x1e')}};return rp(_0xcdeeb9)['then'](function(_0x4b9f51){var _0x2358de=JSON['parse'](_0x4b9f51);if(_0x2358de[_0x9424('0x1f')]){_0x35f08e[_0x9424('0x20')]=_0x2358de[_0x9424('0x1f')];logger['info'](util[_0x9424('0x21')](_0x9424('0x22'),_0x35f08e[_0x9424('0x23')],_0x35f08e['id']));}else{logger[_0x9424('0x24')](util[_0x9424('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x35f08e[_0x9424('0x23')],_0x35f08e['id']),util[_0x9424('0x25')](_0x2358de,{'showHidden':![],'depth':null}));}return _0xe37bd3(null,_0x41178c);})[_0x9424('0x26')](function(_0x534c6d){logger[_0x9424('0x24')](util[_0x9424('0x21')](_0x9424('0x27'),_0x35f08e['name'],_0x35f08e['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xe37bd3(_0x534c6d);});}else{return _0xe37bd3(null,_0x41178c);}},'beforeUpdate':function(_0x1bae2,_0x577e72,_0x4b0825){if(_0x1bae2[_0x9424('0xd')]('zone')||_0x1bae2[_0x9424('0xd')]('serverUrl')||_0x1bae2['changed']('clientId')||_0x1bae2[_0x9424('0xd')](_0x9424('0x11'))||_0x1bae2['changed']('code')||_0x1bae2[_0x9424('0xd')](_0x9424('0x13'))){var _0x205a37,_0x1c1796;_0x205a37=_0x1bae2[_0x9424('0xf')];var _0x25c3ca=_0x205a37[_0x9424('0x14')](-0x1);if(_0x25c3ca==='/'||_0x25c3ca==='\x5c'||_0x25c3ca===':'){_0x205a37=_0x205a37['substring'](0x0,_0x205a37['lastIndexOf'](_0x25c3ca));}switch(_0x1bae2[_0x9424('0xe')]){case'US':_0x1c1796=_0x9424('0x17');break;case'AU':_0x1c1796='https://accounts.zoho.com.au';break;case'IN':_0x1c1796=_0x9424('0x19');break;case'CN':_0x1c1796=_0x9424('0x1a');break;default:_0x1c1796=_0x9424('0x1b');break;}var _0x1cab2b={'method':'POST','uri':_0x1c1796+_0x9424('0x1d'),'form':{'grant_type':'authorization_code','client_id':_0x1bae2[_0x9424('0x10')],'client_secret':_0x1bae2[_0x9424('0x11')],'redirect_uri':_0x1bae2[_0x9424('0xf')],'code':_0x1bae2[_0x9424('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1cab2b)[_0x9424('0x28')](function(_0x232e11){var _0x556a27=JSON[_0x9424('0x29')](_0x232e11);if(_0x556a27[_0x9424('0x1f')]){_0x1bae2[_0x9424('0x20')]=_0x556a27[_0x9424('0x1f')];logger['info'](util[_0x9424('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1bae2[_0x9424('0x23')],_0x1bae2['id']));}else{logger[_0x9424('0x24')](util[_0x9424('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1bae2['name'],_0x1bae2['id']),util[_0x9424('0x25')](_0x556a27,{'showHidden':![],'depth':null}));}return _0x4b0825(null,_0x577e72);})[_0x9424('0x26')](function(_0x44f862){logger[_0x9424('0x24')](util[_0x9424('0x21')](_0x9424('0x27'),_0x1bae2[_0x9424('0x23')],_0x1bae2['id']),util[_0x9424('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x4b0825(_0x44f862);});}else{return _0x4b0825(null,_0x577e72);}}}});}; \ No newline at end of file +var _0x9d2f=['changed','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','authorization_code','refreshToken','lodash','../../config/logger','bluebird','../../config/environment','../../components/integrations/configuration','exports','define','zone'];(function(_0x55c00d,_0x520cb6){var _0x254a8f=function(_0x2b3378){while(--_0x2b3378){_0x55c00d['push'](_0x55c00d['shift']());}};_0x254a8f(++_0x520cb6);}(_0x9d2f,0x90));var _0xf9d2=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x9d2f[_0x119d5a];return _0x15bff4;};'use strict';var _=require(_0xf9d2('0x0'));var util=require('util');var logger=require(_0xf9d2('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf9d2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf9d2('0x3'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xf9d2('0x4'));module[_0xf9d2('0x5')]=function(_0x339679,_0x58a8d4){return _0x339679[_0xf9d2('0x6')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x30d044,_0x2212f3,_0x4dbef4){if(_0x30d044['changed'](_0xf9d2('0x7'))||_0x30d044[_0xf9d2('0x8')](_0xf9d2('0x9'))||_0x30d044['changed'](_0xf9d2('0xa'))||_0x30d044['changed'](_0xf9d2('0xb'))||_0x30d044[_0xf9d2('0x8')](_0xf9d2('0xc'))||_0x30d044['changed'](_0xf9d2('0xd'))){var _0x529afa,_0x367f25;_0x529afa=_0x30d044['serverUrl'];var _0x35fbbf=_0x529afa[_0xf9d2('0xe')](-0x1);if(_0x35fbbf==='/'||_0x35fbbf==='\x5c'||_0x35fbbf===':'){_0x529afa=_0x529afa[_0xf9d2('0xf')](0x0,_0x529afa[_0xf9d2('0x10')](_0x35fbbf));}switch(_0x30d044[_0xf9d2('0x7')]){case'US':_0x367f25=_0xf9d2('0x11');break;case'AU':_0x367f25=_0xf9d2('0x12');break;case'IN':_0x367f25=_0xf9d2('0x13');break;case'CN':_0x367f25=_0xf9d2('0x14');break;default:_0x367f25=_0xf9d2('0x15');break;}var _0x2c56e7={'method':_0xf9d2('0x16'),'uri':_0x367f25+_0xf9d2('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x30d044[_0xf9d2('0xa')],'client_secret':_0x30d044[_0xf9d2('0xb')],'redirect_uri':_0x30d044[_0xf9d2('0x9')],'code':_0x30d044['code']},'headers':{'Content-Type':_0xf9d2('0x18')}};return rp(_0x2c56e7)[_0xf9d2('0x19')](function(_0xad683f){var _0x4a2129=JSON[_0xf9d2('0x1a')](_0xad683f);if(_0x4a2129[_0xf9d2('0x1b')]){_0x30d044['refreshToken']=_0x4a2129[_0xf9d2('0x1b')];logger[_0xf9d2('0x1c')](util[_0xf9d2('0x1d')](_0xf9d2('0x1e'),_0x30d044[_0xf9d2('0x1f')],_0x30d044['id']));}else{logger[_0xf9d2('0x20')](util['format'](_0xf9d2('0x21'),_0x30d044[_0xf9d2('0x1f')],_0x30d044['id']),util[_0xf9d2('0x22')](_0x4a2129,{'showHidden':![],'depth':null}));}return _0x4dbef4(null,_0x2212f3);})[_0xf9d2('0x23')](function(_0x5b0923){logger[_0xf9d2('0x20')](util[_0xf9d2('0x1d')](_0xf9d2('0x21'),_0x30d044['name'],_0x30d044['id']),util[_0xf9d2('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x4dbef4(_0x5b0923);});}else{return _0x4dbef4(null,_0x2212f3);}},'beforeUpdate':function(_0x748083,_0x77fdcc,_0x786fb2){if(_0x748083[_0xf9d2('0x8')](_0xf9d2('0x7'))||_0x748083[_0xf9d2('0x8')](_0xf9d2('0x9'))||_0x748083[_0xf9d2('0x8')](_0xf9d2('0xa'))||_0x748083[_0xf9d2('0x8')](_0xf9d2('0xb'))||_0x748083[_0xf9d2('0x8')]('code')||_0x748083[_0xf9d2('0x8')](_0xf9d2('0xd'))){var _0x78d23a,_0x578990;_0x78d23a=_0x748083[_0xf9d2('0x9')];var _0x572f76=_0x78d23a[_0xf9d2('0xe')](-0x1);if(_0x572f76==='/'||_0x572f76==='\x5c'||_0x572f76===':'){_0x78d23a=_0x78d23a[_0xf9d2('0xf')](0x0,_0x78d23a[_0xf9d2('0x10')](_0x572f76));}switch(_0x748083[_0xf9d2('0x7')]){case'US':_0x578990=_0xf9d2('0x11');break;case'AU':_0x578990=_0xf9d2('0x12');break;case'IN':_0x578990=_0xf9d2('0x13');break;case'CN':_0x578990=_0xf9d2('0x14');break;default:_0x578990='https://accounts.zoho.eu';break;}var _0x325589={'method':'POST','uri':_0x578990+_0xf9d2('0x17'),'form':{'grant_type':_0xf9d2('0x24'),'client_id':_0x748083[_0xf9d2('0xa')],'client_secret':_0x748083[_0xf9d2('0xb')],'redirect_uri':_0x748083['serverUrl'],'code':_0x748083['code']},'headers':{'Content-Type':_0xf9d2('0x18')}};return rp(_0x325589)[_0xf9d2('0x19')](function(_0x4cb720){var _0x3498a0=JSON[_0xf9d2('0x1a')](_0x4cb720);if(_0x3498a0[_0xf9d2('0x1b')]){_0x748083[_0xf9d2('0x25')]=_0x3498a0[_0xf9d2('0x1b')];logger[_0xf9d2('0x1c')](util[_0xf9d2('0x1d')](_0xf9d2('0x1e'),_0x748083[_0xf9d2('0x1f')],_0x748083['id']));}else{logger[_0xf9d2('0x20')](util['format'](_0xf9d2('0x21'),_0x748083[_0xf9d2('0x1f')],_0x748083['id']),util[_0xf9d2('0x22')](_0x3498a0,{'showHidden':![],'depth':null}));}return _0x786fb2(null,_0x77fdcc);})[_0xf9d2('0x23')](function(_0x1dcfa1){logger[_0xf9d2('0x20')](util[_0xf9d2('0x1d')](_0xf9d2('0x21'),_0x748083[_0xf9d2('0x1f')],_0x748083['id']),util[_0xf9d2('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x786fb2(_0x1dcfa1);});}else{return _0x786fb2(null,_0x77fdcc);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 089843f..7ff3ed7 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 _0xe7c3=['request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','ZohoAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe7c3,0x173));var _0x3e7c=function(_0x176a28,_0x568a39){_0x176a28=_0x176a28-0x0;var _0xe9dae5=_0xe7c3[_0x176a28];return _0xe9dae5;};'use strict';var _=require(_0x3e7c('0x0'));var util=require('util');var moment=require(_0x3e7c('0x1'));var BPromise=require(_0x3e7c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e7c('0x3'));var db=require(_0x3e7c('0x4'))['db'];var utils=require(_0x3e7c('0x5'));var logger=require('../../config/logger')(_0x3e7c('0x6'));var config=require(_0x3e7c('0x7'));var jayson=require(_0x3e7c('0x8'));var client=jayson['client'][_0x3e7c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d706d,_0x33f930,_0x2f8bcd){return new BPromise(function(_0x4fc98a,_0x197069){return client[_0x3e7c('0xa')](_0x1d706d,_0x2f8bcd)[_0x3e7c('0xb')](function(_0x33ab49){logger[_0x3e7c('0xc')](_0x3e7c('0xd'),_0x33f930,_0x3e7c('0xe'));logger[_0x3e7c('0xf')](_0x3e7c('0x10'),_0x33f930,_0x3e7c('0xe'),JSON[_0x3e7c('0x11')](_0x33ab49));if(_0x33ab49[_0x3e7c('0x12')]){if(_0x33ab49['error'][_0x3e7c('0x13')]===0x1f4){logger['error'](_0x3e7c('0xd'),_0x33f930,_0x33ab49['error'][_0x3e7c('0x14')]);return _0x197069(_0x33ab49[_0x3e7c('0x12')]['message']);}logger[_0x3e7c('0x12')](_0x3e7c('0xd'),_0x33f930,_0x33ab49[_0x3e7c('0x12')]['message']);return _0x4fc98a(_0x33ab49['error']['message']);}else{logger['info'](_0x3e7c('0xd'),_0x33f930,_0x3e7c('0xe'));_0x4fc98a(_0x33ab49[_0x3e7c('0x15')][_0x3e7c('0x14')]);}})[_0x3e7c('0x16')](function(_0x5381a8){logger['error'](_0x3e7c('0xd'),_0x33f930,_0x5381a8);_0x197069(_0x5381a8);});});}exports[_0x3e7c('0x17')]=function(_0x10fdf6){var _0xabe008=this;return new Promise(function(_0x1c1d8c,_0x62bed6){return db['ZohoAccount'][_0x3e7c('0x18')]({'raw':_0x10fdf6[_0x3e7c('0x19')]?_0x10fdf6['options'][_0x3e7c('0x1a')]===undefined?!![]:![]:!![],'where':_0x10fdf6[_0x3e7c('0x19')]?_0x10fdf6[_0x3e7c('0x19')][_0x3e7c('0x1b')]||null:null,'attributes':_0x10fdf6[_0x3e7c('0x19')]?_0x10fdf6['options'][_0x3e7c('0x1c')]||null:null,'limit':_0x10fdf6['options']?_0x10fdf6['options'][_0x3e7c('0x1d')]||null:null,'include':_0x10fdf6['options']?_0x10fdf6[_0x3e7c('0x19')][_0x3e7c('0x1e')]?_[_0x3e7c('0x1f')](_0x10fdf6[_0x3e7c('0x19')][_0x3e7c('0x1e')],function(_0x4ebfa5){return{'model':db[_0x4ebfa5[_0x3e7c('0x20')]],'as':_0x4ebfa5['as'],'attributes':_0x4ebfa5[_0x3e7c('0x1c')],'include':_0x4ebfa5[_0x3e7c('0x1e')]?_[_0x3e7c('0x1f')](_0x4ebfa5[_0x3e7c('0x1e')],function(_0x7539c1){return{'model':db[_0x7539c1[_0x3e7c('0x20')]],'as':_0x7539c1['as'],'attributes':_0x7539c1[_0x3e7c('0x1c')],'include':_0x7539c1[_0x3e7c('0x1e')]?_['map'](_0x7539c1[_0x3e7c('0x1e')],function(_0x2db463){return{'model':db[_0x2db463['model']],'as':_0x2db463['as'],'attributes':_0x2db463[_0x3e7c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3e7c('0xb')](function(_0x5e4ee3){logger[_0x3e7c('0xc')](_0x3e7c('0x17'),_0x10fdf6);logger[_0x3e7c('0xf')](_0x3e7c('0x17'),_0x10fdf6,JSON['stringify'](_0x5e4ee3));_0x1c1d8c(_0x5e4ee3);})[_0x3e7c('0x16')](function(_0x411b28){logger[_0x3e7c('0x12')](_0x3e7c('0x17'),_0x411b28[_0x3e7c('0x14')],_0x10fdf6);_0x62bed6(_0xabe008[_0x3e7c('0x12')](0x1f4,_0x411b28[_0x3e7c('0x14')]));});});};exports[_0x3e7c('0x21')]=function(_0x3de830){var _0xdaaa0f=this;return new Promise(function(_0x386666,_0x2b1054){return db[_0x3e7c('0x22')]['find']({'raw':_0x3de830[_0x3e7c('0x19')]?_0x3de830['options']['raw']===undefined?!![]:![]:!![],'where':_0x3de830[_0x3e7c('0x19')]?_0x3de830[_0x3e7c('0x19')]['where']||null:null,'attributes':_0x3de830[_0x3e7c('0x19')]?_0x3de830[_0x3e7c('0x19')][_0x3e7c('0x1c')]||null:null,'include':_0x3de830['options']?_0x3de830['options']['include']?_[_0x3e7c('0x1f')](_0x3de830[_0x3e7c('0x19')]['include'],function(_0x17c394){return{'model':db[_0x17c394[_0x3e7c('0x20')]],'as':_0x17c394['as'],'attributes':_0x17c394[_0x3e7c('0x1c')],'include':_0x17c394[_0x3e7c('0x1e')]?_['map'](_0x17c394[_0x3e7c('0x1e')],function(_0x593038){return{'model':db[_0x593038[_0x3e7c('0x20')]],'as':_0x593038['as'],'attributes':_0x593038[_0x3e7c('0x1c')],'include':_0x593038['include']?_[_0x3e7c('0x1f')](_0x593038['include'],function(_0x3282f2){return{'model':db[_0x3282f2[_0x3e7c('0x20')]],'as':_0x3282f2['as'],'attributes':_0x3282f2['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e7c('0xb')](function(_0x5d4948){logger[_0x3e7c('0xc')]('ShowZohoAccount',_0x3de830);logger['debug'](_0x3e7c('0x21'),_0x3de830,JSON[_0x3e7c('0x11')](_0x5d4948));_0x386666(_0x5d4948);})[_0x3e7c('0x16')](function(_0x93c7dc){logger[_0x3e7c('0x12')](_0x3e7c('0x21'),_0x93c7dc[_0x3e7c('0x14')],_0x3de830);_0x2b1054(_0xdaaa0f[_0x3e7c('0x12')](0x1f4,_0x93c7dc['message']));});});}; \ No newline at end of file +var _0x7490=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ZohoAccount','findAll','options','raw','attributes','include','map','model','GetZohoAccount','catch','ShowZohoAccount','find','where','lodash'];(function(_0x365b53,_0x4d312b){var _0x57b0cc=function(_0x35ec5a){while(--_0x35ec5a){_0x365b53['push'](_0x365b53['shift']());}};_0x57b0cc(++_0x4d312b);}(_0x7490,0xc5));var _0x0749=function(_0x18bc62,_0x3b67da){_0x18bc62=_0x18bc62-0x0;var _0x364d09=_0x7490[_0x18bc62];return _0x364d09;};'use strict';var _=require(_0x0749('0x0'));var util=require(_0x0749('0x1'));var moment=require(_0x0749('0x2'));var BPromise=require(_0x0749('0x3'));var rs=require(_0x0749('0x4'));var fs=require('fs');var Redis=require(_0x0749('0x5'));var db=require(_0x0749('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0749('0x7'))(_0x0749('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0749('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x75f21a,_0x46a686,_0x18f8df){return new BPromise(function(_0x2cf119,_0x31acf1){return client[_0x0749('0xa')](_0x75f21a,_0x18f8df)[_0x0749('0xb')](function(_0x3e955b){logger[_0x0749('0xc')](_0x0749('0xd'),_0x46a686,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x46a686,_0x0749('0xe'),JSON[_0x0749('0xf')](_0x3e955b));if(_0x3e955b[_0x0749('0x10')]){if(_0x3e955b[_0x0749('0x10')][_0x0749('0x11')]===0x1f4){logger[_0x0749('0x10')](_0x0749('0xd'),_0x46a686,_0x3e955b['error'][_0x0749('0x12')]);return _0x31acf1(_0x3e955b[_0x0749('0x10')][_0x0749('0x12')]);}logger[_0x0749('0x10')](_0x0749('0xd'),_0x46a686,_0x3e955b[_0x0749('0x10')][_0x0749('0x12')]);return _0x2cf119(_0x3e955b[_0x0749('0x10')][_0x0749('0x12')]);}else{logger[_0x0749('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x46a686,_0x0749('0xe'));_0x2cf119(_0x3e955b[_0x0749('0x13')][_0x0749('0x12')]);}})['catch'](function(_0x315ada){logger['error'](_0x0749('0xd'),_0x46a686,_0x315ada);_0x31acf1(_0x315ada);});});}exports['GetZohoAccount']=function(_0x38610f){var _0x17f20c=this;return new Promise(function(_0x5ac111,_0x5c8e21){return db[_0x0749('0x14')][_0x0749('0x15')]({'raw':_0x38610f[_0x0749('0x16')]?_0x38610f[_0x0749('0x16')][_0x0749('0x17')]===undefined?!![]:![]:!![],'where':_0x38610f['options']?_0x38610f[_0x0749('0x16')]['where']||null:null,'attributes':_0x38610f[_0x0749('0x16')]?_0x38610f['options'][_0x0749('0x18')]||null:null,'limit':_0x38610f['options']?_0x38610f['options']['limit']||null:null,'include':_0x38610f['options']?_0x38610f['options'][_0x0749('0x19')]?_[_0x0749('0x1a')](_0x38610f[_0x0749('0x16')][_0x0749('0x19')],function(_0x3c53ca){return{'model':db[_0x3c53ca[_0x0749('0x1b')]],'as':_0x3c53ca['as'],'attributes':_0x3c53ca[_0x0749('0x18')],'include':_0x3c53ca[_0x0749('0x19')]?_[_0x0749('0x1a')](_0x3c53ca[_0x0749('0x19')],function(_0x388c5a){return{'model':db[_0x388c5a[_0x0749('0x1b')]],'as':_0x388c5a['as'],'attributes':_0x388c5a[_0x0749('0x18')],'include':_0x388c5a[_0x0749('0x19')]?_[_0x0749('0x1a')](_0x388c5a[_0x0749('0x19')],function(_0x35c659){return{'model':db[_0x35c659[_0x0749('0x1b')]],'as':_0x35c659['as'],'attributes':_0x35c659[_0x0749('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0749('0xb')](function(_0x46888c){logger[_0x0749('0xc')]('GetZohoAccount',_0x38610f);logger['debug'](_0x0749('0x1c'),_0x38610f,JSON['stringify'](_0x46888c));_0x5ac111(_0x46888c);})[_0x0749('0x1d')](function(_0x2f88f6){logger['error'](_0x0749('0x1c'),_0x2f88f6[_0x0749('0x12')],_0x38610f);_0x5c8e21(_0x17f20c['error'](0x1f4,_0x2f88f6[_0x0749('0x12')]));});});};exports[_0x0749('0x1e')]=function(_0x47782c){var _0x2376b5=this;return new Promise(function(_0x17c4ce,_0x27e263){return db[_0x0749('0x14')][_0x0749('0x1f')]({'raw':_0x47782c[_0x0749('0x16')]?_0x47782c[_0x0749('0x16')][_0x0749('0x17')]===undefined?!![]:![]:!![],'where':_0x47782c[_0x0749('0x16')]?_0x47782c['options'][_0x0749('0x20')]||null:null,'attributes':_0x47782c[_0x0749('0x16')]?_0x47782c[_0x0749('0x16')][_0x0749('0x18')]||null:null,'include':_0x47782c[_0x0749('0x16')]?_0x47782c['options']['include']?_['map'](_0x47782c['options'][_0x0749('0x19')],function(_0x501b43){return{'model':db[_0x501b43['model']],'as':_0x501b43['as'],'attributes':_0x501b43[_0x0749('0x18')],'include':_0x501b43['include']?_['map'](_0x501b43[_0x0749('0x19')],function(_0x178e11){return{'model':db[_0x178e11[_0x0749('0x1b')]],'as':_0x178e11['as'],'attributes':_0x178e11[_0x0749('0x18')],'include':_0x178e11['include']?_[_0x0749('0x1a')](_0x178e11[_0x0749('0x19')],function(_0xd33cef){return{'model':db[_0xd33cef[_0x0749('0x1b')]],'as':_0xd33cef['as'],'attributes':_0xd33cef[_0x0749('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0749('0xb')](function(_0x5ecee5){logger[_0x0749('0xc')]('ShowZohoAccount',_0x47782c);logger['debug'](_0x0749('0x1e'),_0x47782c,JSON[_0x0749('0xf')](_0x5ecee5));_0x17c4ce(_0x5ecee5);})[_0x0749('0x1d')](function(_0x3c8335){logger['error']('ShowZohoAccount',_0x3c8335[_0x0749('0x12')],_0x47782c);_0x27e263(_0x2376b5[_0x0749('0x10')](0x1f4,_0x3c8335[_0x0749('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index bed2571..cee6caa 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 _0x86a9=['get','isAuthenticated','index','/:id','show','getSubjects','getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller'];(function(_0x48204f,_0x13aa75){var _0x338966=function(_0x4c7eb1){while(--_0x4c7eb1){_0x48204f['push'](_0x48204f['shift']());}};_0x338966(++_0x13aa75);}(_0x86a9,0x69));var _0x986a=function(_0x3e6512,_0x3d3ab3){_0x3e6512=_0x3e6512-0x0;var _0x4e199b=_0x86a9[_0x3e6512];return _0x4e199b;};'use strict';var multer=require(_0x986a('0x0'));var util=require(_0x986a('0x1'));var path=require(_0x986a('0x2'));var timeout=require(_0x986a('0x3'));var express=require(_0x986a('0x4'));var router=express[_0x986a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x986a('0x6'));var interaction=require(_0x986a('0x7'));var config=require(_0x986a('0x8'));var controller=require(_0x986a('0x9'));router[_0x986a('0xa')]('/',auth[_0x986a('0xb')](),controller[_0x986a('0xc')]);router[_0x986a('0xa')](_0x986a('0xd'),auth['isAuthenticated'](),controller[_0x986a('0xe')]);router['get']('/:id/fields',auth[_0x986a('0xb')](),controller['getFields']);router[_0x986a('0xa')]('/:id/subjects',auth[_0x986a('0xb')](),controller[_0x986a('0xf')]);router[_0x986a('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x986a('0x10')]);router['post']('/',auth[_0x986a('0xb')](),controller[_0x986a('0x11')]);router[_0x986a('0x12')](_0x986a('0xd'),auth[_0x986a('0xb')](),controller[_0x986a('0x13')]);router[_0x986a('0x14')](_0x986a('0xd'),auth['isAuthenticated'](),controller[_0x986a('0x15')]);module[_0x986a('0x16')]=router; \ No newline at end of file +var _0x04cf=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','exports'];(function(_0x1da84b,_0xf8abe7){var _0x36001c=function(_0x49922b){while(--_0x49922b){_0x1da84b['push'](_0x1da84b['shift']());}};_0x36001c(++_0xf8abe7);}(_0x04cf,0x1a0));var _0xf04c=function(_0x587f3a,_0x160bad){_0x587f3a=_0x587f3a-0x0;var _0x4fead2=_0x04cf[_0x587f3a];return _0x4fead2;};'use strict';var multer=require(_0xf04c('0x0'));var util=require(_0xf04c('0x1'));var path=require(_0xf04c('0x2'));var timeout=require(_0xf04c('0x3'));var express=require('express');var router=express[_0xf04c('0x4')]();var fs_extra=require(_0xf04c('0x5'));var auth=require(_0xf04c('0x6'));var interaction=require(_0xf04c('0x7'));var config=require(_0xf04c('0x8'));var controller=require('./intZohoConfiguration.controller');router[_0xf04c('0x9')]('/',auth['isAuthenticated'](),controller[_0xf04c('0xa')]);router[_0xf04c('0x9')]('/:id',auth[_0xf04c('0xb')](),controller[_0xf04c('0xc')]);router['get'](_0xf04c('0xd'),auth[_0xf04c('0xb')](),controller[_0xf04c('0xe')]);router[_0xf04c('0x9')](_0xf04c('0xf'),auth[_0xf04c('0xb')](),controller[_0xf04c('0x10')]);router['get'](_0xf04c('0x11'),auth[_0xf04c('0xb')](),controller[_0xf04c('0x12')]);router[_0xf04c('0x13')]('/',auth['isAuthenticated'](),controller[_0xf04c('0x14')]);router[_0xf04c('0x15')]('/:id',auth[_0xf04c('0xb')](),controller[_0xf04c('0x16')]);router[_0xf04c('0x17')](_0xf04c('0x18'),auth['isAuthenticated'](),controller['destroy']);module[_0xf04c('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 45f3b47..9ad87e0 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 _0xb94c=['nothing','ENUM','contact','contact_lead','STRING','exports'];(function(_0x1d9428,_0x2baa2f){var _0x52f4e0=function(_0x523f99){while(--_0x523f99){_0x1d9428['push'](_0x1d9428['shift']());}};_0x52f4e0(++_0x2baa2f);}(_0xb94c,0x1b5));var _0xcb94=function(_0x1add55,_0x4ebf3d){_0x1add55=_0x1add55-0x0;var _0x5d7786=_0xb94c[_0x1add55];return _0x5d7786;};'use strict';var Sequelize=require('sequelize');module[_0xcb94('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM']('lead','contact',_0xcb94('0x1')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xcb94('0x2')]('contact_lead',_0xcb94('0x3'),'lead'),'defaultValue':_0xcb94('0x4')},'description':{'type':Sequelize[_0xcb94('0x5')]}}; \ No newline at end of file +var _0x8195=['sequelize','exports','ENUM','nothing','lead','contact','contact_lead','STRING'];(function(_0x5a836d,_0x54be39){var _0x1f8e2c=function(_0x195c78){while(--_0x195c78){_0x5a836d['push'](_0x5a836d['shift']());}};_0x1f8e2c(++_0x54be39);}(_0x8195,0xb8));var _0x5819=function(_0x5d3ad5,_0x297649){_0x5d3ad5=_0x5d3ad5-0x0;var _0x540ae2=_0x8195[_0x5d3ad5];return _0x540ae2;};'use strict';var Sequelize=require(_0x5819('0x0'));module[_0x5819('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x5819('0x2')]('lead','contact',_0x5819('0x3')),'defaultValue':_0x5819('0x4')},'moduleSearch':{'type':Sequelize[_0x5819('0x2')]('contact_lead',_0x5819('0x5'),_0x5819('0x4')),'defaultValue':_0x5819('0x6')},'description':{'type':Sequelize[_0x5819('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index e8d2238..d4d20e3 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 _0xf2a4=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','sendStatus','end','status','json','offset','limit','Content-Range','save','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','findAll','rows','show','params','length','includeAll','include','create','body','destroy','find','findOne','ZohoField','getFields','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0xf2a4,0xfe));var _0x4f2a=function(_0x4247c2,_0x5e7ec3){_0x4247c2=_0x4247c2-0x0;var _0x4135ce=_0xf2a4[_0x4247c2];return _0x4135ce;};'use strict';var pdf=require(_0x4f2a('0x0'));var emlformat=require(_0x4f2a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4f2a('0x2'));var jsonpatch=require(_0x4f2a('0x3'));var rp=require(_0x4f2a('0x4'));var moment=require(_0x4f2a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4f2a('0x6'));var util=require(_0x4f2a('0x7'));var path=require('path');var sox=require(_0x4f2a('0x8'));var csv=require(_0x4f2a('0x9'));var ejs=require(_0x4f2a('0xa'));var fs=require('fs');var fs_extra=require(_0x4f2a('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4f2a('0xc'));var jsforce=require(_0x4f2a('0xd'));var deskjs=require(_0x4f2a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4f2a('0xf'));var Papa=require(_0x4f2a('0x10'));var Redis=require(_0x4f2a('0x11'));var authService=require(_0x4f2a('0x12'));var qs=require(_0x4f2a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f2a('0x14'));var logger=require(_0x4f2a('0x15'))(_0x4f2a('0x16'));var utils=require(_0x4f2a('0x17'));var config=require(_0x4f2a('0x18'));var licenseUtil=require(_0x4f2a('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4f2a('0x1a'));var client=jayson[_0x4f2a('0x1b')][_0x4f2a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d755e,_0x4252f0,_0x4c27cc,_0x49eec8){return new BPromise(function(_0x206684,_0x29a70b){var _0x4494fc=_0x49eec8||client;return _0x4494fc[_0x4f2a('0x1d')](_0x5d755e,_0x4c27cc)[_0x4f2a('0x1e')](function(_0x29a5de){logger[_0x4f2a('0x1f')](_0x4f2a('0x20'),_0x4252f0,'request\x20sent');logger[_0x4f2a('0x21')](_0x4f2a('0x22'),_0x4252f0,_0x4f2a('0x23'),JSON['stringify'](_0x29a5de));if(_0x29a5de[_0x4f2a('0x24')]){if(_0x29a5de['error']['code']===0x1f4){logger[_0x4f2a('0x24')](_0x4f2a('0x20'),_0x4252f0,_0x29a5de[_0x4f2a('0x24')][_0x4f2a('0x25')]);return _0x29a70b(_0x29a5de[_0x4f2a('0x24')]['message']);}logger[_0x4f2a('0x24')](_0x4f2a('0x20'),_0x4252f0,_0x29a5de[_0x4f2a('0x24')][_0x4f2a('0x25')]);return _0x206684(_0x29a5de[_0x4f2a('0x24')][_0x4f2a('0x25')]);}else{logger[_0x4f2a('0x1f')](_0x4f2a('0x20'),_0x4252f0,_0x4f2a('0x23'));_0x206684(_0x29a5de['result'][_0x4f2a('0x25')]);}})[_0x4f2a('0x26')](function(_0x158ed0){logger[_0x4f2a('0x24')](_0x4f2a('0x20'),_0x4252f0,_0x158ed0);_0x29a70b(_0x158ed0);});});}function respondWithStatusCode(_0x131ba9,_0xcf156b){_0xcf156b=_0xcf156b||0xcc;return function(_0x4ec9ef){if(_0x4ec9ef){return _0x131ba9[_0x4f2a('0x27')](_0xcf156b);}return _0x131ba9['status'](_0xcf156b)[_0x4f2a('0x28')]();};}function respondWithResult(_0x4f4137,_0x874468){_0x874468=_0x874468||0xc8;return function(_0x2163d9){if(_0x2163d9){return _0x4f4137[_0x4f2a('0x29')](_0x874468)[_0x4f2a('0x2a')](_0x2163d9);}};}function respondWithFilteredResult(_0x448543,_0x109879){return function(_0x2cbb37){if(_0x2cbb37){var _0x579519=_0x2cbb37['count'],_0x5e5138=_0x109879[_0x4f2a('0x2b')],_0x1f4862=_0x109879['offset']+_0x109879[_0x4f2a('0x2c')],_0x233cab;if(_0x1f4862>=_0x579519){_0x1f4862=_0x579519;_0x233cab=0xc8;}else{_0x233cab=0xce;}_0x448543[_0x4f2a('0x29')](_0x233cab);return _0x448543['set'](_0x4f2a('0x2d'),_0x5e5138+'-'+_0x1f4862+'/'+_0x579519)['json'](_0x2cbb37);}return null;};}function patchUpdates(_0x6c6c3f){return function(_0x284097){try{jsonpatch['apply'](_0x284097,_0x6c6c3f,!![]);}catch(_0x520784){return BPromise['reject'](_0x520784);}return _0x284097[_0x4f2a('0x2e')]();};}function saveUpdates(_0x29723b,_0x806109){return function(_0x57ff9b){if(_0x57ff9b){return _0x57ff9b['update'](_0x29723b)['then'](function(_0x1aac94){return _0x1aac94;});}return null;};}function removeEntity(_0x31b720,_0x1bbcdc){return function(_0x210cc9){if(_0x210cc9){return _0x210cc9['destroy']()[_0x4f2a('0x1e')](function(){_0x31b720[_0x4f2a('0x29')](0xcc)[_0x4f2a('0x28')]();});}};}function handleEntityNotFound(_0x11c5f9,_0x333001){return function(_0x2481f2){if(!_0x2481f2){_0x11c5f9[_0x4f2a('0x27')](0x194);}return _0x2481f2;};}function handleError(_0x3c7bea,_0x36ae38){_0x36ae38=_0x36ae38||0x1f4;return function(_0x332cfa){logger[_0x4f2a('0x24')](_0x332cfa['stack']);if(_0x332cfa[_0x4f2a('0x2f')]){delete _0x332cfa[_0x4f2a('0x2f')];}_0x3c7bea[_0x4f2a('0x29')](_0x36ae38)[_0x4f2a('0x30')](_0x332cfa);};}exports[_0x4f2a('0x31')]=function(_0x45e4ab,_0x555a38){var _0x2f11c1={},_0x5537b8={},_0x20d16d={'count':0x0,'rows':[]};var _0x5253a1=_['map'](db[_0x4f2a('0x32')][_0x4f2a('0x33')],function(_0x25f3ba){return{'name':_0x25f3ba[_0x4f2a('0x34')],'type':_0x25f3ba[_0x4f2a('0x35')][_0x4f2a('0x36')]};});_0x5537b8[_0x4f2a('0x37')]=_[_0x4f2a('0x38')](_0x5253a1,_0x4f2a('0x2f'));_0x5537b8['query']=_[_0x4f2a('0x39')](_0x45e4ab[_0x4f2a('0x3a')]);_0x5537b8[_0x4f2a('0x3b')]=_[_0x4f2a('0x3c')](_0x5537b8[_0x4f2a('0x37')],_0x5537b8[_0x4f2a('0x3a')]);_0x2f11c1[_0x4f2a('0x3d')]=_[_0x4f2a('0x3c')](_0x5537b8[_0x4f2a('0x37')],qs[_0x4f2a('0x3e')](_0x45e4ab['query'][_0x4f2a('0x3e')]));_0x2f11c1['attributes']=_0x2f11c1[_0x4f2a('0x3d')]['length']?_0x2f11c1[_0x4f2a('0x3d')]:_0x5537b8[_0x4f2a('0x37')];if(!_0x45e4ab[_0x4f2a('0x3a')][_0x4f2a('0x3f')](_0x4f2a('0x40'))){_0x2f11c1['limit']=qs[_0x4f2a('0x2c')](_0x45e4ab['query'][_0x4f2a('0x2c')]);_0x2f11c1[_0x4f2a('0x2b')]=qs['offset'](_0x45e4ab[_0x4f2a('0x3a')][_0x4f2a('0x2b')]);}_0x2f11c1[_0x4f2a('0x41')]=qs[_0x4f2a('0x42')](_0x45e4ab[_0x4f2a('0x3a')][_0x4f2a('0x42')]);_0x2f11c1[_0x4f2a('0x43')]=qs[_0x4f2a('0x3b')](_[_0x4f2a('0x44')](_0x45e4ab[_0x4f2a('0x3a')],_0x5537b8['filters']),_0x5253a1);if(_0x45e4ab[_0x4f2a('0x3a')]['filter']){_0x2f11c1[_0x4f2a('0x43')]=_[_0x4f2a('0x45')](_0x2f11c1[_0x4f2a('0x43')],{'$or':_['map'](_0x5253a1,function(_0xbf881c){if(_0xbf881c['type']!==_0x4f2a('0x46')){var _0x4d75ec={};_0x4d75ec[_0xbf881c[_0x4f2a('0x2f')]]={'$like':'%'+_0x45e4ab[_0x4f2a('0x3a')][_0x4f2a('0x47')]+'%'};return _0x4d75ec;}})});}_0x2f11c1=_[_0x4f2a('0x45')]({},_0x2f11c1,_0x45e4ab[_0x4f2a('0x48')]);var _0x3ee192={'where':_0x2f11c1['where']};return db[_0x4f2a('0x32')][_0x4f2a('0x49')](_0x3ee192)[_0x4f2a('0x1e')](function(_0x2013da){_0x20d16d[_0x4f2a('0x49')]=_0x2013da;if(_0x45e4ab[_0x4f2a('0x3a')]['includeAll']){_0x2f11c1['include']=[{'all':!![]}];}return db[_0x4f2a('0x32')][_0x4f2a('0x4a')](_0x2f11c1);})['then'](function(_0x282093){_0x20d16d[_0x4f2a('0x4b')]=_0x282093;return _0x20d16d;})[_0x4f2a('0x1e')](respondWithFilteredResult(_0x555a38,_0x2f11c1))['catch'](handleError(_0x555a38,null));};exports[_0x4f2a('0x4c')]=function(_0x2a3283,_0x43f32e){var _0x47f339={'raw':![],'where':{'id':_0x2a3283[_0x4f2a('0x4d')]['id']}},_0x53d1f9={};_0x53d1f9['model']=_['keys'](db[_0x4f2a('0x32')][_0x4f2a('0x33')]);_0x53d1f9['query']=_[_0x4f2a('0x39')](_0x2a3283[_0x4f2a('0x3a')]);_0x53d1f9[_0x4f2a('0x3b')]=_[_0x4f2a('0x3c')](_0x53d1f9[_0x4f2a('0x37')],_0x53d1f9[_0x4f2a('0x3a')]);_0x47f339[_0x4f2a('0x3d')]=_[_0x4f2a('0x3c')](_0x53d1f9['model'],qs[_0x4f2a('0x3e')](_0x2a3283[_0x4f2a('0x3a')][_0x4f2a('0x3e')]));_0x47f339[_0x4f2a('0x3d')]=_0x47f339[_0x4f2a('0x3d')][_0x4f2a('0x4e')]?_0x47f339[_0x4f2a('0x3d')]:_0x53d1f9['model'];if(_0x2a3283[_0x4f2a('0x3a')][_0x4f2a('0x4f')]){_0x47f339[_0x4f2a('0x50')]=[{'all':!![]}];}_0x47f339=_[_0x4f2a('0x45')]({},_0x47f339,_0x2a3283[_0x4f2a('0x48')]);return db[_0x4f2a('0x32')]['find'](_0x47f339)[_0x4f2a('0x1e')](handleEntityNotFound(_0x43f32e,null))[_0x4f2a('0x1e')](respondWithResult(_0x43f32e,null))[_0x4f2a('0x26')](handleError(_0x43f32e,null));};exports[_0x4f2a('0x51')]=function(_0x1969a0,_0x1076ec){return db[_0x4f2a('0x32')][_0x4f2a('0x51')](_0x1969a0[_0x4f2a('0x52')],{})[_0x4f2a('0x1e')](respondWithResult(_0x1076ec,0xc9))[_0x4f2a('0x26')](handleError(_0x1076ec,null));};exports['update']=function(_0x4a2b8a,_0x4a7308){if(_0x4a2b8a[_0x4f2a('0x52')]['id']){delete _0x4a2b8a[_0x4f2a('0x52')]['id'];}return db[_0x4f2a('0x32')]['find']({'where':{'id':_0x4a2b8a[_0x4f2a('0x4d')]['id']}})[_0x4f2a('0x1e')](handleEntityNotFound(_0x4a7308,null))[_0x4f2a('0x1e')](saveUpdates(_0x4a2b8a[_0x4f2a('0x52')],null))[_0x4f2a('0x1e')](respondWithResult(_0x4a7308,null))[_0x4f2a('0x26')](handleError(_0x4a7308,null));};exports[_0x4f2a('0x53')]=function(_0x3369f1,_0x26edfc){return db[_0x4f2a('0x32')][_0x4f2a('0x54')]({'where':{'id':_0x3369f1[_0x4f2a('0x4d')]['id']}})[_0x4f2a('0x1e')](handleEntityNotFound(_0x26edfc,null))['then'](removeEntity(_0x26edfc,null))[_0x4f2a('0x26')](handleError(_0x26edfc,null));};exports['getFields']=function(_0x25ad94,_0x421da0,_0x24cd5d){var _0x300984={};var _0x32c219={};var _0x17e96b;var _0x1a6145;return db['ZohoConfiguration'][_0x4f2a('0x55')]({'where':{'id':_0x25ad94[_0x4f2a('0x4d')]['id']}})[_0x4f2a('0x1e')](handleEntityNotFound(_0x421da0,null))[_0x4f2a('0x1e')](function(_0xc3332e){if(_0xc3332e){_0x17e96b=_0xc3332e;_0x32c219['model']=_[_0x4f2a('0x39')](db[_0x4f2a('0x56')][_0x4f2a('0x33')]);_0x32c219['query']=_[_0x4f2a('0x39')](_0x25ad94[_0x4f2a('0x3a')]);_0x32c219[_0x4f2a('0x3b')]=_[_0x4f2a('0x3c')](_0x32c219[_0x4f2a('0x37')],_0x32c219[_0x4f2a('0x3a')]);_0x300984[_0x4f2a('0x3d')]=_[_0x4f2a('0x3c')](_0x32c219[_0x4f2a('0x37')],qs[_0x4f2a('0x3e')](_0x25ad94[_0x4f2a('0x3a')][_0x4f2a('0x3e')]));_0x300984[_0x4f2a('0x3d')]=_0x300984[_0x4f2a('0x3d')][_0x4f2a('0x4e')]?_0x300984[_0x4f2a('0x3d')]:_0x32c219[_0x4f2a('0x37')];_0x300984[_0x4f2a('0x41')]=qs['sort'](_0x25ad94['query'][_0x4f2a('0x42')]);_0x300984['where']=qs[_0x4f2a('0x3b')](_[_0x4f2a('0x44')](_0x25ad94[_0x4f2a('0x3a')],_0x32c219[_0x4f2a('0x3b')]));if(_0x25ad94[_0x4f2a('0x3a')]['filter']){_0x300984[_0x4f2a('0x43')]=_[_0x4f2a('0x45')](_0x300984[_0x4f2a('0x43')],{'$or':_[_0x4f2a('0x38')](_0x300984['attributes'],function(_0x1efec7){var _0x4d2d62={};_0x4d2d62[_0x1efec7]={'$like':'%'+_0x25ad94[_0x4f2a('0x3a')][_0x4f2a('0x47')]+'%'};return _0x4d2d62;})});}_0x300984=_['merge']({},_0x300984,_0x25ad94[_0x4f2a('0x48')]);return _0x17e96b[_0x4f2a('0x57')](_0x300984);}})[_0x4f2a('0x1e')](function(_0x2f8421){if(_0x2f8421){_0x1a6145=_0x2f8421['length'];if(!_0x25ad94[_0x4f2a('0x3a')][_0x4f2a('0x3f')](_0x4f2a('0x40'))){_0x300984[_0x4f2a('0x2c')]=qs[_0x4f2a('0x2c')](_0x25ad94[_0x4f2a('0x3a')][_0x4f2a('0x2c')]);_0x300984[_0x4f2a('0x2b')]=qs['offset'](_0x25ad94[_0x4f2a('0x3a')][_0x4f2a('0x2b')]);}return _0x17e96b['getFields'](_0x300984);}})[_0x4f2a('0x1e')](function(_0x18b50f){if(_0x18b50f){return _0x18b50f?{'count':_0x1a6145,'rows':_0x18b50f}:null;}})['then'](respondWithResult(_0x421da0,null))[_0x4f2a('0x26')](handleError(_0x421da0,null));};exports[_0x4f2a('0x58')]=function(_0x2ebef5,_0x158b2d,_0x18abce){var _0x2cef5b={};var _0x3feb33={};var _0x2876cd;var _0x3844f0;return db[_0x4f2a('0x32')][_0x4f2a('0x55')]({'where':{'id':_0x2ebef5[_0x4f2a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x158b2d,null))[_0x4f2a('0x1e')](function(_0x5eae58){if(_0x5eae58){_0x2876cd=_0x5eae58;_0x3feb33[_0x4f2a('0x37')]=_[_0x4f2a('0x39')](db[_0x4f2a('0x56')][_0x4f2a('0x33')]);_0x3feb33['query']=_['keys'](_0x2ebef5[_0x4f2a('0x3a')]);_0x3feb33[_0x4f2a('0x3b')]=_[_0x4f2a('0x3c')](_0x3feb33[_0x4f2a('0x37')],_0x3feb33['query']);_0x2cef5b[_0x4f2a('0x3d')]=_['intersection'](_0x3feb33['model'],qs[_0x4f2a('0x3e')](_0x2ebef5[_0x4f2a('0x3a')][_0x4f2a('0x3e')]));_0x2cef5b[_0x4f2a('0x3d')]=_0x2cef5b[_0x4f2a('0x3d')]['length']?_0x2cef5b[_0x4f2a('0x3d')]:_0x3feb33[_0x4f2a('0x37')];_0x2cef5b[_0x4f2a('0x41')]=qs[_0x4f2a('0x42')](_0x2ebef5[_0x4f2a('0x3a')][_0x4f2a('0x42')]);_0x2cef5b[_0x4f2a('0x43')]=qs['filters'](_['pick'](_0x2ebef5[_0x4f2a('0x3a')],_0x3feb33['filters']));if(_0x2ebef5[_0x4f2a('0x3a')][_0x4f2a('0x47')]){_0x2cef5b['where']=_[_0x4f2a('0x45')](_0x2cef5b[_0x4f2a('0x43')],{'$or':_[_0x4f2a('0x38')](_0x2cef5b['attributes'],function(_0x56c09b){var _0x2d2743={};_0x2d2743[_0x56c09b]={'$like':'%'+_0x2ebef5['query'][_0x4f2a('0x47')]+'%'};return _0x2d2743;})});}_0x2cef5b=_['merge']({},_0x2cef5b,_0x2ebef5[_0x4f2a('0x48')]);return _0x2876cd[_0x4f2a('0x58')](_0x2cef5b);}})['then'](function(_0x357a90){if(_0x357a90){_0x3844f0=_0x357a90['length'];if(!_0x2ebef5['query'][_0x4f2a('0x3f')]('nolimit')){_0x2cef5b[_0x4f2a('0x2c')]=qs[_0x4f2a('0x2c')](_0x2ebef5[_0x4f2a('0x3a')][_0x4f2a('0x2c')]);_0x2cef5b[_0x4f2a('0x2b')]=qs['offset'](_0x2ebef5[_0x4f2a('0x3a')]['offset']);}return _0x2876cd['getSubjects'](_0x2cef5b);}})[_0x4f2a('0x1e')](function(_0x4f3487){if(_0x4f3487){return _0x4f3487?{'count':_0x3844f0,'rows':_0x4f3487}:null;}})[_0x4f2a('0x1e')](respondWithResult(_0x158b2d,null))['catch'](handleError(_0x158b2d,null));};exports['getDescriptions']=function(_0x192502,_0x21c0c5,_0x23a5f0){var _0x26cfc0={};var _0x1fd567={};var _0x2ebb94;var _0x4affff;return db[_0x4f2a('0x32')][_0x4f2a('0x55')]({'where':{'id':_0x192502[_0x4f2a('0x4d')]['id']}})[_0x4f2a('0x1e')](handleEntityNotFound(_0x21c0c5,null))['then'](function(_0x4acac1){if(_0x4acac1){_0x2ebb94=_0x4acac1;_0x1fd567['model']=_[_0x4f2a('0x39')](db[_0x4f2a('0x56')][_0x4f2a('0x33')]);_0x1fd567[_0x4f2a('0x3a')]=_[_0x4f2a('0x39')](_0x192502[_0x4f2a('0x3a')]);_0x1fd567[_0x4f2a('0x3b')]=_[_0x4f2a('0x3c')](_0x1fd567['model'],_0x1fd567[_0x4f2a('0x3a')]);_0x26cfc0[_0x4f2a('0x3d')]=_[_0x4f2a('0x3c')](_0x1fd567[_0x4f2a('0x37')],qs[_0x4f2a('0x3e')](_0x192502[_0x4f2a('0x3a')]['fields']));_0x26cfc0[_0x4f2a('0x3d')]=_0x26cfc0['attributes'][_0x4f2a('0x4e')]?_0x26cfc0[_0x4f2a('0x3d')]:_0x1fd567[_0x4f2a('0x37')];_0x26cfc0[_0x4f2a('0x41')]=qs[_0x4f2a('0x42')](_0x192502[_0x4f2a('0x3a')][_0x4f2a('0x42')]);_0x26cfc0[_0x4f2a('0x43')]=qs['filters'](_[_0x4f2a('0x44')](_0x192502[_0x4f2a('0x3a')],_0x1fd567[_0x4f2a('0x3b')]));if(_0x192502[_0x4f2a('0x3a')][_0x4f2a('0x47')]){_0x26cfc0[_0x4f2a('0x43')]=_['merge'](_0x26cfc0[_0x4f2a('0x43')],{'$or':_[_0x4f2a('0x38')](_0x26cfc0[_0x4f2a('0x3d')],function(_0xa11658){var _0x456390={};_0x456390[_0xa11658]={'$like':'%'+_0x192502[_0x4f2a('0x3a')][_0x4f2a('0x47')]+'%'};return _0x456390;})});}_0x26cfc0=_[_0x4f2a('0x45')]({},_0x26cfc0,_0x192502[_0x4f2a('0x48')]);return _0x2ebb94[_0x4f2a('0x59')](_0x26cfc0);}})[_0x4f2a('0x1e')](function(_0x48ca6e){if(_0x48ca6e){_0x4affff=_0x48ca6e[_0x4f2a('0x4e')];if(!_0x192502['query']['hasOwnProperty']('nolimit')){_0x26cfc0['limit']=qs[_0x4f2a('0x2c')](_0x192502[_0x4f2a('0x3a')]['limit']);_0x26cfc0[_0x4f2a('0x2b')]=qs[_0x4f2a('0x2b')](_0x192502[_0x4f2a('0x3a')][_0x4f2a('0x2b')]);}return _0x2ebb94[_0x4f2a('0x59')](_0x26cfc0);}})[_0x4f2a('0x1e')](function(_0x198060){if(_0x198060){return _0x198060?{'count':_0x4affff,'rows':_0x198060}:null;}})['then'](respondWithResult(_0x21c0c5,null))[_0x4f2a('0x26')](handleError(_0x21c0c5,null));}; \ No newline at end of file +var _0xd86a=['nolimit','limit','offset','order','sort','pick','filters','filter','where','merge','options','include','findAll','params','rawAttributes','includeAll','find','create','body','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','count','set','Content-Range','json','reject','update','destroy','sendStatus','stack','name','send','map','ZohoConfiguration','type','model','query','keys','intersection','attributes','fields','length'];(function(_0x1ae4a9,_0x4c0ed9){var _0x54d0b0=function(_0x4fff20){while(--_0x4fff20){_0x1ae4a9['push'](_0x1ae4a9['shift']());}};_0x54d0b0(++_0x4c0ed9);}(_0xd86a,0xd1));var _0xad86=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0xd86a[_0x1cbcf1];return _0x3a06f0;};'use strict';var pdf=require(_0xad86('0x0'));var emlformat=require(_0xad86('0x1'));var rimraf=require(_0xad86('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad86('0x3'));var rp=require(_0xad86('0x4'));var moment=require(_0xad86('0x5'));var BPromise=require(_0xad86('0x6'));var Mustache=require(_0xad86('0x7'));var util=require('util');var path=require(_0xad86('0x8'));var sox=require(_0xad86('0x9'));var csv=require('to-csv');var ejs=require(_0xad86('0xa'));var fs=require('fs');var fs_extra=require(_0xad86('0xb'));var _=require(_0xad86('0xc'));var squel=require(_0xad86('0xd'));var crypto=require(_0xad86('0xe'));var jsforce=require(_0xad86('0xf'));var deskjs=require(_0xad86('0x10'));var toCsv=require(_0xad86('0x11'));var querystring=require(_0xad86('0x12'));var Papa=require(_0xad86('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xad86('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad86('0x15'));var logger=require(_0xad86('0x16'))(_0xad86('0x17'));var utils=require(_0xad86('0x18'));var config=require(_0xad86('0x19'));var licenseUtil=require(_0xad86('0x1a'));var db=require(_0xad86('0x1b'))['db'];var jayson=require(_0xad86('0x1c'));var client=jayson[_0xad86('0x1d')][_0xad86('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4bb24e,_0x403d5a,_0x463c06,_0x5bd7cf){return new BPromise(function(_0x3b0c1b,_0x290639){var _0x3501eb=_0x5bd7cf||client;return _0x3501eb[_0xad86('0x1f')](_0x4bb24e,_0x463c06)[_0xad86('0x20')](function(_0x48c069){logger[_0xad86('0x21')](_0xad86('0x22'),_0x403d5a,_0xad86('0x23'));logger[_0xad86('0x24')](_0xad86('0x25'),_0x403d5a,_0xad86('0x23'),JSON[_0xad86('0x26')](_0x48c069));if(_0x48c069[_0xad86('0x27')]){if(_0x48c069[_0xad86('0x27')][_0xad86('0x28')]===0x1f4){logger[_0xad86('0x27')]('ZohoConfiguration,\x20%s,\x20%s',_0x403d5a,_0x48c069[_0xad86('0x27')]['message']);return _0x290639(_0x48c069[_0xad86('0x27')][_0xad86('0x29')]);}logger[_0xad86('0x27')]('ZohoConfiguration,\x20%s,\x20%s',_0x403d5a,_0x48c069[_0xad86('0x27')]['message']);return _0x3b0c1b(_0x48c069[_0xad86('0x27')]['message']);}else{logger[_0xad86('0x21')](_0xad86('0x22'),_0x403d5a,_0xad86('0x23'));_0x3b0c1b(_0x48c069[_0xad86('0x2a')][_0xad86('0x29')]);}})[_0xad86('0x2b')](function(_0x580c91){logger[_0xad86('0x27')](_0xad86('0x22'),_0x403d5a,_0x580c91);_0x290639(_0x580c91);});});}function respondWithStatusCode(_0x5c9005,_0x25880c){_0x25880c=_0x25880c||0xcc;return function(_0x4c036d){if(_0x4c036d){return _0x5c9005['sendStatus'](_0x25880c);}return _0x5c9005[_0xad86('0x2c')](_0x25880c)[_0xad86('0x2d')]();};}function respondWithResult(_0x2a707e,_0x412618){_0x412618=_0x412618||0xc8;return function(_0x515ec2){if(_0x515ec2){return _0x2a707e[_0xad86('0x2c')](_0x412618)['json'](_0x515ec2);}};}function respondWithFilteredResult(_0xa45c55,_0x508017){return function(_0x2750ca){if(_0x2750ca){var _0x1f0790=_0x2750ca[_0xad86('0x2e')],_0x1ca80a=_0x508017['offset'],_0xecf9d4=_0x508017['offset']+_0x508017['limit'],_0x5b94b0;if(_0xecf9d4>=_0x1f0790){_0xecf9d4=_0x1f0790;_0x5b94b0=0xc8;}else{_0x5b94b0=0xce;}_0xa45c55[_0xad86('0x2c')](_0x5b94b0);return _0xa45c55[_0xad86('0x2f')](_0xad86('0x30'),_0x1ca80a+'-'+_0xecf9d4+'/'+_0x1f0790)[_0xad86('0x31')](_0x2750ca);}return null;};}function patchUpdates(_0x224ec1){return function(_0x5db3b2){try{jsonpatch['apply'](_0x5db3b2,_0x224ec1,!![]);}catch(_0x6e6115){return BPromise[_0xad86('0x32')](_0x6e6115);}return _0x5db3b2['save']();};}function saveUpdates(_0x26fc0f,_0x2f4cff){return function(_0x22a19f){if(_0x22a19f){return _0x22a19f[_0xad86('0x33')](_0x26fc0f)['then'](function(_0xd09395){return _0xd09395;});}return null;};}function removeEntity(_0x3d24d8,_0x59c94a){return function(_0x18348a){if(_0x18348a){return _0x18348a[_0xad86('0x34')]()[_0xad86('0x20')](function(){_0x3d24d8[_0xad86('0x2c')](0xcc)[_0xad86('0x2d')]();});}};}function handleEntityNotFound(_0x59a275,_0x30e664){return function(_0x21d4f0){if(!_0x21d4f0){_0x59a275[_0xad86('0x35')](0x194);}return _0x21d4f0;};}function handleError(_0x370167,_0x548c01){_0x548c01=_0x548c01||0x1f4;return function(_0x31680e){logger['error'](_0x31680e[_0xad86('0x36')]);if(_0x31680e[_0xad86('0x37')]){delete _0x31680e['name'];}_0x370167['status'](_0x548c01)[_0xad86('0x38')](_0x31680e);};}exports['index']=function(_0x49998c,_0x365e06){var _0x32f323={},_0x30f247={},_0x57c6d9={'count':0x0,'rows':[]};var _0x3a3343=_[_0xad86('0x39')](db[_0xad86('0x3a')]['rawAttributes'],function(_0x1a4f60){return{'name':_0x1a4f60['fieldName'],'type':_0x1a4f60[_0xad86('0x3b')]['key']};});_0x30f247[_0xad86('0x3c')]=_[_0xad86('0x39')](_0x3a3343,_0xad86('0x37'));_0x30f247[_0xad86('0x3d')]=_[_0xad86('0x3e')](_0x49998c['query']);_0x30f247['filters']=_[_0xad86('0x3f')](_0x30f247[_0xad86('0x3c')],_0x30f247['query']);_0x32f323[_0xad86('0x40')]=_['intersection'](_0x30f247[_0xad86('0x3c')],qs[_0xad86('0x41')](_0x49998c[_0xad86('0x3d')][_0xad86('0x41')]));_0x32f323[_0xad86('0x40')]=_0x32f323[_0xad86('0x40')][_0xad86('0x42')]?_0x32f323[_0xad86('0x40')]:_0x30f247[_0xad86('0x3c')];if(!_0x49998c[_0xad86('0x3d')]['hasOwnProperty'](_0xad86('0x43'))){_0x32f323[_0xad86('0x44')]=qs[_0xad86('0x44')](_0x49998c[_0xad86('0x3d')][_0xad86('0x44')]);_0x32f323[_0xad86('0x45')]=qs[_0xad86('0x45')](_0x49998c[_0xad86('0x3d')][_0xad86('0x45')]);}_0x32f323[_0xad86('0x46')]=qs[_0xad86('0x47')](_0x49998c['query'][_0xad86('0x47')]);_0x32f323['where']=qs['filters'](_[_0xad86('0x48')](_0x49998c['query'],_0x30f247[_0xad86('0x49')]),_0x3a3343);if(_0x49998c[_0xad86('0x3d')][_0xad86('0x4a')]){_0x32f323[_0xad86('0x4b')]=_[_0xad86('0x4c')](_0x32f323[_0xad86('0x4b')],{'$or':_[_0xad86('0x39')](_0x3a3343,function(_0x1fdcc9){if(_0x1fdcc9[_0xad86('0x3b')]!=='VIRTUAL'){var _0x3a28cb={};_0x3a28cb[_0x1fdcc9[_0xad86('0x37')]]={'$like':'%'+_0x49998c[_0xad86('0x3d')][_0xad86('0x4a')]+'%'};return _0x3a28cb;}})});}_0x32f323=_[_0xad86('0x4c')]({},_0x32f323,_0x49998c[_0xad86('0x4d')]);var _0x1cf03e={'where':_0x32f323[_0xad86('0x4b')]};return db[_0xad86('0x3a')][_0xad86('0x2e')](_0x1cf03e)[_0xad86('0x20')](function(_0x3386fe){_0x57c6d9[_0xad86('0x2e')]=_0x3386fe;if(_0x49998c['query']['includeAll']){_0x32f323[_0xad86('0x4e')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xad86('0x4f')](_0x32f323);})[_0xad86('0x20')](function(_0x385b7b){_0x57c6d9['rows']=_0x385b7b;return _0x57c6d9;})['then'](respondWithFilteredResult(_0x365e06,_0x32f323))[_0xad86('0x2b')](handleError(_0x365e06,null));};exports['show']=function(_0x268f81,_0xf9723c){var _0x4fa4d8={'raw':![],'where':{'id':_0x268f81[_0xad86('0x50')]['id']}},_0x35a480={};_0x35a480[_0xad86('0x3c')]=_[_0xad86('0x3e')](db['ZohoConfiguration'][_0xad86('0x51')]);_0x35a480[_0xad86('0x3d')]=_[_0xad86('0x3e')](_0x268f81[_0xad86('0x3d')]);_0x35a480['filters']=_[_0xad86('0x3f')](_0x35a480[_0xad86('0x3c')],_0x35a480[_0xad86('0x3d')]);_0x4fa4d8[_0xad86('0x40')]=_[_0xad86('0x3f')](_0x35a480['model'],qs[_0xad86('0x41')](_0x268f81[_0xad86('0x3d')]['fields']));_0x4fa4d8[_0xad86('0x40')]=_0x4fa4d8[_0xad86('0x40')][_0xad86('0x42')]?_0x4fa4d8[_0xad86('0x40')]:_0x35a480[_0xad86('0x3c')];if(_0x268f81[_0xad86('0x3d')][_0xad86('0x52')]){_0x4fa4d8['include']=[{'all':!![]}];}_0x4fa4d8=_[_0xad86('0x4c')]({},_0x4fa4d8,_0x268f81[_0xad86('0x4d')]);return db['ZohoConfiguration'][_0xad86('0x53')](_0x4fa4d8)[_0xad86('0x20')](handleEntityNotFound(_0xf9723c,null))['then'](respondWithResult(_0xf9723c,null))['catch'](handleError(_0xf9723c,null));};exports[_0xad86('0x54')]=function(_0x546d7f,_0x592f94){return db['ZohoConfiguration'][_0xad86('0x54')](_0x546d7f['body'],{})[_0xad86('0x20')](respondWithResult(_0x592f94,0xc9))['catch'](handleError(_0x592f94,null));};exports['update']=function(_0x4a2145,_0x2c59f4){if(_0x4a2145[_0xad86('0x55')]['id']){delete _0x4a2145[_0xad86('0x55')]['id'];}return db['ZohoConfiguration'][_0xad86('0x53')]({'where':{'id':_0x4a2145[_0xad86('0x50')]['id']}})[_0xad86('0x20')](handleEntityNotFound(_0x2c59f4,null))[_0xad86('0x20')](saveUpdates(_0x4a2145[_0xad86('0x55')],null))['then'](respondWithResult(_0x2c59f4,null))['catch'](handleError(_0x2c59f4,null));};exports[_0xad86('0x34')]=function(_0x1f221e,_0x100717){return db[_0xad86('0x3a')][_0xad86('0x53')]({'where':{'id':_0x1f221e[_0xad86('0x50')]['id']}})[_0xad86('0x20')](handleEntityNotFound(_0x100717,null))[_0xad86('0x20')](removeEntity(_0x100717,null))[_0xad86('0x2b')](handleError(_0x100717,null));};exports[_0xad86('0x56')]=function(_0x8820d1,_0x1e93b3,_0x3bc9e8){var _0x938834={};var _0x353caf={};var _0x595930;var _0x2bc69f;return db['ZohoConfiguration'][_0xad86('0x57')]({'where':{'id':_0x8820d1[_0xad86('0x50')]['id']}})[_0xad86('0x20')](handleEntityNotFound(_0x1e93b3,null))['then'](function(_0x5b4d94){if(_0x5b4d94){_0x595930=_0x5b4d94;_0x353caf['model']=_[_0xad86('0x3e')](db[_0xad86('0x58')][_0xad86('0x51')]);_0x353caf['query']=_[_0xad86('0x3e')](_0x8820d1[_0xad86('0x3d')]);_0x353caf[_0xad86('0x49')]=_[_0xad86('0x3f')](_0x353caf[_0xad86('0x3c')],_0x353caf['query']);_0x938834[_0xad86('0x40')]=_[_0xad86('0x3f')](_0x353caf[_0xad86('0x3c')],qs[_0xad86('0x41')](_0x8820d1['query'][_0xad86('0x41')]));_0x938834[_0xad86('0x40')]=_0x938834[_0xad86('0x40')][_0xad86('0x42')]?_0x938834[_0xad86('0x40')]:_0x353caf['model'];_0x938834['order']=qs[_0xad86('0x47')](_0x8820d1[_0xad86('0x3d')]['sort']);_0x938834[_0xad86('0x4b')]=qs['filters'](_[_0xad86('0x48')](_0x8820d1[_0xad86('0x3d')],_0x353caf['filters']));if(_0x8820d1[_0xad86('0x3d')][_0xad86('0x4a')]){_0x938834[_0xad86('0x4b')]=_[_0xad86('0x4c')](_0x938834['where'],{'$or':_[_0xad86('0x39')](_0x938834['attributes'],function(_0x96c85){var _0x1e5f37={};_0x1e5f37[_0x96c85]={'$like':'%'+_0x8820d1[_0xad86('0x3d')]['filter']+'%'};return _0x1e5f37;})});}_0x938834=_[_0xad86('0x4c')]({},_0x938834,_0x8820d1[_0xad86('0x4d')]);return _0x595930['getFields'](_0x938834);}})[_0xad86('0x20')](function(_0x4a35ce){if(_0x4a35ce){_0x2bc69f=_0x4a35ce[_0xad86('0x42')];if(!_0x8820d1[_0xad86('0x3d')][_0xad86('0x59')](_0xad86('0x43'))){_0x938834[_0xad86('0x44')]=qs['limit'](_0x8820d1[_0xad86('0x3d')][_0xad86('0x44')]);_0x938834['offset']=qs['offset'](_0x8820d1[_0xad86('0x3d')][_0xad86('0x45')]);}return _0x595930[_0xad86('0x56')](_0x938834);}})[_0xad86('0x20')](function(_0x2f53d8){if(_0x2f53d8){return _0x2f53d8?{'count':_0x2bc69f,'rows':_0x2f53d8}:null;}})['then'](respondWithResult(_0x1e93b3,null))[_0xad86('0x2b')](handleError(_0x1e93b3,null));};exports['getSubjects']=function(_0x10c8fc,_0x2110f9,_0x46ecc8){var _0x179226={};var _0x50dddd={};var _0x592ccc;var _0xb3df32;return db[_0xad86('0x3a')]['findOne']({'where':{'id':_0x10c8fc[_0xad86('0x50')]['id']}})['then'](handleEntityNotFound(_0x2110f9,null))[_0xad86('0x20')](function(_0x433d71){if(_0x433d71){_0x592ccc=_0x433d71;_0x50dddd[_0xad86('0x3c')]=_['keys'](db[_0xad86('0x58')][_0xad86('0x51')]);_0x50dddd[_0xad86('0x3d')]=_[_0xad86('0x3e')](_0x10c8fc[_0xad86('0x3d')]);_0x50dddd[_0xad86('0x49')]=_[_0xad86('0x3f')](_0x50dddd['model'],_0x50dddd[_0xad86('0x3d')]);_0x179226['attributes']=_[_0xad86('0x3f')](_0x50dddd['model'],qs[_0xad86('0x41')](_0x10c8fc[_0xad86('0x3d')][_0xad86('0x41')]));_0x179226[_0xad86('0x40')]=_0x179226['attributes'][_0xad86('0x42')]?_0x179226[_0xad86('0x40')]:_0x50dddd[_0xad86('0x3c')];_0x179226[_0xad86('0x46')]=qs[_0xad86('0x47')](_0x10c8fc[_0xad86('0x3d')][_0xad86('0x47')]);_0x179226[_0xad86('0x4b')]=qs[_0xad86('0x49')](_['pick'](_0x10c8fc[_0xad86('0x3d')],_0x50dddd[_0xad86('0x49')]));if(_0x10c8fc[_0xad86('0x3d')][_0xad86('0x4a')]){_0x179226[_0xad86('0x4b')]=_['merge'](_0x179226['where'],{'$or':_[_0xad86('0x39')](_0x179226[_0xad86('0x40')],function(_0x2ffede){var _0x102981={};_0x102981[_0x2ffede]={'$like':'%'+_0x10c8fc[_0xad86('0x3d')]['filter']+'%'};return _0x102981;})});}_0x179226=_['merge']({},_0x179226,_0x10c8fc['options']);return _0x592ccc['getSubjects'](_0x179226);}})['then'](function(_0xe36692){if(_0xe36692){_0xb3df32=_0xe36692[_0xad86('0x42')];if(!_0x10c8fc['query'][_0xad86('0x59')](_0xad86('0x43'))){_0x179226[_0xad86('0x44')]=qs[_0xad86('0x44')](_0x10c8fc[_0xad86('0x3d')]['limit']);_0x179226[_0xad86('0x45')]=qs[_0xad86('0x45')](_0x10c8fc[_0xad86('0x3d')]['offset']);}return _0x592ccc[_0xad86('0x5a')](_0x179226);}})[_0xad86('0x20')](function(_0xf0de7a){if(_0xf0de7a){return _0xf0de7a?{'count':_0xb3df32,'rows':_0xf0de7a}:null;}})[_0xad86('0x20')](respondWithResult(_0x2110f9,null))[_0xad86('0x2b')](handleError(_0x2110f9,null));};exports[_0xad86('0x5b')]=function(_0x10f2da,_0x455153,_0x4a464e){var _0x5747fa={};var _0x44989d={};var _0x315220;var _0x4384a8;return db[_0xad86('0x3a')][_0xad86('0x57')]({'where':{'id':_0x10f2da[_0xad86('0x50')]['id']}})['then'](handleEntityNotFound(_0x455153,null))['then'](function(_0x78a8e3){if(_0x78a8e3){_0x315220=_0x78a8e3;_0x44989d[_0xad86('0x3c')]=_[_0xad86('0x3e')](db[_0xad86('0x58')]['rawAttributes']);_0x44989d[_0xad86('0x3d')]=_[_0xad86('0x3e')](_0x10f2da[_0xad86('0x3d')]);_0x44989d[_0xad86('0x49')]=_['intersection'](_0x44989d[_0xad86('0x3c')],_0x44989d['query']);_0x5747fa[_0xad86('0x40')]=_['intersection'](_0x44989d[_0xad86('0x3c')],qs[_0xad86('0x41')](_0x10f2da[_0xad86('0x3d')][_0xad86('0x41')]));_0x5747fa[_0xad86('0x40')]=_0x5747fa[_0xad86('0x40')][_0xad86('0x42')]?_0x5747fa[_0xad86('0x40')]:_0x44989d[_0xad86('0x3c')];_0x5747fa[_0xad86('0x46')]=qs[_0xad86('0x47')](_0x10f2da[_0xad86('0x3d')]['sort']);_0x5747fa[_0xad86('0x4b')]=qs['filters'](_[_0xad86('0x48')](_0x10f2da[_0xad86('0x3d')],_0x44989d[_0xad86('0x49')]));if(_0x10f2da[_0xad86('0x3d')][_0xad86('0x4a')]){_0x5747fa[_0xad86('0x4b')]=_[_0xad86('0x4c')](_0x5747fa[_0xad86('0x4b')],{'$or':_['map'](_0x5747fa['attributes'],function(_0x57a8fa){var _0x59764d={};_0x59764d[_0x57a8fa]={'$like':'%'+_0x10f2da[_0xad86('0x3d')][_0xad86('0x4a')]+'%'};return _0x59764d;})});}_0x5747fa=_['merge']({},_0x5747fa,_0x10f2da['options']);return _0x315220[_0xad86('0x5b')](_0x5747fa);}})[_0xad86('0x20')](function(_0x8913bd){if(_0x8913bd){_0x4384a8=_0x8913bd[_0xad86('0x42')];if(!_0x10f2da[_0xad86('0x3d')][_0xad86('0x59')](_0xad86('0x43'))){_0x5747fa[_0xad86('0x44')]=qs[_0xad86('0x44')](_0x10f2da['query'][_0xad86('0x44')]);_0x5747fa['offset']=qs[_0xad86('0x45')](_0x10f2da[_0xad86('0x3d')][_0xad86('0x45')]);}return _0x315220[_0xad86('0x5b')](_0x5747fa);}})[_0xad86('0x20')](function(_0xb2a93c){if(_0xb2a93c){return _0xb2a93c?{'count':_0x4384a8,'rows':_0xb2a93c}:null;}})['then'](respondWithResult(_0x455153,null))[_0xad86('0x2b')](handleError(_0x455153,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 3e6df13..7e3a7c1 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 _0x9c48=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3681a4,_0x255a2e){var _0x1b7836=function(_0x24d81f){while(--_0x24d81f){_0x3681a4['push'](_0x3681a4['shift']());}};_0x1b7836(++_0x255a2e);}(_0x9c48,0x19f));var _0x89c4=function(_0x149cb3,_0x5abc68){_0x149cb3=_0x149cb3-0x0;var _0x3153a8=_0x9c48[_0x149cb3];return _0x3153a8;};'use strict';var _=require(_0x89c4('0x0'));var util=require(_0x89c4('0x1'));var logger=require(_0x89c4('0x2'))('api');var moment=require(_0x89c4('0x3'));var BPromise=require(_0x89c4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x89c4('0x5'));var rimraf=require(_0x89c4('0x6'));var config=require(_0x89c4('0x7'));var attributes=require(_0x89c4('0x8'));module[_0x89c4('0x9')]=function(_0x5e5887,_0x3850f9){return _0x5e5887[_0x89c4('0xa')]('ZohoConfiguration',attributes,{'tableName':_0x89c4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32a7=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','ZohoConfiguration','int_zoho_configurations','util','../../config/logger'];(function(_0x33de1a,_0x476586){var _0x153678=function(_0x51951d){while(--_0x51951d){_0x33de1a['push'](_0x33de1a['shift']());}};_0x153678(++_0x476586);}(_0x32a7,0xae));var _0x732a=function(_0xa84425,_0x2442a2){_0xa84425=_0xa84425-0x0;var _0xfe4280=_0x32a7[_0xa84425];return _0xfe4280;};'use strict';var _=require('lodash');var util=require(_0x732a('0x0'));var logger=require(_0x732a('0x1'))(_0x732a('0x2'));var moment=require(_0x732a('0x3'));var BPromise=require(_0x732a('0x4'));var rp=require(_0x732a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x732a('0x6'));var config=require(_0x732a('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0x732a('0x8')]=function(_0x59eb28,_0x4bd2a5){return _0x59eb28['define'](_0x732a('0x9'),attributes,{'tableName':_0x732a('0xa'),'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 2224250..13b8782 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 _0x9b41=['info','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x50fda2,_0x2406c6){var _0x486572=function(_0x19a2ad){while(--_0x19a2ad){_0x50fda2['push'](_0x50fda2['shift']());}};_0x486572(++_0x2406c6);}(_0x9b41,0x14b));var _0x19b4=function(_0x13fd59,_0x2e05b1){_0x13fd59=_0x13fd59-0x0;var _0x2e6ce7=_0x9b41[_0x13fd59];return _0x2e6ce7;};'use strict';var _=require(_0x19b4('0x0'));var util=require(_0x19b4('0x1'));var moment=require(_0x19b4('0x2'));var BPromise=require(_0x19b4('0x3'));var rs=require(_0x19b4('0x4'));var fs=require('fs');var Redis=require(_0x19b4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x19b4('0x6'));var logger=require(_0x19b4('0x7'))(_0x19b4('0x8'));var config=require(_0x19b4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x19b4('0xa')][_0x19b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26e470,_0x1ab38f,_0x689f8b){return new BPromise(function(_0x48d93c,_0x4c477a){return client[_0x19b4('0xc')](_0x26e470,_0x689f8b)[_0x19b4('0xd')](function(_0x3495d5){logger[_0x19b4('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x1ab38f,'request\x20sent');logger['debug'](_0x19b4('0xf'),_0x1ab38f,_0x19b4('0x10'),JSON[_0x19b4('0x11')](_0x3495d5));if(_0x3495d5[_0x19b4('0x12')]){if(_0x3495d5[_0x19b4('0x12')][_0x19b4('0x13')]===0x1f4){logger[_0x19b4('0x12')](_0x19b4('0x14'),_0x1ab38f,_0x3495d5[_0x19b4('0x12')][_0x19b4('0x15')]);return _0x4c477a(_0x3495d5[_0x19b4('0x12')][_0x19b4('0x15')]);}logger[_0x19b4('0x12')](_0x19b4('0x14'),_0x1ab38f,_0x3495d5['error'][_0x19b4('0x15')]);return _0x48d93c(_0x3495d5[_0x19b4('0x12')][_0x19b4('0x15')]);}else{logger[_0x19b4('0xe')](_0x19b4('0x14'),_0x1ab38f,_0x19b4('0x10'));_0x48d93c(_0x3495d5['result'][_0x19b4('0x15')]);}})[_0x19b4('0x16')](function(_0x5195b5){logger[_0x19b4('0x12')](_0x19b4('0x14'),_0x1ab38f,_0x5195b5);_0x4c477a(_0x5195b5);});});} \ No newline at end of file +var _0x64c6=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x3e3819,_0x42e4ce){var _0x264a59=function(_0x3df1ef){while(--_0x3df1ef){_0x3e3819['push'](_0x3e3819['shift']());}};_0x264a59(++_0x42e4ce);}(_0x64c6,0x107));var _0x664c=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x64c6[_0x1fb1c1];return _0x1622df;};'use strict';var _=require(_0x664c('0x0'));var util=require(_0x664c('0x1'));var moment=require(_0x664c('0x2'));var BPromise=require(_0x664c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x664c('0x4'));var db=require(_0x664c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x664c('0x6'))(_0x664c('0x7'));var config=require(_0x664c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x664c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdd7c9f,_0xd8bfea,_0x511adc){return new BPromise(function(_0xea764b,_0x298a30){return client[_0x664c('0xa')](_0xdd7c9f,_0x511adc)[_0x664c('0xb')](function(_0x271df9){logger[_0x664c('0xc')](_0x664c('0xd'),_0xd8bfea,_0x664c('0xe'));logger[_0x664c('0xf')](_0x664c('0x10'),_0xd8bfea,'request\x20sent',JSON[_0x664c('0x11')](_0x271df9));if(_0x271df9['error']){if(_0x271df9['error'][_0x664c('0x12')]===0x1f4){logger[_0x664c('0x13')](_0x664c('0xd'),_0xd8bfea,_0x271df9[_0x664c('0x13')][_0x664c('0x14')]);return _0x298a30(_0x271df9[_0x664c('0x13')][_0x664c('0x14')]);}logger[_0x664c('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0xd8bfea,_0x271df9['error']['message']);return _0xea764b(_0x271df9[_0x664c('0x13')]['message']);}else{logger[_0x664c('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0xd8bfea,_0x664c('0xe'));_0xea764b(_0x271df9[_0x664c('0x15')][_0x664c('0x14')]);}})[_0x664c('0x16')](function(_0x5e6a52){logger[_0x664c('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0xd8bfea,_0x5e6a52);_0x298a30(_0x5e6a52);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 690aa4b..5b451fe 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 _0x85d3=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','put','delete'];(function(_0x3f7e52,_0x3c422e){var _0x3f849f=function(_0xf96ee0){while(--_0xf96ee0){_0x3f7e52['push'](_0x3f7e52['shift']());}};_0x3f849f(++_0x3c422e);}(_0x85d3,0xc8));var _0x385d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x85d3[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x385d('0x0'));var util=require(_0x385d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x385d('0x2'));var router=express[_0x385d('0x3')]();var fs_extra=require(_0x385d('0x4'));var auth=require(_0x385d('0x5'));var interaction=require(_0x385d('0x6'));var config=require(_0x385d('0x7'));var controller=require('./intZohoField.controller');router[_0x385d('0x8')]('/',auth['isAuthenticated'](),controller[_0x385d('0x9')]);router[_0x385d('0x8')](_0x385d('0xa'),auth[_0x385d('0xb')](),controller['show']);router[_0x385d('0xc')]('/',auth[_0x385d('0xb')](),controller[_0x385d('0xd')]);router[_0x385d('0xe')](_0x385d('0xa'),auth[_0x385d('0xb')](),controller['update']);router[_0x385d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x385d('0x10')]);module[_0x385d('0x11')]=router; \ No newline at end of file +var _0x3d45=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x1d0499,_0x23e22f){var _0x153fb3=function(_0x40c19c){while(--_0x40c19c){_0x1d0499['push'](_0x1d0499['shift']());}};_0x153fb3(++_0x23e22f);}(_0x3d45,0x1d2));var _0x53d4=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x3d45[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x53d4('0x0'));var util=require(_0x53d4('0x1'));var path=require(_0x53d4('0x2'));var timeout=require(_0x53d4('0x3'));var express=require(_0x53d4('0x4'));var router=express['Router']();var fs_extra=require(_0x53d4('0x5'));var auth=require(_0x53d4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x53d4('0x7'));var controller=require('./intZohoField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x53d4('0x8')](_0x53d4('0x9'),auth[_0x53d4('0xa')](),controller[_0x53d4('0xb')]);router[_0x53d4('0xc')]('/',auth['isAuthenticated'](),controller[_0x53d4('0xd')]);router[_0x53d4('0xe')](_0x53d4('0x9'),auth['isAuthenticated'](),controller[_0x53d4('0xf')]);router['delete'](_0x53d4('0x9'),auth[_0x53d4('0xa')](),controller[_0x53d4('0x10')]);module[_0x53d4('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 cfdd4bd..a4da618 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 _0xcb81=['string','picklist','STRING','ENUM','variable','customVariable','BOOLEAN','sequelize','exports'];(function(_0x164f31,_0x369e5a){var _0x59914c=function(_0x304aaa){while(--_0x304aaa){_0x164f31['push'](_0x164f31['shift']());}};_0x59914c(++_0x369e5a);}(_0xcb81,0x154));var _0x1cb8=function(_0x5d88c0,_0x5d7d83){_0x5d88c0=_0x5d88c0-0x0;var _0x1b40f0=_0xcb81[_0x5d88c0];return _0x1b40f0;};'use strict';var Sequelize=require(_0x1cb8('0x0'));module[_0x1cb8('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1cb8('0x2'),'variable','customVariable','keyValue',_0x1cb8('0x3')),'defaultValue':_0x1cb8('0x2')},'content':{'type':Sequelize[_0x1cb8('0x4')]},'key':{'type':Sequelize[_0x1cb8('0x4')]},'keyType':{'type':Sequelize[_0x1cb8('0x5')]('string',_0x1cb8('0x6'),_0x1cb8('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1cb8('0x4')]},'nameField':{'type':Sequelize[_0x1cb8('0x4')]},'customField':{'type':Sequelize[_0x1cb8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6b19=['customVariable','sequelize','exports','string','keyValue','picklist','STRING'];(function(_0x218ced,_0x323582){var _0x2b9d20=function(_0x5700ec){while(--_0x5700ec){_0x218ced['push'](_0x218ced['shift']());}};_0x2b9d20(++_0x323582);}(_0x6b19,0xe8));var _0x96b1=function(_0x430997,_0x1b7ef5){_0x430997=_0x430997-0x0;var _0x4876d2=_0x6b19[_0x430997];return _0x4876d2;};'use strict';var Sequelize=require(_0x96b1('0x0'));module[_0x96b1('0x1')]={'type':{'type':Sequelize['ENUM'](_0x96b1('0x2'),'variable','customVariable',_0x96b1('0x3'),_0x96b1('0x4')),'defaultValue':_0x96b1('0x2')},'content':{'type':Sequelize[_0x96b1('0x5')]},'key':{'type':Sequelize[_0x96b1('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x96b1('0x2'),'variable',_0x96b1('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x96b1('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x96b1('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 39f3783..bbd07bd 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 _0x4605=['limit','set','reject','save','then','destroy','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','html-pdf','rimraf','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x5647c9,_0xf4e8b0){var _0x5e58ef=function(_0x2ab3e4){while(--_0x2ab3e4){_0x5647c9['push'](_0x5647c9['shift']());}};_0x5e58ef(++_0xf4e8b0);}(_0x4605,0xba));var _0x5460=function(_0x55e62b,_0x4f34ac){_0x55e62b=_0x55e62b-0x0;var _0xa7162f=_0x4605[_0x55e62b];return _0xa7162f;};'use strict';var pdf=require(_0x5460('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5460('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5460('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5460('0x3'));var Mustache=require(_0x5460('0x4'));var util=require(_0x5460('0x5'));var path=require(_0x5460('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5460('0x7'));var fs=require('fs');var fs_extra=require(_0x5460('0x8'));var _=require(_0x5460('0x9'));var squel=require(_0x5460('0xa'));var crypto=require(_0x5460('0xb'));var jsforce=require(_0x5460('0xc'));var deskjs=require(_0x5460('0xd'));var toCsv=require(_0x5460('0xe'));var querystring=require(_0x5460('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5460('0x10'));var qs=require(_0x5460('0x11'));var as=require(_0x5460('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5460('0x13'))(_0x5460('0x14'));var utils=require('../../config/utils');var config=require(_0x5460('0x15'));var licenseUtil=require(_0x5460('0x16'));var db=require(_0x5460('0x17'))['db'];function respondWithStatusCode(_0x3317cf,_0x1b3142){_0x1b3142=_0x1b3142||0xcc;return function(_0x2ba6d9){if(_0x2ba6d9){return _0x3317cf[_0x5460('0x18')](_0x1b3142);}return _0x3317cf[_0x5460('0x19')](_0x1b3142)[_0x5460('0x1a')]();};}function respondWithResult(_0x4e3ee6,_0x47e0ed){_0x47e0ed=_0x47e0ed||0xc8;return function(_0x34d909){if(_0x34d909){return _0x4e3ee6[_0x5460('0x19')](_0x47e0ed)[_0x5460('0x1b')](_0x34d909);}};}function respondWithFilteredResult(_0xcfc41d,_0x1d6692){return function(_0x139029){if(_0x139029){var _0x503139=_0x139029[_0x5460('0x1c')],_0x338b80=_0x1d6692[_0x5460('0x1d')],_0x1f613f=_0x1d6692[_0x5460('0x1d')]+_0x1d6692[_0x5460('0x1e')],_0x4e25ac;if(_0x1f613f>=_0x503139){_0x1f613f=_0x503139;_0x4e25ac=0xc8;}else{_0x4e25ac=0xce;}_0xcfc41d[_0x5460('0x19')](_0x4e25ac);return _0xcfc41d[_0x5460('0x1f')]('Content-Range',_0x338b80+'-'+_0x1f613f+'/'+_0x503139)['json'](_0x139029);}return null;};}function patchUpdates(_0x597745){return function(_0x53da5a){try{jsonpatch['apply'](_0x53da5a,_0x597745,!![]);}catch(_0xf4853f){return BPromise[_0x5460('0x20')](_0xf4853f);}return _0x53da5a[_0x5460('0x21')]();};}function saveUpdates(_0x3d9d46,_0x8b13ec){return function(_0x59729f){if(_0x59729f){return _0x59729f['update'](_0x3d9d46)[_0x5460('0x22')](function(_0x5be19a){return _0x5be19a;});}return null;};}function removeEntity(_0x52b4a8,_0x27882f){return function(_0x2f2683){if(_0x2f2683){return _0x2f2683[_0x5460('0x23')]()[_0x5460('0x22')](function(){_0x52b4a8['status'](0xcc)[_0x5460('0x1a')]();});}};}function handleEntityNotFound(_0x2cc430,_0x435e47){return function(_0x54d681){if(!_0x54d681){_0x2cc430[_0x5460('0x18')](0x194);}return _0x54d681;};}function handleError(_0x4b1eac,_0x3c5e6c){_0x3c5e6c=_0x3c5e6c||0x1f4;return function(_0x26f45a){logger['error'](_0x26f45a['stack']);if(_0x26f45a[_0x5460('0x24')]){delete _0x26f45a[_0x5460('0x24')];}_0x4b1eac['status'](_0x3c5e6c)[_0x5460('0x25')](_0x26f45a);};}exports[_0x5460('0x26')]=function(_0xd40cb7,_0x450899){var _0x3fb2bb={},_0x2a770c={},_0x4a297e={'count':0x0,'rows':[]};var _0x6a9fd1=_[_0x5460('0x27')](db[_0x5460('0x28')][_0x5460('0x29')],function(_0x3b1348){return{'name':_0x3b1348[_0x5460('0x2a')],'type':_0x3b1348[_0x5460('0x2b')][_0x5460('0x2c')]};});_0x2a770c[_0x5460('0x2d')]=_['map'](_0x6a9fd1,'name');_0x2a770c[_0x5460('0x2e')]=_['keys'](_0xd40cb7[_0x5460('0x2e')]);_0x2a770c['filters']=_[_0x5460('0x2f')](_0x2a770c['model'],_0x2a770c[_0x5460('0x2e')]);_0x3fb2bb[_0x5460('0x30')]=_[_0x5460('0x2f')](_0x2a770c[_0x5460('0x2d')],qs[_0x5460('0x31')](_0xd40cb7[_0x5460('0x2e')][_0x5460('0x31')]));_0x3fb2bb[_0x5460('0x30')]=_0x3fb2bb[_0x5460('0x30')][_0x5460('0x32')]?_0x3fb2bb[_0x5460('0x30')]:_0x2a770c[_0x5460('0x2d')];if(!_0xd40cb7[_0x5460('0x2e')]['hasOwnProperty'](_0x5460('0x33'))){_0x3fb2bb[_0x5460('0x1e')]=qs[_0x5460('0x1e')](_0xd40cb7['query'][_0x5460('0x1e')]);_0x3fb2bb[_0x5460('0x1d')]=qs[_0x5460('0x1d')](_0xd40cb7[_0x5460('0x2e')][_0x5460('0x1d')]);}_0x3fb2bb[_0x5460('0x34')]=qs[_0x5460('0x35')](_0xd40cb7[_0x5460('0x2e')][_0x5460('0x35')]);_0x3fb2bb[_0x5460('0x36')]=qs[_0x5460('0x37')](_[_0x5460('0x38')](_0xd40cb7[_0x5460('0x2e')],_0x2a770c[_0x5460('0x37')]),_0x6a9fd1);if(_0xd40cb7['query'][_0x5460('0x39')]){_0x3fb2bb[_0x5460('0x36')]=_[_0x5460('0x3a')](_0x3fb2bb[_0x5460('0x36')],{'$or':_[_0x5460('0x27')](_0x6a9fd1,function(_0x3c2d04){if(_0x3c2d04['type']!=='VIRTUAL'){var _0x4a7b0d={};_0x4a7b0d[_0x3c2d04[_0x5460('0x24')]]={'$like':'%'+_0xd40cb7[_0x5460('0x2e')][_0x5460('0x39')]+'%'};return _0x4a7b0d;}})});}_0x3fb2bb=_[_0x5460('0x3a')]({},_0x3fb2bb,_0xd40cb7[_0x5460('0x3b')]);var _0x2b838c={'where':_0x3fb2bb[_0x5460('0x36')]};return db[_0x5460('0x28')][_0x5460('0x1c')](_0x2b838c)['then'](function(_0x59bed4){_0x4a297e[_0x5460('0x1c')]=_0x59bed4;if(_0xd40cb7['query'][_0x5460('0x3c')]){_0x3fb2bb[_0x5460('0x3d')]=[{'all':!![]}];}return db[_0x5460('0x28')][_0x5460('0x3e')](_0x3fb2bb);})[_0x5460('0x22')](function(_0x50e154){_0x4a297e[_0x5460('0x3f')]=_0x50e154;return _0x4a297e;})[_0x5460('0x22')](respondWithFilteredResult(_0x450899,_0x3fb2bb))[_0x5460('0x40')](handleError(_0x450899,null));};exports[_0x5460('0x41')]=function(_0x3e8b52,_0x159c51){var _0x45be9e={'raw':!![],'where':{'id':_0x3e8b52[_0x5460('0x42')]['id']}},_0x3717a4={};_0x3717a4[_0x5460('0x2d')]=_[_0x5460('0x43')](db['ZohoField']['rawAttributes']);_0x3717a4['query']=_[_0x5460('0x43')](_0x3e8b52['query']);_0x3717a4[_0x5460('0x37')]=_[_0x5460('0x2f')](_0x3717a4[_0x5460('0x2d')],_0x3717a4[_0x5460('0x2e')]);_0x45be9e[_0x5460('0x30')]=_['intersection'](_0x3717a4[_0x5460('0x2d')],qs[_0x5460('0x31')](_0x3e8b52['query'][_0x5460('0x31')]));_0x45be9e[_0x5460('0x30')]=_0x45be9e[_0x5460('0x30')][_0x5460('0x32')]?_0x45be9e[_0x5460('0x30')]:_0x3717a4[_0x5460('0x2d')];if(_0x3e8b52[_0x5460('0x2e')][_0x5460('0x3c')]){_0x45be9e[_0x5460('0x3d')]=[{'all':!![]}];}_0x45be9e=_[_0x5460('0x3a')]({},_0x45be9e,_0x3e8b52[_0x5460('0x3b')]);return db[_0x5460('0x28')][_0x5460('0x44')](_0x45be9e)[_0x5460('0x22')](handleEntityNotFound(_0x159c51,null))[_0x5460('0x22')](respondWithResult(_0x159c51,null))['catch'](handleError(_0x159c51,null));};exports[_0x5460('0x45')]=function(_0x28336f,_0x53d6fe){return db['ZohoField'][_0x5460('0x45')](_0x28336f[_0x5460('0x46')],{})[_0x5460('0x22')](respondWithResult(_0x53d6fe,0xc9))[_0x5460('0x40')](handleError(_0x53d6fe,null));};exports[_0x5460('0x47')]=function(_0x21d026,_0x4bc8d9){if(_0x21d026[_0x5460('0x46')]['id']){delete _0x21d026['body']['id'];}return db[_0x5460('0x28')]['find']({'where':{'id':_0x21d026['params']['id']}})['then'](handleEntityNotFound(_0x4bc8d9,null))[_0x5460('0x22')](saveUpdates(_0x21d026[_0x5460('0x46')],null))[_0x5460('0x22')](respondWithResult(_0x4bc8d9,null))[_0x5460('0x40')](handleError(_0x4bc8d9,null));};exports[_0x5460('0x23')]=function(_0x3424ae,_0x322b65){return db['ZohoField'][_0x5460('0x44')]({'where':{'id':_0x3424ae['params']['id']}})[_0x5460('0x22')](handleEntityNotFound(_0x322b65,null))[_0x5460('0x22')](removeEntity(_0x322b65,null))[_0x5460('0x40')](handleError(_0x322b65,null));}; \ No newline at end of file +var _0x3fe2=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','ZohoField','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','catch','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x2bf967,_0x37ceb7){var _0x2fcb4b=function(_0xd0c4f7){while(--_0xd0c4f7){_0x2bf967['push'](_0x2bf967['shift']());}};_0x2fcb4b(++_0x37ceb7);}(_0x3fe2,0x187));var _0x23fe=function(_0xd64ab1,_0x57fb54){_0xd64ab1=_0xd64ab1-0x0;var _0x410677=_0x3fe2[_0xd64ab1];return _0x410677;};'use strict';var pdf=require(_0x23fe('0x0'));var emlformat=require(_0x23fe('0x1'));var rimraf=require(_0x23fe('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23fe('0x3'));var rp=require('request-promise');var moment=require(_0x23fe('0x4'));var BPromise=require(_0x23fe('0x5'));var Mustache=require(_0x23fe('0x6'));var util=require(_0x23fe('0x7'));var path=require(_0x23fe('0x8'));var sox=require(_0x23fe('0x9'));var csv=require(_0x23fe('0xa'));var ejs=require(_0x23fe('0xb'));var fs=require('fs');var fs_extra=require(_0x23fe('0xc'));var _=require(_0x23fe('0xd'));var squel=require(_0x23fe('0xe'));var crypto=require('crypto');var jsforce=require(_0x23fe('0xf'));var deskjs=require(_0x23fe('0x10'));var toCsv=require(_0x23fe('0xa'));var querystring=require(_0x23fe('0x11'));var Papa=require(_0x23fe('0x12'));var Redis=require(_0x23fe('0x13'));var authService=require(_0x23fe('0x14'));var qs=require(_0x23fe('0x15'));var as=require(_0x23fe('0x16'));var hardwareService=require(_0x23fe('0x17'));var logger=require(_0x23fe('0x18'))(_0x23fe('0x19'));var utils=require(_0x23fe('0x1a'));var config=require(_0x23fe('0x1b'));var licenseUtil=require(_0x23fe('0x1c'));var db=require(_0x23fe('0x1d'))['db'];function respondWithStatusCode(_0x396485,_0x5e77a4){_0x5e77a4=_0x5e77a4||0xcc;return function(_0x157805){if(_0x157805){return _0x396485[_0x23fe('0x1e')](_0x5e77a4);}return _0x396485[_0x23fe('0x1f')](_0x5e77a4)[_0x23fe('0x20')]();};}function respondWithResult(_0x5d875a,_0x3ea559){_0x3ea559=_0x3ea559||0xc8;return function(_0x3d8247){if(_0x3d8247){return _0x5d875a[_0x23fe('0x1f')](_0x3ea559)[_0x23fe('0x21')](_0x3d8247);}};}function respondWithFilteredResult(_0x4ceac0,_0x59176d){return function(_0x44f4f1){if(_0x44f4f1){var _0x3f0eb6=_0x44f4f1[_0x23fe('0x22')],_0x51b02b=_0x59176d[_0x23fe('0x23')],_0x59d1ef=_0x59176d[_0x23fe('0x23')]+_0x59176d[_0x23fe('0x24')],_0x5e324c;if(_0x59d1ef>=_0x3f0eb6){_0x59d1ef=_0x3f0eb6;_0x5e324c=0xc8;}else{_0x5e324c=0xce;}_0x4ceac0[_0x23fe('0x1f')](_0x5e324c);return _0x4ceac0[_0x23fe('0x25')]('Content-Range',_0x51b02b+'-'+_0x59d1ef+'/'+_0x3f0eb6)['json'](_0x44f4f1);}return null;};}function patchUpdates(_0x104a0f){return function(_0x3b1bbb){try{jsonpatch[_0x23fe('0x26')](_0x3b1bbb,_0x104a0f,!![]);}catch(_0x1a5b8c){return BPromise['reject'](_0x1a5b8c);}return _0x3b1bbb[_0x23fe('0x27')]();};}function saveUpdates(_0x152733,_0x4bfb6a){return function(_0x44ccd3){if(_0x44ccd3){return _0x44ccd3[_0x23fe('0x28')](_0x152733)[_0x23fe('0x29')](function(_0x4f013){return _0x4f013;});}return null;};}function removeEntity(_0x1959a3,_0x5ecb50){return function(_0x1bf867){if(_0x1bf867){return _0x1bf867[_0x23fe('0x2a')]()[_0x23fe('0x29')](function(){_0x1959a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e38f8,_0x337d51){return function(_0x34858d){if(!_0x34858d){_0x2e38f8['sendStatus'](0x194);}return _0x34858d;};}function handleError(_0x2b109f,_0x3e7206){_0x3e7206=_0x3e7206||0x1f4;return function(_0x192cc5){logger[_0x23fe('0x2b')](_0x192cc5[_0x23fe('0x2c')]);if(_0x192cc5[_0x23fe('0x2d')]){delete _0x192cc5['name'];}_0x2b109f['status'](_0x3e7206)[_0x23fe('0x2e')](_0x192cc5);};}exports['index']=function(_0x11db57,_0x6e10b3){var _0x2b1464={},_0x4c7366={},_0x39c7f9={'count':0x0,'rows':[]};var _0x21d8b2=_['map'](db[_0x23fe('0x2f')][_0x23fe('0x30')],function(_0x428b52){return{'name':_0x428b52[_0x23fe('0x31')],'type':_0x428b52[_0x23fe('0x32')][_0x23fe('0x33')]};});_0x4c7366[_0x23fe('0x34')]=_[_0x23fe('0x35')](_0x21d8b2,_0x23fe('0x2d'));_0x4c7366[_0x23fe('0x36')]=_[_0x23fe('0x37')](_0x11db57[_0x23fe('0x36')]);_0x4c7366['filters']=_[_0x23fe('0x38')](_0x4c7366[_0x23fe('0x34')],_0x4c7366['query']);_0x2b1464[_0x23fe('0x39')]=_[_0x23fe('0x38')](_0x4c7366['model'],qs[_0x23fe('0x3a')](_0x11db57[_0x23fe('0x36')][_0x23fe('0x3a')]));_0x2b1464[_0x23fe('0x39')]=_0x2b1464[_0x23fe('0x39')][_0x23fe('0x3b')]?_0x2b1464[_0x23fe('0x39')]:_0x4c7366['model'];if(!_0x11db57[_0x23fe('0x36')][_0x23fe('0x3c')](_0x23fe('0x3d'))){_0x2b1464[_0x23fe('0x24')]=qs[_0x23fe('0x24')](_0x11db57[_0x23fe('0x36')]['limit']);_0x2b1464['offset']=qs['offset'](_0x11db57['query'][_0x23fe('0x23')]);}_0x2b1464['order']=qs[_0x23fe('0x3e')](_0x11db57[_0x23fe('0x36')][_0x23fe('0x3e')]);_0x2b1464[_0x23fe('0x3f')]=qs[_0x23fe('0x40')](_['pick'](_0x11db57[_0x23fe('0x36')],_0x4c7366[_0x23fe('0x40')]),_0x21d8b2);if(_0x11db57[_0x23fe('0x36')][_0x23fe('0x41')]){_0x2b1464[_0x23fe('0x3f')]=_[_0x23fe('0x42')](_0x2b1464[_0x23fe('0x3f')],{'$or':_[_0x23fe('0x35')](_0x21d8b2,function(_0x3cb3d5){if(_0x3cb3d5[_0x23fe('0x32')]!==_0x23fe('0x43')){var _0x75bb3e={};_0x75bb3e[_0x3cb3d5[_0x23fe('0x2d')]]={'$like':'%'+_0x11db57['query'][_0x23fe('0x41')]+'%'};return _0x75bb3e;}})});}_0x2b1464=_[_0x23fe('0x42')]({},_0x2b1464,_0x11db57[_0x23fe('0x44')]);var _0x318469={'where':_0x2b1464[_0x23fe('0x3f')]};return db[_0x23fe('0x2f')][_0x23fe('0x22')](_0x318469)[_0x23fe('0x29')](function(_0x5dd65d){_0x39c7f9[_0x23fe('0x22')]=_0x5dd65d;if(_0x11db57['query'][_0x23fe('0x45')]){_0x2b1464['include']=[{'all':!![]}];}return db[_0x23fe('0x2f')][_0x23fe('0x46')](_0x2b1464);})[_0x23fe('0x29')](function(_0x5624ba){_0x39c7f9[_0x23fe('0x47')]=_0x5624ba;return _0x39c7f9;})[_0x23fe('0x29')](respondWithFilteredResult(_0x6e10b3,_0x2b1464))['catch'](handleError(_0x6e10b3,null));};exports[_0x23fe('0x48')]=function(_0x58e637,_0x35af29){var _0x3a1955={'raw':!![],'where':{'id':_0x58e637[_0x23fe('0x49')]['id']}},_0x289d64={};_0x289d64[_0x23fe('0x34')]=_['keys'](db[_0x23fe('0x2f')][_0x23fe('0x30')]);_0x289d64[_0x23fe('0x36')]=_['keys'](_0x58e637[_0x23fe('0x36')]);_0x289d64[_0x23fe('0x40')]=_[_0x23fe('0x38')](_0x289d64['model'],_0x289d64[_0x23fe('0x36')]);_0x3a1955[_0x23fe('0x39')]=_['intersection'](_0x289d64[_0x23fe('0x34')],qs['fields'](_0x58e637[_0x23fe('0x36')]['fields']));_0x3a1955[_0x23fe('0x39')]=_0x3a1955[_0x23fe('0x39')][_0x23fe('0x3b')]?_0x3a1955[_0x23fe('0x39')]:_0x289d64[_0x23fe('0x34')];if(_0x58e637[_0x23fe('0x36')][_0x23fe('0x45')]){_0x3a1955[_0x23fe('0x4a')]=[{'all':!![]}];}_0x3a1955=_['merge']({},_0x3a1955,_0x58e637[_0x23fe('0x44')]);return db[_0x23fe('0x2f')]['find'](_0x3a1955)['then'](handleEntityNotFound(_0x35af29,null))['then'](respondWithResult(_0x35af29,null))[_0x23fe('0x4b')](handleError(_0x35af29,null));};exports[_0x23fe('0x4c')]=function(_0x4d0344,_0x1c82b9){return db[_0x23fe('0x2f')][_0x23fe('0x4c')](_0x4d0344[_0x23fe('0x4d')],{})[_0x23fe('0x29')](respondWithResult(_0x1c82b9,0xc9))[_0x23fe('0x4b')](handleError(_0x1c82b9,null));};exports[_0x23fe('0x28')]=function(_0x545e39,_0x55eef8){if(_0x545e39[_0x23fe('0x4d')]['id']){delete _0x545e39['body']['id'];}return db[_0x23fe('0x2f')][_0x23fe('0x4e')]({'where':{'id':_0x545e39[_0x23fe('0x49')]['id']}})[_0x23fe('0x29')](handleEntityNotFound(_0x55eef8,null))[_0x23fe('0x29')](saveUpdates(_0x545e39[_0x23fe('0x4d')],null))['then'](respondWithResult(_0x55eef8,null))['catch'](handleError(_0x55eef8,null));};exports[_0x23fe('0x2a')]=function(_0x18568f,_0x3f2b46){return db[_0x23fe('0x2f')][_0x23fe('0x4e')]({'where':{'id':_0x18568f[_0x23fe('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f2b46,null))[_0x23fe('0x29')](removeEntity(_0x3f2b46,null))['catch'](handleError(_0x3f2b46,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 97c6ec2..38bf178 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 _0xad0c=['rimraf','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2c2439,_0x325167){var _0x2db2ef=function(_0x2bfc54){while(--_0x2bfc54){_0x2c2439['push'](_0x2c2439['shift']());}};_0x2db2ef(++_0x325167);}(_0xad0c,0xa9));var _0xcad0=function(_0x26a65d,_0x3687ee){_0x26a65d=_0x26a65d-0x0;var _0x14558e=_0xad0c[_0x26a65d];return _0x14558e;};'use strict';var _=require(_0xcad0('0x0'));var util=require(_0xcad0('0x1'));var logger=require(_0xcad0('0x2'))(_0xcad0('0x3'));var moment=require(_0xcad0('0x4'));var BPromise=require(_0xcad0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcad0('0x6'));var rimraf=require(_0xcad0('0x7'));var config=require(_0xcad0('0x8'));var attributes=require('./intZohoField.attributes');module[_0xcad0('0x9')]=function(_0x29ac58,_0xdd5434){return _0x29ac58[_0xcad0('0xa')](_0xcad0('0xb'),attributes,{'tableName':_0xcad0('0xc'),'paranoid':![],'indexes':[{'name':_0xcad0('0xd'),'fields':[_0xcad0('0xe'),_0xcad0('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4891=['path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x34a6e1,_0xa89e5f){var _0x423776=function(_0x173bf9){while(--_0x173bf9){_0x34a6e1['push'](_0x34a6e1['shift']());}};_0x423776(++_0xa89e5f);}(_0x4891,0x81));var _0x1489=function(_0x37f078,_0x52c2f4){_0x37f078=_0x37f078-0x0;var _0x1e4a5d=_0x4891[_0x37f078];return _0x1e4a5d;};'use strict';var _=require(_0x1489('0x0'));var util=require(_0x1489('0x1'));var logger=require(_0x1489('0x2'))(_0x1489('0x3'));var moment=require('moment');var BPromise=require(_0x1489('0x4'));var rp=require(_0x1489('0x5'));var fs=require('fs');var path=require(_0x1489('0x6'));var rimraf=require(_0x1489('0x7'));var config=require(_0x1489('0x8'));var attributes=require(_0x1489('0x9'));module[_0x1489('0xa')]=function(_0x5a8340,_0x229b5c){return _0x5a8340[_0x1489('0xb')]('ZohoField',attributes,{'tableName':_0x1489('0xc'),'paranoid':![],'indexes':[{'name':_0x1489('0xd'),'fields':['idField',_0x1489('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 4ef66e8..31e9258 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 _0xeec6=['then','info','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5b64a1,_0x2ec810){var _0x4b6f55=function(_0x44dd84){while(--_0x44dd84){_0x5b64a1['push'](_0x5b64a1['shift']());}};_0x4b6f55(++_0x2ec810);}(_0xeec6,0x1c2));var _0x6eec=function(_0x485abd,_0x32c7c1){_0x485abd=_0x485abd-0x0;var _0x3379f1=_0xeec6[_0x485abd];return _0x3379f1;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('ZohoField,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});} \ No newline at end of file +var _0xe5b3=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZohoField,\x20%s,\x20%s'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4164ab,_0x46b3be){_0x4164ab=_0x4164ab-0x0;var _0x4f7810=_0xe5b3[_0x4164ab];return _0x4f7810;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('ZohoField,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('ZohoField,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index bbe3d2d..9568058 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 _0xf6ed=['multer','path','connect-timeout','express','../../components/auth/service','exports'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x16d367,_0x58c247){_0x16d367=_0x16d367-0x0;var _0x1d4831=_0xf6ed[_0x16d367];return _0x1d4831;};'use strict';var multer=require(_0xdf6e('0x0'));var util=require('util');var path=require(_0xdf6e('0x1'));var timeout=require(_0xdf6e('0x2'));var express=require(_0xdf6e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdf6e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xdf6e('0x5')]=router; \ No newline at end of file +var _0x220b=['connect-timeout','express','fs-extra','../../components/interaction/service','exports','util','path'];(function(_0x222237,_0x504f46){var _0x4639f4=function(_0x3df492){while(--_0x3df492){_0x222237['push'](_0x222237['shift']());}};_0x4639f4(++_0x504f46);}(_0x220b,0x1a2));var _0xb220=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x220b[_0x2f87cd];return _0x5d7eda;};'use strict';var multer=require('multer');var util=require(_0xb220('0x0'));var path=require(_0xb220('0x1'));var timeout=require(_0xb220('0x2'));var express=require(_0xb220('0x3'));var router=express['Router']();var fs_extra=require(_0xb220('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb220('0x5'));var config=require('../../config/environment');module[_0xb220('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 0e65f7e..50dc6fe 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 _0x2fe7=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','state'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x2fe7,0xaf));var _0x72fe=function(_0x454080,_0x166990){_0x454080=_0x454080-0x0;var _0x17f3d3=_0x2fe7[_0x454080];return _0x17f3d3;};'use strict';var Sequelize=require(_0x72fe('0x0'));module[_0x72fe('0x1')]={'name':{'type':Sequelize[_0x72fe('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x72fe('0x2')],'allowNull':![],'unique':_0x72fe('0x3')},'main':{'type':Sequelize[_0x72fe('0x2')],'defaultValue':_0x72fe('0x4')},'filename':{'type':Sequelize[_0x72fe('0x2')]},'path':{'type':Sequelize[_0x72fe('0x2')]},'type':{'type':Sequelize[_0x72fe('0x2')]},'size':{'type':Sequelize[_0x72fe('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x72fe('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x72fe('0x6')},'description':{'type':Sequelize[_0x72fe('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x72fe('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x8a66=['STRING','unique_name_and_version','app.js','INTEGER','state','exports'];(function(_0x2a66cf,_0x1f3527){var _0x4d9d6f=function(_0x41b664){while(--_0x41b664){_0x2a66cf['push'](_0x2a66cf['shift']());}};_0x4d9d6f(++_0x1f3527);}(_0x8a66,0x17f));var _0x68a6=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x8a66[_0x24f31b];return _0x488401;};'use strict';var Sequelize=require('sequelize');module[_0x68a6('0x0')]={'name':{'type':Sequelize[_0x68a6('0x1')],'allowNull':![],'unique':_0x68a6('0x2')},'version':{'type':Sequelize[_0x68a6('0x1')],'allowNull':![],'unique':_0x68a6('0x2')},'main':{'type':Sequelize[_0x68a6('0x1')],'defaultValue':_0x68a6('0x3')},'filename':{'type':Sequelize[_0x68a6('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x68a6('0x1')]},'size':{'type':Sequelize[_0x68a6('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x68a6('0x1')]},'logo':{'type':Sequelize[_0x68a6('0x1')]},'state':{'type':Sequelize[_0x68a6('0x1')],'unique':_0x68a6('0x5')},'description':{'type':Sequelize[_0x68a6('0x1')]},'title':{'type':Sequelize[_0x68a6('0x1')]},'remoteUri':{'type':Sequelize[_0x68a6('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 55b86b4..fee37ee 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 _0x3e3c=['apply','reject','update','then','end','error','stack','name','send','index','map','Integration','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','options','include','rows','catch','show','rawAttributes','includeAll','find','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','Content-Range','json'];(function(_0x55e168,_0x2fe2f8){var _0x59c0c2=function(_0x469f16){while(--_0x469f16){_0x55e168['push'](_0x55e168['shift']());}};_0x59c0c2(++_0x2fe2f8);}(_0x3e3c,0xb9));var _0xc3e3=function(_0xc612c5,_0x49b75e){_0xc612c5=_0xc612c5-0x0;var _0x520fee=_0x3e3c[_0xc612c5];return _0x520fee;};'use strict';var pdf=require(_0xc3e3('0x0'));var emlformat=require(_0xc3e3('0x1'));var rimraf=require(_0xc3e3('0x2'));var zipdir=require(_0xc3e3('0x3'));var jsonpatch=require(_0xc3e3('0x4'));var rp=require(_0xc3e3('0x5'));var moment=require('moment');var BPromise=require(_0xc3e3('0x6'));var Mustache=require(_0xc3e3('0x7'));var util=require(_0xc3e3('0x8'));var path=require(_0xc3e3('0x9'));var sox=require(_0xc3e3('0xa'));var csv=require(_0xc3e3('0xb'));var ejs=require(_0xc3e3('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc3e3('0xd'));var crypto=require(_0xc3e3('0xe'));var jsforce=require(_0xc3e3('0xf'));var deskjs=require(_0xc3e3('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc3e3('0x11'));var Papa=require('papaparse');var Redis=require(_0xc3e3('0x12'));var authService=require(_0xc3e3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc3e3('0x14'));var hardwareService=require(_0xc3e3('0x15'));var logger=require('../../config/logger')(_0xc3e3('0x16'));var utils=require('../../config/utils');var config=require(_0xc3e3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3e3('0x18'))['db'];function respondWithStatusCode(_0x3992b5,_0x499743){_0x499743=_0x499743||0xcc;return function(_0x1b6a21){if(_0x1b6a21){return _0x3992b5[_0xc3e3('0x19')](_0x499743);}return _0x3992b5[_0xc3e3('0x1a')](_0x499743)['end']();};}function respondWithResult(_0x185fda,_0x34a739){_0x34a739=_0x34a739||0xc8;return function(_0x8d0217){if(_0x8d0217){return _0x185fda['status'](_0x34a739)['json'](_0x8d0217);}};}function respondWithFilteredResult(_0x113c34,_0x5a22d7){return function(_0x8cf5e3){if(_0x8cf5e3){var _0x2d306e=_0x8cf5e3[_0xc3e3('0x1b')],_0x3a68c2=_0x5a22d7[_0xc3e3('0x1c')],_0x259379=_0x5a22d7[_0xc3e3('0x1c')]+_0x5a22d7['limit'],_0xa6654f;if(_0x259379>=_0x2d306e){_0x259379=_0x2d306e;_0xa6654f=0xc8;}else{_0xa6654f=0xce;}_0x113c34[_0xc3e3('0x1a')](_0xa6654f);return _0x113c34['set'](_0xc3e3('0x1d'),_0x3a68c2+'-'+_0x259379+'/'+_0x2d306e)[_0xc3e3('0x1e')](_0x8cf5e3);}return null;};}function patchUpdates(_0x1e9d82){return function(_0x467ba3){try{jsonpatch[_0xc3e3('0x1f')](_0x467ba3,_0x1e9d82,!![]);}catch(_0x38da5c){return BPromise[_0xc3e3('0x20')](_0x38da5c);}return _0x467ba3['save']();};}function saveUpdates(_0x4933dc,_0x476557){return function(_0xfc22a5){if(_0xfc22a5){return _0xfc22a5[_0xc3e3('0x21')](_0x4933dc)['then'](function(_0xb1dce3){return _0xb1dce3;});}return null;};}function removeEntity(_0x5bedd2,_0x198fdc){return function(_0x169195){if(_0x169195){return _0x169195['destroy']()[_0xc3e3('0x22')](function(){_0x5bedd2['status'](0xcc)[_0xc3e3('0x23')]();});}};}function handleEntityNotFound(_0x202508,_0x623e90){return function(_0x17f3ed){if(!_0x17f3ed){_0x202508['sendStatus'](0x194);}return _0x17f3ed;};}function handleError(_0xade0c4,_0x5260fc){_0x5260fc=_0x5260fc||0x1f4;return function(_0x2c856f){logger[_0xc3e3('0x24')](_0x2c856f[_0xc3e3('0x25')]);if(_0x2c856f[_0xc3e3('0x26')]){delete _0x2c856f[_0xc3e3('0x26')];}_0xade0c4[_0xc3e3('0x1a')](_0x5260fc)[_0xc3e3('0x27')](_0x2c856f);};}exports[_0xc3e3('0x28')]=function(_0x4fb6d2,_0xbf1e14){var _0x577baf={},_0x12003d={},_0x19b204={'count':0x0,'rows':[]};var _0x101597=_[_0xc3e3('0x29')](db[_0xc3e3('0x2a')]['rawAttributes'],function(_0x2771c9){return{'name':_0x2771c9[_0xc3e3('0x2b')],'type':_0x2771c9[_0xc3e3('0x2c')]['key']};});_0x12003d[_0xc3e3('0x2d')]=_[_0xc3e3('0x29')](_0x101597,'name');_0x12003d[_0xc3e3('0x2e')]=_[_0xc3e3('0x2f')](_0x4fb6d2[_0xc3e3('0x2e')]);_0x12003d['filters']=_[_0xc3e3('0x30')](_0x12003d['model'],_0x12003d[_0xc3e3('0x2e')]);_0x577baf[_0xc3e3('0x31')]=_['intersection'](_0x12003d['model'],qs[_0xc3e3('0x32')](_0x4fb6d2[_0xc3e3('0x2e')][_0xc3e3('0x32')]));_0x577baf[_0xc3e3('0x31')]=_0x577baf[_0xc3e3('0x31')][_0xc3e3('0x33')]?_0x577baf[_0xc3e3('0x31')]:_0x12003d[_0xc3e3('0x2d')];if(!_0x4fb6d2[_0xc3e3('0x2e')][_0xc3e3('0x34')](_0xc3e3('0x35'))){_0x577baf[_0xc3e3('0x36')]=qs[_0xc3e3('0x36')](_0x4fb6d2['query'][_0xc3e3('0x36')]);_0x577baf[_0xc3e3('0x1c')]=qs[_0xc3e3('0x1c')](_0x4fb6d2['query']['offset']);}_0x577baf[_0xc3e3('0x37')]=qs['sort'](_0x4fb6d2['query'][_0xc3e3('0x38')]);_0x577baf[_0xc3e3('0x39')]=qs[_0xc3e3('0x3a')](_['pick'](_0x4fb6d2[_0xc3e3('0x2e')],_0x12003d[_0xc3e3('0x3a')]),_0x101597);if(_0x4fb6d2[_0xc3e3('0x2e')]['filter']){_0x577baf[_0xc3e3('0x39')]=_['merge'](_0x577baf[_0xc3e3('0x39')],{'$or':_[_0xc3e3('0x29')](_0x101597,function(_0x48d67c){if(_0x48d67c[_0xc3e3('0x2c')]!=='VIRTUAL'){var _0x55f45c={};_0x55f45c[_0x48d67c[_0xc3e3('0x26')]]={'$like':'%'+_0x4fb6d2['query'][_0xc3e3('0x3b')]+'%'};return _0x55f45c;}})});}_0x577baf=_[_0xc3e3('0x3c')]({},_0x577baf,_0x4fb6d2[_0xc3e3('0x3d')]);var _0x3cae72={'where':_0x577baf[_0xc3e3('0x39')]};return db[_0xc3e3('0x2a')][_0xc3e3('0x1b')](_0x3cae72)[_0xc3e3('0x22')](function(_0x47c215){_0x19b204['count']=_0x47c215;if(_0x4fb6d2['query']['includeAll']){_0x577baf[_0xc3e3('0x3e')]=[{'all':!![]}];}return db[_0xc3e3('0x2a')]['findAll'](_0x577baf);})[_0xc3e3('0x22')](function(_0xfe471a){_0x19b204[_0xc3e3('0x3f')]=_0xfe471a;return _0x19b204;})[_0xc3e3('0x22')](respondWithFilteredResult(_0xbf1e14,_0x577baf))[_0xc3e3('0x40')](handleError(_0xbf1e14,null));};exports[_0xc3e3('0x41')]=function(_0x315fa2,_0xf3461d){var _0x326ebd={'raw':![],'where':{'id':_0x315fa2['params']['id']}},_0x2c3773={};_0x2c3773[_0xc3e3('0x2d')]=_[_0xc3e3('0x2f')](db[_0xc3e3('0x2a')][_0xc3e3('0x42')]);_0x2c3773[_0xc3e3('0x2e')]=_[_0xc3e3('0x2f')](_0x315fa2[_0xc3e3('0x2e')]);_0x2c3773[_0xc3e3('0x3a')]=_['intersection'](_0x2c3773[_0xc3e3('0x2d')],_0x2c3773[_0xc3e3('0x2e')]);_0x326ebd[_0xc3e3('0x31')]=_['intersection'](_0x2c3773[_0xc3e3('0x2d')],qs[_0xc3e3('0x32')](_0x315fa2[_0xc3e3('0x2e')][_0xc3e3('0x32')]));_0x326ebd['attributes']=_0x326ebd['attributes'][_0xc3e3('0x33')]?_0x326ebd[_0xc3e3('0x31')]:_0x2c3773['model'];if(_0x315fa2[_0xc3e3('0x2e')][_0xc3e3('0x43')]){_0x326ebd[_0xc3e3('0x3e')]=[{'all':!![]}];}_0x326ebd=_['merge']({},_0x326ebd,_0x315fa2[_0xc3e3('0x3d')]);return db[_0xc3e3('0x2a')][_0xc3e3('0x44')](_0x326ebd)[_0xc3e3('0x22')](handleEntityNotFound(_0xf3461d,null))['then'](respondWithResult(_0xf3461d,null))[_0xc3e3('0x40')](handleError(_0xf3461d,null));};exports['create']=function(_0x3c1e68,_0x5dd9f5){return db['Integration']['create'](_0x3c1e68[_0xc3e3('0x45')],{})[_0xc3e3('0x22')](respondWithResult(_0x5dd9f5,0xc9))[_0xc3e3('0x40')](handleError(_0x5dd9f5,null));};exports[_0xc3e3('0x21')]=function(_0x20e003,_0x1ea62b){if(_0x20e003[_0xc3e3('0x45')]['id']){delete _0x20e003[_0xc3e3('0x45')]['id'];}return db[_0xc3e3('0x2a')]['find']({'where':{'id':_0x20e003[_0xc3e3('0x46')]['id']}})[_0xc3e3('0x22')](handleEntityNotFound(_0x1ea62b,null))[_0xc3e3('0x22')](saveUpdates(_0x20e003[_0xc3e3('0x45')],null))[_0xc3e3('0x22')](respondWithResult(_0x1ea62b,null))[_0xc3e3('0x40')](handleError(_0x1ea62b,null));};exports[_0xc3e3('0x47')]=function(_0x487c5c,_0x5dbe16){return db[_0xc3e3('0x2a')][_0xc3e3('0x44')]({'where':{'id':_0x487c5c[_0xc3e3('0x46')]['id']}})[_0xc3e3('0x22')](handleEntityNotFound(_0x5dbe16,null))[_0xc3e3('0x22')](removeEntity(_0x5dbe16,null))['catch'](handleError(_0x5dbe16,null));}; \ No newline at end of file +var _0xe59c=['../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','error','stack','name','map','Integration','rawAttributes','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','show','params','keys','options','find','catch','create','body','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x4190fc,_0x5b57f7){var _0x3023d8=function(_0x4549d9){while(--_0x4549d9){_0x4190fc['push'](_0x4190fc['shift']());}};_0x3023d8(++_0x5b57f7);}(_0xe59c,0x191));var _0xce59=function(_0x149c6,_0x24379e){_0x149c6=_0x149c6-0x0;var _0x4de290=_0xe59c[_0x149c6];return _0x4de290;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xce59('0x0'));var rimraf=require(_0xce59('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xce59('0x2'));var BPromise=require(_0xce59('0x3'));var Mustache=require('mustache');var util=require(_0xce59('0x4'));var path=require(_0xce59('0x5'));var sox=require(_0xce59('0x6'));var csv=require(_0xce59('0x7'));var ejs=require(_0xce59('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xce59('0x9'));var crypto=require(_0xce59('0xa'));var jsforce=require(_0xce59('0xb'));var deskjs=require(_0xce59('0xc'));var toCsv=require(_0xce59('0x7'));var querystring=require('querystring');var Papa=require(_0xce59('0xd'));var Redis=require(_0xce59('0xe'));var authService=require(_0xce59('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xce59('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xce59('0x11'));var utils=require(_0xce59('0x12'));var config=require(_0xce59('0x13'));var licenseUtil=require(_0xce59('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1944b5,_0x3e7eae){_0x3e7eae=_0x3e7eae||0xcc;return function(_0x330691){if(_0x330691){return _0x1944b5[_0xce59('0x15')](_0x3e7eae);}return _0x1944b5[_0xce59('0x16')](_0x3e7eae)[_0xce59('0x17')]();};}function respondWithResult(_0x3e7ca7,_0x2afe3b){_0x2afe3b=_0x2afe3b||0xc8;return function(_0x3c5431){if(_0x3c5431){return _0x3e7ca7[_0xce59('0x16')](_0x2afe3b)[_0xce59('0x18')](_0x3c5431);}};}function respondWithFilteredResult(_0x5a42a1,_0x3712a8){return function(_0x1ea545){if(_0x1ea545){var _0x4999e4=_0x1ea545[_0xce59('0x19')],_0x301fad=_0x3712a8[_0xce59('0x1a')],_0x3dbb07=_0x3712a8['offset']+_0x3712a8[_0xce59('0x1b')],_0x1354eb;if(_0x3dbb07>=_0x4999e4){_0x3dbb07=_0x4999e4;_0x1354eb=0xc8;}else{_0x1354eb=0xce;}_0x5a42a1['status'](_0x1354eb);return _0x5a42a1[_0xce59('0x1c')]('Content-Range',_0x301fad+'-'+_0x3dbb07+'/'+_0x4999e4)[_0xce59('0x18')](_0x1ea545);}return null;};}function patchUpdates(_0x54bd5c){return function(_0x10826d){try{jsonpatch[_0xce59('0x1d')](_0x10826d,_0x54bd5c,!![]);}catch(_0x1a1538){return BPromise[_0xce59('0x1e')](_0x1a1538);}return _0x10826d[_0xce59('0x1f')]();};}function saveUpdates(_0x2bd106,_0xe68801){return function(_0x4b0ea8){if(_0x4b0ea8){return _0x4b0ea8[_0xce59('0x20')](_0x2bd106)['then'](function(_0x23685c){return _0x23685c;});}return null;};}function removeEntity(_0x55bf16,_0x3af54f){return function(_0x48df82){if(_0x48df82){return _0x48df82[_0xce59('0x21')]()[_0xce59('0x22')](function(){_0x55bf16[_0xce59('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48a557,_0x495487){return function(_0x1f47c2){if(!_0x1f47c2){_0x48a557['sendStatus'](0x194);}return _0x1f47c2;};}function handleError(_0x1b0f81,_0x30a287){_0x30a287=_0x30a287||0x1f4;return function(_0x163502){logger[_0xce59('0x23')](_0x163502[_0xce59('0x24')]);if(_0x163502[_0xce59('0x25')]){delete _0x163502['name'];}_0x1b0f81[_0xce59('0x16')](_0x30a287)['send'](_0x163502);};}exports['index']=function(_0xa9253,_0x4d88a6){var _0x2d5afe={},_0x3dfc34={},_0x71cec1={'count':0x0,'rows':[]};var _0x24a968=_[_0xce59('0x26')](db[_0xce59('0x27')][_0xce59('0x28')],function(_0x579b4f){return{'name':_0x579b4f['fieldName'],'type':_0x579b4f[_0xce59('0x29')][_0xce59('0x2a')]};});_0x3dfc34['model']=_[_0xce59('0x26')](_0x24a968,'name');_0x3dfc34[_0xce59('0x2b')]=_['keys'](_0xa9253[_0xce59('0x2b')]);_0x3dfc34[_0xce59('0x2c')]=_[_0xce59('0x2d')](_0x3dfc34['model'],_0x3dfc34[_0xce59('0x2b')]);_0x2d5afe[_0xce59('0x2e')]=_['intersection'](_0x3dfc34[_0xce59('0x2f')],qs[_0xce59('0x30')](_0xa9253['query'][_0xce59('0x30')]));_0x2d5afe[_0xce59('0x2e')]=_0x2d5afe[_0xce59('0x2e')][_0xce59('0x31')]?_0x2d5afe[_0xce59('0x2e')]:_0x3dfc34[_0xce59('0x2f')];if(!_0xa9253[_0xce59('0x2b')][_0xce59('0x32')](_0xce59('0x33'))){_0x2d5afe['limit']=qs[_0xce59('0x1b')](_0xa9253[_0xce59('0x2b')][_0xce59('0x1b')]);_0x2d5afe['offset']=qs[_0xce59('0x1a')](_0xa9253[_0xce59('0x2b')]['offset']);}_0x2d5afe[_0xce59('0x34')]=qs['sort'](_0xa9253['query'][_0xce59('0x35')]);_0x2d5afe['where']=qs['filters'](_[_0xce59('0x36')](_0xa9253[_0xce59('0x2b')],_0x3dfc34[_0xce59('0x2c')]),_0x24a968);if(_0xa9253[_0xce59('0x2b')][_0xce59('0x37')]){_0x2d5afe[_0xce59('0x38')]=_[_0xce59('0x39')](_0x2d5afe['where'],{'$or':_[_0xce59('0x26')](_0x24a968,function(_0x129ee1){if(_0x129ee1[_0xce59('0x29')]!==_0xce59('0x3a')){var _0x6ebe83={};_0x6ebe83[_0x129ee1[_0xce59('0x25')]]={'$like':'%'+_0xa9253['query'][_0xce59('0x37')]+'%'};return _0x6ebe83;}})});}_0x2d5afe=_[_0xce59('0x39')]({},_0x2d5afe,_0xa9253['options']);var _0x5640bc={'where':_0x2d5afe[_0xce59('0x38')]};return db['Integration'][_0xce59('0x19')](_0x5640bc)[_0xce59('0x22')](function(_0x5a62d6){_0x71cec1[_0xce59('0x19')]=_0x5a62d6;if(_0xa9253[_0xce59('0x2b')][_0xce59('0x3b')]){_0x2d5afe[_0xce59('0x3c')]=[{'all':!![]}];}return db[_0xce59('0x27')]['findAll'](_0x2d5afe);})['then'](function(_0x5cf3ad){_0x71cec1[_0xce59('0x3d')]=_0x5cf3ad;return _0x71cec1;})[_0xce59('0x22')](respondWithFilteredResult(_0x4d88a6,_0x2d5afe))['catch'](handleError(_0x4d88a6,null));};exports[_0xce59('0x3e')]=function(_0x5134bc,_0x20219e){var _0xca74a7={'raw':![],'where':{'id':_0x5134bc[_0xce59('0x3f')]['id']}},_0x20425c={};_0x20425c['model']=_[_0xce59('0x40')](db[_0xce59('0x27')][_0xce59('0x28')]);_0x20425c['query']=_['keys'](_0x5134bc[_0xce59('0x2b')]);_0x20425c[_0xce59('0x2c')]=_[_0xce59('0x2d')](_0x20425c[_0xce59('0x2f')],_0x20425c[_0xce59('0x2b')]);_0xca74a7[_0xce59('0x2e')]=_[_0xce59('0x2d')](_0x20425c[_0xce59('0x2f')],qs['fields'](_0x5134bc[_0xce59('0x2b')][_0xce59('0x30')]));_0xca74a7[_0xce59('0x2e')]=_0xca74a7['attributes'][_0xce59('0x31')]?_0xca74a7[_0xce59('0x2e')]:_0x20425c['model'];if(_0x5134bc[_0xce59('0x2b')]['includeAll']){_0xca74a7[_0xce59('0x3c')]=[{'all':!![]}];}_0xca74a7=_['merge']({},_0xca74a7,_0x5134bc[_0xce59('0x41')]);return db['Integration'][_0xce59('0x42')](_0xca74a7)[_0xce59('0x22')](handleEntityNotFound(_0x20219e,null))[_0xce59('0x22')](respondWithResult(_0x20219e,null))[_0xce59('0x43')](handleError(_0x20219e,null));};exports['create']=function(_0x56c6d5,_0xda02a6){return db[_0xce59('0x27')][_0xce59('0x44')](_0x56c6d5[_0xce59('0x45')],{})[_0xce59('0x22')](respondWithResult(_0xda02a6,0xc9))['catch'](handleError(_0xda02a6,null));};exports[_0xce59('0x20')]=function(_0x9f4b81,_0x52c223){if(_0x9f4b81[_0xce59('0x45')]['id']){delete _0x9f4b81['body']['id'];}return db[_0xce59('0x27')][_0xce59('0x42')]({'where':{'id':_0x9f4b81[_0xce59('0x3f')]['id']}})[_0xce59('0x22')](handleEntityNotFound(_0x52c223,null))[_0xce59('0x22')](saveUpdates(_0x9f4b81[_0xce59('0x45')],null))[_0xce59('0x22')](respondWithResult(_0x52c223,null))[_0xce59('0x43')](handleError(_0x52c223,null));};exports[_0xce59('0x21')]=function(_0x3e54d,_0xef0fb9){return db[_0xce59('0x27')][_0xce59('0x42')]({'where':{'id':_0x3e54d[_0xce59('0x3f')]['id']}})['then'](handleEntityNotFound(_0xef0fb9,null))[_0xce59('0x22')](removeEntity(_0xef0fb9,null))[_0xce59('0x43')](handleError(_0xef0fb9,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f9b5ff3..6d6039a 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 _0x44fa=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','lodash','util'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x44fa,0xb2));var _0xa44f=function(_0x1237f6,_0x46cbba){_0x1237f6=_0x1237f6-0x0;var _0x28099d=_0x44fa[_0x1237f6];return _0x28099d;};'use strict';var _=require(_0xa44f('0x0'));var util=require(_0xa44f('0x1'));var logger=require(_0xa44f('0x2'))(_0xa44f('0x3'));var moment=require(_0xa44f('0x4'));var BPromise=require(_0xa44f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa44f('0x6'));var config=require(_0xa44f('0x7'));var attributes=require(_0xa44f('0x8'));module[_0xa44f('0x9')]=function(_0x36eee4,_0x2755f3){return _0x36eee4[_0xa44f('0xa')](_0xa44f('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2af1=['./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2af1,0x1a5));var _0x12af=function(_0x4ffed2,_0x58c6d2){_0x4ffed2=_0x4ffed2-0x0;var _0x26cc17=_0x2af1[_0x4ffed2];return _0x26cc17;};'use strict';var _=require(_0x12af('0x0'));var util=require(_0x12af('0x1'));var logger=require(_0x12af('0x2'))(_0x12af('0x3'));var moment=require(_0x12af('0x4'));var BPromise=require(_0x12af('0x5'));var rp=require(_0x12af('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12af('0x7'));var config=require('../../config/environment');var attributes=require(_0x12af('0x8'));module[_0x12af('0x9')]=function(_0x11cb4b,_0x4a379f){return _0x11cb4b[_0x12af('0xa')](_0x12af('0xb'),attributes,{'tableName':_0x12af('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 50e786d..9b60118 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 _0x1de4=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1de4,0x94));var _0x41de=function(_0x32d19b,_0xa3dcd){_0x32d19b=_0x32d19b-0x0;var _0x2b3139=_0x1de4[_0x32d19b];return _0x2b3139;};'use strict';var _=require(_0x41de('0x0'));var util=require(_0x41de('0x1'));var moment=require(_0x41de('0x2'));var BPromise=require(_0x41de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41de('0x4'));var db=require(_0x41de('0x5'))['db'];var utils=require(_0x41de('0x6'));var logger=require('../../config/logger')(_0x41de('0x7'));var config=require(_0x41de('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x41de('0x9')][_0x41de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f1078,_0x352d9b,_0x50f716){return new BPromise(function(_0x4c292c,_0x344b7b){return client[_0x41de('0xb')](_0x2f1078,_0x50f716)[_0x41de('0xc')](function(_0xb268da){logger[_0x41de('0xd')](_0x41de('0xe'),_0x352d9b,'request\x20sent');logger[_0x41de('0xf')](_0x41de('0x10'),_0x352d9b,_0x41de('0x11'),JSON[_0x41de('0x12')](_0xb268da));if(_0xb268da[_0x41de('0x13')]){if(_0xb268da[_0x41de('0x13')]['code']===0x1f4){logger[_0x41de('0x13')](_0x41de('0xe'),_0x352d9b,_0xb268da[_0x41de('0x13')]['message']);return _0x344b7b(_0xb268da[_0x41de('0x13')][_0x41de('0x14')]);}logger['error'](_0x41de('0xe'),_0x352d9b,_0xb268da[_0x41de('0x13')][_0x41de('0x14')]);return _0x4c292c(_0xb268da[_0x41de('0x13')][_0x41de('0x14')]);}else{logger[_0x41de('0xd')](_0x41de('0xe'),_0x352d9b,_0x41de('0x11'));_0x4c292c(_0xb268da[_0x41de('0x15')][_0x41de('0x14')]);}})[_0x41de('0x16')](function(_0x4a9591){logger[_0x41de('0x13')](_0x41de('0xe'),_0x352d9b,_0x4a9591);_0x344b7b(_0x4a9591);});});} \ No newline at end of file +var _0x9dc0=['jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3e136d,_0x58c598){var _0x313b8f=function(_0xa79cda){while(--_0xa79cda){_0x3e136d['push'](_0x3e136d['shift']());}};_0x313b8f(++_0x58c598);}(_0x9dc0,0xd6));var _0x09dc=function(_0x58803c,_0x4a34df){_0x58803c=_0x58803c-0x0;var _0xf95b9b=_0x9dc0[_0x58803c];return _0xf95b9b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x09dc('0x0'));var BPromise=require('bluebird');var rs=require(_0x09dc('0x1'));var fs=require('fs');var Redis=require(_0x09dc('0x2'));var db=require(_0x09dc('0x3'))['db'];var utils=require(_0x09dc('0x4'));var logger=require('../../config/logger')(_0x09dc('0x5'));var config=require('../../config/environment');var jayson=require(_0x09dc('0x6'));var client=jayson[_0x09dc('0x7')][_0x09dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3341cc,_0x5daeae,_0x50e9d2){return new BPromise(function(_0x5e3c5d,_0x58b855){return client[_0x09dc('0x9')](_0x3341cc,_0x50e9d2)[_0x09dc('0xa')](function(_0x48dd44){logger[_0x09dc('0xb')](_0x09dc('0xc'),_0x5daeae,_0x09dc('0xd'));logger['debug'](_0x09dc('0xe'),_0x5daeae,_0x09dc('0xd'),JSON[_0x09dc('0xf')](_0x48dd44));if(_0x48dd44[_0x09dc('0x10')]){if(_0x48dd44[_0x09dc('0x10')][_0x09dc('0x11')]===0x1f4){logger[_0x09dc('0x10')](_0x09dc('0xc'),_0x5daeae,_0x48dd44['error'][_0x09dc('0x12')]);return _0x58b855(_0x48dd44['error'][_0x09dc('0x12')]);}logger[_0x09dc('0x10')]('Integration,\x20%s,\x20%s',_0x5daeae,_0x48dd44[_0x09dc('0x10')][_0x09dc('0x12')]);return _0x5e3c5d(_0x48dd44[_0x09dc('0x10')]['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x5daeae,_0x09dc('0xd'));_0x5e3c5d(_0x48dd44[_0x09dc('0x13')][_0x09dc('0x12')]);}})['catch'](function(_0x39f429){logger[_0x09dc('0x10')]('Integration,\x20%s,\x20%s',_0x5daeae,_0x39f429);_0x58b855(_0x39f429);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 9dc0ab3..5755370 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 _0xabf0=['connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','post','create','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x33c4a7,_0x2980eb){var _0x127856=function(_0x1ebc74){while(--_0x1ebc74){_0x33c4a7['push'](_0x33c4a7['shift']());}};_0x127856(++_0x2980eb);}(_0xabf0,0x1bf));var _0x0abf=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xabf0[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x0abf('0x0'));var util=require(_0x0abf('0x1'));var path=require(_0x0abf('0x2'));var timeout=require(_0x0abf('0x3'));var express=require(_0x0abf('0x4'));var router=express['Router']();var fs_extra=require(_0x0abf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0abf('0x6'));var controller=require('./integrationReport.controller');router[_0x0abf('0x7')]('/',auth[_0x0abf('0x8')](),controller[_0x0abf('0x9')]);router[_0x0abf('0x7')](_0x0abf('0xa'),auth[_0x0abf('0x8')](),controller['describe']);router[_0x0abf('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0abf('0xb')]('/',auth['isAuthenticated'](),controller[_0x0abf('0xc')]);router['put'](_0x0abf('0xd'),auth['isAuthenticated'](),controller[_0x0abf('0xe')]);router[_0x0abf('0xf')](_0x0abf('0xd'),auth[_0x0abf('0x8')](),controller[_0x0abf('0x10')]);module[_0x0abf('0x11')]=router; \ No newline at end of file +var _0x74e2=['./integrationReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5edf61,_0x4cedec){var _0x396335=function(_0x565817){while(--_0x565817){_0x5edf61['push'](_0x5edf61['shift']());}};_0x396335(++_0x4cedec);}(_0x74e2,0xca));var _0x274e=function(_0x504072,_0x2b7160){_0x504072=_0x504072-0x0;var _0x545ba4=_0x74e2[_0x504072];return _0x545ba4;};'use strict';var multer=require('multer');var util=require(_0x274e('0x0'));var path=require(_0x274e('0x1'));var timeout=require(_0x274e('0x2'));var express=require(_0x274e('0x3'));var router=express['Router']();var fs_extra=require(_0x274e('0x4'));var auth=require(_0x274e('0x5'));var interaction=require(_0x274e('0x6'));var config=require('../../config/environment');var controller=require(_0x274e('0x7'));router['get']('/',auth[_0x274e('0x8')](),controller[_0x274e('0x9')]);router[_0x274e('0xa')](_0x274e('0xb'),auth[_0x274e('0x8')](),controller['describe']);router[_0x274e('0xa')](_0x274e('0xc'),auth[_0x274e('0x8')](),controller[_0x274e('0xd')]);router['post']('/',auth[_0x274e('0x8')](),controller[_0x274e('0xe')]);router[_0x274e('0xf')](_0x274e('0xc'),auth['isAuthenticated'](),controller[_0x274e('0x10')]);router[_0x274e('0x11')](_0x274e('0xc'),auth[_0x274e('0x8')](),controller['destroy']);module[_0x274e('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 99fe132..928b41d 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 _0x8d89=['SENT','SENDING','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x546e57,_0x1ef7bd){var _0x36381f=function(_0x25f791){while(--_0x25f791){_0x546e57['push'](_0x546e57['shift']());}};_0x36381f(++_0x1ef7bd);}(_0x8d89,0x119));var _0x98d8=function(_0x58c218,_0x88075c){_0x58c218=_0x58c218-0x0;var _0x382850=_0x8d89[_0x58c218];return _0x382850;};'use strict';var Sequelize=require(_0x98d8('0x0'));module[_0x98d8('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x98d8('0x2')]},'exitStatus':{'type':Sequelize[_0x98d8('0x2')]},'ticketId':{'type':Sequelize[_0x98d8('0x2')]},'integrationId':{'type':Sequelize[_0x98d8('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x98d8('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x98d8('0x2')]},'queue':{'type':Sequelize[_0x98d8('0x2')]},'interface':{'type':Sequelize[_0x98d8('0x2')]},'membername':{'type':Sequelize[_0x98d8('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x98d8('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x98d8('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x98d8('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x98d8('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x98d8('0x3')]},'reason':{'type':Sequelize[_0x98d8('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x98d8('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x98d8('0x4')]},'agentdump':{'type':Sequelize[_0x98d8('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x98d8('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x98d8('0x2')]},'connectedlinenum':{'type':Sequelize[_0x98d8('0x2')]},'connectedlinename':{'type':Sequelize[_0x98d8('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x98d8('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x98d8('0x2')]},'destchannelstate':{'type':Sequelize[_0x98d8('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x98d8('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x98d8('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x98d8('0x2')]},'destlanguage':{'type':Sequelize[_0x98d8('0x2')]},'destaccountcode':{'type':Sequelize[_0x98d8('0x2')]},'destcontext':{'type':Sequelize[_0x98d8('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x98d8('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x98d8('0x2')]},'from':{'type':Sequelize[_0x98d8('0x2')]},'to':{'type':Sequelize[_0x98d8('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x98d8('0x6')]},'html':{'type':Sequelize[_0x98d8('0x6')]},'text':{'type':Sequelize[_0x98d8('0x6')]},'status':{'type':Sequelize['ENUM'](_0x98d8('0x7'),_0x98d8('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x98d8('0x2')]},'app':{'type':Sequelize[_0x98d8('0x2')]},'appdata':{'type':Sequelize[_0x98d8('0x2')]},'projectId':{'type':Sequelize[_0x98d8('0x3')]}}; \ No newline at end of file +var _0x19ad=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT'];(function(_0x1e5b04,_0x33d908){var _0x29583e=function(_0x20afb6){while(--_0x20afb6){_0x1e5b04['push'](_0x1e5b04['shift']());}};_0x29583e(++_0x33d908);}(_0x19ad,0x1d9));var _0xd19a=function(_0x2fac71,_0x2ae81d){_0x2fac71=_0x2fac71-0x0;var _0x28cb27=_0x19ad[_0x2fac71];return _0x28cb27;};'use strict';var Sequelize=require(_0xd19a('0x0'));module[_0xd19a('0x1')]={'integration':{'type':Sequelize[_0xd19a('0x2')]},'eventChannel':{'type':Sequelize[_0xd19a('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xd19a('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xd19a('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd19a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xd19a('0x2')]},'interface':{'type':Sequelize[_0xd19a('0x2')]},'membername':{'type':Sequelize[_0xd19a('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd19a('0x3')]},'agentconnectAt':{'type':Sequelize[_0xd19a('0x3')]},'holdtime':{'type':Sequelize[_0xd19a('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xd19a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd19a('0x4')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xd19a('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd19a('0x3')]},'agentdump':{'type':Sequelize[_0xd19a('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xd19a('0x2')]},'channel':{'type':Sequelize[_0xd19a('0x2')]},'channelstate':{'type':Sequelize[_0xd19a('0x4')]},'channelstatedesc':{'type':Sequelize[_0xd19a('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd19a('0x2')]},'connectedlinename':{'type':Sequelize[_0xd19a('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd19a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd19a('0x2')]},'destchannel':{'type':Sequelize[_0xd19a('0x2')]},'destchannelstate':{'type':Sequelize[_0xd19a('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd19a('0x2')]},'destcalleridname':{'type':Sequelize[_0xd19a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd19a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd19a('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xd19a('0x2')]},'destpriority':{'type':Sequelize[_0xd19a('0x2')]},'destuniqueid':{'type':Sequelize[_0xd19a('0x2')]},'messageId':{'type':Sequelize[_0xd19a('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xd19a('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xd19a('0x2')]},'cc':{'type':Sequelize[_0xd19a('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xd19a('0x6')]},'status':{'type':Sequelize[_0xd19a('0x7')](_0xd19a('0x8'),_0xd19a('0x9'),_0xd19a('0xa'),_0xd19a('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xd19a('0x2')]},'appdata':{'type':Sequelize[_0xd19a('0x2')]},'projectId':{'type':Sequelize[_0xd19a('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 1cd32b9..dce9166 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 _0xabb0=['body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject','then','end','error','stack','name','index','map','IntegrationReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create'];(function(_0x299177,_0x5aa4cd){var _0x55e79a=function(_0x4e4b97){while(--_0x4e4b97){_0x299177['push'](_0x299177['shift']());}};_0x55e79a(++_0x5aa4cd);}(_0xabb0,0x17f));var _0x0abb=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xabb0[_0x126558];return _0x1f6d14;};'use strict';var pdf=require(_0x0abb('0x0'));var emlformat=require(_0x0abb('0x1'));var rimraf=require(_0x0abb('0x2'));var zipdir=require(_0x0abb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0abb('0x4'));var moment=require(_0x0abb('0x5'));var BPromise=require(_0x0abb('0x6'));var Mustache=require(_0x0abb('0x7'));var util=require(_0x0abb('0x8'));var path=require(_0x0abb('0x9'));var sox=require(_0x0abb('0xa'));var csv=require(_0x0abb('0xb'));var ejs=require(_0x0abb('0xc'));var fs=require('fs');var fs_extra=require(_0x0abb('0xd'));var _=require(_0x0abb('0xe'));var squel=require(_0x0abb('0xf'));var crypto=require(_0x0abb('0x10'));var jsforce=require(_0x0abb('0x11'));var deskjs=require(_0x0abb('0x12'));var toCsv=require('to-csv');var querystring=require(_0x0abb('0x13'));var Papa=require('papaparse');var Redis=require(_0x0abb('0x14'));var authService=require(_0x0abb('0x15'));var qs=require(_0x0abb('0x16'));var as=require(_0x0abb('0x17'));var hardwareService=require(_0x0abb('0x18'));var logger=require(_0x0abb('0x19'))(_0x0abb('0x1a'));var utils=require('../../config/utils');var config=require(_0x0abb('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x0abb('0x1c'))['db'];function respondWithStatusCode(_0xaae684,_0x57b59d){_0x57b59d=_0x57b59d||0xcc;return function(_0x4a6ee7){if(_0x4a6ee7){return _0xaae684[_0x0abb('0x1d')](_0x57b59d);}return _0xaae684[_0x0abb('0x1e')](_0x57b59d)['end']();};}function respondWithResult(_0x28a6d2,_0xe7352f){_0xe7352f=_0xe7352f||0xc8;return function(_0x1bfe61){if(_0x1bfe61){return _0x28a6d2[_0x0abb('0x1e')](_0xe7352f)['json'](_0x1bfe61);}};}function respondWithFilteredResult(_0x539bb5,_0x14b96e){return function(_0x4e9c6d){if(_0x4e9c6d){var _0x4964d8=_0x4e9c6d[_0x0abb('0x1f')],_0x7c3c7c=_0x14b96e['offset'],_0x5463fe=_0x14b96e[_0x0abb('0x20')]+_0x14b96e[_0x0abb('0x21')],_0x69c9f2;if(_0x5463fe>=_0x4964d8){_0x5463fe=_0x4964d8;_0x69c9f2=0xc8;}else{_0x69c9f2=0xce;}_0x539bb5['status'](_0x69c9f2);return _0x539bb5[_0x0abb('0x22')]('Content-Range',_0x7c3c7c+'-'+_0x5463fe+'/'+_0x4964d8)[_0x0abb('0x23')](_0x4e9c6d);}return null;};}function patchUpdates(_0x54f162){return function(_0x26555a){try{jsonpatch[_0x0abb('0x24')](_0x26555a,_0x54f162,!![]);}catch(_0xc1cd02){return BPromise[_0x0abb('0x25')](_0xc1cd02);}return _0x26555a['save']();};}function saveUpdates(_0x448794,_0x318d74){return function(_0x4991a1){if(_0x4991a1){return _0x4991a1['update'](_0x448794)[_0x0abb('0x26')](function(_0x5020b9){return _0x5020b9;});}return null;};}function removeEntity(_0xe49ceb,_0xe48bfa){return function(_0x50d610){if(_0x50d610){return _0x50d610['destroy']()[_0x0abb('0x26')](function(){_0xe49ceb[_0x0abb('0x1e')](0xcc)[_0x0abb('0x27')]();});}};}function handleEntityNotFound(_0x2c61d1,_0x240250){return function(_0x2cf983){if(!_0x2cf983){_0x2c61d1[_0x0abb('0x1d')](0x194);}return _0x2cf983;};}function handleError(_0x3a0901,_0x5f24be){_0x5f24be=_0x5f24be||0x1f4;return function(_0x3cc55d){logger[_0x0abb('0x28')](_0x3cc55d[_0x0abb('0x29')]);if(_0x3cc55d[_0x0abb('0x2a')]){delete _0x3cc55d[_0x0abb('0x2a')];}_0x3a0901['status'](_0x5f24be)['send'](_0x3cc55d);};}exports[_0x0abb('0x2b')]=function(_0x30eba2,_0xc05563){var _0x1e6d03={},_0x2d0d4d={},_0x3ad03a={'count':0x0,'rows':[]};var _0x5a607f=_[_0x0abb('0x2c')](db[_0x0abb('0x2d')][_0x0abb('0x2e')],function(_0x1b46db){return{'name':_0x1b46db['fieldName'],'type':_0x1b46db[_0x0abb('0x2f')][_0x0abb('0x30')]};});_0x2d0d4d[_0x0abb('0x31')]=_[_0x0abb('0x2c')](_0x5a607f,'name');_0x2d0d4d['query']=_[_0x0abb('0x32')](_0x30eba2[_0x0abb('0x33')]);_0x2d0d4d[_0x0abb('0x34')]=_[_0x0abb('0x35')](_0x2d0d4d[_0x0abb('0x31')],_0x2d0d4d[_0x0abb('0x33')]);_0x1e6d03[_0x0abb('0x36')]=_['intersection'](_0x2d0d4d[_0x0abb('0x31')],qs[_0x0abb('0x37')](_0x30eba2['query']['fields']));_0x1e6d03['attributes']=_0x1e6d03['attributes'][_0x0abb('0x38')]?_0x1e6d03[_0x0abb('0x36')]:_0x2d0d4d[_0x0abb('0x31')];if(!_0x30eba2['query'][_0x0abb('0x39')](_0x0abb('0x3a'))){_0x1e6d03['limit']=qs[_0x0abb('0x21')](_0x30eba2[_0x0abb('0x33')][_0x0abb('0x21')]);_0x1e6d03['offset']=qs[_0x0abb('0x20')](_0x30eba2[_0x0abb('0x33')][_0x0abb('0x20')]);}_0x1e6d03['order']=qs[_0x0abb('0x3b')](_0x30eba2[_0x0abb('0x33')]['sort']);_0x1e6d03[_0x0abb('0x3c')]=qs['filters'](_['pick'](_0x30eba2['query'],_0x2d0d4d[_0x0abb('0x34')]),_0x5a607f);if(_0x30eba2[_0x0abb('0x33')][_0x0abb('0x3d')]){_0x1e6d03['where']=_[_0x0abb('0x3e')](_0x1e6d03[_0x0abb('0x3c')],{'$or':_[_0x0abb('0x2c')](_0x5a607f,function(_0x224bd9){if(_0x224bd9[_0x0abb('0x2f')]!=='VIRTUAL'){var _0x12f5a1={};_0x12f5a1[_0x224bd9[_0x0abb('0x2a')]]={'$like':'%'+_0x30eba2[_0x0abb('0x33')][_0x0abb('0x3d')]+'%'};return _0x12f5a1;}})});}_0x1e6d03=_[_0x0abb('0x3e')]({},_0x1e6d03,_0x30eba2[_0x0abb('0x3f')]);var _0x5ea991={'where':_0x1e6d03['where']};return db[_0x0abb('0x2d')][_0x0abb('0x1f')](_0x5ea991)['then'](function(_0x206775){_0x3ad03a['count']=_0x206775;if(_0x30eba2[_0x0abb('0x33')]['includeAll']){_0x1e6d03[_0x0abb('0x40')]=[{'all':!![]}];}return db[_0x0abb('0x2d')][_0x0abb('0x41')](_0x1e6d03);})['then'](function(_0x520321){_0x3ad03a[_0x0abb('0x42')]=_0x520321;return _0x3ad03a;})['then'](respondWithFilteredResult(_0xc05563,_0x1e6d03))['catch'](handleError(_0xc05563,null));};exports[_0x0abb('0x43')]=function(_0x2ccab0,_0x451daf){var _0x5d9a1f={'raw':![],'where':{'id':_0x2ccab0[_0x0abb('0x44')]['id']}},_0x33998f={};_0x33998f[_0x0abb('0x31')]=_[_0x0abb('0x32')](db[_0x0abb('0x2d')][_0x0abb('0x2e')]);_0x33998f[_0x0abb('0x33')]=_['keys'](_0x2ccab0['query']);_0x33998f[_0x0abb('0x34')]=_[_0x0abb('0x35')](_0x33998f[_0x0abb('0x31')],_0x33998f[_0x0abb('0x33')]);_0x5d9a1f[_0x0abb('0x36')]=_[_0x0abb('0x35')](_0x33998f['model'],qs['fields'](_0x2ccab0[_0x0abb('0x33')][_0x0abb('0x37')]));_0x5d9a1f[_0x0abb('0x36')]=_0x5d9a1f[_0x0abb('0x36')][_0x0abb('0x38')]?_0x5d9a1f['attributes']:_0x33998f['model'];if(_0x2ccab0['query'][_0x0abb('0x45')]){_0x5d9a1f[_0x0abb('0x40')]=[{'all':!![]}];}_0x5d9a1f=_[_0x0abb('0x3e')]({},_0x5d9a1f,_0x2ccab0['options']);return db[_0x0abb('0x2d')][_0x0abb('0x46')](_0x5d9a1f)[_0x0abb('0x26')](handleEntityNotFound(_0x451daf,null))[_0x0abb('0x26')](respondWithResult(_0x451daf,null))[_0x0abb('0x47')](handleError(_0x451daf,null));};exports[_0x0abb('0x48')]=function(_0x37408c,_0x35f2dd){return db[_0x0abb('0x2d')][_0x0abb('0x48')](_0x37408c['body'],{})[_0x0abb('0x26')](respondWithResult(_0x35f2dd,0xc9))[_0x0abb('0x47')](handleError(_0x35f2dd,null));};exports['update']=function(_0x57a44c,_0x3a34de){if(_0x57a44c[_0x0abb('0x49')]['id']){delete _0x57a44c[_0x0abb('0x49')]['id'];}return db[_0x0abb('0x2d')][_0x0abb('0x46')]({'where':{'id':_0x57a44c[_0x0abb('0x44')]['id']}})[_0x0abb('0x26')](handleEntityNotFound(_0x3a34de,null))[_0x0abb('0x26')](saveUpdates(_0x57a44c[_0x0abb('0x49')],null))['then'](respondWithResult(_0x3a34de,null))[_0x0abb('0x47')](handleError(_0x3a34de,null));};exports[_0x0abb('0x4a')]=function(_0x91db77,_0x744529){return db[_0x0abb('0x2d')][_0x0abb('0x46')]({'where':{'id':_0x91db77[_0x0abb('0x44')]['id']}})[_0x0abb('0x26')](handleEntityNotFound(_0x744529,null))[_0x0abb('0x26')](removeEntity(_0x744529,null))[_0x0abb('0x47')](handleError(_0x744529,null));};exports[_0x0abb('0x4b')]=function(_0x2692f7,_0x3618e4){return db[_0x0abb('0x2d')]['describe']()[_0x0abb('0x26')](respondWithResult(_0x3618e4,null))['catch'](handleError(_0x3618e4,null));}; \ No newline at end of file +var _0x0bce=['name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','fields','find','create','update','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error'];(function(_0x5a6817,_0x4deb53){var _0x53b624=function(_0x3d76e5){while(--_0x3d76e5){_0x5a6817['push'](_0x5a6817['shift']());}};_0x53b624(++_0x4deb53);}(_0x0bce,0x75));var _0xe0bc=function(_0x5a1da0,_0x264065){_0x5a1da0=_0x5a1da0-0x0;var _0x3a5743=_0x0bce[_0x5a1da0];return _0x3a5743;};'use strict';var pdf=require(_0xe0bc('0x0'));var emlformat=require(_0xe0bc('0x1'));var rimraf=require(_0xe0bc('0x2'));var zipdir=require(_0xe0bc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0bc('0x4'));var moment=require(_0xe0bc('0x5'));var BPromise=require(_0xe0bc('0x6'));var Mustache=require(_0xe0bc('0x7'));var util=require(_0xe0bc('0x8'));var path=require('path');var sox=require(_0xe0bc('0x9'));var csv=require(_0xe0bc('0xa'));var ejs=require(_0xe0bc('0xb'));var fs=require('fs');var fs_extra=require(_0xe0bc('0xc'));var _=require(_0xe0bc('0xd'));var squel=require(_0xe0bc('0xe'));var crypto=require(_0xe0bc('0xf'));var jsforce=require(_0xe0bc('0x10'));var deskjs=require(_0xe0bc('0x11'));var toCsv=require(_0xe0bc('0xa'));var querystring=require(_0xe0bc('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe0bc('0x13'));var qs=require(_0xe0bc('0x14'));var as=require(_0xe0bc('0x15'));var hardwareService=require(_0xe0bc('0x16'));var logger=require(_0xe0bc('0x17'))(_0xe0bc('0x18'));var utils=require(_0xe0bc('0x19'));var config=require(_0xe0bc('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0bc('0x1b'))['db'];function respondWithStatusCode(_0x59b49d,_0x5acbb7){_0x5acbb7=_0x5acbb7||0xcc;return function(_0x2bf937){if(_0x2bf937){return _0x59b49d[_0xe0bc('0x1c')](_0x5acbb7);}return _0x59b49d[_0xe0bc('0x1d')](_0x5acbb7)[_0xe0bc('0x1e')]();};}function respondWithResult(_0x4ff66c,_0x2c0ab2){_0x2c0ab2=_0x2c0ab2||0xc8;return function(_0x4e1f58){if(_0x4e1f58){return _0x4ff66c[_0xe0bc('0x1d')](_0x2c0ab2)[_0xe0bc('0x1f')](_0x4e1f58);}};}function respondWithFilteredResult(_0x267f5e,_0x58c4e1){return function(_0x30d5c4){if(_0x30d5c4){var _0x183f99=_0x30d5c4[_0xe0bc('0x20')],_0xaf48c7=_0x58c4e1[_0xe0bc('0x21')],_0x4d1268=_0x58c4e1[_0xe0bc('0x21')]+_0x58c4e1[_0xe0bc('0x22')],_0x5827d3;if(_0x4d1268>=_0x183f99){_0x4d1268=_0x183f99;_0x5827d3=0xc8;}else{_0x5827d3=0xce;}_0x267f5e[_0xe0bc('0x1d')](_0x5827d3);return _0x267f5e[_0xe0bc('0x23')](_0xe0bc('0x24'),_0xaf48c7+'-'+_0x4d1268+'/'+_0x183f99)['json'](_0x30d5c4);}return null;};}function patchUpdates(_0x3ea729){return function(_0x3a5bc9){try{jsonpatch[_0xe0bc('0x25')](_0x3a5bc9,_0x3ea729,!![]);}catch(_0x5de802){return BPromise[_0xe0bc('0x26')](_0x5de802);}return _0x3a5bc9[_0xe0bc('0x27')]();};}function saveUpdates(_0x358ef5,_0x32be42){return function(_0x4c5112){if(_0x4c5112){return _0x4c5112['update'](_0x358ef5)[_0xe0bc('0x28')](function(_0x27855f){return _0x27855f;});}return null;};}function removeEntity(_0xbccda,_0x45b9a9){return function(_0x5dca62){if(_0x5dca62){return _0x5dca62[_0xe0bc('0x29')]()[_0xe0bc('0x28')](function(){_0xbccda[_0xe0bc('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59873f,_0x758aec){return function(_0x167495){if(!_0x167495){_0x59873f['sendStatus'](0x194);}return _0x167495;};}function handleError(_0x132696,_0x56daf1){_0x56daf1=_0x56daf1||0x1f4;return function(_0x2c70a9){logger[_0xe0bc('0x2a')](_0x2c70a9['stack']);if(_0x2c70a9[_0xe0bc('0x2b')]){delete _0x2c70a9[_0xe0bc('0x2b')];}_0x132696['status'](_0x56daf1)[_0xe0bc('0x2c')](_0x2c70a9);};}exports[_0xe0bc('0x2d')]=function(_0xd1c1c,_0x222b05){var _0x476a46={},_0x59dbfc={},_0x385a52={'count':0x0,'rows':[]};var _0x5f2952=_[_0xe0bc('0x2e')](db[_0xe0bc('0x2f')][_0xe0bc('0x30')],function(_0x3df545){return{'name':_0x3df545[_0xe0bc('0x31')],'type':_0x3df545[_0xe0bc('0x32')][_0xe0bc('0x33')]};});_0x59dbfc['model']=_['map'](_0x5f2952,_0xe0bc('0x2b'));_0x59dbfc[_0xe0bc('0x34')]=_[_0xe0bc('0x35')](_0xd1c1c['query']);_0x59dbfc['filters']=_[_0xe0bc('0x36')](_0x59dbfc['model'],_0x59dbfc['query']);_0x476a46[_0xe0bc('0x37')]=_[_0xe0bc('0x36')](_0x59dbfc[_0xe0bc('0x38')],qs['fields'](_0xd1c1c[_0xe0bc('0x34')]['fields']));_0x476a46[_0xe0bc('0x37')]=_0x476a46[_0xe0bc('0x37')][_0xe0bc('0x39')]?_0x476a46['attributes']:_0x59dbfc['model'];if(!_0xd1c1c[_0xe0bc('0x34')][_0xe0bc('0x3a')](_0xe0bc('0x3b'))){_0x476a46[_0xe0bc('0x22')]=qs[_0xe0bc('0x22')](_0xd1c1c[_0xe0bc('0x34')][_0xe0bc('0x22')]);_0x476a46[_0xe0bc('0x21')]=qs[_0xe0bc('0x21')](_0xd1c1c['query'][_0xe0bc('0x21')]);}_0x476a46[_0xe0bc('0x3c')]=qs['sort'](_0xd1c1c[_0xe0bc('0x34')][_0xe0bc('0x3d')]);_0x476a46[_0xe0bc('0x3e')]=qs[_0xe0bc('0x3f')](_[_0xe0bc('0x40')](_0xd1c1c[_0xe0bc('0x34')],_0x59dbfc[_0xe0bc('0x3f')]),_0x5f2952);if(_0xd1c1c[_0xe0bc('0x34')][_0xe0bc('0x41')]){_0x476a46[_0xe0bc('0x3e')]=_[_0xe0bc('0x42')](_0x476a46[_0xe0bc('0x3e')],{'$or':_[_0xe0bc('0x2e')](_0x5f2952,function(_0x7764d3){if(_0x7764d3[_0xe0bc('0x32')]!=='VIRTUAL'){var _0x21ab85={};_0x21ab85[_0x7764d3[_0xe0bc('0x2b')]]={'$like':'%'+_0xd1c1c[_0xe0bc('0x34')][_0xe0bc('0x41')]+'%'};return _0x21ab85;}})});}_0x476a46=_[_0xe0bc('0x42')]({},_0x476a46,_0xd1c1c[_0xe0bc('0x43')]);var _0x2a6d98={'where':_0x476a46['where']};return db['IntegrationReport'][_0xe0bc('0x20')](_0x2a6d98)[_0xe0bc('0x28')](function(_0x371741){_0x385a52['count']=_0x371741;if(_0xd1c1c['query'][_0xe0bc('0x44')]){_0x476a46[_0xe0bc('0x45')]=[{'all':!![]}];}return db[_0xe0bc('0x2f')][_0xe0bc('0x46')](_0x476a46);})['then'](function(_0x1e74f){_0x385a52[_0xe0bc('0x47')]=_0x1e74f;return _0x385a52;})[_0xe0bc('0x28')](respondWithFilteredResult(_0x222b05,_0x476a46))[_0xe0bc('0x48')](handleError(_0x222b05,null));};exports['show']=function(_0x22a825,_0x3d7905){var _0x338609={'raw':![],'where':{'id':_0x22a825['params']['id']}},_0x3eb70a={};_0x3eb70a[_0xe0bc('0x38')]=_[_0xe0bc('0x35')](db['IntegrationReport'][_0xe0bc('0x30')]);_0x3eb70a['query']=_['keys'](_0x22a825[_0xe0bc('0x34')]);_0x3eb70a[_0xe0bc('0x3f')]=_['intersection'](_0x3eb70a[_0xe0bc('0x38')],_0x3eb70a[_0xe0bc('0x34')]);_0x338609[_0xe0bc('0x37')]=_['intersection'](_0x3eb70a[_0xe0bc('0x38')],qs[_0xe0bc('0x49')](_0x22a825['query'][_0xe0bc('0x49')]));_0x338609['attributes']=_0x338609[_0xe0bc('0x37')][_0xe0bc('0x39')]?_0x338609[_0xe0bc('0x37')]:_0x3eb70a[_0xe0bc('0x38')];if(_0x22a825['query'][_0xe0bc('0x44')]){_0x338609[_0xe0bc('0x45')]=[{'all':!![]}];}_0x338609=_[_0xe0bc('0x42')]({},_0x338609,_0x22a825['options']);return db[_0xe0bc('0x2f')][_0xe0bc('0x4a')](_0x338609)[_0xe0bc('0x28')](handleEntityNotFound(_0x3d7905,null))[_0xe0bc('0x28')](respondWithResult(_0x3d7905,null))[_0xe0bc('0x48')](handleError(_0x3d7905,null));};exports['create']=function(_0x11882c,_0x3b27ea){return db[_0xe0bc('0x2f')][_0xe0bc('0x4b')](_0x11882c['body'],{})[_0xe0bc('0x28')](respondWithResult(_0x3b27ea,0xc9))['catch'](handleError(_0x3b27ea,null));};exports[_0xe0bc('0x4c')]=function(_0x2a6f82,_0x47de20){if(_0x2a6f82[_0xe0bc('0x4d')]['id']){delete _0x2a6f82['body']['id'];}return db[_0xe0bc('0x2f')][_0xe0bc('0x4a')]({'where':{'id':_0x2a6f82[_0xe0bc('0x4e')]['id']}})[_0xe0bc('0x28')](handleEntityNotFound(_0x47de20,null))[_0xe0bc('0x28')](saveUpdates(_0x2a6f82[_0xe0bc('0x4d')],null))['then'](respondWithResult(_0x47de20,null))[_0xe0bc('0x48')](handleError(_0x47de20,null));};exports[_0xe0bc('0x29')]=function(_0x3e7183,_0x11d5ea){return db[_0xe0bc('0x2f')][_0xe0bc('0x4a')]({'where':{'id':_0x3e7183[_0xe0bc('0x4e')]['id']}})[_0xe0bc('0x28')](handleEntityNotFound(_0x11d5ea,null))['then'](removeEntity(_0x11d5ea,null))[_0xe0bc('0x48')](handleError(_0x11d5ea,null));};exports[_0xe0bc('0x4f')]=function(_0x269a36,_0x25b28a){return db[_0xe0bc('0x2f')][_0xe0bc('0x4f')]()['then'](respondWithResult(_0x25b28a,null))[_0xe0bc('0x48')](handleError(_0x25b28a,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 68c457c..d559d7d 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 _0x89a9=['rimraf','exports','IntegrationReport','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x9bdf7b,_0x2adb5e){var _0x485401=function(_0x1c84b4){while(--_0x1c84b4){_0x9bdf7b['push'](_0x9bdf7b['shift']());}};_0x485401(++_0x2adb5e);}(_0x89a9,0xfd));var _0x989a=function(_0x39d806,_0x627fd2){_0x39d806=_0x39d806-0x0;var _0x16b0e1=_0x89a9[_0x39d806];return _0x16b0e1;};'use strict';var _=require(_0x989a('0x0'));var util=require(_0x989a('0x1'));var logger=require('../../config/logger')(_0x989a('0x2'));var moment=require(_0x989a('0x3'));var BPromise=require(_0x989a('0x4'));var rp=require(_0x989a('0x5'));var fs=require('fs');var path=require(_0x989a('0x6'));var rimraf=require(_0x989a('0x7'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x989a('0x8')]=function(_0x249e3c,_0x545fcf){return _0x249e3c['define'](_0x989a('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecba=['moment','path','rimraf','../../config/environment','exports','define','report_integration','lodash','util','../../config/logger','api'];(function(_0x6a16e,_0x1a5e0f){var _0x2b5fdf=function(_0x258949){while(--_0x258949){_0x6a16e['push'](_0x6a16e['shift']());}};_0x2b5fdf(++_0x1a5e0f);}(_0xecba,0x167));var _0xaecb=function(_0x456ebe,_0xca6668){_0x456ebe=_0x456ebe-0x0;var _0x3041d9=_0xecba[_0x456ebe];return _0x3041d9;};'use strict';var _=require(_0xaecb('0x0'));var util=require(_0xaecb('0x1'));var logger=require(_0xaecb('0x2'))(_0xaecb('0x3'));var moment=require(_0xaecb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaecb('0x5'));var rimraf=require(_0xaecb('0x6'));var config=require(_0xaecb('0x7'));var attributes=require('./integrationReport.attributes');module[_0xaecb('0x8')]=function(_0x3385a8,_0x154b81){return _0x3385a8[_0xaecb('0x9')]('IntegrationReport',attributes,{'tableName':_0xaecb('0xa'),'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 881ddfb..64ea8d5 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 _0x0713=['IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\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(_0x1fcc68,_0x10acce){var _0x1c2bbc=function(_0x233917){while(--_0x233917){_0x1fcc68['push'](_0x1fcc68['shift']());}};_0x1c2bbc(++_0x10acce);}(_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')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('IntegrationReport,\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')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8603,0x190));var _0x3860=function(_0x31a25e,_0x171d87){_0x31a25e=_0x31a25e-0x0;var _0x3c8ab5=_0x8603[_0x31a25e];return _0x3c8ab5;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index e6a78e1..0bce864 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 _0xf700=['/:id','show','getIntervals','post','/:id/sub_intervals','addInterval','addIntervals','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get'];(function(_0x58fdc5,_0x5986a){var _0x121190=function(_0x28bd5c){while(--_0x28bd5c){_0x58fdc5['push'](_0x58fdc5['shift']());}};_0x121190(++_0x5986a);}(_0xf700,0x143));var _0x0f70=function(_0xdde91,_0x3ae43e){_0xdde91=_0xdde91-0x0;var _0x1166d4=_0xf700[_0xdde91];return _0x1166d4;};'use strict';var multer=require(_0x0f70('0x0'));var util=require('util');var path=require(_0x0f70('0x1'));var timeout=require(_0x0f70('0x2'));var express=require(_0x0f70('0x3'));var router=express[_0x0f70('0x4')]();var fs_extra=require(_0x0f70('0x5'));var auth=require(_0x0f70('0x6'));var interaction=require(_0x0f70('0x7'));var config=require(_0x0f70('0x8'));var controller=require(_0x0f70('0x9'));router['get']('/',auth[_0x0f70('0xa')](),controller[_0x0f70('0xb')]);router[_0x0f70('0xc')](_0x0f70('0xd'),auth[_0x0f70('0xa')](),controller[_0x0f70('0xe')]);router[_0x0f70('0xc')]('/:id/sub_intervals',auth[_0x0f70('0xa')](),controller[_0x0f70('0xf')]);router[_0x0f70('0x10')]('/',auth[_0x0f70('0xa')](),controller['create']);router[_0x0f70('0x10')](_0x0f70('0x11'),auth['isAuthenticated'](),controller[_0x0f70('0x12')]);router[_0x0f70('0x10')]('/:id/sub_intervals/create_many',auth[_0x0f70('0xa')](),controller[_0x0f70('0x13')]);router[_0x0f70('0x14')](_0x0f70('0xd'),auth[_0x0f70('0xa')](),controller[_0x0f70('0x15')]);router['delete']('/:id',auth[_0x0f70('0xa')](),controller[_0x0f70('0x16')]);module[_0x0f70('0x17')]=router; \ No newline at end of file +var _0xdbf7=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','destroy','exports','multer','util','path'];(function(_0x59c1be,_0xba160a){var _0x47c031=function(_0xb62b0b){while(--_0xb62b0b){_0x59c1be['push'](_0x59c1be['shift']());}};_0x47c031(++_0xba160a);}(_0xdbf7,0x8d));var _0x7dbf=function(_0x47d457,_0x1e06d1){_0x47d457=_0x47d457-0x0;var _0x344422=_0xdbf7[_0x47d457];return _0x344422;};'use strict';var multer=require(_0x7dbf('0x0'));var util=require(_0x7dbf('0x1'));var path=require(_0x7dbf('0x2'));var timeout=require(_0x7dbf('0x3'));var express=require(_0x7dbf('0x4'));var router=express[_0x7dbf('0x5')]();var fs_extra=require(_0x7dbf('0x6'));var auth=require(_0x7dbf('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7dbf('0x8'));var controller=require('./interval.controller');router['get']('/',auth[_0x7dbf('0x9')](),controller[_0x7dbf('0xa')]);router[_0x7dbf('0xb')](_0x7dbf('0xc'),auth[_0x7dbf('0x9')](),controller[_0x7dbf('0xd')]);router[_0x7dbf('0xb')](_0x7dbf('0xe'),auth[_0x7dbf('0x9')](),controller[_0x7dbf('0xf')]);router[_0x7dbf('0x10')]('/',auth[_0x7dbf('0x9')](),controller[_0x7dbf('0x11')]);router[_0x7dbf('0x10')](_0x7dbf('0xe'),auth['isAuthenticated'](),controller[_0x7dbf('0x12')]);router[_0x7dbf('0x10')](_0x7dbf('0x13'),auth[_0x7dbf('0x9')](),controller[_0x7dbf('0x14')]);router[_0x7dbf('0x15')]('/:id',auth[_0x7dbf('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7dbf('0x16')]);module[_0x7dbf('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 387cee7..a8d4d0c 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 _0x5e61=['STRING','sequelize','exports'];(function(_0x1d7932,_0x5e7bbd){var _0x4be1ac=function(_0x3fdef9){while(--_0x3fdef9){_0x1d7932['push'](_0x1d7932['shift']());}};_0x4be1ac(++_0x5e7bbd);}(_0x5e61,0xd6));var _0x15e6=function(_0x49185d,_0x52126f){_0x49185d=_0x49185d-0x0;var _0x47fd5e=_0x5e61[_0x49185d];return _0x47fd5e;};'use strict';var Sequelize=require(_0x15e6('0x0'));module[_0x15e6('0x1')]={'name':{'type':Sequelize[_0x15e6('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x15e6('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x2515=['STRING','sequelize','exports'];(function(_0x4a77b3,_0xc9d9d2){var _0x42b4f0=function(_0x2ee47d){while(--_0x2ee47d){_0x4a77b3['push'](_0x4a77b3['shift']());}};_0x42b4f0(++_0xc9d9d2);}(_0x2515,0x7f));var _0x5251=function(_0x2cbaa7,_0x52f78c){_0x2cbaa7=_0x2cbaa7-0x0;var _0x50818f=_0x2515[_0x2cbaa7];return _0x50818f;};'use strict';var Sequelize=require(_0x5251('0x0'));module[_0x5251('0x1')]={'name':{'type':Sequelize[_0x5251('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5251('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 08da568..5ccb6e2 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 _0x7a54=['papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','Intervals','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','rawAttributes','merge','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','IntervalId','keys','getIntervals','hasOwnProperty','nolimit','findOne','bulkCreate','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce'];(function(_0x138286,_0xd5349e){var _0x161864=function(_0x2b67ad){while(--_0x2b67ad){_0x138286['push'](_0x138286['shift']());}};_0x161864(++_0xd5349e);}(_0x7a54,0x106));var _0x47a5=function(_0x58ce21,_0x868964){_0x58ce21=_0x58ce21-0x0;var _0x3a7404=_0x7a54[_0x58ce21];return _0x3a7404;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47a5('0xb'));var squel=require(_0x47a5('0xc'));var crypto=require('crypto');var jsforce=require(_0x47a5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x47a5('0xe'));var Redis=require(_0x47a5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x47a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x47a5('0x11'))(_0x47a5('0x12'));var utils=require(_0x47a5('0x13'));var config=require(_0x47a5('0x14'));var licenseUtil=require(_0x47a5('0x15'));var db=require(_0x47a5('0x16'))['db'];var extensions=require(_0x47a5('0x17'));function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x18')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x19')](_0x44bd3e)[_0x47a5('0x1a')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1b')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=_0x2a2cbb['count'],_0x574af6=_0x3b001e['offset'],_0x549de3=_0x3b001e[_0x47a5('0x1c')]+_0x3b001e[_0x47a5('0x1d')],_0x138bc0;if(_0x549de3>=_0x1ef44c){_0x549de3=_0x1ef44c;_0x138bc0=0xc8;}else{_0x138bc0=0xce;}_0x11faf5[_0x47a5('0x19')](_0x138bc0);return _0x11faf5[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x574af6+'-'+_0x549de3+'/'+_0x1ef44c)[_0x47a5('0x1b')](_0x2a2cbb);}return null;};}function patchUpdates(_0x2763d6){return function(_0xe3c618){try{jsonpatch[_0x47a5('0x20')](_0xe3c618,_0x2763d6,!![]);}catch(_0x4a9fcb){return BPromise[_0x47a5('0x21')](_0x4a9fcb);}return _0xe3c618[_0x47a5('0x22')]();};}function saveUpdates(_0x47cf3c,_0x2b0360){return function(_0x1f03f7){if(_0x1f03f7){return _0x1f03f7[_0x47a5('0x23')](_0x47cf3c)['then'](function(_0xb8ae6c){return _0xb8ae6c;});}return null;};}function removeEntity(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['destroy']()[_0x47a5('0x24')](function(){var _0x385687=_0x7a9f9e['get']({'plain':!![]});var _0x28747d=_0x47a5('0x25');return db[_0x47a5('0x26')][_0x47a5('0x27')]({'where':{'type':_0x28747d,'resourceId':_0x385687['id']}})[_0x47a5('0x24')](function(){return _0x7a9f9e;});})['then'](function(){_0x2f142b['status'](0xcc)[_0x47a5('0x1a')]();});}};}function handleEntityNotFound(_0x5686db,_0x1ea9c8){return function(_0x5b6c4e){if(!_0x5b6c4e){_0x5686db[_0x47a5('0x18')](0x194);}return _0x5b6c4e;};}function handleError(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0x1f4;return function(_0x1dac65){logger[_0x47a5('0x28')](_0x1dac65[_0x47a5('0x29')]);if(_0x1dac65[_0x47a5('0x2a')]){delete _0x1dac65[_0x47a5('0x2a')];}_0x378208[_0x47a5('0x19')](_0x36ad34)[_0x47a5('0x2b')](_0x1dac65);};}exports[_0x47a5('0x2c')]=function(_0x11a4fa,_0x3ad507){var _0x528582={},_0x243210={},_0x51833b={'count':0x0,'rows':[]};var _0x2ef875=_[_0x47a5('0x2d')](db[_0x47a5('0x2e')]['rawAttributes'],function(_0x256650){return{'name':_0x256650[_0x47a5('0x2f')],'type':_0x256650[_0x47a5('0x30')][_0x47a5('0x31')]};});_0x243210['model']=_['map'](_0x2ef875,_0x47a5('0x2a'));_0x243210[_0x47a5('0x32')]=_['keys'](_0x11a4fa['query']);_0x243210[_0x47a5('0x33')]=_[_0x47a5('0x34')](_0x243210['model'],_0x243210[_0x47a5('0x32')]);_0x528582['attributes']=_[_0x47a5('0x34')](_0x243210[_0x47a5('0x35')],qs['fields'](_0x11a4fa['query'][_0x47a5('0x36')]));_0x528582['attributes']=_0x528582[_0x47a5('0x37')][_0x47a5('0x38')]?_0x528582[_0x47a5('0x37')]:_0x243210['model'];if(!_0x11a4fa[_0x47a5('0x32')]['hasOwnProperty']('nolimit')){_0x528582[_0x47a5('0x1d')]=qs['limit'](_0x11a4fa[_0x47a5('0x32')]['limit']);_0x528582[_0x47a5('0x1c')]=qs[_0x47a5('0x1c')](_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x1c')]);}_0x528582[_0x47a5('0x39')]=qs[_0x47a5('0x3a')](_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x3a')]);_0x528582[_0x47a5('0x3b')]=qs['filters'](_[_0x47a5('0x3c')](_0x11a4fa[_0x47a5('0x32')],_0x243210['filters']),_0x2ef875);if(_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x3d')]){_0x528582[_0x47a5('0x3b')]=_['merge'](_0x528582[_0x47a5('0x3b')],{'$or':_[_0x47a5('0x2d')](_0x2ef875,function(_0x596097){if(_0x596097[_0x47a5('0x30')]!==_0x47a5('0x3e')){var _0x54ae35={};_0x54ae35[_0x596097['name']]={'$like':'%'+_0x11a4fa['query'][_0x47a5('0x3d')]+'%'};return _0x54ae35;}})});}_0x528582=_['merge']({},_0x528582,_0x11a4fa[_0x47a5('0x3f')]);var _0x1f9631={'where':_0x528582[_0x47a5('0x3b')]};return db[_0x47a5('0x2e')][_0x47a5('0x40')](_0x1f9631)[_0x47a5('0x24')](function(_0x2003b0){_0x51833b[_0x47a5('0x40')]=_0x2003b0;if(_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x41')]){_0x528582[_0x47a5('0x42')]=[{'all':!![]}];}return db[_0x47a5('0x2e')][_0x47a5('0x43')](_0x528582);})['then'](function(_0x1fbece){_0x51833b[_0x47a5('0x44')]=_0x1fbece;return _0x51833b;})[_0x47a5('0x24')](respondWithFilteredResult(_0x3ad507,_0x528582))[_0x47a5('0x45')](handleError(_0x3ad507,null));};exports['show']=function(_0x7de536,_0x528ef3){var _0x47c7a2={'raw':!![],'where':{'id':_0x7de536['params']['id']}},_0x55c43d={};_0x55c43d[_0x47a5('0x35')]=_['keys'](db[_0x47a5('0x2e')][_0x47a5('0x46')]);_0x55c43d[_0x47a5('0x32')]=_['keys'](_0x7de536[_0x47a5('0x32')]);_0x55c43d[_0x47a5('0x33')]=_['intersection'](_0x55c43d['model'],_0x55c43d[_0x47a5('0x32')]);_0x47c7a2['attributes']=_[_0x47a5('0x34')](_0x55c43d[_0x47a5('0x35')],qs[_0x47a5('0x36')](_0x7de536[_0x47a5('0x32')][_0x47a5('0x36')]));_0x47c7a2[_0x47a5('0x37')]=_0x47c7a2[_0x47a5('0x37')][_0x47a5('0x38')]?_0x47c7a2[_0x47a5('0x37')]:_0x55c43d[_0x47a5('0x35')];if(_0x7de536[_0x47a5('0x32')][_0x47a5('0x41')]){_0x47c7a2[_0x47a5('0x42')]=[{'all':!![]}];}_0x47c7a2=_[_0x47a5('0x47')]({},_0x47c7a2,_0x7de536[_0x47a5('0x3f')]);return db[_0x47a5('0x2e')]['find'](_0x47c7a2)[_0x47a5('0x24')](handleEntityNotFound(_0x528ef3,null))[_0x47a5('0x24')](respondWithResult(_0x528ef3,null))['catch'](handleError(_0x528ef3,null));};exports['create']=function(_0x3d0a88,_0x560e4e){return db[_0x47a5('0x2e')][_0x47a5('0x48')](_0x3d0a88['body'],{})['then'](function(_0x3d85cc){var _0x52d409=_0x3d0a88[_0x47a5('0x49')][_0x47a5('0x4a')]({'plain':!![]});if(!_0x52d409)throw new Error(_0x47a5('0x4b'));if(_0x52d409[_0x47a5('0x4c')]===_0x47a5('0x49')){var _0x26acd2=_0x3d85cc[_0x47a5('0x4a')]({'plain':!![]});var _0x53e994='Intervals';return db[_0x47a5('0x4d')][_0x47a5('0x4e')]({'where':{'name':_0x53e994,'userProfileId':_0x52d409[_0x47a5('0x4f')]},'raw':!![]})[_0x47a5('0x24')](function(_0x2c7020){if(_0x2c7020&&_0x2c7020[_0x47a5('0x50')]===0x0){return db[_0x47a5('0x26')]['create']({'name':_0x26acd2[_0x47a5('0x2a')],'resourceId':_0x26acd2['id'],'type':_0x2c7020[_0x47a5('0x2a')],'sectionId':_0x2c7020['id']},{})[_0x47a5('0x24')](function(){return _0x3d85cc;});}else{return _0x3d85cc;}})['catch'](function(_0x12ca40){logger['error'](_0x47a5('0x51'),_0x12ca40);throw _0x12ca40;});}return _0x3d85cc;})[_0x47a5('0x24')](respondWithResult(_0x560e4e,0xc9))[_0x47a5('0x45')](handleError(_0x560e4e,null));};exports[_0x47a5('0x23')]=function(_0x588551,_0x3adf14){if(_0x588551[_0x47a5('0x52')]['id']){delete _0x588551[_0x47a5('0x52')]['id'];}return db[_0x47a5('0x2e')][_0x47a5('0x4e')]({'where':{'id':_0x588551[_0x47a5('0x53')]['id']}})[_0x47a5('0x24')](handleEntityNotFound(_0x3adf14,null))['then'](saveUpdates(_0x588551[_0x47a5('0x52')],null))[_0x47a5('0x24')](respondWithResult(_0x3adf14,null))[_0x47a5('0x45')](handleError(_0x3adf14,null));};exports[_0x47a5('0x27')]=function(_0x3329aa,_0x1ab0bf){return db['Interval'][_0x47a5('0x4e')]({'where':{'id':_0x3329aa[_0x47a5('0x53')]['id']}})[_0x47a5('0x24')](handleEntityNotFound(_0x1ab0bf,null))['then'](removeEntity(_0x1ab0bf,null))[_0x47a5('0x45')](handleError(_0x1ab0bf,null));};exports[_0x47a5('0x54')]=function(_0x183b3c,_0x5d8d4a,_0x57641e){if(_0x183b3c[_0x47a5('0x52')]['id']){delete _0x183b3c[_0x47a5('0x52')]['id'];}return db['Interval']['find']({'where':{'id':_0x183b3c[_0x47a5('0x53')]['id']}})['then'](handleEntityNotFound(_0x5d8d4a,null))[_0x47a5('0x24')](function(_0x5d383d){if(_0x5d383d){_0x183b3c['body'][_0x47a5('0x55')]=_0x5d383d['id'];return db[_0x47a5('0x2e')]['create'](_0x183b3c[_0x47a5('0x52')]);}})[_0x47a5('0x24')](respondWithResult(_0x5d8d4a,null))['catch'](handleError(_0x5d8d4a,null));};exports['getIntervals']=function(_0x16b4fd,_0x30d482,_0x867da0){var _0x2931e4={};var _0x5996c4={};var _0x199621;var _0x2b4255;return db[_0x47a5('0x2e')]['findOne']({'where':{'id':_0x16b4fd[_0x47a5('0x53')]['id']}})['then'](handleEntityNotFound(_0x30d482,null))[_0x47a5('0x24')](function(_0x470da6){if(_0x470da6){_0x199621=_0x470da6;_0x5996c4[_0x47a5('0x35')]=_[_0x47a5('0x56')](db[_0x47a5('0x2e')]['rawAttributes']);_0x5996c4[_0x47a5('0x32')]=_['keys'](_0x16b4fd['query']);_0x5996c4['filters']=_['intersection'](_0x5996c4[_0x47a5('0x35')],_0x5996c4[_0x47a5('0x32')]);_0x2931e4[_0x47a5('0x37')]=_['intersection'](_0x5996c4['model'],qs[_0x47a5('0x36')](_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x36')]));_0x2931e4[_0x47a5('0x37')]=_0x2931e4[_0x47a5('0x37')]['length']?_0x2931e4[_0x47a5('0x37')]:_0x5996c4['model'];_0x2931e4[_0x47a5('0x39')]=qs[_0x47a5('0x3a')](_0x16b4fd['query'][_0x47a5('0x3a')]);_0x2931e4[_0x47a5('0x3b')]=qs[_0x47a5('0x33')](_[_0x47a5('0x3c')](_0x16b4fd[_0x47a5('0x32')],_0x5996c4[_0x47a5('0x33')]));if(_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x3d')]){_0x2931e4['where']=_[_0x47a5('0x47')](_0x2931e4[_0x47a5('0x3b')],{'$or':_[_0x47a5('0x2d')](_0x2931e4[_0x47a5('0x37')],function(_0x396cb0){var _0x4bbe14={};_0x4bbe14[_0x396cb0]={'$like':'%'+_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x3d')]+'%'};return _0x4bbe14;})});}_0x2931e4=_[_0x47a5('0x47')]({},_0x2931e4,_0x16b4fd[_0x47a5('0x3f')]);return _0x199621[_0x47a5('0x57')](_0x2931e4);}})[_0x47a5('0x24')](function(_0x453191){if(_0x453191){_0x2b4255=_0x453191[_0x47a5('0x38')];if(!_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x58')](_0x47a5('0x59'))){_0x2931e4[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x1d')]);_0x2931e4['offset']=qs[_0x47a5('0x1c')](_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x1c')]);}return _0x199621['getIntervals'](_0x2931e4);}})[_0x47a5('0x24')](function(_0x2e46af){if(_0x2e46af){return _0x2e46af?{'count':_0x2b4255,'rows':_0x2e46af}:null;}})[_0x47a5('0x24')](respondWithResult(_0x30d482,null))[_0x47a5('0x45')](handleError(_0x30d482,null));};exports['addIntervals']=function(_0x3ac402,_0x522ccf,_0x2d5ee6){return db['Interval'][_0x47a5('0x5a')]({'where':{'id':_0x3ac402['params']['id']}})[_0x47a5('0x24')](handleEntityNotFound(_0x522ccf,null))[_0x47a5('0x24')](function(_0x2578d6){if(_0x2578d6){return db['sequelize']['transaction'](function(_0x4b8084){return db[_0x47a5('0x2e')][_0x47a5('0x27')]({'where':{'IntervalId':_0x3ac402[_0x47a5('0x53')]['id']},'transaction':_0x4b8084})[_0x47a5('0x24')](function(_0x525055){var _0x6c0f0=_[_0x47a5('0x2d')](_0x3ac402[_0x47a5('0x52')],function(_0xd5b23f){delete _0xd5b23f['id'];_0xd5b23f[_0x47a5('0x55')]=_0x3ac402[_0x47a5('0x53')]['id'];return _0xd5b23f;});return db[_0x47a5('0x2e')][_0x47a5('0x5b')](_0x6c0f0,{'transaction':_0x4b8084});});})[_0x47a5('0x24')](function(){return db[_0x47a5('0x2e')][_0x47a5('0x43')]({'where':{'IntervalId':_0x3ac402[_0x47a5('0x53')]['id']}});});}})['then'](respondWithResult(_0x522ccf,null))[_0x47a5('0x45')](handleError(_0x522ccf,null));}; \ No newline at end of file +var _0x7a54=['papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','Intervals','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','rawAttributes','merge','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','IntervalId','keys','getIntervals','hasOwnProperty','nolimit','findOne','bulkCreate','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce'];(function(_0x505e57,_0xcbb2c9){var _0x2d4b25=function(_0x177a49){while(--_0x177a49){_0x505e57['push'](_0x505e57['shift']());}};_0x2d4b25(++_0xcbb2c9);}(_0x7a54,0x106));var _0x47a5=function(_0x3da673,_0x49ecf7){_0x3da673=_0x3da673-0x0;var _0x37526a=_0x7a54[_0x3da673];return _0x37526a;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47a5('0xb'));var squel=require(_0x47a5('0xc'));var crypto=require('crypto');var jsforce=require(_0x47a5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x47a5('0xe'));var Redis=require(_0x47a5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x47a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x47a5('0x11'))(_0x47a5('0x12'));var utils=require(_0x47a5('0x13'));var config=require(_0x47a5('0x14'));var licenseUtil=require(_0x47a5('0x15'));var db=require(_0x47a5('0x16'))['db'];var extensions=require(_0x47a5('0x17'));function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x18')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x19')](_0x44bd3e)[_0x47a5('0x1a')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1b')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=_0x2a2cbb['count'],_0x574af6=_0x3b001e['offset'],_0x549de3=_0x3b001e[_0x47a5('0x1c')]+_0x3b001e[_0x47a5('0x1d')],_0x138bc0;if(_0x549de3>=_0x1ef44c){_0x549de3=_0x1ef44c;_0x138bc0=0xc8;}else{_0x138bc0=0xce;}_0x11faf5[_0x47a5('0x19')](_0x138bc0);return _0x11faf5[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x574af6+'-'+_0x549de3+'/'+_0x1ef44c)[_0x47a5('0x1b')](_0x2a2cbb);}return null;};}function patchUpdates(_0x2763d6){return function(_0xe3c618){try{jsonpatch[_0x47a5('0x20')](_0xe3c618,_0x2763d6,!![]);}catch(_0x4a9fcb){return BPromise[_0x47a5('0x21')](_0x4a9fcb);}return _0xe3c618[_0x47a5('0x22')]();};}function saveUpdates(_0x47cf3c,_0x2b0360){return function(_0x1f03f7){if(_0x1f03f7){return _0x1f03f7[_0x47a5('0x23')](_0x47cf3c)['then'](function(_0xb8ae6c){return _0xb8ae6c;});}return null;};}function removeEntity(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['destroy']()[_0x47a5('0x24')](function(){var _0x385687=_0x7a9f9e['get']({'plain':!![]});var _0x28747d=_0x47a5('0x25');return db[_0x47a5('0x26')][_0x47a5('0x27')]({'where':{'type':_0x28747d,'resourceId':_0x385687['id']}})[_0x47a5('0x24')](function(){return _0x7a9f9e;});})['then'](function(){_0x2f142b['status'](0xcc)[_0x47a5('0x1a')]();});}};}function handleEntityNotFound(_0x5686db,_0x1ea9c8){return function(_0x5b6c4e){if(!_0x5b6c4e){_0x5686db[_0x47a5('0x18')](0x194);}return _0x5b6c4e;};}function handleError(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0x1f4;return function(_0x1dac65){logger[_0x47a5('0x28')](_0x1dac65[_0x47a5('0x29')]);if(_0x1dac65[_0x47a5('0x2a')]){delete _0x1dac65[_0x47a5('0x2a')];}_0x378208[_0x47a5('0x19')](_0x36ad34)[_0x47a5('0x2b')](_0x1dac65);};}exports[_0x47a5('0x2c')]=function(_0x11a4fa,_0x3ad507){var _0x528582={},_0x243210={},_0x51833b={'count':0x0,'rows':[]};var _0x2ef875=_[_0x47a5('0x2d')](db[_0x47a5('0x2e')]['rawAttributes'],function(_0x256650){return{'name':_0x256650[_0x47a5('0x2f')],'type':_0x256650[_0x47a5('0x30')][_0x47a5('0x31')]};});_0x243210['model']=_['map'](_0x2ef875,_0x47a5('0x2a'));_0x243210[_0x47a5('0x32')]=_['keys'](_0x11a4fa['query']);_0x243210[_0x47a5('0x33')]=_[_0x47a5('0x34')](_0x243210['model'],_0x243210[_0x47a5('0x32')]);_0x528582['attributes']=_[_0x47a5('0x34')](_0x243210[_0x47a5('0x35')],qs['fields'](_0x11a4fa['query'][_0x47a5('0x36')]));_0x528582['attributes']=_0x528582[_0x47a5('0x37')][_0x47a5('0x38')]?_0x528582[_0x47a5('0x37')]:_0x243210['model'];if(!_0x11a4fa[_0x47a5('0x32')]['hasOwnProperty']('nolimit')){_0x528582[_0x47a5('0x1d')]=qs['limit'](_0x11a4fa[_0x47a5('0x32')]['limit']);_0x528582[_0x47a5('0x1c')]=qs[_0x47a5('0x1c')](_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x1c')]);}_0x528582[_0x47a5('0x39')]=qs[_0x47a5('0x3a')](_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x3a')]);_0x528582[_0x47a5('0x3b')]=qs['filters'](_[_0x47a5('0x3c')](_0x11a4fa[_0x47a5('0x32')],_0x243210['filters']),_0x2ef875);if(_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x3d')]){_0x528582[_0x47a5('0x3b')]=_['merge'](_0x528582[_0x47a5('0x3b')],{'$or':_[_0x47a5('0x2d')](_0x2ef875,function(_0x596097){if(_0x596097[_0x47a5('0x30')]!==_0x47a5('0x3e')){var _0x54ae35={};_0x54ae35[_0x596097['name']]={'$like':'%'+_0x11a4fa['query'][_0x47a5('0x3d')]+'%'};return _0x54ae35;}})});}_0x528582=_['merge']({},_0x528582,_0x11a4fa[_0x47a5('0x3f')]);var _0x1f9631={'where':_0x528582[_0x47a5('0x3b')]};return db[_0x47a5('0x2e')][_0x47a5('0x40')](_0x1f9631)[_0x47a5('0x24')](function(_0x2003b0){_0x51833b[_0x47a5('0x40')]=_0x2003b0;if(_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x41')]){_0x528582[_0x47a5('0x42')]=[{'all':!![]}];}return db[_0x47a5('0x2e')][_0x47a5('0x43')](_0x528582);})['then'](function(_0x1fbece){_0x51833b[_0x47a5('0x44')]=_0x1fbece;return _0x51833b;})[_0x47a5('0x24')](respondWithFilteredResult(_0x3ad507,_0x528582))[_0x47a5('0x45')](handleError(_0x3ad507,null));};exports['show']=function(_0x7de536,_0x528ef3){var _0x47c7a2={'raw':!![],'where':{'id':_0x7de536['params']['id']}},_0x55c43d={};_0x55c43d[_0x47a5('0x35')]=_['keys'](db[_0x47a5('0x2e')][_0x47a5('0x46')]);_0x55c43d[_0x47a5('0x32')]=_['keys'](_0x7de536[_0x47a5('0x32')]);_0x55c43d[_0x47a5('0x33')]=_['intersection'](_0x55c43d['model'],_0x55c43d[_0x47a5('0x32')]);_0x47c7a2['attributes']=_[_0x47a5('0x34')](_0x55c43d[_0x47a5('0x35')],qs[_0x47a5('0x36')](_0x7de536[_0x47a5('0x32')][_0x47a5('0x36')]));_0x47c7a2[_0x47a5('0x37')]=_0x47c7a2[_0x47a5('0x37')][_0x47a5('0x38')]?_0x47c7a2[_0x47a5('0x37')]:_0x55c43d[_0x47a5('0x35')];if(_0x7de536[_0x47a5('0x32')][_0x47a5('0x41')]){_0x47c7a2[_0x47a5('0x42')]=[{'all':!![]}];}_0x47c7a2=_[_0x47a5('0x47')]({},_0x47c7a2,_0x7de536[_0x47a5('0x3f')]);return db[_0x47a5('0x2e')]['find'](_0x47c7a2)[_0x47a5('0x24')](handleEntityNotFound(_0x528ef3,null))[_0x47a5('0x24')](respondWithResult(_0x528ef3,null))['catch'](handleError(_0x528ef3,null));};exports['create']=function(_0x3d0a88,_0x560e4e){return db[_0x47a5('0x2e')][_0x47a5('0x48')](_0x3d0a88['body'],{})['then'](function(_0x3d85cc){var _0x52d409=_0x3d0a88[_0x47a5('0x49')][_0x47a5('0x4a')]({'plain':!![]});if(!_0x52d409)throw new Error(_0x47a5('0x4b'));if(_0x52d409[_0x47a5('0x4c')]===_0x47a5('0x49')){var _0x26acd2=_0x3d85cc[_0x47a5('0x4a')]({'plain':!![]});var _0x53e994='Intervals';return db[_0x47a5('0x4d')][_0x47a5('0x4e')]({'where':{'name':_0x53e994,'userProfileId':_0x52d409[_0x47a5('0x4f')]},'raw':!![]})[_0x47a5('0x24')](function(_0x2c7020){if(_0x2c7020&&_0x2c7020[_0x47a5('0x50')]===0x0){return db[_0x47a5('0x26')]['create']({'name':_0x26acd2[_0x47a5('0x2a')],'resourceId':_0x26acd2['id'],'type':_0x2c7020[_0x47a5('0x2a')],'sectionId':_0x2c7020['id']},{})[_0x47a5('0x24')](function(){return _0x3d85cc;});}else{return _0x3d85cc;}})['catch'](function(_0x12ca40){logger['error'](_0x47a5('0x51'),_0x12ca40);throw _0x12ca40;});}return _0x3d85cc;})[_0x47a5('0x24')](respondWithResult(_0x560e4e,0xc9))[_0x47a5('0x45')](handleError(_0x560e4e,null));};exports[_0x47a5('0x23')]=function(_0x588551,_0x3adf14){if(_0x588551[_0x47a5('0x52')]['id']){delete _0x588551[_0x47a5('0x52')]['id'];}return db[_0x47a5('0x2e')][_0x47a5('0x4e')]({'where':{'id':_0x588551[_0x47a5('0x53')]['id']}})[_0x47a5('0x24')](handleEntityNotFound(_0x3adf14,null))['then'](saveUpdates(_0x588551[_0x47a5('0x52')],null))[_0x47a5('0x24')](respondWithResult(_0x3adf14,null))[_0x47a5('0x45')](handleError(_0x3adf14,null));};exports[_0x47a5('0x27')]=function(_0x3329aa,_0x1ab0bf){return db['Interval'][_0x47a5('0x4e')]({'where':{'id':_0x3329aa[_0x47a5('0x53')]['id']}})[_0x47a5('0x24')](handleEntityNotFound(_0x1ab0bf,null))['then'](removeEntity(_0x1ab0bf,null))[_0x47a5('0x45')](handleError(_0x1ab0bf,null));};exports[_0x47a5('0x54')]=function(_0x183b3c,_0x5d8d4a,_0x57641e){if(_0x183b3c[_0x47a5('0x52')]['id']){delete _0x183b3c[_0x47a5('0x52')]['id'];}return db['Interval']['find']({'where':{'id':_0x183b3c[_0x47a5('0x53')]['id']}})['then'](handleEntityNotFound(_0x5d8d4a,null))[_0x47a5('0x24')](function(_0x5d383d){if(_0x5d383d){_0x183b3c['body'][_0x47a5('0x55')]=_0x5d383d['id'];return db[_0x47a5('0x2e')]['create'](_0x183b3c[_0x47a5('0x52')]);}})[_0x47a5('0x24')](respondWithResult(_0x5d8d4a,null))['catch'](handleError(_0x5d8d4a,null));};exports['getIntervals']=function(_0x16b4fd,_0x30d482,_0x867da0){var _0x2931e4={};var _0x5996c4={};var _0x199621;var _0x2b4255;return db[_0x47a5('0x2e')]['findOne']({'where':{'id':_0x16b4fd[_0x47a5('0x53')]['id']}})['then'](handleEntityNotFound(_0x30d482,null))[_0x47a5('0x24')](function(_0x470da6){if(_0x470da6){_0x199621=_0x470da6;_0x5996c4[_0x47a5('0x35')]=_[_0x47a5('0x56')](db[_0x47a5('0x2e')]['rawAttributes']);_0x5996c4[_0x47a5('0x32')]=_['keys'](_0x16b4fd['query']);_0x5996c4['filters']=_['intersection'](_0x5996c4[_0x47a5('0x35')],_0x5996c4[_0x47a5('0x32')]);_0x2931e4[_0x47a5('0x37')]=_['intersection'](_0x5996c4['model'],qs[_0x47a5('0x36')](_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x36')]));_0x2931e4[_0x47a5('0x37')]=_0x2931e4[_0x47a5('0x37')]['length']?_0x2931e4[_0x47a5('0x37')]:_0x5996c4['model'];_0x2931e4[_0x47a5('0x39')]=qs[_0x47a5('0x3a')](_0x16b4fd['query'][_0x47a5('0x3a')]);_0x2931e4[_0x47a5('0x3b')]=qs[_0x47a5('0x33')](_[_0x47a5('0x3c')](_0x16b4fd[_0x47a5('0x32')],_0x5996c4[_0x47a5('0x33')]));if(_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x3d')]){_0x2931e4['where']=_[_0x47a5('0x47')](_0x2931e4[_0x47a5('0x3b')],{'$or':_[_0x47a5('0x2d')](_0x2931e4[_0x47a5('0x37')],function(_0x396cb0){var _0x4bbe14={};_0x4bbe14[_0x396cb0]={'$like':'%'+_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x3d')]+'%'};return _0x4bbe14;})});}_0x2931e4=_[_0x47a5('0x47')]({},_0x2931e4,_0x16b4fd[_0x47a5('0x3f')]);return _0x199621[_0x47a5('0x57')](_0x2931e4);}})[_0x47a5('0x24')](function(_0x453191){if(_0x453191){_0x2b4255=_0x453191[_0x47a5('0x38')];if(!_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x58')](_0x47a5('0x59'))){_0x2931e4[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x1d')]);_0x2931e4['offset']=qs[_0x47a5('0x1c')](_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x1c')]);}return _0x199621['getIntervals'](_0x2931e4);}})[_0x47a5('0x24')](function(_0x2e46af){if(_0x2e46af){return _0x2e46af?{'count':_0x2b4255,'rows':_0x2e46af}:null;}})[_0x47a5('0x24')](respondWithResult(_0x30d482,null))[_0x47a5('0x45')](handleError(_0x30d482,null));};exports['addIntervals']=function(_0x3ac402,_0x522ccf,_0x2d5ee6){return db['Interval'][_0x47a5('0x5a')]({'where':{'id':_0x3ac402['params']['id']}})[_0x47a5('0x24')](handleEntityNotFound(_0x522ccf,null))[_0x47a5('0x24')](function(_0x2578d6){if(_0x2578d6){return db['sequelize']['transaction'](function(_0x4b8084){return db[_0x47a5('0x2e')][_0x47a5('0x27')]({'where':{'IntervalId':_0x3ac402[_0x47a5('0x53')]['id']},'transaction':_0x4b8084})[_0x47a5('0x24')](function(_0x525055){var _0x6c0f0=_[_0x47a5('0x2d')](_0x3ac402[_0x47a5('0x52')],function(_0xd5b23f){delete _0xd5b23f['id'];_0xd5b23f[_0x47a5('0x55')]=_0x3ac402[_0x47a5('0x53')]['id'];return _0xd5b23f;});return db[_0x47a5('0x2e')][_0x47a5('0x5b')](_0x6c0f0,{'transaction':_0x4b8084});});})[_0x47a5('0x24')](function(){return db[_0x47a5('0x2e')][_0x47a5('0x43')]({'where':{'IntervalId':_0x3ac402[_0x47a5('0x53')]['id']}});});}})['then'](respondWithResult(_0x522ccf,null))[_0x47a5('0x45')](handleError(_0x522ccf,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 4ef493e..b015247 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 _0x7497=['rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','tools_intervals'];(function(_0x3c10fa,_0x460b1d){var _0x5655ee=function(_0x38dfc3){while(--_0x38dfc3){_0x3c10fa['push'](_0x3c10fa['shift']());}};_0x5655ee(++_0x460b1d);}(_0x7497,0x13c));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var logger=require(_0x7749('0x2'))(_0x7749('0x3'));var moment=require(_0x7749('0x4'));var BPromise=require(_0x7749('0x5'));var rp=require(_0x7749('0x6'));var fs=require('fs');var path=require(_0x7749('0x7'));var rimraf=require(_0x7749('0x8'));var config=require(_0x7749('0x9'));var attributes=require(_0x7749('0xa'));var extensions=require(_0x7749('0xb'));module[_0x7749('0xc')]=function(_0x341c81,_0xef965f){return _0x341c81['define']('Interval',attributes,{'tableName':_0x7749('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1bd19b,_0x4af29d){extensions['rewrite'](_0x341c81,_0x1bd19b);},'afterBulkCreate':function(_0x3e20c9,_0x3f6fe2,_0x13fd45){_0x13fd45();extensions[_0x7749('0xe')](_0x341c81,_0x3e20c9[0x0]);},'afterUpdate':function(_0x51e6b5,_0x483296){extensions[_0x7749('0xe')](_0x341c81,_0x51e6b5);},'afterDestroy':function(_0x55c062,_0x201de8){extensions['rewrite'](_0x341c81,_0x55c062);}}});}; \ No newline at end of file +var _0x7dc2=['rimraf','./interval.attributes','../../components/extensions/rewrite','define','Interval','rewrite','../../config/logger','api','moment','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7dc2,0x19d));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x27dc('0x0'))(_0x27dc('0x1'));var moment=require(_0x27dc('0x2'));var BPromise=require(_0x27dc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27dc('0x4'));var rimraf=require(_0x27dc('0x5'));var config=require('../../config/environment');var attributes=require(_0x27dc('0x6'));var extensions=require(_0x27dc('0x7'));module['exports']=function(_0x29eaac,_0x4d2e10){return _0x29eaac[_0x27dc('0x8')](_0x27dc('0x9'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x45aa07,_0x1039b1){extensions[_0x27dc('0xa')](_0x29eaac,_0x45aa07);},'afterBulkCreate':function(_0x242997,_0x50e11b,_0x1d93ef){_0x1d93ef();extensions['rewrite'](_0x29eaac,_0x242997[0x0]);},'afterUpdate':function(_0x3b6946,_0x187853){extensions[_0x27dc('0xa')](_0x29eaac,_0x3b6946);},'afterDestroy':function(_0x54c533,_0x5cd8a5){extensions[_0x27dc('0xa')](_0x29eaac,_0x54c533);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a4777e3..f0fb9d8 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 _0x3a01=['attributes','include','map','model','then','ShowInterval','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Interval,\x20%s,\x20%s','result','catch','GetInterval','Interval','findAll','options','raw','where'];(function(_0x5e3277,_0x369ffa){var _0x1db722=function(_0x227710){while(--_0x227710){_0x5e3277['push'](_0x5e3277['shift']());}};_0x1db722(++_0x369ffa);}(_0x3a01,0x1da));var _0x13a0=function(_0x3c7b49,_0x1bee76){_0x3c7b49=_0x3c7b49-0x0;var _0x47e261=_0x3a01[_0x3c7b49];return _0x47e261;};'use strict';var _=require(_0x13a0('0x0'));var util=require(_0x13a0('0x1'));var moment=require(_0x13a0('0x2'));var BPromise=require('bluebird');var rs=require(_0x13a0('0x3'));var fs=require('fs');var Redis=require(_0x13a0('0x4'));var db=require(_0x13a0('0x5'))['db'];var utils=require(_0x13a0('0x6'));var logger=require(_0x13a0('0x7'))(_0x13a0('0x8'));var config=require(_0x13a0('0x9'));var jayson=require(_0x13a0('0xa'));var client=jayson[_0x13a0('0xb')][_0x13a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33dcd7,_0x40a31c,_0x2bbb23){return new BPromise(function(_0x28381d,_0x5d7c23){return client['request'](_0x33dcd7,_0x2bbb23)['then'](function(_0x1a6858){logger[_0x13a0('0xd')]('Interval,\x20%s,\x20%s',_0x40a31c,_0x13a0('0xe'));logger[_0x13a0('0xf')](_0x13a0('0x10'),_0x40a31c,_0x13a0('0xe'),JSON[_0x13a0('0x11')](_0x1a6858));if(_0x1a6858['error']){if(_0x1a6858[_0x13a0('0x12')][_0x13a0('0x13')]===0x1f4){logger['error']('Interval,\x20%s,\x20%s',_0x40a31c,_0x1a6858['error'][_0x13a0('0x14')]);return _0x5d7c23(_0x1a6858[_0x13a0('0x12')][_0x13a0('0x14')]);}logger[_0x13a0('0x12')](_0x13a0('0x15'),_0x40a31c,_0x1a6858['error'][_0x13a0('0x14')]);return _0x28381d(_0x1a6858[_0x13a0('0x12')][_0x13a0('0x14')]);}else{logger[_0x13a0('0xd')]('Interval,\x20%s,\x20%s',_0x40a31c,_0x13a0('0xe'));_0x28381d(_0x1a6858[_0x13a0('0x16')]['message']);}})[_0x13a0('0x17')](function(_0xd6d445){logger['error'](_0x13a0('0x15'),_0x40a31c,_0xd6d445);_0x5d7c23(_0xd6d445);});});}exports[_0x13a0('0x18')]=function(_0x5716e6){var _0x44ad28=this;return new Promise(function(_0x31344b,_0x561a32){return db[_0x13a0('0x19')][_0x13a0('0x1a')]({'raw':_0x5716e6[_0x13a0('0x1b')]?_0x5716e6[_0x13a0('0x1b')][_0x13a0('0x1c')]===undefined?!![]:![]:!![],'where':_0x5716e6[_0x13a0('0x1b')]?_0x5716e6[_0x13a0('0x1b')][_0x13a0('0x1d')]||null:null,'attributes':_0x5716e6['options']?_0x5716e6[_0x13a0('0x1b')][_0x13a0('0x1e')]||null:null,'limit':_0x5716e6['options']?_0x5716e6[_0x13a0('0x1b')]['limit']||null:null,'include':_0x5716e6[_0x13a0('0x1b')]?_0x5716e6[_0x13a0('0x1b')][_0x13a0('0x1f')]?_[_0x13a0('0x20')](_0x5716e6[_0x13a0('0x1b')][_0x13a0('0x1f')],function(_0x37803a){return{'model':db[_0x37803a[_0x13a0('0x21')]],'as':_0x37803a['as'],'attributes':_0x37803a['attributes'],'include':_0x37803a[_0x13a0('0x1f')]?_[_0x13a0('0x20')](_0x37803a[_0x13a0('0x1f')],function(_0x2a6fc1){return{'model':db[_0x2a6fc1[_0x13a0('0x21')]],'as':_0x2a6fc1['as'],'attributes':_0x2a6fc1[_0x13a0('0x1e')],'include':_0x2a6fc1[_0x13a0('0x1f')]?_['map'](_0x2a6fc1[_0x13a0('0x1f')],function(_0x595e45){return{'model':db[_0x595e45[_0x13a0('0x21')]],'as':_0x595e45['as'],'attributes':_0x595e45[_0x13a0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x13a0('0x22')](function(_0x775e43){logger[_0x13a0('0xd')](_0x13a0('0x18'),_0x5716e6);logger[_0x13a0('0xf')](_0x13a0('0x18'),_0x5716e6,JSON['stringify'](_0x775e43));_0x31344b(_0x775e43);})[_0x13a0('0x17')](function(_0xcb7927){logger[_0x13a0('0x12')](_0x13a0('0x18'),_0xcb7927[_0x13a0('0x14')],_0x5716e6);_0x561a32(_0x44ad28[_0x13a0('0x12')](0x1f4,_0xcb7927[_0x13a0('0x14')]));});});};exports[_0x13a0('0x23')]=function(_0xf710b){var _0x5df71c=this;return new Promise(function(_0x163bf3,_0x441072){return db[_0x13a0('0x19')]['find']({'raw':_0xf710b[_0x13a0('0x1b')]?_0xf710b['options'][_0x13a0('0x1c')]===undefined?!![]:![]:!![],'where':_0xf710b[_0x13a0('0x1b')]?_0xf710b['options'][_0x13a0('0x1d')]||null:null,'attributes':_0xf710b[_0x13a0('0x1b')]?_0xf710b[_0x13a0('0x1b')][_0x13a0('0x1e')]||null:null,'include':_0xf710b[_0x13a0('0x1b')]?_0xf710b['options']['include']?_[_0x13a0('0x20')](_0xf710b[_0x13a0('0x1b')][_0x13a0('0x1f')],function(_0x99cd6){return{'model':db[_0x99cd6[_0x13a0('0x21')]],'as':_0x99cd6['as'],'attributes':_0x99cd6['attributes'],'include':_0x99cd6[_0x13a0('0x1f')]?_[_0x13a0('0x20')](_0x99cd6[_0x13a0('0x1f')],function(_0x491e13){return{'model':db[_0x491e13[_0x13a0('0x21')]],'as':_0x491e13['as'],'attributes':_0x491e13['attributes'],'include':_0x491e13[_0x13a0('0x1f')]?_[_0x13a0('0x20')](_0x491e13[_0x13a0('0x1f')],function(_0x3d58af){return{'model':db[_0x3d58af['model']],'as':_0x3d58af['as'],'attributes':_0x3d58af[_0x13a0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x13a0('0x22')](function(_0x16f088){logger['info']('ShowInterval',_0xf710b);logger[_0x13a0('0xf')](_0x13a0('0x23'),_0xf710b,JSON['stringify'](_0x16f088));_0x163bf3(_0x16f088);})['catch'](function(_0xd8b009){logger[_0x13a0('0x12')]('ShowInterval',_0xd8b009[_0x13a0('0x14')],_0xf710b);_0x441072(_0x5df71c[_0x13a0('0x12')](0x1f4,_0xd8b009['message']));});});}; \ No newline at end of file +var _0xe690=['util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetInterval','Interval','findAll','options','where','limit','include','model','attributes','map','find','raw','ShowInterval','lodash'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xe690,0x1c6));var _0x0e69=function(_0x442dd2,_0x50072a){_0x442dd2=_0x442dd2-0x0;var _0x23f262=_0xe690[_0x442dd2];return _0x23f262;};'use strict';var _=require(_0x0e69('0x0'));var util=require(_0x0e69('0x1'));var moment=require(_0x0e69('0x2'));var BPromise=require(_0x0e69('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e69('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0e69('0x5'))(_0x0e69('0x6'));var config=require(_0x0e69('0x7'));var jayson=require(_0x0e69('0x8'));var client=jayson['client'][_0x0e69('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b9829,_0x37ca0c,_0x5a3fbc){return new BPromise(function(_0x3f06bd,_0x2470e6){return client[_0x0e69('0xa')](_0x5b9829,_0x5a3fbc)['then'](function(_0x4e634e){logger[_0x0e69('0xb')](_0x0e69('0xc'),_0x37ca0c,_0x0e69('0xd'));logger[_0x0e69('0xe')](_0x0e69('0xf'),_0x37ca0c,_0x0e69('0xd'),JSON[_0x0e69('0x10')](_0x4e634e));if(_0x4e634e[_0x0e69('0x11')]){if(_0x4e634e[_0x0e69('0x11')][_0x0e69('0x12')]===0x1f4){logger[_0x0e69('0x11')]('Interval,\x20%s,\x20%s',_0x37ca0c,_0x4e634e[_0x0e69('0x11')]['message']);return _0x2470e6(_0x4e634e[_0x0e69('0x11')][_0x0e69('0x13')]);}logger[_0x0e69('0x11')](_0x0e69('0xc'),_0x37ca0c,_0x4e634e[_0x0e69('0x11')][_0x0e69('0x13')]);return _0x3f06bd(_0x4e634e['error']['message']);}else{logger[_0x0e69('0xb')](_0x0e69('0xc'),_0x37ca0c,_0x0e69('0xd'));_0x3f06bd(_0x4e634e[_0x0e69('0x14')][_0x0e69('0x13')]);}})[_0x0e69('0x15')](function(_0x44eabf){logger['error'](_0x0e69('0xc'),_0x37ca0c,_0x44eabf);_0x2470e6(_0x44eabf);});});}exports[_0x0e69('0x16')]=function(_0x163403){var _0x52d365=this;return new Promise(function(_0x1076aa,_0xcdd77c){return db[_0x0e69('0x17')][_0x0e69('0x18')]({'raw':_0x163403[_0x0e69('0x19')]?_0x163403[_0x0e69('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x163403[_0x0e69('0x19')]?_0x163403['options'][_0x0e69('0x1a')]||null:null,'attributes':_0x163403[_0x0e69('0x19')]?_0x163403['options']['attributes']||null:null,'limit':_0x163403[_0x0e69('0x19')]?_0x163403[_0x0e69('0x19')][_0x0e69('0x1b')]||null:null,'include':_0x163403[_0x0e69('0x19')]?_0x163403[_0x0e69('0x19')]['include']?_['map'](_0x163403['options'][_0x0e69('0x1c')],function(_0x41ffe3){return{'model':db[_0x41ffe3[_0x0e69('0x1d')]],'as':_0x41ffe3['as'],'attributes':_0x41ffe3[_0x0e69('0x1e')],'include':_0x41ffe3[_0x0e69('0x1c')]?_[_0x0e69('0x1f')](_0x41ffe3[_0x0e69('0x1c')],function(_0x2bcc7f){return{'model':db[_0x2bcc7f[_0x0e69('0x1d')]],'as':_0x2bcc7f['as'],'attributes':_0x2bcc7f[_0x0e69('0x1e')],'include':_0x2bcc7f['include']?_[_0x0e69('0x1f')](_0x2bcc7f['include'],function(_0x2d7d02){return{'model':db[_0x2d7d02[_0x0e69('0x1d')]],'as':_0x2d7d02['as'],'attributes':_0x2d7d02[_0x0e69('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ebcec){logger[_0x0e69('0xb')](_0x0e69('0x16'),_0x163403);logger[_0x0e69('0xe')]('GetInterval',_0x163403,JSON[_0x0e69('0x10')](_0x2ebcec));_0x1076aa(_0x2ebcec);})[_0x0e69('0x15')](function(_0x14570d){logger[_0x0e69('0x11')](_0x0e69('0x16'),_0x14570d[_0x0e69('0x13')],_0x163403);_0xcdd77c(_0x52d365[_0x0e69('0x11')](0x1f4,_0x14570d[_0x0e69('0x13')]));});});};exports['ShowInterval']=function(_0x214eeb){var _0xf996be=this;return new Promise(function(_0x25b014,_0x4b42f1){return db[_0x0e69('0x17')][_0x0e69('0x20')]({'raw':_0x214eeb[_0x0e69('0x19')]?_0x214eeb['options'][_0x0e69('0x21')]===undefined?!![]:![]:!![],'where':_0x214eeb['options']?_0x214eeb[_0x0e69('0x19')][_0x0e69('0x1a')]||null:null,'attributes':_0x214eeb[_0x0e69('0x19')]?_0x214eeb[_0x0e69('0x19')][_0x0e69('0x1e')]||null:null,'include':_0x214eeb[_0x0e69('0x19')]?_0x214eeb[_0x0e69('0x19')][_0x0e69('0x1c')]?_[_0x0e69('0x1f')](_0x214eeb[_0x0e69('0x19')]['include'],function(_0x233dd6){return{'model':db[_0x233dd6[_0x0e69('0x1d')]],'as':_0x233dd6['as'],'attributes':_0x233dd6[_0x0e69('0x1e')],'include':_0x233dd6[_0x0e69('0x1c')]?_[_0x0e69('0x1f')](_0x233dd6['include'],function(_0x1742d8){return{'model':db[_0x1742d8[_0x0e69('0x1d')]],'as':_0x1742d8['as'],'attributes':_0x1742d8['attributes'],'include':_0x1742d8[_0x0e69('0x1c')]?_[_0x0e69('0x1f')](_0x1742d8[_0x0e69('0x1c')],function(_0x185e14){return{'model':db[_0x185e14[_0x0e69('0x1d')]],'as':_0x185e14['as'],'attributes':_0x185e14[_0x0e69('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9421d8){logger[_0x0e69('0xb')]('ShowInterval',_0x214eeb);logger[_0x0e69('0xe')](_0x0e69('0x22'),_0x214eeb,JSON[_0x0e69('0x10')](_0x9421d8));_0x25b014(_0x9421d8);})[_0x0e69('0x15')](function(_0x306815){logger['error'](_0x0e69('0x22'),_0x306815[_0x0e69('0x13')],_0x214eeb);_0x4b42f1(_0xf996be[_0x0e69('0x11')](0x1f4,_0x306815['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 60711ab..9862fd6 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 _0x90fa=['../../components/auth/service','send','exports','express'];(function(_0x26623c,_0x335b7a){var _0x890a1f=function(_0x11e450){while(--_0x11e450){_0x26623c['push'](_0x26623c['shift']());}};_0x890a1f(++_0x335b7a);}(_0x90fa,0xe7));var _0xa90f=function(_0x404622,_0x3b1a87){_0x404622=_0x404622-0x0;var _0x336dd0=_0x90fa[_0x404622];return _0x336dd0;};'use strict';var express=require(_0xa90f('0x0'));var router=express['Router']();var auth=require(_0xa90f('0x1'));var controller=require('./jira.controller');router['post']('/',auth['isAuthenticated'](),controller[_0xa90f('0x2')]);module[_0xa90f('0x3')]=router; \ No newline at end of file +var _0xebc0=['post','send','exports','express','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xebc0,0x1a1));var _0x0ebc=function(_0x561359,_0x15922b){_0x561359=_0x561359-0x0;var _0x3b11dd=_0xebc0[_0x561359];return _0x3b11dd;};'use strict';var express=require(_0x0ebc('0x0'));var router=express[_0x0ebc('0x1')]();var auth=require(_0x0ebc('0x2'));var controller=require('./jira.controller');router[_0x0ebc('0x3')]('/',auth['isAuthenticated'](),controller[_0x0ebc('0x4')]);module[_0x0ebc('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index edda144..e4f3703 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 _0x90ab=['status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','bluebird','https','api','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','customfield_11500','email','fields','customfield_11501','customfield_11502','customfield_11503','name','customfield_11504','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','end'];(function(_0x546125,_0xfa3bf){var _0x77b546=function(_0x475555){while(--_0x475555){_0x546125['push'](_0x546125['shift']());}};_0x77b546(++_0xfa3bf);}(_0x90ab,0x1da));var _0xb90a=function(_0x50d5ae,_0x22a349){_0x50d5ae=_0x50d5ae-0x0;var _0x1e8d74=_0x90ab[_0x50d5ae];return _0x1e8d74;};'use strict';var BPromise=require(_0xb90a('0x0'));var https=require(_0xb90a('0x1'));var logger=require('../../config/logger')(_0xb90a('0x2'));var USERNAME='support';var PASSWORD=_0xb90a('0x3');function openIssue(_0xe0656f,_0xe5f8c5){var _0x251262={'fields':{'project':{'key':_0xe0656f[_0xb90a('0x4')]||_0xb90a('0x5')},'summary':(_0xe0656f['summary']||_0xb90a('0x6'))+_0xb90a('0x7')+_0xe0656f['ip'],'description':_0xe0656f[_0xb90a('0x8')]||JSON['stringify'](_0xe0656f),'issuetype':{'name':_0xe0656f['issuetype']||'Bug'}}};_0x251262['fields'][_0xb90a('0x9')]=_0xe0656f[_0xb90a('0xa')];_0x251262[_0xb90a('0xb')][_0xb90a('0xc')]=_0xe0656f['oldToken'];_0x251262[_0xb90a('0xb')][_0xb90a('0xd')]=_0xe0656f['newToken'];_0x251262['fields'][_0xb90a('0xe')]=_0xe0656f[_0xb90a('0xf')];_0x251262[_0xb90a('0xb')][_0xb90a('0x10')]=_0xe0656f['reason'];_0x251262[_0xb90a('0xb')][_0xb90a('0x11')]=_0xe0656f['ip'];var _0x219ae2={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xb90a('0x12'),'method':_0xb90a('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0xb90a('0x14'),'Authorization':_0xb90a('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0xb90a('0x16')](_0xb90a('0x17'))}};var _0x51fbca=JSON[_0xb90a('0x18')](_0x251262);var _0x59e7a4=https[_0xb90a('0x19')](_0x219ae2,function(_0x5c1da9){_0x5c1da9[_0xb90a('0x1a')](_0xb90a('0x1b'));var _0x15e8b8='';_0x5c1da9['on'](_0xb90a('0x1c'),function(_0x1c08c3){_0x15e8b8+=_0x1c08c3;});_0x5c1da9['on'](_0xb90a('0x1d'),function(){if(_0xe5f8c5){return _0xe5f8c5[_0xb90a('0x1e')](_0x5c1da9['statusCode'])[_0xb90a('0x1f')](JSON[_0xb90a('0x20')](_0x15e8b8));}});});_0x59e7a4['on'](_0xb90a('0x21'),function(_0x27a6a8){if(_0xe5f8c5){return _0xe5f8c5['status'](0x1f4)[_0xb90a('0x1f')]({'errors':[{'message':_0xb90a('0x22'),'type':'api.jira'}]});}});_0x59e7a4[_0xb90a('0x23')](_0x51fbca);_0x59e7a4[_0xb90a('0x1d')]();}exports[_0xb90a('0x24')]=openIssue;exports[_0xb90a('0x25')]=function(_0x246e05,_0x1f6909){_0x246e05[_0xb90a('0x26')]['ip']=_0x246e05[_0xb90a('0x27')][_0xb90a('0x28')]||_0x246e05['connection'][_0xb90a('0x29')]||_0x246e05['socket'][_0xb90a('0x29')]||_0x246e05['connection']['socket'][_0xb90a('0x29')];return openIssue(_0x246e05[_0xb90a('0x26')],_0x1f6909);}; \ No newline at end of file +var _0x43f7=['key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','email','oldToken','customfield_11502','newToken','name','reason','customfield_10102','track.xcallymotion.com','POST','application/json','base64','request','data','end','status','statusCode','parse','error','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x43f7,0xec));var _0x743f=function(_0x141ae9,_0x39b88e){_0x141ae9=_0x141ae9-0x0;var _0x21b95e=_0x43f7[_0x141ae9];return _0x21b95e;};'use strict';var BPromise=require(_0x743f('0x0'));var https=require(_0x743f('0x1'));var logger=require(_0x743f('0x2'))(_0x743f('0x3'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x1136bd,_0x3c2dd2){var _0x192b3f={'fields':{'project':{'key':_0x1136bd[_0x743f('0x4')]||_0x743f('0x5')},'summary':(_0x1136bd['summary']||_0x743f('0x6'))+_0x743f('0x7')+_0x1136bd['ip'],'description':_0x1136bd[_0x743f('0x8')]||JSON[_0x743f('0x9')](_0x1136bd),'issuetype':{'name':_0x1136bd[_0x743f('0xa')]||'Bug'}}};_0x192b3f[_0x743f('0xb')][_0x743f('0xc')]=_0x1136bd[_0x743f('0xd')];_0x192b3f[_0x743f('0xb')]['customfield_11501']=_0x1136bd[_0x743f('0xe')];_0x192b3f[_0x743f('0xb')][_0x743f('0xf')]=_0x1136bd[_0x743f('0x10')];_0x192b3f['fields']['customfield_11503']=_0x1136bd[_0x743f('0x11')];_0x192b3f[_0x743f('0xb')]['customfield_11504']=_0x1136bd[_0x743f('0x12')];_0x192b3f[_0x743f('0xb')][_0x743f('0x13')]=_0x1136bd['ip'];var _0x290662={'host':_0x743f('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x743f('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x743f('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x743f('0x17'))}};var _0x4d467c=JSON[_0x743f('0x9')](_0x192b3f);var _0x5d7890=https[_0x743f('0x18')](_0x290662,function(_0x2609f7){_0x2609f7['setEncoding']('utf8');var _0x39e38f='';_0x2609f7['on'](_0x743f('0x19'),function(_0x314cb9){_0x39e38f+=_0x314cb9;});_0x2609f7['on'](_0x743f('0x1a'),function(){if(_0x3c2dd2){return _0x3c2dd2[_0x743f('0x1b')](_0x2609f7[_0x743f('0x1c')])['json'](JSON[_0x743f('0x1d')](_0x39e38f));}});});_0x5d7890['on'](_0x743f('0x1e'),function(_0x487cdf){if(_0x3c2dd2){return _0x3c2dd2['status'](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x5d7890[_0x743f('0x1f')](_0x4d467c);_0x5d7890['end']();}exports[_0x743f('0x20')]=openIssue;exports[_0x743f('0x21')]=function(_0x3b2007,_0x3d163e){_0x3b2007[_0x743f('0x22')]['ip']=_0x3b2007[_0x743f('0x23')][_0x743f('0x24')]||_0x3b2007[_0x743f('0x25')]['remoteAddress']||_0x3b2007[_0x743f('0x26')][_0x743f('0x27')]||_0x3b2007['connection'][_0x743f('0x26')][_0x743f('0x27')];return openIssue(_0x3b2007['body'],_0x3d163e);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 9a05ef3..57c844b 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 _0xd22b=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id','post','put','delete','exports','util'];(function(_0xa41e13,_0x3bcb76){var _0xa2c16b=function(_0x3258e6){while(--_0x3258e6){_0xa41e13['push'](_0xa41e13['shift']());}};_0xa2c16b(++_0x3bcb76);}(_0xd22b,0xed));var _0xbd22=function(_0x4e0f55,_0x2bf5f9){_0x4e0f55=_0x4e0f55-0x0;var _0x4b7450=_0xd22b[_0x4e0f55];return _0x4b7450;};'use strict';var multer=require('multer');var util=require(_0xbd22('0x0'));var path=require(_0xbd22('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbd22('0x2')]();var fs_extra=require(_0xbd22('0x3'));var auth=require(_0xbd22('0x4'));var interaction=require(_0xbd22('0x5'));var config=require(_0xbd22('0x6'));var controller=require(_0xbd22('0x7'));router[_0xbd22('0x8')]('/',auth[_0xbd22('0x9')](),controller[_0xbd22('0xa')]);router[_0xbd22('0x8')]('/describe',auth[_0xbd22('0x9')](),controller[_0xbd22('0xb')]);router[_0xbd22('0x8')](_0xbd22('0xc'),auth[_0xbd22('0x9')](),controller['show']);router[_0xbd22('0xd')]('/',auth[_0xbd22('0x9')](),controller['create']);router[_0xbd22('0xe')](_0xbd22('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xbd22('0xf')](_0xbd22('0xc'),auth[_0xbd22('0x9')](),controller['destroy']);module[_0xbd22('0x10')]=router; \ No newline at end of file +var _0x34f9=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','post','create','put','/:id','update','delete'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x34f9,0xb2));var _0x934f=function(_0x316c1c,_0x2ce61f){_0x316c1c=_0x316c1c-0x0;var _0x3a4497=_0x34f9[_0x316c1c];return _0x3a4497;};'use strict';var multer=require(_0x934f('0x0'));var util=require('util');var path=require(_0x934f('0x1'));var timeout=require(_0x934f('0x2'));var express=require(_0x934f('0x3'));var router=express[_0x934f('0x4')]();var fs_extra=require(_0x934f('0x5'));var auth=require(_0x934f('0x6'));var interaction=require(_0x934f('0x7'));var config=require(_0x934f('0x8'));var controller=require(_0x934f('0x9'));router[_0x934f('0xa')]('/',auth[_0x934f('0xb')](),controller[_0x934f('0xc')]);router['get'](_0x934f('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x934f('0xa')]('/:id',auth[_0x934f('0xb')](),controller['show']);router[_0x934f('0xe')]('/',auth[_0x934f('0xb')](),controller[_0x934f('0xf')]);router[_0x934f('0x10')](_0x934f('0x11'),auth[_0x934f('0xb')](),controller[_0x934f('0x12')]);router[_0x934f('0x13')](_0x934f('0x11'),auth[_0x934f('0xb')](),controller[_0x934f('0x14')]);module[_0x934f('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 20fcfaa..4779b5d 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 _0xf7b4=['long','STRING','sequelize','TEXT'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xf7b4,0x152));var _0x4f7b=function(_0x188e3b,_0x4b8e01){_0x188e3b=_0x188e3b-0x0;var _0x5137c9=_0xf7b4[_0x188e3b];return _0x5137c9;};'use strict';var Sequelize=require(_0x4f7b('0x0'));module['exports']={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0x4f7b('0x1')](_0x4f7b('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4f7b('0x3')]},'uniqueid':{'type':Sequelize[_0x4f7b('0x3')]},'calleridname':{'type':Sequelize[_0x4f7b('0x3')]},'calleridnum':{'type':Sequelize[_0x4f7b('0x3')]},'questionId':{'type':Sequelize[_0x4f7b('0x3')]}}; \ No newline at end of file +var _0x0c5d=['sequelize','exports','TEXT','STRING'];(function(_0x49fa8c,_0x30bf01){var _0x2666bc=function(_0x662857){while(--_0x662857){_0x49fa8c['push'](_0x49fa8c['shift']());}};_0x2666bc(++_0x30bf01);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x36ef7b,_0x3e8323){_0x36ef7b=_0x36ef7b-0x0;var _0x28f1c1=_0x0c5d[_0x36ef7b];return _0x28f1c1;};'use strict';var Sequelize=require(_0xd0c5('0x0'));module[_0xd0c5('0x1')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0xd0c5('0x2')]('long')},'membername':{'type':Sequelize[_0xd0c5('0x3')]},'projectname':{'type':Sequelize[_0xd0c5('0x3')]},'queue':{'type':Sequelize[_0xd0c5('0x3')]},'uniqueid':{'type':Sequelize[_0xd0c5('0x3')]},'calleridname':{'type':Sequelize[_0xd0c5('0x3')]},'calleridnum':{'type':Sequelize[_0xd0c5('0x3')]},'questionId':{'type':Sequelize[_0xd0c5('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 5b34717..ee36eba 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 _0xb2f7=['../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','stack','name','send','map','JscriptyAnswerReport','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','find','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service'];(function(_0x4f846e,_0xe5491f){var _0x54f14f=function(_0x368d2a){while(--_0x368d2a){_0x4f846e['push'](_0x4f846e['shift']());}};_0x54f14f(++_0xe5491f);}(_0xb2f7,0xb6));var _0x7b2f=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xb2f7[_0x8de54f];return _0x14cba4;};'use strict';var pdf=require(_0x7b2f('0x0'));var emlformat=require(_0x7b2f('0x1'));var rimraf=require(_0x7b2f('0x2'));var zipdir=require(_0x7b2f('0x3'));var jsonpatch=require(_0x7b2f('0x4'));var rp=require('request-promise');var moment=require(_0x7b2f('0x5'));var BPromise=require(_0x7b2f('0x6'));var Mustache=require(_0x7b2f('0x7'));var util=require(_0x7b2f('0x8'));var path=require(_0x7b2f('0x9'));var sox=require(_0x7b2f('0xa'));var csv=require(_0x7b2f('0xb'));var ejs=require(_0x7b2f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b2f('0xd'));var squel=require('squel');var crypto=require(_0x7b2f('0xe'));var jsforce=require(_0x7b2f('0xf'));var deskjs=require(_0x7b2f('0x10'));var toCsv=require(_0x7b2f('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7b2f('0x11'));var authService=require(_0x7b2f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b2f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7b2f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7b2f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x410cdc,_0x16ee00){_0x16ee00=_0x16ee00||0xcc;return function(_0x5a95d6){if(_0x5a95d6){return _0x410cdc[_0x7b2f('0x16')](_0x16ee00);}return _0x410cdc[_0x7b2f('0x17')](_0x16ee00)[_0x7b2f('0x18')]();};}function respondWithResult(_0x111e6a,_0xdeb0eb){_0xdeb0eb=_0xdeb0eb||0xc8;return function(_0x31f337){if(_0x31f337){return _0x111e6a[_0x7b2f('0x17')](_0xdeb0eb)[_0x7b2f('0x19')](_0x31f337);}};}function respondWithFilteredResult(_0x43e5c1,_0x468d6d){return function(_0x8d8a4b){if(_0x8d8a4b){var _0x3c7192=_0x8d8a4b['count'],_0x401f6f=_0x468d6d[_0x7b2f('0x1a')],_0xe154f6=_0x468d6d[_0x7b2f('0x1a')]+_0x468d6d['limit'],_0x3795c4;if(_0xe154f6>=_0x3c7192){_0xe154f6=_0x3c7192;_0x3795c4=0xc8;}else{_0x3795c4=0xce;}_0x43e5c1[_0x7b2f('0x17')](_0x3795c4);return _0x43e5c1[_0x7b2f('0x1b')](_0x7b2f('0x1c'),_0x401f6f+'-'+_0xe154f6+'/'+_0x3c7192)[_0x7b2f('0x19')](_0x8d8a4b);}return null;};}function patchUpdates(_0x5526ec){return function(_0x3830c9){try{jsonpatch[_0x7b2f('0x1d')](_0x3830c9,_0x5526ec,!![]);}catch(_0x2fbb3e){return BPromise[_0x7b2f('0x1e')](_0x2fbb3e);}return _0x3830c9['save']();};}function saveUpdates(_0x126889,_0x4cb66f){return function(_0x3faf34){if(_0x3faf34){return _0x3faf34[_0x7b2f('0x1f')](_0x126889)[_0x7b2f('0x20')](function(_0x449e76){return _0x449e76;});}return null;};}function removeEntity(_0x2638b6,_0x2fec0c){return function(_0x225e6b){if(_0x225e6b){return _0x225e6b['destroy']()[_0x7b2f('0x20')](function(){_0x2638b6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12d0e8,_0x1a1180){return function(_0x3911f6){if(!_0x3911f6){_0x12d0e8[_0x7b2f('0x16')](0x194);}return _0x3911f6;};}function handleError(_0xb36d12,_0x553066){_0x553066=_0x553066||0x1f4;return function(_0x50287b){logger['error'](_0x50287b[_0x7b2f('0x21')]);if(_0x50287b[_0x7b2f('0x22')]){delete _0x50287b[_0x7b2f('0x22')];}_0xb36d12[_0x7b2f('0x17')](_0x553066)[_0x7b2f('0x23')](_0x50287b);};}exports['index']=function(_0x44ba63,_0xc80333){var _0x4cca2d={},_0x13c54d={},_0x30ba15={'count':0x0,'rows':[]};var _0x513a40=_[_0x7b2f('0x24')](db[_0x7b2f('0x25')]['rawAttributes'],function(_0x307357){return{'name':_0x307357[_0x7b2f('0x26')],'type':_0x307357[_0x7b2f('0x27')][_0x7b2f('0x28')]};});_0x13c54d['model']=_[_0x7b2f('0x24')](_0x513a40,_0x7b2f('0x22'));_0x13c54d[_0x7b2f('0x29')]=_[_0x7b2f('0x2a')](_0x44ba63[_0x7b2f('0x29')]);_0x13c54d['filters']=_[_0x7b2f('0x2b')](_0x13c54d['model'],_0x13c54d['query']);_0x4cca2d[_0x7b2f('0x2c')]=_[_0x7b2f('0x2b')](_0x13c54d['model'],qs[_0x7b2f('0x2d')](_0x44ba63[_0x7b2f('0x29')][_0x7b2f('0x2d')]));_0x4cca2d[_0x7b2f('0x2c')]=_0x4cca2d[_0x7b2f('0x2c')][_0x7b2f('0x2e')]?_0x4cca2d[_0x7b2f('0x2c')]:_0x13c54d[_0x7b2f('0x2f')];if(!_0x44ba63[_0x7b2f('0x29')]['hasOwnProperty']('nolimit')){_0x4cca2d[_0x7b2f('0x30')]=qs[_0x7b2f('0x30')](_0x44ba63[_0x7b2f('0x29')]['limit']);_0x4cca2d[_0x7b2f('0x1a')]=qs[_0x7b2f('0x1a')](_0x44ba63['query'][_0x7b2f('0x1a')]);}_0x4cca2d[_0x7b2f('0x31')]=qs[_0x7b2f('0x32')](_0x44ba63['query']['sort']);_0x4cca2d[_0x7b2f('0x33')]=qs[_0x7b2f('0x34')](_[_0x7b2f('0x35')](_0x44ba63[_0x7b2f('0x29')],_0x13c54d[_0x7b2f('0x34')]),_0x513a40);if(_0x44ba63[_0x7b2f('0x29')][_0x7b2f('0x36')]){_0x4cca2d['where']=_[_0x7b2f('0x37')](_0x4cca2d[_0x7b2f('0x33')],{'$or':_[_0x7b2f('0x24')](_0x513a40,function(_0x121e50){if(_0x121e50[_0x7b2f('0x27')]!==_0x7b2f('0x38')){var _0x2a2d56={};_0x2a2d56[_0x121e50['name']]={'$like':'%'+_0x44ba63[_0x7b2f('0x29')]['filter']+'%'};return _0x2a2d56;}})});}_0x4cca2d=_[_0x7b2f('0x37')]({},_0x4cca2d,_0x44ba63[_0x7b2f('0x39')]);var _0x49832a={'where':_0x4cca2d[_0x7b2f('0x33')]};return db[_0x7b2f('0x25')]['count'](_0x49832a)[_0x7b2f('0x20')](function(_0x37ec46){_0x30ba15['count']=_0x37ec46;if(_0x44ba63[_0x7b2f('0x29')][_0x7b2f('0x3a')]){_0x4cca2d[_0x7b2f('0x3b')]=[{'all':!![]}];}return db[_0x7b2f('0x25')]['findAll'](_0x4cca2d);})[_0x7b2f('0x20')](function(_0x135b6a){_0x30ba15['rows']=_0x135b6a;return _0x30ba15;})[_0x7b2f('0x20')](respondWithFilteredResult(_0xc80333,_0x4cca2d))[_0x7b2f('0x3c')](handleError(_0xc80333,null));};exports['show']=function(_0x3bdffe,_0x249168){var _0x40a4b6={'raw':!![],'where':{'id':_0x3bdffe[_0x7b2f('0x3d')]['id']}},_0x3ee03f={};_0x3ee03f[_0x7b2f('0x2f')]=_[_0x7b2f('0x2a')](db['JscriptyAnswerReport'][_0x7b2f('0x3e')]);_0x3ee03f[_0x7b2f('0x29')]=_[_0x7b2f('0x2a')](_0x3bdffe[_0x7b2f('0x29')]);_0x3ee03f[_0x7b2f('0x34')]=_[_0x7b2f('0x2b')](_0x3ee03f['model'],_0x3ee03f[_0x7b2f('0x29')]);_0x40a4b6['attributes']=_[_0x7b2f('0x2b')](_0x3ee03f[_0x7b2f('0x2f')],qs[_0x7b2f('0x2d')](_0x3bdffe[_0x7b2f('0x29')]['fields']));_0x40a4b6[_0x7b2f('0x2c')]=_0x40a4b6[_0x7b2f('0x2c')][_0x7b2f('0x2e')]?_0x40a4b6[_0x7b2f('0x2c')]:_0x3ee03f[_0x7b2f('0x2f')];if(_0x3bdffe[_0x7b2f('0x29')][_0x7b2f('0x3a')]){_0x40a4b6[_0x7b2f('0x3b')]=[{'all':!![]}];}_0x40a4b6=_[_0x7b2f('0x37')]({},_0x40a4b6,_0x3bdffe[_0x7b2f('0x39')]);return db[_0x7b2f('0x25')][_0x7b2f('0x3f')](_0x40a4b6)[_0x7b2f('0x20')](handleEntityNotFound(_0x249168,null))[_0x7b2f('0x20')](respondWithResult(_0x249168,null))[_0x7b2f('0x3c')](handleError(_0x249168,null));};exports['create']=function(_0x39c3da,_0x2ea0dc){return db[_0x7b2f('0x25')]['create'](_0x39c3da[_0x7b2f('0x40')],{})['then'](respondWithResult(_0x2ea0dc,0xc9))[_0x7b2f('0x3c')](handleError(_0x2ea0dc,null));};exports[_0x7b2f('0x1f')]=function(_0x632834,_0x4ef660){if(_0x632834[_0x7b2f('0x40')]['id']){delete _0x632834[_0x7b2f('0x40')]['id'];}return db[_0x7b2f('0x25')][_0x7b2f('0x3f')]({'where':{'id':_0x632834[_0x7b2f('0x3d')]['id']}})[_0x7b2f('0x20')](handleEntityNotFound(_0x4ef660,null))['then'](saveUpdates(_0x632834['body'],null))[_0x7b2f('0x20')](respondWithResult(_0x4ef660,null))['catch'](handleError(_0x4ef660,null));};exports[_0x7b2f('0x41')]=function(_0x3eec80,_0xbcf2e8){return db[_0x7b2f('0x25')]['find']({'where':{'id':_0x3eec80[_0x7b2f('0x3d')]['id']}})['then'](handleEntityNotFound(_0xbcf2e8,null))[_0x7b2f('0x20')](removeEntity(_0xbcf2e8,null))['catch'](handleError(_0xbcf2e8,null));};exports[_0x7b2f('0x42')]=function(_0x9d82e3,_0x550b71){return db[_0x7b2f('0x25')][_0x7b2f('0x42')]()[_0x7b2f('0x20')](respondWithResult(_0x550b71,null))[_0x7b2f('0x3c')](handleError(_0x550b71,null));}; \ No newline at end of file +var _0x49ee=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','then','destroy','end','sendStatus','error','stack','name','send','JscriptyAnswerReport','rawAttributes','fieldName','key','model','map','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x368587,_0x1b6554){var _0x42d33c=function(_0xfdccf){while(--_0xfdccf){_0x368587['push'](_0x368587['shift']());}};_0x42d33c(++_0x1b6554);}(_0x49ee,0x11f));var _0xe49e=function(_0x20da42,_0x4a3230){_0x20da42=_0x20da42-0x0;var _0x2d37b1=_0x49ee[_0x20da42];return _0x2d37b1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe49e('0x0'));var rimraf=require(_0xe49e('0x1'));var zipdir=require(_0xe49e('0x2'));var jsonpatch=require(_0xe49e('0x3'));var rp=require('request-promise');var moment=require(_0xe49e('0x4'));var BPromise=require(_0xe49e('0x5'));var Mustache=require(_0xe49e('0x6'));var util=require('util');var path=require(_0xe49e('0x7'));var sox=require('sox');var csv=require(_0xe49e('0x8'));var ejs=require(_0xe49e('0x9'));var fs=require('fs');var fs_extra=require(_0xe49e('0xa'));var _=require(_0xe49e('0xb'));var squel=require(_0xe49e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe49e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe49e('0x8'));var querystring=require(_0xe49e('0xe'));var Papa=require(_0xe49e('0xf'));var Redis=require(_0xe49e('0x10'));var authService=require(_0xe49e('0x11'));var qs=require(_0xe49e('0x12'));var as=require(_0xe49e('0x13'));var hardwareService=require(_0xe49e('0x14'));var logger=require(_0xe49e('0x15'))('api');var utils=require(_0xe49e('0x16'));var config=require(_0xe49e('0x17'));var licenseUtil=require(_0xe49e('0x18'));var db=require(_0xe49e('0x19'))['db'];function respondWithStatusCode(_0x206dd1,_0x18bee9){_0x18bee9=_0x18bee9||0xcc;return function(_0x1259ad){if(_0x1259ad){return _0x206dd1['sendStatus'](_0x18bee9);}return _0x206dd1[_0xe49e('0x1a')](_0x18bee9)['end']();};}function respondWithResult(_0x19b43a,_0x3460a8){_0x3460a8=_0x3460a8||0xc8;return function(_0x35233e){if(_0x35233e){return _0x19b43a[_0xe49e('0x1a')](_0x3460a8)[_0xe49e('0x1b')](_0x35233e);}};}function respondWithFilteredResult(_0x211fb0,_0x311a32){return function(_0x59ed8a){if(_0x59ed8a){var _0x441ce2=_0x59ed8a[_0xe49e('0x1c')],_0x102b14=_0x311a32[_0xe49e('0x1d')],_0x3dce61=_0x311a32['offset']+_0x311a32[_0xe49e('0x1e')],_0x1f34aa;if(_0x3dce61>=_0x441ce2){_0x3dce61=_0x441ce2;_0x1f34aa=0xc8;}else{_0x1f34aa=0xce;}_0x211fb0[_0xe49e('0x1a')](_0x1f34aa);return _0x211fb0[_0xe49e('0x1f')](_0xe49e('0x20'),_0x102b14+'-'+_0x3dce61+'/'+_0x441ce2)[_0xe49e('0x1b')](_0x59ed8a);}return null;};}function patchUpdates(_0x5e142a){return function(_0x24b0f0){try{jsonpatch[_0xe49e('0x21')](_0x24b0f0,_0x5e142a,!![]);}catch(_0x22777e){return BPromise['reject'](_0x22777e);}return _0x24b0f0['save']();};}function saveUpdates(_0x1b249b,_0x2f902a){return function(_0x122c3a){if(_0x122c3a){return _0x122c3a['update'](_0x1b249b)[_0xe49e('0x22')](function(_0x468bc9){return _0x468bc9;});}return null;};}function removeEntity(_0x1adb1c,_0x592574){return function(_0x3fb5eb){if(_0x3fb5eb){return _0x3fb5eb[_0xe49e('0x23')]()[_0xe49e('0x22')](function(){_0x1adb1c[_0xe49e('0x1a')](0xcc)[_0xe49e('0x24')]();});}};}function handleEntityNotFound(_0x37a5da,_0x7eade3){return function(_0x1a4389){if(!_0x1a4389){_0x37a5da[_0xe49e('0x25')](0x194);}return _0x1a4389;};}function handleError(_0x3cd6c6,_0x3a1f77){_0x3a1f77=_0x3a1f77||0x1f4;return function(_0x4b6ba8){logger[_0xe49e('0x26')](_0x4b6ba8[_0xe49e('0x27')]);if(_0x4b6ba8['name']){delete _0x4b6ba8[_0xe49e('0x28')];}_0x3cd6c6[_0xe49e('0x1a')](_0x3a1f77)[_0xe49e('0x29')](_0x4b6ba8);};}exports['index']=function(_0x410247,_0x3d5074){var _0x3eaff4={},_0x122a92={},_0x547287={'count':0x0,'rows':[]};var _0x2d513a=_['map'](db[_0xe49e('0x2a')][_0xe49e('0x2b')],function(_0x174a4e){return{'name':_0x174a4e[_0xe49e('0x2c')],'type':_0x174a4e['type'][_0xe49e('0x2d')]};});_0x122a92[_0xe49e('0x2e')]=_[_0xe49e('0x2f')](_0x2d513a,_0xe49e('0x28'));_0x122a92['query']=_['keys'](_0x410247['query']);_0x122a92[_0xe49e('0x30')]=_[_0xe49e('0x31')](_0x122a92[_0xe49e('0x2e')],_0x122a92['query']);_0x3eaff4[_0xe49e('0x32')]=_['intersection'](_0x122a92[_0xe49e('0x2e')],qs[_0xe49e('0x33')](_0x410247['query'][_0xe49e('0x33')]));_0x3eaff4[_0xe49e('0x32')]=_0x3eaff4[_0xe49e('0x32')][_0xe49e('0x34')]?_0x3eaff4[_0xe49e('0x32')]:_0x122a92['model'];if(!_0x410247[_0xe49e('0x35')][_0xe49e('0x36')](_0xe49e('0x37'))){_0x3eaff4['limit']=qs[_0xe49e('0x1e')](_0x410247[_0xe49e('0x35')][_0xe49e('0x1e')]);_0x3eaff4[_0xe49e('0x1d')]=qs[_0xe49e('0x1d')](_0x410247[_0xe49e('0x35')][_0xe49e('0x1d')]);}_0x3eaff4['order']=qs[_0xe49e('0x38')](_0x410247[_0xe49e('0x35')]['sort']);_0x3eaff4[_0xe49e('0x39')]=qs[_0xe49e('0x30')](_[_0xe49e('0x3a')](_0x410247[_0xe49e('0x35')],_0x122a92[_0xe49e('0x30')]),_0x2d513a);if(_0x410247['query'][_0xe49e('0x3b')]){_0x3eaff4[_0xe49e('0x39')]=_[_0xe49e('0x3c')](_0x3eaff4['where'],{'$or':_[_0xe49e('0x2f')](_0x2d513a,function(_0x2fe3f7){if(_0x2fe3f7[_0xe49e('0x3d')]!==_0xe49e('0x3e')){var _0x1c707c={};_0x1c707c[_0x2fe3f7[_0xe49e('0x28')]]={'$like':'%'+_0x410247[_0xe49e('0x35')]['filter']+'%'};return _0x1c707c;}})});}_0x3eaff4=_[_0xe49e('0x3c')]({},_0x3eaff4,_0x410247[_0xe49e('0x3f')]);var _0x3c93f3={'where':_0x3eaff4[_0xe49e('0x39')]};return db[_0xe49e('0x2a')]['count'](_0x3c93f3)[_0xe49e('0x22')](function(_0x1f7078){_0x547287[_0xe49e('0x1c')]=_0x1f7078;if(_0x410247[_0xe49e('0x35')][_0xe49e('0x40')]){_0x3eaff4[_0xe49e('0x41')]=[{'all':!![]}];}return db[_0xe49e('0x2a')][_0xe49e('0x42')](_0x3eaff4);})['then'](function(_0x2ded62){_0x547287[_0xe49e('0x43')]=_0x2ded62;return _0x547287;})[_0xe49e('0x22')](respondWithFilteredResult(_0x3d5074,_0x3eaff4))['catch'](handleError(_0x3d5074,null));};exports[_0xe49e('0x44')]=function(_0x25dbce,_0x58ebc3){var _0x5148d5={'raw':!![],'where':{'id':_0x25dbce[_0xe49e('0x45')]['id']}},_0x12d9a4={};_0x12d9a4[_0xe49e('0x2e')]=_[_0xe49e('0x46')](db[_0xe49e('0x2a')]['rawAttributes']);_0x12d9a4[_0xe49e('0x35')]=_[_0xe49e('0x46')](_0x25dbce['query']);_0x12d9a4[_0xe49e('0x30')]=_[_0xe49e('0x31')](_0x12d9a4[_0xe49e('0x2e')],_0x12d9a4[_0xe49e('0x35')]);_0x5148d5[_0xe49e('0x32')]=_[_0xe49e('0x31')](_0x12d9a4['model'],qs[_0xe49e('0x33')](_0x25dbce[_0xe49e('0x35')][_0xe49e('0x33')]));_0x5148d5['attributes']=_0x5148d5[_0xe49e('0x32')]['length']?_0x5148d5['attributes']:_0x12d9a4[_0xe49e('0x2e')];if(_0x25dbce[_0xe49e('0x35')][_0xe49e('0x40')]){_0x5148d5['include']=[{'all':!![]}];}_0x5148d5=_['merge']({},_0x5148d5,_0x25dbce[_0xe49e('0x3f')]);return db['JscriptyAnswerReport'][_0xe49e('0x47')](_0x5148d5)['then'](handleEntityNotFound(_0x58ebc3,null))['then'](respondWithResult(_0x58ebc3,null))[_0xe49e('0x48')](handleError(_0x58ebc3,null));};exports[_0xe49e('0x49')]=function(_0x4a685d,_0x1910b7){return db[_0xe49e('0x2a')]['create'](_0x4a685d[_0xe49e('0x4a')],{})[_0xe49e('0x22')](respondWithResult(_0x1910b7,0xc9))['catch'](handleError(_0x1910b7,null));};exports[_0xe49e('0x4b')]=function(_0x399e33,_0xeda051){if(_0x399e33['body']['id']){delete _0x399e33[_0xe49e('0x4a')]['id'];}return db['JscriptyAnswerReport'][_0xe49e('0x47')]({'where':{'id':_0x399e33[_0xe49e('0x45')]['id']}})[_0xe49e('0x22')](handleEntityNotFound(_0xeda051,null))[_0xe49e('0x22')](saveUpdates(_0x399e33['body'],null))[_0xe49e('0x22')](respondWithResult(_0xeda051,null))[_0xe49e('0x48')](handleError(_0xeda051,null));};exports[_0xe49e('0x23')]=function(_0x345aef,_0x325b17){return db[_0xe49e('0x2a')][_0xe49e('0x47')]({'where':{'id':_0x345aef[_0xe49e('0x45')]['id']}})[_0xe49e('0x22')](handleEntityNotFound(_0x325b17,null))[_0xe49e('0x22')](removeEntity(_0x325b17,null))[_0xe49e('0x48')](handleError(_0x325b17,null));};exports[_0xe49e('0x4c')]=function(_0xf09688,_0x4057d3){return db[_0xe49e('0x2a')][_0xe49e('0x4c')]()[_0xe49e('0x22')](respondWithResult(_0x4057d3,null))[_0xe49e('0x48')](handleError(_0x4057d3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 1969ca4..018906c 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 _0xfa76=['api','bluebird','request-promise','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xfa76,0x194));var _0x6fa7=function(_0x4fb899,_0x3e7645){_0x4fb899=_0x4fb899-0x0;var _0x2f7d4b=_0xfa76[_0x4fb899];return _0x2f7d4b;};'use strict';var _=require(_0x6fa7('0x0'));var util=require(_0x6fa7('0x1'));var logger=require(_0x6fa7('0x2'))(_0x6fa7('0x3'));var moment=require('moment');var BPromise=require(_0x6fa7('0x4'));var rp=require(_0x6fa7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6fa7('0x6'));var config=require('../../config/environment');var attributes=require(_0x6fa7('0x7'));module[_0x6fa7('0x8')]=function(_0x1b4492,_0x22655c){return _0x1b4492['define'](_0x6fa7('0x9'),attributes,{'tableName':_0x6fa7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3587=['../../config/environment','./jscriptyAnswerReport.attributes','define','api','bluebird','path','rimraf'];(function(_0x4b92cd,_0x382484){var _0x264e66=function(_0x4ee855){while(--_0x4ee855){_0x4b92cd['push'](_0x4b92cd['shift']());}};_0x264e66(++_0x382484);}(_0x3587,0x17d));var _0x7358=function(_0x5176f6,_0x5e0d36){_0x5176f6=_0x5176f6-0x0;var _0x456876=_0x3587[_0x5176f6];return _0x456876;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7358('0x0'));var moment=require('moment');var BPromise=require(_0x7358('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7358('0x2'));var rimraf=require(_0x7358('0x3'));var config=require(_0x7358('0x4'));var attributes=require(_0x7358('0x5'));module['exports']=function(_0x896fe8,_0x3c9553){return _0x896fe8[_0x7358('0x6')]('JscriptyAnswerReport',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 39e2227..59027c0 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 _0x64b4=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x64b4,0xf0));var _0x464b=function(_0x481940,_0x55890f){_0x481940=_0x481940-0x0;var _0x150025=_0x64b4[_0x481940];return _0x150025;};'use strict';var _=require(_0x464b('0x0'));var util=require(_0x464b('0x1'));var moment=require('moment');var BPromise=require(_0x464b('0x2'));var rs=require(_0x464b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x464b('0x4'))('rpc');var config=require(_0x464b('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22726f,_0x20cbe7,_0x184c9f){return new BPromise(function(_0x3e48f6,_0x4ed3cd){return client[_0x464b('0x6')](_0x22726f,_0x184c9f)[_0x464b('0x7')](function(_0x57b8bf){logger[_0x464b('0x8')](_0x464b('0x9'),_0x20cbe7,'request\x20sent');logger['debug'](_0x464b('0xa'),_0x20cbe7,_0x464b('0xb'),JSON[_0x464b('0xc')](_0x57b8bf));if(_0x57b8bf['error']){if(_0x57b8bf[_0x464b('0xd')][_0x464b('0xe')]===0x1f4){logger[_0x464b('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x20cbe7,_0x57b8bf[_0x464b('0xd')][_0x464b('0xf')]);return _0x4ed3cd(_0x57b8bf[_0x464b('0xd')][_0x464b('0xf')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x20cbe7,_0x57b8bf[_0x464b('0xd')][_0x464b('0xf')]);return _0x3e48f6(_0x57b8bf[_0x464b('0xd')][_0x464b('0xf')]);}else{logger[_0x464b('0x8')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x20cbe7,_0x464b('0xb'));_0x3e48f6(_0x57b8bf[_0x464b('0x10')][_0x464b('0xf')]);}})[_0x464b('0x11')](function(_0x3df044){logger['error'](_0x464b('0x9'),_0x20cbe7,_0x3df044);_0x4ed3cd(_0x3df044);});});} \ No newline at end of file +var _0xc1d3=['lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1d3,0x69));var _0x3c1d=function(_0x2915d6,_0x366d1c){_0x2915d6=_0x2915d6-0x0;var _0x578d22=_0xc1d3[_0x2915d6];return _0x578d22;};'use strict';var _=require(_0x3c1d('0x0'));var util=require('util');var moment=require(_0x3c1d('0x1'));var BPromise=require(_0x3c1d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c1d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c1d('0x4'));var logger=require(_0x3c1d('0x5'))(_0x3c1d('0x6'));var config=require(_0x3c1d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3c1d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3694d3,_0x44c6b8,_0x4e1ad3){return new BPromise(function(_0x45e360,_0x72a9a5){return client[_0x3c1d('0x9')](_0x3694d3,_0x4e1ad3)[_0x3c1d('0xa')](function(_0x573d40){logger['info'](_0x3c1d('0xb'),_0x44c6b8,'request\x20sent');logger[_0x3c1d('0xc')](_0x3c1d('0xd'),_0x44c6b8,'request\x20sent',JSON[_0x3c1d('0xe')](_0x573d40));if(_0x573d40[_0x3c1d('0xf')]){if(_0x573d40[_0x3c1d('0xf')][_0x3c1d('0x10')]===0x1f4){logger['error'](_0x3c1d('0xb'),_0x44c6b8,_0x573d40[_0x3c1d('0xf')][_0x3c1d('0x11')]);return _0x72a9a5(_0x573d40[_0x3c1d('0xf')]['message']);}logger['error'](_0x3c1d('0xb'),_0x44c6b8,_0x573d40[_0x3c1d('0xf')]['message']);return _0x45e360(_0x573d40[_0x3c1d('0xf')][_0x3c1d('0x11')]);}else{logger[_0x3c1d('0x12')](_0x3c1d('0xb'),_0x44c6b8,_0x3c1d('0x13'));_0x45e360(_0x573d40[_0x3c1d('0x14')][_0x3c1d('0x11')]);}})['catch'](function(_0x2b8bb6){logger[_0x3c1d('0xf')](_0x3c1d('0xb'),_0x44c6b8,_0x2b8bb6);_0x72a9a5(_0x2b8bb6);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 8a92846..5007e6b 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 _0xcaf2=['./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','put','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x252979,_0x465d63){var _0x6b0a67=function(_0x476262){while(--_0x476262){_0x252979['push'](_0x252979['shift']());}};_0x6b0a67(++_0x465d63);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2c63a4,_0x18a34f){_0x2c63a4=_0x2c63a4-0x0;var _0x210eb8=_0xcaf2[_0x2c63a4];return _0x210eb8;};'use strict';var multer=require(_0x2caf('0x0'));var util=require('util');var path=require(_0x2caf('0x1'));var timeout=require(_0x2caf('0x2'));var express=require('express');var router=express[_0x2caf('0x3')]();var fs_extra=require(_0x2caf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2caf('0x5'));var config=require('../../config/environment');var controller=require(_0x2caf('0x6'));router[_0x2caf('0x7')]('/',auth[_0x2caf('0x8')](),controller['index']);router[_0x2caf('0x7')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xa')]);router['get'](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xc')]);router[_0x2caf('0x7')](_0x2caf('0xd'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xe')]);router[_0x2caf('0x7')](_0x2caf('0xf'),auth['isAuthenticated'](),timeout(_0x2caf('0x10')),controller[_0x2caf('0x11')]);router[_0x2caf('0x12')]('/',auth[_0x2caf('0x8')](),controller[_0x2caf('0x13')]);router[_0x2caf('0x12')](_0x2caf('0x14'),auth[_0x2caf('0x8')](),controller['clone']);router[_0x2caf('0x15')](_0x2caf('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2caf('0x9'),auth['isAuthenticated'](),controller[_0x2caf('0x16')]);module[_0x2caf('0x17')]=router; \ No newline at end of file +var _0x627e=['isAuthenticated','index','get','/:id','show','/:id/sessions','/:id/answers','/:id/summary','30s','getSummary','post','create','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2eb9c3,_0x33e652){var _0x27a94e=function(_0x561c1f){while(--_0x561c1f){_0x2eb9c3['push'](_0x2eb9c3['shift']());}};_0x27a94e(++_0x33e652);}(_0x627e,0x14a));var _0xe627=function(_0x1d1f5f,_0x244991){_0x1d1f5f=_0x1d1f5f-0x0;var _0x4fc8b2=_0x627e[_0x1d1f5f];return _0x4fc8b2;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var fs_extra=require(_0xe627('0x5'));var auth=require(_0xe627('0x6'));var interaction=require(_0xe627('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0xe627('0x8')](),controller[_0xe627('0x9')]);router[_0xe627('0xa')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xc')]);router['get'](_0xe627('0xd'),auth['isAuthenticated'](),controller['getSessions']);router[_0xe627('0xa')](_0xe627('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xe627('0xa')](_0xe627('0xf'),auth[_0xe627('0x8')](),timeout(_0xe627('0x10')),controller[_0xe627('0x11')]);router[_0xe627('0x12')]('/',auth[_0xe627('0x8')](),controller[_0xe627('0x13')]);router[_0xe627('0x12')]('/:id/clone',auth[_0xe627('0x8')](),controller[_0xe627('0x14')]);router[_0xe627('0x15')]('/:id',auth[_0xe627('0x8')](),controller[_0xe627('0x16')]);router[_0xe627('0x17')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0x18')]);module[_0xe627('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 5c22549..195ea80 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 _0xabaf=['lodash','util','exports','STRING','long','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','sequelize'];(function(_0x20076e,_0x38ac65){var _0x21b9a3=function(_0x47eaa0){while(--_0x47eaa0){_0x20076e['push'](_0x20076e['shift']());}};_0x21b9a3(++_0x38ac65);}(_0xabaf,0x1bf));var _0xfaba=function(_0x11e84b,_0x3a6bc7){_0x11e84b=_0x11e84b-0x0;var _0x5e64c6=_0xabaf[_0x11e84b];return _0x5e64c6;};'use strict';var Sequelize=require(_0xfaba('0x0'));var _=require(_0xfaba('0x1'));var util=require(_0xfaba('0x2'));module[_0xfaba('0x3')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xfaba('0x4')]},'formData':{'type':Sequelize['TEXT'](_0xfaba('0x5')),'set':function(_0xf6c4d0){if(_['isObjectLike'](_0xf6c4d0)){this[_0xfaba('0x6')](_0xfaba('0x7'),JSON[_0xfaba('0x8')](_0xf6c4d0));}else if(_[_0xfaba('0x9')](_0xf6c4d0)){this['setDataValue'](_0xfaba('0x7'),_0xf6c4d0);}else{this['setDataValue'](_0xfaba('0x7'),util[_0xfaba('0xa')](_0xfaba('0xb'),this[_0xfaba('0xc')](_0xfaba('0xd'))||'',this[_0xfaba('0xc')](_0xfaba('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xfaba('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x9223=['getDataValue','BOOLEAN','sequelize','lodash','name','long','isObjectLike','formData','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x18343d,_0x3086cb){var _0x498f11=function(_0x18fcee){while(--_0x18fcee){_0x18343d['push'](_0x18343d['shift']());}};_0x498f11(++_0x3086cb);}(_0x9223,0x152));var _0x3922=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0x9223[_0x2984d0];return _0x2885f2;};'use strict';var Sequelize=require(_0x3922('0x0'));var _=require(_0x3922('0x1'));var util=require('util');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3922('0x2')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x3922('0x3')),'set':function(_0x56b7b7){if(_[_0x3922('0x4')](_0x56b7b7)){this['setDataValue'](_0x3922('0x5'),JSON['stringify'](_0x56b7b7));}else if(_[_0x3922('0x6')](_0x56b7b7)){this['setDataValue']('formData',_0x56b7b7);}else{this[_0x3922('0x7')](_0x3922('0x5'),util[_0x3922('0x8')](_0x3922('0x9'),this[_0x3922('0xa')](_0x3922('0x2'))||'',this[_0x3922('0xa')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x3922('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index d88f252..0c1cc0b 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 _0x1d05=['isEmpty','now','writeFileSync','format','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','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','count','offset','limit','set','Content-Range','save','update','then','destroy','UserProfileResource','error','name','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','JscriptyProject','include','findAll','rows','show','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','length','includeAll','merge','omit','createdAt','updatedAt','findOne','JscriptySessionReport','pick','ProjectId','getAnswers','JscriptyAnswerReport','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer'];(function(_0x50ea5e,_0x3640ce){var _0x5eb4d9=function(_0x397d73){while(--_0x397d73){_0x50ea5e['push'](_0x50ea5e['shift']());}};_0x5eb4d9(++_0x3640ce);}(_0x1d05,0x1ee));var _0x51d0=function(_0x63c2db,_0xf82d39){_0x63c2db=_0x63c2db-0x0;var _0x5f304f=_0x1d05[_0x63c2db];return _0x5f304f;};'use strict';var pdf=require(_0x51d0('0x0'));var emlformat=require(_0x51d0('0x1'));var rimraf=require(_0x51d0('0x2'));var zipdir=require(_0x51d0('0x3'));var jsonpatch=require(_0x51d0('0x4'));var rp=require(_0x51d0('0x5'));var moment=require(_0x51d0('0x6'));var BPromise=require(_0x51d0('0x7'));var Mustache=require(_0x51d0('0x8'));var util=require(_0x51d0('0x9'));var path=require(_0x51d0('0xa'));var sox=require(_0x51d0('0xb'));var csv=require(_0x51d0('0xc'));var ejs=require(_0x51d0('0xd'));var fs=require('fs');var fs_extra=require(_0x51d0('0xe'));var _=require('lodash');var squel=require(_0x51d0('0xf'));var crypto=require(_0x51d0('0x10'));var jsforce=require(_0x51d0('0x11'));var deskjs=require(_0x51d0('0x12'));var toCsv=require(_0x51d0('0xc'));var querystring=require(_0x51d0('0x13'));var Papa=require(_0x51d0('0x14'));var Redis=require(_0x51d0('0x15'));var authService=require(_0x51d0('0x16'));var qs=require(_0x51d0('0x17'));var as=require(_0x51d0('0x18'));var hardwareService=require(_0x51d0('0x19'));var logger=require(_0x51d0('0x1a'))('api');var utils=require(_0x51d0('0x1b'));var config=require(_0x51d0('0x1c'));var licenseUtil=require(_0x51d0('0x1d'));var db=require(_0x51d0('0x1e'))['db'];function respondWithStatusCode(_0xc24ec3,_0x3e8c5e){_0x3e8c5e=_0x3e8c5e||0xcc;return function(_0x260f0d){if(_0x260f0d){return _0xc24ec3[_0x51d0('0x1f')](_0x3e8c5e);}return _0xc24ec3[_0x51d0('0x20')](_0x3e8c5e)[_0x51d0('0x21')]();};}function respondWithResult(_0xff8509,_0x56daff){_0x56daff=_0x56daff||0xc8;return function(_0x686fc9){if(_0x686fc9){return _0xff8509[_0x51d0('0x20')](_0x56daff)[_0x51d0('0x22')](_0x686fc9);}};}function respondWithFilteredResult(_0x267b01,_0x5e19f4){return function(_0x142428){if(_0x142428){var _0x53ce37=_0x142428[_0x51d0('0x23')],_0x1885ac=_0x5e19f4[_0x51d0('0x24')],_0x278973=_0x5e19f4['offset']+_0x5e19f4[_0x51d0('0x25')],_0x2f4002;if(_0x278973>=_0x53ce37){_0x278973=_0x53ce37;_0x2f4002=0xc8;}else{_0x2f4002=0xce;}_0x267b01[_0x51d0('0x20')](_0x2f4002);return _0x267b01[_0x51d0('0x26')](_0x51d0('0x27'),_0x1885ac+'-'+_0x278973+'/'+_0x53ce37)[_0x51d0('0x22')](_0x142428);}return null;};}function patchUpdates(_0x1afdcc){return function(_0x4e0137){try{jsonpatch['apply'](_0x4e0137,_0x1afdcc,!![]);}catch(_0x3e9fec){return BPromise['reject'](_0x3e9fec);}return _0x4e0137[_0x51d0('0x28')]();};}function saveUpdates(_0x20db10,_0x458e6c){return function(_0x9b07bc){if(_0x9b07bc){return _0x9b07bc[_0x51d0('0x29')](_0x20db10)[_0x51d0('0x2a')](function(_0x49d9e5){return _0x49d9e5;});}return null;};}function removeEntity(_0x465b83,_0x40480e){return function(_0x28ff45){if(_0x28ff45){return _0x28ff45[_0x51d0('0x2b')]()['then'](function(){var _0x4a1ddc=_0x28ff45['get']({'plain':!![]});var _0x4a1ae5='Projects';return db[_0x51d0('0x2c')][_0x51d0('0x2b')]({'where':{'type':_0x4a1ae5,'resourceId':_0x4a1ddc['id']}})[_0x51d0('0x2a')](function(){return _0x28ff45;});})['then'](function(){_0x465b83['status'](0xcc)[_0x51d0('0x21')]();});}};}function handleEntityNotFound(_0x4cd2d8,_0x24a821){return function(_0x3c989d){if(!_0x3c989d){_0x4cd2d8[_0x51d0('0x1f')](0x194);}return _0x3c989d;};}function handleError(_0x23dd83,_0x523f7a){_0x523f7a=_0x523f7a||0x1f4;return function(_0x4b74be){logger[_0x51d0('0x2d')](_0x4b74be['stack']);if(_0x4b74be[_0x51d0('0x2e')]){delete _0x4b74be['name'];}_0x23dd83[_0x51d0('0x20')](_0x523f7a)['send'](_0x4b74be);};}exports['index']=function(_0x2cef57,_0x16ef27){var _0x2fdf1a={},_0x5717c8={},_0xd549e7={'count':0x0,'rows':[]};var _0x2426f9=_['map'](db['JscriptyProject'][_0x51d0('0x2f')],function(_0x4963b3){return{'name':_0x4963b3[_0x51d0('0x30')],'type':_0x4963b3[_0x51d0('0x31')]['key']};});_0x5717c8[_0x51d0('0x32')]=_[_0x51d0('0x33')](_0x2426f9,_0x51d0('0x2e'));_0x5717c8[_0x51d0('0x34')]=_[_0x51d0('0x35')](_0x2cef57[_0x51d0('0x34')]);_0x5717c8[_0x51d0('0x36')]=_['intersection'](_0x5717c8['model'],_0x5717c8[_0x51d0('0x34')]);_0x2fdf1a[_0x51d0('0x37')]=_[_0x51d0('0x38')](_0x5717c8[_0x51d0('0x32')],qs['fields'](_0x2cef57[_0x51d0('0x34')][_0x51d0('0x39')]));_0x2fdf1a[_0x51d0('0x37')]=_0x2fdf1a[_0x51d0('0x37')]['length']?_0x2fdf1a[_0x51d0('0x37')]:_0x5717c8[_0x51d0('0x32')];if(!_0x2cef57[_0x51d0('0x34')][_0x51d0('0x3a')](_0x51d0('0x3b'))){_0x2fdf1a[_0x51d0('0x25')]=qs[_0x51d0('0x25')](_0x2cef57[_0x51d0('0x34')]['limit']);_0x2fdf1a[_0x51d0('0x24')]=qs[_0x51d0('0x24')](_0x2cef57['query'][_0x51d0('0x24')]);}_0x2fdf1a[_0x51d0('0x3c')]=qs[_0x51d0('0x3d')](_0x2cef57['query'][_0x51d0('0x3d')]);_0x2fdf1a[_0x51d0('0x3e')]=qs[_0x51d0('0x36')](_['pick'](_0x2cef57[_0x51d0('0x34')],_0x5717c8[_0x51d0('0x36')]),_0x2426f9);if(_0x2cef57[_0x51d0('0x34')][_0x51d0('0x3f')]){_0x2fdf1a[_0x51d0('0x3e')]=_['merge'](_0x2fdf1a['where'],{'$or':_['map'](_0x2426f9,function(_0x346888){if(_0x346888[_0x51d0('0x31')]!==_0x51d0('0x40')){var _0x998f04={};_0x998f04[_0x346888[_0x51d0('0x2e')]]={'$like':'%'+_0x2cef57[_0x51d0('0x34')][_0x51d0('0x3f')]+'%'};return _0x998f04;}})});}_0x2fdf1a=_['merge']({},_0x2fdf1a,_0x2cef57[_0x51d0('0x41')]);var _0x17c630={'where':_0x2fdf1a[_0x51d0('0x3e')]};return db[_0x51d0('0x42')][_0x51d0('0x23')](_0x17c630)[_0x51d0('0x2a')](function(_0x1d73d9){_0xd549e7[_0x51d0('0x23')]=_0x1d73d9;if(_0x2cef57[_0x51d0('0x34')]['includeAll']){_0x2fdf1a[_0x51d0('0x43')]=[{'all':!![]}];}return db[_0x51d0('0x42')][_0x51d0('0x44')](_0x2fdf1a);})[_0x51d0('0x2a')](function(_0x19d613){_0xd549e7[_0x51d0('0x45')]=_0x19d613;return _0xd549e7;})[_0x51d0('0x2a')](respondWithFilteredResult(_0x16ef27,_0x2fdf1a))['catch'](handleError(_0x16ef27,null));};exports[_0x51d0('0x46')]=function(_0x2f05ee,_0x10566d){var _0x45dcb4={'raw':![],'where':{'id':_0x2f05ee['params']['id']}},_0x5319f1={};_0x5319f1[_0x51d0('0x32')]=_[_0x51d0('0x35')](db[_0x51d0('0x42')][_0x51d0('0x2f')]);_0x5319f1[_0x51d0('0x34')]=_[_0x51d0('0x35')](_0x2f05ee[_0x51d0('0x34')]);_0x5319f1[_0x51d0('0x36')]=_['intersection'](_0x5319f1[_0x51d0('0x32')],_0x5319f1[_0x51d0('0x34')]);_0x45dcb4[_0x51d0('0x37')]=_[_0x51d0('0x38')](_0x5319f1[_0x51d0('0x32')],qs['fields'](_0x2f05ee[_0x51d0('0x34')]['fields']));_0x45dcb4[_0x51d0('0x37')]=_0x45dcb4[_0x51d0('0x37')]['length']?_0x45dcb4[_0x51d0('0x37')]:_0x5319f1['model'];if(_0x2f05ee[_0x51d0('0x34')]['includeAll']){_0x45dcb4[_0x51d0('0x43')]=[{'all':!![]}];}_0x45dcb4=_['merge']({},_0x45dcb4,_0x2f05ee[_0x51d0('0x41')]);return db[_0x51d0('0x42')][_0x51d0('0x47')](_0x45dcb4)[_0x51d0('0x2a')](handleEntityNotFound(_0x10566d,null))['then'](respondWithResult(_0x10566d,null))[_0x51d0('0x48')](handleError(_0x10566d,null));};exports[_0x51d0('0x49')]=function(_0x2b86f2,_0x36e21a){return db['JscriptyProject'][_0x51d0('0x49')](_0x2b86f2[_0x51d0('0x4a')],{})['then'](function(_0x123aff){var _0x50caf2=_0x2b86f2['user'][_0x51d0('0x4b')]({'plain':!![]});if(!_0x50caf2)throw new Error(_0x51d0('0x4c'));if(_0x50caf2[_0x51d0('0x4d')]===_0x51d0('0x4e')){var _0x364193=_0x123aff[_0x51d0('0x4b')]({'plain':!![]});var _0x37ae97=_0x51d0('0x4f');return db[_0x51d0('0x50')][_0x51d0('0x47')]({'where':{'name':_0x37ae97,'userProfileId':_0x50caf2[_0x51d0('0x51')]},'raw':!![]})['then'](function(_0x152bd2){if(_0x152bd2&&_0x152bd2[_0x51d0('0x52')]===0x0){return db[_0x51d0('0x2c')]['create']({'name':_0x364193[_0x51d0('0x2e')],'resourceId':_0x364193['id'],'type':_0x152bd2[_0x51d0('0x2e')],'sectionId':_0x152bd2['id']},{})[_0x51d0('0x2a')](function(){return _0x123aff;});}else{return _0x123aff;}})[_0x51d0('0x48')](function(_0x4e2e4d){logger[_0x51d0('0x2d')](_0x51d0('0x53'),_0x4e2e4d);throw _0x4e2e4d;});}return _0x123aff;})[_0x51d0('0x2a')](respondWithResult(_0x36e21a,0xc9))[_0x51d0('0x48')](handleError(_0x36e21a,null));};exports['clone']=function(_0x28136f,_0x5c2a80){var _0x148e42={'where':{'id':_0x28136f[_0x51d0('0x54')]['id']}},_0x336ab2={};_0x336ab2[_0x51d0('0x32')]=_[_0x51d0('0x35')](db[_0x51d0('0x42')]['rawAttributes']);_0x148e42['attributes']=_[_0x51d0('0x38')](_0x336ab2[_0x51d0('0x32')],qs[_0x51d0('0x39')](_0x28136f[_0x51d0('0x34')][_0x51d0('0x39')]));_0x148e42[_0x51d0('0x37')]=_0x148e42['attributes'][_0x51d0('0x55')]?_0x148e42[_0x51d0('0x37')]:_0x336ab2[_0x51d0('0x32')];if(_0x28136f[_0x51d0('0x34')][_0x51d0('0x56')]){_0x148e42[_0x51d0('0x43')]=[{'all':!![]}];}_0x148e42=_[_0x51d0('0x57')]({},_0x148e42,_0x28136f[_0x51d0('0x41')]);return db['JscriptyProject'][_0x51d0('0x47')](_0x148e42)[_0x51d0('0x2a')](handleEntityNotFound(_0x5c2a80,null))[_0x51d0('0x2a')](function(_0x48bbe3){if(_0x48bbe3){var _0x415523=_0x48bbe3[_0x51d0('0x4b')]({'plain':!![]});_0x415523=qs[_0x51d0('0x58')](_0x415523,['id',_0x51d0('0x59'),'updatedAt']);_0x28136f[_0x51d0('0x4a')]=_[_0x51d0('0x58')](_0x28136f['body'],['id','createdAt',_0x51d0('0x5a')]);return db[_0x51d0('0x42')][_0x51d0('0x49')](_[_0x51d0('0x57')](_0x415523,_0x28136f[_0x51d0('0x4a')]),{'include':_0x28136f[_0x51d0('0x34')]['includeAll']?[{'all':!![]}]:undefined})[_0x51d0('0x2a')](function(_0x5c8a89){var _0x42af08=_0x28136f[_0x51d0('0x4e')][_0x51d0('0x4b')]({'plain':!![]});if(!_0x42af08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42af08[_0x51d0('0x4d')]===_0x51d0('0x4e')){var _0x2b13b4=_0x5c8a89[_0x51d0('0x4b')]({'plain':!![]});var _0x22ea41=_0x51d0('0x4f');return db[_0x51d0('0x50')][_0x51d0('0x47')]({'where':{'name':_0x22ea41,'userProfileId':_0x42af08['userProfileId']},'raw':!![]})[_0x51d0('0x2a')](function(_0x1916c4){if(_0x1916c4&&_0x1916c4['autoAssociation']===0x0){return db[_0x51d0('0x2c')][_0x51d0('0x49')]({'name':_0x2b13b4['name'],'resourceId':_0x2b13b4['id'],'type':_0x1916c4[_0x51d0('0x2e')],'sectionId':_0x1916c4['id']},{})[_0x51d0('0x2a')](function(){return _0x5c8a89;});}else{return _0x5c8a89;}})[_0x51d0('0x48')](function(_0x1b7946){logger[_0x51d0('0x2d')](_0x51d0('0x53'),_0x1b7946);throw _0x1b7946;});}return _0x5c8a89;});}})['then'](respondWithResult(_0x5c2a80,0xc9))[_0x51d0('0x48')](handleError(_0x5c2a80,null));};exports[_0x51d0('0x29')]=function(_0x3df3fb,_0x174967){if(_0x3df3fb[_0x51d0('0x4a')]['id']){delete _0x3df3fb['body']['id'];}return db[_0x51d0('0x42')][_0x51d0('0x47')]({'where':{'id':_0x3df3fb[_0x51d0('0x54')]['id']}})[_0x51d0('0x2a')](handleEntityNotFound(_0x174967,null))[_0x51d0('0x2a')](saveUpdates(_0x3df3fb[_0x51d0('0x4a')],null))['then'](respondWithResult(_0x174967,null))['catch'](handleError(_0x174967,null));};exports[_0x51d0('0x2b')]=function(_0x1f758c,_0x26371c){return db[_0x51d0('0x42')][_0x51d0('0x47')]({'where':{'id':_0x1f758c[_0x51d0('0x54')]['id']}})[_0x51d0('0x2a')](handleEntityNotFound(_0x26371c,null))['then'](removeEntity(_0x26371c,null))['catch'](handleError(_0x26371c,null));};exports['getSessions']=function(_0x29b250,_0x48ee6d,_0x9c4ed2){var _0x43bce6={'raw':!![],'where':{}};var _0x26e38b={};var _0x4442e8={'count':0x0,'rows':[]};return db[_0x51d0('0x42')][_0x51d0('0x5b')]({'where':{'id':_0x29b250[_0x51d0('0x54')]['id']}})['then'](handleEntityNotFound(_0x48ee6d,null))[_0x51d0('0x2a')](function(_0x2acc26){if(_0x2acc26){_0x26e38b['model']=_[_0x51d0('0x35')](db[_0x51d0('0x5c')][_0x51d0('0x2f')]);_0x26e38b[_0x51d0('0x34')]=_[_0x51d0('0x35')](_0x29b250[_0x51d0('0x34')]);_0x26e38b[_0x51d0('0x36')]=_[_0x51d0('0x38')](_0x26e38b['model'],_0x26e38b[_0x51d0('0x34')]);_0x43bce6[_0x51d0('0x37')]=_[_0x51d0('0x38')](_0x26e38b[_0x51d0('0x32')],qs[_0x51d0('0x39')](_0x29b250['query'][_0x51d0('0x39')]));_0x43bce6['attributes']=_0x43bce6[_0x51d0('0x37')][_0x51d0('0x55')]?_0x43bce6['attributes']:_0x26e38b[_0x51d0('0x32')];if(!_0x29b250[_0x51d0('0x34')][_0x51d0('0x3a')](_0x51d0('0x3b'))){_0x43bce6['limit']=qs[_0x51d0('0x25')](_0x29b250['query']['limit']);_0x43bce6[_0x51d0('0x24')]=qs['offset'](_0x29b250[_0x51d0('0x34')]['offset']);}_0x43bce6[_0x51d0('0x3c')]=qs[_0x51d0('0x3d')](_0x29b250['query'][_0x51d0('0x3d')]);_0x43bce6['where']=qs[_0x51d0('0x36')](_[_0x51d0('0x5d')](_0x29b250['query'],_0x26e38b[_0x51d0('0x36')]));_0x43bce6[_0x51d0('0x3e')][_0x51d0('0x5e')]=_0x2acc26['id'];if(_0x29b250[_0x51d0('0x34')][_0x51d0('0x3f')]){_0x43bce6[_0x51d0('0x3e')]=_[_0x51d0('0x57')](_0x43bce6['where'],{'$or':_['map'](_0x43bce6['attributes'],function(_0x14a3b0){var _0x20f87b={};_0x20f87b[_0x14a3b0]={'$like':'%'+_0x29b250['query']['filter']+'%'};return _0x20f87b;})});}_0x43bce6=_[_0x51d0('0x57')]({},_0x43bce6,_0x29b250[_0x51d0('0x41')]);return db[_0x51d0('0x5c')]['count']({'where':_0x43bce6[_0x51d0('0x3e')]})[_0x51d0('0x2a')](function(_0x4848bd){_0x4442e8[_0x51d0('0x23')]=_0x4848bd;if(_0x29b250[_0x51d0('0x34')][_0x51d0('0x56')]){_0x43bce6[_0x51d0('0x43')]=[{'all':!![]}];}return db[_0x51d0('0x5c')]['findAll'](_0x43bce6);})[_0x51d0('0x2a')](function(_0x7e56b2){_0x4442e8['rows']=_0x7e56b2;return _0x4442e8;});}})[_0x51d0('0x2a')](respondWithFilteredResult(_0x48ee6d,_0x43bce6))[_0x51d0('0x48')](handleError(_0x48ee6d,null));};exports[_0x51d0('0x5f')]=function(_0x431ad2,_0x14651c,_0x156fa2){var _0x1a9bd2={'raw':!![],'where':{}};var _0x4ba5ea={};var _0x9b7061={'count':0x0,'rows':[]};return db[_0x51d0('0x42')][_0x51d0('0x5b')]({'where':{'id':_0x431ad2[_0x51d0('0x54')]['id']}})[_0x51d0('0x2a')](handleEntityNotFound(_0x14651c,null))[_0x51d0('0x2a')](function(_0x2cc9c5){if(_0x2cc9c5){_0x4ba5ea[_0x51d0('0x32')]=_[_0x51d0('0x35')](db[_0x51d0('0x60')][_0x51d0('0x2f')]);_0x4ba5ea[_0x51d0('0x34')]=_['keys'](_0x431ad2[_0x51d0('0x34')]);_0x4ba5ea[_0x51d0('0x36')]=_['intersection'](_0x4ba5ea[_0x51d0('0x32')],_0x4ba5ea[_0x51d0('0x34')]);_0x1a9bd2[_0x51d0('0x37')]=_[_0x51d0('0x38')](_0x4ba5ea[_0x51d0('0x32')],qs[_0x51d0('0x39')](_0x431ad2['query'][_0x51d0('0x39')]));_0x1a9bd2[_0x51d0('0x37')]=_0x1a9bd2['attributes'][_0x51d0('0x55')]?_0x1a9bd2[_0x51d0('0x37')]:_0x4ba5ea[_0x51d0('0x32')];if(!_0x431ad2[_0x51d0('0x34')][_0x51d0('0x3a')]('nolimit')){_0x1a9bd2[_0x51d0('0x25')]=qs[_0x51d0('0x25')](_0x431ad2[_0x51d0('0x34')][_0x51d0('0x25')]);_0x1a9bd2[_0x51d0('0x24')]=qs[_0x51d0('0x24')](_0x431ad2['query'][_0x51d0('0x24')]);}_0x1a9bd2[_0x51d0('0x3c')]=qs[_0x51d0('0x3d')](_0x431ad2[_0x51d0('0x34')][_0x51d0('0x3d')]);_0x1a9bd2[_0x51d0('0x3e')]=qs[_0x51d0('0x36')](_[_0x51d0('0x5d')](_0x431ad2[_0x51d0('0x34')],_0x4ba5ea[_0x51d0('0x36')]));_0x1a9bd2[_0x51d0('0x3e')][_0x51d0('0x5e')]=_0x2cc9c5['id'];if(_0x431ad2[_0x51d0('0x34')]['filter']){_0x1a9bd2[_0x51d0('0x3e')]=_[_0x51d0('0x57')](_0x1a9bd2['where'],{'$or':_[_0x51d0('0x33')](_0x1a9bd2['attributes'],function(_0x5aebc1){var _0xfd0f22={};_0xfd0f22[_0x5aebc1]={'$like':'%'+_0x431ad2[_0x51d0('0x34')][_0x51d0('0x3f')]+'%'};return _0xfd0f22;})});}_0x1a9bd2=_['merge']({},_0x1a9bd2,_0x431ad2['options']);return db[_0x51d0('0x60')][_0x51d0('0x23')]({'where':_0x1a9bd2['where']})[_0x51d0('0x2a')](function(_0x4219ca){_0x9b7061['count']=_0x4219ca;if(_0x431ad2[_0x51d0('0x34')][_0x51d0('0x56')]){_0x1a9bd2['include']=[{'all':!![]}];}return db[_0x51d0('0x60')][_0x51d0('0x44')](_0x1a9bd2);})[_0x51d0('0x2a')](function(_0x32c43f){_0x9b7061[_0x51d0('0x45')]=_0x32c43f;return _0x9b7061;});}})[_0x51d0('0x2a')](respondWithFilteredResult(_0x14651c,_0x1a9bd2))[_0x51d0('0x48')](handleError(_0x14651c,null));};function char(_0x527d37){return'number'===typeof _0x527d37?String[_0x51d0('0x61')]['apply'](null,arguments):_0x527d37;}function needsEncapsulation(_0x1cf238){return!!_0x1cf238&&(_0x1cf238['toString']()[_0x51d0('0x62')](char(0xd))>=0x0||_0x1cf238[_0x51d0('0x63')]()[_0x51d0('0x62')](char(0xa))>=0x0||_0x1cf238['toString']()['indexOf'](char(0x2c))>=0x0||_0x1cf238[_0x51d0('0x63')]()[_0x51d0('0x62')](char(0x22))>=0x0);}function encapsulate(_0x19ed14){var _0x1fc67b=char(0x22),_0x1f212b='\x5c'+char(0x22),_0xaa955e=_0x19ed14[_0x51d0('0x63')]()[_0x51d0('0x64')](new RegExp(_0x1fc67b,'g'),_0x1f212b);return _0x1fc67b+_0xaa955e+_0x1fc67b;}exports[_0x51d0('0x65')]=function(_0x3abdd5,_0xb020b6,_0x4f10a0){var _0x2002d2,_0x47d7b2;var _0x320509={'where':{'ProjectId':_0x3abdd5[_0x51d0('0x54')]['id']}};if(_0x3abdd5[_0x51d0('0x34')][_0x51d0('0x66')]){_0x320509[_0x51d0('0x3e')][_0x51d0('0x67')]=JSON[_0x51d0('0x68')](_0x3abdd5['query'][_0x51d0('0x66')]);}return db[_0x51d0('0x5c')][_0x51d0('0x44')](_0x320509)['then'](handleEntityNotFound(_0xb020b6,null))[_0x51d0('0x2a')](function(_0x2cd265){if(_0x2cd265){_0x2002d2=_0x2cd265;return db['JscriptyQuestionReport'][_0x51d0('0x44')]({'where':{'SessionId':{'$in':_[_0x51d0('0x33')](_0x2002d2,'id')},'ProjectId':_0x3abdd5['params']['id']},'order':_0x51d0('0x69')});}})[_0x51d0('0x2a')](handleEntityNotFound(_0xb020b6,null))['then'](function(_0xc914fd){if(_0xc914fd){_0x47d7b2=_0xc914fd;var _0x2da753={};for(var _0x5025f0=0x0,_0x4a875a=_0x47d7b2[_0x51d0('0x55')];_0x5025f0<_0x4a875a;_0x5025f0++){if(!_0x2da753[_0x51d0('0x3a')](_0x47d7b2[_0x5025f0][_0x51d0('0x6a')])){_0x2da753[_0x47d7b2[_0x5025f0]['questionId']]=needsEncapsulation(_0x47d7b2[_0x5025f0][_0x51d0('0x6b')])?encapsulate(_0x47d7b2[_0x5025f0][_0x51d0('0x6b')]):_0x47d7b2[_0x5025f0][_0x51d0('0x6b')];}}var _0x51f827=[],_0x917487={};for(var _0x5870a2=0x0,_0x411aad=_0x2002d2[_0x51d0('0x55')];_0x5870a2<_0x411aad;_0x5870a2++){_0x917487={'ProjectId':_0x3abdd5[_0x51d0('0x54')]['id'],'SessionId':_0x2002d2[_0x5870a2]['id'],'StartTime':moment(_0x2002d2[_0x5870a2][_0x51d0('0x67')])['format'](_0x51d0('0x6c'))};for(var _0x5c036a=0x0,_0x5dec74=_0x47d7b2['length'];_0x5c036a<_0x5dec74;_0x5c036a++){if(_0x47d7b2[_0x5c036a][_0x51d0('0x6d')]==_0x2002d2[_0x5870a2]['id']&&_0x2da753['hasOwnProperty'](_0x47d7b2[_0x5c036a][_0x51d0('0x6a')])){_0x917487[_0x2da753[_0x47d7b2[_0x5c036a][_0x51d0('0x6a')]]]=_0x47d7b2[_0x5c036a][_0x51d0('0x6e')];}}for(var _0x10eef1 in _0x2da753){if(!_0x917487[_0x51d0('0x3a')](_0x2da753[_0x10eef1])){_0x917487[_0x2da753[_0x10eef1]]=null;}}_0x51f827['push'](_0x917487);}return _0x51f827;}})[_0x51d0('0x2a')](function(_0x5466f6){if(!_[_0x51d0('0x6f')](_0x5466f6)){var _0x16307d=toCsv(_0x5466f6);var _0x1568d0=Date[_0x51d0('0x70')]();fs[_0x51d0('0x71')](util[_0x51d0('0x72')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3abdd5[_0x51d0('0x54')]['id'],_0x1568d0),_0x16307d);_0xb020b6['setHeader']('Content-disposition','attachment;\x20filename='+util[_0x51d0('0x72')](_0x51d0('0x73'),_0x3abdd5[_0x51d0('0x54')]['id'],_0x1568d0));_0xb020b6[_0x51d0('0x74')](_0x51d0('0x75'),_0x51d0('0x76'));return _0xb020b6[_0x51d0('0x77')](util[_0x51d0('0x72')](_0x51d0('0x78'),_0x3abdd5[_0x51d0('0x54')]['id'],_0x1568d0));}else{return _0xb020b6[_0x51d0('0x1f')](0xcc);}})[_0x51d0('0x48')](handleError(_0xb020b6,null));}; \ No newline at end of file +var _0xf931=['get','error','name','send','index','JscriptyProject','rawAttributes','fieldName','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','catch','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','clone','omit','createdAt','body','updatedAt','role','Projects','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','findOne','nolimit','pick','ProjectId','JscriptySessionReport','findAll','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','json','count','offset','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x221df6,_0x1bab55){var _0x163001=function(_0x4485f7){while(--_0x4485f7){_0x221df6['push'](_0x221df6['shift']());}};_0x163001(++_0x1bab55);}(_0xf931,0x1bf));var _0x1f93=function(_0x1e4896,_0x566ad7){_0x1e4896=_0x1e4896-0x0;var _0x50978a=_0xf931[_0x1e4896];return _0x50978a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1f93('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f93('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f93('0x2'));var moment=require(_0x1f93('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1f93('0x4'));var util=require(_0x1f93('0x5'));var path=require(_0x1f93('0x6'));var sox=require(_0x1f93('0x7'));var csv=require(_0x1f93('0x8'));var ejs=require(_0x1f93('0x9'));var fs=require('fs');var fs_extra=require(_0x1f93('0xa'));var _=require(_0x1f93('0xb'));var squel=require(_0x1f93('0xc'));var crypto=require(_0x1f93('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1f93('0xe'));var toCsv=require(_0x1f93('0x8'));var querystring=require(_0x1f93('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f93('0x10'));var qs=require(_0x1f93('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f93('0x12'));var logger=require(_0x1f93('0x13'))(_0x1f93('0x14'));var utils=require(_0x1f93('0x15'));var config=require(_0x1f93('0x16'));var licenseUtil=require(_0x1f93('0x17'));var db=require(_0x1f93('0x18'))['db'];function respondWithStatusCode(_0x5d76d9,_0x2d6bc7){_0x2d6bc7=_0x2d6bc7||0xcc;return function(_0x1c04e1){if(_0x1c04e1){return _0x5d76d9[_0x1f93('0x19')](_0x2d6bc7);}return _0x5d76d9[_0x1f93('0x1a')](_0x2d6bc7)['end']();};}function respondWithResult(_0x4dd185,_0x251f41){_0x251f41=_0x251f41||0xc8;return function(_0x19d801){if(_0x19d801){return _0x4dd185[_0x1f93('0x1a')](_0x251f41)[_0x1f93('0x1b')](_0x19d801);}};}function respondWithFilteredResult(_0x5b503,_0x57f2a5){return function(_0x1ce1e5){if(_0x1ce1e5){var _0x227d7e=_0x1ce1e5[_0x1f93('0x1c')],_0x146b5f=_0x57f2a5[_0x1f93('0x1d')],_0x2ab97b=_0x57f2a5[_0x1f93('0x1d')]+_0x57f2a5['limit'],_0x3b5798;if(_0x2ab97b>=_0x227d7e){_0x2ab97b=_0x227d7e;_0x3b5798=0xc8;}else{_0x3b5798=0xce;}_0x5b503[_0x1f93('0x1a')](_0x3b5798);return _0x5b503[_0x1f93('0x1e')](_0x1f93('0x1f'),_0x146b5f+'-'+_0x2ab97b+'/'+_0x227d7e)['json'](_0x1ce1e5);}return null;};}function patchUpdates(_0x4fcac6){return function(_0x527566){try{jsonpatch[_0x1f93('0x20')](_0x527566,_0x4fcac6,!![]);}catch(_0x38810b){return BPromise[_0x1f93('0x21')](_0x38810b);}return _0x527566[_0x1f93('0x22')]();};}function saveUpdates(_0x44b44c,_0x1054d8){return function(_0xc6b961){if(_0xc6b961){return _0xc6b961['update'](_0x44b44c)[_0x1f93('0x23')](function(_0x289633){return _0x289633;});}return null;};}function removeEntity(_0x6346ef,_0x5c6cd6){return function(_0x3ff37f){if(_0x3ff37f){return _0x3ff37f[_0x1f93('0x24')]()[_0x1f93('0x23')](function(){var _0x16793b=_0x3ff37f[_0x1f93('0x25')]({'plain':!![]});var _0x3ea4c9='Projects';return db['UserProfileResource']['destroy']({'where':{'type':_0x3ea4c9,'resourceId':_0x16793b['id']}})[_0x1f93('0x23')](function(){return _0x3ff37f;});})['then'](function(){_0x6346ef[_0x1f93('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x437951,_0x22c0e0){return function(_0x54e261){if(!_0x54e261){_0x437951[_0x1f93('0x19')](0x194);}return _0x54e261;};}function handleError(_0xf6fdc0,_0x40f049){_0x40f049=_0x40f049||0x1f4;return function(_0x4cc675){logger[_0x1f93('0x26')](_0x4cc675['stack']);if(_0x4cc675[_0x1f93('0x27')]){delete _0x4cc675[_0x1f93('0x27')];}_0xf6fdc0[_0x1f93('0x1a')](_0x40f049)[_0x1f93('0x28')](_0x4cc675);};}exports[_0x1f93('0x29')]=function(_0x1191a2,_0x35d7e3){var _0x5c1df9={},_0x5d50d4={},_0x4eb3bb={'count':0x0,'rows':[]};var _0x20dbfc=_['map'](db[_0x1f93('0x2a')][_0x1f93('0x2b')],function(_0x27e545){return{'name':_0x27e545[_0x1f93('0x2c')],'type':_0x27e545['type']['key']};});_0x5d50d4['model']=_[_0x1f93('0x2d')](_0x20dbfc,_0x1f93('0x27'));_0x5d50d4[_0x1f93('0x2e')]=_['keys'](_0x1191a2[_0x1f93('0x2e')]);_0x5d50d4[_0x1f93('0x2f')]=_[_0x1f93('0x30')](_0x5d50d4[_0x1f93('0x31')],_0x5d50d4[_0x1f93('0x2e')]);_0x5c1df9['attributes']=_[_0x1f93('0x30')](_0x5d50d4['model'],qs[_0x1f93('0x32')](_0x1191a2[_0x1f93('0x2e')]['fields']));_0x5c1df9[_0x1f93('0x33')]=_0x5c1df9[_0x1f93('0x33')][_0x1f93('0x34')]?_0x5c1df9[_0x1f93('0x33')]:_0x5d50d4['model'];if(!_0x1191a2['query'][_0x1f93('0x35')]('nolimit')){_0x5c1df9[_0x1f93('0x36')]=qs['limit'](_0x1191a2[_0x1f93('0x2e')]['limit']);_0x5c1df9['offset']=qs['offset'](_0x1191a2[_0x1f93('0x2e')][_0x1f93('0x1d')]);}_0x5c1df9[_0x1f93('0x37')]=qs[_0x1f93('0x38')](_0x1191a2[_0x1f93('0x2e')]['sort']);_0x5c1df9[_0x1f93('0x39')]=qs[_0x1f93('0x2f')](_['pick'](_0x1191a2['query'],_0x5d50d4['filters']),_0x20dbfc);if(_0x1191a2[_0x1f93('0x2e')]['filter']){_0x5c1df9[_0x1f93('0x39')]=_['merge'](_0x5c1df9[_0x1f93('0x39')],{'$or':_[_0x1f93('0x2d')](_0x20dbfc,function(_0x596869){if(_0x596869[_0x1f93('0x3a')]!==_0x1f93('0x3b')){var _0x417b76={};_0x417b76[_0x596869[_0x1f93('0x27')]]={'$like':'%'+_0x1191a2['query'][_0x1f93('0x3c')]+'%'};return _0x417b76;}})});}_0x5c1df9=_[_0x1f93('0x3d')]({},_0x5c1df9,_0x1191a2[_0x1f93('0x3e')]);var _0x37f71e={'where':_0x5c1df9[_0x1f93('0x39')]};return db[_0x1f93('0x2a')][_0x1f93('0x1c')](_0x37f71e)['then'](function(_0x576289){_0x4eb3bb[_0x1f93('0x1c')]=_0x576289;if(_0x1191a2['query'][_0x1f93('0x3f')]){_0x5c1df9[_0x1f93('0x40')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x5c1df9);})['then'](function(_0x2432e5){_0x4eb3bb['rows']=_0x2432e5;return _0x4eb3bb;})[_0x1f93('0x23')](respondWithFilteredResult(_0x35d7e3,_0x5c1df9))[_0x1f93('0x41')](handleError(_0x35d7e3,null));};exports['show']=function(_0x589476,_0x1334ad){var _0x3604ec={'raw':![],'where':{'id':_0x589476[_0x1f93('0x42')]['id']}},_0x8c66d5={};_0x8c66d5[_0x1f93('0x31')]=_[_0x1f93('0x43')](db[_0x1f93('0x2a')]['rawAttributes']);_0x8c66d5[_0x1f93('0x2e')]=_['keys'](_0x589476['query']);_0x8c66d5['filters']=_[_0x1f93('0x30')](_0x8c66d5[_0x1f93('0x31')],_0x8c66d5[_0x1f93('0x2e')]);_0x3604ec[_0x1f93('0x33')]=_['intersection'](_0x8c66d5[_0x1f93('0x31')],qs['fields'](_0x589476[_0x1f93('0x2e')]['fields']));_0x3604ec['attributes']=_0x3604ec[_0x1f93('0x33')]['length']?_0x3604ec[_0x1f93('0x33')]:_0x8c66d5[_0x1f93('0x31')];if(_0x589476['query'][_0x1f93('0x3f')]){_0x3604ec[_0x1f93('0x40')]=[{'all':!![]}];}_0x3604ec=_[_0x1f93('0x3d')]({},_0x3604ec,_0x589476['options']);return db[_0x1f93('0x2a')][_0x1f93('0x44')](_0x3604ec)[_0x1f93('0x23')](handleEntityNotFound(_0x1334ad,null))['then'](respondWithResult(_0x1334ad,null))[_0x1f93('0x41')](handleError(_0x1334ad,null));};exports[_0x1f93('0x45')]=function(_0x49c255,_0x45a23b){return db[_0x1f93('0x2a')]['create'](_0x49c255['body'],{})[_0x1f93('0x23')](function(_0x401147){var _0x19fdc6=_0x49c255[_0x1f93('0x46')][_0x1f93('0x25')]({'plain':!![]});if(!_0x19fdc6)throw new Error(_0x1f93('0x47'));if(_0x19fdc6['role']===_0x1f93('0x46')){var _0x1dc3de=_0x401147[_0x1f93('0x25')]({'plain':!![]});var _0x1cac97='Projects';return db[_0x1f93('0x48')][_0x1f93('0x44')]({'where':{'name':_0x1cac97,'userProfileId':_0x19fdc6[_0x1f93('0x49')]},'raw':!![]})['then'](function(_0x12d8d0){if(_0x12d8d0&&_0x12d8d0['autoAssociation']===0x0){return db[_0x1f93('0x4a')]['create']({'name':_0x1dc3de[_0x1f93('0x27')],'resourceId':_0x1dc3de['id'],'type':_0x12d8d0[_0x1f93('0x27')],'sectionId':_0x12d8d0['id']},{})[_0x1f93('0x23')](function(){return _0x401147;});}else{return _0x401147;}})[_0x1f93('0x41')](function(_0x3cbb75){logger[_0x1f93('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cbb75);throw _0x3cbb75;});}return _0x401147;})[_0x1f93('0x23')](respondWithResult(_0x45a23b,0xc9))['catch'](handleError(_0x45a23b,null));};exports[_0x1f93('0x4b')]=function(_0x419f97,_0x278a67){var _0x5c56d6={'where':{'id':_0x419f97[_0x1f93('0x42')]['id']}},_0x55080f={};_0x55080f[_0x1f93('0x31')]=_[_0x1f93('0x43')](db[_0x1f93('0x2a')][_0x1f93('0x2b')]);_0x5c56d6['attributes']=_[_0x1f93('0x30')](_0x55080f[_0x1f93('0x31')],qs[_0x1f93('0x32')](_0x419f97['query'][_0x1f93('0x32')]));_0x5c56d6[_0x1f93('0x33')]=_0x5c56d6[_0x1f93('0x33')][_0x1f93('0x34')]?_0x5c56d6[_0x1f93('0x33')]:_0x55080f['model'];if(_0x419f97[_0x1f93('0x2e')][_0x1f93('0x3f')]){_0x5c56d6[_0x1f93('0x40')]=[{'all':!![]}];}_0x5c56d6=_['merge']({},_0x5c56d6,_0x419f97[_0x1f93('0x3e')]);return db[_0x1f93('0x2a')][_0x1f93('0x44')](_0x5c56d6)[_0x1f93('0x23')](handleEntityNotFound(_0x278a67,null))[_0x1f93('0x23')](function(_0x34cfa2){if(_0x34cfa2){var _0x54b355=_0x34cfa2[_0x1f93('0x25')]({'plain':!![]});_0x54b355=qs[_0x1f93('0x4c')](_0x54b355,['id',_0x1f93('0x4d'),'updatedAt']);_0x419f97[_0x1f93('0x4e')]=_[_0x1f93('0x4c')](_0x419f97[_0x1f93('0x4e')],['id',_0x1f93('0x4d'),_0x1f93('0x4f')]);return db['JscriptyProject'][_0x1f93('0x45')](_['merge'](_0x54b355,_0x419f97[_0x1f93('0x4e')]),{'include':_0x419f97['query'][_0x1f93('0x3f')]?[{'all':!![]}]:undefined})[_0x1f93('0x23')](function(_0x4aca84){var _0xdc9f9=_0x419f97['user']['get']({'plain':!![]});if(!_0xdc9f9)throw new Error(_0x1f93('0x47'));if(_0xdc9f9[_0x1f93('0x50')]==='user'){var _0xec1c0e=_0x4aca84['get']({'plain':!![]});var _0x3868f9=_0x1f93('0x51');return db[_0x1f93('0x48')][_0x1f93('0x44')]({'where':{'name':_0x3868f9,'userProfileId':_0xdc9f9[_0x1f93('0x49')]},'raw':!![]})['then'](function(_0x491e02){if(_0x491e02&&_0x491e02['autoAssociation']===0x0){return db[_0x1f93('0x4a')][_0x1f93('0x45')]({'name':_0xec1c0e['name'],'resourceId':_0xec1c0e['id'],'type':_0x491e02[_0x1f93('0x27')],'sectionId':_0x491e02['id']},{})[_0x1f93('0x23')](function(){return _0x4aca84;});}else{return _0x4aca84;}})[_0x1f93('0x41')](function(_0x4511e1){logger[_0x1f93('0x26')](_0x1f93('0x52'),_0x4511e1);throw _0x4511e1;});}return _0x4aca84;});}})['then'](respondWithResult(_0x278a67,0xc9))[_0x1f93('0x41')](handleError(_0x278a67,null));};exports[_0x1f93('0x53')]=function(_0x500543,_0x6d5a96){if(_0x500543[_0x1f93('0x4e')]['id']){delete _0x500543['body']['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x500543[_0x1f93('0x42')]['id']}})['then'](handleEntityNotFound(_0x6d5a96,null))[_0x1f93('0x23')](saveUpdates(_0x500543[_0x1f93('0x4e')],null))['then'](respondWithResult(_0x6d5a96,null))['catch'](handleError(_0x6d5a96,null));};exports[_0x1f93('0x24')]=function(_0x4264a7,_0x4bbc18){return db[_0x1f93('0x2a')][_0x1f93('0x44')]({'where':{'id':_0x4264a7[_0x1f93('0x42')]['id']}})[_0x1f93('0x23')](handleEntityNotFound(_0x4bbc18,null))[_0x1f93('0x23')](removeEntity(_0x4bbc18,null))[_0x1f93('0x41')](handleError(_0x4bbc18,null));};exports[_0x1f93('0x54')]=function(_0x4f36e5,_0x30d1f4,_0x2b89ed){var _0x2bdd83={'raw':!![],'where':{}};var _0x254c5f={};var _0x21883d={'count':0x0,'rows':[]};return db[_0x1f93('0x2a')][_0x1f93('0x55')]({'where':{'id':_0x4f36e5[_0x1f93('0x42')]['id']}})[_0x1f93('0x23')](handleEntityNotFound(_0x30d1f4,null))[_0x1f93('0x23')](function(_0x545046){if(_0x545046){_0x254c5f['model']=_[_0x1f93('0x43')](db['JscriptySessionReport'][_0x1f93('0x2b')]);_0x254c5f['query']=_[_0x1f93('0x43')](_0x4f36e5[_0x1f93('0x2e')]);_0x254c5f[_0x1f93('0x2f')]=_[_0x1f93('0x30')](_0x254c5f['model'],_0x254c5f[_0x1f93('0x2e')]);_0x2bdd83[_0x1f93('0x33')]=_[_0x1f93('0x30')](_0x254c5f['model'],qs['fields'](_0x4f36e5[_0x1f93('0x2e')][_0x1f93('0x32')]));_0x2bdd83['attributes']=_0x2bdd83[_0x1f93('0x33')][_0x1f93('0x34')]?_0x2bdd83['attributes']:_0x254c5f[_0x1f93('0x31')];if(!_0x4f36e5[_0x1f93('0x2e')]['hasOwnProperty'](_0x1f93('0x56'))){_0x2bdd83[_0x1f93('0x36')]=qs[_0x1f93('0x36')](_0x4f36e5[_0x1f93('0x2e')][_0x1f93('0x36')]);_0x2bdd83[_0x1f93('0x1d')]=qs['offset'](_0x4f36e5['query'][_0x1f93('0x1d')]);}_0x2bdd83[_0x1f93('0x37')]=qs[_0x1f93('0x38')](_0x4f36e5[_0x1f93('0x2e')]['sort']);_0x2bdd83['where']=qs['filters'](_[_0x1f93('0x57')](_0x4f36e5[_0x1f93('0x2e')],_0x254c5f['filters']));_0x2bdd83['where'][_0x1f93('0x58')]=_0x545046['id'];if(_0x4f36e5[_0x1f93('0x2e')][_0x1f93('0x3c')]){_0x2bdd83[_0x1f93('0x39')]=_[_0x1f93('0x3d')](_0x2bdd83[_0x1f93('0x39')],{'$or':_['map'](_0x2bdd83[_0x1f93('0x33')],function(_0x2939eb){var _0x43da02={};_0x43da02[_0x2939eb]={'$like':'%'+_0x4f36e5[_0x1f93('0x2e')][_0x1f93('0x3c')]+'%'};return _0x43da02;})});}_0x2bdd83=_['merge']({},_0x2bdd83,_0x4f36e5[_0x1f93('0x3e')]);return db[_0x1f93('0x59')][_0x1f93('0x1c')]({'where':_0x2bdd83[_0x1f93('0x39')]})[_0x1f93('0x23')](function(_0x360a22){_0x21883d[_0x1f93('0x1c')]=_0x360a22;if(_0x4f36e5['query'][_0x1f93('0x3f')]){_0x2bdd83[_0x1f93('0x40')]=[{'all':!![]}];}return db[_0x1f93('0x59')][_0x1f93('0x5a')](_0x2bdd83);})[_0x1f93('0x23')](function(_0x58061b){_0x21883d[_0x1f93('0x5b')]=_0x58061b;return _0x21883d;});}})[_0x1f93('0x23')](respondWithFilteredResult(_0x30d1f4,_0x2bdd83))[_0x1f93('0x41')](handleError(_0x30d1f4,null));};exports[_0x1f93('0x5c')]=function(_0x29622d,_0x18ddc1,_0x900c9f){var _0x1c02b3={'raw':!![],'where':{}};var _0x516684={};var _0x11224f={'count':0x0,'rows':[]};return db[_0x1f93('0x2a')][_0x1f93('0x55')]({'where':{'id':_0x29622d[_0x1f93('0x42')]['id']}})['then'](handleEntityNotFound(_0x18ddc1,null))[_0x1f93('0x23')](function(_0x48173c){if(_0x48173c){_0x516684[_0x1f93('0x31')]=_[_0x1f93('0x43')](db[_0x1f93('0x5d')][_0x1f93('0x2b')]);_0x516684['query']=_['keys'](_0x29622d[_0x1f93('0x2e')]);_0x516684['filters']=_[_0x1f93('0x30')](_0x516684[_0x1f93('0x31')],_0x516684[_0x1f93('0x2e')]);_0x1c02b3['attributes']=_[_0x1f93('0x30')](_0x516684[_0x1f93('0x31')],qs['fields'](_0x29622d['query'][_0x1f93('0x32')]));_0x1c02b3['attributes']=_0x1c02b3[_0x1f93('0x33')][_0x1f93('0x34')]?_0x1c02b3[_0x1f93('0x33')]:_0x516684['model'];if(!_0x29622d['query'][_0x1f93('0x35')]('nolimit')){_0x1c02b3[_0x1f93('0x36')]=qs[_0x1f93('0x36')](_0x29622d[_0x1f93('0x2e')][_0x1f93('0x36')]);_0x1c02b3['offset']=qs[_0x1f93('0x1d')](_0x29622d[_0x1f93('0x2e')][_0x1f93('0x1d')]);}_0x1c02b3[_0x1f93('0x37')]=qs['sort'](_0x29622d[_0x1f93('0x2e')][_0x1f93('0x38')]);_0x1c02b3[_0x1f93('0x39')]=qs[_0x1f93('0x2f')](_[_0x1f93('0x57')](_0x29622d[_0x1f93('0x2e')],_0x516684[_0x1f93('0x2f')]));_0x1c02b3[_0x1f93('0x39')]['ProjectId']=_0x48173c['id'];if(_0x29622d[_0x1f93('0x2e')][_0x1f93('0x3c')]){_0x1c02b3[_0x1f93('0x39')]=_[_0x1f93('0x3d')](_0x1c02b3[_0x1f93('0x39')],{'$or':_[_0x1f93('0x2d')](_0x1c02b3['attributes'],function(_0xf81235){var _0x209aba={};_0x209aba[_0xf81235]={'$like':'%'+_0x29622d['query']['filter']+'%'};return _0x209aba;})});}_0x1c02b3=_[_0x1f93('0x3d')]({},_0x1c02b3,_0x29622d[_0x1f93('0x3e')]);return db[_0x1f93('0x5d')]['count']({'where':_0x1c02b3[_0x1f93('0x39')]})[_0x1f93('0x23')](function(_0x35ad1f){_0x11224f['count']=_0x35ad1f;if(_0x29622d[_0x1f93('0x2e')][_0x1f93('0x3f')]){_0x1c02b3[_0x1f93('0x40')]=[{'all':!![]}];}return db[_0x1f93('0x5d')][_0x1f93('0x5a')](_0x1c02b3);})[_0x1f93('0x23')](function(_0x2b95bf){_0x11224f[_0x1f93('0x5b')]=_0x2b95bf;return _0x11224f;});}})[_0x1f93('0x23')](respondWithFilteredResult(_0x18ddc1,_0x1c02b3))[_0x1f93('0x41')](handleError(_0x18ddc1,null));};function char(_0x4eff7e){return _0x1f93('0x5e')===typeof _0x4eff7e?String[_0x1f93('0x5f')][_0x1f93('0x20')](null,arguments):_0x4eff7e;}function needsEncapsulation(_0x39a747){return!!_0x39a747&&(_0x39a747[_0x1f93('0x60')]()[_0x1f93('0x61')](char(0xd))>=0x0||_0x39a747[_0x1f93('0x60')]()[_0x1f93('0x61')](char(0xa))>=0x0||_0x39a747['toString']()['indexOf'](char(0x2c))>=0x0||_0x39a747[_0x1f93('0x60')]()[_0x1f93('0x61')](char(0x22))>=0x0);}function encapsulate(_0x46420b){var _0x4c39fb=char(0x22),_0x5d9ced='\x5c'+char(0x22),_0x4f4d40=_0x46420b[_0x1f93('0x60')]()[_0x1f93('0x62')](new RegExp(_0x4c39fb,'g'),_0x5d9ced);return _0x4c39fb+_0x4f4d40+_0x4c39fb;}exports[_0x1f93('0x63')]=function(_0x58762f,_0x4e2677,_0x2b77fc){var _0x379ac3,_0x1b050c;var _0x212b50={'where':{'ProjectId':_0x58762f['params']['id']}};if(_0x58762f[_0x1f93('0x2e')]['startTime']){_0x212b50[_0x1f93('0x39')][_0x1f93('0x64')]=JSON[_0x1f93('0x65')](_0x58762f[_0x1f93('0x2e')][_0x1f93('0x66')]);}return db[_0x1f93('0x59')]['findAll'](_0x212b50)['then'](handleEntityNotFound(_0x4e2677,null))[_0x1f93('0x23')](function(_0x2a86d7){if(_0x2a86d7){_0x379ac3=_0x2a86d7;return db[_0x1f93('0x67')][_0x1f93('0x5a')]({'where':{'SessionId':{'$in':_[_0x1f93('0x2d')](_0x379ac3,'id')},'ProjectId':_0x58762f[_0x1f93('0x42')]['id']},'order':_0x1f93('0x68')});}})['then'](handleEntityNotFound(_0x4e2677,null))[_0x1f93('0x23')](function(_0x1561fb){if(_0x1561fb){_0x1b050c=_0x1561fb;var _0x30f2b7={};for(var _0x43517d=0x0,_0x263372=_0x1b050c[_0x1f93('0x34')];_0x43517d<_0x263372;_0x43517d++){if(!_0x30f2b7['hasOwnProperty'](_0x1b050c[_0x43517d][_0x1f93('0x69')])){_0x30f2b7[_0x1b050c[_0x43517d][_0x1f93('0x69')]]=needsEncapsulation(_0x1b050c[_0x43517d][_0x1f93('0x6a')])?encapsulate(_0x1b050c[_0x43517d]['question']):_0x1b050c[_0x43517d][_0x1f93('0x6a')];}}var _0x285d37=[],_0x542538={};for(var _0x2a616e=0x0,_0x3c2c6e=_0x379ac3[_0x1f93('0x34')];_0x2a616e<_0x3c2c6e;_0x2a616e++){_0x542538={'ProjectId':_0x58762f[_0x1f93('0x42')]['id'],'SessionId':_0x379ac3[_0x2a616e]['id'],'StartTime':moment(_0x379ac3[_0x2a616e][_0x1f93('0x64')])[_0x1f93('0x6b')](_0x1f93('0x6c'))};for(var _0x2c1322=0x0,_0x3ecfc1=_0x1b050c[_0x1f93('0x34')];_0x2c1322<_0x3ecfc1;_0x2c1322++){if(_0x1b050c[_0x2c1322]['SessionId']==_0x379ac3[_0x2a616e]['id']&&_0x30f2b7[_0x1f93('0x35')](_0x1b050c[_0x2c1322][_0x1f93('0x69')])){_0x542538[_0x30f2b7[_0x1b050c[_0x2c1322]['questionId']]]=_0x1b050c[_0x2c1322][_0x1f93('0x6d')];}}for(var _0x39acda in _0x30f2b7){if(!_0x542538[_0x1f93('0x35')](_0x30f2b7[_0x39acda])){_0x542538[_0x30f2b7[_0x39acda]]=null;}}_0x285d37[_0x1f93('0x6e')](_0x542538);}return _0x285d37;}})[_0x1f93('0x23')](function(_0x32c153){if(!_[_0x1f93('0x6f')](_0x32c153)){var _0x55040b=toCsv(_0x32c153);var _0x47808c=Date[_0x1f93('0x70')]();fs[_0x1f93('0x71')](util[_0x1f93('0x6b')](_0x1f93('0x72'),_0x58762f[_0x1f93('0x42')]['id'],_0x47808c),_0x55040b);_0x4e2677[_0x1f93('0x73')]('Content-disposition',_0x1f93('0x74')+util[_0x1f93('0x6b')](_0x1f93('0x75'),_0x58762f[_0x1f93('0x42')]['id'],_0x47808c));_0x4e2677[_0x1f93('0x73')](_0x1f93('0x76'),_0x1f93('0x77'));return _0x4e2677[_0x1f93('0x78')](util[_0x1f93('0x6b')](_0x1f93('0x72'),_0x58762f[_0x1f93('0x42')]['id'],_0x47808c));}else{return _0x4e2677[_0x1f93('0x19')](0xcc);}})[_0x1f93('0x41')](handleError(_0x4e2677,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 1fc4338..e11f9a4 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 _0x29ce=['path','rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util','api','moment'];(function(_0x27a76b,_0x1ca15b){var _0x31dd72=function(_0x12a38f){while(--_0x12a38f){_0x27a76b['push'](_0x27a76b['shift']());}};_0x31dd72(++_0x1ca15b);}(_0x29ce,0xec));var _0xe29c=function(_0x43ccb5,_0x23daf0){_0x43ccb5=_0x43ccb5-0x0;var _0x59990b=_0x29ce[_0x43ccb5];return _0x59990b;};'use strict';var _=require(_0xe29c('0x0'));var util=require(_0xe29c('0x1'));var logger=require('../../config/logger')(_0xe29c('0x2'));var moment=require(_0xe29c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe29c('0x4'));var rimraf=require(_0xe29c('0x5'));var config=require('../../config/environment');var attributes=require(_0xe29c('0x6'));module[_0xe29c('0x7')]=function(_0x3effd7,_0x5a7aa6){return _0x3effd7[_0xe29c('0x8')](_0xe29c('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6815=['JscriptyProject','lodash','util','api','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define'];(function(_0x201adb,_0x1cfa60){var _0x17c93d=function(_0x1f96d6){while(--_0x1f96d6){_0x201adb['push'](_0x201adb['shift']());}};_0x17c93d(++_0x1cfa60);}(_0x6815,0x14b));var _0x5681=function(_0x210359,_0x3d9c00){_0x210359=_0x210359-0x0;var _0x3a3615=_0x6815[_0x210359];return _0x3a3615;};'use strict';var _=require(_0x5681('0x0'));var util=require(_0x5681('0x1'));var logger=require('../../config/logger')(_0x5681('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5681('0x3'));var fs=require('fs');var path=require(_0x5681('0x4'));var rimraf=require(_0x5681('0x5'));var config=require(_0x5681('0x6'));var attributes=require(_0x5681('0x7'));module[_0x5681('0x8')]=function(_0x1ed579,_0x148956){return _0x1ed579[_0x5681('0x9')](_0x5681('0xa'),attributes,{'tableName':'jscripty_projects','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 581da5f..12cceea 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 _0x4846=['message','JscriptyProject,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','request\x20sent','stringify','error','code'];(function(_0xc03249,_0x4b6610){var _0x48ac91=function(_0x45fa24){while(--_0x45fa24){_0xc03249['push'](_0xc03249['shift']());}};_0x48ac91(++_0x4b6610);}(_0x4846,0xb8));var _0x6484=function(_0x17c579,_0x1968f3){_0x17c579=_0x17c579-0x0;var _0xe506d7=_0x4846[_0x17c579];return _0xe506d7;};'use strict';var _=require(_0x6484('0x0'));var util=require(_0x6484('0x1'));var moment=require(_0x6484('0x2'));var BPromise=require(_0x6484('0x3'));var rs=require(_0x6484('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6484('0x5'))['db'];var utils=require(_0x6484('0x6'));var logger=require('../../config/logger')(_0x6484('0x7'));var config=require(_0x6484('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6484('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32f5b5,_0x24e478,_0x2b44f0){return new BPromise(function(_0x3945ef,_0xe27a91){return client['request'](_0x32f5b5,_0x2b44f0)[_0x6484('0xa')](function(_0x224799){logger[_0x6484('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x24e478,_0x6484('0xc'));logger['debug']('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x24e478,'request\x20sent',JSON[_0x6484('0xd')](_0x224799));if(_0x224799['error']){if(_0x224799[_0x6484('0xe')][_0x6484('0xf')]===0x1f4){logger[_0x6484('0xe')]('JscriptyProject,\x20%s,\x20%s',_0x24e478,_0x224799[_0x6484('0xe')][_0x6484('0x10')]);return _0xe27a91(_0x224799['error']['message']);}logger[_0x6484('0xe')](_0x6484('0x11'),_0x24e478,_0x224799[_0x6484('0xe')][_0x6484('0x10')]);return _0x3945ef(_0x224799[_0x6484('0xe')]['message']);}else{logger[_0x6484('0xb')](_0x6484('0x11'),_0x24e478,_0x6484('0xc'));_0x3945ef(_0x224799[_0x6484('0x12')][_0x6484('0x10')]);}})[_0x6484('0x13')](function(_0x4613ae){logger[_0x6484('0xe')](_0x6484('0x11'),_0x24e478,_0x4613ae);_0xe27a91(_0x4613ae);});});} \ No newline at end of file +var _0x9c80=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x583de2,_0x481500){var _0xb88271=function(_0x27e65f){while(--_0x27e65f){_0x583de2['push'](_0x583de2['shift']());}};_0xb88271(++_0x481500);}(_0x9c80,0x1e1));var _0x09c8=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x9c80[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x09c8('0x0'));var util=require(_0x09c8('0x1'));var moment=require(_0x09c8('0x2'));var BPromise=require(_0x09c8('0x3'));var rs=require(_0x09c8('0x4'));var fs=require('fs');var Redis=require(_0x09c8('0x5'));var db=require(_0x09c8('0x6'))['db'];var utils=require(_0x09c8('0x7'));var logger=require(_0x09c8('0x8'))(_0x09c8('0x9'));var config=require(_0x09c8('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x09c8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x580537,_0x14707c,_0x30a0c0){return new BPromise(function(_0x5aaaf7,_0x367563){return client['request'](_0x580537,_0x30a0c0)[_0x09c8('0xc')](function(_0x25e47f){logger[_0x09c8('0xd')](_0x09c8('0xe'),_0x14707c,_0x09c8('0xf'));logger[_0x09c8('0x10')](_0x09c8('0x11'),_0x14707c,'request\x20sent',JSON[_0x09c8('0x12')](_0x25e47f));if(_0x25e47f[_0x09c8('0x13')]){if(_0x25e47f[_0x09c8('0x13')][_0x09c8('0x14')]===0x1f4){logger[_0x09c8('0x13')](_0x09c8('0xe'),_0x14707c,_0x25e47f[_0x09c8('0x13')][_0x09c8('0x15')]);return _0x367563(_0x25e47f[_0x09c8('0x13')][_0x09c8('0x15')]);}logger[_0x09c8('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x14707c,_0x25e47f[_0x09c8('0x13')][_0x09c8('0x15')]);return _0x5aaaf7(_0x25e47f[_0x09c8('0x13')][_0x09c8('0x15')]);}else{logger[_0x09c8('0xd')](_0x09c8('0xe'),_0x14707c,_0x09c8('0xf'));_0x5aaaf7(_0x25e47f['result'][_0x09c8('0x15')]);}})[_0x09c8('0x16')](function(_0x2c85ea){logger[_0x09c8('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x14707c,_0x2c85ea);_0x367563(_0x2c85ea);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 3463725..9a05c2c 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 _0x4b2e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','show','post','create','put','update','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x341e80,_0x205963){var _0x4494f9=function(_0x5c8497){while(--_0x5c8497){_0x341e80['push'](_0x341e80['shift']());}};_0x4494f9(++_0x205963);}(_0x4b2e,0xf5));var _0xe4b2=function(_0x3795e3,_0x3389ed){_0x3795e3=_0x3795e3-0x0;var _0x5ea369=_0x4b2e[_0x3795e3];return _0x5ea369;};'use strict';var multer=require(_0xe4b2('0x0'));var util=require(_0xe4b2('0x1'));var path=require(_0xe4b2('0x2'));var timeout=require(_0xe4b2('0x3'));var express=require(_0xe4b2('0x4'));var router=express[_0xe4b2('0x5')]();var fs_extra=require(_0xe4b2('0x6'));var auth=require(_0xe4b2('0x7'));var interaction=require(_0xe4b2('0x8'));var config=require(_0xe4b2('0x9'));var controller=require(_0xe4b2('0xa'));router[_0xe4b2('0xb')]('/',auth[_0xe4b2('0xc')](),controller['index']);router[_0xe4b2('0xb')]('/describe',auth[_0xe4b2('0xc')](),controller[_0xe4b2('0xd')]);router[_0xe4b2('0xb')]('/:id',auth[_0xe4b2('0xc')](),controller[_0xe4b2('0xe')]);router[_0xe4b2('0xf')]('/',auth[_0xe4b2('0xc')](),controller[_0xe4b2('0x10')]);router[_0xe4b2('0x11')]('/:id',auth[_0xe4b2('0xc')](),controller[_0xe4b2('0x12')]);router['delete'](_0xe4b2('0x13'),auth[_0xe4b2('0xc')](),controller[_0xe4b2('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc474=['get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','multer','util','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x32af47,_0x1d57ab){var _0x104e76=function(_0x32626e){while(--_0x32626e){_0x32af47['push'](_0x32af47['shift']());}};_0x104e76(++_0x1d57ab);}(_0xc474,0x174));var _0x4c47=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xc474[_0x45d3f0];return _0x314b79;};'use strict';var multer=require(_0x4c47('0x0'));var util=require(_0x4c47('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4c47('0x2'));var router=express[_0x4c47('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4c47('0x4'));var config=require(_0x4c47('0x5'));var controller=require('./jscriptyQuestionReport.controller');router[_0x4c47('0x6')]('/',auth[_0x4c47('0x7')](),controller[_0x4c47('0x8')]);router[_0x4c47('0x6')](_0x4c47('0x9'),auth[_0x4c47('0x7')](),controller[_0x4c47('0xa')]);router[_0x4c47('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4c47('0xb')]);router[_0x4c47('0xc')]('/',auth['isAuthenticated'](),controller[_0x4c47('0xd')]);router[_0x4c47('0xe')](_0x4c47('0xf'),auth['isAuthenticated'](),controller[_0x4c47('0x10')]);router[_0x4c47('0x11')](_0x4c47('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 1a751d3..bf5b5aa 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 _0x4024=['long','STRING','sequelize','exports','TEXT'];(function(_0x5b26be,_0x24893b){var _0x4c02c9=function(_0x17dac2){while(--_0x17dac2){_0x5b26be['push'](_0x5b26be['shift']());}};_0x4c02c9(++_0x24893b);}(_0x4024,0x89));var _0x4402=function(_0x2f6a97,_0xbb8cb0){_0x2f6a97=_0x2f6a97-0x0;var _0x11af1b=_0x4024[_0x2f6a97];return _0x11af1b;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0x4402('0x2')](_0x4402('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x4402('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4402('0x4')]},'calleridname':{'type':Sequelize[_0x4402('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0565=['long','STRING','sequelize','exports','TEXT'];(function(_0x29b50c,_0x584a2e){var _0xd1028=function(_0x12d3d6){while(--_0x12d3d6){_0x29b50c['push'](_0x29b50c['shift']());}};_0xd1028(++_0x584a2e);}(_0x0565,0xf2));var _0x5056=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x0565[_0x2112d4];return _0x434972;};'use strict';var Sequelize=require(_0x5056('0x0'));module[_0x5056('0x1')]={'question':{'type':Sequelize[_0x5056('0x2')]},'answer':{'type':Sequelize[_0x5056('0x2')](_0x5056('0x3'))},'membername':{'type':Sequelize[_0x5056('0x4')]},'projectname':{'type':Sequelize[_0x5056('0x4')]},'queue':{'type':Sequelize[_0x5056('0x4')]},'uniqueid':{'type':Sequelize[_0x5056('0x4')]},'calleridname':{'type':Sequelize[_0x5056('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x5056('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index bcafe5b..1b7d395 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 _0xb44a=['index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','merge','includeAll','params','options','find','catch','create','body','describe','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send'];(function(_0x2a2b63,_0x24bbed){var _0x4de1e6=function(_0x2d49f2){while(--_0x2d49f2){_0x2a2b63['push'](_0x2a2b63['shift']());}};_0x4de1e6(++_0x24bbed);}(_0xb44a,0x1c2));var _0xab44=function(_0x197767,_0x400276){_0x197767=_0x197767-0x0;var _0x5422c6=_0xb44a[_0x197767];return _0x5422c6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xab44('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab44('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab44('0x2'));var Mustache=require('mustache');var util=require(_0xab44('0x3'));var path=require(_0xab44('0x4'));var sox=require(_0xab44('0x5'));var csv=require(_0xab44('0x6'));var ejs=require(_0xab44('0x7'));var fs=require('fs');var fs_extra=require(_0xab44('0x8'));var _=require(_0xab44('0x9'));var squel=require(_0xab44('0xa'));var crypto=require(_0xab44('0xb'));var jsforce=require(_0xab44('0xc'));var deskjs=require(_0xab44('0xd'));var toCsv=require(_0xab44('0x6'));var querystring=require(_0xab44('0xe'));var Papa=require('papaparse');var Redis=require(_0xab44('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xab44('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xab44('0x11'))(_0xab44('0x12'));var utils=require(_0xab44('0x13'));var config=require(_0xab44('0x14'));var licenseUtil=require(_0xab44('0x15'));var db=require(_0xab44('0x16'))['db'];function respondWithStatusCode(_0x52d282,_0x57fcff){_0x57fcff=_0x57fcff||0xcc;return function(_0x13a1ca){if(_0x13a1ca){return _0x52d282['sendStatus'](_0x57fcff);}return _0x52d282[_0xab44('0x17')](_0x57fcff)['end']();};}function respondWithResult(_0x25f611,_0x15b98a){_0x15b98a=_0x15b98a||0xc8;return function(_0x344e6b){if(_0x344e6b){return _0x25f611[_0xab44('0x17')](_0x15b98a)[_0xab44('0x18')](_0x344e6b);}};}function respondWithFilteredResult(_0x41701b,_0x4875df){return function(_0x51251b){if(_0x51251b){var _0x44c85e=_0x51251b[_0xab44('0x19')],_0x272a5b=_0x4875df[_0xab44('0x1a')],_0x14fe36=_0x4875df[_0xab44('0x1a')]+_0x4875df[_0xab44('0x1b')],_0x33a79d;if(_0x14fe36>=_0x44c85e){_0x14fe36=_0x44c85e;_0x33a79d=0xc8;}else{_0x33a79d=0xce;}_0x41701b[_0xab44('0x17')](_0x33a79d);return _0x41701b[_0xab44('0x1c')](_0xab44('0x1d'),_0x272a5b+'-'+_0x14fe36+'/'+_0x44c85e)['json'](_0x51251b);}return null;};}function patchUpdates(_0xb779bb){return function(_0x401379){try{jsonpatch[_0xab44('0x1e')](_0x401379,_0xb779bb,!![]);}catch(_0x2902ca){return BPromise[_0xab44('0x1f')](_0x2902ca);}return _0x401379['save']();};}function saveUpdates(_0xcd426,_0x59da3b){return function(_0x1f7311){if(_0x1f7311){return _0x1f7311[_0xab44('0x20')](_0xcd426)[_0xab44('0x21')](function(_0x355083){return _0x355083;});}return null;};}function removeEntity(_0x486317,_0x3a2b1d){return function(_0x26fc03){if(_0x26fc03){return _0x26fc03[_0xab44('0x22')]()[_0xab44('0x21')](function(){_0x486317[_0xab44('0x17')](0xcc)[_0xab44('0x23')]();});}};}function handleEntityNotFound(_0x43f1c6,_0x554955){return function(_0x595761){if(!_0x595761){_0x43f1c6[_0xab44('0x24')](0x194);}return _0x595761;};}function handleError(_0x572e0b,_0x2439f3){_0x2439f3=_0x2439f3||0x1f4;return function(_0x5a7269){logger[_0xab44('0x25')](_0x5a7269['stack']);if(_0x5a7269['name']){delete _0x5a7269[_0xab44('0x26')];}_0x572e0b[_0xab44('0x17')](_0x2439f3)[_0xab44('0x27')](_0x5a7269);};}exports[_0xab44('0x28')]=function(_0x132bf6,_0x4e820c){var _0x2f86ac={},_0x5587fe={},_0x5071f3={'count':0x0,'rows':[]};var _0x887b0d=_[_0xab44('0x29')](db[_0xab44('0x2a')][_0xab44('0x2b')],function(_0x4550c8){return{'name':_0x4550c8[_0xab44('0x2c')],'type':_0x4550c8['type'][_0xab44('0x2d')]};});_0x5587fe[_0xab44('0x2e')]=_[_0xab44('0x29')](_0x887b0d,'name');_0x5587fe['query']=_[_0xab44('0x2f')](_0x132bf6['query']);_0x5587fe['filters']=_[_0xab44('0x30')](_0x5587fe[_0xab44('0x2e')],_0x5587fe[_0xab44('0x31')]);_0x2f86ac[_0xab44('0x32')]=_[_0xab44('0x30')](_0x5587fe[_0xab44('0x2e')],qs[_0xab44('0x33')](_0x132bf6[_0xab44('0x31')][_0xab44('0x33')]));_0x2f86ac[_0xab44('0x32')]=_0x2f86ac[_0xab44('0x32')][_0xab44('0x34')]?_0x2f86ac[_0xab44('0x32')]:_0x5587fe[_0xab44('0x2e')];if(!_0x132bf6['query']['hasOwnProperty'](_0xab44('0x35'))){_0x2f86ac[_0xab44('0x1b')]=qs['limit'](_0x132bf6[_0xab44('0x31')][_0xab44('0x1b')]);_0x2f86ac[_0xab44('0x1a')]=qs[_0xab44('0x1a')](_0x132bf6[_0xab44('0x31')][_0xab44('0x1a')]);}_0x2f86ac[_0xab44('0x36')]=qs[_0xab44('0x37')](_0x132bf6[_0xab44('0x31')][_0xab44('0x37')]);_0x2f86ac[_0xab44('0x38')]=qs[_0xab44('0x39')](_[_0xab44('0x3a')](_0x132bf6[_0xab44('0x31')],_0x5587fe[_0xab44('0x39')]),_0x887b0d);if(_0x132bf6[_0xab44('0x31')][_0xab44('0x3b')]){_0x2f86ac[_0xab44('0x38')]=_['merge'](_0x2f86ac[_0xab44('0x38')],{'$or':_[_0xab44('0x29')](_0x887b0d,function(_0x1eaf1f){if(_0x1eaf1f[_0xab44('0x3c')]!=='VIRTUAL'){var _0x2f25c7={};_0x2f25c7[_0x1eaf1f[_0xab44('0x26')]]={'$like':'%'+_0x132bf6[_0xab44('0x31')][_0xab44('0x3b')]+'%'};return _0x2f25c7;}})});}_0x2f86ac=_[_0xab44('0x3d')]({},_0x2f86ac,_0x132bf6['options']);var _0x3d5514={'where':_0x2f86ac[_0xab44('0x38')]};return db[_0xab44('0x2a')]['count'](_0x3d5514)[_0xab44('0x21')](function(_0x1e26de){_0x5071f3[_0xab44('0x19')]=_0x1e26de;if(_0x132bf6[_0xab44('0x31')][_0xab44('0x3e')]){_0x2f86ac['include']=[{'all':!![]}];}return db[_0xab44('0x2a')]['findAll'](_0x2f86ac);})[_0xab44('0x21')](function(_0x4f2b94){_0x5071f3['rows']=_0x4f2b94;return _0x5071f3;})['then'](respondWithFilteredResult(_0x4e820c,_0x2f86ac))['catch'](handleError(_0x4e820c,null));};exports['show']=function(_0x120585,_0x6131f2){var _0x1ab7df={'raw':!![],'where':{'id':_0x120585[_0xab44('0x3f')]['id']}},_0x1aec00={};_0x1aec00[_0xab44('0x2e')]=_[_0xab44('0x2f')](db[_0xab44('0x2a')][_0xab44('0x2b')]);_0x1aec00[_0xab44('0x31')]=_['keys'](_0x120585[_0xab44('0x31')]);_0x1aec00[_0xab44('0x39')]=_[_0xab44('0x30')](_0x1aec00[_0xab44('0x2e')],_0x1aec00['query']);_0x1ab7df[_0xab44('0x32')]=_[_0xab44('0x30')](_0x1aec00[_0xab44('0x2e')],qs[_0xab44('0x33')](_0x120585[_0xab44('0x31')][_0xab44('0x33')]));_0x1ab7df['attributes']=_0x1ab7df['attributes'][_0xab44('0x34')]?_0x1ab7df[_0xab44('0x32')]:_0x1aec00[_0xab44('0x2e')];if(_0x120585[_0xab44('0x31')][_0xab44('0x3e')]){_0x1ab7df['include']=[{'all':!![]}];}_0x1ab7df=_[_0xab44('0x3d')]({},_0x1ab7df,_0x120585[_0xab44('0x40')]);return db[_0xab44('0x2a')][_0xab44('0x41')](_0x1ab7df)['then'](handleEntityNotFound(_0x6131f2,null))[_0xab44('0x21')](respondWithResult(_0x6131f2,null))[_0xab44('0x42')](handleError(_0x6131f2,null));};exports[_0xab44('0x43')]=function(_0x556f7a,_0x3e55fc){return db[_0xab44('0x2a')][_0xab44('0x43')](_0x556f7a[_0xab44('0x44')],{})['then'](respondWithResult(_0x3e55fc,0xc9))[_0xab44('0x42')](handleError(_0x3e55fc,null));};exports['update']=function(_0x36a9f4,_0x1eef1b){if(_0x36a9f4[_0xab44('0x44')]['id']){delete _0x36a9f4[_0xab44('0x44')]['id'];}return db['JscriptyQuestionReport'][_0xab44('0x41')]({'where':{'id':_0x36a9f4['params']['id']}})[_0xab44('0x21')](handleEntityNotFound(_0x1eef1b,null))[_0xab44('0x21')](saveUpdates(_0x36a9f4[_0xab44('0x44')],null))[_0xab44('0x21')](respondWithResult(_0x1eef1b,null))[_0xab44('0x42')](handleError(_0x1eef1b,null));};exports['destroy']=function(_0x4736fd,_0x53ef06){return db[_0xab44('0x2a')][_0xab44('0x41')]({'where':{'id':_0x4736fd[_0xab44('0x3f')]['id']}})['then'](handleEntityNotFound(_0x53ef06,null))[_0xab44('0x21')](removeEntity(_0x53ef06,null))[_0xab44('0x42')](handleError(_0x53ef06,null));};exports[_0xab44('0x45')]=function(_0x160232,_0x41f946){return db['JscriptyQuestionReport']['describe']()[_0xab44('0x21')](respondWithResult(_0x41f946,null))[_0xab44('0x42')](handleError(_0x41f946,null));}; \ No newline at end of file +var _0x937d=['bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','count','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','describe','html-pdf','fast-json-patch','request-promise','moment'];(function(_0x5bd042,_0x17d722){var _0x45156a=function(_0xfc4ed2){while(--_0xfc4ed2){_0x5bd042['push'](_0x5bd042['shift']());}};_0x45156a(++_0x17d722);}(_0x937d,0x1f4));var _0xd937=function(_0x545fe8,_0xf65d5){_0x545fe8=_0x545fe8-0x0;var _0x2318ff=_0x937d[_0x545fe8];return _0x2318ff;};'use strict';var pdf=require(_0xd937('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd937('0x1'));var rp=require(_0xd937('0x2'));var moment=require(_0xd937('0x3'));var BPromise=require(_0xd937('0x4'));var Mustache=require(_0xd937('0x5'));var util=require(_0xd937('0x6'));var path=require('path');var sox=require(_0xd937('0x7'));var csv=require(_0xd937('0x8'));var ejs=require(_0xd937('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd937('0xa'));var squel=require(_0xd937('0xb'));var crypto=require('crypto');var jsforce=require(_0xd937('0xc'));var deskjs=require(_0xd937('0xd'));var toCsv=require(_0xd937('0x8'));var querystring=require(_0xd937('0xe'));var Papa=require(_0xd937('0xf'));var Redis=require('ioredis');var authService=require(_0xd937('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd937('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd937('0x12'))(_0xd937('0x13'));var utils=require(_0xd937('0x14'));var config=require(_0xd937('0x15'));var licenseUtil=require(_0xd937('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb3a15a,_0xa12849){_0xa12849=_0xa12849||0xcc;return function(_0x73b9d4){if(_0x73b9d4){return _0xb3a15a[_0xd937('0x17')](_0xa12849);}return _0xb3a15a[_0xd937('0x18')](_0xa12849)[_0xd937('0x19')]();};}function respondWithResult(_0x3e9e5b,_0x174ddf){_0x174ddf=_0x174ddf||0xc8;return function(_0x29b598){if(_0x29b598){return _0x3e9e5b[_0xd937('0x18')](_0x174ddf)['json'](_0x29b598);}};}function respondWithFilteredResult(_0x2f5ef4,_0x10910c){return function(_0x295a82){if(_0x295a82){var _0x569a9e=_0x295a82['count'],_0x3786f1=_0x10910c[_0xd937('0x1a')],_0x16d2ba=_0x10910c[_0xd937('0x1a')]+_0x10910c[_0xd937('0x1b')],_0xab9a2e;if(_0x16d2ba>=_0x569a9e){_0x16d2ba=_0x569a9e;_0xab9a2e=0xc8;}else{_0xab9a2e=0xce;}_0x2f5ef4[_0xd937('0x18')](_0xab9a2e);return _0x2f5ef4[_0xd937('0x1c')](_0xd937('0x1d'),_0x3786f1+'-'+_0x16d2ba+'/'+_0x569a9e)[_0xd937('0x1e')](_0x295a82);}return null;};}function patchUpdates(_0x311f08){return function(_0x27a1d2){try{jsonpatch[_0xd937('0x1f')](_0x27a1d2,_0x311f08,!![]);}catch(_0x261878){return BPromise[_0xd937('0x20')](_0x261878);}return _0x27a1d2[_0xd937('0x21')]();};}function saveUpdates(_0x166cb9,_0x398861){return function(_0x2699e8){if(_0x2699e8){return _0x2699e8[_0xd937('0x22')](_0x166cb9)['then'](function(_0x7362d9){return _0x7362d9;});}return null;};}function removeEntity(_0x168f3e,_0x86c492){return function(_0x28703a){if(_0x28703a){return _0x28703a[_0xd937('0x23')]()[_0xd937('0x24')](function(){_0x168f3e[_0xd937('0x18')](0xcc)[_0xd937('0x19')]();});}};}function handleEntityNotFound(_0x194fe5,_0x14b350){return function(_0x2bbbd4){if(!_0x2bbbd4){_0x194fe5['sendStatus'](0x194);}return _0x2bbbd4;};}function handleError(_0x4f176f,_0x541ded){_0x541ded=_0x541ded||0x1f4;return function(_0x22ed55){logger[_0xd937('0x25')](_0x22ed55['stack']);if(_0x22ed55[_0xd937('0x26')]){delete _0x22ed55[_0xd937('0x26')];}_0x4f176f[_0xd937('0x18')](_0x541ded)['send'](_0x22ed55);};}exports['index']=function(_0x375351,_0x21794d){var _0x1afcde={},_0x27f120={},_0xef145={'count':0x0,'rows':[]};var _0x46c855=_[_0xd937('0x27')](db[_0xd937('0x28')][_0xd937('0x29')],function(_0x33b7d9){return{'name':_0x33b7d9[_0xd937('0x2a')],'type':_0x33b7d9['type'][_0xd937('0x2b')]};});_0x27f120[_0xd937('0x2c')]=_[_0xd937('0x27')](_0x46c855,_0xd937('0x26'));_0x27f120['query']=_[_0xd937('0x2d')](_0x375351[_0xd937('0x2e')]);_0x27f120[_0xd937('0x2f')]=_[_0xd937('0x30')](_0x27f120[_0xd937('0x2c')],_0x27f120[_0xd937('0x2e')]);_0x1afcde[_0xd937('0x31')]=_[_0xd937('0x30')](_0x27f120[_0xd937('0x2c')],qs[_0xd937('0x32')](_0x375351[_0xd937('0x2e')][_0xd937('0x32')]));_0x1afcde[_0xd937('0x31')]=_0x1afcde[_0xd937('0x31')]['length']?_0x1afcde['attributes']:_0x27f120[_0xd937('0x2c')];if(!_0x375351[_0xd937('0x2e')][_0xd937('0x33')](_0xd937('0x34'))){_0x1afcde[_0xd937('0x1b')]=qs[_0xd937('0x1b')](_0x375351[_0xd937('0x2e')][_0xd937('0x1b')]);_0x1afcde[_0xd937('0x1a')]=qs[_0xd937('0x1a')](_0x375351[_0xd937('0x2e')]['offset']);}_0x1afcde['order']=qs['sort'](_0x375351[_0xd937('0x2e')]['sort']);_0x1afcde[_0xd937('0x35')]=qs['filters'](_[_0xd937('0x36')](_0x375351[_0xd937('0x2e')],_0x27f120[_0xd937('0x2f')]),_0x46c855);if(_0x375351[_0xd937('0x2e')][_0xd937('0x37')]){_0x1afcde[_0xd937('0x35')]=_[_0xd937('0x38')](_0x1afcde[_0xd937('0x35')],{'$or':_[_0xd937('0x27')](_0x46c855,function(_0x43d8aa){if(_0x43d8aa[_0xd937('0x39')]!==_0xd937('0x3a')){var _0x460097={};_0x460097[_0x43d8aa[_0xd937('0x26')]]={'$like':'%'+_0x375351[_0xd937('0x2e')][_0xd937('0x37')]+'%'};return _0x460097;}})});}_0x1afcde=_[_0xd937('0x38')]({},_0x1afcde,_0x375351['options']);var _0x10ff94={'where':_0x1afcde[_0xd937('0x35')]};return db[_0xd937('0x28')][_0xd937('0x3b')](_0x10ff94)[_0xd937('0x24')](function(_0x20b7c2){_0xef145['count']=_0x20b7c2;if(_0x375351[_0xd937('0x2e')]['includeAll']){_0x1afcde[_0xd937('0x3c')]=[{'all':!![]}];}return db[_0xd937('0x28')][_0xd937('0x3d')](_0x1afcde);})[_0xd937('0x24')](function(_0x56d1e1){_0xef145[_0xd937('0x3e')]=_0x56d1e1;return _0xef145;})[_0xd937('0x24')](respondWithFilteredResult(_0x21794d,_0x1afcde))['catch'](handleError(_0x21794d,null));};exports[_0xd937('0x3f')]=function(_0x3a1eb3,_0x240562){var _0x84bbac={'raw':!![],'where':{'id':_0x3a1eb3[_0xd937('0x40')]['id']}},_0x2c53a8={};_0x2c53a8['model']=_['keys'](db[_0xd937('0x28')][_0xd937('0x29')]);_0x2c53a8['query']=_['keys'](_0x3a1eb3[_0xd937('0x2e')]);_0x2c53a8['filters']=_[_0xd937('0x30')](_0x2c53a8[_0xd937('0x2c')],_0x2c53a8[_0xd937('0x2e')]);_0x84bbac[_0xd937('0x31')]=_[_0xd937('0x30')](_0x2c53a8[_0xd937('0x2c')],qs[_0xd937('0x32')](_0x3a1eb3[_0xd937('0x2e')][_0xd937('0x32')]));_0x84bbac[_0xd937('0x31')]=_0x84bbac['attributes'][_0xd937('0x41')]?_0x84bbac[_0xd937('0x31')]:_0x2c53a8[_0xd937('0x2c')];if(_0x3a1eb3[_0xd937('0x2e')][_0xd937('0x42')]){_0x84bbac['include']=[{'all':!![]}];}_0x84bbac=_['merge']({},_0x84bbac,_0x3a1eb3['options']);return db[_0xd937('0x28')][_0xd937('0x43')](_0x84bbac)[_0xd937('0x24')](handleEntityNotFound(_0x240562,null))[_0xd937('0x24')](respondWithResult(_0x240562,null))[_0xd937('0x44')](handleError(_0x240562,null));};exports[_0xd937('0x45')]=function(_0x3ffeec,_0x1adc8c){return db[_0xd937('0x28')]['create'](_0x3ffeec['body'],{})[_0xd937('0x24')](respondWithResult(_0x1adc8c,0xc9))['catch'](handleError(_0x1adc8c,null));};exports[_0xd937('0x22')]=function(_0x4785ec,_0xb5e7c3){if(_0x4785ec[_0xd937('0x46')]['id']){delete _0x4785ec[_0xd937('0x46')]['id'];}return db[_0xd937('0x28')][_0xd937('0x43')]({'where':{'id':_0x4785ec[_0xd937('0x40')]['id']}})[_0xd937('0x24')](handleEntityNotFound(_0xb5e7c3,null))[_0xd937('0x24')](saveUpdates(_0x4785ec[_0xd937('0x46')],null))['then'](respondWithResult(_0xb5e7c3,null))[_0xd937('0x44')](handleError(_0xb5e7c3,null));};exports['destroy']=function(_0x104442,_0x29a143){return db[_0xd937('0x28')][_0xd937('0x43')]({'where':{'id':_0x104442['params']['id']}})[_0xd937('0x24')](handleEntityNotFound(_0x29a143,null))[_0xd937('0x24')](removeEntity(_0x29a143,null))[_0xd937('0x44')](handleError(_0x29a143,null));};exports[_0xd937('0x47')]=function(_0x1536de,_0x33bf64){return db[_0xd937('0x28')][_0xd937('0x47')]()[_0xd937('0x24')](respondWithResult(_0x33bf64,null))['catch'](handleError(_0x33bf64,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index cf65bfc..3033809 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 _0x83c7=['request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','lodash','util','../../config/logger','api','bluebird'];(function(_0x2c96f6,_0x877207){var _0x6d4808=function(_0x567e0c){while(--_0x567e0c){_0x2c96f6['push'](_0x2c96f6['shift']());}};_0x6d4808(++_0x877207);}(_0x83c7,0xdf));var _0x783c=function(_0x16bcbf,_0x227002){_0x16bcbf=_0x16bcbf-0x0;var _0x38fef2=_0x83c7[_0x16bcbf];return _0x38fef2;};'use strict';var _=require(_0x783c('0x0'));var util=require(_0x783c('0x1'));var logger=require(_0x783c('0x2'))(_0x783c('0x3'));var moment=require('moment');var BPromise=require(_0x783c('0x4'));var rp=require(_0x783c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x783c('0x6'));var config=require(_0x783c('0x7'));var attributes=require(_0x783c('0x8'));module[_0x783c('0x9')]=function(_0x2a5ce4,_0x1ad6d1){return _0x2a5ce4[_0x783c('0xa')](_0x783c('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fae=['exports','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x5b2433,_0x55e16e){var _0x43dfe0=function(_0x41bc6c){while(--_0x41bc6c){_0x5b2433['push'](_0x5b2433['shift']());}};_0x43dfe0(++_0x55e16e);}(_0x3fae,0x86));var _0xe3fa=function(_0x5829f6,_0x4a0f92){_0x5829f6=_0x5829f6-0x0;var _0x47b06c=_0x3fae[_0x5829f6];return _0x47b06c;};'use strict';var _=require('lodash');var util=require(_0xe3fa('0x0'));var logger=require(_0xe3fa('0x1'))(_0xe3fa('0x2'));var moment=require(_0xe3fa('0x3'));var BPromise=require('bluebird');var rp=require(_0xe3fa('0x4'));var fs=require('fs');var path=require(_0xe3fa('0x5'));var rimraf=require(_0xe3fa('0x6'));var config=require(_0xe3fa('0x7'));var attributes=require(_0xe3fa('0x8'));module[_0xe3fa('0x9')]=function(_0x34d273,_0x5b6b7a){return _0x34d273[_0xe3fa('0xa')](_0xe3fa('0xb'),attributes,{'tableName':_0xe3fa('0xc'),'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 c3b0dae..91f1793 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 _0x2d9c=['request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x2a8ae2,_0x2c16ce){var _0x14a890=function(_0x2c159b){while(--_0x2c159b){_0x2a8ae2['push'](_0x2a8ae2['shift']());}};_0x14a890(++_0x2c16ce);}(_0x2d9c,0x191));var _0xc2d9=function(_0x131829,_0x5a99ea){_0x131829=_0x131829-0x0;var _0x1e70d4=_0x2d9c[_0x131829];return _0x1e70d4;};'use strict';var _=require(_0xc2d9('0x0'));var util=require(_0xc2d9('0x1'));var moment=require(_0xc2d9('0x2'));var BPromise=require(_0xc2d9('0x3'));var rs=require(_0xc2d9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2d9('0x5'))['db'];var utils=require(_0xc2d9('0x6'));var logger=require(_0xc2d9('0x7'))(_0xc2d9('0x8'));var config=require(_0xc2d9('0x9'));var jayson=require(_0xc2d9('0xa'));var client=jayson[_0xc2d9('0xb')][_0xc2d9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x318bcd,_0xca5736,_0x5e480a){return new BPromise(function(_0x57c5c7,_0x6d6e3){return client[_0xc2d9('0xd')](_0x318bcd,_0x5e480a)[_0xc2d9('0xe')](function(_0x32a469){logger[_0xc2d9('0xf')](_0xc2d9('0x10'),_0xca5736,_0xc2d9('0x11'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0xca5736,_0xc2d9('0x11'),JSON['stringify'](_0x32a469));if(_0x32a469[_0xc2d9('0x12')]){if(_0x32a469[_0xc2d9('0x12')]['code']===0x1f4){logger[_0xc2d9('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xca5736,_0x32a469[_0xc2d9('0x12')][_0xc2d9('0x13')]);return _0x6d6e3(_0x32a469[_0xc2d9('0x12')][_0xc2d9('0x13')]);}logger[_0xc2d9('0x12')](_0xc2d9('0x10'),_0xca5736,_0x32a469['error'][_0xc2d9('0x13')]);return _0x57c5c7(_0x32a469['error'][_0xc2d9('0x13')]);}else{logger[_0xc2d9('0xf')](_0xc2d9('0x10'),_0xca5736,_0xc2d9('0x11'));_0x57c5c7(_0x32a469[_0xc2d9('0x14')]['message']);}})[_0xc2d9('0x15')](function(_0x418477){logger[_0xc2d9('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xca5736,_0x418477);_0x6d6e3(_0x418477);});});} \ No newline at end of file +var _0x6b3c=['info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x3642e7,_0x16358e){var _0x31e3dd=function(_0x188ec6){while(--_0x188ec6){_0x3642e7['push'](_0x3642e7['shift']());}};_0x31e3dd(++_0x16358e);}(_0x6b3c,0x16b));var _0xc6b3=function(_0x5cf30d,_0xb51cb2){_0x5cf30d=_0x5cf30d-0x0;var _0x51deb4=_0x6b3c[_0x5cf30d];return _0x51deb4;};'use strict';var _=require('lodash');var util=require(_0xc6b3('0x0'));var moment=require('moment');var BPromise=require(_0xc6b3('0x1'));var rs=require(_0xc6b3('0x2'));var fs=require('fs');var Redis=require(_0xc6b3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6b3('0x4'));var logger=require(_0xc6b3('0x5'))(_0xc6b3('0x6'));var config=require(_0xc6b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc6b3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18de40,_0x45ac2b,_0x5f3f2a){return new BPromise(function(_0x2c4a0b,_0x25ca84){return client[_0xc6b3('0x9')](_0x18de40,_0x5f3f2a)[_0xc6b3('0xa')](function(_0x1f1f84){logger[_0xc6b3('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x45ac2b,_0xc6b3('0xc'));logger[_0xc6b3('0xd')](_0xc6b3('0xe'),_0x45ac2b,_0xc6b3('0xc'),JSON[_0xc6b3('0xf')](_0x1f1f84));if(_0x1f1f84[_0xc6b3('0x10')]){if(_0x1f1f84[_0xc6b3('0x10')][_0xc6b3('0x11')]===0x1f4){logger[_0xc6b3('0x10')](_0xc6b3('0x12'),_0x45ac2b,_0x1f1f84['error']['message']);return _0x25ca84(_0x1f1f84[_0xc6b3('0x10')][_0xc6b3('0x13')]);}logger[_0xc6b3('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x45ac2b,_0x1f1f84['error'][_0xc6b3('0x13')]);return _0x2c4a0b(_0x1f1f84[_0xc6b3('0x10')][_0xc6b3('0x13')]);}else{logger[_0xc6b3('0xb')](_0xc6b3('0x12'),_0x45ac2b,_0xc6b3('0xc'));_0x2c4a0b(_0x1f1f84[_0xc6b3('0x14')]['message']);}})[_0xc6b3('0x15')](function(_0x3cffbe){logger[_0xc6b3('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x45ac2b,_0x3cffbe);_0x25ca84(_0x3cffbe);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index b4ff7b6..d8a4ab2 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 _0x6f47=['path','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','getQuestions','create','put','update','delete','destroy','util'];(function(_0x11ea9c,_0x3168f6){var _0x17ca3c=function(_0x10cba3){while(--_0x10cba3){_0x11ea9c['push'](_0x11ea9c['shift']());}};_0x17ca3c(++_0x3168f6);}(_0x6f47,0xc7));var _0x76f4=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x6f47[_0x166d93];return _0xba708;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var fs_extra=require(_0x76f4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var controller=require(_0x76f4('0x6'));router[_0x76f4('0x7')]('/',auth['isAuthenticated'](),controller[_0x76f4('0x8')]);router[_0x76f4('0x7')](_0x76f4('0x9'),auth['isAuthenticated'](),controller[_0x76f4('0xa')]);router[_0x76f4('0x7')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0xd')]);router['get']('/:id/questions',auth[_0x76f4('0xc')](),controller[_0x76f4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x76f4('0xf')]);router[_0x76f4('0x10')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0x11')]);router[_0x76f4('0x12')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd8fb=['put','/:id','isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','index','/describe','describe','show','/:id/questions','getQuestions','post'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3b49cd,_0x32ad06){_0x3b49cd=_0x3b49cd-0x0;var _0x2563c5=_0xd8fb[_0x3b49cd];return _0x2563c5;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0x8')]);router['get'](_0xbd8f('0x9'),auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xbd8f('0xb')]);router[_0xbd8f('0x7')](_0xbd8f('0xc'),auth['isAuthenticated'](),controller[_0xbd8f('0xd')]);router[_0xbd8f('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbd8f('0xf')](_0xbd8f('0x10'),auth[_0xbd8f('0x11')](),controller['update']);router[_0xbd8f('0x12')](_0xbd8f('0x10'),auth[_0xbd8f('0x11')](),controller[_0xbd8f('0x13')]);module[_0xbd8f('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9f48d13..acfd1d5 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 _0x40b2=['STRING','BOOLEAN','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x3cb04f,_0x44b1fd){var _0x2eb516=function(_0x3082a9){while(--_0x3082a9){_0x3cb04f['push'](_0x3cb04f['shift']());}};_0x2eb516(++_0x44b1fd);}(_0x40b2,0x142));var _0x240b=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x40b2[_0x5783f4];return _0x28e380;};'use strict';var moment=require('moment');var Sequelize=require(_0x240b('0x0'));module[_0x240b('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x2ba9c3){this[_0x240b('0x2')](_0x240b('0x3'),_0x2ba9c3);this[_0x240b('0x2')](_0x240b('0x4'),moment()[_0x240b('0x5')](_0x240b('0x6')));}},'endtime':{'type':Sequelize[_0x240b('0x7')]},'membername':{'type':Sequelize[_0x240b('0x8')]},'projectname':{'type':Sequelize[_0x240b('0x8')]},'queue':{'type':Sequelize[_0x240b('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x240b('0x8')]},'calleridnum':{'type':Sequelize[_0x240b('0x8')]},'completed':{'type':Sequelize[_0x240b('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xe563=['STRING','BOOLEAN','moment','exports','DATE','starttime','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x24cfa9,_0x459f8e){var _0x29a315=function(_0x2b58f8){while(--_0x2b58f8){_0x24cfa9['push'](_0x24cfa9['shift']());}};_0x29a315(++_0x459f8e);}(_0xe563,0x1cd));var _0x3e56=function(_0x560652,_0x528d25){_0x560652=_0x560652-0x0;var _0x395783=_0xe563[_0x560652];return _0x395783;};'use strict';var moment=require(_0x3e56('0x0'));var Sequelize=require('sequelize');module[_0x3e56('0x1')]={'starttime':{'type':Sequelize[_0x3e56('0x2')],'set':function(_0x14415e){this['setDataValue'](_0x3e56('0x3'),_0x14415e);this[_0x3e56('0x4')](_0x3e56('0x5'),moment()['format'](_0x3e56('0x6')));}},'endtime':{'type':Sequelize[_0x3e56('0x2')]},'membername':{'type':Sequelize[_0x3e56('0x7')]},'projectname':{'type':Sequelize[_0x3e56('0x7')]},'queue':{'type':Sequelize[_0x3e56('0x7')]},'uniqueid':{'type':Sequelize[_0x3e56('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3e56('0x7')]},'completed':{'type':Sequelize[_0x3e56('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 3719eed..24a20f3 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 _0x9067=['catch','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','show','params','includeAll','include','find'];(function(_0x919bbb,_0x55ef48){var _0x40971a=function(_0xc823b6){while(--_0xc823b6){_0x919bbb['push'](_0x919bbb['shift']());}};_0x40971a(++_0x55ef48);}(_0x9067,0x149));var _0x7906=function(_0x46ad7d,_0x54273b){_0x46ad7d=_0x46ad7d-0x0;var _0x54c59d=_0x9067[_0x46ad7d];return _0x54c59d;};'use strict';var pdf=require(_0x7906('0x0'));var emlformat=require(_0x7906('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7906('0x2'));var jsonpatch=require(_0x7906('0x3'));var rp=require(_0x7906('0x4'));var moment=require(_0x7906('0x5'));var BPromise=require(_0x7906('0x6'));var Mustache=require(_0x7906('0x7'));var util=require(_0x7906('0x8'));var path=require(_0x7906('0x9'));var sox=require('sox');var csv=require(_0x7906('0xa'));var ejs=require(_0x7906('0xb'));var fs=require('fs');var fs_extra=require(_0x7906('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7906('0xd'));var deskjs=require(_0x7906('0xe'));var toCsv=require(_0x7906('0xa'));var querystring=require(_0x7906('0xf'));var Papa=require(_0x7906('0x10'));var Redis=require(_0x7906('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7906('0x12'));var as=require(_0x7906('0x13'));var hardwareService=require(_0x7906('0x14'));var logger=require(_0x7906('0x15'))(_0x7906('0x16'));var utils=require('../../config/utils');var config=require(_0x7906('0x17'));var licenseUtil=require(_0x7906('0x18'));var db=require(_0x7906('0x19'))['db'];function respondWithStatusCode(_0x26d8a1,_0x5960e7){_0x5960e7=_0x5960e7||0xcc;return function(_0x49bf75){if(_0x49bf75){return _0x26d8a1[_0x7906('0x1a')](_0x5960e7);}return _0x26d8a1[_0x7906('0x1b')](_0x5960e7)[_0x7906('0x1c')]();};}function respondWithResult(_0x37943a,_0x1f624f){_0x1f624f=_0x1f624f||0xc8;return function(_0x230a1d){if(_0x230a1d){return _0x37943a[_0x7906('0x1b')](_0x1f624f)[_0x7906('0x1d')](_0x230a1d);}};}function respondWithFilteredResult(_0x1ede88,_0x5e9067){return function(_0x1163d9){if(_0x1163d9){var _0x27cd84=_0x1163d9[_0x7906('0x1e')],_0x17335e=_0x5e9067[_0x7906('0x1f')],_0x2688f5=_0x5e9067[_0x7906('0x1f')]+_0x5e9067[_0x7906('0x20')],_0x4740fd;if(_0x2688f5>=_0x27cd84){_0x2688f5=_0x27cd84;_0x4740fd=0xc8;}else{_0x4740fd=0xce;}_0x1ede88[_0x7906('0x1b')](_0x4740fd);return _0x1ede88[_0x7906('0x21')](_0x7906('0x22'),_0x17335e+'-'+_0x2688f5+'/'+_0x27cd84)['json'](_0x1163d9);}return null;};}function patchUpdates(_0x78cc5d){return function(_0x2bb94e){try{jsonpatch[_0x7906('0x23')](_0x2bb94e,_0x78cc5d,!![]);}catch(_0x2f3e7b){return BPromise['reject'](_0x2f3e7b);}return _0x2bb94e[_0x7906('0x24')]();};}function saveUpdates(_0x245bf8,_0x2a9fc0){return function(_0x4bcfb5){if(_0x4bcfb5){return _0x4bcfb5[_0x7906('0x25')](_0x245bf8)['then'](function(_0xeef266){return _0xeef266;});}return null;};}function removeEntity(_0x4c3820,_0xb1ecfa){return function(_0x38c570){if(_0x38c570){return _0x38c570['destroy']()[_0x7906('0x26')](function(){_0x4c3820['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fdfbd,_0x191a42){return function(_0x560a94){if(!_0x560a94){_0x4fdfbd[_0x7906('0x1a')](0x194);}return _0x560a94;};}function handleError(_0xfb3957,_0x2e9914){_0x2e9914=_0x2e9914||0x1f4;return function(_0x5616d1){logger[_0x7906('0x27')](_0x5616d1['stack']);if(_0x5616d1[_0x7906('0x28')]){delete _0x5616d1[_0x7906('0x28')];}_0xfb3957[_0x7906('0x1b')](_0x2e9914)['send'](_0x5616d1);};}exports[_0x7906('0x29')]=function(_0x5bc301,_0x4383e6){var _0x46d153={},_0x178a76={},_0x131529={'count':0x0,'rows':[]};var _0x8da452=_[_0x7906('0x2a')](db[_0x7906('0x2b')][_0x7906('0x2c')],function(_0x5e6e21){return{'name':_0x5e6e21[_0x7906('0x2d')],'type':_0x5e6e21[_0x7906('0x2e')][_0x7906('0x2f')]};});_0x178a76[_0x7906('0x30')]=_['map'](_0x8da452,_0x7906('0x28'));_0x178a76[_0x7906('0x31')]=_[_0x7906('0x32')](_0x5bc301['query']);_0x178a76[_0x7906('0x33')]=_[_0x7906('0x34')](_0x178a76[_0x7906('0x30')],_0x178a76[_0x7906('0x31')]);_0x46d153[_0x7906('0x35')]=_[_0x7906('0x34')](_0x178a76[_0x7906('0x30')],qs['fields'](_0x5bc301[_0x7906('0x31')][_0x7906('0x36')]));_0x46d153[_0x7906('0x35')]=_0x46d153[_0x7906('0x35')][_0x7906('0x37')]?_0x46d153['attributes']:_0x178a76['model'];if(!_0x5bc301[_0x7906('0x31')][_0x7906('0x38')](_0x7906('0x39'))){_0x46d153['limit']=qs[_0x7906('0x20')](_0x5bc301[_0x7906('0x31')][_0x7906('0x20')]);_0x46d153[_0x7906('0x1f')]=qs['offset'](_0x5bc301[_0x7906('0x31')][_0x7906('0x1f')]);}_0x46d153[_0x7906('0x3a')]=qs[_0x7906('0x3b')](_0x5bc301[_0x7906('0x31')][_0x7906('0x3b')]);_0x46d153[_0x7906('0x3c')]=qs['filters'](_[_0x7906('0x3d')](_0x5bc301['query'],_0x178a76[_0x7906('0x33')]),_0x8da452);if(_0x5bc301[_0x7906('0x31')][_0x7906('0x3e')]){_0x46d153[_0x7906('0x3c')]=_['merge'](_0x46d153[_0x7906('0x3c')],{'$or':_['map'](_0x8da452,function(_0x35c184){if(_0x35c184[_0x7906('0x2e')]!=='VIRTUAL'){var _0x520fda={};_0x520fda[_0x35c184[_0x7906('0x28')]]={'$like':'%'+_0x5bc301[_0x7906('0x31')][_0x7906('0x3e')]+'%'};return _0x520fda;}})});}_0x46d153=_[_0x7906('0x3f')]({},_0x46d153,_0x5bc301[_0x7906('0x40')]);var _0x136639={'where':_0x46d153['where']};return db[_0x7906('0x2b')][_0x7906('0x1e')](_0x136639)['then'](function(_0xd33a22){_0x131529['count']=_0xd33a22;if(_0x5bc301[_0x7906('0x31')]['includeAll']){_0x46d153['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x7906('0x41')](_0x46d153);})[_0x7906('0x26')](function(_0x115661){_0x131529['rows']=_0x115661;return _0x131529;})[_0x7906('0x26')](respondWithFilteredResult(_0x4383e6,_0x46d153))['catch'](handleError(_0x4383e6,null));};exports[_0x7906('0x42')]=function(_0x125050,_0x6d0668){var _0x19f445={'raw':!![],'where':{'id':_0x125050[_0x7906('0x43')]['id']}},_0x43c4c8={};_0x43c4c8[_0x7906('0x30')]=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x43c4c8['query']=_['keys'](_0x125050[_0x7906('0x31')]);_0x43c4c8['filters']=_[_0x7906('0x34')](_0x43c4c8[_0x7906('0x30')],_0x43c4c8['query']);_0x19f445['attributes']=_[_0x7906('0x34')](_0x43c4c8[_0x7906('0x30')],qs[_0x7906('0x36')](_0x125050[_0x7906('0x31')][_0x7906('0x36')]));_0x19f445[_0x7906('0x35')]=_0x19f445['attributes'][_0x7906('0x37')]?_0x19f445[_0x7906('0x35')]:_0x43c4c8[_0x7906('0x30')];if(_0x125050[_0x7906('0x31')][_0x7906('0x44')]){_0x19f445[_0x7906('0x45')]=[{'all':!![]}];}_0x19f445=_[_0x7906('0x3f')]({},_0x19f445,_0x125050['options']);return db[_0x7906('0x2b')][_0x7906('0x46')](_0x19f445)[_0x7906('0x26')](handleEntityNotFound(_0x6d0668,null))[_0x7906('0x26')](respondWithResult(_0x6d0668,null))[_0x7906('0x47')](handleError(_0x6d0668,null));};exports[_0x7906('0x48')]=function(_0x18dd0a,_0x94bc31){return db[_0x7906('0x2b')]['create'](_0x18dd0a[_0x7906('0x49')],{})[_0x7906('0x26')](respondWithResult(_0x94bc31,0xc9))[_0x7906('0x47')](handleError(_0x94bc31,null));};exports['update']=function(_0xb7aa4b,_0x15d7fa){if(_0xb7aa4b['body']['id']){delete _0xb7aa4b[_0x7906('0x49')]['id'];}return db[_0x7906('0x2b')]['find']({'where':{'id':_0xb7aa4b[_0x7906('0x43')]['id']}})[_0x7906('0x26')](handleEntityNotFound(_0x15d7fa,null))['then'](saveUpdates(_0xb7aa4b[_0x7906('0x49')],null))[_0x7906('0x26')](respondWithResult(_0x15d7fa,null))[_0x7906('0x47')](handleError(_0x15d7fa,null));};exports[_0x7906('0x4a')]=function(_0x2025c3,_0x24fe02){return db[_0x7906('0x2b')][_0x7906('0x46')]({'where':{'id':_0x2025c3[_0x7906('0x43')]['id']}})['then'](handleEntityNotFound(_0x24fe02,null))[_0x7906('0x26')](removeEntity(_0x24fe02,null))[_0x7906('0x47')](handleError(_0x24fe02,null));};exports[_0x7906('0x4b')]=function(_0x58da40,_0x3aac90){return db[_0x7906('0x2b')][_0x7906('0x4b')]()[_0x7906('0x26')](respondWithResult(_0x3aac90,null))[_0x7906('0x47')](handleError(_0x3aac90,null));};exports[_0x7906('0x4c')]=function(_0x23c81d,_0x429c36,_0x297360){var _0x1c6733={'raw':!![],'where':{}};var _0x298bb4={};var _0x465f15={'count':0x0,'rows':[]};return db[_0x7906('0x2b')][_0x7906('0x4d')]({'where':{'id':_0x23c81d[_0x7906('0x43')]['id']}})[_0x7906('0x26')](handleEntityNotFound(_0x429c36,null))[_0x7906('0x26')](function(_0x3405af){if(_0x3405af){_0x298bb4[_0x7906('0x30')]=_[_0x7906('0x32')](db[_0x7906('0x4e')][_0x7906('0x2c')]);_0x298bb4[_0x7906('0x31')]=_[_0x7906('0x32')](_0x23c81d[_0x7906('0x31')]);_0x298bb4[_0x7906('0x33')]=_['intersection'](_0x298bb4['model'],_0x298bb4[_0x7906('0x31')]);_0x1c6733[_0x7906('0x35')]=_['intersection'](_0x298bb4['model'],qs[_0x7906('0x36')](_0x23c81d['query'][_0x7906('0x36')]));_0x1c6733[_0x7906('0x35')]=_0x1c6733[_0x7906('0x35')]['length']?_0x1c6733[_0x7906('0x35')]:_0x298bb4[_0x7906('0x30')];if(!_0x23c81d[_0x7906('0x31')][_0x7906('0x38')](_0x7906('0x39'))){_0x1c6733[_0x7906('0x20')]=qs[_0x7906('0x20')](_0x23c81d[_0x7906('0x31')][_0x7906('0x20')]);_0x1c6733[_0x7906('0x1f')]=qs[_0x7906('0x1f')](_0x23c81d[_0x7906('0x31')][_0x7906('0x1f')]);}_0x1c6733[_0x7906('0x3a')]=qs['sort'](_0x23c81d[_0x7906('0x31')]['sort']);_0x1c6733[_0x7906('0x3c')]=qs[_0x7906('0x33')](_[_0x7906('0x3d')](_0x23c81d['query'],_0x298bb4['filters']));_0x1c6733[_0x7906('0x3c')][_0x7906('0x4f')]=_0x3405af['id'];if(_0x23c81d[_0x7906('0x31')][_0x7906('0x3e')]){_0x1c6733[_0x7906('0x3c')]=_[_0x7906('0x3f')](_0x1c6733[_0x7906('0x3c')],{'$or':_[_0x7906('0x2a')](_0x1c6733[_0x7906('0x35')],function(_0x11d864){var _0x3f2dda={};_0x3f2dda[_0x11d864]={'$like':'%'+_0x23c81d[_0x7906('0x31')][_0x7906('0x3e')]+'%'};return _0x3f2dda;})});}_0x1c6733=_[_0x7906('0x3f')]({},_0x1c6733,_0x23c81d['options']);return db[_0x7906('0x4e')]['count']({'where':_0x1c6733[_0x7906('0x3c')]})['then'](function(_0xe33c05){_0x465f15[_0x7906('0x1e')]=_0xe33c05;if(_0x23c81d[_0x7906('0x31')][_0x7906('0x44')]){_0x1c6733[_0x7906('0x45')]=[{'all':!![]}];}return db[_0x7906('0x4e')][_0x7906('0x41')](_0x1c6733);})['then'](function(_0x460b34){_0x465f15['rows']=_0x460b34;return _0x465f15;});}})['then'](respondWithFilteredResult(_0x429c36,_0x1c6733))[_0x7906('0x47')](handleError(_0x429c36,null));}; \ No newline at end of file +var _0x9c33=['status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','destroy','describe','getQuestions','JscriptyQuestionReport','hasOwnProperty','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c33,0xe0));var _0x39c3=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x9c33[_0x46d0c9];return _0x174506;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x39c3('0x0'));var rimraf=require(_0x39c3('0x1'));var zipdir=require(_0x39c3('0x2'));var jsonpatch=require(_0x39c3('0x3'));var rp=require(_0x39c3('0x4'));var moment=require(_0x39c3('0x5'));var BPromise=require(_0x39c3('0x6'));var Mustache=require(_0x39c3('0x7'));var util=require('util');var path=require(_0x39c3('0x8'));var sox=require(_0x39c3('0x9'));var csv=require(_0x39c3('0xa'));var ejs=require(_0x39c3('0xb'));var fs=require('fs');var fs_extra=require(_0x39c3('0xc'));var _=require(_0x39c3('0xd'));var squel=require(_0x39c3('0xe'));var crypto=require(_0x39c3('0xf'));var jsforce=require(_0x39c3('0x10'));var deskjs=require(_0x39c3('0x11'));var toCsv=require('to-csv');var querystring=require(_0x39c3('0x12'));var Papa=require(_0x39c3('0x13'));var Redis=require(_0x39c3('0x14'));var authService=require(_0x39c3('0x15'));var qs=require(_0x39c3('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x39c3('0x17'));var logger=require(_0x39c3('0x18'))('api');var utils=require(_0x39c3('0x19'));var config=require(_0x39c3('0x1a'));var licenseUtil=require(_0x39c3('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf654e4,_0x3db7b5){_0x3db7b5=_0x3db7b5||0xcc;return function(_0x16f267){if(_0x16f267){return _0xf654e4['sendStatus'](_0x3db7b5);}return _0xf654e4[_0x39c3('0x1c')](_0x3db7b5)[_0x39c3('0x1d')]();};}function respondWithResult(_0x1bb29e,_0x19f491){_0x19f491=_0x19f491||0xc8;return function(_0x397b0e){if(_0x397b0e){return _0x1bb29e[_0x39c3('0x1c')](_0x19f491)['json'](_0x397b0e);}};}function respondWithFilteredResult(_0x466a7e,_0x2ce6d7){return function(_0x19cfcb){if(_0x19cfcb){var _0xc751a2=_0x19cfcb[_0x39c3('0x1e')],_0x2964fc=_0x2ce6d7[_0x39c3('0x1f')],_0x47d257=_0x2ce6d7[_0x39c3('0x1f')]+_0x2ce6d7[_0x39c3('0x20')],_0x5896ce;if(_0x47d257>=_0xc751a2){_0x47d257=_0xc751a2;_0x5896ce=0xc8;}else{_0x5896ce=0xce;}_0x466a7e[_0x39c3('0x1c')](_0x5896ce);return _0x466a7e[_0x39c3('0x21')](_0x39c3('0x22'),_0x2964fc+'-'+_0x47d257+'/'+_0xc751a2)['json'](_0x19cfcb);}return null;};}function patchUpdates(_0x1d4506){return function(_0x5ce83b){try{jsonpatch[_0x39c3('0x23')](_0x5ce83b,_0x1d4506,!![]);}catch(_0x479ac4){return BPromise[_0x39c3('0x24')](_0x479ac4);}return _0x5ce83b[_0x39c3('0x25')]();};}function saveUpdates(_0x108cc6,_0x26f7d1){return function(_0x2f49db){if(_0x2f49db){return _0x2f49db[_0x39c3('0x26')](_0x108cc6)[_0x39c3('0x27')](function(_0x28150c){return _0x28150c;});}return null;};}function removeEntity(_0x518504,_0x30aa85){return function(_0x41d1eb){if(_0x41d1eb){return _0x41d1eb['destroy']()[_0x39c3('0x27')](function(){_0x518504[_0x39c3('0x1c')](0xcc)[_0x39c3('0x1d')]();});}};}function handleEntityNotFound(_0x418065,_0xa54a64){return function(_0x29d1aa){if(!_0x29d1aa){_0x418065[_0x39c3('0x28')](0x194);}return _0x29d1aa;};}function handleError(_0x567473,_0x1c14c2){_0x1c14c2=_0x1c14c2||0x1f4;return function(_0x563a75){logger[_0x39c3('0x29')](_0x563a75[_0x39c3('0x2a')]);if(_0x563a75[_0x39c3('0x2b')]){delete _0x563a75[_0x39c3('0x2b')];}_0x567473['status'](_0x1c14c2)[_0x39c3('0x2c')](_0x563a75);};}exports[_0x39c3('0x2d')]=function(_0x4783a1,_0x4c0223){var _0x5af63d={},_0x1c8564={},_0x32b420={'count':0x0,'rows':[]};var _0x1213be=_[_0x39c3('0x2e')](db[_0x39c3('0x2f')][_0x39c3('0x30')],function(_0x2bb2df){return{'name':_0x2bb2df[_0x39c3('0x31')],'type':_0x2bb2df['type']['key']};});_0x1c8564[_0x39c3('0x32')]=_[_0x39c3('0x2e')](_0x1213be,_0x39c3('0x2b'));_0x1c8564['query']=_['keys'](_0x4783a1[_0x39c3('0x33')]);_0x1c8564[_0x39c3('0x34')]=_[_0x39c3('0x35')](_0x1c8564['model'],_0x1c8564[_0x39c3('0x33')]);_0x5af63d[_0x39c3('0x36')]=_['intersection'](_0x1c8564[_0x39c3('0x32')],qs[_0x39c3('0x37')](_0x4783a1[_0x39c3('0x33')][_0x39c3('0x37')]));_0x5af63d[_0x39c3('0x36')]=_0x5af63d[_0x39c3('0x36')][_0x39c3('0x38')]?_0x5af63d['attributes']:_0x1c8564[_0x39c3('0x32')];if(!_0x4783a1[_0x39c3('0x33')]['hasOwnProperty'](_0x39c3('0x39'))){_0x5af63d[_0x39c3('0x20')]=qs[_0x39c3('0x20')](_0x4783a1[_0x39c3('0x33')][_0x39c3('0x20')]);_0x5af63d[_0x39c3('0x1f')]=qs[_0x39c3('0x1f')](_0x4783a1['query'][_0x39c3('0x1f')]);}_0x5af63d[_0x39c3('0x3a')]=qs['sort'](_0x4783a1[_0x39c3('0x33')][_0x39c3('0x3b')]);_0x5af63d[_0x39c3('0x3c')]=qs[_0x39c3('0x34')](_[_0x39c3('0x3d')](_0x4783a1['query'],_0x1c8564[_0x39c3('0x34')]),_0x1213be);if(_0x4783a1['query'][_0x39c3('0x3e')]){_0x5af63d['where']=_['merge'](_0x5af63d[_0x39c3('0x3c')],{'$or':_['map'](_0x1213be,function(_0x32191c){if(_0x32191c[_0x39c3('0x3f')]!==_0x39c3('0x40')){var _0x21f295={};_0x21f295[_0x32191c[_0x39c3('0x2b')]]={'$like':'%'+_0x4783a1['query']['filter']+'%'};return _0x21f295;}})});}_0x5af63d=_[_0x39c3('0x41')]({},_0x5af63d,_0x4783a1['options']);var _0x13a1f3={'where':_0x5af63d[_0x39c3('0x3c')]};return db['JscriptySessionReport'][_0x39c3('0x1e')](_0x13a1f3)[_0x39c3('0x27')](function(_0x1d450f){_0x32b420[_0x39c3('0x1e')]=_0x1d450f;if(_0x4783a1[_0x39c3('0x33')][_0x39c3('0x42')]){_0x5af63d[_0x39c3('0x43')]=[{'all':!![]}];}return db[_0x39c3('0x2f')][_0x39c3('0x44')](_0x5af63d);})['then'](function(_0x21867b){_0x32b420[_0x39c3('0x45')]=_0x21867b;return _0x32b420;})[_0x39c3('0x27')](respondWithFilteredResult(_0x4c0223,_0x5af63d))['catch'](handleError(_0x4c0223,null));};exports[_0x39c3('0x46')]=function(_0x2f496d,_0x2a771f){var _0x789725={'raw':!![],'where':{'id':_0x2f496d[_0x39c3('0x47')]['id']}},_0x27f6fd={};_0x27f6fd[_0x39c3('0x32')]=_[_0x39c3('0x48')](db[_0x39c3('0x2f')]['rawAttributes']);_0x27f6fd['query']=_[_0x39c3('0x48')](_0x2f496d[_0x39c3('0x33')]);_0x27f6fd[_0x39c3('0x34')]=_[_0x39c3('0x35')](_0x27f6fd[_0x39c3('0x32')],_0x27f6fd['query']);_0x789725[_0x39c3('0x36')]=_[_0x39c3('0x35')](_0x27f6fd[_0x39c3('0x32')],qs['fields'](_0x2f496d[_0x39c3('0x33')][_0x39c3('0x37')]));_0x789725[_0x39c3('0x36')]=_0x789725[_0x39c3('0x36')][_0x39c3('0x38')]?_0x789725[_0x39c3('0x36')]:_0x27f6fd['model'];if(_0x2f496d[_0x39c3('0x33')][_0x39c3('0x42')]){_0x789725[_0x39c3('0x43')]=[{'all':!![]}];}_0x789725=_['merge']({},_0x789725,_0x2f496d[_0x39c3('0x49')]);return db['JscriptySessionReport'][_0x39c3('0x4a')](_0x789725)[_0x39c3('0x27')](handleEntityNotFound(_0x2a771f,null))['then'](respondWithResult(_0x2a771f,null))[_0x39c3('0x4b')](handleError(_0x2a771f,null));};exports[_0x39c3('0x4c')]=function(_0x28309a,_0x327849){return db['JscriptySessionReport'][_0x39c3('0x4c')](_0x28309a[_0x39c3('0x4d')],{})[_0x39c3('0x27')](respondWithResult(_0x327849,0xc9))[_0x39c3('0x4b')](handleError(_0x327849,null));};exports[_0x39c3('0x26')]=function(_0x407fd3,_0x3e8f53){if(_0x407fd3[_0x39c3('0x4d')]['id']){delete _0x407fd3[_0x39c3('0x4d')]['id'];}return db[_0x39c3('0x2f')][_0x39c3('0x4a')]({'where':{'id':_0x407fd3[_0x39c3('0x47')]['id']}})[_0x39c3('0x27')](handleEntityNotFound(_0x3e8f53,null))[_0x39c3('0x27')](saveUpdates(_0x407fd3[_0x39c3('0x4d')],null))[_0x39c3('0x27')](respondWithResult(_0x3e8f53,null))[_0x39c3('0x4b')](handleError(_0x3e8f53,null));};exports[_0x39c3('0x4e')]=function(_0x50ad10,_0x3730fa){return db[_0x39c3('0x2f')][_0x39c3('0x4a')]({'where':{'id':_0x50ad10[_0x39c3('0x47')]['id']}})[_0x39c3('0x27')](handleEntityNotFound(_0x3730fa,null))['then'](removeEntity(_0x3730fa,null))[_0x39c3('0x4b')](handleError(_0x3730fa,null));};exports[_0x39c3('0x4f')]=function(_0x48eccf,_0x304637){return db[_0x39c3('0x2f')][_0x39c3('0x4f')]()[_0x39c3('0x27')](respondWithResult(_0x304637,null))[_0x39c3('0x4b')](handleError(_0x304637,null));};exports[_0x39c3('0x50')]=function(_0x47bebf,_0x50171d,_0x5d0e4d){var _0x2bb39f={'raw':!![],'where':{}};var _0x4494b3={};var _0x2c5831={'count':0x0,'rows':[]};return db[_0x39c3('0x2f')]['findOne']({'where':{'id':_0x47bebf[_0x39c3('0x47')]['id']}})['then'](handleEntityNotFound(_0x50171d,null))['then'](function(_0x4bd0ab){if(_0x4bd0ab){_0x4494b3['model']=_['keys'](db[_0x39c3('0x51')][_0x39c3('0x30')]);_0x4494b3['query']=_['keys'](_0x47bebf[_0x39c3('0x33')]);_0x4494b3[_0x39c3('0x34')]=_[_0x39c3('0x35')](_0x4494b3[_0x39c3('0x32')],_0x4494b3[_0x39c3('0x33')]);_0x2bb39f[_0x39c3('0x36')]=_[_0x39c3('0x35')](_0x4494b3[_0x39c3('0x32')],qs['fields'](_0x47bebf[_0x39c3('0x33')]['fields']));_0x2bb39f['attributes']=_0x2bb39f[_0x39c3('0x36')][_0x39c3('0x38')]?_0x2bb39f[_0x39c3('0x36')]:_0x4494b3[_0x39c3('0x32')];if(!_0x47bebf[_0x39c3('0x33')][_0x39c3('0x52')](_0x39c3('0x39'))){_0x2bb39f[_0x39c3('0x20')]=qs[_0x39c3('0x20')](_0x47bebf['query'][_0x39c3('0x20')]);_0x2bb39f['offset']=qs[_0x39c3('0x1f')](_0x47bebf[_0x39c3('0x33')][_0x39c3('0x1f')]);}_0x2bb39f['order']=qs['sort'](_0x47bebf[_0x39c3('0x33')][_0x39c3('0x3b')]);_0x2bb39f[_0x39c3('0x3c')]=qs[_0x39c3('0x34')](_[_0x39c3('0x3d')](_0x47bebf[_0x39c3('0x33')],_0x4494b3[_0x39c3('0x34')]));_0x2bb39f['where'][_0x39c3('0x53')]=_0x4bd0ab['id'];if(_0x47bebf[_0x39c3('0x33')][_0x39c3('0x3e')]){_0x2bb39f[_0x39c3('0x3c')]=_[_0x39c3('0x41')](_0x2bb39f[_0x39c3('0x3c')],{'$or':_[_0x39c3('0x2e')](_0x2bb39f[_0x39c3('0x36')],function(_0x1ccf5f){var _0x14e7cd={};_0x14e7cd[_0x1ccf5f]={'$like':'%'+_0x47bebf['query'][_0x39c3('0x3e')]+'%'};return _0x14e7cd;})});}_0x2bb39f=_['merge']({},_0x2bb39f,_0x47bebf[_0x39c3('0x49')]);return db['JscriptyQuestionReport'][_0x39c3('0x1e')]({'where':_0x2bb39f[_0x39c3('0x3c')]})[_0x39c3('0x27')](function(_0x193b46){_0x2c5831[_0x39c3('0x1e')]=_0x193b46;if(_0x47bebf[_0x39c3('0x33')][_0x39c3('0x42')]){_0x2bb39f[_0x39c3('0x43')]=[{'all':!![]}];}return db[_0x39c3('0x51')][_0x39c3('0x44')](_0x2bb39f);})[_0x39c3('0x27')](function(_0x3fbbf1){_0x2c5831['rows']=_0x3fbbf1;return _0x2c5831;});}})[_0x39c3('0x27')](respondWithFilteredResult(_0x50171d,_0x2bb39f))[_0x39c3('0x4b')](handleError(_0x50171d,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index d159a15..413abd6 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 _0x51dc=['JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x3fd153,_0x1c8184){var _0x3f42d0=function(_0x421ced){while(--_0x421ced){_0x3fd153['push'](_0x3fd153['shift']());}};_0x3f42d0(++_0x1c8184);}(_0x51dc,0x1af));var _0xc51d=function(_0x5a1c5f,_0x466439){_0x5a1c5f=_0x5a1c5f-0x0;var _0x5bede0=_0x51dc[_0x5a1c5f];return _0x5bede0;};'use strict';var _=require(_0xc51d('0x0'));var util=require('util');var logger=require(_0xc51d('0x1'))(_0xc51d('0x2'));var moment=require(_0xc51d('0x3'));var BPromise=require(_0xc51d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc51d('0x5'));var rimraf=require(_0xc51d('0x6'));var config=require(_0xc51d('0x7'));var attributes=require(_0xc51d('0x8'));module['exports']=function(_0x28f889,_0x53fd3c){return _0x28f889['define'](_0xc51d('0x9'),attributes,{'tableName':_0xc51d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbed=['path','exports','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','request-promise'];(function(_0x2f1def,_0x2cdf79){var _0x6c2c9c=function(_0x4477f6){while(--_0x4477f6){_0x2f1def['push'](_0x2f1def['shift']());}};_0x6c2c9c(++_0x2cdf79);}(_0xcbed,0x151));var _0xdcbe=function(_0x21c253,_0x31a1c0){_0x21c253=_0x21c253-0x0;var _0x2c1abf=_0xcbed[_0x21c253];return _0x2c1abf;};'use strict';var _=require(_0xdcbe('0x0'));var util=require('util');var logger=require(_0xdcbe('0x1'))(_0xdcbe('0x2'));var moment=require(_0xdcbe('0x3'));var BPromise=require('bluebird');var rp=require(_0xdcbe('0x4'));var fs=require('fs');var path=require(_0xdcbe('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0xdcbe('0x6')]=function(_0x2945a8,_0x2d4cc7){return _0x2945a8['define'](_0xdcbe('0x7'),attributes,{'tableName':_0xdcbe('0x8'),'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 b4e051c..f3e705c 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 _0x376f=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x243ccc,_0x4d4de1){var _0x9a2114=function(_0x4010b7){while(--_0x4010b7){_0x243ccc['push'](_0x243ccc['shift']());}};_0x9a2114(++_0x4d4de1);}(_0x376f,0x18c));var _0xf376=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x376f[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xf376('0x0'));var util=require(_0xf376('0x1'));var moment=require(_0xf376('0x2'));var BPromise=require(_0xf376('0x3'));var rs=require(_0xf376('0x4'));var fs=require('fs');var Redis=require(_0xf376('0x5'));var db=require(_0xf376('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf376('0x7'))(_0xf376('0x8'));var config=require(_0xf376('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf376('0xa')][_0xf376('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a9d7b,_0x1c4fac,_0x1a8964){return new BPromise(function(_0x25cd67,_0x18ec33){return client[_0xf376('0xc')](_0x5a9d7b,_0x1a8964)[_0xf376('0xd')](function(_0x285e32){logger[_0xf376('0xe')](_0xf376('0xf'),_0x1c4fac,_0xf376('0x10'));logger[_0xf376('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x1c4fac,_0xf376('0x10'),JSON['stringify'](_0x285e32));if(_0x285e32[_0xf376('0x12')]){if(_0x285e32[_0xf376('0x12')][_0xf376('0x13')]===0x1f4){logger[_0xf376('0x12')](_0xf376('0xf'),_0x1c4fac,_0x285e32[_0xf376('0x12')][_0xf376('0x14')]);return _0x18ec33(_0x285e32[_0xf376('0x12')][_0xf376('0x14')]);}logger[_0xf376('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x1c4fac,_0x285e32[_0xf376('0x12')]['message']);return _0x25cd67(_0x285e32['error'][_0xf376('0x14')]);}else{logger[_0xf376('0xe')](_0xf376('0xf'),_0x1c4fac,_0xf376('0x10'));_0x25cd67(_0x285e32[_0xf376('0x15')]['message']);}})[_0xf376('0x16')](function(_0x420dec){logger[_0xf376('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x1c4fac,_0x420dec);_0x18ec33(_0x420dec);});});} \ No newline at end of file +var _0x7c80=['JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','request\x20sent','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c80,0xa4));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x07c8('0x0'));var util=require(_0x07c8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x07c8('0x2'));var fs=require('fs');var Redis=require(_0x07c8('0x3'));var db=require(_0x07c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x07c8('0x5'))(_0x07c8('0x6'));var config=require(_0x07c8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x07c8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a5354,_0x204052,_0xc0c7bf){return new BPromise(function(_0x32d564,_0x20dd0c){return client[_0x07c8('0x9')](_0x4a5354,_0xc0c7bf)[_0x07c8('0xa')](function(_0x58ae16){logger[_0x07c8('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x204052,'request\x20sent');logger[_0x07c8('0xc')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x204052,_0x07c8('0xd'),JSON['stringify'](_0x58ae16));if(_0x58ae16['error']){if(_0x58ae16[_0x07c8('0xe')][_0x07c8('0xf')]===0x1f4){logger[_0x07c8('0xe')](_0x07c8('0x10'),_0x204052,_0x58ae16['error'][_0x07c8('0x11')]);return _0x20dd0c(_0x58ae16[_0x07c8('0xe')][_0x07c8('0x11')]);}logger[_0x07c8('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x204052,_0x58ae16['error'][_0x07c8('0x11')]);return _0x32d564(_0x58ae16['error'][_0x07c8('0x11')]);}else{logger[_0x07c8('0xb')](_0x07c8('0x10'),_0x204052,_0x07c8('0xd'));_0x32d564(_0x58ae16[_0x07c8('0x12')][_0x07c8('0x11')]);}})[_0x07c8('0x13')](function(_0x33a4e4){logger[_0x07c8('0xe')](_0x07c8('0x10'),_0x204052,_0x33a4e4);_0x20dd0c(_0x33a4e4);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 9156ac8..99c230c 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 _0x3821=['exports','multer','util','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3821,0x6d));var _0x1382=function(_0x219645,_0x284e9f){_0x219645=_0x219645-0x0;var _0x599ff5=_0x3821[_0x219645];return _0x599ff5;};'use strict';var multer=require(_0x1382('0x0'));var util=require(_0x1382('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1382('0x2'));var auth=require(_0x1382('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1382('0x4'));var controller=require(_0x1382('0x5'));router[_0x1382('0x6')]('/',controller['index']);router[_0x1382('0x7')](_0x1382('0x8'),auth[_0x1382('0x9')](),controller[_0x1382('0xa')]);module[_0x1382('0xb')]=router; \ No newline at end of file +var _0x0bcf=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','put','isAuthenticated','update','exports','path','connect-timeout','express'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x0bcf,0xb3));var _0xf0bc=function(_0x38a27d,_0x3720b9){_0x38a27d=_0x38a27d-0x0;var _0xf2494c=_0x0bcf[_0x38a27d];return _0xf2494c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf0bc('0x0'));var timeout=require(_0xf0bc('0x1'));var express=require(_0xf0bc('0x2'));var router=express[_0xf0bc('0x3')]();var fs_extra=require(_0xf0bc('0x4'));var auth=require(_0xf0bc('0x5'));var interaction=require(_0xf0bc('0x6'));var config=require(_0xf0bc('0x7'));var controller=require(_0xf0bc('0x8'));router['get']('/',controller[_0xf0bc('0x9')]);router[_0xf0bc('0xa')]('/:id',auth[_0xf0bc('0xb')](),controller[_0xf0bc('0xc')]);module[_0xf0bc('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index d8a2cb6..e319aae 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 _0xdbf5=['exports','STRING','INTEGER'];(function(_0x2d8864,_0x34171a){var _0x435a6a=function(_0x3deecd){while(--_0x3deecd){_0x2d8864['push'](_0x2d8864['shift']());}};_0x435a6a(++_0x34171a);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x462aba,_0x9b0c9f){_0x462aba=_0x462aba-0x0;var _0x4983ef=_0xdbf5[_0x462aba];return _0x4983ef;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x5dbf('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x5dbf('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xda19=['exports','TEXT','STRING'];(function(_0x3b38de,_0x34fbc2){var _0xf3e068=function(_0x3d483d){while(--_0x3d483d){_0x3b38de['push'](_0x3b38de['shift']());}};_0xf3e068(++_0x34fbc2);}(_0xda19,0xd5));var _0x9da1=function(_0xbc455,_0x455435){_0xbc455=_0xbc455-0x0;var _0x78b10a=_0xda19[_0xbc455];return _0x78b10a;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'license':{'type':Sequelize[_0x9da1('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x9da1('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index c26c492..84a5abe 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 _0x8518=['send','keys','License','query','filters','model','attributes','intersection','fields','length','merge','options','getLicense','catch','body','params','get','checkLicense','demo','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name'];(function(_0x3489aa,_0x4e1fb5){var _0x5f145b=function(_0x1c6c82){while(--_0x1c6c82){_0x3489aa['push'](_0x3489aa['shift']());}};_0x5f145b(++_0x4e1fb5);}(_0x8518,0xca));var _0x8851=function(_0x45be52,_0x46d496){_0x45be52=_0x45be52-0x0;var _0x15294f=_0x8518[_0x45be52];return _0x15294f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8851('0x0'));var rimraf=require(_0x8851('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8851('0x2'));var rp=require(_0x8851('0x3'));var moment=require('moment');var BPromise=require(_0x8851('0x4'));var Mustache=require(_0x8851('0x5'));var util=require(_0x8851('0x6'));var path=require(_0x8851('0x7'));var sox=require(_0x8851('0x8'));var csv=require(_0x8851('0x9'));var ejs=require(_0x8851('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8851('0xb'));var squel=require(_0x8851('0xc'));var crypto=require('crypto');var jsforce=require(_0x8851('0xd'));var deskjs=require(_0x8851('0xe'));var toCsv=require(_0x8851('0x9'));var querystring=require(_0x8851('0xf'));var Papa=require(_0x8851('0x10'));var Redis=require(_0x8851('0x11'));var authService=require(_0x8851('0x12'));var qs=require(_0x8851('0x13'));var as=require(_0x8851('0x14'));var hardwareService=require(_0x8851('0x15'));var logger=require(_0x8851('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x8851('0x17'));var licenseUtil=require(_0x8851('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38691e,_0x4f847a){_0x4f847a=_0x4f847a||0xcc;return function(_0x245643){if(_0x245643){return _0x38691e[_0x8851('0x19')](_0x4f847a);}return _0x38691e[_0x8851('0x1a')](_0x4f847a)[_0x8851('0x1b')]();};}function respondWithResult(_0x47b192,_0x243610){_0x243610=_0x243610||0xc8;return function(_0x5f4dcf){if(_0x5f4dcf){return _0x47b192[_0x8851('0x1a')](_0x243610)[_0x8851('0x1c')](_0x5f4dcf);}};}function respondWithFilteredResult(_0x1e5345,_0x8e111c){return function(_0x26c8fe){if(_0x26c8fe){var _0xf33480=_0x26c8fe[_0x8851('0x1d')],_0x17fbec=_0x8e111c[_0x8851('0x1e')],_0x33bc9e=_0x8e111c['offset']+_0x8e111c[_0x8851('0x1f')],_0x157d8d;if(_0x33bc9e>=_0xf33480){_0x33bc9e=_0xf33480;_0x157d8d=0xc8;}else{_0x157d8d=0xce;}_0x1e5345[_0x8851('0x1a')](_0x157d8d);return _0x1e5345[_0x8851('0x20')](_0x8851('0x21'),_0x17fbec+'-'+_0x33bc9e+'/'+_0xf33480)[_0x8851('0x1c')](_0x26c8fe);}return null;};}function patchUpdates(_0x52a603){return function(_0x1e0c10){try{jsonpatch['apply'](_0x1e0c10,_0x52a603,!![]);}catch(_0x11cefe){return BPromise[_0x8851('0x22')](_0x11cefe);}return _0x1e0c10[_0x8851('0x23')]();};}function saveUpdates(_0x148f5c,_0xb3135f){return function(_0x31eacb){if(_0x31eacb){return _0x31eacb[_0x8851('0x24')](_0x148f5c)[_0x8851('0x25')](function(_0x4b3b4b){return _0x4b3b4b;});}return null;};}function removeEntity(_0x32dd86,_0x546aad){return function(_0x43383a){if(_0x43383a){return _0x43383a[_0x8851('0x26')]()['then'](function(){_0x32dd86[_0x8851('0x1a')](0xcc)[_0x8851('0x1b')]();});}};}function handleEntityNotFound(_0x132bf3,_0x360ea4){return function(_0x5ddccb){if(!_0x5ddccb){_0x132bf3[_0x8851('0x19')](0x194);}return _0x5ddccb;};}function handleError(_0x1513ed,_0x48a7c7){_0x48a7c7=_0x48a7c7||0x1f4;return function(_0x100ea0){logger[_0x8851('0x27')](_0x100ea0[_0x8851('0x28')]);if(_0x100ea0[_0x8851('0x29')]){delete _0x100ea0[_0x8851('0x29')];}_0x1513ed[_0x8851('0x1a')](_0x48a7c7)[_0x8851('0x2a')](_0x100ea0);};}var utilLicense=require(_0x8851('0x18'));exports['index']=function(_0x25964e,_0x46b6df){var _0x331c27={'raw':!![],'where':{'id':0x1}},_0x5e2a54={};_0x5e2a54['model']=_[_0x8851('0x2b')](db[_0x8851('0x2c')]['rawAttributes']);_0x5e2a54[_0x8851('0x2d')]=_[_0x8851('0x2b')](_0x25964e[_0x8851('0x2d')]);_0x5e2a54[_0x8851('0x2e')]=_['intersection'](_0x5e2a54[_0x8851('0x2f')],_0x5e2a54[_0x8851('0x2d')]);_0x331c27[_0x8851('0x30')]=_[_0x8851('0x31')](_0x5e2a54[_0x8851('0x2f')],qs[_0x8851('0x32')](_0x25964e[_0x8851('0x2d')][_0x8851('0x32')]));_0x331c27['attributes']=_0x331c27['attributes'][_0x8851('0x33')]?_0x331c27['attributes']:_0x5e2a54[_0x8851('0x2f')];_0x331c27=_[_0x8851('0x34')]({},_0x331c27,_0x25964e[_0x8851('0x35')]);return utilLicense[_0x8851('0x36')](_0x331c27)['then'](respondWithResult(_0x46b6df,null))[_0x8851('0x37')](handleError(_0x46b6df,null));};exports['update']=function(_0x45a13c,_0x1b9a5a){if(_0x45a13c[_0x8851('0x38')]['id']){delete _0x45a13c['body']['id'];}return db[_0x8851('0x2c')]['find']({'where':{'id':_0x45a13c[_0x8851('0x39')]['id']}})[_0x8851('0x25')](handleEntityNotFound(_0x1b9a5a,null))[_0x8851('0x25')](function(_0x58a4e9){var _0x26518b=_0x58a4e9[_0x8851('0x3a')]({'plain':!![]});return utilLicense[_0x8851('0x3b')](_0x26518b,_0x45a13c['body']['key']);})[_0x8851('0x25')](function(_0x4df6ac){if(!_0x4df6ac[_0x8851('0x3c')]){return saveUpdates(_0x45a13c[_0x8851('0x38')],null);}return _0x4df6ac;})['then'](respondWithResult(_0x1b9a5a,null))[_0x8851('0x37')](handleError(_0x1b9a5a,null));}; \ No newline at end of file +var _0x0b29=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','../../config/license/util','model','License','rawAttributes','query','filters','intersection','attributes','fields','merge','options','getLicense','catch','body','params','checkLicense','key','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox'];(function(_0x58a600,_0x1f1e79){var _0xc656ef=function(_0x3e5e6b){while(--_0x3e5e6b){_0x58a600['push'](_0x58a600['shift']());}};_0xc656ef(++_0x1f1e79);}(_0x0b29,0x11b));var _0x90b2=function(_0x3452a8,_0x4bfaa4){_0x3452a8=_0x3452a8-0x0;var _0x233814=_0x0b29[_0x3452a8];return _0x233814;};'use strict';var pdf=require(_0x90b2('0x0'));var emlformat=require(_0x90b2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x90b2('0x2'));var rp=require(_0x90b2('0x3'));var moment=require('moment');var BPromise=require(_0x90b2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x90b2('0x5'));var sox=require(_0x90b2('0x6'));var csv=require(_0x90b2('0x7'));var ejs=require(_0x90b2('0x8'));var fs=require('fs');var fs_extra=require(_0x90b2('0x9'));var _=require(_0x90b2('0xa'));var squel=require(_0x90b2('0xb'));var crypto=require(_0x90b2('0xc'));var jsforce=require(_0x90b2('0xd'));var deskjs=require(_0x90b2('0xe'));var toCsv=require(_0x90b2('0x7'));var querystring=require(_0x90b2('0xf'));var Papa=require(_0x90b2('0x10'));var Redis=require(_0x90b2('0x11'));var authService=require(_0x90b2('0x12'));var qs=require(_0x90b2('0x13'));var as=require(_0x90b2('0x14'));var hardwareService=require(_0x90b2('0x15'));var logger=require('../../config/logger')(_0x90b2('0x16'));var utils=require(_0x90b2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x90b2('0x18'))['db'];function respondWithStatusCode(_0x51b5a9,_0x39d35e){_0x39d35e=_0x39d35e||0xcc;return function(_0x1784c3){if(_0x1784c3){return _0x51b5a9[_0x90b2('0x19')](_0x39d35e);}return _0x51b5a9[_0x90b2('0x1a')](_0x39d35e)[_0x90b2('0x1b')]();};}function respondWithResult(_0x52cfae,_0x2ab4d1){_0x2ab4d1=_0x2ab4d1||0xc8;return function(_0x45f866){if(_0x45f866){return _0x52cfae[_0x90b2('0x1a')](_0x2ab4d1)[_0x90b2('0x1c')](_0x45f866);}};}function respondWithFilteredResult(_0x48983a,_0x556a46){return function(_0x9818cd){if(_0x9818cd){var _0x521642=_0x9818cd['count'],_0x599bfa=_0x556a46[_0x90b2('0x1d')],_0x485aaa=_0x556a46['offset']+_0x556a46[_0x90b2('0x1e')],_0x43f242;if(_0x485aaa>=_0x521642){_0x485aaa=_0x521642;_0x43f242=0xc8;}else{_0x43f242=0xce;}_0x48983a[_0x90b2('0x1a')](_0x43f242);return _0x48983a[_0x90b2('0x1f')](_0x90b2('0x20'),_0x599bfa+'-'+_0x485aaa+'/'+_0x521642)[_0x90b2('0x1c')](_0x9818cd);}return null;};}function patchUpdates(_0x237204){return function(_0x4039cd){try{jsonpatch[_0x90b2('0x21')](_0x4039cd,_0x237204,!![]);}catch(_0x167db4){return BPromise[_0x90b2('0x22')](_0x167db4);}return _0x4039cd[_0x90b2('0x23')]();};}function saveUpdates(_0x2e7642,_0xd3ced9){return function(_0x55574f){if(_0x55574f){return _0x55574f[_0x90b2('0x24')](_0x2e7642)[_0x90b2('0x25')](function(_0x16e5cf){return _0x16e5cf;});}return null;};}function removeEntity(_0xafe24f,_0x22552d){return function(_0x59c341){if(_0x59c341){return _0x59c341[_0x90b2('0x26')]()['then'](function(){_0xafe24f[_0x90b2('0x1a')](0xcc)[_0x90b2('0x1b')]();});}};}function handleEntityNotFound(_0x46ce8b,_0x443099){return function(_0x28eeaa){if(!_0x28eeaa){_0x46ce8b[_0x90b2('0x19')](0x194);}return _0x28eeaa;};}function handleError(_0x2bf924,_0x5f581e){_0x5f581e=_0x5f581e||0x1f4;return function(_0x153cc5){logger['error'](_0x153cc5['stack']);if(_0x153cc5[_0x90b2('0x27')]){delete _0x153cc5[_0x90b2('0x27')];}_0x2bf924[_0x90b2('0x1a')](_0x5f581e)[_0x90b2('0x28')](_0x153cc5);};}var utilLicense=require(_0x90b2('0x29'));exports['index']=function(_0x1cd139,_0x193bcb){var _0x53a18a={'raw':!![],'where':{'id':0x1}},_0xf0202e={};_0xf0202e[_0x90b2('0x2a')]=_['keys'](db[_0x90b2('0x2b')][_0x90b2('0x2c')]);_0xf0202e[_0x90b2('0x2d')]=_['keys'](_0x1cd139[_0x90b2('0x2d')]);_0xf0202e[_0x90b2('0x2e')]=_[_0x90b2('0x2f')](_0xf0202e[_0x90b2('0x2a')],_0xf0202e['query']);_0x53a18a[_0x90b2('0x30')]=_[_0x90b2('0x2f')](_0xf0202e[_0x90b2('0x2a')],qs[_0x90b2('0x31')](_0x1cd139[_0x90b2('0x2d')][_0x90b2('0x31')]));_0x53a18a[_0x90b2('0x30')]=_0x53a18a[_0x90b2('0x30')]['length']?_0x53a18a[_0x90b2('0x30')]:_0xf0202e[_0x90b2('0x2a')];_0x53a18a=_[_0x90b2('0x32')]({},_0x53a18a,_0x1cd139[_0x90b2('0x33')]);return utilLicense[_0x90b2('0x34')](_0x53a18a)['then'](respondWithResult(_0x193bcb,null))[_0x90b2('0x35')](handleError(_0x193bcb,null));};exports[_0x90b2('0x24')]=function(_0x2bebba,_0x51c077){if(_0x2bebba[_0x90b2('0x36')]['id']){delete _0x2bebba['body']['id'];}return db['License']['find']({'where':{'id':_0x2bebba[_0x90b2('0x37')]['id']}})[_0x90b2('0x25')](handleEntityNotFound(_0x51c077,null))[_0x90b2('0x25')](function(_0x525677){var _0x584d83=_0x525677['get']({'plain':!![]});return utilLicense[_0x90b2('0x38')](_0x584d83,_0x2bebba['body'][_0x90b2('0x39')]);})[_0x90b2('0x25')](function(_0x1c0f7d){if(!_0x1c0f7d['demo']){return saveUpdates(_0x2bebba[_0x90b2('0x36')],null);}return _0x1c0f7d;})[_0x90b2('0x25')](respondWithResult(_0x51c077,null))[_0x90b2('0x35')](handleError(_0x51c077,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index b9e39bd..6d706b1 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 _0xda79=['api','bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define','License','lodash','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xda79,0x82));var _0x9da7=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xda79[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x9da7('0x0'));var util=require(_0x9da7('0x1'));var logger=require('../../config/logger')(_0x9da7('0x2'));var moment=require('moment');var BPromise=require(_0x9da7('0x3'));var rp=require(_0x9da7('0x4'));var fs=require('fs');var path=require(_0x9da7('0x5'));var rimraf=require('rimraf');var config=require(_0x9da7('0x6'));var attributes=require(_0x9da7('0x7'));module[_0x9da7('0x8')]=function(_0x14821c,_0x2d1a1){return _0x14821c[_0x9da7('0x9')](_0x9da7('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce5c=['lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define','License','license'];(function(_0x49708f,_0x235e1c){var _0x4cbb7f=function(_0x2f4e02){while(--_0x2f4e02){_0x49708f['push'](_0x49708f['shift']());}};_0x4cbb7f(++_0x235e1c);}(_0xce5c,0x79));var _0xcce5=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0xce5c[_0x1b5aea];return _0x51cae9;};'use strict';var _=require(_0xcce5('0x0'));var util=require('util');var logger=require(_0xcce5('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcce5('0x2'));var rp=require(_0xcce5('0x3'));var fs=require('fs');var path=require(_0xcce5('0x4'));var rimraf=require('rimraf');var config=require(_0xcce5('0x5'));var attributes=require(_0xcce5('0x6'));module[_0xcce5('0x7')]=function(_0x31a61d,_0x105d56){return _0x31a61d[_0xcce5('0x8')](_0xcce5('0x9'),attributes,{'tableName':_0xcce5('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 23163a5..4b239c8 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 _0x7d13=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','util','bluebird'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x7d13,0x6c));var _0x37d1=function(_0x2fc69b,_0x55537d){_0x2fc69b=_0x2fc69b-0x0;var _0x25e3c9=_0x7d13[_0x2fc69b];return _0x25e3c9;};'use strict';var _=require('lodash');var util=require(_0x37d1('0x0'));var moment=require('moment');var BPromise=require(_0x37d1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37d1('0x2'));var db=require(_0x37d1('0x3'))['db'];var utils=require(_0x37d1('0x4'));var logger=require(_0x37d1('0x5'))(_0x37d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x37d1('0x7'));var client=jayson[_0x37d1('0x8')][_0x37d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ac1d,_0x5146e3,_0x9302bd){return new BPromise(function(_0x41dfaa,_0x115eca){return client[_0x37d1('0xa')](_0x27ac1d,_0x9302bd)[_0x37d1('0xb')](function(_0x636359){logger[_0x37d1('0xc')]('License,\x20%s,\x20%s',_0x5146e3,'request\x20sent');logger[_0x37d1('0xd')](_0x37d1('0xe'),_0x5146e3,'request\x20sent',JSON[_0x37d1('0xf')](_0x636359));if(_0x636359[_0x37d1('0x10')]){if(_0x636359[_0x37d1('0x10')][_0x37d1('0x11')]===0x1f4){logger[_0x37d1('0x10')](_0x37d1('0x12'),_0x5146e3,_0x636359[_0x37d1('0x10')][_0x37d1('0x13')]);return _0x115eca(_0x636359['error'][_0x37d1('0x13')]);}logger[_0x37d1('0x10')]('License,\x20%s,\x20%s',_0x5146e3,_0x636359[_0x37d1('0x10')][_0x37d1('0x13')]);return _0x41dfaa(_0x636359['error'][_0x37d1('0x13')]);}else{logger[_0x37d1('0xc')]('License,\x20%s,\x20%s',_0x5146e3,'request\x20sent');_0x41dfaa(_0x636359[_0x37d1('0x14')][_0x37d1('0x13')]);}})[_0x37d1('0x15')](function(_0x5ded71){logger[_0x37d1('0x10')](_0x37d1('0x12'),_0x5146e3,_0x5ded71);_0x115eca(_0x5ded71);});});} \ No newline at end of file +var _0xfc4c=['code','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','info','License,\x20%s,\x20%s','debug','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc4c,0xca));var _0xcfc4=function(_0x177de4,_0x1e3630){_0x177de4=_0x177de4-0x0;var _0x2804d8=_0xfc4c[_0x177de4];return _0x2804d8;};'use strict';var _=require(_0xcfc4('0x0'));var util=require(_0xcfc4('0x1'));var moment=require(_0xcfc4('0x2'));var BPromise=require('bluebird');var rs=require(_0xcfc4('0x3'));var fs=require('fs');var Redis=require(_0xcfc4('0x4'));var db=require(_0xcfc4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcfc4('0x6'));var config=require(_0xcfc4('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcfc4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53486d,_0x560b1c,_0x4578f4){return new BPromise(function(_0x520566,_0x13b9f6){return client['request'](_0x53486d,_0x4578f4)['then'](function(_0x49b787){logger[_0xcfc4('0x9')](_0xcfc4('0xa'),_0x560b1c,'request\x20sent');logger[_0xcfc4('0xb')]('License,\x20%s,\x20%s,\x20%s',_0x560b1c,'request\x20sent',JSON[_0xcfc4('0xc')](_0x49b787));if(_0x49b787[_0xcfc4('0xd')]){if(_0x49b787[_0xcfc4('0xd')][_0xcfc4('0xe')]===0x1f4){logger[_0xcfc4('0xd')]('License,\x20%s,\x20%s',_0x560b1c,_0x49b787[_0xcfc4('0xd')]['message']);return _0x13b9f6(_0x49b787[_0xcfc4('0xd')]['message']);}logger[_0xcfc4('0xd')]('License,\x20%s,\x20%s',_0x560b1c,_0x49b787['error'][_0xcfc4('0xf')]);return _0x520566(_0x49b787[_0xcfc4('0xd')]['message']);}else{logger[_0xcfc4('0x9')](_0xcfc4('0xa'),_0x560b1c,_0xcfc4('0x10'));_0x520566(_0x49b787['result']['message']);}})[_0xcfc4('0x11')](function(_0x47db36){logger['error']('License,\x20%s,\x20%s',_0x560b1c,_0x47db36);_0x13b9f6(_0x47db36);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index ac1f0e5..0e0a259 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 _0xa962=['addInteraction','addApplications','/:id/send','send','delete','/:id/dispositions','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','isAuthenticated','index','get','/describe','/:id','show','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','addSmtp'];(function(_0x5ee607,_0x5ef350){var _0x49a75a=function(_0x3fac2b){while(--_0x3fac2b){_0x5ee607['push'](_0x5ee607['shift']());}};_0x49a75a(++_0x5ef350);}(_0xa962,0xd1));var _0x2a96=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0xa962[_0x3f7598];return _0x51fb16;};'use strict';var multer=require(_0x2a96('0x0'));var util=require(_0x2a96('0x1'));var path=require(_0x2a96('0x2'));var timeout=require('connect-timeout');var express=require(_0x2a96('0x3'));var router=express[_0x2a96('0x4')]();var fs_extra=require(_0x2a96('0x5'));var auth=require(_0x2a96('0x6'));var interaction=require(_0x2a96('0x7'));var config=require('../../config/environment');var controller=require(_0x2a96('0x8'));router['get']('/',auth[_0x2a96('0x9')](),controller[_0x2a96('0xa')]);router[_0x2a96('0xb')](_0x2a96('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x2a96('0xd'),auth[_0x2a96('0x9')](),controller[_0x2a96('0xe')]);router[_0x2a96('0xb')]('/:id/dispositions',auth[_0x2a96('0x9')](),controller[_0x2a96('0xf')]);router['get'](_0x2a96('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x2a96('0xb')](_0x2a96('0x11'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x12')]);router[_0x2a96('0xb')](_0x2a96('0x13'),auth['isAuthenticated'](),controller[_0x2a96('0x14')]);router[_0x2a96('0xb')](_0x2a96('0x15'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x16')]);router[_0x2a96('0xb')](_0x2a96('0x17'),auth['isAuthenticated'](),controller[_0x2a96('0x18')]);router[_0x2a96('0xb')](_0x2a96('0x19'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x1a')]);router[_0x2a96('0xb')](_0x2a96('0x1b'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x1c')]);router[_0x2a96('0xb')](_0x2a96('0x1d'),auth['isAuthenticated'](),controller[_0x2a96('0x1e')]);router[_0x2a96('0x1f')]('/:id/dispositions',auth[_0x2a96('0x9')](),controller[_0x2a96('0x20')]);router[_0x2a96('0x1f')](_0x2a96('0x10'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x21')]);router[_0x2a96('0x1f')]('/',auth[_0x2a96('0x9')](),controller['create']);router[_0x2a96('0x1f')]('/:id/in_servers',auth[_0x2a96('0x9')](),controller[_0x2a96('0x22')]);router[_0x2a96('0x1f')](_0x2a96('0x13'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x23')]);router[_0x2a96('0x1f')](_0x2a96('0x15'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x24')]);router[_0x2a96('0x1f')](_0x2a96('0x17'),auth['isAuthenticated'](),controller[_0x2a96('0x25')]);router[_0x2a96('0x1f')](_0x2a96('0x26'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x27')]);router[_0x2a96('0x1f')](_0x2a96('0x1d'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x2a96('0x9')](),controller['update']);router[_0x2a96('0x28')](_0x2a96('0x29'),auth['isAuthenticated'](),controller[_0x2a96('0x2a')]);router[_0x2a96('0x28')](_0x2a96('0x10'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x2b')]);router[_0x2a96('0x28')](_0x2a96('0x11'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x2c')]);router[_0x2a96('0x28')](_0x2a96('0x13'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x2d')]);router[_0x2a96('0x28')](_0x2a96('0xd'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x2e')]);router['delete'](_0x2a96('0x1d'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x2f')]);module[_0x2a96('0x30')]=router; \ No newline at end of file +var _0x29da=['/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','/:id/canned_answers','addAnswer','create','/:id/in_servers','addImap','addSmtp','addApplications','send','update','delete','/:id/dispositions','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./mailAccount.controller','get','isAuthenticated','index','describe','/:id','show','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages'];(function(_0x2029f7,_0x53b3f1){var _0x5c6c6f=function(_0x22836a){while(--_0x22836a){_0x2029f7['push'](_0x2029f7['shift']());}};_0x5c6c6f(++_0x53b3f1);}(_0x29da,0xf8));var _0xa29d=function(_0x56596d,_0x5ba5ee){_0x56596d=_0x56596d-0x0;var _0x2311e6=_0x29da[_0x56596d];return _0x2311e6;};'use strict';var multer=require(_0xa29d('0x0'));var util=require(_0xa29d('0x1'));var path=require('path');var timeout=require(_0xa29d('0x2'));var express=require(_0xa29d('0x3'));var router=express['Router']();var fs_extra=require(_0xa29d('0x4'));var auth=require(_0xa29d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa29d('0x6'));router[_0xa29d('0x7')]('/',auth[_0xa29d('0x8')](),controller[_0xa29d('0x9')]);router[_0xa29d('0x7')]('/describe',auth[_0xa29d('0x8')](),controller[_0xa29d('0xa')]);router[_0xa29d('0x7')](_0xa29d('0xb'),auth[_0xa29d('0x8')](),controller[_0xa29d('0xc')]);router[_0xa29d('0x7')]('/:id/dispositions',auth[_0xa29d('0x8')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xa29d('0x8')](),controller['getAnswers']);router[_0xa29d('0x7')]('/:id/in_servers',auth[_0xa29d('0x8')](),controller[_0xa29d('0xd')]);router[_0xa29d('0x7')](_0xa29d('0xe'),auth[_0xa29d('0x8')](),controller[_0xa29d('0xf')]);router[_0xa29d('0x7')](_0xa29d('0x10'),auth[_0xa29d('0x8')](),controller[_0xa29d('0x11')]);router[_0xa29d('0x7')](_0xa29d('0x12'),auth[_0xa29d('0x8')](),controller[_0xa29d('0x13')]);router[_0xa29d('0x7')](_0xa29d('0x14'),auth[_0xa29d('0x8')](),controller[_0xa29d('0x15')]);router[_0xa29d('0x7')](_0xa29d('0x16'),auth['isAuthenticated'](),controller[_0xa29d('0x17')]);router[_0xa29d('0x7')](_0xa29d('0x18'),auth[_0xa29d('0x8')](),controller[_0xa29d('0x19')]);router['post']('/:id/dispositions',auth[_0xa29d('0x8')](),controller[_0xa29d('0x1a')]);router[_0xa29d('0x1b')](_0xa29d('0x1c'),auth[_0xa29d('0x8')](),controller[_0xa29d('0x1d')]);router[_0xa29d('0x1b')]('/',auth['isAuthenticated'](),controller[_0xa29d('0x1e')]);router[_0xa29d('0x1b')](_0xa29d('0x1f'),auth[_0xa29d('0x8')](),controller[_0xa29d('0x20')]);router[_0xa29d('0x1b')](_0xa29d('0xe'),auth[_0xa29d('0x8')](),controller[_0xa29d('0x21')]);router[_0xa29d('0x1b')]('/:id/interactions',auth[_0xa29d('0x8')](),controller['addInteraction']);router[_0xa29d('0x1b')](_0xa29d('0x12'),auth['isAuthenticated'](),controller[_0xa29d('0x22')]);router[_0xa29d('0x1b')]('/:id/send',auth[_0xa29d('0x8')](),controller[_0xa29d('0x23')]);router[_0xa29d('0x1b')](_0xa29d('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xa29d('0xb'),auth['isAuthenticated'](),controller[_0xa29d('0x24')]);router[_0xa29d('0x25')](_0xa29d('0x26'),auth[_0xa29d('0x8')](),controller[_0xa29d('0x27')]);router[_0xa29d('0x25')](_0xa29d('0x1c'),auth[_0xa29d('0x8')](),controller[_0xa29d('0x28')]);router['delete'](_0xa29d('0x1f'),auth[_0xa29d('0x8')](),controller[_0xa29d('0x29')]);router['delete'](_0xa29d('0xe'),auth[_0xa29d('0x8')](),controller[_0xa29d('0x2a')]);router[_0xa29d('0x25')](_0xa29d('0xb'),auth[_0xa29d('0x8')](),controller['destroy']);router[_0xa29d('0x25')](_0xa29d('0x18'),auth['isAuthenticated'](),controller[_0xa29d('0x2b')]);module[_0xa29d('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 80e4843..2556eeb 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 _0x76ff=['STRING','TEXT','BOOLEAN','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports'];(function(_0x2c244e,_0x597668){var _0x53b7a4=function(_0x52a71a){while(--_0x52a71a){_0x2c244e['push'](_0x2c244e['shift']());}};_0x53b7a4(++_0x597668);}(_0x76ff,0x11f));var _0xf76f=function(_0x139afb,_0x526074){_0x139afb=_0x139afb-0x0;var _0x13dcd8=_0x76ff[_0x139afb];return _0x13dcd8;};'use strict';var Sequelize=require('sequelize');module[_0xf76f('0x0')]={'description':{'type':Sequelize[_0xf76f('0x1')]},'name':{'type':Sequelize[_0xf76f('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xf76f('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xf76f('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xf76f('0x2')]},'markAsUnread':{'type':Sequelize[_0xf76f('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xf76f('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xf76f('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xf76f('0x2')],'defaultValue':function(){return _0xf76f('0x5');}},'notificationSound':{'type':Sequelize[_0xf76f('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf76f('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf76f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf76f('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf76f('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xf76f('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf76f('0x8'),'set':function(_0x469e88){if(!_0x469e88)this['setDataValue'](_0xf76f('0x9'),null);this[_0xf76f('0xa')](_0xf76f('0xb'),_0x469e88);}}}; \ No newline at end of file +var _0x316e=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x4bcbef,_0x406d11){var _0x39a40a=function(_0x2871b1){while(--_0x2871b1){_0x4bcbef['push'](_0x4bcbef['shift']());}};_0x39a40a(++_0x406d11);}(_0x316e,0x1cd));var _0xe316=function(_0x45ccd2,_0x4ecb10){_0x45ccd2=_0x45ccd2-0x0;var _0x554dff=_0x316e[_0x45ccd2];return _0x554dff;};'use strict';var Sequelize=require(_0xe316('0x0'));module[_0xe316('0x1')]={'description':{'type':Sequelize[_0xe316('0x2')]},'name':{'type':Sequelize[_0xe316('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xe316('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xe316('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xe316('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xe316('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe316('0x2')],'allowNull':![],'defaultValue':_0xe316('0x5')},'fontSize':{'type':Sequelize[_0xe316('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe316('0x4')],'defaultValue':function(){return _0xe316('0x7');}},'notificationSound':{'type':Sequelize[_0xe316('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe316('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe316('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe316('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe316('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe316('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe316('0x3')],'defaultValue':![],'comment':_0xe316('0x8'),'set':function(_0x5aea58){if(!_0x5aea58)this[_0xe316('0x9')](_0xe316('0xa'),null);this[_0xe316('0x9')](_0xe316('0xb'),_0x5aea58);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0d8e1ee..a7b2036 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 _0xebe5=['message','result','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','get','destroy','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','MailAccount','include','findAll','rows','Pause','mandatoryDispositionPause','includeAll','find','body','params','describe','Disposition','create','getDispositions','findOne','nolimit','MailAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','key','ListId','active','description','user','cuser','password','pass','authentication','host','port','service','cservice','cpassword','role','UserProfileSection','MailAccounts','autoAssociation','UserProfileResource','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','Contacts','DESC','isNil','from','%s\x20<%s>','email','attachments','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Messages','verifySmtp','ValidationError','emit','userMailAccount:save','ids','removeAgents','isArray','userMailAccount:remove','getAgents','User','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','html-to-text','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2bf075,_0x18471b){var _0x41e52c=function(_0x500102){while(--_0x500102){_0x2bf075['push'](_0x2bf075['shift']());}};_0x41e52c(++_0x18471b);}(_0xebe5,0x15c));var _0x5ebe=function(_0x17a692,_0x4e6812){_0x17a692=_0x17a692-0x0;var _0x4f5e76=_0xebe5[_0x17a692];return _0x4f5e76;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5ebe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ebe('0x1'));var rp=require(_0x5ebe('0x2'));var moment=require(_0x5ebe('0x3'));var BPromise=require(_0x5ebe('0x4'));var Mustache=require('mustache');var util=require(_0x5ebe('0x5'));var path=require('path');var sox=require(_0x5ebe('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ebe('0x7'));var _=require(_0x5ebe('0x8'));var squel=require(_0x5ebe('0x9'));var crypto=require(_0x5ebe('0xa'));var jsforce=require(_0x5ebe('0xb'));var deskjs=require(_0x5ebe('0xc'));var toCsv=require(_0x5ebe('0xd'));var querystring=require(_0x5ebe('0xe'));var Papa=require(_0x5ebe('0xf'));var htmlToText=require(_0x5ebe('0x10'));var juice=require(_0x5ebe('0x11'));var Redis=require(_0x5ebe('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5ebe('0x13'));var as=require(_0x5ebe('0x14'));var hardwareService=require(_0x5ebe('0x15'));var logger=require('../../config/logger')(_0x5ebe('0x16'));var utils=require('../../config/utils');var config=require(_0x5ebe('0x17'));var licenseUtil=require(_0x5ebe('0x18'));var db=require('../../mysqldb')['db'];config[_0x5ebe('0x19')]=_[_0x5ebe('0x1a')](config[_0x5ebe('0x19')],{'host':_0x5ebe('0x1b'),'port':0x18eb});var socket=require(_0x5ebe('0x1c'))(new Redis(config[_0x5ebe('0x19')]));require('./mailAccount.socket')[_0x5ebe('0x1d')](socket);var jayson=require(_0x5ebe('0x1e'));var client=jayson[_0x5ebe('0x1f')][_0x5ebe('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x5e3d11,_0x53aa4f,_0x5a34b4,_0x22212f){return new BPromise(function(_0x30077b,_0x43582f){var _0x59fde8=_0x22212f||client;return _0x59fde8[_0x5ebe('0x21')](_0x5e3d11,_0x5a34b4)[_0x5ebe('0x22')](function(_0x2c8271){logger[_0x5ebe('0x23')](_0x5ebe('0x24'),_0x53aa4f,'request\x20sent');logger['debug'](_0x5ebe('0x25'),_0x53aa4f,_0x5ebe('0x26'),JSON[_0x5ebe('0x27')](_0x2c8271));if(_0x2c8271[_0x5ebe('0x28')]){if(_0x2c8271[_0x5ebe('0x28')][_0x5ebe('0x29')]===0x1f4){logger['error'](_0x5ebe('0x24'),_0x53aa4f,_0x2c8271[_0x5ebe('0x28')]['message']);return _0x43582f(_0x2c8271[_0x5ebe('0x28')][_0x5ebe('0x2a')]);}logger[_0x5ebe('0x28')](_0x5ebe('0x24'),_0x53aa4f,_0x2c8271['error'][_0x5ebe('0x2a')]);return _0x30077b(_0x2c8271[_0x5ebe('0x28')]['message']);}else{logger[_0x5ebe('0x23')](_0x5ebe('0x24'),_0x53aa4f,_0x5ebe('0x26'));_0x30077b(_0x2c8271[_0x5ebe('0x2b')][_0x5ebe('0x2a')]);}})[_0x5ebe('0x2c')](function(_0x58cfea){logger[_0x5ebe('0x28')]('MailAccount,\x20%s,\x20%s',_0x53aa4f,_0x58cfea);_0x43582f(_0x58cfea);});});}function respondWithStatusCode(_0x2a46b9,_0x21573d){_0x21573d=_0x21573d||0xcc;return function(_0x407fd4){if(_0x407fd4){return _0x2a46b9[_0x5ebe('0x2d')](_0x21573d);}return _0x2a46b9[_0x5ebe('0x2e')](_0x21573d)[_0x5ebe('0x2f')]();};}function respondWithResult(_0xa7042e,_0x5e1880){_0x5e1880=_0x5e1880||0xc8;return function(_0x38ed1c){if(_0x38ed1c){return _0xa7042e[_0x5ebe('0x2e')](_0x5e1880)[_0x5ebe('0x30')](_0x38ed1c);}};}function respondWithFilteredResult(_0xd6d50,_0x19ac67){return function(_0x1fd7ab){if(_0x1fd7ab){var _0x52e612=_0x1fd7ab[_0x5ebe('0x31')],_0x2373d9=_0x19ac67[_0x5ebe('0x32')],_0x35ce0c=_0x19ac67[_0x5ebe('0x32')]+_0x19ac67['limit'],_0x1327ff;if(_0x35ce0c>=_0x52e612){_0x35ce0c=_0x52e612;_0x1327ff=0xc8;}else{_0x1327ff=0xce;}_0xd6d50['status'](_0x1327ff);return _0xd6d50[_0x5ebe('0x33')]('Content-Range',_0x2373d9+'-'+_0x35ce0c+'/'+_0x52e612)[_0x5ebe('0x30')](_0x1fd7ab);}return null;};}function patchUpdates(_0x5ba528){return function(_0x5dddf5){try{jsonpatch[_0x5ebe('0x34')](_0x5dddf5,_0x5ba528,!![]);}catch(_0xc0dad4){return BPromise[_0x5ebe('0x35')](_0xc0dad4);}return _0x5dddf5[_0x5ebe('0x36')]();};}function saveUpdates(_0x370775,_0x236e39){return function(_0x2209cb){if(_0x2209cb){return _0x2209cb[_0x5ebe('0x37')](_0x370775)['then'](function(_0xd6ea45){return _0xd6ea45;});}return null;};}function removeEntity(_0x5748aa,_0x78c43){return function(_0x24718d){if(_0x24718d){return _0x24718d['destroy']()['then'](function(){var _0x5471db=_0x24718d[_0x5ebe('0x38')]({'plain':!![]});var _0x47718a='MailAccounts';return db['UserProfileResource'][_0x5ebe('0x39')]({'where':{'type':_0x47718a,'resourceId':_0x5471db['id']}})[_0x5ebe('0x22')](function(){return _0x24718d;});})['then'](function(){_0x5748aa[_0x5ebe('0x2e')](0xcc)[_0x5ebe('0x2f')]();});}};}function handleEntityNotFound(_0x43b3a1,_0x1342eb){return function(_0x54dd8b){if(!_0x54dd8b){_0x43b3a1[_0x5ebe('0x2d')](0x194);}return _0x54dd8b;};}function handleError(_0x3af27b,_0x1ad8bd){_0x1ad8bd=_0x1ad8bd||0x1f4;return function(_0x24bfa4){logger[_0x5ebe('0x28')](_0x24bfa4[_0x5ebe('0x3a')]);if(_0x24bfa4[_0x5ebe('0x3b')]){delete _0x24bfa4[_0x5ebe('0x3b')];}_0x3af27b['status'](_0x1ad8bd)[_0x5ebe('0x3c')](_0x24bfa4);};}exports[_0x5ebe('0x3d')]=function(_0x4d1f2f,_0x3b45e1){var _0x2bd4e3={'include':[{'model':db[_0x5ebe('0x3e')],'as':_0x5ebe('0x3f')},{'model':db[_0x5ebe('0x40')],'as':_0x5ebe('0x41')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xfa87ff={},_0x51dbba={'count':0x0,'rows':[]};var _0x3be9e8=_[_0x5ebe('0x42')](db['MailAccount'][_0x5ebe('0x43')],function(_0x3828cd){return{'name':_0x3828cd[_0x5ebe('0x44')],'type':_0x3828cd[_0x5ebe('0x45')]['key']};});_0xfa87ff[_0x5ebe('0x46')]=_[_0x5ebe('0x42')](_0x3be9e8,_0x5ebe('0x3b'));_0xfa87ff[_0x5ebe('0x47')]=_[_0x5ebe('0x48')](_0x4d1f2f['query']);_0xfa87ff[_0x5ebe('0x49')]=_[_0x5ebe('0x4a')](_0xfa87ff[_0x5ebe('0x46')],_0xfa87ff[_0x5ebe('0x47')]);_0x2bd4e3[_0x5ebe('0x4b')]=_['intersection'](_0xfa87ff[_0x5ebe('0x46')],qs[_0x5ebe('0x4c')](_0x4d1f2f[_0x5ebe('0x47')]['fields']));_0x2bd4e3[_0x5ebe('0x4b')]=_0x2bd4e3[_0x5ebe('0x4b')][_0x5ebe('0x4d')]?_0x2bd4e3['attributes']:_0xfa87ff[_0x5ebe('0x46')];if(!_0x4d1f2f['query'][_0x5ebe('0x4e')]('nolimit')){_0x2bd4e3[_0x5ebe('0x4f')]=qs[_0x5ebe('0x4f')](_0x4d1f2f[_0x5ebe('0x47')][_0x5ebe('0x4f')]);_0x2bd4e3[_0x5ebe('0x32')]=qs['offset'](_0x4d1f2f[_0x5ebe('0x47')][_0x5ebe('0x32')]);}_0x2bd4e3[_0x5ebe('0x50')]=qs['sort'](_0x4d1f2f[_0x5ebe('0x47')][_0x5ebe('0x51')]);_0x2bd4e3['where']=qs['filters'](_[_0x5ebe('0x52')](_0x4d1f2f[_0x5ebe('0x47')],_0xfa87ff[_0x5ebe('0x49')]),_0x3be9e8);if(_0x4d1f2f[_0x5ebe('0x47')][_0x5ebe('0x53')]){_0x2bd4e3[_0x5ebe('0x54')]=_['merge'](_0x2bd4e3[_0x5ebe('0x54')],{'$or':_[_0x5ebe('0x42')](_0x3be9e8,function(_0x293940){if(_0x293940['type']!==_0x5ebe('0x55')){var _0x14132b={};_0x14132b[_0x293940[_0x5ebe('0x3b')]]={'$like':'%'+_0x4d1f2f[_0x5ebe('0x47')][_0x5ebe('0x53')]+'%'};return _0x14132b;}})});}_0x2bd4e3=_[_0x5ebe('0x56')]({},_0x2bd4e3,_0x4d1f2f[_0x5ebe('0x57')]);var _0x1bcb77={'where':_0x2bd4e3['where']};return db[_0x5ebe('0x58')][_0x5ebe('0x31')](_0x1bcb77)[_0x5ebe('0x22')](function(_0x4b3324){_0x51dbba[_0x5ebe('0x31')]=_0x4b3324;if(_0x4d1f2f['query']['includeAll']){_0x2bd4e3[_0x5ebe('0x59')]=[{'all':!![]}];}return db[_0x5ebe('0x58')][_0x5ebe('0x5a')](_0x2bd4e3);})[_0x5ebe('0x22')](function(_0x442d96){_0x51dbba[_0x5ebe('0x5b')]=_0x442d96;return _0x51dbba;})['then'](respondWithFilteredResult(_0x3b45e1,_0x2bd4e3))['catch'](handleError(_0x3b45e1,null));};exports['show']=function(_0x29dde6,_0x115058){var _0x2c5e2a={'raw':![],'where':{'id':_0x29dde6['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x5ebe('0x3f')},{'model':db[_0x5ebe('0x40')],'as':_0x5ebe('0x41')},{'model':db[_0x5ebe('0x5c')],'as':_0x5ebe('0x5d')}]},_0xc84f06={};_0xc84f06[_0x5ebe('0x46')]=_['keys'](db['MailAccount'][_0x5ebe('0x43')]);_0xc84f06[_0x5ebe('0x47')]=_[_0x5ebe('0x48')](_0x29dde6[_0x5ebe('0x47')]);_0xc84f06[_0x5ebe('0x49')]=_['intersection'](_0xc84f06[_0x5ebe('0x46')],_0xc84f06[_0x5ebe('0x47')]);_0x2c5e2a[_0x5ebe('0x4b')]=_[_0x5ebe('0x4a')](_0xc84f06[_0x5ebe('0x46')],qs['fields'](_0x29dde6['query'][_0x5ebe('0x4c')]));_0x2c5e2a[_0x5ebe('0x4b')]=_0x2c5e2a[_0x5ebe('0x4b')][_0x5ebe('0x4d')]?_0x2c5e2a['attributes']:_0xc84f06[_0x5ebe('0x46')];if(_0x29dde6[_0x5ebe('0x47')][_0x5ebe('0x5e')]){_0x2c5e2a[_0x5ebe('0x59')]=[{'all':!![]}];}_0x2c5e2a=_['merge']({},_0x2c5e2a,_0x29dde6[_0x5ebe('0x57')]);return db[_0x5ebe('0x58')][_0x5ebe('0x5f')](_0x2c5e2a)[_0x5ebe('0x22')](handleEntityNotFound(_0x115058,null))[_0x5ebe('0x22')](respondWithResult(_0x115058,null))[_0x5ebe('0x2c')](handleError(_0x115058,null));};exports[_0x5ebe('0x37')]=function(_0x8f9c8d,_0x125f0e){if(_0x8f9c8d[_0x5ebe('0x60')]['id']){delete _0x8f9c8d['body']['id'];}return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x8f9c8d[_0x5ebe('0x61')]['id']},'include':[{'model':db[_0x5ebe('0x3e')],'as':'Imap'},{'model':db[_0x5ebe('0x40')],'as':_0x5ebe('0x41')},{'model':db[_0x5ebe('0x5c')],'as':'mandatoryDispositionPause'}]})[_0x5ebe('0x22')](handleEntityNotFound(_0x125f0e,null))[_0x5ebe('0x22')](saveUpdates(_0x8f9c8d[_0x5ebe('0x60')],null))[_0x5ebe('0x22')](function(_0xb69f6){if(_0xb69f6&&_0x8f9c8d[_0x5ebe('0x60')][_0x5ebe('0x3f')]){return db['MailServerIn'][_0x5ebe('0x37')](_0x8f9c8d['body'][_0x5ebe('0x3f')],{'where':{'MailAccountId':_0xb69f6['id']}})[_0x5ebe('0x22')](function(){return _0xb69f6;});}return _0xb69f6;})[_0x5ebe('0x22')](function(_0x4a0b56){if(_0x4a0b56&&_0x8f9c8d[_0x5ebe('0x60')][_0x5ebe('0x41')]){return db['MailServerOut']['update'](_0x8f9c8d['body'][_0x5ebe('0x41')],{'where':{'MailAccountId':_0x4a0b56['id']}})['then'](function(){return _0x4a0b56;});}return _0x4a0b56;})[_0x5ebe('0x22')](respondWithResult(_0x125f0e,null))[_0x5ebe('0x2c')](handleError(_0x125f0e,null));};exports[_0x5ebe('0x62')]=function(_0x29f178,_0x5924b1){return db['MailAccount'][_0x5ebe('0x62')]()[_0x5ebe('0x22')](respondWithResult(_0x5924b1,null))[_0x5ebe('0x2c')](handleError(_0x5924b1,null));};exports['addDisposition']=function(_0x59ff8e,_0x502629,_0x4a49ae){if(_0x59ff8e[_0x5ebe('0x60')]['id']){delete _0x59ff8e[_0x5ebe('0x60')]['id'];}return db['MailAccount'][_0x5ebe('0x5f')]({'where':{'id':_0x59ff8e['params']['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x502629,null))[_0x5ebe('0x22')](function(_0x496644){if(_0x496644){_0x59ff8e[_0x5ebe('0x60')]['MailAccountId']=_0x496644['id'];return db[_0x5ebe('0x63')][_0x5ebe('0x64')](_0x59ff8e[_0x5ebe('0x60')]);}})[_0x5ebe('0x22')](respondWithResult(_0x502629,null))[_0x5ebe('0x2c')](handleError(_0x502629,null));};exports[_0x5ebe('0x65')]=function(_0x1df5d8,_0x564666,_0x56376f){var _0x39867b={'raw':![],'where':{}};var _0x885a35={};var _0x4809c7={'count':0x0,'rows':[]};return db['MailAccount'][_0x5ebe('0x66')]({'where':{'id':_0x1df5d8[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x564666,null))[_0x5ebe('0x22')](function(_0x3ec6af){if(_0x3ec6af){_0x885a35[_0x5ebe('0x46')]=_[_0x5ebe('0x48')](db[_0x5ebe('0x63')][_0x5ebe('0x43')]);_0x885a35[_0x5ebe('0x47')]=_['keys'](_0x1df5d8[_0x5ebe('0x47')]);_0x885a35[_0x5ebe('0x49')]=_[_0x5ebe('0x4a')](_0x885a35[_0x5ebe('0x46')],_0x885a35[_0x5ebe('0x47')]);_0x39867b[_0x5ebe('0x4b')]=_[_0x5ebe('0x4a')](_0x885a35[_0x5ebe('0x46')],qs[_0x5ebe('0x4c')](_0x1df5d8[_0x5ebe('0x47')]['fields']));_0x39867b['attributes']=_0x39867b[_0x5ebe('0x4b')]['length']?_0x39867b[_0x5ebe('0x4b')]:_0x885a35[_0x5ebe('0x46')];if(!_0x1df5d8['query'][_0x5ebe('0x4e')](_0x5ebe('0x67'))){_0x39867b[_0x5ebe('0x4f')]=qs['limit'](_0x1df5d8[_0x5ebe('0x47')][_0x5ebe('0x4f')]);_0x39867b['offset']=qs[_0x5ebe('0x32')](_0x1df5d8[_0x5ebe('0x47')][_0x5ebe('0x32')]);}_0x39867b['order']=qs[_0x5ebe('0x51')](_0x1df5d8[_0x5ebe('0x47')][_0x5ebe('0x51')]);_0x39867b[_0x5ebe('0x54')]=qs[_0x5ebe('0x49')](_[_0x5ebe('0x52')](_0x1df5d8['query'],_0x885a35[_0x5ebe('0x49')]));_0x39867b[_0x5ebe('0x54')][_0x5ebe('0x68')]=_0x3ec6af['id'];if(_0x1df5d8[_0x5ebe('0x47')][_0x5ebe('0x53')]){_0x39867b[_0x5ebe('0x54')]=_[_0x5ebe('0x56')](_0x39867b[_0x5ebe('0x54')],{'$or':_['map'](_0x39867b[_0x5ebe('0x4b')],function(_0x1cd23c){var _0x4974a8={};_0x4974a8[_0x1cd23c]={'$like':'%'+_0x1df5d8[_0x5ebe('0x47')][_0x5ebe('0x53')]+'%'};return _0x4974a8;})});}_0x39867b=_[_0x5ebe('0x56')]({},_0x39867b,_0x1df5d8['options']);return db['Disposition'][_0x5ebe('0x31')]({'where':_0x39867b['where']})[_0x5ebe('0x22')](function(_0x1d0c2a){_0x4809c7[_0x5ebe('0x31')]=_0x1d0c2a;if(_0x1df5d8[_0x5ebe('0x47')][_0x5ebe('0x5e')]){_0x39867b[_0x5ebe('0x59')]=[{'all':!![]}];}return db[_0x5ebe('0x63')][_0x5ebe('0x5a')](_0x39867b);})[_0x5ebe('0x22')](function(_0x89d8d0){_0x4809c7[_0x5ebe('0x5b')]=_0x89d8d0;return _0x4809c7;});}})[_0x5ebe('0x22')](respondWithFilteredResult(_0x564666,_0x39867b))['catch'](handleError(_0x564666,null));};exports[_0x5ebe('0x69')]=function(_0x1fe1a7,_0x36b19f,_0x597466){return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x1fe1a7[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x36b19f,null))[_0x5ebe('0x22')](function(_0x1482cb){if(_0x1482cb){return _0x1482cb[_0x5ebe('0x69')](_0x1fe1a7[_0x5ebe('0x47')]['ids']);}})[_0x5ebe('0x22')](respondWithStatusCode(_0x36b19f,null))['catch'](handleError(_0x36b19f,null));};exports[_0x5ebe('0x6a')]=function(_0x5e05f0,_0x5d1bc5,_0x2e1f76){if(_0x5e05f0[_0x5ebe('0x60')]['id']){delete _0x5e05f0[_0x5ebe('0x60')]['id'];}return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x5e05f0[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x5d1bc5,null))['then'](function(_0x5c9fdf){if(_0x5c9fdf){_0x5e05f0['body'][_0x5ebe('0x68')]=_0x5c9fdf['id'];return db[_0x5ebe('0x6b')][_0x5ebe('0x64')](_0x5e05f0['body']);}})[_0x5ebe('0x22')](respondWithResult(_0x5d1bc5,null))[_0x5ebe('0x2c')](handleError(_0x5d1bc5,null));};exports[_0x5ebe('0x6c')]=function(_0x311ad2,_0x346748,_0x43ae24){var _0x180f47={'raw':![],'where':{}};var _0x341da9={};var _0x555d65={'count':0x0,'rows':[]};return db[_0x5ebe('0x58')][_0x5ebe('0x66')]({'where':{'id':_0x311ad2['params']['id']}})['then'](handleEntityNotFound(_0x346748,null))[_0x5ebe('0x22')](function(_0x20a093){if(_0x20a093){_0x341da9['model']=_['keys'](db[_0x5ebe('0x6b')]['rawAttributes']);_0x341da9[_0x5ebe('0x47')]=_['keys'](_0x311ad2[_0x5ebe('0x47')]);_0x341da9[_0x5ebe('0x49')]=_[_0x5ebe('0x4a')](_0x341da9[_0x5ebe('0x46')],_0x341da9[_0x5ebe('0x47')]);_0x180f47[_0x5ebe('0x4b')]=_[_0x5ebe('0x4a')](_0x341da9[_0x5ebe('0x46')],qs['fields'](_0x311ad2['query']['fields']));_0x180f47['attributes']=_0x180f47[_0x5ebe('0x4b')][_0x5ebe('0x4d')]?_0x180f47[_0x5ebe('0x4b')]:_0x341da9[_0x5ebe('0x46')];if(!_0x311ad2[_0x5ebe('0x47')][_0x5ebe('0x4e')]('nolimit')){_0x180f47[_0x5ebe('0x4f')]=qs[_0x5ebe('0x4f')](_0x311ad2[_0x5ebe('0x47')][_0x5ebe('0x4f')]);_0x180f47['offset']=qs[_0x5ebe('0x32')](_0x311ad2[_0x5ebe('0x47')]['offset']);}_0x180f47['order']=qs[_0x5ebe('0x51')](_0x311ad2[_0x5ebe('0x47')]['sort']);_0x180f47[_0x5ebe('0x54')]=qs[_0x5ebe('0x49')](_['pick'](_0x311ad2['query'],_0x341da9[_0x5ebe('0x49')]));_0x180f47[_0x5ebe('0x54')]['MailAccountId']=_0x20a093['id'];if(_0x311ad2[_0x5ebe('0x47')][_0x5ebe('0x53')]){_0x180f47[_0x5ebe('0x54')]=_[_0x5ebe('0x56')](_0x180f47[_0x5ebe('0x54')],{'$or':_[_0x5ebe('0x42')](_0x180f47[_0x5ebe('0x4b')],function(_0x3b5ae2){var _0x51aadd={};_0x51aadd[_0x3b5ae2]={'$like':'%'+_0x311ad2['query'][_0x5ebe('0x53')]+'%'};return _0x51aadd;})});}_0x180f47=_[_0x5ebe('0x56')]({},_0x180f47,_0x311ad2[_0x5ebe('0x57')]);return db[_0x5ebe('0x6b')][_0x5ebe('0x31')]({'where':_0x180f47['where']})[_0x5ebe('0x22')](function(_0x1a1ba0){_0x555d65['count']=_0x1a1ba0;if(_0x311ad2[_0x5ebe('0x47')][_0x5ebe('0x5e')]){_0x180f47['include']=[{'all':!![]}];}return db[_0x5ebe('0x6b')][_0x5ebe('0x5a')](_0x180f47);})[_0x5ebe('0x22')](function(_0x5051e0){_0x555d65[_0x5ebe('0x5b')]=_0x5051e0;return _0x555d65;});}})[_0x5ebe('0x22')](respondWithFilteredResult(_0x346748,_0x180f47))[_0x5ebe('0x2c')](handleError(_0x346748,null));};exports[_0x5ebe('0x6d')]=function(_0x1e701c,_0x3b6167,_0x158757){return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x1e701c[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x3b6167,null))[_0x5ebe('0x22')](function(_0x5a31a9){if(_0x5a31a9){return _0x5a31a9[_0x5ebe('0x6d')](_0x1e701c[_0x5ebe('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x3b6167,null))[_0x5ebe('0x2c')](handleError(_0x3b6167,null));};exports[_0x5ebe('0x64')]=function(_0x207ad9,_0x1e56fd){var _0x2748a3={'name':_0x207ad9['body'][_0x5ebe('0x3b')],'key':_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x6e')],'email':_0x207ad9[_0x5ebe('0x60')]['email'],'ListId':_0x207ad9['body'][_0x5ebe('0x6f')],'active':!_['isNil'](_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x70')])?_0x207ad9['body'][_0x5ebe('0x70')]:!![],'description':_0x207ad9['body'][_0x5ebe('0x71')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x207ad9['body']['cservice'])){if(_0x207ad9['body']['cauthentication']){_0x2748a3[_0x5ebe('0x3f')][_0x5ebe('0x72')]=_0x2748a3[_0x5ebe('0x41')]['user']=_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x73')];_0x2748a3['Imap'][_0x5ebe('0x74')]=_0x2748a3['Smtp'][_0x5ebe('0x75')]=_0x207ad9[_0x5ebe('0x60')]['cpassword'];}else{_0x2748a3[_0x5ebe('0x3f')]['authentication']=_0x2748a3['Smtp'][_0x5ebe('0x76')]=![];}_0x2748a3['Imap'][_0x5ebe('0x77')]=_0x207ad9['body'][_0x5ebe('0x3f')][_0x5ebe('0x77')];_0x2748a3[_0x5ebe('0x3f')][_0x5ebe('0x78')]=_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x3f')][_0x5ebe('0x78')];_0x2748a3[_0x5ebe('0x41')][_0x5ebe('0x77')]=_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x41')][_0x5ebe('0x77')];_0x2748a3[_0x5ebe('0x41')][_0x5ebe('0x78')]=_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x41')]['port'];}else{_0x2748a3['Imap'][_0x5ebe('0x79')]=_0x2748a3[_0x5ebe('0x41')][_0x5ebe('0x79')]=_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x7a')];_0x2748a3['Imap'][_0x5ebe('0x72')]=_0x2748a3['Smtp']['user']=_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x73')];_0x2748a3['Imap']['password']=_0x2748a3[_0x5ebe('0x41')][_0x5ebe('0x75')]=_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x7b')];}return db[_0x5ebe('0x58')]['create'](_0x2748a3,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x5ebe('0x3e')],'as':'Imap'}]})[_0x5ebe('0x22')](function(_0x9008b){var _0x3112c0=_0x207ad9['user'][_0x5ebe('0x38')]({'plain':!![]});if(!_0x3112c0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3112c0[_0x5ebe('0x7c')]===_0x5ebe('0x72')){var _0x22fd98=_0x9008b[_0x5ebe('0x38')]({'plain':!![]});return db[_0x5ebe('0x7d')][_0x5ebe('0x5f')]({'where':{'name':_0x5ebe('0x7e'),'userProfileId':_0x3112c0['userProfileId']},'raw':!![]})[_0x5ebe('0x22')](function(_0xffb522){if(_0xffb522&&_0xffb522[_0x5ebe('0x7f')]===0x0){return db[_0x5ebe('0x80')][_0x5ebe('0x64')]({'name':_0x22fd98[_0x5ebe('0x3b')],'resourceId':_0x22fd98['id'],'type':_0xffb522[_0x5ebe('0x3b')],'sectionId':_0xffb522['id']},{})['then'](function(){return _0x9008b;});}else{return _0x9008b;}})[_0x5ebe('0x2c')](function(_0x2c4294){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c4294);throw _0x2c4294;});}return _0x9008b;})[_0x5ebe('0x22')](respondWithResult(_0x1e56fd,0xc9))[_0x5ebe('0x2c')](handleError(_0x1e56fd,null));};exports[_0x5ebe('0x81')]=function(_0x163c70,_0x4868a8,_0x3330fd){return db['MailAccount']['findOne']({'where':{'id':_0x163c70['params']['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x4868a8,null))[_0x5ebe('0x22')](function(_0x3b9334){if(_0x3b9334){return _0x3b9334[_0x5ebe('0x81')]();}return null;})[_0x5ebe('0x22')](respondWithResult(_0x4868a8,null))[_0x5ebe('0x2c')](handleError(_0x4868a8,null));};exports[_0x5ebe('0x82')]=function(_0x37a89f,_0x3386d0,_0x8ea44f){if(_0x37a89f[_0x5ebe('0x60')]['id']){delete _0x37a89f['body']['id'];}return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x37a89f[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x3386d0,null))[_0x5ebe('0x22')](function(_0x562a07){if(_0x562a07){_0x37a89f['body'][_0x5ebe('0x68')]=_0x562a07['id'];return db[_0x5ebe('0x3e')][_0x5ebe('0x64')](_0x37a89f['body']);}})[_0x5ebe('0x22')](respondWithResult(_0x3386d0,null))[_0x5ebe('0x2c')](handleError(_0x3386d0,null));};exports[_0x5ebe('0x83')]=function(_0x1e9469,_0x4d0763,_0x2f34c8){return db[_0x5ebe('0x58')][_0x5ebe('0x66')]({'where':{'id':_0x1e9469['params']['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x4d0763,null))[_0x5ebe('0x22')](function(_0x1fddc5){if(_0x1fddc5){return _0x1fddc5['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x4d0763,null))['catch'](handleError(_0x4d0763,null));};exports['getSmtp']=function(_0x266d0d,_0x5629da,_0x13ca0d){return db[_0x5ebe('0x58')]['findOne']({'where':{'id':_0x266d0d[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x5629da,null))[_0x5ebe('0x22')](function(_0x32dc20){if(_0x32dc20){return _0x32dc20[_0x5ebe('0x84')]();}return null;})[_0x5ebe('0x22')](respondWithResult(_0x5629da,null))[_0x5ebe('0x2c')](handleError(_0x5629da,null));};exports[_0x5ebe('0x85')]=function(_0x2950e3,_0x39a4a8,_0x335ab0){if(_0x2950e3[_0x5ebe('0x60')]['id']){delete _0x2950e3['body']['id'];}return db['MailAccount'][_0x5ebe('0x5f')]({'where':{'id':_0x2950e3[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x39a4a8,null))[_0x5ebe('0x22')](function(_0x4f4c14){if(_0x4f4c14){_0x2950e3[_0x5ebe('0x60')]['MailAccountId']=_0x4f4c14['id'];return db[_0x5ebe('0x40')][_0x5ebe('0x64')](_0x2950e3[_0x5ebe('0x60')]);}})[_0x5ebe('0x22')](respondWithResult(_0x39a4a8,null))[_0x5ebe('0x2c')](handleError(_0x39a4a8,null));};exports[_0x5ebe('0x86')]=function(_0x1d12b7,_0x157333,_0x5cbe03){return db[_0x5ebe('0x58')][_0x5ebe('0x66')]({'where':{'id':_0x1d12b7['params']['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x157333,null))[_0x5ebe('0x22')](function(_0x153de8){if(_0x153de8){return _0x153de8['setSmtp'](null);}return null;})[_0x5ebe('0x22')](respondWithStatusCode(_0x157333,null))[_0x5ebe('0x2c')](handleError(_0x157333,null));};exports[_0x5ebe('0x87')]=function(_0x2c744f,_0x31c232,_0x217987){return db[_0x5ebe('0x88')][_0x5ebe('0x5f')]({'where':{'id':_0x2c744f[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x31c232,null))[_0x5ebe('0x22')](function(_0x12f5e9){if(_0x12f5e9){return _0x12f5e9['addInteraction'](_0x2c744f['body']['ids'],_[_0x5ebe('0x89')](_0x2c744f[_0x5ebe('0x60')],['ids','id'])||{});}})[_0x5ebe('0x22')](respondWithResult(_0x31c232,null))[_0x5ebe('0x2c')](handleError(_0x31c232,null));};exports[_0x5ebe('0x8a')]=function(_0x461fcb,_0x1479a0,_0x373cb2){var _0x289325={'raw':![],'where':{}};var _0x4dfd16={};var _0x107d9c={'count':0x0,'rows':[]};return db[_0x5ebe('0x58')][_0x5ebe('0x66')]({'where':{'id':_0x461fcb[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x1479a0,null))[_0x5ebe('0x22')](function(_0x2fef32){if(_0x2fef32){_0x4dfd16[_0x5ebe('0x46')]=_[_0x5ebe('0x48')](db[_0x5ebe('0x88')][_0x5ebe('0x43')]);_0x4dfd16[_0x5ebe('0x47')]=_['keys'](_0x461fcb[_0x5ebe('0x47')]);_0x4dfd16['filters']=_[_0x5ebe('0x4a')](_0x4dfd16[_0x5ebe('0x46')],_0x4dfd16['query']);_0x289325[_0x5ebe('0x4b')]=_[_0x5ebe('0x4a')](_0x4dfd16[_0x5ebe('0x46')],qs[_0x5ebe('0x4c')](_0x461fcb['query']['fields']));_0x289325[_0x5ebe('0x4b')]=_0x289325[_0x5ebe('0x4b')]['length']?_0x289325[_0x5ebe('0x4b')]:_0x4dfd16[_0x5ebe('0x46')];if(!_0x461fcb[_0x5ebe('0x47')]['hasOwnProperty'](_0x5ebe('0x67'))){_0x289325['limit']=qs[_0x5ebe('0x4f')](_0x461fcb[_0x5ebe('0x47')]['limit']);_0x289325[_0x5ebe('0x32')]=qs['offset'](_0x461fcb['query'][_0x5ebe('0x32')]);}_0x289325['order']=qs[_0x5ebe('0x51')](_0x461fcb[_0x5ebe('0x47')][_0x5ebe('0x51')]);_0x289325[_0x5ebe('0x54')]=qs[_0x5ebe('0x49')](_[_0x5ebe('0x52')](_0x461fcb[_0x5ebe('0x47')],_0x4dfd16[_0x5ebe('0x49')]));_0x289325[_0x5ebe('0x54')][_0x5ebe('0x68')]=_0x2fef32['id'];if(_0x461fcb['query'][_0x5ebe('0x53')]){_0x289325[_0x5ebe('0x54')]=_[_0x5ebe('0x56')](_0x289325[_0x5ebe('0x54')],{'$or':_[_0x5ebe('0x42')](_0x289325[_0x5ebe('0x4b')],function(_0x5942c5){var _0x48d1a0={};_0x48d1a0[_0x5942c5]={'$like':'%'+_0x461fcb['query']['filter']+'%'};return _0x48d1a0;})});}_0x289325=_[_0x5ebe('0x56')]({},_0x289325,_0x461fcb['options']);return db[_0x5ebe('0x88')]['count']({'where':_0x289325[_0x5ebe('0x54')]})[_0x5ebe('0x22')](function(_0x25b73e){_0x107d9c[_0x5ebe('0x31')]=_0x25b73e;if(_0x461fcb[_0x5ebe('0x47')][_0x5ebe('0x5e')]){_0x289325['include']=[{'model':db[_0x5ebe('0x8b')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x5ebe('0x8c'),'attributes':[_0x5ebe('0x3b'),_0x5ebe('0x8d'),_0x5ebe('0x8e')],'required':![]},{'model':db[_0x5ebe('0x8f')],'as':_0x5ebe('0x90'),'attributes':['id',_0x5ebe('0x3b'),_0x5ebe('0x91')],'where':_0x461fcb['query']['tag']?{'id':_0x461fcb[_0x5ebe('0x47')]['tag']}:undefined,'required':_0x461fcb[_0x5ebe('0x47')][_0x5ebe('0x92')]?!![]:![]}];}return db[_0x5ebe('0x88')][_0x5ebe('0x5a')](_0x289325);})['then'](function(_0x3668be){_0x107d9c[_0x5ebe('0x5b')]=_0x3668be;return _0x107d9c;});}})[_0x5ebe('0x22')](respondWithFilteredResult(_0x1479a0,_0x289325))['catch'](handleError(_0x1479a0,null));};exports[_0x5ebe('0x93')]=function(_0x629815,_0x4e8217,_0x246f61){return db[_0x5ebe('0x58')]['findOne']({'where':{'id':_0x629815[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x4e8217,null))[_0x5ebe('0x22')](function(_0x2974ca){if(_0x2974ca){return db[_0x5ebe('0x94')][_0x5ebe('0x95')](function(_0x76f146){return db[_0x5ebe('0x96')]['destroy']({'where':{'MailAccountId':_0x629815[_0x5ebe('0x61')]['id']},'transaction':_0x76f146})[_0x5ebe('0x22')](function(_0x55556f){var _0x4b7c7f=_[_0x5ebe('0x42')](_0x629815[_0x5ebe('0x60')],function(_0x3908be){_0x3908be['MailAccountId']=_0x629815['params']['id'];return _0x3908be;});return db['MailApplication'][_0x5ebe('0x97')](_0x4b7c7f,{'transaction':_0x76f146});});})[_0x5ebe('0x22')](function(){return db[_0x5ebe('0x96')][_0x5ebe('0x98')]({'where':{'MailAccountId':_0x629815[_0x5ebe('0x61')]['id']},'order':_0x5ebe('0x99')});});}})[_0x5ebe('0x22')](respondWithResult(_0x4e8217,null))[_0x5ebe('0x2c')](handleError(_0x4e8217,null));};exports[_0x5ebe('0x9a')]=function(_0x3cab01,_0x20ffb3,_0x24bca7){var _0x53968f={};var _0x5c0648={};var _0x34e47d;var _0x526c0a;return db[_0x5ebe('0x58')][_0x5ebe('0x66')]({'where':{'id':_0x3cab01[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x20ffb3,null))[_0x5ebe('0x22')](function(_0x1f66f5){if(_0x1f66f5){_0x34e47d=_0x1f66f5;_0x5c0648[_0x5ebe('0x46')]=_['keys'](db[_0x5ebe('0x96')][_0x5ebe('0x43')]);_0x5c0648['query']=_[_0x5ebe('0x48')](_0x3cab01[_0x5ebe('0x47')]);_0x5c0648['filters']=_['intersection'](_0x5c0648[_0x5ebe('0x46')],_0x5c0648['query']);_0x53968f[_0x5ebe('0x4b')]=_[_0x5ebe('0x4a')](_0x5c0648[_0x5ebe('0x46')],qs['fields'](_0x3cab01['query']['fields']));_0x53968f['attributes']=_0x53968f['attributes']['length']?_0x53968f[_0x5ebe('0x4b')]:_0x5c0648['model'];_0x53968f[_0x5ebe('0x50')]=qs['sort'](_0x3cab01[_0x5ebe('0x47')][_0x5ebe('0x51')]);_0x53968f['where']=qs[_0x5ebe('0x49')](_[_0x5ebe('0x52')](_0x3cab01[_0x5ebe('0x47')],_0x5c0648['filters']));if(_0x3cab01[_0x5ebe('0x47')][_0x5ebe('0x53')]){_0x53968f[_0x5ebe('0x54')]=_[_0x5ebe('0x56')](_0x53968f['where'],{'$or':_[_0x5ebe('0x42')](_0x53968f[_0x5ebe('0x4b')],function(_0x1ae792){var _0x4c391d={};_0x4c391d[_0x1ae792]={'$like':'%'+_0x3cab01[_0x5ebe('0x47')][_0x5ebe('0x53')]+'%'};return _0x4c391d;})});}_0x53968f=_[_0x5ebe('0x56')]({},_0x53968f,_0x3cab01[_0x5ebe('0x57')]);return _0x34e47d[_0x5ebe('0x9a')](_0x53968f);}})['then'](function(_0x28f73b){if(_0x28f73b){_0x526c0a=_0x28f73b[_0x5ebe('0x4d')];if(!_0x3cab01[_0x5ebe('0x47')]['hasOwnProperty']('nolimit')){_0x53968f[_0x5ebe('0x4f')]=qs[_0x5ebe('0x4f')](_0x3cab01[_0x5ebe('0x47')][_0x5ebe('0x4f')]);_0x53968f[_0x5ebe('0x32')]=qs['offset'](_0x3cab01[_0x5ebe('0x47')][_0x5ebe('0x32')]);}return _0x34e47d[_0x5ebe('0x9a')](_0x53968f);}})[_0x5ebe('0x22')](function(_0x4ffecf){if(_0x4ffecf){return _0x4ffecf?{'count':_0x526c0a,'rows':_0x4ffecf}:null;}})[_0x5ebe('0x22')](respondWithResult(_0x20ffb3,null))[_0x5ebe('0x2c')](handleError(_0x20ffb3,null));};exports[_0x5ebe('0x9b')]=function(_0x33c8f6,_0x3de911,_0x5d472b){var _0xb496e4={'raw':!![],'where':{}};var _0x1bbf92={};var _0x409016={'count':0x0,'rows':[]};return db['MailAccount'][_0x5ebe('0x66')]({'where':{'id':_0x33c8f6['params']['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x3de911,null))[_0x5ebe('0x22')](function(_0x45b923){if(_0x45b923){_0x1bbf92[_0x5ebe('0x46')]=_[_0x5ebe('0x48')](db[_0x5ebe('0x9c')][_0x5ebe('0x43')]);_0x1bbf92['query']=_[_0x5ebe('0x48')](_0x33c8f6[_0x5ebe('0x47')]);_0x1bbf92[_0x5ebe('0x49')]=_[_0x5ebe('0x4a')](_0x1bbf92[_0x5ebe('0x46')],_0x1bbf92[_0x5ebe('0x47')]);_0xb496e4[_0x5ebe('0x4b')]=_['intersection'](_0x1bbf92['model'],qs[_0x5ebe('0x4c')](_0x33c8f6[_0x5ebe('0x47')][_0x5ebe('0x4c')]));_0xb496e4['attributes']=_0xb496e4[_0x5ebe('0x4b')][_0x5ebe('0x4d')]?_0xb496e4[_0x5ebe('0x4b')]:_0x1bbf92['model'];if(!_0x33c8f6[_0x5ebe('0x47')][_0x5ebe('0x4e')](_0x5ebe('0x67'))){_0xb496e4['limit']=qs['limit'](_0x33c8f6[_0x5ebe('0x47')][_0x5ebe('0x4f')]);_0xb496e4[_0x5ebe('0x32')]=qs[_0x5ebe('0x32')](_0x33c8f6[_0x5ebe('0x47')]['offset']);}_0xb496e4[_0x5ebe('0x50')]=qs[_0x5ebe('0x51')](_0x33c8f6[_0x5ebe('0x47')]['sort']);_0xb496e4['where']=qs[_0x5ebe('0x49')](_['pick'](_0x33c8f6[_0x5ebe('0x47')],_0x1bbf92['filters']));_0xb496e4[_0x5ebe('0x54')][_0x5ebe('0x68')]=_0x45b923['id'];if(_0x33c8f6[_0x5ebe('0x47')][_0x5ebe('0x53')]){_0xb496e4['where']=_[_0x5ebe('0x56')](_0xb496e4[_0x5ebe('0x54')],{'$or':_[_0x5ebe('0x42')](_0xb496e4[_0x5ebe('0x4b')],function(_0x147d9f){var _0x573809={};_0x573809[_0x147d9f]={'$like':'%'+_0x33c8f6['query']['filter']+'%'};return _0x573809;})});}if(_0x33c8f6[_0x5ebe('0x47')][_0x5ebe('0x9d')]){var _0x1ad49b=_0x33c8f6['query'][_0x5ebe('0x9d')]['split'](',');var _0x281e83={};_0x281e83[_0x1ad49b[0x0]]={'$gte':moment(_0x1ad49b[0x1])[_0x5ebe('0x9e')](_0x5ebe('0x9f'))};_0xb496e4['where']=_[_0x5ebe('0x56')](_0xb496e4[_0x5ebe('0x54')],_0x281e83);}_0xb496e4=_[_0x5ebe('0x56')]({},_0xb496e4,_0x33c8f6[_0x5ebe('0x57')]);return db[_0x5ebe('0x9c')][_0x5ebe('0x31')]({'where':_0xb496e4[_0x5ebe('0x54')]})[_0x5ebe('0x22')](function(_0xa6235e){_0x409016['count']=_0xa6235e;if(_0x33c8f6[_0x5ebe('0x47')][_0x5ebe('0x5e')]){_0xb496e4[_0x5ebe('0x59')]=[{'all':!![]}];}return db[_0x5ebe('0x9c')]['findAll'](_0xb496e4);})['then'](function(_0x4974f7){if(_0x33c8f6['query'][_0x5ebe('0xa0')]===_0x5ebe('0xa1')){for(var _0x3f0337=0x0;_0x3f0337<_0x4974f7[_0x5ebe('0x4d')];_0x3f0337++){_0x4974f7[_0x3f0337]['body']=juice(_0x4974f7[_0x3f0337][_0x5ebe('0x60')]);}}_0x409016[_0x5ebe('0x5b')]=_0x4974f7;return _0x409016;});}})[_0x5ebe('0x22')](respondWithFilteredResult(_0x3de911,_0xb496e4))[_0x5ebe('0x2c')](handleError(_0x3de911,null));};exports[_0x5ebe('0x3c')]=function(_0x3ebf84,_0x4a9608,_0x232d52){var _0x434088,_0x13a55e={},_0x343f2c;if(_0x3ebf84[_0x5ebe('0x60')]['to']){_0x343f2c=_0x3ebf84[_0x5ebe('0x60')]['to'][_0x5ebe('0xa2')](',')[0x0];}return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x3ebf84[_0x5ebe('0x61')]['id']},'include':[{'model':db[_0x5ebe('0xa3')],'as':_0x5ebe('0xa4'),'include':[{'model':db[_0x5ebe('0x8b')],'as':_0x5ebe('0xa5'),'where':{'email':_0x343f2c},'limit':0x1,'order':[['updatedAt',_0x5ebe('0xa6')]]}]},{'model':db['MailServerOut'],'as':_0x5ebe('0x41'),'raw':!![]}]})[_0x5ebe('0x22')](handleEntityNotFound(_0x4a9608,null))[_0x5ebe('0x22')](function(_0x18695a){if(_0x18695a){_0x434088=_0x18695a;if(_0x18695a[_0x5ebe('0x41')]){if(_[_0x5ebe('0xa7')](_0x3ebf84['body'][_0x5ebe('0xa8')])){_0x3ebf84[_0x5ebe('0x60')][_0x5ebe('0xa8')]=util[_0x5ebe('0x9e')](_0x5ebe('0xa9'),_0x18695a['name'],_0x18695a[_0x5ebe('0xaa')]||_0x18695a[_0x5ebe('0x41')][_0x5ebe('0x72')]);}if(_0x3ebf84[_0x5ebe('0x60')]['attachments']&&_0x3ebf84['body'][_0x5ebe('0xab')][_0x5ebe('0x4d')]){for(var _0x1ecb45=0x0;_0x1ecb45<_0x3ebf84[_0x5ebe('0x60')]['attachments'][_0x5ebe('0x4d')];_0x1ecb45+=0x1){_0x3ebf84[_0x5ebe('0x60')][_0x5ebe('0xab')][_0x1ecb45]={'filename':_0x3ebf84['body']['attachments'][_0x1ecb45][_0x5ebe('0x3b')],'path':path['join'](config[_0x5ebe('0xac')],_0x5ebe('0xad'),_0x3ebf84['body'][_0x5ebe('0xab')][_0x1ecb45][_0x5ebe('0xae')])};}}var _0x47b7f5={'tls':{'rejectUnauthorized':![]}};if(_[_0x5ebe('0xa7')](_0x18695a[_0x5ebe('0x41')][_0x5ebe('0x79')])){if(_0x18695a[_0x5ebe('0x41')][_0x5ebe('0x76')]){_0x47b7f5[_0x5ebe('0xaf')]={'user':_0x18695a[_0x5ebe('0x41')][_0x5ebe('0x72')],'pass':_0x18695a[_0x5ebe('0x41')][_0x5ebe('0x75')]};}_0x47b7f5[_0x5ebe('0x77')]=_0x18695a[_0x5ebe('0x41')]['host'];_0x47b7f5[_0x5ebe('0x78')]=_0x18695a[_0x5ebe('0x41')][_0x5ebe('0x78')];_0x47b7f5[_0x5ebe('0xb0')]=_0x18695a[_0x5ebe('0x41')][_0x5ebe('0xb0')];}else{_0x47b7f5['service']=_0x18695a[_0x5ebe('0x41')][_0x5ebe('0x79')];_0x47b7f5[_0x5ebe('0xaf')]={'user':_0x18695a['Smtp'][_0x5ebe('0x72')],'pass':_0x18695a['Smtp']['pass']};}return respondWithRpcPromise(_0x5ebe('0xb1'),_0x5ebe('0xb2'),{'account':_0x47b7f5,'message':_0x3ebf84[_0x5ebe('0x60')]});}else{throw new Error(_0x5ebe('0xb3'));}}})[_0x5ebe('0x22')](function(_0x4c5d1a){if(_0x4c5d1a){_0x13a55e=_0x4c5d1a;if(_0x434088[_0x5ebe('0xa4')]){if(_0x434088['List']['Contacts'][_0x5ebe('0x4d')]){return _0x434088[_0x5ebe('0xa4')]['Contacts'][0x0];}else{return db[_0x5ebe('0x8b')][_0x5ebe('0x64')](_[_0x5ebe('0x1a')](_0x3ebf84[_0x5ebe('0x60')],{'firstName':_0x3ebf84[_0x5ebe('0x60')]['to'],'email':_0x3ebf84[_0x5ebe('0x60')]['to'],'phone':_0x3ebf84[_0x5ebe('0x60')]['to'],'ListId':_0x434088[_0x5ebe('0x6f')]}));}}else{throw new Error(_0x5ebe('0xb3'));}}})['then'](function(_0x241a2e){if(_0x241a2e){var _0x4db97d={'UserId':_0x3ebf84[_0x5ebe('0x72')]['id'],'ContactId':_0x241a2e['id'],'MailAccountId':_0x434088['id'],'inReplyTo':_0x13a55e[_0x5ebe('0xb4')],'to':_0x3ebf84['body'][_0x5ebe('0xa8')],'cc':_0x3ebf84[_0x5ebe('0x60')]['cc'],'subject':_0x3ebf84[_0x5ebe('0x60')][_0x5ebe('0xb5')],'attach':_0x3ebf84[_0x5ebe('0x60')][_0x5ebe('0xb6')],'firstMsgDirection':_0x5ebe('0xb7'),'lastMsgAt':moment()[_0x5ebe('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x5ebe('0xb7'),'lastMsgBody':_0x3ebf84['body'][_0x5ebe('0x60')],'Messages':[_[_0x5ebe('0x56')](_0x3ebf84[_0x5ebe('0x60')],{'messageId':_0x13a55e[_0x5ebe('0xb4')],'sentAt':moment()[_0x5ebe('0x9e')](_0x5ebe('0x9f')),'read':!![],'MailAccountId':_0x434088['id'],'UserId':_0x3ebf84[_0x5ebe('0x72')]['id'],'ContactId':_0x241a2e['id']})]};if(_0x3ebf84[_0x5ebe('0x60')]['Interaction']){_0x4db97d=_[_0x5ebe('0x56')](_0x4db97d,_0x3ebf84[_0x5ebe('0x60')]['Interaction']);}return db[_0x5ebe('0x88')][_0x5ebe('0x64')](_0x4db97d,{'include':[{'model':db[_0x5ebe('0x9c')],'as':_0x5ebe('0xb8')}]});}})[_0x5ebe('0x22')](respondWithResult(_0x4a9608,null))[_0x5ebe('0x2c')](handleError(_0x4a9608,null));};exports['verifySmtp']=function(_0x30e513,_0x3a1d98,_0x2c7ace){return db['MailAccount'][_0x5ebe('0x5f')]({'where':{'id':_0x30e513[_0x5ebe('0x61')]['id']},'include':[{'model':db[_0x5ebe('0x40')],'as':_0x5ebe('0x41'),'raw':!![]}]})[_0x5ebe('0x22')](handleEntityNotFound(_0x3a1d98,null))[_0x5ebe('0x22')](function(_0x5dbd1d){if(_0x5dbd1d&&_0x5dbd1d[_0x5ebe('0x41')]){var _0x4ae387={'id':_0x5dbd1d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5dbd1d[_0x5ebe('0x41')][_0x5ebe('0x79')]){_0x4ae387[_0x5ebe('0x79')]=_0x5dbd1d['Smtp']['service'];}else{_0x4ae387[_0x5ebe('0x77')]=_0x5dbd1d[_0x5ebe('0x41')]['host'];_0x4ae387['port']=_0x5dbd1d['Smtp'][_0x5ebe('0x78')];_0x4ae387[_0x5ebe('0xb0')]=_0x5dbd1d['Smtp']['secure'];}if(_0x5dbd1d[_0x5ebe('0x41')][_0x5ebe('0x76')]){_0x4ae387[_0x5ebe('0xaf')]={'user':_0x5dbd1d[_0x5ebe('0x41')][_0x5ebe('0x72')],'pass':_0x5dbd1d['Smtp'][_0x5ebe('0x75')]};}return respondWithRpcPromise('VerifySmtp',_0x5ebe('0xb9'),{'account':_0x4ae387});}})[_0x5ebe('0x22')](respondWithResult(_0x3a1d98,null))[_0x5ebe('0x2c')](handleError(_0x3a1d98,null));};exports[_0x5ebe('0x39')]=function(_0x1008eb,_0x566df7){return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x1008eb[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x566df7,null))['then'](function(_0x18e765){if(_0x18e765&&_0x18e765['service']){throw new db['Sequelize'][(_0x5ebe('0xba'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x18e765;})['then'](removeEntity(_0x566df7,null))['catch'](handleError(_0x566df7,null));};exports['addAgents']=function(_0x548702,_0x18b0e6,_0x1e7c20){return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x548702['params']['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x18b0e6,null))['then'](function(_0x5d44dc){if(_0x5d44dc){return _0x5d44dc['addAgents'](_0x548702['body']['ids'],_['omit'](_0x548702[_0x5ebe('0x60')],['ids','id'])||{})['spread'](function(_0x1f9269){for(var _0x39c069=0x0;_0x39c069<_0x548702[_0x5ebe('0x60')]['ids'][_0x5ebe('0x4d')];_0x39c069+=0x1){socket[_0x5ebe('0xbb')](_0x5ebe('0xbc'),{'UserId':_0x548702[_0x5ebe('0x60')][_0x5ebe('0xbd')][_0x39c069],'MailAccountId':_0x548702['params']['id']});}return _0x1f9269;});}})[_0x5ebe('0x22')](respondWithResult(_0x18b0e6,null))[_0x5ebe('0x2c')](handleError(_0x18b0e6,null));};exports[_0x5ebe('0xbe')]=function(_0x10037b,_0x5c4ed3,_0x3d290c){return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x10037b[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x5c4ed3,null))['then'](function(_0x3d0a3c){if(_0x3d0a3c){return _0x3d0a3c[_0x5ebe('0xbe')](_0x10037b[_0x5ebe('0x47')][_0x5ebe('0xbd')])['then'](function(){if(_[_0x5ebe('0xbf')](_0x10037b[_0x5ebe('0x47')][_0x5ebe('0xbd')])){for(var _0x409961=0x0;_0x409961<_0x10037b[_0x5ebe('0x47')][_0x5ebe('0xbd')]['length'];_0x409961+=0x1){socket[_0x5ebe('0xbb')](_0x5ebe('0xc0'),{'UserId':Number(_0x10037b[_0x5ebe('0x47')][_0x5ebe('0xbd')][_0x409961]),'MailAccountId':Number(_0x10037b[_0x5ebe('0x61')]['id'])});}}else{socket[_0x5ebe('0xbb')](_0x5ebe('0xc0'),{'UserId':Number(_0x10037b[_0x5ebe('0x47')]['ids']),'MailAccountId':Number(_0x10037b[_0x5ebe('0x61')]['id'])});}});}})[_0x5ebe('0x22')](respondWithStatusCode(_0x5c4ed3,null))[_0x5ebe('0x2c')](handleError(_0x5c4ed3,null));};exports[_0x5ebe('0xc1')]=function(_0x1f55a8,_0x64218c,_0x29e22e){var _0x33675e={};var _0x2eec26={};var _0x3fdc63;var _0x8ba07;return db[_0x5ebe('0x58')][_0x5ebe('0x66')]({'where':{'id':_0x1f55a8[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x64218c,null))[_0x5ebe('0x22')](function(_0x1a2343){if(_0x1a2343){_0x3fdc63=_0x1a2343;_0x2eec26[_0x5ebe('0x46')]=_[_0x5ebe('0x48')](db[_0x5ebe('0xc2')]['rawAttributes']);_0x2eec26[_0x5ebe('0x47')]=_[_0x5ebe('0x48')](_0x1f55a8[_0x5ebe('0x47')]);_0x2eec26[_0x5ebe('0x49')]=_[_0x5ebe('0x4a')](_0x2eec26[_0x5ebe('0x46')],_0x2eec26[_0x5ebe('0x47')]);_0x33675e[_0x5ebe('0x4b')]=_['intersection'](_0x2eec26['model'],qs[_0x5ebe('0x4c')](_0x1f55a8[_0x5ebe('0x47')][_0x5ebe('0x4c')]));_0x33675e[_0x5ebe('0x4b')]=_0x33675e[_0x5ebe('0x4b')][_0x5ebe('0x4d')]?_0x33675e[_0x5ebe('0x4b')]:_0x2eec26[_0x5ebe('0x46')];_0x33675e[_0x5ebe('0x50')]=qs[_0x5ebe('0x51')](_0x1f55a8[_0x5ebe('0x47')][_0x5ebe('0x51')]);_0x33675e['where']=qs[_0x5ebe('0x49')](_['pick'](_0x1f55a8[_0x5ebe('0x47')],_0x2eec26[_0x5ebe('0x49')]));if(_0x1f55a8[_0x5ebe('0x47')][_0x5ebe('0x53')]){_0x33675e[_0x5ebe('0x54')]=_['merge'](_0x33675e[_0x5ebe('0x54')],{'$or':_[_0x5ebe('0x42')](_0x33675e[_0x5ebe('0x4b')],function(_0x271378){var _0x2bb7db={};_0x2bb7db[_0x271378]={'$like':'%'+_0x1f55a8[_0x5ebe('0x47')][_0x5ebe('0x53')]+'%'};return _0x2bb7db;})});}_0x33675e=_[_0x5ebe('0x56')]({},_0x33675e,_0x1f55a8[_0x5ebe('0x57')]);return _0x3fdc63[_0x5ebe('0xc1')](_0x33675e);}})['then'](function(_0x2a9ff6){if(_0x2a9ff6){_0x8ba07=_0x2a9ff6[_0x5ebe('0x4d')];if(!_0x1f55a8[_0x5ebe('0x47')]['hasOwnProperty'](_0x5ebe('0x67'))){_0x33675e[_0x5ebe('0x4f')]=qs[_0x5ebe('0x4f')](_0x1f55a8['query'][_0x5ebe('0x4f')]);_0x33675e[_0x5ebe('0x32')]=qs[_0x5ebe('0x32')](_0x1f55a8[_0x5ebe('0x47')][_0x5ebe('0x32')]);}return _0x3fdc63['getAgents'](_0x33675e);}})[_0x5ebe('0x22')](function(_0x174ad0){if(_0x174ad0){return _0x174ad0?{'count':_0x8ba07,'rows':_0x174ad0}:null;}})[_0x5ebe('0x22')](respondWithResult(_0x64218c,null))[_0x5ebe('0x2c')](handleError(_0x64218c,null));}; \ No newline at end of file +var _0x2af5=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','register','jayson/promise','http','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','MailAccounts','UserProfileResource','name','index','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','rows','catch','show','params','keys','rawAttributes','includeAll','include','find','body','Smtp','describe','MailAccountId','Disposition','create','getDispositions','findOne','length','nolimit','order','findAll','removeDispositions','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','password','pass','cpassword','authentication','port','host','service','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','ids','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','tag','addApplications','transaction','MailApplication','findAndCountAll','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','send','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','server/files/attachments','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','auth','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','html-pdf','eml-format'];(function(_0x29bbf6,_0x59bb84){var _0x88a261=function(_0x306789){while(--_0x306789){_0x29bbf6['push'](_0x29bbf6['shift']());}};_0x88a261(++_0x59bb84);}(_0x2af5,0x180));var _0x52af=function(_0x201bb7,_0xb4ae42){_0x201bb7=_0x201bb7-0x0;var _0x463e3b=_0x2af5[_0x201bb7];return _0x463e3b;};'use strict';var pdf=require(_0x52af('0x0'));var emlformat=require(_0x52af('0x1'));var rimraf=require(_0x52af('0x2'));var zipdir=require(_0x52af('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x52af('0x4'));var moment=require(_0x52af('0x5'));var BPromise=require(_0x52af('0x6'));var Mustache=require(_0x52af('0x7'));var util=require(_0x52af('0x8'));var path=require(_0x52af('0x9'));var sox=require(_0x52af('0xa'));var csv=require(_0x52af('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x52af('0xc'));var squel=require('squel');var crypto=require(_0x52af('0xd'));var jsforce=require(_0x52af('0xe'));var deskjs=require(_0x52af('0xf'));var toCsv=require(_0x52af('0xb'));var querystring=require('querystring');var Papa=require(_0x52af('0x10'));var htmlToText=require(_0x52af('0x11'));var juice=require('juice');var Redis=require(_0x52af('0x12'));var authService=require(_0x52af('0x13'));var qs=require(_0x52af('0x14'));var as=require(_0x52af('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x52af('0x16'))(_0x52af('0x17'));var utils=require(_0x52af('0x18'));var config=require(_0x52af('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x52af('0x1a'))['db'];config['redis']=_[_0x52af('0x1b')](config[_0x52af('0x1c')],{'host':_0x52af('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x52af('0x1c')]));require('./mailAccount.socket')[_0x52af('0x1e')](socket);var jayson=require(_0x52af('0x1f'));var client=jayson['client'][_0x52af('0x20')]({'port':0x232b});function respondWithRpcPromise(_0xee109f,_0x1b8126,_0x3f2971,_0x9b14a7){return new BPromise(function(_0x2f14dc,_0x51b35d){var _0x2927e2=_0x9b14a7||client;return _0x2927e2['request'](_0xee109f,_0x3f2971)[_0x52af('0x21')](function(_0x45672e){logger['info'](_0x52af('0x22'),_0x1b8126,_0x52af('0x23'));logger['debug'](_0x52af('0x24'),_0x1b8126,_0x52af('0x23'),JSON['stringify'](_0x45672e));if(_0x45672e[_0x52af('0x25')]){if(_0x45672e[_0x52af('0x25')][_0x52af('0x26')]===0x1f4){logger['error'](_0x52af('0x22'),_0x1b8126,_0x45672e[_0x52af('0x25')]['message']);return _0x51b35d(_0x45672e[_0x52af('0x25')]['message']);}logger[_0x52af('0x25')](_0x52af('0x22'),_0x1b8126,_0x45672e[_0x52af('0x25')][_0x52af('0x27')]);return _0x2f14dc(_0x45672e[_0x52af('0x25')][_0x52af('0x27')]);}else{logger[_0x52af('0x28')](_0x52af('0x22'),_0x1b8126,_0x52af('0x23'));_0x2f14dc(_0x45672e[_0x52af('0x29')][_0x52af('0x27')]);}})['catch'](function(_0x1a2877){logger[_0x52af('0x25')]('MailAccount,\x20%s,\x20%s',_0x1b8126,_0x1a2877);_0x51b35d(_0x1a2877);});});}function respondWithStatusCode(_0x418988,_0x344010){_0x344010=_0x344010||0xcc;return function(_0x4849de){if(_0x4849de){return _0x418988[_0x52af('0x2a')](_0x344010);}return _0x418988[_0x52af('0x2b')](_0x344010)['end']();};}function respondWithResult(_0x2783cc,_0x3ccc19){_0x3ccc19=_0x3ccc19||0xc8;return function(_0xba775b){if(_0xba775b){return _0x2783cc[_0x52af('0x2b')](_0x3ccc19)['json'](_0xba775b);}};}function respondWithFilteredResult(_0x4b52ef,_0x32fb51){return function(_0x135216){if(_0x135216){var _0x286909=_0x135216[_0x52af('0x2c')],_0x481b55=_0x32fb51['offset'],_0x3f5a79=_0x32fb51[_0x52af('0x2d')]+_0x32fb51[_0x52af('0x2e')],_0xe9b4d;if(_0x3f5a79>=_0x286909){_0x3f5a79=_0x286909;_0xe9b4d=0xc8;}else{_0xe9b4d=0xce;}_0x4b52ef['status'](_0xe9b4d);return _0x4b52ef[_0x52af('0x2f')](_0x52af('0x30'),_0x481b55+'-'+_0x3f5a79+'/'+_0x286909)[_0x52af('0x31')](_0x135216);}return null;};}function patchUpdates(_0x56c111){return function(_0x3f0f86){try{jsonpatch[_0x52af('0x32')](_0x3f0f86,_0x56c111,!![]);}catch(_0x20a517){return BPromise[_0x52af('0x33')](_0x20a517);}return _0x3f0f86[_0x52af('0x34')]();};}function saveUpdates(_0x559bae,_0x27105a){return function(_0x20c55d){if(_0x20c55d){return _0x20c55d[_0x52af('0x35')](_0x559bae)['then'](function(_0x5b99e9){return _0x5b99e9;});}return null;};}function removeEntity(_0x1cf0bd,_0x50a46f){return function(_0x5ab07a){if(_0x5ab07a){return _0x5ab07a[_0x52af('0x36')]()[_0x52af('0x21')](function(){var _0x232f68=_0x5ab07a[_0x52af('0x37')]({'plain':!![]});var _0x9d0fba=_0x52af('0x38');return db[_0x52af('0x39')][_0x52af('0x36')]({'where':{'type':_0x9d0fba,'resourceId':_0x232f68['id']}})[_0x52af('0x21')](function(){return _0x5ab07a;});})[_0x52af('0x21')](function(){_0x1cf0bd[_0x52af('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x738c10,_0x54994a){return function(_0x2e070a){if(!_0x2e070a){_0x738c10[_0x52af('0x2a')](0x194);}return _0x2e070a;};}function handleError(_0x27a874,_0x160950){_0x160950=_0x160950||0x1f4;return function(_0x289025){logger[_0x52af('0x25')](_0x289025['stack']);if(_0x289025[_0x52af('0x3a')]){delete _0x289025[_0x52af('0x3a')];}_0x27a874[_0x52af('0x2b')](_0x160950)['send'](_0x289025);};}exports[_0x52af('0x3b')]=function(_0x12297a,_0x4f4e30){var _0x2cfa59={'include':[{'model':db[_0x52af('0x3c')],'as':_0x52af('0x3d')},{'model':db[_0x52af('0x3e')],'as':'Smtp'},{'model':db[_0x52af('0x3f')],'as':_0x52af('0x40')}]},_0x5f11a9={},_0x483d73={'count':0x0,'rows':[]};var _0x1505a5=_[_0x52af('0x41')](db[_0x52af('0x42')]['rawAttributes'],function(_0x5eb276){return{'name':_0x5eb276[_0x52af('0x43')],'type':_0x5eb276[_0x52af('0x44')][_0x52af('0x45')]};});_0x5f11a9['model']=_[_0x52af('0x41')](_0x1505a5,'name');_0x5f11a9[_0x52af('0x46')]=_['keys'](_0x12297a['query']);_0x5f11a9[_0x52af('0x47')]=_[_0x52af('0x48')](_0x5f11a9[_0x52af('0x49')],_0x5f11a9[_0x52af('0x46')]);_0x2cfa59[_0x52af('0x4a')]=_[_0x52af('0x48')](_0x5f11a9[_0x52af('0x49')],qs['fields'](_0x12297a['query'][_0x52af('0x4b')]));_0x2cfa59[_0x52af('0x4a')]=_0x2cfa59['attributes']['length']?_0x2cfa59[_0x52af('0x4a')]:_0x5f11a9[_0x52af('0x49')];if(!_0x12297a[_0x52af('0x46')][_0x52af('0x4c')]('nolimit')){_0x2cfa59[_0x52af('0x2e')]=qs['limit'](_0x12297a[_0x52af('0x46')][_0x52af('0x2e')]);_0x2cfa59['offset']=qs[_0x52af('0x2d')](_0x12297a['query'][_0x52af('0x2d')]);}_0x2cfa59['order']=qs[_0x52af('0x4d')](_0x12297a['query']['sort']);_0x2cfa59['where']=qs[_0x52af('0x47')](_[_0x52af('0x4e')](_0x12297a[_0x52af('0x46')],_0x5f11a9[_0x52af('0x47')]),_0x1505a5);if(_0x12297a['query'][_0x52af('0x4f')]){_0x2cfa59[_0x52af('0x50')]=_['merge'](_0x2cfa59[_0x52af('0x50')],{'$or':_[_0x52af('0x41')](_0x1505a5,function(_0x4964fe){if(_0x4964fe['type']!==_0x52af('0x51')){var _0x10d229={};_0x10d229[_0x4964fe[_0x52af('0x3a')]]={'$like':'%'+_0x12297a[_0x52af('0x46')]['filter']+'%'};return _0x10d229;}})});}_0x2cfa59=_[_0x52af('0x52')]({},_0x2cfa59,_0x12297a[_0x52af('0x53')]);var _0x3ef3cd={'where':_0x2cfa59[_0x52af('0x50')]};return db[_0x52af('0x42')]['count'](_0x3ef3cd)[_0x52af('0x21')](function(_0x40d6f0){_0x483d73[_0x52af('0x2c')]=_0x40d6f0;if(_0x12297a[_0x52af('0x46')]['includeAll']){_0x2cfa59['include']=[{'all':!![]}];}return db[_0x52af('0x42')]['findAll'](_0x2cfa59);})[_0x52af('0x21')](function(_0x51aeac){_0x483d73[_0x52af('0x54')]=_0x51aeac;return _0x483d73;})[_0x52af('0x21')](respondWithFilteredResult(_0x4f4e30,_0x2cfa59))[_0x52af('0x55')](handleError(_0x4f4e30,null));};exports[_0x52af('0x56')]=function(_0x2a207b,_0x525daf){var _0x55bd36={'raw':![],'where':{'id':_0x2a207b[_0x52af('0x57')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x52af('0x3f')],'as':'mandatoryDispositionPause'}]},_0x1042c7={};_0x1042c7[_0x52af('0x49')]=_[_0x52af('0x58')](db[_0x52af('0x42')][_0x52af('0x59')]);_0x1042c7[_0x52af('0x46')]=_[_0x52af('0x58')](_0x2a207b['query']);_0x1042c7[_0x52af('0x47')]=_[_0x52af('0x48')](_0x1042c7[_0x52af('0x49')],_0x1042c7['query']);_0x55bd36[_0x52af('0x4a')]=_[_0x52af('0x48')](_0x1042c7[_0x52af('0x49')],qs[_0x52af('0x4b')](_0x2a207b['query'][_0x52af('0x4b')]));_0x55bd36[_0x52af('0x4a')]=_0x55bd36[_0x52af('0x4a')]['length']?_0x55bd36[_0x52af('0x4a')]:_0x1042c7[_0x52af('0x49')];if(_0x2a207b[_0x52af('0x46')][_0x52af('0x5a')]){_0x55bd36[_0x52af('0x5b')]=[{'all':!![]}];}_0x55bd36=_[_0x52af('0x52')]({},_0x55bd36,_0x2a207b[_0x52af('0x53')]);return db[_0x52af('0x42')][_0x52af('0x5c')](_0x55bd36)[_0x52af('0x21')](handleEntityNotFound(_0x525daf,null))['then'](respondWithResult(_0x525daf,null))[_0x52af('0x55')](handleError(_0x525daf,null));};exports[_0x52af('0x35')]=function(_0x42ce4c,_0x43d106){if(_0x42ce4c['body']['id']){delete _0x42ce4c[_0x52af('0x5d')]['id'];}return db[_0x52af('0x42')]['find']({'where':{'id':_0x42ce4c[_0x52af('0x57')]['id']},'include':[{'model':db[_0x52af('0x3c')],'as':'Imap'},{'model':db[_0x52af('0x3e')],'as':_0x52af('0x5e')},{'model':db[_0x52af('0x3f')],'as':_0x52af('0x40')}]})[_0x52af('0x21')](handleEntityNotFound(_0x43d106,null))[_0x52af('0x21')](saveUpdates(_0x42ce4c[_0x52af('0x5d')],null))[_0x52af('0x21')](function(_0x1897e1){if(_0x1897e1&&_0x42ce4c[_0x52af('0x5d')]['Imap']){return db[_0x52af('0x3c')][_0x52af('0x35')](_0x42ce4c[_0x52af('0x5d')][_0x52af('0x3d')],{'where':{'MailAccountId':_0x1897e1['id']}})['then'](function(){return _0x1897e1;});}return _0x1897e1;})[_0x52af('0x21')](function(_0x576b3d){if(_0x576b3d&&_0x42ce4c[_0x52af('0x5d')][_0x52af('0x5e')]){return db['MailServerOut']['update'](_0x42ce4c[_0x52af('0x5d')]['Smtp'],{'where':{'MailAccountId':_0x576b3d['id']}})[_0x52af('0x21')](function(){return _0x576b3d;});}return _0x576b3d;})[_0x52af('0x21')](respondWithResult(_0x43d106,null))[_0x52af('0x55')](handleError(_0x43d106,null));};exports['describe']=function(_0x202bbd,_0x357774){return db[_0x52af('0x42')][_0x52af('0x5f')]()[_0x52af('0x21')](respondWithResult(_0x357774,null))['catch'](handleError(_0x357774,null));};exports['addDisposition']=function(_0x543471,_0x4c2e49,_0x17b0e1){if(_0x543471[_0x52af('0x5d')]['id']){delete _0x543471[_0x52af('0x5d')]['id'];}return db[_0x52af('0x42')]['find']({'where':{'id':_0x543471[_0x52af('0x57')]['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x4c2e49,null))['then'](function(_0x64136c){if(_0x64136c){_0x543471[_0x52af('0x5d')][_0x52af('0x60')]=_0x64136c['id'];return db[_0x52af('0x61')][_0x52af('0x62')](_0x543471[_0x52af('0x5d')]);}})[_0x52af('0x21')](respondWithResult(_0x4c2e49,null))['catch'](handleError(_0x4c2e49,null));};exports[_0x52af('0x63')]=function(_0x11fac2,_0xebbac0,_0x38d783){var _0x532f9b={'raw':![],'where':{}};var _0x4ff850={};var _0x3bcd78={'count':0x0,'rows':[]};return db[_0x52af('0x42')][_0x52af('0x64')]({'where':{'id':_0x11fac2[_0x52af('0x57')]['id']}})[_0x52af('0x21')](handleEntityNotFound(_0xebbac0,null))[_0x52af('0x21')](function(_0x16d568){if(_0x16d568){_0x4ff850[_0x52af('0x49')]=_[_0x52af('0x58')](db[_0x52af('0x61')][_0x52af('0x59')]);_0x4ff850[_0x52af('0x46')]=_[_0x52af('0x58')](_0x11fac2[_0x52af('0x46')]);_0x4ff850[_0x52af('0x47')]=_[_0x52af('0x48')](_0x4ff850[_0x52af('0x49')],_0x4ff850[_0x52af('0x46')]);_0x532f9b['attributes']=_[_0x52af('0x48')](_0x4ff850['model'],qs['fields'](_0x11fac2[_0x52af('0x46')]['fields']));_0x532f9b[_0x52af('0x4a')]=_0x532f9b['attributes'][_0x52af('0x65')]?_0x532f9b[_0x52af('0x4a')]:_0x4ff850[_0x52af('0x49')];if(!_0x11fac2[_0x52af('0x46')]['hasOwnProperty'](_0x52af('0x66'))){_0x532f9b[_0x52af('0x2e')]=qs[_0x52af('0x2e')](_0x11fac2['query']['limit']);_0x532f9b[_0x52af('0x2d')]=qs[_0x52af('0x2d')](_0x11fac2[_0x52af('0x46')]['offset']);}_0x532f9b[_0x52af('0x67')]=qs['sort'](_0x11fac2[_0x52af('0x46')][_0x52af('0x4d')]);_0x532f9b['where']=qs[_0x52af('0x47')](_[_0x52af('0x4e')](_0x11fac2[_0x52af('0x46')],_0x4ff850[_0x52af('0x47')]));_0x532f9b[_0x52af('0x50')][_0x52af('0x60')]=_0x16d568['id'];if(_0x11fac2['query'][_0x52af('0x4f')]){_0x532f9b[_0x52af('0x50')]=_[_0x52af('0x52')](_0x532f9b[_0x52af('0x50')],{'$or':_[_0x52af('0x41')](_0x532f9b[_0x52af('0x4a')],function(_0x3d5d4e){var _0x28ec27={};_0x28ec27[_0x3d5d4e]={'$like':'%'+_0x11fac2['query'][_0x52af('0x4f')]+'%'};return _0x28ec27;})});}_0x532f9b=_[_0x52af('0x52')]({},_0x532f9b,_0x11fac2[_0x52af('0x53')]);return db[_0x52af('0x61')]['count']({'where':_0x532f9b['where']})[_0x52af('0x21')](function(_0x230ea4){_0x3bcd78[_0x52af('0x2c')]=_0x230ea4;if(_0x11fac2['query']['includeAll']){_0x532f9b[_0x52af('0x5b')]=[{'all':!![]}];}return db['Disposition'][_0x52af('0x68')](_0x532f9b);})[_0x52af('0x21')](function(_0x19eeb3){_0x3bcd78[_0x52af('0x54')]=_0x19eeb3;return _0x3bcd78;});}})[_0x52af('0x21')](respondWithFilteredResult(_0xebbac0,_0x532f9b))['catch'](handleError(_0xebbac0,null));};exports[_0x52af('0x69')]=function(_0x1e15d5,_0x3ea2fb,_0x282842){return db['MailAccount'][_0x52af('0x5c')]({'where':{'id':_0x1e15d5['params']['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x3ea2fb,null))[_0x52af('0x21')](function(_0x20fca9){if(_0x20fca9){return _0x20fca9[_0x52af('0x69')](_0x1e15d5['query']['ids']);}})[_0x52af('0x21')](respondWithStatusCode(_0x3ea2fb,null))[_0x52af('0x55')](handleError(_0x3ea2fb,null));};exports['addAnswer']=function(_0x1487c4,_0x48825c,_0x7fbee8){if(_0x1487c4['body']['id']){delete _0x1487c4[_0x52af('0x5d')]['id'];}return db[_0x52af('0x42')][_0x52af('0x5c')]({'where':{'id':_0x1487c4['params']['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x48825c,null))[_0x52af('0x21')](function(_0x370cf0){if(_0x370cf0){_0x1487c4['body'][_0x52af('0x60')]=_0x370cf0['id'];return db[_0x52af('0x6a')][_0x52af('0x62')](_0x1487c4['body']);}})[_0x52af('0x21')](respondWithResult(_0x48825c,null))[_0x52af('0x55')](handleError(_0x48825c,null));};exports[_0x52af('0x6b')]=function(_0x28ca8d,_0x449006,_0x5ec22b){var _0x4f3ad1={'raw':![],'where':{}};var _0x2a6197={};var _0x3ef7f2={'count':0x0,'rows':[]};return db[_0x52af('0x42')][_0x52af('0x64')]({'where':{'id':_0x28ca8d[_0x52af('0x57')]['id']}})['then'](handleEntityNotFound(_0x449006,null))[_0x52af('0x21')](function(_0x330a78){if(_0x330a78){_0x2a6197[_0x52af('0x49')]=_[_0x52af('0x58')](db['CannedAnswer'][_0x52af('0x59')]);_0x2a6197['query']=_[_0x52af('0x58')](_0x28ca8d[_0x52af('0x46')]);_0x2a6197[_0x52af('0x47')]=_['intersection'](_0x2a6197[_0x52af('0x49')],_0x2a6197['query']);_0x4f3ad1[_0x52af('0x4a')]=_[_0x52af('0x48')](_0x2a6197[_0x52af('0x49')],qs[_0x52af('0x4b')](_0x28ca8d[_0x52af('0x46')][_0x52af('0x4b')]));_0x4f3ad1[_0x52af('0x4a')]=_0x4f3ad1[_0x52af('0x4a')][_0x52af('0x65')]?_0x4f3ad1[_0x52af('0x4a')]:_0x2a6197[_0x52af('0x49')];if(!_0x28ca8d[_0x52af('0x46')][_0x52af('0x4c')](_0x52af('0x66'))){_0x4f3ad1[_0x52af('0x2e')]=qs[_0x52af('0x2e')](_0x28ca8d['query']['limit']);_0x4f3ad1['offset']=qs[_0x52af('0x2d')](_0x28ca8d[_0x52af('0x46')][_0x52af('0x2d')]);}_0x4f3ad1[_0x52af('0x67')]=qs[_0x52af('0x4d')](_0x28ca8d[_0x52af('0x46')][_0x52af('0x4d')]);_0x4f3ad1[_0x52af('0x50')]=qs['filters'](_[_0x52af('0x4e')](_0x28ca8d['query'],_0x2a6197['filters']));_0x4f3ad1['where'][_0x52af('0x60')]=_0x330a78['id'];if(_0x28ca8d[_0x52af('0x46')][_0x52af('0x4f')]){_0x4f3ad1[_0x52af('0x50')]=_['merge'](_0x4f3ad1['where'],{'$or':_[_0x52af('0x41')](_0x4f3ad1['attributes'],function(_0x24baad){var _0x5828bd={};_0x5828bd[_0x24baad]={'$like':'%'+_0x28ca8d[_0x52af('0x46')][_0x52af('0x4f')]+'%'};return _0x5828bd;})});}_0x4f3ad1=_[_0x52af('0x52')]({},_0x4f3ad1,_0x28ca8d[_0x52af('0x53')]);return db[_0x52af('0x6a')]['count']({'where':_0x4f3ad1['where']})['then'](function(_0xfe1ef0){_0x3ef7f2['count']=_0xfe1ef0;if(_0x28ca8d['query']['includeAll']){_0x4f3ad1[_0x52af('0x5b')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4f3ad1);})[_0x52af('0x21')](function(_0x228f8b){_0x3ef7f2[_0x52af('0x54')]=_0x228f8b;return _0x3ef7f2;});}})[_0x52af('0x21')](respondWithFilteredResult(_0x449006,_0x4f3ad1))[_0x52af('0x55')](handleError(_0x449006,null));};exports[_0x52af('0x6c')]=function(_0x33c45d,_0x5da70a,_0x3f449f){return db[_0x52af('0x42')][_0x52af('0x5c')]({'where':{'id':_0x33c45d[_0x52af('0x57')]['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x5da70a,null))[_0x52af('0x21')](function(_0x14b00c){if(_0x14b00c){return _0x14b00c['removeAnswers'](_0x33c45d[_0x52af('0x46')]['ids']);}})[_0x52af('0x21')](respondWithStatusCode(_0x5da70a,null))[_0x52af('0x55')](handleError(_0x5da70a,null));};exports[_0x52af('0x62')]=function(_0x28368f,_0x3587f8){var _0xe1fc79={'name':_0x28368f['body'][_0x52af('0x3a')],'key':_0x28368f['body'][_0x52af('0x45')],'email':_0x28368f[_0x52af('0x5d')][_0x52af('0x6d')],'ListId':_0x28368f[_0x52af('0x5d')][_0x52af('0x6e')],'active':!_[_0x52af('0x6f')](_0x28368f[_0x52af('0x5d')][_0x52af('0x70')])?_0x28368f[_0x52af('0x5d')][_0x52af('0x70')]:!![],'description':_0x28368f[_0x52af('0x5d')][_0x52af('0x71')]||null,'Imap':{},'Smtp':{}};if(_[_0x52af('0x6f')](_0x28368f[_0x52af('0x5d')][_0x52af('0x72')])){if(_0x28368f[_0x52af('0x5d')][_0x52af('0x73')]){_0xe1fc79[_0x52af('0x3d')][_0x52af('0x74')]=_0xe1fc79[_0x52af('0x5e')][_0x52af('0x74')]=_0x28368f['body']['cuser'];_0xe1fc79[_0x52af('0x3d')][_0x52af('0x75')]=_0xe1fc79[_0x52af('0x5e')][_0x52af('0x76')]=_0x28368f[_0x52af('0x5d')][_0x52af('0x77')];}else{_0xe1fc79[_0x52af('0x3d')][_0x52af('0x78')]=_0xe1fc79[_0x52af('0x5e')][_0x52af('0x78')]=![];}_0xe1fc79[_0x52af('0x3d')]['host']=_0x28368f[_0x52af('0x5d')]['Imap']['host'];_0xe1fc79[_0x52af('0x3d')][_0x52af('0x79')]=_0x28368f['body'][_0x52af('0x3d')][_0x52af('0x79')];_0xe1fc79['Smtp']['host']=_0x28368f[_0x52af('0x5d')][_0x52af('0x5e')][_0x52af('0x7a')];_0xe1fc79[_0x52af('0x5e')][_0x52af('0x79')]=_0x28368f[_0x52af('0x5d')][_0x52af('0x5e')][_0x52af('0x79')];}else{_0xe1fc79[_0x52af('0x3d')][_0x52af('0x7b')]=_0xe1fc79[_0x52af('0x5e')][_0x52af('0x7b')]=_0x28368f[_0x52af('0x5d')][_0x52af('0x72')];_0xe1fc79[_0x52af('0x3d')][_0x52af('0x74')]=_0xe1fc79[_0x52af('0x5e')]['user']=_0x28368f[_0x52af('0x5d')]['cuser'];_0xe1fc79[_0x52af('0x3d')][_0x52af('0x75')]=_0xe1fc79[_0x52af('0x5e')][_0x52af('0x76')]=_0x28368f[_0x52af('0x5d')]['cpassword'];}return db[_0x52af('0x42')][_0x52af('0x62')](_0xe1fc79,{'include':[{'model':db['MailServerOut'],'as':_0x52af('0x5e')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x52af('0x21')](function(_0x41d397){var _0x1d819a=_0x28368f[_0x52af('0x74')][_0x52af('0x37')]({'plain':!![]});if(!_0x1d819a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d819a[_0x52af('0x7c')]===_0x52af('0x74')){var _0x24ace7=_0x41d397[_0x52af('0x37')]({'plain':!![]});return db[_0x52af('0x7d')][_0x52af('0x5c')]({'where':{'name':_0x52af('0x38'),'userProfileId':_0x1d819a['userProfileId']},'raw':!![]})[_0x52af('0x21')](function(_0x1233f9){if(_0x1233f9&&_0x1233f9[_0x52af('0x7e')]===0x0){return db[_0x52af('0x39')][_0x52af('0x62')]({'name':_0x24ace7[_0x52af('0x3a')],'resourceId':_0x24ace7['id'],'type':_0x1233f9[_0x52af('0x3a')],'sectionId':_0x1233f9['id']},{})[_0x52af('0x21')](function(){return _0x41d397;});}else{return _0x41d397;}})[_0x52af('0x55')](function(_0x26ea2a){logger[_0x52af('0x25')](_0x52af('0x7f'),_0x26ea2a);throw _0x26ea2a;});}return _0x41d397;})[_0x52af('0x21')](respondWithResult(_0x3587f8,0xc9))['catch'](handleError(_0x3587f8,null));};exports[_0x52af('0x80')]=function(_0x5746c3,_0x1ee732,_0x422df9){return db[_0x52af('0x42')]['findOne']({'where':{'id':_0x5746c3[_0x52af('0x57')]['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x1ee732,null))[_0x52af('0x21')](function(_0x3670cb){if(_0x3670cb){return _0x3670cb[_0x52af('0x80')]();}return null;})[_0x52af('0x21')](respondWithResult(_0x1ee732,null))[_0x52af('0x55')](handleError(_0x1ee732,null));};exports['addImap']=function(_0xfd22bf,_0x2401fe,_0x1817c7){if(_0xfd22bf['body']['id']){delete _0xfd22bf[_0x52af('0x5d')]['id'];}return db[_0x52af('0x42')][_0x52af('0x5c')]({'where':{'id':_0xfd22bf[_0x52af('0x57')]['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x2401fe,null))['then'](function(_0x147e8d){if(_0x147e8d){_0xfd22bf[_0x52af('0x5d')][_0x52af('0x60')]=_0x147e8d['id'];return db[_0x52af('0x3c')][_0x52af('0x62')](_0xfd22bf[_0x52af('0x5d')]);}})['then'](respondWithResult(_0x2401fe,null))[_0x52af('0x55')](handleError(_0x2401fe,null));};exports[_0x52af('0x81')]=function(_0x1fc75d,_0x5847f6,_0xc5df2b){return db[_0x52af('0x42')][_0x52af('0x64')]({'where':{'id':_0x1fc75d[_0x52af('0x57')]['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x5847f6,null))[_0x52af('0x21')](function(_0x24ec76){if(_0x24ec76){return _0x24ec76[_0x52af('0x82')](null);}return null;})['then'](respondWithStatusCode(_0x5847f6,null))[_0x52af('0x55')](handleError(_0x5847f6,null));};exports[_0x52af('0x83')]=function(_0x2456cb,_0x179e86,_0xe63e0e){return db['MailAccount'][_0x52af('0x64')]({'where':{'id':_0x2456cb[_0x52af('0x57')]['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x179e86,null))[_0x52af('0x21')](function(_0x28470c){if(_0x28470c){return _0x28470c['getSmtp']();}return null;})['then'](respondWithResult(_0x179e86,null))[_0x52af('0x55')](handleError(_0x179e86,null));};exports['addSmtp']=function(_0x256697,_0x5be1b6,_0x28672d){if(_0x256697[_0x52af('0x5d')]['id']){delete _0x256697[_0x52af('0x5d')]['id'];}return db[_0x52af('0x42')][_0x52af('0x5c')]({'where':{'id':_0x256697['params']['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x5be1b6,null))[_0x52af('0x21')](function(_0x467102){if(_0x467102){_0x256697['body'][_0x52af('0x60')]=_0x467102['id'];return db[_0x52af('0x3e')]['create'](_0x256697['body']);}})[_0x52af('0x21')](respondWithResult(_0x5be1b6,null))['catch'](handleError(_0x5be1b6,null));};exports[_0x52af('0x84')]=function(_0x342578,_0x1f2565,_0x529442){return db[_0x52af('0x42')][_0x52af('0x64')]({'where':{'id':_0x342578[_0x52af('0x57')]['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x1f2565,null))[_0x52af('0x21')](function(_0x117773){if(_0x117773){return _0x117773[_0x52af('0x85')](null);}return null;})[_0x52af('0x21')](respondWithStatusCode(_0x1f2565,null))[_0x52af('0x55')](handleError(_0x1f2565,null));};exports[_0x52af('0x86')]=function(_0x3af174,_0x1e34a9,_0x2207f2){return db[_0x52af('0x87')]['find']({'where':{'id':_0x3af174['params']['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x1e34a9,null))[_0x52af('0x21')](function(_0x52b70a){if(_0x52b70a){return _0x52b70a[_0x52af('0x86')](_0x3af174[_0x52af('0x5d')]['ids'],_[_0x52af('0x88')](_0x3af174['body'],[_0x52af('0x89'),'id'])||{});}})['then'](respondWithResult(_0x1e34a9,null))[_0x52af('0x55')](handleError(_0x1e34a9,null));};exports[_0x52af('0x8a')]=function(_0x217f68,_0x301fb7,_0x633e79){var _0x48e00a={'raw':![],'where':{}};var _0x2edce7={};var _0x554307={'count':0x0,'rows':[]};return db[_0x52af('0x42')][_0x52af('0x64')]({'where':{'id':_0x217f68[_0x52af('0x57')]['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x301fb7,null))[_0x52af('0x21')](function(_0x37c181){if(_0x37c181){_0x2edce7['model']=_['keys'](db[_0x52af('0x87')][_0x52af('0x59')]);_0x2edce7[_0x52af('0x46')]=_['keys'](_0x217f68[_0x52af('0x46')]);_0x2edce7[_0x52af('0x47')]=_[_0x52af('0x48')](_0x2edce7['model'],_0x2edce7[_0x52af('0x46')]);_0x48e00a['attributes']=_['intersection'](_0x2edce7[_0x52af('0x49')],qs[_0x52af('0x4b')](_0x217f68['query'][_0x52af('0x4b')]));_0x48e00a[_0x52af('0x4a')]=_0x48e00a[_0x52af('0x4a')][_0x52af('0x65')]?_0x48e00a['attributes']:_0x2edce7[_0x52af('0x49')];if(!_0x217f68['query'][_0x52af('0x4c')](_0x52af('0x66'))){_0x48e00a[_0x52af('0x2e')]=qs[_0x52af('0x2e')](_0x217f68[_0x52af('0x46')]['limit']);_0x48e00a[_0x52af('0x2d')]=qs['offset'](_0x217f68[_0x52af('0x46')][_0x52af('0x2d')]);}_0x48e00a[_0x52af('0x67')]=qs[_0x52af('0x4d')](_0x217f68[_0x52af('0x46')][_0x52af('0x4d')]);_0x48e00a['where']=qs[_0x52af('0x47')](_['pick'](_0x217f68['query'],_0x2edce7['filters']));_0x48e00a[_0x52af('0x50')][_0x52af('0x60')]=_0x37c181['id'];if(_0x217f68[_0x52af('0x46')][_0x52af('0x4f')]){_0x48e00a[_0x52af('0x50')]=_[_0x52af('0x52')](_0x48e00a['where'],{'$or':_[_0x52af('0x41')](_0x48e00a[_0x52af('0x4a')],function(_0x56e18b){var _0x5b925e={};_0x5b925e[_0x56e18b]={'$like':'%'+_0x217f68['query']['filter']+'%'};return _0x5b925e;})});}_0x48e00a=_['merge']({},_0x48e00a,_0x217f68['options']);return db[_0x52af('0x87')][_0x52af('0x2c')]({'where':_0x48e00a['where']})[_0x52af('0x21')](function(_0x20eef0){_0x554307[_0x52af('0x2c')]=_0x20eef0;if(_0x217f68[_0x52af('0x46')][_0x52af('0x5a')]){_0x48e00a[_0x52af('0x5b')]=[{'model':db[_0x52af('0x8b')],'as':_0x52af('0x8c'),'required':![]},{'model':db['User'],'as':_0x52af('0x8d'),'attributes':[_0x52af('0x3a'),_0x52af('0x8e'),_0x52af('0x8f')],'required':![]},{'model':db[_0x52af('0x90')],'as':_0x52af('0x91'),'attributes':['id',_0x52af('0x3a'),'color'],'where':_0x217f68[_0x52af('0x46')][_0x52af('0x92')]?{'id':_0x217f68[_0x52af('0x46')][_0x52af('0x92')]}:undefined,'required':_0x217f68[_0x52af('0x46')]['tag']?!![]:![]}];}return db[_0x52af('0x87')][_0x52af('0x68')](_0x48e00a);})[_0x52af('0x21')](function(_0x2e4f06){_0x554307['rows']=_0x2e4f06;return _0x554307;});}})[_0x52af('0x21')](respondWithFilteredResult(_0x301fb7,_0x48e00a))[_0x52af('0x55')](handleError(_0x301fb7,null));};exports[_0x52af('0x93')]=function(_0xe8929,_0x4a6c11,_0xf06821){return db[_0x52af('0x42')]['findOne']({'where':{'id':_0xe8929[_0x52af('0x57')]['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x4a6c11,null))['then'](function(_0x5b76fb){if(_0x5b76fb){return db['sequelize'][_0x52af('0x94')](function(_0x3cac30){return db[_0x52af('0x95')]['destroy']({'where':{'MailAccountId':_0xe8929[_0x52af('0x57')]['id']},'transaction':_0x3cac30})[_0x52af('0x21')](function(_0x3c7ddc){var _0x124d8c=_[_0x52af('0x41')](_0xe8929[_0x52af('0x5d')],function(_0x17566b){_0x17566b['MailAccountId']=_0xe8929['params']['id'];return _0x17566b;});return db[_0x52af('0x95')]['bulkCreate'](_0x124d8c,{'transaction':_0x3cac30});});})[_0x52af('0x21')](function(){return db['MailApplication'][_0x52af('0x96')]({'where':{'MailAccountId':_0xe8929['params']['id']},'order':'priority'});});}})[_0x52af('0x21')](respondWithResult(_0x4a6c11,null))[_0x52af('0x55')](handleError(_0x4a6c11,null));};exports[_0x52af('0x97')]=function(_0xa9e96e,_0x5e1dac,_0x1e2fae){var _0x16d4b6={};var _0x26e946={};var _0x54820f;var _0x2b620e;return db['MailAccount']['findOne']({'where':{'id':_0xa9e96e[_0x52af('0x57')]['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x5e1dac,null))[_0x52af('0x21')](function(_0x32e664){if(_0x32e664){_0x54820f=_0x32e664;_0x26e946[_0x52af('0x49')]=_[_0x52af('0x58')](db[_0x52af('0x95')][_0x52af('0x59')]);_0x26e946[_0x52af('0x46')]=_[_0x52af('0x58')](_0xa9e96e[_0x52af('0x46')]);_0x26e946[_0x52af('0x47')]=_['intersection'](_0x26e946[_0x52af('0x49')],_0x26e946[_0x52af('0x46')]);_0x16d4b6[_0x52af('0x4a')]=_['intersection'](_0x26e946['model'],qs['fields'](_0xa9e96e['query'][_0x52af('0x4b')]));_0x16d4b6[_0x52af('0x4a')]=_0x16d4b6['attributes'][_0x52af('0x65')]?_0x16d4b6['attributes']:_0x26e946[_0x52af('0x49')];_0x16d4b6[_0x52af('0x67')]=qs[_0x52af('0x4d')](_0xa9e96e[_0x52af('0x46')][_0x52af('0x4d')]);_0x16d4b6[_0x52af('0x50')]=qs[_0x52af('0x47')](_[_0x52af('0x4e')](_0xa9e96e[_0x52af('0x46')],_0x26e946[_0x52af('0x47')]));if(_0xa9e96e[_0x52af('0x46')][_0x52af('0x4f')]){_0x16d4b6['where']=_[_0x52af('0x52')](_0x16d4b6[_0x52af('0x50')],{'$or':_[_0x52af('0x41')](_0x16d4b6['attributes'],function(_0x2e3cc4){var _0x1fd736={};_0x1fd736[_0x2e3cc4]={'$like':'%'+_0xa9e96e['query'][_0x52af('0x4f')]+'%'};return _0x1fd736;})});}_0x16d4b6=_[_0x52af('0x52')]({},_0x16d4b6,_0xa9e96e[_0x52af('0x53')]);return _0x54820f[_0x52af('0x97')](_0x16d4b6);}})[_0x52af('0x21')](function(_0x41b031){if(_0x41b031){_0x2b620e=_0x41b031['length'];if(!_0xa9e96e[_0x52af('0x46')][_0x52af('0x4c')](_0x52af('0x66'))){_0x16d4b6[_0x52af('0x2e')]=qs[_0x52af('0x2e')](_0xa9e96e[_0x52af('0x46')][_0x52af('0x2e')]);_0x16d4b6['offset']=qs[_0x52af('0x2d')](_0xa9e96e[_0x52af('0x46')][_0x52af('0x2d')]);}return _0x54820f['getApplications'](_0x16d4b6);}})['then'](function(_0x1ccb79){if(_0x1ccb79){return _0x1ccb79?{'count':_0x2b620e,'rows':_0x1ccb79}:null;}})[_0x52af('0x21')](respondWithResult(_0x5e1dac,null))['catch'](handleError(_0x5e1dac,null));};exports[_0x52af('0x98')]=function(_0x48cc8d,_0x52378b,_0x3834e3){var _0x2bac57={'raw':!![],'where':{}};var _0x4d5866={};var _0x4f3ebb={'count':0x0,'rows':[]};return db[_0x52af('0x42')]['findOne']({'where':{'id':_0x48cc8d[_0x52af('0x57')]['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x52378b,null))[_0x52af('0x21')](function(_0x375152){if(_0x375152){_0x4d5866[_0x52af('0x49')]=_[_0x52af('0x58')](db[_0x52af('0x99')]['rawAttributes']);_0x4d5866['query']=_[_0x52af('0x58')](_0x48cc8d[_0x52af('0x46')]);_0x4d5866['filters']=_[_0x52af('0x48')](_0x4d5866[_0x52af('0x49')],_0x4d5866[_0x52af('0x46')]);_0x2bac57[_0x52af('0x4a')]=_['intersection'](_0x4d5866[_0x52af('0x49')],qs[_0x52af('0x4b')](_0x48cc8d[_0x52af('0x46')][_0x52af('0x4b')]));_0x2bac57[_0x52af('0x4a')]=_0x2bac57[_0x52af('0x4a')][_0x52af('0x65')]?_0x2bac57[_0x52af('0x4a')]:_0x4d5866[_0x52af('0x49')];if(!_0x48cc8d[_0x52af('0x46')]['hasOwnProperty']('nolimit')){_0x2bac57[_0x52af('0x2e')]=qs[_0x52af('0x2e')](_0x48cc8d[_0x52af('0x46')][_0x52af('0x2e')]);_0x2bac57[_0x52af('0x2d')]=qs['offset'](_0x48cc8d[_0x52af('0x46')]['offset']);}_0x2bac57[_0x52af('0x67')]=qs[_0x52af('0x4d')](_0x48cc8d[_0x52af('0x46')][_0x52af('0x4d')]);_0x2bac57[_0x52af('0x50')]=qs[_0x52af('0x47')](_['pick'](_0x48cc8d[_0x52af('0x46')],_0x4d5866[_0x52af('0x47')]));_0x2bac57['where'][_0x52af('0x60')]=_0x375152['id'];if(_0x48cc8d[_0x52af('0x46')][_0x52af('0x4f')]){_0x2bac57[_0x52af('0x50')]=_[_0x52af('0x52')](_0x2bac57['where'],{'$or':_[_0x52af('0x41')](_0x2bac57[_0x52af('0x4a')],function(_0x4386d4){var _0x2c6394={};_0x2c6394[_0x4386d4]={'$like':'%'+_0x48cc8d[_0x52af('0x46')][_0x52af('0x4f')]+'%'};return _0x2c6394;})});}if(_0x48cc8d[_0x52af('0x46')][_0x52af('0x9a')]){var _0x25694c=_0x48cc8d[_0x52af('0x46')]['$gte']['split'](',');var _0x1d1145={};_0x1d1145[_0x25694c[0x0]]={'$gte':moment(_0x25694c[0x1])[_0x52af('0x9b')](_0x52af('0x9c'))};_0x2bac57[_0x52af('0x50')]=_[_0x52af('0x52')](_0x2bac57[_0x52af('0x50')],_0x1d1145);}_0x2bac57=_[_0x52af('0x52')]({},_0x2bac57,_0x48cc8d[_0x52af('0x53')]);return db[_0x52af('0x99')][_0x52af('0x2c')]({'where':_0x2bac57[_0x52af('0x50')]})[_0x52af('0x21')](function(_0xdb95ba){_0x4f3ebb[_0x52af('0x2c')]=_0xdb95ba;if(_0x48cc8d[_0x52af('0x46')][_0x52af('0x5a')]){_0x2bac57[_0x52af('0x5b')]=[{'all':!![]}];}return db[_0x52af('0x99')][_0x52af('0x68')](_0x2bac57);})[_0x52af('0x21')](function(_0x2f08ce){if(_0x48cc8d[_0x52af('0x46')][_0x52af('0x9d')]===_0x52af('0x9e')){for(var _0x1b3c17=0x0;_0x1b3c17<_0x2f08ce['length'];_0x1b3c17++){_0x2f08ce[_0x1b3c17][_0x52af('0x5d')]=juice(_0x2f08ce[_0x1b3c17]['body']);}}_0x4f3ebb['rows']=_0x2f08ce;return _0x4f3ebb;});}})['then'](respondWithFilteredResult(_0x52378b,_0x2bac57))[_0x52af('0x55')](handleError(_0x52378b,null));};exports[_0x52af('0x9f')]=function(_0x8b6534,_0x1beda7,_0x452b1b){var _0x514ac1,_0x27023d={},_0x4d9788;if(_0x8b6534[_0x52af('0x5d')]['to']){_0x4d9788=_0x8b6534['body']['to']['split'](',')[0x0];}return db[_0x52af('0x42')][_0x52af('0x5c')]({'where':{'id':_0x8b6534['params']['id']},'include':[{'model':db[_0x52af('0xa0')],'as':_0x52af('0xa1'),'include':[{'model':db[_0x52af('0x8b')],'as':_0x52af('0xa2'),'where':{'email':_0x4d9788},'limit':0x1,'order':[[_0x52af('0xa3'),_0x52af('0xa4')]]}]},{'model':db[_0x52af('0x3e')],'as':_0x52af('0x5e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x1beda7,null))['then'](function(_0x1456ef){if(_0x1456ef){_0x514ac1=_0x1456ef;if(_0x1456ef[_0x52af('0x5e')]){if(_[_0x52af('0x6f')](_0x8b6534[_0x52af('0x5d')][_0x52af('0xa5')])){_0x8b6534[_0x52af('0x5d')]['from']=util[_0x52af('0x9b')](_0x52af('0xa6'),_0x1456ef[_0x52af('0x3a')],_0x1456ef[_0x52af('0x6d')]||_0x1456ef['Smtp']['user']);}if(_0x8b6534[_0x52af('0x5d')]['attachments']&&_0x8b6534[_0x52af('0x5d')]['attachments'][_0x52af('0x65')]){for(var _0x566832=0x0;_0x566832<_0x8b6534[_0x52af('0x5d')]['attachments']['length'];_0x566832+=0x1){_0x8b6534[_0x52af('0x5d')][_0x52af('0xa7')][_0x566832]={'filename':_0x8b6534[_0x52af('0x5d')][_0x52af('0xa7')][_0x566832][_0x52af('0x3a')],'path':path[_0x52af('0xa8')](config['root'],_0x52af('0xa9'),_0x8b6534[_0x52af('0x5d')]['attachments'][_0x566832]['basename'])};}}var _0x2c4ec9={'tls':{'rejectUnauthorized':![]}};if(_[_0x52af('0x6f')](_0x1456ef[_0x52af('0x5e')][_0x52af('0x7b')])){if(_0x1456ef[_0x52af('0x5e')][_0x52af('0x78')]){_0x2c4ec9['auth']={'user':_0x1456ef['Smtp'][_0x52af('0x74')],'pass':_0x1456ef[_0x52af('0x5e')][_0x52af('0x76')]};}_0x2c4ec9[_0x52af('0x7a')]=_0x1456ef[_0x52af('0x5e')]['host'];_0x2c4ec9[_0x52af('0x79')]=_0x1456ef['Smtp']['port'];_0x2c4ec9[_0x52af('0xaa')]=_0x1456ef[_0x52af('0x5e')][_0x52af('0xaa')];}else{_0x2c4ec9[_0x52af('0x7b')]=_0x1456ef['Smtp'][_0x52af('0x7b')];_0x2c4ec9['auth']={'user':_0x1456ef[_0x52af('0x5e')][_0x52af('0x74')],'pass':_0x1456ef[_0x52af('0x5e')][_0x52af('0x76')]};}return respondWithRpcPromise(_0x52af('0xab'),_0x52af('0xac'),{'account':_0x2c4ec9,'message':_0x8b6534[_0x52af('0x5d')]});}else{throw new Error(_0x52af('0xad'));}}})['then'](function(_0x42bb3d){if(_0x42bb3d){_0x27023d=_0x42bb3d;if(_0x514ac1[_0x52af('0xa1')]){if(_0x514ac1[_0x52af('0xa1')][_0x52af('0xa2')][_0x52af('0x65')]){return _0x514ac1[_0x52af('0xa1')][_0x52af('0xa2')][0x0];}else{return db[_0x52af('0x8b')][_0x52af('0x62')](_[_0x52af('0x1b')](_0x8b6534['body'],{'firstName':_0x8b6534[_0x52af('0x5d')]['to'],'email':_0x8b6534[_0x52af('0x5d')]['to'],'phone':_0x8b6534[_0x52af('0x5d')]['to'],'ListId':_0x514ac1['ListId']}));}}else{throw new Error('List\x20not\x20found');}}})[_0x52af('0x21')](function(_0x5bc168){if(_0x5bc168){var _0x58c946={'UserId':_0x8b6534['user']['id'],'ContactId':_0x5bc168['id'],'MailAccountId':_0x514ac1['id'],'inReplyTo':_0x27023d[_0x52af('0xae')],'to':_0x8b6534[_0x52af('0x5d')][_0x52af('0xa5')],'cc':_0x8b6534[_0x52af('0x5d')]['cc'],'subject':_0x8b6534['body'][_0x52af('0xaf')],'attach':_0x8b6534[_0x52af('0x5d')][_0x52af('0xb0')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x52af('0x9b')](_0x52af('0x9c')),'lastMsgDirection':_0x52af('0xb1'),'lastMsgBody':_0x8b6534[_0x52af('0x5d')][_0x52af('0x5d')],'Messages':[_[_0x52af('0x52')](_0x8b6534['body'],{'messageId':_0x27023d[_0x52af('0xae')],'sentAt':moment()[_0x52af('0x9b')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x514ac1['id'],'UserId':_0x8b6534[_0x52af('0x74')]['id'],'ContactId':_0x5bc168['id']})]};if(_0x8b6534[_0x52af('0x5d')][_0x52af('0xb2')]){_0x58c946=_[_0x52af('0x52')](_0x58c946,_0x8b6534[_0x52af('0x5d')][_0x52af('0xb2')]);}return db[_0x52af('0x87')][_0x52af('0x62')](_0x58c946,{'include':[{'model':db['MailMessage'],'as':_0x52af('0xb3')}]});}})['then'](respondWithResult(_0x1beda7,null))[_0x52af('0x55')](handleError(_0x1beda7,null));};exports[_0x52af('0xb4')]=function(_0x1eea10,_0x4c3281,_0xb1732){return db[_0x52af('0x42')][_0x52af('0x5c')]({'where':{'id':_0x1eea10[_0x52af('0x57')]['id']},'include':[{'model':db[_0x52af('0x3e')],'as':_0x52af('0x5e'),'raw':!![]}]})[_0x52af('0x21')](handleEntityNotFound(_0x4c3281,null))['then'](function(_0x3dc73f){if(_0x3dc73f&&_0x3dc73f[_0x52af('0x5e')]){var _0x3062e4={'id':_0x3dc73f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3dc73f['Smtp']['service']){_0x3062e4[_0x52af('0x7b')]=_0x3dc73f[_0x52af('0x5e')][_0x52af('0x7b')];}else{_0x3062e4['host']=_0x3dc73f['Smtp'][_0x52af('0x7a')];_0x3062e4['port']=_0x3dc73f[_0x52af('0x5e')][_0x52af('0x79')];_0x3062e4[_0x52af('0xaa')]=_0x3dc73f[_0x52af('0x5e')]['secure'];}if(_0x3dc73f['Smtp'][_0x52af('0x78')]){_0x3062e4[_0x52af('0xb5')]={'user':_0x3dc73f[_0x52af('0x5e')][_0x52af('0x74')],'pass':_0x3dc73f[_0x52af('0x5e')][_0x52af('0x76')]};}return respondWithRpcPromise('VerifySmtp',_0x52af('0xb4'),{'account':_0x3062e4});}})[_0x52af('0x21')](respondWithResult(_0x4c3281,null))[_0x52af('0x55')](handleError(_0x4c3281,null));};exports[_0x52af('0x36')]=function(_0x5e384f,_0x283402){return db[_0x52af('0x42')]['find']({'where':{'id':_0x5e384f[_0x52af('0x57')]['id']}})['then'](handleEntityNotFound(_0x283402,null))[_0x52af('0x21')](function(_0x109e05){if(_0x109e05&&_0x109e05[_0x52af('0x7b')]){throw new db[(_0x52af('0xb6'))][(_0x52af('0xb7'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x109e05;})[_0x52af('0x21')](removeEntity(_0x283402,null))[_0x52af('0x55')](handleError(_0x283402,null));};exports[_0x52af('0xb8')]=function(_0x3f87cc,_0x1aab30,_0x13156a){return db[_0x52af('0x42')][_0x52af('0x5c')]({'where':{'id':_0x3f87cc['params']['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x1aab30,null))[_0x52af('0x21')](function(_0x47b2f6){if(_0x47b2f6){return _0x47b2f6[_0x52af('0xb8')](_0x3f87cc['body'][_0x52af('0x89')],_[_0x52af('0x88')](_0x3f87cc[_0x52af('0x5d')],['ids','id'])||{})[_0x52af('0xb9')](function(_0xac1b13){for(var _0x44996b=0x0;_0x44996b<_0x3f87cc['body'][_0x52af('0x89')][_0x52af('0x65')];_0x44996b+=0x1){socket[_0x52af('0xba')](_0x52af('0xbb'),{'UserId':_0x3f87cc[_0x52af('0x5d')][_0x52af('0x89')][_0x44996b],'MailAccountId':_0x3f87cc['params']['id']});}return _0xac1b13;});}})[_0x52af('0x21')](respondWithResult(_0x1aab30,null))[_0x52af('0x55')](handleError(_0x1aab30,null));};exports[_0x52af('0xbc')]=function(_0xcd6d98,_0x1254d2,_0x177f99){return db[_0x52af('0x42')][_0x52af('0x5c')]({'where':{'id':_0xcd6d98[_0x52af('0x57')]['id']}})[_0x52af('0x21')](handleEntityNotFound(_0x1254d2,null))['then'](function(_0x472fad){if(_0x472fad){return _0x472fad[_0x52af('0xbc')](_0xcd6d98['query']['ids'])[_0x52af('0x21')](function(){if(_[_0x52af('0xbd')](_0xcd6d98[_0x52af('0x46')]['ids'])){for(var _0x317383=0x0;_0x317383<_0xcd6d98[_0x52af('0x46')][_0x52af('0x89')]['length'];_0x317383+=0x1){socket['emit'](_0x52af('0xbe'),{'UserId':Number(_0xcd6d98[_0x52af('0x46')]['ids'][_0x317383]),'MailAccountId':Number(_0xcd6d98[_0x52af('0x57')]['id'])});}}else{socket[_0x52af('0xba')](_0x52af('0xbe'),{'UserId':Number(_0xcd6d98[_0x52af('0x46')]['ids']),'MailAccountId':Number(_0xcd6d98[_0x52af('0x57')]['id'])});}});}})[_0x52af('0x21')](respondWithStatusCode(_0x1254d2,null))[_0x52af('0x55')](handleError(_0x1254d2,null));};exports[_0x52af('0xbf')]=function(_0x122370,_0xab07a2,_0x5c1668){var _0x4c5a0c={};var _0x57e008={};var _0x52a783;var _0x2df974;return db[_0x52af('0x42')][_0x52af('0x64')]({'where':{'id':_0x122370[_0x52af('0x57')]['id']}})[_0x52af('0x21')](handleEntityNotFound(_0xab07a2,null))[_0x52af('0x21')](function(_0x3ccf7b){if(_0x3ccf7b){_0x52a783=_0x3ccf7b;_0x57e008[_0x52af('0x49')]=_[_0x52af('0x58')](db[_0x52af('0xc0')][_0x52af('0x59')]);_0x57e008[_0x52af('0x46')]=_[_0x52af('0x58')](_0x122370[_0x52af('0x46')]);_0x57e008['filters']=_['intersection'](_0x57e008[_0x52af('0x49')],_0x57e008[_0x52af('0x46')]);_0x4c5a0c['attributes']=_[_0x52af('0x48')](_0x57e008['model'],qs['fields'](_0x122370[_0x52af('0x46')]['fields']));_0x4c5a0c[_0x52af('0x4a')]=_0x4c5a0c['attributes']['length']?_0x4c5a0c[_0x52af('0x4a')]:_0x57e008[_0x52af('0x49')];_0x4c5a0c[_0x52af('0x67')]=qs[_0x52af('0x4d')](_0x122370[_0x52af('0x46')][_0x52af('0x4d')]);_0x4c5a0c[_0x52af('0x50')]=qs[_0x52af('0x47')](_[_0x52af('0x4e')](_0x122370['query'],_0x57e008[_0x52af('0x47')]));if(_0x122370[_0x52af('0x46')][_0x52af('0x4f')]){_0x4c5a0c[_0x52af('0x50')]=_[_0x52af('0x52')](_0x4c5a0c[_0x52af('0x50')],{'$or':_[_0x52af('0x41')](_0x4c5a0c[_0x52af('0x4a')],function(_0x5634fc){var _0x7b699b={};_0x7b699b[_0x5634fc]={'$like':'%'+_0x122370['query'][_0x52af('0x4f')]+'%'};return _0x7b699b;})});}_0x4c5a0c=_[_0x52af('0x52')]({},_0x4c5a0c,_0x122370[_0x52af('0x53')]);return _0x52a783[_0x52af('0xbf')](_0x4c5a0c);}})[_0x52af('0x21')](function(_0x3fffb2){if(_0x3fffb2){_0x2df974=_0x3fffb2[_0x52af('0x65')];if(!_0x122370[_0x52af('0x46')][_0x52af('0x4c')]('nolimit')){_0x4c5a0c['limit']=qs['limit'](_0x122370[_0x52af('0x46')][_0x52af('0x2e')]);_0x4c5a0c[_0x52af('0x2d')]=qs[_0x52af('0x2d')](_0x122370[_0x52af('0x46')][_0x52af('0x2d')]);}return _0x52a783[_0x52af('0xbf')](_0x4c5a0c);}})['then'](function(_0x4f2330){if(_0x4f2330){return _0x4f2330?{'count':_0x2df974,'rows':_0x4f2330}:null;}})[_0x52af('0x21')](respondWithResult(_0xab07a2,null))[_0x52af('0x55')](handleError(_0xab07a2,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3156e4f..c2c4800 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 _0x7257=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x255093,_0x4fe4fa){var _0x440166=function(_0x366f54){while(--_0x366f54){_0x255093['push'](_0x255093['shift']());}};_0x440166(++_0x4fe4fa);}(_0x7257,0x1ac));var _0x7725=function(_0x180cd0,_0x386c6e){_0x180cd0=_0x180cd0-0x0;var _0x49fc32=_0x7257[_0x180cd0];return _0x49fc32;};'use strict';var EventEmitter=require(_0x7725('0x0'));var MailAccount=require(_0x7725('0x1'))['db'][_0x7725('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7725('0x3')](0x0);var events={'afterCreate':_0x7725('0x4'),'afterUpdate':_0x7725('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3ca6c7){return function(_0x206143,_0x18f64f,_0x3aa8f6){MailAccountEvents[_0x7725('0x6')](_0x3ca6c7+':'+_0x206143['id'],_0x206143);MailAccountEvents['emit'](_0x3ca6c7,_0x206143);_0x3aa8f6(null);};}for(var e in events){if(events[_0x7725('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x7725('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xc95c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x420c82,_0x4639d9){var _0xd16d1e=function(_0xea9eb9){while(--_0xea9eb9){_0x420c82['push'](_0x420c82['shift']());}};_0xd16d1e(++_0x4639d9);}(_0xc95c,0x9c));var _0xcc95=function(_0x567960,_0x228a6a){_0x567960=_0x567960-0x0;var _0x309362=_0xc95c[_0x567960];return _0x309362;};'use strict';var EventEmitter=require(_0xcc95('0x0'));var MailAccount=require(_0xcc95('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xcc95('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcc95('0x3'),'afterDestroy':'remove'};function emitEvent(_0xa941a){return function(_0x359683,_0x4e7310,_0x58610a){MailAccountEvents[_0xcc95('0x4')](_0xa941a+':'+_0x359683['id'],_0x359683);MailAccountEvents[_0xcc95('0x4')](_0xa941a,_0x359683);_0x58610a(null);};}for(var e in events){if(events[_0xcc95('0x5')](e)){var event=events[e];MailAccount[_0xcc95('0x6')](e,emitEvent(event));}}module[_0xcc95('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 79658a1..eef2d32 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 _0xbcf4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','define','MailAccount','mail_accounts'];(function(_0x5017a2,_0x13718b){var _0x4ae179=function(_0x882998){while(--_0x882998){_0x5017a2['push'](_0x5017a2['shift']());}};_0x4ae179(++_0x13718b);}(_0xbcf4,0x1d9));var _0x4bcf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcf4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4bcf('0x0'));var util=require(_0x4bcf('0x1'));var logger=require(_0x4bcf('0x2'))(_0x4bcf('0x3'));var moment=require(_0x4bcf('0x4'));var BPromise=require(_0x4bcf('0x5'));var rp=require(_0x4bcf('0x6'));var fs=require('fs');var path=require(_0x4bcf('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module['exports']=function(_0xc55383,_0x42f53e){return _0xc55383[_0x4bcf('0x8')](_0x4bcf('0x9'),attributes,{'tableName':_0x4bcf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f08=['./mailAccount.attributes','define','MailAccount','mail_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1d9163,_0x79567d){var _0xb42197=function(_0x3818e8){while(--_0x3818e8){_0x1d9163['push'](_0x1d9163['shift']());}};_0xb42197(++_0x79567d);}(_0x6f08,0x197));var _0x86f0=function(_0x2b2564,_0x1e1124){_0x2b2564=_0x2b2564-0x0;var _0xa97e01=_0x6f08[_0x2b2564];return _0xa97e01;};'use strict';var _=require(_0x86f0('0x0'));var util=require(_0x86f0('0x1'));var logger=require(_0x86f0('0x2'))(_0x86f0('0x3'));var moment=require(_0x86f0('0x4'));var BPromise=require('bluebird');var rp=require(_0x86f0('0x5'));var fs=require('fs');var path=require(_0x86f0('0x6'));var rimraf=require(_0x86f0('0x7'));var config=require(_0x86f0('0x8'));var attributes=require(_0x86f0('0x9'));module['exports']=function(_0x54fb7e,_0x19edc7){return _0x54fb7e[_0x86f0('0xa')](_0x86f0('0xb'),attributes,{'tableName':_0x86f0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 83553cf..62f47ff 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 _0x63b8=['length','from','create','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Contact\x20not\x20found','spread','update','interaction','created','MailMessage','attachments','originTo','originCc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','randomstring','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','MailApplication','MailServerOut','Smtp','get','account','omit','Applications','orderBy','priority','asc','autoclose','applications','push','*,*,*,*'];(function(_0x47c46e,_0x23a296){var _0x3c0d69=function(_0x4e869e){while(--_0x4e869e){_0x47c46e['push'](_0x47c46e['shift']());}};_0x3c0d69(++_0x23a296);}(_0x63b8,0x1bc));var _0x863b=function(_0x446ad0,_0xe5aa2){_0x446ad0=_0x446ad0-0x0;var _0x49e596=_0x63b8[_0x446ad0];return _0x49e596;};'use strict';var _=require('lodash');var util=require(_0x863b('0x0'));var moment=require(_0x863b('0x1'));var BPromise=require('bluebird');var rs=require(_0x863b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x863b('0x3'));var logger=require(_0x863b('0x4'))(_0x863b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x863b('0x6')]({'port':0x232c});config[_0x863b('0x7')]=_[_0x863b('0x8')](config[_0x863b('0x7')],{'host':_0x863b('0x9'),'port':0x18eb});var socket=require(_0x863b('0xa'))(new Redis(config[_0x863b('0x7')]));require(_0x863b('0xb'))[_0x863b('0xc')](socket);function respondWithRpcPromise(_0x5223b7,_0x4707f0,_0x4fcf22){return new BPromise(function(_0x390921,_0x3b9161){return client['request'](_0x5223b7,_0x4fcf22)[_0x863b('0xd')](function(_0x2f129b){logger[_0x863b('0xe')](_0x863b('0xf'),_0x4707f0,_0x863b('0x10'));logger[_0x863b('0x11')](_0x863b('0x12'),_0x4707f0,_0x863b('0x10'),JSON[_0x863b('0x13')](_0x2f129b));if(_0x2f129b[_0x863b('0x14')]){if(_0x2f129b[_0x863b('0x14')][_0x863b('0x15')]===0x1f4){logger[_0x863b('0x14')]('MailAccount,\x20%s,\x20%s',_0x4707f0,_0x2f129b[_0x863b('0x14')]['message']);return _0x3b9161(_0x2f129b['error']['message']);}logger[_0x863b('0x14')](_0x863b('0xf'),_0x4707f0,_0x2f129b[_0x863b('0x14')]['message']);return _0x390921(_0x2f129b[_0x863b('0x14')][_0x863b('0x16')]);}else{logger[_0x863b('0xe')](_0x863b('0xf'),_0x4707f0,_0x863b('0x10'));_0x390921(_0x2f129b[_0x863b('0x17')][_0x863b('0x16')]);}})[_0x863b('0x18')](function(_0x1aac2b){logger['error']('MailAccount,\x20%s,\x20%s',_0x4707f0,_0x1aac2b);_0x3b9161(_0x1aac2b);});});}exports[_0x863b('0x19')]=function(_0x4f6772){var _0x4137d6=this;return new Promise(function(_0x5b2d6b,_0x1d1a4c){return db[_0x863b('0x1a')]['findAll']({'raw':_0x4f6772[_0x863b('0x1b')]?_0x4f6772[_0x863b('0x1b')][_0x863b('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f6772[_0x863b('0x1b')]?_0x4f6772[_0x863b('0x1b')][_0x863b('0x1d')]||null:null,'attributes':_0x4f6772[_0x863b('0x1b')]?_0x4f6772['options'][_0x863b('0x1e')]||null:null,'limit':_0x4f6772[_0x863b('0x1b')]?_0x4f6772['options'][_0x863b('0x1f')]||null:null,'include':_0x4f6772[_0x863b('0x1b')]?_0x4f6772[_0x863b('0x1b')][_0x863b('0x20')]?_[_0x863b('0x21')](_0x4f6772[_0x863b('0x1b')][_0x863b('0x20')],function(_0x1bbaa0){return{'model':db[_0x1bbaa0[_0x863b('0x22')]],'as':_0x1bbaa0['as'],'attributes':_0x1bbaa0[_0x863b('0x1e')],'include':_0x1bbaa0[_0x863b('0x20')]?_[_0x863b('0x21')](_0x1bbaa0['include'],function(_0x4c4916){return{'model':db[_0x4c4916[_0x863b('0x22')]],'as':_0x4c4916['as'],'attributes':_0x4c4916['attributes'],'include':_0x4c4916[_0x863b('0x20')]?_['map'](_0x4c4916[_0x863b('0x20')],function(_0x11e4d8){return{'model':db[_0x11e4d8[_0x863b('0x22')]],'as':_0x11e4d8['as'],'attributes':_0x11e4d8[_0x863b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x863b('0xd')](function(_0x522751){logger['info']('GetMailAccount',_0x4f6772);logger[_0x863b('0x11')]('GetMailAccount',_0x4f6772,JSON[_0x863b('0x13')](_0x522751));_0x5b2d6b(_0x522751);})[_0x863b('0x18')](function(_0x3b2c43){logger[_0x863b('0x14')](_0x863b('0x19'),_0x3b2c43['message'],_0x4f6772);_0x1d1a4c(_0x4137d6[_0x863b('0x14')](0x1f4,_0x3b2c43[_0x863b('0x16')]));});});};exports[_0x863b('0x23')]=function(_0x295046){var _0x36c8ab=this;return new Promise(function(_0x4328f5,_0x10f7ce){return db[_0x863b('0x1a')][_0x863b('0x24')]({'raw':_0x295046['options']?_0x295046[_0x863b('0x1b')][_0x863b('0x1c')]===undefined?!![]:![]:!![],'where':_0x295046[_0x863b('0x1b')]?_0x295046[_0x863b('0x1b')][_0x863b('0x1d')]||null:null,'attributes':_0x295046[_0x863b('0x1b')]?_0x295046[_0x863b('0x1b')][_0x863b('0x1e')]||null:null,'include':_0x295046[_0x863b('0x1b')]?_0x295046[_0x863b('0x1b')]['include']?_[_0x863b('0x21')](_0x295046[_0x863b('0x1b')][_0x863b('0x20')],function(_0x29ee99){return{'model':db[_0x29ee99[_0x863b('0x22')]],'as':_0x29ee99['as'],'attributes':_0x29ee99[_0x863b('0x1e')],'include':_0x29ee99[_0x863b('0x20')]?_[_0x863b('0x21')](_0x29ee99[_0x863b('0x20')],function(_0x192d0b){return{'model':db[_0x192d0b[_0x863b('0x22')]],'as':_0x192d0b['as'],'attributes':_0x192d0b[_0x863b('0x1e')],'include':_0x192d0b['include']?_['map'](_0x192d0b[_0x863b('0x20')],function(_0xde0f48){return{'model':db[_0xde0f48[_0x863b('0x22')]],'as':_0xde0f48['as'],'attributes':_0xde0f48[_0x863b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x863b('0xd')](function(_0x3843ae){logger[_0x863b('0xe')](_0x863b('0x23'),_0x295046);logger[_0x863b('0x11')](_0x863b('0x23'),_0x295046,JSON[_0x863b('0x13')](_0x3843ae));_0x4328f5(_0x3843ae);})['catch'](function(_0x16c0c3){logger[_0x863b('0x14')](_0x863b('0x23'),_0x16c0c3[_0x863b('0x16')],_0x295046);_0x10f7ce(_0x36c8ab['error'](0x1f4,_0x16c0c3[_0x863b('0x16')]));});});};exports[_0x863b('0x25')]=function(_0x1d389f){var _0x3292bd=this;return new Promise(function(_0x167ab0,_0xe370fc){var _0x47bb8a={'body':_0x1d389f[_0x863b('0x26')],'channel':_0x863b('0x27')};var _0x3a2ef9=_[_0x863b('0x28')](_[_0x863b('0x29')](db[_0x863b('0x2a')][_0x863b('0x2b')]),['createdAt',_0x863b('0x2c'),_0x863b('0x2d'),_0x863b('0x2e')]);var _0x3f47cd=![];if(_0x1d389f[_0x863b('0x26')]['id']){delete _0x1d389f[_0x863b('0x26')]['id'];}if(_[_0x863b('0x2f')](_0x1d389f[_0x863b('0x26')]['from'])){return _0xe370fc(_0x3292bd[_0x863b('0x14')](0x1f4,_0x863b('0x30')));}if(_[_0x863b('0x2f')](_0x1d389f['body'][_0x863b('0x26')])||_0x1d389f[_0x863b('0x26')]['body']===''){return _0xe370fc(_0x3292bd['error'](0x1f4,_0x863b('0x31')));}if(_[_0x863b('0x2f')](_0x1d389f[_0x863b('0x26')][_0x863b('0x32')])){return _0xe370fc(_0x3292bd[_0x863b('0x14')](0x1f4,_0x863b('0x33')+_0x3a2ef9));}if(!_[_0x863b('0x34')](_0x3a2ef9,_0x1d389f[_0x863b('0x26')][_0x863b('0x32')])){return _0xe370fc(_0x3292bd['error'](0x1f4,_0x863b('0x35')+_0x3a2ef9));}var _0x41f546={};_0x41f546[_0x1d389f[_0x863b('0x26')]['mapKey']]=_0x1d389f[_0x863b('0x26')]['from'];return db[_0x863b('0x1a')]['find']({'where':{'id':_0x1d389f['account']['id']},'include':[{'model':db[_0x863b('0x36')],'as':_0x863b('0x37'),'include':[{'model':db[_0x863b('0x2a')],'as':_0x863b('0x38'),'where':_0x41f546,'limit':0x1,'order':[[_0x863b('0x2c'),'DESC']]}]},{'model':db[_0x863b('0x39')],'as':'Applications'},{'model':db[_0x863b('0x3a')],'as':_0x863b('0x3b')}]})['then'](function(_0x334773){if(_0x334773&&_0x334773[_0x863b('0x37')]){var _0x3dbcdc=_0x334773[_0x863b('0x3c')]({'plain':!![]});_0x47bb8a[_0x863b('0x3d')]=_[_0x863b('0x3e')](_0x3dbcdc,[_0x863b('0x3f'),_0x863b('0x37')]);_0x47bb8a['applications']=_0x3dbcdc[_0x863b('0x3f')];_0x47bb8a['list']=_0x3dbcdc[_0x863b('0x37')];_0x47bb8a['applications']=_[_0x863b('0x40')](_0x47bb8a['applications'],[_0x863b('0x41')],[_0x863b('0x42')]);if(_0x47bb8a[_0x863b('0x3d')]&&_0x47bb8a['account'][_0x863b('0x43')]){_0x47bb8a[_0x863b('0x44')][_0x863b('0x45')]({'id':0x0,'priority':_0x47bb8a['applications']['length']+0x1,'app':'close','appdata':'autoclose','interval':_0x863b('0x46')});}if(_0x47bb8a[_0x863b('0x3d')][_0x863b('0x3f')]){delete _0x47bb8a[_0x863b('0x3d')][_0x863b('0x3f')];}if(_0x47bb8a[_0x863b('0x3d')][_0x863b('0x37')]){delete _0x47bb8a[_0x863b('0x3d')][_0x863b('0x37')];}if(_0x3dbcdc[_0x863b('0x37')][_0x863b('0x38')][_0x863b('0x47')]){return _0x3dbcdc[_0x863b('0x37')][_0x863b('0x38')][0x0];}var _0x4f60de=_[_0x863b('0x8')](_0x1d389f[_0x863b('0x26')],{'firstName':_0x1d389f[_0x863b('0x26')][_0x863b('0x48')],'ListId':_0x3dbcdc[_0x863b('0x2e')]});_0x4f60de[_0x1d389f['body']['mapKey']]=_0x1d389f[_0x863b('0x26')][_0x863b('0x48')];return db['CmContact'][_0x863b('0x49')](_0x4f60de);}else{throw new Error('List\x20not\x20found');}})[_0x863b('0xd')](function(_0x1cf4e6){_0x47bb8a[_0x863b('0x4a')]=_0x1cf4e6;if(_0x1cf4e6){if(!_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4b')]){_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4b')]=rs['generate']()+'\x20'+_0x1d389f['body'][_0x863b('0x16')][_0x863b('0x48')];}var _0x3a6531={'ContactId':_0x1cf4e6['id'],'MailAccountId':_0x1d389f[_0x863b('0x3d')]['id'],'inReplyTo':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4b')],'to':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x48')],'cc':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')]['cc'],'subject':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4c')],'attach':_0x1d389f['body'][_0x863b('0x16')][_0x863b('0x4d')],'lastMsgAt':moment()[_0x863b('0x4e')](_0x863b('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x1d389f[_0x863b('0x26')][_0x863b('0x26')]};return db[_0x863b('0x50')][_0x863b('0x24')]({'where':{'closed':![],'MailAccountId':_0x1d389f[_0x863b('0x3d')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x863b('0x4b')],'where':{'messageId':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')]['inReplyTo']}}]})[_0x863b('0xd')](function(_0x225b93){if(_0x225b93){return[_0x225b93,![]];}return db[_0x863b('0x50')][_0x863b('0x49')](_0x3a6531)[_0x863b('0xd')](function(_0x46e818){return[_0x46e818,!![]];});});}else{throw new Error(_0x863b('0x51'));}})[_0x863b('0x52')](function(_0x2f5e69,_0x1b703e){if(_0x2f5e69){_0x3f47cd=_0x1b703e;if(!_0x1b703e){return _0x2f5e69[_0x863b('0x53')]({'inReplyTo':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4b')],'to':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x48')],'cc':_0x1d389f[_0x863b('0x26')]['message']['cc'],'subject':_0x1d389f[_0x863b('0x26')]['message'][_0x863b('0x4c')],'attach':_0x2f5e69[_0x863b('0x4d')]?_0x2f5e69[_0x863b('0x4d')]:_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4d')],'substatus':null,'substatusAt':moment()[_0x863b('0x4e')](_0x863b('0x4f')),'lastMsgAt':moment()[_0x863b('0x4e')](_0x863b('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x1d389f['body'][_0x863b('0x26')]});}else{return _0x2f5e69;}}})['then'](function(_0x2bd9dd){_0x47bb8a[_0x863b('0x54')]=_0x2bd9dd[_0x863b('0x3c')]({'plain':!![]});_0x47bb8a[_0x863b('0x54')][_0x863b('0x55')]=_0x3f47cd;return db[_0x863b('0x56')]['create']({'body':_0x1d389f['body'][_0x863b('0x26')],'MailAccountId':_0x1d389f[_0x863b('0x3d')]['id'],'MailInteractionId':_0x2bd9dd['id'],'direction':'in','ContactId':_0x47bb8a['contact']['id'],'messageId':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4b')],'from':_0x1d389f['body'][_0x863b('0x16')]['from'],'to':_0x1d389f[_0x863b('0x26')]['message']['to'],'cc':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')]['cc'],'subject':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4c')],'attach':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4d')],'Attachments':_0x1d389f['body'][_0x863b('0x16')][_0x863b('0x57')],'originTo':_0x1d389f['body'][_0x863b('0x16')][_0x863b('0x58')],'originCc':_0x1d389f[_0x863b('0x26')]['message'][_0x863b('0x59')],'bcc':_0x1d389f['body']['message']['bcc'],'ChatWebsiteId':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')]['ChatWebsiteId']||null,'originChannel':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x5a')]||_0x863b('0x5b'),'ChatOfflineMessageId':_0x1d389f[_0x863b('0x26')]['message'][_0x863b('0x5c')]||null},{'include':[{'model':db[_0x863b('0x5d')],'as':_0x863b('0x5e')}]});})['then'](function(_0x13bb23){_0x47bb8a[_0x863b('0x16')]=_0x13bb23;if(_0x47bb8a[_0x863b('0x54')]['UserId']){return db[_0x863b('0x5f')][_0x863b('0x24')]({'attributes':['id',_0x863b('0x60')],'where':{'id':_0x47bb8a[_0x863b('0x54')][_0x863b('0x61')]}})[_0x863b('0xd')](function(_0xd26471){if(_0xd26471){_0x47bb8a[_0x863b('0x44')][_0x863b('0x62')]({'id':0x0,'priority':0x0,'app':_0x863b('0x63'),'appdata':_0xd26471[_0x863b('0x60')]+','+(_0x47bb8a[_0x863b('0x3d')][_0x863b('0x64')]||0xa),'interval':_0x863b('0x46')});}return respondWithRpcPromise(_0x863b('0x65'),_0x863b('0x66'),_0x47bb8a);});}return respondWithRpcPromise(_0x863b('0x65'),_0x863b('0x66'),_0x47bb8a);})[_0x863b('0xd')](function(_0xfb103a){_0x167ab0(_0xfb103a);})[_0x863b('0x18')](function(_0x5e09ea){_0xe370fc(_0x3292bd[_0x863b('0x14')](0x1f4,_0x5e09ea[_0x863b('0x16')]));});});}; \ No newline at end of file +var _0x0abb=['waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailAccount,\x20%s,\x20%s','catch','MailAccount','findAll','options','where','attributes','limit','include','map','model','GetMailAccount','find','raw','ShowMailAccount','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','MailServerOut','Smtp','get','account','Applications','list','applications','orderBy','priority','autoclose','push','length','create','List\x20not\x20found','contact','generate','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','spread','update','interaction','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','UserId','User','name','unshift'];(function(_0x2e96de,_0x7b3fac){var _0x588f95=function(_0x4a5df8){while(--_0x4a5df8){_0x2e96de['push'](_0x2e96de['shift']());}};_0x588f95(++_0x7b3fac);}(_0x0abb,0x1a4));var _0xb0ab=function(_0x2f14bd,_0x15b9bd){_0x2f14bd=_0x2f14bd-0x0;var _0x5e3de8=_0x0abb[_0x2f14bd];return _0x5e3de8;};'use strict';var _=require(_0xb0ab('0x0'));var util=require(_0xb0ab('0x1'));var moment=require(_0xb0ab('0x2'));var BPromise=require(_0xb0ab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb0ab('0x4'));var logger=require(_0xb0ab('0x5'))('rpc');var config=require(_0xb0ab('0x6'));var jayson=require(_0xb0ab('0x7'));var client=jayson[_0xb0ab('0x8')][_0xb0ab('0x9')]({'port':0x232c});config[_0xb0ab('0xa')]=_[_0xb0ab('0xb')](config[_0xb0ab('0xa')],{'host':_0xb0ab('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb0ab('0xa')]));require(_0xb0ab('0xd'))[_0xb0ab('0xe')](socket);function respondWithRpcPromise(_0x34434d,_0x1cf7c7,_0x454590){return new BPromise(function(_0x894bcb,_0x5789b6){return client[_0xb0ab('0xf')](_0x34434d,_0x454590)[_0xb0ab('0x10')](function(_0x143b6b){logger[_0xb0ab('0x11')]('MailAccount,\x20%s,\x20%s',_0x1cf7c7,_0xb0ab('0x12'));logger[_0xb0ab('0x13')](_0xb0ab('0x14'),_0x1cf7c7,_0xb0ab('0x12'),JSON[_0xb0ab('0x15')](_0x143b6b));if(_0x143b6b[_0xb0ab('0x16')]){if(_0x143b6b['error'][_0xb0ab('0x17')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x1cf7c7,_0x143b6b['error'][_0xb0ab('0x18')]);return _0x5789b6(_0x143b6b[_0xb0ab('0x16')][_0xb0ab('0x18')]);}logger[_0xb0ab('0x16')](_0xb0ab('0x19'),_0x1cf7c7,_0x143b6b[_0xb0ab('0x16')][_0xb0ab('0x18')]);return _0x894bcb(_0x143b6b['error']['message']);}else{logger[_0xb0ab('0x11')](_0xb0ab('0x19'),_0x1cf7c7,_0xb0ab('0x12'));_0x894bcb(_0x143b6b['result'][_0xb0ab('0x18')]);}})[_0xb0ab('0x1a')](function(_0x25c904){logger['error'](_0xb0ab('0x19'),_0x1cf7c7,_0x25c904);_0x5789b6(_0x25c904);});});}exports['GetMailAccount']=function(_0x2d4ab2){var _0x36686a=this;return new Promise(function(_0x34ee44,_0x5c3d6b){return db[_0xb0ab('0x1b')][_0xb0ab('0x1c')]({'raw':_0x2d4ab2[_0xb0ab('0x1d')]?_0x2d4ab2[_0xb0ab('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2d4ab2[_0xb0ab('0x1d')]?_0x2d4ab2[_0xb0ab('0x1d')][_0xb0ab('0x1e')]||null:null,'attributes':_0x2d4ab2[_0xb0ab('0x1d')]?_0x2d4ab2[_0xb0ab('0x1d')][_0xb0ab('0x1f')]||null:null,'limit':_0x2d4ab2[_0xb0ab('0x1d')]?_0x2d4ab2[_0xb0ab('0x1d')][_0xb0ab('0x20')]||null:null,'include':_0x2d4ab2[_0xb0ab('0x1d')]?_0x2d4ab2[_0xb0ab('0x1d')][_0xb0ab('0x21')]?_[_0xb0ab('0x22')](_0x2d4ab2['options']['include'],function(_0x5b51b3){return{'model':db[_0x5b51b3[_0xb0ab('0x23')]],'as':_0x5b51b3['as'],'attributes':_0x5b51b3[_0xb0ab('0x1f')],'include':_0x5b51b3[_0xb0ab('0x21')]?_[_0xb0ab('0x22')](_0x5b51b3[_0xb0ab('0x21')],function(_0x5374d8){return{'model':db[_0x5374d8[_0xb0ab('0x23')]],'as':_0x5374d8['as'],'attributes':_0x5374d8[_0xb0ab('0x1f')],'include':_0x5374d8[_0xb0ab('0x21')]?_[_0xb0ab('0x22')](_0x5374d8[_0xb0ab('0x21')],function(_0xe9624e){return{'model':db[_0xe9624e[_0xb0ab('0x23')]],'as':_0xe9624e['as'],'attributes':_0xe9624e[_0xb0ab('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb0ab('0x10')](function(_0xdaf086){logger[_0xb0ab('0x11')]('GetMailAccount',_0x2d4ab2);logger[_0xb0ab('0x13')](_0xb0ab('0x24'),_0x2d4ab2,JSON['stringify'](_0xdaf086));_0x34ee44(_0xdaf086);})[_0xb0ab('0x1a')](function(_0xae59aa){logger[_0xb0ab('0x16')](_0xb0ab('0x24'),_0xae59aa[_0xb0ab('0x18')],_0x2d4ab2);_0x5c3d6b(_0x36686a[_0xb0ab('0x16')](0x1f4,_0xae59aa[_0xb0ab('0x18')]));});});};exports['ShowMailAccount']=function(_0x126150){var _0x36e45e=this;return new Promise(function(_0x462d9c,_0x4c24e8){return db['MailAccount'][_0xb0ab('0x25')]({'raw':_0x126150[_0xb0ab('0x1d')]?_0x126150['options'][_0xb0ab('0x26')]===undefined?!![]:![]:!![],'where':_0x126150[_0xb0ab('0x1d')]?_0x126150['options'][_0xb0ab('0x1e')]||null:null,'attributes':_0x126150[_0xb0ab('0x1d')]?_0x126150[_0xb0ab('0x1d')][_0xb0ab('0x1f')]||null:null,'include':_0x126150[_0xb0ab('0x1d')]?_0x126150[_0xb0ab('0x1d')][_0xb0ab('0x21')]?_[_0xb0ab('0x22')](_0x126150[_0xb0ab('0x1d')][_0xb0ab('0x21')],function(_0x5238a5){return{'model':db[_0x5238a5['model']],'as':_0x5238a5['as'],'attributes':_0x5238a5[_0xb0ab('0x1f')],'include':_0x5238a5[_0xb0ab('0x21')]?_[_0xb0ab('0x22')](_0x5238a5[_0xb0ab('0x21')],function(_0x4ab0e5){return{'model':db[_0x4ab0e5[_0xb0ab('0x23')]],'as':_0x4ab0e5['as'],'attributes':_0x4ab0e5[_0xb0ab('0x1f')],'include':_0x4ab0e5[_0xb0ab('0x21')]?_[_0xb0ab('0x22')](_0x4ab0e5[_0xb0ab('0x21')],function(_0x429405){return{'model':db[_0x429405[_0xb0ab('0x23')]],'as':_0x429405['as'],'attributes':_0x429405[_0xb0ab('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x403751){logger[_0xb0ab('0x11')](_0xb0ab('0x27'),_0x126150);logger[_0xb0ab('0x13')]('ShowMailAccount',_0x126150,JSON[_0xb0ab('0x15')](_0x403751));_0x462d9c(_0x403751);})[_0xb0ab('0x1a')](function(_0x128e43){logger[_0xb0ab('0x16')]('ShowMailAccount',_0x128e43[_0xb0ab('0x18')],_0x126150);_0x4c24e8(_0x36e45e[_0xb0ab('0x16')](0x1f4,_0x128e43[_0xb0ab('0x18')]));});});};exports[_0xb0ab('0x28')]=function(_0x570403){var _0x32070c=this;return new Promise(function(_0x4da7a7,_0x232665){var _0x18db87={'body':_0x570403[_0xb0ab('0x29')],'channel':'mail'};var _0x35c442=_[_0xb0ab('0x2a')](_[_0xb0ab('0x2b')](db[_0xb0ab('0x2c')][_0xb0ab('0x2d')]),[_0xb0ab('0x2e'),_0xb0ab('0x2f'),_0xb0ab('0x30'),_0xb0ab('0x31')]);var _0x3f49ec=![];if(_0x570403['body']['id']){delete _0x570403[_0xb0ab('0x29')]['id'];}if(_[_0xb0ab('0x32')](_0x570403[_0xb0ab('0x29')][_0xb0ab('0x33')])){return _0x232665(_0x32070c[_0xb0ab('0x16')](0x1f4,_0xb0ab('0x34')));}if(_[_0xb0ab('0x32')](_0x570403[_0xb0ab('0x29')][_0xb0ab('0x29')])||_0x570403[_0xb0ab('0x29')][_0xb0ab('0x29')]===''){return _0x232665(_0x32070c['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xb0ab('0x32')](_0x570403[_0xb0ab('0x29')]['mapKey'])){return _0x232665(_0x32070c[_0xb0ab('0x16')](0x1f4,_0xb0ab('0x35')+_0x35c442));}if(!_[_0xb0ab('0x36')](_0x35c442,_0x570403['body'][_0xb0ab('0x37')])){return _0x232665(_0x32070c[_0xb0ab('0x16')](0x1f4,_0xb0ab('0x38')+_0x35c442));}var _0x3f901c={};_0x3f901c[_0x570403[_0xb0ab('0x29')][_0xb0ab('0x37')]]=_0x570403['body'][_0xb0ab('0x33')];return db[_0xb0ab('0x1b')][_0xb0ab('0x25')]({'where':{'id':_0x570403['account']['id']},'include':[{'model':db['CmList'],'as':_0xb0ab('0x39'),'include':[{'model':db[_0xb0ab('0x2c')],'as':_0xb0ab('0x3a'),'where':_0x3f901c,'limit':0x1,'order':[['updatedAt',_0xb0ab('0x3b')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0xb0ab('0x3c')],'as':_0xb0ab('0x3d')}]})[_0xb0ab('0x10')](function(_0x15ab3d){if(_0x15ab3d&&_0x15ab3d[_0xb0ab('0x39')]){var _0x5b1998=_0x15ab3d[_0xb0ab('0x3e')]({'plain':!![]});_0x18db87[_0xb0ab('0x3f')]=_['omit'](_0x5b1998,['Applications','List']);_0x18db87['applications']=_0x5b1998[_0xb0ab('0x40')];_0x18db87[_0xb0ab('0x41')]=_0x5b1998[_0xb0ab('0x39')];_0x18db87[_0xb0ab('0x42')]=_[_0xb0ab('0x43')](_0x18db87[_0xb0ab('0x42')],[_0xb0ab('0x44')],['asc']);if(_0x18db87[_0xb0ab('0x3f')]&&_0x18db87[_0xb0ab('0x3f')][_0xb0ab('0x45')]){_0x18db87[_0xb0ab('0x42')][_0xb0ab('0x46')]({'id':0x0,'priority':_0x18db87[_0xb0ab('0x42')][_0xb0ab('0x47')]+0x1,'app':'close','appdata':'autoclose','interval':'*,*,*,*'});}if(_0x18db87[_0xb0ab('0x3f')][_0xb0ab('0x40')]){delete _0x18db87['account'][_0xb0ab('0x40')];}if(_0x18db87[_0xb0ab('0x3f')][_0xb0ab('0x39')]){delete _0x18db87['account']['List'];}if(_0x5b1998['List']['Contacts'][_0xb0ab('0x47')]){return _0x5b1998[_0xb0ab('0x39')][_0xb0ab('0x3a')][0x0];}var _0x3f2cb2=_[_0xb0ab('0xb')](_0x570403[_0xb0ab('0x29')],{'firstName':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x33')],'ListId':_0x5b1998[_0xb0ab('0x31')]});_0x3f2cb2[_0x570403[_0xb0ab('0x29')][_0xb0ab('0x37')]]=_0x570403[_0xb0ab('0x29')]['from'];return db[_0xb0ab('0x2c')][_0xb0ab('0x48')](_0x3f2cb2);}else{throw new Error(_0xb0ab('0x49'));}})[_0xb0ab('0x10')](function(_0x49e00a){_0x18db87[_0xb0ab('0x4a')]=_0x49e00a;if(_0x49e00a){if(!_0x570403[_0xb0ab('0x29')]['message']['messageId']){_0x570403['body'][_0xb0ab('0x18')]['messageId']=rs[_0xb0ab('0x4b')]()+'\x20'+_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')][_0xb0ab('0x33')];}var _0x1f29a8={'ContactId':_0x49e00a['id'],'MailAccountId':_0x570403[_0xb0ab('0x3f')]['id'],'inReplyTo':_0x570403['body'][_0xb0ab('0x18')][_0xb0ab('0x4c')],'to':_0x570403['body']['message'][_0xb0ab('0x33')],'cc':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')]['cc'],'subject':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')][_0xb0ab('0x4d')],'attach':_0x570403[_0xb0ab('0x29')]['message'][_0xb0ab('0x4e')],'lastMsgAt':moment()[_0xb0ab('0x4f')](_0xb0ab('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x570403['body'][_0xb0ab('0x29')]};return db['MailInteraction'][_0xb0ab('0x25')]({'where':{'closed':![],'MailAccountId':_0x570403['account']['id']},'include':[{'model':db[_0xb0ab('0x51')],'as':_0xb0ab('0x52'),'attributes':[_0xb0ab('0x4c')],'where':{'messageId':_0x570403['body']['message'][_0xb0ab('0x53')]}}]})[_0xb0ab('0x10')](function(_0x3b0dcd){if(_0x3b0dcd){return[_0x3b0dcd,![]];}return db[_0xb0ab('0x54')][_0xb0ab('0x48')](_0x1f29a8)[_0xb0ab('0x10')](function(_0x1d574b){return[_0x1d574b,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb0ab('0x55')](function(_0x52f460,_0x9a8a0){if(_0x52f460){_0x3f49ec=_0x9a8a0;if(!_0x9a8a0){return _0x52f460[_0xb0ab('0x56')]({'inReplyTo':_0x570403['body']['message'][_0xb0ab('0x4c')],'to':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')]['from'],'cc':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')]['cc'],'subject':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')][_0xb0ab('0x4d')],'attach':_0x52f460[_0xb0ab('0x4e')]?_0x52f460[_0xb0ab('0x4e')]:_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')][_0xb0ab('0x4e')],'substatus':null,'substatusAt':moment()[_0xb0ab('0x4f')](_0xb0ab('0x50')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x570403[_0xb0ab('0x29')]['body']});}else{return _0x52f460;}}})['then'](function(_0x319bc8){_0x18db87['interaction']=_0x319bc8[_0xb0ab('0x3e')]({'plain':!![]});_0x18db87[_0xb0ab('0x57')]['created']=_0x3f49ec;return db[_0xb0ab('0x51')][_0xb0ab('0x48')]({'body':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x29')],'MailAccountId':_0x570403[_0xb0ab('0x3f')]['id'],'MailInteractionId':_0x319bc8['id'],'direction':'in','ContactId':_0x18db87[_0xb0ab('0x4a')]['id'],'messageId':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')][_0xb0ab('0x4c')],'from':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')]['from'],'to':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')]['to'],'cc':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')]['cc'],'subject':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')][_0xb0ab('0x4d')],'attach':_0x570403['body'][_0xb0ab('0x18')]['attach'],'Attachments':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')]['attachments'],'originTo':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')][_0xb0ab('0x58')],'originCc':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')][_0xb0ab('0x59')],'bcc':_0x570403[_0xb0ab('0x29')][_0xb0ab('0x18')][_0xb0ab('0x5a')],'ChatWebsiteId':_0x570403[_0xb0ab('0x29')]['message'][_0xb0ab('0x5b')]||null,'originChannel':_0x570403['body'][_0xb0ab('0x18')][_0xb0ab('0x5c')]||_0xb0ab('0x5d'),'ChatOfflineMessageId':_0x570403[_0xb0ab('0x29')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xb0ab('0x5e')],'as':_0xb0ab('0x5f')}]});})[_0xb0ab('0x10')](function(_0x930d6d){_0x18db87[_0xb0ab('0x18')]=_0x930d6d;if(_0x18db87[_0xb0ab('0x57')][_0xb0ab('0x60')]){return db[_0xb0ab('0x61')][_0xb0ab('0x25')]({'attributes':['id',_0xb0ab('0x62')],'where':{'id':_0x18db87['interaction'][_0xb0ab('0x60')]}})['then'](function(_0x4959e7){if(_0x4959e7){_0x18db87[_0xb0ab('0x42')][_0xb0ab('0x63')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4959e7[_0xb0ab('0x62')]+','+(_0x18db87['account'][_0xb0ab('0x64')]||0xa),'interval':_0xb0ab('0x65')});}return respondWithRpcPromise(_0xb0ab('0x66'),_0xb0ab('0x67'),_0x18db87);});}return respondWithRpcPromise(_0xb0ab('0x66'),_0xb0ab('0x67'),_0x18db87);})[_0xb0ab('0x10')](function(_0x47e6ef){_0x4da7a7(_0x47e6ef);})['catch'](function(_0x5994e6){_0x232665(_0x32070c[_0xb0ab('0x16')](0x1f4,_0x5994e6[_0xb0ab('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 6a96ddb..2b321bb 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 _0x37cc=['update','removeListener','register','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x37cc,0x185));var _0xc37c=function(_0x1151c5,_0x3a81b1){_0x1151c5=_0x1151c5-0x0;var _0x2beb31=_0x37cc[_0x1151c5];return _0x2beb31;};'use strict';var MailAccountEvents=require(_0xc37c('0x0'));var events=[_0xc37c('0x1'),_0xc37c('0x2'),_0xc37c('0x3')];function createListener(_0x198089,_0x2bc194){return function(_0x48bba7){_0x2bc194['emit'](_0x198089,_0x48bba7);};}function removeListener(_0x334d3c,_0x946e3b){return function(){MailAccountEvents[_0xc37c('0x4')](_0x334d3c,_0x946e3b);};}exports[_0xc37c('0x5')]=function(_0x4c9dcd){for(var _0x582100=0x0,_0xd8f098=events[_0xc37c('0x6')];_0x582100<_0xd8f098;_0x582100++){var _0x3c5c63=events[_0x582100];var _0x483c8d=createListener(_0xc37c('0x7')+_0x3c5c63,_0x4c9dcd);MailAccountEvents['on'](_0x3c5c63,_0x483c8d);}}; \ No newline at end of file +var _0x3561=['mailAccount:','./mailAccount.events','remove','update','emit','removeListener','register'];(function(_0xbec5d7,_0x320544){var _0x4a399c=function(_0x503b8c){while(--_0x503b8c){_0xbec5d7['push'](_0xbec5d7['shift']());}};_0x4a399c(++_0x320544);}(_0x3561,0x94));var _0x1356=function(_0x1db9d8,_0x202748){_0x1db9d8=_0x1db9d8-0x0;var _0x46d7d4=_0x3561[_0x1db9d8];return _0x46d7d4;};'use strict';var MailAccountEvents=require(_0x1356('0x0'));var events=['save',_0x1356('0x1'),_0x1356('0x2')];function createListener(_0x8ef5f,_0x14465e){return function(_0x442fbc){_0x14465e[_0x1356('0x3')](_0x8ef5f,_0x442fbc);};}function removeListener(_0x1634de,_0x116ff0){return function(){MailAccountEvents[_0x1356('0x4')](_0x1634de,_0x116ff0);};}exports[_0x1356('0x5')]=function(_0x417d11){for(var _0x36e81f=0x0,_0x45ac56=events['length'];_0x36e81f<_0x45ac56;_0x36e81f++){var _0x105aaf=events[_0x36e81f];var _0x33529f=createListener(_0x1356('0x6')+_0x105aaf,_0x417d11);MailAccountEvents['on'](_0x105aaf,_0x33529f);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index d575aa1..bb9fdf8 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 _0x1261=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','/:id','update','delete','destroy'];(function(_0x398acc,_0x21f70b){var _0x6a9478=function(_0x57591d){while(--_0x57591d){_0x398acc['push'](_0x398acc['shift']());}};_0x6a9478(++_0x21f70b);}(_0x1261,0x144));var _0x1126=function(_0x57b4cc,_0x2ae50e){_0x57b4cc=_0x57b4cc-0x0;var _0x45ba9d=_0x1261[_0x57b4cc];return _0x45ba9d;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/:id',auth[_0x1126('0xa')](),controller[_0x1126('0xb')]);router['put'](_0x1126('0xc'),auth[_0x1126('0xa')](),controller[_0x1126('0xd')]);router[_0x1126('0xe')](_0x1126('0xc'),auth['isAuthenticated'](),controller[_0x1126('0xf')]);module[_0x1126('0x10')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x574e21,_0x5a5fa2){var _0x33a6dd=function(_0x58ab82){while(--_0x58ab82){_0x574e21['push'](_0x574e21['shift']());}};_0x33a6dd(++_0x5a5fa2);}(_0xadb5,0xad));var _0x5adb=function(_0x486215,_0x24be79){_0x486215=_0x486215-0x0;var _0x3dc804=_0xadb5[_0x486215];return _0x3dc804;};'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('./mailApplication.controller');router[_0x5adb('0x7')](_0x5adb('0x8'),auth[_0x5adb('0x9')](),controller[_0x5adb('0xa')]);router[_0x5adb('0xb')](_0x5adb('0x8'),auth[_0x5adb('0x9')](),controller[_0x5adb('0xc')]);router[_0x5adb('0xd')](_0x5adb('0x8'),auth[_0x5adb('0x9')](),controller[_0x5adb('0xe')]);module[_0x5adb('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 6a45796..5e34446 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 _0xa92e=['TEXT','STRING','sequelize','exports','INTEGER','noop'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xa92e,0x1ca));var _0xea92=function(_0x17c466,_0x292eca){_0x17c466=_0x17c466-0x0;var _0x37cefb=_0xa92e[_0x17c466];return _0x37cefb;};'use strict';var Sequelize=require(_0xea92('0x0'));module[_0xea92('0x1')]={'priority':{'type':Sequelize[_0xea92('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xea92('0x3')},'appdata':{'type':Sequelize[_0xea92('0x4')]()},'description':{'type':Sequelize[_0xea92('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa19c=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x96a3cc,_0x36d7a0){var _0x30581e=function(_0x549d30){while(--_0x549d30){_0x96a3cc['push'](_0x96a3cc['shift']());}};_0x30581e(++_0x36d7a0);}(_0xa19c,0x180));var _0xca19=function(_0x1f6afe,_0x1f9063){_0x1f6afe=_0x1f6afe-0x0;var _0x13eafe=_0xa19c[_0x1f6afe];return _0x13eafe;};'use strict';var Sequelize=require(_0xca19('0x0'));module[_0xca19('0x1')]={'priority':{'type':Sequelize[_0xca19('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xca19('0x3')],'allowNull':![],'defaultValue':_0xca19('0x4')},'appdata':{'type':Sequelize[_0xca19('0x5')]()},'description':{'type':Sequelize[_0xca19('0x3')]},'interval':{'type':Sequelize[_0xca19('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 56541c0..8b5747c 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 _0x4083=['count','offset','limit','set','Content-Range','apply','update','then','error','stack','name','send','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','destroy','eml-format','rimraf','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','papaparse','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'];(function(_0x390aa6,_0xb715d9){var _0x15d655=function(_0x4e2d38){while(--_0x4e2d38){_0x390aa6['push'](_0x390aa6['shift']());}};_0x15d655(++_0xb715d9);}(_0x4083,0xc7));var _0x3408=function(_0x496c59,_0x1dcb13){_0x496c59=_0x496c59-0x0;var _0x57492f=_0x4083[_0x496c59];return _0x57492f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3408('0x0'));var rimraf=require(_0x3408('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3408('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3408('0x3'));var util=require('util');var path=require(_0x3408('0x4'));var sox=require(_0x3408('0x5'));var csv=require(_0x3408('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3408('0x7'));var squel=require(_0x3408('0x8'));var crypto=require(_0x3408('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3408('0x6'));var querystring=require('querystring');var Papa=require(_0x3408('0xa'));var Redis=require(_0x3408('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x3408('0xc'));var as=require(_0x3408('0xd'));var hardwareService=require(_0x3408('0xe'));var logger=require(_0x3408('0xf'))(_0x3408('0x10'));var utils=require(_0x3408('0x11'));var config=require(_0x3408('0x12'));var licenseUtil=require(_0x3408('0x13'));var db=require(_0x3408('0x14'))['db'];function respondWithStatusCode(_0x1eefd9,_0x218666){_0x218666=_0x218666||0xcc;return function(_0x1e6b06){if(_0x1e6b06){return _0x1eefd9[_0x3408('0x15')](_0x218666);}return _0x1eefd9[_0x3408('0x16')](_0x218666)[_0x3408('0x17')]();};}function respondWithResult(_0x24c9a5,_0x1d9b4e){_0x1d9b4e=_0x1d9b4e||0xc8;return function(_0x333838){if(_0x333838){return _0x24c9a5[_0x3408('0x16')](_0x1d9b4e)[_0x3408('0x18')](_0x333838);}};}function respondWithFilteredResult(_0x1e08ff,_0x38ed85){return function(_0x184a76){if(_0x184a76){var _0x2585b8=_0x184a76[_0x3408('0x19')],_0x2ba83f=_0x38ed85[_0x3408('0x1a')],_0x34ed66=_0x38ed85['offset']+_0x38ed85[_0x3408('0x1b')],_0x4c41cc;if(_0x34ed66>=_0x2585b8){_0x34ed66=_0x2585b8;_0x4c41cc=0xc8;}else{_0x4c41cc=0xce;}_0x1e08ff['status'](_0x4c41cc);return _0x1e08ff[_0x3408('0x1c')](_0x3408('0x1d'),_0x2ba83f+'-'+_0x34ed66+'/'+_0x2585b8)['json'](_0x184a76);}return null;};}function patchUpdates(_0x2f1a00){return function(_0x15c0fb){try{jsonpatch[_0x3408('0x1e')](_0x15c0fb,_0x2f1a00,!![]);}catch(_0xdb1aed){return BPromise['reject'](_0xdb1aed);}return _0x15c0fb['save']();};}function saveUpdates(_0x61c367,_0x165319){return function(_0x161f20){if(_0x161f20){return _0x161f20[_0x3408('0x1f')](_0x61c367)['then'](function(_0x129475){return _0x129475;});}return null;};}function removeEntity(_0x47e54c,_0x19a05a){return function(_0x5eeb01){if(_0x5eeb01){return _0x5eeb01['destroy']()[_0x3408('0x20')](function(){_0x47e54c[_0x3408('0x16')](0xcc)[_0x3408('0x17')]();});}};}function handleEntityNotFound(_0x233dc4,_0x726cdb){return function(_0x4aea18){if(!_0x4aea18){_0x233dc4['sendStatus'](0x194);}return _0x4aea18;};}function handleError(_0xfae1e8,_0x295c7e){_0x295c7e=_0x295c7e||0x1f4;return function(_0x116056){logger[_0x3408('0x21')](_0x116056[_0x3408('0x22')]);if(_0x116056[_0x3408('0x23')]){delete _0x116056[_0x3408('0x23')];}_0xfae1e8[_0x3408('0x16')](_0x295c7e)[_0x3408('0x24')](_0x116056);};}exports['show']=function(_0x55947e,_0x5a9187){var _0x1e282f={'raw':!![],'where':{'id':_0x55947e[_0x3408('0x25')]['id']}},_0x232496={};_0x232496[_0x3408('0x26')]=_[_0x3408('0x27')](db[_0x3408('0x28')][_0x3408('0x29')]);_0x232496[_0x3408('0x2a')]=_[_0x3408('0x27')](_0x55947e['query']);_0x232496[_0x3408('0x2b')]=_[_0x3408('0x2c')](_0x232496['model'],_0x232496[_0x3408('0x2a')]);_0x1e282f[_0x3408('0x2d')]=_['intersection'](_0x232496[_0x3408('0x26')],qs['fields'](_0x55947e[_0x3408('0x2a')][_0x3408('0x2e')]));_0x1e282f[_0x3408('0x2d')]=_0x1e282f[_0x3408('0x2d')][_0x3408('0x2f')]?_0x1e282f[_0x3408('0x2d')]:_0x232496[_0x3408('0x26')];if(_0x55947e[_0x3408('0x2a')][_0x3408('0x30')]){_0x1e282f[_0x3408('0x31')]=[{'all':!![]}];}_0x1e282f=_[_0x3408('0x32')]({},_0x1e282f,_0x55947e[_0x3408('0x33')]);return db['MailApplication'][_0x3408('0x34')](_0x1e282f)[_0x3408('0x20')](handleEntityNotFound(_0x5a9187,null))[_0x3408('0x20')](respondWithResult(_0x5a9187,null))[_0x3408('0x35')](handleError(_0x5a9187,null));};exports[_0x3408('0x1f')]=function(_0x271064,_0x371802){if(_0x271064[_0x3408('0x36')]['id']){delete _0x271064['body']['id'];}return db[_0x3408('0x28')][_0x3408('0x34')]({'where':{'id':_0x271064['params']['id']}})['then'](handleEntityNotFound(_0x371802,null))[_0x3408('0x20')](saveUpdates(_0x271064[_0x3408('0x36')],null))['then'](respondWithResult(_0x371802,null))[_0x3408('0x35')](handleError(_0x371802,null));};exports[_0x3408('0x37')]=function(_0x39e231,_0x409cea){return db[_0x3408('0x28')][_0x3408('0x34')]({'where':{'id':_0x39e231['params']['id']}})['then'](handleEntityNotFound(_0x409cea,null))['then'](removeEntity(_0x409cea,null))['catch'](handleError(_0x409cea,null));}; \ No newline at end of file +var _0x31ee=['model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','options','find','catch','body','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','params'];(function(_0x731271,_0x3dd9dd){var _0x538900=function(_0x4a0bcc){while(--_0x4a0bcc){_0x731271['push'](_0x731271['shift']());}};_0x538900(++_0x3dd9dd);}(_0x31ee,0xab));var _0xe31e=function(_0xb64372,_0x3c862a){_0xb64372=_0xb64372-0x0;var _0x2564b0=_0x31ee[_0xb64372];return _0x2564b0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe31e('0x0'));var rimraf=require(_0xe31e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe31e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe31e('0x3'));var util=require(_0xe31e('0x4'));var path=require(_0xe31e('0x5'));var sox=require(_0xe31e('0x6'));var csv=require(_0xe31e('0x7'));var ejs=require(_0xe31e('0x8'));var fs=require('fs');var fs_extra=require(_0xe31e('0x9'));var _=require('lodash');var squel=require(_0xe31e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe31e('0xb'));var toCsv=require(_0xe31e('0x7'));var querystring=require(_0xe31e('0xc'));var Papa=require(_0xe31e('0xd'));var Redis=require('ioredis');var authService=require(_0xe31e('0xe'));var qs=require(_0xe31e('0xf'));var as=require(_0xe31e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe31e('0x11'))('api');var utils=require(_0xe31e('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40d137,_0x3e4d28){_0x3e4d28=_0x3e4d28||0xcc;return function(_0x454653){if(_0x454653){return _0x40d137[_0xe31e('0x13')](_0x3e4d28);}return _0x40d137[_0xe31e('0x14')](_0x3e4d28)[_0xe31e('0x15')]();};}function respondWithResult(_0x18b3d3,_0x45ae67){_0x45ae67=_0x45ae67||0xc8;return function(_0x527a0a){if(_0x527a0a){return _0x18b3d3['status'](_0x45ae67)[_0xe31e('0x16')](_0x527a0a);}};}function respondWithFilteredResult(_0x5d8089,_0x1c3415){return function(_0x52cf8e){if(_0x52cf8e){var _0x44bd5e=_0x52cf8e['count'],_0x4e1ecc=_0x1c3415[_0xe31e('0x17')],_0x4d7342=_0x1c3415[_0xe31e('0x17')]+_0x1c3415[_0xe31e('0x18')],_0x43e5d6;if(_0x4d7342>=_0x44bd5e){_0x4d7342=_0x44bd5e;_0x43e5d6=0xc8;}else{_0x43e5d6=0xce;}_0x5d8089[_0xe31e('0x14')](_0x43e5d6);return _0x5d8089['set'](_0xe31e('0x19'),_0x4e1ecc+'-'+_0x4d7342+'/'+_0x44bd5e)['json'](_0x52cf8e);}return null;};}function patchUpdates(_0x282106){return function(_0x2fb769){try{jsonpatch[_0xe31e('0x1a')](_0x2fb769,_0x282106,!![]);}catch(_0x12fd21){return BPromise[_0xe31e('0x1b')](_0x12fd21);}return _0x2fb769[_0xe31e('0x1c')]();};}function saveUpdates(_0x84f81d,_0x338207){return function(_0x5d813f){if(_0x5d813f){return _0x5d813f[_0xe31e('0x1d')](_0x84f81d)[_0xe31e('0x1e')](function(_0x232e07){return _0x232e07;});}return null;};}function removeEntity(_0x452588,_0x37e6ab){return function(_0x1eb3d0){if(_0x1eb3d0){return _0x1eb3d0[_0xe31e('0x1f')]()[_0xe31e('0x1e')](function(){_0x452588[_0xe31e('0x14')](0xcc)[_0xe31e('0x15')]();});}};}function handleEntityNotFound(_0x179ce0,_0x193a2c){return function(_0x597697){if(!_0x597697){_0x179ce0['sendStatus'](0x194);}return _0x597697;};}function handleError(_0x252335,_0x366a29){_0x366a29=_0x366a29||0x1f4;return function(_0x535e85){logger['error'](_0x535e85[_0xe31e('0x20')]);if(_0x535e85[_0xe31e('0x21')]){delete _0x535e85[_0xe31e('0x21')];}_0x252335['status'](_0x366a29)[_0xe31e('0x22')](_0x535e85);};}exports[_0xe31e('0x23')]=function(_0x586fd3,_0x3f5614){var _0x1df3df={'raw':!![],'where':{'id':_0x586fd3[_0xe31e('0x24')]['id']}},_0xefc2ed={};_0xefc2ed[_0xe31e('0x25')]=_[_0xe31e('0x26')](db[_0xe31e('0x27')][_0xe31e('0x28')]);_0xefc2ed['query']=_[_0xe31e('0x26')](_0x586fd3[_0xe31e('0x29')]);_0xefc2ed[_0xe31e('0x2a')]=_[_0xe31e('0x2b')](_0xefc2ed[_0xe31e('0x25')],_0xefc2ed[_0xe31e('0x29')]);_0x1df3df[_0xe31e('0x2c')]=_['intersection'](_0xefc2ed[_0xe31e('0x25')],qs['fields'](_0x586fd3[_0xe31e('0x29')]['fields']));_0x1df3df[_0xe31e('0x2c')]=_0x1df3df[_0xe31e('0x2c')][_0xe31e('0x2d')]?_0x1df3df[_0xe31e('0x2c')]:_0xefc2ed[_0xe31e('0x25')];if(_0x586fd3[_0xe31e('0x29')][_0xe31e('0x2e')]){_0x1df3df[_0xe31e('0x2f')]=[{'all':!![]}];}_0x1df3df=_['merge']({},_0x1df3df,_0x586fd3[_0xe31e('0x30')]);return db[_0xe31e('0x27')][_0xe31e('0x31')](_0x1df3df)[_0xe31e('0x1e')](handleEntityNotFound(_0x3f5614,null))[_0xe31e('0x1e')](respondWithResult(_0x3f5614,null))[_0xe31e('0x32')](handleError(_0x3f5614,null));};exports['update']=function(_0xe33d9e,_0x108dc9){if(_0xe33d9e[_0xe31e('0x33')]['id']){delete _0xe33d9e[_0xe31e('0x33')]['id'];}return db[_0xe31e('0x27')]['find']({'where':{'id':_0xe33d9e['params']['id']}})[_0xe31e('0x1e')](handleEntityNotFound(_0x108dc9,null))[_0xe31e('0x1e')](saveUpdates(_0xe33d9e[_0xe31e('0x33')],null))[_0xe31e('0x1e')](respondWithResult(_0x108dc9,null))['catch'](handleError(_0x108dc9,null));};exports[_0xe31e('0x1f')]=function(_0x570e52,_0x5431eb){return db['MailApplication'][_0xe31e('0x31')]({'where':{'id':_0x570e52[_0xe31e('0x24')]['id']}})[_0xe31e('0x1e')](handleEntityNotFound(_0x5431eb,null))[_0xe31e('0x1e')](removeEntity(_0x5431eb,null))[_0xe31e('0x32')](handleError(_0x5431eb,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1ebc415..1752b06 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 _0xe35d=['mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication'];(function(_0x2ff5bc,_0x13d5ce){var _0x1ec873=function(_0x17c62c){while(--_0x17c62c){_0x2ff5bc['push'](_0x2ff5bc['shift']());}};_0x1ec873(++_0x13d5ce);}(_0xe35d,0xd5));var _0xde35=function(_0x5235c0,_0x44717e){_0x5235c0=_0x5235c0-0x0;var _0x130aa5=_0xe35d[_0x5235c0];return _0x130aa5;};'use strict';var _=require(_0xde35('0x0'));var util=require(_0xde35('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xde35('0x2'));var BPromise=require(_0xde35('0x3'));var rp=require(_0xde35('0x4'));var fs=require('fs');var path=require(_0xde35('0x5'));var rimraf=require(_0xde35('0x6'));var config=require(_0xde35('0x7'));var attributes=require(_0xde35('0x8'));module[_0xde35('0x9')]=function(_0x20320f,_0x427941){return _0x20320f['define'](_0xde35('0xa'),attributes,{'tableName':_0xde35('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xde35('0xc'),'collate':_0xde35('0xd')});}; \ No newline at end of file +var _0x2b47=['moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x2926a0,_0x16263e){var _0x294f48=function(_0x5ebd6e){while(--_0x5ebd6e){_0x2926a0['push'](_0x2926a0['shift']());}};_0x294f48(++_0x16263e);}(_0x2b47,0x177));var _0x72b4=function(_0x1478ea,_0x256ad0){_0x1478ea=_0x1478ea-0x0;var _0x4a90ec=_0x2b47[_0x1478ea];return _0x4a90ec;};'use strict';var _=require(_0x72b4('0x0'));var util=require('util');var logger=require(_0x72b4('0x1'))(_0x72b4('0x2'));var moment=require(_0x72b4('0x3'));var BPromise=require('bluebird');var rp=require(_0x72b4('0x4'));var fs=require('fs');var path=require(_0x72b4('0x5'));var rimraf=require(_0x72b4('0x6'));var config=require(_0x72b4('0x7'));var attributes=require(_0x72b4('0x8'));module[_0x72b4('0x9')]=function(_0x4c8ef4,_0xdb9d80){return _0x4c8ef4['define'](_0x72b4('0xa'),attributes,{'tableName':_0x72b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x72b4('0xc'),'collate':_0x72b4('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index c47c912..aa83c9a 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 _0xaaeb=['stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','limit','info'];(function(_0x2c4f17,_0x19477f){var _0x494334=function(_0x4cb3ed){while(--_0x4cb3ed){_0x2c4f17['push'](_0x2c4f17['shift']());}};_0x494334(++_0x19477f);}(_0xaaeb,0x1c1));var _0xbaae=function(_0x52c4f6,_0x5b3ecc){_0x52c4f6=_0x52c4f6-0x0;var _0x34cabb=_0xaaeb[_0x52c4f6];return _0x34cabb;};'use strict';var _=require(_0xbaae('0x0'));var util=require(_0xbaae('0x1'));var moment=require(_0xbaae('0x2'));var BPromise=require(_0xbaae('0x3'));var rs=require(_0xbaae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbaae('0x5'));var logger=require(_0xbaae('0x6'))('rpc');var config=require(_0xbaae('0x7'));var jayson=require(_0xbaae('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4cd967,_0x2c864b,_0xeb709){return new BPromise(function(_0x24ee4a,_0x19f99e){return client[_0xbaae('0x9')](_0x4cd967,_0xeb709)[_0xbaae('0xa')](function(_0x1d2ae7){logger['info'](_0xbaae('0xb'),_0x2c864b,'request\x20sent');logger[_0xbaae('0xc')](_0xbaae('0xd'),_0x2c864b,_0xbaae('0xe'),JSON['stringify'](_0x1d2ae7));if(_0x1d2ae7[_0xbaae('0xf')]){if(_0x1d2ae7[_0xbaae('0xf')][_0xbaae('0x10')]===0x1f4){logger['error'](_0xbaae('0xb'),_0x2c864b,_0x1d2ae7[_0xbaae('0xf')]['message']);return _0x19f99e(_0x1d2ae7['error'][_0xbaae('0x11')]);}logger[_0xbaae('0xf')](_0xbaae('0xb'),_0x2c864b,_0x1d2ae7[_0xbaae('0xf')][_0xbaae('0x11')]);return _0x24ee4a(_0x1d2ae7['error']['message']);}else{logger['info'](_0xbaae('0xb'),_0x2c864b,_0xbaae('0xe'));_0x24ee4a(_0x1d2ae7[_0xbaae('0x12')][_0xbaae('0x11')]);}})[_0xbaae('0x13')](function(_0x41304b){logger[_0xbaae('0xf')](_0xbaae('0xb'),_0x2c864b,_0x41304b);_0x19f99e(_0x41304b);});});}exports[_0xbaae('0x14')]=function(_0x10a118){var _0x5e1cca=this;return new Promise(function(_0x58cda7,_0x493fab){return db[_0xbaae('0x15')][_0xbaae('0x16')](_0x10a118['body'],{'raw':_0x10a118[_0xbaae('0x17')]?_0x10a118['options'][_0xbaae('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10a118['options']?_0x10a118[_0xbaae('0x17')]['where']||null:null,'attributes':_0x10a118[_0xbaae('0x17')]?_0x10a118[_0xbaae('0x17')]['attributes']||null:null,'limit':_0x10a118[_0xbaae('0x17')]?_0x10a118[_0xbaae('0x17')][_0xbaae('0x19')]||null:null})[_0xbaae('0xa')](function(_0x4486e6){logger[_0xbaae('0x1a')](_0xbaae('0x14'),_0x10a118);logger[_0xbaae('0xc')](_0xbaae('0x14'),_0x10a118,JSON[_0xbaae('0x1b')](_0x4486e6));_0x58cda7(_0x4486e6);})[_0xbaae('0x13')](function(_0xcb519e){logger[_0xbaae('0xf')]('UpdateMailApplication',_0xcb519e[_0xbaae('0x11')],_0x10a118);_0x493fab(_0x5e1cca[_0xbaae('0xf')](0x1f4,_0xcb519e[_0xbaae('0x11')]));});});}; \ No newline at end of file +var _0xd1cb=['bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','UpdateMailApplication','update','options','raw','where','attributes','limit','then','catch','lodash','util'];(function(_0x16aaef,_0x410651){var _0x1c82ef=function(_0x3d802b){while(--_0x3d802b){_0x16aaef['push'](_0x16aaef['shift']());}};_0x1c82ef(++_0x410651);}(_0xd1cb,0x1ce));var _0xbd1c=function(_0x53d520,_0x35c166){_0x53d520=_0x53d520-0x0;var _0x488a7e=_0xd1cb[_0x53d520];return _0x488a7e;};'use strict';var _=require(_0xbd1c('0x0'));var util=require(_0xbd1c('0x1'));var moment=require('moment');var BPromise=require(_0xbd1c('0x2'));var rs=require(_0xbd1c('0x3'));var fs=require('fs');var Redis=require(_0xbd1c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd1c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbd1c('0x6'));var jayson=require(_0xbd1c('0x7'));var client=jayson[_0xbd1c('0x8')][_0xbd1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a5e64,_0x16788b,_0x28ab92){return new BPromise(function(_0x34a9ff,_0x9b4345){return client[_0xbd1c('0xa')](_0x2a5e64,_0x28ab92)['then'](function(_0x52c235){logger['info'](_0xbd1c('0xb'),_0x16788b,'request\x20sent');logger[_0xbd1c('0xc')](_0xbd1c('0xd'),_0x16788b,_0xbd1c('0xe'),JSON[_0xbd1c('0xf')](_0x52c235));if(_0x52c235[_0xbd1c('0x10')]){if(_0x52c235[_0xbd1c('0x10')]['code']===0x1f4){logger[_0xbd1c('0x10')](_0xbd1c('0xb'),_0x16788b,_0x52c235[_0xbd1c('0x10')][_0xbd1c('0x11')]);return _0x9b4345(_0x52c235[_0xbd1c('0x10')]['message']);}logger[_0xbd1c('0x10')]('MailApplication,\x20%s,\x20%s',_0x16788b,_0x52c235[_0xbd1c('0x10')][_0xbd1c('0x11')]);return _0x34a9ff(_0x52c235['error'][_0xbd1c('0x11')]);}else{logger[_0xbd1c('0x12')](_0xbd1c('0xb'),_0x16788b,'request\x20sent');_0x34a9ff(_0x52c235[_0xbd1c('0x13')][_0xbd1c('0x11')]);}})['catch'](function(_0x35b492){logger['error']('MailApplication,\x20%s,\x20%s',_0x16788b,_0x35b492);_0x9b4345(_0x35b492);});});}exports[_0xbd1c('0x14')]=function(_0x41f8fa){var _0xc72c1b=this;return new Promise(function(_0x106f4f,_0x227d17){return db['MailApplication'][_0xbd1c('0x15')](_0x41f8fa['body'],{'raw':_0x41f8fa['options']?_0x41f8fa[_0xbd1c('0x16')][_0xbd1c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41f8fa[_0xbd1c('0x16')]?_0x41f8fa['options'][_0xbd1c('0x18')]||null:null,'attributes':_0x41f8fa[_0xbd1c('0x16')]?_0x41f8fa[_0xbd1c('0x16')][_0xbd1c('0x19')]||null:null,'limit':_0x41f8fa[_0xbd1c('0x16')]?_0x41f8fa['options'][_0xbd1c('0x1a')]||null:null})[_0xbd1c('0x1b')](function(_0x488e99){logger['info']('UpdateMailApplication',_0x41f8fa);logger[_0xbd1c('0xc')](_0xbd1c('0x14'),_0x41f8fa,JSON[_0xbd1c('0xf')](_0x488e99));_0x106f4f(_0x488e99);})[_0xbd1c('0x1c')](function(_0x276e20){logger[_0xbd1c('0x10')](_0xbd1c('0x14'),_0x276e20['message'],_0x41f8fa);_0x227d17(_0xc72c1b[_0xbd1c('0x10')](0x1f4,_0x276e20['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 8ede0ab..edddcdc 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 _0x72fa=['Router','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','mail','addTags','mailinteraction:update','update','delete','mailinteraction:destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express'];(function(_0x20cddf,_0x343c9a){var _0x4296af=function(_0x130d2e){while(--_0x130d2e){_0x20cddf['push'](_0x20cddf['shift']());}};_0x4296af(++_0x343c9a);}(_0x72fa,0x78));var _0xa72f=function(_0x1a5cd7,_0x3811e9){_0x1a5cd7=_0x1a5cd7-0x0;var _0x399402=_0x72fa[_0x1a5cd7];return _0x399402;};'use strict';var multer=require(_0xa72f('0x0'));var util=require(_0xa72f('0x1'));var path=require('path');var timeout=require(_0xa72f('0x2'));var express=require(_0xa72f('0x3'));var router=express[_0xa72f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa72f('0x5'));var config=require(_0xa72f('0x6'));var controller=require(_0xa72f('0x7'));router[_0xa72f('0x8')]('/',auth[_0xa72f('0x9')](),controller[_0xa72f('0xa')]);router[_0xa72f('0x8')](_0xa72f('0xb'),auth[_0xa72f('0x9')](),controller[_0xa72f('0xc')]);router['get'](_0xa72f('0xd'),auth[_0xa72f('0x9')](),controller[_0xa72f('0xe')]);router['get'](_0xa72f('0xf'),auth[_0xa72f('0x9')](),controller['getMessages']);router[_0xa72f('0x8')](_0xa72f('0x10'),auth[_0xa72f('0x9')](),controller[_0xa72f('0x11')]);router[_0xa72f('0x12')]('/',auth[_0xa72f('0x9')](),controller[_0xa72f('0x13')]);router[_0xa72f('0x12')](_0xa72f('0xf'),auth[_0xa72f('0x9')](),controller[_0xa72f('0x14')]);router[_0xa72f('0x12')]('/:id/tags',auth[_0xa72f('0x9')](),interaction[_0xa72f('0x15')](_0xa72f('0x16'),'mailinteraction:addtags'),controller[_0xa72f('0x17')]);router['put'](_0xa72f('0xd'),auth[_0xa72f('0x9')](),interaction['tracked'](_0xa72f('0x16'),_0xa72f('0x18')),controller[_0xa72f('0x19')]);router[_0xa72f('0x1a')]('/:id',auth[_0xa72f('0x9')](),interaction[_0xa72f('0x15')](_0xa72f('0x16'),_0xa72f('0x1b')),controller['destroy']);router[_0xa72f('0x1a')](_0xa72f('0x1c'),auth[_0xa72f('0x9')](),controller[_0xa72f('0x1d')]);module[_0xa72f('0x1e')]=router; \ No newline at end of file +var _0x958a=['/:id','mail','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','put'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x958a,0x128));var _0xa958=function(_0x3668a4,_0x4919ae){_0x3668a4=_0x3668a4-0x0;var _0x383ddc=_0x958a[_0x3668a4];return _0x383ddc;};'use strict';var multer=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var path=require('path');var timeout=require(_0xa958('0x2'));var express=require(_0xa958('0x3'));var router=express[_0xa958('0x4')]();var fs_extra=require(_0xa958('0x5'));var auth=require(_0xa958('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa958('0x7'));var controller=require('./mailInteraction.controller');router[_0xa958('0x8')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0xa')]);router[_0xa958('0x8')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0xc')]);router['get']('/:id',auth[_0xa958('0x9')](),controller[_0xa958('0xd')]);router[_0xa958('0x8')](_0xa958('0xe'),auth[_0xa958('0x9')](),controller[_0xa958('0xf')]);router[_0xa958('0x8')](_0xa958('0x10'),auth[_0xa958('0x9')](),controller[_0xa958('0x11')]);router[_0xa958('0x12')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0x13')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0xa958('0x14')]);router[_0xa958('0x12')](_0xa958('0x15'),auth['isAuthenticated'](),interaction[_0xa958('0x16')]('mail','mailinteraction:addtags'),controller['addTags']);router[_0xa958('0x17')](_0xa958('0x18'),auth[_0xa958('0x9')](),interaction[_0xa958('0x16')](_0xa958('0x19'),_0xa958('0x1a')),controller[_0xa958('0x1b')]);router[_0xa958('0x1c')]('/:id',auth[_0xa958('0x9')](),interaction['tracked'](_0xa958('0x19'),_0xa958('0x1d')),controller['destroy']);router[_0xa958('0x1c')](_0xa958('0x15'),auth[_0xa958('0x9')](),controller[_0xa958('0x1e')]);module[_0xa958('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 53cd0fb..fe3efa5 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 _0xb40d=['exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM','out'];(function(_0x5c80f1,_0x1f7155){var _0x1a75a1=function(_0x395288){while(--_0x395288){_0x5c80f1['push'](_0x5c80f1['shift']());}};_0x1a75a1(++_0x1f7155);}(_0xb40d,0x108));var _0xdb40=function(_0x4a77b3,_0xc9d9d2){_0x4a77b3=_0x4a77b3-0x0;var _0x42b4f0=_0xb40d[_0x4a77b3];return _0x42b4f0;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0xdb40('0x0')]={'closed':{'type':Sequelize[_0xdb40('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xdb40('0x2')]},'secondDisposition':{'type':Sequelize[_0xdb40('0x2')]},'thirdDisposition':{'type':Sequelize[_0xdb40('0x2')]},'note':{'type':Sequelize[_0xdb40('0x2')]},'inReplyTo':{'type':Sequelize[_0xdb40('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xdb40('0x3')](_0xdb40('0x4'))},'subject':{'type':Sequelize[_0xdb40('0x3')]()},'attach':{'type':Sequelize[_0xdb40('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xdb40('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0xdb40('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xdb40('0x6')]('in',_0xdb40('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdb40('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xdb40('0x6')]('in',_0xdb40('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xdb40('0x3')](_0xdb40('0x4'))},'lastMsgText':{'type':Sequelize[_0xdb40('0x3')](_0xdb40('0x4'))}}; \ No newline at end of file +var _0xad9c=['ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x29a5a6,_0x130b9d){var _0x404853=function(_0xddce47){while(--_0xddce47){_0x29a5a6['push'](_0x29a5a6['shift']());}};_0x404853(++_0x130b9d);}(_0xad9c,0x16a));var _0xcad9=function(_0x24fbc1,_0x42a096){_0x24fbc1=_0x24fbc1-0x0;var _0x5b03bd=_0xad9c[_0x24fbc1];return _0x5b03bd;};'use strict';var Sequelize=require(_0xcad9('0x0'));var iconv=require(_0xcad9('0x1'));module[_0xcad9('0x2')]={'closed':{'type':Sequelize[_0xcad9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcad9('0x4')]},'disposition':{'type':Sequelize[_0xcad9('0x5')]},'secondDisposition':{'type':Sequelize[_0xcad9('0x5')]},'thirdDisposition':{'type':Sequelize[_0xcad9('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xcad9('0x5')](0x1fe)},'to':{'type':Sequelize[_0xcad9('0x5')]},'cc':{'type':Sequelize[_0xcad9('0x6')](_0xcad9('0x7'))},'subject':{'type':Sequelize[_0xcad9('0x6')]()},'attach':{'type':Sequelize[_0xcad9('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xcad9('0x8')]('in',_0xcad9('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcad9('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xcad9('0x8')]('in',_0xcad9('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0xcad9('0x7'))},'lastMsgText':{'type':Sequelize[_0xcad9('0x6')](_0xcad9('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 843dcba..d836b48 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 _0xb43b=['offset','limit','set','reject','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','from','u.id','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','plainBody','some','compact','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','MailAccountId','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','enableEmailPreview','all','rows','show','params','include','options','create','body','describe','MailMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','addTags','setTags','spread','color','removeTags','download','join','root','files','server','transcript-%d-%s.zip','attachments','bcc','subject','Messages','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','writeFileSync','err','unlinkSync','sendStatus','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','end','status','json','count'];(function(_0x3c9ef8,_0x38ceb2){var _0x83a178=function(_0x3ad8a0){while(--_0x3ad8a0){_0x3c9ef8['push'](_0x3c9ef8['shift']());}};_0x83a178(++_0x38ceb2);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1a9de0,_0x28e6da){_0x1a9de0=_0x1a9de0-0x0;var _0x48209f=_0xb43b[_0x1a9de0];return _0x48209f;};'use strict';var pdf=require(_0xbb43('0x0'));var emlformat=require(_0xbb43('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbb43('0x2'));var jsonpatch=require(_0xbb43('0x3'));var rp=require(_0xbb43('0x4'));var moment=require('moment');var BPromise=require(_0xbb43('0x5'));var Mustache=require(_0xbb43('0x6'));var util=require(_0xbb43('0x7'));var path=require(_0xbb43('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb43('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb43('0xa'));var squel=require(_0xbb43('0xb'));var crypto=require(_0xbb43('0xc'));var jsforce=require(_0xbb43('0xd'));var deskjs=require(_0xbb43('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbb43('0xf'));var Papa=require(_0xbb43('0x10'));var htmlToText=require('html-to-text');var juice=require(_0xbb43('0x11'));var Redis=require(_0xbb43('0x12'));var authService=require(_0xbb43('0x13'));var qs=require(_0xbb43('0x14'));var as=require(_0xbb43('0x15'));var hardwareService=require(_0xbb43('0x16'));var logger=require('../../config/logger')(_0xbb43('0x17'));var utils=require(_0xbb43('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbb43('0x19'))['db'];config['redis']=_['defaults'](config[_0xbb43('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb43('0x1b'))(new Redis(config[_0xbb43('0x1a')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4d5bcf,_0x338120){_0x338120=_0x338120||0xcc;return function(_0x2abce0){if(_0x2abce0){return _0x4d5bcf['sendStatus'](_0x338120);}return _0x4d5bcf['status'](_0x338120)[_0xbb43('0x1c')]();};}function respondWithResult(_0x563ce1,_0x5923dc){_0x5923dc=_0x5923dc||0xc8;return function(_0x2b0797){if(_0x2b0797){return _0x563ce1[_0xbb43('0x1d')](_0x5923dc)[_0xbb43('0x1e')](_0x2b0797);}};}function respondWithFilteredResult(_0x55dd73,_0x1c16d7){return function(_0x4f28b8){if(_0x4f28b8){var _0x3bb57d=_0x4f28b8[_0xbb43('0x1f')],_0x8e6429=_0x1c16d7[_0xbb43('0x20')],_0x4dfc54=_0x1c16d7[_0xbb43('0x20')]+_0x1c16d7[_0xbb43('0x21')],_0x5d765b;if(_0x4dfc54>=_0x3bb57d){_0x4dfc54=_0x3bb57d;_0x5d765b=0xc8;}else{_0x5d765b=0xce;}_0x55dd73['status'](_0x5d765b);return _0x55dd73[_0xbb43('0x22')]('Content-Range',_0x8e6429+'-'+_0x4dfc54+'/'+_0x3bb57d)[_0xbb43('0x1e')](_0x4f28b8);}return null;};}function patchUpdates(_0x4bfaca){return function(_0x2f5e31){try{jsonpatch['apply'](_0x2f5e31,_0x4bfaca,!![]);}catch(_0x3f323e){return BPromise[_0xbb43('0x23')](_0x3f323e);}return _0x2f5e31['save']();};}function saveUpdates(_0x1d0768,_0x4dfb7f){return function(_0xf24e60){if(_0xf24e60){return _0xf24e60[_0xbb43('0x24')](_0x1d0768)[_0xbb43('0x25')](function(_0x4d6d77){return _0x4d6d77;});}return null;};}function removeEntity(_0x53f0d5,_0x59a24d){return function(_0x269ca5){if(_0x269ca5){return _0x269ca5[_0xbb43('0x26')]()['then'](function(){_0x53f0d5[_0xbb43('0x1d')](0xcc)[_0xbb43('0x1c')]();});}};}function handleEntityNotFound(_0x226827,_0x3874fb){return function(_0x4ed43f){if(!_0x4ed43f){_0x226827['sendStatus'](0x194);}return _0x4ed43f;};}function handleError(_0x27fd7a,_0x42800f){_0x42800f=_0x42800f||0x1f4;return function(_0xa88db0){logger[_0xbb43('0x27')](_0xa88db0[_0xbb43('0x28')]);if(_0xa88db0[_0xbb43('0x29')]){delete _0xa88db0[_0xbb43('0x29')];}_0x27fd7a[_0xbb43('0x1d')](_0x42800f)['send'](_0xa88db0);};}function getInteractionUsers(_0x2ad6da,_0x56fe33){return new BPromise(function(_0x31fbc8,_0x436fd5){try{if(_0x56fe33[_0x2ad6da['id']]){_0x2ad6da[_0xbb43('0x2a')]=_[_0xbb43('0x2b')](_0x56fe33[_0x2ad6da['id']],function(_0x555b99){return{'id':_0x555b99['id'],'fullname':_0x555b99[_0xbb43('0x2c')]};});}}catch(_0x547a6f){_0x436fd5(_0x547a6f);}_0x31fbc8(_0x2ad6da);});}function getInteractionTags(_0x5566cf,_0x57d9d4){return new BPromise(function(_0x2af898,_0x573a05){try{if(_0x5566cf[_0xbb43('0x2d')]){_0x5566cf[_0xbb43('0x2e')]=[];_0x5566cf[_0xbb43('0x2d')]['split'](',')[_0xbb43('0x2f')](function(_0x1bdf91){_0x5566cf[_0xbb43('0x2e')][_0xbb43('0x30')](_0x57d9d4[_0x1bdf91]);});}delete _0x5566cf[_0xbb43('0x2d')];}catch(_0x2f1939){_0x573a05(_0x2f1939);}_0x2af898(_0x5566cf);});}function getLastMessageText(_0x3de482){return new BPromise(function(_0x24375b,_0x4f31ce){return db[_0xbb43('0x31')][_0xbb43('0x32')]({'where':{'id':_0x3de482['id']},'attributes':[_0xbb43('0x33'),_0xbb43('0x34')],'raw':!![]})[_0xbb43('0x25')](function(_0x37c565){if(!_0x37c565[_0xbb43('0x34')]){_0x3de482[_0xbb43('0x34')]=_[_0xbb43('0x35')](htmlToText[_0xbb43('0x36')](_0x37c565[_0xbb43('0x33')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x3de482[_0xbb43('0x34')]=_0x37c565[_0xbb43('0x34')];}_0x24375b(_0x3de482);})[_0xbb43('0x37')](function(_0x39062a){_0x4f31ce(_0x39062a);});});}function updateMailInteraction(_0x405f36,_0x549841,_0x39cbd7,_0x2d2056){return new BPromise(function(_0x52a694,_0x285014){return getInteractionUsers(_0x405f36,_0x39cbd7)[_0xbb43('0x25')](function(_0x11d384){return getInteractionTags(_0x11d384,_0x549841);})['then'](function(_0x5f4601){if(_0x2d2056){_0x52a694(getLastMessageText(_0x5f4601));}else{_0x52a694(_0x5f4601);}})['catch'](function(_0x40df31){_0x285014(_0x40df31);});});}exports[_0xbb43('0x38')]=function(_0x4a95c3,_0x4847df){var _0x2aa381={},_0x275425={},_0x29f6e5={'count':0x0,'rows':[]};var _0x37afbb=_[_0xbb43('0x2b')](db['MailInteraction'][_0xbb43('0x39')],function(_0x526cb8){return{'name':_0x526cb8[_0xbb43('0x3a')],'type':_0x526cb8[_0xbb43('0x3b')][_0xbb43('0x3c')]};});_0x275425['model']=_[_0xbb43('0x2b')](_0x37afbb,'name');_0x275425[_0xbb43('0x3d')]=_[_0xbb43('0x3e')](_0x4a95c3['query']);_0x275425[_0xbb43('0x3f')]=_['intersection'](_0x275425[_0xbb43('0x40')],_0x275425[_0xbb43('0x3d')]);_0x2aa381[_0xbb43('0x41')]=_[_0xbb43('0x42')](_0x275425['model'],qs[_0xbb43('0x43')](_0x4a95c3[_0xbb43('0x3d')]['fields']));_0x2aa381[_0xbb43('0x41')]=_0x2aa381['attributes'][_0xbb43('0x44')]?_0x2aa381[_0xbb43('0x41')]:_0x275425[_0xbb43('0x40')];if(!_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x45')](_0xbb43('0x46'))){_0x2aa381['limit']=qs[_0xbb43('0x21')](_0x4a95c3['query'][_0xbb43('0x21')]);_0x2aa381[_0xbb43('0x20')]=qs[_0xbb43('0x20')](_0x4a95c3[_0xbb43('0x3d')]['offset']);}_0x2aa381[_0xbb43('0x47')]=qs[_0xbb43('0x48')](_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x48')]);_0x2aa381[_0xbb43('0x49')]=qs[_0xbb43('0x3f')](_[_0xbb43('0x4a')](_0x4a95c3[_0xbb43('0x3d')],_0x275425['filters']),_0x37afbb);var _0x2eaece=[];var _0x8c57af=squel['select']()[_0xbb43('0x4b')]('id')['field']('name')['field']('color')[_0xbb43('0x4c')]('tools_tags');var _0x19c451=squel['select']()[_0xbb43('0x4b')](_0xbb43('0x4d'))[_0xbb43('0x4b')]('u.fullname')[_0xbb43('0x4b')]('ui.MailInteractionId')[_0xbb43('0x4c')](_0xbb43('0x4e'),'ui')[_0xbb43('0x4f')](_0xbb43('0x50'),'u',_0xbb43('0x51'));var _0x13d0a5=squel[_0xbb43('0x52')]()['from'](_0xbb43('0x53'),'i')[_0xbb43('0x4f')](_0xbb43('0x54'),'c',_0xbb43('0x55'))['left_join'](_0xbb43('0x50'),'o',_0xbb43('0x56'))[_0xbb43('0x4f')](_0xbb43('0x57'),'a','a.id\x20=\x20i.MailAccountId')[_0xbb43('0x4f')](_0xbb43('0x58'),'me',_0xbb43('0x59'))['left_join'](_0xbb43('0x5a'),'it',_0xbb43('0x5b'))[_0xbb43('0x4f')](_0xbb43('0x5c'),'t',_0xbb43('0x5d'));var _0x59c805=squel['expr']();var _0xb44557=[];var _0x5c75ba=squel[_0xbb43('0x5e')]();var _0xe0cdba;if(_0x4a95c3['query'][_0xbb43('0x5f')]){_0xe0cdba=as[_0xbb43('0x60')](_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x5f')]);var _0x1dfbb9=_0xe0cdba['sqlOperator'];for(var _0x124f88=0x0;_0x124f88<_0xe0cdba['conditions']['length'];_0x124f88++){var _0x3f42af=_0xe0cdba[_0xbb43('0x61')][_0x124f88];var _0x182c9b='i';var _0x474cee=_[_0xbb43('0x62')](_0x37afbb,['name',_0x3f42af['field']]);if(!_0x474cee){switch(_0x3f42af[_0xbb43('0x4b')]){case _0xbb43('0x63'):if(_0x3f42af[_0xbb43('0x64')]==0x1){_0x13d0a5[_0xbb43('0x65')]('`'+_0x3f42af[_0xbb43('0x4b')]+_0xbb43('0x66'));}else{_0x13d0a5[_0xbb43('0x65')]('`'+_0x3f42af[_0xbb43('0x4b')]+_0xbb43('0x67'));}break;case'Contact':if(_0x3f42af[_0xbb43('0x68')]===_0xbb43('0x69')){if(_0x3f42af[_0xbb43('0x64')][_0xbb43('0x6a')]('\x20')[_0xbb43('0x44')]>0x1){_0x59c805[_0x1dfbb9](_0xbb43('0x6b'),qs[_0xbb43('0x6c')](_0x3f42af[_0xbb43('0x64')]),null);}else{var _0x3e01e4='%'+_0x3f42af['value']+'%';_0x59c805[_0x1dfbb9]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3e01e4,_0x3e01e4,_0x3e01e4);}}else{_0x474cee=_[_0xbb43('0x62')](_0x37afbb,[_0xbb43('0x29'),_0xbb43('0x6d')]);_0x3f42af[_0xbb43('0x4b')]=_0xbb43('0x6d');_0xd3dcfc=as[_0xbb43('0x6e')](_0x182c9b,_0x474cee[_0xbb43('0x3b')],_0x3f42af);_0x59c805[_0x1dfbb9](_0xd3dcfc['text'],_0xd3dcfc[_0xbb43('0x64')]['start'],_0xd3dcfc['value'][_0xbb43('0x1c')]);}break;case _0xbb43('0x6f'):var _0x3cccea=_0x3f42af[_0xbb43('0x64')][_0xbb43('0x6a')](',')[_0xbb43('0x2b')](function(_0x18ee1a){return Number(_0x18ee1a);});_0x3cccea[_0xbb43('0x2f')](function(_0x51b076){_0x5c75ba['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x51b076+',%');});_0xb44557=_[_0xbb43('0x70')](_0xb44557,_0x3cccea);break;case _0xbb43('0x71'):if(_0x3f42af[_0xbb43('0x68')]===_0xbb43('0x69')){_0x59c805[_0x1dfbb9](_0xbb43('0x72'),'%'+_0x3f42af[_0xbb43('0x64')]+'%',null);}else{_0x474cee=_[_0xbb43('0x62')](_0x37afbb,[_0xbb43('0x29'),_0xbb43('0x73')]);_0x3f42af['field']=_0xbb43('0x73');_0xd3dcfc=as[_0xbb43('0x6e')](_0x182c9b,_0x474cee[_0xbb43('0x3b')],_0x3f42af);_0x59c805[_0x1dfbb9](_0xd3dcfc[_0xbb43('0x74')],_0xd3dcfc[_0xbb43('0x64')][_0xbb43('0x75')],_0xd3dcfc['value'][_0xbb43('0x1c')]);}break;case _0xbb43('0x76'):_0xd3dcfc=as[_0xbb43('0x6e')]('me',null,_0x3f42af);_0x59c805[_0x1dfbb9](_0xd3dcfc[_0xbb43('0x74')],_0xd3dcfc[_0xbb43('0x64')]['start'],_0xd3dcfc[_0xbb43('0x64')][_0xbb43('0x1c')]);break;}}else{var _0xd3dcfc=as[_0xbb43('0x6e')](_0x182c9b,_0x474cee[_0xbb43('0x3b')],_0x3f42af);_0x59c805[_0x1dfbb9](_0xd3dcfc[_0xbb43('0x74')],_0xd3dcfc[_0xbb43('0x64')][_0xbb43('0x75')],_0xd3dcfc[_0xbb43('0x64')][_0xbb43('0x1c')]);}}}else{var _0x580e75=_(_0x4a95c3[_0xbb43('0x3d')])['keys']()[_0xbb43('0x2b')](function(_0x2478fb){return _[_0xbb43('0x77')](_0x37afbb,[_0xbb43('0x29'),_0x2478fb])?_0x2478fb:undefined;})[_0xbb43('0x78')]()['value']();if(!_['isEmpty'](_0x580e75)){_0x580e75[_0xbb43('0x2f')](function(_0xa22c95){if(_0xa22c95==='MailAccountId'){_0x13d0a5[_0xbb43('0x49')](_0xbb43('0x79'),[][_0xbb43('0x7a')](_0x4a95c3[_0xbb43('0x3d')][_0xa22c95]));}else if(_0xa22c95===_0xbb43('0x7b')){var _0x298a77=JSON[_0xbb43('0x7c')](_0x4a95c3[_0xbb43('0x3d')][_0xa22c95])[_0xbb43('0x7d')];var _0xf2b3b0=JSON[_0xbb43('0x7c')](_0x4a95c3[_0xbb43('0x3d')][_0xa22c95])[_0xbb43('0x7e')];_0x13d0a5[_0xbb43('0x49')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x298a77,_0xf2b3b0);}else{if(_0x4a95c3['query'][_0xa22c95]===_0xbb43('0x7f')){_0x13d0a5[_0xbb43('0x49')]('i.'+_0xa22c95+_0xbb43('0x80'));}else{_0x13d0a5['where']('i.'+_0xa22c95+_0xbb43('0x81'),_0x4a95c3[_0xbb43('0x3d')][_0xa22c95]);}}});}if(_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x82')]){if(_0x4a95c3[_0xbb43('0x3d')]['read']==0x1){_0x13d0a5[_0xbb43('0x65')](_0xbb43('0x83'));}else{_0x13d0a5[_0xbb43('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x84')]){_0xb44557=_[_0xbb43('0x85')](_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x84')])?_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x84')]:new Array(_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x84')]);_0xb44557[_0xbb43('0x2f')](function(_0x445219){_0x5c75ba['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x445219+',%');});}if(_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x86')]){var _0x2d439f=_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x86')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2d439f)){_0x59c805['or'](_0xbb43('0x87'),_0x2d439f+'%');}else if(qs[_0xbb43('0x88')](_0x2d439f)){_0x59c805['or'](_0xbb43('0x89'),_0x2d439f+'%');}else{_0x59c805['or'](_0xbb43('0x8a'),qs[_0xbb43('0x6c')](_0x2d439f))['or'](_0xbb43('0x8b'),qs[_0xbb43('0x6c')](_0x2d439f));}}}_0x13d0a5['where'](_0x59c805);_0x13d0a5[_0xbb43('0x8c')](_0xbb43('0x8d'));var _0x3901c6={'type':db['Sequelize'][_0xbb43('0x8e')]['SELECT'],'raw':!![]};var _0x36f94e=_0x13d0a5['clone']();_0x36f94e[_0xbb43('0x4b')](_0xbb43('0x8d'));_0x36f94e[_0xbb43('0x4b')](_0xbb43('0x8f'),_0xbb43('0x63'));if(_0x2aa381[_0xbb43('0x47')]){_0x2aa381[_0xbb43('0x47')][_0xbb43('0x2f')](function(_0x4c4edb){var _0x708327=_0x4c4edb[0x0]===_0xbb43('0x90')?_0x4c4edb[0x0]:'i.'+_0x4c4edb[0x0];_0x13d0a5['order'](_0x708327,_0x4c4edb[0x1]===_0xbb43('0x91')?![]:!![]);});}if(!_[_0xbb43('0x92')](_0xb44557)){_0x13d0a5[_0xbb43('0x65')](_0x5c75ba);_0x36f94e['where'](_0xbb43('0x93'),_0xb44557);}BPromise[_0xbb43('0x94')]()[_0xbb43('0x25')](function(){if(!_0xe0cdba){if(_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x95')])return;_0x36f94e[_0xbb43('0x49')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x13d0a5[_0xbb43('0x49')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4a95c3[_0xbb43('0x96')][_0xbb43('0x97')]!=='agent')return;return _0x4a95c3[_0xbb43('0x96')][_0xbb43('0x98')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4cee72){if(_[_0xbb43('0x92')](_0x4cee72)){_0x36f94e[_0xbb43('0x49')](_0xbb43('0x99'));_0x13d0a5[_0xbb43('0x49')](_0xbb43('0x99'));}else{_0x36f94e[_0xbb43('0x49')](_0xbb43('0x79'),_[_0xbb43('0x2b')](_0x4cee72,'id'));_0x13d0a5[_0xbb43('0x49')](_0xbb43('0x79'),_['map'](_0x4cee72,'id'));}});})[_0xbb43('0x25')](function(){if(_0x4a95c3[_0xbb43('0x96')][_0xbb43('0x97')]==='agent'&&!_0xe0cdba&&!_0x4a95c3['query'][_0xbb43('0x95')])return[];return db[_0xbb43('0x9a')][_0xbb43('0x3d')](_0x36f94e[_0xbb43('0x9b')](),_0x3901c6);})['then'](function(_0x2814fc){_0x29f6e5['count']=_0x2814fc[_0xbb43('0x44')];if(_0x29f6e5[_0xbb43('0x1f')]===0x0)return[];return db[_0xbb43('0x9a')]['query'](_0x8c57af[_0xbb43('0x9b')](),_0x3901c6)[_0xbb43('0x25')](function(_0x47b468){_0x2eaece=_['keyBy'](_0x47b468,'id');_0x3901c6=_[_0xbb43('0x9c')](_0x3901c6,{'model':db[_0xbb43('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x43')]){_0x2aa381[_0xbb43('0x41')][_0xbb43('0x2f')](function(_0x32a2ae){_0x13d0a5[_0xbb43('0x4b')]('i.'+_0x32a2ae);});}else{_0x13d0a5['field'](_0xbb43('0x8f'),_0xbb43('0x63'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0x9d'),'Account.key');_0x13d0a5[_0xbb43('0x4b')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0x9e'),_0xbb43('0x90'));_0x13d0a5['field']('i.id');_0x13d0a5['field'](_0xbb43('0x9f'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xa0'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xa1'));_0x13d0a5['field'](_0xbb43('0xa2'));_0x13d0a5['field'](_0xbb43('0xa3'));_0x13d0a5['field']('i.lastMsgAt');_0x13d0a5['field'](_0xbb43('0xa4'));_0x13d0a5[_0xbb43('0x4b')]('i.subject');_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xa5'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xa6'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xa7'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xa8'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xa9'));_0x13d0a5[_0xbb43('0x4b')]('i.ContactId');_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xaa'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xab'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xac'),_0xbb43('0xad'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xae'),_0xbb43('0xaf'));_0x13d0a5[_0xbb43('0x4b')]('c.email','Contact.email');_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xb0'),'Contact.phone');_0x13d0a5[_0xbb43('0x4b')]('c.mobile',_0xbb43('0xb1'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xb2'),_0xbb43('0xb3'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xb4'),'Owner.fullname');_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xb5'),_0xbb43('0xb6'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xb7'),_0xbb43('0x2d'));}if(_0x2aa381[_0xbb43('0x21')])_0x13d0a5[_0xbb43('0x21')](_0x2aa381[_0xbb43('0x21')]);if(_0x2aa381[_0xbb43('0x20')])_0x13d0a5[_0xbb43('0x20')](_0x2aa381[_0xbb43('0x20')]);return db[_0xbb43('0x9a')][_0xbb43('0x3d')](_0x13d0a5[_0xbb43('0x9b')](),_0x3901c6);})['then'](function(_0x24fe48){_0x19c451[_0xbb43('0x49')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x24fe48,'id'));return db[_0xbb43('0x9a')]['query'](_0x19c451['toString'](),_0x3901c6)[_0xbb43('0x25')](function(_0x5d45da){var _0x395dfe=_[_0xbb43('0xb8')](_0x5d45da,_0xbb43('0xb9'));var _0x60dcf9=[];return db['Setting'][_0xbb43('0x32')]({'attributes':[_0xbb43('0xba')],'raw':!![]})[_0xbb43('0x25')](function(_0x5c65a1){var _0x263d28=_0x5c65a1[_0xbb43('0xba')];_0x24fe48['forEach'](function(_0x15b5c3){_0x60dcf9[_0xbb43('0x30')](updateMailInteraction(_0x15b5c3,_0x2eaece,_0x395dfe,_0x263d28));});return BPromise[_0xbb43('0xbb')](_0x60dcf9);});});});})[_0xbb43('0x25')](function(_0x61ff2f){_0x29f6e5[_0xbb43('0xbc')]=_0x61ff2f;return _0x29f6e5;})[_0xbb43('0x25')](respondWithFilteredResult(_0x4847df,_0x2aa381))[_0xbb43('0x37')](handleError(_0x4847df,null));};exports[_0xbb43('0xbd')]=function(_0x2703cf,_0xda0e5d){var _0x3c4d95={'raw':![],'where':{'id':_0x2703cf[_0xbb43('0xbe')]['id']}},_0x2aef2f={};_0x2aef2f['model']=_[_0xbb43('0x3e')](db[_0xbb43('0x31')][_0xbb43('0x39')]);_0x2aef2f[_0xbb43('0x3d')]=_['keys'](_0x2703cf[_0xbb43('0x3d')]);_0x2aef2f[_0xbb43('0x3f')]=_[_0xbb43('0x42')](_0x2aef2f[_0xbb43('0x40')],_0x2aef2f[_0xbb43('0x3d')]);_0x3c4d95['attributes']=_[_0xbb43('0x42')](_0x2aef2f[_0xbb43('0x40')],qs['fields'](_0x2703cf[_0xbb43('0x3d')][_0xbb43('0x43')]));_0x3c4d95['attributes']=_0x3c4d95[_0xbb43('0x41')][_0xbb43('0x44')]?_0x3c4d95[_0xbb43('0x41')]:_0x2aef2f[_0xbb43('0x40')];if(_0x2703cf[_0xbb43('0x3d')]['includeAll']){_0x3c4d95[_0xbb43('0xbf')]=[{'all':!![]}];}_0x3c4d95=_[_0xbb43('0x9c')]({},_0x3c4d95,_0x2703cf[_0xbb43('0xc0')]);return db[_0xbb43('0x31')][_0xbb43('0x62')](_0x3c4d95)['then'](handleEntityNotFound(_0xda0e5d,null))[_0xbb43('0x25')](respondWithResult(_0xda0e5d,null))['catch'](handleError(_0xda0e5d,null));};exports['create']=function(_0x247002,_0x54fd3b){return db[_0xbb43('0x31')][_0xbb43('0xc1')](_0x247002[_0xbb43('0xc2')],{})[_0xbb43('0x25')](respondWithResult(_0x54fd3b,0xc9))['catch'](handleError(_0x54fd3b,null));};exports['update']=function(_0x51eece,_0xe7b08a){if(_0x51eece[_0xbb43('0xc2')]['id']){delete _0x51eece[_0xbb43('0xc2')]['id'];}return db[_0xbb43('0x31')][_0xbb43('0x62')]({'where':{'id':_0x51eece[_0xbb43('0xbe')]['id']}})[_0xbb43('0x25')](handleEntityNotFound(_0xe7b08a,null))[_0xbb43('0x25')](saveUpdates(_0x51eece['body'],null))[_0xbb43('0x25')](respondWithResult(_0xe7b08a,null))['catch'](handleError(_0xe7b08a,null));};exports[_0xbb43('0x26')]=function(_0x4c5500,_0x1a4089){return db[_0xbb43('0x31')][_0xbb43('0x62')]({'where':{'id':_0x4c5500[_0xbb43('0xbe')]['id']}})[_0xbb43('0x25')](handleEntityNotFound(_0x1a4089,null))[_0xbb43('0x25')](removeEntity(_0x1a4089,null))[_0xbb43('0x37')](handleError(_0x1a4089,null));};exports['describe']=function(_0x115fef,_0x38cf36){return db[_0xbb43('0x31')][_0xbb43('0xc3')]()[_0xbb43('0x25')](respondWithResult(_0x38cf36,null))[_0xbb43('0x37')](handleError(_0x38cf36,null));};exports['addMessage']=function(_0x217127,_0x2965ec,_0x855367){return db[_0xbb43('0xc4')][_0xbb43('0x62')]({'where':{'id':_0x217127[_0xbb43('0xbe')]['id']}})[_0xbb43('0x25')](handleEntityNotFound(_0x2965ec,null))[_0xbb43('0x25')](function(_0xc4893f){if(_0xc4893f){return _0xc4893f['addMessage'](_0x217127[_0xbb43('0xc2')][_0xbb43('0xc5')],_[_0xbb43('0xc6')](_0x217127['body'],[_0xbb43('0xc5'),'id'])||{});}})['then'](respondWithResult(_0x2965ec,null))['catch'](handleError(_0x2965ec,null));};exports[_0xbb43('0xc7')]=function(_0x17d7c4,_0x524085,_0x15ce03){var _0x48d864={'raw':![],'where':{}};var _0x2d1b62={};var _0xdc226f={'count':0x0,'rows':[]};return db[_0xbb43('0x31')]['findOne']({'where':{'id':_0x17d7c4['params']['id']}})['then'](handleEntityNotFound(_0x524085,null))[_0xbb43('0x25')](function(_0x421626){if(_0x421626){_0x2d1b62[_0xbb43('0x40')]=_[_0xbb43('0x3e')](db[_0xbb43('0xc4')]['rawAttributes']);_0x2d1b62[_0xbb43('0x3d')]=_[_0xbb43('0x3e')](_0x17d7c4[_0xbb43('0x3d')]);_0x2d1b62[_0xbb43('0x3f')]=_[_0xbb43('0x42')](_0x2d1b62[_0xbb43('0x40')],_0x2d1b62['query']);_0x48d864['attributes']=_[_0xbb43('0x42')](_0x2d1b62[_0xbb43('0x40')],qs['fields'](_0x17d7c4['query'][_0xbb43('0x43')]));_0x48d864['attributes']=_0x48d864[_0xbb43('0x41')][_0xbb43('0x44')]?_0x48d864[_0xbb43('0x41')]:_0x2d1b62[_0xbb43('0x40')];if(!_0x17d7c4['query'][_0xbb43('0x45')](_0xbb43('0x46'))){_0x48d864[_0xbb43('0x21')]=qs[_0xbb43('0x21')](_0x17d7c4[_0xbb43('0x3d')][_0xbb43('0x21')]);_0x48d864['offset']=qs['offset'](_0x17d7c4[_0xbb43('0x3d')][_0xbb43('0x20')]);}_0x48d864[_0xbb43('0x47')]=qs[_0xbb43('0x48')](_0x17d7c4[_0xbb43('0x3d')]['sort']);_0x48d864['where']=qs[_0xbb43('0x3f')](_[_0xbb43('0x4a')](_0x17d7c4[_0xbb43('0x3d')],_0x2d1b62['filters']));_0x48d864[_0xbb43('0x49')][_0xbb43('0xb9')]=_0x421626['id'];if(_0x17d7c4[_0xbb43('0x3d')]['filter']){_0x48d864[_0xbb43('0x49')]=_['merge'](_0x48d864[_0xbb43('0x49')],{'$or':_[_0xbb43('0x2b')](_0x48d864[_0xbb43('0x41')],function(_0x51fcf2){var _0x449d91={};_0x449d91[_0x51fcf2]={'$like':'%'+_0x17d7c4[_0xbb43('0x3d')][_0xbb43('0x86')]+'%'};return _0x449d91;})});}if(_0x17d7c4[_0xbb43('0x3d')][_0xbb43('0x7d')]){var _0x34e8b8=_0x17d7c4[_0xbb43('0x3d')][_0xbb43('0x7d')][_0xbb43('0x6a')](',');var _0x38f5a6={};_0x38f5a6[_0x34e8b8[0x0]]={'$gte':moment(_0x34e8b8[0x1])[_0xbb43('0xc8')](_0xbb43('0xc9'))};_0x48d864[_0xbb43('0x49')]=_[_0xbb43('0x9c')](_0x48d864['where'],_0x38f5a6);}_0x48d864=_[_0xbb43('0x9c')]({},_0x48d864,_0x17d7c4[_0xbb43('0xc0')]);return db[_0xbb43('0xc4')][_0xbb43('0x1f')]({'where':_0x48d864[_0xbb43('0x49')]})[_0xbb43('0x25')](function(_0x1091fa){_0xdc226f[_0xbb43('0x1f')]=_0x1091fa;if(_0x17d7c4[_0xbb43('0x3d')][_0xbb43('0xca')]){_0x48d864[_0xbb43('0xbf')]=[{'all':!![]}];}return db[_0xbb43('0xc4')][_0xbb43('0xcb')](_0x48d864);})[_0xbb43('0x25')](function(_0x199b58){if(_0x17d7c4[_0xbb43('0x3d')][_0xbb43('0xcc')]==='true'){for(var _0x3034fa=0x0;_0x3034fa<_0x199b58['length'];_0x3034fa++){_0x199b58[_0x3034fa]['body']=juice(_0x199b58[_0x3034fa][_0xbb43('0xc2')]);}}_0xdc226f[_0xbb43('0xbc')]=_0x199b58;return _0xdc226f;});}})['then'](respondWithFilteredResult(_0x524085,_0x48d864))['catch'](handleError(_0x524085,null));};exports[_0xbb43('0xcd')]=function(_0x5911fc,_0x4d22e9,_0x35c678){return db['MailInteraction'][_0xbb43('0x62')]({'where':{'id':_0x5911fc['params']['id']}})[_0xbb43('0x25')](handleEntityNotFound(_0x4d22e9,null))[_0xbb43('0x25')](function(_0x591ffe){if(_0x591ffe){return _0x591ffe[_0xbb43('0xce')](_0x5911fc[_0xbb43('0xc2')][_0xbb43('0xc5')],_[_0xbb43('0xc6')](_0x5911fc[_0xbb43('0xc2')],['ids','id'])||{})[_0xbb43('0xcf')](function(){return db[_0xbb43('0x6f')][_0xbb43('0xcb')]({'attributes':['id',_0xbb43('0x29'),_0xbb43('0xd0')],'where':{'id':_0x5911fc['body'][_0xbb43('0xc5')]}});})[_0xbb43('0x25')](function(_0x27c371){socket['emit']('mailInteractionTags:save',{'id':Number(_0x5911fc[_0xbb43('0xbe')]['id']),'tags':_0x27c371||[]});return{'id':Number(_0x5911fc[_0xbb43('0xbe')]['id']),'tags':_0x27c371||[]};});}})[_0xbb43('0x25')](respondWithResult(_0x4d22e9,null))['catch'](handleError(_0x4d22e9,null));};exports['removeTags']=function(_0x43d2da,_0x1ab4c4,_0x35f06d){return db[_0xbb43('0x31')][_0xbb43('0x62')]({'where':{'id':_0x43d2da['params']['id']}})[_0xbb43('0x25')](handleEntityNotFound(_0x1ab4c4,null))[_0xbb43('0x25')](function(_0x1b0194){if(_0x1b0194){return _0x1b0194[_0xbb43('0xd1')](_0x43d2da[_0xbb43('0x3d')][_0xbb43('0xc5')]);}})['then'](respondWithStatusCode(_0x1ab4c4,null))[_0xbb43('0x37')](handleError(_0x1ab4c4,null));};exports[_0xbb43('0xd2')]=function(_0x12f7a9,_0x5166b9){var _0x3a3990=moment()['unix']()[_0xbb43('0x9b')]();var _0x3653e3=path[_0xbb43('0xd3')](config[_0xbb43('0xd4')],'server',_0xbb43('0xd5'),'tmp');var _0x108ac8=path[_0xbb43('0xd3')](config[_0xbb43('0xd4')],_0xbb43('0xd6'),_0xbb43('0xd5'),'attachments');var _0x767db5=path[_0xbb43('0xd3')](_0x3653e3,_0x3a3990);var _0x9ef7dd=util[_0xbb43('0xc8')](_0xbb43('0xd7'),_0x12f7a9['params']['id'],_0x3a3990);var _0x1ba8b8=path[_0xbb43('0xd3')](_0x3653e3,_0x9ef7dd);var _0x39c8fd=[];if(_0x12f7a9['query'][_0xbb43('0xd8')]){_0x39c8fd['push']({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x585f71=[{'model':db[_0xbb43('0xc4')],'as':'Messages','attributes':['id',_0xbb43('0xc2'),_0xbb43('0x4c'),'to','cc',_0xbb43('0xd9'),_0xbb43('0xda'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb43('0x48')]('id'),'include':_0x39c8fd}];return db[_0xbb43('0x31')]['find']({'where':{'id':_0x12f7a9[_0xbb43('0xbe')]['id']},'include':_0x585f71})[_0xbb43('0x25')](handleEntityNotFound(_0x5166b9,null))['then'](function(_0x4df644){if(_0x4df644&&_0x4df644[_0xbb43('0xdb')]){var _0x249cf5=_0x4df644[_0xbb43('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x767db5);return BPromise[_0xbb43('0xdd')](_0x249cf5['Messages'],function(_0x448d75,_0x33edab){var _0x44ddc0={'from':_0x448d75[_0xbb43('0x4c')],'to':_0x448d75['to'],'subject':_0x448d75['subject'],'html':_0x448d75[_0xbb43('0xc2')],'headers':{'Date':moment(_0x448d75[_0xbb43('0x7b')])[_0xbb43('0xc8')](_0xbb43('0xde'))},'attachments':[]};if(_0x448d75['cc']){_0x44ddc0[_0xbb43('0xdf')]['Cc']=_0x448d75['cc'];}if(_0x448d75['bcc']){_0x44ddc0[_0xbb43('0xdf')][_0xbb43('0xe0')]=_0x448d75['bcc'];}return new BPromise(function(_0x5a87b3,_0x1d5cff){if(_0x448d75['Attachments']){for(var _0x2e3dbb=0x0;_0x2e3dbb<_0x448d75[_0xbb43('0xe1')][_0xbb43('0x44')];_0x2e3dbb++){var _0x114e8c=_0x448d75[_0xbb43('0xe1')][_0x2e3dbb];var _0xacec65=path[_0xbb43('0xd3')](_0x108ac8,_0x114e8c[_0xbb43('0xe2')]);if(fs[_0xbb43('0xe3')](_0xacec65)){_0x44ddc0[_0xbb43('0xd8')]['push']({'name':_0x114e8c[_0xbb43('0x29')],'contentType':_0x114e8c[_0xbb43('0x3b')],'data':fs[_0xbb43('0xe4')](_0xacec65)});}}}emlformat['build'](_0x44ddc0,function(_0x341065,_0x36909d){if(_0x341065)return _0x1d5cff(_0x341065);fs[_0xbb43('0xe5')](path[_0xbb43('0xd3')](_0x767db5,util[_0xbb43('0xc8')]('message%d.eml',_0x33edab)),_0x36909d);return _0x5a87b3(_0x36909d);});});})[_0xbb43('0x25')](function(){return new BPromise(function(_0x5c32a0,_0x5d600f){zipdir(_0x767db5,{'saveTo':_0x1ba8b8},function(_0x48d9c4,_0x5ae452){if(_0x48d9c4)return _0x5d600f(_0x48d9c4);return _0x5c32a0(_0x5ae452);});})[_0xbb43('0x25')](function(){return new BPromise(function(_0x35b9c5,_0x2c2cd5){rimraf(_0x767db5,function(_0x45ff85){if(_0x45ff85)_0x2c2cd5(_0x45ff85);return _0x35b9c5();});});})[_0xbb43('0x25')](function(){return _0x5166b9[_0xbb43('0xd2')](_0x1ba8b8,_0x9ef7dd,function(_0x108e6d){if(_0x108e6d){console['log'](_0xbb43('0xe6'),_0x108e6d);}else{fs[_0xbb43('0xe7')](_0x1ba8b8);}});});});}else{return _0x5166b9[_0xbb43('0xe8')](0xc8);}})[_0xbb43('0x37')](handleError(_0x5166b9,null));}; \ No newline at end of file +var _0xbdb7=['i.thirdDisposition','i.MailAccountId','i.UserId','c.lastName','Contact.lastName','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','enableEmailPreview','all','show','params','rawAttributes','includeAll','include','options','create','body','destroy','describe','MailMessage','addMessage','ids','getMessages','findOne','nolimit','pick','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','omit','spread','emit','mailInteractionTags:save','download','unix','join','root','files','server','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','createdAt','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','build','writeFileSync','message%d.eml','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','crypto','jsforce','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','fullname','TagIds','Tags','push','MailInteraction','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','filters','select','field','color','from','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','users','left_join','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','expr','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','plainBody','buildExpression','some','compact','isEmpty','MailAccountId','where','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20>\x200','tag','filter','replace','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.updatedAt','i.closedAt','i.attach','i.lastMsgDirection','i.subject'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x59eacf,_0x56ec4a){_0x59eacf=_0x59eacf-0x0;var _0x5d74f2=_0xbdb7[_0x59eacf];return _0x5d74f2;};'use strict';var pdf=require(_0x7bdb('0x0'));var emlformat=require(_0x7bdb('0x1'));var rimraf=require(_0x7bdb('0x2'));var zipdir=require(_0x7bdb('0x3'));var jsonpatch=require(_0x7bdb('0x4'));var rp=require(_0x7bdb('0x5'));var moment=require(_0x7bdb('0x6'));var BPromise=require(_0x7bdb('0x7'));var Mustache=require(_0x7bdb('0x8'));var util=require('util');var path=require(_0x7bdb('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7bdb('0xa'));var fs=require('fs');var fs_extra=require(_0x7bdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7bdb('0xc'));var jsforce=require(_0x7bdb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7bdb('0xe'));var Papa=require(_0x7bdb('0xf'));var htmlToText=require(_0x7bdb('0x10'));var juice=require(_0x7bdb('0x11'));var Redis=require(_0x7bdb('0x12'));var authService=require(_0x7bdb('0x13'));var qs=require(_0x7bdb('0x14'));var as=require(_0x7bdb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7bdb('0x16'));var config=require(_0x7bdb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x18'))['db'];config['redis']=_['defaults'](config[_0x7bdb('0x19')],{'host':_0x7bdb('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailInteraction.socket')[_0x7bdb('0x1b')](socket);function respondWithStatusCode(_0x195b2e,_0xe9919f){_0xe9919f=_0xe9919f||0xcc;return function(_0x25d417){if(_0x25d417){return _0x195b2e[_0x7bdb('0x1c')](_0xe9919f);}return _0x195b2e[_0x7bdb('0x1d')](_0xe9919f)[_0x7bdb('0x1e')]();};}function respondWithResult(_0x1b2d9b,_0x54b9ce){_0x54b9ce=_0x54b9ce||0xc8;return function(_0x1c5750){if(_0x1c5750){return _0x1b2d9b[_0x7bdb('0x1d')](_0x54b9ce)[_0x7bdb('0x1f')](_0x1c5750);}};}function respondWithFilteredResult(_0x2aff6a,_0x4ffd4b){return function(_0x41f540){if(_0x41f540){var _0x23e9eb=_0x41f540[_0x7bdb('0x20')],_0x5b8481=_0x4ffd4b[_0x7bdb('0x21')],_0x3e5f8e=_0x4ffd4b[_0x7bdb('0x21')]+_0x4ffd4b['limit'],_0x31f78e;if(_0x3e5f8e>=_0x23e9eb){_0x3e5f8e=_0x23e9eb;_0x31f78e=0xc8;}else{_0x31f78e=0xce;}_0x2aff6a['status'](_0x31f78e);return _0x2aff6a[_0x7bdb('0x22')](_0x7bdb('0x23'),_0x5b8481+'-'+_0x3e5f8e+'/'+_0x23e9eb)['json'](_0x41f540);}return null;};}function patchUpdates(_0x341fe4){return function(_0x118ea1){try{jsonpatch[_0x7bdb('0x24')](_0x118ea1,_0x341fe4,!![]);}catch(_0x3f53e7){return BPromise[_0x7bdb('0x25')](_0x3f53e7);}return _0x118ea1['save']();};}function saveUpdates(_0x1d37ac,_0xdad53d){return function(_0x40c447){if(_0x40c447){return _0x40c447[_0x7bdb('0x26')](_0x1d37ac)['then'](function(_0x4d6e44){return _0x4d6e44;});}return null;};}function removeEntity(_0x3c423f,_0x5eface){return function(_0x47abaf){if(_0x47abaf){return _0x47abaf['destroy']()[_0x7bdb('0x27')](function(){_0x3c423f['status'](0xcc)[_0x7bdb('0x1e')]();});}};}function handleEntityNotFound(_0x72ba69,_0x3ec129){return function(_0x7c09cf){if(!_0x7c09cf){_0x72ba69[_0x7bdb('0x1c')](0x194);}return _0x7c09cf;};}function handleError(_0x523869,_0x10e818){_0x10e818=_0x10e818||0x1f4;return function(_0x32242d){logger[_0x7bdb('0x28')](_0x32242d[_0x7bdb('0x29')]);if(_0x32242d[_0x7bdb('0x2a')]){delete _0x32242d[_0x7bdb('0x2a')];}_0x523869[_0x7bdb('0x1d')](_0x10e818)[_0x7bdb('0x2b')](_0x32242d);};}function getInteractionUsers(_0x25a1fe,_0x365c02){return new BPromise(function(_0x9ec48d,_0x81ca6f){try{if(_0x365c02[_0x25a1fe['id']]){_0x25a1fe['Users']=_[_0x7bdb('0x2c')](_0x365c02[_0x25a1fe['id']],function(_0x23fc3a){return{'id':_0x23fc3a['id'],'fullname':_0x23fc3a[_0x7bdb('0x2d')]};});}}catch(_0x9f5c1){_0x81ca6f(_0x9f5c1);}_0x9ec48d(_0x25a1fe);});}function getInteractionTags(_0x29eac5,_0x5da819){return new BPromise(function(_0x28aa2f,_0x43054c){try{if(_0x29eac5[_0x7bdb('0x2e')]){_0x29eac5[_0x7bdb('0x2f')]=[];_0x29eac5['TagIds']['split'](',')['forEach'](function(_0x2304b1){_0x29eac5['Tags'][_0x7bdb('0x30')](_0x5da819[_0x2304b1]);});}delete _0x29eac5['TagIds'];}catch(_0x23e5b2){_0x43054c(_0x23e5b2);}_0x28aa2f(_0x29eac5);});}function getLastMessageText(_0x438ee5){return new BPromise(function(_0x1cf75a,_0x4b40a3){return db[_0x7bdb('0x31')]['findOne']({'where':{'id':_0x438ee5['id']},'attributes':['lastMsgBody',_0x7bdb('0x32')],'raw':!![]})['then'](function(_0x208cc9){if(!_0x208cc9['lastMsgText']){_0x438ee5['lastMsgText']=_[_0x7bdb('0x33')](htmlToText[_0x7bdb('0x34')](_0x208cc9[_0x7bdb('0x35')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x438ee5[_0x7bdb('0x32')]=_0x208cc9[_0x7bdb('0x32')];}_0x1cf75a(_0x438ee5);})[_0x7bdb('0x36')](function(_0x59e269){_0x4b40a3(_0x59e269);});});}function updateMailInteraction(_0x46aa93,_0x464fde,_0x329ecf,_0x3d1537){return new BPromise(function(_0x26de16,_0x14c522){return getInteractionUsers(_0x46aa93,_0x329ecf)[_0x7bdb('0x27')](function(_0x2587af){return getInteractionTags(_0x2587af,_0x464fde);})[_0x7bdb('0x27')](function(_0x4e1c97){if(_0x3d1537){_0x26de16(getLastMessageText(_0x4e1c97));}else{_0x26de16(_0x4e1c97);}})['catch'](function(_0x19c237){_0x14c522(_0x19c237);});});}exports[_0x7bdb('0x37')]=function(_0x2de3c1,_0x395699){var _0x3732b2={},_0x509e90={},_0x55f020={'count':0x0,'rows':[]};var _0x27164f=_['map'](db[_0x7bdb('0x31')]['rawAttributes'],function(_0x212b50){return{'name':_0x212b50['fieldName'],'type':_0x212b50['type'][_0x7bdb('0x38')]};});_0x509e90[_0x7bdb('0x39')]=_[_0x7bdb('0x2c')](_0x27164f,_0x7bdb('0x2a'));_0x509e90[_0x7bdb('0x3a')]=_[_0x7bdb('0x3b')](_0x2de3c1[_0x7bdb('0x3a')]);_0x509e90['filters']=_['intersection'](_0x509e90[_0x7bdb('0x39')],_0x509e90[_0x7bdb('0x3a')]);_0x3732b2[_0x7bdb('0x3c')]=_[_0x7bdb('0x3d')](_0x509e90[_0x7bdb('0x39')],qs[_0x7bdb('0x3e')](_0x2de3c1[_0x7bdb('0x3a')]['fields']));_0x3732b2['attributes']=_0x3732b2[_0x7bdb('0x3c')][_0x7bdb('0x3f')]?_0x3732b2[_0x7bdb('0x3c')]:_0x509e90[_0x7bdb('0x39')];if(!_0x2de3c1['query'][_0x7bdb('0x40')]('nolimit')){_0x3732b2[_0x7bdb('0x41')]=qs[_0x7bdb('0x41')](_0x2de3c1[_0x7bdb('0x3a')][_0x7bdb('0x41')]);_0x3732b2[_0x7bdb('0x21')]=qs[_0x7bdb('0x21')](_0x2de3c1[_0x7bdb('0x3a')][_0x7bdb('0x21')]);}_0x3732b2[_0x7bdb('0x42')]=qs['sort'](_0x2de3c1[_0x7bdb('0x3a')][_0x7bdb('0x43')]);_0x3732b2['where']=qs[_0x7bdb('0x44')](_['pick'](_0x2de3c1[_0x7bdb('0x3a')],_0x509e90[_0x7bdb('0x44')]),_0x27164f);var _0x122beb=[];var _0x3a8415=squel[_0x7bdb('0x45')]()['field']('id')[_0x7bdb('0x46')](_0x7bdb('0x2a'))[_0x7bdb('0x46')](_0x7bdb('0x47'))[_0x7bdb('0x48')]('tools_tags');var _0x26db62=squel[_0x7bdb('0x45')]()[_0x7bdb('0x46')](_0x7bdb('0x49'))[_0x7bdb('0x46')](_0x7bdb('0x4a'))[_0x7bdb('0x46')](_0x7bdb('0x4b'))[_0x7bdb('0x48')](_0x7bdb('0x4c'),'ui')['left_join'](_0x7bdb('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x47cccd=squel[_0x7bdb('0x45')]()[_0x7bdb('0x48')]('mail_interactions','i')[_0x7bdb('0x4e')](_0x7bdb('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x7bdb('0x50'))[_0x7bdb('0x4e')](_0x7bdb('0x51'),'a',_0x7bdb('0x52'))[_0x7bdb('0x4e')](_0x7bdb('0x53'),'me',_0x7bdb('0x54'))[_0x7bdb('0x4e')](_0x7bdb('0x55'),'it',_0x7bdb('0x56'))['left_join'](_0x7bdb('0x57'),'t','t.id\x20=\x20it.TagId');var _0x240425=squel[_0x7bdb('0x58')]();var _0x5d564d=[];var _0x457886=squel['expr']();var _0x258f29;if(_0x2de3c1['query']['search']){_0x258f29=as[_0x7bdb('0x59')](_0x2de3c1[_0x7bdb('0x3a')]['search']);var _0x4e17f3=_0x258f29['sqlOperator'];for(var _0x3e574e=0x0;_0x3e574e<_0x258f29['conditions']['length'];_0x3e574e++){var _0x12a101=_0x258f29[_0x7bdb('0x5a')][_0x3e574e];var _0x30f89e='i';var _0x148280=_['find'](_0x27164f,[_0x7bdb('0x2a'),_0x12a101['field']]);if(!_0x148280){switch(_0x12a101[_0x7bdb('0x46')]){case _0x7bdb('0x5b'):if(_0x12a101[_0x7bdb('0x5c')]==0x1){_0x47cccd[_0x7bdb('0x5d')]('`'+_0x12a101[_0x7bdb('0x46')]+_0x7bdb('0x5e'));}else{_0x47cccd['having']('`'+_0x12a101[_0x7bdb('0x46')]+_0x7bdb('0x5f'));}break;case _0x7bdb('0x60'):if(_0x12a101['operator']===_0x7bdb('0x61')){if(_0x12a101[_0x7bdb('0x5c')]['split']('\x20')[_0x7bdb('0x3f')]>0x1){_0x240425[_0x4e17f3]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7bdb('0x62')](_0x12a101[_0x7bdb('0x5c')]),null);}else{var _0x4f3f8c='%'+_0x12a101['value']+'%';_0x240425[_0x4e17f3](_0x7bdb('0x63'),_0x4f3f8c,_0x4f3f8c,_0x4f3f8c);}}else{_0x148280=_[_0x7bdb('0x64')](_0x27164f,['name',_0x7bdb('0x65')]);_0x12a101['field']=_0x7bdb('0x65');_0x16141d=as['buildExpression'](_0x30f89e,_0x148280['type'],_0x12a101);_0x240425[_0x4e17f3](_0x16141d[_0x7bdb('0x66')],_0x16141d[_0x7bdb('0x5c')][_0x7bdb('0x67')],_0x16141d[_0x7bdb('0x5c')][_0x7bdb('0x1e')]);}break;case _0x7bdb('0x68'):var _0x3141c2=_0x12a101[_0x7bdb('0x5c')][_0x7bdb('0x69')](',')[_0x7bdb('0x2c')](function(_0x414ac7){return Number(_0x414ac7);});_0x3141c2[_0x7bdb('0x6a')](function(_0x4b9970){_0x457886['or'](_0x7bdb('0x6b'),'%,'+_0x4b9970+',%');});_0x5d564d=_[_0x7bdb('0x6c')](_0x5d564d,_0x3141c2);break;case'User':if(_0x12a101[_0x7bdb('0x6d')]===_0x7bdb('0x61')){_0x240425[_0x4e17f3](_0x7bdb('0x6e'),'%'+_0x12a101[_0x7bdb('0x5c')]+'%',null);}else{_0x148280=_[_0x7bdb('0x64')](_0x27164f,['name',_0x7bdb('0x6f')]);_0x12a101[_0x7bdb('0x46')]=_0x7bdb('0x6f');_0x16141d=as['buildExpression'](_0x30f89e,_0x148280[_0x7bdb('0x70')],_0x12a101);_0x240425[_0x4e17f3](_0x16141d[_0x7bdb('0x66')],_0x16141d[_0x7bdb('0x5c')][_0x7bdb('0x67')],_0x16141d[_0x7bdb('0x5c')][_0x7bdb('0x1e')]);}break;case _0x7bdb('0x71'):_0x16141d=as[_0x7bdb('0x72')]('me',null,_0x12a101);_0x240425[_0x4e17f3](_0x16141d[_0x7bdb('0x66')],_0x16141d['value'][_0x7bdb('0x67')],_0x16141d[_0x7bdb('0x5c')][_0x7bdb('0x1e')]);break;}}else{var _0x16141d=as[_0x7bdb('0x72')](_0x30f89e,_0x148280[_0x7bdb('0x70')],_0x12a101);_0x240425[_0x4e17f3](_0x16141d[_0x7bdb('0x66')],_0x16141d[_0x7bdb('0x5c')][_0x7bdb('0x67')],_0x16141d[_0x7bdb('0x5c')][_0x7bdb('0x1e')]);}}}else{var _0x3dbcc8=_(_0x2de3c1[_0x7bdb('0x3a')])['keys']()[_0x7bdb('0x2c')](function(_0x4d878f){return _[_0x7bdb('0x73')](_0x27164f,[_0x7bdb('0x2a'),_0x4d878f])?_0x4d878f:undefined;})[_0x7bdb('0x74')]()['value']();if(!_[_0x7bdb('0x75')](_0x3dbcc8)){_0x3dbcc8[_0x7bdb('0x6a')](function(_0x4ebc9f){if(_0x4ebc9f===_0x7bdb('0x76')){_0x47cccd[_0x7bdb('0x77')]('i.MailAccountId\x20IN\x20?',[][_0x7bdb('0x78')](_0x2de3c1[_0x7bdb('0x3a')][_0x4ebc9f]));}else if(_0x4ebc9f==='createdAt'){var _0x291fd3=JSON[_0x7bdb('0x79')](_0x2de3c1['query'][_0x4ebc9f])[_0x7bdb('0x7a')];var _0x2b3f2a=JSON['parse'](_0x2de3c1[_0x7bdb('0x3a')][_0x4ebc9f])['$lte'];_0x47cccd[_0x7bdb('0x77')](_0x7bdb('0x7b'),_0x291fd3,_0x2b3f2a);}else{if(_0x2de3c1[_0x7bdb('0x3a')][_0x4ebc9f]===_0x7bdb('0x7c')){_0x47cccd[_0x7bdb('0x77')]('i.'+_0x4ebc9f+'\x20IS\x20NULL');}else{_0x47cccd['where']('i.'+_0x4ebc9f+'\x20=\x20?',_0x2de3c1[_0x7bdb('0x3a')][_0x4ebc9f]);}}});}if(_0x2de3c1['query'][_0x7bdb('0x7d')]){if(_0x2de3c1[_0x7bdb('0x3a')][_0x7bdb('0x7d')]==0x1){_0x47cccd['having']('`unreadMessages`\x20=\x200');}else{_0x47cccd[_0x7bdb('0x5d')](_0x7bdb('0x7e'));}}if(_0x2de3c1[_0x7bdb('0x3a')][_0x7bdb('0x7f')]){_0x5d564d=_['isArray'](_0x2de3c1[_0x7bdb('0x3a')][_0x7bdb('0x7f')])?_0x2de3c1[_0x7bdb('0x3a')][_0x7bdb('0x7f')]:new Array(_0x2de3c1[_0x7bdb('0x3a')][_0x7bdb('0x7f')]);_0x5d564d['forEach'](function(_0x2de47c){_0x457886['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2de47c+',%');});}if(_0x2de3c1[_0x7bdb('0x3a')]['filter']){var _0x6a8f7e=_0x2de3c1[_0x7bdb('0x3a')][_0x7bdb('0x80')][_0x7bdb('0x81')]('\x5c','\x5c\x5c')[_0x7bdb('0x81')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x6a8f7e)){_0x240425['or']('i.id\x20LIKE\x20?',_0x6a8f7e+'%');}else if(qs[_0x7bdb('0x82')](_0x6a8f7e)){_0x240425['or'](_0x7bdb('0x83'),_0x6a8f7e+'%');}else{_0x240425['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7bdb('0x62')](_0x6a8f7e))['or'](_0x7bdb('0x84'),qs['getFullTextValue'](_0x6a8f7e));}}}_0x47cccd[_0x7bdb('0x77')](_0x240425);_0x47cccd[_0x7bdb('0x85')]('i.id');var _0x40f635={'type':db['Sequelize']['QueryTypes'][_0x7bdb('0x86')],'raw':!![]};var _0x43e097=_0x47cccd['clone']();_0x43e097['field'](_0x7bdb('0x87'));_0x43e097['field'](_0x7bdb('0x88'),'unreadMessages');if(_0x3732b2[_0x7bdb('0x42')]){_0x3732b2[_0x7bdb('0x42')][_0x7bdb('0x6a')](function(_0xee0862){var _0x537377=_0xee0862[0x0]===_0x7bdb('0x89')?_0xee0862[0x0]:'i.'+_0xee0862[0x0];_0x47cccd[_0x7bdb('0x42')](_0x537377,_0xee0862[0x1]==='DESC'?![]:!![]);});}if(!_[_0x7bdb('0x75')](_0x5d564d)){_0x47cccd[_0x7bdb('0x5d')](_0x457886);_0x43e097['where'](_0x7bdb('0x8a'),_0x5d564d);}BPromise[_0x7bdb('0x8b')]()[_0x7bdb('0x27')](function(){if(!_0x258f29){if(_0x2de3c1[_0x7bdb('0x3a')]['MailAccountId'])return;_0x43e097[_0x7bdb('0x77')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x47cccd[_0x7bdb('0x77')](_0x7bdb('0x8c'));return;}if(_0x2de3c1[_0x7bdb('0x8d')]['role']!==_0x7bdb('0x8e'))return;return _0x2de3c1[_0x7bdb('0x8d')][_0x7bdb('0x8f')]({'attributes':['id'],'raw':!![]})[_0x7bdb('0x27')](function(_0xc444ef){if(_[_0x7bdb('0x75')](_0xc444ef)){_0x43e097[_0x7bdb('0x77')](_0x7bdb('0x90'));_0x47cccd[_0x7bdb('0x77')](_0x7bdb('0x90'));}else{_0x43e097[_0x7bdb('0x77')](_0x7bdb('0x91'),_[_0x7bdb('0x2c')](_0xc444ef,'id'));_0x47cccd[_0x7bdb('0x77')](_0x7bdb('0x91'),_[_0x7bdb('0x2c')](_0xc444ef,'id'));}});})[_0x7bdb('0x27')](function(){if(_0x2de3c1[_0x7bdb('0x8d')]['role']===_0x7bdb('0x8e')&&!_0x258f29&&!_0x2de3c1[_0x7bdb('0x3a')][_0x7bdb('0x76')])return[];return db[_0x7bdb('0x92')][_0x7bdb('0x3a')](_0x43e097[_0x7bdb('0x93')](),_0x40f635);})[_0x7bdb('0x27')](function(_0x216d5f){_0x55f020[_0x7bdb('0x20')]=_0x216d5f[_0x7bdb('0x3f')];if(_0x55f020[_0x7bdb('0x20')]===0x0)return[];return db['sequelize']['query'](_0x3a8415['toString'](),_0x40f635)[_0x7bdb('0x27')](function(_0x1c5826){_0x122beb=_['keyBy'](_0x1c5826,'id');_0x40f635=_[_0x7bdb('0x94')](_0x40f635,{'model':db[_0x7bdb('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2de3c1['query']['fields']){_0x3732b2['attributes'][_0x7bdb('0x6a')](function(_0x53bcad){_0x47cccd['field']('i.'+_0x53bcad);});}else{_0x47cccd['field'](_0x7bdb('0x88'),_0x7bdb('0x5b'));_0x47cccd[_0x7bdb('0x46')]('a.key',_0x7bdb('0x95'));_0x47cccd[_0x7bdb('0x46')](_0x7bdb('0x96'),_0x7bdb('0x97'));_0x47cccd['field'](_0x7bdb('0x98'),'contactName');_0x47cccd[_0x7bdb('0x46')](_0x7bdb('0x87'));_0x47cccd[_0x7bdb('0x46')]('i.createdAt');_0x47cccd[_0x7bdb('0x46')](_0x7bdb('0x99'));_0x47cccd[_0x7bdb('0x46')]('i.closed');_0x47cccd[_0x7bdb('0x46')](_0x7bdb('0x9a'));_0x47cccd['field'](_0x7bdb('0x9b'));_0x47cccd[_0x7bdb('0x46')]('i.lastMsgAt');_0x47cccd[_0x7bdb('0x46')](_0x7bdb('0x9c'));_0x47cccd[_0x7bdb('0x46')](_0x7bdb('0x9d'));_0x47cccd[_0x7bdb('0x46')]('i.disposition');_0x47cccd[_0x7bdb('0x46')]('i.secondDisposition');_0x47cccd[_0x7bdb('0x46')](_0x7bdb('0x9e'));_0x47cccd[_0x7bdb('0x46')]('i.substatus');_0x47cccd[_0x7bdb('0x46')]('i.to');_0x47cccd[_0x7bdb('0x46')]('i.ContactId');_0x47cccd[_0x7bdb('0x46')](_0x7bdb('0x9f'));_0x47cccd[_0x7bdb('0x46')](_0x7bdb('0xa0'));_0x47cccd[_0x7bdb('0x46')]('c.firstName','Contact.firstName');_0x47cccd[_0x7bdb('0x46')](_0x7bdb('0xa1'),_0x7bdb('0xa2'));_0x47cccd[_0x7bdb('0x46')]('c.email',_0x7bdb('0xa3'));_0x47cccd[_0x7bdb('0x46')]('c.phone',_0x7bdb('0xa4'));_0x47cccd[_0x7bdb('0x46')]('c.mobile',_0x7bdb('0xa5'));_0x47cccd[_0x7bdb('0x46')](_0x7bdb('0xa6'),_0x7bdb('0xa7'));_0x47cccd[_0x7bdb('0x46')](_0x7bdb('0xa8'),_0x7bdb('0xa9'));_0x47cccd[_0x7bdb('0x46')]('o.internal','Owner.internal');_0x47cccd[_0x7bdb('0x46')](_0x7bdb('0xaa'),_0x7bdb('0x2e'));}if(_0x3732b2[_0x7bdb('0x41')])_0x47cccd[_0x7bdb('0x41')](_0x3732b2[_0x7bdb('0x41')]);if(_0x3732b2['offset'])_0x47cccd[_0x7bdb('0x21')](_0x3732b2[_0x7bdb('0x21')]);return db[_0x7bdb('0x92')][_0x7bdb('0x3a')](_0x47cccd['toString'](),_0x40f635);})[_0x7bdb('0x27')](function(_0x202890){_0x26db62['where'](_0x7bdb('0xab'),_[_0x7bdb('0x2c')](_0x202890,'id'));return db[_0x7bdb('0x92')]['query'](_0x26db62['toString'](),_0x40f635)[_0x7bdb('0x27')](function(_0x54a535){var _0x4a8a86=_[_0x7bdb('0xac')](_0x54a535,'MailInteractionId');var _0xaecf6e=[];return db['Setting']['findOne']({'attributes':[_0x7bdb('0xad')],'raw':!![]})['then'](function(_0x3cfaf8){var _0x40141b=_0x3cfaf8['enableEmailPreview'];_0x202890[_0x7bdb('0x6a')](function(_0x113745){_0xaecf6e[_0x7bdb('0x30')](updateMailInteraction(_0x113745,_0x122beb,_0x4a8a86,_0x40141b));});return BPromise[_0x7bdb('0xae')](_0xaecf6e);});});});})['then'](function(_0x1a263d){_0x55f020['rows']=_0x1a263d;return _0x55f020;})[_0x7bdb('0x27')](respondWithFilteredResult(_0x395699,_0x3732b2))[_0x7bdb('0x36')](handleError(_0x395699,null));};exports[_0x7bdb('0xaf')]=function(_0x199e4b,_0x4ebf68){var _0x50af73={'raw':![],'where':{'id':_0x199e4b[_0x7bdb('0xb0')]['id']}},_0x200386={};_0x200386[_0x7bdb('0x39')]=_['keys'](db[_0x7bdb('0x31')][_0x7bdb('0xb1')]);_0x200386['query']=_[_0x7bdb('0x3b')](_0x199e4b['query']);_0x200386[_0x7bdb('0x44')]=_[_0x7bdb('0x3d')](_0x200386['model'],_0x200386[_0x7bdb('0x3a')]);_0x50af73[_0x7bdb('0x3c')]=_[_0x7bdb('0x3d')](_0x200386[_0x7bdb('0x39')],qs[_0x7bdb('0x3e')](_0x199e4b[_0x7bdb('0x3a')][_0x7bdb('0x3e')]));_0x50af73[_0x7bdb('0x3c')]=_0x50af73[_0x7bdb('0x3c')][_0x7bdb('0x3f')]?_0x50af73['attributes']:_0x200386[_0x7bdb('0x39')];if(_0x199e4b['query'][_0x7bdb('0xb2')]){_0x50af73[_0x7bdb('0xb3')]=[{'all':!![]}];}_0x50af73=_[_0x7bdb('0x94')]({},_0x50af73,_0x199e4b[_0x7bdb('0xb4')]);return db[_0x7bdb('0x31')][_0x7bdb('0x64')](_0x50af73)['then'](handleEntityNotFound(_0x4ebf68,null))[_0x7bdb('0x27')](respondWithResult(_0x4ebf68,null))['catch'](handleError(_0x4ebf68,null));};exports['create']=function(_0x3f3048,_0x422b3a){return db[_0x7bdb('0x31')][_0x7bdb('0xb5')](_0x3f3048[_0x7bdb('0xb6')],{})[_0x7bdb('0x27')](respondWithResult(_0x422b3a,0xc9))['catch'](handleError(_0x422b3a,null));};exports[_0x7bdb('0x26')]=function(_0x1020df,_0x48dc62){if(_0x1020df[_0x7bdb('0xb6')]['id']){delete _0x1020df['body']['id'];}return db['MailInteraction'][_0x7bdb('0x64')]({'where':{'id':_0x1020df['params']['id']}})[_0x7bdb('0x27')](handleEntityNotFound(_0x48dc62,null))[_0x7bdb('0x27')](saveUpdates(_0x1020df['body'],null))['then'](respondWithResult(_0x48dc62,null))[_0x7bdb('0x36')](handleError(_0x48dc62,null));};exports[_0x7bdb('0xb7')]=function(_0x59d71d,_0x416719){return db[_0x7bdb('0x31')][_0x7bdb('0x64')]({'where':{'id':_0x59d71d['params']['id']}})['then'](handleEntityNotFound(_0x416719,null))[_0x7bdb('0x27')](removeEntity(_0x416719,null))[_0x7bdb('0x36')](handleError(_0x416719,null));};exports['describe']=function(_0xa6153c,_0x4c137b){return db[_0x7bdb('0x31')][_0x7bdb('0xb8')]()[_0x7bdb('0x27')](respondWithResult(_0x4c137b,null))['catch'](handleError(_0x4c137b,null));};exports['addMessage']=function(_0x48360b,_0x331264,_0xd21b70){return db[_0x7bdb('0xb9')]['find']({'where':{'id':_0x48360b[_0x7bdb('0xb0')]['id']}})[_0x7bdb('0x27')](handleEntityNotFound(_0x331264,null))[_0x7bdb('0x27')](function(_0x137552){if(_0x137552){return _0x137552[_0x7bdb('0xba')](_0x48360b[_0x7bdb('0xb6')]['ids'],_['omit'](_0x48360b[_0x7bdb('0xb6')],[_0x7bdb('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x331264,null))['catch'](handleError(_0x331264,null));};exports[_0x7bdb('0xbc')]=function(_0x5666c7,_0x59bc10,_0x78788c){var _0x37c443={'raw':![],'where':{}};var _0x1793f1={};var _0xfc2d30={'count':0x0,'rows':[]};return db['MailInteraction'][_0x7bdb('0xbd')]({'where':{'id':_0x5666c7[_0x7bdb('0xb0')]['id']}})[_0x7bdb('0x27')](handleEntityNotFound(_0x59bc10,null))['then'](function(_0x197e5b){if(_0x197e5b){_0x1793f1[_0x7bdb('0x39')]=_[_0x7bdb('0x3b')](db[_0x7bdb('0xb9')]['rawAttributes']);_0x1793f1[_0x7bdb('0x3a')]=_[_0x7bdb('0x3b')](_0x5666c7['query']);_0x1793f1[_0x7bdb('0x44')]=_['intersection'](_0x1793f1['model'],_0x1793f1[_0x7bdb('0x3a')]);_0x37c443[_0x7bdb('0x3c')]=_[_0x7bdb('0x3d')](_0x1793f1[_0x7bdb('0x39')],qs[_0x7bdb('0x3e')](_0x5666c7[_0x7bdb('0x3a')]['fields']));_0x37c443['attributes']=_0x37c443[_0x7bdb('0x3c')]['length']?_0x37c443[_0x7bdb('0x3c')]:_0x1793f1[_0x7bdb('0x39')];if(!_0x5666c7[_0x7bdb('0x3a')][_0x7bdb('0x40')](_0x7bdb('0xbe'))){_0x37c443[_0x7bdb('0x41')]=qs['limit'](_0x5666c7['query']['limit']);_0x37c443[_0x7bdb('0x21')]=qs['offset'](_0x5666c7[_0x7bdb('0x3a')][_0x7bdb('0x21')]);}_0x37c443[_0x7bdb('0x42')]=qs['sort'](_0x5666c7[_0x7bdb('0x3a')][_0x7bdb('0x43')]);_0x37c443[_0x7bdb('0x77')]=qs[_0x7bdb('0x44')](_[_0x7bdb('0xbf')](_0x5666c7[_0x7bdb('0x3a')],_0x1793f1['filters']));_0x37c443[_0x7bdb('0x77')][_0x7bdb('0xc0')]=_0x197e5b['id'];if(_0x5666c7[_0x7bdb('0x3a')][_0x7bdb('0x80')]){_0x37c443[_0x7bdb('0x77')]=_['merge'](_0x37c443[_0x7bdb('0x77')],{'$or':_['map'](_0x37c443[_0x7bdb('0x3c')],function(_0x2dd7eb){var _0x40843c={};_0x40843c[_0x2dd7eb]={'$like':'%'+_0x5666c7[_0x7bdb('0x3a')][_0x7bdb('0x80')]+'%'};return _0x40843c;})});}if(_0x5666c7[_0x7bdb('0x3a')][_0x7bdb('0x7a')]){var _0x2a75e3=_0x5666c7[_0x7bdb('0x3a')][_0x7bdb('0x7a')]['split'](',');var _0x1ea2ab={};_0x1ea2ab[_0x2a75e3[0x0]]={'$gte':moment(_0x2a75e3[0x1])[_0x7bdb('0xc1')](_0x7bdb('0xc2'))};_0x37c443['where']=_['merge'](_0x37c443['where'],_0x1ea2ab);}_0x37c443=_['merge']({},_0x37c443,_0x5666c7[_0x7bdb('0xb4')]);return db[_0x7bdb('0xb9')][_0x7bdb('0x20')]({'where':_0x37c443[_0x7bdb('0x77')]})['then'](function(_0x20a19d){_0xfc2d30[_0x7bdb('0x20')]=_0x20a19d;if(_0x5666c7['query']['includeAll']){_0x37c443[_0x7bdb('0xb3')]=[{'all':!![]}];}return db[_0x7bdb('0xb9')][_0x7bdb('0xc3')](_0x37c443);})[_0x7bdb('0x27')](function(_0x11c725){if(_0x5666c7[_0x7bdb('0x3a')][_0x7bdb('0xc4')]===_0x7bdb('0xc5')){for(var _0x555405=0x0;_0x555405<_0x11c725[_0x7bdb('0x3f')];_0x555405++){_0x11c725[_0x555405][_0x7bdb('0xb6')]=juice(_0x11c725[_0x555405][_0x7bdb('0xb6')]);}}_0xfc2d30['rows']=_0x11c725;return _0xfc2d30;});}})[_0x7bdb('0x27')](respondWithFilteredResult(_0x59bc10,_0x37c443))['catch'](handleError(_0x59bc10,null));};exports[_0x7bdb('0xc6')]=function(_0x21ba19,_0x3ba12f,_0x9149a3){return db['MailInteraction'][_0x7bdb('0x64')]({'where':{'id':_0x21ba19[_0x7bdb('0xb0')]['id']}})[_0x7bdb('0x27')](handleEntityNotFound(_0x3ba12f,null))[_0x7bdb('0x27')](function(_0x49af95){if(_0x49af95){return _0x49af95[_0x7bdb('0xc7')](_0x21ba19[_0x7bdb('0xb6')][_0x7bdb('0xbb')],_[_0x7bdb('0xc8')](_0x21ba19[_0x7bdb('0xb6')],[_0x7bdb('0xbb'),'id'])||{})[_0x7bdb('0xc9')](function(){return db[_0x7bdb('0x68')]['findAll']({'attributes':['id',_0x7bdb('0x2a'),_0x7bdb('0x47')],'where':{'id':_0x21ba19[_0x7bdb('0xb6')][_0x7bdb('0xbb')]}});})[_0x7bdb('0x27')](function(_0x1b89e0){socket[_0x7bdb('0xca')](_0x7bdb('0xcb'),{'id':Number(_0x21ba19[_0x7bdb('0xb0')]['id']),'tags':_0x1b89e0||[]});return{'id':Number(_0x21ba19['params']['id']),'tags':_0x1b89e0||[]};});}})[_0x7bdb('0x27')](respondWithResult(_0x3ba12f,null))['catch'](handleError(_0x3ba12f,null));};exports['removeTags']=function(_0x5ae6ca,_0x59e5e5,_0xd2d912){return db['MailInteraction'][_0x7bdb('0x64')]({'where':{'id':_0x5ae6ca[_0x7bdb('0xb0')]['id']}})[_0x7bdb('0x27')](handleEntityNotFound(_0x59e5e5,null))[_0x7bdb('0x27')](function(_0x53222d){if(_0x53222d){return _0x53222d['removeTags'](_0x5ae6ca[_0x7bdb('0x3a')][_0x7bdb('0xbb')]);}})[_0x7bdb('0x27')](respondWithStatusCode(_0x59e5e5,null))[_0x7bdb('0x36')](handleError(_0x59e5e5,null));};exports[_0x7bdb('0xcc')]=function(_0x48a41b,_0x490284){var _0x380338=moment()[_0x7bdb('0xcd')]()[_0x7bdb('0x93')]();var _0x1346ce=path[_0x7bdb('0xce')](config[_0x7bdb('0xcf')],'server',_0x7bdb('0xd0'),'tmp');var _0x622384=path['join'](config[_0x7bdb('0xcf')],_0x7bdb('0xd1'),'files',_0x7bdb('0xd2'));var _0x2c88ee=path[_0x7bdb('0xce')](_0x1346ce,_0x380338);var _0x3b2a72=util[_0x7bdb('0xc1')](_0x7bdb('0xd3'),_0x48a41b[_0x7bdb('0xb0')]['id'],_0x380338);var _0x32894d=path[_0x7bdb('0xce')](_0x1346ce,_0x3b2a72);var _0x8669bc=[];if(_0x48a41b[_0x7bdb('0x3a')][_0x7bdb('0xd2')]){_0x8669bc[_0x7bdb('0x30')]({'model':db[_0x7bdb('0xd4')],'as':_0x7bdb('0xd5'),'raw':!![]});}var _0x2d5cd3=[{'model':db[_0x7bdb('0xb9')],'as':_0x7bdb('0xd6'),'attributes':['id','body','from','to','cc','bcc',_0x7bdb('0xd7'),_0x7bdb('0xd8')],'where':{'secret':![]},'order':qs[_0x7bdb('0x43')]('id'),'include':_0x8669bc}];return db[_0x7bdb('0x31')][_0x7bdb('0x64')]({'where':{'id':_0x48a41b[_0x7bdb('0xb0')]['id']},'include':_0x2d5cd3})[_0x7bdb('0x27')](handleEntityNotFound(_0x490284,null))[_0x7bdb('0x27')](function(_0x2e2b51){if(_0x2e2b51&&_0x2e2b51['Messages']){var _0x1bad2c=_0x2e2b51[_0x7bdb('0xd9')]({'plain':!![]});fs[_0x7bdb('0xda')](_0x2c88ee);return BPromise[_0x7bdb('0xdb')](_0x1bad2c['Messages'],function(_0x178798,_0x15f725){var _0x56a98b={'from':_0x178798[_0x7bdb('0x48')],'to':_0x178798['to'],'subject':_0x178798[_0x7bdb('0xd7')],'html':_0x178798[_0x7bdb('0xb6')],'headers':{'Date':moment(_0x178798[_0x7bdb('0xd8')])['format'](_0x7bdb('0xdc'))},'attachments':[]};if(_0x178798['cc']){_0x56a98b[_0x7bdb('0xdd')]['Cc']=_0x178798['cc'];}if(_0x178798[_0x7bdb('0xde')]){_0x56a98b['headers'][_0x7bdb('0xdf')]=_0x178798[_0x7bdb('0xde')];}return new BPromise(function(_0x1281da,_0x299e2e){if(_0x178798[_0x7bdb('0xd5')]){for(var _0x574b1b=0x0;_0x574b1b<_0x178798[_0x7bdb('0xd5')][_0x7bdb('0x3f')];_0x574b1b++){var _0x93b6a2=_0x178798[_0x7bdb('0xd5')][_0x574b1b];var _0x1cc900=path[_0x7bdb('0xce')](_0x622384,_0x93b6a2[_0x7bdb('0xe0')]);if(fs['existsSync'](_0x1cc900)){_0x56a98b[_0x7bdb('0xd2')][_0x7bdb('0x30')]({'name':_0x93b6a2['name'],'contentType':_0x93b6a2['type'],'data':fs['readFileSync'](_0x1cc900)});}}}emlformat[_0x7bdb('0xe1')](_0x56a98b,function(_0x46e98f,_0x40c244){if(_0x46e98f)return _0x299e2e(_0x46e98f);fs[_0x7bdb('0xe2')](path['join'](_0x2c88ee,util[_0x7bdb('0xc1')](_0x7bdb('0xe3'),_0x15f725)),_0x40c244);return _0x1281da(_0x40c244);});});})[_0x7bdb('0x27')](function(){return new BPromise(function(_0x4ce8ef,_0x290cb6){zipdir(_0x2c88ee,{'saveTo':_0x32894d},function(_0x2cfdd1,_0x4167b2){if(_0x2cfdd1)return _0x290cb6(_0x2cfdd1);return _0x4ce8ef(_0x4167b2);});})[_0x7bdb('0x27')](function(){return new BPromise(function(_0x5bde54,_0x2bc3c7){rimraf(_0x2c88ee,function(_0x1e8d7f){if(_0x1e8d7f)_0x2bc3c7(_0x1e8d7f);return _0x5bde54();});});})[_0x7bdb('0x27')](function(){return _0x490284['download'](_0x32894d,_0x3b2a72,function(_0x18c566){if(_0x18c566){console[_0x7bdb('0xe4')](_0x7bdb('0xe5'),_0x18c566);}else{fs['unlinkSync'](_0x32894d);}});});});}else{return _0x490284[_0x7bdb('0x1c')](0xc8);}})[_0x7bdb('0x36')](handleError(_0x490284,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 989853a..3a72f21 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 _0xd05c=['hook','events','MailInteraction','../../mysqldb','setMaxListeners','save','remove','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x39880f,_0xe47643){var _0x33cdf7=function(_0x4deae7){while(--_0x4deae7){_0x39880f['push'](_0x39880f['shift']());}};_0x33cdf7(++_0xe47643);}(_0xd05c,0x1bb));var _0xcd05=function(_0x227c08,_0x2e1f5b){_0x227c08=_0x227c08-0x0;var _0x245253=_0xd05c[_0x227c08];return _0x245253;};'use strict';var EventEmitter=require(_0xcd05('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xcd05('0x1')];var MailMessage=require(_0xcd05('0x2'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xcd05('0x3')](0x0);var events={'afterCreate':_0xcd05('0x4'),'afterUpdate':'update','afterDestroy':_0xcd05('0x5')};function emitEvent(_0x12da15){return function(_0x1a215b,_0x140fa1,_0x501cd2){_0x1a215b['getUsers']({'attributes':['id'],'raw':!![]})[_0xcd05('0x6')](function(_0x3dc7de){_0x1a215b['setDataValue'](_0xcd05('0x7'),_0x3dc7de[_0xcd05('0x8')](function(_0x416d57){return{'id':_0x416d57['id']};}));return MailMessage[_0xcd05('0x9')]({'where':{'MailInteractionId':_0x1a215b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcd05('0x6')](function(_0x520cba){_0x1a215b[_0xcd05('0xa')](_0xcd05('0xb'),_0x520cba[_0xcd05('0xc')]);MailInteractionEvents['emit'](_0x12da15+':'+_0x1a215b['id'],_0x1a215b);MailInteractionEvents[_0xcd05('0xd')](_0x12da15,_0x1a215b);_0x501cd2(null);})[_0xcd05('0xe')](_0x501cd2(null));};}for(var e in events){if(events[_0xcd05('0xf')](e)){var event=events[e];MailInteraction[_0xcd05('0x10')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xb56d=['exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','then','Users','map','setDataValue','length','emit','catch','hasOwnProperty','hook'];(function(_0x16d523,_0x21b346){var _0x511b64=function(_0x47d6f1){while(--_0x47d6f1){_0x16d523['push'](_0x16d523['shift']());}};_0x511b64(++_0x21b346);}(_0xb56d,0x7f));var _0xdb56=function(_0x23210f,_0x550c26){_0x23210f=_0x23210f-0x0;var _0x50db7c=_0xb56d[_0x23210f];return _0x50db7c;};'use strict';var EventEmitter=require(_0xdb56('0x0'));var MailInteraction=require(_0xdb56('0x1'))['db'][_0xdb56('0x2')];var MailMessage=require(_0xdb56('0x1'))['db'][_0xdb56('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xdb56('0x4')](0x0);var events={'afterCreate':_0xdb56('0x5'),'afterUpdate':_0xdb56('0x6'),'afterDestroy':_0xdb56('0x7')};function emitEvent(_0x14b4d8){return function(_0x1b5125,_0x38c979,_0x2e9f81){_0x1b5125['getUsers']({'attributes':['id'],'raw':!![]})[_0xdb56('0x8')](function(_0x4ea49d){_0x1b5125['setDataValue'](_0xdb56('0x9'),_0x4ea49d[_0xdb56('0xa')](function(_0xec361e){return{'id':_0xec361e['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x1b5125['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdb56('0x8')](function(_0x5da422){_0x1b5125[_0xdb56('0xb')]('unreadMessages',_0x5da422[_0xdb56('0xc')]);MailInteractionEvents[_0xdb56('0xd')](_0x14b4d8+':'+_0x1b5125['id'],_0x1b5125);MailInteractionEvents[_0xdb56('0xd')](_0x14b4d8,_0x1b5125);_0x2e9f81(null);})[_0xdb56('0xe')](_0x2e9f81(null));};}for(var e in events){if(events[_0xdb56('0xf')](e)){var event=events[e];MailInteraction[_0xdb56('0x10')](e,emitEvent(event));}}module[_0xdb56('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 538720b..38270d9 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 _0x36f1=['substatusAt','models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatus','closedAt'];(function(_0x2d37fb,_0x3c31d2){var _0x120c59=function(_0x5d04a0){while(--_0x5d04a0){_0x2d37fb['push'](_0x2d37fb['shift']());}};_0x120c59(++_0x3c31d2);}(_0x36f1,0xb0));var _0x136f=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x36f1[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x136f('0x0'));var util=require('util');var logger=require(_0x136f('0x1'))('api');var moment=require(_0x136f('0x2'));var BPromise=require(_0x136f('0x3'));var rp=require(_0x136f('0x4'));var fs=require('fs');var path=require(_0x136f('0x5'));var rimraf=require(_0x136f('0x6'));var config=require(_0x136f('0x7'));var attributes=require(_0x136f('0x8'));module[_0x136f('0x9')]=function(_0x5b00b5,_0x430433){return _0x5b00b5['define'](_0x136f('0xa'),attributes,{'tableName':_0x136f('0xb'),'paranoid':![],'indexes':[{'name':_0x136f('0xc'),'fields':['subject','to'],'type':_0x136f('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a131b,_0x51d57,_0x7b0a5b){if(_0x1a131b['substatus']){_0x1a131b['substatusAt']=moment()[_0x136f('0xe')](_0x136f('0xf'));}if(_0x1a131b[_0x136f('0x10')]){_0x1a131b['closedAt']=moment()['format'](_0x136f('0xf'));}_0x7b0a5b(null,_0x51d57);},'beforeUpdate':function(_0x134404,_0x16add0,_0x227d03){if(_0x134404[_0x136f('0x11')]('substatus')){_0x134404['substatusAt']=_0x134404[_0x136f('0x12')]?moment()[_0x136f('0xe')](_0x136f('0xf')):null;}if(_0x134404['changed'](_0x136f('0x10'))){_0x134404[_0x136f('0x13')]=moment()[_0x136f('0xe')](_0x136f('0xf'));_0x134404[_0x136f('0x12')]=null;_0x134404[_0x136f('0x14')]=null;}_0x227d03(null,_0x134404);},'afterUpdate':function(_0x3a4a84,_0x39d1f8,_0x502721){var _0x16d69a=_0x5b00b5[_0x136f('0x15')];var _0x66cee=_0x3a4a84[_0x136f('0x16')]({'plain':!![]});if(_0x66cee[_0x136f('0x10')]){return _0x16d69a[_0x136f('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x66cee['id']}})[_0x136f('0x18')](function(){_0x502721();})[_0x136f('0x19')](function(_0x58ceb6){_0x502721(_0x58ceb6);});}else{_0x502721();}}},'charset':_0x136f('0x1a'),'collate':_0x136f('0x1b')});}; \ No newline at end of file +var _0x68fc=['FULLTEXT','substatus','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','./mailInteraction.attributes','exports','mail_interactions','fti_mail_interactions','subject'];(function(_0xccf9a6,_0x1530b9){var _0x47adab=function(_0x4a5e6f){while(--_0x4a5e6f){_0xccf9a6['push'](_0xccf9a6['shift']());}};_0x47adab(++_0x1530b9);}(_0x68fc,0xa5));var _0xc68f=function(_0x24afda,_0x24017b){_0x24afda=_0x24afda-0x0;var _0x446a78=_0x68fc[_0x24afda];return _0x446a78;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var logger=require(_0xc68f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc68f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc68f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc68f('0x5'));module[_0xc68f('0x6')]=function(_0x1c6df9,_0x363cdf){return _0x1c6df9['define']('MailInteraction',attributes,{'tableName':_0xc68f('0x7'),'paranoid':![],'indexes':[{'name':_0xc68f('0x8'),'fields':[_0xc68f('0x9'),'to'],'type':_0xc68f('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x11af4a,_0x1ee022,_0x1d542b){if(_0x11af4a[_0xc68f('0xb')]){_0x11af4a[_0xc68f('0xc')]=moment()[_0xc68f('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x11af4a[_0xc68f('0xe')]){_0x11af4a[_0xc68f('0xf')]=moment()[_0xc68f('0xd')](_0xc68f('0x10'));}_0x1d542b(null,_0x1ee022);},'beforeUpdate':function(_0x2f0694,_0x2a0a52,_0x3ccebe){if(_0x2f0694[_0xc68f('0x11')](_0xc68f('0xb'))){_0x2f0694[_0xc68f('0xc')]=_0x2f0694[_0xc68f('0xb')]?moment()['format'](_0xc68f('0x10')):null;}if(_0x2f0694[_0xc68f('0x11')](_0xc68f('0xe'))){_0x2f0694[_0xc68f('0xf')]=moment()[_0xc68f('0xd')](_0xc68f('0x10'));_0x2f0694[_0xc68f('0xb')]=null;_0x2f0694[_0xc68f('0xc')]=null;}_0x3ccebe(null,_0x2f0694);},'afterUpdate':function(_0x4648c6,_0x5e1e5b,_0x541828){var _0x3a6c06=_0x1c6df9[_0xc68f('0x12')];var _0x171eea=_0x4648c6[_0xc68f('0x13')]({'plain':!![]});if(_0x171eea[_0xc68f('0xe')]){return _0x3a6c06[_0xc68f('0x14')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x171eea['id']}})[_0xc68f('0x15')](function(){_0x541828();})[_0xc68f('0x16')](function(_0x2acad7){_0x541828(_0x2acad7);});}else{_0x541828();}}},'charset':_0xc68f('0x17'),'collate':_0xc68f('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index ef1c540..230be73 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 _0xd71d=['body','options','raw','limit','stringify','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailInteraction','update'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xd71d,0x1a5));var _0xdd71=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0xd71d[_0xa3463d];return _0x50fd67;};'use strict';var _=require(_0xdd71('0x0'));var util=require(_0xdd71('0x1'));var moment=require(_0xdd71('0x2'));var BPromise=require(_0xdd71('0x3'));var rs=require(_0xdd71('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd71('0x5'))['db'];var utils=require(_0xdd71('0x6'));var logger=require(_0xdd71('0x7'))('rpc');var config=require(_0xdd71('0x8'));var jayson=require(_0xdd71('0x9'));var client=jayson[_0xdd71('0xa')]['http']({'port':0x232a});config[_0xdd71('0xb')]=_[_0xdd71('0xc')](config[_0xdd71('0xb')],{'host':_0xdd71('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd71('0xb')]));require(_0xdd71('0xe'))[_0xdd71('0xf')](socket);function respondWithRpcPromise(_0x42a51f,_0x1163dc,_0x5df09b){return new BPromise(function(_0x17cd75,_0x15d56b){return client[_0xdd71('0x10')](_0x42a51f,_0x5df09b)[_0xdd71('0x11')](function(_0x48bd45){logger[_0xdd71('0x12')](_0xdd71('0x13'),_0x1163dc,_0xdd71('0x14'));logger[_0xdd71('0x15')](_0xdd71('0x16'),_0x1163dc,_0xdd71('0x14'),JSON['stringify'](_0x48bd45));if(_0x48bd45[_0xdd71('0x17')]){if(_0x48bd45[_0xdd71('0x17')][_0xdd71('0x18')]===0x1f4){logger[_0xdd71('0x17')]('MailInteraction,\x20%s,\x20%s',_0x1163dc,_0x48bd45[_0xdd71('0x17')][_0xdd71('0x19')]);return _0x15d56b(_0x48bd45[_0xdd71('0x17')][_0xdd71('0x19')]);}logger[_0xdd71('0x17')](_0xdd71('0x13'),_0x1163dc,_0x48bd45[_0xdd71('0x17')][_0xdd71('0x19')]);return _0x17cd75(_0x48bd45[_0xdd71('0x17')][_0xdd71('0x19')]);}else{logger[_0xdd71('0x12')]('MailInteraction,\x20%s,\x20%s',_0x1163dc,'request\x20sent');_0x17cd75(_0x48bd45[_0xdd71('0x1a')][_0xdd71('0x19')]);}})[_0xdd71('0x1b')](function(_0x2a7d0b){logger[_0xdd71('0x17')](_0xdd71('0x13'),_0x1163dc,_0x2a7d0b);_0x15d56b(_0x2a7d0b);});});}exports['UpdateMailInteraction']=function(_0x3243ef){var _0x199e70=this;return new Promise(function(_0x1959ca,_0x3635fc){return db[_0xdd71('0x1c')][_0xdd71('0x1d')](_0x3243ef[_0xdd71('0x1e')],{'raw':_0x3243ef[_0xdd71('0x1f')]?_0x3243ef[_0xdd71('0x1f')][_0xdd71('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3243ef[_0xdd71('0x1f')]?_0x3243ef[_0xdd71('0x1f')]['where']||null:null,'attributes':_0x3243ef[_0xdd71('0x1f')]?_0x3243ef[_0xdd71('0x1f')]['attributes']||null:null,'limit':_0x3243ef[_0xdd71('0x1f')]?_0x3243ef['options'][_0xdd71('0x21')]||null:null})['then'](function(_0x4a5690){logger['info']('UpdateMailInteraction',_0x3243ef);logger[_0xdd71('0x15')]('UpdateMailInteraction',_0x3243ef,JSON[_0xdd71('0x22')](_0x4a5690));_0x1959ca(_0x4a5690);})[_0xdd71('0x1b')](function(_0xd8739d){logger[_0xdd71('0x17')]('UpdateMailInteraction',_0xd8739d['message'],_0x3243ef);_0x3635fc(_0x199e70[_0xdd71('0x17')](0x1f4,_0xd8739d[_0xdd71('0x19')]));});});};exports[_0xdd71('0x23')]=function(_0x5a240e){return new Promise(function(_0x4432af,_0x3a57fc){return db[_0xdd71('0x1c')]['find']({'where':_0x5a240e[_0xdd71('0x1f')]?_0x5a240e['options']['where']||null:null})[_0xdd71('0x11')](function(_0x43588c){if(_0x43588c){return _0x43588c[_0xdd71('0x24')](_0x5a240e[_0xdd71('0x1e')][_0xdd71('0x25')],_[_0xdd71('0x26')](_0x5a240e[_0xdd71('0x1e')],[_0xdd71('0x25'),'id'])||{});}})[_0xdd71('0x27')](function(_0x58fc27){logger[_0xdd71('0x12')](_0xdd71('0x28'),_0x5a240e);logger[_0xdd71('0x15')](_0xdd71('0x28'),_0x5a240e,JSON['stringify'](_0x58fc27));_0x4432af(_0x58fc27);})[_0xdd71('0x1b')](function(_0x4b8292){logger['error'](_0xdd71('0x28'),_0x4b8292[_0xdd71('0x19')],_0x5a240e);_0x3a57fc(_this[_0xdd71('0x17')](0x1f4,_0x4b8292['message']));});});}; \ No newline at end of file +var _0x5e30=['spread','debug','AddTags','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','AddTagsToMailInteraction','find','ids','omit'];(function(_0x4b06c1,_0x2c2ed2){var _0x52ab1f=function(_0x4ca5f7){while(--_0x4ca5f7){_0x4b06c1['push'](_0x4b06c1['shift']());}};_0x52ab1f(++_0x2c2ed2);}(_0x5e30,0x7b));var _0x05e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e30[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x05e3('0x0'));var util=require(_0x05e3('0x1'));var moment=require(_0x05e3('0x2'));var BPromise=require(_0x05e3('0x3'));var rs=require(_0x05e3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x05e3('0x5'))(_0x05e3('0x6'));var config=require(_0x05e3('0x7'));var jayson=require(_0x05e3('0x8'));var client=jayson[_0x05e3('0x9')][_0x05e3('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x05e3('0xb')],{'host':_0x05e3('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x05e3('0xb')]));require(_0x05e3('0xd'))[_0x05e3('0xe')](socket);function respondWithRpcPromise(_0x2afc34,_0x57ad6d,_0x5a98f8){return new BPromise(function(_0xb9bc1e,_0x54cda5){return client[_0x05e3('0xf')](_0x2afc34,_0x5a98f8)[_0x05e3('0x10')](function(_0x20851e){logger['info'](_0x05e3('0x11'),_0x57ad6d,_0x05e3('0x12'));logger['debug'](_0x05e3('0x13'),_0x57ad6d,'request\x20sent',JSON[_0x05e3('0x14')](_0x20851e));if(_0x20851e[_0x05e3('0x15')]){if(_0x20851e[_0x05e3('0x15')][_0x05e3('0x16')]===0x1f4){logger['error'](_0x05e3('0x11'),_0x57ad6d,_0x20851e['error'][_0x05e3('0x17')]);return _0x54cda5(_0x20851e['error']['message']);}logger[_0x05e3('0x15')](_0x05e3('0x11'),_0x57ad6d,_0x20851e[_0x05e3('0x15')]['message']);return _0xb9bc1e(_0x20851e[_0x05e3('0x15')][_0x05e3('0x17')]);}else{logger[_0x05e3('0x18')](_0x05e3('0x11'),_0x57ad6d,_0x05e3('0x12'));_0xb9bc1e(_0x20851e['result'][_0x05e3('0x17')]);}})[_0x05e3('0x19')](function(_0x1bcac9){logger[_0x05e3('0x15')](_0x05e3('0x11'),_0x57ad6d,_0x1bcac9);_0x54cda5(_0x1bcac9);});});}exports[_0x05e3('0x1a')]=function(_0x57c59f){var _0x493237=this;return new Promise(function(_0x53e346,_0x26242d){return db[_0x05e3('0x1b')]['update'](_0x57c59f[_0x05e3('0x1c')],{'raw':_0x57c59f[_0x05e3('0x1d')]?_0x57c59f['options'][_0x05e3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57c59f[_0x05e3('0x1d')]?_0x57c59f[_0x05e3('0x1d')][_0x05e3('0x1f')]||null:null,'attributes':_0x57c59f[_0x05e3('0x1d')]?_0x57c59f[_0x05e3('0x1d')][_0x05e3('0x20')]||null:null,'limit':_0x57c59f[_0x05e3('0x1d')]?_0x57c59f['options']['limit']||null:null})[_0x05e3('0x10')](function(_0x3426be){logger[_0x05e3('0x18')](_0x05e3('0x1a'),_0x57c59f);logger['debug']('UpdateMailInteraction',_0x57c59f,JSON[_0x05e3('0x14')](_0x3426be));_0x53e346(_0x3426be);})[_0x05e3('0x19')](function(_0x7f7d26){logger['error']('UpdateMailInteraction',_0x7f7d26[_0x05e3('0x17')],_0x57c59f);_0x26242d(_0x493237[_0x05e3('0x15')](0x1f4,_0x7f7d26[_0x05e3('0x17')]));});});};exports[_0x05e3('0x21')]=function(_0x2d5d25){return new Promise(function(_0x5ec676,_0x27d7e7){return db[_0x05e3('0x1b')][_0x05e3('0x22')]({'where':_0x2d5d25['options']?_0x2d5d25[_0x05e3('0x1d')]['where']||null:null})[_0x05e3('0x10')](function(_0xc8cc7b){if(_0xc8cc7b){return _0xc8cc7b['addTags'](_0x2d5d25[_0x05e3('0x1c')][_0x05e3('0x23')],_[_0x05e3('0x24')](_0x2d5d25[_0x05e3('0x1c')],[_0x05e3('0x23'),'id'])||{});}})[_0x05e3('0x25')](function(_0x3d9260){logger[_0x05e3('0x18')]('AddTags',_0x2d5d25);logger[_0x05e3('0x26')](_0x05e3('0x27'),_0x2d5d25,JSON[_0x05e3('0x14')](_0x3d9260));_0x5ec676(_0x3d9260);})['catch'](function(_0x1ceb52){logger[_0x05e3('0x15')]('AddTags',_0x1ceb52[_0x05e3('0x17')],_0x2d5d25);_0x27d7e7(_this['error'](0x1f4,_0x1ceb52['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 0e2d8c2..19bb82c 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 _0x993e=['remove','update','length','./mailInteraction.events'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x993e,0x147));var _0xe993=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x993e[_0xa464c9];return _0x3d73c4;};'use strict';var MailInteractionEvents=require(_0xe993('0x0'));var events=['save',_0xe993('0x1'),_0xe993('0x2')];function createListener(_0x572907,_0x2757a8){return function(_0x487ba2){_0x2757a8['emit'](_0x572907,_0x487ba2);};}function removeListener(_0xb36585,_0x5e466c){return function(){MailInteractionEvents['removeListener'](_0xb36585,_0x5e466c);};}exports['register']=function(_0x1f00fe){for(var _0x16fec1=0x0,_0x17986a=events[_0xe993('0x3')];_0x16fec1<_0x17986a;_0x16fec1++){var _0x134af6=events[_0x16fec1];var _0x563428=createListener('mailInteraction:'+_0x134af6,_0x1f00fe);MailInteractionEvents['on'](_0x134af6,_0x563428);}}; \ No newline at end of file +var _0xa45b=['length','mailInteraction:','./mailInteraction.events','save','remove','emit','removeListener','register'];(function(_0x335828,_0x560a9d){var _0x13f709=function(_0x131f20){while(--_0x131f20){_0x335828['push'](_0x335828['shift']());}};_0x13f709(++_0x560a9d);}(_0xa45b,0x1d2));var _0xba45=function(_0x13a360,_0x234221){_0x13a360=_0x13a360-0x0;var _0x564713=_0xa45b[_0x13a360];return _0x564713;};'use strict';var MailInteractionEvents=require(_0xba45('0x0'));var events=[_0xba45('0x1'),_0xba45('0x2'),'update'];function createListener(_0x3ec041,_0x4bf7be){return function(_0x541dea){_0x4bf7be[_0xba45('0x3')](_0x3ec041,_0x541dea);};}function removeListener(_0x58d396,_0x377610){return function(){MailInteractionEvents[_0xba45('0x4')](_0x58d396,_0x377610);};}exports[_0xba45('0x5')]=function(_0x4382e2){for(var _0x407db2=0x0,_0x10c9fa=events[_0xba45('0x6')];_0x407db2<_0x10c9fa;_0x407db2++){var _0x2e5ae1=events[_0x407db2];var _0x3c62a5=createListener(_0xba45('0x7')+_0x2e5ae1,_0x4382e2);MailInteractionEvents['on'](_0x2e5ae1,_0x3c62a5);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 0291059..ef6234f 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 _0xbca1=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','describe','show','/:id/download','post','tracked','mail','mailmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','multer'];(function(_0x470f2c,_0x53c93d){var _0x47162d=function(_0x258ded){while(--_0x258ded){_0x470f2c['push'](_0x470f2c['shift']());}};_0x47162d(++_0x53c93d);}(_0xbca1,0xbc));var _0x1bca=function(_0x49510c,_0x4f9d22){_0x49510c=_0x49510c-0x0;var _0x484982=_0xbca1[_0x49510c];return _0x484982;};'use strict';var multer=require(_0x1bca('0x0'));var util=require(_0x1bca('0x1'));var path=require(_0x1bca('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1bca('0x3')]();var fs_extra=require(_0x1bca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1bca('0x5'));var config=require(_0x1bca('0x6'));var controller=require(_0x1bca('0x7'));router[_0x1bca('0x8')]('/',auth[_0x1bca('0x9')](),controller[_0x1bca('0xa')]);router[_0x1bca('0x8')]('/describe',auth[_0x1bca('0x9')](),controller[_0x1bca('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1bca('0xc')]);router['get'](_0x1bca('0xd'),auth[_0x1bca('0x9')](),controller['download']);router[_0x1bca('0xe')]('/',auth[_0x1bca('0x9')](),interaction[_0x1bca('0xf')](_0x1bca('0x10'),_0x1bca('0x11')),controller[_0x1bca('0x12')]);router[_0x1bca('0x13')](_0x1bca('0x14'),auth[_0x1bca('0x9')](),controller[_0x1bca('0x15')]);router[_0x1bca('0x13')](_0x1bca('0x16'),auth[_0x1bca('0x9')](),controller[_0x1bca('0x17')]);router['put'](_0x1bca('0x18'),auth[_0x1bca('0x9')](),controller['reject']);router[_0x1bca('0x19')]('/:id',auth[_0x1bca('0x9')](),controller[_0x1bca('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x8949=['/:id/reject','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','describe','/:id','isAuthenticated','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','accept'];(function(_0x2fb97f,_0x15ddbb){var _0x3ce04d=function(_0x5c2c12){while(--_0x5c2c12){_0x2fb97f['push'](_0x2fb97f['shift']());}};_0x3ce04d(++_0x15ddbb);}(_0x8949,0x193));var _0x9894=function(_0x217523,_0x5d793a){_0x217523=_0x217523-0x0;var _0x43e3e1=_0x8949[_0x217523];return _0x43e3e1;};'use strict';var multer=require(_0x9894('0x0'));var util=require(_0x9894('0x1'));var path=require('path');var timeout=require(_0x9894('0x2'));var express=require(_0x9894('0x3'));var router=express['Router']();var fs_extra=require(_0x9894('0x4'));var auth=require(_0x9894('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9894('0x6'));var controller=require(_0x9894('0x7'));router[_0x9894('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9894('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x9894('0x9')]);router['get'](_0x9894('0xa'),auth[_0x9894('0xb')](),controller['show']);router[_0x9894('0x8')](_0x9894('0xc'),auth['isAuthenticated'](),controller[_0x9894('0xd')]);router[_0x9894('0xe')]('/',auth['isAuthenticated'](),interaction[_0x9894('0xf')](_0x9894('0x10'),_0x9894('0x11')),controller[_0x9894('0x12')]);router[_0x9894('0x13')](_0x9894('0xa'),auth['isAuthenticated'](),controller[_0x9894('0x14')]);router['put']('/:id/accept',auth[_0x9894('0xb')](),controller[_0x9894('0x15')]);router['put'](_0x9894('0x16'),auth[_0x9894('0xb')](),controller['reject']);router[_0x9894('0x17')](_0x9894('0xa'),auth[_0x9894('0xb')](),controller['destroy']);module[_0x9894('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 18a64c7..a291593 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 _0xa414=['long','medium','BOOLEAN','out','STRING','DATE','INTEGER','Email','sequelize','lodash','TEXT'];(function(_0x3e3cb5,_0x462726){var _0x40b63b=function(_0xd8bee5){while(--_0xd8bee5){_0x3e3cb5['push'](_0x3e3cb5['shift']());}};_0x40b63b(++_0x462726);}(_0xa414,0xd9));var _0x4a41=function(_0x4d8d59,_0x32fa9b){_0x4d8d59=_0x4d8d59-0x0;var _0x3217ff=_0xa414[_0x4d8d59];return _0x3217ff;};'use strict';var Sequelize=require(_0x4a41('0x0'));var _=require(_0x4a41('0x1'));module['exports']={'body':{'type':Sequelize[_0x4a41('0x2')](_0x4a41('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4a41('0x2')](_0x4a41('0x4'))},'read':{'type':Sequelize[_0x4a41('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4a41('0x6')),'defaultValue':_0x4a41('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4a41('0x7')](0x1fe)},'from':{'type':Sequelize[_0x4a41('0x7')]},'to':{'type':Sequelize[_0x4a41('0x2')](_0x4a41('0x3'))},'cc':{'type':Sequelize[_0x4a41('0x2')](_0x4a41('0x3'))},'bcc':{'type':Sequelize[_0x4a41('0x2')](_0x4a41('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x4a41('0x8')]},'attach':{'type':Sequelize[_0x4a41('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4a41('0x8')]},'originTo':{'type':Sequelize[_0x4a41('0x2')](_0x4a41('0x3'))},'originCc':{'type':Sequelize[_0x4a41('0x2')]('long')},'originChannel':{'type':Sequelize['ENUM']('Email','Chat'),'defaultValue':_0x4a41('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0xfb7c=['TEXT','long','INTEGER','Chat','Email','lodash','exports','BOOLEAN','ENUM','out','STRING'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xfb7c,0x1b2));var _0xcfb7=function(_0x520b93,_0x45857c){_0x520b93=_0x520b93-0x0;var _0xc40050=_0xfb7c[_0x520b93];return _0xc40050;};'use strict';var Sequelize=require('sequelize');var _=require(_0xcfb7('0x0'));module[_0xcfb7('0x1')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0xcfb7('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcfb7('0x3')]('in',_0xcfb7('0x4')),'defaultValue':_0xcfb7('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcfb7('0x5')](0x1fe)},'from':{'type':Sequelize[_0xcfb7('0x5')]},'to':{'type':Sequelize[_0xcfb7('0x6')](_0xcfb7('0x7'))},'cc':{'type':Sequelize[_0xcfb7('0x6')]('long')},'bcc':{'type':Sequelize[_0xcfb7('0x6')]('long')},'subject':{'type':Sequelize[_0xcfb7('0x6')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xcfb7('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xcfb7('0x2')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xcfb7('0x6')]('long')},'originCc':{'type':Sequelize[_0xcfb7('0x6')](_0xcfb7('0x7'))},'originChannel':{'type':Sequelize['ENUM']('Email',_0xcfb7('0x9')),'defaultValue':_0xcfb7('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index c58e478..033a087 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 _0x9997=['query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','include','find','update','body','destroy','create','direction','out','secret','split','findOne','MailAccountId','List','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','auth','user','pass','secure','attachments','join','root','basename','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','messageId','mail-interactions','accept','mail','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','Contact','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','MailInteractionId','RejectMessage','rejectMessage','event','reject','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','Attachment','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','log','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','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','defaults','redis','localhost','./mailMessage.socket','jayson/promise','http','client','request','then','info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','status','end','json','count','offset','limit','set','apply','save','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key'];(function(_0x5bca99,_0x5ba77f){var _0x5541ed=function(_0x6dfacf){while(--_0x6dfacf){_0x5bca99['push'](_0x5bca99['shift']());}};_0x5541ed(++_0x5ba77f);}(_0x9997,0x1b8));var _0x7999=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x9997[_0x31ced5];return _0x10d9e5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7999('0x0'));var rimraf=require(_0x7999('0x1'));var zipdir=require(_0x7999('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7999('0x3'));var moment=require(_0x7999('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7999('0x5'));var util=require(_0x7999('0x6'));var path=require(_0x7999('0x7'));var sox=require('sox');var csv=require(_0x7999('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7999('0x9'));var _=require(_0x7999('0xa'));var squel=require(_0x7999('0xb'));var crypto=require(_0x7999('0xc'));var jsforce=require(_0x7999('0xd'));var deskjs=require(_0x7999('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7999('0xf'));var Papa=require(_0x7999('0x10'));var Redis=require(_0x7999('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7999('0x12'));var as=require(_0x7999('0x13'));var hardwareService=require(_0x7999('0x14'));var logger=require(_0x7999('0x15'))(_0x7999('0x16'));var utils=require(_0x7999('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7999('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7999('0x19')](config[_0x7999('0x1a')],{'host':_0x7999('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7999('0x1c'))['register'](socket);var jayson=require(_0x7999('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson['client'][_0x7999('0x1e')]({'port':0x232b});var client9002=jayson[_0x7999('0x1f')][_0x7999('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x240c7c,_0x574347,_0x2cfc79,_0x5955d0){return new BPromise(function(_0x7fa69c,_0x4fb51b){var _0x4d6024=_0x5955d0||client;return _0x4d6024[_0x7999('0x20')](_0x240c7c,_0x2cfc79)[_0x7999('0x21')](function(_0x2ef874){logger[_0x7999('0x22')]('MailMessage,\x20%s,\x20%s',_0x574347,_0x7999('0x23'));logger[_0x7999('0x24')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x574347,'request\x20sent',JSON[_0x7999('0x25')](_0x2ef874));if(_0x2ef874['error']){if(_0x2ef874[_0x7999('0x26')][_0x7999('0x27')]===0x1f4){logger[_0x7999('0x26')](_0x7999('0x28'),_0x574347,_0x2ef874[_0x7999('0x26')][_0x7999('0x29')]);return _0x4fb51b(_0x2ef874[_0x7999('0x26')][_0x7999('0x29')]);}logger[_0x7999('0x26')](_0x7999('0x28'),_0x574347,_0x2ef874[_0x7999('0x26')][_0x7999('0x29')]);return _0x7fa69c(_0x2ef874[_0x7999('0x26')][_0x7999('0x29')]);}else{logger[_0x7999('0x22')]('MailMessage,\x20%s,\x20%s',_0x574347,_0x7999('0x23'));_0x7fa69c(_0x2ef874['result'][_0x7999('0x29')]);}})['catch'](function(_0x17092a){logger[_0x7999('0x26')](_0x7999('0x28'),_0x574347,_0x17092a);_0x4fb51b(_0x17092a);});});}function respondWithStatusCode(_0x1ea988,_0x50f444){_0x50f444=_0x50f444||0xcc;return function(_0x51861c){if(_0x51861c){return _0x1ea988['sendStatus'](_0x50f444);}return _0x1ea988[_0x7999('0x2a')](_0x50f444)[_0x7999('0x2b')]();};}function respondWithResult(_0x3980ad,_0x7de56){_0x7de56=_0x7de56||0xc8;return function(_0x41e950){if(_0x41e950){return _0x3980ad[_0x7999('0x2a')](_0x7de56)[_0x7999('0x2c')](_0x41e950);}};}function respondWithFilteredResult(_0x46a958,_0x44735c){return function(_0x16aa5d){if(_0x16aa5d){var _0x6e9144=_0x16aa5d[_0x7999('0x2d')],_0x4d974c=_0x44735c[_0x7999('0x2e')],_0x1e02f6=_0x44735c[_0x7999('0x2e')]+_0x44735c[_0x7999('0x2f')],_0x541cc4;if(_0x1e02f6>=_0x6e9144){_0x1e02f6=_0x6e9144;_0x541cc4=0xc8;}else{_0x541cc4=0xce;}_0x46a958[_0x7999('0x2a')](_0x541cc4);return _0x46a958[_0x7999('0x30')]('Content-Range',_0x4d974c+'-'+_0x1e02f6+'/'+_0x6e9144)['json'](_0x16aa5d);}return null;};}function patchUpdates(_0x5f00ae){return function(_0x1c61df){try{jsonpatch[_0x7999('0x31')](_0x1c61df,_0x5f00ae,!![]);}catch(_0x536810){return BPromise['reject'](_0x536810);}return _0x1c61df[_0x7999('0x32')]();};}function saveUpdates(_0x4e3c33,_0x4bf585){return function(_0x51716c){if(_0x51716c){return _0x51716c['update'](_0x4e3c33)[_0x7999('0x21')](function(_0x1f525e){return _0x1f525e;});}return null;};}function removeEntity(_0x2e1929,_0x20b613){return function(_0x55a7be){if(_0x55a7be){return _0x55a7be['destroy']()[_0x7999('0x21')](function(){_0x2e1929[_0x7999('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1175cc,_0x458026){return function(_0x334aa1){if(!_0x334aa1){_0x1175cc[_0x7999('0x33')](0x194);}return _0x334aa1;};}function handleError(_0x19a5cb,_0x1d8ab0){_0x1d8ab0=_0x1d8ab0||0x1f4;return function(_0xe7d188){logger[_0x7999('0x26')](_0xe7d188[_0x7999('0x34')]);if(_0xe7d188['name']){delete _0xe7d188[_0x7999('0x35')];}_0x19a5cb[_0x7999('0x2a')](_0x1d8ab0)['send'](_0xe7d188);};}exports[_0x7999('0x36')]=function(_0x5433d3,_0x206c8b){var _0x2588db={},_0x3c4caf={},_0x415f27={'count':0x0,'rows':[]};var _0x2918b9=_[_0x7999('0x37')](db[_0x7999('0x38')][_0x7999('0x39')],function(_0x5b7094){return{'name':_0x5b7094[_0x7999('0x3a')],'type':_0x5b7094[_0x7999('0x3b')][_0x7999('0x3c')]};});_0x3c4caf['model']=_[_0x7999('0x37')](_0x2918b9,_0x7999('0x35'));_0x3c4caf[_0x7999('0x3d')]=_[_0x7999('0x3e')](_0x5433d3[_0x7999('0x3d')]);_0x3c4caf[_0x7999('0x3f')]=_[_0x7999('0x40')](_0x3c4caf[_0x7999('0x41')],_0x3c4caf[_0x7999('0x3d')]);_0x2588db[_0x7999('0x42')]=_[_0x7999('0x40')](_0x3c4caf[_0x7999('0x41')],qs[_0x7999('0x43')](_0x5433d3[_0x7999('0x3d')]['fields']));_0x2588db['attributes']=_0x2588db[_0x7999('0x42')][_0x7999('0x44')]?_0x2588db[_0x7999('0x42')]:_0x3c4caf[_0x7999('0x41')];if(!_0x5433d3['query']['hasOwnProperty'](_0x7999('0x45'))){_0x2588db[_0x7999('0x2f')]=qs[_0x7999('0x2f')](_0x5433d3[_0x7999('0x3d')][_0x7999('0x2f')]);_0x2588db['offset']=qs['offset'](_0x5433d3['query'][_0x7999('0x2e')]);}_0x2588db[_0x7999('0x46')]=qs[_0x7999('0x47')](_0x5433d3['query'][_0x7999('0x47')]);_0x2588db[_0x7999('0x48')]=qs[_0x7999('0x3f')](_[_0x7999('0x49')](_0x5433d3[_0x7999('0x3d')],_0x3c4caf[_0x7999('0x3f')]),_0x2918b9);if(_0x5433d3[_0x7999('0x3d')][_0x7999('0x4a')]){_0x2588db['where']=_['merge'](_0x2588db[_0x7999('0x48')],{'$or':_['map'](_0x2918b9,function(_0x36da80){if(_0x36da80['type']!=='VIRTUAL'){var _0x1bd2a2={};_0x1bd2a2[_0x36da80['name']]={'$like':'%'+_0x5433d3[_0x7999('0x3d')][_0x7999('0x4a')]+'%'};return _0x1bd2a2;}})});}_0x2588db=_[_0x7999('0x4b')]({},_0x2588db,_0x5433d3[_0x7999('0x4c')]);var _0x399924={'where':_0x2588db['where']};return db[_0x7999('0x38')][_0x7999('0x2d')](_0x399924)[_0x7999('0x21')](function(_0x2e2e93){_0x415f27[_0x7999('0x2d')]=_0x2e2e93;if(_0x5433d3[_0x7999('0x3d')][_0x7999('0x4d')]){_0x2588db['include']=[{'all':!![]}];}return db[_0x7999('0x38')][_0x7999('0x4e')](_0x2588db);})[_0x7999('0x21')](function(_0x1a5cd6){_0x415f27['rows']=_0x1a5cd6;return _0x415f27;})['then'](respondWithFilteredResult(_0x206c8b,_0x2588db))[_0x7999('0x4f')](handleError(_0x206c8b,null));};exports[_0x7999('0x50')]=function(_0x4e6529,_0x5e5664){var _0x26d047={'raw':!![],'where':{'id':_0x4e6529[_0x7999('0x51')]['id']}},_0x4c5402={};_0x4c5402['model']=_['keys'](db[_0x7999('0x38')]['rawAttributes']);_0x4c5402[_0x7999('0x3d')]=_['keys'](_0x4e6529[_0x7999('0x3d')]);_0x4c5402['filters']=_[_0x7999('0x40')](_0x4c5402[_0x7999('0x41')],_0x4c5402[_0x7999('0x3d')]);_0x26d047['attributes']=_['intersection'](_0x4c5402[_0x7999('0x41')],qs[_0x7999('0x43')](_0x4e6529['query'][_0x7999('0x43')]));_0x26d047[_0x7999('0x42')]=_0x26d047[_0x7999('0x42')][_0x7999('0x44')]?_0x26d047[_0x7999('0x42')]:_0x4c5402['model'];if(_0x4e6529[_0x7999('0x3d')][_0x7999('0x4d')]){_0x26d047[_0x7999('0x52')]=[{'all':!![]}];}_0x26d047=_[_0x7999('0x4b')]({},_0x26d047,_0x4e6529[_0x7999('0x4c')]);return db['MailMessage'][_0x7999('0x53')](_0x26d047)[_0x7999('0x21')](handleEntityNotFound(_0x5e5664,null))[_0x7999('0x21')](respondWithResult(_0x5e5664,null))[_0x7999('0x4f')](handleError(_0x5e5664,null));};exports[_0x7999('0x54')]=function(_0x35d4dc,_0x52e151){if(_0x35d4dc[_0x7999('0x55')]['id']){delete _0x35d4dc[_0x7999('0x55')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x35d4dc[_0x7999('0x51')]['id']}})[_0x7999('0x21')](handleEntityNotFound(_0x52e151,null))[_0x7999('0x21')](saveUpdates(_0x35d4dc[_0x7999('0x55')],null))[_0x7999('0x21')](respondWithResult(_0x52e151,null))[_0x7999('0x4f')](handleError(_0x52e151,null));};exports[_0x7999('0x56')]=function(_0x40a582,_0x4aa712){return db[_0x7999('0x38')][_0x7999('0x53')]({'where':{'id':_0x40a582[_0x7999('0x51')]['id']}})['then'](handleEntityNotFound(_0x4aa712,null))[_0x7999('0x21')](removeEntity(_0x4aa712,null))['catch'](handleError(_0x4aa712,null));};exports['describe']=function(_0x251614,_0x4371a5){return db[_0x7999('0x38')]['describe']()[_0x7999('0x21')](respondWithResult(_0x4371a5,null))[_0x7999('0x4f')](handleError(_0x4371a5,null));};exports[_0x7999('0x57')]=function(_0x577758,_0x5af58a){return db[_0x7999('0x38')][_0x7999('0x57')](_0x577758[_0x7999('0x55')])['then'](function(_0x57f16a){if(_0x57f16a){if(_0x57f16a[_0x7999('0x58')]===_0x7999('0x59')&&!_0x57f16a[_0x7999('0x5a')]){var _0x5b6c5a,_0x5bcc9d,_0x26d120;if(_0x577758[_0x7999('0x55')]['to']){_0x5bcc9d=_0x577758[_0x7999('0x55')]['to'][_0x7999('0x5b')](',')[0x0];}return db['MailAccount'][_0x7999('0x5c')]({'where':{'id':_0x57f16a[_0x7999('0x5d')]},'include':[{'model':db['CmList'],'as':_0x7999('0x5e'),'include':[{'model':db['CmContact'],'as':_0x7999('0x5f'),'where':{'email':_0x5bcc9d},'limit':0x1,'order':[[_0x7999('0x60'),_0x7999('0x61')]]}]},{'model':db['MailServerOut'],'as':_0x7999('0x62'),'raw':!![]}]})[_0x7999('0x21')](function(_0x12aeec){_0x5b6c5a=_0x12aeec;if(_0x5b6c5a&&_0x5b6c5a[_0x7999('0x62')]){var _0x21eec3={'tls':{'rejectUnauthorized':![]}};if(_[_0x7999('0x63')](_0x5b6c5a[_0x7999('0x62')][_0x7999('0x64')])){_0x21eec3[_0x7999('0x65')]=_0x5b6c5a[_0x7999('0x62')][_0x7999('0x65')];_0x21eec3[_0x7999('0x66')]=_0x5b6c5a[_0x7999('0x62')][_0x7999('0x66')];_0x21eec3['secure']=_0x5b6c5a[_0x7999('0x62')]['secure'];if(_0x5b6c5a[_0x7999('0x62')]['authentication']){_0x21eec3[_0x7999('0x67')]={'user':_0x5b6c5a['Smtp'][_0x7999('0x68')],'pass':_0x5b6c5a['Smtp'][_0x7999('0x69')]};}}else{_0x21eec3[_0x7999('0x64')]=_0x5b6c5a['Smtp'][_0x7999('0x64')];_0x21eec3[_0x7999('0x67')]={'user':_0x5b6c5a[_0x7999('0x62')]['user'],'pass':_0x5b6c5a[_0x7999('0x62')]['pass']};_0x21eec3[_0x7999('0x6a')]=_0x5b6c5a[_0x7999('0x62')][_0x7999('0x6a')];}if(_0x577758[_0x7999('0x55')][_0x7999('0x6b')]&&_0x577758[_0x7999('0x55')][_0x7999('0x6b')][_0x7999('0x44')]){for(var _0x38f079=0x0;_0x38f079<_0x577758[_0x7999('0x55')][_0x7999('0x6b')][_0x7999('0x44')];_0x38f079+=0x1){_0x577758[_0x7999('0x55')]['attachments'][_0x38f079]={'filename':_0x577758['body']['attachments'][_0x38f079][_0x7999('0x35')],'path':path[_0x7999('0x6c')](config[_0x7999('0x6d')],'server/files/attachments',_0x577758[_0x7999('0x55')][_0x7999('0x6b')][_0x38f079][_0x7999('0x6e')])};}}_0x26d120={'account':_0x21eec3,'message':_0x577758['body']};return;}})['then'](function(){if(_0x5b6c5a[_0x7999('0x5e')]){if(_0x5b6c5a[_0x7999('0x5e')]['Contacts'][_0x7999('0x44')]){return _0x5b6c5a['List']['Contacts'][0x0];}else{return db[_0x7999('0x6f')][_0x7999('0x57')](_[_0x7999('0x19')](_0x577758[_0x7999('0x55')],{'firstName':_0x577758[_0x7999('0x55')]['to'],'email':_0x577758[_0x7999('0x55')]['to'],'phone':_0x577758[_0x7999('0x55')]['to'],'ListId':_0x5b6c5a[_0x7999('0x70')]}));}}else{throw new Error(_0x7999('0x71'));}})['then'](function(){if(_0x26d120){return respondWithRpcPromise(_0x7999('0x72'),_0x7999('0x73'),_0x26d120,client9003)['then'](function(_0x3a1318){return _0x57f16a[_0x7999('0x54')]({'read':!![],'messageId':_0x3a1318[_0x7999('0x74')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x7999('0x4f')](function(_0x5b2b45){logger[_0x7999('0x26')]('%s',JSON['stringify'](_0x5b2b45));return _0x57f16a;});}return _0x57f16a;});}return _0x57f16a;}})['then'](respondWithResult(_0x5af58a,0xc9))['catch'](handleError(_0x5af58a,null));};var interaction_log=require(_0x7999('0x15'))(_0x7999('0x75'));exports[_0x7999('0x76')]=function(_0x11e362,_0x2bf68d,_0x1e6eb3){var _0x24efbe={'agent':{},'channel':_0x7999('0x77')};if(_0x11e362['body']['id']){delete _0x11e362['body']['id'];}_0x11e362[_0x7999('0x55')]['read']=!![];_0x11e362[_0x7999('0x55')]['readAt']=moment()[_0x7999('0x78')](_0x7999('0x79'));_0x11e362[_0x7999('0x55')][_0x7999('0x7a')]=_0x11e362[_0x7999('0x55')][_0x7999('0x7a')]||_0x11e362[_0x7999('0x68')]['id'];_0x24efbe[_0x7999('0x7b')]['id']=_0x11e362['body'][_0x7999('0x7a')];return db[_0x7999('0x38')][_0x7999('0x53')]({'where':{'id':_0x11e362['params']['id'],'UserId':null},'include':[{'model':db[_0x7999('0x6f')],'as':_0x7999('0x7c')}]})['then'](handleEntityNotFound(_0x2bf68d,null))[_0x7999('0x21')](saveUpdates(_0x11e362[_0x7999('0x55')],null))[_0x7999('0x21')](function(_0xf22bd9){if(_0xf22bd9){_0x24efbe[_0x7999('0x29')]=_0xf22bd9[_0x7999('0x7d')]({'plain':!![]});return db[_0x7999('0x7e')][_0x7999('0x53')]({'where':{'id':_0xf22bd9['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2bf68d,null))[_0x7999('0x21')](function(_0x5a3f30){if(_0x5a3f30){return _0x5a3f30[_0x7999('0x54')]({'UserId':_0x11e362[_0x7999('0x55')][_0x7999('0x7a')],'read1stAt':_[_0x7999('0x63')](_0x5a3f30[_0x7999('0x7f')])?moment()[_0x7999('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7999('0x21')](function(_0x157ace){if(_0x157ace){_0x24efbe[_0x7999('0x80')]=_0x157ace['get']({'plain':!![]});interaction_log[_0x7999('0x22')](_0x7999('0x81'),_0x11e362[_0x7999('0x68')]['id'],_0x11e362[_0x7999('0x68')]['name'],_0x11e362['user'][_0x7999('0x82')],_0x24efbe['interaction']['id'],_0x11e362[_0x7999('0x55')]?JSON['stringify'](_0x11e362[_0x7999('0x55')]):_0x7999('0x83'));return respondWithRpcPromise(_0x7999('0x84'),_0x7999('0x85'),_0x24efbe);}return null;})[_0x7999('0x21')](function(_0x3ae624){if(_0x3ae624){if(_0x11e362[_0x7999('0x55')]['manual']){_0x24efbe[_0x7999('0x29')][_0x7999('0x86')]=util[_0x7999('0x78')](_0x7999('0x87'),_0x11e362['user'][_0x7999('0x35')]);_0x24efbe['message']['channel']=_0x24efbe[_0x7999('0x88')];_0x24efbe[_0x7999('0x29')]['event']=_0x7999('0x76');return respondWithRpcPromise(_0x7999('0x89'),_0x7999('0x89'),{'event':_0x7999('0x8a'),'message':_0x24efbe[_0x7999('0x29')]},client9002)['then'](function(){return _0x24efbe;});}return _0x24efbe;}return null;})[_0x7999('0x21')](respondWithResult(_0x2bf68d,null))[_0x7999('0x4f')](handleError(_0x2bf68d,null));};var interaction_log=require(_0x7999('0x15'))(_0x7999('0x75'));exports['reject']=function(_0x325d12,_0x162d5f,_0x398bc8){var _0x3aa508={'agent':{},'channel':_0x7999('0x77')};if(_0x325d12['body']['id']){delete _0x325d12[_0x7999('0x55')]['id'];}_0x325d12[_0x7999('0x55')][_0x7999('0x7a')]=_0x325d12[_0x7999('0x55')][_0x7999('0x7a')]||_0x325d12[_0x7999('0x68')]['id'];_0x3aa508['agent']['id']=_0x325d12[_0x7999('0x55')][_0x7999('0x7a')];return db[_0x7999('0x38')][_0x7999('0x53')]({'where':{'id':_0x325d12['params']['id'],'UserId':null}})[_0x7999('0x21')](handleEntityNotFound(_0x162d5f,null))[_0x7999('0x21')](function(_0x5647b8){if(_0x5647b8){_0x3aa508[_0x7999('0x29')]=_0x5647b8[_0x7999('0x7d')]({'plain':!![]});return db[_0x7999('0x7e')][_0x7999('0x53')]({'where':{'id':_0x5647b8[_0x7999('0x8b')]}});}return null;})[_0x7999('0x21')](handleEntityNotFound(_0x162d5f,null))[_0x7999('0x21')](function(_0x315ca8){if(_0x315ca8){_0x3aa508[_0x7999('0x80')]=_0x315ca8['get']({'plain':!![]});interaction_log[_0x7999('0x22')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x325d12['user']['id'],_0x325d12[_0x7999('0x68')][_0x7999('0x35')],_0x325d12[_0x7999('0x68')]['role'],_0x3aa508[_0x7999('0x80')]['id'],_0x325d12[_0x7999('0x55')]?JSON[_0x7999('0x25')](_0x325d12[_0x7999('0x55')]):_0x7999('0x83'));return respondWithRpcPromise(_0x7999('0x8c'),_0x7999('0x8d'),_0x3aa508);}return null;})[_0x7999('0x21')](function(_0x5c073c){if(_0x5c073c){_0x5c073c[_0x7999('0x29')][_0x7999('0x86')]=util[_0x7999('0x78')](_0x7999('0x87'),_0x325d12[_0x7999('0x68')]['name']);_0x5c073c[_0x7999('0x29')][_0x7999('0x88')]=_0x3aa508[_0x7999('0x88')];_0x5c073c[_0x7999('0x29')][_0x7999('0x8e')]=_0x7999('0x8f');respondWithRpcPromise(_0x7999('0x89'),_0x7999('0x89'),{'event':'rejectmessage','message':_0x5c073c[_0x7999('0x29')]},client9002);return _0x3aa508;}return null;})[_0x7999('0x21')](respondWithResult(_0x162d5f,null))[_0x7999('0x4f')](handleError(_0x162d5f,null));};exports[_0x7999('0x90')]=function(_0x60135d,_0x5214f9){var _0x84f792=moment()[_0x7999('0x91')]()[_0x7999('0x92')]();var _0x57d189=path[_0x7999('0x6c')](config['root'],_0x7999('0x93'),_0x7999('0x94'),_0x7999('0x95'));var _0x1156bb=path[_0x7999('0x6c')](config[_0x7999('0x6d')],_0x7999('0x93'),_0x7999('0x94'),_0x7999('0x6b'));var _0x4fcd97=util['format'](_0x7999('0x96'),_0x84f792);return db[_0x7999('0x38')][_0x7999('0x53')]({'where':{'id':_0x60135d[_0x7999('0x51')]['id']},'attributes':['id',_0x7999('0x55'),_0x7999('0x97'),'to','cc',_0x7999('0x98'),_0x7999('0x99'),'createdAt'],'include':_0x60135d[_0x7999('0x3d')]['attachments']?[{'model':db[_0x7999('0x9a')],'as':'Attachments'}]:undefined})[_0x7999('0x21')](handleEntityNotFound(_0x5214f9,null))[_0x7999('0x21')](function(_0x46175d){if(_0x46175d){var _0x26e0a2=_0x46175d;var _0x2a6edc={'from':_0x26e0a2[_0x7999('0x97')],'to':_0x26e0a2['to'],'subject':_0x26e0a2['subject'],'html':_0x26e0a2[_0x7999('0x55')],'headers':{'Date':moment(_0x26e0a2[_0x7999('0x9b')])[_0x7999('0x78')](_0x7999('0x9c'))},'attachments':[]};if(_0x46175d['cc']){_0x2a6edc[_0x7999('0x9d')]['Cc']=_0x46175d['cc'];}if(_0x46175d[_0x7999('0x98')]){_0x2a6edc['headers'][_0x7999('0x9e')]=_0x46175d[_0x7999('0x98')];}return new BPromise(function(_0x30cb29,_0x31fde3){if(_0x46175d[_0x7999('0x9f')]){for(var _0x523992=0x0;_0x523992<_0x46175d[_0x7999('0x9f')][_0x7999('0x44')];_0x523992++){var _0x3f72a0=_0x46175d[_0x7999('0x9f')][_0x523992];var _0x2c2aae=path[_0x7999('0x6c')](_0x1156bb,_0x3f72a0[_0x7999('0x6e')]);if(fs[_0x7999('0xa0')](_0x2c2aae)){_0x2a6edc[_0x7999('0x6b')][_0x7999('0xa1')]({'name':_0x3f72a0[_0x7999('0x35')],'contentType':_0x3f72a0[_0x7999('0x3b')],'data':fs[_0x7999('0xa2')](_0x2c2aae)});}}}emlformat[_0x7999('0xa3')](_0x2a6edc,function(_0x5db966,_0x1e4fa4){if(_0x5db966)return _0x31fde3(_0x5db966);fs[_0x7999('0xa4')](path[_0x7999('0x6c')](_0x57d189,_0x4fcd97),_0x1e4fa4);return _0x30cb29(_0x1e4fa4);});});}})['then'](function(_0x449465){if(_0x449465){return _0x5214f9[_0x7999('0x90')](path[_0x7999('0x6c')](_0x57d189,_0x4fcd97),_0x4fcd97,function(_0x30618e){if(_0x30618e){console[_0x7999('0xa5')]('err',_0x30618e);}else{fs[_0x7999('0xa6')](path[_0x7999('0x6c')](_0x57d189,_0x4fcd97));}});}})[_0x7999('0x4f')](handleError(_0x5214f9,null));}; \ No newline at end of file +var _0xecf6=['from','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','log','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','end','sendStatus','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','MailMessage','findAll','rows','params','rawAttributes','include','find','body','describe','create','direction','out','secret','split','MailAccount','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','basename','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','read','readAt','UserId','agent','get','MailInteractionId','read1stAt','interaction','role','null','AcceptMessage','manual','SIP/%s','channel','event','EventManager','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','rejectmessage','download','unix','root','server','files','message-%s.eml','bcc','createdAt','Attachment'];(function(_0x19022d,_0x3b24be){var _0x4eadcd=function(_0x57f9c4){while(--_0x57f9c4){_0x19022d['push'](_0x19022d['shift']());}};_0x4eadcd(++_0x3b24be);}(_0xecf6,0x159));var _0x6ecf=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xecf6[_0x243b2f];return _0xcb3c2d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6ecf('0x0'));var zipdir=require(_0x6ecf('0x1'));var jsonpatch=require(_0x6ecf('0x2'));var rp=require('request-promise');var moment=require(_0x6ecf('0x3'));var BPromise=require(_0x6ecf('0x4'));var Mustache=require('mustache');var util=require(_0x6ecf('0x5'));var path=require('path');var sox=require(_0x6ecf('0x6'));var csv=require(_0x6ecf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ecf('0x8'));var _=require(_0x6ecf('0x9'));var squel=require(_0x6ecf('0xa'));var crypto=require(_0x6ecf('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6ecf('0xc'));var toCsv=require(_0x6ecf('0x7'));var querystring=require('querystring');var Papa=require(_0x6ecf('0xd'));var Redis=require(_0x6ecf('0xe'));var authService=require(_0x6ecf('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ecf('0x10'));var logger=require(_0x6ecf('0x11'))(_0x6ecf('0x12'));var utils=require(_0x6ecf('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6ecf('0x14'));var db=require(_0x6ecf('0x15'))['db'];config[_0x6ecf('0x16')]=_[_0x6ecf('0x17')](config[_0x6ecf('0x16')],{'host':_0x6ecf('0x18'),'port':0x18eb});var socket=require(_0x6ecf('0x19'))(new Redis(config[_0x6ecf('0x16')]));require(_0x6ecf('0x1a'))[_0x6ecf('0x1b')](socket);var jayson=require(_0x6ecf('0x1c'));var client=jayson[_0x6ecf('0x1d')][_0x6ecf('0x1e')]({'port':0x232c});var client9003=jayson[_0x6ecf('0x1d')][_0x6ecf('0x1e')]({'port':0x232b});var client9002=jayson[_0x6ecf('0x1d')][_0x6ecf('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xc92fdb,_0xb322d0,_0x497d78,_0x29c3dc){return new BPromise(function(_0x1b5a7c,_0x1d58de){var _0xa00132=_0x29c3dc||client;return _0xa00132[_0x6ecf('0x1f')](_0xc92fdb,_0x497d78)['then'](function(_0x44b5f4){logger[_0x6ecf('0x20')](_0x6ecf('0x21'),_0xb322d0,_0x6ecf('0x22'));logger[_0x6ecf('0x23')](_0x6ecf('0x24'),_0xb322d0,'request\x20sent',JSON['stringify'](_0x44b5f4));if(_0x44b5f4[_0x6ecf('0x25')]){if(_0x44b5f4[_0x6ecf('0x25')][_0x6ecf('0x26')]===0x1f4){logger[_0x6ecf('0x25')](_0x6ecf('0x21'),_0xb322d0,_0x44b5f4[_0x6ecf('0x25')][_0x6ecf('0x27')]);return _0x1d58de(_0x44b5f4['error'][_0x6ecf('0x27')]);}logger['error'](_0x6ecf('0x21'),_0xb322d0,_0x44b5f4['error'][_0x6ecf('0x27')]);return _0x1b5a7c(_0x44b5f4['error'][_0x6ecf('0x27')]);}else{logger[_0x6ecf('0x20')](_0x6ecf('0x21'),_0xb322d0,_0x6ecf('0x22'));_0x1b5a7c(_0x44b5f4[_0x6ecf('0x28')]['message']);}})[_0x6ecf('0x29')](function(_0xe2897){logger[_0x6ecf('0x25')](_0x6ecf('0x21'),_0xb322d0,_0xe2897);_0x1d58de(_0xe2897);});});}function respondWithStatusCode(_0x406355,_0x56d7d0){_0x56d7d0=_0x56d7d0||0xcc;return function(_0x1801ad){if(_0x1801ad){return _0x406355['sendStatus'](_0x56d7d0);}return _0x406355['status'](_0x56d7d0)['end']();};}function respondWithResult(_0xea086f,_0x5912bc){_0x5912bc=_0x5912bc||0xc8;return function(_0x2c9dd9){if(_0x2c9dd9){return _0xea086f[_0x6ecf('0x2a')](_0x5912bc)['json'](_0x2c9dd9);}};}function respondWithFilteredResult(_0x6495b3,_0x407c51){return function(_0x1b1cc1){if(_0x1b1cc1){var _0x5b44c1=_0x1b1cc1[_0x6ecf('0x2b')],_0x7e8c59=_0x407c51[_0x6ecf('0x2c')],_0x40a905=_0x407c51[_0x6ecf('0x2c')]+_0x407c51[_0x6ecf('0x2d')],_0x5cd1c7;if(_0x40a905>=_0x5b44c1){_0x40a905=_0x5b44c1;_0x5cd1c7=0xc8;}else{_0x5cd1c7=0xce;}_0x6495b3['status'](_0x5cd1c7);return _0x6495b3[_0x6ecf('0x2e')](_0x6ecf('0x2f'),_0x7e8c59+'-'+_0x40a905+'/'+_0x5b44c1)[_0x6ecf('0x30')](_0x1b1cc1);}return null;};}function patchUpdates(_0x141f84){return function(_0xe7ac9f){try{jsonpatch[_0x6ecf('0x31')](_0xe7ac9f,_0x141f84,!![]);}catch(_0x57ac9c){return BPromise['reject'](_0x57ac9c);}return _0xe7ac9f[_0x6ecf('0x32')]();};}function saveUpdates(_0x4805e3,_0x73f4f){return function(_0xab6480){if(_0xab6480){return _0xab6480[_0x6ecf('0x33')](_0x4805e3)[_0x6ecf('0x34')](function(_0x2b20a0){return _0x2b20a0;});}return null;};}function removeEntity(_0x4ac91d,_0x3c679e){return function(_0xf8f9fe){if(_0xf8f9fe){return _0xf8f9fe[_0x6ecf('0x35')]()[_0x6ecf('0x34')](function(){_0x4ac91d['status'](0xcc)[_0x6ecf('0x36')]();});}};}function handleEntityNotFound(_0x3650ed,_0x723730){return function(_0x5b3e3e){if(!_0x5b3e3e){_0x3650ed[_0x6ecf('0x37')](0x194);}return _0x5b3e3e;};}function handleError(_0x756f4e,_0x20975b){_0x20975b=_0x20975b||0x1f4;return function(_0x5948bc){logger[_0x6ecf('0x25')](_0x5948bc['stack']);if(_0x5948bc[_0x6ecf('0x38')]){delete _0x5948bc[_0x6ecf('0x38')];}_0x756f4e['status'](_0x20975b)[_0x6ecf('0x39')](_0x5948bc);};}exports[_0x6ecf('0x3a')]=function(_0x1c58b2,_0x3d8ed6){var _0x3ddd7a={},_0x2fff22={},_0x2d3ff2={'count':0x0,'rows':[]};var _0x39700f=_[_0x6ecf('0x3b')](db['MailMessage']['rawAttributes'],function(_0xe83de){return{'name':_0xe83de[_0x6ecf('0x3c')],'type':_0xe83de[_0x6ecf('0x3d')][_0x6ecf('0x3e')]};});_0x2fff22[_0x6ecf('0x3f')]=_[_0x6ecf('0x3b')](_0x39700f,_0x6ecf('0x38'));_0x2fff22[_0x6ecf('0x40')]=_[_0x6ecf('0x41')](_0x1c58b2['query']);_0x2fff22[_0x6ecf('0x42')]=_[_0x6ecf('0x43')](_0x2fff22[_0x6ecf('0x3f')],_0x2fff22[_0x6ecf('0x40')]);_0x3ddd7a[_0x6ecf('0x44')]=_[_0x6ecf('0x43')](_0x2fff22[_0x6ecf('0x3f')],qs[_0x6ecf('0x45')](_0x1c58b2[_0x6ecf('0x40')][_0x6ecf('0x45')]));_0x3ddd7a[_0x6ecf('0x44')]=_0x3ddd7a['attributes'][_0x6ecf('0x46')]?_0x3ddd7a[_0x6ecf('0x44')]:_0x2fff22[_0x6ecf('0x3f')];if(!_0x1c58b2[_0x6ecf('0x40')][_0x6ecf('0x47')](_0x6ecf('0x48'))){_0x3ddd7a[_0x6ecf('0x2d')]=qs['limit'](_0x1c58b2[_0x6ecf('0x40')][_0x6ecf('0x2d')]);_0x3ddd7a['offset']=qs['offset'](_0x1c58b2[_0x6ecf('0x40')][_0x6ecf('0x2c')]);}_0x3ddd7a[_0x6ecf('0x49')]=qs[_0x6ecf('0x4a')](_0x1c58b2['query'][_0x6ecf('0x4a')]);_0x3ddd7a[_0x6ecf('0x4b')]=qs[_0x6ecf('0x42')](_['pick'](_0x1c58b2[_0x6ecf('0x40')],_0x2fff22[_0x6ecf('0x42')]),_0x39700f);if(_0x1c58b2[_0x6ecf('0x40')]['filter']){_0x3ddd7a[_0x6ecf('0x4b')]=_[_0x6ecf('0x4c')](_0x3ddd7a[_0x6ecf('0x4b')],{'$or':_[_0x6ecf('0x3b')](_0x39700f,function(_0x2ece27){if(_0x2ece27[_0x6ecf('0x3d')]!==_0x6ecf('0x4d')){var _0x4b60d5={};_0x4b60d5[_0x2ece27[_0x6ecf('0x38')]]={'$like':'%'+_0x1c58b2[_0x6ecf('0x40')]['filter']+'%'};return _0x4b60d5;}})});}_0x3ddd7a=_[_0x6ecf('0x4c')]({},_0x3ddd7a,_0x1c58b2[_0x6ecf('0x4e')]);var _0x939af7={'where':_0x3ddd7a[_0x6ecf('0x4b')]};return db['MailMessage'][_0x6ecf('0x2b')](_0x939af7)[_0x6ecf('0x34')](function(_0x5904de){_0x2d3ff2[_0x6ecf('0x2b')]=_0x5904de;if(_0x1c58b2[_0x6ecf('0x40')][_0x6ecf('0x4f')]){_0x3ddd7a['include']=[{'all':!![]}];}return db[_0x6ecf('0x50')][_0x6ecf('0x51')](_0x3ddd7a);})['then'](function(_0x5d859a){_0x2d3ff2[_0x6ecf('0x52')]=_0x5d859a;return _0x2d3ff2;})[_0x6ecf('0x34')](respondWithFilteredResult(_0x3d8ed6,_0x3ddd7a))[_0x6ecf('0x29')](handleError(_0x3d8ed6,null));};exports['show']=function(_0x4bd8b2,_0x5c4dc7){var _0x3c75a6={'raw':!![],'where':{'id':_0x4bd8b2[_0x6ecf('0x53')]['id']}},_0x188b0e={};_0x188b0e[_0x6ecf('0x3f')]=_['keys'](db[_0x6ecf('0x50')][_0x6ecf('0x54')]);_0x188b0e['query']=_[_0x6ecf('0x41')](_0x4bd8b2[_0x6ecf('0x40')]);_0x188b0e[_0x6ecf('0x42')]=_['intersection'](_0x188b0e['model'],_0x188b0e[_0x6ecf('0x40')]);_0x3c75a6[_0x6ecf('0x44')]=_[_0x6ecf('0x43')](_0x188b0e['model'],qs['fields'](_0x4bd8b2[_0x6ecf('0x40')][_0x6ecf('0x45')]));_0x3c75a6[_0x6ecf('0x44')]=_0x3c75a6[_0x6ecf('0x44')][_0x6ecf('0x46')]?_0x3c75a6[_0x6ecf('0x44')]:_0x188b0e[_0x6ecf('0x3f')];if(_0x4bd8b2['query'][_0x6ecf('0x4f')]){_0x3c75a6[_0x6ecf('0x55')]=[{'all':!![]}];}_0x3c75a6=_[_0x6ecf('0x4c')]({},_0x3c75a6,_0x4bd8b2[_0x6ecf('0x4e')]);return db[_0x6ecf('0x50')][_0x6ecf('0x56')](_0x3c75a6)[_0x6ecf('0x34')](handleEntityNotFound(_0x5c4dc7,null))[_0x6ecf('0x34')](respondWithResult(_0x5c4dc7,null))['catch'](handleError(_0x5c4dc7,null));};exports['update']=function(_0x56bd58,_0x347015){if(_0x56bd58[_0x6ecf('0x57')]['id']){delete _0x56bd58[_0x6ecf('0x57')]['id'];}return db['MailMessage'][_0x6ecf('0x56')]({'where':{'id':_0x56bd58[_0x6ecf('0x53')]['id']}})['then'](handleEntityNotFound(_0x347015,null))['then'](saveUpdates(_0x56bd58[_0x6ecf('0x57')],null))[_0x6ecf('0x34')](respondWithResult(_0x347015,null))['catch'](handleError(_0x347015,null));};exports[_0x6ecf('0x35')]=function(_0x168ee3,_0x4b3a24){return db[_0x6ecf('0x50')][_0x6ecf('0x56')]({'where':{'id':_0x168ee3['params']['id']}})['then'](handleEntityNotFound(_0x4b3a24,null))[_0x6ecf('0x34')](removeEntity(_0x4b3a24,null))[_0x6ecf('0x29')](handleError(_0x4b3a24,null));};exports[_0x6ecf('0x58')]=function(_0x3a1c38,_0x2fa62c){return db[_0x6ecf('0x50')]['describe']()['then'](respondWithResult(_0x2fa62c,null))[_0x6ecf('0x29')](handleError(_0x2fa62c,null));};exports[_0x6ecf('0x59')]=function(_0x2a067e,_0x79ed70){return db['MailMessage']['create'](_0x2a067e[_0x6ecf('0x57')])['then'](function(_0x149e88){if(_0x149e88){if(_0x149e88[_0x6ecf('0x5a')]===_0x6ecf('0x5b')&&!_0x149e88[_0x6ecf('0x5c')]){var _0x39fdfa,_0x483db4,_0x11d914;if(_0x2a067e[_0x6ecf('0x57')]['to']){_0x483db4=_0x2a067e[_0x6ecf('0x57')]['to'][_0x6ecf('0x5d')](',')[0x0];}return db[_0x6ecf('0x5e')]['findOne']({'where':{'id':_0x149e88[_0x6ecf('0x5f')]},'include':[{'model':db['CmList'],'as':_0x6ecf('0x60'),'include':[{'model':db[_0x6ecf('0x61')],'as':_0x6ecf('0x62'),'where':{'email':_0x483db4},'limit':0x1,'order':[[_0x6ecf('0x63'),_0x6ecf('0x64')]]}]},{'model':db[_0x6ecf('0x65')],'as':_0x6ecf('0x66'),'raw':!![]}]})[_0x6ecf('0x34')](function(_0x24d7ea){_0x39fdfa=_0x24d7ea;if(_0x39fdfa&&_0x39fdfa[_0x6ecf('0x66')]){var _0x8da219={'tls':{'rejectUnauthorized':![]}};if(_[_0x6ecf('0x67')](_0x39fdfa[_0x6ecf('0x66')][_0x6ecf('0x68')])){_0x8da219[_0x6ecf('0x69')]=_0x39fdfa[_0x6ecf('0x66')][_0x6ecf('0x69')];_0x8da219[_0x6ecf('0x6a')]=_0x39fdfa[_0x6ecf('0x66')][_0x6ecf('0x6a')];_0x8da219[_0x6ecf('0x6b')]=_0x39fdfa['Smtp'][_0x6ecf('0x6b')];if(_0x39fdfa[_0x6ecf('0x66')][_0x6ecf('0x6c')]){_0x8da219[_0x6ecf('0x6d')]={'user':_0x39fdfa[_0x6ecf('0x66')][_0x6ecf('0x6e')],'pass':_0x39fdfa[_0x6ecf('0x66')][_0x6ecf('0x6f')]};}}else{_0x8da219[_0x6ecf('0x68')]=_0x39fdfa[_0x6ecf('0x66')][_0x6ecf('0x68')];_0x8da219[_0x6ecf('0x6d')]={'user':_0x39fdfa[_0x6ecf('0x66')][_0x6ecf('0x6e')],'pass':_0x39fdfa['Smtp'][_0x6ecf('0x6f')]};_0x8da219[_0x6ecf('0x6b')]=_0x39fdfa['Smtp']['secure'];}if(_0x2a067e[_0x6ecf('0x57')]['attachments']&&_0x2a067e['body'][_0x6ecf('0x70')][_0x6ecf('0x46')]){for(var _0x233a9c=0x0;_0x233a9c<_0x2a067e[_0x6ecf('0x57')][_0x6ecf('0x70')][_0x6ecf('0x46')];_0x233a9c+=0x1){_0x2a067e[_0x6ecf('0x57')][_0x6ecf('0x70')][_0x233a9c]={'filename':_0x2a067e['body'][_0x6ecf('0x70')][_0x233a9c][_0x6ecf('0x38')],'path':path[_0x6ecf('0x71')](config['root'],'server/files/attachments',_0x2a067e[_0x6ecf('0x57')][_0x6ecf('0x70')][_0x233a9c][_0x6ecf('0x72')])};}}_0x11d914={'account':_0x8da219,'message':_0x2a067e[_0x6ecf('0x57')]};return;}})['then'](function(){if(_0x39fdfa[_0x6ecf('0x60')]){if(_0x39fdfa['List'][_0x6ecf('0x62')][_0x6ecf('0x46')]){return _0x39fdfa['List'][_0x6ecf('0x62')][0x0];}else{return db[_0x6ecf('0x61')]['create'](_[_0x6ecf('0x17')](_0x2a067e[_0x6ecf('0x57')],{'firstName':_0x2a067e[_0x6ecf('0x57')]['to'],'email':_0x2a067e[_0x6ecf('0x57')]['to'],'phone':_0x2a067e[_0x6ecf('0x57')]['to'],'ListId':_0x39fdfa['ListId']}));}}else{throw new Error(_0x6ecf('0x73'));}})[_0x6ecf('0x34')](function(){if(_0x11d914){return respondWithRpcPromise(_0x6ecf('0x74'),_0x6ecf('0x75'),_0x11d914,client9003)['then'](function(_0x3b947b){return _0x149e88[_0x6ecf('0x33')]({'read':!![],'messageId':_0x3b947b[_0x6ecf('0x76')],'sentAt':moment()[_0x6ecf('0x77')](_0x6ecf('0x78'))});})[_0x6ecf('0x29')](function(_0x19da52){logger[_0x6ecf('0x25')]('%s',JSON[_0x6ecf('0x79')](_0x19da52));return _0x149e88;});}return _0x149e88;});}return _0x149e88;}})[_0x6ecf('0x34')](respondWithResult(_0x79ed70,0xc9))[_0x6ecf('0x29')](handleError(_0x79ed70,null));};var interaction_log=require(_0x6ecf('0x11'))('mail-interactions');exports['accept']=function(_0x5c0995,_0x4b6d86,_0x2a8b85){var _0x7f7d5b={'agent':{},'channel':'mail'};if(_0x5c0995['body']['id']){delete _0x5c0995[_0x6ecf('0x57')]['id'];}_0x5c0995['body'][_0x6ecf('0x7a')]=!![];_0x5c0995[_0x6ecf('0x57')][_0x6ecf('0x7b')]=moment()[_0x6ecf('0x77')](_0x6ecf('0x78'));_0x5c0995[_0x6ecf('0x57')][_0x6ecf('0x7c')]=_0x5c0995['body'][_0x6ecf('0x7c')]||_0x5c0995['user']['id'];_0x7f7d5b[_0x6ecf('0x7d')]['id']=_0x5c0995['body'][_0x6ecf('0x7c')];return db[_0x6ecf('0x50')][_0x6ecf('0x56')]({'where':{'id':_0x5c0995[_0x6ecf('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x6ecf('0x61')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x4b6d86,null))[_0x6ecf('0x34')](saveUpdates(_0x5c0995[_0x6ecf('0x57')],null))[_0x6ecf('0x34')](function(_0x273459){if(_0x273459){_0x7f7d5b[_0x6ecf('0x27')]=_0x273459[_0x6ecf('0x7e')]({'plain':!![]});return db['MailInteraction'][_0x6ecf('0x56')]({'where':{'id':_0x273459[_0x6ecf('0x7f')]}});}return null;})[_0x6ecf('0x34')](handleEntityNotFound(_0x4b6d86,null))[_0x6ecf('0x34')](function(_0x1cd470){if(_0x1cd470){return _0x1cd470[_0x6ecf('0x33')]({'UserId':_0x5c0995[_0x6ecf('0x57')][_0x6ecf('0x7c')],'read1stAt':_[_0x6ecf('0x67')](_0x1cd470[_0x6ecf('0x80')])?moment()[_0x6ecf('0x77')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6ecf('0x34')](function(_0x344b7a){if(_0x344b7a){_0x7f7d5b[_0x6ecf('0x81')]=_0x344b7a['get']({'plain':!![]});interaction_log[_0x6ecf('0x20')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5c0995[_0x6ecf('0x6e')]['id'],_0x5c0995[_0x6ecf('0x6e')]['name'],_0x5c0995[_0x6ecf('0x6e')][_0x6ecf('0x82')],_0x7f7d5b[_0x6ecf('0x81')]['id'],_0x5c0995[_0x6ecf('0x57')]?JSON[_0x6ecf('0x79')](_0x5c0995[_0x6ecf('0x57')]):_0x6ecf('0x83'));return respondWithRpcPromise(_0x6ecf('0x84'),'acceptMessage',_0x7f7d5b);}return null;})[_0x6ecf('0x34')](function(_0xd23030){if(_0xd23030){if(_0x5c0995[_0x6ecf('0x57')][_0x6ecf('0x85')]){_0x7f7d5b[_0x6ecf('0x27')]['interface']=util['format'](_0x6ecf('0x86'),_0x5c0995[_0x6ecf('0x6e')][_0x6ecf('0x38')]);_0x7f7d5b[_0x6ecf('0x27')][_0x6ecf('0x87')]=_0x7f7d5b[_0x6ecf('0x87')];_0x7f7d5b[_0x6ecf('0x27')][_0x6ecf('0x88')]='accept';return respondWithRpcPromise(_0x6ecf('0x89'),_0x6ecf('0x89'),{'event':'acceptmessage','message':_0x7f7d5b['message']},client9002)[_0x6ecf('0x34')](function(){return _0x7f7d5b;});}return _0x7f7d5b;}return null;})['then'](respondWithResult(_0x4b6d86,null))[_0x6ecf('0x29')](handleError(_0x4b6d86,null));};var interaction_log=require(_0x6ecf('0x11'))('mail-interactions');exports[_0x6ecf('0x8a')]=function(_0xa15880,_0x32ccd7,_0x478e95){var _0x5e8fe3={'agent':{},'channel':'mail'};if(_0xa15880[_0x6ecf('0x57')]['id']){delete _0xa15880[_0x6ecf('0x57')]['id'];}_0xa15880['body'][_0x6ecf('0x7c')]=_0xa15880[_0x6ecf('0x57')][_0x6ecf('0x7c')]||_0xa15880[_0x6ecf('0x6e')]['id'];_0x5e8fe3[_0x6ecf('0x7d')]['id']=_0xa15880[_0x6ecf('0x57')]['UserId'];return db[_0x6ecf('0x50')][_0x6ecf('0x56')]({'where':{'id':_0xa15880[_0x6ecf('0x53')]['id'],'UserId':null}})[_0x6ecf('0x34')](handleEntityNotFound(_0x32ccd7,null))[_0x6ecf('0x34')](function(_0x1fd55a){if(_0x1fd55a){_0x5e8fe3[_0x6ecf('0x27')]=_0x1fd55a[_0x6ecf('0x7e')]({'plain':!![]});return db[_0x6ecf('0x8b')]['find']({'where':{'id':_0x1fd55a[_0x6ecf('0x7f')]}});}return null;})[_0x6ecf('0x34')](handleEntityNotFound(_0x32ccd7,null))[_0x6ecf('0x34')](function(_0x3c7f70){if(_0x3c7f70){_0x5e8fe3[_0x6ecf('0x81')]=_0x3c7f70[_0x6ecf('0x7e')]({'plain':!![]});interaction_log['info'](_0x6ecf('0x8c'),_0xa15880[_0x6ecf('0x6e')]['id'],_0xa15880[_0x6ecf('0x6e')]['name'],_0xa15880['user'][_0x6ecf('0x82')],_0x5e8fe3[_0x6ecf('0x81')]['id'],_0xa15880[_0x6ecf('0x57')]?JSON['stringify'](_0xa15880['body']):_0x6ecf('0x83'));return respondWithRpcPromise(_0x6ecf('0x8d'),'rejectMessage',_0x5e8fe3);}return null;})[_0x6ecf('0x34')](function(_0x32e6df){if(_0x32e6df){_0x32e6df[_0x6ecf('0x27')][_0x6ecf('0x8e')]=util[_0x6ecf('0x77')](_0x6ecf('0x86'),_0xa15880['user'][_0x6ecf('0x38')]);_0x32e6df['message']['channel']=_0x5e8fe3['channel'];_0x32e6df[_0x6ecf('0x27')][_0x6ecf('0x88')]=_0x6ecf('0x8a');respondWithRpcPromise(_0x6ecf('0x89'),_0x6ecf('0x89'),{'event':_0x6ecf('0x8f'),'message':_0x32e6df[_0x6ecf('0x27')]},client9002);return _0x5e8fe3;}return null;})[_0x6ecf('0x34')](respondWithResult(_0x32ccd7,null))[_0x6ecf('0x29')](handleError(_0x32ccd7,null));};exports[_0x6ecf('0x90')]=function(_0x4b4ee5,_0x5c42fb){var _0x1a02dc=moment()[_0x6ecf('0x91')]()['toString']();var _0x5f04ff=path['join'](config[_0x6ecf('0x92')],_0x6ecf('0x93'),_0x6ecf('0x94'),'tmp');var _0x4a15af=path[_0x6ecf('0x71')](config['root'],'server',_0x6ecf('0x94'),'attachments');var _0x179682=util['format'](_0x6ecf('0x95'),_0x1a02dc);return db[_0x6ecf('0x50')][_0x6ecf('0x56')]({'where':{'id':_0x4b4ee5[_0x6ecf('0x53')]['id']},'attributes':['id',_0x6ecf('0x57'),'from','to','cc',_0x6ecf('0x96'),'subject',_0x6ecf('0x97')],'include':_0x4b4ee5[_0x6ecf('0x40')][_0x6ecf('0x70')]?[{'model':db[_0x6ecf('0x98')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x5c42fb,null))[_0x6ecf('0x34')](function(_0x165695){if(_0x165695){var _0x4e7b6f=_0x165695;var _0x3e0847={'from':_0x4e7b6f[_0x6ecf('0x99')],'to':_0x4e7b6f['to'],'subject':_0x4e7b6f[_0x6ecf('0x9a')],'html':_0x4e7b6f[_0x6ecf('0x57')],'headers':{'Date':moment(_0x4e7b6f['createdAt'])[_0x6ecf('0x77')](_0x6ecf('0x9b'))},'attachments':[]};if(_0x165695['cc']){_0x3e0847[_0x6ecf('0x9c')]['Cc']=_0x165695['cc'];}if(_0x165695['bcc']){_0x3e0847['headers'][_0x6ecf('0x9d')]=_0x165695['bcc'];}return new BPromise(function(_0x4516a6,_0x335d21){if(_0x165695[_0x6ecf('0x9e')]){for(var _0x161b5c=0x0;_0x161b5c<_0x165695[_0x6ecf('0x9e')][_0x6ecf('0x46')];_0x161b5c++){var _0x1daa4b=_0x165695[_0x6ecf('0x9e')][_0x161b5c];var _0x3127d3=path[_0x6ecf('0x71')](_0x4a15af,_0x1daa4b[_0x6ecf('0x72')]);if(fs[_0x6ecf('0x9f')](_0x3127d3)){_0x3e0847['attachments'][_0x6ecf('0xa0')]({'name':_0x1daa4b[_0x6ecf('0x38')],'contentType':_0x1daa4b[_0x6ecf('0x3d')],'data':fs[_0x6ecf('0xa1')](_0x3127d3)});}}}emlformat[_0x6ecf('0xa2')](_0x3e0847,function(_0xc9926a,_0x36e789){if(_0xc9926a)return _0x335d21(_0xc9926a);fs[_0x6ecf('0xa3')](path[_0x6ecf('0x71')](_0x5f04ff,_0x179682),_0x36e789);return _0x4516a6(_0x36e789);});});}})['then'](function(_0x160673){if(_0x160673){return _0x5c42fb[_0x6ecf('0x90')](path['join'](_0x5f04ff,_0x179682),_0x179682,function(_0x4bb078){if(_0x4bb078){console[_0x6ecf('0xa4')]('err',_0x4bb078);}else{fs[_0x6ecf('0xa5')](path[_0x6ecf('0x71')](_0x5f04ff,_0x179682));}});}})[_0x6ecf('0x29')](handleError(_0x5c42fb,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index a953170..ec23a96 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 _0x35eb=['hook','exports','events','../../mysqldb','MailMessage','update','remove','emit','hasOwnProperty'];(function(_0x538c70,_0x35531f){var _0x42ae01=function(_0x5c7368){while(--_0x5c7368){_0x538c70['push'](_0x538c70['shift']());}};_0x42ae01(++_0x35531f);}(_0x35eb,0x65));var _0xb35e=function(_0x1d128e,_0x2c87de){_0x1d128e=_0x1d128e-0x0;var _0x3d5236=_0x35eb[_0x1d128e];return _0x3d5236;};'use strict';var EventEmitter=require(_0xb35e('0x0'));var MailMessage=require(_0xb35e('0x1'))['db'][_0xb35e('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb35e('0x3'),'afterDestroy':_0xb35e('0x4')};function emitEvent(_0x53c122){return function(_0xc6990f,_0x276a84,_0x565a9a){MailMessageEvents[_0xb35e('0x5')](_0x53c122+':'+_0xc6990f['id'],_0xc6990f);MailMessageEvents['emit'](_0x53c122,_0xc6990f);_0x565a9a(null);};}for(var e in events){if(events[_0xb35e('0x6')](e)){var event=events[e];MailMessage[_0xb35e('0x7')](e,emitEvent(event));}}module[_0xb35e('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x888e=['remove','emit','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update'];(function(_0x56d04c,_0x3762c4){var _0x278a10=function(_0x420def){while(--_0x420def){_0x56d04c['push'](_0x56d04c['shift']());}};_0x278a10(++_0x3762c4);}(_0x888e,0x78));var _0xe888=function(_0x353257,_0x47e90f){_0x353257=_0x353257-0x0;var _0x148189=_0x888e[_0x353257];return _0x148189;};'use strict';var EventEmitter=require(_0xe888('0x0'));var MailMessage=require(_0xe888('0x1'))['db'][_0xe888('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe888('0x3')](0x0);var events={'afterCreate':_0xe888('0x4'),'afterUpdate':_0xe888('0x5'),'afterDestroy':_0xe888('0x6')};function emitEvent(_0x3c92e7){return function(_0xb2a234,_0x559106,_0x416b19){MailMessageEvents[_0xe888('0x7')](_0x3c92e7+':'+_0xb2a234['id'],_0xb2a234);MailMessageEvents[_0xe888('0x7')](_0x3c92e7,_0xb2a234);_0x416b19(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xe888('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 573a30d..d473fad 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 _0xe1e4=['path','../../config/environment','./mailMessage.attributes','exports','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4fc6ab,_0x42c7da){var _0x94a979=function(_0x2a0ec0){while(--_0x2a0ec0){_0x4fc6ab['push'](_0x4fc6ab['shift']());}};_0x94a979(++_0x42c7da);}(_0xe1e4,0x1ac));var _0x4e1e=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xe1e4[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x4e1e('0x0'));var util=require('util');var logger=require(_0x4e1e('0x1'))(_0x4e1e('0x2'));var moment=require(_0x4e1e('0x3'));var BPromise=require(_0x4e1e('0x4'));var rp=require(_0x4e1e('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x4e1e('0x6'));var rimraf=require('rimraf');var config=require(_0x4e1e('0x7'));var attributes=require(_0x4e1e('0x8'));module[_0x4e1e('0x9')]=function(_0x1b168e,_0x228cea){return _0x1b168e['define']('MailMessage',attributes,{'tableName':_0x4e1e('0xa'),'paranoid':![],'indexes':[{'name':_0x4e1e('0xb'),'fields':[_0x4e1e('0xb')]},{'name':_0x4e1e('0xc'),'fields':[_0x4e1e('0xd'),_0x4e1e('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4619e3,_0x218faf,_0x1b8ad8){if(_0x4619e3[_0x4e1e('0xf')]){_0x4619e3['plainBody']=htmlToText['fromString'](_0x4619e3['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1b8ad8(null,_0x218faf);},'afterCreate':function(_0x4889e1,_0xc9fd44,_0x5521bc){var _0x156aa9=_0x1b168e[_0x4e1e('0x10')];var _0x3ede85=_0x4889e1[_0x4e1e('0x11')]({'plain':!![]});if(_0x3ede85[_0x4e1e('0x12')][_0x4e1e('0x13')]()==='in'||_0x3ede85[_0x4e1e('0x12')]['toLowerCase']()===_0x4e1e('0x14')&&!_0x3ede85[_0x4e1e('0x15')]&&!_[_0x4e1e('0x16')](_0x3ede85[_0x4e1e('0x17')])){_0x156aa9[_0x4e1e('0x18')]['findOne']({'where':{'id':_0x3ede85[_0x4e1e('0x19')]}})[_0x4e1e('0x1a')](function(_0x2de414){if(_0x2de414){_0x2de414[_0x4e1e('0x1b')]({'lastMsgAt':_0x3ede85['createdAt'],'lastMsgDirection':_0x3ede85[_0x4e1e('0x12')]['toLowerCase'](),'lastMsgBody':_0x3ede85['body']});}})[_0x4e1e('0x1c')](function(_0x17b151){console['error'](_0x17b151);});}_0x5521bc();}},'charset':_0x4e1e('0x1d'),'collate':_0x4e1e('0x1e')});}; \ No newline at end of file +var _0x2ff2=['direction','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','toLowerCase','catch','utf8mb4','util','api','moment','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get'];(function(_0x1d1b8e,_0x55f7e9){var _0x31d9e7=function(_0x25af80){while(--_0x25af80){_0x1d1b8e['push'](_0x1d1b8e['shift']());}};_0x31d9e7(++_0x55f7e9);}(_0x2ff2,0xeb));var _0x22ff=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0x2ff2[_0x20d54d];return _0x516e8b;};'use strict';var _=require('lodash');var util=require(_0x22ff('0x0'));var logger=require('../../config/logger')(_0x22ff('0x1'));var moment=require(_0x22ff('0x2'));var BPromise=require(_0x22ff('0x3'));var rp=require(_0x22ff('0x4'));var htmlToText=require(_0x22ff('0x5'));var fs=require('fs');var path=require(_0x22ff('0x6'));var rimraf=require('rimraf');var config=require(_0x22ff('0x7'));var attributes=require(_0x22ff('0x8'));module[_0x22ff('0x9')]=function(_0x2b6b51,_0x23bb33){return _0x2b6b51['define'](_0x22ff('0xa'),attributes,{'tableName':_0x22ff('0xb'),'paranoid':![],'indexes':[{'name':_0x22ff('0xc'),'fields':['messageId']},{'name':_0x22ff('0xd'),'fields':[_0x22ff('0xe'),_0x22ff('0xf')],'type':_0x22ff('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4f7e2e,_0x3ac5aa,_0x2f1e6c){if(_0x4f7e2e[_0x22ff('0x11')]){_0x4f7e2e[_0x22ff('0xe')]=htmlToText[_0x22ff('0x12')](_0x4f7e2e[_0x22ff('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2f1e6c(null,_0x3ac5aa);},'afterCreate':function(_0x5c8d82,_0x352eee,_0xa40961){var _0x4fe8da=_0x2b6b51[_0x22ff('0x13')];var _0x11d27d=_0x5c8d82[_0x22ff('0x14')]({'plain':!![]});if(_0x11d27d[_0x22ff('0x15')]['toLowerCase']()==='in'||_0x11d27d['direction']['toLowerCase']()==='out'&&!_0x11d27d['secret']&&!_[_0x22ff('0x16')](_0x11d27d['UserId'])){_0x4fe8da[_0x22ff('0x17')][_0x22ff('0x18')]({'where':{'id':_0x11d27d[_0x22ff('0x19')]}})[_0x22ff('0x1a')](function(_0x40c832){if(_0x40c832){_0x40c832[_0x22ff('0x1b')]({'lastMsgAt':_0x11d27d[_0x22ff('0x1c')],'lastMsgDirection':_0x11d27d[_0x22ff('0x15')][_0x22ff('0x1d')](),'lastMsgBody':_0x11d27d[_0x22ff('0x11')]});}})[_0x22ff('0x1e')](function(_0x2ea778){console['error'](_0x2ea778);});}_0xa40961();}},'charset':_0x22ff('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index c006ebd..72791ad 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 _0xe4c7=['client','http','localhost','socket.io-emitter','redis','./mailMessage.socket','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5bd1bc,_0x4ec775){var _0x3854cf=function(_0x17e1bb){while(--_0x17e1bb){_0x5bd1bc['push'](_0x5bd1bc['shift']());}};_0x3854cf(++_0x4ec775);}(_0xe4c7,0x1d2));var _0x7e4c=function(_0x10a0ab,_0x37b227){_0x10a0ab=_0x10a0ab-0x0;var _0x35f4c3=_0xe4c7[_0x10a0ab];return _0x35f4c3;};'use strict';var _=require(_0x7e4c('0x0'));var util=require(_0x7e4c('0x1'));var moment=require(_0x7e4c('0x2'));var BPromise=require(_0x7e4c('0x3'));var rs=require(_0x7e4c('0x4'));var fs=require('fs');var Redis=require(_0x7e4c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e4c('0x6'));var logger=require(_0x7e4c('0x7'))(_0x7e4c('0x8'));var config=require('../../config/environment');var jayson=require(_0x7e4c('0x9'));var client=jayson[_0x7e4c('0xa')][_0x7e4c('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x7e4c('0xc'),'port':0x18eb});var socket=require(_0x7e4c('0xd'))(new Redis(config[_0x7e4c('0xe')]));require(_0x7e4c('0xf'))['register'](socket);function respondWithRpcPromise(_0x402cd9,_0x4418be,_0x43827f){return new BPromise(function(_0x5c2f4b,_0x2a73cc){return client[_0x7e4c('0x10')](_0x402cd9,_0x43827f)[_0x7e4c('0x11')](function(_0x1b5cc3){logger[_0x7e4c('0x12')]('MailMessage,\x20%s,\x20%s',_0x4418be,_0x7e4c('0x13'));logger[_0x7e4c('0x14')](_0x7e4c('0x15'),_0x4418be,_0x7e4c('0x13'),JSON[_0x7e4c('0x16')](_0x1b5cc3));if(_0x1b5cc3[_0x7e4c('0x17')]){if(_0x1b5cc3['error'][_0x7e4c('0x18')]===0x1f4){logger['error'](_0x7e4c('0x19'),_0x4418be,_0x1b5cc3[_0x7e4c('0x17')][_0x7e4c('0x1a')]);return _0x2a73cc(_0x1b5cc3[_0x7e4c('0x17')][_0x7e4c('0x1a')]);}logger[_0x7e4c('0x17')](_0x7e4c('0x19'),_0x4418be,_0x1b5cc3[_0x7e4c('0x17')][_0x7e4c('0x1a')]);return _0x5c2f4b(_0x1b5cc3[_0x7e4c('0x17')]['message']);}else{logger[_0x7e4c('0x12')](_0x7e4c('0x19'),_0x4418be,_0x7e4c('0x13'));_0x5c2f4b(_0x1b5cc3[_0x7e4c('0x1b')][_0x7e4c('0x1a')]);}})['catch'](function(_0x28cd52){logger[_0x7e4c('0x17')](_0x7e4c('0x19'),_0x4418be,_0x28cd52);_0x2a73cc(_0x28cd52);});});}exports[_0x7e4c('0x1c')]=function(_0x4c599c){var _0x352eb5=this;return new Promise(function(_0x44ac17,_0x217221){return db[_0x7e4c('0x1d')][_0x7e4c('0x1e')](_0x4c599c[_0x7e4c('0x1f')],{'raw':_0x4c599c[_0x7e4c('0x20')]?_0x4c599c[_0x7e4c('0x20')][_0x7e4c('0x21')]===undefined?!![]:![]:!![]})[_0x7e4c('0x11')](function(_0x2662e0){logger[_0x7e4c('0x12')](_0x7e4c('0x1c'),_0x4c599c);logger['debug'](_0x7e4c('0x1c'),_0x4c599c,JSON[_0x7e4c('0x16')](_0x2662e0));_0x44ac17(_0x2662e0);})['catch'](function(_0x35d7e2){logger[_0x7e4c('0x17')](_0x7e4c('0x1c'),_0x35d7e2[_0x7e4c('0x1a')],_0x4c599c);_0x217221(_0x352eb5[_0x7e4c('0x17')](0x1f4,_0x35d7e2['message']));});});}; \ No newline at end of file +var _0xf531=['request\x20sent','debug','stringify','error','code','message','info','result','catch','create','body','options','CreateMailMessage','lodash','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register','then','MailMessage,\x20%s,\x20%s'];(function(_0x1b67af,_0x37676e){var _0x19b1e5=function(_0x13edd7){while(--_0x13edd7){_0x1b67af['push'](_0x1b67af['shift']());}};_0x19b1e5(++_0x37676e);}(_0xf531,0x7d));var _0x1f53=function(_0x383cad,_0x133407){_0x383cad=_0x383cad-0x0;var _0x1e8934=_0xf531[_0x383cad];return _0x1e8934;};'use strict';var _=require(_0x1f53('0x0'));var util=require('util');var moment=require(_0x1f53('0x1'));var BPromise=require(_0x1f53('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1f53('0x3'))(_0x1f53('0x4'));var config=require(_0x1f53('0x5'));var jayson=require(_0x1f53('0x6'));var client=jayson[_0x1f53('0x7')]['http']({'port':0x232a});config[_0x1f53('0x8')]=_[_0x1f53('0x9')](config[_0x1f53('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f53('0xa'))(new Redis(config['redis']));require(_0x1f53('0xb'))[_0x1f53('0xc')](socket);function respondWithRpcPromise(_0x349d90,_0x15b6a9,_0x5202e2){return new BPromise(function(_0x84258f,_0x4a9683){return client['request'](_0x349d90,_0x5202e2)[_0x1f53('0xd')](function(_0x753663){logger['info'](_0x1f53('0xe'),_0x15b6a9,_0x1f53('0xf'));logger[_0x1f53('0x10')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x15b6a9,'request\x20sent',JSON[_0x1f53('0x11')](_0x753663));if(_0x753663[_0x1f53('0x12')]){if(_0x753663[_0x1f53('0x12')][_0x1f53('0x13')]===0x1f4){logger[_0x1f53('0x12')](_0x1f53('0xe'),_0x15b6a9,_0x753663[_0x1f53('0x12')]['message']);return _0x4a9683(_0x753663[_0x1f53('0x12')][_0x1f53('0x14')]);}logger[_0x1f53('0x12')](_0x1f53('0xe'),_0x15b6a9,_0x753663[_0x1f53('0x12')][_0x1f53('0x14')]);return _0x84258f(_0x753663['error'][_0x1f53('0x14')]);}else{logger[_0x1f53('0x15')](_0x1f53('0xe'),_0x15b6a9,_0x1f53('0xf'));_0x84258f(_0x753663[_0x1f53('0x16')]['message']);}})[_0x1f53('0x17')](function(_0x1bea4a){logger[_0x1f53('0x12')](_0x1f53('0xe'),_0x15b6a9,_0x1bea4a);_0x4a9683(_0x1bea4a);});});}exports['CreateMailMessage']=function(_0x2e4b22){var _0x3d32c3=this;return new Promise(function(_0x4325c9,_0x12cfdf){return db['MailMessage'][_0x1f53('0x18')](_0x2e4b22[_0x1f53('0x19')],{'raw':_0x2e4b22[_0x1f53('0x1a')]?_0x2e4b22[_0x1f53('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4e1bb9){logger[_0x1f53('0x15')]('CreateMailMessage',_0x2e4b22);logger['debug'](_0x1f53('0x1b'),_0x2e4b22,JSON['stringify'](_0x4e1bb9));_0x4325c9(_0x4e1bb9);})[_0x1f53('0x17')](function(_0x7b529){logger[_0x1f53('0x12')]('CreateMailMessage',_0x7b529[_0x1f53('0x14')],_0x2e4b22);_0x12cfdf(_0x3d32c3['error'](0x1f4,_0x7b529[_0x1f53('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 765cea0..aba80ce 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 _0x4499=['mailMessage:','remove','update','emit','removeListener','length'];(function(_0x42c084,_0x3ac7cb){var _0x42fade=function(_0x14fe8f){while(--_0x14fe8f){_0x42c084['push'](_0x42c084['shift']());}};_0x42fade(++_0x3ac7cb);}(_0x4499,0x145));var _0x9449=function(_0x1d2a11,_0x44e346){_0x1d2a11=_0x1d2a11-0x0;var _0xc2dee0=_0x4499[_0x1d2a11];return _0xc2dee0;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x9449('0x0'),_0x9449('0x1')];function createListener(_0x36fd84,_0x352727){return function(_0x34e96e){_0x352727[_0x9449('0x2')](_0x36fd84,_0x34e96e);};}function removeListener(_0x599ac1,_0x465521){return function(){MailMessageEvents[_0x9449('0x3')](_0x599ac1,_0x465521);};}exports['register']=function(_0x4c5927){for(var _0xaecc82=0x0,_0x297234=events[_0x9449('0x4')];_0xaecc82<_0x297234;_0xaecc82++){var _0xdfcacc=events[_0xaecc82];var _0x2bf44b=createListener(_0x9449('0x5')+_0xdfcacc,_0x4c5927);MailMessageEvents['on'](_0xdfcacc,_0x2bf44b);}}; \ No newline at end of file +var _0x5537=['./mailMessage.events','save','remove','emit','register','length','mailMessage:'];(function(_0x277958,_0x4479a5){var _0x2a48a4=function(_0x161505){while(--_0x161505){_0x277958['push'](_0x277958['shift']());}};_0x2a48a4(++_0x4479a5);}(_0x5537,0xb6));var _0x7553=function(_0x4125b0,_0x5ed052){_0x4125b0=_0x4125b0-0x0;var _0x2df421=_0x5537[_0x4125b0];return _0x2df421;};'use strict';var MailMessageEvents=require(_0x7553('0x0'));var events=[_0x7553('0x1'),_0x7553('0x2'),'update'];function createListener(_0x39e20a,_0xea940){return function(_0x208bd5){_0xea940[_0x7553('0x3')](_0x39e20a,_0x208bd5);};}function removeListener(_0x3cec56,_0x490985){return function(){MailMessageEvents['removeListener'](_0x3cec56,_0x490985);};}exports[_0x7553('0x4')]=function(_0x2933c9){for(var _0x324fb7=0x0,_0x11d3ee=events[_0x7553('0x5')];_0x324fb7<_0x11d3ee;_0x324fb7++){var _0x3f75f9=events[_0x324fb7];var _0x16a390=createListener(_0x7553('0x6')+_0x3f75f9,_0x2933c9);MailMessageEvents['on'](_0x3f75f9,_0x16a390);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d4de291..4e6e25b 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 _0x993c=['getAgents','post','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./mailQueue.controller','get','index','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x31e2b1,_0x3e6a08){var _0x10c4fc=function(_0x4c73bc){while(--_0x4c73bc){_0x31e2b1['push'](_0x31e2b1['shift']());}};_0x10c4fc(++_0x3e6a08);}(_0x993c,0x9c));var _0xc993=function(_0x583f59,_0x3ac3ec){_0x583f59=_0x583f59-0x0;var _0x1898c9=_0x993c[_0x583f59];return _0x1898c9;};'use strict';var multer=require(_0xc993('0x0'));var util=require(_0xc993('0x1'));var path=require(_0xc993('0x2'));var timeout=require(_0xc993('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc993('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc993('0x5'));var config=require('../../config/environment');var controller=require(_0xc993('0x6'));router[_0xc993('0x7')]('/',auth['isAuthenticated'](),controller[_0xc993('0x8')]);router[_0xc993('0x7')]('/describe',auth[_0xc993('0x9')](),controller[_0xc993('0xa')]);router[_0xc993('0x7')](_0xc993('0xb'),auth[_0xc993('0x9')](),controller[_0xc993('0xc')]);router[_0xc993('0x7')](_0xc993('0xd'),auth[_0xc993('0x9')](),controller[_0xc993('0xe')]);router[_0xc993('0x7')](_0xc993('0xf'),auth[_0xc993('0x9')](),controller[_0xc993('0x10')]);router[_0xc993('0x7')](_0xc993('0x11'),auth[_0xc993('0x9')](),controller[_0xc993('0x12')]);router[_0xc993('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc993('0x13')](_0xc993('0xf'),auth[_0xc993('0x9')](),controller[_0xc993('0x14')]);router[_0xc993('0x13')](_0xc993('0x11'),auth['isAuthenticated'](),controller[_0xc993('0x15')]);router[_0xc993('0x16')](_0xc993('0xb'),auth[_0xc993('0x9')](),controller[_0xc993('0x17')]);router['delete'](_0xc993('0xb'),auth[_0xc993('0x9')](),controller[_0xc993('0x18')]);router[_0xc993('0x19')](_0xc993('0xf'),auth['isAuthenticated'](),controller[_0xc993('0x1a')]);router[_0xc993('0x19')](_0xc993('0x11'),auth[_0xc993('0x9')](),controller[_0xc993('0x1b')]);module[_0xc993('0x1c')]=router; \ No newline at end of file +var _0x3f0e=['addTeams','/:id/users','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','index','get','/describe','/:id','show','/:id/members','isAuthenticated','getTeams','getAgents','post','create','/:id/teams'];(function(_0x43749d,_0xcb66d3){var _0x34ad57=function(_0x450bd7){while(--_0x450bd7){_0x43749d['push'](_0x43749d['shift']());}};_0x34ad57(++_0xcb66d3);}(_0x3f0e,0x164));var _0xe3f0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3f0e[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xe3f0('0x0'));var util=require(_0xe3f0('0x1'));var path=require(_0xe3f0('0x2'));var timeout=require(_0xe3f0('0x3'));var express=require(_0xe3f0('0x4'));var router=express[_0xe3f0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe3f0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe3f0('0x7'));var controller=require(_0xe3f0('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xe3f0('0x9')]);router[_0xe3f0('0xa')](_0xe3f0('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xe3f0('0xc'),auth['isAuthenticated'](),controller[_0xe3f0('0xd')]);router[_0xe3f0('0xa')](_0xe3f0('0xe'),auth[_0xe3f0('0xf')](),controller['getMembers']);router[_0xe3f0('0xa')]('/:id/teams',auth[_0xe3f0('0xf')](),controller[_0xe3f0('0x10')]);router[_0xe3f0('0xa')]('/:id/users',auth[_0xe3f0('0xf')](),controller[_0xe3f0('0x11')]);router[_0xe3f0('0x12')]('/',auth[_0xe3f0('0xf')](),controller[_0xe3f0('0x13')]);router[_0xe3f0('0x12')](_0xe3f0('0x14'),auth[_0xe3f0('0xf')](),controller[_0xe3f0('0x15')]);router[_0xe3f0('0x12')](_0xe3f0('0x16'),auth[_0xe3f0('0xf')](),controller['addAgents']);router[_0xe3f0('0x17')](_0xe3f0('0xc'),auth[_0xe3f0('0xf')](),controller[_0xe3f0('0x18')]);router[_0xe3f0('0x19')]('/:id',auth[_0xe3f0('0xf')](),controller[_0xe3f0('0x1a')]);router[_0xe3f0('0x19')](_0xe3f0('0x14'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xe3f0('0x19')](_0xe3f0('0x16'),auth[_0xe3f0('0xf')](),controller[_0xe3f0('0x1b')]);module[_0xe3f0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 6f69684..da0ad72 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 _0x1c45=['STRING','name','INTEGER','ENUM','rrmemory','sequelize','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1c45,0x1b0));var _0x51c4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1c45[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x51c4('0x0'));module[_0x51c4('0x1')]={'name':{'type':Sequelize[_0x51c4('0x2')],'unique':_0x51c4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x51c4('0x2')]},'timeout':{'type':Sequelize[_0x51c4('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x51c4('0x5')](_0x51c4('0x6'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xef0a=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x3da3bc,_0x8f6b70){var _0x5001ab=function(_0x41ff56){while(--_0x41ff56){_0x3da3bc['push'](_0x3da3bc['shift']());}};_0x5001ab(++_0x8f6b70);}(_0xef0a,0xdd));var _0xaef0=function(_0x1ba60f,_0x1122e0){_0x1ba60f=_0x1ba60f-0x0;var _0x1d39cc=_0xef0a[_0x1ba60f];return _0x1d39cc;};'use strict';var Sequelize=require(_0xaef0('0x0'));module[_0xaef0('0x1')]={'name':{'type':Sequelize[_0xaef0('0x2')],'unique':_0xaef0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xaef0('0x2')]},'timeout':{'type':Sequelize[_0xaef0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaef0('0x5')](_0xaef0('0x6'),_0xaef0('0x7'),_0xaef0('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index ba42030..3782897 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 _0x66ab=['removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./mailQueue.socket','register','status','json','offset','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','index','MailQueue','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','order','MailQueueId','UserMailQueue','User','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userMailQueue:save','select','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','includes','compact','value','removeTeams'];(function(_0x573a7d,_0x7790d5){var _0x2d086a=function(_0xe08305){while(--_0xe08305){_0x573a7d['push'](_0x573a7d['shift']());}};_0x2d086a(++_0x7790d5);}(_0x66ab,0x11a));var _0xb66a=function(_0x21e31a,_0x4ccba8){_0x21e31a=_0x21e31a-0x0;var _0xec881d=_0x66ab[_0x21e31a];return _0xec881d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb66a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb66a('0x1'));var jsonpatch=require(_0xb66a('0x2'));var rp=require(_0xb66a('0x3'));var moment=require(_0xb66a('0x4'));var BPromise=require(_0xb66a('0x5'));var Mustache=require(_0xb66a('0x6'));var util=require(_0xb66a('0x7'));var path=require('path');var sox=require(_0xb66a('0x8'));var csv=require('to-csv');var ejs=require(_0xb66a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb66a('0xa'));var squel=require('squel');var crypto=require(_0xb66a('0xb'));var jsforce=require(_0xb66a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb66a('0xd'));var querystring=require(_0xb66a('0xe'));var Papa=require('papaparse');var Redis=require(_0xb66a('0xf'));var authService=require(_0xb66a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb66a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb66a('0x12'))('api');var utils=require(_0xb66a('0x13'));var config=require(_0xb66a('0x14'));var licenseUtil=require(_0xb66a('0x15'));var db=require(_0xb66a('0x16'))['db'];config['redis']=_[_0xb66a('0x17')](config[_0xb66a('0x18')],{'host':_0xb66a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb66a('0x18')]));require(_0xb66a('0x1a'))[_0xb66a('0x1b')](socket);function respondWithStatusCode(_0x4bc508,_0x2803ea){_0x2803ea=_0x2803ea||0xcc;return function(_0x53aaf9){if(_0x53aaf9){return _0x4bc508['sendStatus'](_0x2803ea);}return _0x4bc508[_0xb66a('0x1c')](_0x2803ea)['end']();};}function respondWithResult(_0x219eed,_0x5e2101){_0x5e2101=_0x5e2101||0xc8;return function(_0x2aaac3){if(_0x2aaac3){return _0x219eed[_0xb66a('0x1c')](_0x5e2101)[_0xb66a('0x1d')](_0x2aaac3);}};}function respondWithFilteredResult(_0x65495b,_0x45d810){return function(_0x98ab6b){if(_0x98ab6b){var _0x49b2a5=_0x98ab6b['count'],_0x20c5e6=_0x45d810[_0xb66a('0x1e')],_0x14387b=_0x45d810[_0xb66a('0x1e')]+_0x45d810['limit'],_0x5c4666;if(_0x14387b>=_0x49b2a5){_0x14387b=_0x49b2a5;_0x5c4666=0xc8;}else{_0x5c4666=0xce;}_0x65495b[_0xb66a('0x1c')](_0x5c4666);return _0x65495b[_0xb66a('0x1f')](_0xb66a('0x20'),_0x20c5e6+'-'+_0x14387b+'/'+_0x49b2a5)[_0xb66a('0x1d')](_0x98ab6b);}return null;};}function patchUpdates(_0x202ee9){return function(_0x213e46){try{jsonpatch[_0xb66a('0x21')](_0x213e46,_0x202ee9,!![]);}catch(_0x394cea){return BPromise['reject'](_0x394cea);}return _0x213e46[_0xb66a('0x22')]();};}function saveUpdates(_0xf36cd6,_0x583a6e){return function(_0x9f53b0){if(_0x9f53b0){return _0x9f53b0['update'](_0xf36cd6)[_0xb66a('0x23')](function(_0x482703){return _0x482703;});}return null;};}function removeEntity(_0x701375,_0x3f1205){return function(_0x46e875){if(_0x46e875){return _0x46e875[_0xb66a('0x24')]()['then'](function(){var _0x272649=_0x46e875[_0xb66a('0x25')]({'plain':!![]});var _0x6304='MailQueues';return db[_0xb66a('0x26')][_0xb66a('0x24')]({'where':{'type':_0x6304,'resourceId':_0x272649['id']}})['then'](function(){return _0x46e875;});})[_0xb66a('0x23')](function(){_0x701375['status'](0xcc)[_0xb66a('0x27')]();});}};}function handleEntityNotFound(_0x19cbcc,_0x1a215b){return function(_0x1c0cdc){if(!_0x1c0cdc){_0x19cbcc[_0xb66a('0x28')](0x194);}return _0x1c0cdc;};}function handleError(_0x51f9d1,_0x3babc4){_0x3babc4=_0x3babc4||0x1f4;return function(_0x14fc0a){logger[_0xb66a('0x29')](_0x14fc0a[_0xb66a('0x2a')]);if(_0x14fc0a['name']){delete _0x14fc0a[_0xb66a('0x2b')];}_0x51f9d1['status'](_0x3babc4)['send'](_0x14fc0a);};}exports[_0xb66a('0x2c')]=function(_0x5815a8,_0x5e7a76){var _0x23ee16={},_0x27c382={},_0x577979={'count':0x0,'rows':[]};var _0x5d8b9c=_['map'](db[_0xb66a('0x2d')][_0xb66a('0x2e')],function(_0x492d08){return{'name':_0x492d08[_0xb66a('0x2f')],'type':_0x492d08[_0xb66a('0x30')][_0xb66a('0x31')]};});_0x27c382['model']=_[_0xb66a('0x32')](_0x5d8b9c,_0xb66a('0x2b'));_0x27c382[_0xb66a('0x33')]=_[_0xb66a('0x34')](_0x5815a8[_0xb66a('0x33')]);_0x27c382[_0xb66a('0x35')]=_[_0xb66a('0x36')](_0x27c382[_0xb66a('0x37')],_0x27c382[_0xb66a('0x33')]);_0x23ee16[_0xb66a('0x38')]=_[_0xb66a('0x36')](_0x27c382[_0xb66a('0x37')],qs[_0xb66a('0x39')](_0x5815a8[_0xb66a('0x33')]['fields']));_0x23ee16[_0xb66a('0x38')]=_0x23ee16[_0xb66a('0x38')]['length']?_0x23ee16[_0xb66a('0x38')]:_0x27c382[_0xb66a('0x37')];if(!_0x5815a8[_0xb66a('0x33')][_0xb66a('0x3a')](_0xb66a('0x3b'))){_0x23ee16[_0xb66a('0x3c')]=qs[_0xb66a('0x3c')](_0x5815a8[_0xb66a('0x33')]['limit']);_0x23ee16[_0xb66a('0x1e')]=qs['offset'](_0x5815a8['query'][_0xb66a('0x1e')]);}_0x23ee16['order']=qs[_0xb66a('0x3d')](_0x5815a8['query'][_0xb66a('0x3d')]);_0x23ee16[_0xb66a('0x3e')]=qs[_0xb66a('0x35')](_[_0xb66a('0x3f')](_0x5815a8[_0xb66a('0x33')],_0x27c382[_0xb66a('0x35')]),_0x5d8b9c);if(_0x5815a8[_0xb66a('0x33')][_0xb66a('0x40')]){_0x23ee16[_0xb66a('0x3e')]=_[_0xb66a('0x41')](_0x23ee16[_0xb66a('0x3e')],{'$or':_[_0xb66a('0x32')](_0x5d8b9c,function(_0x11a03f){if(_0x11a03f[_0xb66a('0x30')]!==_0xb66a('0x42')){var _0x18cf33={};_0x18cf33[_0x11a03f['name']]={'$like':'%'+_0x5815a8[_0xb66a('0x33')][_0xb66a('0x40')]+'%'};return _0x18cf33;}})});}_0x23ee16=_['merge']({},_0x23ee16,_0x5815a8[_0xb66a('0x43')]);var _0x4b18c8={'where':_0x23ee16['where']};return db[_0xb66a('0x2d')][_0xb66a('0x44')](_0x4b18c8)[_0xb66a('0x23')](function(_0x1a3abb){_0x577979['count']=_0x1a3abb;if(_0x5815a8[_0xb66a('0x33')][_0xb66a('0x45')]){_0x23ee16[_0xb66a('0x46')]=[{'all':!![]}];}return db[_0xb66a('0x2d')][_0xb66a('0x47')](_0x23ee16);})[_0xb66a('0x23')](function(_0x4a318c){_0x577979[_0xb66a('0x48')]=_0x4a318c;return _0x577979;})[_0xb66a('0x23')](respondWithFilteredResult(_0x5e7a76,_0x23ee16))[_0xb66a('0x49')](handleError(_0x5e7a76,null));};exports[_0xb66a('0x4a')]=function(_0x18c430,_0x5e1a62){var _0x3d2d0d={'raw':!![],'where':{'id':_0x18c430[_0xb66a('0x4b')]['id']}},_0x149f8d={};_0x149f8d['model']=_[_0xb66a('0x34')](db[_0xb66a('0x2d')][_0xb66a('0x2e')]);_0x149f8d[_0xb66a('0x33')]=_[_0xb66a('0x34')](_0x18c430[_0xb66a('0x33')]);_0x149f8d[_0xb66a('0x35')]=_[_0xb66a('0x36')](_0x149f8d[_0xb66a('0x37')],_0x149f8d['query']);_0x3d2d0d[_0xb66a('0x38')]=_[_0xb66a('0x36')](_0x149f8d[_0xb66a('0x37')],qs['fields'](_0x18c430[_0xb66a('0x33')]['fields']));_0x3d2d0d['attributes']=_0x3d2d0d[_0xb66a('0x38')][_0xb66a('0x4c')]?_0x3d2d0d[_0xb66a('0x38')]:_0x149f8d[_0xb66a('0x37')];if(_0x18c430[_0xb66a('0x33')][_0xb66a('0x45')]){_0x3d2d0d[_0xb66a('0x46')]=[{'all':!![]}];}_0x3d2d0d=_[_0xb66a('0x41')]({},_0x3d2d0d,_0x18c430[_0xb66a('0x43')]);return db['MailQueue'][_0xb66a('0x4d')](_0x3d2d0d)[_0xb66a('0x23')](handleEntityNotFound(_0x5e1a62,null))['then'](respondWithResult(_0x5e1a62,null))[_0xb66a('0x49')](handleError(_0x5e1a62,null));};exports['create']=function(_0x2dfd55,_0x20a797){return db['MailQueue'][_0xb66a('0x4e')](_0x2dfd55[_0xb66a('0x4f')],{})[_0xb66a('0x23')](function(_0x2fccf0){var _0x468eb6=_0x2dfd55[_0xb66a('0x50')]['get']({'plain':!![]});if(!_0x468eb6)throw new Error(_0xb66a('0x51'));if(_0x468eb6[_0xb66a('0x52')]==='user'){var _0x20b00a=_0x2fccf0[_0xb66a('0x25')]({'plain':!![]});var _0x2cacd9=_0xb66a('0x53');return db[_0xb66a('0x54')][_0xb66a('0x4d')]({'where':{'name':_0x2cacd9,'userProfileId':_0x468eb6[_0xb66a('0x55')]},'raw':!![]})['then'](function(_0x20c987){if(_0x20c987&&_0x20c987['autoAssociation']===0x0){return db[_0xb66a('0x26')]['create']({'name':_0x20b00a[_0xb66a('0x2b')],'resourceId':_0x20b00a['id'],'type':_0x20c987[_0xb66a('0x2b')],'sectionId':_0x20c987['id']},{})['then'](function(){return _0x2fccf0;});}else{return _0x2fccf0;}})[_0xb66a('0x49')](function(_0x557183){logger[_0xb66a('0x29')](_0xb66a('0x56'),_0x557183);throw _0x557183;});}return _0x2fccf0;})[_0xb66a('0x23')](respondWithResult(_0x20a797,0xc9))['catch'](handleError(_0x20a797,null));};exports[_0xb66a('0x57')]=function(_0x559f41,_0x105e50){if(_0x559f41[_0xb66a('0x4f')]['id']){delete _0x559f41[_0xb66a('0x4f')]['id'];}return db[_0xb66a('0x2d')][_0xb66a('0x4d')]({'where':{'id':_0x559f41[_0xb66a('0x4b')]['id']}})[_0xb66a('0x23')](handleEntityNotFound(_0x105e50,null))['then'](saveUpdates(_0x559f41[_0xb66a('0x4f')],null))[_0xb66a('0x23')](respondWithResult(_0x105e50,null))[_0xb66a('0x49')](handleError(_0x105e50,null));};exports[_0xb66a('0x24')]=function(_0x4ebb80,_0x3e4371){return db[_0xb66a('0x2d')][_0xb66a('0x4d')]({'where':{'id':_0x4ebb80[_0xb66a('0x4b')]['id']}})[_0xb66a('0x23')](handleEntityNotFound(_0x3e4371,null))[_0xb66a('0x23')](removeEntity(_0x3e4371,null))['catch'](handleError(_0x3e4371,null));};exports['describe']=function(_0x4278ba,_0xc475be){return db['MailQueue']['describe']()['then'](respondWithResult(_0xc475be,null))['catch'](handleError(_0xc475be,null));};exports['getMembers']=function(_0x232992,_0x2579aa,_0x5588c9){var _0x573c63={'raw':!![],'where':{}},_0x17147d={},_0x3f6ab9;return db[_0xb66a('0x2d')][_0xb66a('0x58')]({'where':{'id':_0x232992[_0xb66a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2579aa,null))[_0xb66a('0x23')](function(_0x57e669){if(_0x57e669){_0x3f6ab9=_0x57e669[_0xb66a('0x25')]({'plain':!![]});_0x17147d[_0xb66a('0x37')]=_[_0xb66a('0x34')](db['UserMailQueue'][_0xb66a('0x2e')]);_0x17147d['query']=_['keys'](_0x232992['query']);_0x17147d[_0xb66a('0x35')]=_[_0xb66a('0x36')](_0x17147d[_0xb66a('0x37')],_0x17147d[_0xb66a('0x33')]);_0x573c63[_0xb66a('0x38')]=_[_0xb66a('0x36')](_0x17147d[_0xb66a('0x37')],qs[_0xb66a('0x39')](_0x232992[_0xb66a('0x33')][_0xb66a('0x39')]));_0x573c63[_0xb66a('0x38')]=_0x573c63[_0xb66a('0x38')][_0xb66a('0x4c')]?_0x573c63[_0xb66a('0x38')]:_0x17147d['model'];if(!_0x232992['query'][_0xb66a('0x3a')]('nolimit')){_0x573c63[_0xb66a('0x3c')]=qs[_0xb66a('0x3c')](_0x232992[_0xb66a('0x33')][_0xb66a('0x3c')]);_0x573c63[_0xb66a('0x1e')]=qs[_0xb66a('0x1e')](_0x232992[_0xb66a('0x33')][_0xb66a('0x1e')]);}_0x573c63[_0xb66a('0x59')]=qs['sort'](_0x232992[_0xb66a('0x33')][_0xb66a('0x3d')]);_0x573c63['where']=qs['filters'](_['pick'](_0x232992[_0xb66a('0x33')],_0x17147d[_0xb66a('0x35')]));_0x573c63[_0xb66a('0x3e')][_0xb66a('0x5a')]=_0x57e669['id'];if(_0x232992['query']['filter']){_0x573c63[_0xb66a('0x3e')]=_[_0xb66a('0x41')](_0x573c63[_0xb66a('0x3e')],{'$or':_[_0xb66a('0x32')](_0x573c63[_0xb66a('0x38')],function(_0x22a593){var _0x19d568={};_0x19d568[_0x22a593]={'$like':'%'+_0x232992[_0xb66a('0x33')][_0xb66a('0x40')]+'%'};return _0x19d568;})});}_0x573c63=_[_0xb66a('0x41')]({},_0x573c63,_0x232992['options']);return db[_0xb66a('0x5b')][_0xb66a('0x47')](_0x573c63);}})['then'](function(_0x5888a5){if(_0x5888a5){return db[_0xb66a('0x5c')]['findAndCountAll']({'where':{'id':_[_0xb66a('0x32')](_0x5888a5,_0xb66a('0x5d')),'role':_0xb66a('0x5e')},'attributes':['id','name',_0xb66a('0x5f'),_0xb66a('0x60'),_0xb66a('0x61')]});}})['then'](function(_0xc2c5e4){if(_0xc2c5e4){return{'count':_0xc2c5e4['count'],'rows':_['map'](_0xc2c5e4[_0xb66a('0x48')],function(_0x3f5fd8){return{'membername':_0x3f5fd8[_0xb66a('0x2b')],'UserId':_0x3f5fd8['id'],'queue_name':_0x3f6ab9[_0xb66a('0x2b')],'MailQueueId':_0x3f6ab9['id'],'interface':util[_0xb66a('0x62')](_0xb66a('0x63'),_0xb66a('0x64'),_0x3f5fd8[_0xb66a('0x2b')]),'penalty':0x0,'paused':_0x3f5fd8[_0xb66a('0x5f')],'createdAt':_0x3f5fd8[_0xb66a('0x61')],'updatedAt':_0x3f5fd8[_0xb66a('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2579aa,_0x573c63))['catch'](handleError(_0x2579aa,null));};exports['getTeams']=function(_0x2eba56,_0x465484,_0x2b344f){var _0x20c0dc={};var _0x4bdbde={};var _0x2f4404;var _0x48e974;return db[_0xb66a('0x2d')]['findOne']({'where':{'id':_0x2eba56['params']['id']}})[_0xb66a('0x23')](handleEntityNotFound(_0x465484,null))[_0xb66a('0x23')](function(_0xd598cc){if(_0xd598cc){_0x2f4404=_0xd598cc;_0x4bdbde[_0xb66a('0x37')]=_[_0xb66a('0x34')](db[_0xb66a('0x65')][_0xb66a('0x2e')]);_0x4bdbde['query']=_[_0xb66a('0x34')](_0x2eba56[_0xb66a('0x33')]);_0x4bdbde[_0xb66a('0x35')]=_[_0xb66a('0x36')](_0x4bdbde['model'],_0x4bdbde[_0xb66a('0x33')]);_0x20c0dc[_0xb66a('0x38')]=_[_0xb66a('0x36')](_0x4bdbde[_0xb66a('0x37')],qs[_0xb66a('0x39')](_0x2eba56[_0xb66a('0x33')][_0xb66a('0x39')]));_0x20c0dc[_0xb66a('0x38')]=_0x20c0dc['attributes']['length']?_0x20c0dc[_0xb66a('0x38')]:_0x4bdbde[_0xb66a('0x37')];_0x20c0dc[_0xb66a('0x59')]=qs[_0xb66a('0x3d')](_0x2eba56[_0xb66a('0x33')][_0xb66a('0x3d')]);_0x20c0dc['where']=qs[_0xb66a('0x35')](_['pick'](_0x2eba56['query'],_0x4bdbde[_0xb66a('0x35')]));if(_0x2eba56[_0xb66a('0x33')][_0xb66a('0x40')]){_0x20c0dc[_0xb66a('0x3e')]=_[_0xb66a('0x41')](_0x20c0dc[_0xb66a('0x3e')],{'$or':_['map'](_0x20c0dc[_0xb66a('0x38')],function(_0xf31dbd){var _0x1fd2bf={};_0x1fd2bf[_0xf31dbd]={'$like':'%'+_0x2eba56[_0xb66a('0x33')][_0xb66a('0x40')]+'%'};return _0x1fd2bf;})});}_0x20c0dc=_[_0xb66a('0x41')]({},_0x20c0dc,_0x2eba56[_0xb66a('0x43')]);return _0x2f4404[_0xb66a('0x66')](_0x20c0dc);}})[_0xb66a('0x23')](function(_0x2a5a5a){if(_0x2a5a5a){_0x48e974=_0x2a5a5a[_0xb66a('0x4c')];if(!_0x2eba56[_0xb66a('0x33')][_0xb66a('0x3a')]('nolimit')){_0x20c0dc['limit']=qs[_0xb66a('0x3c')](_0x2eba56[_0xb66a('0x33')]['limit']);_0x20c0dc[_0xb66a('0x1e')]=qs['offset'](_0x2eba56[_0xb66a('0x33')][_0xb66a('0x1e')]);}return _0x2f4404['getTeams'](_0x20c0dc);}})[_0xb66a('0x23')](function(_0x4e9628){if(_0x4e9628){return _0x4e9628?{'count':_0x48e974,'rows':_0x4e9628}:null;}})['then'](respondWithResult(_0x465484,null))[_0xb66a('0x49')](handleError(_0x465484,null));};exports[_0xb66a('0x67')]=function(_0x5313cf,_0x1724ff,_0x18e49d){var _0x5881f4=_0x5313cf[_0xb66a('0x4f')][_0xb66a('0x68')];return db[_0xb66a('0x65')][_0xb66a('0x47')]({'where':{'id':_0x5881f4},'attributes':['id'],'include':[{'model':db[_0xb66a('0x5c')],'as':'Agents','attributes':['id',_0xb66a('0x2b'),_0xb66a('0x69'),_0xb66a('0x6a'),_0xb66a('0x6b')],'raw':!![]}]})[_0xb66a('0x23')](function(_0x2c5a4e){if(_0x2c5a4e){var _0x2a58fb=_[_0xb66a('0x6c')](_0x2c5a4e,function(_0xc519c7){var _0x376dc2=_0xc519c7['get']({'plain':!![]});return _0x376dc2[_0xb66a('0x6d')];});return db[_0xb66a('0x2d')]['find']({'where':{'id':_0x5313cf[_0xb66a('0x4b')]['id']}})['then'](function(_0x429480){return db[_0xb66a('0x6e')][_0xb66a('0x6f')](function(_0xa99462){return _0x429480[_0xb66a('0x67')](_0x5881f4,{'transaction':_0xa99462})[_0xb66a('0x23')](function(){return BPromise[_0xb66a('0x70')](_0x2a58fb,function(_0x3062c0){return db[_0xb66a('0x5b')]['findOrCreate']({'where':{'UserId':_0x3062c0['id'],'MailQueueId':_0x5313cf[_0xb66a('0x4b')]['id']},'transaction':_0xa99462});});})[_0xb66a('0x23')](function(){_0x2a58fb[_0xb66a('0x71')](function(_0x32ce5f){socket[_0xb66a('0x72')](_0xb66a('0x73'),{'UserId':_0x32ce5f['id'],'MailQueueId':_0x429480['id']});});});});});}})[_0xb66a('0x23')](respondWithStatusCode(_0x1724ff,null))[_0xb66a('0x49')](handleError(_0x1724ff,null));};exports['removeTeams']=function(_0x4d65dc,_0x18249c,_0x52c968){return db[_0xb66a('0x65')][_0xb66a('0x47')]({'where':{'id':_0x4d65dc[_0xb66a('0x33')][_0xb66a('0x68')]},'attributes':['id'],'include':[{'model':db[_0xb66a('0x5c')],'as':_0xb66a('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xb66a('0x23')](handleEntityNotFound(_0x18249c,null))[_0xb66a('0x23')](function(_0x53db85){var _0xb77a66=_[_0xb66a('0x32')](_0x53db85,'id');var _0x439a02=[];var _0x557418=[];var _0x372cc0=squel[_0xb66a('0x74')]();_0x372cc0['field'](_0xb66a('0x75'))[_0xb66a('0x76')](_0xb66a('0x77'),'tq')[_0xb66a('0x78')](_0xb66a('0x79'),'ut',_0xb66a('0x7a'))[_0xb66a('0x3e')](_0xb66a('0x7b'),_0x4d65dc[_0xb66a('0x4b')]['id']);for(var _0x127e44=0x0;_0x127e44<_0x53db85['length'];_0x127e44+=0x1){let _0x4f6c21=_0x53db85[_0x127e44];for(var _0x432283=0x0;_0x432283<_0x4f6c21[_0xb66a('0x6d')]['length'];_0x432283+=0x1){let _0x378d2a=_0x4f6c21['Agents'][_0x432283];var _0xdcedbd=_0x372cc0[_0xb66a('0x7c')]();_0xdcedbd[_0xb66a('0x3e')]('ut.UserId\x20=\x20?',_0x378d2a['id']);_0x557418[_0xb66a('0x7d')](db['sequelize'][_0xb66a('0x33')](_0xdcedbd[_0xb66a('0x7e')](),{'type':db[_0xb66a('0x6e')][_0xb66a('0x7f')]['SELECT']})[_0xb66a('0x23')](function(_0x176ff0){if(_0x176ff0[_0xb66a('0x4c')]===0x1){return _0x378d2a['id'];}else{var _0x379c6b=_['every'](_[_0xb66a('0x32')](_0x176ff0,'TeamId'),function(_0x5c1d1e){return _[_0xb66a('0x80')](_0xb77a66,_0x5c1d1e);});if(_0x379c6b){return _0x378d2a['id'];}}}));}}return BPromise['all'](_0x557418)['then'](function(_0xd36645){_0x439a02=_(_0x439a02)['union'](_0xd36645)[_0xb66a('0x81')]()[_0xb66a('0x82')]();return db['MailQueue'][_0xb66a('0x4d')]({'where':{'id':_0x4d65dc[_0xb66a('0x4b')]['id']}})['then'](function(_0x1b0818){return db[_0xb66a('0x6e')][_0xb66a('0x6f')](function(_0x3e592f){return _0x1b0818[_0xb66a('0x83')](_0x4d65dc['query']['ids'],{'transaction':_0x3e592f})['then'](function(){if(!_['isEmpty'](_0x439a02)){return _0x1b0818[_0xb66a('0x84')](_0x439a02,{'transaction':_0x3e592f});}})[_0xb66a('0x23')](function(){_0x439a02[_0xb66a('0x71')](function(_0x52a0d2){socket[_0xb66a('0x72')](_0xb66a('0x85'),{'UserId':_0x52a0d2,'MailQueueId':_0x1b0818['id']});});});});});});})['then'](respondWithStatusCode(_0x18249c,null))[_0xb66a('0x49')](handleError(_0x18249c,null));};exports[_0xb66a('0x86')]=function(_0x4fbb60,_0x3ae289,_0x48c065){return db['MailQueue']['find']({'where':{'id':_0x4fbb60[_0xb66a('0x4b')]['id']}})[_0xb66a('0x23')](handleEntityNotFound(_0x3ae289,null))['then'](function(_0x32f863){if(_0x32f863){return _0x32f863['addAgents'](_0x4fbb60[_0xb66a('0x4f')]['ids'],_[_0xb66a('0x87')](_0x4fbb60[_0xb66a('0x4f')],[_0xb66a('0x68'),'id'])||{})[_0xb66a('0x88')](function(_0x2e82a0){for(var _0x5c9ec6=0x0;_0x5c9ec6<_0x4fbb60[_0xb66a('0x4f')][_0xb66a('0x68')]['length'];_0x5c9ec6+=0x1){socket[_0xb66a('0x72')]('userMailQueue:save',{'UserId':_0x4fbb60['body'][_0xb66a('0x68')][_0x5c9ec6],'MailQueueId':_0x4fbb60[_0xb66a('0x4b')]['id']});}return _0x2e82a0;});}})[_0xb66a('0x23')](respondWithResult(_0x3ae289,null))['catch'](handleError(_0x3ae289,null));};exports[_0xb66a('0x84')]=function(_0x13c5e4,_0x1468b6,_0x1225d6){return db[_0xb66a('0x2d')][_0xb66a('0x4d')]({'where':{'id':_0x13c5e4[_0xb66a('0x4b')]['id']}})[_0xb66a('0x23')](handleEntityNotFound(_0x1468b6,null))[_0xb66a('0x23')](function(_0x2d2732){if(_0x2d2732){return _0x2d2732['removeAgents'](_0x13c5e4[_0xb66a('0x33')][_0xb66a('0x68')])[_0xb66a('0x23')](function(){if(_['isArray'](_0x13c5e4[_0xb66a('0x33')]['ids'])){for(var _0x1634a5=0x0;_0x1634a5<_0x13c5e4['query']['ids'][_0xb66a('0x4c')];_0x1634a5+=0x1){socket['emit'](_0xb66a('0x85'),{'UserId':Number(_0x13c5e4['query'][_0xb66a('0x68')][_0x1634a5]),'MailQueueId':Number(_0x13c5e4[_0xb66a('0x4b')]['id'])});}}else{socket[_0xb66a('0x72')](_0xb66a('0x85'),{'UserId':Number(_0x13c5e4['query'][_0xb66a('0x68')]),'MailQueueId':Number(_0x13c5e4['params']['id'])});}});}})[_0xb66a('0x23')](respondWithStatusCode(_0x1468b6,null))['catch'](handleError(_0x1468b6,null));};exports[_0xb66a('0x89')]=function(_0x3a7f79,_0x293dc4,_0x592358){var _0x4eabc1={};var _0x456b8a={};var _0x4bd5c7;var _0x3a514d;return db['MailQueue'][_0xb66a('0x58')]({'where':{'id':_0x3a7f79[_0xb66a('0x4b')]['id']}})[_0xb66a('0x23')](handleEntityNotFound(_0x293dc4,null))[_0xb66a('0x23')](function(_0x13c904){if(_0x13c904){_0x4bd5c7=_0x13c904;_0x456b8a[_0xb66a('0x37')]=_[_0xb66a('0x34')](db['User'][_0xb66a('0x2e')]);_0x456b8a['query']=_[_0xb66a('0x34')](_0x3a7f79[_0xb66a('0x33')]);_0x456b8a[_0xb66a('0x35')]=_[_0xb66a('0x36')](_0x456b8a[_0xb66a('0x37')],_0x456b8a[_0xb66a('0x33')]);_0x4eabc1[_0xb66a('0x38')]=_[_0xb66a('0x36')](_0x456b8a[_0xb66a('0x37')],qs[_0xb66a('0x39')](_0x3a7f79[_0xb66a('0x33')][_0xb66a('0x39')]));_0x4eabc1[_0xb66a('0x38')]=_0x4eabc1['attributes'][_0xb66a('0x4c')]?_0x4eabc1[_0xb66a('0x38')]:_0x456b8a[_0xb66a('0x37')];_0x4eabc1[_0xb66a('0x59')]=qs['sort'](_0x3a7f79[_0xb66a('0x33')][_0xb66a('0x3d')]);_0x4eabc1[_0xb66a('0x3e')]=qs[_0xb66a('0x35')](_[_0xb66a('0x3f')](_0x3a7f79[_0xb66a('0x33')],_0x456b8a[_0xb66a('0x35')]));if(_0x3a7f79[_0xb66a('0x33')][_0xb66a('0x40')]){_0x4eabc1[_0xb66a('0x3e')]=_['merge'](_0x4eabc1[_0xb66a('0x3e')],{'$or':_[_0xb66a('0x32')](_0x4eabc1[_0xb66a('0x38')],function(_0x421fd0){var _0x3e8119={};_0x3e8119[_0x421fd0]={'$like':'%'+_0x3a7f79[_0xb66a('0x33')][_0xb66a('0x40')]+'%'};return _0x3e8119;})});}_0x4eabc1=_[_0xb66a('0x41')]({},_0x4eabc1,_0x3a7f79[_0xb66a('0x43')]);return _0x4bd5c7[_0xb66a('0x89')](_0x4eabc1);}})[_0xb66a('0x23')](function(_0x5dcb4a){if(_0x5dcb4a){_0x3a514d=_0x5dcb4a[_0xb66a('0x4c')];if(!_0x3a7f79['query'][_0xb66a('0x3a')](_0xb66a('0x3b'))){_0x4eabc1[_0xb66a('0x3c')]=qs[_0xb66a('0x3c')](_0x3a7f79['query'][_0xb66a('0x3c')]);_0x4eabc1['offset']=qs[_0xb66a('0x1e')](_0x3a7f79['query'][_0xb66a('0x1e')]);}return _0x4bd5c7[_0xb66a('0x89')](_0x4eabc1);}})[_0xb66a('0x23')](function(_0x10a41b){if(_0x10a41b){return _0x10a41b?{'count':_0x3a514d,'rows':_0x10a41b}:null;}})[_0xb66a('0x23')](respondWithResult(_0x293dc4,null))[_0xb66a('0x49')](handleError(_0x293dc4,null));}; \ No newline at end of file +var _0x18a2=['ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','MailQueues','UserProfileResource','end','sendStatus','error','stack','name','send','map','MailQueue','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserMailQueue','nolimit','options','User','UserId','agent','createdAt','%s/%s','SIP','mailPause','updatedAt','getTeams','ids','Agents','voicePause','interface','transaction','addTeams','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','union','value','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','spread','userMailQueue:save','getAgents','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','sox'];(function(_0x3f0ae7,_0xe16dee){var _0x5d4e2e=function(_0x2a9890){while(--_0x2a9890){_0x3f0ae7['push'](_0x3f0ae7['shift']());}};_0x5d4e2e(++_0xe16dee);}(_0x18a2,0x107));var _0x218a=function(_0x34ddea,_0x4d99a0){_0x34ddea=_0x34ddea-0x0;var _0x1cd59a=_0x18a2[_0x34ddea];return _0x1cd59a;};'use strict';var pdf=require(_0x218a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x218a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x218a('0x2'));var moment=require(_0x218a('0x3'));var BPromise=require(_0x218a('0x4'));var Mustache=require(_0x218a('0x5'));var util=require('util');var path=require('path');var sox=require(_0x218a('0x6'));var csv=require('to-csv');var ejs=require(_0x218a('0x7'));var fs=require('fs');var fs_extra=require(_0x218a('0x8'));var _=require(_0x218a('0x9'));var squel=require(_0x218a('0xa'));var crypto=require(_0x218a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x218a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x218a('0xd'));var Papa=require(_0x218a('0xe'));var Redis=require(_0x218a('0xf'));var authService=require(_0x218a('0x10'));var qs=require(_0x218a('0x11'));var as=require(_0x218a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x218a('0x13'))('api');var utils=require(_0x218a('0x14'));var config=require(_0x218a('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x218a('0x16')]=_[_0x218a('0x17')](config['redis'],{'host':_0x218a('0x18'),'port':0x18eb});var socket=require(_0x218a('0x19'))(new Redis(config[_0x218a('0x16')]));require(_0x218a('0x1a'))[_0x218a('0x1b')](socket);function respondWithStatusCode(_0x425908,_0x5715fb){_0x5715fb=_0x5715fb||0xcc;return function(_0x3f753f){if(_0x3f753f){return _0x425908['sendStatus'](_0x5715fb);}return _0x425908['status'](_0x5715fb)['end']();};}function respondWithResult(_0xf03d7a,_0xa08e90){_0xa08e90=_0xa08e90||0xc8;return function(_0x48fbc5){if(_0x48fbc5){return _0xf03d7a[_0x218a('0x1c')](_0xa08e90)[_0x218a('0x1d')](_0x48fbc5);}};}function respondWithFilteredResult(_0x1a11d3,_0x3db35c){return function(_0x21dcfb){if(_0x21dcfb){var _0xf751af=_0x21dcfb[_0x218a('0x1e')],_0x4cd543=_0x3db35c[_0x218a('0x1f')],_0x1d6a64=_0x3db35c[_0x218a('0x1f')]+_0x3db35c[_0x218a('0x20')],_0x3adb98;if(_0x1d6a64>=_0xf751af){_0x1d6a64=_0xf751af;_0x3adb98=0xc8;}else{_0x3adb98=0xce;}_0x1a11d3['status'](_0x3adb98);return _0x1a11d3[_0x218a('0x21')](_0x218a('0x22'),_0x4cd543+'-'+_0x1d6a64+'/'+_0xf751af)[_0x218a('0x1d')](_0x21dcfb);}return null;};}function patchUpdates(_0x441ebe){return function(_0x167743){try{jsonpatch[_0x218a('0x23')](_0x167743,_0x441ebe,!![]);}catch(_0x26e743){return BPromise['reject'](_0x26e743);}return _0x167743[_0x218a('0x24')]();};}function saveUpdates(_0x411465,_0x3bd7c7){return function(_0x46fade){if(_0x46fade){return _0x46fade[_0x218a('0x25')](_0x411465)[_0x218a('0x26')](function(_0x4c317a){return _0x4c317a;});}return null;};}function removeEntity(_0x712c5b,_0x94abda){return function(_0x4b5b0b){if(_0x4b5b0b){return _0x4b5b0b[_0x218a('0x27')]()[_0x218a('0x26')](function(){var _0x41de3e=_0x4b5b0b['get']({'plain':!![]});var _0x4febaa=_0x218a('0x28');return db[_0x218a('0x29')][_0x218a('0x27')]({'where':{'type':_0x4febaa,'resourceId':_0x41de3e['id']}})[_0x218a('0x26')](function(){return _0x4b5b0b;});})[_0x218a('0x26')](function(){_0x712c5b['status'](0xcc)[_0x218a('0x2a')]();});}};}function handleEntityNotFound(_0x496dfd,_0xac3ad9){return function(_0x395671){if(!_0x395671){_0x496dfd[_0x218a('0x2b')](0x194);}return _0x395671;};}function handleError(_0x1a37e2,_0x36a4cf){_0x36a4cf=_0x36a4cf||0x1f4;return function(_0x126565){logger[_0x218a('0x2c')](_0x126565[_0x218a('0x2d')]);if(_0x126565['name']){delete _0x126565[_0x218a('0x2e')];}_0x1a37e2[_0x218a('0x1c')](_0x36a4cf)[_0x218a('0x2f')](_0x126565);};}exports['index']=function(_0x1d22a9,_0x228fb1){var _0x35ba65={},_0x13f28a={},_0x24464c={'count':0x0,'rows':[]};var _0xb4f2b8=_[_0x218a('0x30')](db[_0x218a('0x31')][_0x218a('0x32')],function(_0x2e570a){return{'name':_0x2e570a['fieldName'],'type':_0x2e570a[_0x218a('0x33')]['key']};});_0x13f28a[_0x218a('0x34')]=_['map'](_0xb4f2b8,_0x218a('0x2e'));_0x13f28a[_0x218a('0x35')]=_[_0x218a('0x36')](_0x1d22a9[_0x218a('0x35')]);_0x13f28a[_0x218a('0x37')]=_[_0x218a('0x38')](_0x13f28a[_0x218a('0x34')],_0x13f28a[_0x218a('0x35')]);_0x35ba65[_0x218a('0x39')]=_[_0x218a('0x38')](_0x13f28a[_0x218a('0x34')],qs[_0x218a('0x3a')](_0x1d22a9['query'][_0x218a('0x3a')]));_0x35ba65[_0x218a('0x39')]=_0x35ba65[_0x218a('0x39')][_0x218a('0x3b')]?_0x35ba65[_0x218a('0x39')]:_0x13f28a[_0x218a('0x34')];if(!_0x1d22a9[_0x218a('0x35')][_0x218a('0x3c')]('nolimit')){_0x35ba65[_0x218a('0x20')]=qs['limit'](_0x1d22a9[_0x218a('0x35')]['limit']);_0x35ba65[_0x218a('0x1f')]=qs[_0x218a('0x1f')](_0x1d22a9['query'][_0x218a('0x1f')]);}_0x35ba65[_0x218a('0x3d')]=qs[_0x218a('0x3e')](_0x1d22a9[_0x218a('0x35')][_0x218a('0x3e')]);_0x35ba65[_0x218a('0x3f')]=qs['filters'](_[_0x218a('0x40')](_0x1d22a9[_0x218a('0x35')],_0x13f28a[_0x218a('0x37')]),_0xb4f2b8);if(_0x1d22a9[_0x218a('0x35')][_0x218a('0x41')]){_0x35ba65['where']=_[_0x218a('0x42')](_0x35ba65[_0x218a('0x3f')],{'$or':_['map'](_0xb4f2b8,function(_0x408a1f){if(_0x408a1f[_0x218a('0x33')]!=='VIRTUAL'){var _0x18636a={};_0x18636a[_0x408a1f[_0x218a('0x2e')]]={'$like':'%'+_0x1d22a9[_0x218a('0x35')]['filter']+'%'};return _0x18636a;}})});}_0x35ba65=_[_0x218a('0x42')]({},_0x35ba65,_0x1d22a9['options']);var _0x4655cd={'where':_0x35ba65['where']};return db[_0x218a('0x31')][_0x218a('0x1e')](_0x4655cd)['then'](function(_0x11dce4){_0x24464c[_0x218a('0x1e')]=_0x11dce4;if(_0x1d22a9[_0x218a('0x35')][_0x218a('0x43')]){_0x35ba65[_0x218a('0x44')]=[{'all':!![]}];}return db[_0x218a('0x31')][_0x218a('0x45')](_0x35ba65);})[_0x218a('0x26')](function(_0x43fb65){_0x24464c[_0x218a('0x46')]=_0x43fb65;return _0x24464c;})['then'](respondWithFilteredResult(_0x228fb1,_0x35ba65))[_0x218a('0x47')](handleError(_0x228fb1,null));};exports[_0x218a('0x48')]=function(_0x1c8e79,_0x372d28){var _0x5e12f4={'raw':!![],'where':{'id':_0x1c8e79['params']['id']}},_0x33236b={};_0x33236b[_0x218a('0x34')]=_['keys'](db[_0x218a('0x31')][_0x218a('0x32')]);_0x33236b[_0x218a('0x35')]=_[_0x218a('0x36')](_0x1c8e79[_0x218a('0x35')]);_0x33236b['filters']=_[_0x218a('0x38')](_0x33236b[_0x218a('0x34')],_0x33236b[_0x218a('0x35')]);_0x5e12f4[_0x218a('0x39')]=_['intersection'](_0x33236b[_0x218a('0x34')],qs['fields'](_0x1c8e79[_0x218a('0x35')]['fields']));_0x5e12f4[_0x218a('0x39')]=_0x5e12f4[_0x218a('0x39')][_0x218a('0x3b')]?_0x5e12f4[_0x218a('0x39')]:_0x33236b[_0x218a('0x34')];if(_0x1c8e79[_0x218a('0x35')][_0x218a('0x43')]){_0x5e12f4[_0x218a('0x44')]=[{'all':!![]}];}_0x5e12f4=_[_0x218a('0x42')]({},_0x5e12f4,_0x1c8e79['options']);return db[_0x218a('0x31')][_0x218a('0x49')](_0x5e12f4)[_0x218a('0x26')](handleEntityNotFound(_0x372d28,null))[_0x218a('0x26')](respondWithResult(_0x372d28,null))[_0x218a('0x47')](handleError(_0x372d28,null));};exports[_0x218a('0x4a')]=function(_0x5df967,_0x10f0e9){return db[_0x218a('0x31')][_0x218a('0x4a')](_0x5df967[_0x218a('0x4b')],{})[_0x218a('0x26')](function(_0x2fe509){var _0x5c1c4a=_0x5df967[_0x218a('0x4c')]['get']({'plain':!![]});if(!_0x5c1c4a)throw new Error(_0x218a('0x4d'));if(_0x5c1c4a[_0x218a('0x4e')]===_0x218a('0x4c')){var _0x873755=_0x2fe509[_0x218a('0x4f')]({'plain':!![]});var _0x1d5977='MailQueues';return db[_0x218a('0x50')][_0x218a('0x49')]({'where':{'name':_0x1d5977,'userProfileId':_0x5c1c4a[_0x218a('0x51')]},'raw':!![]})['then'](function(_0x522fe0){if(_0x522fe0&&_0x522fe0[_0x218a('0x52')]===0x0){return db[_0x218a('0x29')][_0x218a('0x4a')]({'name':_0x873755[_0x218a('0x2e')],'resourceId':_0x873755['id'],'type':_0x522fe0[_0x218a('0x2e')],'sectionId':_0x522fe0['id']},{})[_0x218a('0x26')](function(){return _0x2fe509;});}else{return _0x2fe509;}})[_0x218a('0x47')](function(_0x30cb9c){logger[_0x218a('0x2c')](_0x218a('0x53'),_0x30cb9c);throw _0x30cb9c;});}return _0x2fe509;})[_0x218a('0x26')](respondWithResult(_0x10f0e9,0xc9))[_0x218a('0x47')](handleError(_0x10f0e9,null));};exports[_0x218a('0x25')]=function(_0x4bd99f,_0x27b24e){if(_0x4bd99f[_0x218a('0x4b')]['id']){delete _0x4bd99f['body']['id'];}return db['MailQueue'][_0x218a('0x49')]({'where':{'id':_0x4bd99f[_0x218a('0x54')]['id']}})[_0x218a('0x26')](handleEntityNotFound(_0x27b24e,null))[_0x218a('0x26')](saveUpdates(_0x4bd99f[_0x218a('0x4b')],null))[_0x218a('0x26')](respondWithResult(_0x27b24e,null))['catch'](handleError(_0x27b24e,null));};exports[_0x218a('0x27')]=function(_0x38dddb,_0x1f89ab){return db[_0x218a('0x31')][_0x218a('0x49')]({'where':{'id':_0x38dddb['params']['id']}})[_0x218a('0x26')](handleEntityNotFound(_0x1f89ab,null))['then'](removeEntity(_0x1f89ab,null))[_0x218a('0x47')](handleError(_0x1f89ab,null));};exports[_0x218a('0x55')]=function(_0x32bdbb,_0x3728f7){return db[_0x218a('0x31')][_0x218a('0x55')]()['then'](respondWithResult(_0x3728f7,null))[_0x218a('0x47')](handleError(_0x3728f7,null));};exports['getMembers']=function(_0x97a68,_0x32127a,_0x2113a5){var _0x138b9d={'raw':!![],'where':{}},_0x406128={},_0x3b60a2;return db[_0x218a('0x31')][_0x218a('0x56')]({'where':{'id':_0x97a68[_0x218a('0x54')]['id']}})['then'](handleEntityNotFound(_0x32127a,null))[_0x218a('0x26')](function(_0x47880f){if(_0x47880f){_0x3b60a2=_0x47880f[_0x218a('0x4f')]({'plain':!![]});_0x406128[_0x218a('0x34')]=_[_0x218a('0x36')](db[_0x218a('0x57')]['rawAttributes']);_0x406128[_0x218a('0x35')]=_[_0x218a('0x36')](_0x97a68['query']);_0x406128[_0x218a('0x37')]=_[_0x218a('0x38')](_0x406128[_0x218a('0x34')],_0x406128[_0x218a('0x35')]);_0x138b9d[_0x218a('0x39')]=_[_0x218a('0x38')](_0x406128['model'],qs[_0x218a('0x3a')](_0x97a68['query'][_0x218a('0x3a')]));_0x138b9d[_0x218a('0x39')]=_0x138b9d['attributes'][_0x218a('0x3b')]?_0x138b9d['attributes']:_0x406128[_0x218a('0x34')];if(!_0x97a68[_0x218a('0x35')][_0x218a('0x3c')](_0x218a('0x58'))){_0x138b9d[_0x218a('0x20')]=qs[_0x218a('0x20')](_0x97a68[_0x218a('0x35')][_0x218a('0x20')]);_0x138b9d['offset']=qs['offset'](_0x97a68[_0x218a('0x35')][_0x218a('0x1f')]);}_0x138b9d['order']=qs[_0x218a('0x3e')](_0x97a68['query'][_0x218a('0x3e')]);_0x138b9d['where']=qs[_0x218a('0x37')](_[_0x218a('0x40')](_0x97a68[_0x218a('0x35')],_0x406128[_0x218a('0x37')]));_0x138b9d[_0x218a('0x3f')]['MailQueueId']=_0x47880f['id'];if(_0x97a68[_0x218a('0x35')][_0x218a('0x41')]){_0x138b9d[_0x218a('0x3f')]=_[_0x218a('0x42')](_0x138b9d[_0x218a('0x3f')],{'$or':_[_0x218a('0x30')](_0x138b9d[_0x218a('0x39')],function(_0x214eb4){var _0x18da8a={};_0x18da8a[_0x214eb4]={'$like':'%'+_0x97a68[_0x218a('0x35')]['filter']+'%'};return _0x18da8a;})});}_0x138b9d=_['merge']({},_0x138b9d,_0x97a68[_0x218a('0x59')]);return db['UserMailQueue']['findAll'](_0x138b9d);}})['then'](function(_0x562e58){if(_0x562e58){return db[_0x218a('0x5a')]['findAndCountAll']({'where':{'id':_['map'](_0x562e58,_0x218a('0x5b')),'role':_0x218a('0x5c')},'attributes':['id',_0x218a('0x2e'),'mailPause','updatedAt',_0x218a('0x5d')]});}})[_0x218a('0x26')](function(_0x3c69ec){if(_0x3c69ec){return{'count':_0x3c69ec[_0x218a('0x1e')],'rows':_[_0x218a('0x30')](_0x3c69ec[_0x218a('0x46')],function(_0x2956b0){return{'membername':_0x2956b0[_0x218a('0x2e')],'UserId':_0x2956b0['id'],'queue_name':_0x3b60a2[_0x218a('0x2e')],'MailQueueId':_0x3b60a2['id'],'interface':util['format'](_0x218a('0x5e'),_0x218a('0x5f'),_0x2956b0[_0x218a('0x2e')]),'penalty':0x0,'paused':_0x2956b0[_0x218a('0x60')],'createdAt':_0x2956b0[_0x218a('0x5d')],'updatedAt':_0x2956b0[_0x218a('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x218a('0x26')](respondWithFilteredResult(_0x32127a,_0x138b9d))[_0x218a('0x47')](handleError(_0x32127a,null));};exports[_0x218a('0x62')]=function(_0x3fefec,_0x5c02f2,_0x38fb34){var _0x25958f={};var _0x2d779f={};var _0x2e454c;var _0x506392;return db[_0x218a('0x31')][_0x218a('0x56')]({'where':{'id':_0x3fefec[_0x218a('0x54')]['id']}})['then'](handleEntityNotFound(_0x5c02f2,null))[_0x218a('0x26')](function(_0x298b74){if(_0x298b74){_0x2e454c=_0x298b74;_0x2d779f[_0x218a('0x34')]=_[_0x218a('0x36')](db['Team'][_0x218a('0x32')]);_0x2d779f['query']=_[_0x218a('0x36')](_0x3fefec[_0x218a('0x35')]);_0x2d779f[_0x218a('0x37')]=_[_0x218a('0x38')](_0x2d779f[_0x218a('0x34')],_0x2d779f[_0x218a('0x35')]);_0x25958f['attributes']=_['intersection'](_0x2d779f['model'],qs[_0x218a('0x3a')](_0x3fefec['query'][_0x218a('0x3a')]));_0x25958f[_0x218a('0x39')]=_0x25958f['attributes']['length']?_0x25958f[_0x218a('0x39')]:_0x2d779f[_0x218a('0x34')];_0x25958f[_0x218a('0x3d')]=qs[_0x218a('0x3e')](_0x3fefec['query'][_0x218a('0x3e')]);_0x25958f['where']=qs[_0x218a('0x37')](_[_0x218a('0x40')](_0x3fefec[_0x218a('0x35')],_0x2d779f['filters']));if(_0x3fefec[_0x218a('0x35')]['filter']){_0x25958f[_0x218a('0x3f')]=_[_0x218a('0x42')](_0x25958f[_0x218a('0x3f')],{'$or':_[_0x218a('0x30')](_0x25958f['attributes'],function(_0x4a785e){var _0x4991f2={};_0x4991f2[_0x4a785e]={'$like':'%'+_0x3fefec[_0x218a('0x35')][_0x218a('0x41')]+'%'};return _0x4991f2;})});}_0x25958f=_[_0x218a('0x42')]({},_0x25958f,_0x3fefec[_0x218a('0x59')]);return _0x2e454c[_0x218a('0x62')](_0x25958f);}})[_0x218a('0x26')](function(_0x5b3a5c){if(_0x5b3a5c){_0x506392=_0x5b3a5c['length'];if(!_0x3fefec[_0x218a('0x35')][_0x218a('0x3c')]('nolimit')){_0x25958f[_0x218a('0x20')]=qs[_0x218a('0x20')](_0x3fefec[_0x218a('0x35')][_0x218a('0x20')]);_0x25958f[_0x218a('0x1f')]=qs[_0x218a('0x1f')](_0x3fefec[_0x218a('0x35')][_0x218a('0x1f')]);}return _0x2e454c[_0x218a('0x62')](_0x25958f);}})[_0x218a('0x26')](function(_0x24cd80){if(_0x24cd80){return _0x24cd80?{'count':_0x506392,'rows':_0x24cd80}:null;}})['then'](respondWithResult(_0x5c02f2,null))[_0x218a('0x47')](handleError(_0x5c02f2,null));};exports['addTeams']=function(_0x6ebf63,_0x2f5c5e,_0x4e8363){var _0x508312=_0x6ebf63[_0x218a('0x4b')][_0x218a('0x63')];return db['Team'][_0x218a('0x45')]({'where':{'id':_0x508312},'attributes':['id'],'include':[{'model':db['User'],'as':_0x218a('0x64'),'attributes':['id',_0x218a('0x2e'),'online',_0x218a('0x65'),_0x218a('0x66')],'raw':!![]}]})[_0x218a('0x26')](function(_0x50e57c){if(_0x50e57c){var _0x4dd031=_['flatMap'](_0x50e57c,function(_0x222051){var _0x28d3ad=_0x222051[_0x218a('0x4f')]({'plain':!![]});return _0x28d3ad['Agents'];});return db[_0x218a('0x31')][_0x218a('0x49')]({'where':{'id':_0x6ebf63[_0x218a('0x54')]['id']}})['then'](function(_0x1d73fb){return db['sequelize'][_0x218a('0x67')](function(_0x1b0df2){return _0x1d73fb[_0x218a('0x68')](_0x508312,{'transaction':_0x1b0df2})['then'](function(){return BPromise[_0x218a('0x69')](_0x4dd031,function(_0x5c88e4){return db[_0x218a('0x57')][_0x218a('0x6a')]({'where':{'UserId':_0x5c88e4['id'],'MailQueueId':_0x6ebf63[_0x218a('0x54')]['id']},'transaction':_0x1b0df2});});})[_0x218a('0x26')](function(){_0x4dd031['forEach'](function(_0x10ee1f){socket[_0x218a('0x6b')]('userMailQueue:save',{'UserId':_0x10ee1f['id'],'MailQueueId':_0x1d73fb['id']});});});});});}})[_0x218a('0x26')](respondWithStatusCode(_0x2f5c5e,null))[_0x218a('0x47')](handleError(_0x2f5c5e,null));};exports[_0x218a('0x6c')]=function(_0x138103,_0x1bcb98,_0x2992fe){return db['Team'][_0x218a('0x45')]({'where':{'id':_0x138103[_0x218a('0x35')][_0x218a('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x218a('0x26')](handleEntityNotFound(_0x1bcb98,null))[_0x218a('0x26')](function(_0x42fb99){var _0x4669c2=_[_0x218a('0x30')](_0x42fb99,'id');var _0x5338ab=[];var _0x36bb5c=[];var _0x21dbe8=squel[_0x218a('0x6d')]();_0x21dbe8[_0x218a('0x6e')](_0x218a('0x6f'))[_0x218a('0x70')](_0x218a('0x71'),'tq')[_0x218a('0x72')](_0x218a('0x73'),'ut',_0x218a('0x74'))[_0x218a('0x3f')]('MailQueueId\x20=\x20?',_0x138103[_0x218a('0x54')]['id']);for(var _0x48bf31=0x0;_0x48bf31<_0x42fb99[_0x218a('0x3b')];_0x48bf31+=0x1){let _0x485ebb=_0x42fb99[_0x48bf31];for(var _0x426499=0x0;_0x426499<_0x485ebb[_0x218a('0x64')][_0x218a('0x3b')];_0x426499+=0x1){let _0x154654=_0x485ebb[_0x218a('0x64')][_0x426499];var _0x177708=_0x21dbe8['clone']();_0x177708[_0x218a('0x3f')](_0x218a('0x75'),_0x154654['id']);_0x36bb5c[_0x218a('0x76')](db[_0x218a('0x77')][_0x218a('0x35')](_0x177708[_0x218a('0x78')](),{'type':db[_0x218a('0x77')]['QueryTypes'][_0x218a('0x79')]})[_0x218a('0x26')](function(_0x441703){if(_0x441703[_0x218a('0x3b')]===0x1){return _0x154654['id'];}else{var _0x2161a2=_[_0x218a('0x7a')](_[_0x218a('0x30')](_0x441703,_0x218a('0x7b')),function(_0x262467){return _[_0x218a('0x7c')](_0x4669c2,_0x262467);});if(_0x2161a2){return _0x154654['id'];}}}));}}return BPromise['all'](_0x36bb5c)['then'](function(_0x49ead7){_0x5338ab=_(_0x5338ab)[_0x218a('0x7d')](_0x49ead7)['compact']()[_0x218a('0x7e')]();return db['MailQueue'][_0x218a('0x49')]({'where':{'id':_0x138103['params']['id']}})[_0x218a('0x26')](function(_0x5115e4){return db[_0x218a('0x77')][_0x218a('0x67')](function(_0x545c51){return _0x5115e4[_0x218a('0x6c')](_0x138103[_0x218a('0x35')][_0x218a('0x63')],{'transaction':_0x545c51})['then'](function(){if(!_[_0x218a('0x7f')](_0x5338ab)){return _0x5115e4[_0x218a('0x80')](_0x5338ab,{'transaction':_0x545c51});}})['then'](function(){_0x5338ab[_0x218a('0x81')](function(_0x3141d9){socket[_0x218a('0x6b')](_0x218a('0x82'),{'UserId':_0x3141d9,'MailQueueId':_0x5115e4['id']});});});});});});})[_0x218a('0x26')](respondWithStatusCode(_0x1bcb98,null))[_0x218a('0x47')](handleError(_0x1bcb98,null));};exports[_0x218a('0x83')]=function(_0x1ee690,_0x279e09,_0x23430e){return db[_0x218a('0x31')]['find']({'where':{'id':_0x1ee690['params']['id']}})[_0x218a('0x26')](handleEntityNotFound(_0x279e09,null))['then'](function(_0x286381){if(_0x286381){return _0x286381['addAgents'](_0x1ee690[_0x218a('0x4b')][_0x218a('0x63')],_['omit'](_0x1ee690[_0x218a('0x4b')],[_0x218a('0x63'),'id'])||{})[_0x218a('0x84')](function(_0x17edf9){for(var _0xa50821=0x0;_0xa50821<_0x1ee690['body']['ids'][_0x218a('0x3b')];_0xa50821+=0x1){socket['emit'](_0x218a('0x85'),{'UserId':_0x1ee690['body'][_0x218a('0x63')][_0xa50821],'MailQueueId':_0x1ee690[_0x218a('0x54')]['id']});}return _0x17edf9;});}})['then'](respondWithResult(_0x279e09,null))[_0x218a('0x47')](handleError(_0x279e09,null));};exports[_0x218a('0x80')]=function(_0x5d4338,_0x356f28,_0x527242){return db['MailQueue']['find']({'where':{'id':_0x5d4338[_0x218a('0x54')]['id']}})[_0x218a('0x26')](handleEntityNotFound(_0x356f28,null))[_0x218a('0x26')](function(_0x17074e){if(_0x17074e){return _0x17074e[_0x218a('0x80')](_0x5d4338['query']['ids'])['then'](function(){if(_['isArray'](_0x5d4338[_0x218a('0x35')][_0x218a('0x63')])){for(var _0x75f711=0x0;_0x75f711<_0x5d4338[_0x218a('0x35')][_0x218a('0x63')][_0x218a('0x3b')];_0x75f711+=0x1){socket['emit'](_0x218a('0x82'),{'UserId':Number(_0x5d4338['query']['ids'][_0x75f711]),'MailQueueId':Number(_0x5d4338[_0x218a('0x54')]['id'])});}}else{socket[_0x218a('0x6b')]('userMailQueue:remove',{'UserId':Number(_0x5d4338['query'][_0x218a('0x63')]),'MailQueueId':Number(_0x5d4338[_0x218a('0x54')]['id'])});}});}})[_0x218a('0x26')](respondWithStatusCode(_0x356f28,null))[_0x218a('0x47')](handleError(_0x356f28,null));};exports[_0x218a('0x86')]=function(_0x37612d,_0x151ead,_0x28aa42){var _0xfb81d9={};var _0x2c76f9={};var _0x6c96b6;var _0x57d26c;return db[_0x218a('0x31')][_0x218a('0x56')]({'where':{'id':_0x37612d[_0x218a('0x54')]['id']}})[_0x218a('0x26')](handleEntityNotFound(_0x151ead,null))[_0x218a('0x26')](function(_0x5443bd){if(_0x5443bd){_0x6c96b6=_0x5443bd;_0x2c76f9[_0x218a('0x34')]=_[_0x218a('0x36')](db['User'][_0x218a('0x32')]);_0x2c76f9['query']=_['keys'](_0x37612d['query']);_0x2c76f9[_0x218a('0x37')]=_[_0x218a('0x38')](_0x2c76f9['model'],_0x2c76f9['query']);_0xfb81d9['attributes']=_[_0x218a('0x38')](_0x2c76f9[_0x218a('0x34')],qs[_0x218a('0x3a')](_0x37612d[_0x218a('0x35')]['fields']));_0xfb81d9[_0x218a('0x39')]=_0xfb81d9['attributes'][_0x218a('0x3b')]?_0xfb81d9[_0x218a('0x39')]:_0x2c76f9[_0x218a('0x34')];_0xfb81d9[_0x218a('0x3d')]=qs[_0x218a('0x3e')](_0x37612d[_0x218a('0x35')][_0x218a('0x3e')]);_0xfb81d9[_0x218a('0x3f')]=qs[_0x218a('0x37')](_[_0x218a('0x40')](_0x37612d[_0x218a('0x35')],_0x2c76f9[_0x218a('0x37')]));if(_0x37612d[_0x218a('0x35')]['filter']){_0xfb81d9[_0x218a('0x3f')]=_['merge'](_0xfb81d9[_0x218a('0x3f')],{'$or':_[_0x218a('0x30')](_0xfb81d9['attributes'],function(_0x3a6a4b){var _0x2cb3fb={};_0x2cb3fb[_0x3a6a4b]={'$like':'%'+_0x37612d[_0x218a('0x35')][_0x218a('0x41')]+'%'};return _0x2cb3fb;})});}_0xfb81d9=_[_0x218a('0x42')]({},_0xfb81d9,_0x37612d[_0x218a('0x59')]);return _0x6c96b6[_0x218a('0x86')](_0xfb81d9);}})['then'](function(_0x22b1ed){if(_0x22b1ed){_0x57d26c=_0x22b1ed[_0x218a('0x3b')];if(!_0x37612d[_0x218a('0x35')][_0x218a('0x3c')](_0x218a('0x58'))){_0xfb81d9[_0x218a('0x20')]=qs[_0x218a('0x20')](_0x37612d[_0x218a('0x35')][_0x218a('0x20')]);_0xfb81d9['offset']=qs[_0x218a('0x1f')](_0x37612d[_0x218a('0x35')]['offset']);}return _0x6c96b6[_0x218a('0x86')](_0xfb81d9);}})[_0x218a('0x26')](function(_0x982e34){if(_0x982e34){return _0x982e34?{'count':_0x57d26c,'rows':_0x982e34}:null;}})[_0x218a('0x26')](respondWithResult(_0x151ead,null))[_0x218a('0x47')](handleError(_0x151ead,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 0f644f5..5dc7321 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 _0xd262=['hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit'];(function(_0x439fe3,_0x550a22){var _0x5c61e4=function(_0x3e9f0b){while(--_0x3e9f0b){_0x439fe3['push'](_0x439fe3['shift']());}};_0x5c61e4(++_0x550a22);}(_0xd262,0x12c));var _0x2d26=function(_0x18beb0,_0x5238d8){_0x18beb0=_0x18beb0-0x0;var _0x37d642=_0xd262[_0x18beb0];return _0x37d642;};'use strict';var EventEmitter=require(_0x2d26('0x0'));var MailQueue=require(_0x2d26('0x1'))['db'][_0x2d26('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x2d26('0x3')](0x0);var events={'afterCreate':_0x2d26('0x4'),'afterUpdate':_0x2d26('0x5'),'afterDestroy':_0x2d26('0x6')};function emitEvent(_0x2a621c){return function(_0x3a865c,_0x16ae12,_0x552e23){MailQueueEvents['emit'](_0x2a621c+':'+_0x3a865c['id'],_0x3a865c);MailQueueEvents[_0x2d26('0x7')](_0x2a621c,_0x3a865c);_0x552e23(null);};}for(var e in events){if(events[_0x2d26('0x8')](e)){var event=events[e];MailQueue[_0x2d26('0x9')](e,emitEvent(event));}}module[_0x2d26('0xa')]=MailQueueEvents; \ No newline at end of file +var _0x5856=['hook','exports','../../mysqldb','MailQueue','setMaxListeners','update','remove','emit'];(function(_0xd16c1c,_0x14bf73){var _0x3b4a66=function(_0x109792){while(--_0x109792){_0xd16c1c['push'](_0xd16c1c['shift']());}};_0x3b4a66(++_0x14bf73);}(_0x5856,0x12a));var _0x6585=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0x5856[_0x4d45c1];return _0x244478;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x6585('0x0'))['db'][_0x6585('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x6585('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6585('0x3'),'afterDestroy':_0x6585('0x4')};function emitEvent(_0x169c85){return function(_0x5005b9,_0x36301f,_0x22837a){MailQueueEvents[_0x6585('0x5')](_0x169c85+':'+_0x5005b9['id'],_0x5005b9);MailQueueEvents[_0x6585('0x5')](_0x169c85,_0x5005b9);_0x22837a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x6585('0x6')](e,emitEvent(event));}}module[_0x6585('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index c34e320..3e43488 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 _0x144c=['lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','MailQueue','mail_queues'];(function(_0x55ccc5,_0x247db5){var _0x19633d=function(_0x46f722){while(--_0x46f722){_0x55ccc5['push'](_0x55ccc5['shift']());}};_0x19633d(++_0x247db5);}(_0x144c,0xab));var _0xc144=function(_0x7538c5,_0xa5d8ac){_0x7538c5=_0x7538c5-0x0;var _0x8b56be=_0x144c[_0x7538c5];return _0x8b56be;};'use strict';var _=require(_0xc144('0x0'));var util=require('util');var logger=require(_0xc144('0x1'))('api');var moment=require(_0xc144('0x2'));var BPromise=require(_0xc144('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc144('0x4'));var config=require(_0xc144('0x5'));var attributes=require('./mailQueue.attributes');module[_0xc144('0x6')]=function(_0x4f9189,_0x5f4952){return _0x4f9189['define'](_0xc144('0x7'),attributes,{'tableName':_0xc144('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b25=['define','MailQueue','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./mailQueue.attributes','exports'];(function(_0x22bff2,_0x2f11e1){var _0x38e704=function(_0x116dd8){while(--_0x116dd8){_0x22bff2['push'](_0x22bff2['shift']());}};_0x38e704(++_0x2f11e1);}(_0x6b25,0x13a));var _0x56b2=function(_0x2ad484,_0x1f1d13){_0x2ad484=_0x2ad484-0x0;var _0x224303=_0x6b25[_0x2ad484];return _0x224303;};'use strict';var _=require(_0x56b2('0x0'));var util=require(_0x56b2('0x1'));var logger=require('../../config/logger')(_0x56b2('0x2'));var moment=require(_0x56b2('0x3'));var BPromise=require(_0x56b2('0x4'));var rp=require(_0x56b2('0x5'));var fs=require('fs');var path=require(_0x56b2('0x6'));var rimraf=require(_0x56b2('0x7'));var config=require('../../config/environment');var attributes=require(_0x56b2('0x8'));module[_0x56b2('0x9')]=function(_0x51ffa6,_0x2277d5){return _0x51ffa6[_0x56b2('0xa')](_0x56b2('0xb'),attributes,{'tableName':'mail_queues','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 4f14bd0..a3cbbd7 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 _0x125f=['defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','MailQueue','options','raw','where','attributes','limit','include','map','model','then','GetMailQueue','debug','catch','ShowMailQueue','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x5b9e30,_0x207255){var _0x102a4d=function(_0x5babf5){while(--_0x5babf5){_0x5b9e30['push'](_0x5b9e30['shift']());}};_0x102a4d(++_0x207255);}(_0x125f,0x1e4));var _0xf125=function(_0x10a11d,_0xcc39a6){_0x10a11d=_0x10a11d-0x0;var _0x32ef43=_0x125f[_0x10a11d];return _0x32ef43;};'use strict';var _=require(_0xf125('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf125('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf125('0x2'))['db'];var utils=require(_0xf125('0x3'));var logger=require(_0xf125('0x4'))(_0xf125('0x5'));var config=require(_0xf125('0x6'));var jayson=require(_0xf125('0x7'));var client=jayson['client'][_0xf125('0x8')]({'port':0x232a});config[_0xf125('0x9')]=_[_0xf125('0xa')](config['redis'],{'host':_0xf125('0xb'),'port':0x18eb});var socket=require(_0xf125('0xc'))(new Redis(config[_0xf125('0x9')]));require(_0xf125('0xd'))[_0xf125('0xe')](socket);function respondWithRpcPromise(_0xef045e,_0xa76502,_0x3c579b){return new BPromise(function(_0x3ba39e,_0x4563f9){return client[_0xf125('0xf')](_0xef045e,_0x3c579b)['then'](function(_0x2e0f33){logger[_0xf125('0x10')](_0xf125('0x11'),_0xa76502,_0xf125('0x12'));logger['debug'](_0xf125('0x13'),_0xa76502,_0xf125('0x12'),JSON[_0xf125('0x14')](_0x2e0f33));if(_0x2e0f33[_0xf125('0x15')]){if(_0x2e0f33[_0xf125('0x15')]['code']===0x1f4){logger['error'](_0xf125('0x11'),_0xa76502,_0x2e0f33['error'][_0xf125('0x16')]);return _0x4563f9(_0x2e0f33[_0xf125('0x15')][_0xf125('0x16')]);}logger['error'](_0xf125('0x11'),_0xa76502,_0x2e0f33[_0xf125('0x15')][_0xf125('0x16')]);return _0x3ba39e(_0x2e0f33[_0xf125('0x15')][_0xf125('0x16')]);}else{logger[_0xf125('0x10')](_0xf125('0x11'),_0xa76502,_0xf125('0x12'));_0x3ba39e(_0x2e0f33[_0xf125('0x17')][_0xf125('0x16')]);}})['catch'](function(_0x4f6827){logger[_0xf125('0x15')](_0xf125('0x11'),_0xa76502,_0x4f6827);_0x4563f9(_0x4f6827);});});}exports['GetMailQueue']=function(_0x3f861f){var _0x3178ce=this;return new Promise(function(_0x54eede,_0x8a5d6e){return db[_0xf125('0x18')]['findAll']({'raw':_0x3f861f[_0xf125('0x19')]?_0x3f861f['options'][_0xf125('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f861f['options']?_0x3f861f[_0xf125('0x19')][_0xf125('0x1b')]||null:null,'attributes':_0x3f861f[_0xf125('0x19')]?_0x3f861f[_0xf125('0x19')][_0xf125('0x1c')]||null:null,'limit':_0x3f861f[_0xf125('0x19')]?_0x3f861f[_0xf125('0x19')][_0xf125('0x1d')]||null:null,'include':_0x3f861f['options']?_0x3f861f[_0xf125('0x19')][_0xf125('0x1e')]?_[_0xf125('0x1f')](_0x3f861f[_0xf125('0x19')][_0xf125('0x1e')],function(_0x5cf79b){return{'model':db[_0x5cf79b[_0xf125('0x20')]],'as':_0x5cf79b['as'],'attributes':_0x5cf79b[_0xf125('0x1c')],'include':_0x5cf79b[_0xf125('0x1e')]?_[_0xf125('0x1f')](_0x5cf79b[_0xf125('0x1e')],function(_0x25ad22){return{'model':db[_0x25ad22['model']],'as':_0x25ad22['as'],'attributes':_0x25ad22[_0xf125('0x1c')],'include':_0x25ad22[_0xf125('0x1e')]?_[_0xf125('0x1f')](_0x25ad22['include'],function(_0x226214){return{'model':db[_0x226214[_0xf125('0x20')]],'as':_0x226214['as'],'attributes':_0x226214[_0xf125('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf125('0x21')](function(_0x4e5127){logger[_0xf125('0x10')](_0xf125('0x22'),_0x3f861f);logger[_0xf125('0x23')](_0xf125('0x22'),_0x3f861f,JSON[_0xf125('0x14')](_0x4e5127));_0x54eede(_0x4e5127);})[_0xf125('0x24')](function(_0x307919){logger['error'](_0xf125('0x22'),_0x307919[_0xf125('0x16')],_0x3f861f);_0x8a5d6e(_0x3178ce[_0xf125('0x15')](0x1f4,_0x307919['message']));});});};exports[_0xf125('0x25')]=function(_0x3b7ed3){var _0x562147=this;return new Promise(function(_0x2ef85b,_0x587502){return db[_0xf125('0x18')]['find']({'raw':_0x3b7ed3[_0xf125('0x19')]?_0x3b7ed3[_0xf125('0x19')][_0xf125('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b7ed3['options']?_0x3b7ed3[_0xf125('0x19')][_0xf125('0x1b')]||null:null,'attributes':_0x3b7ed3[_0xf125('0x19')]?_0x3b7ed3[_0xf125('0x19')][_0xf125('0x1c')]||null:null,'include':_0x3b7ed3[_0xf125('0x19')]?_0x3b7ed3[_0xf125('0x19')][_0xf125('0x1e')]?_[_0xf125('0x1f')](_0x3b7ed3['options'][_0xf125('0x1e')],function(_0x217ead){return{'model':db[_0x217ead[_0xf125('0x20')]],'as':_0x217ead['as'],'attributes':_0x217ead[_0xf125('0x1c')],'include':_0x217ead[_0xf125('0x1e')]?_[_0xf125('0x1f')](_0x217ead[_0xf125('0x1e')],function(_0x2254f5){return{'model':db[_0x2254f5[_0xf125('0x20')]],'as':_0x2254f5['as'],'attributes':_0x2254f5[_0xf125('0x1c')],'include':_0x2254f5[_0xf125('0x1e')]?_[_0xf125('0x1f')](_0x2254f5[_0xf125('0x1e')],function(_0x4c4f08){return{'model':db[_0x4c4f08['model']],'as':_0x4c4f08['as'],'attributes':_0x4c4f08[_0xf125('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf125('0x21')](function(_0x31cacb){logger[_0xf125('0x10')](_0xf125('0x25'),_0x3b7ed3);logger[_0xf125('0x23')]('ShowMailQueue',_0x3b7ed3,JSON[_0xf125('0x14')](_0x31cacb));_0x2ef85b(_0x31cacb);})[_0xf125('0x24')](function(_0x47b94b){logger[_0xf125('0x15')](_0xf125('0x25'),_0x47b94b[_0xf125('0x16')],_0x3b7ed3);_0x587502(_0x562147[_0xf125('0x15')](0x1f4,_0x47b94b[_0xf125('0x16')]));});});}; \ No newline at end of file +var _0x8039=['MailQueue','find','model','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','message','result','GetMailQueue','findAll','options','raw','where','include','map','attributes','stringify','catch','ShowMailQueue'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x8039,0x150));var _0x9803=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x8039[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0x9803('0x0'));var util=require('util');var moment=require(_0x9803('0x1'));var BPromise=require(_0x9803('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9803('0x3'));var db=require(_0x9803('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9803('0x5'));var config=require(_0x9803('0x6'));var jayson=require(_0x9803('0x7'));var client=jayson[_0x9803('0x8')][_0x9803('0x9')]({'port':0x232a});config[_0x9803('0xa')]=_[_0x9803('0xb')](config[_0x9803('0xa')],{'host':_0x9803('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9803('0xa')]));require(_0x9803('0xd'))['register'](socket);function respondWithRpcPromise(_0x1add94,_0x22562a,_0x421133){return new BPromise(function(_0x2c4be0,_0x287cf){return client['request'](_0x1add94,_0x421133)[_0x9803('0xe')](function(_0x2ddf06){logger[_0x9803('0xf')](_0x9803('0x10'),_0x22562a,_0x9803('0x11'));logger[_0x9803('0x12')](_0x9803('0x13'),_0x22562a,_0x9803('0x11'),JSON['stringify'](_0x2ddf06));if(_0x2ddf06[_0x9803('0x14')]){if(_0x2ddf06[_0x9803('0x14')]['code']===0x1f4){logger[_0x9803('0x14')](_0x9803('0x10'),_0x22562a,_0x2ddf06[_0x9803('0x14')][_0x9803('0x15')]);return _0x287cf(_0x2ddf06[_0x9803('0x14')]['message']);}logger[_0x9803('0x14')](_0x9803('0x10'),_0x22562a,_0x2ddf06[_0x9803('0x14')][_0x9803('0x15')]);return _0x2c4be0(_0x2ddf06[_0x9803('0x14')][_0x9803('0x15')]);}else{logger[_0x9803('0xf')](_0x9803('0x10'),_0x22562a,_0x9803('0x11'));_0x2c4be0(_0x2ddf06[_0x9803('0x16')][_0x9803('0x15')]);}})['catch'](function(_0xa5002){logger['error']('MailQueue,\x20%s,\x20%s',_0x22562a,_0xa5002);_0x287cf(_0xa5002);});});}exports[_0x9803('0x17')]=function(_0x106a5c){var _0xda8d3e=this;return new Promise(function(_0x5699e9,_0x22cdbc){return db['MailQueue'][_0x9803('0x18')]({'raw':_0x106a5c[_0x9803('0x19')]?_0x106a5c[_0x9803('0x19')][_0x9803('0x1a')]===undefined?!![]:![]:!![],'where':_0x106a5c[_0x9803('0x19')]?_0x106a5c[_0x9803('0x19')][_0x9803('0x1b')]||null:null,'attributes':_0x106a5c[_0x9803('0x19')]?_0x106a5c[_0x9803('0x19')]['attributes']||null:null,'limit':_0x106a5c['options']?_0x106a5c['options']['limit']||null:null,'include':_0x106a5c[_0x9803('0x19')]?_0x106a5c[_0x9803('0x19')][_0x9803('0x1c')]?_[_0x9803('0x1d')](_0x106a5c[_0x9803('0x19')]['include'],function(_0xa2fe3d){return{'model':db[_0xa2fe3d['model']],'as':_0xa2fe3d['as'],'attributes':_0xa2fe3d[_0x9803('0x1e')],'include':_0xa2fe3d['include']?_['map'](_0xa2fe3d[_0x9803('0x1c')],function(_0x2474ae){return{'model':db[_0x2474ae['model']],'as':_0x2474ae['as'],'attributes':_0x2474ae['attributes'],'include':_0x2474ae[_0x9803('0x1c')]?_[_0x9803('0x1d')](_0x2474ae[_0x9803('0x1c')],function(_0x4de79){return{'model':db[_0x4de79['model']],'as':_0x4de79['as'],'attributes':_0x4de79[_0x9803('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9803('0xe')](function(_0x22fb8a){logger['info'](_0x9803('0x17'),_0x106a5c);logger[_0x9803('0x12')](_0x9803('0x17'),_0x106a5c,JSON[_0x9803('0x1f')](_0x22fb8a));_0x5699e9(_0x22fb8a);})[_0x9803('0x20')](function(_0x5e07f7){logger[_0x9803('0x14')](_0x9803('0x17'),_0x5e07f7[_0x9803('0x15')],_0x106a5c);_0x22cdbc(_0xda8d3e[_0x9803('0x14')](0x1f4,_0x5e07f7[_0x9803('0x15')]));});});};exports[_0x9803('0x21')]=function(_0x1d5ef5){var _0x26415a=this;return new Promise(function(_0xcc55cf,_0x4c8007){return db[_0x9803('0x22')][_0x9803('0x23')]({'raw':_0x1d5ef5['options']?_0x1d5ef5[_0x9803('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1d5ef5[_0x9803('0x19')]?_0x1d5ef5['options'][_0x9803('0x1b')]||null:null,'attributes':_0x1d5ef5['options']?_0x1d5ef5['options'][_0x9803('0x1e')]||null:null,'include':_0x1d5ef5[_0x9803('0x19')]?_0x1d5ef5[_0x9803('0x19')]['include']?_[_0x9803('0x1d')](_0x1d5ef5[_0x9803('0x19')]['include'],function(_0x3ba8fb){return{'model':db[_0x3ba8fb['model']],'as':_0x3ba8fb['as'],'attributes':_0x3ba8fb[_0x9803('0x1e')],'include':_0x3ba8fb[_0x9803('0x1c')]?_['map'](_0x3ba8fb['include'],function(_0x38be24){return{'model':db[_0x38be24[_0x9803('0x24')]],'as':_0x38be24['as'],'attributes':_0x38be24['attributes'],'include':_0x38be24['include']?_[_0x9803('0x1d')](_0x38be24['include'],function(_0x2a97f0){return{'model':db[_0x2a97f0['model']],'as':_0x2a97f0['as'],'attributes':_0x2a97f0[_0x9803('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3186a3){logger[_0x9803('0xf')]('ShowMailQueue',_0x1d5ef5);logger['debug'](_0x9803('0x21'),_0x1d5ef5,JSON[_0x9803('0x1f')](_0x3186a3));_0xcc55cf(_0x3186a3);})[_0x9803('0x20')](function(_0x1b34e6){logger[_0x9803('0x14')]('ShowMailQueue',_0x1b34e6[_0x9803('0x15')],_0x1d5ef5);_0x4c8007(_0x26415a[_0x9803('0x14')](0x1f4,_0x1b34e6[_0x9803('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 4881275..437bf3c 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 _0xe3e6=['remove','update','emit','removeListener','length','./mailQueue.events','save'];(function(_0x1d000a,_0x477985){var _0x1d19ce=function(_0x358cbc){while(--_0x358cbc){_0x1d000a['push'](_0x1d000a['shift']());}};_0x1d19ce(++_0x477985);}(_0xe3e6,0x139));var _0x6e3e=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xe3e6[_0x4dcc2d];return _0x1bbd79;};'use strict';var MailQueueEvents=require(_0x6e3e('0x0'));var events=[_0x6e3e('0x1'),_0x6e3e('0x2'),_0x6e3e('0x3')];function createListener(_0x348a6a,_0x6a600b){return function(_0x487451){_0x6a600b[_0x6e3e('0x4')](_0x348a6a,_0x487451);};}function removeListener(_0x5a744c,_0x224708){return function(){MailQueueEvents[_0x6e3e('0x5')](_0x5a744c,_0x224708);};}exports['register']=function(_0x394205){for(var _0x55eb60=0x0,_0x26773c=events[_0x6e3e('0x6')];_0x55eb60<_0x26773c;_0x55eb60++){var _0x503b72=events[_0x55eb60];var _0x5353fe=createListener('mailQueue:'+_0x503b72,_0x394205);MailQueueEvents['on'](_0x503b72,_0x5353fe);}}; \ No newline at end of file +var _0x9b93=['update','removeListener','./mailQueue.events','remove'];(function(_0x415395,_0x4babd1){var _0x4c90a2=function(_0x25463d){while(--_0x25463d){_0x415395['push'](_0x415395['shift']());}};_0x4c90a2(++_0x4babd1);}(_0x9b93,0x1c2));var _0x39b9=function(_0x3fa933,_0x190a6d){_0x3fa933=_0x3fa933-0x0;var _0x52846d=_0x9b93[_0x3fa933];return _0x52846d;};'use strict';var MailQueueEvents=require(_0x39b9('0x0'));var events=['save',_0x39b9('0x1'),_0x39b9('0x2')];function createListener(_0x2998ae,_0x3f0064){return function(_0x1c6592){_0x3f0064['emit'](_0x2998ae,_0x1c6592);};}function removeListener(_0x5d759b,_0x6adebb){return function(){MailQueueEvents[_0x39b9('0x3')](_0x5d759b,_0x6adebb);};}exports['register']=function(_0x858d76){for(var _0x575280=0x0,_0x7ee275=events['length'];_0x575280<_0x7ee275;_0x575280++){var _0x15a617=events[_0x575280];var _0x50771f=createListener('mailQueue:'+_0x15a617,_0x858d76);MailQueueEvents['on'](_0x15a617,_0x50771f);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 4307d85..cc0893e 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 _0xc964=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','exports'];(function(_0x353203,_0x1df104){var _0x572d47=function(_0x128120){while(--_0x128120){_0x353203['push'](_0x353203['shift']());}};_0x572d47(++_0x1df104);}(_0xc964,0x7e));var _0x4c96=function(_0x3d441e,_0x1b8837){_0x3d441e=_0x3d441e-0x0;var _0x300d7e=_0xc964[_0x3d441e];return _0x300d7e;};'use strict';var multer=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var path=require('path');var timeout=require(_0x4c96('0x2'));var express=require(_0x4c96('0x3'));var router=express[_0x4c96('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4c96('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4c96('0x6'));var controller=require(_0x4c96('0x7'));router[_0x4c96('0x8')]('/',auth[_0x4c96('0x9')](),controller[_0x4c96('0xa')]);router[_0x4c96('0x8')](_0x4c96('0xb'),auth['isAuthenticated'](),controller[_0x4c96('0xc')]);router[_0x4c96('0x8')](_0x4c96('0xd'),auth['isAuthenticated'](),controller[_0x4c96('0xe')]);router[_0x4c96('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4c96('0xd'),auth[_0x4c96('0x9')](),controller[_0x4c96('0x10')]);router['delete'](_0x4c96('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x4c96('0x11')]=router; \ No newline at end of file +var _0x01fe=['index','/describe','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x76d02c,_0x202df1){var _0x25cc97=function(_0x4f1fe1){while(--_0x4f1fe1){_0x76d02c['push'](_0x76d02c['shift']());}};_0x25cc97(++_0x202df1);}(_0x01fe,0x102));var _0xe01f=function(_0x168847,_0x168dca){_0x168847=_0x168847-0x0;var _0x34fd4d=_0x01fe[_0x168847];return _0x34fd4d;};'use strict';var multer=require(_0xe01f('0x0'));var util=require('util');var path=require(_0xe01f('0x1'));var timeout=require(_0xe01f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe01f('0x3'));var auth=require(_0xe01f('0x4'));var interaction=require(_0xe01f('0x5'));var config=require(_0xe01f('0x6'));var controller=require('./mailQueueReport.controller');router[_0xe01f('0x7')]('/',auth['isAuthenticated'](),controller[_0xe01f('0x8')]);router[_0xe01f('0x7')](_0xe01f('0x9'),auth[_0xe01f('0xa')](),controller[_0xe01f('0xb')]);router['get'](_0xe01f('0xc'),auth[_0xe01f('0xa')](),controller['show']);router[_0xe01f('0xd')]('/',auth['isAuthenticated'](),controller[_0xe01f('0xe')]);router[_0xe01f('0xf')]('/:id',auth[_0xe01f('0xa')](),controller['update']);router[_0xe01f('0x10')](_0xe01f('0xc'),auth[_0xe01f('0xa')](),controller[_0xe01f('0x11')]);module[_0xe01f('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 87cc80d..4e58666 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 _0x8e53=['moment','sequelize','exports','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e53,0x1e0));var _0x38e5=function(_0x34f8e5,_0x278902){_0x34f8e5=_0x34f8e5-0x0;var _0x3deca8=_0x8e53[_0x34f8e5];return _0x3deca8;};'use strict';var moment=require(_0x38e5('0x0'));var Sequelize=require(_0x38e5('0x1'));module[_0x38e5('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x38e5('0x3')]},'joinAt':{'type':Sequelize[_0x38e5('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x38e5('0x4')]},'reason':{'type':Sequelize[_0x38e5('0x3')]}}; \ No newline at end of file +var _0x2d6a=['moment','exports','STRING','DATE'];(function(_0x4cc7c8,_0x50800a){var _0x2c18eb=function(_0x18d54c){while(--_0x18d54c){_0x4cc7c8['push'](_0x4cc7c8['shift']());}};_0x2c18eb(++_0x50800a);}(_0x2d6a,0xbc));var _0xa2d6=function(_0x56229c,_0x16d4b1){_0x56229c=_0x56229c-0x0;var _0xdaab18=_0x2d6a[_0x56229c];return _0xdaab18;};'use strict';var moment=require(_0xa2d6('0x0'));var Sequelize=require('sequelize');module[_0xa2d6('0x1')]={'uniqueid':{'type':Sequelize[_0xa2d6('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa2d6('0x2')]},'joinAt':{'type':Sequelize[_0xa2d6('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa2d6('0x3')]},'exitAt':{'type':Sequelize[_0xa2d6('0x3')]},'reason':{'type':Sequelize[_0xa2d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 2512d2c..6ee0454 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 _0xd739=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','length','find','catch','body','update','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x344de6,_0x3a858b){var _0x31380=function(_0x51c524){while(--_0x51c524){_0x344de6['push'](_0x344de6['shift']());}};_0x31380(++_0x3a858b);}(_0xd739,0x116));var _0x9d73=function(_0x20e284,_0x2af0ab){_0x20e284=_0x20e284-0x0;var _0x4b8e5e=_0xd739[_0x20e284];return _0x4b8e5e;};'use strict';var pdf=require(_0x9d73('0x0'));var emlformat=require(_0x9d73('0x1'));var rimraf=require(_0x9d73('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d73('0x3'));var moment=require(_0x9d73('0x4'));var BPromise=require(_0x9d73('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9d73('0x6'));var sox=require(_0x9d73('0x7'));var csv=require(_0x9d73('0x8'));var ejs=require(_0x9d73('0x9'));var fs=require('fs');var fs_extra=require(_0x9d73('0xa'));var _=require(_0x9d73('0xb'));var squel=require('squel');var crypto=require(_0x9d73('0xc'));var jsforce=require(_0x9d73('0xd'));var deskjs=require(_0x9d73('0xe'));var toCsv=require(_0x9d73('0x8'));var querystring=require(_0x9d73('0xf'));var Papa=require(_0x9d73('0x10'));var Redis=require('ioredis');var authService=require(_0x9d73('0x11'));var qs=require(_0x9d73('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d73('0x13'));var logger=require(_0x9d73('0x14'))(_0x9d73('0x15'));var utils=require(_0x9d73('0x16'));var config=require(_0x9d73('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d73('0x18'))['db'];function respondWithStatusCode(_0x1f0371,_0xcb114d){_0xcb114d=_0xcb114d||0xcc;return function(_0x47b610){if(_0x47b610){return _0x1f0371['sendStatus'](_0xcb114d);}return _0x1f0371[_0x9d73('0x19')](_0xcb114d)['end']();};}function respondWithResult(_0x42da76,_0x5b9abf){_0x5b9abf=_0x5b9abf||0xc8;return function(_0x8a2d73){if(_0x8a2d73){return _0x42da76[_0x9d73('0x19')](_0x5b9abf)[_0x9d73('0x1a')](_0x8a2d73);}};}function respondWithFilteredResult(_0x59de9c,_0x5cb9d2){return function(_0x4d7513){if(_0x4d7513){var _0x5755a4=_0x4d7513[_0x9d73('0x1b')],_0x403b12=_0x5cb9d2[_0x9d73('0x1c')],_0x590107=_0x5cb9d2['offset']+_0x5cb9d2['limit'],_0x500b3e;if(_0x590107>=_0x5755a4){_0x590107=_0x5755a4;_0x500b3e=0xc8;}else{_0x500b3e=0xce;}_0x59de9c[_0x9d73('0x19')](_0x500b3e);return _0x59de9c['set'](_0x9d73('0x1d'),_0x403b12+'-'+_0x590107+'/'+_0x5755a4)['json'](_0x4d7513);}return null;};}function patchUpdates(_0x70358b){return function(_0xe4e051){try{jsonpatch[_0x9d73('0x1e')](_0xe4e051,_0x70358b,!![]);}catch(_0xf8e38d){return BPromise[_0x9d73('0x1f')](_0xf8e38d);}return _0xe4e051[_0x9d73('0x20')]();};}function saveUpdates(_0x301890,_0x466e67){return function(_0x967838){if(_0x967838){return _0x967838['update'](_0x301890)[_0x9d73('0x21')](function(_0x59d401){return _0x59d401;});}return null;};}function removeEntity(_0x442f8d,_0x3e6618){return function(_0x6f2628){if(_0x6f2628){return _0x6f2628[_0x9d73('0x22')]()[_0x9d73('0x21')](function(){_0x442f8d[_0x9d73('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5314da,_0x3dbd81){return function(_0x357322){if(!_0x357322){_0x5314da['sendStatus'](0x194);}return _0x357322;};}function handleError(_0x50e531,_0x550c37){_0x550c37=_0x550c37||0x1f4;return function(_0x3677fb){logger[_0x9d73('0x23')](_0x3677fb[_0x9d73('0x24')]);if(_0x3677fb[_0x9d73('0x25')]){delete _0x3677fb[_0x9d73('0x25')];}_0x50e531[_0x9d73('0x19')](_0x550c37)[_0x9d73('0x26')](_0x3677fb);};}exports[_0x9d73('0x27')]=function(_0xcb3f3d,_0x5f3dcb){var _0x271d22={},_0x3f5214={},_0x5504e5={'count':0x0,'rows':[]};var _0x359a6e=_[_0x9d73('0x28')](db[_0x9d73('0x29')][_0x9d73('0x2a')],function(_0x11938c){return{'name':_0x11938c['fieldName'],'type':_0x11938c[_0x9d73('0x2b')][_0x9d73('0x2c')]};});_0x3f5214['model']=_['map'](_0x359a6e,_0x9d73('0x25'));_0x3f5214[_0x9d73('0x2d')]=_[_0x9d73('0x2e')](_0xcb3f3d[_0x9d73('0x2d')]);_0x3f5214[_0x9d73('0x2f')]=_['intersection'](_0x3f5214[_0x9d73('0x30')],_0x3f5214['query']);_0x271d22[_0x9d73('0x31')]=_[_0x9d73('0x32')](_0x3f5214[_0x9d73('0x30')],qs[_0x9d73('0x33')](_0xcb3f3d[_0x9d73('0x2d')][_0x9d73('0x33')]));_0x271d22[_0x9d73('0x31')]=_0x271d22[_0x9d73('0x31')]['length']?_0x271d22[_0x9d73('0x31')]:_0x3f5214[_0x9d73('0x30')];if(!_0xcb3f3d[_0x9d73('0x2d')][_0x9d73('0x34')](_0x9d73('0x35'))){_0x271d22['limit']=qs[_0x9d73('0x36')](_0xcb3f3d[_0x9d73('0x2d')][_0x9d73('0x36')]);_0x271d22[_0x9d73('0x1c')]=qs['offset'](_0xcb3f3d['query']['offset']);}_0x271d22['order']=qs[_0x9d73('0x37')](_0xcb3f3d['query']['sort']);_0x271d22[_0x9d73('0x38')]=qs[_0x9d73('0x2f')](_[_0x9d73('0x39')](_0xcb3f3d[_0x9d73('0x2d')],_0x3f5214['filters']),_0x359a6e);if(_0xcb3f3d[_0x9d73('0x2d')][_0x9d73('0x3a')]){_0x271d22[_0x9d73('0x38')]=_['merge'](_0x271d22['where'],{'$or':_[_0x9d73('0x28')](_0x359a6e,function(_0x77da98){if(_0x77da98[_0x9d73('0x2b')]!==_0x9d73('0x3b')){var _0x203ecc={};_0x203ecc[_0x77da98[_0x9d73('0x25')]]={'$like':'%'+_0xcb3f3d[_0x9d73('0x2d')][_0x9d73('0x3a')]+'%'};return _0x203ecc;}})});}_0x271d22=_[_0x9d73('0x3c')]({},_0x271d22,_0xcb3f3d[_0x9d73('0x3d')]);var _0x4ad6d8={'where':_0x271d22['where']};return db['MailQueueReport']['count'](_0x4ad6d8)[_0x9d73('0x21')](function(_0x42ceab){_0x5504e5[_0x9d73('0x1b')]=_0x42ceab;if(_0xcb3f3d['query'][_0x9d73('0x3e')]){_0x271d22['include']=[{'all':!![]}];}return db[_0x9d73('0x29')][_0x9d73('0x3f')](_0x271d22);})['then'](function(_0xa13477){_0x5504e5[_0x9d73('0x40')]=_0xa13477;return _0x5504e5;})[_0x9d73('0x21')](respondWithFilteredResult(_0x5f3dcb,_0x271d22))['catch'](handleError(_0x5f3dcb,null));};exports[_0x9d73('0x41')]=function(_0x46c3e7,_0x892ceb){var _0x5d9781={'raw':!![],'where':{'id':_0x46c3e7[_0x9d73('0x42')]['id']}},_0x1218d0={};_0x1218d0[_0x9d73('0x30')]=_['keys'](db[_0x9d73('0x29')]['rawAttributes']);_0x1218d0[_0x9d73('0x2d')]=_[_0x9d73('0x2e')](_0x46c3e7[_0x9d73('0x2d')]);_0x1218d0['filters']=_[_0x9d73('0x32')](_0x1218d0[_0x9d73('0x30')],_0x1218d0[_0x9d73('0x2d')]);_0x5d9781[_0x9d73('0x31')]=_[_0x9d73('0x32')](_0x1218d0[_0x9d73('0x30')],qs[_0x9d73('0x33')](_0x46c3e7[_0x9d73('0x2d')][_0x9d73('0x33')]));_0x5d9781[_0x9d73('0x31')]=_0x5d9781['attributes'][_0x9d73('0x43')]?_0x5d9781[_0x9d73('0x31')]:_0x1218d0[_0x9d73('0x30')];if(_0x46c3e7[_0x9d73('0x2d')][_0x9d73('0x3e')]){_0x5d9781['include']=[{'all':!![]}];}_0x5d9781=_[_0x9d73('0x3c')]({},_0x5d9781,_0x46c3e7['options']);return db[_0x9d73('0x29')][_0x9d73('0x44')](_0x5d9781)[_0x9d73('0x21')](handleEntityNotFound(_0x892ceb,null))[_0x9d73('0x21')](respondWithResult(_0x892ceb,null))[_0x9d73('0x45')](handleError(_0x892ceb,null));};exports['create']=function(_0x238a01,_0x5d0b7a){return db[_0x9d73('0x29')]['create'](_0x238a01[_0x9d73('0x46')],{})[_0x9d73('0x21')](respondWithResult(_0x5d0b7a,0xc9))[_0x9d73('0x45')](handleError(_0x5d0b7a,null));};exports[_0x9d73('0x47')]=function(_0x5b6b42,_0x398c46){if(_0x5b6b42['body']['id']){delete _0x5b6b42[_0x9d73('0x46')]['id'];}return db[_0x9d73('0x29')][_0x9d73('0x44')]({'where':{'id':_0x5b6b42[_0x9d73('0x42')]['id']}})['then'](handleEntityNotFound(_0x398c46,null))[_0x9d73('0x21')](saveUpdates(_0x5b6b42[_0x9d73('0x46')],null))[_0x9d73('0x21')](respondWithResult(_0x398c46,null))[_0x9d73('0x45')](handleError(_0x398c46,null));};exports[_0x9d73('0x22')]=function(_0x3aa903,_0x588dd0){return db[_0x9d73('0x29')][_0x9d73('0x44')]({'where':{'id':_0x3aa903[_0x9d73('0x42')]['id']}})['then'](handleEntityNotFound(_0x588dd0,null))[_0x9d73('0x21')](removeEntity(_0x588dd0,null))['catch'](handleError(_0x588dd0,null));};exports[_0x9d73('0x48')]=function(_0x5c32c5,_0x3cd617){return db[_0x9d73('0x29')][_0x9d73('0x48')]()[_0x9d73('0x21')](respondWithResult(_0x3cd617,null))[_0x9d73('0x45')](handleError(_0x3cd617,null));}; \ No newline at end of file +var _0xdd6a=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','keys','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x387dc1,_0x3ba649){var _0x17567c=function(_0x4690aa){while(--_0x4690aa){_0x387dc1['push'](_0x387dc1['shift']());}};_0x17567c(++_0x3ba649);}(_0xdd6a,0x15d));var _0xadd6=function(_0x5e1aa5,_0x35d6e9){_0x5e1aa5=_0x5e1aa5-0x0;var _0x2c4704=_0xdd6a[_0x5e1aa5];return _0x2c4704;};'use strict';var pdf=require(_0xadd6('0x0'));var emlformat=require(_0xadd6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xadd6('0x2'));var jsonpatch=require(_0xadd6('0x3'));var rp=require(_0xadd6('0x4'));var moment=require(_0xadd6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xadd6('0x6'));var util=require(_0xadd6('0x7'));var path=require(_0xadd6('0x8'));var sox=require(_0xadd6('0x9'));var csv=require(_0xadd6('0xa'));var ejs=require(_0xadd6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xadd6('0xc'));var squel=require('squel');var crypto=require(_0xadd6('0xd'));var jsforce=require(_0xadd6('0xe'));var deskjs=require(_0xadd6('0xf'));var toCsv=require('to-csv');var querystring=require(_0xadd6('0x10'));var Papa=require('papaparse');var Redis=require(_0xadd6('0x11'));var authService=require(_0xadd6('0x12'));var qs=require(_0xadd6('0x13'));var as=require(_0xadd6('0x14'));var hardwareService=require(_0xadd6('0x15'));var logger=require(_0xadd6('0x16'))('api');var utils=require(_0xadd6('0x17'));var config=require(_0xadd6('0x18'));var licenseUtil=require(_0xadd6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x555790,_0x525c5d){_0x525c5d=_0x525c5d||0xcc;return function(_0x53c8c5){if(_0x53c8c5){return _0x555790['sendStatus'](_0x525c5d);}return _0x555790[_0xadd6('0x1a')](_0x525c5d)[_0xadd6('0x1b')]();};}function respondWithResult(_0x2437eb,_0x132c4d){_0x132c4d=_0x132c4d||0xc8;return function(_0x5be9e0){if(_0x5be9e0){return _0x2437eb[_0xadd6('0x1a')](_0x132c4d)['json'](_0x5be9e0);}};}function respondWithFilteredResult(_0x22efe5,_0x397c2c){return function(_0x54ee9b){if(_0x54ee9b){var _0x274a71=_0x54ee9b['count'],_0x5a3577=_0x397c2c[_0xadd6('0x1c')],_0xd17027=_0x397c2c[_0xadd6('0x1c')]+_0x397c2c[_0xadd6('0x1d')],_0x5e0a4d;if(_0xd17027>=_0x274a71){_0xd17027=_0x274a71;_0x5e0a4d=0xc8;}else{_0x5e0a4d=0xce;}_0x22efe5[_0xadd6('0x1a')](_0x5e0a4d);return _0x22efe5['set'](_0xadd6('0x1e'),_0x5a3577+'-'+_0xd17027+'/'+_0x274a71)[_0xadd6('0x1f')](_0x54ee9b);}return null;};}function patchUpdates(_0x536fd3){return function(_0x329644){try{jsonpatch['apply'](_0x329644,_0x536fd3,!![]);}catch(_0x12f3cc){return BPromise[_0xadd6('0x20')](_0x12f3cc);}return _0x329644[_0xadd6('0x21')]();};}function saveUpdates(_0x381b06,_0x5797a4){return function(_0x35bb79){if(_0x35bb79){return _0x35bb79[_0xadd6('0x22')](_0x381b06)[_0xadd6('0x23')](function(_0x3a4686){return _0x3a4686;});}return null;};}function removeEntity(_0x1d08fc,_0x46ab76){return function(_0x12f519){if(_0x12f519){return _0x12f519[_0xadd6('0x24')]()[_0xadd6('0x23')](function(){_0x1d08fc[_0xadd6('0x1a')](0xcc)[_0xadd6('0x1b')]();});}};}function handleEntityNotFound(_0x618ad7,_0x2855ea){return function(_0xbb72d5){if(!_0xbb72d5){_0x618ad7[_0xadd6('0x25')](0x194);}return _0xbb72d5;};}function handleError(_0x4b3e97,_0x449151){_0x449151=_0x449151||0x1f4;return function(_0x30f192){logger[_0xadd6('0x26')](_0x30f192['stack']);if(_0x30f192[_0xadd6('0x27')]){delete _0x30f192[_0xadd6('0x27')];}_0x4b3e97[_0xadd6('0x1a')](_0x449151)[_0xadd6('0x28')](_0x30f192);};}exports[_0xadd6('0x29')]=function(_0xc27112,_0x251dec){var _0x4d4ef0={},_0x39a3f7={},_0xc16c2e={'count':0x0,'rows':[]};var _0x3577fa=_[_0xadd6('0x2a')](db[_0xadd6('0x2b')][_0xadd6('0x2c')],function(_0x3135eb){return{'name':_0x3135eb[_0xadd6('0x2d')],'type':_0x3135eb[_0xadd6('0x2e')][_0xadd6('0x2f')]};});_0x39a3f7[_0xadd6('0x30')]=_[_0xadd6('0x2a')](_0x3577fa,_0xadd6('0x27'));_0x39a3f7['query']=_['keys'](_0xc27112['query']);_0x39a3f7['filters']=_['intersection'](_0x39a3f7[_0xadd6('0x30')],_0x39a3f7[_0xadd6('0x31')]);_0x4d4ef0[_0xadd6('0x32')]=_[_0xadd6('0x33')](_0x39a3f7[_0xadd6('0x30')],qs[_0xadd6('0x34')](_0xc27112['query']['fields']));_0x4d4ef0[_0xadd6('0x32')]=_0x4d4ef0['attributes'][_0xadd6('0x35')]?_0x4d4ef0[_0xadd6('0x32')]:_0x39a3f7[_0xadd6('0x30')];if(!_0xc27112['query'][_0xadd6('0x36')](_0xadd6('0x37'))){_0x4d4ef0[_0xadd6('0x1d')]=qs[_0xadd6('0x1d')](_0xc27112[_0xadd6('0x31')]['limit']);_0x4d4ef0[_0xadd6('0x1c')]=qs[_0xadd6('0x1c')](_0xc27112[_0xadd6('0x31')][_0xadd6('0x1c')]);}_0x4d4ef0[_0xadd6('0x38')]=qs[_0xadd6('0x39')](_0xc27112[_0xadd6('0x31')][_0xadd6('0x39')]);_0x4d4ef0[_0xadd6('0x3a')]=qs['filters'](_['pick'](_0xc27112['query'],_0x39a3f7['filters']),_0x3577fa);if(_0xc27112[_0xadd6('0x31')][_0xadd6('0x3b')]){_0x4d4ef0['where']=_[_0xadd6('0x3c')](_0x4d4ef0[_0xadd6('0x3a')],{'$or':_[_0xadd6('0x2a')](_0x3577fa,function(_0x58aab3){if(_0x58aab3[_0xadd6('0x2e')]!==_0xadd6('0x3d')){var _0x1947bb={};_0x1947bb[_0x58aab3[_0xadd6('0x27')]]={'$like':'%'+_0xc27112[_0xadd6('0x31')][_0xadd6('0x3b')]+'%'};return _0x1947bb;}})});}_0x4d4ef0=_[_0xadd6('0x3c')]({},_0x4d4ef0,_0xc27112[_0xadd6('0x3e')]);var _0xe08e4f={'where':_0x4d4ef0[_0xadd6('0x3a')]};return db[_0xadd6('0x2b')][_0xadd6('0x3f')](_0xe08e4f)[_0xadd6('0x23')](function(_0x5b4568){_0xc16c2e['count']=_0x5b4568;if(_0xc27112[_0xadd6('0x31')][_0xadd6('0x40')]){_0x4d4ef0[_0xadd6('0x41')]=[{'all':!![]}];}return db[_0xadd6('0x2b')]['findAll'](_0x4d4ef0);})[_0xadd6('0x23')](function(_0x24c4b3){_0xc16c2e[_0xadd6('0x42')]=_0x24c4b3;return _0xc16c2e;})[_0xadd6('0x23')](respondWithFilteredResult(_0x251dec,_0x4d4ef0))[_0xadd6('0x43')](handleError(_0x251dec,null));};exports[_0xadd6('0x44')]=function(_0x3450fc,_0x4e4236){var _0x85a601={'raw':!![],'where':{'id':_0x3450fc[_0xadd6('0x45')]['id']}},_0x58be6e={};_0x58be6e[_0xadd6('0x30')]=_[_0xadd6('0x46')](db['MailQueueReport'][_0xadd6('0x2c')]);_0x58be6e[_0xadd6('0x31')]=_['keys'](_0x3450fc['query']);_0x58be6e['filters']=_[_0xadd6('0x33')](_0x58be6e[_0xadd6('0x30')],_0x58be6e[_0xadd6('0x31')]);_0x85a601[_0xadd6('0x32')]=_[_0xadd6('0x33')](_0x58be6e['model'],qs[_0xadd6('0x34')](_0x3450fc[_0xadd6('0x31')][_0xadd6('0x34')]));_0x85a601['attributes']=_0x85a601[_0xadd6('0x32')]['length']?_0x85a601['attributes']:_0x58be6e[_0xadd6('0x30')];if(_0x3450fc[_0xadd6('0x31')][_0xadd6('0x40')]){_0x85a601[_0xadd6('0x41')]=[{'all':!![]}];}_0x85a601=_[_0xadd6('0x3c')]({},_0x85a601,_0x3450fc['options']);return db[_0xadd6('0x2b')]['find'](_0x85a601)[_0xadd6('0x23')](handleEntityNotFound(_0x4e4236,null))[_0xadd6('0x23')](respondWithResult(_0x4e4236,null))[_0xadd6('0x43')](handleError(_0x4e4236,null));};exports['create']=function(_0x9699ff,_0x40a18e){return db[_0xadd6('0x2b')][_0xadd6('0x47')](_0x9699ff[_0xadd6('0x48')],{})[_0xadd6('0x23')](respondWithResult(_0x40a18e,0xc9))[_0xadd6('0x43')](handleError(_0x40a18e,null));};exports['update']=function(_0x45683d,_0x315bf5){if(_0x45683d[_0xadd6('0x48')]['id']){delete _0x45683d[_0xadd6('0x48')]['id'];}return db[_0xadd6('0x2b')]['find']({'where':{'id':_0x45683d['params']['id']}})[_0xadd6('0x23')](handleEntityNotFound(_0x315bf5,null))[_0xadd6('0x23')](saveUpdates(_0x45683d['body'],null))[_0xadd6('0x23')](respondWithResult(_0x315bf5,null))[_0xadd6('0x43')](handleError(_0x315bf5,null));};exports[_0xadd6('0x24')]=function(_0x31716c,_0x4d4dae){return db['MailQueueReport'][_0xadd6('0x49')]({'where':{'id':_0x31716c[_0xadd6('0x45')]['id']}})[_0xadd6('0x23')](handleEntityNotFound(_0x4d4dae,null))[_0xadd6('0x23')](removeEntity(_0x4d4dae,null))['catch'](handleError(_0x4d4dae,null));};exports['describe']=function(_0x2a9cb9,_0xcbe495){return db[_0xadd6('0x2b')]['describe']()[_0xadd6('0x23')](respondWithResult(_0xcbe495,null))[_0xadd6('0x43')](handleError(_0xcbe495,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index d7223a2..668638a 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 _0xbd9b=['bluebird','request-promise','rimraf','../../config/environment','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xbd9b,0x1dd));var _0xbbd9=function(_0x46f1b5,_0x3f96a4){_0x46f1b5=_0x46f1b5-0x0;var _0x505c69=_0xbd9b[_0x46f1b5];return _0x505c69;};'use strict';var _=require(_0xbbd9('0x0'));var util=require(_0xbbd9('0x1'));var logger=require(_0xbbd9('0x2'))('api');var moment=require(_0xbbd9('0x3'));var BPromise=require(_0xbbd9('0x4'));var rp=require(_0xbbd9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbbd9('0x6'));var config=require(_0xbbd9('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0xbbd9('0x8')]=function(_0x31ce6a,_0x29f997){return _0x31ce6a[_0xbbd9('0x9')](_0xbbd9('0xa'),attributes,{'tableName':_0xbbd9('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbbd9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd999=['report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','./mailQueueReport.attributes','define','MailQueueReport'];(function(_0x1fc4ce,_0xcaf42a){var _0x21cc64=function(_0x1de152){while(--_0x1de152){_0x1fc4ce['push'](_0x1fc4ce['shift']());}};_0x21cc64(++_0xcaf42a);}(_0xd999,0x122));var _0x9d99=function(_0x79ef34,_0x42d1a1){_0x79ef34=_0x79ef34-0x0;var _0x43d708=_0xd999[_0x79ef34];return _0x43d708;};'use strict';var _=require(_0x9d99('0x0'));var util=require(_0x9d99('0x1'));var logger=require(_0x9d99('0x2'))(_0x9d99('0x3'));var moment=require(_0x9d99('0x4'));var BPromise=require('bluebird');var rp=require(_0x9d99('0x5'));var fs=require('fs');var path=require(_0x9d99('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9d99('0x7'));module['exports']=function(_0x4baa13,_0x3d2378){return _0x4baa13[_0x9d99('0x8')](_0x9d99('0x9'),attributes,{'tableName':_0x9d99('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9d99('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 2607523..a8c38c5 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 _0xd348=['error','code','message','result','catch','CreateMailQueueReport','create','body','options','raw','UpdateMailQueueReport','MailQueueReport','update','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd348,0xce));var _0x8d34=function(_0x52565f,_0x27637e){_0x52565f=_0x52565f-0x0;var _0x53b9e9=_0xd348[_0x52565f];return _0x53b9e9;};'use strict';var _=require(_0x8d34('0x0'));var util=require(_0x8d34('0x1'));var moment=require('moment');var BPromise=require(_0x8d34('0x2'));var rs=require(_0x8d34('0x3'));var fs=require('fs');var Redis=require(_0x8d34('0x4'));var db=require(_0x8d34('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d34('0x6'))(_0x8d34('0x7'));var config=require(_0x8d34('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8d34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xeacd0f,_0xae9dca,_0x2bcac9){return new BPromise(function(_0x308ab9,_0x4baead){return client[_0x8d34('0xa')](_0xeacd0f,_0x2bcac9)[_0x8d34('0xb')](function(_0x2e32ff){logger[_0x8d34('0xc')](_0x8d34('0xd'),_0xae9dca,_0x8d34('0xe'));logger[_0x8d34('0xf')](_0x8d34('0x10'),_0xae9dca,_0x8d34('0xe'),JSON[_0x8d34('0x11')](_0x2e32ff));if(_0x2e32ff[_0x8d34('0x12')]){if(_0x2e32ff[_0x8d34('0x12')][_0x8d34('0x13')]===0x1f4){logger[_0x8d34('0x12')](_0x8d34('0xd'),_0xae9dca,_0x2e32ff[_0x8d34('0x12')][_0x8d34('0x14')]);return _0x4baead(_0x2e32ff[_0x8d34('0x12')][_0x8d34('0x14')]);}logger[_0x8d34('0x12')](_0x8d34('0xd'),_0xae9dca,_0x2e32ff['error'][_0x8d34('0x14')]);return _0x308ab9(_0x2e32ff[_0x8d34('0x12')][_0x8d34('0x14')]);}else{logger[_0x8d34('0xc')](_0x8d34('0xd'),_0xae9dca,_0x8d34('0xe'));_0x308ab9(_0x2e32ff[_0x8d34('0x15')]['message']);}})[_0x8d34('0x16')](function(_0x2465d6){logger[_0x8d34('0x12')]('MailQueueReport,\x20%s,\x20%s',_0xae9dca,_0x2465d6);_0x4baead(_0x2465d6);});});}exports[_0x8d34('0x17')]=function(_0x4982b5){var _0x31dc2b=this;return new Promise(function(_0x549908,_0x2caf64){return db['MailQueueReport'][_0x8d34('0x18')](_0x4982b5[_0x8d34('0x19')],{'raw':_0x4982b5[_0x8d34('0x1a')]?_0x4982b5['options'][_0x8d34('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3f1986){logger[_0x8d34('0xc')](_0x8d34('0x17'),_0x4982b5);logger[_0x8d34('0xf')](_0x8d34('0x17'),_0x4982b5,JSON['stringify'](_0x3f1986));_0x549908(_0x3f1986);})[_0x8d34('0x16')](function(_0x48a080){logger['error'](_0x8d34('0x17'),_0x48a080[_0x8d34('0x14')],_0x4982b5);_0x2caf64(_0x31dc2b[_0x8d34('0x12')](0x1f4,_0x48a080[_0x8d34('0x14')]));});});};exports[_0x8d34('0x1c')]=function(_0x31455e){var _0x4718e9=this;return new Promise(function(_0x5572b0,_0x59fade){return db[_0x8d34('0x1d')][_0x8d34('0x1e')](_0x31455e[_0x8d34('0x19')],{'raw':_0x31455e[_0x8d34('0x1a')]?_0x31455e[_0x8d34('0x1a')][_0x8d34('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31455e[_0x8d34('0x1a')]?_0x31455e[_0x8d34('0x1a')]['where']||null:null,'attributes':_0x31455e['options']?_0x31455e['options']['attributes']||null:null,'limit':_0x31455e['options']?_0x31455e[_0x8d34('0x1a')][_0x8d34('0x1f')]||null:null})[_0x8d34('0xb')](function(_0x5a17b5){logger[_0x8d34('0xc')]('UpdateMailQueueReport',_0x31455e);logger[_0x8d34('0xf')](_0x8d34('0x1c'),_0x31455e,JSON[_0x8d34('0x11')](_0x5a17b5));_0x5572b0(_0x5a17b5);})[_0x8d34('0x16')](function(_0x4afbb3){logger[_0x8d34('0x12')](_0x8d34('0x1c'),_0x4afbb3[_0x8d34('0x14')],_0x31455e);_0x59fade(_0x4718e9['error'](0x1f4,_0x4afbb3['message']));});});}; \ No newline at end of file +var _0xa357=['info','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','MailQueueReport,\x20%s,\x20%s','message','result','catch','CreateMailQueueReport','MailQueueReport','create','body','then','debug','update','options','raw','limit','UpdateMailQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4dd657,_0x193e9e){var _0x301553=function(_0x2233c7){while(--_0x2233c7){_0x4dd657['push'](_0x4dd657['shift']());}};_0x301553(++_0x193e9e);}(_0xa357,0xda));var _0x7a35=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0xa357[_0x421263];return _0x34e4b5;};'use strict';var _=require(_0x7a35('0x0'));var util=require(_0x7a35('0x1'));var moment=require(_0x7a35('0x2'));var BPromise=require(_0x7a35('0x3'));var rs=require(_0x7a35('0x4'));var fs=require('fs');var Redis=require(_0x7a35('0x5'));var db=require(_0x7a35('0x6'))['db'];var utils=require(_0x7a35('0x7'));var logger=require('../../config/logger')(_0x7a35('0x8'));var config=require(_0x7a35('0x9'));var jayson=require(_0x7a35('0xa'));var client=jayson[_0x7a35('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c14fe,_0x1be7c8,_0x100e10){return new BPromise(function(_0x4f73a2,_0x43b12c){return client[_0x7a35('0xc')](_0x5c14fe,_0x100e10)['then'](function(_0xa4dc31){logger[_0x7a35('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x1be7c8,_0x7a35('0xe'));logger['debug'](_0x7a35('0xf'),_0x1be7c8,'request\x20sent',JSON[_0x7a35('0x10')](_0xa4dc31));if(_0xa4dc31[_0x7a35('0x11')]){if(_0xa4dc31[_0x7a35('0x11')]['code']===0x1f4){logger[_0x7a35('0x11')](_0x7a35('0x12'),_0x1be7c8,_0xa4dc31[_0x7a35('0x11')]['message']);return _0x43b12c(_0xa4dc31[_0x7a35('0x11')][_0x7a35('0x13')]);}logger['error'](_0x7a35('0x12'),_0x1be7c8,_0xa4dc31[_0x7a35('0x11')][_0x7a35('0x13')]);return _0x4f73a2(_0xa4dc31[_0x7a35('0x11')]['message']);}else{logger[_0x7a35('0xd')](_0x7a35('0x12'),_0x1be7c8,_0x7a35('0xe'));_0x4f73a2(_0xa4dc31[_0x7a35('0x14')][_0x7a35('0x13')]);}})[_0x7a35('0x15')](function(_0x283fad){logger['error'](_0x7a35('0x12'),_0x1be7c8,_0x283fad);_0x43b12c(_0x283fad);});});}exports[_0x7a35('0x16')]=function(_0x346a4d){var _0x2c7db0=this;return new Promise(function(_0x4244bd,_0x4b3e79){return db[_0x7a35('0x17')][_0x7a35('0x18')](_0x346a4d[_0x7a35('0x19')],{'raw':_0x346a4d['options']?_0x346a4d['options']['raw']===undefined?!![]:![]:!![]})[_0x7a35('0x1a')](function(_0x989712){logger[_0x7a35('0xd')]('CreateMailQueueReport',_0x346a4d);logger[_0x7a35('0x1b')](_0x7a35('0x16'),_0x346a4d,JSON[_0x7a35('0x10')](_0x989712));_0x4244bd(_0x989712);})[_0x7a35('0x15')](function(_0x5b656c){logger[_0x7a35('0x11')](_0x7a35('0x16'),_0x5b656c[_0x7a35('0x13')],_0x346a4d);_0x4b3e79(_0x2c7db0['error'](0x1f4,_0x5b656c['message']));});});};exports['UpdateMailQueueReport']=function(_0x5e24dc){var _0x4647c6=this;return new Promise(function(_0x545a92,_0xedad42){return db[_0x7a35('0x17')][_0x7a35('0x1c')](_0x5e24dc[_0x7a35('0x19')],{'raw':_0x5e24dc['options']?_0x5e24dc[_0x7a35('0x1d')][_0x7a35('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e24dc[_0x7a35('0x1d')]?_0x5e24dc[_0x7a35('0x1d')]['where']||null:null,'attributes':_0x5e24dc['options']?_0x5e24dc[_0x7a35('0x1d')]['attributes']||null:null,'limit':_0x5e24dc['options']?_0x5e24dc[_0x7a35('0x1d')][_0x7a35('0x1f')]||null:null})[_0x7a35('0x1a')](function(_0x207a65){logger[_0x7a35('0xd')](_0x7a35('0x20'),_0x5e24dc);logger[_0x7a35('0x1b')](_0x7a35('0x20'),_0x5e24dc,JSON['stringify'](_0x207a65));_0x545a92(_0x207a65);})[_0x7a35('0x15')](function(_0x5ad6c4){logger[_0x7a35('0x11')](_0x7a35('0x20'),_0x5ad6c4[_0x7a35('0x13')],_0x5e24dc);_0xedad42(_0x4647c6[_0x7a35('0x11')](0x1f4,_0x5ad6c4[_0x7a35('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index a9016e6..845c9c7 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 _0x5397=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x24826c,_0x5d4ad3){var _0x5ca07b=function(_0x360ba3){while(--_0x360ba3){_0x24826c['push'](_0x24826c['shift']());}};_0x5ca07b(++_0x5d4ad3);}(_0x5397,0x105));var _0x7539=function(_0x5ab591,_0x37d129){_0x5ab591=_0x5ab591-0x0;var _0x395751=_0x5397[_0x5ab591];return _0x395751;};'use strict';var multer=require('multer');var util=require(_0x7539('0x0'));var path=require(_0x7539('0x1'));var timeout=require(_0x7539('0x2'));var express=require(_0x7539('0x3'));var router=express[_0x7539('0x4')]();var fs_extra=require(_0x7539('0x5'));var auth=require(_0x7539('0x6'));var interaction=require(_0x7539('0x7'));var config=require(_0x7539('0x8'));module['exports']=router; \ No newline at end of file +var _0x6629=['../../config/environment','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1dcac5,_0x46365e){var _0x26a0a5=function(_0x459da1){while(--_0x459da1){_0x1dcac5['push'](_0x1dcac5['shift']());}};_0x26a0a5(++_0x46365e);}(_0x6629,0x1c2));var _0x9662=function(_0x5f2bb7,_0x4e8c7d){_0x5f2bb7=_0x5f2bb7-0x0;var _0x56c924=_0x6629[_0x5f2bb7];return _0x56c924;};'use strict';var multer=require(_0x9662('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9662('0x1'));var express=require(_0x9662('0x2'));var router=express[_0x9662('0x3')]();var fs_extra=require(_0x9662('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9662('0x5'));var config=require(_0x9662('0x6'));module[_0x9662('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index f5c262c..5ae80ae 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 _0x6def=['BOOLEAN','username','INTEGER','sequelize','STRING'];(function(_0x400360,_0x27cd32){var _0x2688e3=function(_0x441007){while(--_0x441007){_0x400360['push'](_0x400360['shift']());}};_0x2688e3(++_0x27cd32);}(_0x6def,0x166));var _0xf6de=function(_0x5a3589,_0x21fd98){_0x5a3589=_0x5a3589-0x0;var _0x36873e=_0x6def[_0x5a3589];return _0x36873e;};'use strict';var Sequelize=require(_0xf6de('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf6de('0x1')]},'authentication':{'type':Sequelize[_0xf6de('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf6de('0x1')],'unique':_0xf6de('0x3')},'password':{'type':Sequelize[_0xf6de('0x1')]},'port':{'type':Sequelize[_0xf6de('0x4')]},'tls':{'type':Sequelize[_0xf6de('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf6de('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xf6de('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf6de('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf6de('0x1')]}}; \ No newline at end of file +var _0x295e=['exports','STRING','BOOLEAN','username','INTEGER','sequelize'];(function(_0x4ba20a,_0x50575d){var _0x2ce02e=function(_0x16024e){while(--_0x16024e){_0x4ba20a['push'](_0x4ba20a['shift']());}};_0x2ce02e(++_0x50575d);}(_0x295e,0x155));var _0xe295=function(_0x2aaae8,_0x335325){_0x2aaae8=_0x2aaae8-0x0;var _0x4bfa69=_0x295e[_0x2aaae8];return _0x4bfa69;};'use strict';var Sequelize=require(_0xe295('0x0'));module[_0xe295('0x1')]={'description':{'type':Sequelize[_0xe295('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xe295('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0xe295('0x4')},'password':{'type':Sequelize[_0xe295('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xe295('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe295('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xe295('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index b4202a2..89571cb 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 _0x4227=['./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','api','bluebird','request-promise','path','../../config/environment'];(function(_0x5b6ae2,_0x7752b9){var _0x29eb72=function(_0x4cb009){while(--_0x4cb009){_0x5b6ae2['push'](_0x5b6ae2['shift']());}};_0x29eb72(++_0x7752b9);}(_0x4227,0x89));var _0x7422=function(_0x5b66e5,_0x194afc){_0x5b66e5=_0x5b66e5-0x0;var _0x2f71d2=_0x4227[_0x5b66e5];return _0x2f71d2;};'use strict';var _=require(_0x7422('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7422('0x1'));var moment=require('moment');var BPromise=require(_0x7422('0x2'));var rp=require(_0x7422('0x3'));var fs=require('fs');var path=require(_0x7422('0x4'));var rimraf=require('rimraf');var config=require(_0x7422('0x5'));var attributes=require(_0x7422('0x6'));module[_0x7422('0x7')]=function(_0x36ddba,_0x4432d6){return _0x36ddba[_0x7422('0x8')](_0x7422('0x9'),attributes,{'tableName':_0x7422('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8603=['util','../../config/logger','api','request-promise','path','rimraf','./mailServerIn.attributes','define','MailServerIn','mail_servers_in'];(function(_0x122010,_0x318f8b){var _0x4fcade=function(_0x454085){while(--_0x454085){_0x122010['push'](_0x122010['shift']());}};_0x4fcade(++_0x318f8b);}(_0x8603,0x190));var _0x3860=function(_0x566c5a,_0x42e09c){_0x566c5a=_0x566c5a-0x0;var _0x3c4abe=_0x8603[_0x566c5a];return _0x3c4abe;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3860('0x3'));var fs=require('fs');var path=require(_0x3860('0x4'));var rimraf=require(_0x3860('0x5'));var config=require('../../config/environment');var attributes=require(_0x3860('0x6'));module['exports']=function(_0xb0fc24,_0x40739b){return _0xb0fc24[_0x3860('0x7')](_0x3860('0x8'),attributes,{'tableName':_0x3860('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 9628951..3371a95 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 _0x9bc7=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','MailServerIn','findAll','options','raw','where','limit','include','map','attributes','model','then','GetMailServerIn'];(function(_0x1a958a,_0x5a7cc0){var _0x4faef8=function(_0x4e9c26){while(--_0x4e9c26){_0x1a958a['push'](_0x1a958a['shift']());}};_0x4faef8(++_0x5a7cc0);}(_0x9bc7,0x70));var _0x79bc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9bc7[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x79bc('0x0'));var util=require(_0x79bc('0x1'));var moment=require('moment');var BPromise=require(_0x79bc('0x2'));var rs=require(_0x79bc('0x3'));var fs=require('fs');var Redis=require(_0x79bc('0x4'));var db=require(_0x79bc('0x5'))['db'];var utils=require(_0x79bc('0x6'));var logger=require(_0x79bc('0x7'))(_0x79bc('0x8'));var config=require(_0x79bc('0x9'));var jayson=require(_0x79bc('0xa'));var client=jayson[_0x79bc('0xb')][_0x79bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21f7fd,_0x3a6adb,_0x2eaf50){return new BPromise(function(_0x199b55,_0xafdcc0){return client[_0x79bc('0xd')](_0x21f7fd,_0x2eaf50)['then'](function(_0x59ee9f){logger[_0x79bc('0xe')](_0x79bc('0xf'),_0x3a6adb,_0x79bc('0x10'));logger[_0x79bc('0x11')](_0x79bc('0x12'),_0x3a6adb,'request\x20sent',JSON[_0x79bc('0x13')](_0x59ee9f));if(_0x59ee9f['error']){if(_0x59ee9f['error'][_0x79bc('0x14')]===0x1f4){logger[_0x79bc('0x15')](_0x79bc('0xf'),_0x3a6adb,_0x59ee9f[_0x79bc('0x15')][_0x79bc('0x16')]);return _0xafdcc0(_0x59ee9f['error'][_0x79bc('0x16')]);}logger['error'](_0x79bc('0xf'),_0x3a6adb,_0x59ee9f['error'][_0x79bc('0x16')]);return _0x199b55(_0x59ee9f[_0x79bc('0x15')][_0x79bc('0x16')]);}else{logger['info'](_0x79bc('0xf'),_0x3a6adb,_0x79bc('0x10'));_0x199b55(_0x59ee9f[_0x79bc('0x17')][_0x79bc('0x16')]);}})['catch'](function(_0x5d3455){logger['error'](_0x79bc('0xf'),_0x3a6adb,_0x5d3455);_0xafdcc0(_0x5d3455);});});}exports['GetMailServerIn']=function(_0x5bfcd2){var _0x283026=this;return new Promise(function(_0x478851,_0x19c96a){return db[_0x79bc('0x18')][_0x79bc('0x19')]({'raw':_0x5bfcd2[_0x79bc('0x1a')]?_0x5bfcd2['options'][_0x79bc('0x1b')]===undefined?!![]:![]:!![],'where':_0x5bfcd2[_0x79bc('0x1a')]?_0x5bfcd2[_0x79bc('0x1a')][_0x79bc('0x1c')]||null:null,'attributes':_0x5bfcd2[_0x79bc('0x1a')]?_0x5bfcd2[_0x79bc('0x1a')]['attributes']||null:null,'limit':_0x5bfcd2[_0x79bc('0x1a')]?_0x5bfcd2[_0x79bc('0x1a')][_0x79bc('0x1d')]||null:null,'include':_0x5bfcd2[_0x79bc('0x1a')]?_0x5bfcd2[_0x79bc('0x1a')][_0x79bc('0x1e')]?_[_0x79bc('0x1f')](_0x5bfcd2[_0x79bc('0x1a')][_0x79bc('0x1e')],function(_0x3c2aa0){return{'model':db[_0x3c2aa0['model']],'as':_0x3c2aa0['as'],'attributes':_0x3c2aa0[_0x79bc('0x20')],'include':_0x3c2aa0[_0x79bc('0x1e')]?_[_0x79bc('0x1f')](_0x3c2aa0[_0x79bc('0x1e')],function(_0x5b21ab){return{'model':db[_0x5b21ab[_0x79bc('0x21')]],'as':_0x5b21ab['as'],'attributes':_0x5b21ab['attributes'],'include':_0x5b21ab[_0x79bc('0x1e')]?_[_0x79bc('0x1f')](_0x5b21ab[_0x79bc('0x1e')],function(_0x20c2a7){return{'model':db[_0x20c2a7['model']],'as':_0x20c2a7['as'],'attributes':_0x20c2a7[_0x79bc('0x20')]};}):[]};}):[]};}):[]:[]})[_0x79bc('0x22')](function(_0x29cb51){logger['info'](_0x79bc('0x23'),_0x5bfcd2);logger[_0x79bc('0x11')](_0x79bc('0x23'),_0x5bfcd2,JSON['stringify'](_0x29cb51));_0x478851(_0x29cb51);})[_0x79bc('0x24')](function(_0x49b667){logger[_0x79bc('0x15')]('GetMailServerIn',_0x49b667[_0x79bc('0x16')],_0x5bfcd2);_0x19c96a(_0x283026[_0x79bc('0x15')](0x1f4,_0x49b667[_0x79bc('0x16')]));});});}; \ No newline at end of file +var _0x9a84=['message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x156515,_0x760da4){var _0x3e1e8b=function(_0x23970a){while(--_0x23970a){_0x156515['push'](_0x156515['shift']());}};_0x3e1e8b(++_0x760da4);}(_0x9a84,0x1a5));var _0x49a8=function(_0x352b44,_0x4a91a1){_0x352b44=_0x352b44-0x0;var _0x3e8baa=_0x9a84[_0x352b44];return _0x3e8baa;};'use strict';var _=require(_0x49a8('0x0'));var util=require(_0x49a8('0x1'));var moment=require(_0x49a8('0x2'));var BPromise=require(_0x49a8('0x3'));var rs=require(_0x49a8('0x4'));var fs=require('fs');var Redis=require(_0x49a8('0x5'));var db=require(_0x49a8('0x6'))['db'];var utils=require(_0x49a8('0x7'));var logger=require(_0x49a8('0x8'))(_0x49a8('0x9'));var config=require(_0x49a8('0xa'));var jayson=require(_0x49a8('0xb'));var client=jayson[_0x49a8('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bd7d2,_0x1e3348,_0x549b81){return new BPromise(function(_0x1dd7da,_0x4bc184){return client['request'](_0x1bd7d2,_0x549b81)[_0x49a8('0xd')](function(_0x56d049){logger[_0x49a8('0xe')](_0x49a8('0xf'),_0x1e3348,_0x49a8('0x10'));logger[_0x49a8('0x11')](_0x49a8('0x12'),_0x1e3348,_0x49a8('0x10'),JSON[_0x49a8('0x13')](_0x56d049));if(_0x56d049[_0x49a8('0x14')]){if(_0x56d049[_0x49a8('0x14')]['code']===0x1f4){logger[_0x49a8('0x14')]('MailServerIn,\x20%s,\x20%s',_0x1e3348,_0x56d049[_0x49a8('0x14')][_0x49a8('0x15')]);return _0x4bc184(_0x56d049['error'][_0x49a8('0x15')]);}logger[_0x49a8('0x14')]('MailServerIn,\x20%s,\x20%s',_0x1e3348,_0x56d049['error'][_0x49a8('0x15')]);return _0x1dd7da(_0x56d049[_0x49a8('0x14')][_0x49a8('0x15')]);}else{logger['info'](_0x49a8('0xf'),_0x1e3348,'request\x20sent');_0x1dd7da(_0x56d049[_0x49a8('0x16')]['message']);}})[_0x49a8('0x17')](function(_0x49f245){logger['error'](_0x49a8('0xf'),_0x1e3348,_0x49f245);_0x4bc184(_0x49f245);});});}exports[_0x49a8('0x18')]=function(_0x89da19){var _0x26124b=this;return new Promise(function(_0x1370b6,_0x1a1519){return db[_0x49a8('0x19')][_0x49a8('0x1a')]({'raw':_0x89da19[_0x49a8('0x1b')]?_0x89da19[_0x49a8('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x89da19[_0x49a8('0x1b')]?_0x89da19[_0x49a8('0x1b')][_0x49a8('0x1c')]||null:null,'attributes':_0x89da19['options']?_0x89da19[_0x49a8('0x1b')][_0x49a8('0x1d')]||null:null,'limit':_0x89da19[_0x49a8('0x1b')]?_0x89da19[_0x49a8('0x1b')][_0x49a8('0x1e')]||null:null,'include':_0x89da19[_0x49a8('0x1b')]?_0x89da19[_0x49a8('0x1b')]['include']?_[_0x49a8('0x1f')](_0x89da19[_0x49a8('0x1b')]['include'],function(_0x1b5438){return{'model':db[_0x1b5438['model']],'as':_0x1b5438['as'],'attributes':_0x1b5438[_0x49a8('0x1d')],'include':_0x1b5438[_0x49a8('0x20')]?_['map'](_0x1b5438['include'],function(_0x160ed6){return{'model':db[_0x160ed6['model']],'as':_0x160ed6['as'],'attributes':_0x160ed6[_0x49a8('0x1d')],'include':_0x160ed6['include']?_['map'](_0x160ed6[_0x49a8('0x20')],function(_0x463ea5){return{'model':db[_0x463ea5[_0x49a8('0x21')]],'as':_0x463ea5['as'],'attributes':_0x463ea5[_0x49a8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x49a8('0xd')](function(_0x49ce6e){logger[_0x49a8('0xe')](_0x49a8('0x18'),_0x89da19);logger[_0x49a8('0x11')](_0x49a8('0x18'),_0x89da19,JSON[_0x49a8('0x13')](_0x49ce6e));_0x1370b6(_0x49ce6e);})[_0x49a8('0x17')](function(_0x392804){logger['error'](_0x49a8('0x18'),_0x392804[_0x49a8('0x15')],_0x89da19);_0x1a1519(_0x26124b['error'](0x1f4,_0x392804[_0x49a8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index dc386e3..f507178 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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x2d84f8,_0x44e209){var _0x3c2603=function(_0x30cffa){while(--_0x30cffa){_0x2d84f8['push'](_0x2d84f8['shift']());}};_0x3c2603(++_0x44e209);}(_0x008c,0x188));var _0xc008=function(_0x33d5d6,_0x2ad866){_0x33d5d6=_0x33d5d6-0x0;var _0x27032e=_0x008c[_0x33d5d6];return _0x27032e;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0x22fb=['./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x552971,_0x3e6f5d){var _0x2aae9f=function(_0x368511){while(--_0x368511){_0x552971['push'](_0x552971['shift']());}};_0x2aae9f(++_0x3e6f5d);}(_0x22fb,0x192));var _0xb22f=function(_0x514723,_0x45756a){_0x514723=_0x514723-0x0;var _0x30a3f6=_0x22fb[_0x514723];return _0x30a3f6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0xc')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')](_0xb22f('0xa'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xa'),auth[_0xb22f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 5a6a045..2cc3096 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 _0x36f3=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x3a238d,_0x103eff){var _0x491b6c=function(_0x471070){while(--_0x471070){_0x3a238d['push'](_0x3a238d['shift']());}};_0x491b6c(++_0x103eff);}(_0x36f3,0xe6));var _0x336f=function(_0x36d5d5,_0x1c1590){_0x36d5d5=_0x36d5d5-0x0;var _0x4eaa56=_0x36f3[_0x36d5d5];return _0x4eaa56;};'use strict';var Sequelize=require('sequelize');module[_0x336f('0x0')]={'description':{'type':Sequelize[_0x336f('0x1')]},'host':{'type':Sequelize[_0x336f('0x1')]},'user':{'type':Sequelize[_0x336f('0x1')]},'pass':{'type':Sequelize[_0x336f('0x1')]},'port':{'type':Sequelize[_0x336f('0x2')]},'secure':{'type':Sequelize[_0x336f('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x336f('0x1')]},'authentication':{'type':Sequelize[_0x336f('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x36c3=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x53bb2d,_0x225326){var _0x3038a0=function(_0x3721d7){while(--_0x3721d7){_0x53bb2d['push'](_0x53bb2d['shift']());}};_0x3038a0(++_0x225326);}(_0x36c3,0x1a6));var _0x336c=function(_0x5b8646,_0x3e1589){_0x5b8646=_0x5b8646-0x0;var _0x363e4c=_0x36c3[_0x5b8646];return _0x363e4c;};'use strict';var Sequelize=require(_0x336c('0x0'));module[_0x336c('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x336c('0x2')]},'user':{'type':Sequelize[_0x336c('0x2')]},'pass':{'type':Sequelize[_0x336c('0x2')]},'port':{'type':Sequelize[_0x336c('0x3')]},'secure':{'type':Sequelize[_0x336c('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x336c('0x2')]},'authentication':{'type':Sequelize[_0x336c('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 703d16a..6c43f6c 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 _0xb3c8=['fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','reject','save','update','then','sendStatus','error','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','includeAll','findAll','catch','params','include','merge','options','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x3068a3,_0x23f5ac){var _0x48a707=function(_0x59ad58){while(--_0x59ad58){_0x3068a3['push'](_0x3068a3['shift']());}};_0x48a707(++_0x23f5ac);}(_0xb3c8,0x19b));var _0x8b3c=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb3c8[_0x243b2f];return _0xcb3c2d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b3c('0x0'));var rimraf=require(_0x8b3c('0x1'));var zipdir=require(_0x8b3c('0x2'));var jsonpatch=require(_0x8b3c('0x3'));var rp=require('request-promise');var moment=require(_0x8b3c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8b3c('0x5'));var util=require(_0x8b3c('0x6'));var path=require('path');var sox=require(_0x8b3c('0x7'));var csv=require(_0x8b3c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b3c('0x9'));var _=require(_0x8b3c('0xa'));var squel=require(_0x8b3c('0xb'));var crypto=require('crypto');var jsforce=require(_0x8b3c('0xc'));var deskjs=require(_0x8b3c('0xd'));var toCsv=require(_0x8b3c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b3c('0xe'));var authService=require(_0x8b3c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b3c('0x10'));var logger=require('../../config/logger')(_0x8b3c('0x11'));var utils=require(_0x8b3c('0x12'));var config=require(_0x8b3c('0x13'));var licenseUtil=require(_0x8b3c('0x14'));var db=require(_0x8b3c('0x15'))['db'];function respondWithStatusCode(_0x5d1c62,_0x16cff6){_0x16cff6=_0x16cff6||0xcc;return function(_0x36122b){if(_0x36122b){return _0x5d1c62['sendStatus'](_0x16cff6);}return _0x5d1c62[_0x8b3c('0x16')](_0x16cff6)[_0x8b3c('0x17')]();};}function respondWithResult(_0x259198,_0x2ebbca){_0x2ebbca=_0x2ebbca||0xc8;return function(_0x134298){if(_0x134298){return _0x259198[_0x8b3c('0x16')](_0x2ebbca)[_0x8b3c('0x18')](_0x134298);}};}function respondWithFilteredResult(_0x1c070d,_0x44a76a){return function(_0xe89da7){if(_0xe89da7){var _0x4273f6=_0xe89da7[_0x8b3c('0x19')],_0x1ce4e3=_0x44a76a[_0x8b3c('0x1a')],_0x5506b0=_0x44a76a[_0x8b3c('0x1a')]+_0x44a76a['limit'],_0x503066;if(_0x5506b0>=_0x4273f6){_0x5506b0=_0x4273f6;_0x503066=0xc8;}else{_0x503066=0xce;}_0x1c070d['status'](_0x503066);return _0x1c070d[_0x8b3c('0x1b')]('Content-Range',_0x1ce4e3+'-'+_0x5506b0+'/'+_0x4273f6)[_0x8b3c('0x18')](_0xe89da7);}return null;};}function patchUpdates(_0x59e668){return function(_0x49636){try{jsonpatch['apply'](_0x49636,_0x59e668,!![]);}catch(_0x33cce3){return BPromise[_0x8b3c('0x1c')](_0x33cce3);}return _0x49636[_0x8b3c('0x1d')]();};}function saveUpdates(_0x43810d,_0x25046f){return function(_0x1b46aa){if(_0x1b46aa){return _0x1b46aa[_0x8b3c('0x1e')](_0x43810d)[_0x8b3c('0x1f')](function(_0x1d96e9){return _0x1d96e9;});}return null;};}function removeEntity(_0x5bb365,_0xaa5083){return function(_0x1cc50c){if(_0x1cc50c){return _0x1cc50c['destroy']()[_0x8b3c('0x1f')](function(){_0x5bb365[_0x8b3c('0x16')](0xcc)[_0x8b3c('0x17')]();});}};}function handleEntityNotFound(_0x16940b,_0x48e2fe){return function(_0x28d015){if(!_0x28d015){_0x16940b[_0x8b3c('0x20')](0x194);}return _0x28d015;};}function handleError(_0x2bba10,_0x4a53ad){_0x4a53ad=_0x4a53ad||0x1f4;return function(_0x40daf4){logger[_0x8b3c('0x21')](_0x40daf4['stack']);if(_0x40daf4['name']){delete _0x40daf4[_0x8b3c('0x22')];}_0x2bba10[_0x8b3c('0x16')](_0x4a53ad)[_0x8b3c('0x23')](_0x40daf4);};}exports[_0x8b3c('0x24')]=function(_0xdb0236,_0x5c9046){var _0x5c10a6={},_0x1fac6e={},_0x12b9c6={'count':0x0,'rows':[]};var _0x20d3c2=_[_0x8b3c('0x25')](db[_0x8b3c('0x26')][_0x8b3c('0x27')],function(_0x456cff){return{'name':_0x456cff[_0x8b3c('0x28')],'type':_0x456cff['type'][_0x8b3c('0x29')]};});_0x1fac6e['model']=_[_0x8b3c('0x25')](_0x20d3c2,'name');_0x1fac6e[_0x8b3c('0x2a')]=_[_0x8b3c('0x2b')](_0xdb0236[_0x8b3c('0x2a')]);_0x1fac6e[_0x8b3c('0x2c')]=_[_0x8b3c('0x2d')](_0x1fac6e[_0x8b3c('0x2e')],_0x1fac6e[_0x8b3c('0x2a')]);_0x5c10a6[_0x8b3c('0x2f')]=_['intersection'](_0x1fac6e[_0x8b3c('0x2e')],qs[_0x8b3c('0x30')](_0xdb0236[_0x8b3c('0x2a')][_0x8b3c('0x30')]));_0x5c10a6['attributes']=_0x5c10a6[_0x8b3c('0x2f')][_0x8b3c('0x31')]?_0x5c10a6[_0x8b3c('0x2f')]:_0x1fac6e[_0x8b3c('0x2e')];if(!_0xdb0236[_0x8b3c('0x2a')][_0x8b3c('0x32')](_0x8b3c('0x33'))){_0x5c10a6['limit']=qs['limit'](_0xdb0236[_0x8b3c('0x2a')][_0x8b3c('0x34')]);_0x5c10a6['offset']=qs[_0x8b3c('0x1a')](_0xdb0236[_0x8b3c('0x2a')][_0x8b3c('0x1a')]);}_0x5c10a6[_0x8b3c('0x35')]=qs['sort'](_0xdb0236[_0x8b3c('0x2a')][_0x8b3c('0x36')]);_0x5c10a6[_0x8b3c('0x37')]=qs[_0x8b3c('0x2c')](_[_0x8b3c('0x38')](_0xdb0236[_0x8b3c('0x2a')],_0x1fac6e['filters']),_0x20d3c2);if(_0xdb0236['query'][_0x8b3c('0x39')]){_0x5c10a6[_0x8b3c('0x37')]=_['merge'](_0x5c10a6['where'],{'$or':_[_0x8b3c('0x25')](_0x20d3c2,function(_0x3e4670){if(_0x3e4670[_0x8b3c('0x3a')]!=='VIRTUAL'){var _0x15c53c={};_0x15c53c[_0x3e4670[_0x8b3c('0x22')]]={'$like':'%'+_0xdb0236[_0x8b3c('0x2a')][_0x8b3c('0x39')]+'%'};return _0x15c53c;}})});}_0x5c10a6=_['merge']({},_0x5c10a6,_0xdb0236['options']);var _0x11a81c={'where':_0x5c10a6[_0x8b3c('0x37')]};return db['MailServerOut'][_0x8b3c('0x19')](_0x11a81c)[_0x8b3c('0x1f')](function(_0x411d23){_0x12b9c6[_0x8b3c('0x19')]=_0x411d23;if(_0xdb0236[_0x8b3c('0x2a')][_0x8b3c('0x3b')]){_0x5c10a6['include']=[{'all':!![]}];}return db['MailServerOut'][_0x8b3c('0x3c')](_0x5c10a6);})[_0x8b3c('0x1f')](function(_0x53ac83){_0x12b9c6['rows']=_0x53ac83;return _0x12b9c6;})[_0x8b3c('0x1f')](respondWithFilteredResult(_0x5c9046,_0x5c10a6))[_0x8b3c('0x3d')](handleError(_0x5c9046,null));};exports['show']=function(_0x36ad43,_0x169409){var _0x3688f2={'raw':!![],'where':{'id':_0x36ad43[_0x8b3c('0x3e')]['id']}},_0x163e85={};_0x163e85[_0x8b3c('0x2e')]=_[_0x8b3c('0x2b')](db[_0x8b3c('0x26')][_0x8b3c('0x27')]);_0x163e85[_0x8b3c('0x2a')]=_[_0x8b3c('0x2b')](_0x36ad43[_0x8b3c('0x2a')]);_0x163e85['filters']=_[_0x8b3c('0x2d')](_0x163e85[_0x8b3c('0x2e')],_0x163e85[_0x8b3c('0x2a')]);_0x3688f2[_0x8b3c('0x2f')]=_['intersection'](_0x163e85[_0x8b3c('0x2e')],qs[_0x8b3c('0x30')](_0x36ad43[_0x8b3c('0x2a')][_0x8b3c('0x30')]));_0x3688f2['attributes']=_0x3688f2['attributes'][_0x8b3c('0x31')]?_0x3688f2[_0x8b3c('0x2f')]:_0x163e85['model'];if(_0x36ad43[_0x8b3c('0x2a')][_0x8b3c('0x3b')]){_0x3688f2[_0x8b3c('0x3f')]=[{'all':!![]}];}_0x3688f2=_[_0x8b3c('0x40')]({},_0x3688f2,_0x36ad43[_0x8b3c('0x41')]);return db[_0x8b3c('0x26')][_0x8b3c('0x42')](_0x3688f2)[_0x8b3c('0x1f')](handleEntityNotFound(_0x169409,null))[_0x8b3c('0x1f')](respondWithResult(_0x169409,null))['catch'](handleError(_0x169409,null));};exports[_0x8b3c('0x43')]=function(_0x31fd20,_0x486608){return db[_0x8b3c('0x26')][_0x8b3c('0x43')](_0x31fd20[_0x8b3c('0x44')],{})[_0x8b3c('0x1f')](respondWithResult(_0x486608,0xc9))[_0x8b3c('0x3d')](handleError(_0x486608,null));};exports[_0x8b3c('0x1e')]=function(_0x33efd5,_0x9a3df9){if(_0x33efd5[_0x8b3c('0x44')]['id']){delete _0x33efd5[_0x8b3c('0x44')]['id'];}return db[_0x8b3c('0x26')][_0x8b3c('0x42')]({'where':{'id':_0x33efd5[_0x8b3c('0x3e')]['id']}})[_0x8b3c('0x1f')](handleEntityNotFound(_0x9a3df9,null))[_0x8b3c('0x1f')](saveUpdates(_0x33efd5[_0x8b3c('0x44')],null))['then'](respondWithResult(_0x9a3df9,null))[_0x8b3c('0x3d')](handleError(_0x9a3df9,null));};exports['destroy']=function(_0x1be845,_0x456bac){return db[_0x8b3c('0x26')][_0x8b3c('0x42')]({'where':{'id':_0x1be845['params']['id']}})['then'](handleEntityNotFound(_0x456bac,null))[_0x8b3c('0x1f')](removeEntity(_0x456bac,null))[_0x8b3c('0x3d')](handleError(_0x456bac,null));}; \ No newline at end of file +var _0xaa5c=['intersection','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','apply','reject','update','then','sendStatus','stack','name','send','index','map','MailServerOut','rawAttributes','type','key','model','query','keys','filters','attributes'];(function(_0x36d64e,_0x5a8c2b){var _0x1b9d05=function(_0x1015e3){while(--_0x1015e3){_0x36d64e['push'](_0x36d64e['shift']());}};_0x1b9d05(++_0x5a8c2b);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x195579,_0x242f21){_0x195579=_0x195579-0x0;var _0x2a6591=_0xaa5c[_0x195579];return _0x2a6591;};'use strict';var pdf=require(_0xcaa5('0x0'));var emlformat=require(_0xcaa5('0x1'));var rimraf=require(_0xcaa5('0x2'));var zipdir=require(_0xcaa5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcaa5('0x4'));var util=require('util');var path=require('path');var sox=require(_0xcaa5('0x5'));var csv=require(_0xcaa5('0x6'));var ejs=require(_0xcaa5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcaa5('0x8'));var squel=require(_0xcaa5('0x9'));var crypto=require(_0xcaa5('0xa'));var jsforce=require(_0xcaa5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcaa5('0x6'));var querystring=require(_0xcaa5('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcaa5('0xd'));var qs=require(_0xcaa5('0xe'));var as=require(_0xcaa5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcaa5('0x10'))('api');var utils=require(_0xcaa5('0x11'));var config=require(_0xcaa5('0x12'));var licenseUtil=require(_0xcaa5('0x13'));var db=require(_0xcaa5('0x14'))['db'];function respondWithStatusCode(_0x16bb6d,_0xbf4c57){_0xbf4c57=_0xbf4c57||0xcc;return function(_0x1b77f7){if(_0x1b77f7){return _0x16bb6d['sendStatus'](_0xbf4c57);}return _0x16bb6d[_0xcaa5('0x15')](_0xbf4c57)[_0xcaa5('0x16')]();};}function respondWithResult(_0x474770,_0x295c9f){_0x295c9f=_0x295c9f||0xc8;return function(_0x3ef9ea){if(_0x3ef9ea){return _0x474770[_0xcaa5('0x15')](_0x295c9f)[_0xcaa5('0x17')](_0x3ef9ea);}};}function respondWithFilteredResult(_0xa2c6b6,_0x8b7ad5){return function(_0x53e67f){if(_0x53e67f){var _0xa74489=_0x53e67f['count'],_0x47eb0f=_0x8b7ad5[_0xcaa5('0x18')],_0x17e3d2=_0x8b7ad5[_0xcaa5('0x18')]+_0x8b7ad5[_0xcaa5('0x19')],_0x30c8c0;if(_0x17e3d2>=_0xa74489){_0x17e3d2=_0xa74489;_0x30c8c0=0xc8;}else{_0x30c8c0=0xce;}_0xa2c6b6[_0xcaa5('0x15')](_0x30c8c0);return _0xa2c6b6[_0xcaa5('0x1a')]('Content-Range',_0x47eb0f+'-'+_0x17e3d2+'/'+_0xa74489)[_0xcaa5('0x17')](_0x53e67f);}return null;};}function patchUpdates(_0x4470c1){return function(_0xf28bde){try{jsonpatch[_0xcaa5('0x1b')](_0xf28bde,_0x4470c1,!![]);}catch(_0x5ec417){return BPromise[_0xcaa5('0x1c')](_0x5ec417);}return _0xf28bde['save']();};}function saveUpdates(_0x93f6d4,_0x228f0b){return function(_0xeca790){if(_0xeca790){return _0xeca790[_0xcaa5('0x1d')](_0x93f6d4)[_0xcaa5('0x1e')](function(_0x52ca18){return _0x52ca18;});}return null;};}function removeEntity(_0x48b8ee,_0x51be62){return function(_0x34df47){if(_0x34df47){return _0x34df47['destroy']()[_0xcaa5('0x1e')](function(){_0x48b8ee['status'](0xcc)[_0xcaa5('0x16')]();});}};}function handleEntityNotFound(_0x554027,_0xc9a5ac){return function(_0x6010d4){if(!_0x6010d4){_0x554027[_0xcaa5('0x1f')](0x194);}return _0x6010d4;};}function handleError(_0x2af11b,_0x5c7693){_0x5c7693=_0x5c7693||0x1f4;return function(_0xe4ae3b){logger['error'](_0xe4ae3b[_0xcaa5('0x20')]);if(_0xe4ae3b['name']){delete _0xe4ae3b[_0xcaa5('0x21')];}_0x2af11b[_0xcaa5('0x15')](_0x5c7693)[_0xcaa5('0x22')](_0xe4ae3b);};}exports[_0xcaa5('0x23')]=function(_0x16462d,_0x89b3d3){var _0x16414b={},_0xf27232={},_0x5da781={'count':0x0,'rows':[]};var _0x4c356d=_[_0xcaa5('0x24')](db[_0xcaa5('0x25')][_0xcaa5('0x26')],function(_0x5c49fd){return{'name':_0x5c49fd['fieldName'],'type':_0x5c49fd[_0xcaa5('0x27')][_0xcaa5('0x28')]};});_0xf27232[_0xcaa5('0x29')]=_[_0xcaa5('0x24')](_0x4c356d,_0xcaa5('0x21'));_0xf27232[_0xcaa5('0x2a')]=_[_0xcaa5('0x2b')](_0x16462d[_0xcaa5('0x2a')]);_0xf27232[_0xcaa5('0x2c')]=_['intersection'](_0xf27232[_0xcaa5('0x29')],_0xf27232[_0xcaa5('0x2a')]);_0x16414b[_0xcaa5('0x2d')]=_[_0xcaa5('0x2e')](_0xf27232['model'],qs[_0xcaa5('0x2f')](_0x16462d['query'][_0xcaa5('0x2f')]));_0x16414b[_0xcaa5('0x2d')]=_0x16414b[_0xcaa5('0x2d')]['length']?_0x16414b[_0xcaa5('0x2d')]:_0xf27232[_0xcaa5('0x29')];if(!_0x16462d[_0xcaa5('0x2a')][_0xcaa5('0x30')]('nolimit')){_0x16414b[_0xcaa5('0x19')]=qs[_0xcaa5('0x19')](_0x16462d[_0xcaa5('0x2a')][_0xcaa5('0x19')]);_0x16414b[_0xcaa5('0x18')]=qs['offset'](_0x16462d['query'][_0xcaa5('0x18')]);}_0x16414b[_0xcaa5('0x31')]=qs[_0xcaa5('0x32')](_0x16462d['query'][_0xcaa5('0x32')]);_0x16414b['where']=qs[_0xcaa5('0x2c')](_[_0xcaa5('0x33')](_0x16462d['query'],_0xf27232[_0xcaa5('0x2c')]),_0x4c356d);if(_0x16462d[_0xcaa5('0x2a')][_0xcaa5('0x34')]){_0x16414b[_0xcaa5('0x35')]=_['merge'](_0x16414b[_0xcaa5('0x35')],{'$or':_[_0xcaa5('0x24')](_0x4c356d,function(_0x608ee8){if(_0x608ee8[_0xcaa5('0x27')]!==_0xcaa5('0x36')){var _0x158e7d={};_0x158e7d[_0x608ee8[_0xcaa5('0x21')]]={'$like':'%'+_0x16462d[_0xcaa5('0x2a')]['filter']+'%'};return _0x158e7d;}})});}_0x16414b=_[_0xcaa5('0x37')]({},_0x16414b,_0x16462d[_0xcaa5('0x38')]);var _0x1dc2d4={'where':_0x16414b[_0xcaa5('0x35')]};return db['MailServerOut'][_0xcaa5('0x39')](_0x1dc2d4)['then'](function(_0x1fd607){_0x5da781[_0xcaa5('0x39')]=_0x1fd607;if(_0x16462d['query'][_0xcaa5('0x3a')]){_0x16414b[_0xcaa5('0x3b')]=[{'all':!![]}];}return db[_0xcaa5('0x25')][_0xcaa5('0x3c')](_0x16414b);})[_0xcaa5('0x1e')](function(_0x38430c){_0x5da781['rows']=_0x38430c;return _0x5da781;})[_0xcaa5('0x1e')](respondWithFilteredResult(_0x89b3d3,_0x16414b))[_0xcaa5('0x3d')](handleError(_0x89b3d3,null));};exports[_0xcaa5('0x3e')]=function(_0x3e9b40,_0xb138f4){var _0x31ab85={'raw':!![],'where':{'id':_0x3e9b40[_0xcaa5('0x3f')]['id']}},_0x2af6fe={};_0x2af6fe[_0xcaa5('0x29')]=_[_0xcaa5('0x2b')](db[_0xcaa5('0x25')][_0xcaa5('0x26')]);_0x2af6fe[_0xcaa5('0x2a')]=_[_0xcaa5('0x2b')](_0x3e9b40['query']);_0x2af6fe[_0xcaa5('0x2c')]=_['intersection'](_0x2af6fe[_0xcaa5('0x29')],_0x2af6fe[_0xcaa5('0x2a')]);_0x31ab85[_0xcaa5('0x2d')]=_[_0xcaa5('0x2e')](_0x2af6fe['model'],qs[_0xcaa5('0x2f')](_0x3e9b40[_0xcaa5('0x2a')][_0xcaa5('0x2f')]));_0x31ab85[_0xcaa5('0x2d')]=_0x31ab85[_0xcaa5('0x2d')][_0xcaa5('0x40')]?_0x31ab85[_0xcaa5('0x2d')]:_0x2af6fe[_0xcaa5('0x29')];if(_0x3e9b40['query'][_0xcaa5('0x3a')]){_0x31ab85['include']=[{'all':!![]}];}_0x31ab85=_[_0xcaa5('0x37')]({},_0x31ab85,_0x3e9b40[_0xcaa5('0x38')]);return db[_0xcaa5('0x25')][_0xcaa5('0x41')](_0x31ab85)[_0xcaa5('0x1e')](handleEntityNotFound(_0xb138f4,null))[_0xcaa5('0x1e')](respondWithResult(_0xb138f4,null))[_0xcaa5('0x3d')](handleError(_0xb138f4,null));};exports[_0xcaa5('0x42')]=function(_0x5cb955,_0x13c6e8){return db[_0xcaa5('0x25')][_0xcaa5('0x42')](_0x5cb955['body'],{})[_0xcaa5('0x1e')](respondWithResult(_0x13c6e8,0xc9))[_0xcaa5('0x3d')](handleError(_0x13c6e8,null));};exports[_0xcaa5('0x1d')]=function(_0x5c2af2,_0x43d337){if(_0x5c2af2[_0xcaa5('0x43')]['id']){delete _0x5c2af2[_0xcaa5('0x43')]['id'];}return db[_0xcaa5('0x25')][_0xcaa5('0x41')]({'where':{'id':_0x5c2af2[_0xcaa5('0x3f')]['id']}})[_0xcaa5('0x1e')](handleEntityNotFound(_0x43d337,null))['then'](saveUpdates(_0x5c2af2[_0xcaa5('0x43')],null))['then'](respondWithResult(_0x43d337,null))[_0xcaa5('0x3d')](handleError(_0x43d337,null));};exports['destroy']=function(_0x136334,_0x3cc0ea){return db[_0xcaa5('0x25')][_0xcaa5('0x41')]({'where':{'id':_0x136334[_0xcaa5('0x3f')]['id']}})[_0xcaa5('0x1e')](handleEntityNotFound(_0x3cc0ea,null))[_0xcaa5('0x1e')](removeEntity(_0x3cc0ea,null))[_0xcaa5('0x3d')](handleError(_0x3cc0ea,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 21137b1..a0dba01 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 _0x4819=['mail_servers_out','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','MailServerOut'];(function(_0x5f401a,_0x37e7a8){var _0x1bed74=function(_0x1a7e9){while(--_0x1a7e9){_0x5f401a['push'](_0x5f401a['shift']());}};_0x1bed74(++_0x37e7a8);}(_0x4819,0xcd));var _0x9481=function(_0x52b844,_0x434e67){_0x52b844=_0x52b844-0x0;var _0x14432f=_0x4819[_0x52b844];return _0x14432f;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['mail_servers_out','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','MailServerOut'];(function(_0x3aaf13,_0xc8ae25){var _0x57803b=function(_0x1ac02f){while(--_0x1ac02f){_0x3aaf13['push'](_0x3aaf13['shift']());}};_0x57803b(++_0xc8ae25);}(_0x4819,0xcd));var _0x9481=function(_0x206fc3,_0x251f21){_0x206fc3=_0x206fc3-0x0;var _0xea0c75=_0x4819[_0x206fc3];return _0xea0c75;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('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 c7a313e..2ae1e3d 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 _0xadb0=['message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x390f9b,_0x5dc3f5){var _0x4785f9=function(_0x1377af){while(--_0x1377af){_0x390f9b['push'](_0x390f9b['shift']());}};_0x4785f9(++_0x5dc3f5);}(_0xadb0,0x144));var _0x0adb=function(_0x31be74,_0x3992be){_0x31be74=_0x31be74-0x0;var _0x29275c=_0xadb0[_0x31be74];return _0x29275c;};'use strict';var _=require(_0x0adb('0x0'));var util=require(_0x0adb('0x1'));var moment=require('moment');var BPromise=require(_0x0adb('0x2'));var rs=require(_0x0adb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0adb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0adb('0x5'))('rpc');var config=require(_0x0adb('0x6'));var jayson=require(_0x0adb('0x7'));var client=jayson[_0x0adb('0x8')][_0x0adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb964e4,_0xd30840,_0x3d883e){return new BPromise(function(_0x191558,_0x57d5a3){return client['request'](_0xb964e4,_0x3d883e)[_0x0adb('0xa')](function(_0x1506cc){logger['info'](_0x0adb('0xb'),_0xd30840,_0x0adb('0xc'));logger[_0x0adb('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0xd30840,_0x0adb('0xc'),JSON[_0x0adb('0xe')](_0x1506cc));if(_0x1506cc['error']){if(_0x1506cc[_0x0adb('0xf')]['code']===0x1f4){logger[_0x0adb('0xf')]('MailServerOut,\x20%s,\x20%s',_0xd30840,_0x1506cc[_0x0adb('0xf')]['message']);return _0x57d5a3(_0x1506cc[_0x0adb('0xf')][_0x0adb('0x10')]);}logger[_0x0adb('0xf')](_0x0adb('0xb'),_0xd30840,_0x1506cc['error']['message']);return _0x191558(_0x1506cc[_0x0adb('0xf')][_0x0adb('0x10')]);}else{logger[_0x0adb('0x11')]('MailServerOut,\x20%s,\x20%s',_0xd30840,_0x0adb('0xc'));_0x191558(_0x1506cc[_0x0adb('0x12')][_0x0adb('0x10')]);}})[_0x0adb('0x13')](function(_0x598299){logger[_0x0adb('0xf')]('MailServerOut,\x20%s,\x20%s',_0xd30840,_0x598299);_0x57d5a3(_0x598299);});});} \ No newline at end of file +var _0xcf43=['info','MailServerOut,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x32af7f,_0x12aaf1){var _0x16c351=function(_0x51c69d){while(--_0x51c69d){_0x32af7f['push'](_0x32af7f['shift']());}};_0x16c351(++_0x12aaf1);}(_0xcf43,0x14e));var _0x3cf4=function(_0x50fd90,_0x122469){_0x50fd90=_0x50fd90-0x0;var _0x1d0113=_0xcf43[_0x50fd90];return _0x1d0113;};'use strict';var _=require(_0x3cf4('0x0'));var util=require(_0x3cf4('0x1'));var moment=require(_0x3cf4('0x2'));var BPromise=require(_0x3cf4('0x3'));var rs=require(_0x3cf4('0x4'));var fs=require('fs');var Redis=require(_0x3cf4('0x5'));var db=require(_0x3cf4('0x6'))['db'];var utils=require(_0x3cf4('0x7'));var logger=require(_0x3cf4('0x8'))(_0x3cf4('0x9'));var config=require(_0x3cf4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3cf4('0xb')][_0x3cf4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x530399,_0x34f334,_0x2ce8e8){return new BPromise(function(_0xc9f34b,_0x3e8bcc){return client['request'](_0x530399,_0x2ce8e8)['then'](function(_0x4dda89){logger['info']('MailServerOut,\x20%s,\x20%s',_0x34f334,_0x3cf4('0xd'));logger[_0x3cf4('0xe')](_0x3cf4('0xf'),_0x34f334,_0x3cf4('0xd'),JSON['stringify'](_0x4dda89));if(_0x4dda89['error']){if(_0x4dda89[_0x3cf4('0x10')]['code']===0x1f4){logger[_0x3cf4('0x10')]('MailServerOut,\x20%s,\x20%s',_0x34f334,_0x4dda89[_0x3cf4('0x10')]['message']);return _0x3e8bcc(_0x4dda89[_0x3cf4('0x10')][_0x3cf4('0x11')]);}logger[_0x3cf4('0x10')]('MailServerOut,\x20%s,\x20%s',_0x34f334,_0x4dda89[_0x3cf4('0x10')]['message']);return _0xc9f34b(_0x4dda89[_0x3cf4('0x10')][_0x3cf4('0x11')]);}else{logger[_0x3cf4('0x12')](_0x3cf4('0x13'),_0x34f334,_0x3cf4('0xd'));_0xc9f34b(_0x4dda89[_0x3cf4('0x14')][_0x3cf4('0x11')]);}})[_0x3cf4('0x15')](function(_0x19d5f9){logger[_0x3cf4('0x10')]('MailServerOut,\x20%s,\x20%s',_0x34f334,_0x19d5f9);_0x3e8bcc(_0x19d5f9);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index e129eeb..95e130f 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 _0x3014=['isAuthenticated','index','/describe','describe','show','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get'];(function(_0x2921b6,_0xf37d04){var _0x776fe1=function(_0x315487){while(--_0x315487){_0x2921b6['push'](_0x2921b6['shift']());}};_0x776fe1(++_0xf37d04);}(_0x3014,0x1d7));var _0x4301=function(_0xc118c3,_0xc8a09){_0xc118c3=_0xc118c3-0x0;var _0x4e6301=_0x3014[_0xc118c3];return _0x4e6301;};'use strict';var multer=require(_0x4301('0x0'));var util=require(_0x4301('0x1'));var path=require('path');var timeout=require(_0x4301('0x2'));var express=require(_0x4301('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4301('0x4'));var interaction=require(_0x4301('0x5'));var config=require(_0x4301('0x6'));var controller=require(_0x4301('0x7'));router[_0x4301('0x8')]('/',auth[_0x4301('0x9')](),controller[_0x4301('0xa')]);router[_0x4301('0x8')](_0x4301('0xb'),auth[_0x4301('0x9')](),controller[_0x4301('0xc')]);router['get']('/:id',auth[_0x4301('0x9')](),controller[_0x4301('0xd')]);router['post']('/',auth[_0x4301('0x9')](),controller[_0x4301('0xe')]);router[_0x4301('0xf')](_0x4301('0x10'),auth['isAuthenticated'](),controller[_0x4301('0x11')]);router['delete'](_0x4301('0x10'),auth[_0x4301('0x9')](),controller[_0x4301('0x12')]);module[_0x4301('0x13')]=router; \ No newline at end of file +var _0x63c6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util'];(function(_0x10bb87,_0x3d04e3){var _0x4e663f=function(_0x55ec0f){while(--_0x55ec0f){_0x10bb87['push'](_0x10bb87['shift']());}};_0x4e663f(++_0x3d04e3);}(_0x63c6,0xbb));var _0x663c=function(_0x16f84a,_0x58ec15){_0x16f84a=_0x16f84a-0x0;var _0x3217b7=_0x63c6[_0x16f84a];return _0x3217b7;};'use strict';var multer=require(_0x663c('0x0'));var util=require(_0x663c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x663c('0x2'));var router=express[_0x663c('0x3')]();var fs_extra=require(_0x663c('0x4'));var auth=require(_0x663c('0x5'));var interaction=require(_0x663c('0x6'));var config=require(_0x663c('0x7'));var controller=require(_0x663c('0x8'));router[_0x663c('0x9')]('/',auth[_0x663c('0xa')](),controller['index']);router[_0x663c('0x9')](_0x663c('0xb'),auth[_0x663c('0xa')](),controller[_0x663c('0xc')]);router['get'](_0x663c('0xd'),auth['isAuthenticated'](),controller[_0x663c('0xe')]);router['post']('/',auth[_0x663c('0xa')](),controller[_0x663c('0xf')]);router[_0x663c('0x10')](_0x663c('0xd'),auth[_0x663c('0xa')](),controller[_0x663c('0x11')]);router[_0x663c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x663c('0x13')]);module[_0x663c('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 3e27dea..7cda92b 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 _0x46c1=['name','exports','STRING'];(function(_0x411f70,_0x4e9358){var _0x321eec=function(_0xfb48b6){while(--_0xfb48b6){_0x411f70['push'](_0x411f70['shift']());}};_0x321eec(++_0x4e9358);}(_0x46c1,0x7c));var _0x146c=function(_0x5b10a1,_0x3190da){_0x5b10a1=_0x5b10a1-0x0;var _0x6ccca0=_0x46c1[_0x5b10a1];return _0x6ccca0;};'use strict';var Sequelize=require('sequelize');module[_0x146c('0x0')]={'name':{'type':Sequelize[_0x146c('0x1')],'unique':_0x146c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x146c('0x1')]}}; \ No newline at end of file +var _0x17a7=['name','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x17a7,0xc2));var _0x717a=function(_0x32039a,_0x4cc996){_0x32039a=_0x32039a-0x0;var _0x1eac9f=_0x17a7[_0x32039a];return _0x1eac9f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x717a('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x717a('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 2bf8eb2..d71459a 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 _0xbb90=['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','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailSubstatus','fieldName','key','model','query','filters','attributes','intersection','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','fields','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb90,0x1b6));var _0x0bb9=function(_0x5c1cca,_0x4b80db){_0x5c1cca=_0x5c1cca-0x0;var _0x180cec=_0xbb90[_0x5c1cca];return _0x180cec;};'use strict';var pdf=require(_0x0bb9('0x0'));var emlformat=require(_0x0bb9('0x1'));var rimraf=require(_0x0bb9('0x2'));var zipdir=require(_0x0bb9('0x3'));var jsonpatch=require(_0x0bb9('0x4'));var rp=require(_0x0bb9('0x5'));var moment=require(_0x0bb9('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0bb9('0x7'));var path=require(_0x0bb9('0x8'));var sox=require('sox');var csv=require(_0x0bb9('0x9'));var ejs=require(_0x0bb9('0xa'));var fs=require('fs');var fs_extra=require(_0x0bb9('0xb'));var _=require('lodash');var squel=require(_0x0bb9('0xc'));var crypto=require(_0x0bb9('0xd'));var jsforce=require(_0x0bb9('0xe'));var deskjs=require(_0x0bb9('0xf'));var toCsv=require(_0x0bb9('0x9'));var querystring=require('querystring');var Papa=require(_0x0bb9('0x10'));var Redis=require(_0x0bb9('0x11'));var authService=require(_0x0bb9('0x12'));var qs=require(_0x0bb9('0x13'));var as=require(_0x0bb9('0x14'));var hardwareService=require(_0x0bb9('0x15'));var logger=require(_0x0bb9('0x16'))(_0x0bb9('0x17'));var utils=require(_0x0bb9('0x18'));var config=require(_0x0bb9('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25da20,_0x325821){_0x325821=_0x325821||0xcc;return function(_0x225a44){if(_0x225a44){return _0x25da20['sendStatus'](_0x325821);}return _0x25da20[_0x0bb9('0x1a')](_0x325821)[_0x0bb9('0x1b')]();};}function respondWithResult(_0x6fe76d,_0x4f857f){_0x4f857f=_0x4f857f||0xc8;return function(_0x773b0a){if(_0x773b0a){return _0x6fe76d[_0x0bb9('0x1a')](_0x4f857f)[_0x0bb9('0x1c')](_0x773b0a);}};}function respondWithFilteredResult(_0x4c3e8e,_0x1693d8){return function(_0x4c1b94){if(_0x4c1b94){var _0x8da3b6=_0x4c1b94[_0x0bb9('0x1d')],_0x5a1ea5=_0x1693d8[_0x0bb9('0x1e')],_0x1afe51=_0x1693d8[_0x0bb9('0x1e')]+_0x1693d8[_0x0bb9('0x1f')],_0x1936c9;if(_0x1afe51>=_0x8da3b6){_0x1afe51=_0x8da3b6;_0x1936c9=0xc8;}else{_0x1936c9=0xce;}_0x4c3e8e[_0x0bb9('0x1a')](_0x1936c9);return _0x4c3e8e[_0x0bb9('0x20')](_0x0bb9('0x21'),_0x5a1ea5+'-'+_0x1afe51+'/'+_0x8da3b6)[_0x0bb9('0x1c')](_0x4c1b94);}return null;};}function patchUpdates(_0x304ae2){return function(_0x35f4e7){try{jsonpatch['apply'](_0x35f4e7,_0x304ae2,!![]);}catch(_0x28328f){return BPromise[_0x0bb9('0x22')](_0x28328f);}return _0x35f4e7['save']();};}function saveUpdates(_0x3f700f,_0x584b7f){return function(_0x179a75){if(_0x179a75){return _0x179a75[_0x0bb9('0x23')](_0x3f700f)[_0x0bb9('0x24')](function(_0x26314f){return _0x26314f;});}return null;};}function removeEntity(_0x1a6b0e,_0x1fe4f4){return function(_0x52d5a0){if(_0x52d5a0){return _0x52d5a0[_0x0bb9('0x25')]()[_0x0bb9('0x24')](function(){_0x1a6b0e[_0x0bb9('0x1a')](0xcc)[_0x0bb9('0x1b')]();});}};}function handleEntityNotFound(_0x42af70,_0x3c76ee){return function(_0x4fca4b){if(!_0x4fca4b){_0x42af70[_0x0bb9('0x26')](0x194);}return _0x4fca4b;};}function handleError(_0x3645b4,_0xfb02bd){_0xfb02bd=_0xfb02bd||0x1f4;return function(_0x2bfb18){logger[_0x0bb9('0x27')](_0x2bfb18[_0x0bb9('0x28')]);if(_0x2bfb18[_0x0bb9('0x29')]){delete _0x2bfb18[_0x0bb9('0x29')];}_0x3645b4[_0x0bb9('0x1a')](_0xfb02bd)[_0x0bb9('0x2a')](_0x2bfb18);};}exports[_0x0bb9('0x2b')]=function(_0x2c1e98,_0x51d80b){var _0x58b3c7={},_0x246d78={},_0x2afc18={'count':0x0,'rows':[]};var _0x31727b=_[_0x0bb9('0x2c')](db[_0x0bb9('0x2d')]['rawAttributes'],function(_0xd3654){return{'name':_0xd3654[_0x0bb9('0x2e')],'type':_0xd3654['type'][_0x0bb9('0x2f')]};});_0x246d78[_0x0bb9('0x30')]=_['map'](_0x31727b,_0x0bb9('0x29'));_0x246d78[_0x0bb9('0x31')]=_['keys'](_0x2c1e98[_0x0bb9('0x31')]);_0x246d78[_0x0bb9('0x32')]=_['intersection'](_0x246d78[_0x0bb9('0x30')],_0x246d78[_0x0bb9('0x31')]);_0x58b3c7[_0x0bb9('0x33')]=_[_0x0bb9('0x34')](_0x246d78[_0x0bb9('0x30')],qs['fields'](_0x2c1e98[_0x0bb9('0x31')]['fields']));_0x58b3c7[_0x0bb9('0x33')]=_0x58b3c7[_0x0bb9('0x33')][_0x0bb9('0x35')]?_0x58b3c7[_0x0bb9('0x33')]:_0x246d78[_0x0bb9('0x30')];if(!_0x2c1e98[_0x0bb9('0x31')]['hasOwnProperty']('nolimit')){_0x58b3c7[_0x0bb9('0x1f')]=qs[_0x0bb9('0x1f')](_0x2c1e98['query'][_0x0bb9('0x1f')]);_0x58b3c7[_0x0bb9('0x1e')]=qs[_0x0bb9('0x1e')](_0x2c1e98['query'][_0x0bb9('0x1e')]);}_0x58b3c7[_0x0bb9('0x36')]=qs['sort'](_0x2c1e98['query'][_0x0bb9('0x37')]);_0x58b3c7[_0x0bb9('0x38')]=qs[_0x0bb9('0x32')](_[_0x0bb9('0x39')](_0x2c1e98[_0x0bb9('0x31')],_0x246d78[_0x0bb9('0x32')]),_0x31727b);if(_0x2c1e98['query'][_0x0bb9('0x3a')]){_0x58b3c7[_0x0bb9('0x38')]=_[_0x0bb9('0x3b')](_0x58b3c7[_0x0bb9('0x38')],{'$or':_[_0x0bb9('0x2c')](_0x31727b,function(_0x82dff9){if(_0x82dff9[_0x0bb9('0x3c')]!==_0x0bb9('0x3d')){var _0x352e73={};_0x352e73[_0x82dff9[_0x0bb9('0x29')]]={'$like':'%'+_0x2c1e98[_0x0bb9('0x31')][_0x0bb9('0x3a')]+'%'};return _0x352e73;}})});}_0x58b3c7=_[_0x0bb9('0x3b')]({},_0x58b3c7,_0x2c1e98[_0x0bb9('0x3e')]);var _0xe2869a={'where':_0x58b3c7['where']};return db[_0x0bb9('0x2d')][_0x0bb9('0x1d')](_0xe2869a)[_0x0bb9('0x24')](function(_0xb776af){_0x2afc18['count']=_0xb776af;if(_0x2c1e98[_0x0bb9('0x31')][_0x0bb9('0x3f')]){_0x58b3c7[_0x0bb9('0x40')]=[{'all':!![]}];}return db[_0x0bb9('0x2d')]['findAll'](_0x58b3c7);})[_0x0bb9('0x24')](function(_0x79468a){_0x2afc18[_0x0bb9('0x41')]=_0x79468a;return _0x2afc18;})[_0x0bb9('0x24')](respondWithFilteredResult(_0x51d80b,_0x58b3c7))['catch'](handleError(_0x51d80b,null));};exports[_0x0bb9('0x42')]=function(_0x58a42b,_0xd4f479){var _0x3087ab={'raw':!![],'where':{'id':_0x58a42b[_0x0bb9('0x43')]['id']}},_0xa2277a={};_0xa2277a['model']=_[_0x0bb9('0x44')](db[_0x0bb9('0x2d')]['rawAttributes']);_0xa2277a[_0x0bb9('0x31')]=_['keys'](_0x58a42b['query']);_0xa2277a[_0x0bb9('0x32')]=_[_0x0bb9('0x34')](_0xa2277a[_0x0bb9('0x30')],_0xa2277a['query']);_0x3087ab['attributes']=_[_0x0bb9('0x34')](_0xa2277a[_0x0bb9('0x30')],qs[_0x0bb9('0x45')](_0x58a42b[_0x0bb9('0x31')][_0x0bb9('0x45')]));_0x3087ab[_0x0bb9('0x33')]=_0x3087ab[_0x0bb9('0x33')][_0x0bb9('0x35')]?_0x3087ab[_0x0bb9('0x33')]:_0xa2277a[_0x0bb9('0x30')];if(_0x58a42b['query'][_0x0bb9('0x3f')]){_0x3087ab[_0x0bb9('0x40')]=[{'all':!![]}];}_0x3087ab=_[_0x0bb9('0x3b')]({},_0x3087ab,_0x58a42b['options']);return db[_0x0bb9('0x2d')][_0x0bb9('0x46')](_0x3087ab)[_0x0bb9('0x24')](handleEntityNotFound(_0xd4f479,null))['then'](respondWithResult(_0xd4f479,null))[_0x0bb9('0x47')](handleError(_0xd4f479,null));};exports[_0x0bb9('0x48')]=function(_0x7d697c,_0x21455b){return db[_0x0bb9('0x2d')][_0x0bb9('0x48')](_0x7d697c['body'],{})[_0x0bb9('0x24')](respondWithResult(_0x21455b,0xc9))[_0x0bb9('0x47')](handleError(_0x21455b,null));};exports[_0x0bb9('0x23')]=function(_0x2c0665,_0x2cb3d9){if(_0x2c0665[_0x0bb9('0x49')]['id']){delete _0x2c0665[_0x0bb9('0x49')]['id'];}return db[_0x0bb9('0x2d')]['find']({'where':{'id':_0x2c0665[_0x0bb9('0x43')]['id']}})['then'](handleEntityNotFound(_0x2cb3d9,null))[_0x0bb9('0x24')](saveUpdates(_0x2c0665[_0x0bb9('0x49')],null))[_0x0bb9('0x24')](respondWithResult(_0x2cb3d9,null))[_0x0bb9('0x47')](handleError(_0x2cb3d9,null));};exports[_0x0bb9('0x25')]=function(_0x3bdfff,_0x26d4e6){return db[_0x0bb9('0x2d')][_0x0bb9('0x46')]({'where':{'id':_0x3bdfff['params']['id']}})[_0x0bb9('0x24')](handleEntityNotFound(_0x26d4e6,null))[_0x0bb9('0x24')](removeEntity(_0x26d4e6,null))[_0x0bb9('0x47')](handleError(_0x26d4e6,null));};exports[_0x0bb9('0x4a')]=function(_0x323684,_0x342df3){return db[_0x0bb9('0x2d')][_0x0bb9('0x4a')]()['then'](respondWithResult(_0x342df3,null))[_0x0bb9('0x47')](handleError(_0x342df3,null));}; \ No newline at end of file +var _0x1e40=['end','json','count','offset','apply','destroy','sendStatus','error','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x5ba621,_0x555e06){var _0x5ca37e=function(_0x4013e9){while(--_0x4013e9){_0x5ba621['push'](_0x5ba621['shift']());}};_0x5ca37e(++_0x555e06);}(_0x1e40,0x158));var _0x01e4=function(_0x5dccc0,_0x5d5161){_0x5dccc0=_0x5dccc0-0x0;var _0x5690db=_0x1e40[_0x5dccc0];return _0x5690db;};'use strict';var pdf=require(_0x01e4('0x0'));var emlformat=require(_0x01e4('0x1'));var rimraf=require(_0x01e4('0x2'));var zipdir=require(_0x01e4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x01e4('0x4'));var moment=require(_0x01e4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x01e4('0x6'));var util=require(_0x01e4('0x7'));var path=require(_0x01e4('0x8'));var sox=require(_0x01e4('0x9'));var csv=require(_0x01e4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x01e4('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x01e4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x01e4('0xd'));var Papa=require(_0x01e4('0xe'));var Redis=require(_0x01e4('0xf'));var authService=require(_0x01e4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x01e4('0x11'));var hardwareService=require(_0x01e4('0x12'));var logger=require(_0x01e4('0x13'))(_0x01e4('0x14'));var utils=require(_0x01e4('0x15'));var config=require(_0x01e4('0x16'));var licenseUtil=require(_0x01e4('0x17'));var db=require(_0x01e4('0x18'))['db'];function respondWithStatusCode(_0x5ec088,_0x4967ea){_0x4967ea=_0x4967ea||0xcc;return function(_0x9faad4){if(_0x9faad4){return _0x5ec088['sendStatus'](_0x4967ea);}return _0x5ec088[_0x01e4('0x19')](_0x4967ea)[_0x01e4('0x1a')]();};}function respondWithResult(_0x5cf655,_0x30b47a){_0x30b47a=_0x30b47a||0xc8;return function(_0x4e8930){if(_0x4e8930){return _0x5cf655['status'](_0x30b47a)[_0x01e4('0x1b')](_0x4e8930);}};}function respondWithFilteredResult(_0x2aafc8,_0x33b9c6){return function(_0x168a3f){if(_0x168a3f){var _0x30db0f=_0x168a3f[_0x01e4('0x1c')],_0x23bdc4=_0x33b9c6[_0x01e4('0x1d')],_0x172534=_0x33b9c6[_0x01e4('0x1d')]+_0x33b9c6['limit'],_0x1454c8;if(_0x172534>=_0x30db0f){_0x172534=_0x30db0f;_0x1454c8=0xc8;}else{_0x1454c8=0xce;}_0x2aafc8[_0x01e4('0x19')](_0x1454c8);return _0x2aafc8['set']('Content-Range',_0x23bdc4+'-'+_0x172534+'/'+_0x30db0f)['json'](_0x168a3f);}return null;};}function patchUpdates(_0x34ec87){return function(_0x5267f9){try{jsonpatch[_0x01e4('0x1e')](_0x5267f9,_0x34ec87,!![]);}catch(_0xf1e9cd){return BPromise['reject'](_0xf1e9cd);}return _0x5267f9['save']();};}function saveUpdates(_0x3c2922,_0x4dcf7f){return function(_0xf34c0){if(_0xf34c0){return _0xf34c0['update'](_0x3c2922)['then'](function(_0x3aa4e6){return _0x3aa4e6;});}return null;};}function removeEntity(_0x5c3749,_0x457878){return function(_0x36026a){if(_0x36026a){return _0x36026a[_0x01e4('0x1f')]()['then'](function(){_0x5c3749[_0x01e4('0x19')](0xcc)[_0x01e4('0x1a')]();});}};}function handleEntityNotFound(_0xfcbb5c,_0x2cf84e){return function(_0xdbcd8f){if(!_0xdbcd8f){_0xfcbb5c[_0x01e4('0x20')](0x194);}return _0xdbcd8f;};}function handleError(_0x4a7ee7,_0x544bd0){_0x544bd0=_0x544bd0||0x1f4;return function(_0x5dd3c4){logger[_0x01e4('0x21')](_0x5dd3c4['stack']);if(_0x5dd3c4[_0x01e4('0x22')]){delete _0x5dd3c4['name'];}_0x4a7ee7[_0x01e4('0x19')](_0x544bd0)[_0x01e4('0x23')](_0x5dd3c4);};}exports[_0x01e4('0x24')]=function(_0x4ad69d,_0x436fd9){var _0x9b4948={},_0x5208a0={},_0x32aa57={'count':0x0,'rows':[]};var _0x394870=_[_0x01e4('0x25')](db[_0x01e4('0x26')][_0x01e4('0x27')],function(_0xbbcd69){return{'name':_0xbbcd69[_0x01e4('0x28')],'type':_0xbbcd69[_0x01e4('0x29')][_0x01e4('0x2a')]};});_0x5208a0[_0x01e4('0x2b')]=_['map'](_0x394870,_0x01e4('0x22'));_0x5208a0[_0x01e4('0x2c')]=_[_0x01e4('0x2d')](_0x4ad69d[_0x01e4('0x2c')]);_0x5208a0[_0x01e4('0x2e')]=_[_0x01e4('0x2f')](_0x5208a0[_0x01e4('0x2b')],_0x5208a0[_0x01e4('0x2c')]);_0x9b4948[_0x01e4('0x30')]=_[_0x01e4('0x2f')](_0x5208a0['model'],qs[_0x01e4('0x31')](_0x4ad69d[_0x01e4('0x2c')][_0x01e4('0x31')]));_0x9b4948['attributes']=_0x9b4948[_0x01e4('0x30')][_0x01e4('0x32')]?_0x9b4948[_0x01e4('0x30')]:_0x5208a0[_0x01e4('0x2b')];if(!_0x4ad69d[_0x01e4('0x2c')][_0x01e4('0x33')](_0x01e4('0x34'))){_0x9b4948[_0x01e4('0x35')]=qs[_0x01e4('0x35')](_0x4ad69d[_0x01e4('0x2c')][_0x01e4('0x35')]);_0x9b4948[_0x01e4('0x1d')]=qs[_0x01e4('0x1d')](_0x4ad69d[_0x01e4('0x2c')][_0x01e4('0x1d')]);}_0x9b4948['order']=qs['sort'](_0x4ad69d[_0x01e4('0x2c')][_0x01e4('0x36')]);_0x9b4948[_0x01e4('0x37')]=qs[_0x01e4('0x2e')](_[_0x01e4('0x38')](_0x4ad69d['query'],_0x5208a0[_0x01e4('0x2e')]),_0x394870);if(_0x4ad69d['query'][_0x01e4('0x39')]){_0x9b4948['where']=_['merge'](_0x9b4948['where'],{'$or':_[_0x01e4('0x25')](_0x394870,function(_0x2d7f15){if(_0x2d7f15[_0x01e4('0x29')]!==_0x01e4('0x3a')){var _0x6c6502={};_0x6c6502[_0x2d7f15[_0x01e4('0x22')]]={'$like':'%'+_0x4ad69d['query']['filter']+'%'};return _0x6c6502;}})});}_0x9b4948=_[_0x01e4('0x3b')]({},_0x9b4948,_0x4ad69d[_0x01e4('0x3c')]);var _0x5138f1={'where':_0x9b4948[_0x01e4('0x37')]};return db['MailSubstatus'][_0x01e4('0x1c')](_0x5138f1)[_0x01e4('0x3d')](function(_0x280312){_0x32aa57['count']=_0x280312;if(_0x4ad69d[_0x01e4('0x2c')][_0x01e4('0x3e')]){_0x9b4948[_0x01e4('0x3f')]=[{'all':!![]}];}return db[_0x01e4('0x26')][_0x01e4('0x40')](_0x9b4948);})[_0x01e4('0x3d')](function(_0x187b29){_0x32aa57[_0x01e4('0x41')]=_0x187b29;return _0x32aa57;})[_0x01e4('0x3d')](respondWithFilteredResult(_0x436fd9,_0x9b4948))[_0x01e4('0x42')](handleError(_0x436fd9,null));};exports[_0x01e4('0x43')]=function(_0x35d755,_0x2a6009){var _0x161ef5={'raw':!![],'where':{'id':_0x35d755[_0x01e4('0x44')]['id']}},_0x2432be={};_0x2432be[_0x01e4('0x2b')]=_[_0x01e4('0x2d')](db[_0x01e4('0x26')]['rawAttributes']);_0x2432be[_0x01e4('0x2c')]=_[_0x01e4('0x2d')](_0x35d755[_0x01e4('0x2c')]);_0x2432be[_0x01e4('0x2e')]=_[_0x01e4('0x2f')](_0x2432be['model'],_0x2432be[_0x01e4('0x2c')]);_0x161ef5[_0x01e4('0x30')]=_[_0x01e4('0x2f')](_0x2432be['model'],qs[_0x01e4('0x31')](_0x35d755[_0x01e4('0x2c')]['fields']));_0x161ef5[_0x01e4('0x30')]=_0x161ef5['attributes'][_0x01e4('0x32')]?_0x161ef5[_0x01e4('0x30')]:_0x2432be[_0x01e4('0x2b')];if(_0x35d755['query'][_0x01e4('0x3e')]){_0x161ef5['include']=[{'all':!![]}];}_0x161ef5=_['merge']({},_0x161ef5,_0x35d755[_0x01e4('0x3c')]);return db[_0x01e4('0x26')][_0x01e4('0x45')](_0x161ef5)['then'](handleEntityNotFound(_0x2a6009,null))[_0x01e4('0x3d')](respondWithResult(_0x2a6009,null))[_0x01e4('0x42')](handleError(_0x2a6009,null));};exports[_0x01e4('0x46')]=function(_0x4d1f0f,_0x3fc37a){return db[_0x01e4('0x26')][_0x01e4('0x46')](_0x4d1f0f[_0x01e4('0x47')],{})[_0x01e4('0x3d')](respondWithResult(_0x3fc37a,0xc9))[_0x01e4('0x42')](handleError(_0x3fc37a,null));};exports[_0x01e4('0x48')]=function(_0x5bee09,_0x542f3d){if(_0x5bee09[_0x01e4('0x47')]['id']){delete _0x5bee09['body']['id'];}return db[_0x01e4('0x26')][_0x01e4('0x45')]({'where':{'id':_0x5bee09[_0x01e4('0x44')]['id']}})[_0x01e4('0x3d')](handleEntityNotFound(_0x542f3d,null))[_0x01e4('0x3d')](saveUpdates(_0x5bee09[_0x01e4('0x47')],null))[_0x01e4('0x3d')](respondWithResult(_0x542f3d,null))[_0x01e4('0x42')](handleError(_0x542f3d,null));};exports[_0x01e4('0x1f')]=function(_0x1934bc,_0x4e532a){return db['MailSubstatus']['find']({'where':{'id':_0x1934bc[_0x01e4('0x44')]['id']}})[_0x01e4('0x3d')](handleEntityNotFound(_0x4e532a,null))['then'](removeEntity(_0x4e532a,null))[_0x01e4('0x42')](handleError(_0x4e532a,null));};exports[_0x01e4('0x49')]=function(_0x139bfc,_0x363299){return db[_0x01e4('0x26')][_0x01e4('0x49')]()['then'](respondWithResult(_0x363299,null))[_0x01e4('0x42')](handleError(_0x363299,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index bef4d2c..03f3cbf 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 _0xbbdd=['mail_substatuses','util','api','moment','rimraf','exports','define'];(function(_0x285d9f,_0x5900fa){var _0x333b6a=function(_0x5d06d3){while(--_0x5d06d3){_0x285d9f['push'](_0x285d9f['shift']());}};_0x333b6a(++_0x5900fa);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xbbdd[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require(_0xdbbd('0x0'));var logger=require('../../config/logger')(_0xdbbd('0x1'));var moment=require(_0xdbbd('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdbbd('0x3'));var config=require('../../config/environment');var attributes=require('./mailSubstatus.attributes');module[_0xdbbd('0x4')]=function(_0x103977,_0x3e81aa){return _0x103977[_0xdbbd('0x5')]('MailSubstatus',attributes,{'tableName':_0xdbbd('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32b6=['moment','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','util','api'];(function(_0x11ace8,_0x42f70e){var _0x195dd8=function(_0x4f146e){while(--_0x4f146e){_0x11ace8['push'](_0x11ace8['shift']());}};_0x195dd8(++_0x42f70e);}(_0x32b6,0x1d1));var _0x632b=function(_0x2eef2e,_0x4e3ef7){_0x2eef2e=_0x2eef2e-0x0;var _0x1717ee=_0x32b6[_0x2eef2e];return _0x1717ee;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var logger=require('../../config/logger')(_0x632b('0x2'));var moment=require(_0x632b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x632b('0x4'));var rimraf=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var attributes=require(_0x632b('0x7'));module[_0x632b('0x8')]=function(_0x122768,_0x24ceab){return _0x122768[_0x632b('0x9')](_0x632b('0xa'),attributes,{'tableName':_0x632b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 6a3573c..3aac19d 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 _0x6f7a=['http','request','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3de822,_0x5d1466){var _0x1475c9=function(_0x38d50b){while(--_0x38d50b){_0x3de822['push'](_0x3de822['shift']());}};_0x1475c9(++_0x5d1466);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x268e38,_0x43b717){_0x268e38=_0x268e38-0x0;var _0x288c82=_0x6f7a[_0x268e38];return _0x288c82;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var BPromise=require(_0xa6f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6f7('0x4'));var db=require(_0xa6f7('0x5'))['db'];var utils=require(_0xa6f7('0x6'));var logger=require(_0xa6f7('0x7'))(_0xa6f7('0x8'));var config=require(_0xa6f7('0x9'));var jayson=require(_0xa6f7('0xa'));var client=jayson[_0xa6f7('0xb')][_0xa6f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x335aaa,_0x1a06d1,_0x481a8c){return new BPromise(function(_0x4b4f9e,_0x30f2a7){return client[_0xa6f7('0xd')](_0x335aaa,_0x481a8c)[_0xa6f7('0xe')](function(_0x362404){logger[_0xa6f7('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x1a06d1,'request\x20sent');logger[_0xa6f7('0x10')](_0xa6f7('0x11'),_0x1a06d1,'request\x20sent',JSON[_0xa6f7('0x12')](_0x362404));if(_0x362404['error']){if(_0x362404[_0xa6f7('0x13')][_0xa6f7('0x14')]===0x1f4){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x30f2a7(_0x362404['error'][_0xa6f7('0x16')]);}logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x4b4f9e(_0x362404['error'][_0xa6f7('0x16')]);}else{logger['info'](_0xa6f7('0x15'),_0x1a06d1,_0xa6f7('0x17'));_0x4b4f9e(_0x362404[_0xa6f7('0x18')]['message']);}})[_0xa6f7('0x19')](function(_0x22635e){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x22635e);_0x30f2a7(_0x22635e);});});} \ No newline at end of file +var _0x0a9a=['MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x414901,_0x20ee6a){var _0x2cae72=function(_0x1f13bc){while(--_0x1f13bc){_0x414901['push'](_0x414901['shift']());}};_0x2cae72(++_0x20ee6a);}(_0x0a9a,0x183));var _0xa0a9=function(_0x5915f1,_0x458518){_0x5915f1=_0x5915f1-0x0;var _0x1ec360=_0x0a9a[_0x5915f1];return _0x1ec360;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index ba5f937..061fa0a 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 _0x9990=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','update','destroy','exports','util'];(function(_0x5083e4,_0x2e0e8d){var _0x1cc433=function(_0x20ec84){while(--_0x20ec84){_0x5083e4['push'](_0x5083e4['shift']());}};_0x1cc433(++_0x2e0e8d);}(_0x9990,0xf6));var _0x0999=function(_0x1174d3,_0x17fe65){_0x1174d3=_0x1174d3-0x0;var _0xb58ebd=_0x9990[_0x1174d3];return _0xb58ebd;};'use strict';var multer=require('multer');var util=require(_0x0999('0x0'));var path=require(_0x0999('0x1'));var timeout=require(_0x0999('0x2'));var express=require(_0x0999('0x3'));var router=express[_0x0999('0x4')]();var fs_extra=require(_0x0999('0x5'));var auth=require(_0x0999('0x6'));var interaction=require(_0x0999('0x7'));var config=require('../../config/environment');var controller=require(_0x0999('0x8'));router[_0x0999('0x9')]('/',auth[_0x0999('0xa')](),controller['index']);router[_0x0999('0x9')](_0x0999('0xb'),auth[_0x0999('0xa')](),controller[_0x0999('0xc')]);router[_0x0999('0x9')](_0x0999('0xd'),auth[_0x0999('0xa')](),controller['show']);router[_0x0999('0xe')]('/',auth[_0x0999('0xa')](),controller[_0x0999('0xf')]);router['put'](_0x0999('0xd'),auth[_0x0999('0xa')](),controller[_0x0999('0x10')]);router['delete'](_0x0999('0xd'),auth['isAuthenticated'](),controller[_0x0999('0x11')]);module[_0x0999('0x12')]=router; \ No newline at end of file +var _0x584a=['connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','multer','util'];(function(_0xf38f90,_0x4f26f7){var _0x3c00e6=function(_0x114f41){while(--_0x114f41){_0xf38f90['push'](_0xf38f90['shift']());}};_0x3c00e6(++_0x4f26f7);}(_0x584a,0x1c0));var _0xa584=function(_0x3d9312,_0x3363fc){_0x3d9312=_0x3d9312-0x0;var _0x3a0a42=_0x584a[_0x3d9312];return _0x3a0a42;};'use strict';var multer=require(_0xa584('0x0'));var util=require(_0xa584('0x1'));var path=require('path');var timeout=require(_0xa584('0x2'));var express=require(_0xa584('0x3'));var router=express[_0xa584('0x4')]();var fs_extra=require(_0xa584('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa584('0x6'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xa584('0x7')](),controller[_0xa584('0x8')]);router['get'](_0xa584('0x9'),auth[_0xa584('0x7')](),controller['describe']);router['get']('/:id',auth[_0xa584('0x7')](),controller[_0xa584('0xa')]);router[_0xa584('0xb')]('/',auth[_0xa584('0x7')](),controller[_0xa584('0xc')]);router[_0xa584('0xd')](_0xa584('0xe'),auth[_0xa584('0x7')](),controller[_0xa584('0xf')]);router[_0xa584('0x10')](_0xa584('0xe'),auth[_0xa584('0x7')](),controller[_0xa584('0x11')]);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 73d4e70..8f5dd6c 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 _0xcd6c=['queue','DATE','NOW','moment','account','agent'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xcd6c,0xd5));var _0xccd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6c[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xccd6('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xccd6('0x1'),_0xccd6('0x2'),_0xccd6('0x3')),'allowNull':![],'defaultValue':_0xccd6('0x3')},'transferredAt':{'type':Sequelize[_0xccd6('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xccd6('0x5')]}}; \ No newline at end of file +var _0x8cd1=['moment','exports','STRING','account','agent','queue','DATE','NOW'];(function(_0x497922,_0x4b1243){var _0xcc1c1d=function(_0x247b6e){while(--_0x247b6e){_0x497922['push'](_0x497922['shift']());}};_0xcc1c1d(++_0x4b1243);}(_0x8cd1,0xe8));var _0x18cd=function(_0x440028,_0x4a6d2c){_0x440028=_0x440028-0x0;var _0x56e580=_0x8cd1[_0x440028];return _0x56e580;};'use strict';var moment=require(_0x18cd('0x0'));var Sequelize=require('sequelize');module[_0x18cd('0x1')]={'uniqueid':{'type':Sequelize[_0x18cd('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x18cd('0x3'),_0x18cd('0x4'),_0x18cd('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x18cd('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x18cd('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index a0b952a..f49ee28 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 _0xb22a=['model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','apply','reject','then','destroy','end','sendStatus','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','key'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0xb22a,0x1ee));var _0xab22=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0xb22a[_0x420513];return _0x1b44ec;};'use strict';var pdf=require(_0xab22('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xab22('0x1'));var zipdir=require(_0xab22('0x2'));var jsonpatch=require(_0xab22('0x3'));var rp=require('request-promise');var moment=require(_0xab22('0x4'));var BPromise=require(_0xab22('0x5'));var Mustache=require(_0xab22('0x6'));var util=require('util');var path=require(_0xab22('0x7'));var sox=require('sox');var csv=require(_0xab22('0x8'));var ejs=require(_0xab22('0x9'));var fs=require('fs');var fs_extra=require(_0xab22('0xa'));var _=require('lodash');var squel=require(_0xab22('0xb'));var crypto=require(_0xab22('0xc'));var jsforce=require(_0xab22('0xd'));var deskjs=require(_0xab22('0xe'));var toCsv=require(_0xab22('0x8'));var querystring=require('querystring');var Papa=require(_0xab22('0xf'));var Redis=require(_0xab22('0x10'));var authService=require(_0xab22('0x11'));var qs=require(_0xab22('0x12'));var as=require(_0xab22('0x13'));var hardwareService=require(_0xab22('0x14'));var logger=require(_0xab22('0x15'))(_0xab22('0x16'));var utils=require(_0xab22('0x17'));var config=require(_0xab22('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xab22('0x19'))['db'];function respondWithStatusCode(_0x52feb8,_0x2d0440){_0x2d0440=_0x2d0440||0xcc;return function(_0x164da5){if(_0x164da5){return _0x52feb8['sendStatus'](_0x2d0440);}return _0x52feb8[_0xab22('0x1a')](_0x2d0440)['end']();};}function respondWithResult(_0x350878,_0x5967a9){_0x5967a9=_0x5967a9||0xc8;return function(_0x1de4e4){if(_0x1de4e4){return _0x350878[_0xab22('0x1a')](_0x5967a9)[_0xab22('0x1b')](_0x1de4e4);}};}function respondWithFilteredResult(_0x402d56,_0xb31941){return function(_0x5d4e01){if(_0x5d4e01){var _0x4a9cb0=_0x5d4e01['count'],_0x4a6f4a=_0xb31941[_0xab22('0x1c')],_0x57ce78=_0xb31941[_0xab22('0x1c')]+_0xb31941[_0xab22('0x1d')],_0x15f038;if(_0x57ce78>=_0x4a9cb0){_0x57ce78=_0x4a9cb0;_0x15f038=0xc8;}else{_0x15f038=0xce;}_0x402d56[_0xab22('0x1a')](_0x15f038);return _0x402d56['set']('Content-Range',_0x4a6f4a+'-'+_0x57ce78+'/'+_0x4a9cb0)[_0xab22('0x1b')](_0x5d4e01);}return null;};}function patchUpdates(_0x7c1d97){return function(_0x27b882){try{jsonpatch[_0xab22('0x1e')](_0x27b882,_0x7c1d97,!![]);}catch(_0x355489){return BPromise[_0xab22('0x1f')](_0x355489);}return _0x27b882['save']();};}function saveUpdates(_0x2ef31c,_0x53cf14){return function(_0x10b601){if(_0x10b601){return _0x10b601['update'](_0x2ef31c)[_0xab22('0x20')](function(_0x504513){return _0x504513;});}return null;};}function removeEntity(_0x5a32f4,_0xee4a79){return function(_0x10bbeb){if(_0x10bbeb){return _0x10bbeb[_0xab22('0x21')]()['then'](function(){_0x5a32f4[_0xab22('0x1a')](0xcc)[_0xab22('0x22')]();});}};}function handleEntityNotFound(_0x50ccc1,_0x1fba0e){return function(_0x36661b){if(!_0x36661b){_0x50ccc1[_0xab22('0x23')](0x194);}return _0x36661b;};}function handleError(_0x2c8aae,_0x211c61){_0x211c61=_0x211c61||0x1f4;return function(_0x1b72a6){logger[_0xab22('0x24')](_0x1b72a6[_0xab22('0x25')]);if(_0x1b72a6['name']){delete _0x1b72a6[_0xab22('0x26')];}_0x2c8aae[_0xab22('0x1a')](_0x211c61)[_0xab22('0x27')](_0x1b72a6);};}exports[_0xab22('0x28')]=function(_0x475409,_0x48e829){var _0x11947b={},_0x56e58e={},_0x9a0f32={'count':0x0,'rows':[]};var _0x591e78=_['map'](db[_0xab22('0x29')][_0xab22('0x2a')],function(_0xa3d878){return{'name':_0xa3d878[_0xab22('0x2b')],'type':_0xa3d878['type'][_0xab22('0x2c')]};});_0x56e58e[_0xab22('0x2d')]=_[_0xab22('0x2e')](_0x591e78,_0xab22('0x26'));_0x56e58e[_0xab22('0x2f')]=_[_0xab22('0x30')](_0x475409[_0xab22('0x2f')]);_0x56e58e[_0xab22('0x31')]=_[_0xab22('0x32')](_0x56e58e[_0xab22('0x2d')],_0x56e58e[_0xab22('0x2f')]);_0x11947b[_0xab22('0x33')]=_[_0xab22('0x32')](_0x56e58e[_0xab22('0x2d')],qs[_0xab22('0x34')](_0x475409[_0xab22('0x2f')]['fields']));_0x11947b[_0xab22('0x33')]=_0x11947b['attributes'][_0xab22('0x35')]?_0x11947b[_0xab22('0x33')]:_0x56e58e['model'];if(!_0x475409[_0xab22('0x2f')][_0xab22('0x36')](_0xab22('0x37'))){_0x11947b[_0xab22('0x1d')]=qs['limit'](_0x475409[_0xab22('0x2f')]['limit']);_0x11947b[_0xab22('0x1c')]=qs[_0xab22('0x1c')](_0x475409[_0xab22('0x2f')][_0xab22('0x1c')]);}_0x11947b['order']=qs[_0xab22('0x38')](_0x475409['query']['sort']);_0x11947b['where']=qs['filters'](_[_0xab22('0x39')](_0x475409[_0xab22('0x2f')],_0x56e58e[_0xab22('0x31')]),_0x591e78);if(_0x475409[_0xab22('0x2f')][_0xab22('0x3a')]){_0x11947b['where']=_['merge'](_0x11947b[_0xab22('0x3b')],{'$or':_[_0xab22('0x2e')](_0x591e78,function(_0x4b5de1){if(_0x4b5de1[_0xab22('0x3c')]!==_0xab22('0x3d')){var _0x5ebd8a={};_0x5ebd8a[_0x4b5de1[_0xab22('0x26')]]={'$like':'%'+_0x475409[_0xab22('0x2f')]['filter']+'%'};return _0x5ebd8a;}})});}_0x11947b=_[_0xab22('0x3e')]({},_0x11947b,_0x475409[_0xab22('0x3f')]);var _0x2988c2={'where':_0x11947b[_0xab22('0x3b')]};return db[_0xab22('0x29')]['count'](_0x2988c2)[_0xab22('0x20')](function(_0xeaeaa0){_0x9a0f32[_0xab22('0x40')]=_0xeaeaa0;if(_0x475409[_0xab22('0x2f')][_0xab22('0x41')]){_0x11947b['include']=[{'all':!![]}];}return db['MailTransferReport'][_0xab22('0x42')](_0x11947b);})['then'](function(_0x2fd9c4){_0x9a0f32[_0xab22('0x43')]=_0x2fd9c4;return _0x9a0f32;})['then'](respondWithFilteredResult(_0x48e829,_0x11947b))[_0xab22('0x44')](handleError(_0x48e829,null));};exports[_0xab22('0x45')]=function(_0x187c94,_0x5da135){var _0x343095={'raw':!![],'where':{'id':_0x187c94[_0xab22('0x46')]['id']}},_0x5d4caa={};_0x5d4caa['model']=_[_0xab22('0x30')](db[_0xab22('0x29')][_0xab22('0x2a')]);_0x5d4caa[_0xab22('0x2f')]=_[_0xab22('0x30')](_0x187c94[_0xab22('0x2f')]);_0x5d4caa['filters']=_[_0xab22('0x32')](_0x5d4caa[_0xab22('0x2d')],_0x5d4caa[_0xab22('0x2f')]);_0x343095[_0xab22('0x33')]=_['intersection'](_0x5d4caa[_0xab22('0x2d')],qs[_0xab22('0x34')](_0x187c94[_0xab22('0x2f')][_0xab22('0x34')]));_0x343095[_0xab22('0x33')]=_0x343095[_0xab22('0x33')][_0xab22('0x35')]?_0x343095[_0xab22('0x33')]:_0x5d4caa[_0xab22('0x2d')];if(_0x187c94[_0xab22('0x2f')][_0xab22('0x41')]){_0x343095[_0xab22('0x47')]=[{'all':!![]}];}_0x343095=_['merge']({},_0x343095,_0x187c94[_0xab22('0x3f')]);return db[_0xab22('0x29')][_0xab22('0x48')](_0x343095)[_0xab22('0x20')](handleEntityNotFound(_0x5da135,null))[_0xab22('0x20')](respondWithResult(_0x5da135,null))['catch'](handleError(_0x5da135,null));};exports[_0xab22('0x49')]=function(_0x30aed8,_0x4bb3e2){return db[_0xab22('0x29')]['create'](_0x30aed8[_0xab22('0x4a')],{})['then'](respondWithResult(_0x4bb3e2,0xc9))[_0xab22('0x44')](handleError(_0x4bb3e2,null));};exports[_0xab22('0x4b')]=function(_0x351f4b,_0x291d7c){if(_0x351f4b['body']['id']){delete _0x351f4b[_0xab22('0x4a')]['id'];}return db[_0xab22('0x29')][_0xab22('0x48')]({'where':{'id':_0x351f4b[_0xab22('0x46')]['id']}})[_0xab22('0x20')](handleEntityNotFound(_0x291d7c,null))[_0xab22('0x20')](saveUpdates(_0x351f4b[_0xab22('0x4a')],null))[_0xab22('0x20')](respondWithResult(_0x291d7c,null))[_0xab22('0x44')](handleError(_0x291d7c,null));};exports[_0xab22('0x21')]=function(_0x420a9,_0x32fa79){return db[_0xab22('0x29')][_0xab22('0x48')]({'where':{'id':_0x420a9[_0xab22('0x46')]['id']}})[_0xab22('0x20')](handleEntityNotFound(_0x32fa79,null))[_0xab22('0x20')](removeEntity(_0x32fa79,null))['catch'](handleError(_0x32fa79,null));};exports[_0xab22('0x4c')]=function(_0x52d60d,_0x55491a){return db[_0xab22('0x29')][_0xab22('0x4c')]()[_0xab22('0x20')](respondWithResult(_0x55491a,null))[_0xab22('0x44')](handleError(_0x55491a,null));}; \ No newline at end of file +var _0x0284=['rawAttributes','fieldName','type','key','map','name','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','keys','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','update','then','destroy','error','stack','MailTransferReport'];(function(_0x474035,_0x41e639){var _0x1b58e0=function(_0x91b15c){while(--_0x91b15c){_0x474035['push'](_0x474035['shift']());}};_0x1b58e0(++_0x41e639);}(_0x0284,0xff));var _0x4028=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0x0284[_0x5d5bcb];return _0x4ea5eb;};'use strict';var pdf=require(_0x4028('0x0'));var emlformat=require(_0x4028('0x1'));var rimraf=require(_0x4028('0x2'));var zipdir=require(_0x4028('0x3'));var jsonpatch=require(_0x4028('0x4'));var rp=require(_0x4028('0x5'));var moment=require('moment');var BPromise=require(_0x4028('0x6'));var Mustache=require('mustache');var util=require(_0x4028('0x7'));var path=require(_0x4028('0x8'));var sox=require(_0x4028('0x9'));var csv=require(_0x4028('0xa'));var ejs=require(_0x4028('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4028('0xc'));var squel=require(_0x4028('0xd'));var crypto=require(_0x4028('0xe'));var jsforce=require(_0x4028('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4028('0xa'));var querystring=require(_0x4028('0x10'));var Papa=require(_0x4028('0x11'));var Redis=require('ioredis');var authService=require(_0x4028('0x12'));var qs=require(_0x4028('0x13'));var as=require(_0x4028('0x14'));var hardwareService=require(_0x4028('0x15'));var logger=require(_0x4028('0x16'))(_0x4028('0x17'));var utils=require(_0x4028('0x18'));var config=require(_0x4028('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x4028('0x1a'))['db'];function respondWithStatusCode(_0x1b05d3,_0xfebb42){_0xfebb42=_0xfebb42||0xcc;return function(_0x43da46){if(_0x43da46){return _0x1b05d3[_0x4028('0x1b')](_0xfebb42);}return _0x1b05d3[_0x4028('0x1c')](_0xfebb42)[_0x4028('0x1d')]();};}function respondWithResult(_0x10574f,_0x21f5ad){_0x21f5ad=_0x21f5ad||0xc8;return function(_0x3771f2){if(_0x3771f2){return _0x10574f[_0x4028('0x1c')](_0x21f5ad)[_0x4028('0x1e')](_0x3771f2);}};}function respondWithFilteredResult(_0x17e313,_0x439a32){return function(_0x50eaa0){if(_0x50eaa0){var _0x189733=_0x50eaa0[_0x4028('0x1f')],_0x56991f=_0x439a32['offset'],_0x875fc8=_0x439a32[_0x4028('0x20')]+_0x439a32[_0x4028('0x21')],_0x35e4da;if(_0x875fc8>=_0x189733){_0x875fc8=_0x189733;_0x35e4da=0xc8;}else{_0x35e4da=0xce;}_0x17e313['status'](_0x35e4da);return _0x17e313['set']('Content-Range',_0x56991f+'-'+_0x875fc8+'/'+_0x189733)['json'](_0x50eaa0);}return null;};}function patchUpdates(_0x57db7c){return function(_0x5b8e2d){try{jsonpatch['apply'](_0x5b8e2d,_0x57db7c,!![]);}catch(_0x44382d){return BPromise[_0x4028('0x22')](_0x44382d);}return _0x5b8e2d['save']();};}function saveUpdates(_0x5c04bc,_0x459ab9){return function(_0x52a5f8){if(_0x52a5f8){return _0x52a5f8[_0x4028('0x23')](_0x5c04bc)[_0x4028('0x24')](function(_0x2ce4de){return _0x2ce4de;});}return null;};}function removeEntity(_0x6d40a0,_0x4c1d80){return function(_0x11493e){if(_0x11493e){return _0x11493e[_0x4028('0x25')]()[_0x4028('0x24')](function(){_0x6d40a0['status'](0xcc)[_0x4028('0x1d')]();});}};}function handleEntityNotFound(_0x1228b4,_0x4aa327){return function(_0x1ccab4){if(!_0x1ccab4){_0x1228b4['sendStatus'](0x194);}return _0x1ccab4;};}function handleError(_0x14fe30,_0x3d03c8){_0x3d03c8=_0x3d03c8||0x1f4;return function(_0x229337){logger[_0x4028('0x26')](_0x229337[_0x4028('0x27')]);if(_0x229337['name']){delete _0x229337['name'];}_0x14fe30['status'](_0x3d03c8)['send'](_0x229337);};}exports['index']=function(_0x2cb54f,_0x1406b4){var _0xbd80d2={},_0x295383={},_0x100930={'count':0x0,'rows':[]};var _0x5c7b33=_['map'](db[_0x4028('0x28')][_0x4028('0x29')],function(_0xb814c){return{'name':_0xb814c[_0x4028('0x2a')],'type':_0xb814c[_0x4028('0x2b')][_0x4028('0x2c')]};});_0x295383['model']=_[_0x4028('0x2d')](_0x5c7b33,_0x4028('0x2e'));_0x295383[_0x4028('0x2f')]=_['keys'](_0x2cb54f[_0x4028('0x2f')]);_0x295383[_0x4028('0x30')]=_['intersection'](_0x295383[_0x4028('0x31')],_0x295383['query']);_0xbd80d2['attributes']=_[_0x4028('0x32')](_0x295383[_0x4028('0x31')],qs[_0x4028('0x33')](_0x2cb54f[_0x4028('0x2f')][_0x4028('0x33')]));_0xbd80d2[_0x4028('0x34')]=_0xbd80d2['attributes'][_0x4028('0x35')]?_0xbd80d2[_0x4028('0x34')]:_0x295383[_0x4028('0x31')];if(!_0x2cb54f['query'][_0x4028('0x36')](_0x4028('0x37'))){_0xbd80d2[_0x4028('0x21')]=qs['limit'](_0x2cb54f['query'][_0x4028('0x21')]);_0xbd80d2[_0x4028('0x20')]=qs['offset'](_0x2cb54f[_0x4028('0x2f')][_0x4028('0x20')]);}_0xbd80d2[_0x4028('0x38')]=qs[_0x4028('0x39')](_0x2cb54f[_0x4028('0x2f')]['sort']);_0xbd80d2['where']=qs['filters'](_[_0x4028('0x3a')](_0x2cb54f[_0x4028('0x2f')],_0x295383[_0x4028('0x30')]),_0x5c7b33);if(_0x2cb54f['query'][_0x4028('0x3b')]){_0xbd80d2[_0x4028('0x3c')]=_[_0x4028('0x3d')](_0xbd80d2['where'],{'$or':_[_0x4028('0x2d')](_0x5c7b33,function(_0x534064){if(_0x534064['type']!==_0x4028('0x3e')){var _0xa7f4b9={};_0xa7f4b9[_0x534064[_0x4028('0x2e')]]={'$like':'%'+_0x2cb54f[_0x4028('0x2f')][_0x4028('0x3b')]+'%'};return _0xa7f4b9;}})});}_0xbd80d2=_['merge']({},_0xbd80d2,_0x2cb54f[_0x4028('0x3f')]);var _0x295a40={'where':_0xbd80d2[_0x4028('0x3c')]};return db[_0x4028('0x28')][_0x4028('0x1f')](_0x295a40)[_0x4028('0x24')](function(_0xd7b9f2){_0x100930[_0x4028('0x1f')]=_0xd7b9f2;if(_0x2cb54f[_0x4028('0x2f')][_0x4028('0x40')]){_0xbd80d2[_0x4028('0x41')]=[{'all':!![]}];}return db[_0x4028('0x28')]['findAll'](_0xbd80d2);})[_0x4028('0x24')](function(_0xd6ebb4){_0x100930[_0x4028('0x42')]=_0xd6ebb4;return _0x100930;})[_0x4028('0x24')](respondWithFilteredResult(_0x1406b4,_0xbd80d2))[_0x4028('0x43')](handleError(_0x1406b4,null));};exports['show']=function(_0x19d5f8,_0x5d05da){var _0x141234={'raw':!![],'where':{'id':_0x19d5f8['params']['id']}},_0x3a5561={};_0x3a5561['model']=_['keys'](db['MailTransferReport']['rawAttributes']);_0x3a5561[_0x4028('0x2f')]=_[_0x4028('0x44')](_0x19d5f8[_0x4028('0x2f')]);_0x3a5561['filters']=_[_0x4028('0x32')](_0x3a5561[_0x4028('0x31')],_0x3a5561[_0x4028('0x2f')]);_0x141234[_0x4028('0x34')]=_[_0x4028('0x32')](_0x3a5561[_0x4028('0x31')],qs['fields'](_0x19d5f8[_0x4028('0x2f')][_0x4028('0x33')]));_0x141234['attributes']=_0x141234['attributes'][_0x4028('0x35')]?_0x141234[_0x4028('0x34')]:_0x3a5561[_0x4028('0x31')];if(_0x19d5f8['query'][_0x4028('0x40')]){_0x141234[_0x4028('0x41')]=[{'all':!![]}];}_0x141234=_[_0x4028('0x3d')]({},_0x141234,_0x19d5f8[_0x4028('0x3f')]);return db[_0x4028('0x28')][_0x4028('0x45')](_0x141234)[_0x4028('0x24')](handleEntityNotFound(_0x5d05da,null))[_0x4028('0x24')](respondWithResult(_0x5d05da,null))[_0x4028('0x43')](handleError(_0x5d05da,null));};exports[_0x4028('0x46')]=function(_0x1ac65d,_0x5149eb){return db['MailTransferReport']['create'](_0x1ac65d['body'],{})[_0x4028('0x24')](respondWithResult(_0x5149eb,0xc9))[_0x4028('0x43')](handleError(_0x5149eb,null));};exports[_0x4028('0x23')]=function(_0x5c480c,_0x15eefc){if(_0x5c480c['body']['id']){delete _0x5c480c[_0x4028('0x47')]['id'];}return db[_0x4028('0x28')]['find']({'where':{'id':_0x5c480c[_0x4028('0x48')]['id']}})[_0x4028('0x24')](handleEntityNotFound(_0x15eefc,null))[_0x4028('0x24')](saveUpdates(_0x5c480c[_0x4028('0x47')],null))[_0x4028('0x24')](respondWithResult(_0x15eefc,null))[_0x4028('0x43')](handleError(_0x15eefc,null));};exports[_0x4028('0x25')]=function(_0x6b2764,_0x3ad213){return db[_0x4028('0x28')][_0x4028('0x45')]({'where':{'id':_0x6b2764[_0x4028('0x48')]['id']}})[_0x4028('0x24')](handleEntityNotFound(_0x3ad213,null))[_0x4028('0x24')](removeEntity(_0x3ad213,null))[_0x4028('0x43')](handleError(_0x3ad213,null));};exports[_0x4028('0x49')]=function(_0x5d36d3,_0x1ab7c9){return db[_0x4028('0x28')][_0x4028('0x49')]()['then'](respondWithResult(_0x1ab7c9,null))[_0x4028('0x43')](handleError(_0x1ab7c9,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c98ea63..6451a88 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 _0x00e9=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x814d2f,_0x71ebd9){var _0x1edc7e=function(_0x3f1cb3){while(--_0x3f1cb3){_0x814d2f['push'](_0x814d2f['shift']());}};_0x1edc7e(++_0x71ebd9);}(_0x00e9,0x10f));var _0x900e=function(_0x534269,_0x1e1c1f){_0x534269=_0x534269-0x0;var _0x4b1985=_0x00e9[_0x534269];return _0x4b1985;};'use strict';var _=require(_0x900e('0x0'));var util=require(_0x900e('0x1'));var logger=require(_0x900e('0x2'))(_0x900e('0x3'));var moment=require(_0x900e('0x4'));var BPromise=require(_0x900e('0x5'));var rp=require(_0x900e('0x6'));var fs=require('fs');var path=require(_0x900e('0x7'));var rimraf=require(_0x900e('0x8'));var config=require(_0x900e('0x9'));var attributes=require(_0x900e('0xa'));module[_0x900e('0xb')]=function(_0x20c2aa,_0x5b3736){return _0x20c2aa[_0x900e('0xc')](_0x900e('0xd'),attributes,{'tableName':_0x900e('0xe'),'paranoid':![],'indexes':[{'name':_0x900e('0xf'),'fields':[_0x900e('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4276=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4276,0x7d));var _0x6427=function(_0x8dbcfd,_0x55c3b5){_0x8dbcfd=_0x8dbcfd-0x0;var _0x50374c=_0x4276[_0x8dbcfd];return _0x50374c;};'use strict';var _=require(_0x6427('0x0'));var util=require('util');var logger=require(_0x6427('0x1'))(_0x6427('0x2'));var moment=require(_0x6427('0x3'));var BPromise=require(_0x6427('0x4'));var rp=require(_0x6427('0x5'));var fs=require('fs');var path=require(_0x6427('0x6'));var rimraf=require(_0x6427('0x7'));var config=require(_0x6427('0x8'));var attributes=require(_0x6427('0x9'));module[_0x6427('0xa')]=function(_0xed5343,_0x1bfaaa){return _0xed5343[_0x6427('0xb')](_0x6427('0xc'),attributes,{'tableName':_0x6427('0xd'),'paranoid':![],'indexes':[{'name':_0x6427('0xe'),'fields':[_0x6427('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index ba6eba1..a7e425e 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 _0x4989=['stringify','code','error','message','request\x20sent','result','util','moment','ioredis','../../mysqldb','jayson/promise','client','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3e0772,_0x56d14e){var _0x4aa399=function(_0x44ab29){while(--_0x44ab29){_0x3e0772['push'](_0x3e0772['shift']());}};_0x4aa399(++_0x56d14e);}(_0x4989,0x7d));var _0x9498=function(_0x27f88b,_0x526bad){_0x27f88b=_0x27f88b-0x0;var _0x2114f4=_0x4989[_0x27f88b];return _0x2114f4;};'use strict';var _=require('lodash');var util=require(_0x9498('0x0'));var moment=require(_0x9498('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9498('0x2'));var db=require(_0x9498('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9498('0x4'));var client=jayson[_0x9498('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x503dcf,_0x2ee034,_0x16f095){return new BPromise(function(_0x5803ed,_0x2d6a7a){return client['request'](_0x503dcf,_0x16f095)[_0x9498('0x6')](function(_0x4ff5ab){logger[_0x9498('0x7')](_0x9498('0x8'),_0x2ee034,'request\x20sent');logger[_0x9498('0x9')](_0x9498('0xa'),_0x2ee034,'request\x20sent',JSON[_0x9498('0xb')](_0x4ff5ab));if(_0x4ff5ab['error']){if(_0x4ff5ab['error'][_0x9498('0xc')]===0x1f4){logger[_0x9498('0xd')](_0x9498('0x8'),_0x2ee034,_0x4ff5ab[_0x9498('0xd')][_0x9498('0xe')]);return _0x2d6a7a(_0x4ff5ab[_0x9498('0xd')][_0x9498('0xe')]);}logger[_0x9498('0xd')](_0x9498('0x8'),_0x2ee034,_0x4ff5ab[_0x9498('0xd')][_0x9498('0xe')]);return _0x5803ed(_0x4ff5ab[_0x9498('0xd')][_0x9498('0xe')]);}else{logger[_0x9498('0x7')](_0x9498('0x8'),_0x2ee034,_0x9498('0xf'));_0x5803ed(_0x4ff5ab[_0x9498('0x10')][_0x9498('0xe')]);}})['catch'](function(_0x5d3fcf){logger['error'](_0x9498('0x8'),_0x2ee034,_0x5d3fcf);_0x2d6a7a(_0x5d3fcf);});});} \ No newline at end of file +var _0xe5b6=['message','result','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4b0e6a,_0x2abb9c){var _0x4c5def=function(_0x11b0d3){while(--_0x11b0d3){_0x4b0e6a['push'](_0x4b0e6a['shift']());}};_0x4c5def(++_0x2abb9c);}(_0xe5b6,0x133));var _0x6e5b=function(_0x322991,_0x5bd8a4){_0x322991=_0x322991-0x0;var _0x2ccabd=_0xe5b6[_0x322991];return _0x2ccabd;};'use strict';var _=require(_0x6e5b('0x0'));var util=require(_0x6e5b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6e5b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e5b('0x3'));var logger=require(_0x6e5b('0x4'))(_0x6e5b('0x5'));var config=require('../../config/environment');var jayson=require(_0x6e5b('0x6'));var client=jayson[_0x6e5b('0x7')][_0x6e5b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4af40b,_0x3b9f01,_0x717d81){return new BPromise(function(_0x428aed,_0x29fc0a){return client['request'](_0x4af40b,_0x717d81)['then'](function(_0x4a5a8f){logger[_0x6e5b('0x9')](_0x6e5b('0xa'),_0x3b9f01,_0x6e5b('0xb'));logger[_0x6e5b('0xc')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x3b9f01,_0x6e5b('0xb'),JSON[_0x6e5b('0xd')](_0x4a5a8f));if(_0x4a5a8f[_0x6e5b('0xe')]){if(_0x4a5a8f[_0x6e5b('0xe')][_0x6e5b('0xf')]===0x1f4){logger[_0x6e5b('0xe')](_0x6e5b('0xa'),_0x3b9f01,_0x4a5a8f[_0x6e5b('0xe')]['message']);return _0x29fc0a(_0x4a5a8f[_0x6e5b('0xe')][_0x6e5b('0x10')]);}logger[_0x6e5b('0xe')](_0x6e5b('0xa'),_0x3b9f01,_0x4a5a8f[_0x6e5b('0xe')][_0x6e5b('0x10')]);return _0x428aed(_0x4a5a8f['error']['message']);}else{logger[_0x6e5b('0x9')](_0x6e5b('0xa'),_0x3b9f01,_0x6e5b('0xb'));_0x428aed(_0x4a5a8f[_0x6e5b('0x11')][_0x6e5b('0x10')]);}})[_0x6e5b('0x12')](function(_0x5c88be){logger[_0x6e5b('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x3b9f01,_0x5c88be);_0x29fc0a(_0x5c88be);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index adb3a18..1fd188f 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 _0x811b=['/:id','show','create','update','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../config/environment','./memberReport.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x3c251d,_0xc70445){var _0x520121=function(_0x35ddcd){while(--_0x35ddcd){_0x3c251d['push'](_0x3c251d['shift']());}};_0x520121(++_0xc70445);}(_0x811b,0xb0));var _0xb811=function(_0x504dd8,_0x1396f2){_0x504dd8=_0x504dd8-0x0;var _0x54db75=_0x811b[_0x504dd8];return _0x54db75;};'use strict';var multer=require(_0xb811('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb811('0x1'));var express=require(_0xb811('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb811('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb811('0x4'));var controller=require(_0xb811('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xb811('0x6')]);router[_0xb811('0x7')](_0xb811('0x8'),auth[_0xb811('0x9')](),controller[_0xb811('0xa')]);router['get'](_0xb811('0xb'),auth[_0xb811('0x9')](),controller[_0xb811('0xc')]);router['post']('/',auth[_0xb811('0x9')](),controller[_0xb811('0xd')]);router['put'](_0xb811('0xb'),auth['isAuthenticated'](),controller[_0xb811('0xe')]);router[_0xb811('0xf')](_0xb811('0xb'),auth['isAuthenticated'](),controller[_0xb811('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbaed=['isAuthenticated','index','/describe','/:id','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get'];(function(_0x2a1560,_0x5cb643){var _0x35e4e0=function(_0x5f2c41){while(--_0x5f2c41){_0x2a1560['push'](_0x2a1560['shift']());}};_0x35e4e0(++_0x5cb643);}(_0xbaed,0x81));var _0xdbae=function(_0x2c7b86,_0x59ef3c){_0x2c7b86=_0x2c7b86-0x0;var _0x256735=_0xbaed[_0x2c7b86];return _0x256735;};'use strict';var multer=require(_0xdbae('0x0'));var util=require(_0xdbae('0x1'));var path=require('path');var timeout=require(_0xdbae('0x2'));var express=require(_0xdbae('0x3'));var router=express[_0xdbae('0x4')]();var fs_extra=require(_0xdbae('0x5'));var auth=require(_0xdbae('0x6'));var interaction=require(_0xdbae('0x7'));var config=require(_0xdbae('0x8'));var controller=require(_0xdbae('0x9'));router[_0xdbae('0xa')]('/',auth[_0xdbae('0xb')](),controller[_0xdbae('0xc')]);router[_0xdbae('0xa')](_0xdbae('0xd'),auth[_0xdbae('0xb')](),controller['describe']);router[_0xdbae('0xa')](_0xdbae('0xe'),auth[_0xdbae('0xb')](),controller['show']);router[_0xdbae('0xf')]('/',auth[_0xdbae('0xb')](),controller['create']);router[_0xdbae('0x10')](_0xdbae('0xe'),auth[_0xdbae('0xb')](),controller[_0xdbae('0x11')]);router[_0xdbae('0x12')](_0xdbae('0xe'),auth[_0xdbae('0xb')](),controller[_0xdbae('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 98dd22b..d255bfc 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 _0xa5cc=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','moment'];(function(_0x8b7e28,_0x346e8d){var _0xc244de=function(_0x294427){while(--_0x294427){_0x8b7e28['push'](_0x8b7e28['shift']());}};_0xc244de(++_0x346e8d);}(_0xa5cc,0xed));var _0xca5c=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xa5cc[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xca5c('0x0'));module['exports']={'channel':{'type':Sequelize[_0xca5c('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xca5c('0x1')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xca5c('0x2'),'comment':_0xca5c('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xca5c('0x4')]},'exitAt':{'type':Sequelize[_0xca5c('0x4')],'set':function(_0x595c0c){var _0x52591b=moment(_0x595c0c);var _0x2ae269=moment(this[_0xca5c('0x5')](_0xca5c('0x6')));var _0x1256a3=_0x52591b['diff'](_0x2ae269,_0xca5c('0x7'));this[_0xca5c('0x8')](_0xca5c('0x9'),_0x595c0c);this[_0xca5c('0x8')](_0xca5c('0xa'),_0x1256a3||null);}},'data1':{'type':Sequelize[_0xca5c('0x1')],'comment':_0xca5c('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0xca5c('0xc')},'data3':{'type':Sequelize[_0xca5c('0x1')],'comment':_0xca5c('0xd')},'data4':{'type':Sequelize[_0xca5c('0x1')],'comment':_0xca5c('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0xca5c('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xca5c('0x10')]},'uniqueid':{'type':Sequelize[_0xca5c('0x1')]}}; \ No newline at end of file +var _0xeb2f=['getDataValue','enterAt','diff','seconds','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x108eb6,_0x51bc17){var _0x27057b=function(_0x171063){while(--_0x171063){_0x108eb6['push'](_0x108eb6['shift']());}};_0x27057b(++_0x51bc17);}(_0xeb2f,0x161));var _0xfeb2=function(_0x39238e,_0x51e7ee){_0x39238e=_0x39238e-0x0;var _0x507883=_0xeb2f[_0x39238e];return _0x507883;};'use strict';var Sequelize=require(_0xfeb2('0x0'));var moment=require(_0xfeb2('0x1'));module['exports']={'channel':{'type':Sequelize[_0xfeb2('0x2')]},'membername':{'type':Sequelize[_0xfeb2('0x2')]},'interface':{'type':Sequelize[_0xfeb2('0x2')]},'type':{'type':Sequelize[_0xfeb2('0x2')],'defaultValue':_0xfeb2('0x3'),'comment':_0xfeb2('0x4')},'duration':{'type':Sequelize[_0xfeb2('0x5')]},'enterAt':{'type':Sequelize[_0xfeb2('0x6')]},'exitAt':{'type':Sequelize[_0xfeb2('0x6')],'set':function(_0x1ec710){var _0x2e7190=moment(_0x1ec710);var _0x5ae494=moment(this[_0xfeb2('0x7')](_0xfeb2('0x8')));var _0x1ccde4=_0x2e7190[_0xfeb2('0x9')](_0x5ae494,_0xfeb2('0xa'));this['setDataValue'](_0xfeb2('0xb'),_0x1ec710);this['setDataValue'](_0xfeb2('0xc'),_0x1ccde4||null);}},'data1':{'type':Sequelize[_0xfeb2('0x2')],'comment':_0xfeb2('0xd')},'data2':{'type':Sequelize[_0xfeb2('0x2')],'comment':_0xfeb2('0xe')},'data3':{'type':Sequelize[_0xfeb2('0x2')],'comment':_0xfeb2('0xf')},'data4':{'type':Sequelize[_0xfeb2('0x2')],'comment':_0xfeb2('0x10')},'data5':{'type':Sequelize['STRING'],'comment':_0xfeb2('0x11')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xfeb2('0x5')]},'uniqueid':{'type':Sequelize[_0xfeb2('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 576c8ec..de3beef 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 _0xd499=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','MemberReport','rawAttributes','fieldName','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe'];(function(_0x2fadbf,_0x3a9797){var _0x3eb96b=function(_0x1aaf1d){while(--_0x1aaf1d){_0x2fadbf['push'](_0x2fadbf['shift']());}};_0x3eb96b(++_0x3a9797);}(_0xd499,0xe7));var _0x9d49=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0xd499[_0x215dc8];return _0x583ea3;};'use strict';var pdf=require(_0x9d49('0x0'));var emlformat=require(_0x9d49('0x1'));var rimraf=require(_0x9d49('0x2'));var zipdir=require(_0x9d49('0x3'));var jsonpatch=require(_0x9d49('0x4'));var rp=require(_0x9d49('0x5'));var moment=require(_0x9d49('0x6'));var BPromise=require(_0x9d49('0x7'));var Mustache=require(_0x9d49('0x8'));var util=require(_0x9d49('0x9'));var path=require(_0x9d49('0xa'));var sox=require(_0x9d49('0xb'));var csv=require(_0x9d49('0xc'));var ejs=require(_0x9d49('0xd'));var fs=require('fs');var fs_extra=require(_0x9d49('0xe'));var _=require(_0x9d49('0xf'));var squel=require(_0x9d49('0x10'));var crypto=require(_0x9d49('0x11'));var jsforce=require(_0x9d49('0x12'));var deskjs=require('desk.js');var toCsv=require(_0x9d49('0xc'));var querystring=require(_0x9d49('0x13'));var Papa=require(_0x9d49('0x14'));var Redis=require(_0x9d49('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x9d49('0x16'));var as=require(_0x9d49('0x17'));var hardwareService=require(_0x9d49('0x18'));var logger=require(_0x9d49('0x19'))(_0x9d49('0x1a'));var utils=require('../../config/utils');var config=require(_0x9d49('0x1b'));var licenseUtil=require(_0x9d49('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e31b7,_0x582d86){_0x582d86=_0x582d86||0xcc;return function(_0x4a4b9c){if(_0x4a4b9c){return _0x5e31b7[_0x9d49('0x1d')](_0x582d86);}return _0x5e31b7[_0x9d49('0x1e')](_0x582d86)[_0x9d49('0x1f')]();};}function respondWithResult(_0x337ea8,_0xcc6d28){_0xcc6d28=_0xcc6d28||0xc8;return function(_0x27ee55){if(_0x27ee55){return _0x337ea8[_0x9d49('0x1e')](_0xcc6d28)[_0x9d49('0x20')](_0x27ee55);}};}function respondWithFilteredResult(_0x1beeff,_0x451674){return function(_0x5c2bfc){if(_0x5c2bfc){var _0x5b3f07=_0x5c2bfc[_0x9d49('0x21')],_0x2d9c04=_0x451674[_0x9d49('0x22')],_0xf287a6=_0x451674[_0x9d49('0x22')]+_0x451674['limit'],_0x36155d;if(_0xf287a6>=_0x5b3f07){_0xf287a6=_0x5b3f07;_0x36155d=0xc8;}else{_0x36155d=0xce;}_0x1beeff[_0x9d49('0x1e')](_0x36155d);return _0x1beeff[_0x9d49('0x23')](_0x9d49('0x24'),_0x2d9c04+'-'+_0xf287a6+'/'+_0x5b3f07)[_0x9d49('0x20')](_0x5c2bfc);}return null;};}function patchUpdates(_0x4bde7e){return function(_0x3f174f){try{jsonpatch[_0x9d49('0x25')](_0x3f174f,_0x4bde7e,!![]);}catch(_0x4c36de){return BPromise[_0x9d49('0x26')](_0x4c36de);}return _0x3f174f[_0x9d49('0x27')]();};}function saveUpdates(_0x5eb48f,_0x5cdd4a){return function(_0x1c8d16){if(_0x1c8d16){return _0x1c8d16[_0x9d49('0x28')](_0x5eb48f)[_0x9d49('0x29')](function(_0x2916c6){return _0x2916c6;});}return null;};}function removeEntity(_0x5c9eb7,_0x365678){return function(_0x3cfacf){if(_0x3cfacf){return _0x3cfacf[_0x9d49('0x2a')]()['then'](function(){_0x5c9eb7[_0x9d49('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x302cf7,_0x1e19b2){return function(_0x2dd9e6){if(!_0x2dd9e6){_0x302cf7[_0x9d49('0x1d')](0x194);}return _0x2dd9e6;};}function handleError(_0x33c5af,_0x18dfb9){_0x18dfb9=_0x18dfb9||0x1f4;return function(_0x1c09ee){logger[_0x9d49('0x2b')](_0x1c09ee['stack']);if(_0x1c09ee['name']){delete _0x1c09ee[_0x9d49('0x2c')];}_0x33c5af[_0x9d49('0x1e')](_0x18dfb9)['send'](_0x1c09ee);};}exports[_0x9d49('0x2d')]=function(_0x2d3741,_0x156c80){var _0x10c27d={},_0x438ee6={},_0x2c6e2d={'count':0x0,'rows':[]};var _0xed8ce=_[_0x9d49('0x2e')](db[_0x9d49('0x2f')][_0x9d49('0x30')],function(_0x1cefc1){return{'name':_0x1cefc1[_0x9d49('0x31')],'type':_0x1cefc1['type']['key']};});_0x438ee6['model']=_[_0x9d49('0x2e')](_0xed8ce,'name');_0x438ee6[_0x9d49('0x32')]=_[_0x9d49('0x33')](_0x2d3741['query']);_0x438ee6['filters']=_['intersection'](_0x438ee6[_0x9d49('0x34')],_0x438ee6[_0x9d49('0x32')]);_0x10c27d['attributes']=_[_0x9d49('0x35')](_0x438ee6[_0x9d49('0x34')],qs[_0x9d49('0x36')](_0x2d3741[_0x9d49('0x32')][_0x9d49('0x36')]));_0x10c27d['attributes']=_0x10c27d[_0x9d49('0x37')][_0x9d49('0x38')]?_0x10c27d[_0x9d49('0x37')]:_0x438ee6[_0x9d49('0x34')];if(!_0x2d3741['query'][_0x9d49('0x39')]('nolimit')){_0x10c27d[_0x9d49('0x3a')]=qs[_0x9d49('0x3a')](_0x2d3741[_0x9d49('0x32')]['limit']);_0x10c27d[_0x9d49('0x22')]=qs['offset'](_0x2d3741[_0x9d49('0x32')][_0x9d49('0x22')]);}_0x10c27d[_0x9d49('0x3b')]=qs[_0x9d49('0x3c')](_0x2d3741[_0x9d49('0x32')][_0x9d49('0x3c')]);_0x10c27d[_0x9d49('0x3d')]=qs[_0x9d49('0x3e')](_['pick'](_0x2d3741[_0x9d49('0x32')],_0x438ee6['filters']),_0xed8ce);if(_0x2d3741['query'][_0x9d49('0x3f')]){_0x10c27d['where']=_[_0x9d49('0x40')](_0x10c27d[_0x9d49('0x3d')],{'$or':_[_0x9d49('0x2e')](_0xed8ce,function(_0x57b696){if(_0x57b696['type']!=='VIRTUAL'){var _0x5b0c91={};_0x5b0c91[_0x57b696[_0x9d49('0x2c')]]={'$like':'%'+_0x2d3741[_0x9d49('0x32')][_0x9d49('0x3f')]+'%'};return _0x5b0c91;}})});}_0x10c27d=_['merge']({},_0x10c27d,_0x2d3741[_0x9d49('0x41')]);var _0x24f970={'where':_0x10c27d[_0x9d49('0x3d')]};return db[_0x9d49('0x2f')][_0x9d49('0x21')](_0x24f970)[_0x9d49('0x29')](function(_0xb20986){_0x2c6e2d[_0x9d49('0x21')]=_0xb20986;if(_0x2d3741[_0x9d49('0x32')][_0x9d49('0x42')]){_0x10c27d[_0x9d49('0x43')]=[{'all':!![]}];}return db['MemberReport'][_0x9d49('0x44')](_0x10c27d);})[_0x9d49('0x29')](function(_0xe1275e){_0x2c6e2d[_0x9d49('0x45')]=_0xe1275e;return _0x2c6e2d;})['then'](respondWithFilteredResult(_0x156c80,_0x10c27d))['catch'](handleError(_0x156c80,null));};exports[_0x9d49('0x46')]=function(_0x651a57,_0x4c403b){var _0x28a5fe={'raw':!![],'where':{'id':_0x651a57[_0x9d49('0x47')]['id']}},_0x5c8d22={};_0x5c8d22[_0x9d49('0x34')]=_[_0x9d49('0x33')](db[_0x9d49('0x2f')][_0x9d49('0x30')]);_0x5c8d22['query']=_[_0x9d49('0x33')](_0x651a57[_0x9d49('0x32')]);_0x5c8d22['filters']=_['intersection'](_0x5c8d22['model'],_0x5c8d22[_0x9d49('0x32')]);_0x28a5fe['attributes']=_[_0x9d49('0x35')](_0x5c8d22[_0x9d49('0x34')],qs[_0x9d49('0x36')](_0x651a57[_0x9d49('0x32')][_0x9d49('0x36')]));_0x28a5fe[_0x9d49('0x37')]=_0x28a5fe[_0x9d49('0x37')][_0x9d49('0x38')]?_0x28a5fe[_0x9d49('0x37')]:_0x5c8d22['model'];if(_0x651a57[_0x9d49('0x32')]['includeAll']){_0x28a5fe['include']=[{'all':!![]}];}_0x28a5fe=_['merge']({},_0x28a5fe,_0x651a57['options']);return db[_0x9d49('0x2f')][_0x9d49('0x48')](_0x28a5fe)['then'](handleEntityNotFound(_0x4c403b,null))['then'](respondWithResult(_0x4c403b,null))[_0x9d49('0x49')](handleError(_0x4c403b,null));};exports['create']=function(_0x24700a,_0x474ffb){return db[_0x9d49('0x2f')][_0x9d49('0x4a')](_0x24700a[_0x9d49('0x4b')],{})[_0x9d49('0x29')](respondWithResult(_0x474ffb,0xc9))[_0x9d49('0x49')](handleError(_0x474ffb,null));};exports[_0x9d49('0x28')]=function(_0x8afebf,_0x583d22){if(_0x8afebf['body']['id']){delete _0x8afebf[_0x9d49('0x4b')]['id'];}return db[_0x9d49('0x2f')][_0x9d49('0x48')]({'where':{'id':_0x8afebf[_0x9d49('0x47')]['id']}})[_0x9d49('0x29')](handleEntityNotFound(_0x583d22,null))['then'](saveUpdates(_0x8afebf['body'],null))[_0x9d49('0x29')](respondWithResult(_0x583d22,null))[_0x9d49('0x49')](handleError(_0x583d22,null));};exports[_0x9d49('0x2a')]=function(_0x2e3cec,_0x4d3bee){return db[_0x9d49('0x2f')][_0x9d49('0x48')]({'where':{'id':_0x2e3cec[_0x9d49('0x47')]['id']}})[_0x9d49('0x29')](handleEntityNotFound(_0x4d3bee,null))['then'](removeEntity(_0x4d3bee,null))[_0x9d49('0x49')](handleError(_0x4d3bee,null));};exports['describe']=function(_0x37f0f3,_0x181d3c){return db[_0x9d49('0x2f')][_0x9d49('0x4c')]()[_0x9d49('0x29')](respondWithResult(_0x181d3c,null))[_0x9d49('0x49')](handleError(_0x181d3c,null));}; \ No newline at end of file +var _0x60c5=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','stack','name','send','index','map','MemberReport','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','keys','rawAttributes','includeAll','find','catch','create','body','destroy','params','describe','html-pdf','eml-format','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x35ca53,_0x38b53a){var _0x4d345c=function(_0x5c7e6d){while(--_0x5c7e6d){_0x35ca53['push'](_0x35ca53['shift']());}};_0x4d345c(++_0x38b53a);}(_0x60c5,0x15a));var _0x560c=function(_0x5d2ac3,_0x35f0cc){_0x5d2ac3=_0x5d2ac3-0x0;var _0xcca67d=_0x60c5[_0x5d2ac3];return _0xcca67d;};'use strict';var pdf=require(_0x560c('0x0'));var emlformat=require(_0x560c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x560c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x560c('0x3'));var moment=require('moment');var BPromise=require(_0x560c('0x4'));var Mustache=require('mustache');var util=require(_0x560c('0x5'));var path=require(_0x560c('0x6'));var sox=require('sox');var csv=require(_0x560c('0x7'));var ejs=require(_0x560c('0x8'));var fs=require('fs');var fs_extra=require(_0x560c('0x9'));var _=require('lodash');var squel=require(_0x560c('0xa'));var crypto=require(_0x560c('0xb'));var jsforce=require(_0x560c('0xc'));var deskjs=require(_0x560c('0xd'));var toCsv=require(_0x560c('0x7'));var querystring=require(_0x560c('0xe'));var Papa=require(_0x560c('0xf'));var Redis=require(_0x560c('0x10'));var authService=require(_0x560c('0x11'));var qs=require(_0x560c('0x12'));var as=require(_0x560c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x560c('0x14'));var config=require(_0x560c('0x15'));var licenseUtil=require(_0x560c('0x16'));var db=require(_0x560c('0x17'))['db'];function respondWithStatusCode(_0xe15668,_0x3a8995){_0x3a8995=_0x3a8995||0xcc;return function(_0x963dec){if(_0x963dec){return _0xe15668[_0x560c('0x18')](_0x3a8995);}return _0xe15668[_0x560c('0x19')](_0x3a8995)[_0x560c('0x1a')]();};}function respondWithResult(_0x3d79c8,_0xef79a9){_0xef79a9=_0xef79a9||0xc8;return function(_0x29250d){if(_0x29250d){return _0x3d79c8[_0x560c('0x19')](_0xef79a9)[_0x560c('0x1b')](_0x29250d);}};}function respondWithFilteredResult(_0x391c46,_0xd1074e){return function(_0x13c25a){if(_0x13c25a){var _0x469e2a=_0x13c25a[_0x560c('0x1c')],_0x5586f6=_0xd1074e[_0x560c('0x1d')],_0x427212=_0xd1074e[_0x560c('0x1d')]+_0xd1074e[_0x560c('0x1e')],_0x14b4a7;if(_0x427212>=_0x469e2a){_0x427212=_0x469e2a;_0x14b4a7=0xc8;}else{_0x14b4a7=0xce;}_0x391c46[_0x560c('0x19')](_0x14b4a7);return _0x391c46[_0x560c('0x1f')](_0x560c('0x20'),_0x5586f6+'-'+_0x427212+'/'+_0x469e2a)[_0x560c('0x1b')](_0x13c25a);}return null;};}function patchUpdates(_0x32846c){return function(_0x59e8ff){try{jsonpatch[_0x560c('0x21')](_0x59e8ff,_0x32846c,!![]);}catch(_0x4fe109){return BPromise['reject'](_0x4fe109);}return _0x59e8ff['save']();};}function saveUpdates(_0x4b57af,_0x3b4672){return function(_0x4838e7){if(_0x4838e7){return _0x4838e7[_0x560c('0x22')](_0x4b57af)[_0x560c('0x23')](function(_0x10dc87){return _0x10dc87;});}return null;};}function removeEntity(_0x5888d0,_0x4da3af){return function(_0x15b7be){if(_0x15b7be){return _0x15b7be['destroy']()[_0x560c('0x23')](function(){_0x5888d0[_0x560c('0x19')](0xcc)[_0x560c('0x1a')]();});}};}function handleEntityNotFound(_0x4ff258,_0x22476b){return function(_0x5e33bf){if(!_0x5e33bf){_0x4ff258[_0x560c('0x18')](0x194);}return _0x5e33bf;};}function handleError(_0x53b721,_0x4da33b){_0x4da33b=_0x4da33b||0x1f4;return function(_0x4ef470){logger['error'](_0x4ef470[_0x560c('0x24')]);if(_0x4ef470[_0x560c('0x25')]){delete _0x4ef470['name'];}_0x53b721[_0x560c('0x19')](_0x4da33b)[_0x560c('0x26')](_0x4ef470);};}exports[_0x560c('0x27')]=function(_0x49f6a1,_0x2e38cc){var _0x27202a={},_0x1d987f={},_0x25a751={'count':0x0,'rows':[]};var _0x29f84a=_[_0x560c('0x28')](db[_0x560c('0x29')]['rawAttributes'],function(_0x2ed8e3){return{'name':_0x2ed8e3[_0x560c('0x2a')],'type':_0x2ed8e3[_0x560c('0x2b')]['key']};});_0x1d987f[_0x560c('0x2c')]=_['map'](_0x29f84a,_0x560c('0x25'));_0x1d987f['query']=_['keys'](_0x49f6a1[_0x560c('0x2d')]);_0x1d987f[_0x560c('0x2e')]=_['intersection'](_0x1d987f[_0x560c('0x2c')],_0x1d987f[_0x560c('0x2d')]);_0x27202a[_0x560c('0x2f')]=_[_0x560c('0x30')](_0x1d987f[_0x560c('0x2c')],qs['fields'](_0x49f6a1[_0x560c('0x2d')][_0x560c('0x31')]));_0x27202a[_0x560c('0x2f')]=_0x27202a[_0x560c('0x2f')][_0x560c('0x32')]?_0x27202a[_0x560c('0x2f')]:_0x1d987f[_0x560c('0x2c')];if(!_0x49f6a1[_0x560c('0x2d')][_0x560c('0x33')](_0x560c('0x34'))){_0x27202a['limit']=qs[_0x560c('0x1e')](_0x49f6a1[_0x560c('0x2d')][_0x560c('0x1e')]);_0x27202a[_0x560c('0x1d')]=qs[_0x560c('0x1d')](_0x49f6a1[_0x560c('0x2d')][_0x560c('0x1d')]);}_0x27202a[_0x560c('0x35')]=qs[_0x560c('0x36')](_0x49f6a1[_0x560c('0x2d')][_0x560c('0x36')]);_0x27202a[_0x560c('0x37')]=qs[_0x560c('0x2e')](_[_0x560c('0x38')](_0x49f6a1[_0x560c('0x2d')],_0x1d987f[_0x560c('0x2e')]),_0x29f84a);if(_0x49f6a1['query'][_0x560c('0x39')]){_0x27202a[_0x560c('0x37')]=_[_0x560c('0x3a')](_0x27202a[_0x560c('0x37')],{'$or':_[_0x560c('0x28')](_0x29f84a,function(_0xdeb983){if(_0xdeb983[_0x560c('0x2b')]!=='VIRTUAL'){var _0x255646={};_0x255646[_0xdeb983[_0x560c('0x25')]]={'$like':'%'+_0x49f6a1[_0x560c('0x2d')]['filter']+'%'};return _0x255646;}})});}_0x27202a=_['merge']({},_0x27202a,_0x49f6a1[_0x560c('0x3b')]);var _0x4bf4eb={'where':_0x27202a['where']};return db['MemberReport'][_0x560c('0x1c')](_0x4bf4eb)[_0x560c('0x23')](function(_0x3333d3){_0x25a751[_0x560c('0x1c')]=_0x3333d3;if(_0x49f6a1[_0x560c('0x2d')]['includeAll']){_0x27202a[_0x560c('0x3c')]=[{'all':!![]}];}return db[_0x560c('0x29')][_0x560c('0x3d')](_0x27202a);})['then'](function(_0x490189){_0x25a751[_0x560c('0x3e')]=_0x490189;return _0x25a751;})[_0x560c('0x23')](respondWithFilteredResult(_0x2e38cc,_0x27202a))['catch'](handleError(_0x2e38cc,null));};exports[_0x560c('0x3f')]=function(_0x1a1a22,_0x3c6f3c){var _0x3d893d={'raw':!![],'where':{'id':_0x1a1a22['params']['id']}},_0x371436={};_0x371436[_0x560c('0x2c')]=_[_0x560c('0x40')](db[_0x560c('0x29')][_0x560c('0x41')]);_0x371436[_0x560c('0x2d')]=_[_0x560c('0x40')](_0x1a1a22[_0x560c('0x2d')]);_0x371436[_0x560c('0x2e')]=_[_0x560c('0x30')](_0x371436[_0x560c('0x2c')],_0x371436[_0x560c('0x2d')]);_0x3d893d['attributes']=_[_0x560c('0x30')](_0x371436[_0x560c('0x2c')],qs[_0x560c('0x31')](_0x1a1a22[_0x560c('0x2d')][_0x560c('0x31')]));_0x3d893d[_0x560c('0x2f')]=_0x3d893d[_0x560c('0x2f')][_0x560c('0x32')]?_0x3d893d[_0x560c('0x2f')]:_0x371436[_0x560c('0x2c')];if(_0x1a1a22[_0x560c('0x2d')][_0x560c('0x42')]){_0x3d893d[_0x560c('0x3c')]=[{'all':!![]}];}_0x3d893d=_['merge']({},_0x3d893d,_0x1a1a22[_0x560c('0x3b')]);return db[_0x560c('0x29')][_0x560c('0x43')](_0x3d893d)[_0x560c('0x23')](handleEntityNotFound(_0x3c6f3c,null))[_0x560c('0x23')](respondWithResult(_0x3c6f3c,null))[_0x560c('0x44')](handleError(_0x3c6f3c,null));};exports[_0x560c('0x45')]=function(_0x5a3215,_0x3646a8){return db[_0x560c('0x29')][_0x560c('0x45')](_0x5a3215[_0x560c('0x46')],{})['then'](respondWithResult(_0x3646a8,0xc9))[_0x560c('0x44')](handleError(_0x3646a8,null));};exports['update']=function(_0x37e96a,_0x246715){if(_0x37e96a[_0x560c('0x46')]['id']){delete _0x37e96a[_0x560c('0x46')]['id'];}return db[_0x560c('0x29')][_0x560c('0x43')]({'where':{'id':_0x37e96a['params']['id']}})[_0x560c('0x23')](handleEntityNotFound(_0x246715,null))['then'](saveUpdates(_0x37e96a['body'],null))[_0x560c('0x23')](respondWithResult(_0x246715,null))[_0x560c('0x44')](handleError(_0x246715,null));};exports[_0x560c('0x47')]=function(_0x8001aa,_0x22083f){return db[_0x560c('0x29')][_0x560c('0x43')]({'where':{'id':_0x8001aa[_0x560c('0x48')]['id']}})[_0x560c('0x23')](handleEntityNotFound(_0x22083f,null))[_0x560c('0x23')](removeEntity(_0x22083f,null))['catch'](handleError(_0x22083f,null));};exports[_0x560c('0x49')]=function(_0x1b99a0,_0xe27aef){return db[_0x560c('0x29')][_0x560c('0x49')]()[_0x560c('0x23')](respondWithResult(_0xe27aef,null))[_0x560c('0x44')](handleError(_0xe27aef,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index d32abc4..5518189 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 _0xac84=['interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername'];(function(_0x28ed21,_0x3cad89){var _0x183f00=function(_0x2f11c5){while(--_0x2f11c5){_0x28ed21['push'](_0x28ed21['shift']());}};_0x183f00(++_0x3cad89);}(_0xac84,0x199));var _0x4ac8=function(_0x2331af,_0xa80e25){_0x2331af=_0x2331af-0x0;var _0x478d81=_0xac84[_0x2331af];return _0x478d81;};'use strict';var _=require(_0x4ac8('0x0'));var util=require(_0x4ac8('0x1'));var logger=require(_0x4ac8('0x2'))(_0x4ac8('0x3'));var moment=require(_0x4ac8('0x4'));var BPromise=require(_0x4ac8('0x5'));var rp=require(_0x4ac8('0x6'));var fs=require('fs');var path=require(_0x4ac8('0x7'));var rimraf=require(_0x4ac8('0x8'));var config=require(_0x4ac8('0x9'));var attributes=require(_0x4ac8('0xa'));module[_0x4ac8('0xb')]=function(_0x13a792,_0x5a073d){return _0x13a792[_0x4ac8('0xc')](_0x4ac8('0xd'),attributes,{'tableName':_0x4ac8('0xe'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x4ac8('0xf'),_0x4ac8('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x73e0=['membername_interface','membername','interface','lodash','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','MemberReport','report_member'];(function(_0x2dcc45,_0x330afc){var _0x40e394=function(_0x468ed7){while(--_0x468ed7){_0x2dcc45['push'](_0x2dcc45['shift']());}};_0x40e394(++_0x330afc);}(_0x73e0,0x1df));var _0x073e=function(_0x30a998,_0x387f6d){_0x30a998=_0x30a998-0x0;var _0x487985=_0x73e0[_0x30a998];return _0x487985;};'use strict';var _=require(_0x073e('0x0'));var util=require('util');var logger=require(_0x073e('0x1'))(_0x073e('0x2'));var moment=require(_0x073e('0x3'));var BPromise=require(_0x073e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x073e('0x5'));var rimraf=require(_0x073e('0x6'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x073e('0x7')]=function(_0x3299be,_0x2b7e38){return _0x3299be[_0x073e('0x8')](_0x073e('0x9'),attributes,{'tableName':_0x073e('0xa'),'paranoid':![],'indexes':[{'name':_0x073e('0xb'),'fields':[_0x073e('0xc'),_0x073e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 9cfe371..4348be5 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 _0x4ea4=['stringify','error','MemberReport,\x20%s,\x20%s','message','info','result','catch','GetMemberReport','options','raw','attributes','limit','map','include','model','debug','MemberReport','create','CreateMemberReport','update','body','where','UpdateMemberReport','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent'];(function(_0x13ce84,_0xc5cb0){var _0x2aea48=function(_0x437d34){while(--_0x437d34){_0x13ce84['push'](_0x13ce84['shift']());}};_0x2aea48(++_0xc5cb0);}(_0x4ea4,0x1a3));var _0x44ea=function(_0x3077cb,_0x3af841){_0x3077cb=_0x3077cb-0x0;var _0x417717=_0x4ea4[_0x3077cb];return _0x417717;};'use strict';var _=require('lodash');var util=require(_0x44ea('0x0'));var moment=require(_0x44ea('0x1'));var BPromise=require('bluebird');var rs=require(_0x44ea('0x2'));var fs=require('fs');var Redis=require(_0x44ea('0x3'));var db=require(_0x44ea('0x4'))['db'];var utils=require(_0x44ea('0x5'));var logger=require(_0x44ea('0x6'))(_0x44ea('0x7'));var config=require('../../config/environment');var jayson=require(_0x44ea('0x8'));var client=jayson[_0x44ea('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x114224,_0x31afd2,_0x2de18b){return new BPromise(function(_0x2128c8,_0x3858c0){return client[_0x44ea('0xa')](_0x114224,_0x2de18b)[_0x44ea('0xb')](function(_0x3c5520){logger['info']('MemberReport,\x20%s,\x20%s',_0x31afd2,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x31afd2,_0x44ea('0xc'),JSON[_0x44ea('0xd')](_0x3c5520));if(_0x3c5520[_0x44ea('0xe')]){if(_0x3c5520[_0x44ea('0xe')]['code']===0x1f4){logger[_0x44ea('0xe')](_0x44ea('0xf'),_0x31afd2,_0x3c5520[_0x44ea('0xe')]['message']);return _0x3858c0(_0x3c5520['error'][_0x44ea('0x10')]);}logger[_0x44ea('0xe')]('MemberReport,\x20%s,\x20%s',_0x31afd2,_0x3c5520['error'][_0x44ea('0x10')]);return _0x2128c8(_0x3c5520[_0x44ea('0xe')]['message']);}else{logger[_0x44ea('0x11')]('MemberReport,\x20%s,\x20%s',_0x31afd2,_0x44ea('0xc'));_0x2128c8(_0x3c5520[_0x44ea('0x12')][_0x44ea('0x10')]);}})[_0x44ea('0x13')](function(_0x57de48){logger[_0x44ea('0xe')](_0x44ea('0xf'),_0x31afd2,_0x57de48);_0x3858c0(_0x57de48);});});}exports[_0x44ea('0x14')]=function(_0x519466){var _0x4bb659=this;return new Promise(function(_0x167d17,_0x1c142a){return db['MemberReport']['findAll']({'raw':_0x519466[_0x44ea('0x15')]?_0x519466['options'][_0x44ea('0x16')]===undefined?!![]:![]:!![],'where':_0x519466['options']?_0x519466[_0x44ea('0x15')]['where']||null:null,'attributes':_0x519466[_0x44ea('0x15')]?_0x519466[_0x44ea('0x15')][_0x44ea('0x17')]||null:null,'limit':_0x519466[_0x44ea('0x15')]?_0x519466[_0x44ea('0x15')][_0x44ea('0x18')]||null:null,'include':_0x519466[_0x44ea('0x15')]?_0x519466['options']['include']?_[_0x44ea('0x19')](_0x519466[_0x44ea('0x15')][_0x44ea('0x1a')],function(_0x486fbf){return{'model':db[_0x486fbf[_0x44ea('0x1b')]],'as':_0x486fbf['as'],'attributes':_0x486fbf[_0x44ea('0x17')],'include':_0x486fbf[_0x44ea('0x1a')]?_['map'](_0x486fbf[_0x44ea('0x1a')],function(_0x46d8c3){return{'model':db[_0x46d8c3['model']],'as':_0x46d8c3['as'],'attributes':_0x46d8c3[_0x44ea('0x17')],'include':_0x46d8c3['include']?_[_0x44ea('0x19')](_0x46d8c3[_0x44ea('0x1a')],function(_0x1949df){return{'model':db[_0x1949df[_0x44ea('0x1b')]],'as':_0x1949df['as'],'attributes':_0x1949df[_0x44ea('0x17')]};}):[]};}):[]};}):[]:[]})[_0x44ea('0xb')](function(_0x84e0fe){logger[_0x44ea('0x11')]('GetMemberReport',_0x519466);logger[_0x44ea('0x1c')]('GetMemberReport',_0x519466,JSON['stringify'](_0x84e0fe));_0x167d17(_0x84e0fe);})[_0x44ea('0x13')](function(_0x285477){logger[_0x44ea('0xe')](_0x44ea('0x14'),_0x285477[_0x44ea('0x10')],_0x519466);_0x1c142a(_0x4bb659[_0x44ea('0xe')](0x1f4,_0x285477[_0x44ea('0x10')]));});});};exports['CreateMemberReport']=function(_0x3358fa){var _0x253e2b=this;return new Promise(function(_0x45b8c9,_0x5d7aa7){return db[_0x44ea('0x1d')][_0x44ea('0x1e')](_0x3358fa['body'],{'raw':_0x3358fa[_0x44ea('0x15')]?_0x3358fa[_0x44ea('0x15')][_0x44ea('0x16')]===undefined?!![]:![]:!![]})[_0x44ea('0xb')](function(_0x12a26f){logger['info']('CreateMemberReport',_0x3358fa);logger[_0x44ea('0x1c')](_0x44ea('0x1f'),_0x3358fa,JSON[_0x44ea('0xd')](_0x12a26f));_0x45b8c9(_0x12a26f);})[_0x44ea('0x13')](function(_0x201f28){logger[_0x44ea('0xe')](_0x44ea('0x1f'),_0x201f28[_0x44ea('0x10')],_0x3358fa);_0x5d7aa7(_0x253e2b['error'](0x1f4,_0x201f28[_0x44ea('0x10')]));});});};exports['UpdateMemberReport']=function(_0x3d9435){var _0xe5d9ef=this;return new Promise(function(_0x48ce15,_0x35a928){return db[_0x44ea('0x1d')][_0x44ea('0x20')](_0x3d9435[_0x44ea('0x21')],{'raw':_0x3d9435[_0x44ea('0x15')]?_0x3d9435[_0x44ea('0x15')][_0x44ea('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d9435[_0x44ea('0x15')]?_0x3d9435['options'][_0x44ea('0x22')]||null:null,'attributes':_0x3d9435[_0x44ea('0x15')]?_0x3d9435[_0x44ea('0x15')][_0x44ea('0x17')]||null:null,'limit':_0x3d9435['options']?_0x3d9435['options'][_0x44ea('0x18')]||null:null})[_0x44ea('0xb')](function(_0x32cac7){logger[_0x44ea('0x11')](_0x44ea('0x23'),_0x3d9435);logger[_0x44ea('0x1c')](_0x44ea('0x23'),_0x3d9435,JSON[_0x44ea('0xd')](_0x32cac7));_0x48ce15(_0x32cac7);})['catch'](function(_0x49a032){logger['error'](_0x44ea('0x23'),_0x49a032[_0x44ea('0x10')],_0x3d9435);_0x35a928(_0xe5d9ef[_0x44ea('0xe')](0x1f4,_0x49a032['message']));});});}; \ No newline at end of file +var _0x9faa=['jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message','result','GetMemberReport','options','raw','where','attributes','limit','include','map','model','stringify','catch','MemberReport','body','then','CreateMemberReport','UpdateMemberReport','update','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment'];(function(_0x14b5fe,_0xb16d96){var _0x3158b3=function(_0x324e59){while(--_0x324e59){_0x14b5fe['push'](_0x14b5fe['shift']());}};_0x3158b3(++_0xb16d96);}(_0x9faa,0x17a));var _0xa9fa=function(_0x41700e,_0x4b3084){_0x41700e=_0x41700e-0x0;var _0x2a0a9f=_0x9faa[_0x41700e];return _0x2a0a9f;};'use strict';var _=require('lodash');var util=require(_0xa9fa('0x0'));var moment=require(_0xa9fa('0x1'));var BPromise=require(_0xa9fa('0x2'));var rs=require(_0xa9fa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa9fa('0x4'))(_0xa9fa('0x5'));var config=require(_0xa9fa('0x6'));var jayson=require(_0xa9fa('0x7'));var client=jayson[_0xa9fa('0x8')][_0xa9fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f0184,_0x4f6ec0,_0x1cd664){return new BPromise(function(_0x382169,_0x21360a){return client['request'](_0x1f0184,_0x1cd664)['then'](function(_0x131239){logger[_0xa9fa('0xa')](_0xa9fa('0xb'),_0x4f6ec0,_0xa9fa('0xc'));logger[_0xa9fa('0xd')](_0xa9fa('0xe'),_0x4f6ec0,_0xa9fa('0xc'),JSON['stringify'](_0x131239));if(_0x131239[_0xa9fa('0xf')]){if(_0x131239[_0xa9fa('0xf')]['code']===0x1f4){logger[_0xa9fa('0xf')](_0xa9fa('0xb'),_0x4f6ec0,_0x131239['error'][_0xa9fa('0x10')]);return _0x21360a(_0x131239['error'][_0xa9fa('0x10')]);}logger[_0xa9fa('0xf')](_0xa9fa('0xb'),_0x4f6ec0,_0x131239[_0xa9fa('0xf')][_0xa9fa('0x10')]);return _0x382169(_0x131239[_0xa9fa('0xf')]['message']);}else{logger[_0xa9fa('0xa')]('MemberReport,\x20%s,\x20%s',_0x4f6ec0,'request\x20sent');_0x382169(_0x131239[_0xa9fa('0x11')][_0xa9fa('0x10')]);}})['catch'](function(_0x23bcfd){logger[_0xa9fa('0xf')]('MemberReport,\x20%s,\x20%s',_0x4f6ec0,_0x23bcfd);_0x21360a(_0x23bcfd);});});}exports[_0xa9fa('0x12')]=function(_0x3bddd1){var _0x5d8eea=this;return new Promise(function(_0x2924c1,_0x41f6b2){return db['MemberReport']['findAll']({'raw':_0x3bddd1['options']?_0x3bddd1[_0xa9fa('0x13')][_0xa9fa('0x14')]===undefined?!![]:![]:!![],'where':_0x3bddd1[_0xa9fa('0x13')]?_0x3bddd1['options'][_0xa9fa('0x15')]||null:null,'attributes':_0x3bddd1[_0xa9fa('0x13')]?_0x3bddd1[_0xa9fa('0x13')][_0xa9fa('0x16')]||null:null,'limit':_0x3bddd1['options']?_0x3bddd1[_0xa9fa('0x13')][_0xa9fa('0x17')]||null:null,'include':_0x3bddd1[_0xa9fa('0x13')]?_0x3bddd1[_0xa9fa('0x13')][_0xa9fa('0x18')]?_[_0xa9fa('0x19')](_0x3bddd1[_0xa9fa('0x13')][_0xa9fa('0x18')],function(_0x1155e5){return{'model':db[_0x1155e5[_0xa9fa('0x1a')]],'as':_0x1155e5['as'],'attributes':_0x1155e5['attributes'],'include':_0x1155e5['include']?_[_0xa9fa('0x19')](_0x1155e5[_0xa9fa('0x18')],function(_0x3df293){return{'model':db[_0x3df293[_0xa9fa('0x1a')]],'as':_0x3df293['as'],'attributes':_0x3df293[_0xa9fa('0x16')],'include':_0x3df293['include']?_['map'](_0x3df293['include'],function(_0x2dc769){return{'model':db[_0x2dc769[_0xa9fa('0x1a')]],'as':_0x2dc769['as'],'attributes':_0x2dc769['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b4efc){logger['info'](_0xa9fa('0x12'),_0x3bddd1);logger[_0xa9fa('0xd')]('GetMemberReport',_0x3bddd1,JSON[_0xa9fa('0x1b')](_0x4b4efc));_0x2924c1(_0x4b4efc);})[_0xa9fa('0x1c')](function(_0x3a0157){logger['error'](_0xa9fa('0x12'),_0x3a0157[_0xa9fa('0x10')],_0x3bddd1);_0x41f6b2(_0x5d8eea['error'](0x1f4,_0x3a0157[_0xa9fa('0x10')]));});});};exports['CreateMemberReport']=function(_0x37006a){var _0x13524e=this;return new Promise(function(_0x4ae5d4,_0x43eaba){return db[_0xa9fa('0x1d')]['create'](_0x37006a[_0xa9fa('0x1e')],{'raw':_0x37006a[_0xa9fa('0x13')]?_0x37006a[_0xa9fa('0x13')]['raw']===undefined?!![]:![]:!![]})[_0xa9fa('0x1f')](function(_0x3ca706){logger[_0xa9fa('0xa')](_0xa9fa('0x20'),_0x37006a);logger['debug'](_0xa9fa('0x20'),_0x37006a,JSON[_0xa9fa('0x1b')](_0x3ca706));_0x4ae5d4(_0x3ca706);})[_0xa9fa('0x1c')](function(_0x3cbafb){logger['error'](_0xa9fa('0x20'),_0x3cbafb['message'],_0x37006a);_0x43eaba(_0x13524e['error'](0x1f4,_0x3cbafb['message']));});});};exports[_0xa9fa('0x21')]=function(_0x3b4518){var _0x3e26ee=this;return new Promise(function(_0x5301d8,_0x16b89b){return db['MemberReport'][_0xa9fa('0x22')](_0x3b4518[_0xa9fa('0x1e')],{'raw':_0x3b4518['options']?_0x3b4518[_0xa9fa('0x13')][_0xa9fa('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b4518['options']?_0x3b4518['options'][_0xa9fa('0x15')]||null:null,'attributes':_0x3b4518['options']?_0x3b4518[_0xa9fa('0x13')][_0xa9fa('0x16')]||null:null,'limit':_0x3b4518[_0xa9fa('0x13')]?_0x3b4518[_0xa9fa('0x13')][_0xa9fa('0x17')]||null:null})['then'](function(_0xf8a4d0){logger[_0xa9fa('0xa')](_0xa9fa('0x21'),_0x3b4518);logger[_0xa9fa('0xd')](_0xa9fa('0x21'),_0x3b4518,JSON[_0xa9fa('0x1b')](_0xf8a4d0));_0x5301d8(_0xf8a4d0);})['catch'](function(_0x22571b){logger[_0xa9fa('0xf')](_0xa9fa('0x21'),_0x22571b['message'],_0x3b4518);_0x16b89b(_0x3e26ee[_0xa9fa('0xf')](0x1f4,_0x22571b[_0xa9fa('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 33506d8..94293eb 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 _0xcd59=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5ad794,_0x330eb1){var _0x58d45e=function(_0x28c899){while(--_0x28c899){_0x5ad794['push'](_0x5ad794['shift']());}};_0x58d45e(++_0x330eb1);}(_0xcd59,0x14b));var _0x9cd5=function(_0x4a8812,_0x430080){_0x4a8812=_0x4a8812-0x0;var _0x55a784=_0xcd59[_0x4a8812];return _0x55a784;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var timeout=require(_0x9cd5('0x3'));var express=require(_0x9cd5('0x4'));var router=express[_0x9cd5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9cd5('0x6'));var interaction=require(_0x9cd5('0x7'));var config=require(_0x9cd5('0x8'));var controller=require(_0x9cd5('0x9'));router[_0x9cd5('0xa')]('/',controller[_0x9cd5('0xb')]);module[_0x9cd5('0xc')]=router; \ No newline at end of file +var _0xcca7=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path'];(function(_0x2502ca,_0xdaacfb){var _0x137e6d=function(_0x381796){while(--_0x381796){_0x2502ca['push'](_0x2502ca['shift']());}};_0x137e6d(++_0xdaacfb);}(_0xcca7,0x1aa));var _0x7cca=function(_0x50d678,_0x1393ce){_0x50d678=_0x50d678-0x0;var _0x3f4ab4=_0xcca7[_0x50d678];return _0x3f4ab4;};'use strict';var multer=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var path=require(_0x7cca('0x2'));var timeout=require(_0x7cca('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7cca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7cca('0x5'));var config=require(_0x7cca('0x6'));var controller=require(_0x7cca('0x7'));router[_0x7cca('0x8')]('/',controller[_0x7cca('0x9')]);module[_0x7cca('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 5199fce..3bdd8cc 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 _0xfcf3=['sequelize','version'];(function(_0x296e27,_0x50b464){var _0x360dc2=function(_0x50e9b4){while(--_0x50e9b4){_0x296e27['push'](_0x296e27['shift']());}};_0x360dc2(++_0x50b464);}(_0xfcf3,0x110));var _0x3fcf=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0xfcf3[_0x38eb23];return _0x48506a;};'use strict';var Sequelize=require(_0x3fcf('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x3fcf('0x1')}}; \ No newline at end of file +var _0xd061=['version','sequelize','exports'];(function(_0x25f531,_0x1209ae){var _0x6ac282=function(_0x50bbc3){while(--_0x50bbc3){_0x25f531['push'](_0x25f531['shift']());}};_0x6ac282(++_0x1209ae);}(_0xd061,0x1ea));var _0x1d06=function(_0x1729b7,_0x573ef8){_0x1729b7=_0x1729b7-0x0;var _0x174110=_0xd061[_0x1729b7];return _0x174110;};'use strict';var Sequelize=require(_0x1d06('0x0'));module[_0x1d06('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x1d06('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 37d5958..750d5ed 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 _0x7b84=['filter','merge','options','includeAll','include','findAll','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','Migration','fieldName','type','model','keys','query','intersection','fields','attributes','hasOwnProperty','order','where','filters','pick'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x7b84,0xc7));var _0x47b8=function(_0x37fee7,_0x347789){_0x37fee7=_0x37fee7-0x0;var _0x41f7ca=_0x7b84[_0x37fee7];return _0x41f7ca;};'use strict';var pdf=require(_0x47b8('0x0'));var emlformat=require(_0x47b8('0x1'));var rimraf=require(_0x47b8('0x2'));var zipdir=require(_0x47b8('0x3'));var jsonpatch=require(_0x47b8('0x4'));var rp=require(_0x47b8('0x5'));var moment=require(_0x47b8('0x6'));var BPromise=require(_0x47b8('0x7'));var Mustache=require(_0x47b8('0x8'));var util=require('util');var path=require(_0x47b8('0x9'));var sox=require('sox');var csv=require(_0x47b8('0xa'));var ejs=require(_0x47b8('0xb'));var fs=require('fs');var fs_extra=require(_0x47b8('0xc'));var _=require('lodash');var squel=require(_0x47b8('0xd'));var crypto=require(_0x47b8('0xe'));var jsforce=require(_0x47b8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x47b8('0xa'));var querystring=require(_0x47b8('0x10'));var Papa=require(_0x47b8('0x11'));var Redis=require(_0x47b8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x47b8('0x13'));var as=require(_0x47b8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47b8('0x15'));var utils=require(_0x47b8('0x16'));var config=require(_0x47b8('0x17'));var licenseUtil=require(_0x47b8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3984b6,_0x5dbe12){_0x5dbe12=_0x5dbe12||0xcc;return function(_0x291a46){if(_0x291a46){return _0x3984b6[_0x47b8('0x19')](_0x5dbe12);}return _0x3984b6[_0x47b8('0x1a')](_0x5dbe12)[_0x47b8('0x1b')]();};}function respondWithResult(_0xa48378,_0xc9bf08){_0xc9bf08=_0xc9bf08||0xc8;return function(_0x4f0d0f){if(_0x4f0d0f){return _0xa48378['status'](_0xc9bf08)[_0x47b8('0x1c')](_0x4f0d0f);}};}function respondWithFilteredResult(_0x1b4aa7,_0x482c7b){return function(_0x1b0ee3){if(_0x1b0ee3){var _0x14da23=_0x1b0ee3[_0x47b8('0x1d')],_0x4eb0b7=_0x482c7b['offset'],_0x32f4d8=_0x482c7b[_0x47b8('0x1e')]+_0x482c7b[_0x47b8('0x1f')],_0x518bcf;if(_0x32f4d8>=_0x14da23){_0x32f4d8=_0x14da23;_0x518bcf=0xc8;}else{_0x518bcf=0xce;}_0x1b4aa7[_0x47b8('0x1a')](_0x518bcf);return _0x1b4aa7['set'](_0x47b8('0x20'),_0x4eb0b7+'-'+_0x32f4d8+'/'+_0x14da23)[_0x47b8('0x1c')](_0x1b0ee3);}return null;};}function patchUpdates(_0x212bf2){return function(_0x2a7ebc){try{jsonpatch[_0x47b8('0x21')](_0x2a7ebc,_0x212bf2,!![]);}catch(_0x418c08){return BPromise[_0x47b8('0x22')](_0x418c08);}return _0x2a7ebc['save']();};}function saveUpdates(_0x1154ce,_0x47e8ad){return function(_0x323e78){if(_0x323e78){return _0x323e78[_0x47b8('0x23')](_0x1154ce)[_0x47b8('0x24')](function(_0x2c60de){return _0x2c60de;});}return null;};}function removeEntity(_0x3349b1,_0x4f0fc6){return function(_0x3918d8){if(_0x3918d8){return _0x3918d8[_0x47b8('0x25')]()[_0x47b8('0x24')](function(){_0x3349b1[_0x47b8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48af03,_0x276785){return function(_0xa63c25){if(!_0xa63c25){_0x48af03[_0x47b8('0x19')](0x194);}return _0xa63c25;};}function handleError(_0x8b728a,_0x32021f){_0x32021f=_0x32021f||0x1f4;return function(_0x56e2c5){logger[_0x47b8('0x26')](_0x56e2c5[_0x47b8('0x27')]);if(_0x56e2c5['name']){delete _0x56e2c5[_0x47b8('0x28')];}_0x8b728a['status'](_0x32021f)[_0x47b8('0x29')](_0x56e2c5);};}exports['index']=function(_0x6d1d5e,_0x29c84a){var _0x33e4da={},_0x5e81fb={},_0x2d9c2b={'count':0x0,'rows':[]};var _0x375f8d=_[_0x47b8('0x2a')](db[_0x47b8('0x2b')]['rawAttributes'],function(_0x566045){return{'name':_0x566045[_0x47b8('0x2c')],'type':_0x566045[_0x47b8('0x2d')]['key']};});_0x5e81fb[_0x47b8('0x2e')]=_[_0x47b8('0x2a')](_0x375f8d,'name');_0x5e81fb['query']=_[_0x47b8('0x2f')](_0x6d1d5e[_0x47b8('0x30')]);_0x5e81fb['filters']=_[_0x47b8('0x31')](_0x5e81fb[_0x47b8('0x2e')],_0x5e81fb[_0x47b8('0x30')]);_0x33e4da['attributes']=_[_0x47b8('0x31')](_0x5e81fb[_0x47b8('0x2e')],qs['fields'](_0x6d1d5e['query'][_0x47b8('0x32')]));_0x33e4da[_0x47b8('0x33')]=_0x33e4da[_0x47b8('0x33')]['length']?_0x33e4da[_0x47b8('0x33')]:_0x5e81fb[_0x47b8('0x2e')];if(!_0x6d1d5e[_0x47b8('0x30')][_0x47b8('0x34')]('nolimit')){_0x33e4da['limit']=qs['limit'](_0x6d1d5e[_0x47b8('0x30')][_0x47b8('0x1f')]);_0x33e4da[_0x47b8('0x1e')]=qs[_0x47b8('0x1e')](_0x6d1d5e['query'][_0x47b8('0x1e')]);}_0x33e4da[_0x47b8('0x35')]=qs['sort'](_0x6d1d5e[_0x47b8('0x30')]['sort']);_0x33e4da[_0x47b8('0x36')]=qs[_0x47b8('0x37')](_[_0x47b8('0x38')](_0x6d1d5e['query'],_0x5e81fb[_0x47b8('0x37')]),_0x375f8d);if(_0x6d1d5e[_0x47b8('0x30')][_0x47b8('0x39')]){_0x33e4da[_0x47b8('0x36')]=_[_0x47b8('0x3a')](_0x33e4da[_0x47b8('0x36')],{'$or':_['map'](_0x375f8d,function(_0x268ac0){if(_0x268ac0['type']!=='VIRTUAL'){var _0x26934c={};_0x26934c[_0x268ac0['name']]={'$like':'%'+_0x6d1d5e[_0x47b8('0x30')][_0x47b8('0x39')]+'%'};return _0x26934c;}})});}_0x33e4da=_[_0x47b8('0x3a')]({},_0x33e4da,_0x6d1d5e[_0x47b8('0x3b')]);var _0x417062={'where':_0x33e4da['where']};return db[_0x47b8('0x2b')]['count'](_0x417062)[_0x47b8('0x24')](function(_0x269bd0){_0x2d9c2b[_0x47b8('0x1d')]=_0x269bd0;if(_0x6d1d5e[_0x47b8('0x30')][_0x47b8('0x3c')]){_0x33e4da[_0x47b8('0x3d')]=[{'all':!![]}];}return db[_0x47b8('0x2b')][_0x47b8('0x3e')](_0x33e4da);})[_0x47b8('0x24')](function(_0x4cc6e4){_0x2d9c2b['rows']=_0x4cc6e4;return _0x2d9c2b;})['then'](respondWithFilteredResult(_0x29c84a,_0x33e4da))[_0x47b8('0x3f')](handleError(_0x29c84a,null));}; \ No newline at end of file +var _0xb753=['options','catch','html-pdf','zip-dir','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','reject','save','destroy','then','end','error','stack','name','index','Migration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','VIRTUAL','filter'];(function(_0x102b20,_0x5bcf4d){var _0x471302=function(_0x1e1dbf){while(--_0x1e1dbf){_0x102b20['push'](_0x102b20['shift']());}};_0x471302(++_0x5bcf4d);}(_0xb753,0xe6));var _0x3b75=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0xb753[_0x454165];return _0x56db53;};'use strict';var pdf=require(_0x3b75('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3b75('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3b75('0x2'));var Mustache=require('mustache');var util=require(_0x3b75('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x3b75('0x4'));var ejs=require(_0x3b75('0x5'));var fs=require('fs');var fs_extra=require(_0x3b75('0x6'));var _=require('lodash');var squel=require(_0x3b75('0x7'));var crypto=require(_0x3b75('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x3b75('0x9'));var toCsv=require(_0x3b75('0x4'));var querystring=require(_0x3b75('0xa'));var Papa=require('papaparse');var Redis=require(_0x3b75('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x3b75('0xc'));var as=require(_0x3b75('0xd'));var hardwareService=require(_0x3b75('0xe'));var logger=require(_0x3b75('0xf'))(_0x3b75('0x10'));var utils=require(_0x3b75('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x3b75('0x12'));var db=require(_0x3b75('0x13'))['db'];function respondWithStatusCode(_0xc8885c,_0x5416ba){_0x5416ba=_0x5416ba||0xcc;return function(_0xb57e22){if(_0xb57e22){return _0xc8885c[_0x3b75('0x14')](_0x5416ba);}return _0xc8885c[_0x3b75('0x15')](_0x5416ba)['end']();};}function respondWithResult(_0x27a29c,_0x278b15){_0x278b15=_0x278b15||0xc8;return function(_0x4f9510){if(_0x4f9510){return _0x27a29c['status'](_0x278b15)['json'](_0x4f9510);}};}function respondWithFilteredResult(_0x544e2b,_0x417c97){return function(_0x5635fd){if(_0x5635fd){var _0x1ff801=_0x5635fd['count'],_0x59abfe=_0x417c97[_0x3b75('0x16')],_0x5bef40=_0x417c97[_0x3b75('0x16')]+_0x417c97[_0x3b75('0x17')],_0xc20362;if(_0x5bef40>=_0x1ff801){_0x5bef40=_0x1ff801;_0xc20362=0xc8;}else{_0xc20362=0xce;}_0x544e2b[_0x3b75('0x15')](_0xc20362);return _0x544e2b[_0x3b75('0x18')](_0x3b75('0x19'),_0x59abfe+'-'+_0x5bef40+'/'+_0x1ff801)[_0x3b75('0x1a')](_0x5635fd);}return null;};}function patchUpdates(_0x244ce5){return function(_0x3c1ff8){try{jsonpatch['apply'](_0x3c1ff8,_0x244ce5,!![]);}catch(_0x357157){return BPromise[_0x3b75('0x1b')](_0x357157);}return _0x3c1ff8[_0x3b75('0x1c')]();};}function saveUpdates(_0x190a6f,_0xcc6043){return function(_0x1f05f0){if(_0x1f05f0){return _0x1f05f0['update'](_0x190a6f)['then'](function(_0x238507){return _0x238507;});}return null;};}function removeEntity(_0x5db8c2,_0x3058da){return function(_0x344667){if(_0x344667){return _0x344667[_0x3b75('0x1d')]()[_0x3b75('0x1e')](function(){_0x5db8c2['status'](0xcc)[_0x3b75('0x1f')]();});}};}function handleEntityNotFound(_0x2960cc,_0x4ddb79){return function(_0x26b4e9){if(!_0x26b4e9){_0x2960cc[_0x3b75('0x14')](0x194);}return _0x26b4e9;};}function handleError(_0x2c2fd2,_0x24a94e){_0x24a94e=_0x24a94e||0x1f4;return function(_0x944382){logger[_0x3b75('0x20')](_0x944382[_0x3b75('0x21')]);if(_0x944382[_0x3b75('0x22')]){delete _0x944382[_0x3b75('0x22')];}_0x2c2fd2['status'](_0x24a94e)['send'](_0x944382);};}exports[_0x3b75('0x23')]=function(_0x4cf6e0,_0x510427){var _0x8459ee={},_0x499ae7={},_0x58617a={'count':0x0,'rows':[]};var _0x1ae56c=_['map'](db[_0x3b75('0x24')][_0x3b75('0x25')],function(_0x683f66){return{'name':_0x683f66[_0x3b75('0x26')],'type':_0x683f66[_0x3b75('0x27')][_0x3b75('0x28')]};});_0x499ae7[_0x3b75('0x29')]=_[_0x3b75('0x2a')](_0x1ae56c,_0x3b75('0x22'));_0x499ae7['query']=_[_0x3b75('0x2b')](_0x4cf6e0[_0x3b75('0x2c')]);_0x499ae7[_0x3b75('0x2d')]=_['intersection'](_0x499ae7['model'],_0x499ae7[_0x3b75('0x2c')]);_0x8459ee[_0x3b75('0x2e')]=_[_0x3b75('0x2f')](_0x499ae7[_0x3b75('0x29')],qs[_0x3b75('0x30')](_0x4cf6e0[_0x3b75('0x2c')][_0x3b75('0x30')]));_0x8459ee[_0x3b75('0x2e')]=_0x8459ee[_0x3b75('0x2e')][_0x3b75('0x31')]?_0x8459ee['attributes']:_0x499ae7[_0x3b75('0x29')];if(!_0x4cf6e0[_0x3b75('0x2c')][_0x3b75('0x32')](_0x3b75('0x33'))){_0x8459ee['limit']=qs[_0x3b75('0x17')](_0x4cf6e0[_0x3b75('0x2c')][_0x3b75('0x17')]);_0x8459ee['offset']=qs[_0x3b75('0x16')](_0x4cf6e0['query'][_0x3b75('0x16')]);}_0x8459ee['order']=qs['sort'](_0x4cf6e0[_0x3b75('0x2c')]['sort']);_0x8459ee[_0x3b75('0x34')]=qs['filters'](_['pick'](_0x4cf6e0[_0x3b75('0x2c')],_0x499ae7[_0x3b75('0x2d')]),_0x1ae56c);if(_0x4cf6e0[_0x3b75('0x2c')]['filter']){_0x8459ee[_0x3b75('0x34')]=_['merge'](_0x8459ee[_0x3b75('0x34')],{'$or':_[_0x3b75('0x2a')](_0x1ae56c,function(_0x27f280){if(_0x27f280['type']!==_0x3b75('0x35')){var _0x4ef643={};_0x4ef643[_0x27f280[_0x3b75('0x22')]]={'$like':'%'+_0x4cf6e0[_0x3b75('0x2c')][_0x3b75('0x36')]+'%'};return _0x4ef643;}})});}_0x8459ee=_['merge']({},_0x8459ee,_0x4cf6e0[_0x3b75('0x37')]);var _0x255201={'where':_0x8459ee[_0x3b75('0x34')]};return db[_0x3b75('0x24')]['count'](_0x255201)['then'](function(_0x1ff41c){_0x58617a['count']=_0x1ff41c;if(_0x4cf6e0[_0x3b75('0x2c')]['includeAll']){_0x8459ee['include']=[{'all':!![]}];}return db[_0x3b75('0x24')]['findAll'](_0x8459ee);})[_0x3b75('0x1e')](function(_0x3a8b02){_0x58617a['rows']=_0x3a8b02;return _0x58617a;})[_0x3b75('0x1e')](respondWithFilteredResult(_0x510427,_0x8459ee))[_0x3b75('0x38')](handleError(_0x510427,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 6072140..529d74c 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 _0xab75=['define','Migration','migrations','lodash','util','api','bluebird','request-promise','path','rimraf','./migration.attributes','exports'];(function(_0xbcc6e1,_0x4c42f6){var _0x4985f9=function(_0x2f96ec){while(--_0x2f96ec){_0xbcc6e1['push'](_0xbcc6e1['shift']());}};_0x4985f9(++_0x4c42f6);}(_0xab75,0x10b));var _0x5ab7=function(_0x394431,_0x4d6074){_0x394431=_0x394431-0x0;var _0x560883=_0xab75[_0x394431];return _0x560883;};'use strict';var _=require(_0x5ab7('0x0'));var util=require(_0x5ab7('0x1'));var logger=require('../../config/logger')(_0x5ab7('0x2'));var moment=require('moment');var BPromise=require(_0x5ab7('0x3'));var rp=require(_0x5ab7('0x4'));var fs=require('fs');var path=require(_0x5ab7('0x5'));var rimraf=require(_0x5ab7('0x6'));var config=require('../../config/environment');var attributes=require(_0x5ab7('0x7'));module[_0x5ab7('0x8')]=function(_0x9ed08e,_0x3cb7f3){return _0x9ed08e[_0x5ab7('0x9')](_0x5ab7('0xa'),attributes,{'tableName':_0x5ab7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d8f=['api','bluebird','path','rimraf','../../config/environment','exports','Migration','lodash','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4d8f,0xd6));var _0xf4d8=function(_0x3b506d,_0x3e4787){_0x3b506d=_0x3b506d-0x0;var _0x3afc5f=_0x4d8f[_0x3b506d];return _0x3afc5f;};'use strict';var _=require(_0xf4d8('0x0'));var util=require('util');var logger=require(_0xf4d8('0x1'))(_0xf4d8('0x2'));var moment=require('moment');var BPromise=require(_0xf4d8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4d8('0x4'));var rimraf=require(_0xf4d8('0x5'));var config=require(_0xf4d8('0x6'));var attributes=require('./migration.attributes');module[_0xf4d8('0x7')]=function(_0x2ed687,_0x4079ff){return _0x2ed687['define'](_0xf4d8('0x8'),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 71e994b..d0cc397 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 _0xeeaf=['Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x55e720,_0x1a85c2){var _0x1a250a=function(_0x284aa4){while(--_0x284aa4){_0x55e720['push'](_0x55e720['shift']());}};_0x1a250a(++_0x1a85c2);}(_0xeeaf,0x150));var _0xfeea=function(_0xed1c3a,_0x2b30e5){_0xed1c3a=_0xed1c3a-0x0;var _0x21f91c=_0xeeaf[_0xed1c3a];return _0x21f91c;};'use strict';var _=require(_0xfeea('0x0'));var util=require('util');var moment=require(_0xfeea('0x1'));var BPromise=require(_0xfeea('0x2'));var rs=require(_0xfeea('0x3'));var fs=require('fs');var Redis=require(_0xfeea('0x4'));var db=require(_0xfeea('0x5'))['db'];var utils=require(_0xfeea('0x6'));var logger=require(_0xfeea('0x7'))(_0xfeea('0x8'));var config=require(_0xfeea('0x9'));var jayson=require(_0xfeea('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a18a8,_0x421507,_0x430d0e){return new BPromise(function(_0x325cf4,_0x313779){return client[_0xfeea('0xb')](_0x2a18a8,_0x430d0e)[_0xfeea('0xc')](function(_0x5aa010){logger[_0xfeea('0xd')](_0xfeea('0xe'),_0x421507,_0xfeea('0xf'));logger['debug'](_0xfeea('0x10'),_0x421507,'request\x20sent',JSON[_0xfeea('0x11')](_0x5aa010));if(_0x5aa010[_0xfeea('0x12')]){if(_0x5aa010[_0xfeea('0x12')][_0xfeea('0x13')]===0x1f4){logger['error'](_0xfeea('0xe'),_0x421507,_0x5aa010['error']['message']);return _0x313779(_0x5aa010[_0xfeea('0x12')][_0xfeea('0x14')]);}logger[_0xfeea('0x12')](_0xfeea('0xe'),_0x421507,_0x5aa010[_0xfeea('0x12')][_0xfeea('0x14')]);return _0x325cf4(_0x5aa010[_0xfeea('0x12')][_0xfeea('0x14')]);}else{logger[_0xfeea('0xd')](_0xfeea('0xe'),_0x421507,'request\x20sent');_0x325cf4(_0x5aa010['result'][_0xfeea('0x14')]);}})[_0xfeea('0x15')](function(_0x657ce8){logger[_0xfeea('0x12')](_0xfeea('0xe'),_0x421507,_0x657ce8);_0x313779(_0x657ce8);});});} \ No newline at end of file +var _0xe517=['moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x232956,_0x1048e9){var _0x40ad38=function(_0xfdb3cc){while(--_0xfdb3cc){_0x232956['push'](_0x232956['shift']());}};_0x40ad38(++_0x1048e9);}(_0xe517,0xe6));var _0x7e51=function(_0xcd9a0e,_0x5c65a9){_0xcd9a0e=_0xcd9a0e-0x0;var _0x7a3243=_0xe517[_0xcd9a0e];return _0x7a3243;};'use strict';var _=require('lodash');var util=require(_0x7e51('0x0'));var moment=require(_0x7e51('0x1'));var BPromise=require(_0x7e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7e51('0x3'));var logger=require(_0x7e51('0x4'))('rpc');var config=require(_0x7e51('0x5'));var jayson=require(_0x7e51('0x6'));var client=jayson[_0x7e51('0x7')][_0x7e51('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53654f,_0xf79a02,_0x50a887){return new BPromise(function(_0x5afbd9,_0x234a2f){return client[_0x7e51('0x9')](_0x53654f,_0x50a887)['then'](function(_0x110b32){logger[_0x7e51('0xa')](_0x7e51('0xb'),_0xf79a02,_0x7e51('0xc'));logger[_0x7e51('0xd')](_0x7e51('0xe'),_0xf79a02,_0x7e51('0xc'),JSON[_0x7e51('0xf')](_0x110b32));if(_0x110b32[_0x7e51('0x10')]){if(_0x110b32[_0x7e51('0x10')][_0x7e51('0x11')]===0x1f4){logger['error'](_0x7e51('0xb'),_0xf79a02,_0x110b32[_0x7e51('0x10')][_0x7e51('0x12')]);return _0x234a2f(_0x110b32[_0x7e51('0x10')][_0x7e51('0x12')]);}logger[_0x7e51('0x10')](_0x7e51('0xb'),_0xf79a02,_0x110b32['error']['message']);return _0x5afbd9(_0x110b32[_0x7e51('0x10')][_0x7e51('0x12')]);}else{logger[_0x7e51('0xa')]('Migration,\x20%s,\x20%s',_0xf79a02,_0x7e51('0xc'));_0x5afbd9(_0x110b32[_0x7e51('0x13')][_0x7e51('0x12')]);}})[_0x7e51('0x14')](function(_0x58f415){logger[_0x7e51('0x10')](_0x7e51('0xb'),_0xf79a02,_0x58f415);_0x234a2f(_0x58f415);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index fe07fa7..5899720 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 _0x72ca=['show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated'];(function(_0x46563f,_0x180dea){var _0x176593=function(_0xc76561){while(--_0xc76561){_0x46563f['push'](_0x46563f['shift']());}};_0x176593(++_0x180dea);}(_0x72ca,0x135));var _0xa72c=function(_0x40c99e,_0x35411d){_0x40c99e=_0x40c99e-0x0;var _0x11b1db=_0x72ca[_0x40c99e];return _0x11b1db;};'use strict';var multer=require(_0xa72c('0x0'));var util=require(_0xa72c('0x1'));var path=require(_0xa72c('0x2'));var timeout=require(_0xa72c('0x3'));var express=require(_0xa72c('0x4'));var router=express[_0xa72c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa72c('0x6'));var config=require(_0xa72c('0x7'));var controller=require(_0xa72c('0x8'));router[_0xa72c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa72c('0x9')]('/:id',auth[_0xa72c('0xa')](),controller[_0xa72c('0xb')]);router[_0xa72c('0xc')]('/',auth[_0xa72c('0xa')](),controller[_0xa72c('0xd')]);router[_0xa72c('0xe')](_0xa72c('0xf'),auth[_0xa72c('0xa')](),controller[_0xa72c('0x10')]);router[_0xa72c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa72c('0x12')]);module[_0xa72c('0x13')]=router; \ No newline at end of file +var _0x1fed=['create','put','/:id','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','index','isAuthenticated','show','post'];(function(_0x4b6205,_0x4bdcbb){var _0x1c8663=function(_0x423a72){while(--_0x423a72){_0x4b6205['push'](_0x4b6205['shift']());}};_0x1c8663(++_0x4bdcbb);}(_0x1fed,0x8d));var _0xd1fe=function(_0x5e0823,_0x146024){_0x5e0823=_0x5e0823-0x0;var _0x592fbb=_0x1fed[_0x5e0823];return _0x592fbb;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd1fe('0x0'));var express=require(_0xd1fe('0x1'));var router=express[_0xd1fe('0x2')]();var fs_extra=require(_0xd1fe('0x3'));var auth=require(_0xd1fe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd1fe('0x5'));var controller=require(_0xd1fe('0x6'));router[_0xd1fe('0x7')]('/',auth['isAuthenticated'](),controller[_0xd1fe('0x8')]);router[_0xd1fe('0x7')]('/:id',auth[_0xd1fe('0x9')](),controller[_0xd1fe('0xa')]);router[_0xd1fe('0xb')]('/',auth[_0xd1fe('0x9')](),controller[_0xd1fe('0xc')]);router[_0xd1fe('0xd')](_0xd1fe('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xd1fe('0xf')](_0xd1fe('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xd1fe('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 394b4a0..fa2ca32 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 _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x3c6382,_0x305e94){var _0x55a35e=function(_0x51b73c){while(--_0x51b73c){_0x3c6382['push'](_0x3c6382['shift']());}};_0x55a35e(++_0x305e94);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x346b70,_0x3396b4){var _0x1548ca=function(_0x466584){while(--_0x466584){_0x346b70['push'](_0x346b70['shift']());}};_0x1548ca(++_0x3396b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index f85906d..161f153 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 _0xba77=['render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','join','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','transaction','server/files/templates/network.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','Network','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','params','includeAll','options','find','create','sequelize','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xba77,0x157));var _0x7ba7=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0xba77[_0x3ed054];return _0x16dd95;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7ba7('0x0'));var rimraf=require(_0x7ba7('0x1'));var zipdir=require(_0x7ba7('0x2'));var jsonpatch=require(_0x7ba7('0x3'));var rp=require(_0x7ba7('0x4'));var moment=require(_0x7ba7('0x5'));var BPromise=require(_0x7ba7('0x6'));var Mustache=require('mustache');var util=require(_0x7ba7('0x7'));var path=require(_0x7ba7('0x8'));var sox=require(_0x7ba7('0x9'));var csv=require(_0x7ba7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ba7('0xb'));var _=require(_0x7ba7('0xc'));var squel=require(_0x7ba7('0xd'));var crypto=require(_0x7ba7('0xe'));var jsforce=require(_0x7ba7('0xf'));var deskjs=require(_0x7ba7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7ba7('0x11'));var Papa=require(_0x7ba7('0x12'));var Redis=require(_0x7ba7('0x13'));var authService=require(_0x7ba7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7ba7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ba7('0x16'))(_0x7ba7('0x17'));var utils=require(_0x7ba7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7ba7('0x19'));var db=require(_0x7ba7('0x1a'))['db'];var jayson=require(_0x7ba7('0x1b'));var client=jayson[_0x7ba7('0x1c')][_0x7ba7('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23152c,_0x373b61,_0x234ea,_0x53ca7b){return new BPromise(function(_0x695b3b,_0x5111d9){var _0x569453=_0x53ca7b||client;return _0x569453['request'](_0x23152c,_0x234ea)[_0x7ba7('0x1e')](function(_0x5a8991){logger[_0x7ba7('0x1f')]('Network,\x20%s,\x20%s',_0x373b61,_0x7ba7('0x20'));logger['debug'](_0x7ba7('0x21'),_0x373b61,_0x7ba7('0x20'),JSON[_0x7ba7('0x22')](_0x5a8991));if(_0x5a8991[_0x7ba7('0x23')]){if(_0x5a8991['error'][_0x7ba7('0x24')]===0x1f4){logger['error'](_0x7ba7('0x25'),_0x373b61,_0x5a8991['error'][_0x7ba7('0x26')]);return _0x5111d9(_0x5a8991[_0x7ba7('0x23')][_0x7ba7('0x26')]);}logger['error'](_0x7ba7('0x25'),_0x373b61,_0x5a8991[_0x7ba7('0x23')][_0x7ba7('0x26')]);return _0x695b3b(_0x5a8991['error']['message']);}else{logger[_0x7ba7('0x1f')](_0x7ba7('0x25'),_0x373b61,_0x7ba7('0x20'));_0x695b3b(_0x5a8991['result'][_0x7ba7('0x26')]);}})[_0x7ba7('0x27')](function(_0x2478e2){logger[_0x7ba7('0x23')](_0x7ba7('0x25'),_0x373b61,_0x2478e2);_0x5111d9(_0x2478e2);});});}function respondWithStatusCode(_0x4d354f,_0x117631){_0x117631=_0x117631||0xcc;return function(_0x39adbb){if(_0x39adbb){return _0x4d354f[_0x7ba7('0x28')](_0x117631);}return _0x4d354f[_0x7ba7('0x29')](_0x117631)[_0x7ba7('0x2a')]();};}function respondWithResult(_0x151720,_0x50be2b){_0x50be2b=_0x50be2b||0xc8;return function(_0xb8eca5){if(_0xb8eca5){return _0x151720[_0x7ba7('0x29')](_0x50be2b)['json'](_0xb8eca5);}};}function respondWithFilteredResult(_0x2b0847,_0x2e8c67){return function(_0x3e8c21){if(_0x3e8c21){var _0x3afb08=_0x3e8c21[_0x7ba7('0x2b')],_0xa8b5a8=_0x2e8c67[_0x7ba7('0x2c')],_0x1e5eab=_0x2e8c67[_0x7ba7('0x2c')]+_0x2e8c67[_0x7ba7('0x2d')],_0x140572;if(_0x1e5eab>=_0x3afb08){_0x1e5eab=_0x3afb08;_0x140572=0xc8;}else{_0x140572=0xce;}_0x2b0847[_0x7ba7('0x29')](_0x140572);return _0x2b0847[_0x7ba7('0x2e')](_0x7ba7('0x2f'),_0xa8b5a8+'-'+_0x1e5eab+'/'+_0x3afb08)[_0x7ba7('0x30')](_0x3e8c21);}return null;};}function patchUpdates(_0x151e71){return function(_0x57b553){try{jsonpatch[_0x7ba7('0x31')](_0x57b553,_0x151e71,!![]);}catch(_0x77dac9){return BPromise[_0x7ba7('0x32')](_0x77dac9);}return _0x57b553[_0x7ba7('0x33')]();};}function saveUpdates(_0x29f6c3,_0x518182){return function(_0x35fef6){if(_0x35fef6){return _0x35fef6[_0x7ba7('0x34')](_0x29f6c3)[_0x7ba7('0x1e')](function(_0x43e622){return _0x43e622;});}return null;};}function removeEntity(_0x4e23b9,_0x1c8567){return function(_0x20898b){if(_0x20898b){return _0x20898b[_0x7ba7('0x35')]()[_0x7ba7('0x1e')](function(){_0x4e23b9[_0x7ba7('0x29')](0xcc)[_0x7ba7('0x2a')]();});}};}function handleEntityNotFound(_0x8c14be,_0x351a11){return function(_0x5d4026){if(!_0x5d4026){_0x8c14be[_0x7ba7('0x28')](0x194);}return _0x5d4026;};}function handleError(_0xcb4b21,_0x2e1fce){_0x2e1fce=_0x2e1fce||0x1f4;return function(_0x202cae){logger[_0x7ba7('0x23')](_0x202cae[_0x7ba7('0x36')]);if(_0x202cae[_0x7ba7('0x37')]){delete _0x202cae['name'];}_0xcb4b21[_0x7ba7('0x29')](_0x2e1fce)['send'](_0x202cae);};}exports[_0x7ba7('0x38')]=function(_0x4dcfde,_0x37c12d){var _0x1a6b3c={},_0x299b07={},_0x1da323={'count':0x0,'rows':[]};var _0x2ce844=_['map'](db[_0x7ba7('0x39')][_0x7ba7('0x3a')],function(_0x1c0fa9){return{'name':_0x1c0fa9[_0x7ba7('0x3b')],'type':_0x1c0fa9[_0x7ba7('0x3c')]['key']};});_0x299b07[_0x7ba7('0x3d')]=_[_0x7ba7('0x3e')](_0x2ce844,_0x7ba7('0x37'));_0x299b07[_0x7ba7('0x3f')]=_[_0x7ba7('0x40')](_0x4dcfde[_0x7ba7('0x3f')]);_0x299b07['filters']=_[_0x7ba7('0x41')](_0x299b07[_0x7ba7('0x3d')],_0x299b07['query']);_0x1a6b3c['attributes']=_[_0x7ba7('0x41')](_0x299b07[_0x7ba7('0x3d')],qs[_0x7ba7('0x42')](_0x4dcfde[_0x7ba7('0x3f')]['fields']));_0x1a6b3c[_0x7ba7('0x43')]=_0x1a6b3c[_0x7ba7('0x43')][_0x7ba7('0x44')]?_0x1a6b3c[_0x7ba7('0x43')]:_0x299b07[_0x7ba7('0x3d')];if(!_0x4dcfde['query'][_0x7ba7('0x45')](_0x7ba7('0x46'))){_0x1a6b3c[_0x7ba7('0x2d')]=qs[_0x7ba7('0x2d')](_0x4dcfde[_0x7ba7('0x3f')]['limit']);_0x1a6b3c[_0x7ba7('0x2c')]=qs[_0x7ba7('0x2c')](_0x4dcfde[_0x7ba7('0x3f')][_0x7ba7('0x2c')]);}_0x1a6b3c['order']=qs['sort'](_0x4dcfde[_0x7ba7('0x3f')][_0x7ba7('0x47')]);_0x1a6b3c[_0x7ba7('0x48')]=qs[_0x7ba7('0x49')](_[_0x7ba7('0x4a')](_0x4dcfde[_0x7ba7('0x3f')],_0x299b07[_0x7ba7('0x49')]),_0x2ce844);if(_0x4dcfde[_0x7ba7('0x3f')][_0x7ba7('0x4b')]){_0x1a6b3c[_0x7ba7('0x48')]=_[_0x7ba7('0x4c')](_0x1a6b3c[_0x7ba7('0x48')],{'$or':_[_0x7ba7('0x3e')](_0x2ce844,function(_0x150caf){if(_0x150caf[_0x7ba7('0x3c')]!==_0x7ba7('0x4d')){var _0x33cf92={};_0x33cf92[_0x150caf[_0x7ba7('0x37')]]={'$like':'%'+_0x4dcfde[_0x7ba7('0x3f')][_0x7ba7('0x4b')]+'%'};return _0x33cf92;}})});}_0x1a6b3c=_[_0x7ba7('0x4c')]({},_0x1a6b3c,_0x4dcfde['options']);var _0x405ce7={'where':_0x1a6b3c[_0x7ba7('0x48')]};return db[_0x7ba7('0x39')][_0x7ba7('0x2b')](_0x405ce7)[_0x7ba7('0x1e')](function(_0x266306){_0x1da323[_0x7ba7('0x2b')]=_0x266306;if(_0x4dcfde[_0x7ba7('0x3f')]['includeAll']){_0x1a6b3c[_0x7ba7('0x4e')]=[{'all':!![]}];}return db[_0x7ba7('0x39')][_0x7ba7('0x4f')](_0x1a6b3c);})[_0x7ba7('0x1e')](function(_0x4be98d){_0x1da323[_0x7ba7('0x50')]=_0x4be98d;return _0x1da323;})[_0x7ba7('0x1e')](respondWithFilteredResult(_0x37c12d,_0x1a6b3c))[_0x7ba7('0x27')](handleError(_0x37c12d,null));};exports['show']=function(_0x3c56fa,_0x505925){var _0x1b7cb6={'raw':!![],'where':{'id':_0x3c56fa[_0x7ba7('0x51')]['id']}},_0x4b5faf={};_0x4b5faf[_0x7ba7('0x3d')]=_['keys'](db[_0x7ba7('0x39')][_0x7ba7('0x3a')]);_0x4b5faf[_0x7ba7('0x3f')]=_[_0x7ba7('0x40')](_0x3c56fa[_0x7ba7('0x3f')]);_0x4b5faf[_0x7ba7('0x49')]=_[_0x7ba7('0x41')](_0x4b5faf[_0x7ba7('0x3d')],_0x4b5faf[_0x7ba7('0x3f')]);_0x1b7cb6[_0x7ba7('0x43')]=_[_0x7ba7('0x41')](_0x4b5faf[_0x7ba7('0x3d')],qs[_0x7ba7('0x42')](_0x3c56fa[_0x7ba7('0x3f')]['fields']));_0x1b7cb6[_0x7ba7('0x43')]=_0x1b7cb6[_0x7ba7('0x43')][_0x7ba7('0x44')]?_0x1b7cb6[_0x7ba7('0x43')]:_0x4b5faf[_0x7ba7('0x3d')];if(_0x3c56fa[_0x7ba7('0x3f')][_0x7ba7('0x52')]){_0x1b7cb6['include']=[{'all':!![]}];}_0x1b7cb6=_['merge']({},_0x1b7cb6,_0x3c56fa[_0x7ba7('0x53')]);return db[_0x7ba7('0x39')][_0x7ba7('0x54')](_0x1b7cb6)[_0x7ba7('0x1e')](handleEntityNotFound(_0x505925,null))[_0x7ba7('0x1e')](respondWithResult(_0x505925,null))['catch'](handleError(_0x505925,null));};exports[_0x7ba7('0x55')]=function(_0x10cbf9,_0x43420e,_0x52c2f2){var _0x9e1f24;return db[_0x7ba7('0x56')]['transaction'](function(_0x345013){return db[_0x7ba7('0x39')][_0x7ba7('0x55')](_0x10cbf9[_0x7ba7('0x57')],{'raw':!![]})['then'](function(_0x45910d){_0x9e1f24=_0x45910d;return db[_0x7ba7('0x39')][_0x7ba7('0x4f')]({'where':{'type':_0x10cbf9['body'][_0x7ba7('0x3c')]},'raw':!![]});})[_0x7ba7('0x1e')](function(_0x43d8d1){if(_0x9e1f24[_0x7ba7('0x3c')][_0x7ba7('0x58')]()==_0x7ba7('0x59')){var _0x4c54ca=fs[_0x7ba7('0x5a')](path['join'](config[_0x7ba7('0x5b')],_0x7ba7('0x5c')),'utf8');var _0x3d4bf2=ejs[_0x7ba7('0x5d')](_0x4c54ca,{'networks':_0x43d8d1||[]});fs['writeFileSync'](_0x7ba7('0x5e'),_0x3d4bf2);return respondWithRpcPromise(_0x7ba7('0x5f'),'create',{'module':_0x7ba7('0x60')});}else if(_0x9e1f24[_0x7ba7('0x3c')][_0x7ba7('0x58')]()==_0x7ba7('0x61')){var _0x4e2a88=fs['readFileSync'](path['join'](config[_0x7ba7('0x5b')],_0x7ba7('0x62')),_0x7ba7('0x63'));var _0x200d56=ejs[_0x7ba7('0x5d')](_0x4e2a88,{'networks':_0x43d8d1||[]});fs[_0x7ba7('0x64')](_0x7ba7('0x65'),_0x200d56);return respondWithRpcPromise(_0x7ba7('0x5f'),_0x7ba7('0x55'),{'module':_0x7ba7('0x60')});}else{var _0x223d23=fs['readFileSync'](path[_0x7ba7('0x66')](config[_0x7ba7('0x5b')],'server/files/templates/network.ejs'),_0x7ba7('0x63'));var _0x3d0d2b=ejs['render'](_0x223d23,{'networks':_0x43d8d1||[]});fs['writeFileSync'](util[_0x7ba7('0x67')](_0x7ba7('0x68'),_0x10cbf9['body'][_0x7ba7('0x3c')][_0x7ba7('0x69')]()),_0x3d0d2b);return respondWithRpcPromise(_0x7ba7('0x5f'),'create',{'module':_0x7ba7('0x6a')});}return null;})[_0x7ba7('0x1e')](function(){return _0x9e1f24;});})[_0x7ba7('0x1e')](respondWithResult(_0x43420e,0xc9))[_0x7ba7('0x27')](handleError(_0x43420e,null));};exports[_0x7ba7('0x34')]=function(_0x1e18e7,_0x1966f2,_0x202b88){var _0x5e1893;return db[_0x7ba7('0x56')][_0x7ba7('0x6b')](function(_0x16a8af){return db[_0x7ba7('0x39')][_0x7ba7('0x54')]({'where':{'id':_0x1e18e7[_0x7ba7('0x51')]['id']}})[_0x7ba7('0x1e')](handleEntityNotFound(_0x1966f2,null))['then'](saveUpdates(_0x1e18e7['body'],null))[_0x7ba7('0x1e')](function(_0x45fc49){if(_0x45fc49){_0x5e1893=_0x45fc49;return db['Network']['findAll']({'where':{'type':_0x5e1893[_0x7ba7('0x3c')]},'raw':!![]});}return null;})[_0x7ba7('0x1e')](function(_0x588542){if(_0x5e1893[_0x7ba7('0x3c')][_0x7ba7('0x58')]()=='STUN'){var _0x7ec082=fs[_0x7ba7('0x5a')](path[_0x7ba7('0x66')](config[_0x7ba7('0x5b')],_0x7ba7('0x5c')),'utf8');var _0x455417=ejs[_0x7ba7('0x5d')](_0x7ec082,{'networks':_0x588542||[]});fs[_0x7ba7('0x64')](_0x7ba7('0x5e'),_0x455417);return respondWithRpcPromise(_0x7ba7('0x5f'),_0x7ba7('0x34'),{'module':_0x7ba7('0x60')});}else if(_0x5e1893['type']['toUpperCase']()=='TURN'){var _0x73f0ad=fs[_0x7ba7('0x5a')](path[_0x7ba7('0x66')](config[_0x7ba7('0x5b')],_0x7ba7('0x62')),_0x7ba7('0x63'));var _0x15c411=ejs['render'](_0x73f0ad,{'networks':_0x588542||[]});fs[_0x7ba7('0x64')](_0x7ba7('0x65'),_0x15c411);return respondWithRpcPromise(_0x7ba7('0x5f'),_0x7ba7('0x34'),{'module':_0x7ba7('0x60')});}else{var _0x3fdbec=fs['readFileSync'](path[_0x7ba7('0x66')](config[_0x7ba7('0x5b')],_0x7ba7('0x6c')),_0x7ba7('0x63'));var _0x572503=ejs[_0x7ba7('0x5d')](_0x3fdbec,{'networks':_0x588542||[]});fs[_0x7ba7('0x64')](util[_0x7ba7('0x67')]('/etc/asterisk/sip_xcally_%s.conf',_0x1e18e7[_0x7ba7('0x57')][_0x7ba7('0x3c')][_0x7ba7('0x69')]()),_0x572503);return respondWithRpcPromise(_0x7ba7('0x5f'),'update',{'module':'chan_sip.so'});}return null;})[_0x7ba7('0x1e')](function(_0x4803ba){if(_0x4803ba){return _0x5e1893;}return null;});})['then'](respondWithResult(_0x1966f2,null))[_0x7ba7('0x27')](handleError(_0x1966f2,null));};exports[_0x7ba7('0x35')]=function(_0x16bc2f,_0x190e87,_0x2ff917){var _0x295d7e;return db[_0x7ba7('0x39')][_0x7ba7('0x54')]({'where':{'id':_0x16bc2f[_0x7ba7('0x51')]['id']}})[_0x7ba7('0x1e')](function(_0x3fa0ee){_0x295d7e=_0x3fa0ee;return _0x3fa0ee;})[_0x7ba7('0x1e')](handleEntityNotFound(_0x190e87,null))[_0x7ba7('0x1e')](removeEntity(_0x190e87,null))['then'](function(){if(_0x295d7e){return db[_0x7ba7('0x39')][_0x7ba7('0x4f')]({'where':{'type':_0x295d7e[_0x7ba7('0x3c')]},'raw':!![]});}})[_0x7ba7('0x1e')](function(_0x987d26){if(_0x295d7e[_0x7ba7('0x3c')][_0x7ba7('0x58')]()=='STUN'){var _0x48b44a=fs['readFileSync'](path['join'](config['root'],_0x7ba7('0x5c')),_0x7ba7('0x63'));var _0x32fdb7=ejs[_0x7ba7('0x5d')](_0x48b44a,{'networks':_0x987d26||[]});fs[_0x7ba7('0x64')](_0x7ba7('0x5e'),_0x32fdb7);return respondWithRpcPromise(_0x7ba7('0x5f'),_0x7ba7('0x35'),{'module':'res_stun_monitor.so'});}else if(_0x295d7e['type'][_0x7ba7('0x58')]()==_0x7ba7('0x61')){var _0x55332a=fs[_0x7ba7('0x5a')](path[_0x7ba7('0x66')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x7ba7('0x63'));var _0x29020f=ejs[_0x7ba7('0x5d')](_0x55332a,{'networks':_0x987d26||[]});fs[_0x7ba7('0x64')](_0x7ba7('0x65'),_0x29020f);return respondWithRpcPromise('Reload',_0x7ba7('0x35'),{'module':_0x7ba7('0x60')});}else{var _0x3a924a=fs[_0x7ba7('0x5a')](path[_0x7ba7('0x66')](config[_0x7ba7('0x5b')],_0x7ba7('0x6c')),_0x7ba7('0x63'));var _0x402a08=ejs['render'](_0x3a924a,{'networks':_0x987d26||[]});fs['writeFileSync'](util['format'](_0x7ba7('0x68'),_0x16bc2f[_0x7ba7('0x57')][_0x7ba7('0x3c')][_0x7ba7('0x69')]()),_0x402a08);return respondWithRpcPromise('Reload',_0x7ba7('0x35'),{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0x190e87,null));}; \ No newline at end of file +var _0x213a=['model','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','sequelize','transaction','create','body','toUpperCase','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','chan_sip.so','update','find','STUN','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','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','jayson/promise','client','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','name','send','index','map','Network','fieldName','type','query','filters','intersection','attributes','fields','length'];(function(_0x47bc5a,_0x184843){var _0xdd9534=function(_0x3e6225){while(--_0x3e6225){_0x47bc5a['push'](_0x47bc5a['shift']());}};_0xdd9534(++_0x184843);}(_0x213a,0x97));var _0xa213=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x213a[_0x277107];return _0x1da046;};'use strict';var pdf=require(_0xa213('0x0'));var emlformat=require(_0xa213('0x1'));var rimraf=require(_0xa213('0x2'));var zipdir=require(_0xa213('0x3'));var jsonpatch=require(_0xa213('0x4'));var rp=require(_0xa213('0x5'));var moment=require(_0xa213('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa213('0x7'));var util=require(_0xa213('0x8'));var path=require(_0xa213('0x9'));var sox=require(_0xa213('0xa'));var csv=require(_0xa213('0xb'));var ejs=require(_0xa213('0xc'));var fs=require('fs');var fs_extra=require(_0xa213('0xd'));var _=require(_0xa213('0xe'));var squel=require('squel');var crypto=require(_0xa213('0xf'));var jsforce=require(_0xa213('0x10'));var deskjs=require(_0xa213('0x11'));var toCsv=require('to-csv');var querystring=require(_0xa213('0x12'));var Papa=require(_0xa213('0x13'));var Redis=require(_0xa213('0x14'));var authService=require(_0xa213('0x15'));var qs=require(_0xa213('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa213('0x17'));var logger=require(_0xa213('0x18'))(_0xa213('0x19'));var utils=require(_0xa213('0x1a'));var config=require(_0xa213('0x1b'));var licenseUtil=require(_0xa213('0x1c'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa213('0x1d'));var client=jayson[_0xa213('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ad8d7,_0x43756b,_0x21275c,_0x380b27){return new BPromise(function(_0x19c62b,_0x57bcba){var _0x36b223=_0x380b27||client;return _0x36b223['request'](_0x2ad8d7,_0x21275c)[_0xa213('0x1f')](function(_0x16006f){logger[_0xa213('0x20')]('Network,\x20%s,\x20%s',_0x43756b,_0xa213('0x21'));logger['debug'](_0xa213('0x22'),_0x43756b,_0xa213('0x21'),JSON['stringify'](_0x16006f));if(_0x16006f[_0xa213('0x23')]){if(_0x16006f[_0xa213('0x23')][_0xa213('0x24')]===0x1f4){logger[_0xa213('0x23')](_0xa213('0x25'),_0x43756b,_0x16006f['error']['message']);return _0x57bcba(_0x16006f[_0xa213('0x23')][_0xa213('0x26')]);}logger[_0xa213('0x23')](_0xa213('0x25'),_0x43756b,_0x16006f['error'][_0xa213('0x26')]);return _0x19c62b(_0x16006f['error'][_0xa213('0x26')]);}else{logger[_0xa213('0x20')](_0xa213('0x25'),_0x43756b,_0xa213('0x21'));_0x19c62b(_0x16006f['result'][_0xa213('0x26')]);}})[_0xa213('0x27')](function(_0x24098e){logger[_0xa213('0x23')](_0xa213('0x25'),_0x43756b,_0x24098e);_0x57bcba(_0x24098e);});});}function respondWithStatusCode(_0xbdd8ed,_0x393062){_0x393062=_0x393062||0xcc;return function(_0x376752){if(_0x376752){return _0xbdd8ed[_0xa213('0x28')](_0x393062);}return _0xbdd8ed[_0xa213('0x29')](_0x393062)[_0xa213('0x2a')]();};}function respondWithResult(_0x12054e,_0x55d07e){_0x55d07e=_0x55d07e||0xc8;return function(_0x18944c){if(_0x18944c){return _0x12054e[_0xa213('0x29')](_0x55d07e)[_0xa213('0x2b')](_0x18944c);}};}function respondWithFilteredResult(_0x97b21e,_0x1c9e3a){return function(_0x35d97e){if(_0x35d97e){var _0x1c1b73=_0x35d97e[_0xa213('0x2c')],_0x21f7f8=_0x1c9e3a['offset'],_0x2dddc6=_0x1c9e3a[_0xa213('0x2d')]+_0x1c9e3a[_0xa213('0x2e')],_0x4a6689;if(_0x2dddc6>=_0x1c1b73){_0x2dddc6=_0x1c1b73;_0x4a6689=0xc8;}else{_0x4a6689=0xce;}_0x97b21e[_0xa213('0x29')](_0x4a6689);return _0x97b21e[_0xa213('0x2f')](_0xa213('0x30'),_0x21f7f8+'-'+_0x2dddc6+'/'+_0x1c1b73)[_0xa213('0x2b')](_0x35d97e);}return null;};}function patchUpdates(_0x25145c){return function(_0x119153){try{jsonpatch[_0xa213('0x31')](_0x119153,_0x25145c,!![]);}catch(_0xc1df0b){return BPromise[_0xa213('0x32')](_0xc1df0b);}return _0x119153[_0xa213('0x33')]();};}function saveUpdates(_0x1252d0,_0x4f281c){return function(_0x47376c){if(_0x47376c){return _0x47376c['update'](_0x1252d0)[_0xa213('0x1f')](function(_0x1252fd){return _0x1252fd;});}return null;};}function removeEntity(_0x37c549,_0x2a5795){return function(_0x311098){if(_0x311098){return _0x311098['destroy']()[_0xa213('0x1f')](function(){_0x37c549[_0xa213('0x29')](0xcc)[_0xa213('0x2a')]();});}};}function handleEntityNotFound(_0x4d2edf,_0x3e3be4){return function(_0x482993){if(!_0x482993){_0x4d2edf[_0xa213('0x28')](0x194);}return _0x482993;};}function handleError(_0x572222,_0x57eb42){_0x57eb42=_0x57eb42||0x1f4;return function(_0x17df22){logger[_0xa213('0x23')](_0x17df22['stack']);if(_0x17df22['name']){delete _0x17df22[_0xa213('0x34')];}_0x572222[_0xa213('0x29')](_0x57eb42)[_0xa213('0x35')](_0x17df22);};}exports[_0xa213('0x36')]=function(_0x45a41d,_0x4b8688){var _0x1dd88c={},_0x193830={},_0x2455ae={'count':0x0,'rows':[]};var _0x1c7912=_[_0xa213('0x37')](db[_0xa213('0x38')]['rawAttributes'],function(_0x220929){return{'name':_0x220929[_0xa213('0x39')],'type':_0x220929[_0xa213('0x3a')]['key']};});_0x193830['model']=_[_0xa213('0x37')](_0x1c7912,_0xa213('0x34'));_0x193830['query']=_['keys'](_0x45a41d[_0xa213('0x3b')]);_0x193830[_0xa213('0x3c')]=_[_0xa213('0x3d')](_0x193830['model'],_0x193830['query']);_0x1dd88c[_0xa213('0x3e')]=_[_0xa213('0x3d')](_0x193830['model'],qs[_0xa213('0x3f')](_0x45a41d[_0xa213('0x3b')]['fields']));_0x1dd88c['attributes']=_0x1dd88c[_0xa213('0x3e')][_0xa213('0x40')]?_0x1dd88c[_0xa213('0x3e')]:_0x193830[_0xa213('0x41')];if(!_0x45a41d[_0xa213('0x3b')][_0xa213('0x42')]('nolimit')){_0x1dd88c[_0xa213('0x2e')]=qs[_0xa213('0x2e')](_0x45a41d[_0xa213('0x3b')]['limit']);_0x1dd88c['offset']=qs[_0xa213('0x2d')](_0x45a41d[_0xa213('0x3b')]['offset']);}_0x1dd88c[_0xa213('0x43')]=qs['sort'](_0x45a41d['query'][_0xa213('0x44')]);_0x1dd88c[_0xa213('0x45')]=qs['filters'](_[_0xa213('0x46')](_0x45a41d[_0xa213('0x3b')],_0x193830['filters']),_0x1c7912);if(_0x45a41d[_0xa213('0x3b')][_0xa213('0x47')]){_0x1dd88c[_0xa213('0x45')]=_[_0xa213('0x48')](_0x1dd88c[_0xa213('0x45')],{'$or':_[_0xa213('0x37')](_0x1c7912,function(_0x21f8b1){if(_0x21f8b1[_0xa213('0x3a')]!==_0xa213('0x49')){var _0x20fa36={};_0x20fa36[_0x21f8b1[_0xa213('0x34')]]={'$like':'%'+_0x45a41d['query']['filter']+'%'};return _0x20fa36;}})});}_0x1dd88c=_[_0xa213('0x48')]({},_0x1dd88c,_0x45a41d[_0xa213('0x4a')]);var _0x354b91={'where':_0x1dd88c[_0xa213('0x45')]};return db[_0xa213('0x38')][_0xa213('0x2c')](_0x354b91)[_0xa213('0x1f')](function(_0x485f64){_0x2455ae[_0xa213('0x2c')]=_0x485f64;if(_0x45a41d['query']['includeAll']){_0x1dd88c[_0xa213('0x4b')]=[{'all':!![]}];}return db[_0xa213('0x38')][_0xa213('0x4c')](_0x1dd88c);})['then'](function(_0x568e4a){_0x2455ae[_0xa213('0x4d')]=_0x568e4a;return _0x2455ae;})[_0xa213('0x1f')](respondWithFilteredResult(_0x4b8688,_0x1dd88c))[_0xa213('0x27')](handleError(_0x4b8688,null));};exports[_0xa213('0x4e')]=function(_0x2ff3ae,_0x2dbc26){var _0x56068e={'raw':!![],'where':{'id':_0x2ff3ae[_0xa213('0x4f')]['id']}},_0x42b4bc={};_0x42b4bc[_0xa213('0x41')]=_['keys'](db[_0xa213('0x38')][_0xa213('0x50')]);_0x42b4bc[_0xa213('0x3b')]=_['keys'](_0x2ff3ae[_0xa213('0x3b')]);_0x42b4bc['filters']=_[_0xa213('0x3d')](_0x42b4bc[_0xa213('0x41')],_0x42b4bc[_0xa213('0x3b')]);_0x56068e['attributes']=_['intersection'](_0x42b4bc[_0xa213('0x41')],qs['fields'](_0x2ff3ae[_0xa213('0x3b')][_0xa213('0x3f')]));_0x56068e[_0xa213('0x3e')]=_0x56068e[_0xa213('0x3e')][_0xa213('0x40')]?_0x56068e[_0xa213('0x3e')]:_0x42b4bc[_0xa213('0x41')];if(_0x2ff3ae[_0xa213('0x3b')][_0xa213('0x51')]){_0x56068e['include']=[{'all':!![]}];}_0x56068e=_[_0xa213('0x48')]({},_0x56068e,_0x2ff3ae[_0xa213('0x4a')]);return db['Network']['find'](_0x56068e)[_0xa213('0x1f')](handleEntityNotFound(_0x2dbc26,null))[_0xa213('0x1f')](respondWithResult(_0x2dbc26,null))[_0xa213('0x27')](handleError(_0x2dbc26,null));};exports['create']=function(_0x51b5b1,_0x102a68,_0x1b60da){var _0x3ac0d2;return db[_0xa213('0x52')][_0xa213('0x53')](function(_0x1e1275){return db[_0xa213('0x38')][_0xa213('0x54')](_0x51b5b1[_0xa213('0x55')],{'raw':!![]})[_0xa213('0x1f')](function(_0x45089f){_0x3ac0d2=_0x45089f;return db[_0xa213('0x38')]['findAll']({'where':{'type':_0x51b5b1[_0xa213('0x55')][_0xa213('0x3a')]},'raw':!![]});})[_0xa213('0x1f')](function(_0x553393){if(_0x3ac0d2[_0xa213('0x3a')][_0xa213('0x56')]()=='STUN'){var _0x1eff58=fs[_0xa213('0x57')](path[_0xa213('0x58')](config['root'],_0xa213('0x59')),_0xa213('0x5a'));var _0x4ffa5d=ejs[_0xa213('0x5b')](_0x1eff58,{'networks':_0x553393||[]});fs[_0xa213('0x5c')](_0xa213('0x5d'),_0x4ffa5d);return respondWithRpcPromise('Reload',_0xa213('0x54'),{'module':_0xa213('0x5e')});}else if(_0x3ac0d2[_0xa213('0x3a')][_0xa213('0x56')]()==_0xa213('0x5f')){var _0x122f39=fs['readFileSync'](path[_0xa213('0x58')](config[_0xa213('0x60')],_0xa213('0x61')),_0xa213('0x5a'));var _0x54e720=ejs[_0xa213('0x5b')](_0x122f39,{'networks':_0x553393||[]});fs[_0xa213('0x5c')](_0xa213('0x62'),_0x54e720);return respondWithRpcPromise('Reload',_0xa213('0x54'),{'module':_0xa213('0x5e')});}else{var _0x4bd524=fs[_0xa213('0x57')](path['join'](config[_0xa213('0x60')],'server/files/templates/network.ejs'),'utf8');var _0x174e46=ejs['render'](_0x4bd524,{'networks':_0x553393||[]});fs['writeFileSync'](util[_0xa213('0x63')](_0xa213('0x64'),_0x51b5b1[_0xa213('0x55')][_0xa213('0x3a')][_0xa213('0x65')]()),_0x174e46);return respondWithRpcPromise(_0xa213('0x66'),_0xa213('0x54'),{'module':_0xa213('0x67')});}return null;})['then'](function(){return _0x3ac0d2;});})[_0xa213('0x1f')](respondWithResult(_0x102a68,0xc9))[_0xa213('0x27')](handleError(_0x102a68,null));};exports[_0xa213('0x68')]=function(_0x457247,_0x498ba2,_0x452766){var _0x37b8da;return db[_0xa213('0x52')][_0xa213('0x53')](function(_0x1d64df){return db['Network'][_0xa213('0x69')]({'where':{'id':_0x457247[_0xa213('0x4f')]['id']}})[_0xa213('0x1f')](handleEntityNotFound(_0x498ba2,null))['then'](saveUpdates(_0x457247[_0xa213('0x55')],null))[_0xa213('0x1f')](function(_0x1d31a0){if(_0x1d31a0){_0x37b8da=_0x1d31a0;return db[_0xa213('0x38')][_0xa213('0x4c')]({'where':{'type':_0x37b8da[_0xa213('0x3a')]},'raw':!![]});}return null;})[_0xa213('0x1f')](function(_0x5eaede){if(_0x37b8da[_0xa213('0x3a')]['toUpperCase']()=='STUN'){var _0x2a7100=fs[_0xa213('0x57')](path[_0xa213('0x58')](config[_0xa213('0x60')],_0xa213('0x59')),'utf8');var _0xee1b05=ejs[_0xa213('0x5b')](_0x2a7100,{'networks':_0x5eaede||[]});fs[_0xa213('0x5c')](_0xa213('0x5d'),_0xee1b05);return respondWithRpcPromise(_0xa213('0x66'),_0xa213('0x68'),{'module':_0xa213('0x5e')});}else if(_0x37b8da[_0xa213('0x3a')]['toUpperCase']()==_0xa213('0x5f')){var _0x395ed1=fs[_0xa213('0x57')](path['join'](config[_0xa213('0x60')],_0xa213('0x61')),_0xa213('0x5a'));var _0x2921b9=ejs[_0xa213('0x5b')](_0x395ed1,{'networks':_0x5eaede||[]});fs[_0xa213('0x5c')](_0xa213('0x62'),_0x2921b9);return respondWithRpcPromise(_0xa213('0x66'),_0xa213('0x68'),{'module':_0xa213('0x5e')});}else{var _0x118d68=fs[_0xa213('0x57')](path[_0xa213('0x58')](config[_0xa213('0x60')],'server/files/templates/network.ejs'),_0xa213('0x5a'));var _0x50df6b=ejs[_0xa213('0x5b')](_0x118d68,{'networks':_0x5eaede||[]});fs['writeFileSync'](util[_0xa213('0x63')](_0xa213('0x64'),_0x457247[_0xa213('0x55')]['type'][_0xa213('0x65')]()),_0x50df6b);return respondWithRpcPromise(_0xa213('0x66'),_0xa213('0x68'),{'module':_0xa213('0x67')});}return null;})[_0xa213('0x1f')](function(_0x164333){if(_0x164333){return _0x37b8da;}return null;});})['then'](respondWithResult(_0x498ba2,null))[_0xa213('0x27')](handleError(_0x498ba2,null));};exports['destroy']=function(_0x20bb7c,_0xb84616,_0x27a3c6){var _0x3754d9;return db['Network']['find']({'where':{'id':_0x20bb7c[_0xa213('0x4f')]['id']}})[_0xa213('0x1f')](function(_0x2ce8c4){_0x3754d9=_0x2ce8c4;return _0x2ce8c4;})[_0xa213('0x1f')](handleEntityNotFound(_0xb84616,null))[_0xa213('0x1f')](removeEntity(_0xb84616,null))[_0xa213('0x1f')](function(){if(_0x3754d9){return db['Network'][_0xa213('0x4c')]({'where':{'type':_0x3754d9[_0xa213('0x3a')]},'raw':!![]});}})['then'](function(_0x33cb1d){if(_0x3754d9[_0xa213('0x3a')]['toUpperCase']()==_0xa213('0x6a')){var _0x9aa8f0=fs[_0xa213('0x57')](path[_0xa213('0x58')](config['root'],_0xa213('0x59')),_0xa213('0x5a'));var _0x206bc6=ejs[_0xa213('0x5b')](_0x9aa8f0,{'networks':_0x33cb1d||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x206bc6);return respondWithRpcPromise(_0xa213('0x66'),'destroy',{'module':_0xa213('0x5e')});}else if(_0x3754d9[_0xa213('0x3a')][_0xa213('0x56')]()=='TURN'){var _0x4e266e=fs[_0xa213('0x57')](path[_0xa213('0x58')](config[_0xa213('0x60')],'server/files/templates/turn_multiple.ejs'),_0xa213('0x5a'));var _0x2a2766=ejs['render'](_0x4e266e,{'networks':_0x33cb1d||[]});fs[_0xa213('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x2a2766);return respondWithRpcPromise(_0xa213('0x66'),_0xa213('0x6b'),{'module':_0xa213('0x5e')});}else{var _0x133686=fs['readFileSync'](path[_0xa213('0x58')](config[_0xa213('0x60')],'server/files/templates/network.ejs'),_0xa213('0x5a'));var _0x4220d3=ejs[_0xa213('0x5b')](_0x133686,{'networks':_0x33cb1d||[]});fs[_0xa213('0x5c')](util[_0xa213('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x20bb7c[_0xa213('0x55')][_0xa213('0x3a')][_0xa213('0x65')]()),_0x4220d3);return respondWithRpcPromise(_0xa213('0x66'),_0xa213('0x6b'),{'module':_0xa213('0x67')});}return null;})['catch'](handleError(_0xb84616,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 9acc526..67339bd 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 _0x4404=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./network.attributes','define','Network','network','lodash','util'];(function(_0x47343c,_0x2724b3){var _0x222435=function(_0x4906f5){while(--_0x4906f5){_0x47343c['push'](_0x47343c['shift']());}};_0x222435(++_0x2724b3);}(_0x4404,0x1c5));var _0x4440=function(_0x2e3620,_0x5140e4){_0x2e3620=_0x2e3620-0x0;var _0x130708=_0x4404[_0x2e3620];return _0x130708;};'use strict';var _=require(_0x4440('0x0'));var util=require(_0x4440('0x1'));var logger=require(_0x4440('0x2'))(_0x4440('0x3'));var moment=require(_0x4440('0x4'));var BPromise=require('bluebird');var rp=require(_0x4440('0x5'));var fs=require('fs');var path=require(_0x4440('0x6'));var rimraf=require(_0x4440('0x7'));var config=require(_0x4440('0x8'));var attributes=require(_0x4440('0x9'));module['exports']=function(_0x967f66,_0x4974f1){return _0x967f66[_0x4440('0xa')](_0x4440('0xb'),attributes,{'tableName':_0x4440('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x327e=['moment','rimraf','../../config/environment','lodash','../../config/logger','api'];(function(_0x7f0385,_0x2303b2){var _0xd53e9e=function(_0xee35f9){while(--_0xee35f9){_0x7f0385['push'](_0x7f0385['shift']());}};_0xd53e9e(++_0x2303b2);}(_0x327e,0x17d));var _0xe327=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x327e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe327('0x0'));var util=require('util');var logger=require(_0xe327('0x1'))(_0xe327('0x2'));var moment=require(_0xe327('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe327('0x4'));var config=require(_0xe327('0x5'));var attributes=require('./network.attributes');module['exports']=function(_0x53db64,_0xaa243){return _0x53db64['define']('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index cea2ab1..4118a4e 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 _0x1390=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1390,0x90));var _0x0139=function(_0x465c9e,_0x1ee715){_0x465c9e=_0x465c9e-0x0;var _0x4d4628=_0x1390[_0x465c9e];return _0x4d4628;};'use strict';var _=require(_0x0139('0x0'));var util=require('util');var moment=require(_0x0139('0x1'));var BPromise=require(_0x0139('0x2'));var rs=require(_0x0139('0x3'));var fs=require('fs');var Redis=require(_0x0139('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0139('0x5'));var logger=require('../../config/logger')(_0x0139('0x6'));var config=require(_0x0139('0x7'));var jayson=require(_0x0139('0x8'));var client=jayson['client'][_0x0139('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f2c69,_0x3c60fd,_0x28b0b3){return new BPromise(function(_0x392b37,_0x41d445){return client['request'](_0x4f2c69,_0x28b0b3)['then'](function(_0x27301f){logger['info']('Network,\x20%s,\x20%s',_0x3c60fd,'request\x20sent');logger[_0x0139('0xa')](_0x0139('0xb'),_0x3c60fd,_0x0139('0xc'),JSON[_0x0139('0xd')](_0x27301f));if(_0x27301f[_0x0139('0xe')]){if(_0x27301f[_0x0139('0xe')][_0x0139('0xf')]===0x1f4){logger[_0x0139('0xe')](_0x0139('0x10'),_0x3c60fd,_0x27301f[_0x0139('0xe')][_0x0139('0x11')]);return _0x41d445(_0x27301f[_0x0139('0xe')]['message']);}logger[_0x0139('0xe')](_0x0139('0x10'),_0x3c60fd,_0x27301f[_0x0139('0xe')]['message']);return _0x392b37(_0x27301f[_0x0139('0xe')][_0x0139('0x11')]);}else{logger[_0x0139('0x12')](_0x0139('0x10'),_0x3c60fd,_0x0139('0xc'));_0x392b37(_0x27301f[_0x0139('0x13')][_0x0139('0x11')]);}})[_0x0139('0x14')](function(_0x20ddf0){logger[_0x0139('0xe')](_0x0139('0x10'),_0x3c60fd,_0x20ddf0);_0x41d445(_0x20ddf0);});});} \ No newline at end of file +var _0x8426=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x8426,0x16c));var _0x6842=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x8426[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x6842('0x0'));var util=require(_0x6842('0x1'));var moment=require(_0x6842('0x2'));var BPromise=require(_0x6842('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6842('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6842('0x5'));var logger=require(_0x6842('0x6'))(_0x6842('0x7'));var config=require(_0x6842('0x8'));var jayson=require(_0x6842('0x9'));var client=jayson[_0x6842('0xa')][_0x6842('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f2aca,_0x3f483e,_0x37c005){return new BPromise(function(_0xfb120d,_0x10d058){return client[_0x6842('0xc')](_0x4f2aca,_0x37c005)['then'](function(_0x59a347){logger[_0x6842('0xd')]('Network,\x20%s,\x20%s',_0x3f483e,_0x6842('0xe'));logger[_0x6842('0xf')]('Network,\x20%s,\x20%s,\x20%s',_0x3f483e,_0x6842('0xe'),JSON[_0x6842('0x10')](_0x59a347));if(_0x59a347[_0x6842('0x11')]){if(_0x59a347[_0x6842('0x11')][_0x6842('0x12')]===0x1f4){logger[_0x6842('0x11')](_0x6842('0x13'),_0x3f483e,_0x59a347[_0x6842('0x11')][_0x6842('0x14')]);return _0x10d058(_0x59a347[_0x6842('0x11')][_0x6842('0x14')]);}logger[_0x6842('0x11')]('Network,\x20%s,\x20%s',_0x3f483e,_0x59a347[_0x6842('0x11')][_0x6842('0x14')]);return _0xfb120d(_0x59a347[_0x6842('0x11')][_0x6842('0x14')]);}else{logger[_0x6842('0xd')](_0x6842('0x13'),_0x3f483e,_0x6842('0xe'));_0xfb120d(_0x59a347[_0x6842('0x15')][_0x6842('0x14')]);}})[_0x6842('0x16')](function(_0x242541){logger[_0x6842('0x11')](_0x6842('0x13'),_0x3f483e,_0x242541);_0x10d058(_0x242541);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index c90d8fd..756ebfc 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 _0x8ef6=['get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','post','create','addDisposition','/:id/notify','notify','addApplications','addAgents','send','update','destroy','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x15d57f,_0x208dd9){var _0x42cb32=function(_0x4feeb4){while(--_0x4feeb4){_0x15d57f['push'](_0x15d57f['shift']());}};_0x42cb32(++_0x208dd9);}(_0x8ef6,0xf2));var _0x68ef=function(_0x412890,_0x345ad3){_0x412890=_0x412890-0x0;var _0x1211bb=_0x8ef6[_0x412890];return _0x1211bb;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),auth[_0x68ef('0xc')](),controller['getAgents']);router[_0x68ef('0x17')]('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x18')]);router['post'](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router[_0x68ef('0x17')]('/:id/canned_answers',auth[_0x68ef('0xc')](),controller['addAnswer']);router['post'](_0x68ef('0x1a'),controller[_0x68ef('0x1b')]);router['post']('/:id/applications',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1c')]);router[_0x68ef('0x17')]('/:id/users',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router[_0x68ef('0x17')]('/:id/send',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1e')]);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x1f')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x68ef('0x20')]);router[_0x68ef('0x21')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x22')]);router[_0x68ef('0x21')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x21')]('/:id/users',auth[_0x68ef('0xc')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x1cb9=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','getAgents','post','addAnswer','/:id/notify','notify','/:id/applications','addAgents','put','update','destroy','removeDispositions','delete','removeAnswers','/:id/users'];(function(_0x32f183,_0x541c1e){var _0x3d3f24=function(_0x4b1e76){while(--_0x4b1e76){_0x32f183['push'](_0x32f183['shift']());}};_0x3d3f24(++_0x541c1e);}(_0x1cb9,0x14e));var _0x91cb=function(_0xaa3a55,_0x1074fd){_0xaa3a55=_0xaa3a55-0x0;var _0x4754d2=_0x1cb9[_0xaa3a55];return _0x4754d2;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0x8')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x8')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x8')]('/:id/applications',auth[_0x91cb('0x9')](),controller[_0x91cb('0x13')]);router['get'](_0x91cb('0x14'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x15')]);router[_0x91cb('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x91cb('0x16')]);router[_0x91cb('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x91cb('0x17')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller['addDisposition']);router[_0x91cb('0x17')](_0x91cb('0x11'),auth['isAuthenticated'](),controller[_0x91cb('0x18')]);router[_0x91cb('0x17')](_0x91cb('0x19'),controller[_0x91cb('0x1a')]);router['post'](_0x91cb('0x1b'),auth[_0x91cb('0x9')](),controller['addApplications']);router[_0x91cb('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0x91cb('0x1c')]);router[_0x91cb('0x17')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x91cb('0x1d')](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x1e')]);router['delete'](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x1f')]);router['delete'](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x20')]);router[_0x91cb('0x21')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x22')]);router[_0x91cb('0x21')](_0x91cb('0x23'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x91cb('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index bd2e1a4..5db128f 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 _0x2681=['name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x2681,0x1e9));var _0x1268=function(_0x5d87f4,_0x4673e3){_0x5d87f4=_0x5d87f4-0x0;var _0x3d0902=_0x2681[_0x5d87f4];return _0x3d0902;};'use strict';var Sequelize=require(_0x1268('0x0'));var rs=require(_0x1268('0x1'));module['exports']={'name':{'type':Sequelize[_0x1268('0x2')],'unique':_0x1268('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x1268('0x2')],'defaultValue':function(){return rs[_0x1268('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x1268('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1268('0x5')],'defaultValue':function(){return _0x1268('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1268('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1268('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x1268('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1268('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1268('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1268('0x7')],'defaultValue':![],'comment':_0x1268('0x9'),'set':function(_0x3d0df4){if(!_0x3d0df4)this[_0x1268('0xa')]('mandatoryDispositionPauseId',null);this[_0x1268('0xa')](_0x1268('0xb'),_0x3d0df4);}}}; \ No newline at end of file +var _0xd142=['sequelize','randomstring','exports','STRING','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(_0x3cc8c4,_0x52013d){var _0x181a99=function(_0x395e10){while(--_0x395e10){_0x3cc8c4['push'](_0x3cc8c4['shift']());}};_0x181a99(++_0x52013d);}(_0xd142,0xf0));var _0x2d14=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd142[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x2d14('0x0'));var rs=require(_0x2d14('0x1'));module[_0x2d14('0x2')]={'name':{'type':Sequelize[_0x2d14('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2d14('0x3')]},'token':{'type':Sequelize[_0x2d14('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2d14('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2d14('0x4')],'defaultValue':function(){return _0x2d14('0x5');}},'notificationSound':{'type':Sequelize[_0x2d14('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2d14('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2d14('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2d14('0x3')]},'queueTransfer':{'type':Sequelize[_0x2d14('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2d14('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2d14('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2d14('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2d14('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x2d14('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2c4b92){if(!_0x2c4b92)this[_0x2d14('0x9')](_0x2d14('0xa'),null);this[_0x2d14('0x9')](_0x2d14('0xb'),_0x2c4b92);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f7056b7..4282110 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 _0x3685=['Contacts','DESC','OpenchannelApplication','applications','Applications','list','priority','asc','account','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','fullname','internal','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','out','push','dataValues','html-pdf','rimraf','zip-dir','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','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','get','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List'];(function(_0x94ab7f,_0x38f931){var _0x40c1e4=function(_0x3c96f1){while(--_0x3c96f1){_0x94ab7f['push'](_0x94ab7f['shift']());}};_0x40c1e4(++_0x38f931);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x5368('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5368('0x1'));var zipdir=require(_0x5368('0x2'));var jsonpatch=require(_0x5368('0x3'));var rp=require(_0x5368('0x4'));var moment=require(_0x5368('0x5'));var BPromise=require(_0x5368('0x6'));var Mustache=require(_0x5368('0x7'));var util=require(_0x5368('0x8'));var path=require(_0x5368('0x9'));var sox=require(_0x5368('0xa'));var csv=require('to-csv');var ejs=require(_0x5368('0xb'));var fs=require('fs');var fs_extra=require(_0x5368('0xc'));var _=require(_0x5368('0xd'));var squel=require(_0x5368('0xe'));var crypto=require('crypto');var jsforce=require(_0x5368('0xf'));var deskjs=require(_0x5368('0x10'));var toCsv=require(_0x5368('0x11'));var querystring=require(_0x5368('0x12'));var Papa=require(_0x5368('0x13'));var Redis=require(_0x5368('0x14'));var authService=require(_0x5368('0x15'));var qs=require(_0x5368('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5368('0x17'));var logger=require(_0x5368('0x18'))(_0x5368('0x19'));var utils=require('../../config/utils');var config=require(_0x5368('0x1a'));var licenseUtil=require(_0x5368('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x5368('0x1c')],{'host':_0x5368('0x1d'),'port':0x18eb});var socket=require(_0x5368('0x1e'))(new Redis(config[_0x5368('0x1c')]));require(_0x5368('0x1f'))[_0x5368('0x20')](socket);var jayson=require(_0x5368('0x21'));var client=jayson[_0x5368('0x22')][_0x5368('0x23')]({'port':0x232c});var client9002=jayson[_0x5368('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41ce0e,_0x183041,_0x59c422,_0x19790d){return new BPromise(function(_0x1c04bd,_0x973143){var _0x24a4b3=_0x19790d||client;return _0x24a4b3['request'](_0x41ce0e,_0x59c422)[_0x5368('0x24')](function(_0x56ac4d){logger['info'](_0x5368('0x25'),_0x183041,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x183041,_0x5368('0x26'),JSON[_0x5368('0x27')](_0x56ac4d));if(_0x56ac4d[_0x5368('0x28')]){if(_0x56ac4d['error']['code']===0x1f4){logger[_0x5368('0x28')](_0x5368('0x25'),_0x183041,_0x56ac4d[_0x5368('0x28')][_0x5368('0x29')]);return _0x973143(_0x56ac4d[_0x5368('0x28')][_0x5368('0x29')]);}logger[_0x5368('0x28')](_0x5368('0x25'),_0x183041,_0x56ac4d[_0x5368('0x28')][_0x5368('0x29')]);return _0x1c04bd(_0x56ac4d['error'][_0x5368('0x29')]);}else{logger[_0x5368('0x2a')](_0x5368('0x25'),_0x183041,_0x5368('0x26'));_0x1c04bd(_0x56ac4d[_0x5368('0x2b')][_0x5368('0x29')]);}})[_0x5368('0x2c')](function(_0x5d32ff){logger[_0x5368('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x183041,_0x5d32ff);_0x973143(_0x5d32ff);});});}function respondWithStatusCode(_0x49c518,_0x15c206){_0x15c206=_0x15c206||0xcc;return function(_0x229e5){if(_0x229e5){return _0x49c518[_0x5368('0x2d')](_0x15c206);}return _0x49c518[_0x5368('0x2e')](_0x15c206)[_0x5368('0x2f')]();};}function respondWithResult(_0x4b94cd,_0x725f8e){_0x725f8e=_0x725f8e||0xc8;return function(_0x200ad0){if(_0x200ad0){return _0x4b94cd[_0x5368('0x2e')](_0x725f8e)[_0x5368('0x30')](_0x200ad0);}};}function respondWithFilteredResult(_0x42d4b4,_0x3af128){return function(_0x3d40de){if(_0x3d40de){var _0x2963a6=_0x3d40de[_0x5368('0x31')],_0x3681e6=_0x3af128[_0x5368('0x32')],_0x3c8ae1=_0x3af128['offset']+_0x3af128[_0x5368('0x33')],_0x260eab;if(_0x3c8ae1>=_0x2963a6){_0x3c8ae1=_0x2963a6;_0x260eab=0xc8;}else{_0x260eab=0xce;}_0x42d4b4[_0x5368('0x2e')](_0x260eab);return _0x42d4b4[_0x5368('0x34')]('Content-Range',_0x3681e6+'-'+_0x3c8ae1+'/'+_0x2963a6)[_0x5368('0x30')](_0x3d40de);}return null;};}function patchUpdates(_0x50131a){return function(_0x26fc48){try{jsonpatch[_0x5368('0x35')](_0x26fc48,_0x50131a,!![]);}catch(_0x5007b6){return BPromise[_0x5368('0x36')](_0x5007b6);}return _0x26fc48[_0x5368('0x37')]();};}function saveUpdates(_0x592f21,_0x52344f){return function(_0x32a50e){if(_0x32a50e){return _0x32a50e[_0x5368('0x38')](_0x592f21)['then'](function(_0x46169e){return _0x46169e;});}return null;};}function removeEntity(_0x2fde35,_0x211762){return function(_0x4dc0ee){if(_0x4dc0ee){return _0x4dc0ee[_0x5368('0x39')]()['then'](function(){var _0x22b489=_0x4dc0ee[_0x5368('0x3a')]({'plain':!![]});var _0x7ec790='OpenchannelAccounts';return db[_0x5368('0x3b')][_0x5368('0x39')]({'where':{'type':_0x7ec790,'resourceId':_0x22b489['id']}})[_0x5368('0x24')](function(){return _0x4dc0ee;});})[_0x5368('0x24')](function(){_0x2fde35['status'](0xcc)[_0x5368('0x2f')]();});}};}function handleEntityNotFound(_0x4d016f,_0x295123){return function(_0x69c6c7){if(!_0x69c6c7){_0x4d016f['sendStatus'](0x194);}return _0x69c6c7;};}function handleError(_0x1b84fb,_0x197659){_0x197659=_0x197659||0x1f4;return function(_0x46e59a){logger[_0x5368('0x28')](_0x46e59a['stack']);if(_0x46e59a[_0x5368('0x3c')]){delete _0x46e59a[_0x5368('0x3c')];}_0x1b84fb[_0x5368('0x2e')](_0x197659)[_0x5368('0x3d')](_0x46e59a);};}exports[_0x5368('0x3e')]=function(_0x5d384a,_0x1183a1){var _0x411f8b={'include':[{'model':db[_0x5368('0x3f')],'as':_0x5368('0x40')}]},_0x4e2d3e={},_0x1e16ca={'count':0x0,'rows':[]};var _0x5e796f=_[_0x5368('0x41')](db[_0x5368('0x42')][_0x5368('0x43')],function(_0x25e432){return{'name':_0x25e432['fieldName'],'type':_0x25e432['type'][_0x5368('0x44')]};});_0x4e2d3e[_0x5368('0x45')]=_[_0x5368('0x41')](_0x5e796f,'name');_0x4e2d3e['query']=_[_0x5368('0x46')](_0x5d384a['query']);_0x4e2d3e[_0x5368('0x47')]=_[_0x5368('0x48')](_0x4e2d3e['model'],_0x4e2d3e[_0x5368('0x49')]);_0x411f8b[_0x5368('0x4a')]=_[_0x5368('0x48')](_0x4e2d3e[_0x5368('0x45')],qs[_0x5368('0x4b')](_0x5d384a[_0x5368('0x49')][_0x5368('0x4b')]));_0x411f8b[_0x5368('0x4a')]=_0x411f8b[_0x5368('0x4a')][_0x5368('0x4c')]?_0x411f8b[_0x5368('0x4a')]:_0x4e2d3e[_0x5368('0x45')];if(!_0x5d384a['query'][_0x5368('0x4d')](_0x5368('0x4e'))){_0x411f8b[_0x5368('0x33')]=qs['limit'](_0x5d384a[_0x5368('0x49')][_0x5368('0x33')]);_0x411f8b['offset']=qs[_0x5368('0x32')](_0x5d384a[_0x5368('0x49')][_0x5368('0x32')]);}_0x411f8b[_0x5368('0x4f')]=qs[_0x5368('0x50')](_0x5d384a[_0x5368('0x49')][_0x5368('0x50')]);_0x411f8b[_0x5368('0x51')]=qs[_0x5368('0x47')](_[_0x5368('0x52')](_0x5d384a['query'],_0x4e2d3e['filters']),_0x5e796f);if(_0x5d384a[_0x5368('0x49')][_0x5368('0x53')]){_0x411f8b[_0x5368('0x51')]=_[_0x5368('0x54')](_0x411f8b['where'],{'$or':_['map'](_0x5e796f,function(_0x1031b1){if(_0x1031b1['type']!==_0x5368('0x55')){var _0x5d3aac={};_0x5d3aac[_0x1031b1[_0x5368('0x3c')]]={'$like':'%'+_0x5d384a['query'][_0x5368('0x53')]+'%'};return _0x5d3aac;}})});}_0x411f8b=_[_0x5368('0x54')]({},_0x411f8b,_0x5d384a['options']);var _0x5159f7={'where':_0x411f8b[_0x5368('0x51')]};return db['OpenchannelAccount'][_0x5368('0x31')](_0x5159f7)[_0x5368('0x24')](function(_0x2ee00b){_0x1e16ca[_0x5368('0x31')]=_0x2ee00b;if(_0x5d384a['query'][_0x5368('0x56')]){_0x411f8b[_0x5368('0x57')]=[{'all':!![]}];}return db[_0x5368('0x42')][_0x5368('0x58')](_0x411f8b);})[_0x5368('0x24')](function(_0x4399c3){_0x1e16ca[_0x5368('0x59')]=_0x4399c3;return _0x1e16ca;})['then'](respondWithFilteredResult(_0x1183a1,_0x411f8b))['catch'](handleError(_0x1183a1,null));};exports[_0x5368('0x5a')]=function(_0x7d7a5,_0x367a7d){var _0x4850f8={'raw':![],'where':{'id':_0x7d7a5[_0x5368('0x5b')]['id']},'include':[{'model':db[_0x5368('0x3f')],'as':_0x5368('0x40')}]},_0x42b09e={};_0x42b09e[_0x5368('0x45')]=_[_0x5368('0x46')](db[_0x5368('0x42')][_0x5368('0x43')]);_0x42b09e['query']=_[_0x5368('0x46')](_0x7d7a5[_0x5368('0x49')]);_0x42b09e[_0x5368('0x47')]=_[_0x5368('0x48')](_0x42b09e['model'],_0x42b09e[_0x5368('0x49')]);_0x4850f8[_0x5368('0x4a')]=_[_0x5368('0x48')](_0x42b09e[_0x5368('0x45')],qs[_0x5368('0x4b')](_0x7d7a5[_0x5368('0x49')][_0x5368('0x4b')]));_0x4850f8[_0x5368('0x4a')]=_0x4850f8[_0x5368('0x4a')][_0x5368('0x4c')]?_0x4850f8[_0x5368('0x4a')]:_0x42b09e[_0x5368('0x45')];if(_0x7d7a5[_0x5368('0x49')][_0x5368('0x56')]){_0x4850f8['include']=[{'all':!![]}];}_0x4850f8=_[_0x5368('0x54')]({},_0x4850f8,_0x7d7a5[_0x5368('0x5c')]);return db[_0x5368('0x42')][_0x5368('0x5d')](_0x4850f8)[_0x5368('0x24')](handleEntityNotFound(_0x367a7d,null))[_0x5368('0x24')](respondWithResult(_0x367a7d,null))['catch'](handleError(_0x367a7d,null));};exports[_0x5368('0x5e')]=function(_0x4a5654,_0x3cc107){return db[_0x5368('0x42')][_0x5368('0x5e')](_0x4a5654[_0x5368('0x5f')],{})[_0x5368('0x24')](function(_0x257a24){var _0x170ecd=_0x4a5654['user'][_0x5368('0x3a')]({'plain':!![]});if(!_0x170ecd)throw new Error(_0x5368('0x60'));if(_0x170ecd[_0x5368('0x61')]===_0x5368('0x62')){var _0xf127d0=_0x257a24[_0x5368('0x3a')]({'plain':!![]});var _0x39afad=_0x5368('0x63');return db[_0x5368('0x64')][_0x5368('0x5d')]({'where':{'name':_0x39afad,'userProfileId':_0x170ecd[_0x5368('0x65')]},'raw':!![]})[_0x5368('0x24')](function(_0x38b389){if(_0x38b389&&_0x38b389['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xf127d0[_0x5368('0x3c')],'resourceId':_0xf127d0['id'],'type':_0x38b389[_0x5368('0x3c')],'sectionId':_0x38b389['id']},{})[_0x5368('0x24')](function(){return _0x257a24;});}else{return _0x257a24;}})[_0x5368('0x2c')](function(_0x5e8892){logger['error'](_0x5368('0x66'),_0x5e8892);throw _0x5e8892;});}return _0x257a24;})[_0x5368('0x24')](respondWithResult(_0x3cc107,0xc9))[_0x5368('0x2c')](handleError(_0x3cc107,null));};exports['update']=function(_0x344603,_0x5695a3){if(_0x344603[_0x5368('0x5f')]['id']){delete _0x344603[_0x5368('0x5f')]['id'];}return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0x344603[_0x5368('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x5368('0x40')}]})[_0x5368('0x24')](handleEntityNotFound(_0x5695a3,null))[_0x5368('0x24')](saveUpdates(_0x344603['body'],null))['then'](respondWithResult(_0x5695a3,null))[_0x5368('0x2c')](handleError(_0x5695a3,null));};exports[_0x5368('0x39')]=function(_0x5b2ec2,_0x591c07){return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0x5b2ec2[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x591c07,null))[_0x5368('0x24')](removeEntity(_0x591c07,null))[_0x5368('0x2c')](handleError(_0x591c07,null));};exports[_0x5368('0x67')]=function(_0x146f65,_0x5b1347){return db[_0x5368('0x42')]['describe']()[_0x5368('0x24')](respondWithResult(_0x5b1347,null))[_0x5368('0x2c')](handleError(_0x5b1347,null));};exports[_0x5368('0x68')]=function(_0x5621bf,_0x71fc2c,_0x242a9a){if(_0x5621bf[_0x5368('0x5f')]['id']){delete _0x5621bf[_0x5368('0x5f')]['id'];}return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0x5621bf[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x71fc2c,null))[_0x5368('0x24')](function(_0x343ae5){if(_0x343ae5){_0x5621bf[_0x5368('0x5f')][_0x5368('0x69')]=_0x343ae5['id'];return db[_0x5368('0x6a')][_0x5368('0x5e')](_0x5621bf[_0x5368('0x5f')]);}})[_0x5368('0x24')](respondWithResult(_0x71fc2c,null))[_0x5368('0x2c')](handleError(_0x71fc2c,null));};exports[_0x5368('0x6b')]=function(_0x3debf0,_0x5ec9ca,_0x3307c2){var _0x153cac={'raw':![],'where':{}};var _0x2f8493={};var _0x486ab6={'count':0x0,'rows':[]};return db[_0x5368('0x42')][_0x5368('0x6c')]({'where':{'id':_0x3debf0[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x5ec9ca,null))[_0x5368('0x24')](function(_0x5eea25){if(_0x5eea25){_0x2f8493['model']=_['keys'](db[_0x5368('0x6a')][_0x5368('0x43')]);_0x2f8493[_0x5368('0x49')]=_['keys'](_0x3debf0[_0x5368('0x49')]);_0x2f8493['filters']=_['intersection'](_0x2f8493[_0x5368('0x45')],_0x2f8493[_0x5368('0x49')]);_0x153cac[_0x5368('0x4a')]=_[_0x5368('0x48')](_0x2f8493[_0x5368('0x45')],qs[_0x5368('0x4b')](_0x3debf0[_0x5368('0x49')][_0x5368('0x4b')]));_0x153cac[_0x5368('0x4a')]=_0x153cac[_0x5368('0x4a')]['length']?_0x153cac[_0x5368('0x4a')]:_0x2f8493[_0x5368('0x45')];if(!_0x3debf0[_0x5368('0x49')]['hasOwnProperty'](_0x5368('0x4e'))){_0x153cac[_0x5368('0x33')]=qs[_0x5368('0x33')](_0x3debf0['query'][_0x5368('0x33')]);_0x153cac[_0x5368('0x32')]=qs['offset'](_0x3debf0[_0x5368('0x49')]['offset']);}_0x153cac[_0x5368('0x4f')]=qs['sort'](_0x3debf0[_0x5368('0x49')][_0x5368('0x50')]);_0x153cac[_0x5368('0x51')]=qs['filters'](_['pick'](_0x3debf0[_0x5368('0x49')],_0x2f8493[_0x5368('0x47')]));_0x153cac[_0x5368('0x51')][_0x5368('0x69')]=_0x5eea25['id'];if(_0x3debf0['query']['filter']){_0x153cac[_0x5368('0x51')]=_['merge'](_0x153cac[_0x5368('0x51')],{'$or':_['map'](_0x153cac[_0x5368('0x4a')],function(_0x4f635a){var _0x4fafa7={};_0x4fafa7[_0x4f635a]={'$like':'%'+_0x3debf0[_0x5368('0x49')]['filter']+'%'};return _0x4fafa7;})});}_0x153cac=_[_0x5368('0x54')]({},_0x153cac,_0x3debf0[_0x5368('0x5c')]);return db['Disposition'][_0x5368('0x31')]({'where':_0x153cac[_0x5368('0x51')]})[_0x5368('0x24')](function(_0x377b32){_0x486ab6['count']=_0x377b32;if(_0x3debf0[_0x5368('0x49')][_0x5368('0x56')]){_0x153cac[_0x5368('0x57')]=[{'all':!![]}];}return db[_0x5368('0x6a')][_0x5368('0x58')](_0x153cac);})[_0x5368('0x24')](function(_0x4fdce6){_0x486ab6[_0x5368('0x59')]=_0x4fdce6;return _0x486ab6;});}})[_0x5368('0x24')](respondWithFilteredResult(_0x5ec9ca,_0x153cac))[_0x5368('0x2c')](handleError(_0x5ec9ca,null));};exports[_0x5368('0x6d')]=function(_0xb94224,_0x257055,_0x6f2445){return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0xb94224['params']['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x257055,null))[_0x5368('0x24')](function(_0x1348c6){if(_0x1348c6){return _0x1348c6[_0x5368('0x6d')](_0xb94224[_0x5368('0x49')][_0x5368('0x6e')]);}})[_0x5368('0x24')](respondWithStatusCode(_0x257055,null))[_0x5368('0x2c')](handleError(_0x257055,null));};exports[_0x5368('0x6f')]=function(_0x123ffc,_0x30b0c3,_0x1a2952){if(_0x123ffc[_0x5368('0x5f')]['id']){delete _0x123ffc[_0x5368('0x5f')]['id'];}return db['OpenchannelAccount'][_0x5368('0x5d')]({'where':{'id':_0x123ffc[_0x5368('0x5b')]['id']}})['then'](handleEntityNotFound(_0x30b0c3,null))[_0x5368('0x24')](function(_0x53ad56){if(_0x53ad56){_0x123ffc[_0x5368('0x5f')][_0x5368('0x69')]=_0x53ad56['id'];return db[_0x5368('0x70')]['create'](_0x123ffc[_0x5368('0x5f')]);}})[_0x5368('0x24')](respondWithResult(_0x30b0c3,null))['catch'](handleError(_0x30b0c3,null));};exports[_0x5368('0x71')]=function(_0xd179,_0xa24994,_0x2aa776){var _0x2ef8e3={'raw':![],'where':{}};var _0x40e04a={};var _0x10656a={'count':0x0,'rows':[]};return db[_0x5368('0x42')]['findOne']({'where':{'id':_0xd179[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0xa24994,null))[_0x5368('0x24')](function(_0x76583d){if(_0x76583d){_0x40e04a['model']=_[_0x5368('0x46')](db['CannedAnswer']['rawAttributes']);_0x40e04a['query']=_['keys'](_0xd179[_0x5368('0x49')]);_0x40e04a['filters']=_[_0x5368('0x48')](_0x40e04a['model'],_0x40e04a[_0x5368('0x49')]);_0x2ef8e3[_0x5368('0x4a')]=_['intersection'](_0x40e04a[_0x5368('0x45')],qs['fields'](_0xd179[_0x5368('0x49')][_0x5368('0x4b')]));_0x2ef8e3[_0x5368('0x4a')]=_0x2ef8e3['attributes'][_0x5368('0x4c')]?_0x2ef8e3[_0x5368('0x4a')]:_0x40e04a[_0x5368('0x45')];if(!_0xd179[_0x5368('0x49')][_0x5368('0x4d')](_0x5368('0x4e'))){_0x2ef8e3[_0x5368('0x33')]=qs[_0x5368('0x33')](_0xd179[_0x5368('0x49')]['limit']);_0x2ef8e3[_0x5368('0x32')]=qs[_0x5368('0x32')](_0xd179[_0x5368('0x49')]['offset']);}_0x2ef8e3[_0x5368('0x4f')]=qs['sort'](_0xd179[_0x5368('0x49')][_0x5368('0x50')]);_0x2ef8e3['where']=qs['filters'](_[_0x5368('0x52')](_0xd179[_0x5368('0x49')],_0x40e04a[_0x5368('0x47')]));_0x2ef8e3[_0x5368('0x51')]['OpenchannelAccountId']=_0x76583d['id'];if(_0xd179[_0x5368('0x49')][_0x5368('0x53')]){_0x2ef8e3[_0x5368('0x51')]=_[_0x5368('0x54')](_0x2ef8e3[_0x5368('0x51')],{'$or':_[_0x5368('0x41')](_0x2ef8e3[_0x5368('0x4a')],function(_0x58c4d4){var _0x2bb649={};_0x2bb649[_0x58c4d4]={'$like':'%'+_0xd179[_0x5368('0x49')][_0x5368('0x53')]+'%'};return _0x2bb649;})});}_0x2ef8e3=_[_0x5368('0x54')]({},_0x2ef8e3,_0xd179[_0x5368('0x5c')]);return db[_0x5368('0x70')][_0x5368('0x31')]({'where':_0x2ef8e3[_0x5368('0x51')]})[_0x5368('0x24')](function(_0x509fe9){_0x10656a[_0x5368('0x31')]=_0x509fe9;if(_0xd179[_0x5368('0x49')][_0x5368('0x56')]){_0x2ef8e3[_0x5368('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5368('0x58')](_0x2ef8e3);})[_0x5368('0x24')](function(_0x3955f4){_0x10656a[_0x5368('0x59')]=_0x3955f4;return _0x10656a;});}})[_0x5368('0x24')](respondWithFilteredResult(_0xa24994,_0x2ef8e3))[_0x5368('0x2c')](handleError(_0xa24994,null));};exports[_0x5368('0x72')]=function(_0x3cf884,_0x227040,_0x5ac1fa){return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0x3cf884[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x227040,null))[_0x5368('0x24')](function(_0x2776a5){if(_0x2776a5){return _0x2776a5[_0x5368('0x72')](_0x3cf884[_0x5368('0x49')]['ids']);}})[_0x5368('0x24')](respondWithStatusCode(_0x227040,null))[_0x5368('0x2c')](handleError(_0x227040,null));};exports[_0x5368('0x73')]=function(_0x50f28f,_0x1f3ca8,_0x454e0a){var _0x1c5c63={'body':_0x50f28f[_0x5368('0x5f')],'channel':_0x5368('0x74')};var _0x2dc9a1=[];var _0x1f5122=[];var _0x30ce99={};var _0x27dcb1=![];return db[_0x5368('0x75')][_0x5368('0x67')]()['then'](function(_0x117590){if(!_0x117590){throw new db[(_0x5368('0x76'))][(_0x5368('0x77'))](_0x5368('0x78'));}_0x2dc9a1=_['difference'](_[_0x5368('0x46')](_0x117590),['createdAt',_0x5368('0x79')]);_0x1f5122=_['difference'](_[_0x5368('0x46')](_0x117590),[_0x5368('0x7a'),'updatedAt','CompanyId',_0x5368('0x7b')]);if(_0x50f28f[_0x5368('0x5f')]['id']){delete _0x50f28f['body']['id'];}if(_['isNil'](_0x50f28f['body'][_0x5368('0x7c')])){throw new db[(_0x5368('0x76'))]['ValidationError'](_0x5368('0x7d'));}if(_['isNil'](_0x50f28f[_0x5368('0x5f')][_0x5368('0x5f')])||_0x50f28f[_0x5368('0x5f')][_0x5368('0x5f')]===''){throw new db[(_0x5368('0x76'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x50f28f[_0x5368('0x5f')][_0x5368('0x7e')])){throw new db[(_0x5368('0x76'))][(_0x5368('0x77'))](_0x5368('0x7f')+_0x1f5122);}if(!_[_0x5368('0x80')](_0x1f5122,_0x50f28f[_0x5368('0x5f')]['mapKey'])){throw new db['Sequelize'][(_0x5368('0x77'))](_0x5368('0x81')+_0x1f5122);}_0x30ce99[_0x50f28f[_0x5368('0x5f')]['mapKey']]=_0x50f28f['body'][_0x5368('0x7c')];})[_0x5368('0x24')](function(){return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0x50f28f[_0x5368('0x5b')]['id']},'include':[{'model':db[_0x5368('0x82')],'as':_0x5368('0x83'),'include':[{'model':db['CmContact'],'as':_0x5368('0x84'),'where':_0x30ce99,'limit':0x1,'order':[['updatedAt',_0x5368('0x85')]]}]},{'model':db[_0x5368('0x86')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x1f3ca8,null))[_0x5368('0x24')](function(_0x14c2cd){if(_0x14c2cd&&_0x14c2cd[_0x5368('0x83')]){_0x1c5c63['account']=_0x14c2cd;_0x1c5c63[_0x5368('0x87')]=_0x14c2cd[_0x5368('0x88')];_0x1c5c63[_0x5368('0x89')]=_0x14c2cd[_0x5368('0x83')];_0x1c5c63['applications']=_['orderBy'](_0x1c5c63[_0x5368('0x87')],[_0x5368('0x8a')],[_0x5368('0x8b')]);if(_0x1c5c63['account'][_0x5368('0x88')]){delete _0x1c5c63[_0x5368('0x8c')][_0x5368('0x88')];}if(_0x1c5c63[_0x5368('0x8c')]['List']&&_0x1c5c63[_0x5368('0x8c')]['List']['Contacts'][_0x5368('0x4c')]){return _0x1c5c63[_0x5368('0x8c')]['List'][_0x5368('0x84')][0x0];}var _0x3c3f32=_[_0x5368('0x8d')](_0x50f28f['body'],{'firstName':_0x50f28f[_0x5368('0x5f')][_0x5368('0x7c')],'ListId':_0x14c2cd[_0x5368('0x7b')]});_0x3c3f32[_0x50f28f[_0x5368('0x5f')]['mapKey']]=_0x50f28f[_0x5368('0x5f')][_0x5368('0x7c')];return db[_0x5368('0x75')][_0x5368('0x5e')](_0x3c3f32,{'fields':_0x2dc9a1,'raw':!![]});}})[_0x5368('0x24')](handleEntityNotFound(_0x1f3ca8,null))[_0x5368('0x24')](function(_0x5de622){_0x1c5c63[_0x5368('0x8e')]=_0x5de622;if(_0x5de622){var _0xaabeec={'ContactId':_0x5de622['id'],'OpenchannelAccountId':_0x50f28f[_0x5368('0x5b')]['id'],'from':(_0x5de622[_0x5368('0x8f')]||'')+'\x20'+(_0x5de622[_0x5368('0x90')]||'')};var _0x3c1182={'OpenchannelAccountId':_0x50f28f['params']['id'],'closed':![]};if(_0x50f28f[_0x5368('0x5f')][_0x5368('0x91')]){_0x3c1182[_0x5368('0x91')]=_0x50f28f['body']['threadId'];return db[_0x5368('0x92')][_0x5368('0x5d')]({'where':_0x3c1182})[_0x5368('0x24')](function(_0x202692){if(_0x202692){return[_0x202692,![]];}_0xaabeec['threadId']=_0x50f28f[_0x5368('0x5f')][_0x5368('0x91')];_0xaabeec[_0x5368('0x93')]=_0x50f28f[_0x5368('0x5f')][_0x5368('0x93')];return db['OpenchannelInteraction'][_0x5368('0x5e')](_0xaabeec)[_0x5368('0x24')](function(_0x4c5fdf){return[_0x4c5fdf,!![]];});});}else{_0x3c1182[_0x5368('0x91')]=null;}_0x3c1182[_0x5368('0x94')]=_0x5de622['id'];return db['OpenchannelInteraction'][_0x5368('0x5d')]({'where':_0x3c1182})['then'](function(_0x4131c0){if(_0x4131c0){return[_0x4131c0,![]];}return db['OpenchannelInteraction']['create'](_0xaabeec)[_0x5368('0x24')](function(_0x9fca5e){return[_0x9fca5e,!![]];});});}})[_0x5368('0x95')](function(_0x305878,_0x5ede24){if(_0x305878){_0x27dcb1=_0x5ede24;if(!_0x5ede24){var _0x1c5d2b={'from':(_0x1c5c63['contact']['firstName']||'')+'\x20'+(_0x1c5c63[_0x5368('0x8e')][_0x5368('0x90')]||'')};if(_0x50f28f['body'][_0x5368('0x91')]&&_0x50f28f['body'][_0x5368('0x96')]&&_0x50f28f[_0x5368('0x5f')]['threadId']!=_0x50f28f['body'][_0x5368('0x96')]){_0x1c5d2b['threadId']=_0x50f28f[_0x5368('0x5f')][_0x5368('0x96')];}return _0x305878['update'](_0x1c5d2b);}else{return _0x305878;}}})[_0x5368('0x24')](function(_0xd22d7d){_0x1c5c63[_0x5368('0x97')]=_0xd22d7d[_0x5368('0x3a')]({'plain':!![]});_0x1c5c63[_0x5368('0x97')]['created']=_0x27dcb1;if(_0x1c5c63[_0x5368('0x97')][_0x5368('0x98')]){if(_0x1c5c63[_0x5368('0x8c')][_0x5368('0x99')]){_0x1c5c63['applications']['push']({'id':0x0,'priority':_0x1c5c63[_0x5368('0x87')][_0x5368('0x4c')]+0x1,'app':_0x5368('0x9a'),'appdata':'unmanaged','interval':_0x5368('0x9b')});}}return db[_0x5368('0x9c')][_0x5368('0x5e')]({'body':_0x50f28f[_0x5368('0x5f')][_0x5368('0x5f')],'OpenchannelAccountId':_0x50f28f[_0x5368('0x5b')]['id'],'OpenchannelInteractionId':_0xd22d7d['id'],'direction':'in','ContactId':_0x1c5c63[_0x5368('0x8e')]['id'],'AttachmentId':_0x50f28f[_0x5368('0x5f')][_0x5368('0x9d')]});})[_0x5368('0x24')](function(_0x4305ae){_0x1c5c63[_0x5368('0x29')]=_0x4305ae;if(_0x1c5c63['interaction'][_0x5368('0x9e')]){return db['User'][_0x5368('0x5d')]({'attributes':['id',_0x5368('0x3c')],'where':{'id':_0x1c5c63[_0x5368('0x97')][_0x5368('0x9e')]}})[_0x5368('0x24')](function(_0x39219b){if(_0x39219b){_0x1c5c63[_0x5368('0x87')][_0x5368('0x9f')]({'id':0x0,'priority':0x0,'app':_0x5368('0xa0'),'appdata':_0x39219b[_0x5368('0x3c')]+','+(_0x1c5c63['account'][_0x5368('0xa1')]||0xa),'interval':_0x5368('0x9b')});_0x1c5c63[_0x5368('0xa2')]=![];}return respondWithRpcPromise(_0x5368('0xa3'),'startRouting',_0x1c5c63);});}return respondWithRpcPromise(_0x5368('0xa3'),_0x5368('0xa4'),_0x1c5c63);})[_0x5368('0x24')](function(_0x58539d){respondWithRpcPromise('EventManager',_0x5368('0xa5'),{'event':_0x5368('0x73'),'message':_0x58539d},client9002);return _0x58539d;})['then'](respondWithResult(_0x1f3ca8,null))[_0x5368('0x2c')](handleError(_0x1f3ca8,null));};exports[_0x5368('0xa6')]=function(_0x533d79,_0x59608b,_0x48797d){return db[_0x5368('0x42')][_0x5368('0x6c')]({'where':{'id':_0x533d79[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x59608b,null))[_0x5368('0x24')](function(_0x2288f3){if(_0x2288f3){return db['sequelize'][_0x5368('0xa7')](function(_0xefea41){return db[_0x5368('0x86')][_0x5368('0x39')]({'where':{'OpenchannelAccountId':_0x533d79[_0x5368('0x5b')]['id']},'transaction':_0xefea41})[_0x5368('0x24')](function(_0x2fc79c){var _0x308dbe=_[_0x5368('0x41')](_0x533d79[_0x5368('0x5f')],function(_0x4c4fc4){_0x4c4fc4[_0x5368('0x69')]=_0x533d79[_0x5368('0x5b')]['id'];return _0x4c4fc4;});return db[_0x5368('0x86')][_0x5368('0xa8')](_0x308dbe,{'transaction':_0xefea41});});})[_0x5368('0x24')](function(){return db[_0x5368('0x86')][_0x5368('0xa9')]({'where':{'OpenchannelAccountId':_0x533d79['params']['id']},'order':_0x5368('0x8a')});});}})[_0x5368('0x24')](respondWithResult(_0x59608b,null))[_0x5368('0x2c')](handleError(_0x59608b,null));};exports['getApplications']=function(_0x3176d5,_0x5d5f5e,_0x11e640){var _0x26cda9={};var _0x54c8a1={};var _0x20fd08;var _0x3e1be4;return db[_0x5368('0x42')]['findOne']({'where':{'id':_0x3176d5[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x5d5f5e,null))['then'](function(_0x2555c7){if(_0x2555c7){_0x20fd08=_0x2555c7;_0x54c8a1[_0x5368('0x45')]=_[_0x5368('0x46')](db[_0x5368('0x86')][_0x5368('0x43')]);_0x54c8a1['query']=_[_0x5368('0x46')](_0x3176d5[_0x5368('0x49')]);_0x54c8a1[_0x5368('0x47')]=_[_0x5368('0x48')](_0x54c8a1['model'],_0x54c8a1[_0x5368('0x49')]);_0x26cda9[_0x5368('0x4a')]=_[_0x5368('0x48')](_0x54c8a1[_0x5368('0x45')],qs['fields'](_0x3176d5[_0x5368('0x49')][_0x5368('0x4b')]));_0x26cda9['attributes']=_0x26cda9['attributes'][_0x5368('0x4c')]?_0x26cda9[_0x5368('0x4a')]:_0x54c8a1['model'];_0x26cda9[_0x5368('0x4f')]=qs[_0x5368('0x50')](_0x3176d5[_0x5368('0x49')][_0x5368('0x50')]);_0x26cda9[_0x5368('0x51')]=qs[_0x5368('0x47')](_[_0x5368('0x52')](_0x3176d5[_0x5368('0x49')],_0x54c8a1[_0x5368('0x47')]));if(_0x3176d5['query']['filter']){_0x26cda9['where']=_[_0x5368('0x54')](_0x26cda9['where'],{'$or':_[_0x5368('0x41')](_0x26cda9[_0x5368('0x4a')],function(_0x25aa30){var _0x833ba6={};_0x833ba6[_0x25aa30]={'$like':'%'+_0x3176d5['query'][_0x5368('0x53')]+'%'};return _0x833ba6;})});}_0x26cda9=_[_0x5368('0x54')]({},_0x26cda9,_0x3176d5['options']);return _0x20fd08[_0x5368('0xaa')](_0x26cda9);}})[_0x5368('0x24')](function(_0x3a3fd3){if(_0x3a3fd3){_0x3e1be4=_0x3a3fd3[_0x5368('0x4c')];if(!_0x3176d5['query'][_0x5368('0x4d')]('nolimit')){_0x26cda9[_0x5368('0x33')]=qs[_0x5368('0x33')](_0x3176d5['query'][_0x5368('0x33')]);_0x26cda9[_0x5368('0x32')]=qs['offset'](_0x3176d5[_0x5368('0x49')][_0x5368('0x32')]);}return _0x20fd08['getApplications'](_0x26cda9);}})[_0x5368('0x24')](function(_0x2087d7){if(_0x2087d7){return _0x2087d7?{'count':_0x3e1be4,'rows':_0x2087d7}:null;}})[_0x5368('0x24')](respondWithResult(_0x5d5f5e,null))[_0x5368('0x2c')](handleError(_0x5d5f5e,null));};exports[_0x5368('0xab')]=function(_0x3d73a9,_0x4f2bd1,_0x31587a){var _0x10989c={'raw':![],'where':{}};var _0x213204={};var _0x596082={'count':0x0,'rows':[]};return db[_0x5368('0x42')][_0x5368('0x6c')]({'where':{'id':_0x3d73a9['params']['id']}})['then'](handleEntityNotFound(_0x4f2bd1,null))['then'](function(_0x38f994){if(_0x38f994){_0x213204[_0x5368('0x45')]=_[_0x5368('0x46')](db[_0x5368('0x92')][_0x5368('0x43')]);_0x213204['query']=_[_0x5368('0x46')](_0x3d73a9['query']);_0x213204[_0x5368('0x47')]=_[_0x5368('0x48')](_0x213204[_0x5368('0x45')],_0x213204[_0x5368('0x49')]);_0x10989c['attributes']=_[_0x5368('0x48')](_0x213204[_0x5368('0x45')],qs['fields'](_0x3d73a9[_0x5368('0x49')][_0x5368('0x4b')]));_0x10989c['attributes']=_0x10989c[_0x5368('0x4a')]['length']?_0x10989c[_0x5368('0x4a')]:_0x213204[_0x5368('0x45')];if(!_0x3d73a9[_0x5368('0x49')][_0x5368('0x4d')](_0x5368('0x4e'))){_0x10989c[_0x5368('0x33')]=qs[_0x5368('0x33')](_0x3d73a9[_0x5368('0x49')][_0x5368('0x33')]);_0x10989c['offset']=qs[_0x5368('0x32')](_0x3d73a9[_0x5368('0x49')][_0x5368('0x32')]);}_0x10989c[_0x5368('0x4f')]=qs[_0x5368('0x50')](_0x3d73a9[_0x5368('0x49')][_0x5368('0x50')]);_0x10989c[_0x5368('0x51')]=qs[_0x5368('0x47')](_[_0x5368('0x52')](_0x3d73a9[_0x5368('0x49')],_0x213204[_0x5368('0x47')]));_0x10989c['where']['OpenchannelAccountId']=_0x38f994['id'];if(_0x3d73a9[_0x5368('0x49')][_0x5368('0x53')]){_0x10989c[_0x5368('0x51')]=_[_0x5368('0x54')](_0x10989c[_0x5368('0x51')],{'$or':_['map'](_0x10989c['attributes'],function(_0x543629){var _0x37fda0={};_0x37fda0[_0x543629]={'$like':'%'+_0x3d73a9['query']['filter']+'%'};return _0x37fda0;})});}_0x10989c=_['merge']({},_0x10989c,_0x3d73a9[_0x5368('0x5c')]);return db[_0x5368('0x92')][_0x5368('0x31')]({'where':_0x10989c['where']})['then'](function(_0x55e37b){_0x596082[_0x5368('0x31')]=_0x55e37b;if(_0x3d73a9['query'][_0x5368('0x56')]){_0x10989c[_0x5368('0x57')]=[{'model':db['CmContact'],'as':_0x5368('0xac'),'required':![]},{'model':db[_0x5368('0xad')],'as':'Owner','attributes':[_0x5368('0x3c'),_0x5368('0xae'),_0x5368('0xaf')],'required':![]},{'model':db['Tag'],'as':_0x5368('0xb0'),'attributes':['id','name',_0x5368('0xb1')],'where':_0x3d73a9['query'][_0x5368('0xb2')]?{'id':_0x3d73a9['query'][_0x5368('0xb2')]}:undefined,'required':_0x3d73a9[_0x5368('0x49')][_0x5368('0xb2')]?!![]:![]}];}return db[_0x5368('0x92')][_0x5368('0x58')](_0x10989c);})['then'](function(_0xc1b380){_0x596082[_0x5368('0x59')]=_0xc1b380;return _0x596082;});}})[_0x5368('0x24')](respondWithFilteredResult(_0x4f2bd1,_0x10989c))['catch'](handleError(_0x4f2bd1,null));};exports['addAgents']=function(_0xe8a6c5,_0x5a2795,_0x4b94af){return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0xe8a6c5['params']['id']}})['then'](handleEntityNotFound(_0x5a2795,null))[_0x5368('0x24')](function(_0x1bc4c6){if(_0x1bc4c6){return _0x1bc4c6[_0x5368('0xb3')](_0xe8a6c5[_0x5368('0x5f')][_0x5368('0x6e')],_['omit'](_0xe8a6c5['body'],[_0x5368('0x6e'),'id'])||{})['spread'](function(_0xed03f1){for(var _0x426d03=0x0;_0x426d03<_0xe8a6c5[_0x5368('0x5f')]['ids']['length'];_0x426d03+=0x1){socket[_0x5368('0xb4')](_0x5368('0xb5'),{'UserId':_0xe8a6c5['body'][_0x5368('0x6e')][_0x426d03],'OpenchannelAccountId':_0xe8a6c5[_0x5368('0x5b')]['id']});}return _0xed03f1;});}})[_0x5368('0x24')](respondWithResult(_0x5a2795,null))[_0x5368('0x2c')](handleError(_0x5a2795,null));};exports[_0x5368('0xb6')]=function(_0x188fa7,_0x4eeb19,_0x132175){return db['OpenchannelAccount']['find']({'where':{'id':_0x188fa7[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x4eeb19,null))[_0x5368('0x24')](function(_0x282217){if(_0x282217){return _0x282217[_0x5368('0xb6')](_0x188fa7['query'][_0x5368('0x6e')])[_0x5368('0x24')](function(){if(_[_0x5368('0xb7')](_0x188fa7[_0x5368('0x49')]['ids'])){for(var _0xe7c04c=0x0;_0xe7c04c<_0x188fa7['query'][_0x5368('0x6e')]['length'];_0xe7c04c+=0x1){socket[_0x5368('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x188fa7[_0x5368('0x49')][_0x5368('0x6e')][_0xe7c04c]),'OpenchannelAccountId':Number(_0x188fa7[_0x5368('0x5b')]['id'])});}}else{socket[_0x5368('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x188fa7[_0x5368('0x49')][_0x5368('0x6e')]),'OpenchannelAccountId':Number(_0x188fa7[_0x5368('0x5b')]['id'])});}});}})[_0x5368('0x24')](respondWithStatusCode(_0x4eeb19,null))[_0x5368('0x2c')](handleError(_0x4eeb19,null));};exports['getAgents']=function(_0xf7d802,_0x54a3c3,_0x5d03f5){var _0x1271a1={};var _0x3ce3f1={};var _0x358ecc;var _0x19e1d8;return db[_0x5368('0x42')][_0x5368('0x6c')]({'where':{'id':_0xf7d802[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x54a3c3,null))[_0x5368('0x24')](function(_0x361bf4){if(_0x361bf4){_0x358ecc=_0x361bf4;_0x3ce3f1[_0x5368('0x45')]=_[_0x5368('0x46')](db[_0x5368('0xad')][_0x5368('0x43')]);_0x3ce3f1[_0x5368('0x49')]=_[_0x5368('0x46')](_0xf7d802[_0x5368('0x49')]);_0x3ce3f1[_0x5368('0x47')]=_[_0x5368('0x48')](_0x3ce3f1['model'],_0x3ce3f1[_0x5368('0x49')]);_0x1271a1['attributes']=_[_0x5368('0x48')](_0x3ce3f1[_0x5368('0x45')],qs[_0x5368('0x4b')](_0xf7d802[_0x5368('0x49')][_0x5368('0x4b')]));_0x1271a1[_0x5368('0x4a')]=_0x1271a1[_0x5368('0x4a')][_0x5368('0x4c')]?_0x1271a1[_0x5368('0x4a')]:_0x3ce3f1[_0x5368('0x45')];_0x1271a1[_0x5368('0x4f')]=qs[_0x5368('0x50')](_0xf7d802[_0x5368('0x49')][_0x5368('0x50')]);_0x1271a1[_0x5368('0x51')]=qs[_0x5368('0x47')](_['pick'](_0xf7d802[_0x5368('0x49')],_0x3ce3f1['filters']));if(_0xf7d802['query'][_0x5368('0x53')]){_0x1271a1[_0x5368('0x51')]=_['merge'](_0x1271a1[_0x5368('0x51')],{'$or':_['map'](_0x1271a1[_0x5368('0x4a')],function(_0x19cc87){var _0x44e29a={};_0x44e29a[_0x19cc87]={'$like':'%'+_0xf7d802[_0x5368('0x49')]['filter']+'%'};return _0x44e29a;})});}_0x1271a1=_[_0x5368('0x54')]({},_0x1271a1,_0xf7d802['options']);return _0x358ecc['getAgents'](_0x1271a1);}})[_0x5368('0x24')](function(_0x151260){if(_0x151260){_0x19e1d8=_0x151260[_0x5368('0x4c')];if(!_0xf7d802[_0x5368('0x49')][_0x5368('0x4d')]('nolimit')){_0x1271a1[_0x5368('0x33')]=qs['limit'](_0xf7d802[_0x5368('0x49')][_0x5368('0x33')]);_0x1271a1['offset']=qs[_0x5368('0x32')](_0xf7d802[_0x5368('0x49')][_0x5368('0x32')]);}return _0x358ecc[_0x5368('0xb8')](_0x1271a1);}})[_0x5368('0x24')](function(_0x24598c){if(_0x24598c){return _0x24598c?{'count':_0x19e1d8,'rows':_0x24598c}:null;}})['then'](respondWithResult(_0x54a3c3,null))[_0x5368('0x2c')](handleError(_0x54a3c3,null));};exports[_0x5368('0x3d')]=function(_0xca43c1,_0x27ae50,_0x612478){var _0x5107fd,_0x5ca7dd,_0x2a8049;if(_['isNil'](_0xca43c1[_0x5368('0x5f')]['body'])||_0xca43c1[_0x5368('0x5f')]['body']===''){throw new db[(_0x5368('0x76'))][(_0x5368('0x77'))](_0x5368('0xb9'));}if(_[_0x5368('0xba')](_0xca43c1[_0x5368('0x5f')]['to'])){}_0x5107fd=_0xca43c1['body']['to'];return db[_0x5368('0x42')][_0x5368('0x6c')]({'where':{'id':_0xca43c1['params']['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x27ae50,null))[_0x5368('0x24')](function(_0x5c9436){if(_0x5c9436){return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0x5c9436['id']},'include':[{'model':db[_0x5368('0x82')],'as':_0x5368('0x83'),'include':[{'model':db['CmContact'],'as':_0x5368('0x84'),'where':{[_0x5c9436['mapKey']]:_0x5107fd},'limit':0x1,'order':[['updatedAt',_0x5368('0x85')]]}]}]})[_0x5368('0x24')](handleEntityNotFound(_0x27ae50,null))['then'](function(_0x29f324){if(_0x29f324&&_0x29f324[_0x5368('0x83')]){_0x5ca7dd=_0x29f324[_0x5368('0x3a')]({'plain':!![]});if(_0x5ca7dd[_0x5368('0x83')]&&_0x5ca7dd[_0x5368('0x83')][_0x5368('0x84')][_0x5368('0x4c')]){return _0x5ca7dd[_0x5368('0x83')][_0x5368('0x84')][0x0];}return db['CmContact']['create'](_['defaults'](_0xca43c1[_0x5368('0x5f')],{'firstName':_0x5107fd,[_0x29f324[_0x5368('0x7e')]]:_0x5107fd,'phone':_0x5107fd,'ListId':_0x5ca7dd['ListId']}));}})[_0x5368('0x24')](handleEntityNotFound(_0x27ae50,null))[_0x5368('0x24')](function(_0x3127f6){if(_0x3127f6){_0x2a8049=_0x3127f6;return db[_0x5368('0x92')][_0x5368('0x5d')]({'where':{'ContactId':_0x2a8049['id'],'closed':![],'OpenchannelAccountId':_0x5ca7dd['id']}})[_0x5368('0x24')](function(_0x5837c4){if(_0x5837c4){return[_0x5837c4,![]];}return db['OpenchannelInteraction'][_0x5368('0x5e')]({'UserId':_0xca43c1[_0x5368('0x62')]['id'],'ContactId':_0x2a8049['id'],'OpenchannelAccountId':_0x5ca7dd['id'],'lastMsgDirection':_0x5368('0xbb'),'Messages':[_[_0x5368('0x54')](_0xca43c1[_0x5368('0x5f')],{'read':![],'body':_0xca43c1['body']['body'],'OpenchannelAccountId':_0x5ca7dd['id'],'UserId':_0xca43c1['user']['id'],'ContactId':_0x2a8049['id']})]},{'include':[{'model':db[_0x5368('0x9c')],'as':'Messages'}]})[_0x5368('0x24')](function(_0x5cc45b){return[_0x5cc45b,!![]];});});}})[_0x5368('0x95')](function(_0x3584dd,_0x51ce60){if(_0x51ce60){return _0x3584dd;}return db[_0x5368('0x9c')]['create'](_[_0x5368('0x54')](_0xca43c1['body'],{'read':![],'body':_0xca43c1[_0x5368('0x5f')][_0x5368('0x5f')],'OpenchannelAccountId':_0x5ca7dd['id'],'OpenchannelInteractionId':_0x3584dd['id'],'UserId':_0xca43c1[_0x5368('0x62')]['id'],'ContactId':_0x2a8049['id']}))[_0x5368('0x24')](function(_0x1e4c10){_0x3584dd['dataValues']['Messages']=[];_0x3584dd['dataValues']['Messages'][_0x5368('0xbc')](_0x1e4c10[_0x5368('0xbd')]);return _0x3584dd;});});}})[_0x5368('0x24')](respondWithResult(_0x27ae50,null))[_0x5368('0x2c')](handleError(_0x27ae50,null));}; \ No newline at end of file +var _0x4a9c=['addApplications','sequelize','transaction','getApplications','getInteractions','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','CmList','user','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./openchannelAccount.socket','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','count','offset','limit','set','reject','update','destroy','UserProfileResource','end','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','OpenchannelAccount','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','userProfileId','autoAssociation','find','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','findAll','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','ListId','isNil','from','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','EventManager'];(function(_0x362ac6,_0x52cd79){var _0x5a33ad=function(_0x4ec527){while(--_0x4ec527){_0x362ac6['push'](_0x362ac6['shift']());}};_0x5a33ad(++_0x52cd79);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x33b667,_0x1953e5){_0x33b667=_0x33b667-0x0;var _0x58d986=_0x4a9c[_0x33b667];return _0x58d986;};'use strict';var pdf=require(_0xc4a9('0x0'));var emlformat=require(_0xc4a9('0x1'));var rimraf=require(_0xc4a9('0x2'));var zipdir=require(_0xc4a9('0x3'));var jsonpatch=require(_0xc4a9('0x4'));var rp=require(_0xc4a9('0x5'));var moment=require('moment');var BPromise=require(_0xc4a9('0x6'));var Mustache=require(_0xc4a9('0x7'));var util=require(_0xc4a9('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc4a9('0x9'));var ejs=require(_0xc4a9('0xa'));var fs=require('fs');var fs_extra=require(_0xc4a9('0xb'));var _=require(_0xc4a9('0xc'));var squel=require('squel');var crypto=require(_0xc4a9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc4a9('0x9'));var querystring=require(_0xc4a9('0xe'));var Papa=require(_0xc4a9('0xf'));var Redis=require(_0xc4a9('0x10'));var authService=require(_0xc4a9('0x11'));var qs=require(_0xc4a9('0x12'));var as=require(_0xc4a9('0x13'));var hardwareService=require(_0xc4a9('0x14'));var logger=require(_0xc4a9('0x15'))(_0xc4a9('0x16'));var utils=require(_0xc4a9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc4a9('0x18'));var db=require(_0xc4a9('0x19'))['db'];config[_0xc4a9('0x1a')]=_['defaults'](config[_0xc4a9('0x1a')],{'host':_0xc4a9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc4a9('0x1c'))['register'](socket);var jayson=require(_0xc4a9('0x1d'));var client=jayson[_0xc4a9('0x1e')][_0xc4a9('0x1f')]({'port':0x232c});var client9002=jayson[_0xc4a9('0x1e')][_0xc4a9('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x51d842,_0xaaecf0,_0x585f41,_0x5e83dc){return new BPromise(function(_0x54d1e1,_0x3a3d5c){var _0x1500f4=_0x5e83dc||client;return _0x1500f4['request'](_0x51d842,_0x585f41)[_0xc4a9('0x20')](function(_0x48912e){logger[_0xc4a9('0x21')](_0xc4a9('0x22'),_0xaaecf0,_0xc4a9('0x23'));logger[_0xc4a9('0x24')](_0xc4a9('0x25'),_0xaaecf0,_0xc4a9('0x23'),JSON[_0xc4a9('0x26')](_0x48912e));if(_0x48912e[_0xc4a9('0x27')]){if(_0x48912e[_0xc4a9('0x27')]['code']===0x1f4){logger[_0xc4a9('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0xaaecf0,_0x48912e[_0xc4a9('0x27')][_0xc4a9('0x28')]);return _0x3a3d5c(_0x48912e[_0xc4a9('0x27')][_0xc4a9('0x28')]);}logger['error'](_0xc4a9('0x22'),_0xaaecf0,_0x48912e[_0xc4a9('0x27')]['message']);return _0x54d1e1(_0x48912e[_0xc4a9('0x27')][_0xc4a9('0x28')]);}else{logger['info'](_0xc4a9('0x22'),_0xaaecf0,_0xc4a9('0x23'));_0x54d1e1(_0x48912e['result']['message']);}})[_0xc4a9('0x29')](function(_0x3703c5){logger[_0xc4a9('0x27')](_0xc4a9('0x22'),_0xaaecf0,_0x3703c5);_0x3a3d5c(_0x3703c5);});});}function respondWithStatusCode(_0x33d1b4,_0x959e2c){_0x959e2c=_0x959e2c||0xcc;return function(_0x2b0b16){if(_0x2b0b16){return _0x33d1b4[_0xc4a9('0x2a')](_0x959e2c);}return _0x33d1b4['status'](_0x959e2c)['end']();};}function respondWithResult(_0x2fc199,_0xa31b6f){_0xa31b6f=_0xa31b6f||0xc8;return function(_0x48bb2c){if(_0x48bb2c){return _0x2fc199[_0xc4a9('0x2b')](_0xa31b6f)[_0xc4a9('0x2c')](_0x48bb2c);}};}function respondWithFilteredResult(_0x545b5e,_0x4ec541){return function(_0x20990a){if(_0x20990a){var _0x23110b=_0x20990a[_0xc4a9('0x2d')],_0x2b3967=_0x4ec541['offset'],_0x59d5a0=_0x4ec541[_0xc4a9('0x2e')]+_0x4ec541[_0xc4a9('0x2f')],_0x3bcc02;if(_0x59d5a0>=_0x23110b){_0x59d5a0=_0x23110b;_0x3bcc02=0xc8;}else{_0x3bcc02=0xce;}_0x545b5e[_0xc4a9('0x2b')](_0x3bcc02);return _0x545b5e[_0xc4a9('0x30')]('Content-Range',_0x2b3967+'-'+_0x59d5a0+'/'+_0x23110b)['json'](_0x20990a);}return null;};}function patchUpdates(_0x43349f){return function(_0x56af7f){try{jsonpatch['apply'](_0x56af7f,_0x43349f,!![]);}catch(_0x26b7e0){return BPromise[_0xc4a9('0x31')](_0x26b7e0);}return _0x56af7f['save']();};}function saveUpdates(_0x3e52e0,_0x1394fa){return function(_0x5dae13){if(_0x5dae13){return _0x5dae13[_0xc4a9('0x32')](_0x3e52e0)[_0xc4a9('0x20')](function(_0x1e96e7){return _0x1e96e7;});}return null;};}function removeEntity(_0x3152a5,_0x250735){return function(_0x519e4a){if(_0x519e4a){return _0x519e4a[_0xc4a9('0x33')]()[_0xc4a9('0x20')](function(){var _0x55a09e=_0x519e4a['get']({'plain':!![]});var _0x3adc01='OpenchannelAccounts';return db[_0xc4a9('0x34')]['destroy']({'where':{'type':_0x3adc01,'resourceId':_0x55a09e['id']}})[_0xc4a9('0x20')](function(){return _0x519e4a;});})['then'](function(){_0x3152a5['status'](0xcc)[_0xc4a9('0x35')]();});}};}function handleEntityNotFound(_0x8ec037,_0x3a95fa){return function(_0x3ef4d5){if(!_0x3ef4d5){_0x8ec037[_0xc4a9('0x2a')](0x194);}return _0x3ef4d5;};}function handleError(_0x2116d3,_0x4062a1){_0x4062a1=_0x4062a1||0x1f4;return function(_0x1d1717){logger[_0xc4a9('0x27')](_0x1d1717[_0xc4a9('0x36')]);if(_0x1d1717[_0xc4a9('0x37')]){delete _0x1d1717[_0xc4a9('0x37')];}_0x2116d3[_0xc4a9('0x2b')](_0x4062a1)[_0xc4a9('0x38')](_0x1d1717);};}exports['index']=function(_0x19ea58,_0x135753){var _0x4a4639={'include':[{'model':db[_0xc4a9('0x39')],'as':_0xc4a9('0x3a')}]},_0x1c5050={},_0x15a5c1={'count':0x0,'rows':[]};var _0x45549e=_[_0xc4a9('0x3b')](db['OpenchannelAccount'][_0xc4a9('0x3c')],function(_0x446587){return{'name':_0x446587['fieldName'],'type':_0x446587[_0xc4a9('0x3d')]['key']};});_0x1c5050[_0xc4a9('0x3e')]=_[_0xc4a9('0x3b')](_0x45549e,_0xc4a9('0x37'));_0x1c5050[_0xc4a9('0x3f')]=_[_0xc4a9('0x40')](_0x19ea58[_0xc4a9('0x3f')]);_0x1c5050['filters']=_[_0xc4a9('0x41')](_0x1c5050[_0xc4a9('0x3e')],_0x1c5050[_0xc4a9('0x3f')]);_0x4a4639[_0xc4a9('0x42')]=_[_0xc4a9('0x41')](_0x1c5050['model'],qs[_0xc4a9('0x43')](_0x19ea58[_0xc4a9('0x3f')]['fields']));_0x4a4639[_0xc4a9('0x42')]=_0x4a4639['attributes'][_0xc4a9('0x44')]?_0x4a4639[_0xc4a9('0x42')]:_0x1c5050[_0xc4a9('0x3e')];if(!_0x19ea58[_0xc4a9('0x3f')][_0xc4a9('0x45')](_0xc4a9('0x46'))){_0x4a4639[_0xc4a9('0x2f')]=qs[_0xc4a9('0x2f')](_0x19ea58['query']['limit']);_0x4a4639[_0xc4a9('0x2e')]=qs[_0xc4a9('0x2e')](_0x19ea58[_0xc4a9('0x3f')][_0xc4a9('0x2e')]);}_0x4a4639[_0xc4a9('0x47')]=qs[_0xc4a9('0x48')](_0x19ea58[_0xc4a9('0x3f')]['sort']);_0x4a4639[_0xc4a9('0x49')]=qs[_0xc4a9('0x4a')](_[_0xc4a9('0x4b')](_0x19ea58[_0xc4a9('0x3f')],_0x1c5050[_0xc4a9('0x4a')]),_0x45549e);if(_0x19ea58['query']['filter']){_0x4a4639[_0xc4a9('0x49')]=_[_0xc4a9('0x4c')](_0x4a4639['where'],{'$or':_[_0xc4a9('0x3b')](_0x45549e,function(_0x42481a){if(_0x42481a[_0xc4a9('0x3d')]!==_0xc4a9('0x4d')){var _0xb404f3={};_0xb404f3[_0x42481a['name']]={'$like':'%'+_0x19ea58[_0xc4a9('0x3f')][_0xc4a9('0x4e')]+'%'};return _0xb404f3;}})});}_0x4a4639=_['merge']({},_0x4a4639,_0x19ea58[_0xc4a9('0x4f')]);var _0x447c34={'where':_0x4a4639[_0xc4a9('0x49')]};return db['OpenchannelAccount'][_0xc4a9('0x2d')](_0x447c34)[_0xc4a9('0x20')](function(_0x319720){_0x15a5c1[_0xc4a9('0x2d')]=_0x319720;if(_0x19ea58['query'][_0xc4a9('0x50')]){_0x4a4639[_0xc4a9('0x51')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x4a4639);})[_0xc4a9('0x20')](function(_0x1edc79){_0x15a5c1[_0xc4a9('0x52')]=_0x1edc79;return _0x15a5c1;})[_0xc4a9('0x20')](respondWithFilteredResult(_0x135753,_0x4a4639))[_0xc4a9('0x29')](handleError(_0x135753,null));};exports[_0xc4a9('0x53')]=function(_0x2cc1f4,_0x577747){var _0x541e5d={'raw':![],'where':{'id':_0x2cc1f4[_0xc4a9('0x54')]['id']},'include':[{'model':db[_0xc4a9('0x39')],'as':_0xc4a9('0x3a')}]},_0x25f8cf={};_0x25f8cf[_0xc4a9('0x3e')]=_[_0xc4a9('0x40')](db['OpenchannelAccount'][_0xc4a9('0x3c')]);_0x25f8cf[_0xc4a9('0x3f')]=_['keys'](_0x2cc1f4[_0xc4a9('0x3f')]);_0x25f8cf[_0xc4a9('0x4a')]=_['intersection'](_0x25f8cf[_0xc4a9('0x3e')],_0x25f8cf[_0xc4a9('0x3f')]);_0x541e5d['attributes']=_[_0xc4a9('0x41')](_0x25f8cf[_0xc4a9('0x3e')],qs['fields'](_0x2cc1f4[_0xc4a9('0x3f')][_0xc4a9('0x43')]));_0x541e5d[_0xc4a9('0x42')]=_0x541e5d[_0xc4a9('0x42')][_0xc4a9('0x44')]?_0x541e5d[_0xc4a9('0x42')]:_0x25f8cf[_0xc4a9('0x3e')];if(_0x2cc1f4['query'][_0xc4a9('0x50')]){_0x541e5d[_0xc4a9('0x51')]=[{'all':!![]}];}_0x541e5d=_[_0xc4a9('0x4c')]({},_0x541e5d,_0x2cc1f4[_0xc4a9('0x4f')]);return db[_0xc4a9('0x55')]['find'](_0x541e5d)[_0xc4a9('0x20')](handleEntityNotFound(_0x577747,null))[_0xc4a9('0x20')](respondWithResult(_0x577747,null))[_0xc4a9('0x29')](handleError(_0x577747,null));};exports[_0xc4a9('0x56')]=function(_0x1e8ebe,_0xd6e5f8){return db['OpenchannelAccount'][_0xc4a9('0x56')](_0x1e8ebe[_0xc4a9('0x57')],{})['then'](function(_0x351672){var _0x55e8db=_0x1e8ebe['user'][_0xc4a9('0x58')]({'plain':!![]});if(!_0x55e8db)throw new Error(_0xc4a9('0x59'));if(_0x55e8db[_0xc4a9('0x5a')]==='user'){var _0x5f431d=_0x351672[_0xc4a9('0x58')]({'plain':!![]});var _0x5424ab=_0xc4a9('0x5b');return db['UserProfileSection']['find']({'where':{'name':_0x5424ab,'userProfileId':_0x55e8db[_0xc4a9('0x5c')]},'raw':!![]})[_0xc4a9('0x20')](function(_0x505aa7){if(_0x505aa7&&_0x505aa7[_0xc4a9('0x5d')]===0x0){return db[_0xc4a9('0x34')][_0xc4a9('0x56')]({'name':_0x5f431d[_0xc4a9('0x37')],'resourceId':_0x5f431d['id'],'type':_0x505aa7[_0xc4a9('0x37')],'sectionId':_0x505aa7['id']},{})[_0xc4a9('0x20')](function(){return _0x351672;});}else{return _0x351672;}})['catch'](function(_0x421906){logger[_0xc4a9('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x421906);throw _0x421906;});}return _0x351672;})[_0xc4a9('0x20')](respondWithResult(_0xd6e5f8,0xc9))[_0xc4a9('0x29')](handleError(_0xd6e5f8,null));};exports[_0xc4a9('0x32')]=function(_0x4181d5,_0x5d7584){if(_0x4181d5[_0xc4a9('0x57')]['id']){delete _0x4181d5['body']['id'];}return db[_0xc4a9('0x55')]['find']({'where':{'id':_0x4181d5[_0xc4a9('0x54')]['id']},'include':[{'model':db[_0xc4a9('0x39')],'as':_0xc4a9('0x3a')}]})[_0xc4a9('0x20')](handleEntityNotFound(_0x5d7584,null))[_0xc4a9('0x20')](saveUpdates(_0x4181d5[_0xc4a9('0x57')],null))[_0xc4a9('0x20')](respondWithResult(_0x5d7584,null))['catch'](handleError(_0x5d7584,null));};exports[_0xc4a9('0x33')]=function(_0x35be78,_0x464d31){return db[_0xc4a9('0x55')][_0xc4a9('0x5e')]({'where':{'id':_0x35be78[_0xc4a9('0x54')]['id']}})['then'](handleEntityNotFound(_0x464d31,null))['then'](removeEntity(_0x464d31,null))[_0xc4a9('0x29')](handleError(_0x464d31,null));};exports[_0xc4a9('0x5f')]=function(_0xe11853,_0x416f06){return db[_0xc4a9('0x55')][_0xc4a9('0x5f')]()[_0xc4a9('0x20')](respondWithResult(_0x416f06,null))[_0xc4a9('0x29')](handleError(_0x416f06,null));};exports[_0xc4a9('0x60')]=function(_0x494b93,_0x4a85ab,_0x4177fe){if(_0x494b93[_0xc4a9('0x57')]['id']){delete _0x494b93[_0xc4a9('0x57')]['id'];}return db[_0xc4a9('0x55')][_0xc4a9('0x5e')]({'where':{'id':_0x494b93[_0xc4a9('0x54')]['id']}})[_0xc4a9('0x20')](handleEntityNotFound(_0x4a85ab,null))[_0xc4a9('0x20')](function(_0x5654b2){if(_0x5654b2){_0x494b93['body'][_0xc4a9('0x61')]=_0x5654b2['id'];return db[_0xc4a9('0x62')][_0xc4a9('0x56')](_0x494b93[_0xc4a9('0x57')]);}})[_0xc4a9('0x20')](respondWithResult(_0x4a85ab,null))['catch'](handleError(_0x4a85ab,null));};exports['getDispositions']=function(_0xf90e98,_0x258bd0,_0x362a9f){var _0xa0c60e={'raw':![],'where':{}};var _0x11e278={};var _0x119ccf={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xc4a9('0x63')]({'where':{'id':_0xf90e98[_0xc4a9('0x54')]['id']}})[_0xc4a9('0x20')](handleEntityNotFound(_0x258bd0,null))[_0xc4a9('0x20')](function(_0x5d4bd8){if(_0x5d4bd8){_0x11e278[_0xc4a9('0x3e')]=_[_0xc4a9('0x40')](db[_0xc4a9('0x62')][_0xc4a9('0x3c')]);_0x11e278[_0xc4a9('0x3f')]=_[_0xc4a9('0x40')](_0xf90e98[_0xc4a9('0x3f')]);_0x11e278[_0xc4a9('0x4a')]=_[_0xc4a9('0x41')](_0x11e278['model'],_0x11e278[_0xc4a9('0x3f')]);_0xa0c60e[_0xc4a9('0x42')]=_['intersection'](_0x11e278['model'],qs[_0xc4a9('0x43')](_0xf90e98[_0xc4a9('0x3f')][_0xc4a9('0x43')]));_0xa0c60e[_0xc4a9('0x42')]=_0xa0c60e[_0xc4a9('0x42')]['length']?_0xa0c60e[_0xc4a9('0x42')]:_0x11e278[_0xc4a9('0x3e')];if(!_0xf90e98[_0xc4a9('0x3f')][_0xc4a9('0x45')](_0xc4a9('0x46'))){_0xa0c60e['limit']=qs[_0xc4a9('0x2f')](_0xf90e98[_0xc4a9('0x3f')]['limit']);_0xa0c60e[_0xc4a9('0x2e')]=qs[_0xc4a9('0x2e')](_0xf90e98[_0xc4a9('0x3f')][_0xc4a9('0x2e')]);}_0xa0c60e[_0xc4a9('0x47')]=qs[_0xc4a9('0x48')](_0xf90e98['query'][_0xc4a9('0x48')]);_0xa0c60e[_0xc4a9('0x49')]=qs[_0xc4a9('0x4a')](_[_0xc4a9('0x4b')](_0xf90e98[_0xc4a9('0x3f')],_0x11e278[_0xc4a9('0x4a')]));_0xa0c60e[_0xc4a9('0x49')][_0xc4a9('0x61')]=_0x5d4bd8['id'];if(_0xf90e98[_0xc4a9('0x3f')][_0xc4a9('0x4e')]){_0xa0c60e['where']=_[_0xc4a9('0x4c')](_0xa0c60e[_0xc4a9('0x49')],{'$or':_[_0xc4a9('0x3b')](_0xa0c60e['attributes'],function(_0x34792e){var _0x5d9864={};_0x5d9864[_0x34792e]={'$like':'%'+_0xf90e98['query'][_0xc4a9('0x4e')]+'%'};return _0x5d9864;})});}_0xa0c60e=_[_0xc4a9('0x4c')]({},_0xa0c60e,_0xf90e98[_0xc4a9('0x4f')]);return db[_0xc4a9('0x62')][_0xc4a9('0x2d')]({'where':_0xa0c60e[_0xc4a9('0x49')]})[_0xc4a9('0x20')](function(_0x415c2){_0x119ccf[_0xc4a9('0x2d')]=_0x415c2;if(_0xf90e98[_0xc4a9('0x3f')][_0xc4a9('0x50')]){_0xa0c60e[_0xc4a9('0x51')]=[{'all':!![]}];}return db[_0xc4a9('0x62')][_0xc4a9('0x64')](_0xa0c60e);})[_0xc4a9('0x20')](function(_0x3ee411){_0x119ccf[_0xc4a9('0x52')]=_0x3ee411;return _0x119ccf;});}})[_0xc4a9('0x20')](respondWithFilteredResult(_0x258bd0,_0xa0c60e))[_0xc4a9('0x29')](handleError(_0x258bd0,null));};exports['removeDispositions']=function(_0xb42fe2,_0x52c7b0,_0x250779){return db[_0xc4a9('0x55')][_0xc4a9('0x5e')]({'where':{'id':_0xb42fe2[_0xc4a9('0x54')]['id']}})[_0xc4a9('0x20')](handleEntityNotFound(_0x52c7b0,null))[_0xc4a9('0x20')](function(_0x46295b){if(_0x46295b){return _0x46295b['removeDispositions'](_0xb42fe2['query'][_0xc4a9('0x65')]);}})[_0xc4a9('0x20')](respondWithStatusCode(_0x52c7b0,null))[_0xc4a9('0x29')](handleError(_0x52c7b0,null));};exports[_0xc4a9('0x66')]=function(_0x1bc57d,_0x27d3ae,_0x2c8279){if(_0x1bc57d[_0xc4a9('0x57')]['id']){delete _0x1bc57d[_0xc4a9('0x57')]['id'];}return db[_0xc4a9('0x55')][_0xc4a9('0x5e')]({'where':{'id':_0x1bc57d['params']['id']}})[_0xc4a9('0x20')](handleEntityNotFound(_0x27d3ae,null))[_0xc4a9('0x20')](function(_0x26584b){if(_0x26584b){_0x1bc57d[_0xc4a9('0x57')][_0xc4a9('0x61')]=_0x26584b['id'];return db[_0xc4a9('0x67')][_0xc4a9('0x56')](_0x1bc57d[_0xc4a9('0x57')]);}})['then'](respondWithResult(_0x27d3ae,null))[_0xc4a9('0x29')](handleError(_0x27d3ae,null));};exports[_0xc4a9('0x68')]=function(_0x1b9618,_0x5984e2,_0x13c90b){var _0xa30405={'raw':![],'where':{}};var _0x52d325={};var _0x106b68={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xc4a9('0x63')]({'where':{'id':_0x1b9618[_0xc4a9('0x54')]['id']}})['then'](handleEntityNotFound(_0x5984e2,null))[_0xc4a9('0x20')](function(_0x64ca16){if(_0x64ca16){_0x52d325[_0xc4a9('0x3e')]=_[_0xc4a9('0x40')](db['CannedAnswer'][_0xc4a9('0x3c')]);_0x52d325[_0xc4a9('0x3f')]=_[_0xc4a9('0x40')](_0x1b9618[_0xc4a9('0x3f')]);_0x52d325[_0xc4a9('0x4a')]=_[_0xc4a9('0x41')](_0x52d325['model'],_0x52d325[_0xc4a9('0x3f')]);_0xa30405[_0xc4a9('0x42')]=_[_0xc4a9('0x41')](_0x52d325[_0xc4a9('0x3e')],qs['fields'](_0x1b9618[_0xc4a9('0x3f')]['fields']));_0xa30405['attributes']=_0xa30405[_0xc4a9('0x42')][_0xc4a9('0x44')]?_0xa30405[_0xc4a9('0x42')]:_0x52d325[_0xc4a9('0x3e')];if(!_0x1b9618[_0xc4a9('0x3f')]['hasOwnProperty'](_0xc4a9('0x46'))){_0xa30405[_0xc4a9('0x2f')]=qs[_0xc4a9('0x2f')](_0x1b9618[_0xc4a9('0x3f')][_0xc4a9('0x2f')]);_0xa30405['offset']=qs[_0xc4a9('0x2e')](_0x1b9618[_0xc4a9('0x3f')]['offset']);}_0xa30405[_0xc4a9('0x47')]=qs[_0xc4a9('0x48')](_0x1b9618['query'][_0xc4a9('0x48')]);_0xa30405[_0xc4a9('0x49')]=qs[_0xc4a9('0x4a')](_[_0xc4a9('0x4b')](_0x1b9618['query'],_0x52d325['filters']));_0xa30405[_0xc4a9('0x49')]['OpenchannelAccountId']=_0x64ca16['id'];if(_0x1b9618[_0xc4a9('0x3f')]['filter']){_0xa30405[_0xc4a9('0x49')]=_['merge'](_0xa30405[_0xc4a9('0x49')],{'$or':_[_0xc4a9('0x3b')](_0xa30405[_0xc4a9('0x42')],function(_0x431368){var _0x22f303={};_0x22f303[_0x431368]={'$like':'%'+_0x1b9618[_0xc4a9('0x3f')][_0xc4a9('0x4e')]+'%'};return _0x22f303;})});}_0xa30405=_[_0xc4a9('0x4c')]({},_0xa30405,_0x1b9618[_0xc4a9('0x4f')]);return db[_0xc4a9('0x67')]['count']({'where':_0xa30405['where']})[_0xc4a9('0x20')](function(_0x1e50a6){_0x106b68[_0xc4a9('0x2d')]=_0x1e50a6;if(_0x1b9618[_0xc4a9('0x3f')][_0xc4a9('0x50')]){_0xa30405[_0xc4a9('0x51')]=[{'all':!![]}];}return db[_0xc4a9('0x67')]['findAll'](_0xa30405);})[_0xc4a9('0x20')](function(_0x436a5d){_0x106b68[_0xc4a9('0x52')]=_0x436a5d;return _0x106b68;});}})[_0xc4a9('0x20')](respondWithFilteredResult(_0x5984e2,_0xa30405))[_0xc4a9('0x29')](handleError(_0x5984e2,null));};exports[_0xc4a9('0x69')]=function(_0x25e937,_0x4fce94,_0x3086d3){return db[_0xc4a9('0x55')][_0xc4a9('0x5e')]({'where':{'id':_0x25e937['params']['id']}})[_0xc4a9('0x20')](handleEntityNotFound(_0x4fce94,null))[_0xc4a9('0x20')](function(_0x463bf7){if(_0x463bf7){return _0x463bf7[_0xc4a9('0x69')](_0x25e937[_0xc4a9('0x3f')]['ids']);}})[_0xc4a9('0x20')](respondWithStatusCode(_0x4fce94,null))['catch'](handleError(_0x4fce94,null));};exports['notify']=function(_0x15e90d,_0x42c740,_0x1ba0ad){var _0x5046b7={'body':_0x15e90d[_0xc4a9('0x57')],'channel':_0xc4a9('0x6a')};var _0x1e4675=[];var _0x2e4ed2=[];var _0x1dab77={};var _0x53c22f=![];return db[_0xc4a9('0x6b')]['describe']()['then'](function(_0x19a4f3){if(!_0x19a4f3){throw new db[(_0xc4a9('0x6c'))][(_0xc4a9('0x6d'))](_0xc4a9('0x6e'));}_0x1e4675=_[_0xc4a9('0x6f')](_['keys'](_0x19a4f3),['createdAt',_0xc4a9('0x70')]);_0x2e4ed2=_[_0xc4a9('0x6f')](_[_0xc4a9('0x40')](_0x19a4f3),['createdAt',_0xc4a9('0x70'),'CompanyId',_0xc4a9('0x71')]);if(_0x15e90d[_0xc4a9('0x57')]['id']){delete _0x15e90d[_0xc4a9('0x57')]['id'];}if(_[_0xc4a9('0x72')](_0x15e90d[_0xc4a9('0x57')][_0xc4a9('0x73')])){throw new db['Sequelize'][(_0xc4a9('0x6d'))]('from\x20is\x20mandatory');}if(_[_0xc4a9('0x72')](_0x15e90d[_0xc4a9('0x57')]['body'])||_0x15e90d[_0xc4a9('0x57')][_0xc4a9('0x57')]===''){throw new db[(_0xc4a9('0x6c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc4a9('0x72')](_0x15e90d[_0xc4a9('0x57')]['mapKey'])){throw new db[(_0xc4a9('0x6c'))][(_0xc4a9('0x6d'))](_0xc4a9('0x74')+_0x2e4ed2);}if(!_['includes'](_0x2e4ed2,_0x15e90d[_0xc4a9('0x57')][_0xc4a9('0x75')])){throw new db[(_0xc4a9('0x6c'))][(_0xc4a9('0x6d'))](_0xc4a9('0x76')+_0x2e4ed2);}_0x1dab77[_0x15e90d[_0xc4a9('0x57')][_0xc4a9('0x75')]]=_0x15e90d['body']['from'];})['then'](function(){return db['OpenchannelAccount'][_0xc4a9('0x5e')]({'where':{'id':_0x15e90d[_0xc4a9('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0xc4a9('0x77'),'include':[{'model':db[_0xc4a9('0x6b')],'as':_0xc4a9('0x78'),'where':_0x1dab77,'limit':0x1,'order':[[_0xc4a9('0x70'),_0xc4a9('0x79')]]}]},{'model':db[_0xc4a9('0x7a')],'as':_0xc4a9('0x7b')}]});})['then'](handleEntityNotFound(_0x42c740,null))[_0xc4a9('0x20')](function(_0x3e8130){if(_0x3e8130&&_0x3e8130[_0xc4a9('0x77')]){_0x5046b7[_0xc4a9('0x7c')]=_0x3e8130;_0x5046b7[_0xc4a9('0x7d')]=_0x3e8130['Applications'];_0x5046b7[_0xc4a9('0x7e')]=_0x3e8130['List'];_0x5046b7[_0xc4a9('0x7d')]=_[_0xc4a9('0x7f')](_0x5046b7[_0xc4a9('0x7d')],[_0xc4a9('0x80')],['asc']);if(_0x5046b7['account']['Applications']){delete _0x5046b7['account']['Applications'];}if(_0x5046b7[_0xc4a9('0x7c')]['List']&&_0x5046b7[_0xc4a9('0x7c')][_0xc4a9('0x77')][_0xc4a9('0x78')]['length']){return _0x5046b7[_0xc4a9('0x7c')][_0xc4a9('0x77')][_0xc4a9('0x78')][0x0];}var _0x549525=_[_0xc4a9('0x81')](_0x15e90d[_0xc4a9('0x57')],{'firstName':_0x15e90d['body']['from'],'ListId':_0x3e8130[_0xc4a9('0x71')]});_0x549525[_0x15e90d['body'][_0xc4a9('0x75')]]=_0x15e90d[_0xc4a9('0x57')][_0xc4a9('0x73')];return db[_0xc4a9('0x6b')][_0xc4a9('0x56')](_0x549525,{'fields':_0x1e4675,'raw':!![]});}})[_0xc4a9('0x20')](handleEntityNotFound(_0x42c740,null))[_0xc4a9('0x20')](function(_0x2df476){_0x5046b7[_0xc4a9('0x82')]=_0x2df476;if(_0x2df476){var _0xf04a3e={'ContactId':_0x2df476['id'],'OpenchannelAccountId':_0x15e90d[_0xc4a9('0x54')]['id'],'from':(_0x2df476[_0xc4a9('0x83')]||'')+'\x20'+(_0x2df476[_0xc4a9('0x84')]||'')};var _0x372e91={'OpenchannelAccountId':_0x15e90d['params']['id'],'closed':![]};if(_0x15e90d[_0xc4a9('0x57')][_0xc4a9('0x85')]){_0x372e91[_0xc4a9('0x85')]=_0x15e90d[_0xc4a9('0x57')][_0xc4a9('0x85')];return db[_0xc4a9('0x86')][_0xc4a9('0x5e')]({'where':_0x372e91})['then'](function(_0x12d87b){if(_0x12d87b){return[_0x12d87b,![]];}_0xf04a3e[_0xc4a9('0x85')]=_0x15e90d['body'][_0xc4a9('0x85')];_0xf04a3e['externalUrl']=_0x15e90d[_0xc4a9('0x57')][_0xc4a9('0x87')];return db[_0xc4a9('0x86')][_0xc4a9('0x56')](_0xf04a3e)[_0xc4a9('0x20')](function(_0x22e00a){return[_0x22e00a,!![]];});});}else{_0x372e91['threadId']=null;}_0x372e91[_0xc4a9('0x88')]=_0x2df476['id'];return db[_0xc4a9('0x86')][_0xc4a9('0x5e')]({'where':_0x372e91})[_0xc4a9('0x20')](function(_0x25125a){if(_0x25125a){return[_0x25125a,![]];}return db[_0xc4a9('0x86')][_0xc4a9('0x56')](_0xf04a3e)[_0xc4a9('0x20')](function(_0x129e82){return[_0x129e82,!![]];});});}})[_0xc4a9('0x89')](function(_0x31bfa4,_0x37b223){if(_0x31bfa4){_0x53c22f=_0x37b223;if(!_0x37b223){var _0x468ae6={'from':(_0x5046b7[_0xc4a9('0x82')][_0xc4a9('0x83')]||'')+'\x20'+(_0x5046b7['contact'][_0xc4a9('0x84')]||'')};if(_0x15e90d[_0xc4a9('0x57')][_0xc4a9('0x85')]&&_0x15e90d[_0xc4a9('0x57')][_0xc4a9('0x8a')]&&_0x15e90d[_0xc4a9('0x57')][_0xc4a9('0x85')]!=_0x15e90d['body'][_0xc4a9('0x8a')]){_0x468ae6[_0xc4a9('0x85')]=_0x15e90d[_0xc4a9('0x57')][_0xc4a9('0x8a')];}return _0x31bfa4[_0xc4a9('0x32')](_0x468ae6);}else{return _0x31bfa4;}}})[_0xc4a9('0x20')](function(_0x4aa9c3){_0x5046b7[_0xc4a9('0x8b')]=_0x4aa9c3[_0xc4a9('0x58')]({'plain':!![]});_0x5046b7['interaction']['created']=_0x53c22f;if(_0x5046b7[_0xc4a9('0x8b')]['created']){if(_0x5046b7[_0xc4a9('0x7c')][_0xc4a9('0x8c')]){_0x5046b7[_0xc4a9('0x7d')][_0xc4a9('0x8d')]({'id':0x0,'priority':_0x5046b7[_0xc4a9('0x7d')][_0xc4a9('0x44')]+0x1,'app':_0xc4a9('0x8e'),'appdata':_0xc4a9('0x8f'),'interval':_0xc4a9('0x90')});}}return db[_0xc4a9('0x91')][_0xc4a9('0x56')]({'body':_0x15e90d[_0xc4a9('0x57')][_0xc4a9('0x57')],'OpenchannelAccountId':_0x15e90d['params']['id'],'OpenchannelInteractionId':_0x4aa9c3['id'],'direction':'in','ContactId':_0x5046b7[_0xc4a9('0x82')]['id'],'AttachmentId':_0x15e90d[_0xc4a9('0x57')][_0xc4a9('0x92')]});})[_0xc4a9('0x20')](function(_0x4026a8){_0x5046b7['message']=_0x4026a8;if(_0x5046b7[_0xc4a9('0x8b')][_0xc4a9('0x93')]){return db['User'][_0xc4a9('0x5e')]({'attributes':['id',_0xc4a9('0x37')],'where':{'id':_0x5046b7[_0xc4a9('0x8b')][_0xc4a9('0x93')]}})[_0xc4a9('0x20')](function(_0xee4f61){if(_0xee4f61){_0x5046b7[_0xc4a9('0x7d')][_0xc4a9('0x94')]({'id':0x0,'priority':0x0,'app':_0xc4a9('0x95'),'appdata':_0xee4f61[_0xc4a9('0x37')]+','+(_0x5046b7[_0xc4a9('0x7c')][_0xc4a9('0x96')]||0xa),'interval':_0xc4a9('0x90')});_0x5046b7[_0xc4a9('0x97')]=![];}return respondWithRpcPromise('Start',_0xc4a9('0x98'),_0x5046b7);});}return respondWithRpcPromise('Start',_0xc4a9('0x98'),_0x5046b7);})[_0xc4a9('0x20')](function(_0x18d561){respondWithRpcPromise(_0xc4a9('0x99'),_0xc4a9('0x99'),{'event':'notify','message':_0x18d561},client9002);return _0x18d561;})[_0xc4a9('0x20')](respondWithResult(_0x42c740,null))['catch'](handleError(_0x42c740,null));};exports[_0xc4a9('0x9a')]=function(_0x1b018b,_0x3bc07c,_0x7b8fcd){return db[_0xc4a9('0x55')][_0xc4a9('0x63')]({'where':{'id':_0x1b018b['params']['id']}})[_0xc4a9('0x20')](handleEntityNotFound(_0x3bc07c,null))['then'](function(_0x5f5a88){if(_0x5f5a88){return db[_0xc4a9('0x9b')][_0xc4a9('0x9c')](function(_0x3b40ce){return db[_0xc4a9('0x7a')][_0xc4a9('0x33')]({'where':{'OpenchannelAccountId':_0x1b018b[_0xc4a9('0x54')]['id']},'transaction':_0x3b40ce})[_0xc4a9('0x20')](function(_0x3384ac){var _0x18b647=_[_0xc4a9('0x3b')](_0x1b018b[_0xc4a9('0x57')],function(_0x2dabc9){_0x2dabc9['OpenchannelAccountId']=_0x1b018b['params']['id'];return _0x2dabc9;});return db['OpenchannelApplication']['bulkCreate'](_0x18b647,{'transaction':_0x3b40ce});});})[_0xc4a9('0x20')](function(){return db[_0xc4a9('0x7a')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1b018b[_0xc4a9('0x54')]['id']},'order':_0xc4a9('0x80')});});}})['then'](respondWithResult(_0x3bc07c,null))[_0xc4a9('0x29')](handleError(_0x3bc07c,null));};exports[_0xc4a9('0x9d')]=function(_0x56c148,_0x39c759,_0x1b9093){var _0x422ad8={};var _0xed642a={};var _0x53023d;var _0x23f0c3;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x56c148[_0xc4a9('0x54')]['id']}})[_0xc4a9('0x20')](handleEntityNotFound(_0x39c759,null))[_0xc4a9('0x20')](function(_0x3696ea){if(_0x3696ea){_0x53023d=_0x3696ea;_0xed642a['model']=_[_0xc4a9('0x40')](db[_0xc4a9('0x7a')][_0xc4a9('0x3c')]);_0xed642a[_0xc4a9('0x3f')]=_[_0xc4a9('0x40')](_0x56c148[_0xc4a9('0x3f')]);_0xed642a[_0xc4a9('0x4a')]=_['intersection'](_0xed642a[_0xc4a9('0x3e')],_0xed642a[_0xc4a9('0x3f')]);_0x422ad8['attributes']=_['intersection'](_0xed642a[_0xc4a9('0x3e')],qs[_0xc4a9('0x43')](_0x56c148[_0xc4a9('0x3f')][_0xc4a9('0x43')]));_0x422ad8[_0xc4a9('0x42')]=_0x422ad8['attributes'][_0xc4a9('0x44')]?_0x422ad8[_0xc4a9('0x42')]:_0xed642a[_0xc4a9('0x3e')];_0x422ad8['order']=qs[_0xc4a9('0x48')](_0x56c148['query'][_0xc4a9('0x48')]);_0x422ad8[_0xc4a9('0x49')]=qs['filters'](_['pick'](_0x56c148[_0xc4a9('0x3f')],_0xed642a['filters']));if(_0x56c148[_0xc4a9('0x3f')]['filter']){_0x422ad8[_0xc4a9('0x49')]=_[_0xc4a9('0x4c')](_0x422ad8[_0xc4a9('0x49')],{'$or':_[_0xc4a9('0x3b')](_0x422ad8[_0xc4a9('0x42')],function(_0x9f482e){var _0x122128={};_0x122128[_0x9f482e]={'$like':'%'+_0x56c148[_0xc4a9('0x3f')]['filter']+'%'};return _0x122128;})});}_0x422ad8=_[_0xc4a9('0x4c')]({},_0x422ad8,_0x56c148[_0xc4a9('0x4f')]);return _0x53023d['getApplications'](_0x422ad8);}})[_0xc4a9('0x20')](function(_0x58cce6){if(_0x58cce6){_0x23f0c3=_0x58cce6['length'];if(!_0x56c148['query'][_0xc4a9('0x45')](_0xc4a9('0x46'))){_0x422ad8[_0xc4a9('0x2f')]=qs[_0xc4a9('0x2f')](_0x56c148[_0xc4a9('0x3f')][_0xc4a9('0x2f')]);_0x422ad8[_0xc4a9('0x2e')]=qs[_0xc4a9('0x2e')](_0x56c148[_0xc4a9('0x3f')][_0xc4a9('0x2e')]);}return _0x53023d['getApplications'](_0x422ad8);}})[_0xc4a9('0x20')](function(_0x4db125){if(_0x4db125){return _0x4db125?{'count':_0x23f0c3,'rows':_0x4db125}:null;}})[_0xc4a9('0x20')](respondWithResult(_0x39c759,null))[_0xc4a9('0x29')](handleError(_0x39c759,null));};exports[_0xc4a9('0x9e')]=function(_0x38a7e4,_0x1d4590,_0x5e0378){var _0x51b95f={'raw':![],'where':{}};var _0x1504fb={};var _0x2f443b={'count':0x0,'rows':[]};return db[_0xc4a9('0x55')][_0xc4a9('0x63')]({'where':{'id':_0x38a7e4[_0xc4a9('0x54')]['id']}})['then'](handleEntityNotFound(_0x1d4590,null))[_0xc4a9('0x20')](function(_0x50749e){if(_0x50749e){_0x1504fb[_0xc4a9('0x3e')]=_['keys'](db[_0xc4a9('0x86')][_0xc4a9('0x3c')]);_0x1504fb[_0xc4a9('0x3f')]=_['keys'](_0x38a7e4[_0xc4a9('0x3f')]);_0x1504fb['filters']=_[_0xc4a9('0x41')](_0x1504fb[_0xc4a9('0x3e')],_0x1504fb['query']);_0x51b95f[_0xc4a9('0x42')]=_['intersection'](_0x1504fb[_0xc4a9('0x3e')],qs['fields'](_0x38a7e4[_0xc4a9('0x3f')][_0xc4a9('0x43')]));_0x51b95f[_0xc4a9('0x42')]=_0x51b95f[_0xc4a9('0x42')]['length']?_0x51b95f['attributes']:_0x1504fb[_0xc4a9('0x3e')];if(!_0x38a7e4[_0xc4a9('0x3f')][_0xc4a9('0x45')](_0xc4a9('0x46'))){_0x51b95f[_0xc4a9('0x2f')]=qs[_0xc4a9('0x2f')](_0x38a7e4['query']['limit']);_0x51b95f[_0xc4a9('0x2e')]=qs[_0xc4a9('0x2e')](_0x38a7e4[_0xc4a9('0x3f')]['offset']);}_0x51b95f[_0xc4a9('0x47')]=qs[_0xc4a9('0x48')](_0x38a7e4[_0xc4a9('0x3f')][_0xc4a9('0x48')]);_0x51b95f['where']=qs[_0xc4a9('0x4a')](_[_0xc4a9('0x4b')](_0x38a7e4[_0xc4a9('0x3f')],_0x1504fb['filters']));_0x51b95f['where']['OpenchannelAccountId']=_0x50749e['id'];if(_0x38a7e4[_0xc4a9('0x3f')][_0xc4a9('0x4e')]){_0x51b95f[_0xc4a9('0x49')]=_[_0xc4a9('0x4c')](_0x51b95f[_0xc4a9('0x49')],{'$or':_[_0xc4a9('0x3b')](_0x51b95f['attributes'],function(_0x4936bc){var _0x5556fc={};_0x5556fc[_0x4936bc]={'$like':'%'+_0x38a7e4['query'][_0xc4a9('0x4e')]+'%'};return _0x5556fc;})});}_0x51b95f=_[_0xc4a9('0x4c')]({},_0x51b95f,_0x38a7e4[_0xc4a9('0x4f')]);return db[_0xc4a9('0x86')][_0xc4a9('0x2d')]({'where':_0x51b95f['where']})[_0xc4a9('0x20')](function(_0x31b67f){_0x2f443b[_0xc4a9('0x2d')]=_0x31b67f;if(_0x38a7e4['query'][_0xc4a9('0x50')]){_0x51b95f['include']=[{'model':db[_0xc4a9('0x6b')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xc4a9('0x9f'),'attributes':[_0xc4a9('0x37'),_0xc4a9('0xa0'),_0xc4a9('0xa1')],'required':![]},{'model':db[_0xc4a9('0xa2')],'as':'Tags','attributes':['id',_0xc4a9('0x37'),_0xc4a9('0xa3')],'where':_0x38a7e4[_0xc4a9('0x3f')][_0xc4a9('0xa4')]?{'id':_0x38a7e4[_0xc4a9('0x3f')][_0xc4a9('0xa4')]}:undefined,'required':_0x38a7e4[_0xc4a9('0x3f')][_0xc4a9('0xa4')]?!![]:![]}];}return db[_0xc4a9('0x86')][_0xc4a9('0x64')](_0x51b95f);})[_0xc4a9('0x20')](function(_0x46f330){_0x2f443b[_0xc4a9('0x52')]=_0x46f330;return _0x2f443b;});}})[_0xc4a9('0x20')](respondWithFilteredResult(_0x1d4590,_0x51b95f))[_0xc4a9('0x29')](handleError(_0x1d4590,null));};exports[_0xc4a9('0xa5')]=function(_0x307e4d,_0x37f270,_0xdb7b6a){return db[_0xc4a9('0x55')][_0xc4a9('0x5e')]({'where':{'id':_0x307e4d[_0xc4a9('0x54')]['id']}})[_0xc4a9('0x20')](handleEntityNotFound(_0x37f270,null))['then'](function(_0x3bf714){if(_0x3bf714){return _0x3bf714[_0xc4a9('0xa5')](_0x307e4d[_0xc4a9('0x57')][_0xc4a9('0x65')],_[_0xc4a9('0xa6')](_0x307e4d[_0xc4a9('0x57')],['ids','id'])||{})[_0xc4a9('0x89')](function(_0x383c0b){for(var _0x6177d6=0x0;_0x6177d6<_0x307e4d[_0xc4a9('0x57')][_0xc4a9('0x65')]['length'];_0x6177d6+=0x1){socket[_0xc4a9('0xa7')](_0xc4a9('0xa8'),{'UserId':_0x307e4d[_0xc4a9('0x57')]['ids'][_0x6177d6],'OpenchannelAccountId':_0x307e4d[_0xc4a9('0x54')]['id']});}return _0x383c0b;});}})[_0xc4a9('0x20')](respondWithResult(_0x37f270,null))[_0xc4a9('0x29')](handleError(_0x37f270,null));};exports[_0xc4a9('0xa9')]=function(_0x49bf79,_0x2fdd20,_0x1cfb8e){return db[_0xc4a9('0x55')][_0xc4a9('0x5e')]({'where':{'id':_0x49bf79['params']['id']}})[_0xc4a9('0x20')](handleEntityNotFound(_0x2fdd20,null))[_0xc4a9('0x20')](function(_0xaf7a19){if(_0xaf7a19){return _0xaf7a19[_0xc4a9('0xa9')](_0x49bf79[_0xc4a9('0x3f')][_0xc4a9('0x65')])[_0xc4a9('0x20')](function(){if(_[_0xc4a9('0xaa')](_0x49bf79['query']['ids'])){for(var _0x44eb74=0x0;_0x44eb74<_0x49bf79[_0xc4a9('0x3f')][_0xc4a9('0x65')][_0xc4a9('0x44')];_0x44eb74+=0x1){socket[_0xc4a9('0xa7')](_0xc4a9('0xab'),{'UserId':Number(_0x49bf79['query']['ids'][_0x44eb74]),'OpenchannelAccountId':Number(_0x49bf79['params']['id'])});}}else{socket['emit'](_0xc4a9('0xab'),{'UserId':Number(_0x49bf79[_0xc4a9('0x3f')][_0xc4a9('0x65')]),'OpenchannelAccountId':Number(_0x49bf79['params']['id'])});}});}})[_0xc4a9('0x20')](respondWithStatusCode(_0x2fdd20,null))[_0xc4a9('0x29')](handleError(_0x2fdd20,null));};exports[_0xc4a9('0xac')]=function(_0x5133e5,_0x595854,_0x53fd81){var _0x3f5100={};var _0x4bef95={};var _0x5dc6c7;var _0x223903;return db[_0xc4a9('0x55')][_0xc4a9('0x63')]({'where':{'id':_0x5133e5[_0xc4a9('0x54')]['id']}})[_0xc4a9('0x20')](handleEntityNotFound(_0x595854,null))[_0xc4a9('0x20')](function(_0x36b0b3){if(_0x36b0b3){_0x5dc6c7=_0x36b0b3;_0x4bef95[_0xc4a9('0x3e')]=_['keys'](db[_0xc4a9('0xad')][_0xc4a9('0x3c')]);_0x4bef95[_0xc4a9('0x3f')]=_[_0xc4a9('0x40')](_0x5133e5[_0xc4a9('0x3f')]);_0x4bef95[_0xc4a9('0x4a')]=_[_0xc4a9('0x41')](_0x4bef95[_0xc4a9('0x3e')],_0x4bef95[_0xc4a9('0x3f')]);_0x3f5100[_0xc4a9('0x42')]=_[_0xc4a9('0x41')](_0x4bef95[_0xc4a9('0x3e')],qs[_0xc4a9('0x43')](_0x5133e5[_0xc4a9('0x3f')][_0xc4a9('0x43')]));_0x3f5100[_0xc4a9('0x42')]=_0x3f5100[_0xc4a9('0x42')][_0xc4a9('0x44')]?_0x3f5100[_0xc4a9('0x42')]:_0x4bef95['model'];_0x3f5100['order']=qs[_0xc4a9('0x48')](_0x5133e5[_0xc4a9('0x3f')]['sort']);_0x3f5100['where']=qs[_0xc4a9('0x4a')](_[_0xc4a9('0x4b')](_0x5133e5[_0xc4a9('0x3f')],_0x4bef95[_0xc4a9('0x4a')]));if(_0x5133e5[_0xc4a9('0x3f')][_0xc4a9('0x4e')]){_0x3f5100['where']=_['merge'](_0x3f5100[_0xc4a9('0x49')],{'$or':_['map'](_0x3f5100[_0xc4a9('0x42')],function(_0x28f862){var _0x3e115b={};_0x3e115b[_0x28f862]={'$like':'%'+_0x5133e5[_0xc4a9('0x3f')][_0xc4a9('0x4e')]+'%'};return _0x3e115b;})});}_0x3f5100=_['merge']({},_0x3f5100,_0x5133e5[_0xc4a9('0x4f')]);return _0x5dc6c7[_0xc4a9('0xac')](_0x3f5100);}})[_0xc4a9('0x20')](function(_0x350774){if(_0x350774){_0x223903=_0x350774[_0xc4a9('0x44')];if(!_0x5133e5[_0xc4a9('0x3f')][_0xc4a9('0x45')](_0xc4a9('0x46'))){_0x3f5100[_0xc4a9('0x2f')]=qs[_0xc4a9('0x2f')](_0x5133e5['query'][_0xc4a9('0x2f')]);_0x3f5100[_0xc4a9('0x2e')]=qs['offset'](_0x5133e5['query'][_0xc4a9('0x2e')]);}return _0x5dc6c7[_0xc4a9('0xac')](_0x3f5100);}})['then'](function(_0x51fa6c){if(_0x51fa6c){return _0x51fa6c?{'count':_0x223903,'rows':_0x51fa6c}:null;}})[_0xc4a9('0x20')](respondWithResult(_0x595854,null))[_0xc4a9('0x29')](handleError(_0x595854,null));};exports[_0xc4a9('0x38')]=function(_0x540b33,_0x55c8f0,_0x46d0b5){var _0x5f0040,_0x282d4e,_0x3298ba;if(_['isNil'](_0x540b33['body']['body'])||_0x540b33[_0xc4a9('0x57')][_0xc4a9('0x57')]===''){throw new db[(_0xc4a9('0x6c'))][(_0xc4a9('0x6d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x540b33[_0xc4a9('0x57')]['to'])){}_0x5f0040=_0x540b33[_0xc4a9('0x57')]['to'];return db[_0xc4a9('0x55')][_0xc4a9('0x63')]({'where':{'id':_0x540b33[_0xc4a9('0x54')]['id']}})[_0xc4a9('0x20')](handleEntityNotFound(_0x55c8f0,null))[_0xc4a9('0x20')](function(_0x2a18e5){if(_0x2a18e5){return db[_0xc4a9('0x55')]['find']({'where':{'id':_0x2a18e5['id']},'include':[{'model':db[_0xc4a9('0xae')],'as':'List','include':[{'model':db[_0xc4a9('0x6b')],'as':_0xc4a9('0x78'),'where':{[_0x2a18e5[_0xc4a9('0x75')]]:_0x5f0040},'limit':0x1,'order':[[_0xc4a9('0x70'),_0xc4a9('0x79')]]}]}]})[_0xc4a9('0x20')](handleEntityNotFound(_0x55c8f0,null))[_0xc4a9('0x20')](function(_0x52f7e9){if(_0x52f7e9&&_0x52f7e9[_0xc4a9('0x77')]){_0x282d4e=_0x52f7e9['get']({'plain':!![]});if(_0x282d4e['List']&&_0x282d4e[_0xc4a9('0x77')]['Contacts']['length']){return _0x282d4e[_0xc4a9('0x77')]['Contacts'][0x0];}return db['CmContact'][_0xc4a9('0x56')](_[_0xc4a9('0x81')](_0x540b33['body'],{'firstName':_0x5f0040,[_0x52f7e9[_0xc4a9('0x75')]]:_0x5f0040,'phone':_0x5f0040,'ListId':_0x282d4e[_0xc4a9('0x71')]}));}})[_0xc4a9('0x20')](handleEntityNotFound(_0x55c8f0,null))[_0xc4a9('0x20')](function(_0xc3c654){if(_0xc3c654){_0x3298ba=_0xc3c654;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x3298ba['id'],'closed':![],'OpenchannelAccountId':_0x282d4e['id']}})[_0xc4a9('0x20')](function(_0x3ee7ce){if(_0x3ee7ce){return[_0x3ee7ce,![]];}return db[_0xc4a9('0x86')][_0xc4a9('0x56')]({'UserId':_0x540b33[_0xc4a9('0xaf')]['id'],'ContactId':_0x3298ba['id'],'OpenchannelAccountId':_0x282d4e['id'],'lastMsgDirection':_0xc4a9('0xb0'),'Messages':[_[_0xc4a9('0x4c')](_0x540b33[_0xc4a9('0x57')],{'read':![],'body':_0x540b33[_0xc4a9('0x57')][_0xc4a9('0x57')],'OpenchannelAccountId':_0x282d4e['id'],'UserId':_0x540b33['user']['id'],'ContactId':_0x3298ba['id']})]},{'include':[{'model':db[_0xc4a9('0x91')],'as':_0xc4a9('0xb1')}]})[_0xc4a9('0x20')](function(_0x302b0f){return[_0x302b0f,!![]];});});}})[_0xc4a9('0x89')](function(_0x321f1f,_0x971b58){if(_0x971b58){return _0x321f1f;}return db['OpenchannelMessage'][_0xc4a9('0x56')](_['merge'](_0x540b33[_0xc4a9('0x57')],{'read':![],'body':_0x540b33[_0xc4a9('0x57')][_0xc4a9('0x57')],'OpenchannelAccountId':_0x282d4e['id'],'OpenchannelInteractionId':_0x321f1f['id'],'UserId':_0x540b33[_0xc4a9('0xaf')]['id'],'ContactId':_0x3298ba['id']}))[_0xc4a9('0x20')](function(_0x491c54){_0x321f1f[_0xc4a9('0xb2')][_0xc4a9('0xb1')]=[];_0x321f1f['dataValues']['Messages']['push'](_0x491c54['dataValues']);return _0x321f1f;});});}})[_0xc4a9('0x20')](respondWithResult(_0x55c8f0,null))[_0xc4a9('0x29')](handleError(_0x55c8f0,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 22a6b69..3631b57 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 _0xf8e9=['remove','emit','exports','events','OpenchannelAccount','setMaxListeners','update'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0xf8e9,0x9d));var _0x9f8e=function(_0x23507a,_0x59c5f2){_0x23507a=_0x23507a-0x0;var _0x138536=_0xf8e9[_0x23507a];return _0x138536;};'use strict';var EventEmitter=require(_0x9f8e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x9f8e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9f8e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9f8e('0x3'),'afterDestroy':_0x9f8e('0x4')};function emitEvent(_0x97ba85){return function(_0x4e32e2,_0x5236ac,_0x1da0a7){OpenchannelAccountEvents[_0x9f8e('0x5')](_0x97ba85+':'+_0x4e32e2['id'],_0x4e32e2);OpenchannelAccountEvents['emit'](_0x97ba85,_0x4e32e2);_0x1da0a7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x9f8e('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xbd59=['emit','hook','exports','../../mysqldb'];(function(_0xa8a24d,_0x404f28){var _0x43587a=function(_0x1637b8){while(--_0x1637b8){_0xa8a24d['push'](_0xa8a24d['shift']());}};_0x43587a(++_0x404f28);}(_0xbd59,0x12b));var _0x9bd5=function(_0x4ab63b,_0x1c8bd7){_0x4ab63b=_0x4ab63b-0x0;var _0x381f56=_0xbd59[_0x4ab63b];return _0x381f56;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x9bd5('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4fb489){return function(_0x48440,_0x2bf1b3,_0x24f47){OpenchannelAccountEvents[_0x9bd5('0x1')](_0x4fb489+':'+_0x48440['id'],_0x48440);OpenchannelAccountEvents[_0x9bd5('0x1')](_0x4fb489,_0x48440);_0x24f47(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x9bd5('0x2')](e,emitEvent(event));}}module[_0x9bd5('0x3')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 3053c47..760ab1a 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 _0xa172=['OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xa172,0x1ec));var _0x2a17=function(_0x4233a6,_0x104a18){_0x4233a6=_0x4233a6-0x0;var _0x2d21de=_0xa172[_0x4233a6];return _0x2d21de;};'use strict';var _=require(_0x2a17('0x0'));var util=require(_0x2a17('0x1'));var logger=require(_0x2a17('0x2'))(_0x2a17('0x3'));var moment=require(_0x2a17('0x4'));var BPromise=require(_0x2a17('0x5'));var rp=require(_0x2a17('0x6'));var fs=require('fs');var path=require(_0x2a17('0x7'));var rimraf=require(_0x2a17('0x8'));var config=require(_0x2a17('0x9'));var attributes=require('./openchannelAccount.attributes');module[_0x2a17('0xa')]=function(_0x212798,_0x5d2d4f){return _0x212798[_0x2a17('0xb')](_0x2a17('0xc'),attributes,{'tableName':_0x2a17('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa71e=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa71e,0x1dd));var _0xea71=function(_0x188945,_0x2aafa5){_0x188945=_0x188945-0x0;var _0x4959c2=_0xa71e[_0x188945];return _0x4959c2;};'use strict';var _=require(_0xea71('0x0'));var util=require(_0xea71('0x1'));var logger=require(_0xea71('0x2'))(_0xea71('0x3'));var moment=require(_0xea71('0x4'));var BPromise=require(_0xea71('0x5'));var rp=require(_0xea71('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea71('0x7'));var config=require(_0xea71('0x8'));var attributes=require('./openchannelAccount.attributes');module['exports']=function(_0x3820f9,_0x246c19){return _0x3820f9[_0xea71('0x9')](_0xea71('0xa'),attributes,{'tableName':_0xea71('0xb'),'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 ab46919..d9630f3 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 _0xf0c1=['socket.io-emitter','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x1ec586,_0x331aba){var _0x39b0f0=function(_0x5569ff){while(--_0x5569ff){_0x1ec586['push'](_0x1ec586['shift']());}};_0x39b0f0(++_0x331aba);}(_0xf0c1,0x138));var _0x1f0c=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0xf0c1[_0x6f1a87];return _0x2495c7;};'use strict';var _=require(_0x1f0c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1f0c('0x1'));var rs=require(_0x1f0c('0x2'));var fs=require('fs');var Redis=require(_0x1f0c('0x3'));var db=require(_0x1f0c('0x4'))['db'];var utils=require(_0x1f0c('0x5'));var logger=require(_0x1f0c('0x6'))(_0x1f0c('0x7'));var config=require(_0x1f0c('0x8'));var jayson=require(_0x1f0c('0x9'));var client=jayson[_0x1f0c('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x1f0c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f0c('0xc'))(new Redis(config[_0x1f0c('0xb')]));require(_0x1f0c('0xd'))[_0x1f0c('0xe')](socket);function respondWithRpcPromise(_0x1cd4ba,_0x10798d,_0x27c76b){return new BPromise(function(_0x111a72,_0x2385fb){return client['request'](_0x1cd4ba,_0x27c76b)[_0x1f0c('0xf')](function(_0x34581b){logger[_0x1f0c('0x10')](_0x1f0c('0x11'),_0x10798d,_0x1f0c('0x12'));logger[_0x1f0c('0x13')](_0x1f0c('0x14'),_0x10798d,_0x1f0c('0x12'),JSON[_0x1f0c('0x15')](_0x34581b));if(_0x34581b['error']){if(_0x34581b[_0x1f0c('0x16')][_0x1f0c('0x17')]===0x1f4){logger[_0x1f0c('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x10798d,_0x34581b[_0x1f0c('0x16')][_0x1f0c('0x18')]);return _0x2385fb(_0x34581b[_0x1f0c('0x16')][_0x1f0c('0x18')]);}logger[_0x1f0c('0x16')](_0x1f0c('0x11'),_0x10798d,_0x34581b[_0x1f0c('0x16')]['message']);return _0x111a72(_0x34581b['error'][_0x1f0c('0x18')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x10798d,_0x1f0c('0x12'));_0x111a72(_0x34581b[_0x1f0c('0x19')][_0x1f0c('0x18')]);}})[_0x1f0c('0x1a')](function(_0xde9b68){logger[_0x1f0c('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x10798d,_0xde9b68);_0x2385fb(_0xde9b68);});});} \ No newline at end of file +var _0x2f66=['localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis'];(function(_0x5d184b,_0x1b04c5){var _0x5cee64=function(_0x393f88){while(--_0x393f88){_0x5d184b['push'](_0x5d184b['shift']());}};_0x5cee64(++_0x1b04c5);}(_0x2f66,0xe1));var _0x62f6=function(_0xd8813a,_0x315766){_0xd8813a=_0xd8813a-0x0;var _0x487db6=_0x2f66[_0xd8813a];return _0x487db6;};'use strict';var _=require(_0x62f6('0x0'));var util=require('util');var moment=require(_0x62f6('0x1'));var BPromise=require('bluebird');var rs=require(_0x62f6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x62f6('0x3'))('rpc');var config=require(_0x62f6('0x4'));var jayson=require(_0x62f6('0x5'));var client=jayson['client'][_0x62f6('0x6')]({'port':0x232a});config['redis']=_[_0x62f6('0x7')](config[_0x62f6('0x8')],{'host':_0x62f6('0x9'),'port':0x18eb});var socket=require(_0x62f6('0xa'))(new Redis(config[_0x62f6('0x8')]));require(_0x62f6('0xb'))[_0x62f6('0xc')](socket);function respondWithRpcPromise(_0x35808b,_0x287b80,_0x46653f){return new BPromise(function(_0x5e016a,_0xce1bec){return client[_0x62f6('0xd')](_0x35808b,_0x46653f)[_0x62f6('0xe')](function(_0x45fda5){logger[_0x62f6('0xf')](_0x62f6('0x10'),_0x287b80,_0x62f6('0x11'));logger[_0x62f6('0x12')](_0x62f6('0x13'),_0x287b80,'request\x20sent',JSON[_0x62f6('0x14')](_0x45fda5));if(_0x45fda5[_0x62f6('0x15')]){if(_0x45fda5['error'][_0x62f6('0x16')]===0x1f4){logger[_0x62f6('0x15')](_0x62f6('0x10'),_0x287b80,_0x45fda5[_0x62f6('0x15')][_0x62f6('0x17')]);return _0xce1bec(_0x45fda5['error'][_0x62f6('0x17')]);}logger[_0x62f6('0x15')](_0x62f6('0x10'),_0x287b80,_0x45fda5['error'][_0x62f6('0x17')]);return _0x5e016a(_0x45fda5[_0x62f6('0x15')][_0x62f6('0x17')]);}else{logger[_0x62f6('0xf')](_0x62f6('0x10'),_0x287b80,_0x62f6('0x11'));_0x5e016a(_0x45fda5[_0x62f6('0x18')]['message']);}})[_0x62f6('0x19')](function(_0x62adc1){logger[_0x62f6('0x15')](_0x62f6('0x10'),_0x287b80,_0x62adc1);_0xce1bec(_0x62adc1);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index f0a25ee..c6eca83 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 _0xca9a=['./openchannelAccount.events','save','remove','update','register','length'];(function(_0x139000,_0x2dfd4f){var _0x251c5c=function(_0x42d907){while(--_0x42d907){_0x139000['push'](_0x139000['shift']());}};_0x251c5c(++_0x2dfd4f);}(_0xca9a,0xae));var _0xaca9=function(_0x3a02da,_0x207df0){_0x3a02da=_0x3a02da-0x0;var _0x10e655=_0xca9a[_0x3a02da];return _0x10e655;};'use strict';var OpenchannelAccountEvents=require(_0xaca9('0x0'));var events=[_0xaca9('0x1'),_0xaca9('0x2'),_0xaca9('0x3')];function createListener(_0x423c6d,_0x5254a9){return function(_0x5b7352){_0x5254a9['emit'](_0x423c6d,_0x5b7352);};}function removeListener(_0x1d75d4,_0x37a9d6){return function(){OpenchannelAccountEvents['removeListener'](_0x1d75d4,_0x37a9d6);};}exports[_0xaca9('0x4')]=function(_0x1f78a5){for(var _0x1d9900=0x0,_0x3b4194=events[_0xaca9('0x5')];_0x1d9900<_0x3b4194;_0x1d9900++){var _0x4509d5=events[_0x1d9900];var _0x323901=createListener('openchannelAccount:'+_0x4509d5,_0x1f78a5);OpenchannelAccountEvents['on'](_0x4509d5,_0x323901);}}; \ No newline at end of file +var _0x867f=['remove','update','emit','register','length','./openchannelAccount.events','save'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0x867f,0x155));var _0xf867=function(_0x517869,_0x1f383b){_0x517869=_0x517869-0x0;var _0x2e6dd7=_0x867f[_0x517869];return _0x2e6dd7;};'use strict';var OpenchannelAccountEvents=require(_0xf867('0x0'));var events=[_0xf867('0x1'),_0xf867('0x2'),_0xf867('0x3')];function createListener(_0x4af6f8,_0x281114){return function(_0x264b17){_0x281114[_0xf867('0x4')](_0x4af6f8,_0x264b17);};}function removeListener(_0x279dee,_0x494946){return function(){OpenchannelAccountEvents['removeListener'](_0x279dee,_0x494946);};}exports[_0xf867('0x5')]=function(_0x5a1dd6){for(var _0x3003a4=0x0,_0xb1b294=events[_0xf867('0x6')];_0x3003a4<_0xb1b294;_0x3003a4++){var _0x240266=events[_0x3003a4];var _0x843a49=createListener('openchannelAccount:'+_0x240266,_0x5a1dd6);OpenchannelAccountEvents['on'](_0x240266,_0x843a49);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index d1103af..f87bb26 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 _0x1676=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','post','put','delete','exports','multer','util','path'];(function(_0x54edfc,_0x2cee84){var _0x516b86=function(_0x1ded9a){while(--_0x1ded9a){_0x54edfc['push'](_0x54edfc['shift']());}};_0x516b86(++_0x2cee84);}(_0x1676,0xf9));var _0x6167=function(_0x4d54de,_0x14cc7f){_0x4d54de=_0x4d54de-0x0;var _0x23b9f4=_0x1676[_0x4d54de];return _0x23b9f4;};'use strict';var multer=require(_0x6167('0x0'));var util=require(_0x6167('0x1'));var path=require(_0x6167('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6167('0x3')]();var fs_extra=require(_0x6167('0x4'));var auth=require(_0x6167('0x5'));var interaction=require(_0x6167('0x6'));var config=require(_0x6167('0x7'));var controller=require(_0x6167('0x8'));router['get']('/',auth[_0x6167('0x9')](),controller[_0x6167('0xa')]);router[_0x6167('0xb')](_0x6167('0xc'),auth['isAuthenticated'](),controller[_0x6167('0xd')]);router[_0x6167('0xe')]('/',auth[_0x6167('0x9')](),controller['create']);router[_0x6167('0xf')](_0x6167('0xc'),auth[_0x6167('0x9')](),controller['update']);router[_0x6167('0x10')]('/:id',auth[_0x6167('0x9')](),controller['destroy']);module[_0x6167('0x11')]=router; \ No newline at end of file +var _0x5113=['get','/:id','show','create','put','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelApplication.controller','isAuthenticated','index'];(function(_0x4be09d,_0x5674c5){var _0x382868=function(_0x4a3950){while(--_0x4a3950){_0x4be09d['push'](_0x4be09d['shift']());}};_0x382868(++_0x5674c5);}(_0x5113,0x1e7));var _0x3511=function(_0x390b7c,_0x43ef0c){_0x390b7c=_0x390b7c-0x0;var _0x30bfc5=_0x5113[_0x390b7c];return _0x30bfc5;};'use strict';var multer=require(_0x3511('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3511('0x1'));var express=require(_0x3511('0x2'));var router=express[_0x3511('0x3')]();var fs_extra=require(_0x3511('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3511('0x5'));var config=require('../../config/environment');var controller=require(_0x3511('0x6'));router['get']('/',auth[_0x3511('0x7')](),controller[_0x3511('0x8')]);router[_0x3511('0x9')](_0x3511('0xa'),auth[_0x3511('0x7')](),controller[_0x3511('0xb')]);router['post']('/',auth[_0x3511('0x7')](),controller[_0x3511('0xc')]);router[_0x3511('0xd')](_0x3511('0xa'),auth[_0x3511('0x7')](),controller['update']);router[_0x3511('0xe')](_0x3511('0xa'),auth[_0x3511('0x7')](),controller[_0x3511('0xf')]);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 3bff513..79a73e1 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 _0xeafa=['exports','INTEGER','STRING','TEXT'];(function(_0x4069d6,_0x32c6d1){var _0x3ae8ed=function(_0x4812e7){while(--_0x4812e7){_0x4069d6['push'](_0x4069d6['shift']());}};_0x3ae8ed(++_0x32c6d1);}(_0xeafa,0x1e8));var _0xaeaf=function(_0x5a3b2b,_0x22903e){_0x5a3b2b=_0x5a3b2b-0x0;var _0x3568c7=_0xeafa[_0x5a3b2b];return _0x3568c7;};'use strict';var Sequelize=require('sequelize');module[_0xaeaf('0x0')]={'priority':{'type':Sequelize[_0xaeaf('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xaeaf('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xaeaf('0x3')]()},'description':{'type':Sequelize[_0xaeaf('0x2')]},'interval':{'type':Sequelize[_0xaeaf('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x9379=['*,*,*,*','exports','STRING','noop'];(function(_0x52f4d0,_0x239263){var _0x3fb576=function(_0xe17a5e){while(--_0xe17a5e){_0x52f4d0['push'](_0x52f4d0['shift']());}};_0x3fb576(++_0x239263);}(_0x9379,0x1d9));var _0x9937=function(_0x15197a,_0x49db95){_0x15197a=_0x15197a-0x0;var _0x3dabb7=_0x9379[_0x15197a];return _0x3dabb7;};'use strict';var Sequelize=require('sequelize');module[_0x9937('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9937('0x1')],'allowNull':![],'defaultValue':_0x9937('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9937('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 1b92f28..dbb9834 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 _0x7831=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','params','html-pdf','fast-json-patch','moment','bluebird'];(function(_0x41414c,_0x362f67){var _0x547978=function(_0x46fc3c){while(--_0x46fc3c){_0x41414c['push'](_0x41414c['shift']());}};_0x547978(++_0x362f67);}(_0x7831,0x124));var _0x1783=function(_0x2ba47a,_0x31ec4c){_0x2ba47a=_0x2ba47a-0x0;var _0x21d3eb=_0x7831[_0x2ba47a];return _0x21d3eb;};'use strict';var pdf=require(_0x1783('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1783('0x1'));var rp=require('request-promise');var moment=require(_0x1783('0x2'));var BPromise=require(_0x1783('0x3'));var Mustache=require(_0x1783('0x4'));var util=require(_0x1783('0x5'));var path=require(_0x1783('0x6'));var sox=require(_0x1783('0x7'));var csv=require(_0x1783('0x8'));var ejs=require(_0x1783('0x9'));var fs=require('fs');var fs_extra=require(_0x1783('0xa'));var _=require(_0x1783('0xb'));var squel=require('squel');var crypto=require(_0x1783('0xc'));var jsforce=require(_0x1783('0xd'));var deskjs=require(_0x1783('0xe'));var toCsv=require(_0x1783('0x8'));var querystring=require(_0x1783('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1783('0x10'));var qs=require(_0x1783('0x11'));var as=require(_0x1783('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1783('0x13'))(_0x1783('0x14'));var utils=require(_0x1783('0x15'));var config=require(_0x1783('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1783('0x17'))['db'];function respondWithStatusCode(_0x426c01,_0x205439){_0x205439=_0x205439||0xcc;return function(_0x1cac1f){if(_0x1cac1f){return _0x426c01[_0x1783('0x18')](_0x205439);}return _0x426c01['status'](_0x205439)[_0x1783('0x19')]();};}function respondWithResult(_0x2ba127,_0xb79055){_0xb79055=_0xb79055||0xc8;return function(_0x5d0f4d){if(_0x5d0f4d){return _0x2ba127[_0x1783('0x1a')](_0xb79055)[_0x1783('0x1b')](_0x5d0f4d);}};}function respondWithFilteredResult(_0x2d6ab0,_0x41d06c){return function(_0x255f08){if(_0x255f08){var _0x1974c9=_0x255f08[_0x1783('0x1c')],_0x377501=_0x41d06c[_0x1783('0x1d')],_0x5e7376=_0x41d06c['offset']+_0x41d06c[_0x1783('0x1e')],_0x4b0725;if(_0x5e7376>=_0x1974c9){_0x5e7376=_0x1974c9;_0x4b0725=0xc8;}else{_0x4b0725=0xce;}_0x2d6ab0[_0x1783('0x1a')](_0x4b0725);return _0x2d6ab0[_0x1783('0x1f')]('Content-Range',_0x377501+'-'+_0x5e7376+'/'+_0x1974c9)[_0x1783('0x1b')](_0x255f08);}return null;};}function patchUpdates(_0x21d3c6){return function(_0x2e7b44){try{jsonpatch[_0x1783('0x20')](_0x2e7b44,_0x21d3c6,!![]);}catch(_0x427486){return BPromise[_0x1783('0x21')](_0x427486);}return _0x2e7b44[_0x1783('0x22')]();};}function saveUpdates(_0x4c5458,_0x3a1730){return function(_0x4773ae){if(_0x4773ae){return _0x4773ae[_0x1783('0x23')](_0x4c5458)['then'](function(_0x5f51b9){return _0x5f51b9;});}return null;};}function removeEntity(_0x1400fa,_0x245e3a){return function(_0x437fcb){if(_0x437fcb){return _0x437fcb[_0x1783('0x24')]()[_0x1783('0x25')](function(){_0x1400fa[_0x1783('0x1a')](0xcc)[_0x1783('0x19')]();});}};}function handleEntityNotFound(_0x5d9cde,_0x4d4f24){return function(_0x2ca0e2){if(!_0x2ca0e2){_0x5d9cde[_0x1783('0x18')](0x194);}return _0x2ca0e2;};}function handleError(_0x2f7417,_0x65b720){_0x65b720=_0x65b720||0x1f4;return function(_0xf813db){logger[_0x1783('0x26')](_0xf813db['stack']);if(_0xf813db[_0x1783('0x27')]){delete _0xf813db[_0x1783('0x27')];}_0x2f7417[_0x1783('0x1a')](_0x65b720)[_0x1783('0x28')](_0xf813db);};}exports[_0x1783('0x29')]=function(_0x5a3227,_0x144ff2){var _0x4b9a9c={},_0x2d6d33={},_0x3f51d7={'count':0x0,'rows':[]};var _0x180f13=_[_0x1783('0x2a')](db[_0x1783('0x2b')][_0x1783('0x2c')],function(_0x14122e){return{'name':_0x14122e[_0x1783('0x2d')],'type':_0x14122e['type'][_0x1783('0x2e')]};});_0x2d6d33[_0x1783('0x2f')]=_[_0x1783('0x2a')](_0x180f13,_0x1783('0x27'));_0x2d6d33[_0x1783('0x30')]=_[_0x1783('0x31')](_0x5a3227[_0x1783('0x30')]);_0x2d6d33[_0x1783('0x32')]=_[_0x1783('0x33')](_0x2d6d33[_0x1783('0x2f')],_0x2d6d33[_0x1783('0x30')]);_0x4b9a9c[_0x1783('0x34')]=_[_0x1783('0x33')](_0x2d6d33[_0x1783('0x2f')],qs[_0x1783('0x35')](_0x5a3227[_0x1783('0x30')][_0x1783('0x35')]));_0x4b9a9c[_0x1783('0x34')]=_0x4b9a9c[_0x1783('0x34')]['length']?_0x4b9a9c[_0x1783('0x34')]:_0x2d6d33[_0x1783('0x2f')];if(!_0x5a3227[_0x1783('0x30')][_0x1783('0x36')](_0x1783('0x37'))){_0x4b9a9c[_0x1783('0x1e')]=qs[_0x1783('0x1e')](_0x5a3227[_0x1783('0x30')][_0x1783('0x1e')]);_0x4b9a9c['offset']=qs['offset'](_0x5a3227[_0x1783('0x30')]['offset']);}_0x4b9a9c['order']=qs['sort'](_0x5a3227[_0x1783('0x30')][_0x1783('0x38')]);_0x4b9a9c[_0x1783('0x39')]=qs['filters'](_[_0x1783('0x3a')](_0x5a3227[_0x1783('0x30')],_0x2d6d33['filters']),_0x180f13);if(_0x5a3227['query'][_0x1783('0x3b')]){_0x4b9a9c[_0x1783('0x39')]=_[_0x1783('0x3c')](_0x4b9a9c[_0x1783('0x39')],{'$or':_[_0x1783('0x2a')](_0x180f13,function(_0x72820a){if(_0x72820a[_0x1783('0x3d')]!==_0x1783('0x3e')){var _0x3696a8={};_0x3696a8[_0x72820a[_0x1783('0x27')]]={'$like':'%'+_0x5a3227['query'][_0x1783('0x3b')]+'%'};return _0x3696a8;}})});}_0x4b9a9c=_['merge']({},_0x4b9a9c,_0x5a3227[_0x1783('0x3f')]);var _0x1a13cc={'where':_0x4b9a9c[_0x1783('0x39')]};return db[_0x1783('0x2b')][_0x1783('0x1c')](_0x1a13cc)[_0x1783('0x25')](function(_0x29a2e4){_0x3f51d7[_0x1783('0x1c')]=_0x29a2e4;if(_0x5a3227[_0x1783('0x30')][_0x1783('0x40')]){_0x4b9a9c[_0x1783('0x41')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x1783('0x42')](_0x4b9a9c);})[_0x1783('0x25')](function(_0x3d7f72){_0x3f51d7['rows']=_0x3d7f72;return _0x3f51d7;})[_0x1783('0x25')](respondWithFilteredResult(_0x144ff2,_0x4b9a9c))[_0x1783('0x43')](handleError(_0x144ff2,null));};exports[_0x1783('0x44')]=function(_0x16b0e2,_0x55f52c){var _0xdc8816={'raw':!![],'where':{'id':_0x16b0e2['params']['id']}},_0x3559e8={};_0x3559e8[_0x1783('0x2f')]=_[_0x1783('0x31')](db[_0x1783('0x2b')][_0x1783('0x2c')]);_0x3559e8[_0x1783('0x30')]=_['keys'](_0x16b0e2[_0x1783('0x30')]);_0x3559e8[_0x1783('0x32')]=_[_0x1783('0x33')](_0x3559e8[_0x1783('0x2f')],_0x3559e8['query']);_0xdc8816[_0x1783('0x34')]=_[_0x1783('0x33')](_0x3559e8['model'],qs[_0x1783('0x35')](_0x16b0e2['query'][_0x1783('0x35')]));_0xdc8816[_0x1783('0x34')]=_0xdc8816[_0x1783('0x34')][_0x1783('0x45')]?_0xdc8816['attributes']:_0x3559e8[_0x1783('0x2f')];if(_0x16b0e2['query'][_0x1783('0x40')]){_0xdc8816[_0x1783('0x41')]=[{'all':!![]}];}_0xdc8816=_[_0x1783('0x3c')]({},_0xdc8816,_0x16b0e2[_0x1783('0x3f')]);return db[_0x1783('0x2b')][_0x1783('0x46')](_0xdc8816)[_0x1783('0x25')](handleEntityNotFound(_0x55f52c,null))[_0x1783('0x25')](respondWithResult(_0x55f52c,null))[_0x1783('0x43')](handleError(_0x55f52c,null));};exports[_0x1783('0x47')]=function(_0x211d6e,_0x3540f4){return db['OpenchannelApplication'][_0x1783('0x47')](_0x211d6e['body'],{})[_0x1783('0x25')](respondWithResult(_0x3540f4,0xc9))[_0x1783('0x43')](handleError(_0x3540f4,null));};exports[_0x1783('0x23')]=function(_0x51aa34,_0x52529f){if(_0x51aa34[_0x1783('0x48')]['id']){delete _0x51aa34[_0x1783('0x48')]['id'];}return db[_0x1783('0x2b')][_0x1783('0x46')]({'where':{'id':_0x51aa34[_0x1783('0x49')]['id']}})[_0x1783('0x25')](handleEntityNotFound(_0x52529f,null))[_0x1783('0x25')](saveUpdates(_0x51aa34['body'],null))['then'](respondWithResult(_0x52529f,null))[_0x1783('0x43')](handleError(_0x52529f,null));};exports[_0x1783('0x24')]=function(_0x2f2d37,_0x2a95b9){return db['OpenchannelApplication'][_0x1783('0x46')]({'where':{'id':_0x2f2d37[_0x1783('0x49')]['id']}})[_0x1783('0x25')](handleEntityNotFound(_0x2a95b9,null))['then'](removeEntity(_0x2a95b9,null))[_0x1783('0x43')](handleError(_0x2a95b9,null));}; \ No newline at end of file +var _0xc165=['name','query','keys','filters','intersection','model','fields','attributes','length','nolimit','offset','sort','where','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','html-pdf','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','limit','set','apply','save','update','destroy','then','end','error','send','index','map','OpenchannelApplication','rawAttributes','fieldName'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc165,0x67));var _0x5c16=function(_0x3eae8d,_0x331b35){_0x3eae8d=_0x3eae8d-0x0;var _0x360920=_0xc165[_0x3eae8d];return _0x360920;};'use strict';var pdf=require(_0x5c16('0x0'));var emlformat=require(_0x5c16('0x1'));var rimraf=require(_0x5c16('0x2'));var zipdir=require(_0x5c16('0x3'));var jsonpatch=require(_0x5c16('0x4'));var rp=require(_0x5c16('0x5'));var moment=require(_0x5c16('0x6'));var BPromise=require(_0x5c16('0x7'));var Mustache=require(_0x5c16('0x8'));var util=require(_0x5c16('0x9'));var path=require(_0x5c16('0xa'));var sox=require(_0x5c16('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c16('0xc'));var _=require(_0x5c16('0xd'));var squel=require(_0x5c16('0xe'));var crypto=require(_0x5c16('0xf'));var jsforce=require(_0x5c16('0x10'));var deskjs=require(_0x5c16('0x11'));var toCsv=require(_0x5c16('0x12'));var querystring=require(_0x5c16('0x13'));var Papa=require('papaparse');var Redis=require(_0x5c16('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x5c16('0x15'));var as=require(_0x5c16('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c16('0x17'));var utils=require(_0x5c16('0x18'));var config=require(_0x5c16('0x19'));var licenseUtil=require(_0x5c16('0x1a'));var db=require(_0x5c16('0x1b'))['db'];function respondWithStatusCode(_0x1aaa45,_0x329b79){_0x329b79=_0x329b79||0xcc;return function(_0x11447c){if(_0x11447c){return _0x1aaa45[_0x5c16('0x1c')](_0x329b79);}return _0x1aaa45[_0x5c16('0x1d')](_0x329b79)['end']();};}function respondWithResult(_0x1af46c,_0x1e557c){_0x1e557c=_0x1e557c||0xc8;return function(_0x3f96bf){if(_0x3f96bf){return _0x1af46c[_0x5c16('0x1d')](_0x1e557c)[_0x5c16('0x1e')](_0x3f96bf);}};}function respondWithFilteredResult(_0x29ef53,_0x45a631){return function(_0x165569){if(_0x165569){var _0x3a83ee=_0x165569[_0x5c16('0x1f')],_0x11bad8=_0x45a631['offset'],_0x7c6566=_0x45a631['offset']+_0x45a631[_0x5c16('0x20')],_0x3cd67c;if(_0x7c6566>=_0x3a83ee){_0x7c6566=_0x3a83ee;_0x3cd67c=0xc8;}else{_0x3cd67c=0xce;}_0x29ef53[_0x5c16('0x1d')](_0x3cd67c);return _0x29ef53[_0x5c16('0x21')]('Content-Range',_0x11bad8+'-'+_0x7c6566+'/'+_0x3a83ee)[_0x5c16('0x1e')](_0x165569);}return null;};}function patchUpdates(_0x2c5247){return function(_0x168709){try{jsonpatch[_0x5c16('0x22')](_0x168709,_0x2c5247,!![]);}catch(_0x24146c){return BPromise['reject'](_0x24146c);}return _0x168709[_0x5c16('0x23')]();};}function saveUpdates(_0x2f8958,_0x144626){return function(_0xeb7e82){if(_0xeb7e82){return _0xeb7e82[_0x5c16('0x24')](_0x2f8958)['then'](function(_0xdaf462){return _0xdaf462;});}return null;};}function removeEntity(_0x14be18,_0x4c66ee){return function(_0x5d1a5c){if(_0x5d1a5c){return _0x5d1a5c[_0x5c16('0x25')]()[_0x5c16('0x26')](function(){_0x14be18[_0x5c16('0x1d')](0xcc)[_0x5c16('0x27')]();});}};}function handleEntityNotFound(_0x314835,_0xd4a64e){return function(_0x19972c){if(!_0x19972c){_0x314835[_0x5c16('0x1c')](0x194);}return _0x19972c;};}function handleError(_0x1605dd,_0x58b59d){_0x58b59d=_0x58b59d||0x1f4;return function(_0x13271e){logger[_0x5c16('0x28')](_0x13271e['stack']);if(_0x13271e['name']){delete _0x13271e['name'];}_0x1605dd[_0x5c16('0x1d')](_0x58b59d)[_0x5c16('0x29')](_0x13271e);};}exports[_0x5c16('0x2a')]=function(_0x209db5,_0x3d0a89){var _0x31a163={},_0x197302={},_0x54ba19={'count':0x0,'rows':[]};var _0xa3c1a0=_[_0x5c16('0x2b')](db[_0x5c16('0x2c')][_0x5c16('0x2d')],function(_0x4e8431){return{'name':_0x4e8431[_0x5c16('0x2e')],'type':_0x4e8431['type']['key']};});_0x197302['model']=_[_0x5c16('0x2b')](_0xa3c1a0,_0x5c16('0x2f'));_0x197302[_0x5c16('0x30')]=_[_0x5c16('0x31')](_0x209db5[_0x5c16('0x30')]);_0x197302[_0x5c16('0x32')]=_[_0x5c16('0x33')](_0x197302[_0x5c16('0x34')],_0x197302[_0x5c16('0x30')]);_0x31a163['attributes']=_[_0x5c16('0x33')](_0x197302[_0x5c16('0x34')],qs[_0x5c16('0x35')](_0x209db5[_0x5c16('0x30')][_0x5c16('0x35')]));_0x31a163[_0x5c16('0x36')]=_0x31a163[_0x5c16('0x36')][_0x5c16('0x37')]?_0x31a163[_0x5c16('0x36')]:_0x197302[_0x5c16('0x34')];if(!_0x209db5[_0x5c16('0x30')]['hasOwnProperty'](_0x5c16('0x38'))){_0x31a163[_0x5c16('0x20')]=qs[_0x5c16('0x20')](_0x209db5[_0x5c16('0x30')][_0x5c16('0x20')]);_0x31a163[_0x5c16('0x39')]=qs[_0x5c16('0x39')](_0x209db5[_0x5c16('0x30')][_0x5c16('0x39')]);}_0x31a163['order']=qs[_0x5c16('0x3a')](_0x209db5['query'][_0x5c16('0x3a')]);_0x31a163[_0x5c16('0x3b')]=qs[_0x5c16('0x32')](_['pick'](_0x209db5['query'],_0x197302[_0x5c16('0x32')]),_0xa3c1a0);if(_0x209db5[_0x5c16('0x30')][_0x5c16('0x3c')]){_0x31a163[_0x5c16('0x3b')]=_['merge'](_0x31a163[_0x5c16('0x3b')],{'$or':_[_0x5c16('0x2b')](_0xa3c1a0,function(_0x3dc982){if(_0x3dc982[_0x5c16('0x3d')]!==_0x5c16('0x3e')){var _0x4c13b2={};_0x4c13b2[_0x3dc982[_0x5c16('0x2f')]]={'$like':'%'+_0x209db5[_0x5c16('0x30')]['filter']+'%'};return _0x4c13b2;}})});}_0x31a163=_[_0x5c16('0x3f')]({},_0x31a163,_0x209db5[_0x5c16('0x40')]);var _0xa95318={'where':_0x31a163['where']};return db[_0x5c16('0x2c')][_0x5c16('0x1f')](_0xa95318)['then'](function(_0x20dd18){_0x54ba19['count']=_0x20dd18;if(_0x209db5[_0x5c16('0x30')][_0x5c16('0x41')]){_0x31a163['include']=[{'all':!![]}];}return db[_0x5c16('0x2c')][_0x5c16('0x42')](_0x31a163);})[_0x5c16('0x26')](function(_0x107243){_0x54ba19[_0x5c16('0x43')]=_0x107243;return _0x54ba19;})[_0x5c16('0x26')](respondWithFilteredResult(_0x3d0a89,_0x31a163))[_0x5c16('0x44')](handleError(_0x3d0a89,null));};exports[_0x5c16('0x45')]=function(_0x22d04b,_0xfc2753){var _0x1d5974={'raw':!![],'where':{'id':_0x22d04b[_0x5c16('0x46')]['id']}},_0x24b4e3={};_0x24b4e3[_0x5c16('0x34')]=_[_0x5c16('0x31')](db[_0x5c16('0x2c')][_0x5c16('0x2d')]);_0x24b4e3['query']=_[_0x5c16('0x31')](_0x22d04b['query']);_0x24b4e3[_0x5c16('0x32')]=_['intersection'](_0x24b4e3['model'],_0x24b4e3[_0x5c16('0x30')]);_0x1d5974['attributes']=_[_0x5c16('0x33')](_0x24b4e3[_0x5c16('0x34')],qs[_0x5c16('0x35')](_0x22d04b['query'][_0x5c16('0x35')]));_0x1d5974[_0x5c16('0x36')]=_0x1d5974[_0x5c16('0x36')]['length']?_0x1d5974['attributes']:_0x24b4e3['model'];if(_0x22d04b[_0x5c16('0x30')][_0x5c16('0x41')]){_0x1d5974[_0x5c16('0x47')]=[{'all':!![]}];}_0x1d5974=_[_0x5c16('0x3f')]({},_0x1d5974,_0x22d04b['options']);return db[_0x5c16('0x2c')]['find'](_0x1d5974)[_0x5c16('0x26')](handleEntityNotFound(_0xfc2753,null))['then'](respondWithResult(_0xfc2753,null))[_0x5c16('0x44')](handleError(_0xfc2753,null));};exports[_0x5c16('0x48')]=function(_0x1928a6,_0x5cb74a){return db[_0x5c16('0x2c')]['create'](_0x1928a6[_0x5c16('0x49')],{})[_0x5c16('0x26')](respondWithResult(_0x5cb74a,0xc9))[_0x5c16('0x44')](handleError(_0x5cb74a,null));};exports[_0x5c16('0x24')]=function(_0x2da113,_0x177d78){if(_0x2da113[_0x5c16('0x49')]['id']){delete _0x2da113[_0x5c16('0x49')]['id'];}return db[_0x5c16('0x2c')][_0x5c16('0x4a')]({'where':{'id':_0x2da113[_0x5c16('0x46')]['id']}})[_0x5c16('0x26')](handleEntityNotFound(_0x177d78,null))['then'](saveUpdates(_0x2da113['body'],null))['then'](respondWithResult(_0x177d78,null))[_0x5c16('0x44')](handleError(_0x177d78,null));};exports['destroy']=function(_0x88ae3d,_0xcbbccf){return db[_0x5c16('0x2c')][_0x5c16('0x4a')]({'where':{'id':_0x88ae3d[_0x5c16('0x46')]['id']}})[_0x5c16('0x26')](handleEntityNotFound(_0xcbbccf,null))[_0x5c16('0x26')](removeEntity(_0xcbbccf,null))[_0x5c16('0x44')](handleError(_0xcbbccf,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index fd2ae79..10ace41 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 _0x60ac=['../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','rimraf'];(function(_0x4c2f94,_0x233f5a){var _0x4a6122=function(_0x356cac){while(--_0x356cac){_0x4c2f94['push'](_0x4c2f94['shift']());}};_0x4a6122(++_0x233f5a);}(_0x60ac,0x187));var _0xc60a=function(_0x4933d5,_0x15a500){_0x4933d5=_0x4933d5-0x0;var _0x1feb0f=_0x60ac[_0x4933d5];return _0x1feb0f;};'use strict';var _=require('lodash');var util=require(_0xc60a('0x0'));var logger=require(_0xc60a('0x1'))(_0xc60a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc60a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc60a('0x4'));var config=require(_0xc60a('0x5'));var attributes=require(_0xc60a('0x6'));module[_0xc60a('0x7')]=function(_0xe77823,_0x4a3497){return _0xe77823[_0xc60a('0x8')](_0xc60a('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc60a('0xa'),'collate':_0xc60a('0xb')});}; \ No newline at end of file +var _0xe848=['../../config/logger','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash'];(function(_0x353e98,_0x185de1){var _0x28bc9b=function(_0x52d7f1){while(--_0x52d7f1){_0x353e98['push'](_0x353e98['shift']());}};_0x28bc9b(++_0x185de1);}(_0xe848,0x1c2));var _0x8e84=function(_0x671618,_0x4d04f8){_0x671618=_0x671618-0x0;var _0x5c5215=_0xe848[_0x671618];return _0x5c5215;};'use strict';var _=require(_0x8e84('0x0'));var util=require('util');var logger=require(_0x8e84('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8e84('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e84('0x3'));var rimraf=require(_0x8e84('0x4'));var config=require(_0x8e84('0x5'));var attributes=require(_0x8e84('0x6'));module['exports']=function(_0x316870,_0x132450){return _0x316870[_0x8e84('0x7')](_0x8e84('0x8'),attributes,{'tableName':_0x8e84('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8e84('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index cab9a9f..e5f7991 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 _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x460bdd,_0xde57aa){var _0x2eaaec=function(_0x45d19a){while(--_0x45d19a){_0x460bdd['push'](_0x460bdd['shift']());}};_0x2eaaec(++_0xde57aa);}(_0xb10b,0x12a));var _0xbb10=function(_0x528511,_0x815fd3){_0x528511=_0x528511-0x0;var _0xd1b2b7=_0xb10b[_0x528511];return _0xd1b2b7;};'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?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x2ab924,_0x54d9e4){var _0x531cd0=function(_0x544cde){while(--_0x544cde){_0x2ab924['push'](_0x2ab924['shift']());}};_0x531cd0(++_0x54d9e4);}(_0xb10b,0x12a));var _0xbb10=function(_0x34967e,_0x11f483){_0x34967e=_0x34967e-0x0;var _0x406971=_0xb10b[_0x34967e];return _0x406971;};'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?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 693145e..a123a07 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 _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file +var _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 44a7201..eead3df 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 _0xd7d0=['sequelize','exports','DATE','STRING','out'];(function(_0x4f3030,_0x4577a3){var _0x4be84f=function(_0x1a0229){while(--_0x1a0229){_0x4f3030['push'](_0x4f3030['shift']());}};_0x4be84f(++_0x4577a3);}(_0xd7d0,0x113));var _0x0d7d=function(_0x57862e,_0x2c787f){_0x57862e=_0x57862e-0x0;var _0x1f44ba=_0xd7d0[_0x57862e];return _0x1f44ba;};'use strict';var Sequelize=require(_0x0d7d('0x0'));module[_0x0d7d('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0d7d('0x2')]},'disposition':{'type':Sequelize[_0x0d7d('0x3')]},'secondDisposition':{'type':Sequelize[_0x0d7d('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0d7d('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x0d7d('0x3')]},'externalUrl':{'type':Sequelize[_0x0d7d('0x3')]},'lastMsgAt':{'type':Sequelize[_0x0d7d('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0d7d('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0d7d('0x3')]}}; \ No newline at end of file +var _0x2539=['DATE','STRING','out','sequelize','exports','BOOLEAN'];(function(_0x8f1b2d,_0x257a25){var _0xc43f4e=function(_0x28c8c8){while(--_0x28c8c8){_0x8f1b2d['push'](_0x8f1b2d['shift']());}};_0xc43f4e(++_0x257a25);}(_0x2539,0x147));var _0x9253=function(_0x381bff,_0x19d01f){_0x381bff=_0x381bff-0x0;var _0x201ab1=_0x2539[_0x381bff];return _0x201ab1;};'use strict';var Sequelize=require(_0x9253('0x0'));module[_0x9253('0x1')]={'closed':{'type':Sequelize[_0x9253('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9253('0x3')]},'disposition':{'type':Sequelize[_0x9253('0x4')]},'secondDisposition':{'type':Sequelize[_0x9253('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9253('0x4')]},'read1stAt':{'type':Sequelize[_0x9253('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x9253('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9253('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 3c1fa68..29d3e09 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 _0x018c=['redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','select','field','color','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','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_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','body','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','rows','params','includeAll','include','merge','options','create','describe','OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','pick','OpenchannelInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','count','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','root','files','join','format','CmContact','firstName','attachments','Attachment','OpenchannelAccount','Account','Owner','get','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','closed','closedAt','threadId','Public','Private','Messages','basename','existsSync','createWriteStream','direction','out','lastName','secret','renderFile','server','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x451bca,_0x5611a7){var _0x19ae63=function(_0x464ed9){while(--_0x464ed9){_0x451bca['push'](_0x451bca['shift']());}};_0x19ae63(++_0x5611a7);}(_0x018c,0xda));var _0xc018=function(_0x23d9c6,_0x24be67){_0x23d9c6=_0x23d9c6-0x0;var _0x2f34a8=_0x018c[_0x23d9c6];return _0x2f34a8;};'use strict';var pdf=require(_0xc018('0x0'));var emlformat=require(_0xc018('0x1'));var rimraf=require(_0xc018('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc018('0x3'));var moment=require('moment');var BPromise=require(_0xc018('0x4'));var Mustache=require(_0xc018('0x5'));var util=require(_0xc018('0x6'));var path=require(_0xc018('0x7'));var sox=require('sox');var csv=require(_0xc018('0x8'));var ejs=require(_0xc018('0x9'));var fs=require('fs');var fs_extra=require(_0xc018('0xa'));var _=require(_0xc018('0xb'));var squel=require(_0xc018('0xc'));var crypto=require(_0xc018('0xd'));var jsforce=require(_0xc018('0xe'));var deskjs=require(_0xc018('0xf'));var toCsv=require(_0xc018('0x8'));var querystring=require(_0xc018('0x10'));var Papa=require(_0xc018('0x11'));var Redis=require(_0xc018('0x12'));var authService=require(_0xc018('0x13'));var qs=require(_0xc018('0x14'));var as=require(_0xc018('0x15'));var hardwareService=require(_0xc018('0x16'));var logger=require(_0xc018('0x17'))(_0xc018('0x18'));var utils=require('../../config/utils');var config=require(_0xc018('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc018('0x1a'))['db'];config[_0xc018('0x1b')]=_[_0xc018('0x1c')](config[_0xc018('0x1b')],{'host':_0xc018('0x1d'),'port':0x18eb});var socket=require(_0xc018('0x1e'))(new Redis(config[_0xc018('0x1b')]));require(_0xc018('0x1f'))[_0xc018('0x20')](socket);function respondWithStatusCode(_0x380bbd,_0x30d6cb){_0x30d6cb=_0x30d6cb||0xcc;return function(_0x5d0ae3){if(_0x5d0ae3){return _0x380bbd[_0xc018('0x21')](_0x30d6cb);}return _0x380bbd[_0xc018('0x22')](_0x30d6cb)[_0xc018('0x23')]();};}function respondWithResult(_0x3a07f8,_0x70a0fd){_0x70a0fd=_0x70a0fd||0xc8;return function(_0x3f023f){if(_0x3f023f){return _0x3a07f8[_0xc018('0x22')](_0x70a0fd)[_0xc018('0x24')](_0x3f023f);}};}function respondWithFilteredResult(_0x550652,_0x5f2c11){return function(_0xe5f2fe){if(_0xe5f2fe){var _0x4e388e=_0xe5f2fe['count'],_0x994233=_0x5f2c11[_0xc018('0x25')],_0x41a22d=_0x5f2c11[_0xc018('0x25')]+_0x5f2c11[_0xc018('0x26')],_0x141afc;if(_0x41a22d>=_0x4e388e){_0x41a22d=_0x4e388e;_0x141afc=0xc8;}else{_0x141afc=0xce;}_0x550652['status'](_0x141afc);return _0x550652[_0xc018('0x27')](_0xc018('0x28'),_0x994233+'-'+_0x41a22d+'/'+_0x4e388e)[_0xc018('0x24')](_0xe5f2fe);}return null;};}function patchUpdates(_0x428a57){return function(_0x5dd6d9){try{jsonpatch[_0xc018('0x29')](_0x5dd6d9,_0x428a57,!![]);}catch(_0x30e7a6){return BPromise[_0xc018('0x2a')](_0x30e7a6);}return _0x5dd6d9[_0xc018('0x2b')]();};}function saveUpdates(_0x2576b8,_0xcd7583){return function(_0x117346){if(_0x117346){return _0x117346[_0xc018('0x2c')](_0x2576b8)[_0xc018('0x2d')](function(_0x41b7da){return _0x41b7da;});}return null;};}function removeEntity(_0x208521,_0x37e6d4){return function(_0x847da8){if(_0x847da8){return _0x847da8[_0xc018('0x2e')]()[_0xc018('0x2d')](function(){_0x208521['status'](0xcc)[_0xc018('0x23')]();});}};}function handleEntityNotFound(_0x83a279,_0x195f7e){return function(_0x331a0d){if(!_0x331a0d){_0x83a279['sendStatus'](0x194);}return _0x331a0d;};}function handleError(_0xde5fb6,_0x46fd6a){_0x46fd6a=_0x46fd6a||0x1f4;return function(_0x2dc832){logger['error'](_0x2dc832['stack']);if(_0x2dc832[_0xc018('0x2f')]){delete _0x2dc832[_0xc018('0x2f')];}_0xde5fb6['status'](_0x46fd6a)['send'](_0x2dc832);};}function getInteractionUsers(_0x1a631c,_0x31373c){return new BPromise(function(_0x31fcdc,_0x5092a3){try{if(_0x31373c[_0x1a631c['id']]){_0x1a631c[_0xc018('0x30')]=_[_0xc018('0x31')](_0x31373c[_0x1a631c['id']],function(_0x11c53e){return{'id':_0x11c53e['id'],'fullname':_0x11c53e[_0xc018('0x32')]};});}}catch(_0x34ea58){_0x5092a3(_0x34ea58);}_0x31fcdc(_0x1a631c);});}function getInteractionTags(_0x34fdf4,_0x1f8cfd){return new BPromise(function(_0x24b2fb,_0x2259ff){try{if(_0x34fdf4[_0xc018('0x33')]){_0x34fdf4[_0xc018('0x34')]=[];_0x34fdf4[_0xc018('0x33')][_0xc018('0x35')](',')[_0xc018('0x36')](function(_0x513a59){_0x34fdf4[_0xc018('0x34')][_0xc018('0x37')](_0x1f8cfd[_0x513a59]);});}delete _0x34fdf4[_0xc018('0x33')];}catch(_0xb92560){_0x2259ff(_0xb92560);}_0x24b2fb(_0x34fdf4);});}function updateOpenchannelInteraction(_0x438176,_0x2da4ab,_0x4625d5){return new BPromise(function(_0x275316,_0x3f9696){return getInteractionUsers(_0x438176,_0x4625d5)[_0xc018('0x2d')](function(_0x3c8357){return getInteractionTags(_0x3c8357,_0x2da4ab);})[_0xc018('0x2d')](function(_0x1a7d13){_0x275316(_0x1a7d13);})[_0xc018('0x38')](function(_0x5b04c6){_0x3f9696(_0x5b04c6);});});}exports[_0xc018('0x39')]=function(_0x2bab06,_0x1b47cb){var _0x41f3af={},_0x3d1929={},_0x199ccc={'count':0x0,'rows':[]};var _0x23227c=_[_0xc018('0x31')](db[_0xc018('0x3a')][_0xc018('0x3b')],function(_0x44388e){return{'name':_0x44388e[_0xc018('0x3c')],'type':_0x44388e['type'][_0xc018('0x3d')]};});_0x3d1929[_0xc018('0x3e')]=_[_0xc018('0x31')](_0x23227c,_0xc018('0x2f'));_0x3d1929[_0xc018('0x3f')]=_[_0xc018('0x40')](_0x2bab06[_0xc018('0x3f')]);_0x3d1929[_0xc018('0x41')]=_[_0xc018('0x42')](_0x3d1929[_0xc018('0x3e')],_0x3d1929[_0xc018('0x3f')]);_0x41f3af[_0xc018('0x43')]=_[_0xc018('0x42')](_0x3d1929[_0xc018('0x3e')],qs['fields'](_0x2bab06['query']['fields']));_0x41f3af[_0xc018('0x43')]=_0x41f3af[_0xc018('0x43')][_0xc018('0x44')]?_0x41f3af['attributes']:_0x3d1929[_0xc018('0x3e')];if(!_0x2bab06[_0xc018('0x3f')][_0xc018('0x45')]('nolimit')){_0x41f3af[_0xc018('0x26')]=qs[_0xc018('0x26')](_0x2bab06['query'][_0xc018('0x26')]);_0x41f3af['offset']=qs[_0xc018('0x25')](_0x2bab06[_0xc018('0x3f')][_0xc018('0x25')]);}_0x41f3af[_0xc018('0x46')]=qs[_0xc018('0x47')](_0x2bab06[_0xc018('0x3f')][_0xc018('0x47')]);_0x41f3af[_0xc018('0x48')]=qs['filters'](_['pick'](_0x2bab06[_0xc018('0x3f')],_0x3d1929[_0xc018('0x41')]),_0x23227c);var _0x3680e3=[];var _0x50f8c1=squel[_0xc018('0x49')]()[_0xc018('0x4a')]('id')['field'](_0xc018('0x2f'))[_0xc018('0x4a')](_0xc018('0x4b'))[_0xc018('0x4c')](_0xc018('0x4d'));var _0x111851=squel[_0xc018('0x49')]()['field']('u.id')[_0xc018('0x4a')](_0xc018('0x4e'))['field'](_0xc018('0x4f'))[_0xc018('0x4c')](_0xc018('0x50'),'ui')['left_join'](_0xc018('0x51'),'u',_0xc018('0x52'));var _0x4fa11c=squel[_0xc018('0x49')]()[_0xc018('0x4c')](_0xc018('0x53'),'i')[_0xc018('0x54')](_0xc018('0x55'),'c',_0xc018('0x56'))['left_join'](_0xc018('0x51'),'o',_0xc018('0x57'))[_0xc018('0x54')](_0xc018('0x58'),'a','a.id\x20=\x20i.OpenchannelAccountId')['left_join']('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0xc018('0x59'),'it',_0xc018('0x5a'))[_0xc018('0x54')](_0xc018('0x4d'),'t',_0xc018('0x5b'));var _0x4eefc7=squel['expr']();var _0x4edd5f=[];var _0x132dde=squel[_0xc018('0x5c')]();var _0x3eef49;if(_0x2bab06[_0xc018('0x3f')][_0xc018('0x5d')]){_0x3eef49=as['parseSearch'](_0x2bab06[_0xc018('0x3f')][_0xc018('0x5d')]);var _0x28532e=_0x3eef49[_0xc018('0x5e')];for(var _0x252b60=0x0;_0x252b60<_0x3eef49[_0xc018('0x5f')][_0xc018('0x44')];_0x252b60++){var _0x45aedb=_0x3eef49['conditions'][_0x252b60];var _0x4cc6b4='i';var _0x8063f5=_[_0xc018('0x60')](_0x23227c,[_0xc018('0x2f'),_0x45aedb[_0xc018('0x4a')]]);if(!_0x8063f5){switch(_0x45aedb['field']){case'unreadMessages':if(_0x45aedb[_0xc018('0x61')]==0x1){_0x4fa11c[_0xc018('0x62')]('`'+_0x45aedb[_0xc018('0x4a')]+_0xc018('0x63'));}else{_0x4fa11c['having']('`'+_0x45aedb[_0xc018('0x4a')]+_0xc018('0x64'));}break;case _0xc018('0x65'):if(_0x45aedb[_0xc018('0x66')]==='$substring'){if(_0x45aedb[_0xc018('0x61')][_0xc018('0x35')]('\x20')[_0xc018('0x44')]>0x1){_0x4eefc7[_0x28532e](_0xc018('0x67'),qs[_0xc018('0x68')](_0x45aedb[_0xc018('0x61')]),null);}else{var _0x8e488d='%'+_0x45aedb[_0xc018('0x61')]+'%';_0x4eefc7[_0x28532e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x8e488d,_0x8e488d,_0x8e488d);}}else{_0x8063f5=_[_0xc018('0x60')](_0x23227c,['name',_0xc018('0x69')]);_0x45aedb[_0xc018('0x4a')]=_0xc018('0x69');_0x47062e=as[_0xc018('0x6a')](_0x4cc6b4,_0x8063f5[_0xc018('0x6b')],_0x45aedb);_0x4eefc7[_0x28532e](_0x47062e[_0xc018('0x6c')],_0x47062e[_0xc018('0x61')][_0xc018('0x6d')],_0x47062e['value'][_0xc018('0x23')]);}break;case _0xc018('0x6e'):var _0x390e9b=_0x45aedb['value']['split'](',')[_0xc018('0x31')](function(_0x132de3){return Number(_0x132de3);});_0x390e9b[_0xc018('0x36')](function(_0xe68edd){_0x132dde['or'](_0xc018('0x6f'),'%,'+_0xe68edd+',%');});_0x4edd5f=_[_0xc018('0x70')](_0x4edd5f,_0x390e9b);break;case _0xc018('0x71'):if(_0x45aedb['operator']===_0xc018('0x72')){_0x4eefc7[_0x28532e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x45aedb[_0xc018('0x61')]+'%',null);}else{_0x8063f5=_[_0xc018('0x60')](_0x23227c,[_0xc018('0x2f'),_0xc018('0x73')]);_0x45aedb[_0xc018('0x4a')]=_0xc018('0x73');_0x47062e=as[_0xc018('0x6a')](_0x4cc6b4,_0x8063f5[_0xc018('0x6b')],_0x45aedb);_0x4eefc7[_0x28532e](_0x47062e[_0xc018('0x6c')],_0x47062e[_0xc018('0x61')]['start'],_0x47062e['value']['end']);}break;case _0xc018('0x74'):_0x47062e=as[_0xc018('0x6a')]('me',null,_0x45aedb);_0x4eefc7[_0x28532e](_0x47062e[_0xc018('0x6c')],_0x47062e[_0xc018('0x61')][_0xc018('0x6d')],_0x47062e[_0xc018('0x61')][_0xc018('0x23')]);break;}}else{var _0x47062e=as[_0xc018('0x6a')](_0x4cc6b4,_0x8063f5[_0xc018('0x6b')],_0x45aedb);_0x4eefc7[_0x28532e](_0x47062e[_0xc018('0x6c')],_0x47062e[_0xc018('0x61')][_0xc018('0x6d')],_0x47062e[_0xc018('0x61')][_0xc018('0x23')]);}}}else{var _0x3d74bd=_(_0x2bab06['query'])[_0xc018('0x40')]()[_0xc018('0x31')](function(_0x17497a){return _[_0xc018('0x75')](_0x23227c,[_0xc018('0x2f'),_0x17497a])?_0x17497a:undefined;})[_0xc018('0x76')]()[_0xc018('0x61')]();if(!_['isEmpty'](_0x3d74bd)){_0x3d74bd[_0xc018('0x36')](function(_0x251172){if(_0x251172===_0xc018('0x77')){_0x4fa11c[_0xc018('0x48')](_0xc018('0x78'),[][_0xc018('0x79')](_0x2bab06['query'][_0x251172]));}else if(_0x251172===_0xc018('0x7a')){var _0x49f4eb=JSON[_0xc018('0x7b')](_0x2bab06['query'][_0x251172])['$gte'];var _0x410188=JSON['parse'](_0x2bab06[_0xc018('0x3f')][_0x251172])['$lte'];_0x4fa11c[_0xc018('0x48')](_0xc018('0x7c'),_0x49f4eb,_0x410188);}else{if(_0x2bab06[_0xc018('0x3f')][_0x251172]===_0xc018('0x7d')){_0x4fa11c[_0xc018('0x48')]('i.'+_0x251172+'\x20IS\x20NULL');}else{_0x4fa11c['where']('i.'+_0x251172+_0xc018('0x7e'),_0x2bab06[_0xc018('0x3f')][_0x251172]);}}});}if(_0x2bab06[_0xc018('0x3f')][_0xc018('0x7f')]){if(_0x2bab06[_0xc018('0x3f')]['read']==0x1){_0x4fa11c['having'](_0xc018('0x80'));}else{_0x4fa11c['having'](_0xc018('0x81'));}}if(_0x2bab06['query'][_0xc018('0x82')]){_0x4edd5f=_[_0xc018('0x83')](_0x2bab06[_0xc018('0x3f')][_0xc018('0x82')])?_0x2bab06[_0xc018('0x3f')]['tag']:new Array(_0x2bab06[_0xc018('0x3f')]['tag']);_0x4edd5f[_0xc018('0x36')](function(_0x12ba42){_0x132dde['or'](_0xc018('0x6f'),'%,'+_0x12ba42+',%');});}if(_0x2bab06[_0xc018('0x3f')]['filter']){var _0x5b294a=_0x2bab06[_0xc018('0x3f')]['filter'][_0xc018('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5b294a)){_0x4eefc7['or'](_0xc018('0x85'),_0x5b294a+'%');}else{_0x4eefc7['or'](_0xc018('0x86'),qs[_0xc018('0x68')](_0x5b294a))['or'](_0xc018('0x87'),_0x5b294a+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5b294a+'%');}}}_0x4fa11c[_0xc018('0x48')](_0x4eefc7);_0x4fa11c[_0xc018('0x88')](_0xc018('0x89'));var _0x2b2706={'type':db[_0xc018('0x8a')]['QueryTypes'][_0xc018('0x8b')],'raw':!![]};var _0x17fe65=_0x4fa11c[_0xc018('0x8c')]();_0x17fe65['field'](_0xc018('0x89'));_0x17fe65[_0xc018('0x4a')](_0xc018('0x8d'),'unreadMessages');if(_0x41f3af[_0xc018('0x46')]){_0x41f3af[_0xc018('0x46')][_0xc018('0x36')](function(_0xd942b2){var _0x2507a5=_0xd942b2[0x0]===_0xc018('0x8e')?_0xd942b2[0x0]:'i.'+_0xd942b2[0x0];_0x4fa11c[_0xc018('0x46')](_0x2507a5,_0xd942b2[0x1]===_0xc018('0x8f')?![]:!![]);});}if(!_[_0xc018('0x90')](_0x4edd5f)){_0x4fa11c[_0xc018('0x62')](_0x132dde);_0x17fe65['where'](_0xc018('0x91'),_0x4edd5f);}BPromise[_0xc018('0x92')]()['then'](function(){if(!_0x3eef49){if(_0x2bab06[_0xc018('0x3f')][_0xc018('0x77')])return;_0x17fe65[_0xc018('0x48')](_0xc018('0x93'));_0x4fa11c[_0xc018('0x48')](_0xc018('0x93'));return;}if(_0x2bab06[_0xc018('0x94')][_0xc018('0x95')]!=='agent')return;return _0x2bab06[_0xc018('0x94')][_0xc018('0x96')]({'attributes':['id'],'raw':!![]})[_0xc018('0x2d')](function(_0x2db97e){if(_[_0xc018('0x90')](_0x2db97e)){_0x17fe65[_0xc018('0x48')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x4fa11c[_0xc018('0x48')](_0xc018('0x97'));}else{_0x17fe65[_0xc018('0x48')](_0xc018('0x78'),_[_0xc018('0x31')](_0x2db97e,'id'));_0x4fa11c[_0xc018('0x48')](_0xc018('0x78'),_['map'](_0x2db97e,'id'));}});})[_0xc018('0x2d')](function(){if(_0x2bab06[_0xc018('0x94')]['role']==='agent'&&!_0x3eef49&&!_0x2bab06[_0xc018('0x3f')]['OpenchannelAccountId'])return[];return db[_0xc018('0x98')][_0xc018('0x3f')](_0x17fe65[_0xc018('0x99')](),_0x2b2706);})[_0xc018('0x2d')](function(_0x51fbc5){_0x199ccc['count']=_0x51fbc5[_0xc018('0x44')];if(_0x199ccc['count']===0x0)return[];return db['sequelize'][_0xc018('0x3f')](_0x50f8c1[_0xc018('0x99')](),_0x2b2706)['then'](function(_0x198703){_0x3680e3=_[_0xc018('0x9a')](_0x198703,'id');_0x2b2706=_['merge'](_0x2b2706,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2bab06[_0xc018('0x3f')][_0xc018('0x9b')]){_0x41f3af[_0xc018('0x43')][_0xc018('0x36')](function(_0x517b6f){_0x4fa11c['field']('i.'+_0x517b6f);});}else{_0x4fa11c[_0xc018('0x4a')](_0xc018('0x8d'),'unreadMessages');_0x4fa11c['field'](_0xc018('0x9c'),'Account.key');_0x4fa11c['field'](_0xc018('0x9d'),_0xc018('0x9e'));_0x4fa11c[_0xc018('0x4a')](_0xc018('0x9f'),'contactName');_0x4fa11c['field'](_0xc018('0xa0'));_0x4fa11c['field']('c.firstName',_0xc018('0xa1'));_0x4fa11c[_0xc018('0x4a')]('c.lastName',_0xc018('0xa2'));_0x4fa11c['field'](_0xc018('0xa3'),'Contact.email');_0x4fa11c[_0xc018('0x4a')](_0xc018('0xa4'),_0xc018('0xa5'));_0x4fa11c[_0xc018('0x4a')](_0xc018('0xa6'),_0xc018('0xa7'));_0x4fa11c['field'](_0xc018('0xa8'),_0xc018('0xa9'));_0x4fa11c[_0xc018('0x4a')]('o.fullname',_0xc018('0xaa'));_0x4fa11c[_0xc018('0x4a')](_0xc018('0xab'),_0xc018('0xac'));_0x4fa11c['field'](_0xc018('0xad'),_0xc018('0x33'));}if(_0x41f3af[_0xc018('0x26')])_0x4fa11c[_0xc018('0x26')](_0x41f3af[_0xc018('0x26')]);if(_0x41f3af[_0xc018('0x25')])_0x4fa11c['offset'](_0x41f3af[_0xc018('0x25')]);return db[_0xc018('0x98')][_0xc018('0x3f')](_0x4fa11c['toString'](),_0x2b2706);})[_0xc018('0x2d')](function(_0x35f4ed){_0x111851[_0xc018('0x48')](_0xc018('0xae'),_[_0xc018('0x31')](_0x35f4ed,'id'));return db[_0xc018('0x98')][_0xc018('0x3f')](_0x111851[_0xc018('0x99')](),_0x2b2706)['then'](function(_0x180e67){var _0x146758=_[_0xc018('0xaf')](_0x180e67,'OpenchannelInteractionId');var _0x38b7dc=[];_0x35f4ed[_0xc018('0x36')](function(_0x157145){_0x38b7dc['push'](updateOpenchannelInteraction(_0x157145,_0x3680e3,_0x146758));});return BPromise[_0xc018('0xb0')](_0x38b7dc);});});})[_0xc018('0x2d')](function(_0x1b2807){_0x199ccc[_0xc018('0xb1')]=_0x1b2807;return _0x199ccc;})[_0xc018('0x2d')](respondWithFilteredResult(_0x1b47cb,_0x41f3af))['catch'](handleError(_0x1b47cb,null));};exports['show']=function(_0x2d3e2d,_0x61f989){var _0x365063={};if(_0x2d3e2d['query']['type']&&_0x2d3e2d['query'][_0xc018('0x6b')]===_0xc018('0x4c')){_0x365063[_0xc018('0x4c')]=_0x2d3e2d[_0xc018('0xb2')]['id'];}else{_0x365063['id']=_0x2d3e2d['params']['id'];}var _0x53d7d1={'raw':![],'where':_0x365063},_0x1308af={};_0x1308af[_0xc018('0x3e')]=_[_0xc018('0x40')](db['OpenchannelInteraction'][_0xc018('0x3b')]);_0x1308af['query']=_[_0xc018('0x40')](_0x2d3e2d[_0xc018('0x3f')]);_0x1308af[_0xc018('0x41')]=_[_0xc018('0x42')](_0x1308af[_0xc018('0x3e')],_0x1308af[_0xc018('0x3f')]);_0x53d7d1['attributes']=_[_0xc018('0x42')](_0x1308af[_0xc018('0x3e')],qs[_0xc018('0x9b')](_0x2d3e2d[_0xc018('0x3f')]['fields']));_0x53d7d1[_0xc018('0x43')]=_0x53d7d1['attributes'][_0xc018('0x44')]?_0x53d7d1['attributes']:_0x1308af[_0xc018('0x3e')];if(_0x2d3e2d[_0xc018('0x3f')][_0xc018('0xb3')]){_0x53d7d1[_0xc018('0xb4')]=[{'all':!![]}];}_0x53d7d1=_[_0xc018('0xb5')]({},_0x53d7d1,_0x2d3e2d[_0xc018('0xb6')]);return db[_0xc018('0x3a')][_0xc018('0x60')](_0x53d7d1)[_0xc018('0x2d')](handleEntityNotFound(_0x61f989,null))[_0xc018('0x2d')](respondWithResult(_0x61f989,null))[_0xc018('0x38')](handleError(_0x61f989,null));};exports['create']=function(_0x5b3351,_0x1ea055){return db[_0xc018('0x3a')][_0xc018('0xb7')](_0x5b3351[_0xc018('0x74')],{})[_0xc018('0x2d')](respondWithResult(_0x1ea055,0xc9))['catch'](handleError(_0x1ea055,null));};exports[_0xc018('0x2c')]=function(_0x2afcb3,_0x45bc8f){if(_0x2afcb3[_0xc018('0x74')]['id']){delete _0x2afcb3[_0xc018('0x74')]['id'];}return db[_0xc018('0x3a')][_0xc018('0x60')]({'where':{'id':_0x2afcb3[_0xc018('0xb2')]['id']}})[_0xc018('0x2d')](handleEntityNotFound(_0x45bc8f,null))['then'](saveUpdates(_0x2afcb3[_0xc018('0x74')],null))['then'](respondWithResult(_0x45bc8f,null))[_0xc018('0x38')](handleError(_0x45bc8f,null));};exports['destroy']=function(_0x187cca,_0x54f6dd){return db['OpenchannelInteraction'][_0xc018('0x60')]({'where':{'id':_0x187cca[_0xc018('0xb2')]['id']}})[_0xc018('0x2d')](handleEntityNotFound(_0x54f6dd,null))[_0xc018('0x2d')](removeEntity(_0x54f6dd,null))['catch'](handleError(_0x54f6dd,null));};exports[_0xc018('0xb8')]=function(_0x12b801,_0x3742ce){return db[_0xc018('0x3a')][_0xc018('0xb8')]()['then'](respondWithResult(_0x3742ce,null))[_0xc018('0x38')](handleError(_0x3742ce,null));};exports['addMessage']=function(_0x15babc,_0x449787,_0x5edb2a){return db[_0xc018('0xb9')][_0xc018('0x60')]({'where':{'id':_0x15babc['params']['id']}})[_0xc018('0x2d')](handleEntityNotFound(_0x449787,null))[_0xc018('0x2d')](function(_0x5db1a9){if(_0x5db1a9){return _0x5db1a9['addMessage'](_0x15babc['body'][_0xc018('0xba')],_[_0xc018('0xbb')](_0x15babc[_0xc018('0x74')],[_0xc018('0xba'),'id'])||{});}})[_0xc018('0x2d')](respondWithResult(_0x449787,null))[_0xc018('0x38')](handleError(_0x449787,null));};exports[_0xc018('0xbc')]=function(_0x559589,_0x560acc,_0x548d38){var _0x1453a9={'raw':![],'where':{}};var _0x2671ca={};var _0x492139={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xc018('0xbd')]({'where':{'id':_0x559589[_0xc018('0xb2')]['id']}})[_0xc018('0x2d')](handleEntityNotFound(_0x560acc,null))[_0xc018('0x2d')](function(_0x253754){if(_0x253754){_0x2671ca[_0xc018('0x3e')]=_[_0xc018('0x40')](db[_0xc018('0xb9')][_0xc018('0x3b')]);_0x2671ca[_0xc018('0x3f')]=_[_0xc018('0x40')](_0x559589[_0xc018('0x3f')]);_0x2671ca[_0xc018('0x41')]=_[_0xc018('0x42')](_0x2671ca[_0xc018('0x3e')],_0x2671ca['query']);_0x1453a9[_0xc018('0x43')]=_['intersection'](_0x2671ca['model'],qs[_0xc018('0x9b')](_0x559589['query'][_0xc018('0x9b')]));_0x1453a9[_0xc018('0x43')]=_0x1453a9['attributes'][_0xc018('0x44')]?_0x1453a9[_0xc018('0x43')]:_0x2671ca['model'];if(!_0x559589[_0xc018('0x3f')][_0xc018('0x45')](_0xc018('0xbe'))){_0x1453a9[_0xc018('0x26')]=qs[_0xc018('0x26')](_0x559589[_0xc018('0x3f')][_0xc018('0x26')]);_0x1453a9[_0xc018('0x25')]=qs[_0xc018('0x25')](_0x559589[_0xc018('0x3f')][_0xc018('0x25')]);}_0x1453a9[_0xc018('0x46')]=qs['sort'](_0x559589['query'][_0xc018('0x47')]);_0x1453a9[_0xc018('0x48')]=qs['filters'](_[_0xc018('0xbf')](_0x559589['query'],_0x2671ca[_0xc018('0x41')]));_0x1453a9[_0xc018('0x48')][_0xc018('0xc0')]=_0x253754['id'];if(_0x559589['query'][_0xc018('0xc1')]){_0x1453a9[_0xc018('0x48')]=_[_0xc018('0xb5')](_0x1453a9[_0xc018('0x48')],{'$or':_['map'](_0x1453a9[_0xc018('0x43')],function(_0x29d920){var _0x409a38={};_0x409a38[_0x29d920]={'$like':'%'+_0x559589[_0xc018('0x3f')]['filter']+'%'};return _0x409a38;})});}if(_0x559589[_0xc018('0x3f')][_0xc018('0xc2')]){var _0x2be0b2=_0x559589['query'][_0xc018('0xc2')][_0xc018('0x35')](',');var _0x20e240={};_0x20e240[_0x2be0b2[0x0]]={'$gte':moment(_0x2be0b2[0x1])['format'](_0xc018('0xc3'))};_0x1453a9[_0xc018('0x48')]=_['merge'](_0x1453a9[_0xc018('0x48')],_0x20e240);}_0x1453a9=_[_0xc018('0xb5')]({},_0x1453a9,_0x559589[_0xc018('0xb6')]);return db['OpenchannelMessage'][_0xc018('0xc4')]({'where':_0x1453a9[_0xc018('0x48')]})[_0xc018('0x2d')](function(_0x12a3ee){_0x492139['count']=_0x12a3ee;if(_0x559589[_0xc018('0x3f')][_0xc018('0xb3')]){_0x1453a9['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc018('0xc5')](_0x1453a9);})[_0xc018('0x2d')](function(_0x5f543f){_0x492139[_0xc018('0xb1')]=_0x5f543f;return _0x492139;});}})[_0xc018('0x2d')](respondWithFilteredResult(_0x560acc,_0x1453a9))[_0xc018('0x38')](handleError(_0x560acc,null));};exports[_0xc018('0xc6')]=function(_0x318667,_0x3df27f,_0x259e5b){return db['OpenchannelInteraction'][_0xc018('0x60')]({'where':{'id':_0x318667[_0xc018('0xb2')]['id']}})[_0xc018('0x2d')](handleEntityNotFound(_0x3df27f,null))[_0xc018('0x2d')](function(_0x60eca4){if(_0x60eca4){return _0x60eca4[_0xc018('0xc7')](_0x318667['body']['ids'],_['omit'](_0x318667[_0xc018('0x74')],[_0xc018('0xba'),'id'])||{})[_0xc018('0xc8')](function(){return db[_0xc018('0x6e')][_0xc018('0xc5')]({'attributes':['id',_0xc018('0x2f'),_0xc018('0x4b')],'where':{'id':_0x318667['body'][_0xc018('0xba')]}});})[_0xc018('0x2d')](function(_0x26eb87){socket[_0xc018('0xc9')](_0xc018('0xca'),{'id':Number(_0x318667[_0xc018('0xb2')]['id']),'tags':_0x26eb87||[]});return{'id':Number(_0x318667[_0xc018('0xb2')]['id']),'tags':_0x26eb87||[]};});}})[_0xc018('0x2d')](respondWithResult(_0x3df27f,null))[_0xc018('0x38')](handleError(_0x3df27f,null));};exports['removeTags']=function(_0x599c66,_0x3d30ba,_0x426b09){return db[_0xc018('0x3a')][_0xc018('0x60')]({'where':{'id':_0x599c66[_0xc018('0xb2')]['id']}})[_0xc018('0x2d')](handleEntityNotFound(_0x3d30ba,null))[_0xc018('0x2d')](function(_0x32b162){if(_0x32b162){return _0x32b162[_0xc018('0xcb')](_0x599c66[_0xc018('0x3f')][_0xc018('0xba')]);}})[_0xc018('0x2d')](respondWithStatusCode(_0x3d30ba,null))[_0xc018('0x38')](handleError(_0x3d30ba,null));};exports[_0xc018('0xcc')]=function(_0x4123c5,_0x345ca5){var _0x2d2748=moment()['unix']()['toString']();var _0x2e1567=path['join'](config[_0xc018('0xcd')],'server',_0xc018('0xce'),'tmp');var _0x357091=path[_0xc018('0xcf')](config['root'],'server',_0xc018('0xce'),'attachments');var _0x26a7af=path[_0xc018('0xcf')](_0x2e1567,_0x2d2748);var _0x19e76d=util[_0xc018('0xd0')]('transcript-%d-%s.zip',_0x4123c5[_0xc018('0xb2')]['id'],_0x2d2748);var _0xc2412d=path[_0xc018('0xcf')](_0x2e1567,_0x19e76d);var _0x194bc5=[];_0x194bc5['push']({'model':db[_0xc018('0x71')],'as':'User','attributes':['id',_0xc018('0x32')],'raw':!![]});_0x194bc5[_0xc018('0x37')]({'model':db[_0xc018('0xd1')],'as':_0xc018('0x65'),'attributes':['id',_0xc018('0xd2'),'lastName'],'raw':!![]});if(_0x4123c5['query'][_0xc018('0xd3')]){_0x194bc5[_0xc018('0x37')]({'model':db['Attachment'],'as':_0xc018('0xd4'),'raw':!![]});}var _0x6b1c2c=[{'model':db[_0xc018('0xb9')],'as':'Messages','attributes':['id',_0xc018('0x74'),_0xc018('0x7a'),'direction','secret',_0xc018('0x7f')],'include':_0x194bc5}];_0x6b1c2c['push']({'model':db[_0xc018('0xd5')],'as':_0xc018('0xd6'),'attributes':['id',_0xc018('0x2f')]});_0x6b1c2c[_0xc018('0x37')]({'model':db[_0xc018('0x71')],'as':_0xc018('0xd7'),'attributes':['id',_0xc018('0x32')]});return db[_0xc018('0x3a')][_0xc018('0x60')]({'where':{'id':_0x4123c5[_0xc018('0xb2')]['id']},'include':_0x6b1c2c})[_0xc018('0x2d')](handleEntityNotFound(_0x345ca5,null))[_0xc018('0x2d')](function(_0x32c041){if(_0x32c041){var _0x2ddeaa=_0x32c041[_0xc018('0xd8')]({'plain':!![]});fs['mkdirSync'](_0x26a7af);var _0x1e82e9={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0xc018('0xd9')}},'footer':{'height':_0xc018('0xda'),'contents':{'default':util[_0xc018('0xd0')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xc018('0xd0')](_0xc018('0xdb'),_0xc018('0xdc'),_0x2ddeaa['id']),moment()[_0xc018('0xd0')](_0xc018('0xdd'))[_0xc018('0x99')]())}}};var _0x1066d0={'channel':_0xc018('0xdc'),'account':_0x2ddeaa[_0xc018('0xd6')]['name'],'agent':_0x2ddeaa['Owner']?_0x2ddeaa[_0xc018('0xd7')][_0xc018('0x32')]:_0xc018('0xde'),'createdAt':moment(_0x2ddeaa[_0xc018('0x7a')])[_0xc018('0xd0')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc018('0x99')](),'closedAt':_0x2ddeaa[_0xc018('0xdf')]?moment(_0x2ddeaa[_0xc018('0xe0')])['format'](_0xc018('0xc3'))[_0xc018('0x99')]():'','disposition':_0x2ddeaa['disposition'],'visibility':_0x2ddeaa[_0xc018('0xe1')]?_0xc018('0xe2'):_0xc018('0xe3'),'messages':_(_0x2ddeaa[_0xc018('0xe4')])[_0xc018('0xc1')]({'secret':![]})[_0xc018('0x31')](function(_0x4024de){if(_0x4024de[_0xc018('0xd4')]){var _0x2c7560=path[_0xc018('0xcf')](_0x357091,_0x4024de[_0xc018('0xd4')][_0xc018('0xe5')]);if(fs[_0xc018('0xe6')](_0x2c7560)){fs['createReadStream'](_0x2c7560)['pipe'](fs[_0xc018('0xe7')](path[_0xc018('0xcf')](_0x26a7af,_0x4024de['Attachment'][_0xc018('0xe5')])));}}return{'date':moment(_0x4024de['createdAt'])[_0xc018('0xd0')](_0xc018('0xc3'))[_0xc018('0x99')](),'sender':_0x4024de[_0xc018('0xe8')]===_0xc018('0xe9')?_0x4024de[_0xc018('0x71')]?_0x4024de[_0xc018('0x71')][_0xc018('0x32')]:'System':_0x4024de[_0xc018('0x65')][_0xc018('0xd2')]+(_0x4024de[_0xc018('0x65')]['lastName']?'\x20'+_0x4024de[_0xc018('0x65')][_0xc018('0xea')]:''),'body':_0x4024de[_0xc018('0xd4')]?_0x4024de[_0xc018('0xd4')][_0xc018('0xe5')]:_0x4024de['body'],'direction':_0x4024de[_0xc018('0xe8')]==='out'?'A':'C','secret':_0x4024de[_0xc018('0xeb')],'read':_0x4024de['read'],'attachment':_0x4024de[_0xc018('0xd4')]};})[_0xc018('0x61')]()};return ejs[_0xc018('0xec')](path[_0xc018('0xcf')](config[_0xc018('0xcd')],_0xc018('0xed'),_0xc018('0xee'),_0xc018('0xef')),{'interaction':_0x1066d0})['then'](function(_0x5043bd){return new BPromise(function(_0x230738,_0x3d3249){pdf[_0xc018('0xb7')](_0x5043bd,_0x1e82e9)[_0xc018('0xf0')](path[_0xc018('0xcf')](_0x26a7af,_0xc018('0xf1')+_0x2ddeaa['id']+'-'+_0x2d2748+_0xc018('0xf2')),function(_0x26cb22,_0x3682a5){if(_0x26cb22)return _0x3d3249(_0x26cb22);_0x230738(_0x3682a5);});});})['then'](function(){return new BPromise(function(_0x1b3c4f,_0x7dff31){zipdir(_0x26a7af,{'saveTo':_0xc2412d},function(_0x4b2fd0,_0x3d1deb){if(_0x4b2fd0)return _0x7dff31(_0x4b2fd0);return _0x1b3c4f(_0x3d1deb);});})[_0xc018('0x2d')](function(){return new BPromise(function(_0x68bee9,_0x5466ae){rimraf(_0x26a7af,function(_0xd286a6){if(_0xd286a6)_0x5466ae(_0xd286a6);return _0x68bee9();});});})[_0xc018('0x2d')](function(){return _0x345ca5[_0xc018('0xcc')](_0xc2412d,_0x19e76d,function(_0x380ad7){if(_0x380ad7){console[_0xc018('0xf3')]('err',_0x380ad7);}else{fs[_0xc018('0xf4')](_0xc2412d);}});});});}else{return _0x345ca5[_0xc018('0x21')](0xc8);}})[_0xc018('0x38')](handleError(_0x345ca5,null));}; \ No newline at end of file +var _0x714b=['\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','include','create','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','emit','removeTags','download','unix','join','root','server','files','attachments','fullname','CmContact','firstName','Attachment','Messages','OpenchannelAccount','Account','Owner','get','mkdirSync','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','N.A.','closedAt','Private','basename','existsSync','createReadStream','pipe','createWriteStream','direction','System','lastName','out','secret','downloadInteraction.html','toFile','.pdf','log','err','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','keys','filters','intersection','attributes','fields','query','length','model','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL'];(function(_0x2a87c0,_0x3bad1b){var _0x5ae795=function(_0x8a1b80){while(--_0x8a1b80){_0x2a87c0['push'](_0x2a87c0['shift']());}};_0x5ae795(++_0x3bad1b);}(_0x714b,0x72));var _0xb714=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x714b[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xb714('0x0'));var emlformat=require(_0xb714('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb714('0x2'));var moment=require(_0xb714('0x3'));var BPromise=require(_0xb714('0x4'));var Mustache=require(_0xb714('0x5'));var util=require(_0xb714('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb714('0x7'));var fs=require('fs');var fs_extra=require(_0xb714('0x8'));var _=require(_0xb714('0x9'));var squel=require(_0xb714('0xa'));var crypto=require(_0xb714('0xb'));var jsforce=require(_0xb714('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb714('0xd'));var querystring=require(_0xb714('0xe'));var Papa=require(_0xb714('0xf'));var Redis=require(_0xb714('0x10'));var authService=require(_0xb714('0x11'));var qs=require(_0xb714('0x12'));var as=require(_0xb714('0x13'));var hardwareService=require(_0xb714('0x14'));var logger=require(_0xb714('0x15'))(_0xb714('0x16'));var utils=require(_0xb714('0x17'));var config=require(_0xb714('0x18'));var licenseUtil=require(_0xb714('0x19'));var db=require(_0xb714('0x1a'))['db'];config[_0xb714('0x1b')]=_[_0xb714('0x1c')](config[_0xb714('0x1b')],{'host':_0xb714('0x1d'),'port':0x18eb});var socket=require(_0xb714('0x1e'))(new Redis(config[_0xb714('0x1b')]));require(_0xb714('0x1f'))[_0xb714('0x20')](socket);function respondWithStatusCode(_0x2cb970,_0x1eee98){_0x1eee98=_0x1eee98||0xcc;return function(_0x23ce87){if(_0x23ce87){return _0x2cb970[_0xb714('0x21')](_0x1eee98);}return _0x2cb970[_0xb714('0x22')](_0x1eee98)['end']();};}function respondWithResult(_0x53a9ca,_0x41ee1f){_0x41ee1f=_0x41ee1f||0xc8;return function(_0x915ad1){if(_0x915ad1){return _0x53a9ca[_0xb714('0x22')](_0x41ee1f)[_0xb714('0x23')](_0x915ad1);}};}function respondWithFilteredResult(_0x4b964f,_0x1fbbb9){return function(_0x3dbe37){if(_0x3dbe37){var _0x363b35=_0x3dbe37[_0xb714('0x24')],_0x419f52=_0x1fbbb9[_0xb714('0x25')],_0x3fce58=_0x1fbbb9[_0xb714('0x25')]+_0x1fbbb9[_0xb714('0x26')],_0x5cd8d8;if(_0x3fce58>=_0x363b35){_0x3fce58=_0x363b35;_0x5cd8d8=0xc8;}else{_0x5cd8d8=0xce;}_0x4b964f['status'](_0x5cd8d8);return _0x4b964f[_0xb714('0x27')](_0xb714('0x28'),_0x419f52+'-'+_0x3fce58+'/'+_0x363b35)[_0xb714('0x23')](_0x3dbe37);}return null;};}function patchUpdates(_0x1ff9c1){return function(_0x537ee3){try{jsonpatch[_0xb714('0x29')](_0x537ee3,_0x1ff9c1,!![]);}catch(_0xc881f2){return BPromise['reject'](_0xc881f2);}return _0x537ee3[_0xb714('0x2a')]();};}function saveUpdates(_0x1e4d5d,_0x3d0aa7){return function(_0x503361){if(_0x503361){return _0x503361[_0xb714('0x2b')](_0x1e4d5d)[_0xb714('0x2c')](function(_0x53b558){return _0x53b558;});}return null;};}function removeEntity(_0x4da954,_0x2e7c79){return function(_0x36a374){if(_0x36a374){return _0x36a374[_0xb714('0x2d')]()[_0xb714('0x2c')](function(){_0x4da954[_0xb714('0x22')](0xcc)[_0xb714('0x2e')]();});}};}function handleEntityNotFound(_0x5a9f44,_0x37e26c){return function(_0x5ec0fd){if(!_0x5ec0fd){_0x5a9f44[_0xb714('0x21')](0x194);}return _0x5ec0fd;};}function handleError(_0xa368bb,_0x5d18d5){_0x5d18d5=_0x5d18d5||0x1f4;return function(_0x1e0c34){logger[_0xb714('0x2f')](_0x1e0c34['stack']);if(_0x1e0c34[_0xb714('0x30')]){delete _0x1e0c34[_0xb714('0x30')];}_0xa368bb[_0xb714('0x22')](_0x5d18d5)[_0xb714('0x31')](_0x1e0c34);};}function getInteractionUsers(_0x24f7a8,_0x1d47ec){return new BPromise(function(_0x50c1ee,_0x572231){try{if(_0x1d47ec[_0x24f7a8['id']]){_0x24f7a8[_0xb714('0x32')]=_[_0xb714('0x33')](_0x1d47ec[_0x24f7a8['id']],function(_0x176ecc){return{'id':_0x176ecc['id'],'fullname':_0x176ecc['fullname']};});}}catch(_0x19c5e7){_0x572231(_0x19c5e7);}_0x50c1ee(_0x24f7a8);});}function getInteractionTags(_0x8d2473,_0x430273){return new BPromise(function(_0x1c9dd7,_0x4002c2){try{if(_0x8d2473[_0xb714('0x34')]){_0x8d2473[_0xb714('0x35')]=[];_0x8d2473['TagIds'][_0xb714('0x36')](',')[_0xb714('0x37')](function(_0x4f0d13){_0x8d2473[_0xb714('0x35')][_0xb714('0x38')](_0x430273[_0x4f0d13]);});}delete _0x8d2473[_0xb714('0x34')];}catch(_0x1a490c){_0x4002c2(_0x1a490c);}_0x1c9dd7(_0x8d2473);});}function updateOpenchannelInteraction(_0x46ac8f,_0xbc53b8,_0x5b5a88){return new BPromise(function(_0x15317f,_0x3bd4db){return getInteractionUsers(_0x46ac8f,_0x5b5a88)['then'](function(_0xe97e1f){return getInteractionTags(_0xe97e1f,_0xbc53b8);})[_0xb714('0x2c')](function(_0x186756){_0x15317f(_0x186756);})[_0xb714('0x39')](function(_0x3e1b39){_0x3bd4db(_0x3e1b39);});});}exports[_0xb714('0x3a')]=function(_0x40d764,_0x424230){var _0x520a01={},_0x5f4ba1={},_0x4c8c07={'count':0x0,'rows':[]};var _0x1f26ed=_[_0xb714('0x33')](db[_0xb714('0x3b')][_0xb714('0x3c')],function(_0x447e89){return{'name':_0x447e89[_0xb714('0x3d')],'type':_0x447e89[_0xb714('0x3e')][_0xb714('0x3f')]};});_0x5f4ba1['model']=_[_0xb714('0x33')](_0x1f26ed,_0xb714('0x30'));_0x5f4ba1['query']=_[_0xb714('0x40')](_0x40d764['query']);_0x5f4ba1[_0xb714('0x41')]=_[_0xb714('0x42')](_0x5f4ba1['model'],_0x5f4ba1['query']);_0x520a01[_0xb714('0x43')]=_[_0xb714('0x42')](_0x5f4ba1['model'],qs[_0xb714('0x44')](_0x40d764[_0xb714('0x45')][_0xb714('0x44')]));_0x520a01[_0xb714('0x43')]=_0x520a01[_0xb714('0x43')][_0xb714('0x46')]?_0x520a01[_0xb714('0x43')]:_0x5f4ba1[_0xb714('0x47')];if(!_0x40d764[_0xb714('0x45')][_0xb714('0x48')](_0xb714('0x49'))){_0x520a01[_0xb714('0x26')]=qs[_0xb714('0x26')](_0x40d764[_0xb714('0x45')][_0xb714('0x26')]);_0x520a01['offset']=qs[_0xb714('0x25')](_0x40d764[_0xb714('0x45')][_0xb714('0x25')]);}_0x520a01[_0xb714('0x4a')]=qs[_0xb714('0x4b')](_0x40d764[_0xb714('0x45')][_0xb714('0x4b')]);_0x520a01[_0xb714('0x4c')]=qs[_0xb714('0x41')](_[_0xb714('0x4d')](_0x40d764[_0xb714('0x45')],_0x5f4ba1[_0xb714('0x41')]),_0x1f26ed);var _0x5492eb=[];var _0x28f795=squel[_0xb714('0x4e')]()[_0xb714('0x4f')]('id')['field'](_0xb714('0x30'))[_0xb714('0x4f')](_0xb714('0x50'))[_0xb714('0x51')](_0xb714('0x52'));var _0x5adc13=squel[_0xb714('0x4e')]()[_0xb714('0x4f')](_0xb714('0x53'))['field']('u.fullname')[_0xb714('0x4f')]('ui.OpenchannelInteractionId')['from'](_0xb714('0x54'),'ui')[_0xb714('0x55')](_0xb714('0x56'),'u',_0xb714('0x57'));var _0x391ed6=squel[_0xb714('0x4e')]()[_0xb714('0x51')](_0xb714('0x58'),'i')[_0xb714('0x55')](_0xb714('0x59'),'c',_0xb714('0x5a'))['left_join']('users','o','o.id\x20=\x20i.UserId')['left_join'](_0xb714('0x5b'),'a',_0xb714('0x5c'))['left_join']('openchannel_messages','me',_0xb714('0x5d'))[_0xb714('0x55')](_0xb714('0x5e'),'it',_0xb714('0x5f'))[_0xb714('0x55')](_0xb714('0x52'),'t',_0xb714('0x60'));var _0x180e6d=squel[_0xb714('0x61')]();var _0x5777af=[];var _0x4f75f5=squel[_0xb714('0x61')]();var _0x5d48c1;if(_0x40d764[_0xb714('0x45')][_0xb714('0x62')]){_0x5d48c1=as[_0xb714('0x63')](_0x40d764[_0xb714('0x45')][_0xb714('0x62')]);var _0x2d4dcd=_0x5d48c1[_0xb714('0x64')];for(var _0x21d852=0x0;_0x21d852<_0x5d48c1['conditions'][_0xb714('0x46')];_0x21d852++){var _0x515d0c=_0x5d48c1[_0xb714('0x65')][_0x21d852];var _0x2c0b3e='i';var _0x11653f=_['find'](_0x1f26ed,[_0xb714('0x30'),_0x515d0c[_0xb714('0x4f')]]);if(!_0x11653f){switch(_0x515d0c[_0xb714('0x4f')]){case _0xb714('0x66'):if(_0x515d0c['value']==0x1){_0x391ed6[_0xb714('0x67')]('`'+_0x515d0c[_0xb714('0x4f')]+_0xb714('0x68'));}else{_0x391ed6[_0xb714('0x67')]('`'+_0x515d0c['field']+'`\x20>\x200');}break;case _0xb714('0x69'):if(_0x515d0c[_0xb714('0x6a')]==='$substring'){if(_0x515d0c[_0xb714('0x6b')][_0xb714('0x36')]('\x20')['length']>0x1){_0x180e6d[_0x2d4dcd](_0xb714('0x6c'),qs[_0xb714('0x6d')](_0x515d0c[_0xb714('0x6b')]),null);}else{var _0x2ea540='%'+_0x515d0c[_0xb714('0x6b')]+'%';_0x180e6d[_0x2d4dcd](_0xb714('0x6e'),_0x2ea540,_0x2ea540,_0x2ea540);}}else{_0x11653f=_[_0xb714('0x6f')](_0x1f26ed,[_0xb714('0x30'),_0xb714('0x70')]);_0x515d0c[_0xb714('0x4f')]='ContactId';_0x360f5a=as[_0xb714('0x71')](_0x2c0b3e,_0x11653f[_0xb714('0x3e')],_0x515d0c);_0x180e6d[_0x2d4dcd](_0x360f5a['text'],_0x360f5a[_0xb714('0x6b')][_0xb714('0x72')],_0x360f5a[_0xb714('0x6b')][_0xb714('0x2e')]);}break;case _0xb714('0x73'):var _0x3e116f=_0x515d0c[_0xb714('0x6b')][_0xb714('0x36')](',')[_0xb714('0x33')](function(_0x18ac48){return Number(_0x18ac48);});_0x3e116f[_0xb714('0x37')](function(_0x10d83c){_0x4f75f5['or'](_0xb714('0x74'),'%,'+_0x10d83c+',%');});_0x5777af=_[_0xb714('0x75')](_0x5777af,_0x3e116f);break;case _0xb714('0x76'):if(_0x515d0c[_0xb714('0x6a')]===_0xb714('0x77')){_0x180e6d[_0x2d4dcd](_0xb714('0x78'),'%'+_0x515d0c[_0xb714('0x6b')]+'%',null);}else{_0x11653f=_[_0xb714('0x6f')](_0x1f26ed,[_0xb714('0x30'),_0xb714('0x79')]);_0x515d0c[_0xb714('0x4f')]=_0xb714('0x79');_0x360f5a=as[_0xb714('0x71')](_0x2c0b3e,_0x11653f[_0xb714('0x3e')],_0x515d0c);_0x180e6d[_0x2d4dcd](_0x360f5a[_0xb714('0x7a')],_0x360f5a[_0xb714('0x6b')][_0xb714('0x72')],_0x360f5a['value'][_0xb714('0x2e')]);}break;case _0xb714('0x7b'):_0x360f5a=as[_0xb714('0x71')]('me',null,_0x515d0c);_0x180e6d[_0x2d4dcd](_0x360f5a[_0xb714('0x7a')],_0x360f5a[_0xb714('0x6b')][_0xb714('0x72')],_0x360f5a[_0xb714('0x6b')]['end']);break;}}else{var _0x360f5a=as[_0xb714('0x71')](_0x2c0b3e,_0x11653f[_0xb714('0x3e')],_0x515d0c);_0x180e6d[_0x2d4dcd](_0x360f5a[_0xb714('0x7a')],_0x360f5a[_0xb714('0x6b')]['start'],_0x360f5a[_0xb714('0x6b')][_0xb714('0x2e')]);}}}else{var _0x2492e1=_(_0x40d764[_0xb714('0x45')])[_0xb714('0x40')]()[_0xb714('0x33')](function(_0x23f50a){return _['some'](_0x1f26ed,[_0xb714('0x30'),_0x23f50a])?_0x23f50a:undefined;})[_0xb714('0x7c')]()[_0xb714('0x6b')]();if(!_[_0xb714('0x7d')](_0x2492e1)){_0x2492e1[_0xb714('0x37')](function(_0x5be8a5){if(_0x5be8a5===_0xb714('0x7e')){_0x391ed6['where'](_0xb714('0x7f'),[][_0xb714('0x80')](_0x40d764[_0xb714('0x45')][_0x5be8a5]));}else if(_0x5be8a5===_0xb714('0x81')){var _0x377719=JSON[_0xb714('0x82')](_0x40d764[_0xb714('0x45')][_0x5be8a5])[_0xb714('0x83')];var _0x7b42d8=JSON[_0xb714('0x82')](_0x40d764[_0xb714('0x45')][_0x5be8a5])[_0xb714('0x84')];_0x391ed6[_0xb714('0x4c')](_0xb714('0x85'),_0x377719,_0x7b42d8);}else{if(_0x40d764[_0xb714('0x45')][_0x5be8a5]==='null'){_0x391ed6[_0xb714('0x4c')]('i.'+_0x5be8a5+_0xb714('0x86'));}else{_0x391ed6[_0xb714('0x4c')]('i.'+_0x5be8a5+_0xb714('0x87'),_0x40d764['query'][_0x5be8a5]);}}});}if(_0x40d764[_0xb714('0x45')][_0xb714('0x88')]){if(_0x40d764['query']['read']==0x1){_0x391ed6[_0xb714('0x67')](_0xb714('0x89'));}else{_0x391ed6[_0xb714('0x67')](_0xb714('0x8a'));}}if(_0x40d764['query'][_0xb714('0x8b')]){_0x5777af=_[_0xb714('0x8c')](_0x40d764[_0xb714('0x45')][_0xb714('0x8b')])?_0x40d764[_0xb714('0x45')][_0xb714('0x8b')]:new Array(_0x40d764[_0xb714('0x45')][_0xb714('0x8b')]);_0x5777af['forEach'](function(_0x50eba3){_0x4f75f5['or'](_0xb714('0x74'),'%,'+_0x50eba3+',%');});}if(_0x40d764['query'][_0xb714('0x8d')]){var _0x52dbfa=_0x40d764[_0xb714('0x45')][_0xb714('0x8d')]['replace']('\x5c','\x5c\x5c')[_0xb714('0x8e')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x52dbfa)){_0x180e6d['or']('i.id\x20LIKE\x20?',_0x52dbfa+'%');}else{_0x180e6d['or'](_0xb714('0x8f'),qs[_0xb714('0x6d')](_0x52dbfa))['or'](_0xb714('0x90'),_0x52dbfa+'%')['or'](_0xb714('0x91'),_0x52dbfa+'%');}}}_0x391ed6['where'](_0x180e6d);_0x391ed6[_0xb714('0x92')](_0xb714('0x93'));var _0x4505b1={'type':db[_0xb714('0x94')][_0xb714('0x95')]['SELECT'],'raw':!![]};var _0x511e77=_0x391ed6[_0xb714('0x96')]();_0x511e77[_0xb714('0x4f')](_0xb714('0x93'));_0x511e77[_0xb714('0x4f')](_0xb714('0x97'),'unreadMessages');if(_0x520a01[_0xb714('0x4a')]){_0x520a01[_0xb714('0x4a')][_0xb714('0x37')](function(_0x25497b){var _0x439174=_0x25497b[0x0]==='contactName'?_0x25497b[0x0]:'i.'+_0x25497b[0x0];_0x391ed6['order'](_0x439174,_0x25497b[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x5777af)){_0x391ed6['having'](_0x4f75f5);_0x511e77['where'](_0xb714('0x98'),_0x5777af);}BPromise[_0xb714('0x99')]()[_0xb714('0x2c')](function(){if(!_0x5d48c1){if(_0x40d764['query']['OpenchannelAccountId'])return;_0x511e77[_0xb714('0x4c')](_0xb714('0x9a'));_0x391ed6[_0xb714('0x4c')](_0xb714('0x9a'));return;}if(_0x40d764[_0xb714('0x9b')][_0xb714('0x9c')]!==_0xb714('0x9d'))return;return _0x40d764[_0xb714('0x9b')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xb714('0x2c')](function(_0x10cbfb){if(_['isEmpty'](_0x10cbfb)){_0x511e77[_0xb714('0x4c')](_0xb714('0x9e'));_0x391ed6['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x511e77['where']('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x10cbfb,'id'));_0x391ed6[_0xb714('0x4c')](_0xb714('0x7f'),_[_0xb714('0x33')](_0x10cbfb,'id'));}});})[_0xb714('0x2c')](function(){if(_0x40d764[_0xb714('0x9b')][_0xb714('0x9c')]===_0xb714('0x9d')&&!_0x5d48c1&&!_0x40d764[_0xb714('0x45')][_0xb714('0x7e')])return[];return db[_0xb714('0x9f')][_0xb714('0x45')](_0x511e77['toString'](),_0x4505b1);})['then'](function(_0x51f4f0){_0x4c8c07['count']=_0x51f4f0[_0xb714('0x46')];if(_0x4c8c07[_0xb714('0x24')]===0x0)return[];return db[_0xb714('0x9f')][_0xb714('0x45')](_0x28f795[_0xb714('0xa0')](),_0x4505b1)[_0xb714('0x2c')](function(_0x1f1cb){_0x5492eb=_[_0xb714('0xa1')](_0x1f1cb,'id');_0x4505b1=_[_0xb714('0xa2')](_0x4505b1,{'model':db[_0xb714('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40d764['query'][_0xb714('0x44')]){_0x520a01[_0xb714('0x43')]['forEach'](function(_0x5beed5){_0x391ed6[_0xb714('0x4f')]('i.'+_0x5beed5);});}else{_0x391ed6['field'](_0xb714('0x97'),_0xb714('0x66'));_0x391ed6['field']('a.key',_0xb714('0xa3'));_0x391ed6[_0xb714('0x4f')](_0xb714('0xa4'),'Account.mandatoryDisposition');_0x391ed6['field'](_0xb714('0xa5'),_0xb714('0xa6'));_0x391ed6[_0xb714('0x4f')](_0xb714('0xa7'));_0x391ed6[_0xb714('0x4f')](_0xb714('0xa8'),_0xb714('0xa9'));_0x391ed6['field'](_0xb714('0xaa'),_0xb714('0xab'));_0x391ed6[_0xb714('0x4f')](_0xb714('0xac'),_0xb714('0xad'));_0x391ed6[_0xb714('0x4f')](_0xb714('0xae'),_0xb714('0xaf'));_0x391ed6[_0xb714('0x4f')](_0xb714('0xb0'),_0xb714('0xb1'));_0x391ed6['field']('c.fax',_0xb714('0xb2'));_0x391ed6[_0xb714('0x4f')](_0xb714('0xb3'),_0xb714('0xb4'));_0x391ed6['field'](_0xb714('0xb5'),_0xb714('0xb6'));_0x391ed6[_0xb714('0x4f')](_0xb714('0xb7'),_0xb714('0x34'));}if(_0x520a01[_0xb714('0x26')])_0x391ed6['limit'](_0x520a01['limit']);if(_0x520a01[_0xb714('0x25')])_0x391ed6[_0xb714('0x25')](_0x520a01[_0xb714('0x25')]);return db['sequelize'][_0xb714('0x45')](_0x391ed6[_0xb714('0xa0')](),_0x4505b1);})[_0xb714('0x2c')](function(_0x267e9a){_0x5adc13[_0xb714('0x4c')](_0xb714('0xb8'),_['map'](_0x267e9a,'id'));return db['sequelize'][_0xb714('0x45')](_0x5adc13[_0xb714('0xa0')](),_0x4505b1)[_0xb714('0x2c')](function(_0x11a647){var _0x590c23=_[_0xb714('0xb9')](_0x11a647,_0xb714('0xba'));var _0x2b96f4=[];_0x267e9a[_0xb714('0x37')](function(_0x59a801){_0x2b96f4['push'](updateOpenchannelInteraction(_0x59a801,_0x5492eb,_0x590c23));});return BPromise[_0xb714('0xbb')](_0x2b96f4);});});})[_0xb714('0x2c')](function(_0x2ca51f){_0x4c8c07[_0xb714('0xbc')]=_0x2ca51f;return _0x4c8c07;})[_0xb714('0x2c')](respondWithFilteredResult(_0x424230,_0x520a01))[_0xb714('0x39')](handleError(_0x424230,null));};exports[_0xb714('0xbd')]=function(_0xef308b,_0x208dc0){var _0x2c22b7={};if(_0xef308b[_0xb714('0x45')]['type']&&_0xef308b[_0xb714('0x45')][_0xb714('0x3e')]==='from'){_0x2c22b7[_0xb714('0x51')]=_0xef308b[_0xb714('0xbe')]['id'];}else{_0x2c22b7['id']=_0xef308b['params']['id'];}var _0x374878={'raw':![],'where':_0x2c22b7},_0x25359b={};_0x25359b[_0xb714('0x47')]=_[_0xb714('0x40')](db[_0xb714('0x3b')][_0xb714('0x3c')]);_0x25359b['query']=_['keys'](_0xef308b[_0xb714('0x45')]);_0x25359b[_0xb714('0x41')]=_['intersection'](_0x25359b[_0xb714('0x47')],_0x25359b[_0xb714('0x45')]);_0x374878['attributes']=_[_0xb714('0x42')](_0x25359b['model'],qs[_0xb714('0x44')](_0xef308b['query']['fields']));_0x374878[_0xb714('0x43')]=_0x374878['attributes'][_0xb714('0x46')]?_0x374878['attributes']:_0x25359b[_0xb714('0x47')];if(_0xef308b[_0xb714('0x45')][_0xb714('0xbf')]){_0x374878[_0xb714('0xc0')]=[{'all':!![]}];}_0x374878=_['merge']({},_0x374878,_0xef308b['options']);return db[_0xb714('0x3b')][_0xb714('0x6f')](_0x374878)[_0xb714('0x2c')](handleEntityNotFound(_0x208dc0,null))[_0xb714('0x2c')](respondWithResult(_0x208dc0,null))[_0xb714('0x39')](handleError(_0x208dc0,null));};exports[_0xb714('0xc1')]=function(_0x19faa1,_0xbd4de2){return db[_0xb714('0x3b')][_0xb714('0xc1')](_0x19faa1[_0xb714('0x7b')],{})[_0xb714('0x2c')](respondWithResult(_0xbd4de2,0xc9))[_0xb714('0x39')](handleError(_0xbd4de2,null));};exports['update']=function(_0x16886e,_0x3bf93f){if(_0x16886e[_0xb714('0x7b')]['id']){delete _0x16886e['body']['id'];}return db[_0xb714('0x3b')][_0xb714('0x6f')]({'where':{'id':_0x16886e[_0xb714('0xbe')]['id']}})[_0xb714('0x2c')](handleEntityNotFound(_0x3bf93f,null))[_0xb714('0x2c')](saveUpdates(_0x16886e['body'],null))['then'](respondWithResult(_0x3bf93f,null))[_0xb714('0x39')](handleError(_0x3bf93f,null));};exports['destroy']=function(_0x583163,_0x38c59a){return db[_0xb714('0x3b')][_0xb714('0x6f')]({'where':{'id':_0x583163[_0xb714('0xbe')]['id']}})[_0xb714('0x2c')](handleEntityNotFound(_0x38c59a,null))[_0xb714('0x2c')](removeEntity(_0x38c59a,null))[_0xb714('0x39')](handleError(_0x38c59a,null));};exports['describe']=function(_0x2172ac,_0x4e0f0d){return db[_0xb714('0x3b')][_0xb714('0xc2')]()[_0xb714('0x2c')](respondWithResult(_0x4e0f0d,null))['catch'](handleError(_0x4e0f0d,null));};exports[_0xb714('0xc3')]=function(_0x315eb7,_0x3f19f9,_0x1526de){return db['OpenchannelMessage'][_0xb714('0x6f')]({'where':{'id':_0x315eb7[_0xb714('0xbe')]['id']}})[_0xb714('0x2c')](handleEntityNotFound(_0x3f19f9,null))[_0xb714('0x2c')](function(_0xa8e84b){if(_0xa8e84b){return _0xa8e84b[_0xb714('0xc3')](_0x315eb7[_0xb714('0x7b')][_0xb714('0xc4')],_[_0xb714('0xc5')](_0x315eb7[_0xb714('0x7b')],[_0xb714('0xc4'),'id'])||{});}})['then'](respondWithResult(_0x3f19f9,null))[_0xb714('0x39')](handleError(_0x3f19f9,null));};exports[_0xb714('0xc6')]=function(_0x18e7c7,_0x2c0b85,_0x829dac){var _0x2876de={'raw':![],'where':{}};var _0x2f9e38={};var _0x4a1bb6={'count':0x0,'rows':[]};return db[_0xb714('0x3b')][_0xb714('0xc7')]({'where':{'id':_0x18e7c7[_0xb714('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2c0b85,null))[_0xb714('0x2c')](function(_0x4de833){if(_0x4de833){_0x2f9e38[_0xb714('0x47')]=_[_0xb714('0x40')](db[_0xb714('0xc8')][_0xb714('0x3c')]);_0x2f9e38[_0xb714('0x45')]=_[_0xb714('0x40')](_0x18e7c7['query']);_0x2f9e38[_0xb714('0x41')]=_[_0xb714('0x42')](_0x2f9e38[_0xb714('0x47')],_0x2f9e38[_0xb714('0x45')]);_0x2876de[_0xb714('0x43')]=_[_0xb714('0x42')](_0x2f9e38[_0xb714('0x47')],qs['fields'](_0x18e7c7[_0xb714('0x45')]['fields']));_0x2876de[_0xb714('0x43')]=_0x2876de[_0xb714('0x43')][_0xb714('0x46')]?_0x2876de['attributes']:_0x2f9e38['model'];if(!_0x18e7c7['query'][_0xb714('0x48')](_0xb714('0x49'))){_0x2876de[_0xb714('0x26')]=qs['limit'](_0x18e7c7[_0xb714('0x45')]['limit']);_0x2876de[_0xb714('0x25')]=qs[_0xb714('0x25')](_0x18e7c7[_0xb714('0x45')][_0xb714('0x25')]);}_0x2876de['order']=qs[_0xb714('0x4b')](_0x18e7c7['query'][_0xb714('0x4b')]);_0x2876de[_0xb714('0x4c')]=qs[_0xb714('0x41')](_[_0xb714('0x4d')](_0x18e7c7[_0xb714('0x45')],_0x2f9e38[_0xb714('0x41')]));_0x2876de[_0xb714('0x4c')][_0xb714('0xba')]=_0x4de833['id'];if(_0x18e7c7[_0xb714('0x45')][_0xb714('0x8d')]){_0x2876de['where']=_['merge'](_0x2876de[_0xb714('0x4c')],{'$or':_[_0xb714('0x33')](_0x2876de[_0xb714('0x43')],function(_0x5a622b){var _0x5995c0={};_0x5995c0[_0x5a622b]={'$like':'%'+_0x18e7c7[_0xb714('0x45')][_0xb714('0x8d')]+'%'};return _0x5995c0;})});}if(_0x18e7c7[_0xb714('0x45')][_0xb714('0x83')]){var _0x23dd83=_0x18e7c7[_0xb714('0x45')][_0xb714('0x83')][_0xb714('0x36')](',');var _0x569210={};_0x569210[_0x23dd83[0x0]]={'$gte':moment(_0x23dd83[0x1])[_0xb714('0xc9')](_0xb714('0xca'))};_0x2876de['where']=_[_0xb714('0xa2')](_0x2876de['where'],_0x569210);}_0x2876de=_[_0xb714('0xa2')]({},_0x2876de,_0x18e7c7[_0xb714('0xcb')]);return db['OpenchannelMessage'][_0xb714('0x24')]({'where':_0x2876de[_0xb714('0x4c')]})[_0xb714('0x2c')](function(_0x588708){_0x4a1bb6['count']=_0x588708;if(_0x18e7c7[_0xb714('0x45')][_0xb714('0xbf')]){_0x2876de[_0xb714('0xc0')]=[{'all':!![]}];}return db[_0xb714('0xc8')][_0xb714('0xcc')](_0x2876de);})['then'](function(_0x55e37f){_0x4a1bb6['rows']=_0x55e37f;return _0x4a1bb6;});}})['then'](respondWithFilteredResult(_0x2c0b85,_0x2876de))[_0xb714('0x39')](handleError(_0x2c0b85,null));};exports[_0xb714('0xcd')]=function(_0x6ada19,_0x8de8fc,_0x26924a){return db[_0xb714('0x3b')]['find']({'where':{'id':_0x6ada19[_0xb714('0xbe')]['id']}})['then'](handleEntityNotFound(_0x8de8fc,null))['then'](function(_0x320d1c){if(_0x320d1c){return _0x320d1c[_0xb714('0xce')](_0x6ada19['body'][_0xb714('0xc4')],_[_0xb714('0xc5')](_0x6ada19['body'],[_0xb714('0xc4'),'id'])||{})[_0xb714('0xcf')](function(){return db[_0xb714('0x73')][_0xb714('0xcc')]({'attributes':['id',_0xb714('0x30'),_0xb714('0x50')],'where':{'id':_0x6ada19[_0xb714('0x7b')][_0xb714('0xc4')]}});})['then'](function(_0x2c1c78){socket[_0xb714('0xd0')]('openchannelInteractionTags:save',{'id':Number(_0x6ada19[_0xb714('0xbe')]['id']),'tags':_0x2c1c78||[]});return{'id':Number(_0x6ada19[_0xb714('0xbe')]['id']),'tags':_0x2c1c78||[]};});}})[_0xb714('0x2c')](respondWithResult(_0x8de8fc,null))[_0xb714('0x39')](handleError(_0x8de8fc,null));};exports[_0xb714('0xd1')]=function(_0x25dcd6,_0x521b24,_0x2d7b11){return db['OpenchannelInteraction'][_0xb714('0x6f')]({'where':{'id':_0x25dcd6[_0xb714('0xbe')]['id']}})[_0xb714('0x2c')](handleEntityNotFound(_0x521b24,null))['then'](function(_0xdde8bd){if(_0xdde8bd){return _0xdde8bd[_0xb714('0xd1')](_0x25dcd6['query'][_0xb714('0xc4')]);}})[_0xb714('0x2c')](respondWithStatusCode(_0x521b24,null))[_0xb714('0x39')](handleError(_0x521b24,null));};exports[_0xb714('0xd2')]=function(_0x5241c8,_0x38c0da){var _0x5862fa=moment()[_0xb714('0xd3')]()[_0xb714('0xa0')]();var _0x167082=path[_0xb714('0xd4')](config[_0xb714('0xd5')],_0xb714('0xd6'),'files','tmp');var _0x15aa36=path[_0xb714('0xd4')](config[_0xb714('0xd5')],_0xb714('0xd6'),_0xb714('0xd7'),_0xb714('0xd8'));var _0xfddb71=path['join'](_0x167082,_0x5862fa);var _0x211ea6=util[_0xb714('0xc9')]('transcript-%d-%s.zip',_0x5241c8[_0xb714('0xbe')]['id'],_0x5862fa);var _0x46377a=path[_0xb714('0xd4')](_0x167082,_0x211ea6);var _0x5a1cab=[];_0x5a1cab[_0xb714('0x38')]({'model':db['User'],'as':_0xb714('0x76'),'attributes':['id',_0xb714('0xd9')],'raw':!![]});_0x5a1cab[_0xb714('0x38')]({'model':db[_0xb714('0xda')],'as':_0xb714('0x69'),'attributes':['id',_0xb714('0xdb'),'lastName'],'raw':!![]});if(_0x5241c8[_0xb714('0x45')][_0xb714('0xd8')]){_0x5a1cab[_0xb714('0x38')]({'model':db[_0xb714('0xdc')],'as':_0xb714('0xdc'),'raw':!![]});}var _0x8f7e54=[{'model':db['OpenchannelMessage'],'as':_0xb714('0xdd'),'attributes':['id','body',_0xb714('0x81'),'direction','secret',_0xb714('0x88')],'include':_0x5a1cab}];_0x8f7e54[_0xb714('0x38')]({'model':db[_0xb714('0xde')],'as':_0xb714('0xdf'),'attributes':['id',_0xb714('0x30')]});_0x8f7e54[_0xb714('0x38')]({'model':db[_0xb714('0x76')],'as':_0xb714('0xe0'),'attributes':['id',_0xb714('0xd9')]});return db[_0xb714('0x3b')][_0xb714('0x6f')]({'where':{'id':_0x5241c8[_0xb714('0xbe')]['id']},'include':_0x8f7e54})[_0xb714('0x2c')](handleEntityNotFound(_0x38c0da,null))[_0xb714('0x2c')](function(_0x2b2400){if(_0x2b2400){var _0x6bf393=_0x2b2400[_0xb714('0xe1')]({'plain':!![]});fs[_0xb714('0xe2')](_0xfddb71);var _0x4a8624={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0xb714('0xe3')}},'footer':{'height':'30px','contents':{'default':util[_0xb714('0xc9')](_0xb714('0xe4'),util['format'](_0xb714('0xe5'),_0xb714('0xe6'),_0x6bf393['id']),moment()[_0xb714('0xc9')]('YYYY-MM-DD')[_0xb714('0xa0')]())}}};var _0x1cbf7d={'channel':_0xb714('0xe6'),'account':_0x6bf393[_0xb714('0xdf')][_0xb714('0x30')],'agent':_0x6bf393[_0xb714('0xe0')]?_0x6bf393['Owner']['fullname']:_0xb714('0xe7'),'createdAt':moment(_0x6bf393[_0xb714('0x81')])[_0xb714('0xc9')](_0xb714('0xca'))[_0xb714('0xa0')](),'closedAt':_0x6bf393['closed']?moment(_0x6bf393[_0xb714('0xe8')])[_0xb714('0xc9')](_0xb714('0xca'))[_0xb714('0xa0')]():'','disposition':_0x6bf393['disposition'],'visibility':_0x6bf393['threadId']?'Public':_0xb714('0xe9'),'messages':_(_0x6bf393[_0xb714('0xdd')])['filter']({'secret':![]})[_0xb714('0x33')](function(_0x27f632){if(_0x27f632[_0xb714('0xdc')]){var _0x5c35c2=path[_0xb714('0xd4')](_0x15aa36,_0x27f632[_0xb714('0xdc')][_0xb714('0xea')]);if(fs[_0xb714('0xeb')](_0x5c35c2)){fs[_0xb714('0xec')](_0x5c35c2)[_0xb714('0xed')](fs[_0xb714('0xee')](path[_0xb714('0xd4')](_0xfddb71,_0x27f632[_0xb714('0xdc')][_0xb714('0xea')])));}}return{'date':moment(_0x27f632[_0xb714('0x81')])['format'](_0xb714('0xca'))[_0xb714('0xa0')](),'sender':_0x27f632[_0xb714('0xef')]==='out'?_0x27f632[_0xb714('0x76')]?_0x27f632['User'][_0xb714('0xd9')]:_0xb714('0xf0'):_0x27f632[_0xb714('0x69')][_0xb714('0xdb')]+(_0x27f632['Contact'][_0xb714('0xf1')]?'\x20'+_0x27f632[_0xb714('0x69')][_0xb714('0xf1')]:''),'body':_0x27f632[_0xb714('0xdc')]?_0x27f632[_0xb714('0xdc')][_0xb714('0xea')]:_0x27f632[_0xb714('0x7b')],'direction':_0x27f632['direction']===_0xb714('0xf2')?'A':'C','secret':_0x27f632[_0xb714('0xf3')],'read':_0x27f632[_0xb714('0x88')],'attachment':_0x27f632[_0xb714('0xdc')]};})[_0xb714('0x6b')]()};return ejs['renderFile'](path[_0xb714('0xd4')](config['root'],_0xb714('0xd6'),'views',_0xb714('0xf4')),{'interaction':_0x1cbf7d})[_0xb714('0x2c')](function(_0x414bf4){return new BPromise(function(_0x250360,_0x22113e){pdf[_0xb714('0xc1')](_0x414bf4,_0x4a8624)[_0xb714('0xf5')](path[_0xb714('0xd4')](_0xfddb71,'transcript-'+_0x6bf393['id']+'-'+_0x5862fa+_0xb714('0xf6')),function(_0x43ed9c,_0x11f7de){if(_0x43ed9c)return _0x22113e(_0x43ed9c);_0x250360(_0x11f7de);});});})['then'](function(){return new BPromise(function(_0x543e20,_0x4d126e){zipdir(_0xfddb71,{'saveTo':_0x46377a},function(_0x51e65d,_0x7abad4){if(_0x51e65d)return _0x4d126e(_0x51e65d);return _0x543e20(_0x7abad4);});})[_0xb714('0x2c')](function(){return new BPromise(function(_0x1e3885,_0x3d5773){rimraf(_0xfddb71,function(_0x4b37a3){if(_0x4b37a3)_0x3d5773(_0x4b37a3);return _0x1e3885();});});})[_0xb714('0x2c')](function(){return _0x38c0da[_0xb714('0xd2')](_0x46377a,_0x211ea6,function(_0x3336bf){if(_0x3336bf){console[_0xb714('0xf7')](_0xb714('0xf8'),_0x3336bf);}else{fs['unlinkSync'](_0x46377a);}});});});}else{return _0x38c0da['sendStatus'](0xc8);}})[_0xb714('0x39')](handleError(_0x38c0da,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index acb65a4..0bdd500 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 _0xfea8=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','catch'];(function(_0xdbb6cb,_0x3b8fda){var _0x476b50=function(_0x470ebb){while(--_0x470ebb){_0xdbb6cb['push'](_0xdbb6cb['shift']());}};_0x476b50(++_0x3b8fda);}(_0xfea8,0x1e9));var _0x8fea=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xfea8[_0x35885a];return _0xe86249;};'use strict';var EventEmitter=require(_0x8fea('0x0'));var OpenchannelInteraction=require(_0x8fea('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x8fea('0x1'))['db'][_0x8fea('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8fea('0x3')](0x0);var events={'afterCreate':_0x8fea('0x4'),'afterUpdate':_0x8fea('0x5'),'afterDestroy':'remove'};function emitEvent(_0x512920){return function(_0x37bc11,_0x193ca9,_0x4a5f2b){_0x37bc11[_0x8fea('0x6')]({'attributes':['id'],'raw':!![]})[_0x8fea('0x7')](function(_0x27f946){_0x37bc11[_0x8fea('0x8')](_0x8fea('0x9'),_0x27f946[_0x8fea('0xa')](function(_0x19f615){return{'id':_0x19f615['id']};}));return OpenchannelMessage[_0x8fea('0xb')]({'where':{'OpenchannelInteractionId':_0x37bc11['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8fea('0x7')](function(_0x52a767){_0x37bc11[_0x8fea('0x8')](_0x8fea('0xc'),_0x52a767[_0x8fea('0xd')]);OpenchannelInteractionEvents['emit'](_0x512920+':'+_0x37bc11['id'],_0x37bc11);OpenchannelInteractionEvents['emit'](_0x512920,_0x37bc11);_0x4a5f2b(null);})[_0x8fea('0xe')](_0x4a5f2b(null));};}for(var e in events){if(events[_0x8fea('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x8fea('0x10')](e,emitEvent(event));}}module[_0x8fea('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x1215=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','unreadMessages','length','emit','hasOwnProperty','hook','exports','events'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x1215,0x1af));var _0x5121=function(_0x2fc9e2,_0x1bdb51){_0x2fc9e2=_0x2fc9e2-0x0;var _0x2d1b9c=_0x1215[_0x2fc9e2];return _0x2d1b9c;};'use strict';var EventEmitter=require(_0x5121('0x0'));var OpenchannelInteraction=require(_0x5121('0x1'))['db'][_0x5121('0x2')];var OpenchannelMessage=require(_0x5121('0x1'))['db'][_0x5121('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5121('0x4')](0x0);var events={'afterCreate':_0x5121('0x5'),'afterUpdate':_0x5121('0x6'),'afterDestroy':_0x5121('0x7')};function emitEvent(_0x338eec){return function(_0x125f59,_0x588227,_0x36cad2){_0x125f59['getUsers']({'attributes':['id'],'raw':!![]})[_0x5121('0x8')](function(_0x4e738c){_0x125f59[_0x5121('0x9')](_0x5121('0xa'),_0x4e738c[_0x5121('0xb')](function(_0x1eb06d){return{'id':_0x1eb06d['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x125f59['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5121('0x8')](function(_0x49ef8c){_0x125f59[_0x5121('0x9')](_0x5121('0xc'),_0x49ef8c[_0x5121('0xd')]);OpenchannelInteractionEvents['emit'](_0x338eec+':'+_0x125f59['id'],_0x125f59);OpenchannelInteractionEvents[_0x5121('0xe')](_0x338eec,_0x125f59);_0x36cad2(null);})['catch'](_0x36cad2(null));};}for(var e in events){if(events[_0x5121('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x5121('0x10')](e,emitEvent(event));}}module[_0x5121('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 6270517..908637e 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 _0x71ab=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x588649,_0x99f19d){var _0x370ba1=function(_0x5f224f){while(--_0x5f224f){_0x588649['push'](_0x588649['shift']());}};_0x370ba1(++_0x99f19d);}(_0x71ab,0x64));var _0xb71a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x71ab[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43ca14,_0x471ab6,_0x18c7a6){if(_0x43ca14[_0xb71a('0xc')](_0xb71a('0xd'))){_0x43ca14[_0xb71a('0xe')]=moment()['format'](_0xb71a('0xf'));}_0x18c7a6(null,_0x43ca14);}}});}; \ No newline at end of file +var _0x0fda=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x17bc7e,_0x25bd00){var _0x4b3489=function(_0x4f0b74){while(--_0x4f0b74){_0x17bc7e['push'](_0x17bc7e['shift']());}};_0x4b3489(++_0x25bd00);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x1490d3,_0x3932d6){_0x1490d3=_0x1490d3-0x0;var _0x3fbcb3=_0x0fda[_0x1490d3];return _0x3fbcb3;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var logger=require(_0xa0fd('0x1'))(_0xa0fd('0x2'));var moment=require(_0xa0fd('0x3'));var BPromise=require(_0xa0fd('0x4'));var rp=require(_0xa0fd('0x5'));var fs=require('fs');var path=require(_0xa0fd('0x6'));var rimraf=require(_0xa0fd('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xa0fd('0x8')]=function(_0x4aec58,_0x49b3c1){return _0x4aec58[_0xa0fd('0x9')](_0xa0fd('0xa'),attributes,{'tableName':_0xa0fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x248cca,_0x5d996b,_0x29da4c){if(_0x248cca[_0xa0fd('0xc')](_0xa0fd('0xd'))){_0x248cca[_0xa0fd('0xe')]=moment()['format'](_0xa0fd('0xf'));}_0x29da4c(null,_0x248cca);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index cc8f7de..1bb535e 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 _0xf105=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf105,0x134));var _0x5f10=function(_0x328ae0,_0x46907c){_0x328ae0=_0x328ae0-0x0;var _0x1bdf8f=_0xf105[_0x328ae0];return _0x1bdf8f;};'use strict';var _=require(_0x5f10('0x0'));var util=require('util');var moment=require(_0x5f10('0x1'));var BPromise=require(_0x5f10('0x2'));var rs=require(_0x5f10('0x3'));var fs=require('fs');var Redis=require(_0x5f10('0x4'));var db=require(_0x5f10('0x5'))['db'];var utils=require(_0x5f10('0x6'));var logger=require(_0x5f10('0x7'))('rpc');var config=require(_0x5f10('0x8'));var jayson=require(_0x5f10('0x9'));var client=jayson[_0x5f10('0xa')][_0x5f10('0xb')]({'port':0x232a});config[_0x5f10('0xc')]=_[_0x5f10('0xd')](config[_0x5f10('0xc')],{'host':_0x5f10('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5f10('0xc')]));require(_0x5f10('0xf'))[_0x5f10('0x10')](socket);function respondWithRpcPromise(_0x1d3d9d,_0x4fce36,_0xe9a9fb){return new BPromise(function(_0x3ff7b3,_0x384666){return client[_0x5f10('0x11')](_0x1d3d9d,_0xe9a9fb)[_0x5f10('0x12')](function(_0x541e5d){logger['info'](_0x5f10('0x13'),_0x4fce36,'request\x20sent');logger[_0x5f10('0x14')](_0x5f10('0x15'),_0x4fce36,_0x5f10('0x16'),JSON['stringify'](_0x541e5d));if(_0x541e5d[_0x5f10('0x17')]){if(_0x541e5d[_0x5f10('0x17')][_0x5f10('0x18')]===0x1f4){logger[_0x5f10('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4fce36,_0x541e5d[_0x5f10('0x17')][_0x5f10('0x19')]);return _0x384666(_0x541e5d[_0x5f10('0x17')][_0x5f10('0x19')]);}logger['error'](_0x5f10('0x13'),_0x4fce36,_0x541e5d[_0x5f10('0x17')][_0x5f10('0x19')]);return _0x3ff7b3(_0x541e5d[_0x5f10('0x17')][_0x5f10('0x19')]);}else{logger[_0x5f10('0x1a')](_0x5f10('0x13'),_0x4fce36,_0x5f10('0x16'));_0x3ff7b3(_0x541e5d[_0x5f10('0x1b')][_0x5f10('0x19')]);}})[_0x5f10('0x1c')](function(_0x41af5c){logger[_0x5f10('0x17')](_0x5f10('0x13'),_0x4fce36,_0x41af5c);_0x384666(_0x41af5c);});});}exports[_0x5f10('0x1d')]=function(_0x3fc0c1){var _0x17f839=this;return new Promise(function(_0x229ed8,_0x45ffe7){return db['OpenchannelInteraction'][_0x5f10('0x1e')](_0x3fc0c1[_0x5f10('0x1f')],{'raw':_0x3fc0c1[_0x5f10('0x20')]?_0x3fc0c1[_0x5f10('0x20')][_0x5f10('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fc0c1[_0x5f10('0x20')]?_0x3fc0c1[_0x5f10('0x20')][_0x5f10('0x22')]||null:null,'attributes':_0x3fc0c1[_0x5f10('0x20')]?_0x3fc0c1[_0x5f10('0x20')][_0x5f10('0x23')]||null:null,'limit':_0x3fc0c1[_0x5f10('0x20')]?_0x3fc0c1['options'][_0x5f10('0x24')]||null:null})[_0x5f10('0x12')](function(_0x474796){logger[_0x5f10('0x1a')](_0x5f10('0x1d'),_0x3fc0c1);logger['debug']('UpdateOpenchannelInteraction',_0x3fc0c1,JSON[_0x5f10('0x25')](_0x474796));_0x229ed8(_0x474796);})[_0x5f10('0x1c')](function(_0x10ff4a){logger[_0x5f10('0x17')](_0x5f10('0x1d'),_0x10ff4a['message'],_0x3fc0c1);_0x45ffe7(_0x17f839[_0x5f10('0x17')](0x1f4,_0x10ff4a[_0x5f10('0x19')]));});});};exports[_0x5f10('0x26')]=function(_0xc97937){return new Promise(function(_0x36e8c2,_0x1a87da){return db[_0x5f10('0x27')][_0x5f10('0x28')]({'where':_0xc97937[_0x5f10('0x20')]?_0xc97937[_0x5f10('0x20')][_0x5f10('0x22')]||null:null})[_0x5f10('0x12')](function(_0x4f022f){if(_0x4f022f){return _0x4f022f[_0x5f10('0x29')](_0xc97937['body'][_0x5f10('0x2a')],_[_0x5f10('0x2b')](_0xc97937[_0x5f10('0x1f')],[_0x5f10('0x2a'),'id'])||{});}})['spread'](function(_0x39fa24){logger[_0x5f10('0x1a')](_0x5f10('0x2c'),_0xc97937);logger[_0x5f10('0x14')](_0x5f10('0x2c'),_0xc97937,JSON[_0x5f10('0x25')](_0x39fa24));_0x36e8c2(_0x39fa24);})[_0x5f10('0x1c')](function(_0x5e2641){logger[_0x5f10('0x17')](_0x5f10('0x2c'),_0x5e2641['message'],_0xc97937);_0x1a87da(_this[_0x5f10('0x17')](0x1f4,_0x5e2641['message']));});});}; \ No newline at end of file +var _0x5afb=['update','body','options','where','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelInteraction'];(function(_0x35b23f,_0x25f92a){var _0x12de57=function(_0x35870d){while(--_0x35870d){_0x35b23f['push'](_0x35b23f['shift']());}};_0x12de57(++_0x25f92a);}(_0x5afb,0x16c));var _0xb5af=function(_0x29f258,_0x559572){_0x29f258=_0x29f258-0x0;var _0x1315c7=_0x5afb[_0x29f258];return _0x1315c7;};'use strict';var _=require(_0xb5af('0x0'));var util=require('util');var moment=require(_0xb5af('0x1'));var BPromise=require(_0xb5af('0x2'));var rs=require(_0xb5af('0x3'));var fs=require('fs');var Redis=require(_0xb5af('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb5af('0x5'))(_0xb5af('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb5af('0x7')]({'port':0x232a});config[_0xb5af('0x8')]=_[_0xb5af('0x9')](config[_0xb5af('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb5af('0xa'))(new Redis(config[_0xb5af('0x8')]));require(_0xb5af('0xb'))['register'](socket);function respondWithRpcPromise(_0x5ac130,_0x1fc24b,_0x1d32b5){return new BPromise(function(_0x598684,_0x52b873){return client[_0xb5af('0xc')](_0x5ac130,_0x1d32b5)[_0xb5af('0xd')](function(_0x4f84bd){logger[_0xb5af('0xe')](_0xb5af('0xf'),_0x1fc24b,_0xb5af('0x10'));logger[_0xb5af('0x11')](_0xb5af('0x12'),_0x1fc24b,_0xb5af('0x10'),JSON[_0xb5af('0x13')](_0x4f84bd));if(_0x4f84bd[_0xb5af('0x14')]){if(_0x4f84bd[_0xb5af('0x14')][_0xb5af('0x15')]===0x1f4){logger[_0xb5af('0x14')](_0xb5af('0xf'),_0x1fc24b,_0x4f84bd[_0xb5af('0x14')][_0xb5af('0x16')]);return _0x52b873(_0x4f84bd[_0xb5af('0x14')]['message']);}logger[_0xb5af('0x14')](_0xb5af('0xf'),_0x1fc24b,_0x4f84bd[_0xb5af('0x14')][_0xb5af('0x16')]);return _0x598684(_0x4f84bd['error'][_0xb5af('0x16')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x1fc24b,_0xb5af('0x10'));_0x598684(_0x4f84bd[_0xb5af('0x17')][_0xb5af('0x16')]);}})[_0xb5af('0x18')](function(_0x476ee2){logger[_0xb5af('0x14')](_0xb5af('0xf'),_0x1fc24b,_0x476ee2);_0x52b873(_0x476ee2);});});}exports['UpdateOpenchannelInteraction']=function(_0x285cc3){var _0xf65e3=this;return new Promise(function(_0x4859dd,_0x33bfbb){return db[_0xb5af('0x19')][_0xb5af('0x1a')](_0x285cc3[_0xb5af('0x1b')],{'raw':_0x285cc3['options']?_0x285cc3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x285cc3[_0xb5af('0x1c')]?_0x285cc3[_0xb5af('0x1c')][_0xb5af('0x1d')]||null:null,'attributes':_0x285cc3[_0xb5af('0x1c')]?_0x285cc3[_0xb5af('0x1c')]['attributes']||null:null,'limit':_0x285cc3[_0xb5af('0x1c')]?_0x285cc3[_0xb5af('0x1c')][_0xb5af('0x1e')]||null:null})['then'](function(_0x1ecce1){logger[_0xb5af('0xe')](_0xb5af('0x1f'),_0x285cc3);logger['debug'](_0xb5af('0x1f'),_0x285cc3,JSON['stringify'](_0x1ecce1));_0x4859dd(_0x1ecce1);})[_0xb5af('0x18')](function(_0x357937){logger[_0xb5af('0x14')](_0xb5af('0x1f'),_0x357937[_0xb5af('0x16')],_0x285cc3);_0x33bfbb(_0xf65e3['error'](0x1f4,_0x357937[_0xb5af('0x16')]));});});};exports[_0xb5af('0x20')]=function(_0x39b1b8){return new Promise(function(_0x147ed0,_0x4ea7b0){return db['OpenchannelInteraction'][_0xb5af('0x21')]({'where':_0x39b1b8['options']?_0x39b1b8[_0xb5af('0x1c')][_0xb5af('0x1d')]||null:null})[_0xb5af('0xd')](function(_0x4a434e){if(_0x4a434e){return _0x4a434e[_0xb5af('0x22')](_0x39b1b8[_0xb5af('0x1b')][_0xb5af('0x23')],_[_0xb5af('0x24')](_0x39b1b8[_0xb5af('0x1b')],[_0xb5af('0x23'),'id'])||{});}})[_0xb5af('0x25')](function(_0x1471b8){logger[_0xb5af('0xe')](_0xb5af('0x26'),_0x39b1b8);logger[_0xb5af('0x11')](_0xb5af('0x26'),_0x39b1b8,JSON[_0xb5af('0x13')](_0x1471b8));_0x147ed0(_0x1471b8);})[_0xb5af('0x18')](function(_0x18441a){logger[_0xb5af('0x14')](_0xb5af('0x26'),_0x18441a[_0xb5af('0x16')],_0x39b1b8);_0x4ea7b0(_this[_0xb5af('0x14')](0x1f4,_0x18441a[_0xb5af('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 421c6a9..b7277a8 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 _0x37db=['openchannelInteraction:','save','remove','emit','removeListener','register','length'];(function(_0x205b92,_0x23c973){var _0x331224=function(_0xe7891){while(--_0xe7891){_0x205b92['push'](_0x205b92['shift']());}};_0x331224(++_0x23c973);}(_0x37db,0x1eb));var _0xb37d=function(_0x39b0dc,_0x266b56){_0x39b0dc=_0x39b0dc-0x0;var _0x5681fb=_0x37db[_0x39b0dc];return _0x5681fb;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xb37d('0x0'),_0xb37d('0x1'),'update'];function createListener(_0x37958d,_0x2b5d5d){return function(_0x594b1e){_0x2b5d5d[_0xb37d('0x2')](_0x37958d,_0x594b1e);};}function removeListener(_0x5d978e,_0xda79bf){return function(){OpenchannelInteractionEvents[_0xb37d('0x3')](_0x5d978e,_0xda79bf);};}exports[_0xb37d('0x4')]=function(_0x5b6034){for(var _0x30c8ce=0x0,_0xe6c13b=events[_0xb37d('0x5')];_0x30c8ce<_0xe6c13b;_0x30c8ce++){var _0x11506c=events[_0x30c8ce];var _0x532292=createListener(_0xb37d('0x6')+_0x11506c,_0x5b6034);OpenchannelInteractionEvents['on'](_0x11506c,_0x532292);}}; \ No newline at end of file +var _0xfe28=['save','update','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x119bc8,_0x5ac435){var _0x292d5b=function(_0x2df4e1){while(--_0x2df4e1){_0x119bc8['push'](_0x119bc8['shift']());}};_0x292d5b(++_0x5ac435);}(_0xfe28,0xfb));var _0x8fe2=function(_0x362970,_0x469f14){_0x362970=_0x362970-0x0;var _0x9e822f=_0xfe28[_0x362970];return _0x9e822f;};'use strict';var OpenchannelInteractionEvents=require(_0x8fe2('0x0'));var events=[_0x8fe2('0x1'),'remove',_0x8fe2('0x2')];function createListener(_0x56b80b,_0xbf562f){return function(_0x3f98e4){_0xbf562f['emit'](_0x56b80b,_0x3f98e4);};}function removeListener(_0x5ef0fc,_0x1389f5){return function(){OpenchannelInteractionEvents[_0x8fe2('0x3')](_0x5ef0fc,_0x1389f5);};}exports[_0x8fe2('0x4')]=function(_0x2d646d){for(var _0x3c57c9=0x0,_0x2b055e=events[_0x8fe2('0x5')];_0x3c57c9<_0x2b055e;_0x3c57c9++){var _0x30645d=events[_0x3c57c9];var _0x4baad1=createListener(_0x8fe2('0x6')+_0x30645d,_0x2d646d);OpenchannelInteractionEvents['on'](_0x30645d,_0x4baad1);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 0b94ac9..79f04c2 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 _0x2f3e=['create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','openchannel'];(function(_0x5280da,_0x5a0554){var _0x23ab06=function(_0x5c40d7){while(--_0x5c40d7){_0x5280da['push'](_0x5280da['shift']());}};_0x23ab06(++_0x5a0554);}(_0x2f3e,0xfd));var _0xe2f3=function(_0x388b47,_0x5cdac5){_0x388b47=_0x388b47-0x0;var _0x4859df=_0x2f3e[_0x388b47];return _0x4859df;};'use strict';var multer=require('multer');var util=require(_0xe2f3('0x0'));var path=require('path');var timeout=require(_0xe2f3('0x1'));var express=require(_0xe2f3('0x2'));var router=express[_0xe2f3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe2f3('0x4'));var interaction=require(_0xe2f3('0x5'));var config=require(_0xe2f3('0x6'));var controller=require(_0xe2f3('0x7'));router[_0xe2f3('0x8')]('/',auth[_0xe2f3('0x9')](),controller[_0xe2f3('0xa')]);router[_0xe2f3('0x8')](_0xe2f3('0xb'),auth[_0xe2f3('0x9')](),controller[_0xe2f3('0xc')]);router[_0xe2f3('0x8')](_0xe2f3('0xd'),auth['isAuthenticated'](),controller[_0xe2f3('0xe')]);router[_0xe2f3('0xf')]('/',auth[_0xe2f3('0x9')](),interaction['tracked'](_0xe2f3('0x10'),'openchannelmessage:create'),controller[_0xe2f3('0x11')]);router['put'](_0xe2f3('0xd'),auth[_0xe2f3('0x9')](),controller[_0xe2f3('0x12')]);router[_0xe2f3('0x13')](_0xe2f3('0x14'),auth[_0xe2f3('0x9')](),controller[_0xe2f3('0x15')]);router['put'](_0xe2f3('0x16'),auth[_0xe2f3('0x9')](),controller[_0xe2f3('0x17')]);router[_0xe2f3('0x18')]('/:id',auth[_0xe2f3('0x9')](),controller[_0xe2f3('0x19')]);module[_0xe2f3('0x1a')]=router; \ No newline at end of file +var _0xa508=['update','/:id/accept','accept','reject','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/describe','describe','/:id','post','tracked','openchannel','create','put'];(function(_0x39bbca,_0x525714){var _0x3ecffe=function(_0x26b1c9){while(--_0x26b1c9){_0x39bbca['push'](_0x39bbca['shift']());}};_0x3ecffe(++_0x525714);}(_0xa508,0x83));var _0x8a50=function(_0x2fd632,_0x21e703){_0x2fd632=_0x2fd632-0x0;var _0x53c3a4=_0xa508[_0x2fd632];return _0x53c3a4;};'use strict';var multer=require(_0x8a50('0x0'));var util=require(_0x8a50('0x1'));var path=require('path');var timeout=require(_0x8a50('0x2'));var express=require('express');var router=express[_0x8a50('0x3')]();var fs_extra=require(_0x8a50('0x4'));var auth=require(_0x8a50('0x5'));var interaction=require(_0x8a50('0x6'));var config=require(_0x8a50('0x7'));var controller=require(_0x8a50('0x8'));router[_0x8a50('0x9')]('/',auth[_0x8a50('0xa')](),controller['index']);router[_0x8a50('0x9')](_0x8a50('0xb'),auth[_0x8a50('0xa')](),controller[_0x8a50('0xc')]);router[_0x8a50('0x9')](_0x8a50('0xd'),auth[_0x8a50('0xa')](),controller['show']);router[_0x8a50('0xe')]('/',auth[_0x8a50('0xa')](),interaction[_0x8a50('0xf')](_0x8a50('0x10'),'openchannelmessage:create'),controller[_0x8a50('0x11')]);router[_0x8a50('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8a50('0x13')]);router[_0x8a50('0x12')](_0x8a50('0x14'),auth[_0x8a50('0xa')](),controller[_0x8a50('0x15')]);router[_0x8a50('0x12')]('/:id/reject',auth[_0x8a50('0xa')](),controller[_0x8a50('0x16')]);router[_0x8a50('0x17')](_0x8a50('0xd'),auth[_0x8a50('0xa')](),controller['destroy']);module[_0x8a50('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index c7ecddb..bb30065 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 _0xdb3f=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x1f1162,_0x34a370){var _0x19572a=function(_0x271ee7){while(--_0x271ee7){_0x1f1162['push'](_0x1f1162['shift']());}};_0x19572a(++_0x34a370);}(_0xdb3f,0x88));var _0xfdb3=function(_0x520a3f,_0x57eba7){_0x520a3f=_0x520a3f-0x0;var _0x189b9e=_0xdb3f[_0x520a3f];return _0x189b9e;};'use strict';var Sequelize=require(_0xfdb3('0x0'));module[_0xfdb3('0x1')]={'body':{'type':Sequelize[_0xfdb3('0x2')](_0xfdb3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfdb3('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfdb3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfdb3('0x5')]('in',_0xfdb3('0x6')),'defaultValue':_0xfdb3('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfdb3('0x7')]},'providerName':{'type':Sequelize[_0xfdb3('0x8')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8cd1=['ENUM','out','DATE','STRING','sequelize','TEXT','BOOLEAN'];(function(_0x1b3a9e,_0x3b6e29){var _0x53cdc2=function(_0x4b14ec){while(--_0x4b14ec){_0x1b3a9e['push'](_0x1b3a9e['shift']());}};_0x53cdc2(++_0x3b6e29);}(_0x8cd1,0x1ee));var _0x18cd=function(_0x37f608,_0x3e244e){_0x37f608=_0x37f608-0x0;var _0x4ad437=_0x8cd1[_0x37f608];return _0x4ad437;};'use strict';var Sequelize=require(_0x18cd('0x0'));module['exports']={'body':{'type':Sequelize[_0x18cd('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x18cd('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x18cd('0x3')]('in',_0x18cd('0x4')),'defaultValue':_0x18cd('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x18cd('0x5')]},'providerName':{'type':Sequelize[_0x18cd('0x6')]},'providerResponse':{'type':Sequelize[_0x18cd('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 1eb713e..5b8e382 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 _0xdf08=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','show','params','find','create','body','catch','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','redis','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage'];(function(_0x39acc5,_0x4211ad){var _0x37134d=function(_0x50181d){while(--_0x50181d){_0x39acc5['push'](_0x39acc5['shift']());}};_0x37134d(++_0x4211ad);}(_0xdf08,0x12e));var _0x8df0=function(_0x370b6a,_0x14ab11){_0x370b6a=_0x370b6a-0x0;var _0x2ec592=_0xdf08[_0x370b6a];return _0x2ec592;};'use strict';var pdf=require(_0x8df0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8df0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8df0('0x2'));var rp=require(_0x8df0('0x3'));var moment=require(_0x8df0('0x4'));var BPromise=require(_0x8df0('0x5'));var Mustache=require(_0x8df0('0x6'));var util=require(_0x8df0('0x7'));var path=require(_0x8df0('0x8'));var sox=require(_0x8df0('0x9'));var csv=require(_0x8df0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8df0('0xb'));var _=require('lodash');var squel=require(_0x8df0('0xc'));var crypto=require(_0x8df0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8df0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8df0('0xf'));var Papa=require('papaparse');var Redis=require(_0x8df0('0x10'));var authService=require(_0x8df0('0x11'));var qs=require(_0x8df0('0x12'));var as=require(_0x8df0('0x13'));var hardwareService=require(_0x8df0('0x14'));var logger=require(_0x8df0('0x15'))('api');var utils=require(_0x8df0('0x16'));var config=require(_0x8df0('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x8df0('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8df0('0x19')]));require(_0x8df0('0x1a'))[_0x8df0('0x1b')](socket);var jayson=require(_0x8df0('0x1c'));var client=jayson[_0x8df0('0x1d')][_0x8df0('0x1e')]({'port':0x232c});var client9002=jayson[_0x8df0('0x1d')][_0x8df0('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4edb72,_0x27c718,_0x976212,_0x356cf3){return new BPromise(function(_0x3c60fa,_0x369b83){var _0x3e4ab4=_0x356cf3||client;return _0x3e4ab4[_0x8df0('0x1f')](_0x4edb72,_0x976212)[_0x8df0('0x20')](function(_0x388ae6){logger[_0x8df0('0x21')](_0x8df0('0x22'),_0x27c718,_0x8df0('0x23'));logger[_0x8df0('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x27c718,_0x8df0('0x23'),JSON[_0x8df0('0x25')](_0x388ae6));if(_0x388ae6['error']){if(_0x388ae6[_0x8df0('0x26')][_0x8df0('0x27')]===0x1f4){logger[_0x8df0('0x26')](_0x8df0('0x22'),_0x27c718,_0x388ae6[_0x8df0('0x26')][_0x8df0('0x28')]);return _0x369b83(_0x388ae6[_0x8df0('0x26')][_0x8df0('0x28')]);}logger[_0x8df0('0x26')](_0x8df0('0x22'),_0x27c718,_0x388ae6[_0x8df0('0x26')][_0x8df0('0x28')]);return _0x3c60fa(_0x388ae6[_0x8df0('0x26')]['message']);}else{logger[_0x8df0('0x21')](_0x8df0('0x22'),_0x27c718,_0x8df0('0x23'));_0x3c60fa(_0x388ae6[_0x8df0('0x29')][_0x8df0('0x28')]);}})['catch'](function(_0x30f6cb){logger[_0x8df0('0x26')](_0x8df0('0x22'),_0x27c718,_0x30f6cb);_0x369b83(_0x30f6cb);});});}function respondWithStatusCode(_0x14ec8c,_0x17f6eb){_0x17f6eb=_0x17f6eb||0xcc;return function(_0x12f5a3){if(_0x12f5a3){return _0x14ec8c[_0x8df0('0x2a')](_0x17f6eb);}return _0x14ec8c[_0x8df0('0x2b')](_0x17f6eb)[_0x8df0('0x2c')]();};}function respondWithResult(_0x26eb41,_0x5d4f6d){_0x5d4f6d=_0x5d4f6d||0xc8;return function(_0x13194e){if(_0x13194e){return _0x26eb41[_0x8df0('0x2b')](_0x5d4f6d)['json'](_0x13194e);}};}function respondWithFilteredResult(_0x11f241,_0x6c8175){return function(_0x6962ea){if(_0x6962ea){var _0x274aca=_0x6962ea[_0x8df0('0x2d')],_0x2b1d62=_0x6c8175[_0x8df0('0x2e')],_0x1e429a=_0x6c8175[_0x8df0('0x2e')]+_0x6c8175[_0x8df0('0x2f')],_0x3d6bc7;if(_0x1e429a>=_0x274aca){_0x1e429a=_0x274aca;_0x3d6bc7=0xc8;}else{_0x3d6bc7=0xce;}_0x11f241[_0x8df0('0x2b')](_0x3d6bc7);return _0x11f241[_0x8df0('0x30')](_0x8df0('0x31'),_0x2b1d62+'-'+_0x1e429a+'/'+_0x274aca)['json'](_0x6962ea);}return null;};}function patchUpdates(_0xae6a53){return function(_0x5bc19f){try{jsonpatch[_0x8df0('0x32')](_0x5bc19f,_0xae6a53,!![]);}catch(_0x4fc125){return BPromise[_0x8df0('0x33')](_0x4fc125);}return _0x5bc19f[_0x8df0('0x34')]();};}function saveUpdates(_0x1b89d1,_0x3429d1){return function(_0x4cc4d2){if(_0x4cc4d2){return _0x4cc4d2[_0x8df0('0x35')](_0x1b89d1)['then'](function(_0x282dd1){return _0x282dd1;});}return null;};}function removeEntity(_0x454a04,_0x5ce095){return function(_0x24286e){if(_0x24286e){return _0x24286e[_0x8df0('0x36')]()[_0x8df0('0x20')](function(){_0x454a04[_0x8df0('0x2b')](0xcc)[_0x8df0('0x2c')]();});}};}function handleEntityNotFound(_0x142364,_0x31b27f){return function(_0x2502c7){if(!_0x2502c7){_0x142364['sendStatus'](0x194);}return _0x2502c7;};}function handleError(_0x404961,_0x25bd44){_0x25bd44=_0x25bd44||0x1f4;return function(_0x44621f){logger[_0x8df0('0x26')](_0x44621f[_0x8df0('0x37')]);if(_0x44621f[_0x8df0('0x38')]){delete _0x44621f[_0x8df0('0x38')];}_0x404961['status'](_0x25bd44)[_0x8df0('0x39')](_0x44621f);};}exports[_0x8df0('0x3a')]=function(_0x1e8ae5,_0x30675c){var _0x179a5f={},_0x23f528={},_0x353c93={'count':0x0,'rows':[]};var _0x837285=_[_0x8df0('0x3b')](db[_0x8df0('0x3c')]['rawAttributes'],function(_0x432a11){return{'name':_0x432a11[_0x8df0('0x3d')],'type':_0x432a11['type'][_0x8df0('0x3e')]};});_0x23f528[_0x8df0('0x3f')]=_[_0x8df0('0x3b')](_0x837285,_0x8df0('0x38'));_0x23f528[_0x8df0('0x40')]=_[_0x8df0('0x41')](_0x1e8ae5[_0x8df0('0x40')]);_0x23f528[_0x8df0('0x42')]=_[_0x8df0('0x43')](_0x23f528[_0x8df0('0x3f')],_0x23f528[_0x8df0('0x40')]);_0x179a5f[_0x8df0('0x44')]=_[_0x8df0('0x43')](_0x23f528[_0x8df0('0x3f')],qs[_0x8df0('0x45')](_0x1e8ae5[_0x8df0('0x40')]['fields']));_0x179a5f['attributes']=_0x179a5f[_0x8df0('0x44')][_0x8df0('0x46')]?_0x179a5f[_0x8df0('0x44')]:_0x23f528['model'];if(!_0x1e8ae5['query'][_0x8df0('0x47')](_0x8df0('0x48'))){_0x179a5f[_0x8df0('0x2f')]=qs[_0x8df0('0x2f')](_0x1e8ae5[_0x8df0('0x40')]['limit']);_0x179a5f[_0x8df0('0x2e')]=qs[_0x8df0('0x2e')](_0x1e8ae5[_0x8df0('0x40')][_0x8df0('0x2e')]);}_0x179a5f[_0x8df0('0x49')]=qs[_0x8df0('0x4a')](_0x1e8ae5[_0x8df0('0x40')]['sort']);_0x179a5f[_0x8df0('0x4b')]=qs[_0x8df0('0x42')](_[_0x8df0('0x4c')](_0x1e8ae5[_0x8df0('0x40')],_0x23f528['filters']),_0x837285);if(_0x1e8ae5[_0x8df0('0x40')][_0x8df0('0x4d')]){_0x179a5f[_0x8df0('0x4b')]=_[_0x8df0('0x4e')](_0x179a5f[_0x8df0('0x4b')],{'$or':_['map'](_0x837285,function(_0xa2b4d1){if(_0xa2b4d1[_0x8df0('0x4f')]!==_0x8df0('0x50')){var _0xebd0d4={};_0xebd0d4[_0xa2b4d1['name']]={'$like':'%'+_0x1e8ae5[_0x8df0('0x40')][_0x8df0('0x4d')]+'%'};return _0xebd0d4;}})});}_0x179a5f=_[_0x8df0('0x4e')]({},_0x179a5f,_0x1e8ae5[_0x8df0('0x51')]);var _0x1b9fa4={'where':_0x179a5f['where']};return db[_0x8df0('0x3c')]['count'](_0x1b9fa4)['then'](function(_0xfd8f33){_0x353c93['count']=_0xfd8f33;if(_0x1e8ae5[_0x8df0('0x40')][_0x8df0('0x52')]){_0x179a5f[_0x8df0('0x53')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x179a5f);})[_0x8df0('0x20')](function(_0x12b6b1){_0x353c93['rows']=_0x12b6b1;return _0x353c93;})[_0x8df0('0x20')](respondWithFilteredResult(_0x30675c,_0x179a5f))['catch'](handleError(_0x30675c,null));};exports[_0x8df0('0x54')]=function(_0x4ffc68,_0x11f8bc){var _0x431b3e={'raw':!![],'where':{'id':_0x4ffc68[_0x8df0('0x55')]['id']}},_0x3813dc={};_0x3813dc[_0x8df0('0x3f')]=_[_0x8df0('0x41')](db[_0x8df0('0x3c')]['rawAttributes']);_0x3813dc[_0x8df0('0x40')]=_[_0x8df0('0x41')](_0x4ffc68[_0x8df0('0x40')]);_0x3813dc[_0x8df0('0x42')]=_[_0x8df0('0x43')](_0x3813dc[_0x8df0('0x3f')],_0x3813dc[_0x8df0('0x40')]);_0x431b3e['attributes']=_['intersection'](_0x3813dc[_0x8df0('0x3f')],qs[_0x8df0('0x45')](_0x4ffc68[_0x8df0('0x40')]['fields']));_0x431b3e[_0x8df0('0x44')]=_0x431b3e[_0x8df0('0x44')][_0x8df0('0x46')]?_0x431b3e[_0x8df0('0x44')]:_0x3813dc[_0x8df0('0x3f')];if(_0x4ffc68[_0x8df0('0x40')][_0x8df0('0x52')]){_0x431b3e['include']=[{'all':!![]}];}_0x431b3e=_['merge']({},_0x431b3e,_0x4ffc68[_0x8df0('0x51')]);return db['OpenchannelMessage'][_0x8df0('0x56')](_0x431b3e)[_0x8df0('0x20')](handleEntityNotFound(_0x11f8bc,null))['then'](respondWithResult(_0x11f8bc,null))['catch'](handleError(_0x11f8bc,null));};exports['create']=function(_0x5a8a6f,_0x2c2816){return db[_0x8df0('0x3c')][_0x8df0('0x57')](_0x5a8a6f['body'],{})[_0x8df0('0x20')](respondWithResult(_0x2c2816,0xc9))['catch'](handleError(_0x2c2816,null));};exports[_0x8df0('0x35')]=function(_0xe70cc5,_0x292a4c){if(_0xe70cc5['body']['id']){delete _0xe70cc5[_0x8df0('0x58')]['id'];}return db[_0x8df0('0x3c')][_0x8df0('0x56')]({'where':{'id':_0xe70cc5['params']['id']}})[_0x8df0('0x20')](handleEntityNotFound(_0x292a4c,null))[_0x8df0('0x20')](saveUpdates(_0xe70cc5[_0x8df0('0x58')],null))[_0x8df0('0x20')](respondWithResult(_0x292a4c,null))[_0x8df0('0x59')](handleError(_0x292a4c,null));};exports[_0x8df0('0x36')]=function(_0x5b5a6f,_0x4709c9){return db['OpenchannelMessage'][_0x8df0('0x56')]({'where':{'id':_0x5b5a6f[_0x8df0('0x55')]['id']}})[_0x8df0('0x20')](handleEntityNotFound(_0x4709c9,null))[_0x8df0('0x20')](removeEntity(_0x4709c9,null))[_0x8df0('0x59')](handleError(_0x4709c9,null));};exports[_0x8df0('0x5a')]=function(_0x61f633,_0x34b5d2){return db[_0x8df0('0x3c')][_0x8df0('0x5a')]()[_0x8df0('0x20')](respondWithResult(_0x34b5d2,null))[_0x8df0('0x59')](handleError(_0x34b5d2,null));};var interaction_log=require(_0x8df0('0x15'))(_0x8df0('0x5b'));exports['accept']=function(_0x1d65a5,_0x54c637,_0xed0dd3){var _0x5d9e3d={'agent':{},'channel':_0x8df0('0x5c')};if(_0x1d65a5[_0x8df0('0x58')]['id']){delete _0x1d65a5[_0x8df0('0x58')]['id'];}_0x1d65a5[_0x8df0('0x58')][_0x8df0('0x5d')]=!![];_0x1d65a5[_0x8df0('0x58')][_0x8df0('0x5e')]=moment()[_0x8df0('0x5f')](_0x8df0('0x60'));_0x1d65a5[_0x8df0('0x58')][_0x8df0('0x61')]=_0x1d65a5['body']['UserId']||_0x1d65a5[_0x8df0('0x62')]['id'];_0x5d9e3d[_0x8df0('0x63')]['id']=_0x1d65a5[_0x8df0('0x58')][_0x8df0('0x61')];return db['OpenchannelMessage'][_0x8df0('0x56')]({'where':{'id':_0x1d65a5[_0x8df0('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x8df0('0x64')],'as':_0x8df0('0x65')}]})[_0x8df0('0x20')](handleEntityNotFound(_0x54c637,null))[_0x8df0('0x20')](saveUpdates(_0x1d65a5[_0x8df0('0x58')],null))['then'](function(_0x42c304){if(_0x42c304){_0x5d9e3d['message']=_0x42c304[_0x8df0('0x66')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x42c304['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x54c637,null))[_0x8df0('0x20')](function(_0x360200){if(_0x360200){return _0x360200[_0x8df0('0x35')]({'UserId':_0x1d65a5[_0x8df0('0x58')]['UserId'],'read1stAt':_[_0x8df0('0x67')](_0x360200['read1stAt'])?moment()['format'](_0x8df0('0x60')):undefined});}return null;})[_0x8df0('0x20')](function(_0x2d1e59){if(_0x2d1e59){_0x5d9e3d[_0x8df0('0x68')]=_0x2d1e59[_0x8df0('0x66')]({'plain':!![]});interaction_log[_0x8df0('0x21')](_0x8df0('0x69'),_0x1d65a5[_0x8df0('0x62')]['id'],_0x1d65a5[_0x8df0('0x62')][_0x8df0('0x38')],_0x1d65a5[_0x8df0('0x62')][_0x8df0('0x6a')],_0x5d9e3d[_0x8df0('0x68')]['id'],_0x1d65a5[_0x8df0('0x58')]?JSON[_0x8df0('0x25')](_0x1d65a5[_0x8df0('0x58')]):_0x8df0('0x6b'));return respondWithRpcPromise(_0x8df0('0x6c'),'acceptMessage',_0x5d9e3d);}return null;})[_0x8df0('0x20')](function(_0x83a7e9){if(_0x83a7e9){if(_0x1d65a5[_0x8df0('0x58')][_0x8df0('0x6d')]){_0x5d9e3d[_0x8df0('0x28')][_0x8df0('0x6e')]=util['format'](_0x8df0('0x6f'),_0x1d65a5[_0x8df0('0x62')][_0x8df0('0x38')]);_0x5d9e3d[_0x8df0('0x28')][_0x8df0('0x70')]=_0x5d9e3d[_0x8df0('0x70')];_0x5d9e3d[_0x8df0('0x28')][_0x8df0('0x71')]='accept';return respondWithRpcPromise(_0x8df0('0x72'),_0x8df0('0x72'),{'event':_0x8df0('0x73'),'message':_0x5d9e3d[_0x8df0('0x28')]},client9002)[_0x8df0('0x20')](function(){return _0x5d9e3d;});}return _0x5d9e3d;}return null;})[_0x8df0('0x20')](respondWithResult(_0x54c637,null))[_0x8df0('0x59')](handleError(_0x54c637,null));};var interaction_log=require('../../config/logger')(_0x8df0('0x5b'));exports[_0x8df0('0x33')]=function(_0x300645,_0xcfa980,_0x323f4a){var _0x4886a0={'agent':{},'channel':_0x8df0('0x5c')};if(_0x300645['body']['id']){delete _0x300645[_0x8df0('0x58')]['id'];}_0x300645['body'][_0x8df0('0x61')]=_0x300645[_0x8df0('0x58')][_0x8df0('0x61')]||_0x300645[_0x8df0('0x62')]['id'];_0x4886a0['agent']['id']=_0x300645[_0x8df0('0x58')]['UserId'];return db[_0x8df0('0x3c')][_0x8df0('0x56')]({'where':{'id':_0x300645[_0x8df0('0x55')]['id'],'UserId':null}})[_0x8df0('0x20')](handleEntityNotFound(_0xcfa980,null))['then'](function(_0x4d345c){if(_0x4d345c){_0x4886a0[_0x8df0('0x28')]=_0x4d345c[_0x8df0('0x66')]({'plain':!![]});return db[_0x8df0('0x74')][_0x8df0('0x56')]({'where':{'id':_0x4d345c[_0x8df0('0x75')]}});}return null;})['then'](handleEntityNotFound(_0xcfa980,null))[_0x8df0('0x20')](function(_0x2a0248){if(_0x2a0248){_0x4886a0[_0x8df0('0x68')]=_0x2a0248['get']({'plain':!![]});interaction_log[_0x8df0('0x21')](_0x8df0('0x76'),_0x300645[_0x8df0('0x62')]['id'],_0x300645[_0x8df0('0x62')][_0x8df0('0x38')],_0x300645[_0x8df0('0x62')][_0x8df0('0x6a')],_0x4886a0[_0x8df0('0x68')]['id'],_0x300645['body']?JSON['stringify'](_0x300645[_0x8df0('0x58')]):'null');return respondWithRpcPromise(_0x8df0('0x77'),_0x8df0('0x78'),_0x4886a0);}return null;})[_0x8df0('0x20')](function(_0x34c7bd){if(_0x34c7bd){_0x34c7bd['message'][_0x8df0('0x6e')]=util[_0x8df0('0x5f')](_0x8df0('0x6f'),_0x300645[_0x8df0('0x62')][_0x8df0('0x38')]);_0x34c7bd[_0x8df0('0x28')]['channel']=_0x4886a0[_0x8df0('0x70')];_0x34c7bd[_0x8df0('0x28')]['event']=_0x8df0('0x33');respondWithRpcPromise(_0x8df0('0x72'),_0x8df0('0x72'),{'event':'rejectmessage','message':_0x34c7bd[_0x8df0('0x28')]},client9002);return _0x4886a0;}return null;})[_0x8df0('0x20')](respondWithResult(_0xcfa980,null))[_0x8df0('0x59')](handleError(_0xcfa980,null));}; \ No newline at end of file +var _0x7630=['json','offset','limit','set','reject','save','update','destroy','stack','name','OpenchannelMessage','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','type','filter','options','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','OpenchannelInteraction','isNil','read1stAt','format','interaction','role','null','AcceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','RejectMessage','rejectMessage','event','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','then','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end'];(function(_0x494f7e,_0x3b0f54){var _0x1f4576=function(_0x487607){while(--_0x487607){_0x494f7e['push'](_0x494f7e['shift']());}};_0x1f4576(++_0x3b0f54);}(_0x7630,0x130));var _0x0763=function(_0x2364ce,_0x5eba62){_0x2364ce=_0x2364ce-0x0;var _0x72d33=_0x7630[_0x2364ce];return _0x72d33;};'use strict';var pdf=require(_0x0763('0x0'));var emlformat=require(_0x0763('0x1'));var rimraf=require(_0x0763('0x2'));var zipdir=require(_0x0763('0x3'));var jsonpatch=require(_0x0763('0x4'));var rp=require(_0x0763('0x5'));var moment=require(_0x0763('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0763('0x7'));var util=require(_0x0763('0x8'));var path=require(_0x0763('0x9'));var sox=require(_0x0763('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0763('0xb'));var _=require(_0x0763('0xc'));var squel=require('squel');var crypto=require(_0x0763('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0763('0xe'));var toCsv=require(_0x0763('0xf'));var querystring=require('querystring');var Papa=require(_0x0763('0x10'));var Redis=require(_0x0763('0x11'));var authService=require(_0x0763('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0763('0x13'))(_0x0763('0x14'));var utils=require('../../config/utils');var config=require(_0x0763('0x15'));var licenseUtil=require(_0x0763('0x16'));var db=require(_0x0763('0x17'))['db'];config[_0x0763('0x18')]=_[_0x0763('0x19')](config['redis'],{'host':_0x0763('0x1a'),'port':0x18eb});var socket=require(_0x0763('0x1b'))(new Redis(config['redis']));require(_0x0763('0x1c'))[_0x0763('0x1d')](socket);var jayson=require(_0x0763('0x1e'));var client=jayson['client'][_0x0763('0x1f')]({'port':0x232c});var client9002=jayson[_0x0763('0x20')][_0x0763('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4ad61a,_0x49ad22,_0x4e6d54,_0x39cc88){return new BPromise(function(_0x80b85b,_0x566789){var _0x4d8e5d=_0x39cc88||client;return _0x4d8e5d['request'](_0x4ad61a,_0x4e6d54)[_0x0763('0x21')](function(_0x37200e){logger['info'](_0x0763('0x22'),_0x49ad22,'request\x20sent');logger[_0x0763('0x23')](_0x0763('0x24'),_0x49ad22,_0x0763('0x25'),JSON[_0x0763('0x26')](_0x37200e));if(_0x37200e[_0x0763('0x27')]){if(_0x37200e['error'][_0x0763('0x28')]===0x1f4){logger[_0x0763('0x27')](_0x0763('0x22'),_0x49ad22,_0x37200e[_0x0763('0x27')][_0x0763('0x29')]);return _0x566789(_0x37200e[_0x0763('0x27')][_0x0763('0x29')]);}logger['error'](_0x0763('0x22'),_0x49ad22,_0x37200e[_0x0763('0x27')]['message']);return _0x80b85b(_0x37200e[_0x0763('0x27')][_0x0763('0x29')]);}else{logger[_0x0763('0x2a')](_0x0763('0x22'),_0x49ad22,'request\x20sent');_0x80b85b(_0x37200e[_0x0763('0x2b')][_0x0763('0x29')]);}})['catch'](function(_0xf15def){logger[_0x0763('0x27')](_0x0763('0x22'),_0x49ad22,_0xf15def);_0x566789(_0xf15def);});});}function respondWithStatusCode(_0x4453a0,_0x5e9604){_0x5e9604=_0x5e9604||0xcc;return function(_0x21ca63){if(_0x21ca63){return _0x4453a0[_0x0763('0x2c')](_0x5e9604);}return _0x4453a0[_0x0763('0x2d')](_0x5e9604)[_0x0763('0x2e')]();};}function respondWithResult(_0x706e7f,_0x1b6b1f){_0x1b6b1f=_0x1b6b1f||0xc8;return function(_0x3d0c73){if(_0x3d0c73){return _0x706e7f[_0x0763('0x2d')](_0x1b6b1f)[_0x0763('0x2f')](_0x3d0c73);}};}function respondWithFilteredResult(_0x32c035,_0x50d880){return function(_0x474ad7){if(_0x474ad7){var _0x482e08=_0x474ad7['count'],_0x332e26=_0x50d880[_0x0763('0x30')],_0x3407fe=_0x50d880[_0x0763('0x30')]+_0x50d880[_0x0763('0x31')],_0x531c10;if(_0x3407fe>=_0x482e08){_0x3407fe=_0x482e08;_0x531c10=0xc8;}else{_0x531c10=0xce;}_0x32c035[_0x0763('0x2d')](_0x531c10);return _0x32c035[_0x0763('0x32')]('Content-Range',_0x332e26+'-'+_0x3407fe+'/'+_0x482e08)[_0x0763('0x2f')](_0x474ad7);}return null;};}function patchUpdates(_0x122720){return function(_0xdabe3b){try{jsonpatch['apply'](_0xdabe3b,_0x122720,!![]);}catch(_0x442b25){return BPromise[_0x0763('0x33')](_0x442b25);}return _0xdabe3b[_0x0763('0x34')]();};}function saveUpdates(_0x240a5b,_0xc3b083){return function(_0x454470){if(_0x454470){return _0x454470[_0x0763('0x35')](_0x240a5b)['then'](function(_0x2f3d46){return _0x2f3d46;});}return null;};}function removeEntity(_0x2c5cd3,_0x35ca65){return function(_0x6d68cd){if(_0x6d68cd){return _0x6d68cd[_0x0763('0x36')]()[_0x0763('0x21')](function(){_0x2c5cd3['status'](0xcc)[_0x0763('0x2e')]();});}};}function handleEntityNotFound(_0x3a8fbe,_0x1d58b9){return function(_0x19f10a){if(!_0x19f10a){_0x3a8fbe[_0x0763('0x2c')](0x194);}return _0x19f10a;};}function handleError(_0x47cbf5,_0x1f152f){_0x1f152f=_0x1f152f||0x1f4;return function(_0x36060a){logger[_0x0763('0x27')](_0x36060a[_0x0763('0x37')]);if(_0x36060a[_0x0763('0x38')]){delete _0x36060a['name'];}_0x47cbf5['status'](_0x1f152f)['send'](_0x36060a);};}exports['index']=function(_0x32e54a,_0x27a90c){var _0x13c236={},_0x51bf93={},_0x1bea31={'count':0x0,'rows':[]};var _0x3785c0=_['map'](db[_0x0763('0x39')][_0x0763('0x3a')],function(_0x6b4dab){return{'name':_0x6b4dab[_0x0763('0x3b')],'type':_0x6b4dab['type']['key']};});_0x51bf93[_0x0763('0x3c')]=_['map'](_0x3785c0,_0x0763('0x38'));_0x51bf93[_0x0763('0x3d')]=_['keys'](_0x32e54a[_0x0763('0x3d')]);_0x51bf93[_0x0763('0x3e')]=_[_0x0763('0x3f')](_0x51bf93['model'],_0x51bf93[_0x0763('0x3d')]);_0x13c236[_0x0763('0x40')]=_[_0x0763('0x3f')](_0x51bf93[_0x0763('0x3c')],qs[_0x0763('0x41')](_0x32e54a['query']['fields']));_0x13c236[_0x0763('0x40')]=_0x13c236['attributes'][_0x0763('0x42')]?_0x13c236[_0x0763('0x40')]:_0x51bf93['model'];if(!_0x32e54a[_0x0763('0x3d')][_0x0763('0x43')](_0x0763('0x44'))){_0x13c236[_0x0763('0x31')]=qs[_0x0763('0x31')](_0x32e54a[_0x0763('0x3d')][_0x0763('0x31')]);_0x13c236[_0x0763('0x30')]=qs[_0x0763('0x30')](_0x32e54a[_0x0763('0x3d')]['offset']);}_0x13c236['order']=qs[_0x0763('0x45')](_0x32e54a['query'][_0x0763('0x45')]);_0x13c236[_0x0763('0x46')]=qs[_0x0763('0x3e')](_[_0x0763('0x47')](_0x32e54a[_0x0763('0x3d')],_0x51bf93['filters']),_0x3785c0);if(_0x32e54a[_0x0763('0x3d')]['filter']){_0x13c236[_0x0763('0x46')]=_[_0x0763('0x48')](_0x13c236[_0x0763('0x46')],{'$or':_[_0x0763('0x49')](_0x3785c0,function(_0x3cac04){if(_0x3cac04[_0x0763('0x4a')]!=='VIRTUAL'){var _0x2de6ed={};_0x2de6ed[_0x3cac04[_0x0763('0x38')]]={'$like':'%'+_0x32e54a[_0x0763('0x3d')][_0x0763('0x4b')]+'%'};return _0x2de6ed;}})});}_0x13c236=_[_0x0763('0x48')]({},_0x13c236,_0x32e54a[_0x0763('0x4c')]);var _0x9a0246={'where':_0x13c236[_0x0763('0x46')]};return db[_0x0763('0x39')][_0x0763('0x4d')](_0x9a0246)[_0x0763('0x21')](function(_0x465f75){_0x1bea31['count']=_0x465f75;if(_0x32e54a[_0x0763('0x3d')][_0x0763('0x4e')]){_0x13c236['include']=[{'all':!![]}];}return db[_0x0763('0x39')][_0x0763('0x4f')](_0x13c236);})['then'](function(_0x459b46){_0x1bea31[_0x0763('0x50')]=_0x459b46;return _0x1bea31;})[_0x0763('0x21')](respondWithFilteredResult(_0x27a90c,_0x13c236))[_0x0763('0x51')](handleError(_0x27a90c,null));};exports[_0x0763('0x52')]=function(_0x4573a2,_0xe7d18e){var _0x42409e={'raw':!![],'where':{'id':_0x4573a2[_0x0763('0x53')]['id']}},_0x4ac34d={};_0x4ac34d['model']=_[_0x0763('0x54')](db[_0x0763('0x39')][_0x0763('0x3a')]);_0x4ac34d['query']=_[_0x0763('0x54')](_0x4573a2[_0x0763('0x3d')]);_0x4ac34d[_0x0763('0x3e')]=_['intersection'](_0x4ac34d[_0x0763('0x3c')],_0x4ac34d[_0x0763('0x3d')]);_0x42409e[_0x0763('0x40')]=_['intersection'](_0x4ac34d[_0x0763('0x3c')],qs[_0x0763('0x41')](_0x4573a2[_0x0763('0x3d')][_0x0763('0x41')]));_0x42409e['attributes']=_0x42409e[_0x0763('0x40')][_0x0763('0x42')]?_0x42409e[_0x0763('0x40')]:_0x4ac34d[_0x0763('0x3c')];if(_0x4573a2[_0x0763('0x3d')][_0x0763('0x4e')]){_0x42409e[_0x0763('0x55')]=[{'all':!![]}];}_0x42409e=_[_0x0763('0x48')]({},_0x42409e,_0x4573a2[_0x0763('0x4c')]);return db[_0x0763('0x39')][_0x0763('0x56')](_0x42409e)[_0x0763('0x21')](handleEntityNotFound(_0xe7d18e,null))['then'](respondWithResult(_0xe7d18e,null))[_0x0763('0x51')](handleError(_0xe7d18e,null));};exports[_0x0763('0x57')]=function(_0x3d1044,_0x37a463){return db[_0x0763('0x39')]['create'](_0x3d1044[_0x0763('0x58')],{})[_0x0763('0x21')](respondWithResult(_0x37a463,0xc9))[_0x0763('0x51')](handleError(_0x37a463,null));};exports[_0x0763('0x35')]=function(_0x340126,_0x16c2f6){if(_0x340126[_0x0763('0x58')]['id']){delete _0x340126[_0x0763('0x58')]['id'];}return db[_0x0763('0x39')]['find']({'where':{'id':_0x340126[_0x0763('0x53')]['id']}})[_0x0763('0x21')](handleEntityNotFound(_0x16c2f6,null))[_0x0763('0x21')](saveUpdates(_0x340126[_0x0763('0x58')],null))[_0x0763('0x21')](respondWithResult(_0x16c2f6,null))[_0x0763('0x51')](handleError(_0x16c2f6,null));};exports[_0x0763('0x36')]=function(_0x1d56d4,_0x54aeee){return db[_0x0763('0x39')][_0x0763('0x56')]({'where':{'id':_0x1d56d4[_0x0763('0x53')]['id']}})[_0x0763('0x21')](handleEntityNotFound(_0x54aeee,null))[_0x0763('0x21')](removeEntity(_0x54aeee,null))['catch'](handleError(_0x54aeee,null));};exports['describe']=function(_0x4ea26b,_0x2a68b9){return db[_0x0763('0x39')]['describe']()[_0x0763('0x21')](respondWithResult(_0x2a68b9,null))[_0x0763('0x51')](handleError(_0x2a68b9,null));};var interaction_log=require(_0x0763('0x13'))(_0x0763('0x59'));exports[_0x0763('0x5a')]=function(_0x8778e0,_0x28f543,_0x520d23){var _0x5cc79c={'agent':{},'channel':_0x0763('0x5b')};if(_0x8778e0[_0x0763('0x58')]['id']){delete _0x8778e0[_0x0763('0x58')]['id'];}_0x8778e0[_0x0763('0x58')][_0x0763('0x5c')]=!![];_0x8778e0[_0x0763('0x58')][_0x0763('0x5d')]=moment()['format'](_0x0763('0x5e'));_0x8778e0[_0x0763('0x58')][_0x0763('0x5f')]=_0x8778e0[_0x0763('0x58')][_0x0763('0x5f')]||_0x8778e0[_0x0763('0x60')]['id'];_0x5cc79c[_0x0763('0x61')]['id']=_0x8778e0[_0x0763('0x58')][_0x0763('0x5f')];return db[_0x0763('0x39')][_0x0763('0x56')]({'where':{'id':_0x8778e0[_0x0763('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0763('0x62')],'as':_0x0763('0x63')}]})['then'](handleEntityNotFound(_0x28f543,null))[_0x0763('0x21')](saveUpdates(_0x8778e0[_0x0763('0x58')],null))[_0x0763('0x21')](function(_0x1e5c82){if(_0x1e5c82){_0x5cc79c[_0x0763('0x29')]=_0x1e5c82[_0x0763('0x64')]({'plain':!![]});return db[_0x0763('0x65')][_0x0763('0x56')]({'where':{'id':_0x1e5c82['OpenchannelInteractionId']}});}return null;})[_0x0763('0x21')](handleEntityNotFound(_0x28f543,null))[_0x0763('0x21')](function(_0x1bf4b3){if(_0x1bf4b3){return _0x1bf4b3['update']({'UserId':_0x8778e0[_0x0763('0x58')][_0x0763('0x5f')],'read1stAt':_[_0x0763('0x66')](_0x1bf4b3[_0x0763('0x67')])?moment()[_0x0763('0x68')](_0x0763('0x5e')):undefined});}return null;})[_0x0763('0x21')](function(_0x36a6ac){if(_0x36a6ac){_0x5cc79c[_0x0763('0x69')]=_0x36a6ac['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x8778e0[_0x0763('0x60')]['id'],_0x8778e0[_0x0763('0x60')][_0x0763('0x38')],_0x8778e0['user'][_0x0763('0x6a')],_0x5cc79c[_0x0763('0x69')]['id'],_0x8778e0[_0x0763('0x58')]?JSON['stringify'](_0x8778e0[_0x0763('0x58')]):_0x0763('0x6b'));return respondWithRpcPromise(_0x0763('0x6c'),'acceptMessage',_0x5cc79c);}return null;})[_0x0763('0x21')](function(_0x30512b){if(_0x30512b){if(_0x8778e0[_0x0763('0x58')]['manual']){_0x5cc79c[_0x0763('0x29')][_0x0763('0x6d')]=util[_0x0763('0x68')](_0x0763('0x6e'),_0x8778e0[_0x0763('0x60')][_0x0763('0x38')]);_0x5cc79c[_0x0763('0x29')][_0x0763('0x6f')]=_0x5cc79c[_0x0763('0x6f')];_0x5cc79c['message']['event']=_0x0763('0x5a');return respondWithRpcPromise(_0x0763('0x70'),_0x0763('0x70'),{'event':_0x0763('0x71'),'message':_0x5cc79c[_0x0763('0x29')]},client9002)[_0x0763('0x21')](function(){return _0x5cc79c;});}return _0x5cc79c;}return null;})[_0x0763('0x21')](respondWithResult(_0x28f543,null))[_0x0763('0x51')](handleError(_0x28f543,null));};var interaction_log=require(_0x0763('0x13'))('openchannel-interactions');exports['reject']=function(_0x4ad236,_0x3aff4b,_0x3014fd){var _0x4b0f43={'agent':{},'channel':'openchannel'};if(_0x4ad236[_0x0763('0x58')]['id']){delete _0x4ad236[_0x0763('0x58')]['id'];}_0x4ad236[_0x0763('0x58')][_0x0763('0x5f')]=_0x4ad236[_0x0763('0x58')][_0x0763('0x5f')]||_0x4ad236[_0x0763('0x60')]['id'];_0x4b0f43[_0x0763('0x61')]['id']=_0x4ad236[_0x0763('0x58')][_0x0763('0x5f')];return db[_0x0763('0x39')][_0x0763('0x56')]({'where':{'id':_0x4ad236['params']['id'],'UserId':null}})[_0x0763('0x21')](handleEntityNotFound(_0x3aff4b,null))[_0x0763('0x21')](function(_0x2fdb82){if(_0x2fdb82){_0x4b0f43[_0x0763('0x29')]=_0x2fdb82[_0x0763('0x64')]({'plain':!![]});return db[_0x0763('0x65')]['find']({'where':{'id':_0x2fdb82['OpenchannelInteractionId']}});}return null;})[_0x0763('0x21')](handleEntityNotFound(_0x3aff4b,null))[_0x0763('0x21')](function(_0x56b9ff){if(_0x56b9ff){_0x4b0f43['interaction']=_0x56b9ff[_0x0763('0x64')]({'plain':!![]});interaction_log[_0x0763('0x2a')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ad236['user']['id'],_0x4ad236[_0x0763('0x60')][_0x0763('0x38')],_0x4ad236[_0x0763('0x60')][_0x0763('0x6a')],_0x4b0f43[_0x0763('0x69')]['id'],_0x4ad236[_0x0763('0x58')]?JSON[_0x0763('0x26')](_0x4ad236[_0x0763('0x58')]):_0x0763('0x6b'));return respondWithRpcPromise(_0x0763('0x72'),_0x0763('0x73'),_0x4b0f43);}return null;})[_0x0763('0x21')](function(_0x47d600){if(_0x47d600){_0x47d600['message'][_0x0763('0x6d')]=util[_0x0763('0x68')](_0x0763('0x6e'),_0x4ad236[_0x0763('0x60')][_0x0763('0x38')]);_0x47d600[_0x0763('0x29')][_0x0763('0x6f')]=_0x4b0f43['channel'];_0x47d600['message'][_0x0763('0x74')]=_0x0763('0x33');respondWithRpcPromise(_0x0763('0x70'),_0x0763('0x70'),{'event':'rejectmessage','message':_0x47d600[_0x0763('0x29')]},client9002);return _0x4b0f43;}return null;})[_0x0763('0x21')](respondWithResult(_0x3aff4b,null))['catch'](handleError(_0x3aff4b,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 1da4c2a..6bc8949 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 _0x5558=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x5961a4,_0x142bea){var _0x100e13=function(_0x5784c2){while(--_0x5784c2){_0x5961a4['push'](_0x5961a4['shift']());}};_0x100e13(++_0x142bea);}(_0x5558,0x6b));var _0x8555=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5558[_0x4b055c];return _0x4b62bb;};'use strict';var EventEmitter=require(_0x8555('0x0'));var OpenchannelMessage=require(_0x8555('0x1'))['db'][_0x8555('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8555('0x3')](0x0);var events={'afterCreate':_0x8555('0x4'),'afterUpdate':_0x8555('0x5'),'afterDestroy':_0x8555('0x6')};function emitEvent(_0x2f550b){return function(_0x46f35f,_0x122144,_0x22eaff){OpenchannelMessageEvents[_0x8555('0x7')](_0x2f550b+':'+_0x46f35f['id'],_0x46f35f);OpenchannelMessageEvents['emit'](_0x2f550b,_0x46f35f);_0x22eaff(null);};}for(var e in events){if(events[_0x8555('0x8')](e)){var event=events[e];OpenchannelMessage[_0x8555('0x9')](e,emitEvent(event));}}module[_0x8555('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x0673=['update','remove','emit','hook','exports','events','OpenchannelMessage','save'];(function(_0x53b55f,_0x7980d0){var _0x71d9fa=function(_0x1c30c2){while(--_0x1c30c2){_0x53b55f['push'](_0x53b55f['shift']());}};_0x71d9fa(++_0x7980d0);}(_0x0673,0x15d));var _0x3067=function(_0x2545a2,_0x459ce6){_0x2545a2=_0x2545a2-0x0;var _0x48b6cb=_0x0673[_0x2545a2];return _0x48b6cb;};'use strict';var EventEmitter=require(_0x3067('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x3067('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3067('0x2'),'afterUpdate':_0x3067('0x3'),'afterDestroy':_0x3067('0x4')};function emitEvent(_0x275682){return function(_0x3e9020,_0x581644,_0x24d836){OpenchannelMessageEvents[_0x3067('0x5')](_0x275682+':'+_0x3e9020['id'],_0x3e9020);OpenchannelMessageEvents[_0x3067('0x5')](_0x275682,_0x3e9020);_0x24d836(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x3067('0x6')](e,emitEvent(event));}}module[_0x3067('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index fa414b0..04efe1b 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 _0xcad4=['isNil','UserId','findOne','OpenchannelInteractionId','then','update','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','method','GET','POST','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','get','toLowerCase','direction','out','secret'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0xcad4,0x159));var _0x4cad=function(_0x23d8c3,_0x323336){_0x23d8c3=_0x23d8c3-0x0;var _0x90f27c=_0xcad4[_0x23d8c3];return _0x90f27c;};'use strict';var _=require(_0x4cad('0x0'));var util=require(_0x4cad('0x1'));var logger=require(_0x4cad('0x2'))(_0x4cad('0x3'));var moment=require('moment');var BPromise=require(_0x4cad('0x4'));var rp=require(_0x4cad('0x5'));var fs=require('fs');var path=require(_0x4cad('0x6'));var rimraf=require('rimraf');var config=require(_0x4cad('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x4cad('0x8')]=function(_0x4eb2cb,_0x52653e){return _0x4eb2cb[_0x4cad('0x9')](_0x4cad('0xa'),attributes,{'tableName':_0x4cad('0xb'),'paranoid':![],'indexes':[{'name':_0x4cad('0xc'),'fields':['body'],'type':_0x4cad('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4de990,_0x121693,_0x4a96df){var _0x426cfb=_0x4eb2cb['models'];var _0x48078a=_0x4de990[_0x4cad('0xe')]({'plain':!![]});if(_0x48078a['direction'][_0x4cad('0xf')]()==='in'||_0x48078a[_0x4cad('0x10')][_0x4cad('0xf')]()===_0x4cad('0x11')&&!_0x48078a[_0x4cad('0x12')]&&!_[_0x4cad('0x13')](_0x48078a[_0x4cad('0x14')])){_0x426cfb['OpenchannelInteraction'][_0x4cad('0x15')]({'where':{'id':_0x48078a[_0x4cad('0x16')]}})[_0x4cad('0x17')](function(_0x33cb6b){if(_0x33cb6b){_0x33cb6b[_0x4cad('0x18')]({'lastMsgAt':_0x48078a['createdAt'],'lastMsgDirection':_0x48078a[_0x4cad('0x10')][_0x4cad('0xf')]()});}})[_0x4cad('0x19')](function(_0x7fd2ad){console[_0x4cad('0x1a')](_0x7fd2ad);});}if(_0x48078a[_0x4cad('0x10')]===_0x4cad('0x11')&&!_0x48078a[_0x4cad('0x12')]){var _0x217719;_0x426cfb['CmContact'][_0x4cad('0x1b')]()[_0x4cad('0x17')](function(_0x424b01){return _0x426cfb[_0x4cad('0x1c')][_0x4cad('0x1d')]({'where':{'id':_0x48078a[_0x4cad('0x1e')]},'include':[{'model':_0x426cfb[_0x4cad('0x1f')],'as':_0x4cad('0x20'),'where':{'id':_0x48078a[_0x4cad('0x16')]},'limit':0x1,'include':[{'model':_0x426cfb[_0x4cad('0x21')],'as':_0x4cad('0x22'),'attributes':_[_0x4cad('0x23')](_0x424b01)}]}]});})['then'](function(_0x139a2a){_0x217719=_0x139a2a[_0x4cad('0xe')]({'plain':!![]});if(_0x217719&&_0x217719[_0x4cad('0x24')]){logger[_0x4cad('0x25')](_0x4cad('0x26'),'afterCreate',util[_0x4cad('0x27')](_0x4cad('0x28'),_0x48078a['id'],_0x217719[_0x4cad('0x24')]));if(_0x217719[_0x4cad('0x20')]&&_0x217719[_0x4cad('0x20')]['length']){_0x48078a[_0x4cad('0x29')]=_[_0x4cad('0x2a')](_0x217719[_0x4cad('0x20')][0x0],_0x4cad('0x22'));_0x48078a[_0x4cad('0x22')]=_0x217719['Interactions'][0x0]['Contact'];}var _0x121693={'method':'POST','uri':encodeURI(_0x217719['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x121693[_0x4cad('0x2b')]){case _0x4cad('0x2c'):_0x121693['qs']=_0x48078a;break;case _0x4cad('0x2d'):_0x121693['body']=_0x48078a;break;}return rp(_0x121693)[_0x4cad('0x17')](function(_0x381220){logger[_0x4cad('0x25')](_0x4cad('0x26'),_0x4cad('0x2e'),util[_0x4cad('0x27')](_0x4cad('0x2f'),_0x48078a['id'],_0x217719[_0x4cad('0x24')]));if(_0x381220[_0x4cad('0x30')][_0x4cad('0x31')]&&_0x381220[_0x4cad('0x30')][_0x4cad('0x31')]!=_0x48078a[_0x4cad('0x29')]['threadId']){return _0x426cfb[_0x4cad('0x1f')][_0x4cad('0x18')]({'threadId':_0x381220['body'][_0x4cad('0x31')]},{'logging':!![],'where':{'id':_0x48078a[_0x4cad('0x29')]['id']}});}else{return;}})[_0x4cad('0x17')](function(){return _0x4de990[_0x4cad('0x18')]({'read':!![]});})[_0x4cad('0x19')](function(_0x1a2e16){logger[_0x4cad('0x1a')](_0x4cad('0x26'),_0x4cad('0x2e'),util['inspect'](_0x1a2e16,{'showHidden':![],'depth':null}));_0x4a96df();});}else{_0x4a96df();}})[_0x4cad('0x32')](function(){_0x4a96df();});}else{_0x4a96df();}}},'charset':'utf8mb4','collate':_0x4cad('0x33')});}; \ No newline at end of file +var _0xd6f6=['fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','out','describe','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteractionId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','omit','POST','method','GET','body','threadId','Interaction','catch','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages'];(function(_0x1e2fd5,_0x1977a8){var _0x57d240=function(_0x416748){while(--_0x416748){_0x1e2fd5['push'](_0x1e2fd5['shift']());}};_0x57d240(++_0x1977a8);}(_0xd6f6,0x1c9));var _0x6d6f=function(_0x259f9b,_0x2ca700){_0x259f9b=_0x259f9b-0x0;var _0x564f77=_0xd6f6[_0x259f9b];return _0x564f77;};'use strict';var _=require(_0x6d6f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6d6f('0x1'));var BPromise=require(_0x6d6f('0x2'));var rp=require(_0x6d6f('0x3'));var fs=require('fs');var path=require(_0x6d6f('0x4'));var rimraf=require(_0x6d6f('0x5'));var config=require('../../config/environment');var attributes=require(_0x6d6f('0x6'));module[_0x6d6f('0x7')]=function(_0x247486,_0x94291b){return _0x247486[_0x6d6f('0x8')](_0x6d6f('0x9'),attributes,{'tableName':_0x6d6f('0xa'),'paranoid':![],'indexes':[{'name':_0x6d6f('0xb'),'fields':['body'],'type':_0x6d6f('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x193b3c,_0x1da641,_0xa4c7b4){var _0x22a439=_0x247486[_0x6d6f('0xd')];var _0x271388=_0x193b3c[_0x6d6f('0xe')]({'plain':!![]});if(_0x271388[_0x6d6f('0xf')][_0x6d6f('0x10')]()==='in'||_0x271388[_0x6d6f('0xf')][_0x6d6f('0x10')]()==='out'&&!_0x271388[_0x6d6f('0x11')]&&!_[_0x6d6f('0x12')](_0x271388[_0x6d6f('0x13')])){_0x22a439[_0x6d6f('0x14')][_0x6d6f('0x15')]({'where':{'id':_0x271388['OpenchannelInteractionId']}})[_0x6d6f('0x16')](function(_0x574dea){if(_0x574dea){_0x574dea[_0x6d6f('0x17')]({'lastMsgAt':_0x271388[_0x6d6f('0x18')],'lastMsgDirection':_0x271388[_0x6d6f('0xf')][_0x6d6f('0x10')]()});}})['catch'](function(_0x22201f){console['error'](_0x22201f);});}if(_0x271388[_0x6d6f('0xf')]===_0x6d6f('0x19')&&!_0x271388[_0x6d6f('0x11')]){var _0x3a362c;_0x22a439['CmContact'][_0x6d6f('0x1a')]()[_0x6d6f('0x16')](function(_0x384d3c){return _0x22a439[_0x6d6f('0x1b')]['find']({'where':{'id':_0x271388[_0x6d6f('0x1c')]},'include':[{'model':_0x22a439[_0x6d6f('0x14')],'as':'Interactions','where':{'id':_0x271388[_0x6d6f('0x1d')]},'limit':0x1,'include':[{'model':_0x22a439['CmContact'],'as':_0x6d6f('0x1e'),'attributes':_[_0x6d6f('0x1f')](_0x384d3c)}]}]});})[_0x6d6f('0x16')](function(_0x476246){_0x3a362c=_0x476246['get']({'plain':!![]});if(_0x3a362c&&_0x3a362c[_0x6d6f('0x20')]){logger['info'](_0x6d6f('0x21'),_0x6d6f('0x22'),util[_0x6d6f('0x23')](_0x6d6f('0x24'),_0x271388['id'],_0x3a362c[_0x6d6f('0x20')]));if(_0x3a362c['Interactions']&&_0x3a362c[_0x6d6f('0x25')][_0x6d6f('0x26')]){_0x271388['Interaction']=_[_0x6d6f('0x27')](_0x3a362c[_0x6d6f('0x25')][0x0],_0x6d6f('0x1e'));_0x271388[_0x6d6f('0x1e')]=_0x3a362c['Interactions'][0x0][_0x6d6f('0x1e')];}var _0x1da641={'method':_0x6d6f('0x28'),'uri':encodeURI(_0x3a362c[_0x6d6f('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1da641[_0x6d6f('0x29')]){case _0x6d6f('0x2a'):_0x1da641['qs']=_0x271388;break;case _0x6d6f('0x28'):_0x1da641[_0x6d6f('0x2b')]=_0x271388;break;}return rp(_0x1da641)[_0x6d6f('0x16')](function(_0x413ed3){logger['info'](_0x6d6f('0x21'),_0x6d6f('0x22'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x271388['id'],_0x3a362c[_0x6d6f('0x20')]));if(_0x413ed3[_0x6d6f('0x2b')][_0x6d6f('0x2c')]&&_0x413ed3[_0x6d6f('0x2b')][_0x6d6f('0x2c')]!=_0x271388[_0x6d6f('0x2d')][_0x6d6f('0x2c')]){return _0x22a439[_0x6d6f('0x14')][_0x6d6f('0x17')]({'threadId':_0x413ed3[_0x6d6f('0x2b')][_0x6d6f('0x2c')]},{'logging':!![],'where':{'id':_0x271388['Interaction']['id']}});}else{return;}})[_0x6d6f('0x16')](function(){return _0x193b3c[_0x6d6f('0x17')]({'read':!![]});})[_0x6d6f('0x2e')](function(_0x20c0fd){logger[_0x6d6f('0x2f')](_0x6d6f('0x21'),_0x6d6f('0x22'),util[_0x6d6f('0x30')](_0x20c0fd,{'showHidden':![],'depth':null}));_0xa4c7b4();});}else{_0xa4c7b4();}})[_0x6d6f('0x31')](function(){_0xa4c7b4();});}else{_0xa4c7b4();}}},'charset':_0x6d6f('0x32'),'collate':_0x6d6f('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 15174fb..1e59bf7 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 _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x3fc29f,_0x3dfa3f){var _0xe50bb8=function(_0x214495){while(--_0x214495){_0x3fc29f['push'](_0x3fc29f['shift']());}};_0xe50bb8(++_0x3dfa3f);}(_0xb10b,0x12a));var _0xbb10=function(_0x215e8e,_0x2e9b00){_0x215e8e=_0x215e8e-0x0;var _0x43ce3b=_0xb10b[_0x215e8e];return _0x43ce3b;};'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});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x15a4e2,_0xc1dab){var _0x465974=function(_0x4318c2){while(--_0x4318c2){_0x15a4e2['push'](_0x15a4e2['shift']());}};_0x465974(++_0xc1dab);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a0ae2,_0x4930df){_0x4a0ae2=_0x4a0ae2-0x0;var _0x3986a6=_0xb10b[_0x4a0ae2];return _0x3986a6;};'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});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 34949fe..87ae987 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 _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x3071('0x0'),_0x3071('0x1')];function createListener(_0x27405a,_0x305d85){return function(_0x864539){_0x305d85['emit'](_0x27405a,_0x864539);};}function removeListener(_0x2c547f,_0x7b18a4){return function(){OpenchannelMessageEvents[_0x3071('0x2')](_0x2c547f,_0x7b18a4);};}exports[_0x3071('0x3')]=function(_0xabd7b6){for(var _0x41cf76=0x0,_0x1d3dd6=events[_0x3071('0x4')];_0x41cf76<_0x1d3dd6;_0x41cf76++){var _0xbd737f=events[_0x41cf76];var _0x22274c=createListener(_0x3071('0x5')+_0xbd737f,_0xabd7b6);OpenchannelMessageEvents['on'](_0xbd737f,_0x22274c);}}; \ No newline at end of file +var _0x9c44=['emit','removeListener','length','openchannelMessage:','remove','update'];(function(_0x32de0a,_0x3a98b3){var _0x376921=function(_0x1ced57){while(--_0x1ced57){_0x32de0a['push'](_0x32de0a['shift']());}};_0x376921(++_0x3a98b3);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x49c4('0x0'),_0x49c4('0x1')];function createListener(_0x26844b,_0x1ba0bb){return function(_0x455700){_0x1ba0bb[_0x49c4('0x2')](_0x26844b,_0x455700);};}function removeListener(_0x4e0313,_0x4941f1){return function(){OpenchannelMessageEvents[_0x49c4('0x3')](_0x4e0313,_0x4941f1);};}exports['register']=function(_0xc1278f){for(var _0x6030ae=0x0,_0x69bc41=events[_0x49c4('0x4')];_0x6030ae<_0x69bc41;_0x6030ae++){var _0x436234=events[_0x6030ae];var _0x511d53=createListener(_0x49c4('0x5')+_0x436234,_0xc1278f);OpenchannelMessageEvents['on'](_0x436234,_0x511d53);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 2795c18..58c8be3 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 _0xa9e0=['post','create','/:id/teams','addTeams','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','show','/:id/members','isAuthenticated','getMembers','/:id/users','getAgents'];(function(_0x1dde5d,_0x433089){var _0x376ec1=function(_0x6a0d59){while(--_0x6a0d59){_0x1dde5d['push'](_0x1dde5d['shift']());}};_0x376ec1(++_0x433089);}(_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('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['post'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x11')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller['addAgents']);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0xd')](),controller['update']);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth['isAuthenticated'](),controller[_0x0a9e('0x18')]);router['delete'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);module[_0x0a9e('0x1b')]=router; \ No newline at end of file +var _0xa9e0=['post','create','/:id/teams','addTeams','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','show','/:id/members','isAuthenticated','getMembers','/:id/users','getAgents'];(function(_0x4d05a0,_0x53aa7e){var _0x4c999c=function(_0x358867){while(--_0x358867){_0x4d05a0['push'](_0x4d05a0['shift']());}};_0x4c999c(++_0x53aa7e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['post'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x11')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller['addAgents']);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0xd')](),controller['update']);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth['isAuthenticated'](),controller[_0x0a9e('0x18')]);router['delete'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);module[_0x0a9e('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 f63da13..543b979 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 _0x2f5e=['rrmemory','beepall','exports','STRING','INTEGER','ENUM'];(function(_0x5709e3,_0x3449a2){var _0x5e3262=function(_0x4b0b6f){while(--_0x4b0b6f){_0x5709e3['push'](_0x5709e3['shift']());}};_0x5e3262(++_0x3449a2);}(_0x2f5e,0xe0));var _0xe2f5=function(_0x55448c,_0x174be9){_0x55448c=_0x55448c-0x0;var _0x3b6b3a=_0x2f5e[_0x55448c];return _0x3b6b3a;};'use strict';var Sequelize=require('sequelize');module[_0xe2f5('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe2f5('0x1')]},'timeout':{'type':Sequelize[_0xe2f5('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe2f5('0x3')](_0xe2f5('0x4'),_0xe2f5('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xb3a4=['name','INTEGER','ENUM','rrmemory','beepall','STRING'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0xb3a4,0x77));var _0x4b3a=function(_0x273311,_0x20b491){_0x273311=_0x273311-0x0;var _0x115e77=_0xb3a4[_0x273311];return _0x115e77;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4b3a('0x0')],'unique':_0x4b3a('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4b3a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4b3a('0x3')](_0x4b3a('0x4'),_0x4b3a('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 1f85b5d..1e8ecb3 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 _0xfff8=['then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','send','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','length','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelQueue','include','findAll','rows','catch','show','rawAttributes','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','findOne','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update'];(function(_0x3cd93c,_0x352f49){var _0x138608=function(_0x405d25){while(--_0x405d25){_0x3cd93c['push'](_0x3cd93c['shift']());}};_0x138608(++_0x352f49);}(_0xfff8,0xf6));var _0x8fff=function(_0x952182,_0x331364){_0x952182=_0x952182-0x0;var _0x3accf0=_0xfff8[_0x952182];return _0x3accf0;};'use strict';var pdf=require(_0x8fff('0x0'));var emlformat=require(_0x8fff('0x1'));var rimraf=require(_0x8fff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8fff('0x3'));var rp=require(_0x8fff('0x4'));var moment=require(_0x8fff('0x5'));var BPromise=require(_0x8fff('0x6'));var Mustache=require(_0x8fff('0x7'));var util=require(_0x8fff('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x8fff('0x9'));var ejs=require(_0x8fff('0xa'));var fs=require('fs');var fs_extra=require(_0x8fff('0xb'));var _=require('lodash');var squel=require(_0x8fff('0xc'));var crypto=require(_0x8fff('0xd'));var jsforce=require(_0x8fff('0xe'));var deskjs=require(_0x8fff('0xf'));var toCsv=require(_0x8fff('0x9'));var querystring=require(_0x8fff('0x10'));var Papa=require(_0x8fff('0x11'));var Redis=require(_0x8fff('0x12'));var authService=require(_0x8fff('0x13'));var qs=require(_0x8fff('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8fff('0x15'))('api');var utils=require(_0x8fff('0x16'));var config=require(_0x8fff('0x17'));var licenseUtil=require(_0x8fff('0x18'));var db=require('../../mysqldb')['db'];config[_0x8fff('0x19')]=_[_0x8fff('0x1a')](config[_0x8fff('0x19')],{'host':_0x8fff('0x1b'),'port':0x18eb});var socket=require(_0x8fff('0x1c'))(new Redis(config[_0x8fff('0x19')]));require(_0x8fff('0x1d'))[_0x8fff('0x1e')](socket);function respondWithStatusCode(_0x912a3,_0x440f7e){_0x440f7e=_0x440f7e||0xcc;return function(_0x70049c){if(_0x70049c){return _0x912a3[_0x8fff('0x1f')](_0x440f7e);}return _0x912a3[_0x8fff('0x20')](_0x440f7e)[_0x8fff('0x21')]();};}function respondWithResult(_0x460b61,_0x217e57){_0x217e57=_0x217e57||0xc8;return function(_0x52068d){if(_0x52068d){return _0x460b61[_0x8fff('0x20')](_0x217e57)[_0x8fff('0x22')](_0x52068d);}};}function respondWithFilteredResult(_0x823e40,_0x43dcd3){return function(_0x427858){if(_0x427858){var _0x53e269=_0x427858[_0x8fff('0x23')],_0x46915c=_0x43dcd3[_0x8fff('0x24')],_0x5d375a=_0x43dcd3[_0x8fff('0x24')]+_0x43dcd3[_0x8fff('0x25')],_0x19dce2;if(_0x5d375a>=_0x53e269){_0x5d375a=_0x53e269;_0x19dce2=0xc8;}else{_0x19dce2=0xce;}_0x823e40[_0x8fff('0x20')](_0x19dce2);return _0x823e40[_0x8fff('0x26')](_0x8fff('0x27'),_0x46915c+'-'+_0x5d375a+'/'+_0x53e269)[_0x8fff('0x22')](_0x427858);}return null;};}function patchUpdates(_0x310748){return function(_0x293267){try{jsonpatch['apply'](_0x293267,_0x310748,!![]);}catch(_0x10e1e1){return BPromise['reject'](_0x10e1e1);}return _0x293267[_0x8fff('0x28')]();};}function saveUpdates(_0xe10f5d,_0x3293e0){return function(_0x57134c){if(_0x57134c){return _0x57134c[_0x8fff('0x29')](_0xe10f5d)[_0x8fff('0x2a')](function(_0x3f2a05){return _0x3f2a05;});}return null;};}function removeEntity(_0x35390a,_0x426c13){return function(_0x1af9aa){if(_0x1af9aa){return _0x1af9aa[_0x8fff('0x2b')]()['then'](function(){var _0x2c04c2=_0x1af9aa[_0x8fff('0x2c')]({'plain':!![]});var _0x3bf90a=_0x8fff('0x2d');return db[_0x8fff('0x2e')]['destroy']({'where':{'type':_0x3bf90a,'resourceId':_0x2c04c2['id']}})[_0x8fff('0x2a')](function(){return _0x1af9aa;});})[_0x8fff('0x2a')](function(){_0x35390a[_0x8fff('0x20')](0xcc)[_0x8fff('0x21')]();});}};}function handleEntityNotFound(_0x399791,_0x47a966){return function(_0x14f9cc){if(!_0x14f9cc){_0x399791[_0x8fff('0x1f')](0x194);}return _0x14f9cc;};}function handleError(_0x32c47a,_0x29bcc8){_0x29bcc8=_0x29bcc8||0x1f4;return function(_0x2def7e){logger['error'](_0x2def7e[_0x8fff('0x2f')]);if(_0x2def7e[_0x8fff('0x30')]){delete _0x2def7e['name'];}_0x32c47a['status'](_0x29bcc8)[_0x8fff('0x31')](_0x2def7e);};}exports['index']=function(_0x53791d,_0x307091){var _0xfee4ba={},_0x2275da={},_0x1132a9={'count':0x0,'rows':[]};var _0x3cfb23=_['map'](db['OpenchannelQueue']['rawAttributes'],function(_0x35a66c){return{'name':_0x35a66c[_0x8fff('0x32')],'type':_0x35a66c[_0x8fff('0x33')][_0x8fff('0x34')]};});_0x2275da['model']=_[_0x8fff('0x35')](_0x3cfb23,_0x8fff('0x30'));_0x2275da['query']=_[_0x8fff('0x36')](_0x53791d[_0x8fff('0x37')]);_0x2275da[_0x8fff('0x38')]=_[_0x8fff('0x39')](_0x2275da['model'],_0x2275da[_0x8fff('0x37')]);_0xfee4ba[_0x8fff('0x3a')]=_['intersection'](_0x2275da[_0x8fff('0x3b')],qs['fields'](_0x53791d[_0x8fff('0x37')]['fields']));_0xfee4ba[_0x8fff('0x3a')]=_0xfee4ba[_0x8fff('0x3a')][_0x8fff('0x3c')]?_0xfee4ba[_0x8fff('0x3a')]:_0x2275da[_0x8fff('0x3b')];if(!_0x53791d['query']['hasOwnProperty'](_0x8fff('0x3d'))){_0xfee4ba[_0x8fff('0x25')]=qs['limit'](_0x53791d['query'][_0x8fff('0x25')]);_0xfee4ba['offset']=qs[_0x8fff('0x24')](_0x53791d[_0x8fff('0x37')][_0x8fff('0x24')]);}_0xfee4ba[_0x8fff('0x3e')]=qs[_0x8fff('0x3f')](_0x53791d[_0x8fff('0x37')][_0x8fff('0x3f')]);_0xfee4ba[_0x8fff('0x40')]=qs[_0x8fff('0x38')](_[_0x8fff('0x41')](_0x53791d['query'],_0x2275da[_0x8fff('0x38')]),_0x3cfb23);if(_0x53791d[_0x8fff('0x37')][_0x8fff('0x42')]){_0xfee4ba['where']=_[_0x8fff('0x43')](_0xfee4ba[_0x8fff('0x40')],{'$or':_[_0x8fff('0x35')](_0x3cfb23,function(_0x4ea199){if(_0x4ea199['type']!=='VIRTUAL'){var _0xf1ff56={};_0xf1ff56[_0x4ea199[_0x8fff('0x30')]]={'$like':'%'+_0x53791d[_0x8fff('0x37')]['filter']+'%'};return _0xf1ff56;}})});}_0xfee4ba=_[_0x8fff('0x43')]({},_0xfee4ba,_0x53791d[_0x8fff('0x44')]);var _0x467ef1={'where':_0xfee4ba[_0x8fff('0x40')]};return db[_0x8fff('0x45')][_0x8fff('0x23')](_0x467ef1)['then'](function(_0x172aec){_0x1132a9[_0x8fff('0x23')]=_0x172aec;if(_0x53791d[_0x8fff('0x37')]['includeAll']){_0xfee4ba[_0x8fff('0x46')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x8fff('0x47')](_0xfee4ba);})[_0x8fff('0x2a')](function(_0x43c2ad){_0x1132a9[_0x8fff('0x48')]=_0x43c2ad;return _0x1132a9;})[_0x8fff('0x2a')](respondWithFilteredResult(_0x307091,_0xfee4ba))[_0x8fff('0x49')](handleError(_0x307091,null));};exports[_0x8fff('0x4a')]=function(_0x19dc11,_0x290e99){var _0x40f6fd={'raw':!![],'where':{'id':_0x19dc11['params']['id']}},_0x549417={};_0x549417['model']=_[_0x8fff('0x36')](db['OpenchannelQueue'][_0x8fff('0x4b')]);_0x549417[_0x8fff('0x37')]=_[_0x8fff('0x36')](_0x19dc11[_0x8fff('0x37')]);_0x549417[_0x8fff('0x38')]=_[_0x8fff('0x39')](_0x549417[_0x8fff('0x3b')],_0x549417[_0x8fff('0x37')]);_0x40f6fd[_0x8fff('0x3a')]=_[_0x8fff('0x39')](_0x549417[_0x8fff('0x3b')],qs[_0x8fff('0x4c')](_0x19dc11[_0x8fff('0x37')][_0x8fff('0x4c')]));_0x40f6fd['attributes']=_0x40f6fd['attributes'][_0x8fff('0x3c')]?_0x40f6fd['attributes']:_0x549417['model'];if(_0x19dc11[_0x8fff('0x37')]['includeAll']){_0x40f6fd[_0x8fff('0x46')]=[{'all':!![]}];}_0x40f6fd=_[_0x8fff('0x43')]({},_0x40f6fd,_0x19dc11[_0x8fff('0x44')]);return db['OpenchannelQueue']['find'](_0x40f6fd)[_0x8fff('0x2a')](handleEntityNotFound(_0x290e99,null))['then'](respondWithResult(_0x290e99,null))[_0x8fff('0x49')](handleError(_0x290e99,null));};exports['create']=function(_0x11caba,_0x54234e){return db['OpenchannelQueue'][_0x8fff('0x4d')](_0x11caba[_0x8fff('0x4e')],{})[_0x8fff('0x2a')](function(_0x9c6851){var _0x38b46c=_0x11caba[_0x8fff('0x4f')]['get']({'plain':!![]});if(!_0x38b46c)throw new Error(_0x8fff('0x50'));if(_0x38b46c[_0x8fff('0x51')]==='user'){var _0x5f136d=_0x9c6851[_0x8fff('0x2c')]({'plain':!![]});var _0x4c7ceb=_0x8fff('0x2d');return db[_0x8fff('0x52')][_0x8fff('0x53')]({'where':{'name':_0x4c7ceb,'userProfileId':_0x38b46c[_0x8fff('0x54')]},'raw':!![]})[_0x8fff('0x2a')](function(_0x595be2){if(_0x595be2&&_0x595be2[_0x8fff('0x55')]===0x0){return db[_0x8fff('0x2e')]['create']({'name':_0x5f136d[_0x8fff('0x30')],'resourceId':_0x5f136d['id'],'type':_0x595be2[_0x8fff('0x30')],'sectionId':_0x595be2['id']},{})[_0x8fff('0x2a')](function(){return _0x9c6851;});}else{return _0x9c6851;}})[_0x8fff('0x49')](function(_0x3aa0d8){logger[_0x8fff('0x56')](_0x8fff('0x57'),_0x3aa0d8);throw _0x3aa0d8;});}return _0x9c6851;})[_0x8fff('0x2a')](respondWithResult(_0x54234e,0xc9))['catch'](handleError(_0x54234e,null));};exports[_0x8fff('0x29')]=function(_0x148c94,_0x4f1627){if(_0x148c94['body']['id']){delete _0x148c94[_0x8fff('0x4e')]['id'];}return db[_0x8fff('0x45')][_0x8fff('0x53')]({'where':{'id':_0x148c94[_0x8fff('0x58')]['id']}})[_0x8fff('0x2a')](handleEntityNotFound(_0x4f1627,null))[_0x8fff('0x2a')](saveUpdates(_0x148c94[_0x8fff('0x4e')],null))[_0x8fff('0x2a')](respondWithResult(_0x4f1627,null))['catch'](handleError(_0x4f1627,null));};exports[_0x8fff('0x2b')]=function(_0x5e6045,_0x1cc0ec){return db['OpenchannelQueue'][_0x8fff('0x53')]({'where':{'id':_0x5e6045[_0x8fff('0x58')]['id']}})[_0x8fff('0x2a')](handleEntityNotFound(_0x1cc0ec,null))[_0x8fff('0x2a')](removeEntity(_0x1cc0ec,null))[_0x8fff('0x49')](handleError(_0x1cc0ec,null));};exports['describe']=function(_0x158d09,_0xa9d1c1){return db[_0x8fff('0x45')]['describe']()[_0x8fff('0x2a')](respondWithResult(_0xa9d1c1,null))['catch'](handleError(_0xa9d1c1,null));};exports[_0x8fff('0x59')]=function(_0x2c561c,_0x1c18f9,_0x3e94c2){var _0x38f892={'raw':!![],'where':{}},_0x1e4c2a={},_0x3392a8;return db[_0x8fff('0x45')]['findOne']({'where':{'id':_0x2c561c['params']['id']}})[_0x8fff('0x2a')](handleEntityNotFound(_0x1c18f9,null))[_0x8fff('0x2a')](function(_0xa0cb2a){if(_0xa0cb2a){_0x3392a8=_0xa0cb2a['get']({'plain':!![]});_0x1e4c2a[_0x8fff('0x3b')]=_[_0x8fff('0x36')](db[_0x8fff('0x5a')]['rawAttributes']);_0x1e4c2a[_0x8fff('0x37')]=_['keys'](_0x2c561c[_0x8fff('0x37')]);_0x1e4c2a['filters']=_[_0x8fff('0x39')](_0x1e4c2a[_0x8fff('0x3b')],_0x1e4c2a[_0x8fff('0x37')]);_0x38f892['attributes']=_[_0x8fff('0x39')](_0x1e4c2a[_0x8fff('0x3b')],qs[_0x8fff('0x4c')](_0x2c561c['query']['fields']));_0x38f892['attributes']=_0x38f892[_0x8fff('0x3a')][_0x8fff('0x3c')]?_0x38f892[_0x8fff('0x3a')]:_0x1e4c2a[_0x8fff('0x3b')];if(!_0x2c561c[_0x8fff('0x37')][_0x8fff('0x5b')](_0x8fff('0x3d'))){_0x38f892[_0x8fff('0x25')]=qs[_0x8fff('0x25')](_0x2c561c[_0x8fff('0x37')][_0x8fff('0x25')]);_0x38f892[_0x8fff('0x24')]=qs[_0x8fff('0x24')](_0x2c561c[_0x8fff('0x37')][_0x8fff('0x24')]);}_0x38f892[_0x8fff('0x3e')]=qs[_0x8fff('0x3f')](_0x2c561c[_0x8fff('0x37')][_0x8fff('0x3f')]);_0x38f892['where']=qs[_0x8fff('0x38')](_['pick'](_0x2c561c['query'],_0x1e4c2a[_0x8fff('0x38')]));_0x38f892[_0x8fff('0x40')][_0x8fff('0x5c')]=_0xa0cb2a['id'];if(_0x2c561c[_0x8fff('0x37')][_0x8fff('0x42')]){_0x38f892[_0x8fff('0x40')]=_['merge'](_0x38f892['where'],{'$or':_['map'](_0x38f892[_0x8fff('0x3a')],function(_0x73bf31){var _0x2c12ae={};_0x2c12ae[_0x73bf31]={'$like':'%'+_0x2c561c['query']['filter']+'%'};return _0x2c12ae;})});}_0x38f892=_[_0x8fff('0x43')]({},_0x38f892,_0x2c561c[_0x8fff('0x44')]);return db[_0x8fff('0x5a')][_0x8fff('0x47')](_0x38f892);}})[_0x8fff('0x2a')](function(_0x4c02db){if(_0x4c02db){return db[_0x8fff('0x5d')][_0x8fff('0x5e')]({'where':{'id':_[_0x8fff('0x35')](_0x4c02db,'UserId'),'role':_0x8fff('0x5f')},'attributes':['id',_0x8fff('0x30'),_0x8fff('0x60'),_0x8fff('0x61'),_0x8fff('0x62')]});}})[_0x8fff('0x2a')](function(_0x5d4713){if(_0x5d4713){return{'count':_0x5d4713['count'],'rows':_[_0x8fff('0x35')](_0x5d4713[_0x8fff('0x48')],function(_0x44bdfa){return{'membername':_0x44bdfa[_0x8fff('0x30')],'UserId':_0x44bdfa['id'],'queue_name':_0x3392a8['name'],'OpenchannelQueueId':_0x3392a8['id'],'interface':util[_0x8fff('0x63')](_0x8fff('0x64'),'SIP',_0x44bdfa[_0x8fff('0x30')]),'penalty':0x0,'paused':_0x44bdfa[_0x8fff('0x60')],'createdAt':_0x44bdfa[_0x8fff('0x62')],'updatedAt':_0x44bdfa['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8fff('0x2a')](respondWithFilteredResult(_0x1c18f9,_0x38f892))[_0x8fff('0x49')](handleError(_0x1c18f9,null));};exports[_0x8fff('0x65')]=function(_0x1ba510,_0x202bd5,_0x560c70){var _0x30ed4f={};var _0x6005eb={};var _0x188667;var _0x2ad4fc;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x1ba510[_0x8fff('0x58')]['id']}})[_0x8fff('0x2a')](handleEntityNotFound(_0x202bd5,null))['then'](function(_0x40cfe2){if(_0x40cfe2){_0x188667=_0x40cfe2;_0x6005eb[_0x8fff('0x3b')]=_['keys'](db[_0x8fff('0x66')][_0x8fff('0x4b')]);_0x6005eb[_0x8fff('0x37')]=_[_0x8fff('0x36')](_0x1ba510[_0x8fff('0x37')]);_0x6005eb[_0x8fff('0x38')]=_[_0x8fff('0x39')](_0x6005eb['model'],_0x6005eb['query']);_0x30ed4f['attributes']=_['intersection'](_0x6005eb['model'],qs[_0x8fff('0x4c')](_0x1ba510[_0x8fff('0x37')][_0x8fff('0x4c')]));_0x30ed4f[_0x8fff('0x3a')]=_0x30ed4f['attributes']['length']?_0x30ed4f['attributes']:_0x6005eb['model'];_0x30ed4f[_0x8fff('0x3e')]=qs[_0x8fff('0x3f')](_0x1ba510[_0x8fff('0x37')][_0x8fff('0x3f')]);_0x30ed4f[_0x8fff('0x40')]=qs['filters'](_['pick'](_0x1ba510[_0x8fff('0x37')],_0x6005eb[_0x8fff('0x38')]));if(_0x1ba510[_0x8fff('0x37')][_0x8fff('0x42')]){_0x30ed4f[_0x8fff('0x40')]=_[_0x8fff('0x43')](_0x30ed4f['where'],{'$or':_[_0x8fff('0x35')](_0x30ed4f[_0x8fff('0x3a')],function(_0x389cc1){var _0x5b035a={};_0x5b035a[_0x389cc1]={'$like':'%'+_0x1ba510[_0x8fff('0x37')][_0x8fff('0x42')]+'%'};return _0x5b035a;})});}_0x30ed4f=_['merge']({},_0x30ed4f,_0x1ba510['options']);return _0x188667[_0x8fff('0x65')](_0x30ed4f);}})[_0x8fff('0x2a')](function(_0x3e35a3){if(_0x3e35a3){_0x2ad4fc=_0x3e35a3[_0x8fff('0x3c')];if(!_0x1ba510['query']['hasOwnProperty'](_0x8fff('0x3d'))){_0x30ed4f[_0x8fff('0x25')]=qs[_0x8fff('0x25')](_0x1ba510[_0x8fff('0x37')]['limit']);_0x30ed4f[_0x8fff('0x24')]=qs[_0x8fff('0x24')](_0x1ba510[_0x8fff('0x37')][_0x8fff('0x24')]);}return _0x188667[_0x8fff('0x65')](_0x30ed4f);}})[_0x8fff('0x2a')](function(_0x1cfad6){if(_0x1cfad6){return _0x1cfad6?{'count':_0x2ad4fc,'rows':_0x1cfad6}:null;}})[_0x8fff('0x2a')](respondWithResult(_0x202bd5,null))[_0x8fff('0x49')](handleError(_0x202bd5,null));};exports[_0x8fff('0x67')]=function(_0x29e8c8,_0x58e108,_0x8c0c){var _0x51c8e1=_0x29e8c8[_0x8fff('0x4e')][_0x8fff('0x68')];return db[_0x8fff('0x66')]['findAll']({'where':{'id':_0x51c8e1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8fff('0x69'),'attributes':['id','name',_0x8fff('0x6a'),_0x8fff('0x6b'),_0x8fff('0x6c')],'raw':!![]}]})[_0x8fff('0x2a')](function(_0x2507be){if(_0x2507be){var _0x1279be=_[_0x8fff('0x6d')](_0x2507be,function(_0x4ecdba){var _0x73dc42=_0x4ecdba[_0x8fff('0x2c')]({'plain':!![]});return _0x73dc42[_0x8fff('0x69')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x29e8c8[_0x8fff('0x58')]['id']}})[_0x8fff('0x2a')](function(_0x3cb7e9){return db[_0x8fff('0x6e')][_0x8fff('0x6f')](function(_0x5dd23a){return _0x3cb7e9[_0x8fff('0x67')](_0x51c8e1,{'transaction':_0x5dd23a})[_0x8fff('0x2a')](function(){return BPromise['each'](_0x1279be,function(_0x47b640){return db[_0x8fff('0x5a')]['findOrCreate']({'where':{'UserId':_0x47b640['id'],'OpenchannelQueueId':_0x29e8c8[_0x8fff('0x58')]['id']},'transaction':_0x5dd23a});});})[_0x8fff('0x2a')](function(){_0x1279be[_0x8fff('0x70')](function(_0x5c01af){socket[_0x8fff('0x71')](_0x8fff('0x72'),{'UserId':_0x5c01af['id'],'OpenchannelQueueId':_0x3cb7e9['id']});});});});});}})[_0x8fff('0x2a')](respondWithStatusCode(_0x58e108,null))[_0x8fff('0x49')](handleError(_0x58e108,null));};exports['removeTeams']=function(_0xa1a58b,_0x3bb428,_0x7f5925){return db['Team'][_0x8fff('0x47')]({'where':{'id':_0xa1a58b[_0x8fff('0x37')][_0x8fff('0x68')]},'attributes':['id'],'include':[{'model':db[_0x8fff('0x5d')],'as':_0x8fff('0x69'),'attributes':['id'],'raw':!![]}]})[_0x8fff('0x2a')](handleEntityNotFound(_0x3bb428,null))[_0x8fff('0x2a')](function(_0x45374d){var _0x3595d4=_['map'](_0x45374d,'id');var _0x5f4ce8=[];var _0x42986d=[];var _0x1f127b=squel[_0x8fff('0x73')]();_0x1f127b[_0x8fff('0x74')](_0x8fff('0x75'))[_0x8fff('0x76')]('team_has_openchannel_queues','tq')[_0x8fff('0x77')]('user_has_teams','ut',_0x8fff('0x78'))[_0x8fff('0x40')](_0x8fff('0x79'),_0xa1a58b['params']['id']);for(var _0x310643=0x0;_0x310643<_0x45374d[_0x8fff('0x3c')];_0x310643+=0x1){let _0x27a826=_0x45374d[_0x310643];for(var _0x59ca80=0x0;_0x59ca80<_0x27a826[_0x8fff('0x69')]['length'];_0x59ca80+=0x1){let _0x4f7506=_0x27a826[_0x8fff('0x69')][_0x59ca80];var _0x308c57=_0x1f127b[_0x8fff('0x7a')]();_0x308c57['where'](_0x8fff('0x7b'),_0x4f7506['id']);_0x42986d[_0x8fff('0x7c')](db[_0x8fff('0x6e')][_0x8fff('0x37')](_0x308c57[_0x8fff('0x7d')](),{'type':db['sequelize'][_0x8fff('0x7e')][_0x8fff('0x7f')]})[_0x8fff('0x2a')](function(_0x4aca27){if(_0x4aca27[_0x8fff('0x3c')]===0x1){return _0x4f7506['id'];}else{var _0x48eb0e=_[_0x8fff('0x80')](_[_0x8fff('0x35')](_0x4aca27,_0x8fff('0x81')),function(_0x462cbf){return _[_0x8fff('0x82')](_0x3595d4,_0x462cbf);});if(_0x48eb0e){return _0x4f7506['id'];}}}));}}return BPromise[_0x8fff('0x83')](_0x42986d)['then'](function(_0x2bf059){_0x5f4ce8=_(_0x5f4ce8)[_0x8fff('0x84')](_0x2bf059)[_0x8fff('0x85')]()[_0x8fff('0x86')]();return db['OpenchannelQueue'][_0x8fff('0x53')]({'where':{'id':_0xa1a58b[_0x8fff('0x58')]['id']}})[_0x8fff('0x2a')](function(_0x577d40){return db[_0x8fff('0x6e')]['transaction'](function(_0x45ad31){return _0x577d40['removeTeams'](_0xa1a58b[_0x8fff('0x37')][_0x8fff('0x68')],{'transaction':_0x45ad31})['then'](function(){if(!_[_0x8fff('0x87')](_0x5f4ce8)){return _0x577d40[_0x8fff('0x88')](_0x5f4ce8,{'transaction':_0x45ad31});}})[_0x8fff('0x2a')](function(){_0x5f4ce8[_0x8fff('0x70')](function(_0x2d6dd4){socket[_0x8fff('0x71')]('userOpenchannelQueue:remove',{'UserId':_0x2d6dd4,'OpenchannelQueueId':_0x577d40['id']});});});});});});})['then'](respondWithStatusCode(_0x3bb428,null))['catch'](handleError(_0x3bb428,null));};exports[_0x8fff('0x89')]=function(_0x1c719f,_0x1b84f5,_0x2b5110){return db[_0x8fff('0x45')][_0x8fff('0x53')]({'where':{'id':_0x1c719f[_0x8fff('0x58')]['id']}})[_0x8fff('0x2a')](handleEntityNotFound(_0x1b84f5,null))[_0x8fff('0x2a')](function(_0x43fb3d){if(_0x43fb3d){return _0x43fb3d[_0x8fff('0x89')](_0x1c719f[_0x8fff('0x4e')][_0x8fff('0x68')],_[_0x8fff('0x8a')](_0x1c719f['body'],[_0x8fff('0x68'),'id'])||{})[_0x8fff('0x8b')](function(_0x27d65c){for(var _0x2c68e7=0x0;_0x2c68e7<_0x1c719f[_0x8fff('0x4e')]['ids'][_0x8fff('0x3c')];_0x2c68e7+=0x1){socket[_0x8fff('0x71')](_0x8fff('0x72'),{'UserId':_0x1c719f[_0x8fff('0x4e')][_0x8fff('0x68')][_0x2c68e7],'OpenchannelQueueId':_0x1c719f[_0x8fff('0x58')]['id']});}return _0x27d65c;});}})[_0x8fff('0x2a')](respondWithResult(_0x1b84f5,null))[_0x8fff('0x49')](handleError(_0x1b84f5,null));};exports['removeAgents']=function(_0x58f0bd,_0x45d674,_0x344cba){return db[_0x8fff('0x45')][_0x8fff('0x53')]({'where':{'id':_0x58f0bd[_0x8fff('0x58')]['id']}})['then'](handleEntityNotFound(_0x45d674,null))[_0x8fff('0x2a')](function(_0x922f9b){if(_0x922f9b){return _0x922f9b[_0x8fff('0x88')](_0x58f0bd[_0x8fff('0x37')][_0x8fff('0x68')])[_0x8fff('0x2a')](function(){if(_[_0x8fff('0x8c')](_0x58f0bd[_0x8fff('0x37')][_0x8fff('0x68')])){for(var _0x555758=0x0;_0x555758<_0x58f0bd[_0x8fff('0x37')][_0x8fff('0x68')]['length'];_0x555758+=0x1){socket[_0x8fff('0x71')](_0x8fff('0x8d'),{'UserId':Number(_0x58f0bd[_0x8fff('0x37')]['ids'][_0x555758]),'OpenchannelQueueId':Number(_0x58f0bd[_0x8fff('0x58')]['id'])});}}else{socket[_0x8fff('0x71')](_0x8fff('0x8d'),{'UserId':Number(_0x58f0bd[_0x8fff('0x37')]['ids']),'OpenchannelQueueId':Number(_0x58f0bd[_0x8fff('0x58')]['id'])});}});}})[_0x8fff('0x2a')](respondWithStatusCode(_0x45d674,null))[_0x8fff('0x49')](handleError(_0x45d674,null));};exports[_0x8fff('0x8e')]=function(_0x332dbe,_0x5b9289,_0x4edadc){var _0x466701={};var _0x981b27={};var _0x31b0fe;var _0x54d061;return db[_0x8fff('0x45')][_0x8fff('0x8f')]({'where':{'id':_0x332dbe['params']['id']}})['then'](handleEntityNotFound(_0x5b9289,null))[_0x8fff('0x2a')](function(_0x48df0e){if(_0x48df0e){_0x31b0fe=_0x48df0e;_0x981b27['model']=_[_0x8fff('0x36')](db[_0x8fff('0x5d')][_0x8fff('0x4b')]);_0x981b27[_0x8fff('0x37')]=_['keys'](_0x332dbe[_0x8fff('0x37')]);_0x981b27['filters']=_[_0x8fff('0x39')](_0x981b27['model'],_0x981b27[_0x8fff('0x37')]);_0x466701['attributes']=_[_0x8fff('0x39')](_0x981b27[_0x8fff('0x3b')],qs[_0x8fff('0x4c')](_0x332dbe[_0x8fff('0x37')]['fields']));_0x466701['attributes']=_0x466701[_0x8fff('0x3a')][_0x8fff('0x3c')]?_0x466701[_0x8fff('0x3a')]:_0x981b27['model'];_0x466701[_0x8fff('0x3e')]=qs['sort'](_0x332dbe['query'][_0x8fff('0x3f')]);_0x466701['where']=qs['filters'](_[_0x8fff('0x41')](_0x332dbe[_0x8fff('0x37')],_0x981b27['filters']));if(_0x332dbe['query'][_0x8fff('0x42')]){_0x466701[_0x8fff('0x40')]=_['merge'](_0x466701[_0x8fff('0x40')],{'$or':_['map'](_0x466701[_0x8fff('0x3a')],function(_0x3a10f4){var _0x263d2a={};_0x263d2a[_0x3a10f4]={'$like':'%'+_0x332dbe[_0x8fff('0x37')][_0x8fff('0x42')]+'%'};return _0x263d2a;})});}_0x466701=_[_0x8fff('0x43')]({},_0x466701,_0x332dbe[_0x8fff('0x44')]);return _0x31b0fe[_0x8fff('0x8e')](_0x466701);}})['then'](function(_0x333b28){if(_0x333b28){_0x54d061=_0x333b28[_0x8fff('0x3c')];if(!_0x332dbe['query'][_0x8fff('0x5b')](_0x8fff('0x3d'))){_0x466701['limit']=qs[_0x8fff('0x25')](_0x332dbe[_0x8fff('0x37')]['limit']);_0x466701[_0x8fff('0x24')]=qs[_0x8fff('0x24')](_0x332dbe['query']['offset']);}return _0x31b0fe[_0x8fff('0x8e')](_0x466701);}})[_0x8fff('0x2a')](function(_0x59e9c7){if(_0x59e9c7){return _0x59e9c7?{'count':_0x54d061,'rows':_0x59e9c7}:null;}})[_0x8fff('0x2a')](respondWithResult(_0x5b9289,null))['catch'](handleError(_0x5b9289,null));}; \ No newline at end of file +var _0x4e7e=['VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','online','sequelize','transaction','each','findOrCreate','forEach','removeTeams','Agents','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','value','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','emit','userOpenchannelQueue:save','isArray','getAgents','html-pdf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','json','count','offset','limit','set','apply','save','update','destroy','then','get','OpenchannelQueues','UserProfileResource','end','error','name','send','OpenchannelQueue','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0xc3f429,_0x3f834a){var _0x58a570=function(_0x16d414){while(--_0x16d414){_0xc3f429['push'](_0xc3f429['shift']());}};_0x58a570(++_0x3f834a);}(_0x4e7e,0x1c9));var _0xe4e7=function(_0x1ae6df,_0x366d03){_0x1ae6df=_0x1ae6df-0x0;var _0x21f039=_0x4e7e[_0x1ae6df];return _0x21f039;};'use strict';var pdf=require(_0xe4e7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe4e7('0x1'));var rp=require(_0xe4e7('0x2'));var moment=require(_0xe4e7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe4e7('0x4'));var util=require(_0xe4e7('0x5'));var path=require(_0xe4e7('0x6'));var sox=require('sox');var csv=require(_0xe4e7('0x7'));var ejs=require(_0xe4e7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe4e7('0x9'));var crypto=require(_0xe4e7('0xa'));var jsforce=require(_0xe4e7('0xb'));var deskjs=require(_0xe4e7('0xc'));var toCsv=require(_0xe4e7('0x7'));var querystring=require(_0xe4e7('0xd'));var Papa=require(_0xe4e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe4e7('0xf'));var hardwareService=require(_0xe4e7('0x10'));var logger=require(_0xe4e7('0x11'))('api');var utils=require(_0xe4e7('0x12'));var config=require(_0xe4e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xe4e7('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xe4e7('0x15'))(new Redis(config[_0xe4e7('0x14')]));require(_0xe4e7('0x16'))['register'](socket);function respondWithStatusCode(_0x382a74,_0x53150f){_0x53150f=_0x53150f||0xcc;return function(_0x5687b4){if(_0x5687b4){return _0x382a74[_0xe4e7('0x17')](_0x53150f);}return _0x382a74[_0xe4e7('0x18')](_0x53150f)['end']();};}function respondWithResult(_0x594205,_0x2dad63){_0x2dad63=_0x2dad63||0xc8;return function(_0x34d6f8){if(_0x34d6f8){return _0x594205[_0xe4e7('0x18')](_0x2dad63)[_0xe4e7('0x19')](_0x34d6f8);}};}function respondWithFilteredResult(_0x46a025,_0x204d21){return function(_0xc16d38){if(_0xc16d38){var _0x23756f=_0xc16d38[_0xe4e7('0x1a')],_0x413781=_0x204d21[_0xe4e7('0x1b')],_0x40928d=_0x204d21['offset']+_0x204d21[_0xe4e7('0x1c')],_0x3f2a92;if(_0x40928d>=_0x23756f){_0x40928d=_0x23756f;_0x3f2a92=0xc8;}else{_0x3f2a92=0xce;}_0x46a025[_0xe4e7('0x18')](_0x3f2a92);return _0x46a025[_0xe4e7('0x1d')]('Content-Range',_0x413781+'-'+_0x40928d+'/'+_0x23756f)[_0xe4e7('0x19')](_0xc16d38);}return null;};}function patchUpdates(_0x22a0a6){return function(_0x1e0533){try{jsonpatch[_0xe4e7('0x1e')](_0x1e0533,_0x22a0a6,!![]);}catch(_0x56ddb4){return BPromise['reject'](_0x56ddb4);}return _0x1e0533[_0xe4e7('0x1f')]();};}function saveUpdates(_0x22fd43,_0x25eb70){return function(_0x4dad5d){if(_0x4dad5d){return _0x4dad5d[_0xe4e7('0x20')](_0x22fd43)['then'](function(_0x4e727a){return _0x4e727a;});}return null;};}function removeEntity(_0x3aa51d,_0x5043bf){return function(_0x333bbb){if(_0x333bbb){return _0x333bbb[_0xe4e7('0x21')]()[_0xe4e7('0x22')](function(){var _0x8d04dd=_0x333bbb[_0xe4e7('0x23')]({'plain':!![]});var _0x48bfa9=_0xe4e7('0x24');return db[_0xe4e7('0x25')][_0xe4e7('0x21')]({'where':{'type':_0x48bfa9,'resourceId':_0x8d04dd['id']}})[_0xe4e7('0x22')](function(){return _0x333bbb;});})[_0xe4e7('0x22')](function(){_0x3aa51d[_0xe4e7('0x18')](0xcc)[_0xe4e7('0x26')]();});}};}function handleEntityNotFound(_0x1f5fe2,_0x45a288){return function(_0x119221){if(!_0x119221){_0x1f5fe2[_0xe4e7('0x17')](0x194);}return _0x119221;};}function handleError(_0x141eb2,_0x2662f7){_0x2662f7=_0x2662f7||0x1f4;return function(_0x5b9672){logger[_0xe4e7('0x27')](_0x5b9672['stack']);if(_0x5b9672[_0xe4e7('0x28')]){delete _0x5b9672['name'];}_0x141eb2['status'](_0x2662f7)[_0xe4e7('0x29')](_0x5b9672);};}exports['index']=function(_0x36d7a0,_0x5dd00f){var _0x557868={},_0x4c4dd1={},_0x26191f={'count':0x0,'rows':[]};var _0x40a7f0=_['map'](db[_0xe4e7('0x2a')][_0xe4e7('0x2b')],function(_0x230948){return{'name':_0x230948[_0xe4e7('0x2c')],'type':_0x230948[_0xe4e7('0x2d')][_0xe4e7('0x2e')]};});_0x4c4dd1['model']=_[_0xe4e7('0x2f')](_0x40a7f0,_0xe4e7('0x28'));_0x4c4dd1[_0xe4e7('0x30')]=_[_0xe4e7('0x31')](_0x36d7a0[_0xe4e7('0x30')]);_0x4c4dd1[_0xe4e7('0x32')]=_[_0xe4e7('0x33')](_0x4c4dd1[_0xe4e7('0x34')],_0x4c4dd1[_0xe4e7('0x30')]);_0x557868[_0xe4e7('0x35')]=_['intersection'](_0x4c4dd1[_0xe4e7('0x34')],qs[_0xe4e7('0x36')](_0x36d7a0['query']['fields']));_0x557868[_0xe4e7('0x35')]=_0x557868[_0xe4e7('0x35')][_0xe4e7('0x37')]?_0x557868[_0xe4e7('0x35')]:_0x4c4dd1['model'];if(!_0x36d7a0['query'][_0xe4e7('0x38')](_0xe4e7('0x39'))){_0x557868['limit']=qs[_0xe4e7('0x1c')](_0x36d7a0[_0xe4e7('0x30')][_0xe4e7('0x1c')]);_0x557868['offset']=qs['offset'](_0x36d7a0['query'][_0xe4e7('0x1b')]);}_0x557868[_0xe4e7('0x3a')]=qs[_0xe4e7('0x3b')](_0x36d7a0['query'][_0xe4e7('0x3b')]);_0x557868[_0xe4e7('0x3c')]=qs[_0xe4e7('0x32')](_[_0xe4e7('0x3d')](_0x36d7a0['query'],_0x4c4dd1[_0xe4e7('0x32')]),_0x40a7f0);if(_0x36d7a0[_0xe4e7('0x30')]['filter']){_0x557868[_0xe4e7('0x3c')]=_[_0xe4e7('0x3e')](_0x557868[_0xe4e7('0x3c')],{'$or':_['map'](_0x40a7f0,function(_0x491e9c){if(_0x491e9c['type']!==_0xe4e7('0x3f')){var _0x277d24={};_0x277d24[_0x491e9c['name']]={'$like':'%'+_0x36d7a0[_0xe4e7('0x30')][_0xe4e7('0x40')]+'%'};return _0x277d24;}})});}_0x557868=_[_0xe4e7('0x3e')]({},_0x557868,_0x36d7a0[_0xe4e7('0x41')]);var _0x148ce4={'where':_0x557868[_0xe4e7('0x3c')]};return db[_0xe4e7('0x2a')][_0xe4e7('0x1a')](_0x148ce4)[_0xe4e7('0x22')](function(_0x5a02ee){_0x26191f[_0xe4e7('0x1a')]=_0x5a02ee;if(_0x36d7a0[_0xe4e7('0x30')]['includeAll']){_0x557868[_0xe4e7('0x42')]=[{'all':!![]}];}return db[_0xe4e7('0x2a')][_0xe4e7('0x43')](_0x557868);})[_0xe4e7('0x22')](function(_0x14b8c1){_0x26191f[_0xe4e7('0x44')]=_0x14b8c1;return _0x26191f;})[_0xe4e7('0x22')](respondWithFilteredResult(_0x5dd00f,_0x557868))[_0xe4e7('0x45')](handleError(_0x5dd00f,null));};exports[_0xe4e7('0x46')]=function(_0x273b44,_0x551e87){var _0x9b0d2a={'raw':!![],'where':{'id':_0x273b44[_0xe4e7('0x47')]['id']}},_0x516093={};_0x516093[_0xe4e7('0x34')]=_['keys'](db['OpenchannelQueue']['rawAttributes']);_0x516093[_0xe4e7('0x30')]=_[_0xe4e7('0x31')](_0x273b44['query']);_0x516093['filters']=_['intersection'](_0x516093[_0xe4e7('0x34')],_0x516093[_0xe4e7('0x30')]);_0x9b0d2a[_0xe4e7('0x35')]=_[_0xe4e7('0x33')](_0x516093['model'],qs['fields'](_0x273b44['query']['fields']));_0x9b0d2a['attributes']=_0x9b0d2a[_0xe4e7('0x35')][_0xe4e7('0x37')]?_0x9b0d2a[_0xe4e7('0x35')]:_0x516093['model'];if(_0x273b44[_0xe4e7('0x30')][_0xe4e7('0x48')]){_0x9b0d2a[_0xe4e7('0x42')]=[{'all':!![]}];}_0x9b0d2a=_[_0xe4e7('0x3e')]({},_0x9b0d2a,_0x273b44[_0xe4e7('0x41')]);return db['OpenchannelQueue'][_0xe4e7('0x49')](_0x9b0d2a)[_0xe4e7('0x22')](handleEntityNotFound(_0x551e87,null))[_0xe4e7('0x22')](respondWithResult(_0x551e87,null))['catch'](handleError(_0x551e87,null));};exports[_0xe4e7('0x4a')]=function(_0x237ed9,_0x3dbfca){return db[_0xe4e7('0x2a')][_0xe4e7('0x4a')](_0x237ed9[_0xe4e7('0x4b')],{})[_0xe4e7('0x22')](function(_0x240303){var _0x1fb14d=_0x237ed9['user']['get']({'plain':!![]});if(!_0x1fb14d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fb14d[_0xe4e7('0x4c')]===_0xe4e7('0x4d')){var _0x15f478=_0x240303[_0xe4e7('0x23')]({'plain':!![]});var _0x1a5f8c='OpenchannelQueues';return db[_0xe4e7('0x4e')][_0xe4e7('0x49')]({'where':{'name':_0x1a5f8c,'userProfileId':_0x1fb14d[_0xe4e7('0x4f')]},'raw':!![]})[_0xe4e7('0x22')](function(_0x51a938){if(_0x51a938&&_0x51a938['autoAssociation']===0x0){return db[_0xe4e7('0x25')][_0xe4e7('0x4a')]({'name':_0x15f478['name'],'resourceId':_0x15f478['id'],'type':_0x51a938[_0xe4e7('0x28')],'sectionId':_0x51a938['id']},{})[_0xe4e7('0x22')](function(){return _0x240303;});}else{return _0x240303;}})['catch'](function(_0x270071){logger[_0xe4e7('0x27')](_0xe4e7('0x50'),_0x270071);throw _0x270071;});}return _0x240303;})[_0xe4e7('0x22')](respondWithResult(_0x3dbfca,0xc9))['catch'](handleError(_0x3dbfca,null));};exports['update']=function(_0x425241,_0x332127){if(_0x425241[_0xe4e7('0x4b')]['id']){delete _0x425241[_0xe4e7('0x4b')]['id'];}return db['OpenchannelQueue'][_0xe4e7('0x49')]({'where':{'id':_0x425241[_0xe4e7('0x47')]['id']}})['then'](handleEntityNotFound(_0x332127,null))['then'](saveUpdates(_0x425241[_0xe4e7('0x4b')],null))[_0xe4e7('0x22')](respondWithResult(_0x332127,null))['catch'](handleError(_0x332127,null));};exports[_0xe4e7('0x21')]=function(_0x47b233,_0x186437){return db[_0xe4e7('0x2a')][_0xe4e7('0x49')]({'where':{'id':_0x47b233[_0xe4e7('0x47')]['id']}})[_0xe4e7('0x22')](handleEntityNotFound(_0x186437,null))[_0xe4e7('0x22')](removeEntity(_0x186437,null))['catch'](handleError(_0x186437,null));};exports[_0xe4e7('0x51')]=function(_0x3e3faf,_0x5ef447){return db[_0xe4e7('0x2a')]['describe']()[_0xe4e7('0x22')](respondWithResult(_0x5ef447,null))[_0xe4e7('0x45')](handleError(_0x5ef447,null));};exports[_0xe4e7('0x52')]=function(_0xb5c4ab,_0x6c00da,_0x4dcb9c){var _0x635448={'raw':!![],'where':{}},_0x34f475={},_0x5458b3;return db['OpenchannelQueue'][_0xe4e7('0x53')]({'where':{'id':_0xb5c4ab[_0xe4e7('0x47')]['id']}})[_0xe4e7('0x22')](handleEntityNotFound(_0x6c00da,null))['then'](function(_0x51c1d7){if(_0x51c1d7){_0x5458b3=_0x51c1d7['get']({'plain':!![]});_0x34f475['model']=_['keys'](db[_0xe4e7('0x54')][_0xe4e7('0x2b')]);_0x34f475[_0xe4e7('0x30')]=_['keys'](_0xb5c4ab[_0xe4e7('0x30')]);_0x34f475[_0xe4e7('0x32')]=_[_0xe4e7('0x33')](_0x34f475[_0xe4e7('0x34')],_0x34f475[_0xe4e7('0x30')]);_0x635448[_0xe4e7('0x35')]=_[_0xe4e7('0x33')](_0x34f475[_0xe4e7('0x34')],qs[_0xe4e7('0x36')](_0xb5c4ab[_0xe4e7('0x30')]['fields']));_0x635448[_0xe4e7('0x35')]=_0x635448['attributes']['length']?_0x635448[_0xe4e7('0x35')]:_0x34f475[_0xe4e7('0x34')];if(!_0xb5c4ab['query'][_0xe4e7('0x38')](_0xe4e7('0x39'))){_0x635448[_0xe4e7('0x1c')]=qs[_0xe4e7('0x1c')](_0xb5c4ab[_0xe4e7('0x30')][_0xe4e7('0x1c')]);_0x635448[_0xe4e7('0x1b')]=qs[_0xe4e7('0x1b')](_0xb5c4ab[_0xe4e7('0x30')][_0xe4e7('0x1b')]);}_0x635448['order']=qs[_0xe4e7('0x3b')](_0xb5c4ab[_0xe4e7('0x30')]['sort']);_0x635448[_0xe4e7('0x3c')]=qs[_0xe4e7('0x32')](_[_0xe4e7('0x3d')](_0xb5c4ab[_0xe4e7('0x30')],_0x34f475[_0xe4e7('0x32')]));_0x635448[_0xe4e7('0x3c')]['OpenchannelQueueId']=_0x51c1d7['id'];if(_0xb5c4ab[_0xe4e7('0x30')][_0xe4e7('0x40')]){_0x635448['where']=_[_0xe4e7('0x3e')](_0x635448[_0xe4e7('0x3c')],{'$or':_[_0xe4e7('0x2f')](_0x635448[_0xe4e7('0x35')],function(_0x2f579d){var _0x3d5966={};_0x3d5966[_0x2f579d]={'$like':'%'+_0xb5c4ab['query'][_0xe4e7('0x40')]+'%'};return _0x3d5966;})});}_0x635448=_[_0xe4e7('0x3e')]({},_0x635448,_0xb5c4ab[_0xe4e7('0x41')]);return db[_0xe4e7('0x54')]['findAll'](_0x635448);}})[_0xe4e7('0x22')](function(_0x58f5d5){if(_0x58f5d5){return db[_0xe4e7('0x55')][_0xe4e7('0x56')]({'where':{'id':_[_0xe4e7('0x2f')](_0x58f5d5,_0xe4e7('0x57')),'role':_0xe4e7('0x58')},'attributes':['id',_0xe4e7('0x28'),_0xe4e7('0x59'),_0xe4e7('0x5a'),_0xe4e7('0x5b')]});}})[_0xe4e7('0x22')](function(_0x3f5ac1){if(_0x3f5ac1){return{'count':_0x3f5ac1[_0xe4e7('0x1a')],'rows':_[_0xe4e7('0x2f')](_0x3f5ac1[_0xe4e7('0x44')],function(_0x3e4797){return{'membername':_0x3e4797[_0xe4e7('0x28')],'UserId':_0x3e4797['id'],'queue_name':_0x5458b3[_0xe4e7('0x28')],'OpenchannelQueueId':_0x5458b3['id'],'interface':util[_0xe4e7('0x5c')](_0xe4e7('0x5d'),_0xe4e7('0x5e'),_0x3e4797[_0xe4e7('0x28')]),'penalty':0x0,'paused':_0x3e4797[_0xe4e7('0x59')],'createdAt':_0x3e4797[_0xe4e7('0x5b')],'updatedAt':_0x3e4797[_0xe4e7('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x6c00da,_0x635448))['catch'](handleError(_0x6c00da,null));};exports[_0xe4e7('0x5f')]=function(_0x128620,_0x457572,_0x1b982a){var _0x352d5b={};var _0x4698a0={};var _0x258567;var _0x585ca7;return db[_0xe4e7('0x2a')][_0xe4e7('0x53')]({'where':{'id':_0x128620[_0xe4e7('0x47')]['id']}})['then'](handleEntityNotFound(_0x457572,null))['then'](function(_0x3535b0){if(_0x3535b0){_0x258567=_0x3535b0;_0x4698a0['model']=_['keys'](db['Team'][_0xe4e7('0x2b')]);_0x4698a0[_0xe4e7('0x30')]=_['keys'](_0x128620[_0xe4e7('0x30')]);_0x4698a0[_0xe4e7('0x32')]=_[_0xe4e7('0x33')](_0x4698a0[_0xe4e7('0x34')],_0x4698a0[_0xe4e7('0x30')]);_0x352d5b[_0xe4e7('0x35')]=_[_0xe4e7('0x33')](_0x4698a0[_0xe4e7('0x34')],qs[_0xe4e7('0x36')](_0x128620[_0xe4e7('0x30')][_0xe4e7('0x36')]));_0x352d5b['attributes']=_0x352d5b[_0xe4e7('0x35')][_0xe4e7('0x37')]?_0x352d5b['attributes']:_0x4698a0[_0xe4e7('0x34')];_0x352d5b[_0xe4e7('0x3a')]=qs['sort'](_0x128620[_0xe4e7('0x30')]['sort']);_0x352d5b['where']=qs[_0xe4e7('0x32')](_['pick'](_0x128620[_0xe4e7('0x30')],_0x4698a0['filters']));if(_0x128620[_0xe4e7('0x30')][_0xe4e7('0x40')]){_0x352d5b['where']=_[_0xe4e7('0x3e')](_0x352d5b[_0xe4e7('0x3c')],{'$or':_[_0xe4e7('0x2f')](_0x352d5b['attributes'],function(_0xba5ac5){var _0x401a62={};_0x401a62[_0xba5ac5]={'$like':'%'+_0x128620['query'][_0xe4e7('0x40')]+'%'};return _0x401a62;})});}_0x352d5b=_['merge']({},_0x352d5b,_0x128620[_0xe4e7('0x41')]);return _0x258567[_0xe4e7('0x5f')](_0x352d5b);}})[_0xe4e7('0x22')](function(_0x1a296c){if(_0x1a296c){_0x585ca7=_0x1a296c[_0xe4e7('0x37')];if(!_0x128620['query'][_0xe4e7('0x38')]('nolimit')){_0x352d5b[_0xe4e7('0x1c')]=qs['limit'](_0x128620[_0xe4e7('0x30')]['limit']);_0x352d5b[_0xe4e7('0x1b')]=qs['offset'](_0x128620[_0xe4e7('0x30')][_0xe4e7('0x1b')]);}return _0x258567['getTeams'](_0x352d5b);}})[_0xe4e7('0x22')](function(_0x2f8ebc){if(_0x2f8ebc){return _0x2f8ebc?{'count':_0x585ca7,'rows':_0x2f8ebc}:null;}})['then'](respondWithResult(_0x457572,null))[_0xe4e7('0x45')](handleError(_0x457572,null));};exports[_0xe4e7('0x60')]=function(_0x529630,_0x444b57,_0x4693cd){var _0x4d7d5d=_0x529630[_0xe4e7('0x4b')][_0xe4e7('0x61')];return db[_0xe4e7('0x62')][_0xe4e7('0x43')]({'where':{'id':_0x4d7d5d},'attributes':['id'],'include':[{'model':db[_0xe4e7('0x55')],'as':'Agents','attributes':['id',_0xe4e7('0x28'),_0xe4e7('0x63'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x3448c2){if(_0x3448c2){var _0x351615=_['flatMap'](_0x3448c2,function(_0x4e0d19){var _0x544ed0=_0x4e0d19[_0xe4e7('0x23')]({'plain':!![]});return _0x544ed0['Agents'];});return db[_0xe4e7('0x2a')]['find']({'where':{'id':_0x529630['params']['id']}})[_0xe4e7('0x22')](function(_0x5f25be){return db[_0xe4e7('0x64')][_0xe4e7('0x65')](function(_0x20f4fe){return _0x5f25be[_0xe4e7('0x60')](_0x4d7d5d,{'transaction':_0x20f4fe})['then'](function(){return BPromise[_0xe4e7('0x66')](_0x351615,function(_0x24199e){return db['UserOpenchannelQueue'][_0xe4e7('0x67')]({'where':{'UserId':_0x24199e['id'],'OpenchannelQueueId':_0x529630[_0xe4e7('0x47')]['id']},'transaction':_0x20f4fe});});})['then'](function(){_0x351615[_0xe4e7('0x68')](function(_0x1ba94c){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x1ba94c['id'],'OpenchannelQueueId':_0x5f25be['id']});});});});});}})[_0xe4e7('0x22')](respondWithStatusCode(_0x444b57,null))[_0xe4e7('0x45')](handleError(_0x444b57,null));};exports[_0xe4e7('0x69')]=function(_0x3f6689,_0x437c13,_0x1c4308){return db[_0xe4e7('0x62')][_0xe4e7('0x43')]({'where':{'id':_0x3f6689['query'][_0xe4e7('0x61')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe4e7('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x437c13,null))[_0xe4e7('0x22')](function(_0x63b0e8){var _0x23d0c9=_[_0xe4e7('0x2f')](_0x63b0e8,'id');var _0x544494=[];var _0x11da50=[];var _0x40f910=squel['select']();_0x40f910[_0xe4e7('0x6b')](_0xe4e7('0x6c'))['from'](_0xe4e7('0x6d'),'tq')[_0xe4e7('0x6e')](_0xe4e7('0x6f'),'ut',_0xe4e7('0x70'))[_0xe4e7('0x3c')](_0xe4e7('0x71'),_0x3f6689[_0xe4e7('0x47')]['id']);for(var _0x12e1e0=0x0;_0x12e1e0<_0x63b0e8['length'];_0x12e1e0+=0x1){let _0x484d91=_0x63b0e8[_0x12e1e0];for(var _0x1a8ea0=0x0;_0x1a8ea0<_0x484d91[_0xe4e7('0x6a')][_0xe4e7('0x37')];_0x1a8ea0+=0x1){let _0x93f661=_0x484d91[_0xe4e7('0x6a')][_0x1a8ea0];var _0x3ae29a=_0x40f910['clone']();_0x3ae29a[_0xe4e7('0x3c')](_0xe4e7('0x72'),_0x93f661['id']);_0x11da50['push'](db[_0xe4e7('0x64')][_0xe4e7('0x30')](_0x3ae29a[_0xe4e7('0x73')](),{'type':db[_0xe4e7('0x64')]['QueryTypes']['SELECT']})[_0xe4e7('0x22')](function(_0x18aa9b){if(_0x18aa9b['length']===0x1){return _0x93f661['id'];}else{var _0x215352=_[_0xe4e7('0x74')](_[_0xe4e7('0x2f')](_0x18aa9b,_0xe4e7('0x75')),function(_0x391467){return _[_0xe4e7('0x76')](_0x23d0c9,_0x391467);});if(_0x215352){return _0x93f661['id'];}}}));}}return BPromise[_0xe4e7('0x77')](_0x11da50)[_0xe4e7('0x22')](function(_0x5ccbfc){_0x544494=_(_0x544494)['union'](_0x5ccbfc)['compact']()[_0xe4e7('0x78')]();return db[_0xe4e7('0x2a')][_0xe4e7('0x49')]({'where':{'id':_0x3f6689[_0xe4e7('0x47')]['id']}})[_0xe4e7('0x22')](function(_0x5e9876){return db[_0xe4e7('0x64')][_0xe4e7('0x65')](function(_0x572256){return _0x5e9876[_0xe4e7('0x69')](_0x3f6689['query'][_0xe4e7('0x61')],{'transaction':_0x572256})[_0xe4e7('0x22')](function(){if(!_['isEmpty'](_0x544494)){return _0x5e9876[_0xe4e7('0x79')](_0x544494,{'transaction':_0x572256});}})['then'](function(){_0x544494['forEach'](function(_0x38129c){socket['emit'](_0xe4e7('0x7a'),{'UserId':_0x38129c,'OpenchannelQueueId':_0x5e9876['id']});});});});});});})[_0xe4e7('0x22')](respondWithStatusCode(_0x437c13,null))[_0xe4e7('0x45')](handleError(_0x437c13,null));};exports[_0xe4e7('0x7b')]=function(_0x240903,_0x55c84e,_0x13c558){return db['OpenchannelQueue']['find']({'where':{'id':_0x240903[_0xe4e7('0x47')]['id']}})[_0xe4e7('0x22')](handleEntityNotFound(_0x55c84e,null))[_0xe4e7('0x22')](function(_0x45b637){if(_0x45b637){return _0x45b637[_0xe4e7('0x7b')](_0x240903[_0xe4e7('0x4b')][_0xe4e7('0x61')],_[_0xe4e7('0x7c')](_0x240903['body'],[_0xe4e7('0x61'),'id'])||{})[_0xe4e7('0x7d')](function(_0x2f7b49){for(var _0x38cd22=0x0;_0x38cd22<_0x240903[_0xe4e7('0x4b')]['ids']['length'];_0x38cd22+=0x1){socket[_0xe4e7('0x7e')](_0xe4e7('0x7f'),{'UserId':_0x240903[_0xe4e7('0x4b')][_0xe4e7('0x61')][_0x38cd22],'OpenchannelQueueId':_0x240903['params']['id']});}return _0x2f7b49;});}})[_0xe4e7('0x22')](respondWithResult(_0x55c84e,null))['catch'](handleError(_0x55c84e,null));};exports['removeAgents']=function(_0x45ca5b,_0x176e6a,_0x562c46){return db[_0xe4e7('0x2a')][_0xe4e7('0x49')]({'where':{'id':_0x45ca5b[_0xe4e7('0x47')]['id']}})[_0xe4e7('0x22')](handleEntityNotFound(_0x176e6a,null))[_0xe4e7('0x22')](function(_0x34401b){if(_0x34401b){return _0x34401b[_0xe4e7('0x79')](_0x45ca5b[_0xe4e7('0x30')][_0xe4e7('0x61')])[_0xe4e7('0x22')](function(){if(_[_0xe4e7('0x80')](_0x45ca5b[_0xe4e7('0x30')][_0xe4e7('0x61')])){for(var _0x5d4c18=0x0;_0x5d4c18<_0x45ca5b[_0xe4e7('0x30')][_0xe4e7('0x61')][_0xe4e7('0x37')];_0x5d4c18+=0x1){socket[_0xe4e7('0x7e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x45ca5b[_0xe4e7('0x30')][_0xe4e7('0x61')][_0x5d4c18]),'OpenchannelQueueId':Number(_0x45ca5b[_0xe4e7('0x47')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x45ca5b[_0xe4e7('0x30')][_0xe4e7('0x61')]),'OpenchannelQueueId':Number(_0x45ca5b[_0xe4e7('0x47')]['id'])});}});}})[_0xe4e7('0x22')](respondWithStatusCode(_0x176e6a,null))[_0xe4e7('0x45')](handleError(_0x176e6a,null));};exports[_0xe4e7('0x81')]=function(_0x8080ae,_0xff787d,_0x20636e){var _0x18dce1={};var _0x392733={};var _0x59e1a0;var _0x2e923b;return db['OpenchannelQueue'][_0xe4e7('0x53')]({'where':{'id':_0x8080ae[_0xe4e7('0x47')]['id']}})['then'](handleEntityNotFound(_0xff787d,null))[_0xe4e7('0x22')](function(_0x46b51a){if(_0x46b51a){_0x59e1a0=_0x46b51a;_0x392733['model']=_['keys'](db[_0xe4e7('0x55')][_0xe4e7('0x2b')]);_0x392733[_0xe4e7('0x30')]=_[_0xe4e7('0x31')](_0x8080ae['query']);_0x392733[_0xe4e7('0x32')]=_[_0xe4e7('0x33')](_0x392733[_0xe4e7('0x34')],_0x392733[_0xe4e7('0x30')]);_0x18dce1['attributes']=_[_0xe4e7('0x33')](_0x392733[_0xe4e7('0x34')],qs[_0xe4e7('0x36')](_0x8080ae[_0xe4e7('0x30')]['fields']));_0x18dce1[_0xe4e7('0x35')]=_0x18dce1['attributes'][_0xe4e7('0x37')]?_0x18dce1[_0xe4e7('0x35')]:_0x392733[_0xe4e7('0x34')];_0x18dce1[_0xe4e7('0x3a')]=qs[_0xe4e7('0x3b')](_0x8080ae[_0xe4e7('0x30')][_0xe4e7('0x3b')]);_0x18dce1[_0xe4e7('0x3c')]=qs[_0xe4e7('0x32')](_[_0xe4e7('0x3d')](_0x8080ae[_0xe4e7('0x30')],_0x392733['filters']));if(_0x8080ae['query']['filter']){_0x18dce1['where']=_[_0xe4e7('0x3e')](_0x18dce1[_0xe4e7('0x3c')],{'$or':_['map'](_0x18dce1[_0xe4e7('0x35')],function(_0x2ab087){var _0x49748b={};_0x49748b[_0x2ab087]={'$like':'%'+_0x8080ae[_0xe4e7('0x30')][_0xe4e7('0x40')]+'%'};return _0x49748b;})});}_0x18dce1=_[_0xe4e7('0x3e')]({},_0x18dce1,_0x8080ae[_0xe4e7('0x41')]);return _0x59e1a0[_0xe4e7('0x81')](_0x18dce1);}})[_0xe4e7('0x22')](function(_0x117be5){if(_0x117be5){_0x2e923b=_0x117be5[_0xe4e7('0x37')];if(!_0x8080ae[_0xe4e7('0x30')][_0xe4e7('0x38')](_0xe4e7('0x39'))){_0x18dce1['limit']=qs[_0xe4e7('0x1c')](_0x8080ae['query'][_0xe4e7('0x1c')]);_0x18dce1[_0xe4e7('0x1b')]=qs[_0xe4e7('0x1b')](_0x8080ae[_0xe4e7('0x30')][_0xe4e7('0x1b')]);}return _0x59e1a0[_0xe4e7('0x81')](_0x18dce1);}})[_0xe4e7('0x22')](function(_0x36997b){if(_0x36997b){return _0x36997b?{'count':_0x2e923b,'rows':_0x36997b}:null;}})[_0xe4e7('0x22')](respondWithResult(_0xff787d,null))[_0xe4e7('0x45')](handleError(_0xff787d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index cee69c1..69a243d 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 _0xb3f2=['emit','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0xb3f2,0x14d));var _0x2b3f=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xb3f2[_0x500419];return _0x241c1a;};'use strict';var EventEmitter=require(_0x2b3f('0x0'));var OpenchannelQueue=require(_0x2b3f('0x1'))['db'][_0x2b3f('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2b3f('0x3')](0x0);var events={'afterCreate':_0x2b3f('0x4'),'afterUpdate':_0x2b3f('0x5'),'afterDestroy':_0x2b3f('0x6')};function emitEvent(_0x450424){return function(_0xf0511c,_0x3d2525,_0x1baad5){OpenchannelQueueEvents[_0x2b3f('0x7')](_0x450424+':'+_0xf0511c['id'],_0xf0511c);OpenchannelQueueEvents['emit'](_0x450424,_0xf0511c);_0x1baad5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x2b3f('0x8')](e,emitEvent(event));}}module[_0x2b3f('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xc39e=['exports','../../mysqldb','save','remove','emit','hasOwnProperty','hook'];(function(_0x8f9d16,_0x315791){var _0x39ca42=function(_0x5a9348){while(--_0x5a9348){_0x8f9d16['push'](_0x8f9d16['shift']());}};_0x39ca42(++_0x315791);}(_0xc39e,0x127));var _0xec39=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0xc39e[_0xf55e73];return _0x116b99;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xec39('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xec39('0x1'),'afterUpdate':'update','afterDestroy':_0xec39('0x2')};function emitEvent(_0x4933ed){return function(_0x3f4af7,_0x9b86c9,_0x1011d2){OpenchannelQueueEvents[_0xec39('0x3')](_0x4933ed+':'+_0x3f4af7['id'],_0x3f4af7);OpenchannelQueueEvents[_0xec39('0x3')](_0x4933ed,_0x3f4af7);_0x1011d2(null);};}for(var e in events){if(events[_0xec39('0x4')](e)){var event=events[e];OpenchannelQueue[_0xec39('0x5')](e,emitEvent(event));}}module[_0xec39('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 70eb80c..e7fdef3 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 _0x3e1f=['api','moment','bluebird','request-promise','path','rimraf','exports','OpenchannelQueue','openchannel_queues','lodash','../../config/logger'];(function(_0x1ffb8e,_0x1544c9){var _0x462b75=function(_0x50507b){while(--_0x50507b){_0x1ffb8e['push'](_0x1ffb8e['shift']());}};_0x462b75(++_0x1544c9);}(_0x3e1f,0xe5));var _0xf3e1=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x3e1f[_0x254b22];return _0x1279db;};'use strict';var _=require(_0xf3e1('0x0'));var util=require('util');var logger=require(_0xf3e1('0x1'))(_0xf3e1('0x2'));var moment=require(_0xf3e1('0x3'));var BPromise=require(_0xf3e1('0x4'));var rp=require(_0xf3e1('0x5'));var fs=require('fs');var path=require(_0xf3e1('0x6'));var rimraf=require(_0xf3e1('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0xf3e1('0x8')]=function(_0x3ee96e,_0x4e24f3){return _0x3ee96e['define'](_0xf3e1('0x9'),attributes,{'tableName':_0xf3e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac85=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue','openchannel_queues'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0xac85,0x1a0));var _0x5ac8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xac85[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x5ac8('0x0'));var util=require(_0x5ac8('0x1'));var logger=require(_0x5ac8('0x2'))(_0x5ac8('0x3'));var moment=require(_0x5ac8('0x4'));var BPromise=require(_0x5ac8('0x5'));var rp=require(_0x5ac8('0x6'));var fs=require('fs');var path=require(_0x5ac8('0x7'));var rimraf=require(_0x5ac8('0x8'));var config=require(_0x5ac8('0x9'));var attributes=require(_0x5ac8('0xa'));module['exports']=function(_0x39dddc,_0x1422ff){return _0x39dddc['define'](_0x5ac8('0xb'),attributes,{'tableName':_0x5ac8('0xc'),'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 b0ff0b7..d0671c3 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 _0x203b=['stringify','error','code','message','request\x20sent','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','raw','options','limit','include','map','model','attributes','find','where','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x56fcf6,_0x401b3c){var _0x2078a7=function(_0x4f2790){while(--_0x4f2790){_0x56fcf6['push'](_0x56fcf6['shift']());}};_0x2078a7(++_0x401b3c);}(_0x203b,0x15c));var _0xb203=function(_0x3cfb5e,_0x114615){_0x3cfb5e=_0x3cfb5e-0x0;var _0x30be38=_0x203b[_0x3cfb5e];return _0x30be38;};'use strict';var _=require(_0xb203('0x0'));var util=require('util');var moment=require(_0xb203('0x1'));var BPromise=require(_0xb203('0x2'));var rs=require(_0xb203('0x3'));var fs=require('fs');var Redis=require(_0xb203('0x4'));var db=require(_0xb203('0x5'))['db'];var utils=require(_0xb203('0x6'));var logger=require(_0xb203('0x7'))(_0xb203('0x8'));var config=require(_0xb203('0x9'));var jayson=require(_0xb203('0xa'));var client=jayson['client'][_0xb203('0xb')]({'port':0x232a});config[_0xb203('0xc')]=_['defaults'](config[_0xb203('0xc')],{'host':_0xb203('0xd'),'port':0x18eb});var socket=require(_0xb203('0xe'))(new Redis(config[_0xb203('0xc')]));require('./openchannelQueue.socket')[_0xb203('0xf')](socket);function respondWithRpcPromise(_0x4df780,_0x18ef75,_0x5d1598){return new BPromise(function(_0x56fabf,_0x53d157){return client['request'](_0x4df780,_0x5d1598)[_0xb203('0x10')](function(_0x28caed){logger[_0xb203('0x11')](_0xb203('0x12'),_0x18ef75,'request\x20sent');logger[_0xb203('0x13')](_0xb203('0x14'),_0x18ef75,'request\x20sent',JSON[_0xb203('0x15')](_0x28caed));if(_0x28caed[_0xb203('0x16')]){if(_0x28caed[_0xb203('0x16')][_0xb203('0x17')]===0x1f4){logger['error'](_0xb203('0x12'),_0x18ef75,_0x28caed[_0xb203('0x16')][_0xb203('0x18')]);return _0x53d157(_0x28caed[_0xb203('0x16')][_0xb203('0x18')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x18ef75,_0x28caed[_0xb203('0x16')][_0xb203('0x18')]);return _0x56fabf(_0x28caed[_0xb203('0x16')][_0xb203('0x18')]);}else{logger[_0xb203('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x18ef75,_0xb203('0x19'));_0x56fabf(_0x28caed[_0xb203('0x1a')][_0xb203('0x18')]);}})[_0xb203('0x1b')](function(_0x56ccd7){logger[_0xb203('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x18ef75,_0x56ccd7);_0x53d157(_0x56ccd7);});});}exports[_0xb203('0x1c')]=function(_0x41595f){var _0x2fc740=this;return new Promise(function(_0x4ac477,_0x30605e){return db[_0xb203('0x1d')][_0xb203('0x1e')]({'raw':_0x41595f['options']?_0x41595f['options'][_0xb203('0x1f')]===undefined?!![]:![]:!![],'where':_0x41595f['options']?_0x41595f[_0xb203('0x20')]['where']||null:null,'attributes':_0x41595f[_0xb203('0x20')]?_0x41595f['options']['attributes']||null:null,'limit':_0x41595f[_0xb203('0x20')]?_0x41595f[_0xb203('0x20')][_0xb203('0x21')]||null:null,'include':_0x41595f[_0xb203('0x20')]?_0x41595f[_0xb203('0x20')][_0xb203('0x22')]?_[_0xb203('0x23')](_0x41595f[_0xb203('0x20')]['include'],function(_0x300d05){return{'model':db[_0x300d05[_0xb203('0x24')]],'as':_0x300d05['as'],'attributes':_0x300d05[_0xb203('0x25')],'include':_0x300d05[_0xb203('0x22')]?_[_0xb203('0x23')](_0x300d05['include'],function(_0x4a6c85){return{'model':db[_0x4a6c85[_0xb203('0x24')]],'as':_0x4a6c85['as'],'attributes':_0x4a6c85[_0xb203('0x25')],'include':_0x4a6c85['include']?_['map'](_0x4a6c85['include'],function(_0x50fb5b){return{'model':db[_0x50fb5b[_0xb203('0x24')]],'as':_0x50fb5b['as'],'attributes':_0x50fb5b[_0xb203('0x25')]};}):[]};}):[]};}):[]:[]})[_0xb203('0x10')](function(_0x55f3bc){logger[_0xb203('0x11')](_0xb203('0x1c'),_0x41595f);logger['debug']('GetOpenchannelQueue',_0x41595f,JSON['stringify'](_0x55f3bc));_0x4ac477(_0x55f3bc);})[_0xb203('0x1b')](function(_0x1b4910){logger['error'](_0xb203('0x1c'),_0x1b4910[_0xb203('0x18')],_0x41595f);_0x30605e(_0x2fc740[_0xb203('0x16')](0x1f4,_0x1b4910[_0xb203('0x18')]));});});};exports['ShowOpenchannelQueue']=function(_0xdb4937){var _0x464347=this;return new Promise(function(_0x24885d,_0x15cbd1){return db[_0xb203('0x1d')][_0xb203('0x26')]({'raw':_0xdb4937[_0xb203('0x20')]?_0xdb4937[_0xb203('0x20')][_0xb203('0x1f')]===undefined?!![]:![]:!![],'where':_0xdb4937[_0xb203('0x20')]?_0xdb4937['options'][_0xb203('0x27')]||null:null,'attributes':_0xdb4937['options']?_0xdb4937['options'][_0xb203('0x25')]||null:null,'include':_0xdb4937[_0xb203('0x20')]?_0xdb4937[_0xb203('0x20')]['include']?_['map'](_0xdb4937[_0xb203('0x20')]['include'],function(_0x2555da){return{'model':db[_0x2555da[_0xb203('0x24')]],'as':_0x2555da['as'],'attributes':_0x2555da[_0xb203('0x25')],'include':_0x2555da[_0xb203('0x22')]?_[_0xb203('0x23')](_0x2555da['include'],function(_0x24116b){return{'model':db[_0x24116b[_0xb203('0x24')]],'as':_0x24116b['as'],'attributes':_0x24116b['attributes'],'include':_0x24116b[_0xb203('0x22')]?_[_0xb203('0x23')](_0x24116b[_0xb203('0x22')],function(_0x2e0655){return{'model':db[_0x2e0655['model']],'as':_0x2e0655['as'],'attributes':_0x2e0655[_0xb203('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d0ded){logger[_0xb203('0x11')](_0xb203('0x28'),_0xdb4937);logger[_0xb203('0x13')]('ShowOpenchannelQueue',_0xdb4937,JSON['stringify'](_0x2d0ded));_0x24885d(_0x2d0ded);})[_0xb203('0x1b')](function(_0x455606){logger[_0xb203('0x16')](_0xb203('0x28'),_0x455606[_0xb203('0x18')],_0xdb4937);_0x15cbd1(_0x464347[_0xb203('0x16')](0x1f4,_0x455606['message']));});});}; \ No newline at end of file +var _0x0dad=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll','options','raw','where','limit','include','attributes','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','find','stringify'];(function(_0xae7a63,_0x446fdf){var _0xd2d0e7=function(_0xb8ab40){while(--_0xb8ab40){_0xae7a63['push'](_0xae7a63['shift']());}};_0xd2d0e7(++_0x446fdf);}(_0x0dad,0x72));var _0xd0da=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x0dad[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0xd0da('0x0'));var util=require(_0xd0da('0x1'));var moment=require('moment');var BPromise=require(_0xd0da('0x2'));var rs=require(_0xd0da('0x3'));var fs=require('fs');var Redis=require(_0xd0da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd0da('0x5'));var logger=require(_0xd0da('0x6'))(_0xd0da('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd0da('0x8')]['http']({'port':0x232a});config[_0xd0da('0x9')]=_[_0xd0da('0xa')](config[_0xd0da('0x9')],{'host':_0xd0da('0xb'),'port':0x18eb});var socket=require(_0xd0da('0xc'))(new Redis(config[_0xd0da('0x9')]));require(_0xd0da('0xd'))['register'](socket);function respondWithRpcPromise(_0x563465,_0x5a7891,_0x3386b1){return new BPromise(function(_0x53f146,_0x22d96a){return client[_0xd0da('0xe')](_0x563465,_0x3386b1)[_0xd0da('0xf')](function(_0x10187e){logger[_0xd0da('0x10')](_0xd0da('0x11'),_0x5a7891,_0xd0da('0x12'));logger[_0xd0da('0x13')](_0xd0da('0x14'),_0x5a7891,_0xd0da('0x12'),JSON['stringify'](_0x10187e));if(_0x10187e[_0xd0da('0x15')]){if(_0x10187e[_0xd0da('0x15')][_0xd0da('0x16')]===0x1f4){logger['error'](_0xd0da('0x11'),_0x5a7891,_0x10187e['error'][_0xd0da('0x17')]);return _0x22d96a(_0x10187e['error'][_0xd0da('0x17')]);}logger[_0xd0da('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x5a7891,_0x10187e[_0xd0da('0x15')][_0xd0da('0x17')]);return _0x53f146(_0x10187e['error'][_0xd0da('0x17')]);}else{logger[_0xd0da('0x10')](_0xd0da('0x11'),_0x5a7891,_0xd0da('0x12'));_0x53f146(_0x10187e['result'][_0xd0da('0x17')]);}})[_0xd0da('0x18')](function(_0x10dcc5){logger[_0xd0da('0x15')](_0xd0da('0x11'),_0x5a7891,_0x10dcc5);_0x22d96a(_0x10dcc5);});});}exports['GetOpenchannelQueue']=function(_0x8c6ea5){var _0x542fba=this;return new Promise(function(_0x34d81d,_0x431424){return db['OpenchannelQueue'][_0xd0da('0x19')]({'raw':_0x8c6ea5[_0xd0da('0x1a')]?_0x8c6ea5['options'][_0xd0da('0x1b')]===undefined?!![]:![]:!![],'where':_0x8c6ea5['options']?_0x8c6ea5[_0xd0da('0x1a')][_0xd0da('0x1c')]||null:null,'attributes':_0x8c6ea5[_0xd0da('0x1a')]?_0x8c6ea5[_0xd0da('0x1a')]['attributes']||null:null,'limit':_0x8c6ea5['options']?_0x8c6ea5[_0xd0da('0x1a')][_0xd0da('0x1d')]||null:null,'include':_0x8c6ea5[_0xd0da('0x1a')]?_0x8c6ea5['options'][_0xd0da('0x1e')]?_['map'](_0x8c6ea5['options']['include'],function(_0x15df20){return{'model':db[_0x15df20['model']],'as':_0x15df20['as'],'attributes':_0x15df20[_0xd0da('0x1f')],'include':_0x15df20[_0xd0da('0x1e')]?_[_0xd0da('0x20')](_0x15df20[_0xd0da('0x1e')],function(_0x41c403){return{'model':db[_0x41c403[_0xd0da('0x21')]],'as':_0x41c403['as'],'attributes':_0x41c403[_0xd0da('0x1f')],'include':_0x41c403[_0xd0da('0x1e')]?_[_0xd0da('0x20')](_0x41c403[_0xd0da('0x1e')],function(_0x4325c9){return{'model':db[_0x4325c9[_0xd0da('0x21')]],'as':_0x4325c9['as'],'attributes':_0x4325c9[_0xd0da('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd0da('0xf')](function(_0x307290){logger['info']('GetOpenchannelQueue',_0x8c6ea5);logger['debug'](_0xd0da('0x22'),_0x8c6ea5,JSON['stringify'](_0x307290));_0x34d81d(_0x307290);})[_0xd0da('0x18')](function(_0x173053){logger[_0xd0da('0x15')](_0xd0da('0x22'),_0x173053[_0xd0da('0x17')],_0x8c6ea5);_0x431424(_0x542fba[_0xd0da('0x15')](0x1f4,_0x173053[_0xd0da('0x17')]));});});};exports[_0xd0da('0x23')]=function(_0xb32132){var _0xe67adb=this;return new Promise(function(_0x1aec73,_0x9f45f2){return db['OpenchannelQueue'][_0xd0da('0x24')]({'raw':_0xb32132['options']?_0xb32132[_0xd0da('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xb32132[_0xd0da('0x1a')]?_0xb32132['options'][_0xd0da('0x1c')]||null:null,'attributes':_0xb32132[_0xd0da('0x1a')]?_0xb32132[_0xd0da('0x1a')][_0xd0da('0x1f')]||null:null,'include':_0xb32132[_0xd0da('0x1a')]?_0xb32132[_0xd0da('0x1a')][_0xd0da('0x1e')]?_[_0xd0da('0x20')](_0xb32132[_0xd0da('0x1a')][_0xd0da('0x1e')],function(_0x12d6f4){return{'model':db[_0x12d6f4[_0xd0da('0x21')]],'as':_0x12d6f4['as'],'attributes':_0x12d6f4[_0xd0da('0x1f')],'include':_0x12d6f4[_0xd0da('0x1e')]?_[_0xd0da('0x20')](_0x12d6f4[_0xd0da('0x1e')],function(_0x16787c){return{'model':db[_0x16787c[_0xd0da('0x21')]],'as':_0x16787c['as'],'attributes':_0x16787c[_0xd0da('0x1f')],'include':_0x16787c[_0xd0da('0x1e')]?_[_0xd0da('0x20')](_0x16787c[_0xd0da('0x1e')],function(_0x134ff){return{'model':db[_0x134ff['model']],'as':_0x134ff['as'],'attributes':_0x134ff['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a6282){logger[_0xd0da('0x10')](_0xd0da('0x23'),_0xb32132);logger[_0xd0da('0x13')](_0xd0da('0x23'),_0xb32132,JSON[_0xd0da('0x25')](_0x3a6282));_0x1aec73(_0x3a6282);})['catch'](function(_0xbd3ac3){logger['error'](_0xd0da('0x23'),_0xbd3ac3[_0xd0da('0x17')],_0xb32132);_0x9f45f2(_0xe67adb[_0xd0da('0x15')](0x1f4,_0xbd3ac3[_0xd0da('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index c37e00b..8e419c2 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 _0xfdfa=['openchannelQueue:','./openchannelQueue.events','save','remove','emit','removeListener','register','length'];(function(_0x225ec9,_0x2e1289){var _0x466941=function(_0x4d3e54){while(--_0x4d3e54){_0x225ec9['push'](_0x225ec9['shift']());}};_0x466941(++_0x2e1289);}(_0xfdfa,0x1e9));var _0xafdf=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xfdfa[_0x1b349a];return _0x5d1f7c;};'use strict';var OpenchannelQueueEvents=require(_0xafdf('0x0'));var events=[_0xafdf('0x1'),_0xafdf('0x2'),'update'];function createListener(_0x3b2940,_0x26b50d){return function(_0xe2fa78){_0x26b50d[_0xafdf('0x3')](_0x3b2940,_0xe2fa78);};}function removeListener(_0x289e54,_0x411ea3){return function(){OpenchannelQueueEvents[_0xafdf('0x4')](_0x289e54,_0x411ea3);};}exports[_0xafdf('0x5')]=function(_0x4a83d6){for(var _0x19ccb5=0x0,_0x4316a2=events[_0xafdf('0x6')];_0x19ccb5<_0x4316a2;_0x19ccb5++){var _0x46c30a=events[_0x19ccb5];var _0x3b3d5e=createListener(_0xafdf('0x7')+_0x46c30a,_0x4a83d6);OpenchannelQueueEvents['on'](_0x46c30a,_0x3b3d5e);}}; \ No newline at end of file +var _0x875b=['openchannelQueue:','save','remove','update','emit','removeListener','length'];(function(_0x170067,_0x185086){var _0x3cea4f=function(_0x4dc0fc){while(--_0x4dc0fc){_0x170067['push'](_0x170067['shift']());}};_0x3cea4f(++_0x185086);}(_0x875b,0xc5));var _0xb875=function(_0xffa654,_0x4c734){_0xffa654=_0xffa654-0x0;var _0x5dd847=_0x875b[_0xffa654];return _0x5dd847;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xb875('0x0'),_0xb875('0x1'),_0xb875('0x2')];function createListener(_0x340d95,_0xa3ab34){return function(_0x1925f7){_0xa3ab34[_0xb875('0x3')](_0x340d95,_0x1925f7);};}function removeListener(_0x14cdaf,_0x5acf7e){return function(){OpenchannelQueueEvents[_0xb875('0x4')](_0x14cdaf,_0x5acf7e);};}exports['register']=function(_0x3a3a2a){for(var _0x589d2c=0x0,_0x457b82=events[_0xb875('0x5')];_0x589d2c<_0x457b82;_0x589d2c++){var _0xd51f26=events[_0x589d2c];var _0x313a86=createListener(_0xb875('0x6')+_0xd51f26,_0x3a3a2a);OpenchannelQueueEvents['on'](_0xd51f26,_0x313a86);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 991647c..b0f8caf 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 _0x3843=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3843,0x82));var _0x3384=function(_0x21cd0e,_0xd7914){_0x21cd0e=_0x21cd0e-0x0;var _0x440381=_0x3843[_0x21cd0e];return _0x440381;};'use strict';var multer=require(_0x3384('0x0'));var util=require('util');var path=require(_0x3384('0x1'));var timeout=require(_0x3384('0x2'));var express=require(_0x3384('0x3'));var router=express[_0x3384('0x4')]();var fs_extra=require(_0x3384('0x5'));var auth=require(_0x3384('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3384('0x7'));var controller=require(_0x3384('0x8'));router['get']('/',auth[_0x3384('0x9')](),controller[_0x3384('0xa')]);router[_0x3384('0xb')]('/describe',auth[_0x3384('0x9')](),controller[_0x3384('0xc')]);router[_0x3384('0xb')](_0x3384('0xd'),auth[_0x3384('0x9')](),controller[_0x3384('0xe')]);router[_0x3384('0xf')]('/',auth[_0x3384('0x9')](),controller[_0x3384('0x10')]);router[_0x3384('0x11')](_0x3384('0xd'),auth[_0x3384('0x9')](),controller[_0x3384('0x12')]);router[_0x3384('0x13')](_0x3384('0xd'),auth[_0x3384('0x9')](),controller[_0x3384('0x14')]);module[_0x3384('0x15')]=router; \ No newline at end of file +var _0xdac1=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','update','delete','exports'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0xdac1,0x72));var _0x1dac=function(_0x5000b9,_0x1a2b26){_0x5000b9=_0x5000b9-0x0;var _0x434c27=_0xdac1[_0x5000b9];return _0x434c27;};'use strict';var multer=require('multer');var util=require(_0x1dac('0x0'));var path=require(_0x1dac('0x1'));var timeout=require(_0x1dac('0x2'));var express=require(_0x1dac('0x3'));var router=express[_0x1dac('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1dac('0x5'));var interaction=require(_0x1dac('0x6'));var config=require(_0x1dac('0x7'));var controller=require(_0x1dac('0x8'));router[_0x1dac('0x9')]('/',auth[_0x1dac('0xa')](),controller[_0x1dac('0xb')]);router[_0x1dac('0x9')](_0x1dac('0xc'),auth[_0x1dac('0xa')](),controller[_0x1dac('0xd')]);router[_0x1dac('0x9')](_0x1dac('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x1dac('0xf')]('/',auth[_0x1dac('0xa')](),controller['create']);router['put'](_0x1dac('0xe'),auth[_0x1dac('0xa')](),controller[_0x1dac('0x10')]);router[_0x1dac('0x11')](_0x1dac('0xe'),auth[_0x1dac('0xa')](),controller['destroy']);module[_0x1dac('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 d53ef20..ec2acf1 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 _0xe721=['STRING','DATE','exports'];(function(_0x83d48e,_0x507328){var _0x26f1d1=function(_0x252172){while(--_0x252172){_0x83d48e['push'](_0x83d48e['shift']());}};_0x26f1d1(++_0x507328);}(_0xe721,0x14f));var _0x1e72=function(_0x39efab,_0x55a207){_0x39efab=_0x39efab-0x0;var _0x5b3185=_0xe721[_0x39efab];return _0x5b3185;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1e72('0x0')]={'uniqueid':{'type':Sequelize[_0x1e72('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x1e72('0x1')]},'joinAt':{'type':Sequelize[_0x1e72('0x2')]},'leaveAt':{'type':Sequelize[_0x1e72('0x2')]},'acceptAt':{'type':Sequelize[_0x1e72('0x2')]},'exitAt':{'type':Sequelize[_0x1e72('0x2')]},'reason':{'type':Sequelize[_0x1e72('0x1')]}}; \ No newline at end of file +var _0x24f5=['exports','STRING','DATE','sequelize'];(function(_0x3b8182,_0x58fe76){var _0x595f1c=function(_0xd25e9c){while(--_0xd25e9c){_0x3b8182['push'](_0x3b8182['shift']());}};_0x595f1c(++_0x58fe76);}(_0x24f5,0x107));var _0x524f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x24f5[_0x19e35c];return _0x3e1fe8;};'use strict';var moment=require('moment');var Sequelize=require(_0x524f('0x0'));module[_0x524f('0x1')]={'uniqueid':{'type':Sequelize[_0x524f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x524f('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x524f('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index dd36d1c..d41ba42 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 _0x2a49=['then','destroy','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','catch','show','includeAll','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','set','apply','save','update'];(function(_0x3ebd75,_0x28dcfb){var _0x47a6a0=function(_0x44078b){while(--_0x44078b){_0x3ebd75['push'](_0x3ebd75['shift']());}};_0x47a6a0(++_0x28dcfb);}(_0x2a49,0x77));var _0x92a4=function(_0x5d58c7,_0x4102a8){_0x5d58c7=_0x5d58c7-0x0;var _0x400089=_0x2a49[_0x5d58c7];return _0x400089;};'use strict';var pdf=require(_0x92a4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x92a4('0x1'));var zipdir=require(_0x92a4('0x2'));var jsonpatch=require(_0x92a4('0x3'));var rp=require(_0x92a4('0x4'));var moment=require('moment');var BPromise=require(_0x92a4('0x5'));var Mustache=require(_0x92a4('0x6'));var util=require(_0x92a4('0x7'));var path=require(_0x92a4('0x8'));var sox=require(_0x92a4('0x9'));var csv=require(_0x92a4('0xa'));var ejs=require(_0x92a4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x92a4('0xc'));var squel=require(_0x92a4('0xd'));var crypto=require('crypto');var jsforce=require(_0x92a4('0xe'));var deskjs=require(_0x92a4('0xf'));var toCsv=require(_0x92a4('0xa'));var querystring=require(_0x92a4('0x10'));var Papa=require(_0x92a4('0x11'));var Redis=require('ioredis');var authService=require(_0x92a4('0x12'));var qs=require(_0x92a4('0x13'));var as=require(_0x92a4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92a4('0x15'))(_0x92a4('0x16'));var utils=require(_0x92a4('0x17'));var config=require(_0x92a4('0x18'));var licenseUtil=require(_0x92a4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ff19e,_0x73afa9){_0x73afa9=_0x73afa9||0xcc;return function(_0x4b5239){if(_0x4b5239){return _0x3ff19e[_0x92a4('0x1a')](_0x73afa9);}return _0x3ff19e[_0x92a4('0x1b')](_0x73afa9)['end']();};}function respondWithResult(_0x5a21e7,_0x586c92){_0x586c92=_0x586c92||0xc8;return function(_0x2bd14c){if(_0x2bd14c){return _0x5a21e7['status'](_0x586c92)[_0x92a4('0x1c')](_0x2bd14c);}};}function respondWithFilteredResult(_0x1f554d,_0x4ddb01){return function(_0x3a01e2){if(_0x3a01e2){var _0x2bfcbc=_0x3a01e2['count'],_0x57f350=_0x4ddb01['offset'],_0x109297=_0x4ddb01[_0x92a4('0x1d')]+_0x4ddb01[_0x92a4('0x1e')],_0x545154;if(_0x109297>=_0x2bfcbc){_0x109297=_0x2bfcbc;_0x545154=0xc8;}else{_0x545154=0xce;}_0x1f554d[_0x92a4('0x1b')](_0x545154);return _0x1f554d[_0x92a4('0x1f')]('Content-Range',_0x57f350+'-'+_0x109297+'/'+_0x2bfcbc)[_0x92a4('0x1c')](_0x3a01e2);}return null;};}function patchUpdates(_0x49b883){return function(_0x33bc0c){try{jsonpatch[_0x92a4('0x20')](_0x33bc0c,_0x49b883,!![]);}catch(_0x26b65b){return BPromise['reject'](_0x26b65b);}return _0x33bc0c[_0x92a4('0x21')]();};}function saveUpdates(_0x1e4910,_0x39fa79){return function(_0x34e8e6){if(_0x34e8e6){return _0x34e8e6[_0x92a4('0x22')](_0x1e4910)[_0x92a4('0x23')](function(_0x13f500){return _0x13f500;});}return null;};}function removeEntity(_0x1219cc,_0x66b747){return function(_0x55de63){if(_0x55de63){return _0x55de63[_0x92a4('0x24')]()[_0x92a4('0x23')](function(){_0x1219cc['status'](0xcc)[_0x92a4('0x25')]();});}};}function handleEntityNotFound(_0x1a1bd0,_0x13df63){return function(_0xc0ee7f){if(!_0xc0ee7f){_0x1a1bd0[_0x92a4('0x1a')](0x194);}return _0xc0ee7f;};}function handleError(_0xca119b,_0x3bc17f){_0x3bc17f=_0x3bc17f||0x1f4;return function(_0x3c62a9){logger[_0x92a4('0x26')](_0x3c62a9[_0x92a4('0x27')]);if(_0x3c62a9[_0x92a4('0x28')]){delete _0x3c62a9[_0x92a4('0x28')];}_0xca119b['status'](_0x3bc17f)[_0x92a4('0x29')](_0x3c62a9);};}exports[_0x92a4('0x2a')]=function(_0x3f0554,_0x336f42){var _0xbaabb5={},_0x1d2a54={},_0x518537={'count':0x0,'rows':[]};var _0x76df04=_[_0x92a4('0x2b')](db[_0x92a4('0x2c')][_0x92a4('0x2d')],function(_0x32767c){return{'name':_0x32767c[_0x92a4('0x2e')],'type':_0x32767c[_0x92a4('0x2f')][_0x92a4('0x30')]};});_0x1d2a54[_0x92a4('0x31')]=_['map'](_0x76df04,'name');_0x1d2a54[_0x92a4('0x32')]=_[_0x92a4('0x33')](_0x3f0554[_0x92a4('0x32')]);_0x1d2a54[_0x92a4('0x34')]=_['intersection'](_0x1d2a54['model'],_0x1d2a54['query']);_0xbaabb5[_0x92a4('0x35')]=_[_0x92a4('0x36')](_0x1d2a54['model'],qs[_0x92a4('0x37')](_0x3f0554['query'][_0x92a4('0x37')]));_0xbaabb5[_0x92a4('0x35')]=_0xbaabb5[_0x92a4('0x35')][_0x92a4('0x38')]?_0xbaabb5['attributes']:_0x1d2a54['model'];if(!_0x3f0554[_0x92a4('0x32')][_0x92a4('0x39')]('nolimit')){_0xbaabb5[_0x92a4('0x1e')]=qs[_0x92a4('0x1e')](_0x3f0554[_0x92a4('0x32')][_0x92a4('0x1e')]);_0xbaabb5[_0x92a4('0x1d')]=qs[_0x92a4('0x1d')](_0x3f0554['query'][_0x92a4('0x1d')]);}_0xbaabb5[_0x92a4('0x3a')]=qs[_0x92a4('0x3b')](_0x3f0554['query']['sort']);_0xbaabb5[_0x92a4('0x3c')]=qs[_0x92a4('0x34')](_[_0x92a4('0x3d')](_0x3f0554[_0x92a4('0x32')],_0x1d2a54[_0x92a4('0x34')]),_0x76df04);if(_0x3f0554['query'][_0x92a4('0x3e')]){_0xbaabb5[_0x92a4('0x3c')]=_['merge'](_0xbaabb5[_0x92a4('0x3c')],{'$or':_['map'](_0x76df04,function(_0x5ab2c8){if(_0x5ab2c8['type']!==_0x92a4('0x3f')){var _0xe5657c={};_0xe5657c[_0x5ab2c8['name']]={'$like':'%'+_0x3f0554['query']['filter']+'%'};return _0xe5657c;}})});}_0xbaabb5=_[_0x92a4('0x40')]({},_0xbaabb5,_0x3f0554[_0x92a4('0x41')]);var _0x573306={'where':_0xbaabb5[_0x92a4('0x3c')]};return db['OpenchannelQueueReport'][_0x92a4('0x42')](_0x573306)[_0x92a4('0x23')](function(_0x530b25){_0x518537[_0x92a4('0x42')]=_0x530b25;if(_0x3f0554[_0x92a4('0x32')]['includeAll']){_0xbaabb5[_0x92a4('0x43')]=[{'all':!![]}];}return db[_0x92a4('0x2c')][_0x92a4('0x44')](_0xbaabb5);})['then'](function(_0x26d82a){_0x518537['rows']=_0x26d82a;return _0x518537;})[_0x92a4('0x23')](respondWithFilteredResult(_0x336f42,_0xbaabb5))[_0x92a4('0x45')](handleError(_0x336f42,null));};exports[_0x92a4('0x46')]=function(_0x5a26cb,_0x166c23){var _0xc1b760={'raw':!![],'where':{'id':_0x5a26cb['params']['id']}},_0x317d0b={};_0x317d0b[_0x92a4('0x31')]=_[_0x92a4('0x33')](db[_0x92a4('0x2c')][_0x92a4('0x2d')]);_0x317d0b[_0x92a4('0x32')]=_[_0x92a4('0x33')](_0x5a26cb[_0x92a4('0x32')]);_0x317d0b[_0x92a4('0x34')]=_[_0x92a4('0x36')](_0x317d0b[_0x92a4('0x31')],_0x317d0b[_0x92a4('0x32')]);_0xc1b760[_0x92a4('0x35')]=_['intersection'](_0x317d0b['model'],qs['fields'](_0x5a26cb[_0x92a4('0x32')][_0x92a4('0x37')]));_0xc1b760['attributes']=_0xc1b760[_0x92a4('0x35')][_0x92a4('0x38')]?_0xc1b760[_0x92a4('0x35')]:_0x317d0b['model'];if(_0x5a26cb[_0x92a4('0x32')][_0x92a4('0x47')]){_0xc1b760[_0x92a4('0x43')]=[{'all':!![]}];}_0xc1b760=_[_0x92a4('0x40')]({},_0xc1b760,_0x5a26cb[_0x92a4('0x41')]);return db[_0x92a4('0x2c')][_0x92a4('0x48')](_0xc1b760)[_0x92a4('0x23')](handleEntityNotFound(_0x166c23,null))[_0x92a4('0x23')](respondWithResult(_0x166c23,null))['catch'](handleError(_0x166c23,null));};exports['create']=function(_0x335367,_0x34c45d){return db[_0x92a4('0x2c')][_0x92a4('0x49')](_0x335367[_0x92a4('0x4a')],{})[_0x92a4('0x23')](respondWithResult(_0x34c45d,0xc9))[_0x92a4('0x45')](handleError(_0x34c45d,null));};exports[_0x92a4('0x22')]=function(_0x4a4dfd,_0x21d59d){if(_0x4a4dfd[_0x92a4('0x4a')]['id']){delete _0x4a4dfd[_0x92a4('0x4a')]['id'];}return db['OpenchannelQueueReport'][_0x92a4('0x48')]({'where':{'id':_0x4a4dfd[_0x92a4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x21d59d,null))[_0x92a4('0x23')](saveUpdates(_0x4a4dfd['body'],null))[_0x92a4('0x23')](respondWithResult(_0x21d59d,null))[_0x92a4('0x45')](handleError(_0x21d59d,null));};exports[_0x92a4('0x24')]=function(_0x1f5eb5,_0x91c5f9){return db[_0x92a4('0x2c')][_0x92a4('0x48')]({'where':{'id':_0x1f5eb5[_0x92a4('0x4b')]['id']}})[_0x92a4('0x23')](handleEntityNotFound(_0x91c5f9,null))[_0x92a4('0x23')](removeEntity(_0x91c5f9,null))[_0x92a4('0x45')](handleError(_0x91c5f9,null));};exports[_0x92a4('0x4c')]=function(_0x181e71,_0x382c70){return db['OpenchannelQueueReport'][_0x92a4('0x4c')]()[_0x92a4('0x23')](respondWithResult(_0x382c70,null))[_0x92a4('0x45')](handleError(_0x382c70,null));}; \ No newline at end of file +var _0xc841=['path','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','intersection','length','includeAll','options','find','catch','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc841,0xd7));var _0x1c84=function(_0x2c98e1,_0x1cf0fe){_0x2c98e1=_0x2c98e1-0x0;var _0x2e0d8f=_0xc841[_0x2c98e1];return _0x2e0d8f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1c84('0x0'));var rimraf=require(_0x1c84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c84('0x2'));var rp=require(_0x1c84('0x3'));var moment=require('moment');var BPromise=require(_0x1c84('0x4'));var Mustache=require(_0x1c84('0x5'));var util=require(_0x1c84('0x6'));var path=require(_0x1c84('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1c84('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c84('0x9'));var squel=require(_0x1c84('0xa'));var crypto=require(_0x1c84('0xb'));var jsforce=require(_0x1c84('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1c84('0xd'));var Papa=require('papaparse');var Redis=require(_0x1c84('0xe'));var authService=require(_0x1c84('0xf'));var qs=require(_0x1c84('0x10'));var as=require(_0x1c84('0x11'));var hardwareService=require(_0x1c84('0x12'));var logger=require(_0x1c84('0x13'))('api');var utils=require(_0x1c84('0x14'));var config=require(_0x1c84('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fdf9d,_0xf27b71){_0xf27b71=_0xf27b71||0xcc;return function(_0x17253a){if(_0x17253a){return _0x2fdf9d['sendStatus'](_0xf27b71);}return _0x2fdf9d['status'](_0xf27b71)[_0x1c84('0x16')]();};}function respondWithResult(_0x1e2abb,_0xec8bf9){_0xec8bf9=_0xec8bf9||0xc8;return function(_0x39f134){if(_0x39f134){return _0x1e2abb[_0x1c84('0x17')](_0xec8bf9)[_0x1c84('0x18')](_0x39f134);}};}function respondWithFilteredResult(_0x278350,_0x527b81){return function(_0x3500aa){if(_0x3500aa){var _0x5cc7be=_0x3500aa[_0x1c84('0x19')],_0x3d7e3c=_0x527b81[_0x1c84('0x1a')],_0x18ee10=_0x527b81[_0x1c84('0x1a')]+_0x527b81[_0x1c84('0x1b')],_0x206937;if(_0x18ee10>=_0x5cc7be){_0x18ee10=_0x5cc7be;_0x206937=0xc8;}else{_0x206937=0xce;}_0x278350[_0x1c84('0x17')](_0x206937);return _0x278350[_0x1c84('0x1c')](_0x1c84('0x1d'),_0x3d7e3c+'-'+_0x18ee10+'/'+_0x5cc7be)[_0x1c84('0x18')](_0x3500aa);}return null;};}function patchUpdates(_0x2908df){return function(_0xdf838c){try{jsonpatch[_0x1c84('0x1e')](_0xdf838c,_0x2908df,!![]);}catch(_0x196547){return BPromise[_0x1c84('0x1f')](_0x196547);}return _0xdf838c[_0x1c84('0x20')]();};}function saveUpdates(_0x492f45,_0xcc5c22){return function(_0x38fca3){if(_0x38fca3){return _0x38fca3[_0x1c84('0x21')](_0x492f45)[_0x1c84('0x22')](function(_0x19e6b8){return _0x19e6b8;});}return null;};}function removeEntity(_0x101385,_0x330144){return function(_0x2e517a){if(_0x2e517a){return _0x2e517a['destroy']()['then'](function(){_0x101385[_0x1c84('0x17')](0xcc)[_0x1c84('0x16')]();});}};}function handleEntityNotFound(_0x45a621,_0x402e07){return function(_0x9f42bd){if(!_0x9f42bd){_0x45a621[_0x1c84('0x23')](0x194);}return _0x9f42bd;};}function handleError(_0x54c6ea,_0x42b5be){_0x42b5be=_0x42b5be||0x1f4;return function(_0x3fcb09){logger[_0x1c84('0x24')](_0x3fcb09[_0x1c84('0x25')]);if(_0x3fcb09[_0x1c84('0x26')]){delete _0x3fcb09[_0x1c84('0x26')];}_0x54c6ea['status'](_0x42b5be)[_0x1c84('0x27')](_0x3fcb09);};}exports[_0x1c84('0x28')]=function(_0x96657f,_0x521f78){var _0x14fd37={},_0x5cdce8={},_0x18d0dc={'count':0x0,'rows':[]};var _0x1b7cc6=_[_0x1c84('0x29')](db[_0x1c84('0x2a')][_0x1c84('0x2b')],function(_0x5dc8e3){return{'name':_0x5dc8e3[_0x1c84('0x2c')],'type':_0x5dc8e3[_0x1c84('0x2d')][_0x1c84('0x2e')]};});_0x5cdce8[_0x1c84('0x2f')]=_[_0x1c84('0x29')](_0x1b7cc6,_0x1c84('0x26'));_0x5cdce8[_0x1c84('0x30')]=_[_0x1c84('0x31')](_0x96657f[_0x1c84('0x30')]);_0x5cdce8[_0x1c84('0x32')]=_['intersection'](_0x5cdce8[_0x1c84('0x2f')],_0x5cdce8[_0x1c84('0x30')]);_0x14fd37[_0x1c84('0x33')]=_['intersection'](_0x5cdce8[_0x1c84('0x2f')],qs[_0x1c84('0x34')](_0x96657f[_0x1c84('0x30')][_0x1c84('0x34')]));_0x14fd37[_0x1c84('0x33')]=_0x14fd37['attributes']['length']?_0x14fd37[_0x1c84('0x33')]:_0x5cdce8[_0x1c84('0x2f')];if(!_0x96657f[_0x1c84('0x30')][_0x1c84('0x35')](_0x1c84('0x36'))){_0x14fd37['limit']=qs['limit'](_0x96657f[_0x1c84('0x30')][_0x1c84('0x1b')]);_0x14fd37[_0x1c84('0x1a')]=qs['offset'](_0x96657f[_0x1c84('0x30')][_0x1c84('0x1a')]);}_0x14fd37[_0x1c84('0x37')]=qs[_0x1c84('0x38')](_0x96657f[_0x1c84('0x30')][_0x1c84('0x38')]);_0x14fd37[_0x1c84('0x39')]=qs[_0x1c84('0x32')](_[_0x1c84('0x3a')](_0x96657f[_0x1c84('0x30')],_0x5cdce8[_0x1c84('0x32')]),_0x1b7cc6);if(_0x96657f['query'][_0x1c84('0x3b')]){_0x14fd37['where']=_[_0x1c84('0x3c')](_0x14fd37['where'],{'$or':_[_0x1c84('0x29')](_0x1b7cc6,function(_0x1fad83){if(_0x1fad83[_0x1c84('0x2d')]!=='VIRTUAL'){var _0x3e8942={};_0x3e8942[_0x1fad83[_0x1c84('0x26')]]={'$like':'%'+_0x96657f[_0x1c84('0x30')][_0x1c84('0x3b')]+'%'};return _0x3e8942;}})});}_0x14fd37=_['merge']({},_0x14fd37,_0x96657f['options']);var _0x2790bd={'where':_0x14fd37['where']};return db[_0x1c84('0x2a')][_0x1c84('0x19')](_0x2790bd)['then'](function(_0x4c2bf9){_0x18d0dc[_0x1c84('0x19')]=_0x4c2bf9;if(_0x96657f[_0x1c84('0x30')]['includeAll']){_0x14fd37[_0x1c84('0x3d')]=[{'all':!![]}];}return db[_0x1c84('0x2a')]['findAll'](_0x14fd37);})[_0x1c84('0x22')](function(_0x67b614){_0x18d0dc[_0x1c84('0x3e')]=_0x67b614;return _0x18d0dc;})[_0x1c84('0x22')](respondWithFilteredResult(_0x521f78,_0x14fd37))['catch'](handleError(_0x521f78,null));};exports['show']=function(_0x55e4c2,_0x299440){var _0x494fa6={'raw':!![],'where':{'id':_0x55e4c2['params']['id']}},_0x10cb48={};_0x10cb48[_0x1c84('0x2f')]=_[_0x1c84('0x31')](db[_0x1c84('0x2a')]['rawAttributes']);_0x10cb48[_0x1c84('0x30')]=_['keys'](_0x55e4c2['query']);_0x10cb48[_0x1c84('0x32')]=_[_0x1c84('0x3f')](_0x10cb48[_0x1c84('0x2f')],_0x10cb48['query']);_0x494fa6['attributes']=_[_0x1c84('0x3f')](_0x10cb48[_0x1c84('0x2f')],qs['fields'](_0x55e4c2[_0x1c84('0x30')][_0x1c84('0x34')]));_0x494fa6[_0x1c84('0x33')]=_0x494fa6[_0x1c84('0x33')][_0x1c84('0x40')]?_0x494fa6[_0x1c84('0x33')]:_0x10cb48[_0x1c84('0x2f')];if(_0x55e4c2[_0x1c84('0x30')][_0x1c84('0x41')]){_0x494fa6[_0x1c84('0x3d')]=[{'all':!![]}];}_0x494fa6=_[_0x1c84('0x3c')]({},_0x494fa6,_0x55e4c2[_0x1c84('0x42')]);return db[_0x1c84('0x2a')][_0x1c84('0x43')](_0x494fa6)['then'](handleEntityNotFound(_0x299440,null))['then'](respondWithResult(_0x299440,null))[_0x1c84('0x44')](handleError(_0x299440,null));};exports[_0x1c84('0x45')]=function(_0x5e5301,_0x570c19){return db[_0x1c84('0x2a')][_0x1c84('0x45')](_0x5e5301[_0x1c84('0x46')],{})[_0x1c84('0x22')](respondWithResult(_0x570c19,0xc9))[_0x1c84('0x44')](handleError(_0x570c19,null));};exports[_0x1c84('0x21')]=function(_0x3f9786,_0x27d1be){if(_0x3f9786[_0x1c84('0x46')]['id']){delete _0x3f9786['body']['id'];}return db[_0x1c84('0x2a')][_0x1c84('0x43')]({'where':{'id':_0x3f9786[_0x1c84('0x47')]['id']}})['then'](handleEntityNotFound(_0x27d1be,null))['then'](saveUpdates(_0x3f9786[_0x1c84('0x46')],null))[_0x1c84('0x22')](respondWithResult(_0x27d1be,null))[_0x1c84('0x44')](handleError(_0x27d1be,null));};exports[_0x1c84('0x48')]=function(_0x23038c,_0x5094ac){return db[_0x1c84('0x2a')][_0x1c84('0x43')]({'where':{'id':_0x23038c[_0x1c84('0x47')]['id']}})[_0x1c84('0x22')](handleEntityNotFound(_0x5094ac,null))[_0x1c84('0x22')](removeEntity(_0x5094ac,null))['catch'](handleError(_0x5094ac,null));};exports['describe']=function(_0x3b6110,_0x1e5b04){return db[_0x1c84('0x2a')][_0x1c84('0x49')]()['then'](respondWithResult(_0x1e5b04,null))['catch'](handleError(_0x1e5b04,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 13ace53..cd82c00 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 _0xac22=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid'];(function(_0x202b05,_0x5a246c){var _0x22a0a7=function(_0x5157f2){while(--_0x5157f2){_0x202b05['push'](_0x202b05['shift']());}};_0x22a0a7(++_0x5a246c);}(_0xac22,0x138));var _0x2ac2=function(_0x550c35,_0x4cfaf3){_0x550c35=_0x550c35-0x0;var _0x586717=_0xac22[_0x550c35];return _0x586717;};'use strict';var _=require('lodash');var util=require(_0x2ac2('0x0'));var logger=require(_0x2ac2('0x1'))(_0x2ac2('0x2'));var moment=require(_0x2ac2('0x3'));var BPromise=require(_0x2ac2('0x4'));var rp=require(_0x2ac2('0x5'));var fs=require('fs');var path=require(_0x2ac2('0x6'));var rimraf=require('rimraf');var config=require(_0x2ac2('0x7'));var attributes=require(_0x2ac2('0x8'));module[_0x2ac2('0x9')]=function(_0x54943c,_0xd807b2){return _0x54943c[_0x2ac2('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x2ac2('0xb'),'paranoid':![],'indexes':[{'name':_0x2ac2('0xc'),'fields':[_0x2ac2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01fe=['../../config/environment','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x01fe,0x102));var _0xe01f=function(_0x520fcf,_0x54fbb2){_0x520fcf=_0x520fcf-0x0;var _0x4a5530=_0x01fe[_0x520fcf];return _0x4a5530;};'use strict';var _=require(_0xe01f('0x0'));var util=require('util');var logger=require(_0xe01f('0x1'))(_0xe01f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe01f('0x3'));var fs=require('fs');var path=require(_0xe01f('0x4'));var rimraf=require(_0xe01f('0x5'));var config=require(_0xe01f('0x6'));var attributes=require('./openchannelQueueReport.attributes');module[_0xe01f('0x7')]=function(_0x574969,_0x3effc4){return _0x574969[_0xe01f('0x8')](_0xe01f('0x9'),attributes,{'tableName':_0xe01f('0xa'),'paranoid':![],'indexes':[{'name':_0xe01f('0xb'),'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 1be62c6..3584a7a 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 _0xfb23=['request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','OpenchannelQueueReport','body','options','CreateOpenchannelQueueReport','debug','UpdateOpenchannelQueueReport','update','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1721be,_0x4e2a86){var _0xf9507a=function(_0x20850d){while(--_0x20850d){_0x1721be['push'](_0x1721be['shift']());}};_0xf9507a(++_0x4e2a86);}(_0xfb23,0x195));var _0x3fb2=function(_0x16aaa6,_0x1bbd90){_0x16aaa6=_0x16aaa6-0x0;var _0x4ecf6b=_0xfb23[_0x16aaa6];return _0x4ecf6b;};'use strict';var _=require(_0x3fb2('0x0'));var util=require('util');var moment=require(_0x3fb2('0x1'));var BPromise=require(_0x3fb2('0x2'));var rs=require(_0x3fb2('0x3'));var fs=require('fs');var Redis=require(_0x3fb2('0x4'));var db=require(_0x3fb2('0x5'))['db'];var utils=require(_0x3fb2('0x6'));var logger=require(_0x3fb2('0x7'))('rpc');var config=require(_0x3fb2('0x8'));var jayson=require(_0x3fb2('0x9'));var client=jayson[_0x3fb2('0xa')][_0x3fb2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30c37e,_0xd2996b,_0x19a335){return new BPromise(function(_0x2e748c,_0x3e199a){return client[_0x3fb2('0xc')](_0x30c37e,_0x19a335)[_0x3fb2('0xd')](function(_0x5b8591){logger[_0x3fb2('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xd2996b,_0x3fb2('0xf'));logger['debug'](_0x3fb2('0x10'),_0xd2996b,_0x3fb2('0xf'),JSON[_0x3fb2('0x11')](_0x5b8591));if(_0x5b8591[_0x3fb2('0x12')]){if(_0x5b8591[_0x3fb2('0x12')][_0x3fb2('0x13')]===0x1f4){logger[_0x3fb2('0x12')](_0x3fb2('0x14'),_0xd2996b,_0x5b8591[_0x3fb2('0x12')]['message']);return _0x3e199a(_0x5b8591['error'][_0x3fb2('0x15')]);}logger[_0x3fb2('0x12')](_0x3fb2('0x14'),_0xd2996b,_0x5b8591['error'][_0x3fb2('0x15')]);return _0x2e748c(_0x5b8591[_0x3fb2('0x12')]['message']);}else{logger[_0x3fb2('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xd2996b,_0x3fb2('0xf'));_0x2e748c(_0x5b8591[_0x3fb2('0x16')][_0x3fb2('0x15')]);}})[_0x3fb2('0x17')](function(_0x4a7503){logger[_0x3fb2('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xd2996b,_0x4a7503);_0x3e199a(_0x4a7503);});});}exports['CreateOpenchannelQueueReport']=function(_0x29adbc){var _0x50d0f8=this;return new Promise(function(_0x4018dc,_0x486d57){return db[_0x3fb2('0x18')]['create'](_0x29adbc[_0x3fb2('0x19')],{'raw':_0x29adbc['options']?_0x29adbc[_0x3fb2('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x3fb2('0xd')](function(_0x7e34bd){logger[_0x3fb2('0xe')](_0x3fb2('0x1b'),_0x29adbc);logger[_0x3fb2('0x1c')]('CreateOpenchannelQueueReport',_0x29adbc,JSON[_0x3fb2('0x11')](_0x7e34bd));_0x4018dc(_0x7e34bd);})['catch'](function(_0x1e8c26){logger[_0x3fb2('0x12')](_0x3fb2('0x1b'),_0x1e8c26[_0x3fb2('0x15')],_0x29adbc);_0x486d57(_0x50d0f8[_0x3fb2('0x12')](0x1f4,_0x1e8c26[_0x3fb2('0x15')]));});});};exports[_0x3fb2('0x1d')]=function(_0x132f75){var _0x1e573e=this;return new Promise(function(_0x35a43c,_0x44b410){return db['OpenchannelQueueReport'][_0x3fb2('0x1e')](_0x132f75[_0x3fb2('0x19')],{'raw':_0x132f75['options']?_0x132f75[_0x3fb2('0x1a')][_0x3fb2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x132f75['options']?_0x132f75[_0x3fb2('0x1a')][_0x3fb2('0x20')]||null:null,'attributes':_0x132f75[_0x3fb2('0x1a')]?_0x132f75['options'][_0x3fb2('0x21')]||null:null,'limit':_0x132f75[_0x3fb2('0x1a')]?_0x132f75[_0x3fb2('0x1a')][_0x3fb2('0x22')]||null:null})[_0x3fb2('0xd')](function(_0x3fbe48){logger[_0x3fb2('0xe')]('UpdateOpenchannelQueueReport',_0x132f75);logger[_0x3fb2('0x1c')](_0x3fb2('0x1d'),_0x132f75,JSON[_0x3fb2('0x11')](_0x3fbe48));_0x35a43c(_0x3fbe48);})[_0x3fb2('0x17')](function(_0xaa7c9a){logger[_0x3fb2('0x12')](_0x3fb2('0x1d'),_0xaa7c9a['message'],_0x132f75);_0x44b410(_0x1e573e[_0x3fb2('0x12')](0x1f4,_0xaa7c9a['message']));});});}; \ No newline at end of file +var _0x1c02=['code','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','then','stringify','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x49192,_0x2fc6fb){var _0x57d8e8=function(_0xc4ed8d){while(--_0xc4ed8d){_0x49192['push'](_0x49192['shift']());}};_0x57d8e8(++_0x2fc6fb);}(_0x1c02,0x184));var _0x21c0=function(_0x55fa80,_0x173db9){_0x55fa80=_0x55fa80-0x0;var _0x5d0fb1=_0x1c02[_0x55fa80];return _0x5d0fb1;};'use strict';var _=require(_0x21c0('0x0'));var util=require(_0x21c0('0x1'));var moment=require(_0x21c0('0x2'));var BPromise=require(_0x21c0('0x3'));var rs=require(_0x21c0('0x4'));var fs=require('fs');var Redis=require(_0x21c0('0x5'));var db=require(_0x21c0('0x6'))['db'];var utils=require(_0x21c0('0x7'));var logger=require(_0x21c0('0x8'))(_0x21c0('0x9'));var config=require(_0x21c0('0xa'));var jayson=require(_0x21c0('0xb'));var client=jayson[_0x21c0('0xc')][_0x21c0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x288cb2,_0x447cfd,_0x55bfa7){return new BPromise(function(_0x19202e,_0x41422b){return client[_0x21c0('0xe')](_0x288cb2,_0x55bfa7)['then'](function(_0x43d16b){logger[_0x21c0('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x447cfd,'request\x20sent');logger[_0x21c0('0x10')](_0x21c0('0x11'),_0x447cfd,_0x21c0('0x12'),JSON['stringify'](_0x43d16b));if(_0x43d16b['error']){if(_0x43d16b['error'][_0x21c0('0x13')]===0x1f4){logger[_0x21c0('0x14')](_0x21c0('0x15'),_0x447cfd,_0x43d16b['error'][_0x21c0('0x16')]);return _0x41422b(_0x43d16b['error'][_0x21c0('0x16')]);}logger['error'](_0x21c0('0x15'),_0x447cfd,_0x43d16b[_0x21c0('0x14')][_0x21c0('0x16')]);return _0x19202e(_0x43d16b[_0x21c0('0x14')][_0x21c0('0x16')]);}else{logger[_0x21c0('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x447cfd,_0x21c0('0x12'));_0x19202e(_0x43d16b[_0x21c0('0x17')][_0x21c0('0x16')]);}})[_0x21c0('0x18')](function(_0x2e3d55){logger['error'](_0x21c0('0x15'),_0x447cfd,_0x2e3d55);_0x41422b(_0x2e3d55);});});}exports[_0x21c0('0x19')]=function(_0x148a35){var _0x41043c=this;return new Promise(function(_0x589123,_0x509773){return db[_0x21c0('0x1a')]['create'](_0x148a35['body'],{'raw':_0x148a35[_0x21c0('0x1b')]?_0x148a35[_0x21c0('0x1b')][_0x21c0('0x1c')]===undefined?!![]:![]:!![]})[_0x21c0('0x1d')](function(_0x5a4a8c){logger[_0x21c0('0xf')]('CreateOpenchannelQueueReport',_0x148a35);logger[_0x21c0('0x10')](_0x21c0('0x19'),_0x148a35,JSON[_0x21c0('0x1e')](_0x5a4a8c));_0x589123(_0x5a4a8c);})['catch'](function(_0x51a4c3){logger[_0x21c0('0x14')](_0x21c0('0x19'),_0x51a4c3[_0x21c0('0x16')],_0x148a35);_0x509773(_0x41043c[_0x21c0('0x14')](0x1f4,_0x51a4c3[_0x21c0('0x16')]));});});};exports[_0x21c0('0x1f')]=function(_0x453d21){var _0x30db63=this;return new Promise(function(_0x1d0899,_0x13321a){return db[_0x21c0('0x1a')][_0x21c0('0x20')](_0x453d21[_0x21c0('0x21')],{'raw':_0x453d21[_0x21c0('0x1b')]?_0x453d21[_0x21c0('0x1b')][_0x21c0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x453d21[_0x21c0('0x1b')]?_0x453d21[_0x21c0('0x1b')][_0x21c0('0x22')]||null:null,'attributes':_0x453d21['options']?_0x453d21[_0x21c0('0x1b')][_0x21c0('0x23')]||null:null,'limit':_0x453d21[_0x21c0('0x1b')]?_0x453d21['options'][_0x21c0('0x24')]||null:null})[_0x21c0('0x1d')](function(_0x11e7b9){logger[_0x21c0('0xf')](_0x21c0('0x1f'),_0x453d21);logger[_0x21c0('0x10')](_0x21c0('0x1f'),_0x453d21,JSON[_0x21c0('0x1e')](_0x11e7b9));_0x1d0899(_0x11e7b9);})[_0x21c0('0x18')](function(_0x1c2e3f){logger[_0x21c0('0x14')](_0x21c0('0x1f'),_0x1c2e3f['message'],_0x453d21);_0x13321a(_0x30db63[_0x21c0('0x14')](0x1f4,_0x1c2e3f[_0x21c0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 077accf..37d8816 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 _0x1acd=['show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','isAuthenticated','/:id'];(function(_0xcf1a64,_0x32ef53){var _0x5c70b0=function(_0x1dbbac){while(--_0x1dbbac){_0xcf1a64['push'](_0xcf1a64['shift']());}};_0x5c70b0(++_0x32ef53);}(_0x1acd,0x10c));var _0xd1ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1acd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd1ac('0x0'));var path=require(_0xd1ac('0x1'));var timeout=require(_0xd1ac('0x2'));var express=require(_0xd1ac('0x3'));var router=express['Router']();var fs_extra=require(_0xd1ac('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd1ac('0x5'));var config=require(_0xd1ac('0x6'));var controller=require(_0xd1ac('0x7'));router[_0xd1ac('0x8')]('/',auth['isAuthenticated'](),controller[_0xd1ac('0x9')]);router['get']('/describe',auth[_0xd1ac('0xa')](),controller['describe']);router[_0xd1ac('0x8')](_0xd1ac('0xb'),auth['isAuthenticated'](),controller[_0xd1ac('0xc')]);router[_0xd1ac('0xd')]('/',auth['isAuthenticated'](),controller[_0xd1ac('0xe')]);router[_0xd1ac('0xf')](_0xd1ac('0xb'),auth['isAuthenticated'](),controller[_0xd1ac('0x10')]);router[_0xd1ac('0x11')]('/:id',auth[_0xd1ac('0xa')](),controller[_0xd1ac('0x12')]);module[_0xd1ac('0x13')]=router; \ No newline at end of file +var _0xbef3=['delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','index','isAuthenticated','/:id','show','post','update'];(function(_0x3c43f6,_0x429058){var _0x5677a4=function(_0x13b06b){while(--_0x13b06b){_0x3c43f6['push'](_0x3c43f6['shift']());}};_0x5677a4(++_0x429058);}(_0xbef3,0x80));var _0x3bef=function(_0x5f5aea,_0x228cfe){_0x5f5aea=_0x5f5aea-0x0;var _0x19a568=_0xbef3[_0x5f5aea];return _0x19a568;};'use strict';var multer=require(_0x3bef('0x0'));var util=require(_0x3bef('0x1'));var path=require('path');var timeout=require(_0x3bef('0x2'));var express=require(_0x3bef('0x3'));var router=express[_0x3bef('0x4')]();var fs_extra=require(_0x3bef('0x5'));var auth=require(_0x3bef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3bef('0x7'));var controller=require(_0x3bef('0x8'));router[_0x3bef('0x9')]('/',auth['isAuthenticated'](),controller[_0x3bef('0xa')]);router[_0x3bef('0x9')]('/describe',auth[_0x3bef('0xb')](),controller['describe']);router[_0x3bef('0x9')](_0x3bef('0xc'),auth[_0x3bef('0xb')](),controller[_0x3bef('0xd')]);router[_0x3bef('0xe')]('/',auth[_0x3bef('0xb')](),controller['create']);router['put']('/:id',auth[_0x3bef('0xb')](),controller[_0x3bef('0xf')]);router[_0x3bef('0x10')](_0x3bef('0xc'),auth['isAuthenticated'](),controller[_0x3bef('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 4da7027..b28fcbe 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 _0xfe0b=['sequelize','exports','STRING','ENUM','account','queue','DATE','NOW'];(function(_0x5d506b,_0x41b1ca){var _0x2a8f24=function(_0x12821c){while(--_0x12821c){_0x5d506b['push'](_0x5d506b['shift']());}};_0x2a8f24(++_0x41b1ca);}(_0xfe0b,0x78));var _0xbfe0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfe0b[_0x19e35c];return _0x3e1fe8;};'use strict';var moment=require('moment');var Sequelize=require(_0xbfe0('0x0'));module[_0xbfe0('0x1')]={'uniqueid':{'type':Sequelize[_0xbfe0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbfe0('0x3')](_0xbfe0('0x4'),'agent',_0xbfe0('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xbfe0('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbfe0('0x7')]}}; \ No newline at end of file +var _0xa192=['ENUM','account','queue','DATE','moment','exports','STRING'];(function(_0x245b67,_0x1f7f8a){var _0x53b2e9=function(_0x3aec8f){while(--_0x3aec8f){_0x245b67['push'](_0x245b67['shift']());}};_0x53b2e9(++_0x1f7f8a);}(_0xa192,0x11c));var _0x2a19=function(_0x3da44e,_0xf556aa){_0x3da44e=_0x3da44e-0x0;var _0x4180e7=_0xa192[_0x3da44e];return _0x4180e7;};'use strict';var moment=require(_0x2a19('0x0'));var Sequelize=require('sequelize');module[_0x2a19('0x1')]={'uniqueid':{'type':Sequelize[_0x2a19('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2a19('0x3')](_0x2a19('0x4'),'agent',_0x2a19('0x5')),'allowNull':![],'defaultValue':_0x2a19('0x5')},'transferredAt':{'type':Sequelize[_0x2a19('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 8b52d9a..6f5cc9e 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 _0x58cc=['apply','update','destroy','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','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','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','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','count','offset','limit','set','Content-Range'];(function(_0x1e82db,_0x375757){var _0x702bac=function(_0x1c412a){while(--_0x1c412a){_0x1e82db['push'](_0x1e82db['shift']());}};_0x702bac(++_0x375757);}(_0x58cc,0x7a));var _0xc58c=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x58cc[_0x10df18];return _0x1f9a1d;};'use strict';var pdf=require(_0xc58c('0x0'));var emlformat=require(_0xc58c('0x1'));var rimraf=require(_0xc58c('0x2'));var zipdir=require(_0xc58c('0x3'));var jsonpatch=require(_0xc58c('0x4'));var rp=require(_0xc58c('0x5'));var moment=require('moment');var BPromise=require(_0xc58c('0x6'));var Mustache=require(_0xc58c('0x7'));var util=require(_0xc58c('0x8'));var path=require(_0xc58c('0x9'));var sox=require(_0xc58c('0xa'));var csv=require(_0xc58c('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc58c('0xc'));var squel=require(_0xc58c('0xd'));var crypto=require('crypto');var jsforce=require(_0xc58c('0xe'));var deskjs=require(_0xc58c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc58c('0x10'));var Papa=require('papaparse');var Redis=require(_0xc58c('0x11'));var authService=require(_0xc58c('0x12'));var qs=require(_0xc58c('0x13'));var as=require(_0xc58c('0x14'));var hardwareService=require(_0xc58c('0x15'));var logger=require(_0xc58c('0x16'))('api');var utils=require(_0xc58c('0x17'));var config=require(_0xc58c('0x18'));var licenseUtil=require(_0xc58c('0x19'));var db=require(_0xc58c('0x1a'))['db'];function respondWithStatusCode(_0x311dc2,_0x41ed49){_0x41ed49=_0x41ed49||0xcc;return function(_0x28f519){if(_0x28f519){return _0x311dc2[_0xc58c('0x1b')](_0x41ed49);}return _0x311dc2[_0xc58c('0x1c')](_0x41ed49)[_0xc58c('0x1d')]();};}function respondWithResult(_0x499235,_0x233b9c){_0x233b9c=_0x233b9c||0xc8;return function(_0x59b60a){if(_0x59b60a){return _0x499235[_0xc58c('0x1c')](_0x233b9c)[_0xc58c('0x1e')](_0x59b60a);}};}function respondWithFilteredResult(_0x3dfff5,_0x313849){return function(_0xa6b37a){if(_0xa6b37a){var _0x3fc914=_0xa6b37a[_0xc58c('0x1f')],_0x294b48=_0x313849[_0xc58c('0x20')],_0xf1601f=_0x313849['offset']+_0x313849[_0xc58c('0x21')],_0x171110;if(_0xf1601f>=_0x3fc914){_0xf1601f=_0x3fc914;_0x171110=0xc8;}else{_0x171110=0xce;}_0x3dfff5[_0xc58c('0x1c')](_0x171110);return _0x3dfff5[_0xc58c('0x22')](_0xc58c('0x23'),_0x294b48+'-'+_0xf1601f+'/'+_0x3fc914)['json'](_0xa6b37a);}return null;};}function patchUpdates(_0x43e650){return function(_0x36325b){try{jsonpatch[_0xc58c('0x24')](_0x36325b,_0x43e650,!![]);}catch(_0x4e1165){return BPromise['reject'](_0x4e1165);}return _0x36325b['save']();};}function saveUpdates(_0xcf3d26,_0x234a5b){return function(_0xae79a1){if(_0xae79a1){return _0xae79a1[_0xc58c('0x25')](_0xcf3d26)['then'](function(_0x48444f){return _0x48444f;});}return null;};}function removeEntity(_0x16ba3f,_0x284f0e){return function(_0x4b0800){if(_0x4b0800){return _0x4b0800[_0xc58c('0x26')]()[_0xc58c('0x27')](function(){_0x16ba3f[_0xc58c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4eb13a,_0x4729dd){return function(_0x1d2717){if(!_0x1d2717){_0x4eb13a[_0xc58c('0x1b')](0x194);}return _0x1d2717;};}function handleError(_0x1dd1bc,_0x5a66d8){_0x5a66d8=_0x5a66d8||0x1f4;return function(_0x293774){logger[_0xc58c('0x28')](_0x293774[_0xc58c('0x29')]);if(_0x293774[_0xc58c('0x2a')]){delete _0x293774[_0xc58c('0x2a')];}_0x1dd1bc[_0xc58c('0x1c')](_0x5a66d8)[_0xc58c('0x2b')](_0x293774);};}exports[_0xc58c('0x2c')]=function(_0x4d6ae4,_0x161c6f){var _0x2477df={},_0x402e57={},_0x585110={'count':0x0,'rows':[]};var _0x3dd9cc=_[_0xc58c('0x2d')](db[_0xc58c('0x2e')][_0xc58c('0x2f')],function(_0x4fd51d){return{'name':_0x4fd51d[_0xc58c('0x30')],'type':_0x4fd51d[_0xc58c('0x31')]['key']};});_0x402e57[_0xc58c('0x32')]=_[_0xc58c('0x2d')](_0x3dd9cc,'name');_0x402e57[_0xc58c('0x33')]=_[_0xc58c('0x34')](_0x4d6ae4[_0xc58c('0x33')]);_0x402e57[_0xc58c('0x35')]=_[_0xc58c('0x36')](_0x402e57[_0xc58c('0x32')],_0x402e57[_0xc58c('0x33')]);_0x2477df[_0xc58c('0x37')]=_[_0xc58c('0x36')](_0x402e57['model'],qs[_0xc58c('0x38')](_0x4d6ae4[_0xc58c('0x33')][_0xc58c('0x38')]));_0x2477df[_0xc58c('0x37')]=_0x2477df[_0xc58c('0x37')][_0xc58c('0x39')]?_0x2477df[_0xc58c('0x37')]:_0x402e57[_0xc58c('0x32')];if(!_0x4d6ae4['query'][_0xc58c('0x3a')](_0xc58c('0x3b'))){_0x2477df[_0xc58c('0x21')]=qs[_0xc58c('0x21')](_0x4d6ae4[_0xc58c('0x33')][_0xc58c('0x21')]);_0x2477df['offset']=qs[_0xc58c('0x20')](_0x4d6ae4[_0xc58c('0x33')][_0xc58c('0x20')]);}_0x2477df[_0xc58c('0x3c')]=qs[_0xc58c('0x3d')](_0x4d6ae4['query'][_0xc58c('0x3d')]);_0x2477df[_0xc58c('0x3e')]=qs[_0xc58c('0x35')](_[_0xc58c('0x3f')](_0x4d6ae4[_0xc58c('0x33')],_0x402e57[_0xc58c('0x35')]),_0x3dd9cc);if(_0x4d6ae4[_0xc58c('0x33')][_0xc58c('0x40')]){_0x2477df[_0xc58c('0x3e')]=_[_0xc58c('0x41')](_0x2477df[_0xc58c('0x3e')],{'$or':_[_0xc58c('0x2d')](_0x3dd9cc,function(_0x19df21){if(_0x19df21[_0xc58c('0x31')]!==_0xc58c('0x42')){var _0x2271cb={};_0x2271cb[_0x19df21[_0xc58c('0x2a')]]={'$like':'%'+_0x4d6ae4[_0xc58c('0x33')][_0xc58c('0x40')]+'%'};return _0x2271cb;}})});}_0x2477df=_[_0xc58c('0x41')]({},_0x2477df,_0x4d6ae4[_0xc58c('0x43')]);var _0x497ed1={'where':_0x2477df['where']};return db['OpenchannelTransferReport'][_0xc58c('0x1f')](_0x497ed1)[_0xc58c('0x27')](function(_0x4d9cbc){_0x585110[_0xc58c('0x1f')]=_0x4d9cbc;if(_0x4d6ae4[_0xc58c('0x33')]['includeAll']){_0x2477df[_0xc58c('0x44')]=[{'all':!![]}];}return db[_0xc58c('0x2e')][_0xc58c('0x45')](_0x2477df);})[_0xc58c('0x27')](function(_0x47676e){_0x585110[_0xc58c('0x46')]=_0x47676e;return _0x585110;})[_0xc58c('0x27')](respondWithFilteredResult(_0x161c6f,_0x2477df))[_0xc58c('0x47')](handleError(_0x161c6f,null));};exports[_0xc58c('0x48')]=function(_0x21dea0,_0x5f2bbd){var _0x321d5a={'raw':!![],'where':{'id':_0x21dea0[_0xc58c('0x49')]['id']}},_0x5e326a={};_0x5e326a[_0xc58c('0x32')]=_[_0xc58c('0x34')](db[_0xc58c('0x2e')][_0xc58c('0x2f')]);_0x5e326a['query']=_[_0xc58c('0x34')](_0x21dea0[_0xc58c('0x33')]);_0x5e326a[_0xc58c('0x35')]=_[_0xc58c('0x36')](_0x5e326a['model'],_0x5e326a['query']);_0x321d5a[_0xc58c('0x37')]=_['intersection'](_0x5e326a[_0xc58c('0x32')],qs['fields'](_0x21dea0[_0xc58c('0x33')][_0xc58c('0x38')]));_0x321d5a[_0xc58c('0x37')]=_0x321d5a[_0xc58c('0x37')][_0xc58c('0x39')]?_0x321d5a[_0xc58c('0x37')]:_0x5e326a[_0xc58c('0x32')];if(_0x21dea0[_0xc58c('0x33')][_0xc58c('0x4a')]){_0x321d5a[_0xc58c('0x44')]=[{'all':!![]}];}_0x321d5a=_[_0xc58c('0x41')]({},_0x321d5a,_0x21dea0[_0xc58c('0x43')]);return db[_0xc58c('0x2e')][_0xc58c('0x4b')](_0x321d5a)['then'](handleEntityNotFound(_0x5f2bbd,null))['then'](respondWithResult(_0x5f2bbd,null))[_0xc58c('0x47')](handleError(_0x5f2bbd,null));};exports[_0xc58c('0x4c')]=function(_0x46d25f,_0x1c72c7){return db[_0xc58c('0x2e')][_0xc58c('0x4c')](_0x46d25f[_0xc58c('0x4d')],{})[_0xc58c('0x27')](respondWithResult(_0x1c72c7,0xc9))[_0xc58c('0x47')](handleError(_0x1c72c7,null));};exports[_0xc58c('0x25')]=function(_0x1e0216,_0x315731){if(_0x1e0216[_0xc58c('0x4d')]['id']){delete _0x1e0216[_0xc58c('0x4d')]['id'];}return db['OpenchannelTransferReport'][_0xc58c('0x4b')]({'where':{'id':_0x1e0216[_0xc58c('0x49')]['id']}})[_0xc58c('0x27')](handleEntityNotFound(_0x315731,null))[_0xc58c('0x27')](saveUpdates(_0x1e0216[_0xc58c('0x4d')],null))[_0xc58c('0x27')](respondWithResult(_0x315731,null))[_0xc58c('0x47')](handleError(_0x315731,null));};exports['destroy']=function(_0x16af85,_0x577cf3){return db[_0xc58c('0x2e')]['find']({'where':{'id':_0x16af85[_0xc58c('0x49')]['id']}})[_0xc58c('0x27')](handleEntityNotFound(_0x577cf3,null))[_0xc58c('0x27')](removeEntity(_0x577cf3,null))['catch'](handleError(_0x577cf3,null));};exports['describe']=function(_0xf047ee,_0x27cd95){return db[_0xc58c('0x2e')][_0xc58c('0x4e')]()[_0xc58c('0x27')](respondWithResult(_0x27cd95,null))[_0xc58c('0x47')](handleError(_0x27cd95,null));}; \ No newline at end of file +var _0x8025=['moment','bluebird','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2b2a87,_0x16569b){var _0x308440=function(_0x308b17){while(--_0x308b17){_0x2b2a87['push'](_0x2b2a87['shift']());}};_0x308440(++_0x16569b);}(_0x8025,0x92));var _0x5802=function(_0x1cefaf,_0x2958d1){_0x1cefaf=_0x1cefaf-0x0;var _0x125999=_0x8025[_0x1cefaf];return _0x125999;};'use strict';var pdf=require(_0x5802('0x0'));var emlformat=require(_0x5802('0x1'));var rimraf=require(_0x5802('0x2'));var zipdir=require(_0x5802('0x3'));var jsonpatch=require(_0x5802('0x4'));var rp=require(_0x5802('0x5'));var moment=require(_0x5802('0x6'));var BPromise=require(_0x5802('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5802('0x8'));var fs=require('fs');var fs_extra=require(_0x5802('0x9'));var _=require(_0x5802('0xa'));var squel=require(_0x5802('0xb'));var crypto=require(_0x5802('0xc'));var jsforce=require(_0x5802('0xd'));var deskjs=require(_0x5802('0xe'));var toCsv=require(_0x5802('0xf'));var querystring=require(_0x5802('0x10'));var Papa=require(_0x5802('0x11'));var Redis=require(_0x5802('0x12'));var authService=require(_0x5802('0x13'));var qs=require(_0x5802('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5802('0x15'));var logger=require(_0x5802('0x16'))(_0x5802('0x17'));var utils=require(_0x5802('0x18'));var config=require(_0x5802('0x19'));var licenseUtil=require(_0x5802('0x1a'));var db=require(_0x5802('0x1b'))['db'];function respondWithStatusCode(_0x28d6,_0xba3210){_0xba3210=_0xba3210||0xcc;return function(_0x156d04){if(_0x156d04){return _0x28d6[_0x5802('0x1c')](_0xba3210);}return _0x28d6[_0x5802('0x1d')](_0xba3210)[_0x5802('0x1e')]();};}function respondWithResult(_0x382cee,_0x54aaed){_0x54aaed=_0x54aaed||0xc8;return function(_0x28c855){if(_0x28c855){return _0x382cee[_0x5802('0x1d')](_0x54aaed)[_0x5802('0x1f')](_0x28c855);}};}function respondWithFilteredResult(_0x295c91,_0x28408b){return function(_0x5844de){if(_0x5844de){var _0x6b8e1e=_0x5844de[_0x5802('0x20')],_0x291d23=_0x28408b[_0x5802('0x21')],_0x158557=_0x28408b[_0x5802('0x21')]+_0x28408b[_0x5802('0x22')],_0x342e02;if(_0x158557>=_0x6b8e1e){_0x158557=_0x6b8e1e;_0x342e02=0xc8;}else{_0x342e02=0xce;}_0x295c91[_0x5802('0x1d')](_0x342e02);return _0x295c91['set'](_0x5802('0x23'),_0x291d23+'-'+_0x158557+'/'+_0x6b8e1e)[_0x5802('0x1f')](_0x5844de);}return null;};}function patchUpdates(_0x1e39ef){return function(_0x203115){try{jsonpatch['apply'](_0x203115,_0x1e39ef,!![]);}catch(_0x5b9cb1){return BPromise[_0x5802('0x24')](_0x5b9cb1);}return _0x203115[_0x5802('0x25')]();};}function saveUpdates(_0x2ddf41,_0x135e37){return function(_0xcbcb47){if(_0xcbcb47){return _0xcbcb47[_0x5802('0x26')](_0x2ddf41)[_0x5802('0x27')](function(_0x19d573){return _0x19d573;});}return null;};}function removeEntity(_0x18d5bf,_0x43925a){return function(_0x43289e){if(_0x43289e){return _0x43289e[_0x5802('0x28')]()[_0x5802('0x27')](function(){_0x18d5bf[_0x5802('0x1d')](0xcc)[_0x5802('0x1e')]();});}};}function handleEntityNotFound(_0x5f0aca,_0x53a744){return function(_0x52bb89){if(!_0x52bb89){_0x5f0aca[_0x5802('0x1c')](0x194);}return _0x52bb89;};}function handleError(_0x487955,_0x6378ca){_0x6378ca=_0x6378ca||0x1f4;return function(_0x55ba3a){logger[_0x5802('0x29')](_0x55ba3a[_0x5802('0x2a')]);if(_0x55ba3a['name']){delete _0x55ba3a[_0x5802('0x2b')];}_0x487955[_0x5802('0x1d')](_0x6378ca)['send'](_0x55ba3a);};}exports['index']=function(_0xe3306c,_0x4cd364){var _0x10b050={},_0x4eab10={},_0x3779b3={'count':0x0,'rows':[]};var _0x36d1da=_[_0x5802('0x2c')](db[_0x5802('0x2d')][_0x5802('0x2e')],function(_0x1cbc39){return{'name':_0x1cbc39[_0x5802('0x2f')],'type':_0x1cbc39[_0x5802('0x30')][_0x5802('0x31')]};});_0x4eab10[_0x5802('0x32')]=_[_0x5802('0x2c')](_0x36d1da,_0x5802('0x2b'));_0x4eab10[_0x5802('0x33')]=_[_0x5802('0x34')](_0xe3306c['query']);_0x4eab10[_0x5802('0x35')]=_[_0x5802('0x36')](_0x4eab10[_0x5802('0x32')],_0x4eab10['query']);_0x10b050['attributes']=_[_0x5802('0x36')](_0x4eab10[_0x5802('0x32')],qs[_0x5802('0x37')](_0xe3306c[_0x5802('0x33')][_0x5802('0x37')]));_0x10b050['attributes']=_0x10b050[_0x5802('0x38')][_0x5802('0x39')]?_0x10b050[_0x5802('0x38')]:_0x4eab10[_0x5802('0x32')];if(!_0xe3306c[_0x5802('0x33')][_0x5802('0x3a')]('nolimit')){_0x10b050[_0x5802('0x22')]=qs[_0x5802('0x22')](_0xe3306c[_0x5802('0x33')][_0x5802('0x22')]);_0x10b050[_0x5802('0x21')]=qs[_0x5802('0x21')](_0xe3306c[_0x5802('0x33')][_0x5802('0x21')]);}_0x10b050['order']=qs['sort'](_0xe3306c['query'][_0x5802('0x3b')]);_0x10b050['where']=qs[_0x5802('0x35')](_['pick'](_0xe3306c[_0x5802('0x33')],_0x4eab10[_0x5802('0x35')]),_0x36d1da);if(_0xe3306c[_0x5802('0x33')][_0x5802('0x3c')]){_0x10b050[_0x5802('0x3d')]=_[_0x5802('0x3e')](_0x10b050[_0x5802('0x3d')],{'$or':_[_0x5802('0x2c')](_0x36d1da,function(_0x1b216a){if(_0x1b216a['type']!==_0x5802('0x3f')){var _0x42d4ee={};_0x42d4ee[_0x1b216a[_0x5802('0x2b')]]={'$like':'%'+_0xe3306c[_0x5802('0x33')][_0x5802('0x3c')]+'%'};return _0x42d4ee;}})});}_0x10b050=_[_0x5802('0x3e')]({},_0x10b050,_0xe3306c[_0x5802('0x40')]);var _0x477f57={'where':_0x10b050[_0x5802('0x3d')]};return db['OpenchannelTransferReport']['count'](_0x477f57)[_0x5802('0x27')](function(_0x241e14){_0x3779b3[_0x5802('0x20')]=_0x241e14;if(_0xe3306c[_0x5802('0x33')][_0x5802('0x41')]){_0x10b050[_0x5802('0x42')]=[{'all':!![]}];}return db[_0x5802('0x2d')][_0x5802('0x43')](_0x10b050);})[_0x5802('0x27')](function(_0x219298){_0x3779b3[_0x5802('0x44')]=_0x219298;return _0x3779b3;})[_0x5802('0x27')](respondWithFilteredResult(_0x4cd364,_0x10b050))[_0x5802('0x45')](handleError(_0x4cd364,null));};exports[_0x5802('0x46')]=function(_0x2d92b8,_0x397aff){var _0x32bbe5={'raw':!![],'where':{'id':_0x2d92b8[_0x5802('0x47')]['id']}},_0x43fba2={};_0x43fba2[_0x5802('0x32')]=_[_0x5802('0x34')](db[_0x5802('0x2d')][_0x5802('0x2e')]);_0x43fba2['query']=_['keys'](_0x2d92b8[_0x5802('0x33')]);_0x43fba2[_0x5802('0x35')]=_[_0x5802('0x36')](_0x43fba2[_0x5802('0x32')],_0x43fba2[_0x5802('0x33')]);_0x32bbe5[_0x5802('0x38')]=_[_0x5802('0x36')](_0x43fba2[_0x5802('0x32')],qs[_0x5802('0x37')](_0x2d92b8[_0x5802('0x33')][_0x5802('0x37')]));_0x32bbe5['attributes']=_0x32bbe5[_0x5802('0x38')]['length']?_0x32bbe5['attributes']:_0x43fba2[_0x5802('0x32')];if(_0x2d92b8[_0x5802('0x33')][_0x5802('0x41')]){_0x32bbe5[_0x5802('0x42')]=[{'all':!![]}];}_0x32bbe5=_[_0x5802('0x3e')]({},_0x32bbe5,_0x2d92b8[_0x5802('0x40')]);return db[_0x5802('0x2d')]['find'](_0x32bbe5)[_0x5802('0x27')](handleEntityNotFound(_0x397aff,null))[_0x5802('0x27')](respondWithResult(_0x397aff,null))['catch'](handleError(_0x397aff,null));};exports[_0x5802('0x48')]=function(_0x54b4b3,_0x2d3606){return db[_0x5802('0x2d')][_0x5802('0x48')](_0x54b4b3['body'],{})['then'](respondWithResult(_0x2d3606,0xc9))[_0x5802('0x45')](handleError(_0x2d3606,null));};exports[_0x5802('0x26')]=function(_0x37e4cd,_0x377df5){if(_0x37e4cd[_0x5802('0x49')]['id']){delete _0x37e4cd['body']['id'];}return db[_0x5802('0x2d')][_0x5802('0x4a')]({'where':{'id':_0x37e4cd[_0x5802('0x47')]['id']}})[_0x5802('0x27')](handleEntityNotFound(_0x377df5,null))[_0x5802('0x27')](saveUpdates(_0x37e4cd[_0x5802('0x49')],null))[_0x5802('0x27')](respondWithResult(_0x377df5,null))[_0x5802('0x45')](handleError(_0x377df5,null));};exports[_0x5802('0x28')]=function(_0x392031,_0x9832ee){return db['OpenchannelTransferReport'][_0x5802('0x4a')]({'where':{'id':_0x392031[_0x5802('0x47')]['id']}})[_0x5802('0x27')](handleEntityNotFound(_0x9832ee,null))[_0x5802('0x27')](removeEntity(_0x9832ee,null))[_0x5802('0x45')](handleError(_0x9832ee,null));};exports[_0x5802('0x4b')]=function(_0x19327b,_0x10d7ec){return db[_0x5802('0x2d')][_0x5802('0x4b')]()[_0x5802('0x27')](respondWithResult(_0x10d7ec,null))[_0x5802('0x45')](handleError(_0x10d7ec,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 3d17839..095eba6 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 _0xab13=['api','moment','bluebird','path','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0xab13,0x18a));var _0x3ab1=function(_0xf3120,_0x80a54c){_0xf3120=_0xf3120-0x0;var _0x5aa549=_0xab13[_0xf3120];return _0x5aa549;};'use strict';var _=require('lodash');var util=require(_0x3ab1('0x0'));var logger=require(_0x3ab1('0x1'))(_0x3ab1('0x2'));var moment=require(_0x3ab1('0x3'));var BPromise=require(_0x3ab1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ab1('0x5'));var rimraf=require('rimraf');var config=require(_0x3ab1('0x6'));var attributes=require(_0x3ab1('0x7'));module[_0x3ab1('0x8')]=function(_0x213391,_0x5dd712){return _0x213391['define'](_0x3ab1('0x9'),attributes,{'tableName':_0x3ab1('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3ab1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc1a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x11b475,_0x49e27f){var _0x5cef50=function(_0x6bc0ef){while(--_0x6bc0ef){_0x11b475['push'](_0x11b475['shift']());}};_0x5cef50(++_0x49e27f);}(_0xbc1a,0x70));var _0xabc1=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xbc1a[_0x39c734];return _0xb2a2f9;};'use strict';var _=require('lodash');var util=require(_0xabc1('0x0'));var logger=require(_0xabc1('0x1'))(_0xabc1('0x2'));var moment=require(_0xabc1('0x3'));var BPromise=require(_0xabc1('0x4'));var rp=require(_0xabc1('0x5'));var fs=require('fs');var path=require(_0xabc1('0x6'));var rimraf=require(_0xabc1('0x7'));var config=require('../../config/environment');var attributes=require(_0xabc1('0x8'));module[_0xabc1('0x9')]=function(_0x4265df,_0x257d61){return _0x4265df[_0xabc1('0xa')](_0xabc1('0xb'),attributes,{'tableName':_0xabc1('0xc'),'paranoid':![],'indexes':[{'name':_0xabc1('0xd'),'fields':[_0xabc1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 86c6683..67695e9 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 _0x3713=['client','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','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x16f9b1,_0x21450b){var _0x557675=function(_0x215576){while(--_0x215576){_0x16f9b1['push'](_0x16f9b1['shift']());}};_0x557675(++_0x21450b);}(_0x3713,0xe7));var _0x3371=function(_0x5d757c,_0x3bcb3d){_0x5d757c=_0x5d757c-0x0;var _0x44302f=_0x3713[_0x5d757c];return _0x44302f;};'use strict';var _=require(_0x3371('0x0'));var util=require('util');var moment=require(_0x3371('0x1'));var BPromise=require(_0x3371('0x2'));var rs=require(_0x3371('0x3'));var fs=require('fs');var Redis=require(_0x3371('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3371('0x5'));var logger=require(_0x3371('0x6'))('rpc');var config=require(_0x3371('0x7'));var jayson=require(_0x3371('0x8'));var client=jayson[_0x3371('0x9')][_0x3371('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26bf23,_0xd2e5fa,_0x8342ed){return new BPromise(function(_0x26f18e,_0x506a72){return client[_0x3371('0xb')](_0x26bf23,_0x8342ed)[_0x3371('0xc')](function(_0x45f661){logger[_0x3371('0xd')](_0x3371('0xe'),_0xd2e5fa,_0x3371('0xf'));logger[_0x3371('0x10')](_0x3371('0x11'),_0xd2e5fa,'request\x20sent',JSON[_0x3371('0x12')](_0x45f661));if(_0x45f661[_0x3371('0x13')]){if(_0x45f661[_0x3371('0x13')][_0x3371('0x14')]===0x1f4){logger[_0x3371('0x13')](_0x3371('0xe'),_0xd2e5fa,_0x45f661[_0x3371('0x13')][_0x3371('0x15')]);return _0x506a72(_0x45f661[_0x3371('0x13')][_0x3371('0x15')]);}logger[_0x3371('0x13')](_0x3371('0xe'),_0xd2e5fa,_0x45f661['error']['message']);return _0x26f18e(_0x45f661[_0x3371('0x13')][_0x3371('0x15')]);}else{logger[_0x3371('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xd2e5fa,_0x3371('0xf'));_0x26f18e(_0x45f661[_0x3371('0x16')]['message']);}})[_0x3371('0x17')](function(_0x1b3ce7){logger[_0x3371('0x13')](_0x3371('0xe'),_0xd2e5fa,_0x1b3ce7);_0x506a72(_0x1b3ce7);});});} \ No newline at end of file +var _0x2913=['message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x481cf8,_0x416f29){var _0x5ef718=function(_0x5dc28e){while(--_0x5dc28e){_0x481cf8['push'](_0x481cf8['shift']());}};_0x5ef718(++_0x416f29);}(_0x2913,0x123));var _0x3291=function(_0x4bb90e,_0x47bd56){_0x4bb90e=_0x4bb90e-0x0;var _0x4628ec=_0x2913[_0x4bb90e];return _0x4628ec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3291('0x0'));var BPromise=require(_0x3291('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3291('0x2'));var db=require(_0x3291('0x3'))['db'];var utils=require(_0x3291('0x4'));var logger=require(_0x3291('0x5'))(_0x3291('0x6'));var config=require(_0x3291('0x7'));var jayson=require(_0x3291('0x8'));var client=jayson[_0x3291('0x9')][_0x3291('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1735bd,_0x182f65,_0xe7f555){return new BPromise(function(_0x3d28e2,_0x14fefe){return client[_0x3291('0xb')](_0x1735bd,_0xe7f555)[_0x3291('0xc')](function(_0x3cf147){logger[_0x3291('0xd')](_0x3291('0xe'),_0x182f65,_0x3291('0xf'));logger[_0x3291('0x10')](_0x3291('0x11'),_0x182f65,_0x3291('0xf'),JSON[_0x3291('0x12')](_0x3cf147));if(_0x3cf147[_0x3291('0x13')]){if(_0x3cf147[_0x3291('0x13')][_0x3291('0x14')]===0x1f4){logger[_0x3291('0x13')](_0x3291('0xe'),_0x182f65,_0x3cf147[_0x3291('0x13')][_0x3291('0x15')]);return _0x14fefe(_0x3cf147['error']['message']);}logger[_0x3291('0x13')](_0x3291('0xe'),_0x182f65,_0x3cf147[_0x3291('0x13')][_0x3291('0x15')]);return _0x3d28e2(_0x3cf147[_0x3291('0x13')][_0x3291('0x15')]);}else{logger['info'](_0x3291('0xe'),_0x182f65,_0x3291('0xf'));_0x3d28e2(_0x3cf147[_0x3291('0x16')][_0x3291('0x15')]);}})[_0x3291('0x17')](function(_0x532266){logger[_0x3291('0x13')](_0x3291('0xe'),_0x182f65,_0x532266);_0x14fefe(_0x532266);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 8ef954e..77e462f 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 _0x72d1=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x72d1,0xc0));var _0x172d=function(_0x43e2e4,_0x4ad3b4){_0x43e2e4=_0x43e2e4-0x0;var _0x1b71d0=_0x72d1[_0x43e2e4];return _0x1b71d0;};'use strict';var multer=require(_0x172d('0x0'));var util=require(_0x172d('0x1'));var path=require(_0x172d('0x2'));var timeout=require('connect-timeout');var express=require(_0x172d('0x3'));var router=express[_0x172d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x172d('0x5'));var interaction=require(_0x172d('0x6'));var config=require(_0x172d('0x7'));var controller=require('./pause.controller');router[_0x172d('0x8')]('/',auth[_0x172d('0x9')](),controller[_0x172d('0xa')]);router[_0x172d('0x8')](_0x172d('0xb'),auth['isAuthenticated'](),controller[_0x172d('0xc')]);router[_0x172d('0xd')]('/',auth['isAuthenticated'](),controller[_0x172d('0xe')]);router[_0x172d('0xf')]('/:id',auth[_0x172d('0x9')](),controller[_0x172d('0x10')]);router[_0x172d('0x11')](_0x172d('0xb'),auth[_0x172d('0x9')](),controller[_0x172d('0x12')]);module[_0x172d('0x13')]=router; \ No newline at end of file +var _0x2926=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','create','put','update','delete','destroy'];(function(_0x29c8c4,_0x2cdf25){var _0xf11b18=function(_0x2e7fea){while(--_0x2e7fea){_0x29c8c4['push'](_0x29c8c4['shift']());}};_0xf11b18(++_0x2cdf25);}(_0x2926,0x170));var _0x6292=function(_0x5338fe,_0x5e71d1){_0x5338fe=_0x5338fe-0x0;var _0xf0a1be=_0x2926[_0x5338fe];return _0xf0a1be;};'use strict';var multer=require('multer');var util=require(_0x6292('0x0'));var path=require(_0x6292('0x1'));var timeout=require(_0x6292('0x2'));var express=require(_0x6292('0x3'));var router=express['Router']();var fs_extra=require(_0x6292('0x4'));var auth=require(_0x6292('0x5'));var interaction=require(_0x6292('0x6'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x6292('0x7')]('/',auth[_0x6292('0x8')](),controller['index']);router['get'](_0x6292('0x9'),auth['isAuthenticated'](),controller[_0x6292('0xa')]);router['post']('/',auth[_0x6292('0x8')](),controller[_0x6292('0xb')]);router[_0x6292('0xc')](_0x6292('0x9'),auth[_0x6292('0x8')](),controller[_0x6292('0xd')]);router[_0x6292('0xe')](_0x6292('0x9'),auth[_0x6292('0x8')](),controller[_0x6292('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 9009b47..78e6321 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 _0x210f=['exports','STRING','name','sequelize'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x210f,0x123));var _0xf210=function(_0x7cf5ca,_0xfc5f30){_0x7cf5ca=_0x7cf5ca-0x0;var _0x39c365=_0x210f[_0x7cf5ca];return _0x39c365;};'use strict';var Sequelize=require(_0xf210('0x0'));module[_0xf210('0x1')]={'name':{'type':Sequelize[_0xf210('0x2')],'unique':_0xf210('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf210('0x2')]}}; \ No newline at end of file +var _0x3745=['STRING','name'];(function(_0x448ae2,_0x1676f5){var _0x4fdd34=function(_0x30e907){while(--_0x30e907){_0x448ae2['push'](_0x448ae2['shift']());}};_0x4fdd34(++_0x1676f5);}(_0x3745,0x107));var _0x5374=function(_0x2f73a7,_0x1be12b){_0x2f73a7=_0x2f73a7-0x0;var _0x4e8690=_0x3745[_0x2f73a7];return _0x4e8690;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5374('0x0'),'allowNull':![]},'description':{'type':Sequelize[_0x5374('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 3402bc7..d5f5a3a 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 _0x2082=['filter','merge','VIRTUAL','options','count','include','findAll','rows','rawAttributes','find','catch','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','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','fieldName','type','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x2082,0x1c3));var _0x2208=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0x2082[_0x2c7dc6];return _0x10002b;};'use strict';var pdf=require(_0x2208('0x0'));var emlformat=require(_0x2208('0x1'));var rimraf=require(_0x2208('0x2'));var zipdir=require(_0x2208('0x3'));var jsonpatch=require(_0x2208('0x4'));var rp=require('request-promise');var moment=require(_0x2208('0x5'));var BPromise=require(_0x2208('0x6'));var Mustache=require('mustache');var util=require(_0x2208('0x7'));var path=require('path');var sox=require(_0x2208('0x8'));var csv=require(_0x2208('0x9'));var ejs=require(_0x2208('0xa'));var fs=require('fs');var fs_extra=require(_0x2208('0xb'));var _=require(_0x2208('0xc'));var squel=require(_0x2208('0xd'));var crypto=require(_0x2208('0xe'));var jsforce=require(_0x2208('0xf'));var deskjs=require(_0x2208('0x10'));var toCsv=require(_0x2208('0x9'));var querystring=require(_0x2208('0x11'));var Papa=require(_0x2208('0x12'));var Redis=require(_0x2208('0x13'));var authService=require(_0x2208('0x14'));var qs=require(_0x2208('0x15'));var as=require(_0x2208('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2208('0x17'))('api');var utils=require(_0x2208('0x18'));var config=require(_0x2208('0x19'));var licenseUtil=require(_0x2208('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc7708c,_0x11b129){_0x11b129=_0x11b129||0xcc;return function(_0x363bd4){if(_0x363bd4){return _0xc7708c[_0x2208('0x1b')](_0x11b129);}return _0xc7708c[_0x2208('0x1c')](_0x11b129)[_0x2208('0x1d')]();};}function respondWithResult(_0x571fbc,_0x1e78cd){_0x1e78cd=_0x1e78cd||0xc8;return function(_0x5d35c1){if(_0x5d35c1){return _0x571fbc[_0x2208('0x1c')](_0x1e78cd)[_0x2208('0x1e')](_0x5d35c1);}};}function respondWithFilteredResult(_0x3e0b07,_0x583994){return function(_0x21dde8){if(_0x21dde8){var _0x193dd1=_0x21dde8['count'],_0x320f66=_0x583994[_0x2208('0x1f')],_0x15eae7=_0x583994['offset']+_0x583994[_0x2208('0x20')],_0x15e437;if(_0x15eae7>=_0x193dd1){_0x15eae7=_0x193dd1;_0x15e437=0xc8;}else{_0x15e437=0xce;}_0x3e0b07['status'](_0x15e437);return _0x3e0b07[_0x2208('0x21')](_0x2208('0x22'),_0x320f66+'-'+_0x15eae7+'/'+_0x193dd1)[_0x2208('0x1e')](_0x21dde8);}return null;};}function patchUpdates(_0x4700a8){return function(_0x2a7aec){try{jsonpatch[_0x2208('0x23')](_0x2a7aec,_0x4700a8,!![]);}catch(_0x45b546){return BPromise[_0x2208('0x24')](_0x45b546);}return _0x2a7aec[_0x2208('0x25')]();};}function saveUpdates(_0x4536ff,_0x43fd0f){return function(_0xdef301){if(_0xdef301){return _0xdef301[_0x2208('0x26')](_0x4536ff)[_0x2208('0x27')](function(_0x19ba31){return _0x19ba31;});}return null;};}function removeEntity(_0x3afd09,_0x3718b2){return function(_0x25345d){if(_0x25345d){return _0x25345d[_0x2208('0x28')]()[_0x2208('0x27')](function(){var _0x9e35c4=_0x25345d[_0x2208('0x29')]({'plain':!![]});var _0x50f5e3=_0x2208('0x2a');return db[_0x2208('0x2b')][_0x2208('0x28')]({'where':{'type':_0x50f5e3,'resourceId':_0x9e35c4['id']}})[_0x2208('0x27')](function(){return _0x25345d;});})[_0x2208('0x27')](function(){_0x3afd09[_0x2208('0x1c')](0xcc)[_0x2208('0x1d')]();});}};}function handleEntityNotFound(_0x5d849d,_0x49d4e8){return function(_0x17a9d4){if(!_0x17a9d4){_0x5d849d[_0x2208('0x1b')](0x194);}return _0x17a9d4;};}function handleError(_0x4e8695,_0xbda26e){_0xbda26e=_0xbda26e||0x1f4;return function(_0x4ed19a){logger[_0x2208('0x2c')](_0x4ed19a[_0x2208('0x2d')]);if(_0x4ed19a[_0x2208('0x2e')]){delete _0x4ed19a[_0x2208('0x2e')];}_0x4e8695[_0x2208('0x1c')](_0xbda26e)[_0x2208('0x2f')](_0x4ed19a);};}exports[_0x2208('0x30')]=function(_0x35f39a,_0x3c19c8){var _0x56d6e2={},_0x55fb2d={},_0x300543={'count':0x0,'rows':[]};var _0x43796a=_[_0x2208('0x31')](db[_0x2208('0x32')]['rawAttributes'],function(_0x29890d){return{'name':_0x29890d[_0x2208('0x33')],'type':_0x29890d[_0x2208('0x34')]['key']};});_0x55fb2d['model']=_[_0x2208('0x31')](_0x43796a,_0x2208('0x2e'));_0x55fb2d[_0x2208('0x35')]=_[_0x2208('0x36')](_0x35f39a[_0x2208('0x35')]);_0x55fb2d['filters']=_[_0x2208('0x37')](_0x55fb2d[_0x2208('0x38')],_0x55fb2d[_0x2208('0x35')]);_0x56d6e2[_0x2208('0x39')]=_['intersection'](_0x55fb2d['model'],qs[_0x2208('0x3a')](_0x35f39a[_0x2208('0x35')][_0x2208('0x3a')]));_0x56d6e2[_0x2208('0x39')]=_0x56d6e2[_0x2208('0x39')][_0x2208('0x3b')]?_0x56d6e2[_0x2208('0x39')]:_0x55fb2d['model'];if(!_0x35f39a[_0x2208('0x35')]['hasOwnProperty']('nolimit')){_0x56d6e2[_0x2208('0x20')]=qs['limit'](_0x35f39a[_0x2208('0x35')][_0x2208('0x20')]);_0x56d6e2[_0x2208('0x1f')]=qs[_0x2208('0x1f')](_0x35f39a[_0x2208('0x35')]['offset']);}_0x56d6e2[_0x2208('0x3c')]=qs[_0x2208('0x3d')](_0x35f39a[_0x2208('0x35')][_0x2208('0x3d')]);_0x56d6e2[_0x2208('0x3e')]=qs[_0x2208('0x3f')](_[_0x2208('0x40')](_0x35f39a[_0x2208('0x35')],_0x55fb2d[_0x2208('0x3f')]),_0x43796a);if(_0x35f39a['query'][_0x2208('0x41')]){_0x56d6e2[_0x2208('0x3e')]=_[_0x2208('0x42')](_0x56d6e2[_0x2208('0x3e')],{'$or':_[_0x2208('0x31')](_0x43796a,function(_0x375309){if(_0x375309[_0x2208('0x34')]!==_0x2208('0x43')){var _0x3e2537={};_0x3e2537[_0x375309[_0x2208('0x2e')]]={'$like':'%'+_0x35f39a[_0x2208('0x35')][_0x2208('0x41')]+'%'};return _0x3e2537;}})});}_0x56d6e2=_['merge']({},_0x56d6e2,_0x35f39a[_0x2208('0x44')]);var _0x40edd2={'where':_0x56d6e2[_0x2208('0x3e')]};return db[_0x2208('0x32')]['count'](_0x40edd2)[_0x2208('0x27')](function(_0x26b27f){_0x300543[_0x2208('0x45')]=_0x26b27f;if(_0x35f39a[_0x2208('0x35')]['includeAll']){_0x56d6e2[_0x2208('0x46')]=[{'all':!![]}];}return db['Pause'][_0x2208('0x47')](_0x56d6e2);})[_0x2208('0x27')](function(_0x188e4d){_0x300543[_0x2208('0x48')]=_0x188e4d;return _0x300543;})[_0x2208('0x27')](respondWithFilteredResult(_0x3c19c8,_0x56d6e2))['catch'](handleError(_0x3c19c8,null));};exports['show']=function(_0x4f0ea4,_0x31ca27){var _0x5c7ee9={'raw':!![],'where':{'id':_0x4f0ea4['params']['id']}},_0x2c0d2c={};_0x2c0d2c[_0x2208('0x38')]=_['keys'](db[_0x2208('0x32')][_0x2208('0x49')]);_0x2c0d2c[_0x2208('0x35')]=_[_0x2208('0x36')](_0x4f0ea4['query']);_0x2c0d2c[_0x2208('0x3f')]=_[_0x2208('0x37')](_0x2c0d2c['model'],_0x2c0d2c[_0x2208('0x35')]);_0x5c7ee9[_0x2208('0x39')]=_[_0x2208('0x37')](_0x2c0d2c[_0x2208('0x38')],qs[_0x2208('0x3a')](_0x4f0ea4[_0x2208('0x35')]['fields']));_0x5c7ee9[_0x2208('0x39')]=_0x5c7ee9[_0x2208('0x39')][_0x2208('0x3b')]?_0x5c7ee9[_0x2208('0x39')]:_0x2c0d2c['model'];if(_0x4f0ea4['query']['includeAll']){_0x5c7ee9['include']=[{'all':!![]}];}_0x5c7ee9=_[_0x2208('0x42')]({},_0x5c7ee9,_0x4f0ea4['options']);return db[_0x2208('0x32')][_0x2208('0x4a')](_0x5c7ee9)[_0x2208('0x27')](handleEntityNotFound(_0x31ca27,null))[_0x2208('0x27')](respondWithResult(_0x31ca27,null))[_0x2208('0x4b')](handleError(_0x31ca27,null));};exports[_0x2208('0x4c')]=function(_0x50cdf4,_0x1e302d){return db[_0x2208('0x32')][_0x2208('0x4c')](_0x50cdf4[_0x2208('0x4d')],{})[_0x2208('0x27')](function(_0x5b46a3){var _0x4f1eb9=_0x50cdf4[_0x2208('0x4e')][_0x2208('0x29')]({'plain':!![]});if(!_0x4f1eb9)throw new Error(_0x2208('0x4f'));if(_0x4f1eb9[_0x2208('0x50')]===_0x2208('0x4e')){var _0x3c1c42=_0x5b46a3[_0x2208('0x29')]({'plain':!![]});var _0x58d51a=_0x2208('0x2a');return db[_0x2208('0x51')][_0x2208('0x4a')]({'where':{'name':_0x58d51a,'userProfileId':_0x4f1eb9[_0x2208('0x52')]},'raw':!![]})['then'](function(_0x177844){if(_0x177844&&_0x177844[_0x2208('0x53')]===0x0){return db[_0x2208('0x2b')][_0x2208('0x4c')]({'name':_0x3c1c42[_0x2208('0x2e')],'resourceId':_0x3c1c42['id'],'type':_0x177844[_0x2208('0x2e')],'sectionId':_0x177844['id']},{})[_0x2208('0x27')](function(){return _0x5b46a3;});}else{return _0x5b46a3;}})['catch'](function(_0x401999){logger[_0x2208('0x2c')](_0x2208('0x54'),_0x401999);throw _0x401999;});}return _0x5b46a3;})[_0x2208('0x27')](respondWithResult(_0x1e302d,0xc9))['catch'](handleError(_0x1e302d,null));};exports[_0x2208('0x26')]=function(_0x1e6178,_0x5a505c){if(_0x1e6178[_0x2208('0x4d')]['id']){delete _0x1e6178[_0x2208('0x4d')]['id'];}return db[_0x2208('0x32')]['find']({'where':{'id':_0x1e6178[_0x2208('0x55')]['id']}})['then'](handleEntityNotFound(_0x5a505c,null))['then'](saveUpdates(_0x1e6178[_0x2208('0x4d')],null))[_0x2208('0x27')](respondWithResult(_0x5a505c,null))[_0x2208('0x4b')](handleError(_0x5a505c,null));};exports[_0x2208('0x28')]=function(_0x1235bb,_0x433748){return db[_0x2208('0x32')][_0x2208('0x4a')]({'where':{'id':_0x1235bb[_0x2208('0x55')]['id']}})[_0x2208('0x27')](handleEntityNotFound(_0x433748,null))['then'](removeEntity(_0x433748,null))[_0x2208('0x4b')](handleError(_0x433748,null));}; \ No newline at end of file +var _0x07fc=['ejs','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','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','then','get','Pauses','UserProfileResource','destroy','error','stack','name','send','index','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','count','includeAll','rows','catch','length','find','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv'];(function(_0x51811f,_0x467686){var _0xfd5346=function(_0x21e9be){while(--_0x21e9be){_0x51811f['push'](_0x51811f['shift']());}};_0xfd5346(++_0x467686);}(_0x07fc,0x99));var _0xc07f=function(_0x4886ab,_0xbc50f1){_0x4886ab=_0x4886ab-0x0;var _0xb696f8=_0x07fc[_0x4886ab];return _0xb696f8;};'use strict';var pdf=require(_0xc07f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc07f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc07f('0x2'));var rp=require(_0xc07f('0x3'));var moment=require('moment');var BPromise=require(_0xc07f('0x4'));var Mustache=require(_0xc07f('0x5'));var util=require(_0xc07f('0x6'));var path=require('path');var sox=require(_0xc07f('0x7'));var csv=require(_0xc07f('0x8'));var ejs=require(_0xc07f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc07f('0xa'));var squel=require(_0xc07f('0xb'));var crypto=require(_0xc07f('0xc'));var jsforce=require(_0xc07f('0xd'));var deskjs=require(_0xc07f('0xe'));var toCsv=require(_0xc07f('0x8'));var querystring=require('querystring');var Papa=require(_0xc07f('0xf'));var Redis=require(_0xc07f('0x10'));var authService=require(_0xc07f('0x11'));var qs=require(_0xc07f('0x12'));var as=require(_0xc07f('0x13'));var hardwareService=require(_0xc07f('0x14'));var logger=require(_0xc07f('0x15'))(_0xc07f('0x16'));var utils=require(_0xc07f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc07f('0x18'))['db'];function respondWithStatusCode(_0x385b98,_0x136580){_0x136580=_0x136580||0xcc;return function(_0x3a2125){if(_0x3a2125){return _0x385b98[_0xc07f('0x19')](_0x136580);}return _0x385b98[_0xc07f('0x1a')](_0x136580)[_0xc07f('0x1b')]();};}function respondWithResult(_0x43cb09,_0x5de545){_0x5de545=_0x5de545||0xc8;return function(_0x138e6d){if(_0x138e6d){return _0x43cb09['status'](_0x5de545)[_0xc07f('0x1c')](_0x138e6d);}};}function respondWithFilteredResult(_0x273498,_0x1cb888){return function(_0x15c88d){if(_0x15c88d){var _0x491c1d=_0x15c88d['count'],_0x1d7fa5=_0x1cb888[_0xc07f('0x1d')],_0x4f1c07=_0x1cb888[_0xc07f('0x1d')]+_0x1cb888[_0xc07f('0x1e')],_0x1e4f4c;if(_0x4f1c07>=_0x491c1d){_0x4f1c07=_0x491c1d;_0x1e4f4c=0xc8;}else{_0x1e4f4c=0xce;}_0x273498[_0xc07f('0x1a')](_0x1e4f4c);return _0x273498[_0xc07f('0x1f')](_0xc07f('0x20'),_0x1d7fa5+'-'+_0x4f1c07+'/'+_0x491c1d)['json'](_0x15c88d);}return null;};}function patchUpdates(_0x2b66ae){return function(_0x53ecc4){try{jsonpatch[_0xc07f('0x21')](_0x53ecc4,_0x2b66ae,!![]);}catch(_0x557ca4){return BPromise[_0xc07f('0x22')](_0x557ca4);}return _0x53ecc4['save']();};}function saveUpdates(_0x40f427,_0x4de6fa){return function(_0x36c767){if(_0x36c767){return _0x36c767['update'](_0x40f427)['then'](function(_0x451cd8){return _0x451cd8;});}return null;};}function removeEntity(_0x1d9e01,_0x3089b4){return function(_0x1056a5){if(_0x1056a5){return _0x1056a5['destroy']()[_0xc07f('0x23')](function(){var _0x4371e2=_0x1056a5[_0xc07f('0x24')]({'plain':!![]});var _0x1e9d56=_0xc07f('0x25');return db[_0xc07f('0x26')][_0xc07f('0x27')]({'where':{'type':_0x1e9d56,'resourceId':_0x4371e2['id']}})[_0xc07f('0x23')](function(){return _0x1056a5;});})[_0xc07f('0x23')](function(){_0x1d9e01[_0xc07f('0x1a')](0xcc)[_0xc07f('0x1b')]();});}};}function handleEntityNotFound(_0x6ed07a,_0x526095){return function(_0x204d65){if(!_0x204d65){_0x6ed07a[_0xc07f('0x19')](0x194);}return _0x204d65;};}function handleError(_0x5cf1c4,_0x52719c){_0x52719c=_0x52719c||0x1f4;return function(_0x537e23){logger[_0xc07f('0x28')](_0x537e23[_0xc07f('0x29')]);if(_0x537e23[_0xc07f('0x2a')]){delete _0x537e23[_0xc07f('0x2a')];}_0x5cf1c4[_0xc07f('0x1a')](_0x52719c)[_0xc07f('0x2b')](_0x537e23);};}exports[_0xc07f('0x2c')]=function(_0x54456d,_0x2bc5ba){var _0xbae600={},_0x556307={},_0x86f223={'count':0x0,'rows':[]};var _0x104d9f=_['map'](db[_0xc07f('0x2d')][_0xc07f('0x2e')],function(_0x3cf85d){return{'name':_0x3cf85d[_0xc07f('0x2f')],'type':_0x3cf85d[_0xc07f('0x30')][_0xc07f('0x31')]};});_0x556307[_0xc07f('0x32')]=_['map'](_0x104d9f,'name');_0x556307[_0xc07f('0x33')]=_[_0xc07f('0x34')](_0x54456d[_0xc07f('0x33')]);_0x556307[_0xc07f('0x35')]=_['intersection'](_0x556307[_0xc07f('0x32')],_0x556307[_0xc07f('0x33')]);_0xbae600[_0xc07f('0x36')]=_[_0xc07f('0x37')](_0x556307[_0xc07f('0x32')],qs['fields'](_0x54456d[_0xc07f('0x33')][_0xc07f('0x38')]));_0xbae600[_0xc07f('0x36')]=_0xbae600[_0xc07f('0x36')]['length']?_0xbae600[_0xc07f('0x36')]:_0x556307[_0xc07f('0x32')];if(!_0x54456d[_0xc07f('0x33')]['hasOwnProperty'](_0xc07f('0x39'))){_0xbae600[_0xc07f('0x1e')]=qs['limit'](_0x54456d[_0xc07f('0x33')][_0xc07f('0x1e')]);_0xbae600[_0xc07f('0x1d')]=qs[_0xc07f('0x1d')](_0x54456d[_0xc07f('0x33')]['offset']);}_0xbae600[_0xc07f('0x3a')]=qs[_0xc07f('0x3b')](_0x54456d['query'][_0xc07f('0x3b')]);_0xbae600[_0xc07f('0x3c')]=qs[_0xc07f('0x35')](_[_0xc07f('0x3d')](_0x54456d['query'],_0x556307[_0xc07f('0x35')]),_0x104d9f);if(_0x54456d[_0xc07f('0x33')][_0xc07f('0x3e')]){_0xbae600[_0xc07f('0x3c')]=_[_0xc07f('0x3f')](_0xbae600[_0xc07f('0x3c')],{'$or':_[_0xc07f('0x40')](_0x104d9f,function(_0x374a58){if(_0x374a58[_0xc07f('0x30')]!==_0xc07f('0x41')){var _0x3c3904={};_0x3c3904[_0x374a58[_0xc07f('0x2a')]]={'$like':'%'+_0x54456d['query'][_0xc07f('0x3e')]+'%'};return _0x3c3904;}})});}_0xbae600=_[_0xc07f('0x3f')]({},_0xbae600,_0x54456d['options']);var _0x382709={'where':_0xbae600['where']};return db[_0xc07f('0x2d')][_0xc07f('0x42')](_0x382709)[_0xc07f('0x23')](function(_0x2c805b){_0x86f223[_0xc07f('0x42')]=_0x2c805b;if(_0x54456d[_0xc07f('0x33')][_0xc07f('0x43')]){_0xbae600['include']=[{'all':!![]}];}return db[_0xc07f('0x2d')]['findAll'](_0xbae600);})[_0xc07f('0x23')](function(_0x52bcc3){_0x86f223[_0xc07f('0x44')]=_0x52bcc3;return _0x86f223;})[_0xc07f('0x23')](respondWithFilteredResult(_0x2bc5ba,_0xbae600))[_0xc07f('0x45')](handleError(_0x2bc5ba,null));};exports['show']=function(_0x3b74d2,_0x20e596){var _0x248c03={'raw':!![],'where':{'id':_0x3b74d2['params']['id']}},_0x47bee4={};_0x47bee4['model']=_[_0xc07f('0x34')](db['Pause'][_0xc07f('0x2e')]);_0x47bee4[_0xc07f('0x33')]=_[_0xc07f('0x34')](_0x3b74d2[_0xc07f('0x33')]);_0x47bee4[_0xc07f('0x35')]=_[_0xc07f('0x37')](_0x47bee4[_0xc07f('0x32')],_0x47bee4[_0xc07f('0x33')]);_0x248c03[_0xc07f('0x36')]=_[_0xc07f('0x37')](_0x47bee4['model'],qs['fields'](_0x3b74d2[_0xc07f('0x33')]['fields']));_0x248c03[_0xc07f('0x36')]=_0x248c03['attributes'][_0xc07f('0x46')]?_0x248c03[_0xc07f('0x36')]:_0x47bee4[_0xc07f('0x32')];if(_0x3b74d2['query'][_0xc07f('0x43')]){_0x248c03['include']=[{'all':!![]}];}_0x248c03=_[_0xc07f('0x3f')]({},_0x248c03,_0x3b74d2['options']);return db['Pause'][_0xc07f('0x47')](_0x248c03)[_0xc07f('0x23')](handleEntityNotFound(_0x20e596,null))['then'](respondWithResult(_0x20e596,null))[_0xc07f('0x45')](handleError(_0x20e596,null));};exports[_0xc07f('0x48')]=function(_0x41ef8a,_0x38f125){return db[_0xc07f('0x2d')][_0xc07f('0x48')](_0x41ef8a['body'],{})[_0xc07f('0x23')](function(_0x592e21){var _0x4d7ef0=_0x41ef8a[_0xc07f('0x49')]['get']({'plain':!![]});if(!_0x4d7ef0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d7ef0[_0xc07f('0x4a')]===_0xc07f('0x49')){var _0x2fc25c=_0x592e21['get']({'plain':!![]});var _0x1864f4='Pauses';return db['UserProfileSection'][_0xc07f('0x47')]({'where':{'name':_0x1864f4,'userProfileId':_0x4d7ef0[_0xc07f('0x4b')]},'raw':!![]})[_0xc07f('0x23')](function(_0x445947){if(_0x445947&&_0x445947[_0xc07f('0x4c')]===0x0){return db[_0xc07f('0x26')][_0xc07f('0x48')]({'name':_0x2fc25c[_0xc07f('0x2a')],'resourceId':_0x2fc25c['id'],'type':_0x445947['name'],'sectionId':_0x445947['id']},{})[_0xc07f('0x23')](function(){return _0x592e21;});}else{return _0x592e21;}})[_0xc07f('0x45')](function(_0x2d54ca){logger[_0xc07f('0x28')](_0xc07f('0x4d'),_0x2d54ca);throw _0x2d54ca;});}return _0x592e21;})['then'](respondWithResult(_0x38f125,0xc9))[_0xc07f('0x45')](handleError(_0x38f125,null));};exports[_0xc07f('0x4e')]=function(_0x2a2888,_0x3be70a){if(_0x2a2888[_0xc07f('0x4f')]['id']){delete _0x2a2888[_0xc07f('0x4f')]['id'];}return db['Pause']['find']({'where':{'id':_0x2a2888[_0xc07f('0x50')]['id']}})['then'](handleEntityNotFound(_0x3be70a,null))[_0xc07f('0x23')](saveUpdates(_0x2a2888['body'],null))['then'](respondWithResult(_0x3be70a,null))['catch'](handleError(_0x3be70a,null));};exports[_0xc07f('0x27')]=function(_0x4d1c50,_0x4ebfba){return db[_0xc07f('0x2d')][_0xc07f('0x47')]({'where':{'id':_0x4d1c50[_0xc07f('0x50')]['id']}})['then'](handleEntityNotFound(_0x4ebfba,null))[_0xc07f('0x23')](removeEntity(_0x4ebfba,null))[_0xc07f('0x45')](handleError(_0x4ebfba,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 5d3edbe..9b69de9 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 _0xe0dd=['request-promise','path','rimraf','exports','define','Pause','tools_pauses','lodash','util','api','moment','bluebird'];(function(_0x235c9e,_0x15114c){var _0x146660=function(_0x5d1918){while(--_0x5d1918){_0x235c9e['push'](_0x235c9e['shift']());}};_0x146660(++_0x15114c);}(_0xe0dd,0x163));var _0xde0d=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0xe0dd[_0x51fe5f];return _0x4abce9;};'use strict';var _=require(_0xde0d('0x0'));var util=require(_0xde0d('0x1'));var logger=require('../../config/logger')(_0xde0d('0x2'));var moment=require(_0xde0d('0x3'));var BPromise=require(_0xde0d('0x4'));var rp=require(_0xde0d('0x5'));var fs=require('fs');var path=require(_0xde0d('0x6'));var rimraf=require(_0xde0d('0x7'));var config=require('../../config/environment');var attributes=require('./pause.attributes');module[_0xde0d('0x8')]=function(_0x1c7bda,_0x5c58e5){return _0x1c7bda[_0xde0d('0x9')](_0xde0d('0xa'),attributes,{'tableName':_0xde0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb016=['../../config/environment','exports','tools_pauses','lodash','util','moment','request-promise','path','rimraf'];(function(_0x219f41,_0xa48d73){var _0x41c351=function(_0x101fde){while(--_0x101fde){_0x219f41['push'](_0x219f41['shift']());}};_0x41c351(++_0xa48d73);}(_0xb016,0x159));var _0x6b01=function(_0x2a831d,_0x32b31e){_0x2a831d=_0x2a831d-0x0;var _0x1e7aeb=_0xb016[_0x2a831d];return _0x1e7aeb;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b01('0x2'));var BPromise=require('bluebird');var rp=require(_0x6b01('0x3'));var fs=require('fs');var path=require(_0x6b01('0x4'));var rimraf=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var attributes=require('./pause.attributes');module[_0x6b01('0x7')]=function(_0x65407a,_0x192b2d){return _0x65407a['define']('Pause',attributes,{'tableName':_0x6b01('0x8'),'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 bb33a36..ce0d6a2 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 _0xc30e=['../../config/environment','jayson/promise','client','debug','request\x20sent','stringify','error','code','Pause,\x20%s,\x20%s','message','info','result','ShowPause','Pause','find','options','where','include','map','attributes','model','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x52a7e1,_0x189bf3){var _0x4f4495=function(_0x5d1915){while(--_0x5d1915){_0x52a7e1['push'](_0x52a7e1['shift']());}};_0x4f4495(++_0x189bf3);}(_0xc30e,0x1d8));var _0xec30=function(_0x3bb6e6,_0x2a552f){_0x3bb6e6=_0x3bb6e6-0x0;var _0x5a0258=_0xc30e[_0x3bb6e6];return _0x5a0258;};'use strict';var _=require(_0xec30('0x0'));var util=require('util');var moment=require(_0xec30('0x1'));var BPromise=require(_0xec30('0x2'));var rs=require(_0xec30('0x3'));var fs=require('fs');var Redis=require(_0xec30('0x4'));var db=require(_0xec30('0x5'))['db'];var utils=require(_0xec30('0x6'));var logger=require(_0xec30('0x7'))('rpc');var config=require(_0xec30('0x8'));var jayson=require(_0xec30('0x9'));var client=jayson[_0xec30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b222b,_0x1fe35a,_0x365609){return new BPromise(function(_0x49528d,_0x1d2812){return client['request'](_0x3b222b,_0x365609)['then'](function(_0x442028){logger['info']('Pause,\x20%s,\x20%s',_0x1fe35a,'request\x20sent');logger[_0xec30('0xb')]('Pause,\x20%s,\x20%s,\x20%s',_0x1fe35a,_0xec30('0xc'),JSON[_0xec30('0xd')](_0x442028));if(_0x442028[_0xec30('0xe')]){if(_0x442028['error'][_0xec30('0xf')]===0x1f4){logger['error'](_0xec30('0x10'),_0x1fe35a,_0x442028[_0xec30('0xe')][_0xec30('0x11')]);return _0x1d2812(_0x442028[_0xec30('0xe')][_0xec30('0x11')]);}logger[_0xec30('0xe')]('Pause,\x20%s,\x20%s',_0x1fe35a,_0x442028['error'][_0xec30('0x11')]);return _0x49528d(_0x442028[_0xec30('0xe')][_0xec30('0x11')]);}else{logger[_0xec30('0x12')](_0xec30('0x10'),_0x1fe35a,_0xec30('0xc'));_0x49528d(_0x442028[_0xec30('0x13')][_0xec30('0x11')]);}})['catch'](function(_0x1ad7e0){logger[_0xec30('0xe')]('Pause,\x20%s,\x20%s',_0x1fe35a,_0x1ad7e0);_0x1d2812(_0x1ad7e0);});});}exports[_0xec30('0x14')]=function(_0x522025){var _0xc925c1=this;return new Promise(function(_0x3482a0,_0x1597dd){return db[_0xec30('0x15')][_0xec30('0x16')]({'raw':_0x522025['options']?_0x522025[_0xec30('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x522025[_0xec30('0x17')]?_0x522025[_0xec30('0x17')][_0xec30('0x18')]||null:null,'attributes':_0x522025[_0xec30('0x17')]?_0x522025[_0xec30('0x17')]['attributes']||null:null,'include':_0x522025[_0xec30('0x17')]?_0x522025[_0xec30('0x17')][_0xec30('0x19')]?_[_0xec30('0x1a')](_0x522025['options'][_0xec30('0x19')],function(_0x308bbd){return{'model':db[_0x308bbd['model']],'as':_0x308bbd['as'],'attributes':_0x308bbd['attributes'],'include':_0x308bbd[_0xec30('0x19')]?_[_0xec30('0x1a')](_0x308bbd['include'],function(_0x42d795){return{'model':db[_0x42d795['model']],'as':_0x42d795['as'],'attributes':_0x42d795[_0xec30('0x1b')],'include':_0x42d795[_0xec30('0x19')]?_[_0xec30('0x1a')](_0x42d795[_0xec30('0x19')],function(_0x4c042f){return{'model':db[_0x4c042f[_0xec30('0x1c')]],'as':_0x4c042f['as'],'attributes':_0x4c042f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x388f07){logger['info'](_0xec30('0x14'),_0x522025);logger[_0xec30('0xb')](_0xec30('0x14'),_0x522025,JSON['stringify'](_0x388f07));_0x3482a0(_0x388f07);})[_0xec30('0x1d')](function(_0x501f4f){logger[_0xec30('0xe')](_0xec30('0x14'),_0x501f4f[_0xec30('0x11')],_0x522025);_0x1597dd(_0xc925c1['error'](0x1f4,_0x501f4f['message']));});});}; \ No newline at end of file +var _0xefbf=['../../config/logger','rpc','../../config/environment','client','request','info','Pause,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowPause','Pause','find','options','raw','include','map','model','attributes','debug','lodash','util','ioredis','../../mysqldb','../../config/utils'];(function(_0x38f48f,_0x3de3d0){var _0x454e88=function(_0x430df5){while(--_0x430df5){_0x38f48f['push'](_0x38f48f['shift']());}};_0x454e88(++_0x3de3d0);}(_0xefbf,0xa3));var _0xfefb=function(_0x4b6d4d,_0x211c58){_0x4b6d4d=_0x4b6d4d-0x0;var _0x2a109c=_0xefbf[_0x4b6d4d];return _0x2a109c;};'use strict';var _=require(_0xfefb('0x0'));var util=require(_0xfefb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfefb('0x2'));var db=require(_0xfefb('0x3'))['db'];var utils=require(_0xfefb('0x4'));var logger=require(_0xfefb('0x5'))(_0xfefb('0x6'));var config=require(_0xfefb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfefb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7851d4,_0x424135,_0x5706f5){return new BPromise(function(_0x18ffe2,_0x1afa97){return client[_0xfefb('0x9')](_0x7851d4,_0x5706f5)['then'](function(_0x89b029){logger[_0xfefb('0xa')](_0xfefb('0xb'),_0x424135,'request\x20sent');logger['debug']('Pause,\x20%s,\x20%s,\x20%s',_0x424135,_0xfefb('0xc'),JSON[_0xfefb('0xd')](_0x89b029));if(_0x89b029[_0xfefb('0xe')]){if(_0x89b029[_0xfefb('0xe')][_0xfefb('0xf')]===0x1f4){logger[_0xfefb('0xe')](_0xfefb('0xb'),_0x424135,_0x89b029[_0xfefb('0xe')]['message']);return _0x1afa97(_0x89b029[_0xfefb('0xe')][_0xfefb('0x10')]);}logger[_0xfefb('0xe')](_0xfefb('0xb'),_0x424135,_0x89b029[_0xfefb('0xe')][_0xfefb('0x10')]);return _0x18ffe2(_0x89b029[_0xfefb('0xe')][_0xfefb('0x10')]);}else{logger['info']('Pause,\x20%s,\x20%s',_0x424135,_0xfefb('0xc'));_0x18ffe2(_0x89b029['result'][_0xfefb('0x10')]);}})[_0xfefb('0x11')](function(_0x482684){logger[_0xfefb('0xe')](_0xfefb('0xb'),_0x424135,_0x482684);_0x1afa97(_0x482684);});});}exports[_0xfefb('0x12')]=function(_0x5487aa){var _0x2ce77f=this;return new Promise(function(_0x326934,_0x5acf37){return db[_0xfefb('0x13')][_0xfefb('0x14')]({'raw':_0x5487aa[_0xfefb('0x15')]?_0x5487aa[_0xfefb('0x15')][_0xfefb('0x16')]===undefined?!![]:![]:!![],'where':_0x5487aa[_0xfefb('0x15')]?_0x5487aa[_0xfefb('0x15')]['where']||null:null,'attributes':_0x5487aa[_0xfefb('0x15')]?_0x5487aa[_0xfefb('0x15')]['attributes']||null:null,'include':_0x5487aa[_0xfefb('0x15')]?_0x5487aa[_0xfefb('0x15')][_0xfefb('0x17')]?_[_0xfefb('0x18')](_0x5487aa['options'][_0xfefb('0x17')],function(_0x366c76){return{'model':db[_0x366c76['model']],'as':_0x366c76['as'],'attributes':_0x366c76['attributes'],'include':_0x366c76[_0xfefb('0x17')]?_[_0xfefb('0x18')](_0x366c76['include'],function(_0x2178b6){return{'model':db[_0x2178b6[_0xfefb('0x19')]],'as':_0x2178b6['as'],'attributes':_0x2178b6[_0xfefb('0x1a')],'include':_0x2178b6[_0xfefb('0x17')]?_['map'](_0x2178b6[_0xfefb('0x17')],function(_0xa32e3b){return{'model':db[_0xa32e3b[_0xfefb('0x19')]],'as':_0xa32e3b['as'],'attributes':_0xa32e3b[_0xfefb('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x558ec3){logger[_0xfefb('0xa')](_0xfefb('0x12'),_0x5487aa);logger[_0xfefb('0x1b')]('ShowPause',_0x5487aa,JSON[_0xfefb('0xd')](_0x558ec3));_0x326934(_0x558ec3);})['catch'](function(_0x267492){logger['error'](_0xfefb('0x12'),_0x267492['message'],_0x5487aa);_0x5acf37(_0x2ce77f[_0xfefb('0xe')](0x1f4,_0x267492[_0xfefb('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 063b565..772c404 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 _0x5b98=['multer','path','connect-timeout','express','Router','../../config/environment','./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','now','extname','post','upload','webhookPost','put','update','delete','exports'];(function(_0x3556d6,_0x40f6f6){var _0x3cc1c5=function(_0x44e0c3){while(--_0x44e0c3){_0x3556d6['push'](_0x3556d6['shift']());}};_0x3cc1c5(++_0x40f6f6);}(_0x5b98,0x160));var _0x85b9=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0x5b98[_0x12ca5f];return _0xfc3ae9;};'use strict';var multer=require(_0x85b9('0x0'));var util=require('util');var path=require(_0x85b9('0x1'));var timeout=require(_0x85b9('0x2'));var express=require(_0x85b9('0x3'));var router=express[_0x85b9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x85b9('0x5'));var controller=require(_0x85b9('0x6'));router[_0x85b9('0x7')]('/',auth[_0x85b9('0x8')](),controller['index']);router[_0x85b9('0x7')](_0x85b9('0x9'),controller[_0x85b9('0xa')]);router['get'](_0x85b9('0xb'),auth['isAuthenticated'](),controller[_0x85b9('0xc')]);router[_0x85b9('0x7')](_0x85b9('0xd'),auth[_0x85b9('0x8')](),controller[_0x85b9('0xe')]);var upload=multer({'storage':multer[_0x85b9('0xf')]({'destination':function(_0x3f3bff,_0x17dd4b,_0xca1aa0){_0xca1aa0(null,path[_0x85b9('0x10')](config[_0x85b9('0x11')],_0x85b9('0x12')));},'filename':function(_0xddf30b,_0x2cba1a,_0x36a8bf){_0x2cba1a[_0x85b9('0x13')]=_0x2cba1a[_0x85b9('0x13')][_0x85b9('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x36a8bf(null,util[_0x85b9('0x15')]('%s-%s%s',path[_0x85b9('0x16')](_0x2cba1a[_0x85b9('0x13')],path['extname'](_0x2cba1a['originalname'])),Date[_0x85b9('0x17')](),path[_0x85b9('0x18')](_0x2cba1a['originalname'])));}})});router[_0x85b9('0x19')]('/',upload['single']('file'),controller[_0x85b9('0x1a')]);router[_0x85b9('0x19')]('/webhook',controller[_0x85b9('0x1b')]);router[_0x85b9('0x1c')](_0x85b9('0xb'),auth[_0x85b9('0x8')](),controller[_0x85b9('0x1d')]);router[_0x85b9('0x1e')](_0x85b9('0xb'),auth[_0x85b9('0x8')](),controller['delete']);module[_0x85b9('0x1f')]=router; \ No newline at end of file +var _0x08ed=['download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','post','single','upload','webhookPost','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download'];(function(_0x3cff3a,_0x2dcc6b){var _0x31d709=function(_0x4471f1){while(--_0x4471f1){_0x3cff3a['push'](_0x3cff3a['shift']());}};_0x31d709(++_0x2dcc6b);}(_0x08ed,0x145));var _0xd08e=function(_0x4fa97c,_0x4aa6ab){_0x4fa97c=_0x4fa97c-0x0;var _0x518c7f=_0x08ed[_0x4fa97c];return _0x518c7f;};'use strict';var multer=require(_0xd08e('0x0'));var util=require(_0xd08e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd08e('0x2'));var router=express[_0xd08e('0x3')]();var fs_extra=require(_0xd08e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd08e('0x5'));var config=require(_0xd08e('0x6'));var controller=require('./plugin.controller');router[_0xd08e('0x7')]('/',auth[_0xd08e('0x8')](),controller[_0xd08e('0x9')]);router[_0xd08e('0x7')](_0xd08e('0xa'),controller[_0xd08e('0xb')]);router[_0xd08e('0x7')](_0xd08e('0xc'),auth['isAuthenticated'](),controller[_0xd08e('0xd')]);router[_0xd08e('0x7')](_0xd08e('0xe'),auth[_0xd08e('0x8')](),controller[_0xd08e('0xf')]);var upload=multer({'storage':multer[_0xd08e('0x10')]({'destination':function(_0x32ce57,_0x3c6114,_0x3f2101){_0x3f2101(null,path[_0xd08e('0x11')](config[_0xd08e('0x12')],_0xd08e('0x13')));},'filename':function(_0x39d1c8,_0x189729,_0x8c1f78){_0x189729['originalname']=_0x189729[_0xd08e('0x14')][_0xd08e('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x8c1f78(null,util[_0xd08e('0x16')](_0xd08e('0x17'),path[_0xd08e('0x18')](_0x189729[_0xd08e('0x14')],path[_0xd08e('0x19')](_0x189729['originalname'])),Date['now'](),path[_0xd08e('0x19')](_0x189729[_0xd08e('0x14')])));}})});router[_0xd08e('0x1a')]('/',upload[_0xd08e('0x1b')]('file'),controller[_0xd08e('0x1c')]);router[_0xd08e('0x1a')](_0xd08e('0xa'),controller[_0xd08e('0x1d')]);router[_0xd08e('0x1e')](_0xd08e('0xc'),auth[_0xd08e('0x8')](),controller[_0xd08e('0x1f')]);router[_0xd08e('0x20')](_0xd08e('0xc'),auth[_0xd08e('0x8')](),controller['delete']);module[_0xd08e('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 9feda2a..10e380b 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 _0x78ed=['sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78ed,0x104));var _0xd78e=function(_0x48141c,_0x3bca09){_0x48141c=_0x48141c-0x0;var _0x2e3ffb=_0x78ed[_0x48141c];return _0x2e3ffb;};'use strict';var Sequelize=require(_0xd78e('0x0'));module[_0xd78e('0x1')]={'name':{'type':Sequelize[_0xd78e('0x2')]},'type':{'type':Sequelize[_0xd78e('0x3')](_0xd78e('0x4'),'script')},'description':{'type':Sequelize[_0xd78e('0x5')]},'version':{'type':Sequelize[_0xd78e('0x5')]},'path':{'type':Sequelize[_0xd78e('0x2')],'comment':_0xd78e('0x6')},'active':{'type':Sequelize[_0xd78e('0x7')],'defaultValue':0x0,'comment':_0xd78e('0x8')},'sidebar':{'type':Sequelize[_0xd78e('0x3')](_0xd78e('0x9'),_0xd78e('0xa'),_0xd78e('0xb'),_0xd78e('0xc')),'defaultValue':_0xd78e('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xd78e('0x2')]},'scriptName':{'type':Sequelize[_0xd78e('0x2')]},'scriptPath':{'type':Sequelize[_0xd78e('0x2')]}}; \ No newline at end of file +var _0x65e4=['ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING'];(function(_0xae5e3c,_0x1a07bf){var _0x5c87b8=function(_0x3e8143){while(--_0x3e8143){_0xae5e3c['push'](_0xae5e3c['shift']());}};_0x5c87b8(++_0x1a07bf);}(_0x65e4,0x80));var _0x465e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x65e4[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x465e('0x0'));module['exports']={'name':{'type':Sequelize[_0x465e('0x1')]},'type':{'type':Sequelize[_0x465e('0x2')](_0x465e('0x3'),_0x465e('0x4'))},'description':{'type':Sequelize[_0x465e('0x5')]},'version':{'type':Sequelize[_0x465e('0x5')]},'path':{'type':Sequelize[_0x465e('0x1')],'comment':_0x465e('0x6')},'active':{'type':Sequelize[_0x465e('0x7')],'defaultValue':0x0,'comment':_0x465e('0x8')},'sidebar':{'type':Sequelize[_0x465e('0x2')](_0x465e('0x9'),_0x465e('0xa'),'always','never'),'defaultValue':_0x465e('0xb'),'comment':_0x465e('0xc')},'icon':{'type':Sequelize[_0x465e('0x1')]},'adminUrl':{'type':Sequelize[_0x465e('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x465e('0x1')]},'scriptPath':{'type':Sequelize[_0x465e('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 4639545..eb71a24 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 _0x92d4=['\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Plugins','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','Plugin','includeAll','rows','catch','show','include','find','download','params','path','join','root','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','server/files/plugins','finalize','existsSync','Plugin\x20not\x20found','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','webhookGet','resolve','port'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x92d4,0x16a));var _0x492d=function(_0x4c25c4,_0xef0ef4){_0x4c25c4=_0x4c25c4-0x0;var _0x5ec546=_0x92d4[_0x4c25c4];return _0x5ec546;};'use strict';var pdf=require(_0x492d('0x0'));var emlformat=require(_0x492d('0x1'));var rimraf=require(_0x492d('0x2'));var zipdir=require(_0x492d('0x3'));var jsonpatch=require(_0x492d('0x4'));var rp=require(_0x492d('0x5'));var moment=require('moment');var BPromise=require(_0x492d('0x6'));var Mustache=require(_0x492d('0x7'));var util=require(_0x492d('0x8'));var path=require('path');var sox=require(_0x492d('0x9'));var csv=require(_0x492d('0xa'));var ejs=require(_0x492d('0xb'));var fs=require('fs');var fs_extra=require(_0x492d('0xc'));var _=require(_0x492d('0xd'));var squel=require('squel');var crypto=require(_0x492d('0xe'));var jsforce=require(_0x492d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x492d('0xa'));var querystring=require(_0x492d('0x10'));var Papa=require('papaparse');var extract=require(_0x492d('0x11'));var rimraf=require('rimraf');var archiver=require(_0x492d('0x12'));var Redis=require(_0x492d('0x13'));var authService=require(_0x492d('0x14'));var qs=require(_0x492d('0x15'));var as=require(_0x492d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x492d('0x17'))(_0x492d('0x18'));var utils=require(_0x492d('0x19'));var config=require(_0x492d('0x1a'));var licenseUtil=require(_0x492d('0x1b'));var db=require(_0x492d('0x1c'))['db'];config[_0x492d('0x1d')]=_[_0x492d('0x1e')](config[_0x492d('0x1d')],{'host':_0x492d('0x1f'),'port':0x18eb});var socket=require(_0x492d('0x20'))(new Redis(config[_0x492d('0x1d')]));require('./plugin.socket')[_0x492d('0x21')](socket);function respondWithStatusCode(_0x17a597,_0x3bb88f){_0x3bb88f=_0x3bb88f||0xcc;return function(_0x37f353){if(_0x37f353){return _0x17a597[_0x492d('0x22')](_0x3bb88f);}return _0x17a597[_0x492d('0x23')](_0x3bb88f)['end']();};}function respondWithResult(_0x14b2cf,_0x48ff39){_0x48ff39=_0x48ff39||0xc8;return function(_0x3e45a2){if(_0x3e45a2){return _0x14b2cf[_0x492d('0x23')](_0x48ff39)['json'](_0x3e45a2);}};}function respondWithFilteredResult(_0x324d02,_0x2c22fe){return function(_0x12fd6a){if(_0x12fd6a){var _0x1196e8=_0x12fd6a[_0x492d('0x24')],_0x364259=_0x2c22fe[_0x492d('0x25')],_0x508634=_0x2c22fe[_0x492d('0x25')]+_0x2c22fe['limit'],_0x446760;if(_0x508634>=_0x1196e8){_0x508634=_0x1196e8;_0x446760=0xc8;}else{_0x446760=0xce;}_0x324d02[_0x492d('0x23')](_0x446760);return _0x324d02['set'](_0x492d('0x26'),_0x364259+'-'+_0x508634+'/'+_0x1196e8)[_0x492d('0x27')](_0x12fd6a);}return null;};}function patchUpdates(_0x2e5840){return function(_0xbc481a){try{jsonpatch['apply'](_0xbc481a,_0x2e5840,!![]);}catch(_0x4d0a94){return BPromise[_0x492d('0x28')](_0x4d0a94);}return _0xbc481a[_0x492d('0x29')]();};}function saveUpdates(_0x4182b8,_0x144eff){return function(_0x2275ba){if(_0x2275ba){return _0x2275ba[_0x492d('0x2a')](_0x4182b8)[_0x492d('0x2b')](function(_0xdfa7eb){return _0xdfa7eb;});}return null;};}function removeEntity(_0x5b3f77,_0x22dca6){return function(_0x54ac88){if(_0x54ac88){return _0x54ac88[_0x492d('0x2c')]()[_0x492d('0x2b')](function(){var _0x511aed=_0x54ac88[_0x492d('0x2d')]({'plain':!![]});var _0x5ba704=_0x492d('0x2e');return db[_0x492d('0x2f')][_0x492d('0x2c')]({'where':{'type':_0x5ba704,'resourceId':_0x511aed['id']}})[_0x492d('0x2b')](function(){return _0x54ac88;});})[_0x492d('0x2b')](function(){_0x5b3f77[_0x492d('0x23')](0xcc)[_0x492d('0x30')]();});}};}function handleEntityNotFound(_0x86e2fb,_0x392560){return function(_0x81ffc5){if(!_0x81ffc5){_0x86e2fb[_0x492d('0x22')](0x194);}return _0x81ffc5;};}function handleError(_0x3a0694,_0x1250ae){_0x1250ae=_0x1250ae||0x1f4;return function(_0x23745d){logger[_0x492d('0x31')](_0x23745d[_0x492d('0x32')]);if(_0x23745d[_0x492d('0x33')]){delete _0x23745d['name'];}_0x3a0694[_0x492d('0x23')](_0x1250ae)[_0x492d('0x34')](_0x23745d);};}exports[_0x492d('0x35')]=function(_0x49f281,_0x91fcc1){var _0x5e8c6b={},_0xb25c0d={},_0x1649d0={'count':0x0,'rows':[]};var _0x187314=_['map'](db['Plugin'][_0x492d('0x36')],function(_0x380d2b){return{'name':_0x380d2b[_0x492d('0x37')],'type':_0x380d2b[_0x492d('0x38')][_0x492d('0x39')]};});_0xb25c0d[_0x492d('0x3a')]=_[_0x492d('0x3b')](_0x187314,_0x492d('0x33'));_0xb25c0d[_0x492d('0x3c')]=_['keys'](_0x49f281[_0x492d('0x3c')]);_0xb25c0d[_0x492d('0x3d')]=_[_0x492d('0x3e')](_0xb25c0d[_0x492d('0x3a')],_0xb25c0d['query']);_0x5e8c6b[_0x492d('0x3f')]=_['intersection'](_0xb25c0d['model'],qs[_0x492d('0x40')](_0x49f281[_0x492d('0x3c')][_0x492d('0x40')]));_0x5e8c6b[_0x492d('0x3f')]=_0x5e8c6b[_0x492d('0x3f')][_0x492d('0x41')]?_0x5e8c6b[_0x492d('0x3f')]:_0xb25c0d['model'];if(!_0x49f281['query'][_0x492d('0x42')](_0x492d('0x43'))){_0x5e8c6b['limit']=qs[_0x492d('0x44')](_0x49f281[_0x492d('0x3c')]['limit']);_0x5e8c6b[_0x492d('0x25')]=qs[_0x492d('0x25')](_0x49f281[_0x492d('0x3c')][_0x492d('0x25')]);}_0x5e8c6b[_0x492d('0x45')]=qs[_0x492d('0x46')](_0x49f281[_0x492d('0x3c')][_0x492d('0x46')]);_0x5e8c6b[_0x492d('0x47')]=qs[_0x492d('0x3d')](_['pick'](_0x49f281['query'],_0xb25c0d['filters']),_0x187314);if(_0x49f281['query'][_0x492d('0x48')]){_0x5e8c6b[_0x492d('0x47')]=_[_0x492d('0x49')](_0x5e8c6b['where'],{'$or':_[_0x492d('0x3b')](_0x187314,function(_0x46a517){if(_0x46a517[_0x492d('0x38')]!==_0x492d('0x4a')){var _0xa163a2={};_0xa163a2[_0x46a517[_0x492d('0x33')]]={'$like':'%'+_0x49f281[_0x492d('0x3c')]['filter']+'%'};return _0xa163a2;}})});}_0x5e8c6b=_['merge']({},_0x5e8c6b,_0x49f281[_0x492d('0x4b')]);var _0x3ff95b={'where':_0x5e8c6b[_0x492d('0x47')]};return db[_0x492d('0x4c')]['count'](_0x3ff95b)[_0x492d('0x2b')](function(_0x2babcf){_0x1649d0['count']=_0x2babcf;if(_0x49f281[_0x492d('0x3c')][_0x492d('0x4d')]){_0x5e8c6b['include']=[{'all':!![]}];}return db[_0x492d('0x4c')]['findAll'](_0x5e8c6b);})[_0x492d('0x2b')](function(_0x35408b){_0x1649d0[_0x492d('0x4e')]=_0x35408b;return _0x1649d0;})[_0x492d('0x2b')](respondWithFilteredResult(_0x91fcc1,_0x5e8c6b))[_0x492d('0x4f')](handleError(_0x91fcc1,null));};exports[_0x492d('0x50')]=function(_0x2bd5d7,_0x173e73){var _0x5c8d12={'raw':!![],'where':{'id':_0x2bd5d7['params']['id']}},_0x53de87={};_0x53de87['model']=_['keys'](db[_0x492d('0x4c')]['rawAttributes']);_0x53de87['query']=_['keys'](_0x2bd5d7[_0x492d('0x3c')]);_0x53de87['filters']=_[_0x492d('0x3e')](_0x53de87[_0x492d('0x3a')],_0x53de87[_0x492d('0x3c')]);_0x5c8d12[_0x492d('0x3f')]=_[_0x492d('0x3e')](_0x53de87[_0x492d('0x3a')],qs[_0x492d('0x40')](_0x2bd5d7[_0x492d('0x3c')][_0x492d('0x40')]));_0x5c8d12[_0x492d('0x3f')]=_0x5c8d12['attributes'][_0x492d('0x41')]?_0x5c8d12[_0x492d('0x3f')]:_0x53de87[_0x492d('0x3a')];if(_0x2bd5d7['query'][_0x492d('0x4d')]){_0x5c8d12[_0x492d('0x51')]=[{'all':!![]}];}_0x5c8d12=_[_0x492d('0x49')]({},_0x5c8d12,_0x2bd5d7['options']);return db[_0x492d('0x4c')][_0x492d('0x52')](_0x5c8d12)[_0x492d('0x2b')](handleEntityNotFound(_0x173e73,null))[_0x492d('0x2b')](respondWithResult(_0x173e73,null))[_0x492d('0x4f')](handleError(_0x173e73,null));};exports[_0x492d('0x53')]=function(_0x50327c,_0x3cc093,_0x2b9c81){return db[_0x492d('0x4c')][_0x492d('0x52')]({'where':{'id':_0x50327c[_0x492d('0x54')]['id']},'attributes':[_0x492d('0x33'),_0x492d('0x55')],'raw':!![]})[_0x492d('0x2b')](handleEntityNotFound(_0x3cc093,null))[_0x492d('0x2b')](function(_0x1895dd){if(_0x1895dd){var _0x4c3607=path[_0x492d('0x56')](config[_0x492d('0x57')],'server/files/plugins',util[_0x492d('0x58')](_0x492d('0x59'),path[_0x492d('0x5a')](_0x1895dd[_0x492d('0x55')])));var _0x47a8bf=fs[_0x492d('0x5b')](_0x4c3607);var _0x1e0b00=archiver(_0x492d('0x5c'),{'zlib':{'level':0x9}});_0x1e0b00['on'](_0x492d('0x5d'),function(_0x20e58d){if(_0x20e58d[_0x492d('0x5e')]===_0x492d('0x5f')){logger[_0x492d('0x31')](_0x20e58d);}else{throw new db[(_0x492d('0x60'))]['Error'](_0x492d('0x61'));}});_0x1e0b00['on']('error',function(_0x4ff41d){throw new db[(_0x492d('0x60'))][(_0x492d('0x62'))](_0x492d('0x61'));});_0x1e0b00[_0x492d('0x63')](_0x47a8bf);_0x1e0b00[_0x492d('0x64')](_0x492d('0x65'),{'cwd':path[_0x492d('0x56')](config[_0x492d('0x57')],_0x492d('0x66'),path['dirname'](_0x1895dd[_0x492d('0x55')])),'ignore':[path['join'](path[_0x492d('0x5a')](_0x1895dd[_0x492d('0x55')]),'node_modules/**/*'),path['join'](path[_0x492d('0x5a')](_0x1895dd['path']),'attachments/**/*')],'nodir':!![]})[_0x492d('0x67')]();_0x47a8bf['on']('close',function(){if(!fs[_0x492d('0x68')](_0x4c3607)){throw new db['Sequelize']['Error'](_0x492d('0x69'));}return _0x3cc093[_0x492d('0x53')](_0x4c3607,util[_0x492d('0x58')](_0x492d('0x59'),path[_0x492d('0x5a')](_0x1895dd['path'])),function(_0x52c5c6){if(_0x52c5c6){throw new db[(_0x492d('0x60'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x4c3607);logger[_0x492d('0x6a')](_0x492d('0x6b'));logger[_0x492d('0x6a')](_0x492d('0x6c'));});});}return null;})[_0x492d('0x4f')](handleError(_0x3cc093,null));};exports[_0x492d('0x6d')]=function(_0x1f0fec,_0x86dd29,_0x27ce11){var _0x1a8c2a=path[_0x492d('0x5a')](_0x1f0fec[_0x492d('0x6e')][_0x492d('0x6f')],path['extname'](_0x1f0fec[_0x492d('0x6e')][_0x492d('0x6f')]));var _0x3cf646=path['join'](config[_0x492d('0x57')],_0x492d('0x66'),_0x1f0fec[_0x492d('0x6e')][_0x492d('0x6f')]);var _0x1f32d7=path[_0x492d('0x56')](config[_0x492d('0x57')],_0x492d('0x66'),_0x1a8c2a);logger[_0x492d('0x6a')]('Plugin\x20upload\x20filepath:\x20%s',_0x3cf646);logger[_0x492d('0x6a')](_0x492d('0x70'),_0x1f32d7);try{fs['chmodSync'](_0x3cf646,parseInt('0777',0x8));extract(_0x3cf646,{'dir':_0x1f32d7},function(_0x564d25){if(_0x564d25){logger['error'](_0x564d25);handleError(_0x564d25,!![]);};var _0x48ceda=fs[_0x492d('0x71')](_0x1f32d7);if(_0x48ceda['length']>0x1){removeReferences(_0x3cf646,_0x1f32d7);logger['error']('Invalid\x20plugin\x20structure');return _0x27ce11(new Error(_0x492d('0x72')));}var _0x2c2561=fs[_0x492d('0x73')](path['join'](_0x1f32d7,_0x48ceda[0x0]));if(_0x2c2561[_0x492d('0x74')]()){removeReferences(_0x3cf646,_0x1f32d7);logger[_0x492d('0x31')]('Invalid\x20plugin\x20structure');return _0x27ce11(new Error(_0x492d('0x72')));}if(_0x2c2561[_0x492d('0x75')]()){var _0x435d3d=fs[_0x492d('0x71')](path['join'](_0x1f32d7,_0x48ceda[0x0]));if(_0x435d3d[_0x492d('0x41')]===0x0){removeReferences(_0x3cf646,_0x1f32d7);logger[_0x492d('0x31')](_0x492d('0x72'));return _0x27ce11(new Error(_0x492d('0x72')));}var _0x5dd380=_0x435d3d[_0x492d('0x76')](function(_0x28a10d){return _0x28a10d===_0x492d('0x77');});if(!_0x5dd380){return _0x27ce11(new Error(_0x492d('0x78')));}var _0x26b3e7=fs['readFileSync'](path['join'](_0x1f32d7,_0x48ceda[0x0],'manifest.json'));var _0x29fa0e=JSON[_0x492d('0x79')](_0x26b3e7);if(_0x492d('0x7a')==typeof _0x29fa0e['name']){return _0x27ce11(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x492d('0x7a')==typeof _0x29fa0e[_0x492d('0x38')]){return _0x27ce11(new Error(_0x492d('0x7b')));}if(_0x492d('0x7a')==typeof _0x29fa0e[_0x492d('0x7c')]){return _0x27ce11(new Error(_0x492d('0x7d')));}if(_0x492d('0x7a')==typeof _0x29fa0e[_0x492d('0x7e')]){return _0x27ce11(new Error(_0x492d('0x7f')));}if(_0x29fa0e[_0x492d('0x38')]===_0x492d('0x80')){if(_0x492d('0x7a')==typeof _0x29fa0e['parameters'][_0x492d('0x81')]){return _0x27ce11(new Error(_0x492d('0x82')));}if('undefined'==typeof _0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')][_0x492d('0x83')]&&_0x492d('0x7a')==typeof _0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')][_0x492d('0x84')]){return _0x27ce11(new Error(_0x492d('0x85')));}}else if(_0x29fa0e[_0x492d('0x38')]==='script'){if(_0x492d('0x7a')==typeof _0x29fa0e[_0x492d('0x7e')][_0x492d('0x86')]){return _0x27ce11(new Error(_0x492d('0x87')));}if('undefined'==typeof _0x29fa0e['parameters'][_0x492d('0x88')]){return _0x27ce11(new Error(_0x492d('0x89')));}}else{return _0x27ce11(new Error(_0x492d('0x8a')));}var _0x24a914=_0x29fa0e[_0x492d('0x33')];var _0x517a4c=_0x29fa0e[_0x492d('0x8b')];var _0x8af6da=_0x29fa0e[_0x492d('0x38')];var _0x4f3f7b=_0x29fa0e[_0x492d('0x8c')]?_0x29fa0e[_0x492d('0x8c')]:_0x492d('0x8d');var _0xc135f1=_0x29fa0e[_0x492d('0x8e')]?_0x29fa0e[_0x492d('0x8e')]:_0x492d('0x8f');var _0x267c2b='';var _0x500796='';var _0x46d555='';var _0x548869='';var _0x3e3dcc=_0x29fa0e['version'];if(_0x8af6da===_0x492d('0x80')){if(_0x492d('0x7a')!=typeof _0x29fa0e[_0x492d('0x7e')]['views'][_0x492d('0x83')]){var _0x1872e5=_0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')][_0x492d('0x83')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1872e5)){_0x267c2b=path[_0x492d('0x56')](_0x492d('0x90'),_0x1a8c2a,_0x48ceda[0x0],_0x1872e5);}else{_0x267c2b=_0x1872e5;}}else{logger[_0x492d('0x6a')](_0x492d('0x91'));}if(_0x492d('0x7a')!=typeof _0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')]['agent']){var _0x4e3d02=_0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x492d('0x92')](_0x4e3d02)){_0x500796=path[_0x492d('0x56')]('plugins',_0x1a8c2a,_0x48ceda[0x0],_0x4e3d02);}else{_0x500796=_0x4e3d02;}}else{logger[_0x492d('0x6a')](_0x492d('0x93'));}}else if(_0x8af6da==='script'){_0x46d555=_0x29fa0e['parameters'][_0x492d('0x86')];_0x548869=_0x29fa0e[_0x492d('0x7e')][_0x492d('0x88')];if(_0x492d('0x7a')!=typeof _0x29fa0e['parameters'][_0x492d('0x81')]){if(_0x492d('0x7a')!=typeof _0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')][_0x492d('0x83')]){var _0x1872e5=_0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')][_0x492d('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x492d('0x92')](_0x1872e5)){_0x267c2b=path['join'](_0x492d('0x90'),_0x1a8c2a,_0x48ceda[0x0],_0x1872e5);}else{_0x267c2b=_0x1872e5;}}if(_0x492d('0x7a')!=typeof _0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')][_0x492d('0x84')]){var _0x4e3d02=_0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x492d('0x92')](_0x4e3d02)){_0x500796=path[_0x492d('0x56')](_0x492d('0x90'),_0x1a8c2a,_0x48ceda[0x0],_0x4e3d02);}else{_0x500796=_0x4e3d02;}}}}var _0x2ba1c2={'name':_0x24a914,'description':_0x517a4c,'path':path[_0x492d('0x56')](_0x1a8c2a,_0x48ceda[0x0]),'type':_0x8af6da,'sidebar':_0x4f3f7b,'icon':_0xc135f1,'adminUrl':_0x267c2b,'agentUrl':_0x500796,'scriptName':_0x46d555,'scriptPath':_0x548869,'version':_0x3e3dcc};removeReferences(_0x3cf646,null);return db[_0x492d('0x4c')][_0x492d('0x94')](_0x2ba1c2)['then'](function(_0x18f588){var _0x35c6c3={'role':_0x1f0fec[_0x492d('0x95')][_0x492d('0x96')],'userProfileId':_0x1f0fec[_0x492d('0x95')]['userProfileId']};if(!_0x35c6c3)throw new Error(_0x492d('0x97'));if(_0x35c6c3[_0x492d('0x96')]==='user'){var _0x3e82c6=_0x18f588[_0x492d('0x2d')]({'plain':!![]});return db[_0x492d('0x98')]['find']({'where':{'name':_0x492d('0x2e'),'userProfileId':_0x35c6c3[_0x492d('0x99')]},'raw':!![]})[_0x492d('0x2b')](function(_0x10d084){if(_0x10d084&&_0x10d084[_0x492d('0x9a')]===0x0){return db[_0x492d('0x2f')][_0x492d('0x94')]({'name':_0x3e82c6[_0x492d('0x33')],'resourceId':_0x3e82c6['id'],'type':_0x10d084[_0x492d('0x33')],'sectionId':_0x10d084['id']},{})[_0x492d('0x2b')](function(){return _0x18f588;});}else{return _0x18f588;}})[_0x492d('0x4f')](function(_0x5f03bb){logger[_0x492d('0x31')](_0x492d('0x9b'),_0x5f03bb);throw _0x5f03bb;});}return _0x18f588;})[_0x492d('0x2b')](respondWithResult(_0x86dd29,null))['catch'](handleError(_0x86dd29,null));}});}catch(_0x14b8a6){_0x86dd29['status'](0x1f4)[_0x492d('0x34')](_0x14b8a6);}};function removeReferences(_0x1537c1,_0x33c1b2){try{if(_0x1537c1){fs['unlinkSync'](_0x1537c1);logger[_0x492d('0x6a')](_0x492d('0x9c'));}if(_0x33c1b2){rimraf(_0x33c1b2,function(){});logger[_0x492d('0x6a')](_0x492d('0x9d'));}}catch(_0x53822a){logger[_0x492d('0x31')](_0x53822a);}}exports['update']=function(_0x2912de,_0x1eeccb,_0x59e0eb){return db[_0x492d('0x4c')][_0x492d('0x52')]({'where':{'id':_0x2912de[_0x492d('0x54')]['id']}})[_0x492d('0x2b')](handleEntityNotFound(_0x1eeccb,null))[_0x492d('0x2b')](saveUpdates(_0x2912de[_0x492d('0x95')],null))[_0x492d('0x2b')](respondWithResult(_0x1eeccb,null))['catch'](handleError(_0x1eeccb,null));};exports[_0x492d('0x9e')]=function(_0x416193,_0x1f0013,_0x5d0f4e){return db[_0x492d('0x4c')]['find']({'where':{'id':_0x416193[_0x492d('0x54')]['id']}})[_0x492d('0x2b')](function(_0x2c5e3d){if(_0x2c5e3d){return _0x2c5e3d[_0x492d('0x2c')]();}})[_0x492d('0x2b')](function(_0x1fd9ca){rimraf(path['join'](config[_0x492d('0x57')],_0x492d('0x66'),path[_0x492d('0x9f')](_0x1fd9ca['path'])),function(){});return _0x1fd9ca;})[_0x492d('0x2b')](handleEntityNotFound(_0x1f0013,null))[_0x492d('0x2b')](respondWithStatusCode(_0x1f0013,null))['catch'](handleError(_0x1f0013,null));};exports[_0x492d('0xa0')]=function(_0x1622c8,_0x50d0f4,_0x200393){return BPromise[_0x492d('0xa1')]()[_0x492d('0x2b')](function(){if(!_0x1622c8[_0x492d('0x3c')][_0x492d('0x55')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1622c8[_0x492d('0x3c')][_0x492d('0xa2')]){throw new Error(_0x492d('0xa3'));}var _0xbc9267=_0x1622c8[_0x492d('0x3c')][_0x492d('0xa4')]?_0x1622c8[_0x492d('0x3c')]['hostname']+':'+_0x1622c8['query'][_0x492d('0xa2')]:_0x492d('0xa5')+_0x1622c8[_0x492d('0x3c')]['port'];var _0x5a79db=_0x1622c8['query'][_0x492d('0x27')]?_0x1622c8['query'][_0x492d('0x27')]:!![];var _0x4f4444=_0x1622c8[_0x492d('0x3c')]['encoding']?_0x1622c8[_0x492d('0x3c')][_0x492d('0xa6')]:null;var _0x1b4e25={'method':_0x1622c8[_0x492d('0xa7')],'uri':util[_0x492d('0x58')](_0x492d('0xa8'),_0xbc9267,_0x1622c8['query']['path']),'json':_0x5a79db,'resolveWithFullResponse':!![],'encoding':_0x4f4444,'qs':_0x1622c8[_0x492d('0x3c')]};if(_0x1622c8['headers']){_0x1b4e25[_0x492d('0xa9')]=_0x1622c8[_0x492d('0xa9')];if(_0x1b4e25['headers'][_0x492d('0xaa')]){delete _0x1b4e25[_0x492d('0xa9')][_0x492d('0xaa')];}}if(_0x1b4e25[_0x492d('0xa9')][_0x492d('0xab')]){delete _0x1b4e25[_0x492d('0xa9')][_0x492d('0xab')];}return rp(_0x1b4e25);})[_0x492d('0x2b')](function(_0x4db087){if(_0x4db087){_0x50d0f4[_0x492d('0xac')](_0x4db087['headers']);logger[_0x492d('0x6a')](_0x4db087[_0x492d('0x95')]);if(_['endsWith'](_0x1622c8['query']['path'],_0x492d('0x53'))&&_0x4db087[_0x492d('0xad')]==0x1f4){return _0x50d0f4['sendStatus'](_0x4db087['statusCode']);}else{return _0x50d0f4[_0x492d('0x23')](_0x4db087[_0x492d('0xad')])[_0x492d('0x34')](_0x4db087[_0x492d('0x95')]);}}else{return _0x50d0f4['sendStatus'](0xc8);}})['catch'](handleError(_0x50d0f4,null));};exports['webhookPost']=function(_0x4fe20b,_0x4d97f9,_0x2c469e){return BPromise[_0x492d('0xa1')]()[_0x492d('0x2b')](function(){if(!_0x4fe20b[_0x492d('0x3c')][_0x492d('0x55')]){throw new Error(_0x492d('0xae'));}if(!_0x4fe20b[_0x492d('0x3c')][_0x492d('0xa2')]){throw new Error(_0x492d('0xa3'));}var _0x3bc330=_0x4fe20b[_0x492d('0x3c')][_0x492d('0xa4')]?_0x4fe20b['query'][_0x492d('0xa4')]+':'+_0x4fe20b['query'][_0x492d('0xa2')]:_0x492d('0xa5')+_0x4fe20b[_0x492d('0x3c')][_0x492d('0xa2')];var _0x3aa273=_0x4fe20b[_0x492d('0x3c')]['json']?_0x4fe20b['query'][_0x492d('0x27')]:!![];var _0x4ae2ef=_0x4fe20b[_0x492d('0x3c')][_0x492d('0xa6')]?_0x4fe20b['query']['encoding']:null;var _0x249a82={'method':_0x4fe20b['method'],'uri':util['format']('%s%s',_0x3bc330,_0x4fe20b[_0x492d('0x3c')]['path']),'json':_0x3aa273,'resolveWithFullResponse':!![],'encoding':_0x4ae2ef,'body':_0x4fe20b[_0x492d('0x95')]};if(_0x4fe20b[_0x492d('0xa9')]){_0x249a82[_0x492d('0xa9')]=_0x4fe20b['headers'];if(_0x249a82[_0x492d('0xa9')][_0x492d('0xaa')]){delete _0x249a82['headers'][_0x492d('0xaa')];}}if(_0x249a82['headers'][_0x492d('0xab')]){delete _0x249a82[_0x492d('0xa9')][_0x492d('0xab')];}return rp(_0x249a82);})[_0x492d('0x2b')](function(_0xba9bec){if(_0xba9bec){_0x4d97f9[_0x492d('0xac')](_0xba9bec['headers']);logger[_0x492d('0x6a')](_0xba9bec[_0x492d('0x95')]);return _0x4d97f9[_0x492d('0x23')](_0xba9bec[_0x492d('0xad')])['send'](_0xba9bec[_0x492d('0x95')]);}else{return _0x4d97f9[_0x492d('0x22')](0xc8);}})['catch'](handleError(_0x4d97f9,null));}; \ No newline at end of file +var _0x1f71=['length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','Plugin','find','join','root','server/files/plugins','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','basename','attachments/**/*','finalize','close','Plugin\x20not\x20found','download','format','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','Invalid\x20manifest:\x20views\x20missing','admin','views','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','json','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','send','webhookPost','method','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','extract-zip','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','count','set','Content-Range','reject','then','destroy','get','Plugins','UserProfileResource','error','stack','name','map','rawAttributes','type','query','keys','filters','model','attributes','intersection','fields'];(function(_0xd2d54,_0x5329f7){var _0x78b113=function(_0x7d2b29){while(--_0x7d2b29){_0xd2d54['push'](_0xd2d54['shift']());}};_0x78b113(++_0x5329f7);}(_0x1f71,0x1d6));var _0x11f7=function(_0xdace57,_0x4cdcae){_0xdace57=_0xdace57-0x0;var _0x5adace=_0x1f71[_0xdace57];return _0x5adace;};'use strict';var pdf=require(_0x11f7('0x0'));var emlformat=require(_0x11f7('0x1'));var rimraf=require(_0x11f7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11f7('0x3'));var rp=require('request-promise');var moment=require(_0x11f7('0x4'));var BPromise=require(_0x11f7('0x5'));var Mustache=require(_0x11f7('0x6'));var util=require(_0x11f7('0x7'));var path=require(_0x11f7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x11f7('0x9'));var fs=require('fs');var fs_extra=require(_0x11f7('0xa'));var _=require(_0x11f7('0xb'));var squel=require(_0x11f7('0xc'));var crypto=require('crypto');var jsforce=require(_0x11f7('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x11f7('0xe'));var extract=require(_0x11f7('0xf'));var rimraf=require(_0x11f7('0x2'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x11f7('0x10'));var as=require(_0x11f7('0x11'));var hardwareService=require(_0x11f7('0x12'));var logger=require(_0x11f7('0x13'))(_0x11f7('0x14'));var utils=require(_0x11f7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x11f7('0x16'));var db=require(_0x11f7('0x17'))['db'];config[_0x11f7('0x18')]=_[_0x11f7('0x19')](config[_0x11f7('0x18')],{'host':_0x11f7('0x1a'),'port':0x18eb});var socket=require(_0x11f7('0x1b'))(new Redis(config[_0x11f7('0x18')]));require(_0x11f7('0x1c'))[_0x11f7('0x1d')](socket);function respondWithStatusCode(_0x41b1e3,_0x1c9bb8){_0x1c9bb8=_0x1c9bb8||0xcc;return function(_0x2b62a5){if(_0x2b62a5){return _0x41b1e3[_0x11f7('0x1e')](_0x1c9bb8);}return _0x41b1e3[_0x11f7('0x1f')](_0x1c9bb8)[_0x11f7('0x20')]();};}function respondWithResult(_0x57e8f6,_0x32d866){_0x32d866=_0x32d866||0xc8;return function(_0xc98519){if(_0xc98519){return _0x57e8f6['status'](_0x32d866)['json'](_0xc98519);}};}function respondWithFilteredResult(_0x3a4157,_0x4ad435){return function(_0x56f414){if(_0x56f414){var _0x3bc775=_0x56f414[_0x11f7('0x21')],_0x11dc9e=_0x4ad435['offset'],_0x4dec37=_0x4ad435['offset']+_0x4ad435['limit'],_0x3175ea;if(_0x4dec37>=_0x3bc775){_0x4dec37=_0x3bc775;_0x3175ea=0xc8;}else{_0x3175ea=0xce;}_0x3a4157['status'](_0x3175ea);return _0x3a4157[_0x11f7('0x22')](_0x11f7('0x23'),_0x11dc9e+'-'+_0x4dec37+'/'+_0x3bc775)['json'](_0x56f414);}return null;};}function patchUpdates(_0x555cff){return function(_0x45b7df){try{jsonpatch['apply'](_0x45b7df,_0x555cff,!![]);}catch(_0x225a71){return BPromise[_0x11f7('0x24')](_0x225a71);}return _0x45b7df['save']();};}function saveUpdates(_0x38343a,_0x18b468){return function(_0xf0add4){if(_0xf0add4){return _0xf0add4['update'](_0x38343a)[_0x11f7('0x25')](function(_0x2e5150){return _0x2e5150;});}return null;};}function removeEntity(_0x3ffc84,_0xd36bbf){return function(_0x4f2240){if(_0x4f2240){return _0x4f2240[_0x11f7('0x26')]()['then'](function(){var _0x39159e=_0x4f2240[_0x11f7('0x27')]({'plain':!![]});var _0xd2c008=_0x11f7('0x28');return db[_0x11f7('0x29')]['destroy']({'where':{'type':_0xd2c008,'resourceId':_0x39159e['id']}})[_0x11f7('0x25')](function(){return _0x4f2240;});})[_0x11f7('0x25')](function(){_0x3ffc84[_0x11f7('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d3dd0,_0x1e541f){return function(_0x2f4883){if(!_0x2f4883){_0x3d3dd0['sendStatus'](0x194);}return _0x2f4883;};}function handleError(_0x29ee2a,_0x537926){_0x537926=_0x537926||0x1f4;return function(_0x40b11d){logger[_0x11f7('0x2a')](_0x40b11d[_0x11f7('0x2b')]);if(_0x40b11d['name']){delete _0x40b11d[_0x11f7('0x2c')];}_0x29ee2a[_0x11f7('0x1f')](_0x537926)['send'](_0x40b11d);};}exports['index']=function(_0xc853ea,_0x208043){var _0x40d677={},_0x4615ea={},_0x6f4d6={'count':0x0,'rows':[]};var _0x9e293e=_[_0x11f7('0x2d')](db['Plugin'][_0x11f7('0x2e')],function(_0x12d71d){return{'name':_0x12d71d['fieldName'],'type':_0x12d71d[_0x11f7('0x2f')]['key']};});_0x4615ea['model']=_[_0x11f7('0x2d')](_0x9e293e,'name');_0x4615ea[_0x11f7('0x30')]=_[_0x11f7('0x31')](_0xc853ea[_0x11f7('0x30')]);_0x4615ea[_0x11f7('0x32')]=_['intersection'](_0x4615ea[_0x11f7('0x33')],_0x4615ea[_0x11f7('0x30')]);_0x40d677[_0x11f7('0x34')]=_[_0x11f7('0x35')](_0x4615ea[_0x11f7('0x33')],qs[_0x11f7('0x36')](_0xc853ea[_0x11f7('0x30')][_0x11f7('0x36')]));_0x40d677['attributes']=_0x40d677[_0x11f7('0x34')][_0x11f7('0x37')]?_0x40d677[_0x11f7('0x34')]:_0x4615ea[_0x11f7('0x33')];if(!_0xc853ea[_0x11f7('0x30')][_0x11f7('0x38')](_0x11f7('0x39'))){_0x40d677[_0x11f7('0x3a')]=qs['limit'](_0xc853ea[_0x11f7('0x30')][_0x11f7('0x3a')]);_0x40d677['offset']=qs['offset'](_0xc853ea['query'][_0x11f7('0x3b')]);}_0x40d677[_0x11f7('0x3c')]=qs[_0x11f7('0x3d')](_0xc853ea[_0x11f7('0x30')][_0x11f7('0x3d')]);_0x40d677[_0x11f7('0x3e')]=qs[_0x11f7('0x32')](_[_0x11f7('0x3f')](_0xc853ea[_0x11f7('0x30')],_0x4615ea[_0x11f7('0x32')]),_0x9e293e);if(_0xc853ea[_0x11f7('0x30')][_0x11f7('0x40')]){_0x40d677[_0x11f7('0x3e')]=_[_0x11f7('0x41')](_0x40d677[_0x11f7('0x3e')],{'$or':_['map'](_0x9e293e,function(_0x4b6de9){if(_0x4b6de9[_0x11f7('0x2f')]!==_0x11f7('0x42')){var _0x41fb44={};_0x41fb44[_0x4b6de9['name']]={'$like':'%'+_0xc853ea[_0x11f7('0x30')][_0x11f7('0x40')]+'%'};return _0x41fb44;}})});}_0x40d677=_['merge']({},_0x40d677,_0xc853ea[_0x11f7('0x43')]);var _0x20f274={'where':_0x40d677[_0x11f7('0x3e')]};return db['Plugin'][_0x11f7('0x21')](_0x20f274)[_0x11f7('0x25')](function(_0x5cac4c){_0x6f4d6[_0x11f7('0x21')]=_0x5cac4c;if(_0xc853ea[_0x11f7('0x30')][_0x11f7('0x44')]){_0x40d677['include']=[{'all':!![]}];}return db['Plugin'][_0x11f7('0x45')](_0x40d677);})[_0x11f7('0x25')](function(_0x2fd206){_0x6f4d6['rows']=_0x2fd206;return _0x6f4d6;})[_0x11f7('0x25')](respondWithFilteredResult(_0x208043,_0x40d677))[_0x11f7('0x46')](handleError(_0x208043,null));};exports[_0x11f7('0x47')]=function(_0x5da647,_0x36092a){var _0x5eeb5f={'raw':!![],'where':{'id':_0x5da647[_0x11f7('0x48')]['id']}},_0x37d1f2={};_0x37d1f2[_0x11f7('0x33')]=_[_0x11f7('0x31')](db['Plugin'][_0x11f7('0x2e')]);_0x37d1f2['query']=_[_0x11f7('0x31')](_0x5da647[_0x11f7('0x30')]);_0x37d1f2[_0x11f7('0x32')]=_[_0x11f7('0x35')](_0x37d1f2[_0x11f7('0x33')],_0x37d1f2[_0x11f7('0x30')]);_0x5eeb5f[_0x11f7('0x34')]=_[_0x11f7('0x35')](_0x37d1f2[_0x11f7('0x33')],qs[_0x11f7('0x36')](_0x5da647[_0x11f7('0x30')][_0x11f7('0x36')]));_0x5eeb5f[_0x11f7('0x34')]=_0x5eeb5f[_0x11f7('0x34')]['length']?_0x5eeb5f[_0x11f7('0x34')]:_0x37d1f2[_0x11f7('0x33')];if(_0x5da647[_0x11f7('0x30')][_0x11f7('0x44')]){_0x5eeb5f['include']=[{'all':!![]}];}_0x5eeb5f=_[_0x11f7('0x41')]({},_0x5eeb5f,_0x5da647['options']);return db[_0x11f7('0x49')][_0x11f7('0x4a')](_0x5eeb5f)['then'](handleEntityNotFound(_0x36092a,null))[_0x11f7('0x25')](respondWithResult(_0x36092a,null))[_0x11f7('0x46')](handleError(_0x36092a,null));};exports['download']=function(_0x148ac3,_0x3ca3f6,_0x28d3f3){return db['Plugin'][_0x11f7('0x4a')]({'where':{'id':_0x148ac3[_0x11f7('0x48')]['id']},'attributes':['name',_0x11f7('0x8')],'raw':!![]})[_0x11f7('0x25')](handleEntityNotFound(_0x3ca3f6,null))[_0x11f7('0x25')](function(_0x42facf){if(_0x42facf){var _0x4f9c46=path[_0x11f7('0x4b')](config[_0x11f7('0x4c')],_0x11f7('0x4d'),util['format']('%s.zip',path['basename'](_0x42facf['path'])));var _0x1aeb7f=fs['createWriteStream'](_0x4f9c46);var _0xf7d2e=archiver(_0x11f7('0x4e'),{'zlib':{'level':0x9}});_0xf7d2e['on'](_0x11f7('0x4f'),function(_0x1c0b5c){if(_0x1c0b5c[_0x11f7('0x50')]===_0x11f7('0x51')){logger[_0x11f7('0x2a')](_0x1c0b5c);}else{throw new db[(_0x11f7('0x52'))][(_0x11f7('0x53'))](_0x11f7('0x54'));}});_0xf7d2e['on'](_0x11f7('0x2a'),function(_0x51b8bd){throw new db[(_0x11f7('0x52'))][(_0x11f7('0x53'))](_0x11f7('0x54'));});_0xf7d2e[_0x11f7('0x55')](_0x1aeb7f);_0xf7d2e[_0x11f7('0x56')](_0x11f7('0x57'),{'cwd':path[_0x11f7('0x4b')](config['root'],_0x11f7('0x4d'),path[_0x11f7('0x58')](_0x42facf[_0x11f7('0x8')])),'ignore':[path['join'](path[_0x11f7('0x59')](_0x42facf['path']),'node_modules/**/*'),path['join'](path[_0x11f7('0x59')](_0x42facf[_0x11f7('0x8')]),_0x11f7('0x5a'))],'nodir':!![]})[_0x11f7('0x5b')]();_0x1aeb7f['on'](_0x11f7('0x5c'),function(){if(!fs['existsSync'](_0x4f9c46)){throw new db[(_0x11f7('0x52'))]['Error'](_0x11f7('0x5d'));}return _0x3ca3f6[_0x11f7('0x5e')](_0x4f9c46,util[_0x11f7('0x5f')]('%s.zip',path[_0x11f7('0x59')](_0x42facf[_0x11f7('0x8')])),function(_0x2efb7a){if(_0x2efb7a){throw new db[(_0x11f7('0x52'))][(_0x11f7('0x53'))](_0x11f7('0x60'));}fs['unlinkSync'](_0x4f9c46);logger[_0x11f7('0x61')](_0x11f7('0x62'));logger[_0x11f7('0x61')](_0x11f7('0x63'));});});}return null;})[_0x11f7('0x46')](handleError(_0x3ca3f6,null));};exports[_0x11f7('0x64')]=function(_0x7b0bd7,_0x1af9db,_0x21732c){var _0x37bd38=path[_0x11f7('0x59')](_0x7b0bd7[_0x11f7('0x65')][_0x11f7('0x66')],path[_0x11f7('0x67')](_0x7b0bd7[_0x11f7('0x65')][_0x11f7('0x66')]));var _0x3f4241=path['join'](config[_0x11f7('0x4c')],'server/files/plugins',_0x7b0bd7[_0x11f7('0x65')][_0x11f7('0x66')]);var _0x3f1355=path[_0x11f7('0x4b')](config[_0x11f7('0x4c')],'server/files/plugins',_0x37bd38);logger[_0x11f7('0x61')](_0x11f7('0x68'),_0x3f4241);logger['info'](_0x11f7('0x69'),_0x3f1355);try{fs[_0x11f7('0x6a')](_0x3f4241,parseInt(_0x11f7('0x6b'),0x8));extract(_0x3f4241,{'dir':_0x3f1355},function(_0x405fd0){if(_0x405fd0){logger['error'](_0x405fd0);handleError(_0x405fd0,!![]);};var _0x160e39=fs[_0x11f7('0x6c')](_0x3f1355);if(_0x160e39[_0x11f7('0x37')]>0x1){removeReferences(_0x3f4241,_0x3f1355);logger['error'](_0x11f7('0x6d'));return _0x21732c(new Error(_0x11f7('0x6d')));}var _0x18af83=fs[_0x11f7('0x6e')](path['join'](_0x3f1355,_0x160e39[0x0]));if(_0x18af83[_0x11f7('0x6f')]()){removeReferences(_0x3f4241,_0x3f1355);logger[_0x11f7('0x2a')](_0x11f7('0x6d'));return _0x21732c(new Error(_0x11f7('0x6d')));}if(_0x18af83[_0x11f7('0x70')]()){var _0x17b721=fs[_0x11f7('0x6c')](path[_0x11f7('0x4b')](_0x3f1355,_0x160e39[0x0]));if(_0x17b721['length']===0x0){removeReferences(_0x3f4241,_0x3f1355);logger['error'](_0x11f7('0x6d'));return _0x21732c(new Error('Invalid\x20plugin\x20structure'));}var _0x2b616d=_0x17b721[_0x11f7('0x71')](function(_0x1d5a8e){return _0x1d5a8e===_0x11f7('0x72');});if(!_0x2b616d){return _0x21732c(new Error(_0x11f7('0x73')));}var _0x39497d=fs[_0x11f7('0x74')](path['join'](_0x3f1355,_0x160e39[0x0],_0x11f7('0x72')));var _0x4cd0db=JSON[_0x11f7('0x75')](_0x39497d);if(_0x11f7('0x76')==typeof _0x4cd0db[_0x11f7('0x2c')]){return _0x21732c(new Error(_0x11f7('0x77')));}if(_0x11f7('0x76')==typeof _0x4cd0db[_0x11f7('0x2f')]){return _0x21732c(new Error(_0x11f7('0x78')));}if(_0x11f7('0x76')==typeof _0x4cd0db[_0x11f7('0x79')]){return _0x21732c(new Error(_0x11f7('0x7a')));}if(_0x11f7('0x76')==typeof _0x4cd0db[_0x11f7('0x7b')]){return _0x21732c(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4cd0db['type']===_0x11f7('0x7c')){if(_0x11f7('0x76')==typeof _0x4cd0db[_0x11f7('0x7b')]['views']){return _0x21732c(new Error(_0x11f7('0x7d')));}if(_0x11f7('0x76')==typeof _0x4cd0db[_0x11f7('0x7b')]['views'][_0x11f7('0x7e')]&&_0x11f7('0x76')==typeof _0x4cd0db[_0x11f7('0x7b')][_0x11f7('0x7f')]['agent']){return _0x21732c(new Error(_0x11f7('0x80')));}}else if(_0x4cd0db['type']===_0x11f7('0x81')){if(_0x11f7('0x76')==typeof _0x4cd0db[_0x11f7('0x7b')]['scriptName']){return _0x21732c(new Error(_0x11f7('0x82')));}if(_0x11f7('0x76')==typeof _0x4cd0db[_0x11f7('0x7b')][_0x11f7('0x83')]){return _0x21732c(new Error(_0x11f7('0x84')));}}else{return _0x21732c(new Error(_0x11f7('0x85')));}var _0x570eb1=_0x4cd0db['name'];var _0x30da93=_0x4cd0db[_0x11f7('0x86')];var _0x5b9e34=_0x4cd0db[_0x11f7('0x2f')];var _0x57eef4=_0x4cd0db['sidebar']?_0x4cd0db[_0x11f7('0x87')]:_0x11f7('0x88');var _0x13c265=_0x4cd0db[_0x11f7('0x89')]?_0x4cd0db['icon']:_0x11f7('0x8a');var _0x1b0257='';var _0x55a119='';var _0x4f72d2='';var _0x5ea166='';var _0x216d67=_0x4cd0db['version'];if(_0x5b9e34===_0x11f7('0x7c')){if(_0x11f7('0x76')!=typeof _0x4cd0db['parameters'][_0x11f7('0x7f')][_0x11f7('0x7e')]){var _0xf64de=_0x4cd0db['parameters'][_0x11f7('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x11f7('0x8b')](_0xf64de)){_0x1b0257=path[_0x11f7('0x4b')]('plugins',_0x37bd38,_0x160e39[0x0],_0xf64de);}else{_0x1b0257=_0xf64de;}}else{logger[_0x11f7('0x61')](_0x11f7('0x8c'));}if(_0x11f7('0x76')!=typeof _0x4cd0db['parameters']['views'][_0x11f7('0x8d')]){var _0x307361=_0x4cd0db[_0x11f7('0x7b')][_0x11f7('0x7f')][_0x11f7('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x11f7('0x8b')](_0x307361)){_0x55a119=path['join'](_0x11f7('0x8e'),_0x37bd38,_0x160e39[0x0],_0x307361);}else{_0x55a119=_0x307361;}}else{logger[_0x11f7('0x61')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x5b9e34===_0x11f7('0x81')){_0x4f72d2=_0x4cd0db[_0x11f7('0x7b')][_0x11f7('0x8f')];_0x5ea166=_0x4cd0db[_0x11f7('0x7b')][_0x11f7('0x83')];if(_0x11f7('0x76')!=typeof _0x4cd0db[_0x11f7('0x7b')]['views']){if(_0x11f7('0x76')!=typeof _0x4cd0db[_0x11f7('0x7b')]['views'][_0x11f7('0x7e')]){var _0xf64de=_0x4cd0db[_0x11f7('0x7b')][_0x11f7('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0xf64de)){_0x1b0257=path[_0x11f7('0x4b')](_0x11f7('0x8e'),_0x37bd38,_0x160e39[0x0],_0xf64de);}else{_0x1b0257=_0xf64de;}}if(_0x11f7('0x76')!=typeof _0x4cd0db[_0x11f7('0x7b')]['views'][_0x11f7('0x8d')]){var _0x307361=_0x4cd0db[_0x11f7('0x7b')][_0x11f7('0x7f')][_0x11f7('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x11f7('0x8b')](_0x307361)){_0x55a119=path['join'](_0x11f7('0x8e'),_0x37bd38,_0x160e39[0x0],_0x307361);}else{_0x55a119=_0x307361;}}}}var _0x3b61cd={'name':_0x570eb1,'description':_0x30da93,'path':path[_0x11f7('0x4b')](_0x37bd38,_0x160e39[0x0]),'type':_0x5b9e34,'sidebar':_0x57eef4,'icon':_0x13c265,'adminUrl':_0x1b0257,'agentUrl':_0x55a119,'scriptName':_0x4f72d2,'scriptPath':_0x5ea166,'version':_0x216d67};removeReferences(_0x3f4241,null);return db['Plugin'][_0x11f7('0x90')](_0x3b61cd)['then'](function(_0x50a13e){var _0x11206a={'role':_0x7b0bd7[_0x11f7('0x91')][_0x11f7('0x92')],'userProfileId':_0x7b0bd7[_0x11f7('0x91')][_0x11f7('0x93')]};if(!_0x11206a)throw new Error(_0x11f7('0x94'));if(_0x11206a[_0x11f7('0x92')]===_0x11f7('0x95')){var _0x18e8fa=_0x50a13e[_0x11f7('0x27')]({'plain':!![]});return db[_0x11f7('0x96')][_0x11f7('0x4a')]({'where':{'name':_0x11f7('0x28'),'userProfileId':_0x11206a[_0x11f7('0x93')]},'raw':!![]})[_0x11f7('0x25')](function(_0x4b125e){if(_0x4b125e&&_0x4b125e[_0x11f7('0x97')]===0x0){return db[_0x11f7('0x29')]['create']({'name':_0x18e8fa[_0x11f7('0x2c')],'resourceId':_0x18e8fa['id'],'type':_0x4b125e['name'],'sectionId':_0x4b125e['id']},{})[_0x11f7('0x25')](function(){return _0x50a13e;});}else{return _0x50a13e;}})[_0x11f7('0x46')](function(_0x3997e5){logger['error'](_0x11f7('0x98'),_0x3997e5);throw _0x3997e5;});}return _0x50a13e;})[_0x11f7('0x25')](respondWithResult(_0x1af9db,null))[_0x11f7('0x46')](handleError(_0x1af9db,null));}});}catch(_0x1afc6e){_0x1af9db['status'](0x1f4)['send'](_0x1afc6e);}};function removeReferences(_0x58965b,_0x4404ab){try{if(_0x58965b){fs[_0x11f7('0x99')](_0x58965b);logger[_0x11f7('0x61')](_0x11f7('0x9a'));}if(_0x4404ab){rimraf(_0x4404ab,function(){});logger[_0x11f7('0x61')](_0x11f7('0x9b'));}}catch(_0x24bc7c){logger[_0x11f7('0x2a')](_0x24bc7c);}}exports['update']=function(_0x29fa71,_0x5979d7,_0x514b82){return db[_0x11f7('0x49')][_0x11f7('0x4a')]({'where':{'id':_0x29fa71[_0x11f7('0x48')]['id']}})['then'](handleEntityNotFound(_0x5979d7,null))[_0x11f7('0x25')](saveUpdates(_0x29fa71['body'],null))['then'](respondWithResult(_0x5979d7,null))[_0x11f7('0x46')](handleError(_0x5979d7,null));};exports[_0x11f7('0x9c')]=function(_0x3ceb1,_0x2800b4,_0x2531c7){return db['Plugin'][_0x11f7('0x4a')]({'where':{'id':_0x3ceb1[_0x11f7('0x48')]['id']}})[_0x11f7('0x25')](function(_0x56256e){if(_0x56256e){return _0x56256e['destroy']();}})['then'](function(_0x14c165){rimraf(path[_0x11f7('0x4b')](config[_0x11f7('0x4c')],_0x11f7('0x4d'),path[_0x11f7('0x58')](_0x14c165[_0x11f7('0x8')])),function(){});return _0x14c165;})[_0x11f7('0x25')](handleEntityNotFound(_0x2800b4,null))[_0x11f7('0x25')](respondWithStatusCode(_0x2800b4,null))[_0x11f7('0x46')](handleError(_0x2800b4,null));};exports[_0x11f7('0x9d')]=function(_0x4c1d0f,_0x3c1872,_0xd9d6f8){return BPromise[_0x11f7('0x9e')]()[_0x11f7('0x25')](function(){if(!_0x4c1d0f['query'][_0x11f7('0x8')]){throw new Error(_0x11f7('0x9f'));}if(!_0x4c1d0f[_0x11f7('0x30')]['port']){throw new Error(_0x11f7('0xa0'));}var _0x30ac5b=_0x4c1d0f[_0x11f7('0x30')][_0x11f7('0xa1')]?_0x4c1d0f[_0x11f7('0x30')][_0x11f7('0xa1')]+':'+_0x4c1d0f[_0x11f7('0x30')][_0x11f7('0xa2')]:_0x11f7('0xa3')+_0x4c1d0f[_0x11f7('0x30')][_0x11f7('0xa2')];var _0x514b0f=_0x4c1d0f[_0x11f7('0x30')][_0x11f7('0xa4')]?_0x4c1d0f['query']['json']:!![];var _0x1df582=_0x4c1d0f[_0x11f7('0x30')][_0x11f7('0xa5')]?_0x4c1d0f['query'][_0x11f7('0xa5')]:null;var _0x495721={'method':_0x4c1d0f['method'],'uri':util['format'](_0x11f7('0xa6'),_0x30ac5b,_0x4c1d0f[_0x11f7('0x30')]['path']),'json':_0x514b0f,'resolveWithFullResponse':!![],'encoding':_0x1df582,'qs':_0x4c1d0f[_0x11f7('0x30')]};if(_0x4c1d0f[_0x11f7('0xa7')]){_0x495721[_0x11f7('0xa7')]=_0x4c1d0f['headers'];if(_0x495721[_0x11f7('0xa7')]['content-length']){delete _0x495721[_0x11f7('0xa7')][_0x11f7('0xa8')];}}if(_0x495721[_0x11f7('0xa7')][_0x11f7('0xa9')]){delete _0x495721[_0x11f7('0xa7')][_0x11f7('0xa9')];}return rp(_0x495721);})[_0x11f7('0x25')](function(_0x4d7b25){if(_0x4d7b25){_0x3c1872[_0x11f7('0x22')](_0x4d7b25[_0x11f7('0xa7')]);logger[_0x11f7('0x61')](_0x4d7b25['body']);if(_[_0x11f7('0xaa')](_0x4c1d0f[_0x11f7('0x30')]['path'],'download')&&_0x4d7b25[_0x11f7('0xab')]==0x1f4){return _0x3c1872['sendStatus'](_0x4d7b25[_0x11f7('0xab')]);}else{return _0x3c1872[_0x11f7('0x1f')](_0x4d7b25[_0x11f7('0xab')])[_0x11f7('0xac')](_0x4d7b25[_0x11f7('0x91')]);}}else{return _0x3c1872[_0x11f7('0x1e')](0xc8);}})[_0x11f7('0x46')](handleError(_0x3c1872,null));};exports[_0x11f7('0xad')]=function(_0x418548,_0x2e6f13,_0x2e7c82){return BPromise[_0x11f7('0x9e')]()[_0x11f7('0x25')](function(){if(!_0x418548['query'][_0x11f7('0x8')]){throw new Error(_0x11f7('0x9f'));}if(!_0x418548[_0x11f7('0x30')][_0x11f7('0xa2')]){throw new Error(_0x11f7('0xa0'));}var _0x290a73=_0x418548[_0x11f7('0x30')][_0x11f7('0xa1')]?_0x418548['query'][_0x11f7('0xa1')]+':'+_0x418548['query']['port']:_0x11f7('0xa3')+_0x418548[_0x11f7('0x30')][_0x11f7('0xa2')];var _0x1d0c76=_0x418548['query'][_0x11f7('0xa4')]?_0x418548[_0x11f7('0x30')][_0x11f7('0xa4')]:!![];var _0x57680c=_0x418548['query']['encoding']?_0x418548[_0x11f7('0x30')][_0x11f7('0xa5')]:null;var _0x1ffbf2={'method':_0x418548[_0x11f7('0xae')],'uri':util[_0x11f7('0x5f')]('%s%s',_0x290a73,_0x418548['query'][_0x11f7('0x8')]),'json':_0x1d0c76,'resolveWithFullResponse':!![],'encoding':_0x57680c,'body':_0x418548[_0x11f7('0x91')]};if(_0x418548[_0x11f7('0xa7')]){_0x1ffbf2[_0x11f7('0xa7')]=_0x418548['headers'];if(_0x1ffbf2[_0x11f7('0xa7')][_0x11f7('0xa8')]){delete _0x1ffbf2[_0x11f7('0xa7')][_0x11f7('0xa8')];}}if(_0x1ffbf2[_0x11f7('0xa7')][_0x11f7('0xa9')]){delete _0x1ffbf2[_0x11f7('0xa7')][_0x11f7('0xa9')];}return rp(_0x1ffbf2);})[_0x11f7('0x25')](function(_0x1df9ea){if(_0x1df9ea){_0x2e6f13[_0x11f7('0x22')](_0x1df9ea[_0x11f7('0xa7')]);logger[_0x11f7('0x61')](_0x1df9ea['body']);return _0x2e6f13[_0x11f7('0x1f')](_0x1df9ea[_0x11f7('0xab')])[_0x11f7('0xac')](_0x1df9ea[_0x11f7('0x91')]);}else{return _0x2e6f13[_0x11f7('0x1e')](0xc8);}})[_0x11f7('0x46')](handleError(_0x2e6f13,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 7b521eb..7a5ebae 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 _0x3a6d=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a6d,0x143));var _0xd3a6=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x3a6d[_0x50a0c2];return _0x5ebadd;};'use strict';var EventEmitter=require(_0xd3a6('0x0'));var Plugin=require(_0xd3a6('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xd3a6('0x2')](0x0);var events={'afterCreate':_0xd3a6('0x3'),'afterUpdate':_0xd3a6('0x4'),'afterDestroy':_0xd3a6('0x5')};function emitEvent(_0x3d37ff){return function(_0x585473,_0x1cb966,_0x27d641){PluginEvents[_0xd3a6('0x6')](_0x3d37ff+':'+_0x585473['id'],_0x585473);PluginEvents[_0xd3a6('0x6')](_0x3d37ff,_0x585473);_0x27d641(null);};}for(var e in events){if(events[_0xd3a6('0x7')](e)){var event=events[e];Plugin[_0xd3a6('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x4bd3=['events','Plugin','setMaxListeners','emit','hook','exports'];(function(_0x2be86d,_0x7aac06){var _0xb062ea=function(_0xacee39){while(--_0xacee39){_0x2be86d['push'](_0x2be86d['shift']());}};_0xb062ea(++_0x7aac06);}(_0x4bd3,0x174));var _0x34bd=function(_0x45d2be,_0x441bbd){_0x45d2be=_0x45d2be-0x0;var _0xbabd01=_0x4bd3[_0x45d2be];return _0xbabd01;};'use strict';var EventEmitter=require(_0x34bd('0x0'));var Plugin=require('../../mysqldb')['db'][_0x34bd('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x34bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22b921){return function(_0x44854a,_0x1fc8eb,_0x5846f3){PluginEvents[_0x34bd('0x3')](_0x22b921+':'+_0x44854a['id'],_0x44854a);PluginEvents[_0x34bd('0x3')](_0x22b921,_0x44854a);_0x5846f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x34bd('0x4')](e,emitEvent(event));}}module[_0x34bd('0x5')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 364b012..df057ec 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 _0xeec6=['path','rimraf','../../config/environment','./plugin.attributes','Plugin','plugins','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1c5dfc,_0x33e663){var _0x2a4f2b=function(_0x4f9104){while(--_0x4f9104){_0x1c5dfc['push'](_0x1c5dfc['shift']());}};_0x2a4f2b(++_0x33e663);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3cc751,_0x38b8ff){_0x3cc751=_0x3cc751-0x0;var _0x3956a2=_0xeec6[_0x3cc751];return _0x3956a2;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var logger=require(_0x6eec('0x2'))(_0x6eec('0x3'));var moment=require('moment');var BPromise=require(_0x6eec('0x4'));var rp=require(_0x6eec('0x5'));var fs=require('fs');var path=require(_0x6eec('0x6'));var rimraf=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var attributes=require(_0x6eec('0x9'));module['exports']=function(_0x185f31,_0x3c6eda){return _0x185f31['define'](_0x6eec('0xa'),attributes,{'tableName':_0x6eec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0bb=['Plugin','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define'];(function(_0xdfdbe,_0x17739b){var _0x555732=function(_0x3d608d){while(--_0x3d608d){_0xdfdbe['push'](_0xdfdbe['shift']());}};_0x555732(++_0x17739b);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x5ecb26,_0xdd72bd){_0x5ecb26=_0x5ecb26-0x0;var _0x5c374a=_0xd0bb[_0x5ecb26];return _0x5c374a;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var logger=require(_0xbd0b('0x2'))('api');var moment=require(_0xbd0b('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd0b('0x4'));var fs=require('fs');var path=require(_0xbd0b('0x5'));var rimraf=require('rimraf');var config=require(_0xbd0b('0x6'));var attributes=require('./plugin.attributes');module[_0xbd0b('0x7')]=function(_0x1b2499,_0x158b5c){return _0x1b2499[_0xbd0b('0x8')](_0xbd0b('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 2046294..384d545 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 _0xdc14=['then','debug','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreatePlugin','Plugin','create','options'];(function(_0x17f6ab,_0x5743f7){var _0x28758e=function(_0x371824){while(--_0x371824){_0x17f6ab['push'](_0x17f6ab['shift']());}};_0x28758e(++_0x5743f7);}(_0xdc14,0x136));var _0x4dc1=function(_0x46ac0c,_0x10c48f){_0x46ac0c=_0x46ac0c-0x0;var _0x2644d2=_0xdc14[_0x46ac0c];return _0x2644d2;};'use strict';var _=require(_0x4dc1('0x0'));var util=require(_0x4dc1('0x1'));var moment=require(_0x4dc1('0x2'));var BPromise=require('bluebird');var rs=require(_0x4dc1('0x3'));var fs=require('fs');var Redis=require(_0x4dc1('0x4'));var db=require(_0x4dc1('0x5'))['db'];var utils=require(_0x4dc1('0x6'));var logger=require(_0x4dc1('0x7'))(_0x4dc1('0x8'));var config=require(_0x4dc1('0x9'));var jayson=require(_0x4dc1('0xa'));var client=jayson[_0x4dc1('0xb')][_0x4dc1('0xc')]({'port':0x232a});config[_0x4dc1('0xd')]=_[_0x4dc1('0xe')](config[_0x4dc1('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4dc1('0xf'))(new Redis(config[_0x4dc1('0xd')]));require(_0x4dc1('0x10'))[_0x4dc1('0x11')](socket);function respondWithRpcPromise(_0x5cec1e,_0x4e5177,_0x379780){return new BPromise(function(_0x538589,_0x4a1a3c){return client[_0x4dc1('0x12')](_0x5cec1e,_0x379780)['then'](function(_0x452b1c){logger[_0x4dc1('0x13')](_0x4dc1('0x14'),_0x4e5177,_0x4dc1('0x15'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x4e5177,'request\x20sent',JSON['stringify'](_0x452b1c));if(_0x452b1c['error']){if(_0x452b1c[_0x4dc1('0x16')][_0x4dc1('0x17')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x4e5177,_0x452b1c['error'][_0x4dc1('0x18')]);return _0x4a1a3c(_0x452b1c[_0x4dc1('0x16')][_0x4dc1('0x18')]);}logger['error'](_0x4dc1('0x14'),_0x4e5177,_0x452b1c[_0x4dc1('0x16')][_0x4dc1('0x18')]);return _0x538589(_0x452b1c[_0x4dc1('0x16')][_0x4dc1('0x18')]);}else{logger['info'](_0x4dc1('0x14'),_0x4e5177,_0x4dc1('0x15'));_0x538589(_0x452b1c[_0x4dc1('0x19')][_0x4dc1('0x18')]);}})['catch'](function(_0x1cb765){logger['error']('Plugin,\x20%s,\x20%s',_0x4e5177,_0x1cb765);_0x4a1a3c(_0x1cb765);});});}exports[_0x4dc1('0x1a')]=function(_0x4d0911){var _0x405c70=this;return new Promise(function(_0x5a39a2,_0x4edf33){return db[_0x4dc1('0x1b')][_0x4dc1('0x1c')](_0x4d0911['body'],{'raw':_0x4d0911[_0x4dc1('0x1d')]?_0x4d0911[_0x4dc1('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x4dc1('0x1e')](function(_0xd0c573){logger[_0x4dc1('0x13')]('CreatePlugin',_0x4d0911);logger[_0x4dc1('0x1f')]('CreatePlugin',_0x4d0911,JSON[_0x4dc1('0x20')](_0xd0c573));_0x5a39a2(_0xd0c573);})[_0x4dc1('0x21')](function(_0x3ef41d){logger[_0x4dc1('0x16')](_0x4dc1('0x1a'),_0x3ef41d[_0x4dc1('0x18')],_0x4d0911);_0x4edf33(_0x405c70[_0x4dc1('0x16')](0x1f4,_0x3ef41d[_0x4dc1('0x18')]));});});}; \ No newline at end of file +var _0x8f64=['create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','defaults','redis','register','request','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreatePlugin','Plugin'];(function(_0x19e54b,_0xbf9e7e){var _0x417d52=function(_0x4b7364){while(--_0x4b7364){_0x19e54b['push'](_0x19e54b['shift']());}};_0x417d52(++_0xbf9e7e);}(_0x8f64,0x18a));var _0x48f6=function(_0x219af3,_0x47d6da){_0x219af3=_0x219af3-0x0;var _0x29a18d=_0x8f64[_0x219af3];return _0x29a18d;};'use strict';var _=require(_0x48f6('0x0'));var util=require(_0x48f6('0x1'));var moment=require(_0x48f6('0x2'));var BPromise=require(_0x48f6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48f6('0x4'));var db=require(_0x48f6('0x5'))['db'];var utils=require(_0x48f6('0x6'));var logger=require('../../config/logger')(_0x48f6('0x7'));var config=require(_0x48f6('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x48f6('0x9')](config[_0x48f6('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48f6('0xa')]));require('./plugin.socket')[_0x48f6('0xb')](socket);function respondWithRpcPromise(_0x25413a,_0x5de749,_0x5c917a){return new BPromise(function(_0x3aa865,_0x21ab92){return client[_0x48f6('0xc')](_0x25413a,_0x5c917a)['then'](function(_0x5c4985){logger['info'](_0x48f6('0xd'),_0x5de749,_0x48f6('0xe'));logger[_0x48f6('0xf')](_0x48f6('0x10'),_0x5de749,'request\x20sent',JSON[_0x48f6('0x11')](_0x5c4985));if(_0x5c4985['error']){if(_0x5c4985[_0x48f6('0x12')][_0x48f6('0x13')]===0x1f4){logger['error'](_0x48f6('0xd'),_0x5de749,_0x5c4985[_0x48f6('0x12')][_0x48f6('0x14')]);return _0x21ab92(_0x5c4985['error'][_0x48f6('0x14')]);}logger[_0x48f6('0x12')]('Plugin,\x20%s,\x20%s',_0x5de749,_0x5c4985[_0x48f6('0x12')][_0x48f6('0x14')]);return _0x3aa865(_0x5c4985[_0x48f6('0x12')]['message']);}else{logger[_0x48f6('0x15')](_0x48f6('0xd'),_0x5de749,_0x48f6('0xe'));_0x3aa865(_0x5c4985[_0x48f6('0x16')]['message']);}})[_0x48f6('0x17')](function(_0x59629a){logger['error'](_0x48f6('0xd'),_0x5de749,_0x59629a);_0x21ab92(_0x59629a);});});}exports[_0x48f6('0x18')]=function(_0x360036){var _0x1c94b8=this;return new Promise(function(_0x4ac655,_0x297fa2){return db[_0x48f6('0x19')][_0x48f6('0x1a')](_0x360036[_0x48f6('0x1b')],{'raw':_0x360036[_0x48f6('0x1c')]?_0x360036[_0x48f6('0x1c')][_0x48f6('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2992cf){logger[_0x48f6('0x15')](_0x48f6('0x18'),_0x360036);logger[_0x48f6('0xf')](_0x48f6('0x18'),_0x360036,JSON[_0x48f6('0x11')](_0x2992cf));_0x4ac655(_0x2992cf);})['catch'](function(_0x67e3d0){logger[_0x48f6('0x12')](_0x48f6('0x18'),_0x67e3d0[_0x48f6('0x14')],_0x360036);_0x297fa2(_0x1c94b8[_0x48f6('0x12')](0x1f4,_0x67e3d0['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 9eea0ce..6353352 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 _0x4f01=['update','emit','register','length','plugin:','save','remove'];(function(_0x2612d5,_0x12651a){var _0x522573=function(_0x45fab1){while(--_0x45fab1){_0x2612d5['push'](_0x2612d5['shift']());}};_0x522573(++_0x12651a);}(_0x4f01,0xe5));var _0x14f0=function(_0x376a76,_0x3f3c4d){_0x376a76=_0x376a76-0x0;var _0xb37764=_0x4f01[_0x376a76];return _0xb37764;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x14f0('0x0'),_0x14f0('0x1'),_0x14f0('0x2')];function createListener(_0x1c0cdb,_0x3ba042){return function(_0x2727f6){_0x3ba042[_0x14f0('0x3')](_0x1c0cdb,_0x2727f6);};}function removeListener(_0x2c2070,_0x17d681){return function(){PluginEvents['removeListener'](_0x2c2070,_0x17d681);};}exports[_0x14f0('0x4')]=function(_0x36bc10){for(var _0x5c4969=0x0,_0xcf2512=events[_0x14f0('0x5')];_0x5c4969<_0xcf2512;_0x5c4969++){var _0xb1e01a=events[_0x5c4969];var _0xf71652=createListener(_0x14f0('0x6')+_0xb1e01a,_0x36bc10);PluginEvents['on'](_0xb1e01a,_0xf71652);}}; \ No newline at end of file +var _0x6c5c=['register','plugin:','save','update','emit'];(function(_0x2381c9,_0xddadfd){var _0x5d10ee=function(_0x233323){while(--_0x233323){_0x2381c9['push'](_0x2381c9['shift']());}};_0x5d10ee(++_0xddadfd);}(_0x6c5c,0x124));var _0xc6c5=function(_0x1188d3,_0x2c2016){_0x1188d3=_0x1188d3-0x0;var _0x37df25=_0x6c5c[_0x1188d3];return _0x37df25;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xc6c5('0x0'),'remove',_0xc6c5('0x1')];function createListener(_0x814063,_0xcac708){return function(_0x5a5234){_0xcac708[_0xc6c5('0x2')](_0x814063,_0x5a5234);};}function removeListener(_0x5e8b2b,_0x4344e1){return function(){PluginEvents['removeListener'](_0x5e8b2b,_0x4344e1);};}exports[_0xc6c5('0x3')]=function(_0x113793){for(var _0x56dcb4=0x0,_0x2c6533=events['length'];_0x56dcb4<_0x2c6533;_0x56dcb4++){var _0xe77741=events[_0x56dcb4];var _0x22c050=createListener(_0xc6c5('0x4')+_0xe77741,_0x113793);PluginEvents['on'](_0xe77741,_0x22c050);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index c310d7e..6f1ee28 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 _0xd42d=['./pm2.controller','get','isAuthenticated','index','show','post','create','/:id','destroy','exports','express','Router','../../components/auth/service'];(function(_0x259f87,_0x5b6a0e){var _0x78a5d4=function(_0x4e3489){while(--_0x4e3489){_0x259f87['push'](_0x259f87['shift']());}};_0x78a5d4(++_0x5b6a0e);}(_0xd42d,0x10e));var _0xdd42=function(_0x2590c7,_0x4eea69){_0x2590c7=_0x2590c7-0x0;var _0x4c7e7a=_0xd42d[_0x2590c7];return _0x4c7e7a;};'use strict';var express=require(_0xdd42('0x0'));var router=express[_0xdd42('0x1')]();var auth=require(_0xdd42('0x2'));var controller=require(_0xdd42('0x3'));router[_0xdd42('0x4')]('/',auth[_0xdd42('0x5')](),controller[_0xdd42('0x6')]);router[_0xdd42('0x4')]('/:id',auth[_0xdd42('0x5')](),controller[_0xdd42('0x7')]);router[_0xdd42('0x8')]('/',auth[_0xdd42('0x5')](),controller[_0xdd42('0x9')]);router['put'](_0xdd42('0xa'),auth[_0xdd42('0x5')](),controller['update']);router['delete']('/:id',auth[_0xdd42('0x5')](),controller[_0xdd42('0xb')]);module[_0xdd42('0xc')]=router; \ No newline at end of file +var _0xfe7a=['destroy','exports','express','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xfe7a,0xa7));var _0xafe7=function(_0x21e0af,_0x176e49){_0x21e0af=_0x21e0af-0x0;var _0x57d906=_0xfe7a[_0x21e0af];return _0x57d906;};'use strict';var express=require(_0xafe7('0x0'));var router=express[_0xafe7('0x1')]();var auth=require(_0xafe7('0x2'));var controller=require(_0xafe7('0x3'));router[_0xafe7('0x4')]('/',auth[_0xafe7('0x5')](),controller[_0xafe7('0x6')]);router[_0xafe7('0x4')](_0xafe7('0x7'),auth[_0xafe7('0x5')](),controller['show']);router[_0xafe7('0x8')]('/',auth[_0xafe7('0x5')](),controller[_0xafe7('0x9')]);router[_0xafe7('0xa')]('/:id',auth[_0xafe7('0x5')](),controller[_0xafe7('0xb')]);router[_0xafe7('0xc')](_0xafe7('0x7'),auth[_0xafe7('0x5')](),controller[_0xafe7('0xd')]);module[_0xafe7('0xe')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 9869bcf..44a7532 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 _0x78a6=['dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','send','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','api','path','child_process','exec','bluebird','sendStatus','status','json','stack','name','info','error','index','then','reject','motion2','catch','show','describe','params','create','body','join','../../files/plugins','script','cwd','chdir','start'];(function(_0x4cdd59,_0x400fdc){var _0x1c90b2=function(_0x3a9343){while(--_0x3a9343){_0x4cdd59['push'](_0x4cdd59['shift']());}};_0x1c90b2(++_0x400fdc);}(_0x78a6,0x1eb));var _0x678a=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x78a6[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x678a('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x678a('0x1'));var path=require(_0x678a('0x2'));var exec=require(_0x678a('0x3'))[_0x678a('0x4')];var BPromise=require(_0x678a('0x5'));function handleEntityNotFound(_0x1b3dc0,_0x46e134){return function(_0x1f1618){if(!_0x1f1618){_0x1b3dc0[_0x678a('0x6')](0x194);;}return _0x1f1618;};}function respondWithResult(_0x574ef9,_0x3b358c){_0x3b358c=_0x3b358c||0xc8;return function(_0x2eed7d){if(_0x2eed7d){return _0x574ef9[_0x678a('0x7')](_0x3b358c)[_0x678a('0x8')](_0x2eed7d);}return null;};}function handleError(_0x39de02,_0x417374){_0x417374=_0x417374||0x1f4;return function(_0x21925b){logger['error'](_0x21925b[_0x678a('0x9')]);if(_0x21925b['name']){delete _0x21925b[_0x678a('0xa')];}_0x39de02[_0x678a('0x7')](_0x417374)['send'](_0x21925b);};}function execChildProcess(){return new BPromise(function(_0x2e492e,_0x47c60f){exec('npm\x20install',function(_0x5a9d28,_0x1f94b1,_0x4e873a){logger['info'](_0x1f94b1);logger[_0x678a('0xb')](_0x4e873a);if(_0x5a9d28){logger[_0x678a('0xc')](_0x5a9d28);return _0x47c60f(_0x5a9d28);}return _0x2e492e(_0x1f94b1);});});}exports[_0x678a('0xd')]=function(_0x5a834d,_0x23bf76){return pm2['list']()[_0x678a('0xe')](function(_0x1b7e1d){if(_0x1b7e1d){var _0x3657ab=_[_0x678a('0xf')](_0x1b7e1d,function(_0x57bb91){return _0x57bb91['name']==='express'||_0x57bb91['name']===_0x678a('0x10');});return{'rows':_0x3657ab,'count':_0x3657ab['length']};}return null;})[_0x678a('0xe')](respondWithResult(_0x23bf76,null))[_0x678a('0x11')](handleError(_0x23bf76,null));};exports[_0x678a('0x12')]=function(_0x5c5dfb,_0x107a06){return pm2[_0x678a('0x13')](_0x5c5dfb[_0x678a('0x14')]['id'])[_0x678a('0xe')](respondWithResult(_0x107a06,null))[_0x678a('0xe')](handleEntityNotFound(_0x107a06,null))[_0x678a('0x11')](handleError(_0x107a06,null));};exports[_0x678a('0x15')]=function(_0x457b47,_0x3327cf){if(_0x457b47[_0x678a('0x16')][_0x678a('0xa')]&&_0x457b47[_0x678a('0x16')]['script']){var _0x263825=path[_0x678a('0x17')](__dirname,_0x678a('0x18'),_0x457b47[_0x678a('0x16')][_0x678a('0x19')]);var _0x3397e6=process[_0x678a('0x1a')]();process[_0x678a('0x1b')](path['dirname'](_0x263825));return execChildProcess()[_0x678a('0xe')](function(_0x34777c){process[_0x678a('0x1b')](_0x3397e6);return pm2[_0x678a('0x1c')]({'name':_0x457b47['body'][_0x678a('0xa')],'script':_0x263825});})[_0x678a('0xe')](function(_0x2a682f){pm2[_0x678a('0x1d')]();return _0x2a682f[0x0];})['then'](respondWithResult(_0x3327cf,0xc9))['catch'](handleError(_0x3327cf,null));}else{return _0x3327cf[_0x678a('0x7')](0x1f4)['send']({'message':_0x678a('0x1e')});}};exports[_0x678a('0x1f')]=function(_0x5c2206,_0x482465){if(_0x5c2206[_0x678a('0x16')]['id']){delete _0x5c2206['body']['id'];}var _0x2eae71={'online':_0x678a('0x20'),'stopped':_0x678a('0x21')};if(_0x2eae71[_0x678a('0x22')](_0x5c2206[_0x678a('0x16')]['status'])){return pm2[_0x2eae71[_0x5c2206['body']['status']]](_0x5c2206[_0x678a('0x14')]['id'])[_0x678a('0xe')](respondWithResult(_0x482465,0xc8))[_0x678a('0x11')](handleError(_0x482465,null));}else{return _0x482465[_0x678a('0x7')](0x1f4)[_0x678a('0x23')]({'message':_0x678a('0x24')});}};exports[_0x678a('0x25')]=function(_0x1f5259,_0x3a536c){if(_0x1f5259[_0x678a('0x16')]['id']){delete _0x1f5259[_0x678a('0x16')]['id'];}if(_0x1f5259[_0x678a('0x14')]['id']){return pm2[_0x678a('0x26')](_0x1f5259[_0x678a('0x14')]['id'])[_0x678a('0xe')](function(_0x59934f){pm2['dump']();return _0x59934f[0x0];})[_0x678a('0xe')](respondWithResult(_0x3a536c,null))[_0x678a('0x11')](handleError(_0x3a536c,null));}else{return _0x3a536c['status'](0x1f4)['send']({'message':_0x678a('0x27')});}}; \ No newline at end of file +var _0xdd99=['restart','hasOwnProperty','params','Unknown\x20status','delete','Unknown\x20id','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','index','list','then','reject','express','motion2','catch','show','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0xdd99,0x9e));var _0x9dd9=function(_0x42a78b,_0x221347){_0x42a78b=_0x42a78b-0x0;var _0x375f2e=_0xdd99[_0x42a78b];return _0x375f2e;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x9dd9('0x0'))(_0x9dd9('0x1'));var path=require(_0x9dd9('0x2'));var exec=require(_0x9dd9('0x3'))[_0x9dd9('0x4')];var BPromise=require(_0x9dd9('0x5'));function handleEntityNotFound(_0x217a9a,_0x143ccb){return function(_0x234f8c){if(!_0x234f8c){_0x217a9a[_0x9dd9('0x6')](0x194);;}return _0x234f8c;};}function respondWithResult(_0x5459f3,_0x54d6ae){_0x54d6ae=_0x54d6ae||0xc8;return function(_0x4fdde2){if(_0x4fdde2){return _0x5459f3[_0x9dd9('0x7')](_0x54d6ae)[_0x9dd9('0x8')](_0x4fdde2);}return null;};}function handleError(_0xa92ab,_0x4bec02){_0x4bec02=_0x4bec02||0x1f4;return function(_0x55cc4f){logger[_0x9dd9('0x9')](_0x55cc4f[_0x9dd9('0xa')]);if(_0x55cc4f[_0x9dd9('0xb')]){delete _0x55cc4f['name'];}_0xa92ab[_0x9dd9('0x7')](_0x4bec02)[_0x9dd9('0xc')](_0x55cc4f);};}function execChildProcess(){return new BPromise(function(_0x354c16,_0x26c97b){exec(_0x9dd9('0xd'),function(_0x9bf27c,_0x218154,_0x461e54){logger['info'](_0x218154);logger['info'](_0x461e54);if(_0x9bf27c){logger[_0x9dd9('0x9')](_0x9bf27c);return _0x26c97b(_0x9bf27c);}return _0x354c16(_0x218154);});});}exports[_0x9dd9('0xe')]=function(_0x48ba0a,_0x1f02e5){return pm2[_0x9dd9('0xf')]()[_0x9dd9('0x10')](function(_0x1da7db){if(_0x1da7db){var _0x418245=_[_0x9dd9('0x11')](_0x1da7db,function(_0x4319ac){return _0x4319ac[_0x9dd9('0xb')]===_0x9dd9('0x12')||_0x4319ac[_0x9dd9('0xb')]===_0x9dd9('0x13');});return{'rows':_0x418245,'count':_0x418245['length']};}return null;})[_0x9dd9('0x10')](respondWithResult(_0x1f02e5,null))[_0x9dd9('0x14')](handleError(_0x1f02e5,null));};exports[_0x9dd9('0x15')]=function(_0x7056fb,_0x1a5956){return pm2['describe'](_0x7056fb['params']['id'])[_0x9dd9('0x10')](respondWithResult(_0x1a5956,null))[_0x9dd9('0x10')](handleEntityNotFound(_0x1a5956,null))[_0x9dd9('0x14')](handleError(_0x1a5956,null));};exports['create']=function(_0x4603cf,_0x162227){if(_0x4603cf[_0x9dd9('0x16')]['name']&&_0x4603cf['body'][_0x9dd9('0x17')]){var _0x1672cd=path[_0x9dd9('0x18')](__dirname,_0x9dd9('0x19'),_0x4603cf[_0x9dd9('0x16')][_0x9dd9('0x17')]);var _0x2dece2=process[_0x9dd9('0x1a')]();process[_0x9dd9('0x1b')](path[_0x9dd9('0x1c')](_0x1672cd));return execChildProcess()[_0x9dd9('0x10')](function(_0x5b9e69){process[_0x9dd9('0x1b')](_0x2dece2);return pm2[_0x9dd9('0x1d')]({'name':_0x4603cf[_0x9dd9('0x16')][_0x9dd9('0xb')],'script':_0x1672cd});})[_0x9dd9('0x10')](function(_0x5af0f1){pm2[_0x9dd9('0x1e')]();return _0x5af0f1[0x0];})[_0x9dd9('0x10')](respondWithResult(_0x162227,0xc9))[_0x9dd9('0x14')](handleError(_0x162227,null));}else{return _0x162227[_0x9dd9('0x7')](0x1f4)[_0x9dd9('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x9dd9('0x1f')]=function(_0x21606a,_0x32cd05){if(_0x21606a[_0x9dd9('0x16')]['id']){delete _0x21606a[_0x9dd9('0x16')]['id'];}var _0x28b208={'online':_0x9dd9('0x20'),'stopped':'stop'};if(_0x28b208[_0x9dd9('0x21')](_0x21606a[_0x9dd9('0x16')][_0x9dd9('0x7')])){return pm2[_0x28b208[_0x21606a[_0x9dd9('0x16')]['status']]](_0x21606a[_0x9dd9('0x22')]['id'])['then'](respondWithResult(_0x32cd05,0xc8))[_0x9dd9('0x14')](handleError(_0x32cd05,null));}else{return _0x32cd05[_0x9dd9('0x7')](0x1f4)[_0x9dd9('0xc')]({'message':_0x9dd9('0x23')});}};exports['destroy']=function(_0x501db1,_0x4dc63e){if(_0x501db1['body']['id']){delete _0x501db1[_0x9dd9('0x16')]['id'];}if(_0x501db1[_0x9dd9('0x22')]['id']){return pm2[_0x9dd9('0x24')](_0x501db1[_0x9dd9('0x22')]['id'])[_0x9dd9('0x10')](function(_0x305d35){pm2[_0x9dd9('0x1e')]();return _0x305d35[0x0];})[_0x9dd9('0x10')](respondWithResult(_0x4dc63e,null))[_0x9dd9('0x14')](handleError(_0x4dc63e,null));}else{return _0x4dc63e[_0x9dd9('0x7')](0x1f4)[_0x9dd9('0xc')]({'message':_0x9dd9('0x25')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 5b333a7..ee991f4 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 _0xffe1=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x51c82c,_0x4aacbd){var _0x2b4d1b=function(_0x2c0e11){while(--_0x2c0e11){_0x51c82c['push'](_0x51c82c['shift']());}};_0x2b4d1b(++_0x4aacbd);}(_0xffe1,0x187));var _0x1ffe=function(_0x39e94d,_0x1aa514){_0x39e94d=_0x39e94d-0x0;var _0x504946=_0xffe1[_0x39e94d];return _0x504946;};'use strict';var multer=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var path=require('path');var timeout=require(_0x1ffe('0x2'));var express=require('express');var router=express[_0x1ffe('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1ffe('0x4'));var interaction=require(_0x1ffe('0x5'));var config=require(_0x1ffe('0x6'));module[_0x1ffe('0x7')]=router; \ No newline at end of file +var _0x065e=['fs-extra','../../config/environment','exports','multer','express','Router'];(function(_0x4b1454,_0xe510c9){var _0x477a76=function(_0x540bd3){while(--_0x540bd3){_0x4b1454['push'](_0x4b1454['shift']());}};_0x477a76(++_0xe510c9);}(_0x065e,0x1a7));var _0xe065=function(_0x48a36d,_0x59ace8){_0x48a36d=_0x48a36d-0x0;var _0xdef2dd=_0x065e[_0x48a36d];return _0xdef2dd;};'use strict';var multer=require(_0xe065('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe065('0x1'));var router=express[_0xe065('0x2')]();var fs_extra=require(_0xe065('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe065('0x4'));module[_0xe065('0x5')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index aaff845..d94e1c4 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 _0x74d5=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x23bf7c,_0x10a6ae){var _0x4223fd=function(_0x38a22f){while(--_0x38a22f){_0x23bf7c['push'](_0x23bf7c['shift']());}};_0x4223fd(++_0x10a6ae);}(_0x74d5,0x8e));var _0x574d=function(_0x57267d,_0x44976d){_0x57267d=_0x57267d-0x0;var _0x2cab22=_0x74d5[_0x57267d];return _0x2cab22;};'use strict';var Sequelize=require(_0x574d('0x0'));module[_0x574d('0x1')]={'state':{'type':Sequelize[_0x574d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x574d('0x3')]},'scheduledat':{'type':Sequelize[_0x574d('0x4')]},'uniqueid':{'type':Sequelize[_0x574d('0x3')]},'starttime':{'type':Sequelize[_0x574d('0x4')]},'responsetime':{'type':Sequelize[_0x574d('0x4')]},'ringtime':{'type':Sequelize[_0x574d('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x574d('0x3')]},'membername':{'type':Sequelize[_0x574d('0x3')]}}; \ No newline at end of file +var _0x1656=['sequelize','INTEGER','STRING','DATE'];(function(_0x322f21,_0x47316f){var _0x121265=function(_0x5102cd){while(--_0x5102cd){_0x322f21['push'](_0x322f21['shift']());}};_0x121265(++_0x47316f);}(_0x1656,0x154));var _0x6165=function(_0x37c97d,_0x3205f0){_0x37c97d=_0x37c97d-0x0;var _0x3add5c=_0x1656[_0x37c97d];return _0x3add5c;};'use strict';var Sequelize=require(_0x6165('0x0'));module['exports']={'state':{'type':Sequelize[_0x6165('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x6165('0x2')]},'scheduledat':{'type':Sequelize[_0x6165('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6165('0x3')]},'responsetime':{'type':Sequelize[_0x6165('0x3')]},'ringtime':{'type':Sequelize[_0x6165('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6165('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6165('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index fa4f73e..fedc763 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 _0xe460=['report_agent_preview','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','ReportAgentPreview'];(function(_0x4abbaa,_0xae0a0e){var _0x40a910=function(_0x1cd4ed){while(--_0x1cd4ed){_0x4abbaa['push'](_0x4abbaa['shift']());}};_0x40a910(++_0xae0a0e);}(_0xe460,0xb7));var _0x0e46=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xe460[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0x0e46('0x0'));var util=require(_0x0e46('0x1'));var logger=require(_0x0e46('0x2'))(_0x0e46('0x3'));var moment=require(_0x0e46('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e46('0x5'));var fs=require('fs');var path=require(_0x0e46('0x6'));var rimraf=require(_0x0e46('0x7'));var config=require(_0x0e46('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x0e46('0x9')]=function(_0x224471,_0x56f58b){return _0x224471[_0x0e46('0xa')](_0x0e46('0xb'),attributes,{'tableName':_0x0e46('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b77=['bluebird','path','../../config/environment','exports','ReportAgentPreview','lodash','util','api','moment'];(function(_0x3b4738,_0x3d6f1b){var _0x2f0ebd=function(_0x56833a){while(--_0x56833a){_0x3b4738['push'](_0x3b4738['shift']());}};_0x2f0ebd(++_0x3d6f1b);}(_0x1b77,0x1eb));var _0x71b7=function(_0x19acfc,_0x21bbaf){_0x19acfc=_0x19acfc-0x0;var _0x31e33d=_0x1b77[_0x19acfc];return _0x31e33d;};'use strict';var _=require(_0x71b7('0x0'));var util=require(_0x71b7('0x1'));var logger=require('../../config/logger')(_0x71b7('0x2'));var moment=require(_0x71b7('0x3'));var BPromise=require(_0x71b7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71b7('0x5'));var rimraf=require('rimraf');var config=require(_0x71b7('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0x71b7('0x7')]=function(_0x57cb4e,_0x5d0c23){return _0x57cb4e['define'](_0x71b7('0x8'),attributes,{'tableName':'report_agent_preview','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 028895e..1d4b03e 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 _0x18a1=['debug','request\x20sent','error','message','catch','ReportAgentPreview','body','options','raw','CreateReportAgentPreview','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x77d286,_0x1ddc6d){var _0x5446a5=function(_0x45e2cf){while(--_0x45e2cf){_0x77d286['push'](_0x77d286['shift']());}};_0x5446a5(++_0x1ddc6d);}(_0x18a1,0x1a3));var _0x118a=function(_0x40e25f,_0x51ea53){_0x40e25f=_0x40e25f-0x0;var _0x4d41d9=_0x18a1[_0x40e25f];return _0x4d41d9;};'use strict';var _=require('lodash');var util=require(_0x118a('0x0'));var moment=require(_0x118a('0x1'));var BPromise=require(_0x118a('0x2'));var rs=require(_0x118a('0x3'));var fs=require('fs');var Redis=require(_0x118a('0x4'));var db=require(_0x118a('0x5'))['db'];var utils=require(_0x118a('0x6'));var logger=require(_0x118a('0x7'))('rpc');var config=require(_0x118a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x118a('0x9')][_0x118a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c79ce,_0x592920,_0x1f8c30){return new BPromise(function(_0x45f373,_0x40f4c6){return client['request'](_0x5c79ce,_0x1f8c30)['then'](function(_0xcd2dc5){logger[_0x118a('0xb')](_0x118a('0xc'),_0x592920,'request\x20sent');logger[_0x118a('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x592920,_0x118a('0xe'),JSON['stringify'](_0xcd2dc5));if(_0xcd2dc5[_0x118a('0xf')]){if(_0xcd2dc5[_0x118a('0xf')]['code']===0x1f4){logger[_0x118a('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x592920,_0xcd2dc5['error'][_0x118a('0x10')]);return _0x40f4c6(_0xcd2dc5[_0x118a('0xf')][_0x118a('0x10')]);}logger[_0x118a('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x592920,_0xcd2dc5['error'][_0x118a('0x10')]);return _0x45f373(_0xcd2dc5[_0x118a('0xf')][_0x118a('0x10')]);}else{logger[_0x118a('0xb')](_0x118a('0xc'),_0x592920,'request\x20sent');_0x45f373(_0xcd2dc5['result'][_0x118a('0x10')]);}})[_0x118a('0x11')](function(_0x4a0740){logger[_0x118a('0xf')](_0x118a('0xc'),_0x592920,_0x4a0740);_0x40f4c6(_0x4a0740);});});}exports['CreateReportAgentPreview']=function(_0x5673f9){var _0x6901fc=this;return new Promise(function(_0x2de8e0,_0x47b0e7){return db[_0x118a('0x12')]['create'](_0x5673f9[_0x118a('0x13')],{'raw':_0x5673f9[_0x118a('0x14')]?_0x5673f9[_0x118a('0x14')][_0x118a('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x4f227a){logger[_0x118a('0xb')](_0x118a('0x16'),_0x5673f9);logger[_0x118a('0xd')](_0x118a('0x16'),_0x5673f9,JSON[_0x118a('0x17')](_0x4f227a));_0x2de8e0(_0x4f227a);})[_0x118a('0x11')](function(_0x377327){logger[_0x118a('0xf')](_0x118a('0x16'),_0x377327[_0x118a('0x10')],_0x5673f9);_0x47b0e7(_0x6901fc[_0x118a('0xf')](0x1f4,_0x377327['message']));});});}; \ No newline at end of file +var _0x7ce6=['result','catch','ReportAgentPreview','create','body','raw','CreateReportAgentPreview','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message'];(function(_0x293ad7,_0x3757df){var _0x5a6318=function(_0x491684){while(--_0x491684){_0x293ad7['push'](_0x293ad7['shift']());}};_0x5a6318(++_0x3757df);}(_0x7ce6,0x19d));var _0x67ce=function(_0xddc9f8,_0xcb5e77){_0xddc9f8=_0xddc9f8-0x0;var _0x4e916c=_0x7ce6[_0xddc9f8];return _0x4e916c;};'use strict';var _=require(_0x67ce('0x0'));var util=require(_0x67ce('0x1'));var moment=require('moment');var BPromise=require(_0x67ce('0x2'));var rs=require(_0x67ce('0x3'));var fs=require('fs');var Redis=require(_0x67ce('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x67ce('0x5'));var logger=require(_0x67ce('0x6'))(_0x67ce('0x7'));var config=require('../../config/environment');var jayson=require(_0x67ce('0x8'));var client=jayson[_0x67ce('0x9')][_0x67ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2da996,_0x30f3e1,_0xaa3900){return new BPromise(function(_0x6ad6be,_0x14fa3a){return client[_0x67ce('0xb')](_0x2da996,_0xaa3900)[_0x67ce('0xc')](function(_0x422a8d){logger[_0x67ce('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x30f3e1,_0x67ce('0xe'));logger[_0x67ce('0xf')](_0x67ce('0x10'),_0x30f3e1,_0x67ce('0xe'),JSON[_0x67ce('0x11')](_0x422a8d));if(_0x422a8d[_0x67ce('0x12')]){if(_0x422a8d[_0x67ce('0x12')][_0x67ce('0x13')]===0x1f4){logger[_0x67ce('0x12')](_0x67ce('0x14'),_0x30f3e1,_0x422a8d[_0x67ce('0x12')][_0x67ce('0x15')]);return _0x14fa3a(_0x422a8d['error'][_0x67ce('0x15')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x30f3e1,_0x422a8d[_0x67ce('0x12')][_0x67ce('0x15')]);return _0x6ad6be(_0x422a8d['error']['message']);}else{logger[_0x67ce('0xd')](_0x67ce('0x14'),_0x30f3e1,_0x67ce('0xe'));_0x6ad6be(_0x422a8d[_0x67ce('0x16')][_0x67ce('0x15')]);}})[_0x67ce('0x17')](function(_0x1b2982){logger['error'](_0x67ce('0x14'),_0x30f3e1,_0x1b2982);_0x14fa3a(_0x1b2982);});});}exports['CreateReportAgentPreview']=function(_0x597d54){var _0x52451b=this;return new Promise(function(_0x3bd199,_0x3a62e9){return db[_0x67ce('0x18')][_0x67ce('0x19')](_0x597d54[_0x67ce('0x1a')],{'raw':_0x597d54['options']?_0x597d54['options'][_0x67ce('0x1b')]===undefined?!![]:![]:!![]})[_0x67ce('0xc')](function(_0xe24e88){logger[_0x67ce('0xd')](_0x67ce('0x1c'),_0x597d54);logger['debug']('CreateReportAgentPreview',_0x597d54,JSON['stringify'](_0xe24e88));_0x3bd199(_0xe24e88);})[_0x67ce('0x17')](function(_0x43f741){logger['error'](_0x67ce('0x1c'),_0x43f741['message'],_0x597d54);_0x3a62e9(_0x52451b[_0x67ce('0x12')](0x1f4,_0x43f741[_0x67ce('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 4bd6d9b..238c6d2 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 _0x4ff9=['put','/agents/:id/capacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','agents'];(function(_0x2eec1f,_0x1b9987){var _0x543075=function(_0x5792d2){while(--_0x5792d2){_0x2eec1f['push'](_0x2eec1f['shift']());}};_0x543075(++_0x1b9987);}(_0x4ff9,0x149));var _0x94ff=function(_0x5018db,_0x24d66c){_0x5018db=_0x5018db-0x0;var _0x340c6a=_0x4ff9[_0x5018db];return _0x340c6a;};'use strict';var multer=require(_0x94ff('0x0'));var util=require(_0x94ff('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x94ff('0x2'));router[_0x94ff('0x3')](_0x94ff('0x4'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x6')]);router[_0x94ff('0x3')](_0x94ff('0x7'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x8')]);router['get'](_0x94ff('0x9'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0x94ff('0x3')](_0x94ff('0xa'),auth[_0x94ff('0x5')](),controller[_0x94ff('0xb')]);router[_0x94ff('0x3')](_0x94ff('0xc'),auth[_0x94ff('0x5')](),controller[_0x94ff('0xd')]);router[_0x94ff('0x3')]('/mail/queues',auth[_0x94ff('0x5')](),controller[_0x94ff('0xe')]);router[_0x94ff('0x3')](_0x94ff('0xf'),auth[_0x94ff('0x5')](),controller['mailAccounts']);router[_0x94ff('0x3')]('/openchannel/queues',auth[_0x94ff('0x5')](),controller['openchannelQueues']);router[_0x94ff('0x3')](_0x94ff('0x10'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x11')]);router['get']('/whatsapp/queues',auth[_0x94ff('0x5')](),controller['whatsappQueues']);router[_0x94ff('0x3')](_0x94ff('0x12'),auth['isAuthenticated'](),controller[_0x94ff('0x13')]);router[_0x94ff('0x3')](_0x94ff('0x14'),auth['isAuthenticated'](),controller[_0x94ff('0x15')]);router[_0x94ff('0x3')](_0x94ff('0x16'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x17')]);router[_0x94ff('0x3')]('/voice/queues/channels/:uniqueid',auth[_0x94ff('0x5')](),controller[_0x94ff('0x18')]);router[_0x94ff('0x3')](_0x94ff('0x19'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x1a')]);router[_0x94ff('0x3')](_0x94ff('0x1b'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x1c')]);router[_0x94ff('0x3')](_0x94ff('0x1d'),auth['isAuthenticated'](),controller[_0x94ff('0x1e')]);router['get'](_0x94ff('0x1f'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x20')]);router['get'](_0x94ff('0x21'),auth['isAuthenticated'](),controller[_0x94ff('0x22')]);router[_0x94ff('0x3')]('/agents',auth[_0x94ff('0x5')](),controller[_0x94ff('0x23')]);router[_0x94ff('0x24')](_0x94ff('0x25'),auth[_0x94ff('0x5')](),controller['agentCapacity']);router['get']('/telephones',auth[_0x94ff('0x5')](),controller[_0x94ff('0x26')]);router['get'](_0x94ff('0x27'),auth['isAuthenticated'](),controller[_0x94ff('0x28')]);router[_0x94ff('0x3')](_0x94ff('0x29'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x2a')]);router['get'](_0x94ff('0x2b'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x2c')]);router[_0x94ff('0x3')](_0x94ff('0x2d'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x2e')]);router[_0x94ff('0x3')](_0x94ff('0x2f'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x30')]);router[_0x94ff('0x3')](_0x94ff('0x31'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x32')]);router[_0x94ff('0x3')]('/openchannel/queues/:id/waitinginteractions',auth[_0x94ff('0x5')](),controller[_0x94ff('0x33')]);router['get']('/sms/queues/waitinginteractions',auth[_0x94ff('0x5')](),controller[_0x94ff('0x34')]);router[_0x94ff('0x3')](_0x94ff('0x35'),auth['isAuthenticated'](),controller[_0x94ff('0x36')]);router['get'](_0x94ff('0x37'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x38')]);router[_0x94ff('0x39')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x94ff('0x3a')](_0x94ff('0x3b')));router['get']('/mail/queues/:id',auth[_0x94ff('0x5')](),controller[_0x94ff('0x3c')]);router[_0x94ff('0x39')](_0x94ff('0x3d'),auth[_0x94ff('0x5')](),controller['queueNotify']('chat'));router['get'](_0x94ff('0x3e'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x94ff('0x39')]('/fax/queues/:id/notify',auth[_0x94ff('0x5')](),controller[_0x94ff('0x3a')]('fax'));router[_0x94ff('0x3')]('/fax/queues/:id',auth[_0x94ff('0x5')](),controller[_0x94ff('0x3f')]);router[_0x94ff('0x39')](_0x94ff('0x40'),auth[_0x94ff('0x5')](),controller['queueNotify']('openchannel'));router['get'](_0x94ff('0x41'),auth[_0x94ff('0x5')](),controller['showOpenchannelQueues']);router[_0x94ff('0x39')](_0x94ff('0x42'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x3a')]('sms'));router[_0x94ff('0x39')](_0x94ff('0x43'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x3a')]('whatsapp'));router[_0x94ff('0x3')]('/sms/queues/:id',auth[_0x94ff('0x5')](),controller[_0x94ff('0x44')]);router['get'](_0x94ff('0x45'),auth[_0x94ff('0x5')](),controller['showWhatsappQueues']);router[_0x94ff('0x39')](_0x94ff('0x46'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x47')]);module[_0x94ff('0x48')]=router; \ No newline at end of file +var _0xcfef=['openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','put','/telephones','telephones','/trunks','trunks','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues'];(function(_0x98f6c3,_0x28639f){var _0x29238c=function(_0x585647){while(--_0x585647){_0x98f6c3['push'](_0x98f6c3['shift']());}};_0x29238c(++_0x28639f);}(_0xcfef,0x1db));var _0xfcfe=function(_0x59cb53,_0x19e1b3){_0x59cb53=_0x59cb53-0x0;var _0x4d9262=_0xcfef[_0x59cb53];return _0x4d9262;};'use strict';var multer=require(_0xfcfe('0x0'));var util=require(_0xfcfe('0x1'));var path=require(_0xfcfe('0x2'));var express=require(_0xfcfe('0x3'));var router=express[_0xfcfe('0x4')]();var auth=require(_0xfcfe('0x5'));var controller=require(_0xfcfe('0x6'));router[_0xfcfe('0x7')](_0xfcfe('0x8'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0xa')]);router[_0xfcfe('0x7')](_0xfcfe('0xb'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0xc')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xfcfe('0x9')](),controller['voiceChannelStopMixMonitor']);router['get'](_0xfcfe('0xd'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0xe')]);router[_0xfcfe('0x7')](_0xfcfe('0xf'),auth[_0xfcfe('0x9')](),controller['chatQueues']);router['get'](_0xfcfe('0x10'),auth[_0xfcfe('0x9')](),controller['mailQueues']);router[_0xfcfe('0x7')]('/mail/accounts',auth[_0xfcfe('0x9')](),controller['mailAccounts']);router['get'](_0xfcfe('0x11'),auth['isAuthenticated'](),controller[_0xfcfe('0x12')]);router[_0xfcfe('0x7')](_0xfcfe('0x13'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x14')]);router['get']('/whatsapp/queues',auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x15')]);router[_0xfcfe('0x7')]('/fax/queues',auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x16')]);router[_0xfcfe('0x7')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0xfcfe('0x17')]);router[_0xfcfe('0x7')](_0xfcfe('0x18'),auth[_0xfcfe('0x9')](),controller['voiceQueuesChannels']);router[_0xfcfe('0x7')](_0xfcfe('0x19'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x1a')]);router[_0xfcfe('0x7')](_0xfcfe('0x1b'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x1c')]);router[_0xfcfe('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0xfcfe('0x1d')]);router[_0xfcfe('0x7')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0xfcfe('0x1e')]);router['get'](_0xfcfe('0x1f'),auth['isAuthenticated'](),controller[_0xfcfe('0x20')]);router['get'](_0xfcfe('0x21'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x22')]);router['get'](_0xfcfe('0x23'),auth['isAuthenticated'](),controller['agents']);router[_0xfcfe('0x24')]('/agents/:id/capacity',auth[_0xfcfe('0x9')](),controller['agentCapacity']);router[_0xfcfe('0x7')](_0xfcfe('0x25'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x26')]);router[_0xfcfe('0x7')](_0xfcfe('0x27'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x28')]);router[_0xfcfe('0x7')]('/campaigns',auth[_0xfcfe('0x9')](),controller['campaigns']);router['get'](_0xfcfe('0x29'),auth[_0xfcfe('0x9')](),controller['faxAccounts']);router[_0xfcfe('0x7')](_0xfcfe('0x2a'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x2b')]);router[_0xfcfe('0x7')]('/mail/queues/waitinginteractions',auth[_0xfcfe('0x9')](),controller['mailQueuesWaitingInteractions']);router[_0xfcfe('0x7')](_0xfcfe('0x2c'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x2d')]);router[_0xfcfe('0x7')](_0xfcfe('0x2e'),auth['isAuthenticated'](),controller[_0xfcfe('0x2f')]);router[_0xfcfe('0x7')](_0xfcfe('0x30'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x31')]);router[_0xfcfe('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x32')]);router[_0xfcfe('0x7')](_0xfcfe('0x33'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x34')]);router[_0xfcfe('0x35')](_0xfcfe('0x36'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x37')](_0xfcfe('0x38')));router[_0xfcfe('0x7')]('/mail/queues/:id',auth[_0xfcfe('0x9')](),controller['showMailQueues']);router[_0xfcfe('0x35')](_0xfcfe('0x39'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x37')](_0xfcfe('0x3a')));router[_0xfcfe('0x7')](_0xfcfe('0x3b'),auth[_0xfcfe('0x9')](),controller['showChatQueues']);router[_0xfcfe('0x35')](_0xfcfe('0x3c'),auth[_0xfcfe('0x9')](),controller['queueNotify'](_0xfcfe('0x3d')));router[_0xfcfe('0x7')](_0xfcfe('0x3e'),auth['isAuthenticated'](),controller[_0xfcfe('0x3f')]);router[_0xfcfe('0x35')]('/openchannel/queues/:id/notify',auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x37')](_0xfcfe('0x40')));router[_0xfcfe('0x7')](_0xfcfe('0x41'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x42')]);router['post'](_0xfcfe('0x43'),auth[_0xfcfe('0x9')](),controller['queueNotify'](_0xfcfe('0x44')));router[_0xfcfe('0x35')](_0xfcfe('0x45'),auth['isAuthenticated'](),controller[_0xfcfe('0x37')](_0xfcfe('0x46')));router[_0xfcfe('0x7')]('/sms/queues/:id',auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x47')]);router[_0xfcfe('0x7')](_0xfcfe('0x48'),auth['isAuthenticated'](),controller[_0xfcfe('0x49')]);router[_0xfcfe('0x35')](_0xfcfe('0x4a'),auth[_0xfcfe('0x9')](),controller[_0xfcfe('0x4b')]);module[_0xfcfe('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index d65709d..6114192 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 _0xe753=['FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','queueNotify','chat','Website','Queue','\x20Queue\x20not\x20found','findOne','Interaction','Account','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','Agent\x20not\x20found','Message','messageId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','message','result','catch','status','json','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','VoiceQueuesPreview','merge','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','length','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','telephones','trunks','Trunks','campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xe753,0x12a));var _0x3e75=function(_0x56d0b2,_0x2f7c9e){_0x56d0b2=_0x56d0b2-0x0;var _0x37e421=_0xe753[_0x56d0b2];return _0x37e421;};'use strict';var BPromise=require(_0x3e75('0x0'));var moment=require(_0x3e75('0x1'));var _=require(_0x3e75('0x2'));var util=require(_0x3e75('0x3'));var db=require(_0x3e75('0x4'))['db'];var logger=require(_0x3e75('0x5'))(_0x3e75('0x6'));var jayson=require(_0x3e75('0x7'));var amiClient=jayson['client'][_0x3e75('0x8')]({'port':0x232a});var mailClient=jayson[_0x3e75('0x9')][_0x3e75('0x8')]({'port':0x232b});var routingClient=jayson[_0x3e75('0x9')]['http']({'port':0x232c});function respondWithRpcPromise(_0x49f821,_0x2e56e4,_0x2da234){return new BPromise(function(_0x37b165,_0x17e222){var _0x48883f=_0x2da234?_0x2da234:amiClient;return _0x48883f[_0x3e75('0xa')](_0x49f821,_0x2e56e4)[_0x3e75('0xb')](function(_0x19b3f0){if(_0x19b3f0[_0x3e75('0xc')]){if(_0x19b3f0['error']['code']===0x1f4){return _0x17e222(_0x19b3f0[_0x3e75('0xc')][_0x3e75('0xd')]);}return _0x37b165(_0x19b3f0[_0x3e75('0xc')]['message']);}else{_0x37b165(_0x19b3f0[_0x3e75('0xe')]);}})[_0x3e75('0xf')](function(_0x9a44ec){_0x17e222(_0x9a44ec);});});}function respondWithResult(_0x3f1d3a,_0x26e121){_0x26e121=_0x26e121||0xc8;return function(_0x31a8db){if(_0x31a8db){return _0x3f1d3a[_0x3e75('0x10')](_0x26e121)[_0x3e75('0x11')](_0x31a8db);}return _0x3f1d3a['sendStatus'](0x194);};}function handleError(_0x3d2325,_0x1f24ad){_0x1f24ad=_0x1f24ad||0x1f4;return function(_0x191ed3){logger['error'](_0x191ed3[_0x3e75('0x12')]);if(_0x191ed3[_0x3e75('0x13')]){delete _0x191ed3['name'];}_0x3d2325[_0x3e75('0x10')](_0x1f24ad)[_0x3e75('0x14')](_0x191ed3);};}function findById(_0xbb65a6){return function(_0x2ff841){if(!_[_0x3e75('0x15')](_0xbb65a6)&&!_[_0x3e75('0x15')](_0x2ff841)&&!_[_0x3e75('0x15')](_0x2ff841[_0x3e75('0x16')])){return _[_0x3e75('0x17')](_0x2ff841['rows'],function(_0x581853){return _0x581853['id']==_0xbb65a6;});}return null;};}exports[_0x3e75('0x18')]=function(_0x3e436c,_0xee5e38){return respondWithRpcPromise(_0x3e75('0x19'),_0x3e436c[_0x3e75('0x1a')])[_0x3e75('0xb')](respondWithResult(_0xee5e38,null))[_0x3e75('0xf')](handleError(_0xee5e38,null));};exports[_0x3e75('0x1b')]=function(_0xabb832,_0x160fe3){return respondWithRpcPromise(_0x3e75('0x1c'),_['merge'](_0xabb832[_0x3e75('0x1a')],_0xabb832[_0x3e75('0x1d')]))[_0x3e75('0xb')](respondWithResult(_0x160fe3,null))[_0x3e75('0xf')](handleError(_0x160fe3,null));};exports[_0x3e75('0x1e')]=function(_0x46ac98,_0x5554e0){return respondWithRpcPromise(_0x3e75('0x1f'),_['merge'](_0x46ac98[_0x3e75('0x1a')],_0x46ac98['params']))[_0x3e75('0xb')](respondWithResult(_0x5554e0,null))[_0x3e75('0xf')](handleError(_0x5554e0,null));};exports[_0x3e75('0x20')]=function(_0x2cf8e6,_0xc5deb5){return respondWithRpcPromise('VoiceQueues',_0x2cf8e6[_0x3e75('0x1a')])[_0x3e75('0xb')](respondWithResult(_0xc5deb5,null))[_0x3e75('0xf')](handleError(_0xc5deb5,null));};exports['showVoiceQueues']=function(_0x32b17f,_0x2b3b32){return respondWithRpcPromise(_0x3e75('0x21'),_0x32b17f[_0x3e75('0x1a')])[_0x3e75('0xb')](findById(_0x32b17f['params']['id']))[_0x3e75('0xb')](respondWithResult(_0x2b3b32,null))['catch'](handleError(_0x2b3b32,null));};exports['voiceQueuesPreview']=function(_0x2f66a8,_0x56ed68){return respondWithRpcPromise(_0x3e75('0x22'),_[_0x3e75('0x23')](_0x2f66a8[_0x3e75('0x1a')],_0x2f66a8[_0x3e75('0x1d')]))[_0x3e75('0xb')](respondWithResult(_0x56ed68,null))[_0x3e75('0xf')](handleError(_0x56ed68,null));};exports[_0x3e75('0x24')]=function(_0xeee0a1,_0x135825){return respondWithRpcPromise(_0x3e75('0x25'),_0xeee0a1['query'])['then'](respondWithResult(_0x135825,null))[_0x3e75('0xf')](handleError(_0x135825,null));};exports['voiceQueuesChannel']=function(_0x57c1db,_0x3c7014){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x3e75('0x23')](_0x57c1db[_0x3e75('0x1a')],_0x57c1db['params']))[_0x3e75('0xb')](respondWithResult(_0x3c7014,null))[_0x3e75('0xf')](handleError(_0x3c7014,null));};exports[_0x3e75('0x26')]=function(_0x220565,_0x3440b4){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x3e75('0x23')](_0x220565[_0x3e75('0x1a')],_0x220565[_0x3e75('0x1d')]))['then'](respondWithResult(_0x3440b4,null))[_0x3e75('0xf')](handleError(_0x3440b4,null));};exports[_0x3e75('0x27')]=function(_0x4a6839,_0x363414){return respondWithRpcPromise(_0x3e75('0x28'),_['merge'](_0x4a6839[_0x3e75('0x1a')],_0x4a6839[_0x3e75('0x1d')]))[_0x3e75('0xb')](respondWithResult(_0x363414,null))['catch'](handleError(_0x363414,null));};exports['outbound']=function(_0x4099fe,_0x32a7a9){return respondWithRpcPromise(_0x3e75('0x29'),_0x4099fe['query'])[_0x3e75('0xb')](respondWithResult(_0x32a7a9,null))[_0x3e75('0xf')](handleError(_0x32a7a9,null));};exports[_0x3e75('0x2a')]=function(_0x20d408,_0x1717be){return respondWithRpcPromise('OutboundChannels',_0x20d408[_0x3e75('0x1a')])[_0x3e75('0xb')](respondWithResult(_0x1717be,null))[_0x3e75('0xf')](handleError(_0x1717be,null));};exports[_0x3e75('0x2b')]=function(_0x37fc98,_0x59139b){var _0x2b450e;return respondWithRpcPromise('Agents',_0x37fc98[_0x3e75('0x1a')])[_0x3e75('0xb')](function(_0x474167){_0x2b450e=_0x474167;return respondWithRpcPromise(_0x3e75('0x2c'),_0x37fc98['query'],routingClient);})[_0x3e75('0xb')](function(_0x118ba5){return _['merge']({},_0x118ba5,_0x2b450e);})[_0x3e75('0xb')](respondWithResult(_0x59139b,null))[_0x3e75('0xf')](handleError(_0x59139b,null));};exports[_0x3e75('0x2d')]=function(_0x3d6f07,_0x548e98){if(_0x3d6f07[_0x3e75('0x2e')]&&_0x3d6f07[_0x3e75('0x2e')][_0x3e75('0x2f')]&&_0x3d6f07[_0x3e75('0x30')]&&_0x3d6f07[_0x3e75('0x30')]['name']){for(var _0x4ec925 in _0x3d6f07[_0x3e75('0x2e')][_0x3e75('0x2f')]){if(_0x3d6f07[_0x3e75('0x2e')][_0x3e75('0x2f')][_0x3e75('0x31')](_0x4ec925)){db[_0x3e75('0x32')]['findAll']({'where':{'channel':_0x4ec925,'membername':_0x3d6f07['user']['name'],'type':_0x3e75('0x33'),'exitAt':null,'uniqueid':_0x3d6f07['body'][_0x3e75('0x2f')][_0x4ec925]&&_0x3d6f07[_0x3e75('0x2e')][_0x3e75('0x2f')][_0x4ec925]['length']?{'$notIn':_0x3d6f07[_0x3e75('0x2e')]['interaction'][_0x4ec925]}:{'$ne':null}}})[_0x3e75('0xb')](function(_0x476313){var _0x444edc=moment()[_0x3e75('0x34')](_0x3e75('0x35'));for(var _0xfa4c9b=0x0,_0x8abdad=_0x476313['length'];_0xfa4c9b<_0x8abdad;_0xfa4c9b+=0x1){_0x476313[_0xfa4c9b][_0x3e75('0x36')]({'exitAt':_0x444edc});}});for(var _0x158872=0x0;_0x158872<_0x3d6f07[_0x3e75('0x2e')][_0x3e75('0x2f')][_0x4ec925][_0x3e75('0x37')];_0x158872+=0x1){db[_0x3e75('0x32')][_0x3e75('0x38')]({'where':{'channel':_0x4ec925,'membername':_0x3d6f07[_0x3e75('0x30')][_0x3e75('0x13')],'type':_0x3e75('0x33'),'uniqueid':_0x3d6f07[_0x3e75('0x2e')]['interaction'][_0x4ec925][_0x158872],'exitAt':null},'defaults':{'channel':_0x4ec925,'membername':_0x3d6f07[_0x3e75('0x30')][_0x3e75('0x13')],'interface':_[_0x3e75('0x15')](_0x3d6f07[_0x3e75('0x30')][_0x3e75('0x39')])?util[_0x3e75('0x34')](_0x3e75('0x3a'),_0x3d6f07[_0x3e75('0x30')]['name']):_0x3d6f07['user'][_0x3e75('0x39')],'type':_0x3e75('0x33'),'enterAt':moment()[_0x3e75('0x34')](_0x3e75('0x35')),'role':_0x3e75('0x3b'),'internal':_0x3d6f07['user'][_0x3e75('0x3c')],'uniqueid':_0x3d6f07['body']['interaction'][_0x4ec925][_0x158872]}});}}}}return respondWithRpcPromise(_0x3e75('0x3d'),{'id':_0x3d6f07[_0x3e75('0x1d')]['id'],'capacity':_0x3d6f07['body']['capacity']},routingClient)[_0x3e75('0xb')](respondWithResult(_0x548e98,null))['catch'](handleError(_0x548e98,null));};exports[_0x3e75('0x3e')]=function(_0x5114d8,_0x19071a){return respondWithRpcPromise('Telephones',_0x5114d8[_0x3e75('0x1a')])[_0x3e75('0xb')](respondWithResult(_0x19071a,null))[_0x3e75('0xf')](handleError(_0x19071a,null));};exports[_0x3e75('0x3f')]=function(_0x4a78b7,_0x190f5b){return respondWithRpcPromise(_0x3e75('0x40'),_0x4a78b7['query'])['then'](respondWithResult(_0x190f5b,null))[_0x3e75('0xf')](handleError(_0x190f5b,null));};exports[_0x3e75('0x41')]=function(_0x1da639,_0x4f3e11){return respondWithRpcPromise('Campaigns',_0x1da639['query'])[_0x3e75('0xb')](respondWithResult(_0x4f3e11,null))[_0x3e75('0xf')](handleError(_0x4f3e11,null));};exports[_0x3e75('0x42')]=function(_0x2568ec,_0x1f13de){return respondWithRpcPromise('ChatQueues',_0x2568ec['query'],routingClient)[_0x3e75('0xb')](respondWithResult(_0x1f13de,null))[_0x3e75('0xf')](handleError(_0x1f13de,null));};exports[_0x3e75('0x43')]=function(_0x29d41c,_0x39faa1){return respondWithRpcPromise(_0x3e75('0x44'),_0x29d41c[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](findById(_0x29d41c['params']['id']))[_0x3e75('0xb')](respondWithResult(_0x39faa1,null))[_0x3e75('0xf')](handleError(_0x39faa1,null));};exports[_0x3e75('0x45')]=function(_0x501a79,_0x73b7ab){return respondWithRpcPromise('MailQueues',_0x501a79[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](respondWithResult(_0x73b7ab,null))[_0x3e75('0xf')](handleError(_0x73b7ab,null));};exports[_0x3e75('0x46')]=function(_0x1affac,_0x2d30ed){return respondWithRpcPromise(_0x3e75('0x47'),_0x1affac[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](findById(_0x1affac['params']['id']))[_0x3e75('0xb')](respondWithResult(_0x2d30ed,null))[_0x3e75('0xf')](handleError(_0x2d30ed,null));};exports[_0x3e75('0x48')]=function(_0x4fc5b6,_0x2c4474){return respondWithRpcPromise(_0x3e75('0x49'),_0x4fc5b6[_0x3e75('0x1a')],mailClient)[_0x3e75('0xb')](respondWithResult(_0x2c4474,null))[_0x3e75('0xf')](handleError(_0x2c4474,null));};exports[_0x3e75('0x4a')]=function(_0x882b92,_0x357a48){return respondWithRpcPromise(_0x3e75('0x4b'),_0x882b92[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](respondWithResult(_0x357a48,null))['catch'](handleError(_0x357a48,null));};exports[_0x3e75('0x4c')]=function(_0x4093eb,_0x10238c){return respondWithRpcPromise(_0x3e75('0x4b'),_0x4093eb[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](findById(_0x4093eb[_0x3e75('0x1d')]['id']))[_0x3e75('0xb')](respondWithResult(_0x10238c,null))[_0x3e75('0xf')](handleError(_0x10238c,null));};exports[_0x3e75('0x4d')]=function(_0x1ed4cc,_0x499d5b){return respondWithRpcPromise(_0x3e75('0x4e'),_0x1ed4cc[_0x3e75('0x1a')],routingClient)['then'](respondWithResult(_0x499d5b,null))[_0x3e75('0xf')](handleError(_0x499d5b,null));};exports[_0x3e75('0x4f')]=function(_0x4795bd,_0x59a5c4){return respondWithRpcPromise(_0x3e75('0x4e'),_0x4795bd[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](findById(_0x4795bd[_0x3e75('0x1d')]['id']))['then'](respondWithResult(_0x59a5c4,null))[_0x3e75('0xf')](handleError(_0x59a5c4,null));};exports[_0x3e75('0x50')]=function(_0x3a581b,_0x123254){return respondWithRpcPromise('WhatsappQueues',_0x3a581b['query'],routingClient)[_0x3e75('0xb')](respondWithResult(_0x123254,null))[_0x3e75('0xf')](handleError(_0x123254,null));};exports[_0x3e75('0x51')]=function(_0x358226,_0x405cfb){return respondWithRpcPromise(_0x3e75('0x52'),_0x358226[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](findById(_0x358226[_0x3e75('0x1d')]['id']))[_0x3e75('0xb')](respondWithResult(_0x405cfb,null))['catch'](handleError(_0x405cfb,null));};exports['faxQueues']=function(_0xdc7c9a,_0x55f092){return respondWithRpcPromise(_0x3e75('0x53'),_0xdc7c9a[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](respondWithResult(_0x55f092,null))['catch'](handleError(_0x55f092,null));};exports['showFaxQueues']=function(_0x21d260,_0x2c623e){return respondWithRpcPromise('FaxQueues',_0x21d260[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](findById(_0x21d260[_0x3e75('0x1d')]['id']))['then'](respondWithResult(_0x2c623e,null))[_0x3e75('0xf')](handleError(_0x2c623e,null));};exports[_0x3e75('0x54')]=function(_0x2665a1,_0x54191d){return respondWithRpcPromise(_0x3e75('0x55'),_0x2665a1[_0x3e75('0x1a')])[_0x3e75('0xb')](respondWithResult(_0x54191d,null))[_0x3e75('0xf')](handleError(_0x54191d,null));};exports[_0x3e75('0x56')]=function(_0x3ccb82,_0x3aa7b2){return respondWithRpcPromise(_0x3e75('0x57'),_0x3ccb82['query'],routingClient)['then'](respondWithResult(_0x3aa7b2,null))['catch'](handleError(_0x3aa7b2,null));};exports[_0x3e75('0x58')]=function(_0x4f67db,_0x54e0f9){return respondWithRpcPromise(_0x3e75('0x59'),_0x4f67db['query'],routingClient)['then'](respondWithResult(_0x54e0f9,null))[_0x3e75('0xf')](handleError(_0x54e0f9,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x488dba,_0x2b666a){return respondWithRpcPromise(_0x3e75('0x5a'),_0x488dba[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](respondWithResult(_0x2b666a,null))[_0x3e75('0xf')](handleError(_0x2b666a,null));};exports[_0x3e75('0x5b')]=function(_0x445b14,_0x4defe0){return respondWithRpcPromise(_0x3e75('0x5a'),_0x445b14['query'],routingClient)[_0x3e75('0xb')](function(_0x4a8e87){if(_0x445b14[_0x3e75('0x1a')][_0x3e75('0x5c')]!==undefined){var _0x2c66dc=_(_0x4a8e87[_0x3e75('0x16')])[_0x3e75('0x5d')]([_0x445b14[_0x3e75('0x1a')][_0x3e75('0x5c')],_0x445b14[_0x3e75('0x1d')]['id']])[_0x3e75('0x5e')](_0x3e75('0x5f'))[_0x3e75('0x60')]()[_0x3e75('0x61')]();return _0x4a8e87[_0x3e75('0x16')]['filter'](function(_0x4cad03){return _0x2c66dc['indexOf'](_0x4cad03[_0x3e75('0x5f')])>-0x1;});}else{return _0x4a8e87[_0x3e75('0x16')][_0x3e75('0x5d')](function(_0x37b796){return _0x37b796[_0x3e75('0x5f')]===parseInt(_0x445b14['params']['id']);});}})[_0x3e75('0xb')](respondWithResult(_0x4defe0,null))[_0x3e75('0xf')](handleError(_0x4defe0,null));};exports[_0x3e75('0x62')]=function(_0x4ea833,_0x95d20e){return respondWithRpcPromise(_0x3e75('0x63'),_0x4ea833[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](respondWithResult(_0x95d20e,null))[_0x3e75('0xf')](handleError(_0x95d20e,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2b89a9,_0x57e35f){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2b89a9[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](respondWithResult(_0x57e35f,null))[_0x3e75('0xf')](handleError(_0x57e35f,null));};exports['faxQueuesWaitingInteractions']=function(_0x5a1832,_0x10b9e7){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x5a1832['query'],routingClient)[_0x3e75('0xb')](respondWithResult(_0x10b9e7,null))[_0x3e75('0xf')](handleError(_0x10b9e7,null));};exports[_0x3e75('0x64')]=function(_0x2ea591){return function(_0x41b99e,_0x210a05){var _0x5c2585,_0x57521d;var _0x41f9a0=_['capitalize'](_0x2ea591);var _0x19d5df=_0x2ea591===_0x3e75('0x65')?_0x3e75('0x66'):'Account';return db[_0x41f9a0+_0x3e75('0x67')]['findOne']({'raw':!![],'where':{'id':_0x41b99e[_0x3e75('0x1d')]['id']}})[_0x3e75('0xb')](function(_0x5f2755){if(_[_0x3e75('0x15')](_0x5f2755)){throw new Error(_0x41f9a0+_0x3e75('0x68'));}_0x5c2585=_0x5f2755;return db[_0x41f9a0+'Message'][_0x3e75('0x69')]({'where':{'id':_0x41b99e[_0x3e75('0x2e')]['messageId']},'include':[{'model':db[_0x41f9a0+_0x3e75('0x6a')],'as':_0x3e75('0x6a')},{'model':db[_0x41f9a0+_0x19d5df],'as':_0x3e75('0x6b')}]});})[_0x3e75('0xb')](function(_0xd952d6){if(_['isNil'](_0xd952d6)){throw new Error(_0x41f9a0+_0x3e75('0x6c'));}_0x57521d=_0xd952d6;return _0xd952d6['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x3e75('0xb')](function(){var _0x8c98b0={'uniqueid':_0x2ea591+'.'+_0x57521d['id']+'.'+_0x57521d[_0x3e75('0x6a')]['id'],'FromUserId':_0x41b99e[_0x3e75('0x30')]['id'],'type':_0x3e75('0x6d')};_0x8c98b0[_0x41f9a0+_0x3e75('0x6e')]=_0x57521d['id'];_0x8c98b0[_0x41f9a0+_0x3e75('0x6f')]=_0x57521d[_0x3e75('0x6a')]['id'];_0x8c98b0[_0x3e75('0x70')+_0x41f9a0+_0x19d5df+'Id']=_0x57521d['Account']['id'];_0x8c98b0['To'+_0x41f9a0+_0x3e75('0x71')]=_0x5c2585['id'];return db[_0x41f9a0+_0x3e75('0x72')][_0x3e75('0x73')](_0x8c98b0);})[_0x3e75('0xb')](function(){return respondWithRpcPromise(_0x3e75('0x74'),{'channel':_0x2ea591,'interaction':_0x57521d['Interaction'],'message':_0x57521d,'account':_0x57521d[_0x3e75('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x3e75('0x6d'),'appdata':_0x5c2585['name']+','+(_0x57521d[_0x3e75('0x6b')][_0x3e75('0x75')]||0x12c),'interval':_0x3e75('0x76')}]},routingClient);})['then'](respondWithResult(_0x210a05,null))[_0x3e75('0xf')](handleError(_0x210a05,null));};};exports[_0x3e75('0x77')]=function(_0x1d4b63,_0x5ca06b){var _0x42ca3b,_0xc1c757;if(_[_0x3e75('0x15')](_0x1d4b63[_0x3e75('0x2e')][_0x3e75('0x78')])){throw new Error(_0x3e75('0x79'));}var _0x1a7780=_0x1d4b63[_0x3e75('0x2e')]['channel'];var _0x1825f1=_[_0x3e75('0x7a')](_0x1a7780);var _0x424188=_0x1a7780===_0x3e75('0x65')?'Website':'Account';return db['User']['findOne']({'raw':!![],'where':{'id':_0x1d4b63[_0x3e75('0x1d')]['id'],'role':_0x3e75('0x3b')}})[_0x3e75('0xb')](function(_0x5a5ae1){if(_[_0x3e75('0x15')](_0x5a5ae1)){throw new Error(_0x3e75('0x7b'));}_0x42ca3b=_0x5a5ae1;return db[_0x1825f1+_0x3e75('0x7c')][_0x3e75('0x69')]({'where':{'id':_0x1d4b63[_0x3e75('0x2e')][_0x3e75('0x7d')]},'include':[{'model':db[_0x1825f1+_0x3e75('0x6a')],'as':_0x3e75('0x6a')},{'model':db[_0x1825f1+_0x424188],'as':_0x3e75('0x6b')}]});})[_0x3e75('0xb')](function(_0x13850c){if(_[_0x3e75('0x15')](_0x13850c)){throw new Error(_0x1825f1+_0x3e75('0x6c'));}_0xc1c757=_0x13850c;return _0x13850c['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x3e75('0xb')](function(){var _0x1b6333={'uniqueid':_0x1a7780+'.'+_0xc1c757['id']+'.'+_0xc1c757[_0x3e75('0x6a')]['id'],'FromUserId':_0x1d4b63[_0x3e75('0x30')]['id'],'type':_0x3e75('0x6d'),'ToUserId':_0x42ca3b['id']};_0x1b6333[_0x1825f1+_0x3e75('0x6e')]=_0xc1c757['id'];_0x1b6333[_0x1825f1+'InteractionId']=_0xc1c757['Interaction']['id'];_0x1b6333['From'+_0x1825f1+_0x424188+'Id']=_0xc1c757[_0x3e75('0x6b')]['id'];return db[_0x1825f1+'TransferReport'][_0x3e75('0x73')](_0x1b6333);})[_0x3e75('0xb')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a7780,'interaction':_0xc1c757[_0x3e75('0x6a')],'message':_0xc1c757,'account':_0xc1c757[_0x3e75('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x3e75('0x3b'),'appdata':_0x42ca3b['name']+','+(_0xc1c757['Account'][_0x3e75('0x7e')]||0x12c),'interval':_0x3e75('0x76')}]},routingClient);})[_0x3e75('0xb')](respondWithResult(_0x5ca06b,null))[_0x3e75('0xf')](handleError(_0x5ca06b,null));}; \ No newline at end of file +var _0xe61d=['result','catch','status','json','sendStatus','stack','name','isNil','rows','find','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','length','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','Telephones','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','capitalize','chat','Website','Account','findOne','messageId','Interaction','update','queue','MessageId','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','\x20Message\x20not\x20found','InteractionId','From','bluebird','lodash','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','code','message'];(function(_0x218a36,_0x175868){var _0x109161=function(_0x494798){while(--_0x494798){_0x218a36['push'](_0x218a36['shift']());}};_0x109161(++_0x175868);}(_0xe61d,0x6d));var _0xde61=function(_0x3be8b7,_0x56e022){_0x3be8b7=_0x3be8b7-0x0;var _0x13f8ad=_0xe61d[_0x3be8b7];return _0x13f8ad;};'use strict';var BPromise=require(_0xde61('0x0'));var moment=require('moment');var _=require(_0xde61('0x1'));var util=require('util');var db=require(_0xde61('0x2'))['db'];var logger=require(_0xde61('0x3'))('api');var jayson=require(_0xde61('0x4'));var amiClient=jayson[_0xde61('0x5')][_0xde61('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0xde61('0x6')]({'port':0x232b});var routingClient=jayson[_0xde61('0x5')][_0xde61('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x48852c,_0x3224fd,_0x3a811d){return new BPromise(function(_0x1ec264,_0x925b98){var _0x56ee6a=_0x3a811d?_0x3a811d:amiClient;return _0x56ee6a[_0xde61('0x7')](_0x48852c,_0x3224fd)[_0xde61('0x8')](function(_0x58b299){if(_0x58b299[_0xde61('0x9')]){if(_0x58b299[_0xde61('0x9')][_0xde61('0xa')]===0x1f4){return _0x925b98(_0x58b299[_0xde61('0x9')][_0xde61('0xb')]);}return _0x1ec264(_0x58b299[_0xde61('0x9')]['message']);}else{_0x1ec264(_0x58b299[_0xde61('0xc')]);}})[_0xde61('0xd')](function(_0x3818c6){_0x925b98(_0x3818c6);});});}function respondWithResult(_0x542b47,_0x3baa09){_0x3baa09=_0x3baa09||0xc8;return function(_0x2cf630){if(_0x2cf630){return _0x542b47[_0xde61('0xe')](_0x3baa09)[_0xde61('0xf')](_0x2cf630);}return _0x542b47[_0xde61('0x10')](0x194);};}function handleError(_0x6750d4,_0x27d524){_0x27d524=_0x27d524||0x1f4;return function(_0x28ddb5){logger[_0xde61('0x9')](_0x28ddb5[_0xde61('0x11')]);if(_0x28ddb5[_0xde61('0x12')]){delete _0x28ddb5['name'];}_0x6750d4[_0xde61('0xe')](_0x27d524)['send'](_0x28ddb5);};}function findById(_0x446bf3){return function(_0x441541){if(!_[_0xde61('0x13')](_0x446bf3)&&!_[_0xde61('0x13')](_0x441541)&&!_[_0xde61('0x13')](_0x441541[_0xde61('0x14')])){return _[_0xde61('0x15')](_0x441541[_0xde61('0x14')],function(_0x2a4b57){return _0x2a4b57['id']==_0x446bf3;});}return null;};}exports['voiceChannels']=function(_0x1331e9,_0x15abce){return respondWithRpcPromise(_0xde61('0x16'),_0x1331e9[_0xde61('0x17')])['then'](respondWithResult(_0x15abce,null))[_0xde61('0xd')](handleError(_0x15abce,null));};exports[_0xde61('0x18')]=function(_0x42c157,_0x456c50){return respondWithRpcPromise(_0xde61('0x19'),_[_0xde61('0x1a')](_0x42c157[_0xde61('0x17')],_0x42c157[_0xde61('0x1b')]))[_0xde61('0x8')](respondWithResult(_0x456c50,null))[_0xde61('0xd')](handleError(_0x456c50,null));};exports[_0xde61('0x1c')]=function(_0x41169a,_0x32eb60){return respondWithRpcPromise(_0xde61('0x1d'),_[_0xde61('0x1a')](_0x41169a[_0xde61('0x17')],_0x41169a['params']))[_0xde61('0x8')](respondWithResult(_0x32eb60,null))[_0xde61('0xd')](handleError(_0x32eb60,null));};exports[_0xde61('0x1e')]=function(_0x85efd2,_0x5c6a3f){return respondWithRpcPromise(_0xde61('0x1f'),_0x85efd2[_0xde61('0x17')])[_0xde61('0x8')](respondWithResult(_0x5c6a3f,null))[_0xde61('0xd')](handleError(_0x5c6a3f,null));};exports[_0xde61('0x20')]=function(_0x12416c,_0xe57d12){return respondWithRpcPromise(_0xde61('0x1f'),_0x12416c[_0xde61('0x17')])[_0xde61('0x8')](findById(_0x12416c[_0xde61('0x1b')]['id']))['then'](respondWithResult(_0xe57d12,null))[_0xde61('0xd')](handleError(_0xe57d12,null));};exports[_0xde61('0x21')]=function(_0x206e69,_0x540fef){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xde61('0x1a')](_0x206e69['query'],_0x206e69[_0xde61('0x1b')]))[_0xde61('0x8')](respondWithResult(_0x540fef,null))[_0xde61('0xd')](handleError(_0x540fef,null));};exports[_0xde61('0x22')]=function(_0x218468,_0x5a1f61){return respondWithRpcPromise('VoiceQueuesChannels',_0x218468[_0xde61('0x17')])[_0xde61('0x8')](respondWithResult(_0x5a1f61,null))[_0xde61('0xd')](handleError(_0x5a1f61,null));};exports[_0xde61('0x23')]=function(_0x25e23e,_0x4d980f){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xde61('0x1a')](_0x25e23e['query'],_0x25e23e['params']))[_0xde61('0x8')](respondWithResult(_0x4d980f,null))['catch'](handleError(_0x4d980f,null));};exports[_0xde61('0x24')]=function(_0x255c12,_0x3da96d){return respondWithRpcPromise(_0xde61('0x25'),_['merge'](_0x255c12[_0xde61('0x17')],_0x255c12[_0xde61('0x1b')]))[_0xde61('0x8')](respondWithResult(_0x3da96d,null))[_0xde61('0xd')](handleError(_0x3da96d,null));};exports['voiceQueuesChannelRedirect']=function(_0x2aa88f,_0x259cb9){return respondWithRpcPromise(_0xde61('0x26'),_['merge'](_0x2aa88f['query'],_0x2aa88f[_0xde61('0x1b')]))[_0xde61('0x8')](respondWithResult(_0x259cb9,null))['catch'](handleError(_0x259cb9,null));};exports['outbound']=function(_0x14b894,_0x9d8b41){return respondWithRpcPromise(_0xde61('0x27'),_0x14b894[_0xde61('0x17')])[_0xde61('0x8')](respondWithResult(_0x9d8b41,null))[_0xde61('0xd')](handleError(_0x9d8b41,null));};exports[_0xde61('0x28')]=function(_0x565b88,_0x2a2a0b){return respondWithRpcPromise(_0xde61('0x29'),_0x565b88[_0xde61('0x17')])[_0xde61('0x8')](respondWithResult(_0x2a2a0b,null))[_0xde61('0xd')](handleError(_0x2a2a0b,null));};exports[_0xde61('0x2a')]=function(_0x472f2d,_0xe0b205){var _0x4a4ecf;return respondWithRpcPromise(_0xde61('0x2b'),_0x472f2d[_0xde61('0x17')])[_0xde61('0x8')](function(_0x597a8f){_0x4a4ecf=_0x597a8f;return respondWithRpcPromise('Agents',_0x472f2d['query'],routingClient);})[_0xde61('0x8')](function(_0x56157b){return _[_0xde61('0x1a')]({},_0x56157b,_0x4a4ecf);})[_0xde61('0x8')](respondWithResult(_0xe0b205,null))[_0xde61('0xd')](handleError(_0xe0b205,null));};exports[_0xde61('0x2c')]=function(_0x284a4e,_0x180411){if(_0x284a4e[_0xde61('0x2d')]&&_0x284a4e[_0xde61('0x2d')][_0xde61('0x2e')]&&_0x284a4e[_0xde61('0x2f')]&&_0x284a4e[_0xde61('0x2f')][_0xde61('0x12')]){for(var _0x387b91 in _0x284a4e['body'][_0xde61('0x2e')]){if(_0x284a4e['body'][_0xde61('0x2e')]['hasOwnProperty'](_0x387b91)){db[_0xde61('0x30')][_0xde61('0x31')]({'where':{'channel':_0x387b91,'membername':_0x284a4e[_0xde61('0x2f')][_0xde61('0x12')],'type':_0xde61('0x32'),'exitAt':null,'uniqueid':_0x284a4e[_0xde61('0x2d')][_0xde61('0x2e')][_0x387b91]&&_0x284a4e[_0xde61('0x2d')][_0xde61('0x2e')][_0x387b91]['length']?{'$notIn':_0x284a4e[_0xde61('0x2d')][_0xde61('0x2e')][_0x387b91]}:{'$ne':null}}})[_0xde61('0x8')](function(_0x474547){var _0x48957e=moment()[_0xde61('0x33')](_0xde61('0x34'));for(var _0x536d6d=0x0,_0x22b0d6=_0x474547['length'];_0x536d6d<_0x22b0d6;_0x536d6d+=0x1){_0x474547[_0x536d6d][_0xde61('0x35')]({'exitAt':_0x48957e});}});for(var _0x4e4c9c=0x0;_0x4e4c9c<_0x284a4e[_0xde61('0x2d')][_0xde61('0x2e')][_0x387b91][_0xde61('0x36')];_0x4e4c9c+=0x1){db[_0xde61('0x30')][_0xde61('0x37')]({'where':{'channel':_0x387b91,'membername':_0x284a4e[_0xde61('0x2f')]['name'],'type':_0xde61('0x32'),'uniqueid':_0x284a4e[_0xde61('0x2d')]['interaction'][_0x387b91][_0x4e4c9c],'exitAt':null},'defaults':{'channel':_0x387b91,'membername':_0x284a4e[_0xde61('0x2f')][_0xde61('0x12')],'interface':_[_0xde61('0x13')](_0x284a4e[_0xde61('0x2f')][_0xde61('0x38')])?util['format'](_0xde61('0x39'),_0x284a4e['user'][_0xde61('0x12')]):_0x284a4e[_0xde61('0x2f')][_0xde61('0x38')],'type':_0xde61('0x32'),'enterAt':moment()['format'](_0xde61('0x34')),'role':_0xde61('0x3a'),'internal':_0x284a4e['user'][_0xde61('0x3b')],'uniqueid':_0x284a4e[_0xde61('0x2d')][_0xde61('0x2e')][_0x387b91][_0x4e4c9c]}});}}}}return respondWithRpcPromise(_0xde61('0x3c'),{'id':_0x284a4e[_0xde61('0x1b')]['id'],'capacity':_0x284a4e[_0xde61('0x2d')][_0xde61('0x3d')]},routingClient)[_0xde61('0x8')](respondWithResult(_0x180411,null))['catch'](handleError(_0x180411,null));};exports['telephones']=function(_0x43b320,_0x461006){return respondWithRpcPromise(_0xde61('0x3e'),_0x43b320[_0xde61('0x17')])['then'](respondWithResult(_0x461006,null))[_0xde61('0xd')](handleError(_0x461006,null));};exports['trunks']=function(_0xb9f80e,_0x5bfef0){return respondWithRpcPromise(_0xde61('0x3f'),_0xb9f80e[_0xde61('0x17')])[_0xde61('0x8')](respondWithResult(_0x5bfef0,null))['catch'](handleError(_0x5bfef0,null));};exports[_0xde61('0x40')]=function(_0x26f5bb,_0x2608c2){return respondWithRpcPromise('Campaigns',_0x26f5bb['query'])['then'](respondWithResult(_0x2608c2,null))[_0xde61('0xd')](handleError(_0x2608c2,null));};exports[_0xde61('0x41')]=function(_0x8c4390,_0x375ff8){return respondWithRpcPromise(_0xde61('0x42'),_0x8c4390[_0xde61('0x17')],routingClient)[_0xde61('0x8')](respondWithResult(_0x375ff8,null))[_0xde61('0xd')](handleError(_0x375ff8,null));};exports[_0xde61('0x43')]=function(_0x28456c,_0x48802d){return respondWithRpcPromise(_0xde61('0x42'),_0x28456c[_0xde61('0x17')],routingClient)[_0xde61('0x8')](findById(_0x28456c['params']['id']))[_0xde61('0x8')](respondWithResult(_0x48802d,null))[_0xde61('0xd')](handleError(_0x48802d,null));};exports[_0xde61('0x44')]=function(_0x49f472,_0x39fdf9){return respondWithRpcPromise('MailQueues',_0x49f472['query'],routingClient)['then'](respondWithResult(_0x39fdf9,null))[_0xde61('0xd')](handleError(_0x39fdf9,null));};exports['showMailQueues']=function(_0x2208c0,_0x32dc1a){return respondWithRpcPromise(_0xde61('0x45'),_0x2208c0[_0xde61('0x17')],routingClient)[_0xde61('0x8')](findById(_0x2208c0[_0xde61('0x1b')]['id']))[_0xde61('0x8')](respondWithResult(_0x32dc1a,null))['catch'](handleError(_0x32dc1a,null));};exports['mailAccounts']=function(_0x554172,_0x43b31e){return respondWithRpcPromise(_0xde61('0x46'),_0x554172[_0xde61('0x17')],mailClient)[_0xde61('0x8')](respondWithResult(_0x43b31e,null))[_0xde61('0xd')](handleError(_0x43b31e,null));};exports['openchannelQueues']=function(_0x45f5d0,_0x113f29){return respondWithRpcPromise(_0xde61('0x47'),_0x45f5d0['query'],routingClient)[_0xde61('0x8')](respondWithResult(_0x113f29,null))['catch'](handleError(_0x113f29,null));};exports[_0xde61('0x48')]=function(_0xbcd275,_0x1f5e20){return respondWithRpcPromise(_0xde61('0x47'),_0xbcd275[_0xde61('0x17')],routingClient)[_0xde61('0x8')](findById(_0xbcd275[_0xde61('0x1b')]['id']))[_0xde61('0x8')](respondWithResult(_0x1f5e20,null))[_0xde61('0xd')](handleError(_0x1f5e20,null));};exports[_0xde61('0x49')]=function(_0x54b893,_0x54aabe){return respondWithRpcPromise('SmsQueues',_0x54b893['query'],routingClient)[_0xde61('0x8')](respondWithResult(_0x54aabe,null))[_0xde61('0xd')](handleError(_0x54aabe,null));};exports[_0xde61('0x4a')]=function(_0x171a67,_0x23f409){return respondWithRpcPromise(_0xde61('0x4b'),_0x171a67['query'],routingClient)[_0xde61('0x8')](findById(_0x171a67['params']['id']))[_0xde61('0x8')](respondWithResult(_0x23f409,null))[_0xde61('0xd')](handleError(_0x23f409,null));};exports['whatsappQueues']=function(_0x4088fe,_0x1899e1){return respondWithRpcPromise(_0xde61('0x4c'),_0x4088fe[_0xde61('0x17')],routingClient)['then'](respondWithResult(_0x1899e1,null))[_0xde61('0xd')](handleError(_0x1899e1,null));};exports[_0xde61('0x4d')]=function(_0x10148b,_0x4c6730){return respondWithRpcPromise('WhatsappQueues',_0x10148b[_0xde61('0x17')],routingClient)[_0xde61('0x8')](findById(_0x10148b['params']['id']))[_0xde61('0x8')](respondWithResult(_0x4c6730,null))[_0xde61('0xd')](handleError(_0x4c6730,null));};exports[_0xde61('0x4e')]=function(_0x3e85a0,_0x306181){return respondWithRpcPromise(_0xde61('0x4f'),_0x3e85a0['query'],routingClient)['then'](respondWithResult(_0x306181,null))[_0xde61('0xd')](handleError(_0x306181,null));};exports[_0xde61('0x50')]=function(_0x4d7e48,_0x355b08){return respondWithRpcPromise(_0xde61('0x4f'),_0x4d7e48[_0xde61('0x17')],routingClient)['then'](findById(_0x4d7e48['params']['id']))[_0xde61('0x8')](respondWithResult(_0x355b08,null))['catch'](handleError(_0x355b08,null));};exports['faxAccounts']=function(_0x558a51,_0x2c622a){return respondWithRpcPromise(_0xde61('0x51'),_0x558a51[_0xde61('0x17')])['then'](respondWithResult(_0x2c622a,null))[_0xde61('0xd')](handleError(_0x2c622a,null));};exports[_0xde61('0x52')]=function(_0x5032ab,_0x44e736){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5032ab[_0xde61('0x17')],routingClient)[_0xde61('0x8')](respondWithResult(_0x44e736,null))['catch'](handleError(_0x44e736,null));};exports[_0xde61('0x53')]=function(_0x41ff1b,_0x4e5c43){return respondWithRpcPromise(_0xde61('0x54'),_0x41ff1b[_0xde61('0x17')],routingClient)['then'](respondWithResult(_0x4e5c43,null))[_0xde61('0xd')](handleError(_0x4e5c43,null));};exports[_0xde61('0x55')]=function(_0x37ea7e,_0x3da730){return respondWithRpcPromise(_0xde61('0x56'),_0x37ea7e[_0xde61('0x17')],routingClient)['then'](respondWithResult(_0x3da730,null))[_0xde61('0xd')](handleError(_0x3da730,null));};exports[_0xde61('0x57')]=function(_0x2ce5d1,_0x3b4fa8){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2ce5d1[_0xde61('0x17')],routingClient)[_0xde61('0x8')](function(_0x5b801f){if(_0x2ce5d1[_0xde61('0x17')]['type']!==undefined){var _0x1c5966=_(_0x5b801f[_0xde61('0x14')])['filter']([_0x2ce5d1[_0xde61('0x17')][_0xde61('0x58')],_0x2ce5d1[_0xde61('0x1b')]['id']])[_0xde61('0x59')](_0xde61('0x5a'))[_0xde61('0x5b')]()[_0xde61('0x5c')]();return _0x5b801f[_0xde61('0x14')]['filter'](function(_0x4e8b51){return _0x1c5966['indexOf'](_0x4e8b51[_0xde61('0x5a')])>-0x1;});}else{return _0x5b801f['rows']['filter'](function(_0x1f4f45){return _0x1f4f45[_0xde61('0x5a')]===parseInt(_0x2ce5d1['params']['id']);});}})['then'](respondWithResult(_0x3b4fa8,null))[_0xde61('0xd')](handleError(_0x3b4fa8,null));};exports[_0xde61('0x5d')]=function(_0x495f02,_0x4e9721){return respondWithRpcPromise(_0xde61('0x5e'),_0x495f02[_0xde61('0x17')],routingClient)[_0xde61('0x8')](respondWithResult(_0x4e9721,null))[_0xde61('0xd')](handleError(_0x4e9721,null));};exports[_0xde61('0x5f')]=function(_0x39e4f7,_0x52f563){return respondWithRpcPromise(_0xde61('0x60'),_0x39e4f7[_0xde61('0x17')],routingClient)[_0xde61('0x8')](respondWithResult(_0x52f563,null))[_0xde61('0xd')](handleError(_0x52f563,null));};exports[_0xde61('0x61')]=function(_0xc5f43b,_0x2b6d32){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0xc5f43b[_0xde61('0x17')],routingClient)[_0xde61('0x8')](respondWithResult(_0x2b6d32,null))[_0xde61('0xd')](handleError(_0x2b6d32,null));};exports['queueNotify']=function(_0x29a888){return function(_0x1a0fe3,_0x3e0e9b){var _0x3ee60f,_0xed90aa;var _0x4c5af1=_[_0xde61('0x62')](_0x29a888);var _0x19cf65=_0x29a888===_0xde61('0x63')?_0xde61('0x64'):_0xde61('0x65');return db[_0x4c5af1+'Queue'][_0xde61('0x66')]({'raw':!![],'where':{'id':_0x1a0fe3['params']['id']}})[_0xde61('0x8')](function(_0xedd079){if(_[_0xde61('0x13')](_0xedd079)){throw new Error(_0x4c5af1+'\x20Queue\x20not\x20found');}_0x3ee60f=_0xedd079;return db[_0x4c5af1+'Message'][_0xde61('0x66')]({'where':{'id':_0x1a0fe3[_0xde61('0x2d')][_0xde61('0x67')]},'include':[{'model':db[_0x4c5af1+'Interaction'],'as':_0xde61('0x68')},{'model':db[_0x4c5af1+_0x19cf65],'as':_0xde61('0x65')}]});})[_0xde61('0x8')](function(_0x5d2c79){if(_[_0xde61('0x13')](_0x5d2c79)){throw new Error(_0x4c5af1+'\x20Message\x20not\x20found');}_0xed90aa=_0x5d2c79;return _0x5d2c79[_0xde61('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3371f8={'uniqueid':_0x29a888+'.'+_0xed90aa['id']+'.'+_0xed90aa[_0xde61('0x68')]['id'],'FromUserId':_0x1a0fe3['user']['id'],'type':_0xde61('0x6a')};_0x3371f8[_0x4c5af1+_0xde61('0x6b')]=_0xed90aa['id'];_0x3371f8[_0x4c5af1+'InteractionId']=_0xed90aa['Interaction']['id'];_0x3371f8['From'+_0x4c5af1+_0x19cf65+'Id']=_0xed90aa[_0xde61('0x65')]['id'];_0x3371f8['To'+_0x4c5af1+_0xde61('0x6c')]=_0x3ee60f['id'];return db[_0x4c5af1+_0xde61('0x6d')][_0xde61('0x6e')](_0x3371f8);})[_0xde61('0x8')](function(){return respondWithRpcPromise(_0xde61('0x6f'),{'channel':_0x29a888,'interaction':_0xed90aa['Interaction'],'message':_0xed90aa,'account':_0xed90aa['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xde61('0x6a'),'appdata':_0x3ee60f[_0xde61('0x12')]+','+(_0xed90aa[_0xde61('0x65')][_0xde61('0x70')]||0x12c),'interval':_0xde61('0x71')}]},routingClient);})['then'](respondWithResult(_0x3e0e9b,null))['catch'](handleError(_0x3e0e9b,null));};};exports[_0xde61('0x72')]=function(_0xa77a74,_0x122635){var _0x154e62,_0x403aa1;if(_[_0xde61('0x13')](_0xa77a74[_0xde61('0x2d')][_0xde61('0x73')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x549614=_0xa77a74[_0xde61('0x2d')][_0xde61('0x73')];var _0x1db3f2=_[_0xde61('0x62')](_0x549614);var _0x2150ac=_0x549614===_0xde61('0x63')?_0xde61('0x64'):_0xde61('0x65');return db[_0xde61('0x74')]['findOne']({'raw':!![],'where':{'id':_0xa77a74[_0xde61('0x1b')]['id'],'role':_0xde61('0x3a')}})['then'](function(_0x50d34c){if(_[_0xde61('0x13')](_0x50d34c)){throw new Error(_0xde61('0x75'));}_0x154e62=_0x50d34c;return db[_0x1db3f2+'Message'][_0xde61('0x66')]({'where':{'id':_0xa77a74['body']['messageId']},'include':[{'model':db[_0x1db3f2+_0xde61('0x68')],'as':_0xde61('0x68')},{'model':db[_0x1db3f2+_0x2150ac],'as':'Account'}]});})[_0xde61('0x8')](function(_0x1f1fff){if(_[_0xde61('0x13')](_0x1f1fff)){throw new Error(_0x1db3f2+_0xde61('0x76'));}_0x403aa1=_0x1f1fff;return _0x1f1fff[_0xde61('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2862b8={'uniqueid':_0x549614+'.'+_0x403aa1['id']+'.'+_0x403aa1[_0xde61('0x68')]['id'],'FromUserId':_0xa77a74[_0xde61('0x2f')]['id'],'type':_0xde61('0x6a'),'ToUserId':_0x154e62['id']};_0x2862b8[_0x1db3f2+_0xde61('0x6b')]=_0x403aa1['id'];_0x2862b8[_0x1db3f2+_0xde61('0x77')]=_0x403aa1[_0xde61('0x68')]['id'];_0x2862b8[_0xde61('0x78')+_0x1db3f2+_0x2150ac+'Id']=_0x403aa1['Account']['id'];return db[_0x1db3f2+_0xde61('0x6d')][_0xde61('0x6e')](_0x2862b8);})[_0xde61('0x8')](function(){return respondWithRpcPromise(_0xde61('0x6f'),{'channel':_0x549614,'interaction':_0x403aa1[_0xde61('0x68')],'message':_0x403aa1,'account':_0x403aa1[_0xde61('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0xde61('0x3a'),'appdata':_0x154e62['name']+','+(_0x403aa1[_0xde61('0x65')]['agentTransferTimeout']||0x12c),'interval':_0xde61('0x71')}]},routingClient);})[_0xde61('0x8')](respondWithResult(_0x122635,null))['catch'](handleError(_0x122635,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 9c6944b..a80d405 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 _0xb140=['index','get','show','/:id/run','post','create','/:id','update','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x421f42,_0x1c2d04){var _0x59128b=function(_0x333f9a){while(--_0x333f9a){_0x421f42['push'](_0x421f42['shift']());}};_0x59128b(++_0x1c2d04);}(_0xb140,0x1c3));var _0x0b14=function(_0x2c5ce4,_0x1b4766){_0x2c5ce4=_0x2c5ce4-0x0;var _0x4060a3=_0xb140[_0x2c5ce4];return _0x4060a3;};'use strict';var multer=require(_0x0b14('0x0'));var util=require(_0x0b14('0x1'));var path=require(_0x0b14('0x2'));var timeout=require(_0x0b14('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0b14('0x4'));var auth=require(_0x0b14('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0b14('0x6'));var controller=require('./schedule.controller');router['get']('/',auth[_0x0b14('0x7')](),controller[_0x0b14('0x8')]);router[_0x0b14('0x9')]('/:id',auth[_0x0b14('0x7')](),controller[_0x0b14('0xa')]);router[_0x0b14('0x9')](_0x0b14('0xb'),auth[_0x0b14('0x7')](),controller['run']);router[_0x0b14('0xc')]('/',auth[_0x0b14('0x7')](),controller[_0x0b14('0xd')]);router['put'](_0x0b14('0xe'),auth['isAuthenticated'](),controller[_0x0b14('0xf')]);router['delete'](_0x0b14('0xe'),auth[_0x0b14('0x7')](),controller[_0x0b14('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4ac1=['isAuthenticated','index','show','run','post','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get'];(function(_0x2a81f2,_0x113ed9){var _0x59d94a=function(_0x5ec490){while(--_0x5ec490){_0x2a81f2['push'](_0x2a81f2['shift']());}};_0x59d94a(++_0x113ed9);}(_0x4ac1,0x197));var _0x14ac=function(_0x21bef6,_0x4fe670){_0x21bef6=_0x21bef6-0x0;var _0x174478=_0x4ac1[_0x21bef6];return _0x174478;};'use strict';var multer=require(_0x14ac('0x0'));var util=require(_0x14ac('0x1'));var path=require(_0x14ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x14ac('0x3'));var router=express[_0x14ac('0x4')]();var fs_extra=require(_0x14ac('0x5'));var auth=require(_0x14ac('0x6'));var interaction=require(_0x14ac('0x7'));var config=require(_0x14ac('0x8'));var controller=require(_0x14ac('0x9'));router[_0x14ac('0xa')]('/',auth[_0x14ac('0xb')](),controller[_0x14ac('0xc')]);router[_0x14ac('0xa')]('/:id',auth[_0x14ac('0xb')](),controller[_0x14ac('0xd')]);router[_0x14ac('0xa')]('/:id/run',auth['isAuthenticated'](),controller[_0x14ac('0xe')]);router[_0x14ac('0xf')]('/',auth[_0x14ac('0xb')](),controller[_0x14ac('0x10')]);router[_0x14ac('0x11')](_0x14ac('0x12'),auth[_0x14ac('0xb')](),controller[_0x14ac('0x13')]);router[_0x14ac('0x14')](_0x14ac('0x12'),auth[_0x14ac('0xb')](),controller[_0x14ac('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index ced1ca5..ccd4a7a 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 _0x102b=['DATE','INTEGER','ENUM','quarters','months','weeks','days','hours','pdf','custom','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*'];(function(_0x3588de,_0x15b64a){var _0x2b4386=function(_0x38ba7d){while(--_0x38ba7d){_0x3588de['push'](_0x3588de['shift']());}};_0x2b4386(++_0x15b64a);}(_0x102b,0x1be));var _0xb102=function(_0x1f7b1a,_0x4320ee){_0x1f7b1a=_0x1f7b1a-0x0;var _0x4269c0=_0x102b[_0x1f7b1a];return _0x4269c0;};'use strict';var Sequelize=require('sequelize');module[_0xb102('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb102('0x1')]},'active':{'type':Sequelize[_0xb102('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb102('0x1')],'allowNull':![],'defaultValue':_0xb102('0x3')},'startAt':{'type':Sequelize[_0xb102('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb102('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb102('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb102('0x6')]('years',_0xb102('0x7'),_0xb102('0x8'),_0xb102('0x9'),_0xb102('0xa'),_0xb102('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xb102('0xa')},'output':{'type':Sequelize['ENUM']('csv',_0xb102('0xc'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xb102('0x6')](_0xb102('0xd'),'default'),'allowNull':![],'defaultValue':_0xb102('0xd')},'sendMail':{'type':Sequelize[_0xb102('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xb102('0x1')]},'cc':{'type':Sequelize[_0xb102('0xe')]},'bcc':{'type':Sequelize[_0xb102('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xb102('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1261=['csv','xlsx','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','months','weeks','hours','minutes','days'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0x1261,0x144));var _0x1126=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x1261[_0x310504];return _0x5b36d0;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'name':{'type':Sequelize[_0x1126('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1126('0x1')]},'active':{'type':Sequelize[_0x1126('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x1126('0x1')],'allowNull':![],'defaultValue':_0x1126('0x3')},'startAt':{'type':Sequelize[_0x1126('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x1126('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x1126('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x1126('0x6')]('years','quarters',_0x1126('0x7'),_0x1126('0x8'),'days',_0x1126('0x9'),_0x1126('0xa')),'allowNull':![],'defaultValue':_0x1126('0xb')},'output':{'type':Sequelize[_0x1126('0x6')](_0x1126('0xc'),'pdf',_0x1126('0xd')),'allowNull':![],'defaultValue':_0x1126('0xc')},'type':{'type':Sequelize[_0x1126('0x6')]('custom',_0x1126('0xe')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x1126('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x1126('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x1126('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 1895b4d..bf5ba3c 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 _0x4f3e=['stack','name','send','map','Schedule','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4f3e,0xce));var _0xe4f3=function(_0x1ee1aa,_0x4bb6a3){_0x1ee1aa=_0x1ee1aa-0x0;var _0x661aa8=_0x4f3e[_0x1ee1aa];return _0x661aa8;};'use strict';var pdf=require(_0xe4f3('0x0'));var emlformat=require(_0xe4f3('0x1'));var rimraf=require(_0xe4f3('0x2'));var zipdir=require(_0xe4f3('0x3'));var jsonpatch=require(_0xe4f3('0x4'));var rp=require(_0xe4f3('0x5'));var moment=require('moment');var BPromise=require(_0xe4f3('0x6'));var Mustache=require('mustache');var util=require(_0xe4f3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe4f3('0x8'));var ejs=require(_0xe4f3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4f3('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe4f3('0xb'));var deskjs=require(_0xe4f3('0xc'));var toCsv=require(_0xe4f3('0x8'));var querystring=require(_0xe4f3('0xd'));var Papa=require(_0xe4f3('0xe'));var Redis=require('ioredis');var authService=require(_0xe4f3('0xf'));var qs=require(_0xe4f3('0x10'));var as=require(_0xe4f3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4f3('0x12'))(_0xe4f3('0x13'));var utils=require('../../config/utils');var config=require(_0xe4f3('0x14'));var licenseUtil=require(_0xe4f3('0x15'));var db=require(_0xe4f3('0x16'))['db'];function respondWithStatusCode(_0x35de1e,_0x3493ae){_0x3493ae=_0x3493ae||0xcc;return function(_0x17fbd1){if(_0x17fbd1){return _0x35de1e['sendStatus'](_0x3493ae);}return _0x35de1e[_0xe4f3('0x17')](_0x3493ae)[_0xe4f3('0x18')]();};}function respondWithResult(_0x40d35f,_0xb39dae){_0xb39dae=_0xb39dae||0xc8;return function(_0x4e7ec1){if(_0x4e7ec1){return _0x40d35f[_0xe4f3('0x17')](_0xb39dae)[_0xe4f3('0x19')](_0x4e7ec1);}};}function respondWithFilteredResult(_0x158fc5,_0x5a3e83){return function(_0x2933d1){if(_0x2933d1){var _0x26cbe2=_0x2933d1[_0xe4f3('0x1a')],_0x69fdea=_0x5a3e83[_0xe4f3('0x1b')],_0x3b72a6=_0x5a3e83[_0xe4f3('0x1b')]+_0x5a3e83[_0xe4f3('0x1c')],_0x814ba5;if(_0x3b72a6>=_0x26cbe2){_0x3b72a6=_0x26cbe2;_0x814ba5=0xc8;}else{_0x814ba5=0xce;}_0x158fc5['status'](_0x814ba5);return _0x158fc5[_0xe4f3('0x1d')]('Content-Range',_0x69fdea+'-'+_0x3b72a6+'/'+_0x26cbe2)[_0xe4f3('0x19')](_0x2933d1);}return null;};}function patchUpdates(_0x37608f){return function(_0x296139){try{jsonpatch[_0xe4f3('0x1e')](_0x296139,_0x37608f,!![]);}catch(_0x4aa0c0){return BPromise['reject'](_0x4aa0c0);}return _0x296139[_0xe4f3('0x1f')]();};}function saveUpdates(_0x3f6226,_0x1cd6ab){return function(_0x279abb){if(_0x279abb){return _0x279abb[_0xe4f3('0x20')](_0x3f6226)[_0xe4f3('0x21')](function(_0x9fd41c){return _0x9fd41c;});}return null;};}function removeEntity(_0x398a39,_0x3b68d3){return function(_0x14e1bf){if(_0x14e1bf){return _0x14e1bf[_0xe4f3('0x22')]()['then'](function(){var _0x28a036=_0x14e1bf[_0xe4f3('0x23')]({'plain':!![]});var _0x1f72d5=_0xe4f3('0x24');return db[_0xe4f3('0x25')]['destroy']({'where':{'type':_0x1f72d5,'resourceId':_0x28a036['id']}})[_0xe4f3('0x21')](function(){return _0x14e1bf;});})[_0xe4f3('0x21')](function(){_0x398a39[_0xe4f3('0x17')](0xcc)[_0xe4f3('0x18')]();});}};}function handleEntityNotFound(_0x3847e9,_0x3a7a67){return function(_0x21e63e){if(!_0x21e63e){_0x3847e9[_0xe4f3('0x26')](0x194);}return _0x21e63e;};}function handleError(_0x2f3922,_0x55747d){_0x55747d=_0x55747d||0x1f4;return function(_0x38bde1){logger[_0xe4f3('0x27')](_0x38bde1[_0xe4f3('0x28')]);if(_0x38bde1[_0xe4f3('0x29')]){delete _0x38bde1['name'];}_0x2f3922['status'](_0x55747d)[_0xe4f3('0x2a')](_0x38bde1);};}exports['index']=function(_0x30b90c,_0x27efc8){var _0x1268ce={},_0x485bfe={},_0x4ae8c6={'count':0x0,'rows':[]};var _0x5abb2a=_[_0xe4f3('0x2b')](db[_0xe4f3('0x2c')][_0xe4f3('0x2d')],function(_0x596d2a){return{'name':_0x596d2a['fieldName'],'type':_0x596d2a[_0xe4f3('0x2e')][_0xe4f3('0x2f')]};});_0x485bfe[_0xe4f3('0x30')]=_[_0xe4f3('0x2b')](_0x5abb2a,_0xe4f3('0x29'));_0x485bfe[_0xe4f3('0x31')]=_[_0xe4f3('0x32')](_0x30b90c['query']);_0x485bfe[_0xe4f3('0x33')]=_['intersection'](_0x485bfe[_0xe4f3('0x30')],_0x485bfe['query']);_0x1268ce[_0xe4f3('0x34')]=_[_0xe4f3('0x35')](_0x485bfe[_0xe4f3('0x30')],qs[_0xe4f3('0x36')](_0x30b90c[_0xe4f3('0x31')][_0xe4f3('0x36')]));_0x1268ce['attributes']=_0x1268ce[_0xe4f3('0x34')][_0xe4f3('0x37')]?_0x1268ce[_0xe4f3('0x34')]:_0x485bfe[_0xe4f3('0x30')];if(!_0x30b90c['query'][_0xe4f3('0x38')](_0xe4f3('0x39'))){_0x1268ce[_0xe4f3('0x1c')]=qs[_0xe4f3('0x1c')](_0x30b90c[_0xe4f3('0x31')][_0xe4f3('0x1c')]);_0x1268ce[_0xe4f3('0x1b')]=qs[_0xe4f3('0x1b')](_0x30b90c[_0xe4f3('0x31')][_0xe4f3('0x1b')]);}_0x1268ce[_0xe4f3('0x3a')]=qs[_0xe4f3('0x3b')](_0x30b90c[_0xe4f3('0x31')][_0xe4f3('0x3b')]);_0x1268ce[_0xe4f3('0x3c')]=qs['filters'](_[_0xe4f3('0x3d')](_0x30b90c[_0xe4f3('0x31')],_0x485bfe['filters']),_0x5abb2a);if(_0x30b90c[_0xe4f3('0x31')][_0xe4f3('0x3e')]){_0x1268ce[_0xe4f3('0x3c')]=_['merge'](_0x1268ce[_0xe4f3('0x3c')],{'$or':_['map'](_0x5abb2a,function(_0x28b881){if(_0x28b881[_0xe4f3('0x2e')]!=='VIRTUAL'){var _0x5e8ac0={};_0x5e8ac0[_0x28b881['name']]={'$like':'%'+_0x30b90c['query'][_0xe4f3('0x3e')]+'%'};return _0x5e8ac0;}})});}_0x1268ce=_[_0xe4f3('0x3f')]({},_0x1268ce,_0x30b90c[_0xe4f3('0x40')]);var _0xd52b58={'where':_0x1268ce[_0xe4f3('0x3c')]};return db[_0xe4f3('0x2c')][_0xe4f3('0x1a')](_0xd52b58)[_0xe4f3('0x21')](function(_0x594b15){_0x4ae8c6[_0xe4f3('0x1a')]=_0x594b15;if(_0x30b90c['query'][_0xe4f3('0x41')]){_0x1268ce[_0xe4f3('0x42')]=[{'all':!![]}];}return db['Schedule'][_0xe4f3('0x43')](_0x1268ce);})['then'](function(_0x4e4544){_0x4ae8c6[_0xe4f3('0x44')]=_0x4e4544;return _0x4ae8c6;})[_0xe4f3('0x21')](respondWithFilteredResult(_0x27efc8,_0x1268ce))[_0xe4f3('0x45')](handleError(_0x27efc8,null));};exports[_0xe4f3('0x46')]=function(_0x11e64a,_0x2ffd6b){var _0x146644={'raw':![],'where':{'id':_0x11e64a[_0xe4f3('0x47')]['id']}},_0x1ba433={};_0x1ba433['model']=_[_0xe4f3('0x32')](db['Schedule'][_0xe4f3('0x2d')]);_0x1ba433[_0xe4f3('0x31')]=_[_0xe4f3('0x32')](_0x11e64a['query']);_0x1ba433[_0xe4f3('0x33')]=_['intersection'](_0x1ba433[_0xe4f3('0x30')],_0x1ba433['query']);_0x146644[_0xe4f3('0x34')]=_[_0xe4f3('0x35')](_0x1ba433['model'],qs[_0xe4f3('0x36')](_0x11e64a['query'][_0xe4f3('0x36')]));_0x146644[_0xe4f3('0x34')]=_0x146644[_0xe4f3('0x34')][_0xe4f3('0x37')]?_0x146644[_0xe4f3('0x34')]:_0x1ba433[_0xe4f3('0x30')];if(_0x11e64a[_0xe4f3('0x31')][_0xe4f3('0x41')]){_0x146644[_0xe4f3('0x42')]=[{'all':!![]}];}_0x146644=_[_0xe4f3('0x3f')]({},_0x146644,_0x11e64a[_0xe4f3('0x40')]);return db[_0xe4f3('0x2c')][_0xe4f3('0x48')](_0x146644)[_0xe4f3('0x21')](handleEntityNotFound(_0x2ffd6b,null))['then'](respondWithResult(_0x2ffd6b,null))['catch'](handleError(_0x2ffd6b,null));};exports[_0xe4f3('0x49')]=function(_0x109227,_0x5cfe7a){return db[_0xe4f3('0x2c')][_0xe4f3('0x49')](_0x109227[_0xe4f3('0x4a')],{})[_0xe4f3('0x21')](function(_0x164b9f){var _0x301c92=_0x109227[_0xe4f3('0x4b')][_0xe4f3('0x23')]({'plain':!![]});if(!_0x301c92)throw new Error(_0xe4f3('0x4c'));if(_0x301c92[_0xe4f3('0x4d')]===_0xe4f3('0x4b')){var _0x1f6145=_0x164b9f[_0xe4f3('0x23')]({'plain':!![]});var _0x1bbd2a=_0xe4f3('0x24');return db['UserProfileSection'][_0xe4f3('0x48')]({'where':{'name':_0x1bbd2a,'userProfileId':_0x301c92[_0xe4f3('0x4e')]},'raw':!![]})[_0xe4f3('0x21')](function(_0x15789e){if(_0x15789e&&_0x15789e['autoAssociation']===0x0){return db[_0xe4f3('0x25')][_0xe4f3('0x49')]({'name':_0x1f6145[_0xe4f3('0x29')],'resourceId':_0x1f6145['id'],'type':_0x15789e['name'],'sectionId':_0x15789e['id']},{})[_0xe4f3('0x21')](function(){return _0x164b9f;});}else{return _0x164b9f;}})['catch'](function(_0xb5d2fe){logger[_0xe4f3('0x27')](_0xe4f3('0x4f'),_0xb5d2fe);throw _0xb5d2fe;});}return _0x164b9f;})[_0xe4f3('0x21')](respondWithResult(_0x5cfe7a,0xc9))['catch'](handleError(_0x5cfe7a,null));};exports['update']=function(_0x5e34ef,_0xe6333e){if(_0x5e34ef[_0xe4f3('0x4a')]['id']){delete _0x5e34ef['body']['id'];}return db[_0xe4f3('0x2c')]['find']({'where':{'id':_0x5e34ef['params']['id']}})['then'](handleEntityNotFound(_0xe6333e,null))['then'](saveUpdates(_0x5e34ef['body'],null))['then'](respondWithResult(_0xe6333e,null))[_0xe4f3('0x45')](handleError(_0xe6333e,null));};exports[_0xe4f3('0x22')]=function(_0x315968,_0xdcc940){return db[_0xe4f3('0x2c')][_0xe4f3('0x48')]({'where':{'id':_0x315968['params']['id']}})[_0xe4f3('0x21')](handleEntityNotFound(_0xdcc940,null))[_0xe4f3('0x21')](removeEntity(_0xdcc940,null))[_0xe4f3('0x45')](handleError(_0xdcc940,null));};exports[_0xe4f3('0x50')]=function(_0x3b2ce2,_0x7efcab,_0x2bcdd0){var _0x2e7e49=require(_0xe4f3('0x51'));return db[_0xe4f3('0x2c')]['find']({'where':{'id':_0x3b2ce2[_0xe4f3('0x47')]['id']},'raw':!![]})[_0xe4f3('0x21')](handleEntityNotFound(_0x7efcab,null))['then'](function(){_0x2e7e49['run'](_0x3b2ce2[_0xe4f3('0x47')]['id']);})[_0xe4f3('0x21')](respondWithStatusCode(_0x7efcab,null))['catch'](handleError(_0x7efcab,null));}; \ No newline at end of file +var _0x63c3=['../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','filters','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','Schedule','includeAll','include','findAll','catch','show','params','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','run','../../config/schedule','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3f15de,_0x52351e){var _0x16b2d5=function(_0x47ad73){while(--_0x47ad73){_0x3f15de['push'](_0x3f15de['shift']());}};_0x16b2d5(++_0x52351e);}(_0x63c3,0x19d));var _0x363c=function(_0x5876fc,_0x431a54){_0x5876fc=_0x5876fc-0x0;var _0x279a56=_0x63c3[_0x5876fc];return _0x279a56;};'use strict';var pdf=require(_0x363c('0x0'));var emlformat=require(_0x363c('0x1'));var rimraf=require(_0x363c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x363c('0x3'));var rp=require(_0x363c('0x4'));var moment=require(_0x363c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x363c('0x6'));var path=require(_0x363c('0x7'));var sox=require('sox');var csv=require(_0x363c('0x8'));var ejs=require(_0x363c('0x9'));var fs=require('fs');var fs_extra=require(_0x363c('0xa'));var _=require(_0x363c('0xb'));var squel=require(_0x363c('0xc'));var crypto=require(_0x363c('0xd'));var jsforce=require(_0x363c('0xe'));var deskjs=require(_0x363c('0xf'));var toCsv=require(_0x363c('0x8'));var querystring=require(_0x363c('0x10'));var Papa=require(_0x363c('0x11'));var Redis=require(_0x363c('0x12'));var authService=require(_0x363c('0x13'));var qs=require(_0x363c('0x14'));var as=require(_0x363c('0x15'));var hardwareService=require(_0x363c('0x16'));var logger=require(_0x363c('0x17'))(_0x363c('0x18'));var utils=require(_0x363c('0x19'));var config=require(_0x363c('0x1a'));var licenseUtil=require(_0x363c('0x1b'));var db=require(_0x363c('0x1c'))['db'];function respondWithStatusCode(_0x20679c,_0x25a624){_0x25a624=_0x25a624||0xcc;return function(_0x229b2e){if(_0x229b2e){return _0x20679c['sendStatus'](_0x25a624);}return _0x20679c[_0x363c('0x1d')](_0x25a624)[_0x363c('0x1e')]();};}function respondWithResult(_0x3114f7,_0x30c3aa){_0x30c3aa=_0x30c3aa||0xc8;return function(_0x56d0ad){if(_0x56d0ad){return _0x3114f7[_0x363c('0x1d')](_0x30c3aa)['json'](_0x56d0ad);}};}function respondWithFilteredResult(_0xd98b5,_0x53acf0){return function(_0x18375e){if(_0x18375e){var _0x5e3368=_0x18375e[_0x363c('0x1f')],_0x25e8c7=_0x53acf0[_0x363c('0x20')],_0x5be72f=_0x53acf0[_0x363c('0x20')]+_0x53acf0[_0x363c('0x21')],_0x5b6740;if(_0x5be72f>=_0x5e3368){_0x5be72f=_0x5e3368;_0x5b6740=0xc8;}else{_0x5b6740=0xce;}_0xd98b5[_0x363c('0x1d')](_0x5b6740);return _0xd98b5[_0x363c('0x22')](_0x363c('0x23'),_0x25e8c7+'-'+_0x5be72f+'/'+_0x5e3368)['json'](_0x18375e);}return null;};}function patchUpdates(_0x59b1fb){return function(_0x53f15c){try{jsonpatch[_0x363c('0x24')](_0x53f15c,_0x59b1fb,!![]);}catch(_0x17c51e){return BPromise[_0x363c('0x25')](_0x17c51e);}return _0x53f15c[_0x363c('0x26')]();};}function saveUpdates(_0x58cf2a,_0x4f1dd3){return function(_0xb62671){if(_0xb62671){return _0xb62671[_0x363c('0x27')](_0x58cf2a)[_0x363c('0x28')](function(_0x385820){return _0x385820;});}return null;};}function removeEntity(_0x1abdd2,_0x50f1f0){return function(_0x47894f){if(_0x47894f){return _0x47894f[_0x363c('0x29')]()[_0x363c('0x28')](function(){var _0x269af0=_0x47894f[_0x363c('0x2a')]({'plain':!![]});var _0xd60603=_0x363c('0x2b');return db['UserProfileResource'][_0x363c('0x29')]({'where':{'type':_0xd60603,'resourceId':_0x269af0['id']}})[_0x363c('0x28')](function(){return _0x47894f;});})['then'](function(){_0x1abdd2[_0x363c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x769ee7,_0x2d00fa){return function(_0x3bb394){if(!_0x3bb394){_0x769ee7[_0x363c('0x2c')](0x194);}return _0x3bb394;};}function handleError(_0x30cac9,_0x393447){_0x393447=_0x393447||0x1f4;return function(_0x295844){logger[_0x363c('0x2d')](_0x295844[_0x363c('0x2e')]);if(_0x295844[_0x363c('0x2f')]){delete _0x295844[_0x363c('0x2f')];}_0x30cac9[_0x363c('0x1d')](_0x393447)[_0x363c('0x30')](_0x295844);};}exports[_0x363c('0x31')]=function(_0x3d0988,_0x44c3a0){var _0x3b5316={},_0x579095={},_0x1c8f7c={'count':0x0,'rows':[]};var _0xbf1b46=_['map'](db['Schedule'][_0x363c('0x32')],function(_0x1a6bde){return{'name':_0x1a6bde[_0x363c('0x33')],'type':_0x1a6bde['type'][_0x363c('0x34')]};});_0x579095[_0x363c('0x35')]=_[_0x363c('0x36')](_0xbf1b46,_0x363c('0x2f'));_0x579095['query']=_[_0x363c('0x37')](_0x3d0988['query']);_0x579095[_0x363c('0x38')]=_['intersection'](_0x579095[_0x363c('0x35')],_0x579095[_0x363c('0x39')]);_0x3b5316['attributes']=_['intersection'](_0x579095[_0x363c('0x35')],qs[_0x363c('0x3a')](_0x3d0988['query'][_0x363c('0x3a')]));_0x3b5316[_0x363c('0x3b')]=_0x3b5316[_0x363c('0x3b')][_0x363c('0x3c')]?_0x3b5316['attributes']:_0x579095[_0x363c('0x35')];if(!_0x3d0988[_0x363c('0x39')][_0x363c('0x3d')]('nolimit')){_0x3b5316['limit']=qs[_0x363c('0x21')](_0x3d0988['query'][_0x363c('0x21')]);_0x3b5316['offset']=qs[_0x363c('0x20')](_0x3d0988[_0x363c('0x39')][_0x363c('0x20')]);}_0x3b5316[_0x363c('0x3e')]=qs['sort'](_0x3d0988[_0x363c('0x39')][_0x363c('0x3f')]);_0x3b5316[_0x363c('0x40')]=qs['filters'](_[_0x363c('0x41')](_0x3d0988[_0x363c('0x39')],_0x579095[_0x363c('0x38')]),_0xbf1b46);if(_0x3d0988[_0x363c('0x39')][_0x363c('0x42')]){_0x3b5316[_0x363c('0x40')]=_[_0x363c('0x43')](_0x3b5316[_0x363c('0x40')],{'$or':_['map'](_0xbf1b46,function(_0x13cc4c){if(_0x13cc4c['type']!=='VIRTUAL'){var _0x1910f5={};_0x1910f5[_0x13cc4c[_0x363c('0x2f')]]={'$like':'%'+_0x3d0988[_0x363c('0x39')][_0x363c('0x42')]+'%'};return _0x1910f5;}})});}_0x3b5316=_[_0x363c('0x43')]({},_0x3b5316,_0x3d0988[_0x363c('0x44')]);var _0xaf4776={'where':_0x3b5316[_0x363c('0x40')]};return db[_0x363c('0x45')][_0x363c('0x1f')](_0xaf4776)[_0x363c('0x28')](function(_0x113700){_0x1c8f7c[_0x363c('0x1f')]=_0x113700;if(_0x3d0988[_0x363c('0x39')][_0x363c('0x46')]){_0x3b5316[_0x363c('0x47')]=[{'all':!![]}];}return db[_0x363c('0x45')][_0x363c('0x48')](_0x3b5316);})[_0x363c('0x28')](function(_0x269d30){_0x1c8f7c['rows']=_0x269d30;return _0x1c8f7c;})[_0x363c('0x28')](respondWithFilteredResult(_0x44c3a0,_0x3b5316))[_0x363c('0x49')](handleError(_0x44c3a0,null));};exports[_0x363c('0x4a')]=function(_0x46407c,_0x1c623d){var _0x5d567c={'raw':![],'where':{'id':_0x46407c[_0x363c('0x4b')]['id']}},_0x147af1={};_0x147af1[_0x363c('0x35')]=_['keys'](db[_0x363c('0x45')][_0x363c('0x32')]);_0x147af1[_0x363c('0x39')]=_[_0x363c('0x37')](_0x46407c[_0x363c('0x39')]);_0x147af1[_0x363c('0x38')]=_[_0x363c('0x4c')](_0x147af1[_0x363c('0x35')],_0x147af1['query']);_0x5d567c['attributes']=_[_0x363c('0x4c')](_0x147af1[_0x363c('0x35')],qs[_0x363c('0x3a')](_0x46407c[_0x363c('0x39')][_0x363c('0x3a')]));_0x5d567c[_0x363c('0x3b')]=_0x5d567c[_0x363c('0x3b')][_0x363c('0x3c')]?_0x5d567c[_0x363c('0x3b')]:_0x147af1[_0x363c('0x35')];if(_0x46407c[_0x363c('0x39')][_0x363c('0x46')]){_0x5d567c['include']=[{'all':!![]}];}_0x5d567c=_['merge']({},_0x5d567c,_0x46407c[_0x363c('0x44')]);return db[_0x363c('0x45')]['find'](_0x5d567c)[_0x363c('0x28')](handleEntityNotFound(_0x1c623d,null))[_0x363c('0x28')](respondWithResult(_0x1c623d,null))[_0x363c('0x49')](handleError(_0x1c623d,null));};exports[_0x363c('0x4d')]=function(_0x12870f,_0x495f64){return db[_0x363c('0x45')][_0x363c('0x4d')](_0x12870f[_0x363c('0x4e')],{})['then'](function(_0x2a3612){var _0x3cf252=_0x12870f[_0x363c('0x4f')][_0x363c('0x2a')]({'plain':!![]});if(!_0x3cf252)throw new Error(_0x363c('0x50'));if(_0x3cf252[_0x363c('0x51')]==='user'){var _0x294438=_0x2a3612[_0x363c('0x2a')]({'plain':!![]});var _0x1b9134=_0x363c('0x2b');return db[_0x363c('0x52')][_0x363c('0x53')]({'where':{'name':_0x1b9134,'userProfileId':_0x3cf252[_0x363c('0x54')]},'raw':!![]})[_0x363c('0x28')](function(_0x568935){if(_0x568935&&_0x568935['autoAssociation']===0x0){return db[_0x363c('0x55')][_0x363c('0x4d')]({'name':_0x294438[_0x363c('0x2f')],'resourceId':_0x294438['id'],'type':_0x568935[_0x363c('0x2f')],'sectionId':_0x568935['id']},{})['then'](function(){return _0x2a3612;});}else{return _0x2a3612;}})['catch'](function(_0x3927c0){logger[_0x363c('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3927c0);throw _0x3927c0;});}return _0x2a3612;})[_0x363c('0x28')](respondWithResult(_0x495f64,0xc9))[_0x363c('0x49')](handleError(_0x495f64,null));};exports[_0x363c('0x27')]=function(_0x5483a1,_0x1461bc){if(_0x5483a1[_0x363c('0x4e')]['id']){delete _0x5483a1['body']['id'];}return db[_0x363c('0x45')][_0x363c('0x53')]({'where':{'id':_0x5483a1[_0x363c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1461bc,null))[_0x363c('0x28')](saveUpdates(_0x5483a1[_0x363c('0x4e')],null))[_0x363c('0x28')](respondWithResult(_0x1461bc,null))[_0x363c('0x49')](handleError(_0x1461bc,null));};exports[_0x363c('0x29')]=function(_0x3b34f1,_0x17cb12){return db[_0x363c('0x45')]['find']({'where':{'id':_0x3b34f1[_0x363c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x17cb12,null))[_0x363c('0x28')](removeEntity(_0x17cb12,null))['catch'](handleError(_0x17cb12,null));};exports[_0x363c('0x56')]=function(_0x5b3272,_0x261fca,_0x52cb39){var _0x1d539a=require(_0x363c('0x57'));return db[_0x363c('0x45')][_0x363c('0x53')]({'where':{'id':_0x5b3272[_0x363c('0x4b')]['id']},'raw':!![]})[_0x363c('0x28')](handleEntityNotFound(_0x261fca,null))[_0x363c('0x28')](function(){_0x1d539a[_0x363c('0x56')](_0x5b3272['params']['id']);})['then'](respondWithStatusCode(_0x261fca,null))['catch'](handleError(_0x261fca,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index db931f9..eb1e12f 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 _0x8d2e=['bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','util','../../config/logger','api'];(function(_0x35d073,_0xb2bde6){var _0x422e50=function(_0x156396){while(--_0x156396){_0x35d073['push'](_0x35d073['shift']());}};_0x422e50(++_0xb2bde6);}(_0x8d2e,0x152));var _0xe8d2=function(_0x569aff,_0x3c2404){_0x569aff=_0x569aff-0x0;var _0x3b86d2=_0x8d2e[_0x569aff];return _0x3b86d2;};'use strict';var _=require('lodash');var util=require(_0xe8d2('0x0'));var logger=require(_0xe8d2('0x1'))(_0xe8d2('0x2'));var moment=require('moment');var BPromise=require(_0xe8d2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8d2('0x4'));var rimraf=require(_0xe8d2('0x5'));var config=require(_0xe8d2('0x6'));var attributes=require(_0xe8d2('0x7'));module[_0xe8d2('0x8')]=function(_0x3fc883,_0x5715f3){return _0x3fc883[_0xe8d2('0x9')](_0xe8d2('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09aa=['api','moment','request-promise','path','../../config/environment','./schedule.attributes','exports','define','Schedule','lodash','util'];(function(_0xad63a4,_0x1d06ee){var _0x427575=function(_0x358190){while(--_0x358190){_0xad63a4['push'](_0xad63a4['shift']());}};_0x427575(++_0x1d06ee);}(_0x09aa,0x11c));var _0xa09a=function(_0x370db8,_0x18155e){_0x370db8=_0x370db8-0x0;var _0x40fa3e=_0x09aa[_0x370db8];return _0x40fa3e;};'use strict';var _=require(_0xa09a('0x0'));var util=require(_0xa09a('0x1'));var logger=require('../../config/logger')(_0xa09a('0x2'));var moment=require(_0xa09a('0x3'));var BPromise=require('bluebird');var rp=require(_0xa09a('0x4'));var fs=require('fs');var path=require(_0xa09a('0x5'));var rimraf=require('rimraf');var config=require(_0xa09a('0x6'));var attributes=require(_0xa09a('0x7'));module[_0xa09a('0x8')]=function(_0x2dfa75,_0x48441a){return _0x2dfa75[_0xa09a('0x9')](_0xa09a('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 943a373..0a4a7d2 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 _0x204a=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x204a,0x100));var _0xa204=function(_0x2c5922,_0x1a484e){_0x2c5922=_0x2c5922-0x0;var _0x426cde=_0x204a[_0x2c5922];return _0x426cde;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa204('0x0'));var BPromise=require(_0xa204('0x1'));var rs=require(_0xa204('0x2'));var fs=require('fs');var Redis=require(_0xa204('0x3'));var db=require(_0xa204('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa204('0x5'));var jayson=require(_0xa204('0x6'));var client=jayson[_0xa204('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bd1aa,_0x3c6412,_0x3657cb){return new BPromise(function(_0x446f5c,_0x419df4){return client['request'](_0x3bd1aa,_0x3657cb)['then'](function(_0x18c861){logger[_0xa204('0x8')](_0xa204('0x9'),_0x3c6412,_0xa204('0xa'));logger['debug'](_0xa204('0xb'),_0x3c6412,_0xa204('0xa'),JSON['stringify'](_0x18c861));if(_0x18c861[_0xa204('0xc')]){if(_0x18c861[_0xa204('0xc')][_0xa204('0xd')]===0x1f4){logger['error'](_0xa204('0x9'),_0x3c6412,_0x18c861[_0xa204('0xc')][_0xa204('0xe')]);return _0x419df4(_0x18c861[_0xa204('0xc')][_0xa204('0xe')]);}logger[_0xa204('0xc')](_0xa204('0x9'),_0x3c6412,_0x18c861['error'][_0xa204('0xe')]);return _0x446f5c(_0x18c861[_0xa204('0xc')][_0xa204('0xe')]);}else{logger[_0xa204('0x8')](_0xa204('0x9'),_0x3c6412,_0xa204('0xa'));_0x446f5c(_0x18c861[_0xa204('0xf')]['message']);}})[_0xa204('0x10')](function(_0x4d8ee5){logger[_0xa204('0xc')](_0xa204('0x9'),_0x3c6412,_0x4d8ee5);_0x419df4(_0x4d8ee5);});});} \ No newline at end of file +var _0x1a07=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x291b50,_0xf93bf2){var _0x3a108e=function(_0x14abfa){while(--_0x14abfa){_0x291b50['push'](_0x291b50['shift']());}};_0x3a108e(++_0xf93bf2);}(_0x1a07,0xc9));var _0x71a0=function(_0x35dcca,_0x14e01d){_0x35dcca=_0x35dcca-0x0;var _0x4d843c=_0x1a07[_0x35dcca];return _0x4d843c;};'use strict';var _=require(_0x71a0('0x0'));var util=require(_0x71a0('0x1'));var moment=require('moment');var BPromise=require(_0x71a0('0x2'));var rs=require(_0x71a0('0x3'));var fs=require('fs');var Redis=require(_0x71a0('0x4'));var db=require(_0x71a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x71a0('0x6'))('rpc');var config=require(_0x71a0('0x7'));var jayson=require(_0x71a0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29540c,_0x4a6c7a,_0x44a1ca){return new BPromise(function(_0x29523a,_0x329c7e){return client[_0x71a0('0x9')](_0x29540c,_0x44a1ca)['then'](function(_0x8426b){logger[_0x71a0('0xa')](_0x71a0('0xb'),_0x4a6c7a,_0x71a0('0xc'));logger['debug'](_0x71a0('0xd'),_0x4a6c7a,_0x71a0('0xc'),JSON[_0x71a0('0xe')](_0x8426b));if(_0x8426b[_0x71a0('0xf')]){if(_0x8426b['error'][_0x71a0('0x10')]===0x1f4){logger['error'](_0x71a0('0xb'),_0x4a6c7a,_0x8426b[_0x71a0('0xf')][_0x71a0('0x11')]);return _0x329c7e(_0x8426b[_0x71a0('0xf')]['message']);}logger['error'](_0x71a0('0xb'),_0x4a6c7a,_0x8426b[_0x71a0('0xf')]['message']);return _0x29523a(_0x8426b[_0x71a0('0xf')][_0x71a0('0x11')]);}else{logger[_0x71a0('0xa')]('Schedule,\x20%s,\x20%s',_0x4a6c7a,_0x71a0('0xc'));_0x29523a(_0x8426b[_0x71a0('0x12')][_0x71a0('0x11')]);}})[_0x71a0('0x13')](function(_0x19325f){logger[_0x71a0('0xf')](_0x71a0('0xb'),_0x4a6c7a,_0x19325f);_0x329c7e(_0x19325f);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index b12447a..fab6c43 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 _0xe08b=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','/describe','/:id','isAuthenticated','show','/:id/download','download','create','put','delete'];(function(_0x2b0252,_0x3114b9){var _0x335ac4=function(_0x23871e){while(--_0x23871e){_0x2b0252['push'](_0x2b0252['shift']());}};_0x335ac4(++_0x3114b9);}(_0xe08b,0x1a6));var _0xbe08=function(_0x10dc60,_0x2fcce1){_0x10dc60=_0x10dc60-0x0;var _0x47dec5=_0xe08b[_0x10dc60];return _0x47dec5;};'use strict';var multer=require(_0xbe08('0x0'));var util=require(_0xbe08('0x1'));var path=require(_0xbe08('0x2'));var timeout=require(_0xbe08('0x3'));var express=require(_0xbe08('0x4'));var router=express['Router']();var fs_extra=require(_0xbe08('0x5'));var auth=require(_0xbe08('0x6'));var interaction=require(_0xbe08('0x7'));var config=require('../../config/environment');var controller=require(_0xbe08('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbe08('0x9')](_0xbe08('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xbe08('0x9')](_0xbe08('0xb'),auth[_0xbe08('0xc')](),controller[_0xbe08('0xd')]);router[_0xbe08('0x9')](_0xbe08('0xe'),auth['isAuthenticated'](),controller[_0xbe08('0xf')]);router['post']('/',auth[_0xbe08('0xc')](),controller[_0xbe08('0x10')]);router[_0xbe08('0x11')](_0xbe08('0xb'),auth[_0xbe08('0xc')](),controller['update']);router[_0xbe08('0x12')](_0xbe08('0xb'),auth[_0xbe08('0xc')](),controller[_0xbe08('0x13')]);module[_0xbe08('0x14')]=router; \ No newline at end of file +var _0x6520=['isAuthenticated','index','/describe','describe','/:id','show','download','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get'];(function(_0x53773b,_0x38a0a9){var _0x228f6f=function(_0x4440a5){while(--_0x4440a5){_0x53773b['push'](_0x53773b['shift']());}};_0x228f6f(++_0x38a0a9);}(_0x6520,0x186));var _0x0652=function(_0x5bc786,_0x39e7bd){_0x5bc786=_0x5bc786-0x0;var _0x473d37=_0x6520[_0x5bc786];return _0x473d37;};'use strict';var multer=require(_0x0652('0x0'));var util=require('util');var path=require(_0x0652('0x1'));var timeout=require(_0x0652('0x2'));var express=require(_0x0652('0x3'));var router=express['Router']();var fs_extra=require(_0x0652('0x4'));var auth=require(_0x0652('0x5'));var interaction=require(_0x0652('0x6'));var config=require('../../config/environment');var controller=require(_0x0652('0x7'));router[_0x0652('0x8')]('/',auth[_0x0652('0x9')](),controller[_0x0652('0xa')]);router[_0x0652('0x8')](_0x0652('0xb'),auth[_0x0652('0x9')](),controller[_0x0652('0xc')]);router['get'](_0x0652('0xd'),auth['isAuthenticated'](),controller[_0x0652('0xe')]);router[_0x0652('0x8')]('/:id/download',auth[_0x0652('0x9')](),controller[_0x0652('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0652('0x10')](_0x0652('0xd'),auth[_0x0652('0x9')](),controller[_0x0652('0x11')]);router[_0x0652('0x12')]('/:id',auth[_0x0652('0x9')](),controller[_0x0652('0x13')]);module[_0x0652('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index cd4a2b4..48594ce 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 _0xb458=['STRING','replace','setDataValue','INTEGER','startedAt','closedAt','format','MM-DD-YYYY\x20HH:mm','DATE','toString','createdAt','updatedAt','sequelize','moment','path','VIRTUAL','getDataValue','value','extname'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xb458,0x103));var _0x8b45=function(_0x44029c,_0x426690){_0x44029c=_0x44029c-0x0;var _0x547fa1=_0xb458[_0x44029c];return _0x547fa1;};'use strict';var Sequelize=require(_0x8b45('0x0'));var moment=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x8b45('0x3')],'get':function(){return this[_0x8b45('0x4')](_0x8b45('0x5'))?path[_0x8b45('0x6')](this['getDataValue'](_0x8b45('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x8b45('0x7')],'set':function(_0x12bd05){var _0x2daa9a=_0x12bd05[_0x8b45('0x8')](/\\/g,'/');this[_0x8b45('0x9')]('value',_0x2daa9a);}},'rating':{'type':Sequelize[_0x8b45('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8b45('0xa')],'set':function(_0x33f30e){this[_0x8b45('0x9')](_0x8b45('0xb'),moment()['subtract'](_0x33f30e,'ms'));this[_0x8b45('0x9')](_0x8b45('0xc'),moment());this['setDataValue']('duration',_0x33f30e);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x8b45('0xb')))[_0x8b45('0xd')](_0x8b45('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0x8b45('0xf')],'get':function(){return moment(this[_0x8b45('0x4')](_0x8b45('0xc')))[_0x8b45('0xd')](_0x8b45('0xe'))[_0x8b45('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x8b45('0x11')))[_0x8b45('0xd')](_0x8b45('0xe'))[_0x8b45('0x10')]();}},'updatedAt':{'type':Sequelize[_0x8b45('0xf')],'get':function(){return moment(this[_0x8b45('0x4')](_0x8b45('0x12')))[_0x8b45('0xd')](_0x8b45('0xe'))[_0x8b45('0x10')]();}}}; \ No newline at end of file +var _0x55ca=['STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','VIRTUAL','getDataValue','extname','value'];(function(_0x3c6112,_0x44e3a4){var _0x56c76d=function(_0x50f017){while(--_0x50f017){_0x3c6112['push'](_0x3c6112['shift']());}};_0x56c76d(++_0x44e3a4);}(_0x55ca,0x126));var _0xa55c=function(_0x39e2d7,_0x1b15f6){_0x39e2d7=_0x39e2d7-0x0;var _0x413d0d=_0x55ca[_0x39e2d7];return _0x413d0d;};'use strict';var Sequelize=require(_0xa55c('0x0'));var moment=require(_0xa55c('0x1'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0xa55c('0x2')],'get':function(){return this[_0xa55c('0x3')]('value')?path[_0xa55c('0x4')](this[_0xa55c('0x3')](_0xa55c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xa55c('0x6')]},'channel':{'type':Sequelize[_0xa55c('0x6')]},'value':{'type':Sequelize[_0xa55c('0x6')],'set':function(_0x36b623){var _0x4d0624=_0x36b623[_0xa55c('0x7')](/\\/g,'/');this[_0xa55c('0x8')]('value',_0x4d0624);}},'rating':{'type':Sequelize[_0xa55c('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa55c('0x9')],'set':function(_0x52a3bc){this['setDataValue'](_0xa55c('0xa'),moment()[_0xa55c('0xb')](_0x52a3bc,'ms'));this[_0xa55c('0x8')](_0xa55c('0xc'),moment());this[_0xa55c('0x8')](_0xa55c('0xd'),_0x52a3bc);}},'startedAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this[_0xa55c('0x3')](_0xa55c('0xa')))[_0xa55c('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this['getDataValue']('closedAt'))['format'](_0xa55c('0x10'))[_0xa55c('0x11')]();}},'createdAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this[_0xa55c('0x3')](_0xa55c('0x12')))[_0xa55c('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xa55c('0x11')]();}},'updatedAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this[_0xa55c('0x3')](_0xa55c('0x13')))[_0xa55c('0xf')](_0xa55c('0x10'))[_0xa55c('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index e6d6dea..b08f6c8 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 _0x70e0=['count','offset','limit','Content-Range','json','apply','then','destroy','end','sendStatus','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','format','keys','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','find','create','body','update','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x14f051,_0x85870b){var _0x3f59ee=function(_0xc8785a){while(--_0xc8785a){_0x14f051['push'](_0x14f051['shift']());}};_0x3f59ee(++_0x85870b);}(_0x70e0,0x17b));var _0x070e=function(_0x3e16d5,_0x17af0e){_0x3e16d5=_0x3e16d5-0x0;var _0x4586e4=_0x70e0[_0x3e16d5];return _0x4586e4;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x070e('0x9'));var crypto=require(_0x070e('0xa'));var jsforce=require(_0x070e('0xb'));var deskjs=require(_0x070e('0xc'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x070e('0xf'));var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x5bf079,_0x2930b8){_0x2930b8=_0x2930b8||0xcc;return function(_0x52da3b){if(_0x52da3b){return _0x5bf079['sendStatus'](_0x2930b8);}return _0x5bf079[_0x070e('0x18')](_0x2930b8)['end']();};}function respondWithResult(_0x4a33d2,_0x5bae0f){_0x5bae0f=_0x5bae0f||0xc8;return function(_0x11d2ce){if(_0x11d2ce){return _0x4a33d2[_0x070e('0x18')](_0x5bae0f)['json'](_0x11d2ce);}};}function respondWithFilteredResult(_0x5d3a38,_0x373d86){return function(_0xeae1a5){if(_0xeae1a5){var _0x180897=_0xeae1a5[_0x070e('0x19')],_0x19d9da=_0x373d86[_0x070e('0x1a')],_0x5bc71e=_0x373d86[_0x070e('0x1a')]+_0x373d86[_0x070e('0x1b')],_0x49861b;if(_0x5bc71e>=_0x180897){_0x5bc71e=_0x180897;_0x49861b=0xc8;}else{_0x49861b=0xce;}_0x5d3a38[_0x070e('0x18')](_0x49861b);return _0x5d3a38['set'](_0x070e('0x1c'),_0x19d9da+'-'+_0x5bc71e+'/'+_0x180897)[_0x070e('0x1d')](_0xeae1a5);}return null;};}function patchUpdates(_0x1ad3de){return function(_0x3ea105){try{jsonpatch[_0x070e('0x1e')](_0x3ea105,_0x1ad3de,!![]);}catch(_0x5c16fd){return BPromise['reject'](_0x5c16fd);}return _0x3ea105['save']();};}function saveUpdates(_0x9907cf,_0x3004f0){return function(_0x20dc60){if(_0x20dc60){return _0x20dc60['update'](_0x9907cf)[_0x070e('0x1f')](function(_0x5dc5d2){return _0x5dc5d2;});}return null;};}function removeEntity(_0xf8dd5d,_0x3f6985){return function(_0x27a01e){if(_0x27a01e){return _0x27a01e[_0x070e('0x20')]()[_0x070e('0x1f')](function(){_0xf8dd5d[_0x070e('0x18')](0xcc)[_0x070e('0x21')]();});}};}function handleEntityNotFound(_0x164cdf,_0x595c7e){return function(_0x2f8055){if(!_0x2f8055){_0x164cdf[_0x070e('0x22')](0x194);}return _0x2f8055;};}function handleError(_0x4790eb,_0x503f4d){_0x503f4d=_0x503f4d||0x1f4;return function(_0xf17c56){logger['error'](_0xf17c56['stack']);if(_0xf17c56[_0x070e('0x23')]){delete _0xf17c56[_0x070e('0x23')];}_0x4790eb[_0x070e('0x18')](_0x503f4d)[_0x070e('0x24')](_0xf17c56);};}exports[_0x070e('0x25')]=function(_0x497f58,_0x374c54){var _0x219e48={},_0x1d72d6={},_0x1d2a34={'count':0x0,'rows':[]};var _0x43dd96=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x5e8326){return{'name':_0x5e8326[_0x070e('0x29')],'type':_0x5e8326[_0x070e('0x2a')][_0x070e('0x2b')]};});_0x1d72d6['model']=_['differenceBy'](_[_0x070e('0x26')](_0x43dd96,_0x070e('0x23')),[_0x070e('0x2c')]);_0x1d72d6['query']=_[_0x070e('0x2d')](_0x497f58[_0x070e('0x2e')]);_0x1d72d6[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x1d72d6['model'],_0x1d72d6['query']);_0x219e48['attributes']=_['intersection'](_0x1d72d6[_0x070e('0x31')],qs['fields'](_0x497f58[_0x070e('0x2e')][_0x070e('0x32')]));_0x219e48['attributes']=_0x219e48['attributes'][_0x070e('0x33')]?_0x219e48[_0x070e('0x34')]:_0x1d72d6['model'];if(!_0x497f58['query'][_0x070e('0x35')](_0x070e('0x36'))){_0x219e48[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x497f58[_0x070e('0x2e')]['limit']);_0x219e48['offset']=qs[_0x070e('0x1a')](_0x497f58[_0x070e('0x2e')][_0x070e('0x1a')]);}_0x219e48[_0x070e('0x37')]=qs[_0x070e('0x38')](_0x497f58['query'][_0x070e('0x38')]);_0x219e48[_0x070e('0x39')]=qs['filters'](_[_0x070e('0x3a')](_0x497f58[_0x070e('0x2e')],_0x1d72d6['filters']),_0x43dd96);if(_0x497f58['query']['filter']){_0x219e48[_0x070e('0x39')]=_[_0x070e('0x3b')](_0x219e48[_0x070e('0x39')],{'$or':_[_0x070e('0x26')](_0x43dd96,function(_0x33c5f8){if(_0x33c5f8['type']!==_0x070e('0x3c')){var _0xa1bb20={};_0xa1bb20[_0x33c5f8[_0x070e('0x23')]]={'$like':'%'+_0x497f58['query'][_0x070e('0x3d')]+'%'};return _0xa1bb20;}})});}_0x219e48=_[_0x070e('0x3b')]({},_0x219e48,_0x497f58[_0x070e('0x3e')]);var _0x54b72f={'where':_0x219e48[_0x070e('0x39')]};return db[_0x070e('0x27')]['count'](_0x54b72f)[_0x070e('0x1f')](function(_0x5d689b){_0x1d2a34[_0x070e('0x19')]=_0x5d689b;if(_0x497f58[_0x070e('0x2e')][_0x070e('0x3f')]){_0x219e48[_0x070e('0x40')]=[{'all':!![]}];}return db[_0x070e('0x27')]['findAll'](_0x219e48);})[_0x070e('0x1f')](function(_0x5db2ce){_0x1d2a34['rows']=_0x5db2ce;return _0x1d2a34;})[_0x070e('0x1f')](respondWithFilteredResult(_0x374c54,_0x219e48))[_0x070e('0x41')](handleError(_0x374c54,null));};exports[_0x070e('0x42')]=function(_0x4d52ff,_0x2ad56c){var _0x1223be={'raw':![],'where':{'id':_0x4d52ff[_0x070e('0x43')]['id']}},_0x556bf3={};_0x556bf3['model']=_[_0x070e('0x2d')](db['ScreenRecording']['rawAttributes']);_0x556bf3['query']=_[_0x070e('0x2d')](_0x4d52ff[_0x070e('0x2e')]);_0x556bf3[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x556bf3[_0x070e('0x31')],_0x556bf3['query']);_0x1223be[_0x070e('0x34')]=_['intersection'](_0x556bf3[_0x070e('0x31')],qs[_0x070e('0x32')](_0x4d52ff[_0x070e('0x2e')]['fields']));_0x1223be['attributes']=_0x1223be[_0x070e('0x34')]['length']?_0x1223be[_0x070e('0x34')]:_0x556bf3[_0x070e('0x31')];if(_0x4d52ff[_0x070e('0x2e')]['includeAll']){_0x1223be[_0x070e('0x40')]=[{'all':!![]}];}_0x1223be=_[_0x070e('0x3b')]({},_0x1223be,_0x4d52ff['options']);return db['ScreenRecording'][_0x070e('0x44')](_0x1223be)[_0x070e('0x1f')](handleEntityNotFound(_0x2ad56c,null))[_0x070e('0x1f')](respondWithResult(_0x2ad56c,null))[_0x070e('0x41')](handleError(_0x2ad56c,null));};exports[_0x070e('0x45')]=function(_0x5500d0,_0x20b80e){return db[_0x070e('0x27')][_0x070e('0x45')](_0x5500d0[_0x070e('0x46')],{})[_0x070e('0x1f')](respondWithResult(_0x20b80e,0xc9))[_0x070e('0x41')](handleError(_0x20b80e,null));};exports[_0x070e('0x47')]=function(_0x1b5374,_0xd67987){if(_0x1b5374[_0x070e('0x46')]['id']){delete _0x1b5374[_0x070e('0x46')]['id'];}delete _0x1b5374[_0x070e('0x46')][_0x070e('0x48')];delete _0x1b5374[_0x070e('0x46')][_0x070e('0x49')];delete _0x1b5374['body'][_0x070e('0x4a')];delete _0x1b5374[_0x070e('0x46')][_0x070e('0x4b')];return db[_0x070e('0x27')][_0x070e('0x44')]({'where':{'id':_0x1b5374[_0x070e('0x43')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0xd67987,null))[_0x070e('0x1f')](saveUpdates(_0x1b5374[_0x070e('0x46')],null))['then'](respondWithResult(_0xd67987,null))[_0x070e('0x41')](handleError(_0xd67987,null));};exports['describe']=function(_0x1acddb,_0x2be643){return db['ScreenRecording'][_0x070e('0x4c')]()[_0x070e('0x1f')](respondWithResult(_0x2be643,null))[_0x070e('0x41')](handleError(_0x2be643,null));};exports[_0x070e('0x4d')]=function(_0x2b8e51,_0x1e8a4f,_0x83f21e){var _0x5694fa=require(_0x070e('0x4e'));var _0x5bacbd=![];var _0x516161={};if(_0x2b8e51[_0x070e('0x2e')][_0x070e('0x2a')]&&_0x2b8e51[_0x070e('0x2e')][_0x070e('0x2a')]===_0x070e('0x4f')){_0x516161[_0x070e('0x4f')]=_0x2b8e51[_0x070e('0x43')]['id'];}else{_0x516161['id']=_0x2b8e51[_0x070e('0x43')]['id'];}return db['ScreenRecording'][_0x070e('0x44')]({'where':_0x516161,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x1e8a4f,null))[_0x070e('0x1f')](function(_0x20acc6){if(_0x20acc6){var _0x589aee=path[_0x070e('0x50')](config[_0x070e('0x51')],_0x070e('0x52'),_0x20acc6[_0x070e('0x4b')]);var _0x1aacfc=util[_0x070e('0x2c')](_0x070e('0x53'),_0x589aee);if(fs['existsSync'](_0x1aacfc)){_0x5bacbd=!![];return _0x5694fa['decryptFile'](_0x1aacfc,_0x589aee,config['secrets'][_0x070e('0x54')])[_0x070e('0x1f')](function(){return _0x20acc6;});}return _0x20acc6;}})[_0x070e('0x1f')](function(_0x2f8fcb){if(_0x2f8fcb){var _0x5ac0b5=path[_0x070e('0x50')](config['root'],_0x070e('0x52'),_0x2f8fcb[_0x070e('0x4b')]);if(!fs[_0x070e('0x55')](_0x5ac0b5)){throw new db[(_0x070e('0x56'))][(_0x070e('0x57'))](_0x070e('0x58'));}if(_0x2f8fcb['filename']){return _0x1e8a4f[_0x070e('0x4d')](_0x5ac0b5,_0x2f8fcb[_0x070e('0x59')]+path[_0x070e('0x5a')](_0x5ac0b5),function(){if(_0x5bacbd){fs['unlink'](_0x5ac0b5);}});}else{return _0x1e8a4f[_0x070e('0x4d')](_0x5ac0b5,function(_0x1da803){if(_0x5bacbd){fs['unlink'](_0x5ac0b5);}});}}})[_0x070e('0x41')](function(_0x4e8dfc){if(_0x4e8dfc[_0x070e('0x5b')]==='ScreenRecording\x20not\x20found'){_0x1e8a4f['status'](0x194)['send'](_0x070e('0x5c'));}else{return handleError(_0x1e8a4f,null);}});};exports[_0x070e('0x20')]=function(_0x1100d8,_0x122198){return db[_0x070e('0x27')][_0x070e('0x44')]({'where':{'id':_0x1100d8['params']['id']}})[_0x070e('0x1f')](function(_0x54d4f9){if(!_0x54d4f9)throw new ReferenceError(_0x070e('0x5d'));return _0x54d4f9;})['then'](function(_0x2e10f7){var _0x34f410=path['join'](config[_0x070e('0x51')],'server/files/screen_recordings',_0x2e10f7[_0x070e('0x4b')]);logger[_0x070e('0x5e')](_0x070e('0x5f'),_0x34f410);if(!_[_0x070e('0x60')](_0x2e10f7[_0x070e('0x4b')])&&fs[_0x070e('0x55')](_0x34f410)){logger[_0x070e('0x5e')](_0x070e('0x61')+_0x34f410+_0x070e('0x62'));fs[_0x070e('0x63')](_0x34f410);}_0x34f410=_0x34f410+_0x070e('0x64');if(!_[_0x070e('0x60')](_0x2e10f7[_0x070e('0x4b')])&&fs[_0x070e('0x55')](_0x34f410)){logger['info'](_0x070e('0x61')+_0x34f410+_0x070e('0x62'));fs[_0x070e('0x63')](_0x34f410);}return _0x2e10f7;})[_0x070e('0x1f')](function(_0x5712d1){if(!_0x5712d1)throw new InternalError();return _0x5712d1[_0x070e('0x20')]();})[_0x070e('0x1f')](function(){_0x122198[_0x070e('0x18')](0xcc)[_0x070e('0x21')]();})[_0x070e('0x41')](handleError(_0x122198,null));}; \ No newline at end of file +var _0x9957=['sort','where','filters','pick','filter','merge','type','VIRTUAL','options','ScreenRecording','includeAll','include','rows','show','params','length','find','catch','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','differenceBy','format','query','keys','intersection','attributes','model','fields','nolimit'];(function(_0x541453,_0x1b51c2){var _0xf12185=function(_0x6a9e16){while(--_0x6a9e16){_0x541453['push'](_0x541453['shift']());}};_0xf12185(++_0x1b51c2);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var fs_extra=require(_0x7995('0xc'));var _=require(_0x7995('0xd'));var squel=require('squel');var crypto=require(_0x7995('0xe'));var jsforce=require(_0x7995('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7995('0xa'));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('../../config/license/hardware');var logger=require(_0x7995('0x16'))(_0x7995('0x17'));var utils=require('../../config/utils');var config=require(_0x7995('0x18'));var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x385f00,_0x281576){_0x281576=_0x281576||0xcc;return function(_0x23999f){if(_0x23999f){return _0x385f00[_0x7995('0x1b')](_0x281576);}return _0x385f00['status'](_0x281576)['end']();};}function respondWithResult(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xc8;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1c')](_0x2233dd)[_0x7995('0x1d')](_0x24b5bb);}};}function respondWithFilteredResult(_0x1a5310,_0x2202ce){return function(_0x41cbf0){if(_0x41cbf0){var _0x5377e5=_0x41cbf0[_0x7995('0x1e')],_0x2eeacc=_0x2202ce[_0x7995('0x1f')],_0x565d97=_0x2202ce[_0x7995('0x1f')]+_0x2202ce[_0x7995('0x20')],_0x2f832e;if(_0x565d97>=_0x5377e5){_0x565d97=_0x5377e5;_0x2f832e=0xc8;}else{_0x2f832e=0xce;}_0x1a5310[_0x7995('0x1c')](_0x2f832e);return _0x1a5310['set']('Content-Range',_0x2eeacc+'-'+_0x565d97+'/'+_0x5377e5)[_0x7995('0x1d')](_0x41cbf0);}return null;};}function patchUpdates(_0x5e6f90){return function(_0x555f74){try{jsonpatch[_0x7995('0x21')](_0x555f74,_0x5e6f90,!![]);}catch(_0x3d463e){return BPromise['reject'](_0x3d463e);}return _0x555f74[_0x7995('0x22')]();};}function saveUpdates(_0x51f276,_0x4b1a8e){return function(_0x3e4c54){if(_0x3e4c54){return _0x3e4c54[_0x7995('0x23')](_0x51f276)[_0x7995('0x24')](function(_0x1a8568){return _0x1a8568;});}return null;};}function removeEntity(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x25')]()[_0x7995('0x24')](function(){_0x460924[_0x7995('0x1c')](0xcc)[_0x7995('0x26')]();});}};}function handleEntityNotFound(_0x563799,_0x13bc35){return function(_0x475351){if(!_0x475351){_0x563799[_0x7995('0x1b')](0x194);}return _0x475351;};}function handleError(_0x59405a,_0x39df42){_0x39df42=_0x39df42||0x1f4;return function(_0x34e70c){logger[_0x7995('0x27')](_0x34e70c[_0x7995('0x28')]);if(_0x34e70c[_0x7995('0x29')]){delete _0x34e70c[_0x7995('0x29')];}_0x59405a['status'](_0x39df42)[_0x7995('0x2a')](_0x34e70c);};}exports['index']=function(_0x229742,_0x49bc7e){var _0xf16cc2={},_0x132a42={},_0x11c1eb={'count':0x0,'rows':[]};var _0x4b6f99=_[_0x7995('0x2b')](db['ScreenRecording'][_0x7995('0x2c')],function(_0x3250e0){return{'name':_0x3250e0[_0x7995('0x2d')],'type':_0x3250e0['type']['key']};});_0x132a42['model']=_[_0x7995('0x2e')](_[_0x7995('0x2b')](_0x4b6f99,_0x7995('0x29')),[_0x7995('0x2f')]);_0x132a42[_0x7995('0x30')]=_[_0x7995('0x31')](_0x229742['query']);_0x132a42['filters']=_[_0x7995('0x32')](_0x132a42['model'],_0x132a42[_0x7995('0x30')]);_0xf16cc2[_0x7995('0x33')]=_[_0x7995('0x32')](_0x132a42[_0x7995('0x34')],qs[_0x7995('0x35')](_0x229742['query'][_0x7995('0x35')]));_0xf16cc2[_0x7995('0x33')]=_0xf16cc2['attributes']['length']?_0xf16cc2['attributes']:_0x132a42[_0x7995('0x34')];if(!_0x229742[_0x7995('0x30')]['hasOwnProperty'](_0x7995('0x36'))){_0xf16cc2['limit']=qs[_0x7995('0x20')](_0x229742[_0x7995('0x30')][_0x7995('0x20')]);_0xf16cc2['offset']=qs['offset'](_0x229742[_0x7995('0x30')]['offset']);}_0xf16cc2['order']=qs[_0x7995('0x37')](_0x229742[_0x7995('0x30')]['sort']);_0xf16cc2[_0x7995('0x38')]=qs[_0x7995('0x39')](_[_0x7995('0x3a')](_0x229742[_0x7995('0x30')],_0x132a42[_0x7995('0x39')]),_0x4b6f99);if(_0x229742['query'][_0x7995('0x3b')]){_0xf16cc2[_0x7995('0x38')]=_[_0x7995('0x3c')](_0xf16cc2[_0x7995('0x38')],{'$or':_['map'](_0x4b6f99,function(_0x2be2c0){if(_0x2be2c0[_0x7995('0x3d')]!==_0x7995('0x3e')){var _0xe5ea43={};_0xe5ea43[_0x2be2c0[_0x7995('0x29')]]={'$like':'%'+_0x229742[_0x7995('0x30')]['filter']+'%'};return _0xe5ea43;}})});}_0xf16cc2=_[_0x7995('0x3c')]({},_0xf16cc2,_0x229742[_0x7995('0x3f')]);var _0x8a1be0={'where':_0xf16cc2[_0x7995('0x38')]};return db[_0x7995('0x40')][_0x7995('0x1e')](_0x8a1be0)[_0x7995('0x24')](function(_0x270c0e){_0x11c1eb[_0x7995('0x1e')]=_0x270c0e;if(_0x229742[_0x7995('0x30')][_0x7995('0x41')]){_0xf16cc2[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0xf16cc2);})['then'](function(_0x334dff){_0x11c1eb[_0x7995('0x43')]=_0x334dff;return _0x11c1eb;})['then'](respondWithFilteredResult(_0x49bc7e,_0xf16cc2))['catch'](handleError(_0x49bc7e,null));};exports[_0x7995('0x44')]=function(_0x4a9fef,_0x504a33){var _0x23da6b={'raw':![],'where':{'id':_0x4a9fef[_0x7995('0x45')]['id']}},_0x36e28b={};_0x36e28b['model']=_[_0x7995('0x31')](db['ScreenRecording'][_0x7995('0x2c')]);_0x36e28b['query']=_['keys'](_0x4a9fef[_0x7995('0x30')]);_0x36e28b[_0x7995('0x39')]=_[_0x7995('0x32')](_0x36e28b[_0x7995('0x34')],_0x36e28b['query']);_0x23da6b[_0x7995('0x33')]=_[_0x7995('0x32')](_0x36e28b[_0x7995('0x34')],qs[_0x7995('0x35')](_0x4a9fef['query']['fields']));_0x23da6b[_0x7995('0x33')]=_0x23da6b['attributes'][_0x7995('0x46')]?_0x23da6b['attributes']:_0x36e28b[_0x7995('0x34')];if(_0x4a9fef['query'][_0x7995('0x41')]){_0x23da6b[_0x7995('0x42')]=[{'all':!![]}];}_0x23da6b=_['merge']({},_0x23da6b,_0x4a9fef[_0x7995('0x3f')]);return db[_0x7995('0x40')][_0x7995('0x47')](_0x23da6b)[_0x7995('0x24')](handleEntityNotFound(_0x504a33,null))['then'](respondWithResult(_0x504a33,null))[_0x7995('0x48')](handleError(_0x504a33,null));};exports[_0x7995('0x49')]=function(_0x237270,_0x491184){return db[_0x7995('0x40')][_0x7995('0x49')](_0x237270[_0x7995('0x4a')],{})[_0x7995('0x24')](respondWithResult(_0x491184,0xc9))[_0x7995('0x48')](handleError(_0x491184,null));};exports['update']=function(_0x1a5cec,_0xfb72b2){if(_0x1a5cec['body']['id']){delete _0x1a5cec[_0x7995('0x4a')]['id'];}delete _0x1a5cec['body'][_0x7995('0x4b')];delete _0x1a5cec[_0x7995('0x4a')][_0x7995('0x4c')];delete _0x1a5cec[_0x7995('0x4a')][_0x7995('0x4d')];delete _0x1a5cec[_0x7995('0x4a')][_0x7995('0x4e')];return db['ScreenRecording'][_0x7995('0x47')]({'where':{'id':_0x1a5cec[_0x7995('0x45')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0xfb72b2,null))['then'](saveUpdates(_0x1a5cec[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0xfb72b2,null))[_0x7995('0x48')](handleError(_0xfb72b2,null));};exports['describe']=function(_0x4ec548,_0x5a592e){return db[_0x7995('0x40')][_0x7995('0x4f')]()['then'](respondWithResult(_0x5a592e,null))[_0x7995('0x48')](handleError(_0x5a592e,null));};exports[_0x7995('0x50')]=function(_0x31f27c,_0x1a9bd7,_0xc04004){var _0x528c8e=require(_0x7995('0x51'));var _0x4ab09f=![];var _0x14fe7f={};if(_0x31f27c[_0x7995('0x30')][_0x7995('0x3d')]&&_0x31f27c['query']['type']==='uniqueid'){_0x14fe7f['uniqueid']=_0x31f27c[_0x7995('0x45')]['id'];}else{_0x14fe7f['id']=_0x31f27c[_0x7995('0x45')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':_0x14fe7f,'attributes':['id',_0x7995('0x4e')],'raw':!![]})[_0x7995('0x24')](handleEntityNotFound(_0x1a9bd7,null))[_0x7995('0x24')](function(_0xda6ce8){if(_0xda6ce8){var _0x328671=path[_0x7995('0x52')](config[_0x7995('0x53')],_0x7995('0x54'),_0xda6ce8[_0x7995('0x4e')]);var _0x35bea3=util[_0x7995('0x2f')](_0x7995('0x55'),_0x328671);if(fs[_0x7995('0x56')](_0x35bea3)){_0x4ab09f=!![];return _0x528c8e[_0x7995('0x57')](_0x35bea3,_0x328671,config[_0x7995('0x58')]['recording'])[_0x7995('0x24')](function(){return _0xda6ce8;});}return _0xda6ce8;}})[_0x7995('0x24')](function(_0x3b8a54){if(_0x3b8a54){var _0x32c0d3=path['join'](config['root'],_0x7995('0x54'),_0x3b8a54[_0x7995('0x4e')]);if(!fs[_0x7995('0x56')](_0x32c0d3)){throw new db[(_0x7995('0x59'))]['ValidationError'](_0x7995('0x5a'));}if(_0x3b8a54[_0x7995('0x5b')]){return _0x1a9bd7[_0x7995('0x50')](_0x32c0d3,_0x3b8a54[_0x7995('0x5b')]+path['extname'](_0x32c0d3),function(){if(_0x4ab09f){fs['unlink'](_0x32c0d3);}});}else{return _0x1a9bd7[_0x7995('0x50')](_0x32c0d3,function(_0x398fac){if(_0x4ab09f){fs[_0x7995('0x5c')](_0x32c0d3);}});}}})[_0x7995('0x48')](function(_0x37072){if(_0x37072[_0x7995('0x5d')]===_0x7995('0x5a')){_0x1a9bd7[_0x7995('0x1c')](0x194)[_0x7995('0x2a')]('Not\x20found');}else{return handleError(_0x1a9bd7,null);}});};exports[_0x7995('0x25')]=function(_0x3ec5a8,_0xdf9e38){return db[_0x7995('0x40')]['find']({'where':{'id':_0x3ec5a8['params']['id']}})[_0x7995('0x24')](function(_0xebb5c8){if(!_0xebb5c8)throw new ReferenceError('Entity\x20not\x20found');return _0xebb5c8;})[_0x7995('0x24')](function(_0x375fc9){var _0x2e3421=path[_0x7995('0x52')](config[_0x7995('0x53')],'server/files/screen_recordings',_0x375fc9[_0x7995('0x4e')]);logger['info'](_0x7995('0x5e'),_0x2e3421);if(!_[_0x7995('0x5f')](_0x375fc9[_0x7995('0x4e')])&&fs[_0x7995('0x56')](_0x2e3421)){logger[_0x7995('0x60')](_0x7995('0x61')+_0x2e3421+_0x7995('0x62'));fs[_0x7995('0x63')](_0x2e3421);}_0x2e3421=_0x2e3421+_0x7995('0x64');if(!_[_0x7995('0x5f')](_0x375fc9[_0x7995('0x4e')])&&fs[_0x7995('0x56')](_0x2e3421)){logger['info'](_0x7995('0x61')+_0x2e3421+_0x7995('0x62'));fs[_0x7995('0x63')](_0x2e3421);}return _0x375fc9;})[_0x7995('0x24')](function(_0x2c6548){if(!_0x2c6548)throw new InternalError();return _0x2c6548['destroy']();})['then'](function(){_0xdf9e38[_0x7995('0x1c')](0xcc)[_0x7995('0x26')]();})[_0x7995('0x48')](handleError(_0xdf9e38,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 98ec1fe..fd2fb84 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 _0x5e13=['exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x20efab,_0x34fa6f){var _0x52b8f1=function(_0x43fccb){while(--_0x43fccb){_0x20efab['push'](_0x20efab['shift']());}};_0x52b8f1(++_0x34fa6f);}(_0x5e13,0x1d2));var _0x35e1=function(_0x411bd1,_0x416106){_0x411bd1=_0x411bd1-0x0;var _0x320464=_0x5e13[_0x411bd1];return _0x320464;};'use strict';var _=require(_0x35e1('0x0'));var util=require(_0x35e1('0x1'));var logger=require(_0x35e1('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x35e1('0x3'));var fs=require('fs');var path=require(_0x35e1('0x4'));var rimraf=require(_0x35e1('0x5'));var config=require(_0x35e1('0x6'));var attributes=require('./screenRecording.attributes');module[_0x35e1('0x7')]=function(_0xc8ac89,_0x52f3fc){return _0xc8ac89[_0x35e1('0x8')](_0x35e1('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x35e1('0xa'),'fields':[_0x35e1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba7c=['interactionid','lodash','api','moment','request-promise','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings'];(function(_0x7e34b1,_0x519b3b){var _0x135e2e=function(_0x46fd98){while(--_0x46fd98){_0x7e34b1['push'](_0x7e34b1['shift']());}};_0x135e2e(++_0x519b3b);}(_0xba7c,0xa9));var _0xcba7=function(_0x3b8950,_0x58325c){_0x3b8950=_0x3b8950-0x0;var _0x20baa0=_0xba7c[_0x3b8950];return _0x20baa0;};'use strict';var _=require(_0xcba7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcba7('0x1'));var moment=require(_0xcba7('0x2'));var BPromise=require('bluebird');var rp=require(_0xcba7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcba7('0x4'));var config=require(_0xcba7('0x5'));var attributes=require(_0xcba7('0x6'));module[_0xcba7('0x7')]=function(_0x3ae51e,_0x54dbd7){return _0x3ae51e[_0xcba7('0x8')](_0xcba7('0x9'),attributes,{'tableName':_0xcba7('0xa'),'paranoid':![],'indexes':[{'name':_0xcba7('0xb'),'fields':[_0xcba7('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 3019f2b..1075145 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 _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x240eae,_0x374ebd){var _0x59b493=function(_0x45a7cc){while(--_0x45a7cc){_0x240eae['push'](_0x240eae['shift']());}};_0x59b493(++_0x374ebd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x27733e,_0x285f07){var _0x35791e=function(_0x392a88){while(--_0x392a88){_0x27733e['push'](_0x27733e['shift']());}};_0x35791e(++_0x285f07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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/setting/index.js b/server/api/setting/index.js index 11b8923..1071576 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 _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x4fde1b,_0xd723f9){var _0x1364e5=function(_0x1bc9b4){while(--_0x1bc9b4){_0x4fde1b['push'](_0x4fde1b['shift']());}};_0x1364e5(++_0xd723f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x3ed74b,_0x4d5fe5){var _0xbc94d2=function(_0x59e0d0){while(--_0x59e0d0){_0x3ed74b['push'](_0x3ed74b['shift']());}};_0xbc94d2(++_0x4d5fe5);}(_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'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index e0da3f3..1a41d35 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 _0xad92=['min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER'];(function(_0x2f8377,_0x3ed4bf){var _0x1705ed=function(_0x5db7ec){while(--_0x5db7ec){_0x2f8377['push'](_0x2f8377['shift']());}};_0x1705ed(++_0x3ed4bf);}(_0xad92,0x97));var _0x2ad9=function(_0x133fe4,_0x1f473b){_0x133fe4=_0x133fe4-0x0;var _0x4c4017=_0xad92[_0x133fe4];return _0x4c4017;};'use strict';var Sequelize=require(_0x2ad9('0x0'));module[_0x2ad9('0x1')]={'min_internal':{'type':Sequelize[_0x2ad9('0x2')](0xb),'unique':_0x2ad9('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x2ad9('0x2')](0xb),'unique':_0x2ad9('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x2ad9('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x2ad9('0x5')],'defaultValue':_0x2ad9('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x2ad9('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x2ad9('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x2ad9('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x2ad9('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x2ad9('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x2ad9('0x5')],'defaultValue':_0x2ad9('0x8')},'enableEmailPreview':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x2ad9('0x5')],'defaultValue':_0x2ad9('0x9')},'chatTimeout':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x2ad9('0x5')]},'defaultPreferred':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x2ad9('0x5')]},'defaultFavicon':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x2ad9('0x2')]},'transcribeRegion':{'type':Sequelize[_0x2ad9('0x5')]},'sentiment':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x2ad9('0x5')]},'language':{'type':Sequelize[_0x2ad9('0x5')]},'bucket':{'type':Sequelize[_0x2ad9('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x2ad9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc599=['exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0xc599,0x17b));var _0x9c59=function(_0x2b42bf,_0x2f1463){_0x2b42bf=_0x2b42bf-0x0;var _0x23c423=_0xc599[_0x2b42bf];return _0x23c423;};'use strict';var Sequelize=require(_0x9c59('0x0'));module[_0x9c59('0x1')]={'min_internal':{'type':Sequelize[_0x9c59('0x2')](0xb),'unique':_0x9c59('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x9c59('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x9c59('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x9c59('0x5')],'defaultValue':_0x9c59('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x9c59('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x9c59('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x9c59('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x9c59('0x5')]},'turnpassword':{'type':Sequelize[_0x9c59('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x9c59('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x9c59('0x5')],'defaultValue':_0x9c59('0x8')},'enableEmailPreview':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x9c59('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x9c59('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x9c59('0x5')]},'defaultPreferred':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x9c59('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x9c59('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x9c59('0x5')]},'defaultFavicon':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x9c59('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x9c59('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x9c59('0x2')]},'sentimentRegion':{'type':Sequelize[_0x9c59('0x5')]},'language':{'type':Sequelize[_0x9c59('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x9c59('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x9c59('0x2')](0x2)[_0x9c59('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x9c59('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x9c59('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x9c59('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index be7bb01..e0a6d82 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 _0xd6c1=['defaultPreferred','default_loginLogo.svg','download','gdpr','securePassword','addPreferred','getPreferred','custom','default_preferred.png','addFavicon','default_favicon.ico','Sequelize','getDate','utcOffset','format','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','map','Setting','type','key','keys','query','filters','intersection','model','attributes','fields','length','order','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','find','body','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','toLower','root','default','upperFirst','default_logo.svg','ValidationError','\x20not\x20found','server/files/images/logos'];(function(_0x106b26,_0x2ecdea){var _0x24f211=function(_0x5be91f){while(--_0x5be91f){_0x106b26['push'](_0x106b26['shift']());}};_0x24f211(++_0x2ecdea);}(_0xd6c1,0xfb));var _0x1d6c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd6c1[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0x1d6c('0x0'));var emlformat=require(_0x1d6c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1d6c('0x2'));var jsonpatch=require(_0x1d6c('0x3'));var rp=require(_0x1d6c('0x4'));var moment=require(_0x1d6c('0x5'));var BPromise=require(_0x1d6c('0x6'));var Mustache=require(_0x1d6c('0x7'));var util=require(_0x1d6c('0x8'));var path=require(_0x1d6c('0x9'));var sox=require('sox');var csv=require(_0x1d6c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d6c('0xb'));var _=require('lodash');var squel=require(_0x1d6c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1d6c('0xd'));var toCsv=require(_0x1d6c('0xa'));var querystring=require(_0x1d6c('0xe'));var Papa=require('papaparse');var Redis=require(_0x1d6c('0xf'));var authService=require(_0x1d6c('0x10'));var qs=require(_0x1d6c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d6c('0x12'));var logger=require(_0x1d6c('0x13'))(_0x1d6c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1d6c('0x15'))['db'];var jayson=require(_0x1d6c('0x16'));var client=jayson[_0x1d6c('0x17')][_0x1d6c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2a9511,_0x575b19,_0x3b58a5,_0x3755b1){return new BPromise(function(_0x4b9df4,_0x4f4410){var _0x2230b6=_0x3755b1||client;return _0x2230b6[_0x1d6c('0x19')](_0x2a9511,_0x3b58a5)[_0x1d6c('0x1a')](function(_0x1598d1){logger[_0x1d6c('0x1b')](_0x1d6c('0x1c'),_0x575b19,_0x1d6c('0x1d'));logger[_0x1d6c('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x575b19,_0x1d6c('0x1d'),JSON[_0x1d6c('0x1f')](_0x1598d1));if(_0x1598d1[_0x1d6c('0x20')]){if(_0x1598d1[_0x1d6c('0x20')][_0x1d6c('0x21')]===0x1f4){logger['error'](_0x1d6c('0x1c'),_0x575b19,_0x1598d1[_0x1d6c('0x20')]['message']);return _0x4f4410(_0x1598d1[_0x1d6c('0x20')][_0x1d6c('0x22')]);}logger[_0x1d6c('0x20')]('Setting,\x20%s,\x20%s',_0x575b19,_0x1598d1['error']['message']);return _0x4b9df4(_0x1598d1[_0x1d6c('0x20')][_0x1d6c('0x22')]);}else{logger[_0x1d6c('0x1b')](_0x1d6c('0x1c'),_0x575b19,_0x1d6c('0x1d'));_0x4b9df4(_0x1598d1[_0x1d6c('0x23')][_0x1d6c('0x22')]);}})[_0x1d6c('0x24')](function(_0x307f89){logger['error']('Setting,\x20%s,\x20%s',_0x575b19,_0x307f89);_0x4f4410(_0x307f89);});});}function respondWithStatusCode(_0x27c87b,_0x2d291b){_0x2d291b=_0x2d291b||0xcc;return function(_0x4fba44){if(_0x4fba44){return _0x27c87b[_0x1d6c('0x25')](_0x2d291b);}return _0x27c87b[_0x1d6c('0x26')](_0x2d291b)[_0x1d6c('0x27')]();};}function respondWithResult(_0x37f64c,_0x5e623e){_0x5e623e=_0x5e623e||0xc8;return function(_0x32f3ae){if(_0x32f3ae){return _0x37f64c[_0x1d6c('0x26')](_0x5e623e)[_0x1d6c('0x28')](_0x32f3ae);}};}function respondWithFilteredResult(_0x2bb0f3,_0x5cc291){return function(_0x1a55ab){if(_0x1a55ab){var _0x19f134=_0x1a55ab[_0x1d6c('0x29')],_0x334bf=_0x5cc291[_0x1d6c('0x2a')],_0x323057=_0x5cc291[_0x1d6c('0x2a')]+_0x5cc291[_0x1d6c('0x2b')],_0x24863b;if(_0x323057>=_0x19f134){_0x323057=_0x19f134;_0x24863b=0xc8;}else{_0x24863b=0xce;}_0x2bb0f3[_0x1d6c('0x26')](_0x24863b);return _0x2bb0f3[_0x1d6c('0x2c')](_0x1d6c('0x2d'),_0x334bf+'-'+_0x323057+'/'+_0x19f134)[_0x1d6c('0x28')](_0x1a55ab);}return null;};}function patchUpdates(_0xc625f6){return function(_0x27b434){try{jsonpatch[_0x1d6c('0x2e')](_0x27b434,_0xc625f6,!![]);}catch(_0x1979f8){return BPromise['reject'](_0x1979f8);}return _0x27b434[_0x1d6c('0x2f')]();};}function saveUpdates(_0x1b0ee9,_0x299a83){return function(_0x170a2e){if(_0x170a2e){return _0x170a2e[_0x1d6c('0x30')](_0x1b0ee9)[_0x1d6c('0x1a')](function(_0x4a8d2d){return _0x4a8d2d;});}return null;};}function removeEntity(_0x33bd2e,_0x2726c7){return function(_0x35391b){if(_0x35391b){return _0x35391b[_0x1d6c('0x31')]()['then'](function(){_0x33bd2e['status'](0xcc)[_0x1d6c('0x27')]();});}};}function handleEntityNotFound(_0x6a25f7,_0x5498b9){return function(_0x226eba){if(!_0x226eba){_0x6a25f7[_0x1d6c('0x25')](0x194);}return _0x226eba;};}function handleError(_0x46b63e,_0x2b8aa0){_0x2b8aa0=_0x2b8aa0||0x1f4;return function(_0x29ebc2){logger[_0x1d6c('0x20')](_0x29ebc2[_0x1d6c('0x32')]);if(_0x29ebc2['name']){delete _0x29ebc2[_0x1d6c('0x33')];}_0x46b63e['status'](_0x2b8aa0)[_0x1d6c('0x34')](_0x29ebc2);};}exports['index']=function(_0x352c33,_0x2404c0){var _0x2a9246={},_0x307c1e={},_0x5af514={'count':0x0,'rows':[]};var _0x2d49f6=_[_0x1d6c('0x35')](db[_0x1d6c('0x36')]['rawAttributes'],function(_0x35a3f1){return{'name':_0x35a3f1['fieldName'],'type':_0x35a3f1[_0x1d6c('0x37')][_0x1d6c('0x38')]};});_0x307c1e['model']=_[_0x1d6c('0x35')](_0x2d49f6,'name');_0x307c1e['query']=_[_0x1d6c('0x39')](_0x352c33[_0x1d6c('0x3a')]);_0x307c1e[_0x1d6c('0x3b')]=_[_0x1d6c('0x3c')](_0x307c1e[_0x1d6c('0x3d')],_0x307c1e[_0x1d6c('0x3a')]);_0x2a9246[_0x1d6c('0x3e')]=_[_0x1d6c('0x3c')](_0x307c1e[_0x1d6c('0x3d')],qs['fields'](_0x352c33[_0x1d6c('0x3a')][_0x1d6c('0x3f')]));_0x2a9246[_0x1d6c('0x3e')]=_0x2a9246[_0x1d6c('0x3e')][_0x1d6c('0x40')]?_0x2a9246[_0x1d6c('0x3e')]:_0x307c1e[_0x1d6c('0x3d')];if(!_0x352c33[_0x1d6c('0x3a')]['hasOwnProperty']('nolimit')){_0x2a9246['limit']=qs[_0x1d6c('0x2b')](_0x352c33[_0x1d6c('0x3a')]['limit']);_0x2a9246[_0x1d6c('0x2a')]=qs[_0x1d6c('0x2a')](_0x352c33[_0x1d6c('0x3a')][_0x1d6c('0x2a')]);}_0x2a9246[_0x1d6c('0x41')]=qs['sort'](_0x352c33[_0x1d6c('0x3a')]['sort']);_0x2a9246[_0x1d6c('0x42')]=qs[_0x1d6c('0x3b')](_[_0x1d6c('0x43')](_0x352c33[_0x1d6c('0x3a')],_0x307c1e['filters']),_0x2d49f6);if(_0x352c33[_0x1d6c('0x3a')][_0x1d6c('0x44')]){_0x2a9246['where']=_['merge'](_0x2a9246['where'],{'$or':_[_0x1d6c('0x35')](_0x2d49f6,function(_0x4f7e60){if(_0x4f7e60[_0x1d6c('0x37')]!==_0x1d6c('0x45')){var _0x38ac98={};_0x38ac98[_0x4f7e60[_0x1d6c('0x33')]]={'$like':'%'+_0x352c33[_0x1d6c('0x3a')][_0x1d6c('0x44')]+'%'};return _0x38ac98;}})});}_0x2a9246=_[_0x1d6c('0x46')]({},_0x2a9246,_0x352c33[_0x1d6c('0x47')]);var _0x324f36={'where':_0x2a9246[_0x1d6c('0x42')]};return db['Setting'][_0x1d6c('0x29')](_0x324f36)[_0x1d6c('0x1a')](function(_0x29a890){_0x5af514[_0x1d6c('0x29')]=_0x29a890;if(_0x352c33[_0x1d6c('0x3a')]['includeAll']){_0x2a9246[_0x1d6c('0x48')]=[{'all':!![]}];}return db['Setting'][_0x1d6c('0x49')](_0x2a9246);})[_0x1d6c('0x1a')](function(_0x397c49){_0x5af514[_0x1d6c('0x4a')]=_0x397c49;return _0x5af514;})[_0x1d6c('0x1a')](respondWithFilteredResult(_0x2404c0,_0x2a9246))[_0x1d6c('0x24')](handleError(_0x2404c0,null));};exports[_0x1d6c('0x4b')]=function(_0x581fb8,_0x16730f){var _0x4a7d1b={'raw':![],'where':{'id':_0x581fb8[_0x1d6c('0x4c')]['id']}},_0xa7c982={};_0xa7c982[_0x1d6c('0x3d')]=_[_0x1d6c('0x39')](db[_0x1d6c('0x36')]['rawAttributes']);_0xa7c982[_0x1d6c('0x3a')]=_['keys'](_0x581fb8['query']);_0xa7c982[_0x1d6c('0x3b')]=_[_0x1d6c('0x3c')](_0xa7c982[_0x1d6c('0x3d')],_0xa7c982[_0x1d6c('0x3a')]);_0x4a7d1b['attributes']=_[_0x1d6c('0x3c')](_0xa7c982[_0x1d6c('0x3d')],qs[_0x1d6c('0x3f')](_0x581fb8['query']['fields']));_0x4a7d1b[_0x1d6c('0x3e')]=_0x4a7d1b[_0x1d6c('0x3e')]['length']?_0x4a7d1b['attributes']:_0xa7c982[_0x1d6c('0x3d')];if(_0x581fb8[_0x1d6c('0x3a')][_0x1d6c('0x4d')]){_0x4a7d1b[_0x1d6c('0x48')]=[{'all':!![]}];}_0x4a7d1b=_[_0x1d6c('0x46')]({},_0x4a7d1b,_0x581fb8['options']);return db[_0x1d6c('0x36')][_0x1d6c('0x4e')](_0x4a7d1b)[_0x1d6c('0x1a')](handleEntityNotFound(_0x16730f,null))[_0x1d6c('0x1a')](respondWithResult(_0x16730f,null))[_0x1d6c('0x24')](handleError(_0x16730f,null));};exports[_0x1d6c('0x30')]=function(_0x206e64,_0x105458){if(_0x206e64['body']['id']){delete _0x206e64[_0x1d6c('0x4f')]['id'];}return db['Setting'][_0x1d6c('0x4e')]({'where':{'id':_0x206e64[_0x1d6c('0x4c')]['id']}})[_0x1d6c('0x1a')](handleEntityNotFound(_0x105458,null))[_0x1d6c('0x1a')](saveUpdates(_0x206e64['body'],null))['then'](respondWithResult(_0x105458,null))[_0x1d6c('0x24')](handleError(_0x105458,null));};exports['addLogo']=function(_0x42adbb,_0x3dc724,_0x8cac80){if(_0x42adbb[_0x1d6c('0x50')]&&_0x42adbb[_0x1d6c('0x50')]['filename']){_0x42adbb[_0x1d6c('0x4f')]['logo']=_0x42adbb['file'][_0x1d6c('0x51')];}return db[_0x1d6c('0x36')]['find']({'where':{'id':_0x42adbb[_0x1d6c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3dc724,null))[_0x1d6c('0x1a')](saveUpdates(_0x42adbb[_0x1d6c('0x4f')],null))[_0x1d6c('0x1a')](respondWithResult(_0x3dc724,null))[_0x1d6c('0x24')](handleError(_0x3dc724,null));};exports[_0x1d6c('0x52')]=function(_0x428f4f,_0x1cf939,_0x26e915){if(_0x428f4f[_0x1d6c('0x50')]&&_0x428f4f[_0x1d6c('0x50')][_0x1d6c('0x51')]){_0x428f4f['body'][_0x1d6c('0x53')]=_0x428f4f['file'][_0x1d6c('0x51')];}return db['Setting'][_0x1d6c('0x4e')]({'where':{'id':_0x428f4f[_0x1d6c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1cf939,null))['then'](saveUpdates(_0x428f4f['body'],null))[_0x1d6c('0x1a')](respondWithResult(_0x1cf939,null))[_0x1d6c('0x24')](handleError(_0x1cf939,null));};var utilLicense=require(_0x1d6c('0x54'));exports[_0x1d6c('0x55')]=function(_0x5a8933,_0x1f2ea6,_0x504559){var _0x491ed7='server/files/images/logos';var _0x59a4c4={'custom':![]};return utilLicense[_0x1d6c('0x56')]()['then'](function(_0xd0050f){if(_0xd0050f){_0x59a4c4=_0xd0050f;}return db[_0x1d6c('0x36')][_0x1d6c('0x4e')]({'where':{'id':_0x5a8933[_0x1d6c('0x4c')]['id']},'attributes':[_0x1d6c('0x57'),'loginLogo',_0x1d6c('0x58'),_0x1d6c('0x59'),_0x1d6c('0x5a'),_0x1d6c('0x5b'),'defaultPreferred',_0x1d6c('0x5c')],'raw':!![]});})[_0x1d6c('0x1a')](handleEntityNotFound(_0x1f2ea6,null))[_0x1d6c('0x1a')](function(_0x4c54d6){if(_0x4c54d6){var _0x54e359=_0x4c54d6[_0x1d6c('0x57')]&&fs[_0x1d6c('0x5d')](path[_0x1d6c('0x5e')](config['root'],_0x491ed7,_[_0x1d6c('0x5f')](_0x4c54d6['logo'])))?path['join'](config[_0x1d6c('0x60')],_0x491ed7,_[_0x1d6c('0x5f')](_0x4c54d6[_0x1d6c('0x57')])):path['join'](config[_0x1d6c('0x60')],_0x491ed7,_[_0x1d6c('0x5f')]('default_logo.svg'));var _0x1c3570=_0x1d6c('0x61')+_[_0x1d6c('0x62')](_0x1d6c('0x57'));if(_0x4c54d6[_0x1c3570]||!_0x59a4c4['custom']){_0x54e359=path[_0x1d6c('0x5e')](config[_0x1d6c('0x60')],_0x491ed7,_['toLower'](_0x1d6c('0x63')));}if(!fs[_0x1d6c('0x5d')](_0x54e359)){throw new db['Sequelize'][(_0x1d6c('0x64'))](_[_0x1d6c('0x62')](_0x1d6c('0x57'))+_0x1d6c('0x65'));}return _0x1f2ea6['download'](_0x54e359);}})[_0x1d6c('0x24')](handleError(_0x1f2ea6,null));};var utilLicense=require(_0x1d6c('0x54'));exports['getLogoLogin']=function(_0x309046,_0x1094f0,_0x142737){var _0x4e3af5=_0x1d6c('0x66');var _0x2fa2fd={'custom':![]};return utilLicense['getLicense']()[_0x1d6c('0x1a')](function(_0x134b0e){if(_0x134b0e){_0x2fa2fd=_0x134b0e;}return db[_0x1d6c('0x36')][_0x1d6c('0x4e')]({'where':{'id':_0x309046[_0x1d6c('0x4c')]['id']},'attributes':['logo',_0x1d6c('0x53'),_0x1d6c('0x58'),'favicon','defaultLogo',_0x1d6c('0x5b'),_0x1d6c('0x67'),_0x1d6c('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x1094f0,null))[_0x1d6c('0x1a')](function(_0x10704e){if(_0x10704e){var _0x10f219=_0x10704e[_0x1d6c('0x53')]&&fs[_0x1d6c('0x5d')](path['join'](config[_0x1d6c('0x60')],_0x4e3af5,_[_0x1d6c('0x5f')](_0x10704e[_0x1d6c('0x53')])))?path[_0x1d6c('0x5e')](config[_0x1d6c('0x60')],_0x4e3af5,_[_0x1d6c('0x5f')](_0x10704e[_0x1d6c('0x53')])):path[_0x1d6c('0x5e')](config[_0x1d6c('0x60')],_0x4e3af5,_[_0x1d6c('0x5f')]('default_loginLogo.svg'));var _0x51e6a9=_0x1d6c('0x61')+_[_0x1d6c('0x62')](_0x1d6c('0x53'));if(_0x10704e[_0x51e6a9]||!_0x2fa2fd['custom']){_0x10f219=path['join'](config['root'],_0x4e3af5,_['toLower'](_0x1d6c('0x68')));}if(!fs[_0x1d6c('0x5d')](_0x10f219)){throw new db['Sequelize'][(_0x1d6c('0x64'))](_[_0x1d6c('0x62')](_0x1d6c('0x53'))+_0x1d6c('0x65'));}return _0x1094f0[_0x1d6c('0x69')](_0x10f219);}})[_0x1d6c('0x24')](handleError(_0x1094f0,null));};exports[_0x1d6c('0x6a')]=function(_0x4d3b4a,_0x3ccd3e){return db[_0x1d6c('0x36')][_0x1d6c('0x4e')]({'where':{'id':_0x4d3b4a[_0x1d6c('0x4c')]['id']},'attributes':[_0x1d6c('0x6b')]})['then'](respondWithResult(_0x3ccd3e,null))[_0x1d6c('0x24')](handleError(_0x3ccd3e,null));};exports[_0x1d6c('0x6c')]=function(_0x503e1b,_0x1e67ad,_0x34ca6e){if(_0x503e1b[_0x1d6c('0x50')]&&_0x503e1b[_0x1d6c('0x50')]['filename']){_0x503e1b[_0x1d6c('0x4f')][_0x1d6c('0x58')]=_0x503e1b['file'][_0x1d6c('0x51')];}return db[_0x1d6c('0x36')][_0x1d6c('0x4e')]({'where':{'id':_0x503e1b['params']['id']}})[_0x1d6c('0x1a')](handleEntityNotFound(_0x1e67ad,null))[_0x1d6c('0x1a')](saveUpdates(_0x503e1b['body'],null))['then'](respondWithResult(_0x1e67ad,null))[_0x1d6c('0x24')](handleError(_0x1e67ad,null));};var utilLicense=require('../../config/license/util');exports[_0x1d6c('0x6d')]=function(_0x357540,_0x472346,_0x404bb1){var _0x498466='server/files/images/logos';var _0x56aa63={'custom':![]};return utilLicense[_0x1d6c('0x56')]()[_0x1d6c('0x1a')](function(_0x13c205){if(_0x13c205){_0x56aa63=_0x13c205;}return db[_0x1d6c('0x36')][_0x1d6c('0x4e')]({'where':{'id':_0x357540[_0x1d6c('0x4c')]['id']},'attributes':[_0x1d6c('0x57'),_0x1d6c('0x53'),_0x1d6c('0x58'),_0x1d6c('0x59'),_0x1d6c('0x5a'),_0x1d6c('0x5b'),_0x1d6c('0x67'),'defaultFavicon'],'raw':!![]});})[_0x1d6c('0x1a')](handleEntityNotFound(_0x472346,null))[_0x1d6c('0x1a')](function(_0x442cc3){if(_0x442cc3){var _0x262289=_0x442cc3['preferred']&&fs['existsSync'](path['join'](config[_0x1d6c('0x60')],_0x498466,_[_0x1d6c('0x5f')](_0x442cc3[_0x1d6c('0x58')])))?path['join'](config[_0x1d6c('0x60')],_0x498466,_[_0x1d6c('0x5f')](_0x442cc3['preferred'])):path['join'](config['root'],_0x498466,_[_0x1d6c('0x5f')]('default_preferred.png'));var _0x2777f4='default'+_[_0x1d6c('0x62')](_0x1d6c('0x58'));if(_0x442cc3[_0x2777f4]||!_0x56aa63[_0x1d6c('0x6e')]||!_0x56aa63['preferred']){_0x262289=path[_0x1d6c('0x5e')](config['root'],_0x498466,_['toLower'](_0x1d6c('0x6f')));}if(!fs[_0x1d6c('0x5d')](_0x262289)){throw new db['Sequelize'][(_0x1d6c('0x64'))](_[_0x1d6c('0x62')](_0x1d6c('0x58'))+_0x1d6c('0x65'));}return _0x472346[_0x1d6c('0x69')](_0x262289);}})['catch'](handleError(_0x472346,null));};exports[_0x1d6c('0x70')]=function(_0x21b76f,_0x45bfa4,_0x11ca3a){if(_0x21b76f[_0x1d6c('0x50')]&&_0x21b76f['file']['filename']){_0x21b76f['body'][_0x1d6c('0x59')]=_0x21b76f[_0x1d6c('0x50')][_0x1d6c('0x51')];}return db[_0x1d6c('0x36')][_0x1d6c('0x4e')]({'where':{'id':_0x21b76f['params']['id']}})[_0x1d6c('0x1a')](handleEntityNotFound(_0x45bfa4,null))['then'](saveUpdates(_0x21b76f[_0x1d6c('0x4f')],null))[_0x1d6c('0x1a')](respondWithResult(_0x45bfa4,null))[_0x1d6c('0x24')](handleError(_0x45bfa4,null));};var utilLicense=require(_0x1d6c('0x54'));exports['getFavicon']=function(_0x5ec29d,_0x256d7f,_0x58e57b){var _0x4a4652=_0x1d6c('0x66');var _0x1bce21={'custom':![]};return utilLicense[_0x1d6c('0x56')]()[_0x1d6c('0x1a')](function(_0x50530f){if(_0x50530f){_0x1bce21=_0x50530f;}return db[_0x1d6c('0x36')][_0x1d6c('0x4e')]({'where':{'id':_0x5ec29d[_0x1d6c('0x4c')]['id']},'attributes':[_0x1d6c('0x57'),_0x1d6c('0x53'),'preferred',_0x1d6c('0x59'),_0x1d6c('0x5a'),_0x1d6c('0x5b'),_0x1d6c('0x67'),'defaultFavicon'],'raw':!![]});})[_0x1d6c('0x1a')](handleEntityNotFound(_0x256d7f,null))[_0x1d6c('0x1a')](function(_0x3a9f82){if(_0x3a9f82){var _0x5d9c26=_0x3a9f82[_0x1d6c('0x59')]&&fs[_0x1d6c('0x5d')](path[_0x1d6c('0x5e')](config['root'],_0x4a4652,_['toLower'](_0x3a9f82[_0x1d6c('0x59')])))?path[_0x1d6c('0x5e')](config[_0x1d6c('0x60')],_0x4a4652,_[_0x1d6c('0x5f')](_0x3a9f82[_0x1d6c('0x59')])):path[_0x1d6c('0x5e')](config[_0x1d6c('0x60')],_0x4a4652,_[_0x1d6c('0x5f')](_0x1d6c('0x71')));var _0xf3d7e9=_0x1d6c('0x61')+_[_0x1d6c('0x62')](_0x1d6c('0x59'));if(_0x3a9f82[_0xf3d7e9]||!_0x1bce21[_0x1d6c('0x6e')]){_0x5d9c26=path[_0x1d6c('0x5e')](config[_0x1d6c('0x60')],_0x4a4652,_[_0x1d6c('0x5f')](_0x1d6c('0x71')));}if(!fs[_0x1d6c('0x5d')](_0x5d9c26)){throw new db[(_0x1d6c('0x72'))][(_0x1d6c('0x64'))](_[_0x1d6c('0x62')](_0x1d6c('0x59'))+'\x20not\x20found');}return _0x256d7f['download'](_0x5d9c26);}})['catch'](handleError(_0x256d7f,null));};exports[_0x1d6c('0x73')]=function(_0x3ff908,_0x23fd94){var _0x140517={'offset':moment()[_0x1d6c('0x74')]()};_0x140517['now']=moment()[_0x1d6c('0x74')](_0x140517[_0x1d6c('0x2a')])[_0x1d6c('0x75')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x23fd94['status'](0xc8)['send'](_0x140517);}; \ No newline at end of file +var _0x8a5b=['Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','count','limit','set','Content-Range','apply','reject','update','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','nolimit','offset','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','Setting','intersection','find','body','file','filename','logo','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','download','default_loginLogo.svg','Sequelize','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x36ed5,_0x26234f){var _0x132053=function(_0x1202e7){while(--_0x1202e7){_0x36ed5['push'](_0x36ed5['shift']());}};_0x132053(++_0x26234f);}(_0x8a5b,0x158));var _0xb8a5=function(_0x1a647a,_0x3c940c){_0x1a647a=_0x1a647a-0x0;var _0x205d87=_0x8a5b[_0x1a647a];return _0x205d87;};'use strict';var pdf=require(_0xb8a5('0x0'));var emlformat=require(_0xb8a5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb8a5('0x2'));var jsonpatch=require(_0xb8a5('0x3'));var rp=require(_0xb8a5('0x4'));var moment=require(_0xb8a5('0x5'));var BPromise=require(_0xb8a5('0x6'));var Mustache=require(_0xb8a5('0x7'));var util=require(_0xb8a5('0x8'));var path=require(_0xb8a5('0x9'));var sox=require(_0xb8a5('0xa'));var csv=require(_0xb8a5('0xb'));var ejs=require(_0xb8a5('0xc'));var fs=require('fs');var fs_extra=require(_0xb8a5('0xd'));var _=require('lodash');var squel=require(_0xb8a5('0xe'));var crypto=require('crypto');var jsforce=require(_0xb8a5('0xf'));var deskjs=require(_0xb8a5('0x10'));var toCsv=require(_0xb8a5('0xb'));var querystring=require(_0xb8a5('0x11'));var Papa=require('papaparse');var Redis=require(_0xb8a5('0x12'));var authService=require(_0xb8a5('0x13'));var qs=require(_0xb8a5('0x14'));var as=require(_0xb8a5('0x15'));var hardwareService=require(_0xb8a5('0x16'));var logger=require(_0xb8a5('0x17'))(_0xb8a5('0x18'));var utils=require(_0xb8a5('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb8a5('0x1a'))['db'];var jayson=require(_0xb8a5('0x1b'));var client=jayson[_0xb8a5('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55a8fa,_0x597f0f,_0xc7f384,_0x1871b7){return new BPromise(function(_0xa66863,_0x9d6e12){var _0x442837=_0x1871b7||client;return _0x442837[_0xb8a5('0x1d')](_0x55a8fa,_0xc7f384)[_0xb8a5('0x1e')](function(_0x14a4f4){logger['info'](_0xb8a5('0x1f'),_0x597f0f,_0xb8a5('0x20'));logger[_0xb8a5('0x21')](_0xb8a5('0x22'),_0x597f0f,'request\x20sent',JSON[_0xb8a5('0x23')](_0x14a4f4));if(_0x14a4f4[_0xb8a5('0x24')]){if(_0x14a4f4[_0xb8a5('0x24')][_0xb8a5('0x25')]===0x1f4){logger[_0xb8a5('0x24')](_0xb8a5('0x1f'),_0x597f0f,_0x14a4f4[_0xb8a5('0x24')][_0xb8a5('0x26')]);return _0x9d6e12(_0x14a4f4[_0xb8a5('0x24')][_0xb8a5('0x26')]);}logger[_0xb8a5('0x24')](_0xb8a5('0x1f'),_0x597f0f,_0x14a4f4[_0xb8a5('0x24')][_0xb8a5('0x26')]);return _0xa66863(_0x14a4f4[_0xb8a5('0x24')]['message']);}else{logger[_0xb8a5('0x27')]('Setting,\x20%s,\x20%s',_0x597f0f,_0xb8a5('0x20'));_0xa66863(_0x14a4f4[_0xb8a5('0x28')][_0xb8a5('0x26')]);}})[_0xb8a5('0x29')](function(_0x2b357c){logger['error'](_0xb8a5('0x1f'),_0x597f0f,_0x2b357c);_0x9d6e12(_0x2b357c);});});}function respondWithStatusCode(_0x2e13c6,_0x31a793){_0x31a793=_0x31a793||0xcc;return function(_0x320fc2){if(_0x320fc2){return _0x2e13c6[_0xb8a5('0x2a')](_0x31a793);}return _0x2e13c6[_0xb8a5('0x2b')](_0x31a793)['end']();};}function respondWithResult(_0x160574,_0xe125e2){_0xe125e2=_0xe125e2||0xc8;return function(_0x4a4739){if(_0x4a4739){return _0x160574[_0xb8a5('0x2b')](_0xe125e2)['json'](_0x4a4739);}};}function respondWithFilteredResult(_0x79705c,_0xd94083){return function(_0x3a80f6){if(_0x3a80f6){var _0x101577=_0x3a80f6[_0xb8a5('0x2c')],_0x4e3e10=_0xd94083['offset'],_0x4c316f=_0xd94083['offset']+_0xd94083[_0xb8a5('0x2d')],_0x13ce85;if(_0x4c316f>=_0x101577){_0x4c316f=_0x101577;_0x13ce85=0xc8;}else{_0x13ce85=0xce;}_0x79705c[_0xb8a5('0x2b')](_0x13ce85);return _0x79705c[_0xb8a5('0x2e')](_0xb8a5('0x2f'),_0x4e3e10+'-'+_0x4c316f+'/'+_0x101577)['json'](_0x3a80f6);}return null;};}function patchUpdates(_0x184399){return function(_0x48f124){try{jsonpatch[_0xb8a5('0x30')](_0x48f124,_0x184399,!![]);}catch(_0x764f1){return BPromise[_0xb8a5('0x31')](_0x764f1);}return _0x48f124['save']();};}function saveUpdates(_0x25270d,_0x12a202){return function(_0x36b27c){if(_0x36b27c){return _0x36b27c[_0xb8a5('0x32')](_0x25270d)[_0xb8a5('0x1e')](function(_0x2398fe){return _0x2398fe;});}return null;};}function removeEntity(_0x5526db,_0x1b2094){return function(_0x2b0d0d){if(_0x2b0d0d){return _0x2b0d0d['destroy']()[_0xb8a5('0x1e')](function(){_0x5526db[_0xb8a5('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57c336,_0x18bbab){return function(_0x335ae0){if(!_0x335ae0){_0x57c336[_0xb8a5('0x2a')](0x194);}return _0x335ae0;};}function handleError(_0x95749d,_0x166839){_0x166839=_0x166839||0x1f4;return function(_0x293415){logger[_0xb8a5('0x24')](_0x293415[_0xb8a5('0x33')]);if(_0x293415[_0xb8a5('0x34')]){delete _0x293415[_0xb8a5('0x34')];}_0x95749d[_0xb8a5('0x2b')](_0x166839)[_0xb8a5('0x35')](_0x293415);};}exports[_0xb8a5('0x36')]=function(_0x58d848,_0x2bd3d6){var _0x21d7d={},_0x2a4565={},_0xbac024={'count':0x0,'rows':[]};var _0x3f87a5=_[_0xb8a5('0x37')](db['Setting'][_0xb8a5('0x38')],function(_0x247b23){return{'name':_0x247b23[_0xb8a5('0x39')],'type':_0x247b23[_0xb8a5('0x3a')][_0xb8a5('0x3b')]};});_0x2a4565[_0xb8a5('0x3c')]=_[_0xb8a5('0x37')](_0x3f87a5,_0xb8a5('0x34'));_0x2a4565['query']=_[_0xb8a5('0x3d')](_0x58d848[_0xb8a5('0x3e')]);_0x2a4565[_0xb8a5('0x3f')]=_['intersection'](_0x2a4565['model'],_0x2a4565['query']);_0x21d7d[_0xb8a5('0x40')]=_['intersection'](_0x2a4565[_0xb8a5('0x3c')],qs[_0xb8a5('0x41')](_0x58d848[_0xb8a5('0x3e')][_0xb8a5('0x41')]));_0x21d7d[_0xb8a5('0x40')]=_0x21d7d[_0xb8a5('0x40')][_0xb8a5('0x42')]?_0x21d7d[_0xb8a5('0x40')]:_0x2a4565[_0xb8a5('0x3c')];if(!_0x58d848[_0xb8a5('0x3e')]['hasOwnProperty'](_0xb8a5('0x43'))){_0x21d7d['limit']=qs[_0xb8a5('0x2d')](_0x58d848[_0xb8a5('0x3e')][_0xb8a5('0x2d')]);_0x21d7d[_0xb8a5('0x44')]=qs[_0xb8a5('0x44')](_0x58d848[_0xb8a5('0x3e')]['offset']);}_0x21d7d[_0xb8a5('0x45')]=qs['sort'](_0x58d848[_0xb8a5('0x3e')][_0xb8a5('0x46')]);_0x21d7d['where']=qs[_0xb8a5('0x3f')](_[_0xb8a5('0x47')](_0x58d848[_0xb8a5('0x3e')],_0x2a4565[_0xb8a5('0x3f')]),_0x3f87a5);if(_0x58d848[_0xb8a5('0x3e')][_0xb8a5('0x48')]){_0x21d7d[_0xb8a5('0x49')]=_['merge'](_0x21d7d[_0xb8a5('0x49')],{'$or':_['map'](_0x3f87a5,function(_0x31185e){if(_0x31185e['type']!==_0xb8a5('0x4a')){var _0x445493={};_0x445493[_0x31185e[_0xb8a5('0x34')]]={'$like':'%'+_0x58d848[_0xb8a5('0x3e')][_0xb8a5('0x48')]+'%'};return _0x445493;}})});}_0x21d7d=_[_0xb8a5('0x4b')]({},_0x21d7d,_0x58d848[_0xb8a5('0x4c')]);var _0x1a8a41={'where':_0x21d7d[_0xb8a5('0x49')]};return db['Setting'][_0xb8a5('0x2c')](_0x1a8a41)['then'](function(_0x5cd4d1){_0xbac024['count']=_0x5cd4d1;if(_0x58d848['query'][_0xb8a5('0x4d')]){_0x21d7d[_0xb8a5('0x4e')]=[{'all':!![]}];}return db['Setting'][_0xb8a5('0x4f')](_0x21d7d);})['then'](function(_0x314442){_0xbac024[_0xb8a5('0x50')]=_0x314442;return _0xbac024;})['then'](respondWithFilteredResult(_0x2bd3d6,_0x21d7d))[_0xb8a5('0x29')](handleError(_0x2bd3d6,null));};exports[_0xb8a5('0x51')]=function(_0x59a148,_0x49edf7){var _0x7b6038={'raw':![],'where':{'id':_0x59a148[_0xb8a5('0x52')]['id']}},_0x201dc6={};_0x201dc6[_0xb8a5('0x3c')]=_['keys'](db[_0xb8a5('0x53')][_0xb8a5('0x38')]);_0x201dc6[_0xb8a5('0x3e')]=_[_0xb8a5('0x3d')](_0x59a148[_0xb8a5('0x3e')]);_0x201dc6[_0xb8a5('0x3f')]=_[_0xb8a5('0x54')](_0x201dc6[_0xb8a5('0x3c')],_0x201dc6[_0xb8a5('0x3e')]);_0x7b6038[_0xb8a5('0x40')]=_['intersection'](_0x201dc6['model'],qs[_0xb8a5('0x41')](_0x59a148[_0xb8a5('0x3e')][_0xb8a5('0x41')]));_0x7b6038[_0xb8a5('0x40')]=_0x7b6038[_0xb8a5('0x40')][_0xb8a5('0x42')]?_0x7b6038[_0xb8a5('0x40')]:_0x201dc6[_0xb8a5('0x3c')];if(_0x59a148[_0xb8a5('0x3e')][_0xb8a5('0x4d')]){_0x7b6038[_0xb8a5('0x4e')]=[{'all':!![]}];}_0x7b6038=_[_0xb8a5('0x4b')]({},_0x7b6038,_0x59a148[_0xb8a5('0x4c')]);return db[_0xb8a5('0x53')][_0xb8a5('0x55')](_0x7b6038)[_0xb8a5('0x1e')](handleEntityNotFound(_0x49edf7,null))['then'](respondWithResult(_0x49edf7,null))[_0xb8a5('0x29')](handleError(_0x49edf7,null));};exports['update']=function(_0x265f8d,_0xb11829){if(_0x265f8d['body']['id']){delete _0x265f8d[_0xb8a5('0x56')]['id'];}return db['Setting'][_0xb8a5('0x55')]({'where':{'id':_0x265f8d[_0xb8a5('0x52')]['id']}})[_0xb8a5('0x1e')](handleEntityNotFound(_0xb11829,null))[_0xb8a5('0x1e')](saveUpdates(_0x265f8d[_0xb8a5('0x56')],null))[_0xb8a5('0x1e')](respondWithResult(_0xb11829,null))[_0xb8a5('0x29')](handleError(_0xb11829,null));};exports['addLogo']=function(_0x167b31,_0x2df0fa,_0x481bbb){if(_0x167b31['file']&&_0x167b31[_0xb8a5('0x57')][_0xb8a5('0x58')]){_0x167b31[_0xb8a5('0x56')][_0xb8a5('0x59')]=_0x167b31[_0xb8a5('0x57')][_0xb8a5('0x58')];}return db[_0xb8a5('0x53')][_0xb8a5('0x55')]({'where':{'id':_0x167b31[_0xb8a5('0x52')]['id']}})[_0xb8a5('0x1e')](handleEntityNotFound(_0x2df0fa,null))[_0xb8a5('0x1e')](saveUpdates(_0x167b31[_0xb8a5('0x56')],null))['then'](respondWithResult(_0x2df0fa,null))['catch'](handleError(_0x2df0fa,null));};exports['addLogoLogin']=function(_0x5230ce,_0x14a0d3,_0x3f3649){if(_0x5230ce['file']&&_0x5230ce['file'][_0xb8a5('0x58')]){_0x5230ce[_0xb8a5('0x56')][_0xb8a5('0x5a')]=_0x5230ce[_0xb8a5('0x57')][_0xb8a5('0x58')];}return db[_0xb8a5('0x53')]['find']({'where':{'id':_0x5230ce[_0xb8a5('0x52')]['id']}})[_0xb8a5('0x1e')](handleEntityNotFound(_0x14a0d3,null))[_0xb8a5('0x1e')](saveUpdates(_0x5230ce[_0xb8a5('0x56')],null))[_0xb8a5('0x1e')](respondWithResult(_0x14a0d3,null))[_0xb8a5('0x29')](handleError(_0x14a0d3,null));};var utilLicense=require(_0xb8a5('0x5b'));exports[_0xb8a5('0x5c')]=function(_0x4ce6f0,_0xe03d59,_0x44579c){var _0x4bc3ca=_0xb8a5('0x5d');var _0x29a5a0={'custom':![]};return utilLicense[_0xb8a5('0x5e')]()['then'](function(_0x2dee7a){if(_0x2dee7a){_0x29a5a0=_0x2dee7a;}return db['Setting'][_0xb8a5('0x55')]({'where':{'id':_0x4ce6f0['params']['id']},'attributes':[_0xb8a5('0x59'),_0xb8a5('0x5a'),_0xb8a5('0x5f'),_0xb8a5('0x60'),_0xb8a5('0x61'),_0xb8a5('0x62'),_0xb8a5('0x63'),_0xb8a5('0x64')],'raw':!![]});})[_0xb8a5('0x1e')](handleEntityNotFound(_0xe03d59,null))[_0xb8a5('0x1e')](function(_0xfa80cb){if(_0xfa80cb){var _0x55c29c=_0xfa80cb[_0xb8a5('0x59')]&&fs[_0xb8a5('0x65')](path[_0xb8a5('0x66')](config[_0xb8a5('0x67')],_0x4bc3ca,_[_0xb8a5('0x68')](_0xfa80cb[_0xb8a5('0x59')])))?path[_0xb8a5('0x66')](config['root'],_0x4bc3ca,_[_0xb8a5('0x68')](_0xfa80cb[_0xb8a5('0x59')])):path[_0xb8a5('0x66')](config[_0xb8a5('0x67')],_0x4bc3ca,_[_0xb8a5('0x68')](_0xb8a5('0x69')));var _0x324b66=_0xb8a5('0x6a')+_[_0xb8a5('0x6b')](_0xb8a5('0x59'));if(_0xfa80cb[_0x324b66]||!_0x29a5a0[_0xb8a5('0x6c')]){_0x55c29c=path['join'](config['root'],_0x4bc3ca,_[_0xb8a5('0x68')](_0xb8a5('0x69')));}if(!fs[_0xb8a5('0x65')](_0x55c29c)){throw new db['Sequelize'][(_0xb8a5('0x6d'))](_[_0xb8a5('0x6b')](_0xb8a5('0x59'))+_0xb8a5('0x6e'));}return _0xe03d59[_0xb8a5('0x6f')](_0x55c29c);}})['catch'](handleError(_0xe03d59,null));};var utilLicense=require(_0xb8a5('0x5b'));exports['getLogoLogin']=function(_0x4edb84,_0x24661d,_0x5ebeee){var _0x4dbc97=_0xb8a5('0x5d');var _0x3597eb={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x27a2e1){if(_0x27a2e1){_0x3597eb=_0x27a2e1;}return db[_0xb8a5('0x53')][_0xb8a5('0x55')]({'where':{'id':_0x4edb84[_0xb8a5('0x52')]['id']},'attributes':[_0xb8a5('0x59'),_0xb8a5('0x5a'),_0xb8a5('0x5f'),_0xb8a5('0x60'),'defaultLogo',_0xb8a5('0x62'),'defaultPreferred',_0xb8a5('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x24661d,null))['then'](function(_0x2c89fd){if(_0x2c89fd){var _0x52457a=_0x2c89fd['loginLogo']&&fs[_0xb8a5('0x65')](path[_0xb8a5('0x66')](config[_0xb8a5('0x67')],_0x4dbc97,_[_0xb8a5('0x68')](_0x2c89fd[_0xb8a5('0x5a')])))?path[_0xb8a5('0x66')](config[_0xb8a5('0x67')],_0x4dbc97,_[_0xb8a5('0x68')](_0x2c89fd[_0xb8a5('0x5a')])):path[_0xb8a5('0x66')](config[_0xb8a5('0x67')],_0x4dbc97,_[_0xb8a5('0x68')](_0xb8a5('0x70')));var _0x4bd5d1=_0xb8a5('0x6a')+_['upperFirst']('loginLogo');if(_0x2c89fd[_0x4bd5d1]||!_0x3597eb[_0xb8a5('0x6c')]){_0x52457a=path['join'](config[_0xb8a5('0x67')],_0x4dbc97,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xb8a5('0x65')](_0x52457a)){throw new db[(_0xb8a5('0x71'))]['ValidationError'](_[_0xb8a5('0x6b')](_0xb8a5('0x5a'))+_0xb8a5('0x6e'));}return _0x24661d[_0xb8a5('0x6f')](_0x52457a);}})[_0xb8a5('0x29')](handleError(_0x24661d,null));};exports[_0xb8a5('0x72')]=function(_0x125e02,_0x5a2067){return db['Setting'][_0xb8a5('0x55')]({'where':{'id':_0x125e02[_0xb8a5('0x52')]['id']},'attributes':[_0xb8a5('0x73')]})[_0xb8a5('0x1e')](respondWithResult(_0x5a2067,null))['catch'](handleError(_0x5a2067,null));};exports[_0xb8a5('0x74')]=function(_0xb01949,_0x571439,_0x2cd3b7){if(_0xb01949[_0xb8a5('0x57')]&&_0xb01949[_0xb8a5('0x57')][_0xb8a5('0x58')]){_0xb01949[_0xb8a5('0x56')]['preferred']=_0xb01949['file'][_0xb8a5('0x58')];}return db[_0xb8a5('0x53')]['find']({'where':{'id':_0xb01949['params']['id']}})['then'](handleEntityNotFound(_0x571439,null))[_0xb8a5('0x1e')](saveUpdates(_0xb01949[_0xb8a5('0x56')],null))[_0xb8a5('0x1e')](respondWithResult(_0x571439,null))[_0xb8a5('0x29')](handleError(_0x571439,null));};var utilLicense=require(_0xb8a5('0x5b'));exports[_0xb8a5('0x75')]=function(_0x359bad,_0x175129,_0x5ac2a5){var _0x54f8b8='server/files/images/logos';var _0x443c6a={'custom':![]};return utilLicense[_0xb8a5('0x5e')]()['then'](function(_0xfb6489){if(_0xfb6489){_0x443c6a=_0xfb6489;}return db[_0xb8a5('0x53')][_0xb8a5('0x55')]({'where':{'id':_0x359bad[_0xb8a5('0x52')]['id']},'attributes':['logo',_0xb8a5('0x5a'),_0xb8a5('0x5f'),_0xb8a5('0x60'),_0xb8a5('0x61'),_0xb8a5('0x62'),_0xb8a5('0x63'),'defaultFavicon'],'raw':!![]});})[_0xb8a5('0x1e')](handleEntityNotFound(_0x175129,null))[_0xb8a5('0x1e')](function(_0x323df2){if(_0x323df2){var _0x3dde42=_0x323df2[_0xb8a5('0x5f')]&&fs[_0xb8a5('0x65')](path[_0xb8a5('0x66')](config['root'],_0x54f8b8,_['toLower'](_0x323df2['preferred'])))?path[_0xb8a5('0x66')](config[_0xb8a5('0x67')],_0x54f8b8,_[_0xb8a5('0x68')](_0x323df2[_0xb8a5('0x5f')])):path['join'](config[_0xb8a5('0x67')],_0x54f8b8,_['toLower']('default_preferred.png'));var _0x349a83=_0xb8a5('0x6a')+_[_0xb8a5('0x6b')](_0xb8a5('0x5f'));if(_0x323df2[_0x349a83]||!_0x443c6a['custom']||!_0x443c6a[_0xb8a5('0x5f')]){_0x3dde42=path['join'](config[_0xb8a5('0x67')],_0x54f8b8,_['toLower'](_0xb8a5('0x76')));}if(!fs[_0xb8a5('0x65')](_0x3dde42)){throw new db[(_0xb8a5('0x71'))][(_0xb8a5('0x6d'))](_['upperFirst'](_0xb8a5('0x5f'))+_0xb8a5('0x6e'));}return _0x175129[_0xb8a5('0x6f')](_0x3dde42);}})[_0xb8a5('0x29')](handleError(_0x175129,null));};exports[_0xb8a5('0x77')]=function(_0x456144,_0x30568a,_0x5097b7){if(_0x456144['file']&&_0x456144[_0xb8a5('0x57')]['filename']){_0x456144[_0xb8a5('0x56')][_0xb8a5('0x60')]=_0x456144[_0xb8a5('0x57')][_0xb8a5('0x58')];}return db[_0xb8a5('0x53')][_0xb8a5('0x55')]({'where':{'id':_0x456144[_0xb8a5('0x52')]['id']}})[_0xb8a5('0x1e')](handleEntityNotFound(_0x30568a,null))[_0xb8a5('0x1e')](saveUpdates(_0x456144[_0xb8a5('0x56')],null))[_0xb8a5('0x1e')](respondWithResult(_0x30568a,null))[_0xb8a5('0x29')](handleError(_0x30568a,null));};var utilLicense=require(_0xb8a5('0x5b'));exports[_0xb8a5('0x78')]=function(_0x2018f9,_0x24cd94,_0x3106c8){var _0x41de4c=_0xb8a5('0x5d');var _0x3a4e71={'custom':![]};return utilLicense[_0xb8a5('0x5e')]()[_0xb8a5('0x1e')](function(_0x27107b){if(_0x27107b){_0x3a4e71=_0x27107b;}return db['Setting'][_0xb8a5('0x55')]({'where':{'id':_0x2018f9[_0xb8a5('0x52')]['id']},'attributes':[_0xb8a5('0x59'),_0xb8a5('0x5a'),_0xb8a5('0x5f'),'favicon',_0xb8a5('0x61'),_0xb8a5('0x62'),'defaultPreferred',_0xb8a5('0x64')],'raw':!![]});})[_0xb8a5('0x1e')](handleEntityNotFound(_0x24cd94,null))[_0xb8a5('0x1e')](function(_0x1c47f0){if(_0x1c47f0){var _0x17bf81=_0x1c47f0[_0xb8a5('0x60')]&&fs['existsSync'](path['join'](config[_0xb8a5('0x67')],_0x41de4c,_['toLower'](_0x1c47f0[_0xb8a5('0x60')])))?path[_0xb8a5('0x66')](config[_0xb8a5('0x67')],_0x41de4c,_[_0xb8a5('0x68')](_0x1c47f0[_0xb8a5('0x60')])):path['join'](config[_0xb8a5('0x67')],_0x41de4c,_[_0xb8a5('0x68')]('default_favicon.ico'));var _0x191080=_0xb8a5('0x6a')+_['upperFirst']('favicon');if(_0x1c47f0[_0x191080]||!_0x3a4e71[_0xb8a5('0x6c')]){_0x17bf81=path[_0xb8a5('0x66')](config['root'],_0x41de4c,_[_0xb8a5('0x68')]('default_favicon.ico'));}if(!fs[_0xb8a5('0x65')](_0x17bf81)){throw new db[(_0xb8a5('0x71'))][(_0xb8a5('0x6d'))](_[_0xb8a5('0x6b')](_0xb8a5('0x60'))+_0xb8a5('0x6e'));}return _0x24cd94[_0xb8a5('0x6f')](_0x17bf81);}})[_0xb8a5('0x29')](handleError(_0x24cd94,null));};exports[_0xb8a5('0x79')]=function(_0x4e0b94,_0x40bb5b){var _0x3ea911={'offset':moment()[_0xb8a5('0x7a')]()};_0x3ea911[_0xb8a5('0x7b')]=moment()[_0xb8a5('0x7a')](_0x3ea911['offset'])[_0xb8a5('0x7c')](_0xb8a5('0x7d'));return _0x40bb5b[_0xb8a5('0x2b')](0xc8)['send'](_0x3ea911);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 7f14fee..f609161 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 _0xd130=['Setting','settings','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0xc98c18,_0x4aecd0){var _0x1d4f6f=function(_0x36e666){while(--_0x36e666){_0xc98c18['push'](_0xc98c18['shift']());}};_0x1d4f6f(++_0x4aecd0);}(_0xd130,0x183));var _0x0d13=function(_0x272141,_0xc1016e){_0x272141=_0x272141-0x0;var _0x1ba809=_0xd130[_0x272141];return _0x1ba809;};'use strict';var _=require('lodash');var util=require(_0x0d13('0x0'));var logger=require(_0x0d13('0x1'))(_0x0d13('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0d13('0x3'));var fs=require('fs');var path=require(_0x0d13('0x4'));var rimraf=require(_0x0d13('0x5'));var config=require(_0x0d13('0x6'));var attributes=require(_0x0d13('0x7'));module[_0x0d13('0x8')]=function(_0x571063,_0x315355){return _0x571063['define'](_0x0d13('0x9'),attributes,{'tableName':_0x0d13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f10=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Setting','lodash','util','../../config/logger'];(function(_0x37a7b9,_0x3d7fe4){var _0x5d41d0=function(_0x39f89a){while(--_0x39f89a){_0x37a7b9['push'](_0x37a7b9['shift']());}};_0x5d41d0(++_0x3d7fe4);}(_0x6f10,0x1b7));var _0x06f1=function(_0x2d2dbf,_0x1deb90){_0x2d2dbf=_0x2d2dbf-0x0;var _0x54c782=_0x6f10[_0x2d2dbf];return _0x54c782;};'use strict';var _=require(_0x06f1('0x0'));var util=require(_0x06f1('0x1'));var logger=require(_0x06f1('0x2'))(_0x06f1('0x3'));var moment=require(_0x06f1('0x4'));var BPromise=require(_0x06f1('0x5'));var rp=require(_0x06f1('0x6'));var fs=require('fs');var path=require(_0x06f1('0x7'));var rimraf=require(_0x06f1('0x8'));var config=require(_0x06f1('0x9'));var attributes=require('./setting.attributes');module[_0x06f1('0xa')]=function(_0x52c982,_0x8f1440){return _0x52c982[_0x06f1('0xb')](_0x06f1('0xc'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index e4fd2ee..2aeacf5 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 _0x0f1e=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','Setting,\x20%s,\x20%s','result'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0x0f1e,0x13c));var _0xe0f1=function(_0x56418c,_0xd90668){_0x56418c=_0x56418c-0x0;var _0x1c838d=_0x0f1e[_0x56418c];return _0x1c838d;};'use strict';var _=require(_0xe0f1('0x0'));var util=require(_0xe0f1('0x1'));var moment=require(_0xe0f1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0f1('0x3'));var db=require(_0xe0f1('0x4'))['db'];var utils=require(_0xe0f1('0x5'));var logger=require(_0xe0f1('0x6'))(_0xe0f1('0x7'));var config=require(_0xe0f1('0x8'));var jayson=require(_0xe0f1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4225a5,_0x43fb96,_0x3aec5a){return new BPromise(function(_0x2469d9,_0x3033ed){return client[_0xe0f1('0xa')](_0x4225a5,_0x3aec5a)[_0xe0f1('0xb')](function(_0x318086){logger[_0xe0f1('0xc')]('Setting,\x20%s,\x20%s',_0x43fb96,'request\x20sent');logger['debug'](_0xe0f1('0xd'),_0x43fb96,_0xe0f1('0xe'),JSON['stringify'](_0x318086));if(_0x318086[_0xe0f1('0xf')]){if(_0x318086['error'][_0xe0f1('0x10')]===0x1f4){logger[_0xe0f1('0xf')]('Setting,\x20%s,\x20%s',_0x43fb96,_0x318086['error'][_0xe0f1('0x11')]);return _0x3033ed(_0x318086[_0xe0f1('0xf')][_0xe0f1('0x11')]);}logger[_0xe0f1('0xf')]('Setting,\x20%s,\x20%s',_0x43fb96,_0x318086[_0xe0f1('0xf')][_0xe0f1('0x11')]);return _0x2469d9(_0x318086[_0xe0f1('0xf')][_0xe0f1('0x11')]);}else{logger[_0xe0f1('0xc')](_0xe0f1('0x12'),_0x43fb96,_0xe0f1('0xe'));_0x2469d9(_0x318086[_0xe0f1('0x13')]['message']);}})[_0xe0f1('0x14')](function(_0x65b8bf){logger[_0xe0f1('0xf')](_0xe0f1('0x12'),_0x43fb96,_0x65b8bf);_0x3033ed(_0x65b8bf);});});} \ No newline at end of file +var _0x4025=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1e48a4,_0x4af3f6){var _0x352dd4=function(_0x35b400){while(--_0x35b400){_0x1e48a4['push'](_0x1e48a4['shift']());}};_0x352dd4(++_0x4af3f6);}(_0x4025,0xa9));var _0x5402=function(_0x1f868f,_0x68a40c){_0x1f868f=_0x1f868f-0x0;var _0x765bbc=_0x4025[_0x1f868f];return _0x765bbc;};'use strict';var _=require('lodash');var util=require(_0x5402('0x0'));var moment=require('moment');var BPromise=require(_0x5402('0x1'));var rs=require(_0x5402('0x2'));var fs=require('fs');var Redis=require(_0x5402('0x3'));var db=require(_0x5402('0x4'))['db'];var utils=require(_0x5402('0x5'));var logger=require(_0x5402('0x6'))('rpc');var config=require(_0x5402('0x7'));var jayson=require(_0x5402('0x8'));var client=jayson[_0x5402('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x854537,_0x1805db,_0x2095ef){return new BPromise(function(_0xb18358,_0x1a28c1){return client[_0x5402('0xa')](_0x854537,_0x2095ef)[_0x5402('0xb')](function(_0x236413){logger[_0x5402('0xc')](_0x5402('0xd'),_0x1805db,_0x5402('0xe'));logger[_0x5402('0xf')](_0x5402('0x10'),_0x1805db,_0x5402('0xe'),JSON[_0x5402('0x11')](_0x236413));if(_0x236413['error']){if(_0x236413[_0x5402('0x12')]['code']===0x1f4){logger[_0x5402('0x12')](_0x5402('0xd'),_0x1805db,_0x236413[_0x5402('0x12')][_0x5402('0x13')]);return _0x1a28c1(_0x236413[_0x5402('0x12')]['message']);}logger[_0x5402('0x12')](_0x5402('0xd'),_0x1805db,_0x236413['error'][_0x5402('0x13')]);return _0xb18358(_0x236413[_0x5402('0x12')][_0x5402('0x13')]);}else{logger[_0x5402('0xc')](_0x5402('0xd'),_0x1805db,_0x5402('0xe'));_0xb18358(_0x236413['result'][_0x5402('0x13')]);}})[_0x5402('0x14')](function(_0x10bed5){logger[_0x5402('0x12')](_0x5402('0xd'),_0x1805db,_0x10bed5);_0x1a28c1(_0x10bed5);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 9978788..59f5832 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 _0xa1cd=['describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/status','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','status','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0xa1cd,0x1c0));var _0xda1c=function(_0x1a9d8b,_0x4d5c2b){_0x1a9d8b=_0x1a9d8b-0x0;var _0x466424=_0xa1cd[_0x1a9d8b];return _0x466424;};'use strict';var multer=require(_0xda1c('0x0'));var util=require(_0xda1c('0x1'));var path=require(_0xda1c('0x2'));var timeout=require(_0xda1c('0x3'));var express=require('express');var router=express[_0xda1c('0x4')]();var fs_extra=require(_0xda1c('0x5'));var auth=require(_0xda1c('0x6'));var interaction=require(_0xda1c('0x7'));var config=require(_0xda1c('0x8'));var controller=require(_0xda1c('0x9'));router[_0xda1c('0xa')]('/',auth['isAuthenticated'](),controller[_0xda1c('0xb')]);router[_0xda1c('0xa')](_0xda1c('0xc'),auth[_0xda1c('0xd')](),controller[_0xda1c('0xe')]);router[_0xda1c('0xa')]('/:id',auth[_0xda1c('0xd')](),controller['show']);router[_0xda1c('0xa')](_0xda1c('0xf'),auth['isAuthenticated'](),controller[_0xda1c('0x10')]);router[_0xda1c('0xa')](_0xda1c('0x11'),auth[_0xda1c('0xd')](),controller[_0xda1c('0x12')]);router[_0xda1c('0xa')]('/:id/applications',auth[_0xda1c('0xd')](),controller[_0xda1c('0x13')]);router[_0xda1c('0xa')]('/:id/interactions',auth[_0xda1c('0xd')](),controller['getInteractions']);router[_0xda1c('0xa')](_0xda1c('0x14'),controller['statusGet']);router['get'](_0xda1c('0x15'),auth[_0xda1c('0xd')](),controller[_0xda1c('0x16')]);router[_0xda1c('0x17')]('/',auth[_0xda1c('0xd')](),controller[_0xda1c('0x18')]);router[_0xda1c('0x17')](_0xda1c('0xf'),auth[_0xda1c('0xd')](),controller[_0xda1c('0x19')]);router[_0xda1c('0x17')](_0xda1c('0x11'),auth[_0xda1c('0xd')](),controller[_0xda1c('0x1a')]);router[_0xda1c('0x17')](_0xda1c('0x1b'),controller[_0xda1c('0x1c')]);router['post'](_0xda1c('0x1d'),auth[_0xda1c('0xd')](),controller[_0xda1c('0x1e')]);router[_0xda1c('0x17')](_0xda1c('0x1f'),auth[_0xda1c('0xd')](),controller[_0xda1c('0x20')]);router[_0xda1c('0x17')](_0xda1c('0x14'),controller[_0xda1c('0x21')]);router[_0xda1c('0x17')](_0xda1c('0x15'),auth['isAuthenticated'](),controller['addAgents']);router[_0xda1c('0x22')](_0xda1c('0x23'),auth[_0xda1c('0xd')](),controller[_0xda1c('0x24')]);router[_0xda1c('0x25')](_0xda1c('0x23'),auth['isAuthenticated'](),controller[_0xda1c('0x26')]);router['delete']('/:id/dispositions',auth[_0xda1c('0xd')](),controller[_0xda1c('0x27')]);router[_0xda1c('0x25')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xda1c('0x28')]);router[_0xda1c('0x25')]('/:id/users',auth[_0xda1c('0xd')](),controller[_0xda1c('0x29')]);module['exports']=router; \ No newline at end of file +var _0x3880=['notify','addApplications','/:id/send','send','status','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify'];(function(_0x19713c,_0x5d8496){var _0x92d054=function(_0x43d723){while(--_0x43d723){_0x19713c['push'](_0x19713c['shift']());}};_0x92d054(++_0x5d8496);}(_0x3880,0x10a));var _0x0388=function(_0x450bef,_0x536212){_0x450bef=_0x450bef-0x0;var _0x334691=_0x3880[_0x450bef];return _0x334691;};'use strict';var multer=require('multer');var util=require(_0x0388('0x0'));var path=require(_0x0388('0x1'));var timeout=require(_0x0388('0x2'));var express=require('express');var router=express[_0x0388('0x3')]();var fs_extra=require(_0x0388('0x4'));var auth=require(_0x0388('0x5'));var interaction=require(_0x0388('0x6'));var config=require('../../config/environment');var controller=require(_0x0388('0x7'));router[_0x0388('0x8')]('/',auth[_0x0388('0x9')](),controller['index']);router['get'](_0x0388('0xa'),auth[_0x0388('0x9')](),controller[_0x0388('0xb')]);router[_0x0388('0x8')]('/:id',auth[_0x0388('0x9')](),controller[_0x0388('0xc')]);router['get'](_0x0388('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x0388('0x8')]('/:id/canned_answers',auth[_0x0388('0x9')](),controller[_0x0388('0xe')]);router[_0x0388('0x8')](_0x0388('0xf'),auth['isAuthenticated'](),controller[_0x0388('0x10')]);router[_0x0388('0x8')](_0x0388('0x11'),auth[_0x0388('0x9')](),controller[_0x0388('0x12')]);router[_0x0388('0x8')](_0x0388('0x13'),controller[_0x0388('0x14')]);router[_0x0388('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x0388('0x15')]);router[_0x0388('0x16')]('/',auth[_0x0388('0x9')](),controller[_0x0388('0x17')]);router[_0x0388('0x16')](_0x0388('0xd'),auth['isAuthenticated'](),controller[_0x0388('0x18')]);router[_0x0388('0x16')](_0x0388('0x19'),auth['isAuthenticated'](),controller[_0x0388('0x1a')]);router[_0x0388('0x16')](_0x0388('0x1b'),controller[_0x0388('0x1c')]);router[_0x0388('0x16')]('/:id/applications',auth[_0x0388('0x9')](),controller[_0x0388('0x1d')]);router[_0x0388('0x16')](_0x0388('0x1e'),auth[_0x0388('0x9')](),controller[_0x0388('0x1f')]);router[_0x0388('0x16')](_0x0388('0x13'),controller[_0x0388('0x20')]);router[_0x0388('0x16')]('/:id/users',auth[_0x0388('0x9')](),controller[_0x0388('0x21')]);router[_0x0388('0x22')](_0x0388('0x23'),auth[_0x0388('0x9')](),controller[_0x0388('0x24')]);router[_0x0388('0x25')]('/:id',auth[_0x0388('0x9')](),controller[_0x0388('0x26')]);router[_0x0388('0x25')](_0x0388('0xd'),auth[_0x0388('0x9')](),controller[_0x0388('0x27')]);router[_0x0388('0x25')](_0x0388('0x19'),auth[_0x0388('0x9')](),controller[_0x0388('0x28')]);router['delete']('/:id/users',auth[_0x0388('0x9')](),controller[_0x0388('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 3e0f86d..398355f 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 _0xb923=['clicksend','clickatell','bandwidth','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','generate','ENUM','skebby'];(function(_0x4d2411,_0x13ac78){var _0x50514d=function(_0xfaaf97){while(--_0xfaaf97){_0x4d2411['push'](_0x4d2411['shift']());}};_0x50514d(++_0x13ac78);}(_0xb923,0x80));var _0x3b92=function(_0x5390e7,_0x41a2d5){_0x5390e7=_0x5390e7-0x0;var _0x598df2=_0xb923[_0x5390e7];return _0x598df2;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x3b92('0x0')]={'name':{'type':Sequelize[_0x3b92('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x3b92('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x3b92('0x1')],'defaultValue':function(){return rs[_0x3b92('0x2')]();}},'phone':{'type':Sequelize[_0x3b92('0x1')]},'type':{'type':Sequelize[_0x3b92('0x3')]('twilio',_0x3b92('0x4'),'connectel',_0x3b92('0x5'),'plivo',_0x3b92('0x6'),_0x3b92('0x7'),'csc',_0x3b92('0x8'),_0x3b92('0x9'))},'accountSid':{'type':Sequelize[_0x3b92('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x3b92('0x1')]},'smsMethod':{'type':Sequelize[_0x3b92('0x3')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x3b92('0x1')]},'apiKey':{'type':Sequelize[_0x3b92('0x1')]},'applicationId':{'type':Sequelize[_0x3b92('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x3b92('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x3b92('0x1')]},'notificationTemplate':{'type':Sequelize[_0x3b92('0xa')],'defaultValue':function(){return _0x3b92('0xb');}},'notificationSound':{'type':Sequelize[_0x3b92('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3b92('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3b92('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3b92('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3b92('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3b92('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3b92('0xd')],'comment':_0x3b92('0xe')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3b92('0xf'),'set':function(_0x380923){if(!_0x380923)this[_0x3b92('0x10')](_0x3b92('0x11'),null);this[_0x3b92('0x10')](_0x3b92('0x12'),_0x380923);}}}; \ No newline at end of file +var _0x29a1=['clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby'];(function(_0x3e3d1b,_0x15ff28){var _0x7f5c5e=function(_0x291052){while(--_0x291052){_0x3e3d1b['push'](_0x3e3d1b['shift']());}};_0x7f5c5e(++_0x15ff28);}(_0x29a1,0x98));var _0x129a=function(_0x5ceffb,_0x38fa11){_0x5ceffb=_0x5ceffb-0x0;var _0x38cefe=_0x29a1[_0x5ceffb];return _0x38cefe;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x129a('0x0'));module[_0x129a('0x1')]={'name':{'type':Sequelize[_0x129a('0x2')],'unique':_0x129a('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x129a('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x129a('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x129a('0x2')],'defaultValue':function(){return rs[_0x129a('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x129a('0x5')](_0x129a('0x6'),_0x129a('0x7'),'connectel',_0x129a('0x8'),_0x129a('0x9'),_0x129a('0xa'),_0x129a('0xb'),'csc',_0x129a('0xc'),_0x129a('0xd'))},'accountSid':{'type':Sequelize[_0x129a('0x2')]},'authId':{'type':Sequelize[_0x129a('0x2')]},'authToken':{'type':Sequelize[_0x129a('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x129a('0x2')]},'password':{'type':Sequelize[_0x129a('0x2')]},'apiKey':{'type':Sequelize[_0x129a('0x2')]},'applicationId':{'type':Sequelize[_0x129a('0x2')]},'accountId':{'type':Sequelize[_0x129a('0x2')]},'senderString':{'type':Sequelize[_0x129a('0x2')]},'deliveryReport':{'type':Sequelize[_0x129a('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x129a('0xf');}},'notificationSound':{'type':Sequelize[_0x129a('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x129a('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x129a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x129a('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x129a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x129a('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x129a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x129a('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x129a('0x10')],'comment':_0x129a('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x129a('0x12'),'set':function(_0x2ae4bc){if(!_0x2ae4bc)this[_0x129a('0x13')]('mandatoryDispositionPauseId',null);this[_0x129a('0x13')]('mandatoryDisposition',_0x2ae4bc);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2fa6282..f4bcb1c 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 _0x8d4b=['SmsApplication','findAndCountAll','getApplications','getInteractions','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','infobip','groupName','redif','connectel','update','DELIVERED','RECEIVED_BY_RECIPIENT','bandwidth','message-delivered','DELIVRD','ACCEPTD','message-id','state','emit','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','reject','save','destroy','get','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','params','rawAttributes','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','create','getDispositions','findOne','Disposition','SmsAccountId','includeAll','removeDispositions','ids','CannedAnswer','removeAnswers','notify','applications','Applications','priority','asc','account','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','twilio','From','Body','skebby','from','sender','text','messageId','message_id','Text','MessageUUID','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','interaction','autoclose','push','close','unmanaged','created','SmsMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','Start','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','addApplications','sequelize','transaction'];(function(_0x2f922f,_0x34a14f){var _0x4a63d4=function(_0x251b57){while(--_0x251b57){_0x2f922f['push'](_0x2f922f['shift']());}};_0x4a63d4(++_0x34a14f);}(_0x8d4b,0x103));var _0xb8d4=function(_0x447998,_0x299092){_0x447998=_0x447998-0x0;var _0x2cc4a6=_0x8d4b[_0x447998];return _0x2cc4a6;};'use strict';var pdf=require(_0xb8d4('0x0'));var emlformat=require(_0xb8d4('0x1'));var rimraf=require(_0xb8d4('0x2'));var zipdir=require(_0xb8d4('0x3'));var jsonpatch=require(_0xb8d4('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb8d4('0x5'));var Mustache=require(_0xb8d4('0x6'));var util=require(_0xb8d4('0x7'));var path=require(_0xb8d4('0x8'));var sox=require(_0xb8d4('0x9'));var csv=require(_0xb8d4('0xa'));var ejs=require(_0xb8d4('0xb'));var fs=require('fs');var fs_extra=require(_0xb8d4('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb8d4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb8d4('0xe'));var toCsv=require(_0xb8d4('0xa'));var querystring=require(_0xb8d4('0xf'));var Papa=require('papaparse');var Redis=require(_0xb8d4('0x10'));var authService=require(_0xb8d4('0x11'));var qs=require(_0xb8d4('0x12'));var as=require(_0xb8d4('0x13'));var hardwareService=require(_0xb8d4('0x14'));var logger=require(_0xb8d4('0x15'))(_0xb8d4('0x16'));var utils=require(_0xb8d4('0x17'));var config=require(_0xb8d4('0x18'));var licenseUtil=require(_0xb8d4('0x19'));var db=require(_0xb8d4('0x1a'))['db'];config['redis']=_[_0xb8d4('0x1b')](config[_0xb8d4('0x1c')],{'host':_0xb8d4('0x1d'),'port':0x18eb});var socket=require(_0xb8d4('0x1e'))(new Redis(config[_0xb8d4('0x1c')]));require(_0xb8d4('0x1f'))[_0xb8d4('0x20')](socket);var jayson=require(_0xb8d4('0x21'));var client=jayson['client'][_0xb8d4('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x49d91e,_0x5729ae,_0x2a67a4,_0x219267){return new BPromise(function(_0x827847,_0x43eddf){var _0x558efc=_0x219267||client;return _0x558efc[_0xb8d4('0x23')](_0x49d91e,_0x2a67a4)[_0xb8d4('0x24')](function(_0x2f57d3){logger[_0xb8d4('0x25')](_0xb8d4('0x26'),_0x5729ae,_0xb8d4('0x27'));logger[_0xb8d4('0x28')](_0xb8d4('0x29'),_0x5729ae,_0xb8d4('0x27'),JSON[_0xb8d4('0x2a')](_0x2f57d3));if(_0x2f57d3[_0xb8d4('0x2b')]){if(_0x2f57d3[_0xb8d4('0x2b')][_0xb8d4('0x2c')]===0x1f4){logger['error'](_0xb8d4('0x26'),_0x5729ae,_0x2f57d3[_0xb8d4('0x2b')][_0xb8d4('0x2d')]);return _0x43eddf(_0x2f57d3[_0xb8d4('0x2b')][_0xb8d4('0x2d')]);}logger['error'](_0xb8d4('0x26'),_0x5729ae,_0x2f57d3[_0xb8d4('0x2b')][_0xb8d4('0x2d')]);return _0x827847(_0x2f57d3[_0xb8d4('0x2b')][_0xb8d4('0x2d')]);}else{logger[_0xb8d4('0x25')](_0xb8d4('0x26'),_0x5729ae,_0xb8d4('0x27'));_0x827847(_0x2f57d3[_0xb8d4('0x2e')]['message']);}})[_0xb8d4('0x2f')](function(_0x555f6f){logger[_0xb8d4('0x2b')](_0xb8d4('0x26'),_0x5729ae,_0x555f6f);_0x43eddf(_0x555f6f);});});}function respondWithStatusCode(_0x586e6d,_0xadbe5e){_0xadbe5e=_0xadbe5e||0xcc;return function(_0x170438){if(_0x170438){return _0x586e6d[_0xb8d4('0x30')](_0xadbe5e);}return _0x586e6d[_0xb8d4('0x31')](_0xadbe5e)[_0xb8d4('0x32')]();};}function respondWithResult(_0x4bcbda,_0x2d6680){_0x2d6680=_0x2d6680||0xc8;return function(_0x280a2c){if(_0x280a2c){return _0x4bcbda[_0xb8d4('0x31')](_0x2d6680)['json'](_0x280a2c);}};}function respondWithFilteredResult(_0x324949,_0x28c233){return function(_0x3a65c5){if(_0x3a65c5){var _0x3c3d12=_0x3a65c5[_0xb8d4('0x33')],_0x55ea61=_0x28c233['offset'],_0x2c033a=_0x28c233[_0xb8d4('0x34')]+_0x28c233[_0xb8d4('0x35')],_0x2a3c66;if(_0x2c033a>=_0x3c3d12){_0x2c033a=_0x3c3d12;_0x2a3c66=0xc8;}else{_0x2a3c66=0xce;}_0x324949[_0xb8d4('0x31')](_0x2a3c66);return _0x324949[_0xb8d4('0x36')]('Content-Range',_0x55ea61+'-'+_0x2c033a+'/'+_0x3c3d12)[_0xb8d4('0x37')](_0x3a65c5);}return null;};}function patchUpdates(_0x5e814e){return function(_0x26a2c4){try{jsonpatch['apply'](_0x26a2c4,_0x5e814e,!![]);}catch(_0x48915a){return BPromise[_0xb8d4('0x38')](_0x48915a);}return _0x26a2c4[_0xb8d4('0x39')]();};}function saveUpdates(_0x10d9b8,_0x4b170e){return function(_0x5af2e1){if(_0x5af2e1){return _0x5af2e1['update'](_0x10d9b8)[_0xb8d4('0x24')](function(_0x5ac91f){return _0x5ac91f;});}return null;};}function removeEntity(_0x4ab74f,_0x21d143){return function(_0x5283d1){if(_0x5283d1){return _0x5283d1[_0xb8d4('0x3a')]()['then'](function(){var _0x1b79a9=_0x5283d1[_0xb8d4('0x3b')]({'plain':!![]});var _0x30c86b='SmsAccounts';return db[_0xb8d4('0x3c')]['destroy']({'where':{'type':_0x30c86b,'resourceId':_0x1b79a9['id']}})[_0xb8d4('0x24')](function(){return _0x5283d1;});})[_0xb8d4('0x24')](function(){_0x4ab74f[_0xb8d4('0x31')](0xcc)[_0xb8d4('0x32')]();});}};}function handleEntityNotFound(_0x1fc857,_0x4b4c4b){return function(_0x23895e){if(!_0x23895e){_0x1fc857['sendStatus'](0x194);}return _0x23895e;};}function handleError(_0x28a82d,_0x40071b){_0x40071b=_0x40071b||0x1f4;return function(_0xcd499d){logger['error'](_0xcd499d['stack']);if(_0xcd499d[_0xb8d4('0x3d')]){delete _0xcd499d[_0xb8d4('0x3d')];}_0x28a82d['status'](_0x40071b)[_0xb8d4('0x3e')](_0xcd499d);};}exports['index']=function(_0x6f86ae,_0x5ade26){var _0x46f7fd={'include':[{'model':db[_0xb8d4('0x3f')],'as':_0xb8d4('0x40')}]},_0x29b722={},_0x2db4b3={'count':0x0,'rows':[]};var _0x14fa83=_[_0xb8d4('0x41')](db[_0xb8d4('0x42')]['rawAttributes'],function(_0x3e7e82){return{'name':_0x3e7e82[_0xb8d4('0x43')],'type':_0x3e7e82[_0xb8d4('0x44')]['key']};});_0x29b722[_0xb8d4('0x45')]=_[_0xb8d4('0x41')](_0x14fa83,_0xb8d4('0x3d'));_0x29b722[_0xb8d4('0x46')]=_[_0xb8d4('0x47')](_0x6f86ae[_0xb8d4('0x46')]);_0x29b722[_0xb8d4('0x48')]=_[_0xb8d4('0x49')](_0x29b722['model'],_0x29b722[_0xb8d4('0x46')]);_0x46f7fd['attributes']=_['intersection'](_0x29b722[_0xb8d4('0x45')],qs[_0xb8d4('0x4a')](_0x6f86ae['query'][_0xb8d4('0x4a')]));_0x46f7fd[_0xb8d4('0x4b')]=_0x46f7fd['attributes'][_0xb8d4('0x4c')]?_0x46f7fd[_0xb8d4('0x4b')]:_0x29b722['model'];if(!_0x6f86ae[_0xb8d4('0x46')][_0xb8d4('0x4d')](_0xb8d4('0x4e'))){_0x46f7fd[_0xb8d4('0x35')]=qs['limit'](_0x6f86ae[_0xb8d4('0x46')][_0xb8d4('0x35')]);_0x46f7fd['offset']=qs[_0xb8d4('0x34')](_0x6f86ae['query']['offset']);}_0x46f7fd[_0xb8d4('0x4f')]=qs[_0xb8d4('0x50')](_0x6f86ae[_0xb8d4('0x46')][_0xb8d4('0x50')]);_0x46f7fd['where']=qs[_0xb8d4('0x48')](_[_0xb8d4('0x51')](_0x6f86ae[_0xb8d4('0x46')],_0x29b722[_0xb8d4('0x48')]),_0x14fa83);if(_0x6f86ae[_0xb8d4('0x46')]['filter']){_0x46f7fd['where']=_[_0xb8d4('0x52')](_0x46f7fd[_0xb8d4('0x53')],{'$or':_[_0xb8d4('0x41')](_0x14fa83,function(_0x57cff0){if(_0x57cff0[_0xb8d4('0x44')]!==_0xb8d4('0x54')){var _0x34a45e={};_0x34a45e[_0x57cff0[_0xb8d4('0x3d')]]={'$like':'%'+_0x6f86ae[_0xb8d4('0x46')][_0xb8d4('0x55')]+'%'};return _0x34a45e;}})});}_0x46f7fd=_['merge']({},_0x46f7fd,_0x6f86ae[_0xb8d4('0x56')]);var _0x522189={'where':_0x46f7fd['where']};return db[_0xb8d4('0x42')][_0xb8d4('0x33')](_0x522189)[_0xb8d4('0x24')](function(_0x577f5f){_0x2db4b3['count']=_0x577f5f;if(_0x6f86ae[_0xb8d4('0x46')]['includeAll']){_0x46f7fd[_0xb8d4('0x57')]=[{'all':!![]}];}return db[_0xb8d4('0x42')][_0xb8d4('0x58')](_0x46f7fd);})['then'](function(_0x1145f5){_0x2db4b3[_0xb8d4('0x59')]=_0x1145f5;return _0x2db4b3;})[_0xb8d4('0x24')](respondWithFilteredResult(_0x5ade26,_0x46f7fd))[_0xb8d4('0x2f')](handleError(_0x5ade26,null));};exports['show']=function(_0x372743,_0x111c8d){var _0x5d9539={'raw':![],'where':{'id':_0x372743[_0xb8d4('0x5a')]['id']},'include':[{'model':db[_0xb8d4('0x3f')],'as':'mandatoryDispositionPause'}]},_0x561821={};_0x561821[_0xb8d4('0x45')]=_[_0xb8d4('0x47')](db[_0xb8d4('0x42')][_0xb8d4('0x5b')]);_0x561821[_0xb8d4('0x46')]=_[_0xb8d4('0x47')](_0x372743[_0xb8d4('0x46')]);_0x561821['filters']=_[_0xb8d4('0x49')](_0x561821[_0xb8d4('0x45')],_0x561821[_0xb8d4('0x46')]);_0x5d9539[_0xb8d4('0x4b')]=_['intersection'](_0x561821[_0xb8d4('0x45')],qs[_0xb8d4('0x4a')](_0x372743[_0xb8d4('0x46')]['fields']));_0x5d9539['attributes']=_0x5d9539[_0xb8d4('0x4b')]['length']?_0x5d9539[_0xb8d4('0x4b')]:_0x561821[_0xb8d4('0x45')];if(_0x372743['query']['includeAll']){_0x5d9539[_0xb8d4('0x57')]=[{'all':!![]}];}_0x5d9539=_[_0xb8d4('0x52')]({},_0x5d9539,_0x372743[_0xb8d4('0x56')]);return db[_0xb8d4('0x42')][_0xb8d4('0x5c')](_0x5d9539)[_0xb8d4('0x24')](handleEntityNotFound(_0x111c8d,null))['then'](respondWithResult(_0x111c8d,null))[_0xb8d4('0x2f')](handleError(_0x111c8d,null));};exports['create']=function(_0x57bb49,_0x35a541){return db[_0xb8d4('0x42')]['create'](_0x57bb49['body'],{})['then'](function(_0x186d7b){var _0x41e8d6=_0x57bb49[_0xb8d4('0x5d')][_0xb8d4('0x3b')]({'plain':!![]});if(!_0x41e8d6)throw new Error(_0xb8d4('0x5e'));if(_0x41e8d6[_0xb8d4('0x5f')]===_0xb8d4('0x5d')){var _0x2ef957=_0x186d7b['get']({'plain':!![]});var _0x16f15d='SmsAccounts';return db[_0xb8d4('0x60')][_0xb8d4('0x5c')]({'where':{'name':_0x16f15d,'userProfileId':_0x41e8d6['userProfileId']},'raw':!![]})[_0xb8d4('0x24')](function(_0x2bdf20){if(_0x2bdf20&&_0x2bdf20[_0xb8d4('0x61')]===0x0){return db[_0xb8d4('0x3c')]['create']({'name':_0x2ef957[_0xb8d4('0x3d')],'resourceId':_0x2ef957['id'],'type':_0x2bdf20[_0xb8d4('0x3d')],'sectionId':_0x2bdf20['id']},{})['then'](function(){return _0x186d7b;});}else{return _0x186d7b;}})[_0xb8d4('0x2f')](function(_0x43617f){logger['error'](_0xb8d4('0x62'),_0x43617f);throw _0x43617f;});}return _0x186d7b;})[_0xb8d4('0x24')](respondWithResult(_0x35a541,0xc9))[_0xb8d4('0x2f')](handleError(_0x35a541,null));};exports['update']=function(_0x5cc5ea,_0x5c58d5){if(_0x5cc5ea[_0xb8d4('0x63')]['id']){delete _0x5cc5ea[_0xb8d4('0x63')]['id'];}return db[_0xb8d4('0x42')][_0xb8d4('0x5c')]({'where':{'id':_0x5cc5ea['params']['id']},'include':[{'model':db[_0xb8d4('0x3f')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x5c58d5,null))[_0xb8d4('0x24')](saveUpdates(_0x5cc5ea[_0xb8d4('0x63')],null))[_0xb8d4('0x24')](respondWithResult(_0x5c58d5,null))[_0xb8d4('0x2f')](handleError(_0x5c58d5,null));};exports[_0xb8d4('0x3a')]=function(_0x20d880,_0x2cf3aa){return db[_0xb8d4('0x42')]['find']({'where':{'id':_0x20d880[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x2cf3aa,null))['then'](removeEntity(_0x2cf3aa,null))[_0xb8d4('0x2f')](handleError(_0x2cf3aa,null));};exports['describe']=function(_0x467edb,_0x7856bb){return db[_0xb8d4('0x42')][_0xb8d4('0x64')]()[_0xb8d4('0x24')](respondWithResult(_0x7856bb,null))[_0xb8d4('0x2f')](handleError(_0x7856bb,null));};exports[_0xb8d4('0x65')]=function(_0x36032f,_0x1beec7,_0x375211){if(_0x36032f['body']['id']){delete _0x36032f[_0xb8d4('0x63')]['id'];}return db[_0xb8d4('0x42')][_0xb8d4('0x5c')]({'where':{'id':_0x36032f[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x1beec7,null))[_0xb8d4('0x24')](function(_0x1579e3){if(_0x1579e3){_0x36032f[_0xb8d4('0x63')]['SmsAccountId']=_0x1579e3['id'];return db['Disposition'][_0xb8d4('0x66')](_0x36032f[_0xb8d4('0x63')]);}})[_0xb8d4('0x24')](respondWithResult(_0x1beec7,null))[_0xb8d4('0x2f')](handleError(_0x1beec7,null));};exports[_0xb8d4('0x67')]=function(_0x5d04d9,_0x19c33e,_0x485ceb){var _0x2603c9={'raw':![],'where':{}};var _0x18dc15={};var _0x20b40b={'count':0x0,'rows':[]};return db[_0xb8d4('0x42')][_0xb8d4('0x68')]({'where':{'id':_0x5d04d9[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x19c33e,null))['then'](function(_0x1aa9db){if(_0x1aa9db){_0x18dc15['model']=_[_0xb8d4('0x47')](db[_0xb8d4('0x69')][_0xb8d4('0x5b')]);_0x18dc15['query']=_[_0xb8d4('0x47')](_0x5d04d9[_0xb8d4('0x46')]);_0x18dc15[_0xb8d4('0x48')]=_[_0xb8d4('0x49')](_0x18dc15[_0xb8d4('0x45')],_0x18dc15['query']);_0x2603c9[_0xb8d4('0x4b')]=_[_0xb8d4('0x49')](_0x18dc15[_0xb8d4('0x45')],qs[_0xb8d4('0x4a')](_0x5d04d9['query'][_0xb8d4('0x4a')]));_0x2603c9[_0xb8d4('0x4b')]=_0x2603c9[_0xb8d4('0x4b')][_0xb8d4('0x4c')]?_0x2603c9[_0xb8d4('0x4b')]:_0x18dc15['model'];if(!_0x5d04d9['query']['hasOwnProperty'](_0xb8d4('0x4e'))){_0x2603c9[_0xb8d4('0x35')]=qs[_0xb8d4('0x35')](_0x5d04d9[_0xb8d4('0x46')][_0xb8d4('0x35')]);_0x2603c9['offset']=qs[_0xb8d4('0x34')](_0x5d04d9['query'][_0xb8d4('0x34')]);}_0x2603c9[_0xb8d4('0x4f')]=qs[_0xb8d4('0x50')](_0x5d04d9[_0xb8d4('0x46')][_0xb8d4('0x50')]);_0x2603c9[_0xb8d4('0x53')]=qs['filters'](_['pick'](_0x5d04d9[_0xb8d4('0x46')],_0x18dc15[_0xb8d4('0x48')]));_0x2603c9[_0xb8d4('0x53')][_0xb8d4('0x6a')]=_0x1aa9db['id'];if(_0x5d04d9[_0xb8d4('0x46')][_0xb8d4('0x55')]){_0x2603c9[_0xb8d4('0x53')]=_[_0xb8d4('0x52')](_0x2603c9[_0xb8d4('0x53')],{'$or':_[_0xb8d4('0x41')](_0x2603c9[_0xb8d4('0x4b')],function(_0x3d179d){var _0x295ba2={};_0x295ba2[_0x3d179d]={'$like':'%'+_0x5d04d9[_0xb8d4('0x46')]['filter']+'%'};return _0x295ba2;})});}_0x2603c9=_['merge']({},_0x2603c9,_0x5d04d9[_0xb8d4('0x56')]);return db[_0xb8d4('0x69')][_0xb8d4('0x33')]({'where':_0x2603c9['where']})[_0xb8d4('0x24')](function(_0x5962e8){_0x20b40b[_0xb8d4('0x33')]=_0x5962e8;if(_0x5d04d9['query'][_0xb8d4('0x6b')]){_0x2603c9[_0xb8d4('0x57')]=[{'all':!![]}];}return db['Disposition'][_0xb8d4('0x58')](_0x2603c9);})[_0xb8d4('0x24')](function(_0x171bf6){_0x20b40b[_0xb8d4('0x59')]=_0x171bf6;return _0x20b40b;});}})[_0xb8d4('0x24')](respondWithFilteredResult(_0x19c33e,_0x2603c9))[_0xb8d4('0x2f')](handleError(_0x19c33e,null));};exports[_0xb8d4('0x6c')]=function(_0x5e2e4a,_0x14863a,_0x631401){return db[_0xb8d4('0x42')]['find']({'where':{'id':_0x5e2e4a[_0xb8d4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x14863a,null))['then'](function(_0x1cc4e){if(_0x1cc4e){return _0x1cc4e[_0xb8d4('0x6c')](_0x5e2e4a['query'][_0xb8d4('0x6d')]);}})[_0xb8d4('0x24')](respondWithStatusCode(_0x14863a,null))['catch'](handleError(_0x14863a,null));};exports['addAnswer']=function(_0x3e6518,_0x4a1b60,_0x4bf6c4){if(_0x3e6518[_0xb8d4('0x63')]['id']){delete _0x3e6518['body']['id'];}return db['SmsAccount'][_0xb8d4('0x5c')]({'where':{'id':_0x3e6518['params']['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x4a1b60,null))[_0xb8d4('0x24')](function(_0x1e9362){if(_0x1e9362){_0x3e6518[_0xb8d4('0x63')][_0xb8d4('0x6a')]=_0x1e9362['id'];return db[_0xb8d4('0x6e')][_0xb8d4('0x66')](_0x3e6518['body']);}})[_0xb8d4('0x24')](respondWithResult(_0x4a1b60,null))[_0xb8d4('0x2f')](handleError(_0x4a1b60,null));};exports['getAnswers']=function(_0x27d087,_0x3c9e28,_0x3e1c3a){var _0x42ae79={'raw':![],'where':{}};var _0x1dbe56={};var _0x47d87b={'count':0x0,'rows':[]};return db[_0xb8d4('0x42')][_0xb8d4('0x68')]({'where':{'id':_0x27d087[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x3c9e28,null))['then'](function(_0x4d62b4){if(_0x4d62b4){_0x1dbe56['model']=_['keys'](db['CannedAnswer'][_0xb8d4('0x5b')]);_0x1dbe56[_0xb8d4('0x46')]=_[_0xb8d4('0x47')](_0x27d087['query']);_0x1dbe56[_0xb8d4('0x48')]=_['intersection'](_0x1dbe56[_0xb8d4('0x45')],_0x1dbe56[_0xb8d4('0x46')]);_0x42ae79[_0xb8d4('0x4b')]=_[_0xb8d4('0x49')](_0x1dbe56[_0xb8d4('0x45')],qs['fields'](_0x27d087[_0xb8d4('0x46')][_0xb8d4('0x4a')]));_0x42ae79[_0xb8d4('0x4b')]=_0x42ae79[_0xb8d4('0x4b')]['length']?_0x42ae79[_0xb8d4('0x4b')]:_0x1dbe56[_0xb8d4('0x45')];if(!_0x27d087[_0xb8d4('0x46')]['hasOwnProperty'](_0xb8d4('0x4e'))){_0x42ae79[_0xb8d4('0x35')]=qs[_0xb8d4('0x35')](_0x27d087[_0xb8d4('0x46')][_0xb8d4('0x35')]);_0x42ae79['offset']=qs[_0xb8d4('0x34')](_0x27d087[_0xb8d4('0x46')]['offset']);}_0x42ae79[_0xb8d4('0x4f')]=qs[_0xb8d4('0x50')](_0x27d087['query'][_0xb8d4('0x50')]);_0x42ae79[_0xb8d4('0x53')]=qs['filters'](_[_0xb8d4('0x51')](_0x27d087['query'],_0x1dbe56[_0xb8d4('0x48')]));_0x42ae79[_0xb8d4('0x53')][_0xb8d4('0x6a')]=_0x4d62b4['id'];if(_0x27d087[_0xb8d4('0x46')][_0xb8d4('0x55')]){_0x42ae79[_0xb8d4('0x53')]=_[_0xb8d4('0x52')](_0x42ae79['where'],{'$or':_['map'](_0x42ae79['attributes'],function(_0x54de4a){var _0x177a32={};_0x177a32[_0x54de4a]={'$like':'%'+_0x27d087[_0xb8d4('0x46')][_0xb8d4('0x55')]+'%'};return _0x177a32;})});}_0x42ae79=_[_0xb8d4('0x52')]({},_0x42ae79,_0x27d087[_0xb8d4('0x56')]);return db[_0xb8d4('0x6e')][_0xb8d4('0x33')]({'where':_0x42ae79[_0xb8d4('0x53')]})[_0xb8d4('0x24')](function(_0x391ccd){_0x47d87b[_0xb8d4('0x33')]=_0x391ccd;if(_0x27d087[_0xb8d4('0x46')][_0xb8d4('0x6b')]){_0x42ae79[_0xb8d4('0x57')]=[{'all':!![]}];}return db[_0xb8d4('0x6e')][_0xb8d4('0x58')](_0x42ae79);})[_0xb8d4('0x24')](function(_0x27632b){_0x47d87b[_0xb8d4('0x59')]=_0x27632b;return _0x47d87b;});}})[_0xb8d4('0x24')](respondWithFilteredResult(_0x3c9e28,_0x42ae79))['catch'](handleError(_0x3c9e28,null));};exports[_0xb8d4('0x6f')]=function(_0x189a30,_0x274ad2,_0x14c7b6){return db[_0xb8d4('0x42')][_0xb8d4('0x5c')]({'where':{'id':_0x189a30[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x274ad2,null))[_0xb8d4('0x24')](function(_0x1e27a7){if(_0x1e27a7){return _0x1e27a7[_0xb8d4('0x6f')](_0x189a30['query'][_0xb8d4('0x6d')]);}})[_0xb8d4('0x24')](respondWithStatusCode(_0x274ad2,null))[_0xb8d4('0x2f')](handleError(_0x274ad2,null));};exports[_0xb8d4('0x70')]=function(_0x9b0f80,_0x2aa0e3,_0x3f516b){var _0x310dd5={'channel':'sms'};var _0x3af4e9=[];var _0x447ce6=[];var _0xe281b0={};return db[_0xb8d4('0x42')][_0xb8d4('0x5c')]({'where':{'id':_0x9b0f80['params']['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x2aa0e3,null))['then'](function(_0x507ab3){_0x310dd5['account']=_0x507ab3;_0x310dd5[_0xb8d4('0x71')]=_['orderBy'](_0x507ab3[_0xb8d4('0x72')],[_0xb8d4('0x73')],[_0xb8d4('0x74')]);if(_0x310dd5[_0xb8d4('0x75')][_0xb8d4('0x72')]){delete _0x310dd5[_0xb8d4('0x75')][_0xb8d4('0x72')];}return db[_0xb8d4('0x76')][_0xb8d4('0x64')]();})[_0xb8d4('0x24')](function(_0x276c16){if(!_0x276c16){throw new db[(_0xb8d4('0x77'))]['ValidationError']('no\x20available\x20attributes');}_0x3af4e9=_[_0xb8d4('0x78')](_[_0xb8d4('0x47')](_0x276c16),[_0xb8d4('0x79'),_0xb8d4('0x7a')]);_0x447ce6=_[_0xb8d4('0x78')](_['keys'](_0x276c16),[_0xb8d4('0x79'),'updatedAt',_0xb8d4('0x7b'),_0xb8d4('0x7c')]);_0x310dd5[_0xb8d4('0x63')]={'mapKey':'mobile'};if(_0x310dd5['account'][_0xb8d4('0x44')]){switch(_0x310dd5[_0xb8d4('0x75')][_0xb8d4('0x44')]){case _0xb8d4('0x7d'):_0x310dd5['body']['from']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x7e')];_0x310dd5[_0xb8d4('0x63')]['body']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x7f')];_0x310dd5['body']['messageId']=_0x9b0f80[_0xb8d4('0x63')]['MessageSid'];break;case _0xb8d4('0x80'):_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')]='+'+_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x82')];_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x63')]=_0x9b0f80['body'][_0xb8d4('0x83')];break;case'connectel':_0x310dd5[_0xb8d4('0x63')]['from']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x81')];_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x63')]=_0x9b0f80[_0xb8d4('0x63')]['message'];break;case'clicksend':_0x310dd5['body'][_0xb8d4('0x81')]=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x81')];_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x63')]=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x63')];_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x84')]=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x85')];break;case'plivo':_0x310dd5[_0xb8d4('0x63')]['from']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x7e')];_0x310dd5['body']['body']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x86')];_0x310dd5[_0xb8d4('0x63')]['messageId']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x87')];break;case'infobip':_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')]='+'+_0x9b0f80['body'][_0xb8d4('0x88')][0x0][_0xb8d4('0x81')];_0x310dd5['body'][_0xb8d4('0x63')]=_0x9b0f80['body'][_0xb8d4('0x88')][0x0][_0xb8d4('0x83')];_0x310dd5['body'][_0xb8d4('0x84')]=_0x9b0f80[_0xb8d4('0x63')]['results'][0x0][_0xb8d4('0x84')];break;case _0xb8d4('0x89'):_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')]=_0x9b0f80[_0xb8d4('0x63')]['originatingAddress'];_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x63')]=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x8a')][_0xb8d4('0x2d')];break;case _0xb8d4('0x8b'):_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')]=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x8c')];_0x310dd5[_0xb8d4('0x63')]['body']=_0x9b0f80['body'][_0xb8d4('0x83')];_0x310dd5['body'][_0xb8d4('0x84')]=_0x9b0f80['body'][_0xb8d4('0x8d')];break;case'bandwidth':_0x310dd5['body'][_0xb8d4('0x84')]=_0x9b0f80[_0xb8d4('0x63')][0x0]['message']['id'];_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')]=_0x9b0f80[_0xb8d4('0x63')][0x0]['message'][_0xb8d4('0x81')];_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x63')]=_0x9b0f80['body'][0x0][_0xb8d4('0x2d')][_0xb8d4('0x83')];break;case _0xb8d4('0x8e'):_0x310dd5['body'][_0xb8d4('0x81')]=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x81')];_0x310dd5[_0xb8d4('0x63')]['body']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x2d')];_0x310dd5[_0xb8d4('0x63')]['messageId']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x8f')];break;}}if(_0x310dd5[_0xb8d4('0x63')]['id']){delete _0x310dd5[_0xb8d4('0x63')]['id'];}if(_[_0xb8d4('0x90')](_0x310dd5[_0xb8d4('0x63')]['from'])){throw new db[(_0xb8d4('0x77'))][(_0xb8d4('0x91'))](_0xb8d4('0x92'));}if(_[_0xb8d4('0x90')](_0x310dd5['body'][_0xb8d4('0x63')])||_0x310dd5['body'][_0xb8d4('0x63')]===''){throw new db['Sequelize'][(_0xb8d4('0x91'))](_0xb8d4('0x93'));}if(_[_0xb8d4('0x90')](_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x94')])){throw new db[(_0xb8d4('0x77'))][(_0xb8d4('0x91'))](_0xb8d4('0x95')+_0x447ce6);}if(!_[_0xb8d4('0x96')](_0x447ce6,_0x310dd5['body'][_0xb8d4('0x94')])){throw new db['Sequelize'][(_0xb8d4('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x447ce6);}_0xe281b0[_0x310dd5[_0xb8d4('0x63')]['mapKey']]=_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')];return db[_0xb8d4('0x97')]['find']({'where':{'id':_0x310dd5[_0xb8d4('0x75')][_0xb8d4('0x7c')]},'include':[{'model':db[_0xb8d4('0x76')],'as':'Contacts','where':_0xe281b0,'limit':0x1,'order':[[_0xb8d4('0x7a'),_0xb8d4('0x98')]]}]});})['then'](handleEntityNotFound(_0x2aa0e3,null))['then'](function(_0xc322a6){if(_0xc322a6){_0x310dd5[_0xb8d4('0x99')]=_[_0xb8d4('0x9a')](_0xc322a6,[_0xb8d4('0x9b')]);if(_0xc322a6['Contacts'][_0xb8d4('0x4c')]){return _0xc322a6[_0xb8d4('0x9b')][0x0];}var _0x18a410=_['defaults'](_0x310dd5[_0xb8d4('0x63')],{'firstName':_0x310dd5['body'][_0xb8d4('0x81')],'ListId':_0xc322a6['id']});_0x18a410[_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x94')]]=_0x310dd5[_0xb8d4('0x63')]['from'];return db[_0xb8d4('0x76')]['create'](_0x18a410,{'fields':_0x3af4e9,'raw':!![]});}})[_0xb8d4('0x24')](handleEntityNotFound(_0x2aa0e3,null))[_0xb8d4('0x24')](function(_0x106496){if(_0x106496){_0x310dd5[_0xb8d4('0x9c')]=_0x106496;var _0x3a0048={'ContactId':_0x106496['id'],'phone':_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')],'SmsAccountId':_0x9b0f80[_0xb8d4('0x5a')]['id']};var _0x2ed70a={'ContactId':_0x106496['id'],'SmsAccountId':_0x9b0f80[_0xb8d4('0x5a')]['id'],'closed':![]};return db[_0xb8d4('0x9d')]['find']({'where':_0x2ed70a})[_0xb8d4('0x24')](function(_0x113d9d){if(_0x113d9d){return[_0x113d9d,![]];}return db[_0xb8d4('0x9d')]['create'](_0x3a0048)['then'](function(_0x1665ba){return[_0x1665ba,!![]];});});}})['spread'](function(_0x269322,_0x5eb7fe){_0x310dd5['interaction']=_0x269322[_0xb8d4('0x3b')]({'plain':!![]});_0x310dd5[_0xb8d4('0x9e')]['created']=![];if(_0x5eb7fe){if(_0x310dd5[_0xb8d4('0x75')][_0xb8d4('0x9f')]){_0x310dd5[_0xb8d4('0x71')][_0xb8d4('0xa0')]({'id':0x0,'priority':_0x310dd5[_0xb8d4('0x71')]['length']+0x1,'app':_0xb8d4('0xa1'),'appdata':_0xb8d4('0xa2'),'interval':'*,*,*,*'});}_0x310dd5[_0xb8d4('0x9e')][_0xb8d4('0xa3')]=!![];}return db[_0xb8d4('0xa4')][_0xb8d4('0x66')]({'phone':_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')],'messageId':_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x84')],'body':_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x63')],'SmsAccountId':_0x9b0f80[_0xb8d4('0x5a')]['id'],'SmsInteractionId':_0x269322['id'],'direction':'in','ContactId':_0x269322['ContactId'],'AttachmentId':_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0xa5')]});})[_0xb8d4('0x24')](function(_0x183cb1){_0x310dd5[_0xb8d4('0x2d')]=_0x183cb1;if(_0x310dd5['interaction'][_0xb8d4('0xa6')]){return db[_0xb8d4('0xa7')][_0xb8d4('0x5c')]({'attributes':['id',_0xb8d4('0x3d')],'where':{'id':_0x310dd5[_0xb8d4('0x9e')][_0xb8d4('0xa6')]}})[_0xb8d4('0x24')](function(_0x130519){if(_0x130519){_0x310dd5[_0xb8d4('0x71')][_0xb8d4('0xa8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x130519[_0xb8d4('0x3d')]+','+(_0x310dd5[_0xb8d4('0x75')][_0xb8d4('0xa9')]||0xa),'interval':_0xb8d4('0xaa')});}return respondWithRpcPromise(_0xb8d4('0xab'),'startRouting',_0x310dd5);});}return respondWithRpcPromise(_0xb8d4('0xab'),'startRouting',_0x310dd5);})['then'](function(_0x38f82b){if(_0x38f82b){var _0x46ea24=0xc8;var _0xb0016='receiveMessage';logger['info'](_0xb8d4('0x29'),_0xb0016,_0x46ea24,_0xb8d4('0xac'));logger[_0xb8d4('0x28')](_0xb8d4('0xad'),_0xb0016,_0x46ea24,_0xb8d4('0xac'),JSON['stringify'](_0x38f82b));if(_0x310dd5[_0xb8d4('0x75')][_0xb8d4('0x44')]==='twilio'){return _0x2aa0e3[_0xb8d4('0x31')](_0x46ea24)[_0xb8d4('0x36')](_0xb8d4('0xae'),_0xb8d4('0xaf'))[_0xb8d4('0x3e')]('\x0a');}else{return _0x2aa0e3['status'](_0x46ea24)['json'](_0x38f82b);}}})[_0xb8d4('0x2f')](handleError(_0x2aa0e3,null));};exports[_0xb8d4('0xb0')]=function(_0x5ee759,_0x9b09a7,_0x4c131e){return db[_0xb8d4('0x42')][_0xb8d4('0x68')]({'where':{'id':_0x5ee759[_0xb8d4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x9b09a7,null))[_0xb8d4('0x24')](function(_0x17c0a2){if(_0x17c0a2){return db[_0xb8d4('0xb1')][_0xb8d4('0xb2')](function(_0x651b6b){return db[_0xb8d4('0xb3')]['destroy']({'where':{'SmsAccountId':_0x5ee759[_0xb8d4('0x5a')]['id']},'transaction':_0x651b6b})[_0xb8d4('0x24')](function(_0x242f99){var _0xb55183=_[_0xb8d4('0x41')](_0x5ee759[_0xb8d4('0x63')],function(_0x4cc514){_0x4cc514[_0xb8d4('0x6a')]=_0x5ee759['params']['id'];return _0x4cc514;});return db[_0xb8d4('0xb3')]['bulkCreate'](_0xb55183,{'transaction':_0x651b6b});});})[_0xb8d4('0x24')](function(){return db[_0xb8d4('0xb3')][_0xb8d4('0xb4')]({'where':{'SmsAccountId':_0x5ee759[_0xb8d4('0x5a')]['id']},'order':_0xb8d4('0x73')});});}})[_0xb8d4('0x24')](respondWithResult(_0x9b09a7,null))['catch'](handleError(_0x9b09a7,null));};exports[_0xb8d4('0xb5')]=function(_0x3ade4c,_0x3de8ce,_0x5e225f){var _0x51a77f={};var _0x176744={};var _0x5f1302;var _0x210e97;return db['SmsAccount'][_0xb8d4('0x68')]({'where':{'id':_0x3ade4c[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x3de8ce,null))[_0xb8d4('0x24')](function(_0x1654bb){if(_0x1654bb){_0x5f1302=_0x1654bb;_0x176744[_0xb8d4('0x45')]=_[_0xb8d4('0x47')](db[_0xb8d4('0xb3')][_0xb8d4('0x5b')]);_0x176744['query']=_[_0xb8d4('0x47')](_0x3ade4c[_0xb8d4('0x46')]);_0x176744[_0xb8d4('0x48')]=_[_0xb8d4('0x49')](_0x176744['model'],_0x176744[_0xb8d4('0x46')]);_0x51a77f[_0xb8d4('0x4b')]=_[_0xb8d4('0x49')](_0x176744['model'],qs['fields'](_0x3ade4c[_0xb8d4('0x46')][_0xb8d4('0x4a')]));_0x51a77f[_0xb8d4('0x4b')]=_0x51a77f[_0xb8d4('0x4b')][_0xb8d4('0x4c')]?_0x51a77f[_0xb8d4('0x4b')]:_0x176744['model'];_0x51a77f[_0xb8d4('0x4f')]=qs['sort'](_0x3ade4c[_0xb8d4('0x46')][_0xb8d4('0x50')]);_0x51a77f[_0xb8d4('0x53')]=qs['filters'](_[_0xb8d4('0x51')](_0x3ade4c[_0xb8d4('0x46')],_0x176744[_0xb8d4('0x48')]));if(_0x3ade4c[_0xb8d4('0x46')][_0xb8d4('0x55')]){_0x51a77f[_0xb8d4('0x53')]=_['merge'](_0x51a77f[_0xb8d4('0x53')],{'$or':_['map'](_0x51a77f[_0xb8d4('0x4b')],function(_0xe0225){var _0x515927={};_0x515927[_0xe0225]={'$like':'%'+_0x3ade4c[_0xb8d4('0x46')]['filter']+'%'};return _0x515927;})});}_0x51a77f=_[_0xb8d4('0x52')]({},_0x51a77f,_0x3ade4c[_0xb8d4('0x56')]);return _0x5f1302[_0xb8d4('0xb5')](_0x51a77f);}})[_0xb8d4('0x24')](function(_0x367586){if(_0x367586){_0x210e97=_0x367586[_0xb8d4('0x4c')];if(!_0x3ade4c[_0xb8d4('0x46')][_0xb8d4('0x4d')](_0xb8d4('0x4e'))){_0x51a77f['limit']=qs[_0xb8d4('0x35')](_0x3ade4c[_0xb8d4('0x46')][_0xb8d4('0x35')]);_0x51a77f['offset']=qs[_0xb8d4('0x34')](_0x3ade4c[_0xb8d4('0x46')]['offset']);}return _0x5f1302[_0xb8d4('0xb5')](_0x51a77f);}})[_0xb8d4('0x24')](function(_0x1fef91){if(_0x1fef91){return _0x1fef91?{'count':_0x210e97,'rows':_0x1fef91}:null;}})[_0xb8d4('0x24')](respondWithResult(_0x3de8ce,null))['catch'](handleError(_0x3de8ce,null));};exports[_0xb8d4('0xb6')]=function(_0x31dd91,_0x1c7340,_0x2ff87d){var _0x15191d={'raw':![],'where':{}};var _0x2702d8={};var _0x4d8894={'count':0x0,'rows':[]};return db[_0xb8d4('0x42')][_0xb8d4('0x68')]({'where':{'id':_0x31dd91[_0xb8d4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1c7340,null))[_0xb8d4('0x24')](function(_0x3b1243){if(_0x3b1243){_0x2702d8[_0xb8d4('0x45')]=_[_0xb8d4('0x47')](db[_0xb8d4('0x9d')][_0xb8d4('0x5b')]);_0x2702d8[_0xb8d4('0x46')]=_[_0xb8d4('0x47')](_0x31dd91[_0xb8d4('0x46')]);_0x2702d8['filters']=_['intersection'](_0x2702d8[_0xb8d4('0x45')],_0x2702d8['query']);_0x15191d[_0xb8d4('0x4b')]=_['intersection'](_0x2702d8[_0xb8d4('0x45')],qs['fields'](_0x31dd91[_0xb8d4('0x46')]['fields']));_0x15191d[_0xb8d4('0x4b')]=_0x15191d[_0xb8d4('0x4b')][_0xb8d4('0x4c')]?_0x15191d['attributes']:_0x2702d8['model'];if(!_0x31dd91['query'][_0xb8d4('0x4d')](_0xb8d4('0x4e'))){_0x15191d[_0xb8d4('0x35')]=qs[_0xb8d4('0x35')](_0x31dd91['query'][_0xb8d4('0x35')]);_0x15191d[_0xb8d4('0x34')]=qs[_0xb8d4('0x34')](_0x31dd91[_0xb8d4('0x46')][_0xb8d4('0x34')]);}_0x15191d[_0xb8d4('0x4f')]=qs[_0xb8d4('0x50')](_0x31dd91[_0xb8d4('0x46')][_0xb8d4('0x50')]);_0x15191d[_0xb8d4('0x53')]=qs[_0xb8d4('0x48')](_[_0xb8d4('0x51')](_0x31dd91[_0xb8d4('0x46')],_0x2702d8[_0xb8d4('0x48')]));_0x15191d[_0xb8d4('0x53')][_0xb8d4('0x6a')]=_0x3b1243['id'];if(_0x31dd91[_0xb8d4('0x46')][_0xb8d4('0x55')]){_0x15191d[_0xb8d4('0x53')]=_[_0xb8d4('0x52')](_0x15191d[_0xb8d4('0x53')],{'$or':_[_0xb8d4('0x41')](_0x15191d[_0xb8d4('0x4b')],function(_0xe4c8b5){var _0x6f9da9={};_0x6f9da9[_0xe4c8b5]={'$like':'%'+_0x31dd91[_0xb8d4('0x46')][_0xb8d4('0x55')]+'%'};return _0x6f9da9;})});}_0x15191d=_['merge']({},_0x15191d,_0x31dd91[_0xb8d4('0x56')]);return db[_0xb8d4('0x9d')][_0xb8d4('0x33')]({'where':_0x15191d['where']})[_0xb8d4('0x24')](function(_0x14c3f4){_0x4d8894[_0xb8d4('0x33')]=_0x14c3f4;if(_0x31dd91[_0xb8d4('0x46')][_0xb8d4('0x6b')]){_0x15191d['include']=[{'model':db[_0xb8d4('0x76')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xb8d4('0x3d'),_0xb8d4('0xb7'),_0xb8d4('0xb8')],'required':![]},{'model':db[_0xb8d4('0xb9')],'as':_0xb8d4('0xba'),'attributes':['id',_0xb8d4('0x3d'),_0xb8d4('0xbb')],'where':_0x31dd91[_0xb8d4('0x46')][_0xb8d4('0xbc')]?{'id':_0x31dd91[_0xb8d4('0x46')][_0xb8d4('0xbc')]}:undefined,'required':_0x31dd91['query'][_0xb8d4('0xbc')]?!![]:![]}];}return db[_0xb8d4('0x9d')][_0xb8d4('0x58')](_0x15191d);})['then'](function(_0x51456a){_0x4d8894[_0xb8d4('0x59')]=_0x51456a;return _0x4d8894;});}})[_0xb8d4('0x24')](respondWithFilteredResult(_0x1c7340,_0x15191d))[_0xb8d4('0x2f')](handleError(_0x1c7340,null));};exports[_0xb8d4('0x3e')]=function(_0xa08c35,_0x3a3e12,_0x2a2b38){var _0x50e249,_0x4d1843,_0x1bd265;if(_['isNil'](_0xa08c35[_0xb8d4('0x63')][_0xb8d4('0x63')])||_0xa08c35[_0xb8d4('0x63')][_0xb8d4('0x63')]===''){throw new db[(_0xb8d4('0x77'))][(_0xb8d4('0x91'))](_0xb8d4('0x93'));}if(_[_0xb8d4('0x90')](_0xa08c35[_0xb8d4('0x63')]['to'])){throw new db[(_0xb8d4('0x77'))]['ValidationError'](_0xb8d4('0xbd'));}_0x50e249=_0xa08c35[_0xb8d4('0x63')]['to'];return db[_0xb8d4('0x42')]['find']({'where':{'id':_0xa08c35[_0xb8d4('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0xb8d4('0xbe'),'include':[{'model':db['CmContact'],'as':_0xb8d4('0x9b'),'where':{'mobile':_0x50e249},'limit':0x1,'order':[[_0xb8d4('0x7a'),_0xb8d4('0x98')]]}]}]})[_0xb8d4('0x24')](handleEntityNotFound(_0x3a3e12,null))[_0xb8d4('0x24')](function(_0x271443){if(_0x271443&&_0x271443[_0xb8d4('0xbe')]){_0x4d1843=_0x271443[_0xb8d4('0x3b')]({'plain':!![]});if(_0x4d1843['List']&&_0x4d1843['List'][_0xb8d4('0x9b')]['length']){return _0x4d1843[_0xb8d4('0xbe')][_0xb8d4('0x9b')][0x0];}return db['CmContact'][_0xb8d4('0x66')](_['defaults'](_0xa08c35[_0xb8d4('0x63')],{'firstName':_0x50e249,'mobile':_0x50e249,'phone':_0x50e249,'ListId':_0x4d1843['ListId']}));}})[_0xb8d4('0x24')](handleEntityNotFound(_0x3a3e12,null))[_0xb8d4('0x24')](function(_0x34d4d2){if(_0x34d4d2){_0x1bd265=_0x34d4d2;return db[_0xb8d4('0x9d')]['find']({'where':{'ContactId':_0x1bd265['id'],'closed':![],'SmsAccountId':_0x4d1843['id']}})[_0xb8d4('0x24')](function(_0x8fdade){if(_0x8fdade){return[_0x8fdade,![]];}return db[_0xb8d4('0x9d')][_0xb8d4('0x66')]({'UserId':_0xa08c35[_0xb8d4('0x5d')]['id'],'ContactId':_0x1bd265['id'],'SmsAccountId':_0x4d1843['id'],'phone':_0x50e249,'firstMsgDirection':_0xb8d4('0xbf'),'Messages':[_[_0xb8d4('0x52')](_0xa08c35[_0xb8d4('0x63')],{'read':![],'body':_0xa08c35[_0xb8d4('0x63')][_0xb8d4('0x63')],'phone':_0x50e249,'SmsAccountId':_0x4d1843['id'],'UserId':_0xa08c35[_0xb8d4('0x5d')]['id'],'ContactId':_0x1bd265['id']})]},{'include':[{'model':db[_0xb8d4('0xa4')],'as':_0xb8d4('0xc0')}]})[_0xb8d4('0x24')](function(_0x5e22d2){return[_0x5e22d2,!![]];});});}})[_0xb8d4('0xc1')](function(_0x3c05e8,_0x4c0a49){if(_0x4c0a49){return _0x3c05e8;}return db[_0xb8d4('0xa4')][_0xb8d4('0x66')](_['merge'](_0xa08c35[_0xb8d4('0x63')],{'read':![],'body':_0xa08c35[_0xb8d4('0x63')][_0xb8d4('0x63')],'phone':_0x50e249,'SmsAccountId':_0x4d1843['id'],'SmsInteractionId':_0x3c05e8['id'],'UserId':_0xa08c35[_0xb8d4('0x5d')]['id'],'ContactId':_0x1bd265['id']}))[_0xb8d4('0x24')](function(_0x415220){_0x3c05e8[_0xb8d4('0xc2')][_0xb8d4('0xc0')]=[];_0x3c05e8[_0xb8d4('0xc2')][_0xb8d4('0xc0')][_0xb8d4('0xa0')](_0x415220[_0xb8d4('0xc2')]);return _0x3c05e8;});})[_0xb8d4('0x24')](respondWithResult(_0x3a3e12,null))[_0xb8d4('0x2f')](handleError(_0x3a3e12,null));};exports[_0xb8d4('0x31')]=function(_0x9a51e1,_0x90afe3,_0x180875){if(_0x9a51e1['body']['id']){delete _0x9a51e1['body']['id'];}var _0x51692b,_0x32ba0a,_0x212478;return db[_0xb8d4('0x42')]['find']({'where':{'id':_0x9a51e1[_0xb8d4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x90afe3,null))[_0xb8d4('0x24')](function(_0x20f53b){if(_0x20f53b){_0x212478=_0x20f53b;logger[_0xb8d4('0x28')](_0xb8d4('0x29'),'status',_0xb8d4('0xc3'),_0x20f53b['type'],util[_0xb8d4('0xc4')](_0x9a51e1[_0xb8d4('0x63')],{'showHidden':![],'depth':null}));switch(_0x20f53b[_0xb8d4('0x44')]){case _0xb8d4('0x80'):if(_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xc5')]&&_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0x31')]){_0x32ba0a=_0x9a51e1[_0xb8d4('0x63')]['status'];return db[_0xb8d4('0xa4')][_0xb8d4('0x5c')]({'where':{'messageId':_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xc5')]}});}break;case'connectel':if(_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xc6')]&&_0x9a51e1['body'][_0xb8d4('0xc7')]){_0x32ba0a=_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xc7')];return db[_0xb8d4('0xa4')][_0xb8d4('0x5c')]({'where':{'messageId':_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xc6')]}});}break;case _0xb8d4('0xc8'):if(_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0x85')]&&_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xc9')]){_0x32ba0a=_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xc9')];return db['SmsMessage'][_0xb8d4('0x5c')]({'where':{'messageId':_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0x85')]}});}break;case _0xb8d4('0xca'):var _0x39697f=_0x9a51e1['body'][_0xb8d4('0x88')][0x0];if(_0x39697f[_0xb8d4('0x84')]&&_0x39697f[_0xb8d4('0x31')][_0xb8d4('0xcb')]==='DELIVERED'){_0x32ba0a=_0x39697f[_0xb8d4('0x31')][_0xb8d4('0xcb')];return db[_0xb8d4('0xa4')][_0xb8d4('0x5c')]({'where':{'messageId':_0x39697f[_0xb8d4('0x84')]}});}break;case _0xb8d4('0x8b'):if(_0x9a51e1[_0xb8d4('0x63')]['messageId']&&_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0x31')]){_0x32ba0a=_0x9a51e1['body'][_0xb8d4('0x31')];return db[_0xb8d4('0xa4')][_0xb8d4('0x5c')]({'where':{'messageId':_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0x84')]}});}break;case'bandwidth':if(_0x9a51e1['body'][0x0][_0xb8d4('0x2d')]['id']){_0x32ba0a=_0x9a51e1[_0xb8d4('0x63')][0x0][_0xb8d4('0x44')];return db['SmsMessage'][_0xb8d4('0x5c')]({'where':{'messageId':_0x9a51e1[_0xb8d4('0x63')][0x0][_0xb8d4('0x2d')]['id']}});}break;case _0xb8d4('0x8e'):if(_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xcc')]&&_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0x31')]){_0x32ba0a=_0x9a51e1['body'][_0xb8d4('0x31')];return db[_0xb8d4('0xa4')][_0xb8d4('0x5c')]({'where':{'messageId':_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xcc')]}});}break;}}})[_0xb8d4('0x24')](handleEntityNotFound(_0x90afe3,null))['then'](function(_0x29acc2){if(_0x29acc2){_0x51692b=_0x29acc2;switch(_0x212478[_0xb8d4('0x44')]){case _0xb8d4('0x80'):if(_0x32ba0a==='DELIVERED'){return _0x51692b['update']({'read':!![]});}else{logger[_0xb8d4('0x2b')](_0xb8d4('0x29'),'status',_0xb8d4('0x80'),util[_0xb8d4('0xc4')](_0x9a51e1['body'],{'showHidden':![],'depth':null}));}break;case _0xb8d4('0xcd'):if(_0x32ba0a==='1'){return _0x51692b[_0xb8d4('0xce')]({'read':!![]});}else{logger[_0xb8d4('0x2b')](_0xb8d4('0x29'),_0xb8d4('0x31'),_0xb8d4('0x80'),util['inspect'](_0x9a51e1[_0xb8d4('0x63')],{'showHidden':![],'depth':null}));}break;case _0xb8d4('0xc8'):if(!_0x9a51e1[_0xb8d4('0x63')]['error_code']&&_0x32ba0a>=0xc8&&_0x32ba0a<=0xce){return _0x51692b[_0xb8d4('0xce')]({'read':!![]});}else{logger['error'](_0xb8d4('0x29'),_0xb8d4('0x31'),_0xb8d4('0xc8'),util[_0xb8d4('0xc4')](_0x9a51e1['body'],{'showHidden':![],'depth':null}));}break;case _0xb8d4('0xca'):var _0x55c25a=_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0x88')][0x0];if(_0x55c25a[_0xb8d4('0x31')]['groupName']===_0xb8d4('0xcf')){return _0x51692b[_0xb8d4('0xce')]({'read':!![]});}else{logger[_0xb8d4('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb8d4('0x31'),'infobip',util['inspect'](_0x9a51e1[_0xb8d4('0x63')],{'showHidden':![],'depth':null}));}break;case _0xb8d4('0x8b'):if(_0x32ba0a=='DELIVERED_TO_GATEWAY'||_0x32ba0a==_0xb8d4('0xd0')){return _0x51692b[_0xb8d4('0xce')]({'read':!![]});}else{logger[_0xb8d4('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb8d4('0x31'),_0xb8d4('0x8b'),util[_0xb8d4('0xc4')](_0x9a51e1[_0xb8d4('0x63')],{'showHidden':![],'depth':null}));}break;case _0xb8d4('0xd1'):if(_0x32ba0a==_0xb8d4('0xd2')){return _0x51692b['update']({'read':!![]});}else{logger[_0xb8d4('0x2b')](_0xb8d4('0x29'),_0xb8d4('0x31'),_0xb8d4('0xd1'),util[_0xb8d4('0xc4')](_0x9a51e1[_0xb8d4('0x63')],{'showHidden':![],'depth':null}));}break;case _0xb8d4('0x8e'):if(_0x32ba0a===_0xb8d4('0xd3')||_0x32ba0a===_0xb8d4('0xd4')){return _0x51692b['update']({'read':!![]});}else{logger[_0xb8d4('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xb8d4('0x8e'),util[_0xb8d4('0xc4')](_0x9a51e1[_0xb8d4('0x63')],{'showHidden':![],'depth':null}));}break;}return _0x51692b;}})['then'](respondWithResult(_0x90afe3,null))[_0xb8d4('0x2f')](handleError(_0x90afe3,null));};exports['statusGet']=function(_0x235900,_0x14a045,_0x517009){var _0x12910d,_0x371b00,_0x32df7d;return db[_0xb8d4('0x42')]['find']({'where':{'id':_0x235900[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x14a045,null))[_0xb8d4('0x24')](function(_0x34c3b9){if(_0x34c3b9){_0x32df7d=_0x34c3b9;logger[_0xb8d4('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb8d4('0x31'),'received\x20delivery\x20report\x20from',_0x34c3b9[_0xb8d4('0x44')],util[_0xb8d4('0xc4')](_0x235900[_0xb8d4('0x46')],{'showHidden':![],'depth':null}));switch(_0x34c3b9[_0xb8d4('0x44')]){case _0xb8d4('0x89'):if(_0x235900[_0xb8d4('0x46')][_0xb8d4('0xd5')]&&_0x235900[_0xb8d4('0x46')][_0xb8d4('0xd6')]){_0x371b00=_0x235900[_0xb8d4('0x46')][_0xb8d4('0xd6')];return db['SmsMessage'][_0xb8d4('0x5c')]({'where':{'messageId':_0x235900[_0xb8d4('0x46')][_0xb8d4('0xd5')]}});}break;}}})[_0xb8d4('0x24')](handleEntityNotFound(_0x14a045,null))[_0xb8d4('0x24')](function(_0x2d9a6a){if(_0x2d9a6a){_0x12910d=_0x2d9a6a;switch(_0x32df7d[_0xb8d4('0x44')]){case'csc':if(_0x371b00==='2'||_0x371b00==='6'){return _0x12910d[_0xb8d4('0xce')]({'read':!![]});}else{logger[_0xb8d4('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb8d4('0x31'),_0xb8d4('0x89'),util[_0xb8d4('0xc4')](_0x235900[_0xb8d4('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x12910d;}})[_0xb8d4('0x24')](respondWithResult(_0x14a045,null))[_0xb8d4('0x2f')](handleError(_0x14a045,null));};exports['addAgents']=function(_0x154881,_0x1bd427,_0xefbdcc){return db['SmsAccount']['find']({'where':{'id':_0x154881[_0xb8d4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1bd427,null))[_0xb8d4('0x24')](function(_0x4cf1b7){if(_0x4cf1b7){return _0x4cf1b7['addAgents'](_0x154881[_0xb8d4('0x63')]['ids'],_[_0xb8d4('0x9a')](_0x154881[_0xb8d4('0x63')],[_0xb8d4('0x6d'),'id'])||{})[_0xb8d4('0xc1')](function(_0x350ce6){for(var _0x24c718=0x0;_0x24c718<_0x154881[_0xb8d4('0x63')][_0xb8d4('0x6d')][_0xb8d4('0x4c')];_0x24c718+=0x1){socket[_0xb8d4('0xd7')]('userSmsAccount:save',{'UserId':_0x154881[_0xb8d4('0x63')]['ids'][_0x24c718],'SmsAccountId':_0x154881[_0xb8d4('0x5a')]['id']});}return _0x350ce6;});}})[_0xb8d4('0x24')](respondWithResult(_0x1bd427,null))[_0xb8d4('0x2f')](handleError(_0x1bd427,null));};exports['removeAgents']=function(_0x77c1e,_0x223f73,_0x1d3394){return db[_0xb8d4('0x42')][_0xb8d4('0x5c')]({'where':{'id':_0x77c1e[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x223f73,null))[_0xb8d4('0x24')](function(_0x349548){if(_0x349548){return _0x349548[_0xb8d4('0xd8')](_0x77c1e[_0xb8d4('0x46')]['ids'])['then'](function(){if(_[_0xb8d4('0xd9')](_0x77c1e[_0xb8d4('0x46')]['ids'])){for(var _0x19f975=0x0;_0x19f975<_0x77c1e[_0xb8d4('0x46')][_0xb8d4('0x6d')][_0xb8d4('0x4c')];_0x19f975+=0x1){socket[_0xb8d4('0xd7')]('userSmsAccount:remove',{'UserId':Number(_0x77c1e[_0xb8d4('0x46')][_0xb8d4('0x6d')][_0x19f975]),'SmsAccountId':Number(_0x77c1e[_0xb8d4('0x5a')]['id'])});}}else{socket[_0xb8d4('0xd7')]('userSmsAccount:remove',{'UserId':Number(_0x77c1e[_0xb8d4('0x46')][_0xb8d4('0x6d')]),'SmsAccountId':Number(_0x77c1e[_0xb8d4('0x5a')]['id'])});}});}})[_0xb8d4('0x24')](respondWithStatusCode(_0x223f73,null))[_0xb8d4('0x2f')](handleError(_0x223f73,null));};exports[_0xb8d4('0xda')]=function(_0x354312,_0x507057,_0x5cd079){var _0x1d180d={};var _0x515f39={};var _0xd422bc;var _0x4ac096;return db[_0xb8d4('0x42')][_0xb8d4('0x68')]({'where':{'id':_0x354312[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x507057,null))[_0xb8d4('0x24')](function(_0x52435c){if(_0x52435c){_0xd422bc=_0x52435c;_0x515f39[_0xb8d4('0x45')]=_[_0xb8d4('0x47')](db[_0xb8d4('0xa7')][_0xb8d4('0x5b')]);_0x515f39[_0xb8d4('0x46')]=_['keys'](_0x354312[_0xb8d4('0x46')]);_0x515f39[_0xb8d4('0x48')]=_[_0xb8d4('0x49')](_0x515f39[_0xb8d4('0x45')],_0x515f39[_0xb8d4('0x46')]);_0x1d180d['attributes']=_[_0xb8d4('0x49')](_0x515f39[_0xb8d4('0x45')],qs[_0xb8d4('0x4a')](_0x354312[_0xb8d4('0x46')][_0xb8d4('0x4a')]));_0x1d180d[_0xb8d4('0x4b')]=_0x1d180d['attributes']['length']?_0x1d180d['attributes']:_0x515f39[_0xb8d4('0x45')];_0x1d180d[_0xb8d4('0x4f')]=qs[_0xb8d4('0x50')](_0x354312[_0xb8d4('0x46')][_0xb8d4('0x50')]);_0x1d180d[_0xb8d4('0x53')]=qs[_0xb8d4('0x48')](_['pick'](_0x354312[_0xb8d4('0x46')],_0x515f39[_0xb8d4('0x48')]));if(_0x354312[_0xb8d4('0x46')][_0xb8d4('0x55')]){_0x1d180d['where']=_[_0xb8d4('0x52')](_0x1d180d['where'],{'$or':_[_0xb8d4('0x41')](_0x1d180d['attributes'],function(_0x204ff9){var _0x5c28d4={};_0x5c28d4[_0x204ff9]={'$like':'%'+_0x354312[_0xb8d4('0x46')][_0xb8d4('0x55')]+'%'};return _0x5c28d4;})});}_0x1d180d=_[_0xb8d4('0x52')]({},_0x1d180d,_0x354312[_0xb8d4('0x56')]);return _0xd422bc[_0xb8d4('0xda')](_0x1d180d);}})['then'](function(_0x3d4e6e){if(_0x3d4e6e){_0x4ac096=_0x3d4e6e[_0xb8d4('0x4c')];if(!_0x354312[_0xb8d4('0x46')][_0xb8d4('0x4d')]('nolimit')){_0x1d180d[_0xb8d4('0x35')]=qs['limit'](_0x354312[_0xb8d4('0x46')][_0xb8d4('0x35')]);_0x1d180d[_0xb8d4('0x34')]=qs[_0xb8d4('0x34')](_0x354312[_0xb8d4('0x46')][_0xb8d4('0x34')]);}return _0xd422bc['getAgents'](_0x1d180d);}})[_0xb8d4('0x24')](function(_0x1485c7){if(_0x1485c7){return _0x1485c7?{'count':_0x4ac096,'rows':_0x1485c7}:null;}})[_0xb8d4('0x24')](respondWithResult(_0x507057,null))[_0xb8d4('0x2f')](handleError(_0x507057,null));}; \ No newline at end of file +var _0x3f7c=['to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','get','UserProfileResource','destroy','stack','name','Pause','map','SmsAccount','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','order','removeAnswers','SmsApplication','Applications','account','applications','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','From','Body','messageId','MessageSid','skebby','from','sender','text','connectel','clicksend','plivo','MessageUUID','infobip','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','results','groupName','DELIVERED','intelepeer','redif','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','received\x20delivery\x20report\x20from','csc','message-id','state','addAgents','userSmsAccount:save','removeAgents','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox'];(function(_0x2aec3a,_0x241834){var _0x581322=function(_0x5597cd){while(--_0x5597cd){_0x2aec3a['push'](_0x2aec3a['shift']());}};_0x581322(++_0x241834);}(_0x3f7c,0xe2));var _0xc3f7=function(_0x1e7abf,_0x59c588){_0x1e7abf=_0x1e7abf-0x0;var _0x849048=_0x3f7c[_0x1e7abf];return _0x849048;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc3f7('0x0'));var rimraf=require(_0xc3f7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc3f7('0x2'));var rp=require(_0xc3f7('0x3'));var moment=require(_0xc3f7('0x4'));var BPromise=require(_0xc3f7('0x5'));var Mustache=require('mustache');var util=require(_0xc3f7('0x6'));var path=require('path');var sox=require(_0xc3f7('0x7'));var csv=require(_0xc3f7('0x8'));var ejs=require(_0xc3f7('0x9'));var fs=require('fs');var fs_extra=require(_0xc3f7('0xa'));var _=require(_0xc3f7('0xb'));var squel=require(_0xc3f7('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc3f7('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc3f7('0xe'));var Papa=require('papaparse');var Redis=require(_0xc3f7('0xf'));var authService=require(_0xc3f7('0x10'));var qs=require(_0xc3f7('0x11'));var as=require(_0xc3f7('0x12'));var hardwareService=require(_0xc3f7('0x13'));var logger=require(_0xc3f7('0x14'))(_0xc3f7('0x15'));var utils=require(_0xc3f7('0x16'));var config=require(_0xc3f7('0x17'));var licenseUtil=require(_0xc3f7('0x18'));var db=require(_0xc3f7('0x19'))['db'];config[_0xc3f7('0x1a')]=_[_0xc3f7('0x1b')](config[_0xc3f7('0x1a')],{'host':_0xc3f7('0x1c'),'port':0x18eb});var socket=require(_0xc3f7('0x1d'))(new Redis(config[_0xc3f7('0x1a')]));require(_0xc3f7('0x1e'))[_0xc3f7('0x1f')](socket);var jayson=require(_0xc3f7('0x20'));var client=jayson[_0xc3f7('0x21')][_0xc3f7('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x27e9f3,_0x2d1ba4,_0x15eced,_0x5d4d1d){return new BPromise(function(_0x5c871f,_0xaf8693){var _0x22bf42=_0x5d4d1d||client;return _0x22bf42[_0xc3f7('0x23')](_0x27e9f3,_0x15eced)[_0xc3f7('0x24')](function(_0x4f8fca){logger['info'](_0xc3f7('0x25'),_0x2d1ba4,_0xc3f7('0x26'));logger['debug'](_0xc3f7('0x27'),_0x2d1ba4,'request\x20sent',JSON[_0xc3f7('0x28')](_0x4f8fca));if(_0x4f8fca[_0xc3f7('0x29')]){if(_0x4f8fca['error']['code']===0x1f4){logger[_0xc3f7('0x29')](_0xc3f7('0x25'),_0x2d1ba4,_0x4f8fca['error'][_0xc3f7('0x2a')]);return _0xaf8693(_0x4f8fca[_0xc3f7('0x29')]['message']);}logger[_0xc3f7('0x29')](_0xc3f7('0x25'),_0x2d1ba4,_0x4f8fca[_0xc3f7('0x29')]['message']);return _0x5c871f(_0x4f8fca[_0xc3f7('0x29')][_0xc3f7('0x2a')]);}else{logger[_0xc3f7('0x2b')](_0xc3f7('0x25'),_0x2d1ba4,_0xc3f7('0x26'));_0x5c871f(_0x4f8fca['result']['message']);}})[_0xc3f7('0x2c')](function(_0x44fc70){logger[_0xc3f7('0x29')](_0xc3f7('0x25'),_0x2d1ba4,_0x44fc70);_0xaf8693(_0x44fc70);});});}function respondWithStatusCode(_0x13c08f,_0x3cd927){_0x3cd927=_0x3cd927||0xcc;return function(_0x261db9){if(_0x261db9){return _0x13c08f[_0xc3f7('0x2d')](_0x3cd927);}return _0x13c08f[_0xc3f7('0x2e')](_0x3cd927)[_0xc3f7('0x2f')]();};}function respondWithResult(_0x32c0eb,_0x10e1fc){_0x10e1fc=_0x10e1fc||0xc8;return function(_0x39b6bf){if(_0x39b6bf){return _0x32c0eb[_0xc3f7('0x2e')](_0x10e1fc)[_0xc3f7('0x30')](_0x39b6bf);}};}function respondWithFilteredResult(_0x500c0a,_0x537657){return function(_0x3badc1){if(_0x3badc1){var _0x24670d=_0x3badc1[_0xc3f7('0x31')],_0x45a4cc=_0x537657[_0xc3f7('0x32')],_0x38057d=_0x537657[_0xc3f7('0x32')]+_0x537657[_0xc3f7('0x33')],_0x409aab;if(_0x38057d>=_0x24670d){_0x38057d=_0x24670d;_0x409aab=0xc8;}else{_0x409aab=0xce;}_0x500c0a[_0xc3f7('0x2e')](_0x409aab);return _0x500c0a[_0xc3f7('0x34')](_0xc3f7('0x35'),_0x45a4cc+'-'+_0x38057d+'/'+_0x24670d)[_0xc3f7('0x30')](_0x3badc1);}return null;};}function patchUpdates(_0x1ab3f0){return function(_0x3e4be9){try{jsonpatch[_0xc3f7('0x36')](_0x3e4be9,_0x1ab3f0,!![]);}catch(_0x59f867){return BPromise[_0xc3f7('0x37')](_0x59f867);}return _0x3e4be9['save']();};}function saveUpdates(_0x506e13,_0x3540e6){return function(_0x4f3895){if(_0x4f3895){return _0x4f3895[_0xc3f7('0x38')](_0x506e13)['then'](function(_0x4a550d){return _0x4a550d;});}return null;};}function removeEntity(_0x4c2efa,_0x3033d8){return function(_0xd7c0b6){if(_0xd7c0b6){return _0xd7c0b6['destroy']()[_0xc3f7('0x24')](function(){var _0xad7045=_0xd7c0b6[_0xc3f7('0x39')]({'plain':!![]});var _0x57730b='SmsAccounts';return db[_0xc3f7('0x3a')][_0xc3f7('0x3b')]({'where':{'type':_0x57730b,'resourceId':_0xad7045['id']}})[_0xc3f7('0x24')](function(){return _0xd7c0b6;});})[_0xc3f7('0x24')](function(){_0x4c2efa[_0xc3f7('0x2e')](0xcc)[_0xc3f7('0x2f')]();});}};}function handleEntityNotFound(_0x4808fb,_0x29ce4a){return function(_0x2682b4){if(!_0x2682b4){_0x4808fb[_0xc3f7('0x2d')](0x194);}return _0x2682b4;};}function handleError(_0x15c74f,_0x693f3){_0x693f3=_0x693f3||0x1f4;return function(_0x1f0c9f){logger[_0xc3f7('0x29')](_0x1f0c9f[_0xc3f7('0x3c')]);if(_0x1f0c9f[_0xc3f7('0x3d')]){delete _0x1f0c9f[_0xc3f7('0x3d')];}_0x15c74f[_0xc3f7('0x2e')](_0x693f3)['send'](_0x1f0c9f);};}exports['index']=function(_0x2d4e87,_0x530b6f){var _0x3cabef={'include':[{'model':db[_0xc3f7('0x3e')],'as':'mandatoryDispositionPause'}]},_0x353667={},_0x1c9cad={'count':0x0,'rows':[]};var _0x40905e=_[_0xc3f7('0x3f')](db[_0xc3f7('0x40')][_0xc3f7('0x41')],function(_0x419959){return{'name':_0x419959[_0xc3f7('0x42')],'type':_0x419959[_0xc3f7('0x43')]['key']};});_0x353667['model']=_[_0xc3f7('0x3f')](_0x40905e,_0xc3f7('0x3d'));_0x353667[_0xc3f7('0x44')]=_['keys'](_0x2d4e87[_0xc3f7('0x44')]);_0x353667[_0xc3f7('0x45')]=_[_0xc3f7('0x46')](_0x353667[_0xc3f7('0x47')],_0x353667['query']);_0x3cabef[_0xc3f7('0x48')]=_[_0xc3f7('0x46')](_0x353667[_0xc3f7('0x47')],qs[_0xc3f7('0x49')](_0x2d4e87[_0xc3f7('0x44')]['fields']));_0x3cabef[_0xc3f7('0x48')]=_0x3cabef[_0xc3f7('0x48')][_0xc3f7('0x4a')]?_0x3cabef[_0xc3f7('0x48')]:_0x353667[_0xc3f7('0x47')];if(!_0x2d4e87[_0xc3f7('0x44')][_0xc3f7('0x4b')](_0xc3f7('0x4c'))){_0x3cabef[_0xc3f7('0x33')]=qs[_0xc3f7('0x33')](_0x2d4e87[_0xc3f7('0x44')][_0xc3f7('0x33')]);_0x3cabef[_0xc3f7('0x32')]=qs[_0xc3f7('0x32')](_0x2d4e87['query'][_0xc3f7('0x32')]);}_0x3cabef['order']=qs['sort'](_0x2d4e87['query'][_0xc3f7('0x4d')]);_0x3cabef[_0xc3f7('0x4e')]=qs[_0xc3f7('0x45')](_[_0xc3f7('0x4f')](_0x2d4e87[_0xc3f7('0x44')],_0x353667[_0xc3f7('0x45')]),_0x40905e);if(_0x2d4e87['query'][_0xc3f7('0x50')]){_0x3cabef[_0xc3f7('0x4e')]=_['merge'](_0x3cabef['where'],{'$or':_[_0xc3f7('0x3f')](_0x40905e,function(_0x6d65f){if(_0x6d65f['type']!==_0xc3f7('0x51')){var _0x19629d={};_0x19629d[_0x6d65f[_0xc3f7('0x3d')]]={'$like':'%'+_0x2d4e87[_0xc3f7('0x44')][_0xc3f7('0x50')]+'%'};return _0x19629d;}})});}_0x3cabef=_[_0xc3f7('0x52')]({},_0x3cabef,_0x2d4e87[_0xc3f7('0x53')]);var _0x2bff69={'where':_0x3cabef[_0xc3f7('0x4e')]};return db['SmsAccount'][_0xc3f7('0x31')](_0x2bff69)['then'](function(_0x18b7f8){_0x1c9cad[_0xc3f7('0x31')]=_0x18b7f8;if(_0x2d4e87[_0xc3f7('0x44')][_0xc3f7('0x54')]){_0x3cabef[_0xc3f7('0x55')]=[{'all':!![]}];}return db[_0xc3f7('0x40')][_0xc3f7('0x56')](_0x3cabef);})['then'](function(_0x511eb1){_0x1c9cad[_0xc3f7('0x57')]=_0x511eb1;return _0x1c9cad;})[_0xc3f7('0x24')](respondWithFilteredResult(_0x530b6f,_0x3cabef))[_0xc3f7('0x2c')](handleError(_0x530b6f,null));};exports[_0xc3f7('0x58')]=function(_0x4609cf,_0x4bc5a2){var _0xdba7ea={'raw':![],'where':{'id':_0x4609cf[_0xc3f7('0x59')]['id']},'include':[{'model':db[_0xc3f7('0x3e')],'as':_0xc3f7('0x5a')}]},_0x482409={};_0x482409['model']=_['keys'](db[_0xc3f7('0x40')][_0xc3f7('0x41')]);_0x482409[_0xc3f7('0x44')]=_[_0xc3f7('0x5b')](_0x4609cf[_0xc3f7('0x44')]);_0x482409[_0xc3f7('0x45')]=_[_0xc3f7('0x46')](_0x482409['model'],_0x482409[_0xc3f7('0x44')]);_0xdba7ea[_0xc3f7('0x48')]=_[_0xc3f7('0x46')](_0x482409[_0xc3f7('0x47')],qs[_0xc3f7('0x49')](_0x4609cf[_0xc3f7('0x44')][_0xc3f7('0x49')]));_0xdba7ea[_0xc3f7('0x48')]=_0xdba7ea[_0xc3f7('0x48')][_0xc3f7('0x4a')]?_0xdba7ea[_0xc3f7('0x48')]:_0x482409[_0xc3f7('0x47')];if(_0x4609cf[_0xc3f7('0x44')][_0xc3f7('0x54')]){_0xdba7ea[_0xc3f7('0x55')]=[{'all':!![]}];}_0xdba7ea=_[_0xc3f7('0x52')]({},_0xdba7ea,_0x4609cf[_0xc3f7('0x53')]);return db[_0xc3f7('0x40')][_0xc3f7('0x5c')](_0xdba7ea)[_0xc3f7('0x24')](handleEntityNotFound(_0x4bc5a2,null))['then'](respondWithResult(_0x4bc5a2,null))[_0xc3f7('0x2c')](handleError(_0x4bc5a2,null));};exports[_0xc3f7('0x5d')]=function(_0x305090,_0x3918f3){return db[_0xc3f7('0x40')][_0xc3f7('0x5d')](_0x305090[_0xc3f7('0x5e')],{})[_0xc3f7('0x24')](function(_0x23004c){var _0xe071e4=_0x305090['user'][_0xc3f7('0x39')]({'plain':!![]});if(!_0xe071e4)throw new Error(_0xc3f7('0x5f'));if(_0xe071e4[_0xc3f7('0x60')]===_0xc3f7('0x61')){var _0x187b22=_0x23004c[_0xc3f7('0x39')]({'plain':!![]});var _0x3ac47b=_0xc3f7('0x62');return db[_0xc3f7('0x63')][_0xc3f7('0x5c')]({'where':{'name':_0x3ac47b,'userProfileId':_0xe071e4[_0xc3f7('0x64')]},'raw':!![]})[_0xc3f7('0x24')](function(_0x2babf7){if(_0x2babf7&&_0x2babf7[_0xc3f7('0x65')]===0x0){return db[_0xc3f7('0x3a')][_0xc3f7('0x5d')]({'name':_0x187b22['name'],'resourceId':_0x187b22['id'],'type':_0x2babf7['name'],'sectionId':_0x2babf7['id']},{})['then'](function(){return _0x23004c;});}else{return _0x23004c;}})[_0xc3f7('0x2c')](function(_0x34e730){logger[_0xc3f7('0x29')](_0xc3f7('0x66'),_0x34e730);throw _0x34e730;});}return _0x23004c;})[_0xc3f7('0x24')](respondWithResult(_0x3918f3,0xc9))[_0xc3f7('0x2c')](handleError(_0x3918f3,null));};exports['update']=function(_0x3142ae,_0x244907){if(_0x3142ae[_0xc3f7('0x5e')]['id']){delete _0x3142ae[_0xc3f7('0x5e')]['id'];}return db[_0xc3f7('0x40')][_0xc3f7('0x5c')]({'where':{'id':_0x3142ae[_0xc3f7('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xc3f7('0x24')](handleEntityNotFound(_0x244907,null))[_0xc3f7('0x24')](saveUpdates(_0x3142ae[_0xc3f7('0x5e')],null))[_0xc3f7('0x24')](respondWithResult(_0x244907,null))[_0xc3f7('0x2c')](handleError(_0x244907,null));};exports[_0xc3f7('0x3b')]=function(_0x55c5cf,_0x18fd85){return db[_0xc3f7('0x40')]['find']({'where':{'id':_0x55c5cf[_0xc3f7('0x59')]['id']}})[_0xc3f7('0x24')](handleEntityNotFound(_0x18fd85,null))[_0xc3f7('0x24')](removeEntity(_0x18fd85,null))['catch'](handleError(_0x18fd85,null));};exports[_0xc3f7('0x67')]=function(_0x142cb3,_0xbe0e7a){return db[_0xc3f7('0x40')]['describe']()['then'](respondWithResult(_0xbe0e7a,null))[_0xc3f7('0x2c')](handleError(_0xbe0e7a,null));};exports[_0xc3f7('0x68')]=function(_0x293a62,_0x4cb773,_0x115246){if(_0x293a62[_0xc3f7('0x5e')]['id']){delete _0x293a62['body']['id'];}return db[_0xc3f7('0x40')][_0xc3f7('0x5c')]({'where':{'id':_0x293a62[_0xc3f7('0x59')]['id']}})[_0xc3f7('0x24')](handleEntityNotFound(_0x4cb773,null))[_0xc3f7('0x24')](function(_0x4a5adb){if(_0x4a5adb){_0x293a62['body'][_0xc3f7('0x69')]=_0x4a5adb['id'];return db[_0xc3f7('0x6a')][_0xc3f7('0x5d')](_0x293a62['body']);}})[_0xc3f7('0x24')](respondWithResult(_0x4cb773,null))[_0xc3f7('0x2c')](handleError(_0x4cb773,null));};exports[_0xc3f7('0x6b')]=function(_0x410b9b,_0x360964,_0x42c415){var _0x52ddb9={'raw':![],'where':{}};var _0x55425e={};var _0x7c4ccb={'count':0x0,'rows':[]};return db[_0xc3f7('0x40')]['findOne']({'where':{'id':_0x410b9b['params']['id']}})['then'](handleEntityNotFound(_0x360964,null))[_0xc3f7('0x24')](function(_0x1ef7d3){if(_0x1ef7d3){_0x55425e['model']=_['keys'](db[_0xc3f7('0x6a')][_0xc3f7('0x41')]);_0x55425e[_0xc3f7('0x44')]=_[_0xc3f7('0x5b')](_0x410b9b['query']);_0x55425e['filters']=_[_0xc3f7('0x46')](_0x55425e['model'],_0x55425e[_0xc3f7('0x44')]);_0x52ddb9[_0xc3f7('0x48')]=_[_0xc3f7('0x46')](_0x55425e[_0xc3f7('0x47')],qs[_0xc3f7('0x49')](_0x410b9b['query']['fields']));_0x52ddb9[_0xc3f7('0x48')]=_0x52ddb9[_0xc3f7('0x48')][_0xc3f7('0x4a')]?_0x52ddb9[_0xc3f7('0x48')]:_0x55425e[_0xc3f7('0x47')];if(!_0x410b9b[_0xc3f7('0x44')][_0xc3f7('0x4b')](_0xc3f7('0x4c'))){_0x52ddb9[_0xc3f7('0x33')]=qs[_0xc3f7('0x33')](_0x410b9b[_0xc3f7('0x44')][_0xc3f7('0x33')]);_0x52ddb9[_0xc3f7('0x32')]=qs[_0xc3f7('0x32')](_0x410b9b[_0xc3f7('0x44')]['offset']);}_0x52ddb9['order']=qs[_0xc3f7('0x4d')](_0x410b9b[_0xc3f7('0x44')]['sort']);_0x52ddb9[_0xc3f7('0x4e')]=qs[_0xc3f7('0x45')](_['pick'](_0x410b9b[_0xc3f7('0x44')],_0x55425e[_0xc3f7('0x45')]));_0x52ddb9['where']['SmsAccountId']=_0x1ef7d3['id'];if(_0x410b9b[_0xc3f7('0x44')][_0xc3f7('0x50')]){_0x52ddb9[_0xc3f7('0x4e')]=_[_0xc3f7('0x52')](_0x52ddb9[_0xc3f7('0x4e')],{'$or':_['map'](_0x52ddb9[_0xc3f7('0x48')],function(_0x5182f8){var _0x367657={};_0x367657[_0x5182f8]={'$like':'%'+_0x410b9b['query'][_0xc3f7('0x50')]+'%'};return _0x367657;})});}_0x52ddb9=_['merge']({},_0x52ddb9,_0x410b9b[_0xc3f7('0x53')]);return db['Disposition']['count']({'where':_0x52ddb9[_0xc3f7('0x4e')]})[_0xc3f7('0x24')](function(_0x233e7b){_0x7c4ccb[_0xc3f7('0x31')]=_0x233e7b;if(_0x410b9b[_0xc3f7('0x44')][_0xc3f7('0x54')]){_0x52ddb9[_0xc3f7('0x55')]=[{'all':!![]}];}return db[_0xc3f7('0x6a')][_0xc3f7('0x56')](_0x52ddb9);})[_0xc3f7('0x24')](function(_0xb5dc4){_0x7c4ccb[_0xc3f7('0x57')]=_0xb5dc4;return _0x7c4ccb;});}})[_0xc3f7('0x24')](respondWithFilteredResult(_0x360964,_0x52ddb9))[_0xc3f7('0x2c')](handleError(_0x360964,null));};exports['removeDispositions']=function(_0x5c7efd,_0x3667c1,_0x5bb8e5){return db[_0xc3f7('0x40')][_0xc3f7('0x5c')]({'where':{'id':_0x5c7efd[_0xc3f7('0x59')]['id']}})[_0xc3f7('0x24')](handleEntityNotFound(_0x3667c1,null))[_0xc3f7('0x24')](function(_0x3e920f){if(_0x3e920f){return _0x3e920f[_0xc3f7('0x6c')](_0x5c7efd[_0xc3f7('0x44')][_0xc3f7('0x6d')]);}})['then'](respondWithStatusCode(_0x3667c1,null))['catch'](handleError(_0x3667c1,null));};exports[_0xc3f7('0x6e')]=function(_0x17714a,_0x17defd,_0x59ae46){if(_0x17714a[_0xc3f7('0x5e')]['id']){delete _0x17714a['body']['id'];}return db[_0xc3f7('0x40')][_0xc3f7('0x5c')]({'where':{'id':_0x17714a[_0xc3f7('0x59')]['id']}})['then'](handleEntityNotFound(_0x17defd,null))['then'](function(_0x44b667){if(_0x44b667){_0x17714a[_0xc3f7('0x5e')][_0xc3f7('0x69')]=_0x44b667['id'];return db['CannedAnswer']['create'](_0x17714a['body']);}})[_0xc3f7('0x24')](respondWithResult(_0x17defd,null))['catch'](handleError(_0x17defd,null));};exports[_0xc3f7('0x6f')]=function(_0x3ae58d,_0x4657af,_0x5a9002){var _0x1c2ea4={'raw':![],'where':{}};var _0x2a1ba3={};var _0x241184={'count':0x0,'rows':[]};return db[_0xc3f7('0x40')][_0xc3f7('0x70')]({'where':{'id':_0x3ae58d[_0xc3f7('0x59')]['id']}})[_0xc3f7('0x24')](handleEntityNotFound(_0x4657af,null))[_0xc3f7('0x24')](function(_0xe95d89){if(_0xe95d89){_0x2a1ba3['model']=_[_0xc3f7('0x5b')](db[_0xc3f7('0x71')][_0xc3f7('0x41')]);_0x2a1ba3[_0xc3f7('0x44')]=_[_0xc3f7('0x5b')](_0x3ae58d[_0xc3f7('0x44')]);_0x2a1ba3[_0xc3f7('0x45')]=_[_0xc3f7('0x46')](_0x2a1ba3['model'],_0x2a1ba3['query']);_0x1c2ea4[_0xc3f7('0x48')]=_[_0xc3f7('0x46')](_0x2a1ba3[_0xc3f7('0x47')],qs['fields'](_0x3ae58d['query'][_0xc3f7('0x49')]));_0x1c2ea4[_0xc3f7('0x48')]=_0x1c2ea4[_0xc3f7('0x48')][_0xc3f7('0x4a')]?_0x1c2ea4[_0xc3f7('0x48')]:_0x2a1ba3['model'];if(!_0x3ae58d[_0xc3f7('0x44')][_0xc3f7('0x4b')](_0xc3f7('0x4c'))){_0x1c2ea4[_0xc3f7('0x33')]=qs[_0xc3f7('0x33')](_0x3ae58d[_0xc3f7('0x44')][_0xc3f7('0x33')]);_0x1c2ea4['offset']=qs['offset'](_0x3ae58d['query'][_0xc3f7('0x32')]);}_0x1c2ea4[_0xc3f7('0x72')]=qs['sort'](_0x3ae58d[_0xc3f7('0x44')][_0xc3f7('0x4d')]);_0x1c2ea4[_0xc3f7('0x4e')]=qs['filters'](_[_0xc3f7('0x4f')](_0x3ae58d[_0xc3f7('0x44')],_0x2a1ba3[_0xc3f7('0x45')]));_0x1c2ea4[_0xc3f7('0x4e')][_0xc3f7('0x69')]=_0xe95d89['id'];if(_0x3ae58d[_0xc3f7('0x44')][_0xc3f7('0x50')]){_0x1c2ea4['where']=_[_0xc3f7('0x52')](_0x1c2ea4[_0xc3f7('0x4e')],{'$or':_['map'](_0x1c2ea4[_0xc3f7('0x48')],function(_0x2096a1){var _0x23755e={};_0x23755e[_0x2096a1]={'$like':'%'+_0x3ae58d[_0xc3f7('0x44')][_0xc3f7('0x50')]+'%'};return _0x23755e;})});}_0x1c2ea4=_['merge']({},_0x1c2ea4,_0x3ae58d['options']);return db['CannedAnswer']['count']({'where':_0x1c2ea4[_0xc3f7('0x4e')]})[_0xc3f7('0x24')](function(_0x4b881a){_0x241184[_0xc3f7('0x31')]=_0x4b881a;if(_0x3ae58d[_0xc3f7('0x44')][_0xc3f7('0x54')]){_0x1c2ea4['include']=[{'all':!![]}];}return db[_0xc3f7('0x71')]['findAll'](_0x1c2ea4);})[_0xc3f7('0x24')](function(_0x45ddc3){_0x241184[_0xc3f7('0x57')]=_0x45ddc3;return _0x241184;});}})['then'](respondWithFilteredResult(_0x4657af,_0x1c2ea4))[_0xc3f7('0x2c')](handleError(_0x4657af,null));};exports[_0xc3f7('0x73')]=function(_0x2de5f6,_0x4fa2bc,_0x1ba0e6){return db['SmsAccount'][_0xc3f7('0x5c')]({'where':{'id':_0x2de5f6[_0xc3f7('0x59')]['id']}})['then'](handleEntityNotFound(_0x4fa2bc,null))[_0xc3f7('0x24')](function(_0x59b08d){if(_0x59b08d){return _0x59b08d[_0xc3f7('0x73')](_0x2de5f6[_0xc3f7('0x44')][_0xc3f7('0x6d')]);}})[_0xc3f7('0x24')](respondWithStatusCode(_0x4fa2bc,null))[_0xc3f7('0x2c')](handleError(_0x4fa2bc,null));};exports['notify']=function(_0x2ea1d9,_0x1f76a0,_0x3f09e0){var _0x2880dd={'channel':'sms'};var _0x42d4d2=[];var _0x27d3fb=[];var _0x36a8fa={};return db[_0xc3f7('0x40')][_0xc3f7('0x5c')]({'where':{'id':_0x2ea1d9['params']['id']},'include':[{'model':db[_0xc3f7('0x74')],'as':_0xc3f7('0x75')}]})[_0xc3f7('0x24')](handleEntityNotFound(_0x1f76a0,null))['then'](function(_0x7049fc){_0x2880dd[_0xc3f7('0x76')]=_0x7049fc;_0x2880dd[_0xc3f7('0x77')]=_[_0xc3f7('0x78')](_0x7049fc[_0xc3f7('0x75')],['priority'],[_0xc3f7('0x79')]);if(_0x2880dd[_0xc3f7('0x76')][_0xc3f7('0x75')]){delete _0x2880dd['account'][_0xc3f7('0x75')];}return db[_0xc3f7('0x7a')][_0xc3f7('0x67')]();})[_0xc3f7('0x24')](function(_0x2c1cd0){if(!_0x2c1cd0){throw new db[(_0xc3f7('0x7b'))]['ValidationError'](_0xc3f7('0x7c'));}_0x42d4d2=_[_0xc3f7('0x7d')](_[_0xc3f7('0x5b')](_0x2c1cd0),['createdAt','updatedAt']);_0x27d3fb=_[_0xc3f7('0x7d')](_[_0xc3f7('0x5b')](_0x2c1cd0),[_0xc3f7('0x7e'),_0xc3f7('0x7f'),'CompanyId',_0xc3f7('0x80')]);_0x2880dd[_0xc3f7('0x5e')]={'mapKey':_0xc3f7('0x81')};if(_0x2880dd[_0xc3f7('0x76')]['type']){switch(_0x2880dd[_0xc3f7('0x76')][_0xc3f7('0x43')]){case _0xc3f7('0x82'):_0x2880dd[_0xc3f7('0x5e')]['from']=_0x2ea1d9[_0xc3f7('0x5e')][_0xc3f7('0x83')];_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x5e')]=_0x2ea1d9[_0xc3f7('0x5e')][_0xc3f7('0x84')];_0x2880dd['body'][_0xc3f7('0x85')]=_0x2ea1d9[_0xc3f7('0x5e')][_0xc3f7('0x86')];break;case _0xc3f7('0x87'):_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x88')]='+'+_0x2ea1d9['body'][_0xc3f7('0x89')];_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x5e')]=_0x2ea1d9[_0xc3f7('0x5e')][_0xc3f7('0x8a')];break;case _0xc3f7('0x8b'):_0x2880dd['body']['from']=_0x2ea1d9['body']['from'];_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x5e')]=_0x2ea1d9[_0xc3f7('0x5e')][_0xc3f7('0x2a')];break;case _0xc3f7('0x8c'):_0x2880dd[_0xc3f7('0x5e')]['from']=_0x2ea1d9[_0xc3f7('0x5e')][_0xc3f7('0x88')];_0x2880dd['body'][_0xc3f7('0x5e')]=_0x2ea1d9[_0xc3f7('0x5e')]['body'];_0x2880dd[_0xc3f7('0x5e')]['messageId']=_0x2ea1d9['body']['message_id'];break;case _0xc3f7('0x8d'):_0x2880dd['body'][_0xc3f7('0x88')]=_0x2ea1d9[_0xc3f7('0x5e')][_0xc3f7('0x83')];_0x2880dd['body'][_0xc3f7('0x5e')]=_0x2ea1d9[_0xc3f7('0x5e')]['Text'];_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x85')]=_0x2ea1d9['body'][_0xc3f7('0x8e')];break;case _0xc3f7('0x8f'):_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x88')]='+'+_0x2ea1d9['body']['results'][0x0][_0xc3f7('0x88')];_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x5e')]=_0x2ea1d9['body']['results'][0x0][_0xc3f7('0x8a')];_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x85')]=_0x2ea1d9[_0xc3f7('0x5e')]['results'][0x0][_0xc3f7('0x85')];break;case'csc':_0x2880dd['body'][_0xc3f7('0x88')]=_0x2ea1d9[_0xc3f7('0x5e')]['originatingAddress'];_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x5e')]=_0x2ea1d9[_0xc3f7('0x5e')][_0xc3f7('0x90')][_0xc3f7('0x2a')];break;case _0xc3f7('0x91'):_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x88')]=_0x2ea1d9['body'][_0xc3f7('0x92')];_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x5e')]=_0x2ea1d9[_0xc3f7('0x5e')][_0xc3f7('0x8a')];_0x2880dd['body'][_0xc3f7('0x85')]=_0x2ea1d9[_0xc3f7('0x5e')][_0xc3f7('0x93')];break;case _0xc3f7('0x94'):_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x85')]=_0x2ea1d9[_0xc3f7('0x5e')][0x0][_0xc3f7('0x2a')]['id'];_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x88')]=_0x2ea1d9[_0xc3f7('0x5e')][0x0][_0xc3f7('0x2a')]['from'];_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x5e')]=_0x2ea1d9[_0xc3f7('0x5e')][0x0][_0xc3f7('0x2a')]['text'];break;case'intelepeer':_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x88')]=_0x2ea1d9['body']['from'];_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x5e')]=_0x2ea1d9[_0xc3f7('0x5e')][_0xc3f7('0x2a')];_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x85')]=_0x2ea1d9[_0xc3f7('0x5e')][_0xc3f7('0x95')];break;}}if(_0x2880dd[_0xc3f7('0x5e')]['id']){delete _0x2880dd['body']['id'];}if(_['isNil'](_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x88')])){throw new db['Sequelize'][(_0xc3f7('0x96'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x5e')])||_0x2880dd['body'][_0xc3f7('0x5e')]===''){throw new db[(_0xc3f7('0x7b'))][(_0xc3f7('0x96'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2880dd[_0xc3f7('0x5e')]['mapKey'])){throw new db[(_0xc3f7('0x7b'))]['ValidationError'](_0xc3f7('0x97')+_0x27d3fb);}if(!_['includes'](_0x27d3fb,_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x98')])){throw new db['Sequelize'][(_0xc3f7('0x96'))](_0xc3f7('0x99')+_0x27d3fb);}_0x36a8fa[_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x98')]]=_0x2880dd['body'][_0xc3f7('0x88')];return db['CmList'][_0xc3f7('0x5c')]({'where':{'id':_0x2880dd[_0xc3f7('0x76')][_0xc3f7('0x80')]},'include':[{'model':db[_0xc3f7('0x7a')],'as':_0xc3f7('0x9a'),'where':_0x36a8fa,'limit':0x1,'order':[[_0xc3f7('0x7f'),_0xc3f7('0x9b')]]}]});})[_0xc3f7('0x24')](handleEntityNotFound(_0x1f76a0,null))[_0xc3f7('0x24')](function(_0x32845f){if(_0x32845f){_0x2880dd[_0xc3f7('0x9c')]=_[_0xc3f7('0x9d')](_0x32845f,[_0xc3f7('0x9a')]);if(_0x32845f[_0xc3f7('0x9a')][_0xc3f7('0x4a')]){return _0x32845f[_0xc3f7('0x9a')][0x0];}var _0x4ce151=_[_0xc3f7('0x1b')](_0x2880dd[_0xc3f7('0x5e')],{'firstName':_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x88')],'ListId':_0x32845f['id']});_0x4ce151[_0x2880dd[_0xc3f7('0x5e')]['mapKey']]=_0x2880dd[_0xc3f7('0x5e')]['from'];return db[_0xc3f7('0x7a')][_0xc3f7('0x5d')](_0x4ce151,{'fields':_0x42d4d2,'raw':!![]});}})['then'](handleEntityNotFound(_0x1f76a0,null))['then'](function(_0x5c2623){if(_0x5c2623){_0x2880dd[_0xc3f7('0x9e')]=_0x5c2623;var _0x177bb9={'ContactId':_0x5c2623['id'],'phone':_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x88')],'SmsAccountId':_0x2ea1d9[_0xc3f7('0x59')]['id']};var _0x309a06={'ContactId':_0x5c2623['id'],'SmsAccountId':_0x2ea1d9['params']['id'],'closed':![]};return db[_0xc3f7('0x9f')]['find']({'where':_0x309a06})[_0xc3f7('0x24')](function(_0x16828e){if(_0x16828e){return[_0x16828e,![]];}return db[_0xc3f7('0x9f')]['create'](_0x177bb9)[_0xc3f7('0x24')](function(_0x52a948){return[_0x52a948,!![]];});});}})[_0xc3f7('0xa0')](function(_0x51d005,_0x32283d){_0x2880dd[_0xc3f7('0xa1')]=_0x51d005[_0xc3f7('0x39')]({'plain':!![]});_0x2880dd[_0xc3f7('0xa1')][_0xc3f7('0xa2')]=![];if(_0x32283d){if(_0x2880dd['account'][_0xc3f7('0xa3')]){_0x2880dd[_0xc3f7('0x77')][_0xc3f7('0xa4')]({'id':0x0,'priority':_0x2880dd['applications'][_0xc3f7('0x4a')]+0x1,'app':_0xc3f7('0xa5'),'appdata':_0xc3f7('0xa6'),'interval':_0xc3f7('0xa7')});}_0x2880dd[_0xc3f7('0xa1')][_0xc3f7('0xa2')]=!![];}return db[_0xc3f7('0xa8')][_0xc3f7('0x5d')]({'phone':_0x2880dd[_0xc3f7('0x5e')]['from'],'messageId':_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x85')],'body':_0x2880dd[_0xc3f7('0x5e')][_0xc3f7('0x5e')],'SmsAccountId':_0x2ea1d9[_0xc3f7('0x59')]['id'],'SmsInteractionId':_0x51d005['id'],'direction':'in','ContactId':_0x51d005[_0xc3f7('0xa9')],'AttachmentId':_0x2880dd[_0xc3f7('0x5e')]['AttachmentId']});})['then'](function(_0x290595){_0x2880dd['message']=_0x290595;if(_0x2880dd[_0xc3f7('0xa1')][_0xc3f7('0xaa')]){return db[_0xc3f7('0xab')][_0xc3f7('0x5c')]({'attributes':['id',_0xc3f7('0x3d')],'where':{'id':_0x2880dd['interaction'][_0xc3f7('0xaa')]}})[_0xc3f7('0x24')](function(_0x1e999e){if(_0x1e999e){_0x2880dd['applications'][_0xc3f7('0xac')]({'id':0x0,'priority':0x0,'app':_0xc3f7('0xad'),'appdata':_0x1e999e[_0xc3f7('0x3d')]+','+(_0x2880dd[_0xc3f7('0x76')][_0xc3f7('0xae')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc3f7('0xaf'),_0xc3f7('0xb0'),_0x2880dd);});}return respondWithRpcPromise(_0xc3f7('0xaf'),_0xc3f7('0xb0'),_0x2880dd);})['then'](function(_0x427759){if(_0x427759){var _0x36c70f=0xc8;var _0x5e3a9a=_0xc3f7('0xb1');logger[_0xc3f7('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5e3a9a,_0x36c70f,_0xc3f7('0xb2'));logger[_0xc3f7('0xb3')](_0xc3f7('0xb4'),_0x5e3a9a,_0x36c70f,_0xc3f7('0xb2'),JSON[_0xc3f7('0x28')](_0x427759));if(_0x2880dd[_0xc3f7('0x76')][_0xc3f7('0x43')]===_0xc3f7('0x82')){return _0x1f76a0[_0xc3f7('0x2e')](_0x36c70f)[_0xc3f7('0x34')](_0xc3f7('0xb5'),_0xc3f7('0xb6'))[_0xc3f7('0xb7')](_0xc3f7('0xb8'));}else{return _0x1f76a0[_0xc3f7('0x2e')](_0x36c70f)['json'](_0x427759);}}})[_0xc3f7('0x2c')](handleError(_0x1f76a0,null));};exports[_0xc3f7('0xb9')]=function(_0x579a87,_0xc8ee8a,_0x3dd929){return db[_0xc3f7('0x40')]['findOne']({'where':{'id':_0x579a87[_0xc3f7('0x59')]['id']}})[_0xc3f7('0x24')](handleEntityNotFound(_0xc8ee8a,null))[_0xc3f7('0x24')](function(_0x234f8f){if(_0x234f8f){return db[_0xc3f7('0xba')][_0xc3f7('0xbb')](function(_0x5df5e5){return db[_0xc3f7('0x74')][_0xc3f7('0x3b')]({'where':{'SmsAccountId':_0x579a87[_0xc3f7('0x59')]['id']},'transaction':_0x5df5e5})[_0xc3f7('0x24')](function(_0x24509c){var _0x3fb4a6=_[_0xc3f7('0x3f')](_0x579a87[_0xc3f7('0x5e')],function(_0x194398){_0x194398['SmsAccountId']=_0x579a87[_0xc3f7('0x59')]['id'];return _0x194398;});return db['SmsApplication']['bulkCreate'](_0x3fb4a6,{'transaction':_0x5df5e5});});})[_0xc3f7('0x24')](function(){return db['SmsApplication'][_0xc3f7('0xbc')]({'where':{'SmsAccountId':_0x579a87[_0xc3f7('0x59')]['id']},'order':_0xc3f7('0xbd')});});}})[_0xc3f7('0x24')](respondWithResult(_0xc8ee8a,null))[_0xc3f7('0x2c')](handleError(_0xc8ee8a,null));};exports[_0xc3f7('0xbe')]=function(_0x2cc873,_0x3c3e60,_0x7b383){var _0x2f1d81={};var _0x4835d6={};var _0x75f641;var _0x140fee;return db[_0xc3f7('0x40')][_0xc3f7('0x70')]({'where':{'id':_0x2cc873['params']['id']}})[_0xc3f7('0x24')](handleEntityNotFound(_0x3c3e60,null))['then'](function(_0x20ebf5){if(_0x20ebf5){_0x75f641=_0x20ebf5;_0x4835d6['model']=_['keys'](db['SmsApplication'][_0xc3f7('0x41')]);_0x4835d6[_0xc3f7('0x44')]=_[_0xc3f7('0x5b')](_0x2cc873[_0xc3f7('0x44')]);_0x4835d6[_0xc3f7('0x45')]=_['intersection'](_0x4835d6['model'],_0x4835d6[_0xc3f7('0x44')]);_0x2f1d81[_0xc3f7('0x48')]=_[_0xc3f7('0x46')](_0x4835d6[_0xc3f7('0x47')],qs[_0xc3f7('0x49')](_0x2cc873['query'][_0xc3f7('0x49')]));_0x2f1d81[_0xc3f7('0x48')]=_0x2f1d81[_0xc3f7('0x48')][_0xc3f7('0x4a')]?_0x2f1d81[_0xc3f7('0x48')]:_0x4835d6[_0xc3f7('0x47')];_0x2f1d81[_0xc3f7('0x72')]=qs[_0xc3f7('0x4d')](_0x2cc873[_0xc3f7('0x44')][_0xc3f7('0x4d')]);_0x2f1d81[_0xc3f7('0x4e')]=qs['filters'](_['pick'](_0x2cc873[_0xc3f7('0x44')],_0x4835d6['filters']));if(_0x2cc873[_0xc3f7('0x44')]['filter']){_0x2f1d81['where']=_[_0xc3f7('0x52')](_0x2f1d81[_0xc3f7('0x4e')],{'$or':_[_0xc3f7('0x3f')](_0x2f1d81[_0xc3f7('0x48')],function(_0x2e4e1e){var _0x55dd59={};_0x55dd59[_0x2e4e1e]={'$like':'%'+_0x2cc873[_0xc3f7('0x44')][_0xc3f7('0x50')]+'%'};return _0x55dd59;})});}_0x2f1d81=_['merge']({},_0x2f1d81,_0x2cc873[_0xc3f7('0x53')]);return _0x75f641['getApplications'](_0x2f1d81);}})['then'](function(_0x3473a4){if(_0x3473a4){_0x140fee=_0x3473a4[_0xc3f7('0x4a')];if(!_0x2cc873[_0xc3f7('0x44')][_0xc3f7('0x4b')](_0xc3f7('0x4c'))){_0x2f1d81[_0xc3f7('0x33')]=qs[_0xc3f7('0x33')](_0x2cc873['query']['limit']);_0x2f1d81[_0xc3f7('0x32')]=qs[_0xc3f7('0x32')](_0x2cc873[_0xc3f7('0x44')]['offset']);}return _0x75f641['getApplications'](_0x2f1d81);}})[_0xc3f7('0x24')](function(_0xe7a2){if(_0xe7a2){return _0xe7a2?{'count':_0x140fee,'rows':_0xe7a2}:null;}})[_0xc3f7('0x24')](respondWithResult(_0x3c3e60,null))['catch'](handleError(_0x3c3e60,null));};exports[_0xc3f7('0xbf')]=function(_0xe7d9bf,_0x45f63e,_0x50b942){var _0x5bbd53={'raw':![],'where':{}};var _0x5ed624={};var _0x55cde1={'count':0x0,'rows':[]};return db[_0xc3f7('0x40')][_0xc3f7('0x70')]({'where':{'id':_0xe7d9bf['params']['id']}})[_0xc3f7('0x24')](handleEntityNotFound(_0x45f63e,null))['then'](function(_0x3c9229){if(_0x3c9229){_0x5ed624[_0xc3f7('0x47')]=_[_0xc3f7('0x5b')](db[_0xc3f7('0x9f')][_0xc3f7('0x41')]);_0x5ed624[_0xc3f7('0x44')]=_['keys'](_0xe7d9bf['query']);_0x5ed624[_0xc3f7('0x45')]=_[_0xc3f7('0x46')](_0x5ed624[_0xc3f7('0x47')],_0x5ed624[_0xc3f7('0x44')]);_0x5bbd53[_0xc3f7('0x48')]=_[_0xc3f7('0x46')](_0x5ed624[_0xc3f7('0x47')],qs[_0xc3f7('0x49')](_0xe7d9bf[_0xc3f7('0x44')][_0xc3f7('0x49')]));_0x5bbd53['attributes']=_0x5bbd53[_0xc3f7('0x48')][_0xc3f7('0x4a')]?_0x5bbd53[_0xc3f7('0x48')]:_0x5ed624[_0xc3f7('0x47')];if(!_0xe7d9bf[_0xc3f7('0x44')][_0xc3f7('0x4b')](_0xc3f7('0x4c'))){_0x5bbd53[_0xc3f7('0x33')]=qs[_0xc3f7('0x33')](_0xe7d9bf['query'][_0xc3f7('0x33')]);_0x5bbd53['offset']=qs['offset'](_0xe7d9bf[_0xc3f7('0x44')]['offset']);}_0x5bbd53[_0xc3f7('0x72')]=qs[_0xc3f7('0x4d')](_0xe7d9bf['query'][_0xc3f7('0x4d')]);_0x5bbd53[_0xc3f7('0x4e')]=qs['filters'](_['pick'](_0xe7d9bf[_0xc3f7('0x44')],_0x5ed624['filters']));_0x5bbd53[_0xc3f7('0x4e')]['SmsAccountId']=_0x3c9229['id'];if(_0xe7d9bf[_0xc3f7('0x44')][_0xc3f7('0x50')]){_0x5bbd53[_0xc3f7('0x4e')]=_[_0xc3f7('0x52')](_0x5bbd53[_0xc3f7('0x4e')],{'$or':_[_0xc3f7('0x3f')](_0x5bbd53['attributes'],function(_0x3198d1){var _0x3b3ada={};_0x3b3ada[_0x3198d1]={'$like':'%'+_0xe7d9bf[_0xc3f7('0x44')]['filter']+'%'};return _0x3b3ada;})});}_0x5bbd53=_[_0xc3f7('0x52')]({},_0x5bbd53,_0xe7d9bf[_0xc3f7('0x53')]);return db[_0xc3f7('0x9f')]['count']({'where':_0x5bbd53[_0xc3f7('0x4e')]})[_0xc3f7('0x24')](function(_0x172b37){_0x55cde1[_0xc3f7('0x31')]=_0x172b37;if(_0xe7d9bf[_0xc3f7('0x44')]['includeAll']){_0x5bbd53[_0xc3f7('0x55')]=[{'model':db[_0xc3f7('0x7a')],'as':_0xc3f7('0xc0'),'required':![]},{'model':db['User'],'as':_0xc3f7('0xc1'),'attributes':[_0xc3f7('0x3d'),_0xc3f7('0xc2'),_0xc3f7('0xc3')],'required':![]},{'model':db[_0xc3f7('0xc4')],'as':_0xc3f7('0xc5'),'attributes':['id','name',_0xc3f7('0xc6')],'where':_0xe7d9bf[_0xc3f7('0x44')][_0xc3f7('0xc7')]?{'id':_0xe7d9bf['query'][_0xc3f7('0xc7')]}:undefined,'required':_0xe7d9bf[_0xc3f7('0x44')][_0xc3f7('0xc7')]?!![]:![]}];}return db[_0xc3f7('0x9f')]['findAll'](_0x5bbd53);})[_0xc3f7('0x24')](function(_0x2ced92){_0x55cde1['rows']=_0x2ced92;return _0x55cde1;});}})[_0xc3f7('0x24')](respondWithFilteredResult(_0x45f63e,_0x5bbd53))[_0xc3f7('0x2c')](handleError(_0x45f63e,null));};exports[_0xc3f7('0xb7')]=function(_0x4babef,_0x26ebcb,_0x14cd41){var _0x436f62,_0xe0d1ca,_0x40ed6a;if(_[_0xc3f7('0xc8')](_0x4babef[_0xc3f7('0x5e')][_0xc3f7('0x5e')])||_0x4babef[_0xc3f7('0x5e')][_0xc3f7('0x5e')]===''){throw new db['Sequelize'][(_0xc3f7('0x96'))](_0xc3f7('0xc9'));}if(_[_0xc3f7('0xc8')](_0x4babef['body']['to'])){throw new db[(_0xc3f7('0x7b'))]['ValidationError'](_0xc3f7('0xca'));}_0x436f62=_0x4babef[_0xc3f7('0x5e')]['to'];return db[_0xc3f7('0x40')][_0xc3f7('0x5c')]({'where':{'id':_0x4babef['params']['id']},'include':[{'model':db[_0xc3f7('0xcb')],'as':'List','include':[{'model':db[_0xc3f7('0x7a')],'as':_0xc3f7('0x9a'),'where':{'mobile':_0x436f62},'limit':0x1,'order':[[_0xc3f7('0x7f'),_0xc3f7('0x9b')]]}]}]})[_0xc3f7('0x24')](handleEntityNotFound(_0x26ebcb,null))[_0xc3f7('0x24')](function(_0x10e6bc){if(_0x10e6bc&&_0x10e6bc[_0xc3f7('0xcc')]){_0xe0d1ca=_0x10e6bc[_0xc3f7('0x39')]({'plain':!![]});if(_0xe0d1ca['List']&&_0xe0d1ca[_0xc3f7('0xcc')]['Contacts']['length']){return _0xe0d1ca[_0xc3f7('0xcc')][_0xc3f7('0x9a')][0x0];}return db[_0xc3f7('0x7a')]['create'](_['defaults'](_0x4babef[_0xc3f7('0x5e')],{'firstName':_0x436f62,'mobile':_0x436f62,'phone':_0x436f62,'ListId':_0xe0d1ca[_0xc3f7('0x80')]}));}})[_0xc3f7('0x24')](handleEntityNotFound(_0x26ebcb,null))[_0xc3f7('0x24')](function(_0x29c7d5){if(_0x29c7d5){_0x40ed6a=_0x29c7d5;return db[_0xc3f7('0x9f')][_0xc3f7('0x5c')]({'where':{'ContactId':_0x40ed6a['id'],'closed':![],'SmsAccountId':_0xe0d1ca['id']}})[_0xc3f7('0x24')](function(_0x2b117f){if(_0x2b117f){return[_0x2b117f,![]];}return db[_0xc3f7('0x9f')][_0xc3f7('0x5d')]({'UserId':_0x4babef[_0xc3f7('0x61')]['id'],'ContactId':_0x40ed6a['id'],'SmsAccountId':_0xe0d1ca['id'],'phone':_0x436f62,'firstMsgDirection':_0xc3f7('0xcd'),'Messages':[_[_0xc3f7('0x52')](_0x4babef[_0xc3f7('0x5e')],{'read':![],'body':_0x4babef[_0xc3f7('0x5e')][_0xc3f7('0x5e')],'phone':_0x436f62,'SmsAccountId':_0xe0d1ca['id'],'UserId':_0x4babef['user']['id'],'ContactId':_0x40ed6a['id']})]},{'include':[{'model':db[_0xc3f7('0xa8')],'as':_0xc3f7('0xce')}]})[_0xc3f7('0x24')](function(_0x391f17){return[_0x391f17,!![]];});});}})['spread'](function(_0x3e2593,_0x336580){if(_0x336580){return _0x3e2593;}return db['SmsMessage'][_0xc3f7('0x5d')](_['merge'](_0x4babef['body'],{'read':![],'body':_0x4babef[_0xc3f7('0x5e')][_0xc3f7('0x5e')],'phone':_0x436f62,'SmsAccountId':_0xe0d1ca['id'],'SmsInteractionId':_0x3e2593['id'],'UserId':_0x4babef[_0xc3f7('0x61')]['id'],'ContactId':_0x40ed6a['id']}))['then'](function(_0x11dc6b){_0x3e2593[_0xc3f7('0xcf')][_0xc3f7('0xce')]=[];_0x3e2593[_0xc3f7('0xcf')][_0xc3f7('0xce')][_0xc3f7('0xa4')](_0x11dc6b[_0xc3f7('0xcf')]);return _0x3e2593;});})[_0xc3f7('0x24')](respondWithResult(_0x26ebcb,null))[_0xc3f7('0x2c')](handleError(_0x26ebcb,null));};exports[_0xc3f7('0x2e')]=function(_0x281d5b,_0x5aec40,_0x2a95f2){if(_0x281d5b['body']['id']){delete _0x281d5b[_0xc3f7('0x5e')]['id'];}var _0x2beadd,_0x8608a6,_0x2daa95;return db[_0xc3f7('0x40')][_0xc3f7('0x5c')]({'where':{'id':_0x281d5b[_0xc3f7('0x59')]['id']}})[_0xc3f7('0x24')](handleEntityNotFound(_0x5aec40,null))[_0xc3f7('0x24')](function(_0x129552){if(_0x129552){_0x2daa95=_0x129552;logger['debug'](_0xc3f7('0x27'),'status','received\x20delivery\x20report\x20from',_0x129552['type'],util[_0xc3f7('0xd0')](_0x281d5b['body'],{'showHidden':![],'depth':null}));switch(_0x129552['type']){case _0xc3f7('0x87'):if(_0x281d5b['body'][_0xc3f7('0xd1')]&&_0x281d5b[_0xc3f7('0x5e')][_0xc3f7('0x2e')]){_0x8608a6=_0x281d5b[_0xc3f7('0x5e')][_0xc3f7('0x2e')];return db['SmsMessage'][_0xc3f7('0x5c')]({'where':{'messageId':_0x281d5b[_0xc3f7('0x5e')][_0xc3f7('0xd1')]}});}break;case _0xc3f7('0x8b'):if(_0x281d5b['body'][_0xc3f7('0xd2')]&&_0x281d5b['body'][_0xc3f7('0xd3')]){_0x8608a6=_0x281d5b[_0xc3f7('0x5e')]['statusInt'];return db[_0xc3f7('0xa8')][_0xc3f7('0x5c')]({'where':{'messageId':_0x281d5b[_0xc3f7('0x5e')][_0xc3f7('0xd2')]}});}break;case _0xc3f7('0x8c'):if(_0x281d5b[_0xc3f7('0x5e')][_0xc3f7('0xd4')]&&_0x281d5b[_0xc3f7('0x5e')][_0xc3f7('0xd5')]){_0x8608a6=_0x281d5b[_0xc3f7('0x5e')]['status_code'];return db['SmsMessage'][_0xc3f7('0x5c')]({'where':{'messageId':_0x281d5b['body'][_0xc3f7('0xd4')]}});}break;case'infobip':var _0x243921=_0x281d5b[_0xc3f7('0x5e')][_0xc3f7('0xd6')][0x0];if(_0x243921[_0xc3f7('0x85')]&&_0x243921['status'][_0xc3f7('0xd7')]===_0xc3f7('0xd8')){_0x8608a6=_0x243921[_0xc3f7('0x2e')][_0xc3f7('0xd7')];return db[_0xc3f7('0xa8')][_0xc3f7('0x5c')]({'where':{'messageId':_0x243921['messageId']}});}break;case _0xc3f7('0x91'):if(_0x281d5b[_0xc3f7('0x5e')][_0xc3f7('0x85')]&&_0x281d5b['body'][_0xc3f7('0x2e')]){_0x8608a6=_0x281d5b[_0xc3f7('0x5e')][_0xc3f7('0x2e')];return db[_0xc3f7('0xa8')][_0xc3f7('0x5c')]({'where':{'messageId':_0x281d5b[_0xc3f7('0x5e')][_0xc3f7('0x85')]}});}break;case'bandwidth':if(_0x281d5b['body'][0x0][_0xc3f7('0x2a')]['id']){_0x8608a6=_0x281d5b['body'][0x0][_0xc3f7('0x43')];return db[_0xc3f7('0xa8')][_0xc3f7('0x5c')]({'where':{'messageId':_0x281d5b[_0xc3f7('0x5e')][0x0]['message']['id']}});}break;case _0xc3f7('0xd9'):if(_0x281d5b[_0xc3f7('0x5e')][_0xc3f7('0xda')]&&_0x281d5b[_0xc3f7('0x5e')]['status']){_0x8608a6=_0x281d5b[_0xc3f7('0x5e')][_0xc3f7('0x2e')];return db[_0xc3f7('0xa8')][_0xc3f7('0x5c')]({'where':{'messageId':_0x281d5b[_0xc3f7('0x5e')]['redif']}});}break;}}})[_0xc3f7('0x24')](handleEntityNotFound(_0x5aec40,null))[_0xc3f7('0x24')](function(_0x1f7205){if(_0x1f7205){_0x2beadd=_0x1f7205;switch(_0x2daa95[_0xc3f7('0x43')]){case _0xc3f7('0x87'):if(_0x8608a6===_0xc3f7('0xd8')){return _0x2beadd[_0xc3f7('0x38')]({'read':!![]});}else{logger['error'](_0xc3f7('0x27'),_0xc3f7('0x2e'),'skebby',util[_0xc3f7('0xd0')](_0x281d5b[_0xc3f7('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xc3f7('0x8b'):if(_0x8608a6==='1'){return _0x2beadd[_0xc3f7('0x38')]({'read':!![]});}else{logger[_0xc3f7('0x29')](_0xc3f7('0x27'),_0xc3f7('0x2e'),_0xc3f7('0x87'),util[_0xc3f7('0xd0')](_0x281d5b[_0xc3f7('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xc3f7('0x8c'):if(!_0x281d5b[_0xc3f7('0x5e')][_0xc3f7('0xdb')]&&_0x8608a6>=0xc8&&_0x8608a6<=0xce){return _0x2beadd[_0xc3f7('0x38')]({'read':!![]});}else{logger['error'](_0xc3f7('0x27'),'status',_0xc3f7('0x8c'),util['inspect'](_0x281d5b[_0xc3f7('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xc3f7('0x8f'):var _0x3b801c=_0x281d5b['body'][_0xc3f7('0xd6')][0x0];if(_0x3b801c[_0xc3f7('0x2e')][_0xc3f7('0xd7')]==='DELIVERED'){return _0x2beadd[_0xc3f7('0x38')]({'read':!![]});}else{logger['error'](_0xc3f7('0x27'),'status',_0xc3f7('0x8f'),util[_0xc3f7('0xd0')](_0x281d5b[_0xc3f7('0x5e')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x8608a6=='DELIVERED_TO_GATEWAY'||_0x8608a6==_0xc3f7('0xdc')){return _0x2beadd[_0xc3f7('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc3f7('0x2e'),'clickatell',util[_0xc3f7('0xd0')](_0x281d5b[_0xc3f7('0x5e')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x8608a6==_0xc3f7('0xdd')){return _0x2beadd[_0xc3f7('0x38')]({'read':!![]});}else{logger[_0xc3f7('0x29')](_0xc3f7('0x27'),_0xc3f7('0x2e'),'bandwidth',util[_0xc3f7('0xd0')](_0x281d5b[_0xc3f7('0x5e')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x8608a6===_0xc3f7('0xde')||_0x8608a6===_0xc3f7('0xdf')){return _0x2beadd['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc3f7('0x2e'),_0xc3f7('0xd9'),util[_0xc3f7('0xd0')](_0x281d5b[_0xc3f7('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x2beadd;}})[_0xc3f7('0x24')](respondWithResult(_0x5aec40,null))[_0xc3f7('0x2c')](handleError(_0x5aec40,null));};exports['statusGet']=function(_0x208e35,_0x3bf2fc,_0x3b7559){var _0x4a6485,_0x54950d,_0x4d4e1e;return db['SmsAccount']['find']({'where':{'id':_0x208e35['params']['id']}})['then'](handleEntityNotFound(_0x3bf2fc,null))[_0xc3f7('0x24')](function(_0x4252df){if(_0x4252df){_0x4d4e1e=_0x4252df;logger[_0xc3f7('0xb3')](_0xc3f7('0x27'),_0xc3f7('0x2e'),_0xc3f7('0xe0'),_0x4252df['type'],util[_0xc3f7('0xd0')](_0x208e35[_0xc3f7('0x44')],{'showHidden':![],'depth':null}));switch(_0x4252df['type']){case _0xc3f7('0xe1'):if(_0x208e35[_0xc3f7('0x44')][_0xc3f7('0xe2')]&&_0x208e35[_0xc3f7('0x44')][_0xc3f7('0xe3')]){_0x54950d=_0x208e35[_0xc3f7('0x44')][_0xc3f7('0xe3')];return db['SmsMessage'][_0xc3f7('0x5c')]({'where':{'messageId':_0x208e35['query'][_0xc3f7('0xe2')]}});}break;}}})[_0xc3f7('0x24')](handleEntityNotFound(_0x3bf2fc,null))['then'](function(_0x1bd22a){if(_0x1bd22a){_0x4a6485=_0x1bd22a;switch(_0x4d4e1e[_0xc3f7('0x43')]){case _0xc3f7('0xe1'):if(_0x54950d==='2'||_0x54950d==='6'){return _0x4a6485[_0xc3f7('0x38')]({'read':!![]});}else{logger[_0xc3f7('0x29')](_0xc3f7('0x27'),_0xc3f7('0x2e'),_0xc3f7('0xe1'),util[_0xc3f7('0xd0')](_0x208e35[_0xc3f7('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x4a6485;}})['then'](respondWithResult(_0x3bf2fc,null))[_0xc3f7('0x2c')](handleError(_0x3bf2fc,null));};exports[_0xc3f7('0xe4')]=function(_0x4ee1a1,_0x2a57f7,_0x34a9d5){return db[_0xc3f7('0x40')][_0xc3f7('0x5c')]({'where':{'id':_0x4ee1a1[_0xc3f7('0x59')]['id']}})[_0xc3f7('0x24')](handleEntityNotFound(_0x2a57f7,null))['then'](function(_0x3b234c){if(_0x3b234c){return _0x3b234c[_0xc3f7('0xe4')](_0x4ee1a1[_0xc3f7('0x5e')][_0xc3f7('0x6d')],_[_0xc3f7('0x9d')](_0x4ee1a1['body'],['ids','id'])||{})[_0xc3f7('0xa0')](function(_0x20cfe8){for(var _0x4563a6=0x0;_0x4563a6<_0x4ee1a1[_0xc3f7('0x5e')]['ids'][_0xc3f7('0x4a')];_0x4563a6+=0x1){socket['emit'](_0xc3f7('0xe5'),{'UserId':_0x4ee1a1[_0xc3f7('0x5e')][_0xc3f7('0x6d')][_0x4563a6],'SmsAccountId':_0x4ee1a1['params']['id']});}return _0x20cfe8;});}})[_0xc3f7('0x24')](respondWithResult(_0x2a57f7,null))[_0xc3f7('0x2c')](handleError(_0x2a57f7,null));};exports['removeAgents']=function(_0xd49a4b,_0x5a9d7e,_0x267391){return db[_0xc3f7('0x40')][_0xc3f7('0x5c')]({'where':{'id':_0xd49a4b[_0xc3f7('0x59')]['id']}})[_0xc3f7('0x24')](handleEntityNotFound(_0x5a9d7e,null))[_0xc3f7('0x24')](function(_0x3c7900){if(_0x3c7900){return _0x3c7900[_0xc3f7('0xe6')](_0xd49a4b['query'][_0xc3f7('0x6d')])[_0xc3f7('0x24')](function(){if(_['isArray'](_0xd49a4b[_0xc3f7('0x44')][_0xc3f7('0x6d')])){for(var _0x1355e4=0x0;_0x1355e4<_0xd49a4b['query']['ids'][_0xc3f7('0x4a')];_0x1355e4+=0x1){socket[_0xc3f7('0xe7')](_0xc3f7('0xe8'),{'UserId':Number(_0xd49a4b[_0xc3f7('0x44')]['ids'][_0x1355e4]),'SmsAccountId':Number(_0xd49a4b['params']['id'])});}}else{socket[_0xc3f7('0xe7')](_0xc3f7('0xe8'),{'UserId':Number(_0xd49a4b[_0xc3f7('0x44')][_0xc3f7('0x6d')]),'SmsAccountId':Number(_0xd49a4b['params']['id'])});}});}})[_0xc3f7('0x24')](respondWithStatusCode(_0x5a9d7e,null))['catch'](handleError(_0x5a9d7e,null));};exports[_0xc3f7('0xe9')]=function(_0xdcd8bc,_0xd538b8,_0x3884dc){var _0x29b35a={};var _0x4fa997={};var _0x5bdc02;var _0x2bc3e1;return db['SmsAccount'][_0xc3f7('0x70')]({'where':{'id':_0xdcd8bc[_0xc3f7('0x59')]['id']}})['then'](handleEntityNotFound(_0xd538b8,null))[_0xc3f7('0x24')](function(_0x40a19a){if(_0x40a19a){_0x5bdc02=_0x40a19a;_0x4fa997[_0xc3f7('0x47')]=_[_0xc3f7('0x5b')](db[_0xc3f7('0xab')]['rawAttributes']);_0x4fa997[_0xc3f7('0x44')]=_[_0xc3f7('0x5b')](_0xdcd8bc[_0xc3f7('0x44')]);_0x4fa997[_0xc3f7('0x45')]=_[_0xc3f7('0x46')](_0x4fa997[_0xc3f7('0x47')],_0x4fa997[_0xc3f7('0x44')]);_0x29b35a[_0xc3f7('0x48')]=_[_0xc3f7('0x46')](_0x4fa997['model'],qs['fields'](_0xdcd8bc['query']['fields']));_0x29b35a[_0xc3f7('0x48')]=_0x29b35a[_0xc3f7('0x48')]['length']?_0x29b35a[_0xc3f7('0x48')]:_0x4fa997[_0xc3f7('0x47')];_0x29b35a[_0xc3f7('0x72')]=qs[_0xc3f7('0x4d')](_0xdcd8bc[_0xc3f7('0x44')][_0xc3f7('0x4d')]);_0x29b35a[_0xc3f7('0x4e')]=qs[_0xc3f7('0x45')](_[_0xc3f7('0x4f')](_0xdcd8bc['query'],_0x4fa997[_0xc3f7('0x45')]));if(_0xdcd8bc[_0xc3f7('0x44')][_0xc3f7('0x50')]){_0x29b35a[_0xc3f7('0x4e')]=_['merge'](_0x29b35a[_0xc3f7('0x4e')],{'$or':_['map'](_0x29b35a['attributes'],function(_0x31b7ee){var _0x42bc85={};_0x42bc85[_0x31b7ee]={'$like':'%'+_0xdcd8bc['query'][_0xc3f7('0x50')]+'%'};return _0x42bc85;})});}_0x29b35a=_['merge']({},_0x29b35a,_0xdcd8bc[_0xc3f7('0x53')]);return _0x5bdc02[_0xc3f7('0xe9')](_0x29b35a);}})[_0xc3f7('0x24')](function(_0x5aa291){if(_0x5aa291){_0x2bc3e1=_0x5aa291[_0xc3f7('0x4a')];if(!_0xdcd8bc[_0xc3f7('0x44')][_0xc3f7('0x4b')](_0xc3f7('0x4c'))){_0x29b35a[_0xc3f7('0x33')]=qs[_0xc3f7('0x33')](_0xdcd8bc[_0xc3f7('0x44')][_0xc3f7('0x33')]);_0x29b35a[_0xc3f7('0x32')]=qs['offset'](_0xdcd8bc['query'][_0xc3f7('0x32')]);}return _0x5bdc02[_0xc3f7('0xe9')](_0x29b35a);}})['then'](function(_0x1a1d9c){if(_0x1a1d9c){return _0x1a1d9c?{'count':_0x2bc3e1,'rows':_0x1a1d9c}:null;}})[_0xc3f7('0x24')](respondWithResult(_0xd538b8,null))[_0xc3f7('0x2c')](handleError(_0xd538b8,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 210c9f9..731ab28 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 _0x3355=['update','remove','emit','hook','events','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x4a987b,_0x43efad){var _0xb8c588=function(_0x21070c){while(--_0x21070c){_0x4a987b['push'](_0x4a987b['shift']());}};_0xb8c588(++_0x43efad);}(_0x3355,0x94));var _0x5335=function(_0x105ba2,_0x346d0f){_0x105ba2=_0x105ba2-0x0;var _0x1e3f8b=_0x3355[_0x105ba2];return _0x1e3f8b;};'use strict';var EventEmitter=require(_0x5335('0x0'));var SmsAccount=require(_0x5335('0x1'))['db'][_0x5335('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5335('0x3')](0x0);var events={'afterCreate':_0x5335('0x4'),'afterUpdate':_0x5335('0x5'),'afterDestroy':_0x5335('0x6')};function emitEvent(_0x7cf0a2){return function(_0x533a11,_0x59a132,_0x3d07f3){SmsAccountEvents[_0x5335('0x7')](_0x7cf0a2+':'+_0x533a11['id'],_0x533a11);SmsAccountEvents['emit'](_0x7cf0a2,_0x533a11);_0x3d07f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x5335('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xdd84=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x48d20c,_0x177ad5){var _0x497cf4=function(_0x1b9e56){while(--_0x1b9e56){_0x48d20c['push'](_0x48d20c['shift']());}};_0x497cf4(++_0x177ad5);}(_0xdd84,0xb3));var _0x4dd8=function(_0x1264b9,_0x451f6d){_0x1264b9=_0x1264b9-0x0;var _0xa2332d=_0xdd84[_0x1264b9];return _0xa2332d;};'use strict';var EventEmitter=require(_0x4dd8('0x0'));var SmsAccount=require(_0x4dd8('0x1'))['db'][_0x4dd8('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4dd8('0x3')](0x0);var events={'afterCreate':_0x4dd8('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x26c0e0){return function(_0x1493ea,_0x2f86be,_0xf02e3d){SmsAccountEvents[_0x4dd8('0x5')](_0x26c0e0+':'+_0x1493ea['id'],_0x1493ea);SmsAccountEvents[_0x4dd8('0x5')](_0x26c0e0,_0x1493ea);_0xf02e3d(null);};}for(var e in events){if(events[_0x4dd8('0x6')](e)){var event=events[e];SmsAccount[_0x4dd8('0x7')](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 5856eb8..498e210 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 _0x8367=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','../../config/logger','api'];(function(_0xad380f,_0x3a29fb){var _0x5c1f52=function(_0x5c62af){while(--_0x5c62af){_0xad380f['push'](_0xad380f['shift']());}};_0x5c1f52(++_0x3a29fb);}(_0x8367,0x191));var _0x7836=function(_0x3246b4,_0x401153){_0x3246b4=_0x3246b4-0x0;var _0x34b3d7=_0x8367[_0x3246b4];return _0x34b3d7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7836('0x0'))(_0x7836('0x1'));var moment=require(_0x7836('0x2'));var BPromise=require(_0x7836('0x3'));var rp=require(_0x7836('0x4'));var fs=require('fs');var path=require(_0x7836('0x5'));var rimraf=require(_0x7836('0x6'));var config=require(_0x7836('0x7'));var attributes=require(_0x7836('0x8'));module[_0x7836('0x9')]=function(_0x1ea5ed,_0x4049ba){return _0x1ea5ed[_0x7836('0xa')](_0x7836('0xb'),attributes,{'tableName':_0x7836('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e52=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','sms_accounts','lodash','util','../../config/logger'];(function(_0x4989a2,_0x2d8a04){var _0x308837=function(_0x7e7cb5){while(--_0x7e7cb5){_0x4989a2['push'](_0x4989a2['shift']());}};_0x308837(++_0x2d8a04);}(_0x8e52,0x135));var _0x28e5=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0x8e52[_0x4191af];return _0x27bebf;};'use strict';var _=require(_0x28e5('0x0'));var util=require(_0x28e5('0x1'));var logger=require(_0x28e5('0x2'))('api');var moment=require(_0x28e5('0x3'));var BPromise=require(_0x28e5('0x4'));var rp=require(_0x28e5('0x5'));var fs=require('fs');var path=require(_0x28e5('0x6'));var rimraf=require(_0x28e5('0x7'));var config=require(_0x28e5('0x8'));var attributes=require('./smsAccount.attributes');module[_0x28e5('0x9')]=function(_0x14a1d4,_0x681079){return _0x14a1d4[_0x28e5('0xa')]('SmsAccount',attributes,{'tableName':_0x28e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 8572b10..817651e 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 _0x3aae=['error','code','SmsAccount,\x20%s,\x20%s','message','ShowSmsAccount','SmsAccount','options','raw','where','attributes','map','include','model','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./smsAccount.socket','register','request','then','info','request\x20sent','debug','stringify'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x3aae,0x136));var _0xe3aa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3aae[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe3aa('0x0'));var util=require(_0xe3aa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe3aa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3aa('0x3'))['db'];var utils=require(_0xe3aa('0x4'));var logger=require(_0xe3aa('0x5'))(_0xe3aa('0x6'));var config=require(_0xe3aa('0x7'));var jayson=require(_0xe3aa('0x8'));var client=jayson[_0xe3aa('0x9')][_0xe3aa('0xa')]({'port':0x232a});config['redis']=_[_0xe3aa('0xb')](config['redis'],{'host':_0xe3aa('0xc'),'port':0x18eb});var socket=require(_0xe3aa('0xd'))(new Redis(config[_0xe3aa('0xe')]));require(_0xe3aa('0xf'))[_0xe3aa('0x10')](socket);function respondWithRpcPromise(_0x35256d,_0x47f921,_0x6292f7){return new BPromise(function(_0x4b43d7,_0x3fe85c){return client[_0xe3aa('0x11')](_0x35256d,_0x6292f7)[_0xe3aa('0x12')](function(_0x4e89da){logger[_0xe3aa('0x13')]('SmsAccount,\x20%s,\x20%s',_0x47f921,_0xe3aa('0x14'));logger[_0xe3aa('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47f921,_0xe3aa('0x14'),JSON[_0xe3aa('0x16')](_0x4e89da));if(_0x4e89da[_0xe3aa('0x17')]){if(_0x4e89da['error'][_0xe3aa('0x18')]===0x1f4){logger[_0xe3aa('0x17')](_0xe3aa('0x19'),_0x47f921,_0x4e89da['error'][_0xe3aa('0x1a')]);return _0x3fe85c(_0x4e89da['error'][_0xe3aa('0x1a')]);}logger[_0xe3aa('0x17')]('SmsAccount,\x20%s,\x20%s',_0x47f921,_0x4e89da[_0xe3aa('0x17')][_0xe3aa('0x1a')]);return _0x4b43d7(_0x4e89da[_0xe3aa('0x17')]['message']);}else{logger[_0xe3aa('0x13')](_0xe3aa('0x19'),_0x47f921,_0xe3aa('0x14'));_0x4b43d7(_0x4e89da['result']['message']);}})['catch'](function(_0x3306e5){logger[_0xe3aa('0x17')](_0xe3aa('0x19'),_0x47f921,_0x3306e5);_0x3fe85c(_0x3306e5);});});}exports[_0xe3aa('0x1b')]=function(_0x2e7e52){var _0x257364=this;return new Promise(function(_0x3eb6f5,_0x549ea1){return db[_0xe3aa('0x1c')]['find']({'raw':_0x2e7e52['options']?_0x2e7e52[_0xe3aa('0x1d')][_0xe3aa('0x1e')]===undefined?!![]:![]:!![],'where':_0x2e7e52['options']?_0x2e7e52[_0xe3aa('0x1d')][_0xe3aa('0x1f')]||null:null,'attributes':_0x2e7e52['options']?_0x2e7e52[_0xe3aa('0x1d')][_0xe3aa('0x20')]||null:null,'include':_0x2e7e52[_0xe3aa('0x1d')]?_0x2e7e52[_0xe3aa('0x1d')]['include']?_[_0xe3aa('0x21')](_0x2e7e52[_0xe3aa('0x1d')][_0xe3aa('0x22')],function(_0x1e6016){return{'model':db[_0x1e6016[_0xe3aa('0x23')]],'as':_0x1e6016['as'],'attributes':_0x1e6016['attributes'],'include':_0x1e6016['include']?_[_0xe3aa('0x21')](_0x1e6016[_0xe3aa('0x22')],function(_0x26cbcf){return{'model':db[_0x26cbcf['model']],'as':_0x26cbcf['as'],'attributes':_0x26cbcf[_0xe3aa('0x20')],'include':_0x26cbcf[_0xe3aa('0x22')]?_[_0xe3aa('0x21')](_0x26cbcf[_0xe3aa('0x22')],function(_0x94f128){return{'model':db[_0x94f128[_0xe3aa('0x23')]],'as':_0x94f128['as'],'attributes':_0x94f128[_0xe3aa('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe3aa('0x12')](function(_0x573ba1){logger[_0xe3aa('0x13')](_0xe3aa('0x1b'),_0x2e7e52);logger[_0xe3aa('0x15')](_0xe3aa('0x1b'),_0x2e7e52,JSON[_0xe3aa('0x16')](_0x573ba1));_0x3eb6f5(_0x573ba1);})[_0xe3aa('0x24')](function(_0x2072b3){logger[_0xe3aa('0x17')](_0xe3aa('0x1b'),_0x2072b3['message'],_0x2e7e52);_0x549ea1(_0x257364['error'](0x1f4,_0x2072b3[_0xe3aa('0x1a')]));});});}; \ No newline at end of file +var _0xa370=['request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSmsAccount','SmsAccount','options','raw','include','map','model','attributes','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s'];(function(_0x58ca22,_0x19198c){var _0x1e63ff=function(_0x4ea473){while(--_0x4ea473){_0x58ca22['push'](_0x58ca22['shift']());}};_0x1e63ff(++_0x19198c);}(_0xa370,0xbf));var _0x0a37=function(_0x275d85,_0x5a883e){_0x275d85=_0x275d85-0x0;var _0x3cd754=_0xa370[_0x275d85];return _0x3cd754;};'use strict';var _=require(_0x0a37('0x0'));var util=require(_0x0a37('0x1'));var moment=require('moment');var BPromise=require(_0x0a37('0x2'));var rs=require(_0x0a37('0x3'));var fs=require('fs');var Redis=require(_0x0a37('0x4'));var db=require(_0x0a37('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0a37('0x6'));var config=require(_0x0a37('0x7'));var jayson=require(_0x0a37('0x8'));var client=jayson['client'][_0x0a37('0x9')]({'port':0x232a});config[_0x0a37('0xa')]=_[_0x0a37('0xb')](config['redis'],{'host':_0x0a37('0xc'),'port':0x18eb});var socket=require(_0x0a37('0xd'))(new Redis(config[_0x0a37('0xa')]));require('./smsAccount.socket')[_0x0a37('0xe')](socket);function respondWithRpcPromise(_0x12bae7,_0x384cd7,_0x62d7a4){return new BPromise(function(_0x4ba5d5,_0x581b92){return client[_0x0a37('0xf')](_0x12bae7,_0x62d7a4)[_0x0a37('0x10')](function(_0x535781){logger[_0x0a37('0x11')](_0x0a37('0x12'),_0x384cd7,_0x0a37('0x13'));logger[_0x0a37('0x14')](_0x0a37('0x15'),_0x384cd7,_0x0a37('0x13'),JSON['stringify'](_0x535781));if(_0x535781[_0x0a37('0x16')]){if(_0x535781[_0x0a37('0x16')]['code']===0x1f4){logger[_0x0a37('0x16')](_0x0a37('0x12'),_0x384cd7,_0x535781[_0x0a37('0x16')]['message']);return _0x581b92(_0x535781['error'][_0x0a37('0x17')]);}logger[_0x0a37('0x16')](_0x0a37('0x12'),_0x384cd7,_0x535781[_0x0a37('0x16')]['message']);return _0x4ba5d5(_0x535781[_0x0a37('0x16')][_0x0a37('0x17')]);}else{logger[_0x0a37('0x11')](_0x0a37('0x12'),_0x384cd7,'request\x20sent');_0x4ba5d5(_0x535781[_0x0a37('0x18')][_0x0a37('0x17')]);}})[_0x0a37('0x19')](function(_0x2d03d2){logger[_0x0a37('0x16')](_0x0a37('0x12'),_0x384cd7,_0x2d03d2);_0x581b92(_0x2d03d2);});});}exports[_0x0a37('0x1a')]=function(_0x3f5ee1){var _0x2b4fa2=this;return new Promise(function(_0x38c727,_0x2cee62){return db[_0x0a37('0x1b')]['find']({'raw':_0x3f5ee1['options']?_0x3f5ee1[_0x0a37('0x1c')][_0x0a37('0x1d')]===undefined?!![]:![]:!![],'where':_0x3f5ee1['options']?_0x3f5ee1[_0x0a37('0x1c')]['where']||null:null,'attributes':_0x3f5ee1[_0x0a37('0x1c')]?_0x3f5ee1[_0x0a37('0x1c')]['attributes']||null:null,'include':_0x3f5ee1[_0x0a37('0x1c')]?_0x3f5ee1['options'][_0x0a37('0x1e')]?_[_0x0a37('0x1f')](_0x3f5ee1[_0x0a37('0x1c')][_0x0a37('0x1e')],function(_0xd53acd){return{'model':db[_0xd53acd['model']],'as':_0xd53acd['as'],'attributes':_0xd53acd['attributes'],'include':_0xd53acd[_0x0a37('0x1e')]?_[_0x0a37('0x1f')](_0xd53acd['include'],function(_0x11ef23){return{'model':db[_0x11ef23[_0x0a37('0x20')]],'as':_0x11ef23['as'],'attributes':_0x11ef23[_0x0a37('0x21')],'include':_0x11ef23['include']?_[_0x0a37('0x1f')](_0x11ef23['include'],function(_0x15ce6b){return{'model':db[_0x15ce6b[_0x0a37('0x20')]],'as':_0x15ce6b['as'],'attributes':_0x15ce6b[_0x0a37('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0a37('0x10')](function(_0xf7f3fa){logger[_0x0a37('0x11')](_0x0a37('0x1a'),_0x3f5ee1);logger[_0x0a37('0x14')](_0x0a37('0x1a'),_0x3f5ee1,JSON[_0x0a37('0x22')](_0xf7f3fa));_0x38c727(_0xf7f3fa);})[_0x0a37('0x19')](function(_0x263e0e){logger['error']('ShowSmsAccount',_0x263e0e[_0x0a37('0x17')],_0x3f5ee1);_0x2cee62(_0x2b4fa2[_0x0a37('0x16')](0x1f4,_0x263e0e[_0x0a37('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index fedd2eb..60a6aae 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 _0x675c=['smsAccount:','./smsAccount.events','save','update','register','length'];(function(_0x418933,_0x35b1a8){var _0x53b9de=function(_0x1fdbed){while(--_0x1fdbed){_0x418933['push'](_0x418933['shift']());}};_0x53b9de(++_0x35b1a8);}(_0x675c,0x6d));var _0xc675=function(_0x2c3a37,_0x49f86a){_0x2c3a37=_0x2c3a37-0x0;var _0x509da8=_0x675c[_0x2c3a37];return _0x509da8;};'use strict';var SmsAccountEvents=require(_0xc675('0x0'));var events=[_0xc675('0x1'),'remove',_0xc675('0x2')];function createListener(_0x239958,_0x451395){return function(_0x1c1574){_0x451395['emit'](_0x239958,_0x1c1574);};}function removeListener(_0x236a0b,_0x4d85f9){return function(){SmsAccountEvents['removeListener'](_0x236a0b,_0x4d85f9);};}exports[_0xc675('0x3')]=function(_0x5c2f46){for(var _0x3b23bc=0x0,_0x2b55af=events[_0xc675('0x4')];_0x3b23bc<_0x2b55af;_0x3b23bc++){var _0x4757e8=events[_0x3b23bc];var _0x5ede4a=createListener(_0xc675('0x5')+_0x4757e8,_0x5c2f46);SmsAccountEvents['on'](_0x4757e8,_0x5ede4a);}}; \ No newline at end of file +var _0x130b=['length','remove','update','removeListener','register'];(function(_0x223c0d,_0x3ec04d){var _0x207827=function(_0x39d240){while(--_0x39d240){_0x223c0d['push'](_0x223c0d['shift']());}};_0x207827(++_0x3ec04d);}(_0x130b,0x187));var _0xb130=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x130b[_0x1f9f37];return _0x21c080;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save',_0xb130('0x0'),_0xb130('0x1')];function createListener(_0xabbd0e,_0x10db15){return function(_0x5bfda8){_0x10db15['emit'](_0xabbd0e,_0x5bfda8);};}function removeListener(_0x10a995,_0x3f7360){return function(){SmsAccountEvents[_0xb130('0x2')](_0x10a995,_0x3f7360);};}exports[_0xb130('0x3')]=function(_0x4b4d9d){for(var _0x32b382=0x0,_0xb2ff53=events[_0xb130('0x4')];_0x32b382<_0xb2ff53;_0x32b382++){var _0x527502=events[_0x32b382];var _0x385805=createListener('smsAccount:'+_0x527502,_0x4b4d9d);SmsAccountEvents['on'](_0x527502,_0x385805);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 1c12f8b..b3667f4 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 _0x3174=['../../components/interaction/service','../../config/environment','./smsApplication.controller','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x3174,0x6b));var _0x4317=function(_0x4e9481,_0x4defa6){_0x4e9481=_0x4e9481-0x0;var _0x4006ff=_0x3174[_0x4e9481];return _0x4006ff;};'use strict';var multer=require(_0x4317('0x0'));var util=require(_0x4317('0x1'));var path=require(_0x4317('0x2'));var timeout=require('connect-timeout');var express=require(_0x4317('0x3'));var router=express[_0x4317('0x4')]();var fs_extra=require(_0x4317('0x5'));var auth=require(_0x4317('0x6'));var interaction=require(_0x4317('0x7'));var config=require(_0x4317('0x8'));var controller=require(_0x4317('0x9'));router['get']('/',auth[_0x4317('0xa')](),controller[_0x4317('0xb')]);router['get'](_0x4317('0xc'),auth[_0x4317('0xa')](),controller['show']);router[_0x4317('0xd')]('/',auth['isAuthenticated'](),controller[_0x4317('0xe')]);router[_0x4317('0xf')](_0x4317('0xc'),auth[_0x4317('0xa')](),controller['update']);router[_0x4317('0x10')]('/:id',auth[_0x4317('0xa')](),controller[_0x4317('0x11')]);module[_0x4317('0x12')]=router; \ No newline at end of file +var _0x6cba=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','create','put','/:id','update'];(function(_0x496a49,_0x5430cd){var _0x3f7705=function(_0x13a9cb){while(--_0x13a9cb){_0x496a49['push'](_0x496a49['shift']());}};_0x3f7705(++_0x5430cd);}(_0x6cba,0x1a5));var _0xa6cb=function(_0x526caf,_0x4cf2ec){_0x526caf=_0x526caf-0x0;var _0x34b314=_0x6cba[_0x526caf];return _0x34b314;};'use strict';var multer=require(_0xa6cb('0x0'));var util=require(_0xa6cb('0x1'));var path=require('path');var timeout=require(_0xa6cb('0x2'));var express=require(_0xa6cb('0x3'));var router=express[_0xa6cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa6cb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa6cb('0x6'));var controller=require(_0xa6cb('0x7'));router[_0xa6cb('0x8')]('/',auth[_0xa6cb('0x9')](),controller[_0xa6cb('0xa')]);router[_0xa6cb('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa6cb('0xb')]('/',auth[_0xa6cb('0x9')](),controller[_0xa6cb('0xc')]);router[_0xa6cb('0xd')](_0xa6cb('0xe'),auth[_0xa6cb('0x9')](),controller[_0xa6cb('0xf')]);router[_0xa6cb('0x10')](_0xa6cb('0xe'),auth['isAuthenticated'](),controller[_0xa6cb('0x11')]);module[_0xa6cb('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 85d8935..ce8da66 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 _0xc5e3=['INTEGER','noop','STRING','*,*,*,*','sequelize','exports'];(function(_0x2861e4,_0x475263){var _0x45e027=function(_0x4928b5){while(--_0x4928b5){_0x2861e4['push'](_0x2861e4['shift']());}};_0x45e027(++_0x475263);}(_0xc5e3,0xac));var _0x3c5e=function(_0x3d964d,_0x5d348e){_0x3d964d=_0x3d964d-0x0;var _0x1ca6bf=_0xc5e3[_0x3d964d];return _0x1ca6bf;};'use strict';var Sequelize=require(_0x3c5e('0x0'));module[_0x3c5e('0x1')]={'priority':{'type':Sequelize[_0x3c5e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3c5e('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3c5e('0x4')],'defaultValue':_0x3c5e('0x5')}}; \ No newline at end of file +var _0x38d1=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x23db1c,_0x41409a){var _0x1d5f7c=function(_0x17bcce){while(--_0x17bcce){_0x23db1c['push'](_0x23db1c['shift']());}};_0x1d5f7c(++_0x41409a);}(_0x38d1,0xf2));var _0x138d=function(_0x2e30c9,_0x44ccfc){_0x2e30c9=_0x2e30c9-0x0;var _0x583cd7=_0x38d1[_0x2e30c9];return _0x583cd7;};'use strict';var Sequelize=require(_0x138d('0x0'));module[_0x138d('0x1')]={'priority':{'type':Sequelize[_0x138d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x138d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x138d('0x4')]()},'description':{'type':Sequelize[_0x138d('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x138d('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 510a114..01aee1f 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 _0xe3b5=['request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsApplication','count','includeAll','findAll','show','params','include','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x30a528,_0x1d04f2){var _0x3e029c=function(_0x4e4b97){while(--_0x4e4b97){_0x30a528['push'](_0x30a528['shift']());}};_0x3e029c(++_0x1d04f2);}(_0xe3b5,0xdd));var _0x5e3b=function(_0x456825,_0x37ff79){_0x456825=_0x456825-0x0;var _0x5e3a06=_0xe3b5[_0x456825];return _0x5e3a06;};'use strict';var pdf=require(_0x5e3b('0x0'));var emlformat=require(_0x5e3b('0x1'));var rimraf=require(_0x5e3b('0x2'));var zipdir=require(_0x5e3b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e3b('0x4'));var moment=require(_0x5e3b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5e3b('0x6'));var path=require(_0x5e3b('0x7'));var sox=require(_0x5e3b('0x8'));var csv=require(_0x5e3b('0x9'));var ejs=require(_0x5e3b('0xa'));var fs=require('fs');var fs_extra=require(_0x5e3b('0xb'));var _=require(_0x5e3b('0xc'));var squel=require(_0x5e3b('0xd'));var crypto=require(_0x5e3b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5e3b('0xf'));var toCsv=require(_0x5e3b('0x9'));var querystring=require(_0x5e3b('0x10'));var Papa=require(_0x5e3b('0x11'));var Redis=require(_0x5e3b('0x12'));var authService=require(_0x5e3b('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e3b('0x14'));var logger=require(_0x5e3b('0x15'))(_0x5e3b('0x16'));var utils=require('../../config/utils');var config=require(_0x5e3b('0x17'));var licenseUtil=require(_0x5e3b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35b3e2,_0x2bbdb5){_0x2bbdb5=_0x2bbdb5||0xcc;return function(_0x5abc86){if(_0x5abc86){return _0x35b3e2['sendStatus'](_0x2bbdb5);}return _0x35b3e2[_0x5e3b('0x19')](_0x2bbdb5)['end']();};}function respondWithResult(_0x19d174,_0x1e3566){_0x1e3566=_0x1e3566||0xc8;return function(_0xe17e7e){if(_0xe17e7e){return _0x19d174[_0x5e3b('0x19')](_0x1e3566)[_0x5e3b('0x1a')](_0xe17e7e);}};}function respondWithFilteredResult(_0x670945,_0x22a11c){return function(_0x259832){if(_0x259832){var _0x768ab6=_0x259832['count'],_0x18a212=_0x22a11c[_0x5e3b('0x1b')],_0x7e19b2=_0x22a11c[_0x5e3b('0x1b')]+_0x22a11c[_0x5e3b('0x1c')],_0x1ae1d6;if(_0x7e19b2>=_0x768ab6){_0x7e19b2=_0x768ab6;_0x1ae1d6=0xc8;}else{_0x1ae1d6=0xce;}_0x670945[_0x5e3b('0x19')](_0x1ae1d6);return _0x670945[_0x5e3b('0x1d')](_0x5e3b('0x1e'),_0x18a212+'-'+_0x7e19b2+'/'+_0x768ab6)[_0x5e3b('0x1a')](_0x259832);}return null;};}function patchUpdates(_0x6b89b1){return function(_0x5b2270){try{jsonpatch[_0x5e3b('0x1f')](_0x5b2270,_0x6b89b1,!![]);}catch(_0x203da3){return BPromise['reject'](_0x203da3);}return _0x5b2270[_0x5e3b('0x20')]();};}function saveUpdates(_0x4d0428,_0x65f09d){return function(_0x20d599){if(_0x20d599){return _0x20d599[_0x5e3b('0x21')](_0x4d0428)[_0x5e3b('0x22')](function(_0x4e5083){return _0x4e5083;});}return null;};}function removeEntity(_0x3cfa05,_0x4e116a){return function(_0x1034ad){if(_0x1034ad){return _0x1034ad[_0x5e3b('0x23')]()[_0x5e3b('0x22')](function(){_0x3cfa05[_0x5e3b('0x19')](0xcc)[_0x5e3b('0x24')]();});}};}function handleEntityNotFound(_0xf1da7c,_0x275000){return function(_0x5480c7){if(!_0x5480c7){_0xf1da7c['sendStatus'](0x194);}return _0x5480c7;};}function handleError(_0x890b2,_0x47b303){_0x47b303=_0x47b303||0x1f4;return function(_0x1e59fc){logger[_0x5e3b('0x25')](_0x1e59fc[_0x5e3b('0x26')]);if(_0x1e59fc[_0x5e3b('0x27')]){delete _0x1e59fc[_0x5e3b('0x27')];}_0x890b2['status'](_0x47b303)[_0x5e3b('0x28')](_0x1e59fc);};}exports['index']=function(_0x3899c5,_0x3c59bc){var _0x160cdf={},_0x10bb52={},_0x3851b0={'count':0x0,'rows':[]};var _0x1530f4=_[_0x5e3b('0x29')](db['SmsApplication'][_0x5e3b('0x2a')],function(_0x49053c){return{'name':_0x49053c[_0x5e3b('0x2b')],'type':_0x49053c['type'][_0x5e3b('0x2c')]};});_0x10bb52[_0x5e3b('0x2d')]=_['map'](_0x1530f4,_0x5e3b('0x27'));_0x10bb52[_0x5e3b('0x2e')]=_[_0x5e3b('0x2f')](_0x3899c5[_0x5e3b('0x2e')]);_0x10bb52[_0x5e3b('0x30')]=_[_0x5e3b('0x31')](_0x10bb52[_0x5e3b('0x2d')],_0x10bb52['query']);_0x160cdf[_0x5e3b('0x32')]=_[_0x5e3b('0x31')](_0x10bb52[_0x5e3b('0x2d')],qs[_0x5e3b('0x33')](_0x3899c5[_0x5e3b('0x2e')][_0x5e3b('0x33')]));_0x160cdf[_0x5e3b('0x32')]=_0x160cdf[_0x5e3b('0x32')][_0x5e3b('0x34')]?_0x160cdf['attributes']:_0x10bb52[_0x5e3b('0x2d')];if(!_0x3899c5[_0x5e3b('0x2e')][_0x5e3b('0x35')](_0x5e3b('0x36'))){_0x160cdf[_0x5e3b('0x1c')]=qs['limit'](_0x3899c5['query'][_0x5e3b('0x1c')]);_0x160cdf[_0x5e3b('0x1b')]=qs[_0x5e3b('0x1b')](_0x3899c5[_0x5e3b('0x2e')][_0x5e3b('0x1b')]);}_0x160cdf[_0x5e3b('0x37')]=qs[_0x5e3b('0x38')](_0x3899c5[_0x5e3b('0x2e')][_0x5e3b('0x38')]);_0x160cdf[_0x5e3b('0x39')]=qs['filters'](_[_0x5e3b('0x3a')](_0x3899c5[_0x5e3b('0x2e')],_0x10bb52[_0x5e3b('0x30')]),_0x1530f4);if(_0x3899c5[_0x5e3b('0x2e')][_0x5e3b('0x3b')]){_0x160cdf['where']=_[_0x5e3b('0x3c')](_0x160cdf[_0x5e3b('0x39')],{'$or':_[_0x5e3b('0x29')](_0x1530f4,function(_0x337b97){if(_0x337b97[_0x5e3b('0x3d')]!==_0x5e3b('0x3e')){var _0x1fa83f={};_0x1fa83f[_0x337b97[_0x5e3b('0x27')]]={'$like':'%'+_0x3899c5[_0x5e3b('0x2e')][_0x5e3b('0x3b')]+'%'};return _0x1fa83f;}})});}_0x160cdf=_[_0x5e3b('0x3c')]({},_0x160cdf,_0x3899c5[_0x5e3b('0x3f')]);var _0xbd1153={'where':_0x160cdf['where']};return db[_0x5e3b('0x40')][_0x5e3b('0x41')](_0xbd1153)[_0x5e3b('0x22')](function(_0xdffafb){_0x3851b0[_0x5e3b('0x41')]=_0xdffafb;if(_0x3899c5['query'][_0x5e3b('0x42')]){_0x160cdf['include']=[{'all':!![]}];}return db[_0x5e3b('0x40')][_0x5e3b('0x43')](_0x160cdf);})[_0x5e3b('0x22')](function(_0x3344a2){_0x3851b0['rows']=_0x3344a2;return _0x3851b0;})['then'](respondWithFilteredResult(_0x3c59bc,_0x160cdf))['catch'](handleError(_0x3c59bc,null));};exports[_0x5e3b('0x44')]=function(_0x18bee3,_0x1cdbd3){var _0x3b4e3e={'raw':!![],'where':{'id':_0x18bee3[_0x5e3b('0x45')]['id']}},_0x50c7f7={};_0x50c7f7['model']=_['keys'](db['SmsApplication'][_0x5e3b('0x2a')]);_0x50c7f7[_0x5e3b('0x2e')]=_[_0x5e3b('0x2f')](_0x18bee3[_0x5e3b('0x2e')]);_0x50c7f7[_0x5e3b('0x30')]=_[_0x5e3b('0x31')](_0x50c7f7[_0x5e3b('0x2d')],_0x50c7f7[_0x5e3b('0x2e')]);_0x3b4e3e['attributes']=_[_0x5e3b('0x31')](_0x50c7f7[_0x5e3b('0x2d')],qs[_0x5e3b('0x33')](_0x18bee3[_0x5e3b('0x2e')][_0x5e3b('0x33')]));_0x3b4e3e[_0x5e3b('0x32')]=_0x3b4e3e[_0x5e3b('0x32')][_0x5e3b('0x34')]?_0x3b4e3e[_0x5e3b('0x32')]:_0x50c7f7[_0x5e3b('0x2d')];if(_0x18bee3[_0x5e3b('0x2e')][_0x5e3b('0x42')]){_0x3b4e3e[_0x5e3b('0x46')]=[{'all':!![]}];}_0x3b4e3e=_[_0x5e3b('0x3c')]({},_0x3b4e3e,_0x18bee3['options']);return db[_0x5e3b('0x40')][_0x5e3b('0x47')](_0x3b4e3e)[_0x5e3b('0x22')](handleEntityNotFound(_0x1cdbd3,null))[_0x5e3b('0x22')](respondWithResult(_0x1cdbd3,null))[_0x5e3b('0x48')](handleError(_0x1cdbd3,null));};exports[_0x5e3b('0x49')]=function(_0x445366,_0x268814){return db['SmsApplication']['create'](_0x445366['body'],{})['then'](respondWithResult(_0x268814,0xc9))[_0x5e3b('0x48')](handleError(_0x268814,null));};exports[_0x5e3b('0x21')]=function(_0x3dca04,_0x1effb6){if(_0x3dca04[_0x5e3b('0x4a')]['id']){delete _0x3dca04[_0x5e3b('0x4a')]['id'];}return db[_0x5e3b('0x40')]['find']({'where':{'id':_0x3dca04[_0x5e3b('0x45')]['id']}})[_0x5e3b('0x22')](handleEntityNotFound(_0x1effb6,null))['then'](saveUpdates(_0x3dca04[_0x5e3b('0x4a')],null))['then'](respondWithResult(_0x1effb6,null))[_0x5e3b('0x48')](handleError(_0x1effb6,null));};exports[_0x5e3b('0x23')]=function(_0x46b98f,_0x2f8fc0){return db[_0x5e3b('0x40')][_0x5e3b('0x47')]({'where':{'id':_0x46b98f[_0x5e3b('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f8fc0,null))[_0x5e3b('0x22')](removeEntity(_0x2f8fc0,null))['catch'](handleError(_0x2f8fc0,null));}; \ No newline at end of file +var _0xccfb=['SmsApplication','findAll','catch','show','params','options','find','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','set','Content-Range','reject','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include'];(function(_0x1f244d,_0x19e830){var _0x16003a=function(_0x1ee3f3){while(--_0x1ee3f3){_0x1f244d['push'](_0x1f244d['shift']());}};_0x16003a(++_0x19e830);}(_0xccfb,0xa2));var _0xbccf=function(_0x201474,_0x1d0dbd){_0x201474=_0x201474-0x0;var _0x595f42=_0xccfb[_0x201474];return _0x595f42;};'use strict';var pdf=require(_0xbccf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbccf('0x1'));var zipdir=require(_0xbccf('0x2'));var jsonpatch=require(_0xbccf('0x3'));var rp=require(_0xbccf('0x4'));var moment=require(_0xbccf('0x5'));var BPromise=require(_0xbccf('0x6'));var Mustache=require(_0xbccf('0x7'));var util=require(_0xbccf('0x8'));var path=require(_0xbccf('0x9'));var sox=require(_0xbccf('0xa'));var csv=require(_0xbccf('0xb'));var ejs=require(_0xbccf('0xc'));var fs=require('fs');var fs_extra=require(_0xbccf('0xd'));var _=require(_0xbccf('0xe'));var squel=require(_0xbccf('0xf'));var crypto=require(_0xbccf('0x10'));var jsforce=require(_0xbccf('0x11'));var deskjs=require(_0xbccf('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbccf('0x13'));var Redis=require(_0xbccf('0x14'));var authService=require(_0xbccf('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbccf('0x16'));var logger=require(_0xbccf('0x17'))(_0xbccf('0x18'));var utils=require(_0xbccf('0x19'));var config=require(_0xbccf('0x1a'));var licenseUtil=require(_0xbccf('0x1b'));var db=require(_0xbccf('0x1c'))['db'];function respondWithStatusCode(_0x1cadab,_0x429e68){_0x429e68=_0x429e68||0xcc;return function(_0x2e4b36){if(_0x2e4b36){return _0x1cadab['sendStatus'](_0x429e68);}return _0x1cadab['status'](_0x429e68)[_0xbccf('0x1d')]();};}function respondWithResult(_0x855a4e,_0x55c295){_0x55c295=_0x55c295||0xc8;return function(_0x1782ce){if(_0x1782ce){return _0x855a4e[_0xbccf('0x1e')](_0x55c295)[_0xbccf('0x1f')](_0x1782ce);}};}function respondWithFilteredResult(_0x19f74e,_0x52b7ff){return function(_0xb91300){if(_0xb91300){var _0x23e00b=_0xb91300[_0xbccf('0x20')],_0x5de1ab=_0x52b7ff[_0xbccf('0x21')],_0x19300b=_0x52b7ff[_0xbccf('0x21')]+_0x52b7ff['limit'],_0x16cc79;if(_0x19300b>=_0x23e00b){_0x19300b=_0x23e00b;_0x16cc79=0xc8;}else{_0x16cc79=0xce;}_0x19f74e[_0xbccf('0x1e')](_0x16cc79);return _0x19f74e[_0xbccf('0x22')](_0xbccf('0x23'),_0x5de1ab+'-'+_0x19300b+'/'+_0x23e00b)[_0xbccf('0x1f')](_0xb91300);}return null;};}function patchUpdates(_0x2a3ca3){return function(_0x19ae6d){try{jsonpatch['apply'](_0x19ae6d,_0x2a3ca3,!![]);}catch(_0x24eacb){return BPromise[_0xbccf('0x24')](_0x24eacb);}return _0x19ae6d[_0xbccf('0x25')]();};}function saveUpdates(_0x4c8605,_0x39f0f3){return function(_0x6d5501){if(_0x6d5501){return _0x6d5501[_0xbccf('0x26')](_0x4c8605)[_0xbccf('0x27')](function(_0x464dfd){return _0x464dfd;});}return null;};}function removeEntity(_0x28d14f,_0x2078a7){return function(_0x4259be){if(_0x4259be){return _0x4259be['destroy']()[_0xbccf('0x27')](function(){_0x28d14f[_0xbccf('0x1e')](0xcc)[_0xbccf('0x1d')]();});}};}function handleEntityNotFound(_0x3b92cd,_0x14766d){return function(_0x137ba1){if(!_0x137ba1){_0x3b92cd[_0xbccf('0x28')](0x194);}return _0x137ba1;};}function handleError(_0x47520e,_0x4a50dd){_0x4a50dd=_0x4a50dd||0x1f4;return function(_0x4b50a3){logger[_0xbccf('0x29')](_0x4b50a3['stack']);if(_0x4b50a3[_0xbccf('0x2a')]){delete _0x4b50a3['name'];}_0x47520e[_0xbccf('0x1e')](_0x4a50dd)[_0xbccf('0x2b')](_0x4b50a3);};}exports[_0xbccf('0x2c')]=function(_0x43682b,_0x52c874){var _0x293263={},_0x309bf4={},_0x4aa4db={'count':0x0,'rows':[]};var _0x6d510e=_[_0xbccf('0x2d')](db['SmsApplication'][_0xbccf('0x2e')],function(_0xc74b4f){return{'name':_0xc74b4f[_0xbccf('0x2f')],'type':_0xc74b4f[_0xbccf('0x30')][_0xbccf('0x31')]};});_0x309bf4[_0xbccf('0x32')]=_[_0xbccf('0x2d')](_0x6d510e,_0xbccf('0x2a'));_0x309bf4[_0xbccf('0x33')]=_[_0xbccf('0x34')](_0x43682b[_0xbccf('0x33')]);_0x309bf4[_0xbccf('0x35')]=_[_0xbccf('0x36')](_0x309bf4[_0xbccf('0x32')],_0x309bf4[_0xbccf('0x33')]);_0x293263[_0xbccf('0x37')]=_[_0xbccf('0x36')](_0x309bf4[_0xbccf('0x32')],qs['fields'](_0x43682b[_0xbccf('0x33')][_0xbccf('0x38')]));_0x293263[_0xbccf('0x37')]=_0x293263[_0xbccf('0x37')][_0xbccf('0x39')]?_0x293263[_0xbccf('0x37')]:_0x309bf4[_0xbccf('0x32')];if(!_0x43682b['query'][_0xbccf('0x3a')](_0xbccf('0x3b'))){_0x293263[_0xbccf('0x3c')]=qs[_0xbccf('0x3c')](_0x43682b[_0xbccf('0x33')]['limit']);_0x293263[_0xbccf('0x21')]=qs[_0xbccf('0x21')](_0x43682b['query'][_0xbccf('0x21')]);}_0x293263[_0xbccf('0x3d')]=qs[_0xbccf('0x3e')](_0x43682b[_0xbccf('0x33')][_0xbccf('0x3e')]);_0x293263[_0xbccf('0x3f')]=qs['filters'](_['pick'](_0x43682b[_0xbccf('0x33')],_0x309bf4['filters']),_0x6d510e);if(_0x43682b[_0xbccf('0x33')][_0xbccf('0x40')]){_0x293263['where']=_[_0xbccf('0x41')](_0x293263[_0xbccf('0x3f')],{'$or':_[_0xbccf('0x2d')](_0x6d510e,function(_0x48d343){if(_0x48d343[_0xbccf('0x30')]!==_0xbccf('0x42')){var _0x4db646={};_0x4db646[_0x48d343[_0xbccf('0x2a')]]={'$like':'%'+_0x43682b['query']['filter']+'%'};return _0x4db646;}})});}_0x293263=_[_0xbccf('0x41')]({},_0x293263,_0x43682b['options']);var _0x566d82={'where':_0x293263[_0xbccf('0x3f')]};return db['SmsApplication'][_0xbccf('0x20')](_0x566d82)[_0xbccf('0x27')](function(_0x22b4b9){_0x4aa4db['count']=_0x22b4b9;if(_0x43682b[_0xbccf('0x33')][_0xbccf('0x43')]){_0x293263[_0xbccf('0x44')]=[{'all':!![]}];}return db[_0xbccf('0x45')][_0xbccf('0x46')](_0x293263);})[_0xbccf('0x27')](function(_0x1dd469){_0x4aa4db['rows']=_0x1dd469;return _0x4aa4db;})[_0xbccf('0x27')](respondWithFilteredResult(_0x52c874,_0x293263))[_0xbccf('0x47')](handleError(_0x52c874,null));};exports[_0xbccf('0x48')]=function(_0x2a873c,_0x2214f0){var _0x187628={'raw':!![],'where':{'id':_0x2a873c[_0xbccf('0x49')]['id']}},_0x2e8b97={};_0x2e8b97[_0xbccf('0x32')]=_[_0xbccf('0x34')](db[_0xbccf('0x45')][_0xbccf('0x2e')]);_0x2e8b97[_0xbccf('0x33')]=_[_0xbccf('0x34')](_0x2a873c['query']);_0x2e8b97[_0xbccf('0x35')]=_[_0xbccf('0x36')](_0x2e8b97['model'],_0x2e8b97[_0xbccf('0x33')]);_0x187628[_0xbccf('0x37')]=_[_0xbccf('0x36')](_0x2e8b97[_0xbccf('0x32')],qs[_0xbccf('0x38')](_0x2a873c[_0xbccf('0x33')][_0xbccf('0x38')]));_0x187628[_0xbccf('0x37')]=_0x187628[_0xbccf('0x37')][_0xbccf('0x39')]?_0x187628[_0xbccf('0x37')]:_0x2e8b97[_0xbccf('0x32')];if(_0x2a873c[_0xbccf('0x33')]['includeAll']){_0x187628[_0xbccf('0x44')]=[{'all':!![]}];}_0x187628=_[_0xbccf('0x41')]({},_0x187628,_0x2a873c[_0xbccf('0x4a')]);return db[_0xbccf('0x45')][_0xbccf('0x4b')](_0x187628)[_0xbccf('0x27')](handleEntityNotFound(_0x2214f0,null))[_0xbccf('0x27')](respondWithResult(_0x2214f0,null))[_0xbccf('0x47')](handleError(_0x2214f0,null));};exports['create']=function(_0x1e0fe5,_0x5505a6){return db['SmsApplication']['create'](_0x1e0fe5[_0xbccf('0x4c')],{})[_0xbccf('0x27')](respondWithResult(_0x5505a6,0xc9))[_0xbccf('0x47')](handleError(_0x5505a6,null));};exports[_0xbccf('0x26')]=function(_0x6f6a66,_0x1d9a44){if(_0x6f6a66['body']['id']){delete _0x6f6a66[_0xbccf('0x4c')]['id'];}return db[_0xbccf('0x45')][_0xbccf('0x4b')]({'where':{'id':_0x6f6a66[_0xbccf('0x49')]['id']}})[_0xbccf('0x27')](handleEntityNotFound(_0x1d9a44,null))[_0xbccf('0x27')](saveUpdates(_0x6f6a66[_0xbccf('0x4c')],null))['then'](respondWithResult(_0x1d9a44,null))[_0xbccf('0x47')](handleError(_0x1d9a44,null));};exports['destroy']=function(_0x54dd5e,_0x2e5d2d){return db[_0xbccf('0x45')][_0xbccf('0x4b')]({'where':{'id':_0x54dd5e[_0xbccf('0x49')]['id']}})[_0xbccf('0x27')](handleEntityNotFound(_0x2e5d2d,null))[_0xbccf('0x27')](removeEntity(_0x2e5d2d,null))[_0xbccf('0x47')](handleError(_0x2e5d2d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b553b19..6e2d44f 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 _0x4d9d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash'];(function(_0x56fa4d,_0x52faff){var _0x22fbcb=function(_0x2c7d49){while(--_0x2c7d49){_0x56fa4d['push'](_0x56fa4d['shift']());}};_0x22fbcb(++_0x52faff);}(_0x4d9d,0x1df));var _0xd4d9=function(_0x17d133,_0x3aebc5){_0x17d133=_0x17d133-0x0;var _0xf4f7a2=_0x4d9d[_0x17d133];return _0xf4f7a2;};'use strict';var _=require(_0xd4d9('0x0'));var util=require(_0xd4d9('0x1'));var logger=require(_0xd4d9('0x2'))(_0xd4d9('0x3'));var moment=require(_0xd4d9('0x4'));var BPromise=require(_0xd4d9('0x5'));var rp=require(_0xd4d9('0x6'));var fs=require('fs');var path=require(_0xd4d9('0x7'));var rimraf=require(_0xd4d9('0x8'));var config=require(_0xd4d9('0x9'));var attributes=require(_0xd4d9('0xa'));module[_0xd4d9('0xb')]=function(_0x236616,_0x3ed109){return _0x236616[_0xd4d9('0xc')](_0xd4d9('0xd'),attributes,{'tableName':_0xd4d9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd4d9('0xf')});}; \ No newline at end of file +var _0x162e=['util','api','bluebird','request-promise','../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x587ba2,_0x42eb40){var _0x50ec73=function(_0x2f32e3){while(--_0x2f32e3){_0x587ba2['push'](_0x587ba2['shift']());}};_0x50ec73(++_0x42eb40);}(_0x162e,0x172));var _0xe162=function(_0x3b426e,_0x533ce9){_0x3b426e=_0x3b426e-0x0;var _0x1b6f13=_0x162e[_0x3b426e];return _0x1b6f13;};'use strict';var _=require('lodash');var util=require(_0xe162('0x0'));var logger=require('../../config/logger')(_0xe162('0x1'));var moment=require('moment');var BPromise=require(_0xe162('0x2'));var rp=require(_0xe162('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe162('0x4'));var attributes=require(_0xe162('0x5'));module['exports']=function(_0x43d9c2,_0x2cee67){return _0x43d9c2['define'](_0xe162('0x6'),attributes,{'tableName':_0xe162('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe162('0x8'),'collate':_0xe162('0x9')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index ebae35f..5263927 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 _0x41fe=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','error','code','SmsApplication,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x33ba2a,_0x472888){var _0x1c77f8=function(_0x5b7e46){while(--_0x5b7e46){_0x33ba2a['push'](_0x33ba2a['shift']());}};_0x1c77f8(++_0x472888);}(_0x41fe,0xd1));var _0xe41f=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0x41fe[_0x2bc3f4];return _0x14ac53;};'use strict';var _=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var moment=require(_0xe41f('0x2'));var BPromise=require(_0xe41f('0x3'));var rs=require(_0xe41f('0x4'));var fs=require('fs');var Redis=require(_0xe41f('0x5'));var db=require(_0xe41f('0x6'))['db'];var utils=require(_0xe41f('0x7'));var logger=require(_0xe41f('0x8'))(_0xe41f('0x9'));var config=require(_0xe41f('0xa'));var jayson=require(_0xe41f('0xb'));var client=jayson[_0xe41f('0xc')][_0xe41f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x32a410,_0x6fda32,_0x23fdc9){return new BPromise(function(_0x519361,_0x27ba71){return client[_0xe41f('0xe')](_0x32a410,_0x23fdc9)['then'](function(_0x7303e4){logger['info']('SmsApplication,\x20%s,\x20%s',_0x6fda32,'request\x20sent');logger[_0xe41f('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x6fda32,'request\x20sent',JSON['stringify'](_0x7303e4));if(_0x7303e4[_0xe41f('0x10')]){if(_0x7303e4[_0xe41f('0x10')][_0xe41f('0x11')]===0x1f4){logger[_0xe41f('0x10')](_0xe41f('0x12'),_0x6fda32,_0x7303e4[_0xe41f('0x10')][_0xe41f('0x13')]);return _0x27ba71(_0x7303e4[_0xe41f('0x10')][_0xe41f('0x13')]);}logger[_0xe41f('0x10')]('SmsApplication,\x20%s,\x20%s',_0x6fda32,_0x7303e4[_0xe41f('0x10')][_0xe41f('0x13')]);return _0x519361(_0x7303e4['error'][_0xe41f('0x13')]);}else{logger[_0xe41f('0x14')](_0xe41f('0x12'),_0x6fda32,_0xe41f('0x15'));_0x519361(_0x7303e4[_0xe41f('0x16')][_0xe41f('0x13')]);}})[_0xe41f('0x17')](function(_0x54635b){logger['error'](_0xe41f('0x12'),_0x6fda32,_0x54635b);_0x27ba71(_0x54635b);});});} \ No newline at end of file +var _0x0a9f=['ioredis','../../config/utils','client','http','then','info','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x2ff6a8,_0xf84957){var _0x8b699=function(_0x302f46){while(--_0x302f46){_0x2ff6a8['push'](_0x2ff6a8['shift']());}};_0x8b699(++_0xf84957);}(_0x0a9f,0x64));var _0xf0a9=function(_0x3a8b2d,_0x4ea870){_0x3a8b2d=_0x3a8b2d-0x0;var _0x54f1be=_0x0a9f[_0x3a8b2d];return _0x54f1be;};'use strict';var _=require('lodash');var util=require(_0xf0a9('0x0'));var moment=require(_0xf0a9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0a9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0a9('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf0a9('0x4')][_0xf0a9('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x4e9fa6,_0x63889e,_0x4d14e0){return new BPromise(function(_0x798586,_0x399cf8){return client['request'](_0x4e9fa6,_0x4d14e0)[_0xf0a9('0x6')](function(_0x27c500){logger[_0xf0a9('0x7')]('SmsApplication,\x20%s,\x20%s',_0x63889e,_0xf0a9('0x8'));logger['debug'](_0xf0a9('0x9'),_0x63889e,_0xf0a9('0x8'),JSON[_0xf0a9('0xa')](_0x27c500));if(_0x27c500[_0xf0a9('0xb')]){if(_0x27c500['error'][_0xf0a9('0xc')]===0x1f4){logger[_0xf0a9('0xb')](_0xf0a9('0xd'),_0x63889e,_0x27c500[_0xf0a9('0xb')]['message']);return _0x399cf8(_0x27c500['error'][_0xf0a9('0xe')]);}logger[_0xf0a9('0xb')](_0xf0a9('0xd'),_0x63889e,_0x27c500[_0xf0a9('0xb')][_0xf0a9('0xe')]);return _0x798586(_0x27c500[_0xf0a9('0xb')][_0xf0a9('0xe')]);}else{logger['info'](_0xf0a9('0xd'),_0x63889e,_0xf0a9('0x8'));_0x798586(_0x27c500[_0xf0a9('0xf')]['message']);}})[_0xf0a9('0x10')](function(_0x5ea7ad){logger[_0xf0a9('0xb')](_0xf0a9('0xd'),_0x63889e,_0x5ea7ad);_0x399cf8(_0x5ea7ad);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index bec6b32..499ee1d 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 _0x2da6=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy'];(function(_0x10df03,_0x43bd49){var _0x43cbed=function(_0x4b13d9){while(--_0x4b13d9){_0x10df03['push'](_0x10df03['shift']());}};_0x43cbed(++_0x43bd49);}(_0x2da6,0x1dd));var _0x62da=function(_0x4063f2,_0x492432){_0x4063f2=_0x4063f2-0x0;var _0x72b663=_0x2da6[_0x4063f2];return _0x72b663;};'use strict';var multer=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var path=require(_0x62da('0x2'));var timeout=require(_0x62da('0x3'));var express=require(_0x62da('0x4'));var router=express[_0x62da('0x5')]();var fs_extra=require(_0x62da('0x6'));var auth=require(_0x62da('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x62da('0x8'));router[_0x62da('0x9')]('/',auth[_0x62da('0xa')](),controller[_0x62da('0xb')]);router[_0x62da('0x9')](_0x62da('0xc'),auth[_0x62da('0xa')](),controller[_0x62da('0xd')]);router[_0x62da('0x9')]('/:id',auth[_0x62da('0xa')](),controller[_0x62da('0xe')]);router[_0x62da('0x9')](_0x62da('0xf'),auth['isAuthenticated'](),controller[_0x62da('0x10')]);router[_0x62da('0x9')](_0x62da('0x11'),auth[_0x62da('0xa')](),controller[_0x62da('0x12')]);router['post']('/',auth[_0x62da('0xa')](),controller[_0x62da('0x13')]);router[_0x62da('0x14')](_0x62da('0xf'),auth[_0x62da('0xa')](),controller['addMessage']);router['post'](_0x62da('0x15'),auth[_0x62da('0xa')](),interaction[_0x62da('0x16')](_0x62da('0x17'),_0x62da('0x18')),controller[_0x62da('0x19')]);router[_0x62da('0x1a')](_0x62da('0x1b'),auth[_0x62da('0xa')](),interaction[_0x62da('0x16')](_0x62da('0x17'),_0x62da('0x1c')),controller[_0x62da('0x1d')]);router[_0x62da('0x1e')]('/:id',auth['isAuthenticated'](),interaction[_0x62da('0x16')]('sms',_0x62da('0x1f')),controller[_0x62da('0x20')]);router[_0x62da('0x1e')]('/:id/tags',auth[_0x62da('0xa')](),controller['removeTags']);module[_0x62da('0x21')]=router; \ No newline at end of file +var _0x3714=['describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x3714,0x95));var _0x4371=function(_0x1887a9,_0x3288a8){_0x1887a9=_0x1887a9-0x0;var _0x1bf9bc=_0x3714[_0x1887a9];return _0x1bf9bc;};'use strict';var multer=require(_0x4371('0x0'));var util=require(_0x4371('0x1'));var path=require('path');var timeout=require(_0x4371('0x2'));var express=require(_0x4371('0x3'));var router=express[_0x4371('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4371('0x5'));var interaction=require(_0x4371('0x6'));var config=require(_0x4371('0x7'));var controller=require('./smsInteraction.controller');router[_0x4371('0x8')]('/',auth['isAuthenticated'](),controller[_0x4371('0x9')]);router[_0x4371('0x8')]('/describe',auth[_0x4371('0xa')](),controller[_0x4371('0xb')]);router[_0x4371('0x8')](_0x4371('0xc'),auth['isAuthenticated'](),controller[_0x4371('0xd')]);router['get'](_0x4371('0xe'),auth[_0x4371('0xa')](),controller[_0x4371('0xf')]);router[_0x4371('0x8')]('/:id/download',auth[_0x4371('0xa')](),controller[_0x4371('0x10')]);router['post']('/',auth[_0x4371('0xa')](),controller[_0x4371('0x11')]);router[_0x4371('0x12')](_0x4371('0xe'),auth[_0x4371('0xa')](),controller[_0x4371('0x13')]);router[_0x4371('0x12')](_0x4371('0x14'),auth[_0x4371('0xa')](),interaction[_0x4371('0x15')](_0x4371('0x16'),'smsinteraction:addtags'),controller[_0x4371('0x17')]);router[_0x4371('0x18')](_0x4371('0xc'),auth['isAuthenticated'](),interaction[_0x4371('0x15')](_0x4371('0x16'),_0x4371('0x19')),controller[_0x4371('0x1a')]);router[_0x4371('0x1b')](_0x4371('0xc'),auth[_0x4371('0xa')](),interaction[_0x4371('0x15')](_0x4371('0x16'),_0x4371('0x1c')),controller[_0x4371('0x1d')]);router[_0x4371('0x1b')](_0x4371('0x14'),auth['isAuthenticated'](),controller[_0x4371('0x1e')]);module[_0x4371('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 7adfece..97ac0ce 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 _0x8413=['STRING','out','ENUM','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x42fba6,_0x6d76b7){var _0x3a3312=function(_0x24fdc1){while(--_0x24fdc1){_0x42fba6['push'](_0x42fba6['shift']());}};_0x3a3312(++_0x6d76b7);}(_0x8413,0xd3));var _0x3841=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x8413[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0x3841('0x0'));var moment=require(_0x3841('0x1'));module[_0x3841('0x2')]={'closed':{'type':Sequelize[_0x3841('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3841('0x4')]},'disposition':{'type':Sequelize[_0x3841('0x5')]},'secondDisposition':{'type':Sequelize[_0x3841('0x5')]},'thirdDisposition':{'type':Sequelize[_0x3841('0x5')]},'note':{'type':Sequelize[_0x3841('0x5')]},'phone':{'type':Sequelize[_0x3841('0x5')]},'read1stAt':{'type':Sequelize[_0x3841('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x3841('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3841('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x3841('0x7')]('in',_0x3841('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x4ed5=['BOOLEAN','DATE','STRING','ENUM','out','moment','exports'];(function(_0x4dd9cd,_0xcd632c){var _0x3859b3=function(_0x5a54b7){while(--_0x5a54b7){_0x4dd9cd['push'](_0x4dd9cd['shift']());}};_0x3859b3(++_0xcd632c);}(_0x4ed5,0x1be));var _0x54ed=function(_0x3bbad4,_0x1c0dca){_0x3bbad4=_0x3bbad4-0x0;var _0x505520=_0x4ed5[_0x3bbad4];return _0x505520;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x54ed('0x0'));module[_0x54ed('0x1')]={'closed':{'type':Sequelize[_0x54ed('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x54ed('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x54ed('0x4')]},'thirdDisposition':{'type':Sequelize[_0x54ed('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x54ed('0x4')]},'read1stAt':{'type':Sequelize[_0x54ed('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x54ed('0x5')]('in',_0x54ed('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x54ed('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x54ed('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 29c1a15..f35811a 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 _0xa9e0=['rawAttributes','includeAll','include','merge','create','body','params','describe','addMessage','SmsMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','format','CmContact','firstName','lastName','Messages','secret','Owner','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','closedAt','disposition','direction','out','System','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','json','count','offset','limit','status','set','apply','save','then','destroy','error','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','`\x20=\x200','having','`\x20>\x200','Contact','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','start','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','model'];(function(_0x622035,_0x1a4b91){var _0x326cf2=function(_0x5c3002){while(--_0x5c3002){_0x622035['push'](_0x622035['shift']());}};_0x326cf2(++_0x1a4b91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);function respondWithStatusCode(_0x44dcfd,_0x4d5611){_0x4d5611=_0x4d5611||0xcc;return function(_0x52a03d){if(_0x52a03d){return _0x44dcfd[_0x0a9e('0x1b')](_0x4d5611);}return _0x44dcfd['status'](_0x4d5611)[_0x0a9e('0x1c')]();};}function respondWithResult(_0x519dfd,_0x16033c){_0x16033c=_0x16033c||0xc8;return function(_0x12066b){if(_0x12066b){return _0x519dfd['status'](_0x16033c)[_0x0a9e('0x1d')](_0x12066b);}};}function respondWithFilteredResult(_0x5a0a06,_0x459eb1){return function(_0x478723){if(_0x478723){var _0x106033=_0x478723[_0x0a9e('0x1e')],_0x205fd6=_0x459eb1[_0x0a9e('0x1f')],_0x31b1ca=_0x459eb1[_0x0a9e('0x1f')]+_0x459eb1[_0x0a9e('0x20')],_0x2eb11f;if(_0x31b1ca>=_0x106033){_0x31b1ca=_0x106033;_0x2eb11f=0xc8;}else{_0x2eb11f=0xce;}_0x5a0a06[_0x0a9e('0x21')](_0x2eb11f);return _0x5a0a06[_0x0a9e('0x22')]('Content-Range',_0x205fd6+'-'+_0x31b1ca+'/'+_0x106033)[_0x0a9e('0x1d')](_0x478723);}return null;};}function patchUpdates(_0x155cce){return function(_0x53682f){try{jsonpatch[_0x0a9e('0x23')](_0x53682f,_0x155cce,!![]);}catch(_0x5a09ef){return BPromise['reject'](_0x5a09ef);}return _0x53682f[_0x0a9e('0x24')]();};}function saveUpdates(_0x432e56,_0x38e7c4){return function(_0x30bae6){if(_0x30bae6){return _0x30bae6['update'](_0x432e56)[_0x0a9e('0x25')](function(_0x2fb0e4){return _0x2fb0e4;});}return null;};}function removeEntity(_0x3b45bc,_0x4d00e6){return function(_0x370d86){if(_0x370d86){return _0x370d86[_0x0a9e('0x26')]()[_0x0a9e('0x25')](function(){_0x3b45bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197ec0,_0x3a8e58){return function(_0x40c424){if(!_0x40c424){_0x197ec0[_0x0a9e('0x1b')](0x194);}return _0x40c424;};}function handleError(_0x526cf3,_0x384319){_0x384319=_0x384319||0x1f4;return function(_0x479bc4){logger[_0x0a9e('0x27')](_0x479bc4['stack']);if(_0x479bc4[_0x0a9e('0x28')]){delete _0x479bc4[_0x0a9e('0x28')];}_0x526cf3[_0x0a9e('0x21')](_0x384319)[_0x0a9e('0x29')](_0x479bc4);};}function getInteractionUsers(_0x140511,_0x1538a4){return new BPromise(function(_0x11c3b6,_0x14de77){try{if(_0x1538a4[_0x140511['id']]){_0x140511['Users']=_[_0x0a9e('0x2a')](_0x1538a4[_0x140511['id']],function(_0x468813){return{'id':_0x468813['id'],'fullname':_0x468813[_0x0a9e('0x2b')]};});}}catch(_0x2ec755){_0x14de77(_0x2ec755);}_0x11c3b6(_0x140511);});}function getInteractionTags(_0x5c877d,_0x15b200){return new BPromise(function(_0x40e7a3,_0x1843b2){try{if(_0x5c877d[_0x0a9e('0x2c')]){_0x5c877d[_0x0a9e('0x2d')]=[];_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2e')](',')[_0x0a9e('0x2f')](function(_0x1dbde2){_0x5c877d['Tags'][_0x0a9e('0x30')](_0x15b200[_0x1dbde2]);});}delete _0x5c877d['TagIds'];}catch(_0x2407f9){_0x1843b2(_0x2407f9);}_0x40e7a3(_0x5c877d);});}function updateSmsInteraction(_0x3ae878,_0x1122db,_0x33bdb7){return new BPromise(function(_0x25ce3a,_0x5180f1){return getInteractionUsers(_0x3ae878,_0x33bdb7)[_0x0a9e('0x25')](function(_0x46f0a5){return getInteractionTags(_0x46f0a5,_0x1122db);})[_0x0a9e('0x25')](function(_0x2da5c0){_0x25ce3a(_0x2da5c0);})[_0x0a9e('0x31')](function(_0x409319){_0x5180f1(_0x409319);});});}exports[_0x0a9e('0x32')]=function(_0x39e565,_0x5583a4){var _0x44295a={},_0x5e7238={},_0x2cc7a0={'count':0x0,'rows':[]};var _0x14b13f=_[_0x0a9e('0x2a')](db[_0x0a9e('0x33')]['rawAttributes'],function(_0x191e91){return{'name':_0x191e91[_0x0a9e('0x34')],'type':_0x191e91[_0x0a9e('0x35')][_0x0a9e('0x36')]};});_0x5e7238['model']=_['map'](_0x14b13f,_0x0a9e('0x28'));_0x5e7238['query']=_[_0x0a9e('0x37')](_0x39e565[_0x0a9e('0x38')]);_0x5e7238[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5e7238['model'],_0x5e7238[_0x0a9e('0x38')]);_0x44295a[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0x5e7238['model'],qs[_0x0a9e('0x3c')](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x3c')]));_0x44295a['attributes']=_0x44295a['attributes'][_0x0a9e('0x3d')]?_0x44295a[_0x0a9e('0x3b')]:_0x5e7238['model'];if(!_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x44295a[_0x0a9e('0x20')]=qs['limit'](_0x39e565['query'][_0x0a9e('0x20')]);_0x44295a[_0x0a9e('0x1f')]=qs['offset'](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x1f')]);}_0x44295a[_0x0a9e('0x40')]=qs['sort'](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x41')]);_0x44295a[_0x0a9e('0x42')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x43')](_0x39e565[_0x0a9e('0x38')],_0x5e7238[_0x0a9e('0x39')]),_0x14b13f);var _0x45a9b8=[];var _0x23b089=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')[_0x0a9e('0x45')](_0x0a9e('0x28'))[_0x0a9e('0x45')](_0x0a9e('0x46'))['from']('tools_tags');var _0x473fdc=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')](_0x0a9e('0x47'))[_0x0a9e('0x45')](_0x0a9e('0x48'))[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'ui')[_0x0a9e('0x4c')](_0x0a9e('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x117c99=squel[_0x0a9e('0x44')]()[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'i')[_0x0a9e('0x4c')](_0x0a9e('0x4f'),'c',_0x0a9e('0x50'))[_0x0a9e('0x4c')]('users','o',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'a',_0x0a9e('0x53'))[_0x0a9e('0x4c')]('sms_messages','me',_0x0a9e('0x54'))[_0x0a9e('0x4c')](_0x0a9e('0x55'),'it',_0x0a9e('0x56'))[_0x0a9e('0x4c')](_0x0a9e('0x57'),'t',_0x0a9e('0x58'));var _0x5bbcde=squel[_0x0a9e('0x59')]();var _0x1bde3c=[];var _0x1b5e80=squel[_0x0a9e('0x59')]();var _0x409789;if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x5a')]){_0x409789=as[_0x0a9e('0x5b')](_0x39e565[_0x0a9e('0x38')]['search']);var _0xe401a=_0x409789[_0x0a9e('0x5c')];for(var _0x4f7240=0x0;_0x4f7240<_0x409789['conditions']['length'];_0x4f7240++){var _0x1adfee=_0x409789[_0x0a9e('0x5d')][_0x4f7240];var _0x37edaa='i';var _0x11545a=_[_0x0a9e('0x5e')](_0x14b13f,[_0x0a9e('0x28'),_0x1adfee[_0x0a9e('0x45')]]);if(!_0x11545a){switch(_0x1adfee[_0x0a9e('0x45')]){case'unreadMessages':if(_0x1adfee['value']==0x1){_0x117c99['having']('`'+_0x1adfee[_0x0a9e('0x45')]+_0x0a9e('0x5f'));}else{_0x117c99[_0x0a9e('0x60')]('`'+_0x1adfee['field']+_0x0a9e('0x61'));}break;case _0x0a9e('0x62'):if(_0x1adfee['operator']==='$substring'){if(_0x1adfee[_0x0a9e('0x63')]['split']('\x20')[_0x0a9e('0x3d')]>0x1){_0x5bbcde[_0xe401a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x64')](_0x1adfee[_0x0a9e('0x63')]),null);}else{var _0x439340='%'+_0x1adfee['value']+'%';_0x5bbcde[_0xe401a](_0x0a9e('0x65'),_0x439340,_0x439340,_0x439340);}}else{_0x11545a=_[_0x0a9e('0x5e')](_0x14b13f,['name','ContactId']);_0x1adfee[_0x0a9e('0x45')]=_0x0a9e('0x66');_0x7be420=as['buildExpression'](_0x37edaa,_0x11545a[_0x0a9e('0x35')],_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420['text'],_0x7be420[_0x0a9e('0x63')]['start'],_0x7be420[_0x0a9e('0x63')]['end']);}break;case'Tag':var _0x5df0ad=_0x1adfee[_0x0a9e('0x63')]['split'](',')[_0x0a9e('0x2a')](function(_0x65432){return Number(_0x65432);});_0x5df0ad[_0x0a9e('0x2f')](function(_0x19b4df){_0x1b5e80['or'](_0x0a9e('0x67'),'%,'+_0x19b4df+',%');});_0x1bde3c=_[_0x0a9e('0x68')](_0x1bde3c,_0x5df0ad);break;case _0x0a9e('0x69'):if(_0x1adfee[_0x0a9e('0x6a')]==='$substring'){_0x5bbcde[_0xe401a](_0x0a9e('0x6b'),'%'+_0x1adfee[_0x0a9e('0x63')]+'%',null);}else{_0x11545a=_[_0x0a9e('0x5e')](_0x14b13f,[_0x0a9e('0x28'),_0x0a9e('0x6c')]);_0x1adfee[_0x0a9e('0x45')]='UserId';_0x7be420=as[_0x0a9e('0x6d')](_0x37edaa,_0x11545a[_0x0a9e('0x35')],_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420['text'],_0x7be420[_0x0a9e('0x63')]['start'],_0x7be420[_0x0a9e('0x63')]['end']);}break;case'body':_0x7be420=as['buildExpression']('me',null,_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420[_0x0a9e('0x6e')],_0x7be420['value'][_0x0a9e('0x6f')],_0x7be420[_0x0a9e('0x63')][_0x0a9e('0x1c')]);break;}}else{var _0x7be420=as[_0x0a9e('0x6d')](_0x37edaa,_0x11545a[_0x0a9e('0x35')],_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420['text'],_0x7be420[_0x0a9e('0x63')]['start'],_0x7be420[_0x0a9e('0x63')][_0x0a9e('0x1c')]);}}}else{var _0x51aaf7=_(_0x39e565['query'])[_0x0a9e('0x37')]()[_0x0a9e('0x2a')](function(_0x119677){return _[_0x0a9e('0x70')](_0x14b13f,['name',_0x119677])?_0x119677:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x63')]();if(!_['isEmpty'](_0x51aaf7)){_0x51aaf7[_0x0a9e('0x2f')](function(_0x17e88c){if(_0x17e88c===_0x0a9e('0x72')){_0x117c99[_0x0a9e('0x42')](_0x0a9e('0x73'),[]['concat'](_0x39e565[_0x0a9e('0x38')][_0x17e88c]));}else if(_0x17e88c===_0x0a9e('0x74')){var _0x281c7d=JSON['parse'](_0x39e565[_0x0a9e('0x38')][_0x17e88c])['$gte'];var _0x5211e3=JSON[_0x0a9e('0x75')](_0x39e565[_0x0a9e('0x38')][_0x17e88c])[_0x0a9e('0x76')];_0x117c99[_0x0a9e('0x42')](_0x0a9e('0x77'),_0x281c7d,_0x5211e3);}else{if(_0x39e565[_0x0a9e('0x38')][_0x17e88c]===_0x0a9e('0x78')){_0x117c99[_0x0a9e('0x42')]('i.'+_0x17e88c+_0x0a9e('0x79'));}else{_0x117c99[_0x0a9e('0x42')]('i.'+_0x17e88c+_0x0a9e('0x7a'),_0x39e565[_0x0a9e('0x38')][_0x17e88c]);}}});}if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7b')]){if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7b')]==0x1){_0x117c99[_0x0a9e('0x60')](_0x0a9e('0x7c'));}else{_0x117c99['having'](_0x0a9e('0x7d'));}}if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7e')]){_0x1bde3c=_['isArray'](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7e')])?_0x39e565['query'][_0x0a9e('0x7e')]:new Array(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7e')]);_0x1bde3c[_0x0a9e('0x2f')](function(_0x13b5c0){_0x1b5e80['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x13b5c0+',%');});}if(_0x39e565['query']['filter']){var _0x40fb85=_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7f')][_0x0a9e('0x80')]('\x5c','\x5c\x5c')[_0x0a9e('0x80')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x81')](_0x40fb85)){_0x5bbcde['or'](_0x0a9e('0x82'),_0x40fb85+'%')['or'](_0x0a9e('0x83'),_0x40fb85+'%');}else{_0x5bbcde['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x64')](_0x40fb85))['or'](_0x0a9e('0x84'),_0x40fb85+'%');}}}_0x117c99[_0x0a9e('0x42')](_0x5bbcde);_0x117c99['group'](_0x0a9e('0x85'));var _0x583b2e={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')]['SELECT'],'raw':!![]};var _0x2ed01e=_0x117c99[_0x0a9e('0x88')]();_0x2ed01e[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x2ed01e['field'](_0x0a9e('0x89'),_0x0a9e('0x8a'));if(_0x44295a[_0x0a9e('0x40')]){_0x44295a[_0x0a9e('0x40')]['forEach'](function(_0x109ccb){var _0x3d91db=_0x109ccb[0x0]===_0x0a9e('0x8b')?_0x109ccb[0x0]:'i.'+_0x109ccb[0x0];_0x117c99[_0x0a9e('0x40')](_0x3d91db,_0x109ccb[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x8c')](_0x1bde3c)){_0x117c99[_0x0a9e('0x60')](_0x1b5e80);_0x2ed01e[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x1bde3c);}BPromise[_0x0a9e('0x8e')]()[_0x0a9e('0x25')](function(){if(!_0x409789){if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x72')])return;_0x2ed01e[_0x0a9e('0x42')](_0x0a9e('0x8f'));_0x117c99[_0x0a9e('0x42')](_0x0a9e('0x8f'));return;}if(_0x39e565[_0x0a9e('0x90')][_0x0a9e('0x91')]!=='agent')return;return _0x39e565[_0x0a9e('0x90')][_0x0a9e('0x92')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x25')](function(_0x563627){if(_[_0x0a9e('0x8c')](_0x563627)){_0x2ed01e[_0x0a9e('0x42')](_0x0a9e('0x93'));_0x117c99[_0x0a9e('0x42')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x2ed01e['where'](_0x0a9e('0x73'),_[_0x0a9e('0x2a')](_0x563627,'id'));_0x117c99['where'](_0x0a9e('0x73'),_['map'](_0x563627,'id'));}});})[_0x0a9e('0x25')](function(){if(_0x39e565[_0x0a9e('0x90')]['role']===_0x0a9e('0x94')&&!_0x409789&&!_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x72')])return[];return db[_0x0a9e('0x95')][_0x0a9e('0x38')](_0x2ed01e[_0x0a9e('0x96')](),_0x583b2e);})[_0x0a9e('0x25')](function(_0x482ca2){_0x2cc7a0[_0x0a9e('0x1e')]=_0x482ca2[_0x0a9e('0x3d')];if(_0x2cc7a0[_0x0a9e('0x1e')]===0x0)return[];return db[_0x0a9e('0x95')]['query'](_0x23b089[_0x0a9e('0x96')](),_0x583b2e)[_0x0a9e('0x25')](function(_0x4bf3a5){_0x45a9b8=_[_0x0a9e('0x97')](_0x4bf3a5,'id');_0x583b2e=_['merge'](_0x583b2e,{'model':db[_0x0a9e('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x3c')]){_0x44295a[_0x0a9e('0x3b')]['forEach'](function(_0x51ccd7){_0x117c99[_0x0a9e('0x45')]('i.'+_0x51ccd7);});}else{_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x89'),'unreadMessages');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x98'),'Account.key');_0x117c99['field'](_0x0a9e('0x99'),'Account.mandatoryDisposition');_0x117c99['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',_0x0a9e('0x8b'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x9b'),_0x0a9e('0x9c'));_0x117c99['field'](_0x0a9e('0x9d'),'Contact.lastName');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x117c99[_0x0a9e('0x45')]('c.phone',_0x0a9e('0xa0'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa1'),'Contact.mobile');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa6'),'Owner.internal');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa7'),'TagIds');}if(_0x44295a[_0x0a9e('0x20')])_0x117c99[_0x0a9e('0x20')](_0x44295a[_0x0a9e('0x20')]);if(_0x44295a['offset'])_0x117c99[_0x0a9e('0x1f')](_0x44295a['offset']);return db[_0x0a9e('0x95')][_0x0a9e('0x38')](_0x117c99[_0x0a9e('0x96')](),_0x583b2e);})[_0x0a9e('0x25')](function(_0x842d6f){_0x473fdc[_0x0a9e('0x42')](_0x0a9e('0xa8'),_[_0x0a9e('0x2a')](_0x842d6f,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x473fdc[_0x0a9e('0x96')](),_0x583b2e)[_0x0a9e('0x25')](function(_0x30ef6e){var _0x28e60a=_[_0x0a9e('0xa9')](_0x30ef6e,_0x0a9e('0xaa'));var _0x33f0c9=[];_0x842d6f[_0x0a9e('0x2f')](function(_0x31af8c){_0x33f0c9[_0x0a9e('0x30')](updateSmsInteraction(_0x31af8c,_0x45a9b8,_0x28e60a));});return BPromise[_0x0a9e('0xab')](_0x33f0c9);});});})[_0x0a9e('0x25')](function(_0x4989f9){_0x2cc7a0[_0x0a9e('0xac')]=_0x4989f9;return _0x2cc7a0;})[_0x0a9e('0x25')](respondWithFilteredResult(_0x5583a4,_0x44295a))[_0x0a9e('0x31')](handleError(_0x5583a4,null));};exports[_0x0a9e('0xad')]=function(_0xb0599a,_0x5d9ddb){var _0x3afc8c={'raw':![],'where':{'id':_0xb0599a['params']['id']}},_0x1756c7={};_0x1756c7[_0x0a9e('0xae')]=_['keys'](db[_0x0a9e('0x33')][_0x0a9e('0xaf')]);_0x1756c7[_0x0a9e('0x38')]=_[_0x0a9e('0x37')](_0xb0599a['query']);_0x1756c7[_0x0a9e('0x39')]=_['intersection'](_0x1756c7[_0x0a9e('0xae')],_0x1756c7[_0x0a9e('0x38')]);_0x3afc8c['attributes']=_[_0x0a9e('0x3a')](_0x1756c7[_0x0a9e('0xae')],qs[_0x0a9e('0x3c')](_0xb0599a['query']['fields']));_0x3afc8c[_0x0a9e('0x3b')]=_0x3afc8c[_0x0a9e('0x3b')][_0x0a9e('0x3d')]?_0x3afc8c[_0x0a9e('0x3b')]:_0x1756c7[_0x0a9e('0xae')];if(_0xb0599a[_0x0a9e('0x38')][_0x0a9e('0xb0')]){_0x3afc8c[_0x0a9e('0xb1')]=[{'all':!![]}];}_0x3afc8c=_[_0x0a9e('0xb2')]({},_0x3afc8c,_0xb0599a['options']);return db[_0x0a9e('0x33')]['find'](_0x3afc8c)[_0x0a9e('0x25')](handleEntityNotFound(_0x5d9ddb,null))[_0x0a9e('0x25')](respondWithResult(_0x5d9ddb,null))[_0x0a9e('0x31')](handleError(_0x5d9ddb,null));};exports[_0x0a9e('0xb3')]=function(_0x1b61d5,_0x4e7273){return db[_0x0a9e('0x33')][_0x0a9e('0xb3')](_0x1b61d5[_0x0a9e('0xb4')],{})[_0x0a9e('0x25')](respondWithResult(_0x4e7273,0xc9))[_0x0a9e('0x31')](handleError(_0x4e7273,null));};exports['update']=function(_0x4f074c,_0x22a3cb){if(_0x4f074c['body']['id']){delete _0x4f074c[_0x0a9e('0xb4')]['id'];}return db[_0x0a9e('0x33')][_0x0a9e('0x5e')]({'where':{'id':_0x4f074c[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x22a3cb,null))[_0x0a9e('0x25')](saveUpdates(_0x4f074c['body'],null))['then'](respondWithResult(_0x22a3cb,null))[_0x0a9e('0x31')](handleError(_0x22a3cb,null));};exports['destroy']=function(_0x2469d1,_0x5c689c){return db[_0x0a9e('0x33')]['find']({'where':{'id':_0x2469d1['params']['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x5c689c,null))[_0x0a9e('0x25')](removeEntity(_0x5c689c,null))['catch'](handleError(_0x5c689c,null));};exports[_0x0a9e('0xb6')]=function(_0x17cb30,_0x15c6b9){return db[_0x0a9e('0x33')][_0x0a9e('0xb6')]()['then'](respondWithResult(_0x15c6b9,null))['catch'](handleError(_0x15c6b9,null));};exports[_0x0a9e('0xb7')]=function(_0x22286c,_0x41c8cd,_0x24beb6){return db[_0x0a9e('0xb8')]['find']({'where':{'id':_0x22286c[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x41c8cd,null))['then'](function(_0x3c313d){if(_0x3c313d){return _0x3c313d[_0x0a9e('0xb7')](_0x22286c[_0x0a9e('0xb4')][_0x0a9e('0xb9')],_[_0x0a9e('0xba')](_0x22286c[_0x0a9e('0xb4')],[_0x0a9e('0xb9'),'id'])||{});}})[_0x0a9e('0x25')](respondWithResult(_0x41c8cd,null))[_0x0a9e('0x31')](handleError(_0x41c8cd,null));};exports[_0x0a9e('0xbb')]=function(_0x4bdebb,_0x1065a7,_0x301047){var _0x2ada60={'raw':![],'where':{}};var _0x1c4232={};var _0x1d0b02={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x4bdebb[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x1065a7,null))[_0x0a9e('0x25')](function(_0x2fea95){if(_0x2fea95){_0x1c4232[_0x0a9e('0xae')]=_['keys'](db[_0x0a9e('0xb8')][_0x0a9e('0xaf')]);_0x1c4232[_0x0a9e('0x38')]=_['keys'](_0x4bdebb[_0x0a9e('0x38')]);_0x1c4232['filters']=_[_0x0a9e('0x3a')](_0x1c4232['model'],_0x1c4232[_0x0a9e('0x38')]);_0x2ada60[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0x1c4232['model'],qs[_0x0a9e('0x3c')](_0x4bdebb['query'][_0x0a9e('0x3c')]));_0x2ada60[_0x0a9e('0x3b')]=_0x2ada60[_0x0a9e('0x3b')][_0x0a9e('0x3d')]?_0x2ada60[_0x0a9e('0x3b')]:_0x1c4232[_0x0a9e('0xae')];if(!_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x2ada60[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x20')]);_0x2ada60[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x4bdebb[_0x0a9e('0x38')]['offset']);}_0x2ada60['order']=qs[_0x0a9e('0x41')](_0x4bdebb['query'][_0x0a9e('0x41')]);_0x2ada60[_0x0a9e('0x42')]=qs['filters'](_[_0x0a9e('0x43')](_0x4bdebb[_0x0a9e('0x38')],_0x1c4232[_0x0a9e('0x39')]));_0x2ada60[_0x0a9e('0x42')]['SmsInteractionId']=_0x2fea95['id'];if(_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x7f')]){_0x2ada60[_0x0a9e('0x42')]=_[_0x0a9e('0xb2')](_0x2ada60['where'],{'$or':_[_0x0a9e('0x2a')](_0x2ada60[_0x0a9e('0x3b')],function(_0x2b7092){var _0x5c838b={};_0x5c838b[_0x2b7092]={'$like':'%'+_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x7f')]+'%'};return _0x5c838b;})});}if(_0x4bdebb[_0x0a9e('0x38')]['$gte']){var _0x303f75=_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0xbc')][_0x0a9e('0x2e')](',');var _0x2394d3={};_0x2394d3[_0x303f75[0x0]]={'$gte':moment(_0x303f75[0x1])['format'](_0x0a9e('0xbd'))};_0x2ada60[_0x0a9e('0x42')]=_['merge'](_0x2ada60[_0x0a9e('0x42')],_0x2394d3);}_0x2ada60=_[_0x0a9e('0xb2')]({},_0x2ada60,_0x4bdebb[_0x0a9e('0xbe')]);return db['SmsMessage']['count']({'where':_0x2ada60['where']})[_0x0a9e('0x25')](function(_0x4a70ce){_0x1d0b02['count']=_0x4a70ce;if(_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0xb0')]){_0x2ada60[_0x0a9e('0xb1')]=[{'all':!![]}];}return db['SmsMessage'][_0x0a9e('0xbf')](_0x2ada60);})[_0x0a9e('0x25')](function(_0x213d4e){_0x1d0b02[_0x0a9e('0xac')]=_0x213d4e;return _0x1d0b02;});}})[_0x0a9e('0x25')](respondWithFilteredResult(_0x1065a7,_0x2ada60))[_0x0a9e('0x31')](handleError(_0x1065a7,null));};exports[_0x0a9e('0xc0')]=function(_0x328ec5,_0x3b5bda,_0x5a1848){return db[_0x0a9e('0x33')]['find']({'where':{'id':_0x328ec5[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x3b5bda,null))[_0x0a9e('0x25')](function(_0x3cf222){if(_0x3cf222){return _0x3cf222[_0x0a9e('0xc1')](_0x328ec5[_0x0a9e('0xb4')]['ids'],_[_0x0a9e('0xba')](_0x328ec5[_0x0a9e('0xb4')],[_0x0a9e('0xb9'),'id'])||{})[_0x0a9e('0xc2')](function(){return db['Tag'][_0x0a9e('0xbf')]({'attributes':['id',_0x0a9e('0x28'),_0x0a9e('0x46')],'where':{'id':_0x328ec5[_0x0a9e('0xb4')][_0x0a9e('0xb9')]}});})[_0x0a9e('0x25')](function(_0x238c24){socket[_0x0a9e('0xc3')](_0x0a9e('0xc4'),{'id':Number(_0x328ec5[_0x0a9e('0xb5')]['id']),'tags':_0x238c24||[]});return{'id':Number(_0x328ec5['params']['id']),'tags':_0x238c24||[]};});}})[_0x0a9e('0x25')](respondWithResult(_0x3b5bda,null))[_0x0a9e('0x31')](handleError(_0x3b5bda,null));};exports[_0x0a9e('0xc5')]=function(_0x26b826,_0xea8bd1,_0x253f74){return db[_0x0a9e('0x33')][_0x0a9e('0x5e')]({'where':{'id':_0x26b826['params']['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0xea8bd1,null))[_0x0a9e('0x25')](function(_0x1a9ef1){if(_0x1a9ef1){return _0x1a9ef1['removeTags'](_0x26b826[_0x0a9e('0x38')][_0x0a9e('0xb9')]);}})[_0x0a9e('0x25')](respondWithStatusCode(_0xea8bd1,null))[_0x0a9e('0x31')](handleError(_0xea8bd1,null));};exports[_0x0a9e('0xc6')]=function(_0x1ba457,_0x424f1b){var _0x336a19=moment()[_0x0a9e('0xc7')]()[_0x0a9e('0x96')]();var _0x5a7dad=path[_0x0a9e('0xc8')](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x3942fd=path['join'](config[_0x0a9e('0xc9')],'server','files','attachments');var _0x19e4e6=path[_0x0a9e('0xc8')](_0x5a7dad,_0x336a19);var _0x426cb4=util[_0x0a9e('0xcd')]('transcript-%d-%s.zip',_0x1ba457[_0x0a9e('0xb5')]['id'],_0x336a19);var _0x309fa9=path[_0x0a9e('0xc8')](_0x5a7dad,_0x426cb4);var _0x1fdb10=[];_0x1fdb10[_0x0a9e('0x30')]({'model':db['User'],'as':'User','attributes':['id',_0x0a9e('0x2b')],'raw':!![]});_0x1fdb10[_0x0a9e('0x30')]({'model':db[_0x0a9e('0xce')],'as':'Contact','attributes':['id',_0x0a9e('0xcf'),_0x0a9e('0xd0')],'raw':!![]});var _0x422f0a=[{'model':db['SmsMessage'],'as':_0x0a9e('0xd1'),'attributes':['id',_0x0a9e('0xb4'),_0x0a9e('0x74'),'direction',_0x0a9e('0xd2'),_0x0a9e('0x7b')],'include':_0x1fdb10}];_0x422f0a[_0x0a9e('0x30')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x422f0a[_0x0a9e('0x30')]({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x2b')]});return db['SmsInteraction'][_0x0a9e('0x5e')]({'where':{'id':_0x1ba457['params']['id']},'include':_0x422f0a})[_0x0a9e('0x25')](handleEntityNotFound(_0x424f1b,null))[_0x0a9e('0x25')](function(_0x242f23){if(_0x242f23){var _0x57f673=_0x242f23[_0x0a9e('0xd4')]({'plain':!![]});fs[_0x0a9e('0xd5')](_0x19e4e6);var _0xb8a476={'format':'A4','border':'10px','header':{'height':_0x0a9e('0xd6'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0x0a9e('0xd7'),'contents':{'default':util['format'](_0x0a9e('0xd8'),util['format'](_0x0a9e('0xd9'),_0x0a9e('0xda'),_0x57f673['id']),moment()[_0x0a9e('0xcd')](_0x0a9e('0xdb'))[_0x0a9e('0x96')]())}}};var _0x251dd9={'channel':_0x0a9e('0xda'),'account':_0x57f673['Account'][_0x0a9e('0x28')],'agent':_0x57f673[_0x0a9e('0xd3')]?_0x57f673['Owner'][_0x0a9e('0x2b')]:_0x0a9e('0xdc'),'createdAt':moment(_0x57f673['createdAt'])[_0x0a9e('0xcd')](_0x0a9e('0xbd'))[_0x0a9e('0x96')](),'closedAt':_0x57f673['closed']?moment(_0x57f673[_0x0a9e('0xdd')])[_0x0a9e('0xcd')](_0x0a9e('0xbd'))[_0x0a9e('0x96')]():'','disposition':_0x57f673[_0x0a9e('0xde')],'messages':_(_0x57f673[_0x0a9e('0xd1')])[_0x0a9e('0x7f')]({'secret':![]})[_0x0a9e('0x2a')](function(_0x22767f){return{'date':moment(_0x22767f[_0x0a9e('0x74')])['format'](_0x0a9e('0xbd'))['toString'](),'sender':_0x22767f[_0x0a9e('0xdf')]===_0x0a9e('0xe0')?_0x22767f[_0x0a9e('0x69')]?_0x22767f[_0x0a9e('0x69')][_0x0a9e('0x2b')]:_0x0a9e('0xe1'):_0x22767f['Contact'][_0x0a9e('0xcf')]+(_0x22767f[_0x0a9e('0x62')][_0x0a9e('0xd0')]?'\x20'+_0x22767f['Contact'][_0x0a9e('0xd0')]:''),'body':_0x22767f[_0x0a9e('0xb4')],'direction':_0x22767f[_0x0a9e('0xdf')]===_0x0a9e('0xe0')?'A':'C','secret':_0x22767f[_0x0a9e('0xd2')],'read':_0x22767f[_0x0a9e('0x7b')]};})[_0x0a9e('0x63')]()};return ejs['renderFile'](path[_0x0a9e('0xc8')](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe2'),_0x0a9e('0xe3')),{'interaction':_0x251dd9})[_0x0a9e('0x25')](function(_0x8120e){return new BPromise(function(_0x5d6a48,_0x5c8720){pdf[_0x0a9e('0xb3')](_0x8120e,_0xb8a476)[_0x0a9e('0xe4')](path[_0x0a9e('0xc8')](_0x19e4e6,_0x0a9e('0xe5')+_0x57f673['id']+'-'+_0x336a19+_0x0a9e('0xe6')),function(_0x131da8,_0x609711){if(_0x131da8)return _0x5c8720(_0x131da8);_0x5d6a48(_0x609711);});});})['then'](function(){return new BPromise(function(_0x39ea62,_0x1d7fc4){zipdir(_0x19e4e6,{'saveTo':_0x309fa9},function(_0x2d8e91,_0x2675a5){if(_0x2d8e91)return _0x1d7fc4(_0x2d8e91);return _0x39ea62(_0x2675a5);});})[_0x0a9e('0x25')](function(){return new BPromise(function(_0x3c6082,_0x16be7e){rimraf(_0x19e4e6,function(_0x54f0b8){if(_0x54f0b8)_0x16be7e(_0x54f0b8);return _0x3c6082();});});})[_0x0a9e('0x25')](function(){return _0x424f1b[_0x0a9e('0xc6')](_0x309fa9,_0x426cb4,function(_0x231826){if(_0x231826){console['log'](_0x0a9e('0xe7'),_0x231826);}else{fs[_0x0a9e('0xe8')](_0x309fa9);}});});});}else{return _0x424f1b[_0x0a9e('0x1b')](0xc8);}})[_0x0a9e('0x31')](handleError(_0x424f1b,null));}; \ No newline at end of file +var _0xa9e0=['rawAttributes','includeAll','include','merge','create','body','params','describe','addMessage','SmsMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','format','CmContact','firstName','lastName','Messages','secret','Owner','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','closedAt','disposition','direction','out','System','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','json','count','offset','limit','status','set','apply','save','then','destroy','error','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','`\x20=\x200','having','`\x20>\x200','Contact','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','start','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','model'];(function(_0x1c7386,_0x298a93){var _0x2b6b71=function(_0x3dfaf0){while(--_0x3dfaf0){_0x1c7386['push'](_0x1c7386['shift']());}};_0x2b6b71(++_0x298a93);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);function respondWithStatusCode(_0x44dcfd,_0x4d5611){_0x4d5611=_0x4d5611||0xcc;return function(_0x52a03d){if(_0x52a03d){return _0x44dcfd[_0x0a9e('0x1b')](_0x4d5611);}return _0x44dcfd['status'](_0x4d5611)[_0x0a9e('0x1c')]();};}function respondWithResult(_0x519dfd,_0x16033c){_0x16033c=_0x16033c||0xc8;return function(_0x12066b){if(_0x12066b){return _0x519dfd['status'](_0x16033c)[_0x0a9e('0x1d')](_0x12066b);}};}function respondWithFilteredResult(_0x5a0a06,_0x459eb1){return function(_0x478723){if(_0x478723){var _0x106033=_0x478723[_0x0a9e('0x1e')],_0x205fd6=_0x459eb1[_0x0a9e('0x1f')],_0x31b1ca=_0x459eb1[_0x0a9e('0x1f')]+_0x459eb1[_0x0a9e('0x20')],_0x2eb11f;if(_0x31b1ca>=_0x106033){_0x31b1ca=_0x106033;_0x2eb11f=0xc8;}else{_0x2eb11f=0xce;}_0x5a0a06[_0x0a9e('0x21')](_0x2eb11f);return _0x5a0a06[_0x0a9e('0x22')]('Content-Range',_0x205fd6+'-'+_0x31b1ca+'/'+_0x106033)[_0x0a9e('0x1d')](_0x478723);}return null;};}function patchUpdates(_0x155cce){return function(_0x53682f){try{jsonpatch[_0x0a9e('0x23')](_0x53682f,_0x155cce,!![]);}catch(_0x5a09ef){return BPromise['reject'](_0x5a09ef);}return _0x53682f[_0x0a9e('0x24')]();};}function saveUpdates(_0x432e56,_0x38e7c4){return function(_0x30bae6){if(_0x30bae6){return _0x30bae6['update'](_0x432e56)[_0x0a9e('0x25')](function(_0x2fb0e4){return _0x2fb0e4;});}return null;};}function removeEntity(_0x3b45bc,_0x4d00e6){return function(_0x370d86){if(_0x370d86){return _0x370d86[_0x0a9e('0x26')]()[_0x0a9e('0x25')](function(){_0x3b45bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197ec0,_0x3a8e58){return function(_0x40c424){if(!_0x40c424){_0x197ec0[_0x0a9e('0x1b')](0x194);}return _0x40c424;};}function handleError(_0x526cf3,_0x384319){_0x384319=_0x384319||0x1f4;return function(_0x479bc4){logger[_0x0a9e('0x27')](_0x479bc4['stack']);if(_0x479bc4[_0x0a9e('0x28')]){delete _0x479bc4[_0x0a9e('0x28')];}_0x526cf3[_0x0a9e('0x21')](_0x384319)[_0x0a9e('0x29')](_0x479bc4);};}function getInteractionUsers(_0x140511,_0x1538a4){return new BPromise(function(_0x11c3b6,_0x14de77){try{if(_0x1538a4[_0x140511['id']]){_0x140511['Users']=_[_0x0a9e('0x2a')](_0x1538a4[_0x140511['id']],function(_0x468813){return{'id':_0x468813['id'],'fullname':_0x468813[_0x0a9e('0x2b')]};});}}catch(_0x2ec755){_0x14de77(_0x2ec755);}_0x11c3b6(_0x140511);});}function getInteractionTags(_0x5c877d,_0x15b200){return new BPromise(function(_0x40e7a3,_0x1843b2){try{if(_0x5c877d[_0x0a9e('0x2c')]){_0x5c877d[_0x0a9e('0x2d')]=[];_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2e')](',')[_0x0a9e('0x2f')](function(_0x1dbde2){_0x5c877d['Tags'][_0x0a9e('0x30')](_0x15b200[_0x1dbde2]);});}delete _0x5c877d['TagIds'];}catch(_0x2407f9){_0x1843b2(_0x2407f9);}_0x40e7a3(_0x5c877d);});}function updateSmsInteraction(_0x3ae878,_0x1122db,_0x33bdb7){return new BPromise(function(_0x25ce3a,_0x5180f1){return getInteractionUsers(_0x3ae878,_0x33bdb7)[_0x0a9e('0x25')](function(_0x46f0a5){return getInteractionTags(_0x46f0a5,_0x1122db);})[_0x0a9e('0x25')](function(_0x2da5c0){_0x25ce3a(_0x2da5c0);})[_0x0a9e('0x31')](function(_0x409319){_0x5180f1(_0x409319);});});}exports[_0x0a9e('0x32')]=function(_0x39e565,_0x5583a4){var _0x44295a={},_0x5e7238={},_0x2cc7a0={'count':0x0,'rows':[]};var _0x14b13f=_[_0x0a9e('0x2a')](db[_0x0a9e('0x33')]['rawAttributes'],function(_0x191e91){return{'name':_0x191e91[_0x0a9e('0x34')],'type':_0x191e91[_0x0a9e('0x35')][_0x0a9e('0x36')]};});_0x5e7238['model']=_['map'](_0x14b13f,_0x0a9e('0x28'));_0x5e7238['query']=_[_0x0a9e('0x37')](_0x39e565[_0x0a9e('0x38')]);_0x5e7238[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5e7238['model'],_0x5e7238[_0x0a9e('0x38')]);_0x44295a[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0x5e7238['model'],qs[_0x0a9e('0x3c')](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x3c')]));_0x44295a['attributes']=_0x44295a['attributes'][_0x0a9e('0x3d')]?_0x44295a[_0x0a9e('0x3b')]:_0x5e7238['model'];if(!_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x44295a[_0x0a9e('0x20')]=qs['limit'](_0x39e565['query'][_0x0a9e('0x20')]);_0x44295a[_0x0a9e('0x1f')]=qs['offset'](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x1f')]);}_0x44295a[_0x0a9e('0x40')]=qs['sort'](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x41')]);_0x44295a[_0x0a9e('0x42')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x43')](_0x39e565[_0x0a9e('0x38')],_0x5e7238[_0x0a9e('0x39')]),_0x14b13f);var _0x45a9b8=[];var _0x23b089=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')[_0x0a9e('0x45')](_0x0a9e('0x28'))[_0x0a9e('0x45')](_0x0a9e('0x46'))['from']('tools_tags');var _0x473fdc=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')](_0x0a9e('0x47'))[_0x0a9e('0x45')](_0x0a9e('0x48'))[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'ui')[_0x0a9e('0x4c')](_0x0a9e('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x117c99=squel[_0x0a9e('0x44')]()[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'i')[_0x0a9e('0x4c')](_0x0a9e('0x4f'),'c',_0x0a9e('0x50'))[_0x0a9e('0x4c')]('users','o',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'a',_0x0a9e('0x53'))[_0x0a9e('0x4c')]('sms_messages','me',_0x0a9e('0x54'))[_0x0a9e('0x4c')](_0x0a9e('0x55'),'it',_0x0a9e('0x56'))[_0x0a9e('0x4c')](_0x0a9e('0x57'),'t',_0x0a9e('0x58'));var _0x5bbcde=squel[_0x0a9e('0x59')]();var _0x1bde3c=[];var _0x1b5e80=squel[_0x0a9e('0x59')]();var _0x409789;if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x5a')]){_0x409789=as[_0x0a9e('0x5b')](_0x39e565[_0x0a9e('0x38')]['search']);var _0xe401a=_0x409789[_0x0a9e('0x5c')];for(var _0x4f7240=0x0;_0x4f7240<_0x409789['conditions']['length'];_0x4f7240++){var _0x1adfee=_0x409789[_0x0a9e('0x5d')][_0x4f7240];var _0x37edaa='i';var _0x11545a=_[_0x0a9e('0x5e')](_0x14b13f,[_0x0a9e('0x28'),_0x1adfee[_0x0a9e('0x45')]]);if(!_0x11545a){switch(_0x1adfee[_0x0a9e('0x45')]){case'unreadMessages':if(_0x1adfee['value']==0x1){_0x117c99['having']('`'+_0x1adfee[_0x0a9e('0x45')]+_0x0a9e('0x5f'));}else{_0x117c99[_0x0a9e('0x60')]('`'+_0x1adfee['field']+_0x0a9e('0x61'));}break;case _0x0a9e('0x62'):if(_0x1adfee['operator']==='$substring'){if(_0x1adfee[_0x0a9e('0x63')]['split']('\x20')[_0x0a9e('0x3d')]>0x1){_0x5bbcde[_0xe401a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x64')](_0x1adfee[_0x0a9e('0x63')]),null);}else{var _0x439340='%'+_0x1adfee['value']+'%';_0x5bbcde[_0xe401a](_0x0a9e('0x65'),_0x439340,_0x439340,_0x439340);}}else{_0x11545a=_[_0x0a9e('0x5e')](_0x14b13f,['name','ContactId']);_0x1adfee[_0x0a9e('0x45')]=_0x0a9e('0x66');_0x7be420=as['buildExpression'](_0x37edaa,_0x11545a[_0x0a9e('0x35')],_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420['text'],_0x7be420[_0x0a9e('0x63')]['start'],_0x7be420[_0x0a9e('0x63')]['end']);}break;case'Tag':var _0x5df0ad=_0x1adfee[_0x0a9e('0x63')]['split'](',')[_0x0a9e('0x2a')](function(_0x65432){return Number(_0x65432);});_0x5df0ad[_0x0a9e('0x2f')](function(_0x19b4df){_0x1b5e80['or'](_0x0a9e('0x67'),'%,'+_0x19b4df+',%');});_0x1bde3c=_[_0x0a9e('0x68')](_0x1bde3c,_0x5df0ad);break;case _0x0a9e('0x69'):if(_0x1adfee[_0x0a9e('0x6a')]==='$substring'){_0x5bbcde[_0xe401a](_0x0a9e('0x6b'),'%'+_0x1adfee[_0x0a9e('0x63')]+'%',null);}else{_0x11545a=_[_0x0a9e('0x5e')](_0x14b13f,[_0x0a9e('0x28'),_0x0a9e('0x6c')]);_0x1adfee[_0x0a9e('0x45')]='UserId';_0x7be420=as[_0x0a9e('0x6d')](_0x37edaa,_0x11545a[_0x0a9e('0x35')],_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420['text'],_0x7be420[_0x0a9e('0x63')]['start'],_0x7be420[_0x0a9e('0x63')]['end']);}break;case'body':_0x7be420=as['buildExpression']('me',null,_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420[_0x0a9e('0x6e')],_0x7be420['value'][_0x0a9e('0x6f')],_0x7be420[_0x0a9e('0x63')][_0x0a9e('0x1c')]);break;}}else{var _0x7be420=as[_0x0a9e('0x6d')](_0x37edaa,_0x11545a[_0x0a9e('0x35')],_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420['text'],_0x7be420[_0x0a9e('0x63')]['start'],_0x7be420[_0x0a9e('0x63')][_0x0a9e('0x1c')]);}}}else{var _0x51aaf7=_(_0x39e565['query'])[_0x0a9e('0x37')]()[_0x0a9e('0x2a')](function(_0x119677){return _[_0x0a9e('0x70')](_0x14b13f,['name',_0x119677])?_0x119677:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x63')]();if(!_['isEmpty'](_0x51aaf7)){_0x51aaf7[_0x0a9e('0x2f')](function(_0x17e88c){if(_0x17e88c===_0x0a9e('0x72')){_0x117c99[_0x0a9e('0x42')](_0x0a9e('0x73'),[]['concat'](_0x39e565[_0x0a9e('0x38')][_0x17e88c]));}else if(_0x17e88c===_0x0a9e('0x74')){var _0x281c7d=JSON['parse'](_0x39e565[_0x0a9e('0x38')][_0x17e88c])['$gte'];var _0x5211e3=JSON[_0x0a9e('0x75')](_0x39e565[_0x0a9e('0x38')][_0x17e88c])[_0x0a9e('0x76')];_0x117c99[_0x0a9e('0x42')](_0x0a9e('0x77'),_0x281c7d,_0x5211e3);}else{if(_0x39e565[_0x0a9e('0x38')][_0x17e88c]===_0x0a9e('0x78')){_0x117c99[_0x0a9e('0x42')]('i.'+_0x17e88c+_0x0a9e('0x79'));}else{_0x117c99[_0x0a9e('0x42')]('i.'+_0x17e88c+_0x0a9e('0x7a'),_0x39e565[_0x0a9e('0x38')][_0x17e88c]);}}});}if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7b')]){if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7b')]==0x1){_0x117c99[_0x0a9e('0x60')](_0x0a9e('0x7c'));}else{_0x117c99['having'](_0x0a9e('0x7d'));}}if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7e')]){_0x1bde3c=_['isArray'](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7e')])?_0x39e565['query'][_0x0a9e('0x7e')]:new Array(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7e')]);_0x1bde3c[_0x0a9e('0x2f')](function(_0x13b5c0){_0x1b5e80['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x13b5c0+',%');});}if(_0x39e565['query']['filter']){var _0x40fb85=_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7f')][_0x0a9e('0x80')]('\x5c','\x5c\x5c')[_0x0a9e('0x80')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x81')](_0x40fb85)){_0x5bbcde['or'](_0x0a9e('0x82'),_0x40fb85+'%')['or'](_0x0a9e('0x83'),_0x40fb85+'%');}else{_0x5bbcde['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x64')](_0x40fb85))['or'](_0x0a9e('0x84'),_0x40fb85+'%');}}}_0x117c99[_0x0a9e('0x42')](_0x5bbcde);_0x117c99['group'](_0x0a9e('0x85'));var _0x583b2e={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')]['SELECT'],'raw':!![]};var _0x2ed01e=_0x117c99[_0x0a9e('0x88')]();_0x2ed01e[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x2ed01e['field'](_0x0a9e('0x89'),_0x0a9e('0x8a'));if(_0x44295a[_0x0a9e('0x40')]){_0x44295a[_0x0a9e('0x40')]['forEach'](function(_0x109ccb){var _0x3d91db=_0x109ccb[0x0]===_0x0a9e('0x8b')?_0x109ccb[0x0]:'i.'+_0x109ccb[0x0];_0x117c99[_0x0a9e('0x40')](_0x3d91db,_0x109ccb[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x8c')](_0x1bde3c)){_0x117c99[_0x0a9e('0x60')](_0x1b5e80);_0x2ed01e[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x1bde3c);}BPromise[_0x0a9e('0x8e')]()[_0x0a9e('0x25')](function(){if(!_0x409789){if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x72')])return;_0x2ed01e[_0x0a9e('0x42')](_0x0a9e('0x8f'));_0x117c99[_0x0a9e('0x42')](_0x0a9e('0x8f'));return;}if(_0x39e565[_0x0a9e('0x90')][_0x0a9e('0x91')]!=='agent')return;return _0x39e565[_0x0a9e('0x90')][_0x0a9e('0x92')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x25')](function(_0x563627){if(_[_0x0a9e('0x8c')](_0x563627)){_0x2ed01e[_0x0a9e('0x42')](_0x0a9e('0x93'));_0x117c99[_0x0a9e('0x42')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x2ed01e['where'](_0x0a9e('0x73'),_[_0x0a9e('0x2a')](_0x563627,'id'));_0x117c99['where'](_0x0a9e('0x73'),_['map'](_0x563627,'id'));}});})[_0x0a9e('0x25')](function(){if(_0x39e565[_0x0a9e('0x90')]['role']===_0x0a9e('0x94')&&!_0x409789&&!_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x72')])return[];return db[_0x0a9e('0x95')][_0x0a9e('0x38')](_0x2ed01e[_0x0a9e('0x96')](),_0x583b2e);})[_0x0a9e('0x25')](function(_0x482ca2){_0x2cc7a0[_0x0a9e('0x1e')]=_0x482ca2[_0x0a9e('0x3d')];if(_0x2cc7a0[_0x0a9e('0x1e')]===0x0)return[];return db[_0x0a9e('0x95')]['query'](_0x23b089[_0x0a9e('0x96')](),_0x583b2e)[_0x0a9e('0x25')](function(_0x4bf3a5){_0x45a9b8=_[_0x0a9e('0x97')](_0x4bf3a5,'id');_0x583b2e=_['merge'](_0x583b2e,{'model':db[_0x0a9e('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x3c')]){_0x44295a[_0x0a9e('0x3b')]['forEach'](function(_0x51ccd7){_0x117c99[_0x0a9e('0x45')]('i.'+_0x51ccd7);});}else{_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x89'),'unreadMessages');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x98'),'Account.key');_0x117c99['field'](_0x0a9e('0x99'),'Account.mandatoryDisposition');_0x117c99['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',_0x0a9e('0x8b'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x9b'),_0x0a9e('0x9c'));_0x117c99['field'](_0x0a9e('0x9d'),'Contact.lastName');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x117c99[_0x0a9e('0x45')]('c.phone',_0x0a9e('0xa0'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa1'),'Contact.mobile');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa6'),'Owner.internal');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa7'),'TagIds');}if(_0x44295a[_0x0a9e('0x20')])_0x117c99[_0x0a9e('0x20')](_0x44295a[_0x0a9e('0x20')]);if(_0x44295a['offset'])_0x117c99[_0x0a9e('0x1f')](_0x44295a['offset']);return db[_0x0a9e('0x95')][_0x0a9e('0x38')](_0x117c99[_0x0a9e('0x96')](),_0x583b2e);})[_0x0a9e('0x25')](function(_0x842d6f){_0x473fdc[_0x0a9e('0x42')](_0x0a9e('0xa8'),_[_0x0a9e('0x2a')](_0x842d6f,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x473fdc[_0x0a9e('0x96')](),_0x583b2e)[_0x0a9e('0x25')](function(_0x30ef6e){var _0x28e60a=_[_0x0a9e('0xa9')](_0x30ef6e,_0x0a9e('0xaa'));var _0x33f0c9=[];_0x842d6f[_0x0a9e('0x2f')](function(_0x31af8c){_0x33f0c9[_0x0a9e('0x30')](updateSmsInteraction(_0x31af8c,_0x45a9b8,_0x28e60a));});return BPromise[_0x0a9e('0xab')](_0x33f0c9);});});})[_0x0a9e('0x25')](function(_0x4989f9){_0x2cc7a0[_0x0a9e('0xac')]=_0x4989f9;return _0x2cc7a0;})[_0x0a9e('0x25')](respondWithFilteredResult(_0x5583a4,_0x44295a))[_0x0a9e('0x31')](handleError(_0x5583a4,null));};exports[_0x0a9e('0xad')]=function(_0xb0599a,_0x5d9ddb){var _0x3afc8c={'raw':![],'where':{'id':_0xb0599a['params']['id']}},_0x1756c7={};_0x1756c7[_0x0a9e('0xae')]=_['keys'](db[_0x0a9e('0x33')][_0x0a9e('0xaf')]);_0x1756c7[_0x0a9e('0x38')]=_[_0x0a9e('0x37')](_0xb0599a['query']);_0x1756c7[_0x0a9e('0x39')]=_['intersection'](_0x1756c7[_0x0a9e('0xae')],_0x1756c7[_0x0a9e('0x38')]);_0x3afc8c['attributes']=_[_0x0a9e('0x3a')](_0x1756c7[_0x0a9e('0xae')],qs[_0x0a9e('0x3c')](_0xb0599a['query']['fields']));_0x3afc8c[_0x0a9e('0x3b')]=_0x3afc8c[_0x0a9e('0x3b')][_0x0a9e('0x3d')]?_0x3afc8c[_0x0a9e('0x3b')]:_0x1756c7[_0x0a9e('0xae')];if(_0xb0599a[_0x0a9e('0x38')][_0x0a9e('0xb0')]){_0x3afc8c[_0x0a9e('0xb1')]=[{'all':!![]}];}_0x3afc8c=_[_0x0a9e('0xb2')]({},_0x3afc8c,_0xb0599a['options']);return db[_0x0a9e('0x33')]['find'](_0x3afc8c)[_0x0a9e('0x25')](handleEntityNotFound(_0x5d9ddb,null))[_0x0a9e('0x25')](respondWithResult(_0x5d9ddb,null))[_0x0a9e('0x31')](handleError(_0x5d9ddb,null));};exports[_0x0a9e('0xb3')]=function(_0x1b61d5,_0x4e7273){return db[_0x0a9e('0x33')][_0x0a9e('0xb3')](_0x1b61d5[_0x0a9e('0xb4')],{})[_0x0a9e('0x25')](respondWithResult(_0x4e7273,0xc9))[_0x0a9e('0x31')](handleError(_0x4e7273,null));};exports['update']=function(_0x4f074c,_0x22a3cb){if(_0x4f074c['body']['id']){delete _0x4f074c[_0x0a9e('0xb4')]['id'];}return db[_0x0a9e('0x33')][_0x0a9e('0x5e')]({'where':{'id':_0x4f074c[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x22a3cb,null))[_0x0a9e('0x25')](saveUpdates(_0x4f074c['body'],null))['then'](respondWithResult(_0x22a3cb,null))[_0x0a9e('0x31')](handleError(_0x22a3cb,null));};exports['destroy']=function(_0x2469d1,_0x5c689c){return db[_0x0a9e('0x33')]['find']({'where':{'id':_0x2469d1['params']['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x5c689c,null))[_0x0a9e('0x25')](removeEntity(_0x5c689c,null))['catch'](handleError(_0x5c689c,null));};exports[_0x0a9e('0xb6')]=function(_0x17cb30,_0x15c6b9){return db[_0x0a9e('0x33')][_0x0a9e('0xb6')]()['then'](respondWithResult(_0x15c6b9,null))['catch'](handleError(_0x15c6b9,null));};exports[_0x0a9e('0xb7')]=function(_0x22286c,_0x41c8cd,_0x24beb6){return db[_0x0a9e('0xb8')]['find']({'where':{'id':_0x22286c[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x41c8cd,null))['then'](function(_0x3c313d){if(_0x3c313d){return _0x3c313d[_0x0a9e('0xb7')](_0x22286c[_0x0a9e('0xb4')][_0x0a9e('0xb9')],_[_0x0a9e('0xba')](_0x22286c[_0x0a9e('0xb4')],[_0x0a9e('0xb9'),'id'])||{});}})[_0x0a9e('0x25')](respondWithResult(_0x41c8cd,null))[_0x0a9e('0x31')](handleError(_0x41c8cd,null));};exports[_0x0a9e('0xbb')]=function(_0x4bdebb,_0x1065a7,_0x301047){var _0x2ada60={'raw':![],'where':{}};var _0x1c4232={};var _0x1d0b02={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x4bdebb[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x1065a7,null))[_0x0a9e('0x25')](function(_0x2fea95){if(_0x2fea95){_0x1c4232[_0x0a9e('0xae')]=_['keys'](db[_0x0a9e('0xb8')][_0x0a9e('0xaf')]);_0x1c4232[_0x0a9e('0x38')]=_['keys'](_0x4bdebb[_0x0a9e('0x38')]);_0x1c4232['filters']=_[_0x0a9e('0x3a')](_0x1c4232['model'],_0x1c4232[_0x0a9e('0x38')]);_0x2ada60[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0x1c4232['model'],qs[_0x0a9e('0x3c')](_0x4bdebb['query'][_0x0a9e('0x3c')]));_0x2ada60[_0x0a9e('0x3b')]=_0x2ada60[_0x0a9e('0x3b')][_0x0a9e('0x3d')]?_0x2ada60[_0x0a9e('0x3b')]:_0x1c4232[_0x0a9e('0xae')];if(!_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x2ada60[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x20')]);_0x2ada60[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x4bdebb[_0x0a9e('0x38')]['offset']);}_0x2ada60['order']=qs[_0x0a9e('0x41')](_0x4bdebb['query'][_0x0a9e('0x41')]);_0x2ada60[_0x0a9e('0x42')]=qs['filters'](_[_0x0a9e('0x43')](_0x4bdebb[_0x0a9e('0x38')],_0x1c4232[_0x0a9e('0x39')]));_0x2ada60[_0x0a9e('0x42')]['SmsInteractionId']=_0x2fea95['id'];if(_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x7f')]){_0x2ada60[_0x0a9e('0x42')]=_[_0x0a9e('0xb2')](_0x2ada60['where'],{'$or':_[_0x0a9e('0x2a')](_0x2ada60[_0x0a9e('0x3b')],function(_0x2b7092){var _0x5c838b={};_0x5c838b[_0x2b7092]={'$like':'%'+_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x7f')]+'%'};return _0x5c838b;})});}if(_0x4bdebb[_0x0a9e('0x38')]['$gte']){var _0x303f75=_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0xbc')][_0x0a9e('0x2e')](',');var _0x2394d3={};_0x2394d3[_0x303f75[0x0]]={'$gte':moment(_0x303f75[0x1])['format'](_0x0a9e('0xbd'))};_0x2ada60[_0x0a9e('0x42')]=_['merge'](_0x2ada60[_0x0a9e('0x42')],_0x2394d3);}_0x2ada60=_[_0x0a9e('0xb2')]({},_0x2ada60,_0x4bdebb[_0x0a9e('0xbe')]);return db['SmsMessage']['count']({'where':_0x2ada60['where']})[_0x0a9e('0x25')](function(_0x4a70ce){_0x1d0b02['count']=_0x4a70ce;if(_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0xb0')]){_0x2ada60[_0x0a9e('0xb1')]=[{'all':!![]}];}return db['SmsMessage'][_0x0a9e('0xbf')](_0x2ada60);})[_0x0a9e('0x25')](function(_0x213d4e){_0x1d0b02[_0x0a9e('0xac')]=_0x213d4e;return _0x1d0b02;});}})[_0x0a9e('0x25')](respondWithFilteredResult(_0x1065a7,_0x2ada60))[_0x0a9e('0x31')](handleError(_0x1065a7,null));};exports[_0x0a9e('0xc0')]=function(_0x328ec5,_0x3b5bda,_0x5a1848){return db[_0x0a9e('0x33')]['find']({'where':{'id':_0x328ec5[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x3b5bda,null))[_0x0a9e('0x25')](function(_0x3cf222){if(_0x3cf222){return _0x3cf222[_0x0a9e('0xc1')](_0x328ec5[_0x0a9e('0xb4')]['ids'],_[_0x0a9e('0xba')](_0x328ec5[_0x0a9e('0xb4')],[_0x0a9e('0xb9'),'id'])||{})[_0x0a9e('0xc2')](function(){return db['Tag'][_0x0a9e('0xbf')]({'attributes':['id',_0x0a9e('0x28'),_0x0a9e('0x46')],'where':{'id':_0x328ec5[_0x0a9e('0xb4')][_0x0a9e('0xb9')]}});})[_0x0a9e('0x25')](function(_0x238c24){socket[_0x0a9e('0xc3')](_0x0a9e('0xc4'),{'id':Number(_0x328ec5[_0x0a9e('0xb5')]['id']),'tags':_0x238c24||[]});return{'id':Number(_0x328ec5['params']['id']),'tags':_0x238c24||[]};});}})[_0x0a9e('0x25')](respondWithResult(_0x3b5bda,null))[_0x0a9e('0x31')](handleError(_0x3b5bda,null));};exports[_0x0a9e('0xc5')]=function(_0x26b826,_0xea8bd1,_0x253f74){return db[_0x0a9e('0x33')][_0x0a9e('0x5e')]({'where':{'id':_0x26b826['params']['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0xea8bd1,null))[_0x0a9e('0x25')](function(_0x1a9ef1){if(_0x1a9ef1){return _0x1a9ef1['removeTags'](_0x26b826[_0x0a9e('0x38')][_0x0a9e('0xb9')]);}})[_0x0a9e('0x25')](respondWithStatusCode(_0xea8bd1,null))[_0x0a9e('0x31')](handleError(_0xea8bd1,null));};exports[_0x0a9e('0xc6')]=function(_0x1ba457,_0x424f1b){var _0x336a19=moment()[_0x0a9e('0xc7')]()[_0x0a9e('0x96')]();var _0x5a7dad=path[_0x0a9e('0xc8')](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x3942fd=path['join'](config[_0x0a9e('0xc9')],'server','files','attachments');var _0x19e4e6=path[_0x0a9e('0xc8')](_0x5a7dad,_0x336a19);var _0x426cb4=util[_0x0a9e('0xcd')]('transcript-%d-%s.zip',_0x1ba457[_0x0a9e('0xb5')]['id'],_0x336a19);var _0x309fa9=path[_0x0a9e('0xc8')](_0x5a7dad,_0x426cb4);var _0x1fdb10=[];_0x1fdb10[_0x0a9e('0x30')]({'model':db['User'],'as':'User','attributes':['id',_0x0a9e('0x2b')],'raw':!![]});_0x1fdb10[_0x0a9e('0x30')]({'model':db[_0x0a9e('0xce')],'as':'Contact','attributes':['id',_0x0a9e('0xcf'),_0x0a9e('0xd0')],'raw':!![]});var _0x422f0a=[{'model':db['SmsMessage'],'as':_0x0a9e('0xd1'),'attributes':['id',_0x0a9e('0xb4'),_0x0a9e('0x74'),'direction',_0x0a9e('0xd2'),_0x0a9e('0x7b')],'include':_0x1fdb10}];_0x422f0a[_0x0a9e('0x30')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x422f0a[_0x0a9e('0x30')]({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x2b')]});return db['SmsInteraction'][_0x0a9e('0x5e')]({'where':{'id':_0x1ba457['params']['id']},'include':_0x422f0a})[_0x0a9e('0x25')](handleEntityNotFound(_0x424f1b,null))[_0x0a9e('0x25')](function(_0x242f23){if(_0x242f23){var _0x57f673=_0x242f23[_0x0a9e('0xd4')]({'plain':!![]});fs[_0x0a9e('0xd5')](_0x19e4e6);var _0xb8a476={'format':'A4','border':'10px','header':{'height':_0x0a9e('0xd6'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0x0a9e('0xd7'),'contents':{'default':util['format'](_0x0a9e('0xd8'),util['format'](_0x0a9e('0xd9'),_0x0a9e('0xda'),_0x57f673['id']),moment()[_0x0a9e('0xcd')](_0x0a9e('0xdb'))[_0x0a9e('0x96')]())}}};var _0x251dd9={'channel':_0x0a9e('0xda'),'account':_0x57f673['Account'][_0x0a9e('0x28')],'agent':_0x57f673[_0x0a9e('0xd3')]?_0x57f673['Owner'][_0x0a9e('0x2b')]:_0x0a9e('0xdc'),'createdAt':moment(_0x57f673['createdAt'])[_0x0a9e('0xcd')](_0x0a9e('0xbd'))[_0x0a9e('0x96')](),'closedAt':_0x57f673['closed']?moment(_0x57f673[_0x0a9e('0xdd')])[_0x0a9e('0xcd')](_0x0a9e('0xbd'))[_0x0a9e('0x96')]():'','disposition':_0x57f673[_0x0a9e('0xde')],'messages':_(_0x57f673[_0x0a9e('0xd1')])[_0x0a9e('0x7f')]({'secret':![]})[_0x0a9e('0x2a')](function(_0x22767f){return{'date':moment(_0x22767f[_0x0a9e('0x74')])['format'](_0x0a9e('0xbd'))['toString'](),'sender':_0x22767f[_0x0a9e('0xdf')]===_0x0a9e('0xe0')?_0x22767f[_0x0a9e('0x69')]?_0x22767f[_0x0a9e('0x69')][_0x0a9e('0x2b')]:_0x0a9e('0xe1'):_0x22767f['Contact'][_0x0a9e('0xcf')]+(_0x22767f[_0x0a9e('0x62')][_0x0a9e('0xd0')]?'\x20'+_0x22767f['Contact'][_0x0a9e('0xd0')]:''),'body':_0x22767f[_0x0a9e('0xb4')],'direction':_0x22767f[_0x0a9e('0xdf')]===_0x0a9e('0xe0')?'A':'C','secret':_0x22767f[_0x0a9e('0xd2')],'read':_0x22767f[_0x0a9e('0x7b')]};})[_0x0a9e('0x63')]()};return ejs['renderFile'](path[_0x0a9e('0xc8')](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe2'),_0x0a9e('0xe3')),{'interaction':_0x251dd9})[_0x0a9e('0x25')](function(_0x8120e){return new BPromise(function(_0x5d6a48,_0x5c8720){pdf[_0x0a9e('0xb3')](_0x8120e,_0xb8a476)[_0x0a9e('0xe4')](path[_0x0a9e('0xc8')](_0x19e4e6,_0x0a9e('0xe5')+_0x57f673['id']+'-'+_0x336a19+_0x0a9e('0xe6')),function(_0x131da8,_0x609711){if(_0x131da8)return _0x5c8720(_0x131da8);_0x5d6a48(_0x609711);});});})['then'](function(){return new BPromise(function(_0x39ea62,_0x1d7fc4){zipdir(_0x19e4e6,{'saveTo':_0x309fa9},function(_0x2d8e91,_0x2675a5){if(_0x2d8e91)return _0x1d7fc4(_0x2d8e91);return _0x39ea62(_0x2675a5);});})[_0x0a9e('0x25')](function(){return new BPromise(function(_0x3c6082,_0x16be7e){rimraf(_0x19e4e6,function(_0x54f0b8){if(_0x54f0b8)_0x16be7e(_0x54f0b8);return _0x3c6082();});});})[_0x0a9e('0x25')](function(){return _0x424f1b[_0x0a9e('0xc6')](_0x309fa9,_0x426cb4,function(_0x231826){if(_0x231826){console['log'](_0x0a9e('0xe7'),_0x231826);}else{fs[_0x0a9e('0xe8')](_0x309fa9);}});});});}else{return _0x424f1b[_0x0a9e('0x1b')](0xc8);}})[_0x0a9e('0x31')](handleError(_0x424f1b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 48ff77b..1266a2d 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 _0x7d9f=['emit','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','setDataValue','Users','length'];(function(_0x3ff0aa,_0x4701e5){var _0x10dc5e=function(_0xf344b2){while(--_0xf344b2){_0x3ff0aa['push'](_0x3ff0aa['shift']());}};_0x10dc5e(++_0x4701e5);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x1b8bc6,_0x4672de){_0x1b8bc6=_0x1b8bc6-0x0;var _0x17b6bd=_0x7d9f[_0x1b8bc6];return _0x17b6bd;};'use strict';var EventEmitter=require(_0xf7d9('0x0'));var SmsInteraction=require(_0xf7d9('0x1'))['db'][_0xf7d9('0x2')];var SmsMessage=require(_0xf7d9('0x1'))['db'][_0xf7d9('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf7d9('0x4'),'afterUpdate':_0xf7d9('0x5'),'afterDestroy':_0xf7d9('0x6')};function emitEvent(_0x159e95){return function(_0x23cb4c,_0x53fdaf,_0x4b50c7){_0x23cb4c[_0xf7d9('0x7')]({'attributes':['id'],'raw':!![]})[_0xf7d9('0x8')](function(_0x5772b4){_0x23cb4c[_0xf7d9('0x9')](_0xf7d9('0xa'),_0x5772b4['map'](function(_0x572d51){return{'id':_0x572d51['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x23cb4c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf7d9('0x8')](function(_0x33360a){_0x23cb4c['setDataValue']('unreadMessages',_0x33360a[_0xf7d9('0xb')]);SmsInteractionEvents[_0xf7d9('0xc')](_0x159e95+':'+_0x23cb4c['id'],_0x23cb4c);SmsInteractionEvents[_0xf7d9('0xc')](_0x159e95,_0x23cb4c);_0x4b50c7(null);})['catch'](_0x4b50c7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xf7d9('0xd')](e,emitEvent(event));}}module[_0xf7d9('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0xca9e=['emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','findAll','then','unreadMessages','length'];(function(_0x37f7f5,_0x3b19b4){var _0x3a4377=function(_0x450a20){while(--_0x450a20){_0x37f7f5['push'](_0x37f7f5['shift']());}};_0x3a4377(++_0x3b19b4);}(_0xca9e,0x136));var _0xeca9=function(_0x57f273,_0x60b78a){_0x57f273=_0x57f273-0x0;var _0x41ad18=_0xca9e[_0x57f273];return _0x41ad18;};'use strict';var EventEmitter=require(_0xeca9('0x0'));var SmsInteraction=require(_0xeca9('0x1'))['db'][_0xeca9('0x2')];var SmsMessage=require(_0xeca9('0x1'))['db'][_0xeca9('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xeca9('0x4')](0x0);var events={'afterCreate':_0xeca9('0x5'),'afterUpdate':_0xeca9('0x6'),'afterDestroy':_0xeca9('0x7')};function emitEvent(_0x1e0a18){return function(_0x3aba81,_0x1c4ce6,_0x186a47){_0x3aba81[_0xeca9('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x369f5e){_0x3aba81[_0xeca9('0x9')]('Users',_0x369f5e['map'](function(_0x1ef0f3){return{'id':_0x1ef0f3['id']};}));return SmsMessage[_0xeca9('0xa')]({'where':{'SmsInteractionId':_0x3aba81['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeca9('0xb')](function(_0x5305ce){_0x3aba81[_0xeca9('0x9')](_0xeca9('0xc'),_0x5305ce[_0xeca9('0xd')]);SmsInteractionEvents[_0xeca9('0xe')](_0x1e0a18+':'+_0x3aba81['id'],_0x3aba81);SmsInteractionEvents[_0xeca9('0xe')](_0x1e0a18,_0x3aba81);_0x186a47(null);})[_0xeca9('0xf')](_0x186a47(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xeca9('0x10')](e,emitEvent(event));}}module[_0xeca9('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 5567e64..6083ea2 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 _0xcc84=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x34c401,_0x4458ec){var _0x89c5e3=function(_0x57c41a){while(--_0x57c41a){_0x34c401['push'](_0x34c401['shift']());}};_0x89c5e3(++_0x4458ec);}(_0xcc84,0x180));var _0x4cc8=function(_0x1d4049,_0x5b60c9){_0x1d4049=_0x1d4049-0x0;var _0x1c72e6=_0xcc84[_0x1d4049];return _0x1c72e6;};'use strict';var _=require(_0x4cc8('0x0'));var util=require(_0x4cc8('0x1'));var logger=require(_0x4cc8('0x2'))(_0x4cc8('0x3'));var moment=require(_0x4cc8('0x4'));var BPromise=require(_0x4cc8('0x5'));var rp=require(_0x4cc8('0x6'));var fs=require('fs');var path=require(_0x4cc8('0x7'));var rimraf=require(_0x4cc8('0x8'));var config=require(_0x4cc8('0x9'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x5e53c6,_0x39dee0){return _0x5e53c6[_0x4cc8('0xa')]('SmsInteraction',attributes,{'tableName':_0x4cc8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb61f76,_0x2294e3,_0x502aab){if(_0xb61f76[_0x4cc8('0xc')](_0x4cc8('0xd'))){_0xb61f76[_0x4cc8('0xe')]=moment()['format'](_0x4cc8('0xf'));}_0x502aab(null,_0xb61f76);}}});}; \ No newline at end of file +var _0x41a4=['SmsInteraction','sms_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define'];(function(_0x537ce5,_0x13a4af){var _0x38789f=function(_0x11a802){while(--_0x11a802){_0x537ce5['push'](_0x537ce5['shift']());}};_0x38789f(++_0x13a4af);}(_0x41a4,0x1d5));var _0x441a=function(_0x57a463,_0x55d84a){_0x57a463=_0x57a463-0x0;var _0x2b0b23=_0x41a4[_0x57a463];return _0x2b0b23;};'use strict';var _=require(_0x441a('0x0'));var util=require(_0x441a('0x1'));var logger=require(_0x441a('0x2'))('api');var moment=require(_0x441a('0x3'));var BPromise=require(_0x441a('0x4'));var rp=require(_0x441a('0x5'));var fs=require('fs');var path=require(_0x441a('0x6'));var rimraf=require(_0x441a('0x7'));var config=require(_0x441a('0x8'));var attributes=require(_0x441a('0x9'));module['exports']=function(_0x4df8f8,_0xf0d190){return _0x4df8f8[_0x441a('0xa')](_0x441a('0xb'),attributes,{'tableName':_0x441a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x35aeef,_0x16e285,_0x4b13ca){if(_0x35aeef[_0x441a('0xd')](_0x441a('0xe'))){_0x35aeef['closedAt']=moment()['format'](_0x441a('0xf'));}_0x4b13ca(null,_0x35aeef);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 48208d8..3f056f2 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 _0xcfa3=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsInteraction.socket','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','then','AddTagsToSmsInteraction','addTags','ids','spread'];(function(_0xee588,_0x368239){var _0x58dd1a=function(_0x3fd2b1){while(--_0x3fd2b1){_0xee588['push'](_0xee588['shift']());}};_0x58dd1a(++_0x368239);}(_0xcfa3,0x7c));var _0x3cfa=function(_0x533f16,_0x5fa494){_0x533f16=_0x533f16-0x0;var _0x4775b4=_0xcfa3[_0x533f16];return _0x4775b4;};'use strict';var _=require(_0x3cfa('0x0'));var util=require(_0x3cfa('0x1'));var moment=require(_0x3cfa('0x2'));var BPromise=require(_0x3cfa('0x3'));var rs=require(_0x3cfa('0x4'));var fs=require('fs');var Redis=require(_0x3cfa('0x5'));var db=require(_0x3cfa('0x6'))['db'];var utils=require(_0x3cfa('0x7'));var logger=require(_0x3cfa('0x8'))(_0x3cfa('0x9'));var config=require('../../config/environment');var jayson=require(_0x3cfa('0xa'));var client=jayson[_0x3cfa('0xb')][_0x3cfa('0xc')]({'port':0x232a});config['redis']=_[_0x3cfa('0xd')](config[_0x3cfa('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x3cfa('0xf'))(new Redis(config[_0x3cfa('0xe')]));require(_0x3cfa('0x10'))['register'](socket);function respondWithRpcPromise(_0xfe6037,_0xea7193,_0x4a70f9){return new BPromise(function(_0x1bfa89,_0x860d0c){return client['request'](_0xfe6037,_0x4a70f9)['then'](function(_0x57139c){logger[_0x3cfa('0x11')]('SmsInteraction,\x20%s,\x20%s',_0xea7193,_0x3cfa('0x12'));logger[_0x3cfa('0x13')](_0x3cfa('0x14'),_0xea7193,'request\x20sent',JSON[_0x3cfa('0x15')](_0x57139c));if(_0x57139c[_0x3cfa('0x16')]){if(_0x57139c['error'][_0x3cfa('0x17')]===0x1f4){logger[_0x3cfa('0x16')](_0x3cfa('0x18'),_0xea7193,_0x57139c[_0x3cfa('0x16')][_0x3cfa('0x19')]);return _0x860d0c(_0x57139c['error'][_0x3cfa('0x19')]);}logger[_0x3cfa('0x16')](_0x3cfa('0x18'),_0xea7193,_0x57139c['error']['message']);return _0x1bfa89(_0x57139c['error'][_0x3cfa('0x19')]);}else{logger[_0x3cfa('0x11')](_0x3cfa('0x18'),_0xea7193,_0x3cfa('0x12'));_0x1bfa89(_0x57139c[_0x3cfa('0x1a')][_0x3cfa('0x19')]);}})[_0x3cfa('0x1b')](function(_0xe149a8){logger[_0x3cfa('0x16')](_0x3cfa('0x18'),_0xea7193,_0xe149a8);_0x860d0c(_0xe149a8);});});}exports[_0x3cfa('0x1c')]=function(_0x50d2c7){var _0x4447be=this;return new Promise(function(_0x1bda1c,_0x571e73){return db[_0x3cfa('0x1d')][_0x3cfa('0x1e')](_0x50d2c7[_0x3cfa('0x1f')],{'raw':_0x50d2c7[_0x3cfa('0x20')]?_0x50d2c7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50d2c7[_0x3cfa('0x20')]?_0x50d2c7[_0x3cfa('0x20')][_0x3cfa('0x21')]||null:null,'attributes':_0x50d2c7['options']?_0x50d2c7[_0x3cfa('0x20')][_0x3cfa('0x22')]||null:null,'limit':_0x50d2c7[_0x3cfa('0x20')]?_0x50d2c7[_0x3cfa('0x20')]['limit']||null:null})[_0x3cfa('0x23')](function(_0x2c354a){logger[_0x3cfa('0x11')](_0x3cfa('0x1c'),_0x50d2c7);logger[_0x3cfa('0x13')]('UpdateSmsInteraction',_0x50d2c7,JSON[_0x3cfa('0x15')](_0x2c354a));_0x1bda1c(_0x2c354a);})[_0x3cfa('0x1b')](function(_0x418ead){logger[_0x3cfa('0x16')](_0x3cfa('0x1c'),_0x418ead['message'],_0x50d2c7);_0x571e73(_0x4447be['error'](0x1f4,_0x418ead[_0x3cfa('0x19')]));});});};exports[_0x3cfa('0x24')]=function(_0x10c186){return new Promise(function(_0x15d2d5,_0x4b0001){return db[_0x3cfa('0x1d')]['find']({'where':_0x10c186[_0x3cfa('0x20')]?_0x10c186[_0x3cfa('0x20')][_0x3cfa('0x21')]||null:null})['then'](function(_0x25621f){if(_0x25621f){return _0x25621f[_0x3cfa('0x25')](_0x10c186[_0x3cfa('0x1f')]['ids'],_['omit'](_0x10c186[_0x3cfa('0x1f')],[_0x3cfa('0x26'),'id'])||{});}})[_0x3cfa('0x27')](function(_0xe47aaa){logger[_0x3cfa('0x11')]('AddTags',_0x10c186);logger[_0x3cfa('0x13')]('AddTags',_0x10c186,JSON[_0x3cfa('0x15')](_0xe47aaa));_0x15d2d5(_0xe47aaa);})[_0x3cfa('0x1b')](function(_0x2b6c81){logger[_0x3cfa('0x16')](_0x3cfa('0x28'),_0x2b6c81[_0x3cfa('0x19')],_0x10c186);_0x4b0001(_this[_0x3cfa('0x16')](0x1f4,_0x2b6c81[_0x3cfa('0x19')]));});});}; \ No newline at end of file +var _0x4071=['SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','info','result','message','catch','SmsInteraction','update','options','raw','where','attributes','UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s'];(function(_0x59b930,_0x2ca6c1){var _0x3ca77d=function(_0x59f49a){while(--_0x59f49a){_0x59b930['push'](_0x59b930['shift']());}};_0x3ca77d(++_0x2ca6c1);}(_0x4071,0x6f));var _0x1407=function(_0x2f6331,_0x268498){_0x2f6331=_0x2f6331-0x0;var _0x365ba5=_0x4071[_0x2f6331];return _0x365ba5;};'use strict';var _=require(_0x1407('0x0'));var util=require(_0x1407('0x1'));var moment=require(_0x1407('0x2'));var BPromise=require(_0x1407('0x3'));var rs=require(_0x1407('0x4'));var fs=require('fs');var Redis=require(_0x1407('0x5'));var db=require(_0x1407('0x6'))['db'];var utils=require(_0x1407('0x7'));var logger=require(_0x1407('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1407('0x9')]({'port':0x232a});config[_0x1407('0xa')]=_[_0x1407('0xb')](config[_0x1407('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1407('0xc'))(new Redis(config['redis']));require(_0x1407('0xd'))[_0x1407('0xe')](socket);function respondWithRpcPromise(_0x269c7a,_0x6ab2e8,_0x2e603b){return new BPromise(function(_0x173097,_0x2b8d19){return client[_0x1407('0xf')](_0x269c7a,_0x2e603b)[_0x1407('0x10')](function(_0x3479d5){logger['info'](_0x1407('0x11'),_0x6ab2e8,'request\x20sent');logger['debug'](_0x1407('0x12'),_0x6ab2e8,_0x1407('0x13'),JSON['stringify'](_0x3479d5));if(_0x3479d5['error']){if(_0x3479d5['error'][_0x1407('0x14')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x6ab2e8,_0x3479d5[_0x1407('0x15')]['message']);return _0x2b8d19(_0x3479d5[_0x1407('0x15')]['message']);}logger[_0x1407('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x6ab2e8,_0x3479d5['error']['message']);return _0x173097(_0x3479d5[_0x1407('0x15')]['message']);}else{logger[_0x1407('0x16')](_0x1407('0x11'),_0x6ab2e8,_0x1407('0x13'));_0x173097(_0x3479d5[_0x1407('0x17')][_0x1407('0x18')]);}})[_0x1407('0x19')](function(_0x5355fc){logger[_0x1407('0x15')](_0x1407('0x11'),_0x6ab2e8,_0x5355fc);_0x2b8d19(_0x5355fc);});});}exports['UpdateSmsInteraction']=function(_0xe5c24d){var _0x1dc07f=this;return new Promise(function(_0x4958e7,_0x1aa2bf){return db[_0x1407('0x1a')][_0x1407('0x1b')](_0xe5c24d['body'],{'raw':_0xe5c24d[_0x1407('0x1c')]?_0xe5c24d[_0x1407('0x1c')][_0x1407('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe5c24d[_0x1407('0x1c')]?_0xe5c24d[_0x1407('0x1c')][_0x1407('0x1e')]||null:null,'attributes':_0xe5c24d[_0x1407('0x1c')]?_0xe5c24d['options'][_0x1407('0x1f')]||null:null,'limit':_0xe5c24d[_0x1407('0x1c')]?_0xe5c24d['options']['limit']||null:null})[_0x1407('0x10')](function(_0x45485f){logger['info'](_0x1407('0x20'),_0xe5c24d);logger['debug'](_0x1407('0x20'),_0xe5c24d,JSON[_0x1407('0x21')](_0x45485f));_0x4958e7(_0x45485f);})['catch'](function(_0x1dbb47){logger[_0x1407('0x15')](_0x1407('0x20'),_0x1dbb47['message'],_0xe5c24d);_0x1aa2bf(_0x1dc07f[_0x1407('0x15')](0x1f4,_0x1dbb47[_0x1407('0x18')]));});});};exports[_0x1407('0x22')]=function(_0x242758){return new Promise(function(_0x539a1c,_0x2eccaa){return db[_0x1407('0x1a')][_0x1407('0x23')]({'where':_0x242758[_0x1407('0x1c')]?_0x242758[_0x1407('0x1c')][_0x1407('0x1e')]||null:null})['then'](function(_0x594953){if(_0x594953){return _0x594953[_0x1407('0x24')](_0x242758[_0x1407('0x25')][_0x1407('0x26')],_[_0x1407('0x27')](_0x242758[_0x1407('0x25')],['ids','id'])||{});}})[_0x1407('0x28')](function(_0x4df1fc){logger[_0x1407('0x16')](_0x1407('0x29'),_0x242758);logger[_0x1407('0x2a')](_0x1407('0x29'),_0x242758,JSON[_0x1407('0x21')](_0x4df1fc));_0x539a1c(_0x4df1fc);})[_0x1407('0x19')](function(_0x378576){logger[_0x1407('0x15')](_0x1407('0x29'),_0x378576[_0x1407('0x18')],_0x242758);_0x2eccaa(_this['error'](0x1f4,_0x378576[_0x1407('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 27fcfc3..6ec6e21 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 _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0x2032,0xd9));var _0x2203=function(_0x159a2a,_0x5af9f1){_0x159a2a=_0x159a2a-0x0;var _0x1bd212=_0x2032[_0x159a2a];return _0x1bd212;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file +var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x3417a0,_0x30c162){var _0x43a7e7=function(_0x39826a){while(--_0x39826a){_0x3417a0['push'](_0x3417a0['shift']());}};_0x43a7e7(++_0x30c162);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index d034ebe..75c5c80 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 _0xb685=['/:id/reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','tracked','sms','post','/:id/status','status','put','update','/:id/accept','accept'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xb685,0x107));var _0x5b68=function(_0x53cb72,_0x458fac){_0x53cb72=_0x53cb72-0x0;var _0x932595=_0xb685[_0x53cb72];return _0x932595;};'use strict';var multer=require(_0x5b68('0x0'));var util=require(_0x5b68('0x1'));var path=require(_0x5b68('0x2'));var timeout=require(_0x5b68('0x3'));var express=require(_0x5b68('0x4'));var router=express[_0x5b68('0x5')]();var fs_extra=require(_0x5b68('0x6'));var auth=require(_0x5b68('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x5b68('0x8')]('/',auth[_0x5b68('0x9')](),controller[_0x5b68('0xa')]);router[_0x5b68('0x8')](_0x5b68('0xb'),auth[_0x5b68('0x9')](),controller[_0x5b68('0xc')]);router[_0x5b68('0x8')](_0x5b68('0xd'),auth[_0x5b68('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0x5b68('0xe')](_0x5b68('0xf'),'smsmessage:create'),controller['create']);router[_0x5b68('0x10')](_0x5b68('0x11'),controller[_0x5b68('0x12')]);router[_0x5b68('0x13')](_0x5b68('0xd'),auth['isAuthenticated'](),controller[_0x5b68('0x14')]);router[_0x5b68('0x13')](_0x5b68('0x15'),auth[_0x5b68('0x9')](),controller[_0x5b68('0x16')]);router[_0x5b68('0x13')](_0x5b68('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0x5b68('0x18')](_0x5b68('0xd'),auth[_0x5b68('0x9')](),controller[_0x5b68('0x19')]);module['exports']=router; \ No newline at end of file +var _0xbcb7=['sms','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','post','tracked'];(function(_0x47a0f9,_0x31f6fe){var _0x16c80b=function(_0x1f0c27){while(--_0x1f0c27){_0x47a0f9['push'](_0x47a0f9['shift']());}};_0x16c80b(++_0x31f6fe);}(_0xbcb7,0xa7));var _0x7bcb=function(_0x47c0c1,_0x2fd98f){_0x47c0c1=_0x47c0c1-0x0;var _0x48e551=_0xbcb7[_0x47c0c1];return _0x48e551;};'use strict';var multer=require('multer');var util=require(_0x7bcb('0x0'));var path=require(_0x7bcb('0x1'));var timeout=require(_0x7bcb('0x2'));var express=require(_0x7bcb('0x3'));var router=express[_0x7bcb('0x4')]();var fs_extra=require(_0x7bcb('0x5'));var auth=require(_0x7bcb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7bcb('0x7'));var controller=require('./smsMessage.controller');router[_0x7bcb('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bcb('0x8')](_0x7bcb('0x9'),auth[_0x7bcb('0xa')](),controller['describe']);router[_0x7bcb('0x8')](_0x7bcb('0xb'),auth[_0x7bcb('0xa')](),controller[_0x7bcb('0xc')]);router[_0x7bcb('0xd')]('/',auth[_0x7bcb('0xa')](),interaction[_0x7bcb('0xe')](_0x7bcb('0xf'),'smsmessage:create'),controller[_0x7bcb('0x10')]);router[_0x7bcb('0xd')](_0x7bcb('0x11'),controller[_0x7bcb('0x12')]);router[_0x7bcb('0x13')](_0x7bcb('0xb'),auth[_0x7bcb('0xa')](),controller[_0x7bcb('0x14')]);router[_0x7bcb('0x13')](_0x7bcb('0x15'),auth['isAuthenticated'](),controller[_0x7bcb('0x16')]);router[_0x7bcb('0x13')](_0x7bcb('0x17'),auth[_0x7bcb('0xa')](),controller[_0x7bcb('0x18')]);router[_0x7bcb('0x19')](_0x7bcb('0xb'),auth[_0x7bcb('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 8cdc03b..b3b0973 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 _0xf4e1=['BOOLEAN','sequelize','exports','TEXT','medium','out','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf4e1,0x17b));var _0x1f4e=function(_0xc1389e,_0xe9d812){_0xc1389e=_0xc1389e-0x0;var _0x16d7d9=_0xf4e1[_0xc1389e];return _0x16d7d9;};'use strict';var Sequelize=require(_0x1f4e('0x0'));module[_0x1f4e('0x1')]={'body':{'type':Sequelize[_0x1f4e('0x2')](_0x1f4e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x1f4e('0x4')),'defaultValue':_0x1f4e('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1f4e('0x5')](0xbe)},'phone':{'type':Sequelize[_0x1f4e('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x1f4e('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1f4e('0x5')]},'providerResponse':{'type':Sequelize[_0x1f4e('0x2')]}}; \ No newline at end of file +var _0x4bf9=['sequelize','exports','BOOLEAN','ENUM','out','STRING','DATE','TEXT'];(function(_0x36a466,_0x3634e0){var _0x28f5f4=function(_0x37c9b7){while(--_0x37c9b7){_0x36a466['push'](_0x36a466['shift']());}};_0x28f5f4(++_0x3634e0);}(_0x4bf9,0x80));var _0x94bf=function(_0x1675ca,_0x3490f3){_0x1675ca=_0x1675ca-0x0;var _0x2baf04=_0x4bf9[_0x1675ca];return _0x2baf04;};'use strict';var Sequelize=require(_0x94bf('0x0'));module[_0x94bf('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x94bf('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x94bf('0x3')]('in',_0x94bf('0x4')),'defaultValue':_0x94bf('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x94bf('0x5')](0xbe)},'phone':{'type':Sequelize[_0x94bf('0x5')]},'readAt':{'type':Sequelize[_0x94bf('0x6')]},'secret':{'type':Sequelize[_0x94bf('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x94bf('0x5')]},'providerResponse':{'type':Sequelize[_0x94bf('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 979337d..88bbadd 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 _0x5e11=['acceptmessage','reject','RejectMessage','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','limit','apply','save','end','stack','name','map','SmsMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','VIRTUAL','filter','merge','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','CmContact','Contact','SmsInteractionId','update','isNil','read1stAt','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','null','AcceptMessage','acceptMessage','manual','interface','format','SIP/%s','channel','event','EventManager'];(function(_0x531ef1,_0x53c97e){var _0x50dd44=function(_0x8c82b4){while(--_0x8c82b4){_0x531ef1['push'](_0x531ef1['shift']());}};_0x50dd44(++_0x53c97e);}(_0x5e11,0x1c3));var _0x15e1=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x5e11[_0x4eafed];return _0x159c85;};'use strict';var pdf=require(_0x15e1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x15e1('0x1'));var zipdir=require(_0x15e1('0x2'));var jsonpatch=require(_0x15e1('0x3'));var rp=require(_0x15e1('0x4'));var moment=require(_0x15e1('0x5'));var BPromise=require(_0x15e1('0x6'));var Mustache=require('mustache');var util=require(_0x15e1('0x7'));var path=require('path');var sox=require(_0x15e1('0x8'));var csv=require(_0x15e1('0x9'));var ejs=require(_0x15e1('0xa'));var fs=require('fs');var fs_extra=require(_0x15e1('0xb'));var _=require(_0x15e1('0xc'));var squel=require('squel');var crypto=require(_0x15e1('0xd'));var jsforce=require(_0x15e1('0xe'));var deskjs=require(_0x15e1('0xf'));var toCsv=require(_0x15e1('0x9'));var querystring=require('querystring');var Papa=require(_0x15e1('0x10'));var Redis=require(_0x15e1('0x11'));var authService=require(_0x15e1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x15e1('0x13'));var hardwareService=require(_0x15e1('0x14'));var logger=require(_0x15e1('0x15'))(_0x15e1('0x16'));var utils=require(_0x15e1('0x17'));var config=require(_0x15e1('0x18'));var licenseUtil=require(_0x15e1('0x19'));var db=require(_0x15e1('0x1a'))['db'];config[_0x15e1('0x1b')]=_[_0x15e1('0x1c')](config[_0x15e1('0x1b')],{'host':_0x15e1('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15e1('0x1b')]));require(_0x15e1('0x1e'))[_0x15e1('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x15e1('0x20')][_0x15e1('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x15e1('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xa1ba90,_0x36f758,_0x448d59,_0x36d214){return new BPromise(function(_0x14cd54,_0x376500){var _0x32008a=_0x36d214||client;return _0x32008a[_0x15e1('0x22')](_0xa1ba90,_0x448d59)[_0x15e1('0x23')](function(_0x440c73){logger[_0x15e1('0x24')](_0x15e1('0x25'),_0x36f758,_0x15e1('0x26'));logger[_0x15e1('0x27')](_0x15e1('0x28'),_0x36f758,'request\x20sent',JSON[_0x15e1('0x29')](_0x440c73));if(_0x440c73[_0x15e1('0x2a')]){if(_0x440c73['error'][_0x15e1('0x2b')]===0x1f4){logger[_0x15e1('0x2a')](_0x15e1('0x25'),_0x36f758,_0x440c73[_0x15e1('0x2a')]['message']);return _0x376500(_0x440c73['error'][_0x15e1('0x2c')]);}logger[_0x15e1('0x2a')](_0x15e1('0x25'),_0x36f758,_0x440c73[_0x15e1('0x2a')][_0x15e1('0x2c')]);return _0x14cd54(_0x440c73[_0x15e1('0x2a')][_0x15e1('0x2c')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x36f758,_0x15e1('0x26'));_0x14cd54(_0x440c73[_0x15e1('0x2d')]['message']);}})['catch'](function(_0x3d0f0f){logger[_0x15e1('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x36f758,_0x3d0f0f);_0x376500(_0x3d0f0f);});});}function respondWithStatusCode(_0x477ff1,_0x1c8538){_0x1c8538=_0x1c8538||0xcc;return function(_0x21d188){if(_0x21d188){return _0x477ff1[_0x15e1('0x2e')](_0x1c8538);}return _0x477ff1[_0x15e1('0x2f')](_0x1c8538)['end']();};}function respondWithResult(_0x506af2,_0x4c14c3){_0x4c14c3=_0x4c14c3||0xc8;return function(_0x30353f){if(_0x30353f){return _0x506af2['status'](_0x4c14c3)[_0x15e1('0x30')](_0x30353f);}};}function respondWithFilteredResult(_0x23664b,_0x201b53){return function(_0x16c14e){if(_0x16c14e){var _0x40f5ef=_0x16c14e[_0x15e1('0x31')],_0x4e1dcf=_0x201b53['offset'],_0x29f2a7=_0x201b53['offset']+_0x201b53[_0x15e1('0x32')],_0x55513b;if(_0x29f2a7>=_0x40f5ef){_0x29f2a7=_0x40f5ef;_0x55513b=0xc8;}else{_0x55513b=0xce;}_0x23664b['status'](_0x55513b);return _0x23664b['set']('Content-Range',_0x4e1dcf+'-'+_0x29f2a7+'/'+_0x40f5ef)[_0x15e1('0x30')](_0x16c14e);}return null;};}function patchUpdates(_0x31aa27){return function(_0x523cc3){try{jsonpatch[_0x15e1('0x33')](_0x523cc3,_0x31aa27,!![]);}catch(_0x37a5f7){return BPromise['reject'](_0x37a5f7);}return _0x523cc3[_0x15e1('0x34')]();};}function saveUpdates(_0x159299,_0x45736d){return function(_0xcfdd11){if(_0xcfdd11){return _0xcfdd11['update'](_0x159299)[_0x15e1('0x23')](function(_0x40a779){return _0x40a779;});}return null;};}function removeEntity(_0x53499b,_0x51a55d){return function(_0x109fb0){if(_0x109fb0){return _0x109fb0['destroy']()['then'](function(){_0x53499b['status'](0xcc)[_0x15e1('0x35')]();});}};}function handleEntityNotFound(_0x13cb61,_0x97f7ff){return function(_0x2bab56){if(!_0x2bab56){_0x13cb61[_0x15e1('0x2e')](0x194);}return _0x2bab56;};}function handleError(_0x348acd,_0x3829c9){_0x3829c9=_0x3829c9||0x1f4;return function(_0x4fc7f5){logger[_0x15e1('0x2a')](_0x4fc7f5[_0x15e1('0x36')]);if(_0x4fc7f5[_0x15e1('0x37')]){delete _0x4fc7f5[_0x15e1('0x37')];}_0x348acd['status'](_0x3829c9)['send'](_0x4fc7f5);};}exports['index']=function(_0x32f4d0,_0x5e583e){var _0x33fb4e={},_0x4c457b={},_0x5b30a2={'count':0x0,'rows':[]};var _0x3a163e=_[_0x15e1('0x38')](db[_0x15e1('0x39')][_0x15e1('0x3a')],function(_0x358bd9){return{'name':_0x358bd9[_0x15e1('0x3b')],'type':_0x358bd9['type'][_0x15e1('0x3c')]};});_0x4c457b[_0x15e1('0x3d')]=_['map'](_0x3a163e,'name');_0x4c457b['query']=_[_0x15e1('0x3e')](_0x32f4d0[_0x15e1('0x3f')]);_0x4c457b[_0x15e1('0x40')]=_[_0x15e1('0x41')](_0x4c457b[_0x15e1('0x3d')],_0x4c457b[_0x15e1('0x3f')]);_0x33fb4e[_0x15e1('0x42')]=_['intersection'](_0x4c457b[_0x15e1('0x3d')],qs[_0x15e1('0x43')](_0x32f4d0[_0x15e1('0x3f')]['fields']));_0x33fb4e[_0x15e1('0x42')]=_0x33fb4e[_0x15e1('0x42')][_0x15e1('0x44')]?_0x33fb4e[_0x15e1('0x42')]:_0x4c457b[_0x15e1('0x3d')];if(!_0x32f4d0[_0x15e1('0x3f')]['hasOwnProperty'](_0x15e1('0x45'))){_0x33fb4e['limit']=qs['limit'](_0x32f4d0[_0x15e1('0x3f')]['limit']);_0x33fb4e[_0x15e1('0x46')]=qs[_0x15e1('0x46')](_0x32f4d0[_0x15e1('0x3f')]['offset']);}_0x33fb4e[_0x15e1('0x47')]=qs[_0x15e1('0x48')](_0x32f4d0[_0x15e1('0x3f')][_0x15e1('0x48')]);_0x33fb4e[_0x15e1('0x49')]=qs[_0x15e1('0x40')](_[_0x15e1('0x4a')](_0x32f4d0['query'],_0x4c457b[_0x15e1('0x40')]),_0x3a163e);if(_0x32f4d0[_0x15e1('0x3f')]['filter']){_0x33fb4e[_0x15e1('0x49')]=_['merge'](_0x33fb4e[_0x15e1('0x49')],{'$or':_[_0x15e1('0x38')](_0x3a163e,function(_0x36c5c4){if(_0x36c5c4['type']!==_0x15e1('0x4b')){var _0x4fe14c={};_0x4fe14c[_0x36c5c4[_0x15e1('0x37')]]={'$like':'%'+_0x32f4d0[_0x15e1('0x3f')][_0x15e1('0x4c')]+'%'};return _0x4fe14c;}})});}_0x33fb4e=_[_0x15e1('0x4d')]({},_0x33fb4e,_0x32f4d0['options']);var _0x2f0600={'where':_0x33fb4e[_0x15e1('0x49')]};return db[_0x15e1('0x39')][_0x15e1('0x31')](_0x2f0600)[_0x15e1('0x23')](function(_0x2bcd04){_0x5b30a2[_0x15e1('0x31')]=_0x2bcd04;if(_0x32f4d0[_0x15e1('0x3f')]['includeAll']){_0x33fb4e['include']=[{'all':!![]}];}return db[_0x15e1('0x39')][_0x15e1('0x4e')](_0x33fb4e);})[_0x15e1('0x23')](function(_0x8e7a1b){_0x5b30a2[_0x15e1('0x4f')]=_0x8e7a1b;return _0x5b30a2;})[_0x15e1('0x23')](respondWithFilteredResult(_0x5e583e,_0x33fb4e))[_0x15e1('0x50')](handleError(_0x5e583e,null));};exports[_0x15e1('0x51')]=function(_0x429a23,_0x2d958d){var _0x69474={'raw':!![],'where':{'id':_0x429a23[_0x15e1('0x52')]['id']}},_0x217062={};_0x217062['model']=_[_0x15e1('0x3e')](db[_0x15e1('0x39')]['rawAttributes']);_0x217062[_0x15e1('0x3f')]=_[_0x15e1('0x3e')](_0x429a23[_0x15e1('0x3f')]);_0x217062[_0x15e1('0x40')]=_['intersection'](_0x217062[_0x15e1('0x3d')],_0x217062[_0x15e1('0x3f')]);_0x69474[_0x15e1('0x42')]=_[_0x15e1('0x41')](_0x217062[_0x15e1('0x3d')],qs['fields'](_0x429a23[_0x15e1('0x3f')]['fields']));_0x69474[_0x15e1('0x42')]=_0x69474[_0x15e1('0x42')][_0x15e1('0x44')]?_0x69474[_0x15e1('0x42')]:_0x217062['model'];if(_0x429a23[_0x15e1('0x3f')]['includeAll']){_0x69474['include']=[{'all':!![]}];}_0x69474=_[_0x15e1('0x4d')]({},_0x69474,_0x429a23[_0x15e1('0x53')]);return db[_0x15e1('0x39')][_0x15e1('0x54')](_0x69474)[_0x15e1('0x23')](handleEntityNotFound(_0x2d958d,null))[_0x15e1('0x23')](respondWithResult(_0x2d958d,null))['catch'](handleError(_0x2d958d,null));};exports[_0x15e1('0x55')]=function(_0x70407d,_0x5cbc70){return db[_0x15e1('0x39')][_0x15e1('0x55')](_0x70407d[_0x15e1('0x56')],{})[_0x15e1('0x23')](respondWithResult(_0x5cbc70,0xc9))[_0x15e1('0x50')](handleError(_0x5cbc70,null));};exports['update']=function(_0x5035b3,_0xf60970){if(_0x5035b3[_0x15e1('0x56')]['id']){delete _0x5035b3[_0x15e1('0x56')]['id'];}return db[_0x15e1('0x39')][_0x15e1('0x54')]({'where':{'id':_0x5035b3[_0x15e1('0x52')]['id']}})[_0x15e1('0x23')](handleEntityNotFound(_0xf60970,null))['then'](saveUpdates(_0x5035b3[_0x15e1('0x56')],null))[_0x15e1('0x23')](respondWithResult(_0xf60970,null))['catch'](handleError(_0xf60970,null));};exports[_0x15e1('0x57')]=function(_0x41747a,_0x4f8605){return db[_0x15e1('0x39')][_0x15e1('0x54')]({'where':{'id':_0x41747a[_0x15e1('0x52')]['id']}})[_0x15e1('0x23')](handleEntityNotFound(_0x4f8605,null))[_0x15e1('0x23')](removeEntity(_0x4f8605,null))['catch'](handleError(_0x4f8605,null));};exports[_0x15e1('0x58')]=function(_0x4bb4ee,_0x2fb635){return db[_0x15e1('0x39')][_0x15e1('0x58')]()['then'](respondWithResult(_0x2fb635,null))[_0x15e1('0x50')](handleError(_0x2fb635,null));};var interaction_log=require(_0x15e1('0x15'))(_0x15e1('0x59'));exports[_0x15e1('0x5a')]=function(_0x31bc5f,_0x332f19,_0x779dd4){var _0x27a881={'agent':{},'channel':_0x15e1('0x5b')};if(_0x31bc5f[_0x15e1('0x56')]['id']){delete _0x31bc5f[_0x15e1('0x56')]['id'];}_0x31bc5f[_0x15e1('0x56')][_0x15e1('0x5c')]=!![];_0x31bc5f[_0x15e1('0x56')][_0x15e1('0x5d')]=moment()['format'](_0x15e1('0x5e'));_0x31bc5f['body'][_0x15e1('0x5f')]=_0x31bc5f[_0x15e1('0x56')][_0x15e1('0x5f')]||_0x31bc5f['user']['id'];_0x27a881[_0x15e1('0x60')]['id']=_0x31bc5f[_0x15e1('0x56')]['UserId'];return db['SmsMessage'][_0x15e1('0x54')]({'where':{'id':_0x31bc5f['params']['id'],'UserId':null},'include':[{'model':db[_0x15e1('0x61')],'as':_0x15e1('0x62')}]})[_0x15e1('0x23')](handleEntityNotFound(_0x332f19,null))['then'](saveUpdates(_0x31bc5f['body'],null))['then'](function(_0x5c3ff3){if(_0x5c3ff3){_0x27a881['message']=_0x5c3ff3['get']({'plain':!![]});return db['SmsInteraction'][_0x15e1('0x54')]({'where':{'id':_0x5c3ff3[_0x15e1('0x63')]}});}return null;})[_0x15e1('0x23')](handleEntityNotFound(_0x332f19,null))[_0x15e1('0x23')](function(_0x544e56){if(_0x544e56){return _0x544e56[_0x15e1('0x64')]({'UserId':_0x31bc5f[_0x15e1('0x56')][_0x15e1('0x5f')],'read1stAt':_[_0x15e1('0x65')](_0x544e56[_0x15e1('0x66')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x15e1('0x23')](function(_0x3bdb2b){if(_0x3bdb2b){_0x27a881['interaction']=_0x3bdb2b[_0x15e1('0x67')]({'plain':!![]});interaction_log[_0x15e1('0x24')](_0x15e1('0x68'),_0x31bc5f[_0x15e1('0x69')]['id'],_0x31bc5f[_0x15e1('0x69')][_0x15e1('0x37')],_0x31bc5f['user']['role'],_0x27a881[_0x15e1('0x6a')]['id'],_0x31bc5f[_0x15e1('0x56')]?JSON[_0x15e1('0x29')](_0x31bc5f[_0x15e1('0x56')]):_0x15e1('0x6b'));return respondWithRpcPromise(_0x15e1('0x6c'),_0x15e1('0x6d'),_0x27a881);}return null;})[_0x15e1('0x23')](function(_0x3b560a){if(_0x3b560a){if(_0x31bc5f[_0x15e1('0x56')][_0x15e1('0x6e')]){_0x27a881[_0x15e1('0x2c')][_0x15e1('0x6f')]=util[_0x15e1('0x70')](_0x15e1('0x71'),_0x31bc5f[_0x15e1('0x69')]['name']);_0x27a881[_0x15e1('0x2c')]['channel']=_0x27a881[_0x15e1('0x72')];_0x27a881[_0x15e1('0x2c')][_0x15e1('0x73')]='accept';return respondWithRpcPromise('EventManager',_0x15e1('0x74'),{'event':_0x15e1('0x75'),'message':_0x27a881[_0x15e1('0x2c')]},client9002)[_0x15e1('0x23')](function(){return _0x27a881;});}return _0x27a881;}return null;})[_0x15e1('0x23')](respondWithResult(_0x332f19,null))['catch'](handleError(_0x332f19,null));};var interaction_log=require(_0x15e1('0x15'))(_0x15e1('0x59'));exports[_0x15e1('0x76')]=function(_0x313e86,_0x29c758,_0x411e6d){var _0x4551bb={'agent':{},'channel':_0x15e1('0x5b')};if(_0x313e86[_0x15e1('0x56')]['id']){delete _0x313e86[_0x15e1('0x56')]['id'];}_0x313e86[_0x15e1('0x56')][_0x15e1('0x5f')]=_0x313e86[_0x15e1('0x56')][_0x15e1('0x5f')]||_0x313e86[_0x15e1('0x69')]['id'];_0x4551bb[_0x15e1('0x60')]['id']=_0x313e86[_0x15e1('0x56')][_0x15e1('0x5f')];return db[_0x15e1('0x39')][_0x15e1('0x54')]({'where':{'id':_0x313e86[_0x15e1('0x52')]['id'],'UserId':null}})[_0x15e1('0x23')](handleEntityNotFound(_0x29c758,null))[_0x15e1('0x23')](function(_0xb83a5e){if(_0xb83a5e){_0x4551bb[_0x15e1('0x2c')]=_0xb83a5e[_0x15e1('0x67')]({'plain':!![]});return db['SmsInteraction'][_0x15e1('0x54')]({'where':{'id':_0xb83a5e[_0x15e1('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x29c758,null))['then'](function(_0x4de1b1){if(_0x4de1b1){_0x4551bb[_0x15e1('0x6a')]=_0x4de1b1[_0x15e1('0x67')]({'plain':!![]});interaction_log[_0x15e1('0x24')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x313e86[_0x15e1('0x69')]['id'],_0x313e86[_0x15e1('0x69')][_0x15e1('0x37')],_0x313e86[_0x15e1('0x69')]['role'],_0x4551bb[_0x15e1('0x6a')]['id'],_0x313e86['body']?JSON[_0x15e1('0x29')](_0x313e86['body']):'null');return respondWithRpcPromise(_0x15e1('0x77'),_0x15e1('0x78'),_0x4551bb);}return null;})[_0x15e1('0x23')](function(_0x1f833d){if(_0x1f833d){_0x1f833d['message'][_0x15e1('0x6f')]=util[_0x15e1('0x70')]('SIP/%s',_0x313e86[_0x15e1('0x69')]['name']);_0x1f833d[_0x15e1('0x2c')][_0x15e1('0x72')]=_0x4551bb[_0x15e1('0x72')];_0x1f833d[_0x15e1('0x2c')][_0x15e1('0x73')]=_0x15e1('0x76');respondWithRpcPromise(_0x15e1('0x74'),_0x15e1('0x74'),{'event':_0x15e1('0x79'),'message':_0x1f833d['message']},client9002);return _0x4551bb;}return null;})[_0x15e1('0x23')](respondWithResult(_0x29c758,null))[_0x15e1('0x50')](handleError(_0x29c758,null));};exports[_0x15e1('0x2f')]=function(_0x169d2c,_0x80b2e1,_0x3fdcdc){if(_0x169d2c[_0x15e1('0x56')]['id']){delete _0x169d2c[_0x15e1('0x56')]['id'];}var _0x4099e7;return db[_0x15e1('0x39')][_0x15e1('0x54')]({'where':{'id':_0x169d2c[_0x15e1('0x52')]['id']}})['then'](handleEntityNotFound(_0x80b2e1,null))[_0x15e1('0x23')](function(_0x1404fc){if(_0x1404fc){_0x4099e7=_0x1404fc;return db[_0x15e1('0x7a')][_0x15e1('0x54')]({'where':{'id':_0x1404fc[_0x15e1('0x7b')]}});}})[_0x15e1('0x23')](handleEntityNotFound(_0x80b2e1,null))[_0x15e1('0x23')](function(_0x56f2e7){if(_0x56f2e7){logger[_0x15e1('0x27')](_0x15e1('0x28'),_0x15e1('0x2f'),_0x15e1('0x7c'),_0x56f2e7[_0x15e1('0x7d')],util[_0x15e1('0x7e')](_0x169d2c[_0x15e1('0x56')],{'showHidden':![],'depth':null}));switch(_0x56f2e7[_0x15e1('0x7d')]){case _0x15e1('0x7f'):if(_0x169d2c[_0x15e1('0x56')]['MessageSid']&&_0x169d2c[_0x15e1('0x56')][_0x15e1('0x80')]===_0x4099e7[_0x15e1('0x81')]){return _0x4099e7[_0x15e1('0x64')]({'read':!![]});}else{logger[_0x15e1('0x2a')](_0x15e1('0x82'),_0x15e1('0x2f'),_0x15e1('0x7f'),util[_0x15e1('0x7e')](_0x169d2c[_0x15e1('0x56')],{'showHidden':![],'depth':null}));}break;case _0x15e1('0x83'):if(_0x169d2c[_0x15e1('0x56')]['MessageUUID']&&_0x169d2c[_0x15e1('0x56')][_0x15e1('0x84')]===_0x4099e7[_0x15e1('0x81')]&&_[_0x15e1('0x85')]([_0x15e1('0x86'),_0x15e1('0x87')],_0x169d2c[_0x15e1('0x56')][_0x15e1('0x88')])>=0x0){return _0x4099e7[_0x15e1('0x64')]({'read':!![]});}else{logger['error'](_0x15e1('0x82'),_0x15e1('0x2f'),_0x15e1('0x89'),util['inspect'](_0x169d2c[_0x15e1('0x56')],{'showHidden':![],'depth':null}));}break;case _0x15e1('0x8a'):var _0x3096a6=_0x169d2c[_0x15e1('0x56')][_0x15e1('0x8b')][0x0];if(_0x3096a6['status'][_0x15e1('0x8c')]===_0x15e1('0x8d')){return _0x4099e7[_0x15e1('0x64')]({'read':!![]});}else{logger[_0x15e1('0x2a')](_0x15e1('0x82'),_0x15e1('0x2f'),_0x15e1('0x8a'),util[_0x15e1('0x7e')](_0x169d2c['body'],{'showHidden':![],'depth':null}));}break;}return _0x4099e7;}})[_0x15e1('0x23')](respondWithResult(_0x80b2e1,null))[_0x15e1('0x50')](handleError(_0x80b2e1,null));}; \ No newline at end of file +var _0xf417=['SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','eml-format','rimraf','zip-dir','request-promise','mustache','ejs','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','sendStatus','status','count','offset','Content-Range','json','apply','save','update','destroy','end','stack','name','send','index','SmsMessage','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','findAll','rows','show','include','create','body','params','find','describe','sms-interactions','accept','sms','read','readAt','format','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','manual','interface','SIP/%s','EventManager','../../config/logger','reject','agent','RejectMessage','channel','event','rejectmessage','SmsAccount'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0xf417,0x8f));var _0x7f41=function(_0x5bc95c,_0xfed759){_0x5bc95c=_0x5bc95c-0x0;var _0x3721fc=_0xf417[_0x5bc95c];return _0x3721fc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7f41('0x0'));var rimraf=require(_0x7f41('0x1'));var zipdir=require(_0x7f41('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f41('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7f41('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7f41('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f41('0x6'));var squel=require(_0x7f41('0x7'));var crypto=require('crypto');var jsforce=require(_0x7f41('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x7f41('0x9'));var querystring=require('querystring');var Papa=require(_0x7f41('0xa'));var Redis=require(_0x7f41('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7f41('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7f41('0xd'));var utils=require(_0x7f41('0xe'));var config=require(_0x7f41('0xf'));var licenseUtil=require(_0x7f41('0x10'));var db=require(_0x7f41('0x11'))['db'];config[_0x7f41('0x12')]=_[_0x7f41('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7f41('0x14'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x7f41('0x15')](socket);var jayson=require(_0x7f41('0x16'));var client=jayson[_0x7f41('0x17')]['http']({'port':0x232c});var client9002=jayson[_0x7f41('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27c0f6,_0x51004d,_0xe76241,_0x54b159){return new BPromise(function(_0x2508a8,_0x1ae462){var _0xdd9671=_0x54b159||client;return _0xdd9671['request'](_0x27c0f6,_0xe76241)[_0x7f41('0x18')](function(_0x26580c){logger['info'](_0x7f41('0x19'),_0x51004d,_0x7f41('0x1a'));logger[_0x7f41('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51004d,_0x7f41('0x1a'),JSON['stringify'](_0x26580c));if(_0x26580c['error']){if(_0x26580c[_0x7f41('0x1c')][_0x7f41('0x1d')]===0x1f4){logger[_0x7f41('0x1c')](_0x7f41('0x19'),_0x51004d,_0x26580c[_0x7f41('0x1c')][_0x7f41('0x1e')]);return _0x1ae462(_0x26580c['error']['message']);}logger[_0x7f41('0x1c')]('SmsMessage,\x20%s,\x20%s',_0x51004d,_0x26580c['error'][_0x7f41('0x1e')]);return _0x2508a8(_0x26580c[_0x7f41('0x1c')][_0x7f41('0x1e')]);}else{logger[_0x7f41('0x1f')](_0x7f41('0x19'),_0x51004d,_0x7f41('0x1a'));_0x2508a8(_0x26580c[_0x7f41('0x20')][_0x7f41('0x1e')]);}})[_0x7f41('0x21')](function(_0x57a302){logger['error']('SmsMessage,\x20%s,\x20%s',_0x51004d,_0x57a302);_0x1ae462(_0x57a302);});});}function respondWithStatusCode(_0x16b410,_0x183ac7){_0x183ac7=_0x183ac7||0xcc;return function(_0x55a32a){if(_0x55a32a){return _0x16b410[_0x7f41('0x22')](_0x183ac7);}return _0x16b410[_0x7f41('0x23')](_0x183ac7)['end']();};}function respondWithResult(_0x4a814e,_0x51a935){_0x51a935=_0x51a935||0xc8;return function(_0x2152e6){if(_0x2152e6){return _0x4a814e['status'](_0x51a935)['json'](_0x2152e6);}};}function respondWithFilteredResult(_0x501076,_0x3889b1){return function(_0x379dbe){if(_0x379dbe){var _0x4fa7e8=_0x379dbe[_0x7f41('0x24')],_0x2b93e4=_0x3889b1[_0x7f41('0x25')],_0x2f288e=_0x3889b1[_0x7f41('0x25')]+_0x3889b1['limit'],_0x48a1a5;if(_0x2f288e>=_0x4fa7e8){_0x2f288e=_0x4fa7e8;_0x48a1a5=0xc8;}else{_0x48a1a5=0xce;}_0x501076['status'](_0x48a1a5);return _0x501076['set'](_0x7f41('0x26'),_0x2b93e4+'-'+_0x2f288e+'/'+_0x4fa7e8)[_0x7f41('0x27')](_0x379dbe);}return null;};}function patchUpdates(_0x26b4d9){return function(_0x42e149){try{jsonpatch[_0x7f41('0x28')](_0x42e149,_0x26b4d9,!![]);}catch(_0x20a921){return BPromise['reject'](_0x20a921);}return _0x42e149[_0x7f41('0x29')]();};}function saveUpdates(_0x156853,_0x212170){return function(_0x483f69){if(_0x483f69){return _0x483f69[_0x7f41('0x2a')](_0x156853)['then'](function(_0xf1f9af){return _0xf1f9af;});}return null;};}function removeEntity(_0x393bba,_0x42fc04){return function(_0x5a03b5){if(_0x5a03b5){return _0x5a03b5[_0x7f41('0x2b')]()[_0x7f41('0x18')](function(){_0x393bba[_0x7f41('0x23')](0xcc)[_0x7f41('0x2c')]();});}};}function handleEntityNotFound(_0x1a1445,_0x354be6){return function(_0x303f1a){if(!_0x303f1a){_0x1a1445[_0x7f41('0x22')](0x194);}return _0x303f1a;};}function handleError(_0x565015,_0xaae809){_0xaae809=_0xaae809||0x1f4;return function(_0x389581){logger[_0x7f41('0x1c')](_0x389581[_0x7f41('0x2d')]);if(_0x389581[_0x7f41('0x2e')]){delete _0x389581[_0x7f41('0x2e')];}_0x565015[_0x7f41('0x23')](_0xaae809)[_0x7f41('0x2f')](_0x389581);};}exports[_0x7f41('0x30')]=function(_0x175a81,_0x12bdd7){var _0x21889f={},_0x544e2c={},_0xd774cf={'count':0x0,'rows':[]};var _0x2bf8c3=_['map'](db[_0x7f41('0x31')]['rawAttributes'],function(_0x38bf16){return{'name':_0x38bf16[_0x7f41('0x32')],'type':_0x38bf16[_0x7f41('0x33')]['key']};});_0x544e2c[_0x7f41('0x34')]=_[_0x7f41('0x35')](_0x2bf8c3,'name');_0x544e2c['query']=_[_0x7f41('0x36')](_0x175a81[_0x7f41('0x37')]);_0x544e2c[_0x7f41('0x38')]=_[_0x7f41('0x39')](_0x544e2c[_0x7f41('0x34')],_0x544e2c[_0x7f41('0x37')]);_0x21889f[_0x7f41('0x3a')]=_[_0x7f41('0x39')](_0x544e2c[_0x7f41('0x34')],qs['fields'](_0x175a81[_0x7f41('0x37')][_0x7f41('0x3b')]));_0x21889f[_0x7f41('0x3a')]=_0x21889f[_0x7f41('0x3a')][_0x7f41('0x3c')]?_0x21889f[_0x7f41('0x3a')]:_0x544e2c['model'];if(!_0x175a81[_0x7f41('0x37')][_0x7f41('0x3d')](_0x7f41('0x3e'))){_0x21889f[_0x7f41('0x3f')]=qs['limit'](_0x175a81['query'][_0x7f41('0x3f')]);_0x21889f[_0x7f41('0x25')]=qs[_0x7f41('0x25')](_0x175a81['query'][_0x7f41('0x25')]);}_0x21889f[_0x7f41('0x40')]=qs['sort'](_0x175a81[_0x7f41('0x37')][_0x7f41('0x41')]);_0x21889f[_0x7f41('0x42')]=qs[_0x7f41('0x38')](_['pick'](_0x175a81[_0x7f41('0x37')],_0x544e2c['filters']),_0x2bf8c3);if(_0x175a81[_0x7f41('0x37')][_0x7f41('0x43')]){_0x21889f[_0x7f41('0x42')]=_[_0x7f41('0x44')](_0x21889f['where'],{'$or':_[_0x7f41('0x35')](_0x2bf8c3,function(_0xec91a){if(_0xec91a[_0x7f41('0x33')]!=='VIRTUAL'){var _0x37b7={};_0x37b7[_0xec91a['name']]={'$like':'%'+_0x175a81['query'][_0x7f41('0x43')]+'%'};return _0x37b7;}})});}_0x21889f=_[_0x7f41('0x44')]({},_0x21889f,_0x175a81[_0x7f41('0x45')]);var _0xdb06d={'where':_0x21889f[_0x7f41('0x42')]};return db[_0x7f41('0x31')][_0x7f41('0x24')](_0xdb06d)[_0x7f41('0x18')](function(_0x1b080e){_0xd774cf[_0x7f41('0x24')]=_0x1b080e;if(_0x175a81[_0x7f41('0x37')][_0x7f41('0x46')]){_0x21889f['include']=[{'all':!![]}];}return db[_0x7f41('0x31')][_0x7f41('0x47')](_0x21889f);})[_0x7f41('0x18')](function(_0x45bf47){_0xd774cf[_0x7f41('0x48')]=_0x45bf47;return _0xd774cf;})[_0x7f41('0x18')](respondWithFilteredResult(_0x12bdd7,_0x21889f))[_0x7f41('0x21')](handleError(_0x12bdd7,null));};exports[_0x7f41('0x49')]=function(_0x250a36,_0x547943){var _0x11bece={'raw':!![],'where':{'id':_0x250a36['params']['id']}},_0x5e6b1f={};_0x5e6b1f[_0x7f41('0x34')]=_[_0x7f41('0x36')](db[_0x7f41('0x31')]['rawAttributes']);_0x5e6b1f[_0x7f41('0x37')]=_[_0x7f41('0x36')](_0x250a36[_0x7f41('0x37')]);_0x5e6b1f[_0x7f41('0x38')]=_['intersection'](_0x5e6b1f[_0x7f41('0x34')],_0x5e6b1f['query']);_0x11bece[_0x7f41('0x3a')]=_[_0x7f41('0x39')](_0x5e6b1f['model'],qs[_0x7f41('0x3b')](_0x250a36[_0x7f41('0x37')][_0x7f41('0x3b')]));_0x11bece[_0x7f41('0x3a')]=_0x11bece['attributes']['length']?_0x11bece[_0x7f41('0x3a')]:_0x5e6b1f[_0x7f41('0x34')];if(_0x250a36['query'][_0x7f41('0x46')]){_0x11bece[_0x7f41('0x4a')]=[{'all':!![]}];}_0x11bece=_['merge']({},_0x11bece,_0x250a36[_0x7f41('0x45')]);return db[_0x7f41('0x31')]['find'](_0x11bece)['then'](handleEntityNotFound(_0x547943,null))['then'](respondWithResult(_0x547943,null))['catch'](handleError(_0x547943,null));};exports[_0x7f41('0x4b')]=function(_0xebd97,_0x491534){return db[_0x7f41('0x31')][_0x7f41('0x4b')](_0xebd97[_0x7f41('0x4c')],{})[_0x7f41('0x18')](respondWithResult(_0x491534,0xc9))[_0x7f41('0x21')](handleError(_0x491534,null));};exports['update']=function(_0xa6c634,_0x10f968){if(_0xa6c634[_0x7f41('0x4c')]['id']){delete _0xa6c634[_0x7f41('0x4c')]['id'];}return db[_0x7f41('0x31')]['find']({'where':{'id':_0xa6c634[_0x7f41('0x4d')]['id']}})[_0x7f41('0x18')](handleEntityNotFound(_0x10f968,null))['then'](saveUpdates(_0xa6c634['body'],null))[_0x7f41('0x18')](respondWithResult(_0x10f968,null))['catch'](handleError(_0x10f968,null));};exports[_0x7f41('0x2b')]=function(_0x2f62c9,_0x22e924){return db[_0x7f41('0x31')][_0x7f41('0x4e')]({'where':{'id':_0x2f62c9['params']['id']}})['then'](handleEntityNotFound(_0x22e924,null))[_0x7f41('0x18')](removeEntity(_0x22e924,null))[_0x7f41('0x21')](handleError(_0x22e924,null));};exports[_0x7f41('0x4f')]=function(_0x10e0ce,_0x8cb868){return db[_0x7f41('0x31')]['describe']()[_0x7f41('0x18')](respondWithResult(_0x8cb868,null))[_0x7f41('0x21')](handleError(_0x8cb868,null));};var interaction_log=require('../../config/logger')(_0x7f41('0x50'));exports[_0x7f41('0x51')]=function(_0xea76ae,_0x3f3e80,_0x5cffaa){var _0x1e43c1={'agent':{},'channel':_0x7f41('0x52')};if(_0xea76ae['body']['id']){delete _0xea76ae['body']['id'];}_0xea76ae['body'][_0x7f41('0x53')]=!![];_0xea76ae['body'][_0x7f41('0x54')]=moment()[_0x7f41('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0xea76ae[_0x7f41('0x4c')]['UserId']=_0xea76ae['body'][_0x7f41('0x56')]||_0xea76ae[_0x7f41('0x57')]['id'];_0x1e43c1['agent']['id']=_0xea76ae[_0x7f41('0x4c')][_0x7f41('0x56')];return db[_0x7f41('0x31')]['find']({'where':{'id':_0xea76ae[_0x7f41('0x4d')]['id'],'UserId':null},'include':[{'model':db[_0x7f41('0x58')],'as':_0x7f41('0x59')}]})[_0x7f41('0x18')](handleEntityNotFound(_0x3f3e80,null))[_0x7f41('0x18')](saveUpdates(_0xea76ae[_0x7f41('0x4c')],null))[_0x7f41('0x18')](function(_0x2d7010){if(_0x2d7010){_0x1e43c1[_0x7f41('0x1e')]=_0x2d7010[_0x7f41('0x5a')]({'plain':!![]});return db[_0x7f41('0x5b')][_0x7f41('0x4e')]({'where':{'id':_0x2d7010[_0x7f41('0x5c')]}});}return null;})[_0x7f41('0x18')](handleEntityNotFound(_0x3f3e80,null))[_0x7f41('0x18')](function(_0x6100d6){if(_0x6100d6){return _0x6100d6[_0x7f41('0x2a')]({'UserId':_0xea76ae[_0x7f41('0x4c')]['UserId'],'read1stAt':_[_0x7f41('0x5d')](_0x6100d6['read1stAt'])?moment()['format'](_0x7f41('0x5e')):undefined});}return null;})[_0x7f41('0x18')](function(_0x4c4059){if(_0x4c4059){_0x1e43c1[_0x7f41('0x5f')]=_0x4c4059[_0x7f41('0x5a')]({'plain':!![]});interaction_log[_0x7f41('0x1f')](_0x7f41('0x60'),_0xea76ae['user']['id'],_0xea76ae[_0x7f41('0x57')]['name'],_0xea76ae['user'][_0x7f41('0x61')],_0x1e43c1[_0x7f41('0x5f')]['id'],_0xea76ae[_0x7f41('0x4c')]?JSON[_0x7f41('0x62')](_0xea76ae[_0x7f41('0x4c')]):_0x7f41('0x63'));return respondWithRpcPromise(_0x7f41('0x64'),'acceptMessage',_0x1e43c1);}return null;})['then'](function(_0x2ecbeb){if(_0x2ecbeb){if(_0xea76ae[_0x7f41('0x4c')][_0x7f41('0x65')]){_0x1e43c1[_0x7f41('0x1e')][_0x7f41('0x66')]=util[_0x7f41('0x55')](_0x7f41('0x67'),_0xea76ae[_0x7f41('0x57')][_0x7f41('0x2e')]);_0x1e43c1[_0x7f41('0x1e')]['channel']=_0x1e43c1['channel'];_0x1e43c1[_0x7f41('0x1e')]['event']=_0x7f41('0x51');return respondWithRpcPromise(_0x7f41('0x68'),_0x7f41('0x68'),{'event':'acceptmessage','message':_0x1e43c1[_0x7f41('0x1e')]},client9002)['then'](function(){return _0x1e43c1;});}return _0x1e43c1;}return null;})[_0x7f41('0x18')](respondWithResult(_0x3f3e80,null))['catch'](handleError(_0x3f3e80,null));};var interaction_log=require(_0x7f41('0x69'))(_0x7f41('0x50'));exports[_0x7f41('0x6a')]=function(_0x12a26f,_0x174108,_0x4d834c){var _0x3bf170={'agent':{},'channel':'sms'};if(_0x12a26f[_0x7f41('0x4c')]['id']){delete _0x12a26f[_0x7f41('0x4c')]['id'];}_0x12a26f[_0x7f41('0x4c')][_0x7f41('0x56')]=_0x12a26f[_0x7f41('0x4c')][_0x7f41('0x56')]||_0x12a26f[_0x7f41('0x57')]['id'];_0x3bf170[_0x7f41('0x6b')]['id']=_0x12a26f[_0x7f41('0x4c')][_0x7f41('0x56')];return db[_0x7f41('0x31')]['find']({'where':{'id':_0x12a26f[_0x7f41('0x4d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x174108,null))[_0x7f41('0x18')](function(_0x3015b9){if(_0x3015b9){_0x3bf170['message']=_0x3015b9[_0x7f41('0x5a')]({'plain':!![]});return db[_0x7f41('0x5b')]['find']({'where':{'id':_0x3015b9[_0x7f41('0x5c')]}});}return null;})[_0x7f41('0x18')](handleEntityNotFound(_0x174108,null))[_0x7f41('0x18')](function(_0x5c9891){if(_0x5c9891){_0x3bf170[_0x7f41('0x5f')]=_0x5c9891[_0x7f41('0x5a')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x12a26f[_0x7f41('0x57')]['id'],_0x12a26f[_0x7f41('0x57')]['name'],_0x12a26f[_0x7f41('0x57')][_0x7f41('0x61')],_0x3bf170['interaction']['id'],_0x12a26f['body']?JSON[_0x7f41('0x62')](_0x12a26f[_0x7f41('0x4c')]):'null');return respondWithRpcPromise(_0x7f41('0x6c'),'rejectMessage',_0x3bf170);}return null;})[_0x7f41('0x18')](function(_0x21f930){if(_0x21f930){_0x21f930[_0x7f41('0x1e')][_0x7f41('0x66')]=util[_0x7f41('0x55')]('SIP/%s',_0x12a26f[_0x7f41('0x57')][_0x7f41('0x2e')]);_0x21f930[_0x7f41('0x1e')][_0x7f41('0x6d')]=_0x3bf170[_0x7f41('0x6d')];_0x21f930[_0x7f41('0x1e')][_0x7f41('0x6e')]=_0x7f41('0x6a');respondWithRpcPromise('EventManager',_0x7f41('0x68'),{'event':_0x7f41('0x6f'),'message':_0x21f930[_0x7f41('0x1e')]},client9002);return _0x3bf170;}return null;})[_0x7f41('0x18')](respondWithResult(_0x174108,null))['catch'](handleError(_0x174108,null));};exports[_0x7f41('0x23')]=function(_0x4e7c12,_0x267100,_0x14fbca){if(_0x4e7c12[_0x7f41('0x4c')]['id']){delete _0x4e7c12[_0x7f41('0x4c')]['id'];}var _0x5e212f;return db[_0x7f41('0x31')]['find']({'where':{'id':_0x4e7c12[_0x7f41('0x4d')]['id']}})[_0x7f41('0x18')](handleEntityNotFound(_0x267100,null))[_0x7f41('0x18')](function(_0x25567c){if(_0x25567c){_0x5e212f=_0x25567c;return db[_0x7f41('0x70')][_0x7f41('0x4e')]({'where':{'id':_0x25567c['SmsAccountId']}});}})[_0x7f41('0x18')](handleEntityNotFound(_0x267100,null))[_0x7f41('0x18')](function(_0x331776){if(_0x331776){logger['debug'](_0x7f41('0x71'),'status','received\x20delivery\x20report\x20from',_0x331776[_0x7f41('0x33')],util[_0x7f41('0x72')](_0x4e7c12[_0x7f41('0x4c')],{'showHidden':![],'depth':null}));switch(_0x331776[_0x7f41('0x33')]){case _0x7f41('0x73'):if(_0x4e7c12['body'][_0x7f41('0x74')]&&_0x4e7c12[_0x7f41('0x4c')][_0x7f41('0x74')]===_0x5e212f['messageId']){return _0x5e212f[_0x7f41('0x2a')]({'read':!![]});}else{logger[_0x7f41('0x1c')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7f41('0x23'),_0x7f41('0x73'),util[_0x7f41('0x72')](_0x4e7c12[_0x7f41('0x4c')],{'showHidden':![],'depth':null}));}break;case _0x7f41('0x75'):if(_0x4e7c12['body'][_0x7f41('0x76')]&&_0x4e7c12[_0x7f41('0x4c')]['MessageUUID']===_0x5e212f[_0x7f41('0x77')]&&_[_0x7f41('0x78')]([_0x7f41('0x79'),_0x7f41('0x7a')],_0x4e7c12[_0x7f41('0x4c')][_0x7f41('0x7b')])>=0x0){return _0x5e212f[_0x7f41('0x2a')]({'read':!![]});}else{logger[_0x7f41('0x1c')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x7f41('0x7c'),util['inspect'](_0x4e7c12[_0x7f41('0x4c')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x560188=_0x4e7c12['body']['results'][0x0];if(_0x560188[_0x7f41('0x23')]['groupName']===_0x7f41('0x7d')){return _0x5e212f[_0x7f41('0x2a')]({'read':!![]});}else{logger['error'](_0x7f41('0x7e'),_0x7f41('0x23'),_0x7f41('0x7f'),util['inspect'](_0x4e7c12[_0x7f41('0x4c')],{'showHidden':![],'depth':null}));}break;}return _0x5e212f;}})[_0x7f41('0x18')](respondWithResult(_0x267100,null))[_0x7f41('0x21')](handleError(_0x267100,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 5c89cec..bfff85a 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 _0xe660=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x5dd6ef,_0x5054d9){var _0x33daab=function(_0x5bdfc7){while(--_0x5bdfc7){_0x5dd6ef['push'](_0x5dd6ef['shift']());}};_0x33daab(++_0x5054d9);}(_0xe660,0xb7));var _0x0e66=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0xe660[_0x17c8cc];return _0x3db4eb;};'use strict';var EventEmitter=require(_0x0e66('0x0'));var SmsMessage=require(_0x0e66('0x1'))['db'][_0x0e66('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0e66('0x3')](0x0);var events={'afterCreate':_0x0e66('0x4'),'afterUpdate':_0x0e66('0x5'),'afterDestroy':_0x0e66('0x6')};function emitEvent(_0x2357a6){return function(_0x2ddf7c,_0x2b7ab5,_0x2b8a0f){SmsMessageEvents['emit'](_0x2357a6+':'+_0x2ddf7c['id'],_0x2ddf7c);SmsMessageEvents[_0x0e66('0x7')](_0x2357a6,_0x2ddf7c);_0x2b8a0f(null);};}for(var e in events){if(events[_0x0e66('0x8')](e)){var event=events[e];SmsMessage[_0x0e66('0x9')](e,emitEvent(event));}}module[_0x0e66('0xa')]=SmsMessageEvents; \ No newline at end of file +var _0xb36d=['SmsMessage','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x248482,_0x4d086b){var _0x13b2c1=function(_0x23b9fb){while(--_0x23b9fb){_0x248482['push'](_0x248482['shift']());}};_0x13b2c1(++_0x4d086b);}(_0xb36d,0xd8));var _0xdb36=function(_0x16b8be,_0x22851e){_0x16b8be=_0x16b8be-0x0;var _0x29a6a3=_0xb36d[_0x16b8be];return _0x29a6a3;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xdb36('0x0'))['db'][_0xdb36('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xdb36('0x2'),'afterDestroy':_0xdb36('0x3')};function emitEvent(_0x28d5ea){return function(_0x5b32e7,_0x193453,_0x33ee66){SmsMessageEvents[_0xdb36('0x4')](_0x28d5ea+':'+_0x5b32e7['id'],_0x5b32e7);SmsMessageEvents[_0xdb36('0x4')](_0x28d5ea,_0x5b32e7);_0x33ee66(null);};}for(var e in events){if(events[_0xdb36('0x5')](e)){var event=events[e];SmsMessage[_0xdb36('0x6')](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 7d11372..464ef8d 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 _0x21ed=['direction','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','update','createdAt','catch','error','SmsAccount','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','body','smsMethod','sender','login?username=','&password=','password','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','http_code','data','head','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','base64','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','keys','length','createHash','digest','hex','signature=','GET','/external/get/send.php?','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','clickatell','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','toLowerCase'];(function(_0x4fc695,_0x4d6695){var _0x21f109=function(_0x451c4f){while(--_0x451c4f){_0x4fc695['push'](_0x4fc695['shift']());}};_0x21f109(++_0x4d6695);}(_0x21ed,0xe6));var _0xd21e=function(_0x533d45,_0x4c2fe5){_0x533d45=_0x533d45-0x0;var _0x8ce794=_0x21ed[_0x533d45];return _0x8ce794;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd21e('0x0'))('api');var moment=require('moment');var BPromise=require(_0xd21e('0x1'));var rp=require(_0xd21e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd21e('0x3'));var config=require(_0xd21e('0x4'));var attributes=require(_0xd21e('0x5'));module['exports']=function(_0x284b2f,_0x504261){return _0x284b2f[_0xd21e('0x6')](_0xd21e('0x7'),attributes,{'tableName':_0xd21e('0x8'),'paranoid':![],'indexes':[{'name':_0xd21e('0x9'),'fields':[_0xd21e('0x9')]},{'name':_0xd21e('0xa'),'fields':['body'],'type':_0xd21e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5be567,_0x4dbbe5,_0x168ebd){var _0x94798b=_0x284b2f[_0xd21e('0xc')];var _0x280e02=_0x5be567['get']({'plain':!![]});if(_0x280e02['direction'][_0xd21e('0xd')]()==='in'||_0x280e02[_0xd21e('0xe')][_0xd21e('0xd')]()===_0xd21e('0xf')&&!_0x280e02[_0xd21e('0x10')]&&!_[_0xd21e('0x11')](_0x280e02[_0xd21e('0x12')])){_0x94798b[_0xd21e('0x13')][_0xd21e('0x14')]({'where':{'id':_0x280e02[_0xd21e('0x15')]}})['then'](function(_0x5a1710){if(_0x5a1710){_0x5a1710[_0xd21e('0x16')]({'lastMsgAt':_0x280e02[_0xd21e('0x17')],'lastMsgDirection':_0x280e02[_0xd21e('0xe')]['toLowerCase']()});}})[_0xd21e('0x18')](function(_0x3bca27){console[_0xd21e('0x19')](_0x3bca27);});}if(_0x280e02[_0xd21e('0xe')]===_0xd21e('0xf')&&!_0x280e02['secret']){var _0x122700;_0x94798b[_0xd21e('0x1a')]['find']({'where':{'id':_0x280e02[_0xd21e('0x1b')]},'raw':!![]})[_0xd21e('0x1c')](function(_0x180397){_0x122700=_0x180397;if(_0x122700&&_0x122700['type']){switch(_0x122700[_0xd21e('0x1d')]){case'twilio':var _0x5f014a=require(_0xd21e('0x1e'));if(_0x122700[_0xd21e('0x1f')]&&_0x122700[_0xd21e('0x20')]&&_0x122700[_0xd21e('0x21')]){var _0x4e0ebf=new _0x5f014a(_0x122700[_0xd21e('0x1f')],_0x122700[_0xd21e('0x20')]);_0x4e0ebf[_0xd21e('0x22')]['create']({'body':_0x280e02['body'],'to':_0x280e02[_0xd21e('0x21')],'from':_0x122700[_0xd21e('0x21')],'statusCallback':_0x122700[_0xd21e('0x23')]+_0xd21e('0x24')+_0x280e02['id']+_0xd21e('0x25')+_0x122700[_0xd21e('0x26')]})['then'](function(_0x2bc5ba){if(_0x2bc5ba[_0xd21e('0x27')]){return _0x5be567[_0xd21e('0x16')]({'messageId':_0x2bc5ba[_0xd21e('0x27')]});}})[_0xd21e('0x18')](function(_0x3f6ec6){logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),'twilio',util[_0xd21e('0x2a')](_0x3f6ec6,{'showHidden':![],'depth':null}));});}else{logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x1e'),_0xd21e('0x2b'));}break;case'skebby':var _0x7fc041=_0xd21e('0x2c');if(_0x122700[_0xd21e('0x2d')]&&_0x122700['password']){var _0x1720ad={'recipient':[_0x280e02[_0xd21e('0x21')]],'message':_0x280e02[_0xd21e('0x2e')],'message_type':_0x122700[_0xd21e('0x2f')]};if(_0x122700[_0xd21e('0x2f')]&&_0x122700['smsMethod']!=='SI'){_0x1720ad[_0xd21e('0x30')]=_0x122700[_0xd21e('0x21')];}var _0x3de19d={'url':_0x7fc041+_0xd21e('0x31')+_0x122700[_0xd21e('0x2d')]+_0xd21e('0x32')+_0x122700[_0xd21e('0x33')],'method':'GET'};rp(_0x3de19d)['then'](function(_0x1b218a){var _0x1802ee=_0x1b218a[_0xd21e('0x34')](';');var _0x5d798e={'user_key':_0x1802ee[0x0],'session_key':_0x1802ee[0x1]};_0x3de19d={'url':_0x7fc041+'sms','method':_0xd21e('0x35'),'headers':{'user_key':_0x5d798e[_0xd21e('0x36')],'Session_key':_0x5d798e[_0xd21e('0x37')]},'json':!![],'body':_0x1720ad};return rp(_0x3de19d);})[_0xd21e('0x1c')](function(_0x2d8342){if(_0x2d8342[_0xd21e('0x38')]>=0x1){var _0x10e450={'messageId':_0x2d8342[_0xd21e('0x39')]};if(_0x122700['smsMethod']!=='GP'||!_0x122700[_0xd21e('0x3a')]){_0x10e450[_0xd21e('0x3b')]=!![];}return _0x5be567[_0xd21e('0x16')](_0x10e450);}else{return logger['error'](_0xd21e('0x28'),_0xd21e('0x29'),'skebby',util[_0xd21e('0x2a')](_0x2d8342,{'showHidden':![],'depth':null}));}})[_0xd21e('0x18')](function(_0x59225e){return logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),'skebby',util[_0xd21e('0x2a')](_0x59225e,{'showHidden':![],'depth':null}));});}else{logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x3c'),_0xd21e('0x3d'));}break;case _0xd21e('0x3e'):if(_0x122700[_0xd21e('0x20')]){var _0x30f6e3={'recipient':_0x280e02[_0xd21e('0x21')],'message':_0x280e02[_0xd21e('0x2e')],'sender':_0x122700[_0xd21e('0x3f')]||_0x122700[_0xd21e('0x21')],'authorization':_0x122700[_0xd21e('0x20')]};var _0x4dbbe5={'method':'POST','uri':_0xd21e('0x40'),'body':_0x30f6e3,'json':!![]};rp(_0x4dbbe5)[_0xd21e('0x1c')](function(_0x309a84){var _0x401e90={'messageId':_0x309a84[_0xd21e('0x41')]};if(!_0x122700['deliveryReport']){_0x401e90[_0xd21e('0x3b')]=!![];}return _0x5be567['update'](_0x401e90);})[_0xd21e('0x18')](function(_0x21e300){logger[_0xd21e('0x19')](_0xd21e('0x28'),'afterCreate',_0xd21e('0x3e'),util['inspect'](_0x21e300,{'showHidden':![],'depth':null}));});}else{logger[_0xd21e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd21e('0x29'),_0xd21e('0x3e'),'Missing\x20parameters:\x20authToken');}break;case _0xd21e('0x42'):if(_0x122700[_0xd21e('0x2d')]&&_0x122700[_0xd21e('0x33')]){var _0x30f6e3={'messages':[{'source':_0xd21e('0x43'),'to':_0x280e02[_0xd21e('0x21')],'body':_0x280e02[_0xd21e('0x2e')],'from':_0x122700[_0xd21e('0x3f')]||_0x122700[_0xd21e('0x21')]}]};var _0x26eeb8=util[_0xd21e('0x44')]('%s:%s',_0x122700[_0xd21e('0x2d')],_0x122700[_0xd21e('0x33')]);var _0x4dbbe5={'method':'POST','uri':_0xd21e('0x45'),'body':_0x30f6e3,'headers':{'Authorization':util['format'](_0xd21e('0x46'),new Buffer(_0x26eeb8)['toString']('base64'))},'json':!![]};rp(_0x4dbbe5)[_0xd21e('0x1c')](function(_0x1b57ae){if(_0x1b57ae['http_code']>=0xc8&&_0x1b57ae[_0xd21e('0x47')]<=0xce){if(_0x1b57ae[_0xd21e('0x48')]&&_0x1b57ae[_0xd21e('0x48')]['queued_count']>0x0){var _0x527311=_[_0xd21e('0x49')](_0x1b57ae[_0xd21e('0x48')][_0xd21e('0x22')]);var _0x1076b7={'messageId':_0x527311[_0xd21e('0x4a')]};if(!_0x122700[_0xd21e('0x3a')]){_0x1076b7[_0xd21e('0x3b')]=!![];}return _0x5be567[_0xd21e('0x16')](_0x1076b7);}else{logger[_0xd21e('0x19')](_0xd21e('0x28'),'afterCreate',_0xd21e('0x4b'),util[_0xd21e('0x2a')](_0x1b57ae,{'showHidden':![],'depth':null}));}}else{logger[_0xd21e('0x19')](_0xd21e('0x28'),'afterCreate',_0xd21e('0x4b'),util['inspect'](_0x1b57ae,{'showHidden':![],'depth':null}));}})[_0xd21e('0x18')](function(_0x2575d5){logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x4b'),util[_0xd21e('0x2a')](_0x2575d5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd21e('0x28'),_0xd21e('0x29'),'clickSend',_0xd21e('0x3d'));}break;case'plivo':if(_0x122700[_0xd21e('0x4c')]&&_0x122700[_0xd21e('0x20')]){var _0x30f6e3={'dst':_0x280e02[_0xd21e('0x21')],'text':_0x280e02['body'],'src':_0x122700[_0xd21e('0x3f')]||_0x122700[_0xd21e('0x21')],'url':_0x122700['remote']+_0xd21e('0x24')+_0x280e02['id']+'/status?token='+_0x122700[_0xd21e('0x26')]};var _0x26eeb8=util['format']('%s:%s',_0x122700['authId'],_0x122700['authToken']);var _0x4dbbe5={'method':_0xd21e('0x35'),'uri':util['format'](_0xd21e('0x4d'),_0x122700[_0xd21e('0x4c')]),'body':_0x30f6e3,'headers':{'Authorization':util[_0xd21e('0x44')](_0xd21e('0x46'),new Buffer(_0x26eeb8)[_0xd21e('0x4e')](_0xd21e('0x4f')))},'json':!![]};rp(_0x4dbbe5)[_0xd21e('0x1c')](function(_0x52fdd4){var _0xd42b1e={'messageId':_0x52fdd4['message_uuid'][0x0]};return _0x5be567[_0xd21e('0x16')](_0xd42b1e);})[_0xd21e('0x18')](function(_0x2bd73e){logger['error'](_0xd21e('0x28'),_0xd21e('0x29'),'plivo',util[_0xd21e('0x2a')](_0x2bd73e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x50'),_0xd21e('0x51'));}break;case _0xd21e('0x52'):if(_0x122700[_0xd21e('0x2d')]&&_0x122700[_0xd21e('0x33')]){if(_0x122700['baseUrl']){var _0x1b3bd8={'method':_0xd21e('0x35'),'uri':_0x122700[_0xd21e('0x53')]+_0xd21e('0x54'),'body':{'username':_0x122700[_0xd21e('0x2d')],'password':_0x122700[_0xd21e('0x33')]},'json':!![]};return rp(_0x1b3bd8)[_0xd21e('0x1c')](function(_0x2c573d){var _0x1912ab={'method':_0xd21e('0x35'),'uri':_0x122700['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x122700[_0xd21e('0x21')],'destinations':[{'to':_0x280e02['phone']}],'text':_0x280e02[_0xd21e('0x2e')],'notifyUrl':_0x122700[_0xd21e('0x23')]+_0xd21e('0x24')+_0x280e02['id']+_0xd21e('0x25')+_0x122700[_0xd21e('0x26')],'notifyContentType':'application/json','callbackData':_0x122700[_0xd21e('0x21')]+';'+_0x280e02[_0xd21e('0x2e')]}]},'headers':{'Authorization':_0xd21e('0x55')+_0x2c573d[_0xd21e('0x26')]},'json':!![]};return rp(_0x1912ab)[_0xd21e('0x1c')](function(_0x43a433){if(_0x43a433[_0xd21e('0x22')]){var _0x3068e7={'messageId':_0x43a433[_0xd21e('0x22')][0x0][_0xd21e('0x9')]};if(!_0x122700['deliveryReport']){_0x3068e7[_0xd21e('0x3b')]=!![];}return _0x5be567['update'](_0x3068e7);}else{return logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x52'),util[_0xd21e('0x2a')](_0x43a433,{'showHidden':![],'depth':null}));}});})[_0xd21e('0x18')](function(_0xed26c6){return logger['error'](_0xd21e('0x28'),'afterCreate',_0xd21e('0x52'),util[_0xd21e('0x2a')](_0xed26c6,{'showHidden':![],'depth':null}));});}else{logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),'infobip',_0xd21e('0x56'));}}else{logger[_0xd21e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd21e('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xd21e('0x57'):var _0x1fa606=require('crypto');if(_0x122700[_0xd21e('0x58')]){var _0xb3b423={};_0xb3b423[_0xd21e('0x59')]=_0x122700[_0xd21e('0x2d')];_0xb3b423[_0xd21e('0x21')]=_0x280e02[_0xd21e('0x21')];_0xb3b423[_0xd21e('0x30')]=_0x122700['phone'];_0xb3b423[_0xd21e('0x5a')]=_0x280e02[_0xd21e('0x2e')];_0xb3b423[_0xd21e('0x5b')]=+new Date();var _0x4c12a2='';var _0x30b027='';var _0x1610e5=Object[_0xd21e('0x5c')](_0xb3b423);_0x1610e5['sort']();for(var _0x264ce2=0x0;_0x264ce2<_0x1610e5[_0xd21e('0x5d')];_0x264ce2++){if(_0x4c12a2!=''){_0x4c12a2+='&';}_0x4c12a2+=_0x1610e5[_0x264ce2]+'='+encodeURIComponent(_0xb3b423[_0x1610e5[_0x264ce2]]);_0x30b027+=_0xb3b423[_0x1610e5[_0x264ce2]];}_0x30b027+=_0x122700[_0xd21e('0x58')];_0x30b027=_0x1fa606[_0xd21e('0x5e')]('md5')['update'](_0x30b027)[_0xd21e('0x5f')](_0xd21e('0x60'));if(_0x4c12a2!==''){_0x4c12a2+='&';}_0x4c12a2+=_0xd21e('0x61')+_0x30b027;var _0x3de19d={'method':_0xd21e('0x62'),'uri':_0x122700[_0xd21e('0x53')]+_0xd21e('0x63')+_0x4c12a2,'json':!![]};return rp(_0x3de19d)[_0xd21e('0x1c')](function(_0x314384){var _0x4f6206=Object[_0xd21e('0x5c')](_0x314384);if(_0x314384[_0x4f6206[0x0]][_0xd21e('0x19')]&&parseInt(_0x314384[_0x4f6206[0x0]]['error'])===0x0){var _0x1661fb={'messageId':_0x314384[_0x4f6206[0x0]]['id_sms']};if(!_0x122700['deliveryReport']){_0x1661fb[_0xd21e('0x3b')]=!![];}return _0x5be567[_0xd21e('0x16')](_0x1661fb);}else{return logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x57'),util['inspect'](_0x314384[_0xd21e('0x19')],{'showHidden':![],'depth':null}));}})[_0xd21e('0x18')](function(_0x3fc12b){return logger[_0xd21e('0x19')](_0xd21e('0x28'),'afterCreate',_0xd21e('0x57'),util['inspect'](_0x3fc12b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x57'),_0xd21e('0x64'));}break;case'clickatell':if(_0x122700[_0xd21e('0x58')]){var _0x2492dd={'method':_0xd21e('0x35'),'uri':_0xd21e('0x65'),'headers':{'Authorization':_0x122700[_0xd21e('0x58')]},'body':{'content':_0x280e02[_0xd21e('0x2e')],'to':[_0x280e02[_0xd21e('0x21')]],'from':_0x122700[_0xd21e('0x21')],'binary':![],'clientMessageId':_0xd21e('0x66'),'charset':_0xd21e('0x67')},'json':!![]};rp(_0x2492dd)[_0xd21e('0x1c')](function(_0x109e13){if(!_0x109e13[_0xd21e('0x19')]){var _0x1826da={'messageId':_0x109e13['messages'][0x0]['apiMessageId']};if(!_0x122700['deliveryReport']){_0x1826da[_0xd21e('0x3b')]=!![];}return _0x5be567[_0xd21e('0x16')](_0x1826da);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util[_0xd21e('0x2a')](_0x109e13['error'],{'showHidden':![],'depth':null}));}})[_0xd21e('0x18')](function(_0x52d85b){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd21e('0x29'),_0xd21e('0x68'),util['inspect'](_0x52d85b,{'showHidden':![],'depth':null}));});}else{logger[_0xd21e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd21e('0x29'),'clickatell',_0xd21e('0x64'));}break;case _0xd21e('0x69'):if(_0x122700[_0xd21e('0x2d')]&&_0x122700[_0xd21e('0x33')]){var _0x26eeb8=util['format'](_0xd21e('0x6a'),_0x122700[_0xd21e('0x2d')],_0x122700['password']);var _0x4dbbe5={'method':_0xd21e('0x35'),'uri':_0xd21e('0x6b')+_0x122700[_0xd21e('0x6c')]+_0xd21e('0x6d'),'body':{'to':[_0x280e02[_0xd21e('0x21')]],'text':_0x280e02['body'],'from':_0x122700['phone'],'applicationId':_0x122700[_0xd21e('0x6e')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x26eeb8)[_0xd21e('0x4e')]('base64'))},'json':!![]};rp(_0x4dbbe5)[_0xd21e('0x1c')](function(_0x120cfa){if(_0x120cfa['id']){var _0x5dad58={'messageId':_0x120cfa['id']};return _0x5be567[_0xd21e('0x16')](_0x5dad58);}else{logger['error'](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x69'),util[_0xd21e('0x2a')](_0x120cfa,{'showHidden':![],'depth':null}));}})[_0xd21e('0x18')](function(_0x54c2c0){logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x69'),util['inspect'](_0x54c2c0,{'showHidden':![],'depth':null}));});}else{logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),'bandwidth',_0xd21e('0x3d'));}break;case'intelepeer':if(_0x122700['apiKey']){var _0x36877f={};var _0x3de19d={'method':_0xd21e('0x35'),'uri':_0xd21e('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x122700['apiKey'],'Content-Type':_0xd21e('0x70')},'body':{'from':_0x122700[_0xd21e('0x21')],'to':_0x280e02[_0xd21e('0x21')],'text':_0x280e02[_0xd21e('0x2e')]},'json':!![]};return rp(_0x3de19d)['then'](function(_0x10e3d6){if(_0x10e3d6['code']==0xca){_0x36877f[_0xd21e('0x71')]=_0x10e3d6;var _0x4ea067={'method':_0xd21e('0x35'),'uri':_0xd21e('0x72'),'headers':{'Authorization':_0xd21e('0x73')+_0x122700[_0xd21e('0x58')],'Content-Type':_0xd21e('0x70')},'body':{'refid':_0x36877f[_0xd21e('0x71')][_0xd21e('0x74')]},'json':!![]};return rp(_0x4ea067)[_0xd21e('0x1c')](function(_0xb5eedb){_0x36877f[_0xd21e('0x75')]=_0xb5eedb;var _0x29c9d6={'messageId':_0x36877f['message']['refid'],'read':!![]};return _0x5be567[_0xd21e('0x16')](_0x29c9d6);});}else{return logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),'intelepeer',util[_0xd21e('0x2a')](_0x10e3d6,{'showHidden':![],'depth':null}));}})[_0xd21e('0x18')](function(_0x2c622f){return logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x76'),util[_0xd21e('0x2a')](_0x2c622f,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd21e('0x29'),_0xd21e('0x76'),_0xd21e('0x77'));}break;}}})[_0xd21e('0x78')](function(){_0x168ebd();});}else{_0x168ebd();}}},'charset':_0xd21e('0x79'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x964e=['senderString','POST','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','http_code','data','queued_count','head','message_id','deliveryReport','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','/status?token=','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','keys','sort','length','createHash','digest','hex','signature=','GET','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','clickatell','apiMessageId','bandwidth','accountId','/messages','Basic\x20%s','base64','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','moment','request-promise','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','findOne','SmsInteractionId','then','update','createdAt','catch','SmsAccount','type','twilio','authToken','phone','accountSid','messages','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','user_key','session_key','total_sent','read','Missing\x20parameters:\x20username,\x20password','connectel'];(function(_0x55cd40,_0x516d3a){var _0x33b87b=function(_0x37bac5){while(--_0x37bac5){_0x55cd40['push'](_0x55cd40['shift']());}};_0x33b87b(++_0x516d3a);}(_0x964e,0x11d));var _0xe964=function(_0x500c29,_0x329601){_0x500c29=_0x500c29-0x0;var _0x6d4096=_0x964e[_0x500c29];return _0x6d4096;};'use strict';var _=require(_0xe964('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe964('0x1'));var BPromise=require('bluebird');var rp=require(_0xe964('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe964('0x3'));var attributes=require(_0xe964('0x4'));module[_0xe964('0x5')]=function(_0x5a39b1,_0x346f5b){return _0x5a39b1[_0xe964('0x6')]('SmsMessage',attributes,{'tableName':_0xe964('0x7'),'paranoid':![],'indexes':[{'name':_0xe964('0x8'),'fields':[_0xe964('0x8')]},{'name':_0xe964('0x9'),'fields':[_0xe964('0xa')],'type':_0xe964('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23d50e,_0x288151,_0x23a1df){var _0x1152c5=_0x5a39b1[_0xe964('0xc')];var _0x3b0570=_0x23d50e[_0xe964('0xd')]({'plain':!![]});if(_0x3b0570[_0xe964('0xe')][_0xe964('0xf')]()==='in'||_0x3b0570[_0xe964('0xe')][_0xe964('0xf')]()===_0xe964('0x10')&&!_0x3b0570[_0xe964('0x11')]&&!_['isNil'](_0x3b0570[_0xe964('0x12')])){_0x1152c5['SmsInteraction'][_0xe964('0x13')]({'where':{'id':_0x3b0570[_0xe964('0x14')]}})[_0xe964('0x15')](function(_0x403471){if(_0x403471){_0x403471[_0xe964('0x16')]({'lastMsgAt':_0x3b0570[_0xe964('0x17')],'lastMsgDirection':_0x3b0570[_0xe964('0xe')][_0xe964('0xf')]()});}})[_0xe964('0x18')](function(_0x3cf7bc){console['error'](_0x3cf7bc);});}if(_0x3b0570[_0xe964('0xe')]===_0xe964('0x10')&&!_0x3b0570[_0xe964('0x11')]){var _0xb450e3;_0x1152c5[_0xe964('0x19')]['find']({'where':{'id':_0x3b0570['SmsAccountId']},'raw':!![]})[_0xe964('0x15')](function(_0x15c4da){_0xb450e3=_0x15c4da;if(_0xb450e3&&_0xb450e3[_0xe964('0x1a')]){switch(_0xb450e3[_0xe964('0x1a')]){case _0xe964('0x1b'):var _0x2b5826=require(_0xe964('0x1b'));if(_0xb450e3['accountSid']&&_0xb450e3[_0xe964('0x1c')]&&_0xb450e3[_0xe964('0x1d')]){var _0x40c921=new _0x2b5826(_0xb450e3[_0xe964('0x1e')],_0xb450e3[_0xe964('0x1c')]);_0x40c921[_0xe964('0x1f')]['create']({'body':_0x3b0570[_0xe964('0xa')],'to':_0x3b0570[_0xe964('0x1d')],'from':_0xb450e3['phone'],'statusCallback':_0xb450e3[_0xe964('0x20')]+_0xe964('0x21')+_0x3b0570['id']+'/status?token='+_0xb450e3[_0xe964('0x22')]})['then'](function(_0x9c95d6){if(_0x9c95d6[_0xe964('0x23')]){return _0x23d50e['update']({'messageId':_0x9c95d6['sid']});}})[_0xe964('0x18')](function(_0x909c7a){logger['error'](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x1b'),util[_0xe964('0x26')](_0x909c7a,{'showHidden':![],'depth':null}));});}else{logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x1b'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xe964('0x28'):var _0x512623=_0xe964('0x29');if(_0xb450e3[_0xe964('0x2a')]&&_0xb450e3['password']){var _0x166537={'recipient':[_0x3b0570['phone']],'message':_0x3b0570[_0xe964('0xa')],'message_type':_0xb450e3['smsMethod']};if(_0xb450e3[_0xe964('0x2b')]&&_0xb450e3[_0xe964('0x2b')]!=='SI'){_0x166537[_0xe964('0x2c')]=_0xb450e3[_0xe964('0x1d')];}var _0x22173c={'url':_0x512623+_0xe964('0x2d')+_0xb450e3[_0xe964('0x2a')]+_0xe964('0x2e')+_0xb450e3[_0xe964('0x2f')],'method':'GET'};rp(_0x22173c)[_0xe964('0x15')](function(_0x56f880){var _0x1bb0eb=_0x56f880['split'](';');var _0x59b1a4={'user_key':_0x1bb0eb[0x0],'session_key':_0x1bb0eb[0x1]};_0x22173c={'url':_0x512623+'sms','method':'POST','headers':{'user_key':_0x59b1a4[_0xe964('0x30')],'Session_key':_0x59b1a4[_0xe964('0x31')]},'json':!![],'body':_0x166537};return rp(_0x22173c);})['then'](function(_0x1f4da7){if(_0x1f4da7[_0xe964('0x32')]>=0x1){var _0x2ce356={'messageId':_0x1f4da7['internal_order_id']};if(_0xb450e3[_0xe964('0x2b')]!=='GP'||!_0xb450e3['deliveryReport']){_0x2ce356[_0xe964('0x33')]=!![];}return _0x23d50e[_0xe964('0x16')](_0x2ce356);}else{return logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),'skebby',util[_0xe964('0x26')](_0x1f4da7,{'showHidden':![],'depth':null}));}})[_0xe964('0x18')](function(_0x4aa357){return logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),'skebby',util[_0xe964('0x26')](_0x4aa357,{'showHidden':![],'depth':null}));});}else{logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x28'),_0xe964('0x34'));}break;case _0xe964('0x35'):if(_0xb450e3[_0xe964('0x1c')]){var _0x465231={'recipient':_0x3b0570[_0xe964('0x1d')],'message':_0x3b0570[_0xe964('0xa')],'sender':_0xb450e3[_0xe964('0x36')]||_0xb450e3[_0xe964('0x1d')],'authorization':_0xb450e3[_0xe964('0x1c')]};var _0x288151={'method':_0xe964('0x37'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x465231,'json':!![]};rp(_0x288151)[_0xe964('0x15')](function(_0xf608e){var _0x39f49e={'messageId':_0xf608e['requestid']};if(!_0xb450e3['deliveryReport']){_0x39f49e[_0xe964('0x33')]=!![];}return _0x23d50e[_0xe964('0x16')](_0x39f49e);})[_0xe964('0x18')](function(_0x566e52){logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x35'),util[_0xe964('0x26')](_0x566e52,{'showHidden':![],'depth':null}));});}else{logger[_0xe964('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe964('0x35'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0xb450e3[_0xe964('0x2a')]&&_0xb450e3[_0xe964('0x2f')]){var _0x465231={'messages':[{'source':_0xe964('0x38'),'to':_0x3b0570['phone'],'body':_0x3b0570[_0xe964('0xa')],'from':_0xb450e3[_0xe964('0x36')]||_0xb450e3[_0xe964('0x1d')]}]};var _0x2299e4=util[_0xe964('0x39')](_0xe964('0x3a'),_0xb450e3[_0xe964('0x2a')],_0xb450e3[_0xe964('0x2f')]);var _0x288151={'method':'POST','uri':_0xe964('0x3b'),'body':_0x465231,'headers':{'Authorization':util[_0xe964('0x39')]('Basic\x20%s',new Buffer(_0x2299e4)[_0xe964('0x3c')]('base64'))},'json':!![]};rp(_0x288151)[_0xe964('0x15')](function(_0x49f63d){if(_0x49f63d[_0xe964('0x3d')]>=0xc8&&_0x49f63d['http_code']<=0xce){if(_0x49f63d['data']&&_0x49f63d[_0xe964('0x3e')][_0xe964('0x3f')]>0x0){var _0x4c4da8=_[_0xe964('0x40')](_0x49f63d[_0xe964('0x3e')][_0xe964('0x1f')]);var _0x3e7b65={'messageId':_0x4c4da8[_0xe964('0x41')]};if(!_0xb450e3[_0xe964('0x42')]){_0x3e7b65['read']=!![];}return _0x23d50e[_0xe964('0x16')](_0x3e7b65);}else{logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x43'),util['inspect'](_0x49f63d,{'showHidden':![],'depth':null}));}}else{logger[_0xe964('0x27')](_0xe964('0x24'),'afterCreate',_0xe964('0x43'),util[_0xe964('0x26')](_0x49f63d,{'showHidden':![],'depth':null}));}})[_0xe964('0x18')](function(_0x44a89a){logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x43'),util[_0xe964('0x26')](_0x44a89a,{'showHidden':![],'depth':null}));});}else{logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),'clickSend',_0xe964('0x34'));}break;case _0xe964('0x44'):if(_0xb450e3[_0xe964('0x45')]&&_0xb450e3[_0xe964('0x1c')]){var _0x465231={'dst':_0x3b0570[_0xe964('0x1d')],'text':_0x3b0570[_0xe964('0xa')],'src':_0xb450e3[_0xe964('0x36')]||_0xb450e3[_0xe964('0x1d')],'url':_0xb450e3[_0xe964('0x20')]+'/api/sms/messages/'+_0x3b0570['id']+'/status?token='+_0xb450e3[_0xe964('0x22')]};var _0x2299e4=util[_0xe964('0x39')](_0xe964('0x3a'),_0xb450e3[_0xe964('0x45')],_0xb450e3[_0xe964('0x1c')]);var _0x288151={'method':_0xe964('0x37'),'uri':util['format'](_0xe964('0x46'),_0xb450e3[_0xe964('0x45')]),'body':_0x465231,'headers':{'Authorization':util[_0xe964('0x39')]('Basic\x20%s',new Buffer(_0x2299e4)['toString']('base64'))},'json':!![]};rp(_0x288151)[_0xe964('0x15')](function(_0x2caf60){var _0x2d2b06={'messageId':_0x2caf60[_0xe964('0x47')][0x0]};return _0x23d50e[_0xe964('0x16')](_0x2d2b06);})['catch'](function(_0x3604c7){logger[_0xe964('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe964('0x25'),'plivo',util['inspect'](_0x3604c7,{'showHidden':![],'depth':null}));});}else{logger[_0xe964('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe964('0x44'),_0xe964('0x48'));}break;case _0xe964('0x49'):if(_0xb450e3['username']&&_0xb450e3[_0xe964('0x2f')]){if(_0xb450e3[_0xe964('0x4a')]){var _0x33013b={'method':_0xe964('0x37'),'uri':_0xb450e3['baseUrl']+'/auth/1/session','body':{'username':_0xb450e3[_0xe964('0x2a')],'password':_0xb450e3[_0xe964('0x2f')]},'json':!![]};return rp(_0x33013b)[_0xe964('0x15')](function(_0x49b6d1){var _0x4bbcb4={'method':_0xe964('0x37'),'uri':_0xb450e3[_0xe964('0x4a')]+_0xe964('0x4b'),'body':{'messages':[{'from':_0xb450e3[_0xe964('0x1d')],'destinations':[{'to':_0x3b0570[_0xe964('0x1d')]}],'text':_0x3b0570['body'],'notifyUrl':_0xb450e3[_0xe964('0x20')]+_0xe964('0x21')+_0x3b0570['id']+_0xe964('0x4c')+_0xb450e3[_0xe964('0x22')],'notifyContentType':_0xe964('0x4d'),'callbackData':_0xb450e3[_0xe964('0x1d')]+';'+_0x3b0570[_0xe964('0xa')]}]},'headers':{'Authorization':_0xe964('0x4e')+_0x49b6d1[_0xe964('0x22')]},'json':!![]};return rp(_0x4bbcb4)[_0xe964('0x15')](function(_0x671536){if(_0x671536[_0xe964('0x1f')]){var _0x4db36d={'messageId':_0x671536[_0xe964('0x1f')][0x0][_0xe964('0x8')]};if(!_0xb450e3['deliveryReport']){_0x4db36d['read']=!![];}return _0x23d50e[_0xe964('0x16')](_0x4db36d);}else{return logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),'infobip',util[_0xe964('0x26')](_0x671536,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x56b59d){return logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x49'),util['inspect'](_0x56b59d,{'showHidden':![],'depth':null}));});}else{logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x49'),_0xe964('0x4f'));}}else{logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x49'),_0xe964('0x34'));}break;case'csc':var _0x5ce5a7=require(_0xe964('0x50'));if(_0xb450e3[_0xe964('0x51')]){var _0x578bc7={};_0x578bc7[_0xe964('0x52')]=_0xb450e3[_0xe964('0x2a')];_0x578bc7[_0xe964('0x1d')]=_0x3b0570[_0xe964('0x1d')];_0x578bc7[_0xe964('0x2c')]=_0xb450e3[_0xe964('0x1d')];_0x578bc7[_0xe964('0x53')]=_0x3b0570[_0xe964('0xa')];_0x578bc7['timestamp']=+new Date();var _0x4cef93='';var _0x12bd7b='';var _0x46a030=Object[_0xe964('0x54')](_0x578bc7);_0x46a030[_0xe964('0x55')]();for(var _0x57e3e5=0x0;_0x57e3e5<_0x46a030[_0xe964('0x56')];_0x57e3e5++){if(_0x4cef93!=''){_0x4cef93+='&';}_0x4cef93+=_0x46a030[_0x57e3e5]+'='+encodeURIComponent(_0x578bc7[_0x46a030[_0x57e3e5]]);_0x12bd7b+=_0x578bc7[_0x46a030[_0x57e3e5]];}_0x12bd7b+=_0xb450e3[_0xe964('0x51')];_0x12bd7b=_0x5ce5a7[_0xe964('0x57')]('md5')[_0xe964('0x16')](_0x12bd7b)[_0xe964('0x58')](_0xe964('0x59'));if(_0x4cef93!==''){_0x4cef93+='&';}_0x4cef93+=_0xe964('0x5a')+_0x12bd7b;var _0x22173c={'method':_0xe964('0x5b'),'uri':_0xb450e3[_0xe964('0x4a')]+_0xe964('0x5c')+_0x4cef93,'json':!![]};return rp(_0x22173c)[_0xe964('0x15')](function(_0x42c4fc){var _0x1c1c40=Object[_0xe964('0x54')](_0x42c4fc);if(_0x42c4fc[_0x1c1c40[0x0]][_0xe964('0x27')]&&parseInt(_0x42c4fc[_0x1c1c40[0x0]][_0xe964('0x27')])===0x0){var _0x120ca4={'messageId':_0x42c4fc[_0x1c1c40[0x0]]['id_sms']};if(!_0xb450e3[_0xe964('0x42')]){_0x120ca4[_0xe964('0x33')]=!![];}return _0x23d50e['update'](_0x120ca4);}else{return logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x5d'),util[_0xe964('0x26')](_0x42c4fc[_0xe964('0x27')],{'showHidden':![],'depth':null}));}})[_0xe964('0x18')](function(_0x5477a4){return logger[_0xe964('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe964('0x25'),_0xe964('0x5d'),util[_0xe964('0x26')](_0x5477a4,{'showHidden':![],'depth':null}));});}else{logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x5d'),_0xe964('0x5e'));}break;case _0xe964('0x5f'):if(_0xb450e3[_0xe964('0x51')]){var _0x5c207c={'method':_0xe964('0x37'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0xb450e3[_0xe964('0x51')]},'body':{'content':_0x3b0570[_0xe964('0xa')],'to':[_0x3b0570[_0xe964('0x1d')]],'from':_0xb450e3['phone'],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x5c207c)['then'](function(_0x400f5b){if(!_0x400f5b[_0xe964('0x27')]){var _0x13f878={'messageId':_0x400f5b[_0xe964('0x1f')][0x0][_0xe964('0x60')]};if(!_0xb450e3[_0xe964('0x42')]){_0x13f878['read']=!![];}return _0x23d50e[_0xe964('0x16')](_0x13f878);}else{return logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x5f'),util[_0xe964('0x26')](_0x400f5b[_0xe964('0x27')],{'showHidden':![],'depth':null}));}})[_0xe964('0x18')](function(_0x30adb6){return logger[_0xe964('0x27')](_0xe964('0x24'),'afterCreate',_0xe964('0x5f'),util[_0xe964('0x26')](_0x30adb6,{'showHidden':![],'depth':null}));});}else{logger[_0xe964('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe964('0x25'),_0xe964('0x5f'),_0xe964('0x5e'));}break;case _0xe964('0x61'):if(_0xb450e3['username']&&_0xb450e3[_0xe964('0x2f')]){var _0x2299e4=util[_0xe964('0x39')](_0xe964('0x3a'),_0xb450e3[_0xe964('0x2a')],_0xb450e3[_0xe964('0x2f')]);var _0x288151={'method':_0xe964('0x37'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0xb450e3[_0xe964('0x62')]+_0xe964('0x63'),'body':{'to':[_0x3b0570[_0xe964('0x1d')]],'text':_0x3b0570[_0xe964('0xa')],'from':_0xb450e3[_0xe964('0x1d')],'applicationId':_0xb450e3['applicationId']},'headers':{'Authorization':util[_0xe964('0x39')](_0xe964('0x64'),new Buffer(_0x2299e4)[_0xe964('0x3c')](_0xe964('0x65')))},'json':!![]};rp(_0x288151)['then'](function(_0x59ac7a){if(_0x59ac7a['id']){var _0x6e8c={'messageId':_0x59ac7a['id']};return _0x23d50e[_0xe964('0x16')](_0x6e8c);}else{logger['error'](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x61'),util['inspect'](_0x59ac7a,{'showHidden':![],'depth':null}));}})[_0xe964('0x18')](function(_0x4b44de){logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),'bandwidth',util[_0xe964('0x26')](_0x4b44de,{'showHidden':![],'depth':null}));});}else{logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x61'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe964('0x66'):if(_0xb450e3[_0xe964('0x51')]){var _0x368c7f={};var _0x22173c={'method':_0xe964('0x37'),'uri':_0xe964('0x67'),'headers':{'Authorization':_0xe964('0x68')+_0xb450e3[_0xe964('0x51')],'Content-Type':'application/json'},'body':{'from':_0xb450e3['phone'],'to':_0x3b0570['phone'],'text':_0x3b0570[_0xe964('0xa')]},'json':!![]};return rp(_0x22173c)[_0xe964('0x15')](function(_0x3d55a9){if(_0x3d55a9[_0xe964('0x69')]==0xca){_0x368c7f[_0xe964('0x6a')]=_0x3d55a9;var _0x23ee6e={'method':_0xe964('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xe964('0x68')+_0xb450e3[_0xe964('0x51')],'Content-Type':_0xe964('0x4d')},'body':{'refid':_0x368c7f['message'][_0xe964('0x6b')]},'json':!![]};return rp(_0x23ee6e)['then'](function(_0x12f845){_0x368c7f[_0xe964('0x6c')]=_0x12f845;var _0x408245={'messageId':_0x368c7f[_0xe964('0x6a')]['refid'],'read':!![]};return _0x23d50e[_0xe964('0x16')](_0x408245);});}else{return logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x66'),util[_0xe964('0x26')](_0x3d55a9,{'showHidden':![],'depth':null}));}})['catch'](function(_0xda2562){return logger[_0xe964('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe964('0x25'),_0xe964('0x66'),util[_0xe964('0x26')](_0xda2562,{'showHidden':![],'depth':null}));});}else{return logger[_0xe964('0x27')](_0xe964('0x24'),_0xe964('0x25'),_0xe964('0x66'),_0xe964('0x6d'));}break;}}})[_0xe964('0x6e')](function(){_0x23a1df();});}else{_0x23a1df();}}},'charset':_0xe964('0x6f'),'collate':_0xe964('0x70')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 9b827f9..875a477 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 _0xb9e4=['create','body','options','CreateSmsMessage','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','SmsMessage'];(function(_0x678ed,_0x339833){var _0x2c709c=function(_0x167f12){while(--_0x167f12){_0x678ed['push'](_0x678ed['shift']());}};_0x2c709c(++_0x339833);}(_0xb9e4,0x163));var _0x4b9e=function(_0x480182,_0x3e9ab3){_0x480182=_0x480182-0x0;var _0x9554d4=_0xb9e4[_0x480182];return _0x9554d4;};'use strict';var _=require('lodash');var util=require(_0x4b9e('0x0'));var moment=require(_0x4b9e('0x1'));var BPromise=require(_0x4b9e('0x2'));var rs=require(_0x4b9e('0x3'));var fs=require('fs');var Redis=require(_0x4b9e('0x4'));var db=require(_0x4b9e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b9e('0x6'))(_0x4b9e('0x7'));var config=require(_0x4b9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4b9e('0x9')][_0x4b9e('0xa')]({'port':0x232a});config['redis']=_[_0x4b9e('0xb')](config[_0x4b9e('0xc')],{'host':_0x4b9e('0xd'),'port':0x18eb});var socket=require(_0x4b9e('0xe'))(new Redis(config['redis']));require(_0x4b9e('0xf'))[_0x4b9e('0x10')](socket);function respondWithRpcPromise(_0xeb834e,_0xb1e43c,_0x3646ba){return new BPromise(function(_0x192e38,_0xef1c25){return client[_0x4b9e('0x11')](_0xeb834e,_0x3646ba)[_0x4b9e('0x12')](function(_0x149728){logger[_0x4b9e('0x13')]('SmsMessage,\x20%s,\x20%s',_0xb1e43c,_0x4b9e('0x14'));logger[_0x4b9e('0x15')](_0x4b9e('0x16'),_0xb1e43c,'request\x20sent',JSON['stringify'](_0x149728));if(_0x149728[_0x4b9e('0x17')]){if(_0x149728[_0x4b9e('0x17')][_0x4b9e('0x18')]===0x1f4){logger[_0x4b9e('0x17')](_0x4b9e('0x19'),_0xb1e43c,_0x149728[_0x4b9e('0x17')][_0x4b9e('0x1a')]);return _0xef1c25(_0x149728[_0x4b9e('0x17')][_0x4b9e('0x1a')]);}logger[_0x4b9e('0x17')]('SmsMessage,\x20%s,\x20%s',_0xb1e43c,_0x149728[_0x4b9e('0x17')][_0x4b9e('0x1a')]);return _0x192e38(_0x149728['error'][_0x4b9e('0x1a')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0xb1e43c,_0x4b9e('0x14'));_0x192e38(_0x149728[_0x4b9e('0x1b')][_0x4b9e('0x1a')]);}})[_0x4b9e('0x1c')](function(_0x1768d2){logger['error'](_0x4b9e('0x19'),_0xb1e43c,_0x1768d2);_0xef1c25(_0x1768d2);});});}exports['CreateSmsMessage']=function(_0x474537){var _0x5d7836=this;return new Promise(function(_0x38babb,_0x37b51e){return db[_0x4b9e('0x1d')][_0x4b9e('0x1e')](_0x474537[_0x4b9e('0x1f')],{'raw':_0x474537[_0x4b9e('0x20')]?_0x474537['options']['raw']===undefined?!![]:![]:!![]})[_0x4b9e('0x12')](function(_0x1d176f){logger[_0x4b9e('0x13')]('CreateSmsMessage',_0x474537);logger['debug'](_0x4b9e('0x21'),_0x474537,JSON[_0x4b9e('0x22')](_0x1d176f));_0x38babb(_0x1d176f);})[_0x4b9e('0x1c')](function(_0x27a060){logger[_0x4b9e('0x17')](_0x4b9e('0x21'),_0x27a060[_0x4b9e('0x1a')],_0x474537);_0x37b51e(_0x5d7836[_0x4b9e('0x17')](0x1f4,_0x27a060[_0x4b9e('0x1a')]));});});}; \ No newline at end of file +var _0x2879=['body','options','raw','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSmsMessage','SmsMessage','create'];(function(_0x578bc4,_0x137b60){var _0x5757c7=function(_0x27e99a){while(--_0x27e99a){_0x578bc4['push'](_0x578bc4['shift']());}};_0x5757c7(++_0x137b60);}(_0x2879,0xae));var _0x9287=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2879[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x9287('0x0'));var util=require(_0x9287('0x1'));var moment=require(_0x9287('0x2'));var BPromise=require(_0x9287('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9287('0x4'))['db'];var utils=require(_0x9287('0x5'));var logger=require(_0x9287('0x6'))(_0x9287('0x7'));var config=require(_0x9287('0x8'));var jayson=require(_0x9287('0x9'));var client=jayson['client'][_0x9287('0xa')]({'port':0x232a});config[_0x9287('0xb')]=_[_0x9287('0xc')](config[_0x9287('0xb')],{'host':_0x9287('0xd'),'port':0x18eb});var socket=require(_0x9287('0xe'))(new Redis(config[_0x9287('0xb')]));require('./smsMessage.socket')[_0x9287('0xf')](socket);function respondWithRpcPromise(_0x1a1d26,_0x22c25a,_0x249e15){return new BPromise(function(_0x473657,_0x12a457){return client[_0x9287('0x10')](_0x1a1d26,_0x249e15)[_0x9287('0x11')](function(_0x33ca64){logger['info'](_0x9287('0x12'),_0x22c25a,_0x9287('0x13'));logger['debug'](_0x9287('0x14'),_0x22c25a,_0x9287('0x13'),JSON[_0x9287('0x15')](_0x33ca64));if(_0x33ca64[_0x9287('0x16')]){if(_0x33ca64[_0x9287('0x16')][_0x9287('0x17')]===0x1f4){logger[_0x9287('0x16')](_0x9287('0x12'),_0x22c25a,_0x33ca64[_0x9287('0x16')][_0x9287('0x18')]);return _0x12a457(_0x33ca64['error']['message']);}logger[_0x9287('0x16')](_0x9287('0x12'),_0x22c25a,_0x33ca64[_0x9287('0x16')][_0x9287('0x18')]);return _0x473657(_0x33ca64['error'][_0x9287('0x18')]);}else{logger[_0x9287('0x19')](_0x9287('0x12'),_0x22c25a,_0x9287('0x13'));_0x473657(_0x33ca64['result'][_0x9287('0x18')]);}})[_0x9287('0x1a')](function(_0x4e917d){logger['error']('SmsMessage,\x20%s,\x20%s',_0x22c25a,_0x4e917d);_0x12a457(_0x4e917d);});});}exports[_0x9287('0x1b')]=function(_0x3d42c7){var _0x8f3e=this;return new Promise(function(_0x5524be,_0x174eb8){return db[_0x9287('0x1c')][_0x9287('0x1d')](_0x3d42c7[_0x9287('0x1e')],{'raw':_0x3d42c7[_0x9287('0x1f')]?_0x3d42c7[_0x9287('0x1f')][_0x9287('0x20')]===undefined?!![]:![]:!![]})[_0x9287('0x11')](function(_0x123bd4){logger[_0x9287('0x19')]('CreateSmsMessage',_0x3d42c7);logger[_0x9287('0x21')](_0x9287('0x1b'),_0x3d42c7,JSON['stringify'](_0x123bd4));_0x5524be(_0x123bd4);})[_0x9287('0x1a')](function(_0xf0f983){logger['error'](_0x9287('0x1b'),_0xf0f983[_0x9287('0x18')],_0x3d42c7);_0x174eb8(_0x8f3e[_0x9287('0x16')](0x1f4,_0xf0f983['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index aea1a9e..f03f216 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 _0x994a=['length','smsMessage:','remove','update','register'];(function(_0x3ed26a,_0x1a9bac){var _0x350db5=function(_0x5c9a97){while(--_0x5c9a97){_0x3ed26a['push'](_0x3ed26a['shift']());}};_0x350db5(++_0x1a9bac);}(_0x994a,0x1b5));var _0xa994=function(_0x5c214c,_0x415e6f){_0x5c214c=_0x5c214c-0x0;var _0x9e37e=_0x994a[_0x5c214c];return _0x9e37e;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0xa994('0x0'),_0xa994('0x1')];function createListener(_0x2496dd,_0x3eb5e0){return function(_0x1ee2c8){_0x3eb5e0['emit'](_0x2496dd,_0x1ee2c8);};}function removeListener(_0x245c7b,_0x1e2631){return function(){SmsMessageEvents['removeListener'](_0x245c7b,_0x1e2631);};}exports[_0xa994('0x2')]=function(_0x288795){for(var _0x3672a6=0x0,_0x2487ad=events[_0xa994('0x3')];_0x3672a6<_0x2487ad;_0x3672a6++){var _0x21ae9e=events[_0x3672a6];var _0x1533c4=createListener(_0xa994('0x4')+_0x21ae9e,_0x288795);SmsMessageEvents['on'](_0x21ae9e,_0x1533c4);}}; \ No newline at end of file +var _0x0ab1=['length','smsMessage:','save','remove','update','register'];(function(_0x1becf1,_0x2c4671){var _0x3e0ed1=function(_0x2ba825){while(--_0x2ba825){_0x1becf1['push'](_0x1becf1['shift']());}};_0x3e0ed1(++_0x2c4671);}(_0x0ab1,0xec));var _0x10ab=function(_0x581cec,_0x571902){_0x581cec=_0x581cec-0x0;var _0x55cd31=_0x0ab1[_0x581cec];return _0x55cd31;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x10ab('0x0'),_0x10ab('0x1'),_0x10ab('0x2')];function createListener(_0x51fb7b,_0x500126){return function(_0x4be20b){_0x500126['emit'](_0x51fb7b,_0x4be20b);};}function removeListener(_0x27b5a9,_0x34a039){return function(){SmsMessageEvents['removeListener'](_0x27b5a9,_0x34a039);};}exports[_0x10ab('0x3')]=function(_0x414a29){for(var _0x231e09=0x0,_0x49057a=events[_0x10ab('0x4')];_0x231e09<_0x49057a;_0x231e09++){var _0x191244=events[_0x231e09];var _0x4f0b0c=createListener(_0x10ab('0x5')+_0x191244,_0x414a29);SmsMessageEvents['on'](_0x191244,_0x4f0b0c);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a76dde7..eef3e46 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 _0x4ae6=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','delete','destroy','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ae6,0x8f));var _0x64ae=function(_0x36219a,_0x332224){_0x36219a=_0x36219a-0x0;var _0x597a4d=_0x4ae6[_0x36219a];return _0x597a4d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x64ae('0x0'));var timeout=require(_0x64ae('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x64ae('0x2'));var interaction=require(_0x64ae('0x3'));var config=require(_0x64ae('0x4'));var controller=require(_0x64ae('0x5'));router['get']('/',auth[_0x64ae('0x6')](),controller[_0x64ae('0x7')]);router[_0x64ae('0x8')](_0x64ae('0x9'),auth[_0x64ae('0x6')](),controller['describe']);router[_0x64ae('0x8')](_0x64ae('0xa'),auth[_0x64ae('0x6')](),controller[_0x64ae('0xb')]);router['get'](_0x64ae('0xc'),auth['isAuthenticated'](),controller[_0x64ae('0xd')]);router['get'](_0x64ae('0xe'),auth[_0x64ae('0x6')](),controller[_0x64ae('0xf')]);router[_0x64ae('0x8')]('/:id/users',auth[_0x64ae('0x6')](),controller[_0x64ae('0x10')]);router[_0x64ae('0x11')]('/',auth['isAuthenticated'](),controller[_0x64ae('0x12')]);router['post'](_0x64ae('0xe'),auth[_0x64ae('0x6')](),controller[_0x64ae('0x13')]);router[_0x64ae('0x11')](_0x64ae('0x14'),auth[_0x64ae('0x6')](),controller[_0x64ae('0x15')]);router['put'](_0x64ae('0xa'),auth[_0x64ae('0x6')](),controller['update']);router[_0x64ae('0x16')](_0x64ae('0xa'),auth[_0x64ae('0x6')](),controller[_0x64ae('0x17')]);router['delete'](_0x64ae('0xe'),auth[_0x64ae('0x6')](),controller['removeTeams']);router[_0x64ae('0x16')](_0x64ae('0x14'),auth[_0x64ae('0x6')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xa795=['removeAgents','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams'];(function(_0x2ce7be,_0x228447){var _0x4cf6fd=function(_0x5848c3){while(--_0x5848c3){_0x2ce7be['push'](_0x2ce7be['shift']());}};_0x4cf6fd(++_0x228447);}(_0xa795,0xbf));var _0x5a79=function(_0x2b4003,_0x223344){_0x2b4003=_0x2b4003-0x0;var _0x495cdb=_0xa795[_0x2b4003];return _0x495cdb;};'use strict';var multer=require(_0x5a79('0x0'));var util=require(_0x5a79('0x1'));var path=require('path');var timeout=require(_0x5a79('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5a79('0x3'));var auth=require(_0x5a79('0x4'));var interaction=require(_0x5a79('0x5'));var config=require(_0x5a79('0x6'));var controller=require('./smsQueue.controller');router[_0x5a79('0x7')]('/',auth[_0x5a79('0x8')](),controller[_0x5a79('0x9')]);router[_0x5a79('0x7')]('/describe',auth[_0x5a79('0x8')](),controller['describe']);router[_0x5a79('0x7')](_0x5a79('0xa'),auth['isAuthenticated'](),controller[_0x5a79('0xb')]);router[_0x5a79('0x7')](_0x5a79('0xc'),auth[_0x5a79('0x8')](),controller[_0x5a79('0xd')]);router[_0x5a79('0x7')]('/:id/teams',auth[_0x5a79('0x8')](),controller[_0x5a79('0xe')]);router['get'](_0x5a79('0xf'),auth[_0x5a79('0x8')](),controller[_0x5a79('0x10')]);router[_0x5a79('0x11')]('/',auth[_0x5a79('0x8')](),controller['create']);router['post'](_0x5a79('0x12'),auth[_0x5a79('0x8')](),controller[_0x5a79('0x13')]);router['post'](_0x5a79('0xf'),auth[_0x5a79('0x8')](),controller[_0x5a79('0x14')]);router[_0x5a79('0x15')](_0x5a79('0xa'),auth[_0x5a79('0x8')](),controller['update']);router[_0x5a79('0x16')](_0x5a79('0xa'),auth[_0x5a79('0x8')](),controller[_0x5a79('0x17')]);router[_0x5a79('0x16')](_0x5a79('0x12'),auth[_0x5a79('0x8')](),controller[_0x5a79('0x18')]);router[_0x5a79('0x16')](_0x5a79('0xf'),auth[_0x5a79('0x8')](),controller[_0x5a79('0x19')]);module[_0x5a79('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 1cb7bcb..2d6a438 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 _0xaf6c=['INTEGER','ENUM','rrmemory','beepall','sequelize','STRING','name'];(function(_0x3b2d9b,_0x374369){var _0x4bf259=function(_0x46a6a4){while(--_0x46a6a4){_0x3b2d9b['push'](_0x3b2d9b['shift']());}};_0x4bf259(++_0x374369);}(_0xaf6c,0xf9));var _0xcaf6=function(_0x112290,_0x1cafbb){_0x112290=_0x112290-0x0;var _0x27d718=_0xaf6c[_0x112290];return _0x27d718;};'use strict';var Sequelize=require(_0xcaf6('0x0'));module['exports']={'name':{'type':Sequelize[_0xcaf6('0x1')],'unique':_0xcaf6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcaf6('0x1')]},'timeout':{'type':Sequelize[_0xcaf6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcaf6('0x4')](_0xcaf6('0x5'),_0xcaf6('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x608c=['exports','STRING','name','ENUM','rrmemory','beepall','sequelize'];(function(_0x52f268,_0x464137){var _0x1fc2a0=function(_0x505ae9){while(--_0x505ae9){_0x52f268['push'](_0x52f268['shift']());}};_0x1fc2a0(++_0x464137);}(_0x608c,0x1b1));var _0xc608=function(_0x4ccbc8,_0x1c17e7){_0x4ccbc8=_0x4ccbc8-0x0;var _0x111b32=_0x608c[_0x4ccbc8];return _0x111b32;};'use strict';var Sequelize=require(_0xc608('0x0'));module[_0xc608('0x1')]={'name':{'type':Sequelize[_0xc608('0x2')],'unique':_0xc608('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc608('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc608('0x4')](_0xc608('0x5'),_0xc608('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f4cf03d..df06a68 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 _0x9ffd=['online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','union','value','removeTeams','removeAgents','userSmsQueue:remove','addAgents','omit','userSmsQueue:save','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','status','json','count','offset','limit','Content-Range','reject','update','then','get','SmsQueues','UserProfileResource','destroy','end','sendStatus','error','stack','name','index','map','SmsQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','type','VIRTUAL','options','where','includeAll','include','findAll','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserSmsQueue','nolimit','pick','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','rows','format','SIP','createdAt','getTeams','Team','addTeams','ids'];(function(_0x60f018,_0x2ea2cb){var _0x2f759f=function(_0x5b8a8f){while(--_0x5b8a8f){_0x60f018['push'](_0x60f018['shift']());}};_0x2f759f(++_0x2ea2cb);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2d4b8d,_0x362e72){_0x2d4b8d=_0x2d4b8d-0x0;var _0x419e59=_0x9ffd[_0x2d4b8d];return _0x419e59;};'use strict';var pdf=require(_0xd9ff('0x0'));var emlformat=require(_0xd9ff('0x1'));var rimraf=require(_0xd9ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd9ff('0x3'));var rp=require(_0xd9ff('0x4'));var moment=require(_0xd9ff('0x5'));var BPromise=require(_0xd9ff('0x6'));var Mustache=require('mustache');var util=require(_0xd9ff('0x7'));var path=require(_0xd9ff('0x8'));var sox=require('sox');var csv=require(_0xd9ff('0x9'));var ejs=require(_0xd9ff('0xa'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xb'));var _=require(_0xd9ff('0xc'));var squel=require(_0xd9ff('0xd'));var crypto=require(_0xd9ff('0xe'));var jsforce=require(_0xd9ff('0xf'));var deskjs=require(_0xd9ff('0x10'));var toCsv=require(_0xd9ff('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd9ff('0x11'));var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd9ff('0x19')](config[_0xd9ff('0x1a')],{'host':_0xd9ff('0x1b'),'port':0x18eb});var socket=require(_0xd9ff('0x1c'))(new Redis(config[_0xd9ff('0x1a')]));require('./smsQueue.socket')[_0xd9ff('0x1d')](socket);function respondWithStatusCode(_0x3c9ace,_0x5c1a28){_0x5c1a28=_0x5c1a28||0xcc;return function(_0xf14c9f){if(_0xf14c9f){return _0x3c9ace['sendStatus'](_0x5c1a28);}return _0x3c9ace['status'](_0x5c1a28)['end']();};}function respondWithResult(_0x4c5718,_0x271287){_0x271287=_0x271287||0xc8;return function(_0x4f9d6d){if(_0x4f9d6d){return _0x4c5718[_0xd9ff('0x1e')](_0x271287)[_0xd9ff('0x1f')](_0x4f9d6d);}};}function respondWithFilteredResult(_0x39c6ce,_0x3afd19){return function(_0x5f45c4){if(_0x5f45c4){var _0x2d4df1=_0x5f45c4[_0xd9ff('0x20')],_0x3ccf15=_0x3afd19[_0xd9ff('0x21')],_0x128588=_0x3afd19[_0xd9ff('0x21')]+_0x3afd19[_0xd9ff('0x22')],_0x182775;if(_0x128588>=_0x2d4df1){_0x128588=_0x2d4df1;_0x182775=0xc8;}else{_0x182775=0xce;}_0x39c6ce['status'](_0x182775);return _0x39c6ce['set'](_0xd9ff('0x23'),_0x3ccf15+'-'+_0x128588+'/'+_0x2d4df1)[_0xd9ff('0x1f')](_0x5f45c4);}return null;};}function patchUpdates(_0x4eea4d){return function(_0x588151){try{jsonpatch['apply'](_0x588151,_0x4eea4d,!![]);}catch(_0x4b1477){return BPromise[_0xd9ff('0x24')](_0x4b1477);}return _0x588151['save']();};}function saveUpdates(_0x4c486a,_0x3fd141){return function(_0x291f52){if(_0x291f52){return _0x291f52[_0xd9ff('0x25')](_0x4c486a)[_0xd9ff('0x26')](function(_0x42a828){return _0x42a828;});}return null;};}function removeEntity(_0x4b058a,_0x4fada1){return function(_0x1136e9){if(_0x1136e9){return _0x1136e9['destroy']()[_0xd9ff('0x26')](function(){var _0x4d86fe=_0x1136e9[_0xd9ff('0x27')]({'plain':!![]});var _0x5d45b3=_0xd9ff('0x28');return db[_0xd9ff('0x29')][_0xd9ff('0x2a')]({'where':{'type':_0x5d45b3,'resourceId':_0x4d86fe['id']}})[_0xd9ff('0x26')](function(){return _0x1136e9;});})['then'](function(){_0x4b058a[_0xd9ff('0x1e')](0xcc)[_0xd9ff('0x2b')]();});}};}function handleEntityNotFound(_0x1c78c4,_0x4390f7){return function(_0x5c1c1f){if(!_0x5c1c1f){_0x1c78c4[_0xd9ff('0x2c')](0x194);}return _0x5c1c1f;};}function handleError(_0x3792d9,_0x44b5a7){_0x44b5a7=_0x44b5a7||0x1f4;return function(_0x45fb63){logger[_0xd9ff('0x2d')](_0x45fb63[_0xd9ff('0x2e')]);if(_0x45fb63[_0xd9ff('0x2f')]){delete _0x45fb63[_0xd9ff('0x2f')];}_0x3792d9[_0xd9ff('0x1e')](_0x44b5a7)['send'](_0x45fb63);};}exports[_0xd9ff('0x30')]=function(_0x4ba2be,_0x1d55fd){var _0x29c532={},_0xbdd352={},_0x552d08={'count':0x0,'rows':[]};var _0x2ba4d3=_[_0xd9ff('0x31')](db[_0xd9ff('0x32')][_0xd9ff('0x33')],function(_0x509291){return{'name':_0x509291[_0xd9ff('0x34')],'type':_0x509291['type'][_0xd9ff('0x35')]};});_0xbdd352[_0xd9ff('0x36')]=_[_0xd9ff('0x31')](_0x2ba4d3,_0xd9ff('0x2f'));_0xbdd352[_0xd9ff('0x37')]=_[_0xd9ff('0x38')](_0x4ba2be[_0xd9ff('0x37')]);_0xbdd352[_0xd9ff('0x39')]=_[_0xd9ff('0x3a')](_0xbdd352[_0xd9ff('0x36')],_0xbdd352[_0xd9ff('0x37')]);_0x29c532[_0xd9ff('0x3b')]=_[_0xd9ff('0x3a')](_0xbdd352[_0xd9ff('0x36')],qs['fields'](_0x4ba2be[_0xd9ff('0x37')][_0xd9ff('0x3c')]));_0x29c532[_0xd9ff('0x3b')]=_0x29c532['attributes'][_0xd9ff('0x3d')]?_0x29c532['attributes']:_0xbdd352[_0xd9ff('0x36')];if(!_0x4ba2be['query'][_0xd9ff('0x3e')]('nolimit')){_0x29c532[_0xd9ff('0x22')]=qs[_0xd9ff('0x22')](_0x4ba2be[_0xd9ff('0x37')]['limit']);_0x29c532['offset']=qs['offset'](_0x4ba2be[_0xd9ff('0x37')][_0xd9ff('0x21')]);}_0x29c532[_0xd9ff('0x3f')]=qs[_0xd9ff('0x40')](_0x4ba2be[_0xd9ff('0x37')][_0xd9ff('0x40')]);_0x29c532['where']=qs['filters'](_['pick'](_0x4ba2be[_0xd9ff('0x37')],_0xbdd352[_0xd9ff('0x39')]),_0x2ba4d3);if(_0x4ba2be[_0xd9ff('0x37')][_0xd9ff('0x41')]){_0x29c532['where']=_[_0xd9ff('0x42')](_0x29c532['where'],{'$or':_[_0xd9ff('0x31')](_0x2ba4d3,function(_0x3e2beb){if(_0x3e2beb[_0xd9ff('0x43')]!==_0xd9ff('0x44')){var _0x59fc07={};_0x59fc07[_0x3e2beb[_0xd9ff('0x2f')]]={'$like':'%'+_0x4ba2be[_0xd9ff('0x37')]['filter']+'%'};return _0x59fc07;}})});}_0x29c532=_[_0xd9ff('0x42')]({},_0x29c532,_0x4ba2be[_0xd9ff('0x45')]);var _0x94dcd8={'where':_0x29c532[_0xd9ff('0x46')]};return db[_0xd9ff('0x32')][_0xd9ff('0x20')](_0x94dcd8)['then'](function(_0x294c89){_0x552d08[_0xd9ff('0x20')]=_0x294c89;if(_0x4ba2be[_0xd9ff('0x37')][_0xd9ff('0x47')]){_0x29c532[_0xd9ff('0x48')]=[{'all':!![]}];}return db['SmsQueue'][_0xd9ff('0x49')](_0x29c532);})[_0xd9ff('0x26')](function(_0xe0bc49){_0x552d08['rows']=_0xe0bc49;return _0x552d08;})['then'](respondWithFilteredResult(_0x1d55fd,_0x29c532))[_0xd9ff('0x4a')](handleError(_0x1d55fd,null));};exports[_0xd9ff('0x4b')]=function(_0x18d1c4,_0x2dfb8f){var _0x437561={'raw':!![],'where':{'id':_0x18d1c4['params']['id']}},_0x30c69d={};_0x30c69d[_0xd9ff('0x36')]=_[_0xd9ff('0x38')](db['SmsQueue'][_0xd9ff('0x33')]);_0x30c69d[_0xd9ff('0x37')]=_[_0xd9ff('0x38')](_0x18d1c4[_0xd9ff('0x37')]);_0x30c69d[_0xd9ff('0x39')]=_['intersection'](_0x30c69d['model'],_0x30c69d['query']);_0x437561[_0xd9ff('0x3b')]=_['intersection'](_0x30c69d[_0xd9ff('0x36')],qs[_0xd9ff('0x3c')](_0x18d1c4[_0xd9ff('0x37')]['fields']));_0x437561[_0xd9ff('0x3b')]=_0x437561[_0xd9ff('0x3b')]['length']?_0x437561[_0xd9ff('0x3b')]:_0x30c69d[_0xd9ff('0x36')];if(_0x18d1c4[_0xd9ff('0x37')][_0xd9ff('0x47')]){_0x437561['include']=[{'all':!![]}];}_0x437561=_[_0xd9ff('0x42')]({},_0x437561,_0x18d1c4['options']);return db[_0xd9ff('0x32')]['find'](_0x437561)[_0xd9ff('0x26')](handleEntityNotFound(_0x2dfb8f,null))[_0xd9ff('0x26')](respondWithResult(_0x2dfb8f,null))[_0xd9ff('0x4a')](handleError(_0x2dfb8f,null));};exports[_0xd9ff('0x4c')]=function(_0xf21b7d,_0x540b78){return db[_0xd9ff('0x32')][_0xd9ff('0x4c')](_0xf21b7d[_0xd9ff('0x4d')],{})[_0xd9ff('0x26')](function(_0x5c3e11){var _0x537282=_0xf21b7d['user'][_0xd9ff('0x27')]({'plain':!![]});if(!_0x537282)throw new Error(_0xd9ff('0x4e'));if(_0x537282[_0xd9ff('0x4f')]==='user'){var _0x136bac=_0x5c3e11[_0xd9ff('0x27')]({'plain':!![]});var _0x6d1082=_0xd9ff('0x28');return db[_0xd9ff('0x50')][_0xd9ff('0x51')]({'where':{'name':_0x6d1082,'userProfileId':_0x537282[_0xd9ff('0x52')]},'raw':!![]})[_0xd9ff('0x26')](function(_0x1ad160){if(_0x1ad160&&_0x1ad160[_0xd9ff('0x53')]===0x0){return db[_0xd9ff('0x29')][_0xd9ff('0x4c')]({'name':_0x136bac[_0xd9ff('0x2f')],'resourceId':_0x136bac['id'],'type':_0x1ad160['name'],'sectionId':_0x1ad160['id']},{})[_0xd9ff('0x26')](function(){return _0x5c3e11;});}else{return _0x5c3e11;}})['catch'](function(_0x2c03a6){logger['error'](_0xd9ff('0x54'),_0x2c03a6);throw _0x2c03a6;});}return _0x5c3e11;})['then'](respondWithResult(_0x540b78,0xc9))[_0xd9ff('0x4a')](handleError(_0x540b78,null));};exports['update']=function(_0x3aea70,_0x4a45d4){if(_0x3aea70[_0xd9ff('0x4d')]['id']){delete _0x3aea70['body']['id'];}return db[_0xd9ff('0x32')]['find']({'where':{'id':_0x3aea70[_0xd9ff('0x55')]['id']}})[_0xd9ff('0x26')](handleEntityNotFound(_0x4a45d4,null))[_0xd9ff('0x26')](saveUpdates(_0x3aea70[_0xd9ff('0x4d')],null))['then'](respondWithResult(_0x4a45d4,null))[_0xd9ff('0x4a')](handleError(_0x4a45d4,null));};exports[_0xd9ff('0x2a')]=function(_0x1dc00c,_0x59f8e8){return db[_0xd9ff('0x32')][_0xd9ff('0x51')]({'where':{'id':_0x1dc00c[_0xd9ff('0x55')]['id']}})[_0xd9ff('0x26')](handleEntityNotFound(_0x59f8e8,null))[_0xd9ff('0x26')](removeEntity(_0x59f8e8,null))['catch'](handleError(_0x59f8e8,null));};exports[_0xd9ff('0x56')]=function(_0x412114,_0x11b6c4){return db[_0xd9ff('0x32')][_0xd9ff('0x56')]()[_0xd9ff('0x26')](respondWithResult(_0x11b6c4,null))[_0xd9ff('0x4a')](handleError(_0x11b6c4,null));};exports['getMembers']=function(_0x3be850,_0x11251f,_0x561a9b){var _0x1c885f={'raw':!![],'where':{}},_0x17c1b2={},_0x5b17c0;return db[_0xd9ff('0x32')][_0xd9ff('0x57')]({'where':{'id':_0x3be850[_0xd9ff('0x55')]['id']}})['then'](handleEntityNotFound(_0x11251f,null))['then'](function(_0x39473e){if(_0x39473e){_0x5b17c0=_0x39473e['get']({'plain':!![]});_0x17c1b2[_0xd9ff('0x36')]=_[_0xd9ff('0x38')](db[_0xd9ff('0x58')][_0xd9ff('0x33')]);_0x17c1b2['query']=_['keys'](_0x3be850['query']);_0x17c1b2[_0xd9ff('0x39')]=_[_0xd9ff('0x3a')](_0x17c1b2[_0xd9ff('0x36')],_0x17c1b2[_0xd9ff('0x37')]);_0x1c885f[_0xd9ff('0x3b')]=_['intersection'](_0x17c1b2[_0xd9ff('0x36')],qs['fields'](_0x3be850[_0xd9ff('0x37')][_0xd9ff('0x3c')]));_0x1c885f[_0xd9ff('0x3b')]=_0x1c885f[_0xd9ff('0x3b')][_0xd9ff('0x3d')]?_0x1c885f[_0xd9ff('0x3b')]:_0x17c1b2[_0xd9ff('0x36')];if(!_0x3be850[_0xd9ff('0x37')]['hasOwnProperty'](_0xd9ff('0x59'))){_0x1c885f[_0xd9ff('0x22')]=qs['limit'](_0x3be850['query'][_0xd9ff('0x22')]);_0x1c885f['offset']=qs[_0xd9ff('0x21')](_0x3be850[_0xd9ff('0x37')]['offset']);}_0x1c885f[_0xd9ff('0x3f')]=qs[_0xd9ff('0x40')](_0x3be850[_0xd9ff('0x37')][_0xd9ff('0x40')]);_0x1c885f[_0xd9ff('0x46')]=qs['filters'](_[_0xd9ff('0x5a')](_0x3be850['query'],_0x17c1b2['filters']));_0x1c885f[_0xd9ff('0x46')][_0xd9ff('0x5b')]=_0x39473e['id'];if(_0x3be850[_0xd9ff('0x37')][_0xd9ff('0x41')]){_0x1c885f['where']=_[_0xd9ff('0x42')](_0x1c885f[_0xd9ff('0x46')],{'$or':_[_0xd9ff('0x31')](_0x1c885f[_0xd9ff('0x3b')],function(_0x1bb042){var _0x255edf={};_0x255edf[_0x1bb042]={'$like':'%'+_0x3be850[_0xd9ff('0x37')][_0xd9ff('0x41')]+'%'};return _0x255edf;})});}_0x1c885f=_['merge']({},_0x1c885f,_0x3be850['options']);return db['UserSmsQueue'][_0xd9ff('0x49')](_0x1c885f);}})[_0xd9ff('0x26')](function(_0x514d59){if(_0x514d59){return db[_0xd9ff('0x5c')][_0xd9ff('0x5d')]({'where':{'id':_[_0xd9ff('0x31')](_0x514d59,_0xd9ff('0x5e')),'role':_0xd9ff('0x5f')},'attributes':['id',_0xd9ff('0x2f'),_0xd9ff('0x60'),_0xd9ff('0x61'),'createdAt']});}})[_0xd9ff('0x26')](function(_0x1ef766){if(_0x1ef766){return{'count':_0x1ef766[_0xd9ff('0x20')],'rows':_['map'](_0x1ef766[_0xd9ff('0x62')],function(_0x58c9c2){return{'membername':_0x58c9c2[_0xd9ff('0x2f')],'UserId':_0x58c9c2['id'],'queue_name':_0x5b17c0[_0xd9ff('0x2f')],'SmsQueueId':_0x5b17c0['id'],'interface':util[_0xd9ff('0x63')]('%s/%s',_0xd9ff('0x64'),_0x58c9c2[_0xd9ff('0x2f')]),'penalty':0x0,'paused':_0x58c9c2[_0xd9ff('0x60')],'createdAt':_0x58c9c2[_0xd9ff('0x65')],'updatedAt':_0x58c9c2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd9ff('0x26')](respondWithFilteredResult(_0x11251f,_0x1c885f))[_0xd9ff('0x4a')](handleError(_0x11251f,null));};exports[_0xd9ff('0x66')]=function(_0x53fca5,_0x29a562,_0x212f86){var _0x2619c9={};var _0x5c6bf3={};var _0xac6ee;var _0x35926f;return db[_0xd9ff('0x32')][_0xd9ff('0x57')]({'where':{'id':_0x53fca5[_0xd9ff('0x55')]['id']}})['then'](handleEntityNotFound(_0x29a562,null))[_0xd9ff('0x26')](function(_0x45e825){if(_0x45e825){_0xac6ee=_0x45e825;_0x5c6bf3['model']=_[_0xd9ff('0x38')](db[_0xd9ff('0x67')][_0xd9ff('0x33')]);_0x5c6bf3['query']=_[_0xd9ff('0x38')](_0x53fca5['query']);_0x5c6bf3[_0xd9ff('0x39')]=_['intersection'](_0x5c6bf3[_0xd9ff('0x36')],_0x5c6bf3[_0xd9ff('0x37')]);_0x2619c9[_0xd9ff('0x3b')]=_[_0xd9ff('0x3a')](_0x5c6bf3[_0xd9ff('0x36')],qs[_0xd9ff('0x3c')](_0x53fca5[_0xd9ff('0x37')][_0xd9ff('0x3c')]));_0x2619c9[_0xd9ff('0x3b')]=_0x2619c9[_0xd9ff('0x3b')]['length']?_0x2619c9[_0xd9ff('0x3b')]:_0x5c6bf3[_0xd9ff('0x36')];_0x2619c9[_0xd9ff('0x3f')]=qs[_0xd9ff('0x40')](_0x53fca5[_0xd9ff('0x37')][_0xd9ff('0x40')]);_0x2619c9['where']=qs['filters'](_[_0xd9ff('0x5a')](_0x53fca5[_0xd9ff('0x37')],_0x5c6bf3[_0xd9ff('0x39')]));if(_0x53fca5[_0xd9ff('0x37')][_0xd9ff('0x41')]){_0x2619c9[_0xd9ff('0x46')]=_['merge'](_0x2619c9[_0xd9ff('0x46')],{'$or':_[_0xd9ff('0x31')](_0x2619c9[_0xd9ff('0x3b')],function(_0x3d4953){var _0x14c89f={};_0x14c89f[_0x3d4953]={'$like':'%'+_0x53fca5[_0xd9ff('0x37')]['filter']+'%'};return _0x14c89f;})});}_0x2619c9=_[_0xd9ff('0x42')]({},_0x2619c9,_0x53fca5[_0xd9ff('0x45')]);return _0xac6ee[_0xd9ff('0x66')](_0x2619c9);}})[_0xd9ff('0x26')](function(_0x373a32){if(_0x373a32){_0x35926f=_0x373a32[_0xd9ff('0x3d')];if(!_0x53fca5[_0xd9ff('0x37')][_0xd9ff('0x3e')]('nolimit')){_0x2619c9[_0xd9ff('0x22')]=qs['limit'](_0x53fca5[_0xd9ff('0x37')][_0xd9ff('0x22')]);_0x2619c9[_0xd9ff('0x21')]=qs[_0xd9ff('0x21')](_0x53fca5[_0xd9ff('0x37')][_0xd9ff('0x21')]);}return _0xac6ee[_0xd9ff('0x66')](_0x2619c9);}})[_0xd9ff('0x26')](function(_0x2492fa){if(_0x2492fa){return _0x2492fa?{'count':_0x35926f,'rows':_0x2492fa}:null;}})[_0xd9ff('0x26')](respondWithResult(_0x29a562,null))[_0xd9ff('0x4a')](handleError(_0x29a562,null));};exports[_0xd9ff('0x68')]=function(_0xa908a3,_0x5d29b9,_0x4413c4){var _0x3d5742=_0xa908a3[_0xd9ff('0x4d')][_0xd9ff('0x69')];return db['Team'][_0xd9ff('0x49')]({'where':{'id':_0x3d5742},'attributes':['id'],'include':[{'model':db[_0xd9ff('0x5c')],'as':'Agents','attributes':['id',_0xd9ff('0x2f'),_0xd9ff('0x6a'),_0xd9ff('0x6b'),_0xd9ff('0x6c')],'raw':!![]}]})[_0xd9ff('0x26')](function(_0x6b2b42){if(_0x6b2b42){var _0x372747=_['flatMap'](_0x6b2b42,function(_0x3ac557){var _0x4dcadb=_0x3ac557[_0xd9ff('0x27')]({'plain':!![]});return _0x4dcadb[_0xd9ff('0x6d')];});return db[_0xd9ff('0x32')][_0xd9ff('0x51')]({'where':{'id':_0xa908a3[_0xd9ff('0x55')]['id']}})[_0xd9ff('0x26')](function(_0x2226bf){return db[_0xd9ff('0x6e')][_0xd9ff('0x6f')](function(_0x108583){return _0x2226bf[_0xd9ff('0x68')](_0x3d5742,{'transaction':_0x108583})['then'](function(){return BPromise[_0xd9ff('0x70')](_0x372747,function(_0x3ae3dd){return db['UserSmsQueue'][_0xd9ff('0x71')]({'where':{'UserId':_0x3ae3dd['id'],'SmsQueueId':_0xa908a3[_0xd9ff('0x55')]['id']},'transaction':_0x108583});});})[_0xd9ff('0x26')](function(){_0x372747[_0xd9ff('0x72')](function(_0x1332a9){socket[_0xd9ff('0x73')]('userSmsQueue:save',{'UserId':_0x1332a9['id'],'SmsQueueId':_0x2226bf['id']});});});});});}})['then'](respondWithStatusCode(_0x5d29b9,null))[_0xd9ff('0x4a')](handleError(_0x5d29b9,null));};exports['removeTeams']=function(_0x58da81,_0x4a55c1,_0x4b9359){return db[_0xd9ff('0x67')][_0xd9ff('0x49')]({'where':{'id':_0x58da81[_0xd9ff('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd9ff('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4a55c1,null))[_0xd9ff('0x26')](function(_0x4c50d2){var _0x338235=_[_0xd9ff('0x31')](_0x4c50d2,'id');var _0xdf0ca=[];var _0x1cb244=[];var _0x1938f1=squel['select']();_0x1938f1['field'](_0xd9ff('0x74'))[_0xd9ff('0x75')](_0xd9ff('0x76'),'tq')[_0xd9ff('0x77')](_0xd9ff('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd9ff('0x46')](_0xd9ff('0x79'),_0x58da81[_0xd9ff('0x55')]['id']);for(var _0x7fdc57=0x0;_0x7fdc57<_0x4c50d2[_0xd9ff('0x3d')];_0x7fdc57+=0x1){let _0x29dafb=_0x4c50d2[_0x7fdc57];for(var _0x38731a=0x0;_0x38731a<_0x29dafb[_0xd9ff('0x6d')][_0xd9ff('0x3d')];_0x38731a+=0x1){let _0x41b7e3=_0x29dafb[_0xd9ff('0x6d')][_0x38731a];var _0x311b25=_0x1938f1[_0xd9ff('0x7a')]();_0x311b25['where'](_0xd9ff('0x7b'),_0x41b7e3['id']);_0x1cb244[_0xd9ff('0x7c')](db['sequelize']['query'](_0x311b25[_0xd9ff('0x7d')](),{'type':db[_0xd9ff('0x6e')]['QueryTypes'][_0xd9ff('0x7e')]})[_0xd9ff('0x26')](function(_0x178b5c){if(_0x178b5c[_0xd9ff('0x3d')]===0x1){return _0x41b7e3['id'];}else{var _0x46a0fa=_[_0xd9ff('0x7f')](_[_0xd9ff('0x31')](_0x178b5c,_0xd9ff('0x80')),function(_0x564e90){return _['includes'](_0x338235,_0x564e90);});if(_0x46a0fa){return _0x41b7e3['id'];}}}));}}return BPromise['all'](_0x1cb244)[_0xd9ff('0x26')](function(_0x610088){_0xdf0ca=_(_0xdf0ca)[_0xd9ff('0x81')](_0x610088)['compact']()[_0xd9ff('0x82')]();return db[_0xd9ff('0x32')][_0xd9ff('0x51')]({'where':{'id':_0x58da81[_0xd9ff('0x55')]['id']}})[_0xd9ff('0x26')](function(_0x6c45b3){return db['sequelize'][_0xd9ff('0x6f')](function(_0x514aa0){return _0x6c45b3[_0xd9ff('0x83')](_0x58da81[_0xd9ff('0x37')][_0xd9ff('0x69')],{'transaction':_0x514aa0})[_0xd9ff('0x26')](function(){if(!_['isEmpty'](_0xdf0ca)){return _0x6c45b3[_0xd9ff('0x84')](_0xdf0ca,{'transaction':_0x514aa0});}})[_0xd9ff('0x26')](function(){_0xdf0ca['forEach'](function(_0x59bcd4){socket['emit'](_0xd9ff('0x85'),{'UserId':_0x59bcd4,'SmsQueueId':_0x6c45b3['id']});});});});});});})[_0xd9ff('0x26')](respondWithStatusCode(_0x4a55c1,null))['catch'](handleError(_0x4a55c1,null));};exports[_0xd9ff('0x86')]=function(_0x149791,_0x16e130,_0x4f6eef){return db['SmsQueue']['find']({'where':{'id':_0x149791[_0xd9ff('0x55')]['id']}})['then'](handleEntityNotFound(_0x16e130,null))[_0xd9ff('0x26')](function(_0x1fbfcf){if(_0x1fbfcf){return _0x1fbfcf['addAgents'](_0x149791[_0xd9ff('0x4d')][_0xd9ff('0x69')],_[_0xd9ff('0x87')](_0x149791[_0xd9ff('0x4d')],[_0xd9ff('0x69'),'id'])||{})['spread'](function(_0xd46620){for(var _0x5d0d2e=0x0;_0x5d0d2e<_0x149791['body']['ids'][_0xd9ff('0x3d')];_0x5d0d2e+=0x1){socket[_0xd9ff('0x73')](_0xd9ff('0x88'),{'UserId':_0x149791[_0xd9ff('0x4d')]['ids'][_0x5d0d2e],'SmsQueueId':_0x149791['params']['id']});}return _0xd46620;});}})[_0xd9ff('0x26')](respondWithResult(_0x16e130,null))[_0xd9ff('0x4a')](handleError(_0x16e130,null));};exports[_0xd9ff('0x84')]=function(_0x443e0a,_0x28afbb,_0x490a21){return db['SmsQueue'][_0xd9ff('0x51')]({'where':{'id':_0x443e0a[_0xd9ff('0x55')]['id']}})[_0xd9ff('0x26')](handleEntityNotFound(_0x28afbb,null))[_0xd9ff('0x26')](function(_0x6d92e8){if(_0x6d92e8){return _0x6d92e8[_0xd9ff('0x84')](_0x443e0a['query'][_0xd9ff('0x69')])['then'](function(){if(_['isArray'](_0x443e0a[_0xd9ff('0x37')][_0xd9ff('0x69')])){for(var _0x33fee6=0x0;_0x33fee6<_0x443e0a[_0xd9ff('0x37')]['ids']['length'];_0x33fee6+=0x1){socket[_0xd9ff('0x73')]('userSmsQueue:remove',{'UserId':Number(_0x443e0a['query'][_0xd9ff('0x69')][_0x33fee6]),'SmsQueueId':Number(_0x443e0a['params']['id'])});}}else{socket[_0xd9ff('0x73')]('userSmsQueue:remove',{'UserId':Number(_0x443e0a[_0xd9ff('0x37')][_0xd9ff('0x69')]),'SmsQueueId':Number(_0x443e0a[_0xd9ff('0x55')]['id'])});}});}})[_0xd9ff('0x26')](respondWithStatusCode(_0x28afbb,null))[_0xd9ff('0x4a')](handleError(_0x28afbb,null));};exports[_0xd9ff('0x89')]=function(_0x2a4aea,_0x4cf14b,_0x30967e){var _0x5da105={};var _0x591d44={};var _0x181512;var _0x1aff49;return db['SmsQueue'][_0xd9ff('0x57')]({'where':{'id':_0x2a4aea['params']['id']}})['then'](handleEntityNotFound(_0x4cf14b,null))[_0xd9ff('0x26')](function(_0x2823a2){if(_0x2823a2){_0x181512=_0x2823a2;_0x591d44[_0xd9ff('0x36')]=_[_0xd9ff('0x38')](db[_0xd9ff('0x5c')][_0xd9ff('0x33')]);_0x591d44[_0xd9ff('0x37')]=_[_0xd9ff('0x38')](_0x2a4aea[_0xd9ff('0x37')]);_0x591d44[_0xd9ff('0x39')]=_[_0xd9ff('0x3a')](_0x591d44[_0xd9ff('0x36')],_0x591d44[_0xd9ff('0x37')]);_0x5da105['attributes']=_['intersection'](_0x591d44['model'],qs[_0xd9ff('0x3c')](_0x2a4aea['query'][_0xd9ff('0x3c')]));_0x5da105[_0xd9ff('0x3b')]=_0x5da105[_0xd9ff('0x3b')][_0xd9ff('0x3d')]?_0x5da105['attributes']:_0x591d44[_0xd9ff('0x36')];_0x5da105['order']=qs[_0xd9ff('0x40')](_0x2a4aea['query']['sort']);_0x5da105['where']=qs[_0xd9ff('0x39')](_['pick'](_0x2a4aea[_0xd9ff('0x37')],_0x591d44['filters']));if(_0x2a4aea[_0xd9ff('0x37')][_0xd9ff('0x41')]){_0x5da105[_0xd9ff('0x46')]=_[_0xd9ff('0x42')](_0x5da105[_0xd9ff('0x46')],{'$or':_[_0xd9ff('0x31')](_0x5da105['attributes'],function(_0x58b4e3){var _0x2f09f3={};_0x2f09f3[_0x58b4e3]={'$like':'%'+_0x2a4aea[_0xd9ff('0x37')][_0xd9ff('0x41')]+'%'};return _0x2f09f3;})});}_0x5da105=_[_0xd9ff('0x42')]({},_0x5da105,_0x2a4aea[_0xd9ff('0x45')]);return _0x181512['getAgents'](_0x5da105);}})[_0xd9ff('0x26')](function(_0x4542e9){if(_0x4542e9){_0x1aff49=_0x4542e9[_0xd9ff('0x3d')];if(!_0x2a4aea[_0xd9ff('0x37')][_0xd9ff('0x3e')](_0xd9ff('0x59'))){_0x5da105['limit']=qs[_0xd9ff('0x22')](_0x2a4aea[_0xd9ff('0x37')][_0xd9ff('0x22')]);_0x5da105[_0xd9ff('0x21')]=qs[_0xd9ff('0x21')](_0x2a4aea[_0xd9ff('0x37')][_0xd9ff('0x21')]);}return _0x181512[_0xd9ff('0x89')](_0x5da105);}})[_0xd9ff('0x26')](function(_0x12a989){if(_0x12a989){return _0x12a989?{'count':_0x1aff49,'rows':_0x12a989}:null;}})[_0xd9ff('0x26')](respondWithResult(_0x4cf14b,null))[_0xd9ff('0x4a')](handleError(_0x4cf14b,null));}; \ No newline at end of file +var _0x4fc2=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','index','map','SmsQueue','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','UserSmsQueue','nolimit','SmsQueueId','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','Team','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','forEach','userSmsQueue:save','removeTeams','field','tq.TeamId','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','isEmpty','userSmsQueue:remove','addAgents','emit','removeAgents','isArray','getAgents','findOne','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x4fc2,0x111));var _0x24fc=function(_0x2e92c2,_0x381855){_0x2e92c2=_0x2e92c2-0x0;var _0x37105f=_0x4fc2[_0x2e92c2];return _0x37105f;};'use strict';var pdf=require(_0x24fc('0x0'));var emlformat=require(_0x24fc('0x1'));var rimraf=require(_0x24fc('0x2'));var zipdir=require(_0x24fc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24fc('0x4'));var moment=require(_0x24fc('0x5'));var BPromise=require(_0x24fc('0x6'));var Mustache=require('mustache');var util=require(_0x24fc('0x7'));var path=require(_0x24fc('0x8'));var sox=require('sox');var csv=require(_0x24fc('0x9'));var ejs=require(_0x24fc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x24fc('0xb'));var squel=require(_0x24fc('0xc'));var crypto=require(_0x24fc('0xd'));var jsforce=require(_0x24fc('0xe'));var deskjs=require(_0x24fc('0xf'));var toCsv=require(_0x24fc('0x9'));var querystring=require('querystring');var Papa=require(_0x24fc('0x10'));var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var hardwareService=require(_0x24fc('0x15'));var logger=require(_0x24fc('0x16'))(_0x24fc('0x17'));var utils=require('../../config/utils');var config=require(_0x24fc('0x18'));var licenseUtil=require(_0x24fc('0x19'));var db=require('../../mysqldb')['db'];config[_0x24fc('0x1a')]=_[_0x24fc('0x1b')](config[_0x24fc('0x1a')],{'host':_0x24fc('0x1c'),'port':0x18eb});var socket=require(_0x24fc('0x1d'))(new Redis(config[_0x24fc('0x1a')]));require('./smsQueue.socket')[_0x24fc('0x1e')](socket);function respondWithStatusCode(_0x18c0a7,_0x2ffed3){_0x2ffed3=_0x2ffed3||0xcc;return function(_0x42cbe8){if(_0x42cbe8){return _0x18c0a7['sendStatus'](_0x2ffed3);}return _0x18c0a7[_0x24fc('0x1f')](_0x2ffed3)['end']();};}function respondWithResult(_0x4af098,_0x3385c7){_0x3385c7=_0x3385c7||0xc8;return function(_0x218fb6){if(_0x218fb6){return _0x4af098[_0x24fc('0x1f')](_0x3385c7)[_0x24fc('0x20')](_0x218fb6);}};}function respondWithFilteredResult(_0x52a884,_0x23873c){return function(_0x1cb3d0){if(_0x1cb3d0){var _0x6cfa0a=_0x1cb3d0[_0x24fc('0x21')],_0x8ac114=_0x23873c[_0x24fc('0x22')],_0x4c5a43=_0x23873c['offset']+_0x23873c[_0x24fc('0x23')],_0x5eabee;if(_0x4c5a43>=_0x6cfa0a){_0x4c5a43=_0x6cfa0a;_0x5eabee=0xc8;}else{_0x5eabee=0xce;}_0x52a884[_0x24fc('0x1f')](_0x5eabee);return _0x52a884[_0x24fc('0x24')](_0x24fc('0x25'),_0x8ac114+'-'+_0x4c5a43+'/'+_0x6cfa0a)['json'](_0x1cb3d0);}return null;};}function patchUpdates(_0x323beb){return function(_0x545939){try{jsonpatch[_0x24fc('0x26')](_0x545939,_0x323beb,!![]);}catch(_0x591c8f){return BPromise[_0x24fc('0x27')](_0x591c8f);}return _0x545939[_0x24fc('0x28')]();};}function saveUpdates(_0x2ffade,_0x595475){return function(_0x313a25){if(_0x313a25){return _0x313a25['update'](_0x2ffade)[_0x24fc('0x29')](function(_0x2bb93a){return _0x2bb93a;});}return null;};}function removeEntity(_0x36a9b4,_0x34b5b2){return function(_0x3296fc){if(_0x3296fc){return _0x3296fc[_0x24fc('0x2a')]()[_0x24fc('0x29')](function(){var _0x20192b=_0x3296fc[_0x24fc('0x2b')]({'plain':!![]});var _0x2a5c4b='SmsQueues';return db[_0x24fc('0x2c')][_0x24fc('0x2a')]({'where':{'type':_0x2a5c4b,'resourceId':_0x20192b['id']}})[_0x24fc('0x29')](function(){return _0x3296fc;});})['then'](function(){_0x36a9b4[_0x24fc('0x1f')](0xcc)[_0x24fc('0x2d')]();});}};}function handleEntityNotFound(_0x35f9f9,_0x290f84){return function(_0x8f2528){if(!_0x8f2528){_0x35f9f9[_0x24fc('0x2e')](0x194);}return _0x8f2528;};}function handleError(_0x5ac1f2,_0x240ae7){_0x240ae7=_0x240ae7||0x1f4;return function(_0x29a461){logger[_0x24fc('0x2f')](_0x29a461[_0x24fc('0x30')]);if(_0x29a461[_0x24fc('0x31')]){delete _0x29a461['name'];}_0x5ac1f2['status'](_0x240ae7)['send'](_0x29a461);};}exports[_0x24fc('0x32')]=function(_0x574ba3,_0x3f2464){var _0x3e6389={},_0xae4f22={},_0x2086c0={'count':0x0,'rows':[]};var _0x4dbd52=_[_0x24fc('0x33')](db[_0x24fc('0x34')]['rawAttributes'],function(_0xf46cd5){return{'name':_0xf46cd5[_0x24fc('0x35')],'type':_0xf46cd5['type']['key']};});_0xae4f22[_0x24fc('0x36')]=_['map'](_0x4dbd52,_0x24fc('0x31'));_0xae4f22[_0x24fc('0x37')]=_['keys'](_0x574ba3[_0x24fc('0x37')]);_0xae4f22[_0x24fc('0x38')]=_[_0x24fc('0x39')](_0xae4f22[_0x24fc('0x36')],_0xae4f22[_0x24fc('0x37')]);_0x3e6389[_0x24fc('0x3a')]=_[_0x24fc('0x39')](_0xae4f22[_0x24fc('0x36')],qs[_0x24fc('0x3b')](_0x574ba3['query'][_0x24fc('0x3b')]));_0x3e6389[_0x24fc('0x3a')]=_0x3e6389[_0x24fc('0x3a')][_0x24fc('0x3c')]?_0x3e6389[_0x24fc('0x3a')]:_0xae4f22['model'];if(!_0x574ba3['query'][_0x24fc('0x3d')]('nolimit')){_0x3e6389[_0x24fc('0x23')]=qs[_0x24fc('0x23')](_0x574ba3[_0x24fc('0x37')][_0x24fc('0x23')]);_0x3e6389['offset']=qs[_0x24fc('0x22')](_0x574ba3['query'][_0x24fc('0x22')]);}_0x3e6389[_0x24fc('0x3e')]=qs[_0x24fc('0x3f')](_0x574ba3[_0x24fc('0x37')][_0x24fc('0x3f')]);_0x3e6389['where']=qs[_0x24fc('0x38')](_[_0x24fc('0x40')](_0x574ba3[_0x24fc('0x37')],_0xae4f22[_0x24fc('0x38')]),_0x4dbd52);if(_0x574ba3['query'][_0x24fc('0x41')]){_0x3e6389[_0x24fc('0x42')]=_['merge'](_0x3e6389[_0x24fc('0x42')],{'$or':_['map'](_0x4dbd52,function(_0x320f7b){if(_0x320f7b[_0x24fc('0x43')]!==_0x24fc('0x44')){var _0x1e045a={};_0x1e045a[_0x320f7b[_0x24fc('0x31')]]={'$like':'%'+_0x574ba3[_0x24fc('0x37')][_0x24fc('0x41')]+'%'};return _0x1e045a;}})});}_0x3e6389=_[_0x24fc('0x45')]({},_0x3e6389,_0x574ba3['options']);var _0x1721ea={'where':_0x3e6389[_0x24fc('0x42')]};return db[_0x24fc('0x34')]['count'](_0x1721ea)[_0x24fc('0x29')](function(_0x1e3b52){_0x2086c0['count']=_0x1e3b52;if(_0x574ba3[_0x24fc('0x37')][_0x24fc('0x46')]){_0x3e6389[_0x24fc('0x47')]=[{'all':!![]}];}return db['SmsQueue'][_0x24fc('0x48')](_0x3e6389);})[_0x24fc('0x29')](function(_0x585e48){_0x2086c0[_0x24fc('0x49')]=_0x585e48;return _0x2086c0;})[_0x24fc('0x29')](respondWithFilteredResult(_0x3f2464,_0x3e6389))[_0x24fc('0x4a')](handleError(_0x3f2464,null));};exports[_0x24fc('0x4b')]=function(_0x4c8dad,_0x2eecaf){var _0x9bc56a={'raw':!![],'where':{'id':_0x4c8dad[_0x24fc('0x4c')]['id']}},_0x3ce7b3={};_0x3ce7b3[_0x24fc('0x36')]=_['keys'](db[_0x24fc('0x34')][_0x24fc('0x4d')]);_0x3ce7b3[_0x24fc('0x37')]=_[_0x24fc('0x4e')](_0x4c8dad['query']);_0x3ce7b3[_0x24fc('0x38')]=_[_0x24fc('0x39')](_0x3ce7b3['model'],_0x3ce7b3['query']);_0x9bc56a[_0x24fc('0x3a')]=_['intersection'](_0x3ce7b3['model'],qs[_0x24fc('0x3b')](_0x4c8dad['query'][_0x24fc('0x3b')]));_0x9bc56a[_0x24fc('0x3a')]=_0x9bc56a[_0x24fc('0x3a')]['length']?_0x9bc56a[_0x24fc('0x3a')]:_0x3ce7b3[_0x24fc('0x36')];if(_0x4c8dad[_0x24fc('0x37')][_0x24fc('0x46')]){_0x9bc56a[_0x24fc('0x47')]=[{'all':!![]}];}_0x9bc56a=_[_0x24fc('0x45')]({},_0x9bc56a,_0x4c8dad[_0x24fc('0x4f')]);return db[_0x24fc('0x34')]['find'](_0x9bc56a)['then'](handleEntityNotFound(_0x2eecaf,null))[_0x24fc('0x29')](respondWithResult(_0x2eecaf,null))[_0x24fc('0x4a')](handleError(_0x2eecaf,null));};exports[_0x24fc('0x50')]=function(_0x5b5e7a,_0x557316){return db[_0x24fc('0x34')][_0x24fc('0x50')](_0x5b5e7a[_0x24fc('0x51')],{})[_0x24fc('0x29')](function(_0x21f8b8){var _0x42e22a=_0x5b5e7a[_0x24fc('0x52')][_0x24fc('0x2b')]({'plain':!![]});if(!_0x42e22a)throw new Error(_0x24fc('0x53'));if(_0x42e22a[_0x24fc('0x54')]===_0x24fc('0x52')){var _0x676f02=_0x21f8b8['get']({'plain':!![]});var _0x1c9a28=_0x24fc('0x55');return db[_0x24fc('0x56')][_0x24fc('0x57')]({'where':{'name':_0x1c9a28,'userProfileId':_0x42e22a[_0x24fc('0x58')]},'raw':!![]})['then'](function(_0x428012){if(_0x428012&&_0x428012['autoAssociation']===0x0){return db[_0x24fc('0x2c')][_0x24fc('0x50')]({'name':_0x676f02[_0x24fc('0x31')],'resourceId':_0x676f02['id'],'type':_0x428012[_0x24fc('0x31')],'sectionId':_0x428012['id']},{})[_0x24fc('0x29')](function(){return _0x21f8b8;});}else{return _0x21f8b8;}})[_0x24fc('0x4a')](function(_0x4c9216){logger[_0x24fc('0x2f')](_0x24fc('0x59'),_0x4c9216);throw _0x4c9216;});}return _0x21f8b8;})[_0x24fc('0x29')](respondWithResult(_0x557316,0xc9))[_0x24fc('0x4a')](handleError(_0x557316,null));};exports[_0x24fc('0x5a')]=function(_0x870767,_0x540b22){if(_0x870767[_0x24fc('0x51')]['id']){delete _0x870767[_0x24fc('0x51')]['id'];}return db[_0x24fc('0x34')][_0x24fc('0x57')]({'where':{'id':_0x870767[_0x24fc('0x4c')]['id']}})[_0x24fc('0x29')](handleEntityNotFound(_0x540b22,null))[_0x24fc('0x29')](saveUpdates(_0x870767['body'],null))[_0x24fc('0x29')](respondWithResult(_0x540b22,null))[_0x24fc('0x4a')](handleError(_0x540b22,null));};exports['destroy']=function(_0x1368f6,_0x192aa8){return db[_0x24fc('0x34')][_0x24fc('0x57')]({'where':{'id':_0x1368f6[_0x24fc('0x4c')]['id']}})[_0x24fc('0x29')](handleEntityNotFound(_0x192aa8,null))['then'](removeEntity(_0x192aa8,null))[_0x24fc('0x4a')](handleError(_0x192aa8,null));};exports['describe']=function(_0x3e9644,_0x8c9649){return db['SmsQueue'][_0x24fc('0x5b')]()['then'](respondWithResult(_0x8c9649,null))[_0x24fc('0x4a')](handleError(_0x8c9649,null));};exports['getMembers']=function(_0xdff811,_0x27b612,_0x57daaf){var _0x2edef7={'raw':!![],'where':{}},_0x5d6539={},_0x191bc6;return db[_0x24fc('0x34')]['findOne']({'where':{'id':_0xdff811[_0x24fc('0x4c')]['id']}})[_0x24fc('0x29')](handleEntityNotFound(_0x27b612,null))[_0x24fc('0x29')](function(_0x47179d){if(_0x47179d){_0x191bc6=_0x47179d[_0x24fc('0x2b')]({'plain':!![]});_0x5d6539['model']=_[_0x24fc('0x4e')](db[_0x24fc('0x5c')][_0x24fc('0x4d')]);_0x5d6539[_0x24fc('0x37')]=_[_0x24fc('0x4e')](_0xdff811['query']);_0x5d6539['filters']=_[_0x24fc('0x39')](_0x5d6539[_0x24fc('0x36')],_0x5d6539['query']);_0x2edef7['attributes']=_[_0x24fc('0x39')](_0x5d6539[_0x24fc('0x36')],qs[_0x24fc('0x3b')](_0xdff811[_0x24fc('0x37')]['fields']));_0x2edef7[_0x24fc('0x3a')]=_0x2edef7[_0x24fc('0x3a')][_0x24fc('0x3c')]?_0x2edef7[_0x24fc('0x3a')]:_0x5d6539[_0x24fc('0x36')];if(!_0xdff811[_0x24fc('0x37')][_0x24fc('0x3d')](_0x24fc('0x5d'))){_0x2edef7[_0x24fc('0x23')]=qs[_0x24fc('0x23')](_0xdff811[_0x24fc('0x37')][_0x24fc('0x23')]);_0x2edef7[_0x24fc('0x22')]=qs[_0x24fc('0x22')](_0xdff811[_0x24fc('0x37')]['offset']);}_0x2edef7[_0x24fc('0x3e')]=qs[_0x24fc('0x3f')](_0xdff811[_0x24fc('0x37')][_0x24fc('0x3f')]);_0x2edef7[_0x24fc('0x42')]=qs[_0x24fc('0x38')](_[_0x24fc('0x40')](_0xdff811[_0x24fc('0x37')],_0x5d6539['filters']));_0x2edef7[_0x24fc('0x42')][_0x24fc('0x5e')]=_0x47179d['id'];if(_0xdff811[_0x24fc('0x37')][_0x24fc('0x41')]){_0x2edef7['where']=_[_0x24fc('0x45')](_0x2edef7[_0x24fc('0x42')],{'$or':_['map'](_0x2edef7['attributes'],function(_0x4f97b7){var _0x2ae2ac={};_0x2ae2ac[_0x4f97b7]={'$like':'%'+_0xdff811[_0x24fc('0x37')][_0x24fc('0x41')]+'%'};return _0x2ae2ac;})});}_0x2edef7=_[_0x24fc('0x45')]({},_0x2edef7,_0xdff811[_0x24fc('0x4f')]);return db[_0x24fc('0x5c')]['findAll'](_0x2edef7);}})[_0x24fc('0x29')](function(_0x15e8a3){if(_0x15e8a3){return db['User']['findAndCountAll']({'where':{'id':_[_0x24fc('0x33')](_0x15e8a3,_0x24fc('0x5f')),'role':_0x24fc('0x60')},'attributes':['id','name',_0x24fc('0x61'),_0x24fc('0x62'),_0x24fc('0x63')]});}})['then'](function(_0x546e7c){if(_0x546e7c){return{'count':_0x546e7c['count'],'rows':_['map'](_0x546e7c['rows'],function(_0x10ef7c){return{'membername':_0x10ef7c[_0x24fc('0x31')],'UserId':_0x10ef7c['id'],'queue_name':_0x191bc6[_0x24fc('0x31')],'SmsQueueId':_0x191bc6['id'],'interface':util[_0x24fc('0x64')]('%s/%s',_0x24fc('0x65'),_0x10ef7c['name']),'penalty':0x0,'paused':_0x10ef7c[_0x24fc('0x61')],'createdAt':_0x10ef7c['createdAt'],'updatedAt':_0x10ef7c[_0x24fc('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x24fc('0x29')](respondWithFilteredResult(_0x27b612,_0x2edef7))[_0x24fc('0x4a')](handleError(_0x27b612,null));};exports[_0x24fc('0x66')]=function(_0x3c4e2c,_0x291d60,_0x35c5f7){var _0x591ec6={};var _0x45513e={};var _0x302992;var _0x2de101;return db['SmsQueue']['findOne']({'where':{'id':_0x3c4e2c[_0x24fc('0x4c')]['id']}})[_0x24fc('0x29')](handleEntityNotFound(_0x291d60,null))['then'](function(_0x42b972){if(_0x42b972){_0x302992=_0x42b972;_0x45513e[_0x24fc('0x36')]=_['keys'](db[_0x24fc('0x67')][_0x24fc('0x4d')]);_0x45513e['query']=_[_0x24fc('0x4e')](_0x3c4e2c[_0x24fc('0x37')]);_0x45513e[_0x24fc('0x38')]=_[_0x24fc('0x39')](_0x45513e[_0x24fc('0x36')],_0x45513e[_0x24fc('0x37')]);_0x591ec6['attributes']=_['intersection'](_0x45513e[_0x24fc('0x36')],qs['fields'](_0x3c4e2c[_0x24fc('0x37')]['fields']));_0x591ec6['attributes']=_0x591ec6[_0x24fc('0x3a')][_0x24fc('0x3c')]?_0x591ec6[_0x24fc('0x3a')]:_0x45513e[_0x24fc('0x36')];_0x591ec6[_0x24fc('0x3e')]=qs[_0x24fc('0x3f')](_0x3c4e2c[_0x24fc('0x37')][_0x24fc('0x3f')]);_0x591ec6['where']=qs[_0x24fc('0x38')](_[_0x24fc('0x40')](_0x3c4e2c['query'],_0x45513e['filters']));if(_0x3c4e2c[_0x24fc('0x37')][_0x24fc('0x41')]){_0x591ec6[_0x24fc('0x42')]=_[_0x24fc('0x45')](_0x591ec6[_0x24fc('0x42')],{'$or':_['map'](_0x591ec6[_0x24fc('0x3a')],function(_0xcb7986){var _0x5ca35b={};_0x5ca35b[_0xcb7986]={'$like':'%'+_0x3c4e2c[_0x24fc('0x37')][_0x24fc('0x41')]+'%'};return _0x5ca35b;})});}_0x591ec6=_[_0x24fc('0x45')]({},_0x591ec6,_0x3c4e2c['options']);return _0x302992[_0x24fc('0x66')](_0x591ec6);}})[_0x24fc('0x29')](function(_0x3399fe){if(_0x3399fe){_0x2de101=_0x3399fe[_0x24fc('0x3c')];if(!_0x3c4e2c[_0x24fc('0x37')][_0x24fc('0x3d')](_0x24fc('0x5d'))){_0x591ec6[_0x24fc('0x23')]=qs[_0x24fc('0x23')](_0x3c4e2c['query'][_0x24fc('0x23')]);_0x591ec6[_0x24fc('0x22')]=qs[_0x24fc('0x22')](_0x3c4e2c['query']['offset']);}return _0x302992['getTeams'](_0x591ec6);}})[_0x24fc('0x29')](function(_0x560c80){if(_0x560c80){return _0x560c80?{'count':_0x2de101,'rows':_0x560c80}:null;}})[_0x24fc('0x29')](respondWithResult(_0x291d60,null))[_0x24fc('0x4a')](handleError(_0x291d60,null));};exports['addTeams']=function(_0x23ec74,_0x559692,_0x41cef7){var _0x57e241=_0x23ec74[_0x24fc('0x51')][_0x24fc('0x68')];return db[_0x24fc('0x67')][_0x24fc('0x48')]({'where':{'id':_0x57e241},'attributes':['id'],'include':[{'model':db[_0x24fc('0x69')],'as':_0x24fc('0x6a'),'attributes':['id','name',_0x24fc('0x6b'),_0x24fc('0x6c'),_0x24fc('0x6d')],'raw':!![]}]})[_0x24fc('0x29')](function(_0xc9e77c){if(_0xc9e77c){var _0x328d4d=_[_0x24fc('0x6e')](_0xc9e77c,function(_0x3f21c0){var _0x1b3db1=_0x3f21c0['get']({'plain':!![]});return _0x1b3db1[_0x24fc('0x6a')];});return db[_0x24fc('0x34')][_0x24fc('0x57')]({'where':{'id':_0x23ec74[_0x24fc('0x4c')]['id']}})['then'](function(_0xf321e4){return db[_0x24fc('0x6f')][_0x24fc('0x70')](function(_0x59411e){return _0xf321e4[_0x24fc('0x71')](_0x57e241,{'transaction':_0x59411e})['then'](function(){return BPromise['each'](_0x328d4d,function(_0x4e7c8b){return db[_0x24fc('0x5c')]['findOrCreate']({'where':{'UserId':_0x4e7c8b['id'],'SmsQueueId':_0x23ec74[_0x24fc('0x4c')]['id']},'transaction':_0x59411e});});})[_0x24fc('0x29')](function(){_0x328d4d[_0x24fc('0x72')](function(_0x10abf7){socket['emit'](_0x24fc('0x73'),{'UserId':_0x10abf7['id'],'SmsQueueId':_0xf321e4['id']});});});});});}})[_0x24fc('0x29')](respondWithStatusCode(_0x559692,null))[_0x24fc('0x4a')](handleError(_0x559692,null));};exports[_0x24fc('0x74')]=function(_0x37929c,_0x5c80a5,_0x2055d2){return db[_0x24fc('0x67')][_0x24fc('0x48')]({'where':{'id':_0x37929c[_0x24fc('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x24fc('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x24fc('0x29')](handleEntityNotFound(_0x5c80a5,null))[_0x24fc('0x29')](function(_0x188d0d){var _0x1f263c=_['map'](_0x188d0d,'id');var _0x44e610=[];var _0x31dad1=[];var _0x95ecb1=squel['select']();_0x95ecb1[_0x24fc('0x75')](_0x24fc('0x76'))[_0x24fc('0x77')](_0x24fc('0x78'),'tq')[_0x24fc('0x79')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x24fc('0x7a'),_0x37929c[_0x24fc('0x4c')]['id']);for(var _0x2b7be3=0x0;_0x2b7be3<_0x188d0d[_0x24fc('0x3c')];_0x2b7be3+=0x1){let _0x181633=_0x188d0d[_0x2b7be3];for(var _0x2ac3e8=0x0;_0x2ac3e8<_0x181633[_0x24fc('0x6a')][_0x24fc('0x3c')];_0x2ac3e8+=0x1){let _0x382a1c=_0x181633[_0x24fc('0x6a')][_0x2ac3e8];var _0x31ae7d=_0x95ecb1[_0x24fc('0x7b')]();_0x31ae7d['where']('ut.UserId\x20=\x20?',_0x382a1c['id']);_0x31dad1[_0x24fc('0x7c')](db['sequelize'][_0x24fc('0x37')](_0x31ae7d[_0x24fc('0x7d')](),{'type':db[_0x24fc('0x6f')][_0x24fc('0x7e')][_0x24fc('0x7f')]})[_0x24fc('0x29')](function(_0x40be24){if(_0x40be24[_0x24fc('0x3c')]===0x1){return _0x382a1c['id'];}else{var _0x45978b=_['every'](_[_0x24fc('0x33')](_0x40be24,_0x24fc('0x80')),function(_0x5b310c){return _['includes'](_0x1f263c,_0x5b310c);});if(_0x45978b){return _0x382a1c['id'];}}}));}}return BPromise[_0x24fc('0x81')](_0x31dad1)[_0x24fc('0x29')](function(_0x5407a9){_0x44e610=_(_0x44e610)[_0x24fc('0x82')](_0x5407a9)[_0x24fc('0x83')]()[_0x24fc('0x84')]();return db['SmsQueue'][_0x24fc('0x57')]({'where':{'id':_0x37929c[_0x24fc('0x4c')]['id']}})[_0x24fc('0x29')](function(_0x124728){return db['sequelize'][_0x24fc('0x70')](function(_0x10519f){return _0x124728[_0x24fc('0x74')](_0x37929c['query'][_0x24fc('0x68')],{'transaction':_0x10519f})[_0x24fc('0x29')](function(){if(!_[_0x24fc('0x85')](_0x44e610)){return _0x124728['removeAgents'](_0x44e610,{'transaction':_0x10519f});}})[_0x24fc('0x29')](function(){_0x44e610[_0x24fc('0x72')](function(_0x59d704){socket['emit'](_0x24fc('0x86'),{'UserId':_0x59d704,'SmsQueueId':_0x124728['id']});});});});});});})[_0x24fc('0x29')](respondWithStatusCode(_0x5c80a5,null))[_0x24fc('0x4a')](handleError(_0x5c80a5,null));};exports[_0x24fc('0x87')]=function(_0x783cb2,_0x3afe80,_0x590d99){return db[_0x24fc('0x34')][_0x24fc('0x57')]({'where':{'id':_0x783cb2[_0x24fc('0x4c')]['id']}})[_0x24fc('0x29')](handleEntityNotFound(_0x3afe80,null))[_0x24fc('0x29')](function(_0x39994e){if(_0x39994e){return _0x39994e['addAgents'](_0x783cb2[_0x24fc('0x51')]['ids'],_['omit'](_0x783cb2[_0x24fc('0x51')],[_0x24fc('0x68'),'id'])||{})['spread'](function(_0x94a2b2){for(var _0x45e8da=0x0;_0x45e8da<_0x783cb2[_0x24fc('0x51')][_0x24fc('0x68')]['length'];_0x45e8da+=0x1){socket[_0x24fc('0x88')](_0x24fc('0x73'),{'UserId':_0x783cb2[_0x24fc('0x51')][_0x24fc('0x68')][_0x45e8da],'SmsQueueId':_0x783cb2[_0x24fc('0x4c')]['id']});}return _0x94a2b2;});}})[_0x24fc('0x29')](respondWithResult(_0x3afe80,null))['catch'](handleError(_0x3afe80,null));};exports['removeAgents']=function(_0x5b4875,_0xc4f001,_0x3fb8fc){return db['SmsQueue'][_0x24fc('0x57')]({'where':{'id':_0x5b4875[_0x24fc('0x4c')]['id']}})[_0x24fc('0x29')](handleEntityNotFound(_0xc4f001,null))['then'](function(_0x286949){if(_0x286949){return _0x286949[_0x24fc('0x89')](_0x5b4875['query']['ids'])[_0x24fc('0x29')](function(){if(_[_0x24fc('0x8a')](_0x5b4875[_0x24fc('0x37')]['ids'])){for(var _0x2e4e38=0x0;_0x2e4e38<_0x5b4875['query']['ids'][_0x24fc('0x3c')];_0x2e4e38+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5b4875[_0x24fc('0x37')]['ids'][_0x2e4e38]),'SmsQueueId':Number(_0x5b4875[_0x24fc('0x4c')]['id'])});}}else{socket[_0x24fc('0x88')](_0x24fc('0x86'),{'UserId':Number(_0x5b4875[_0x24fc('0x37')]['ids']),'SmsQueueId':Number(_0x5b4875[_0x24fc('0x4c')]['id'])});}});}})[_0x24fc('0x29')](respondWithStatusCode(_0xc4f001,null))['catch'](handleError(_0xc4f001,null));};exports[_0x24fc('0x8b')]=function(_0x22aa52,_0x30d523,_0x8b1efd){var _0x2a19f9={};var _0x547712={};var _0x1f0dd9;var _0x1d4d91;return db['SmsQueue'][_0x24fc('0x8c')]({'where':{'id':_0x22aa52[_0x24fc('0x4c')]['id']}})[_0x24fc('0x29')](handleEntityNotFound(_0x30d523,null))[_0x24fc('0x29')](function(_0x18197a){if(_0x18197a){_0x1f0dd9=_0x18197a;_0x547712['model']=_[_0x24fc('0x4e')](db['User']['rawAttributes']);_0x547712[_0x24fc('0x37')]=_[_0x24fc('0x4e')](_0x22aa52[_0x24fc('0x37')]);_0x547712['filters']=_['intersection'](_0x547712[_0x24fc('0x36')],_0x547712[_0x24fc('0x37')]);_0x2a19f9[_0x24fc('0x3a')]=_[_0x24fc('0x39')](_0x547712[_0x24fc('0x36')],qs[_0x24fc('0x3b')](_0x22aa52[_0x24fc('0x37')][_0x24fc('0x3b')]));_0x2a19f9['attributes']=_0x2a19f9['attributes'][_0x24fc('0x3c')]?_0x2a19f9['attributes']:_0x547712['model'];_0x2a19f9[_0x24fc('0x3e')]=qs[_0x24fc('0x3f')](_0x22aa52[_0x24fc('0x37')][_0x24fc('0x3f')]);_0x2a19f9[_0x24fc('0x42')]=qs[_0x24fc('0x38')](_[_0x24fc('0x40')](_0x22aa52['query'],_0x547712[_0x24fc('0x38')]));if(_0x22aa52[_0x24fc('0x37')][_0x24fc('0x41')]){_0x2a19f9[_0x24fc('0x42')]=_[_0x24fc('0x45')](_0x2a19f9[_0x24fc('0x42')],{'$or':_[_0x24fc('0x33')](_0x2a19f9[_0x24fc('0x3a')],function(_0x9fd1b5){var _0x3115d0={};_0x3115d0[_0x9fd1b5]={'$like':'%'+_0x22aa52[_0x24fc('0x37')][_0x24fc('0x41')]+'%'};return _0x3115d0;})});}_0x2a19f9=_[_0x24fc('0x45')]({},_0x2a19f9,_0x22aa52[_0x24fc('0x4f')]);return _0x1f0dd9[_0x24fc('0x8b')](_0x2a19f9);}})[_0x24fc('0x29')](function(_0x29af09){if(_0x29af09){_0x1d4d91=_0x29af09[_0x24fc('0x3c')];if(!_0x22aa52[_0x24fc('0x37')][_0x24fc('0x3d')](_0x24fc('0x5d'))){_0x2a19f9[_0x24fc('0x23')]=qs[_0x24fc('0x23')](_0x22aa52[_0x24fc('0x37')][_0x24fc('0x23')]);_0x2a19f9['offset']=qs[_0x24fc('0x22')](_0x22aa52[_0x24fc('0x37')][_0x24fc('0x22')]);}return _0x1f0dd9[_0x24fc('0x8b')](_0x2a19f9);}})['then'](function(_0x5d8153){if(_0x5d8153){return _0x5d8153?{'count':_0x1d4d91,'rows':_0x5d8153}:null;}})['then'](respondWithResult(_0x30d523,null))[_0x24fc('0x4a')](handleError(_0x30d523,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index f98bb93..3bfc2c2 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 _0x65bd=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','emit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x65bd,0xb3));var _0xd65b=function(_0x262f06,_0x5c8a91){_0x262f06=_0x262f06-0x0;var _0x20db02=_0x65bd[_0x262f06];return _0x20db02;};'use strict';var EventEmitter=require(_0xd65b('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd65b('0x1')](0x0);var events={'afterCreate':_0xd65b('0x2'),'afterUpdate':_0xd65b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3b8687){return function(_0x46412e,_0xd60aac,_0x4dbb47){SmsQueueEvents[_0xd65b('0x4')](_0x3b8687+':'+_0x46412e['id'],_0x46412e);SmsQueueEvents[_0xd65b('0x4')](_0x3b8687,_0x46412e);_0x4dbb47(null);};}for(var e in events){if(events[_0xd65b('0x5')](e)){var event=events[e];SmsQueue[_0xd65b('0x6')](e,emitEvent(event));}}module[_0xd65b('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x2723=['update','emit','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0xcdf96f,_0xc63784){var _0xb59f45=function(_0xee7cc8){while(--_0xee7cc8){_0xcdf96f['push'](_0xcdf96f['shift']());}};_0xb59f45(++_0xc63784);}(_0x2723,0x16f));var _0x3272=function(_0x5a7cf7,_0x170cf2){_0x5a7cf7=_0x5a7cf7-0x0;var _0x391da7=_0x2723[_0x5a7cf7];return _0x391da7;};'use strict';var EventEmitter=require(_0x3272('0x0'));var SmsQueue=require(_0x3272('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3272('0x2')](0x0);var events={'afterCreate':_0x3272('0x3'),'afterUpdate':_0x3272('0x4'),'afterDestroy':'remove'};function emitEvent(_0x53750b){return function(_0x2dd08d,_0x1a2f1c,_0x51bd19){SmsQueueEvents['emit'](_0x53750b+':'+_0x2dd08d['id'],_0x2dd08d);SmsQueueEvents[_0x3272('0x5')](_0x53750b,_0x2dd08d);_0x51bd19(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x3272('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 2efb361..8f56671 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 _0xa543=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x297dfc,_0x3be7ee){var _0x19eba7=function(_0x50075c){while(--_0x50075c){_0x297dfc['push'](_0x297dfc['shift']());}};_0x19eba7(++_0x3be7ee);}(_0xa543,0x101));var _0x3a54=function(_0x4e17f7,_0x2e54e0){_0x4e17f7=_0x4e17f7-0x0;var _0x509ce4=_0xa543[_0x4e17f7];return _0x509ce4;};'use strict';var _=require('lodash');var util=require(_0x3a54('0x0'));var logger=require(_0x3a54('0x1'))('api');var moment=require(_0x3a54('0x2'));var BPromise=require(_0x3a54('0x3'));var rp=require(_0x3a54('0x4'));var fs=require('fs');var path=require(_0x3a54('0x5'));var rimraf=require('rimraf');var config=require(_0x3a54('0x6'));var attributes=require(_0x3a54('0x7'));module[_0x3a54('0x8')]=function(_0x22f504,_0x47a013){return _0x22f504[_0x3a54('0x9')](_0x3a54('0xa'),attributes,{'tableName':_0x3a54('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x309e=['request-promise','path','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xa62876,_0x2faa48){var _0x147953=function(_0x183992){while(--_0x183992){_0xa62876['push'](_0xa62876['shift']());}};_0x147953(++_0x2faa48);}(_0x309e,0xd2));var _0xe309=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x309e[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0xe309('0x0'));var util=require(_0xe309('0x1'));var logger=require(_0xe309('0x2'))(_0xe309('0x3'));var moment=require(_0xe309('0x4'));var BPromise=require(_0xe309('0x5'));var rp=require(_0xe309('0x6'));var fs=require('fs');var path=require(_0xe309('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe309('0x8'));module['exports']=function(_0x19cd16,_0x1c46d4){return _0x19cd16[_0xe309('0x9')](_0xe309('0xa'),attributes,{'tableName':_0xe309('0xb'),'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 4921e81..e77f8fe 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 _0x2af9=['client','http','redis','defaults','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x42acbc,_0x5e9a37){var _0x102e15=function(_0x399c5c){while(--_0x399c5c){_0x42acbc['push'](_0x42acbc['shift']());}};_0x102e15(++_0x5e9a37);}(_0x2af9,0x15e));var _0x92af=function(_0x1e5c05,_0x30a33){_0x1e5c05=_0x1e5c05-0x0;var _0x102141=_0x2af9[_0x1e5c05];return _0x102141;};'use strict';var _=require(_0x92af('0x0'));var util=require(_0x92af('0x1'));var moment=require('moment');var BPromise=require(_0x92af('0x2'));var rs=require(_0x92af('0x3'));var fs=require('fs');var Redis=require(_0x92af('0x4'));var db=require(_0x92af('0x5'))['db'];var utils=require(_0x92af('0x6'));var logger=require(_0x92af('0x7'))('rpc');var config=require(_0x92af('0x8'));var jayson=require(_0x92af('0x9'));var client=jayson[_0x92af('0xa')][_0x92af('0xb')]({'port':0x232a});config[_0x92af('0xc')]=_[_0x92af('0xd')](config[_0x92af('0xc')],{'host':_0x92af('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x92af('0xc')]));require(_0x92af('0xf'))[_0x92af('0x10')](socket);function respondWithRpcPromise(_0x51acc1,_0x12c6f0,_0x925286){return new BPromise(function(_0x4a1cbc,_0x219207){return client[_0x92af('0x11')](_0x51acc1,_0x925286)[_0x92af('0x12')](function(_0x5e768b){logger[_0x92af('0x13')](_0x92af('0x14'),_0x12c6f0,'request\x20sent');logger[_0x92af('0x15')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x12c6f0,_0x92af('0x16'),JSON[_0x92af('0x17')](_0x5e768b));if(_0x5e768b[_0x92af('0x18')]){if(_0x5e768b['error']['code']===0x1f4){logger[_0x92af('0x18')](_0x92af('0x14'),_0x12c6f0,_0x5e768b[_0x92af('0x18')][_0x92af('0x19')]);return _0x219207(_0x5e768b[_0x92af('0x18')][_0x92af('0x19')]);}logger[_0x92af('0x18')](_0x92af('0x14'),_0x12c6f0,_0x5e768b[_0x92af('0x18')][_0x92af('0x19')]);return _0x4a1cbc(_0x5e768b[_0x92af('0x18')][_0x92af('0x19')]);}else{logger[_0x92af('0x13')](_0x92af('0x14'),_0x12c6f0,_0x92af('0x16'));_0x4a1cbc(_0x5e768b[_0x92af('0x1a')][_0x92af('0x19')]);}})[_0x92af('0x1b')](function(_0xe3f955){logger['error'](_0x92af('0x14'),_0x12c6f0,_0xe3f955);_0x219207(_0xe3f955);});});}exports[_0x92af('0x1c')]=function(_0x43e23c){var _0x534b0a=this;return new Promise(function(_0x35f462,_0x2c07cd){return db[_0x92af('0x1d')][_0x92af('0x1e')]({'raw':_0x43e23c[_0x92af('0x1f')]?_0x43e23c[_0x92af('0x1f')][_0x92af('0x20')]===undefined?!![]:![]:!![],'where':_0x43e23c[_0x92af('0x1f')]?_0x43e23c['options'][_0x92af('0x21')]||null:null,'attributes':_0x43e23c[_0x92af('0x1f')]?_0x43e23c[_0x92af('0x1f')][_0x92af('0x22')]||null:null,'limit':_0x43e23c['options']?_0x43e23c['options'][_0x92af('0x23')]||null:null,'include':_0x43e23c[_0x92af('0x1f')]?_0x43e23c['options'][_0x92af('0x24')]?_[_0x92af('0x25')](_0x43e23c[_0x92af('0x1f')]['include'],function(_0x218564){return{'model':db[_0x218564[_0x92af('0x26')]],'as':_0x218564['as'],'attributes':_0x218564[_0x92af('0x22')],'include':_0x218564[_0x92af('0x24')]?_[_0x92af('0x25')](_0x218564[_0x92af('0x24')],function(_0x1dc445){return{'model':db[_0x1dc445[_0x92af('0x26')]],'as':_0x1dc445['as'],'attributes':_0x1dc445[_0x92af('0x22')],'include':_0x1dc445['include']?_['map'](_0x1dc445[_0x92af('0x24')],function(_0x49e8b3){return{'model':db[_0x49e8b3[_0x92af('0x26')]],'as':_0x49e8b3['as'],'attributes':_0x49e8b3[_0x92af('0x22')]};}):[]};}):[]};}):[]:[]})[_0x92af('0x12')](function(_0x10c074){logger['info'](_0x92af('0x1c'),_0x43e23c);logger['debug'](_0x92af('0x1c'),_0x43e23c,JSON[_0x92af('0x17')](_0x10c074));_0x35f462(_0x10c074);})[_0x92af('0x1b')](function(_0x600d79){logger['error'](_0x92af('0x1c'),_0x600d79[_0x92af('0x19')],_0x43e23c);_0x2c07cd(_0x534b0a[_0x92af('0x18')](0x1f4,_0x600d79[_0x92af('0x19')]));});});};exports[_0x92af('0x27')]=function(_0x5036af){var _0x5e889d=this;return new Promise(function(_0x94fe,_0xc23f83){return db[_0x92af('0x1d')]['find']({'raw':_0x5036af[_0x92af('0x1f')]?_0x5036af[_0x92af('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x5036af['options']?_0x5036af[_0x92af('0x1f')][_0x92af('0x21')]||null:null,'attributes':_0x5036af[_0x92af('0x1f')]?_0x5036af['options'][_0x92af('0x22')]||null:null,'include':_0x5036af[_0x92af('0x1f')]?_0x5036af[_0x92af('0x1f')][_0x92af('0x24')]?_[_0x92af('0x25')](_0x5036af['options'][_0x92af('0x24')],function(_0x217cda){return{'model':db[_0x217cda['model']],'as':_0x217cda['as'],'attributes':_0x217cda['attributes'],'include':_0x217cda[_0x92af('0x24')]?_[_0x92af('0x25')](_0x217cda[_0x92af('0x24')],function(_0x10810d){return{'model':db[_0x10810d[_0x92af('0x26')]],'as':_0x10810d['as'],'attributes':_0x10810d[_0x92af('0x22')],'include':_0x10810d[_0x92af('0x24')]?_[_0x92af('0x25')](_0x10810d[_0x92af('0x24')],function(_0x20b9c7){return{'model':db[_0x20b9c7[_0x92af('0x26')]],'as':_0x20b9c7['as'],'attributes':_0x20b9c7['attributes']};}):[]};}):[]};}):[]:[]})[_0x92af('0x12')](function(_0x167685){logger[_0x92af('0x13')](_0x92af('0x27'),_0x5036af);logger[_0x92af('0x15')](_0x92af('0x27'),_0x5036af,JSON[_0x92af('0x17')](_0x167685));_0x94fe(_0x167685);})[_0x92af('0x1b')](function(_0x21d9a0){logger[_0x92af('0x18')](_0x92af('0x27'),_0x21d9a0['message'],_0x5036af);_0xc23f83(_0x5e889d['error'](0x1f4,_0x21d9a0['message']));});});}; \ No newline at end of file +var _0x67e8=['stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','then','debug','find','ShowSmsQueue'];(function(_0x35468d,_0x2a7240){var _0x30da52=function(_0xd9d2f){while(--_0xd9d2f){_0x35468d['push'](_0x35468d['shift']());}};_0x30da52(++_0x2a7240);}(_0x67e8,0x151));var _0x867e=function(_0x18ecd3,_0x716f05){_0x18ecd3=_0x18ecd3-0x0;var _0x140403=_0x67e8[_0x18ecd3];return _0x140403;};'use strict';var _=require(_0x867e('0x0'));var util=require(_0x867e('0x1'));var moment=require(_0x867e('0x2'));var BPromise=require(_0x867e('0x3'));var rs=require(_0x867e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x867e('0x5'))['db'];var utils=require(_0x867e('0x6'));var logger=require(_0x867e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x867e('0x8')][_0x867e('0x9')]({'port':0x232a});config[_0x867e('0xa')]=_[_0x867e('0xb')](config[_0x867e('0xa')],{'host':_0x867e('0xc'),'port':0x18eb});var socket=require(_0x867e('0xd'))(new Redis(config[_0x867e('0xa')]));require(_0x867e('0xe'))[_0x867e('0xf')](socket);function respondWithRpcPromise(_0x50276b,_0x2cdfc0,_0x937364){return new BPromise(function(_0x58acda,_0x517f29){return client[_0x867e('0x10')](_0x50276b,_0x937364)['then'](function(_0x515039){logger['info'](_0x867e('0x11'),_0x2cdfc0,'request\x20sent');logger['debug'](_0x867e('0x12'),_0x2cdfc0,_0x867e('0x13'),JSON['stringify'](_0x515039));if(_0x515039[_0x867e('0x14')]){if(_0x515039[_0x867e('0x14')][_0x867e('0x15')]===0x1f4){logger[_0x867e('0x14')](_0x867e('0x11'),_0x2cdfc0,_0x515039['error']['message']);return _0x517f29(_0x515039[_0x867e('0x14')][_0x867e('0x16')]);}logger[_0x867e('0x14')](_0x867e('0x11'),_0x2cdfc0,_0x515039['error'][_0x867e('0x16')]);return _0x58acda(_0x515039[_0x867e('0x14')][_0x867e('0x16')]);}else{logger[_0x867e('0x17')](_0x867e('0x11'),_0x2cdfc0,_0x867e('0x13'));_0x58acda(_0x515039[_0x867e('0x18')][_0x867e('0x16')]);}})[_0x867e('0x19')](function(_0x4cbc02){logger[_0x867e('0x14')](_0x867e('0x11'),_0x2cdfc0,_0x4cbc02);_0x517f29(_0x4cbc02);});});}exports[_0x867e('0x1a')]=function(_0x5c5fe1){var _0x5742c8=this;return new Promise(function(_0x3d7fb4,_0x497570){return db[_0x867e('0x1b')][_0x867e('0x1c')]({'raw':_0x5c5fe1['options']?_0x5c5fe1[_0x867e('0x1d')][_0x867e('0x1e')]===undefined?!![]:![]:!![],'where':_0x5c5fe1[_0x867e('0x1d')]?_0x5c5fe1[_0x867e('0x1d')][_0x867e('0x1f')]||null:null,'attributes':_0x5c5fe1[_0x867e('0x1d')]?_0x5c5fe1['options']['attributes']||null:null,'limit':_0x5c5fe1[_0x867e('0x1d')]?_0x5c5fe1[_0x867e('0x1d')][_0x867e('0x20')]||null:null,'include':_0x5c5fe1['options']?_0x5c5fe1['options'][_0x867e('0x21')]?_[_0x867e('0x22')](_0x5c5fe1[_0x867e('0x1d')]['include'],function(_0x5b1bd3){return{'model':db[_0x5b1bd3[_0x867e('0x23')]],'as':_0x5b1bd3['as'],'attributes':_0x5b1bd3[_0x867e('0x24')],'include':_0x5b1bd3['include']?_[_0x867e('0x22')](_0x5b1bd3['include'],function(_0xc27a59){return{'model':db[_0xc27a59[_0x867e('0x23')]],'as':_0xc27a59['as'],'attributes':_0xc27a59[_0x867e('0x24')],'include':_0xc27a59[_0x867e('0x21')]?_['map'](_0xc27a59[_0x867e('0x21')],function(_0x40e62b){return{'model':db[_0x40e62b[_0x867e('0x23')]],'as':_0x40e62b['as'],'attributes':_0x40e62b['attributes']};}):[]};}):[]};}):[]:[]})[_0x867e('0x25')](function(_0x1862a6){logger[_0x867e('0x17')](_0x867e('0x1a'),_0x5c5fe1);logger[_0x867e('0x26')]('GetSmsQueue',_0x5c5fe1,JSON['stringify'](_0x1862a6));_0x3d7fb4(_0x1862a6);})['catch'](function(_0x13cf67){logger[_0x867e('0x14')]('GetSmsQueue',_0x13cf67['message'],_0x5c5fe1);_0x497570(_0x5742c8['error'](0x1f4,_0x13cf67['message']));});});};exports['ShowSmsQueue']=function(_0x538d4f){var _0x5bdcd8=this;return new Promise(function(_0x5a3c85,_0x390e7f){return db[_0x867e('0x1b')][_0x867e('0x27')]({'raw':_0x538d4f[_0x867e('0x1d')]?_0x538d4f['options'][_0x867e('0x1e')]===undefined?!![]:![]:!![],'where':_0x538d4f[_0x867e('0x1d')]?_0x538d4f[_0x867e('0x1d')][_0x867e('0x1f')]||null:null,'attributes':_0x538d4f[_0x867e('0x1d')]?_0x538d4f[_0x867e('0x1d')][_0x867e('0x24')]||null:null,'include':_0x538d4f['options']?_0x538d4f[_0x867e('0x1d')][_0x867e('0x21')]?_[_0x867e('0x22')](_0x538d4f[_0x867e('0x1d')][_0x867e('0x21')],function(_0x9bee09){return{'model':db[_0x9bee09['model']],'as':_0x9bee09['as'],'attributes':_0x9bee09[_0x867e('0x24')],'include':_0x9bee09[_0x867e('0x21')]?_[_0x867e('0x22')](_0x9bee09[_0x867e('0x21')],function(_0x347f97){return{'model':db[_0x347f97[_0x867e('0x23')]],'as':_0x347f97['as'],'attributes':_0x347f97[_0x867e('0x24')],'include':_0x347f97[_0x867e('0x21')]?_[_0x867e('0x22')](_0x347f97[_0x867e('0x21')],function(_0x1fc9bb){return{'model':db[_0x1fc9bb[_0x867e('0x23')]],'as':_0x1fc9bb['as'],'attributes':_0x1fc9bb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3194d1){logger[_0x867e('0x17')]('ShowSmsQueue',_0x538d4f);logger[_0x867e('0x26')](_0x867e('0x28'),_0x538d4f,JSON[_0x867e('0x29')](_0x3194d1));_0x5a3c85(_0x3194d1);})[_0x867e('0x19')](function(_0x31d114){logger[_0x867e('0x14')](_0x867e('0x28'),_0x31d114[_0x867e('0x16')],_0x538d4f);_0x390e7f(_0x5bdcd8[_0x867e('0x14')](0x1f4,_0x31d114[_0x867e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 0a9c07a..0c34c83 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 _0xa258=['remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xa258,0x73));var _0x8a25=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0xa258[_0x4350c2];return _0x8b6406;};'use strict';var SmsQueueEvents=require(_0x8a25('0x0'));var events=[_0x8a25('0x1'),_0x8a25('0x2'),_0x8a25('0x3')];function createListener(_0x3e6438,_0x3e6e01){return function(_0x69137f){_0x3e6e01[_0x8a25('0x4')](_0x3e6438,_0x69137f);};}function removeListener(_0x42b551,_0x1f4c32){return function(){SmsQueueEvents[_0x8a25('0x5')](_0x42b551,_0x1f4c32);};}exports[_0x8a25('0x6')]=function(_0x278aba){for(var _0xf23d29=0x0,_0x31f774=events[_0x8a25('0x7')];_0xf23d29<_0x31f774;_0xf23d29++){var _0x3193b9=events[_0xf23d29];var _0x2af104=createListener(_0x8a25('0x8')+_0x3193b9,_0x278aba);SmsQueueEvents['on'](_0x3193b9,_0x2af104);}}; \ No newline at end of file +var _0xd588=['update','emit','removeListener','register','length','./smsQueue.events','remove'];(function(_0x3aa7cb,_0x5682cd){var _0x26ae82=function(_0x329a45){while(--_0x329a45){_0x3aa7cb['push'](_0x3aa7cb['shift']());}};_0x26ae82(++_0x5682cd);}(_0xd588,0x1be));var _0x8d58=function(_0x5717ac,_0xbb31e7){_0x5717ac=_0x5717ac-0x0;var _0xfcf5e=_0xd588[_0x5717ac];return _0xfcf5e;};'use strict';var SmsQueueEvents=require(_0x8d58('0x0'));var events=['save',_0x8d58('0x1'),_0x8d58('0x2')];function createListener(_0x4b4945,_0xbb3568){return function(_0x174c8a){_0xbb3568[_0x8d58('0x3')](_0x4b4945,_0x174c8a);};}function removeListener(_0x333dd0,_0x3c1dcb){return function(){SmsQueueEvents[_0x8d58('0x4')](_0x333dd0,_0x3c1dcb);};}exports[_0x8d58('0x5')]=function(_0x458cf8){for(var _0x2a4e37=0x0,_0x1cbf56=events[_0x8d58('0x6')];_0x2a4e37<_0x1cbf56;_0x2a4e37++){var _0x5416cc=events[_0x2a4e37];var _0x172b3f=createListener('smsQueue:'+_0x5416cc,_0x458cf8);SmsQueueEvents['on'](_0x5416cc,_0x172b3f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 39bba75..2057b1f 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 _0x967d=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','multer'];(function(_0x21f3bf,_0xfb0f59){var _0x249d08=function(_0x37e6c2){while(--_0x37e6c2){_0x21f3bf['push'](_0x21f3bf['shift']());}};_0x249d08(++_0xfb0f59);}(_0x967d,0x125));var _0xd967=function(_0x43faa3,_0x478c98){_0x43faa3=_0x43faa3-0x0;var _0x127d0a=_0x967d[_0x43faa3];return _0x127d0a;};'use strict';var multer=require(_0xd967('0x0'));var util=require('util');var path=require(_0xd967('0x1'));var timeout=require('connect-timeout');var express=require(_0xd967('0x2'));var router=express[_0xd967('0x3')]();var fs_extra=require(_0xd967('0x4'));var auth=require(_0xd967('0x5'));var interaction=require(_0xd967('0x6'));var config=require(_0xd967('0x7'));var controller=require(_0xd967('0x8'));router[_0xd967('0x9')]('/',auth[_0xd967('0xa')](),controller[_0xd967('0xb')]);router[_0xd967('0x9')](_0xd967('0xc'),auth[_0xd967('0xa')](),controller['describe']);router[_0xd967('0x9')]('/:id',auth[_0xd967('0xa')](),controller[_0xd967('0xd')]);router[_0xd967('0xe')]('/',auth[_0xd967('0xa')](),controller[_0xd967('0xf')]);router[_0xd967('0x10')](_0xd967('0x11'),auth['isAuthenticated'](),controller[_0xd967('0x12')]);router[_0xd967('0x13')](_0xd967('0x11'),auth[_0xd967('0xa')](),controller[_0xd967('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4dcf=['index','/describe','describe','get','/:id','post','create','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','isAuthenticated'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4dcf,0x106));var _0xf4dc=function(_0x552397,_0x377e73){_0x552397=_0x552397-0x0;var _0x4748c5=_0x4dcf[_0x552397];return _0x4748c5;};'use strict';var multer=require(_0xf4dc('0x0'));var util=require(_0xf4dc('0x1'));var path=require(_0xf4dc('0x2'));var timeout=require(_0xf4dc('0x3'));var express=require(_0xf4dc('0x4'));var router=express['Router']();var fs_extra=require(_0xf4dc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf4dc('0x6'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0xf4dc('0x7')](),controller[_0xf4dc('0x8')]);router['get'](_0xf4dc('0x9'),auth[_0xf4dc('0x7')](),controller[_0xf4dc('0xa')]);router[_0xf4dc('0xb')](_0xf4dc('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf4dc('0xd')]('/',auth['isAuthenticated'](),controller[_0xf4dc('0xe')]);router[_0xf4dc('0xf')](_0xf4dc('0xc'),auth[_0xf4dc('0x7')](),controller[_0xf4dc('0x10')]);router['delete'](_0xf4dc('0xc'),auth[_0xf4dc('0x7')](),controller['destroy']);module[_0xf4dc('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 3edb0bb..dbdbb79 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 _0x33ae=['exports','STRING','DATE','moment','sequelize'];(function(_0x587be3,_0x16553d){var _0x85d742=function(_0x344e68){while(--_0x344e68){_0x587be3['push'](_0x587be3['shift']());}};_0x85d742(++_0x16553d);}(_0x33ae,0x14d));var _0xe33a=function(_0x316efa,_0x20a1e1){_0x316efa=_0x316efa-0x0;var _0x4d96cc=_0x33ae[_0x316efa];return _0x4d96cc;};'use strict';var moment=require(_0xe33a('0x0'));var Sequelize=require(_0xe33a('0x1'));module[_0xe33a('0x2')]={'uniqueid':{'type':Sequelize[_0xe33a('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe33a('0x4')]},'leaveAt':{'type':Sequelize[_0xe33a('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe33a('0x4')]},'reason':{'type':Sequelize[_0xe33a('0x3')]}}; \ No newline at end of file +var _0xd4c8=['exports','STRING','DATE','moment','sequelize'];(function(_0x44a9fb,_0x5231f3){var _0x3b296e=function(_0x25dc5a){while(--_0x25dc5a){_0x44a9fb['push'](_0x44a9fb['shift']());}};_0x3b296e(++_0x5231f3);}(_0xd4c8,0x1a2));var _0x8d4c=function(_0xfc6890,_0x28a06a){_0xfc6890=_0xfc6890-0x0;var _0x34f519=_0xd4c8[_0xfc6890];return _0x34f519;};'use strict';var moment=require(_0x8d4c('0x0'));var Sequelize=require(_0x8d4c('0x1'));module[_0x8d4c('0x2')]={'uniqueid':{'type':Sequelize[_0x8d4c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8d4c('0x3')]},'joinAt':{'type':Sequelize[_0x8d4c('0x4')]},'leaveAt':{'type':Sequelize[_0x8d4c('0x4')]},'acceptAt':{'type':Sequelize[_0x8d4c('0x4')]},'exitAt':{'type':Sequelize[_0x8d4c('0x4')]},'reason':{'type':Sequelize[_0x8d4c('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 82bbc29..920d659 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 _0x31b6=['crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','destroy','then','end','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','filter','count','includeAll','SmsQueueReport','rows','catch','show','keys','options','find','create','body','update','params','describe','eml-format','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x3dcab,_0x58860f){var _0x517c6a=function(_0x1bcf1f){while(--_0x1bcf1f){_0x3dcab['push'](_0x3dcab['shift']());}};_0x517c6a(++_0x58860f);}(_0x31b6,0x14a));var _0x631b=function(_0xf1f886,_0x5f0ebd){_0xf1f886=_0xf1f886-0x0;var _0x23cd8d=_0x31b6[_0xf1f886];return _0x23cd8d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x631b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x631b('0x1'));var jsonpatch=require(_0x631b('0x2'));var rp=require('request-promise');var moment=require(_0x631b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x631b('0x4'));var sox=require(_0x631b('0x5'));var csv=require(_0x631b('0x6'));var ejs=require(_0x631b('0x7'));var fs=require('fs');var fs_extra=require(_0x631b('0x8'));var _=require('lodash');var squel=require(_0x631b('0x9'));var crypto=require(_0x631b('0xa'));var jsforce=require(_0x631b('0xb'));var deskjs=require(_0x631b('0xc'));var toCsv=require(_0x631b('0x6'));var querystring=require('querystring');var Papa=require(_0x631b('0xd'));var Redis=require('ioredis');var authService=require(_0x631b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x631b('0xf'));var hardwareService=require(_0x631b('0x10'));var logger=require('../../config/logger')(_0x631b('0x11'));var utils=require(_0x631b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x631b('0x13'));var db=require(_0x631b('0x14'))['db'];function respondWithStatusCode(_0x349e4a,_0x1cced5){_0x1cced5=_0x1cced5||0xcc;return function(_0x287c3f){if(_0x287c3f){return _0x349e4a['sendStatus'](_0x1cced5);}return _0x349e4a[_0x631b('0x15')](_0x1cced5)['end']();};}function respondWithResult(_0x41d0a9,_0x31beb2){_0x31beb2=_0x31beb2||0xc8;return function(_0x1f40f2){if(_0x1f40f2){return _0x41d0a9[_0x631b('0x15')](_0x31beb2)[_0x631b('0x16')](_0x1f40f2);}};}function respondWithFilteredResult(_0x46dd5f,_0x54a7b0){return function(_0x2f873){if(_0x2f873){var _0x4bc639=_0x2f873['count'],_0x1144ea=_0x54a7b0[_0x631b('0x17')],_0x1e73ac=_0x54a7b0['offset']+_0x54a7b0[_0x631b('0x18')],_0x305622;if(_0x1e73ac>=_0x4bc639){_0x1e73ac=_0x4bc639;_0x305622=0xc8;}else{_0x305622=0xce;}_0x46dd5f[_0x631b('0x15')](_0x305622);return _0x46dd5f[_0x631b('0x19')](_0x631b('0x1a'),_0x1144ea+'-'+_0x1e73ac+'/'+_0x4bc639)[_0x631b('0x16')](_0x2f873);}return null;};}function patchUpdates(_0x199d2f){return function(_0x4f1d5d){try{jsonpatch[_0x631b('0x1b')](_0x4f1d5d,_0x199d2f,!![]);}catch(_0x4e5f12){return BPromise['reject'](_0x4e5f12);}return _0x4f1d5d['save']();};}function saveUpdates(_0x4f65be,_0x4cf7eb){return function(_0x1a42fc){if(_0x1a42fc){return _0x1a42fc['update'](_0x4f65be)['then'](function(_0x38d464){return _0x38d464;});}return null;};}function removeEntity(_0x3f9e38,_0x459e42){return function(_0x79966){if(_0x79966){return _0x79966[_0x631b('0x1c')]()[_0x631b('0x1d')](function(){_0x3f9e38[_0x631b('0x15')](0xcc)[_0x631b('0x1e')]();});}};}function handleEntityNotFound(_0x2ef406,_0xe1a6a9){return function(_0x4deb06){if(!_0x4deb06){_0x2ef406['sendStatus'](0x194);}return _0x4deb06;};}function handleError(_0x5b862b,_0x2f7677){_0x2f7677=_0x2f7677||0x1f4;return function(_0x2e05fe){logger['error'](_0x2e05fe[_0x631b('0x1f')]);if(_0x2e05fe['name']){delete _0x2e05fe[_0x631b('0x20')];}_0x5b862b[_0x631b('0x15')](_0x2f7677)[_0x631b('0x21')](_0x2e05fe);};}exports[_0x631b('0x22')]=function(_0x3cdcad,_0x1a9541){var _0x47d9bc={},_0x20f7e7={},_0x86e5bc={'count':0x0,'rows':[]};var _0x1e9b13=_[_0x631b('0x23')](db['SmsQueueReport'][_0x631b('0x24')],function(_0x385604){return{'name':_0x385604[_0x631b('0x25')],'type':_0x385604['type'][_0x631b('0x26')]};});_0x20f7e7['model']=_[_0x631b('0x23')](_0x1e9b13,_0x631b('0x20'));_0x20f7e7['query']=_['keys'](_0x3cdcad[_0x631b('0x27')]);_0x20f7e7[_0x631b('0x28')]=_['intersection'](_0x20f7e7[_0x631b('0x29')],_0x20f7e7['query']);_0x47d9bc['attributes']=_[_0x631b('0x2a')](_0x20f7e7[_0x631b('0x29')],qs[_0x631b('0x2b')](_0x3cdcad['query']['fields']));_0x47d9bc[_0x631b('0x2c')]=_0x47d9bc['attributes'][_0x631b('0x2d')]?_0x47d9bc[_0x631b('0x2c')]:_0x20f7e7[_0x631b('0x29')];if(!_0x3cdcad[_0x631b('0x27')][_0x631b('0x2e')](_0x631b('0x2f'))){_0x47d9bc['limit']=qs[_0x631b('0x18')](_0x3cdcad['query'][_0x631b('0x18')]);_0x47d9bc[_0x631b('0x17')]=qs['offset'](_0x3cdcad[_0x631b('0x27')]['offset']);}_0x47d9bc['order']=qs['sort'](_0x3cdcad[_0x631b('0x27')][_0x631b('0x30')]);_0x47d9bc['where']=qs[_0x631b('0x28')](_[_0x631b('0x31')](_0x3cdcad[_0x631b('0x27')],_0x20f7e7[_0x631b('0x28')]),_0x1e9b13);if(_0x3cdcad[_0x631b('0x27')]['filter']){_0x47d9bc[_0x631b('0x32')]=_[_0x631b('0x33')](_0x47d9bc[_0x631b('0x32')],{'$or':_['map'](_0x1e9b13,function(_0x49c187){if(_0x49c187[_0x631b('0x34')]!=='VIRTUAL'){var _0x440f78={};_0x440f78[_0x49c187['name']]={'$like':'%'+_0x3cdcad[_0x631b('0x27')][_0x631b('0x35')]+'%'};return _0x440f78;}})});}_0x47d9bc=_[_0x631b('0x33')]({},_0x47d9bc,_0x3cdcad['options']);var _0x195708={'where':_0x47d9bc[_0x631b('0x32')]};return db['SmsQueueReport'][_0x631b('0x36')](_0x195708)[_0x631b('0x1d')](function(_0x20d672){_0x86e5bc[_0x631b('0x36')]=_0x20d672;if(_0x3cdcad[_0x631b('0x27')][_0x631b('0x37')]){_0x47d9bc['include']=[{'all':!![]}];}return db[_0x631b('0x38')]['findAll'](_0x47d9bc);})[_0x631b('0x1d')](function(_0x91b452){_0x86e5bc[_0x631b('0x39')]=_0x91b452;return _0x86e5bc;})[_0x631b('0x1d')](respondWithFilteredResult(_0x1a9541,_0x47d9bc))[_0x631b('0x3a')](handleError(_0x1a9541,null));};exports[_0x631b('0x3b')]=function(_0x12b817,_0x2ca95d){var _0x375a46={'raw':!![],'where':{'id':_0x12b817['params']['id']}},_0x361664={};_0x361664[_0x631b('0x29')]=_[_0x631b('0x3c')](db[_0x631b('0x38')]['rawAttributes']);_0x361664[_0x631b('0x27')]=_[_0x631b('0x3c')](_0x12b817['query']);_0x361664[_0x631b('0x28')]=_[_0x631b('0x2a')](_0x361664[_0x631b('0x29')],_0x361664[_0x631b('0x27')]);_0x375a46[_0x631b('0x2c')]=_[_0x631b('0x2a')](_0x361664[_0x631b('0x29')],qs[_0x631b('0x2b')](_0x12b817[_0x631b('0x27')][_0x631b('0x2b')]));_0x375a46['attributes']=_0x375a46['attributes'][_0x631b('0x2d')]?_0x375a46['attributes']:_0x361664[_0x631b('0x29')];if(_0x12b817[_0x631b('0x27')]['includeAll']){_0x375a46['include']=[{'all':!![]}];}_0x375a46=_[_0x631b('0x33')]({},_0x375a46,_0x12b817[_0x631b('0x3d')]);return db['SmsQueueReport'][_0x631b('0x3e')](_0x375a46)[_0x631b('0x1d')](handleEntityNotFound(_0x2ca95d,null))[_0x631b('0x1d')](respondWithResult(_0x2ca95d,null))['catch'](handleError(_0x2ca95d,null));};exports[_0x631b('0x3f')]=function(_0x57ecf3,_0xb41c51){return db[_0x631b('0x38')][_0x631b('0x3f')](_0x57ecf3[_0x631b('0x40')],{})[_0x631b('0x1d')](respondWithResult(_0xb41c51,0xc9))[_0x631b('0x3a')](handleError(_0xb41c51,null));};exports[_0x631b('0x41')]=function(_0x4bee69,_0x3eba34){if(_0x4bee69['body']['id']){delete _0x4bee69[_0x631b('0x40')]['id'];}return db[_0x631b('0x38')][_0x631b('0x3e')]({'where':{'id':_0x4bee69[_0x631b('0x42')]['id']}})[_0x631b('0x1d')](handleEntityNotFound(_0x3eba34,null))['then'](saveUpdates(_0x4bee69[_0x631b('0x40')],null))[_0x631b('0x1d')](respondWithResult(_0x3eba34,null))[_0x631b('0x3a')](handleError(_0x3eba34,null));};exports[_0x631b('0x1c')]=function(_0x3f1c02,_0x27c584){return db['SmsQueueReport']['find']({'where':{'id':_0x3f1c02[_0x631b('0x42')]['id']}})['then'](handleEntityNotFound(_0x27c584,null))[_0x631b('0x1d')](removeEntity(_0x27c584,null))[_0x631b('0x3a')](handleError(_0x27c584,null));};exports[_0x631b('0x43')]=function(_0xfe3b86,_0x2817cd){return db[_0x631b('0x38')][_0x631b('0x43')]()[_0x631b('0x1d')](respondWithResult(_0x2817cd,null))[_0x631b('0x3a')](handleError(_0x2817cd,null));}; \ No newline at end of file +var _0xf35a=['map','SmsQueueReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','json','count','offset','limit','status','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf35a,0x69));var _0xaf35=function(_0x5e5e9f,_0x23aba7){_0x5e5e9f=_0x5e5e9f-0x0;var _0xf8500e=_0xf35a[_0x5e5e9f];return _0xf8500e;};'use strict';var pdf=require(_0xaf35('0x0'));var emlformat=require(_0xaf35('0x1'));var rimraf=require(_0xaf35('0x2'));var zipdir=require(_0xaf35('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf35('0x4'));var moment=require(_0xaf35('0x5'));var BPromise=require(_0xaf35('0x6'));var Mustache=require(_0xaf35('0x7'));var util=require(_0xaf35('0x8'));var path=require(_0xaf35('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf35('0xa'));var fs=require('fs');var fs_extra=require(_0xaf35('0xb'));var _=require(_0xaf35('0xc'));var squel=require('squel');var crypto=require(_0xaf35('0xd'));var jsforce=require(_0xaf35('0xe'));var deskjs=require(_0xaf35('0xf'));var toCsv=require('to-csv');var querystring=require(_0xaf35('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaf35('0x11'));var qs=require(_0xaf35('0x12'));var as=require(_0xaf35('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf35('0x14'))('api');var utils=require(_0xaf35('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xaf35('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d11c0,_0x500a8f){_0x500a8f=_0x500a8f||0xcc;return function(_0x1322ac){if(_0x1322ac){return _0x3d11c0[_0xaf35('0x17')](_0x500a8f);}return _0x3d11c0['status'](_0x500a8f)['end']();};}function respondWithResult(_0x56ff71,_0x166c6f){_0x166c6f=_0x166c6f||0xc8;return function(_0x5f5734){if(_0x5f5734){return _0x56ff71['status'](_0x166c6f)[_0xaf35('0x18')](_0x5f5734);}};}function respondWithFilteredResult(_0x2239bc,_0x44f352){return function(_0x185fc9){if(_0x185fc9){var _0x4de9be=_0x185fc9[_0xaf35('0x19')],_0xb03b96=_0x44f352[_0xaf35('0x1a')],_0x3a6471=_0x44f352[_0xaf35('0x1a')]+_0x44f352[_0xaf35('0x1b')],_0x30a81b;if(_0x3a6471>=_0x4de9be){_0x3a6471=_0x4de9be;_0x30a81b=0xc8;}else{_0x30a81b=0xce;}_0x2239bc[_0xaf35('0x1c')](_0x30a81b);return _0x2239bc[_0xaf35('0x1d')](_0xaf35('0x1e'),_0xb03b96+'-'+_0x3a6471+'/'+_0x4de9be)[_0xaf35('0x18')](_0x185fc9);}return null;};}function patchUpdates(_0x25531e){return function(_0x5d48a9){try{jsonpatch['apply'](_0x5d48a9,_0x25531e,!![]);}catch(_0x531588){return BPromise[_0xaf35('0x1f')](_0x531588);}return _0x5d48a9[_0xaf35('0x20')]();};}function saveUpdates(_0x4b77f4,_0x3dc68c){return function(_0x34f845){if(_0x34f845){return _0x34f845[_0xaf35('0x21')](_0x4b77f4)[_0xaf35('0x22')](function(_0x12162b){return _0x12162b;});}return null;};}function removeEntity(_0x3c7592,_0x20e111){return function(_0x250521){if(_0x250521){return _0x250521[_0xaf35('0x23')]()['then'](function(){_0x3c7592[_0xaf35('0x1c')](0xcc)[_0xaf35('0x24')]();});}};}function handleEntityNotFound(_0x57c1e0,_0xa2e220){return function(_0x537ecd){if(!_0x537ecd){_0x57c1e0['sendStatus'](0x194);}return _0x537ecd;};}function handleError(_0x103474,_0x13121c){_0x13121c=_0x13121c||0x1f4;return function(_0x117ba1){logger[_0xaf35('0x25')](_0x117ba1['stack']);if(_0x117ba1[_0xaf35('0x26')]){delete _0x117ba1[_0xaf35('0x26')];}_0x103474[_0xaf35('0x1c')](_0x13121c)[_0xaf35('0x27')](_0x117ba1);};}exports[_0xaf35('0x28')]=function(_0x4208cb,_0x5546bb){var _0x27ecbd={},_0x2c65bd={},_0x68c6ea={'count':0x0,'rows':[]};var _0x1e1c4b=_[_0xaf35('0x29')](db[_0xaf35('0x2a')][_0xaf35('0x2b')],function(_0x5581b3){return{'name':_0x5581b3['fieldName'],'type':_0x5581b3['type'][_0xaf35('0x2c')]};});_0x2c65bd[_0xaf35('0x2d')]=_['map'](_0x1e1c4b,_0xaf35('0x26'));_0x2c65bd[_0xaf35('0x2e')]=_[_0xaf35('0x2f')](_0x4208cb[_0xaf35('0x2e')]);_0x2c65bd[_0xaf35('0x30')]=_[_0xaf35('0x31')](_0x2c65bd['model'],_0x2c65bd[_0xaf35('0x2e')]);_0x27ecbd[_0xaf35('0x32')]=_[_0xaf35('0x31')](_0x2c65bd['model'],qs[_0xaf35('0x33')](_0x4208cb[_0xaf35('0x2e')][_0xaf35('0x33')]));_0x27ecbd[_0xaf35('0x32')]=_0x27ecbd['attributes'][_0xaf35('0x34')]?_0x27ecbd[_0xaf35('0x32')]:_0x2c65bd[_0xaf35('0x2d')];if(!_0x4208cb[_0xaf35('0x2e')][_0xaf35('0x35')]('nolimit')){_0x27ecbd[_0xaf35('0x1b')]=qs['limit'](_0x4208cb[_0xaf35('0x2e')][_0xaf35('0x1b')]);_0x27ecbd[_0xaf35('0x1a')]=qs[_0xaf35('0x1a')](_0x4208cb[_0xaf35('0x2e')][_0xaf35('0x1a')]);}_0x27ecbd[_0xaf35('0x36')]=qs['sort'](_0x4208cb['query'][_0xaf35('0x37')]);_0x27ecbd[_0xaf35('0x38')]=qs[_0xaf35('0x30')](_[_0xaf35('0x39')](_0x4208cb['query'],_0x2c65bd['filters']),_0x1e1c4b);if(_0x4208cb['query'][_0xaf35('0x3a')]){_0x27ecbd[_0xaf35('0x38')]=_[_0xaf35('0x3b')](_0x27ecbd[_0xaf35('0x38')],{'$or':_[_0xaf35('0x29')](_0x1e1c4b,function(_0x3a8d55){if(_0x3a8d55['type']!==_0xaf35('0x3c')){var _0xf81c7c={};_0xf81c7c[_0x3a8d55[_0xaf35('0x26')]]={'$like':'%'+_0x4208cb[_0xaf35('0x2e')][_0xaf35('0x3a')]+'%'};return _0xf81c7c;}})});}_0x27ecbd=_[_0xaf35('0x3b')]({},_0x27ecbd,_0x4208cb[_0xaf35('0x3d')]);var _0x2c9a01={'where':_0x27ecbd['where']};return db[_0xaf35('0x2a')][_0xaf35('0x19')](_0x2c9a01)[_0xaf35('0x22')](function(_0x53a43b){_0x68c6ea[_0xaf35('0x19')]=_0x53a43b;if(_0x4208cb[_0xaf35('0x2e')]['includeAll']){_0x27ecbd[_0xaf35('0x3e')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xaf35('0x3f')](_0x27ecbd);})[_0xaf35('0x22')](function(_0x1deb98){_0x68c6ea[_0xaf35('0x40')]=_0x1deb98;return _0x68c6ea;})[_0xaf35('0x22')](respondWithFilteredResult(_0x5546bb,_0x27ecbd))[_0xaf35('0x41')](handleError(_0x5546bb,null));};exports[_0xaf35('0x42')]=function(_0x14b123,_0x4fb47f){var _0x567725={'raw':!![],'where':{'id':_0x14b123[_0xaf35('0x43')]['id']}},_0x4084c0={};_0x4084c0[_0xaf35('0x2d')]=_[_0xaf35('0x2f')](db[_0xaf35('0x2a')][_0xaf35('0x2b')]);_0x4084c0[_0xaf35('0x2e')]=_['keys'](_0x14b123[_0xaf35('0x2e')]);_0x4084c0[_0xaf35('0x30')]=_[_0xaf35('0x31')](_0x4084c0[_0xaf35('0x2d')],_0x4084c0[_0xaf35('0x2e')]);_0x567725['attributes']=_[_0xaf35('0x31')](_0x4084c0[_0xaf35('0x2d')],qs[_0xaf35('0x33')](_0x14b123[_0xaf35('0x2e')][_0xaf35('0x33')]));_0x567725[_0xaf35('0x32')]=_0x567725[_0xaf35('0x32')]['length']?_0x567725[_0xaf35('0x32')]:_0x4084c0[_0xaf35('0x2d')];if(_0x14b123[_0xaf35('0x2e')][_0xaf35('0x44')]){_0x567725[_0xaf35('0x3e')]=[{'all':!![]}];}_0x567725=_[_0xaf35('0x3b')]({},_0x567725,_0x14b123[_0xaf35('0x3d')]);return db['SmsQueueReport'][_0xaf35('0x45')](_0x567725)[_0xaf35('0x22')](handleEntityNotFound(_0x4fb47f,null))[_0xaf35('0x22')](respondWithResult(_0x4fb47f,null))[_0xaf35('0x41')](handleError(_0x4fb47f,null));};exports[_0xaf35('0x46')]=function(_0x554e62,_0x2a14f3){return db[_0xaf35('0x2a')][_0xaf35('0x46')](_0x554e62[_0xaf35('0x47')],{})[_0xaf35('0x22')](respondWithResult(_0x2a14f3,0xc9))[_0xaf35('0x41')](handleError(_0x2a14f3,null));};exports[_0xaf35('0x21')]=function(_0x25706c,_0x1afe8f){if(_0x25706c[_0xaf35('0x47')]['id']){delete _0x25706c[_0xaf35('0x47')]['id'];}return db['SmsQueueReport'][_0xaf35('0x45')]({'where':{'id':_0x25706c['params']['id']}})['then'](handleEntityNotFound(_0x1afe8f,null))[_0xaf35('0x22')](saveUpdates(_0x25706c['body'],null))[_0xaf35('0x22')](respondWithResult(_0x1afe8f,null))[_0xaf35('0x41')](handleError(_0x1afe8f,null));};exports['destroy']=function(_0x2b660c,_0x1d877e){return db[_0xaf35('0x2a')][_0xaf35('0x45')]({'where':{'id':_0x2b660c[_0xaf35('0x43')]['id']}})[_0xaf35('0x22')](handleEntityNotFound(_0x1d877e,null))[_0xaf35('0x22')](removeEntity(_0x1d877e,null))[_0xaf35('0x41')](handleError(_0x1d877e,null));};exports[_0xaf35('0x48')]=function(_0x1dc939,_0x544ae2){return db[_0xaf35('0x2a')]['describe']()[_0xaf35('0x22')](respondWithResult(_0x544ae2,null))[_0xaf35('0x41')](handleError(_0x544ae2,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index fe23c3f..49f4898 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 _0x0849=['moment','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0849,0xca));var _0x9084=function(_0x1b65c6,_0x295b12){_0x1b65c6=_0x1b65c6-0x0;var _0x4ce2ae=_0x0849[_0x1b65c6];return _0x4ce2ae;};'use strict';var _=require(_0x9084('0x0'));var util=require(_0x9084('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9084('0x2'));var BPromise=require(_0x9084('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9084('0x4'));var rimraf=require(_0x9084('0x5'));var config=require(_0x9084('0x6'));var attributes=require(_0x9084('0x7'));module['exports']=function(_0x321e2e,_0x42288f){return _0x321e2e[_0x9084('0x8')](_0x9084('0x9'),attributes,{'tableName':_0x9084('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9084('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5694=['SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x2064c8,_0x168039){var _0x23af73=function(_0x2a2d10){while(--_0x2a2d10){_0x2064c8['push'](_0x2064c8['shift']());}};_0x23af73(++_0x168039);}(_0x5694,0x1ca));var _0x4569=function(_0x59f93f,_0x376c01){_0x59f93f=_0x59f93f-0x0;var _0x5c989e=_0x5694[_0x59f93f];return _0x5c989e;};'use strict';var _=require(_0x4569('0x0'));var util=require(_0x4569('0x1'));var logger=require(_0x4569('0x2'))(_0x4569('0x3'));var moment=require('moment');var BPromise=require(_0x4569('0x4'));var rp=require(_0x4569('0x5'));var fs=require('fs');var path=require(_0x4569('0x6'));var rimraf=require('rimraf');var config=require(_0x4569('0x7'));var attributes=require('./smsQueueReport.attributes');module[_0x4569('0x8')]=function(_0x3b692e,_0x459790){return _0x3b692e[_0x4569('0x9')](_0x4569('0xa'),attributes,{'tableName':_0x4569('0xb'),'paranoid':![],'indexes':[{'name':_0x4569('0xc'),'fields':[_0x4569('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 51781a5..cbe10f0 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 _0x2bdd=['ioredis','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','CreateSmsQueueReport','UpdateSmsQueueReport','update','raw','where','limit','util','moment','bluebird'];(function(_0x5a349d,_0x3b73b5){var _0x3643a1=function(_0x22fe6b){while(--_0x22fe6b){_0x5a349d['push'](_0x5a349d['shift']());}};_0x3643a1(++_0x3b73b5);}(_0x2bdd,0x71));var _0xd2bd=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x2bdd[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require('lodash');var util=require(_0xd2bd('0x0'));var moment=require(_0xd2bd('0x1'));var BPromise=require(_0xd2bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd2bd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd2bd('0x4'));var jayson=require(_0xd2bd('0x5'));var client=jayson[_0xd2bd('0x6')][_0xd2bd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x100bfc,_0x4b335c,_0x555e30){return new BPromise(function(_0x48cb61,_0x2d40aa){return client[_0xd2bd('0x8')](_0x100bfc,_0x555e30)[_0xd2bd('0x9')](function(_0x1d3a6f){logger[_0xd2bd('0xa')](_0xd2bd('0xb'),_0x4b335c,_0xd2bd('0xc'));logger[_0xd2bd('0xd')](_0xd2bd('0xe'),_0x4b335c,'request\x20sent',JSON[_0xd2bd('0xf')](_0x1d3a6f));if(_0x1d3a6f[_0xd2bd('0x10')]){if(_0x1d3a6f[_0xd2bd('0x10')]['code']===0x1f4){logger[_0xd2bd('0x10')](_0xd2bd('0xb'),_0x4b335c,_0x1d3a6f[_0xd2bd('0x10')][_0xd2bd('0x11')]);return _0x2d40aa(_0x1d3a6f[_0xd2bd('0x10')][_0xd2bd('0x11')]);}logger[_0xd2bd('0x10')](_0xd2bd('0xb'),_0x4b335c,_0x1d3a6f[_0xd2bd('0x10')]['message']);return _0x48cb61(_0x1d3a6f['error'][_0xd2bd('0x11')]);}else{logger['info'](_0xd2bd('0xb'),_0x4b335c,'request\x20sent');_0x48cb61(_0x1d3a6f[_0xd2bd('0x12')][_0xd2bd('0x11')]);}})[_0xd2bd('0x13')](function(_0x4df64f){logger['error'](_0xd2bd('0xb'),_0x4b335c,_0x4df64f);_0x2d40aa(_0x4df64f);});});}exports['CreateSmsQueueReport']=function(_0x198ef0){var _0x28f61c=this;return new Promise(function(_0x32e5d5,_0x1e48ce){return db['SmsQueueReport'][_0xd2bd('0x14')](_0x198ef0[_0xd2bd('0x15')],{'raw':_0x198ef0[_0xd2bd('0x16')]?_0x198ef0[_0xd2bd('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xd2bd('0x9')](function(_0x10f52e){logger[_0xd2bd('0xa')](_0xd2bd('0x17'),_0x198ef0);logger[_0xd2bd('0xd')](_0xd2bd('0x17'),_0x198ef0,JSON[_0xd2bd('0xf')](_0x10f52e));_0x32e5d5(_0x10f52e);})[_0xd2bd('0x13')](function(_0x19052e){logger[_0xd2bd('0x10')]('CreateSmsQueueReport',_0x19052e[_0xd2bd('0x11')],_0x198ef0);_0x1e48ce(_0x28f61c['error'](0x1f4,_0x19052e[_0xd2bd('0x11')]));});});};exports[_0xd2bd('0x18')]=function(_0x38f3b2){var _0xc06457=this;return new Promise(function(_0x4c21a1,_0x3e9b07){return db['SmsQueueReport'][_0xd2bd('0x19')](_0x38f3b2[_0xd2bd('0x15')],{'raw':_0x38f3b2[_0xd2bd('0x16')]?_0x38f3b2[_0xd2bd('0x16')][_0xd2bd('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38f3b2[_0xd2bd('0x16')]?_0x38f3b2['options'][_0xd2bd('0x1b')]||null:null,'attributes':_0x38f3b2[_0xd2bd('0x16')]?_0x38f3b2[_0xd2bd('0x16')]['attributes']||null:null,'limit':_0x38f3b2['options']?_0x38f3b2['options'][_0xd2bd('0x1c')]||null:null})['then'](function(_0x62df94){logger[_0xd2bd('0xa')]('UpdateSmsQueueReport',_0x38f3b2);logger[_0xd2bd('0xd')](_0xd2bd('0x18'),_0x38f3b2,JSON['stringify'](_0x62df94));_0x4c21a1(_0x62df94);})[_0xd2bd('0x13')](function(_0x2c60b5){logger['error'](_0xd2bd('0x18'),_0x2c60b5['message'],_0x38f3b2);_0x3e9b07(_0xc06457[_0xd2bd('0x10')](0x1f4,_0x2c60b5[_0xd2bd('0x11')]));});});}; \ No newline at end of file +var _0xd564=['SmsQueueReport,\x20%s,\x20%s','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','UpdateSmsQueueReport','update','limit','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd564,0x152));var _0x4d56=function(_0x13e047,_0x1c3aa9){_0x13e047=_0x13e047-0x0;var _0x42b8c1=_0xd564[_0x13e047];return _0x42b8c1;};'use strict';var _=require('lodash');var util=require(_0x4d56('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d56('0x1'));var fs=require('fs');var Redis=require(_0x4d56('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4d56('0x3'))(_0x4d56('0x4'));var config=require(_0x4d56('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4d56('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x25a7f3,_0x41c1da,_0x2a6cfb){return new BPromise(function(_0x27fc56,_0x3f16e8){return client[_0x4d56('0x7')](_0x25a7f3,_0x2a6cfb)[_0x4d56('0x8')](function(_0x1c09dd){logger[_0x4d56('0x9')](_0x4d56('0xa'),_0x41c1da,'request\x20sent');logger['debug'](_0x4d56('0xb'),_0x41c1da,'request\x20sent',JSON[_0x4d56('0xc')](_0x1c09dd));if(_0x1c09dd[_0x4d56('0xd')]){if(_0x1c09dd[_0x4d56('0xd')][_0x4d56('0xe')]===0x1f4){logger[_0x4d56('0xd')](_0x4d56('0xa'),_0x41c1da,_0x1c09dd[_0x4d56('0xd')]['message']);return _0x3f16e8(_0x1c09dd[_0x4d56('0xd')][_0x4d56('0xf')]);}logger[_0x4d56('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x41c1da,_0x1c09dd[_0x4d56('0xd')]['message']);return _0x27fc56(_0x1c09dd[_0x4d56('0xd')]['message']);}else{logger['info'](_0x4d56('0xa'),_0x41c1da,_0x4d56('0x10'));_0x27fc56(_0x1c09dd[_0x4d56('0x11')]['message']);}})[_0x4d56('0x12')](function(_0x6f4f){logger[_0x4d56('0xd')](_0x4d56('0xa'),_0x41c1da,_0x6f4f);_0x3f16e8(_0x6f4f);});});}exports[_0x4d56('0x13')]=function(_0x3eb483){var _0x83f679=this;return new Promise(function(_0x290683,_0x1dd773){return db[_0x4d56('0x14')][_0x4d56('0x15')](_0x3eb483[_0x4d56('0x16')],{'raw':_0x3eb483[_0x4d56('0x17')]?_0x3eb483['options'][_0x4d56('0x18')]===undefined?!![]:![]:!![]})[_0x4d56('0x8')](function(_0x8e63a){logger[_0x4d56('0x9')](_0x4d56('0x13'),_0x3eb483);logger[_0x4d56('0x19')](_0x4d56('0x13'),_0x3eb483,JSON[_0x4d56('0xc')](_0x8e63a));_0x290683(_0x8e63a);})[_0x4d56('0x12')](function(_0x46e171){logger[_0x4d56('0xd')]('CreateSmsQueueReport',_0x46e171['message'],_0x3eb483);_0x1dd773(_0x83f679[_0x4d56('0xd')](0x1f4,_0x46e171['message']));});});};exports[_0x4d56('0x1a')]=function(_0x3f44c1){var _0x3d9d04=this;return new Promise(function(_0x103de8,_0x497769){return db[_0x4d56('0x14')][_0x4d56('0x1b')](_0x3f44c1['body'],{'raw':_0x3f44c1[_0x4d56('0x17')]?_0x3f44c1['options'][_0x4d56('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f44c1['options']?_0x3f44c1['options']['where']||null:null,'attributes':_0x3f44c1['options']?_0x3f44c1[_0x4d56('0x17')]['attributes']||null:null,'limit':_0x3f44c1[_0x4d56('0x17')]?_0x3f44c1[_0x4d56('0x17')][_0x4d56('0x1c')]||null:null})[_0x4d56('0x8')](function(_0x39a256){logger['info']('UpdateSmsQueueReport',_0x3f44c1);logger[_0x4d56('0x19')](_0x4d56('0x1a'),_0x3f44c1,JSON[_0x4d56('0xc')](_0x39a256));_0x103de8(_0x39a256);})[_0x4d56('0x12')](function(_0x5b3a4b){logger[_0x4d56('0xd')](_0x4d56('0x1a'),_0x5b3a4b[_0x4d56('0xf')],_0x3f44c1);_0x497769(_0x3d9d04[_0x4d56('0xd')](0x1f4,_0x5b3a4b[_0x4d56('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 1cd1188..0b46fb5 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 _0x16f6=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','create','delete','destroy','exports'];(function(_0x58fae5,_0xea34ed){var _0x2c5345=function(_0x16879f){while(--_0x16879f){_0x58fae5['push'](_0x58fae5['shift']());}};_0x2c5345(++_0xea34ed);}(_0x16f6,0xc8));var _0x616f=function(_0x2c76c4,_0x8720e9){_0x2c76c4=_0x2c76c4-0x0;var _0x4e7aba=_0x16f6[_0x2c76c4];return _0x4e7aba;};'use strict';var multer=require(_0x616f('0x0'));var util=require(_0x616f('0x1'));var path=require(_0x616f('0x2'));var timeout=require(_0x616f('0x3'));var express=require(_0x616f('0x4'));var router=express[_0x616f('0x5')]();var fs_extra=require(_0x616f('0x6'));var auth=require(_0x616f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x616f('0x8'));var controller=require(_0x616f('0x9'));router[_0x616f('0xa')]('/',auth[_0x616f('0xb')](),controller[_0x616f('0xc')]);router[_0x616f('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x616f('0xd')]);router[_0x616f('0xa')](_0x616f('0xe'),auth[_0x616f('0xb')](),controller[_0x616f('0xf')]);router['post']('/',auth[_0x616f('0xb')](),controller[_0x616f('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x616f('0x11')]('/:id',auth[_0x616f('0xb')](),controller[_0x616f('0x12')]);module[_0x616f('0x13')]=router; \ No newline at end of file +var _0xa260=['index','get','describe','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller'];(function(_0x33f750,_0x3a0638){var _0xd2186a=function(_0x20b011){while(--_0x20b011){_0x33f750['push'](_0x33f750['shift']());}};_0xd2186a(++_0x3a0638);}(_0xa260,0xbc));var _0x0a26=function(_0x292007,_0x55cafa){_0x292007=_0x292007-0x0;var _0x37af5e=_0xa260[_0x292007];return _0x37af5e;};'use strict';var multer=require(_0x0a26('0x0'));var util=require(_0x0a26('0x1'));var path=require(_0x0a26('0x2'));var timeout=require(_0x0a26('0x3'));var express=require('express');var router=express[_0x0a26('0x4')]();var fs_extra=require(_0x0a26('0x5'));var auth=require(_0x0a26('0x6'));var interaction=require(_0x0a26('0x7'));var config=require(_0x0a26('0x8'));var controller=require(_0x0a26('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x0a26('0xa')]);router[_0x0a26('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x0a26('0xc')]);router[_0x0a26('0xb')](_0x0a26('0xd'),auth[_0x0a26('0xe')](),controller[_0x0a26('0xf')]);router[_0x0a26('0x10')]('/',auth['isAuthenticated'](),controller[_0x0a26('0x11')]);router[_0x0a26('0x12')](_0x0a26('0xd'),auth[_0x0a26('0xe')](),controller['update']);router[_0x0a26('0x13')](_0x0a26('0xd'),auth[_0x0a26('0xe')](),controller[_0x0a26('0x14')]);module[_0x0a26('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index e9af059..bad7d9a 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 _0x9537=['NOW','sequelize','STRING','ENUM','account','queue','DATE'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x9537,0x151));var _0x7953=function(_0x424b05,_0x526b5b){_0x424b05=_0x424b05-0x0;var _0x4c65cd=_0x9537[_0x424b05];return _0x4c65cd;};'use strict';var moment=require('moment');var Sequelize=require(_0x7953('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7953('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7953('0x2')](_0x7953('0x3'),'agent',_0x7953('0x4')),'allowNull':![],'defaultValue':_0x7953('0x4')},'transferredAt':{'type':Sequelize[_0x7953('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x7953('0x6')]}}; \ No newline at end of file +var _0xc917=['exports','STRING','ENUM','account','agent','DATE','moment','sequelize'];(function(_0x3ab9f1,_0x85c28b){var _0x49ed43=function(_0x4d48a0){while(--_0x4d48a0){_0x3ab9f1['push'](_0x3ab9f1['shift']());}};_0x49ed43(++_0x85c28b);}(_0xc917,0xee));var _0x7c91=function(_0x4ffdc4,_0x34a28a){_0x4ffdc4=_0x4ffdc4-0x0;var _0x3b010c=_0xc917[_0x4ffdc4];return _0x3b010c;};'use strict';var moment=require(_0x7c91('0x0'));var Sequelize=require(_0x7c91('0x1'));module[_0x7c91('0x2')]={'uniqueid':{'type':Sequelize[_0x7c91('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7c91('0x4')](_0x7c91('0x5'),_0x7c91('0x6'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x7c91('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index e8c2c07..cde135f 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 _0xbba0=['length','hasOwnProperty','nolimit','order','where','filters','pick','type','VIRTUAL','filter','options','SmsTransferReport','includeAll','include','rows','catch','params','keys','merge','find','create','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','attributes','intersection','fields'];(function(_0x19fe32,_0x3a8828){var _0x3185cd=function(_0x1162c1){while(--_0x1162c1){_0x19fe32['push'](_0x19fe32['shift']());}};_0x3185cd(++_0x3a8828);}(_0xbba0,0xf5));var _0x0bba=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xbba0[_0x36ed48];return _0x51c63a;};'use strict';var pdf=require(_0x0bba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0bba('0x1'));var zipdir=require(_0x0bba('0x2'));var jsonpatch=require(_0x0bba('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0bba('0x4'));var Mustache=require(_0x0bba('0x5'));var util=require(_0x0bba('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0bba('0x7'));var ejs=require(_0x0bba('0x8'));var fs=require('fs');var fs_extra=require(_0x0bba('0x9'));var _=require('lodash');var squel=require(_0x0bba('0xa'));var crypto=require(_0x0bba('0xb'));var jsforce=require(_0x0bba('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0bba('0xd'));var Papa=require(_0x0bba('0xe'));var Redis=require(_0x0bba('0xf'));var authService=require(_0x0bba('0x10'));var qs=require(_0x0bba('0x11'));var as=require(_0x0bba('0x12'));var hardwareService=require(_0x0bba('0x13'));var logger=require(_0x0bba('0x14'))(_0x0bba('0x15'));var utils=require(_0x0bba('0x16'));var config=require(_0x0bba('0x17'));var licenseUtil=require(_0x0bba('0x18'));var db=require(_0x0bba('0x19'))['db'];function respondWithStatusCode(_0x4a4134,_0x5e9cd2){_0x5e9cd2=_0x5e9cd2||0xcc;return function(_0x58b3eb){if(_0x58b3eb){return _0x4a4134[_0x0bba('0x1a')](_0x5e9cd2);}return _0x4a4134[_0x0bba('0x1b')](_0x5e9cd2)[_0x0bba('0x1c')]();};}function respondWithResult(_0x58085b,_0x2b3034){_0x2b3034=_0x2b3034||0xc8;return function(_0x3ea57f){if(_0x3ea57f){return _0x58085b[_0x0bba('0x1b')](_0x2b3034)['json'](_0x3ea57f);}};}function respondWithFilteredResult(_0xde4670,_0x68c148){return function(_0x1c39cf){if(_0x1c39cf){var _0x1876bf=_0x1c39cf[_0x0bba('0x1d')],_0x5cffce=_0x68c148[_0x0bba('0x1e')],_0x2c66e5=_0x68c148['offset']+_0x68c148[_0x0bba('0x1f')],_0x1a94b5;if(_0x2c66e5>=_0x1876bf){_0x2c66e5=_0x1876bf;_0x1a94b5=0xc8;}else{_0x1a94b5=0xce;}_0xde4670[_0x0bba('0x1b')](_0x1a94b5);return _0xde4670['set'](_0x0bba('0x20'),_0x5cffce+'-'+_0x2c66e5+'/'+_0x1876bf)[_0x0bba('0x21')](_0x1c39cf);}return null;};}function patchUpdates(_0x4a2a6b){return function(_0x42da1e){try{jsonpatch[_0x0bba('0x22')](_0x42da1e,_0x4a2a6b,!![]);}catch(_0x2d0af2){return BPromise['reject'](_0x2d0af2);}return _0x42da1e[_0x0bba('0x23')]();};}function saveUpdates(_0x38fec5,_0x44b609){return function(_0xd44019){if(_0xd44019){return _0xd44019[_0x0bba('0x24')](_0x38fec5)[_0x0bba('0x25')](function(_0x2889e3){return _0x2889e3;});}return null;};}function removeEntity(_0x392308,_0x5292b2){return function(_0xf651a3){if(_0xf651a3){return _0xf651a3['destroy']()[_0x0bba('0x25')](function(){_0x392308[_0x0bba('0x1b')](0xcc)[_0x0bba('0x1c')]();});}};}function handleEntityNotFound(_0x429ae7,_0x264539){return function(_0x6f3d08){if(!_0x6f3d08){_0x429ae7['sendStatus'](0x194);}return _0x6f3d08;};}function handleError(_0x359d50,_0x59bf72){_0x59bf72=_0x59bf72||0x1f4;return function(_0x2128ec){logger[_0x0bba('0x26')](_0x2128ec[_0x0bba('0x27')]);if(_0x2128ec[_0x0bba('0x28')]){delete _0x2128ec[_0x0bba('0x28')];}_0x359d50[_0x0bba('0x1b')](_0x59bf72)[_0x0bba('0x29')](_0x2128ec);};}exports['index']=function(_0x128240,_0x553a48){var _0x15c0bf={},_0x445088={},_0x467f17={'count':0x0,'rows':[]};var _0x317d3d=_[_0x0bba('0x2a')](db['SmsTransferReport'][_0x0bba('0x2b')],function(_0x7c6285){return{'name':_0x7c6285[_0x0bba('0x2c')],'type':_0x7c6285['type'][_0x0bba('0x2d')]};});_0x445088[_0x0bba('0x2e')]=_[_0x0bba('0x2a')](_0x317d3d,'name');_0x445088['query']=_['keys'](_0x128240[_0x0bba('0x2f')]);_0x445088['filters']=_['intersection'](_0x445088[_0x0bba('0x2e')],_0x445088[_0x0bba('0x2f')]);_0x15c0bf[_0x0bba('0x30')]=_[_0x0bba('0x31')](_0x445088[_0x0bba('0x2e')],qs['fields'](_0x128240[_0x0bba('0x2f')][_0x0bba('0x32')]));_0x15c0bf[_0x0bba('0x30')]=_0x15c0bf[_0x0bba('0x30')][_0x0bba('0x33')]?_0x15c0bf['attributes']:_0x445088[_0x0bba('0x2e')];if(!_0x128240['query'][_0x0bba('0x34')](_0x0bba('0x35'))){_0x15c0bf[_0x0bba('0x1f')]=qs[_0x0bba('0x1f')](_0x128240[_0x0bba('0x2f')][_0x0bba('0x1f')]);_0x15c0bf[_0x0bba('0x1e')]=qs[_0x0bba('0x1e')](_0x128240[_0x0bba('0x2f')][_0x0bba('0x1e')]);}_0x15c0bf[_0x0bba('0x36')]=qs['sort'](_0x128240[_0x0bba('0x2f')]['sort']);_0x15c0bf[_0x0bba('0x37')]=qs[_0x0bba('0x38')](_[_0x0bba('0x39')](_0x128240['query'],_0x445088[_0x0bba('0x38')]),_0x317d3d);if(_0x128240[_0x0bba('0x2f')]['filter']){_0x15c0bf['where']=_['merge'](_0x15c0bf[_0x0bba('0x37')],{'$or':_['map'](_0x317d3d,function(_0x3391af){if(_0x3391af[_0x0bba('0x3a')]!==_0x0bba('0x3b')){var _0x2c9e00={};_0x2c9e00[_0x3391af['name']]={'$like':'%'+_0x128240[_0x0bba('0x2f')][_0x0bba('0x3c')]+'%'};return _0x2c9e00;}})});}_0x15c0bf=_['merge']({},_0x15c0bf,_0x128240[_0x0bba('0x3d')]);var _0x4b0dcf={'where':_0x15c0bf[_0x0bba('0x37')]};return db[_0x0bba('0x3e')]['count'](_0x4b0dcf)[_0x0bba('0x25')](function(_0x125329){_0x467f17[_0x0bba('0x1d')]=_0x125329;if(_0x128240[_0x0bba('0x2f')][_0x0bba('0x3f')]){_0x15c0bf[_0x0bba('0x40')]=[{'all':!![]}];}return db[_0x0bba('0x3e')]['findAll'](_0x15c0bf);})[_0x0bba('0x25')](function(_0x31a3a2){_0x467f17[_0x0bba('0x41')]=_0x31a3a2;return _0x467f17;})['then'](respondWithFilteredResult(_0x553a48,_0x15c0bf))[_0x0bba('0x42')](handleError(_0x553a48,null));};exports['show']=function(_0x29d28,_0x3482c3){var _0x4de980={'raw':!![],'where':{'id':_0x29d28[_0x0bba('0x43')]['id']}},_0x4dff62={};_0x4dff62[_0x0bba('0x2e')]=_[_0x0bba('0x44')](db[_0x0bba('0x3e')]['rawAttributes']);_0x4dff62['query']=_['keys'](_0x29d28[_0x0bba('0x2f')]);_0x4dff62[_0x0bba('0x38')]=_[_0x0bba('0x31')](_0x4dff62[_0x0bba('0x2e')],_0x4dff62[_0x0bba('0x2f')]);_0x4de980['attributes']=_[_0x0bba('0x31')](_0x4dff62[_0x0bba('0x2e')],qs[_0x0bba('0x32')](_0x29d28['query'][_0x0bba('0x32')]));_0x4de980['attributes']=_0x4de980[_0x0bba('0x30')][_0x0bba('0x33')]?_0x4de980[_0x0bba('0x30')]:_0x4dff62[_0x0bba('0x2e')];if(_0x29d28[_0x0bba('0x2f')][_0x0bba('0x3f')]){_0x4de980[_0x0bba('0x40')]=[{'all':!![]}];}_0x4de980=_[_0x0bba('0x45')]({},_0x4de980,_0x29d28['options']);return db['SmsTransferReport'][_0x0bba('0x46')](_0x4de980)[_0x0bba('0x25')](handleEntityNotFound(_0x3482c3,null))['then'](respondWithResult(_0x3482c3,null))['catch'](handleError(_0x3482c3,null));};exports[_0x0bba('0x47')]=function(_0x14a4a8,_0xcf41a){return db[_0x0bba('0x3e')]['create'](_0x14a4a8[_0x0bba('0x48')],{})['then'](respondWithResult(_0xcf41a,0xc9))[_0x0bba('0x42')](handleError(_0xcf41a,null));};exports[_0x0bba('0x24')]=function(_0x13589f,_0x447cff){if(_0x13589f[_0x0bba('0x48')]['id']){delete _0x13589f['body']['id'];}return db[_0x0bba('0x3e')]['find']({'where':{'id':_0x13589f[_0x0bba('0x43')]['id']}})['then'](handleEntityNotFound(_0x447cff,null))[_0x0bba('0x25')](saveUpdates(_0x13589f[_0x0bba('0x48')],null))[_0x0bba('0x25')](respondWithResult(_0x447cff,null))[_0x0bba('0x42')](handleError(_0x447cff,null));};exports[_0x0bba('0x49')]=function(_0x24d50b,_0x149675){return db[_0x0bba('0x3e')]['find']({'where':{'id':_0x24d50b[_0x0bba('0x43')]['id']}})[_0x0bba('0x25')](handleEntityNotFound(_0x149675,null))[_0x0bba('0x25')](removeEntity(_0x149675,null))['catch'](handleError(_0x149675,null));};exports['describe']=function(_0x2da3f0,_0x25dc43){return db[_0x0bba('0x3e')]['describe']()[_0x0bba('0x25')](respondWithResult(_0x25dc43,null))[_0x0bba('0x42')](handleError(_0x25dc43,null));}; \ No newline at end of file +var _0xca87=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','json','apply','reject','save','then','destroy','error','stack','name','send','map','SmsTransferReport','fieldName','type','key','query','intersection','model','attributes','length','hasOwnProperty','limit','where','filters','pick','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','keys','fields','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash'];(function(_0x367361,_0x311488){var _0x195d2d=function(_0x2b20a4){while(--_0x2b20a4){_0x367361['push'](_0x367361['shift']());}};_0x195d2d(++_0x311488);}(_0xca87,0xcf));var _0x7ca8=function(_0x49d79a,_0x1fd57e){_0x49d79a=_0x49d79a-0x0;var _0x3aba02=_0xca87[_0x49d79a];return _0x3aba02;};'use strict';var pdf=require(_0x7ca8('0x0'));var emlformat=require(_0x7ca8('0x1'));var rimraf=require(_0x7ca8('0x2'));var zipdir=require(_0x7ca8('0x3'));var jsonpatch=require(_0x7ca8('0x4'));var rp=require('request-promise');var moment=require(_0x7ca8('0x5'));var BPromise=require(_0x7ca8('0x6'));var Mustache=require(_0x7ca8('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7ca8('0x8'));var ejs=require(_0x7ca8('0x9'));var fs=require('fs');var fs_extra=require(_0x7ca8('0xa'));var _=require(_0x7ca8('0xb'));var squel=require(_0x7ca8('0xc'));var crypto=require(_0x7ca8('0xd'));var jsforce=require(_0x7ca8('0xe'));var deskjs=require(_0x7ca8('0xf'));var toCsv=require(_0x7ca8('0x8'));var querystring=require(_0x7ca8('0x10'));var Papa=require('papaparse');var Redis=require(_0x7ca8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7ca8('0x12'));var as=require(_0x7ca8('0x13'));var hardwareService=require(_0x7ca8('0x14'));var logger=require(_0x7ca8('0x15'))(_0x7ca8('0x16'));var utils=require(_0x7ca8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7ca8('0x18'));var db=require(_0x7ca8('0x19'))['db'];function respondWithStatusCode(_0x1c081a,_0x431952){_0x431952=_0x431952||0xcc;return function(_0x433eb8){if(_0x433eb8){return _0x1c081a[_0x7ca8('0x1a')](_0x431952);}return _0x1c081a[_0x7ca8('0x1b')](_0x431952)[_0x7ca8('0x1c')]();};}function respondWithResult(_0x278004,_0x49cef2){_0x49cef2=_0x49cef2||0xc8;return function(_0xd0d09b){if(_0xd0d09b){return _0x278004[_0x7ca8('0x1b')](_0x49cef2)['json'](_0xd0d09b);}};}function respondWithFilteredResult(_0x5c3f52,_0x15d632){return function(_0x559d23){if(_0x559d23){var _0x10f53a=_0x559d23['count'],_0x120b94=_0x15d632[_0x7ca8('0x1d')],_0x3d5700=_0x15d632[_0x7ca8('0x1d')]+_0x15d632['limit'],_0x4913f1;if(_0x3d5700>=_0x10f53a){_0x3d5700=_0x10f53a;_0x4913f1=0xc8;}else{_0x4913f1=0xce;}_0x5c3f52['status'](_0x4913f1);return _0x5c3f52[_0x7ca8('0x1e')]('Content-Range',_0x120b94+'-'+_0x3d5700+'/'+_0x10f53a)[_0x7ca8('0x1f')](_0x559d23);}return null;};}function patchUpdates(_0x5abd56){return function(_0xd0a157){try{jsonpatch[_0x7ca8('0x20')](_0xd0a157,_0x5abd56,!![]);}catch(_0xe58e2c){return BPromise[_0x7ca8('0x21')](_0xe58e2c);}return _0xd0a157[_0x7ca8('0x22')]();};}function saveUpdates(_0x502e47,_0x249b39){return function(_0x3cb464){if(_0x3cb464){return _0x3cb464['update'](_0x502e47)[_0x7ca8('0x23')](function(_0x1b8193){return _0x1b8193;});}return null;};}function removeEntity(_0x561534,_0x4d7a20){return function(_0x54b5be){if(_0x54b5be){return _0x54b5be[_0x7ca8('0x24')]()[_0x7ca8('0x23')](function(){_0x561534[_0x7ca8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ac6b0,_0x35bae6){return function(_0x569674){if(!_0x569674){_0x1ac6b0['sendStatus'](0x194);}return _0x569674;};}function handleError(_0x44e3a0,_0x10a2a5){_0x10a2a5=_0x10a2a5||0x1f4;return function(_0x2a1bea){logger[_0x7ca8('0x25')](_0x2a1bea[_0x7ca8('0x26')]);if(_0x2a1bea['name']){delete _0x2a1bea[_0x7ca8('0x27')];}_0x44e3a0[_0x7ca8('0x1b')](_0x10a2a5)[_0x7ca8('0x28')](_0x2a1bea);};}exports['index']=function(_0x652012,_0x32b71a){var _0xfafa9e={},_0x5c0c53={},_0xa0a22c={'count':0x0,'rows':[]};var _0x5bf0d9=_[_0x7ca8('0x29')](db[_0x7ca8('0x2a')]['rawAttributes'],function(_0x4f4312){return{'name':_0x4f4312[_0x7ca8('0x2b')],'type':_0x4f4312[_0x7ca8('0x2c')][_0x7ca8('0x2d')]};});_0x5c0c53['model']=_[_0x7ca8('0x29')](_0x5bf0d9,'name');_0x5c0c53[_0x7ca8('0x2e')]=_['keys'](_0x652012[_0x7ca8('0x2e')]);_0x5c0c53['filters']=_[_0x7ca8('0x2f')](_0x5c0c53[_0x7ca8('0x30')],_0x5c0c53[_0x7ca8('0x2e')]);_0xfafa9e['attributes']=_[_0x7ca8('0x2f')](_0x5c0c53[_0x7ca8('0x30')],qs['fields'](_0x652012[_0x7ca8('0x2e')]['fields']));_0xfafa9e[_0x7ca8('0x31')]=_0xfafa9e[_0x7ca8('0x31')][_0x7ca8('0x32')]?_0xfafa9e[_0x7ca8('0x31')]:_0x5c0c53[_0x7ca8('0x30')];if(!_0x652012[_0x7ca8('0x2e')][_0x7ca8('0x33')]('nolimit')){_0xfafa9e[_0x7ca8('0x34')]=qs[_0x7ca8('0x34')](_0x652012['query'][_0x7ca8('0x34')]);_0xfafa9e[_0x7ca8('0x1d')]=qs[_0x7ca8('0x1d')](_0x652012[_0x7ca8('0x2e')]['offset']);}_0xfafa9e['order']=qs['sort'](_0x652012[_0x7ca8('0x2e')]['sort']);_0xfafa9e[_0x7ca8('0x35')]=qs[_0x7ca8('0x36')](_[_0x7ca8('0x37')](_0x652012['query'],_0x5c0c53[_0x7ca8('0x36')]),_0x5bf0d9);if(_0x652012[_0x7ca8('0x2e')]['filter']){_0xfafa9e[_0x7ca8('0x35')]=_[_0x7ca8('0x38')](_0xfafa9e['where'],{'$or':_[_0x7ca8('0x29')](_0x5bf0d9,function(_0x2fee96){if(_0x2fee96[_0x7ca8('0x2c')]!==_0x7ca8('0x39')){var _0x3e71d8={};_0x3e71d8[_0x2fee96[_0x7ca8('0x27')]]={'$like':'%'+_0x652012[_0x7ca8('0x2e')]['filter']+'%'};return _0x3e71d8;}})});}_0xfafa9e=_[_0x7ca8('0x38')]({},_0xfafa9e,_0x652012[_0x7ca8('0x3a')]);var _0x33ddb3={'where':_0xfafa9e[_0x7ca8('0x35')]};return db[_0x7ca8('0x2a')][_0x7ca8('0x3b')](_0x33ddb3)['then'](function(_0x4c759c){_0xa0a22c[_0x7ca8('0x3b')]=_0x4c759c;if(_0x652012[_0x7ca8('0x2e')][_0x7ca8('0x3c')]){_0xfafa9e[_0x7ca8('0x3d')]=[{'all':!![]}];}return db[_0x7ca8('0x2a')]['findAll'](_0xfafa9e);})['then'](function(_0x400b06){_0xa0a22c[_0x7ca8('0x3e')]=_0x400b06;return _0xa0a22c;})[_0x7ca8('0x23')](respondWithFilteredResult(_0x32b71a,_0xfafa9e))[_0x7ca8('0x3f')](handleError(_0x32b71a,null));};exports[_0x7ca8('0x40')]=function(_0xcab4d7,_0xab191b){var _0x2b9d31={'raw':!![],'where':{'id':_0xcab4d7[_0x7ca8('0x41')]['id']}},_0x176f6c={};_0x176f6c[_0x7ca8('0x30')]=_[_0x7ca8('0x42')](db[_0x7ca8('0x2a')]['rawAttributes']);_0x176f6c['query']=_[_0x7ca8('0x42')](_0xcab4d7[_0x7ca8('0x2e')]);_0x176f6c[_0x7ca8('0x36')]=_[_0x7ca8('0x2f')](_0x176f6c[_0x7ca8('0x30')],_0x176f6c['query']);_0x2b9d31[_0x7ca8('0x31')]=_['intersection'](_0x176f6c[_0x7ca8('0x30')],qs['fields'](_0xcab4d7[_0x7ca8('0x2e')][_0x7ca8('0x43')]));_0x2b9d31[_0x7ca8('0x31')]=_0x2b9d31[_0x7ca8('0x31')]['length']?_0x2b9d31[_0x7ca8('0x31')]:_0x176f6c[_0x7ca8('0x30')];if(_0xcab4d7[_0x7ca8('0x2e')][_0x7ca8('0x3c')]){_0x2b9d31[_0x7ca8('0x3d')]=[{'all':!![]}];}_0x2b9d31=_['merge']({},_0x2b9d31,_0xcab4d7[_0x7ca8('0x3a')]);return db[_0x7ca8('0x2a')]['find'](_0x2b9d31)[_0x7ca8('0x23')](handleEntityNotFound(_0xab191b,null))[_0x7ca8('0x23')](respondWithResult(_0xab191b,null))[_0x7ca8('0x3f')](handleError(_0xab191b,null));};exports[_0x7ca8('0x44')]=function(_0x11a50a,_0x37aa96){return db[_0x7ca8('0x2a')][_0x7ca8('0x44')](_0x11a50a[_0x7ca8('0x45')],{})['then'](respondWithResult(_0x37aa96,0xc9))[_0x7ca8('0x3f')](handleError(_0x37aa96,null));};exports[_0x7ca8('0x46')]=function(_0x2b0b71,_0x276912){if(_0x2b0b71['body']['id']){delete _0x2b0b71[_0x7ca8('0x45')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x2b0b71['params']['id']}})[_0x7ca8('0x23')](handleEntityNotFound(_0x276912,null))['then'](saveUpdates(_0x2b0b71[_0x7ca8('0x45')],null))[_0x7ca8('0x23')](respondWithResult(_0x276912,null))[_0x7ca8('0x3f')](handleError(_0x276912,null));};exports[_0x7ca8('0x24')]=function(_0x102719,_0x4d4006){return db[_0x7ca8('0x2a')][_0x7ca8('0x47')]({'where':{'id':_0x102719[_0x7ca8('0x41')]['id']}})[_0x7ca8('0x23')](handleEntityNotFound(_0x4d4006,null))[_0x7ca8('0x23')](removeEntity(_0x4d4006,null))['catch'](handleError(_0x4d4006,null));};exports[_0x7ca8('0x48')]=function(_0x2f44bd,_0x304603){return db[_0x7ca8('0x2a')]['describe']()[_0x7ca8('0x23')](respondWithResult(_0x304603,null))['catch'](handleError(_0x304603,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index b0f667e..9e95ca5 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 _0x82c4=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsTransferReport.attributes','define'];(function(_0x495ee7,_0x2a5811){var _0x4b6292=function(_0x582fe2){while(--_0x582fe2){_0x495ee7['push'](_0x495ee7['shift']());}};_0x4b6292(++_0x2a5811);}(_0x82c4,0x1ca));var _0x482c=function(_0xa61bff,_0x1dd784){_0xa61bff=_0xa61bff-0x0;var _0x7cf1ae=_0x82c4[_0xa61bff];return _0x7cf1ae;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[{'name':_0x482c('0xc'),'fields':[_0x482c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee1=['bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','moment'];(function(_0x55d48f,_0x56bfe8){var _0x3be71f=function(_0x576697){while(--_0x576697){_0x55d48f['push'](_0x55d48f['shift']());}};_0x3be71f(++_0x56bfe8);}(_0x7ee1,0x8d));var _0x17ee=function(_0x2c1d09,_0x1496ef){_0x2c1d09=_0x2c1d09-0x0;var _0xefcbf7=_0x7ee1[_0x2c1d09];return _0xefcbf7;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));module[_0x17ee('0x7')]=function(_0x5c0617,_0x52b1db){return _0x5c0617[_0x17ee('0x8')]('SmsTransferReport',attributes,{'tableName':_0x17ee('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x17ee('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 864b413..13896d4 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 _0xf49f=['code','message','SmsTransferReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x26dd96,_0x1e70a6){var _0x1aa18f=function(_0x1e846){while(--_0x1e846){_0x26dd96['push'](_0x26dd96['shift']());}};_0x1aa18f(++_0x1e70a6);}(_0xf49f,0x139));var _0xff49=function(_0x58f028,_0x8937ab){_0x58f028=_0x58f028-0x0;var _0x8e0ec8=_0xf49f[_0x58f028];return _0x8e0ec8;};'use strict';var _=require('lodash');var util=require(_0xff49('0x0'));var moment=require(_0xff49('0x1'));var BPromise=require(_0xff49('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff49('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xff49('0x4'));var logger=require(_0xff49('0x5'))(_0xff49('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xff49('0x7')][_0xff49('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42d054,_0x129277,_0x213924){return new BPromise(function(_0x6377f1,_0x5508c6){return client[_0xff49('0x9')](_0x42d054,_0x213924)[_0xff49('0xa')](function(_0x6f71a9){logger[_0xff49('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x129277,'request\x20sent');logger[_0xff49('0xc')](_0xff49('0xd'),_0x129277,_0xff49('0xe'),JSON[_0xff49('0xf')](_0x6f71a9));if(_0x6f71a9[_0xff49('0x10')]){if(_0x6f71a9['error'][_0xff49('0x11')]===0x1f4){logger[_0xff49('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x129277,_0x6f71a9[_0xff49('0x10')][_0xff49('0x12')]);return _0x5508c6(_0x6f71a9['error']['message']);}logger['error'](_0xff49('0x13'),_0x129277,_0x6f71a9[_0xff49('0x10')][_0xff49('0x12')]);return _0x6377f1(_0x6f71a9['error'][_0xff49('0x12')]);}else{logger[_0xff49('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x129277,_0xff49('0xe'));_0x6377f1(_0x6f71a9[_0xff49('0x14')][_0xff49('0x12')]);}})[_0xff49('0x15')](function(_0x52bbc3){logger['error'](_0xff49('0x13'),_0x129277,_0x52bbc3);_0x5508c6(_0x52bbc3);});});} \ No newline at end of file +var _0xd883=['rpc','jayson/promise','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2a6d8c,_0x19c800){var _0x31a401=function(_0x2bd376){while(--_0x2bd376){_0x2a6d8c['push'](_0x2a6d8c['shift']());}};_0x31a401(++_0x19c800);}(_0xd883,0xbf));var _0x3d88=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xd883[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x3d88('0x0'));var util=require(_0x3d88('0x1'));var moment=require(_0x3d88('0x2'));var BPromise=require(_0x3d88('0x3'));var rs=require(_0x3d88('0x4'));var fs=require('fs');var Redis=require(_0x3d88('0x5'));var db=require(_0x3d88('0x6'))['db'];var utils=require(_0x3d88('0x7'));var logger=require(_0x3d88('0x8'))(_0x3d88('0x9'));var config=require('../../config/environment');var jayson=require(_0x3d88('0xa'));var client=jayson[_0x3d88('0xb')][_0x3d88('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d9531,_0x504508,_0x1c5803){return new BPromise(function(_0x5da0b3,_0x344dcd){return client['request'](_0x2d9531,_0x1c5803)[_0x3d88('0xd')](function(_0x28dd39){logger[_0x3d88('0xe')](_0x3d88('0xf'),_0x504508,_0x3d88('0x10'));logger[_0x3d88('0x11')](_0x3d88('0x12'),_0x504508,'request\x20sent',JSON[_0x3d88('0x13')](_0x28dd39));if(_0x28dd39[_0x3d88('0x14')]){if(_0x28dd39[_0x3d88('0x14')][_0x3d88('0x15')]===0x1f4){logger[_0x3d88('0x14')](_0x3d88('0xf'),_0x504508,_0x28dd39['error'][_0x3d88('0x16')]);return _0x344dcd(_0x28dd39[_0x3d88('0x14')][_0x3d88('0x16')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x504508,_0x28dd39[_0x3d88('0x14')][_0x3d88('0x16')]);return _0x5da0b3(_0x28dd39[_0x3d88('0x14')][_0x3d88('0x16')]);}else{logger['info'](_0x3d88('0xf'),_0x504508,_0x3d88('0x10'));_0x5da0b3(_0x28dd39[_0x3d88('0x17')][_0x3d88('0x16')]);}})[_0x3d88('0x18')](function(_0x381088){logger[_0x3d88('0x14')](_0x3d88('0xf'),_0x504508,_0x381088);_0x344dcd(_0x381088);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3b8e40e..25987b8 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 _0x6cfc=['delete','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','originalname','replace','%s-%s%s','basename','now','post','file','put','update'];(function(_0x5040b0,_0x53c900){var _0x32d66e=function(_0x10451b){while(--_0x10451b){_0x5040b0['push'](_0x5040b0['shift']());}};_0x32d66e(++_0x53c900);}(_0x6cfc,0x1f0));var _0xc6cf=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0x6cfc[_0x528575];return _0x3063b7;};'use strict';var multer=require(_0xc6cf('0x0'));var util=require('util');var path=require(_0xc6cf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc6cf('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc6cf('0x3'));var config=require(_0xc6cf('0x4'));var controller=require(_0xc6cf('0x5'));router[_0xc6cf('0x6')]('/',auth[_0xc6cf('0x7')](),controller[_0xc6cf('0x8')]);router[_0xc6cf('0x6')](_0xc6cf('0x9'),auth[_0xc6cf('0x7')](),controller[_0xc6cf('0xa')]);router[_0xc6cf('0x6')](_0xc6cf('0xb'),auth[_0xc6cf('0x7')](),controller[_0xc6cf('0xc')]);var upload=multer({'storage':multer[_0xc6cf('0xd')]({'destination':function(_0x2a8096,_0x79ff5f,_0x1903d3){_0x1903d3(null,path[_0xc6cf('0xe')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x2398e9,_0x4e35cd,_0x2738a6){_0x4e35cd[_0xc6cf('0xf')]=_0x4e35cd['originalname'][_0xc6cf('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2738a6(null,util['format'](_0xc6cf('0x11'),path[_0xc6cf('0x12')](_0x4e35cd[_0xc6cf('0xf')],path['extname'](_0x4e35cd[_0xc6cf('0xf')])),Date[_0xc6cf('0x13')](),path['extname'](_0x4e35cd[_0xc6cf('0xf')])));}})});router[_0xc6cf('0x14')]('/',upload['single'](_0xc6cf('0x15')),controller['create']);router[_0xc6cf('0x16')](_0xc6cf('0x9'),auth[_0xc6cf('0x7')](),controller[_0xc6cf('0x17')]);router[_0xc6cf('0x18')](_0xc6cf('0x9'),auth[_0xc6cf('0x7')](),controller[_0xc6cf('0x18')]);module[_0xc6cf('0x19')]=router; \ No newline at end of file +var _0x4686=['%s-%s%s','basename','extname','now','post','create','update','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4686,0x1c1));var _0x6468=function(_0x5ea640,_0x55e0ec){_0x5ea640=_0x5ea640-0x0;var _0x26f888=_0x4686[_0x5ea640];return _0x26f888;};'use strict';var multer=require('multer');var util=require(_0x6468('0x0'));var path=require(_0x6468('0x1'));var timeout=require('connect-timeout');var express=require(_0x6468('0x2'));var router=express['Router']();var fs_extra=require(_0x6468('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6468('0x4'));var config=require(_0x6468('0x5'));var controller=require(_0x6468('0x6'));router[_0x6468('0x7')]('/',auth[_0x6468('0x8')](),controller[_0x6468('0x9')]);router[_0x6468('0x7')](_0x6468('0xa'),auth[_0x6468('0x8')](),controller[_0x6468('0xb')]);router[_0x6468('0x7')](_0x6468('0xc'),auth[_0x6468('0x8')](),controller[_0x6468('0xd')]);var upload=multer({'storage':multer[_0x6468('0xe')]({'destination':function(_0x1e11a6,_0x45b74f,_0x4965dc){_0x4965dc(null,path[_0x6468('0xf')](config['root'],_0x6468('0x10')));},'filename':function(_0x129596,_0x50fbea,_0x131477){_0x50fbea[_0x6468('0x11')]=_0x50fbea[_0x6468('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x131477(null,util[_0x6468('0x12')](_0x6468('0x13'),path[_0x6468('0x14')](_0x50fbea[_0x6468('0x11')],path[_0x6468('0x15')](_0x50fbea[_0x6468('0x11')])),Date[_0x6468('0x16')](),path[_0x6468('0x15')](_0x50fbea[_0x6468('0x11')])));}})});router[_0x6468('0x17')]('/',upload['single']('file'),controller[_0x6468('0x18')]);router['put'](_0x6468('0xa'),auth[_0x6468('0x8')](),controller[_0x6468('0x19')]);router['delete'](_0x6468('0xa'),auth[_0x6468('0x8')](),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 d84824a..7d8d430 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 _0xb31e=['BIGINT','sequelize','exports','STRING','FLOAT','INTEGER'];(function(_0x5db759,_0x46b917){var _0x137300=function(_0x312082){while(--_0x312082){_0x5db759['push'](_0x5db759['shift']());}};_0x137300(++_0x46b917);}(_0xb31e,0x17b));var _0xeb31=function(_0x58edc6,_0x1e068c){_0x58edc6=_0x58edc6-0x0;var _0x218d1b=_0xb31e[_0x58edc6];return _0x218d1b;};'use strict';var Sequelize=require(_0xeb31('0x0'));module[_0xeb31('0x1')]={'name':{'type':Sequelize[_0xeb31('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xeb31('0x2')]},'display_name':{'type':Sequelize[_0xeb31('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xeb31('0x2')]},'original_format':{'type':Sequelize[_0xeb31('0x2')]},'original_duration':{'type':Sequelize[_0xeb31('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xeb31('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xeb31('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xeb31('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xeb31('0x5')]},'converted_channelCount':{'type':Sequelize[_0xeb31('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xeb31('0x4')]}}; \ No newline at end of file +var _0x9683=['FLOAT','BIGINT','INTEGER','sequelize','STRING','name'];(function(_0x57d511,_0x3dab6a){var _0x2ce6c3=function(_0x38d98f){while(--_0x38d98f){_0x57d511['push'](_0x57d511['shift']());}};_0x2ce6c3(++_0x3dab6a);}(_0x9683,0x6f));var _0x3968=function(_0x43f88e,_0x4390e9){_0x43f88e=_0x43f88e-0x0;var _0x33d3e6=_0x9683[_0x43f88e];return _0x33d3e6;};'use strict';var Sequelize=require(_0x3968('0x0'));module['exports']={'name':{'type':Sequelize[_0x3968('0x1')],'unique':_0x3968('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x3968('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x3968('0x3')]},'original_sampleCount':{'type':Sequelize[_0x3968('0x4')]},'original_channelCount':{'type':Sequelize[_0x3968('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x3968('0x5')]},'converted_format':{'type':Sequelize[_0x3968('0x1')]},'converted_duration':{'type':Sequelize[_0x3968('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x3968('0x4')]},'converted_channelCount':{'type':Sequelize[_0x3968('0x5')]},'converted_bitRate':{'type':Sequelize[_0x3968('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x3968('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 544a455..d640b8d 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 _0xf1d7=['converted_bitRate','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','unlinkSync','html-pdf','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','reject','save','update','then','get','Sounds','UserProfileResource','destroy','error','stack','name','send','Sound','rawAttributes','fieldName','map','query','keys','filters','model','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','download','converted_format','existsSync','join','server/files/sounds/converted','save_name','Sequelize','root','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','duration','original_sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','sampleCount','converted_channelCount'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0xf1d7,0x17e));var _0x7f1d=function(_0xad5e8a,_0x5e74df){_0xad5e8a=_0xad5e8a-0x0;var _0x658ac=_0xf1d7[_0xad5e8a];return _0x658ac;};'use strict';var pdf=require(_0x7f1d('0x0'));var emlformat=require(_0x7f1d('0x1'));var rimraf=require(_0x7f1d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7f1d('0x3'));var moment=require(_0x7f1d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7f1d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7f1d('0x6'));var csv=require(_0x7f1d('0x7'));var ejs=require(_0x7f1d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f1d('0x9'));var squel=require(_0x7f1d('0xa'));var crypto=require(_0x7f1d('0xb'));var jsforce=require(_0x7f1d('0xc'));var deskjs=require(_0x7f1d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7f1d('0xe'));var Papa=require(_0x7f1d('0xf'));var Redis=require(_0x7f1d('0x10'));var authService=require(_0x7f1d('0x11'));var qs=require(_0x7f1d('0x12'));var as=require(_0x7f1d('0x13'));var hardwareService=require(_0x7f1d('0x14'));var logger=require(_0x7f1d('0x15'))(_0x7f1d('0x16'));var utils=require(_0x7f1d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7f1d('0x18'))['db'];function respondWithStatusCode(_0x233c7e,_0x32f617){_0x32f617=_0x32f617||0xcc;return function(_0x42da4f){if(_0x42da4f){return _0x233c7e[_0x7f1d('0x19')](_0x32f617);}return _0x233c7e['status'](_0x32f617)[_0x7f1d('0x1a')]();};}function respondWithResult(_0x401c81,_0x4e4602){_0x4e4602=_0x4e4602||0xc8;return function(_0x4e27c3){if(_0x4e27c3){return _0x401c81[_0x7f1d('0x1b')](_0x4e4602)['json'](_0x4e27c3);}};}function respondWithFilteredResult(_0x268214,_0x3cdf3b){return function(_0x233b9e){if(_0x233b9e){var _0x2a9536=_0x233b9e['count'],_0x329e87=_0x3cdf3b[_0x7f1d('0x1c')],_0x54fe2e=_0x3cdf3b[_0x7f1d('0x1c')]+_0x3cdf3b['limit'],_0x48da16;if(_0x54fe2e>=_0x2a9536){_0x54fe2e=_0x2a9536;_0x48da16=0xc8;}else{_0x48da16=0xce;}_0x268214[_0x7f1d('0x1b')](_0x48da16);return _0x268214['set']('Content-Range',_0x329e87+'-'+_0x54fe2e+'/'+_0x2a9536)['json'](_0x233b9e);}return null;};}function patchUpdates(_0x561023){return function(_0x7a4cf9){try{jsonpatch['apply'](_0x7a4cf9,_0x561023,!![]);}catch(_0x111a43){return BPromise[_0x7f1d('0x1d')](_0x111a43);}return _0x7a4cf9[_0x7f1d('0x1e')]();};}function saveUpdates(_0xb04ddc,_0x139517){return function(_0x1aef2f){if(_0x1aef2f){return _0x1aef2f[_0x7f1d('0x1f')](_0xb04ddc)['then'](function(_0x3ef891){return _0x3ef891;});}return null;};}function removeEntity(_0xa91517,_0x55e006){return function(_0x4c98e6){if(_0x4c98e6){return _0x4c98e6['destroy']()[_0x7f1d('0x20')](function(){var _0x4b1134=_0x4c98e6[_0x7f1d('0x21')]({'plain':!![]});var _0x48d181=_0x7f1d('0x22');return db[_0x7f1d('0x23')][_0x7f1d('0x24')]({'where':{'type':_0x48d181,'resourceId':_0x4b1134['id']}})[_0x7f1d('0x20')](function(){return _0x4c98e6;});})[_0x7f1d('0x20')](function(){_0xa91517[_0x7f1d('0x1b')](0xcc)[_0x7f1d('0x1a')]();});}};}function handleEntityNotFound(_0x330379,_0x2b853d){return function(_0x389b74){if(!_0x389b74){_0x330379[_0x7f1d('0x19')](0x194);}return _0x389b74;};}function handleError(_0x5259a1,_0x35cb0c){_0x35cb0c=_0x35cb0c||0x1f4;return function(_0xfecdf3){logger[_0x7f1d('0x25')](_0xfecdf3[_0x7f1d('0x26')]);if(_0xfecdf3[_0x7f1d('0x27')]){delete _0xfecdf3[_0x7f1d('0x27')];}_0x5259a1[_0x7f1d('0x1b')](_0x35cb0c)[_0x7f1d('0x28')](_0xfecdf3);};}exports['index']=function(_0x42449d,_0x130178){var _0x1c9607={},_0x3a34cd={},_0x2f480c={'count':0x0,'rows':[]};var _0xb8be2e=_['map'](db[_0x7f1d('0x29')][_0x7f1d('0x2a')],function(_0x14b269){return{'name':_0x14b269[_0x7f1d('0x2b')],'type':_0x14b269['type']['key']};});_0x3a34cd['model']=_[_0x7f1d('0x2c')](_0xb8be2e,_0x7f1d('0x27'));_0x3a34cd[_0x7f1d('0x2d')]=_[_0x7f1d('0x2e')](_0x42449d[_0x7f1d('0x2d')]);_0x3a34cd[_0x7f1d('0x2f')]=_['intersection'](_0x3a34cd[_0x7f1d('0x30')],_0x3a34cd[_0x7f1d('0x2d')]);_0x1c9607[_0x7f1d('0x31')]=_[_0x7f1d('0x32')](_0x3a34cd[_0x7f1d('0x30')],qs[_0x7f1d('0x33')](_0x42449d['query'][_0x7f1d('0x33')]));_0x1c9607[_0x7f1d('0x31')]=_0x1c9607[_0x7f1d('0x31')]['length']?_0x1c9607[_0x7f1d('0x31')]:_0x3a34cd[_0x7f1d('0x30')];if(!_0x42449d['query']['hasOwnProperty'](_0x7f1d('0x34'))){_0x1c9607['limit']=qs['limit'](_0x42449d[_0x7f1d('0x2d')][_0x7f1d('0x35')]);_0x1c9607[_0x7f1d('0x1c')]=qs[_0x7f1d('0x1c')](_0x42449d['query']['offset']);}_0x1c9607[_0x7f1d('0x36')]=qs[_0x7f1d('0x37')](_0x42449d[_0x7f1d('0x2d')][_0x7f1d('0x37')]);_0x1c9607[_0x7f1d('0x38')]=qs[_0x7f1d('0x2f')](_[_0x7f1d('0x39')](_0x42449d[_0x7f1d('0x2d')],_0x3a34cd[_0x7f1d('0x2f')]),_0xb8be2e);if(_0x42449d[_0x7f1d('0x2d')][_0x7f1d('0x3a')]){_0x1c9607[_0x7f1d('0x38')]=_[_0x7f1d('0x3b')](_0x1c9607[_0x7f1d('0x38')],{'$or':_['map'](_0xb8be2e,function(_0xb4835e){if(_0xb4835e[_0x7f1d('0x3c')]!==_0x7f1d('0x3d')){var _0x1345de={};_0x1345de[_0xb4835e[_0x7f1d('0x27')]]={'$like':'%'+_0x42449d[_0x7f1d('0x2d')][_0x7f1d('0x3a')]+'%'};return _0x1345de;}})});}_0x1c9607=_[_0x7f1d('0x3b')]({},_0x1c9607,_0x42449d[_0x7f1d('0x3e')]);var _0x22a0ea={'where':_0x1c9607[_0x7f1d('0x38')]};return db['Sound']['count'](_0x22a0ea)[_0x7f1d('0x20')](function(_0x337f20){_0x2f480c[_0x7f1d('0x3f')]=_0x337f20;if(_0x42449d[_0x7f1d('0x2d')][_0x7f1d('0x40')]){_0x1c9607['include']=[{'all':!![]}];}return db[_0x7f1d('0x29')][_0x7f1d('0x41')](_0x1c9607);})[_0x7f1d('0x20')](function(_0x3e6945){_0x2f480c[_0x7f1d('0x42')]=_0x3e6945;return _0x2f480c;})['then'](respondWithFilteredResult(_0x130178,_0x1c9607))[_0x7f1d('0x43')](handleError(_0x130178,null));};exports[_0x7f1d('0x44')]=function(_0x101ab8,_0x4bd51f){var _0x37e28b={'raw':!![],'where':{'id':_0x101ab8[_0x7f1d('0x45')]['id']}},_0x1944b0={};_0x1944b0[_0x7f1d('0x30')]=_[_0x7f1d('0x2e')](db[_0x7f1d('0x29')]['rawAttributes']);_0x1944b0['query']=_[_0x7f1d('0x2e')](_0x101ab8[_0x7f1d('0x2d')]);_0x1944b0[_0x7f1d('0x2f')]=_['intersection'](_0x1944b0[_0x7f1d('0x30')],_0x1944b0['query']);_0x37e28b['attributes']=_['intersection'](_0x1944b0[_0x7f1d('0x30')],qs[_0x7f1d('0x33')](_0x101ab8['query']['fields']));_0x37e28b[_0x7f1d('0x31')]=_0x37e28b[_0x7f1d('0x31')]['length']?_0x37e28b[_0x7f1d('0x31')]:_0x1944b0[_0x7f1d('0x30')];if(_0x101ab8[_0x7f1d('0x2d')][_0x7f1d('0x40')]){_0x37e28b[_0x7f1d('0x46')]=[{'all':!![]}];}_0x37e28b=_['merge']({},_0x37e28b,_0x101ab8[_0x7f1d('0x3e')]);return db[_0x7f1d('0x29')]['find'](_0x37e28b)[_0x7f1d('0x20')](handleEntityNotFound(_0x4bd51f,null))[_0x7f1d('0x20')](respondWithResult(_0x4bd51f,null))[_0x7f1d('0x43')](handleError(_0x4bd51f,null));};exports[_0x7f1d('0x47')]=function(_0x259d75,_0x4ad878,_0x14ea2c){return db[_0x7f1d('0x29')]['find']({'where':{'id':_0x259d75[_0x7f1d('0x45')]['id']},'attributes':[_0x7f1d('0x27'),'save_name',_0x7f1d('0x48')],'raw':!![]})[_0x7f1d('0x20')](handleEntityNotFound(_0x4ad878,null))['then'](function(_0x493c0b){if(_0x493c0b){if(!fs[_0x7f1d('0x49')](path[_0x7f1d('0x4a')](config['root'],_0x7f1d('0x4b'),_0x493c0b[_0x7f1d('0x4c')]+'.'+_0x493c0b[_0x7f1d('0x48')]))){throw new db[(_0x7f1d('0x4d'))]['ValidationError']('Sound\x20not\x20found');}return _0x4ad878[_0x7f1d('0x47')](path['join'](config[_0x7f1d('0x4e')],'server/files/sounds/converted',util[_0x7f1d('0x4f')](_0x7f1d('0x50'),_0x493c0b[_0x7f1d('0x4c')],_0x493c0b['converted_format'])),util['format'](_0x7f1d('0x50'),_0x493c0b['name'],_0x493c0b['converted_format']));}return null;})[_0x7f1d('0x43')](handleError(_0x4ad878,null));};exports[_0x7f1d('0x51')]=function(_0x1e4ba8,_0x598b10,_0x132ae3){var _0x235cf3={'name':path[_0x7f1d('0x52')](_0x1e4ba8[_0x7f1d('0x53')][_0x7f1d('0x54')],path[_0x7f1d('0x55')](_0x1e4ba8[_0x7f1d('0x53')][_0x7f1d('0x54')])),'save_name':path[_0x7f1d('0x52')](_0x1e4ba8['file'][_0x7f1d('0x56')],path['extname'](_0x1e4ba8[_0x7f1d('0x53')]['filename'])),'original_format':path[_0x7f1d('0x55')](_0x1e4ba8[_0x7f1d('0x53')][_0x7f1d('0x54')])[_0x7f1d('0x57')](0x1),'converted_format':_0x7f1d('0x58')};var _0x1e4437=path[_0x7f1d('0x4a')](config[_0x7f1d('0x4e')],_0x7f1d('0x59'),_0x1e4ba8[_0x7f1d('0x53')][_0x7f1d('0x56')]);var _0x48b3c9=path[_0x7f1d('0x4a')](config[_0x7f1d('0x4e')],_0x7f1d('0x4b'),util[_0x7f1d('0x4f')]('%s.%s',path[_0x7f1d('0x52')](_0x1e4ba8[_0x7f1d('0x53')][_0x7f1d('0x56')],path[_0x7f1d('0x55')](_0x1e4ba8[_0x7f1d('0x53')][_0x7f1d('0x56')])),_0x235cf3['converted_format']));logger[_0x7f1d('0x5a')](_0x7f1d('0x5b'),_0x1e4437);logger['info'](_0x7f1d('0x5c'),_0x48b3c9);try{fs[_0x7f1d('0x5d')](_0x1e4437,parseInt(_0x7f1d('0x5e'),0x8));var _0x58ca15=sox['transcode'](_0x1e4437,_0x48b3c9,{'sampleRate':0x1f40,'format':_0x7f1d('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x58ca15['on']('error',function(_0x2a9c9d){fs['unlinkSync'](_0x1e4437);_0x598b10[_0x7f1d('0x1b')](0x1f4)['send'](_0x2a9c9d);});_0x58ca15['on']('src',function(_0x1fb3ca){_0x235cf3['original_duration']=isNaN(_0x1fb3ca[_0x7f1d('0x5f')])?null:_0x1fb3ca[_0x7f1d('0x5f')]*0x3e8;_0x235cf3[_0x7f1d('0x60')]=isNaN(_0x1fb3ca['sampleCount'])?null:_0x1fb3ca['sampleCount'];_0x235cf3['original_channelCount']=isNaN(_0x1fb3ca['channelCount'])?null:_0x1fb3ca[_0x7f1d('0x61')];_0x235cf3[_0x7f1d('0x62')]=isNaN(_0x1fb3ca[_0x7f1d('0x63')])?null:_0x1fb3ca['bitRate'];_0x235cf3[_0x7f1d('0x64')]=isNaN(_0x1fb3ca[_0x7f1d('0x65')])?null:_0x1fb3ca[_0x7f1d('0x65')];});_0x58ca15['on'](_0x7f1d('0x66'),function(_0x2eaa0a){_0x235cf3[_0x7f1d('0x67')]=isNaN(_0x2eaa0a['duration'])?null:_0x2eaa0a[_0x7f1d('0x5f')]*0x3e8;_0x235cf3['converted_sampleCount']=isNaN(_0x2eaa0a[_0x7f1d('0x68')])?null:_0x2eaa0a[_0x7f1d('0x68')];_0x235cf3[_0x7f1d('0x69')]=isNaN(_0x2eaa0a[_0x7f1d('0x61')])?null:_0x2eaa0a[_0x7f1d('0x61')];_0x235cf3[_0x7f1d('0x6a')]=isNaN(_0x2eaa0a['bitRate'])?null:_0x2eaa0a[_0x7f1d('0x63')];_0x235cf3[_0x7f1d('0x6b')]=isNaN(_0x2eaa0a['sampleRate'])?null:_0x2eaa0a['sampleRate'];});_0x58ca15['on']('end',function(){fs[_0x7f1d('0x5d')](_0x48b3c9,parseInt(_0x7f1d('0x5e'),0x8));return db[_0x7f1d('0x29')]['create'](_0x235cf3)['then'](function(_0x24a3e6){var _0x5a4b79={'role':_0x1e4ba8['body'][_0x7f1d('0x6c')],'userProfileId':_0x1e4ba8[_0x7f1d('0x6d')][_0x7f1d('0x6e')]};if(!_0x5a4b79)throw new Error(_0x7f1d('0x6f'));if(_0x5a4b79[_0x7f1d('0x6c')]===_0x7f1d('0x70')){var _0x33da54=_0x24a3e6[_0x7f1d('0x21')]({'plain':!![]});return db[_0x7f1d('0x71')][_0x7f1d('0x72')]({'where':{'name':_0x7f1d('0x22'),'userProfileId':_0x5a4b79[_0x7f1d('0x6e')]},'raw':!![]})[_0x7f1d('0x20')](function(_0x47c60d){if(_0x47c60d&&_0x47c60d[_0x7f1d('0x73')]===0x0){return db[_0x7f1d('0x23')][_0x7f1d('0x51')]({'name':_0x33da54['name'],'resourceId':_0x33da54['id'],'type':_0x47c60d[_0x7f1d('0x27')],'sectionId':_0x47c60d['id']},{})[_0x7f1d('0x20')](function(){return _0x24a3e6;});}else{return _0x24a3e6;}})[_0x7f1d('0x43')](function(_0xa17b36){logger[_0x7f1d('0x25')](_0x7f1d('0x74'),_0xa17b36);throw _0xa17b36;});}return _0x24a3e6;})[_0x7f1d('0x20')](respondWithResult(_0x598b10,null))[_0x7f1d('0x43')](handleError(_0x598b10,null));});_0x58ca15[_0x7f1d('0x75')]();}catch(_0x6334ca){_0x598b10['status'](0x1f4)[_0x7f1d('0x28')](_0x6334ca);}};exports[_0x7f1d('0x1f')]=function(_0x396bd1,_0x5398db,_0x115d0b){return db[_0x7f1d('0x29')][_0x7f1d('0x72')]({'where':{'id':_0x396bd1[_0x7f1d('0x45')]['id']}})[_0x7f1d('0x20')](handleEntityNotFound(_0x5398db,null))[_0x7f1d('0x20')](saveUpdates(_['pick'](_0x396bd1[_0x7f1d('0x6d')],['name',_0x7f1d('0x76')]),null))[_0x7f1d('0x20')](respondWithResult(_0x5398db,null))[_0x7f1d('0x43')](handleError(_0x5398db,null));};exports[_0x7f1d('0x77')]=function(_0x10fb41,_0x3374de,_0x5cb2ce){return db[_0x7f1d('0x29')]['find']({'where':{'id':_0x10fb41[_0x7f1d('0x45')]['id']}})['then'](function(_0x3cd9a0){if(_0x3cd9a0){return _0x3cd9a0[_0x7f1d('0x24')]();}})[_0x7f1d('0x20')](function(_0x55318c){var _0x1af8c4=path[_0x7f1d('0x4a')](config[_0x7f1d('0x4e')],_0x7f1d('0x59'),util[_0x7f1d('0x4f')](_0x7f1d('0x50'),_0x55318c['save_name'],_0x55318c[_0x7f1d('0x78')]));var _0x4ea57b=path['join'](config['root'],_0x7f1d('0x4b'),util[_0x7f1d('0x4f')](_0x7f1d('0x50'),_0x55318c[_0x7f1d('0x4c')],_0x55318c[_0x7f1d('0x48')]));fs[_0x7f1d('0x79')](_0x1af8c4);fs[_0x7f1d('0x79')](_0x4ea57b);return _0x55318c;})[_0x7f1d('0x20')](function(_0x24d107){if(_0x24d107){return _0x3374de[_0x7f1d('0x1b')](0xcc)[_0x7f1d('0x1a')]();}})['then'](handleEntityNotFound(_0x3374de,null))['catch'](handleError(_0x3374de,null));}; \ No newline at end of file +var _0xe040=['UserProfileResource','error','stack','name','send','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','params','include','download','find','existsSync','join','server/files/sounds/converted','save_name','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','file','originalname','extname','basename','filename','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_sampleCount','converted_bitRate','converted_sampleRate','chmodSync','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','start','description','delete','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','crypto','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','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','Sounds'];(function(_0x83e4d9,_0x3b9bb6){var _0x36a145=function(_0x2904e9){while(--_0x2904e9){_0x83e4d9['push'](_0x83e4d9['shift']());}};_0x36a145(++_0x3b9bb6);}(_0xe040,0xcc));var _0x0e04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe040[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x0e04('0x0'));var emlformat=require(_0x0e04('0x1'));var rimraf=require(_0x0e04('0x2'));var zipdir=require(_0x0e04('0x3'));var jsonpatch=require(_0x0e04('0x4'));var rp=require('request-promise');var moment=require(_0x0e04('0x5'));var BPromise=require(_0x0e04('0x6'));var Mustache=require(_0x0e04('0x7'));var util=require(_0x0e04('0x8'));var path=require(_0x0e04('0x9'));var sox=require(_0x0e04('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e04('0xb'));var squel=require('squel');var crypto=require(_0x0e04('0xc'));var jsforce=require(_0x0e04('0xd'));var deskjs=require(_0x0e04('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0e04('0xf'));var Papa=require('papaparse');var Redis=require(_0x0e04('0x10'));var authService=require(_0x0e04('0x11'));var qs=require(_0x0e04('0x12'));var as=require(_0x0e04('0x13'));var hardwareService=require(_0x0e04('0x14'));var logger=require(_0x0e04('0x15'))('api');var utils=require(_0x0e04('0x16'));var config=require(_0x0e04('0x17'));var licenseUtil=require(_0x0e04('0x18'));var db=require(_0x0e04('0x19'))['db'];function respondWithStatusCode(_0x4de74d,_0x37314e){_0x37314e=_0x37314e||0xcc;return function(_0x52c1da){if(_0x52c1da){return _0x4de74d[_0x0e04('0x1a')](_0x37314e);}return _0x4de74d[_0x0e04('0x1b')](_0x37314e)[_0x0e04('0x1c')]();};}function respondWithResult(_0x1509a3,_0x2ee934){_0x2ee934=_0x2ee934||0xc8;return function(_0x1b651e){if(_0x1b651e){return _0x1509a3['status'](_0x2ee934)['json'](_0x1b651e);}};}function respondWithFilteredResult(_0x304c88,_0x5e7601){return function(_0x3f726b){if(_0x3f726b){var _0x46e0bb=_0x3f726b[_0x0e04('0x1d')],_0x4f4ffc=_0x5e7601['offset'],_0x3dd5d5=_0x5e7601[_0x0e04('0x1e')]+_0x5e7601[_0x0e04('0x1f')],_0x3f38f8;if(_0x3dd5d5>=_0x46e0bb){_0x3dd5d5=_0x46e0bb;_0x3f38f8=0xc8;}else{_0x3f38f8=0xce;}_0x304c88[_0x0e04('0x1b')](_0x3f38f8);return _0x304c88[_0x0e04('0x20')](_0x0e04('0x21'),_0x4f4ffc+'-'+_0x3dd5d5+'/'+_0x46e0bb)[_0x0e04('0x22')](_0x3f726b);}return null;};}function patchUpdates(_0x592457){return function(_0x5e29d8){try{jsonpatch['apply'](_0x5e29d8,_0x592457,!![]);}catch(_0x4bc8e5){return BPromise[_0x0e04('0x23')](_0x4bc8e5);}return _0x5e29d8['save']();};}function saveUpdates(_0x10c5ad,_0x5dee3b){return function(_0x307379){if(_0x307379){return _0x307379[_0x0e04('0x24')](_0x10c5ad)[_0x0e04('0x25')](function(_0x557f04){return _0x557f04;});}return null;};}function removeEntity(_0x23c81e,_0x15aa74){return function(_0x282603){if(_0x282603){return _0x282603[_0x0e04('0x26')]()[_0x0e04('0x25')](function(){var _0x4620f8=_0x282603['get']({'plain':!![]});var _0x529a1f=_0x0e04('0x27');return db[_0x0e04('0x28')][_0x0e04('0x26')]({'where':{'type':_0x529a1f,'resourceId':_0x4620f8['id']}})['then'](function(){return _0x282603;});})[_0x0e04('0x25')](function(){_0x23c81e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50f1f9,_0x2f79b3){return function(_0x38dba5){if(!_0x38dba5){_0x50f1f9[_0x0e04('0x1a')](0x194);}return _0x38dba5;};}function handleError(_0x1bd8d7,_0x1e2d26){_0x1e2d26=_0x1e2d26||0x1f4;return function(_0x2fbdd1){logger[_0x0e04('0x29')](_0x2fbdd1[_0x0e04('0x2a')]);if(_0x2fbdd1[_0x0e04('0x2b')]){delete _0x2fbdd1[_0x0e04('0x2b')];}_0x1bd8d7['status'](_0x1e2d26)[_0x0e04('0x2c')](_0x2fbdd1);};}exports['index']=function(_0x359e9d,_0x4ac2cd){var _0x11184e={},_0x4d5205={},_0x1bd0df={'count':0x0,'rows':[]};var _0x2d8241=_[_0x0e04('0x2d')](db[_0x0e04('0x2e')][_0x0e04('0x2f')],function(_0x43bb62){return{'name':_0x43bb62[_0x0e04('0x30')],'type':_0x43bb62[_0x0e04('0x31')][_0x0e04('0x32')]};});_0x4d5205[_0x0e04('0x33')]=_[_0x0e04('0x2d')](_0x2d8241,_0x0e04('0x2b'));_0x4d5205[_0x0e04('0x34')]=_[_0x0e04('0x35')](_0x359e9d[_0x0e04('0x34')]);_0x4d5205[_0x0e04('0x36')]=_[_0x0e04('0x37')](_0x4d5205['model'],_0x4d5205[_0x0e04('0x34')]);_0x11184e[_0x0e04('0x38')]=_[_0x0e04('0x37')](_0x4d5205[_0x0e04('0x33')],qs[_0x0e04('0x39')](_0x359e9d[_0x0e04('0x34')]['fields']));_0x11184e[_0x0e04('0x38')]=_0x11184e['attributes'][_0x0e04('0x3a')]?_0x11184e[_0x0e04('0x38')]:_0x4d5205['model'];if(!_0x359e9d[_0x0e04('0x34')]['hasOwnProperty']('nolimit')){_0x11184e[_0x0e04('0x1f')]=qs[_0x0e04('0x1f')](_0x359e9d[_0x0e04('0x34')][_0x0e04('0x1f')]);_0x11184e[_0x0e04('0x1e')]=qs[_0x0e04('0x1e')](_0x359e9d[_0x0e04('0x34')][_0x0e04('0x1e')]);}_0x11184e[_0x0e04('0x3b')]=qs[_0x0e04('0x3c')](_0x359e9d['query']['sort']);_0x11184e[_0x0e04('0x3d')]=qs[_0x0e04('0x36')](_[_0x0e04('0x3e')](_0x359e9d[_0x0e04('0x34')],_0x4d5205[_0x0e04('0x36')]),_0x2d8241);if(_0x359e9d[_0x0e04('0x34')]['filter']){_0x11184e[_0x0e04('0x3d')]=_[_0x0e04('0x3f')](_0x11184e['where'],{'$or':_[_0x0e04('0x2d')](_0x2d8241,function(_0x56c285){if(_0x56c285[_0x0e04('0x31')]!==_0x0e04('0x40')){var _0x285d0a={};_0x285d0a[_0x56c285[_0x0e04('0x2b')]]={'$like':'%'+_0x359e9d[_0x0e04('0x34')][_0x0e04('0x41')]+'%'};return _0x285d0a;}})});}_0x11184e=_[_0x0e04('0x3f')]({},_0x11184e,_0x359e9d[_0x0e04('0x42')]);var _0x337654={'where':_0x11184e['where']};return db['Sound'][_0x0e04('0x1d')](_0x337654)[_0x0e04('0x25')](function(_0x2c37d3){_0x1bd0df[_0x0e04('0x1d')]=_0x2c37d3;if(_0x359e9d[_0x0e04('0x34')][_0x0e04('0x43')]){_0x11184e['include']=[{'all':!![]}];}return db['Sound'][_0x0e04('0x44')](_0x11184e);})[_0x0e04('0x25')](function(_0x5de594){_0x1bd0df['rows']=_0x5de594;return _0x1bd0df;})[_0x0e04('0x25')](respondWithFilteredResult(_0x4ac2cd,_0x11184e))[_0x0e04('0x45')](handleError(_0x4ac2cd,null));};exports['show']=function(_0x1b0113,_0x568309){var _0x264cd2={'raw':!![],'where':{'id':_0x1b0113[_0x0e04('0x46')]['id']}},_0x1eb74e={};_0x1eb74e['model']=_[_0x0e04('0x35')](db['Sound']['rawAttributes']);_0x1eb74e[_0x0e04('0x34')]=_[_0x0e04('0x35')](_0x1b0113[_0x0e04('0x34')]);_0x1eb74e[_0x0e04('0x36')]=_['intersection'](_0x1eb74e['model'],_0x1eb74e[_0x0e04('0x34')]);_0x264cd2[_0x0e04('0x38')]=_[_0x0e04('0x37')](_0x1eb74e[_0x0e04('0x33')],qs[_0x0e04('0x39')](_0x1b0113[_0x0e04('0x34')][_0x0e04('0x39')]));_0x264cd2[_0x0e04('0x38')]=_0x264cd2[_0x0e04('0x38')][_0x0e04('0x3a')]?_0x264cd2[_0x0e04('0x38')]:_0x1eb74e['model'];if(_0x1b0113[_0x0e04('0x34')]['includeAll']){_0x264cd2[_0x0e04('0x47')]=[{'all':!![]}];}_0x264cd2=_[_0x0e04('0x3f')]({},_0x264cd2,_0x1b0113[_0x0e04('0x42')]);return db[_0x0e04('0x2e')]['find'](_0x264cd2)['then'](handleEntityNotFound(_0x568309,null))['then'](respondWithResult(_0x568309,null))[_0x0e04('0x45')](handleError(_0x568309,null));};exports[_0x0e04('0x48')]=function(_0x16ecde,_0x8a74ad,_0xcd66c9){return db[_0x0e04('0x2e')][_0x0e04('0x49')]({'where':{'id':_0x16ecde['params']['id']},'attributes':[_0x0e04('0x2b'),'save_name','converted_format'],'raw':!![]})[_0x0e04('0x25')](handleEntityNotFound(_0x8a74ad,null))[_0x0e04('0x25')](function(_0x3a41f7){if(_0x3a41f7){if(!fs[_0x0e04('0x4a')](path[_0x0e04('0x4b')](config['root'],_0x0e04('0x4c'),_0x3a41f7[_0x0e04('0x4d')]+'.'+_0x3a41f7[_0x0e04('0x4e')]))){throw new db[(_0x0e04('0x4f'))][(_0x0e04('0x50'))](_0x0e04('0x51'));}return _0x8a74ad['download'](path[_0x0e04('0x4b')](config[_0x0e04('0x52')],_0x0e04('0x4c'),util[_0x0e04('0x53')](_0x0e04('0x54'),_0x3a41f7[_0x0e04('0x4d')],_0x3a41f7[_0x0e04('0x4e')])),util[_0x0e04('0x53')](_0x0e04('0x54'),_0x3a41f7[_0x0e04('0x2b')],_0x3a41f7[_0x0e04('0x4e')]));}return null;})[_0x0e04('0x45')](handleError(_0x8a74ad,null));};exports[_0x0e04('0x55')]=function(_0x312fec,_0x24be8d,_0x3116c3){var _0xbc90e1={'name':path['basename'](_0x312fec[_0x0e04('0x56')][_0x0e04('0x57')],path[_0x0e04('0x58')](_0x312fec[_0x0e04('0x56')][_0x0e04('0x57')])),'save_name':path[_0x0e04('0x59')](_0x312fec['file'][_0x0e04('0x5a')],path['extname'](_0x312fec[_0x0e04('0x56')]['filename'])),'original_format':path[_0x0e04('0x58')](_0x312fec[_0x0e04('0x56')][_0x0e04('0x57')])['substring'](0x1),'converted_format':_0x0e04('0x5b')};var _0x56679a=path[_0x0e04('0x4b')](config[_0x0e04('0x52')],_0x0e04('0x5c'),_0x312fec[_0x0e04('0x56')]['filename']);var _0x425b50=path[_0x0e04('0x4b')](config[_0x0e04('0x52')],_0x0e04('0x4c'),util[_0x0e04('0x53')]('%s.%s',path['basename'](_0x312fec[_0x0e04('0x56')][_0x0e04('0x5a')],path['extname'](_0x312fec['file'][_0x0e04('0x5a')])),_0xbc90e1[_0x0e04('0x4e')]));logger['info'](_0x0e04('0x5d'),_0x56679a);logger[_0x0e04('0x5e')](_0x0e04('0x5f'),_0x425b50);try{fs['chmodSync'](_0x56679a,parseInt(_0x0e04('0x60'),0x8));var _0x136c6e=sox[_0x0e04('0x61')](_0x56679a,_0x425b50,{'sampleRate':0x1f40,'format':_0x0e04('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x136c6e['on'](_0x0e04('0x29'),function(_0x2211ab){fs[_0x0e04('0x62')](_0x56679a);_0x24be8d[_0x0e04('0x1b')](0x1f4)['send'](_0x2211ab);});_0x136c6e['on'](_0x0e04('0x63'),function(_0x4efeaa){_0xbc90e1[_0x0e04('0x64')]=isNaN(_0x4efeaa[_0x0e04('0x65')])?null:_0x4efeaa[_0x0e04('0x65')]*0x3e8;_0xbc90e1[_0x0e04('0x66')]=isNaN(_0x4efeaa['sampleCount'])?null:_0x4efeaa[_0x0e04('0x67')];_0xbc90e1[_0x0e04('0x68')]=isNaN(_0x4efeaa[_0x0e04('0x69')])?null:_0x4efeaa[_0x0e04('0x69')];_0xbc90e1['original_bitRate']=isNaN(_0x4efeaa[_0x0e04('0x6a')])?null:_0x4efeaa[_0x0e04('0x6a')];_0xbc90e1['original_sampleRate']=isNaN(_0x4efeaa[_0x0e04('0x6b')])?null:_0x4efeaa[_0x0e04('0x6b')];});_0x136c6e['on'](_0x0e04('0x6c'),function(_0x11aad9){_0xbc90e1['converted_duration']=isNaN(_0x11aad9[_0x0e04('0x65')])?null:_0x11aad9[_0x0e04('0x65')]*0x3e8;_0xbc90e1[_0x0e04('0x6d')]=isNaN(_0x11aad9[_0x0e04('0x67')])?null:_0x11aad9['sampleCount'];_0xbc90e1['converted_channelCount']=isNaN(_0x11aad9['channelCount'])?null:_0x11aad9[_0x0e04('0x69')];_0xbc90e1[_0x0e04('0x6e')]=isNaN(_0x11aad9[_0x0e04('0x6a')])?null:_0x11aad9[_0x0e04('0x6a')];_0xbc90e1[_0x0e04('0x6f')]=isNaN(_0x11aad9['sampleRate'])?null:_0x11aad9[_0x0e04('0x6b')];});_0x136c6e['on'](_0x0e04('0x1c'),function(){fs[_0x0e04('0x70')](_0x425b50,parseInt(_0x0e04('0x60'),0x8));return db[_0x0e04('0x2e')][_0x0e04('0x55')](_0xbc90e1)[_0x0e04('0x25')](function(_0x2995ab){var _0x19ba8c={'role':_0x312fec['body'][_0x0e04('0x71')],'userProfileId':_0x312fec[_0x0e04('0x72')]['userProfileId']};if(!_0x19ba8c)throw new Error(_0x0e04('0x73'));if(_0x19ba8c[_0x0e04('0x71')]===_0x0e04('0x74')){var _0x127763=_0x2995ab[_0x0e04('0x75')]({'plain':!![]});return db[_0x0e04('0x76')][_0x0e04('0x49')]({'where':{'name':_0x0e04('0x27'),'userProfileId':_0x19ba8c['userProfileId']},'raw':!![]})['then'](function(_0x35c3de){if(_0x35c3de&&_0x35c3de['autoAssociation']===0x0){return db[_0x0e04('0x28')]['create']({'name':_0x127763['name'],'resourceId':_0x127763['id'],'type':_0x35c3de[_0x0e04('0x2b')],'sectionId':_0x35c3de['id']},{})[_0x0e04('0x25')](function(){return _0x2995ab;});}else{return _0x2995ab;}})[_0x0e04('0x45')](function(_0x12017c){logger[_0x0e04('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12017c);throw _0x12017c;});}return _0x2995ab;})[_0x0e04('0x25')](respondWithResult(_0x24be8d,null))[_0x0e04('0x45')](handleError(_0x24be8d,null));});_0x136c6e[_0x0e04('0x77')]();}catch(_0x496044){_0x24be8d['status'](0x1f4)[_0x0e04('0x2c')](_0x496044);}};exports[_0x0e04('0x24')]=function(_0x27ec82,_0x293e4e,_0x3d56ba){return db[_0x0e04('0x2e')][_0x0e04('0x49')]({'where':{'id':_0x27ec82[_0x0e04('0x46')]['id']}})[_0x0e04('0x25')](handleEntityNotFound(_0x293e4e,null))[_0x0e04('0x25')](saveUpdates(_[_0x0e04('0x3e')](_0x27ec82[_0x0e04('0x72')],[_0x0e04('0x2b'),_0x0e04('0x78')]),null))[_0x0e04('0x25')](respondWithResult(_0x293e4e,null))[_0x0e04('0x45')](handleError(_0x293e4e,null));};exports[_0x0e04('0x79')]=function(_0x392baa,_0xdaa983,_0x5a4c81){return db['Sound']['find']({'where':{'id':_0x392baa[_0x0e04('0x46')]['id']}})['then'](function(_0x233b01){if(_0x233b01){return _0x233b01[_0x0e04('0x26')]();}})['then'](function(_0x2f0ee8){var _0x57caa9=path['join'](config[_0x0e04('0x52')],_0x0e04('0x5c'),util[_0x0e04('0x53')]('%s.%s',_0x2f0ee8['save_name'],_0x2f0ee8['original_format']));var _0x34ece1=path[_0x0e04('0x4b')](config[_0x0e04('0x52')],'server/files/sounds/converted',util[_0x0e04('0x53')]('%s.%s',_0x2f0ee8['save_name'],_0x2f0ee8[_0x0e04('0x4e')]));fs[_0x0e04('0x62')](_0x57caa9);fs[_0x0e04('0x62')](_0x34ece1);return _0x2f0ee8;})[_0x0e04('0x25')](function(_0x4e538b){if(_0x4e538b){return _0xdaa983[_0x0e04('0x1b')](0xcc)[_0x0e04('0x1c')]();}})[_0x0e04('0x25')](handleEntityNotFound(_0xdaa983,null))[_0x0e04('0x45')](handleError(_0xdaa983,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 93a7f05..5925d4f 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 _0x4f17=['request-promise','rimraf','../../config/environment','exports','define','Sound','tools_sounds','util','../../config/logger','moment'];(function(_0x581feb,_0xd74dcc){var _0x734423=function(_0xe2facc){while(--_0xe2facc){_0x581feb['push'](_0x581feb['shift']());}};_0x734423(++_0xd74dcc);}(_0x4f17,0x75));var _0x74f1=function(_0x3df822,_0x299495){_0x3df822=_0x3df822-0x0;var _0x4e457d=_0x4f17[_0x3df822];return _0x4e457d;};'use strict';var _=require('lodash');var util=require(_0x74f1('0x0'));var logger=require(_0x74f1('0x1'))('api');var moment=require(_0x74f1('0x2'));var BPromise=require('bluebird');var rp=require(_0x74f1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x74f1('0x4'));var config=require(_0x74f1('0x5'));var attributes=require('./sound.attributes');module[_0x74f1('0x6')]=function(_0x178ca2,_0x1a226a){return _0x178ca2[_0x74f1('0x7')](_0x74f1('0x8'),attributes,{'tableName':_0x74f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4e1=['define','Sound','tools_sounds','lodash','util','moment','bluebird','request-promise','../../config/environment'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xe4e1,0x8a));var _0x1e4e=function(_0x105ee5,_0x3549b8){_0x105ee5=_0x105ee5-0x0;var _0x2b0873=_0xe4e1[_0x105ee5];return _0x2b0873;};'use strict';var _=require(_0x1e4e('0x0'));var util=require(_0x1e4e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1e4e('0x2'));var BPromise=require(_0x1e4e('0x3'));var rp=require(_0x1e4e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1e4e('0x5'));var attributes=require('./sound.attributes');module['exports']=function(_0x44f9ce,_0x2bbc46){return _0x44f9ce[_0x1e4e('0x6')](_0x1e4e('0x7'),attributes,{'tableName':_0x1e4e('0x8'),'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 a081923..a7b35af 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 _0x12c5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x12c5,0xc1));var _0x512c=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x12c5[_0x10004e];return _0x5af990;};'use strict';var _=require(_0x512c('0x0'));var util=require(_0x512c('0x1'));var moment=require('moment');var BPromise=require(_0x512c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x512c('0x3'));var db=require(_0x512c('0x4'))['db'];var utils=require(_0x512c('0x5'));var logger=require(_0x512c('0x6'))(_0x512c('0x7'));var config=require(_0x512c('0x8'));var jayson=require(_0x512c('0x9'));var client=jayson['client'][_0x512c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x221f89,_0x426db2,_0x3b61a4){return new BPromise(function(_0x5badf0,_0x1ec4e2){return client[_0x512c('0xb')](_0x221f89,_0x3b61a4)[_0x512c('0xc')](function(_0x2c6d2a){logger[_0x512c('0xd')](_0x512c('0xe'),_0x426db2,_0x512c('0xf'));logger[_0x512c('0x10')](_0x512c('0x11'),_0x426db2,_0x512c('0xf'),JSON[_0x512c('0x12')](_0x2c6d2a));if(_0x2c6d2a[_0x512c('0x13')]){if(_0x2c6d2a['error'][_0x512c('0x14')]===0x1f4){logger[_0x512c('0x13')](_0x512c('0xe'),_0x426db2,_0x2c6d2a[_0x512c('0x13')][_0x512c('0x15')]);return _0x1ec4e2(_0x2c6d2a['error'][_0x512c('0x15')]);}logger[_0x512c('0x13')]('Sound,\x20%s,\x20%s',_0x426db2,_0x2c6d2a[_0x512c('0x13')][_0x512c('0x15')]);return _0x5badf0(_0x2c6d2a[_0x512c('0x13')][_0x512c('0x15')]);}else{logger[_0x512c('0xd')](_0x512c('0xe'),_0x426db2,_0x512c('0xf'));_0x5badf0(_0x2c6d2a[_0x512c('0x16')][_0x512c('0x15')]);}})['catch'](function(_0x15e940){logger[_0x512c('0x13')](_0x512c('0xe'),_0x426db2,_0x15e940);_0x1ec4e2(_0x15e940);});});}exports[_0x512c('0x17')]=function(_0x51e915){var _0x49d9e1=this;return new Promise(function(_0x497079,_0xd7ff0d){return db[_0x512c('0x18')][_0x512c('0x19')]({'raw':_0x51e915[_0x512c('0x1a')]?_0x51e915['options'][_0x512c('0x1b')]===undefined?!![]:![]:!![],'where':_0x51e915[_0x512c('0x1a')]?_0x51e915[_0x512c('0x1a')][_0x512c('0x1c')]||null:null,'attributes':_0x51e915[_0x512c('0x1a')]?_0x51e915[_0x512c('0x1a')][_0x512c('0x1d')]||null:null,'include':_0x51e915[_0x512c('0x1a')]?_0x51e915[_0x512c('0x1a')][_0x512c('0x1e')]?_[_0x512c('0x1f')](_0x51e915[_0x512c('0x1a')]['include'],function(_0x5bdb66){return{'model':db[_0x5bdb66[_0x512c('0x20')]],'as':_0x5bdb66['as'],'attributes':_0x5bdb66[_0x512c('0x1d')],'include':_0x5bdb66[_0x512c('0x1e')]?_[_0x512c('0x1f')](_0x5bdb66['include'],function(_0x54c886){return{'model':db[_0x54c886[_0x512c('0x20')]],'as':_0x54c886['as'],'attributes':_0x54c886['attributes'],'include':_0x54c886['include']?_['map'](_0x54c886[_0x512c('0x1e')],function(_0x38448d){return{'model':db[_0x38448d[_0x512c('0x20')]],'as':_0x38448d['as'],'attributes':_0x38448d[_0x512c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x512c('0xc')](function(_0x5a63f5){logger[_0x512c('0xd')]('ShowSound',_0x51e915);logger[_0x512c('0x10')]('ShowSound',_0x51e915,JSON['stringify'](_0x5a63f5));_0x497079(_0x5a63f5);})['catch'](function(_0xac27f8){logger['error'](_0x512c('0x17'),_0xac27f8[_0x512c('0x15')],_0x51e915);_0xd7ff0d(_0x49d9e1[_0x512c('0x13')](0x1f4,_0xac27f8[_0x512c('0x15')]));});});}; \ No newline at end of file +var _0x5d20=['debug','Sound,\x20%s,\x20%s,\x20%s','error','code','Sound,\x20%s,\x20%s','message','request\x20sent','catch','ShowSound','find','options','raw','where','attributes','include','model','map','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x5a2299,_0x3e2922){var _0xedff0f=function(_0x1624cb){while(--_0x1624cb){_0x5a2299['push'](_0x5a2299['shift']());}};_0xedff0f(++_0x3e2922);}(_0x5d20,0x192));var _0x05d2=function(_0x57a255,_0x8ce2c1){_0x57a255=_0x57a255-0x0;var _0x537678=_0x5d20[_0x57a255];return _0x537678;};'use strict';var _=require(_0x05d2('0x0'));var util=require(_0x05d2('0x1'));var moment=require(_0x05d2('0x2'));var BPromise=require(_0x05d2('0x3'));var rs=require(_0x05d2('0x4'));var fs=require('fs');var Redis=require(_0x05d2('0x5'));var db=require(_0x05d2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x05d2('0x7'))(_0x05d2('0x8'));var config=require('../../config/environment');var jayson=require(_0x05d2('0x9'));var client=jayson[_0x05d2('0xa')][_0x05d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x81ed06,_0x5c82c7,_0x23f2ce){return new BPromise(function(_0x268b60,_0x4a4907){return client['request'](_0x81ed06,_0x23f2ce)[_0x05d2('0xc')](function(_0x309761){logger[_0x05d2('0xd')]('Sound,\x20%s,\x20%s',_0x5c82c7,'request\x20sent');logger[_0x05d2('0xe')](_0x05d2('0xf'),_0x5c82c7,'request\x20sent',JSON['stringify'](_0x309761));if(_0x309761[_0x05d2('0x10')]){if(_0x309761['error'][_0x05d2('0x11')]===0x1f4){logger['error'](_0x05d2('0x12'),_0x5c82c7,_0x309761[_0x05d2('0x10')]['message']);return _0x4a4907(_0x309761[_0x05d2('0x10')][_0x05d2('0x13')]);}logger['error'](_0x05d2('0x12'),_0x5c82c7,_0x309761[_0x05d2('0x10')][_0x05d2('0x13')]);return _0x268b60(_0x309761['error'][_0x05d2('0x13')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x5c82c7,_0x05d2('0x14'));_0x268b60(_0x309761['result'][_0x05d2('0x13')]);}})[_0x05d2('0x15')](function(_0x5ae06d){logger[_0x05d2('0x10')]('Sound,\x20%s,\x20%s',_0x5c82c7,_0x5ae06d);_0x4a4907(_0x5ae06d);});});}exports[_0x05d2('0x16')]=function(_0x2bd9df){var _0xe63e99=this;return new Promise(function(_0x8751d2,_0x4a7f7e){return db['Sound'][_0x05d2('0x17')]({'raw':_0x2bd9df[_0x05d2('0x18')]?_0x2bd9df[_0x05d2('0x18')][_0x05d2('0x19')]===undefined?!![]:![]:!![],'where':_0x2bd9df[_0x05d2('0x18')]?_0x2bd9df[_0x05d2('0x18')][_0x05d2('0x1a')]||null:null,'attributes':_0x2bd9df[_0x05d2('0x18')]?_0x2bd9df[_0x05d2('0x18')][_0x05d2('0x1b')]||null:null,'include':_0x2bd9df[_0x05d2('0x18')]?_0x2bd9df[_0x05d2('0x18')][_0x05d2('0x1c')]?_['map'](_0x2bd9df[_0x05d2('0x18')]['include'],function(_0x4cdf32){return{'model':db[_0x4cdf32[_0x05d2('0x1d')]],'as':_0x4cdf32['as'],'attributes':_0x4cdf32['attributes'],'include':_0x4cdf32[_0x05d2('0x1c')]?_[_0x05d2('0x1e')](_0x4cdf32['include'],function(_0x456c21){return{'model':db[_0x456c21[_0x05d2('0x1d')]],'as':_0x456c21['as'],'attributes':_0x456c21[_0x05d2('0x1b')],'include':_0x456c21[_0x05d2('0x1c')]?_['map'](_0x456c21['include'],function(_0xe00de0){return{'model':db[_0xe00de0['model']],'as':_0xe00de0['as'],'attributes':_0xe00de0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x506f6d){logger[_0x05d2('0xd')]('ShowSound',_0x2bd9df);logger[_0x05d2('0xe')](_0x05d2('0x16'),_0x2bd9df,JSON[_0x05d2('0x1f')](_0x506f6d));_0x8751d2(_0x506f6d);})[_0x05d2('0x15')](function(_0x2f946c){logger[_0x05d2('0x10')]('ShowSound',_0x2f946c[_0x05d2('0x13')],_0x2bd9df);_0x4a7f7e(_0xe63e99['error'](0x1f4,_0x2f946c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 703ba0e..9662cda 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 _0xa675=['./squareMessage.controller','get','isAuthenticated','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0xa675,0xac));var _0x5a67=function(_0x5654ef,_0x1ddf03){_0x5654ef=_0x5654ef-0x0;var _0x40fee1=_0xa675[_0x5654ef];return _0x40fee1;};'use strict';var multer=require('multer');var util=require(_0x5a67('0x0'));var path=require(_0x5a67('0x1'));var timeout=require(_0x5a67('0x2'));var express=require(_0x5a67('0x3'));var router=express[_0x5a67('0x4')]();var fs_extra=require(_0x5a67('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5a67('0x6'));var config=require(_0x5a67('0x7'));var controller=require(_0x5a67('0x8'));router[_0x5a67('0x9')]('/',auth[_0x5a67('0xa')](),controller['index']);router[_0x5a67('0x9')](_0x5a67('0xb'),auth['isAuthenticated'](),controller[_0x5a67('0xc')]);router[_0x5a67('0xd')]('/',auth[_0x5a67('0xa')](),controller['create']);router['put'](_0x5a67('0xb'),auth['isAuthenticated'](),controller[_0x5a67('0xe')]);router[_0x5a67('0xf')]('/:id',auth[_0x5a67('0xa')](),controller[_0x5a67('0x10')]);module[_0x5a67('0x11')]=router; \ No newline at end of file +var _0xd608=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x24ff10,_0x4f2b68){var _0x39c406=function(_0x40f740){while(--_0x40f740){_0x24ff10['push'](_0x24ff10['shift']());}};_0x39c406(++_0x4f2b68);}(_0xd608,0x1b8));var _0x8d60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd608[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8d60('0x0'));var util=require(_0x8d60('0x1'));var path=require(_0x8d60('0x2'));var timeout=require(_0x8d60('0x3'));var express=require(_0x8d60('0x4'));var router=express['Router']();var fs_extra=require(_0x8d60('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8d60('0x6'));var config=require(_0x8d60('0x7'));var controller=require(_0x8d60('0x8'));router[_0x8d60('0x9')]('/',auth[_0x8d60('0xa')](),controller[_0x8d60('0xb')]);router[_0x8d60('0x9')](_0x8d60('0xc'),auth[_0x8d60('0xa')](),controller[_0x8d60('0xd')]);router[_0x8d60('0xe')]('/',auth[_0x8d60('0xa')](),controller[_0x8d60('0xf')]);router[_0x8d60('0x10')](_0x8d60('0xc'),auth[_0x8d60('0xa')](),controller[_0x8d60('0x11')]);router[_0x8d60('0x12')](_0x8d60('0xc'),auth['isAuthenticated'](),controller[_0x8d60('0x13')]);module[_0x8d60('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index f3b8aad..7963969 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 _0x24ca=['sequelize','TEXT','ENUM','out'];(function(_0x46fbba,_0x36010f){var _0xd143af=function(_0x1b3915){while(--_0x1b3915){_0x46fbba['push'](_0x46fbba['shift']());}};_0xd143af(++_0x36010f);}(_0x24ca,0x8c));var _0xa24c=function(_0x168127,_0x59cea1){_0x168127=_0x168127-0x0;var _0x4c99ad=_0x24ca[_0x168127];return _0x4c99ad;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xa24c('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xa24c('0x2')]('in',_0xa24c('0x3')),'defaultValue':_0xa24c('0x3'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa24c('0x1')]}}; \ No newline at end of file +var _0xcb66=['out','exports','STRING','TEXT','medium','ENUM'];(function(_0x5ab9d,_0x2f4be1){var _0xbf874c=function(_0x3f46fa){while(--_0x3f46fa){_0x5ab9d['push'](_0x5ab9d['shift']());}};_0xbf874c(++_0x2f4be1);}(_0xcb66,0x19f));var _0x6cb6=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0xcb66[_0x4e8286];return _0x44a440;};'use strict';var Sequelize=require('sequelize');module[_0x6cb6('0x0')]={'uniqueid':{'type':Sequelize[_0x6cb6('0x1')]},'body':{'type':Sequelize[_0x6cb6('0x2')](_0x6cb6('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6cb6('0x4')]('in','out'),'defaultValue':_0x6cb6('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6cb6('0x1')]},'providerResponse':{'type':Sequelize[_0x6cb6('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index faaa518..63fcb09 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 _0x0f56=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','reject','save','destroy','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','model','intersection','attributes','query','fields','length','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','options','count','then','include','findAll','rows','show','params','keys','catch','create','update','body','find','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x124b24,_0x24494f){var _0x1c62fa=function(_0xfcb2e3){while(--_0xfcb2e3){_0x124b24['push'](_0x124b24['shift']());}};_0x1c62fa(++_0x24494f);}(_0x0f56,0xc3));var _0x60f5=function(_0x435645,_0xc3d7aa){_0x435645=_0x435645-0x0;var _0x546f44=_0x0f56[_0x435645];return _0x546f44;};'use strict';var pdf=require(_0x60f5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x60f5('0x1'));var moment=require(_0x60f5('0x2'));var BPromise=require(_0x60f5('0x3'));var Mustache=require(_0x60f5('0x4'));var util=require(_0x60f5('0x5'));var path=require(_0x60f5('0x6'));var sox=require(_0x60f5('0x7'));var csv=require(_0x60f5('0x8'));var ejs=require(_0x60f5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x60f5('0xa'));var squel=require(_0x60f5('0xb'));var crypto=require(_0x60f5('0xc'));var jsforce=require(_0x60f5('0xd'));var deskjs=require(_0x60f5('0xe'));var toCsv=require(_0x60f5('0x8'));var querystring=require(_0x60f5('0xf'));var Papa=require(_0x60f5('0x10'));var Redis=require('ioredis');var authService=require(_0x60f5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x60f5('0x12'));var hardwareService=require(_0x60f5('0x13'));var logger=require(_0x60f5('0x14'))(_0x60f5('0x15'));var utils=require(_0x60f5('0x16'));var config=require(_0x60f5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x60f5('0x18'))['db'];function respondWithStatusCode(_0x41ff31,_0x36dca1){_0x36dca1=_0x36dca1||0xcc;return function(_0x41c064){if(_0x41c064){return _0x41ff31['sendStatus'](_0x36dca1);}return _0x41ff31['status'](_0x36dca1)[_0x60f5('0x19')]();};}function respondWithResult(_0x1896a5,_0x47eaaf){_0x47eaaf=_0x47eaaf||0xc8;return function(_0x28bcf9){if(_0x28bcf9){return _0x1896a5[_0x60f5('0x1a')](_0x47eaaf)[_0x60f5('0x1b')](_0x28bcf9);}};}function respondWithFilteredResult(_0x551408,_0x45e640){return function(_0x53469d){if(_0x53469d){var _0x41a7e0=_0x53469d['count'],_0x317e41=_0x45e640[_0x60f5('0x1c')],_0x441d59=_0x45e640['offset']+_0x45e640[_0x60f5('0x1d')],_0x48a9cf;if(_0x441d59>=_0x41a7e0){_0x441d59=_0x41a7e0;_0x48a9cf=0xc8;}else{_0x48a9cf=0xce;}_0x551408[_0x60f5('0x1a')](_0x48a9cf);return _0x551408[_0x60f5('0x1e')](_0x60f5('0x1f'),_0x317e41+'-'+_0x441d59+'/'+_0x41a7e0)[_0x60f5('0x1b')](_0x53469d);}return null;};}function patchUpdates(_0xd1ec7e){return function(_0x21d2a0){try{jsonpatch['apply'](_0x21d2a0,_0xd1ec7e,!![]);}catch(_0x1262a6){return BPromise[_0x60f5('0x20')](_0x1262a6);}return _0x21d2a0[_0x60f5('0x21')]();};}function saveUpdates(_0x373569,_0x12525d){return function(_0x527208){if(_0x527208){return _0x527208['update'](_0x373569)['then'](function(_0x3d5374){return _0x3d5374;});}return null;};}function removeEntity(_0x1d8d64,_0x2a51d1){return function(_0x469867){if(_0x469867){return _0x469867[_0x60f5('0x22')]()['then'](function(){_0x1d8d64[_0x60f5('0x1a')](0xcc)[_0x60f5('0x19')]();});}};}function handleEntityNotFound(_0x188796,_0x16a106){return function(_0x5d8772){if(!_0x5d8772){_0x188796['sendStatus'](0x194);}return _0x5d8772;};}function handleError(_0x4f89d6,_0x5ca298){_0x5ca298=_0x5ca298||0x1f4;return function(_0x68085e){logger['error'](_0x68085e[_0x60f5('0x23')]);if(_0x68085e[_0x60f5('0x24')]){delete _0x68085e[_0x60f5('0x24')];}_0x4f89d6[_0x60f5('0x1a')](_0x5ca298)[_0x60f5('0x25')](_0x68085e);};}exports[_0x60f5('0x26')]=function(_0x1e5e88,_0x2061de){var _0x191bb4={},_0x33fa9b={},_0x3653ba={'count':0x0,'rows':[]};var _0x2e005c=_['map'](db[_0x60f5('0x27')][_0x60f5('0x28')],function(_0x294802){return{'name':_0x294802[_0x60f5('0x29')],'type':_0x294802[_0x60f5('0x2a')]['key']};});_0x33fa9b[_0x60f5('0x2b')]=_['map'](_0x2e005c,'name');_0x33fa9b['query']=_['keys'](_0x1e5e88['query']);_0x33fa9b['filters']=_[_0x60f5('0x2c')](_0x33fa9b[_0x60f5('0x2b')],_0x33fa9b['query']);_0x191bb4[_0x60f5('0x2d')]=_[_0x60f5('0x2c')](_0x33fa9b['model'],qs['fields'](_0x1e5e88[_0x60f5('0x2e')][_0x60f5('0x2f')]));_0x191bb4[_0x60f5('0x2d')]=_0x191bb4[_0x60f5('0x2d')][_0x60f5('0x30')]?_0x191bb4[_0x60f5('0x2d')]:_0x33fa9b[_0x60f5('0x2b')];if(!_0x1e5e88['query']['hasOwnProperty'](_0x60f5('0x31'))){_0x191bb4['limit']=qs[_0x60f5('0x1d')](_0x1e5e88['query'][_0x60f5('0x1d')]);_0x191bb4['offset']=qs['offset'](_0x1e5e88[_0x60f5('0x2e')][_0x60f5('0x1c')]);}_0x191bb4[_0x60f5('0x32')]=qs[_0x60f5('0x33')](_0x1e5e88[_0x60f5('0x2e')][_0x60f5('0x33')]);_0x191bb4[_0x60f5('0x34')]=qs[_0x60f5('0x35')](_['pick'](_0x1e5e88[_0x60f5('0x2e')],_0x33fa9b[_0x60f5('0x35')]),_0x2e005c);if(_0x1e5e88[_0x60f5('0x2e')]['filter']){_0x191bb4[_0x60f5('0x34')]=_['merge'](_0x191bb4['where'],{'$or':_['map'](_0x2e005c,function(_0x2c30e4){if(_0x2c30e4[_0x60f5('0x2a')]!==_0x60f5('0x36')){var _0x1714dd={};_0x1714dd[_0x2c30e4['name']]={'$like':'%'+_0x1e5e88[_0x60f5('0x2e')][_0x60f5('0x37')]+'%'};return _0x1714dd;}})});}_0x191bb4=_[_0x60f5('0x38')]({},_0x191bb4,_0x1e5e88[_0x60f5('0x39')]);var _0x24d60a={'where':_0x191bb4[_0x60f5('0x34')]};return db[_0x60f5('0x27')][_0x60f5('0x3a')](_0x24d60a)[_0x60f5('0x3b')](function(_0x209291){_0x3653ba[_0x60f5('0x3a')]=_0x209291;if(_0x1e5e88[_0x60f5('0x2e')]['includeAll']){_0x191bb4[_0x60f5('0x3c')]=[{'all':!![]}];}return db[_0x60f5('0x27')][_0x60f5('0x3d')](_0x191bb4);})[_0x60f5('0x3b')](function(_0x1554e3){_0x3653ba[_0x60f5('0x3e')]=_0x1554e3;return _0x3653ba;})['then'](respondWithFilteredResult(_0x2061de,_0x191bb4))['catch'](handleError(_0x2061de,null));};exports[_0x60f5('0x3f')]=function(_0x3095f3,_0x3699a8){var _0x2ef483={'raw':!![],'where':{'id':_0x3095f3[_0x60f5('0x40')]['id']}},_0x1ca88e={};_0x1ca88e[_0x60f5('0x2b')]=_[_0x60f5('0x41')](db[_0x60f5('0x27')][_0x60f5('0x28')]);_0x1ca88e[_0x60f5('0x2e')]=_[_0x60f5('0x41')](_0x3095f3[_0x60f5('0x2e')]);_0x1ca88e['filters']=_[_0x60f5('0x2c')](_0x1ca88e[_0x60f5('0x2b')],_0x1ca88e['query']);_0x2ef483[_0x60f5('0x2d')]=_[_0x60f5('0x2c')](_0x1ca88e['model'],qs[_0x60f5('0x2f')](_0x3095f3[_0x60f5('0x2e')][_0x60f5('0x2f')]));_0x2ef483[_0x60f5('0x2d')]=_0x2ef483[_0x60f5('0x2d')][_0x60f5('0x30')]?_0x2ef483[_0x60f5('0x2d')]:_0x1ca88e[_0x60f5('0x2b')];if(_0x3095f3['query']['includeAll']){_0x2ef483[_0x60f5('0x3c')]=[{'all':!![]}];}_0x2ef483=_[_0x60f5('0x38')]({},_0x2ef483,_0x3095f3[_0x60f5('0x39')]);return db[_0x60f5('0x27')]['find'](_0x2ef483)[_0x60f5('0x3b')](handleEntityNotFound(_0x3699a8,null))['then'](respondWithResult(_0x3699a8,null))[_0x60f5('0x42')](handleError(_0x3699a8,null));};exports['create']=function(_0x150e24,_0x392b28){return db[_0x60f5('0x27')][_0x60f5('0x43')](_0x150e24['body'],{})[_0x60f5('0x3b')](respondWithResult(_0x392b28,0xc9))['catch'](handleError(_0x392b28,null));};exports[_0x60f5('0x44')]=function(_0x2ba9af,_0x3ce8c7){if(_0x2ba9af[_0x60f5('0x45')]['id']){delete _0x2ba9af[_0x60f5('0x45')]['id'];}return db[_0x60f5('0x27')][_0x60f5('0x46')]({'where':{'id':_0x2ba9af[_0x60f5('0x40')]['id']}})[_0x60f5('0x3b')](handleEntityNotFound(_0x3ce8c7,null))[_0x60f5('0x3b')](saveUpdates(_0x2ba9af[_0x60f5('0x45')],null))['then'](respondWithResult(_0x3ce8c7,null))['catch'](handleError(_0x3ce8c7,null));};exports[_0x60f5('0x22')]=function(_0x48b551,_0x5b49ec){return db[_0x60f5('0x27')][_0x60f5('0x46')]({'where':{'id':_0x48b551['params']['id']}})['then'](handleEntityNotFound(_0x5b49ec,null))['then'](removeEntity(_0x5b49ec,null))['catch'](handleError(_0x5b49ec,null));}; \ No newline at end of file +var _0x2141=['rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','end','status','json','count','offset','set','Content-Range','reject','save','destroy','then','sendStatus','name','send','SquareMessage','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','update','html-pdf','eml-format'];(function(_0x42593f,_0x90afcd){var _0x360aa8=function(_0x3bd635){while(--_0x3bd635){_0x42593f['push'](_0x42593f['shift']());}};_0x360aa8(++_0x90afcd);}(_0x2141,0x1ba));var _0x1214=function(_0x55914a,_0x42c3b4){_0x55914a=_0x55914a-0x0;var _0x57f55b=_0x2141[_0x55914a];return _0x57f55b;};'use strict';var pdf=require(_0x1214('0x0'));var emlformat=require(_0x1214('0x1'));var rimraf=require(_0x1214('0x2'));var zipdir=require(_0x1214('0x3'));var jsonpatch=require(_0x1214('0x4'));var rp=require(_0x1214('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1214('0x6'));var util=require(_0x1214('0x7'));var path=require(_0x1214('0x8'));var sox=require(_0x1214('0x9'));var csv=require(_0x1214('0xa'));var ejs=require(_0x1214('0xb'));var fs=require('fs');var fs_extra=require(_0x1214('0xc'));var _=require(_0x1214('0xd'));var squel=require(_0x1214('0xe'));var crypto=require(_0x1214('0xf'));var jsforce=require(_0x1214('0x10'));var deskjs=require(_0x1214('0x11'));var toCsv=require(_0x1214('0xa'));var querystring=require(_0x1214('0x12'));var Papa=require(_0x1214('0x13'));var Redis=require(_0x1214('0x14'));var authService=require(_0x1214('0x15'));var qs=require(_0x1214('0x16'));var as=require(_0x1214('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1214('0x18'))(_0x1214('0x19'));var utils=require(_0x1214('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x1214('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc193b5,_0x5119d4){_0x5119d4=_0x5119d4||0xcc;return function(_0x34a8dd){if(_0x34a8dd){return _0xc193b5['sendStatus'](_0x5119d4);}return _0xc193b5['status'](_0x5119d4)[_0x1214('0x1c')]();};}function respondWithResult(_0xf35f7a,_0x41678b){_0x41678b=_0x41678b||0xc8;return function(_0x506f71){if(_0x506f71){return _0xf35f7a[_0x1214('0x1d')](_0x41678b)[_0x1214('0x1e')](_0x506f71);}};}function respondWithFilteredResult(_0x4060fe,_0x56b2fb){return function(_0x4a2811){if(_0x4a2811){var _0x302b3f=_0x4a2811[_0x1214('0x1f')],_0x13e8ad=_0x56b2fb[_0x1214('0x20')],_0x3109d2=_0x56b2fb[_0x1214('0x20')]+_0x56b2fb['limit'],_0xd95b37;if(_0x3109d2>=_0x302b3f){_0x3109d2=_0x302b3f;_0xd95b37=0xc8;}else{_0xd95b37=0xce;}_0x4060fe[_0x1214('0x1d')](_0xd95b37);return _0x4060fe[_0x1214('0x21')](_0x1214('0x22'),_0x13e8ad+'-'+_0x3109d2+'/'+_0x302b3f)['json'](_0x4a2811);}return null;};}function patchUpdates(_0x2dc2a9){return function(_0x2d3ec3){try{jsonpatch['apply'](_0x2d3ec3,_0x2dc2a9,!![]);}catch(_0x2644ca){return BPromise[_0x1214('0x23')](_0x2644ca);}return _0x2d3ec3[_0x1214('0x24')]();};}function saveUpdates(_0xda87b3,_0x545ec8){return function(_0x1427dc){if(_0x1427dc){return _0x1427dc['update'](_0xda87b3)['then'](function(_0x35ee48){return _0x35ee48;});}return null;};}function removeEntity(_0x2ad704,_0x52479e){return function(_0x336958){if(_0x336958){return _0x336958[_0x1214('0x25')]()[_0x1214('0x26')](function(){_0x2ad704['status'](0xcc)[_0x1214('0x1c')]();});}};}function handleEntityNotFound(_0x31626f,_0x512e22){return function(_0x5c6223){if(!_0x5c6223){_0x31626f[_0x1214('0x27')](0x194);}return _0x5c6223;};}function handleError(_0x113b0a,_0x4afb3b){_0x4afb3b=_0x4afb3b||0x1f4;return function(_0x3450cc){logger['error'](_0x3450cc['stack']);if(_0x3450cc['name']){delete _0x3450cc[_0x1214('0x28')];}_0x113b0a[_0x1214('0x1d')](_0x4afb3b)[_0x1214('0x29')](_0x3450cc);};}exports['index']=function(_0x76c1d4,_0x408322){var _0xe5eb1={},_0x23f0bc={},_0x137d62={'count':0x0,'rows':[]};var _0x2d1dc1=_['map'](db[_0x1214('0x2a')][_0x1214('0x2b')],function(_0x471326){return{'name':_0x471326['fieldName'],'type':_0x471326[_0x1214('0x2c')]['key']};});_0x23f0bc[_0x1214('0x2d')]=_[_0x1214('0x2e')](_0x2d1dc1,'name');_0x23f0bc[_0x1214('0x2f')]=_[_0x1214('0x30')](_0x76c1d4[_0x1214('0x2f')]);_0x23f0bc[_0x1214('0x31')]=_[_0x1214('0x32')](_0x23f0bc['model'],_0x23f0bc[_0x1214('0x2f')]);_0xe5eb1[_0x1214('0x33')]=_[_0x1214('0x32')](_0x23f0bc['model'],qs[_0x1214('0x34')](_0x76c1d4['query'][_0x1214('0x34')]));_0xe5eb1[_0x1214('0x33')]=_0xe5eb1[_0x1214('0x33')]['length']?_0xe5eb1[_0x1214('0x33')]:_0x23f0bc[_0x1214('0x2d')];if(!_0x76c1d4['query'][_0x1214('0x35')]('nolimit')){_0xe5eb1[_0x1214('0x36')]=qs[_0x1214('0x36')](_0x76c1d4[_0x1214('0x2f')][_0x1214('0x36')]);_0xe5eb1[_0x1214('0x20')]=qs[_0x1214('0x20')](_0x76c1d4['query'][_0x1214('0x20')]);}_0xe5eb1[_0x1214('0x37')]=qs[_0x1214('0x38')](_0x76c1d4['query'][_0x1214('0x38')]);_0xe5eb1[_0x1214('0x39')]=qs['filters'](_[_0x1214('0x3a')](_0x76c1d4[_0x1214('0x2f')],_0x23f0bc[_0x1214('0x31')]),_0x2d1dc1);if(_0x76c1d4[_0x1214('0x2f')]['filter']){_0xe5eb1[_0x1214('0x39')]=_['merge'](_0xe5eb1[_0x1214('0x39')],{'$or':_[_0x1214('0x2e')](_0x2d1dc1,function(_0x3641db){if(_0x3641db[_0x1214('0x2c')]!=='VIRTUAL'){var _0x53fac5={};_0x53fac5[_0x3641db['name']]={'$like':'%'+_0x76c1d4['query'][_0x1214('0x3b')]+'%'};return _0x53fac5;}})});}_0xe5eb1=_[_0x1214('0x3c')]({},_0xe5eb1,_0x76c1d4[_0x1214('0x3d')]);var _0x3f9f8c={'where':_0xe5eb1[_0x1214('0x39')]};return db[_0x1214('0x2a')][_0x1214('0x1f')](_0x3f9f8c)[_0x1214('0x26')](function(_0x12774a){_0x137d62[_0x1214('0x1f')]=_0x12774a;if(_0x76c1d4[_0x1214('0x2f')][_0x1214('0x3e')]){_0xe5eb1[_0x1214('0x3f')]=[{'all':!![]}];}return db[_0x1214('0x2a')][_0x1214('0x40')](_0xe5eb1);})['then'](function(_0x5cf136){_0x137d62[_0x1214('0x41')]=_0x5cf136;return _0x137d62;})[_0x1214('0x26')](respondWithFilteredResult(_0x408322,_0xe5eb1))['catch'](handleError(_0x408322,null));};exports[_0x1214('0x42')]=function(_0x2c9f9b,_0x51bfe3){var _0x4f8419={'raw':!![],'where':{'id':_0x2c9f9b[_0x1214('0x43')]['id']}},_0x1e0af9={};_0x1e0af9['model']=_['keys'](db[_0x1214('0x2a')][_0x1214('0x2b')]);_0x1e0af9[_0x1214('0x2f')]=_[_0x1214('0x30')](_0x2c9f9b[_0x1214('0x2f')]);_0x1e0af9[_0x1214('0x31')]=_[_0x1214('0x32')](_0x1e0af9[_0x1214('0x2d')],_0x1e0af9[_0x1214('0x2f')]);_0x4f8419['attributes']=_[_0x1214('0x32')](_0x1e0af9[_0x1214('0x2d')],qs['fields'](_0x2c9f9b['query'][_0x1214('0x34')]));_0x4f8419[_0x1214('0x33')]=_0x4f8419['attributes'][_0x1214('0x44')]?_0x4f8419[_0x1214('0x33')]:_0x1e0af9[_0x1214('0x2d')];if(_0x2c9f9b[_0x1214('0x2f')]['includeAll']){_0x4f8419[_0x1214('0x3f')]=[{'all':!![]}];}_0x4f8419=_[_0x1214('0x3c')]({},_0x4f8419,_0x2c9f9b['options']);return db[_0x1214('0x2a')][_0x1214('0x45')](_0x4f8419)[_0x1214('0x26')](handleEntityNotFound(_0x51bfe3,null))[_0x1214('0x26')](respondWithResult(_0x51bfe3,null))[_0x1214('0x46')](handleError(_0x51bfe3,null));};exports[_0x1214('0x47')]=function(_0x52c93f,_0x40e184){return db['SquareMessage']['create'](_0x52c93f[_0x1214('0x48')],{})['then'](respondWithResult(_0x40e184,0xc9))[_0x1214('0x46')](handleError(_0x40e184,null));};exports[_0x1214('0x49')]=function(_0x223253,_0x16d174){if(_0x223253[_0x1214('0x48')]['id']){delete _0x223253[_0x1214('0x48')]['id'];}return db[_0x1214('0x2a')][_0x1214('0x45')]({'where':{'id':_0x223253[_0x1214('0x43')]['id']}})[_0x1214('0x26')](handleEntityNotFound(_0x16d174,null))[_0x1214('0x26')](saveUpdates(_0x223253[_0x1214('0x48')],null))[_0x1214('0x26')](respondWithResult(_0x16d174,null))[_0x1214('0x46')](handleError(_0x16d174,null));};exports[_0x1214('0x25')]=function(_0x1f2cfd,_0x1c74e2){return db[_0x1214('0x2a')][_0x1214('0x45')]({'where':{'id':_0x1f2cfd['params']['id']}})[_0x1214('0x26')](handleEntityNotFound(_0x1c74e2,null))[_0x1214('0x26')](removeEntity(_0x1c74e2,null))[_0x1214('0x46')](handleError(_0x1c74e2,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index fdc56ea..17dc6bf 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 _0x8148=['path','./squareMessage.attributes','exports','define','square_messages','util','../../config/logger','moment','bluebird'];(function(_0x322919,_0x2ea14c){var _0x1ccdb7=function(_0x38c4e4){while(--_0x38c4e4){_0x322919['push'](_0x322919['shift']());}};_0x1ccdb7(++_0x2ea14c);}(_0x8148,0x152));var _0x8814=function(_0x452acd,_0x3bcaac){_0x452acd=_0x452acd-0x0;var _0x328e8=_0x8148[_0x452acd];return _0x328e8;};'use strict';var _=require('lodash');var util=require(_0x8814('0x0'));var logger=require(_0x8814('0x1'))('api');var moment=require(_0x8814('0x2'));var BPromise=require(_0x8814('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8814('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8814('0x5'));module[_0x8814('0x6')]=function(_0x42c370,_0x5584d9){return _0x42c370[_0x8814('0x7')]('SquareMessage',attributes,{'tableName':_0x8814('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f53=['SquareMessage','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3dedd3,_0x34d565){var _0x4d4d4=function(_0x4e6f0e){while(--_0x4e6f0e){_0x3dedd3['push'](_0x3dedd3['shift']());}};_0x4d4d4(++_0x34d565);}(_0x9f53,0x140));var _0x39f5=function(_0x4cc7a9,_0x572ef7){_0x4cc7a9=_0x4cc7a9-0x0;var _0x1d16bc=_0x9f53[_0x4cc7a9];return _0x1d16bc;};'use strict';var _=require(_0x39f5('0x0'));var util=require(_0x39f5('0x1'));var logger=require(_0x39f5('0x2'))(_0x39f5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x39f5('0x4'));var fs=require('fs');var path=require(_0x39f5('0x5'));var rimraf=require(_0x39f5('0x6'));var config=require(_0x39f5('0x7'));var attributes=require('./squareMessage.attributes');module[_0x39f5('0x8')]=function(_0x2bcd56,_0x5893a2){return _0x2bcd56[_0x39f5('0x9')](_0x39f5('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 2e57634..cecd354 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 _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x2fdf7c,_0x205ad2){var _0x20b654=function(_0x3257c8){while(--_0x3257c8){_0x2fdf7c['push'](_0x2fdf7c['shift']());}};_0x20b654(++_0x205ad2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x2c7d37,_0x126471){var _0x2e7626=function(_0x255fef){while(--_0x255fef){_0x2c7d37['push'](_0x2c7d37['shift']());}};_0x2e7626(++_0x126471);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index ef3c545..92afb54 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 _0xa427=['../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5890ea,_0x371000){var _0x1773af=function(_0x43cb18){while(--_0x43cb18){_0x5890ea['push'](_0x5890ea['shift']());}};_0x1773af(++_0x371000);}(_0xa427,0xbf));var _0x7a42=function(_0x5f3cc2,_0x23b6b4){_0x5f3cc2=_0x5f3cc2-0x0;var _0x3823b0=_0xa427[_0x5f3cc2];return _0x3823b0;};'use strict';var multer=require(_0x7a42('0x0'));var util=require(_0x7a42('0x1'));var path=require(_0x7a42('0x2'));var timeout=require('connect-timeout');var express=require(_0x7a42('0x3'));var router=express[_0x7a42('0x4')]();var fs_extra=require(_0x7a42('0x5'));var auth=require(_0x7a42('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7a42('0x7'));var controller=require(_0x7a42('0x8'));router[_0x7a42('0x9')]('/',auth[_0x7a42('0xa')](),controller[_0x7a42('0xb')]);router[_0x7a42('0x9')](_0x7a42('0xc'),auth[_0x7a42('0xa')](),controller[_0x7a42('0xd')]);router[_0x7a42('0x9')](_0x7a42('0xe'),auth[_0x7a42('0xa')](),timeout(_0x7a42('0xf')),controller[_0x7a42('0x10')]);router[_0x7a42('0x11')]('/',auth[_0x7a42('0xa')](),controller[_0x7a42('0x12')]);router[_0x7a42('0x13')](_0x7a42('0xc'),auth[_0x7a42('0xa')](),controller[_0x7a42('0x14')]);router[_0x7a42('0x15')](_0x7a42('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe9f3=['isAuthenticated','/:id','show','/:id/test','15s','test','post','create','update','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','get'];(function(_0x54579b,_0x5965ed){var _0x4d86a7=function(_0x3d78b9){while(--_0x3d78b9){_0x54579b['push'](_0x54579b['shift']());}};_0x4d86a7(++_0x5965ed);}(_0xe9f3,0x1a9));var _0x3e9f=function(_0x9af801,_0x257def){_0x9af801=_0x9af801-0x0;var _0x1d5bc3=_0xe9f3[_0x9af801];return _0x1d5bc3;};'use strict';var multer=require('multer');var util=require(_0x3e9f('0x0'));var path=require(_0x3e9f('0x1'));var timeout=require('connect-timeout');var express=require(_0x3e9f('0x2'));var router=express[_0x3e9f('0x3')]();var fs_extra=require(_0x3e9f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3e9f('0x5'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x3e9f('0x6')]('/',auth[_0x3e9f('0x7')](),controller['index']);router[_0x3e9f('0x6')](_0x3e9f('0x8'),auth['isAuthenticated'](),controller[_0x3e9f('0x9')]);router[_0x3e9f('0x6')](_0x3e9f('0xa'),auth[_0x3e9f('0x7')](),timeout(_0x3e9f('0xb')),controller[_0x3e9f('0xc')]);router[_0x3e9f('0xd')]('/',auth['isAuthenticated'](),controller[_0x3e9f('0xe')]);router['put'](_0x3e9f('0x8'),auth[_0x3e9f('0x7')](),controller[_0x3e9f('0xf')]);router['delete'](_0x3e9f('0x8'),auth['isAuthenticated'](),controller[_0x3e9f('0x10')]);module[_0x3e9f('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 b70e73a..5e21dd4 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 _0x91bd=['sequelize','STRING','name'];(function(_0x2e3545,_0x20a6ec){var _0xcf18f=function(_0x3c85dd){while(--_0x3c85dd){_0x2e3545['push'](_0x2e3545['shift']());}};_0xcf18f(++_0x20a6ec);}(_0x91bd,0x1aa));var _0xd91b=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x91bd[_0x46efd7];return _0x5637e4;};'use strict';var Sequelize=require(_0xd91b('0x0'));module['exports']={'name':{'type':Sequelize[_0xd91b('0x1')],'unique':_0xd91b('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd91b('0x1')]},'description':{'type':Sequelize[_0xd91b('0x1')]}}; \ No newline at end of file +var _0xee3a=['exports','name','STRING','sequelize'];(function(_0x18da33,_0x2586f3){var _0x4dfc9c=function(_0x4f83fa){while(--_0x4f83fa){_0x18da33['push'](_0x18da33['shift']());}};_0x4dfc9c(++_0x2586f3);}(_0xee3a,0xf3));var _0xaee3=function(_0x4224ae,_0x229daf){_0x4224ae=_0x4224ae-0x0;var _0x12e17e=_0xee3a[_0x4224ae];return _0x12e17e;};'use strict';var Sequelize=require(_0xaee3('0x0'));module[_0xaee3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xaee3('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaee3('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 2e38a7f..7ee0b0a 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 _0xf70a=['index','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name'];(function(_0x5deca1,_0x27eb11){var _0x2e945b=function(_0x3822ea){while(--_0x3822ea){_0x5deca1['push'](_0x5deca1['shift']());}};_0x2e945b(++_0x27eb11);}(_0xf70a,0x18f));var _0xaf70=function(_0x305117,_0x289f1a){_0x305117=_0x305117-0x0;var _0x184cb7=_0xf70a[_0x305117];return _0x184cb7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaf70('0x0'));var rimraf=require(_0xaf70('0x1'));var zipdir=require(_0xaf70('0x2'));var jsonpatch=require(_0xaf70('0x3'));var rp=require(_0xaf70('0x4'));var moment=require(_0xaf70('0x5'));var BPromise=require(_0xaf70('0x6'));var Mustache=require(_0xaf70('0x7'));var util=require(_0xaf70('0x8'));var path=require(_0xaf70('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf70('0xa'));var fs=require('fs');var fs_extra=require(_0xaf70('0xb'));var _=require(_0xaf70('0xc'));var squel=require(_0xaf70('0xd'));var crypto=require(_0xaf70('0xe'));var jsforce=require(_0xaf70('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xaf70('0x10'));var querystring=require(_0xaf70('0x11'));var Papa=require(_0xaf70('0x12'));var Redis=require('ioredis');var authService=require(_0xaf70('0x13'));var qs=require(_0xaf70('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf70('0x15'))(_0xaf70('0x16'));var utils=require(_0xaf70('0x17'));var config=require(_0xaf70('0x18'));var licenseUtil=require(_0xaf70('0x19'));var db=require(_0xaf70('0x1a'))['db'];function respondWithStatusCode(_0x3bd683,_0x463dc0){_0x463dc0=_0x463dc0||0xcc;return function(_0x4646c5){if(_0x4646c5){return _0x3bd683[_0xaf70('0x1b')](_0x463dc0);}return _0x3bd683['status'](_0x463dc0)[_0xaf70('0x1c')]();};}function respondWithResult(_0xc13f30,_0x19f5c4){_0x19f5c4=_0x19f5c4||0xc8;return function(_0x5b699a){if(_0x5b699a){return _0xc13f30[_0xaf70('0x1d')](_0x19f5c4)[_0xaf70('0x1e')](_0x5b699a);}};}function respondWithFilteredResult(_0x44c946,_0x236476){return function(_0x90640c){if(_0x90640c){var _0x2f85ff=_0x90640c[_0xaf70('0x1f')],_0x3357b9=_0x236476[_0xaf70('0x20')],_0x2ba41b=_0x236476[_0xaf70('0x20')]+_0x236476['limit'],_0x4a5b14;if(_0x2ba41b>=_0x2f85ff){_0x2ba41b=_0x2f85ff;_0x4a5b14=0xc8;}else{_0x4a5b14=0xce;}_0x44c946[_0xaf70('0x1d')](_0x4a5b14);return _0x44c946[_0xaf70('0x21')](_0xaf70('0x22'),_0x3357b9+'-'+_0x2ba41b+'/'+_0x2f85ff)[_0xaf70('0x1e')](_0x90640c);}return null;};}function patchUpdates(_0x613f2f){return function(_0x67c838){try{jsonpatch[_0xaf70('0x23')](_0x67c838,_0x613f2f,!![]);}catch(_0x795c8a){return BPromise[_0xaf70('0x24')](_0x795c8a);}return _0x67c838['save']();};}function saveUpdates(_0x2fbb60,_0x5d53fd){return function(_0x1abe87){if(_0x1abe87){return _0x1abe87[_0xaf70('0x25')](_0x2fbb60)[_0xaf70('0x26')](function(_0x30b3f1){return _0x30b3f1;});}return null;};}function removeEntity(_0x296f79,_0x7c903){return function(_0x2efd5d){if(_0x2efd5d){return _0x2efd5d[_0xaf70('0x27')]()['then'](function(){var _0x37068e=_0x2efd5d[_0xaf70('0x28')]({'plain':!![]});var _0x4706b7=_0xaf70('0x29');return db[_0xaf70('0x2a')]['destroy']({'where':{'type':_0x4706b7,'resourceId':_0x37068e['id']}})[_0xaf70('0x26')](function(){return _0x2efd5d;});})[_0xaf70('0x26')](function(){_0x296f79[_0xaf70('0x1d')](0xcc)[_0xaf70('0x1c')]();});}};}function handleEntityNotFound(_0x1f2140,_0x503799){return function(_0x37d092){if(!_0x37d092){_0x1f2140[_0xaf70('0x1b')](0x194);}return _0x37d092;};}function handleError(_0x134e58,_0x1acb57){_0x1acb57=_0x1acb57||0x1f4;return function(_0x5ac7ed){logger[_0xaf70('0x2b')](_0x5ac7ed[_0xaf70('0x2c')]);if(_0x5ac7ed[_0xaf70('0x2d')]){delete _0x5ac7ed[_0xaf70('0x2d')];}_0x134e58[_0xaf70('0x1d')](_0x1acb57)['send'](_0x5ac7ed);};}exports[_0xaf70('0x2e')]=function(_0x2c2fe8,_0x52ce61){var _0x2f196e={},_0x586702={},_0x648f96={'count':0x0,'rows':[]};var _0x558281=_[_0xaf70('0x2f')](db[_0xaf70('0x30')][_0xaf70('0x31')],function(_0xbdabff){return{'name':_0xbdabff[_0xaf70('0x32')],'type':_0xbdabff['type'][_0xaf70('0x33')]};});_0x586702[_0xaf70('0x34')]=_[_0xaf70('0x2f')](_0x558281,_0xaf70('0x2d'));_0x586702[_0xaf70('0x35')]=_[_0xaf70('0x36')](_0x2c2fe8[_0xaf70('0x35')]);_0x586702[_0xaf70('0x37')]=_[_0xaf70('0x38')](_0x586702[_0xaf70('0x34')],_0x586702[_0xaf70('0x35')]);_0x2f196e['attributes']=_[_0xaf70('0x38')](_0x586702[_0xaf70('0x34')],qs[_0xaf70('0x39')](_0x2c2fe8[_0xaf70('0x35')][_0xaf70('0x39')]));_0x2f196e[_0xaf70('0x3a')]=_0x2f196e['attributes'][_0xaf70('0x3b')]?_0x2f196e['attributes']:_0x586702[_0xaf70('0x34')];if(!_0x2c2fe8[_0xaf70('0x35')][_0xaf70('0x3c')](_0xaf70('0x3d'))){_0x2f196e[_0xaf70('0x3e')]=qs['limit'](_0x2c2fe8[_0xaf70('0x35')][_0xaf70('0x3e')]);_0x2f196e[_0xaf70('0x20')]=qs[_0xaf70('0x20')](_0x2c2fe8[_0xaf70('0x35')]['offset']);}_0x2f196e[_0xaf70('0x3f')]=qs[_0xaf70('0x40')](_0x2c2fe8[_0xaf70('0x35')][_0xaf70('0x40')]);_0x2f196e[_0xaf70('0x41')]=qs['filters'](_[_0xaf70('0x42')](_0x2c2fe8[_0xaf70('0x35')],_0x586702[_0xaf70('0x37')]),_0x558281);if(_0x2c2fe8[_0xaf70('0x35')][_0xaf70('0x43')]){_0x2f196e[_0xaf70('0x41')]=_['merge'](_0x2f196e['where'],{'$or':_[_0xaf70('0x2f')](_0x558281,function(_0x1f6d44){if(_0x1f6d44[_0xaf70('0x44')]!=='VIRTUAL'){var _0x37627d={};_0x37627d[_0x1f6d44[_0xaf70('0x2d')]]={'$like':'%'+_0x2c2fe8['query']['filter']+'%'};return _0x37627d;}})});}_0x2f196e=_[_0xaf70('0x45')]({},_0x2f196e,_0x2c2fe8[_0xaf70('0x46')]);var _0x4ecabc={'where':_0x2f196e['where']};return db['SquareOdbc']['count'](_0x4ecabc)[_0xaf70('0x26')](function(_0xa9cd97){_0x648f96[_0xaf70('0x1f')]=_0xa9cd97;if(_0x2c2fe8[_0xaf70('0x35')][_0xaf70('0x47')]){_0x2f196e[_0xaf70('0x48')]=[{'all':!![]}];}return db[_0xaf70('0x30')][_0xaf70('0x49')](_0x2f196e);})['then'](function(_0x215b7d){_0x648f96['rows']=_0x215b7d;return _0x648f96;})[_0xaf70('0x26')](respondWithFilteredResult(_0x52ce61,_0x2f196e))[_0xaf70('0x4a')](handleError(_0x52ce61,null));};exports[_0xaf70('0x4b')]=function(_0x41edfe,_0x49b46f){var _0x1d32d2={'raw':!![],'where':{'id':_0x41edfe['params']['id']}},_0x4df44d={};_0x4df44d[_0xaf70('0x34')]=_[_0xaf70('0x36')](db[_0xaf70('0x30')][_0xaf70('0x31')]);_0x4df44d[_0xaf70('0x35')]=_['keys'](_0x41edfe[_0xaf70('0x35')]);_0x4df44d['filters']=_[_0xaf70('0x38')](_0x4df44d[_0xaf70('0x34')],_0x4df44d['query']);_0x1d32d2[_0xaf70('0x3a')]=_[_0xaf70('0x38')](_0x4df44d[_0xaf70('0x34')],qs['fields'](_0x41edfe['query'][_0xaf70('0x39')]));_0x1d32d2['attributes']=_0x1d32d2[_0xaf70('0x3a')][_0xaf70('0x3b')]?_0x1d32d2[_0xaf70('0x3a')]:_0x4df44d[_0xaf70('0x34')];if(_0x41edfe['query'][_0xaf70('0x47')]){_0x1d32d2[_0xaf70('0x48')]=[{'all':!![]}];}_0x1d32d2=_[_0xaf70('0x45')]({},_0x1d32d2,_0x41edfe['options']);return db[_0xaf70('0x30')][_0xaf70('0x4c')](_0x1d32d2)[_0xaf70('0x26')](handleEntityNotFound(_0x49b46f,null))[_0xaf70('0x26')](respondWithResult(_0x49b46f,null))[_0xaf70('0x4a')](handleError(_0x49b46f,null));};exports[_0xaf70('0x4d')]=function(_0x5ba0f2,_0x416315){return db[_0xaf70('0x30')]['create'](_0x5ba0f2[_0xaf70('0x4e')],{})['then'](function(_0x57fb16){var _0x2f2759=_0x5ba0f2['user']['get']({'plain':!![]});if(!_0x2f2759)throw new Error(_0xaf70('0x4f'));if(_0x2f2759[_0xaf70('0x50')]==='user'){var _0xcd5826=_0x57fb16[_0xaf70('0x28')]({'plain':!![]});var _0x2a2a1a=_0xaf70('0x29');return db[_0xaf70('0x51')][_0xaf70('0x4c')]({'where':{'name':_0x2a2a1a,'userProfileId':_0x2f2759[_0xaf70('0x52')]},'raw':!![]})[_0xaf70('0x26')](function(_0x24394f){if(_0x24394f&&_0x24394f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xcd5826[_0xaf70('0x2d')],'resourceId':_0xcd5826['id'],'type':_0x24394f['name'],'sectionId':_0x24394f['id']},{})[_0xaf70('0x26')](function(){return _0x57fb16;});}else{return _0x57fb16;}})[_0xaf70('0x4a')](function(_0x4be25f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4be25f);throw _0x4be25f;});}return _0x57fb16;})[_0xaf70('0x26')](respondWithResult(_0x416315,0xc9))[_0xaf70('0x4a')](handleError(_0x416315,null));};exports['update']=function(_0xf4a77f,_0x2e27de){if(_0xf4a77f['body']['id']){delete _0xf4a77f['body']['id'];}return db[_0xaf70('0x30')]['find']({'where':{'id':_0xf4a77f[_0xaf70('0x53')]['id']}})[_0xaf70('0x26')](handleEntityNotFound(_0x2e27de,null))['then'](saveUpdates(_0xf4a77f[_0xaf70('0x4e')],null))[_0xaf70('0x26')](respondWithResult(_0x2e27de,null))['catch'](handleError(_0x2e27de,null));};exports[_0xaf70('0x27')]=function(_0xe441f4,_0x21f7b0){return db['SquareOdbc']['find']({'where':{'id':_0xe441f4[_0xaf70('0x53')]['id']}})[_0xaf70('0x26')](handleEntityNotFound(_0x21f7b0,null))['then'](removeEntity(_0x21f7b0,null))[_0xaf70('0x4a')](handleError(_0x21f7b0,null));};exports[_0xaf70('0x54')]=function(_0x2f5678,_0x2ea5b1,_0x1e5456){var _0x21d27c;return db['SquareOdbc'][_0xaf70('0x4c')]({'where':{'id':_0x2f5678[_0xaf70('0x53')]['id']},'attributes':['id','dsn']})[_0xaf70('0x26')](handleEntityNotFound(_0x2ea5b1,null))[_0xaf70('0x26')](function(_0x5549e4){if(_0x5549e4){var _0x3d26c2=require(_0xaf70('0x55'))();_0x3d26c2[_0xaf70('0x56')](_0x5549e4[_0xaf70('0x57')]);_0x3d26c2[_0xaf70('0x58')]();return _0x5549e4;}})[_0xaf70('0x26')](respondWithResult(_0x2ea5b1,null))['catch'](handleError(_0x2ea5b1,null));}; \ No newline at end of file +var _0x135d=['json','count','offset','limit','Content-Range','apply','save','update','then','UserProfileResource','destroy','error','name','send','SquareOdbc','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','create','body','user','get','ODBC','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x1f4561,_0x2f705e){var _0x4ff465=function(_0x49f5d9){while(--_0x49f5d9){_0x1f4561['push'](_0x1f4561['shift']());}};_0x4ff465(++_0x2f705e);}(_0x135d,0x1e2));var _0xd135=function(_0x12bb4b,_0x4c534c){_0x12bb4b=_0x12bb4b-0x0;var _0x4a9a67=_0x135d[_0x12bb4b];return _0x4a9a67;};'use strict';var pdf=require(_0xd135('0x0'));var emlformat=require(_0xd135('0x1'));var rimraf=require(_0xd135('0x2'));var zipdir=require(_0xd135('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd135('0x4'));var moment=require(_0xd135('0x5'));var BPromise=require(_0xd135('0x6'));var Mustache=require(_0xd135('0x7'));var util=require('util');var path=require(_0xd135('0x8'));var sox=require(_0xd135('0x9'));var csv=require(_0xd135('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd135('0xb'));var _=require(_0xd135('0xc'));var squel=require(_0xd135('0xd'));var crypto=require(_0xd135('0xe'));var jsforce=require(_0xd135('0xf'));var deskjs=require(_0xd135('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd135('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd135('0x12'));var hardwareService=require(_0xd135('0x13'));var logger=require(_0xd135('0x14'))(_0xd135('0x15'));var utils=require('../../config/utils');var config=require(_0xd135('0x16'));var licenseUtil=require(_0xd135('0x17'));var db=require(_0xd135('0x18'))['db'];function respondWithStatusCode(_0x3078f5,_0x22a579){_0x22a579=_0x22a579||0xcc;return function(_0x5c4201){if(_0x5c4201){return _0x3078f5[_0xd135('0x19')](_0x22a579);}return _0x3078f5[_0xd135('0x1a')](_0x22a579)[_0xd135('0x1b')]();};}function respondWithResult(_0x222e94,_0x430f99){_0x430f99=_0x430f99||0xc8;return function(_0x130149){if(_0x130149){return _0x222e94[_0xd135('0x1a')](_0x430f99)[_0xd135('0x1c')](_0x130149);}};}function respondWithFilteredResult(_0x63eef4,_0x31efc2){return function(_0x4a11be){if(_0x4a11be){var _0x35932b=_0x4a11be[_0xd135('0x1d')],_0x1ae5b2=_0x31efc2[_0xd135('0x1e')],_0x42d919=_0x31efc2['offset']+_0x31efc2[_0xd135('0x1f')],_0x3f799d;if(_0x42d919>=_0x35932b){_0x42d919=_0x35932b;_0x3f799d=0xc8;}else{_0x3f799d=0xce;}_0x63eef4['status'](_0x3f799d);return _0x63eef4['set'](_0xd135('0x20'),_0x1ae5b2+'-'+_0x42d919+'/'+_0x35932b)[_0xd135('0x1c')](_0x4a11be);}return null;};}function patchUpdates(_0x54065b){return function(_0x2cfdd8){try{jsonpatch[_0xd135('0x21')](_0x2cfdd8,_0x54065b,!![]);}catch(_0x3061cb){return BPromise['reject'](_0x3061cb);}return _0x2cfdd8[_0xd135('0x22')]();};}function saveUpdates(_0x17e622,_0x5bf78c){return function(_0x530291){if(_0x530291){return _0x530291[_0xd135('0x23')](_0x17e622)[_0xd135('0x24')](function(_0x44e4f6){return _0x44e4f6;});}return null;};}function removeEntity(_0x391457,_0x44d678){return function(_0x3e41fc){if(_0x3e41fc){return _0x3e41fc['destroy']()[_0xd135('0x24')](function(){var _0x453b5f=_0x3e41fc['get']({'plain':!![]});var _0x293a73='ODBC';return db[_0xd135('0x25')][_0xd135('0x26')]({'where':{'type':_0x293a73,'resourceId':_0x453b5f['id']}})[_0xd135('0x24')](function(){return _0x3e41fc;});})['then'](function(){_0x391457['status'](0xcc)[_0xd135('0x1b')]();});}};}function handleEntityNotFound(_0x297336,_0x55b729){return function(_0x22558c){if(!_0x22558c){_0x297336[_0xd135('0x19')](0x194);}return _0x22558c;};}function handleError(_0x2e8944,_0xaa9cea){_0xaa9cea=_0xaa9cea||0x1f4;return function(_0x38bc54){logger[_0xd135('0x27')](_0x38bc54['stack']);if(_0x38bc54[_0xd135('0x28')]){delete _0x38bc54[_0xd135('0x28')];}_0x2e8944[_0xd135('0x1a')](_0xaa9cea)[_0xd135('0x29')](_0x38bc54);};}exports['index']=function(_0x2c2bfa,_0x50a245){var _0x2b47bd={},_0x1a8fa9={},_0x2a1370={'count':0x0,'rows':[]};var _0x3c23d1=_['map'](db[_0xd135('0x2a')][_0xd135('0x2b')],function(_0x2ee20e){return{'name':_0x2ee20e[_0xd135('0x2c')],'type':_0x2ee20e[_0xd135('0x2d')][_0xd135('0x2e')]};});_0x1a8fa9[_0xd135('0x2f')]=_[_0xd135('0x30')](_0x3c23d1,'name');_0x1a8fa9['query']=_[_0xd135('0x31')](_0x2c2bfa['query']);_0x1a8fa9['filters']=_[_0xd135('0x32')](_0x1a8fa9[_0xd135('0x2f')],_0x1a8fa9[_0xd135('0x33')]);_0x2b47bd[_0xd135('0x34')]=_[_0xd135('0x32')](_0x1a8fa9['model'],qs[_0xd135('0x35')](_0x2c2bfa[_0xd135('0x33')][_0xd135('0x35')]));_0x2b47bd[_0xd135('0x34')]=_0x2b47bd[_0xd135('0x34')][_0xd135('0x36')]?_0x2b47bd[_0xd135('0x34')]:_0x1a8fa9[_0xd135('0x2f')];if(!_0x2c2bfa[_0xd135('0x33')][_0xd135('0x37')](_0xd135('0x38'))){_0x2b47bd['limit']=qs[_0xd135('0x1f')](_0x2c2bfa[_0xd135('0x33')][_0xd135('0x1f')]);_0x2b47bd[_0xd135('0x1e')]=qs[_0xd135('0x1e')](_0x2c2bfa[_0xd135('0x33')][_0xd135('0x1e')]);}_0x2b47bd['order']=qs[_0xd135('0x39')](_0x2c2bfa[_0xd135('0x33')][_0xd135('0x39')]);_0x2b47bd[_0xd135('0x3a')]=qs['filters'](_['pick'](_0x2c2bfa[_0xd135('0x33')],_0x1a8fa9[_0xd135('0x3b')]),_0x3c23d1);if(_0x2c2bfa[_0xd135('0x33')]['filter']){_0x2b47bd[_0xd135('0x3a')]=_[_0xd135('0x3c')](_0x2b47bd[_0xd135('0x3a')],{'$or':_['map'](_0x3c23d1,function(_0x303190){if(_0x303190[_0xd135('0x2d')]!==_0xd135('0x3d')){var _0x183c77={};_0x183c77[_0x303190[_0xd135('0x28')]]={'$like':'%'+_0x2c2bfa[_0xd135('0x33')][_0xd135('0x3e')]+'%'};return _0x183c77;}})});}_0x2b47bd=_['merge']({},_0x2b47bd,_0x2c2bfa[_0xd135('0x3f')]);var _0x51457e={'where':_0x2b47bd[_0xd135('0x3a')]};return db['SquareOdbc'][_0xd135('0x1d')](_0x51457e)[_0xd135('0x24')](function(_0x2b526f){_0x2a1370[_0xd135('0x1d')]=_0x2b526f;if(_0x2c2bfa[_0xd135('0x33')][_0xd135('0x40')]){_0x2b47bd[_0xd135('0x41')]=[{'all':!![]}];}return db[_0xd135('0x2a')][_0xd135('0x42')](_0x2b47bd);})[_0xd135('0x24')](function(_0xb67272){_0x2a1370[_0xd135('0x43')]=_0xb67272;return _0x2a1370;})[_0xd135('0x24')](respondWithFilteredResult(_0x50a245,_0x2b47bd))[_0xd135('0x44')](handleError(_0x50a245,null));};exports[_0xd135('0x45')]=function(_0x498837,_0x1c28fc){var _0x18aa36={'raw':!![],'where':{'id':_0x498837['params']['id']}},_0x5e56cc={};_0x5e56cc[_0xd135('0x2f')]=_[_0xd135('0x31')](db[_0xd135('0x2a')][_0xd135('0x2b')]);_0x5e56cc[_0xd135('0x33')]=_[_0xd135('0x31')](_0x498837['query']);_0x5e56cc[_0xd135('0x3b')]=_[_0xd135('0x32')](_0x5e56cc['model'],_0x5e56cc[_0xd135('0x33')]);_0x18aa36[_0xd135('0x34')]=_[_0xd135('0x32')](_0x5e56cc[_0xd135('0x2f')],qs[_0xd135('0x35')](_0x498837[_0xd135('0x33')]['fields']));_0x18aa36[_0xd135('0x34')]=_0x18aa36[_0xd135('0x34')][_0xd135('0x36')]?_0x18aa36['attributes']:_0x5e56cc['model'];if(_0x498837[_0xd135('0x33')][_0xd135('0x40')]){_0x18aa36[_0xd135('0x41')]=[{'all':!![]}];}_0x18aa36=_[_0xd135('0x3c')]({},_0x18aa36,_0x498837[_0xd135('0x3f')]);return db[_0xd135('0x2a')]['find'](_0x18aa36)['then'](handleEntityNotFound(_0x1c28fc,null))[_0xd135('0x24')](respondWithResult(_0x1c28fc,null))[_0xd135('0x44')](handleError(_0x1c28fc,null));};exports[_0xd135('0x46')]=function(_0x2c2aa1,_0xc78f51){return db[_0xd135('0x2a')][_0xd135('0x46')](_0x2c2aa1[_0xd135('0x47')],{})[_0xd135('0x24')](function(_0x4695fe){var _0x54df35=_0x2c2aa1[_0xd135('0x48')][_0xd135('0x49')]({'plain':!![]});if(!_0x54df35)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54df35['role']===_0xd135('0x48')){var _0x2a3edb=_0x4695fe[_0xd135('0x49')]({'plain':!![]});var _0x43ffee=_0xd135('0x4a');return db[_0xd135('0x4b')][_0xd135('0x4c')]({'where':{'name':_0x43ffee,'userProfileId':_0x54df35[_0xd135('0x4d')]},'raw':!![]})[_0xd135('0x24')](function(_0x281713){if(_0x281713&&_0x281713[_0xd135('0x4e')]===0x0){return db[_0xd135('0x25')][_0xd135('0x46')]({'name':_0x2a3edb[_0xd135('0x28')],'resourceId':_0x2a3edb['id'],'type':_0x281713[_0xd135('0x28')],'sectionId':_0x281713['id']},{})[_0xd135('0x24')](function(){return _0x4695fe;});}else{return _0x4695fe;}})[_0xd135('0x44')](function(_0xdedc7d){logger['error'](_0xd135('0x4f'),_0xdedc7d);throw _0xdedc7d;});}return _0x4695fe;})[_0xd135('0x24')](respondWithResult(_0xc78f51,0xc9))[_0xd135('0x44')](handleError(_0xc78f51,null));};exports[_0xd135('0x23')]=function(_0xcbec78,_0x2aba41){if(_0xcbec78[_0xd135('0x47')]['id']){delete _0xcbec78[_0xd135('0x47')]['id'];}return db[_0xd135('0x2a')]['find']({'where':{'id':_0xcbec78[_0xd135('0x50')]['id']}})['then'](handleEntityNotFound(_0x2aba41,null))[_0xd135('0x24')](saveUpdates(_0xcbec78['body'],null))['then'](respondWithResult(_0x2aba41,null))[_0xd135('0x44')](handleError(_0x2aba41,null));};exports[_0xd135('0x26')]=function(_0x501aa3,_0x3908d8){return db[_0xd135('0x2a')][_0xd135('0x4c')]({'where':{'id':_0x501aa3[_0xd135('0x50')]['id']}})[_0xd135('0x24')](handleEntityNotFound(_0x3908d8,null))[_0xd135('0x24')](removeEntity(_0x3908d8,null))[_0xd135('0x44')](handleError(_0x3908d8,null));};exports[_0xd135('0x51')]=function(_0x556b03,_0x27900b,_0x30cba7){var _0x196da6;return db[_0xd135('0x2a')][_0xd135('0x4c')]({'where':{'id':_0x556b03[_0xd135('0x50')]['id']},'attributes':['id',_0xd135('0x52')]})[_0xd135('0x24')](handleEntityNotFound(_0x27900b,null))[_0xd135('0x24')](function(_0x32118c){if(_0x32118c){var _0x47a9e7=require('odbc')();_0x47a9e7[_0xd135('0x53')](_0x32118c[_0xd135('0x52')]);_0x47a9e7[_0xd135('0x54')]();return _0x32118c;}})[_0xd135('0x24')](respondWithResult(_0x27900b,null))[_0xd135('0x44')](handleError(_0x27900b,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 73d7844..f57e619 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 _0x9749=['SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define'];(function(_0x1fae76,_0x2d852d){var _0x5e5bf1=function(_0x6d40ca){while(--_0x6d40ca){_0x1fae76['push'](_0x1fae76['shift']());}};_0x5e5bf1(++_0x2d852d);}(_0x9749,0xde));var _0x9974=function(_0x5cc89b,_0x21cae4){_0x5cc89b=_0x5cc89b-0x0;var _0x19b93d=_0x9749[_0x5cc89b];return _0x19b93d;};'use strict';var _=require(_0x9974('0x0'));var util=require(_0x9974('0x1'));var logger=require(_0x9974('0x2'))(_0x9974('0x3'));var moment=require(_0x9974('0x4'));var BPromise=require('bluebird');var rp=require(_0x9974('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9974('0x6'));var config=require(_0x9974('0x7'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x24fba0,_0xa1e04d){return _0x24fba0[_0x9974('0x8')](_0x9974('0x9'),attributes,{'tableName':_0x9974('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ef2=['../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash','bluebird','path'];(function(_0x9e6348,_0x533af8){var _0x14fc50=function(_0x2dfc0b){while(--_0x2dfc0b){_0x9e6348['push'](_0x9e6348['shift']());}};_0x14fc50(++_0x533af8);}(_0x1ef2,0xed));var _0x21ef=function(_0x19f764,_0x1a230b){_0x19f764=_0x19f764-0x0;var _0x17b88f=_0x1ef2[_0x19f764];return _0x17b88f;};'use strict';var _=require(_0x21ef('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x21ef('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x21ef('0x2'));var rimraf=require('rimraf');var config=require(_0x21ef('0x3'));var attributes=require(_0x21ef('0x4'));module[_0x21ef('0x5')]=function(_0x17d1a1,_0x224b1c){return _0x17d1a1['define'](_0x21ef('0x6'),attributes,{'tableName':_0x21ef('0x7'),'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 5c04a64..bfc554a 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 _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x51fd25,_0x2fcbb){var _0x4529ae=function(_0x17ed81){while(--_0x17ed81){_0x51fd25['push'](_0x51fd25['shift']());}};_0x4529ae(++_0x2fcbb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0x5fc3[_0x255ac0];return _0x437bf1;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x5b89d7,_0x9f55b0){var _0x320ac9=function(_0x3e7274){while(--_0x3e7274){_0x5b89d7['push'](_0x5b89d7['shift']());}};_0x320ac9(++_0x9f55b0);}(_0x7217,0x19e));var _0x7721=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7217[_0x19e35c];return _0x3e1fe8;};'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')]('SquareOdbc,\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']('SquareOdbc,\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);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 3b8616f..17e68d2 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 _0xc8c2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','getUsers','post','create','/:id/users','addUsers','put','update','delete','removeUsers','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x390143,_0x2b54ac){var _0x11361b=function(_0x3666c3){while(--_0x3666c3){_0x390143['push'](_0x390143['shift']());}};_0x11361b(++_0x2b54ac);}(_0xc8c2,0xf4));var _0x2c8c=function(_0x5787fa,_0x2073d7){_0x5787fa=_0x5787fa-0x0;var _0x424173=_0xc8c2[_0x5787fa];return _0x424173;};'use strict';var multer=require(_0x2c8c('0x0'));var util=require(_0x2c8c('0x1'));var path=require(_0x2c8c('0x2'));var timeout=require(_0x2c8c('0x3'));var express=require(_0x2c8c('0x4'));var router=express['Router']();var fs_extra=require(_0x2c8c('0x5'));var auth=require(_0x2c8c('0x6'));var interaction=require(_0x2c8c('0x7'));var config=require(_0x2c8c('0x8'));var controller=require(_0x2c8c('0x9'));router[_0x2c8c('0xa')]('/',auth[_0x2c8c('0xb')](),controller[_0x2c8c('0xc')]);router['get'](_0x2c8c('0xd'),auth[_0x2c8c('0xb')](),controller[_0x2c8c('0xe')]);router[_0x2c8c('0xa')]('/:id/users',auth[_0x2c8c('0xb')](),controller[_0x2c8c('0xf')]);router[_0x2c8c('0x10')]('/',auth[_0x2c8c('0xb')](),controller[_0x2c8c('0x11')]);router[_0x2c8c('0x10')](_0x2c8c('0x12'),auth[_0x2c8c('0xb')](),controller[_0x2c8c('0x13')]);router[_0x2c8c('0x14')](_0x2c8c('0xd'),auth['isAuthenticated'](),controller[_0x2c8c('0x15')]);router[_0x2c8c('0x16')](_0x2c8c('0xd'),auth[_0x2c8c('0xb')](),controller['destroy']);router[_0x2c8c('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x2c8c('0x17')]);module[_0x2c8c('0x18')]=router; \ No newline at end of file +var _0xa283=['../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/users','create','post','addUsers','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x105a8a,_0x15a3a2){var _0x105a0e=function(_0x3beeb1){while(--_0x3beeb1){_0x105a8a['push'](_0x105a8a['shift']());}};_0x105a0e(++_0x15a3a2);}(_0xa283,0x10a));var _0x3a28=function(_0x3ec6be,_0x29f162){_0x3ec6be=_0x3ec6be-0x0;var _0x1d8328=_0xa283[_0x3ec6be];return _0x1d8328;};'use strict';var multer=require(_0x3a28('0x0'));var util=require(_0x3a28('0x1'));var path=require(_0x3a28('0x2'));var timeout=require('connect-timeout');var express=require(_0x3a28('0x3'));var router=express[_0x3a28('0x4')]();var fs_extra=require(_0x3a28('0x5'));var auth=require(_0x3a28('0x6'));var interaction=require(_0x3a28('0x7'));var config=require(_0x3a28('0x8'));var controller=require('./squareProject.controller');router['get']('/',auth[_0x3a28('0x9')](),controller['index']);router[_0x3a28('0xa')](_0x3a28('0xb'),auth[_0x3a28('0x9')](),controller[_0x3a28('0xc')]);router[_0x3a28('0xa')](_0x3a28('0xd'),auth['isAuthenticated'](),controller['getUsers']);router['post']('/',auth[_0x3a28('0x9')](),controller[_0x3a28('0xe')]);router[_0x3a28('0xf')]('/:id/users',auth[_0x3a28('0x9')](),controller[_0x3a28('0x10')]);router[_0x3a28('0x11')](_0x3a28('0xb'),auth[_0x3a28('0x9')](),controller[_0x3a28('0x12')]);router[_0x3a28('0x13')]('/:id',auth[_0x3a28('0x9')](),controller['destroy']);router[_0x3a28('0x13')](_0x3a28('0xd'),auth[_0x3a28('0x9')](),controller['removeUsers']);module[_0x3a28('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index bb09c76..3e11a90 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 _0xe3da=['TEXT','BLOB','long','getDataValue','preproduction','utf8','production','DATE','sequelize','exports','name','STRING'];(function(_0x3aeb36,_0x312dc9){var _0xa2ef21=function(_0x50a46b){while(--_0x50a46b){_0x3aeb36['push'](_0x3aeb36['shift']());}};_0xa2ef21(++_0x312dc9);}(_0xe3da,0x1e8));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xae3d('0x0'));module[_0xae3d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xae3d('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xae3d('0x3')]},'notes':{'type':Sequelize[_0xae3d('0x4')]},'preproduction':{'type':Sequelize[_0xae3d('0x5')](_0xae3d('0x6')),'get':function(){if(this[_0xae3d('0x7')](_0xae3d('0x8'))){return this['getDataValue'](_0xae3d('0x8'))['toString'](_0xae3d('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0xae3d('0x6')),'get':function(){if(this[_0xae3d('0x7')](_0xae3d('0xa'))){return this['getDataValue'](_0xae3d('0xa'))['toString'](_0xae3d('0x9'));}}},'savedAt':{'type':Sequelize[_0xae3d('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x2d00=['utf8','production','DATE','exports','STRING','name','long','getDataValue','preproduction','toString'];(function(_0x296683,_0x4cf597){var _0x19848c=function(_0x5653be){while(--_0x5653be){_0x296683['push'](_0x296683['shift']());}};_0x19848c(++_0x4cf597);}(_0x2d00,0x139));var _0x02d0=function(_0xa27617,_0x47c5b3){_0xa27617=_0xa27617-0x0;var _0xf8b040=_0x2d00[_0xa27617];return _0xf8b040;};'use strict';var Sequelize=require('sequelize');module[_0x02d0('0x0')]={'name':{'type':Sequelize[_0x02d0('0x1')],'unique':_0x02d0('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x02d0('0x3')),'get':function(){if(this[_0x02d0('0x4')](_0x02d0('0x5'))){return this[_0x02d0('0x4')](_0x02d0('0x5'))[_0x02d0('0x6')](_0x02d0('0x7'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x02d0('0x4')]('production')){return this[_0x02d0('0x4')](_0x02d0('0x8'))[_0x02d0('0x6')](_0x02d0('0x7'));}}},'savedAt':{'type':Sequelize[_0x02d0('0x9')]},'publishedAt':{'type':Sequelize[_0x02d0('0x9')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 5d35099..6c62b5d 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 _0x4e33=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','params','ids','removeUsers','isArray','userSquareProject:remove','emit','findOne','User','order','getUsers','html-pdf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SquareProject','count','includeAll','include','rows','show','length','find','catch','create'];(function(_0x2544f9,_0x4f82c5){var _0x136492=function(_0x4ab946){while(--_0x4ab946){_0x2544f9['push'](_0x2544f9['shift']());}};_0x136492(++_0x4f82c5);}(_0x4e33,0x1eb));var _0x34e3=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x4e33[_0x19b84f];return _0x18067b;};'use strict';var pdf=require(_0x34e3('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x34e3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x34e3('0x2'));var moment=require(_0x34e3('0x3'));var BPromise=require(_0x34e3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x34e3('0x5'));var csv=require(_0x34e3('0x6'));var ejs=require(_0x34e3('0x7'));var fs=require('fs');var fs_extra=require(_0x34e3('0x8'));var _=require(_0x34e3('0x9'));var squel=require(_0x34e3('0xa'));var crypto=require('crypto');var jsforce=require(_0x34e3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x34e3('0xc'));var Papa=require(_0x34e3('0xd'));var Redis=require(_0x34e3('0xe'));var authService=require(_0x34e3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x34e3('0x10'));var hardwareService=require(_0x34e3('0x11'));var logger=require('../../config/logger')(_0x34e3('0x12'));var utils=require(_0x34e3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x34e3('0x14'));var db=require(_0x34e3('0x15'))['db'];config[_0x34e3('0x16')]=_[_0x34e3('0x17')](config[_0x34e3('0x16')],{'host':_0x34e3('0x18'),'port':0x18eb});var socket=require(_0x34e3('0x19'))(new Redis(config[_0x34e3('0x16')]));require(_0x34e3('0x1a'))[_0x34e3('0x1b')](socket);function respondWithStatusCode(_0x4b00b5,_0x44ea7f){_0x44ea7f=_0x44ea7f||0xcc;return function(_0x267256){if(_0x267256){return _0x4b00b5[_0x34e3('0x1c')](_0x44ea7f);}return _0x4b00b5[_0x34e3('0x1d')](_0x44ea7f)[_0x34e3('0x1e')]();};}function respondWithResult(_0x1c1368,_0x5c3537){_0x5c3537=_0x5c3537||0xc8;return function(_0xc3678){if(_0xc3678){return _0x1c1368['status'](_0x5c3537)[_0x34e3('0x1f')](_0xc3678);}};}function respondWithFilteredResult(_0x58ca4e,_0x26930b){return function(_0x28e4b6){if(_0x28e4b6){var _0x3c7315=_0x28e4b6['count'],_0x865b6f=_0x26930b[_0x34e3('0x20')],_0x44daae=_0x26930b['offset']+_0x26930b[_0x34e3('0x21')],_0x244485;if(_0x44daae>=_0x3c7315){_0x44daae=_0x3c7315;_0x244485=0xc8;}else{_0x244485=0xce;}_0x58ca4e[_0x34e3('0x1d')](_0x244485);return _0x58ca4e[_0x34e3('0x22')](_0x34e3('0x23'),_0x865b6f+'-'+_0x44daae+'/'+_0x3c7315)[_0x34e3('0x1f')](_0x28e4b6);}return null;};}function patchUpdates(_0x1c1a77){return function(_0x4a5698){try{jsonpatch[_0x34e3('0x24')](_0x4a5698,_0x1c1a77,!![]);}catch(_0x2ad4ca){return BPromise[_0x34e3('0x25')](_0x2ad4ca);}return _0x4a5698[_0x34e3('0x26')]();};}function saveUpdates(_0x5082e0,_0x1c2a57){return function(_0x578cd2){if(_0x578cd2){return _0x578cd2[_0x34e3('0x27')](_0x5082e0)[_0x34e3('0x28')](function(_0x16fd82){return _0x16fd82;});}return null;};}function removeEntity(_0x4851c4,_0x4a7854){return function(_0x422a88){if(_0x422a88){return _0x422a88[_0x34e3('0x29')]()[_0x34e3('0x28')](function(){var _0x5caeba=_0x422a88[_0x34e3('0x2a')]({'plain':!![]});var _0x577b1f=_0x34e3('0x2b');return db[_0x34e3('0x2c')][_0x34e3('0x29')]({'where':{'type':_0x577b1f,'resourceId':_0x5caeba['id']}})[_0x34e3('0x28')](function(){return _0x422a88;});})[_0x34e3('0x28')](function(){_0x4851c4[_0x34e3('0x1d')](0xcc)[_0x34e3('0x1e')]();});}};}function handleEntityNotFound(_0x1a4e7c,_0x3362d4){return function(_0x52dd33){if(!_0x52dd33){_0x1a4e7c['sendStatus'](0x194);}return _0x52dd33;};}function handleError(_0x1816bb,_0x414f9e){_0x414f9e=_0x414f9e||0x1f4;return function(_0x21055e){logger[_0x34e3('0x2d')](_0x21055e[_0x34e3('0x2e')]);if(_0x21055e[_0x34e3('0x2f')]){delete _0x21055e['name'];}_0x1816bb[_0x34e3('0x1d')](_0x414f9e)[_0x34e3('0x30')](_0x21055e);};}exports[_0x34e3('0x31')]=function(_0x549e94,_0x437860){var _0x44ccee={},_0x4b3deb={},_0x16552f={'count':0x0,'rows':[]};var _0xa77b58=_[_0x34e3('0x32')](db['SquareProject'][_0x34e3('0x33')],function(_0x1bf3f2){return{'name':_0x1bf3f2['fieldName'],'type':_0x1bf3f2[_0x34e3('0x34')]['key']};});_0x4b3deb[_0x34e3('0x35')]=_[_0x34e3('0x32')](_0xa77b58,'name');_0x4b3deb[_0x34e3('0x36')]=_[_0x34e3('0x37')](_0x549e94[_0x34e3('0x36')]);_0x4b3deb[_0x34e3('0x38')]=_['intersection'](_0x4b3deb[_0x34e3('0x35')],_0x4b3deb[_0x34e3('0x36')]);_0x44ccee[_0x34e3('0x39')]=_[_0x34e3('0x3a')](_0x4b3deb[_0x34e3('0x35')],qs[_0x34e3('0x3b')](_0x549e94[_0x34e3('0x36')]['fields']));_0x44ccee[_0x34e3('0x39')]=_0x44ccee[_0x34e3('0x39')]['length']?_0x44ccee[_0x34e3('0x39')]:_0x4b3deb[_0x34e3('0x35')];if(!_0x549e94[_0x34e3('0x36')][_0x34e3('0x3c')](_0x34e3('0x3d'))){_0x44ccee[_0x34e3('0x21')]=qs[_0x34e3('0x21')](_0x549e94[_0x34e3('0x36')][_0x34e3('0x21')]);_0x44ccee['offset']=qs['offset'](_0x549e94['query'][_0x34e3('0x20')]);}_0x44ccee['order']=qs[_0x34e3('0x3e')](_0x549e94[_0x34e3('0x36')]['sort']);_0x44ccee[_0x34e3('0x3f')]=qs[_0x34e3('0x38')](_[_0x34e3('0x40')](_0x549e94[_0x34e3('0x36')],_0x4b3deb[_0x34e3('0x38')]),_0xa77b58);if(_0x549e94['query'][_0x34e3('0x41')]){_0x44ccee[_0x34e3('0x3f')]=_[_0x34e3('0x42')](_0x44ccee['where'],{'$or':_['map'](_0xa77b58,function(_0x7aca78){if(_0x7aca78[_0x34e3('0x34')]!==_0x34e3('0x43')){var _0x2f1411={};_0x2f1411[_0x7aca78[_0x34e3('0x2f')]]={'$like':'%'+_0x549e94[_0x34e3('0x36')][_0x34e3('0x41')]+'%'};return _0x2f1411;}})});}_0x44ccee=_[_0x34e3('0x42')]({},_0x44ccee,_0x549e94[_0x34e3('0x44')]);var _0x5cf376={'where':_0x44ccee['where']};return db[_0x34e3('0x45')][_0x34e3('0x46')](_0x5cf376)['then'](function(_0x5d5f57){_0x16552f[_0x34e3('0x46')]=_0x5d5f57;if(_0x549e94[_0x34e3('0x36')][_0x34e3('0x47')]){_0x44ccee[_0x34e3('0x48')]=[{'all':!![]}];}return db[_0x34e3('0x45')]['findAll'](_0x44ccee);})['then'](function(_0x5106a6){_0x16552f[_0x34e3('0x49')]=_0x5106a6;return _0x16552f;})[_0x34e3('0x28')](respondWithFilteredResult(_0x437860,_0x44ccee))['catch'](handleError(_0x437860,null));};exports[_0x34e3('0x4a')]=function(_0x4af1c1,_0x441a03){var _0x31d4b6={'raw':![],'where':{'id':_0x4af1c1['params']['id']}},_0x339f48={};_0x339f48[_0x34e3('0x35')]=_[_0x34e3('0x37')](db['SquareProject'][_0x34e3('0x33')]);_0x339f48['query']=_['keys'](_0x4af1c1['query']);_0x339f48[_0x34e3('0x38')]=_[_0x34e3('0x3a')](_0x339f48[_0x34e3('0x35')],_0x339f48[_0x34e3('0x36')]);_0x31d4b6['attributes']=_[_0x34e3('0x3a')](_0x339f48[_0x34e3('0x35')],qs[_0x34e3('0x3b')](_0x4af1c1[_0x34e3('0x36')][_0x34e3('0x3b')]));_0x31d4b6['attributes']=_0x31d4b6[_0x34e3('0x39')][_0x34e3('0x4b')]?_0x31d4b6['attributes']:_0x339f48['model'];if(_0x4af1c1[_0x34e3('0x36')][_0x34e3('0x47')]){_0x31d4b6[_0x34e3('0x48')]=[{'all':!![]}];}_0x31d4b6=_[_0x34e3('0x42')]({},_0x31d4b6,_0x4af1c1[_0x34e3('0x44')]);return db[_0x34e3('0x45')][_0x34e3('0x4c')](_0x31d4b6)[_0x34e3('0x28')](handleEntityNotFound(_0x441a03,null))[_0x34e3('0x28')](respondWithResult(_0x441a03,null))[_0x34e3('0x4d')](handleError(_0x441a03,null));};exports['create']=function(_0x4b1fc5,_0x58c9cc){return db[_0x34e3('0x45')][_0x34e3('0x4e')](_0x4b1fc5['body'],{})[_0x34e3('0x28')](function(_0x45e77f){var _0xbb3889=_0x4b1fc5[_0x34e3('0x4f')]['get']({'plain':!![]});if(!_0xbb3889)throw new Error(_0x34e3('0x50'));if(_0xbb3889['role']==='user'){var _0x34bfcb=_0x45e77f[_0x34e3('0x2a')]({'plain':!![]});var _0x451480='SquareProjects';return db[_0x34e3('0x51')]['find']({'where':{'name':_0x451480,'userProfileId':_0xbb3889[_0x34e3('0x52')]},'raw':!![]})[_0x34e3('0x28')](function(_0x31eb30){if(_0x31eb30&&_0x31eb30[_0x34e3('0x53')]===0x0){return db[_0x34e3('0x2c')][_0x34e3('0x4e')]({'name':_0x34bfcb['name'],'resourceId':_0x34bfcb['id'],'type':_0x31eb30[_0x34e3('0x2f')],'sectionId':_0x31eb30['id']},{})['then'](function(){return _0x45e77f;});}else{return _0x45e77f;}})[_0x34e3('0x4d')](function(_0x22c3f8){logger[_0x34e3('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22c3f8);throw _0x22c3f8;});}return _0x45e77f;})[_0x34e3('0x28')](respondWithResult(_0x58c9cc,0xc9))[_0x34e3('0x4d')](handleError(_0x58c9cc,null));};exports['update']=function(_0x176478,_0x1d6044){if(_0x176478[_0x34e3('0x54')]['id']){delete _0x176478['body']['id'];}return db['SquareProject'][_0x34e3('0x4c')]({'where':{'id':_0x176478[_0x34e3('0x55')]['id']}})['then'](handleEntityNotFound(_0x1d6044,null))[_0x34e3('0x28')](saveUpdates(_0x176478['body'],null))[_0x34e3('0x28')](respondWithResult(_0x1d6044,null))[_0x34e3('0x4d')](handleError(_0x1d6044,null));};exports[_0x34e3('0x29')]=function(_0x1c4e24,_0x344254){return db[_0x34e3('0x45')][_0x34e3('0x4c')]({'where':{'id':_0x1c4e24[_0x34e3('0x55')]['id']}})[_0x34e3('0x28')](handleEntityNotFound(_0x344254,null))[_0x34e3('0x28')](removeEntity(_0x344254,null))[_0x34e3('0x4d')](handleError(_0x344254,null));};exports['addUsers']=function(_0x2a2a70,_0x892abf,_0x448b8e){return db[_0x34e3('0x45')][_0x34e3('0x4c')]({'where':{'id':_0x2a2a70[_0x34e3('0x55')]['id']}})[_0x34e3('0x28')](handleEntityNotFound(_0x892abf,null))['then'](function(_0x436b2f){if(_0x436b2f){return _0x436b2f['addUsers'](_0x2a2a70[_0x34e3('0x54')][_0x34e3('0x56')],_['omit'](_0x2a2a70[_0x34e3('0x54')],[_0x34e3('0x56'),'id'])||{});}})['then'](respondWithResult(_0x892abf,null))[_0x34e3('0x4d')](handleError(_0x892abf,null));};exports[_0x34e3('0x57')]=function(_0xe6ade3,_0x5ccc8c,_0x383532){return db[_0x34e3('0x45')][_0x34e3('0x4c')]({'where':{'id':_0xe6ade3[_0x34e3('0x55')]['id']}})[_0x34e3('0x28')](handleEntityNotFound(_0x5ccc8c,null))[_0x34e3('0x28')](function(_0x40c72c){if(_0x40c72c){return _0x40c72c[_0x34e3('0x57')](_0xe6ade3[_0x34e3('0x36')][_0x34e3('0x56')])[_0x34e3('0x28')](function(){if(_[_0x34e3('0x58')](_0xe6ade3[_0x34e3('0x36')][_0x34e3('0x56')])){for(var _0x381c83=0x0;_0x381c83<_0xe6ade3[_0x34e3('0x36')][_0x34e3('0x56')][_0x34e3('0x4b')];_0x381c83+=0x1){socket['emit'](_0x34e3('0x59'),{'UserId':Number(_0xe6ade3[_0x34e3('0x36')]['ids'][_0x381c83]),'SquareProjectId':Number(_0xe6ade3[_0x34e3('0x55')]['id'])});}}else{socket[_0x34e3('0x5a')](_0x34e3('0x59'),{'UserId':Number(_0xe6ade3[_0x34e3('0x36')]['ids']),'SquareProjectId':Number(_0xe6ade3[_0x34e3('0x55')]['id'])});}});}})[_0x34e3('0x28')](respondWithStatusCode(_0x5ccc8c,null))[_0x34e3('0x4d')](handleError(_0x5ccc8c,null));};exports['getUsers']=function(_0x4ff7c4,_0x217a94,_0x254747){var _0x3fcf8a={};var _0xb2867f={};var _0x35e3b7;var _0x2b96fa;return db[_0x34e3('0x45')][_0x34e3('0x5b')]({'where':{'id':_0x4ff7c4[_0x34e3('0x55')]['id']}})[_0x34e3('0x28')](handleEntityNotFound(_0x217a94,null))[_0x34e3('0x28')](function(_0x1288fa){if(_0x1288fa){_0x35e3b7=_0x1288fa;_0xb2867f['model']=_[_0x34e3('0x37')](db[_0x34e3('0x5c')]['rawAttributes']);_0xb2867f[_0x34e3('0x36')]=_[_0x34e3('0x37')](_0x4ff7c4[_0x34e3('0x36')]);_0xb2867f[_0x34e3('0x38')]=_['intersection'](_0xb2867f[_0x34e3('0x35')],_0xb2867f['query']);_0x3fcf8a[_0x34e3('0x39')]=_['intersection'](_0xb2867f[_0x34e3('0x35')],qs[_0x34e3('0x3b')](_0x4ff7c4['query']['fields']));_0x3fcf8a[_0x34e3('0x39')]=_0x3fcf8a[_0x34e3('0x39')][_0x34e3('0x4b')]?_0x3fcf8a[_0x34e3('0x39')]:_0xb2867f[_0x34e3('0x35')];_0x3fcf8a[_0x34e3('0x5d')]=qs['sort'](_0x4ff7c4[_0x34e3('0x36')][_0x34e3('0x3e')]);_0x3fcf8a[_0x34e3('0x3f')]=qs['filters'](_[_0x34e3('0x40')](_0x4ff7c4[_0x34e3('0x36')],_0xb2867f[_0x34e3('0x38')]));if(_0x4ff7c4['query']['filter']){_0x3fcf8a[_0x34e3('0x3f')]=_['merge'](_0x3fcf8a[_0x34e3('0x3f')],{'$or':_[_0x34e3('0x32')](_0x3fcf8a[_0x34e3('0x39')],function(_0x47ae88){var _0x505d53={};_0x505d53[_0x47ae88]={'$like':'%'+_0x4ff7c4[_0x34e3('0x36')]['filter']+'%'};return _0x505d53;})});}_0x3fcf8a=_[_0x34e3('0x42')]({},_0x3fcf8a,_0x4ff7c4[_0x34e3('0x44')]);return _0x35e3b7[_0x34e3('0x5e')](_0x3fcf8a);}})[_0x34e3('0x28')](function(_0x1faa5b){if(_0x1faa5b){_0x2b96fa=_0x1faa5b[_0x34e3('0x4b')];if(!_0x4ff7c4[_0x34e3('0x36')][_0x34e3('0x3c')]('nolimit')){_0x3fcf8a[_0x34e3('0x21')]=qs['limit'](_0x4ff7c4[_0x34e3('0x36')]['limit']);_0x3fcf8a[_0x34e3('0x20')]=qs['offset'](_0x4ff7c4[_0x34e3('0x36')][_0x34e3('0x20')]);}return _0x35e3b7['getUsers'](_0x3fcf8a);}})[_0x34e3('0x28')](function(_0x1d7bf3){if(_0x1d7bf3){return _0x1d7bf3?{'count':_0x2b96fa,'rows':_0x1d7bf3}:null;}})[_0x34e3('0x28')](respondWithResult(_0x217a94,null))[_0x34e3('0x4d')](handleError(_0x217a94,null));}; \ No newline at end of file +var _0xcaa1=['pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','omit','removeUsers','isArray','emit','getUsers','findOne','User','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','./squareProject.socket','register','sendStatus','status','end','count','limit','Content-Range','json','reject','save','then','destroy','SquareProjects','UserProfileResource','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','offset','order','sort','where'];(function(_0x3c065a,_0x90a342){var _0x30e680=function(_0x188477){while(--_0x188477){_0x3c065a['push'](_0x3c065a['shift']());}};_0x30e680(++_0x90a342);}(_0xcaa1,0x19d));var _0x1caa=function(_0x498748,_0xdf79e1){_0x498748=_0x498748-0x0;var _0x5b5882=_0xcaa1[_0x498748];return _0x5b5882;};'use strict';var pdf=require(_0x1caa('0x0'));var emlformat=require(_0x1caa('0x1'));var rimraf=require(_0x1caa('0x2'));var zipdir=require(_0x1caa('0x3'));var jsonpatch=require(_0x1caa('0x4'));var rp=require(_0x1caa('0x5'));var moment=require(_0x1caa('0x6'));var BPromise=require(_0x1caa('0x7'));var Mustache=require(_0x1caa('0x8'));var util=require(_0x1caa('0x9'));var path=require(_0x1caa('0xa'));var sox=require(_0x1caa('0xb'));var csv=require(_0x1caa('0xc'));var ejs=require(_0x1caa('0xd'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1caa('0xe'));var crypto=require('crypto');var jsforce=require(_0x1caa('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1caa('0xc'));var querystring=require('querystring');var Papa=require(_0x1caa('0x10'));var Redis=require(_0x1caa('0x11'));var authService=require(_0x1caa('0x12'));var qs=require(_0x1caa('0x13'));var as=require(_0x1caa('0x14'));var hardwareService=require(_0x1caa('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x1caa('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1caa('0x17'));var db=require(_0x1caa('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1caa('0x19')]));require(_0x1caa('0x1a'))[_0x1caa('0x1b')](socket);function respondWithStatusCode(_0x2b6734,_0x3e54e6){_0x3e54e6=_0x3e54e6||0xcc;return function(_0x89397d){if(_0x89397d){return _0x2b6734[_0x1caa('0x1c')](_0x3e54e6);}return _0x2b6734[_0x1caa('0x1d')](_0x3e54e6)[_0x1caa('0x1e')]();};}function respondWithResult(_0x22a67d,_0x1753dd){_0x1753dd=_0x1753dd||0xc8;return function(_0x3f568e){if(_0x3f568e){return _0x22a67d[_0x1caa('0x1d')](_0x1753dd)['json'](_0x3f568e);}};}function respondWithFilteredResult(_0x3606e0,_0x14d0c9){return function(_0x59f1af){if(_0x59f1af){var _0x348126=_0x59f1af[_0x1caa('0x1f')],_0x3def87=_0x14d0c9['offset'],_0x3494c4=_0x14d0c9['offset']+_0x14d0c9[_0x1caa('0x20')],_0x27f36f;if(_0x3494c4>=_0x348126){_0x3494c4=_0x348126;_0x27f36f=0xc8;}else{_0x27f36f=0xce;}_0x3606e0['status'](_0x27f36f);return _0x3606e0['set'](_0x1caa('0x21'),_0x3def87+'-'+_0x3494c4+'/'+_0x348126)[_0x1caa('0x22')](_0x59f1af);}return null;};}function patchUpdates(_0x21f22c){return function(_0x2e093f){try{jsonpatch['apply'](_0x2e093f,_0x21f22c,!![]);}catch(_0x3a5017){return BPromise[_0x1caa('0x23')](_0x3a5017);}return _0x2e093f[_0x1caa('0x24')]();};}function saveUpdates(_0x4366be,_0x3074b1){return function(_0xae372){if(_0xae372){return _0xae372['update'](_0x4366be)[_0x1caa('0x25')](function(_0x32c6b2){return _0x32c6b2;});}return null;};}function removeEntity(_0x4d6b54,_0xdd92e2){return function(_0xbaa704){if(_0xbaa704){return _0xbaa704[_0x1caa('0x26')]()[_0x1caa('0x25')](function(){var _0x13a34c=_0xbaa704['get']({'plain':!![]});var _0x2c0933=_0x1caa('0x27');return db[_0x1caa('0x28')][_0x1caa('0x26')]({'where':{'type':_0x2c0933,'resourceId':_0x13a34c['id']}})['then'](function(){return _0xbaa704;});})[_0x1caa('0x25')](function(){_0x4d6b54[_0x1caa('0x1d')](0xcc)[_0x1caa('0x1e')]();});}};}function handleEntityNotFound(_0x4b2dfc,_0x519bba){return function(_0xb32235){if(!_0xb32235){_0x4b2dfc['sendStatus'](0x194);}return _0xb32235;};}function handleError(_0x35f842,_0x497c78){_0x497c78=_0x497c78||0x1f4;return function(_0x50ea0b){logger[_0x1caa('0x29')](_0x50ea0b[_0x1caa('0x2a')]);if(_0x50ea0b[_0x1caa('0x2b')]){delete _0x50ea0b[_0x1caa('0x2b')];}_0x35f842[_0x1caa('0x1d')](_0x497c78)[_0x1caa('0x2c')](_0x50ea0b);};}exports[_0x1caa('0x2d')]=function(_0x2cb781,_0xa3d05c){var _0xa05682={},_0x3d94f1={},_0x480ced={'count':0x0,'rows':[]};var _0x53db2d=_['map'](db[_0x1caa('0x2e')][_0x1caa('0x2f')],function(_0x5d023b){return{'name':_0x5d023b[_0x1caa('0x30')],'type':_0x5d023b[_0x1caa('0x31')]['key']};});_0x3d94f1[_0x1caa('0x32')]=_[_0x1caa('0x33')](_0x53db2d,_0x1caa('0x2b'));_0x3d94f1[_0x1caa('0x34')]=_[_0x1caa('0x35')](_0x2cb781[_0x1caa('0x34')]);_0x3d94f1[_0x1caa('0x36')]=_[_0x1caa('0x37')](_0x3d94f1[_0x1caa('0x32')],_0x3d94f1[_0x1caa('0x34')]);_0xa05682['attributes']=_[_0x1caa('0x37')](_0x3d94f1[_0x1caa('0x32')],qs[_0x1caa('0x38')](_0x2cb781[_0x1caa('0x34')][_0x1caa('0x38')]));_0xa05682[_0x1caa('0x39')]=_0xa05682[_0x1caa('0x39')]['length']?_0xa05682[_0x1caa('0x39')]:_0x3d94f1['model'];if(!_0x2cb781[_0x1caa('0x34')]['hasOwnProperty']('nolimit')){_0xa05682[_0x1caa('0x20')]=qs[_0x1caa('0x20')](_0x2cb781[_0x1caa('0x34')]['limit']);_0xa05682[_0x1caa('0x3a')]=qs[_0x1caa('0x3a')](_0x2cb781[_0x1caa('0x34')][_0x1caa('0x3a')]);}_0xa05682[_0x1caa('0x3b')]=qs['sort'](_0x2cb781[_0x1caa('0x34')][_0x1caa('0x3c')]);_0xa05682[_0x1caa('0x3d')]=qs[_0x1caa('0x36')](_[_0x1caa('0x3e')](_0x2cb781[_0x1caa('0x34')],_0x3d94f1[_0x1caa('0x36')]),_0x53db2d);if(_0x2cb781[_0x1caa('0x34')][_0x1caa('0x3f')]){_0xa05682[_0x1caa('0x3d')]=_[_0x1caa('0x40')](_0xa05682[_0x1caa('0x3d')],{'$or':_[_0x1caa('0x33')](_0x53db2d,function(_0x4e3441){if(_0x4e3441[_0x1caa('0x31')]!==_0x1caa('0x41')){var _0x3c9f3c={};_0x3c9f3c[_0x4e3441['name']]={'$like':'%'+_0x2cb781[_0x1caa('0x34')][_0x1caa('0x3f')]+'%'};return _0x3c9f3c;}})});}_0xa05682=_[_0x1caa('0x40')]({},_0xa05682,_0x2cb781[_0x1caa('0x42')]);var _0x5ec47d={'where':_0xa05682[_0x1caa('0x3d')]};return db[_0x1caa('0x2e')][_0x1caa('0x1f')](_0x5ec47d)['then'](function(_0x53bff6){_0x480ced[_0x1caa('0x1f')]=_0x53bff6;if(_0x2cb781[_0x1caa('0x34')]['includeAll']){_0xa05682[_0x1caa('0x43')]=[{'all':!![]}];}return db[_0x1caa('0x2e')][_0x1caa('0x44')](_0xa05682);})[_0x1caa('0x25')](function(_0x65a99f){_0x480ced[_0x1caa('0x45')]=_0x65a99f;return _0x480ced;})[_0x1caa('0x25')](respondWithFilteredResult(_0xa3d05c,_0xa05682))[_0x1caa('0x46')](handleError(_0xa3d05c,null));};exports['show']=function(_0x2dfbb3,_0x3aebd3){var _0x4d1ad5={'raw':![],'where':{'id':_0x2dfbb3[_0x1caa('0x47')]['id']}},_0x3e1545={};_0x3e1545['model']=_['keys'](db['SquareProject'][_0x1caa('0x2f')]);_0x3e1545[_0x1caa('0x34')]=_['keys'](_0x2dfbb3[_0x1caa('0x34')]);_0x3e1545[_0x1caa('0x36')]=_[_0x1caa('0x37')](_0x3e1545['model'],_0x3e1545['query']);_0x4d1ad5[_0x1caa('0x39')]=_[_0x1caa('0x37')](_0x3e1545[_0x1caa('0x32')],qs['fields'](_0x2dfbb3[_0x1caa('0x34')][_0x1caa('0x38')]));_0x4d1ad5[_0x1caa('0x39')]=_0x4d1ad5[_0x1caa('0x39')][_0x1caa('0x48')]?_0x4d1ad5[_0x1caa('0x39')]:_0x3e1545[_0x1caa('0x32')];if(_0x2dfbb3[_0x1caa('0x34')][_0x1caa('0x49')]){_0x4d1ad5[_0x1caa('0x43')]=[{'all':!![]}];}_0x4d1ad5=_[_0x1caa('0x40')]({},_0x4d1ad5,_0x2dfbb3[_0x1caa('0x42')]);return db[_0x1caa('0x2e')]['find'](_0x4d1ad5)[_0x1caa('0x25')](handleEntityNotFound(_0x3aebd3,null))['then'](respondWithResult(_0x3aebd3,null))[_0x1caa('0x46')](handleError(_0x3aebd3,null));};exports['create']=function(_0x16c1c2,_0x52a344){return db['SquareProject'][_0x1caa('0x4a')](_0x16c1c2[_0x1caa('0x4b')],{})[_0x1caa('0x25')](function(_0x179a85){var _0x1f3db3=_0x16c1c2[_0x1caa('0x4c')]['get']({'plain':!![]});if(!_0x1f3db3)throw new Error(_0x1caa('0x4d'));if(_0x1f3db3[_0x1caa('0x4e')]==='user'){var _0x4004b8=_0x179a85[_0x1caa('0x4f')]({'plain':!![]});var _0x2519d5=_0x1caa('0x27');return db['UserProfileSection'][_0x1caa('0x50')]({'where':{'name':_0x2519d5,'userProfileId':_0x1f3db3['userProfileId']},'raw':!![]})[_0x1caa('0x25')](function(_0x12f075){if(_0x12f075&&_0x12f075[_0x1caa('0x51')]===0x0){return db[_0x1caa('0x28')][_0x1caa('0x4a')]({'name':_0x4004b8[_0x1caa('0x2b')],'resourceId':_0x4004b8['id'],'type':_0x12f075[_0x1caa('0x2b')],'sectionId':_0x12f075['id']},{})[_0x1caa('0x25')](function(){return _0x179a85;});}else{return _0x179a85;}})[_0x1caa('0x46')](function(_0x554263){logger[_0x1caa('0x29')](_0x1caa('0x52'),_0x554263);throw _0x554263;});}return _0x179a85;})[_0x1caa('0x25')](respondWithResult(_0x52a344,0xc9))[_0x1caa('0x46')](handleError(_0x52a344,null));};exports[_0x1caa('0x53')]=function(_0x221134,_0x57ac74){if(_0x221134[_0x1caa('0x4b')]['id']){delete _0x221134['body']['id'];}return db[_0x1caa('0x2e')][_0x1caa('0x50')]({'where':{'id':_0x221134[_0x1caa('0x47')]['id']}})['then'](handleEntityNotFound(_0x57ac74,null))[_0x1caa('0x25')](saveUpdates(_0x221134[_0x1caa('0x4b')],null))[_0x1caa('0x25')](respondWithResult(_0x57ac74,null))[_0x1caa('0x46')](handleError(_0x57ac74,null));};exports['destroy']=function(_0x3d8d4d,_0x3456b5){return db['SquareProject'][_0x1caa('0x50')]({'where':{'id':_0x3d8d4d['params']['id']}})[_0x1caa('0x25')](handleEntityNotFound(_0x3456b5,null))[_0x1caa('0x25')](removeEntity(_0x3456b5,null))[_0x1caa('0x46')](handleError(_0x3456b5,null));};exports['addUsers']=function(_0x2dbdda,_0x29601c,_0x472df7){return db[_0x1caa('0x2e')][_0x1caa('0x50')]({'where':{'id':_0x2dbdda[_0x1caa('0x47')]['id']}})[_0x1caa('0x25')](handleEntityNotFound(_0x29601c,null))[_0x1caa('0x25')](function(_0x5ad85e){if(_0x5ad85e){return _0x5ad85e[_0x1caa('0x54')](_0x2dbdda[_0x1caa('0x4b')][_0x1caa('0x55')],_[_0x1caa('0x56')](_0x2dbdda[_0x1caa('0x4b')],['ids','id'])||{});}})[_0x1caa('0x25')](respondWithResult(_0x29601c,null))[_0x1caa('0x46')](handleError(_0x29601c,null));};exports[_0x1caa('0x57')]=function(_0x27591b,_0x313e6e,_0x3b262a){return db[_0x1caa('0x2e')]['find']({'where':{'id':_0x27591b['params']['id']}})[_0x1caa('0x25')](handleEntityNotFound(_0x313e6e,null))[_0x1caa('0x25')](function(_0x11c9bb){if(_0x11c9bb){return _0x11c9bb[_0x1caa('0x57')](_0x27591b[_0x1caa('0x34')][_0x1caa('0x55')])[_0x1caa('0x25')](function(){if(_[_0x1caa('0x58')](_0x27591b[_0x1caa('0x34')][_0x1caa('0x55')])){for(var _0x2a56c1=0x0;_0x2a56c1<_0x27591b[_0x1caa('0x34')][_0x1caa('0x55')]['length'];_0x2a56c1+=0x1){socket[_0x1caa('0x59')]('userSquareProject:remove',{'UserId':Number(_0x27591b[_0x1caa('0x34')][_0x1caa('0x55')][_0x2a56c1]),'SquareProjectId':Number(_0x27591b[_0x1caa('0x47')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x27591b[_0x1caa('0x34')][_0x1caa('0x55')]),'SquareProjectId':Number(_0x27591b['params']['id'])});}});}})[_0x1caa('0x25')](respondWithStatusCode(_0x313e6e,null))[_0x1caa('0x46')](handleError(_0x313e6e,null));};exports[_0x1caa('0x5a')]=function(_0x465aa2,_0x3c61f8,_0x414c3e){var _0x2a6d77={};var _0x3353f6={};var _0x4d6b9b;var _0x2e7389;return db['SquareProject'][_0x1caa('0x5b')]({'where':{'id':_0x465aa2[_0x1caa('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c61f8,null))[_0x1caa('0x25')](function(_0x47d7ff){if(_0x47d7ff){_0x4d6b9b=_0x47d7ff;_0x3353f6['model']=_['keys'](db[_0x1caa('0x5c')]['rawAttributes']);_0x3353f6[_0x1caa('0x34')]=_[_0x1caa('0x35')](_0x465aa2[_0x1caa('0x34')]);_0x3353f6[_0x1caa('0x36')]=_[_0x1caa('0x37')](_0x3353f6['model'],_0x3353f6[_0x1caa('0x34')]);_0x2a6d77[_0x1caa('0x39')]=_[_0x1caa('0x37')](_0x3353f6[_0x1caa('0x32')],qs[_0x1caa('0x38')](_0x465aa2['query'][_0x1caa('0x38')]));_0x2a6d77[_0x1caa('0x39')]=_0x2a6d77[_0x1caa('0x39')][_0x1caa('0x48')]?_0x2a6d77[_0x1caa('0x39')]:_0x3353f6[_0x1caa('0x32')];_0x2a6d77['order']=qs[_0x1caa('0x3c')](_0x465aa2[_0x1caa('0x34')][_0x1caa('0x3c')]);_0x2a6d77['where']=qs[_0x1caa('0x36')](_[_0x1caa('0x3e')](_0x465aa2['query'],_0x3353f6[_0x1caa('0x36')]));if(_0x465aa2['query']['filter']){_0x2a6d77[_0x1caa('0x3d')]=_[_0x1caa('0x40')](_0x2a6d77['where'],{'$or':_['map'](_0x2a6d77[_0x1caa('0x39')],function(_0xd99f22){var _0x53b264={};_0x53b264[_0xd99f22]={'$like':'%'+_0x465aa2[_0x1caa('0x34')][_0x1caa('0x3f')]+'%'};return _0x53b264;})});}_0x2a6d77=_[_0x1caa('0x40')]({},_0x2a6d77,_0x465aa2[_0x1caa('0x42')]);return _0x4d6b9b[_0x1caa('0x5a')](_0x2a6d77);}})[_0x1caa('0x25')](function(_0x37d132){if(_0x37d132){_0x2e7389=_0x37d132[_0x1caa('0x48')];if(!_0x465aa2[_0x1caa('0x34')][_0x1caa('0x5d')](_0x1caa('0x5e'))){_0x2a6d77[_0x1caa('0x20')]=qs[_0x1caa('0x20')](_0x465aa2[_0x1caa('0x34')]['limit']);_0x2a6d77[_0x1caa('0x3a')]=qs[_0x1caa('0x3a')](_0x465aa2[_0x1caa('0x34')]['offset']);}return _0x4d6b9b[_0x1caa('0x5a')](_0x2a6d77);}})['then'](function(_0x3f5abb){if(_0x3f5abb){return _0x3f5abb?{'count':_0x2e7389,'rows':_0x3f5abb}:null;}})[_0x1caa('0x25')](respondWithResult(_0x3c61f8,null))[_0x1caa('0x46')](handleError(_0x3c61f8,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 9bcce0f..7697b2d 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 _0x1cf4=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x1cf4,0xbf));var _0x41cf=function(_0x3aee2e,_0xf3d800){_0x3aee2e=_0x3aee2e-0x0;var _0x836df3=_0x1cf4[_0x3aee2e];return _0x836df3;};'use strict';var EventEmitter=require(_0x41cf('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x41cf('0x1')](0x0);var events={'afterCreate':_0x41cf('0x2'),'afterUpdate':'update','afterDestroy':_0x41cf('0x3')};function emitEvent(_0x2308e9){return function(_0x446a26,_0x32902d,_0x29b5da){SquareProjectEvents[_0x41cf('0x4')](_0x2308e9+':'+_0x446a26['id'],_0x446a26);SquareProjectEvents[_0x41cf('0x4')](_0x2308e9,_0x446a26);_0x29b5da(null);};}for(var e in events){if(events[_0x41cf('0x5')](e)){var event=events[e];SquareProject[_0x41cf('0x6')](e,emitEvent(event));}}module[_0x41cf('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xadec=['events','../../mysqldb','SquareProject','setMaxListeners','save','exports'];(function(_0x4bad60,_0x12f886){var _0x2d6291=function(_0x40f495){while(--_0x40f495){_0x4bad60['push'](_0x4bad60['shift']());}};_0x2d6291(++_0x12f886);}(_0xadec,0x156));var _0xcade=function(_0x409f0b,_0x44c9d6){_0x409f0b=_0x409f0b-0x0;var _0x52cd59=_0xadec[_0x409f0b];return _0x52cd59;};'use strict';var EventEmitter=require(_0xcade('0x0'));var SquareProject=require(_0xcade('0x1'))['db'][_0xcade('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xcade('0x3')](0x0);var events={'afterCreate':_0xcade('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x570d9c){return function(_0x475533,_0x875b81,_0xc0b40e){SquareProjectEvents['emit'](_0x570d9c+':'+_0x475533['id'],_0x475533);SquareProjectEvents['emit'](_0x570d9c,_0x475533);_0xc0b40e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xcade('0x5')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index b9f0042..ad87e56 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 _0x919e=['rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','format','lodash','util','../../config/logger','moment','path'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe919('0x0'));var util=require(_0xe919('0x1'));var logger=require(_0xe919('0x2'))('api');var moment=require(_0xe919('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe919('0x4'));var rimraf=require(_0xe919('0x5'));var config=require(_0xe919('0x6'));var attributes=require(_0xe919('0x7'));module[_0xe919('0x8')]=function(_0x5a27ad,_0x1225a5){return _0x5a27ad['define'](_0xe919('0x9'),attributes,{'tableName':_0xe919('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57c3fe,_0x44d418,_0x5c4129){if(_0x57c3fe[_0xe919('0xb')](_0xe919('0xc'))){_0x57c3fe[_0xe919('0xd')]=moment()['format'](_0xe919('0xe'));}if(_0x57c3fe[_0xe919('0xb')](_0xe919('0xf'))){_0x57c3fe['publishedAt']=moment()[_0xe919('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5c4129(null,_0x57c3fe);}}});}; \ No newline at end of file +var _0x6aa7=['production','publishedAt','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','SquareProject','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6aa7,0x178));var _0x76aa=function(_0x5d1303,_0x476804){_0x5d1303=_0x5d1303-0x0;var _0x3a4722=_0x6aa7[_0x5d1303];return _0x3a4722;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x56d6bc,_0x3dae33,_0x266bd5){if(_0x56d6bc[_0x76aa('0xb')]('preproduction')){_0x56d6bc[_0x76aa('0xc')]=moment()[_0x76aa('0xd')](_0x76aa('0xe'));}if(_0x56d6bc[_0x76aa('0xb')](_0x76aa('0xf'))){_0x56d6bc[_0x76aa('0x10')]=moment()[_0x76aa('0xd')](_0x76aa('0xe'));}_0x266bd5(null,_0x56d6bc);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 3a3b9e1..2f037a9 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 _0x6c86=['ShowSquareProject','SquareProject','find','options','where','include','map','model','attributes','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x56ecda,_0x1a6b83){var _0x28ce71=function(_0x10e4d0){while(--_0x10e4d0){_0x56ecda['push'](_0x56ecda['shift']());}};_0x28ce71(++_0x1a6b83);}(_0x6c86,0x186));var _0x66c8=function(_0x13a8d6,_0x4e8ec9){_0x13a8d6=_0x13a8d6-0x0;var _0x23fed9=_0x6c86[_0x13a8d6];return _0x23fed9;};'use strict';var _=require(_0x66c8('0x0'));var util=require(_0x66c8('0x1'));var moment=require(_0x66c8('0x2'));var BPromise=require(_0x66c8('0x3'));var rs=require(_0x66c8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x66c8('0x5'));var logger=require(_0x66c8('0x6'))(_0x66c8('0x7'));var config=require(_0x66c8('0x8'));var jayson=require(_0x66c8('0x9'));var client=jayson[_0x66c8('0xa')][_0x66c8('0xb')]({'port':0x232a});config[_0x66c8('0xc')]=_[_0x66c8('0xd')](config[_0x66c8('0xc')],{'host':_0x66c8('0xe'),'port':0x18eb});var socket=require(_0x66c8('0xf'))(new Redis(config[_0x66c8('0xc')]));require('./squareProject.socket')[_0x66c8('0x10')](socket);function respondWithRpcPromise(_0x389a98,_0x2caee6,_0x41c4e4){return new BPromise(function(_0x174b3b,_0x13a76d){return client[_0x66c8('0x11')](_0x389a98,_0x41c4e4)['then'](function(_0x44ae78){logger['info'](_0x66c8('0x12'),_0x2caee6,_0x66c8('0x13'));logger[_0x66c8('0x14')](_0x66c8('0x15'),_0x2caee6,_0x66c8('0x13'),JSON['stringify'](_0x44ae78));if(_0x44ae78[_0x66c8('0x16')]){if(_0x44ae78[_0x66c8('0x16')][_0x66c8('0x17')]===0x1f4){logger[_0x66c8('0x16')](_0x66c8('0x12'),_0x2caee6,_0x44ae78[_0x66c8('0x16')][_0x66c8('0x18')]);return _0x13a76d(_0x44ae78[_0x66c8('0x16')][_0x66c8('0x18')]);}logger[_0x66c8('0x16')]('SquareProject,\x20%s,\x20%s',_0x2caee6,_0x44ae78[_0x66c8('0x16')]['message']);return _0x174b3b(_0x44ae78[_0x66c8('0x16')][_0x66c8('0x18')]);}else{logger[_0x66c8('0x19')]('SquareProject,\x20%s,\x20%s',_0x2caee6,_0x66c8('0x13'));_0x174b3b(_0x44ae78[_0x66c8('0x1a')][_0x66c8('0x18')]);}})[_0x66c8('0x1b')](function(_0x3df630){logger[_0x66c8('0x16')](_0x66c8('0x12'),_0x2caee6,_0x3df630);_0x13a76d(_0x3df630);});});}exports[_0x66c8('0x1c')]=function(_0x2c85f1){var _0x3dc62c=this;return new Promise(function(_0x1f32ed,_0x2ae87b){return db[_0x66c8('0x1d')][_0x66c8('0x1e')]({'raw':_0x2c85f1['options']?_0x2c85f1[_0x66c8('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2c85f1['options']?_0x2c85f1['options'][_0x66c8('0x20')]||null:null,'attributes':_0x2c85f1['options']?_0x2c85f1['options']['attributes']||null:null,'include':_0x2c85f1[_0x66c8('0x1f')]?_0x2c85f1[_0x66c8('0x1f')][_0x66c8('0x21')]?_[_0x66c8('0x22')](_0x2c85f1['options'][_0x66c8('0x21')],function(_0xc533df){return{'model':db[_0xc533df[_0x66c8('0x23')]],'as':_0xc533df['as'],'attributes':_0xc533df[_0x66c8('0x24')],'include':_0xc533df['include']?_['map'](_0xc533df[_0x66c8('0x21')],function(_0x202d7b){return{'model':db[_0x202d7b[_0x66c8('0x23')]],'as':_0x202d7b['as'],'attributes':_0x202d7b[_0x66c8('0x24')],'include':_0x202d7b[_0x66c8('0x21')]?_['map'](_0x202d7b[_0x66c8('0x21')],function(_0x4b1571){return{'model':db[_0x4b1571[_0x66c8('0x23')]],'as':_0x4b1571['as'],'attributes':_0x4b1571['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d6f2c){logger[_0x66c8('0x19')]('ShowSquareProject',_0x2c85f1);logger[_0x66c8('0x14')](_0x66c8('0x1c'),_0x2c85f1,JSON[_0x66c8('0x25')](_0x4d6f2c));_0x1f32ed(_0x4d6f2c);})['catch'](function(_0x59b85f){logger[_0x66c8('0x16')]('ShowSquareProject',_0x59b85f[_0x66c8('0x18')],_0x2c85f1);_0x2ae87b(_0x3dc62c['error'](0x1f4,_0x59b85f[_0x66c8('0x18')]));});});}; \ No newline at end of file +var _0x1720=['SquareProject','options','raw','where','attributes','include','model','ShowSquareProject','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','redis','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x3bac2b,_0x137306){var _0xbadf45=function(_0xddb85a){while(--_0xddb85a){_0x3bac2b['push'](_0x3bac2b['shift']());}};_0xbadf45(++_0x137306);}(_0x1720,0xcf));var _0x0172=function(_0x465de3,_0x3f2055){_0x465de3=_0x465de3-0x0;var _0x5805a8=_0x1720[_0x465de3];return _0x5805a8;};'use strict';var _=require(_0x0172('0x0'));var util=require('util');var moment=require(_0x0172('0x1'));var BPromise=require(_0x0172('0x2'));var rs=require(_0x0172('0x3'));var fs=require('fs');var Redis=require(_0x0172('0x4'));var db=require(_0x0172('0x5'))['db'];var utils=require(_0x0172('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0172('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0172('0x8')]['http']({'port':0x232a});config[_0x0172('0x9')]=_['defaults'](config[_0x0172('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x0172('0xa'))(new Redis(config['redis']));require(_0x0172('0xb'))[_0x0172('0xc')](socket);function respondWithRpcPromise(_0x24b868,_0x9cad50,_0x415189){return new BPromise(function(_0x1aeaf5,_0x24ae3f){return client[_0x0172('0xd')](_0x24b868,_0x415189)[_0x0172('0xe')](function(_0x2989d2){logger[_0x0172('0xf')](_0x0172('0x10'),_0x9cad50,_0x0172('0x11'));logger[_0x0172('0x12')](_0x0172('0x13'),_0x9cad50,_0x0172('0x11'),JSON['stringify'](_0x2989d2));if(_0x2989d2[_0x0172('0x14')]){if(_0x2989d2[_0x0172('0x14')]['code']===0x1f4){logger['error'](_0x0172('0x10'),_0x9cad50,_0x2989d2[_0x0172('0x14')]['message']);return _0x24ae3f(_0x2989d2[_0x0172('0x14')][_0x0172('0x15')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0x9cad50,_0x2989d2[_0x0172('0x14')][_0x0172('0x15')]);return _0x1aeaf5(_0x2989d2['error']['message']);}else{logger[_0x0172('0xf')](_0x0172('0x10'),_0x9cad50,_0x0172('0x11'));_0x1aeaf5(_0x2989d2[_0x0172('0x16')]['message']);}})[_0x0172('0x17')](function(_0x308be9){logger['error'](_0x0172('0x10'),_0x9cad50,_0x308be9);_0x24ae3f(_0x308be9);});});}exports['ShowSquareProject']=function(_0x3d60b1){var _0x13727b=this;return new Promise(function(_0x238466,_0x2156c9){return db[_0x0172('0x18')]['find']({'raw':_0x3d60b1[_0x0172('0x19')]?_0x3d60b1[_0x0172('0x19')][_0x0172('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d60b1[_0x0172('0x19')]?_0x3d60b1[_0x0172('0x19')][_0x0172('0x1b')]||null:null,'attributes':_0x3d60b1['options']?_0x3d60b1[_0x0172('0x19')][_0x0172('0x1c')]||null:null,'include':_0x3d60b1[_0x0172('0x19')]?_0x3d60b1[_0x0172('0x19')]['include']?_['map'](_0x3d60b1['options'][_0x0172('0x1d')],function(_0x16a591){return{'model':db[_0x16a591['model']],'as':_0x16a591['as'],'attributes':_0x16a591[_0x0172('0x1c')],'include':_0x16a591[_0x0172('0x1d')]?_['map'](_0x16a591[_0x0172('0x1d')],function(_0x24a8e0){return{'model':db[_0x24a8e0[_0x0172('0x1e')]],'as':_0x24a8e0['as'],'attributes':_0x24a8e0['attributes'],'include':_0x24a8e0[_0x0172('0x1d')]?_['map'](_0x24a8e0[_0x0172('0x1d')],function(_0x50b326){return{'model':db[_0x50b326[_0x0172('0x1e')]],'as':_0x50b326['as'],'attributes':_0x50b326[_0x0172('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0172('0xe')](function(_0x39aad8){logger[_0x0172('0xf')](_0x0172('0x1f'),_0x3d60b1);logger[_0x0172('0x12')](_0x0172('0x1f'),_0x3d60b1,JSON[_0x0172('0x20')](_0x39aad8));_0x238466(_0x39aad8);})[_0x0172('0x17')](function(_0x2c1f38){logger[_0x0172('0x14')](_0x0172('0x1f'),_0x2c1f38[_0x0172('0x15')],_0x3d60b1);_0x2156c9(_0x13727b[_0x0172('0x14')](0x1f4,_0x2c1f38['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d5f16e2..5e664a2 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 _0x01d9=['./squareProject.events','save','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0xbb0f8e,_0x326a1b){var _0x2f0899=function(_0x5ab321){while(--_0x5ab321){_0xbb0f8e['push'](_0xbb0f8e['shift']());}};_0x2f0899(++_0x326a1b);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var SquareProjectEvents=require(_0x901d('0x0'));var events=[_0x901d('0x1'),_0x901d('0x2'),_0x901d('0x3')];function createListener(_0x521cc9,_0x2ce1fd){return function(_0x28bf48){_0x2ce1fd[_0x901d('0x4')](_0x521cc9,_0x28bf48);};}function removeListener(_0x8f7b4,_0x214f38){return function(){SquareProjectEvents[_0x901d('0x5')](_0x8f7b4,_0x214f38);};}exports[_0x901d('0x6')]=function(_0x4e7842){for(var _0x1e5d7d=0x0,_0x6c9ac8=events[_0x901d('0x7')];_0x1e5d7d<_0x6c9ac8;_0x1e5d7d++){var _0x12c39f=events[_0x1e5d7d];var _0x313f85=createListener(_0x901d('0x8')+_0x12c39f,_0x4e7842);SquareProjectEvents['on'](_0x12c39f,_0x313f85);}}; \ No newline at end of file +var _0x6d38=['removeListener','length','squareProject:','save','remove','update'];(function(_0x150cc4,_0x15e9f1){var _0x22a995=function(_0x114834){while(--_0x114834){_0x150cc4['push'](_0x150cc4['shift']());}};_0x22a995(++_0x15e9f1);}(_0x6d38,0x1ef));var _0x86d3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6d38[_0x19e35c];return _0x3e1fe8;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x86d3('0x0'),_0x86d3('0x1'),_0x86d3('0x2')];function createListener(_0x52d138,_0x5c0b77){return function(_0xd1c7c){_0x5c0b77['emit'](_0x52d138,_0xd1c7c);};}function removeListener(_0xe9198a,_0x455b9d){return function(){SquareProjectEvents[_0x86d3('0x3')](_0xe9198a,_0x455b9d);};}exports['register']=function(_0x2d8272){for(var _0xfbbc15=0x0,_0x33d4aa=events[_0x86d3('0x4')];_0xfbbc15<_0x33d4aa;_0xfbbc15++){var _0x47e654=events[_0xfbbc15];var _0x552b07=createListener(_0x86d3('0x5')+_0x47e654,_0x2d8272);SquareProjectEvents['on'](_0x47e654,_0x552b07);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 808e37c..55bb772 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 _0xd452=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/download','isAuthenticated','download','post','put','update','/:id/delete','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x580dc4,_0x4dddf4){var _0x144fd9=function(_0xac7188){while(--_0xac7188){_0x580dc4['push'](_0x580dc4['shift']());}};_0x144fd9(++_0x4dddf4);}(_0xd452,0x8e));var _0x2d45=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0xd452[_0x3861f7];return _0x50879f;};'use strict';var multer=require('multer');var util=require(_0x2d45('0x0'));var path=require('path');var timeout=require(_0x2d45('0x1'));var express=require(_0x2d45('0x2'));var router=express[_0x2d45('0x3')]();var fs_extra=require(_0x2d45('0x4'));var auth=require(_0x2d45('0x5'));var interaction=require(_0x2d45('0x6'));var config=require(_0x2d45('0x7'));var controller=require('./squareRecording.controller');router[_0x2d45('0x8')]('/',auth['isAuthenticated'](),controller[_0x2d45('0x9')]);router[_0x2d45('0x8')](_0x2d45('0xa'),auth['isAuthenticated'](),controller[_0x2d45('0xb')]);router['get'](_0x2d45('0xc'),auth[_0x2d45('0xd')](),controller[_0x2d45('0xe')]);router[_0x2d45('0xf')]('/',auth[_0x2d45('0xd')](),controller['create']);router[_0x2d45('0x10')](_0x2d45('0xa'),auth[_0x2d45('0xd')](),controller[_0x2d45('0x11')]);router['delete'](_0x2d45('0x12'),auth['isAuthenticated'](),controller[_0x2d45('0x13')]);module[_0x2d45('0x14')]=router; \ No newline at end of file +var _0xe1d8=['isAuthenticated','index','/:id','show','download','put','update','delete','/:id/delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x560c73,_0x298133){var _0x25a4a9=function(_0xdd1919){while(--_0xdd1919){_0x560c73['push'](_0x560c73['shift']());}};_0x25a4a9(++_0x298133);}(_0xe1d8,0x102));var _0x8e1d=function(_0x2ebd19,_0x4666e4){_0x2ebd19=_0x2ebd19-0x0;var _0x1ec212=_0xe1d8[_0x2ebd19];return _0x1ec212;};'use strict';var multer=require('multer');var util=require(_0x8e1d('0x0'));var path=require(_0x8e1d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8e1d('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8e1d('0x3'));var interaction=require(_0x8e1d('0x4'));var config=require(_0x8e1d('0x5'));var controller=require(_0x8e1d('0x6'));router[_0x8e1d('0x7')]('/',auth[_0x8e1d('0x8')](),controller[_0x8e1d('0x9')]);router['get'](_0x8e1d('0xa'),auth[_0x8e1d('0x8')](),controller[_0x8e1d('0xb')]);router['get']('/:id/download',auth[_0x8e1d('0x8')](),controller[_0x8e1d('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8e1d('0xd')](_0x8e1d('0xa'),auth[_0x8e1d('0x8')](),controller[_0x8e1d('0xe')]);router[_0x8e1d('0xf')](_0x8e1d('0x10'),auth[_0x8e1d('0x8')](),controller[_0x8e1d('0x11')]);module[_0x8e1d('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 33b993b..b33cef5 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 _0x8101=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x4c0699,_0x1f326d){var _0x472d6f=function(_0x2f88d3){while(--_0x2f88d3){_0x4c0699['push'](_0x4c0699['shift']());}};_0x472d6f(++_0x1f326d);}(_0x8101,0xc0));var _0x1810=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0x8101[_0x5d860f];return _0x236490;};'use strict';var Sequelize=require(_0x1810('0x0'));module[_0x1810('0x1')]={'uniqueid':{'type':Sequelize[_0x1810('0x2')]},'callerid':{'type':Sequelize[_0x1810('0x2')]},'calleridname':{'type':Sequelize[_0x1810('0x2')]},'context':{'type':Sequelize[_0x1810('0x2')]},'extension':{'type':Sequelize[_0x1810('0x2')]},'priority':{'type':Sequelize[_0x1810('0x2')]},'accountcode':{'type':Sequelize[_0x1810('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x1810('0x2')]},'filename':{'type':Sequelize[_0x1810('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1810('0x3')],'get':function(){var _0x44802e='';var _0x3f076f=this[_0x1810('0x4')](_0x1810('0x5'));if(_0x3f076f){_0x44802e=_0x3f076f[_0x1810('0x6')](_0x3f076f[_0x1810('0x7')]('.'));}return _0x44802e;}}}; \ No newline at end of file +var _0x06f8=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x37f2ac,_0x351772){var _0x58ca37=function(_0x3f7254){while(--_0x3f7254){_0x37f2ac['push'](_0x37f2ac['shift']());}};_0x58ca37(++_0x351772);}(_0x06f8,0x178));var _0x806f=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0x06f8[_0xa79977];return _0x109f10;};'use strict';var Sequelize=require(_0x806f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x806f('0x1')]},'callerid':{'type':Sequelize[_0x806f('0x1')]},'calleridname':{'type':Sequelize[_0x806f('0x1')]},'context':{'type':Sequelize[_0x806f('0x1')]},'extension':{'type':Sequelize[_0x806f('0x1')]},'priority':{'type':Sequelize[_0x806f('0x1')]},'accountcode':{'type':Sequelize[_0x806f('0x1')]},'dnid':{'type':Sequelize[_0x806f('0x1')]},'projectName':{'type':Sequelize[_0x806f('0x1')]},'saveName':{'type':Sequelize[_0x806f('0x1')]},'filename':{'type':Sequelize[_0x806f('0x1')]},'savePath':{'type':Sequelize[_0x806f('0x1')]},'format':{'type':Sequelize[_0x806f('0x2')],'get':function(){var _0xafd260='';var _0x15b400=this['getDataValue'](_0x806f('0x3'));if(_0x15b400){_0xafd260=_0x15b400[_0x806f('0x4')](_0x15b400[_0x806f('0x5')]('.'));}return _0xafd260;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 7d5f361..0af50a5 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 _0x9700=['../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','fields','find','catch','create','body','download'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9700,0x77));var _0x0970=function(_0x46df65,_0x4df43b){_0x46df65=_0x46df65-0x0;var _0x2a5a25=_0x9700[_0x46df65];return _0x2a5a25;};'use strict';var pdf=require(_0x0970('0x0'));var emlformat=require(_0x0970('0x1'));var rimraf=require(_0x0970('0x2'));var zipdir=require(_0x0970('0x3'));var jsonpatch=require(_0x0970('0x4'));var rp=require(_0x0970('0x5'));var moment=require(_0x0970('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0970('0x7'));var util=require(_0x0970('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0970('0x9'));var ejs=require(_0x0970('0xa'));var fs=require('fs');var fs_extra=require(_0x0970('0xb'));var _=require(_0x0970('0xc'));var squel=require(_0x0970('0xd'));var crypto=require('crypto');var jsforce=require(_0x0970('0xe'));var deskjs=require(_0x0970('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0970('0x10'));var Papa=require(_0x0970('0x11'));var Redis=require(_0x0970('0x12'));var authService=require(_0x0970('0x13'));var qs=require(_0x0970('0x14'));var as=require(_0x0970('0x15'));var hardwareService=require(_0x0970('0x16'));var logger=require(_0x0970('0x17'))('api');var utils=require(_0x0970('0x18'));var config=require(_0x0970('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0970('0x1a'))['db'];function respondWithStatusCode(_0x1846db,_0x3bf5a9){_0x3bf5a9=_0x3bf5a9||0xcc;return function(_0x11005a){if(_0x11005a){return _0x1846db[_0x0970('0x1b')](_0x3bf5a9);}return _0x1846db[_0x0970('0x1c')](_0x3bf5a9)[_0x0970('0x1d')]();};}function respondWithResult(_0x312086,_0x28162a){_0x28162a=_0x28162a||0xc8;return function(_0x3b6ebb){if(_0x3b6ebb){return _0x312086[_0x0970('0x1c')](_0x28162a)['json'](_0x3b6ebb);}};}function respondWithFilteredResult(_0x1d4985,_0x1a680e){return function(_0x3c931a){if(_0x3c931a){var _0x17e5d0=_0x3c931a[_0x0970('0x1e')],_0x41559=_0x1a680e['offset'],_0x32acf2=_0x1a680e[_0x0970('0x1f')]+_0x1a680e['limit'],_0x479d69;if(_0x32acf2>=_0x17e5d0){_0x32acf2=_0x17e5d0;_0x479d69=0xc8;}else{_0x479d69=0xce;}_0x1d4985[_0x0970('0x1c')](_0x479d69);return _0x1d4985[_0x0970('0x20')](_0x0970('0x21'),_0x41559+'-'+_0x32acf2+'/'+_0x17e5d0)[_0x0970('0x22')](_0x3c931a);}return null;};}function patchUpdates(_0x26a5e7){return function(_0xac5ea5){try{jsonpatch[_0x0970('0x23')](_0xac5ea5,_0x26a5e7,!![]);}catch(_0x888eaf){return BPromise[_0x0970('0x24')](_0x888eaf);}return _0xac5ea5[_0x0970('0x25')]();};}function saveUpdates(_0x128e74,_0x230c1e){return function(_0x4dbdd0){if(_0x4dbdd0){return _0x4dbdd0[_0x0970('0x26')](_0x128e74)[_0x0970('0x27')](function(_0x4a76dd){return _0x4a76dd;});}return null;};}function removeEntity(_0x28de87,_0x5137c7){return function(_0x56a66e){if(_0x56a66e){return _0x56a66e[_0x0970('0x28')]()[_0x0970('0x27')](function(){_0x28de87['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a2526,_0x5b41ac){return function(_0x611e28){if(!_0x611e28){_0x4a2526[_0x0970('0x1b')](0x194);}return _0x611e28;};}function handleError(_0x13c870,_0x33ff87){_0x33ff87=_0x33ff87||0x1f4;return function(_0x259d60){logger['error'](_0x259d60[_0x0970('0x29')]);if(_0x259d60[_0x0970('0x2a')]){delete _0x259d60['name'];}_0x13c870['status'](_0x33ff87)[_0x0970('0x2b')](_0x259d60);};}exports[_0x0970('0x2c')]=function(_0xf38957,_0x14a5c2){var _0x56eca6={},_0x7b3494={},_0x24aedf={'count':0x0,'rows':[]};var _0x3525e4=_['map'](db[_0x0970('0x2d')][_0x0970('0x2e')],function(_0xe5ab32){return{'name':_0xe5ab32[_0x0970('0x2f')],'type':_0xe5ab32[_0x0970('0x30')][_0x0970('0x31')]};});_0x7b3494[_0x0970('0x32')]=_[_0x0970('0x33')](_0x3525e4,'name');_0x7b3494[_0x0970('0x34')]=_['keys'](_0xf38957[_0x0970('0x34')]);_0x7b3494[_0x0970('0x35')]=_[_0x0970('0x36')](_0x7b3494[_0x0970('0x32')],_0x7b3494[_0x0970('0x34')]);_0x56eca6[_0x0970('0x37')]=_[_0x0970('0x36')](_0x7b3494[_0x0970('0x32')],qs['fields'](_0xf38957[_0x0970('0x34')]['fields']));_0x56eca6[_0x0970('0x37')]=_0x56eca6[_0x0970('0x37')][_0x0970('0x38')]?_0x56eca6['attributes']:_0x7b3494[_0x0970('0x32')];if(!_0xf38957['query']['hasOwnProperty'](_0x0970('0x39'))){_0x56eca6[_0x0970('0x3a')]=qs[_0x0970('0x3a')](_0xf38957[_0x0970('0x34')][_0x0970('0x3a')]);_0x56eca6[_0x0970('0x1f')]=qs['offset'](_0xf38957[_0x0970('0x34')][_0x0970('0x1f')]);}_0x56eca6['order']=qs['sort'](_0xf38957['query'][_0x0970('0x3b')]);_0x56eca6['where']=qs[_0x0970('0x35')](_[_0x0970('0x3c')](_0xf38957[_0x0970('0x34')],_0x7b3494[_0x0970('0x35')]),_0x3525e4);if(_0xf38957[_0x0970('0x34')][_0x0970('0x3d')]){_0x56eca6[_0x0970('0x3e')]=_[_0x0970('0x3f')](_0x56eca6[_0x0970('0x3e')],{'$or':_[_0x0970('0x33')](_0x3525e4,function(_0xce4a97){if(_0xce4a97['type']!==_0x0970('0x40')){var _0x26ff4e={};_0x26ff4e[_0xce4a97[_0x0970('0x2a')]]={'$like':'%'+_0xf38957[_0x0970('0x34')][_0x0970('0x3d')]+'%'};return _0x26ff4e;}})});}_0x56eca6=_[_0x0970('0x3f')]({},_0x56eca6,_0xf38957[_0x0970('0x41')]);var _0x5f347b={'where':_0x56eca6[_0x0970('0x3e')]};return db['SquareRecording'][_0x0970('0x1e')](_0x5f347b)['then'](function(_0x3efa19){_0x24aedf[_0x0970('0x1e')]=_0x3efa19;if(_0xf38957[_0x0970('0x34')][_0x0970('0x42')]){_0x56eca6[_0x0970('0x43')]=[{'all':!![]}];}return db[_0x0970('0x2d')][_0x0970('0x44')](_0x56eca6);})[_0x0970('0x27')](function(_0x4ea077){_0x24aedf[_0x0970('0x45')]=_0x4ea077;return _0x24aedf;})[_0x0970('0x27')](respondWithFilteredResult(_0x14a5c2,_0x56eca6))['catch'](handleError(_0x14a5c2,null));};exports[_0x0970('0x46')]=function(_0x15b697,_0x54f4cc){var _0x1bf48a={'raw':!![],'where':{'id':_0x15b697[_0x0970('0x47')]['id']}},_0x5539d2={};_0x5539d2[_0x0970('0x32')]=_[_0x0970('0x48')](db[_0x0970('0x2d')][_0x0970('0x2e')]);_0x5539d2[_0x0970('0x34')]=_[_0x0970('0x48')](_0x15b697['query']);_0x5539d2[_0x0970('0x35')]=_['intersection'](_0x5539d2[_0x0970('0x32')],_0x5539d2['query']);_0x1bf48a['attributes']=_[_0x0970('0x36')](_0x5539d2['model'],qs[_0x0970('0x49')](_0x15b697[_0x0970('0x34')]['fields']));_0x1bf48a[_0x0970('0x37')]=_0x1bf48a[_0x0970('0x37')][_0x0970('0x38')]?_0x1bf48a[_0x0970('0x37')]:_0x5539d2[_0x0970('0x32')];if(_0x15b697[_0x0970('0x34')][_0x0970('0x42')]){_0x1bf48a[_0x0970('0x43')]=[{'all':!![]}];}_0x1bf48a=_[_0x0970('0x3f')]({},_0x1bf48a,_0x15b697[_0x0970('0x41')]);return db[_0x0970('0x2d')][_0x0970('0x4a')](_0x1bf48a)[_0x0970('0x27')](handleEntityNotFound(_0x54f4cc,null))['then'](respondWithResult(_0x54f4cc,null))[_0x0970('0x4b')](handleError(_0x54f4cc,null));};exports[_0x0970('0x4c')]=function(_0x84898c,_0x157a30){return db[_0x0970('0x2d')]['create'](_0x84898c[_0x0970('0x4d')],{})[_0x0970('0x27')](respondWithResult(_0x157a30,0xc9))[_0x0970('0x4b')](handleError(_0x157a30,null));};exports[_0x0970('0x26')]=function(_0x19a4e5,_0x14f1a6){if(_0x19a4e5['body']['id']){delete _0x19a4e5[_0x0970('0x4d')]['id'];}return db[_0x0970('0x2d')][_0x0970('0x4a')]({'where':{'id':_0x19a4e5['params']['id']}})['then'](handleEntityNotFound(_0x14f1a6,null))[_0x0970('0x27')](saveUpdates(_0x19a4e5[_0x0970('0x4d')],null))['then'](respondWithResult(_0x14f1a6,null))[_0x0970('0x4b')](handleError(_0x14f1a6,null));};exports[_0x0970('0x4e')]=function(_0x1b8937,_0xa139d1,_0x3422e8){var _0x344b85=require(_0x0970('0x4f'));var _0x1a705f=![];var _0x5d3e6b={};if(_0x1b8937['query']['type']&&_0x1b8937[_0x0970('0x34')][_0x0970('0x30')]===_0x0970('0x50')){_0x5d3e6b[_0x0970('0x50')]=_0x1b8937[_0x0970('0x47')]['id'];}else{_0x5d3e6b['id']=_0x1b8937[_0x0970('0x47')]['id'];}return db[_0x0970('0x2d')][_0x0970('0x4a')]({'where':_0x5d3e6b,'attributes':['id',_0x0970('0x51'),_0x0970('0x52')],'raw':!![]})[_0x0970('0x27')](handleEntityNotFound(_0xa139d1,null))[_0x0970('0x27')](function(_0x1b5e05){if(_0x1b5e05){var _0x1a0cb0=_0x1b5e05[_0x0970('0x51')];var _0x27360a=util[_0x0970('0x53')](_0x0970('0x54'),_0x1a0cb0);if(fs[_0x0970('0x55')](_0x27360a)){_0x1a705f=!![];return _0x344b85[_0x0970('0x56')](_0x27360a,_0x1a0cb0,config[_0x0970('0x57')][_0x0970('0x58')])[_0x0970('0x27')](function(){return _0x1b5e05;});}return _0x1b5e05;}})[_0x0970('0x27')](function(_0x3e55d2){if(_0x3e55d2){var _0x2c9ec2=_0x3e55d2[_0x0970('0x51')];if(!fs['existsSync'](_0x2c9ec2)){throw new db['Sequelize'][(_0x0970('0x59'))](_0x0970('0x5a'));}if(_0x3e55d2[_0x0970('0x52')]){return _0xa139d1['download'](_0x2c9ec2,_0x3e55d2['filename']+path[_0x0970('0x5b')](_0x2c9ec2),function(){if(_0x1a705f){fs[_0x0970('0x5c')](_0x2c9ec2);}});}else{return _0xa139d1[_0x0970('0x4e')](_0x2c9ec2,function(_0x429739){if(_0x1a705f){fs[_0x0970('0x5c')](_0x2c9ec2);}});}}})[_0x0970('0x4b')](function(_0x3184b2){if(_0x3184b2[_0x0970('0x5d')]===_0x0970('0x5a')){_0xa139d1[_0x0970('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0xa139d1,null);}});};exports[_0x0970('0x28')]=function(_0x29b12a,_0x2ce452){return db['SquareRecording']['find']({'where':{'id':_0x29b12a['params']['id']}})['then'](function(_0x4c2bda){if(!_0x4c2bda)throw new ReferenceError('Entity\x20not\x20found');return _0x4c2bda;})[_0x0970('0x27')](function(_0x525065){var _0x2fd2f2=_0x525065['savePath'];logger[_0x0970('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x2fd2f2);if(!_[_0x0970('0x5f')](_0x525065[_0x0970('0x51')])&&fs[_0x0970('0x55')](_0x2fd2f2)){logger['info'](_0x0970('0x60')+_0x2fd2f2+_0x0970('0x61'));fs[_0x0970('0x62')](_0x2fd2f2);}_0x2fd2f2=_0x2fd2f2+'.cypher';if(!_[_0x0970('0x5f')](_0x525065[_0x0970('0x51')])&&fs['existsSync'](_0x2fd2f2)){logger[_0x0970('0x5e')](_0x0970('0x60')+_0x2fd2f2+_0x0970('0x61'));fs['unlinkSync'](_0x2fd2f2);}return _0x525065;})[_0x0970('0x27')](function(_0x21672a){if(!_0x21672a)throw new InternalError();return _0x21672a[_0x0970('0x28')]();})[_0x0970('0x27')](function(){_0x2ce452[_0x0970('0x1c')](0xcc)['end']();})['catch'](handleError(_0x2ce452,null));}; \ No newline at end of file +var _0xeabc=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','stack','name','send','index','SquareRecording','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','nolimit','limit','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','../../components/encryptor','uniqueid','filename','savePath','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0x1d6446,_0x5a1e5c){var _0x2ee1eb=function(_0x86928){while(--_0x86928){_0x1d6446['push'](_0x1d6446['shift']());}};_0x2ee1eb(++_0x5a1e5c);}(_0xeabc,0x114));var _0xceab=function(_0x14c7fc,_0x50826a){_0x14c7fc=_0x14c7fc-0x0;var _0x8a547c=_0xeabc[_0x14c7fc];return _0x8a547c;};'use strict';var pdf=require(_0xceab('0x0'));var emlformat=require(_0xceab('0x1'));var rimraf=require(_0xceab('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xceab('0x3'));var rp=require('request-promise');var moment=require(_0xceab('0x4'));var BPromise=require(_0xceab('0x5'));var Mustache=require('mustache');var util=require(_0xceab('0x6'));var path=require(_0xceab('0x7'));var sox=require(_0xceab('0x8'));var csv=require(_0xceab('0x9'));var ejs=require(_0xceab('0xa'));var fs=require('fs');var fs_extra=require(_0xceab('0xb'));var _=require(_0xceab('0xc'));var squel=require(_0xceab('0xd'));var crypto=require(_0xceab('0xe'));var jsforce=require(_0xceab('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xceab('0x9'));var querystring=require(_0xceab('0x10'));var Papa=require(_0xceab('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xceab('0x12'));var as=require(_0xceab('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xceab('0x14'));var utils=require(_0xceab('0x15'));var config=require(_0xceab('0x16'));var licenseUtil=require(_0xceab('0x17'));var db=require(_0xceab('0x18'))['db'];function respondWithStatusCode(_0x51e3bf,_0x5c8bd3){_0x5c8bd3=_0x5c8bd3||0xcc;return function(_0x3ded2c){if(_0x3ded2c){return _0x51e3bf[_0xceab('0x19')](_0x5c8bd3);}return _0x51e3bf[_0xceab('0x1a')](_0x5c8bd3)[_0xceab('0x1b')]();};}function respondWithResult(_0x2e8e90,_0x5c122a){_0x5c122a=_0x5c122a||0xc8;return function(_0x507b30){if(_0x507b30){return _0x2e8e90[_0xceab('0x1a')](_0x5c122a)[_0xceab('0x1c')](_0x507b30);}};}function respondWithFilteredResult(_0x303081,_0x17e3f4){return function(_0x3c7a12){if(_0x3c7a12){var _0x555b2b=_0x3c7a12[_0xceab('0x1d')],_0x484b2b=_0x17e3f4[_0xceab('0x1e')],_0x30faac=_0x17e3f4['offset']+_0x17e3f4['limit'],_0x238d4f;if(_0x30faac>=_0x555b2b){_0x30faac=_0x555b2b;_0x238d4f=0xc8;}else{_0x238d4f=0xce;}_0x303081['status'](_0x238d4f);return _0x303081[_0xceab('0x1f')]('Content-Range',_0x484b2b+'-'+_0x30faac+'/'+_0x555b2b)['json'](_0x3c7a12);}return null;};}function patchUpdates(_0x25f88f){return function(_0x1d1619){try{jsonpatch[_0xceab('0x20')](_0x1d1619,_0x25f88f,!![]);}catch(_0x46c845){return BPromise[_0xceab('0x21')](_0x46c845);}return _0x1d1619[_0xceab('0x22')]();};}function saveUpdates(_0x1d8d07,_0xf9b2ae){return function(_0x196023){if(_0x196023){return _0x196023[_0xceab('0x23')](_0x1d8d07)[_0xceab('0x24')](function(_0x5a32d6){return _0x5a32d6;});}return null;};}function removeEntity(_0xa3e92b,_0x559e2f){return function(_0x3e0850){if(_0x3e0850){return _0x3e0850[_0xceab('0x25')]()['then'](function(){_0xa3e92b[_0xceab('0x1a')](0xcc)[_0xceab('0x1b')]();});}};}function handleEntityNotFound(_0xb9b3e,_0x5542b8){return function(_0x244555){if(!_0x244555){_0xb9b3e['sendStatus'](0x194);}return _0x244555;};}function handleError(_0x5b0dc5,_0x18c45e){_0x18c45e=_0x18c45e||0x1f4;return function(_0x3de493){logger['error'](_0x3de493[_0xceab('0x26')]);if(_0x3de493[_0xceab('0x27')]){delete _0x3de493[_0xceab('0x27')];}_0x5b0dc5['status'](_0x18c45e)[_0xceab('0x28')](_0x3de493);};}exports[_0xceab('0x29')]=function(_0x29bc65,_0x11e054){var _0x3a550b={},_0x3f5426={},_0x55b762={'count':0x0,'rows':[]};var _0x1995fe=_['map'](db[_0xceab('0x2a')][_0xceab('0x2b')],function(_0x1fb16c){return{'name':_0x1fb16c[_0xceab('0x2c')],'type':_0x1fb16c['type'][_0xceab('0x2d')]};});_0x3f5426[_0xceab('0x2e')]=_[_0xceab('0x2f')](_0x1995fe,_0xceab('0x27'));_0x3f5426[_0xceab('0x30')]=_['keys'](_0x29bc65[_0xceab('0x30')]);_0x3f5426['filters']=_[_0xceab('0x31')](_0x3f5426[_0xceab('0x2e')],_0x3f5426['query']);_0x3a550b[_0xceab('0x32')]=_[_0xceab('0x31')](_0x3f5426[_0xceab('0x2e')],qs[_0xceab('0x33')](_0x29bc65[_0xceab('0x30')][_0xceab('0x33')]));_0x3a550b[_0xceab('0x32')]=_0x3a550b[_0xceab('0x32')][_0xceab('0x34')]?_0x3a550b[_0xceab('0x32')]:_0x3f5426[_0xceab('0x2e')];if(!_0x29bc65['query']['hasOwnProperty'](_0xceab('0x35'))){_0x3a550b[_0xceab('0x36')]=qs['limit'](_0x29bc65[_0xceab('0x30')][_0xceab('0x36')]);_0x3a550b[_0xceab('0x1e')]=qs['offset'](_0x29bc65[_0xceab('0x30')][_0xceab('0x1e')]);}_0x3a550b['order']=qs['sort'](_0x29bc65[_0xceab('0x30')][_0xceab('0x37')]);_0x3a550b['where']=qs[_0xceab('0x38')](_[_0xceab('0x39')](_0x29bc65[_0xceab('0x30')],_0x3f5426[_0xceab('0x38')]),_0x1995fe);if(_0x29bc65[_0xceab('0x30')][_0xceab('0x3a')]){_0x3a550b[_0xceab('0x3b')]=_[_0xceab('0x3c')](_0x3a550b['where'],{'$or':_[_0xceab('0x2f')](_0x1995fe,function(_0x2a8544){if(_0x2a8544[_0xceab('0x3d')]!==_0xceab('0x3e')){var _0x365ef2={};_0x365ef2[_0x2a8544[_0xceab('0x27')]]={'$like':'%'+_0x29bc65['query'][_0xceab('0x3a')]+'%'};return _0x365ef2;}})});}_0x3a550b=_[_0xceab('0x3c')]({},_0x3a550b,_0x29bc65[_0xceab('0x3f')]);var _0x4792f1={'where':_0x3a550b['where']};return db[_0xceab('0x2a')][_0xceab('0x1d')](_0x4792f1)[_0xceab('0x24')](function(_0x239ea0){_0x55b762['count']=_0x239ea0;if(_0x29bc65[_0xceab('0x30')][_0xceab('0x40')]){_0x3a550b[_0xceab('0x41')]=[{'all':!![]}];}return db['SquareRecording'][_0xceab('0x42')](_0x3a550b);})[_0xceab('0x24')](function(_0x5a1943){_0x55b762['rows']=_0x5a1943;return _0x55b762;})['then'](respondWithFilteredResult(_0x11e054,_0x3a550b))[_0xceab('0x43')](handleError(_0x11e054,null));};exports[_0xceab('0x44')]=function(_0x4ee240,_0x5e0275){var _0x1cc36c={'raw':!![],'where':{'id':_0x4ee240[_0xceab('0x45')]['id']}},_0x185517={};_0x185517[_0xceab('0x2e')]=_[_0xceab('0x46')](db[_0xceab('0x2a')]['rawAttributes']);_0x185517[_0xceab('0x30')]=_[_0xceab('0x46')](_0x4ee240['query']);_0x185517['filters']=_[_0xceab('0x31')](_0x185517['model'],_0x185517[_0xceab('0x30')]);_0x1cc36c[_0xceab('0x32')]=_[_0xceab('0x31')](_0x185517['model'],qs[_0xceab('0x33')](_0x4ee240[_0xceab('0x30')]['fields']));_0x1cc36c[_0xceab('0x32')]=_0x1cc36c[_0xceab('0x32')][_0xceab('0x34')]?_0x1cc36c[_0xceab('0x32')]:_0x185517[_0xceab('0x2e')];if(_0x4ee240['query']['includeAll']){_0x1cc36c[_0xceab('0x41')]=[{'all':!![]}];}_0x1cc36c=_[_0xceab('0x3c')]({},_0x1cc36c,_0x4ee240[_0xceab('0x3f')]);return db[_0xceab('0x2a')][_0xceab('0x47')](_0x1cc36c)[_0xceab('0x24')](handleEntityNotFound(_0x5e0275,null))[_0xceab('0x24')](respondWithResult(_0x5e0275,null))[_0xceab('0x43')](handleError(_0x5e0275,null));};exports['create']=function(_0x456672,_0x4e265f){return db[_0xceab('0x2a')][_0xceab('0x48')](_0x456672['body'],{})['then'](respondWithResult(_0x4e265f,0xc9))[_0xceab('0x43')](handleError(_0x4e265f,null));};exports[_0xceab('0x23')]=function(_0x59d571,_0x2a46b8){if(_0x59d571[_0xceab('0x49')]['id']){delete _0x59d571[_0xceab('0x49')]['id'];}return db[_0xceab('0x2a')][_0xceab('0x47')]({'where':{'id':_0x59d571['params']['id']}})[_0xceab('0x24')](handleEntityNotFound(_0x2a46b8,null))[_0xceab('0x24')](saveUpdates(_0x59d571[_0xceab('0x49')],null))['then'](respondWithResult(_0x2a46b8,null))['catch'](handleError(_0x2a46b8,null));};exports['download']=function(_0x50a756,_0x571490,_0x42b0df){var _0x30bd2e=require(_0xceab('0x4a'));var _0x78b720=![];var _0x3e2781={};if(_0x50a756[_0xceab('0x30')][_0xceab('0x3d')]&&_0x50a756[_0xceab('0x30')][_0xceab('0x3d')]===_0xceab('0x4b')){_0x3e2781[_0xceab('0x4b')]=_0x50a756[_0xceab('0x45')]['id'];}else{_0x3e2781['id']=_0x50a756[_0xceab('0x45')]['id'];}return db[_0xceab('0x2a')]['find']({'where':_0x3e2781,'attributes':['id','savePath',_0xceab('0x4c')],'raw':!![]})[_0xceab('0x24')](handleEntityNotFound(_0x571490,null))[_0xceab('0x24')](function(_0x32b039){if(_0x32b039){var _0x5078cf=_0x32b039[_0xceab('0x4d')];var _0x29d9cd=util['format'](_0xceab('0x4e'),_0x5078cf);if(fs[_0xceab('0x4f')](_0x29d9cd)){_0x78b720=!![];return _0x30bd2e[_0xceab('0x50')](_0x29d9cd,_0x5078cf,config[_0xceab('0x51')][_0xceab('0x52')])[_0xceab('0x24')](function(){return _0x32b039;});}return _0x32b039;}})[_0xceab('0x24')](function(_0x43dec3){if(_0x43dec3){var _0x2c79d5=_0x43dec3[_0xceab('0x4d')];if(!fs[_0xceab('0x4f')](_0x2c79d5)){throw new db[(_0xceab('0x53'))][(_0xceab('0x54'))](_0xceab('0x55'));}if(_0x43dec3['filename']){return _0x571490['download'](_0x2c79d5,_0x43dec3['filename']+path[_0xceab('0x56')](_0x2c79d5),function(){if(_0x78b720){fs['unlink'](_0x2c79d5);}});}else{return _0x571490['download'](_0x2c79d5,function(_0x2f160e){if(_0x78b720){fs['unlink'](_0x2c79d5);}});}}})[_0xceab('0x43')](function(_0x5b4aee){if(_0x5b4aee['message']===_0xceab('0x55')){_0x571490[_0xceab('0x1a')](0x194)[_0xceab('0x28')](_0xceab('0x57'));}else{return handleError(_0x571490,null);}});};exports[_0xceab('0x25')]=function(_0x443f76,_0x44df1a){return db['SquareRecording']['find']({'where':{'id':_0x443f76['params']['id']}})['then'](function(_0x202f0a){if(!_0x202f0a)throw new ReferenceError(_0xceab('0x58'));return _0x202f0a;})[_0xceab('0x24')](function(_0x4b8b8a){var _0x170c42=_0x4b8b8a[_0xceab('0x4d')];logger[_0xceab('0x59')](_0xceab('0x5a'),_0x170c42);if(!_[_0xceab('0x5b')](_0x4b8b8a['savePath'])&&fs[_0xceab('0x4f')](_0x170c42)){logger[_0xceab('0x59')]('File:\x20\x22'+_0x170c42+_0xceab('0x5c'));fs['unlinkSync'](_0x170c42);}_0x170c42=_0x170c42+'.cypher';if(!_['isNil'](_0x4b8b8a[_0xceab('0x4d')])&&fs[_0xceab('0x4f')](_0x170c42)){logger[_0xceab('0x59')]('File:\x20\x22'+_0x170c42+_0xceab('0x5c'));fs[_0xceab('0x5d')](_0x170c42);}return _0x4b8b8a;})[_0xceab('0x24')](function(_0x4921cd){if(!_0x4921cd)throw new InternalError();return _0x4921cd[_0xceab('0x25')]();})['then'](function(){_0x44df1a['status'](0xcc)['end']();})['catch'](handleError(_0x44df1a,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 8aff7f8..27947ac 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 _0xefda=['../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','api','moment','request-promise','path','rimraf'];(function(_0x5d688c,_0x269916){var _0x2e93ba=function(_0x23d93b){while(--_0x23d93b){_0x5d688c['push'](_0x5d688c['shift']());}};_0x2e93ba(++_0x269916);}(_0xefda,0x96));var _0xaefd=function(_0xb8484a,_0x95e48d){_0xb8484a=_0xb8484a-0x0;var _0x4dbbe7=_0xefda[_0xb8484a];return _0x4dbbe7;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcbb=['rimraf','../../config/environment','define','SquareRecording','square_recordings','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x1f7f58,_0x340bfd){var _0x1ac2d9=function(_0x5273c0){while(--_0x5273c0){_0x1f7f58['push'](_0x1f7f58['shift']());}};_0x1ac2d9(++_0x340bfd);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x28661f,_0x2bfcd6){_0x28661f=_0x28661f-0x0;var _0x1aac56=_0xfcbb[_0x28661f];return _0x1aac56;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var logger=require(_0xbfcb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbfcb('0x3'));var rp=require(_0xbfcb('0x4'));var fs=require('fs');var path=require(_0xbfcb('0x5'));var rimraf=require(_0xbfcb('0x6'));var config=require(_0xbfcb('0x7'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x32c2aa,_0x4990c){return _0x32c2aa[_0xbfcb('0x8')](_0xbfcb('0x9'),attributes,{'tableName':_0xbfcb('0xa'),'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 356a948..53cb3c6 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 _0x37e6=['message','SquareRecording','body','raw','CreateSquareRecording','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2beb3a,_0x10e475){var _0x362b1c=function(_0x558bad){while(--_0x558bad){_0x2beb3a['push'](_0x2beb3a['shift']());}};_0x362b1c(++_0x10e475);}(_0x37e6,0x8c));var _0x637e=function(_0x1056c2,_0xfbcd8){_0x1056c2=_0x1056c2-0x0;var _0x11119a=_0x37e6[_0x1056c2];return _0x11119a;};'use strict';var _=require(_0x637e('0x0'));var util=require(_0x637e('0x1'));var moment=require(_0x637e('0x2'));var BPromise=require(_0x637e('0x3'));var rs=require(_0x637e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x637e('0x5'))['db'];var utils=require(_0x637e('0x6'));var logger=require(_0x637e('0x7'))('rpc');var config=require(_0x637e('0x8'));var jayson=require(_0x637e('0x9'));var client=jayson[_0x637e('0xa')][_0x637e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x439c04,_0x58ef8b,_0x3f83ec){return new BPromise(function(_0x4530b0,_0x52a3ac){return client[_0x637e('0xc')](_0x439c04,_0x3f83ec)[_0x637e('0xd')](function(_0xb97814){logger[_0x637e('0xe')](_0x637e('0xf'),_0x58ef8b,_0x637e('0x10'));logger[_0x637e('0x11')](_0x637e('0x12'),_0x58ef8b,_0x637e('0x10'),JSON[_0x637e('0x13')](_0xb97814));if(_0xb97814[_0x637e('0x14')]){if(_0xb97814[_0x637e('0x14')][_0x637e('0x15')]===0x1f4){logger[_0x637e('0x14')]('SquareRecording,\x20%s,\x20%s',_0x58ef8b,_0xb97814['error'][_0x637e('0x16')]);return _0x52a3ac(_0xb97814[_0x637e('0x14')][_0x637e('0x16')]);}logger[_0x637e('0x14')](_0x637e('0xf'),_0x58ef8b,_0xb97814['error'][_0x637e('0x16')]);return _0x4530b0(_0xb97814[_0x637e('0x14')]['message']);}else{logger[_0x637e('0xe')](_0x637e('0xf'),_0x58ef8b,_0x637e('0x10'));_0x4530b0(_0xb97814['result']['message']);}})['catch'](function(_0x103316){logger['error']('SquareRecording,\x20%s,\x20%s',_0x58ef8b,_0x103316);_0x52a3ac(_0x103316);});});}exports['CreateSquareRecording']=function(_0x3474a8){var _0x5c7f22=this;return new Promise(function(_0x406181,_0x283c82){return db[_0x637e('0x17')]['create'](_0x3474a8[_0x637e('0x18')],{'raw':_0x3474a8['options']?_0x3474a8['options'][_0x637e('0x19')]===undefined?!![]:![]:!![]})[_0x637e('0xd')](function(_0x28e71d){logger[_0x637e('0xe')](_0x637e('0x1a'),_0x3474a8);logger[_0x637e('0x11')]('CreateSquareRecording',_0x3474a8,JSON['stringify'](_0x28e71d));_0x406181(_0x28e71d);})['catch'](function(_0x29f443){logger[_0x637e('0x14')](_0x637e('0x1a'),_0x29f443[_0x637e('0x16')],_0x3474a8);_0x283c82(_0x5c7f22[_0x637e('0x14')](0x1f4,_0x29f443[_0x637e('0x16')]));});});}; \ No newline at end of file +var _0x8d7d=['http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','then','debug','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x57c100,_0x1fd08d){var _0x136fd3=function(_0x5e28dc){while(--_0x5e28dc){_0x57c100['push'](_0x57c100['shift']());}};_0x136fd3(++_0x1fd08d);}(_0x8d7d,0x17f));var _0xd8d7=function(_0x2a380f,_0x523e45){_0x2a380f=_0x2a380f-0x0;var _0x2d6c4f=_0x8d7d[_0x2a380f];return _0x2d6c4f;};'use strict';var _=require(_0xd8d7('0x0'));var util=require(_0xd8d7('0x1'));var moment=require('moment');var BPromise=require(_0xd8d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8d7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8d7('0x4'));var logger=require(_0xd8d7('0x5'))(_0xd8d7('0x6'));var config=require(_0xd8d7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd8d7('0x8')][_0xd8d7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa4133e,_0x1a4d13,_0x11db60){return new BPromise(function(_0x35af94,_0x2e56ac){return client[_0xd8d7('0xa')](_0xa4133e,_0x11db60)['then'](function(_0x4addaf){logger['info'](_0xd8d7('0xb'),_0x1a4d13,_0xd8d7('0xc'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x1a4d13,_0xd8d7('0xc'),JSON[_0xd8d7('0xd')](_0x4addaf));if(_0x4addaf[_0xd8d7('0xe')]){if(_0x4addaf[_0xd8d7('0xe')][_0xd8d7('0xf')]===0x1f4){logger[_0xd8d7('0xe')](_0xd8d7('0xb'),_0x1a4d13,_0x4addaf['error'][_0xd8d7('0x10')]);return _0x2e56ac(_0x4addaf[_0xd8d7('0xe')][_0xd8d7('0x10')]);}logger['error'](_0xd8d7('0xb'),_0x1a4d13,_0x4addaf[_0xd8d7('0xe')][_0xd8d7('0x10')]);return _0x35af94(_0x4addaf['error'][_0xd8d7('0x10')]);}else{logger[_0xd8d7('0x11')](_0xd8d7('0xb'),_0x1a4d13,_0xd8d7('0xc'));_0x35af94(_0x4addaf[_0xd8d7('0x12')][_0xd8d7('0x10')]);}})[_0xd8d7('0x13')](function(_0x5006f2){logger[_0xd8d7('0xe')](_0xd8d7('0xb'),_0x1a4d13,_0x5006f2);_0x2e56ac(_0x5006f2);});});}exports[_0xd8d7('0x14')]=function(_0x3137c1){var _0x2f81d2=this;return new Promise(function(_0x4ca231,_0x5b6adb){return db[_0xd8d7('0x15')][_0xd8d7('0x16')](_0x3137c1[_0xd8d7('0x17')],{'raw':_0x3137c1['options']?_0x3137c1[_0xd8d7('0x18')][_0xd8d7('0x19')]===undefined?!![]:![]:!![]})[_0xd8d7('0x1a')](function(_0x3ba3c1){logger['info'](_0xd8d7('0x14'),_0x3137c1);logger[_0xd8d7('0x1b')]('CreateSquareRecording',_0x3137c1,JSON[_0xd8d7('0xd')](_0x3ba3c1));_0x4ca231(_0x3ba3c1);})[_0xd8d7('0x13')](function(_0x1cb6d0){logger[_0xd8d7('0xe')](_0xd8d7('0x14'),_0x1cb6d0[_0xd8d7('0x10')],_0x3137c1);_0x5b6adb(_0x2f81d2[_0xd8d7('0xe')](0x1f4,_0x1cb6d0['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index f283090..2047bcf 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 _0x88c3=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','update','delete','destroy','exports'];(function(_0x1a931f,_0x2cabb9){var _0x21d049=function(_0x3c07b1){while(--_0x3c07b1){_0x1a931f['push'](_0x1a931f['shift']());}};_0x21d049(++_0x2cabb9);}(_0x88c3,0x1c2));var _0x388c=function(_0x4ae970,_0x43b505){_0x4ae970=_0x4ae970-0x0;var _0x4a17af=_0x88c3[_0x4ae970];return _0x4a17af;};'use strict';var multer=require('multer');var util=require(_0x388c('0x0'));var path=require('path');var timeout=require(_0x388c('0x1'));var express=require(_0x388c('0x2'));var router=express['Router']();var fs_extra=require(_0x388c('0x3'));var auth=require(_0x388c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x388c('0x5'));var controller=require(_0x388c('0x6'));router[_0x388c('0x7')]('/',auth[_0x388c('0x8')](),controller[_0x388c('0x9')]);router[_0x388c('0x7')](_0x388c('0xa'),auth[_0x388c('0x8')](),controller['describe']);router[_0x388c('0x7')](_0x388c('0xb'),auth[_0x388c('0x8')](),controller['show']);router[_0x388c('0xc')]('/',auth['isAuthenticated'](),controller[_0x388c('0xd')]);router['put'](_0x388c('0xb'),auth['isAuthenticated'](),controller[_0x388c('0xe')]);router[_0x388c('0xf')](_0x388c('0xb'),auth['isAuthenticated'](),controller[_0x388c('0x10')]);module[_0x388c('0x11')]=router; \ No newline at end of file +var _0x619d=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','delete','destroy','multer','util','connect-timeout'];(function(_0x5dba45,_0x5cbaa0){var _0x7f67c1=function(_0x3bef6e){while(--_0x3bef6e){_0x5dba45['push'](_0x5dba45['shift']());}};_0x7f67c1(++_0x5cbaa0);}(_0x619d,0x1b7));var _0xd619=function(_0xfd15b7,_0x4c3627){_0xfd15b7=_0xfd15b7-0x0;var _0x12b2ea=_0x619d[_0xfd15b7];return _0x12b2ea;};'use strict';var multer=require(_0xd619('0x0'));var util=require(_0xd619('0x1'));var path=require('path');var timeout=require(_0xd619('0x2'));var express=require(_0xd619('0x3'));var router=express['Router']();var fs_extra=require(_0xd619('0x4'));var auth=require(_0xd619('0x5'));var interaction=require(_0xd619('0x6'));var config=require(_0xd619('0x7'));var controller=require('./squareReport.controller');router[_0xd619('0x8')]('/',auth[_0xd619('0x9')](),controller['index']);router[_0xd619('0x8')]('/describe',auth[_0xd619('0x9')](),controller[_0xd619('0xa')]);router[_0xd619('0x8')](_0xd619('0xb'),auth[_0xd619('0x9')](),controller[_0xd619('0xc')]);router[_0xd619('0xd')]('/',auth[_0xd619('0x9')](),controller[_0xd619('0xe')]);router['put'](_0xd619('0xb'),auth[_0xd619('0x9')](),controller['update']);router[_0xd619('0xf')](_0xd619('0xb'),auth[_0xd619('0x9')](),controller[_0xd619('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 09cf77a..bd32993 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 _0xf56a=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x25b613,_0x42d4e7){var _0x5ee1d9=function(_0x1c16c5){while(--_0x1c16c5){_0x25b613['push'](_0x25b613['shift']());}};_0x5ee1d9(++_0x42d4e7);}(_0xf56a,0x1ac));var _0xaf56=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xf56a[_0x291f8b];return _0x275171;};'use strict';var Sequelize=require(_0xaf56('0x0'));module[_0xaf56('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xaf56('0x2')]},'request':{'type':Sequelize[_0xaf56('0x2')]},'channel':{'type':Sequelize[_0xaf56('0x2')]},'language':{'type':Sequelize[_0xaf56('0x2')]},'type':{'type':Sequelize[_0xaf56('0x2')]},'uniqueid':{'type':Sequelize[_0xaf56('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf56('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xaf56('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xaf56('0x2')]},'rdnis':{'type':Sequelize[_0xaf56('0x2')]},'context':{'type':Sequelize[_0xaf56('0x2')]},'extension':{'type':Sequelize[_0xaf56('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaf56('0x2')]},'threadid':{'type':Sequelize[_0xaf56('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xaf56('0x3')]},'leaveAt':{'type':Sequelize[_0xaf56('0x3')]},'bot':{'type':Sequelize[_0xaf56('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa191=['sequelize','exports','STRING'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xa191,0xc3));var _0x1a19=function(_0x807dd0,_0x2cd340){_0x807dd0=_0x807dd0-0x0;var _0x1c6213=_0xa191[_0x807dd0];return _0x1c6213;};'use strict';var Sequelize=require(_0x1a19('0x0'));module[_0x1a19('0x1')]={'network':{'type':Sequelize[_0x1a19('0x2')]},'network_script':{'type':Sequelize[_0x1a19('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1a19('0x2')]},'language':{'type':Sequelize[_0x1a19('0x2')]},'type':{'type':Sequelize[_0x1a19('0x2')]},'uniqueid':{'type':Sequelize[_0x1a19('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1a19('0x2')]},'calleridname':{'type':Sequelize[_0x1a19('0x2')]},'callingpres':{'type':Sequelize[_0x1a19('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x1a19('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1a19('0x2')]},'extension':{'type':Sequelize[_0x1a19('0x2')]},'priority':{'type':Sequelize[_0x1a19('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1a19('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x1a19('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 1e6ac55..a9b4a83 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 _0x0421=['type','VIRTUAL','merge','options','SquareReport','then','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x115920,_0x507f3e){var _0x258144=function(_0x338258){while(--_0x338258){_0x115920['push'](_0x115920['shift']());}};_0x258144(++_0x507f3e);}(_0x0421,0x142));var _0x1042=function(_0x201181,_0x3ad169){_0x201181=_0x201181-0x0;var _0x58cf9c=_0x0421[_0x201181];return _0x58cf9c;};'use strict';var pdf=require(_0x1042('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1042('0x1'));var zipdir=require(_0x1042('0x2'));var jsonpatch=require(_0x1042('0x3'));var rp=require(_0x1042('0x4'));var moment=require('moment');var BPromise=require(_0x1042('0x5'));var Mustache=require(_0x1042('0x6'));var util=require('util');var path=require(_0x1042('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1042('0x8'));var fs=require('fs');var fs_extra=require(_0x1042('0x9'));var _=require(_0x1042('0xa'));var squel=require('squel');var crypto=require(_0x1042('0xb'));var jsforce=require(_0x1042('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1042('0xd'));var Papa=require(_0x1042('0xe'));var Redis=require(_0x1042('0xf'));var authService=require(_0x1042('0x10'));var qs=require(_0x1042('0x11'));var as=require(_0x1042('0x12'));var hardwareService=require(_0x1042('0x13'));var logger=require(_0x1042('0x14'))(_0x1042('0x15'));var utils=require(_0x1042('0x16'));var config=require(_0x1042('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cfd62,_0x21a8f5){_0x21a8f5=_0x21a8f5||0xcc;return function(_0x1bd025){if(_0x1bd025){return _0x3cfd62[_0x1042('0x18')](_0x21a8f5);}return _0x3cfd62['status'](_0x21a8f5)[_0x1042('0x19')]();};}function respondWithResult(_0x456027,_0x550beb){_0x550beb=_0x550beb||0xc8;return function(_0x4b0384){if(_0x4b0384){return _0x456027[_0x1042('0x1a')](_0x550beb)[_0x1042('0x1b')](_0x4b0384);}};}function respondWithFilteredResult(_0x5a250c,_0x569c18){return function(_0x11ce87){if(_0x11ce87){var _0xad67a0=_0x11ce87[_0x1042('0x1c')],_0xb05a99=_0x569c18['offset'],_0x1c96f6=_0x569c18[_0x1042('0x1d')]+_0x569c18[_0x1042('0x1e')],_0x277f9a;if(_0x1c96f6>=_0xad67a0){_0x1c96f6=_0xad67a0;_0x277f9a=0xc8;}else{_0x277f9a=0xce;}_0x5a250c[_0x1042('0x1a')](_0x277f9a);return _0x5a250c[_0x1042('0x1f')](_0x1042('0x20'),_0xb05a99+'-'+_0x1c96f6+'/'+_0xad67a0)['json'](_0x11ce87);}return null;};}function patchUpdates(_0x2f9163){return function(_0x1042d6){try{jsonpatch[_0x1042('0x21')](_0x1042d6,_0x2f9163,!![]);}catch(_0x2ed30f){return BPromise[_0x1042('0x22')](_0x2ed30f);}return _0x1042d6[_0x1042('0x23')]();};}function saveUpdates(_0x3a35ed,_0x1b8c14){return function(_0x84de0a){if(_0x84de0a){return _0x84de0a[_0x1042('0x24')](_0x3a35ed)['then'](function(_0x49b40e){return _0x49b40e;});}return null;};}function removeEntity(_0x462007,_0x429430){return function(_0xc84e3c){if(_0xc84e3c){return _0xc84e3c['destroy']()['then'](function(){_0x462007[_0x1042('0x1a')](0xcc)[_0x1042('0x19')]();});}};}function handleEntityNotFound(_0x5b3e77,_0x5260be){return function(_0x44a1bd){if(!_0x44a1bd){_0x5b3e77[_0x1042('0x18')](0x194);}return _0x44a1bd;};}function handleError(_0x28b2c0,_0x34c4cd){_0x34c4cd=_0x34c4cd||0x1f4;return function(_0x1d1be3){logger['error'](_0x1d1be3['stack']);if(_0x1d1be3[_0x1042('0x25')]){delete _0x1d1be3[_0x1042('0x25')];}_0x28b2c0['status'](_0x34c4cd)[_0x1042('0x26')](_0x1d1be3);};}exports[_0x1042('0x27')]=function(_0x5245e2,_0xfe6043){var _0x1e3149={},_0x1a908b={},_0x4865ce={'count':0x0,'rows':[]};var _0x5b0886=_[_0x1042('0x28')](db['SquareReport'][_0x1042('0x29')],function(_0x28d7df){return{'name':_0x28d7df[_0x1042('0x2a')],'type':_0x28d7df['type']['key']};});_0x1a908b[_0x1042('0x2b')]=_[_0x1042('0x28')](_0x5b0886,_0x1042('0x25'));_0x1a908b[_0x1042('0x2c')]=_[_0x1042('0x2d')](_0x5245e2['query']);_0x1a908b[_0x1042('0x2e')]=_[_0x1042('0x2f')](_0x1a908b['model'],_0x1a908b['query']);_0x1e3149[_0x1042('0x30')]=_[_0x1042('0x2f')](_0x1a908b[_0x1042('0x2b')],qs['fields'](_0x5245e2[_0x1042('0x2c')][_0x1042('0x31')]));_0x1e3149['attributes']=_0x1e3149[_0x1042('0x30')][_0x1042('0x32')]?_0x1e3149['attributes']:_0x1a908b['model'];if(!_0x5245e2[_0x1042('0x2c')][_0x1042('0x33')](_0x1042('0x34'))){_0x1e3149[_0x1042('0x1e')]=qs[_0x1042('0x1e')](_0x5245e2[_0x1042('0x2c')][_0x1042('0x1e')]);_0x1e3149[_0x1042('0x1d')]=qs[_0x1042('0x1d')](_0x5245e2[_0x1042('0x2c')][_0x1042('0x1d')]);}_0x1e3149[_0x1042('0x35')]=qs[_0x1042('0x36')](_0x5245e2[_0x1042('0x2c')][_0x1042('0x36')]);_0x1e3149[_0x1042('0x37')]=qs[_0x1042('0x2e')](_[_0x1042('0x38')](_0x5245e2['query'],_0x1a908b[_0x1042('0x2e')]),_0x5b0886);if(_0x5245e2[_0x1042('0x2c')][_0x1042('0x39')]){_0x1e3149[_0x1042('0x37')]=_['merge'](_0x1e3149[_0x1042('0x37')],{'$or':_[_0x1042('0x28')](_0x5b0886,function(_0x3fab07){if(_0x3fab07[_0x1042('0x3a')]!==_0x1042('0x3b')){var _0x5a033d={};_0x5a033d[_0x3fab07['name']]={'$like':'%'+_0x5245e2[_0x1042('0x2c')][_0x1042('0x39')]+'%'};return _0x5a033d;}})});}_0x1e3149=_[_0x1042('0x3c')]({},_0x1e3149,_0x5245e2[_0x1042('0x3d')]);var _0x4c7301={'where':_0x1e3149[_0x1042('0x37')]};return db[_0x1042('0x3e')][_0x1042('0x1c')](_0x4c7301)[_0x1042('0x3f')](function(_0x107de2){_0x4865ce[_0x1042('0x1c')]=_0x107de2;if(_0x5245e2[_0x1042('0x2c')]['includeAll']){_0x1e3149[_0x1042('0x40')]=[{'all':!![]}];}return db[_0x1042('0x3e')][_0x1042('0x41')](_0x1e3149);})[_0x1042('0x3f')](function(_0x36e5bf){_0x4865ce[_0x1042('0x42')]=_0x36e5bf;return _0x4865ce;})[_0x1042('0x3f')](respondWithFilteredResult(_0xfe6043,_0x1e3149))[_0x1042('0x43')](handleError(_0xfe6043,null));};exports[_0x1042('0x44')]=function(_0x559601,_0xaf8b72){var _0x2d3227={'raw':!![],'where':{'id':_0x559601[_0x1042('0x45')]['id']}},_0x167666={};_0x167666[_0x1042('0x2b')]=_[_0x1042('0x2d')](db[_0x1042('0x3e')][_0x1042('0x29')]);_0x167666[_0x1042('0x2c')]=_[_0x1042('0x2d')](_0x559601['query']);_0x167666[_0x1042('0x2e')]=_[_0x1042('0x2f')](_0x167666[_0x1042('0x2b')],_0x167666[_0x1042('0x2c')]);_0x2d3227['attributes']=_[_0x1042('0x2f')](_0x167666[_0x1042('0x2b')],qs[_0x1042('0x31')](_0x559601[_0x1042('0x2c')][_0x1042('0x31')]));_0x2d3227[_0x1042('0x30')]=_0x2d3227['attributes'][_0x1042('0x32')]?_0x2d3227[_0x1042('0x30')]:_0x167666[_0x1042('0x2b')];if(_0x559601[_0x1042('0x2c')][_0x1042('0x46')]){_0x2d3227[_0x1042('0x40')]=[{'all':!![]}];}_0x2d3227=_[_0x1042('0x3c')]({},_0x2d3227,_0x559601[_0x1042('0x3d')]);return db['SquareReport'][_0x1042('0x47')](_0x2d3227)[_0x1042('0x3f')](handleEntityNotFound(_0xaf8b72,null))[_0x1042('0x3f')](respondWithResult(_0xaf8b72,null))[_0x1042('0x43')](handleError(_0xaf8b72,null));};exports[_0x1042('0x48')]=function(_0x1a7e85,_0x35749e){return db['SquareReport'][_0x1042('0x48')](_0x1a7e85[_0x1042('0x49')],{})[_0x1042('0x3f')](respondWithResult(_0x35749e,0xc9))[_0x1042('0x43')](handleError(_0x35749e,null));};exports[_0x1042('0x24')]=function(_0x190774,_0x5990eb){if(_0x190774[_0x1042('0x49')]['id']){delete _0x190774[_0x1042('0x49')]['id'];}return db['SquareReport'][_0x1042('0x47')]({'where':{'id':_0x190774[_0x1042('0x45')]['id']}})['then'](handleEntityNotFound(_0x5990eb,null))[_0x1042('0x3f')](saveUpdates(_0x190774[_0x1042('0x49')],null))[_0x1042('0x3f')](respondWithResult(_0x5990eb,null))['catch'](handleError(_0x5990eb,null));};exports[_0x1042('0x4a')]=function(_0x46ff9e,_0x153970){return db['SquareReport'][_0x1042('0x47')]({'where':{'id':_0x46ff9e[_0x1042('0x45')]['id']}})[_0x1042('0x3f')](handleEntityNotFound(_0x153970,null))['then'](removeEntity(_0x153970,null))[_0x1042('0x43')](handleError(_0x153970,null));};exports[_0x1042('0x4b')]=function(_0x432588,_0x4237fc){return db[_0x1042('0x3e')]['describe']()[_0x1042('0x3f')](respondWithResult(_0x4237fc,null))[_0x1042('0x43')](handleError(_0x4237fc,null));}; \ No newline at end of file +var _0x614e=['status','json','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','attributes','intersection','fields','length','nolimit','offset','sort','where','filters','pick','filter','merge','options','SquareReport','count','includeAll','include','findAll','catch','show','model','find','create','body','params','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x720e20,_0x1a827){var _0xfef46e=function(_0x4b3c31){while(--_0x4b3c31){_0x720e20['push'](_0x720e20['shift']());}};_0xfef46e(++_0x1a827);}(_0x614e,0x1a3));var _0xe614=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x614e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe614('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe614('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe614('0x2'));var rp=require(_0xe614('0x3'));var moment=require(_0xe614('0x4'));var BPromise=require(_0xe614('0x5'));var Mustache=require(_0xe614('0x6'));var util=require(_0xe614('0x7'));var path=require(_0xe614('0x8'));var sox=require('sox');var csv=require(_0xe614('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe614('0xa'));var _=require(_0xe614('0xb'));var squel=require('squel');var crypto=require(_0xe614('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe614('0xd'));var toCsv=require(_0xe614('0x9'));var querystring=require(_0xe614('0xe'));var Papa=require('papaparse');var Redis=require(_0xe614('0xf'));var authService=require(_0xe614('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe614('0x11'));var hardwareService=require(_0xe614('0x12'));var logger=require(_0xe614('0x13'))(_0xe614('0x14'));var utils=require(_0xe614('0x15'));var config=require(_0xe614('0x16'));var licenseUtil=require(_0xe614('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31abf1,_0xdd76ef){_0xdd76ef=_0xdd76ef||0xcc;return function(_0x51d524){if(_0x51d524){return _0x31abf1[_0xe614('0x18')](_0xdd76ef);}return _0x31abf1[_0xe614('0x19')](_0xdd76ef)['end']();};}function respondWithResult(_0x4c5077,_0x5712de){_0x5712de=_0x5712de||0xc8;return function(_0x42e07c){if(_0x42e07c){return _0x4c5077[_0xe614('0x19')](_0x5712de)[_0xe614('0x1a')](_0x42e07c);}};}function respondWithFilteredResult(_0x23505a,_0x34dd00){return function(_0x2e9216){if(_0x2e9216){var _0x5f02c3=_0x2e9216['count'],_0x424fb2=_0x34dd00['offset'],_0x4fbebe=_0x34dd00['offset']+_0x34dd00[_0xe614('0x1b')],_0x5d2de4;if(_0x4fbebe>=_0x5f02c3){_0x4fbebe=_0x5f02c3;_0x5d2de4=0xc8;}else{_0x5d2de4=0xce;}_0x23505a[_0xe614('0x19')](_0x5d2de4);return _0x23505a[_0xe614('0x1c')](_0xe614('0x1d'),_0x424fb2+'-'+_0x4fbebe+'/'+_0x5f02c3)[_0xe614('0x1a')](_0x2e9216);}return null;};}function patchUpdates(_0x123c13){return function(_0xf9d5d8){try{jsonpatch[_0xe614('0x1e')](_0xf9d5d8,_0x123c13,!![]);}catch(_0x35e02a){return BPromise[_0xe614('0x1f')](_0x35e02a);}return _0xf9d5d8[_0xe614('0x20')]();};}function saveUpdates(_0x160b40,_0xc7a61f){return function(_0x55a7e6){if(_0x55a7e6){return _0x55a7e6[_0xe614('0x21')](_0x160b40)[_0xe614('0x22')](function(_0x362a78){return _0x362a78;});}return null;};}function removeEntity(_0x122f94,_0x11e2f1){return function(_0x2c6232){if(_0x2c6232){return _0x2c6232[_0xe614('0x23')]()[_0xe614('0x22')](function(){_0x122f94['status'](0xcc)[_0xe614('0x24')]();});}};}function handleEntityNotFound(_0x5ab1c9,_0x1ba2aa){return function(_0x2c79a1){if(!_0x2c79a1){_0x5ab1c9[_0xe614('0x18')](0x194);}return _0x2c79a1;};}function handleError(_0x32f0a0,_0x51de5d){_0x51de5d=_0x51de5d||0x1f4;return function(_0x406b7b){logger['error'](_0x406b7b[_0xe614('0x25')]);if(_0x406b7b['name']){delete _0x406b7b[_0xe614('0x26')];}_0x32f0a0[_0xe614('0x19')](_0x51de5d)[_0xe614('0x27')](_0x406b7b);};}exports[_0xe614('0x28')]=function(_0x217617,_0x507b3e){var _0xddc43a={},_0x51a22a={},_0x1bd0c8={'count':0x0,'rows':[]};var _0x56b06c=_[_0xe614('0x29')](db['SquareReport'][_0xe614('0x2a')],function(_0x53a8d7){return{'name':_0x53a8d7[_0xe614('0x2b')],'type':_0x53a8d7[_0xe614('0x2c')][_0xe614('0x2d')]};});_0x51a22a['model']=_['map'](_0x56b06c,_0xe614('0x26'));_0x51a22a['query']=_[_0xe614('0x2e')](_0x217617[_0xe614('0x2f')]);_0x51a22a['filters']=_['intersection'](_0x51a22a['model'],_0x51a22a[_0xe614('0x2f')]);_0xddc43a[_0xe614('0x30')]=_[_0xe614('0x31')](_0x51a22a['model'],qs['fields'](_0x217617[_0xe614('0x2f')][_0xe614('0x32')]));_0xddc43a['attributes']=_0xddc43a[_0xe614('0x30')][_0xe614('0x33')]?_0xddc43a[_0xe614('0x30')]:_0x51a22a['model'];if(!_0x217617[_0xe614('0x2f')]['hasOwnProperty'](_0xe614('0x34'))){_0xddc43a[_0xe614('0x1b')]=qs[_0xe614('0x1b')](_0x217617['query'][_0xe614('0x1b')]);_0xddc43a[_0xe614('0x35')]=qs[_0xe614('0x35')](_0x217617[_0xe614('0x2f')][_0xe614('0x35')]);}_0xddc43a['order']=qs[_0xe614('0x36')](_0x217617[_0xe614('0x2f')][_0xe614('0x36')]);_0xddc43a[_0xe614('0x37')]=qs[_0xe614('0x38')](_[_0xe614('0x39')](_0x217617[_0xe614('0x2f')],_0x51a22a[_0xe614('0x38')]),_0x56b06c);if(_0x217617[_0xe614('0x2f')][_0xe614('0x3a')]){_0xddc43a[_0xe614('0x37')]=_[_0xe614('0x3b')](_0xddc43a['where'],{'$or':_[_0xe614('0x29')](_0x56b06c,function(_0x5f1730){if(_0x5f1730[_0xe614('0x2c')]!=='VIRTUAL'){var _0x3eda8e={};_0x3eda8e[_0x5f1730[_0xe614('0x26')]]={'$like':'%'+_0x217617[_0xe614('0x2f')][_0xe614('0x3a')]+'%'};return _0x3eda8e;}})});}_0xddc43a=_['merge']({},_0xddc43a,_0x217617[_0xe614('0x3c')]);var _0x592c6e={'where':_0xddc43a[_0xe614('0x37')]};return db[_0xe614('0x3d')][_0xe614('0x3e')](_0x592c6e)[_0xe614('0x22')](function(_0x349447){_0x1bd0c8[_0xe614('0x3e')]=_0x349447;if(_0x217617['query'][_0xe614('0x3f')]){_0xddc43a[_0xe614('0x40')]=[{'all':!![]}];}return db[_0xe614('0x3d')][_0xe614('0x41')](_0xddc43a);})[_0xe614('0x22')](function(_0x565e00){_0x1bd0c8['rows']=_0x565e00;return _0x1bd0c8;})[_0xe614('0x22')](respondWithFilteredResult(_0x507b3e,_0xddc43a))[_0xe614('0x42')](handleError(_0x507b3e,null));};exports[_0xe614('0x43')]=function(_0x451684,_0x2e6bc4){var _0x45ac49={'raw':!![],'where':{'id':_0x451684['params']['id']}},_0x1b2d9f={};_0x1b2d9f[_0xe614('0x44')]=_[_0xe614('0x2e')](db[_0xe614('0x3d')][_0xe614('0x2a')]);_0x1b2d9f[_0xe614('0x2f')]=_[_0xe614('0x2e')](_0x451684[_0xe614('0x2f')]);_0x1b2d9f[_0xe614('0x38')]=_[_0xe614('0x31')](_0x1b2d9f['model'],_0x1b2d9f[_0xe614('0x2f')]);_0x45ac49[_0xe614('0x30')]=_[_0xe614('0x31')](_0x1b2d9f[_0xe614('0x44')],qs[_0xe614('0x32')](_0x451684['query'][_0xe614('0x32')]));_0x45ac49['attributes']=_0x45ac49['attributes'][_0xe614('0x33')]?_0x45ac49['attributes']:_0x1b2d9f[_0xe614('0x44')];if(_0x451684[_0xe614('0x2f')][_0xe614('0x3f')]){_0x45ac49[_0xe614('0x40')]=[{'all':!![]}];}_0x45ac49=_['merge']({},_0x45ac49,_0x451684[_0xe614('0x3c')]);return db['SquareReport'][_0xe614('0x45')](_0x45ac49)[_0xe614('0x22')](handleEntityNotFound(_0x2e6bc4,null))[_0xe614('0x22')](respondWithResult(_0x2e6bc4,null))['catch'](handleError(_0x2e6bc4,null));};exports[_0xe614('0x46')]=function(_0x24a1e2,_0x2763dd){return db[_0xe614('0x3d')][_0xe614('0x46')](_0x24a1e2['body'],{})[_0xe614('0x22')](respondWithResult(_0x2763dd,0xc9))['catch'](handleError(_0x2763dd,null));};exports[_0xe614('0x21')]=function(_0x226a26,_0x14e94c){if(_0x226a26[_0xe614('0x47')]['id']){delete _0x226a26[_0xe614('0x47')]['id'];}return db[_0xe614('0x3d')][_0xe614('0x45')]({'where':{'id':_0x226a26[_0xe614('0x48')]['id']}})[_0xe614('0x22')](handleEntityNotFound(_0x14e94c,null))['then'](saveUpdates(_0x226a26[_0xe614('0x47')],null))[_0xe614('0x22')](respondWithResult(_0x14e94c,null))[_0xe614('0x42')](handleError(_0x14e94c,null));};exports[_0xe614('0x23')]=function(_0x5df391,_0x46af37){return db[_0xe614('0x3d')][_0xe614('0x45')]({'where':{'id':_0x5df391[_0xe614('0x48')]['id']}})[_0xe614('0x22')](handleEntityNotFound(_0x46af37,null))[_0xe614('0x22')](removeEntity(_0x46af37,null))['catch'](handleError(_0x46af37,null));};exports['describe']=function(_0x26eccf,_0x3984fc){return db['SquareReport'][_0xe614('0x49')]()[_0xe614('0x22')](respondWithResult(_0x3984fc,null))[_0xe614('0x42')](handleError(_0x3984fc,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index b782fd4..9f8170a 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 _0xfee1=['define','SquareReport','report_square','uid_pname','uniqueid','project_name','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xfee1,0x106));var _0x1fee=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xfee1[_0x18abd2];return _0x1dcad6;};'use strict';var _=require(_0x1fee('0x0'));var util=require(_0x1fee('0x1'));var logger=require(_0x1fee('0x2'))('api');var moment=require(_0x1fee('0x3'));var BPromise=require(_0x1fee('0x4'));var rp=require(_0x1fee('0x5'));var fs=require('fs');var path=require(_0x1fee('0x6'));var rimraf=require(_0x1fee('0x7'));var config=require(_0x1fee('0x8'));var attributes=require('./squareReport.attributes');module[_0x1fee('0x9')]=function(_0x16bea2,_0x1d3a1e){return _0x16bea2[_0x1fee('0xa')](_0x1fee('0xb'),attributes,{'tableName':_0x1fee('0xc'),'paranoid':![],'indexes':[{'name':_0x1fee('0xd'),'fields':[_0x1fee('0xe'),_0x1fee('0xf')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d54=['./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','api','moment','path','rimraf','../../config/environment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9d54,0x1b5));var _0x49d5=function(_0x409091,_0x55494d){_0x409091=_0x409091-0x0;var _0x44a4a2=_0x9d54[_0x409091];return _0x44a4a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x49d5('0x0'));var moment=require(_0x49d5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x49d5('0x2'));var rimraf=require(_0x49d5('0x3'));var config=require(_0x49d5('0x4'));var attributes=require(_0x49d5('0x5'));module[_0x49d5('0x6')]=function(_0x40b13b,_0x50dcf4){return _0x40b13b[_0x49d5('0x7')](_0x49d5('0x8'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x49d5('0x9'),'fields':[_0x49d5('0xa'),_0x49d5('0xb')]},{'name':_0x49d5('0xc'),'fields':[_0x49d5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index f4dd9c3..119970b 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 _0x8d0e=['../../config/environment','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareReport','create','options','CreateSquareReport','debug','update','body','raw','where','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4db4f2,_0x422e88){var _0x4ccfee=function(_0xf74f82){while(--_0xf74f82){_0x4db4f2['push'](_0x4db4f2['shift']());}};_0x4ccfee(++_0x422e88);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x196bef,_0x5ae3cf){_0x196bef=_0x196bef-0x0;var _0xa75d96=_0x8d0e[_0x196bef];return _0xa75d96;};'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});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){return client[_0xe8d0('0xb')](_0x92483d,_0xcc03d0)[_0xe8d0('0xc')](function(_0x5605a0){logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,_0xe8d0('0xf'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x469d37,_0xe8d0('0xf'),JSON[_0xe8d0('0x10')](_0x5605a0));if(_0x5605a0[_0xe8d0('0x11')]){if(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x12')]===0x1f4){logger[_0xe8d0('0x11')]('SquareReport,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x13aa63(_0x5605a0['error'][_0xe8d0('0x13')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x2b6dce(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);}else{logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,'request\x20sent');_0x2b6dce(_0x5605a0[_0xe8d0('0x14')]['message']);}})[_0xe8d0('0x15')](function(_0x3c526c){logger[_0xe8d0('0x11')]('SquareReport,\x20%s,\x20%s',_0x469d37,_0x3c526c);_0x13aa63(_0x3c526c);});});}exports['CreateSquareReport']=function(_0x47c67a){var _0x1bdd94=this;return new Promise(function(_0x384854,_0x27b910){return db[_0xe8d0('0x16')][_0xe8d0('0x17')](_0x47c67a['body'],{'raw':_0x47c67a[_0xe8d0('0x18')]?_0x47c67a[_0xe8d0('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x554402){logger[_0xe8d0('0xd')](_0xe8d0('0x19'),_0x47c67a);logger[_0xe8d0('0x1a')](_0xe8d0('0x19'),_0x47c67a,JSON[_0xe8d0('0x10')](_0x554402));_0x384854(_0x554402);})[_0xe8d0('0x15')](function(_0x1bd25c){logger[_0xe8d0('0x11')](_0xe8d0('0x19'),_0x1bd25c['message'],_0x47c67a);_0x27b910(_0x1bdd94[_0xe8d0('0x11')](0x1f4,_0x1bd25c[_0xe8d0('0x13')]));});});};exports['UpdateSquareReport']=function(_0x106614){var _0x2e69d1=this;return new Promise(function(_0x274cac,_0xd86c76){return db[_0xe8d0('0x16')][_0xe8d0('0x1b')](_0x106614[_0xe8d0('0x1c')],{'raw':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')][_0xe8d0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x106614[_0xe8d0('0x18')]?_0x106614['options'][_0xe8d0('0x1e')]||null:null,'attributes':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')]['attributes']||null:null,'limit':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')]['limit']||null:null})[_0xe8d0('0xc')](function(_0x3ffcb7){logger[_0xe8d0('0xd')](_0xe8d0('0x1f'),_0x106614);logger[_0xe8d0('0x1a')]('UpdateSquareReport',_0x106614,JSON[_0xe8d0('0x10')](_0x3ffcb7));_0x274cac(_0x3ffcb7);})['catch'](function(_0x5d3276){logger['error'](_0xe8d0('0x1f'),_0x5d3276[_0xe8d0('0x13')],_0x106614);_0xd86c76(_0x2e69d1[_0xe8d0('0x11')](0x1f4,_0x5d3276['message']));});});}; \ No newline at end of file +var _0x4b84=['CreateSquareReport','SquareReport','create','options','raw','catch','UpdateSquareReport','update','body','where','attributes','limit','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message'];(function(_0x20a95f,_0x555cbe){var _0x3207be=function(_0xcc018f){while(--_0xcc018f){_0x20a95f['push'](_0x20a95f['shift']());}};_0x3207be(++_0x555cbe);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0x4b84[_0x2b5513];return _0x578fd2;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('SquareReport,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('SquareReport,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});}exports[_0x44b8('0x10')]=function(_0x55e258){var _0x36743e=this;return new Promise(function(_0xe3de8f,_0x5103f5){return db[_0x44b8('0x11')][_0x44b8('0x12')](_0x55e258['body'],{'raw':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x14')]===undefined?!![]:![]:!![]})[_0x44b8('0x7')](function(_0x102ef9){logger[_0x44b8('0x8')](_0x44b8('0x10'),_0x55e258);logger[_0x44b8('0xa')](_0x44b8('0x10'),_0x55e258,JSON[_0x44b8('0xc')](_0x102ef9));_0xe3de8f(_0x102ef9);})[_0x44b8('0x15')](function(_0x14996c){logger['error'](_0x44b8('0x10'),_0x14996c[_0x44b8('0xf')],_0x55e258);_0x5103f5(_0x36743e[_0x44b8('0xd')](0x1f4,_0x14996c[_0x44b8('0xf')]));});});};exports[_0x44b8('0x16')]=function(_0x51a34a){var _0x402497=this;return new Promise(function(_0x54677c,_0x41a922){return db[_0x44b8('0x11')][_0x44b8('0x17')](_0x51a34a[_0x44b8('0x18')],{'raw':_0x51a34a[_0x44b8('0x13')]?_0x51a34a['options'][_0x44b8('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51a34a['options']?_0x51a34a[_0x44b8('0x13')][_0x44b8('0x19')]||null:null,'attributes':_0x51a34a['options']?_0x51a34a[_0x44b8('0x13')][_0x44b8('0x1a')]||null:null,'limit':_0x51a34a[_0x44b8('0x13')]?_0x51a34a['options'][_0x44b8('0x1b')]||null:null})[_0x44b8('0x7')](function(_0x53d9c7){logger[_0x44b8('0x8')]('UpdateSquareReport',_0x51a34a);logger[_0x44b8('0xa')]('UpdateSquareReport',_0x51a34a,JSON['stringify'](_0x53d9c7));_0x54677c(_0x53d9c7);})['catch'](function(_0x387293){logger[_0x44b8('0xd')](_0x44b8('0x16'),_0x387293[_0x44b8('0xf')],_0x51a34a);_0x41a922(_0x402497[_0x44b8('0xd')](0x1f4,_0x387293[_0x44b8('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index d22d912..6d2e6e2 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 _0x54f2=['update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/describe','get','/:id','show','post','create'];(function(_0x4c7e7b,_0x2e6c49){var _0x83eb34=function(_0x5c726b){while(--_0x5c726b){_0x4c7e7b['push'](_0x4c7e7b['shift']());}};_0x83eb34(++_0x2e6c49);}(_0x54f2,0x1d8));var _0x254f=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x54f2[_0x36c5b0];return _0xf19333;};'use strict';var multer=require('multer');var util=require(_0x254f('0x0'));var path=require('path');var timeout=require(_0x254f('0x1'));var express=require(_0x254f('0x2'));var router=express[_0x254f('0x3')]();var fs_extra=require(_0x254f('0x4'));var auth=require(_0x254f('0x5'));var interaction=require(_0x254f('0x6'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x254f('0x7')](),controller['index']);router['get'](_0x254f('0x8'),auth[_0x254f('0x7')](),controller['describe']);router[_0x254f('0x9')](_0x254f('0xa'),auth[_0x254f('0x7')](),controller[_0x254f('0xb')]);router[_0x254f('0xc')]('/',auth[_0x254f('0x7')](),controller[_0x254f('0xd')]);router['put'](_0x254f('0xa'),auth[_0x254f('0x7')](),controller[_0x254f('0xe')]);router[_0x254f('0xf')]('/:id',auth[_0x254f('0x7')](),controller[_0x254f('0x10')]);module[_0x254f('0x11')]=router; \ No newline at end of file +var _0x9ca0=['../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','post','create','put','/:id','update','destroy','exports','path','express','fs-extra','../../components/auth/service'];(function(_0x54a02b,_0x17726d){var _0x35e0c9=function(_0x879191){while(--_0x879191){_0x54a02b['push'](_0x54a02b['shift']());}};_0x35e0c9(++_0x17726d);}(_0x9ca0,0x1ac));var _0x09ca=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x9ca0[_0xf0bcac];return _0x4e4c65;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x09ca('0x0'));var timeout=require('connect-timeout');var express=require(_0x09ca('0x1'));var router=express['Router']();var fs_extra=require(_0x09ca('0x2'));var auth=require(_0x09ca('0x3'));var interaction=require(_0x09ca('0x4'));var config=require(_0x09ca('0x5'));var controller=require(_0x09ca('0x6'));router[_0x09ca('0x7')]('/',auth[_0x09ca('0x8')](),controller[_0x09ca('0x9')]);router[_0x09ca('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x09ca('0xa')]);router[_0x09ca('0x7')]('/:id',auth[_0x09ca('0x8')](),controller['show']);router[_0x09ca('0xb')]('/',auth['isAuthenticated'](),controller[_0x09ca('0xc')]);router[_0x09ca('0xd')](_0x09ca('0xe'),auth[_0x09ca('0x8')](),controller[_0x09ca('0xf')]);router['delete'](_0x09ca('0xe'),auth['isAuthenticated'](),controller[_0x09ca('0x10')]);module[_0x09ca('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 6cdacc6..8019f60 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 _0x06a5=['STRING','TEXT'];(function(_0xc29be3,_0x377032){var _0x15a466=function(_0x236532){while(--_0x236532){_0xc29be3['push'](_0xc29be3['shift']());}};_0x15a466(++_0x377032);}(_0x06a5,0x112));var _0x506a=function(_0x2f4abe,_0x257fd4){_0x2f4abe=_0x2f4abe-0x0;var _0x30797b=_0x06a5[_0x2f4abe];return _0x30797b;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x506a('0x0')]},'node':{'type':Sequelize[_0x506a('0x0')]},'application':{'type':Sequelize[_0x506a('0x0')]},'data':{'type':Sequelize[_0x506a('0x1')]},'project_name':{'type':Sequelize[_0x506a('0x0')]},'callerid':{'type':Sequelize[_0x506a('0x0')]}}; \ No newline at end of file +var _0x54e9=['sequelize','STRING','TEXT'];(function(_0x4e4e5a,_0x237d70){var _0xe64290=function(_0x5d7668){while(--_0x5d7668){_0x4e4e5a['push'](_0x4e4e5a['shift']());}};_0xe64290(++_0x237d70);}(_0x54e9,0xcc));var _0x954e=function(_0x2fbd0e,_0x3460a9){_0x2fbd0e=_0x2fbd0e-0x0;var _0x481c9f=_0x54e9[_0x2fbd0e];return _0x481c9f;};'use strict';var Sequelize=require(_0x954e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x954e('0x1')]},'node':{'type':Sequelize[_0x954e('0x1')]},'application':{'type':Sequelize[_0x954e('0x1')]},'data':{'type':Sequelize[_0x954e('0x2')]},'project_name':{'type':Sequelize[_0x954e('0x1')]},'callerid':{'type':Sequelize[_0x954e('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 58caa1a..190fa27 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 _0x1b7e=['map','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','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','sendStatus','status','end','json','offset','set','apply','reject','save','update','destroy','then','error','name','send','index','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge'];(function(_0x421c02,_0x156783){var _0x208b7a=function(_0x43a54b){while(--_0x43a54b){_0x421c02['push'](_0x421c02['shift']());}};_0x208b7a(++_0x156783);}(_0x1b7e,0x1f0));var _0xe1b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b7e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe1b7('0x0'));var emlformat=require(_0xe1b7('0x1'));var rimraf=require(_0xe1b7('0x2'));var zipdir=require(_0xe1b7('0x3'));var jsonpatch=require(_0xe1b7('0x4'));var rp=require(_0xe1b7('0x5'));var moment=require('moment');var BPromise=require(_0xe1b7('0x6'));var Mustache=require(_0xe1b7('0x7'));var util=require('util');var path=require(_0xe1b7('0x8'));var sox=require(_0xe1b7('0x9'));var csv=require('to-csv');var ejs=require(_0xe1b7('0xa'));var fs=require('fs');var fs_extra=require(_0xe1b7('0xb'));var _=require(_0xe1b7('0xc'));var squel=require(_0xe1b7('0xd'));var crypto=require(_0xe1b7('0xe'));var jsforce=require(_0xe1b7('0xf'));var deskjs=require(_0xe1b7('0x10'));var toCsv=require(_0xe1b7('0x11'));var querystring=require(_0xe1b7('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe1b7('0x13'));var qs=require(_0xe1b7('0x14'));var as=require(_0xe1b7('0x15'));var hardwareService=require(_0xe1b7('0x16'));var logger=require('../../config/logger')(_0xe1b7('0x17'));var utils=require(_0xe1b7('0x18'));var config=require(_0xe1b7('0x19'));var licenseUtil=require(_0xe1b7('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27c47e,_0x42906f){_0x42906f=_0x42906f||0xcc;return function(_0x4375c2){if(_0x4375c2){return _0x27c47e[_0xe1b7('0x1b')](_0x42906f);}return _0x27c47e[_0xe1b7('0x1c')](_0x42906f)[_0xe1b7('0x1d')]();};}function respondWithResult(_0xdaa63c,_0x3f94fd){_0x3f94fd=_0x3f94fd||0xc8;return function(_0x2c1a17){if(_0x2c1a17){return _0xdaa63c['status'](_0x3f94fd)[_0xe1b7('0x1e')](_0x2c1a17);}};}function respondWithFilteredResult(_0x2e5144,_0x57d167){return function(_0x343fc8){if(_0x343fc8){var _0x5c6581=_0x343fc8['count'],_0x959b32=_0x57d167[_0xe1b7('0x1f')],_0x282cf7=_0x57d167[_0xe1b7('0x1f')]+_0x57d167['limit'],_0x2c2d6a;if(_0x282cf7>=_0x5c6581){_0x282cf7=_0x5c6581;_0x2c2d6a=0xc8;}else{_0x2c2d6a=0xce;}_0x2e5144[_0xe1b7('0x1c')](_0x2c2d6a);return _0x2e5144[_0xe1b7('0x20')]('Content-Range',_0x959b32+'-'+_0x282cf7+'/'+_0x5c6581)[_0xe1b7('0x1e')](_0x343fc8);}return null;};}function patchUpdates(_0x49d165){return function(_0x2adc2e){try{jsonpatch[_0xe1b7('0x21')](_0x2adc2e,_0x49d165,!![]);}catch(_0x48304c){return BPromise[_0xe1b7('0x22')](_0x48304c);}return _0x2adc2e[_0xe1b7('0x23')]();};}function saveUpdates(_0x13a4a7,_0x27dfa8){return function(_0xcd14a){if(_0xcd14a){return _0xcd14a[_0xe1b7('0x24')](_0x13a4a7)['then'](function(_0x54abc2){return _0x54abc2;});}return null;};}function removeEntity(_0x4c30e3,_0x9fdbd8){return function(_0x51538b){if(_0x51538b){return _0x51538b[_0xe1b7('0x25')]()[_0xe1b7('0x26')](function(){_0x4c30e3['status'](0xcc)[_0xe1b7('0x1d')]();});}};}function handleEntityNotFound(_0x33c667,_0x2f4a86){return function(_0xfa5067){if(!_0xfa5067){_0x33c667[_0xe1b7('0x1b')](0x194);}return _0xfa5067;};}function handleError(_0x5bb429,_0x3469b3){_0x3469b3=_0x3469b3||0x1f4;return function(_0x30e1ed){logger[_0xe1b7('0x27')](_0x30e1ed['stack']);if(_0x30e1ed['name']){delete _0x30e1ed[_0xe1b7('0x28')];}_0x5bb429[_0xe1b7('0x1c')](_0x3469b3)[_0xe1b7('0x29')](_0x30e1ed);};}exports[_0xe1b7('0x2a')]=function(_0x5d46f2,_0x50ca5b){var _0x167bbe={},_0x284be4={},_0x517d7d={'count':0x0,'rows':[]};var _0x39f984=_['map'](db[_0xe1b7('0x2b')][_0xe1b7('0x2c')],function(_0x4784a3){return{'name':_0x4784a3[_0xe1b7('0x2d')],'type':_0x4784a3['type'][_0xe1b7('0x2e')]};});_0x284be4[_0xe1b7('0x2f')]=_['map'](_0x39f984,_0xe1b7('0x28'));_0x284be4[_0xe1b7('0x30')]=_[_0xe1b7('0x31')](_0x5d46f2[_0xe1b7('0x30')]);_0x284be4['filters']=_[_0xe1b7('0x32')](_0x284be4[_0xe1b7('0x2f')],_0x284be4[_0xe1b7('0x30')]);_0x167bbe[_0xe1b7('0x33')]=_[_0xe1b7('0x32')](_0x284be4[_0xe1b7('0x2f')],qs[_0xe1b7('0x34')](_0x5d46f2[_0xe1b7('0x30')][_0xe1b7('0x34')]));_0x167bbe['attributes']=_0x167bbe['attributes'][_0xe1b7('0x35')]?_0x167bbe[_0xe1b7('0x33')]:_0x284be4[_0xe1b7('0x2f')];if(!_0x5d46f2[_0xe1b7('0x30')][_0xe1b7('0x36')](_0xe1b7('0x37'))){_0x167bbe[_0xe1b7('0x38')]=qs['limit'](_0x5d46f2[_0xe1b7('0x30')][_0xe1b7('0x38')]);_0x167bbe['offset']=qs[_0xe1b7('0x1f')](_0x5d46f2['query'][_0xe1b7('0x1f')]);}_0x167bbe[_0xe1b7('0x39')]=qs['sort'](_0x5d46f2[_0xe1b7('0x30')][_0xe1b7('0x3a')]);_0x167bbe[_0xe1b7('0x3b')]=qs[_0xe1b7('0x3c')](_[_0xe1b7('0x3d')](_0x5d46f2[_0xe1b7('0x30')],_0x284be4[_0xe1b7('0x3c')]),_0x39f984);if(_0x5d46f2['query'][_0xe1b7('0x3e')]){_0x167bbe[_0xe1b7('0x3b')]=_[_0xe1b7('0x3f')](_0x167bbe[_0xe1b7('0x3b')],{'$or':_[_0xe1b7('0x40')](_0x39f984,function(_0x399fa5){if(_0x399fa5[_0xe1b7('0x41')]!==_0xe1b7('0x42')){var _0xeb95b8={};_0xeb95b8[_0x399fa5['name']]={'$like':'%'+_0x5d46f2[_0xe1b7('0x30')][_0xe1b7('0x3e')]+'%'};return _0xeb95b8;}})});}_0x167bbe=_['merge']({},_0x167bbe,_0x5d46f2[_0xe1b7('0x43')]);var _0x5d6f91={'where':_0x167bbe[_0xe1b7('0x3b')]};return db[_0xe1b7('0x2b')][_0xe1b7('0x44')](_0x5d6f91)['then'](function(_0x564f9f){_0x517d7d['count']=_0x564f9f;if(_0x5d46f2[_0xe1b7('0x30')][_0xe1b7('0x45')]){_0x167bbe[_0xe1b7('0x46')]=[{'all':!![]}];}return db[_0xe1b7('0x2b')][_0xe1b7('0x47')](_0x167bbe);})['then'](function(_0xd4f150){_0x517d7d[_0xe1b7('0x48')]=_0xd4f150;return _0x517d7d;})[_0xe1b7('0x26')](respondWithFilteredResult(_0x50ca5b,_0x167bbe))[_0xe1b7('0x49')](handleError(_0x50ca5b,null));};exports[_0xe1b7('0x4a')]=function(_0x4addce,_0x459d66){var _0x23a208={'raw':!![],'where':{'id':_0x4addce[_0xe1b7('0x4b')]['id']}},_0x23ed7f={};_0x23ed7f[_0xe1b7('0x2f')]=_[_0xe1b7('0x31')](db[_0xe1b7('0x2b')][_0xe1b7('0x2c')]);_0x23ed7f[_0xe1b7('0x30')]=_['keys'](_0x4addce['query']);_0x23ed7f[_0xe1b7('0x3c')]=_[_0xe1b7('0x32')](_0x23ed7f['model'],_0x23ed7f['query']);_0x23a208['attributes']=_['intersection'](_0x23ed7f[_0xe1b7('0x2f')],qs[_0xe1b7('0x34')](_0x4addce[_0xe1b7('0x30')][_0xe1b7('0x34')]));_0x23a208[_0xe1b7('0x33')]=_0x23a208[_0xe1b7('0x33')]['length']?_0x23a208[_0xe1b7('0x33')]:_0x23ed7f[_0xe1b7('0x2f')];if(_0x4addce['query'][_0xe1b7('0x45')]){_0x23a208['include']=[{'all':!![]}];}_0x23a208=_[_0xe1b7('0x3f')]({},_0x23a208,_0x4addce[_0xe1b7('0x43')]);return db[_0xe1b7('0x2b')]['find'](_0x23a208)[_0xe1b7('0x26')](handleEntityNotFound(_0x459d66,null))[_0xe1b7('0x26')](respondWithResult(_0x459d66,null))[_0xe1b7('0x49')](handleError(_0x459d66,null));};exports[_0xe1b7('0x4c')]=function(_0x31d6a9,_0x262a8f){return db[_0xe1b7('0x2b')][_0xe1b7('0x4c')](_0x31d6a9[_0xe1b7('0x4d')],{})[_0xe1b7('0x26')](respondWithResult(_0x262a8f,0xc9))[_0xe1b7('0x49')](handleError(_0x262a8f,null));};exports[_0xe1b7('0x24')]=function(_0x4a2d7f,_0x201f5f){if(_0x4a2d7f[_0xe1b7('0x4d')]['id']){delete _0x4a2d7f[_0xe1b7('0x4d')]['id'];}return db[_0xe1b7('0x2b')]['find']({'where':{'id':_0x4a2d7f['params']['id']}})['then'](handleEntityNotFound(_0x201f5f,null))[_0xe1b7('0x26')](saveUpdates(_0x4a2d7f[_0xe1b7('0x4d')],null))['then'](respondWithResult(_0x201f5f,null))[_0xe1b7('0x49')](handleError(_0x201f5f,null));};exports[_0xe1b7('0x25')]=function(_0x22dca9,_0x5ca1e5){return db[_0xe1b7('0x2b')][_0xe1b7('0x4e')]({'where':{'id':_0x22dca9[_0xe1b7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5ca1e5,null))[_0xe1b7('0x26')](removeEntity(_0x5ca1e5,null))[_0xe1b7('0x49')](handleError(_0x5ca1e5,null));};exports['describe']=function(_0x5c93b9,_0x9444be){return db['SquareDetailsReport'][_0xe1b7('0x4f')]()['then'](respondWithResult(_0x9444be,null))['catch'](handleError(_0x9444be,null));}; \ No newline at end of file +var _0x474b=['query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','then','includeAll','include','show','params','intersection','find','catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','error','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model'];(function(_0x520761,_0x24d496){var _0x44caf4=function(_0x237d19){while(--_0x237d19){_0x520761['push'](_0x520761['shift']());}};_0x44caf4(++_0x24d496);}(_0x474b,0x14c));var _0xb474=function(_0x337be6,_0xff25a3){_0x337be6=_0x337be6-0x0;var _0x3a108b=_0x474b[_0x337be6];return _0x3a108b;};'use strict';var pdf=require(_0xb474('0x0'));var emlformat=require(_0xb474('0x1'));var rimraf=require(_0xb474('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb474('0x3'));var rp=require(_0xb474('0x4'));var moment=require(_0xb474('0x5'));var BPromise=require(_0xb474('0x6'));var Mustache=require(_0xb474('0x7'));var util=require(_0xb474('0x8'));var path=require(_0xb474('0x9'));var sox=require(_0xb474('0xa'));var csv=require(_0xb474('0xb'));var ejs=require(_0xb474('0xc'));var fs=require('fs');var fs_extra=require(_0xb474('0xd'));var _=require(_0xb474('0xe'));var squel=require(_0xb474('0xf'));var crypto=require(_0xb474('0x10'));var jsforce=require(_0xb474('0x11'));var deskjs=require(_0xb474('0x12'));var toCsv=require(_0xb474('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb474('0x13'));var qs=require(_0xb474('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb474('0x15'));var logger=require(_0xb474('0x16'))(_0xb474('0x17'));var utils=require(_0xb474('0x18'));var config=require(_0xb474('0x19'));var licenseUtil=require(_0xb474('0x1a'));var db=require(_0xb474('0x1b'))['db'];function respondWithStatusCode(_0x51e310,_0xbe8647){_0xbe8647=_0xbe8647||0xcc;return function(_0x2b77c0){if(_0x2b77c0){return _0x51e310[_0xb474('0x1c')](_0xbe8647);}return _0x51e310[_0xb474('0x1d')](_0xbe8647)[_0xb474('0x1e')]();};}function respondWithResult(_0x12be12,_0x7ab0db){_0x7ab0db=_0x7ab0db||0xc8;return function(_0x2c3c1d){if(_0x2c3c1d){return _0x12be12['status'](_0x7ab0db)[_0xb474('0x1f')](_0x2c3c1d);}};}function respondWithFilteredResult(_0x54eeb3,_0x1b2910){return function(_0x23413b){if(_0x23413b){var _0x3003b0=_0x23413b[_0xb474('0x20')],_0xacf44=_0x1b2910[_0xb474('0x21')],_0x2c4c71=_0x1b2910[_0xb474('0x21')]+_0x1b2910['limit'],_0x172dfe;if(_0x2c4c71>=_0x3003b0){_0x2c4c71=_0x3003b0;_0x172dfe=0xc8;}else{_0x172dfe=0xce;}_0x54eeb3[_0xb474('0x1d')](_0x172dfe);return _0x54eeb3[_0xb474('0x22')](_0xb474('0x23'),_0xacf44+'-'+_0x2c4c71+'/'+_0x3003b0)['json'](_0x23413b);}return null;};}function patchUpdates(_0x5a4432){return function(_0x56ed3d){try{jsonpatch['apply'](_0x56ed3d,_0x5a4432,!![]);}catch(_0xbb95b6){return BPromise['reject'](_0xbb95b6);}return _0x56ed3d[_0xb474('0x24')]();};}function saveUpdates(_0x13c490,_0x192240){return function(_0x5afd26){if(_0x5afd26){return _0x5afd26[_0xb474('0x25')](_0x13c490)['then'](function(_0x36c647){return _0x36c647;});}return null;};}function removeEntity(_0x5c9d6c,_0x4718db){return function(_0x5d3641){if(_0x5d3641){return _0x5d3641['destroy']()['then'](function(){_0x5c9d6c[_0xb474('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x225bcf,_0x47d90c){return function(_0x2d75d2){if(!_0x2d75d2){_0x225bcf[_0xb474('0x1c')](0x194);}return _0x2d75d2;};}function handleError(_0x2ea9e9,_0x4b9cdf){_0x4b9cdf=_0x4b9cdf||0x1f4;return function(_0x8a99a){logger[_0xb474('0x26')](_0x8a99a['stack']);if(_0x8a99a[_0xb474('0x27')]){delete _0x8a99a['name'];}_0x2ea9e9[_0xb474('0x1d')](_0x4b9cdf)['send'](_0x8a99a);};}exports[_0xb474('0x28')]=function(_0x4f8f14,_0x11d0dd){var _0x545486={},_0x3dad58={},_0x2e6e85={'count':0x0,'rows':[]};var _0x2b0364=_[_0xb474('0x29')](db[_0xb474('0x2a')][_0xb474('0x2b')],function(_0x33c0ca){return{'name':_0x33c0ca[_0xb474('0x2c')],'type':_0x33c0ca[_0xb474('0x2d')][_0xb474('0x2e')]};});_0x3dad58[_0xb474('0x2f')]=_[_0xb474('0x29')](_0x2b0364,'name');_0x3dad58[_0xb474('0x30')]=_[_0xb474('0x31')](_0x4f8f14[_0xb474('0x30')]);_0x3dad58[_0xb474('0x32')]=_['intersection'](_0x3dad58[_0xb474('0x2f')],_0x3dad58[_0xb474('0x30')]);_0x545486['attributes']=_['intersection'](_0x3dad58[_0xb474('0x2f')],qs[_0xb474('0x33')](_0x4f8f14['query'][_0xb474('0x33')]));_0x545486[_0xb474('0x34')]=_0x545486['attributes'][_0xb474('0x35')]?_0x545486[_0xb474('0x34')]:_0x3dad58[_0xb474('0x2f')];if(!_0x4f8f14[_0xb474('0x30')][_0xb474('0x36')](_0xb474('0x37'))){_0x545486['limit']=qs[_0xb474('0x38')](_0x4f8f14[_0xb474('0x30')]['limit']);_0x545486[_0xb474('0x21')]=qs[_0xb474('0x21')](_0x4f8f14[_0xb474('0x30')][_0xb474('0x21')]);}_0x545486[_0xb474('0x39')]=qs[_0xb474('0x3a')](_0x4f8f14[_0xb474('0x30')][_0xb474('0x3a')]);_0x545486['where']=qs[_0xb474('0x32')](_[_0xb474('0x3b')](_0x4f8f14[_0xb474('0x30')],_0x3dad58[_0xb474('0x32')]),_0x2b0364);if(_0x4f8f14[_0xb474('0x30')][_0xb474('0x3c')]){_0x545486[_0xb474('0x3d')]=_[_0xb474('0x3e')](_0x545486[_0xb474('0x3d')],{'$or':_[_0xb474('0x29')](_0x2b0364,function(_0x3a67dd){if(_0x3a67dd[_0xb474('0x2d')]!=='VIRTUAL'){var _0x2e5b56={};_0x2e5b56[_0x3a67dd[_0xb474('0x27')]]={'$like':'%'+_0x4f8f14['query'][_0xb474('0x3c')]+'%'};return _0x2e5b56;}})});}_0x545486=_[_0xb474('0x3e')]({},_0x545486,_0x4f8f14[_0xb474('0x3f')]);var _0x419431={'where':_0x545486[_0xb474('0x3d')]};return db['SquareDetailsReport'][_0xb474('0x20')](_0x419431)[_0xb474('0x40')](function(_0x48993d){_0x2e6e85[_0xb474('0x20')]=_0x48993d;if(_0x4f8f14[_0xb474('0x30')][_0xb474('0x41')]){_0x545486[_0xb474('0x42')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x545486);})[_0xb474('0x40')](function(_0x4794bc){_0x2e6e85['rows']=_0x4794bc;return _0x2e6e85;})[_0xb474('0x40')](respondWithFilteredResult(_0x11d0dd,_0x545486))['catch'](handleError(_0x11d0dd,null));};exports[_0xb474('0x43')]=function(_0x27dcb2,_0x25044d){var _0x2bba92={'raw':!![],'where':{'id':_0x27dcb2[_0xb474('0x44')]['id']}},_0x55930f={};_0x55930f[_0xb474('0x2f')]=_[_0xb474('0x31')](db[_0xb474('0x2a')][_0xb474('0x2b')]);_0x55930f[_0xb474('0x30')]=_[_0xb474('0x31')](_0x27dcb2[_0xb474('0x30')]);_0x55930f[_0xb474('0x32')]=_[_0xb474('0x45')](_0x55930f[_0xb474('0x2f')],_0x55930f[_0xb474('0x30')]);_0x2bba92[_0xb474('0x34')]=_['intersection'](_0x55930f[_0xb474('0x2f')],qs[_0xb474('0x33')](_0x27dcb2[_0xb474('0x30')][_0xb474('0x33')]));_0x2bba92[_0xb474('0x34')]=_0x2bba92[_0xb474('0x34')][_0xb474('0x35')]?_0x2bba92[_0xb474('0x34')]:_0x55930f[_0xb474('0x2f')];if(_0x27dcb2[_0xb474('0x30')]['includeAll']){_0x2bba92[_0xb474('0x42')]=[{'all':!![]}];}_0x2bba92=_[_0xb474('0x3e')]({},_0x2bba92,_0x27dcb2[_0xb474('0x3f')]);return db[_0xb474('0x2a')][_0xb474('0x46')](_0x2bba92)['then'](handleEntityNotFound(_0x25044d,null))[_0xb474('0x40')](respondWithResult(_0x25044d,null))[_0xb474('0x47')](handleError(_0x25044d,null));};exports[_0xb474('0x48')]=function(_0x209e06,_0x27931c){return db[_0xb474('0x2a')][_0xb474('0x48')](_0x209e06['body'],{})[_0xb474('0x40')](respondWithResult(_0x27931c,0xc9))[_0xb474('0x47')](handleError(_0x27931c,null));};exports[_0xb474('0x25')]=function(_0xcea7f4,_0x6c27d0){if(_0xcea7f4['body']['id']){delete _0xcea7f4[_0xb474('0x49')]['id'];}return db[_0xb474('0x2a')][_0xb474('0x46')]({'where':{'id':_0xcea7f4[_0xb474('0x44')]['id']}})[_0xb474('0x40')](handleEntityNotFound(_0x6c27d0,null))['then'](saveUpdates(_0xcea7f4[_0xb474('0x49')],null))[_0xb474('0x40')](respondWithResult(_0x6c27d0,null))[_0xb474('0x47')](handleError(_0x6c27d0,null));};exports[_0xb474('0x4a')]=function(_0x261292,_0x189cec){return db[_0xb474('0x2a')][_0xb474('0x46')]({'where':{'id':_0x261292[_0xb474('0x44')]['id']}})[_0xb474('0x40')](handleEntityNotFound(_0x189cec,null))[_0xb474('0x40')](removeEntity(_0x189cec,null))[_0xb474('0x47')](handleError(_0x189cec,null));};exports[_0xb474('0x4b')]=function(_0x1f0f3c,_0x3cec48){return db['SquareDetailsReport'][_0xb474('0x4b')]()[_0xb474('0x40')](respondWithResult(_0x3cec48,null))['catch'](handleError(_0x3cec48,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 809e493..ed4e1da 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 _0xa90b=['./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0xa90b,0x10c));var _0xba90=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0xa90b[_0xab9f3d];return _0x5283bf;};'use strict';var _=require('lodash');var util=require(_0xba90('0x0'));var logger=require('../../config/logger')(_0xba90('0x1'));var moment=require(_0xba90('0x2'));var BPromise=require(_0xba90('0x3'));var rp=require(_0xba90('0x4'));var fs=require('fs');var path=require(_0xba90('0x5'));var rimraf=require(_0xba90('0x6'));var config=require(_0xba90('0x7'));var attributes=require(_0xba90('0x8'));module['exports']=function(_0x5b7452,_0x1d5f07){return _0x5b7452[_0xba90('0x9')](_0xba90('0xa'),attributes,{'tableName':_0xba90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f17=['path','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','../../config/logger','api','bluebird','request-promise'];(function(_0x20c56f,_0x3cedb1){var _0x5da2bf=function(_0x153c38){while(--_0x153c38){_0x20c56f['push'](_0x20c56f['shift']());}};_0x5da2bf(++_0x3cedb1);}(_0x9f17,0xc4));var _0x79f1=function(_0x295f17,_0x4888e5){_0x295f17=_0x295f17-0x0;var _0x3f1c80=_0x9f17[_0x295f17];return _0x3f1c80;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x79f1('0x0'))(_0x79f1('0x1'));var moment=require('moment');var BPromise=require(_0x79f1('0x2'));var rp=require(_0x79f1('0x3'));var fs=require('fs');var path=require(_0x79f1('0x4'));var rimraf=require('rimraf');var config=require(_0x79f1('0x5'));var attributes=require(_0x79f1('0x6'));module[_0x79f1('0x7')]=function(_0x1209b0,_0x14dda4){return _0x1209b0[_0x79f1('0x8')]('SquareDetailsReport',attributes,{'tableName':_0x79f1('0x9'),'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 f3015ef..4df1877 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 _0x9f8d=['stringify','error','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9f8d,0x167));var _0xd9f8=function(_0x1b8504,_0x441c97){_0x1b8504=_0x1b8504-0x0;var _0x3e9c77=_0x9f8d[_0x1b8504];return _0x3e9c77;};'use strict';var _=require(_0xd9f8('0x0'));var util=require(_0xd9f8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd9f8('0x2'));var fs=require('fs');var Redis=require(_0xd9f8('0x3'));var db=require(_0xd9f8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9f8('0x5'))(_0xd9f8('0x6'));var config=require('../../config/environment');var jayson=require(_0xd9f8('0x7'));var client=jayson[_0xd9f8('0x8')][_0xd9f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x821466,_0x2ff8e6,_0x2dcd44){return new BPromise(function(_0x307aaa,_0x4c5436){return client[_0xd9f8('0xa')](_0x821466,_0x2dcd44)['then'](function(_0x2cce96){logger[_0xd9f8('0xb')](_0xd9f8('0xc'),_0x2ff8e6,'request\x20sent');logger[_0xd9f8('0xd')](_0xd9f8('0xe'),_0x2ff8e6,_0xd9f8('0xf'),JSON[_0xd9f8('0x10')](_0x2cce96));if(_0x2cce96[_0xd9f8('0x11')]){if(_0x2cce96[_0xd9f8('0x11')]['code']===0x1f4){logger[_0xd9f8('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x2ff8e6,_0x2cce96['error'][_0xd9f8('0x12')]);return _0x4c5436(_0x2cce96['error']['message']);}logger[_0xd9f8('0x11')](_0xd9f8('0xc'),_0x2ff8e6,_0x2cce96[_0xd9f8('0x11')]['message']);return _0x307aaa(_0x2cce96[_0xd9f8('0x11')][_0xd9f8('0x12')]);}else{logger[_0xd9f8('0xb')](_0xd9f8('0xc'),_0x2ff8e6,'request\x20sent');_0x307aaa(_0x2cce96[_0xd9f8('0x13')][_0xd9f8('0x12')]);}})['catch'](function(_0x2339fc){logger[_0xd9f8('0x11')](_0xd9f8('0xc'),_0x2ff8e6,_0x2339fc);_0x4c5436(_0x2339fc);});});}exports[_0xd9f8('0x14')]=function(_0x582308){var _0xe8a79e=this;return new Promise(function(_0x4ae9ac,_0x142d44){return db[_0xd9f8('0x15')][_0xd9f8('0x16')](_0x582308[_0xd9f8('0x17')],{'raw':_0x582308['options']?_0x582308['options'][_0xd9f8('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3a02ef){logger[_0xd9f8('0xb')](_0xd9f8('0x14'),_0x582308);logger[_0xd9f8('0xd')](_0xd9f8('0x14'),_0x582308,JSON['stringify'](_0x3a02ef));_0x4ae9ac(_0x3a02ef);})['catch'](function(_0x9cb580){logger[_0xd9f8('0x11')]('CreateSquareDetailsReport',_0x9cb580[_0xd9f8('0x12')],_0x582308);_0x142d44(_0xe8a79e[_0xd9f8('0x11')](0x1f4,_0x9cb580[_0xd9f8('0x12')]));});});}; \ No newline at end of file +var _0xae8c=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','then','util','moment'];(function(_0x217819,_0x310090){var _0x39fff2=function(_0x1d4e2d){while(--_0x1d4e2d){_0x217819['push'](_0x217819['shift']());}};_0x39fff2(++_0x310090);}(_0xae8c,0xb4));var _0xcae8=function(_0x45495d,_0x2b43cd){_0x45495d=_0x45495d-0x0;var _0x4b7f6f=_0xae8c[_0x45495d];return _0x4b7f6f;};'use strict';var _=require('lodash');var util=require(_0xcae8('0x0'));var moment=require(_0xcae8('0x1'));var BPromise=require(_0xcae8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcae8('0x3'));var db=require(_0xcae8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcae8('0x5'))(_0xcae8('0x6'));var config=require('../../config/environment');var jayson=require(_0xcae8('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c12c2,_0x2252eb,_0xce2d7f){return new BPromise(function(_0x50e45d,_0x5f302f){return client[_0xcae8('0x8')](_0x5c12c2,_0xce2d7f)['then'](function(_0x1c22a8){logger[_0xcae8('0x9')](_0xcae8('0xa'),_0x2252eb,_0xcae8('0xb'));logger[_0xcae8('0xc')](_0xcae8('0xd'),_0x2252eb,_0xcae8('0xb'),JSON[_0xcae8('0xe')](_0x1c22a8));if(_0x1c22a8['error']){if(_0x1c22a8[_0xcae8('0xf')][_0xcae8('0x10')]===0x1f4){logger[_0xcae8('0xf')](_0xcae8('0xa'),_0x2252eb,_0x1c22a8[_0xcae8('0xf')][_0xcae8('0x11')]);return _0x5f302f(_0x1c22a8['error'][_0xcae8('0x11')]);}logger[_0xcae8('0xf')](_0xcae8('0xa'),_0x2252eb,_0x1c22a8[_0xcae8('0xf')]['message']);return _0x50e45d(_0x1c22a8[_0xcae8('0xf')][_0xcae8('0x11')]);}else{logger[_0xcae8('0x9')](_0xcae8('0xa'),_0x2252eb,'request\x20sent');_0x50e45d(_0x1c22a8[_0xcae8('0x12')][_0xcae8('0x11')]);}})[_0xcae8('0x13')](function(_0x3fe2fd){logger[_0xcae8('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x2252eb,_0x3fe2fd);_0x5f302f(_0x3fe2fd);});});}exports[_0xcae8('0x14')]=function(_0x112987){var _0x113e8e=this;return new Promise(function(_0x10a958,_0x1cb6c7){return db[_0xcae8('0x15')][_0xcae8('0x16')](_0x112987[_0xcae8('0x17')],{'raw':_0x112987[_0xcae8('0x18')]?_0x112987[_0xcae8('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xcae8('0x19')](function(_0x1568a2){logger['info'](_0xcae8('0x14'),_0x112987);logger['debug'](_0xcae8('0x14'),_0x112987,JSON[_0xcae8('0xe')](_0x1568a2));_0x10a958(_0x1568a2);})['catch'](function(_0x1aa4e0){logger[_0xcae8('0xf')]('CreateSquareDetailsReport',_0x1aa4e0[_0xcae8('0x11')],_0x112987);_0x1cb6c7(_0x113e8e[_0xcae8('0xf')](0x1f4,_0x1aa4e0['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 908264a..a84c760 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 _0x5aaa=['killProcess','express','Router','get','isAuthenticated','/process/:pid/kill'];(function(_0x2ef393,_0x15b7f5){var _0x3e1a67=function(_0x5519f4){while(--_0x5519f4){_0x2ef393['push'](_0x2ef393['shift']());}};_0x3e1a67(++_0x15b7f5);}(_0x5aaa,0xeb));var _0xa5aa=function(_0x582d9e,_0x3c3ad2){_0x582d9e=_0x582d9e-0x0;var _0x4d8b92=_0x5aaa[_0x582d9e];return _0x4d8b92;};'use strict';var express=require(_0xa5aa('0x0'));var router=express[_0xa5aa('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0xa5aa('0x2')]('/',auth[_0xa5aa('0x3')](),controller['index']);router[_0xa5aa('0x2')](_0xa5aa('0x4'),auth['isAuthenticated'](),controller[_0xa5aa('0x5')]);module['exports']=router; \ No newline at end of file +var _0xdde3=['express','Router','isAuthenticated','get','/process/:pid/kill','killProcess','exports'];(function(_0x479245,_0x58193d){var _0x5ae7fa=function(_0x23c739){while(--_0x23c739){_0x479245['push'](_0x479245['shift']());}};_0x5ae7fa(++_0x58193d);}(_0xdde3,0xf5));var _0x3dde=function(_0x40a5af,_0x420e2b){_0x40a5af=_0x40a5af-0x0;var _0x5110e0=_0xdde3[_0x40a5af];return _0x5110e0;};'use strict';var express=require(_0x3dde('0x0'));var router=express[_0x3dde('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router['get']('/',auth[_0x3dde('0x2')](),controller['index']);router[_0x3dde('0x3')](_0x3dde('0x4'),auth[_0x3dde('0x2')](),controller[_0x3dde('0x5')]);module[_0x3dde('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 9751e1e..1969817 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 _0x8463=['util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','then','status','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x8463,0x140));var _0x3846=function(_0x522058,_0x15af74){_0x522058=_0x522058-0x0;var _0x72cbb0=_0x8463[_0x522058];return _0x72cbb0;};'use strict';var info=require(_0x3846('0x0'));var exec=require(_0x3846('0x1'))['exec'];var logger=require(_0x3846('0x2'))(_0x3846('0x3'));var util=require(_0x3846('0x4'));var BPromise=require(_0x3846('0x5'));var _=require('lodash');function handleError(_0x22dbe7,_0x28939c,_0x4b1a52){_0x28939c=_0x28939c||0x1f4;return function(_0x2474ac){logger[_0x3846('0x6')](_0x3846('0x7'),_0x4b1a52,_0x28939c,util[_0x3846('0x8')](_0x2474ac,{'showHidden':![],'depth':null}));delete _0x2474ac[_0x3846('0x9')];_0x22dbe7['status'](_0x28939c)[_0x3846('0xa')](_0x2474ac);};}exports[_0x3846('0xb')]=function(_0x58af61,_0x1cb865){return info[_0x3846('0xc')]()[_0x3846('0xd')](function(_0x1424cc){return _0x1cb865[_0x3846('0xe')](0xc8)[_0x3846('0xf')](_0x1424cc);})[_0x3846('0x10')](function(_0x54760a){return _0x1cb865['status'](0x1f4)[_0x3846('0xf')](_0x54760a);});};exports[_0x3846('0x11')]=function(_0x140d17,_0xe9a85){var _0x23aa98=[_0x3846('0x12')];return new BPromise(function(_0x30e9be,_0x288f2e){return exec(util[_0x3846('0x13')](_0x3846('0x14'),_0x140d17[_0x3846('0x15')][_0x3846('0x16')]),function(_0x59bf6b,_0x2f434e,_0x5a605f){if(_0x59bf6b){return _0x288f2e(_0x59bf6b);}return _0x30e9be(_0x2f434e);});})['then'](function(_0x340c3d){var _0x4fc257=![];var _0x24664a=_0x340c3d['split'](/\n/);for(var _0x182605=0x0,_0x55710f=_0x23aa98['length'];_0x182605<_0x55710f,_0x4fc257===![];_0x182605+=0x1){if(_0x340c3d[_0x3846('0x17')](_0x23aa98[_0x182605])>=0x0){_0x4fc257=!![];}}if(!_0x4fc257){throw new Error(util['format'](_0x3846('0x18'),_0x140d17[_0x3846('0x15')][_0x3846('0x16')]));}process[_0x3846('0x19')](_0x140d17[_0x3846('0x15')]['pid'],'SIGINT');return _0xe9a85[_0x3846('0xe')](0xc8)['json']({'message':util[_0x3846('0x13')](_0x3846('0x1a'),_0x140d17[_0x3846('0x15')]['pid'])});})[_0x3846('0x10')](handleError(_0xe9a85,null,'killProcess'));}; \ No newline at end of file +var _0xc8f5=['status','send','index','getAllData','json','catch','components/import/cm','params','pid','split','length','format','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','killProcess','systeminformation','child_process','../../config/logger','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name'];(function(_0x31abee,_0x11ff0c){var _0x3c1761=function(_0x2b5062){while(--_0x2b5062){_0x31abee['push'](_0x31abee['shift']());}};_0x3c1761(++_0x11ff0c);}(_0xc8f5,0xeb));var _0x5c8f=function(_0x5106c1,_0x13233a){_0x5106c1=_0x5106c1-0x0;var _0x5bcaac=_0xc8f5[_0x5106c1];return _0x5bcaac;};'use strict';var info=require(_0x5c8f('0x0'));var exec=require(_0x5c8f('0x1'))['exec'];var logger=require(_0x5c8f('0x2'))('api');var util=require('util');var BPromise=require('bluebird');var _=require(_0x5c8f('0x3'));function handleError(_0x30124,_0x2a4780,_0x4e4a83){_0x2a4780=_0x2a4780||0x1f4;return function(_0x16a197){logger['error'](_0x5c8f('0x4'),_0x4e4a83,_0x2a4780,util[_0x5c8f('0x5')](_0x16a197,{'showHidden':![],'depth':null}));delete _0x16a197[_0x5c8f('0x6')];_0x30124[_0x5c8f('0x7')](_0x2a4780)[_0x5c8f('0x8')](_0x16a197);};}exports[_0x5c8f('0x9')]=function(_0x5e6820,_0x339d39){return info[_0x5c8f('0xa')]()['then'](function(_0x462075){return _0x339d39['status'](0xc8)[_0x5c8f('0xb')](_0x462075);})[_0x5c8f('0xc')](function(_0x230a34){return _0x339d39['status'](0x1f4)[_0x5c8f('0xb')](_0x230a34);});};exports['killProcess']=function(_0x5b4d11,_0x2cc347){var _0x390b93=[_0x5c8f('0xd')];return new BPromise(function(_0x2e4aa6,_0x54bb93){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x5b4d11[_0x5c8f('0xe')][_0x5c8f('0xf')]),function(_0x4c97dd,_0x566b20,_0x60f0a6){if(_0x4c97dd){return _0x54bb93(_0x4c97dd);}return _0x2e4aa6(_0x566b20);});})['then'](function(_0x4d195e){var _0x35a6f7=![];var _0x38a61f=_0x4d195e[_0x5c8f('0x10')](/\n/);for(var _0x3782b6=0x0,_0xf6e4ea=_0x390b93[_0x5c8f('0x11')];_0x3782b6<_0xf6e4ea,_0x35a6f7===![];_0x3782b6+=0x1){if(_0x4d195e['indexOf'](_0x390b93[_0x3782b6])>=0x0){_0x35a6f7=!![];}}if(!_0x35a6f7){throw new Error(util[_0x5c8f('0x12')](_0x5c8f('0x13'),_0x5b4d11[_0x5c8f('0xe')][_0x5c8f('0xf')]));}process['kill'](_0x5b4d11[_0x5c8f('0xe')]['pid'],_0x5c8f('0x14'));return _0x2cc347[_0x5c8f('0x7')](0xc8)[_0x5c8f('0xb')]({'message':util[_0x5c8f('0x12')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x5b4d11[_0x5c8f('0xe')][_0x5c8f('0xf')])});})[_0x5c8f('0xc')](handleError(_0x2cc347,null,_0x5c8f('0x15')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index d83721f..e31ded1 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 _0x8ca7=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0x8ca7,0x9b));var _0x78ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ca7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x78ca('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x78ca('0x1'));var router=express[_0x78ca('0x2')]();var fs_extra=require(_0x78ca('0x3'));var auth=require(_0x78ca('0x4'));var interaction=require(_0x78ca('0x5'));var config=require(_0x78ca('0x6'));var controller=require('./tag.controller');router[_0x78ca('0x7')]('/',auth[_0x78ca('0x8')](),controller[_0x78ca('0x9')]);router[_0x78ca('0x7')](_0x78ca('0xa'),auth[_0x78ca('0x8')](),controller[_0x78ca('0xb')]);router[_0x78ca('0xc')]('/',auth[_0x78ca('0x8')](),controller[_0x78ca('0xd')]);router[_0x78ca('0xe')](_0x78ca('0xa'),auth[_0x78ca('0x8')](),controller[_0x78ca('0xf')]);router[_0x78ca('0x10')](_0x78ca('0xa'),auth[_0x78ca('0x8')](),controller[_0x78ca('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb781=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x5ee045,_0x313197){var _0x31a6f9=function(_0x551a8b){while(--_0x551a8b){_0x5ee045['push'](_0x5ee045['shift']());}};_0x31a6f9(++_0x313197);}(_0xb781,0x134));var _0x1b78=function(_0x42a7f6,_0x469407){_0x42a7f6=_0x42a7f6-0x0;var _0x222a0e=_0xb781[_0x42a7f6];return _0x222a0e;};'use strict';var multer=require(_0x1b78('0x0'));var util=require(_0x1b78('0x1'));var path=require(_0x1b78('0x2'));var timeout=require(_0x1b78('0x3'));var express=require('express');var router=express[_0x1b78('0x4')]();var fs_extra=require(_0x1b78('0x5'));var auth=require(_0x1b78('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1b78('0x7'));var controller=require(_0x1b78('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1b78('0x9')](_0x1b78('0xa'),auth[_0x1b78('0xb')](),controller[_0x1b78('0xc')]);router[_0x1b78('0xd')]('/',auth[_0x1b78('0xb')](),controller[_0x1b78('0xe')]);router[_0x1b78('0xf')](_0x1b78('0xa'),auth[_0x1b78('0xb')](),controller['update']);router['delete'](_0x1b78('0xa'),auth[_0x1b78('0xb')](),controller[_0x1b78('0x10')]);module[_0x1b78('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 66680c1..8cc59da 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 _0xda3f=['exports','STRING'];(function(_0x377700,_0x235235){var _0x1fc4d6=function(_0x29bb70){while(--_0x29bb70){_0x377700['push'](_0x377700['shift']());}};_0x1fc4d6(++_0x235235);}(_0xda3f,0xec));var _0xfda3=function(_0x5f7079,_0x557a2d){_0x5f7079=_0x5f7079-0x0;var _0x103cb8=_0xda3f[_0x5f7079];return _0x103cb8;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'name':{'type':Sequelize[_0xfda3('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xfda3('0x1')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb7e7,0x121));var _0x7b7e=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xb7e7[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 3e466ce..c609b8a 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 _0x7a54=['includeAll','include','findAll','rows','catch','show','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filters','filter','merge','VIRTUAL'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x7a54,0x106));var _0x47a5=function(_0x492e6c,_0x5f4190){_0x492e6c=_0x492e6c-0x0;var _0x387de8=_0x7a54[_0x492e6c];return _0x387de8;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47a5('0xb'));var squel=require(_0x47a5('0xc'));var crypto=require('crypto');var jsforce=require(_0x47a5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x47a5('0xe'));var Redis=require(_0x47a5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x47a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x47a5('0x11'))(_0x47a5('0x12'));var utils=require(_0x47a5('0x13'));var config=require(_0x47a5('0x14'));var licenseUtil=require(_0x47a5('0x15'));var db=require(_0x47a5('0x16'))['db'];function respondWithStatusCode(_0x1eae59,_0x5beb89){_0x5beb89=_0x5beb89||0xcc;return function(_0x44bd3e){if(_0x44bd3e){return _0x1eae59[_0x47a5('0x17')](_0x5beb89);}return _0x1eae59[_0x47a5('0x18')](_0x5beb89)[_0x47a5('0x19')]();};}function respondWithResult(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xc8;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x18')](_0x620ee9)['json'](_0x3c6c46);}};}function respondWithFilteredResult(_0x362359,_0x11faf5){return function(_0x3b001e){if(_0x3b001e){var _0x2a2cbb=_0x3b001e[_0x47a5('0x1a')],_0x1ef44c=_0x11faf5['offset'],_0x574af6=_0x11faf5['offset']+_0x11faf5[_0x47a5('0x1b')],_0x549de3;if(_0x574af6>=_0x2a2cbb){_0x574af6=_0x2a2cbb;_0x549de3=0xc8;}else{_0x549de3=0xce;}_0x362359[_0x47a5('0x18')](_0x549de3);return _0x362359[_0x47a5('0x1c')](_0x47a5('0x1d'),_0x1ef44c+'-'+_0x574af6+'/'+_0x2a2cbb)[_0x47a5('0x1e')](_0x3b001e);}return null;};}function patchUpdates(_0x12b98e){return function(_0x2763d6){try{jsonpatch[_0x47a5('0x1f')](_0x2763d6,_0x12b98e,!![]);}catch(_0x3aed38){return BPromise['reject'](_0x3aed38);}return _0x2763d6[_0x47a5('0x20')]();};}function saveUpdates(_0xf160ba,_0x47cf3c){return function(_0x2b0360){if(_0x2b0360){return _0x2b0360[_0x47a5('0x21')](_0xf160ba)[_0x47a5('0x22')](function(_0x4c5910){return _0x4c5910;});}return null;};}function removeEntity(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x23')]()['then'](function(){var _0xe2dea9=_0x23db32[_0x47a5('0x24')]({'plain':!![]});var _0x513981=_0x47a5('0x25');return db[_0x47a5('0x26')][_0x47a5('0x23')]({'where':{'type':_0x513981,'resourceId':_0xe2dea9['id']}})[_0x47a5('0x22')](function(){return _0x23db32;});})[_0x47a5('0x22')](function(){_0xb8ae6c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x136745,_0x5686db){return function(_0x1ea9c8){if(!_0x1ea9c8){_0x136745['sendStatus'](0x194);}return _0x1ea9c8;};}function handleError(_0x23cb77,_0x378208){_0x378208=_0x378208||0x1f4;return function(_0x36ad34){logger[_0x47a5('0x27')](_0x36ad34[_0x47a5('0x28')]);if(_0x36ad34[_0x47a5('0x29')]){delete _0x36ad34[_0x47a5('0x29')];}_0x23cb77[_0x47a5('0x18')](_0x378208)[_0x47a5('0x2a')](_0x36ad34);};}exports[_0x47a5('0x2b')]=function(_0x1127f8,_0x11a4fa){var _0x3ad507={},_0x528582={},_0x243210={'count':0x0,'rows':[]};var _0x51833b=_[_0x47a5('0x2c')](db[_0x47a5('0x2d')][_0x47a5('0x2e')],function(_0x4d6b57){return{'name':_0x4d6b57[_0x47a5('0x2f')],'type':_0x4d6b57[_0x47a5('0x30')][_0x47a5('0x31')]};});_0x528582[_0x47a5('0x32')]=_['map'](_0x51833b,'name');_0x528582[_0x47a5('0x33')]=_[_0x47a5('0x34')](_0x1127f8['query']);_0x528582['filters']=_[_0x47a5('0x35')](_0x528582[_0x47a5('0x32')],_0x528582['query']);_0x3ad507[_0x47a5('0x36')]=_['intersection'](_0x528582[_0x47a5('0x32')],qs[_0x47a5('0x37')](_0x1127f8['query']['fields']));_0x3ad507[_0x47a5('0x36')]=_0x3ad507['attributes'][_0x47a5('0x38')]?_0x3ad507[_0x47a5('0x36')]:_0x528582[_0x47a5('0x32')];if(!_0x1127f8['query'][_0x47a5('0x39')]('nolimit')){_0x3ad507['limit']=qs[_0x47a5('0x1b')](_0x1127f8['query'][_0x47a5('0x1b')]);_0x3ad507['offset']=qs[_0x47a5('0x3a')](_0x1127f8[_0x47a5('0x33')][_0x47a5('0x3a')]);}_0x3ad507[_0x47a5('0x3b')]=qs[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x33')][_0x47a5('0x3c')]);_0x3ad507[_0x47a5('0x3d')]=qs[_0x47a5('0x3e')](_['pick'](_0x1127f8[_0x47a5('0x33')],_0x528582[_0x47a5('0x3e')]),_0x51833b);if(_0x1127f8['query'][_0x47a5('0x3f')]){_0x3ad507[_0x47a5('0x3d')]=_[_0x47a5('0x40')](_0x3ad507['where'],{'$or':_[_0x47a5('0x2c')](_0x51833b,function(_0x10f660){if(_0x10f660['type']!==_0x47a5('0x41')){var _0x19218a={};_0x19218a[_0x10f660['name']]={'$like':'%'+_0x1127f8['query']['filter']+'%'};return _0x19218a;}})});}_0x3ad507=_[_0x47a5('0x40')]({},_0x3ad507,_0x1127f8['options']);var _0x9b5eaf={'where':_0x3ad507[_0x47a5('0x3d')]};return db[_0x47a5('0x2d')][_0x47a5('0x1a')](_0x9b5eaf)[_0x47a5('0x22')](function(_0xcb5243){_0x243210[_0x47a5('0x1a')]=_0xcb5243;if(_0x1127f8[_0x47a5('0x33')][_0x47a5('0x42')]){_0x3ad507[_0x47a5('0x43')]=[{'all':!![]}];}return db[_0x47a5('0x2d')][_0x47a5('0x44')](_0x3ad507);})[_0x47a5('0x22')](function(_0x56dbbd){_0x243210[_0x47a5('0x45')]=_0x56dbbd;return _0x243210;})[_0x47a5('0x22')](respondWithFilteredResult(_0x11a4fa,_0x3ad507))[_0x47a5('0x46')](handleError(_0x11a4fa,null));};exports[_0x47a5('0x47')]=function(_0x586f4f,_0x7de536){var _0x528ef3={'raw':!![],'where':{'id':_0x586f4f['params']['id']}},_0x47c7a2={};_0x47c7a2['model']=_[_0x47a5('0x34')](db['Tag'][_0x47a5('0x2e')]);_0x47c7a2[_0x47a5('0x33')]=_[_0x47a5('0x34')](_0x586f4f['query']);_0x47c7a2[_0x47a5('0x3e')]=_[_0x47a5('0x35')](_0x47c7a2['model'],_0x47c7a2['query']);_0x528ef3[_0x47a5('0x36')]=_['intersection'](_0x47c7a2[_0x47a5('0x32')],qs[_0x47a5('0x37')](_0x586f4f[_0x47a5('0x33')][_0x47a5('0x37')]));_0x528ef3[_0x47a5('0x36')]=_0x528ef3[_0x47a5('0x36')][_0x47a5('0x38')]?_0x528ef3[_0x47a5('0x36')]:_0x47c7a2[_0x47a5('0x32')];if(_0x586f4f[_0x47a5('0x33')][_0x47a5('0x42')]){_0x528ef3[_0x47a5('0x43')]=[{'all':!![]}];}_0x528ef3=_[_0x47a5('0x40')]({},_0x528ef3,_0x586f4f[_0x47a5('0x48')]);return db[_0x47a5('0x2d')][_0x47a5('0x49')](_0x528ef3)['then'](handleEntityNotFound(_0x7de536,null))[_0x47a5('0x22')](respondWithResult(_0x7de536,null))[_0x47a5('0x46')](handleError(_0x7de536,null));};exports['create']=function(_0x52b3a8,_0x3d0a88){return db['Tag'][_0x47a5('0x4a')](_0x52b3a8[_0x47a5('0x4b')],{})['then'](function(_0x4f62d3){var _0x3d85cc=_0x52b3a8['user'][_0x47a5('0x24')]({'plain':!![]});if(!_0x3d85cc)throw new Error(_0x47a5('0x4c'));if(_0x3d85cc[_0x47a5('0x4d')]===_0x47a5('0x4e')){var _0x44fe8a=_0x4f62d3[_0x47a5('0x24')]({'plain':!![]});var _0x238ebb='Tags';return db['UserProfileSection'][_0x47a5('0x49')]({'where':{'name':_0x238ebb,'userProfileId':_0x3d85cc[_0x47a5('0x4f')]},'raw':!![]})[_0x47a5('0x22')](function(_0x9ea93e){if(_0x9ea93e&&_0x9ea93e[_0x47a5('0x50')]===0x0){return db[_0x47a5('0x26')][_0x47a5('0x4a')]({'name':_0x44fe8a['name'],'resourceId':_0x44fe8a['id'],'type':_0x9ea93e[_0x47a5('0x29')],'sectionId':_0x9ea93e['id']},{})[_0x47a5('0x22')](function(){return _0x4f62d3;});}else{return _0x4f62d3;}})[_0x47a5('0x46')](function(_0x5c3c75){logger[_0x47a5('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c3c75);throw _0x5c3c75;});}return _0x4f62d3;})[_0x47a5('0x22')](respondWithResult(_0x3d0a88,0xc9))[_0x47a5('0x46')](handleError(_0x3d0a88,null));};exports[_0x47a5('0x21')]=function(_0xf03bd5,_0x588551){if(_0xf03bd5[_0x47a5('0x4b')]['id']){delete _0xf03bd5[_0x47a5('0x4b')]['id'];}return db[_0x47a5('0x2d')][_0x47a5('0x49')]({'where':{'id':_0xf03bd5[_0x47a5('0x51')]['id']}})[_0x47a5('0x22')](handleEntityNotFound(_0x588551,null))[_0x47a5('0x22')](saveUpdates(_0xf03bd5['body'],null))[_0x47a5('0x22')](respondWithResult(_0x588551,null))[_0x47a5('0x46')](handleError(_0x588551,null));};exports[_0x47a5('0x23')]=function(_0x8da9fb,_0x3329aa){return db[_0x47a5('0x2d')]['find']({'where':{'id':_0x8da9fb[_0x47a5('0x51')]['id']}})[_0x47a5('0x22')](handleEntityNotFound(_0x3329aa,null))[_0x47a5('0x22')](removeEntity(_0x3329aa,null))['catch'](handleError(_0x3329aa,null));}; \ No newline at end of file +var _0x7a54=['includeAll','include','findAll','rows','catch','show','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filters','filter','merge','VIRTUAL'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x7a54,0x106));var _0x47a5=function(_0x3fcccb,_0x4eb515){_0x3fcccb=_0x3fcccb-0x0;var _0x27bbbc=_0x7a54[_0x3fcccb];return _0x27bbbc;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47a5('0xb'));var squel=require(_0x47a5('0xc'));var crypto=require('crypto');var jsforce=require(_0x47a5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x47a5('0xe'));var Redis=require(_0x47a5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x47a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x47a5('0x11'))(_0x47a5('0x12'));var utils=require(_0x47a5('0x13'));var config=require(_0x47a5('0x14'));var licenseUtil=require(_0x47a5('0x15'));var db=require(_0x47a5('0x16'))['db'];function respondWithStatusCode(_0x1eae59,_0x5beb89){_0x5beb89=_0x5beb89||0xcc;return function(_0x44bd3e){if(_0x44bd3e){return _0x1eae59[_0x47a5('0x17')](_0x5beb89);}return _0x1eae59[_0x47a5('0x18')](_0x5beb89)[_0x47a5('0x19')]();};}function respondWithResult(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xc8;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x18')](_0x620ee9)['json'](_0x3c6c46);}};}function respondWithFilteredResult(_0x362359,_0x11faf5){return function(_0x3b001e){if(_0x3b001e){var _0x2a2cbb=_0x3b001e[_0x47a5('0x1a')],_0x1ef44c=_0x11faf5['offset'],_0x574af6=_0x11faf5['offset']+_0x11faf5[_0x47a5('0x1b')],_0x549de3;if(_0x574af6>=_0x2a2cbb){_0x574af6=_0x2a2cbb;_0x549de3=0xc8;}else{_0x549de3=0xce;}_0x362359[_0x47a5('0x18')](_0x549de3);return _0x362359[_0x47a5('0x1c')](_0x47a5('0x1d'),_0x1ef44c+'-'+_0x574af6+'/'+_0x2a2cbb)[_0x47a5('0x1e')](_0x3b001e);}return null;};}function patchUpdates(_0x12b98e){return function(_0x2763d6){try{jsonpatch[_0x47a5('0x1f')](_0x2763d6,_0x12b98e,!![]);}catch(_0x3aed38){return BPromise['reject'](_0x3aed38);}return _0x2763d6[_0x47a5('0x20')]();};}function saveUpdates(_0xf160ba,_0x47cf3c){return function(_0x2b0360){if(_0x2b0360){return _0x2b0360[_0x47a5('0x21')](_0xf160ba)[_0x47a5('0x22')](function(_0x4c5910){return _0x4c5910;});}return null;};}function removeEntity(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x23')]()['then'](function(){var _0xe2dea9=_0x23db32[_0x47a5('0x24')]({'plain':!![]});var _0x513981=_0x47a5('0x25');return db[_0x47a5('0x26')][_0x47a5('0x23')]({'where':{'type':_0x513981,'resourceId':_0xe2dea9['id']}})[_0x47a5('0x22')](function(){return _0x23db32;});})[_0x47a5('0x22')](function(){_0xb8ae6c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x136745,_0x5686db){return function(_0x1ea9c8){if(!_0x1ea9c8){_0x136745['sendStatus'](0x194);}return _0x1ea9c8;};}function handleError(_0x23cb77,_0x378208){_0x378208=_0x378208||0x1f4;return function(_0x36ad34){logger[_0x47a5('0x27')](_0x36ad34[_0x47a5('0x28')]);if(_0x36ad34[_0x47a5('0x29')]){delete _0x36ad34[_0x47a5('0x29')];}_0x23cb77[_0x47a5('0x18')](_0x378208)[_0x47a5('0x2a')](_0x36ad34);};}exports[_0x47a5('0x2b')]=function(_0x1127f8,_0x11a4fa){var _0x3ad507={},_0x528582={},_0x243210={'count':0x0,'rows':[]};var _0x51833b=_[_0x47a5('0x2c')](db[_0x47a5('0x2d')][_0x47a5('0x2e')],function(_0x4d6b57){return{'name':_0x4d6b57[_0x47a5('0x2f')],'type':_0x4d6b57[_0x47a5('0x30')][_0x47a5('0x31')]};});_0x528582[_0x47a5('0x32')]=_['map'](_0x51833b,'name');_0x528582[_0x47a5('0x33')]=_[_0x47a5('0x34')](_0x1127f8['query']);_0x528582['filters']=_[_0x47a5('0x35')](_0x528582[_0x47a5('0x32')],_0x528582['query']);_0x3ad507[_0x47a5('0x36')]=_['intersection'](_0x528582[_0x47a5('0x32')],qs[_0x47a5('0x37')](_0x1127f8['query']['fields']));_0x3ad507[_0x47a5('0x36')]=_0x3ad507['attributes'][_0x47a5('0x38')]?_0x3ad507[_0x47a5('0x36')]:_0x528582[_0x47a5('0x32')];if(!_0x1127f8['query'][_0x47a5('0x39')]('nolimit')){_0x3ad507['limit']=qs[_0x47a5('0x1b')](_0x1127f8['query'][_0x47a5('0x1b')]);_0x3ad507['offset']=qs[_0x47a5('0x3a')](_0x1127f8[_0x47a5('0x33')][_0x47a5('0x3a')]);}_0x3ad507[_0x47a5('0x3b')]=qs[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x33')][_0x47a5('0x3c')]);_0x3ad507[_0x47a5('0x3d')]=qs[_0x47a5('0x3e')](_['pick'](_0x1127f8[_0x47a5('0x33')],_0x528582[_0x47a5('0x3e')]),_0x51833b);if(_0x1127f8['query'][_0x47a5('0x3f')]){_0x3ad507[_0x47a5('0x3d')]=_[_0x47a5('0x40')](_0x3ad507['where'],{'$or':_[_0x47a5('0x2c')](_0x51833b,function(_0x10f660){if(_0x10f660['type']!==_0x47a5('0x41')){var _0x19218a={};_0x19218a[_0x10f660['name']]={'$like':'%'+_0x1127f8['query']['filter']+'%'};return _0x19218a;}})});}_0x3ad507=_[_0x47a5('0x40')]({},_0x3ad507,_0x1127f8['options']);var _0x9b5eaf={'where':_0x3ad507[_0x47a5('0x3d')]};return db[_0x47a5('0x2d')][_0x47a5('0x1a')](_0x9b5eaf)[_0x47a5('0x22')](function(_0xcb5243){_0x243210[_0x47a5('0x1a')]=_0xcb5243;if(_0x1127f8[_0x47a5('0x33')][_0x47a5('0x42')]){_0x3ad507[_0x47a5('0x43')]=[{'all':!![]}];}return db[_0x47a5('0x2d')][_0x47a5('0x44')](_0x3ad507);})[_0x47a5('0x22')](function(_0x56dbbd){_0x243210[_0x47a5('0x45')]=_0x56dbbd;return _0x243210;})[_0x47a5('0x22')](respondWithFilteredResult(_0x11a4fa,_0x3ad507))[_0x47a5('0x46')](handleError(_0x11a4fa,null));};exports[_0x47a5('0x47')]=function(_0x586f4f,_0x7de536){var _0x528ef3={'raw':!![],'where':{'id':_0x586f4f['params']['id']}},_0x47c7a2={};_0x47c7a2['model']=_[_0x47a5('0x34')](db['Tag'][_0x47a5('0x2e')]);_0x47c7a2[_0x47a5('0x33')]=_[_0x47a5('0x34')](_0x586f4f['query']);_0x47c7a2[_0x47a5('0x3e')]=_[_0x47a5('0x35')](_0x47c7a2['model'],_0x47c7a2['query']);_0x528ef3[_0x47a5('0x36')]=_['intersection'](_0x47c7a2[_0x47a5('0x32')],qs[_0x47a5('0x37')](_0x586f4f[_0x47a5('0x33')][_0x47a5('0x37')]));_0x528ef3[_0x47a5('0x36')]=_0x528ef3[_0x47a5('0x36')][_0x47a5('0x38')]?_0x528ef3[_0x47a5('0x36')]:_0x47c7a2[_0x47a5('0x32')];if(_0x586f4f[_0x47a5('0x33')][_0x47a5('0x42')]){_0x528ef3[_0x47a5('0x43')]=[{'all':!![]}];}_0x528ef3=_[_0x47a5('0x40')]({},_0x528ef3,_0x586f4f[_0x47a5('0x48')]);return db[_0x47a5('0x2d')][_0x47a5('0x49')](_0x528ef3)['then'](handleEntityNotFound(_0x7de536,null))[_0x47a5('0x22')](respondWithResult(_0x7de536,null))[_0x47a5('0x46')](handleError(_0x7de536,null));};exports['create']=function(_0x52b3a8,_0x3d0a88){return db['Tag'][_0x47a5('0x4a')](_0x52b3a8[_0x47a5('0x4b')],{})['then'](function(_0x4f62d3){var _0x3d85cc=_0x52b3a8['user'][_0x47a5('0x24')]({'plain':!![]});if(!_0x3d85cc)throw new Error(_0x47a5('0x4c'));if(_0x3d85cc[_0x47a5('0x4d')]===_0x47a5('0x4e')){var _0x44fe8a=_0x4f62d3[_0x47a5('0x24')]({'plain':!![]});var _0x238ebb='Tags';return db['UserProfileSection'][_0x47a5('0x49')]({'where':{'name':_0x238ebb,'userProfileId':_0x3d85cc[_0x47a5('0x4f')]},'raw':!![]})[_0x47a5('0x22')](function(_0x9ea93e){if(_0x9ea93e&&_0x9ea93e[_0x47a5('0x50')]===0x0){return db[_0x47a5('0x26')][_0x47a5('0x4a')]({'name':_0x44fe8a['name'],'resourceId':_0x44fe8a['id'],'type':_0x9ea93e[_0x47a5('0x29')],'sectionId':_0x9ea93e['id']},{})[_0x47a5('0x22')](function(){return _0x4f62d3;});}else{return _0x4f62d3;}})[_0x47a5('0x46')](function(_0x5c3c75){logger[_0x47a5('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c3c75);throw _0x5c3c75;});}return _0x4f62d3;})[_0x47a5('0x22')](respondWithResult(_0x3d0a88,0xc9))[_0x47a5('0x46')](handleError(_0x3d0a88,null));};exports[_0x47a5('0x21')]=function(_0xf03bd5,_0x588551){if(_0xf03bd5[_0x47a5('0x4b')]['id']){delete _0xf03bd5[_0x47a5('0x4b')]['id'];}return db[_0x47a5('0x2d')][_0x47a5('0x49')]({'where':{'id':_0xf03bd5[_0x47a5('0x51')]['id']}})[_0x47a5('0x22')](handleEntityNotFound(_0x588551,null))[_0x47a5('0x22')](saveUpdates(_0xf03bd5['body'],null))[_0x47a5('0x22')](respondWithResult(_0x588551,null))[_0x47a5('0x46')](handleError(_0x588551,null));};exports[_0x47a5('0x23')]=function(_0x8da9fb,_0x3329aa){return db[_0x47a5('0x2d')]['find']({'where':{'id':_0x8da9fb[_0x47a5('0x51')]['id']}})[_0x47a5('0x22')](handleEntityNotFound(_0x3329aa,null))[_0x47a5('0x22')](removeEntity(_0x3329aa,null))['catch'](handleError(_0x3329aa,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 33ddf8f..1861d54 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 _0x988c=['bluebird','request-promise','./tag.attributes','exports','define','Tag','lodash','moment'];(function(_0x50cf3a,_0x265e83){var _0x41e677=function(_0x4d35ed){while(--_0x4d35ed){_0x50cf3a['push'](_0x50cf3a['shift']());}};_0x41e677(++_0x265e83);}(_0x988c,0x19e));var _0xc988=function(_0x4feadb,_0x43bfe9){_0x4feadb=_0x4feadb-0x0;var _0x17789b=_0x988c[_0x4feadb];return _0x17789b;};'use strict';var _=require(_0xc988('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc988('0x1'));var BPromise=require(_0xc988('0x2'));var rp=require(_0xc988('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc988('0x4'));module[_0xc988('0x5')]=function(_0x17fa32,_0x56317c){return _0x17fa32[_0xc988('0x6')](_0xc988('0x7'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0da=['define','tools_tags','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./tag.attributes','exports'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa0da,0x183));var _0xaa0d=function(_0x441163,_0x1f1fd2){_0x441163=_0x441163-0x0;var _0x210539=_0xa0da[_0x441163];return _0x210539;};'use strict';var _=require(_0xaa0d('0x0'));var util=require('util');var logger=require(_0xaa0d('0x1'))(_0xaa0d('0x2'));var moment=require(_0xaa0d('0x3'));var BPromise=require(_0xaa0d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa0d('0x5'));var rimraf=require(_0xaa0d('0x6'));var config=require('../../config/environment');var attributes=require(_0xaa0d('0x7'));module[_0xaa0d('0x8')]=function(_0x4e9f11,_0x3a207f){return _0x4e9f11[_0xaa0d('0x9')]('Tag',attributes,{'tableName':_0xaa0d('0xa'),'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 b8a114b..f70e08c 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 _0xb9a7=['request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Tag,\x20%s,\x20%s'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb9a7,0x112));var _0x7b9a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xb9a7[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var config=require(_0x7b9a('0x5'));var jayson=require(_0x7b9a('0x6'));var client=jayson[_0x7b9a('0x7')][_0x7b9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7019fd,_0x37ce81,_0x3e51f0){return new BPromise(function(_0x4d3f20,_0x43d8e2){return client[_0x7b9a('0x9')](_0x7019fd,_0x3e51f0)['then'](function(_0x511e28){logger['info'](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));logger['debug'](_0x7b9a('0xc'),_0x37ce81,'request\x20sent',JSON[_0x7b9a('0xd')](_0x511e28));if(_0x511e28['error']){if(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0xf')]===0x1f4){logger[_0x7b9a('0xe')]('Tag,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x43d8e2(_0x511e28['error'][_0x7b9a('0x10')]);}logger[_0x7b9a('0xe')]('Tag,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x4d3f20(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);}else{logger[_0x7b9a('0x11')](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));_0x4d3f20(_0x511e28[_0x7b9a('0x12')][_0x7b9a('0x10')]);}})['catch'](function(_0x34a82d){logger['error'](_0x7b9a('0xa'),_0x37ce81,_0x34a82d);_0x43d8e2(_0x34a82d);});});} \ No newline at end of file +var _0x91a7=['message','Tag,\x20%s,\x20%s','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x57b7c1,_0x27afb6){var _0x12a3a7=function(_0x253b12){while(--_0x253b12){_0x57b7c1['push'](_0x57b7c1['shift']());}};_0x12a3a7(++_0x27afb6);}(_0x91a7,0xe7));var _0x791a=function(_0x2ca156,_0x5e2784){_0x2ca156=_0x2ca156-0x0;var _0x132682=_0x91a7[_0x2ca156];return _0x132682;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('Tag,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('Tag,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('Tag,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('Tag,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('Tag,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 9e4a08d..3585ade 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 _0xd41f=['addAgents','put','update','delete','removeQueues','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./team.controller','get','index','/:id','isAuthenticated','/:id/queues','getQueues','/:id/users','post','create','addQueues'];(function(_0x4afee1,_0x590539){var _0x4a7087=function(_0x564136){while(--_0x564136){_0x4afee1['push'](_0x4afee1['shift']());}};_0x4a7087(++_0x590539);}(_0xd41f,0x197));var _0xfd41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd41f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfd41('0x0'));var util=require(_0xfd41('0x1'));var path=require('path');var timeout=require(_0xfd41('0x2'));var express=require(_0xfd41('0x3'));var router=express[_0xfd41('0x4')]();var fs_extra=require(_0xfd41('0x5'));var auth=require(_0xfd41('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfd41('0x7'));router[_0xfd41('0x8')]('/',auth['isAuthenticated'](),controller[_0xfd41('0x9')]);router['get'](_0xfd41('0xa'),auth[_0xfd41('0xb')](),controller['show']);router[_0xfd41('0x8')](_0xfd41('0xc'),auth['isAuthenticated'](),controller[_0xfd41('0xd')]);router[_0xfd41('0x8')](_0xfd41('0xe'),auth[_0xfd41('0xb')](),controller['getAgents']);router[_0xfd41('0xf')]('/',auth['isAuthenticated'](),controller[_0xfd41('0x10')]);router[_0xfd41('0xf')](_0xfd41('0xc'),auth['isAuthenticated'](),controller[_0xfd41('0x11')]);router[_0xfd41('0xf')](_0xfd41('0xe'),auth[_0xfd41('0xb')](),controller[_0xfd41('0x12')]);router[_0xfd41('0x13')](_0xfd41('0xa'),auth['isAuthenticated'](),controller[_0xfd41('0x14')]);router[_0xfd41('0x15')](_0xfd41('0xa'),auth[_0xfd41('0xb')](),controller['destroy']);router[_0xfd41('0x15')](_0xfd41('0xc'),auth[_0xfd41('0xb')](),controller[_0xfd41('0x16')]);router[_0xfd41('0x15')](_0xfd41('0xe'),auth[_0xfd41('0xb')](),controller[_0xfd41('0x17')]);module[_0xfd41('0x18')]=router; \ No newline at end of file +var _0xee1e=['show','/:id/queues','/:id/users','getAgents','create','post','addQueues','addAgents','put','/:id','update','delete','removeQueues','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x1ace0d,_0x5cdbfa){var _0x4aa33b=function(_0x2b380e){while(--_0x2b380e){_0x1ace0d['push'](_0x1ace0d['shift']());}};_0x4aa33b(++_0x5cdbfa);}(_0xee1e,0x100));var _0xeee1=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0xee1e[_0x22e9fe];return _0x47cd19;};'use strict';var multer=require('multer');var util=require(_0xeee1('0x0'));var path=require(_0xeee1('0x1'));var timeout=require(_0xeee1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xeee1('0x3'));var auth=require(_0xeee1('0x4'));var interaction=require(_0xeee1('0x5'));var config=require('../../config/environment');var controller=require('./team.controller');router[_0xeee1('0x6')]('/',auth[_0xeee1('0x7')](),controller['index']);router[_0xeee1('0x6')]('/:id',auth[_0xeee1('0x7')](),controller[_0xeee1('0x8')]);router['get'](_0xeee1('0x9'),auth[_0xeee1('0x7')](),controller['getQueues']);router['get'](_0xeee1('0xa'),auth['isAuthenticated'](),controller[_0xeee1('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeee1('0xc')]);router[_0xeee1('0xd')](_0xeee1('0x9'),auth[_0xeee1('0x7')](),controller[_0xeee1('0xe')]);router[_0xeee1('0xd')](_0xeee1('0xa'),auth[_0xeee1('0x7')](),controller[_0xeee1('0xf')]);router[_0xeee1('0x10')](_0xeee1('0x11'),auth[_0xeee1('0x7')](),controller[_0xeee1('0x12')]);router['delete'](_0xeee1('0x11'),auth[_0xeee1('0x7')](),controller['destroy']);router[_0xeee1('0x13')]('/:id/queues',auth[_0xeee1('0x7')](),controller[_0xeee1('0x14')]);router[_0xeee1('0x13')](_0xeee1('0xa'),auth[_0xeee1('0x7')](),controller['removeAgents']);module[_0xeee1('0x15')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index b299113..e2d1713 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 _0x436b=['name','sequelize','exports','STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x436b,0x131));var _0xb436=function(_0x50eab9,_0x1a6d00){_0x50eab9=_0x50eab9-0x0;var _0x102a2f=_0x436b[_0x50eab9];return _0x102a2f;};'use strict';var Sequelize=require(_0xb436('0x0'));module[_0xb436('0x1')]={'name':{'type':Sequelize[_0xb436('0x2')],'allowNull':![],'unique':_0xb436('0x3')},'description':{'type':Sequelize[_0xb436('0x2')]}}; \ No newline at end of file +var _0x1173=['STRING','exports','name'];(function(_0x57adde,_0x358c1e){var _0x589458=function(_0x2c6e01){while(--_0x2c6e01){_0x57adde['push'](_0x57adde['shift']());}};_0x589458(++_0x358c1e);}(_0x1173,0x1d8));var _0x3117=function(_0x4ad364,_0x3ff8d7){_0x4ad364=_0x4ad364-0x0;var _0x4ac3c3=_0x1173[_0x4ad364];return _0x4ac3c3;};'use strict';var Sequelize=require('sequelize');module[_0x3117('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3117('0x1')},'description':{'type':Sequelize[_0x3117('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 6aff935..92c64c9 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 _0x1c75=['Team','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','keys','find','catch','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','params','channel','isValidChannel','Sequelize','Unknown\x20channel','capitalize','Queue','order','pick','toLowerCase','Queues','addQueues','ValidationError','add','remove','ids','addAgents','Voice','Chat','Mail','Fax','Whatsapp','sequelize','transaction','through','penalty','TeamVoiceQueue','User','findOrCreate','QueueId','voicePause','interface','upsert','SIP/%s','all','Sms','removeAgents','emit','Queue:remove','getAgents','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./team.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Teams','stack','name','index'];(function(_0x563c9c,_0x3f4699){var _0x3af8d4=function(_0x2d8599){while(--_0x2d8599){_0x563c9c['push'](_0x563c9c['shift']());}};_0x3af8d4(++_0x3f4699);}(_0x1c75,0xce));var _0x51c7=function(_0x5755bf,_0x5a50ba){_0x5755bf=_0x5755bf-0x0;var _0x156408=_0x1c75[_0x5755bf];return _0x156408;};'use strict';var pdf=require(_0x51c7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x51c7('0x1'));var rp=require(_0x51c7('0x2'));var moment=require(_0x51c7('0x3'));var BPromise=require(_0x51c7('0x4'));var Mustache=require(_0x51c7('0x5'));var util=require(_0x51c7('0x6'));var path=require(_0x51c7('0x7'));var sox=require(_0x51c7('0x8'));var csv=require(_0x51c7('0x9'));var ejs=require(_0x51c7('0xa'));var fs=require('fs');var fs_extra=require(_0x51c7('0xb'));var _=require('lodash');var squel=require(_0x51c7('0xc'));var crypto=require(_0x51c7('0xd'));var jsforce=require(_0x51c7('0xe'));var deskjs=require(_0x51c7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x51c7('0x10'));var Papa=require('papaparse');var Redis=require(_0x51c7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x51c7('0x12'));var as=require(_0x51c7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x51c7('0x14'))(_0x51c7('0x15'));var utils=require(_0x51c7('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x51c7('0x17')]=_[_0x51c7('0x18')](config[_0x51c7('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x51c7('0x19'))(new Redis(config['redis']));require(_0x51c7('0x1a'))['register'](socket);function respondWithStatusCode(_0x2e54af,_0x48f08a){_0x48f08a=_0x48f08a||0xcc;return function(_0x730429){if(_0x730429){return _0x2e54af[_0x51c7('0x1b')](_0x48f08a);}return _0x2e54af[_0x51c7('0x1c')](_0x48f08a)[_0x51c7('0x1d')]();};}function respondWithResult(_0x521d8a,_0x177e14){_0x177e14=_0x177e14||0xc8;return function(_0x1782d6){if(_0x1782d6){return _0x521d8a[_0x51c7('0x1c')](_0x177e14)[_0x51c7('0x1e')](_0x1782d6);}};}function respondWithFilteredResult(_0x209ab3,_0x36b29a){return function(_0x4a64e4){if(_0x4a64e4){var _0xe4cf49=_0x4a64e4[_0x51c7('0x1f')],_0x8dd5b0=_0x36b29a[_0x51c7('0x20')],_0x6960a9=_0x36b29a['offset']+_0x36b29a['limit'],_0x52bb0d;if(_0x6960a9>=_0xe4cf49){_0x6960a9=_0xe4cf49;_0x52bb0d=0xc8;}else{_0x52bb0d=0xce;}_0x209ab3[_0x51c7('0x1c')](_0x52bb0d);return _0x209ab3[_0x51c7('0x21')](_0x51c7('0x22'),_0x8dd5b0+'-'+_0x6960a9+'/'+_0xe4cf49)[_0x51c7('0x1e')](_0x4a64e4);}return null;};}function patchUpdates(_0x4072b9){return function(_0x3a7c98){try{jsonpatch[_0x51c7('0x23')](_0x3a7c98,_0x4072b9,!![]);}catch(_0x5248e2){return BPromise[_0x51c7('0x24')](_0x5248e2);}return _0x3a7c98[_0x51c7('0x25')]();};}function saveUpdates(_0x4e0108,_0x23bf9c){return function(_0x48b259){if(_0x48b259){return _0x48b259[_0x51c7('0x26')](_0x4e0108)[_0x51c7('0x27')](function(_0x414de0){return _0x414de0;});}return null;};}function removeEntity(_0x48e6e6,_0x11f01f){return function(_0x2a76a5){if(_0x2a76a5){return _0x2a76a5[_0x51c7('0x28')]()[_0x51c7('0x27')](function(){var _0x44de99=_0x2a76a5[_0x51c7('0x29')]({'plain':!![]});var _0x57fe70=_0x51c7('0x2a');return db['UserProfileResource'][_0x51c7('0x28')]({'where':{'type':_0x57fe70,'resourceId':_0x44de99['id']}})[_0x51c7('0x27')](function(){return _0x2a76a5;});})[_0x51c7('0x27')](function(){_0x48e6e6[_0x51c7('0x1c')](0xcc)[_0x51c7('0x1d')]();});}};}function handleEntityNotFound(_0x224940,_0x32ac6e){return function(_0x198465){if(!_0x198465){_0x224940[_0x51c7('0x1b')](0x194);}return _0x198465;};}function handleError(_0x2a18e0,_0x104315){_0x104315=_0x104315||0x1f4;return function(_0x16db1b){logger['error'](_0x16db1b[_0x51c7('0x2b')]);if(_0x16db1b[_0x51c7('0x2c')]){delete _0x16db1b[_0x51c7('0x2c')];}_0x2a18e0[_0x51c7('0x1c')](_0x104315)['send'](_0x16db1b);};}exports[_0x51c7('0x2d')]=function(_0x5e90bc,_0x3d590d){var _0x29b08a={},_0x47476e={},_0x5882c9={'count':0x0,'rows':[]};var _0xa7ff09=_['map'](db[_0x51c7('0x2e')][_0x51c7('0x2f')],function(_0x239fc6){return{'name':_0x239fc6[_0x51c7('0x30')],'type':_0x239fc6[_0x51c7('0x31')][_0x51c7('0x32')]};});_0x47476e[_0x51c7('0x33')]=_[_0x51c7('0x34')](_0xa7ff09,_0x51c7('0x2c'));_0x47476e[_0x51c7('0x35')]=_['keys'](_0x5e90bc[_0x51c7('0x35')]);_0x47476e['filters']=_[_0x51c7('0x36')](_0x47476e[_0x51c7('0x33')],_0x47476e['query']);_0x29b08a[_0x51c7('0x37')]=_[_0x51c7('0x36')](_0x47476e[_0x51c7('0x33')],qs[_0x51c7('0x38')](_0x5e90bc['query'][_0x51c7('0x38')]));_0x29b08a[_0x51c7('0x37')]=_0x29b08a[_0x51c7('0x37')][_0x51c7('0x39')]?_0x29b08a['attributes']:_0x47476e[_0x51c7('0x33')];if(!_0x5e90bc[_0x51c7('0x35')][_0x51c7('0x3a')](_0x51c7('0x3b'))){_0x29b08a[_0x51c7('0x3c')]=qs['limit'](_0x5e90bc[_0x51c7('0x35')]['limit']);_0x29b08a[_0x51c7('0x20')]=qs['offset'](_0x5e90bc[_0x51c7('0x35')][_0x51c7('0x20')]);}_0x29b08a['order']=qs[_0x51c7('0x3d')](_0x5e90bc[_0x51c7('0x35')][_0x51c7('0x3d')]);_0x29b08a[_0x51c7('0x3e')]=qs['filters'](_['pick'](_0x5e90bc[_0x51c7('0x35')],_0x47476e[_0x51c7('0x3f')]),_0xa7ff09);if(_0x5e90bc[_0x51c7('0x35')][_0x51c7('0x40')]){_0x29b08a['where']=_[_0x51c7('0x41')](_0x29b08a['where'],{'$or':_[_0x51c7('0x34')](_0xa7ff09,function(_0x1a5d25){if(_0x1a5d25[_0x51c7('0x31')]!==_0x51c7('0x42')){var _0x53a154={};_0x53a154[_0x1a5d25[_0x51c7('0x2c')]]={'$like':'%'+_0x5e90bc[_0x51c7('0x35')][_0x51c7('0x40')]+'%'};return _0x53a154;}})});}_0x29b08a=_[_0x51c7('0x41')]({},_0x29b08a,_0x5e90bc[_0x51c7('0x43')]);var _0x2cf6cf={'where':_0x29b08a['where']};return db['Team'][_0x51c7('0x1f')](_0x2cf6cf)[_0x51c7('0x27')](function(_0x5dd64a){_0x5882c9[_0x51c7('0x1f')]=_0x5dd64a;if(_0x5e90bc[_0x51c7('0x35')][_0x51c7('0x44')]){_0x29b08a[_0x51c7('0x45')]=[{'all':!![]}];}return db[_0x51c7('0x2e')][_0x51c7('0x46')](_0x29b08a);})[_0x51c7('0x27')](function(_0x24f1c0){_0x5882c9[_0x51c7('0x47')]=_0x24f1c0;return _0x5882c9;})[_0x51c7('0x27')](respondWithFilteredResult(_0x3d590d,_0x29b08a))['catch'](handleError(_0x3d590d,null));};exports['show']=function(_0x1bc95c,_0x2ab2a1){var _0x39ffba={'raw':![],'where':{'id':_0x1bc95c['params']['id']}},_0x415d2e={};_0x415d2e['model']=_[_0x51c7('0x48')](db[_0x51c7('0x2e')][_0x51c7('0x2f')]);_0x415d2e['query']=_[_0x51c7('0x48')](_0x1bc95c[_0x51c7('0x35')]);_0x415d2e[_0x51c7('0x3f')]=_[_0x51c7('0x36')](_0x415d2e['model'],_0x415d2e[_0x51c7('0x35')]);_0x39ffba['attributes']=_[_0x51c7('0x36')](_0x415d2e[_0x51c7('0x33')],qs[_0x51c7('0x38')](_0x1bc95c[_0x51c7('0x35')]['fields']));_0x39ffba['attributes']=_0x39ffba['attributes'][_0x51c7('0x39')]?_0x39ffba[_0x51c7('0x37')]:_0x415d2e['model'];if(_0x1bc95c['query']['includeAll']){_0x39ffba[_0x51c7('0x45')]=[{'all':!![]}];}_0x39ffba=_['merge']({},_0x39ffba,_0x1bc95c[_0x51c7('0x43')]);return db[_0x51c7('0x2e')][_0x51c7('0x49')](_0x39ffba)[_0x51c7('0x27')](handleEntityNotFound(_0x2ab2a1,null))['then'](respondWithResult(_0x2ab2a1,null))[_0x51c7('0x4a')](handleError(_0x2ab2a1,null));};exports[_0x51c7('0x4b')]=function(_0x10fd72,_0x2f506b){return db[_0x51c7('0x2e')][_0x51c7('0x4b')](_0x10fd72[_0x51c7('0x4c')],{})[_0x51c7('0x27')](function(_0x4d2ed0){var _0xf730ed=_0x10fd72[_0x51c7('0x4d')][_0x51c7('0x29')]({'plain':!![]});if(!_0xf730ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf730ed[_0x51c7('0x4e')]==='user'){var _0x168bb2=_0x4d2ed0[_0x51c7('0x29')]({'plain':!![]});var _0x3e70eb=_0x51c7('0x2a');return db[_0x51c7('0x4f')][_0x51c7('0x49')]({'where':{'name':_0x3e70eb,'userProfileId':_0xf730ed['userProfileId']},'raw':!![]})['then'](function(_0x14c9e4){if(_0x14c9e4&&_0x14c9e4[_0x51c7('0x50')]===0x0){return db[_0x51c7('0x51')][_0x51c7('0x4b')]({'name':_0x168bb2[_0x51c7('0x2c')],'resourceId':_0x168bb2['id'],'type':_0x14c9e4[_0x51c7('0x2c')],'sectionId':_0x14c9e4['id']},{})[_0x51c7('0x27')](function(){return _0x4d2ed0;});}else{return _0x4d2ed0;}})[_0x51c7('0x4a')](function(_0x3fee47){logger[_0x51c7('0x52')](_0x51c7('0x53'),_0x3fee47);throw _0x3fee47;});}return _0x4d2ed0;})[_0x51c7('0x27')](respondWithResult(_0x2f506b,0xc9))[_0x51c7('0x4a')](handleError(_0x2f506b,null));};exports[_0x51c7('0x26')]=function(_0x45459b,_0x1c25c1){if(_0x45459b[_0x51c7('0x4c')]['id']){delete _0x45459b[_0x51c7('0x4c')]['id'];}return db[_0x51c7('0x2e')]['find']({'where':{'id':_0x45459b['params']['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x1c25c1,null))[_0x51c7('0x27')](saveUpdates(_0x45459b[_0x51c7('0x4c')],null))[_0x51c7('0x27')](respondWithResult(_0x1c25c1,null))['catch'](handleError(_0x1c25c1,null));};exports[_0x51c7('0x28')]=function(_0x1f4fb6,_0x5453c5){return db[_0x51c7('0x2e')][_0x51c7('0x49')]({'where':{'id':_0x1f4fb6['params']['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x5453c5,null))[_0x51c7('0x27')](removeEntity(_0x5453c5,null))[_0x51c7('0x4a')](handleError(_0x5453c5,null));};exports[_0x51c7('0x54')]=function(_0x4a7fae,_0x4a5549,_0x76a1ec){return db[_0x51c7('0x2e')][_0x51c7('0x55')]({'where':{'id':_0x4a7fae[_0x51c7('0x56')]['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x4a5549,null))[_0x51c7('0x27')](function(_0x144298){if(!_0x4a7fae[_0x51c7('0x35')][_0x51c7('0x57')]||!utils[_0x51c7('0x58')](_0x4a7fae['query']['channel'])){throw new db[(_0x51c7('0x59'))]['ValidationError'](_0x51c7('0x5a'));}var _0x5d1798={};var _0x3424bb={};_0x3424bb[_0x51c7('0x33')]=_['keys'](db[_[_0x51c7('0x5b')](_0x4a7fae[_0x51c7('0x35')]['channel']['toLowerCase']())+_0x51c7('0x5c')][_0x51c7('0x2f')]);_0x3424bb['query']=_[_0x51c7('0x48')](_0x4a7fae[_0x51c7('0x35')]);_0x3424bb[_0x51c7('0x3f')]=_['intersection'](_0x3424bb[_0x51c7('0x33')],_0x3424bb[_0x51c7('0x35')]);_0x5d1798[_0x51c7('0x37')]=_['intersection'](_0x3424bb['model'],qs[_0x51c7('0x38')](_0x4a7fae[_0x51c7('0x35')][_0x51c7('0x38')]));_0x5d1798[_0x51c7('0x37')]=_0x5d1798[_0x51c7('0x37')][_0x51c7('0x39')]?_0x5d1798[_0x51c7('0x37')]:_0x3424bb[_0x51c7('0x33')];_0x5d1798[_0x51c7('0x3c')]=qs['limit'](_0x4a7fae[_0x51c7('0x35')]['limit']);_0x5d1798[_0x51c7('0x20')]=qs[_0x51c7('0x20')](_0x4a7fae[_0x51c7('0x35')]['offset']);_0x5d1798[_0x51c7('0x5d')]=qs[_0x51c7('0x3d')](_0x4a7fae[_0x51c7('0x35')][_0x51c7('0x3d')]);_0x5d1798[_0x51c7('0x3e')]=qs['filters'](_[_0x51c7('0x5e')](_0x4a7fae[_0x51c7('0x35')],_0x3424bb['filters']));_0x5d1798=_['merge']({},_0x5d1798,_0x4a7fae['options']);return _0x144298[_0x51c7('0x29')+_[_0x51c7('0x5b')](_0x4a7fae[_0x51c7('0x35')][_0x51c7('0x57')][_0x51c7('0x5f')]())+_0x51c7('0x60')](_0x5d1798);})[_0x51c7('0x27')](respondWithResult(_0x4a5549,null))[_0x51c7('0x4a')](handleError(_0x4a5549,null));};exports[_0x51c7('0x61')]=function(_0x564db5,_0x2eddb8,_0x24a905){return db['Team'][_0x51c7('0x55')]({'where':{'id':_0x564db5[_0x51c7('0x56')]['id']}})[_0x51c7('0x27')](function(_0x5c5d2f){if(_0x5c5d2f){if(!_0x564db5[_0x51c7('0x4c')][_0x51c7('0x57')]||!utils['isValidChannel'](_0x564db5[_0x51c7('0x4c')][_0x51c7('0x57')])){throw new db[(_0x51c7('0x59'))][(_0x51c7('0x62'))](_0x51c7('0x5a'));}return _0x5c5d2f[_0x51c7('0x63')+_['capitalize'](_0x564db5[_0x51c7('0x4c')]['channel'][_0x51c7('0x5f')]())+_0x51c7('0x60')](_0x564db5[_0x51c7('0x4c')]['ids']);}return null;})[_0x51c7('0x27')](handleEntityNotFound(_0x2eddb8,null))[_0x51c7('0x27')](respondWithStatusCode(_0x2eddb8,null))[_0x51c7('0x4a')](handleError(_0x2eddb8,null));};exports['removeQueues']=function(_0x2ce9a9,_0x20c68c,_0xb1abdf){return db[_0x51c7('0x2e')][_0x51c7('0x55')]({'where':{'id':_0x2ce9a9[_0x51c7('0x56')]['id']}})[_0x51c7('0x27')](function(_0x1b8cff){if(_0x1b8cff){if(!_0x2ce9a9['query']['channel']||!utils['isValidChannel'](_0x2ce9a9[_0x51c7('0x35')][_0x51c7('0x57')])){throw new db[(_0x51c7('0x59'))][(_0x51c7('0x62'))]('Unknown\x20channel');}return _0x1b8cff[_0x51c7('0x64')+_[_0x51c7('0x5b')](_0x2ce9a9['query'][_0x51c7('0x57')][_0x51c7('0x5f')]())+_0x51c7('0x60')](_0x2ce9a9[_0x51c7('0x35')][_0x51c7('0x65')]);}return null;})['then'](handleEntityNotFound(_0x20c68c,null))[_0x51c7('0x27')](respondWithStatusCode(_0x20c68c,null))[_0x51c7('0x4a')](handleError(_0x20c68c,null));};exports[_0x51c7('0x66')]=function(_0x4a7de5,_0x2b1216){return db[_0x51c7('0x2e')][_0x51c7('0x49')]({'where':{'id':_0x4a7de5['params']['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x2b1216,null))[_0x51c7('0x27')](function(_0x2b7da8){if(_0x2b7da8){var _0x26f93d=[_0x51c7('0x67'),_0x51c7('0x68'),_0x51c7('0x69'),'Sms',_0x51c7('0x6a'),'Openchannel',_0x51c7('0x6b')];return db[_0x51c7('0x6c')][_0x51c7('0x6d')](function(_0x2ea6bd){var _0x3cbc33=_[_0x51c7('0x34')](_0x26f93d,function(_0x14bdec){var _0x53b4f9={'attributes':['id',_0x51c7('0x2c')]};if(_0x14bdec===_0x51c7('0x67')){_0x53b4f9[_0x51c7('0x6e')]={'attributes':[_0x51c7('0x6f')]};}return _0x2b7da8[_0x51c7('0x29')+_0x14bdec+_0x51c7('0x60')](_0x53b4f9)[_0x51c7('0x27')](function(_0x5d9c3d){var _0x5d03cd=_['map'](_0x5d9c3d,function(_0x2280a6){var _0x44ed81=_[_0x51c7('0x34')](_0x4a7de5[_0x51c7('0x4c')][_0x51c7('0x65')],function(_0x522fa7){var _0x135a91={'where':{'UserId':_0x522fa7,[_0x14bdec+'QueueId']:_0x2280a6['id']},'transaction':_0x2ea6bd};if(_0x14bdec===_0x51c7('0x67')){_0x135a91[_0x51c7('0x18')]={'penalty':_0x2280a6[_0x51c7('0x70')][_0x51c7('0x6f')]};}return db[_0x51c7('0x71')+_0x14bdec+'Queue'][_0x51c7('0x72')](_0x135a91)[_0x51c7('0x27')](function(){socket['emit']('user'+_0x14bdec+'Queue:save',{'UserId':_0x522fa7,[_0x14bdec+_0x51c7('0x73')]:_0x2280a6['id']});if(_0x14bdec!==_0x51c7('0x67'))return;return db[_0x51c7('0x71')][_0x51c7('0x46')]({'where':{'id':_0x4a7de5[_0x51c7('0x4c')][_0x51c7('0x65')],'online':0x1},'attributes':['id',_0x51c7('0x2c'),'online',_0x51c7('0x74'),_0x51c7('0x75')],'raw':!![]})[_0x51c7('0x27')](function(_0x7b7285){var _0x31110c=_[_0x51c7('0x34')](_0x7b7285,function(_0x2e2bb0){return db['UserVoiceQueueRt'][_0x51c7('0x76')]({'membername':_0x2e2bb0['name'],'UserId':_0x2e2bb0['id'],'queue_name':_0x2280a6[_0x51c7('0x2c')],'VoiceQueueId':_0x2280a6['id'],'interface':_['isNil'](_0x2e2bb0[_0x51c7('0x75')])?util['format'](_0x51c7('0x77'),_0x2e2bb0[_0x51c7('0x2c')]):_0x2e2bb0['interface'],'paused':_0x2e2bb0[_0x51c7('0x74')]||![],'penalty':_0x2280a6[_0x51c7('0x70')][_0x51c7('0x6f')]},{'transaction':_0x2ea6bd});});return Promise[_0x51c7('0x78')](_0x31110c);});});});return Promise[_0x51c7('0x78')](_0x44ed81);});return Promise[_0x51c7('0x78')](_0x5d03cd);});});return Promise[_0x51c7('0x78')](_0x3cbc33)[_0x51c7('0x27')](function(){return _0x2b7da8['addAgents'](_0x4a7de5[_0x51c7('0x4c')][_0x51c7('0x65')],{'transaction':_0x2ea6bd})['spread'](function(_0x2f32b0){return _0x2f32b0;});});});}})['then'](respondWithResult(_0x2b1216,null))['catch'](handleError(_0x2b1216,null));};exports['removeAgents']=function(_0x941093,_0x405f5e){return db[_0x51c7('0x2e')][_0x51c7('0x49')]({'where':{'id':_0x941093[_0x51c7('0x56')]['id']}})['then'](handleEntityNotFound(_0x405f5e,null))[_0x51c7('0x27')](function(_0x321b1d){if(_0x321b1d){var _0x5c7546=[_0x51c7('0x67'),'Chat',_0x51c7('0x69'),_0x51c7('0x79'),_0x51c7('0x6a'),'Openchannel',_0x51c7('0x6b')];return db[_0x51c7('0x6c')]['transaction'](function(_0x55f740){var _0x3ccebc=_[_0x51c7('0x34')](_0x5c7546,function(_0x5ca0e5){var _0x880809={'attributes':['id',_0x51c7('0x2c')]};return _0x321b1d[_0x51c7('0x29')+_0x5ca0e5+_0x51c7('0x60')](_0x880809)[_0x51c7('0x27')](function(_0x36d28a){var _0x45a465=_['map'](_0x36d28a,function(_0x5f58a4){return _0x5f58a4[_0x51c7('0x7a')](_0x941093['query'][_0x51c7('0x65')],{'transaction':_0x55f740})[_0x51c7('0x27')](function(){var _0x4eb9fc=JSON['parse']('['+_0x941093['query'][_0x51c7('0x65')]+']');var _0xdf2202=_[_0x51c7('0x34')](_0x4eb9fc,function(_0x438215){socket[_0x51c7('0x7b')](_0x51c7('0x4d')+_0x5ca0e5+_0x51c7('0x7c'),{'UserId':Number(_0x438215),[_0x5ca0e5+_0x51c7('0x73')]:_0x5f58a4['id']});if(_0x5ca0e5!==_0x51c7('0x67'))return;return db['UserVoiceQueueRt'][_0x51c7('0x28')]({'where':{'VoiceQueueId':_0x5f58a4['id'],'UserId':_0x438215},'transaction':_0x55f740});});return Promise[_0x51c7('0x78')](_0xdf2202);});});return Promise[_0x51c7('0x78')](_0x45a465);});});return Promise[_0x51c7('0x78')](_0x3ccebc)[_0x51c7('0x27')](function(){return _0x321b1d[_0x51c7('0x7a')](_0x941093[_0x51c7('0x35')][_0x51c7('0x65')],{'transaction':_0x55f740});});});}})['then'](respondWithStatusCode(_0x405f5e,null))[_0x51c7('0x4a')](handleError(_0x405f5e,null));};exports[_0x51c7('0x7d')]=function(_0x244672,_0x1c2eaf,_0x7a0bb8){var _0x2bb6a6={};var _0x137656={};var _0x4c018b;var _0x550edf;return db[_0x51c7('0x2e')][_0x51c7('0x55')]({'where':{'id':_0x244672[_0x51c7('0x56')]['id']}})['then'](handleEntityNotFound(_0x1c2eaf,null))[_0x51c7('0x27')](function(_0x49f3b6){if(_0x49f3b6){_0x4c018b=_0x49f3b6;_0x137656['model']=_[_0x51c7('0x48')](db[_0x51c7('0x71')][_0x51c7('0x2f')]);_0x137656[_0x51c7('0x35')]=_[_0x51c7('0x48')](_0x244672[_0x51c7('0x35')]);_0x137656[_0x51c7('0x3f')]=_[_0x51c7('0x36')](_0x137656['model'],_0x137656[_0x51c7('0x35')]);_0x2bb6a6[_0x51c7('0x37')]=_['intersection'](_0x137656[_0x51c7('0x33')],qs[_0x51c7('0x38')](_0x244672[_0x51c7('0x35')][_0x51c7('0x38')]));_0x2bb6a6[_0x51c7('0x37')]=_0x2bb6a6[_0x51c7('0x37')]['length']?_0x2bb6a6[_0x51c7('0x37')]:_0x137656[_0x51c7('0x33')];_0x2bb6a6['order']=qs['sort'](_0x244672[_0x51c7('0x35')][_0x51c7('0x3d')]);_0x2bb6a6[_0x51c7('0x3e')]=qs[_0x51c7('0x3f')](_[_0x51c7('0x5e')](_0x244672[_0x51c7('0x35')],_0x137656['filters']));if(_0x244672['query'][_0x51c7('0x40')]){_0x2bb6a6[_0x51c7('0x3e')]=_['merge'](_0x2bb6a6['where'],{'$or':_[_0x51c7('0x34')](_0x2bb6a6[_0x51c7('0x37')],function(_0xfa35eb){var _0x2ae927={};_0x2ae927[_0xfa35eb]={'$like':'%'+_0x244672[_0x51c7('0x35')]['filter']+'%'};return _0x2ae927;})});}_0x2bb6a6=_['merge']({},_0x2bb6a6,_0x244672[_0x51c7('0x43')]);return _0x4c018b[_0x51c7('0x7d')](_0x2bb6a6);}})[_0x51c7('0x27')](function(_0x3897ab){if(_0x3897ab){_0x550edf=_0x3897ab['length'];if(!_0x244672[_0x51c7('0x35')]['hasOwnProperty'](_0x51c7('0x3b'))){_0x2bb6a6[_0x51c7('0x3c')]=qs[_0x51c7('0x3c')](_0x244672[_0x51c7('0x35')][_0x51c7('0x3c')]);_0x2bb6a6[_0x51c7('0x20')]=qs[_0x51c7('0x20')](_0x244672['query']['offset']);}return _0x4c018b[_0x51c7('0x7d')](_0x2bb6a6);}})[_0x51c7('0x27')](function(_0x5ae6bc){if(_0x5ae6bc){return _0x5ae6bc?{'count':_0x550edf,'rows':_0x5ae6bc}:null;}})[_0x51c7('0x27')](respondWithResult(_0x1c2eaf,null))[_0x51c7('0x4a')](handleError(_0x1c2eaf,null));}; \ No newline at end of file +var _0xcf12=['findAll','catch','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getQueues','channel','ValidationError','Unknown\x20channel','toLowerCase','Queue','addQueues','findOne','capitalize','Queues','ids','removeQueues','Sequelize','remove','addAgents','Mail','Sms','Fax','Openchannel','sequelize','transaction','Voice','through','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','removeAgents','Chat','Whatsapp','parse','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','name','merge','Team','count','include'];(function(_0x3020d5,_0x496039){var _0x4f1828=function(_0x2664a9){while(--_0x2664a9){_0x3020d5['push'](_0x3020d5['shift']());}};_0x4f1828(++_0x496039);}(_0xcf12,0x140));var _0x2cf1=function(_0x262593,_0x382dae){_0x262593=_0x262593-0x0;var _0x26c00e=_0xcf12[_0x262593];return _0x26c00e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2cf1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2cf1('0x1'));var jsonpatch=require(_0x2cf1('0x2'));var rp=require(_0x2cf1('0x3'));var moment=require('moment');var BPromise=require(_0x2cf1('0x4'));var Mustache=require(_0x2cf1('0x5'));var util=require(_0x2cf1('0x6'));var path=require(_0x2cf1('0x7'));var sox=require(_0x2cf1('0x8'));var csv=require(_0x2cf1('0x9'));var ejs=require(_0x2cf1('0xa'));var fs=require('fs');var fs_extra=require(_0x2cf1('0xb'));var _=require(_0x2cf1('0xc'));var squel=require('squel');var crypto=require(_0x2cf1('0xd'));var jsforce=require(_0x2cf1('0xe'));var deskjs=require(_0x2cf1('0xf'));var toCsv=require(_0x2cf1('0x9'));var querystring=require(_0x2cf1('0x10'));var Papa=require(_0x2cf1('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2cf1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2cf1('0x13'))(_0x2cf1('0x14'));var utils=require(_0x2cf1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2cf1('0x16'));var db=require('../../mysqldb')['db'];config[_0x2cf1('0x17')]=_[_0x2cf1('0x18')](config[_0x2cf1('0x17')],{'host':_0x2cf1('0x19'),'port':0x18eb});var socket=require(_0x2cf1('0x1a'))(new Redis(config[_0x2cf1('0x17')]));require(_0x2cf1('0x1b'))[_0x2cf1('0x1c')](socket);function respondWithStatusCode(_0x10c491,_0x58d102){_0x58d102=_0x58d102||0xcc;return function(_0x4298b9){if(_0x4298b9){return _0x10c491[_0x2cf1('0x1d')](_0x58d102);}return _0x10c491['status'](_0x58d102)[_0x2cf1('0x1e')]();};}function respondWithResult(_0x2f0ac7,_0x46afec){_0x46afec=_0x46afec||0xc8;return function(_0x200378){if(_0x200378){return _0x2f0ac7[_0x2cf1('0x1f')](_0x46afec)[_0x2cf1('0x20')](_0x200378);}};}function respondWithFilteredResult(_0x1b3506,_0x15685d){return function(_0x35b1d7){if(_0x35b1d7){var _0x3e1da5=_0x35b1d7['count'],_0x3abd2c=_0x15685d[_0x2cf1('0x21')],_0x4a6dc3=_0x15685d[_0x2cf1('0x21')]+_0x15685d[_0x2cf1('0x22')],_0x1c94d3;if(_0x4a6dc3>=_0x3e1da5){_0x4a6dc3=_0x3e1da5;_0x1c94d3=0xc8;}else{_0x1c94d3=0xce;}_0x1b3506[_0x2cf1('0x1f')](_0x1c94d3);return _0x1b3506[_0x2cf1('0x23')](_0x2cf1('0x24'),_0x3abd2c+'-'+_0x4a6dc3+'/'+_0x3e1da5)[_0x2cf1('0x20')](_0x35b1d7);}return null;};}function patchUpdates(_0x345d77){return function(_0x59684b){try{jsonpatch[_0x2cf1('0x25')](_0x59684b,_0x345d77,!![]);}catch(_0x2b33f3){return BPromise[_0x2cf1('0x26')](_0x2b33f3);}return _0x59684b['save']();};}function saveUpdates(_0x1ef1fd,_0x58b1b0){return function(_0x436bb9){if(_0x436bb9){return _0x436bb9[_0x2cf1('0x27')](_0x1ef1fd)[_0x2cf1('0x28')](function(_0x11d73e){return _0x11d73e;});}return null;};}function removeEntity(_0x4c3ac3,_0x581878){return function(_0x3e5cae){if(_0x3e5cae){return _0x3e5cae[_0x2cf1('0x29')]()[_0x2cf1('0x28')](function(){var _0x5d86f2=_0x3e5cae[_0x2cf1('0x2a')]({'plain':!![]});var _0x56291c='Teams';return db[_0x2cf1('0x2b')]['destroy']({'where':{'type':_0x56291c,'resourceId':_0x5d86f2['id']}})[_0x2cf1('0x28')](function(){return _0x3e5cae;});})[_0x2cf1('0x28')](function(){_0x4c3ac3[_0x2cf1('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x276d3b,_0x4f143e){return function(_0x4c564a){if(!_0x4c564a){_0x276d3b[_0x2cf1('0x1d')](0x194);}return _0x4c564a;};}function handleError(_0x7d909f,_0x2dc6a2){_0x2dc6a2=_0x2dc6a2||0x1f4;return function(_0x1d4308){logger[_0x2cf1('0x2c')](_0x1d4308[_0x2cf1('0x2d')]);if(_0x1d4308['name']){delete _0x1d4308['name'];}_0x7d909f[_0x2cf1('0x1f')](_0x2dc6a2)[_0x2cf1('0x2e')](_0x1d4308);};}exports[_0x2cf1('0x2f')]=function(_0x2ade86,_0x30fb1a){var _0x43f388={},_0x5a1b7e={},_0x1bf9e6={'count':0x0,'rows':[]};var _0x4b160e=_[_0x2cf1('0x30')](db['Team'][_0x2cf1('0x31')],function(_0x27cfab){return{'name':_0x27cfab['fieldName'],'type':_0x27cfab[_0x2cf1('0x32')][_0x2cf1('0x33')]};});_0x5a1b7e[_0x2cf1('0x34')]=_[_0x2cf1('0x30')](_0x4b160e,'name');_0x5a1b7e[_0x2cf1('0x35')]=_[_0x2cf1('0x36')](_0x2ade86[_0x2cf1('0x35')]);_0x5a1b7e[_0x2cf1('0x37')]=_[_0x2cf1('0x38')](_0x5a1b7e[_0x2cf1('0x34')],_0x5a1b7e['query']);_0x43f388['attributes']=_[_0x2cf1('0x38')](_0x5a1b7e['model'],qs[_0x2cf1('0x39')](_0x2ade86[_0x2cf1('0x35')][_0x2cf1('0x39')]));_0x43f388[_0x2cf1('0x3a')]=_0x43f388[_0x2cf1('0x3a')][_0x2cf1('0x3b')]?_0x43f388['attributes']:_0x5a1b7e[_0x2cf1('0x34')];if(!_0x2ade86[_0x2cf1('0x35')][_0x2cf1('0x3c')](_0x2cf1('0x3d'))){_0x43f388[_0x2cf1('0x22')]=qs[_0x2cf1('0x22')](_0x2ade86['query'][_0x2cf1('0x22')]);_0x43f388[_0x2cf1('0x21')]=qs[_0x2cf1('0x21')](_0x2ade86['query'][_0x2cf1('0x21')]);}_0x43f388[_0x2cf1('0x3e')]=qs[_0x2cf1('0x3f')](_0x2ade86['query'][_0x2cf1('0x3f')]);_0x43f388['where']=qs['filters'](_[_0x2cf1('0x40')](_0x2ade86['query'],_0x5a1b7e[_0x2cf1('0x37')]),_0x4b160e);if(_0x2ade86[_0x2cf1('0x35')][_0x2cf1('0x41')]){_0x43f388[_0x2cf1('0x42')]=_['merge'](_0x43f388[_0x2cf1('0x42')],{'$or':_[_0x2cf1('0x30')](_0x4b160e,function(_0x442f88){if(_0x442f88[_0x2cf1('0x32')]!==_0x2cf1('0x43')){var _0x255d9c={};_0x255d9c[_0x442f88[_0x2cf1('0x44')]]={'$like':'%'+_0x2ade86['query'][_0x2cf1('0x41')]+'%'};return _0x255d9c;}})});}_0x43f388=_[_0x2cf1('0x45')]({},_0x43f388,_0x2ade86['options']);var _0x44b18e={'where':_0x43f388[_0x2cf1('0x42')]};return db[_0x2cf1('0x46')]['count'](_0x44b18e)[_0x2cf1('0x28')](function(_0x55face){_0x1bf9e6[_0x2cf1('0x47')]=_0x55face;if(_0x2ade86[_0x2cf1('0x35')]['includeAll']){_0x43f388[_0x2cf1('0x48')]=[{'all':!![]}];}return db[_0x2cf1('0x46')][_0x2cf1('0x49')](_0x43f388);})[_0x2cf1('0x28')](function(_0xabe945){_0x1bf9e6['rows']=_0xabe945;return _0x1bf9e6;})[_0x2cf1('0x28')](respondWithFilteredResult(_0x30fb1a,_0x43f388))[_0x2cf1('0x4a')](handleError(_0x30fb1a,null));};exports['show']=function(_0x38e90b,_0x3eb456){var _0x369a8d={'raw':![],'where':{'id':_0x38e90b[_0x2cf1('0x4b')]['id']}},_0x50c38b={};_0x50c38b[_0x2cf1('0x34')]=_[_0x2cf1('0x36')](db[_0x2cf1('0x46')][_0x2cf1('0x31')]);_0x50c38b['query']=_[_0x2cf1('0x36')](_0x38e90b[_0x2cf1('0x35')]);_0x50c38b[_0x2cf1('0x37')]=_[_0x2cf1('0x38')](_0x50c38b[_0x2cf1('0x34')],_0x50c38b['query']);_0x369a8d[_0x2cf1('0x3a')]=_[_0x2cf1('0x38')](_0x50c38b['model'],qs['fields'](_0x38e90b[_0x2cf1('0x35')][_0x2cf1('0x39')]));_0x369a8d[_0x2cf1('0x3a')]=_0x369a8d[_0x2cf1('0x3a')][_0x2cf1('0x3b')]?_0x369a8d[_0x2cf1('0x3a')]:_0x50c38b[_0x2cf1('0x34')];if(_0x38e90b[_0x2cf1('0x35')][_0x2cf1('0x4c')]){_0x369a8d[_0x2cf1('0x48')]=[{'all':!![]}];}_0x369a8d=_[_0x2cf1('0x45')]({},_0x369a8d,_0x38e90b[_0x2cf1('0x4d')]);return db[_0x2cf1('0x46')]['find'](_0x369a8d)[_0x2cf1('0x28')](handleEntityNotFound(_0x3eb456,null))[_0x2cf1('0x28')](respondWithResult(_0x3eb456,null))['catch'](handleError(_0x3eb456,null));};exports[_0x2cf1('0x4e')]=function(_0x1dde79,_0x52af64){return db[_0x2cf1('0x46')][_0x2cf1('0x4e')](_0x1dde79[_0x2cf1('0x4f')],{})['then'](function(_0x2872c0){var _0x361373=_0x1dde79[_0x2cf1('0x50')][_0x2cf1('0x2a')]({'plain':!![]});if(!_0x361373)throw new Error(_0x2cf1('0x51'));if(_0x361373[_0x2cf1('0x52')]==='user'){var _0x1155af=_0x2872c0[_0x2cf1('0x2a')]({'plain':!![]});var _0x6ec94f=_0x2cf1('0x53');return db[_0x2cf1('0x54')]['find']({'where':{'name':_0x6ec94f,'userProfileId':_0x361373[_0x2cf1('0x55')]},'raw':!![]})[_0x2cf1('0x28')](function(_0x49828e){if(_0x49828e&&_0x49828e[_0x2cf1('0x56')]===0x0){return db[_0x2cf1('0x2b')][_0x2cf1('0x4e')]({'name':_0x1155af['name'],'resourceId':_0x1155af['id'],'type':_0x49828e[_0x2cf1('0x44')],'sectionId':_0x49828e['id']},{})[_0x2cf1('0x28')](function(){return _0x2872c0;});}else{return _0x2872c0;}})[_0x2cf1('0x4a')](function(_0xc6e2be){logger['error'](_0x2cf1('0x57'),_0xc6e2be);throw _0xc6e2be;});}return _0x2872c0;})['then'](respondWithResult(_0x52af64,0xc9))['catch'](handleError(_0x52af64,null));};exports['update']=function(_0x2b6df8,_0x52156f){if(_0x2b6df8[_0x2cf1('0x4f')]['id']){delete _0x2b6df8[_0x2cf1('0x4f')]['id'];}return db[_0x2cf1('0x46')][_0x2cf1('0x58')]({'where':{'id':_0x2b6df8[_0x2cf1('0x4b')]['id']}})[_0x2cf1('0x28')](handleEntityNotFound(_0x52156f,null))[_0x2cf1('0x28')](saveUpdates(_0x2b6df8[_0x2cf1('0x4f')],null))[_0x2cf1('0x28')](respondWithResult(_0x52156f,null))[_0x2cf1('0x4a')](handleError(_0x52156f,null));};exports[_0x2cf1('0x29')]=function(_0x3afa78,_0x6b8ab7){return db[_0x2cf1('0x46')][_0x2cf1('0x58')]({'where':{'id':_0x3afa78[_0x2cf1('0x4b')]['id']}})[_0x2cf1('0x28')](handleEntityNotFound(_0x6b8ab7,null))[_0x2cf1('0x28')](removeEntity(_0x6b8ab7,null))[_0x2cf1('0x4a')](handleError(_0x6b8ab7,null));};exports[_0x2cf1('0x59')]=function(_0x264e7a,_0xb2d34e,_0x5e2a2b){return db[_0x2cf1('0x46')]['findOne']({'where':{'id':_0x264e7a['params']['id']}})[_0x2cf1('0x28')](handleEntityNotFound(_0xb2d34e,null))[_0x2cf1('0x28')](function(_0x1774b4){if(!_0x264e7a[_0x2cf1('0x35')][_0x2cf1('0x5a')]||!utils['isValidChannel'](_0x264e7a['query']['channel'])){throw new db['Sequelize'][(_0x2cf1('0x5b'))](_0x2cf1('0x5c'));}var _0x243845={};var _0x329936={};_0x329936[_0x2cf1('0x34')]=_[_0x2cf1('0x36')](db[_['capitalize'](_0x264e7a['query']['channel'][_0x2cf1('0x5d')]())+_0x2cf1('0x5e')][_0x2cf1('0x31')]);_0x329936[_0x2cf1('0x35')]=_['keys'](_0x264e7a[_0x2cf1('0x35')]);_0x329936[_0x2cf1('0x37')]=_[_0x2cf1('0x38')](_0x329936[_0x2cf1('0x34')],_0x329936[_0x2cf1('0x35')]);_0x243845['attributes']=_[_0x2cf1('0x38')](_0x329936[_0x2cf1('0x34')],qs[_0x2cf1('0x39')](_0x264e7a[_0x2cf1('0x35')][_0x2cf1('0x39')]));_0x243845['attributes']=_0x243845[_0x2cf1('0x3a')][_0x2cf1('0x3b')]?_0x243845[_0x2cf1('0x3a')]:_0x329936[_0x2cf1('0x34')];_0x243845[_0x2cf1('0x22')]=qs[_0x2cf1('0x22')](_0x264e7a[_0x2cf1('0x35')][_0x2cf1('0x22')]);_0x243845[_0x2cf1('0x21')]=qs[_0x2cf1('0x21')](_0x264e7a[_0x2cf1('0x35')][_0x2cf1('0x21')]);_0x243845[_0x2cf1('0x3e')]=qs[_0x2cf1('0x3f')](_0x264e7a[_0x2cf1('0x35')][_0x2cf1('0x3f')]);_0x243845[_0x2cf1('0x42')]=qs['filters'](_[_0x2cf1('0x40')](_0x264e7a[_0x2cf1('0x35')],_0x329936[_0x2cf1('0x37')]));_0x243845=_['merge']({},_0x243845,_0x264e7a[_0x2cf1('0x4d')]);return _0x1774b4[_0x2cf1('0x2a')+_['capitalize'](_0x264e7a[_0x2cf1('0x35')][_0x2cf1('0x5a')][_0x2cf1('0x5d')]())+'Queues'](_0x243845);})[_0x2cf1('0x28')](respondWithResult(_0xb2d34e,null))['catch'](handleError(_0xb2d34e,null));};exports[_0x2cf1('0x5f')]=function(_0xbcb9f8,_0xfd384f,_0x36d902){return db[_0x2cf1('0x46')][_0x2cf1('0x60')]({'where':{'id':_0xbcb9f8[_0x2cf1('0x4b')]['id']}})[_0x2cf1('0x28')](function(_0x3c8db3){if(_0x3c8db3){if(!_0xbcb9f8['body']['channel']||!utils['isValidChannel'](_0xbcb9f8[_0x2cf1('0x4f')][_0x2cf1('0x5a')])){throw new db['Sequelize']['ValidationError'](_0x2cf1('0x5c'));}return _0x3c8db3['add'+_[_0x2cf1('0x61')](_0xbcb9f8[_0x2cf1('0x4f')][_0x2cf1('0x5a')][_0x2cf1('0x5d')]())+_0x2cf1('0x62')](_0xbcb9f8[_0x2cf1('0x4f')][_0x2cf1('0x63')]);}return null;})[_0x2cf1('0x28')](handleEntityNotFound(_0xfd384f,null))['then'](respondWithStatusCode(_0xfd384f,null))[_0x2cf1('0x4a')](handleError(_0xfd384f,null));};exports[_0x2cf1('0x64')]=function(_0x53900b,_0x2403eb,_0x5bd021){return db['Team'][_0x2cf1('0x60')]({'where':{'id':_0x53900b[_0x2cf1('0x4b')]['id']}})[_0x2cf1('0x28')](function(_0x39e434){if(_0x39e434){if(!_0x53900b[_0x2cf1('0x35')][_0x2cf1('0x5a')]||!utils['isValidChannel'](_0x53900b[_0x2cf1('0x35')][_0x2cf1('0x5a')])){throw new db[(_0x2cf1('0x65'))][(_0x2cf1('0x5b'))]('Unknown\x20channel');}return _0x39e434[_0x2cf1('0x66')+_[_0x2cf1('0x61')](_0x53900b[_0x2cf1('0x35')][_0x2cf1('0x5a')][_0x2cf1('0x5d')]())+'Queues'](_0x53900b[_0x2cf1('0x35')][_0x2cf1('0x63')]);}return null;})['then'](handleEntityNotFound(_0x2403eb,null))[_0x2cf1('0x28')](respondWithStatusCode(_0x2403eb,null))[_0x2cf1('0x4a')](handleError(_0x2403eb,null));};exports[_0x2cf1('0x67')]=function(_0xec8683,_0x48a712){return db[_0x2cf1('0x46')]['find']({'where':{'id':_0xec8683[_0x2cf1('0x4b')]['id']}})[_0x2cf1('0x28')](handleEntityNotFound(_0x48a712,null))[_0x2cf1('0x28')](function(_0x264868){if(_0x264868){var _0x568ffb=['Voice','Chat',_0x2cf1('0x68'),_0x2cf1('0x69'),_0x2cf1('0x6a'),_0x2cf1('0x6b'),'Whatsapp'];return db[_0x2cf1('0x6c')][_0x2cf1('0x6d')](function(_0x1c9135){var _0x5f3194=_[_0x2cf1('0x30')](_0x568ffb,function(_0xafd1ed){var _0x566b00={'attributes':['id',_0x2cf1('0x44')]};if(_0xafd1ed===_0x2cf1('0x6e')){_0x566b00[_0x2cf1('0x6f')]={'attributes':['penalty']};}return _0x264868[_0x2cf1('0x2a')+_0xafd1ed+'Queues'](_0x566b00)[_0x2cf1('0x28')](function(_0x2a0033){var _0x417b44=_[_0x2cf1('0x30')](_0x2a0033,function(_0x2f80d9){var _0x20beb0=_['map'](_0xec8683[_0x2cf1('0x4f')][_0x2cf1('0x63')],function(_0x320873){var _0x48b993={'where':{'UserId':_0x320873,[_0xafd1ed+'QueueId']:_0x2f80d9['id']},'transaction':_0x1c9135};if(_0xafd1ed==='Voice'){_0x48b993[_0x2cf1('0x18')]={'penalty':_0x2f80d9[_0x2cf1('0x70')][_0x2cf1('0x71')]};}return db[_0x2cf1('0x72')+_0xafd1ed+_0x2cf1('0x5e')][_0x2cf1('0x73')](_0x48b993)[_0x2cf1('0x28')](function(){socket[_0x2cf1('0x74')](_0x2cf1('0x50')+_0xafd1ed+_0x2cf1('0x75'),{'UserId':_0x320873,[_0xafd1ed+'QueueId']:_0x2f80d9['id']});if(_0xafd1ed!=='Voice')return;return db[_0x2cf1('0x72')][_0x2cf1('0x49')]({'where':{'id':_0xec8683[_0x2cf1('0x4f')][_0x2cf1('0x63')],'online':0x1},'attributes':['id','name','online',_0x2cf1('0x76'),_0x2cf1('0x77')],'raw':!![]})['then'](function(_0x458cd6){var _0x55aeea=_[_0x2cf1('0x30')](_0x458cd6,function(_0x31e29a){return db[_0x2cf1('0x78')][_0x2cf1('0x79')]({'membername':_0x31e29a[_0x2cf1('0x44')],'UserId':_0x31e29a['id'],'queue_name':_0x2f80d9[_0x2cf1('0x44')],'VoiceQueueId':_0x2f80d9['id'],'interface':_['isNil'](_0x31e29a[_0x2cf1('0x77')])?util[_0x2cf1('0x7a')](_0x2cf1('0x7b'),_0x31e29a[_0x2cf1('0x44')]):_0x31e29a[_0x2cf1('0x77')],'paused':_0x31e29a['voicePause']||![],'penalty':_0x2f80d9[_0x2cf1('0x70')][_0x2cf1('0x71')]},{'transaction':_0x1c9135});});return Promise[_0x2cf1('0x7c')](_0x55aeea);});});});return Promise['all'](_0x20beb0);});return Promise[_0x2cf1('0x7c')](_0x417b44);});});return Promise[_0x2cf1('0x7c')](_0x5f3194)[_0x2cf1('0x28')](function(){return _0x264868['addAgents'](_0xec8683[_0x2cf1('0x4f')]['ids'],{'transaction':_0x1c9135})['spread'](function(_0x3ca4c6){return _0x3ca4c6;});});});}})[_0x2cf1('0x28')](respondWithResult(_0x48a712,null))[_0x2cf1('0x4a')](handleError(_0x48a712,null));};exports[_0x2cf1('0x7d')]=function(_0x257673,_0x3c3151){return db[_0x2cf1('0x46')][_0x2cf1('0x58')]({'where':{'id':_0x257673[_0x2cf1('0x4b')]['id']}})[_0x2cf1('0x28')](handleEntityNotFound(_0x3c3151,null))[_0x2cf1('0x28')](function(_0x558a55){if(_0x558a55){var _0x419d5d=[_0x2cf1('0x6e'),_0x2cf1('0x7e'),_0x2cf1('0x68'),_0x2cf1('0x69'),_0x2cf1('0x6a'),_0x2cf1('0x6b'),_0x2cf1('0x7f')];return db[_0x2cf1('0x6c')][_0x2cf1('0x6d')](function(_0x28f0e5){var _0x787952=_[_0x2cf1('0x30')](_0x419d5d,function(_0x33a343){var _0x16aa8c={'attributes':['id','name']};return _0x558a55[_0x2cf1('0x2a')+_0x33a343+_0x2cf1('0x62')](_0x16aa8c)['then'](function(_0x2bf5cd){var _0x3f74cf=_[_0x2cf1('0x30')](_0x2bf5cd,function(_0x2f9d8f){return _0x2f9d8f[_0x2cf1('0x7d')](_0x257673[_0x2cf1('0x35')]['ids'],{'transaction':_0x28f0e5})[_0x2cf1('0x28')](function(){var _0x87c522=JSON[_0x2cf1('0x80')]('['+_0x257673[_0x2cf1('0x35')][_0x2cf1('0x63')]+']');var _0x565cd4=_[_0x2cf1('0x30')](_0x87c522,function(_0xfec251){socket[_0x2cf1('0x74')]('user'+_0x33a343+_0x2cf1('0x81'),{'UserId':Number(_0xfec251),[_0x33a343+'QueueId']:_0x2f9d8f['id']});if(_0x33a343!=='Voice')return;return db[_0x2cf1('0x78')][_0x2cf1('0x29')]({'where':{'VoiceQueueId':_0x2f9d8f['id'],'UserId':_0xfec251},'transaction':_0x28f0e5});});return Promise['all'](_0x565cd4);});});return Promise['all'](_0x3f74cf);});});return Promise[_0x2cf1('0x7c')](_0x787952)[_0x2cf1('0x28')](function(){return _0x558a55[_0x2cf1('0x7d')](_0x257673[_0x2cf1('0x35')][_0x2cf1('0x63')],{'transaction':_0x28f0e5});});});}})[_0x2cf1('0x28')](respondWithStatusCode(_0x3c3151,null))['catch'](handleError(_0x3c3151,null));};exports[_0x2cf1('0x82')]=function(_0x322e75,_0x4b0b90,_0x5b42db){var _0x21732f={};var _0x33e2c8={};var _0x204f6e;var _0x2c77a8;return db[_0x2cf1('0x46')][_0x2cf1('0x60')]({'where':{'id':_0x322e75[_0x2cf1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4b0b90,null))['then'](function(_0x466b09){if(_0x466b09){_0x204f6e=_0x466b09;_0x33e2c8['model']=_[_0x2cf1('0x36')](db[_0x2cf1('0x72')][_0x2cf1('0x31')]);_0x33e2c8['query']=_[_0x2cf1('0x36')](_0x322e75[_0x2cf1('0x35')]);_0x33e2c8[_0x2cf1('0x37')]=_[_0x2cf1('0x38')](_0x33e2c8[_0x2cf1('0x34')],_0x33e2c8[_0x2cf1('0x35')]);_0x21732f[_0x2cf1('0x3a')]=_[_0x2cf1('0x38')](_0x33e2c8[_0x2cf1('0x34')],qs[_0x2cf1('0x39')](_0x322e75[_0x2cf1('0x35')][_0x2cf1('0x39')]));_0x21732f[_0x2cf1('0x3a')]=_0x21732f['attributes'][_0x2cf1('0x3b')]?_0x21732f[_0x2cf1('0x3a')]:_0x33e2c8[_0x2cf1('0x34')];_0x21732f['order']=qs['sort'](_0x322e75[_0x2cf1('0x35')][_0x2cf1('0x3f')]);_0x21732f[_0x2cf1('0x42')]=qs[_0x2cf1('0x37')](_[_0x2cf1('0x40')](_0x322e75['query'],_0x33e2c8[_0x2cf1('0x37')]));if(_0x322e75[_0x2cf1('0x35')][_0x2cf1('0x41')]){_0x21732f[_0x2cf1('0x42')]=_[_0x2cf1('0x45')](_0x21732f['where'],{'$or':_[_0x2cf1('0x30')](_0x21732f[_0x2cf1('0x3a')],function(_0xf9ed67){var _0x2e221c={};_0x2e221c[_0xf9ed67]={'$like':'%'+_0x322e75['query']['filter']+'%'};return _0x2e221c;})});}_0x21732f=_[_0x2cf1('0x45')]({},_0x21732f,_0x322e75[_0x2cf1('0x4d')]);return _0x204f6e['getAgents'](_0x21732f);}})[_0x2cf1('0x28')](function(_0x4ad831){if(_0x4ad831){_0x2c77a8=_0x4ad831[_0x2cf1('0x3b')];if(!_0x322e75[_0x2cf1('0x35')][_0x2cf1('0x3c')](_0x2cf1('0x3d'))){_0x21732f[_0x2cf1('0x22')]=qs[_0x2cf1('0x22')](_0x322e75[_0x2cf1('0x35')]['limit']);_0x21732f[_0x2cf1('0x21')]=qs[_0x2cf1('0x21')](_0x322e75['query'][_0x2cf1('0x21')]);}return _0x204f6e['getAgents'](_0x21732f);}})[_0x2cf1('0x28')](function(_0x3c8bc7){if(_0x3c8bc7){return _0x3c8bc7?{'count':_0x2c77a8,'rows':_0x3c8bc7}:null;}})[_0x2cf1('0x28')](respondWithResult(_0x4b0b90,null))['catch'](handleError(_0x4b0b90,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index a1b1584..31b9268 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 _0xad3f=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x1ff106,_0x58c90e){var _0x4274cd=function(_0x44d2f5){while(--_0x44d2f5){_0x1ff106['push'](_0x1ff106['shift']());}};_0x4274cd(++_0x58c90e);}(_0xad3f,0x133));var _0xfad3=function(_0x1eaf73,_0x75d844){_0x1eaf73=_0x1eaf73-0x0;var _0x26f9f9=_0xad3f[_0x1eaf73];return _0x26f9f9;};'use strict';var EventEmitter=require(_0xfad3('0x0'));var Team=require(_0xfad3('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xfad3('0x2')](0x0);var events={'afterCreate':_0xfad3('0x3'),'afterUpdate':'update','afterDestroy':_0xfad3('0x4')};function emitEvent(_0x40dc1d){return function(_0x574642,_0x4ee34f,_0x2663c2){TeamEvents['emit'](_0x40dc1d+':'+_0x574642['id'],_0x574642);TeamEvents[_0xfad3('0x5')](_0x40dc1d,_0x574642);_0x2663c2(null);};}for(var e in events){if(events[_0xfad3('0x6')](e)){var event=events[e];Team[_0xfad3('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xd383=['remove','emit','hasOwnProperty','hook','Team','setMaxListeners','save'];(function(_0x5c3b4c,_0x940d76){var _0xf4c09c=function(_0x23be05){while(--_0x23be05){_0x5c3b4c['push'](_0x5c3b4c['shift']());}};_0xf4c09c(++_0x940d76);}(_0xd383,0x66));var _0x3d38=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xd383[_0x36c5b0];return _0xf19333;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x3d38('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x3d38('0x1')](0x0);var events={'afterCreate':_0x3d38('0x2'),'afterUpdate':'update','afterDestroy':_0x3d38('0x3')};function emitEvent(_0x50a915){return function(_0x544773,_0x3d7d0d,_0x15f7d5){TeamEvents['emit'](_0x50a915+':'+_0x544773['id'],_0x544773);TeamEvents[_0x3d38('0x4')](_0x50a915,_0x544773);_0x15f7d5(null);};}for(var e in events){if(events[_0x3d38('0x5')](e)){var event=events[e];Team[_0x3d38('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index f672c94..85075af 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 _0x50c4=['moment','bluebird','request-promise','path','exports','define','Team','teams','lodash','util','api'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x50c4,0xce));var _0x450c=function(_0x41d2d4,_0x12bcf4){_0x41d2d4=_0x41d2d4-0x0;var _0x225e0f=_0x50c4[_0x41d2d4];return _0x225e0f;};'use strict';var _=require(_0x450c('0x0'));var util=require(_0x450c('0x1'));var logger=require('../../config/logger')(_0x450c('0x2'));var moment=require(_0x450c('0x3'));var BPromise=require(_0x450c('0x4'));var rp=require(_0x450c('0x5'));var fs=require('fs');var path=require(_0x450c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x450c('0x7')]=function(_0x791ee5,_0x540c14){return _0x791ee5[_0x450c('0x8')](_0x450c('0x9'),attributes,{'tableName':_0x450c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a9b=['bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','Team','teams','lodash','util','moment'];(function(_0xd6ba4a,_0x55f4ff){var _0x10eb3d=function(_0x5c62e4){while(--_0x5c62e4){_0xd6ba4a['push'](_0xd6ba4a['shift']());}};_0x10eb3d(++_0x55f4ff);}(_0x2a9b,0x17d));var _0xb2a9=function(_0x496d8f,_0x3d877d){_0x496d8f=_0x496d8f-0x0;var _0x1dd7a5=_0x2a9b[_0x496d8f];return _0x1dd7a5;};'use strict';var _=require(_0xb2a9('0x0'));var util=require(_0xb2a9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb2a9('0x2'));var BPromise=require(_0xb2a9('0x3'));var rp=require(_0xb2a9('0x4'));var fs=require('fs');var path=require(_0xb2a9('0x5'));var rimraf=require(_0xb2a9('0x6'));var config=require(_0xb2a9('0x7'));var attributes=require(_0xb2a9('0x8'));module[_0xb2a9('0x9')]=function(_0xe37ce1,_0x5b2a03){return _0xe37ce1['define'](_0xb2a9('0xa'),attributes,{'tableName':_0xb2a9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index d17aa1d..ae9a06d 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 _0x5409=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','code','error','Team,\x20%s,\x20%s','message'];(function(_0x132fb6,_0x7a257b){var _0x2ca9d5=function(_0x490d53){while(--_0x490d53){_0x132fb6['push'](_0x132fb6['shift']());}};_0x2ca9d5(++_0x7a257b);}(_0x5409,0x12e));var _0x9540=function(_0x98ba9e,_0x28de31){_0x98ba9e=_0x98ba9e-0x0;var _0x138bf3=_0x5409[_0x98ba9e];return _0x138bf3;};'use strict';var _=require(_0x9540('0x0'));var util=require(_0x9540('0x1'));var moment=require(_0x9540('0x2'));var BPromise=require(_0x9540('0x3'));var rs=require(_0x9540('0x4'));var fs=require('fs');var Redis=require(_0x9540('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9540('0x6'));var logger=require(_0x9540('0x7'))(_0x9540('0x8'));var config=require(_0x9540('0x9'));var jayson=require(_0x9540('0xa'));var client=jayson[_0x9540('0xb')][_0x9540('0xc')]({'port':0x232a});config[_0x9540('0xd')]=_[_0x9540('0xe')](config[_0x9540('0xd')],{'host':_0x9540('0xf'),'port':0x18eb});var socket=require(_0x9540('0x10'))(new Redis(config[_0x9540('0xd')]));require(_0x9540('0x11'))['register'](socket);function respondWithRpcPromise(_0x5bb093,_0xd8f7de,_0x120fe3){return new BPromise(function(_0x53ea61,_0x5d6e7f){return client[_0x9540('0x12')](_0x5bb093,_0x120fe3)[_0x9540('0x13')](function(_0x8a2a80){logger[_0x9540('0x14')]('Team,\x20%s,\x20%s',_0xd8f7de,_0x9540('0x15'));logger[_0x9540('0x16')](_0x9540('0x17'),_0xd8f7de,_0x9540('0x15'),JSON['stringify'](_0x8a2a80));if(_0x8a2a80['error']){if(_0x8a2a80['error'][_0x9540('0x18')]===0x1f4){logger[_0x9540('0x19')](_0x9540('0x1a'),_0xd8f7de,_0x8a2a80[_0x9540('0x19')][_0x9540('0x1b')]);return _0x5d6e7f(_0x8a2a80[_0x9540('0x19')]['message']);}logger[_0x9540('0x19')](_0x9540('0x1a'),_0xd8f7de,_0x8a2a80[_0x9540('0x19')][_0x9540('0x1b')]);return _0x53ea61(_0x8a2a80[_0x9540('0x19')]['message']);}else{logger[_0x9540('0x14')]('Team,\x20%s,\x20%s',_0xd8f7de,'request\x20sent');_0x53ea61(_0x8a2a80[_0x9540('0x1c')][_0x9540('0x1b')]);}})[_0x9540('0x1d')](function(_0x483a07){logger[_0x9540('0x19')](_0x9540('0x1a'),_0xd8f7de,_0x483a07);_0x5d6e7f(_0x483a07);});});} \ No newline at end of file +var _0x1865=['../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x1865,0xed));var _0x5186=function(_0x47ea50,_0x4f713f){_0x47ea50=_0x47ea50-0x0;var _0x4986bb=_0x1865[_0x47ea50];return _0x4986bb;};'use strict';var _=require(_0x5186('0x0'));var util=require(_0x5186('0x1'));var moment=require(_0x5186('0x2'));var BPromise=require('bluebird');var rs=require(_0x5186('0x3'));var fs=require('fs');var Redis=require(_0x5186('0x4'));var db=require(_0x5186('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5186('0x6'))(_0x5186('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5186('0x8')][_0x5186('0x9')]({'port':0x232a});config[_0x5186('0xa')]=_[_0x5186('0xb')](config['redis'],{'host':_0x5186('0xc'),'port':0x18eb});var socket=require(_0x5186('0xd'))(new Redis(config[_0x5186('0xa')]));require(_0x5186('0xe'))[_0x5186('0xf')](socket);function respondWithRpcPromise(_0x147996,_0x5cf413,_0x560a0b){return new BPromise(function(_0x22b826,_0x1f0b2b){return client[_0x5186('0x10')](_0x147996,_0x560a0b)[_0x5186('0x11')](function(_0xaec5cf){logger[_0x5186('0x12')](_0x5186('0x13'),_0x5cf413,'request\x20sent');logger[_0x5186('0x14')](_0x5186('0x15'),_0x5cf413,_0x5186('0x16'),JSON['stringify'](_0xaec5cf));if(_0xaec5cf[_0x5186('0x17')]){if(_0xaec5cf[_0x5186('0x17')]['code']===0x1f4){logger[_0x5186('0x17')]('Team,\x20%s,\x20%s',_0x5cf413,_0xaec5cf['error'][_0x5186('0x18')]);return _0x1f0b2b(_0xaec5cf[_0x5186('0x17')][_0x5186('0x18')]);}logger[_0x5186('0x17')](_0x5186('0x13'),_0x5cf413,_0xaec5cf['error'][_0x5186('0x18')]);return _0x22b826(_0xaec5cf[_0x5186('0x17')][_0x5186('0x18')]);}else{logger[_0x5186('0x12')](_0x5186('0x13'),_0x5cf413,'request\x20sent');_0x22b826(_0xaec5cf[_0x5186('0x19')][_0x5186('0x18')]);}})[_0x5186('0x1a')](function(_0x351d78){logger[_0x5186('0x17')](_0x5186('0x13'),_0x5cf413,_0x351d78);_0x1f0b2b(_0x351d78);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 5983de0..f42aa0b 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 _0x7c71=['update','emit','removeListener','register','length','team:','./team.events','save','remove'];(function(_0x56a3dd,_0x2b1843){var _0x11edca=function(_0xd8b617){while(--_0xd8b617){_0x56a3dd['push'](_0x56a3dd['shift']());}};_0x11edca(++_0x2b1843);}(_0x7c71,0x177));var _0x17c7=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x7c71[_0x3207aa];return _0x51758f;};'use strict';var TeamEvents=require(_0x17c7('0x0'));var events=[_0x17c7('0x1'),_0x17c7('0x2'),_0x17c7('0x3')];function createListener(_0x5f1e52,_0x323ba0){return function(_0x449af7){_0x323ba0[_0x17c7('0x4')](_0x5f1e52,_0x449af7);};}function removeListener(_0x5a4923,_0x4fed29){return function(){TeamEvents[_0x17c7('0x5')](_0x5a4923,_0x4fed29);};}exports[_0x17c7('0x6')]=function(_0x26b276){for(var _0x3e98d9=0x0,_0x3c061b=events[_0x17c7('0x7')];_0x3e98d9<_0x3c061b;_0x3e98d9++){var _0x1ff4ec=events[_0x3e98d9];var _0x50feb0=createListener(_0x17c7('0x8')+_0x1ff4ec,_0x26b276);TeamEvents['on'](_0x1ff4ec,_0x50feb0);}}; \ No newline at end of file +var _0x8f6b=['removeListener','./team.events','save','remove','emit'];(function(_0x33532f,_0x22f546){var _0x263e7f=function(_0x4b82b2){while(--_0x4b82b2){_0x33532f['push'](_0x33532f['shift']());}};_0x263e7f(++_0x22f546);}(_0x8f6b,0x146));var _0xb8f6=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x8f6b[_0x1c546c];return _0x2cc384;};'use strict';var TeamEvents=require(_0xb8f6('0x0'));var events=[_0xb8f6('0x1'),_0xb8f6('0x2'),'update'];function createListener(_0x2b45ba,_0x170b3e){return function(_0x5e99f1){_0x170b3e[_0xb8f6('0x3')](_0x2b45ba,_0x5e99f1);};}function removeListener(_0x456df3,_0x49693f){return function(){TeamEvents[_0xb8f6('0x4')](_0x456df3,_0x49693f);};}exports['register']=function(_0x332ce0){for(var _0x4c73ad=0x0,_0x207add=events['length'];_0x4c73ad<_0x207add;_0x4c73ad++){var _0x1426d1=events[_0x4c73ad];var _0x11b65b=createListener('team:'+_0x1426d1,_0x332ce0);TeamEvents['on'](_0x1426d1,_0x11b65b);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 54b0db7..779426c 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 _0xf7b4=['../../config/environment','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x43a8b0,_0x2b5908){var _0x3aaf7b=function(_0x486421){while(--_0x486421){_0x43a8b0['push'](_0x43a8b0['shift']());}};_0x3aaf7b(++_0x2b5908);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4f0c68,_0x153910){_0x4f0c68=_0x4f0c68-0x0;var _0x5ad1f7=_0xf7b4[_0x4f0c68];return _0x5ad1f7;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));module[_0x4f7b('0x6')]=router; \ No newline at end of file +var _0xf69c=['Router','fs-extra','../../components/auth/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x4bd4c1,_0x3f4c7b){var _0x4a2968=function(_0x1d3488){while(--_0x1d3488){_0x4bd4c1['push'](_0x4bd4c1['shift']());}};_0x4a2968(++_0x3f4c7b);}(_0xf69c,0x1e2));var _0xcf69=function(_0x5e4ffa,_0x56154d){_0x5e4ffa=_0x5e4ffa-0x0;var _0x43a656=_0xf69c[_0x5e4ffa];return _0x43a656;};'use strict';var multer=require(_0xcf69('0x0'));var util=require(_0xcf69('0x1'));var path=require(_0xcf69('0x2'));var timeout=require(_0xcf69('0x3'));var express=require('express');var router=express[_0xcf69('0x4')]();var fs_extra=require(_0xcf69('0x5'));var auth=require(_0xcf69('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcf69('0x7'));module[_0xcf69('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index f353f2e..dac0d5c 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 _0xd8b0=['exports','sequelize'];(function(_0x197115,_0x14d69a){var _0x19d830=function(_0x1f59c5){while(--_0x1f59c5){_0x197115['push'](_0x197115['shift']());}};_0x19d830(++_0x14d69a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 370031a..bfee867 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 _0xdd29=['define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x2858b1,_0x296858){var _0x1cf8b9=function(_0x5e3cec){while(--_0x5e3cec){_0x2858b1['push'](_0x2858b1['shift']());}};_0x1cf8b9(++_0x296858);}(_0xdd29,0x16b));var _0x9dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd29[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9dd2('0x0'));var util=require(_0x9dd2('0x1'));var logger=require(_0x9dd2('0x2'))('api');var moment=require(_0x9dd2('0x3'));var BPromise=require(_0x9dd2('0x4'));var rp=require(_0x9dd2('0x5'));var fs=require('fs');var path=require(_0x9dd2('0x6'));var rimraf=require('rimraf');var config=require(_0x9dd2('0x7'));var attributes=require(_0x9dd2('0x8'));module['exports']=function(_0x3bf819,_0x20579e){return _0x3bf819[_0x9dd2('0x9')](_0x9dd2('0xa'),attributes,{'tableName':_0x9dd2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5d5=['define','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x463934,_0x1e38ec){var _0x44c1a2=function(_0x2116d7){while(--_0x2116d7){_0x463934['push'](_0x463934['shift']());}};_0x44c1a2(++_0x1e38ec);}(_0xf5d5,0x14e));var _0x5f5d=function(_0x1d2394,_0x1d5c4b){_0x1d2394=_0x1d2394-0x0;var _0x45cce5=_0xf5d5[_0x1d2394];return _0x45cce5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5f5d('0x0'))(_0x5f5d('0x1'));var moment=require('moment');var BPromise=require(_0x5f5d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f5d('0x3'));var rimraf=require(_0x5f5d('0x4'));var config=require(_0x5f5d('0x5'));var attributes=require(_0x5f5d('0x6'));module[_0x5f5d('0x7')]=function(_0x134a6c,_0x60c157){return _0x134a6c[_0x5f5d('0x8')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','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 47381e6..cbf10dc 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 _0x7bc8=['message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x10fe43,_0x584402){var _0xd4ff1a=function(_0x7d7771){while(--_0x7d7771){_0x10fe43['push'](_0x10fe43['shift']());}};_0xd4ff1a(++_0x584402);}(_0x7bc8,0x10b));var _0x87bc=function(_0x3a7691,_0xd5769d){_0x3a7691=_0x3a7691-0x0;var _0x5f2d74=_0x7bc8[_0x3a7691];return _0x5f2d74;};'use strict';var _=require(_0x87bc('0x0'));var util=require(_0x87bc('0x1'));var moment=require(_0x87bc('0x2'));var BPromise=require(_0x87bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87bc('0x4'));var db=require(_0x87bc('0x5'))['db'];var utils=require(_0x87bc('0x6'));var logger=require(_0x87bc('0x7'))(_0x87bc('0x8'));var config=require(_0x87bc('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x87bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bf192,_0x2e2e8c,_0x5d6b9a){return new BPromise(function(_0x52b6f7,_0x5acfda){return client[_0x87bc('0xb')](_0x2bf192,_0x5d6b9a)['then'](function(_0x3819c9){logger['info'](_0x87bc('0xc'),_0x2e2e8c,_0x87bc('0xd'));logger[_0x87bc('0xe')](_0x87bc('0xf'),_0x2e2e8c,_0x87bc('0xd'),JSON[_0x87bc('0x10')](_0x3819c9));if(_0x3819c9[_0x87bc('0x11')]){if(_0x3819c9[_0x87bc('0x11')][_0x87bc('0x12')]===0x1f4){logger[_0x87bc('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2e2e8c,_0x3819c9[_0x87bc('0x11')][_0x87bc('0x13')]);return _0x5acfda(_0x3819c9['error'][_0x87bc('0x13')]);}logger['error'](_0x87bc('0xc'),_0x2e2e8c,_0x3819c9[_0x87bc('0x11')]['message']);return _0x52b6f7(_0x3819c9[_0x87bc('0x11')][_0x87bc('0x13')]);}else{logger[_0x87bc('0x14')](_0x87bc('0xc'),_0x2e2e8c,_0x87bc('0xd'));_0x52b6f7(_0x3819c9[_0x87bc('0x15')][_0x87bc('0x13')]);}})['catch'](function(_0x3b09fa){logger[_0x87bc('0x11')](_0x87bc('0xc'),_0x2e2e8c,_0x3b09fa);_0x5acfda(_0x3b09fa);});});} \ No newline at end of file +var _0x05e0=['moment','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x39871f,_0x42cbeb){var _0x1c1fd0=function(_0x36ae54){while(--_0x36ae54){_0x39871f['push'](_0x39871f['shift']());}};_0x1c1fd0(++_0x42cbeb);}(_0x05e0,0xee));var _0x005e=function(_0x514816,_0x57c091){_0x514816=_0x514816-0x0;var _0x5c3a43=_0x05e0[_0x514816];return _0x5c3a43;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x005e('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x005e('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x005e('0x2'));var logger=require('../../config/logger')(_0x005e('0x3'));var config=require(_0x005e('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x005e('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x97cc29,_0x38eb96,_0x24644b){return new BPromise(function(_0x4265c9,_0x3cb036){return client[_0x005e('0x6')](_0x97cc29,_0x24644b)[_0x005e('0x7')](function(_0x9da15b){logger[_0x005e('0x8')]('TeamVoiceQueue,\x20%s,\x20%s',_0x38eb96,_0x005e('0x9'));logger[_0x005e('0xa')](_0x005e('0xb'),_0x38eb96,'request\x20sent',JSON[_0x005e('0xc')](_0x9da15b));if(_0x9da15b[_0x005e('0xd')]){if(_0x9da15b['error'][_0x005e('0xe')]===0x1f4){logger[_0x005e('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x38eb96,_0x9da15b[_0x005e('0xd')][_0x005e('0xf')]);return _0x3cb036(_0x9da15b[_0x005e('0xd')]['message']);}logger[_0x005e('0xd')](_0x005e('0x10'),_0x38eb96,_0x9da15b[_0x005e('0xd')][_0x005e('0xf')]);return _0x4265c9(_0x9da15b[_0x005e('0xd')][_0x005e('0xf')]);}else{logger[_0x005e('0x8')]('TeamVoiceQueue,\x20%s,\x20%s',_0x38eb96,_0x005e('0x9'));_0x4265c9(_0x9da15b['result'][_0x005e('0xf')]);}})['catch'](function(_0x476cca){logger[_0x005e('0xd')](_0x005e('0x10'),_0x38eb96,_0x476cca);_0x3cb036(_0x476cca);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index a71db40..4ed931f 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','create'];(function(_0x39be0e,_0x448f15){var _0x1fa5eb=function(_0x10ceb0){while(--_0x10ceb0){_0x39be0e['push'](_0x39be0e['shift']());}};_0x1fa5eb(++_0x448f15);}(_0x55ca,0x126));var _0xa55c=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0x55ca[_0x4fc421];return _0x8c6d63;};'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['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0x98a8=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x98a8,0x12c));var _0x898a=function(_0x3f1e60,_0x2bf241){_0x3f1e60=_0x3f1e60-0x0;var _0x5ece46=_0x98a8[_0x3f1e60];return _0x5ece46;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var fs_extra=require(_0x898a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var controller=require(_0x898a('0x9'));router[_0x898a('0xa')]('/',auth[_0x898a('0xb')](),controller['index']);router[_0x898a('0xa')]('/:id',auth[_0x898a('0xb')](),controller['show']);router[_0x898a('0xc')]('/',auth[_0x898a('0xb')](),controller[_0x898a('0xd')]);router[_0x898a('0xe')](_0x898a('0xf'),auth[_0x898a('0xb')](),controller[_0x898a('0x10')]);router[_0x898a('0x11')](_0x898a('0xf'),auth['isAuthenticated'](),controller[_0x898a('0x12')]);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 b43872b..ef7964f 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 _0xf45a=['STRING','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf45a,0xcf));var _0xaf45=function(_0x4aac12,_0x3097e5){_0x4aac12=_0x4aac12-0x0;var _0xb7aa3a=_0xf45a[_0x4aac12];return _0xb7aa3a;};'use strict';var Sequelize=require(_0xaf45('0x0'));module['exports']={'name':{'type':Sequelize[_0xaf45('0x1')]},'description':{'type':Sequelize[_0xaf45('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x58a6=['STRING','exports'];(function(_0x22808b,_0x329b6a){var _0x42cbd2=function(_0x256a8d){while(--_0x256a8d){_0x22808b['push'](_0x22808b['shift']());}};_0x42cbd2(++_0x329b6a);}(_0x58a6,0x109));var _0x658a=function(_0x45dca0,_0x2789a2){_0x45dca0=_0x45dca0-0x0;var _0x52704a=_0x58a6[_0x45dca0];return _0x52704a;};'use strict';var Sequelize=require('sequelize');module[_0x658a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x658a('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5458b46..1626ed2 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 _0x34b7=['where','pick','merge','VIRTUAL','options','rows','catch','params','includeAll','find','create','body','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','map','Template','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort'];(function(_0x217077,_0x535e80){var _0x289538=function(_0x15f864){while(--_0x15f864){_0x217077['push'](_0x217077['shift']());}};_0x289538(++_0x535e80);}(_0x34b7,0x196));var _0x734b=function(_0x37b546,_0x8c85de){_0x37b546=_0x37b546-0x0;var _0x24a3b5=_0x34b7[_0x37b546];return _0x24a3b5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x734b('0x0'));var zipdir=require(_0x734b('0x1'));var jsonpatch=require(_0x734b('0x2'));var rp=require(_0x734b('0x3'));var moment=require(_0x734b('0x4'));var BPromise=require(_0x734b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x734b('0x6'));var sox=require(_0x734b('0x7'));var csv=require(_0x734b('0x8'));var ejs=require(_0x734b('0x9'));var fs=require('fs');var fs_extra=require(_0x734b('0xa'));var _=require(_0x734b('0xb'));var squel=require('squel');var crypto=require(_0x734b('0xc'));var jsforce=require(_0x734b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x734b('0xe'));var Redis=require('ioredis');var authService=require(_0x734b('0xf'));var qs=require(_0x734b('0x10'));var as=require(_0x734b('0x11'));var hardwareService=require(_0x734b('0x12'));var logger=require(_0x734b('0x13'))(_0x734b('0x14'));var utils=require(_0x734b('0x15'));var config=require(_0x734b('0x16'));var licenseUtil=require(_0x734b('0x17'));var db=require(_0x734b('0x18'))['db'];function respondWithStatusCode(_0x189a82,_0xff9ddf){_0xff9ddf=_0xff9ddf||0xcc;return function(_0x145ec3){if(_0x145ec3){return _0x189a82[_0x734b('0x19')](_0xff9ddf);}return _0x189a82['status'](_0xff9ddf)[_0x734b('0x1a')]();};}function respondWithResult(_0x252510,_0x47791c){_0x47791c=_0x47791c||0xc8;return function(_0xd1ab2a){if(_0xd1ab2a){return _0x252510[_0x734b('0x1b')](_0x47791c)[_0x734b('0x1c')](_0xd1ab2a);}};}function respondWithFilteredResult(_0x2372bd,_0x2c03bd){return function(_0xa6d111){if(_0xa6d111){var _0x4b8c63=_0xa6d111[_0x734b('0x1d')],_0x42407a=_0x2c03bd[_0x734b('0x1e')],_0x4d2d23=_0x2c03bd[_0x734b('0x1e')]+_0x2c03bd['limit'],_0x461df5;if(_0x4d2d23>=_0x4b8c63){_0x4d2d23=_0x4b8c63;_0x461df5=0xc8;}else{_0x461df5=0xce;}_0x2372bd['status'](_0x461df5);return _0x2372bd[_0x734b('0x1f')](_0x734b('0x20'),_0x42407a+'-'+_0x4d2d23+'/'+_0x4b8c63)[_0x734b('0x1c')](_0xa6d111);}return null;};}function patchUpdates(_0x41ba87){return function(_0x1c605c){try{jsonpatch[_0x734b('0x21')](_0x1c605c,_0x41ba87,!![]);}catch(_0x1c68c4){return BPromise[_0x734b('0x22')](_0x1c68c4);}return _0x1c605c[_0x734b('0x23')]();};}function saveUpdates(_0x1d2b27,_0x7060f8){return function(_0x3d0ffd){if(_0x3d0ffd){return _0x3d0ffd[_0x734b('0x24')](_0x1d2b27)[_0x734b('0x25')](function(_0x56f807){return _0x56f807;});}return null;};}function removeEntity(_0x1e4dcc,_0x7856d7){return function(_0x4f98a7){if(_0x4f98a7){return _0x4f98a7[_0x734b('0x26')]()[_0x734b('0x25')](function(){var _0x1a7908=_0x4f98a7[_0x734b('0x27')]({'plain':!![]});var _0x46d432=_0x734b('0x28');return db[_0x734b('0x29')][_0x734b('0x26')]({'where':{'type':_0x46d432,'resourceId':_0x1a7908['id']}})[_0x734b('0x25')](function(){return _0x4f98a7;});})[_0x734b('0x25')](function(){_0x1e4dcc[_0x734b('0x1b')](0xcc)[_0x734b('0x1a')]();});}};}function handleEntityNotFound(_0x3bb651,_0x566d55){return function(_0x49732b){if(!_0x49732b){_0x3bb651[_0x734b('0x19')](0x194);}return _0x49732b;};}function handleError(_0x3680a0,_0x47a0a9){_0x47a0a9=_0x47a0a9||0x1f4;return function(_0x32ea00){logger[_0x734b('0x2a')](_0x32ea00[_0x734b('0x2b')]);if(_0x32ea00[_0x734b('0x2c')]){delete _0x32ea00[_0x734b('0x2c')];}_0x3680a0[_0x734b('0x1b')](_0x47a0a9)[_0x734b('0x2d')](_0x32ea00);};}exports['index']=function(_0x1f3652,_0x436efe){var _0x42e9ae={},_0x241c89={},_0x729431={'count':0x0,'rows':[]};var _0x427c36=_[_0x734b('0x2e')](db[_0x734b('0x2f')][_0x734b('0x30')],function(_0x3065b0){return{'name':_0x3065b0['fieldName'],'type':_0x3065b0[_0x734b('0x31')][_0x734b('0x32')]};});_0x241c89['model']=_[_0x734b('0x2e')](_0x427c36,_0x734b('0x2c'));_0x241c89[_0x734b('0x33')]=_[_0x734b('0x34')](_0x1f3652[_0x734b('0x33')]);_0x241c89[_0x734b('0x35')]=_[_0x734b('0x36')](_0x241c89[_0x734b('0x37')],_0x241c89[_0x734b('0x33')]);_0x42e9ae[_0x734b('0x38')]=_[_0x734b('0x36')](_0x241c89[_0x734b('0x37')],qs[_0x734b('0x39')](_0x1f3652[_0x734b('0x33')][_0x734b('0x39')]));_0x42e9ae['attributes']=_0x42e9ae[_0x734b('0x38')]['length']?_0x42e9ae[_0x734b('0x38')]:_0x241c89[_0x734b('0x37')];if(!_0x1f3652[_0x734b('0x33')][_0x734b('0x3a')](_0x734b('0x3b'))){_0x42e9ae[_0x734b('0x3c')]=qs['limit'](_0x1f3652['query'][_0x734b('0x3c')]);_0x42e9ae['offset']=qs[_0x734b('0x1e')](_0x1f3652['query'][_0x734b('0x1e')]);}_0x42e9ae['order']=qs[_0x734b('0x3d')](_0x1f3652['query'][_0x734b('0x3d')]);_0x42e9ae[_0x734b('0x3e')]=qs[_0x734b('0x35')](_[_0x734b('0x3f')](_0x1f3652[_0x734b('0x33')],_0x241c89[_0x734b('0x35')]),_0x427c36);if(_0x1f3652[_0x734b('0x33')]['filter']){_0x42e9ae[_0x734b('0x3e')]=_[_0x734b('0x40')](_0x42e9ae['where'],{'$or':_[_0x734b('0x2e')](_0x427c36,function(_0x309b31){if(_0x309b31[_0x734b('0x31')]!==_0x734b('0x41')){var _0x4feaa8={};_0x4feaa8[_0x309b31[_0x734b('0x2c')]]={'$like':'%'+_0x1f3652[_0x734b('0x33')]['filter']+'%'};return _0x4feaa8;}})});}_0x42e9ae=_[_0x734b('0x40')]({},_0x42e9ae,_0x1f3652[_0x734b('0x42')]);var _0x5dc018={'where':_0x42e9ae[_0x734b('0x3e')]};return db[_0x734b('0x2f')][_0x734b('0x1d')](_0x5dc018)[_0x734b('0x25')](function(_0x56eb35){_0x729431['count']=_0x56eb35;if(_0x1f3652[_0x734b('0x33')]['includeAll']){_0x42e9ae['include']=[{'all':!![]}];}return db[_0x734b('0x2f')]['findAll'](_0x42e9ae);})[_0x734b('0x25')](function(_0x4d77f0){_0x729431[_0x734b('0x43')]=_0x4d77f0;return _0x729431;})[_0x734b('0x25')](respondWithFilteredResult(_0x436efe,_0x42e9ae))[_0x734b('0x44')](handleError(_0x436efe,null));};exports['show']=function(_0x5cf3a0,_0x2e1aa8){var _0x553824={'raw':!![],'where':{'id':_0x5cf3a0[_0x734b('0x45')]['id']}},_0x5c5e09={};_0x5c5e09[_0x734b('0x37')]=_['keys'](db[_0x734b('0x2f')]['rawAttributes']);_0x5c5e09[_0x734b('0x33')]=_[_0x734b('0x34')](_0x5cf3a0[_0x734b('0x33')]);_0x5c5e09['filters']=_[_0x734b('0x36')](_0x5c5e09[_0x734b('0x37')],_0x5c5e09[_0x734b('0x33')]);_0x553824[_0x734b('0x38')]=_['intersection'](_0x5c5e09['model'],qs['fields'](_0x5cf3a0[_0x734b('0x33')]['fields']));_0x553824['attributes']=_0x553824[_0x734b('0x38')]['length']?_0x553824[_0x734b('0x38')]:_0x5c5e09[_0x734b('0x37')];if(_0x5cf3a0[_0x734b('0x33')][_0x734b('0x46')]){_0x553824['include']=[{'all':!![]}];}_0x553824=_[_0x734b('0x40')]({},_0x553824,_0x5cf3a0['options']);return db[_0x734b('0x2f')][_0x734b('0x47')](_0x553824)[_0x734b('0x25')](handleEntityNotFound(_0x2e1aa8,null))['then'](respondWithResult(_0x2e1aa8,null))[_0x734b('0x44')](handleError(_0x2e1aa8,null));};exports['create']=function(_0x357ae4,_0x331a87){return db['Template'][_0x734b('0x48')](_0x357ae4[_0x734b('0x49')],{})[_0x734b('0x25')](function(_0x38125a){var _0x21e127=_0x357ae4['user'][_0x734b('0x27')]({'plain':!![]});if(!_0x21e127)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21e127[_0x734b('0x4a')]==='user'){var _0xd3c688=_0x38125a[_0x734b('0x27')]({'plain':!![]});var _0x1a7e12=_0x734b('0x28');return db[_0x734b('0x4b')]['find']({'where':{'name':_0x1a7e12,'userProfileId':_0x21e127['userProfileId']},'raw':!![]})['then'](function(_0x284a4e){if(_0x284a4e&&_0x284a4e[_0x734b('0x4c')]===0x0){return db['UserProfileResource'][_0x734b('0x48')]({'name':_0xd3c688[_0x734b('0x2c')],'resourceId':_0xd3c688['id'],'type':_0x284a4e['name'],'sectionId':_0x284a4e['id']},{})[_0x734b('0x25')](function(){return _0x38125a;});}else{return _0x38125a;}})[_0x734b('0x44')](function(_0x44e6d2){logger['error'](_0x734b('0x4d'),_0x44e6d2);throw _0x44e6d2;});}return _0x38125a;})[_0x734b('0x25')](respondWithResult(_0x331a87,0xc9))[_0x734b('0x44')](handleError(_0x331a87,null));};exports[_0x734b('0x24')]=function(_0x5e2d7c,_0x44cc7d){if(_0x5e2d7c[_0x734b('0x49')]['id']){delete _0x5e2d7c[_0x734b('0x49')]['id'];}return db[_0x734b('0x2f')]['find']({'where':{'id':_0x5e2d7c[_0x734b('0x45')]['id']}})['then'](handleEntityNotFound(_0x44cc7d,null))[_0x734b('0x25')](saveUpdates(_0x5e2d7c[_0x734b('0x49')],null))[_0x734b('0x25')](respondWithResult(_0x44cc7d,null))[_0x734b('0x44')](handleError(_0x44cc7d,null));};exports['destroy']=function(_0x2b9da7,_0x1af382){return db['Template']['find']({'where':{'id':_0x2b9da7[_0x734b('0x45')]['id']}})['then'](handleEntityNotFound(_0x1af382,null))[_0x734b('0x25')](removeEntity(_0x1af382,null))[_0x734b('0x44')](handleError(_0x1af382,null));}; \ No newline at end of file +var _0xcf66=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','name','include','rows','catch','show','params','includeAll','options','find','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','end','error','stack','send','index','map','Template','rawAttributes','fieldName','key','model'];(function(_0x2377f5,_0x1034d1){var _0x3b6e4b=function(_0x2ea1c8){while(--_0x2ea1c8){_0x2377f5['push'](_0x2377f5['shift']());}};_0x3b6e4b(++_0x1034d1);}(_0xcf66,0x71));var _0x6cf6=function(_0x1980ca,_0x3287c8){_0x1980ca=_0x1980ca-0x0;var _0x5a2b4d=_0xcf66[_0x1980ca];return _0x5a2b4d;};'use strict';var pdf=require(_0x6cf6('0x0'));var emlformat=require(_0x6cf6('0x1'));var rimraf=require(_0x6cf6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6cf6('0x3'));var rp=require(_0x6cf6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6cf6('0x5'));var util=require(_0x6cf6('0x6'));var path=require('path');var sox=require(_0x6cf6('0x7'));var csv=require(_0x6cf6('0x8'));var ejs=require(_0x6cf6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6cf6('0xa'));var squel=require(_0x6cf6('0xb'));var crypto=require(_0x6cf6('0xc'));var jsforce=require(_0x6cf6('0xd'));var deskjs=require(_0x6cf6('0xe'));var toCsv=require(_0x6cf6('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6cf6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6cf6('0x10'));var hardwareService=require(_0x6cf6('0x11'));var logger=require(_0x6cf6('0x12'))(_0x6cf6('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6cf6('0x14'))['db'];function respondWithStatusCode(_0x13b1ad,_0x372d12){_0x372d12=_0x372d12||0xcc;return function(_0x39e8c3){if(_0x39e8c3){return _0x13b1ad[_0x6cf6('0x15')](_0x372d12);}return _0x13b1ad[_0x6cf6('0x16')](_0x372d12)['end']();};}function respondWithResult(_0x32fe64,_0x494ece){_0x494ece=_0x494ece||0xc8;return function(_0x4dbae8){if(_0x4dbae8){return _0x32fe64[_0x6cf6('0x16')](_0x494ece)['json'](_0x4dbae8);}};}function respondWithFilteredResult(_0x40e413,_0x1b40f8){return function(_0x2d23ab){if(_0x2d23ab){var _0x74486a=_0x2d23ab[_0x6cf6('0x17')],_0x2b6d7b=_0x1b40f8[_0x6cf6('0x18')],_0x2bdb12=_0x1b40f8[_0x6cf6('0x18')]+_0x1b40f8['limit'],_0x10b430;if(_0x2bdb12>=_0x74486a){_0x2bdb12=_0x74486a;_0x10b430=0xc8;}else{_0x10b430=0xce;}_0x40e413[_0x6cf6('0x16')](_0x10b430);return _0x40e413[_0x6cf6('0x19')](_0x6cf6('0x1a'),_0x2b6d7b+'-'+_0x2bdb12+'/'+_0x74486a)['json'](_0x2d23ab);}return null;};}function patchUpdates(_0x18abd9){return function(_0x39b4a2){try{jsonpatch[_0x6cf6('0x1b')](_0x39b4a2,_0x18abd9,!![]);}catch(_0x2995b3){return BPromise[_0x6cf6('0x1c')](_0x2995b3);}return _0x39b4a2[_0x6cf6('0x1d')]();};}function saveUpdates(_0x123993,_0x4eb6bd){return function(_0x19f2cd){if(_0x19f2cd){return _0x19f2cd[_0x6cf6('0x1e')](_0x123993)[_0x6cf6('0x1f')](function(_0x380a40){return _0x380a40;});}return null;};}function removeEntity(_0x5cba3a,_0x470ea4){return function(_0x41344f){if(_0x41344f){return _0x41344f[_0x6cf6('0x20')]()['then'](function(){var _0x5b30e0=_0x41344f[_0x6cf6('0x21')]({'plain':!![]});var _0x59f838=_0x6cf6('0x22');return db[_0x6cf6('0x23')][_0x6cf6('0x20')]({'where':{'type':_0x59f838,'resourceId':_0x5b30e0['id']}})[_0x6cf6('0x1f')](function(){return _0x41344f;});})[_0x6cf6('0x1f')](function(){_0x5cba3a[_0x6cf6('0x16')](0xcc)[_0x6cf6('0x24')]();});}};}function handleEntityNotFound(_0x4e0e85,_0x2779b7){return function(_0xc7b489){if(!_0xc7b489){_0x4e0e85[_0x6cf6('0x15')](0x194);}return _0xc7b489;};}function handleError(_0x558405,_0xf4eec5){_0xf4eec5=_0xf4eec5||0x1f4;return function(_0x2e56ca){logger[_0x6cf6('0x25')](_0x2e56ca[_0x6cf6('0x26')]);if(_0x2e56ca['name']){delete _0x2e56ca['name'];}_0x558405[_0x6cf6('0x16')](_0xf4eec5)[_0x6cf6('0x27')](_0x2e56ca);};}exports[_0x6cf6('0x28')]=function(_0x5869e9,_0x5ccc8f){var _0x2afc06={},_0x52717d={},_0x4ceeb9={'count':0x0,'rows':[]};var _0x519a70=_[_0x6cf6('0x29')](db[_0x6cf6('0x2a')][_0x6cf6('0x2b')],function(_0x42f488){return{'name':_0x42f488[_0x6cf6('0x2c')],'type':_0x42f488['type'][_0x6cf6('0x2d')]};});_0x52717d[_0x6cf6('0x2e')]=_[_0x6cf6('0x29')](_0x519a70,'name');_0x52717d[_0x6cf6('0x2f')]=_[_0x6cf6('0x30')](_0x5869e9[_0x6cf6('0x2f')]);_0x52717d[_0x6cf6('0x31')]=_[_0x6cf6('0x32')](_0x52717d[_0x6cf6('0x2e')],_0x52717d[_0x6cf6('0x2f')]);_0x2afc06[_0x6cf6('0x33')]=_[_0x6cf6('0x32')](_0x52717d[_0x6cf6('0x2e')],qs[_0x6cf6('0x34')](_0x5869e9[_0x6cf6('0x2f')][_0x6cf6('0x34')]));_0x2afc06[_0x6cf6('0x33')]=_0x2afc06[_0x6cf6('0x33')][_0x6cf6('0x35')]?_0x2afc06[_0x6cf6('0x33')]:_0x52717d[_0x6cf6('0x2e')];if(!_0x5869e9['query'][_0x6cf6('0x36')](_0x6cf6('0x37'))){_0x2afc06[_0x6cf6('0x38')]=qs[_0x6cf6('0x38')](_0x5869e9[_0x6cf6('0x2f')][_0x6cf6('0x38')]);_0x2afc06[_0x6cf6('0x18')]=qs[_0x6cf6('0x18')](_0x5869e9[_0x6cf6('0x2f')][_0x6cf6('0x18')]);}_0x2afc06[_0x6cf6('0x39')]=qs['sort'](_0x5869e9[_0x6cf6('0x2f')][_0x6cf6('0x3a')]);_0x2afc06[_0x6cf6('0x3b')]=qs[_0x6cf6('0x31')](_[_0x6cf6('0x3c')](_0x5869e9[_0x6cf6('0x2f')],_0x52717d[_0x6cf6('0x31')]),_0x519a70);if(_0x5869e9[_0x6cf6('0x2f')][_0x6cf6('0x3d')]){_0x2afc06['where']=_[_0x6cf6('0x3e')](_0x2afc06[_0x6cf6('0x3b')],{'$or':_[_0x6cf6('0x29')](_0x519a70,function(_0x3e906f){if(_0x3e906f[_0x6cf6('0x3f')]!==_0x6cf6('0x40')){var _0x369779={};_0x369779[_0x3e906f[_0x6cf6('0x41')]]={'$like':'%'+_0x5869e9[_0x6cf6('0x2f')]['filter']+'%'};return _0x369779;}})});}_0x2afc06=_[_0x6cf6('0x3e')]({},_0x2afc06,_0x5869e9['options']);var _0x2433fd={'where':_0x2afc06[_0x6cf6('0x3b')]};return db[_0x6cf6('0x2a')][_0x6cf6('0x17')](_0x2433fd)[_0x6cf6('0x1f')](function(_0x29541e){_0x4ceeb9[_0x6cf6('0x17')]=_0x29541e;if(_0x5869e9[_0x6cf6('0x2f')]['includeAll']){_0x2afc06[_0x6cf6('0x42')]=[{'all':!![]}];}return db[_0x6cf6('0x2a')]['findAll'](_0x2afc06);})[_0x6cf6('0x1f')](function(_0x41c16a){_0x4ceeb9[_0x6cf6('0x43')]=_0x41c16a;return _0x4ceeb9;})['then'](respondWithFilteredResult(_0x5ccc8f,_0x2afc06))[_0x6cf6('0x44')](handleError(_0x5ccc8f,null));};exports[_0x6cf6('0x45')]=function(_0x51d915,_0x3f1084){var _0x1d9aef={'raw':!![],'where':{'id':_0x51d915[_0x6cf6('0x46')]['id']}},_0x372d36={};_0x372d36[_0x6cf6('0x2e')]=_[_0x6cf6('0x30')](db[_0x6cf6('0x2a')]['rawAttributes']);_0x372d36[_0x6cf6('0x2f')]=_['keys'](_0x51d915[_0x6cf6('0x2f')]);_0x372d36[_0x6cf6('0x31')]=_['intersection'](_0x372d36[_0x6cf6('0x2e')],_0x372d36[_0x6cf6('0x2f')]);_0x1d9aef[_0x6cf6('0x33')]=_[_0x6cf6('0x32')](_0x372d36[_0x6cf6('0x2e')],qs['fields'](_0x51d915[_0x6cf6('0x2f')][_0x6cf6('0x34')]));_0x1d9aef[_0x6cf6('0x33')]=_0x1d9aef['attributes'][_0x6cf6('0x35')]?_0x1d9aef[_0x6cf6('0x33')]:_0x372d36[_0x6cf6('0x2e')];if(_0x51d915['query'][_0x6cf6('0x47')]){_0x1d9aef['include']=[{'all':!![]}];}_0x1d9aef=_['merge']({},_0x1d9aef,_0x51d915[_0x6cf6('0x48')]);return db[_0x6cf6('0x2a')][_0x6cf6('0x49')](_0x1d9aef)[_0x6cf6('0x1f')](handleEntityNotFound(_0x3f1084,null))[_0x6cf6('0x1f')](respondWithResult(_0x3f1084,null))[_0x6cf6('0x44')](handleError(_0x3f1084,null));};exports[_0x6cf6('0x4a')]=function(_0x1b58fd,_0x1a9610){return db[_0x6cf6('0x2a')][_0x6cf6('0x4a')](_0x1b58fd[_0x6cf6('0x4b')],{})[_0x6cf6('0x1f')](function(_0x4c8ada){var _0x26a6ff=_0x1b58fd[_0x6cf6('0x4c')]['get']({'plain':!![]});if(!_0x26a6ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26a6ff[_0x6cf6('0x4d')]===_0x6cf6('0x4c')){var _0x1db524=_0x4c8ada[_0x6cf6('0x21')]({'plain':!![]});var _0x459ca3=_0x6cf6('0x22');return db['UserProfileSection'][_0x6cf6('0x49')]({'where':{'name':_0x459ca3,'userProfileId':_0x26a6ff[_0x6cf6('0x4e')]},'raw':!![]})[_0x6cf6('0x1f')](function(_0x52122b){if(_0x52122b&&_0x52122b['autoAssociation']===0x0){return db[_0x6cf6('0x23')][_0x6cf6('0x4a')]({'name':_0x1db524[_0x6cf6('0x41')],'resourceId':_0x1db524['id'],'type':_0x52122b[_0x6cf6('0x41')],'sectionId':_0x52122b['id']},{})[_0x6cf6('0x1f')](function(){return _0x4c8ada;});}else{return _0x4c8ada;}})[_0x6cf6('0x44')](function(_0x2cb470){logger[_0x6cf6('0x25')](_0x6cf6('0x4f'),_0x2cb470);throw _0x2cb470;});}return _0x4c8ada;})[_0x6cf6('0x1f')](respondWithResult(_0x1a9610,0xc9))['catch'](handleError(_0x1a9610,null));};exports[_0x6cf6('0x1e')]=function(_0x2fc115,_0x34165c){if(_0x2fc115[_0x6cf6('0x4b')]['id']){delete _0x2fc115[_0x6cf6('0x4b')]['id'];}return db[_0x6cf6('0x2a')][_0x6cf6('0x49')]({'where':{'id':_0x2fc115[_0x6cf6('0x46')]['id']}})[_0x6cf6('0x1f')](handleEntityNotFound(_0x34165c,null))[_0x6cf6('0x1f')](saveUpdates(_0x2fc115[_0x6cf6('0x4b')],null))['then'](respondWithResult(_0x34165c,null))[_0x6cf6('0x44')](handleError(_0x34165c,null));};exports['destroy']=function(_0x5c33ed,_0xea457d){return db['Template'][_0x6cf6('0x49')]({'where':{'id':_0x5c33ed[_0x6cf6('0x46')]['id']}})[_0x6cf6('0x1f')](handleEntityNotFound(_0xea457d,null))[_0x6cf6('0x1f')](removeEntity(_0xea457d,null))[_0x6cf6('0x44')](handleError(_0xea457d,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 485e329..bf54258 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 _0xbdee=['moment','bluebird','path','rimraf','./template.attributes','exports','define','tools_templates','lodash','util','api'];(function(_0x321985,_0x15180c){var _0x1f09f5=function(_0x2d5b8d){while(--_0x2d5b8d){_0x321985['push'](_0x321985['shift']());}};_0x1f09f5(++_0x15180c);}(_0xbdee,0x126));var _0xebde=function(_0x12e673,_0x441304){_0x12e673=_0x12e673-0x0;var _0x28991c=_0xbdee[_0x12e673];return _0x28991c;};'use strict';var _=require(_0xebde('0x0'));var util=require(_0xebde('0x1'));var logger=require('../../config/logger')(_0xebde('0x2'));var moment=require(_0xebde('0x3'));var BPromise=require(_0xebde('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xebde('0x5'));var rimraf=require(_0xebde('0x6'));var config=require('../../config/environment');var attributes=require(_0xebde('0x7'));module[_0xebde('0x8')]=function(_0x5cab15,_0x4e2037){return _0x5cab15[_0xebde('0x9')]('Template',attributes,{'tableName':_0xebde('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff44=['util','api','moment','bluebird','request-promise','path','rimraf','./template.attributes','exports','define','Template'];(function(_0x35f521,_0x5c71dd){var _0x5b0ba=function(_0x44485c){while(--_0x44485c){_0x35f521['push'](_0x35f521['shift']());}};_0x5b0ba(++_0x5c71dd);}(_0xff44,0x11e));var _0x4ff4=function(_0x44ab9d,_0x3d060c){_0x44ab9d=_0x44ab9d-0x0;var _0x279648=_0xff44[_0x44ab9d];return _0x279648;};'use strict';var _=require('lodash');var util=require(_0x4ff4('0x0'));var logger=require('../../config/logger')(_0x4ff4('0x1'));var moment=require(_0x4ff4('0x2'));var BPromise=require(_0x4ff4('0x3'));var rp=require(_0x4ff4('0x4'));var fs=require('fs');var path=require(_0x4ff4('0x5'));var rimraf=require(_0x4ff4('0x6'));var config=require('../../config/environment');var attributes=require(_0x4ff4('0x7'));module[_0x4ff4('0x8')]=function(_0x2d29d0,_0x5b5596){return _0x2d29d0[_0x4ff4('0x9')](_0x4ff4('0xa'),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 2aec6e4..4705323 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 _0xba82=['request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','util','bluebird','ioredis','../../mysqldb','jayson/promise','request','then','info','Template,\x20%s,\x20%s'];(function(_0x56b928,_0x57ff0c){var _0x284b0a=function(_0x5ee18e){while(--_0x5ee18e){_0x56b928['push'](_0x56b928['shift']());}};_0x284b0a(++_0x57ff0c);}(_0xba82,0x17f));var _0x2ba8=function(_0x433c91,_0x53d791){_0x433c91=_0x433c91-0x0;var _0x117df6=_0xba82[_0x433c91];return _0x117df6;};'use strict';var _=require('lodash');var util=require(_0x2ba8('0x0'));var moment=require('moment');var BPromise=require(_0x2ba8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ba8('0x2'));var db=require(_0x2ba8('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2ba8('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13bf77,_0xf71b25,_0x1bc319){return new BPromise(function(_0x55b20d,_0x3a48fe){return client[_0x2ba8('0x5')](_0x13bf77,_0x1bc319)[_0x2ba8('0x6')](function(_0x1d772c){logger[_0x2ba8('0x7')](_0x2ba8('0x8'),_0xf71b25,_0x2ba8('0x9'));logger[_0x2ba8('0xa')](_0x2ba8('0xb'),_0xf71b25,'request\x20sent',JSON[_0x2ba8('0xc')](_0x1d772c));if(_0x1d772c[_0x2ba8('0xd')]){if(_0x1d772c['error'][_0x2ba8('0xe')]===0x1f4){logger[_0x2ba8('0xd')](_0x2ba8('0x8'),_0xf71b25,_0x1d772c[_0x2ba8('0xd')]['message']);return _0x3a48fe(_0x1d772c[_0x2ba8('0xd')][_0x2ba8('0xf')]);}logger[_0x2ba8('0xd')](_0x2ba8('0x8'),_0xf71b25,_0x1d772c[_0x2ba8('0xd')][_0x2ba8('0xf')]);return _0x55b20d(_0x1d772c[_0x2ba8('0xd')][_0x2ba8('0xf')]);}else{logger[_0x2ba8('0x7')](_0x2ba8('0x8'),_0xf71b25,_0x2ba8('0x9'));_0x55b20d(_0x1d772c['result']['message']);}})[_0x2ba8('0x10')](function(_0x2b0630){logger['error'](_0x2ba8('0x8'),_0xf71b25,_0x2b0630);_0x3a48fe(_0x2b0630);});});}exports[_0x2ba8('0x11')]=function(_0x550828){var _0x4060da=this;return new Promise(function(_0x2d6d43,_0x12abc6){return db[_0x2ba8('0x12')][_0x2ba8('0x13')]({'raw':_0x550828['options']?_0x550828[_0x2ba8('0x14')][_0x2ba8('0x15')]===undefined?!![]:![]:!![],'where':_0x550828[_0x2ba8('0x14')]?_0x550828[_0x2ba8('0x14')][_0x2ba8('0x16')]||null:null,'attributes':_0x550828[_0x2ba8('0x14')]?_0x550828[_0x2ba8('0x14')][_0x2ba8('0x17')]||null:null,'limit':_0x550828[_0x2ba8('0x14')]?_0x550828['options'][_0x2ba8('0x18')]||null:null,'include':_0x550828[_0x2ba8('0x14')]?_0x550828[_0x2ba8('0x14')][_0x2ba8('0x19')]?_[_0x2ba8('0x1a')](_0x550828[_0x2ba8('0x14')][_0x2ba8('0x19')],function(_0x361402){return{'model':db[_0x361402[_0x2ba8('0x1b')]],'as':_0x361402['as'],'attributes':_0x361402[_0x2ba8('0x17')],'include':_0x361402[_0x2ba8('0x19')]?_['map'](_0x361402['include'],function(_0x18a537){return{'model':db[_0x18a537['model']],'as':_0x18a537['as'],'attributes':_0x18a537[_0x2ba8('0x17')],'include':_0x18a537[_0x2ba8('0x19')]?_[_0x2ba8('0x1a')](_0x18a537['include'],function(_0x505ec5){return{'model':db[_0x505ec5[_0x2ba8('0x1b')]],'as':_0x505ec5['as'],'attributes':_0x505ec5[_0x2ba8('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2ba8('0x6')](function(_0x2890a1){logger[_0x2ba8('0x7')](_0x2ba8('0x11'),_0x550828);logger[_0x2ba8('0xa')](_0x2ba8('0x11'),_0x550828,JSON[_0x2ba8('0xc')](_0x2890a1));_0x2d6d43(_0x2890a1);})[_0x2ba8('0x10')](function(_0x287195){logger[_0x2ba8('0xd')](_0x2ba8('0x11'),_0x287195[_0x2ba8('0xf')],_0x550828);_0x12abc6(_0x4060da[_0x2ba8('0xd')](0x1f4,_0x287195[_0x2ba8('0xf')]));});});}; \ No newline at end of file +var _0x27d8=['then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Template','options','attributes','include','map','model','GetTemplate','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x531c0f,_0x48b950){var _0x227bad=function(_0x5608c8){while(--_0x5608c8){_0x531c0f['push'](_0x531c0f['shift']());}};_0x227bad(++_0x48b950);}(_0x27d8,0x13c));var _0x827d=function(_0x124f88,_0x3ad501){_0x124f88=_0x124f88-0x0;var _0xed0e3b=_0x27d8[_0x124f88];return _0xed0e3b;};'use strict';var _=require(_0x827d('0x0'));var util=require(_0x827d('0x1'));var moment=require(_0x827d('0x2'));var BPromise=require(_0x827d('0x3'));var rs=require(_0x827d('0x4'));var fs=require('fs');var Redis=require(_0x827d('0x5'));var db=require(_0x827d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x827d('0x7'))(_0x827d('0x8'));var config=require(_0x827d('0x9'));var jayson=require(_0x827d('0xa'));var client=jayson[_0x827d('0xb')][_0x827d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b87c5,_0xe1827c,_0x5cecd4){return new BPromise(function(_0xc50e18,_0x4273a6){return client[_0x827d('0xd')](_0x2b87c5,_0x5cecd4)[_0x827d('0xe')](function(_0x34bfd0){logger[_0x827d('0xf')](_0x827d('0x10'),_0xe1827c,_0x827d('0x11'));logger[_0x827d('0x12')](_0x827d('0x13'),_0xe1827c,'request\x20sent',JSON[_0x827d('0x14')](_0x34bfd0));if(_0x34bfd0[_0x827d('0x15')]){if(_0x34bfd0['error'][_0x827d('0x16')]===0x1f4){logger['error'](_0x827d('0x10'),_0xe1827c,_0x34bfd0['error'][_0x827d('0x17')]);return _0x4273a6(_0x34bfd0[_0x827d('0x15')]['message']);}logger[_0x827d('0x15')](_0x827d('0x10'),_0xe1827c,_0x34bfd0[_0x827d('0x15')][_0x827d('0x17')]);return _0xc50e18(_0x34bfd0['error'][_0x827d('0x17')]);}else{logger[_0x827d('0xf')]('Template,\x20%s,\x20%s',_0xe1827c,_0x827d('0x11'));_0xc50e18(_0x34bfd0[_0x827d('0x18')][_0x827d('0x17')]);}})[_0x827d('0x19')](function(_0x3d369e){logger[_0x827d('0x15')]('Template,\x20%s,\x20%s',_0xe1827c,_0x3d369e);_0x4273a6(_0x3d369e);});});}exports['GetTemplate']=function(_0x4d28d2){var _0x50b9a5=this;return new Promise(function(_0x24c910,_0x2d0bf1){return db[_0x827d('0x1a')]['findAll']({'raw':_0x4d28d2['options']?_0x4d28d2[_0x827d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4d28d2[_0x827d('0x1b')]?_0x4d28d2[_0x827d('0x1b')]['where']||null:null,'attributes':_0x4d28d2['options']?_0x4d28d2['options'][_0x827d('0x1c')]||null:null,'limit':_0x4d28d2[_0x827d('0x1b')]?_0x4d28d2[_0x827d('0x1b')]['limit']||null:null,'include':_0x4d28d2[_0x827d('0x1b')]?_0x4d28d2[_0x827d('0x1b')][_0x827d('0x1d')]?_[_0x827d('0x1e')](_0x4d28d2['options'][_0x827d('0x1d')],function(_0x508f0d){return{'model':db[_0x508f0d['model']],'as':_0x508f0d['as'],'attributes':_0x508f0d[_0x827d('0x1c')],'include':_0x508f0d[_0x827d('0x1d')]?_[_0x827d('0x1e')](_0x508f0d[_0x827d('0x1d')],function(_0x495000){return{'model':db[_0x495000[_0x827d('0x1f')]],'as':_0x495000['as'],'attributes':_0x495000[_0x827d('0x1c')],'include':_0x495000[_0x827d('0x1d')]?_[_0x827d('0x1e')](_0x495000[_0x827d('0x1d')],function(_0x22af39){return{'model':db[_0x22af39[_0x827d('0x1f')]],'as':_0x22af39['as'],'attributes':_0x22af39[_0x827d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x827d('0xe')](function(_0x5e00a6){logger[_0x827d('0xf')]('GetTemplate',_0x4d28d2);logger['debug'](_0x827d('0x20'),_0x4d28d2,JSON[_0x827d('0x14')](_0x5e00a6));_0x24c910(_0x5e00a6);})[_0x827d('0x19')](function(_0x3f04c2){logger['error']('GetTemplate',_0x3f04c2['message'],_0x4d28d2);_0x2d0bf1(_0x50b9a5[_0x827d('0x15')](0x1f4,_0x3f04c2[_0x827d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 10ebc9a..57c40cd 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 _0x7f7f=['create','addAction','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7f7f,0x6a));var _0xf7f7=function(_0x9fcd34,_0x48acf6){_0x9fcd34=_0x9fcd34-0x0;var _0x4ca147=_0x7f7f[_0x9fcd34];return _0x4ca147;};'use strict';var multer=require(_0xf7f7('0x0'));var util=require(_0xf7f7('0x1'));var path=require(_0xf7f7('0x2'));var timeout=require(_0xf7f7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf7f7('0x4'));var auth=require(_0xf7f7('0x5'));var interaction=require(_0xf7f7('0x6'));var config=require(_0xf7f7('0x7'));var controller=require(_0xf7f7('0x8'));router[_0xf7f7('0x9')]('/',auth[_0xf7f7('0xa')](),controller['index']);router[_0xf7f7('0x9')](_0xf7f7('0xb'),auth[_0xf7f7('0xa')](),controller[_0xf7f7('0xc')]);router[_0xf7f7('0x9')](_0xf7f7('0xd'),auth[_0xf7f7('0xa')](),controller[_0xf7f7('0xe')]);router[_0xf7f7('0x9')](_0xf7f7('0xf'),auth[_0xf7f7('0xa')](),controller['getAnyConditions']);router[_0xf7f7('0x9')](_0xf7f7('0x10'),auth['isAuthenticated'](),controller[_0xf7f7('0x11')]);router[_0xf7f7('0x12')]('/',auth[_0xf7f7('0xa')](),controller[_0xf7f7('0x13')]);router[_0xf7f7('0x12')](_0xf7f7('0xd'),auth[_0xf7f7('0xa')](),controller['addAllCondition']);router[_0xf7f7('0x12')](_0xf7f7('0xf'),auth[_0xf7f7('0xa')](),controller['addAnyCondition']);router[_0xf7f7('0x12')](_0xf7f7('0x10'),auth[_0xf7f7('0xa')](),controller[_0xf7f7('0x14')]);router[_0xf7f7('0x15')](_0xf7f7('0xb'),auth[_0xf7f7('0xa')](),controller[_0xf7f7('0x16')]);router[_0xf7f7('0x17')](_0xf7f7('0xb'),auth['isAuthenticated'](),controller[_0xf7f7('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd6ab=['update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','/:id'];(function(_0x141908,_0x4e61dc){var _0x37e9c9=function(_0x3a557e){while(--_0x3a557e){_0x141908['push'](_0x141908['shift']());}};_0x37e9c9(++_0x4e61dc);}(_0xd6ab,0x118));var _0xbd6a=function(_0x55cedb,_0x35b236){_0x55cedb=_0x55cedb-0x0;var _0x547b84=_0xd6ab[_0x55cedb];return _0x547b84;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbd6a('0x0'));var timeout=require(_0xbd6a('0x1'));var express=require('express');var router=express[_0xbd6a('0x2')]();var fs_extra=require(_0xbd6a('0x3'));var auth=require(_0xbd6a('0x4'));var interaction=require(_0xbd6a('0x5'));var config=require('../../config/environment');var controller=require(_0xbd6a('0x6'));router[_0xbd6a('0x7')]('/',auth[_0xbd6a('0x8')](),controller[_0xbd6a('0x9')]);router[_0xbd6a('0x7')]('/:id',auth[_0xbd6a('0x8')](),controller[_0xbd6a('0xa')]);router[_0xbd6a('0x7')](_0xbd6a('0xb'),auth[_0xbd6a('0x8')](),controller['getAllConditions']);router[_0xbd6a('0x7')]('/:id/any_conditions',auth[_0xbd6a('0x8')](),controller['getAnyConditions']);router[_0xbd6a('0x7')](_0xbd6a('0xc'),auth[_0xbd6a('0x8')](),controller[_0xbd6a('0xd')]);router[_0xbd6a('0xe')]('/',auth[_0xbd6a('0x8')](),controller['create']);router[_0xbd6a('0xe')](_0xbd6a('0xb'),auth[_0xbd6a('0x8')](),controller[_0xbd6a('0xf')]);router[_0xbd6a('0xe')]('/:id/any_conditions',auth[_0xbd6a('0x8')](),controller[_0xbd6a('0x10')]);router[_0xbd6a('0xe')](_0xbd6a('0xc'),auth[_0xbd6a('0x8')](),controller[_0xbd6a('0x11')]);router['put'](_0xbd6a('0x12'),auth[_0xbd6a('0x8')](),controller[_0xbd6a('0x13')]);router[_0xbd6a('0x14')](_0xbd6a('0x12'),auth[_0xbd6a('0x8')](),controller[_0xbd6a('0x15')]);module[_0xbd6a('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 28934bd..a41e6dc 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 _0x1c08=['exports','STRING','BOOLEAN','sequelize'];(function(_0xcb385f,_0x35c1b2){var _0x1768dd=function(_0x438c96){while(--_0x438c96){_0xcb385f['push'](_0xcb385f['shift']());}};_0x1768dd(++_0x35c1b2);}(_0x1c08,0x18b));var _0x81c0=function(_0x75ad68,_0xc75b2a){_0x75ad68=_0x75ad68-0x0;var _0x469c7d=_0x1c08[_0x75ad68];return _0x469c7d;};'use strict';var Sequelize=require(_0x81c0('0x0'));module[_0x81c0('0x1')]={'name':{'type':Sequelize[_0x81c0('0x2')]},'channel':{'type':Sequelize[_0x81c0('0x2')]},'description':{'type':Sequelize[_0x81c0('0x2')]},'status':{'type':Sequelize[_0x81c0('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe5ec=['BOOLEAN','sequelize','exports','STRING'];(function(_0x7a7f74,_0x461e76){var _0x58dc13=function(_0x2440b4){while(--_0x2440b4){_0x7a7f74['push'](_0x7a7f74['shift']());}};_0x58dc13(++_0x461e76);}(_0xe5ec,0x119));var _0xce5e=function(_0x22ea49,_0x4a785c){_0x22ea49=_0x22ea49-0x0;var _0x580ac8=_0xe5ec[_0x22ea49];return _0x580ac8;};'use strict';var Sequelize=require(_0xce5e('0x0'));module[_0xce5e('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xce5e('0x2')]},'description':{'type':Sequelize[_0xce5e('0x2')]},'status':{'type':Sequelize[_0xce5e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 9e1aa50..81af138 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 _0x2c3b=['role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','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','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','name','send','map','Trigger','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x28941b,_0x106034){var _0x59870e=function(_0x1b1c70){while(--_0x1b1c70){_0x28941b['push'](_0x28941b['shift']());}};_0x59870e(++_0x106034);}(_0x2c3b,0x18b));var _0xb2c3=function(_0x2ce5e3,_0x429426){_0x2ce5e3=_0x2ce5e3-0x0;var _0xe1e73c=_0x2c3b[_0x2ce5e3];return _0xe1e73c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb2c3('0x0'));var rimraf=require(_0xb2c3('0x1'));var zipdir=require(_0xb2c3('0x2'));var jsonpatch=require(_0xb2c3('0x3'));var rp=require(_0xb2c3('0x4'));var moment=require(_0xb2c3('0x5'));var BPromise=require(_0xb2c3('0x6'));var Mustache=require(_0xb2c3('0x7'));var util=require('util');var path=require(_0xb2c3('0x8'));var sox=require('sox');var csv=require(_0xb2c3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb2c3('0xa'));var _=require(_0xb2c3('0xb'));var squel=require(_0xb2c3('0xc'));var crypto=require(_0xb2c3('0xd'));var jsforce=require(_0xb2c3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb2c3('0x9'));var querystring=require(_0xb2c3('0xf'));var Papa=require(_0xb2c3('0x10'));var Redis=require(_0xb2c3('0x11'));var authService=require(_0xb2c3('0x12'));var qs=require(_0xb2c3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb2c3('0x14'));var logger=require(_0xb2c3('0x15'))(_0xb2c3('0x16'));var utils=require(_0xb2c3('0x17'));var config=require(_0xb2c3('0x18'));var licenseUtil=require(_0xb2c3('0x19'));var db=require(_0xb2c3('0x1a'))['db'];function respondWithStatusCode(_0x20fcfb,_0x1d94ad){_0x1d94ad=_0x1d94ad||0xcc;return function(_0x16af91){if(_0x16af91){return _0x20fcfb[_0xb2c3('0x1b')](_0x1d94ad);}return _0x20fcfb[_0xb2c3('0x1c')](_0x1d94ad)[_0xb2c3('0x1d')]();};}function respondWithResult(_0x55ba83,_0x5d1f08){_0x5d1f08=_0x5d1f08||0xc8;return function(_0x251b6a){if(_0x251b6a){return _0x55ba83[_0xb2c3('0x1c')](_0x5d1f08)[_0xb2c3('0x1e')](_0x251b6a);}};}function respondWithFilteredResult(_0x4856e6,_0x36fc3c){return function(_0x5bf16f){if(_0x5bf16f){var _0xfc3c27=_0x5bf16f[_0xb2c3('0x1f')],_0x3238d6=_0x36fc3c[_0xb2c3('0x20')],_0x44212e=_0x36fc3c[_0xb2c3('0x20')]+_0x36fc3c[_0xb2c3('0x21')],_0x4dfee8;if(_0x44212e>=_0xfc3c27){_0x44212e=_0xfc3c27;_0x4dfee8=0xc8;}else{_0x4dfee8=0xce;}_0x4856e6[_0xb2c3('0x1c')](_0x4dfee8);return _0x4856e6['set'](_0xb2c3('0x22'),_0x3238d6+'-'+_0x44212e+'/'+_0xfc3c27)[_0xb2c3('0x1e')](_0x5bf16f);}return null;};}function patchUpdates(_0x3af0ed){return function(_0x2ec834){try{jsonpatch[_0xb2c3('0x23')](_0x2ec834,_0x3af0ed,!![]);}catch(_0xe9a3fb){return BPromise[_0xb2c3('0x24')](_0xe9a3fb);}return _0x2ec834[_0xb2c3('0x25')]();};}function saveUpdates(_0x140a01,_0x4eba5f){return function(_0x3f1290){if(_0x3f1290){return _0x3f1290[_0xb2c3('0x26')](_0x140a01)[_0xb2c3('0x27')](function(_0x1baef3){return _0x1baef3;});}return null;};}function removeEntity(_0x349b69,_0x592470){return function(_0x2a5ce8){if(_0x2a5ce8){return _0x2a5ce8[_0xb2c3('0x28')]()[_0xb2c3('0x27')](function(){var _0x500251=_0x2a5ce8[_0xb2c3('0x29')]({'plain':!![]});var _0x20b65d=_0xb2c3('0x2a');return db[_0xb2c3('0x2b')][_0xb2c3('0x28')]({'where':{'type':_0x20b65d,'resourceId':_0x500251['id']}})[_0xb2c3('0x27')](function(){return _0x2a5ce8;});})[_0xb2c3('0x27')](function(){_0x349b69[_0xb2c3('0x1c')](0xcc)[_0xb2c3('0x1d')]();});}};}function handleEntityNotFound(_0x45c64c,_0x5d60b1){return function(_0x7833d9){if(!_0x7833d9){_0x45c64c['sendStatus'](0x194);}return _0x7833d9;};}function handleError(_0x21b80b,_0x287f75){_0x287f75=_0x287f75||0x1f4;return function(_0x403c6d){logger[_0xb2c3('0x2c')](_0x403c6d['stack']);if(_0x403c6d[_0xb2c3('0x2d')]){delete _0x403c6d[_0xb2c3('0x2d')];}_0x21b80b[_0xb2c3('0x1c')](_0x287f75)[_0xb2c3('0x2e')](_0x403c6d);};}exports['index']=function(_0x53a274,_0x2a653c){var _0x51dc6f={},_0x1db146={},_0x41255c={'count':0x0,'rows':[]};var _0x34b0d1=_[_0xb2c3('0x2f')](db[_0xb2c3('0x30')]['rawAttributes'],function(_0x4d2448){return{'name':_0x4d2448[_0xb2c3('0x31')],'type':_0x4d2448[_0xb2c3('0x32')]['key']};});_0x1db146['model']=_[_0xb2c3('0x2f')](_0x34b0d1,_0xb2c3('0x2d'));_0x1db146[_0xb2c3('0x33')]=_['keys'](_0x53a274[_0xb2c3('0x33')]);_0x1db146[_0xb2c3('0x34')]=_[_0xb2c3('0x35')](_0x1db146[_0xb2c3('0x36')],_0x1db146[_0xb2c3('0x33')]);_0x51dc6f['attributes']=_[_0xb2c3('0x35')](_0x1db146[_0xb2c3('0x36')],qs[_0xb2c3('0x37')](_0x53a274['query'][_0xb2c3('0x37')]));_0x51dc6f[_0xb2c3('0x38')]=_0x51dc6f[_0xb2c3('0x38')][_0xb2c3('0x39')]?_0x51dc6f[_0xb2c3('0x38')]:_0x1db146[_0xb2c3('0x36')];if(!_0x53a274['query'][_0xb2c3('0x3a')](_0xb2c3('0x3b'))){_0x51dc6f[_0xb2c3('0x21')]=qs['limit'](_0x53a274[_0xb2c3('0x33')][_0xb2c3('0x21')]);_0x51dc6f[_0xb2c3('0x20')]=qs[_0xb2c3('0x20')](_0x53a274[_0xb2c3('0x33')]['offset']);}_0x51dc6f[_0xb2c3('0x3c')]=qs[_0xb2c3('0x3d')](_0x53a274[_0xb2c3('0x33')][_0xb2c3('0x3d')]);_0x51dc6f['where']=qs['filters'](_[_0xb2c3('0x3e')](_0x53a274[_0xb2c3('0x33')],_0x1db146[_0xb2c3('0x34')]),_0x34b0d1);if(_0x53a274[_0xb2c3('0x33')][_0xb2c3('0x3f')]){_0x51dc6f[_0xb2c3('0x40')]=_[_0xb2c3('0x41')](_0x51dc6f[_0xb2c3('0x40')],{'$or':_[_0xb2c3('0x2f')](_0x34b0d1,function(_0x48f2b3){if(_0x48f2b3[_0xb2c3('0x32')]!==_0xb2c3('0x42')){var _0x283149={};_0x283149[_0x48f2b3['name']]={'$like':'%'+_0x53a274[_0xb2c3('0x33')][_0xb2c3('0x3f')]+'%'};return _0x283149;}})});}_0x51dc6f=_[_0xb2c3('0x41')]({},_0x51dc6f,_0x53a274[_0xb2c3('0x43')]);var _0x4c73a0={'where':_0x51dc6f[_0xb2c3('0x40')]};return db[_0xb2c3('0x30')][_0xb2c3('0x1f')](_0x4c73a0)[_0xb2c3('0x27')](function(_0x3b8494){_0x41255c[_0xb2c3('0x1f')]=_0x3b8494;if(_0x53a274[_0xb2c3('0x33')][_0xb2c3('0x44')]){_0x51dc6f['include']=[{'all':!![]}];}return db[_0xb2c3('0x30')][_0xb2c3('0x45')](_0x51dc6f);})[_0xb2c3('0x27')](function(_0x538235){_0x41255c[_0xb2c3('0x46')]=_0x538235;return _0x41255c;})['then'](respondWithFilteredResult(_0x2a653c,_0x51dc6f))[_0xb2c3('0x47')](handleError(_0x2a653c,null));};exports[_0xb2c3('0x48')]=function(_0x366f5e,_0x33db17){var _0x2542bb={'raw':![],'where':{'id':_0x366f5e[_0xb2c3('0x49')]['id']}},_0xe98c7={};_0xe98c7['model']=_[_0xb2c3('0x4a')](db[_0xb2c3('0x30')][_0xb2c3('0x4b')]);_0xe98c7[_0xb2c3('0x33')]=_['keys'](_0x366f5e[_0xb2c3('0x33')]);_0xe98c7[_0xb2c3('0x34')]=_['intersection'](_0xe98c7[_0xb2c3('0x36')],_0xe98c7['query']);_0x2542bb[_0xb2c3('0x38')]=_[_0xb2c3('0x35')](_0xe98c7[_0xb2c3('0x36')],qs[_0xb2c3('0x37')](_0x366f5e[_0xb2c3('0x33')][_0xb2c3('0x37')]));_0x2542bb[_0xb2c3('0x38')]=_0x2542bb[_0xb2c3('0x38')][_0xb2c3('0x39')]?_0x2542bb[_0xb2c3('0x38')]:_0xe98c7['model'];if(_0x366f5e[_0xb2c3('0x33')][_0xb2c3('0x44')]){_0x2542bb[_0xb2c3('0x4c')]=[{'all':!![]}];}_0x2542bb=_['merge']({},_0x2542bb,_0x366f5e[_0xb2c3('0x43')]);return db['Trigger']['find'](_0x2542bb)[_0xb2c3('0x27')](handleEntityNotFound(_0x33db17,null))[_0xb2c3('0x27')](respondWithResult(_0x33db17,null))[_0xb2c3('0x47')](handleError(_0x33db17,null));};exports[_0xb2c3('0x4d')]=function(_0x1a1df2,_0x1a7b15){return db[_0xb2c3('0x30')][_0xb2c3('0x4d')](_0x1a1df2[_0xb2c3('0x4e')],{})[_0xb2c3('0x27')](function(_0x3c1c2c){var _0x30f162=_0x1a1df2['user'][_0xb2c3('0x29')]({'plain':!![]});if(!_0x30f162)throw new Error(_0xb2c3('0x4f'));if(_0x30f162[_0xb2c3('0x50')]==='user'){var _0x3102a2=_0x3c1c2c[_0xb2c3('0x29')]({'plain':!![]});var _0x40c3f7=_0xb2c3('0x2a');return db['UserProfileSection'][_0xb2c3('0x51')]({'where':{'name':_0x40c3f7,'userProfileId':_0x30f162[_0xb2c3('0x52')]},'raw':!![]})[_0xb2c3('0x27')](function(_0x4fe406){if(_0x4fe406&&_0x4fe406['autoAssociation']===0x0){return db[_0xb2c3('0x2b')][_0xb2c3('0x4d')]({'name':_0x3102a2[_0xb2c3('0x2d')],'resourceId':_0x3102a2['id'],'type':_0x4fe406['name'],'sectionId':_0x4fe406['id']},{})['then'](function(){return _0x3c1c2c;});}else{return _0x3c1c2c;}})['catch'](function(_0x33cdbc){logger[_0xb2c3('0x2c')](_0xb2c3('0x53'),_0x33cdbc);throw _0x33cdbc;});}return _0x3c1c2c;})[_0xb2c3('0x27')](respondWithResult(_0x1a7b15,0xc9))[_0xb2c3('0x47')](handleError(_0x1a7b15,null));};exports[_0xb2c3('0x26')]=function(_0x3e8253,_0x4b9281){if(_0x3e8253[_0xb2c3('0x4e')]['id']){delete _0x3e8253[_0xb2c3('0x4e')]['id'];}return db[_0xb2c3('0x30')][_0xb2c3('0x51')]({'where':{'id':_0x3e8253[_0xb2c3('0x49')]['id']}})[_0xb2c3('0x27')](handleEntityNotFound(_0x4b9281,null))[_0xb2c3('0x27')](saveUpdates(_0x3e8253['body'],null))[_0xb2c3('0x27')](respondWithResult(_0x4b9281,null))['catch'](handleError(_0x4b9281,null));};exports[_0xb2c3('0x28')]=function(_0x45b8c2,_0x5e5e19){return db[_0xb2c3('0x30')]['find']({'where':{'id':_0x45b8c2[_0xb2c3('0x49')]['id']}})['then'](handleEntityNotFound(_0x5e5e19,null))['then'](removeEntity(_0x5e5e19,null))[_0xb2c3('0x47')](handleError(_0x5e5e19,null));};exports[_0xb2c3('0x54')]=function(_0x401ee4,_0x2aabbb,_0x318bd9){if(_0x401ee4[_0xb2c3('0x4e')]['id']){delete _0x401ee4['body']['id'];}return db[_0xb2c3('0x30')][_0xb2c3('0x51')]({'where':{'id':_0x401ee4[_0xb2c3('0x49')]['id']}})[_0xb2c3('0x27')](handleEntityNotFound(_0x2aabbb,null))['then'](function(_0x1eecff){if(_0x1eecff){_0x401ee4['body'][_0xb2c3('0x55')]=_0x1eecff['id'];return db[_0xb2c3('0x56')][_0xb2c3('0x4d')](_0x401ee4[_0xb2c3('0x4e')]);}})[_0xb2c3('0x27')](respondWithResult(_0x2aabbb,null))[_0xb2c3('0x47')](handleError(_0x2aabbb,null));};exports[_0xb2c3('0x57')]=function(_0x48e41c,_0x39439f,_0x546065){if(_0x48e41c[_0xb2c3('0x4e')]['id']){delete _0x48e41c[_0xb2c3('0x4e')]['id'];}return db['Trigger']['find']({'where':{'id':_0x48e41c['params']['id']}})['then'](handleEntityNotFound(_0x39439f,null))[_0xb2c3('0x27')](function(_0x237191){if(_0x237191){_0x48e41c['body']['TriggerAnyId']=_0x237191['id'];return db[_0xb2c3('0x56')]['create'](_0x48e41c[_0xb2c3('0x4e')]);}})[_0xb2c3('0x27')](respondWithResult(_0x39439f,null))[_0xb2c3('0x47')](handleError(_0x39439f,null));};exports[_0xb2c3('0x58')]=function(_0xbaf81a,_0xfe1ef4,_0x5bb69a){var _0xd25d5f={};var _0x177804={};var _0xa9eacc;var _0x333c40;return db['Trigger']['findOne']({'where':{'id':_0xbaf81a[_0xb2c3('0x49')]['id']}})[_0xb2c3('0x27')](handleEntityNotFound(_0xfe1ef4,null))[_0xb2c3('0x27')](function(_0x4ebc68){if(_0x4ebc68){_0xa9eacc=_0x4ebc68;_0x177804[_0xb2c3('0x36')]=_['keys'](db['Condition'][_0xb2c3('0x4b')]);_0x177804['query']=_['keys'](_0xbaf81a[_0xb2c3('0x33')]);_0x177804[_0xb2c3('0x34')]=_[_0xb2c3('0x35')](_0x177804['model'],_0x177804[_0xb2c3('0x33')]);_0xd25d5f['attributes']=_['intersection'](_0x177804[_0xb2c3('0x36')],qs[_0xb2c3('0x37')](_0xbaf81a[_0xb2c3('0x33')][_0xb2c3('0x37')]));_0xd25d5f[_0xb2c3('0x38')]=_0xd25d5f[_0xb2c3('0x38')]['length']?_0xd25d5f[_0xb2c3('0x38')]:_0x177804['model'];_0xd25d5f[_0xb2c3('0x3c')]=qs['sort'](_0xbaf81a[_0xb2c3('0x33')][_0xb2c3('0x3d')]);_0xd25d5f['where']=qs[_0xb2c3('0x34')](_[_0xb2c3('0x3e')](_0xbaf81a[_0xb2c3('0x33')],_0x177804['filters']));if(_0xbaf81a[_0xb2c3('0x33')]['filter']){_0xd25d5f[_0xb2c3('0x40')]=_[_0xb2c3('0x41')](_0xd25d5f['where'],{'$or':_[_0xb2c3('0x2f')](_0xd25d5f[_0xb2c3('0x38')],function(_0x113b48){var _0x5732cd={};_0x5732cd[_0x113b48]={'$like':'%'+_0xbaf81a[_0xb2c3('0x33')][_0xb2c3('0x3f')]+'%'};return _0x5732cd;})});}_0xd25d5f=_['merge']({},_0xd25d5f,_0xbaf81a['options']);return _0xa9eacc[_0xb2c3('0x58')](_0xd25d5f);}})[_0xb2c3('0x27')](function(_0x3a0fc0){if(_0x3a0fc0){_0x333c40=_0x3a0fc0['length'];if(!_0xbaf81a[_0xb2c3('0x33')]['hasOwnProperty'](_0xb2c3('0x3b'))){_0xd25d5f['limit']=qs[_0xb2c3('0x21')](_0xbaf81a[_0xb2c3('0x33')][_0xb2c3('0x21')]);_0xd25d5f[_0xb2c3('0x20')]=qs['offset'](_0xbaf81a['query']['offset']);}return _0xa9eacc[_0xb2c3('0x58')](_0xd25d5f);}})[_0xb2c3('0x27')](function(_0x1f9f9d){if(_0x1f9f9d){return _0x1f9f9d?{'count':_0x333c40,'rows':_0x1f9f9d}:null;}})['then'](respondWithResult(_0xfe1ef4,null))['catch'](handleError(_0xfe1ef4,null));};exports[_0xb2c3('0x59')]=function(_0x2ccbbc,_0x46df91,_0x3cbea8){var _0x521a92={};var _0x1465dc={};var _0x1d6be8;var _0x55b8e9;return db['Trigger'][_0xb2c3('0x5a')]({'where':{'id':_0x2ccbbc[_0xb2c3('0x49')]['id']}})['then'](handleEntityNotFound(_0x46df91,null))[_0xb2c3('0x27')](function(_0x4fdf1b){if(_0x4fdf1b){_0x1d6be8=_0x4fdf1b;_0x1465dc[_0xb2c3('0x36')]=_[_0xb2c3('0x4a')](db[_0xb2c3('0x56')]['rawAttributes']);_0x1465dc[_0xb2c3('0x33')]=_[_0xb2c3('0x4a')](_0x2ccbbc[_0xb2c3('0x33')]);_0x1465dc[_0xb2c3('0x34')]=_[_0xb2c3('0x35')](_0x1465dc[_0xb2c3('0x36')],_0x1465dc[_0xb2c3('0x33')]);_0x521a92[_0xb2c3('0x38')]=_[_0xb2c3('0x35')](_0x1465dc[_0xb2c3('0x36')],qs['fields'](_0x2ccbbc['query'][_0xb2c3('0x37')]));_0x521a92[_0xb2c3('0x38')]=_0x521a92[_0xb2c3('0x38')]['length']?_0x521a92[_0xb2c3('0x38')]:_0x1465dc[_0xb2c3('0x36')];_0x521a92['order']=qs['sort'](_0x2ccbbc['query'][_0xb2c3('0x3d')]);_0x521a92['where']=qs['filters'](_[_0xb2c3('0x3e')](_0x2ccbbc['query'],_0x1465dc['filters']));if(_0x2ccbbc['query'][_0xb2c3('0x3f')]){_0x521a92[_0xb2c3('0x40')]=_['merge'](_0x521a92[_0xb2c3('0x40')],{'$or':_['map'](_0x521a92[_0xb2c3('0x38')],function(_0x297719){var _0x2429ec={};_0x2429ec[_0x297719]={'$like':'%'+_0x2ccbbc[_0xb2c3('0x33')]['filter']+'%'};return _0x2429ec;})});}_0x521a92=_['merge']({},_0x521a92,_0x2ccbbc[_0xb2c3('0x43')]);return _0x1d6be8[_0xb2c3('0x59')](_0x521a92);}})[_0xb2c3('0x27')](function(_0x1f58af){if(_0x1f58af){_0x55b8e9=_0x1f58af[_0xb2c3('0x39')];if(!_0x2ccbbc['query']['hasOwnProperty']('nolimit')){_0x521a92[_0xb2c3('0x21')]=qs[_0xb2c3('0x21')](_0x2ccbbc[_0xb2c3('0x33')]['limit']);_0x521a92[_0xb2c3('0x20')]=qs[_0xb2c3('0x20')](_0x2ccbbc[_0xb2c3('0x33')][_0xb2c3('0x20')]);}return _0x1d6be8[_0xb2c3('0x59')](_0x521a92);}})['then'](function(_0xc2024d){if(_0xc2024d){return _0xc2024d?{'count':_0x55b8e9,'rows':_0xc2024d}:null;}})['then'](respondWithResult(_0x46df91,null))[_0xb2c3('0x47')](handleError(_0x46df91,null));};exports[_0xb2c3('0x5b')]=function(_0x2be3c2,_0xea2809,_0x1cb718){if(_0x2be3c2[_0xb2c3('0x4e')]['id']){delete _0x2be3c2[_0xb2c3('0x4e')]['id'];}return db[_0xb2c3('0x30')]['find']({'where':{'id':_0x2be3c2[_0xb2c3('0x49')]['id']}})[_0xb2c3('0x27')](handleEntityNotFound(_0xea2809,null))['then'](function(_0x54d7e4){if(_0x54d7e4){_0x2be3c2['body'][_0xb2c3('0x5c')]=_0x54d7e4['id'];return db['Action'][_0xb2c3('0x4d')](_0x2be3c2[_0xb2c3('0x4e')]);}})[_0xb2c3('0x27')](respondWithResult(_0xea2809,null))[_0xb2c3('0x47')](handleError(_0xea2809,null));};exports[_0xb2c3('0x5d')]=function(_0x24796e,_0x32d7be,_0x1da9a7){var _0x4b0255={};var _0x511b13={};var _0x494865;var _0x5d135c;return db[_0xb2c3('0x30')][_0xb2c3('0x5a')]({'where':{'id':_0x24796e[_0xb2c3('0x49')]['id']}})['then'](handleEntityNotFound(_0x32d7be,null))[_0xb2c3('0x27')](function(_0xde8671){if(_0xde8671){_0x494865=_0xde8671;_0x511b13[_0xb2c3('0x36')]=_['keys'](db[_0xb2c3('0x5e')][_0xb2c3('0x4b')]);_0x511b13[_0xb2c3('0x33')]=_[_0xb2c3('0x4a')](_0x24796e['query']);_0x511b13[_0xb2c3('0x34')]=_['intersection'](_0x511b13[_0xb2c3('0x36')],_0x511b13[_0xb2c3('0x33')]);_0x4b0255[_0xb2c3('0x38')]=_[_0xb2c3('0x35')](_0x511b13[_0xb2c3('0x36')],qs[_0xb2c3('0x37')](_0x24796e[_0xb2c3('0x33')][_0xb2c3('0x37')]));_0x4b0255[_0xb2c3('0x38')]=_0x4b0255[_0xb2c3('0x38')]['length']?_0x4b0255[_0xb2c3('0x38')]:_0x511b13['model'];_0x4b0255[_0xb2c3('0x3c')]=qs[_0xb2c3('0x3d')](_0x24796e[_0xb2c3('0x33')][_0xb2c3('0x3d')]);_0x4b0255[_0xb2c3('0x40')]=qs['filters'](_[_0xb2c3('0x3e')](_0x24796e['query'],_0x511b13[_0xb2c3('0x34')]));if(_0x24796e[_0xb2c3('0x33')]['filter']){_0x4b0255[_0xb2c3('0x40')]=_[_0xb2c3('0x41')](_0x4b0255['where'],{'$or':_[_0xb2c3('0x2f')](_0x4b0255['attributes'],function(_0x492096){var _0x42328c={};_0x42328c[_0x492096]={'$like':'%'+_0x24796e['query']['filter']+'%'};return _0x42328c;})});}_0x4b0255=_['merge']({},_0x4b0255,_0x24796e[_0xb2c3('0x43')]);return _0x494865['getActions'](_0x4b0255);}})['then'](function(_0x4018f9){if(_0x4018f9){_0x5d135c=_0x4018f9[_0xb2c3('0x39')];if(!_0x24796e[_0xb2c3('0x33')]['hasOwnProperty'](_0xb2c3('0x3b'))){_0x4b0255[_0xb2c3('0x21')]=qs[_0xb2c3('0x21')](_0x24796e[_0xb2c3('0x33')]['limit']);_0x4b0255[_0xb2c3('0x20')]=qs['offset'](_0x24796e[_0xb2c3('0x33')][_0xb2c3('0x20')]);}return _0x494865['getActions'](_0x4b0255);}})[_0xb2c3('0x27')](function(_0x5517ab){if(_0x5517ab){return _0x5517ab?{'count':_0x5d135c,'rows':_0x5517ab}:null;}})[_0xb2c3('0x27')](respondWithResult(_0x32d7be,null))[_0xb2c3('0x47')](handleError(_0x32d7be,null));}; \ No newline at end of file +var _0x97e1=['apply','reject','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','Trigger','includeAll','include','rows','catch','show','params','keys','find','create','body','user','Triggers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','nolimit','getAnyConditions','pick','TriggerId','Action','getActions','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x150de5,_0x392c60){var _0x4c8102=function(_0x392910){while(--_0x392910){_0x150de5['push'](_0x150de5['shift']());}};_0x4c8102(++_0x392c60);}(_0x97e1,0x1bc));var _0x197e=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x97e1[_0x1e172a];return _0x96338b;};'use strict';var pdf=require(_0x197e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x197e('0x1'));var zipdir=require(_0x197e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x197e('0x3'));var moment=require(_0x197e('0x4'));var BPromise=require(_0x197e('0x5'));var Mustache=require('mustache');var util=require(_0x197e('0x6'));var path=require(_0x197e('0x7'));var sox=require(_0x197e('0x8'));var csv=require(_0x197e('0x9'));var ejs=require(_0x197e('0xa'));var fs=require('fs');var fs_extra=require(_0x197e('0xb'));var _=require(_0x197e('0xc'));var squel=require(_0x197e('0xd'));var crypto=require(_0x197e('0xe'));var jsforce=require(_0x197e('0xf'));var deskjs=require(_0x197e('0x10'));var toCsv=require(_0x197e('0x9'));var querystring=require('querystring');var Papa=require(_0x197e('0x11'));var Redis=require('ioredis');var authService=require(_0x197e('0x12'));var qs=require(_0x197e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197e('0x14'));var logger=require(_0x197e('0x15'))(_0x197e('0x16'));var utils=require(_0x197e('0x17'));var config=require(_0x197e('0x18'));var licenseUtil=require(_0x197e('0x19'));var db=require(_0x197e('0x1a'))['db'];function respondWithStatusCode(_0x34ca46,_0x2096c3){_0x2096c3=_0x2096c3||0xcc;return function(_0x3e1d88){if(_0x3e1d88){return _0x34ca46[_0x197e('0x1b')](_0x2096c3);}return _0x34ca46[_0x197e('0x1c')](_0x2096c3)[_0x197e('0x1d')]();};}function respondWithResult(_0x25bdff,_0x462575){_0x462575=_0x462575||0xc8;return function(_0x3ab6bc){if(_0x3ab6bc){return _0x25bdff[_0x197e('0x1c')](_0x462575)[_0x197e('0x1e')](_0x3ab6bc);}};}function respondWithFilteredResult(_0x44031a,_0xdd8f37){return function(_0x320918){if(_0x320918){var _0x16fd4a=_0x320918[_0x197e('0x1f')],_0x27dfb5=_0xdd8f37[_0x197e('0x20')],_0x652c59=_0xdd8f37[_0x197e('0x20')]+_0xdd8f37[_0x197e('0x21')],_0xe17df8;if(_0x652c59>=_0x16fd4a){_0x652c59=_0x16fd4a;_0xe17df8=0xc8;}else{_0xe17df8=0xce;}_0x44031a['status'](_0xe17df8);return _0x44031a[_0x197e('0x22')](_0x197e('0x23'),_0x27dfb5+'-'+_0x652c59+'/'+_0x16fd4a)['json'](_0x320918);}return null;};}function patchUpdates(_0x85722f){return function(_0x3db7b5){try{jsonpatch[_0x197e('0x24')](_0x3db7b5,_0x85722f,!![]);}catch(_0x513904){return BPromise[_0x197e('0x25')](_0x513904);}return _0x3db7b5['save']();};}function saveUpdates(_0x127cd0,_0x2288ef){return function(_0x15682e){if(_0x15682e){return _0x15682e['update'](_0x127cd0)[_0x197e('0x26')](function(_0x21835a){return _0x21835a;});}return null;};}function removeEntity(_0xd04851,_0x173f22){return function(_0x41759a){if(_0x41759a){return _0x41759a['destroy']()[_0x197e('0x26')](function(){var _0x494c07=_0x41759a[_0x197e('0x27')]({'plain':!![]});var _0x6cb179='Triggers';return db[_0x197e('0x28')][_0x197e('0x29')]({'where':{'type':_0x6cb179,'resourceId':_0x494c07['id']}})['then'](function(){return _0x41759a;});})[_0x197e('0x26')](function(){_0xd04851[_0x197e('0x1c')](0xcc)[_0x197e('0x1d')]();});}};}function handleEntityNotFound(_0x45d885,_0x2733a9){return function(_0x4f9b1b){if(!_0x4f9b1b){_0x45d885['sendStatus'](0x194);}return _0x4f9b1b;};}function handleError(_0x5b655b,_0xe43373){_0xe43373=_0xe43373||0x1f4;return function(_0x510ddf){logger[_0x197e('0x2a')](_0x510ddf[_0x197e('0x2b')]);if(_0x510ddf['name']){delete _0x510ddf[_0x197e('0x2c')];}_0x5b655b[_0x197e('0x1c')](_0xe43373)[_0x197e('0x2d')](_0x510ddf);};}exports[_0x197e('0x2e')]=function(_0xe0a20e,_0x5502e9){var _0xda0a7={},_0x434e3c={},_0x23dacd={'count':0x0,'rows':[]};var _0x876883=_[_0x197e('0x2f')](db['Trigger'][_0x197e('0x30')],function(_0x1c6ec9){return{'name':_0x1c6ec9[_0x197e('0x31')],'type':_0x1c6ec9[_0x197e('0x32')][_0x197e('0x33')]};});_0x434e3c[_0x197e('0x34')]=_[_0x197e('0x2f')](_0x876883,_0x197e('0x2c'));_0x434e3c[_0x197e('0x35')]=_['keys'](_0xe0a20e['query']);_0x434e3c[_0x197e('0x36')]=_[_0x197e('0x37')](_0x434e3c[_0x197e('0x34')],_0x434e3c['query']);_0xda0a7[_0x197e('0x38')]=_[_0x197e('0x37')](_0x434e3c[_0x197e('0x34')],qs[_0x197e('0x39')](_0xe0a20e[_0x197e('0x35')][_0x197e('0x39')]));_0xda0a7[_0x197e('0x38')]=_0xda0a7[_0x197e('0x38')][_0x197e('0x3a')]?_0xda0a7[_0x197e('0x38')]:_0x434e3c[_0x197e('0x34')];if(!_0xe0a20e['query'][_0x197e('0x3b')]('nolimit')){_0xda0a7[_0x197e('0x21')]=qs['limit'](_0xe0a20e[_0x197e('0x35')][_0x197e('0x21')]);_0xda0a7[_0x197e('0x20')]=qs[_0x197e('0x20')](_0xe0a20e[_0x197e('0x35')][_0x197e('0x20')]);}_0xda0a7[_0x197e('0x3c')]=qs[_0x197e('0x3d')](_0xe0a20e[_0x197e('0x35')]['sort']);_0xda0a7[_0x197e('0x3e')]=qs[_0x197e('0x36')](_['pick'](_0xe0a20e[_0x197e('0x35')],_0x434e3c[_0x197e('0x36')]),_0x876883);if(_0xe0a20e[_0x197e('0x35')][_0x197e('0x3f')]){_0xda0a7[_0x197e('0x3e')]=_[_0x197e('0x40')](_0xda0a7[_0x197e('0x3e')],{'$or':_['map'](_0x876883,function(_0x4201c5){if(_0x4201c5[_0x197e('0x32')]!==_0x197e('0x41')){var _0x13b677={};_0x13b677[_0x4201c5[_0x197e('0x2c')]]={'$like':'%'+_0xe0a20e[_0x197e('0x35')]['filter']+'%'};return _0x13b677;}})});}_0xda0a7=_['merge']({},_0xda0a7,_0xe0a20e[_0x197e('0x42')]);var _0x354c6={'where':_0xda0a7['where']};return db[_0x197e('0x43')][_0x197e('0x1f')](_0x354c6)['then'](function(_0x4b52cd){_0x23dacd[_0x197e('0x1f')]=_0x4b52cd;if(_0xe0a20e[_0x197e('0x35')][_0x197e('0x44')]){_0xda0a7[_0x197e('0x45')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0xda0a7);})[_0x197e('0x26')](function(_0x4e794a){_0x23dacd[_0x197e('0x46')]=_0x4e794a;return _0x23dacd;})[_0x197e('0x26')](respondWithFilteredResult(_0x5502e9,_0xda0a7))[_0x197e('0x47')](handleError(_0x5502e9,null));};exports[_0x197e('0x48')]=function(_0x25350c,_0x1ec68b){var _0x5dc0a2={'raw':![],'where':{'id':_0x25350c[_0x197e('0x49')]['id']}},_0x2d20af={};_0x2d20af[_0x197e('0x34')]=_[_0x197e('0x4a')](db[_0x197e('0x43')][_0x197e('0x30')]);_0x2d20af[_0x197e('0x35')]=_[_0x197e('0x4a')](_0x25350c[_0x197e('0x35')]);_0x2d20af[_0x197e('0x36')]=_[_0x197e('0x37')](_0x2d20af[_0x197e('0x34')],_0x2d20af[_0x197e('0x35')]);_0x5dc0a2[_0x197e('0x38')]=_[_0x197e('0x37')](_0x2d20af[_0x197e('0x34')],qs[_0x197e('0x39')](_0x25350c[_0x197e('0x35')]['fields']));_0x5dc0a2[_0x197e('0x38')]=_0x5dc0a2['attributes']['length']?_0x5dc0a2[_0x197e('0x38')]:_0x2d20af[_0x197e('0x34')];if(_0x25350c['query']['includeAll']){_0x5dc0a2['include']=[{'all':!![]}];}_0x5dc0a2=_[_0x197e('0x40')]({},_0x5dc0a2,_0x25350c[_0x197e('0x42')]);return db['Trigger'][_0x197e('0x4b')](_0x5dc0a2)[_0x197e('0x26')](handleEntityNotFound(_0x1ec68b,null))[_0x197e('0x26')](respondWithResult(_0x1ec68b,null))[_0x197e('0x47')](handleError(_0x1ec68b,null));};exports['create']=function(_0x23df5c,_0x359a8d){return db['Trigger'][_0x197e('0x4c')](_0x23df5c[_0x197e('0x4d')],{})['then'](function(_0x5a6081){var _0x20e731=_0x23df5c[_0x197e('0x4e')][_0x197e('0x27')]({'plain':!![]});if(!_0x20e731)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20e731['role']===_0x197e('0x4e')){var _0x1eab0f=_0x5a6081[_0x197e('0x27')]({'plain':!![]});var _0x1a38e2=_0x197e('0x4f');return db['UserProfileSection'][_0x197e('0x4b')]({'where':{'name':_0x1a38e2,'userProfileId':_0x20e731[_0x197e('0x50')]},'raw':!![]})[_0x197e('0x26')](function(_0x2ef9c2){if(_0x2ef9c2&&_0x2ef9c2[_0x197e('0x51')]===0x0){return db[_0x197e('0x28')][_0x197e('0x4c')]({'name':_0x1eab0f[_0x197e('0x2c')],'resourceId':_0x1eab0f['id'],'type':_0x2ef9c2['name'],'sectionId':_0x2ef9c2['id']},{})[_0x197e('0x26')](function(){return _0x5a6081;});}else{return _0x5a6081;}})[_0x197e('0x47')](function(_0x49ec8a){logger['error'](_0x197e('0x52'),_0x49ec8a);throw _0x49ec8a;});}return _0x5a6081;})[_0x197e('0x26')](respondWithResult(_0x359a8d,0xc9))[_0x197e('0x47')](handleError(_0x359a8d,null));};exports[_0x197e('0x53')]=function(_0x5a8c96,_0x5b1f83){if(_0x5a8c96[_0x197e('0x4d')]['id']){delete _0x5a8c96['body']['id'];}return db[_0x197e('0x43')][_0x197e('0x4b')]({'where':{'id':_0x5a8c96['params']['id']}})['then'](handleEntityNotFound(_0x5b1f83,null))[_0x197e('0x26')](saveUpdates(_0x5a8c96['body'],null))['then'](respondWithResult(_0x5b1f83,null))[_0x197e('0x47')](handleError(_0x5b1f83,null));};exports['destroy']=function(_0x1970a9,_0x1673b0){return db[_0x197e('0x43')][_0x197e('0x4b')]({'where':{'id':_0x1970a9['params']['id']}})[_0x197e('0x26')](handleEntityNotFound(_0x1673b0,null))[_0x197e('0x26')](removeEntity(_0x1673b0,null))[_0x197e('0x47')](handleError(_0x1673b0,null));};exports['addAllCondition']=function(_0x1cf038,_0x284427,_0x45372e){if(_0x1cf038['body']['id']){delete _0x1cf038[_0x197e('0x4d')]['id'];}return db['Trigger'][_0x197e('0x4b')]({'where':{'id':_0x1cf038[_0x197e('0x49')]['id']}})['then'](handleEntityNotFound(_0x284427,null))[_0x197e('0x26')](function(_0x46d343){if(_0x46d343){_0x1cf038[_0x197e('0x4d')][_0x197e('0x54')]=_0x46d343['id'];return db[_0x197e('0x55')]['create'](_0x1cf038[_0x197e('0x4d')]);}})[_0x197e('0x26')](respondWithResult(_0x284427,null))[_0x197e('0x47')](handleError(_0x284427,null));};exports[_0x197e('0x56')]=function(_0x10c082,_0x4e72e7,_0x3b3958){if(_0x10c082[_0x197e('0x4d')]['id']){delete _0x10c082[_0x197e('0x4d')]['id'];}return db[_0x197e('0x43')][_0x197e('0x4b')]({'where':{'id':_0x10c082['params']['id']}})['then'](handleEntityNotFound(_0x4e72e7,null))['then'](function(_0x565039){if(_0x565039){_0x10c082[_0x197e('0x4d')][_0x197e('0x57')]=_0x565039['id'];return db[_0x197e('0x55')][_0x197e('0x4c')](_0x10c082[_0x197e('0x4d')]);}})[_0x197e('0x26')](respondWithResult(_0x4e72e7,null))[_0x197e('0x47')](handleError(_0x4e72e7,null));};exports['getAllConditions']=function(_0x21a3c8,_0x2b1d31,_0x237c4d){var _0x465bb2={};var _0x540499={};var _0xa965bd;var _0x277856;return db[_0x197e('0x43')][_0x197e('0x58')]({'where':{'id':_0x21a3c8[_0x197e('0x49')]['id']}})[_0x197e('0x26')](handleEntityNotFound(_0x2b1d31,null))['then'](function(_0x115cfe){if(_0x115cfe){_0xa965bd=_0x115cfe;_0x540499['model']=_['keys'](db['Condition']['rawAttributes']);_0x540499[_0x197e('0x35')]=_[_0x197e('0x4a')](_0x21a3c8['query']);_0x540499[_0x197e('0x36')]=_['intersection'](_0x540499['model'],_0x540499['query']);_0x465bb2['attributes']=_[_0x197e('0x37')](_0x540499[_0x197e('0x34')],qs[_0x197e('0x39')](_0x21a3c8[_0x197e('0x35')]['fields']));_0x465bb2['attributes']=_0x465bb2[_0x197e('0x38')][_0x197e('0x3a')]?_0x465bb2[_0x197e('0x38')]:_0x540499[_0x197e('0x34')];_0x465bb2[_0x197e('0x3c')]=qs[_0x197e('0x3d')](_0x21a3c8[_0x197e('0x35')][_0x197e('0x3d')]);_0x465bb2['where']=qs['filters'](_['pick'](_0x21a3c8[_0x197e('0x35')],_0x540499['filters']));if(_0x21a3c8[_0x197e('0x35')][_0x197e('0x3f')]){_0x465bb2[_0x197e('0x3e')]=_[_0x197e('0x40')](_0x465bb2[_0x197e('0x3e')],{'$or':_[_0x197e('0x2f')](_0x465bb2[_0x197e('0x38')],function(_0x432f48){var _0xdaa3a4={};_0xdaa3a4[_0x432f48]={'$like':'%'+_0x21a3c8['query'][_0x197e('0x3f')]+'%'};return _0xdaa3a4;})});}_0x465bb2=_[_0x197e('0x40')]({},_0x465bb2,_0x21a3c8[_0x197e('0x42')]);return _0xa965bd[_0x197e('0x59')](_0x465bb2);}})[_0x197e('0x26')](function(_0x374085){if(_0x374085){_0x277856=_0x374085[_0x197e('0x3a')];if(!_0x21a3c8[_0x197e('0x35')][_0x197e('0x3b')](_0x197e('0x5a'))){_0x465bb2[_0x197e('0x21')]=qs['limit'](_0x21a3c8[_0x197e('0x35')]['limit']);_0x465bb2['offset']=qs[_0x197e('0x20')](_0x21a3c8[_0x197e('0x35')][_0x197e('0x20')]);}return _0xa965bd[_0x197e('0x59')](_0x465bb2);}})[_0x197e('0x26')](function(_0x4f07bc){if(_0x4f07bc){return _0x4f07bc?{'count':_0x277856,'rows':_0x4f07bc}:null;}})[_0x197e('0x26')](respondWithResult(_0x2b1d31,null))[_0x197e('0x47')](handleError(_0x2b1d31,null));};exports[_0x197e('0x5b')]=function(_0x539c5d,_0x430dd7,_0x3ed566){var _0x6424bb={};var _0x4162df={};var _0x56e3bf;var _0x4dddaa;return db['Trigger'][_0x197e('0x58')]({'where':{'id':_0x539c5d['params']['id']}})[_0x197e('0x26')](handleEntityNotFound(_0x430dd7,null))[_0x197e('0x26')](function(_0x28f506){if(_0x28f506){_0x56e3bf=_0x28f506;_0x4162df[_0x197e('0x34')]=_['keys'](db['Condition'][_0x197e('0x30')]);_0x4162df[_0x197e('0x35')]=_[_0x197e('0x4a')](_0x539c5d[_0x197e('0x35')]);_0x4162df[_0x197e('0x36')]=_[_0x197e('0x37')](_0x4162df[_0x197e('0x34')],_0x4162df[_0x197e('0x35')]);_0x6424bb[_0x197e('0x38')]=_['intersection'](_0x4162df[_0x197e('0x34')],qs[_0x197e('0x39')](_0x539c5d[_0x197e('0x35')][_0x197e('0x39')]));_0x6424bb[_0x197e('0x38')]=_0x6424bb['attributes'][_0x197e('0x3a')]?_0x6424bb[_0x197e('0x38')]:_0x4162df[_0x197e('0x34')];_0x6424bb[_0x197e('0x3c')]=qs[_0x197e('0x3d')](_0x539c5d[_0x197e('0x35')][_0x197e('0x3d')]);_0x6424bb[_0x197e('0x3e')]=qs[_0x197e('0x36')](_[_0x197e('0x5c')](_0x539c5d[_0x197e('0x35')],_0x4162df[_0x197e('0x36')]));if(_0x539c5d[_0x197e('0x35')]['filter']){_0x6424bb[_0x197e('0x3e')]=_[_0x197e('0x40')](_0x6424bb['where'],{'$or':_[_0x197e('0x2f')](_0x6424bb['attributes'],function(_0x13aed5){var _0x436dec={};_0x436dec[_0x13aed5]={'$like':'%'+_0x539c5d[_0x197e('0x35')]['filter']+'%'};return _0x436dec;})});}_0x6424bb=_[_0x197e('0x40')]({},_0x6424bb,_0x539c5d[_0x197e('0x42')]);return _0x56e3bf[_0x197e('0x5b')](_0x6424bb);}})['then'](function(_0x46a53c){if(_0x46a53c){_0x4dddaa=_0x46a53c['length'];if(!_0x539c5d[_0x197e('0x35')]['hasOwnProperty'](_0x197e('0x5a'))){_0x6424bb[_0x197e('0x21')]=qs[_0x197e('0x21')](_0x539c5d[_0x197e('0x35')][_0x197e('0x21')]);_0x6424bb[_0x197e('0x20')]=qs[_0x197e('0x20')](_0x539c5d[_0x197e('0x35')][_0x197e('0x20')]);}return _0x56e3bf[_0x197e('0x5b')](_0x6424bb);}})[_0x197e('0x26')](function(_0x59d8ef){if(_0x59d8ef){return _0x59d8ef?{'count':_0x4dddaa,'rows':_0x59d8ef}:null;}})[_0x197e('0x26')](respondWithResult(_0x430dd7,null))[_0x197e('0x47')](handleError(_0x430dd7,null));};exports['addAction']=function(_0x472c7a,_0x2e152c,_0x1fc3ea){if(_0x472c7a['body']['id']){delete _0x472c7a['body']['id'];}return db[_0x197e('0x43')][_0x197e('0x4b')]({'where':{'id':_0x472c7a[_0x197e('0x49')]['id']}})[_0x197e('0x26')](handleEntityNotFound(_0x2e152c,null))['then'](function(_0x372143){if(_0x372143){_0x472c7a[_0x197e('0x4d')][_0x197e('0x5d')]=_0x372143['id'];return db[_0x197e('0x5e')]['create'](_0x472c7a[_0x197e('0x4d')]);}})[_0x197e('0x26')](respondWithResult(_0x2e152c,null))['catch'](handleError(_0x2e152c,null));};exports['getActions']=function(_0x55ce48,_0x53a37a,_0x26e008){var _0x6cf59d={};var _0x3c5c3e={};var _0x4a8bce;var _0x77dfaa;return db[_0x197e('0x43')][_0x197e('0x58')]({'where':{'id':_0x55ce48[_0x197e('0x49')]['id']}})['then'](handleEntityNotFound(_0x53a37a,null))[_0x197e('0x26')](function(_0x46b442){if(_0x46b442){_0x4a8bce=_0x46b442;_0x3c5c3e['model']=_['keys'](db[_0x197e('0x5e')][_0x197e('0x30')]);_0x3c5c3e['query']=_[_0x197e('0x4a')](_0x55ce48[_0x197e('0x35')]);_0x3c5c3e[_0x197e('0x36')]=_[_0x197e('0x37')](_0x3c5c3e[_0x197e('0x34')],_0x3c5c3e[_0x197e('0x35')]);_0x6cf59d[_0x197e('0x38')]=_[_0x197e('0x37')](_0x3c5c3e['model'],qs['fields'](_0x55ce48[_0x197e('0x35')][_0x197e('0x39')]));_0x6cf59d['attributes']=_0x6cf59d[_0x197e('0x38')][_0x197e('0x3a')]?_0x6cf59d[_0x197e('0x38')]:_0x3c5c3e[_0x197e('0x34')];_0x6cf59d[_0x197e('0x3c')]=qs[_0x197e('0x3d')](_0x55ce48[_0x197e('0x35')][_0x197e('0x3d')]);_0x6cf59d['where']=qs[_0x197e('0x36')](_[_0x197e('0x5c')](_0x55ce48[_0x197e('0x35')],_0x3c5c3e['filters']));if(_0x55ce48['query']['filter']){_0x6cf59d[_0x197e('0x3e')]=_[_0x197e('0x40')](_0x6cf59d[_0x197e('0x3e')],{'$or':_[_0x197e('0x2f')](_0x6cf59d[_0x197e('0x38')],function(_0x122f01){var _0x1ce63e={};_0x1ce63e[_0x122f01]={'$like':'%'+_0x55ce48[_0x197e('0x35')][_0x197e('0x3f')]+'%'};return _0x1ce63e;})});}_0x6cf59d=_[_0x197e('0x40')]({},_0x6cf59d,_0x55ce48[_0x197e('0x42')]);return _0x4a8bce['getActions'](_0x6cf59d);}})[_0x197e('0x26')](function(_0x35d7fc){if(_0x35d7fc){_0x77dfaa=_0x35d7fc[_0x197e('0x3a')];if(!_0x55ce48[_0x197e('0x35')][_0x197e('0x3b')](_0x197e('0x5a'))){_0x6cf59d[_0x197e('0x21')]=qs[_0x197e('0x21')](_0x55ce48[_0x197e('0x35')][_0x197e('0x21')]);_0x6cf59d['offset']=qs[_0x197e('0x20')](_0x55ce48[_0x197e('0x35')][_0x197e('0x20')]);}return _0x4a8bce[_0x197e('0x5f')](_0x6cf59d);}})[_0x197e('0x26')](function(_0x110a51){if(_0x110a51){return _0x110a51?{'count':_0x77dfaa,'rows':_0x110a51}:null;}})[_0x197e('0x26')](respondWithResult(_0x53a37a,null))[_0x197e('0x47')](handleError(_0x53a37a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 8e0d848..06d3132 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 _0xb04d=['util','api','moment','bluebird','request-promise','path','rimraf','./trigger.attributes','define','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb04d,0x1ad));var _0xdb04=function(_0x5a5c89,_0x37c7d6){_0x5a5c89=_0x5a5c89-0x0;var _0x35a495=_0xb04d[_0x5a5c89];return _0x35a495;};'use strict';var _=require(_0xdb04('0x0'));var util=require(_0xdb04('0x1'));var logger=require('../../config/logger')(_0xdb04('0x2'));var moment=require(_0xdb04('0x3'));var BPromise=require(_0xdb04('0x4'));var rp=require(_0xdb04('0x5'));var fs=require('fs');var path=require(_0xdb04('0x6'));var rimraf=require(_0xdb04('0x7'));var config=require('../../config/environment');var attributes=require(_0xdb04('0x8'));module['exports']=function(_0x2f1224,_0x26a763){return _0x2f1224[_0xdb04('0x9')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x007f=['request-promise','path','rimraf','./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x9e575,_0x5894d4){var _0x522277=function(_0x1f5458){while(--_0x1f5458){_0x9e575['push'](_0x9e575['shift']());}};_0x522277(++_0x5894d4);}(_0x007f,0xa3));var _0xf007=function(_0x40b7ec,_0x307707){_0x40b7ec=_0x40b7ec-0x0;var _0x72b976=_0x007f[_0x40b7ec];return _0x72b976;};'use strict';var _=require(_0xf007('0x0'));var util=require(_0xf007('0x1'));var logger=require(_0xf007('0x2'))(_0xf007('0x3'));var moment=require(_0xf007('0x4'));var BPromise=require(_0xf007('0x5'));var rp=require(_0xf007('0x6'));var fs=require('fs');var path=require(_0xf007('0x7'));var rimraf=require(_0xf007('0x8'));var config=require('../../config/environment');var attributes=require(_0xf007('0x9'));module[_0xf007('0xa')]=function(_0x288d74,_0x5e13e4){return _0x288d74[_0xf007('0xb')](_0xf007('0xc'),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 c9fba14..4428368 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 _0xdd4f=['request\x20sent','stringify','error','code','message','info','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowTrigger','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0x4c9bc4,_0x50a2d8){var _0x1a64ea=function(_0x189ba9){while(--_0x189ba9){_0x4c9bc4['push'](_0x4c9bc4['shift']());}};_0x1a64ea(++_0x50a2d8);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x10e1ce,_0x1f28eb){_0x10e1ce=_0x10e1ce-0x0;var _0x5be2ea=_0xdd4f[_0x10e1ce];return _0x5be2ea;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x307ac6,_0x3c72d4,_0x51acd6){return new BPromise(function(_0x3cd8e6,_0x563ae6){return client[_0xfdd4('0x9')](_0x307ac6,_0x51acd6)[_0xfdd4('0xa')](function(_0x1e823e){logger['info'](_0xfdd4('0xb'),_0x3c72d4,'request\x20sent');logger[_0xfdd4('0xc')](_0xfdd4('0xd'),_0x3c72d4,_0xfdd4('0xe'),JSON[_0xfdd4('0xf')](_0x1e823e));if(_0x1e823e[_0xfdd4('0x10')]){if(_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x11')]===0x1f4){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x12')]);return _0x563ae6(_0x1e823e['error'][_0xfdd4('0x12')]);}logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e['error'][_0xfdd4('0x12')]);return _0x3cd8e6(_0x1e823e['error'][_0xfdd4('0x12')]);}else{logger[_0xfdd4('0x13')](_0xfdd4('0xb'),_0x3c72d4,_0xfdd4('0xe'));_0x3cd8e6(_0x1e823e[_0xfdd4('0x14')]['message']);}})['catch'](function(_0x559c77){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x559c77);_0x563ae6(_0x559c77);});});}exports[_0xfdd4('0x15')]=function(_0x2ccc88){var _0x32b5f7=this;return new Promise(function(_0x33d752,_0x1746e1){return db[_0xfdd4('0x16')][_0xfdd4('0x17')]({'raw':_0x2ccc88['options']?_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x19')]===undefined?!![]:![]:!![],'where':_0x2ccc88[_0xfdd4('0x18')]?_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x1a')]||null:null,'attributes':_0x2ccc88[_0xfdd4('0x18')]?_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x1b')]||null:null,'limit':_0x2ccc88['options']?_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x1c')]||null:null,'include':_0x2ccc88[_0xfdd4('0x18')]?_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x1d')]?_[_0xfdd4('0x1e')](_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x1d')],function(_0x538b00){return{'model':db[_0x538b00[_0xfdd4('0x1f')]],'as':_0x538b00['as'],'attributes':_0x538b00[_0xfdd4('0x1b')],'include':_0x538b00[_0xfdd4('0x1d')]?_['map'](_0x538b00[_0xfdd4('0x1d')],function(_0x39b712){return{'model':db[_0x39b712[_0xfdd4('0x1f')]],'as':_0x39b712['as'],'attributes':_0x39b712[_0xfdd4('0x1b')],'include':_0x39b712[_0xfdd4('0x1d')]?_['map'](_0x39b712[_0xfdd4('0x1d')],function(_0x2c88ad){return{'model':db[_0x2c88ad[_0xfdd4('0x1f')]],'as':_0x2c88ad['as'],'attributes':_0x2c88ad[_0xfdd4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfdd4('0xa')](function(_0x192471){logger[_0xfdd4('0x13')](_0xfdd4('0x15'),_0x2ccc88);logger['debug'](_0xfdd4('0x15'),_0x2ccc88,JSON[_0xfdd4('0xf')](_0x192471));_0x33d752(_0x192471);})[_0xfdd4('0x20')](function(_0xef012e){logger[_0xfdd4('0x10')]('GetTrigger',_0xef012e[_0xfdd4('0x12')],_0x2ccc88);_0x1746e1(_0x32b5f7[_0xfdd4('0x10')](0x1f4,_0xef012e[_0xfdd4('0x12')]));});});};exports[_0xfdd4('0x21')]=function(_0x13cc5e){var _0x4d64ce=this;return new Promise(function(_0x374e98,_0x315568){return db[_0xfdd4('0x16')]['find']({'raw':_0x13cc5e[_0xfdd4('0x18')]?_0x13cc5e['options'][_0xfdd4('0x19')]===undefined?!![]:![]:!![],'where':_0x13cc5e[_0xfdd4('0x18')]?_0x13cc5e['options']['where']||null:null,'attributes':_0x13cc5e[_0xfdd4('0x18')]?_0x13cc5e[_0xfdd4('0x18')]['attributes']||null:null,'include':_0x13cc5e['options']?_0x13cc5e[_0xfdd4('0x18')][_0xfdd4('0x1d')]?_[_0xfdd4('0x1e')](_0x13cc5e[_0xfdd4('0x18')][_0xfdd4('0x1d')],function(_0x265cab){return{'model':db[_0x265cab[_0xfdd4('0x1f')]],'as':_0x265cab['as'],'attributes':_0x265cab[_0xfdd4('0x1b')],'include':_0x265cab[_0xfdd4('0x1d')]?_[_0xfdd4('0x1e')](_0x265cab[_0xfdd4('0x1d')],function(_0x12b8b1){return{'model':db[_0x12b8b1[_0xfdd4('0x1f')]],'as':_0x12b8b1['as'],'attributes':_0x12b8b1[_0xfdd4('0x1b')],'include':_0x12b8b1[_0xfdd4('0x1d')]?_[_0xfdd4('0x1e')](_0x12b8b1[_0xfdd4('0x1d')],function(_0x3a0102){return{'model':db[_0x3a0102[_0xfdd4('0x1f')]],'as':_0x3a0102['as'],'attributes':_0x3a0102[_0xfdd4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfdd4('0xa')](function(_0x2e4c8c){logger[_0xfdd4('0x13')](_0xfdd4('0x21'),_0x13cc5e);logger[_0xfdd4('0xc')](_0xfdd4('0x21'),_0x13cc5e,JSON['stringify'](_0x2e4c8c));_0x374e98(_0x2e4c8c);})[_0xfdd4('0x20')](function(_0x3716da){logger[_0xfdd4('0x10')](_0xfdd4('0x21'),_0x3716da[_0xfdd4('0x12')],_0x13cc5e);_0x315568(_0x4d64ce[_0xfdd4('0x10')](0x1f4,_0x3716da['message']));});});}; \ No newline at end of file +var _0xf7b4=['request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','GetTrigger','find','ShowTrigger','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x2be87e,_0x59de6b){var _0x213e1a=function(_0x2b8cf6){while(--_0x2b8cf6){_0x2be87e['push'](_0x2be87e['shift']());}};_0x213e1a(++_0x59de6b);}(_0xf7b4,0x152));var _0x4f7b=function(_0x5e99af,_0x29f8c1){_0x5e99af=_0x5e99af-0x0;var _0x546f21=_0xf7b4[_0x5e99af];return _0x546f21;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('Trigger,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('Trigger,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});}exports['GetTrigger']=function(_0x24e5cf){var _0x3813da=this;return new Promise(function(_0x519d90,_0x2b34c9){return db[_0x4f7b('0x15')][_0x4f7b('0x16')]({'raw':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x24e5cf['options']?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'limit':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1b')]||null:null,'include':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x24e5cf[_0x4f7b('0x17')]['include'],function(_0x150f57){return{'model':db[_0x150f57[_0x4f7b('0x1e')]],'as':_0x150f57['as'],'attributes':_0x150f57['attributes'],'include':_0x150f57[_0x4f7b('0x1c')]?_['map'](_0x150f57[_0x4f7b('0x1c')],function(_0x2429be){return{'model':db[_0x2429be[_0x4f7b('0x1e')]],'as':_0x2429be['as'],'attributes':_0x2429be[_0x4f7b('0x1a')],'include':_0x2429be[_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x2429be[_0x4f7b('0x1c')],function(_0x3ad769){return{'model':db[_0x3ad769['model']],'as':_0x3ad769['as'],'attributes':_0x3ad769[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x311675){logger['info'](_0x4f7b('0x20'),_0x24e5cf);logger[_0x4f7b('0xd')](_0x4f7b('0x20'),_0x24e5cf,JSON[_0x4f7b('0xf')](_0x311675));_0x519d90(_0x311675);})[_0x4f7b('0x14')](function(_0x4ebffa){logger[_0x4f7b('0x10')](_0x4f7b('0x20'),_0x4ebffa[_0x4f7b('0x12')],_0x24e5cf);_0x2b34c9(_0x3813da['error'](0x1f4,_0x4ebffa[_0x4f7b('0x12')]));});});};exports['ShowTrigger']=function(_0x4e4828){var _0x1a2346=this;return new Promise(function(_0x52a5b1,_0x1aad4b){return db[_0x4f7b('0x15')][_0x4f7b('0x21')]({'raw':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'include':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')],function(_0x35f1ed){return{'model':db[_0x35f1ed[_0x4f7b('0x1e')]],'as':_0x35f1ed['as'],'attributes':_0x35f1ed[_0x4f7b('0x1a')],'include':_0x35f1ed[_0x4f7b('0x1c')]?_['map'](_0x35f1ed[_0x4f7b('0x1c')],function(_0x5127a2){return{'model':db[_0x5127a2[_0x4f7b('0x1e')]],'as':_0x5127a2['as'],'attributes':_0x5127a2[_0x4f7b('0x1a')],'include':_0x5127a2['include']?_[_0x4f7b('0x1d')](_0x5127a2[_0x4f7b('0x1c')],function(_0x1347b6){return{'model':db[_0x1347b6['model']],'as':_0x1347b6['as'],'attributes':_0x1347b6[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x446f6e){logger[_0x4f7b('0xb')](_0x4f7b('0x22'),_0x4e4828);logger[_0x4f7b('0xd')](_0x4f7b('0x22'),_0x4e4828,JSON['stringify'](_0x446f6e));_0x52a5b1(_0x446f6e);})[_0x4f7b('0x14')](function(_0x486187){logger[_0x4f7b('0x10')](_0x4f7b('0x22'),_0x486187[_0x4f7b('0x12')],_0x4e4828);_0x1aad4b(_0x1a2346['error'](0x1f4,_0x486187[_0x4f7b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 0d76d1a..0ec5a9b 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 _0xc44b=['isAuthenticated','show','post','create','delete','/:id','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','get'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xc44b,0xad));var _0xbc44=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0xc44b[_0x396466];return _0x5e9ab4;};'use strict';var multer=require(_0xbc44('0x0'));var util=require(_0xbc44('0x1'));var path=require(_0xbc44('0x2'));var timeout=require('connect-timeout');var express=require(_0xbc44('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbc44('0x4'));var config=require(_0xbc44('0x5'));var controller=require('./trunk.controller');router[_0xbc44('0x6')]('/',auth[_0xbc44('0x7')](),controller['index']);router['get']('/:id',auth[_0xbc44('0x7')](),controller[_0xbc44('0x8')]);router[_0xbc44('0x9')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0xbc44('0x9')]('/',auth[_0xbc44('0x7')](),controller[_0xbc44('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xbc44('0xb')](_0xbc44('0xc'),auth['isAuthenticated'](),controller[_0xbc44('0xd')]);module[_0xbc44('0xe')]=router; \ No newline at end of file +var _0x27a2=['isAuthenticated','index','/:id','show','clone','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get'];(function(_0x3b9c74,_0x3feb38){var _0x10f564=function(_0x55100c){while(--_0x55100c){_0x3b9c74['push'](_0x3b9c74['shift']());}};_0x10f564(++_0x3feb38);}(_0x27a2,0x182));var _0x227a=function(_0x38224a,_0x2e0c7b){_0x38224a=_0x38224a-0x0;var _0x5298f6=_0x27a2[_0x38224a];return _0x5298f6;};'use strict';var multer=require(_0x227a('0x0'));var util=require(_0x227a('0x1'));var path=require('path');var timeout=require(_0x227a('0x2'));var express=require(_0x227a('0x3'));var router=express[_0x227a('0x4')]();var fs_extra=require(_0x227a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x227a('0x6'));var config=require(_0x227a('0x7'));var controller=require(_0x227a('0x8'));router[_0x227a('0x9')]('/',auth[_0x227a('0xa')](),controller[_0x227a('0xb')]);router[_0x227a('0x9')](_0x227a('0xc'),auth['isAuthenticated'](),controller[_0x227a('0xd')]);router['post']('/:id/clone',auth[_0x227a('0xa')](),controller[_0x227a('0xe')]);router[_0x227a('0xf')]('/',auth[_0x227a('0xa')](),controller[_0x227a('0x10')]);router[_0x227a('0x11')](_0x227a('0xc'),auth[_0x227a('0xa')](),controller[_0x227a('0x12')]);router[_0x227a('0x13')](_0x227a('0xc'),auth[_0x227a('0xa')](),controller[_0x227a('0x14')]);module[_0x227a('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index c5d6b04..4b771af 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 _0xc9e5=['uas','pai','fingerprint','active','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','user','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB','udp','setDataValue','join','transport','split','rfc2833','shortinfo','nonat','update','outgoing','yes','nat','getDataValue','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','originate'];(function(_0x106df8,_0x5e190b){var _0x1b6d78=function(_0xc46051){while(--_0xc46051){_0x106df8['push'](_0x106df8['shift']());}};_0x1b6d78(++_0x5e190b);}(_0xc9e5,0x89));var _0x5c9e=function(_0x2a29e2,_0x12ff0a){_0x2a29e2=_0x2a29e2-0x0;var _0x5be96a=_0xc9e5[_0x2a29e2];return _0x5be96a;};'use strict';var Sequelize=require(_0x5c9e('0x0'));module[_0x5c9e('0x1')]={'name':{'type':Sequelize[_0x5c9e('0x2')],'allowNull':![],'unique':_0x5c9e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x5c9e('0x4'),_0x5c9e('0x5'),'peer'),'allowNull':![],'defaultValue':_0x5c9e('0x4')},'context':{'type':Sequelize[_0x5c9e('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x5c9e('0x6')]('ALLOWED_NOT_SCREENED',_0x5c9e('0x7'),_0x5c9e('0x8'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x5c9e('0x9'))},'deny':{'type':Sequelize[_0x5c9e('0x2')]},'permit':{'type':Sequelize[_0x5c9e('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x5c9e('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x5c9e('0xa'),'set':function(_0x16316f){this[_0x5c9e('0xb')]('transport',_0x16316f?_0x16316f[_0x5c9e('0xc')](','):null);},'get':function(){return this['getDataValue'](_0x5c9e('0xd'))?this['getDataValue'](_0x5c9e('0xd'))[_0x5c9e('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0xf'),'info',_0x5c9e('0x10'),'inband','auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x5c9e('0x6')]('yes','no',_0x5c9e('0x11'),_0x5c9e('0x12'),_0x5c9e('0x13')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5c9e('0x2')]},'directmediadeny':{'type':Sequelize[_0x5c9e('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x5dcc41){this[_0x5c9e('0xb')](_0x5c9e('0x15'),_0x5dcc41?_0x5dcc41['join'](','):null);},'get':function(){return this[_0x5c9e('0x16')](_0x5c9e('0x15'))?this['getDataValue']('nat')[_0x5c9e('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x5c9e('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x5c9e('0x2')]},'language':{'type':Sequelize[_0x5c9e('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5c9e('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x5c9e('0x2')],'defaultValue':_0x5c9e('0x17')},'allow':{'type':Sequelize[_0x5c9e('0x2')],'allowNull':![],'defaultValue':_0x5c9e('0x18'),'set':function(_0x1d1792){this[_0x5c9e('0xb')](_0x5c9e('0x19'),_0x1d1792?_0x1d1792[_0x5c9e('0xc')](';'):_0x5c9e('0x18'));},'get':function(){return this[_0x5c9e('0x16')](_0x5c9e('0x19'))?this[_0x5c9e('0x16')](_0x5c9e('0x19'))[_0x5c9e('0xe')](';'):null;},'comment':_0x5c9e('0x1a')},'autoframing':{'type':Sequelize[_0x5c9e('0x6')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x5c9e('0x1b'),'set':function(_0x24cad3){this['setDataValue'](_0x5c9e('0x1c'),_0x24cad3?_0x24cad3[_0x5c9e('0xc')](','):null);},'get':function(){return this[_0x5c9e('0x16')](_0x5c9e('0x1c'))?this[_0x5c9e('0x16')]('insecure')[_0x5c9e('0xe')](','):null;},'comment':_0x5c9e('0x1d')},'trustrpid':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5c9e('0x6')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no',_0x5c9e('0x1e'))},'promiscredir':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'useclientcode':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x5c9e('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x5c9e('0x2')]},'callcounter':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no'),'defaultValue':_0x5c9e('0x14')},'busylevel':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x5c9e('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0x5c9e('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x5c9e('0x14'),'no',_0x5c9e('0x20')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x5c9e('0x6')]('yes','no')},'mailbox':{'type':Sequelize[_0x5c9e('0x2')]},'session_timers':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x21'),'refuse',_0x5c9e('0x22'))},'session_expires':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'session_minse':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'session_refresher':{'type':Sequelize[_0x5c9e('0x6')]('uac',_0x5c9e('0x23')),'defaultValue':_0x5c9e('0x23')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x5c9e('0x2')]},'fromdomain':{'type':Sequelize[_0x5c9e('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x5c9e('0x1f')](0x5)},'qualify':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no'),'defaultValue':_0x5c9e('0x14')},'keepalive':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'defaultip':{'type':Sequelize[_0x5c9e('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'sendrpid':{'type':Sequelize[_0x5c9e('0x6')]('yes','no',_0x5c9e('0x24')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x5c9e('0x2')]},'timert1':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'timerb':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'qualifyfreq':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'contactpermit':{'type':Sequelize[_0x5c9e('0x2')]},'contactdeny':{'type':Sequelize[_0x5c9e('0x2')]},'contactacl':{'type':Sequelize[_0x5c9e('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x5c9e('0x2')]},'use_q850_reason':{'type':Sequelize[_0x5c9e('0x2')]},'maxforwards':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x5c9e('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'force_avp':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'icesupport':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no',_0x5c9e('0x25'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x5c9e('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x5c9e('0x2')]},'dtlscipher':{'type':Sequelize[_0x5c9e('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x5c9e('0x2')]},'dtlssetup':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x26'),_0x5c9e('0x27'),_0x5c9e('0x28')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5c9e('0x2')]},'usereqphone':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5c9e('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x5c9e('0x1f')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x5c9e('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0x5c9e('0x6')]('yes','no')},'vmexten':{'type':Sequelize[_0x5c9e('0x2')]},'mohinterpret':{'type':Sequelize[_0x5c9e('0x2')]},'mohsuggest':{'type':Sequelize[_0x5c9e('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5c9e('0x2')]},'host':{'type':Sequelize[_0x5c9e('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x5c9e('0x14'),'no',_0x5c9e('0x11'),_0x5c9e('0x12'),_0x5c9e('0x29')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5c9e('0x2a')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x5c9e('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x7b55=['exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','setDataValue','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','active','passive','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize'];(function(_0x5a826d,_0x388e13){var _0x1b9687=function(_0x467abd){while(--_0x467abd){_0x5a826d['push'](_0x5a826d['shift']());}};_0x1b9687(++_0x388e13);}(_0x7b55,0x1af));var _0x57b5=function(_0xb7bcf2,_0xd8e69d){_0xb7bcf2=_0xb7bcf2-0x0;var _0x1451d9=_0x7b55[_0xb7bcf2];return _0x1451d9;};'use strict';var Sequelize=require(_0x57b5('0x0'));module[_0x57b5('0x1')]={'name':{'type':Sequelize[_0x57b5('0x2')],'allowNull':![],'unique':_0x57b5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x5'),_0x57b5('0x6'),'peer'),'allowNull':![],'defaultValue':_0x57b5('0x5')},'context':{'type':Sequelize[_0x57b5('0x2')],'allowNull':![],'defaultValue':_0x57b5('0x7')},'callingpres':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x8'),_0x57b5('0x9'),'ALLOWED_FAILED_SCREEN',_0x57b5('0xa'),'PROHIB_NOT_SCREENED',_0x57b5('0xb'),_0x57b5('0xc'),_0x57b5('0xd'))},'deny':{'type':Sequelize[_0x57b5('0x2')]},'permit':{'type':Sequelize[_0x57b5('0x2')]},'secret':{'type':Sequelize[_0x57b5('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x57b5('0x2')]},'transport':{'type':Sequelize[_0x57b5('0x2')],'defaultValue':_0x57b5('0xe'),'set':function(_0x529de4){this['setDataValue'](_0x57b5('0xf'),_0x529de4?_0x529de4[_0x57b5('0x10')](','):null);},'get':function(){return this[_0x57b5('0x11')](_0x57b5('0xf'))?this[_0x57b5('0x11')](_0x57b5('0xf'))[_0x57b5('0x12')](','):null;},'comment':_0x57b5('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0x57b5('0x14'),'info',_0x57b5('0x15'),_0x57b5('0x16'),_0x57b5('0x17')),'defaultValue':_0x57b5('0x14')},'directmedia':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no','nonat',_0x57b5('0x19'),_0x57b5('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x57b5('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x57b5('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x57b5('0x1b'),'set':function(_0x39f98e){this['setDataValue'](_0x57b5('0x1c'),_0x39f98e?_0x39f98e[_0x57b5('0x10')](','):null);},'get':function(){return this[_0x57b5('0x11')](_0x57b5('0x1c'))?this[_0x57b5('0x11')](_0x57b5('0x1c'))[_0x57b5('0x12')](','):null;},'comment':_0x57b5('0x1d')},'callgroup':{'type':Sequelize[_0x57b5('0x2')]},'namedcallgroup':{'type':Sequelize[_0x57b5('0x2')]},'pickupgroup':{'type':Sequelize[_0x57b5('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x57b5('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x57b5('0x1e')},'allow':{'type':Sequelize[_0x57b5('0x2')],'allowNull':![],'defaultValue':_0x57b5('0x1f'),'set':function(_0x5b8a40){this['setDataValue'](_0x57b5('0x20'),_0x5b8a40?_0x5b8a40[_0x57b5('0x10')](';'):_0x57b5('0x1f'));},'get':function(){return this[_0x57b5('0x11')]('allow')?this[_0x57b5('0x11')](_0x57b5('0x20'))[_0x57b5('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no')},'insecure':{'type':Sequelize[_0x57b5('0x2')],'defaultValue':_0x57b5('0x21'),'set':function(_0x13825b){this[_0x57b5('0x22')](_0x57b5('0x23'),_0x13825b?_0x13825b[_0x57b5('0x10')](','):null);},'get':function(){return this[_0x57b5('0x11')](_0x57b5('0x23'))?this[_0x57b5('0x11')](_0x57b5('0x23'))[_0x57b5('0x12')](','):null;},'comment':_0x57b5('0x24')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no',_0x57b5('0x25'))},'promiscredir':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x57b5('0x18'),'no')},'accountcode':{'type':Sequelize[_0x57b5('0x26')](0xb)},'setvar':{'type':Sequelize[_0x57b5('0x2')]},'callerid':{'type':Sequelize[_0x57b5('0x2')],'defaultValue':_0x57b5('0x27')},'amaflags':{'type':Sequelize[_0x57b5('0x2')]},'callcounter':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no'),'defaultValue':_0x57b5('0x18')},'busylevel':{'type':Sequelize[_0x57b5('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x57b5('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x57b5('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x57b5('0x2')]},'template':{'type':Sequelize[_0x57b5('0x2')]},'videosupport':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no',_0x57b5('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x57b5('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x57b5('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0x57b5('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x57b5('0x29'),_0x57b5('0x2a'),_0x57b5('0x2b'))},'session_expires':{'type':Sequelize[_0x57b5('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x2c'),_0x57b5('0x2d')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x57b5('0x2')]},'regexten':{'type':Sequelize[_0x57b5('0x2')]},'fromdomain':{'type':Sequelize[_0x57b5('0x2')]},'fromuser':{'type':Sequelize[_0x57b5('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x57b5('0x18'),'no'),'defaultValue':_0x57b5('0x18')},'keepalive':{'type':Sequelize[_0x57b5('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x57b5('0x2')]},'rtptimeout':{'type':Sequelize[_0x57b5('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x57b5('0x26')](0xb)},'timerb':{'type':Sequelize[_0x57b5('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x57b5('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x57b5('0x2')]},'contactdeny':{'type':Sequelize[_0x57b5('0x2')]},'contactacl':{'type':Sequelize[_0x57b5('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x57b5('0x2')]},'maxforwards':{'type':Sequelize[_0x57b5('0x26')](0xb)},'encryption':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no')},'force_avp':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no')},'icesupport':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x57b5('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x57b5('0x4')]('yes','no',_0x57b5('0x2e'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x57b5('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x57b5('0x2')]},'dtlscapath':{'type':Sequelize[_0x57b5('0x2')]},'dtlssetup':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x2f'),_0x57b5('0x30'),_0x57b5('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x57b5('0x2')]},'usereqphone':{'type':Sequelize[_0x57b5('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x57b5('0x2')]},'call_limit':{'type':Sequelize[_0x57b5('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x57b5('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no')},'vmexten':{'type':Sequelize[_0x57b5('0x2')]},'mohinterpret':{'type':Sequelize[_0x57b5('0x2')]},'mohsuggest':{'type':Sequelize[_0x57b5('0x2')]},'parkinglot':{'type':Sequelize[_0x57b5('0x2')]},'description':{'type':Sequelize[_0x57b5('0x2')]},'host':{'type':Sequelize[_0x57b5('0x2')],'defaultValue':_0x57b5('0x32')},'canreinvite':{'type':Sequelize[_0x57b5('0x4')](_0x57b5('0x18'),'no',_0x57b5('0x33'),_0x57b5('0x19'),_0x57b5('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x57b5('0x2')]},'otherFields':{'type':Sequelize[_0x57b5('0x2')]},'active':{'type':Sequelize[_0x57b5('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x57b5('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 99c286c..4c02fdf 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 _0x98c6=['../../config/license/util','../../mysqldb','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','map','rawAttributes','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','Trunk','includeAll','include','findAll','rows','show','params','find','omit','createdAt','updatedAt','body','create','role','user','UserProfileSection','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','server/files/templates/registry.ejs','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment'];(function(_0x2e8de8,_0xac464e){var _0x4df88d=function(_0x405924){while(--_0x405924){_0x2e8de8['push'](_0x2e8de8['shift']());}};_0x4df88d(++_0xac464e);}(_0x98c6,0xc7));var _0x698c=function(_0x352521,_0x1e1113){_0x352521=_0x352521-0x0;var _0x64a222=_0x98c6[_0x352521];return _0x64a222;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x698c('0x0'));var rimraf=require(_0x698c('0x1'));var zipdir=require(_0x698c('0x2'));var jsonpatch=require(_0x698c('0x3'));var rp=require(_0x698c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x698c('0x5'));var sox=require('sox');var csv=require(_0x698c('0x6'));var ejs=require(_0x698c('0x7'));var fs=require('fs');var fs_extra=require(_0x698c('0x8'));var _=require(_0x698c('0x9'));var squel=require('squel');var crypto=require(_0x698c('0xa'));var jsforce=require(_0x698c('0xb'));var deskjs=require(_0x698c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x698c('0xd'));var Redis=require(_0x698c('0xe'));var authService=require(_0x698c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x698c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x698c('0x11'));var config=require(_0x698c('0x12'));var licenseUtil=require(_0x698c('0x13'));var db=require(_0x698c('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x698c('0x15')][_0x698c('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2c3c45,_0x5f0f16,_0x2f4099,_0x2a021a){return new BPromise(function(_0xcf6ea1,_0x4df191){var _0xa11a9d=_0x2a021a||client;return _0xa11a9d[_0x698c('0x17')](_0x2c3c45,_0x2f4099)[_0x698c('0x18')](function(_0xaf9495){logger[_0x698c('0x19')](_0x698c('0x1a'),_0x5f0f16,_0x698c('0x1b'));logger[_0x698c('0x1c')](_0x698c('0x1d'),_0x5f0f16,'request\x20sent',JSON[_0x698c('0x1e')](_0xaf9495));if(_0xaf9495['error']){if(_0xaf9495[_0x698c('0x1f')]['code']===0x1f4){logger['error'](_0x698c('0x1a'),_0x5f0f16,_0xaf9495[_0x698c('0x1f')][_0x698c('0x20')]);return _0x4df191(_0xaf9495[_0x698c('0x1f')][_0x698c('0x20')]);}logger[_0x698c('0x1f')]('Trunk,\x20%s,\x20%s',_0x5f0f16,_0xaf9495[_0x698c('0x1f')][_0x698c('0x20')]);return _0xcf6ea1(_0xaf9495['error'][_0x698c('0x20')]);}else{logger['info'](_0x698c('0x1a'),_0x5f0f16,_0x698c('0x1b'));_0xcf6ea1(_0xaf9495[_0x698c('0x21')]['message']);}})['catch'](function(_0x2d19a0){logger[_0x698c('0x1f')](_0x698c('0x1a'),_0x5f0f16,_0x2d19a0);_0x4df191(_0x2d19a0);});});}function respondWithStatusCode(_0x2ebd00,_0x59b646){_0x59b646=_0x59b646||0xcc;return function(_0x37df73){if(_0x37df73){return _0x2ebd00[_0x698c('0x22')](_0x59b646);}return _0x2ebd00['status'](_0x59b646)[_0x698c('0x23')]();};}function respondWithResult(_0x21c076,_0x40c75c){_0x40c75c=_0x40c75c||0xc8;return function(_0x53d8f6){if(_0x53d8f6){return _0x21c076['status'](_0x40c75c)['json'](_0x53d8f6);}};}function respondWithFilteredResult(_0x3f739e,_0x127f4d){return function(_0x2c24bf){if(_0x2c24bf){var _0xb6c49=_0x2c24bf[_0x698c('0x24')],_0x19c19b=_0x127f4d[_0x698c('0x25')],_0x5ae595=_0x127f4d['offset']+_0x127f4d[_0x698c('0x26')],_0x451281;if(_0x5ae595>=_0xb6c49){_0x5ae595=_0xb6c49;_0x451281=0xc8;}else{_0x451281=0xce;}_0x3f739e[_0x698c('0x27')](_0x451281);return _0x3f739e[_0x698c('0x28')](_0x698c('0x29'),_0x19c19b+'-'+_0x5ae595+'/'+_0xb6c49)['json'](_0x2c24bf);}return null;};}function patchUpdates(_0x55eaf0){return function(_0x28dd35){try{jsonpatch[_0x698c('0x2a')](_0x28dd35,_0x55eaf0,!![]);}catch(_0x3c1365){return BPromise[_0x698c('0x2b')](_0x3c1365);}return _0x28dd35[_0x698c('0x2c')]();};}function saveUpdates(_0x29428e,_0x3783e5){return function(_0x334a80){if(_0x334a80){return _0x334a80[_0x698c('0x2d')](_0x29428e)['then'](function(_0x559390){return _0x559390;});}return null;};}function removeEntity(_0x2c0d45,_0x858602){return function(_0x207cc4){if(_0x207cc4){return _0x207cc4[_0x698c('0x2e')]()[_0x698c('0x18')](function(){var _0x3d7be7=_0x207cc4[_0x698c('0x2f')]({'plain':!![]});var _0x25ed5c=_0x698c('0x30');return db[_0x698c('0x31')][_0x698c('0x2e')]({'where':{'type':_0x25ed5c,'resourceId':_0x3d7be7['id']}})['then'](function(){return _0x207cc4;});})['then'](function(){_0x2c0d45[_0x698c('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f9cf3,_0x1d9ce1){return function(_0x44a23a){if(!_0x44a23a){_0x1f9cf3[_0x698c('0x22')](0x194);}return _0x44a23a;};}function handleError(_0x5d69f2,_0x478b3c){_0x478b3c=_0x478b3c||0x1f4;return function(_0x2512bb){logger['error'](_0x2512bb[_0x698c('0x32')]);if(_0x2512bb['name']){delete _0x2512bb['name'];}_0x5d69f2[_0x698c('0x27')](_0x478b3c)[_0x698c('0x33')](_0x2512bb);};}exports[_0x698c('0x34')]=function(_0x586044,_0x2372c7){var _0x31c680={},_0x326498={},_0x13c1f3={'count':0x0,'rows':[]};var _0x9fff0f=_[_0x698c('0x35')](db['Trunk'][_0x698c('0x36')],function(_0x5dbfb6){return{'name':_0x5dbfb6['fieldName'],'type':_0x5dbfb6[_0x698c('0x37')][_0x698c('0x38')]};});_0x326498[_0x698c('0x39')]=_['map'](_0x9fff0f,_0x698c('0x3a'));_0x326498[_0x698c('0x3b')]=_[_0x698c('0x3c')](_0x586044['query']);_0x326498['filters']=_[_0x698c('0x3d')](_0x326498[_0x698c('0x39')],_0x326498[_0x698c('0x3b')]);_0x31c680['attributes']=_[_0x698c('0x3d')](_0x326498[_0x698c('0x39')],qs['fields'](_0x586044['query'][_0x698c('0x3e')]));_0x31c680[_0x698c('0x3f')]=_0x31c680[_0x698c('0x3f')][_0x698c('0x40')]?_0x31c680['attributes']:_0x326498[_0x698c('0x39')];if(!_0x586044[_0x698c('0x3b')][_0x698c('0x41')](_0x698c('0x42'))){_0x31c680['limit']=qs[_0x698c('0x26')](_0x586044[_0x698c('0x3b')]['limit']);_0x31c680['offset']=qs[_0x698c('0x25')](_0x586044[_0x698c('0x3b')][_0x698c('0x25')]);}_0x31c680[_0x698c('0x43')]=qs[_0x698c('0x44')](_0x586044[_0x698c('0x3b')][_0x698c('0x44')]);_0x31c680[_0x698c('0x45')]=qs['filters'](_[_0x698c('0x46')](_0x586044[_0x698c('0x3b')],_0x326498[_0x698c('0x47')]),_0x9fff0f);if(_0x586044[_0x698c('0x3b')][_0x698c('0x48')]){_0x31c680[_0x698c('0x45')]=_[_0x698c('0x49')](_0x31c680['where'],{'$or':_[_0x698c('0x35')](_0x9fff0f,function(_0x4ed8f9){if(_0x4ed8f9[_0x698c('0x37')]!==_0x698c('0x4a')){var _0x3a129a={};_0x3a129a[_0x4ed8f9[_0x698c('0x3a')]]={'$like':'%'+_0x586044['query'][_0x698c('0x48')]+'%'};return _0x3a129a;}})});}_0x31c680=_[_0x698c('0x49')]({},_0x31c680,_0x586044[_0x698c('0x4b')]);var _0x567a5b={'where':_0x31c680['where']};return db[_0x698c('0x4c')]['count'](_0x567a5b)[_0x698c('0x18')](function(_0x5b7199){_0x13c1f3[_0x698c('0x24')]=_0x5b7199;if(_0x586044['query'][_0x698c('0x4d')]){_0x31c680[_0x698c('0x4e')]=[{'all':!![]}];}return db[_0x698c('0x4c')][_0x698c('0x4f')](_0x31c680);})[_0x698c('0x18')](function(_0x2ca00d){_0x13c1f3[_0x698c('0x50')]=_0x2ca00d;return _0x13c1f3;})[_0x698c('0x18')](respondWithFilteredResult(_0x2372c7,_0x31c680))['catch'](handleError(_0x2372c7,null));};exports[_0x698c('0x51')]=function(_0x374e7f,_0x4d2aeb){var _0x509021={'raw':![],'where':{'id':_0x374e7f[_0x698c('0x52')]['id']}},_0x550b49={};_0x550b49[_0x698c('0x39')]=_['keys'](db[_0x698c('0x4c')]['rawAttributes']);_0x550b49[_0x698c('0x3b')]=_[_0x698c('0x3c')](_0x374e7f[_0x698c('0x3b')]);_0x550b49[_0x698c('0x47')]=_[_0x698c('0x3d')](_0x550b49['model'],_0x550b49[_0x698c('0x3b')]);_0x509021[_0x698c('0x3f')]=_[_0x698c('0x3d')](_0x550b49['model'],qs['fields'](_0x374e7f[_0x698c('0x3b')][_0x698c('0x3e')]));_0x509021[_0x698c('0x3f')]=_0x509021[_0x698c('0x3f')]['length']?_0x509021[_0x698c('0x3f')]:_0x550b49['model'];if(_0x374e7f['query']['includeAll']){_0x509021[_0x698c('0x4e')]=[{'all':!![]}];}_0x509021=_['merge']({},_0x509021,_0x374e7f[_0x698c('0x4b')]);return db[_0x698c('0x4c')][_0x698c('0x53')](_0x509021)[_0x698c('0x18')](handleEntityNotFound(_0x4d2aeb,null))[_0x698c('0x18')](respondWithResult(_0x4d2aeb,null))['catch'](handleError(_0x4d2aeb,null));};exports['clone']=function(_0x31896e,_0x10513f){var _0x2269f8={'where':{'id':_0x31896e[_0x698c('0x52')]['id']}},_0x1c560c={};_0x1c560c[_0x698c('0x39')]=_[_0x698c('0x3c')](db['Trunk'][_0x698c('0x36')]);_0x2269f8[_0x698c('0x3f')]=_['intersection'](_0x1c560c[_0x698c('0x39')],qs[_0x698c('0x3e')](_0x31896e[_0x698c('0x3b')][_0x698c('0x3e')]));_0x2269f8['attributes']=_0x2269f8[_0x698c('0x3f')][_0x698c('0x40')]?_0x2269f8[_0x698c('0x3f')]:_0x1c560c[_0x698c('0x39')];if(_0x31896e[_0x698c('0x3b')][_0x698c('0x4d')]){_0x2269f8[_0x698c('0x4e')]=[{'all':!![]}];}_0x2269f8=_[_0x698c('0x49')]({},_0x2269f8,_0x31896e[_0x698c('0x4b')]);return db[_0x698c('0x4c')][_0x698c('0x53')](_0x2269f8)[_0x698c('0x18')](handleEntityNotFound(_0x10513f,null))[_0x698c('0x18')](function(_0x54528e){if(_0x54528e){var _0x15003e=_0x54528e[_0x698c('0x2f')]({'plain':!![]});_0x15003e=qs[_0x698c('0x54')](_0x15003e,['id',_0x698c('0x55'),_0x698c('0x56')]);_0x31896e[_0x698c('0x57')]=_[_0x698c('0x54')](_0x31896e[_0x698c('0x57')],['id',_0x698c('0x55'),'updatedAt']);return db[_0x698c('0x4c')][_0x698c('0x58')](_[_0x698c('0x49')](_0x15003e,_0x31896e[_0x698c('0x57')]),{'include':_0x31896e[_0x698c('0x3b')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4db4b4){var _0x577408=_0x31896e['user'][_0x698c('0x2f')]({'plain':!![]});if(!_0x577408)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x577408[_0x698c('0x59')]===_0x698c('0x5a')){var _0x59ca15=_0x4db4b4['get']({'plain':!![]});var _0x52cc96=_0x698c('0x30');return db[_0x698c('0x5b')]['find']({'where':{'name':_0x52cc96,'userProfileId':_0x577408['userProfileId']},'raw':!![]})[_0x698c('0x18')](function(_0x31530a){if(_0x31530a&&_0x31530a['autoAssociation']===0x0){return db[_0x698c('0x31')][_0x698c('0x58')]({'name':_0x59ca15[_0x698c('0x3a')],'resourceId':_0x59ca15['id'],'type':_0x31530a[_0x698c('0x3a')],'sectionId':_0x31530a['id']},{})['then'](function(){return _0x4db4b4;});}else{return _0x4db4b4;}})[_0x698c('0x5c')](function(_0x5beac9){logger[_0x698c('0x1f')](_0x698c('0x5d'),_0x5beac9);throw _0x5beac9;});}return _0x4db4b4;});}})[_0x698c('0x18')](respondWithResult(_0x10513f,0xc9))['catch'](handleError(_0x10513f,null));};exports['create']=function(_0x33add5,_0x30cac7,_0x41f2f6){var _0x200d5b;return db[_0x698c('0x4c')]['create'](_0x33add5[_0x698c('0x57')],{'raw':!![]})[_0x698c('0x18')](function(_0x44d5ef){_0x200d5b=_0x44d5ef;return db[_0x698c('0x4c')]['findAll']({'raw':!![]});})[_0x698c('0x18')](function(_0x105841){var _0x250a05=fs[_0x698c('0x5e')](path[_0x698c('0x5f')](config[_0x698c('0x60')],_0x698c('0x61')),'utf8');var _0x44288d=fs[_0x698c('0x5e')](path[_0x698c('0x5f')](config[_0x698c('0x60')],'server/files/templates/registry.ejs'),_0x698c('0x62'));var _0x459440=ejs[_0x698c('0x63')](_0x250a05,{'trunks':_0x105841||[]});fs[_0x698c('0x64')](_0x698c('0x65'),_0x459440);if(_0x200d5b['registry']){var _0x2b40b5=ejs[_0x698c('0x63')](_0x44288d,{'trunks':_0x105841||[]});fs['writeFileSync'](_0x698c('0x66'),_0x2b40b5);}})[_0x698c('0x18')](function(){return respondWithRpcPromise('Reload',_0x698c('0x58'),{'module':'chan_sip.so'});})[_0x698c('0x18')](function(){var _0x427c1c=_0x33add5['user']['get']({'plain':!![]});if(!_0x427c1c)throw new Error(_0x698c('0x67'));if(_0x427c1c[_0x698c('0x59')]===_0x698c('0x5a')){var _0x12f515=_0x200d5b[_0x698c('0x2f')]({'plain':!![]});return db[_0x698c('0x5b')][_0x698c('0x53')]({'where':{'name':_0x698c('0x30'),'userProfileId':_0x427c1c[_0x698c('0x68')]},'raw':!![]})[_0x698c('0x18')](function(_0x5bf9e4){if(_0x5bf9e4&&_0x5bf9e4[_0x698c('0x69')]===0x0){return db[_0x698c('0x31')][_0x698c('0x58')]({'name':_0x12f515[_0x698c('0x3a')],'resourceId':_0x12f515['id'],'type':_0x5bf9e4['name'],'sectionId':_0x5bf9e4['id']},{})[_0x698c('0x18')](function(){return _0x200d5b;});}else{return _0x200d5b;}})[_0x698c('0x5c')](function(_0x372040){logger['error'](_0x698c('0x5d'),_0x372040);throw _0x372040;});}return _0x200d5b;})[_0x698c('0x18')](respondWithResult(_0x30cac7,0xc9))[_0x698c('0x5c')](handleError(_0x30cac7,null));};exports[_0x698c('0x2d')]=function(_0x3e2a15,_0x328bc6,_0x28e1d7){var _0x38efcc;return db['Trunk']['find']({'where':{'id':_0x3e2a15['params']['id']}})[_0x698c('0x18')](handleEntityNotFound(_0x328bc6,null))[_0x698c('0x18')](saveUpdates(_0x3e2a15[_0x698c('0x57')],null))[_0x698c('0x18')](function(_0x512b9a){if(_0x512b9a){_0x38efcc=_0x512b9a;return db['Trunk']['findAll']({'raw':!![]});}})[_0x698c('0x18')](function(_0x259d45){if(_0x259d45){var _0x5bc7c3=fs[_0x698c('0x5e')](path[_0x698c('0x5f')](config[_0x698c('0x60')],'server/files/templates/trunk.ejs'),'utf8');var _0x2ba167=fs[_0x698c('0x5e')](path[_0x698c('0x5f')](config[_0x698c('0x60')],_0x698c('0x6a')),_0x698c('0x62'));var _0x1ec0ba=ejs[_0x698c('0x63')](_0x5bc7c3,{'trunks':_0x259d45||[]});fs[_0x698c('0x64')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ec0ba);var _0x1cce58=ejs[_0x698c('0x63')](_0x2ba167,{'trunks':_0x259d45||[]});fs[_0x698c('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x1cce58);return respondWithRpcPromise(_0x698c('0x6b'),_0x698c('0x2d'),{'module':'chan_sip.so'});}return null;})[_0x698c('0x18')](function(_0x231889){if(_0x231889){return _0x38efcc;}})[_0x698c('0x18')](respondWithResult(_0x328bc6,null))[_0x698c('0x5c')](handleError(_0x328bc6,null));};exports[_0x698c('0x2e')]=function(_0x484441,_0x38b97e,_0x514401){var _0xbf2894;return db[_0x698c('0x4c')][_0x698c('0x53')]({'where':{'id':_0x484441[_0x698c('0x52')]['id']}})[_0x698c('0x18')](handleEntityNotFound(_0x38b97e,null))[_0x698c('0x18')](removeEntity(_0x38b97e,null))[_0x698c('0x18')](function(){return db[_0x698c('0x4c')][_0x698c('0x4f')]({'raw':!![]});})[_0x698c('0x18')](function(_0x2f8128){var _0x48fb03=fs[_0x698c('0x5e')](path[_0x698c('0x5f')](config[_0x698c('0x60')],_0x698c('0x61')),_0x698c('0x62'));var _0x235fa8=fs['readFileSync'](path[_0x698c('0x5f')](config['root'],_0x698c('0x6a')),_0x698c('0x62'));var _0x2aaaa8=ejs[_0x698c('0x63')](_0x48fb03,{'trunks':_0x2f8128});var _0x25392d=ejs[_0x698c('0x63')](_0x235fa8,{'trunks':_0x2f8128});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x2aaaa8);fs[_0x698c('0x64')](_0x698c('0x66'),_0x25392d);return respondWithRpcPromise('Reload',_0x698c('0x2e'),{'module':_0x698c('0x6c')});})[_0x698c('0x5c')](handleError(_0x38b97e,null));}; \ No newline at end of file +var _0x747f=['moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','set','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','Trunk','includeAll','include','findAll','rows','catch','show','params','options','find','clone','omit','createdAt','body','updatedAt','create','user','role','UserProfileSection','userProfileId','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3c0a3f,_0x585f21){var _0x518fa6=function(_0x220d65){while(--_0x220d65){_0x3c0a3f['push'](_0x3c0a3f['shift']());}};_0x518fa6(++_0x585f21);}(_0x747f,0x1b8));var _0xf747=function(_0x150db8,_0x21c705){_0x150db8=_0x150db8-0x0;var _0x5611cd=_0x747f[_0x150db8];return _0x5611cd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf747('0x0'));var rimraf=require(_0xf747('0x1'));var zipdir=require(_0xf747('0x2'));var jsonpatch=require(_0xf747('0x3'));var rp=require('request-promise');var moment=require(_0xf747('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf747('0x5'));var util=require(_0xf747('0x6'));var path=require(_0xf747('0x7'));var sox=require(_0xf747('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf747('0x9'));var _=require(_0xf747('0xa'));var squel=require(_0xf747('0xb'));var crypto=require(_0xf747('0xc'));var jsforce=require(_0xf747('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf747('0xe'));var querystring=require(_0xf747('0xf'));var Papa=require(_0xf747('0x10'));var Redis=require(_0xf747('0x11'));var authService=require(_0xf747('0x12'));var qs=require(_0xf747('0x13'));var as=require(_0xf747('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf747('0x15'))(_0xf747('0x16'));var utils=require('../../config/utils');var config=require(_0xf747('0x17'));var licenseUtil=require(_0xf747('0x18'));var db=require(_0xf747('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf747('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x556c7c,_0x398a28,_0x513276,_0x8f2120){return new BPromise(function(_0x4a2562,_0x3f59d4){var _0x5e961b=_0x8f2120||client;return _0x5e961b[_0xf747('0x1b')](_0x556c7c,_0x513276)[_0xf747('0x1c')](function(_0x2f255e){logger['info']('Trunk,\x20%s,\x20%s',_0x398a28,_0xf747('0x1d'));logger[_0xf747('0x1e')](_0xf747('0x1f'),_0x398a28,_0xf747('0x1d'),JSON[_0xf747('0x20')](_0x2f255e));if(_0x2f255e[_0xf747('0x21')]){if(_0x2f255e['error'][_0xf747('0x22')]===0x1f4){logger['error'](_0xf747('0x23'),_0x398a28,_0x2f255e[_0xf747('0x21')][_0xf747('0x24')]);return _0x3f59d4(_0x2f255e[_0xf747('0x21')]['message']);}logger[_0xf747('0x21')](_0xf747('0x23'),_0x398a28,_0x2f255e[_0xf747('0x21')][_0xf747('0x24')]);return _0x4a2562(_0x2f255e[_0xf747('0x21')][_0xf747('0x24')]);}else{logger['info'](_0xf747('0x23'),_0x398a28,_0xf747('0x1d'));_0x4a2562(_0x2f255e[_0xf747('0x25')][_0xf747('0x24')]);}})['catch'](function(_0x3d30c8){logger[_0xf747('0x21')](_0xf747('0x23'),_0x398a28,_0x3d30c8);_0x3f59d4(_0x3d30c8);});});}function respondWithStatusCode(_0x50cdc3,_0x340f33){_0x340f33=_0x340f33||0xcc;return function(_0x1dd581){if(_0x1dd581){return _0x50cdc3[_0xf747('0x26')](_0x340f33);}return _0x50cdc3[_0xf747('0x27')](_0x340f33)[_0xf747('0x28')]();};}function respondWithResult(_0x3950c8,_0x284fc9){_0x284fc9=_0x284fc9||0xc8;return function(_0x151761){if(_0x151761){return _0x3950c8['status'](_0x284fc9)[_0xf747('0x29')](_0x151761);}};}function respondWithFilteredResult(_0x110415,_0x52fbc8){return function(_0x2c2d8e){if(_0x2c2d8e){var _0x2bd647=_0x2c2d8e[_0xf747('0x2a')],_0x2eb6e8=_0x52fbc8[_0xf747('0x2b')],_0x54da00=_0x52fbc8[_0xf747('0x2b')]+_0x52fbc8['limit'],_0x2873c4;if(_0x54da00>=_0x2bd647){_0x54da00=_0x2bd647;_0x2873c4=0xc8;}else{_0x2873c4=0xce;}_0x110415[_0xf747('0x27')](_0x2873c4);return _0x110415[_0xf747('0x2c')]('Content-Range',_0x2eb6e8+'-'+_0x54da00+'/'+_0x2bd647)[_0xf747('0x29')](_0x2c2d8e);}return null;};}function patchUpdates(_0x54d619){return function(_0x283d15){try{jsonpatch['apply'](_0x283d15,_0x54d619,!![]);}catch(_0x18dfc6){return BPromise['reject'](_0x18dfc6);}return _0x283d15['save']();};}function saveUpdates(_0x43a8b8,_0x22b387){return function(_0x1fed38){if(_0x1fed38){return _0x1fed38[_0xf747('0x2d')](_0x43a8b8)['then'](function(_0x44dce2){return _0x44dce2;});}return null;};}function removeEntity(_0x4351b3,_0x22ba04){return function(_0x11e75e){if(_0x11e75e){return _0x11e75e[_0xf747('0x2e')]()[_0xf747('0x1c')](function(){var _0x11149d=_0x11e75e[_0xf747('0x2f')]({'plain':!![]});var _0x50e898=_0xf747('0x30');return db[_0xf747('0x31')][_0xf747('0x2e')]({'where':{'type':_0x50e898,'resourceId':_0x11149d['id']}})[_0xf747('0x1c')](function(){return _0x11e75e;});})[_0xf747('0x1c')](function(){_0x4351b3[_0xf747('0x27')](0xcc)[_0xf747('0x28')]();});}};}function handleEntityNotFound(_0x4e335b,_0x53e6fd){return function(_0x30a177){if(!_0x30a177){_0x4e335b[_0xf747('0x26')](0x194);}return _0x30a177;};}function handleError(_0x53562f,_0x33d530){_0x33d530=_0x33d530||0x1f4;return function(_0x271878){logger[_0xf747('0x21')](_0x271878[_0xf747('0x32')]);if(_0x271878[_0xf747('0x33')]){delete _0x271878[_0xf747('0x33')];}_0x53562f[_0xf747('0x27')](_0x33d530)['send'](_0x271878);};}exports[_0xf747('0x34')]=function(_0x62d1e1,_0x3b856a){var _0x35063c={},_0x22dc78={},_0x311a46={'count':0x0,'rows':[]};var _0x3d5c0e=_[_0xf747('0x35')](db['Trunk'][_0xf747('0x36')],function(_0xf10c61){return{'name':_0xf10c61[_0xf747('0x37')],'type':_0xf10c61[_0xf747('0x38')][_0xf747('0x39')]};});_0x22dc78[_0xf747('0x3a')]=_['map'](_0x3d5c0e,_0xf747('0x33'));_0x22dc78[_0xf747('0x3b')]=_[_0xf747('0x3c')](_0x62d1e1['query']);_0x22dc78[_0xf747('0x3d')]=_[_0xf747('0x3e')](_0x22dc78[_0xf747('0x3a')],_0x22dc78[_0xf747('0x3b')]);_0x35063c[_0xf747('0x3f')]=_[_0xf747('0x3e')](_0x22dc78[_0xf747('0x3a')],qs[_0xf747('0x40')](_0x62d1e1[_0xf747('0x3b')]['fields']));_0x35063c[_0xf747('0x3f')]=_0x35063c[_0xf747('0x3f')][_0xf747('0x41')]?_0x35063c['attributes']:_0x22dc78['model'];if(!_0x62d1e1[_0xf747('0x3b')][_0xf747('0x42')](_0xf747('0x43'))){_0x35063c[_0xf747('0x44')]=qs[_0xf747('0x44')](_0x62d1e1[_0xf747('0x3b')][_0xf747('0x44')]);_0x35063c[_0xf747('0x2b')]=qs['offset'](_0x62d1e1[_0xf747('0x3b')][_0xf747('0x2b')]);}_0x35063c[_0xf747('0x45')]=qs[_0xf747('0x46')](_0x62d1e1[_0xf747('0x3b')]['sort']);_0x35063c[_0xf747('0x47')]=qs[_0xf747('0x3d')](_[_0xf747('0x48')](_0x62d1e1[_0xf747('0x3b')],_0x22dc78[_0xf747('0x3d')]),_0x3d5c0e);if(_0x62d1e1[_0xf747('0x3b')][_0xf747('0x49')]){_0x35063c[_0xf747('0x47')]=_[_0xf747('0x4a')](_0x35063c[_0xf747('0x47')],{'$or':_[_0xf747('0x35')](_0x3d5c0e,function(_0x189d7e){if(_0x189d7e[_0xf747('0x38')]!=='VIRTUAL'){var _0x5af78e={};_0x5af78e[_0x189d7e[_0xf747('0x33')]]={'$like':'%'+_0x62d1e1[_0xf747('0x3b')][_0xf747('0x49')]+'%'};return _0x5af78e;}})});}_0x35063c=_[_0xf747('0x4a')]({},_0x35063c,_0x62d1e1['options']);var _0x469d1f={'where':_0x35063c[_0xf747('0x47')]};return db[_0xf747('0x4b')][_0xf747('0x2a')](_0x469d1f)[_0xf747('0x1c')](function(_0x3cff80){_0x311a46['count']=_0x3cff80;if(_0x62d1e1[_0xf747('0x3b')][_0xf747('0x4c')]){_0x35063c[_0xf747('0x4d')]=[{'all':!![]}];}return db[_0xf747('0x4b')][_0xf747('0x4e')](_0x35063c);})[_0xf747('0x1c')](function(_0x2f4898){_0x311a46[_0xf747('0x4f')]=_0x2f4898;return _0x311a46;})[_0xf747('0x1c')](respondWithFilteredResult(_0x3b856a,_0x35063c))[_0xf747('0x50')](handleError(_0x3b856a,null));};exports[_0xf747('0x51')]=function(_0x52e780,_0x3de719){var _0x3d969f={'raw':![],'where':{'id':_0x52e780[_0xf747('0x52')]['id']}},_0x3a635f={};_0x3a635f['model']=_[_0xf747('0x3c')](db[_0xf747('0x4b')]['rawAttributes']);_0x3a635f[_0xf747('0x3b')]=_['keys'](_0x52e780['query']);_0x3a635f[_0xf747('0x3d')]=_[_0xf747('0x3e')](_0x3a635f[_0xf747('0x3a')],_0x3a635f['query']);_0x3d969f[_0xf747('0x3f')]=_[_0xf747('0x3e')](_0x3a635f[_0xf747('0x3a')],qs[_0xf747('0x40')](_0x52e780[_0xf747('0x3b')]['fields']));_0x3d969f[_0xf747('0x3f')]=_0x3d969f['attributes'][_0xf747('0x41')]?_0x3d969f[_0xf747('0x3f')]:_0x3a635f[_0xf747('0x3a')];if(_0x52e780['query']['includeAll']){_0x3d969f[_0xf747('0x4d')]=[{'all':!![]}];}_0x3d969f=_[_0xf747('0x4a')]({},_0x3d969f,_0x52e780[_0xf747('0x53')]);return db[_0xf747('0x4b')][_0xf747('0x54')](_0x3d969f)[_0xf747('0x1c')](handleEntityNotFound(_0x3de719,null))[_0xf747('0x1c')](respondWithResult(_0x3de719,null))['catch'](handleError(_0x3de719,null));};exports[_0xf747('0x55')]=function(_0x529870,_0x113f53){var _0x3b59d9={'where':{'id':_0x529870['params']['id']}},_0x24d48b={};_0x24d48b['model']=_[_0xf747('0x3c')](db[_0xf747('0x4b')][_0xf747('0x36')]);_0x3b59d9['attributes']=_[_0xf747('0x3e')](_0x24d48b['model'],qs['fields'](_0x529870[_0xf747('0x3b')]['fields']));_0x3b59d9[_0xf747('0x3f')]=_0x3b59d9[_0xf747('0x3f')][_0xf747('0x41')]?_0x3b59d9[_0xf747('0x3f')]:_0x24d48b[_0xf747('0x3a')];if(_0x529870[_0xf747('0x3b')][_0xf747('0x4c')]){_0x3b59d9[_0xf747('0x4d')]=[{'all':!![]}];}_0x3b59d9=_[_0xf747('0x4a')]({},_0x3b59d9,_0x529870[_0xf747('0x53')]);return db[_0xf747('0x4b')][_0xf747('0x54')](_0x3b59d9)[_0xf747('0x1c')](handleEntityNotFound(_0x113f53,null))[_0xf747('0x1c')](function(_0x22bef4){if(_0x22bef4){var _0x902c90=_0x22bef4[_0xf747('0x2f')]({'plain':!![]});_0x902c90=qs[_0xf747('0x56')](_0x902c90,['id',_0xf747('0x57'),'updatedAt']);_0x529870[_0xf747('0x58')]=_[_0xf747('0x56')](_0x529870[_0xf747('0x58')],['id',_0xf747('0x57'),_0xf747('0x59')]);return db['Trunk'][_0xf747('0x5a')](_[_0xf747('0x4a')](_0x902c90,_0x529870[_0xf747('0x58')]),{'include':_0x529870[_0xf747('0x3b')][_0xf747('0x4c')]?[{'all':!![]}]:undefined})[_0xf747('0x1c')](function(_0x4e786f){var _0x1d52f1=_0x529870[_0xf747('0x5b')][_0xf747('0x2f')]({'plain':!![]});if(!_0x1d52f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d52f1[_0xf747('0x5c')]==='user'){var _0x5b131d=_0x4e786f['get']({'plain':!![]});var _0x4bc0f8=_0xf747('0x30');return db[_0xf747('0x5d')][_0xf747('0x54')]({'where':{'name':_0x4bc0f8,'userProfileId':_0x1d52f1[_0xf747('0x5e')]},'raw':!![]})[_0xf747('0x1c')](function(_0x514cea){if(_0x514cea&&_0x514cea['autoAssociation']===0x0){return db[_0xf747('0x31')][_0xf747('0x5a')]({'name':_0x5b131d['name'],'resourceId':_0x5b131d['id'],'type':_0x514cea[_0xf747('0x33')],'sectionId':_0x514cea['id']},{})['then'](function(){return _0x4e786f;});}else{return _0x4e786f;}})[_0xf747('0x50')](function(_0x4ba66b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ba66b);throw _0x4ba66b;});}return _0x4e786f;});}})[_0xf747('0x1c')](respondWithResult(_0x113f53,0xc9))[_0xf747('0x50')](handleError(_0x113f53,null));};exports[_0xf747('0x5a')]=function(_0x1e60fb,_0x471e7e,_0x30157b){var _0x239b89;return db[_0xf747('0x4b')][_0xf747('0x5a')](_0x1e60fb['body'],{'raw':!![]})[_0xf747('0x1c')](function(_0x3d6692){_0x239b89=_0x3d6692;return db[_0xf747('0x4b')][_0xf747('0x4e')]({'raw':!![]});})[_0xf747('0x1c')](function(_0x20cc34){var _0x476c21=fs['readFileSync'](path[_0xf747('0x5f')](config[_0xf747('0x60')],_0xf747('0x61')),_0xf747('0x62'));var _0x11eda6=fs[_0xf747('0x63')](path['join'](config[_0xf747('0x60')],_0xf747('0x64')),_0xf747('0x62'));var _0xebbdd1=ejs[_0xf747('0x65')](_0x476c21,{'trunks':_0x20cc34||[]});fs['writeFileSync'](_0xf747('0x66'),_0xebbdd1);if(_0x239b89[_0xf747('0x67')]){var _0x43c0cd=ejs['render'](_0x11eda6,{'trunks':_0x20cc34||[]});fs[_0xf747('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x43c0cd);}})[_0xf747('0x1c')](function(){return respondWithRpcPromise(_0xf747('0x69'),_0xf747('0x5a'),{'module':_0xf747('0x6a')});})['then'](function(){var _0x3ba846=_0x1e60fb[_0xf747('0x5b')][_0xf747('0x2f')]({'plain':!![]});if(!_0x3ba846)throw new Error(_0xf747('0x6b'));if(_0x3ba846[_0xf747('0x5c')]===_0xf747('0x5b')){var _0x5532dc=_0x239b89['get']({'plain':!![]});return db[_0xf747('0x5d')][_0xf747('0x54')]({'where':{'name':_0xf747('0x30'),'userProfileId':_0x3ba846[_0xf747('0x5e')]},'raw':!![]})[_0xf747('0x1c')](function(_0x554575){if(_0x554575&&_0x554575[_0xf747('0x6c')]===0x0){return db[_0xf747('0x31')][_0xf747('0x5a')]({'name':_0x5532dc[_0xf747('0x33')],'resourceId':_0x5532dc['id'],'type':_0x554575[_0xf747('0x33')],'sectionId':_0x554575['id']},{})[_0xf747('0x1c')](function(){return _0x239b89;});}else{return _0x239b89;}})[_0xf747('0x50')](function(_0x551a57){logger[_0xf747('0x21')](_0xf747('0x6d'),_0x551a57);throw _0x551a57;});}return _0x239b89;})[_0xf747('0x1c')](respondWithResult(_0x471e7e,0xc9))[_0xf747('0x50')](handleError(_0x471e7e,null));};exports[_0xf747('0x2d')]=function(_0x392040,_0x11deca,_0x339bfc){var _0x101646;return db[_0xf747('0x4b')][_0xf747('0x54')]({'where':{'id':_0x392040[_0xf747('0x52')]['id']}})['then'](handleEntityNotFound(_0x11deca,null))[_0xf747('0x1c')](saveUpdates(_0x392040['body'],null))['then'](function(_0xf461d5){if(_0xf461d5){_0x101646=_0xf461d5;return db[_0xf747('0x4b')][_0xf747('0x4e')]({'raw':!![]});}})['then'](function(_0x54b608){if(_0x54b608){var _0x459124=fs[_0xf747('0x63')](path[_0xf747('0x5f')](config[_0xf747('0x60')],_0xf747('0x61')),_0xf747('0x62'));var _0x2202dc=fs[_0xf747('0x63')](path[_0xf747('0x5f')](config[_0xf747('0x60')],_0xf747('0x64')),_0xf747('0x62'));var _0x721ba3=ejs[_0xf747('0x65')](_0x459124,{'trunks':_0x54b608||[]});fs[_0xf747('0x68')](_0xf747('0x66'),_0x721ba3);var _0x7c1bf4=ejs[_0xf747('0x65')](_0x2202dc,{'trunks':_0x54b608||[]});fs[_0xf747('0x68')](_0xf747('0x6e'),_0x7c1bf4);return respondWithRpcPromise('Reload',_0xf747('0x2d'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x21fce8){if(_0x21fce8){return _0x101646;}})[_0xf747('0x1c')](respondWithResult(_0x11deca,null))[_0xf747('0x50')](handleError(_0x11deca,null));};exports[_0xf747('0x2e')]=function(_0x370cd1,_0x1f70e5,_0x8b4494){var _0x5de6ff;return db[_0xf747('0x4b')][_0xf747('0x54')]({'where':{'id':_0x370cd1[_0xf747('0x52')]['id']}})['then'](handleEntityNotFound(_0x1f70e5,null))[_0xf747('0x1c')](removeEntity(_0x1f70e5,null))[_0xf747('0x1c')](function(){return db[_0xf747('0x4b')][_0xf747('0x4e')]({'raw':!![]});})['then'](function(_0x30121d){var _0x37a23e=fs[_0xf747('0x63')](path[_0xf747('0x5f')](config[_0xf747('0x60')],_0xf747('0x61')),_0xf747('0x62'));var _0x2eb3cb=fs[_0xf747('0x63')](path[_0xf747('0x5f')](config[_0xf747('0x60')],'server/files/templates/registry.ejs'),'utf8');var _0x4a834b=ejs['render'](_0x37a23e,{'trunks':_0x30121d});var _0xd7aae8=ejs[_0xf747('0x65')](_0x2eb3cb,{'trunks':_0x30121d});fs[_0xf747('0x68')](_0xf747('0x66'),_0x4a834b);fs[_0xf747('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0xd7aae8);return respondWithRpcPromise(_0xf747('0x69'),_0xf747('0x2e'),{'module':_0xf747('0x6a')});})['catch'](handleError(_0x1f70e5,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 4eb01f8..111e0cb 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 _0xfec6=['moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','api'];(function(_0x4501c5,_0x49524d){var _0x3d8e45=function(_0x3290da){while(--_0x3290da){_0x4501c5['push'](_0x4501c5['shift']());}};_0x3d8e45(++_0x49524d);}(_0xfec6,0x99));var _0x6fec=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xfec6[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x6fec('0x0'));var util=require(_0x6fec('0x1'));var logger=require('../../config/logger')(_0x6fec('0x2'));var moment=require(_0x6fec('0x3'));var BPromise=require('bluebird');var rp=require(_0x6fec('0x4'));var fs=require('fs');var path=require(_0x6fec('0x5'));var rimraf=require(_0x6fec('0x6'));var config=require(_0x6fec('0x7'));var attributes=require(_0x6fec('0x8'));module[_0x6fec('0x9')]=function(_0x5abb01,_0x4bbe3d){return _0x5abb01[_0x6fec('0xa')](_0x6fec('0xb'),attributes,{'tableName':_0x6fec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f44=['path','rimraf','../../config/environment','define','Trunk','util','api','moment','bluebird','request-promise'];(function(_0x54b4a8,_0x3abef0){var _0x4c7a5f=function(_0x50e054){while(--_0x50e054){_0x54b4a8['push'](_0x54b4a8['shift']());}};_0x4c7a5f(++_0x3abef0);}(_0x5f44,0x1a9));var _0x45f4=function(_0x534f1d,_0x3956e9){_0x534f1d=_0x534f1d-0x0;var _0x311abd=_0x5f44[_0x534f1d];return _0x311abd;};'use strict';var _=require('lodash');var util=require(_0x45f4('0x0'));var logger=require('../../config/logger')(_0x45f4('0x1'));var moment=require(_0x45f4('0x2'));var BPromise=require(_0x45f4('0x3'));var rp=require(_0x45f4('0x4'));var fs=require('fs');var path=require(_0x45f4('0x5'));var rimraf=require(_0x45f4('0x6'));var config=require(_0x45f4('0x7'));var attributes=require('./trunk.attributes');module['exports']=function(_0x5493f0,_0x1c7348){return _0x5493f0[_0x45f4('0x8')](_0x45f4('0x9'),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 02ea0c6..ed97f9d 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 _0x1a85=['info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','options','raw','where','limit','include','model','map','attributes','then','ShowTrunk','find','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x1a85,0x178));var _0x51a8=function(_0x3e9155,_0x38e9d2){_0x3e9155=_0x3e9155-0x0;var _0x5de67a=_0x1a85[_0x3e9155];return _0x5de67a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Trunk,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['findAll']({'raw':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x16')]===undefined?!![]:![]:!![],'where':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x17')]||null:null,'attributes':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')]['attributes']||null:null,'limit':_0x45a433[_0x51a8('0x15')]?_0x45a433['options'][_0x51a8('0x18')]||null:null,'include':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x19')]?_['map'](_0x45a433[_0x51a8('0x15')]['include'],function(_0x47f063){return{'model':db[_0x47f063[_0x51a8('0x1a')]],'as':_0x47f063['as'],'attributes':_0x47f063['attributes'],'include':_0x47f063[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x47f063[_0x51a8('0x19')],function(_0x18e2f3){return{'model':db[_0x18e2f3[_0x51a8('0x1a')]],'as':_0x18e2f3['as'],'attributes':_0x18e2f3[_0x51a8('0x1c')],'include':_0x18e2f3[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x18e2f3['include'],function(_0x273ce2){return{'model':db[_0x273ce2[_0x51a8('0x1a')]],'as':_0x273ce2['as'],'attributes':_0x273ce2[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x1c150d){logger[_0x51a8('0x8')](_0x51a8('0x13'),_0x45a433);logger[_0x51a8('0xb')](_0x51a8('0x13'),_0x45a433,JSON[_0x51a8('0xd')](_0x1c150d));_0x23539e(_0x1c150d);})[_0x51a8('0x12')](function(_0x347a02){logger['error'](_0x51a8('0x13'),_0x347a02['message'],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x347a02[_0x51a8('0x10')]));});});};exports[_0x51a8('0x1e')]=function(_0x41df56){var _0x2136b4=this;return new Promise(function(_0x4ea271,_0x10c19b){return db['Trunk'][_0x51a8('0x1f')]({'raw':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x17')]||null:null,'attributes':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')][_0x51a8('0x1c')]||null:null,'include':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x19')]?_['map'](_0x41df56[_0x51a8('0x15')][_0x51a8('0x19')],function(_0x41561a){return{'model':db[_0x41561a['model']],'as':_0x41561a['as'],'attributes':_0x41561a[_0x51a8('0x1c')],'include':_0x41561a[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x41561a[_0x51a8('0x19')],function(_0x41c020){return{'model':db[_0x41c020['model']],'as':_0x41c020['as'],'attributes':_0x41c020['attributes'],'include':_0x41c020['include']?_[_0x51a8('0x1b')](_0x41c020[_0x51a8('0x19')],function(_0x4ec1db){return{'model':db[_0x4ec1db[_0x51a8('0x1a')]],'as':_0x4ec1db['as'],'attributes':_0x4ec1db['attributes']};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x38aa25){logger[_0x51a8('0x8')](_0x51a8('0x1e'),_0x41df56);logger[_0x51a8('0xb')](_0x51a8('0x1e'),_0x41df56,JSON['stringify'](_0x38aa25));_0x4ea271(_0x38aa25);})['catch'](function(_0x377b4c){logger['error']('ShowTrunk',_0x377b4c['message'],_0x41df56);_0x10c19b(_0x2136b4[_0x51a8('0xe')](0x1f4,_0x377b4c[_0x51a8('0x10')]));});});}; \ No newline at end of file +var _0x2032=['error','code','message','info','result','catch','GetTrunk','Trunk','options','raw','where','map','model','attributes','include','stringify','ShowTrunk','find','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x483d76,_0x2c0f05){var _0x2dbecd=function(_0x4ab398){while(--_0x4ab398){_0x483d76['push'](_0x483d76['shift']());}};_0x2dbecd(++_0x2c0f05);}(_0x2032,0xd9));var _0x2203=function(_0x4453b0,_0x5a8160){_0x4453b0=_0x4453b0-0x0;var _0x3f7d98=_0x2032[_0x4453b0];return _0x3f7d98;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['findAll']({'raw':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x18')]||null:null,'attributes':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['attributes']||null:null,'limit':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['limit']||null:null,'include':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')]['include']?_[_0x2203('0x19')](_0x4893ff['options']['include'],function(_0x226374){return{'model':db[_0x226374[_0x2203('0x1a')]],'as':_0x226374['as'],'attributes':_0x226374[_0x2203('0x1b')],'include':_0x226374[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x226374[_0x2203('0x1c')],function(_0x49c12){return{'model':db[_0x49c12[_0x2203('0x1a')]],'as':_0x49c12['as'],'attributes':_0x49c12['attributes'],'include':_0x49c12[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x49c12[_0x2203('0x1c')],function(_0x5f11bf){return{'model':db[_0x5f11bf[_0x2203('0x1a')]],'as':_0x5f11bf['as'],'attributes':_0x5f11bf[_0x2203('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd6e109){logger[_0x2203('0x11')](_0x2203('0x14'),_0x4893ff);logger[_0x2203('0xd')](_0x2203('0x14'),_0x4893ff,JSON[_0x2203('0x1d')](_0xd6e109));_0x8906e1(_0xd6e109);})[_0x2203('0x13')](function(_0x5a95c1){logger[_0x2203('0xe')](_0x2203('0x14'),_0x5a95c1[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6[_0x2203('0xe')](0x1f4,_0x5a95c1['message']));});});};exports[_0x2203('0x1e')]=function(_0x21ff0d){var _0x287c95=this;return new Promise(function(_0xf59954,_0x520602){return db[_0x2203('0x15')][_0x2203('0x1f')]({'raw':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x18')]||null:null,'attributes':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d[_0x2203('0x16')][_0x2203('0x1b')]||null:null,'include':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d['options'][_0x2203('0x1c')]?_[_0x2203('0x19')](_0x21ff0d['options'][_0x2203('0x1c')],function(_0x20fbe1){return{'model':db[_0x20fbe1[_0x2203('0x1a')]],'as':_0x20fbe1['as'],'attributes':_0x20fbe1[_0x2203('0x1b')],'include':_0x20fbe1[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x20fbe1[_0x2203('0x1c')],function(_0x44228e){return{'model':db[_0x44228e[_0x2203('0x1a')]],'as':_0x44228e['as'],'attributes':_0x44228e['attributes'],'include':_0x44228e[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x44228e['include'],function(_0x54b90b){return{'model':db[_0x54b90b[_0x2203('0x1a')]],'as':_0x54b90b['as'],'attributes':_0x54b90b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2203('0x20')](function(_0x3b1eeb){logger[_0x2203('0x11')]('ShowTrunk',_0x21ff0d);logger['debug'](_0x2203('0x1e'),_0x21ff0d,JSON['stringify'](_0x3b1eeb));_0xf59954(_0x3b1eeb);})[_0x2203('0x13')](function(_0x5cfe5e){logger[_0x2203('0xe')]('ShowTrunk',_0x5cfe5e[_0x2203('0x10')],_0x21ff0d);_0x520602(_0x287c95[_0x2203('0xe')](0x1f4,_0x5cfe5e[_0x2203('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 440dce5..079e9d0 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 _0x2036=['/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/fax_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSquareProjects','createApiKey','update','put','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/contacts','getContacts','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x2036,0x11e));var _0x6203=function(_0x7a0eb6,_0x81f990){_0x7a0eb6=_0x7a0eb6-0x0;var _0x2a720a=_0x2036[_0x7a0eb6];return _0x2a720a;};'use strict';var multer=require(_0x6203('0x0'));var util=require('util');var path=require(_0x6203('0x1'));var timeout=require(_0x6203('0x2'));var express=require(_0x6203('0x3'));var router=express[_0x6203('0x4')]();var fs_extra=require(_0x6203('0x5'));var auth=require(_0x6203('0x6'));var interaction=require(_0x6203('0x7'));var config=require(_0x6203('0x8'));var controller=require(_0x6203('0x9'));router[_0x6203('0xa')]('/',auth[_0x6203('0xb')](),controller[_0x6203('0xc')]);router[_0x6203('0xa')]('/describe',auth[_0x6203('0xb')](),controller[_0x6203('0xd')]);router[_0x6203('0xa')](_0x6203('0xe'),auth[_0x6203('0xb')](),controller[_0x6203('0xf')]);router[_0x6203('0xa')](_0x6203('0x10'),auth['isAuthenticated'](),controller[_0x6203('0x11')]);router[_0x6203('0xa')](_0x6203('0x12'),auth['isAuthenticated'](),controller['show']);router['get'](_0x6203('0x13'),controller[_0x6203('0x14')]);router[_0x6203('0xa')](_0x6203('0x15'),auth['isAuthenticated'](),controller[_0x6203('0x16')]);router[_0x6203('0xa')]('/:id/queues',auth[_0x6203('0xb')](),controller['getQueues']);router[_0x6203('0xa')]('/:id/queues_rt',auth[_0x6203('0xb')](),controller[_0x6203('0x17')]);router[_0x6203('0xa')](_0x6203('0x18'),auth['isAuthenticated'](),controller['getGroups']);router[_0x6203('0xa')](_0x6203('0x19'),auth[_0x6203('0xb')](),controller[_0x6203('0x1a')]);router[_0x6203('0xa')](_0x6203('0x1b'),auth[_0x6203('0xb')](),controller[_0x6203('0x1c')]);router[_0x6203('0xa')](_0x6203('0x1d'),auth[_0x6203('0xb')](),controller[_0x6203('0x1e')]);router['get']('/:id/openchannel/interactions',auth[_0x6203('0xb')](),controller[_0x6203('0x1f')]);router[_0x6203('0xa')](_0x6203('0x20'),auth[_0x6203('0xb')](),controller[_0x6203('0x21')]);router[_0x6203('0xa')](_0x6203('0x22'),auth[_0x6203('0xb')](),controller[_0x6203('0x23')]);router[_0x6203('0xa')](_0x6203('0x24'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0x6203('0xa')](_0x6203('0x25'),auth['isAuthenticated'](),controller[_0x6203('0x26')]);router[_0x6203('0xa')](_0x6203('0x27'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x6203('0x28'),auth[_0x6203('0xb')](),controller[_0x6203('0x29')]);router[_0x6203('0xa')](_0x6203('0x2a'),auth['isAuthenticated'](),controller[_0x6203('0x2b')]);router[_0x6203('0xa')](_0x6203('0x2c'),auth[_0x6203('0xb')](),controller[_0x6203('0x2d')]);router['get'](_0x6203('0x2e'),auth['isAuthenticated'](),controller[_0x6203('0x2f')]);router[_0x6203('0xa')](_0x6203('0x30'),auth['isAuthenticated'](),controller[_0x6203('0x31')]);router[_0x6203('0xa')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0x6203('0xa')](_0x6203('0x32'),auth[_0x6203('0xb')](),controller[_0x6203('0x33')]);router[_0x6203('0xa')](_0x6203('0x34'),auth[_0x6203('0xb')](),controller[_0x6203('0x35')]);router[_0x6203('0xa')](_0x6203('0x36'),auth[_0x6203('0xb')](),controller[_0x6203('0x37')]);router[_0x6203('0xa')](_0x6203('0x38'),auth[_0x6203('0xb')](),controller[_0x6203('0x39')]);router[_0x6203('0xa')]('/:id/scheduled_calls',auth[_0x6203('0xb')](),controller[_0x6203('0x3a')]);router[_0x6203('0xa')](_0x6203('0x3b'),auth[_0x6203('0xb')](),controller['getApiKey']);router[_0x6203('0x3c')]('/:id/contacts',auth[_0x6203('0xb')](),controller[_0x6203('0x3d')]);router['post']('/',auth[_0x6203('0xb')](),controller[_0x6203('0x3e')]);router['post']('/create_many',auth[_0x6203('0xb')](),controller[_0x6203('0x3f')]);router[_0x6203('0x3c')]('/:id/queues',auth[_0x6203('0xb')](),controller[_0x6203('0x40')]);var upload=multer({'storage':multer[_0x6203('0x41')]({'destination':function(_0x28d05b,_0x40a19e,_0x392b8d){_0x392b8d(null,path[_0x6203('0x42')](config[_0x6203('0x43')],_0x6203('0x44')));},'filename':function(_0x59dc9f,_0x4c99c1,_0xa86a38){_0xa86a38(null,util[_0x6203('0x45')](_0x6203('0x46'),Date[_0x6203('0x47')](),_0x4c99c1[_0x6203('0x48')]));}})});router['post']('/:id/avatar',upload[_0x6203('0x49')](_0x6203('0x4a')),controller['addAvatar']);router[_0x6203('0x3c')](_0x6203('0x4b'),auth[_0x6203('0xb')](),controller[_0x6203('0x4c')]);router['post'](_0x6203('0x4d'),auth[_0x6203('0xb')](),controller[_0x6203('0x4e')]);router[_0x6203('0x3c')](_0x6203('0x4f'),auth[_0x6203('0xb')](),controller[_0x6203('0x50')]);router['post'](_0x6203('0x51'),auth[_0x6203('0xb')](),controller[_0x6203('0x52')]);router[_0x6203('0x3c')](_0x6203('0x27'),auth[_0x6203('0xb')](),controller['addTeams']);router[_0x6203('0x3c')](_0x6203('0x53'),auth[_0x6203('0xb')](),controller[_0x6203('0x54')]);router[_0x6203('0x3c')]('/:id/mail_interactions',auth[_0x6203('0xb')](),controller['addMailInteractions']);router[_0x6203('0x3c')](_0x6203('0x55'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x6203('0x3c')]('/:id/sms_interactions',auth[_0x6203('0xb')](),controller[_0x6203('0x56')]);router[_0x6203('0x3c')](_0x6203('0x57'),auth[_0x6203('0xb')](),controller['addOpenchannelInteractions']);router[_0x6203('0x3c')](_0x6203('0x58'),auth['isAuthenticated'](),controller[_0x6203('0x59')]);router[_0x6203('0x3c')](_0x6203('0x2e'),auth[_0x6203('0xb')](),controller[_0x6203('0x5a')]);router[_0x6203('0x3c')](_0x6203('0x30'),auth[_0x6203('0xb')](),controller['addMailAccounts']);router[_0x6203('0x3c')]('/:id/openchannel_accounts',auth[_0x6203('0xb')](),controller[_0x6203('0x5b')]);router[_0x6203('0x3c')](_0x6203('0x32'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x6203('0x3c')](_0x6203('0x34'),auth[_0x6203('0xb')](),controller['addChatWebsites']);router[_0x6203('0x3c')](_0x6203('0x36'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x6203('0x3c')](_0x6203('0x38'),auth[_0x6203('0xb')](),controller[_0x6203('0x5c')]);router[_0x6203('0x3c')]('/:id/api_key',auth[_0x6203('0xb')](),controller[_0x6203('0x5d')]);router['put']('/:id',auth[_0x6203('0xb')](),controller[_0x6203('0x5e')]);router[_0x6203('0x5f')](_0x6203('0x60'),auth[_0x6203('0xb')](),controller['changePassword']);router[_0x6203('0x61')]('/:id/queues',auth[_0x6203('0xb')](),controller[_0x6203('0x62')]);router[_0x6203('0x61')]('/:id/teams',auth[_0x6203('0xb')](),controller[_0x6203('0x63')]);router[_0x6203('0x61')](_0x6203('0x12'),auth[_0x6203('0xb')](),controller[_0x6203('0x64')]);router[_0x6203('0x61')](_0x6203('0x53'),auth['isAuthenticated'](),controller[_0x6203('0x65')]);router['delete']('/:id/mail_interactions',auth[_0x6203('0xb')](),controller[_0x6203('0x66')]);router[_0x6203('0x61')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x6203('0x67')]);router[_0x6203('0x61')](_0x6203('0x68'),auth[_0x6203('0xb')](),controller['removeSmsInteractions']);router[_0x6203('0x61')]('/:id/openchannel_interactions',auth[_0x6203('0xb')](),controller['removeOpenchannelInteractions']);router[_0x6203('0x61')]('/:id/whatsapp_interactions',auth[_0x6203('0xb')](),controller[_0x6203('0x69')]);router[_0x6203('0x61')](_0x6203('0x2e'),auth['isAuthenticated'](),controller[_0x6203('0x6a')]);router['delete'](_0x6203('0x30'),auth[_0x6203('0xb')](),controller[_0x6203('0x6b')]);router[_0x6203('0x61')]('/:id/openchannel_accounts',auth[_0x6203('0xb')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x6203('0x6c')]);router[_0x6203('0x61')](_0x6203('0x34'),auth[_0x6203('0xb')](),controller[_0x6203('0x6d')]);router[_0x6203('0x61')]('/:id/whatsapp_accounts',auth[_0x6203('0xb')](),controller[_0x6203('0x6e')]);router['delete'](_0x6203('0x38'),auth['isAuthenticated'](),controller[_0x6203('0x6f')]);router['delete']('/:id/api_key',auth[_0x6203('0xb')](),controller[_0x6203('0x70')]);module[_0x6203('0x71')]=router; \ No newline at end of file +var _0x7bb8=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./user.controller','isAuthenticated','index','describe','get','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/api_key','getApiKey','post','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeWhatsappInteractions','removeMailAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports'];(function(_0x467cca,_0x18f429){var _0x3bd0b5=function(_0x509c6d){while(--_0x509c6d){_0x467cca['push'](_0x467cca['shift']());}};_0x3bd0b5(++_0x18f429);}(_0x7bb8,0xe8));var _0x87bb=function(_0x254150,_0x3eaf50){_0x254150=_0x254150-0x0;var _0x517a9d=_0x7bb8[_0x254150];return _0x517a9d;};'use strict';var multer=require('multer');var util=require(_0x87bb('0x0'));var path=require(_0x87bb('0x1'));var timeout=require(_0x87bb('0x2'));var express=require(_0x87bb('0x3'));var router=express['Router']();var fs_extra=require(_0x87bb('0x4'));var auth=require(_0x87bb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x87bb('0x6'));var controller=require(_0x87bb('0x7'));router['get']('/',auth[_0x87bb('0x8')](),controller[_0x87bb('0x9')]);router['get']('/describe',auth[_0x87bb('0x8')](),controller[_0x87bb('0xa')]);router[_0x87bb('0xb')]('/whoami',auth[_0x87bb('0x8')](),controller[_0x87bb('0xc')]);router[_0x87bb('0xb')](_0x87bb('0xd'),auth[_0x87bb('0x8')](),controller[_0x87bb('0xe')]);router[_0x87bb('0xb')](_0x87bb('0xf'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x10')]);router[_0x87bb('0xb')](_0x87bb('0x11'),controller['getAvatar']);router[_0x87bb('0xb')](_0x87bb('0x12'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x13')]);router[_0x87bb('0xb')](_0x87bb('0x14'),auth['isAuthenticated'](),controller[_0x87bb('0x15')]);router[_0x87bb('0xb')](_0x87bb('0x16'),auth[_0x87bb('0x8')](),controller['getVoiceQueuesRt']);router[_0x87bb('0xb')]('/:id/groups',auth['isAuthenticated'](),controller['getGroups']);router['get'](_0x87bb('0x17'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x18')]);router['get'](_0x87bb('0x19'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x1a')]);router[_0x87bb('0xb')](_0x87bb('0x1b'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x1c')]);router[_0x87bb('0xb')](_0x87bb('0x1d'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x1e')]);router[_0x87bb('0xb')](_0x87bb('0x1f'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x20')]);router[_0x87bb('0xb')](_0x87bb('0x21'),auth['isAuthenticated'](),controller[_0x87bb('0x22')]);router[_0x87bb('0xb')]('/:id/fax/interactions',auth[_0x87bb('0x8')](),controller[_0x87bb('0x23')]);router[_0x87bb('0xb')](_0x87bb('0x24'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x25')]);router[_0x87bb('0xb')]('/:id/teams',auth[_0x87bb('0x8')](),controller['getTeams']);router[_0x87bb('0xb')](_0x87bb('0x26'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x27')]);router[_0x87bb('0xb')](_0x87bb('0x28'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x29')]);router[_0x87bb('0xb')](_0x87bb('0x2a'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x2b')]);router[_0x87bb('0xb')](_0x87bb('0x2c'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x2d')]);router['get'](_0x87bb('0x2e'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x2f')]);router['get'](_0x87bb('0x30'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x31')]);router[_0x87bb('0xb')](_0x87bb('0x32'),auth['isAuthenticated'](),controller[_0x87bb('0x33')]);router[_0x87bb('0xb')](_0x87bb('0x34'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x35')]);router[_0x87bb('0xb')](_0x87bb('0x36'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x37')]);router[_0x87bb('0xb')](_0x87bb('0x38'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x39')]);router['get']('/:id/scheduled_calls',auth[_0x87bb('0x8')](),controller['getScheduledCalls']);router['get'](_0x87bb('0x3a'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x3b')]);router[_0x87bb('0x3c')](_0x87bb('0x12'),auth[_0x87bb('0x8')](),controller['addContacts']);router[_0x87bb('0x3c')]('/',auth[_0x87bb('0x8')](),controller[_0x87bb('0x3d')]);router['post']('/create_many',auth['isAuthenticated'](),controller[_0x87bb('0x3e')]);router[_0x87bb('0x3c')](_0x87bb('0x14'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x3f')]);var upload=multer({'storage':multer[_0x87bb('0x40')]({'destination':function(_0x59314f,_0x354d4b,_0x39cef4){_0x39cef4(null,path[_0x87bb('0x41')](config[_0x87bb('0x42')],_0x87bb('0x43')));},'filename':function(_0x6b61ac,_0x5bb4b0,_0x3c17d7){_0x3c17d7(null,util[_0x87bb('0x44')](_0x87bb('0x45'),Date[_0x87bb('0x46')](),_0x5bb4b0[_0x87bb('0x47')]));}})});router['post'](_0x87bb('0x11'),upload[_0x87bb('0x48')](_0x87bb('0x49')),controller[_0x87bb('0x4a')]);router[_0x87bb('0x3c')](_0x87bb('0x4b'),auth['isAuthenticated'](),controller['login']);router[_0x87bb('0x3c')](_0x87bb('0x4c'),auth['isAuthenticated'](),controller[_0x87bb('0x4d')]);router['post'](_0x87bb('0x4e'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x4f')]);router['post'](_0x87bb('0x50'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x51')]);router['post'](_0x87bb('0x52'),auth[_0x87bb('0x8')](),controller['addTeams']);router[_0x87bb('0x3c')](_0x87bb('0x53'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x54')]);router[_0x87bb('0x3c')]('/:id/mail_interactions',auth[_0x87bb('0x8')](),controller['addMailInteractions']);router['post'](_0x87bb('0x55'),auth['isAuthenticated'](),controller[_0x87bb('0x56')]);router[_0x87bb('0x3c')](_0x87bb('0x57'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x58')]);router['post'](_0x87bb('0x59'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x5a')]);router[_0x87bb('0x3c')](_0x87bb('0x5b'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x5c')]);router[_0x87bb('0x3c')](_0x87bb('0x2c'),auth[_0x87bb('0x8')](),controller['addFaxAccounts']);router[_0x87bb('0x3c')](_0x87bb('0x2e'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x5d')]);router[_0x87bb('0x3c')](_0x87bb('0x30'),auth['isAuthenticated'](),controller[_0x87bb('0x5e')]);router['post']('/:id/sms_accounts',auth[_0x87bb('0x8')](),controller[_0x87bb('0x5f')]);router[_0x87bb('0x3c')](_0x87bb('0x34'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x60')]);router[_0x87bb('0x3c')](_0x87bb('0x36'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x61')]);router['post'](_0x87bb('0x38'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x62')]);router[_0x87bb('0x3c')](_0x87bb('0x3a'),auth['isAuthenticated'](),controller['createApiKey']);router[_0x87bb('0x63')]('/:id',auth[_0x87bb('0x8')](),controller[_0x87bb('0x64')]);router[_0x87bb('0x63')](_0x87bb('0x65'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x66')]);router['delete'](_0x87bb('0x14'),auth['isAuthenticated'](),controller[_0x87bb('0x67')]);router[_0x87bb('0x68')](_0x87bb('0x52'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x69')]);router[_0x87bb('0x68')](_0x87bb('0xf'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x6a')]);router[_0x87bb('0x68')]('/:id/chat_interactions',auth[_0x87bb('0x8')](),controller['removeChatInteractions']);router[_0x87bb('0x68')](_0x87bb('0x6b'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x6c')]);router[_0x87bb('0x68')](_0x87bb('0x55'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x6d')]);router[_0x87bb('0x68')](_0x87bb('0x57'),auth[_0x87bb('0x8')](),controller['removeSmsInteractions']);router[_0x87bb('0x68')](_0x87bb('0x59'),auth[_0x87bb('0x8')](),controller['removeOpenchannelInteractions']);router[_0x87bb('0x68')](_0x87bb('0x5b'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x6e')]);router[_0x87bb('0x68')](_0x87bb('0x2c'),auth[_0x87bb('0x8')](),controller['removeFaxAccounts']);router[_0x87bb('0x68')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x87bb('0x6f')]);router[_0x87bb('0x68')](_0x87bb('0x30'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x87bb('0x68')](_0x87bb('0x32'),auth[_0x87bb('0x8')](),controller['removeSmsAccounts']);router[_0x87bb('0x68')](_0x87bb('0x34'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x87bb('0x68')](_0x87bb('0x36'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x70')]);router[_0x87bb('0x68')]('/:id/square_projects',auth[_0x87bb('0x8')](),controller[_0x87bb('0x71')]);router[_0x87bb('0x68')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x87bb('0x72')]);module[_0x87bb('0x73')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 44e0092..b4d43c9 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 _0x998f=['PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','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','never','\x22\x22\x20<>','originate','uac','uas','active','passive','actpass','update','update,nonat','showWebBar','get','wss','udp','avpf','force_avp','icesupport','dtlsenable','dtlscertfile','encryption','dtlssetup','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','rtcp_mux','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','internal','email','ENUM','admin','telephone','local','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED'];(function(_0x1315f0,_0x25a87b){var _0x457bb2=function(_0x3ed927){while(--_0x3ed927){_0x1315f0['push'](_0x1315f0['shift']());}};_0x457bb2(++_0x25a87b);}(_0x998f,0x1a8));var _0xf998=function(_0x58fe2f,_0xa835da){_0x58fe2f=_0x58fe2f-0x0;var _0x251ee5=_0x998f[_0x58fe2f];return _0x251ee5;};'use strict';var Sequelize=require(_0xf998('0x0'));var moment=require(_0xf998('0x1'));var util=require(_0xf998('0x2'));var _=require(_0xf998('0x3'));module[_0xf998('0x4')]={'name':{'type':Sequelize[_0xf998('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x55299f){this['setDataValue'](_0xf998('0x6'),_0x55299f);this[_0xf998('0x7')](_0xf998('0x8'),_0x55299f);},'comment':_0xf998('0x9')},'fullname':{'type':Sequelize[_0xf998('0x5')],'allowNull':![],'set':function(_0x344109){this[_0xf998('0x7')](_0xf998('0xa'),_0x344109);this[_0xf998('0x7')](_0xf998('0xb'),util[_0xf998('0xc')]('\x22%s\x22\x20<%s>',_0x344109,this['getDataValue'](_0xf998('0xd'))));}},'alias':{'type':Sequelize[_0xf998('0x5')]},'email':{'type':Sequelize[_0xf998('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x3b1ef6){if(_0x3b1ef6){this[_0xf998('0x7')](_0xf998('0xe'),_0x3b1ef6['toLowerCase']());}}},'role':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x10'),'user','agent',_0xf998('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0xf998('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xf998('0x5')],'defaultValue':_0xf998('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xf998('0xd'),'set':function(_0x999b8e){this[_0xf998('0x7')](_0xf998('0xd'),_0x999b8e);this[_0xf998('0x7')](_0xf998('0x13'),_0x999b8e);this['setDataValue'](_0xf998('0xb'),util[_0xf998('0xc')](_0xf998('0x14'),this['getDataValue']('fullname'),_0x999b8e));}},'salt':{'type':Sequelize[_0xf998('0x5')]},'phone':{'type':Sequelize[_0xf998('0x5')]},'mobile':{'type':Sequelize[_0xf998('0x5')]},'address':{'type':Sequelize[_0xf998('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xf998('0x5')]},'city':{'type':Sequelize[_0xf998('0x5')]},'country':{'type':Sequelize[_0xf998('0x5')]},'online':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xf998('0x5')],'defaultValue':_0xf998('0x16')},'lastPauseAt':{'type':Sequelize[_0xf998('0x17')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xf998('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xf998('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![],'defaultValue':_0xf998('0x19')},'ipaddr':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x1a'),'user','peer'),'allowNull':!![],'defaultValue':_0xf998('0x1a')},'context':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![],'defaultValue':_0xf998('0x1b')},'callingpres':{'type':Sequelize['ENUM'](_0xf998('0x1c'),_0xf998('0x1d'),'ALLOWED_FAILED_SCREEN',_0xf998('0x1e'),_0xf998('0x1f'),_0xf998('0x20'),_0xf998('0x21'),_0xf998('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0x1e764c){this[_0xf998('0x7')](_0xf998('0x23'),_0x1e764c?_0x1e764c[_0xf998('0x24')](','):null);},'get':function(){return this[_0xf998('0x25')]('transport')?this[_0xf998('0x25')](_0xf998('0x23'))[_0xf998('0x26')](','):null;},'comment':_0xf998('0x27')},'dtmfmode':{'type':Sequelize['ENUM'](_0xf998('0x28'),_0xf998('0x29'),_0xf998('0x2a'),_0xf998('0x2b'),_0xf998('0x2c')),'allowNull':!![],'defaultValue':_0xf998('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0xf998('0x2d'),'no',_0xf998('0x2e'),'update',_0xf998('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![],'defaultValue':_0xf998('0x30'),'set':function(_0x41f2b7){this[_0xf998('0x7')](_0xf998('0x31'),_0x41f2b7?_0x41f2b7[_0xf998('0x24')](','):null);},'get':function(){return this[_0xf998('0x25')]('nat')?this[_0xf998('0x25')](_0xf998('0x31'))[_0xf998('0x26')](','):null;},'comment':_0xf998('0x32')},'callgroup':{'type':Sequelize[_0xf998('0x5')]},'namedcallgroup':{'type':Sequelize[_0xf998('0x5')]},'pickupgroup':{'type':Sequelize[_0xf998('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xf998('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xf998('0x5')],'allowNull':![],'defaultValue':_0xf998('0x33')},'allow':{'type':Sequelize[_0xf998('0x5')],'allowNull':![],'defaultValue':_0xf998('0x34'),'set':function(_0x59243b){this[_0xf998('0x7')](_0xf998('0x35'),_0x59243b?_0x59243b['join'](';'):_0xf998('0x34'));},'get':function(){return this[_0xf998('0x25')](_0xf998('0x35'))?this[_0xf998('0x25')](_0xf998('0x35'))[_0xf998('0x26')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xf998('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![],'set':function(_0x37216d){this[_0xf998('0x7')](_0xf998('0x36'),_0x37216d?_0x37216d[_0xf998('0x24')](','):null);},'get':function(){return this[_0xf998('0x25')](_0xf998('0x36'))?this['getDataValue']('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xf998('0x2d'),'no',_0xf998('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![],'defaultValue':_0xf998('0x38')},'amaflags':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xf998('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept','refuse',_0xf998('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x3a'),_0xf998('0x3b')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xf998('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xf998('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xf998('0x2d'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xf998('0x3c'),_0xf998('0x3d'),_0xf998('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xf998('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xf998('0xf')]('yes','no',_0xf998('0x2e'),_0xf998('0x3f'),_0xf998('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xf998('0x17')]},'passwordResetAt':{'type':Sequelize[_0xf998('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xf998('0x5')]},'showWebBar':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0,'set':function(_0x775d5f){this[_0xf998('0x7')](_0xf998('0x41'),_0x775d5f);var _0x3dfa57=this[_0xf998('0x42')]({'plain':!![]});switch(_0x775d5f){case 0x0:case 0x1:var _0x2bd55b=_0x3dfa57[_0xf998('0x23')]?_['isArray'](_0x3dfa57['transport'])?_0x3dfa57[_0xf998('0x23')][_0xf998('0x24')]():_0x3dfa57[_0xf998('0x23')]:'udp';if(_0x2bd55b===_0xf998('0x43')){_0x2bd55b=_0xf998('0x44');}this[_0xf998('0x7')](_0xf998('0x23'),_0x2bd55b);this[_0xf998('0x7')]('encryption','no');this['setDataValue'](_0xf998('0x45'),null);this[_0xf998('0x7')](_0xf998('0x46'),null);this[_0xf998('0x7')](_0xf998('0x47'),null);this[_0xf998('0x7')](_0xf998('0x48'),null);this[_0xf998('0x7')]('dtlsverify',null);this[_0xf998('0x7')]('dtlssetup',null);this[_0xf998('0x7')](_0xf998('0x49'),null);this[_0xf998('0x7')]('dtlsprivatekey',null);this[_0xf998('0x7')]('rtcp_mux','no');break;case 0x2:this[_0xf998('0x7')](_0xf998('0x23'),_0xf998('0x43'));this[_0xf998('0x7')](_0xf998('0x4a'),_0xf998('0x2d'));this[_0xf998('0x7')](_0xf998('0x45'),_0xf998('0x2d'));this[_0xf998('0x7')](_0xf998('0x46'),'yes');this['setDataValue'](_0xf998('0x47'),_0xf998('0x2d'));this[_0xf998('0x7')](_0xf998('0x48'),'yes');this['setDataValue']('dtlsverify','no');this[_0xf998('0x7')](_0xf998('0x4b'),_0xf998('0x3e'));this['setDataValue'](_0xf998('0x49'),_0x3dfa57[_0xf998('0x49')]||_0xf998('0x4c'));this[_0xf998('0x7')](_0xf998('0x4d'),_0x3dfa57[_0xf998('0x4d')]||'/etc/pki/tls/private/motion.key');this[_0xf998('0x7')](_0xf998('0x4e'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xf998('0x4f')],'set':function(_0x1ea7a3){this[_0xf998('0x7')](_0xf998('0x50'),_0x1ea7a3?_0x1ea7a3[_0xf998('0x24')](','):[]);},'get':function(){return this[_0xf998('0x25')](_0xf998('0x50'))?_[_0xf998('0x51')](this[_0xf998('0x25')](_0xf998('0x50'))[_0xf998('0x26')](','),function(_0x15ceaa){return parseInt(_0x15ceaa,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xf998('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xf998('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xf998('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xf998('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xf998('0x5')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xf998('0x52')],'get':function(){return this[_0xf998('0x25')](_0xf998('0x53'))?this[_0xf998('0x25')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xf998('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![],'set':function(_0x3a157f){if(typeof _0x3a157f===_0xf998('0x54')){var _0x41e2d3=_0x3a157f==='1'?!![]:_0x3a157f==='0'?![]:_0x3a157f===_0xf998('0x55')?!![]:_0x3a157f===_0xf998('0x56')?![]:![];this[_0xf998('0x7')](_0xf998('0x57'),_0x41e2d3);}else{this[_0xf998('0x7')]('screenrecording',_0x3a157f);}}},'blocked':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![],'set':function(_0x58c21f){this[_0xf998('0x7')](_0xf998('0x58'),_0x58c21f);if(_0x58c21f===!![]){this[_0xf998('0x7')](_0xf998('0x59'),moment());this[_0xf998('0x7')](_0xf998('0x5a'),0x0);}else{this[_0xf998('0x7')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xf998('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xf998('0x15')],'defaultValue':!![]}}; \ No newline at end of file +var _0xef52=['auto','nonat','outgoing','yes','nat','split','all','ulaw;alaw;gsm','allow','insecure','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','active','actpass','update,nonat','showWebBar','get','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','name','setDataValue','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','email','toLowerCase','ENUM','user','telephone','local','INTEGER','accountcode','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','rfc2833','info'];(function(_0x5b0ec8,_0x4a662e){var _0x2c6994=function(_0xa14a5b){while(--_0xa14a5b){_0x5b0ec8['push'](_0x5b0ec8['shift']());}};_0x2c6994(++_0x4a662e);}(_0xef52,0x7f));var _0x2ef5=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0xef52[_0x4a6cf8];return _0x22205e;};'use strict';var Sequelize=require(_0x2ef5('0x0'));var moment=require(_0x2ef5('0x1'));var util=require(_0x2ef5('0x2'));var _=require(_0x2ef5('0x3'));module[_0x2ef5('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2ef5('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2bb105){this[_0x2ef5('0x6')](_0x2ef5('0x5'),_0x2bb105);this[_0x2ef5('0x6')]('defaultuser',_0x2bb105);},'comment':_0x2ef5('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x178950){this['setDataValue']('fullname',_0x178950);this[_0x2ef5('0x6')](_0x2ef5('0x8'),util[_0x2ef5('0x9')](_0x2ef5('0xa'),_0x178950,this[_0x2ef5('0xb')](_0x2ef5('0xc'))));}},'alias':{'type':Sequelize[_0x2ef5('0xd')]},'email':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x23d642){if(_0x23d642){this[_0x2ef5('0x6')](_0x2ef5('0xe'),_0x23d642[_0x2ef5('0xf')]());}}},'role':{'type':Sequelize[_0x2ef5('0x10')]('admin',_0x2ef5('0x11'),'agent',_0x2ef5('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x2ef5('0x13')},'internal':{'type':Sequelize[_0x2ef5('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x5e9ee6){this[_0x2ef5('0x6')](_0x2ef5('0xc'),_0x5e9ee6);this[_0x2ef5('0x6')](_0x2ef5('0x15'),_0x5e9ee6);this[_0x2ef5('0x6')](_0x2ef5('0x8'),util[_0x2ef5('0x9')](_0x2ef5('0xa'),this[_0x2ef5('0xb')](_0x2ef5('0x16')),_0x5e9ee6));}},'salt':{'type':Sequelize[_0x2ef5('0xd')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x2ef5('0xd')]},'zipcode':{'type':Sequelize[_0x2ef5('0xd')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x2ef5('0xd')]},'country':{'type':Sequelize[_0x2ef5('0xd')]},'online':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2ef5('0x18')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2ef5('0xd')],'defaultValue':_0x2ef5('0x19')},'lastPauseAt':{'type':Sequelize[_0x2ef5('0x18')]},'chatCapacity':{'type':Sequelize[_0x2ef5('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2ef5('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2ef5('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x2ef5('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2ef5('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2ef5('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2ef5('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2ef5('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'host':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![],'defaultValue':_0x2ef5('0x1a')},'ipaddr':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2ef5('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x2ef5('0x1b'),_0x2ef5('0x11'),_0x2ef5('0x1c')),'allowNull':!![],'defaultValue':_0x2ef5('0x1b')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2ef5('0x1d')},'callingpres':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x1e'),_0x2ef5('0x1f'),_0x2ef5('0x20'),_0x2ef5('0x21'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x2ef5('0x22'),_0x2ef5('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2ef5('0x24'),'set':function(_0x5c41c5){this['setDataValue'](_0x2ef5('0x25'),_0x5c41c5?_0x5c41c5[_0x2ef5('0x26')](','):null);},'get':function(){return this[_0x2ef5('0xb')]('transport')?this['getDataValue'](_0x2ef5('0x25'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x2ef5('0x27'),_0x2ef5('0x28'),'shortinfo','inband',_0x2ef5('0x29')),'allowNull':!![],'defaultValue':_0x2ef5('0x27')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x2ef5('0x2a'),'update',_0x2ef5('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x3b8aab){this[_0x2ef5('0x6')](_0x2ef5('0x2d'),_0x3b8aab?_0x3b8aab['join'](','):null);},'get':function(){return this[_0x2ef5('0xb')](_0x2ef5('0x2d'))?this[_0x2ef5('0xb')](_0x2ef5('0x2d'))[_0x2ef5('0x2e')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x2ef5('0xd')]},'namedcallgroup':{'type':Sequelize[_0x2ef5('0xd')]},'pickupgroup':{'type':Sequelize[_0x2ef5('0xd')]},'namedpickupgroup':{'type':Sequelize[_0x2ef5('0xd')]},'language':{'type':Sequelize[_0x2ef5('0xd')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2ef5('0xd')]},'disallow':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':![],'defaultValue':_0x2ef5('0x2f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2ef5('0x30'),'set':function(_0xc5a23d){this[_0x2ef5('0x6')](_0x2ef5('0x31'),_0xc5a23d?_0xc5a23d[_0x2ef5('0x26')](';'):_0x2ef5('0x30'));},'get':function(){return this[_0x2ef5('0xb')](_0x2ef5('0x31'))?this[_0x2ef5('0xb')](_0x2ef5('0x31'))[_0x2ef5('0x2e')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x33615e){this[_0x2ef5('0x6')](_0x2ef5('0x32'),_0x33615e?_0x33615e[_0x2ef5('0x26')](','):null);},'get':function(){return this[_0x2ef5('0xb')](_0x2ef5('0x32'))?this['getDataValue'](_0x2ef5('0x32'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2ef5('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x2ef5('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2ef5('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2ef5('0x34')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2ef5('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x2ef5('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no',_0x2ef5('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2ef5('0x10')]('accept',_0x2ef5('0x36'),_0x2ef5('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2ef5('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x38'),_0x2ef5('0x39')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x2ef5('0x2c')},'keepalive':{'type':Sequelize[_0x2ef5('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2ef5('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2ef5('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x2ef5('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2ef5('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2ef5('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2ef5('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2ef5('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x2ef5('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x2ef5('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x2ef5('0x3a'),'passive',_0x2ef5('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2ef5('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2ef5('0x10')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x2ef5('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x2ef5('0x10')](_0x2ef5('0x2c'),'no',_0x2ef5('0x2a'),'update',_0x2ef5('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2ef5('0xd')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x2ef5('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['STRING']},'showWebBar':{'type':Sequelize[_0x2ef5('0x14')],'defaultValue':0x0,'set':function(_0x26308d){this[_0x2ef5('0x6')](_0x2ef5('0x3d'),_0x26308d);var _0x547b8d=this[_0x2ef5('0x3e')]({'plain':!![]});switch(_0x26308d){case 0x0:case 0x1:var _0x40bfda=_0x547b8d['transport']?_['isArray'](_0x547b8d[_0x2ef5('0x25')])?_0x547b8d[_0x2ef5('0x25')][_0x2ef5('0x26')]():_0x547b8d[_0x2ef5('0x25')]:_0x2ef5('0x24');if(_0x40bfda===_0x2ef5('0x3f')){_0x40bfda=_0x2ef5('0x24');}this[_0x2ef5('0x6')]('transport',_0x40bfda);this['setDataValue'](_0x2ef5('0x40'),'no');this['setDataValue'](_0x2ef5('0x41'),null);this[_0x2ef5('0x6')]('force_avp',null);this[_0x2ef5('0x6')](_0x2ef5('0x42'),null);this[_0x2ef5('0x6')](_0x2ef5('0x43'),null);this[_0x2ef5('0x6')](_0x2ef5('0x44'),null);this[_0x2ef5('0x6')](_0x2ef5('0x45'),null);this[_0x2ef5('0x6')](_0x2ef5('0x46'),null);this[_0x2ef5('0x6')](_0x2ef5('0x47'),null);this[_0x2ef5('0x6')](_0x2ef5('0x48'),'no');break;case 0x2:this[_0x2ef5('0x6')](_0x2ef5('0x25'),_0x2ef5('0x3f'));this[_0x2ef5('0x6')](_0x2ef5('0x40'),_0x2ef5('0x2c'));this[_0x2ef5('0x6')]('avpf',_0x2ef5('0x2c'));this[_0x2ef5('0x6')]('force_avp',_0x2ef5('0x2c'));this[_0x2ef5('0x6')]('icesupport',_0x2ef5('0x2c'));this[_0x2ef5('0x6')](_0x2ef5('0x43'),_0x2ef5('0x2c'));this[_0x2ef5('0x6')](_0x2ef5('0x44'),'no');this[_0x2ef5('0x6')](_0x2ef5('0x45'),'actpass');this[_0x2ef5('0x6')]('dtlscertfile',_0x547b8d[_0x2ef5('0x46')]||'/etc/pki/tls/certs/motion.crt');this[_0x2ef5('0x6')](_0x2ef5('0x47'),_0x547b8d[_0x2ef5('0x47')]||'/etc/pki/tls/private/motion.key');this[_0x2ef5('0x6')](_0x2ef5('0x48'),_0x2ef5('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0x2ef5('0x49')],'set':function(_0x3b5302){this['setDataValue'](_0x2ef5('0x4a'),_0x3b5302?_0x3b5302[_0x2ef5('0x26')](','):[]);},'get':function(){return this[_0x2ef5('0xb')](_0x2ef5('0x4a'))?_[_0x2ef5('0x4b')](this[_0x2ef5('0xb')](_0x2ef5('0x4a'))[_0x2ef5('0x2e')](','),function(_0x3455e6){return parseInt(_0x3455e6,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2ef5('0xd')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2ef5('0xd')]},'phoneBarBusyNumber':{'type':Sequelize[_0x2ef5('0xd')]},'phoneBarUnconditional':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2ef5('0xd')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2ef5('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2ef5('0x10')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2ef5('0x4c')],'get':function(){return this[_0x2ef5('0xb')](_0x2ef5('0x4d'))?this['getDataValue'](_0x2ef5('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x2ef5('0xd')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2ef5('0xd')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x2cf5dd){if(typeof _0x2cf5dd===_0x2ef5('0x4e')){var _0x3d58b5=_0x2cf5dd==='1'?!![]:_0x2cf5dd==='0'?![]:_0x2cf5dd==='true'?!![]:_0x2cf5dd===_0x2ef5('0x4f')?![]:![];this[_0x2ef5('0x6')](_0x2ef5('0x50'),_0x3d58b5);}else{this[_0x2ef5('0x6')](_0x2ef5('0x50'),_0x2cf5dd);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x223181){this[_0x2ef5('0x6')](_0x2ef5('0x51'),_0x223181);if(_0x223181===!![]){this['setDataValue'](_0x2ef5('0x52'),moment());this['setDataValue'](_0x2ef5('0x53'),0x0);}else{this[_0x2ef5('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x2ef5('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2ef5('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2ef5('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 042b8e6..980036f 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 _0xcb91=['queues','inbound','toString','asc','desc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','voiceStatus','busy','slice','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','User,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','destroy','get','role','admin','Users','user','Agents','agent','Telephones','filter','ignore','map','value','includes','name','stack','send','index','User','rawAttributes','fieldName','key','differenceBy','salt','keys','query','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','sequelize','lower','col','options','include','findAll','show','password','fields','includeAll','body','find','params','describe','addContacts','ids','Setting','findById','securePassword','max','internal','min_internal','isNil','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','mailbox','VoiceMail','fullname','email','permissions','101','102','103','110','104','105','106','107','108','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','push','all','each','some','telephone','isEmpty','compact','changePassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','oldPassword','Sequelize','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','isValidChannel','add','capitalize','toLowerCase','spread','QueueId','emit','voice','VoiceQueue','interface','format','SIP/%s','penalty','UserVoiceQueueRt','removeQueues','Unknown\x20channel','remove','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','download','root','server/files/images/','getContacts','findOne','CmContact','List','Tag','Tags','color','tag','getQueues','Queue','Unknown\x20role','Queues','getVoiceQueuesRt','getGroups','ChatGroup','VoiceRecording','rows','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','type','chatPause','faxPause','openchannelPause','whatsapppause','pauseType','manual','chat','fax','sms','openchannel','%s%s','Pause','unpause','getTeams','Team','addTeams','omit','setDataValue','Voice','getChatQueues','getMailQueues','Mail','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','transaction','addAgent','getDataValue','upsert','removeTeams','getSmsQueues','Openchannel','flatten','removeAgent','getLists','CmList','getAgents','values','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','isArray','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getPresence','teams'];(function(_0x4eb83a,_0x3cce82){var _0xcd71c3=function(_0x16c0d1){while(--_0x16c0d1){_0x4eb83a['push'](_0x4eb83a['shift']());}};_0xcd71c3(++_0x3cce82);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0xcb91[_0x334599];return _0x4cdff2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var fs_extra=require(_0x1cb9('0x9'));var _=require('lodash');var squel=require(_0x1cb9('0xa'));var crypto=require(_0x1cb9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1cb9('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1cb9('0xd'));var Redis=require(_0x1cb9('0xe'));var authService=require(_0x1cb9('0xf'));var qs=require(_0x1cb9('0x10'));var as=require(_0x1cb9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1cb9('0x12'))(_0x1cb9('0x13'));var utils=require(_0x1cb9('0x14'));var config=require(_0x1cb9('0x15'));var licenseUtil=require(_0x1cb9('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x1cb9('0x17')],{'host':_0x1cb9('0x18'),'port':0x18eb});var socket=require(_0x1cb9('0x19'))(new Redis(config[_0x1cb9('0x17')]));require('./user.socket')[_0x1cb9('0x1a')](socket);var jayson=require(_0x1cb9('0x1b'));var client=jayson[_0x1cb9('0x1c')][_0x1cb9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3e2d11,_0x5806d8,_0x5572cb,_0xd446a3){return new BPromise(function(_0x3cc765,_0x3904b7){var _0x3f1376=_0xd446a3||client;return _0x3f1376[_0x1cb9('0x1e')](_0x3e2d11,_0x5572cb)[_0x1cb9('0x1f')](function(_0x23d3a9){logger['info']('User,\x20%s,\x20%s',_0x5806d8,_0x1cb9('0x20'));logger[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x5806d8,_0x1cb9('0x20'),JSON[_0x1cb9('0x23')](_0x23d3a9));if(_0x23d3a9[_0x1cb9('0x24')]){if(_0x23d3a9[_0x1cb9('0x24')]['code']===0x1f4){logger['error'](_0x1cb9('0x25'),_0x5806d8,_0x23d3a9['error'][_0x1cb9('0x26')]);return _0x3904b7(_0x23d3a9[_0x1cb9('0x24')]['message']);}logger['error'](_0x1cb9('0x25'),_0x5806d8,_0x23d3a9[_0x1cb9('0x24')][_0x1cb9('0x26')]);return _0x3cc765(_0x23d3a9[_0x1cb9('0x24')][_0x1cb9('0x26')]);}else{logger[_0x1cb9('0x27')]('User,\x20%s,\x20%s',_0x5806d8,'request\x20sent');_0x3cc765(_0x23d3a9[_0x1cb9('0x28')]['message']);}})[_0x1cb9('0x29')](function(_0x2b1275){logger[_0x1cb9('0x24')](_0x1cb9('0x25'),_0x5806d8,_0x2b1275);_0x3904b7(_0x2b1275);});});}function respondWithStatusCode(_0x43a100,_0x53f9fa){_0x53f9fa=_0x53f9fa||0xcc;return function(_0x195f16){if(_0x195f16){return _0x43a100[_0x1cb9('0x2a')](_0x53f9fa);}return _0x43a100['status'](_0x53f9fa)[_0x1cb9('0x2b')]();};}function respondWithResult(_0x21effa,_0x41a9a0){_0x41a9a0=_0x41a9a0||0xc8;return function(_0x1804fd){if(_0x1804fd){return _0x21effa[_0x1cb9('0x2c')](_0x41a9a0)[_0x1cb9('0x2d')](_0x1804fd);}};}function respondWithFilteredResult(_0x2e28fe,_0xb644b3){return function(_0x41e5c2){if(_0x41e5c2){var _0x9de64b=_0x41e5c2[_0x1cb9('0x2e')],_0x48888d=_0xb644b3['offset'],_0x405a2f=_0xb644b3[_0x1cb9('0x2f')]+_0xb644b3[_0x1cb9('0x30')],_0x536635;if(_0x405a2f>=_0x9de64b){_0x405a2f=_0x9de64b;_0x536635=0xc8;}else{_0x536635=0xce;}_0x2e28fe[_0x1cb9('0x2c')](_0x536635);return _0x2e28fe[_0x1cb9('0x31')]('Content-Range',_0x48888d+'-'+_0x405a2f+'/'+_0x9de64b)[_0x1cb9('0x2d')](_0x41e5c2);}return null;};}function patchUpdates(_0x4eba82){return function(_0xe0a0e2){try{jsonpatch[_0x1cb9('0x32')](_0xe0a0e2,_0x4eba82,!![]);}catch(_0x4220d7){return BPromise['reject'](_0x4220d7);}return _0xe0a0e2[_0x1cb9('0x33')]();};}function saveUpdates(_0x5e84fd,_0x3a3543){return function(_0x58f4f5){if(_0x58f4f5){return _0x58f4f5[_0x1cb9('0x34')](_0x5e84fd)[_0x1cb9('0x1f')](function(_0x3a2c60){return _0x3a2c60;});}return null;};}function removeEntity(_0xae910,_0x56c3e0){return function(_0x2114a4){if(_0x2114a4){return _0x2114a4[_0x1cb9('0x35')]()[_0x1cb9('0x1f')](function(){var _0x91a1db=_0x2114a4[_0x1cb9('0x36')]({'plain':!![]});if(_0x91a1db[_0x1cb9('0x37')]===_0x1cb9('0x38'))return;var _0x1ed5ad=[{'name':_0x1cb9('0x39'),'value':_0x1cb9('0x3a'),'ignore':!![]},{'name':_0x1cb9('0x3b'),'value':_0x1cb9('0x3c'),'ignore':![]},{'name':_0x1cb9('0x3d'),'value':'telephone','ignore':![]}];var _0x54c6e6=_(_0x1ed5ad)[_0x1cb9('0x3e')](_0x1cb9('0x3f'))[_0x1cb9('0x40')](_0x1cb9('0x41'))[_0x1cb9('0x41')]();if(_[_0x1cb9('0x42')](_0x54c6e6,_0x91a1db[_0x1cb9('0x37')])){return;}var _0x3f5637=_['find'](_0x1ed5ad,[_0x1cb9('0x41'),_0x91a1db[_0x1cb9('0x37')]])[_0x1cb9('0x43')];return db['UserProfileResource'][_0x1cb9('0x35')]({'where':{'type':_0x3f5637,'resourceId':_0x91a1db['id']}})['then'](function(){return _0x2114a4;});})[_0x1cb9('0x1f')](function(){_0xae910['status'](0xcc)[_0x1cb9('0x2b')]();});}};}function handleEntityNotFound(_0x13d4fd,_0x289b73){return function(_0x2bcacd){if(!_0x2bcacd){_0x13d4fd[_0x1cb9('0x2a')](0x194);}return _0x2bcacd;};}function handleError(_0x291802,_0x1a85ee){_0x1a85ee=_0x1a85ee||0x1f4;return function(_0x4a4788){logger['error'](_0x4a4788[_0x1cb9('0x44')]);if(_0x4a4788[_0x1cb9('0x43')]){delete _0x4a4788[_0x1cb9('0x43')];}_0x291802[_0x1cb9('0x2c')](_0x1a85ee)[_0x1cb9('0x45')](_0x4a4788);};}exports[_0x1cb9('0x46')]=function(_0x32130b,_0x4a670c){var _0xbcaa32={},_0x47edad={},_0x576ef2={'count':0x0,'rows':[]};var _0x4c6c75=_[_0x1cb9('0x40')](db[_0x1cb9('0x47')][_0x1cb9('0x48')],function(_0x2e3cf3){return{'name':_0x2e3cf3[_0x1cb9('0x49')],'type':_0x2e3cf3['type'][_0x1cb9('0x4a')]};});_0x47edad['model']=_[_0x1cb9('0x4b')](_[_0x1cb9('0x40')](_0x4c6c75,_0x1cb9('0x43')),['password',_0x1cb9('0x4c')]);_0x47edad['query']=_[_0x1cb9('0x4d')](_0x32130b[_0x1cb9('0x4e')]);_0x47edad['filters']=_['intersection'](_0x47edad[_0x1cb9('0x4f')],_0x47edad[_0x1cb9('0x4e')]);_0xbcaa32[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0x47edad[_0x1cb9('0x4f')],qs['fields'](_0x32130b[_0x1cb9('0x4e')]['fields']));_0xbcaa32['attributes']=_0xbcaa32['attributes'][_0x1cb9('0x52')]?_0xbcaa32[_0x1cb9('0x50')]:_0x47edad[_0x1cb9('0x4f')];if(!_0x32130b[_0x1cb9('0x4e')][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0xbcaa32[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x32130b[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0xbcaa32[_0x1cb9('0x2f')]=qs['offset'](_0x32130b[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}_0xbcaa32[_0x1cb9('0x55')]=qs['sort'](_0x32130b[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0xbcaa32[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_[_0x1cb9('0x59')](_0x32130b['query'],_0x47edad[_0x1cb9('0x58')]),_0x4c6c75);if(_0x32130b['query'][_0x1cb9('0x3e')]){_0xbcaa32['where']=_[_0x1cb9('0x5a')](_0xbcaa32[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x4c6c75,function(_0x2cb57b){if(_0x2cb57b['type']!==_0x1cb9('0x5b')){return db[_0x1cb9('0x5c')][_0x1cb9('0x57')](db[_0x1cb9('0x5c')]['fn'](_0x1cb9('0x5d'),db[_0x1cb9('0x5c')][_0x1cb9('0x5e')](_0x2cb57b[_0x1cb9('0x43')])),{'$like':db[_0x1cb9('0x5c')]['fn'](_0x1cb9('0x5d'),'%'+_0x32130b['query']['filter']+'%')});}})});}_0xbcaa32=_[_0x1cb9('0x5a')]({},_0xbcaa32,_0x32130b[_0x1cb9('0x5f')]);var _0x19e83a={'where':_0xbcaa32[_0x1cb9('0x57')]};return db[_0x1cb9('0x47')][_0x1cb9('0x2e')](_0x19e83a)[_0x1cb9('0x1f')](function(_0x1c4ff6){_0x576ef2[_0x1cb9('0x2e')]=_0x1c4ff6;if(_0x32130b[_0x1cb9('0x4e')]['includeAll']){_0xbcaa32[_0x1cb9('0x60')]=[{'all':!![]}];}return db['User'][_0x1cb9('0x61')](_0xbcaa32);})['then'](function(_0x135795){_0x576ef2['rows']=_0x135795;return _0x576ef2;})['then'](respondWithFilteredResult(_0x4a670c,_0xbcaa32))[_0x1cb9('0x29')](handleError(_0x4a670c,null));};exports[_0x1cb9('0x62')]=function(_0x303da3,_0x4bce54){var _0x3c157f={'raw':![],'where':{'id':_0x303da3['params']['id']}},_0xe67f19={};_0xe67f19['model']=_[_0x1cb9('0x4b')](_[_0x1cb9('0x4d')](db[_0x1cb9('0x47')][_0x1cb9('0x48')]),[_0x1cb9('0x63'),_0x1cb9('0x4c')]);_0xe67f19[_0x1cb9('0x4e')]=_['keys'](_0x303da3[_0x1cb9('0x4e')]);_0xe67f19[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0xe67f19['model'],_0xe67f19[_0x1cb9('0x4e')]);_0x3c157f[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0xe67f19[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x303da3[_0x1cb9('0x4e')]['fields']));_0x3c157f[_0x1cb9('0x50')]=_0x3c157f[_0x1cb9('0x50')][_0x1cb9('0x52')]?_0x3c157f[_0x1cb9('0x50')]:_0xe67f19[_0x1cb9('0x4f')];if(_0x303da3[_0x1cb9('0x4e')][_0x1cb9('0x65')]){_0x3c157f[_0x1cb9('0x60')]=[{'all':!![]}];}_0x3c157f=_[_0x1cb9('0x5a')]({},_0x3c157f,_0x303da3[_0x1cb9('0x5f')]);return db[_0x1cb9('0x47')]['find'](_0x3c157f)[_0x1cb9('0x1f')](handleEntityNotFound(_0x4bce54,null))[_0x1cb9('0x1f')](respondWithResult(_0x4bce54,null))[_0x1cb9('0x29')](handleError(_0x4bce54,null));};exports[_0x1cb9('0x34')]=function(_0x4fc66b,_0x4a9cf8){if(_0x4fc66b[_0x1cb9('0x66')]['id']){delete _0x4fc66b[_0x1cb9('0x66')]['id'];}delete _0x4fc66b[_0x1cb9('0x66')][_0x1cb9('0x37')];return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x4fc66b[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x4a9cf8,null))['then'](saveUpdates(_0x4fc66b['body'],null))[_0x1cb9('0x1f')](respondWithResult(_0x4a9cf8,null))['catch'](handleError(_0x4a9cf8,null));};exports['describe']=function(_0x4ca5bc,_0x580369){return db['User'][_0x1cb9('0x69')]()[_0x1cb9('0x1f')](respondWithResult(_0x580369,null))[_0x1cb9('0x29')](handleError(_0x580369,null));};exports[_0x1cb9('0x6a')]=function(_0x23d435,_0xccbee3,_0x54f008){return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x23d435['params']['id']}})['then'](handleEntityNotFound(_0xccbee3,null))[_0x1cb9('0x1f')](function(_0x7b3380){if(_0x7b3380){return _0x7b3380[_0x1cb9('0x6a')](_0x23d435[_0x1cb9('0x66')][_0x1cb9('0x6b')],_['omit'](_0x23d435['body'],['ids','id'])||{});}})[_0x1cb9('0x1f')](respondWithResult(_0xccbee3,null))[_0x1cb9('0x29')](handleError(_0xccbee3,null));};function validateUser(_0x196349){return new BPromise(function(_0x2e83fe,_0x349f33){if(_0x196349['internal'])return _0x2e83fe(_0x196349);return db[_0x1cb9('0x6c')][_0x1cb9('0x6d')](0x1)['then'](function(_0x55b8e9){if(_0x55b8e9[_0x1cb9('0x6e')])authService['validatePasswordPattern'](_0x196349[_0x1cb9('0x63')]);db[_0x1cb9('0x47')][_0x1cb9('0x6f')](_0x1cb9('0x70'))[_0x1cb9('0x1f')](function(_0x398779){if(_['isNil'](_0x398779)){_0x196349[_0x1cb9('0x70')]=_0x55b8e9[_0x1cb9('0x71')]||0x1;return;}if(_[_0x1cb9('0x72')](_0x55b8e9[_0x1cb9('0x71')])||_0x55b8e9['min_internal']===_0x398779){_0x196349['internal']=_0x398779+0x1;return;}if(_0x55b8e9[_0x1cb9('0x71')]>_0x398779){_0x196349[_0x1cb9('0x70')]=_0x55b8e9[_0x1cb9('0x71')];return;}return db[_0x1cb9('0x5c')][_0x1cb9('0x4e')](_0x1cb9('0x73'),{'type':db['sequelize'][_0x1cb9('0x74')]['SELECT']})[_0x1cb9('0x1f')](function(_0x26dae9){if(_0x26dae9&&_0x26dae9['length']){for(var _0xf5b006=0x0,_0xce1835=_0x26dae9[_0x1cb9('0x52')];_0xf5b006<_0xce1835&&_['isNil'](_0x196349[_0x1cb9('0x70')]);_0xf5b006++){if(_0x55b8e9[_0x1cb9('0x71')]<=_0x26dae9[_0xf5b006][_0x1cb9('0x75')]){_0x196349[_0x1cb9('0x70')]=_0x26dae9[_0xf5b006][_0x1cb9('0x75')];}else if(_0x55b8e9[_0x1cb9('0x71')]>_0x26dae9[_0xf5b006]['from']&&_0x55b8e9[_0x1cb9('0x71')]<=_0x26dae9[_0xf5b006]['to']){_0x196349[_0x1cb9('0x70')]=_0x55b8e9[_0x1cb9('0x71')];}}}if(_[_0x1cb9('0x72')](_0x196349[_0x1cb9('0x70')])){_0x196349[_0x1cb9('0x70')]=_0x398779+0x1;}return _0x2e83fe(_0x196349);});});})[_0x1cb9('0x29')](function(_0x37bcd9){_0x349f33(_0x37bcd9);});});}function updateUser(_0x4cd544){return new BPromise(function(_0x28bac2,_0x78e9c){try{if(_0x4cd544['voicemail']){_0x4cd544[_0x1cb9('0x76')]=_0x4cd544['internal'];_0x4cd544[_0x1cb9('0x77')]={'mailbox':_0x4cd544['internal'],'password':_0x4cd544['password'],'fullname':_0x4cd544[_0x1cb9('0x78')],'email':_0x4cd544[_0x1cb9('0x79')]};}if(_0x4cd544['role']===_0x1cb9('0x3c')){if(!_0x4cd544['permissions'])_0x4cd544[_0x1cb9('0x7a')]=[_0x1cb9('0x7b'),_0x1cb9('0x7c'),_0x1cb9('0x7d'),'113',_0x1cb9('0x7e'),_0x1cb9('0x7f'),_0x1cb9('0x80'),_0x1cb9('0x81'),_0x1cb9('0x82'),_0x1cb9('0x83'),'109',_0x1cb9('0x84'),_0x1cb9('0x85'),_0x1cb9('0x86'),_0x1cb9('0x87')];}_0x28bac2(_0x4cd544);}catch(_0x102f2c){_0x78e9c(_0x102f2c);}});}exports[_0x1cb9('0x88')]=function(_0x5e07ba,_0x3db146){if(_0x5e07ba[_0x1cb9('0x3a')]['role']===_0x1cb9('0x3c'))throw new Error(_0x1cb9('0x89'));if(_0x5e07ba[_0x1cb9('0x66')][_0x1cb9('0x37')]===_0x1cb9('0x3a')&&_0x5e07ba[_0x1cb9('0x3a')][_0x1cb9('0x37')]!=='admin'){throw new Error(_0x1cb9('0x8a'));}if(_0x5e07ba['body'][_0x1cb9('0x37')]===_0x1cb9('0x38')&&_0x5e07ba['user'][_0x1cb9('0x37')]!==_0x1cb9('0x38')){throw new Error(_0x1cb9('0x8b'));}return licenseUtil[_0x1cb9('0x8c')]([_0x5e07ba['body']])[_0x1cb9('0x1f')](function(){return validateUser(_0x5e07ba[_0x1cb9('0x66')]);})[_0x1cb9('0x1f')](function(_0x5d0e8c){return updateUser(_0x5d0e8c)[_0x1cb9('0x1f')](function(_0xe3ee8e){if(_0xe3ee8e[_0x1cb9('0x37')]===_0x1cb9('0x38')){_0xe3ee8e[_0x1cb9('0x8d')]=_0x5e07ba[_0x1cb9('0x3a')][_0x1cb9('0x8d')];delete _0xe3ee8e['userProfileId'];}return _0xe3ee8e;});})[_0x1cb9('0x1f')](function(_0x4b15a4){return db[_0x1cb9('0x47')][_0x1cb9('0x88')](_0x4b15a4,{'include':[{'model':db[_0x1cb9('0x77')],'as':_0x1cb9('0x77')}]});})['then'](function(_0x1ff5e9){if(_0x5e07ba[_0x1cb9('0x66')]['role']===_0x1cb9('0x3a'))return _0x1ff5e9;if(_0x5e07ba[_0x1cb9('0x3a')][_0x1cb9('0x37')]!==_0x1cb9('0x3a'))return _0x1ff5e9;return db[_0x1cb9('0x8e')]['find']({'where':{'name':_0x1ff5e9['role']==='agent'?'Agents':_0x1cb9('0x3d'),'userProfileId':_0x5e07ba[_0x1cb9('0x3a')][_0x1cb9('0x8f')]},'raw':!![]})[_0x1cb9('0x1f')](function(_0x3534b6){if(!_0x3534b6||_0x3534b6[_0x1cb9('0x90')]!=0x0)return _0x1ff5e9;return db[_0x1cb9('0x91')][_0x1cb9('0x88')]({'name':_0x1ff5e9['name'],'resourceId':_0x1ff5e9['id'],'type':_0x3534b6[_0x1cb9('0x43')],'sectionId':_0x3534b6['id']},{})[_0x1cb9('0x1f')](function(){return _0x1ff5e9;});})[_0x1cb9('0x29')](function(_0x5eff1e){logger[_0x1cb9('0x24')](_0x1cb9('0x92'),_0x5eff1e);throw _0x5eff1e;});})['then'](respondWithResult(_0x3db146,0xc9))[_0x1cb9('0x29')](handleError(_0x3db146,null));};exports[_0x1cb9('0x93')]=function(_0x887adc,_0x466dc7){var _0x5cb5e5=_0x887adc[_0x1cb9('0x66')];var _0x282ffa=[];if(_0x887adc['user']['role']===_0x1cb9('0x3c'))throw new Error(_0x1cb9('0x89'));if(_['some'](_0x5cb5e5,['role',_0x1cb9('0x3a')])&&_0x887adc[_0x1cb9('0x3a')]['role']!=='admin'){throw new Error(_0x1cb9('0x8a'));}if(_['some'](_0x5cb5e5,['role','admin'])&&_0x887adc[_0x1cb9('0x3a')]['role']!==_0x1cb9('0x38')){throw new Error(_0x1cb9('0x94'));}return licenseUtil[_0x1cb9('0x8c')](_0x5cb5e5)['then'](function(){return validateUser(_0x5cb5e5[0x0]);})[_0x1cb9('0x1f')](function(){for(var _0x2fbe45=0x1;_0x2fbe45<_0x5cb5e5[_0x1cb9('0x52')];_0x2fbe45++){var _0x4c54b5=_0x5cb5e5[_0x2fbe45-0x1][_0x1cb9('0x70')];if(!_0x5cb5e5[_0x2fbe45][_0x1cb9('0x70')])_0x5cb5e5[_0x2fbe45][_0x1cb9('0x70')]=_0x4c54b5+0x1;_0x282ffa[_0x1cb9('0x95')](validateUser(_0x5cb5e5[_0x2fbe45]));}return BPromise[_0x1cb9('0x96')](_0x282ffa);})['then'](function(){_0x282ffa=[];for(var _0x19bd03=0x0;_0x19bd03<_0x5cb5e5[_0x1cb9('0x52')];_0x19bd03++){_0x282ffa[_0x1cb9('0x95')](updateUser(_0x5cb5e5[_0x19bd03]));}return BPromise['all'](_0x282ffa);})[_0x1cb9('0x1f')](function(){return BPromise[_0x1cb9('0x97')](_0x5cb5e5,function(_0x534378){return db[_0x1cb9('0x47')][_0x1cb9('0x88')](_0x534378,{'include':[{'model':db['VoiceMail'],'as':_0x1cb9('0x77')}]})[_0x1cb9('0x1f')](function(_0x40148e){_0x534378['id']=_0x40148e['id'];return _0x534378;});});})[_0x1cb9('0x1f')](function(_0x2f19e5){if(_0x887adc[_0x1cb9('0x66')][_0x1cb9('0x37')]===_0x1cb9('0x3a'))return _0x2f19e5;if(_0x887adc[_0x1cb9('0x3a')][_0x1cb9('0x37')]!==_0x1cb9('0x3a'))return _0x2f19e5;var _0x2bb5a2=_[_0x1cb9('0x98')](_0x2f19e5,function(_0x1b2b1c){return _0x1b2b1c[_0x1cb9('0x37')]===_0x1cb9('0x3c')||_0x1b2b1c[_0x1cb9('0x37')]===_0x1cb9('0x99');});if(!_0x2bb5a2)return _0x2f19e5;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0x1cb9('0x3b'),_0x1cb9('0x3d')]},'userProfileId':_0x887adc[_0x1cb9('0x3a')][_0x1cb9('0x8f')]},'raw':!![]})[_0x1cb9('0x1f')](function(_0x165789){if(_[_0x1cb9('0x9a')](_0x165789)||!_['some'](_0x165789,['autoAssociation',0x0]))return _0x2f19e5;_0x282ffa=[];var _0x1d14a4=_(_0x165789)[_0x1cb9('0x40')](function(_0x29b478){if(_0x29b478[_0x1cb9('0x90')]===0x1)return;return _0x29b478[_0x1cb9('0x43')]==='Agents'?_0x1cb9('0x3c'):_0x1cb9('0x99');})[_0x1cb9('0x9b')]()['value']();for(var _0x36faa4=0x0;_0x36faa4<_0x2f19e5[_0x1cb9('0x52')];_0x36faa4++){if(!_[_0x1cb9('0x42')](_0x1d14a4,_0x2f19e5[_0x36faa4]['role']))return;var _0x17fc5a=_0x2f19e5[_0x36faa4][_0x1cb9('0x37')]===_0x1cb9('0x3c')?'Agents':'Telephones';_0x282ffa['push'](db[_0x1cb9('0x91')][_0x1cb9('0x88')]({'name':_0x2f19e5[_0x36faa4][_0x1cb9('0x43')],'resourceId':_0x2f19e5[_0x36faa4]['id'],'type':_0x17fc5a,'sectionId':_['find'](_0x165789,[_0x1cb9('0x43'),_0x17fc5a])['id']},{}));}return BPromise['all'](_0x282ffa);});})['then'](respondWithResult(_0x466dc7,0xc9))[_0x1cb9('0x29')](handleError(_0x466dc7,null));};exports[_0x1cb9('0x9c')]=function(_0x46f990,_0x2fa5b8,_0x2b31b7){if(_0x46f990[_0x1cb9('0x66')]['id']){delete _0x46f990[_0x1cb9('0x66')]['id'];}return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x46f990[_0x1cb9('0x68')]['id']}})['then'](function(_0x4ff2da){if(!_0x4ff2da)return null;if(_0x4ff2da['id']===_0x46f990[_0x1cb9('0x3a')]['id']){if(!_0x46f990[_0x1cb9('0x66')]['oldPassword']||!_0x46f990['body']['newPassword']){throw new db['Sequelize'][(_0x1cb9('0x9d'))](_0x1cb9('0x9e'));}if(!_0x4ff2da['authenticate'](_0x46f990[_0x1cb9('0x66')][_0x1cb9('0x9f')])){throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0xa1'));}if(_0x46f990['body'][_0x1cb9('0x9f')]===_0x46f990[_0x1cb9('0x66')][_0x1cb9('0xa2')]){throw new db[(_0x1cb9('0xa0'))]['ValidationError'](_0x1cb9('0xa3'));}}else if(_0x46f990[_0x1cb9('0x3a')]['role']==='admin'){if(!_0x46f990['body'][_0x1cb9('0xa2')]){throw new db['Sequelize'][(_0x1cb9('0x9d'))](_0x1cb9('0xa4'));}}else if(_0x46f990[_0x1cb9('0x3a')][_0x1cb9('0x37')]===_0x1cb9('0x3a')){if(!_0x46f990[_0x1cb9('0x66')]['newPassword']){throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0xa4'));}if(_0x4ff2da[_0x1cb9('0x37')]!==_0x1cb9('0x3c')){throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0x89'));}}else{throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0x89'));}return _0x4ff2da;})[_0x1cb9('0x1f')](handleEntityNotFound(_0x2fa5b8,null))[_0x1cb9('0x1f')](function(_0x1022d8){return db[_0x1cb9('0x6c')]['findOne']({'attributes':['id','securePassword','enforcePasswordHistory',_0x1cb9('0xa5')]})[_0x1cb9('0x1f')](function(_0x4d887c){if(_0x4d887c[_0x1cb9('0x6e')])authService[_0x1cb9('0xa6')](_0x46f990[_0x1cb9('0x66')]['newPassword']);if(!_0x4d887c[_0x1cb9('0xa7')]||!_0x1022d8[_0x1cb9('0xa8')])return _0x1022d8;authService[_0x1cb9('0xa9')](_0x46f990[_0x1cb9('0x66')][_0x1cb9('0xa2')],_0x1022d8['previousPasswords'],_0x4d887c[_0x1cb9('0xa5')]);return _0x1022d8;})['then'](saveUpdates({'password':_0x46f990['body'][_0x1cb9('0xa2')],'passwordResetAt':_0x46f990[_0x1cb9('0x3a')]['id']==_0x46f990[_0x1cb9('0x68')]['id']?moment():null,'previousPasswords':authService[_0x1cb9('0xaa')](_0x46f990[_0x1cb9('0x66')][_0x1cb9('0xa2')],_0x1022d8[_0x1cb9('0xa8')])},null));})[_0x1cb9('0x1f')](respondWithResult(_0x2fa5b8,null))['catch'](handleError(_0x2fa5b8,null));};exports[_0x1cb9('0xab')]=function(_0x1b259c,_0x370df9,_0x2d8585){var _0x2aed50=_0x1b259c['body'][_0x1cb9('0xac')];return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x1b259c[_0x1cb9('0x68')]['id']},'attributes':['id',_0x1cb9('0x43'),'role',_0x1cb9('0xad'),_0x1cb9('0xae'),_0x1cb9('0xaf'),'interface']})[_0x1cb9('0x1f')](handleEntityNotFound(_0x370df9,null))[_0x1cb9('0x1f')](function(_0x42d642){if(_0x42d642){if(!utils[_0x1cb9('0xb0')](_0x2aed50)){throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))]('Unknown\x20channel');}return _0x42d642[_0x1cb9('0xb1')+_[_0x1cb9('0xb2')](_0x2aed50[_0x1cb9('0xb3')]())+'Queues'](_0x1b259c[_0x1cb9('0x66')][_0x1cb9('0x6b')],{'penalty':_0x1b259c['body']['penalty']||0x0})[_0x1cb9('0xb4')](function(_0x3fc823){for(var _0xe867bd=0x0;_0xe867bd<_0x1b259c[_0x1cb9('0x66')][_0x1cb9('0x6b')]['length'];_0xe867bd+=0x1){var _0x3fdb00={'UserId':_0x1b259c[_0x1cb9('0x68')]['id']};_0x3fdb00[_[_0x1cb9('0xb2')](_0x2aed50[_0x1cb9('0xb3')]())+_0x1cb9('0xb5')]=_0x1b259c['body']['ids'][_0xe867bd];socket[_0x1cb9('0xb6')](_0x1cb9('0x3a')+_[_0x1cb9('0xb2')](_0x2aed50['toLowerCase']())+'Queue:save',_0x3fdb00);}return _0x3fc823;})[_0x1cb9('0x1f')](function(){if(_0x2aed50===_0x1cb9('0xb7')){return db[_0x1cb9('0xb8')]['findAll']({'where':{'id':_0x1b259c['body']['ids']||[]},'raw':!![],'attributes':['id',_0x1cb9('0x43')]});}})[_0x1cb9('0x1f')](function(_0x27995f){var _0x5268fa=_0x42d642[_0x1cb9('0x36')]({'plain':!![]});var _0x5311dd=[];if(_0x2aed50===_0x1cb9('0xb7')&&_0x5268fa[_0x1cb9('0x37')]===_0x1cb9('0x3c')&&_0x5268fa[_0x1cb9('0xad')]){for(var _0x42e789=0x0;_0x42e789<_0x27995f['length'];_0x42e789+=0x1){_0x5311dd[_0x1cb9('0x95')]({'membername':_0x5268fa['name'],'UserId':_0x5268fa['id'],'queue_name':_0x27995f[_0x42e789][_0x1cb9('0x43')],'VoiceQueueId':_0x27995f[_0x42e789]['id'],'interface':_[_0x1cb9('0x72')](_0x5268fa[_0x1cb9('0xb9')])?util[_0x1cb9('0xba')](_0x1cb9('0xbb'),_0x5268fa['name']):_0x5268fa[_0x1cb9('0xb9')],'paused':_0x5268fa[_0x1cb9('0xaf')]||![],'penalty':_0x1b259c[_0x1cb9('0x66')][_0x1cb9('0xbc')]||0x0});}return BPromise[_0x1cb9('0x97')](_0x5311dd,function(_0x42c4d6){return db[_0x1cb9('0xbd')]['upsert'](_0x42c4d6);});}return _0x42d642;});}})['then'](respondWithStatusCode(_0x370df9,null))[_0x1cb9('0x29')](handleError(_0x370df9,null));};exports[_0x1cb9('0xbe')]=function(_0x46fdc2,_0x1cdff0,_0x106fe7){var _0x54b0d0;return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x46fdc2['params']['id']},'attributes':['id','name',_0x1cb9('0x37')]})['then'](handleEntityNotFound(_0x1cdff0,null))[_0x1cb9('0x1f')](function(_0x4af9bb){if(_0x4af9bb){_0x54b0d0=_0x4af9bb;if(!_0x46fdc2[_0x1cb9('0x4e')][_0x1cb9('0xac')]||!utils[_0x1cb9('0xb0')](_0x46fdc2[_0x1cb9('0x4e')][_0x1cb9('0xac')])){throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0xbf'));}return _0x4af9bb[_0x1cb9('0xc0')+_[_0x1cb9('0xb2')](_0x46fdc2[_0x1cb9('0x4e')][_0x1cb9('0xac')]['toLowerCase']())+'Queues'](_0x46fdc2['query']['ids']);}})[_0x1cb9('0x1f')](function(_0xb23270){for(var _0x550877=0x0;_0x550877<_0x46fdc2['query']['ids'][_0x1cb9('0x52')];_0x550877+=0x1){var _0x327c0d={'UserId':_0x46fdc2[_0x1cb9('0x68')]['id']};_0x327c0d[_[_0x1cb9('0xb2')](_0x46fdc2['query'][_0x1cb9('0xac')][_0x1cb9('0xb3')]())+_0x1cb9('0xb5')]=_0x46fdc2['query'][_0x1cb9('0x6b')][_0x550877];socket[_0x1cb9('0xb6')]('user'+_[_0x1cb9('0xb2')](_0x46fdc2['query'][_0x1cb9('0xac')][_0x1cb9('0xb3')]())+_0x1cb9('0xc1'),_0x327c0d);}return _0xb23270;})[_0x1cb9('0x1f')](function(){if(_0x46fdc2[_0x1cb9('0x4e')][_0x1cb9('0xac')]===_0x1cb9('0xb7')){return db['UserVoiceQueueRt'][_0x1cb9('0x35')]({'where':{'UserId':_0x46fdc2[_0x1cb9('0x68')]['id'],'VoiceQueueId':_0x46fdc2[_0x1cb9('0x4e')][_0x1cb9('0x6b')]},'individualHooks':!![]})[_0x1cb9('0x1f')](function(){return _0x54b0d0;});}return _0x54b0d0;})[_0x1cb9('0x1f')](respondWithStatusCode(_0x1cdff0,null))[_0x1cb9('0x29')](handleError(_0x1cdff0,null));};exports[_0x1cb9('0xc2')]=function(_0x181146,_0x394a89,_0x4a050d){_0x181146[_0x1cb9('0x66')][_0x1cb9('0xc3')]=_0x181146[_0x1cb9('0xc4')][_0x1cb9('0xc5')];return db[_0x1cb9('0x47')]['find']({'where':{'id':_0x181146[_0x1cb9('0x68')]['id']}})['then'](handleEntityNotFound(_0x394a89,null))['then'](saveUpdates(_0x181146[_0x1cb9('0x66')],null))[_0x1cb9('0x1f')](respondWithResult(_0x394a89,null))[_0x1cb9('0x29')](handleError(_0x394a89,null));};exports[_0x1cb9('0xc6')]=function(_0x1d45aa,_0x250556,_0x3bc190){var _0x1fad95=path[_0x1cb9('0xc7')](config['root'],'server/files/images/logos/default_profile.png');return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x1d45aa[_0x1cb9('0x68')]['id']},'attributes':['id',_0x1cb9('0xc3')],'raw':!![]})[_0x1cb9('0x1f')](handleEntityNotFound(_0x250556,null))[_0x1cb9('0x1f')](function(_0x27f056){if(_0x27f056){if(_[_0x1cb9('0x72')](_0x27f056[_0x1cb9('0xc3')])){return _0x250556[_0x1cb9('0xc8')](_0x1fad95);}else{if(!fs['existsSync'](path[_0x1cb9('0xc7')](config[_0x1cb9('0xc9')],_0x1cb9('0xca'),_0x27f056[_0x1cb9('0xc3')]))){return _0x250556[_0x1cb9('0xc8')](_0x1fad95);}return _0x250556[_0x1cb9('0xc8')](path['join'](config[_0x1cb9('0xc9')],_0x1cb9('0xca'),_0x27f056[_0x1cb9('0xc3')]));}}})[_0x1cb9('0x29')](handleError(_0x250556,null));};exports[_0x1cb9('0xcb')]=function(_0x1bf6a4,_0x44dbc8,_0x592e22){var _0x200ad9={};var _0x1c1dc0={};var _0x276900;var _0x45c0e6;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x1bf6a4[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x44dbc8,null))[_0x1cb9('0x1f')](function(_0x42622e){if(_0x42622e){_0x276900=_0x42622e;_0x1c1dc0[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db[_0x1cb9('0xcd')][_0x1cb9('0x48')]);_0x1c1dc0[_0x1cb9('0x4e')]=_[_0x1cb9('0x4d')](_0x1bf6a4[_0x1cb9('0x4e')]);_0x1c1dc0[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x1c1dc0[_0x1cb9('0x4f')],_0x1c1dc0[_0x1cb9('0x4e')]);_0x200ad9[_0x1cb9('0x50')]=_['intersection'](_0x1c1dc0[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x200ad9[_0x1cb9('0x50')]=_0x200ad9[_0x1cb9('0x50')]['length']?_0x200ad9[_0x1cb9('0x50')]:_0x1c1dc0['model'];_0x200ad9[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x1bf6a4[_0x1cb9('0x4e')]['sort']);_0x200ad9[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_[_0x1cb9('0x59')](_0x1bf6a4[_0x1cb9('0x4e')],_0x1c1dc0['filters']));if(_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x200ad9[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x200ad9['where'],{'$or':_[_0x1cb9('0x40')](_0x200ad9[_0x1cb9('0x50')],function(_0x574001){var _0x21d844={};_0x21d844[_0x574001]={'$like':'%'+_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x21d844;})});}_0x200ad9=_[_0x1cb9('0x5a')]({},_0x200ad9,_0x1bf6a4[_0x1cb9('0x5f')]);return _0x276900[_0x1cb9('0xcb')](_0x200ad9);}})[_0x1cb9('0x1f')](function(_0x78d2bc){if(_0x78d2bc){_0x45c0e6=_0x78d2bc[_0x1cb9('0x52')];if(_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0x53')]('includeAll')){_0x200ad9[_0x1cb9('0x60')]=[{'model':db['CmList'],'as':_0x1cb9('0xce'),'required':![]},{'model':db[_0x1cb9('0xcf')],'as':_0x1cb9('0xd0'),'attributes':['id',_0x1cb9('0x43'),_0x1cb9('0xd1')],'where':_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0xd2')]?{'id':_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0xd2')]}:undefined,'required':_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0xd2')]?!![]:![]}];}if(!_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0x53')]('nolimit')){_0x200ad9[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x1bf6a4[_0x1cb9('0x4e')]['limit']);_0x200ad9['offset']=qs['offset'](_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x276900['getContacts'](_0x200ad9);}})[_0x1cb9('0x1f')](function(_0x31627f){if(_0x31627f){return _0x31627f?{'count':_0x45c0e6,'rows':_0x31627f}:null;}})[_0x1cb9('0x1f')](respondWithResult(_0x44dbc8,null))[_0x1cb9('0x29')](handleError(_0x44dbc8,null));};exports[_0x1cb9('0xd3')]=function(_0x5b2928,_0x18792b,_0x149b0c){var _0x259727;var _0x1b0aae;var _0x566572={};var _0x4adc16;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x5b2928[_0x1cb9('0x68')]['id']},'attributes':['id',_0x1cb9('0x43'),_0x1cb9('0x37')]})['then'](handleEntityNotFound(_0x18792b,null))[_0x1cb9('0x1f')](function(_0x436e30){if(!utils[_0x1cb9('0xb0')](_0x5b2928[_0x1cb9('0x4e')][_0x1cb9('0xac')])){throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0xbf'));}_0x259727=_0x436e30;var _0xa43246={};_0xa43246[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db[_['capitalize'](_0x5b2928[_0x1cb9('0x4e')][_0x1cb9('0xac')])+'Queue'][_0x1cb9('0x48')]);_0xa43246['query']=_[_0x1cb9('0x4d')](_0x5b2928[_0x1cb9('0x4e')]);_0xa43246[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0xa43246[_0x1cb9('0x4f')],_0xa43246[_0x1cb9('0x4e')]);_0x566572[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0xa43246[_0x1cb9('0x4f')],qs['fields'](_0x5b2928['query']['fields']));_0x566572[_0x1cb9('0x50')]=_0x566572[_0x1cb9('0x50')][_0x1cb9('0x52')]?_0x566572['attributes']:_0xa43246[_0x1cb9('0x4f')];_0x566572[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x5b2928[_0x1cb9('0x4e')]['sort']);_0x566572['where']=qs[_0x1cb9('0x58')](_[_0x1cb9('0x59')](_0x5b2928['query'],_0xa43246[_0x1cb9('0x58')]));if(_0x5b2928[_0x1cb9('0x4e')]['filter']){_0x566572[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x566572[_0x1cb9('0x57')],{'$or':_['map'](_0x566572['attributes'],function(_0x3d9610){var _0x73fc01={};_0x73fc01[_0x3d9610]={'$like':'%'+_0x5b2928['query'][_0x1cb9('0x3e')]+'%'};return _0x73fc01;})});}_0x566572=_[_0x1cb9('0x5a')]({},_0x566572,_0x5b2928[_0x1cb9('0x5f')]);switch(_0x259727[_0x1cb9('0x37')]){case'admin':return db[_[_0x1cb9('0xb2')](_0x5b2928[_0x1cb9('0x4e')][_0x1cb9('0xac')])+_0x1cb9('0xd4')][_0x1cb9('0x61')](_0x566572);case'user':case _0x1cb9('0x3c'):return _0x259727['get'+_[_0x1cb9('0xb2')](_0x5b2928['query'][_0x1cb9('0xac')])+'Queues'](_0x566572);default:throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0xd5'));}})[_0x1cb9('0x1f')](function(_0x3f54a8){_0x4adc16=_0x3f54a8[_0x1cb9('0x52')];if(!_0x5b2928[_0x1cb9('0x4e')][_0x1cb9('0x53')]('nolimit')){_0x566572[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x5b2928[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x566572[_0x1cb9('0x2f')]=qs[_0x1cb9('0x2f')](_0x5b2928['query']['offset']);}switch(_0x259727[_0x1cb9('0x37')]){case _0x1cb9('0x38'):return db[_[_0x1cb9('0xb2')](_0x5b2928[_0x1cb9('0x4e')][_0x1cb9('0xac')])+_0x1cb9('0xd4')]['findAll'](_0x566572);case'user':case _0x1cb9('0x3c'):return _0x259727[_0x1cb9('0x36')+_[_0x1cb9('0xb2')](_0x5b2928['query'][_0x1cb9('0xac')])+_0x1cb9('0xd6')](_0x566572);}})[_0x1cb9('0x1f')](function(_0x490100){return{'count':_0x4adc16,'rows':_0x490100};})[_0x1cb9('0x1f')](respondWithResult(_0x18792b,null))[_0x1cb9('0x29')](handleError(_0x18792b,null));};exports[_0x1cb9('0xd7')]=function(_0xb3ff97,_0x24eaec,_0x182ca2){var _0x22340d={};var _0x3979bb={};var _0x3f445f;var _0x7b0437;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0xb3ff97['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x24eaec,null))['then'](function(_0x47bb20){if(_0x47bb20){_0x3f445f=_0x47bb20;_0x3979bb['model']=_['keys'](db[_0x1cb9('0xbd')][_0x1cb9('0x48')]);_0x3979bb['query']=_[_0x1cb9('0x4d')](_0xb3ff97['query']);_0x3979bb[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x3979bb[_0x1cb9('0x4f')],_0x3979bb['query']);_0x22340d[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0x3979bb[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0xb3ff97[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x22340d[_0x1cb9('0x50')]=_0x22340d[_0x1cb9('0x50')]['length']?_0x22340d[_0x1cb9('0x50')]:_0x3979bb['model'];_0x22340d[_0x1cb9('0x55')]=qs['sort'](_0xb3ff97[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x22340d[_0x1cb9('0x57')]=qs['filters'](_[_0x1cb9('0x59')](_0xb3ff97[_0x1cb9('0x4e')],_0x3979bb[_0x1cb9('0x58')]));if(_0xb3ff97[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x22340d['where']=_[_0x1cb9('0x5a')](_0x22340d[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x22340d['attributes'],function(_0x27840b){var _0x1978d3={};_0x1978d3[_0x27840b]={'$like':'%'+_0xb3ff97[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x1978d3;})});}_0x22340d=_['merge']({},_0x22340d,_0xb3ff97[_0x1cb9('0x5f')]);return _0x3f445f['getVoiceQueuesRt'](_0x22340d);}})['then'](function(_0x327071){if(_0x327071){_0x7b0437=_0x327071['length'];if(!_0xb3ff97[_0x1cb9('0x4e')]['hasOwnProperty'](_0x1cb9('0x54'))){_0x22340d[_0x1cb9('0x30')]=qs['limit'](_0xb3ff97[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x22340d[_0x1cb9('0x2f')]=qs[_0x1cb9('0x2f')](_0xb3ff97[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x3f445f['getVoiceQueuesRt'](_0x22340d);}})[_0x1cb9('0x1f')](function(_0x45a7a4){if(_0x45a7a4){return _0x45a7a4?{'count':_0x7b0437,'rows':_0x45a7a4}:null;}})[_0x1cb9('0x1f')](respondWithResult(_0x24eaec,null))[_0x1cb9('0x29')](handleError(_0x24eaec,null));};exports[_0x1cb9('0xd8')]=function(_0x170033,_0x5caa7c,_0x5a4d77){var _0x3f3ff9={};var _0x203478={};var _0x2f5705;var _0x33bfc1;return db['User'][_0x1cb9('0xcc')]({'where':{'id':_0x170033[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x5caa7c,null))['then'](function(_0x410c9f){if(_0x410c9f){_0x2f5705=_0x410c9f;_0x203478[_0x1cb9('0x4f')]=_['keys'](db[_0x1cb9('0xd9')][_0x1cb9('0x48')]);_0x203478['query']=_[_0x1cb9('0x4d')](_0x170033[_0x1cb9('0x4e')]);_0x203478[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x203478[_0x1cb9('0x4f')],_0x203478[_0x1cb9('0x4e')]);_0x3f3ff9[_0x1cb9('0x50')]=_['intersection'](_0x203478[_0x1cb9('0x4f')],qs['fields'](_0x170033[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x3f3ff9[_0x1cb9('0x50')]=_0x3f3ff9[_0x1cb9('0x50')]['length']?_0x3f3ff9[_0x1cb9('0x50')]:_0x203478[_0x1cb9('0x4f')];_0x3f3ff9[_0x1cb9('0x55')]=qs['sort'](_0x170033[_0x1cb9('0x4e')]['sort']);_0x3f3ff9['where']=qs[_0x1cb9('0x58')](_['pick'](_0x170033[_0x1cb9('0x4e')],_0x203478['filters']));if(_0x170033[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x3f3ff9[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x3f3ff9[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x3f3ff9[_0x1cb9('0x50')],function(_0x3cbd38){var _0x1a4b8c={};_0x1a4b8c[_0x3cbd38]={'$like':'%'+_0x170033[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x1a4b8c;})});}_0x3f3ff9=_[_0x1cb9('0x5a')]({},_0x3f3ff9,_0x170033[_0x1cb9('0x5f')]);return _0x2f5705['getGroups'](_0x3f3ff9);}})[_0x1cb9('0x1f')](function(_0x183798){if(_0x183798){_0x33bfc1=_0x183798['length'];if(!_0x170033['query'][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x3f3ff9[_0x1cb9('0x30')]=qs['limit'](_0x170033[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x3f3ff9['offset']=qs[_0x1cb9('0x2f')](_0x170033[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x2f5705[_0x1cb9('0xd8')](_0x3f3ff9);}})[_0x1cb9('0x1f')](function(_0x3771ef){if(_0x3771ef){return _0x3771ef?{'count':_0x33bfc1,'rows':_0x3771ef}:null;}})['then'](respondWithResult(_0x5caa7c,null))[_0x1cb9('0x29')](handleError(_0x5caa7c,null));};exports['getRecordings']=function(_0x30e969,_0x5ef01e,_0x3680dd){var _0x1a808a={'raw':!![],'where':{}};var _0x45d912={};var _0x451250={'count':0x0,'rows':[]};return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x30e969['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x5ef01e,null))[_0x1cb9('0x1f')](function(_0x4169d9){if(_0x4169d9){_0x45d912['model']=_['keys'](db[_0x1cb9('0xda')]['rawAttributes']);_0x45d912[_0x1cb9('0x4e')]=_[_0x1cb9('0x4d')](_0x30e969['query']);_0x45d912[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x45d912[_0x1cb9('0x4f')],_0x45d912[_0x1cb9('0x4e')]);_0x1a808a[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0x45d912[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x30e969[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x1a808a[_0x1cb9('0x50')]=_0x1a808a[_0x1cb9('0x50')]['length']?_0x1a808a[_0x1cb9('0x50')]:_0x45d912[_0x1cb9('0x4f')];if(!_0x30e969[_0x1cb9('0x4e')][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x1a808a['limit']=qs[_0x1cb9('0x30')](_0x30e969[_0x1cb9('0x4e')]['limit']);_0x1a808a[_0x1cb9('0x2f')]=qs[_0x1cb9('0x2f')](_0x30e969[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}_0x1a808a[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x30e969['query'][_0x1cb9('0x56')]);_0x1a808a[_0x1cb9('0x57')]=qs['filters'](_[_0x1cb9('0x59')](_0x30e969[_0x1cb9('0x4e')],_0x45d912[_0x1cb9('0x58')]));_0x1a808a['where']['UserId']=_0x4169d9['id'];if(_0x30e969[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x1a808a[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x1a808a[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x1a808a[_0x1cb9('0x50')],function(_0x4c62ad){var _0x52fdb2={};_0x52fdb2[_0x4c62ad]={'$like':'%'+_0x30e969['query'][_0x1cb9('0x3e')]+'%'};return _0x52fdb2;})});}_0x1a808a=_['merge']({},_0x1a808a,_0x30e969[_0x1cb9('0x5f')]);return db[_0x1cb9('0xda')][_0x1cb9('0x2e')]({'where':_0x1a808a[_0x1cb9('0x57')]})[_0x1cb9('0x1f')](function(_0x550dca){_0x451250[_0x1cb9('0x2e')]=_0x550dca;if(_0x30e969['query']['includeAll']){_0x1a808a[_0x1cb9('0x60')]=[{'all':!![]}];}return db[_0x1cb9('0xda')][_0x1cb9('0x61')](_0x1a808a);})['then'](function(_0x46c7fe){_0x451250[_0x1cb9('0xdb')]=_0x46c7fe;return _0x451250;});}})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x5ef01e,_0x1a808a))[_0x1cb9('0x29')](handleError(_0x5ef01e,null));};exports[_0x1cb9('0xdc')]=function(_0x3b8cdb,_0x60cc43,_0x3ab9a0){var _0x30e355={'raw':!![],'where':{}};var _0x2bf661={};var _0x117b81={'count':0x0,'rows':[]};return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x3b8cdb[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x60cc43,null))['then'](function(_0x399138){if(_0x399138){_0x2bf661['model']=_['keys'](db[_0x1cb9('0xdd')][_0x1cb9('0x48')]);_0x2bf661[_0x1cb9('0x4e')]=_[_0x1cb9('0x4d')](_0x3b8cdb[_0x1cb9('0x4e')]);_0x2bf661[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x2bf661['model'],_0x2bf661['query']);_0x30e355['attributes']=_[_0x1cb9('0x51')](_0x2bf661[_0x1cb9('0x4f')],qs['fields'](_0x3b8cdb['query'][_0x1cb9('0x64')]));_0x30e355[_0x1cb9('0x50')]=_0x30e355[_0x1cb9('0x50')]['length']?_0x30e355[_0x1cb9('0x50')]:_0x2bf661[_0x1cb9('0x4f')];if(!_0x3b8cdb['query'][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x30e355[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x3b8cdb[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x30e355['offset']=qs['offset'](_0x3b8cdb['query'][_0x1cb9('0x2f')]);}_0x30e355['order']=qs['sort'](_0x3b8cdb[_0x1cb9('0x4e')]['sort']);_0x30e355[_0x1cb9('0x57')]=qs['filters'](_[_0x1cb9('0x59')](_0x3b8cdb['query'],_0x2bf661[_0x1cb9('0x58')]));_0x30e355['where'][_0x1cb9('0xde')]=_0x399138['id'];if(_0x3b8cdb[_0x1cb9('0x4e')]['filter']){_0x30e355[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x30e355[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x30e355[_0x1cb9('0x50')],function(_0x5e7e2e){var _0x268601={};_0x268601[_0x5e7e2e]={'$like':'%'+_0x3b8cdb['query'][_0x1cb9('0x3e')]+'%'};return _0x268601;})});}_0x30e355=_[_0x1cb9('0x5a')]({},_0x30e355,_0x3b8cdb[_0x1cb9('0x5f')]);return db[_0x1cb9('0xdd')][_0x1cb9('0x2e')]({'where':_0x30e355[_0x1cb9('0x57')]})[_0x1cb9('0x1f')](function(_0x46b009){_0x117b81['count']=_0x46b009;if(_0x3b8cdb['query']['includeAll']){_0x30e355[_0x1cb9('0x60')]=[{'all':!![]}];}return db[_0x1cb9('0xdd')][_0x1cb9('0x61')](_0x30e355);})[_0x1cb9('0x1f')](function(_0xbbc101){_0x117b81[_0x1cb9('0xdb')]=_0xbbc101;return _0x117b81;});}})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x60cc43,_0x30e355))[_0x1cb9('0x29')](handleError(_0x60cc43,null));};exports[_0x1cb9('0xdf')]=function(_0x49bd15,_0x4997ad,_0x318a4c){var _0x35d396={};var _0x2c68b9={};var _0x44fbbc;var _0x3eb851;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x49bd15[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x4997ad,null))[_0x1cb9('0x1f')](function(_0x4c6764){if(_0x4c6764){_0x44fbbc=_0x4c6764;_0x2c68b9[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db[_0x1cb9('0xe0')][_0x1cb9('0x48')]);_0x2c68b9['query']=_[_0x1cb9('0x4d')](_0x49bd15[_0x1cb9('0x4e')]);_0x2c68b9[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x2c68b9['model'],_0x2c68b9[_0x1cb9('0x4e')]);_0x35d396[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0x2c68b9[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x49bd15[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x35d396[_0x1cb9('0x50')]=_0x35d396['attributes']['length']?_0x35d396['attributes']:_0x2c68b9[_0x1cb9('0x4f')];_0x35d396['order']=qs['sort'](_0x49bd15[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x35d396['where']=qs[_0x1cb9('0x58')](_[_0x1cb9('0x59')](_0x49bd15['query'],_0x2c68b9[_0x1cb9('0x58')]));if(_0x49bd15[_0x1cb9('0x4e')]['filter']){_0x35d396[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x35d396[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x35d396[_0x1cb9('0x50')],function(_0x3a5195){var _0x4bc4b9={};_0x4bc4b9[_0x3a5195]={'$like':'%'+_0x49bd15['query'][_0x1cb9('0x3e')]+'%'};return _0x4bc4b9;})});}_0x35d396=_[_0x1cb9('0x5a')]({},_0x35d396,_0x49bd15['options']);return _0x44fbbc[_0x1cb9('0xdf')](_0x35d396);}})[_0x1cb9('0x1f')](function(_0x2d6c56){if(_0x2d6c56){_0x3eb851=_0x2d6c56['length'];if(!_0x49bd15['query'][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x35d396['limit']=qs[_0x1cb9('0x30')](_0x49bd15[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x35d396['offset']=qs['offset'](_0x49bd15[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x44fbbc[_0x1cb9('0xdf')](_0x35d396);}})[_0x1cb9('0x1f')](function(_0x511c7b){if(_0x511c7b){return _0x511c7b?{'count':_0x3eb851,'rows':_0x511c7b}:null;}})[_0x1cb9('0x1f')](respondWithResult(_0x4997ad,null))[_0x1cb9('0x29')](handleError(_0x4997ad,null));};exports[_0x1cb9('0xe1')]=function(_0x22b6f9,_0x199eb7,_0x5320e3){var _0x5ec994={};var _0x1d2143={};var _0x358a0b;var _0x1f8e9d;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x22b6f9[_0x1cb9('0x68')]['id']}})['then'](handleEntityNotFound(_0x199eb7,null))[_0x1cb9('0x1f')](function(_0x48ee69){if(_0x48ee69){_0x358a0b=_0x48ee69;_0x1d2143[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db['OpenchannelInteraction']['rawAttributes']);_0x1d2143[_0x1cb9('0x4e')]=_[_0x1cb9('0x4d')](_0x22b6f9['query']);_0x1d2143[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x1d2143[_0x1cb9('0x4f')],_0x1d2143[_0x1cb9('0x4e')]);_0x5ec994[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0x1d2143[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x22b6f9[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x5ec994[_0x1cb9('0x50')]=_0x5ec994[_0x1cb9('0x50')][_0x1cb9('0x52')]?_0x5ec994['attributes']:_0x1d2143[_0x1cb9('0x4f')];_0x5ec994[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x22b6f9[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x5ec994[_0x1cb9('0x57')]=qs['filters'](_[_0x1cb9('0x59')](_0x22b6f9[_0x1cb9('0x4e')],_0x1d2143['filters']));if(_0x22b6f9[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x5ec994['where']=_[_0x1cb9('0x5a')](_0x5ec994[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x5ec994[_0x1cb9('0x50')],function(_0x2a799f){var _0xddc143={};_0xddc143[_0x2a799f]={'$like':'%'+_0x22b6f9['query'][_0x1cb9('0x3e')]+'%'};return _0xddc143;})});}_0x5ec994=_[_0x1cb9('0x5a')]({},_0x5ec994,_0x22b6f9[_0x1cb9('0x5f')]);return _0x358a0b['getOpenchannelInteractions'](_0x5ec994);}})[_0x1cb9('0x1f')](function(_0x4af331){if(_0x4af331){_0x1f8e9d=_0x4af331['length'];if(!_0x22b6f9[_0x1cb9('0x4e')][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x5ec994[_0x1cb9('0x30')]=qs['limit'](_0x22b6f9[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x5ec994[_0x1cb9('0x2f')]=qs[_0x1cb9('0x2f')](_0x22b6f9[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x358a0b[_0x1cb9('0xe1')](_0x5ec994);}})['then'](function(_0x14978e){if(_0x14978e){return _0x14978e?{'count':_0x1f8e9d,'rows':_0x14978e}:null;}})[_0x1cb9('0x1f')](respondWithResult(_0x199eb7,null))[_0x1cb9('0x29')](handleError(_0x199eb7,null));};exports['getMailInteractions']=function(_0x20db03,_0x572ef7,_0x396540){var _0x4561cc={'raw':!![],'where':{}};var _0x2733af={};var _0x1e3826={'count':0x0,'rows':[]};return db[_0x1cb9('0x47')]['findOne']({'where':{'id':_0x20db03['params']['id']}})['then'](handleEntityNotFound(_0x572ef7,null))['then'](function(_0x1b685d){if(_0x1b685d){_0x2733af['model']=_[_0x1cb9('0x4d')](db['MailInteraction'][_0x1cb9('0x48')]);_0x2733af[_0x1cb9('0x4e')]=_[_0x1cb9('0x4d')](_0x20db03[_0x1cb9('0x4e')]);_0x2733af[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x2733af[_0x1cb9('0x4f')],_0x2733af[_0x1cb9('0x4e')]);_0x4561cc['attributes']=_[_0x1cb9('0x51')](_0x2733af[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x20db03[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x4561cc['attributes']=_0x4561cc['attributes'][_0x1cb9('0x52')]?_0x4561cc['attributes']:_0x2733af['model'];if(!_0x20db03['query'][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x4561cc[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x20db03[_0x1cb9('0x4e')]['limit']);_0x4561cc[_0x1cb9('0x2f')]=qs[_0x1cb9('0x2f')](_0x20db03['query'][_0x1cb9('0x2f')]);}_0x4561cc[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x20db03[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x4561cc[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_['pick'](_0x20db03[_0x1cb9('0x4e')],_0x2733af['filters']));_0x4561cc['where'][_0x1cb9('0xde')]=_0x1b685d['id'];if(_0x20db03['query'][_0x1cb9('0x3e')]){_0x4561cc[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x4561cc['where'],{'$or':_[_0x1cb9('0x40')](_0x4561cc[_0x1cb9('0x50')],function(_0x72f476){var _0x2e6004={};_0x2e6004[_0x72f476]={'$like':'%'+_0x20db03[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x2e6004;})});}_0x4561cc=_['merge']({},_0x4561cc,_0x20db03[_0x1cb9('0x5f')]);return db[_0x1cb9('0xe2')]['count']({'where':_0x4561cc['where']})[_0x1cb9('0x1f')](function(_0xa36e89){_0x1e3826[_0x1cb9('0x2e')]=_0xa36e89;if(_0x20db03[_0x1cb9('0x4e')][_0x1cb9('0x65')]){_0x4561cc['include']=[{'all':!![]}];}return db[_0x1cb9('0xe2')]['findAll'](_0x4561cc);})[_0x1cb9('0x1f')](function(_0x46bb8e){_0x1e3826[_0x1cb9('0xdb')]=_0x46bb8e;return _0x1e3826;});}})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x572ef7,_0x4561cc))[_0x1cb9('0x29')](handleError(_0x572ef7,null));};exports['getSmsInteractions']=function(_0x3a151b,_0x53095b,_0x1444db){var _0x5aef8a={};var _0x2d699d={};var _0x37a414;var _0x56042a;return db[_0x1cb9('0x47')]['findOne']({'where':{'id':_0x3a151b[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x53095b,null))['then'](function(_0xd7e084){if(_0xd7e084){_0x37a414=_0xd7e084;_0x2d699d[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db[_0x1cb9('0xe3')]['rawAttributes']);_0x2d699d['query']=_[_0x1cb9('0x4d')](_0x3a151b[_0x1cb9('0x4e')]);_0x2d699d[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x2d699d['model'],_0x2d699d[_0x1cb9('0x4e')]);_0x5aef8a[_0x1cb9('0x50')]=_['intersection'](_0x2d699d[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x3a151b[_0x1cb9('0x4e')]['fields']));_0x5aef8a[_0x1cb9('0x50')]=_0x5aef8a['attributes'][_0x1cb9('0x52')]?_0x5aef8a[_0x1cb9('0x50')]:_0x2d699d['model'];_0x5aef8a[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x3a151b[_0x1cb9('0x4e')]['sort']);_0x5aef8a[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_['pick'](_0x3a151b[_0x1cb9('0x4e')],_0x2d699d[_0x1cb9('0x58')]));if(_0x3a151b[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x5aef8a['where']=_[_0x1cb9('0x5a')](_0x5aef8a['where'],{'$or':_['map'](_0x5aef8a[_0x1cb9('0x50')],function(_0x4c40da){var _0x194eea={};_0x194eea[_0x4c40da]={'$like':'%'+_0x3a151b[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x194eea;})});}_0x5aef8a=_['merge']({},_0x5aef8a,_0x3a151b[_0x1cb9('0x5f')]);return _0x37a414[_0x1cb9('0xe4')](_0x5aef8a);}})[_0x1cb9('0x1f')](function(_0x40f094){if(_0x40f094){_0x56042a=_0x40f094[_0x1cb9('0x52')];if(!_0x3a151b[_0x1cb9('0x4e')][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x5aef8a[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x3a151b[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x5aef8a['offset']=qs[_0x1cb9('0x2f')](_0x3a151b[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x37a414[_0x1cb9('0xe4')](_0x5aef8a);}})[_0x1cb9('0x1f')](function(_0x1e36b8){if(_0x1e36b8){return _0x1e36b8?{'count':_0x56042a,'rows':_0x1e36b8}:null;}})['then'](respondWithResult(_0x53095b,null))[_0x1cb9('0x29')](handleError(_0x53095b,null));};exports[_0x1cb9('0xe5')]=function(_0x12a2c0,_0x43f3af,_0x44ad12){var _0x4801d7={};var _0x189f7b={};var _0x595905;var _0x18186b;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x12a2c0[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x43f3af,null))[_0x1cb9('0x1f')](function(_0x237135){if(_0x237135){_0x595905=_0x237135;_0x189f7b[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db['FaxInteraction']['rawAttributes']);_0x189f7b[_0x1cb9('0x4e')]=_[_0x1cb9('0x4d')](_0x12a2c0[_0x1cb9('0x4e')]);_0x189f7b[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x189f7b[_0x1cb9('0x4f')],_0x189f7b[_0x1cb9('0x4e')]);_0x4801d7['attributes']=_[_0x1cb9('0x51')](_0x189f7b['model'],qs[_0x1cb9('0x64')](_0x12a2c0['query'][_0x1cb9('0x64')]));_0x4801d7[_0x1cb9('0x50')]=_0x4801d7[_0x1cb9('0x50')]['length']?_0x4801d7['attributes']:_0x189f7b[_0x1cb9('0x4f')];_0x4801d7['order']=qs[_0x1cb9('0x56')](_0x12a2c0[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x4801d7[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_['pick'](_0x12a2c0[_0x1cb9('0x4e')],_0x189f7b[_0x1cb9('0x58')]));if(_0x12a2c0[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x4801d7[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x4801d7[_0x1cb9('0x57')],{'$or':_['map'](_0x4801d7[_0x1cb9('0x50')],function(_0x48f353){var _0x501ea0={};_0x501ea0[_0x48f353]={'$like':'%'+_0x12a2c0[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x501ea0;})});}_0x4801d7=_['merge']({},_0x4801d7,_0x12a2c0[_0x1cb9('0x5f')]);return _0x595905[_0x1cb9('0xe5')](_0x4801d7);}})[_0x1cb9('0x1f')](function(_0x1d032b){if(_0x1d032b){_0x18186b=_0x1d032b[_0x1cb9('0x52')];if(!_0x12a2c0[_0x1cb9('0x4e')]['hasOwnProperty'](_0x1cb9('0x54'))){_0x4801d7['limit']=qs[_0x1cb9('0x30')](_0x12a2c0[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x4801d7['offset']=qs['offset'](_0x12a2c0[_0x1cb9('0x4e')]['offset']);}return _0x595905['getFaxInteractions'](_0x4801d7);}})[_0x1cb9('0x1f')](function(_0x2a4bca){if(_0x2a4bca){return _0x2a4bca?{'count':_0x18186b,'rows':_0x2a4bca}:null;}})['then'](respondWithResult(_0x43f3af,null))[_0x1cb9('0x29')](handleError(_0x43f3af,null));};exports[_0x1cb9('0xe6')]=function(_0x1e676d,_0x6dfbd0,_0x34a654){var _0x5756c8={};var _0xc369a={};var _0x45865e;var _0x241e05;return db[_0x1cb9('0x47')]['findOne']({'where':{'id':_0x1e676d[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x6dfbd0,null))['then'](function(_0x230de0){if(_0x230de0){_0x45865e=_0x230de0;_0xc369a['model']=_[_0x1cb9('0x4d')](db[_0x1cb9('0xe7')][_0x1cb9('0x48')]);_0xc369a[_0x1cb9('0x4e')]=_['keys'](_0x1e676d[_0x1cb9('0x4e')]);_0xc369a['filters']=_[_0x1cb9('0x51')](_0xc369a[_0x1cb9('0x4f')],_0xc369a[_0x1cb9('0x4e')]);_0x5756c8[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0xc369a[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x1e676d[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x5756c8[_0x1cb9('0x50')]=_0x5756c8[_0x1cb9('0x50')][_0x1cb9('0x52')]?_0x5756c8['attributes']:_0xc369a[_0x1cb9('0x4f')];_0x5756c8[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x1e676d[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x5756c8[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_[_0x1cb9('0x59')](_0x1e676d['query'],_0xc369a[_0x1cb9('0x58')]));if(_0x1e676d[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x5756c8['where']=_[_0x1cb9('0x5a')](_0x5756c8['where'],{'$or':_[_0x1cb9('0x40')](_0x5756c8[_0x1cb9('0x50')],function(_0x575392){var _0x4e0ed8={};_0x4e0ed8[_0x575392]={'$like':'%'+_0x1e676d[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x4e0ed8;})});}_0x5756c8=_[_0x1cb9('0x5a')]({},_0x5756c8,_0x1e676d[_0x1cb9('0x5f')]);return _0x45865e[_0x1cb9('0xe6')](_0x5756c8);}})['then'](function(_0x54f8e6){if(_0x54f8e6){_0x241e05=_0x54f8e6['length'];if(!_0x1e676d[_0x1cb9('0x4e')][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x5756c8[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x1e676d[_0x1cb9('0x4e')]['limit']);_0x5756c8['offset']=qs[_0x1cb9('0x2f')](_0x1e676d[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x45865e[_0x1cb9('0xe6')](_0x5756c8);}})['then'](function(_0x31fefb){if(_0x31fefb){return _0x31fefb?{'count':_0x241e05,'rows':_0x31fefb}:null;}})[_0x1cb9('0x1f')](respondWithResult(_0x6dfbd0,null))[_0x1cb9('0x29')](handleError(_0x6dfbd0,null));};exports[_0x1cb9('0xe8')]=function(_0x18ca2d,_0x2ac02b,_0x53a57e){var _0x50b0f6;var _0x499e3c;var _0x39627c;var _0x3bf219=!_['isNil'](_0x18ca2d[_0x1cb9('0x68')]['id'])?_0x18ca2d['params']['id']:!_[_0x1cb9('0x72')](_0x18ca2d[_0x1cb9('0x3a')]['id'])?_0x18ca2d[_0x1cb9('0x3a')]['id']:null;return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x3bf219,'role':{'$or':[_0x1cb9('0x38'),_0x1cb9('0x3a'),_0x1cb9('0x3c')]}},'attributes':['id',_0x1cb9('0x43'),_0x1cb9('0xe9'),_0x1cb9('0xea'),_0x1cb9('0x37'),_0x1cb9('0x70'),_0x1cb9('0xae')]})['then'](function(_0x23eef2){if(_0x23eef2){if(_0x23eef2[_0x1cb9('0x37')]===_0x1cb9('0x3c')){_0x50b0f6=_0x23eef2;if(_0x18ca2d[_0x1cb9('0x66')]['interface']){_0x39627c=util[_0x1cb9('0xba')](_0x1cb9('0xeb'),_0x50b0f6[_0x18ca2d[_0x1cb9('0x66')][_0x1cb9('0xb9')]]);}else if(_0x18ca2d[_0x1cb9('0x66')]['intrf']){_0x39627c=util[_0x1cb9('0xba')](_0x1cb9('0xbb'),_0x18ca2d[_0x1cb9('0x66')][_0x1cb9('0xec')]);}else{_0x39627c=util[_0x1cb9('0xba')](_0x1cb9('0xbb'),_0x50b0f6[_0x1cb9('0x43')]);}socket['to'](util['format'](_0x1cb9('0xed'),_0x50b0f6[_0x1cb9('0x43')]))[_0x1cb9('0xb6')](_0x1cb9('0xee'),{'user':{'id':_0x50b0f6['id'],'name':_0x50b0f6[_0x1cb9('0x43')]},'ip':_0x18ca2d['headers'][_0x1cb9('0xef')]||_0x18ca2d[_0x1cb9('0xf0')][_0x1cb9('0xf1')]||_0x18ca2d[_0x1cb9('0xf2')][_0x1cb9('0xf1')]||_0x18ca2d[_0x1cb9('0xf0')]['socket'][_0x1cb9('0xf1')]});return db[_0x1cb9('0xbd')]['destroy']({'where':{'membername':_0x50b0f6[_0x1cb9('0x43')]},'individualHooks':!![]});}}else{throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0xf3'));}})[_0x1cb9('0x1f')](function(){if(_0x50b0f6){return _0x50b0f6[_0x1cb9('0xf4')]({'raw':!![]});}})[_0x1cb9('0x1f')](function(_0x2d6701){if(_0x50b0f6){var _0x3b697f=[];if(_0x2d6701){_0x499e3c=_0x2d6701;if(_0x499e3c[_0x1cb9('0x52')]){for(var _0x5494e4=0x0;_0x5494e4<_0x499e3c[_0x1cb9('0x52')];_0x5494e4++){_0x3b697f['push']({'membername':_0x50b0f6[_0x1cb9('0x43')],'UserId':_0x50b0f6['id'],'queue_name':_0x499e3c[_0x5494e4][_0x1cb9('0x43')],'VoiceQueueId':_0x499e3c[_0x5494e4]['id'],'interface':_0x39627c,'paused':_0x50b0f6['loginInPause']||![],'penalty':_0x499e3c[_0x5494e4][_0x1cb9('0xf5')]||0x0});}return BPromise['each'](_0x3b697f,function(_0x25b3f0){return db[_0x1cb9('0xbd')]['upsert'](_0x25b3f0);});}}}})['then'](function(){if(_0x50b0f6){return db[_0x1cb9('0xf6')]['findAll']({'where':{'membername':_0x50b0f6[_0x1cb9('0x43')],'exitAt':null}});}})[_0x1cb9('0x1f')](function(_0x258670){if(_0x50b0f6){var _0x375a3e=[];_0x258670[_0x1cb9('0xf7')](function(_0x55f632){_0x375a3e[_0x1cb9('0x95')](_0x55f632[_0x1cb9('0x34')]({'exitAt':moment()[_0x1cb9('0xba')](_0x1cb9('0xf8'))}));});return BPromise[_0x1cb9('0x96')](_0x375a3e);}})[_0x1cb9('0x1f')](function(){if(_0x50b0f6){var _0x4f383c=[];var _0x426757=[];var _0x4a3947=utils[_0x1cb9('0xf9')]();var _0x55eaf9={'membername':_0x50b0f6['name'],'interface':_0x39627c,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x50b0f6[_0x1cb9('0x37')],'internal':_0x50b0f6[_0x1cb9('0x70')]};_0x4a3947[_0x1cb9('0xf7')](function(_0x16b437){_0x4f383c[_0x1cb9('0x95')](_[_0x1cb9('0x5a')]({'channel':_0x16b437,'type':_0x1cb9('0xfa'),'data1':_0x18ca2d[_0x1cb9('0x66')][_0x1cb9('0xfb')],'data2':_0x39627c},_0x55eaf9));if(_0x50b0f6['loginInPause']){_0x426757[_0x1cb9('0x95')](_[_0x1cb9('0x5a')]({'channel':_0x16b437,'type':_0x1cb9('0xfc'),'data1':_0x1cb9('0xfd')},_0x55eaf9));}});return db[_0x1cb9('0xf6')][_0x1cb9('0x93')](_0x4f383c[_0x1cb9('0xfe')](_0x426757),{'individualHooks':!![]});}})[_0x1cb9('0x1f')](function(){if(_0x50b0f6){return _0x50b0f6['update']({'online':!![],'lastLoginAt':moment()[_0x1cb9('0xba')](_0x1cb9('0xf8')),'voicePause':_0x50b0f6['loginInPause']||![],'mailPause':_0x50b0f6[_0x1cb9('0xae')]||![],'chatPause':_0x50b0f6[_0x1cb9('0xae')]||![],'faxPause':_0x50b0f6[_0x1cb9('0xae')]||![],'smsPause':_0x50b0f6[_0x1cb9('0xae')]||![],'openchannelPause':_0x50b0f6['loginInPause']||![],'whatsappPause':_0x50b0f6[_0x1cb9('0xae')]||![],'pauseType':_0x50b0f6[_0x1cb9('0xae')]?_0x1cb9('0xfd'):null,'interface':_0x39627c,'lastPauseAt':moment()[_0x1cb9('0xba')](_0x1cb9('0xf8'))});}})[_0x1cb9('0x1f')](function(_0x36c51b){if(_0x18ca2d[_0x1cb9('0xff')]){return _0x53a57e();}else{return BPromise[_0x1cb9('0x100')](_0x36c51b)[_0x1cb9('0x1f')](respondWithResult(_0x2ac02b,null));}})[_0x1cb9('0x29')](handleError(_0x2ac02b,null));};exports[_0x1cb9('0x101')]=function(_0x3f9b5d,_0x170b32,_0x5c0b29){var _0xad25cc;return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x3f9b5d[_0x1cb9('0x68')]['id'],'role':_0x1cb9('0x3c')},'attributes':['id','name',_0x1cb9('0x37')]})[_0x1cb9('0x1f')](handleEntityNotFound(_0x170b32,null))['then'](function(_0x4ec491){if(_0x4ec491){_0xad25cc=_0x4ec491;return db['UserVoiceQueueRt'][_0x1cb9('0x35')]({'where':{'membername':_0xad25cc['name']},'individualHooks':!![]});}})[_0x1cb9('0x1f')](function(){return db['MemberReport'][_0x1cb9('0x61')]({'where':{'membername':_0xad25cc['name'],'exitAt':null}});})[_0x1cb9('0x1f')](function(_0x3f2e56){var _0x5cfb57=[];_0x3f2e56[_0x1cb9('0xf7')](function(_0x4e9b4e){_0x5cfb57[_0x1cb9('0x95')](_0x4e9b4e[_0x1cb9('0x34')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x1cb9('0x96')](_0x5cfb57);})[_0x1cb9('0x1f')](function(){return _0xad25cc['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x1cb9('0x1f')](respondWithResult(_0x170b32,null))[_0x1cb9('0x29')](handleError(_0x170b32,null));};exports['pause']=function(_0x59436f,_0x1316fc,_0x4ed004){var _0x63dc58;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x59436f[_0x1cb9('0x68')]['id']},'individualHooks':!![]})[_0x1cb9('0x1f')](function(){return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x59436f['params']['id'],'role':'agent'},'attributes':['id',_0x1cb9('0x43'),'role',_0x1cb9('0x70'),'interface']});})['then'](handleEntityNotFound(_0x1316fc,null))['then'](function(_0x185219){if(_0x185219){_0x63dc58=_0x185219;return respondWithRpcPromise(_0x1cb9('0x102'),_0x1cb9('0x103'),{'id':_0x63dc58['id'],'name':_0x63dc58['name'],'pause':!![]});}})[_0x1cb9('0x1f')](function(){if(_0x63dc58){return db['MemberReport'][_0x1cb9('0x61')]({'where':{'membername':_0x63dc58[_0x1cb9('0x43')],'type':'PAUSE','exitAt':null}});}})[_0x1cb9('0x1f')](function(_0x545f41){if(_0x545f41[_0x1cb9('0x52')]){var _0x284e25=moment()[_0x1cb9('0xba')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x18b543=0x0,_0x1b61be=_0x545f41[_0x1cb9('0x52')];_0x18b543<_0x1b61be;_0x18b543++){_0x545f41[_0x18b543][_0x1cb9('0x104')]({'exitAt':_0x284e25});}}})[_0x1cb9('0x1f')](function(){var _0xf98b70=[];var _0x1151a6=utils[_0x1cb9('0xf9')]();_0x1151a6['forEach'](function(_0x5857c1){_0xf98b70[_0x1cb9('0x95')]({'channel':_0x5857c1,'membername':_0x63dc58[_0x1cb9('0x43')],'interface':_[_0x1cb9('0x72')](_0x63dc58[_0x1cb9('0xb9')])?util[_0x1cb9('0xba')]('SIP/%s',_0x63dc58[_0x1cb9('0x43')]):_0x63dc58[_0x1cb9('0xb9')],'type':'PAUSE','enterAt':moment()[_0x1cb9('0xba')](_0x1cb9('0xf8')),'data1':_0x59436f['body']['type']||_0x1cb9('0x105'),'role':_0x63dc58[_0x1cb9('0x37')],'internal':_0x63dc58[_0x1cb9('0x70')]});});return db[_0x1cb9('0xf6')][_0x1cb9('0x93')](_0xf98b70,{'individualHooks':!![]});})[_0x1cb9('0x1f')](function(){return _0x63dc58['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x59436f[_0x1cb9('0x66')][_0x1cb9('0x106')]||_0x1cb9('0x105'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x1cb9('0x1f')](respondWithResult(_0x1316fc,null))['catch'](handleError(_0x1316fc,null));};exports['unpause']=function(_0x2fa0fe,_0x1e3938,_0x30364b){var _0x1d357a;return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x2fa0fe[_0x1cb9('0x68')]['id']},'attributes':['id',_0x1cb9('0x43'),_0x1cb9('0x37'),'voicePause','mailPause',_0x1cb9('0x107'),_0x1cb9('0x108'),_0x1cb9('0x109'),'smsPause',_0x1cb9('0x10a'),_0x1cb9('0x10b'),'lastPauseAt']})[_0x1cb9('0x1f')](handleEntityNotFound(_0x1e3938,null))['then'](function(_0x440755){if(_0x440755){_0x1d357a=_0x440755;if(_0x2fa0fe['body'][_0x1cb9('0xac')]&&!utils[_0x1cb9('0xb0')](_0x2fa0fe[_0x1cb9('0x66')]['channel'])){throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))]('Unknown\x20channel');}switch(_0x2fa0fe[_0x1cb9('0x66')][_0x1cb9('0xac')]){case _0x1cb9('0xb7'):return respondWithRpcPromise(_0x1cb9('0x102'),'unpause',{'id':_0x1d357a['id'],'name':_0x1d357a[_0x1cb9('0x43')],'pause':![]})['then'](function(){return db[_0x1cb9('0xbd')][_0x1cb9('0x34')]({'paused':0x0},{'where':{'UserId':_0x1d357a['id']},'individualHooks':!![]});})[_0x1cb9('0x1f')](function(){return db[_0x1cb9('0xf6')]['find']({'where':{'channel':_0x2fa0fe[_0x1cb9('0x66')]['channel'],'membername':_0x1d357a[_0x1cb9('0x43')],'type':_0x1cb9('0xfc'),'exitAt':null}});})[_0x1cb9('0x1f')](function(_0x3b60be){if(_0x3b60be){return _0x3b60be[_0x1cb9('0x34')]({'exitAt':moment()[_0x1cb9('0xba')](_0x1cb9('0xf8')),'data2':_0x1cb9('0x10c')},{'individualHooks':!![]});}return null;})[_0x1cb9('0x1f')](function(){return _0x1d357a[_0x1cb9('0x34')]({'voicePause':![]});});case'mail':case _0x1cb9('0x10d'):case _0x1cb9('0x10e'):case _0x1cb9('0x10f'):case'whatsapp':case _0x1cb9('0x110'):return db[_0x1cb9('0xf6')][_0x1cb9('0x67')]({'where':{'channel':_0x2fa0fe['body'][_0x1cb9('0xac')],'membername':_0x1d357a[_0x1cb9('0x43')],'type':_0x1cb9('0xfc'),'exitAt':null}})[_0x1cb9('0x1f')](function(_0x36929e){if(_0x36929e){return _0x36929e[_0x1cb9('0x34')]({'exitAt':moment()['format'](_0x1cb9('0xf8')),'data2':_0x1cb9('0x10c')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x146062={};_[_0x1cb9('0x31')](_0x146062,util['format'](_0x1cb9('0x111'),_0x2fa0fe[_0x1cb9('0x66')]['channel'],_0x1cb9('0x112')),![]);return _0x1d357a[_0x1cb9('0x34')](_0x146062);});default:return respondWithRpcPromise(_0x1cb9('0x102'),_0x1cb9('0x113'),{'id':_0x1d357a['id'],'name':_0x1d357a[_0x1cb9('0x43')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0x1cb9('0x34')]({'paused':0x0},{'where':{'UserId':_0x1d357a['id']}});})[_0x1cb9('0x1f')](function(){return db[_0x1cb9('0xf6')]['findAll']({'where':{'membername':_0x1d357a['name'],'type':_0x1cb9('0xfc'),'exitAt':null}});})[_0x1cb9('0x1f')](function(_0x1f7283){var _0x320daa=[];_0x1f7283['forEach'](function(_0x27ae51){_0x320daa[_0x1cb9('0x95')](_0x27ae51['update']({'exitAt':moment()[_0x1cb9('0xba')](_0x1cb9('0xf8')),'data2':'manual'}));});return BPromise[_0x1cb9('0x96')](_0x320daa);})[_0x1cb9('0x1f')](function(){return _0x1d357a[_0x1cb9('0x34')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x1cb9('0x1f')](respondWithResult(_0x1e3938,null))[_0x1cb9('0x29')](handleError(_0x1e3938,null));};exports[_0x1cb9('0x114')]=function(_0x32655b,_0x168a4b,_0xc18104){var _0x3a6f53={};var _0x1ac4bb={};var _0x4af047;var _0x2da5e5;return db['User'][_0x1cb9('0xcc')]({'where':{'id':_0x32655b[_0x1cb9('0x68')]['id']}})['then'](handleEntityNotFound(_0x168a4b,null))['then'](function(_0x2cad61){if(_0x2cad61){_0x4af047=_0x2cad61;_0x1ac4bb[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db[_0x1cb9('0x115')]['rawAttributes']);_0x1ac4bb['query']=_[_0x1cb9('0x4d')](_0x32655b[_0x1cb9('0x4e')]);_0x1ac4bb[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x1ac4bb[_0x1cb9('0x4f')],_0x1ac4bb[_0x1cb9('0x4e')]);_0x3a6f53[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0x1ac4bb[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x32655b['query'][_0x1cb9('0x64')]));_0x3a6f53[_0x1cb9('0x50')]=_0x3a6f53[_0x1cb9('0x50')][_0x1cb9('0x52')]?_0x3a6f53[_0x1cb9('0x50')]:_0x1ac4bb[_0x1cb9('0x4f')];_0x3a6f53[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x32655b[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x3a6f53[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_[_0x1cb9('0x59')](_0x32655b[_0x1cb9('0x4e')],_0x1ac4bb[_0x1cb9('0x58')]));if(_0x32655b[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x3a6f53[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x3a6f53[_0x1cb9('0x57')],{'$or':_['map'](_0x3a6f53[_0x1cb9('0x50')],function(_0x4aa96f){var _0x4e0f2c={};_0x4e0f2c[_0x4aa96f]={'$like':'%'+_0x32655b[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x4e0f2c;})});}_0x3a6f53=_[_0x1cb9('0x5a')]({},_0x3a6f53,_0x32655b[_0x1cb9('0x5f')]);return _0x4af047[_0x1cb9('0x114')](_0x3a6f53);}})[_0x1cb9('0x1f')](function(_0x3b21f9){if(_0x3b21f9){_0x2da5e5=_0x3b21f9[_0x1cb9('0x52')];if(!_0x32655b[_0x1cb9('0x4e')]['hasOwnProperty']('nolimit')){_0x3a6f53[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x32655b['query'][_0x1cb9('0x30')]);_0x3a6f53[_0x1cb9('0x2f')]=qs[_0x1cb9('0x2f')](_0x32655b[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x4af047[_0x1cb9('0x114')](_0x3a6f53);}})[_0x1cb9('0x1f')](function(_0x2faa13){if(_0x2faa13){return _0x2faa13?{'count':_0x2da5e5,'rows':_0x2faa13}:null;}})[_0x1cb9('0x1f')](respondWithResult(_0x168a4b,null))['catch'](handleError(_0x168a4b,null));};exports['addTeams']=function(_0x4e6a1a,_0x1ec2e0){return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x4e6a1a[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x1ec2e0,null))['then'](function(_0x46f169){if(_0x46f169){var _0x2b71da=_0x46f169[_0x1cb9('0x36')]({'plain':!![]});return _0x46f169[_0x1cb9('0x116')](_0x4e6a1a[_0x1cb9('0x66')][_0x1cb9('0x6b')],_[_0x1cb9('0x117')](_0x4e6a1a[_0x1cb9('0x66')],['ids','id'])||{})[_0x1cb9('0x1f')](function(){for(var _0x268808=0x0;_0x268808<_0x4e6a1a[_0x1cb9('0x66')][_0x1cb9('0x6b')][_0x1cb9('0x52')];_0x268808++){var _0x502fd3=[];db[_0x1cb9('0x115')]['findOne']({'where':{'id':_0x4e6a1a['body'][_0x1cb9('0x6b')][_0x268808]}})[_0x1cb9('0x1f')](function(_0x12305e){_0x502fd3[_0x1cb9('0x95')](_0x12305e[_0x1cb9('0xf4')]()['then'](function(_0x1c0375){for(var _0x163b14=0x0;_0x163b14<_0x1c0375['length'];_0x163b14++){_0x1c0375[_0x163b14][_0x1cb9('0x118')]('channel',_0x1cb9('0x119'));}return _0x1c0375;}));_0x502fd3[_0x1cb9('0x95')](_0x12305e[_0x1cb9('0x11a')]()[_0x1cb9('0x1f')](function(_0x4124f9){for(var _0x10b17e=0x0;_0x10b17e<_0x4124f9[_0x1cb9('0x52')];_0x10b17e++){_0x4124f9[_0x10b17e][_0x1cb9('0x118')](_0x1cb9('0xac'),'Chat');}return _0x4124f9;}));_0x502fd3[_0x1cb9('0x95')](_0x12305e[_0x1cb9('0x11b')]()[_0x1cb9('0x1f')](function(_0x31156b){for(var _0x914f70=0x0;_0x914f70<_0x31156b[_0x1cb9('0x52')];_0x914f70++){_0x31156b[_0x914f70][_0x1cb9('0x118')](_0x1cb9('0xac'),_0x1cb9('0x11c'));}return _0x31156b;}));_0x502fd3[_0x1cb9('0x95')](_0x12305e['getSmsQueues']()[_0x1cb9('0x1f')](function(_0x50afa4){for(var _0x432f23=0x0;_0x432f23<_0x50afa4[_0x1cb9('0x52')];_0x432f23++){_0x50afa4[_0x432f23]['setDataValue'](_0x1cb9('0xac'),_0x1cb9('0x11d'));}return _0x50afa4;}));_0x502fd3['push'](_0x12305e[_0x1cb9('0x11e')]()[_0x1cb9('0x1f')](function(_0x4a434a){for(var _0x1ee6b1=0x0;_0x1ee6b1<_0x4a434a[_0x1cb9('0x52')];_0x1ee6b1++){_0x4a434a[_0x1ee6b1][_0x1cb9('0x118')](_0x1cb9('0xac'),_0x1cb9('0x11f'));}return _0x4a434a;}));_0x502fd3['push'](_0x12305e[_0x1cb9('0x120')]()['then'](function(_0x5e3302){for(var _0x1313c3=0x0;_0x1313c3<_0x5e3302[_0x1cb9('0x52')];_0x1313c3++){_0x5e3302[_0x1313c3]['setDataValue'](_0x1cb9('0xac'),_0x1cb9('0x121'));}return _0x5e3302;}));_0x502fd3[_0x1cb9('0x95')](_0x12305e[_0x1cb9('0x122')]()[_0x1cb9('0x1f')](function(_0x564266){for(var _0xb95366=0x0;_0xb95366<_0x564266['length'];_0xb95366++){_0x564266[_0xb95366][_0x1cb9('0x118')](_0x1cb9('0xac'),'Openchannel');}return _0x564266;}));return BPromise[_0x1cb9('0x96')](_0x502fd3);})[_0x1cb9('0x1f')](function(_0x383fde){var _0x18b557=_['flatten'](_0x383fde);_0x502fd3=[];return db[_0x1cb9('0x5c')][_0x1cb9('0x123')](function(_0x13e6f7){for(var _0x66355e=0x0;_0x66355e<_0x18b557[_0x1cb9('0x52')];_0x66355e++){_0x502fd3[_0x1cb9('0x95')](_0x18b557[_0x66355e][_0x1cb9('0x124')](_0x2b71da['id']),{'transaction':_0x13e6f7});}return BPromise[_0x1cb9('0x96')](_0x502fd3)[_0x1cb9('0x1f')](function(){if(_0x2b71da[_0x1cb9('0xad')]){return BPromise[_0x1cb9('0x97')](_[_0x1cb9('0x3e')](_0x18b557,function(_0x40bed6){return _0x40bed6[_0x1cb9('0x125')](_0x1cb9('0xac'))===_0x1cb9('0x119');}),function(_0x55c15f){return db['UserVoiceQueueRt'][_0x1cb9('0x126')]({'membername':_0x2b71da[_0x1cb9('0x43')],'UserId':_0x2b71da['id'],'queue_name':_0x55c15f['name'],'VoiceQueueId':_0x55c15f['id'],'interface':_[_0x1cb9('0x72')](_0x2b71da[_0x1cb9('0xb9')])?util['format']('SIP/%s',_0x2b71da[_0x1cb9('0x43')]):_0x2b71da[_0x1cb9('0xb9')],'paused':_0x2b71da[_0x1cb9('0xaf')]||![],'penalty':_0x2b71da[_0x1cb9('0xbc')]},{'transaction':_0x13e6f7});});}else{return;}})[_0x1cb9('0x1f')](function(){for(var _0x28b781=0x0;_0x28b781<_0x18b557[_0x1cb9('0x52')];_0x28b781++){var _0x11fd5d=_0x18b557[_0x28b781][_0x1cb9('0x125')](_0x1cb9('0xac'));var _0x13cb56=_0x11fd5d+_0x1cb9('0xb5');socket[_0x1cb9('0xb6')]('user'+_0x11fd5d+'Queue:save',{'UserId':_0x2b71da['id'],['queueField']:_0x18b557[_0x28b781]['id']});}});});});}});}})[_0x1cb9('0x1f')](respondWithStatusCode(_0x1ec2e0,null))['catch'](handleError(_0x1ec2e0,null));};exports[_0x1cb9('0x127')]=function(_0x207977,_0x1e601c){return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x207977['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x1e601c,null))['then'](function(_0x3dbb5e){if(_0x3dbb5e){var _0x23205c=_0x3dbb5e[_0x1cb9('0x36')]({'plain':!![]});var _0x33dc60=_0x207977[_0x1cb9('0x4e')][_0x1cb9('0x6b')];return _0x3dbb5e[_0x1cb9('0x127')](_0x33dc60)[_0x1cb9('0x1f')](function(){for(var _0x5880d4=0x0;_0x5880d4<_0x33dc60[_0x1cb9('0x52')];_0x5880d4++){var _0x444f2e=[];db['Team']['findOne']({'where':{'id':_0x33dc60[_0x5880d4]}})[_0x1cb9('0x1f')](function(_0x1f0186){_0x444f2e[_0x1cb9('0x95')](_0x1f0186[_0x1cb9('0xf4')]()['then'](function(_0xba3d7c){for(var _0x435be0=0x0;_0x435be0<_0xba3d7c['length'];_0x435be0++){_0xba3d7c[_0x435be0][_0x1cb9('0x118')](_0x1cb9('0xac'),_0x1cb9('0x119'));}return _0xba3d7c;}));_0x444f2e[_0x1cb9('0x95')](_0x1f0186[_0x1cb9('0x11a')]()[_0x1cb9('0x1f')](function(_0x1048a4){for(var _0x961db2=0x0;_0x961db2<_0x1048a4[_0x1cb9('0x52')];_0x961db2++){_0x1048a4[_0x961db2][_0x1cb9('0x118')](_0x1cb9('0xac'),'Chat');}return _0x1048a4;}));_0x444f2e['push'](_0x1f0186[_0x1cb9('0x11b')]()[_0x1cb9('0x1f')](function(_0x21dc31){for(var _0x2469b2=0x0;_0x2469b2<_0x21dc31[_0x1cb9('0x52')];_0x2469b2++){_0x21dc31[_0x2469b2][_0x1cb9('0x118')](_0x1cb9('0xac'),_0x1cb9('0x11c'));}return _0x21dc31;}));_0x444f2e[_0x1cb9('0x95')](_0x1f0186[_0x1cb9('0x128')]()[_0x1cb9('0x1f')](function(_0x388ddd){for(var _0x384542=0x0;_0x384542<_0x388ddd['length'];_0x384542++){_0x388ddd[_0x384542]['setDataValue'](_0x1cb9('0xac'),_0x1cb9('0x11d'));}return _0x388ddd;}));_0x444f2e[_0x1cb9('0x95')](_0x1f0186['getWhatsappQueues']()[_0x1cb9('0x1f')](function(_0x5c8a6f){for(var _0x4c36f0=0x0;_0x4c36f0<_0x5c8a6f[_0x1cb9('0x52')];_0x4c36f0++){_0x5c8a6f[_0x4c36f0][_0x1cb9('0x118')]('channel',_0x1cb9('0x11f'));}return _0x5c8a6f;}));_0x444f2e[_0x1cb9('0x95')](_0x1f0186[_0x1cb9('0x120')]()[_0x1cb9('0x1f')](function(_0x184acb){for(var _0x5768bf=0x0;_0x5768bf<_0x184acb[_0x1cb9('0x52')];_0x5768bf++){_0x184acb[_0x5768bf][_0x1cb9('0x118')](_0x1cb9('0xac'),_0x1cb9('0x121'));}return _0x184acb;}));_0x444f2e[_0x1cb9('0x95')](_0x1f0186[_0x1cb9('0x122')]()[_0x1cb9('0x1f')](function(_0x37cc8e){for(var _0x297e9d=0x0;_0x297e9d<_0x37cc8e['length'];_0x297e9d++){_0x37cc8e[_0x297e9d][_0x1cb9('0x118')]('channel',_0x1cb9('0x129'));}return _0x37cc8e;}));return BPromise[_0x1cb9('0x96')](_0x444f2e);})[_0x1cb9('0x1f')](function(_0xd4b57f){var _0x38c0a0=_[_0x1cb9('0x12a')](_0xd4b57f);_0x444f2e=[];return db['sequelize'][_0x1cb9('0x123')](function(_0x249814){for(var _0x3d0200=0x0;_0x3d0200<_0x38c0a0[_0x1cb9('0x52')];_0x3d0200++){_0x444f2e['push'](_0x38c0a0[_0x3d0200][_0x1cb9('0x12b')](_0x23205c['id']),{'transaction':_0x249814});}return BPromise[_0x1cb9('0x96')](_0x444f2e)['then'](function(){if(_0x23205c['online']){return BPromise[_0x1cb9('0x97')](_[_0x1cb9('0x3e')](_0x38c0a0,function(_0x32de36){return _0x32de36[_0x1cb9('0x125')]('channel')==='Voice';}),function(_0x52b267){return db[_0x1cb9('0xbd')]['destroy']({'where':{'VoiceQueueId':_0x52b267['id'],'UserId':_0x23205c['id']},'transaction':_0x249814});});}else{return;}})[_0x1cb9('0x1f')](function(){for(var _0x1a24b0=0x0;_0x1a24b0<_0x38c0a0[_0x1cb9('0x52')];_0x1a24b0++){var _0x1d060e=_0x38c0a0[_0x1a24b0][_0x1cb9('0x125')]('channel');var _0x534b17=_0x1d060e+_0x1cb9('0xb5');socket[_0x1cb9('0xb6')](_0x1cb9('0x3a')+_0x1d060e+_0x1cb9('0xc1'),{'UserId':_0x23205c['id'],['queueField']:_0x38c0a0[_0x1a24b0]['id']});}});});});}});}})[_0x1cb9('0x1f')](respondWithStatusCode(_0x1e601c,null))['catch'](handleError(_0x1e601c,null));};exports[_0x1cb9('0x12c')]=function(_0x112dfc,_0x350878,_0x5355e9){var _0x490450={};var _0x45abcf={};var _0x52c3a4;var _0x4a46cc;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x112dfc['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x350878,null))['then'](function(_0x245aad){if(_0x245aad){_0x52c3a4=_0x245aad;_0x45abcf[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db[_0x1cb9('0x12d')][_0x1cb9('0x48')]);_0x45abcf[_0x1cb9('0x4e')]=_['keys'](_0x112dfc[_0x1cb9('0x4e')]);_0x45abcf[_0x1cb9('0x58')]=_['intersection'](_0x45abcf['model'],_0x45abcf[_0x1cb9('0x4e')]);_0x490450[_0x1cb9('0x50')]=_['intersection'](_0x45abcf['model'],qs[_0x1cb9('0x64')](_0x112dfc['query'][_0x1cb9('0x64')]));_0x490450[_0x1cb9('0x50')]=_0x490450['attributes']['length']?_0x490450[_0x1cb9('0x50')]:_0x45abcf[_0x1cb9('0x4f')];_0x490450['order']=qs['sort'](_0x112dfc[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x490450[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_[_0x1cb9('0x59')](_0x112dfc[_0x1cb9('0x4e')],_0x45abcf[_0x1cb9('0x58')]));if(_0x112dfc[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x490450['where']=_[_0x1cb9('0x5a')](_0x490450[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x490450[_0x1cb9('0x50')],function(_0x1a4aa0){var _0x5b15cb={};_0x5b15cb[_0x1a4aa0]={'$like':'%'+_0x112dfc['query'][_0x1cb9('0x3e')]+'%'};return _0x5b15cb;})});}_0x490450=_[_0x1cb9('0x5a')]({},_0x490450,_0x112dfc[_0x1cb9('0x5f')]);return _0x52c3a4[_0x1cb9('0x12c')](_0x490450);}})[_0x1cb9('0x1f')](function(_0x2a9bb0){if(_0x2a9bb0){_0x4a46cc=_0x2a9bb0[_0x1cb9('0x52')];if(!_0x112dfc[_0x1cb9('0x4e')][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x490450[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x112dfc[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x490450[_0x1cb9('0x2f')]=qs[_0x1cb9('0x2f')](_0x112dfc[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x52c3a4[_0x1cb9('0x12c')](_0x490450);}})[_0x1cb9('0x1f')](function(_0x21a4db){if(_0x21a4db){return _0x21a4db?{'count':_0x4a46cc,'rows':_0x21a4db}:null;}})[_0x1cb9('0x1f')](respondWithResult(_0x350878,null))['catch'](handleError(_0x350878,null));};exports[_0x1cb9('0x12e')]=function(_0x225a58,_0x405405,_0x5af533){var _0x3d6f5d={};var _0x2e1fa2={};var _0x237545;var _0x457a16;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x225a58['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x405405,null))[_0x1cb9('0x1f')](function(_0x4a57b3){if(_0x4a57b3){_0x237545=_0x4a57b3;_0x2e1fa2['model']=_['keys'](db[_0x1cb9('0x47')]['rawAttributes']);_0x2e1fa2[_0x1cb9('0x4e')]=_[_0x1cb9('0x4d')](_0x225a58['query']);_0x2e1fa2[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x2e1fa2['model'],_0x2e1fa2[_0x1cb9('0x4e')]);_0x3d6f5d[_0x1cb9('0x50')]=_['intersection'](_0x2e1fa2[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x225a58['query']['fields']));_0x3d6f5d[_0x1cb9('0x50')]=_0x3d6f5d['attributes'][_0x1cb9('0x52')]?_0x3d6f5d[_0x1cb9('0x50')]:_0x2e1fa2['model'];_0x3d6f5d[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x225a58['query'][_0x1cb9('0x56')]);_0x3d6f5d[_0x1cb9('0x57')]=qs['filters'](_[_0x1cb9('0x59')](_0x225a58[_0x1cb9('0x4e')],_0x2e1fa2[_0x1cb9('0x58')]));if(_0x225a58[_0x1cb9('0x4e')]['filter']){_0x3d6f5d[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x3d6f5d['where'],{'$or':_[_0x1cb9('0x40')](_0x3d6f5d[_0x1cb9('0x50')],function(_0x18c2cf){var _0x146ec9={};_0x146ec9[_0x18c2cf]={'$like':'%'+_0x225a58[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x146ec9;})});}_0x3d6f5d[_0x1cb9('0x4f')]=db[_0x1cb9('0x47')];_0x3d6f5d['as']=_0x1cb9('0x3b');_0x3d6f5d=_[_0x1cb9('0x5a')]({},_0x3d6f5d,_0x225a58[_0x1cb9('0x5f')]);return _0x237545[_0x1cb9('0xf4')]({'include':[_0x3d6f5d]});}})[_0x1cb9('0x1f')](function(_0x168a42){if(_0x168a42){var _0x2d0735={},_0x14fd50=[],_0x13e7ac=0x0;for(var _0x48939e=0x0;_0x48939e<_0x168a42['length'];_0x48939e+=0x1){for(var _0x335a1d=0x0,_0x5aca26;_0x335a1d<_0x168a42[_0x48939e][_0x1cb9('0x3b')][_0x1cb9('0x52')];_0x335a1d+=0x1){_0x5aca26=_0x168a42[_0x48939e]['Agents'][_0x335a1d][_0x1cb9('0x36')]({'plain':!![]});_0x2d0735[_0x5aca26['id']]=_0x5aca26;}}_0x2d0735=_[_0x1cb9('0x12f')](_0x2d0735);for(var _0x1773f0=qs[_0x1cb9('0x2f')](_0x225a58[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);_0x1773f0<_0x2d0735[_0x1cb9('0x52')]&&_0x14fd50[_0x1cb9('0x52')]=_0x140511){_0x11c3b6=_0x140511;_0x14de77=0xc8;}else{_0x14de77=0xce;}_0x34dc65[_0x0a9e('0x2a')](_0x14de77);return _0x34dc65['set'](_0x0a9e('0x2e'),_0x1538a4+'-'+_0x11c3b6+'/'+_0x140511)[_0x0a9e('0x2b')](_0x14433c);}return null;};}function patchUpdates(_0x1843b2){return function(_0x824a4f){try{jsonpatch[_0x0a9e('0x2f')](_0x824a4f,_0x1843b2,!![]);}catch(_0x563b45){return BPromise[_0x0a9e('0x30')](_0x563b45);}return _0x824a4f[_0x0a9e('0x31')]();};}function saveUpdates(_0x1dbde2,_0x540530){return function(_0x426950){if(_0x426950){return _0x426950['update'](_0x1dbde2)[_0x0a9e('0x32')](function(_0x3ae878){return _0x3ae878;});}return null;};}function removeEntity(_0x1122db,_0x33bdb7){return function(_0x25ce3a){if(_0x25ce3a){return _0x25ce3a['destroy']()[_0x0a9e('0x32')](function(){var _0x46f0a5=_0x25ce3a[_0x0a9e('0x33')]({'plain':!![]});if(_0x46f0a5[_0x0a9e('0x34')]===_0x0a9e('0x35'))return;var _0x409319=[{'name':_0x0a9e('0x36'),'value':_0x0a9e('0x37'),'ignore':!![]},{'name':'Agents','value':_0x0a9e('0x38'),'ignore':![]},{'name':'Telephones','value':_0x0a9e('0x39'),'ignore':![]}];var _0x14b13f=_(_0x409319)[_0x0a9e('0x3a')](_0x0a9e('0x3b'))['map'](_0x0a9e('0x3c'))[_0x0a9e('0x3c')]();if(_[_0x0a9e('0x3d')](_0x14b13f,_0x46f0a5[_0x0a9e('0x34')])){return;}var _0x4853b1=_['find'](_0x409319,[_0x0a9e('0x3c'),_0x46f0a5['role']])[_0x0a9e('0x3e')];return db[_0x0a9e('0x3f')][_0x0a9e('0x40')]({'where':{'type':_0x4853b1,'resourceId':_0x46f0a5['id']}})[_0x0a9e('0x32')](function(){return _0x25ce3a;});})['then'](function(){_0x1122db[_0x0a9e('0x2a')](0xcc)[_0x0a9e('0x41')]();});}};}function handleEntityNotFound(_0x3cae,_0x533942){return function(_0x1dbf74){if(!_0x1dbf74){_0x3cae[_0x0a9e('0x29')](0x194);}return _0x1dbf74;};}function handleError(_0x289467,_0x4c1c0e){_0x4c1c0e=_0x4c1c0e||0x1f4;return function(_0x546ef8){logger[_0x0a9e('0x24')](_0x546ef8[_0x0a9e('0x42')]);if(_0x546ef8['name']){delete _0x546ef8[_0x0a9e('0x3e')];}_0x289467[_0x0a9e('0x2a')](_0x4c1c0e)[_0x0a9e('0x43')](_0x546ef8);};}exports[_0x0a9e('0x44')]=function(_0x4b38d9,_0x5a594b){var _0x15e37d={},_0x45b3d0={},_0x53f3ee={'count':0x0,'rows':[]};var _0x183991=_[_0x0a9e('0x45')](db[_0x0a9e('0x46')]['rawAttributes'],function(_0x316c8f){return{'name':_0x316c8f[_0x0a9e('0x47')],'type':_0x316c8f[_0x0a9e('0x48')][_0x0a9e('0x49')]};});_0x45b3d0[_0x0a9e('0x4a')]=_[_0x0a9e('0x4b')](_[_0x0a9e('0x45')](_0x183991,_0x0a9e('0x3e')),[_0x0a9e('0x4c'),_0x0a9e('0x4d')]);_0x45b3d0[_0x0a9e('0x4e')]=_[_0x0a9e('0x4f')](_0x4b38d9[_0x0a9e('0x4e')]);_0x45b3d0[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x45b3d0['model'],_0x45b3d0['query']);_0x15e37d[_0x0a9e('0x52')]=_[_0x0a9e('0x51')](_0x45b3d0[_0x0a9e('0x4a')],qs[_0x0a9e('0x53')](_0x4b38d9[_0x0a9e('0x4e')][_0x0a9e('0x53')]));_0x15e37d[_0x0a9e('0x52')]=_0x15e37d[_0x0a9e('0x52')][_0x0a9e('0x54')]?_0x15e37d[_0x0a9e('0x52')]:_0x45b3d0[_0x0a9e('0x4a')];if(!_0x4b38d9[_0x0a9e('0x4e')]['hasOwnProperty'](_0x0a9e('0x55'))){_0x15e37d[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x4b38d9[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x15e37d[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x4b38d9[_0x0a9e('0x4e')]['offset']);}_0x15e37d[_0x0a9e('0x56')]=qs['sort'](_0x4b38d9[_0x0a9e('0x4e')][_0x0a9e('0x57')]);_0x15e37d[_0x0a9e('0x58')]=qs['filters'](_[_0x0a9e('0x59')](_0x4b38d9[_0x0a9e('0x4e')],_0x45b3d0[_0x0a9e('0x50')]),_0x183991);if(_0x4b38d9[_0x0a9e('0x4e')][_0x0a9e('0x3a')]){_0x15e37d[_0x0a9e('0x58')]=_[_0x0a9e('0x5a')](_0x15e37d['where'],{'$or':_[_0x0a9e('0x45')](_0x183991,function(_0x1bde3c){if(_0x1bde3c[_0x0a9e('0x48')]!==_0x0a9e('0x5b')){return db[_0x0a9e('0x5c')][_0x0a9e('0x58')](db[_0x0a9e('0x5c')]['fn'](_0x0a9e('0x5d'),db[_0x0a9e('0x5c')]['col'](_0x1bde3c[_0x0a9e('0x3e')])),{'$like':db[_0x0a9e('0x5c')]['fn']('lower','%'+_0x4b38d9['query']['filter']+'%')});}})});}_0x15e37d=_[_0x0a9e('0x5a')]({},_0x15e37d,_0x4b38d9[_0x0a9e('0x5e')]);var _0x37edaa={'where':_0x15e37d[_0x0a9e('0x58')]};return db[_0x0a9e('0x46')][_0x0a9e('0x5f')](_0x37edaa)[_0x0a9e('0x32')](function(_0x375c18){_0x53f3ee['count']=_0x375c18;if(_0x4b38d9['query']['includeAll']){_0x15e37d[_0x0a9e('0x60')]=[{'all':!![]}];}return db[_0x0a9e('0x46')][_0x0a9e('0x61')](_0x15e37d);})['then'](function(_0x2b69d9){_0x53f3ee[_0x0a9e('0x62')]=_0x2b69d9;return _0x53f3ee;})['then'](respondWithFilteredResult(_0x5a594b,_0x15e37d))['catch'](handleError(_0x5a594b,null));};exports[_0x0a9e('0x63')]=function(_0x59c6ff,_0x443e72){var _0x4c3845={'raw':![],'where':{'id':_0x59c6ff[_0x0a9e('0x64')]['id']}},_0x2e5e62={};_0x2e5e62[_0x0a9e('0x4a')]=_['differenceBy'](_[_0x0a9e('0x4f')](db[_0x0a9e('0x46')]['rawAttributes']),['password',_0x0a9e('0x4d')]);_0x2e5e62[_0x0a9e('0x4e')]=_['keys'](_0x59c6ff[_0x0a9e('0x4e')]);_0x2e5e62['filters']=_[_0x0a9e('0x51')](_0x2e5e62['model'],_0x2e5e62[_0x0a9e('0x4e')]);_0x4c3845['attributes']=_['intersection'](_0x2e5e62['model'],qs[_0x0a9e('0x53')](_0x59c6ff['query'][_0x0a9e('0x53')]));_0x4c3845[_0x0a9e('0x52')]=_0x4c3845[_0x0a9e('0x52')][_0x0a9e('0x54')]?_0x4c3845[_0x0a9e('0x52')]:_0x2e5e62[_0x0a9e('0x4a')];if(_0x59c6ff[_0x0a9e('0x4e')][_0x0a9e('0x65')]){_0x4c3845['include']=[{'all':!![]}];}_0x4c3845=_[_0x0a9e('0x5a')]({},_0x4c3845,_0x59c6ff[_0x0a9e('0x5e')]);return db[_0x0a9e('0x46')][_0x0a9e('0x66')](_0x4c3845)[_0x0a9e('0x32')](handleEntityNotFound(_0x443e72,null))[_0x0a9e('0x32')](respondWithResult(_0x443e72,null))['catch'](handleError(_0x443e72,null));};exports[_0x0a9e('0x67')]=function(_0x26bc80,_0x5239ef){if(_0x26bc80[_0x0a9e('0x68')]['id']){delete _0x26bc80['body']['id'];}delete _0x26bc80[_0x0a9e('0x68')]['role'];return db['User']['find']({'where':{'id':_0x26bc80[_0x0a9e('0x64')]['id']}})['then'](handleEntityNotFound(_0x5239ef,null))[_0x0a9e('0x32')](saveUpdates(_0x26bc80[_0x0a9e('0x68')],null))[_0x0a9e('0x32')](respondWithResult(_0x5239ef,null))[_0x0a9e('0x28')](handleError(_0x5239ef,null));};exports[_0x0a9e('0x69')]=function(_0x26d7db,_0x49eed0){return db[_0x0a9e('0x46')]['describe']()[_0x0a9e('0x32')](respondWithResult(_0x49eed0,null))[_0x0a9e('0x28')](handleError(_0x49eed0,null));};exports[_0x0a9e('0x6a')]=function(_0x5adf8f,_0x453360,_0x156f1c){return db[_0x0a9e('0x46')][_0x0a9e('0x66')]({'where':{'id':_0x5adf8f['params']['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x453360,null))[_0x0a9e('0x32')](function(_0x54327c){if(_0x54327c){return _0x54327c[_0x0a9e('0x6a')](_0x5adf8f[_0x0a9e('0x68')][_0x0a9e('0x6b')],_[_0x0a9e('0x6c')](_0x5adf8f[_0x0a9e('0x68')],['ids','id'])||{});}})[_0x0a9e('0x32')](respondWithResult(_0x453360,null))[_0x0a9e('0x28')](handleError(_0x453360,null));};function validateUser(_0x281c7d){return new BPromise(function(_0x47bb43,_0x3528b7){if(_0x281c7d['internal'])return _0x47bb43(_0x281c7d);return db['Setting'][_0x0a9e('0x6d')](0x1)[_0x0a9e('0x32')](function(_0x9375fb){if(_0x9375fb[_0x0a9e('0x6e')])authService[_0x0a9e('0x6f')](_0x281c7d[_0x0a9e('0x4c')]);db[_0x0a9e('0x46')][_0x0a9e('0x70')](_0x0a9e('0x71'))[_0x0a9e('0x32')](function(_0x2e89b7){if(_[_0x0a9e('0x72')](_0x2e89b7)){_0x281c7d[_0x0a9e('0x71')]=_0x9375fb[_0x0a9e('0x73')]||0x1;return;}if(_[_0x0a9e('0x72')](_0x9375fb[_0x0a9e('0x73')])||_0x9375fb[_0x0a9e('0x73')]===_0x2e89b7){_0x281c7d[_0x0a9e('0x71')]=_0x2e89b7+0x1;return;}if(_0x9375fb['min_internal']>_0x2e89b7){_0x281c7d[_0x0a9e('0x71')]=_0x9375fb[_0x0a9e('0x73')];return;}return db[_0x0a9e('0x5c')]['query'](_0x0a9e('0x74'),{'type':db[_0x0a9e('0x5c')]['QueryTypes'][_0x0a9e('0x75')]})[_0x0a9e('0x32')](function(_0x3ef315){if(_0x3ef315&&_0x3ef315[_0x0a9e('0x54')]){for(var _0x13b5c0=0x0,_0x4a43a8=_0x3ef315['length'];_0x13b5c0<_0x4a43a8&&_['isNil'](_0x281c7d[_0x0a9e('0x71')]);_0x13b5c0++){if(_0x9375fb[_0x0a9e('0x73')]<=_0x3ef315[_0x13b5c0][_0x0a9e('0x76')]){_0x281c7d[_0x0a9e('0x71')]=_0x3ef315[_0x13b5c0][_0x0a9e('0x76')];}else if(_0x9375fb[_0x0a9e('0x73')]>_0x3ef315[_0x13b5c0][_0x0a9e('0x76')]&&_0x9375fb[_0x0a9e('0x73')]<=_0x3ef315[_0x13b5c0]['to']){_0x281c7d['internal']=_0x9375fb[_0x0a9e('0x73')];}}}if(_[_0x0a9e('0x72')](_0x281c7d[_0x0a9e('0x71')])){_0x281c7d['internal']=_0x2e89b7+0x1;}return _0x47bb43(_0x281c7d);});});})[_0x0a9e('0x28')](function(_0x583b2e){_0x3528b7(_0x583b2e);});});}function updateUser(_0x4437ff){return new BPromise(function(_0x44351d,_0x4c46c1){try{if(_0x4437ff[_0x0a9e('0x77')]){_0x4437ff[_0x0a9e('0x78')]=_0x4437ff[_0x0a9e('0x71')];_0x4437ff[_0x0a9e('0x79')]={'mailbox':_0x4437ff['internal'],'password':_0x4437ff[_0x0a9e('0x4c')],'fullname':_0x4437ff[_0x0a9e('0x7a')],'email':_0x4437ff[_0x0a9e('0x7b')]};}if(_0x4437ff[_0x0a9e('0x34')]==='agent'){if(!_0x4437ff[_0x0a9e('0x7c')])_0x4437ff[_0x0a9e('0x7c')]=[_0x0a9e('0x7d'),_0x0a9e('0x7e'),'103',_0x0a9e('0x7f'),_0x0a9e('0x80'),_0x0a9e('0x81'),_0x0a9e('0x82'),_0x0a9e('0x83'),_0x0a9e('0x84'),_0x0a9e('0x85'),_0x0a9e('0x86'),_0x0a9e('0x87'),_0x0a9e('0x88'),_0x0a9e('0x89'),_0x0a9e('0x8a')];}_0x44351d(_0x4437ff);}catch(_0x25744a){_0x4c46c1(_0x25744a);}});}exports[_0x0a9e('0x8b')]=function(_0x5b35db,_0xf4120f){if(_0x5b35db[_0x0a9e('0x37')][_0x0a9e('0x34')]==='agent')throw new Error(_0x0a9e('0x8c'));if(_0x5b35db[_0x0a9e('0x68')][_0x0a9e('0x34')]===_0x0a9e('0x37')&&_0x5b35db['user']['role']!==_0x0a9e('0x35')){throw new Error(_0x0a9e('0x8d'));}if(_0x5b35db['body'][_0x0a9e('0x34')]==='admin'&&_0x5b35db[_0x0a9e('0x37')][_0x0a9e('0x34')]!=='admin'){throw new Error(_0x0a9e('0x8e'));}return licenseUtil[_0x0a9e('0x8f')]([_0x5b35db[_0x0a9e('0x68')]])[_0x0a9e('0x32')](function(){return validateUser(_0x5b35db[_0x0a9e('0x68')]);})[_0x0a9e('0x32')](function(_0x444f1f){return updateUser(_0x444f1f)['then'](function(_0x2973d3){if(_0x2973d3[_0x0a9e('0x34')]===_0x0a9e('0x35')){_0x2973d3[_0x0a9e('0x90')]=_0x5b35db['user'][_0x0a9e('0x90')];delete _0x2973d3[_0x0a9e('0x91')];}return _0x2973d3;});})['then'](function(_0x1d6834){return db['User'][_0x0a9e('0x8b')](_0x1d6834,{'include':[{'model':db[_0x0a9e('0x79')],'as':_0x0a9e('0x79')}]});})[_0x0a9e('0x32')](function(_0x5af453){if(_0x5b35db['body'][_0x0a9e('0x34')]===_0x0a9e('0x37'))return _0x5af453;if(_0x5b35db[_0x0a9e('0x37')]['role']!==_0x0a9e('0x37'))return _0x5af453;return db[_0x0a9e('0x92')]['find']({'where':{'name':_0x5af453['role']===_0x0a9e('0x38')?'Agents':'Telephones','userProfileId':_0x5b35db['user'][_0x0a9e('0x91')]},'raw':!![]})[_0x0a9e('0x32')](function(_0x9044fe){if(!_0x9044fe||_0x9044fe[_0x0a9e('0x93')]!=0x0)return _0x5af453;return db[_0x0a9e('0x3f')][_0x0a9e('0x8b')]({'name':_0x5af453['name'],'resourceId':_0x5af453['id'],'type':_0x9044fe[_0x0a9e('0x3e')],'sectionId':_0x9044fe['id']},{})['then'](function(){return _0x5af453;});})[_0x0a9e('0x28')](function(_0x2aabab){logger[_0x0a9e('0x24')](_0x0a9e('0x94'),_0x2aabab);throw _0x2aabab;});})['then'](respondWithResult(_0xf4120f,0xc9))[_0x0a9e('0x28')](handleError(_0xf4120f,null));};exports[_0x0a9e('0x95')]=function(_0x1d4877,_0x5b74c3){var _0xb6e411=_0x1d4877[_0x0a9e('0x68')];var _0x2a563d=[];if(_0x1d4877[_0x0a9e('0x37')][_0x0a9e('0x34')]===_0x0a9e('0x38'))throw new Error(_0x0a9e('0x8c'));if(_[_0x0a9e('0x96')](_0xb6e411,['role',_0x0a9e('0x37')])&&_0x1d4877[_0x0a9e('0x37')]['role']!==_0x0a9e('0x35')){throw new Error(_0x0a9e('0x8d'));}if(_[_0x0a9e('0x96')](_0xb6e411,['role',_0x0a9e('0x35')])&&_0x1d4877['user'][_0x0a9e('0x34')]!==_0x0a9e('0x35')){throw new Error(_0x0a9e('0x97'));}return licenseUtil[_0x0a9e('0x8f')](_0xb6e411)[_0x0a9e('0x32')](function(){return validateUser(_0xb6e411[0x0]);})[_0x0a9e('0x32')](function(){for(var _0x16a039=0x1;_0x16a039<_0xb6e411[_0x0a9e('0x54')];_0x16a039++){var _0x501050=_0xb6e411[_0x16a039-0x1][_0x0a9e('0x71')];if(!_0xb6e411[_0x16a039][_0x0a9e('0x71')])_0xb6e411[_0x16a039][_0x0a9e('0x71')]=_0x501050+0x1;_0x2a563d[_0x0a9e('0x98')](validateUser(_0xb6e411[_0x16a039]));}return BPromise[_0x0a9e('0x99')](_0x2a563d);})[_0x0a9e('0x32')](function(){_0x2a563d=[];for(var _0x6803d6=0x0;_0x6803d6<_0xb6e411[_0x0a9e('0x54')];_0x6803d6++){_0x2a563d[_0x0a9e('0x98')](updateUser(_0xb6e411[_0x6803d6]));}return BPromise[_0x0a9e('0x99')](_0x2a563d);})[_0x0a9e('0x32')](function(){return BPromise[_0x0a9e('0x9a')](_0xb6e411,function(_0x18273f){return db['User'][_0x0a9e('0x8b')](_0x18273f,{'include':[{'model':db[_0x0a9e('0x79')],'as':_0x0a9e('0x79')}]})[_0x0a9e('0x32')](function(_0xb0599a){_0x18273f['id']=_0xb0599a['id'];return _0x18273f;});});})['then'](function(_0x3afc8c){if(_0x1d4877[_0x0a9e('0x68')]['role']===_0x0a9e('0x37'))return _0x3afc8c;if(_0x1d4877['user'][_0x0a9e('0x34')]!==_0x0a9e('0x37'))return _0x3afc8c;var _0x1d93b1=_[_0x0a9e('0x96')](_0x3afc8c,function(_0x4f4d2d){return _0x4f4d2d[_0x0a9e('0x34')]==='agent'||_0x4f4d2d[_0x0a9e('0x34')]===_0x0a9e('0x39');});if(!_0x1d93b1)return _0x3afc8c;return db['UserProfileSection'][_0x0a9e('0x61')]({'where':{'name':{'$or':[_0x0a9e('0x9b'),_0x0a9e('0x9c')]},'userProfileId':_0x1d4877['user']['userProfileId']},'raw':!![]})[_0x0a9e('0x32')](function(_0x6ba2be){if(_[_0x0a9e('0x9d')](_0x6ba2be)||!_[_0x0a9e('0x96')](_0x6ba2be,[_0x0a9e('0x93'),0x0]))return _0x3afc8c;_0x2a563d=[];var _0x2450a8=_(_0x6ba2be)[_0x0a9e('0x45')](function(_0x3c75b9){if(_0x3c75b9[_0x0a9e('0x93')]===0x1)return;return _0x3c75b9['name']===_0x0a9e('0x9b')?'agent':_0x0a9e('0x39');})[_0x0a9e('0x9e')]()[_0x0a9e('0x3c')]();for(var _0x28ce92=0x0;_0x28ce92<_0x3afc8c[_0x0a9e('0x54')];_0x28ce92++){if(!_['includes'](_0x2450a8,_0x3afc8c[_0x28ce92][_0x0a9e('0x34')]))return;var _0x4667bf=_0x3afc8c[_0x28ce92][_0x0a9e('0x34')]===_0x0a9e('0x38')?_0x0a9e('0x9b'):'Telephones';_0x2a563d['push'](db[_0x0a9e('0x3f')]['create']({'name':_0x3afc8c[_0x28ce92][_0x0a9e('0x3e')],'resourceId':_0x3afc8c[_0x28ce92]['id'],'type':_0x4667bf,'sectionId':_[_0x0a9e('0x66')](_0x6ba2be,[_0x0a9e('0x3e'),_0x4667bf])['id']},{}));}return BPromise[_0x0a9e('0x99')](_0x2a563d);});})[_0x0a9e('0x32')](respondWithResult(_0x5b74c3,0xc9))[_0x0a9e('0x28')](handleError(_0x5b74c3,null));};exports['changePassword']=function(_0x4db918,_0x1889ed,_0x5dfbe2){if(_0x4db918[_0x0a9e('0x68')]['id']){delete _0x4db918['body']['id'];}return db[_0x0a9e('0x46')]['find']({'where':{'id':_0x4db918['params']['id']}})[_0x0a9e('0x32')](function(_0xb8db59){if(!_0xb8db59)return null;if(_0xb8db59['id']===_0x4db918['user']['id']){if(!_0x4db918[_0x0a9e('0x68')][_0x0a9e('0x9f')]||!_0x4db918[_0x0a9e('0x68')][_0x0a9e('0xa0')]){throw new db[(_0x0a9e('0xa1'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0xb8db59[_0x0a9e('0xa2')](_0x4db918[_0x0a9e('0x68')][_0x0a9e('0x9f')])){throw new db[(_0x0a9e('0xa1'))][(_0x0a9e('0xa3'))]('Wrong\x20credentials');}if(_0x4db918[_0x0a9e('0x68')][_0x0a9e('0x9f')]===_0x4db918['body'][_0x0a9e('0xa0')]){throw new db[(_0x0a9e('0xa1'))][(_0x0a9e('0xa3'))](_0x0a9e('0xa4'));}}else if(_0x4db918[_0x0a9e('0x37')][_0x0a9e('0x34')]===_0x0a9e('0x35')){if(!_0x4db918[_0x0a9e('0x68')][_0x0a9e('0xa0')]){throw new db[(_0x0a9e('0xa1'))]['ValidationError'](_0x0a9e('0xa5'));}}else if(_0x4db918[_0x0a9e('0x37')][_0x0a9e('0x34')]===_0x0a9e('0x37')){if(!_0x4db918[_0x0a9e('0x68')]['newPassword']){throw new db['Sequelize'][(_0x0a9e('0xa3'))](_0x0a9e('0xa5'));}if(_0xb8db59[_0x0a9e('0x34')]!==_0x0a9e('0x38')){throw new db[(_0x0a9e('0xa1'))]['ValidationError'](_0x0a9e('0x8c'));}}else{throw new db[(_0x0a9e('0xa1'))][(_0x0a9e('0xa3'))]('Unauthorized');}return _0xb8db59;})[_0x0a9e('0x32')](handleEntityNotFound(_0x1889ed,null))['then'](function(_0x2144ca){return db['Setting'][_0x0a9e('0xa6')]({'attributes':['id',_0x0a9e('0x6e'),_0x0a9e('0xa7'),'passwordHistoryLimit']})[_0x0a9e('0x32')](function(_0x5ed560){if(_0x5ed560[_0x0a9e('0x6e')])authService[_0x0a9e('0x6f')](_0x4db918[_0x0a9e('0x68')][_0x0a9e('0xa0')]);if(!_0x5ed560[_0x0a9e('0xa7')]||!_0x2144ca[_0x0a9e('0xa8')])return _0x2144ca;authService[_0x0a9e('0xa9')](_0x4db918[_0x0a9e('0x68')][_0x0a9e('0xa0')],_0x2144ca[_0x0a9e('0xa8')],_0x5ed560[_0x0a9e('0xaa')]);return _0x2144ca;})[_0x0a9e('0x32')](saveUpdates({'password':_0x4db918[_0x0a9e('0x68')][_0x0a9e('0xa0')],'passwordResetAt':_0x4db918[_0x0a9e('0x37')]['id']==_0x4db918[_0x0a9e('0x64')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4db918['body'][_0x0a9e('0xa0')],_0x2144ca['previousPasswords'])},null));})[_0x0a9e('0x32')](respondWithResult(_0x1889ed,null))[_0x0a9e('0x28')](handleError(_0x1889ed,null));};exports['addQueues']=function(_0x1a3754,_0xe2b083,_0x387bbe){var _0x18adc8=_0x1a3754['body'][_0x0a9e('0xab')];return db[_0x0a9e('0x46')][_0x0a9e('0x66')]({'where':{'id':_0x1a3754[_0x0a9e('0x64')]['id']},'attributes':['id','name',_0x0a9e('0x34'),_0x0a9e('0xac'),_0x0a9e('0xad'),'voicePause',_0x0a9e('0xae')]})[_0x0a9e('0x32')](handleEntityNotFound(_0xe2b083,null))[_0x0a9e('0x32')](function(_0x54b107){if(_0x54b107){if(!utils[_0x0a9e('0xaf')](_0x18adc8)){throw new db[(_0x0a9e('0xa1'))][(_0x0a9e('0xa3'))](_0x0a9e('0xb0'));}return _0x54b107[_0x0a9e('0xb1')+_['capitalize'](_0x18adc8[_0x0a9e('0xb2')]())+_0x0a9e('0xb3')](_0x1a3754['body'][_0x0a9e('0x6b')],{'penalty':_0x1a3754[_0x0a9e('0x68')][_0x0a9e('0xb4')]||0x0})['spread'](function(_0x5c3b6f){for(var _0x523d08=0x0;_0x523d08<_0x1a3754[_0x0a9e('0x68')][_0x0a9e('0x6b')]['length'];_0x523d08+=0x1){var _0x183244={'UserId':_0x1a3754[_0x0a9e('0x64')]['id']};_0x183244[_[_0x0a9e('0xb5')](_0x18adc8['toLowerCase']())+_0x0a9e('0xb6')]=_0x1a3754[_0x0a9e('0x68')][_0x0a9e('0x6b')][_0x523d08];socket[_0x0a9e('0xb7')](_0x0a9e('0x37')+_[_0x0a9e('0xb5')](_0x18adc8[_0x0a9e('0xb2')]())+_0x0a9e('0xb8'),_0x183244);}return _0x5c3b6f;})[_0x0a9e('0x32')](function(){if(_0x18adc8==='voice'){return db[_0x0a9e('0xb9')]['findAll']({'where':{'id':_0x1a3754[_0x0a9e('0x68')][_0x0a9e('0x6b')]||[]},'raw':!![],'attributes':['id',_0x0a9e('0x3e')]});}})[_0x0a9e('0x32')](function(_0x407e9d){var _0x344cd4=_0x54b107['get']({'plain':!![]});var _0x1a0314=[];if(_0x18adc8===_0x0a9e('0xba')&&_0x344cd4[_0x0a9e('0x34')]===_0x0a9e('0x38')&&_0x344cd4['online']){for(var _0x2e4887=0x0;_0x2e4887<_0x407e9d[_0x0a9e('0x54')];_0x2e4887+=0x1){_0x1a0314[_0x0a9e('0x98')]({'membername':_0x344cd4[_0x0a9e('0x3e')],'UserId':_0x344cd4['id'],'queue_name':_0x407e9d[_0x2e4887][_0x0a9e('0x3e')],'VoiceQueueId':_0x407e9d[_0x2e4887]['id'],'interface':_[_0x0a9e('0x72')](_0x344cd4[_0x0a9e('0xae')])?util[_0x0a9e('0xbb')](_0x0a9e('0xbc'),_0x344cd4[_0x0a9e('0x3e')]):_0x344cd4['interface'],'paused':_0x344cd4[_0x0a9e('0xbd')]||![],'penalty':_0x1a3754[_0x0a9e('0x68')][_0x0a9e('0xb4')]||0x0});}return BPromise[_0x0a9e('0x9a')](_0x1a0314,function(_0xea8bd1){return db[_0x0a9e('0xbe')][_0x0a9e('0xbf')](_0xea8bd1);});}return _0x54b107;});}})[_0x0a9e('0x32')](respondWithStatusCode(_0xe2b083,null))['catch'](handleError(_0xe2b083,null));};exports[_0x0a9e('0xc0')]=function(_0xd2391,_0x1a9ef1,_0x5c65fc){var _0x1402c7;return db[_0x0a9e('0x46')][_0x0a9e('0x66')]({'where':{'id':_0xd2391[_0x0a9e('0x64')]['id']},'attributes':['id',_0x0a9e('0x3e'),_0x0a9e('0x34')]})[_0x0a9e('0x32')](handleEntityNotFound(_0x1a9ef1,null))[_0x0a9e('0x32')](function(_0x401601){if(_0x401601){_0x1402c7=_0x401601;if(!_0xd2391[_0x0a9e('0x4e')]['channel']||!utils[_0x0a9e('0xaf')](_0xd2391[_0x0a9e('0x4e')][_0x0a9e('0xab')])){throw new db[(_0x0a9e('0xa1'))][(_0x0a9e('0xa3'))](_0x0a9e('0xb0'));}return _0x401601['remove'+_[_0x0a9e('0xb5')](_0xd2391['query']['channel']['toLowerCase']())+_0x0a9e('0xb3')](_0xd2391[_0x0a9e('0x4e')][_0x0a9e('0x6b')]);}})[_0x0a9e('0x32')](function(_0x4d99a8){for(var _0x4156a5=0x0;_0x4156a5<_0xd2391[_0x0a9e('0x4e')][_0x0a9e('0x6b')][_0x0a9e('0x54')];_0x4156a5+=0x1){var _0x2c8d1d={'UserId':_0xd2391['params']['id']};_0x2c8d1d[_['capitalize'](_0xd2391[_0x0a9e('0x4e')][_0x0a9e('0xab')][_0x0a9e('0xb2')]())+'QueueId']=_0xd2391[_0x0a9e('0x4e')][_0x0a9e('0x6b')][_0x4156a5];socket[_0x0a9e('0xb7')]('user'+_[_0x0a9e('0xb5')](_0xd2391[_0x0a9e('0x4e')][_0x0a9e('0xab')]['toLowerCase']())+_0x0a9e('0xc1'),_0x2c8d1d);}return _0x4d99a8;})[_0x0a9e('0x32')](function(){if(_0xd2391[_0x0a9e('0x4e')]['channel']==='voice'){return db['UserVoiceQueueRt'][_0x0a9e('0x40')]({'where':{'UserId':_0xd2391[_0x0a9e('0x64')]['id'],'VoiceQueueId':_0xd2391[_0x0a9e('0x4e')][_0x0a9e('0x6b')]},'individualHooks':!![]})['then'](function(){return _0x1402c7;});}return _0x1402c7;})[_0x0a9e('0x32')](respondWithStatusCode(_0x1a9ef1,null))['catch'](handleError(_0x1a9ef1,null));};exports[_0x0a9e('0xc2')]=function(_0x2ff2ab,_0x242f23,_0x57f673){_0x2ff2ab[_0x0a9e('0x68')][_0x0a9e('0xc3')]=_0x2ff2ab[_0x0a9e('0xc4')]['filename'];return db[_0x0a9e('0x46')]['find']({'where':{'id':_0x2ff2ab[_0x0a9e('0x64')]['id']}})['then'](handleEntityNotFound(_0x242f23,null))[_0x0a9e('0x32')](saveUpdates(_0x2ff2ab['body'],null))[_0x0a9e('0x32')](respondWithResult(_0x242f23,null))[_0x0a9e('0x28')](handleError(_0x242f23,null));};exports[_0x0a9e('0xc5')]=function(_0x10ace8,_0x1e306c,_0x251dd9){var _0x1784c1=path['join'](config[_0x0a9e('0xc6')],_0x0a9e('0xc7'));return db['User'][_0x0a9e('0x66')]({'where':{'id':_0x10ace8[_0x0a9e('0x64')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x0a9e('0x32')](handleEntityNotFound(_0x1e306c,null))[_0x0a9e('0x32')](function(_0x16b578){if(_0x16b578){if(_['isNil'](_0x16b578[_0x0a9e('0xc3')])){return _0x1e306c[_0x0a9e('0xc8')](_0x1784c1);}else{if(!fs[_0x0a9e('0xc9')](path[_0x0a9e('0xca')](config[_0x0a9e('0xc6')],_0x0a9e('0xcb'),_0x16b578[_0x0a9e('0xc3')]))){return _0x1e306c[_0x0a9e('0xc8')](_0x1784c1);}return _0x1e306c[_0x0a9e('0xc8')](path[_0x0a9e('0xca')](config['root'],_0x0a9e('0xcb'),_0x16b578['userpic']));}}})[_0x0a9e('0x28')](handleError(_0x1e306c,null));};exports[_0x0a9e('0xcc')]=function(_0x5b9c76,_0x315e31,_0x5d577b){var _0x2d45db={};var _0x5691ac={};var _0x119708;var _0x469035;return db[_0x0a9e('0x46')]['findOne']({'where':{'id':_0x5b9c76[_0x0a9e('0x64')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x315e31,null))[_0x0a9e('0x32')](function(_0x3272b8){if(_0x3272b8){_0x119708=_0x3272b8;_0x5691ac[_0x0a9e('0x4a')]=_[_0x0a9e('0x4f')](db[_0x0a9e('0xcd')]['rawAttributes']);_0x5691ac[_0x0a9e('0x4e')]=_[_0x0a9e('0x4f')](_0x5b9c76[_0x0a9e('0x4e')]);_0x5691ac[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x5691ac[_0x0a9e('0x4a')],_0x5691ac[_0x0a9e('0x4e')]);_0x2d45db['attributes']=_['intersection'](_0x5691ac[_0x0a9e('0x4a')],qs[_0x0a9e('0x53')](_0x5b9c76[_0x0a9e('0x4e')][_0x0a9e('0x53')]));_0x2d45db[_0x0a9e('0x52')]=_0x2d45db[_0x0a9e('0x52')][_0x0a9e('0x54')]?_0x2d45db['attributes']:_0x5691ac[_0x0a9e('0x4a')];_0x2d45db[_0x0a9e('0x56')]=qs[_0x0a9e('0x57')](_0x5b9c76[_0x0a9e('0x4e')][_0x0a9e('0x57')]);_0x2d45db[_0x0a9e('0x58')]=qs[_0x0a9e('0x50')](_['pick'](_0x5b9c76[_0x0a9e('0x4e')],_0x5691ac[_0x0a9e('0x50')]));if(_0x5b9c76[_0x0a9e('0x4e')]['filter']){_0x2d45db[_0x0a9e('0x58')]=_[_0x0a9e('0x5a')](_0x2d45db[_0x0a9e('0x58')],{'$or':_[_0x0a9e('0x45')](_0x2d45db['attributes'],function(_0x38892b){var _0xcbbea0={};_0xcbbea0[_0x38892b]={'$like':'%'+_0x5b9c76[_0x0a9e('0x4e')][_0x0a9e('0x3a')]+'%'};return _0xcbbea0;})});}_0x2d45db=_[_0x0a9e('0x5a')]({},_0x2d45db,_0x5b9c76[_0x0a9e('0x5e')]);return _0x119708[_0x0a9e('0xcc')](_0x2d45db);}})[_0x0a9e('0x32')](function(_0x4e5dec){if(_0x4e5dec){_0x469035=_0x4e5dec[_0x0a9e('0x54')];if(_0x5b9c76[_0x0a9e('0x4e')][_0x0a9e('0xce')](_0x0a9e('0x65'))){_0x2d45db['include']=[{'model':db['CmList'],'as':_0x0a9e('0xcf'),'required':![]},{'model':db[_0x0a9e('0xd0')],'as':_0x0a9e('0xd1'),'attributes':['id','name',_0x0a9e('0xd2')],'where':_0x5b9c76[_0x0a9e('0x4e')]['tag']?{'id':_0x5b9c76[_0x0a9e('0x4e')]['tag']}:undefined,'required':_0x5b9c76[_0x0a9e('0x4e')]['tag']?!![]:![]}];}if(!_0x5b9c76['query']['hasOwnProperty'](_0x0a9e('0x55'))){_0x2d45db[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x5b9c76[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x2d45db[_0x0a9e('0x2c')]=qs['offset'](_0x5b9c76[_0x0a9e('0x4e')][_0x0a9e('0x2c')]);}return _0x119708[_0x0a9e('0xcc')](_0x2d45db);}})[_0x0a9e('0x32')](function(_0x293b22){if(_0x293b22){return _0x293b22?{'count':_0x469035,'rows':_0x293b22}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x315e31,null))[_0x0a9e('0x28')](handleError(_0x315e31,null));};exports['getQueues']=function(_0x49baaa,_0x111e21,_0x5b6edc){var _0x29537a;var _0xb326cb;var _0x1f0318={};var _0xa3695f;return db[_0x0a9e('0x46')][_0x0a9e('0xa6')]({'where':{'id':_0x49baaa['params']['id']},'attributes':['id',_0x0a9e('0x3e'),'role']})['then'](handleEntityNotFound(_0x111e21,null))[_0x0a9e('0x32')](function(_0x593f9e){if(!utils[_0x0a9e('0xaf')](_0x49baaa['query']['channel'])){throw new db[(_0x0a9e('0xa1'))]['ValidationError'](_0x0a9e('0xb0'));}_0x29537a=_0x593f9e;var _0x142e53={};_0x142e53[_0x0a9e('0x4a')]=_['keys'](db[_[_0x0a9e('0xb5')](_0x49baaa[_0x0a9e('0x4e')][_0x0a9e('0xab')])+'Queue']['rawAttributes']);_0x142e53[_0x0a9e('0x4e')]=_[_0x0a9e('0x4f')](_0x49baaa[_0x0a9e('0x4e')]);_0x142e53[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x142e53[_0x0a9e('0x4a')],_0x142e53[_0x0a9e('0x4e')]);_0x1f0318[_0x0a9e('0x52')]=_[_0x0a9e('0x51')](_0x142e53[_0x0a9e('0x4a')],qs['fields'](_0x49baaa['query']['fields']));_0x1f0318[_0x0a9e('0x52')]=_0x1f0318[_0x0a9e('0x52')][_0x0a9e('0x54')]?_0x1f0318[_0x0a9e('0x52')]:_0x142e53[_0x0a9e('0x4a')];_0x1f0318[_0x0a9e('0x56')]=qs[_0x0a9e('0x57')](_0x49baaa[_0x0a9e('0x4e')]['sort']);_0x1f0318['where']=qs[_0x0a9e('0x50')](_[_0x0a9e('0x59')](_0x49baaa['query'],_0x142e53[_0x0a9e('0x50')]));if(_0x49baaa[_0x0a9e('0x4e')][_0x0a9e('0x3a')]){_0x1f0318[_0x0a9e('0x58')]=_[_0x0a9e('0x5a')](_0x1f0318[_0x0a9e('0x58')],{'$or':_[_0x0a9e('0x45')](_0x1f0318[_0x0a9e('0x52')],function(_0x59f8f7){var _0x400800={};_0x400800[_0x59f8f7]={'$like':'%'+_0x49baaa[_0x0a9e('0x4e')][_0x0a9e('0x3a')]+'%'};return _0x400800;})});}_0x1f0318=_['merge']({},_0x1f0318,_0x49baaa[_0x0a9e('0x5e')]);switch(_0x29537a[_0x0a9e('0x34')]){case _0x0a9e('0x35'):return db[_[_0x0a9e('0xb5')](_0x49baaa[_0x0a9e('0x4e')][_0x0a9e('0xab')])+_0x0a9e('0xd3')][_0x0a9e('0x61')](_0x1f0318);case _0x0a9e('0x37'):case _0x0a9e('0x38'):return _0x29537a[_0x0a9e('0x33')+_[_0x0a9e('0xb5')](_0x49baaa['query']['channel'])+_0x0a9e('0xb3')](_0x1f0318);default:throw new db[(_0x0a9e('0xa1'))][(_0x0a9e('0xa3'))](_0x0a9e('0xd4'));}})[_0x0a9e('0x32')](function(_0x1e29e2){_0xa3695f=_0x1e29e2[_0x0a9e('0x54')];if(!_0x49baaa['query'][_0x0a9e('0xce')]('nolimit')){_0x1f0318[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x49baaa[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x1f0318[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x49baaa[_0x0a9e('0x4e')][_0x0a9e('0x2c')]);}switch(_0x29537a[_0x0a9e('0x34')]){case _0x0a9e('0x35'):return db[_[_0x0a9e('0xb5')](_0x49baaa[_0x0a9e('0x4e')][_0x0a9e('0xab')])+_0x0a9e('0xd3')][_0x0a9e('0x61')](_0x1f0318);case _0x0a9e('0x37'):case'agent':return _0x29537a['get'+_[_0x0a9e('0xb5')](_0x49baaa[_0x0a9e('0x4e')]['channel'])+'Queues'](_0x1f0318);}})[_0x0a9e('0x32')](function(_0x1feb9){return{'count':_0xa3695f,'rows':_0x1feb9};})[_0x0a9e('0x32')](respondWithResult(_0x111e21,null))['catch'](handleError(_0x111e21,null));};exports[_0x0a9e('0xd5')]=function(_0x5b6447,_0x31fe9e,_0x4bf1e3){var _0x22d31f={};var _0x5e9c92={};var _0x122e7d;var _0x21e210;return db[_0x0a9e('0x46')]['findOne']({'where':{'id':_0x5b6447[_0x0a9e('0x64')]['id']}})['then'](handleEntityNotFound(_0x31fe9e,null))['then'](function(_0x44b7af){if(_0x44b7af){_0x122e7d=_0x44b7af;_0x5e9c92[_0x0a9e('0x4a')]=_[_0x0a9e('0x4f')](db[_0x0a9e('0xbe')][_0x0a9e('0xd6')]);_0x5e9c92[_0x0a9e('0x4e')]=_[_0x0a9e('0x4f')](_0x5b6447[_0x0a9e('0x4e')]);_0x5e9c92[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x5e9c92[_0x0a9e('0x4a')],_0x5e9c92[_0x0a9e('0x4e')]);_0x22d31f[_0x0a9e('0x52')]=_[_0x0a9e('0x51')](_0x5e9c92[_0x0a9e('0x4a')],qs[_0x0a9e('0x53')](_0x5b6447[_0x0a9e('0x4e')][_0x0a9e('0x53')]));_0x22d31f[_0x0a9e('0x52')]=_0x22d31f['attributes'][_0x0a9e('0x54')]?_0x22d31f[_0x0a9e('0x52')]:_0x5e9c92[_0x0a9e('0x4a')];_0x22d31f[_0x0a9e('0x56')]=qs['sort'](_0x5b6447['query']['sort']);_0x22d31f[_0x0a9e('0x58')]=qs['filters'](_[_0x0a9e('0x59')](_0x5b6447[_0x0a9e('0x4e')],_0x5e9c92[_0x0a9e('0x50')]));if(_0x5b6447[_0x0a9e('0x4e')][_0x0a9e('0x3a')]){_0x22d31f[_0x0a9e('0x58')]=_[_0x0a9e('0x5a')](_0x22d31f[_0x0a9e('0x58')],{'$or':_[_0x0a9e('0x45')](_0x22d31f[_0x0a9e('0x52')],function(_0x4a87a0){var _0x283c59={};_0x283c59[_0x4a87a0]={'$like':'%'+_0x5b6447['query'][_0x0a9e('0x3a')]+'%'};return _0x283c59;})});}_0x22d31f=_['merge']({},_0x22d31f,_0x5b6447[_0x0a9e('0x5e')]);return _0x122e7d[_0x0a9e('0xd5')](_0x22d31f);}})[_0x0a9e('0x32')](function(_0x556bb7){if(_0x556bb7){_0x21e210=_0x556bb7[_0x0a9e('0x54')];if(!_0x5b6447[_0x0a9e('0x4e')]['hasOwnProperty']('nolimit')){_0x22d31f[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x5b6447[_0x0a9e('0x4e')]['limit']);_0x22d31f['offset']=qs['offset'](_0x5b6447[_0x0a9e('0x4e')][_0x0a9e('0x2c')]);}return _0x122e7d[_0x0a9e('0xd5')](_0x22d31f);}})[_0x0a9e('0x32')](function(_0x3d4349){if(_0x3d4349){return _0x3d4349?{'count':_0x21e210,'rows':_0x3d4349}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x31fe9e,null))[_0x0a9e('0x28')](handleError(_0x31fe9e,null));};exports[_0x0a9e('0xd7')]=function(_0x348f2d,_0x18e38b,_0xc9669d){var _0x2f4de1={};var _0x13215c={};var _0x4104d1;var _0x310758;return db[_0x0a9e('0x46')][_0x0a9e('0xa6')]({'where':{'id':_0x348f2d[_0x0a9e('0x64')]['id']}})['then'](handleEntityNotFound(_0x18e38b,null))[_0x0a9e('0x32')](function(_0x25ba4e){if(_0x25ba4e){_0x4104d1=_0x25ba4e;_0x13215c[_0x0a9e('0x4a')]=_[_0x0a9e('0x4f')](db[_0x0a9e('0xd8')][_0x0a9e('0xd6')]);_0x13215c['query']=_[_0x0a9e('0x4f')](_0x348f2d[_0x0a9e('0x4e')]);_0x13215c[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x13215c[_0x0a9e('0x4a')],_0x13215c[_0x0a9e('0x4e')]);_0x2f4de1[_0x0a9e('0x52')]=_[_0x0a9e('0x51')](_0x13215c[_0x0a9e('0x4a')],qs['fields'](_0x348f2d['query'][_0x0a9e('0x53')]));_0x2f4de1[_0x0a9e('0x52')]=_0x2f4de1['attributes'][_0x0a9e('0x54')]?_0x2f4de1[_0x0a9e('0x52')]:_0x13215c['model'];_0x2f4de1[_0x0a9e('0x56')]=qs['sort'](_0x348f2d[_0x0a9e('0x4e')][_0x0a9e('0x57')]);_0x2f4de1['where']=qs[_0x0a9e('0x50')](_[_0x0a9e('0x59')](_0x348f2d['query'],_0x13215c[_0x0a9e('0x50')]));if(_0x348f2d[_0x0a9e('0x4e')]['filter']){_0x2f4de1[_0x0a9e('0x58')]=_[_0x0a9e('0x5a')](_0x2f4de1[_0x0a9e('0x58')],{'$or':_[_0x0a9e('0x45')](_0x2f4de1[_0x0a9e('0x52')],function(_0x17a0d5){var _0x5d525f={};_0x5d525f[_0x17a0d5]={'$like':'%'+_0x348f2d[_0x0a9e('0x4e')][_0x0a9e('0x3a')]+'%'};return _0x5d525f;})});}_0x2f4de1=_['merge']({},_0x2f4de1,_0x348f2d[_0x0a9e('0x5e')]);return _0x4104d1[_0x0a9e('0xd7')](_0x2f4de1);}})[_0x0a9e('0x32')](function(_0x2a6789){if(_0x2a6789){_0x310758=_0x2a6789[_0x0a9e('0x54')];if(!_0x348f2d[_0x0a9e('0x4e')][_0x0a9e('0xce')]('nolimit')){_0x2f4de1['limit']=qs['limit'](_0x348f2d['query']['limit']);_0x2f4de1[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x348f2d['query']['offset']);}return _0x4104d1[_0x0a9e('0xd7')](_0x2f4de1);}})['then'](function(_0x41600e){if(_0x41600e){return _0x41600e?{'count':_0x310758,'rows':_0x41600e}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x18e38b,null))[_0x0a9e('0x28')](handleError(_0x18e38b,null));};exports[_0x0a9e('0xd9')]=function(_0x336518,_0x14a683,_0x49b97a){var _0xfd7f01={'raw':!![],'where':{}};var _0x4733c6={};var _0x58006d={'count':0x0,'rows':[]};return db[_0x0a9e('0x46')][_0x0a9e('0xa6')]({'where':{'id':_0x336518[_0x0a9e('0x64')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x14a683,null))[_0x0a9e('0x32')](function(_0x2f1cc0){if(_0x2f1cc0){_0x4733c6[_0x0a9e('0x4a')]=_['keys'](db[_0x0a9e('0xda')]['rawAttributes']);_0x4733c6[_0x0a9e('0x4e')]=_[_0x0a9e('0x4f')](_0x336518['query']);_0x4733c6[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x4733c6['model'],_0x4733c6[_0x0a9e('0x4e')]);_0xfd7f01['attributes']=_[_0x0a9e('0x51')](_0x4733c6[_0x0a9e('0x4a')],qs['fields'](_0x336518[_0x0a9e('0x4e')]['fields']));_0xfd7f01[_0x0a9e('0x52')]=_0xfd7f01[_0x0a9e('0x52')][_0x0a9e('0x54')]?_0xfd7f01[_0x0a9e('0x52')]:_0x4733c6[_0x0a9e('0x4a')];if(!_0x336518[_0x0a9e('0x4e')][_0x0a9e('0xce')]('nolimit')){_0xfd7f01[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x336518[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0xfd7f01[_0x0a9e('0x2c')]=qs['offset'](_0x336518[_0x0a9e('0x4e')]['offset']);}_0xfd7f01['order']=qs[_0x0a9e('0x57')](_0x336518['query'][_0x0a9e('0x57')]);_0xfd7f01[_0x0a9e('0x58')]=qs['filters'](_[_0x0a9e('0x59')](_0x336518[_0x0a9e('0x4e')],_0x4733c6[_0x0a9e('0x50')]));_0xfd7f01[_0x0a9e('0x58')][_0x0a9e('0xdb')]=_0x2f1cc0['id'];if(_0x336518[_0x0a9e('0x4e')][_0x0a9e('0x3a')]){_0xfd7f01[_0x0a9e('0x58')]=_[_0x0a9e('0x5a')](_0xfd7f01['where'],{'$or':_[_0x0a9e('0x45')](_0xfd7f01[_0x0a9e('0x52')],function(_0x23ff8c){var _0x43403c={};_0x43403c[_0x23ff8c]={'$like':'%'+_0x336518['query'][_0x0a9e('0x3a')]+'%'};return _0x43403c;})});}_0xfd7f01=_[_0x0a9e('0x5a')]({},_0xfd7f01,_0x336518[_0x0a9e('0x5e')]);return db['VoiceRecording'][_0x0a9e('0x5f')]({'where':_0xfd7f01[_0x0a9e('0x58')]})[_0x0a9e('0x32')](function(_0x5598ea){_0x58006d[_0x0a9e('0x5f')]=_0x5598ea;if(_0x336518['query'][_0x0a9e('0x65')]){_0xfd7f01[_0x0a9e('0x60')]=[{'all':!![]}];}return db[_0x0a9e('0xda')][_0x0a9e('0x61')](_0xfd7f01);})[_0x0a9e('0x32')](function(_0x1b86e6){_0x58006d[_0x0a9e('0x62')]=_0x1b86e6;return _0x58006d;});}})['then'](respondWithFilteredResult(_0x14a683,_0xfd7f01))[_0x0a9e('0x28')](handleError(_0x14a683,null));};exports[_0x0a9e('0xdc')]=function(_0x7c4db6,_0x14444e,_0x1eb768){var _0x117694={'raw':!![],'where':{}};var _0x3a4def={};var _0x2670f5={'count':0x0,'rows':[]};return db[_0x0a9e('0x46')][_0x0a9e('0xa6')]({'where':{'id':_0x7c4db6[_0x0a9e('0x64')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x14444e,null))[_0x0a9e('0x32')](function(_0x2e8369){if(_0x2e8369){_0x3a4def[_0x0a9e('0x4a')]=_[_0x0a9e('0x4f')](db[_0x0a9e('0xdd')][_0x0a9e('0xd6')]);_0x3a4def[_0x0a9e('0x4e')]=_[_0x0a9e('0x4f')](_0x7c4db6[_0x0a9e('0x4e')]);_0x3a4def[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x3a4def['model'],_0x3a4def[_0x0a9e('0x4e')]);_0x117694[_0x0a9e('0x52')]=_[_0x0a9e('0x51')](_0x3a4def['model'],qs[_0x0a9e('0x53')](_0x7c4db6['query'][_0x0a9e('0x53')]));_0x117694[_0x0a9e('0x52')]=_0x117694[_0x0a9e('0x52')][_0x0a9e('0x54')]?_0x117694[_0x0a9e('0x52')]:_0x3a4def[_0x0a9e('0x4a')];if(!_0x7c4db6[_0x0a9e('0x4e')][_0x0a9e('0xce')]('nolimit')){_0x117694[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x7c4db6['query'][_0x0a9e('0x2d')]);_0x117694[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x7c4db6['query'][_0x0a9e('0x2c')]);}_0x117694[_0x0a9e('0x56')]=qs[_0x0a9e('0x57')](_0x7c4db6[_0x0a9e('0x4e')]['sort']);_0x117694[_0x0a9e('0x58')]=qs[_0x0a9e('0x50')](_[_0x0a9e('0x59')](_0x7c4db6[_0x0a9e('0x4e')],_0x3a4def[_0x0a9e('0x50')]));_0x117694['where'][_0x0a9e('0xdb')]=_0x2e8369['id'];if(_0x7c4db6[_0x0a9e('0x4e')]['filter']){_0x117694[_0x0a9e('0x58')]=_[_0x0a9e('0x5a')](_0x117694[_0x0a9e('0x58')],{'$or':_['map'](_0x117694['attributes'],function(_0x45ef37){var _0x36d905={};_0x36d905[_0x45ef37]={'$like':'%'+_0x7c4db6[_0x0a9e('0x4e')][_0x0a9e('0x3a')]+'%'};return _0x36d905;})});}_0x117694=_[_0x0a9e('0x5a')]({},_0x117694,_0x7c4db6[_0x0a9e('0x5e')]);return db[_0x0a9e('0xdd')][_0x0a9e('0x5f')]({'where':_0x117694['where']})['then'](function(_0x46509b){_0x2670f5['count']=_0x46509b;if(_0x7c4db6[_0x0a9e('0x4e')][_0x0a9e('0x65')]){_0x117694[_0x0a9e('0x60')]=[{'all':!![]}];}return db[_0x0a9e('0xdd')]['findAll'](_0x117694);})[_0x0a9e('0x32')](function(_0x43c1d1){_0x2670f5['rows']=_0x43c1d1;return _0x2670f5;});}})[_0x0a9e('0x32')](respondWithFilteredResult(_0x14444e,_0x117694))['catch'](handleError(_0x14444e,null));};exports[_0x0a9e('0xde')]=function(_0x30a77e,_0xd63c87,_0xc2f873){var _0x223e19={};var _0x3b459b={};var _0x595efc;var _0x16d50b;return db['User'][_0x0a9e('0xa6')]({'where':{'id':_0x30a77e[_0x0a9e('0x64')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0xd63c87,null))[_0x0a9e('0x32')](function(_0xa244bc){if(_0xa244bc){_0x595efc=_0xa244bc;_0x3b459b[_0x0a9e('0x4a')]=_[_0x0a9e('0x4f')](db['ChatInteraction'][_0x0a9e('0xd6')]);_0x3b459b[_0x0a9e('0x4e')]=_[_0x0a9e('0x4f')](_0x30a77e[_0x0a9e('0x4e')]);_0x3b459b[_0x0a9e('0x50')]=_['intersection'](_0x3b459b[_0x0a9e('0x4a')],_0x3b459b[_0x0a9e('0x4e')]);_0x223e19['attributes']=_['intersection'](_0x3b459b[_0x0a9e('0x4a')],qs[_0x0a9e('0x53')](_0x30a77e[_0x0a9e('0x4e')][_0x0a9e('0x53')]));_0x223e19[_0x0a9e('0x52')]=_0x223e19[_0x0a9e('0x52')]['length']?_0x223e19[_0x0a9e('0x52')]:_0x3b459b[_0x0a9e('0x4a')];_0x223e19[_0x0a9e('0x56')]=qs['sort'](_0x30a77e[_0x0a9e('0x4e')][_0x0a9e('0x57')]);_0x223e19[_0x0a9e('0x58')]=qs[_0x0a9e('0x50')](_['pick'](_0x30a77e['query'],_0x3b459b[_0x0a9e('0x50')]));if(_0x30a77e[_0x0a9e('0x4e')][_0x0a9e('0x3a')]){_0x223e19[_0x0a9e('0x58')]=_[_0x0a9e('0x5a')](_0x223e19[_0x0a9e('0x58')],{'$or':_[_0x0a9e('0x45')](_0x223e19[_0x0a9e('0x52')],function(_0x4a4f79){var _0x17187c={};_0x17187c[_0x4a4f79]={'$like':'%'+_0x30a77e['query'][_0x0a9e('0x3a')]+'%'};return _0x17187c;})});}_0x223e19=_[_0x0a9e('0x5a')]({},_0x223e19,_0x30a77e[_0x0a9e('0x5e')]);return _0x595efc['getChatInteractions'](_0x223e19);}})['then'](function(_0x462ecd){if(_0x462ecd){_0x16d50b=_0x462ecd['length'];if(!_0x30a77e[_0x0a9e('0x4e')]['hasOwnProperty']('nolimit')){_0x223e19[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x30a77e[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x223e19[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x30a77e[_0x0a9e('0x4e')][_0x0a9e('0x2c')]);}return _0x595efc[_0x0a9e('0xde')](_0x223e19);}})[_0x0a9e('0x32')](function(_0x81f495){if(_0x81f495){return _0x81f495?{'count':_0x16d50b,'rows':_0x81f495}:null;}})[_0x0a9e('0x32')](respondWithResult(_0xd63c87,null))[_0x0a9e('0x28')](handleError(_0xd63c87,null));};exports['getOpenchannelInteractions']=function(_0x58f251,_0x3bde76,_0x48c889){var _0x2649f2={};var _0x1db652={};var _0x27be90;var _0x54befc;return db['User'][_0x0a9e('0xa6')]({'where':{'id':_0x58f251[_0x0a9e('0x64')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x3bde76,null))[_0x0a9e('0x32')](function(_0x193e3b){if(_0x193e3b){_0x27be90=_0x193e3b;_0x1db652[_0x0a9e('0x4a')]=_[_0x0a9e('0x4f')](db['OpenchannelInteraction'][_0x0a9e('0xd6')]);_0x1db652['query']=_[_0x0a9e('0x4f')](_0x58f251[_0x0a9e('0x4e')]);_0x1db652['filters']=_[_0x0a9e('0x51')](_0x1db652[_0x0a9e('0x4a')],_0x1db652[_0x0a9e('0x4e')]);_0x2649f2[_0x0a9e('0x52')]=_[_0x0a9e('0x51')](_0x1db652[_0x0a9e('0x4a')],qs['fields'](_0x58f251[_0x0a9e('0x4e')][_0x0a9e('0x53')]));_0x2649f2[_0x0a9e('0x52')]=_0x2649f2['attributes'][_0x0a9e('0x54')]?_0x2649f2[_0x0a9e('0x52')]:_0x1db652[_0x0a9e('0x4a')];_0x2649f2['order']=qs[_0x0a9e('0x57')](_0x58f251[_0x0a9e('0x4e')][_0x0a9e('0x57')]);_0x2649f2[_0x0a9e('0x58')]=qs[_0x0a9e('0x50')](_[_0x0a9e('0x59')](_0x58f251['query'],_0x1db652['filters']));if(_0x58f251[_0x0a9e('0x4e')][_0x0a9e('0x3a')]){_0x2649f2['where']=_[_0x0a9e('0x5a')](_0x2649f2[_0x0a9e('0x58')],{'$or':_[_0x0a9e('0x45')](_0x2649f2[_0x0a9e('0x52')],function(_0x2e413d){var _0x4e3983={};_0x4e3983[_0x2e413d]={'$like':'%'+_0x58f251['query'][_0x0a9e('0x3a')]+'%'};return _0x4e3983;})});}_0x2649f2=_[_0x0a9e('0x5a')]({},_0x2649f2,_0x58f251[_0x0a9e('0x5e')]);return _0x27be90['getOpenchannelInteractions'](_0x2649f2);}})[_0x0a9e('0x32')](function(_0x4532de){if(_0x4532de){_0x54befc=_0x4532de[_0x0a9e('0x54')];if(!_0x58f251[_0x0a9e('0x4e')]['hasOwnProperty']('nolimit')){_0x2649f2[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x58f251[_0x0a9e('0x4e')]['limit']);_0x2649f2[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x58f251[_0x0a9e('0x4e')][_0x0a9e('0x2c')]);}return _0x27be90[_0x0a9e('0xdf')](_0x2649f2);}})[_0x0a9e('0x32')](function(_0x37c14b){if(_0x37c14b){return _0x37c14b?{'count':_0x54befc,'rows':_0x37c14b}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x3bde76,null))['catch'](handleError(_0x3bde76,null));};exports['getMailInteractions']=function(_0x17fd14,_0x1c71ad,_0x58e948){var _0xe6701c={'raw':!![],'where':{}};var _0x5eb336={};var _0x1f80cb={'count':0x0,'rows':[]};return db[_0x0a9e('0x46')]['findOne']({'where':{'id':_0x17fd14[_0x0a9e('0x64')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x1c71ad,null))['then'](function(_0x15b0ba){if(_0x15b0ba){_0x5eb336[_0x0a9e('0x4a')]=_[_0x0a9e('0x4f')](db[_0x0a9e('0xe0')][_0x0a9e('0xd6')]);_0x5eb336[_0x0a9e('0x4e')]=_[_0x0a9e('0x4f')](_0x17fd14['query']);_0x5eb336[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x5eb336[_0x0a9e('0x4a')],_0x5eb336[_0x0a9e('0x4e')]);_0xe6701c[_0x0a9e('0x52')]=_[_0x0a9e('0x51')](_0x5eb336[_0x0a9e('0x4a')],qs['fields'](_0x17fd14['query'][_0x0a9e('0x53')]));_0xe6701c[_0x0a9e('0x52')]=_0xe6701c[_0x0a9e('0x52')]['length']?_0xe6701c['attributes']:_0x5eb336[_0x0a9e('0x4a')];if(!_0x17fd14['query'][_0x0a9e('0xce')](_0x0a9e('0x55'))){_0xe6701c[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x17fd14[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0xe6701c[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x17fd14[_0x0a9e('0x4e')]['offset']);}_0xe6701c['order']=qs[_0x0a9e('0x57')](_0x17fd14['query'][_0x0a9e('0x57')]);_0xe6701c[_0x0a9e('0x58')]=qs[_0x0a9e('0x50')](_[_0x0a9e('0x59')](_0x17fd14['query'],_0x5eb336[_0x0a9e('0x50')]));_0xe6701c[_0x0a9e('0x58')][_0x0a9e('0xdb')]=_0x15b0ba['id'];if(_0x17fd14['query'][_0x0a9e('0x3a')]){_0xe6701c[_0x0a9e('0x58')]=_[_0x0a9e('0x5a')](_0xe6701c['where'],{'$or':_[_0x0a9e('0x45')](_0xe6701c[_0x0a9e('0x52')],function(_0x459ab7){var _0x6e8a19={};_0x6e8a19[_0x459ab7]={'$like':'%'+_0x17fd14[_0x0a9e('0x4e')][_0x0a9e('0x3a')]+'%'};return _0x6e8a19;})});}_0xe6701c=_['merge']({},_0xe6701c,_0x17fd14['options']);return db[_0x0a9e('0xe0')][_0x0a9e('0x5f')]({'where':_0xe6701c[_0x0a9e('0x58')]})['then'](function(_0x5990e1){_0x1f80cb[_0x0a9e('0x5f')]=_0x5990e1;if(_0x17fd14[_0x0a9e('0x4e')][_0x0a9e('0x65')]){_0xe6701c['include']=[{'all':!![]}];}return db['MailInteraction'][_0x0a9e('0x61')](_0xe6701c);})[_0x0a9e('0x32')](function(_0x33046a){_0x1f80cb[_0x0a9e('0x62')]=_0x33046a;return _0x1f80cb;});}})[_0x0a9e('0x32')](respondWithFilteredResult(_0x1c71ad,_0xe6701c))['catch'](handleError(_0x1c71ad,null));};exports[_0x0a9e('0xe1')]=function(_0x4b62e8,_0x385f4e,_0x311e40){var _0x57e719={};var _0xeed3a={};var _0x4ccc3c;var _0xd03230;return db[_0x0a9e('0x46')][_0x0a9e('0xa6')]({'where':{'id':_0x4b62e8[_0x0a9e('0x64')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x385f4e,null))['then'](function(_0x42c3a9){if(_0x42c3a9){_0x4ccc3c=_0x42c3a9;_0xeed3a[_0x0a9e('0x4a')]=_[_0x0a9e('0x4f')](db['SmsInteraction'][_0x0a9e('0xd6')]);_0xeed3a['query']=_[_0x0a9e('0x4f')](_0x4b62e8[_0x0a9e('0x4e')]);_0xeed3a[_0x0a9e('0x50')]=_['intersection'](_0xeed3a[_0x0a9e('0x4a')],_0xeed3a[_0x0a9e('0x4e')]);_0x57e719[_0x0a9e('0x52')]=_[_0x0a9e('0x51')](_0xeed3a[_0x0a9e('0x4a')],qs[_0x0a9e('0x53')](_0x4b62e8['query'][_0x0a9e('0x53')]));_0x57e719[_0x0a9e('0x52')]=_0x57e719[_0x0a9e('0x52')][_0x0a9e('0x54')]?_0x57e719[_0x0a9e('0x52')]:_0xeed3a[_0x0a9e('0x4a')];_0x57e719[_0x0a9e('0x56')]=qs[_0x0a9e('0x57')](_0x4b62e8['query'][_0x0a9e('0x57')]);_0x57e719[_0x0a9e('0x58')]=qs[_0x0a9e('0x50')](_[_0x0a9e('0x59')](_0x4b62e8['query'],_0xeed3a[_0x0a9e('0x50')]));if(_0x4b62e8['query'][_0x0a9e('0x3a')]){_0x57e719[_0x0a9e('0x58')]=_[_0x0a9e('0x5a')](_0x57e719['where'],{'$or':_[_0x0a9e('0x45')](_0x57e719[_0x0a9e('0x52')],function(_0x433f3f){var _0x36c0f4={};_0x36c0f4[_0x433f3f]={'$like':'%'+_0x4b62e8['query'][_0x0a9e('0x3a')]+'%'};return _0x36c0f4;})});}_0x57e719=_[_0x0a9e('0x5a')]({},_0x57e719,_0x4b62e8[_0x0a9e('0x5e')]);return _0x4ccc3c[_0x0a9e('0xe1')](_0x57e719);}})[_0x0a9e('0x32')](function(_0x1568bd){if(_0x1568bd){_0xd03230=_0x1568bd[_0x0a9e('0x54')];if(!_0x4b62e8['query'][_0x0a9e('0xce')](_0x0a9e('0x55'))){_0x57e719[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x4b62e8['query'][_0x0a9e('0x2d')]);_0x57e719['offset']=qs[_0x0a9e('0x2c')](_0x4b62e8[_0x0a9e('0x4e')][_0x0a9e('0x2c')]);}return _0x4ccc3c[_0x0a9e('0xe1')](_0x57e719);}})[_0x0a9e('0x32')](function(_0x478b46){if(_0x478b46){return _0x478b46?{'count':_0xd03230,'rows':_0x478b46}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x385f4e,null))['catch'](handleError(_0x385f4e,null));};exports[_0x0a9e('0xe2')]=function(_0x4ac7f1,_0x382412,_0x1612d8){var _0x47d640={};var _0x2ebed3={};var _0x167f89;var _0x46f728;return db[_0x0a9e('0x46')]['findOne']({'where':{'id':_0x4ac7f1[_0x0a9e('0x64')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x382412,null))['then'](function(_0xcc859d){if(_0xcc859d){_0x167f89=_0xcc859d;_0x2ebed3['model']=_['keys'](db['FaxInteraction'][_0x0a9e('0xd6')]);_0x2ebed3[_0x0a9e('0x4e')]=_['keys'](_0x4ac7f1[_0x0a9e('0x4e')]);_0x2ebed3[_0x0a9e('0x50')]=_['intersection'](_0x2ebed3[_0x0a9e('0x4a')],_0x2ebed3[_0x0a9e('0x4e')]);_0x47d640[_0x0a9e('0x52')]=_[_0x0a9e('0x51')](_0x2ebed3[_0x0a9e('0x4a')],qs[_0x0a9e('0x53')](_0x4ac7f1[_0x0a9e('0x4e')]['fields']));_0x47d640[_0x0a9e('0x52')]=_0x47d640['attributes'][_0x0a9e('0x54')]?_0x47d640[_0x0a9e('0x52')]:_0x2ebed3[_0x0a9e('0x4a')];_0x47d640[_0x0a9e('0x56')]=qs[_0x0a9e('0x57')](_0x4ac7f1[_0x0a9e('0x4e')]['sort']);_0x47d640[_0x0a9e('0x58')]=qs[_0x0a9e('0x50')](_[_0x0a9e('0x59')](_0x4ac7f1['query'],_0x2ebed3[_0x0a9e('0x50')]));if(_0x4ac7f1[_0x0a9e('0x4e')][_0x0a9e('0x3a')]){_0x47d640[_0x0a9e('0x58')]=_[_0x0a9e('0x5a')](_0x47d640[_0x0a9e('0x58')],{'$or':_[_0x0a9e('0x45')](_0x47d640[_0x0a9e('0x52')],function(_0x4562f5){var _0x1ca28d={};_0x1ca28d[_0x4562f5]={'$like':'%'+_0x4ac7f1[_0x0a9e('0x4e')][_0x0a9e('0x3a')]+'%'};return _0x1ca28d;})});}_0x47d640=_[_0x0a9e('0x5a')]({},_0x47d640,_0x4ac7f1[_0x0a9e('0x5e')]);return _0x167f89[_0x0a9e('0xe2')](_0x47d640);}})[_0x0a9e('0x32')](function(_0x515f8f){if(_0x515f8f){_0x46f728=_0x515f8f[_0x0a9e('0x54')];if(!_0x4ac7f1[_0x0a9e('0x4e')][_0x0a9e('0xce')]('nolimit')){_0x47d640[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x4ac7f1[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x47d640['offset']=qs[_0x0a9e('0x2c')](_0x4ac7f1[_0x0a9e('0x4e')][_0x0a9e('0x2c')]);}return _0x167f89[_0x0a9e('0xe2')](_0x47d640);}})['then'](function(_0x2b263b){if(_0x2b263b){return _0x2b263b?{'count':_0x46f728,'rows':_0x2b263b}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x382412,null))[_0x0a9e('0x28')](handleError(_0x382412,null));};exports[_0x0a9e('0xe3')]=function(_0x58a46f,_0x4b7595,_0xbb4d1b){var _0x44343f={};var _0x2de997={};var _0x353960;var _0x8c1ac4;return db[_0x0a9e('0x46')][_0x0a9e('0xa6')]({'where':{'id':_0x58a46f[_0x0a9e('0x64')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x4b7595,null))[_0x0a9e('0x32')](function(_0x323506){if(_0x323506){_0x353960=_0x323506;_0x2de997[_0x0a9e('0x4a')]=_[_0x0a9e('0x4f')](db[_0x0a9e('0xe4')]['rawAttributes']);_0x2de997[_0x0a9e('0x4e')]=_[_0x0a9e('0x4f')](_0x58a46f[_0x0a9e('0x4e')]);_0x2de997['filters']=_['intersection'](_0x2de997[_0x0a9e('0x4a')],_0x2de997['query']);_0x44343f[_0x0a9e('0x52')]=_[_0x0a9e('0x51')](_0x2de997[_0x0a9e('0x4a')],qs[_0x0a9e('0x53')](_0x58a46f['query']['fields']));_0x44343f[_0x0a9e('0x52')]=_0x44343f[_0x0a9e('0x52')][_0x0a9e('0x54')]?_0x44343f[_0x0a9e('0x52')]:_0x2de997['model'];_0x44343f[_0x0a9e('0x56')]=qs[_0x0a9e('0x57')](_0x58a46f[_0x0a9e('0x4e')][_0x0a9e('0x57')]);_0x44343f[_0x0a9e('0x58')]=qs['filters'](_['pick'](_0x58a46f[_0x0a9e('0x4e')],_0x2de997[_0x0a9e('0x50')]));if(_0x58a46f[_0x0a9e('0x4e')][_0x0a9e('0x3a')]){_0x44343f[_0x0a9e('0x58')]=_[_0x0a9e('0x5a')](_0x44343f[_0x0a9e('0x58')],{'$or':_['map'](_0x44343f[_0x0a9e('0x52')],function(_0xd73712){var _0x173daf={};_0x173daf[_0xd73712]={'$like':'%'+_0x58a46f['query']['filter']+'%'};return _0x173daf;})});}_0x44343f=_['merge']({},_0x44343f,_0x58a46f[_0x0a9e('0x5e')]);return _0x353960[_0x0a9e('0xe3')](_0x44343f);}})['then'](function(_0x419d9e){if(_0x419d9e){_0x8c1ac4=_0x419d9e[_0x0a9e('0x54')];if(!_0x58a46f[_0x0a9e('0x4e')]['hasOwnProperty']('nolimit')){_0x44343f[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x58a46f[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x44343f['offset']=qs[_0x0a9e('0x2c')](_0x58a46f['query']['offset']);}return _0x353960[_0x0a9e('0xe3')](_0x44343f);}})['then'](function(_0x98bab3){if(_0x98bab3){return _0x98bab3?{'count':_0x8c1ac4,'rows':_0x98bab3}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x4b7595,null))[_0x0a9e('0x28')](handleError(_0x4b7595,null));};exports['login']=function(_0x3229c1,_0x1a2ea6,_0x432ad8){var _0x5c39d1;var _0x5b20fa;var _0x3aa901;var _0xb3e9cb=!_[_0x0a9e('0x72')](_0x3229c1[_0x0a9e('0x64')]['id'])?_0x3229c1[_0x0a9e('0x64')]['id']:!_[_0x0a9e('0x72')](_0x3229c1['user']['id'])?_0x3229c1['user']['id']:null;return db[_0x0a9e('0x46')][_0x0a9e('0x66')]({'where':{'id':_0xb3e9cb,'role':{'$or':['admin','user','agent']}},'attributes':['id','name','phone','mobile',_0x0a9e('0x34'),'internal',_0x0a9e('0xad')]})[_0x0a9e('0x32')](function(_0x2d0ed3){if(_0x2d0ed3){if(_0x2d0ed3[_0x0a9e('0x34')]===_0x0a9e('0x38')){_0x5c39d1=_0x2d0ed3;if(_0x3229c1[_0x0a9e('0x68')][_0x0a9e('0xae')]){_0x3aa901=util['format'](_0x0a9e('0xe5'),_0x5c39d1[_0x3229c1[_0x0a9e('0x68')][_0x0a9e('0xae')]]);}else if(_0x3229c1[_0x0a9e('0x68')][_0x0a9e('0xe6')]){_0x3aa901=util[_0x0a9e('0xbb')](_0x0a9e('0xbc'),_0x3229c1[_0x0a9e('0x68')][_0x0a9e('0xe6')]);}else{_0x3aa901=util[_0x0a9e('0xbb')](_0x0a9e('0xbc'),_0x5c39d1['name']);}socket['to'](util[_0x0a9e('0xbb')](_0x0a9e('0xe7'),_0x5c39d1['name']))[_0x0a9e('0xb7')]('user:forcelogout',{'user':{'id':_0x5c39d1['id'],'name':_0x5c39d1[_0x0a9e('0x3e')]},'ip':_0x3229c1[_0x0a9e('0xe8')]['x-forwarded-for']||_0x3229c1['connection'][_0x0a9e('0xe9')]||_0x3229c1['socket'][_0x0a9e('0xe9')]||_0x3229c1[_0x0a9e('0xea')][_0x0a9e('0xeb')][_0x0a9e('0xe9')]});return db[_0x0a9e('0xbe')]['destroy']({'where':{'membername':_0x5c39d1[_0x0a9e('0x3e')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError'](_0x0a9e('0xec'));}})[_0x0a9e('0x32')](function(){if(_0x5c39d1){return _0x5c39d1[_0x0a9e('0xed')]({'raw':!![]});}})[_0x0a9e('0x32')](function(_0x379f1f){if(_0x5c39d1){var _0x489e58=[];if(_0x379f1f){_0x5b20fa=_0x379f1f;if(_0x5b20fa[_0x0a9e('0x54')]){for(var _0x425fa1=0x0;_0x425fa1<_0x5b20fa[_0x0a9e('0x54')];_0x425fa1++){_0x489e58[_0x0a9e('0x98')]({'membername':_0x5c39d1['name'],'UserId':_0x5c39d1['id'],'queue_name':_0x5b20fa[_0x425fa1][_0x0a9e('0x3e')],'VoiceQueueId':_0x5b20fa[_0x425fa1]['id'],'interface':_0x3aa901,'paused':_0x5c39d1[_0x0a9e('0xad')]||![],'penalty':_0x5b20fa[_0x425fa1]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x0a9e('0x9a')](_0x489e58,function(_0x36d8a1){return db[_0x0a9e('0xbe')][_0x0a9e('0xbf')](_0x36d8a1);});}}}})['then'](function(){if(_0x5c39d1){return db[_0x0a9e('0xee')][_0x0a9e('0x61')]({'where':{'membername':_0x5c39d1[_0x0a9e('0x3e')],'exitAt':null}});}})[_0x0a9e('0x32')](function(_0x2673ea){if(_0x5c39d1){var _0x4b829f=[];_0x2673ea[_0x0a9e('0xef')](function(_0xa52efe){_0x4b829f['push'](_0xa52efe[_0x0a9e('0x67')]({'exitAt':moment()['format'](_0x0a9e('0xf0'))}));});return BPromise[_0x0a9e('0x99')](_0x4b829f);}})[_0x0a9e('0x32')](function(){if(_0x5c39d1){var _0x1f2eaa=[];var _0x9c7523=[];var _0x115092=utils[_0x0a9e('0xf1')]();var _0xfddd6e={'membername':_0x5c39d1[_0x0a9e('0x3e')],'interface':_0x3aa901,'enterAt':moment()[_0x0a9e('0xbb')](_0x0a9e('0xf0')),'role':_0x5c39d1[_0x0a9e('0x34')],'internal':_0x5c39d1[_0x0a9e('0x71')]};_0x115092[_0x0a9e('0xef')](function(_0x435f11){_0x1f2eaa['push'](_[_0x0a9e('0x5a')]({'channel':_0x435f11,'type':_0x0a9e('0xf2'),'data1':_0x3229c1[_0x0a9e('0x68')][_0x0a9e('0xf3')],'data2':_0x3aa901},_0xfddd6e));if(_0x5c39d1[_0x0a9e('0xad')]){_0x9c7523[_0x0a9e('0x98')](_[_0x0a9e('0x5a')]({'channel':_0x435f11,'type':_0x0a9e('0xf4'),'data1':'LOGININPAUSE'},_0xfddd6e));}});return db['MemberReport']['bulkCreate'](_0x1f2eaa['concat'](_0x9c7523),{'individualHooks':!![]});}})[_0x0a9e('0x32')](function(){if(_0x5c39d1){return _0x5c39d1['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5c39d1[_0x0a9e('0xad')]||![],'mailPause':_0x5c39d1[_0x0a9e('0xad')]||![],'chatPause':_0x5c39d1[_0x0a9e('0xad')]||![],'faxPause':_0x5c39d1[_0x0a9e('0xad')]||![],'smsPause':_0x5c39d1['loginInPause']||![],'openchannelPause':_0x5c39d1['loginInPause']||![],'whatsappPause':_0x5c39d1[_0x0a9e('0xad')]||![],'pauseType':_0x5c39d1[_0x0a9e('0xad')]?_0x0a9e('0xf5'):null,'interface':_0x3aa901,'lastPauseAt':moment()[_0x0a9e('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x0a9e('0x32')](function(_0x9e2f5a){if(_0x3229c1[_0x0a9e('0xf6')]){return _0x432ad8();}else{return BPromise[_0x0a9e('0xf7')](_0x9e2f5a)[_0x0a9e('0x32')](respondWithResult(_0x1a2ea6,null));}})[_0x0a9e('0x28')](handleError(_0x1a2ea6,null));};exports['logout']=function(_0x298a78,_0x5056d5,_0x4c2bbd){var _0x22a553;return db['User'][_0x0a9e('0x66')]({'where':{'id':_0x298a78[_0x0a9e('0x64')]['id'],'role':_0x0a9e('0x38')},'attributes':['id',_0x0a9e('0x3e'),_0x0a9e('0x34')]})[_0x0a9e('0x32')](handleEntityNotFound(_0x5056d5,null))[_0x0a9e('0x32')](function(_0x38182c){if(_0x38182c){_0x22a553=_0x38182c;return db[_0x0a9e('0xbe')]['destroy']({'where':{'membername':_0x22a553[_0x0a9e('0x3e')]},'individualHooks':!![]});}})[_0x0a9e('0x32')](function(){return db['MemberReport'][_0x0a9e('0x61')]({'where':{'membername':_0x22a553[_0x0a9e('0x3e')],'exitAt':null}});})[_0x0a9e('0x32')](function(_0x38c42c){var _0x5a1649=[];_0x38c42c[_0x0a9e('0xef')](function(_0xcef65f){_0x5a1649[_0x0a9e('0x98')](_0xcef65f[_0x0a9e('0x67')]({'exitAt':moment()[_0x0a9e('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x5a1649);})[_0x0a9e('0x32')](function(){return _0x22a553['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0a9e('0x32')](respondWithResult(_0x5056d5,null))['catch'](handleError(_0x5056d5,null));};exports[_0x0a9e('0xf8')]=function(_0x510141,_0x230d1c,_0x50f11c){var _0x436a54;return db[_0x0a9e('0xbe')][_0x0a9e('0x67')]({'paused':0x1},{'where':{'UserId':_0x510141['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0x0a9e('0x46')]['find']({'where':{'id':_0x510141[_0x0a9e('0x64')]['id'],'role':'agent'},'attributes':['id',_0x0a9e('0x3e'),'role',_0x0a9e('0x71'),_0x0a9e('0xae')]});})['then'](handleEntityNotFound(_0x230d1c,null))[_0x0a9e('0x32')](function(_0x3eb8){if(_0x3eb8){_0x436a54=_0x3eb8;return respondWithRpcPromise(_0x0a9e('0xf9'),_0x0a9e('0xf8'),{'id':_0x436a54['id'],'name':_0x436a54[_0x0a9e('0x3e')],'pause':!![]});}})[_0x0a9e('0x32')](function(){if(_0x436a54){return db[_0x0a9e('0xee')][_0x0a9e('0x61')]({'where':{'membername':_0x436a54[_0x0a9e('0x3e')],'type':'PAUSE','exitAt':null}});}})[_0x0a9e('0x32')](function(_0xdb234d){if(_0xdb234d[_0x0a9e('0x54')]){var _0x1cbde1=moment()[_0x0a9e('0xbb')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x59dab2=0x0,_0x20b5b1=_0xdb234d['length'];_0x59dab2<_0x20b5b1;_0x59dab2++){_0xdb234d[_0x59dab2][_0x0a9e('0xfa')]({'exitAt':_0x1cbde1});}}})['then'](function(){var _0x3b43a4=[];var _0x3e4739=utils[_0x0a9e('0xf1')]();_0x3e4739[_0x0a9e('0xef')](function(_0x2bf5fc){_0x3b43a4[_0x0a9e('0x98')]({'channel':_0x2bf5fc,'membername':_0x436a54[_0x0a9e('0x3e')],'interface':_['isNil'](_0x436a54['interface'])?util[_0x0a9e('0xbb')](_0x0a9e('0xbc'),_0x436a54['name']):_0x436a54[_0x0a9e('0xae')],'type':_0x0a9e('0xf4'),'enterAt':moment()[_0x0a9e('0xbb')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x510141['body']['type']||_0x0a9e('0xfb'),'role':_0x436a54[_0x0a9e('0x34')],'internal':_0x436a54[_0x0a9e('0x71')]});});return db[_0x0a9e('0xee')]['bulkCreate'](_0x3b43a4,{'individualHooks':!![]});})[_0x0a9e('0x32')](function(){return _0x436a54[_0x0a9e('0x67')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x510141[_0x0a9e('0x68')]['type']||_0x0a9e('0xfb'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x0a9e('0x32')](respondWithResult(_0x230d1c,null))[_0x0a9e('0x28')](handleError(_0x230d1c,null));};exports['unpause']=function(_0x5dbf0b,_0x31114d,_0x5dacb3){var _0x1352c;return db['User'][_0x0a9e('0x66')]({'where':{'id':_0x5dbf0b[_0x0a9e('0x64')]['id']},'attributes':['id',_0x0a9e('0x3e'),'role','voicePause',_0x0a9e('0xfc'),_0x0a9e('0xfd'),_0x0a9e('0xfe'),_0x0a9e('0xff'),'smsPause',_0x0a9e('0x100'),_0x0a9e('0x101'),'lastPauseAt']})[_0x0a9e('0x32')](handleEntityNotFound(_0x31114d,null))[_0x0a9e('0x32')](function(_0x11ba87){if(_0x11ba87){_0x1352c=_0x11ba87;if(_0x5dbf0b['body'][_0x0a9e('0xab')]&&!utils[_0x0a9e('0xaf')](_0x5dbf0b[_0x0a9e('0x68')][_0x0a9e('0xab')])){throw new db[(_0x0a9e('0xa1'))][(_0x0a9e('0xa3'))](_0x0a9e('0xb0'));}switch(_0x5dbf0b[_0x0a9e('0x68')][_0x0a9e('0xab')]){case _0x0a9e('0xba'):return respondWithRpcPromise(_0x0a9e('0xf9'),_0x0a9e('0x102'),{'id':_0x1352c['id'],'name':_0x1352c[_0x0a9e('0x3e')],'pause':![]})[_0x0a9e('0x32')](function(){return db[_0x0a9e('0xbe')][_0x0a9e('0x67')]({'paused':0x0},{'where':{'UserId':_0x1352c['id']},'individualHooks':!![]});})[_0x0a9e('0x32')](function(){return db[_0x0a9e('0xee')][_0x0a9e('0x66')]({'where':{'channel':_0x5dbf0b[_0x0a9e('0x68')][_0x0a9e('0xab')],'membername':_0x1352c[_0x0a9e('0x3e')],'type':'PAUSE','exitAt':null}});})[_0x0a9e('0x32')](function(_0xe6e376){if(_0xe6e376){return _0xe6e376[_0x0a9e('0x67')]({'exitAt':moment()['format'](_0x0a9e('0xf0')),'data2':_0x0a9e('0x103')},{'individualHooks':!![]});}return null;})[_0x0a9e('0x32')](function(){return _0x1352c[_0x0a9e('0x67')]({'voicePause':![]});});case'mail':case _0x0a9e('0x104'):case _0x0a9e('0x105'):case'sms':case _0x0a9e('0x106'):case _0x0a9e('0x107'):return db[_0x0a9e('0xee')]['find']({'where':{'channel':_0x5dbf0b['body'][_0x0a9e('0xab')],'membername':_0x1352c[_0x0a9e('0x3e')],'type':_0x0a9e('0xf4'),'exitAt':null}})['then'](function(_0x5b1ee9){if(_0x5b1ee9){return _0x5b1ee9[_0x0a9e('0x67')]({'exitAt':moment()[_0x0a9e('0xbb')](_0x0a9e('0xf0')),'data2':_0x0a9e('0x103')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x27d340={};_['set'](_0x27d340,util['format'](_0x0a9e('0x108'),_0x5dbf0b[_0x0a9e('0x68')][_0x0a9e('0xab')],'Pause'),![]);return _0x1352c[_0x0a9e('0x67')](_0x27d340);});default:return respondWithRpcPromise(_0x0a9e('0xf9'),_0x0a9e('0x102'),{'id':_0x1352c['id'],'name':_0x1352c['name'],'pause':![]})['then'](function(){return db[_0x0a9e('0xbe')][_0x0a9e('0x67')]({'paused':0x0},{'where':{'UserId':_0x1352c['id']}});})[_0x0a9e('0x32')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x1352c[_0x0a9e('0x3e')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x522b46){var _0x3d5d58=[];_0x522b46[_0x0a9e('0xef')](function(_0x1785c9){_0x3d5d58['push'](_0x1785c9[_0x0a9e('0x67')]({'exitAt':moment()[_0x0a9e('0xbb')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x0a9e('0x103')}));});return BPromise['all'](_0x3d5d58);})[_0x0a9e('0x32')](function(){return _0x1352c[_0x0a9e('0x67')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x31114d,null))[_0x0a9e('0x28')](handleError(_0x31114d,null));};exports[_0x0a9e('0x109')]=function(_0x18e3b3,_0x4afa93,_0x10f9fe){var _0x4756e3={};var _0x3b22f4={};var _0x4baeb5;var _0xebb578;return db[_0x0a9e('0x46')][_0x0a9e('0xa6')]({'where':{'id':_0x18e3b3['params']['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x4afa93,null))[_0x0a9e('0x32')](function(_0x15bd22){if(_0x15bd22){_0x4baeb5=_0x15bd22;_0x3b22f4[_0x0a9e('0x4a')]=_[_0x0a9e('0x4f')](db[_0x0a9e('0x10a')][_0x0a9e('0xd6')]);_0x3b22f4[_0x0a9e('0x4e')]=_['keys'](_0x18e3b3[_0x0a9e('0x4e')]);_0x3b22f4[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x3b22f4[_0x0a9e('0x4a')],_0x3b22f4['query']);_0x4756e3[_0x0a9e('0x52')]=_[_0x0a9e('0x51')](_0x3b22f4['model'],qs[_0x0a9e('0x53')](_0x18e3b3[_0x0a9e('0x4e')][_0x0a9e('0x53')]));_0x4756e3[_0x0a9e('0x52')]=_0x4756e3[_0x0a9e('0x52')][_0x0a9e('0x54')]?_0x4756e3[_0x0a9e('0x52')]:_0x3b22f4[_0x0a9e('0x4a')];_0x4756e3['order']=qs[_0x0a9e('0x57')](_0x18e3b3['query'][_0x0a9e('0x57')]);_0x4756e3[_0x0a9e('0x58')]=qs['filters'](_[_0x0a9e('0x59')](_0x18e3b3[_0x0a9e('0x4e')],_0x3b22f4['filters']));if(_0x18e3b3[_0x0a9e('0x4e')][_0x0a9e('0x3a')]){_0x4756e3['where']=_[_0x0a9e('0x5a')](_0x4756e3['where'],{'$or':_['map'](_0x4756e3['attributes'],function(_0x9914d5){var _0x16f638={};_0x16f638[_0x9914d5]={'$like':'%'+_0x18e3b3['query'][_0x0a9e('0x3a')]+'%'};return _0x16f638;})});}_0x4756e3=_[_0x0a9e('0x5a')]({},_0x4756e3,_0x18e3b3['options']);return _0x4baeb5[_0x0a9e('0x109')](_0x4756e3);}})[_0x0a9e('0x32')](function(_0x4bdcd3){if(_0x4bdcd3){_0xebb578=_0x4bdcd3[_0x0a9e('0x54')];if(!_0x18e3b3[_0x0a9e('0x4e')][_0x0a9e('0xce')]('nolimit')){_0x4756e3[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x18e3b3[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x4756e3[_0x0a9e('0x2c')]=qs['offset'](_0x18e3b3[_0x0a9e('0x4e')]['offset']);}return _0x4baeb5[_0x0a9e('0x109')](_0x4756e3);}})[_0x0a9e('0x32')](function(_0x346236){if(_0x346236){return _0x346236?{'count':_0xebb578,'rows':_0x346236}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x4afa93,null))[_0x0a9e('0x28')](handleError(_0x4afa93,null));};exports[_0x0a9e('0x10b')]=function(_0x366766,_0xff9d23){return db[_0x0a9e('0x46')]['find']({'where':{'id':_0x366766[_0x0a9e('0x64')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0xff9d23,null))[_0x0a9e('0x32')](function(_0x5437cc){if(_0x5437cc){var _0x48782d=_0x5437cc['get']({'plain':!![]});return _0x5437cc['addTeams'](_0x366766['body'][_0x0a9e('0x6b')],_['omit'](_0x366766[_0x0a9e('0x68')],[_0x0a9e('0x6b'),'id'])||{})[_0x0a9e('0x32')](function(){for(var _0x38cd5d=0x0;_0x38cd5d<_0x366766[_0x0a9e('0x68')][_0x0a9e('0x6b')]['length'];_0x38cd5d++){var _0x20a1c0=[];db['Team']['findOne']({'where':{'id':_0x366766[_0x0a9e('0x68')]['ids'][_0x38cd5d]}})[_0x0a9e('0x32')](function(_0x5ba16e){_0x20a1c0[_0x0a9e('0x98')](_0x5ba16e[_0x0a9e('0xed')]()[_0x0a9e('0x32')](function(_0x4427e9){for(var _0x17f6a4=0x0;_0x17f6a4<_0x4427e9['length'];_0x17f6a4++){_0x4427e9[_0x17f6a4][_0x0a9e('0x10c')](_0x0a9e('0xab'),'Voice');}return _0x4427e9;}));_0x20a1c0[_0x0a9e('0x98')](_0x5ba16e[_0x0a9e('0x10d')]()['then'](function(_0x7c9f7e){for(var _0x26320a=0x0;_0x26320a<_0x7c9f7e[_0x0a9e('0x54')];_0x26320a++){_0x7c9f7e[_0x26320a][_0x0a9e('0x10c')](_0x0a9e('0xab'),_0x0a9e('0x10e'));}return _0x7c9f7e;}));_0x20a1c0[_0x0a9e('0x98')](_0x5ba16e['getMailQueues']()[_0x0a9e('0x32')](function(_0x3254d0){for(var _0x2f8c74=0x0;_0x2f8c74<_0x3254d0[_0x0a9e('0x54')];_0x2f8c74++){_0x3254d0[_0x2f8c74]['setDataValue'](_0x0a9e('0xab'),_0x0a9e('0x10f'));}return _0x3254d0;}));_0x20a1c0[_0x0a9e('0x98')](_0x5ba16e[_0x0a9e('0x110')]()[_0x0a9e('0x32')](function(_0x29776f){for(var _0x43106c=0x0;_0x43106c<_0x29776f[_0x0a9e('0x54')];_0x43106c++){_0x29776f[_0x43106c]['setDataValue'](_0x0a9e('0xab'),_0x0a9e('0x111'));}return _0x29776f;}));_0x20a1c0[_0x0a9e('0x98')](_0x5ba16e['getWhatsappQueues']()[_0x0a9e('0x32')](function(_0x101e33){for(var _0x2cf15c=0x0;_0x2cf15c<_0x101e33[_0x0a9e('0x54')];_0x2cf15c++){_0x101e33[_0x2cf15c][_0x0a9e('0x10c')](_0x0a9e('0xab'),_0x0a9e('0x112'));}return _0x101e33;}));_0x20a1c0[_0x0a9e('0x98')](_0x5ba16e[_0x0a9e('0x113')]()[_0x0a9e('0x32')](function(_0x4c8e78){for(var _0x1cee49=0x0;_0x1cee49<_0x4c8e78[_0x0a9e('0x54')];_0x1cee49++){_0x4c8e78[_0x1cee49][_0x0a9e('0x10c')]('channel','Fax');}return _0x4c8e78;}));_0x20a1c0[_0x0a9e('0x98')](_0x5ba16e[_0x0a9e('0x114')]()[_0x0a9e('0x32')](function(_0x73014f){for(var _0x2cbfa3=0x0;_0x2cbfa3<_0x73014f[_0x0a9e('0x54')];_0x2cbfa3++){_0x73014f[_0x2cbfa3][_0x0a9e('0x10c')](_0x0a9e('0xab'),_0x0a9e('0x115'));}return _0x73014f;}));return BPromise['all'](_0x20a1c0);})[_0x0a9e('0x32')](function(_0x41ae51){var _0x4d8e8b=_[_0x0a9e('0x116')](_0x41ae51);_0x20a1c0=[];return db[_0x0a9e('0x5c')]['transaction'](function(_0x5bfbb6){for(var _0x1b644d=0x0;_0x1b644d<_0x4d8e8b[_0x0a9e('0x54')];_0x1b644d++){_0x20a1c0[_0x0a9e('0x98')](_0x4d8e8b[_0x1b644d][_0x0a9e('0x117')](_0x48782d['id']),{'transaction':_0x5bfbb6});}return BPromise[_0x0a9e('0x99')](_0x20a1c0)['then'](function(){if(_0x48782d[_0x0a9e('0xac')]){return BPromise['each'](_['filter'](_0x4d8e8b,function(_0x49f3de){return _0x49f3de[_0x0a9e('0x118')]('channel')==='Voice';}),function(_0x4a87e4){return db[_0x0a9e('0xbe')][_0x0a9e('0xbf')]({'membername':_0x48782d[_0x0a9e('0x3e')],'UserId':_0x48782d['id'],'queue_name':_0x4a87e4[_0x0a9e('0x3e')],'VoiceQueueId':_0x4a87e4['id'],'interface':_['isNil'](_0x48782d[_0x0a9e('0xae')])?util['format']('SIP/%s',_0x48782d[_0x0a9e('0x3e')]):_0x48782d[_0x0a9e('0xae')],'paused':_0x48782d[_0x0a9e('0xbd')]||![],'penalty':_0x48782d['penalty']},{'transaction':_0x5bfbb6});});}else{return;}})['then'](function(){for(var _0x5873f8=0x0;_0x5873f8<_0x4d8e8b[_0x0a9e('0x54')];_0x5873f8++){var _0x14f5c6=_0x4d8e8b[_0x5873f8][_0x0a9e('0x118')](_0x0a9e('0xab'));var _0x14f999=_0x14f5c6+'QueueId';socket[_0x0a9e('0xb7')](_0x0a9e('0x37')+_0x14f5c6+_0x0a9e('0xb8'),{'UserId':_0x48782d['id'],['queueField']:_0x4d8e8b[_0x5873f8]['id']});}});});});}});}})[_0x0a9e('0x32')](respondWithStatusCode(_0xff9d23,null))[_0x0a9e('0x28')](handleError(_0xff9d23,null));};exports[_0x0a9e('0x119')]=function(_0x534995,_0x292208){return db[_0x0a9e('0x46')][_0x0a9e('0xa6')]({'where':{'id':_0x534995[_0x0a9e('0x64')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x292208,null))[_0x0a9e('0x32')](function(_0x42919a){if(_0x42919a){var _0x3d9139=_0x42919a[_0x0a9e('0x33')]({'plain':!![]});var _0x20e4f3=_0x534995[_0x0a9e('0x4e')][_0x0a9e('0x6b')];return _0x42919a[_0x0a9e('0x119')](_0x20e4f3)[_0x0a9e('0x32')](function(){for(var _0x31d2d4=0x0;_0x31d2d4<_0x20e4f3[_0x0a9e('0x54')];_0x31d2d4++){var _0x5ef27b=[];db[_0x0a9e('0x10a')]['findOne']({'where':{'id':_0x20e4f3[_0x31d2d4]}})[_0x0a9e('0x32')](function(_0x1b533c){_0x5ef27b['push'](_0x1b533c['getVoiceQueues']()['then'](function(_0x3d4068){for(var _0x3b24b8=0x0;_0x3b24b8<_0x3d4068['length'];_0x3b24b8++){_0x3d4068[_0x3b24b8][_0x0a9e('0x10c')](_0x0a9e('0xab'),'Voice');}return _0x3d4068;}));_0x5ef27b[_0x0a9e('0x98')](_0x1b533c['getChatQueues']()[_0x0a9e('0x32')](function(_0x48f70a){for(var _0x202722=0x0;_0x202722<_0x48f70a[_0x0a9e('0x54')];_0x202722++){_0x48f70a[_0x202722][_0x0a9e('0x10c')](_0x0a9e('0xab'),'Chat');}return _0x48f70a;}));_0x5ef27b[_0x0a9e('0x98')](_0x1b533c[_0x0a9e('0x11a')]()[_0x0a9e('0x32')](function(_0x4bc0ba){for(var _0x5e72f1=0x0;_0x5e72f1<_0x4bc0ba['length'];_0x5e72f1++){_0x4bc0ba[_0x5e72f1]['setDataValue'](_0x0a9e('0xab'),_0x0a9e('0x10f'));}return _0x4bc0ba;}));_0x5ef27b[_0x0a9e('0x98')](_0x1b533c[_0x0a9e('0x110')]()[_0x0a9e('0x32')](function(_0x55b3a4){for(var _0xe3728c=0x0;_0xe3728c<_0x55b3a4[_0x0a9e('0x54')];_0xe3728c++){_0x55b3a4[_0xe3728c][_0x0a9e('0x10c')](_0x0a9e('0xab'),'Sms');}return _0x55b3a4;}));_0x5ef27b[_0x0a9e('0x98')](_0x1b533c[_0x0a9e('0x11b')]()[_0x0a9e('0x32')](function(_0x197089){for(var _0xba6bfb=0x0;_0xba6bfb<_0x197089['length'];_0xba6bfb++){_0x197089[_0xba6bfb][_0x0a9e('0x10c')](_0x0a9e('0xab'),_0x0a9e('0x112'));}return _0x197089;}));_0x5ef27b['push'](_0x1b533c[_0x0a9e('0x113')]()['then'](function(_0xca03cd){for(var _0x7aa530=0x0;_0x7aa530<_0xca03cd[_0x0a9e('0x54')];_0x7aa530++){_0xca03cd[_0x7aa530][_0x0a9e('0x10c')](_0x0a9e('0xab'),'Fax');}return _0xca03cd;}));_0x5ef27b[_0x0a9e('0x98')](_0x1b533c[_0x0a9e('0x114')]()[_0x0a9e('0x32')](function(_0x44b401){for(var _0xccdd65=0x0;_0xccdd65<_0x44b401['length'];_0xccdd65++){_0x44b401[_0xccdd65][_0x0a9e('0x10c')](_0x0a9e('0xab'),_0x0a9e('0x115'));}return _0x44b401;}));return BPromise['all'](_0x5ef27b);})[_0x0a9e('0x32')](function(_0x488216){var _0x479441=_[_0x0a9e('0x116')](_0x488216);_0x5ef27b=[];return db['sequelize'][_0x0a9e('0x11c')](function(_0x32edb5){for(var _0x43de1a=0x0;_0x43de1a<_0x479441['length'];_0x43de1a++){_0x5ef27b[_0x0a9e('0x98')](_0x479441[_0x43de1a][_0x0a9e('0x11d')](_0x3d9139['id']),{'transaction':_0x32edb5});}return BPromise[_0x0a9e('0x99')](_0x5ef27b)[_0x0a9e('0x32')](function(){if(_0x3d9139[_0x0a9e('0xac')]){return BPromise[_0x0a9e('0x9a')](_[_0x0a9e('0x3a')](_0x479441,function(_0x1c3f66){return _0x1c3f66['getDataValue'](_0x0a9e('0xab'))===_0x0a9e('0x11e');}),function(_0x3ea9f1){return db[_0x0a9e('0xbe')][_0x0a9e('0x40')]({'where':{'VoiceQueueId':_0x3ea9f1['id'],'UserId':_0x3d9139['id']},'transaction':_0x32edb5});});}else{return;}})['then'](function(){for(var _0x592f39=0x0;_0x592f39<_0x479441[_0x0a9e('0x54')];_0x592f39++){var _0x5460fc=_0x479441[_0x592f39][_0x0a9e('0x118')](_0x0a9e('0xab'));var _0x58b3f3=_0x5460fc+_0x0a9e('0xb6');socket[_0x0a9e('0xb7')](_0x0a9e('0x37')+_0x5460fc+'Queue:remove',{'UserId':_0x3d9139['id'],['queueField']:_0x479441[_0x592f39]['id']});}});});});}});}})[_0x0a9e('0x32')](respondWithStatusCode(_0x292208,null))[_0x0a9e('0x28')](handleError(_0x292208,null));};exports[_0x0a9e('0x11f')]=function(_0x14cf4c,_0x1b2cf5,_0x1d7537){var _0x9ecf57={};var _0x305a4b={};var _0x5695b6;var _0x152879;return db[_0x0a9e('0x46')][_0x0a9e('0xa6')]({'where':{'id':_0x14cf4c[_0x0a9e('0x64')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x1b2cf5,null))['then'](function(_0x34c5c3){if(_0x34c5c3){_0x5695b6=_0x34c5c3;_0x305a4b['model']=_[_0x0a9e('0x4f')](db[_0x0a9e('0x120')][_0x0a9e('0xd6')]);_0x305a4b['query']=_[_0x0a9e('0x4f')](_0x14cf4c['query']);_0x305a4b[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x305a4b[_0x0a9e('0x4a')],_0x305a4b[_0x0a9e('0x4e')]);_0x9ecf57['attributes']=_[_0x0a9e('0x51')](_0x305a4b['model'],qs[_0x0a9e('0x53')](_0x14cf4c[_0x0a9e('0x4e')]['fields']));_0x9ecf57[_0x0a9e('0x52')]=_0x9ecf57[_0x0a9e('0x52')][_0x0a9e('0x54')]?_0x9ecf57['attributes']:_0x305a4b[_0x0a9e('0x4a')];_0x9ecf57['order']=qs[_0x0a9e('0x57')](_0x14cf4c[_0x0a9e('0x4e')]['sort']);_0x9ecf57['where']=qs['filters'](_['pick'](_0x14cf4c[_0x0a9e('0x4e')],_0x305a4b[_0x0a9e('0x50')]));if(_0x14cf4c[_0x0a9e('0x4e')][_0x0a9e('0x3a')]){_0x9ecf57['where']=_[_0x0a9e('0x5a')](_0x9ecf57['where'],{'$or':_[_0x0a9e('0x45')](_0x9ecf57[_0x0a9e('0x52')],function(_0x5064c9){var _0x39f387={};_0x39f387[_0x5064c9]={'$like':'%'+_0x14cf4c[_0x0a9e('0x4e')][_0x0a9e('0x3a')]+'%'};return _0x39f387;})});}_0x9ecf57=_[_0x0a9e('0x5a')]({},_0x9ecf57,_0x14cf4c[_0x0a9e('0x5e')]);return _0x5695b6[_0x0a9e('0x11f')](_0x9ecf57);}})[_0x0a9e('0x32')](function(_0x55a638){if(_0x55a638){_0x152879=_0x55a638[_0x0a9e('0x54')];if(!_0x14cf4c[_0x0a9e('0x4e')][_0x0a9e('0xce')](_0x0a9e('0x55'))){_0x9ecf57[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x14cf4c[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x9ecf57[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x14cf4c[_0x0a9e('0x4e')]['offset']);}return _0x5695b6[_0x0a9e('0x11f')](_0x9ecf57);}})[_0x0a9e('0x32')](function(_0x36da83){if(_0x36da83){return _0x36da83?{'count':_0x152879,'rows':_0x36da83}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x1b2cf5,null))[_0x0a9e('0x28')](handleError(_0x1b2cf5,null));};exports[_0x0a9e('0x121')]=function(_0x447ce4,_0x5b393b,_0x2c2a3e){var _0x3fa11d={};var _0x1d504a={};var _0x5bf423;var _0x3ca501;return db[_0x0a9e('0x46')][_0x0a9e('0xa6')]({'where':{'id':_0x447ce4['params']['id']}})['then'](handleEntityNotFound(_0x5b393b,null))[_0x0a9e('0x32')](function(_0x17a2d7){if(_0x17a2d7){_0x5bf423=_0x17a2d7;_0x1d504a[_0x0a9e('0x4a')]=_[_0x0a9e('0x4f')](db[_0x0a9e('0x46')]['rawAttributes']);_0x1d504a[_0x0a9e('0x4e')]=_['keys'](_0x447ce4[_0x0a9e('0x4e')]);_0x1d504a[_0x0a9e('0x50')]=_['intersection'](_0x1d504a[_0x0a9e('0x4a')],_0x1d504a['query']);_0x3fa11d[_0x0a9e('0x52')]=_[_0x0a9e('0x51')](_0x1d504a['model'],qs[_0x0a9e('0x53')](_0x447ce4[_0x0a9e('0x4e')][_0x0a9e('0x53')]));_0x3fa11d['attributes']=_0x3fa11d[_0x0a9e('0x52')][_0x0a9e('0x54')]?_0x3fa11d[_0x0a9e('0x52')]:_0x1d504a[_0x0a9e('0x4a')];_0x3fa11d[_0x0a9e('0x56')]=qs[_0x0a9e('0x57')](_0x447ce4['query'][_0x0a9e('0x57')]);_0x3fa11d[_0x0a9e('0x58')]=qs[_0x0a9e('0x50')](_[_0x0a9e('0x59')](_0x447ce4['query'],_0x1d504a['filters']));if(_0x447ce4[_0x0a9e('0x4e')][_0x0a9e('0x3a')]){_0x3fa11d[_0x0a9e('0x58')]=_['merge'](_0x3fa11d['where'],{'$or':_[_0x0a9e('0x45')](_0x3fa11d['attributes'],function(_0x5d8137){var _0x2e557b={};_0x2e557b[_0x5d8137]={'$like':'%'+_0x447ce4[_0x0a9e('0x4e')]['filter']+'%'};return _0x2e557b;})});}_0x3fa11d[_0x0a9e('0x4a')]=db[_0x0a9e('0x46')];_0x3fa11d['as']=_0x0a9e('0x9b');_0x3fa11d=_[_0x0a9e('0x5a')]({},_0x3fa11d,_0x447ce4[_0x0a9e('0x5e')]);return _0x5bf423['getVoiceQueues']({'include':[_0x3fa11d]});}})[_0x0a9e('0x32')](function(_0x1db07){if(_0x1db07){var _0x499e86={},_0x12c434=[],_0x27668b=0x0;for(var _0x1b6408=0x0;_0x1b6408<_0x1db07[_0x0a9e('0x54')];_0x1b6408+=0x1){for(var _0x2a9c02=0x0,_0x4b546f;_0x2a9c02<_0x1db07[_0x1b6408][_0x0a9e('0x9b')][_0x0a9e('0x54')];_0x2a9c02+=0x1){_0x4b546f=_0x1db07[_0x1b6408]['Agents'][_0x2a9c02]['get']({'plain':!![]});_0x499e86[_0x4b546f['id']]=_0x4b546f;}}_0x499e86=_[_0x0a9e('0x122')](_0x499e86);for(var _0x3df59c=qs['offset'](_0x447ce4['query'][_0x0a9e('0x2c')]);_0x3df59c<_0x499e86[_0x0a9e('0x54')]&&_0x12c434[_0x0a9e('0x54')]=_0x4edc5b[_0x779d('0x50')]){throw new Error(_0x779d('0x51'));}})['then'](function(){if(_0x2df1aa){return db[_0x779d('0x2a')]['destroy']({'where':{'membername':_0x2df1aa[_0x779d('0x26')]},'individualHooks':!![]});}})[_0x779d('0xc')](function(){if(_0x2df1aa){return _0x2df1aa[_0x779d('0x52')]({'raw':!![]});}})[_0x779d('0xc')](function(_0x42f671){if(_0x2df1aa){if(_0x42f671){var _0xa91bea=[];_0x1218ad=_0x42f671;if(_0x1218ad[_0x779d('0x2c')]){for(var _0x58cdfc=0x0;_0x58cdfc<_0x1218ad[_0x779d('0x2c')];_0x58cdfc++){_0xa91bea[_0x779d('0x31')](db[_0x779d('0x2a')][_0x779d('0x53')]({'membername':_0x2df1aa[_0x779d('0x26')],'UserId':_0x2df1aa['id'],'queue_name':_0x1218ad[_0x58cdfc]['name'],'VoiceQueueId':_0x1218ad[_0x58cdfc]['id'],'interface':_0x5a9b30,'paused':_0x2df1aa[_0x779d('0x4c')]||![],'penalty':_0x1218ad[_0x58cdfc]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x779d('0x48')](_0xa91bea);}}}})[_0x779d('0xc')](function(){if(_0x2df1aa){return db[_0x779d('0x37')][_0x779d('0x18')]({'where':{'membername':_0x2df1aa[_0x779d('0x26')],'exitAt':null}});}})['then'](function(_0x47dc1b){if(_0x2df1aa){if(_0x47dc1b&&_0x47dc1b[_0x779d('0x2c')]){var _0x57c235=[];_0x47dc1b[_0x779d('0x30')](function(_0x4cf2fb){_0x57c235[_0x779d('0x31')](_0x4cf2fb['update']({'exitAt':moment()[_0x779d('0x33')](_0x779d('0x2d'))}));});return BPromise[_0x779d('0x48')](_0x57c235);}}})[_0x779d('0xc')](function(_0x369b5f){if(_0x2df1aa){var _0x45146d=[];var _0x5f02ed=[];var _0x3591e2=utils[_0x779d('0x2f')]();var _0x2e9fc9={'membername':_0x2df1aa['name'],'interface':_0x5a9b30,'enterAt':moment()[_0x779d('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2df1aa[_0x779d('0x27')],'internal':_0x2df1aa[_0x779d('0x28')]};_0x3591e2[_0x779d('0x30')](function(_0x575d6c){_0x45146d[_0x779d('0x31')](_[_0x779d('0x54')]({'channel':_0x575d6c,'type':'LOGIN','data1':_0x779d('0x55'),'data2':_0x5a9b30},_0x2e9fc9));if(_0x2df1aa['loginInPause']){_0x5f02ed['push'](_['merge']({'channel':_0x575d6c,'type':_0x779d('0x2b'),'data1':_0x779d('0x56')},_0x2e9fc9));}});return db[_0x779d('0x37')]['bulkCreate'](_0x45146d[_0x779d('0x57')](_0x5f02ed),{'individualHooks':!![]});}})[_0x779d('0xc')](function(){if(_0x2df1aa){return _0x2df1aa[_0x779d('0x39')]({'online':!![],'lastLoginAt':moment()[_0x779d('0x33')](_0x779d('0x2d')),'voicePause':_0x2df1aa['loginInPause']||![],'mailPause':_0x2df1aa['loginInPause']||![],'chatPause':_0x2df1aa['loginInPause']||![],'faxPause':_0x2df1aa[_0x779d('0x4c')]||![],'smsPause':_0x2df1aa['loginInPause']||![],'openchannelPause':_0x2df1aa[_0x779d('0x4c')]||![],'pauseType':_0x2df1aa['loginInPause']?_0x779d('0x56'):null,'lastPauseAt':moment()[_0x779d('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x5a9b30});}})[_0x779d('0xc')](function(_0x4868cd){_0x3741a4(_0x4868cd);})[_0x779d('0x16')](function(_0x4c5df0){_0x214dfe(_0x22bc5f[_0x779d('0x12')](0x1f4,_0x4c5df0[_0x779d('0x14')]));});});}; \ No newline at end of file +var _0x6cb4=['error','code','User,\x20%s,\x20%s','message','result','catch','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','ShowUser','info','stringify','find','role','interface','update','name','PAUSE','format','updateAttributes','push','isNil','YYYY-MM-DD\x20HH:mm:ss','body','type','DEFAULT\x20PAUSE','internal','bulkCreate','UnpauseUser','findOne','channel','isValidChannel','voice','UserVoiceQueueRt','system','mail','chat','fax','sms','whatsapp','Pause','forEach','all','LogoutUser','destroy','MemberReport','length','LoginUser','phone','loginInPause','SIP/%s','count','agent','../../config/license/util','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s'];(function(_0x2e855a,_0x991cc4){var _0x5853a7=function(_0x561065){while(--_0x561065){_0x2e855a['push'](_0x2e855a['shift']());}};_0x5853a7(++_0x991cc4);}(_0x6cb4,0xff));var _0x46cb=function(_0x4d6679,_0xbd28c6){_0x4d6679=_0x4d6679-0x0;var _0x5199a5=_0x6cb4[_0x4d6679];return _0x5199a5;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});config[_0x46cb('0xb')]=_[_0x46cb('0xc')](config[_0x46cb('0xb')],{'host':_0x46cb('0xd'),'port':0x18eb});var socket=require(_0x46cb('0xe'))(new Redis(config[_0x46cb('0xb')]));require('./user.socket')[_0x46cb('0xf')](socket);function respondWithRpcPromise(_0x34f9e9,_0x48101c,_0x206f10){return new BPromise(function(_0x106a87,_0x4a60b2){return client[_0x46cb('0x10')](_0x34f9e9,_0x206f10)[_0x46cb('0x11')](function(_0x570cfd){logger['info']('User,\x20%s,\x20%s',_0x48101c,_0x46cb('0x12'));logger[_0x46cb('0x13')](_0x46cb('0x14'),_0x48101c,_0x46cb('0x12'),JSON['stringify'](_0x570cfd));if(_0x570cfd[_0x46cb('0x15')]){if(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x16')]===0x1f4){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);return _0x4a60b2(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);}logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd['error'][_0x46cb('0x18')]);return _0x106a87(_0x570cfd['error'][_0x46cb('0x18')]);}else{logger['info']('User,\x20%s,\x20%s',_0x48101c,'request\x20sent');_0x106a87(_0x570cfd[_0x46cb('0x19')][_0x46cb('0x18')]);}})[_0x46cb('0x1a')](function(_0xcc8e2){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0xcc8e2);_0x4a60b2(_0xcc8e2);});});}exports[_0x46cb('0x1b')]=function(_0x32e9fe){var _0x90cd50=this;return new Promise(function(_0xfc9064,_0x149483){return db[_0x46cb('0x1c')][_0x46cb('0x1d')]({'raw':_0x32e9fe[_0x46cb('0x1e')]?_0x32e9fe[_0x46cb('0x1e')][_0x46cb('0x1f')]===undefined?!![]:![]:!![],'where':_0x32e9fe[_0x46cb('0x1e')]?_0x32e9fe[_0x46cb('0x1e')][_0x46cb('0x20')]||null:null,'attributes':_0x32e9fe[_0x46cb('0x1e')]?_0x32e9fe[_0x46cb('0x1e')][_0x46cb('0x21')]||null:null,'limit':_0x32e9fe[_0x46cb('0x1e')]?_0x32e9fe[_0x46cb('0x1e')][_0x46cb('0x22')]||null:null,'include':_0x32e9fe['options']?_0x32e9fe['options'][_0x46cb('0x23')]?_[_0x46cb('0x24')](_0x32e9fe[_0x46cb('0x1e')][_0x46cb('0x23')],function(_0x6e6d9){return{'model':db[_0x6e6d9['model']],'as':_0x6e6d9['as'],'attributes':_0x6e6d9[_0x46cb('0x21')],'include':_0x6e6d9['include']?_['map'](_0x6e6d9['include'],function(_0x180ce1){return{'model':db[_0x180ce1[_0x46cb('0x25')]],'as':_0x180ce1['as'],'attributes':_0x180ce1[_0x46cb('0x21')],'include':_0x180ce1[_0x46cb('0x23')]?_[_0x46cb('0x24')](_0x180ce1[_0x46cb('0x23')],function(_0x378dc7){return{'model':db[_0x378dc7[_0x46cb('0x25')]],'as':_0x378dc7['as'],'attributes':_0x378dc7[_0x46cb('0x21')]};}):[]};}):[]};}):[]:[]})[_0x46cb('0x11')](function(_0x4620ef){logger['info'](_0x46cb('0x1b'),_0x32e9fe);logger[_0x46cb('0x13')]('GetUser',_0x32e9fe,JSON['stringify'](_0x4620ef));_0xfc9064(_0x4620ef);})[_0x46cb('0x1a')](function(_0x5cbb22){logger[_0x46cb('0x15')](_0x46cb('0x1b'),_0x5cbb22[_0x46cb('0x18')],_0x32e9fe);_0x149483(_0x90cd50[_0x46cb('0x15')](0x1f4,_0x5cbb22[_0x46cb('0x18')]));});});};exports[_0x46cb('0x26')]=function(_0x5dc551){var _0x2e2d36=this;return new Promise(function(_0x49ffc5,_0x2661d6){return db[_0x46cb('0x1c')]['find']({'raw':_0x5dc551[_0x46cb('0x1e')]?_0x5dc551[_0x46cb('0x1e')][_0x46cb('0x1f')]===undefined?!![]:![]:!![],'where':_0x5dc551[_0x46cb('0x1e')]?_0x5dc551[_0x46cb('0x1e')]['where']||null:null,'attributes':_0x5dc551[_0x46cb('0x1e')]?_0x5dc551['options'][_0x46cb('0x21')]||null:null,'include':_0x5dc551[_0x46cb('0x1e')]?_0x5dc551[_0x46cb('0x1e')]['include']?_[_0x46cb('0x24')](_0x5dc551[_0x46cb('0x1e')]['include'],function(_0x19421c){return{'model':db[_0x19421c[_0x46cb('0x25')]],'as':_0x19421c['as'],'attributes':_0x19421c[_0x46cb('0x21')],'include':_0x19421c[_0x46cb('0x23')]?_[_0x46cb('0x24')](_0x19421c[_0x46cb('0x23')],function(_0x244084){return{'model':db[_0x244084[_0x46cb('0x25')]],'as':_0x244084['as'],'attributes':_0x244084[_0x46cb('0x21')],'include':_0x244084[_0x46cb('0x23')]?_[_0x46cb('0x24')](_0x244084['include'],function(_0x5f1df0){return{'model':db[_0x5f1df0['model']],'as':_0x5f1df0['as'],'attributes':_0x5f1df0[_0x46cb('0x21')]};}):[]};}):[]};}):[]:[]})[_0x46cb('0x11')](function(_0x502c0b){logger[_0x46cb('0x27')](_0x46cb('0x26'),_0x5dc551);logger[_0x46cb('0x13')]('ShowUser',_0x5dc551,JSON[_0x46cb('0x28')](_0x502c0b));_0x49ffc5(_0x502c0b);})['catch'](function(_0x4e8c14){logger[_0x46cb('0x15')]('ShowUser',_0x4e8c14['message'],_0x5dc551);_0x2661d6(_0x2e2d36[_0x46cb('0x15')](0x1f4,_0x4e8c14['message']));});});};exports['PauseUser']=function(_0x67bd14){var _0x10017d=this;return new Promise(function(_0x4680bc,_0x22a61c){var _0x300aeb;return db[_0x46cb('0x1c')][_0x46cb('0x29')]({'where':_0x67bd14['options'][_0x46cb('0x20')]||{},'attributes':['id','name',_0x46cb('0x2a'),'internal',_0x46cb('0x2b')]})[_0x46cb('0x11')](function(_0x2445a2){if(_0x2445a2){_0x300aeb=_0x2445a2;return db['UserVoiceQueueRt'][_0x46cb('0x2c')]({'paused':0x1},{'where':{'UserId':_0x300aeb['id']},'individualHooks':!![]});}})[_0x46cb('0x11')](function(){if(_0x300aeb){return db['MemberReport'][_0x46cb('0x1d')]({'where':{'membername':_0x300aeb[_0x46cb('0x2d')],'type':_0x46cb('0x2e'),'exitAt':null}});}})[_0x46cb('0x11')](function(_0x34fbdd){if(_0x300aeb){if(_0x34fbdd&&_0x34fbdd['length']){var _0x582905=moment()[_0x46cb('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1a9959=0x0,_0x41f76c=_0x34fbdd['length'];_0x1a9959<_0x41f76c;_0x1a9959++){_0x34fbdd[_0x1a9959][_0x46cb('0x30')]({'exitAt':_0x582905});}}}})[_0x46cb('0x11')](function(){if(_0x300aeb){var _0x46ca86=[];var _0x5d94db=utils['getChannels']();_0x5d94db['forEach'](function(_0x57fedd){_0x46ca86[_0x46cb('0x31')]({'channel':_0x57fedd,'membername':_0x300aeb[_0x46cb('0x2d')],'interface':_[_0x46cb('0x32')](_0x300aeb[_0x46cb('0x2b')])?util[_0x46cb('0x2f')]('SIP/%s',_0x300aeb['name']):_0x300aeb[_0x46cb('0x2b')],'type':_0x46cb('0x2e'),'enterAt':moment()['format'](_0x46cb('0x33')),'data1':_0x67bd14[_0x46cb('0x34')][_0x46cb('0x35')]||_0x46cb('0x36'),'role':_0x300aeb[_0x46cb('0x2a')],'internal':_0x300aeb[_0x46cb('0x37')],'uniqueid':_0x67bd14[_0x46cb('0x34')]['uniqueid']||null});});return db['MemberReport'][_0x46cb('0x38')](_0x46ca86,{'individualHooks':!![]});}})['then'](function(){if(_0x300aeb){return _0x300aeb[_0x46cb('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x67bd14[_0x46cb('0x34')][_0x46cb('0x35')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x46cb('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x16c500){_0x4680bc(_0x16c500);})[_0x46cb('0x1a')](function(_0x2c96b7){_0x22a61c(_0x10017d[_0x46cb('0x15')](0x1f4,_0x2c96b7[_0x46cb('0x18')]));});});};exports[_0x46cb('0x39')]=function(_0xb75519){var _0x58887b=this;return new Promise(function(_0x546a98,_0x40aff3){var _0x12bb44;return db['User'][_0x46cb('0x3a')]({'where':_0xb75519[_0x46cb('0x1e')][_0x46cb('0x20')]||{},'attributes':['id',_0x46cb('0x2d')]})[_0x46cb('0x11')](function(_0x5e0a49){if(_0x5e0a49){_0x12bb44=_0x5e0a49;if(_0xb75519[_0x46cb('0x34')][_0x46cb('0x3b')]&&!utils[_0x46cb('0x3c')](_0xb75519['body'][_0x46cb('0x3b')])){throw new Error('Unknown\x20channel');}switch(_0xb75519['body'][_0x46cb('0x3b')]){case _0x46cb('0x3d'):return db[_0x46cb('0x3e')][_0x46cb('0x2c')]({'paused':0x0},{'where':{'UserId':_0x12bb44['id']}})[_0x46cb('0x11')](function(){return db['MemberReport'][_0x46cb('0x29')]({'where':{'channel':_0xb75519[_0x46cb('0x34')]['channel'],'membername':_0x12bb44['name'],'type':_0x46cb('0x2e'),'exitAt':null}});})[_0x46cb('0x11')](function(_0x108e57){if(_0x108e57){return _0x108e57['update']({'exitAt':moment()[_0x46cb('0x2f')](_0x46cb('0x33')),'data2':_0x46cb('0x3f')},{'individualHooks':!![]});}return null;})[_0x46cb('0x11')](function(){return _0x12bb44[_0x46cb('0x2c')]({'voicePause':![]});});case _0x46cb('0x40'):case _0x46cb('0x41'):case _0x46cb('0x42'):case _0x46cb('0x43'):case'openchannel':case _0x46cb('0x44'):return db['MemberReport'][_0x46cb('0x29')]({'where':{'channel':_0xb75519[_0x46cb('0x34')][_0x46cb('0x3b')],'membername':_0x12bb44[_0x46cb('0x2d')],'type':'PAUSE','exitAt':null}})[_0x46cb('0x11')](function(_0x13d25f){return _0x13d25f[_0x46cb('0x2c')]({'exitAt':moment()[_0x46cb('0x2f')](_0x46cb('0x33')),'data2':_0x46cb('0x3f')},{'individualHooks':!![]});})[_0x46cb('0x11')](function(){var _0x2e55f4={};_['set'](_0x2e55f4,util['format']('%s%s',_0xb75519['body'][_0x46cb('0x3b')],_0x46cb('0x45')),![]);return _0x12bb44['update'](_0x2e55f4);});default:return db[_0x46cb('0x3e')][_0x46cb('0x2c')]({'paused':0x0},{'where':{'UserId':_0x12bb44['id']}})[_0x46cb('0x11')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x12bb44[_0x46cb('0x2d')],'type':'PAUSE','exitAt':null}});})[_0x46cb('0x11')](function(_0xedba12){var _0x1eb392=[];_0xedba12[_0x46cb('0x46')](function(_0x47455d){_0x1eb392[_0x46cb('0x31')](_0x47455d[_0x46cb('0x2c')]({'exitAt':moment()[_0x46cb('0x2f')](_0x46cb('0x33')),'data2':_0x46cb('0x3f')}));});return BPromise[_0x46cb('0x47')](_0x1eb392);})[_0x46cb('0x11')](function(){return _0x12bb44[_0x46cb('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x3f12f9){_0x546a98(_0x3f12f9);})['catch'](function(_0x3be7b4){_0x40aff3(_0x58887b[_0x46cb('0x15')](0x1f4,_0x3be7b4[_0x46cb('0x18')]));});});};exports[_0x46cb('0x48')]=function(_0x4f02e9){var _0x3dc4bd=this;return new Promise(function(_0x656601,_0x598a41){var _0x265fe4;return db[_0x46cb('0x1c')][_0x46cb('0x3a')]({'where':_0x4f02e9[_0x46cb('0x1e')]['where']||{},'attributes':['id',_0x46cb('0x2d')]})[_0x46cb('0x11')](function(_0x6dc790){if(_0x6dc790){_0x265fe4=_0x6dc790;return db[_0x46cb('0x3e')][_0x46cb('0x49')]({'where':{'membername':_0x265fe4['name']},'individualHooks':!![]});}})[_0x46cb('0x11')](function(){if(_0x265fe4){return db[_0x46cb('0x4a')][_0x46cb('0x1d')]({'where':{'membername':_0x265fe4[_0x46cb('0x2d')],'exitAt':null}});}})[_0x46cb('0x11')](function(_0x1938e6){if(_0x265fe4){if(_0x1938e6&&_0x1938e6[_0x46cb('0x4b')]){var _0x275c44=[];_0x1938e6['forEach'](function(_0x5dc4c8){_0x275c44['push'](_0x5dc4c8[_0x46cb('0x2c')]({'exitAt':moment()[_0x46cb('0x2f')](_0x46cb('0x33'))}));});return BPromise[_0x46cb('0x47')](_0x275c44);}}})[_0x46cb('0x11')](function(){if(_0x265fe4){return _0x265fe4[_0x46cb('0x2c')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x46cb('0x11')](function(_0x257d92){_0x656601(_0x257d92);})[_0x46cb('0x1a')](function(_0x408f2a){_0x598a41(_0x3dc4bd[_0x46cb('0x15')](0x1f4,_0x408f2a[_0x46cb('0x18')]));});});};exports[_0x46cb('0x4c')]=function(_0x2ea5d0){var _0x5c9f3c=this;return new Promise(function(_0x2e23e4,_0x5ab62f){var _0x42e9de;var _0x4aea2c;var _0x424e49;var _0x3a2aec;return db[_0x46cb('0x1c')][_0x46cb('0x3a')]({'where':_0x2ea5d0['options'][_0x46cb('0x20')]||{},'attributes':['id',_0x46cb('0x2d'),'role','mobile',_0x46cb('0x4d'),_0x46cb('0x37'),_0x46cb('0x4e'),_0x46cb('0x2b')]})[_0x46cb('0x11')](function(_0x596804){if(_0x596804){_0x42e9de=_0x596804;_0x3a2aec=_0x2ea5d0['body']['interface']?_0x2ea5d0[_0x46cb('0x34')][_0x46cb('0x2b')]:util[_0x46cb('0x2f')](_0x46cb('0x4f'),_0x42e9de[_0x46cb('0x2d')]);return db[_0x46cb('0x1c')][_0x46cb('0x50')]({'where':{'role':_0x46cb('0x51'),'online':!![],'id':{'$ne':_0x42e9de['id']}}});}})[_0x46cb('0x11')](function(_0x456e48){if(_0x456e48){_0x424e49=_0x456e48;return require(_0x46cb('0x52'))['getLicense']();}})[_0x46cb('0x11')](function(_0xf71acb){if(_0xf71acb&&_0xf71acb[_0x46cb('0x53')]&&_0x424e49>=_0xf71acb[_0x46cb('0x53')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x46cb('0x11')](function(){if(_0x42e9de){return db[_0x46cb('0x3e')][_0x46cb('0x49')]({'where':{'membername':_0x42e9de[_0x46cb('0x2d')]},'individualHooks':!![]});}})['then'](function(){if(_0x42e9de){return _0x42e9de[_0x46cb('0x54')]({'raw':!![]});}})[_0x46cb('0x11')](function(_0x2aa5c1){if(_0x42e9de){if(_0x2aa5c1){var _0x11d96b=[];_0x4aea2c=_0x2aa5c1;if(_0x4aea2c['length']){for(var _0x5775dc=0x0;_0x5775dc<_0x4aea2c['length'];_0x5775dc++){_0x11d96b[_0x46cb('0x31')](db['UserVoiceQueueRt'][_0x46cb('0x55')]({'membername':_0x42e9de['name'],'UserId':_0x42e9de['id'],'queue_name':_0x4aea2c[_0x5775dc][_0x46cb('0x2d')],'VoiceQueueId':_0x4aea2c[_0x5775dc]['id'],'interface':_0x3a2aec,'paused':_0x42e9de[_0x46cb('0x4e')]||![],'penalty':_0x4aea2c[_0x5775dc][_0x46cb('0x56')]||0x0}));}return BPromise[_0x46cb('0x47')](_0x11d96b);}}}})['then'](function(){if(_0x42e9de){return db[_0x46cb('0x4a')][_0x46cb('0x1d')]({'where':{'membername':_0x42e9de[_0x46cb('0x2d')],'exitAt':null}});}})[_0x46cb('0x11')](function(_0x5747da){if(_0x42e9de){if(_0x5747da&&_0x5747da['length']){var _0x2ce53a=[];_0x5747da[_0x46cb('0x46')](function(_0x332a98){_0x2ce53a[_0x46cb('0x31')](_0x332a98[_0x46cb('0x2c')]({'exitAt':moment()[_0x46cb('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x2ce53a);}}})[_0x46cb('0x11')](function(_0x53eb){if(_0x42e9de){var _0x51cbf6=[];var _0x18e45c=[];var _0x355041=utils[_0x46cb('0x57')]();var _0x385ffe={'membername':_0x42e9de[_0x46cb('0x2d')],'interface':_0x3a2aec,'enterAt':moment()[_0x46cb('0x2f')](_0x46cb('0x33')),'role':_0x42e9de['role'],'internal':_0x42e9de[_0x46cb('0x37')]};_0x355041[_0x46cb('0x46')](function(_0x392d6d){_0x51cbf6[_0x46cb('0x31')](_[_0x46cb('0x58')]({'channel':_0x392d6d,'type':_0x46cb('0x59'),'data1':_0x46cb('0x5a'),'data2':_0x3a2aec},_0x385ffe));if(_0x42e9de[_0x46cb('0x4e')]){_0x18e45c['push'](_['merge']({'channel':_0x392d6d,'type':_0x46cb('0x2e'),'data1':_0x46cb('0x5b')},_0x385ffe));}});return db[_0x46cb('0x4a')][_0x46cb('0x38')](_0x51cbf6['concat'](_0x18e45c),{'individualHooks':!![]});}})[_0x46cb('0x11')](function(){if(_0x42e9de){return _0x42e9de['update']({'online':!![],'lastLoginAt':moment()['format'](_0x46cb('0x33')),'voicePause':_0x42e9de[_0x46cb('0x4e')]||![],'mailPause':_0x42e9de[_0x46cb('0x4e')]||![],'chatPause':_0x42e9de[_0x46cb('0x4e')]||![],'faxPause':_0x42e9de['loginInPause']||![],'smsPause':_0x42e9de[_0x46cb('0x4e')]||![],'openchannelPause':_0x42e9de['loginInPause']||![],'pauseType':_0x42e9de[_0x46cb('0x4e')]?_0x46cb('0x5b'):null,'lastPauseAt':moment()[_0x46cb('0x2f')](_0x46cb('0x33')),'interface':_0x3a2aec});}})[_0x46cb('0x11')](function(_0x472316){_0x2e23e4(_0x472316);})['catch'](function(_0x576146){_0x5ab62f(_0x5c9f3c[_0x46cb('0x15')](0x1f4,_0x576146['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 4f78c11..c3b8cb7 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 _0x77af=['./user.events','save','remove','update','emit','removeListener','register','user:'];(function(_0x3cb51c,_0x58b8e3){var _0x4e1fda=function(_0x2ccf50){while(--_0x2ccf50){_0x3cb51c['push'](_0x3cb51c['shift']());}};_0x4e1fda(++_0x58b8e3);}(_0x77af,0xd0));var _0xf77a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x77af[_0x167cc1];return _0x10bc4b;};'use strict';var UserEvents=require(_0xf77a('0x0'));var events=[_0xf77a('0x1'),_0xf77a('0x2'),_0xf77a('0x3')];function createListener(_0x58bf56,_0x37088f){return function(_0x4caa0f){_0x37088f[_0xf77a('0x4')](_0x58bf56,_0x4caa0f);};}function removeListener(_0x53fd4a,_0x42d6f9){return function(){UserEvents[_0xf77a('0x5')](_0x53fd4a,_0x42d6f9);};}exports[_0xf77a('0x6')]=function(_0x45a7e3){for(var _0x3ac0f1=0x0,_0x13b5d4=events['length'];_0x3ac0f1<_0x13b5d4;_0x3ac0f1++){var _0x4bdab9=events[_0x3ac0f1];var _0x29ffb1=createListener(_0xf77a('0x7')+_0x4bdab9,_0x45a7e3);UserEvents['on'](_0x4bdab9,_0x29ffb1);}}; \ No newline at end of file +var _0x043d=['update','emit','removeListener','register','user:','save'];(function(_0x5a5d72,_0x17ab58){var _0x3bce0d=function(_0x17f0f1){while(--_0x17f0f1){_0x5a5d72['push'](_0x5a5d72['shift']());}};_0x3bce0d(++_0x17ab58);}(_0x043d,0xdd));var _0xd043=function(_0x4b2251,_0x393f10){_0x4b2251=_0x4b2251-0x0;var _0x5d22fb=_0x043d[_0x4b2251];return _0x5d22fb;};'use strict';var UserEvents=require('./user.events');var events=[_0xd043('0x0'),'remove',_0xd043('0x1')];function createListener(_0x1763ef,_0x5e82cc){return function(_0x1ad327){_0x5e82cc[_0xd043('0x2')](_0x1763ef,_0x1ad327);};}function removeListener(_0x507b37,_0x11a024){return function(){UserEvents[_0xd043('0x3')](_0x507b37,_0x11a024);};}exports[_0xd043('0x4')]=function(_0x2f5538){for(var _0x1fa25d=0x0,_0x48b68f=events['length'];_0x1fa25d<_0x48b68f;_0x1fa25d++){var _0x4cd11d=events[_0x1fa25d];var _0x1f0cac=createListener(_0xd043('0x5')+_0x4cd11d,_0x2f5538);UserEvents['on'](_0x4cd11d,_0x1f0cac);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index cfe73f3..7c3999e 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 _0x36ee=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x18d1c3,_0x62846b){var _0x2c00cb=function(_0x1e3b23){while(--_0x1e3b23){_0x18d1c3['push'](_0x18d1c3['shift']());}};_0x2c00cb(++_0x62846b);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));module[_0xe36e('0x7')]=router; \ No newline at end of file +var _0x0102=['util','path','connect-timeout','express','exports'];(function(_0x26d26f,_0x302cce){var _0x5c8c0e=function(_0x519b9d){while(--_0x519b9d){_0x26d26f['push'](_0x26d26f['shift']());}};_0x5c8c0e(++_0x302cce);}(_0x0102,0x186));var _0x2010=function(_0xd5bad6,_0x5558c9){_0xd5bad6=_0xd5bad6-0x0;var _0x58bfb3=_0x0102[_0xd5bad6];return _0x58bfb3;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x2010('0x4')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 7f64101..4cbbc29 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 _0xbaf0=['exports','INTEGER'];(function(_0x31b350,_0x5be290){var _0x1870dc=function(_0xbae48d){while(--_0xbae48d){_0x31b350['push'](_0x31b350['shift']());}};_0x1870dc(++_0x5be290);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x5a2015,_0x5a944a){var _0x59d0f9=function(_0x6c6e8a){while(--_0x6c6e8a){_0x5a2015['push'](_0x5a2015['shift']());}};_0x59d0f9(++_0x5a944a);}(_0xe706,0xa3));var _0x6e70=function(_0x502f0e,_0x3463b3){_0x502f0e=_0x502f0e-0x0;var _0x2522e8=_0xe706[_0x502f0e];return _0x2522e8;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('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 e644465..6e4f07f 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 _0x9169=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x25b9f4,_0x150ea9){var _0x4f8504=function(_0xe62785){while(--_0xe62785){_0x25b9f4['push'](_0x25b9f4['shift']());}};_0x4f8504(++_0x150ea9);}(_0x9169,0xdd));var _0x9916=function(_0x577f15,_0x33bcb0){_0x577f15=_0x577f15-0x0;var _0x49d66d=_0x9169[_0x577f15];return _0x49d66d;};'use strict';var _=require(_0x9916('0x0'));var util=require(_0x9916('0x1'));var logger=require(_0x9916('0x2'))(_0x9916('0x3'));var moment=require(_0x9916('0x4'));var BPromise=require(_0x9916('0x5'));var rp=require(_0x9916('0x6'));var fs=require('fs');var path=require(_0x9916('0x7'));var rimraf=require(_0x9916('0x8'));var config=require(_0x9916('0x9'));var attributes=require(_0x9916('0xa'));module['exports']=function(_0x2f58cd,_0x44fb08){return _0x2f58cd[_0x9916('0xb')](_0x9916('0xc'),attributes,{'tableName':_0x9916('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe296=['api','moment','bluebird','request-promise','rimraf','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x7d11d,_0x505aeb){var _0x245de0=function(_0x1d3946){while(--_0x1d3946){_0x7d11d['push'](_0x7d11d['shift']());}};_0x245de0(++_0x505aeb);}(_0xe296,0x1d1));var _0x6e29=function(_0x576ca4,_0x1e1550){_0x576ca4=_0x576ca4-0x0;var _0x3a4556=_0xe296[_0x576ca4];return _0x3a4556;};'use strict';var _=require(_0x6e29('0x0'));var util=require(_0x6e29('0x1'));var logger=require(_0x6e29('0x2'))(_0x6e29('0x3'));var moment=require(_0x6e29('0x4'));var BPromise=require(_0x6e29('0x5'));var rp=require(_0x6e29('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e29('0x7'));var config=require('../../config/environment');var attributes=require(_0x6e29('0x8'));module['exports']=function(_0x5d63d1,_0x2f5249){return _0x5d63d1[_0x6e29('0x9')](_0x6e29('0xa'),attributes,{'tableName':_0x6e29('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 b23274d..cbcf82f 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 _0xe4ca=['debug','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x271650,_0x492d94){var _0x583344=function(_0xda8a39){while(--_0xda8a39){_0x271650['push'](_0x271650['shift']());}};_0x583344(++_0x492d94);}(_0xe4ca,0x1a8));var _0xae4c=function(_0x35939f,_0x1fdf17){_0x35939f=_0x35939f-0x0;var _0x30a32a=_0xe4ca[_0x35939f];return _0x30a32a;};'use strict';var _=require(_0xae4c('0x0'));var util=require('util');var moment=require(_0xae4c('0x1'));var BPromise=require(_0xae4c('0x2'));var rs=require(_0xae4c('0x3'));var fs=require('fs');var Redis=require(_0xae4c('0x4'));var db=require(_0xae4c('0x5'))['db'];var utils=require(_0xae4c('0x6'));var logger=require('../../config/logger')(_0xae4c('0x7'));var config=require('../../config/environment');var jayson=require(_0xae4c('0x8'));var client=jayson[_0xae4c('0x9')][_0xae4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ddc85,_0x540deb,_0x293d1b){return new BPromise(function(_0x2f1337,_0x16f687){return client[_0xae4c('0xb')](_0x2ddc85,_0x293d1b)[_0xae4c('0xc')](function(_0x436d4f){logger[_0xae4c('0xd')](_0xae4c('0xe'),_0x540deb,_0xae4c('0xf'));logger[_0xae4c('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x540deb,_0xae4c('0xf'),JSON[_0xae4c('0x11')](_0x436d4f));if(_0x436d4f[_0xae4c('0x12')]){if(_0x436d4f[_0xae4c('0x12')][_0xae4c('0x13')]===0x1f4){logger[_0xae4c('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x540deb,_0x436d4f['error']['message']);return _0x16f687(_0x436d4f['error']['message']);}logger['error'](_0xae4c('0xe'),_0x540deb,_0x436d4f['error'][_0xae4c('0x14')]);return _0x2f1337(_0x436d4f[_0xae4c('0x12')][_0xae4c('0x14')]);}else{logger[_0xae4c('0xd')](_0xae4c('0xe'),_0x540deb,'request\x20sent');_0x2f1337(_0x436d4f['result'][_0xae4c('0x14')]);}})[_0xae4c('0x15')](function(_0x19c7be){logger[_0xae4c('0x12')](_0xae4c('0xe'),_0x540deb,_0x19c7be);_0x16f687(_0x19c7be);});});} \ No newline at end of file +var _0x63e7=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x4a63fc,_0x167a02){var _0x30d4c3=function(_0x3eecb2){while(--_0x3eecb2){_0x4a63fc['push'](_0x4a63fc['shift']());}};_0x30d4c3(++_0x167a02);}(_0x63e7,0x15b));var _0x763e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x63e7[_0x432682];return _0x463d05;};'use strict';var _=require(_0x763e('0x0'));var util=require(_0x763e('0x1'));var moment=require(_0x763e('0x2'));var BPromise=require(_0x763e('0x3'));var rs=require(_0x763e('0x4'));var fs=require('fs');var Redis=require(_0x763e('0x5'));var db=require(_0x763e('0x6'))['db'];var utils=require(_0x763e('0x7'));var logger=require(_0x763e('0x8'))(_0x763e('0x9'));var config=require('../../config/environment');var jayson=require(_0x763e('0xa'));var client=jayson[_0x763e('0xb')][_0x763e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cebf8,_0x352a61,_0x107b1e){return new BPromise(function(_0x171599,_0x39d642){return client['request'](_0x2cebf8,_0x107b1e)[_0x763e('0xd')](function(_0x11eaa9){logger[_0x763e('0xe')](_0x763e('0xf'),_0x352a61,_0x763e('0x10'));logger[_0x763e('0x11')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x352a61,'request\x20sent',JSON[_0x763e('0x12')](_0x11eaa9));if(_0x11eaa9[_0x763e('0x13')]){if(_0x11eaa9[_0x763e('0x13')]['code']===0x1f4){logger[_0x763e('0x13')](_0x763e('0xf'),_0x352a61,_0x11eaa9[_0x763e('0x13')][_0x763e('0x14')]);return _0x39d642(_0x11eaa9[_0x763e('0x13')][_0x763e('0x14')]);}logger[_0x763e('0x13')](_0x763e('0xf'),_0x352a61,_0x11eaa9['error'][_0x763e('0x14')]);return _0x171599(_0x11eaa9[_0x763e('0x13')][_0x763e('0x14')]);}else{logger[_0x763e('0xe')](_0x763e('0xf'),_0x352a61,_0x763e('0x10'));_0x171599(_0x11eaa9[_0x763e('0x15')][_0x763e('0x14')]);}})[_0x763e('0x16')](function(_0x34477c){logger[_0x763e('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x352a61,_0x34477c);_0x39d642(_0x34477c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index aa01b73..d1fc273 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 _0x2b4f=['../../config/environment','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2bbb60,_0x3eda72){var _0x155bc1=function(_0x46be1f){while(--_0x46be1f){_0x2bbb60['push'](_0x2bbb60['shift']());}};_0x155bc1(++_0x3eda72);}(_0x2b4f,0x142));var _0xf2b4=function(_0x29dde9,_0x24a1f9){_0x29dde9=_0x29dde9-0x0;var _0x641de3=_0x2b4f[_0x29dde9];return _0x641de3;};'use strict';var multer=require('multer');var util=require(_0xf2b4('0x0'));var path=require('path');var timeout=require(_0xf2b4('0x1'));var express=require(_0xf2b4('0x2'));var router=express[_0xf2b4('0x3')]();var fs_extra=require(_0xf2b4('0x4'));var auth=require(_0xf2b4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf2b4('0x6'));module[_0xf2b4('0x7')]=router; \ No newline at end of file +var _0xa5fa=['fs-extra','../../components/auth/service','../../config/environment','exports','util','path','connect-timeout','express'];(function(_0x406ee1,_0x96ed0d){var _0x3ab7fc=function(_0x10619e){while(--_0x10619e){_0x406ee1['push'](_0x406ee1['shift']());}};_0x3ab7fc(++_0x96ed0d);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x35639c,_0xfba17c){_0x35639c=_0x35639c-0x0;var _0x1ca47a=_0xa5fa[_0x35639c];return _0x1ca47a;};'use strict';var multer=require('multer');var util=require(_0xaa5f('0x0'));var path=require(_0xaa5f('0x1'));var timeout=require(_0xaa5f('0x2'));var express=require(_0xaa5f('0x3'));var router=express['Router']();var fs_extra=require(_0xaa5f('0x4'));var auth=require(_0xaa5f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa5f('0x6'));module[_0xaa5f('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 6771ea5..060e5ce 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 _0xdd4f=['sequelize','STRING'];(function(_0x417d31,_0x25bf51){var _0x562c2a=function(_0x2ea6fc){while(--_0x2ea6fc){_0x417d31['push'](_0x417d31['shift']());}};_0x562c2a(++_0x25bf51);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x1bb532,_0x8fc8ab){_0x1bb532=_0x1bb532-0x0;var _0x285d13=_0xdd4f[_0x1bb532];return _0x285d13;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfdd4('0x1')]}}; \ No newline at end of file +var _0x9ffd=['INTEGER','STRING','sequelize','exports'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x45abd5,_0x253742){_0x45abd5=_0x45abd5-0x0;var _0x4900e4=_0x9ffd[_0x45abd5];return _0x4900e4;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'penalty':{'type':Sequelize[_0xd9ff('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd9ff('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 5e91824..f481624 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 _0x172c=['util','api','moment','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues'];(function(_0x4b5a90,_0x1af1ad){var _0x154029=function(_0x441715){while(--_0x441715){_0x4b5a90['push'](_0x4b5a90['shift']());}};_0x154029(++_0x1af1ad);}(_0x172c,0x1ad));var _0xc172=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x172c[_0x8b8564];return _0x360c61;};'use strict';var _=require('lodash');var util=require(_0xc172('0x0'));var logger=require('../../config/logger')(_0xc172('0x1'));var moment=require(_0xc172('0x2'));var BPromise=require(_0xc172('0x3'));var rp=require(_0xc172('0x4'));var fs=require('fs');var path=require(_0xc172('0x5'));var rimraf=require(_0xc172('0x6'));var config=require('../../config/environment');var attributes=require(_0xc172('0x7'));module['exports']=function(_0x569a8d,_0x247556){return _0x569a8d[_0xc172('0x8')](_0xc172('0x9'),attributes,{'tableName':_0xc172('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fc5=['../../config/environment','exports','define','UserFaxQueue','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1be845,_0x5c472a){var _0x18fac5=function(_0x52b144){while(--_0x52b144){_0x1be845['push'](_0x1be845['shift']());}};_0x18fac5(++_0x5c472a);}(_0x3fc5,0x10c));var _0x53fc=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x3fc5[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x53fc('0x0'));var util=require('util');var logger=require(_0x53fc('0x1'))('api');var moment=require(_0x53fc('0x2'));var BPromise=require(_0x53fc('0x3'));var rp=require(_0x53fc('0x4'));var fs=require('fs');var path=require(_0x53fc('0x5'));var rimraf=require(_0x53fc('0x6'));var config=require(_0x53fc('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x53fc('0x8')]=function(_0xc31195,_0x4bf89b){return _0xc31195[_0x53fc('0x9')](_0x53fc('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 19e4880..5392047 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 _0x4012=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','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'];(function(_0x360f76,_0x2a1361){var _0x4c3d88=function(_0x3e5ab1){while(--_0x3e5ab1){_0x360f76['push'](_0x360f76['shift']());}};_0x4c3d88(++_0x2a1361);}(_0x4012,0x1bf));var _0x2401=function(_0x20a7be,_0x57e651){_0x20a7be=_0x20a7be-0x0;var _0x483865=_0x4012[_0x20a7be];return _0x483865;};'use strict';var _=require(_0x2401('0x0'));var util=require(_0x2401('0x1'));var moment=require(_0x2401('0x2'));var BPromise=require(_0x2401('0x3'));var rs=require(_0x2401('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2401('0x5'))['db'];var utils=require(_0x2401('0x6'));var logger=require(_0x2401('0x7'))(_0x2401('0x8'));var config=require(_0x2401('0x9'));var jayson=require(_0x2401('0xa'));var client=jayson[_0x2401('0xb')][_0x2401('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd7e3ab,_0x244889,_0x2758d2){return new BPromise(function(_0x5e2762,_0x351588){return client['request'](_0xd7e3ab,_0x2758d2)[_0x2401('0xd')](function(_0x4026c2){logger[_0x2401('0xe')](_0x2401('0xf'),_0x244889,_0x2401('0x10'));logger[_0x2401('0x11')](_0x2401('0x12'),_0x244889,_0x2401('0x10'),JSON[_0x2401('0x13')](_0x4026c2));if(_0x4026c2[_0x2401('0x14')]){if(_0x4026c2[_0x2401('0x14')][_0x2401('0x15')]===0x1f4){logger[_0x2401('0x14')](_0x2401('0xf'),_0x244889,_0x4026c2['error'][_0x2401('0x16')]);return _0x351588(_0x4026c2['error'][_0x2401('0x16')]);}logger[_0x2401('0x14')](_0x2401('0xf'),_0x244889,_0x4026c2[_0x2401('0x14')][_0x2401('0x16')]);return _0x5e2762(_0x4026c2['error']['message']);}else{logger[_0x2401('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x244889,'request\x20sent');_0x5e2762(_0x4026c2[_0x2401('0x17')][_0x2401('0x16')]);}})[_0x2401('0x18')](function(_0xa2a4c1){logger[_0x2401('0x14')](_0x2401('0xf'),_0x244889,_0xa2a4c1);_0x351588(_0xa2a4c1);});});} \ No newline at end of file +var _0xfc4e=['rpc','../../config/environment','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x540102,_0x455509){var _0x310d5b=function(_0x39491b){while(--_0x39491b){_0x540102['push'](_0x540102['shift']());}};_0x310d5b(++_0x455509);}(_0xfc4e,0xd6));var _0xefc4=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xfc4e[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xefc4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xefc4('0x1'));var rs=require(_0xefc4('0x2'));var fs=require('fs');var Redis=require(_0xefc4('0x3'));var db=require(_0xefc4('0x4'))['db'];var utils=require(_0xefc4('0x5'));var logger=require('../../config/logger')(_0xefc4('0x6'));var config=require(_0xefc4('0x7'));var jayson=require(_0xefc4('0x8'));var client=jayson[_0xefc4('0x9')][_0xefc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xffc5aa,_0x1b8d39,_0x12b58a){return new BPromise(function(_0x43b9c2,_0x1542a8){return client[_0xefc4('0xb')](_0xffc5aa,_0x12b58a)['then'](function(_0x5dba6f){logger[_0xefc4('0xc')](_0xefc4('0xd'),_0x1b8d39,_0xefc4('0xe'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1b8d39,'request\x20sent',JSON['stringify'](_0x5dba6f));if(_0x5dba6f[_0xefc4('0xf')]){if(_0x5dba6f['error'][_0xefc4('0x10')]===0x1f4){logger[_0xefc4('0xf')](_0xefc4('0xd'),_0x1b8d39,_0x5dba6f[_0xefc4('0xf')][_0xefc4('0x11')]);return _0x1542a8(_0x5dba6f[_0xefc4('0xf')][_0xefc4('0x11')]);}logger[_0xefc4('0xf')](_0xefc4('0xd'),_0x1b8d39,_0x5dba6f[_0xefc4('0xf')][_0xefc4('0x11')]);return _0x43b9c2(_0x5dba6f['error'][_0xefc4('0x11')]);}else{logger[_0xefc4('0xc')](_0xefc4('0xd'),_0x1b8d39,_0xefc4('0xe'));_0x43b9c2(_0x5dba6f[_0xefc4('0x12')]['message']);}})[_0xefc4('0x13')](function(_0x292aa0){logger['error'](_0xefc4('0xd'),_0x1b8d39,_0x292aa0);_0x1542a8(_0x292aa0);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index bf2ec25..894300d 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 _0x0b63=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x380b39,_0x1026dd){var _0x4cacd1=function(_0x52c2b6){while(--_0x52c2b6){_0x380b39['push'](_0x380b39['shift']());}};_0x4cacd1(++_0x1026dd);}(_0x0b63,0xe7));var _0x30b6=function(_0x1beec3,_0x43b981){_0x1beec3=_0x1beec3-0x0;var _0x456c1e=_0x0b63[_0x1beec3];return _0x456c1e;};'use strict';var multer=require(_0x30b6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x30b6('0x1'));var express=require(_0x30b6('0x2'));var router=express[_0x30b6('0x3')]();var fs_extra=require(_0x30b6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x30b6('0x5'));var config=require(_0x30b6('0x6'));module[_0x30b6('0x7')]=router; \ No newline at end of file +var _0x065e=['fs-extra','../../config/environment','exports','multer','express','Router'];(function(_0x2d53ba,_0x2f2302){var _0x1395f3=function(_0x31e812){while(--_0x31e812){_0x2d53ba['push'](_0x2d53ba['shift']());}};_0x1395f3(++_0x2f2302);}(_0x065e,0x1a7));var _0xe065=function(_0x578ba5,_0x26607e){_0x578ba5=_0x578ba5-0x0;var _0x4e9295=_0x065e[_0x578ba5];return _0x4e9295;};'use strict';var multer=require(_0xe065('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe065('0x1'));var router=express[_0xe065('0x2')]();var fs_extra=require(_0xe065('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe065('0x4'));module[_0xe065('0x5')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index a3e2b3b..ccba3cb 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 _0xd8b0=['exports','sequelize'];(function(_0x16acb7,_0x23f034){var _0x39bf39=function(_0x21281e){while(--_0x21281e){_0x16acb7['push'](_0x16acb7['shift']());}};_0x39bf39(++_0x23f034);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x577519,_0x346daf){var _0x5b12f7=function(_0x4aecb6){while(--_0x4aecb6){_0x577519['push'](_0x577519['shift']());}};_0x5b12f7(++_0x346daf);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'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 58a70de..8fc2b8b 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x5c365f,_0x3b40ed){var _0x295e1b=function(_0x226683){while(--_0x226683){_0x5c365f['push'](_0x5c365f['shift']());}};_0x295e1b(++_0x3b40ed);}(_0xb10b,0x12a));var _0xbb10=function(_0x4bea95,_0x2026cb){_0x4bea95=_0x4bea95-0x0;var _0x52aa29=_0xb10b[_0x4bea95];return _0x52aa29;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x4cd14a,_0x3c08b4){var _0x59ac6a=function(_0x5d95ec){while(--_0x5d95ec){_0x4cd14a['push'](_0x4cd14a['shift']());}};_0x59ac6a(++_0x3c08b4);}(_0xb10b,0x12a));var _0xbb10=function(_0xc8f5a3,_0x4a02a5){_0xc8f5a3=_0xc8f5a3-0x0;var _0x55041a=_0xb10b[_0xc8f5a3];return _0x55041a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 3d549d7..e5ca061 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 _0xe685=['UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','code','error','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info'];(function(_0x4035a9,_0x41019f){var _0x1e161b=function(_0x4d880e){while(--_0x4d880e){_0x4035a9['push'](_0x4035a9['shift']());}};_0x1e161b(++_0x41019f);}(_0xe685,0x1ed));var _0x5e68=function(_0xbc41b5,_0x31bfb2){_0xbc41b5=_0xbc41b5-0x0;var _0x1973ea=_0xe685[_0xbc41b5];return _0x1973ea;};'use strict';var _=require('lodash');var util=require(_0x5e68('0x0'));var moment=require(_0x5e68('0x1'));var BPromise=require('bluebird');var rs=require(_0x5e68('0x2'));var fs=require('fs');var Redis=require(_0x5e68('0x3'));var db=require(_0x5e68('0x4'))['db'];var utils=require(_0x5e68('0x5'));var logger=require(_0x5e68('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5e68('0x7'));var client=jayson[_0x5e68('0x8')][_0x5e68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x310072,_0x47f58d,_0x47218c){return new BPromise(function(_0x1e8ac7,_0x165280){return client['request'](_0x310072,_0x47218c)['then'](function(_0x54b9c9){logger[_0x5e68('0xa')](_0x5e68('0xb'),_0x47f58d,_0x5e68('0xc'));logger[_0x5e68('0xd')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x47f58d,'request\x20sent',JSON['stringify'](_0x54b9c9));if(_0x54b9c9['error']){if(_0x54b9c9['error'][_0x5e68('0xe')]===0x1f4){logger[_0x5e68('0xf')](_0x5e68('0xb'),_0x47f58d,_0x54b9c9['error'][_0x5e68('0x10')]);return _0x165280(_0x54b9c9[_0x5e68('0xf')]['message']);}logger[_0x5e68('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x47f58d,_0x54b9c9[_0x5e68('0xf')]['message']);return _0x1e8ac7(_0x54b9c9[_0x5e68('0xf')][_0x5e68('0x10')]);}else{logger[_0x5e68('0xa')]('UserMailQueue,\x20%s,\x20%s',_0x47f58d,_0x5e68('0xc'));_0x1e8ac7(_0x54b9c9['result']['message']);}})[_0x5e68('0x11')](function(_0x45f3c4){logger[_0x5e68('0xf')](_0x5e68('0xb'),_0x47f58d,_0x45f3c4);_0x165280(_0x45f3c4);});});} \ No newline at end of file +var _0x386f=['UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5b24e7,_0x171047){var _0x5f20cb=function(_0x5b5103){while(--_0x5b5103){_0x5b24e7['push'](_0x5b24e7['shift']());}};_0x5f20cb(++_0x171047);}(_0x386f,0x11a));var _0xf386=function(_0x3929e1,_0x53fa82){_0x3929e1=_0x3929e1-0x0;var _0x80cc2f=_0x386f[_0x3929e1];return _0x80cc2f;};'use strict';var _=require(_0xf386('0x0'));var util=require(_0xf386('0x1'));var moment=require(_0xf386('0x2'));var BPromise=require(_0xf386('0x3'));var rs=require(_0xf386('0x4'));var fs=require('fs');var Redis=require(_0xf386('0x5'));var db=require(_0xf386('0x6'))['db'];var utils=require(_0xf386('0x7'));var logger=require(_0xf386('0x8'))('rpc');var config=require(_0xf386('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf386('0xa')][_0xf386('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e9c7c,_0x2123b0,_0x2c5b22){return new BPromise(function(_0x42e077,_0x59dced){return client[_0xf386('0xc')](_0x2e9c7c,_0x2c5b22)[_0xf386('0xd')](function(_0x3891ad){logger[_0xf386('0xe')](_0xf386('0xf'),_0x2123b0,_0xf386('0x10'));logger[_0xf386('0x11')](_0xf386('0x12'),_0x2123b0,'request\x20sent',JSON[_0xf386('0x13')](_0x3891ad));if(_0x3891ad[_0xf386('0x14')]){if(_0x3891ad['error'][_0xf386('0x15')]===0x1f4){logger[_0xf386('0x14')](_0xf386('0xf'),_0x2123b0,_0x3891ad[_0xf386('0x14')][_0xf386('0x16')]);return _0x59dced(_0x3891ad[_0xf386('0x14')][_0xf386('0x16')]);}logger[_0xf386('0x14')](_0xf386('0xf'),_0x2123b0,_0x3891ad[_0xf386('0x14')][_0xf386('0x16')]);return _0x42e077(_0x3891ad['error']['message']);}else{logger['info'](_0xf386('0xf'),_0x2123b0,_0xf386('0x10'));_0x42e077(_0x3891ad[_0xf386('0x17')][_0xf386('0x16')]);}})[_0xf386('0x18')](function(_0x5344f1){logger[_0xf386('0x14')](_0xf386('0xf'),_0x2123b0,_0x5344f1);_0x59dced(_0x5344f1);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 590b026..78c0fdc 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 _0x1776=['./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1776,0x71));var _0x6177=function(_0x3fbd52,_0x5b2799){_0x3fbd52=_0x3fbd52-0x0;var _0x52b3e3=_0x1776[_0x3fbd52];return _0x52b3e3;};'use strict';var multer=require(_0x6177('0x0'));var util=require(_0x6177('0x1'));var path=require('path');var timeout=require(_0x6177('0x2'));var express=require(_0x6177('0x3'));var router=express['Router']();var fs_extra=require(_0x6177('0x4'));var auth=require(_0x6177('0x5'));var interaction=require(_0x6177('0x6'));var config=require('../../config/environment');var controller=require(_0x6177('0x7'));router[_0x6177('0x8')]('/',auth[_0x6177('0x9')](),controller[_0x6177('0xa')]);module[_0x6177('0xb')]=router; \ No newline at end of file +var _0xd351=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','sendUserNotification','exports','util','connect-timeout'];(function(_0x27381f,_0x298b5a){var _0x506a5e=function(_0x163ccf){while(--_0x163ccf){_0x27381f['push'](_0x27381f['shift']());}};_0x506a5e(++_0x298b5a);}(_0xd351,0x174));var _0x1d35=function(_0xfeb43a,_0x3d6470){_0xfeb43a=_0xfeb43a-0x0;var _0x1bfdea=_0xd351[_0xfeb43a];return _0x1bfdea;};'use strict';var multer=require('multer');var util=require(_0x1d35('0x0'));var path=require('path');var timeout=require(_0x1d35('0x1'));var express=require(_0x1d35('0x2'));var router=express[_0x1d35('0x3')]();var fs_extra=require(_0x1d35('0x4'));var auth=require(_0x1d35('0x5'));var interaction=require(_0x1d35('0x6'));var config=require(_0x1d35('0x7'));var controller=require('./userNotification.controller');router['post']('/',auth[_0x1d35('0x8')](),controller[_0x1d35('0x9')]);module[_0x1d35('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index f24377a..aa136d8 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 _0xaa8e=['TEXT'];(function(_0x17c0d9,_0x19f78d){var _0x164907=function(_0xd62171){while(--_0xd62171){_0x17c0d9['push'](_0x17c0d9['shift']());}};_0x164907(++_0x19f78d);}(_0xaa8e,0x13e));var _0xeaa8=function(_0x4e1027,_0x811e4a){_0x4e1027=_0x4e1027-0x0;var _0x2c3210=_0xaa8e[_0x4e1027];return _0x2c3210;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xeaa8('0x0')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xac13=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x3e6ac0,_0x34b200){var _0xe1dee5=function(_0x8864a8){while(--_0x8864a8){_0x3e6ac0['push'](_0x3e6ac0['shift']());}};_0xe1dee5(++_0x34b200);}(_0xac13,0x1a5));var _0x3ac1=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xac13[_0xef8146];return _0x5a6cb0;};'use strict';var Sequelize=require(_0x3ac1('0x0'));module[_0x3ac1('0x1')]={'body':{'type':Sequelize[_0x3ac1('0x2')]},'senderName':{'type':Sequelize[_0x3ac1('0x3')]},'recipientsId':{'type':Sequelize[_0x3ac1('0x2')]},'recipientsDescription':{'type':Sequelize[_0x3ac1('0x3')]},'beep':{'type':Sequelize[_0x3ac1('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d3f4bf7..5c047db 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 _0xec5b=['emit','Template','findOne','html','render','view','catch','User','union','ids','queue','replace','Queue','push','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../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','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','set','reject','update','then','error','stack','name','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','smsqueue','voicequeue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xec5b,0x137));var _0xbec5=function(_0x411d66,_0x418a17){_0x411d66=_0x411d66-0x0;var _0x273da0=_0xec5b[_0x411d66];return _0x273da0;};'use strict';var pdf=require(_0xbec5('0x0'));var emlformat=require(_0xbec5('0x1'));var rimraf=require(_0xbec5('0x2'));var zipdir=require(_0xbec5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbec5('0x4'));var moment=require(_0xbec5('0x5'));var BPromise=require(_0xbec5('0x6'));var Mustache=require(_0xbec5('0x7'));var util=require(_0xbec5('0x8'));var path=require(_0xbec5('0x9'));var sox=require(_0xbec5('0xa'));var csv=require(_0xbec5('0xb'));var ejs=require(_0xbec5('0xc'));var fs=require('fs');var fs_extra=require(_0xbec5('0xd'));var _=require(_0xbec5('0xe'));var squel=require('squel');var crypto=require(_0xbec5('0xf'));var jsforce=require(_0xbec5('0x10'));var deskjs=require(_0xbec5('0x11'));var toCsv=require(_0xbec5('0xb'));var querystring=require('querystring');var Papa=require(_0xbec5('0x12'));var Redis=require(_0xbec5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbec5('0x14'));var as=require(_0xbec5('0x15'));var hardwareService=require(_0xbec5('0x16'));var logger=require(_0xbec5('0x17'))('api');var utils=require(_0xbec5('0x18'));var config=require(_0xbec5('0x19'));var licenseUtil=require(_0xbec5('0x1a'));var db=require(_0xbec5('0x1b'))['db'];config[_0xbec5('0x1c')]=_[_0xbec5('0x1d')](config[_0xbec5('0x1c')],{'host':_0xbec5('0x1e'),'port':0x18eb});var socket=require(_0xbec5('0x1f'))(new Redis(config[_0xbec5('0x1c')]));require(_0xbec5('0x20'))[_0xbec5('0x21')](socket);function respondWithStatusCode(_0x128004,_0x43eef0){_0x43eef0=_0x43eef0||0xcc;return function(_0x575e83){if(_0x575e83){return _0x128004[_0xbec5('0x22')](_0x43eef0);}return _0x128004[_0xbec5('0x23')](_0x43eef0)[_0xbec5('0x24')]();};}function respondWithResult(_0x2f7ca6,_0x2eae18){_0x2eae18=_0x2eae18||0xc8;return function(_0xb832ac){if(_0xb832ac){return _0x2f7ca6[_0xbec5('0x23')](_0x2eae18)[_0xbec5('0x25')](_0xb832ac);}};}function respondWithFilteredResult(_0x126ea1,_0x47ebac){return function(_0x5c63e2){if(_0x5c63e2){var _0x573d18=_0x5c63e2['count'],_0x159985=_0x47ebac['offset'],_0x414e8b=_0x47ebac[_0xbec5('0x26')]+_0x47ebac[_0xbec5('0x27')],_0x113263;if(_0x414e8b>=_0x573d18){_0x414e8b=_0x573d18;_0x113263=0xc8;}else{_0x113263=0xce;}_0x126ea1['status'](_0x113263);return _0x126ea1[_0xbec5('0x28')]('Content-Range',_0x159985+'-'+_0x414e8b+'/'+_0x573d18)[_0xbec5('0x25')](_0x5c63e2);}return null;};}function patchUpdates(_0x5439eb){return function(_0x22686f){try{jsonpatch['apply'](_0x22686f,_0x5439eb,!![]);}catch(_0x310345){return BPromise[_0xbec5('0x29')](_0x310345);}return _0x22686f['save']();};}function saveUpdates(_0x1f1d12,_0x166e07){return function(_0x2c18ba){if(_0x2c18ba){return _0x2c18ba[_0xbec5('0x2a')](_0x1f1d12)[_0xbec5('0x2b')](function(_0x59ca98){return _0x59ca98;});}return null;};}function removeEntity(_0x5e5da5,_0x1a605a){return function(_0x1d61e1){if(_0x1d61e1){return _0x1d61e1['destroy']()[_0xbec5('0x2b')](function(){_0x5e5da5[_0xbec5('0x23')](0xcc)[_0xbec5('0x24')]();});}};}function handleEntityNotFound(_0x47afd5,_0x20d8b4){return function(_0x1f2545){if(!_0x1f2545){_0x47afd5[_0xbec5('0x22')](0x194);}return _0x1f2545;};}function handleError(_0x26dbd8,_0x25fbcd){_0x25fbcd=_0x25fbcd||0x1f4;return function(_0x51d2a1){logger[_0xbec5('0x2c')](_0x51d2a1[_0xbec5('0x2d')]);if(_0x51d2a1[_0xbec5('0x2e')]){delete _0x51d2a1[_0xbec5('0x2e')];}_0x26dbd8[_0xbec5('0x23')](_0x25fbcd)[_0xbec5('0x2f')](_0x51d2a1);};}exports[_0xbec5('0x30')]=function(_0x173682,_0x2fb6b7,_0x12b22a){if(!_0x173682['body'][_0xbec5('0x31')](_0xbec5('0x32'))&&!_0x173682[_0xbec5('0x33')][_0xbec5('0x31')](_0xbec5('0x34'))){throw new db[(_0xbec5('0x35'))][(_0xbec5('0x36'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x173682['body'][_0xbec5('0x31')](_0xbec5('0x34'))&&!_0x173682['body'][_0xbec5('0x31')]('view')){throw new db[(_0xbec5('0x35'))][(_0xbec5('0x36'))](_0xbec5('0x37'));}if(!_0x173682[_0xbec5('0x33')]['hasOwnProperty'](_0xbec5('0x38'))){throw new db[(_0xbec5('0x35'))][(_0xbec5('0x36'))](_0xbec5('0x39'));}else{try{var _0x15c18b=JSON[_0xbec5('0x3a')](_0x173682['body'][_0xbec5('0x38')]);}catch(_0x40b745){logger['error'](_0x40b745);throw new db[(_0xbec5('0x35'))][(_0xbec5('0x36'))](_0xbec5('0x3b'));}var _0x66afe5=['chatqueue','faxqueue','mailqueue','openchannelqueue',_0xbec5('0x3c'),_0xbec5('0x3d'),'whatsappqueue',_0xbec5('0x3e'),'user'];if(_[_0xbec5('0x3f')](_0x15c18b,function(_0x340c7e){return!_['includes'](_0x66afe5,_0x340c7e[_0xbec5('0x40')][_0xbec5('0x41')]());})){throw new db['Sequelize']['ValidationError'](_0xbec5('0x42'));}}}var _0x31dca5={};_0x31dca5[_0xbec5('0x43')]=_0x173682[_0xbec5('0x33')][_0xbec5('0x31')](_0xbec5('0x43'))?_0x173682[_0xbec5('0x33')][_0xbec5('0x43')]:_0x173682[_0xbec5('0x44')]['fullname'];_0x31dca5[_0xbec5('0x45')]=_[_0xbec5('0x46')](_0x173682[_0xbec5('0x33')][_0xbec5('0x45')])?null:_0x173682['body']['recipientsDescription'];_0x31dca5[_0xbec5('0x47')]=_0x173682[_0xbec5('0x33')][_0xbec5('0x47')]||![];_0x31dca5[_0xbec5('0x48')]=_0x173682[_0xbec5('0x44')]['id'];return getContent(_0x173682[_0xbec5('0x33')])['then'](function(_0x4c0b46){_0x31dca5[_0xbec5('0x33')]=_0x4c0b46;return getRecipients(_0x15c18b);})['then'](function(_0x41ced0){_0x31dca5[_0xbec5('0x49')]=_[_0xbec5('0x4a')](_0x41ced0)[_0xbec5('0x4b')](',');return db[_0xbec5('0x4c')][_0xbec5('0x4d')](function(_0x36f777){return db[_0xbec5('0x4e')]['create'](_0x31dca5,{'raw':!![],'transaction':_0x36f777})[_0xbec5('0x2b')](function(_0xa9bc08){var _0x3a2eb4={'sender':_0x31dca5[_0xbec5('0x43')],'description':_0x31dca5[_0xbec5('0x45')],'content':_0x31dca5['body'],'beep':_0x31dca5['beep']};_0x41ced0[_0xbec5('0x4f')](function(_0x58ea5e){_0x3a2eb4[_0xbec5('0x50')]=_0x58ea5e;socket[_0xbec5('0x51')]('userNotification:send',_0x3a2eb4);});return _0xa9bc08;});});})[_0xbec5('0x2b')](respondWithResult(_0x2fb6b7,0xc9))['catch'](handleError(_0x2fb6b7,null));};function getContent(_0x430e6e){return new BPromise(function(_0x43586c,_0x4dc5ff){if(_0x430e6e[_0xbec5('0x32')]){_0x43586c(_0x430e6e[_0xbec5('0x32')]);return;}return db[_0xbec5('0x52')][_0xbec5('0x53')]({'attributes':[_0xbec5('0x54')],'where':{'id':_0x430e6e[_0xbec5('0x34')]},'raw':!![]})[_0xbec5('0x2b')](function(_0x308e2d){if(!_0x308e2d)throw new db['Sequelize']['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3e5ea9=Mustache[_0xbec5('0x55')](_0x308e2d['html'],_0x430e6e[_0xbec5('0x56')]);_0x43586c(_0x3e5ea9);})[_0xbec5('0x57')](function(_0x4e9bbc){_0x4dc5ff(_0x4e9bbc);});});}function getRecipients(_0x100c6a){return new BPromise(function(_0x1eccd6,_0x58a4fd){var _0x22e209=[];var _0x4d98e3=[];_0x100c6a[_0xbec5('0x4f')](function(_0x269e9f){var _0x519ab7=_['startCase'](_0x269e9f['model'][_0xbec5('0x41')]());if(_0x519ab7===_0xbec5('0x58')){_0x22e209=_[_0xbec5('0x59')](_0x22e209,_0x269e9f[_0xbec5('0x5a')]);}else{if(_['includes'](_0x519ab7,_0xbec5('0x5b')))_0x519ab7=_0x519ab7[_0xbec5('0x5c')](_0xbec5('0x5b'),_0xbec5('0x5d'));_0x269e9f[_0xbec5('0x5a')]['forEach'](function(_0x44622d){_0x4d98e3[_0xbec5('0x5e')](getAgents(_0x519ab7,_0x44622d));});}});return BPromise['all'](_0x4d98e3)[_0xbec5('0x2b')](function(_0x17f736){_0x22e209=_[_0xbec5('0x59')](_0x22e209,_[_0xbec5('0x5f')](_0x17f736));_0x1eccd6(_0x22e209);})['catch'](function(_0x5f043b){_0x58a4fd(_0x5f043b);});});}function getAgents(_0x216bf3,_0x756335){return new BPromise(function(_0x3e6e1b,_0x215f9a){return db[_0x216bf3][_0xbec5('0x53')]({'where':{'id':_0x756335}})[_0xbec5('0x2b')](function(_0x106525){return _0x106525[_0xbec5('0x60')]({'attributes':['id'],'raw':!![]})[_0xbec5('0x2b')](function(_0x3c202c){var _0x1df2bd=_[_0xbec5('0x61')](_0x3c202c,'id');_0x3e6e1b(_0x1df2bd);});})[_0xbec5('0x57')](function(_0x122ddd){_0x215f9a(_0x122ddd);});});} \ No newline at end of file +var _0x4062=['reject','save','update','destroy','then','send','sendUserNotification','body','hasOwnProperty','text','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','smsqueue','whatsappqueue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','sortBy','join','transaction','UserNotification','create','forEach','emit','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','catch','User','union','ids','includes','queue','replace','Queue','all','flatten','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','limit','set','json'];(function(_0x1af70b,_0x981f09){var _0x32c619=function(_0x373205){while(--_0x373205){_0x1af70b['push'](_0x1af70b['shift']());}};_0x32c619(++_0x981f09);}(_0x4062,0xfb));var _0x2406=function(_0x4064d1,_0x43c1cd){_0x4064d1=_0x4064d1-0x0;var _0x4814ea=_0x4062[_0x4064d1];return _0x4814ea;};'use strict';var pdf=require(_0x2406('0x0'));var emlformat=require(_0x2406('0x1'));var rimraf=require(_0x2406('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2406('0x3'));var rp=require(_0x2406('0x4'));var moment=require(_0x2406('0x5'));var BPromise=require(_0x2406('0x6'));var Mustache=require('mustache');var util=require(_0x2406('0x7'));var path=require(_0x2406('0x8'));var sox=require(_0x2406('0x9'));var csv=require(_0x2406('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2406('0xb'));var _=require(_0x2406('0xc'));var squel=require(_0x2406('0xd'));var crypto=require(_0x2406('0xe'));var jsforce=require(_0x2406('0xf'));var deskjs=require(_0x2406('0x10'));var toCsv=require(_0x2406('0xa'));var querystring=require(_0x2406('0x11'));var Papa=require(_0x2406('0x12'));var Redis=require(_0x2406('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2406('0x14'));var hardwareService=require(_0x2406('0x15'));var logger=require(_0x2406('0x16'))(_0x2406('0x17'));var utils=require('../../config/utils');var config=require(_0x2406('0x18'));var licenseUtil=require(_0x2406('0x19'));var db=require(_0x2406('0x1a'))['db'];config['redis']=_[_0x2406('0x1b')](config[_0x2406('0x1c')],{'host':_0x2406('0x1d'),'port':0x18eb});var socket=require(_0x2406('0x1e'))(new Redis(config['redis']));require(_0x2406('0x1f'))[_0x2406('0x20')](socket);function respondWithStatusCode(_0x421c31,_0x6bed8a){_0x6bed8a=_0x6bed8a||0xcc;return function(_0x5797f9){if(_0x5797f9){return _0x421c31[_0x2406('0x21')](_0x6bed8a);}return _0x421c31[_0x2406('0x22')](_0x6bed8a)[_0x2406('0x23')]();};}function respondWithResult(_0x33756f,_0x10b5aa){_0x10b5aa=_0x10b5aa||0xc8;return function(_0x2cf638){if(_0x2cf638){return _0x33756f[_0x2406('0x22')](_0x10b5aa)['json'](_0x2cf638);}};}function respondWithFilteredResult(_0x539a9a,_0x1ae5a7){return function(_0x2671ca){if(_0x2671ca){var _0x5c0059=_0x2671ca['count'],_0x3ae6d1=_0x1ae5a7[_0x2406('0x24')],_0x53cb17=_0x1ae5a7[_0x2406('0x24')]+_0x1ae5a7[_0x2406('0x25')],_0x322939;if(_0x53cb17>=_0x5c0059){_0x53cb17=_0x5c0059;_0x322939=0xc8;}else{_0x322939=0xce;}_0x539a9a['status'](_0x322939);return _0x539a9a[_0x2406('0x26')]('Content-Range',_0x3ae6d1+'-'+_0x53cb17+'/'+_0x5c0059)[_0x2406('0x27')](_0x2671ca);}return null;};}function patchUpdates(_0x1b43fa){return function(_0x14bbee){try{jsonpatch['apply'](_0x14bbee,_0x1b43fa,!![]);}catch(_0x3642b4){return BPromise[_0x2406('0x28')](_0x3642b4);}return _0x14bbee[_0x2406('0x29')]();};}function saveUpdates(_0x312d1c,_0x5a4708){return function(_0x2a74b2){if(_0x2a74b2){return _0x2a74b2[_0x2406('0x2a')](_0x312d1c)['then'](function(_0x3c11cb){return _0x3c11cb;});}return null;};}function removeEntity(_0xd963d7,_0x550767){return function(_0x39e8af){if(_0x39e8af){return _0x39e8af[_0x2406('0x2b')]()[_0x2406('0x2c')](function(){_0xd963d7[_0x2406('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x518b9a,_0x5a7a70){return function(_0x32c71e){if(!_0x32c71e){_0x518b9a[_0x2406('0x21')](0x194);}return _0x32c71e;};}function handleError(_0x58558f,_0x275e69){_0x275e69=_0x275e69||0x1f4;return function(_0x59fdfc){logger['error'](_0x59fdfc['stack']);if(_0x59fdfc['name']){delete _0x59fdfc['name'];}_0x58558f[_0x2406('0x22')](_0x275e69)[_0x2406('0x2d')](_0x59fdfc);};}exports[_0x2406('0x2e')]=function(_0x36c82d,_0x119d93,_0x44941b){if(!_0x36c82d[_0x2406('0x2f')][_0x2406('0x30')](_0x2406('0x31'))&&!_0x36c82d[_0x2406('0x2f')]['hasOwnProperty']('TemplateId')){throw new db['Sequelize'][(_0x2406('0x32'))](_0x2406('0x33'));}else{if(_0x36c82d[_0x2406('0x2f')][_0x2406('0x30')](_0x2406('0x34'))&&!_0x36c82d[_0x2406('0x2f')][_0x2406('0x30')](_0x2406('0x35'))){throw new db[(_0x2406('0x36'))][(_0x2406('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x36c82d['body'][_0x2406('0x30')](_0x2406('0x37'))){throw new db[(_0x2406('0x36'))]['ValidationError'](_0x2406('0x38'));}else{try{var _0xb41763=JSON[_0x2406('0x39')](_0x36c82d[_0x2406('0x2f')]['recipients']);}catch(_0x333aff){logger[_0x2406('0x3a')](_0x333aff);throw new db[(_0x2406('0x36'))][(_0x2406('0x32'))](_0x2406('0x3b'));}var _0x3020c5=[_0x2406('0x3c'),'faxqueue',_0x2406('0x3d'),'openchannelqueue',_0x2406('0x3e'),'voicequeue',_0x2406('0x3f'),_0x2406('0x40'),'user'];if(_[_0x2406('0x41')](_0xb41763,function(_0x37cb71){return!_['includes'](_0x3020c5,_0x37cb71[_0x2406('0x42')][_0x2406('0x43')]());})){throw new db[(_0x2406('0x36'))][(_0x2406('0x32'))](_0x2406('0x44'));}}}var _0x736661={};_0x736661[_0x2406('0x45')]=_0x36c82d[_0x2406('0x2f')]['hasOwnProperty'](_0x2406('0x45'))?_0x36c82d['body'][_0x2406('0x45')]:_0x36c82d[_0x2406('0x46')]['fullname'];_0x736661[_0x2406('0x47')]=_[_0x2406('0x48')](_0x36c82d[_0x2406('0x2f')][_0x2406('0x47')])?null:_0x36c82d['body']['recipientsDescription'];_0x736661['beep']=_0x36c82d[_0x2406('0x2f')][_0x2406('0x49')]||![];_0x736661['SenderId']=_0x36c82d[_0x2406('0x46')]['id'];return getContent(_0x36c82d[_0x2406('0x2f')])[_0x2406('0x2c')](function(_0x4fcb05){_0x736661[_0x2406('0x2f')]=_0x4fcb05;return getRecipients(_0xb41763);})['then'](function(_0x55be87){_0x736661['recipientsId']=_[_0x2406('0x4a')](_0x55be87)[_0x2406('0x4b')](',');return db['sequelize'][_0x2406('0x4c')](function(_0x1dd2f9){return db[_0x2406('0x4d')][_0x2406('0x4e')](_0x736661,{'raw':!![],'transaction':_0x1dd2f9})['then'](function(_0x4969e8){var _0x9d986a={'sender':_0x736661[_0x2406('0x45')],'description':_0x736661['recipientsDescription'],'content':_0x736661['body'],'beep':_0x736661[_0x2406('0x49')]};_0x55be87[_0x2406('0x4f')](function(_0x283f2e){_0x9d986a['recipient']=_0x283f2e;socket[_0x2406('0x50')]('userNotification:send',_0x9d986a);});return _0x4969e8;});});})[_0x2406('0x2c')](respondWithResult(_0x119d93,0xc9))['catch'](handleError(_0x119d93,null));};function getContent(_0x1f6670){return new BPromise(function(_0x304491,_0x138f82){if(_0x1f6670[_0x2406('0x31')]){_0x304491(_0x1f6670['text']);return;}return db[_0x2406('0x51')][_0x2406('0x52')]({'attributes':['html'],'where':{'id':_0x1f6670[_0x2406('0x34')]},'raw':!![]})[_0x2406('0x2c')](function(_0x35e356){if(!_0x35e356)throw new db[(_0x2406('0x36'))]['ValidationError'](_0x2406('0x53'));var _0x2a552a=Mustache[_0x2406('0x54')](_0x35e356[_0x2406('0x55')],_0x1f6670['view']);_0x304491(_0x2a552a);})[_0x2406('0x56')](function(_0x21c32a){_0x138f82(_0x21c32a);});});}function getRecipients(_0x34ffcc){return new BPromise(function(_0x50b12b,_0xf1ec00){var _0x3c94b0=[];var _0x7a65d7=[];_0x34ffcc[_0x2406('0x4f')](function(_0x24cf9d){var _0x7c746c=_['startCase'](_0x24cf9d[_0x2406('0x42')]['toLowerCase']());if(_0x7c746c===_0x2406('0x57')){_0x3c94b0=_[_0x2406('0x58')](_0x3c94b0,_0x24cf9d[_0x2406('0x59')]);}else{if(_[_0x2406('0x5a')](_0x7c746c,_0x2406('0x5b')))_0x7c746c=_0x7c746c[_0x2406('0x5c')](_0x2406('0x5b'),_0x2406('0x5d'));_0x24cf9d[_0x2406('0x59')][_0x2406('0x4f')](function(_0x562463){_0x7a65d7['push'](getAgents(_0x7c746c,_0x562463));});}});return BPromise[_0x2406('0x5e')](_0x7a65d7)[_0x2406('0x2c')](function(_0x3c6da4){_0x3c94b0=_['union'](_0x3c94b0,_[_0x2406('0x5f')](_0x3c6da4));_0x50b12b(_0x3c94b0);})[_0x2406('0x56')](function(_0x3d3151){_0xf1ec00(_0x3d3151);});});}function getAgents(_0x2b4ee6,_0x577acc){return new BPromise(function(_0x1a3556,_0x101f7f){return db[_0x2b4ee6][_0x2406('0x52')]({'where':{'id':_0x577acc}})[_0x2406('0x2c')](function(_0x51ae7f){return _0x51ae7f[_0x2406('0x60')]({'attributes':['id'],'raw':!![]})[_0x2406('0x2c')](function(_0x5cf658){var _0x3b1349=_['map'](_0x5cf658,'id');_0x1a3556(_0x3b1349);});})['catch'](function(_0x3160a1){_0x101f7f(_0x3160a1);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 0f2f72c..4979415 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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x33a01d,_0x44a200){var _0x19df5c=function(_0x36abed){while(--_0x36abed){_0x33a01d['push'](_0x33a01d['shift']());}};_0x19df5c(++_0x44a200);}(_0x008c,0x188));var _0xc008=function(_0x43b4b5,_0x3efc1b){_0x43b4b5=_0x43b4b5-0x0;var _0x2df432=_0x008c[_0x43b4b5];return _0x2df432;};'use strict';var EventEmitter=require(_0xc008('0x0'));var UserNotification=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){UserNotificationEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);UserNotificationEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];UserNotification[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x9f62=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x1061de,_0x38998a){var _0x3b543f=function(_0x39e67a){while(--_0x39e67a){_0x1061de['push'](_0x1061de['shift']());}};_0x3b543f(++_0x38998a);}(_0x9f62,0x154));var _0x29f6=function(_0x2c061a,_0x3c04c0){_0x2c061a=_0x2c061a-0x0;var _0x2d55dd=_0x9f62[_0x2c061a];return _0x2d55dd;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x29f6('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x29f6('0x1')](0x0);var events={'afterCreate':_0x29f6('0x2'),'afterUpdate':_0x29f6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54d164){return function(_0x258ddd,_0x2f0420,_0xefa26c){UserNotificationEvents[_0x29f6('0x4')](_0x54d164+':'+_0x258ddd['id'],_0x258ddd);UserNotificationEvents['emit'](_0x54d164,_0x258ddd);_0xefa26c(null);};}for(var e in events){if(events[_0x29f6('0x5')](e)){var event=events[e];UserNotification[_0x29f6('0x6')](e,emitEvent(event));}}module[_0x29f6('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 f77f6a4..cc8d703 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 _0xa1aa=['utf8mb4','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','UserNotification'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa1aa,0x19b));var _0xaa1a=function(_0x3dd62d,_0x1b8677){_0x3dd62d=_0x3dd62d-0x0;var _0x6e44ec=_0xa1aa[_0x3dd62d];return _0x6e44ec;};'use strict';var _=require('lodash');var util=require(_0xaa1a('0x0'));var logger=require(_0xaa1a('0x1'))(_0xaa1a('0x2'));var moment=require(_0xaa1a('0x3'));var BPromise=require(_0xaa1a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaa1a('0x5'));var config=require(_0xaa1a('0x6'));var attributes=require('./userNotification.attributes');module[_0xaa1a('0x7')]=function(_0x370a4e,_0x243c15){return _0x370a4e['define'](_0xaa1a('0x8'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaa1a('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4d6e=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','lodash'];(function(_0x558ec3,_0x4d5d78){var _0x543965=function(_0x4e9234){while(--_0x4e9234){_0x558ec3['push'](_0x558ec3['shift']());}};_0x543965(++_0x4d5d78);}(_0x4d6e,0x77));var _0xe4d6=function(_0x6d0c3e,_0xbc2aed){_0x6d0c3e=_0x6d0c3e-0x0;var _0x2895ce=_0x4d6e[_0x6d0c3e];return _0x2895ce;};'use strict';var _=require(_0xe4d6('0x0'));var util=require(_0xe4d6('0x1'));var logger=require(_0xe4d6('0x2'))(_0xe4d6('0x3'));var moment=require(_0xe4d6('0x4'));var BPromise=require('bluebird');var rp=require(_0xe4d6('0x5'));var fs=require('fs');var path=require(_0xe4d6('0x6'));var rimraf=require(_0xe4d6('0x7'));var config=require(_0xe4d6('0x8'));var attributes=require(_0xe4d6('0x9'));module[_0xe4d6('0xa')]=function(_0x3a452a,_0x2d08ae){return _0x3a452a[_0xe4d6('0xb')](_0xe4d6('0xc'),attributes,{'tableName':_0xe4d6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe4d6('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 33849e8..21cc052 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 _0x6be9=['client','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x26ab98,_0x540333){var _0x50d0a4=function(_0x4c21b7){while(--_0x4c21b7){_0x26ab98['push'](_0x26ab98['shift']());}};_0x50d0a4(++_0x540333);}(_0x6be9,0x1ec));var _0x96be=function(_0x2a22c6,_0x1b18bb){_0x2a22c6=_0x2a22c6-0x0;var _0x56162d=_0x6be9[_0x2a22c6];return _0x56162d;};'use strict';var _=require(_0x96be('0x0'));var util=require(_0x96be('0x1'));var moment=require('moment');var BPromise=require(_0x96be('0x2'));var rs=require(_0x96be('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x96be('0x4'));var logger=require(_0x96be('0x5'))('rpc');var config=require(_0x96be('0x6'));var jayson=require(_0x96be('0x7'));var client=jayson[_0x96be('0x8')]['http']({'port':0x232a});config['redis']=_[_0x96be('0x9')](config[_0x96be('0xa')],{'host':_0x96be('0xb'),'port':0x18eb});var socket=require(_0x96be('0xc'))(new Redis(config['redis']));require(_0x96be('0xd'))['register'](socket);function respondWithRpcPromise(_0x543082,_0x42c4b2,_0x43b3d4){return new BPromise(function(_0x14b3ba,_0x3d3e2d){return client[_0x96be('0xe')](_0x543082,_0x43b3d4)[_0x96be('0xf')](function(_0x1b685b){logger[_0x96be('0x10')](_0x96be('0x11'),_0x42c4b2,_0x96be('0x12'));logger['debug'](_0x96be('0x13'),_0x42c4b2,'request\x20sent',JSON[_0x96be('0x14')](_0x1b685b));if(_0x1b685b[_0x96be('0x15')]){if(_0x1b685b[_0x96be('0x15')][_0x96be('0x16')]===0x1f4){logger[_0x96be('0x15')]('UserNotification,\x20%s,\x20%s',_0x42c4b2,_0x1b685b[_0x96be('0x15')][_0x96be('0x17')]);return _0x3d3e2d(_0x1b685b[_0x96be('0x15')][_0x96be('0x17')]);}logger['error'](_0x96be('0x11'),_0x42c4b2,_0x1b685b[_0x96be('0x15')][_0x96be('0x17')]);return _0x14b3ba(_0x1b685b[_0x96be('0x15')]['message']);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x42c4b2,_0x96be('0x12'));_0x14b3ba(_0x1b685b['result'][_0x96be('0x17')]);}})[_0x96be('0x18')](function(_0x5d350a){logger[_0x96be('0x15')](_0x96be('0x11'),_0x42c4b2,_0x5d350a);_0x3d3e2d(_0x5d350a);});});} \ No newline at end of file +var _0xdeff=['util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x5a3a20,_0x223458){var _0x480d41=function(_0x65d7f6){while(--_0x65d7f6){_0x5a3a20['push'](_0x5a3a20['shift']());}};_0x480d41(++_0x223458);}(_0xdeff,0xd8));var _0xfdef=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0xdeff[_0x28669c];return _0x4a3af6;};'use strict';var _=require('lodash');var util=require(_0xfdef('0x0'));var moment=require(_0xfdef('0x1'));var BPromise=require('bluebird');var rs=require(_0xfdef('0x2'));var fs=require('fs');var Redis=require(_0xfdef('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfdef('0x4'))(_0xfdef('0x5'));var config=require(_0xfdef('0x6'));var jayson=require(_0xfdef('0x7'));var client=jayson[_0xfdef('0x8')][_0xfdef('0x9')]({'port':0x232a});config[_0xfdef('0xa')]=_[_0xfdef('0xb')](config[_0xfdef('0xa')],{'host':_0xfdef('0xc'),'port':0x18eb});var socket=require(_0xfdef('0xd'))(new Redis(config[_0xfdef('0xa')]));require(_0xfdef('0xe'))[_0xfdef('0xf')](socket);function respondWithRpcPromise(_0x2f9991,_0x376806,_0x59ae85){return new BPromise(function(_0x5783cf,_0x5f4fc5){return client[_0xfdef('0x10')](_0x2f9991,_0x59ae85)['then'](function(_0x25276c){logger[_0xfdef('0x11')](_0xfdef('0x12'),_0x376806,_0xfdef('0x13'));logger[_0xfdef('0x14')](_0xfdef('0x15'),_0x376806,_0xfdef('0x13'),JSON[_0xfdef('0x16')](_0x25276c));if(_0x25276c['error']){if(_0x25276c[_0xfdef('0x17')][_0xfdef('0x18')]===0x1f4){logger['error'](_0xfdef('0x12'),_0x376806,_0x25276c['error'][_0xfdef('0x19')]);return _0x5f4fc5(_0x25276c[_0xfdef('0x17')][_0xfdef('0x19')]);}logger['error'](_0xfdef('0x12'),_0x376806,_0x25276c[_0xfdef('0x17')][_0xfdef('0x19')]);return _0x5783cf(_0x25276c[_0xfdef('0x17')][_0xfdef('0x19')]);}else{logger['info'](_0xfdef('0x12'),_0x376806,_0xfdef('0x13'));_0x5783cf(_0x25276c['result'][_0xfdef('0x19')]);}})[_0xfdef('0x1a')](function(_0x33214){logger['error']('UserNotification,\x20%s,\x20%s',_0x376806,_0x33214);_0x5f4fc5(_0x33214);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 0730c1a..3791b51 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 _0x77f7=['update','emit','register','length','userNotification:','./userNotification.events','save','remove'];(function(_0x5d14c3,_0x2437f2){var _0x26fc55=function(_0x1e35ba){while(--_0x1e35ba){_0x5d14c3['push'](_0x5d14c3['shift']());}};_0x26fc55(++_0x2437f2);}(_0x77f7,0xbd));var _0x777f=function(_0x1494a0,_0xc46cf8){_0x1494a0=_0x1494a0-0x0;var _0x2627d9=_0x77f7[_0x1494a0];return _0x2627d9;};'use strict';var UserNotificationEvents=require(_0x777f('0x0'));var events=[_0x777f('0x1'),_0x777f('0x2'),_0x777f('0x3')];function createListener(_0x1f8adc,_0xcd0b99){return function(_0x1f15bf){_0xcd0b99[_0x777f('0x4')](_0x1f8adc,_0x1f15bf);};}function removeListener(_0x1f783b,_0x5a26ca){return function(){UserNotificationEvents['removeListener'](_0x1f783b,_0x5a26ca);};}exports[_0x777f('0x5')]=function(_0x188bf1){for(var _0x186afb=0x0,_0x16642d=events[_0x777f('0x6')];_0x186afb<_0x16642d;_0x186afb++){var _0x5bf11d=events[_0x186afb];var _0x12bff6=createListener(_0x777f('0x7')+_0x5bf11d,_0x188bf1);UserNotificationEvents['on'](_0x5bf11d,_0x12bff6);}}; \ No newline at end of file +var _0x869e=['remove','emit','removeListener','register','userNotification:','./userNotification.events','save'];(function(_0x6306d2,_0x4ae91b){var _0x4d13aa=function(_0x3bfb2a){while(--_0x3bfb2a){_0x6306d2['push'](_0x6306d2['shift']());}};_0x4d13aa(++_0x4ae91b);}(_0x869e,0x15c));var _0xe869=function(_0x5d5f4f,_0x1a432e){_0x5d5f4f=_0x5d5f4f-0x0;var _0x4b6082=_0x869e[_0x5d5f4f];return _0x4b6082;};'use strict';var UserNotificationEvents=require(_0xe869('0x0'));var events=[_0xe869('0x1'),_0xe869('0x2'),'update'];function createListener(_0x1984e4,_0x14dd86){return function(_0xb2e42a){_0x14dd86[_0xe869('0x3')](_0x1984e4,_0xb2e42a);};}function removeListener(_0x39fee6,_0x597771){return function(){UserNotificationEvents[_0xe869('0x4')](_0x39fee6,_0x597771);};}exports[_0xe869('0x5')]=function(_0x26a223){for(var _0x26afde=0x0,_0x587ead=events['length'];_0x26afde<_0x587ead;_0x26afde++){var _0xb3936=events[_0x26afde];var _0x296feb=createListener(_0xe869('0x6')+_0xb3936,_0x26a223);UserNotificationEvents['on'](_0xb3936,_0x296feb);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index fe4bdf8..ca0e437 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 _0xfbb4=['fs-extra','../../components/auth/service','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1481d2,_0x2c97b0){var _0xeaa21f=function(_0x3fe4c2){while(--_0x3fe4c2){_0x1481d2['push'](_0x1481d2['shift']());}};_0xeaa21f(++_0x2c97b0);}(_0xfbb4,0x186));var _0x4fbb=function(_0xbd8547,_0x2e0fd2){_0xbd8547=_0xbd8547-0x0;var _0x2cc550=_0xfbb4[_0xbd8547];return _0x2cc550;};'use strict';var multer=require(_0x4fbb('0x0'));var util=require(_0x4fbb('0x1'));var path=require(_0x4fbb('0x2'));var timeout=require(_0x4fbb('0x3'));var express=require(_0x4fbb('0x4'));var router=express[_0x4fbb('0x5')]();var fs_extra=require(_0x4fbb('0x6'));var auth=require(_0x4fbb('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x4fbb('0x8')]=router; \ No newline at end of file +var _0x7072=['express','Router','../../components/interaction/service','exports','util','path','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7072,0x138));var _0x2707=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x7072[_0x363ef8];return _0x148822;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2707('0x5'));var config=require('../../config/environment');module[_0x2707('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index c8e2f3e..cdf2386 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 _0xbaf0=['exports','INTEGER'];(function(_0x1fb4a0,_0x48a602){var _0x1094e7=function(_0x25fcd5){while(--_0x25fcd5){_0x1fb4a0['push'](_0x1fb4a0['shift']());}};_0x1094e7(++_0x48a602);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0xa01fc0,_0x30ffce){var _0x1aeb02=function(_0x3cf856){while(--_0x3cf856){_0xa01fc0['push'](_0xa01fc0['shift']());}};_0x1aeb02(++_0x30ffce);}(_0xe706,0xa3));var _0x6e70=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xe706[_0x288f5e];return _0x476cc9;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index a0ac535..9265087 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 _0x9431=['./userOpenchannelQueue.attributes','define','lodash','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x48dca8,_0x59b0c9){var _0x595683=function(_0x3ff8d2){while(--_0x3ff8d2){_0x48dca8['push'](_0x48dca8['shift']());}};_0x595683(++_0x59b0c9);}(_0x9431,0xd1));var _0x1943=function(_0x361116,_0x389b79){_0x361116=_0x361116-0x0;var _0x412b65=_0x9431[_0x361116];return _0x412b65;};'use strict';var _=require(_0x1943('0x0'));var util=require(_0x1943('0x1'));var logger=require('../../config/logger')(_0x1943('0x2'));var moment=require(_0x1943('0x3'));var BPromise=require(_0x1943('0x4'));var rp=require(_0x1943('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1943('0x6'));var attributes=require(_0x1943('0x7'));module['exports']=function(_0x264963,_0x1184d3){return _0x264963[_0x1943('0x8')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa912=['exports','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xa912,0x86));var _0x2a91=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xa912[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0x2a91('0x0'));var util=require(_0x2a91('0x1'));var logger=require(_0x2a91('0x2'))(_0x2a91('0x3'));var moment=require(_0x2a91('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a91('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a91('0x6'));var config=require(_0x2a91('0x7'));var attributes=require(_0x2a91('0x8'));module[_0x2a91('0x9')]=function(_0x51cd5e,_0x41c312){return _0x51cd5e['define']('UserOpenchannelQueue',attributes,{'tableName':_0x2a91('0xa'),'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 0d5137e..9cd0b9d 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 _0x723e=['debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x54e9a4,_0xe64888){var _0x55decf=function(_0x729265){while(--_0x729265){_0x54e9a4['push'](_0x54e9a4['shift']());}};_0x55decf(++_0xe64888);}(_0x723e,0xf7));var _0xe723=function(_0x4a4ff6,_0x2b0de3){_0x4a4ff6=_0x4a4ff6-0x0;var _0x55e8de=_0x723e[_0x4a4ff6];return _0x55e8de;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var moment=require(_0xe723('0x1'));var BPromise=require(_0xe723('0x2'));var rs=require(_0xe723('0x3'));var fs=require('fs');var Redis=require(_0xe723('0x4'));var db=require(_0xe723('0x5'))['db'];var utils=require(_0xe723('0x6'));var logger=require('../../config/logger')(_0xe723('0x7'));var config=require(_0xe723('0x8'));var jayson=require(_0xe723('0x9'));var client=jayson[_0xe723('0xa')][_0xe723('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2005d8,_0xd3e33a,_0x1ef316){return new BPromise(function(_0x4c2560,_0x176988){return client[_0xe723('0xc')](_0x2005d8,_0x1ef316)[_0xe723('0xd')](function(_0x10bd1e){logger[_0xe723('0xe')](_0xe723('0xf'),_0xd3e33a,_0xe723('0x10'));logger[_0xe723('0x11')](_0xe723('0x12'),_0xd3e33a,_0xe723('0x10'),JSON[_0xe723('0x13')](_0x10bd1e));if(_0x10bd1e['error']){if(_0x10bd1e[_0xe723('0x14')][_0xe723('0x15')]===0x1f4){logger[_0xe723('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0xd3e33a,_0x10bd1e[_0xe723('0x14')][_0xe723('0x16')]);return _0x176988(_0x10bd1e[_0xe723('0x14')][_0xe723('0x16')]);}logger[_0xe723('0x14')](_0xe723('0xf'),_0xd3e33a,_0x10bd1e[_0xe723('0x14')][_0xe723('0x16')]);return _0x4c2560(_0x10bd1e[_0xe723('0x14')][_0xe723('0x16')]);}else{logger[_0xe723('0xe')](_0xe723('0xf'),_0xd3e33a,'request\x20sent');_0x4c2560(_0x10bd1e['result']['message']);}})[_0xe723('0x17')](function(_0x1d9bc2){logger['error'](_0xe723('0xf'),_0xd3e33a,_0x1d9bc2);_0x176988(_0x1d9bc2);});});} \ No newline at end of file +var _0x3fab=['request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x3fab,0x1bd));var _0xb3fa=function(_0x3229ca,_0x22cc12){_0x3229ca=_0x3229ca-0x0;var _0x27bf27=_0x3fab[_0x3229ca];return _0x27bf27;};'use strict';var _=require(_0xb3fa('0x0'));var util=require(_0xb3fa('0x1'));var moment=require(_0xb3fa('0x2'));var BPromise=require(_0xb3fa('0x3'));var rs=require(_0xb3fa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb3fa('0x6'))(_0xb3fa('0x7'));var config=require(_0xb3fa('0x8'));var jayson=require(_0xb3fa('0x9'));var client=jayson[_0xb3fa('0xa')][_0xb3fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x171c75,_0x2bb627,_0x4da091){return new BPromise(function(_0x4b7970,_0x2a12d4){return client['request'](_0x171c75,_0x4da091)[_0xb3fa('0xc')](function(_0x2bbcfb){logger[_0xb3fa('0xd')](_0xb3fa('0xe'),_0x2bb627,_0xb3fa('0xf'));logger[_0xb3fa('0x10')](_0xb3fa('0x11'),_0x2bb627,'request\x20sent',JSON['stringify'](_0x2bbcfb));if(_0x2bbcfb[_0xb3fa('0x12')]){if(_0x2bbcfb[_0xb3fa('0x12')][_0xb3fa('0x13')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x2bb627,_0x2bbcfb[_0xb3fa('0x12')][_0xb3fa('0x14')]);return _0x2a12d4(_0x2bbcfb[_0xb3fa('0x12')][_0xb3fa('0x14')]);}logger[_0xb3fa('0x12')](_0xb3fa('0xe'),_0x2bb627,_0x2bbcfb[_0xb3fa('0x12')][_0xb3fa('0x14')]);return _0x4b7970(_0x2bbcfb[_0xb3fa('0x12')][_0xb3fa('0x14')]);}else{logger[_0xb3fa('0xd')](_0xb3fa('0xe'),_0x2bb627,'request\x20sent');_0x4b7970(_0x2bbcfb[_0xb3fa('0x15')][_0xb3fa('0x14')]);}})[_0xb3fa('0x16')](function(_0x1e30d){logger['error'](_0xb3fa('0xe'),_0x2bb627,_0x1e30d);_0x2a12d4(_0x1e30d);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e653f19..dbc77b8 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 _0x7a54=['./userProfile.controller','get','index','/describe','isAuthenticated','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections','/:id/resources','put','/:id','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x4c6c3f,_0x45b36e){_0x4c6c3f=_0x4c6c3f-0x0;var _0x35fa1c=_0x7a54[_0x4c6c3f];return _0x35fa1c;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/resources',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x10')](_0x47a5('0x12'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x10')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x14')]);router[_0x47a5('0x10')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['addResources']);router[_0x47a5('0x16')](_0x47a5('0x17'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x18')]);router[_0x47a5('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0x1a')]);router['delete']('/:id/sections',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x19')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);module[_0x47a5('0x1d')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','show','/:id/sections','getSections','getResources','create','post','/:id/clone','clone','addSections','/:id/resources','addResources','put','/:id','delete','destroy','removeSections','multer','util','path'];(function(_0xea860f,_0x4e877e){var _0x4ab3e7=function(_0x184a4d){while(--_0x184a4d){_0xea860f['push'](_0xea860f['shift']());}};_0x4ab3e7(++_0x4e877e);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/resources',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['post']('/',auth[_0x7995('0xa')](),controller[_0x7995('0x12')]);router[_0x7995('0x13')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x13')]('/:id/sections',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x13')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0x1a'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1b')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1c')]);router[_0x7995('0x1b')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/resources',auth[_0x7995('0xa')](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 0a1bd69..5ff9d68 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 _0xe260=['sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x2c28a2,_0x585c92){var _0x2407e0=function(_0x3e01ff){while(--_0x3e01ff){_0x2c28a2['push'](_0x2c28a2['shift']());}};_0x2407e0(++_0x585c92);}(_0xe260,0xb0));var _0x0e26=function(_0x38f791,_0x300012){_0x38f791=_0x38f791-0x0;var _0x4707ea=_0xe260[_0x38f791];return _0x4707ea;};'use strict';var Sequelize=require(_0x0e26('0x0'));module[_0x0e26('0x1')]={'name':{'type':Sequelize[_0x0e26('0x2')],'allowNull':![],'unique':_0x0e26('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x332d6e){this[_0x0e26('0x4')](_0x0e26('0x5'),_0x332d6e?_0x332d6e[_0x0e26('0x6')](''):[]);},'get':function(){return this[_0x0e26('0x7')](_0x0e26('0x5'))?this[_0x0e26('0x7')](_0x0e26('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0e26('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x767b=['sequelize','exports','STRING','name','join','crudPermissions','getDataValue','split'];(function(_0x40a609,_0x25e7b1){var _0x5ee8f4=function(_0x26d778){while(--_0x26d778){_0x40a609['push'](_0x40a609['shift']());}};_0x5ee8f4(++_0x25e7b1);}(_0x767b,0xd0));var _0xb767=function(_0x7917d5,_0x17feed){_0x7917d5=_0x7917d5-0x0;var _0xebfe51=_0x767b[_0x7917d5];return _0xebfe51;};'use strict';var Sequelize=require(_0xb767('0x0'));module[_0xb767('0x1')]={'name':{'type':Sequelize[_0xb767('0x2')],'allowNull':![],'unique':_0xb767('0x3')},'crudPermissions':{'type':Sequelize[_0xb767('0x2')],'set':function(_0x31b425){this['setDataValue']('crudPermissions',_0x31b425?_0x31b425[_0xb767('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xb767('0x5'))?this[_0xb767('0x6')](_0xb767('0x5'))[_0xb767('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb767('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 7a661dc..b406d15 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 _0x83d2=['updatedAt','crudPermissions','createdAt','sequelize','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','Resources','destroy','describe','addSections','push','getSections','includes','isEmpty','subsections','enabled','Dashboard','forEach','resourceId','Plugin','userProfileId','bulkCreate','removeResources','getResources','section','undefined','Sequelize','Unknown\x20section','mergeResources','childModel','ValidationError','Invalid\x20section\x20\x27','parentSections','findOne','all','ignore','field','AnalyticExtractedReport','associatedResources','foreignKey','reportType','default','reportId','DefaultReports','CustomReports','rows','CmContact','Tag','ThroughTags','color','tag','value','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','contacts','Lists','ListId','CmList','companies','globalcustomfields','chatqueues','ChatQueue','chatwebsites','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','whatsappaccounts','users','agents','telephones','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','triggers','trunks','variables','Variable','plugins','Reports','metrics','AnalyticMetric','WhatsappAccount','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','error','stack','name','send','map','UserProfile','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','catch','show','params','rawAttributes','intersection','include','find','create','body','includeAll','get','omit'];(function(_0x523398,_0x19cc81){var _0x3f4002=function(_0x30ffa4){while(--_0x30ffa4){_0x523398['push'](_0x523398['shift']());}};_0x3f4002(++_0x19cc81);}(_0x83d2,0x98));var _0x283d=function(_0x15684a,_0x533afe){_0x15684a=_0x15684a-0x0;var _0x2ce52e=_0x83d2[_0x15684a];return _0x2ce52e;};'use strict';var pdf=require(_0x283d('0x0'));var emlformat=require(_0x283d('0x1'));var rimraf=require(_0x283d('0x2'));var zipdir=require(_0x283d('0x3'));var jsonpatch=require(_0x283d('0x4'));var rp=require(_0x283d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x283d('0x6'));var sox=require(_0x283d('0x7'));var csv=require(_0x283d('0x8'));var ejs=require(_0x283d('0x9'));var fs=require('fs');var fs_extra=require(_0x283d('0xa'));var _=require(_0x283d('0xb'));var squel=require(_0x283d('0xc'));var crypto=require(_0x283d('0xd'));var jsforce=require(_0x283d('0xe'));var deskjs=require(_0x283d('0xf'));var toCsv=require(_0x283d('0x8'));var querystring=require(_0x283d('0x10'));var Papa=require(_0x283d('0x11'));var Redis=require(_0x283d('0x12'));var authService=require(_0x283d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x283d('0x14'));var utils=require(_0x283d('0x15'));var config=require(_0x283d('0x16'));var licenseUtil=require(_0x283d('0x17'));var db=require('../../mysqldb')['db'];config[_0x283d('0x18')]=_[_0x283d('0x19')](config[_0x283d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x283d('0x1a'))(new Redis(config[_0x283d('0x18')]));require(_0x283d('0x1b'))[_0x283d('0x1c')](socket);function respondWithStatusCode(_0x555ef6,_0x3b530d){_0x3b530d=_0x3b530d||0xcc;return function(_0x4556df){if(_0x4556df){return _0x555ef6[_0x283d('0x1d')](_0x3b530d);}return _0x555ef6[_0x283d('0x1e')](_0x3b530d)[_0x283d('0x1f')]();};}function respondWithResult(_0x5d2d9b,_0x2204a6){_0x2204a6=_0x2204a6||0xc8;return function(_0xfe9099){if(_0xfe9099){return _0x5d2d9b['status'](_0x2204a6)['json'](_0xfe9099);}};}function respondWithFilteredResult(_0x4ba757,_0x1e3174){return function(_0x55d0ca){if(_0x55d0ca){var _0xc88300=_0x55d0ca[_0x283d('0x20')],_0x1ab1a4=_0x1e3174[_0x283d('0x21')],_0x5c208e=_0x1e3174[_0x283d('0x21')]+_0x1e3174[_0x283d('0x22')],_0x5e0549;if(_0x5c208e>=_0xc88300){_0x5c208e=_0xc88300;_0x5e0549=0xc8;}else{_0x5e0549=0xce;}_0x4ba757[_0x283d('0x1e')](_0x5e0549);return _0x4ba757[_0x283d('0x23')]('Content-Range',_0x1ab1a4+'-'+_0x5c208e+'/'+_0xc88300)[_0x283d('0x24')](_0x55d0ca);}return null;};}function patchUpdates(_0x454b84){return function(_0x17b83f){try{jsonpatch[_0x283d('0x25')](_0x17b83f,_0x454b84,!![]);}catch(_0x58f9c0){return BPromise[_0x283d('0x26')](_0x58f9c0);}return _0x17b83f['save']();};}function saveUpdates(_0x2bb061,_0x360d46){return function(_0x712bc){if(_0x712bc){return _0x712bc[_0x283d('0x27')](_0x2bb061)[_0x283d('0x28')](function(_0x2da493){return _0x2da493;});}return null;};}function removeEntity(_0x132e3,_0x547e61){return function(_0x1e6ef2){if(_0x1e6ef2){return _0x1e6ef2['destroy']()[_0x283d('0x28')](function(){_0x132e3[_0x283d('0x1e')](0xcc)[_0x283d('0x1f')]();});}};}function handleEntityNotFound(_0x3bbe6f,_0x225ca3){return function(_0x2980d6){if(!_0x2980d6){_0x3bbe6f[_0x283d('0x1d')](0x194);}return _0x2980d6;};}function handleError(_0x68b400,_0x912b71){_0x912b71=_0x912b71||0x1f4;return function(_0x49259a){logger[_0x283d('0x29')](_0x49259a[_0x283d('0x2a')]);if(_0x49259a[_0x283d('0x2b')]){delete _0x49259a['name'];}_0x68b400[_0x283d('0x1e')](_0x912b71)[_0x283d('0x2c')](_0x49259a);};}exports['index']=function(_0x384f5a,_0x4daa18){var _0x712c97={},_0x551374={},_0x3b155f={'count':0x0,'rows':[]};var _0x158536=_[_0x283d('0x2d')](db[_0x283d('0x2e')]['rawAttributes'],function(_0x215869){return{'name':_0x215869[_0x283d('0x2f')],'type':_0x215869[_0x283d('0x30')]['key']};});_0x551374[_0x283d('0x31')]=_[_0x283d('0x2d')](_0x158536,_0x283d('0x2b'));_0x551374[_0x283d('0x32')]=_[_0x283d('0x33')](_0x384f5a[_0x283d('0x32')]);_0x551374[_0x283d('0x34')]=_['intersection'](_0x551374[_0x283d('0x31')],_0x551374[_0x283d('0x32')]);_0x712c97[_0x283d('0x35')]=_['intersection'](_0x551374[_0x283d('0x31')],qs['fields'](_0x384f5a[_0x283d('0x32')][_0x283d('0x36')]));_0x712c97[_0x283d('0x35')]=_0x712c97[_0x283d('0x35')][_0x283d('0x37')]?_0x712c97[_0x283d('0x35')]:_0x551374[_0x283d('0x31')];if(!_0x384f5a[_0x283d('0x32')][_0x283d('0x38')](_0x283d('0x39'))){_0x712c97[_0x283d('0x22')]=qs['limit'](_0x384f5a[_0x283d('0x32')][_0x283d('0x22')]);_0x712c97['offset']=qs['offset'](_0x384f5a[_0x283d('0x32')]['offset']);}_0x712c97[_0x283d('0x3a')]=qs[_0x283d('0x3b')](_0x384f5a[_0x283d('0x32')][_0x283d('0x3b')]);_0x712c97['where']=qs['filters'](_[_0x283d('0x3c')](_0x384f5a['query'],_0x551374[_0x283d('0x34')]),_0x158536);if(_0x384f5a[_0x283d('0x32')][_0x283d('0x3d')]){_0x712c97['where']=_[_0x283d('0x3e')](_0x712c97['where'],{'$or':_[_0x283d('0x2d')](_0x158536,function(_0x1b72d2){if(_0x1b72d2[_0x283d('0x30')]!==_0x283d('0x3f')){var _0x1228b6={};_0x1228b6[_0x1b72d2['name']]={'$like':'%'+_0x384f5a[_0x283d('0x32')]['filter']+'%'};return _0x1228b6;}})});}_0x712c97=_['merge']({},_0x712c97,_0x384f5a[_0x283d('0x40')]);var _0x1fa767={'where':_0x712c97[_0x283d('0x41')]};return db[_0x283d('0x2e')][_0x283d('0x20')](_0x1fa767)['then'](function(_0x5ecd11){_0x3b155f['count']=_0x5ecd11;if(_0x384f5a['query']['includeAll']){_0x712c97['include']=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x712c97);})[_0x283d('0x28')](function(_0x99edd8){_0x3b155f['rows']=_0x99edd8;return _0x3b155f;})[_0x283d('0x28')](respondWithFilteredResult(_0x4daa18,_0x712c97))[_0x283d('0x42')](handleError(_0x4daa18,null));};exports[_0x283d('0x43')]=function(_0x2af141,_0x2e29a2){var _0x44cb31={'raw':![],'where':{'id':_0x2af141[_0x283d('0x44')]['id']}},_0x2a6722={};_0x2a6722['model']=_[_0x283d('0x33')](db[_0x283d('0x2e')][_0x283d('0x45')]);_0x2a6722['query']=_['keys'](_0x2af141[_0x283d('0x32')]);_0x2a6722['filters']=_[_0x283d('0x46')](_0x2a6722[_0x283d('0x31')],_0x2a6722[_0x283d('0x32')]);_0x44cb31['attributes']=_[_0x283d('0x46')](_0x2a6722[_0x283d('0x31')],qs[_0x283d('0x36')](_0x2af141[_0x283d('0x32')][_0x283d('0x36')]));_0x44cb31[_0x283d('0x35')]=_0x44cb31['attributes'][_0x283d('0x37')]?_0x44cb31[_0x283d('0x35')]:_0x2a6722['model'];if(_0x2af141[_0x283d('0x32')]['includeAll']){_0x44cb31[_0x283d('0x47')]=[{'all':!![]}];}_0x44cb31=_[_0x283d('0x3e')]({},_0x44cb31,_0x2af141[_0x283d('0x40')]);return db[_0x283d('0x2e')][_0x283d('0x48')](_0x44cb31)[_0x283d('0x28')](handleEntityNotFound(_0x2e29a2,null))[_0x283d('0x28')](respondWithResult(_0x2e29a2,null))[_0x283d('0x42')](handleError(_0x2e29a2,null));};exports[_0x283d('0x49')]=function(_0x3d177a,_0xd017e5){return db['UserProfile']['create'](_0x3d177a[_0x283d('0x4a')],{})['then'](respondWithResult(_0xd017e5,0xc9))[_0x283d('0x42')](handleError(_0xd017e5,null));};exports['clone']=function(_0x5961b2,_0x231897){var _0x6ba0a5={'where':{'id':_0x5961b2[_0x283d('0x44')]['id']}},_0x1b847a={};_0x1b847a['model']=_[_0x283d('0x33')](db[_0x283d('0x2e')][_0x283d('0x45')]);_0x6ba0a5[_0x283d('0x35')]=_['intersection'](_0x1b847a[_0x283d('0x31')],qs['fields'](_0x5961b2[_0x283d('0x32')][_0x283d('0x36')]));_0x6ba0a5[_0x283d('0x35')]=_0x6ba0a5[_0x283d('0x35')]['length']?_0x6ba0a5[_0x283d('0x35')]:_0x1b847a['model'];if(_0x5961b2['query'][_0x283d('0x4b')]){_0x6ba0a5[_0x283d('0x47')]=[{'all':!![]}];}_0x6ba0a5=_[_0x283d('0x3e')]({},_0x6ba0a5,_0x5961b2[_0x283d('0x40')]);return db[_0x283d('0x2e')][_0x283d('0x48')](_0x6ba0a5)[_0x283d('0x28')](handleEntityNotFound(_0x231897,null))[_0x283d('0x28')](function(_0xec0efe){if(_0xec0efe){var _0x23ab26=_0xec0efe[_0x283d('0x4c')]({'plain':!![]});_0x23ab26=qs[_0x283d('0x4d')](_0x23ab26,['id','createdAt',_0x283d('0x4e'),_0x283d('0x4f')]);_0x5961b2[_0x283d('0x4a')]=_[_0x283d('0x4d')](_0x5961b2['body'],['id',_0x283d('0x50'),_0x283d('0x4e')]);return db[_0x283d('0x51')]['transaction'](function(_0x35d41d){return db[_0x283d('0x2e')][_0x283d('0x49')](_[_0x283d('0x3e')](_0x23ab26,_0x5961b2[_0x283d('0x4a')]),{'include':_0x5961b2[_0x283d('0x32')][_0x283d('0x4b')]?[{'all':!![]}]:undefined,'transaction':_0x35d41d})['then'](function(_0x1a3219){var _0x40401e=_0x1a3219[_0x283d('0x4c')]({'plain':!![]});return db[_0x283d('0x52')][_0x283d('0x53')]({'where':{'userProfileId':_0x5961b2[_0x283d('0x44')]['id']},'raw':!![]})[_0x283d('0x28')](function(_0x521794){if(_0x521794){return BPromise[_0x283d('0x54')](_0x521794,function(_0x2cc6ab){return new BPromise(function(_0x107bc6,_0x3e84bc){if(_0x2cc6ab[_0x283d('0x55')]===null||_0x2cc6ab[_0x283d('0x55')]===0x1)_0x107bc6(null);return db[_0x283d('0x56')]['findAll']({'where':{'sectionId':_0x2cc6ab['id']},'raw':!![]})[_0x283d('0x28')](function(_0x9a3a34){var _0x5e4f9e=_[_0x283d('0x2d')](_0x9a3a34,function(_0x38ed37){return qs[_0x283d('0x4d')](_0x38ed37,['id',_0x283d('0x50'),'updatedAt',_0x283d('0x57')]);});_0x107bc6(_0x5e4f9e);})[_0x283d('0x42')](function(_0x388bba){_0x3e84bc(_0x388bba);});})[_0x283d('0x28')](function(_0x6f3fe7){var _0x267f9b=qs['omit'](_0x2cc6ab,['id',_0x283d('0x50'),_0x283d('0x4e')]);_0x267f9b['userProfileId']=_0x40401e['id'];if(_0x6f3fe7)_0x267f9b[_0x283d('0x58')]=_0x6f3fe7;return _0x267f9b;})['then'](function(_0x33c84e){return db[_0x283d('0x52')][_0x283d('0x49')](_0x33c84e,{'include':[{'model':db[_0x283d('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x35d41d});});})[_0x283d('0x28')](function(){return _0x40401e;});}});});});}})['then'](respondWithResult(_0x231897,0xc9))[_0x283d('0x42')](handleError(_0x231897,null));};exports[_0x283d('0x27')]=function(_0x43ba2a,_0x4937f1){if(_0x43ba2a[_0x283d('0x4a')]['id']){delete _0x43ba2a['body']['id'];}return db[_0x283d('0x2e')][_0x283d('0x48')]({'where':{'id':_0x43ba2a[_0x283d('0x44')]['id']}})[_0x283d('0x28')](handleEntityNotFound(_0x4937f1,null))[_0x283d('0x28')](saveUpdates(_0x43ba2a['body'],null))['then'](respondWithResult(_0x4937f1,null))['catch'](handleError(_0x4937f1,null));};exports[_0x283d('0x59')]=function(_0x181aab,_0x3ddbc9){return db[_0x283d('0x2e')][_0x283d('0x48')]({'where':{'id':_0x181aab[_0x283d('0x44')]['id']}})['then'](handleEntityNotFound(_0x3ddbc9,null))[_0x283d('0x28')](removeEntity(_0x3ddbc9,null))[_0x283d('0x42')](handleError(_0x3ddbc9,null));};exports['describe']=function(_0x118152,_0x50a83e){return db[_0x283d('0x2e')][_0x283d('0x5a')]()[_0x283d('0x28')](respondWithResult(_0x50a83e,null))[_0x283d('0x42')](handleError(_0x50a83e,null));};exports[_0x283d('0x5b')]=function(_0x3879e9,_0x267650){var _0x46a765=_0x3879e9[_0x283d('0x4a')];return db[_0x283d('0x2e')][_0x283d('0x48')]({'where':{'id':_0x3879e9[_0x283d('0x44')]['id']}})['then'](handleEntityNotFound(_0x267650,null))[_0x283d('0x28')](function(_0x298184){if(_0x298184){return db[_0x283d('0x51')]['transaction'](function(_0x4147dc){return db['UserProfileSection'][_0x283d('0x59')]({'where':{'userProfileId':_0x3879e9[_0x283d('0x44')]['id'],'sectionId':_[_0x283d('0x2d')](_0x46a765,function(_0x45e8b7){return _0x45e8b7[_0x283d('0x57')];})},'transaction':_0x4147dc})[_0x283d('0x28')](function(){var _0x2fc652=_[_0x283d('0x2d')](_0x46a765,function(_0x179d66){_0x179d66['userProfileId']=_0x3879e9[_0x283d('0x44')]['id'];return _0x179d66;});var _0x354dc5=[];return BPromise[_0x283d('0x54')](_0x2fc652,function(_0x6c84a3){return db[_0x283d('0x52')]['create'](_0x6c84a3,{'include':[{'model':db[_0x283d('0x56')],'as':_0x283d('0x58')}],'raw':!![],'transaction':_0x4147dc})[_0x283d('0x28')](function(_0x129dea){_0x354dc5[_0x283d('0x5c')](_0x129dea[_0x283d('0x4c')]({'plain':!![]}));});})['then'](function(){return _0x354dc5;});});});}})['then'](function(_0x10b2ec){return _0x10b2ec;})[_0x283d('0x28')](respondWithResult(_0x267650,null))['catch'](handleError(_0x267650,null));};exports['removeSections']=function(_0x186d90,_0x29c005){var _0x2f1647;return db[_0x283d('0x2e')][_0x283d('0x48')]({'where':{'id':_0x186d90[_0x283d('0x44')]['id']},'attributes':['id','name']})[_0x283d('0x28')](handleEntityNotFound(_0x29c005,null))[_0x283d('0x28')](function(_0x5d393d){if(_0x5d393d){_0x2f1647=_0x5d393d;return db[_0x283d('0x52')][_0x283d('0x59')]({'where':{'userProfileId':_0x186d90[_0x283d('0x44')]['id'],'sectionId':_0x186d90[_0x283d('0x32')]['ids']}});}})['then'](function(){return _0x2f1647;})[_0x283d('0x28')](respondWithStatusCode(_0x29c005,null))[_0x283d('0x42')](handleError(_0x29c005,null));};exports[_0x283d('0x5d')]=function(_0x58192b,_0x1e563b){var _0x2987bc=[];var _0x21fb3b=[];return db[_0x283d('0x52')][_0x283d('0x53')]({'where':{'userProfileId':_0x58192b[_0x283d('0x44')]['id']},'raw':!![]})[_0x283d('0x28')](function(_0x14e19e){_0x2987bc=_[_0x283d('0x3d')](_0x14e19e,function(_0x2c84e8){return _0x2c84e8['enabled']===0x1||_[_0x283d('0x5e')]([0x3eb,0x709],_0x2c84e8[_0x283d('0x57')]);});if(!_[_0x283d('0x5f')](_0x2987bc)){return _[_0x283d('0x2d')](_0x2987bc,function(_0x51de93){return _0x51de93[_0x283d('0x57')];});}else{return;}})['then'](function(_0x5d8eec){if(_0x5d8eec)_0x21fb3b=_0x5d8eec;if(_['includes'](_0x21fb3b,0x64)){var _0x400126=_[_0x283d('0x48')](_0x2987bc,{'sectionId':0x64});return hasDefaultDashboard(_0x400126)[_0x283d('0x28')](function(_0x13f08c){return _['map'](_0x2987bc,function(_0x32d08a){if(_0x32d08a[_0x283d('0x57')]===0x64){_0x32d08a[_0x283d('0x60')]=_0x13f08c;}return _0x32d08a;});});}else{return;}})['then'](function(_0x2fa4dd){if(_0x2fa4dd)_0x2987bc=_0x2fa4dd;if(_[_0x283d('0x5e')](_0x21fb3b,0x3eb)){var _0x149f09=_[_0x283d('0x48')](_0x2987bc,{'sectionId':0x3eb});return getCustomDashboards(_0x149f09)[_0x283d('0x28')](function(_0x485204){return _[_0x283d('0x2d')](_0x2987bc,function(_0x32bd43){if(_0x149f09[_0x283d('0x61')]){if(_0x32bd43[_0x283d('0x57')]===0x3eb){_0x32bd43[_0x283d('0x60')]=_0x485204;}}else{if(_0x32bd43['sectionId']===0x64){_0x32bd43[_0x283d('0x60')]=_0x485204;}}return _0x32bd43;});});}else{return;}})[_0x283d('0x28')](function(_0x393778){if(_0x393778)_0x2987bc=_0x393778;if(_['includes'](_0x21fb3b,0x709)){var _0x2fcca4=_[_0x283d('0x48')](_0x2987bc,{'sectionId':0x709});return getPlugins(_0x2fcca4)[_0x283d('0x28')](function(_0x23b682){if(_0x2fcca4[_0x283d('0x61')]){return _['map'](_0x2987bc,function(_0x51ee27){if(_0x51ee27[_0x283d('0x57')]===0x709){_0x51ee27[_0x283d('0x60')]=_0x23b682;}return _0x51ee27;});}else{var _0x156230={'sectionId':0x76c,'enabled':0x1,'subsections':_0x23b682};var _0x26725a=_[_0x283d('0x2d')](_0x2987bc);_0x26725a[_0x283d('0x5c')](_0x156230);return _0x26725a;}});}else{return;}})[_0x283d('0x28')](function(_0x183e1d){if(_0x183e1d)_0x2987bc=_0x183e1d;return _[_0x283d('0x3d')](_0x2987bc,[_0x283d('0x61'),0x1]);})['then'](respondWithResult(_0x1e563b,null))[_0x283d('0x42')](handleError(_0x1e563b,null));};function hasDefaultDashboard(_0x27320f){var _0x57135e=[0x65];return new BPromise(function(_0x2879ab,_0x468f64){try{if(_0x27320f[_0x283d('0x55')]){_0x2879ab(_0x57135e);}else{return db[_0x283d('0x56')]['findOne']({'where':{'sectionId':_0x27320f['id']},'raw':!![]})[_0x283d('0x28')](function(_0xbadf96){_0xbadf96?_0x2879ab(_0x57135e):_0x2879ab();});}}catch(_0x3ea29d){_0x468f64(_0x3ea29d);}});}function getCustomDashboards(_0x5a72f6){var _0x2f14fe=[];return new BPromise(function(_0x28a59d,_0x56bd05){try{if(_0x5a72f6[_0x283d('0x55')]){return db[_0x283d('0x62')][_0x283d('0x53')]({'raw':!![]})[_0x283d('0x28')](function(_0x258e54){_0x258e54[_0x283d('0x63')](function(_0x5843e7){_0x2f14fe['push'](_0x5843e7['id']+0x1869f);});_0x28a59d(_0x2f14fe);});}else{return db['UserProfileResource'][_0x283d('0x53')]({'where':{'sectionId':_0x5a72f6['id']},'raw':!![]})[_0x283d('0x28')](function(_0x8e4e83){_0x8e4e83['forEach'](function(_0x28b6a9){_0x2f14fe[_0x283d('0x5c')](_0x28b6a9[_0x283d('0x64')]+0x1869f);});_0x28a59d(_0x2f14fe);});}}catch(_0x397e8f){_0x56bd05(_0x397e8f);}});}function getPlugins(_0x13a542){var _0x5cef5d=[];return new BPromise(function(_0x397c20,_0xf9ff4c){try{if(_0x13a542[_0x283d('0x55')]){return db[_0x283d('0x65')][_0x283d('0x53')]({'raw':!![]})[_0x283d('0x28')](function(_0x24bfa3){_0x24bfa3['forEach'](function(_0x5bc106){_0x5cef5d[_0x283d('0x5c')](_0x5bc106['id']+0x15b38);});_0x397c20(_0x5cef5d);});}else{return db[_0x283d('0x56')][_0x283d('0x53')]({'where':{'sectionId':_0x13a542['id']},'raw':!![]})[_0x283d('0x28')](function(_0x4249f5){_0x4249f5[_0x283d('0x63')](function(_0x226fbd){_0x5cef5d[_0x283d('0x5c')](_0x226fbd['resourceId']+0x15b38);});_0x397c20(_0x5cef5d);});}}catch(_0x57a4e2){_0xf9ff4c(_0x57a4e2);}});}exports['addResources']=function(_0x472d16,_0x4ff05d){return db[_0x283d('0x2e')][_0x283d('0x48')]({'where':{'id':_0x472d16[_0x283d('0x44')]['id']}})[_0x283d('0x28')](handleEntityNotFound(_0x4ff05d,null))[_0x283d('0x28')](function(_0x162bdc){if(_0x162bdc){return db[_0x283d('0x51')]['transaction'](function(_0x286dac){return db['UserProfileSection'][_0x283d('0x53')]({'where':{'userProfileId':_0x472d16[_0x283d('0x44')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xcf74f9){if(_0xcf74f9){return db[_0x283d('0x52')][_0x283d('0x59')]({'where':{'userProfileId':_0x472d16[_0x283d('0x44')]['id'],'id':_['map'](_0xcf74f9,function(_0x56f338){return _0x56f338['id'];})},'transaction':_0x286dac});}})[_0x283d('0x28')](function(_0x4674f0){var _0x1977ed=_[_0x283d('0x2d')](_0x472d16[_0x283d('0x4a')],function(_0x268076){_0x268076[_0x283d('0x66')]=_0x472d16[_0x283d('0x44')]['id'];return _0x268076;});return db[_0x283d('0x52')][_0x283d('0x67')](_0x1977ed,{'raw':!![],'transaction':_0x286dac});})['then'](function(_0x77878c){var _0x27fb3f=_[_0x283d('0x3d')](_[_0x283d('0x2d')](_0x77878c,function(_0x28de5c){return _0x28de5c[_0x283d('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x27fb3f){return db[_0x283d('0x52')]['findAll']({'where':{'userProfileId':_0x472d16[_0x283d('0x44')]['id'],'sectionId':_[_0x283d('0x2d')](_0x27fb3f,function(_0x17a00e){return _0x17a00e['sectionId'];})},'attributes':['id',_0x283d('0x57')],'raw':!![]})['then'](function(_0x31f5c1){var _0x39eea7=_[_0x283d('0x2d')](_0x472d16[_0x283d('0x4a')],function(_0x53a2d6){_0x53a2d6['userProfileId']=_0x472d16[_0x283d('0x44')]['id'];return _0x53a2d6;});return db[_0x283d('0x56')][_0x283d('0x67')](_0x39eea7,{'raw':!![],'transaction':_0x286dac});});}})[_0x283d('0x42')](handleError(_0x4ff05d,null));});}})[_0x283d('0x28')](function(_0x540c26){var _0xc9691d=_['map'](_0x540c26,function(_0x982c57){return _0x982c57[_0x283d('0x4c')]({'plain':!![]});});})['then'](respondWithResult(_0x4ff05d,null))[_0x283d('0x42')](handleError(_0x4ff05d,null));};exports[_0x283d('0x68')]=function(_0x56b1d9,_0x339c12,_0x2b22b9){return db['UserProfile']['find']({'where':{'id':_0x56b1d9[_0x283d('0x44')]['id']}})[_0x283d('0x28')](handleEntityNotFound(_0x339c12,null))[_0x283d('0x28')](function(_0x157fc5){if(_0x157fc5){return _0x157fc5['removeResources'](_0x56b1d9['query']['ids']);}})[_0x283d('0x28')](respondWithStatusCode(_0x339c12,null))['catch'](handleError(_0x339c12,null));};exports[_0x283d('0x69')]=function(_0x1f7658,_0x2b370a){var _0x3ae099={'raw':![],'where':{}};var _0x5e1a63={};var _0x405b74={'count':0x0,'rows':[]};var _0x4cdbe0=_0x1f7658[_0x283d('0x32')][_0x283d('0x6a')];if(typeof _0x4cdbe0===_0x283d('0x6b')){throw new db[(_0x283d('0x6c'))]['ValidationError'](_0x283d('0x6d'));}var _0x591618=_0x1f7658[_0x283d('0x32')][_0x283d('0x6e')]||![];var _0x198a22=getQueryModels(_0x4cdbe0,_0x591618);if(typeof _0x198a22[_0x283d('0x6f')]==='undefined'){throw new db[(_0x283d('0x6c'))][(_0x283d('0x70'))](_0x283d('0x71')+_0x4cdbe0+'\x27');}var _0x54f83b=[];if(!_[_0x283d('0x5f')](_0x198a22['parentSections'])){_0x54f83b=_0x198a22[_0x283d('0x72')];}else{_0x54f83b=[{'name':_0x4cdbe0}];}return db['UserProfile'][_0x283d('0x73')]({'where':{'id':_0x1f7658[_0x283d('0x44')]['id']}})[_0x283d('0x28')](handleEntityNotFound(_0x2b370a,null))[_0x283d('0x28')](function(_0x33d092){if(_0x33d092){var _0x1ab28=[];for(var _0x5a5a7a=0x0;_0x5a5a7a<_0x54f83b[_0x283d('0x37')];_0x5a5a7a++){_0x1ab28[_0x283d('0x5c')](db[_0x283d('0x52')]['findOne']({'where':{'userProfileId':_0x33d092['id'],'name':_0x54f83b[_0x5a5a7a][_0x283d('0x2b')]},'raw':!![]}));}return BPromise[_0x283d('0x74')](_0x1ab28);}})['then'](function(_0x1dc004){var _0x19f66d=_[_0x283d('0x3d')](_0x1dc004,function(_0x23de38){return _0x23de38?_0x23de38:undefined;});var _0x37d86a=_['filter'](_0x54f83b,[_0x283d('0x75'),!![]]);var _0x3f7fa8=_[_0x283d('0x5f')](_0x19f66d)&&_[_0x283d('0x5f')](_0x37d86a)?null:_['union'](_0x37d86a,_0x19f66d);if(_0x3f7fa8){var _0xdecc8=[];for(var _0x47b56c=0x0;_0x47b56c<_0x3f7fa8[_0x283d('0x37')];_0x47b56c++){var _0x1802bf=_[_0x283d('0x48')](_0x54f83b,function(_0x47eae2){return _0x3f7fa8[_0x47b56c]?_0x47eae2[_0x283d('0x2b')]===_0x3f7fa8[_0x47b56c][_0x283d('0x2b')]:null;});if(_0x1802bf){if(_0x3f7fa8[_0x47b56c][_0x283d('0x75')]){_0xdecc8[_0x283d('0x5c')](getAllResources(_0x198a22[_0x283d('0x6f')],_0x3f7fa8[_0x47b56c]));}else{if(!_0x3f7fa8[_0x47b56c][_0x283d('0x55')]){_0xdecc8[_0x283d('0x5c')](getAllowedResources(_0x1802bf,_0x3f7fa8[_0x47b56c],_0x198a22[_0x283d('0x6f')]));}else{if(_0x1802bf[_0x283d('0x31')]){_0xdecc8[_0x283d('0x5c')](getAllFilteredResources(_0x1802bf,_0x3f7fa8[_0x47b56c]));}}}}}return BPromise[_0x283d('0x74')](_0xdecc8);}else{return null;}})[_0x283d('0x28')](function(_0x12109a){var _0x37a0da=_0x12109a;var _0x3f9ffa=null;if(_0x37a0da){_0x3f9ffa=_0x37a0da['length']===0x1?_0x37a0da[0x0]:null;}if(_0x3f9ffa||_0x37a0da){var _0xe2dc76=db[_0x198a22[_0x283d('0x6f')]][_0x283d('0x45')];_0x5e1a63[_0x283d('0x31')]=_[_0x283d('0x33')](_0xe2dc76);_0x5e1a63['query']=_[_0x283d('0x33')](_0x1f7658[_0x283d('0x32')]);_0x5e1a63['filters']=_[_0x283d('0x46')](_0x5e1a63[_0x283d('0x31')],_0x5e1a63[_0x283d('0x32')]);_0x3ae099[_0x283d('0x35')]=_[_0x283d('0x46')](_0x5e1a63['model'],qs[_0x283d('0x36')](_0x1f7658[_0x283d('0x32')][_0x283d('0x36')]));_0x3ae099[_0x283d('0x35')]=_0x3ae099[_0x283d('0x35')][_0x283d('0x37')]?_0x3ae099[_0x283d('0x35')]:_0x5e1a63['model'];if(!_0x1f7658[_0x283d('0x32')][_0x283d('0x38')](_0x283d('0x39'))){_0x3ae099[_0x283d('0x22')]=qs[_0x283d('0x22')](_0x1f7658[_0x283d('0x32')][_0x283d('0x22')]);_0x3ae099['offset']=qs[_0x283d('0x21')](_0x1f7658[_0x283d('0x32')][_0x283d('0x21')]);}_0x3ae099[_0x283d('0x3a')]=qs['sort'](_0x1f7658[_0x283d('0x32')]['sort']);_0x3ae099[_0x283d('0x41')]=qs[_0x283d('0x34')](_[_0x283d('0x3c')](_0x1f7658[_0x283d('0x32')],_0x5e1a63[_0x283d('0x34')]));if(_0x1f7658['query'][_0x283d('0x3d')]){_0x3ae099[_0x283d('0x41')]=_[_0x283d('0x3e')](_0x3ae099[_0x283d('0x41')],{'$or':_['map'](_0xe2dc76,function(_0x431a02){if(_0x431a02['type']['key']!==_0x283d('0x3f')){var _0x1c0e68={};_0x1c0e68[_0x431a02['field']]={'$like':'%'+_0x1f7658[_0x283d('0x32')]['filter']+'%'};return _0x1c0e68;}})});}var _0x4c294a=[];if(_0x3f9ffa){var _0x387b1f=_[_0x283d('0x48')](_0x54f83b,[_0x283d('0x2b'),_0x3f9ffa[_0x283d('0x2b')]]);if(_0x387b1f[_0x283d('0x76')]){var _0x1edc85={};if(_0x198a22['childModel']===_0x283d('0x77')){_0x1edc85[_0x387b1f['foreignKey']]=_[_0x283d('0x2d')](_0x3f9ffa[_0x283d('0x78')],'id');}else{_0x1edc85[_0x387b1f[_0x283d('0x79')]]=_0x3f9ffa[_0x283d('0x78')];}_0x4c294a['push'](_0x1edc85);}else{_0x3ae099['where']['id']=_0x3f9ffa[_0x283d('0x78')];}}else{for(var _0x2fa44f=0x0;_0x2fa44f<_0x37a0da[_0x283d('0x37')];_0x2fa44f++){var _0x387b1f=_[_0x283d('0x48')](_0x54f83b,['name',_0x37a0da[_0x2fa44f][_0x283d('0x2b')]]);if(_0x387b1f[_0x283d('0x76')]){var _0x1edc85={};_0x1edc85[_0x387b1f['foreignKey']]=_0x37a0da[_0x2fa44f]['associatedResources'];_0x4c294a[_0x283d('0x5c')](_0x1edc85);}else{if(!_0x3ae099[_0x283d('0x41')]['id'])_0x3ae099['where']['id']=[];_0x37a0da[_0x2fa44f][_0x283d('0x78')][_0x283d('0x63')](function(_0x1ca919){_0x3ae099['where']['id']['push'](_0x1ca919);});}}}if(!_['isEmpty'](_0x4c294a)){_0x3ae099['where']=_[_0x283d('0x3e')](_0x3ae099[_0x283d('0x41')],{'$and':{'$or':_0x4c294a}});}_0x3ae099=_[_0x283d('0x3e')]({},_0x3ae099,_0x1f7658[_0x283d('0x40')]);if(_0x3f9ffa&&!_0x3f9ffa['autoAssociation']&&_0x198a22['childModel']==='AnalyticExtractedReport'){if(_0x1f7658[_0x283d('0x32')][_0x283d('0x4b')]){_0x3ae099['include']=[{'all':!![]}];}return db[_0x198a22[_0x283d('0x6f')]][_0x283d('0x53')](_0x3ae099)[_0x283d('0x28')](function(_0x47053f){var _0xca5389=[];_0x47053f[_0x283d('0x63')](function(_0x3846de){var _0x5e578d;switch(_0x3846de[_0x283d('0x7a')]){case _0x283d('0x7b'):_0x5e578d=_['find'](_0x3f9ffa['associatedResources'],function(_0x423ca4){return _0x423ca4['id']===_0x3846de[_0x283d('0x7c')]&&_0x423ca4['type']===_0x283d('0x7d');});break;case'custom':_0x5e578d=_[_0x283d('0x48')](_0x3f9ffa[_0x283d('0x78')],function(_0x132f22){return _0x132f22['id']===_0x3846de[_0x283d('0x7c')]&&_0x132f22[_0x283d('0x30')]===_0x283d('0x7e');});break;}if(_0x5e578d)_0xca5389[_0x283d('0x5c')](_0x3846de);});_0x405b74[_0x283d('0x20')]=_0xca5389[_0x283d('0x37')];_0x405b74[_0x283d('0x7f')]=_0xca5389;return _0x405b74;});}else{return db[_0x198a22['childModel']][_0x283d('0x20')]({'where':_0x3ae099[_0x283d('0x41')]})[_0x283d('0x28')](function(_0x22eddb){_0x405b74['count']=_0x22eddb;if(_0x1f7658['query']['includeAll']){if(_0x198a22[_0x283d('0x6f')]===_0x283d('0x80')){_0x3ae099[_0x283d('0x47')]=[{'model':db[_0x283d('0x81')],'as':'Tags','attributes':['id',_0x283d('0x2b'),'color'],'required':_0x1f7658[_0x283d('0x32')]['tag']?!![]:![]},{'model':db[_0x283d('0x81')],'as':_0x283d('0x82'),'attributes':['id',_0x283d('0x2b'),_0x283d('0x83')],'through':_0x1f7658[_0x283d('0x32')][_0x283d('0x84')]?{'attributes':[],'where':{'TagId':_0x1f7658[_0x283d('0x32')]['tag']||undefined}}:{},'required':_0x1f7658[_0x283d('0x32')]['tag']?!![]:![]}];}else{_0x3ae099['include']=[{'all':!![]}];}}return db[_0x198a22[_0x283d('0x6f')]][_0x283d('0x53')](_0x3ae099);})['then'](function(_0x1fd434){_0x405b74[_0x283d('0x7f')]=_0x1fd434;return _0x405b74;});}}else{return _0x405b74;}})[_0x283d('0x28')](respondWithFilteredResult(_0x2b370a,_0x3ae099))['catch'](handleError(_0x2b370a,null));};function getAllResources(_0x22da5b,_0x3e2ebc){return new BPromise(function(_0x7558be,_0x4ba66e){if(_0x3e2ebc){var _0x28d026=_0x3e2ebc['filter']?{[_0x3e2ebc[_0x283d('0x3d')][_0x283d('0x76')]]:_0x3e2ebc['filter'][_0x283d('0x85')]}:undefined;return db[_0x22da5b][_0x283d('0x53')]({'where':_0x28d026,'raw':!![]})[_0x283d('0x28')](function(_0x473d50){_0x3e2ebc[_0x283d('0x78')]=_[_0x283d('0x2d')](_0x473d50,'id');_0x7558be(_0x3e2ebc);})[_0x283d('0x42')](function(_0x4ef55f){_0x4ba66e(_0x4ef55f);});}else{_0x7558be(null);}});}function getAllFilteredResources(_0x4e2950,_0x1fbaf){return new BPromise(function(_0x4f2083,_0x4005b5){var _0x147c61=_0x4e2950[_0x283d('0x3d')]?{[_0x4e2950[_0x283d('0x3d')][_0x283d('0x76')]]:_0x4e2950[_0x283d('0x3d')][_0x283d('0x85')]}:undefined;return db[_0x4e2950[_0x283d('0x31')]][_0x283d('0x53')]({'where':_0x147c61,'raw':!![]})[_0x283d('0x28')](function(_0x188a33){_0x1fbaf[_0x283d('0x78')]=_[_0x283d('0x2d')](_0x188a33,function(_0x37172a){return _0x37172a[_0x283d('0x2b')];});_0x4f2083(_0x1fbaf);})[_0x283d('0x42')](function(_0x455db2){_0x4005b5(_0x455db2);});});}function getAllowedResources(_0x30dc09,_0x47b957,_0x17766b){return new BPromise(function(_0x5dac2c,_0x1a4f4f){if(_0x47b957){return db[_0x283d('0x56')][_0x283d('0x53')]({'where':{'sectionId':_0x47b957['id']},'raw':!![]})[_0x283d('0x28')](function(_0x31baac){if(_0x30dc09[_0x283d('0x76')]&&_0x30dc09[_0x283d('0x76')]!=='id'){_0x47b957[_0x283d('0x78')]=_[_0x283d('0x2d')](_0x31baac,function(_0x36b068){return _0x36b068[_0x30dc09[_0x283d('0x76')]];});}else{if(_0x17766b===_0x283d('0x77')){_0x47b957[_0x283d('0x78')]=_['map'](_0x31baac,function(_0x4a6b5e){return{'id':_0x4a6b5e[_0x283d('0x64')],'type':_0x4a6b5e[_0x283d('0x30')]};});}else{_0x47b957['associatedResources']=_[_0x283d('0x2d')](_0x31baac,function(_0x298e6b){return _0x298e6b[_0x283d('0x64')];});}}_0x5dac2c(_0x47b957);})[_0x283d('0x42')](function(_0x555ca4){_0x1a4f4f(_0x555ca4);});}else{_0x5dac2c(null);}});}function getQueryModels(_0x22be98,_0x3feb44){var _0x46ba12=_0x22be98[_0x283d('0x86')]();var _0x24838={'childModel':undefined,'parentSections':[]};switch(_0x46ba12){case'squareprojects':_0x24838[_0x283d('0x6f')]=_0x283d('0x87');break;case _0x283d('0x88'):_0x24838[_0x283d('0x6f')]=_0x283d('0x89');break;case _0x283d('0x8a'):_0x24838['childModel']=_0x283d('0x8b');_0x24838['parentSections']=[{'name':_0x283d('0x8c'),'field':'name','foreignKey':_0x283d('0x8d')}];break;case _0x283d('0x8e'):_0x24838[_0x283d('0x6f')]='JscriptyProject';break;case _0x283d('0x8f'):_0x24838[_0x283d('0x6f')]=_0x283d('0x80');_0x24838[_0x283d('0x72')]=[{'name':_0x283d('0x90'),'field':'id','foreignKey':_0x283d('0x91')}];break;case'lists':_0x24838['childModel']=_0x283d('0x92');break;case _0x283d('0x93'):_0x24838[_0x283d('0x6f')]='CmCompany';break;case _0x283d('0x94'):_0x24838['childModel']='CmCustomField';break;case _0x283d('0x95'):_0x24838['childModel']=_0x283d('0x96');break;case _0x283d('0x97'):_0x24838[_0x283d('0x6f')]='ChatWebsite';break;case'faxqueues':_0x24838[_0x283d('0x6f')]='FaxQueue';break;case _0x283d('0x98'):_0x24838['childModel']='FaxAccount';break;case _0x283d('0x99'):case _0x283d('0x9a'):case _0x283d('0x9b'):_0x24838['childModel']=_0x283d('0x9c');break;case _0x283d('0x9d'):_0x24838['childModel']=_0x283d('0x9e');break;case'voicemails':_0x24838[_0x283d('0x6f')]=_0x283d('0x9f');break;case _0x283d('0xa0'):_0x24838[_0x283d('0x6f')]=_0x283d('0xa1');_0x24838[_0x283d('0x72')]=[{'name':_0x283d('0xa2'),'field':_0x283d('0x2b'),'foreignKey':_0x283d('0xa3'),'model':_0x283d('0xa4'),'filter':{'field':_0x283d('0xa5'),'value':['agent']}},{'name':_0x283d('0xa6'),'field':_0x283d('0x2b'),'foreignKey':_0x283d('0xa3'),'model':_0x283d('0xa4'),'filter':{'field':_0x283d('0xa5'),'value':[_0x283d('0xa7')]}},{'name':_0x283d('0xa8'),'field':_0x283d('0x2b'),'foreignKey':'queue','model':_0x283d('0xa9'),'filter':{'field':'type','value':[_0x283d('0xaa')]}},{'name':_0x283d('0xab'),'field':_0x283d('0x2b'),'foreignKey':_0x283d('0xac'),'model':_0x283d('0xa9'),'filter':{'field':_0x283d('0x30'),'value':[_0x283d('0xad')]}}];break;case _0x283d('0xae'):_0x24838[_0x283d('0x6f')]='VoiceMusicOnHold';break;case _0x283d('0xaf'):_0x24838[_0x283d('0x6f')]='VoiceChanSpy';break;case _0x283d('0xb0'):_0x24838['childModel']=_0x283d('0xb1');break;case _0x283d('0xb2'):_0x24838['childModel']=_0x283d('0xb3');break;case _0x283d('0xb4'):_0x24838[_0x283d('0x6f')]=_0x283d('0xb5');break;case _0x283d('0xb6'):_0x24838[_0x283d('0x6f')]=_0x283d('0xb7');break;case _0x283d('0xb8'):_0x24838[_0x283d('0x6f')]='MailSubstatus';break;case _0x283d('0xb9'):_0x24838[_0x283d('0x6f')]=_0x283d('0xba');break;case _0x283d('0xbb'):_0x24838[_0x283d('0x6f')]=_0x283d('0xbc');break;case'smsqueues':_0x24838[_0x283d('0x6f')]=_0x283d('0xbd');break;case'smsaccounts':_0x24838[_0x283d('0x6f')]='SmsAccount';break;case'whatsappqueues':_0x24838['childModel']='WhatsappQueue';break;case _0x283d('0xbe'):_0x24838['childModel']='WhatsappAccount';break;case'teams':_0x24838[_0x283d('0x6f')]='Team';break;case'voicequeues':case'queuecampaigns':_0x24838[_0x283d('0x6f')]='VoiceQueue';if(_0x3feb44){_0x24838['parentSections']=[{'name':_0x283d('0xa8')},{'name':'QueueCampaigns'}];}break;case _0x283d('0xbf'):case _0x283d('0xc0'):case _0x283d('0xc1'):_0x24838[_0x283d('0x6f')]=_0x283d('0xa4');if(_0x3feb44){_0x24838['parentSections']=[{'name':_0x283d('0xc2'),'filter':{'field':_0x283d('0xa5'),'value':[_0x283d('0xc3'),'user']},'ignore':!![]},{'name':_0x283d('0xa2')},{'name':_0x283d('0xa6')}];}break;case _0x283d('0xc4'):_0x24838['childModel']=_0x283d('0xc5');break;case _0x283d('0xc6'):_0x24838[_0x283d('0x6f')]=_0x283d('0xc7');break;case _0x283d('0xc8'):_0x24838[_0x283d('0x6f')]=_0x283d('0xc9');break;case _0x283d('0xca'):_0x24838[_0x283d('0x6f')]='SugarcrmAccount';break;case _0x283d('0xcb'):_0x24838[_0x283d('0x6f')]=_0x283d('0xcc');break;case'zohoaccounts':_0x24838['childModel']='ZohoAccount';break;case _0x283d('0xcd'):_0x24838['childModel']=_0x283d('0xa4');break;case _0x283d('0xce'):_0x24838[_0x283d('0x6f')]=_0x283d('0xcf');break;case _0x283d('0xd0'):_0x24838[_0x283d('0x6f')]=_0x283d('0xd1');break;case _0x283d('0xd2'):_0x24838[_0x283d('0x6f')]=_0x283d('0x62');break;case _0x283d('0xd3'):_0x24838[_0x283d('0x6f')]=_0x283d('0xd4');break;case _0x283d('0xd5'):_0x24838[_0x283d('0x6f')]=_0x283d('0xd6');break;case _0x283d('0xd7'):_0x24838['childModel']=_0x283d('0xd8');break;case _0x283d('0xd9'):_0x24838[_0x283d('0x6f')]=_0x283d('0xda');break;case _0x283d('0xdb'):_0x24838[_0x283d('0x6f')]='Tag';break;case _0x283d('0xdc'):_0x24838['childModel']='Template';break;case _0x283d('0xdd'):_0x24838[_0x283d('0x6f')]='Trigger';break;case _0x283d('0xde'):_0x24838[_0x283d('0x6f')]='Trunk';break;case _0x283d('0xdf'):_0x24838[_0x283d('0x6f')]=_0x283d('0xe0');break;case _0x283d('0xe1'):_0x24838['childModel']='Plugin';break;case'extractedreports':_0x24838[_0x283d('0x6f')]='AnalyticExtractedReport';_0x24838[_0x283d('0x72')]=[{'name':_0x283d('0xe2'),'field':'id','foreignKey':_0x283d('0x7c')}];break;case _0x283d('0xe3'):_0x24838[_0x283d('0x6f')]=_0x283d('0xe4');break;case _0x283d('0xbe'):_0x24838['childModel']=_0x283d('0xe5');break;default:return _0x24838;}return _0x24838;} \ No newline at end of file +var _0x385b=['omit','createdAt','userProfileId','UserProfileResource','Resources','update','describe','addSections','ids','getSections','enabled','includes','sectionId','isEmpty','subsections','push','findOne','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','union','pick','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CustomReports','CmContact','color','tag','value','toLowerCase','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','contacts','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','chanspies','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','openchannelqueues','OpenchannelQueue','openchannelaccounts','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','QueueCampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Pause','sounds','Sound','Tag','templates','Template','Trigger','Trunk','Variable','extractedreports','Reports','metrics','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','map','UserProfile','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','updatedAt','sequelize','get','UserProfileSection','each','autoAssociation'];(function(_0x977b7a,_0x56030f){var _0x1dedcb=function(_0x40513c){while(--_0x40513c){_0x977b7a['push'](_0x977b7a['shift']());}};_0x1dedcb(++_0x56030f);}(_0x385b,0x8f));var _0xb385=function(_0x3cdf76,_0x63322b){_0x3cdf76=_0x3cdf76-0x0;var _0x1f1bdb=_0x385b[_0x3cdf76];return _0x1f1bdb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb385('0x0'));var rimraf=require(_0xb385('0x1'));var zipdir=require(_0xb385('0x2'));var jsonpatch=require(_0xb385('0x3'));var rp=require(_0xb385('0x4'));var moment=require('moment');var BPromise=require(_0xb385('0x5'));var Mustache=require(_0xb385('0x6'));var util=require(_0xb385('0x7'));var path=require(_0xb385('0x8'));var sox=require(_0xb385('0x9'));var csv=require(_0xb385('0xa'));var ejs=require(_0xb385('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb385('0xc'));var squel=require(_0xb385('0xd'));var crypto=require('crypto');var jsforce=require(_0xb385('0xe'));var deskjs=require(_0xb385('0xf'));var toCsv=require(_0xb385('0xa'));var querystring=require(_0xb385('0x10'));var Papa=require(_0xb385('0x11'));var Redis=require('ioredis');var authService=require(_0xb385('0x12'));var qs=require(_0xb385('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb385('0x14'));var logger=require(_0xb385('0x15'))(_0xb385('0x16'));var utils=require(_0xb385('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb385('0x18'));var db=require('../../mysqldb')['db'];config[_0xb385('0x19')]=_[_0xb385('0x1a')](config[_0xb385('0x19')],{'host':_0xb385('0x1b'),'port':0x18eb});var socket=require(_0xb385('0x1c'))(new Redis(config[_0xb385('0x19')]));require('./userProfile.socket')[_0xb385('0x1d')](socket);function respondWithStatusCode(_0x744326,_0xea45f5){_0xea45f5=_0xea45f5||0xcc;return function(_0x278f03){if(_0x278f03){return _0x744326[_0xb385('0x1e')](_0xea45f5);}return _0x744326['status'](_0xea45f5)[_0xb385('0x1f')]();};}function respondWithResult(_0x3444ce,_0x261abf){_0x261abf=_0x261abf||0xc8;return function(_0x47be7a){if(_0x47be7a){return _0x3444ce[_0xb385('0x20')](_0x261abf)['json'](_0x47be7a);}};}function respondWithFilteredResult(_0x225daa,_0xcb9a47){return function(_0x14bbb4){if(_0x14bbb4){var _0x72e2eb=_0x14bbb4[_0xb385('0x21')],_0x158eb1=_0xcb9a47[_0xb385('0x22')],_0xba4c5a=_0xcb9a47[_0xb385('0x22')]+_0xcb9a47[_0xb385('0x23')],_0x3c1c58;if(_0xba4c5a>=_0x72e2eb){_0xba4c5a=_0x72e2eb;_0x3c1c58=0xc8;}else{_0x3c1c58=0xce;}_0x225daa[_0xb385('0x20')](_0x3c1c58);return _0x225daa[_0xb385('0x24')](_0xb385('0x25'),_0x158eb1+'-'+_0xba4c5a+'/'+_0x72e2eb)[_0xb385('0x26')](_0x14bbb4);}return null;};}function patchUpdates(_0x4afcba){return function(_0x5787c3){try{jsonpatch[_0xb385('0x27')](_0x5787c3,_0x4afcba,!![]);}catch(_0x4333ad){return BPromise[_0xb385('0x28')](_0x4333ad);}return _0x5787c3[_0xb385('0x29')]();};}function saveUpdates(_0x1bee88,_0x4c4824){return function(_0xb968b8){if(_0xb968b8){return _0xb968b8['update'](_0x1bee88)[_0xb385('0x2a')](function(_0x104ea5){return _0x104ea5;});}return null;};}function removeEntity(_0x2061c2,_0x2402ae){return function(_0x54cd6a){if(_0x54cd6a){return _0x54cd6a[_0xb385('0x2b')]()[_0xb385('0x2a')](function(){_0x2061c2[_0xb385('0x20')](0xcc)[_0xb385('0x1f')]();});}};}function handleEntityNotFound(_0x25a547,_0x39c3d1){return function(_0x1f49d7){if(!_0x1f49d7){_0x25a547[_0xb385('0x1e')](0x194);}return _0x1f49d7;};}function handleError(_0x58222e,_0x3d124d){_0x3d124d=_0x3d124d||0x1f4;return function(_0x2e8910){logger[_0xb385('0x2c')](_0x2e8910['stack']);if(_0x2e8910[_0xb385('0x2d')]){delete _0x2e8910[_0xb385('0x2d')];}_0x58222e['status'](_0x3d124d)[_0xb385('0x2e')](_0x2e8910);};}exports['index']=function(_0x46a94e,_0x355cb6){var _0xcfeae4={},_0x42329b={},_0x283635={'count':0x0,'rows':[]};var _0x4ae5c5=_[_0xb385('0x2f')](db[_0xb385('0x30')][_0xb385('0x31')],function(_0x5b688c){return{'name':_0x5b688c[_0xb385('0x32')],'type':_0x5b688c[_0xb385('0x33')][_0xb385('0x34')]};});_0x42329b[_0xb385('0x35')]=_[_0xb385('0x2f')](_0x4ae5c5,_0xb385('0x2d'));_0x42329b[_0xb385('0x36')]=_['keys'](_0x46a94e[_0xb385('0x36')]);_0x42329b[_0xb385('0x37')]=_[_0xb385('0x38')](_0x42329b['model'],_0x42329b[_0xb385('0x36')]);_0xcfeae4[_0xb385('0x39')]=_[_0xb385('0x38')](_0x42329b['model'],qs[_0xb385('0x3a')](_0x46a94e[_0xb385('0x36')][_0xb385('0x3a')]));_0xcfeae4[_0xb385('0x39')]=_0xcfeae4['attributes'][_0xb385('0x3b')]?_0xcfeae4['attributes']:_0x42329b['model'];if(!_0x46a94e[_0xb385('0x36')][_0xb385('0x3c')](_0xb385('0x3d'))){_0xcfeae4['limit']=qs['limit'](_0x46a94e[_0xb385('0x36')][_0xb385('0x23')]);_0xcfeae4[_0xb385('0x22')]=qs[_0xb385('0x22')](_0x46a94e[_0xb385('0x36')][_0xb385('0x22')]);}_0xcfeae4[_0xb385('0x3e')]=qs[_0xb385('0x3f')](_0x46a94e[_0xb385('0x36')]['sort']);_0xcfeae4['where']=qs[_0xb385('0x37')](_['pick'](_0x46a94e[_0xb385('0x36')],_0x42329b['filters']),_0x4ae5c5);if(_0x46a94e['query']['filter']){_0xcfeae4['where']=_[_0xb385('0x40')](_0xcfeae4[_0xb385('0x41')],{'$or':_[_0xb385('0x2f')](_0x4ae5c5,function(_0x477e48){if(_0x477e48['type']!=='VIRTUAL'){var _0x4cf04f={};_0x4cf04f[_0x477e48[_0xb385('0x2d')]]={'$like':'%'+_0x46a94e['query'][_0xb385('0x42')]+'%'};return _0x4cf04f;}})});}_0xcfeae4=_[_0xb385('0x40')]({},_0xcfeae4,_0x46a94e['options']);var _0x5ee366={'where':_0xcfeae4['where']};return db['UserProfile'][_0xb385('0x21')](_0x5ee366)[_0xb385('0x2a')](function(_0x5d07ad){_0x283635['count']=_0x5d07ad;if(_0x46a94e['query'][_0xb385('0x43')]){_0xcfeae4[_0xb385('0x44')]=[{'all':!![]}];}return db[_0xb385('0x30')][_0xb385('0x45')](_0xcfeae4);})['then'](function(_0xbc86e5){_0x283635[_0xb385('0x46')]=_0xbc86e5;return _0x283635;})[_0xb385('0x2a')](respondWithFilteredResult(_0x355cb6,_0xcfeae4))[_0xb385('0x47')](handleError(_0x355cb6,null));};exports[_0xb385('0x48')]=function(_0x2de275,_0x4001da){var _0x319bb4={'raw':![],'where':{'id':_0x2de275[_0xb385('0x49')]['id']}},_0x4f9d58={};_0x4f9d58[_0xb385('0x35')]=_['keys'](db['UserProfile']['rawAttributes']);_0x4f9d58[_0xb385('0x36')]=_[_0xb385('0x4a')](_0x2de275[_0xb385('0x36')]);_0x4f9d58[_0xb385('0x37')]=_[_0xb385('0x38')](_0x4f9d58['model'],_0x4f9d58['query']);_0x319bb4[_0xb385('0x39')]=_[_0xb385('0x38')](_0x4f9d58[_0xb385('0x35')],qs[_0xb385('0x3a')](_0x2de275['query'][_0xb385('0x3a')]));_0x319bb4[_0xb385('0x39')]=_0x319bb4['attributes'][_0xb385('0x3b')]?_0x319bb4[_0xb385('0x39')]:_0x4f9d58[_0xb385('0x35')];if(_0x2de275[_0xb385('0x36')]['includeAll']){_0x319bb4[_0xb385('0x44')]=[{'all':!![]}];}_0x319bb4=_['merge']({},_0x319bb4,_0x2de275[_0xb385('0x4b')]);return db['UserProfile'][_0xb385('0x4c')](_0x319bb4)['then'](handleEntityNotFound(_0x4001da,null))[_0xb385('0x2a')](respondWithResult(_0x4001da,null))[_0xb385('0x47')](handleError(_0x4001da,null));};exports[_0xb385('0x4d')]=function(_0x1cbeec,_0x3810f1){return db[_0xb385('0x30')]['create'](_0x1cbeec[_0xb385('0x4e')],{})[_0xb385('0x2a')](respondWithResult(_0x3810f1,0xc9))[_0xb385('0x47')](handleError(_0x3810f1,null));};exports['clone']=function(_0x235a80,_0xacf9c3){var _0x3bf9c6={'where':{'id':_0x235a80[_0xb385('0x49')]['id']}},_0x425707={};_0x425707[_0xb385('0x35')]=_[_0xb385('0x4a')](db[_0xb385('0x30')][_0xb385('0x31')]);_0x3bf9c6['attributes']=_[_0xb385('0x38')](_0x425707[_0xb385('0x35')],qs[_0xb385('0x3a')](_0x235a80['query'][_0xb385('0x3a')]));_0x3bf9c6[_0xb385('0x39')]=_0x3bf9c6[_0xb385('0x39')]['length']?_0x3bf9c6['attributes']:_0x425707[_0xb385('0x35')];if(_0x235a80[_0xb385('0x36')]['includeAll']){_0x3bf9c6[_0xb385('0x44')]=[{'all':!![]}];}_0x3bf9c6=_[_0xb385('0x40')]({},_0x3bf9c6,_0x235a80[_0xb385('0x4b')]);return db[_0xb385('0x30')]['find'](_0x3bf9c6)[_0xb385('0x2a')](handleEntityNotFound(_0xacf9c3,null))['then'](function(_0xea918c){if(_0xea918c){var _0x53444c=_0xea918c['get']({'plain':!![]});_0x53444c=qs['omit'](_0x53444c,['id','createdAt',_0xb385('0x4f'),'crudPermissions']);_0x235a80[_0xb385('0x4e')]=_['omit'](_0x235a80[_0xb385('0x4e')],['id','createdAt',_0xb385('0x4f')]);return db[_0xb385('0x50')]['transaction'](function(_0x31abc8){return db[_0xb385('0x30')][_0xb385('0x4d')](_[_0xb385('0x40')](_0x53444c,_0x235a80[_0xb385('0x4e')]),{'include':_0x235a80[_0xb385('0x36')][_0xb385('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x31abc8})[_0xb385('0x2a')](function(_0x24bde7){var _0xdcefbb=_0x24bde7[_0xb385('0x51')]({'plain':!![]});return db[_0xb385('0x52')][_0xb385('0x45')]({'where':{'userProfileId':_0x235a80['params']['id']},'raw':!![]})[_0xb385('0x2a')](function(_0x15680e){if(_0x15680e){return BPromise[_0xb385('0x53')](_0x15680e,function(_0x2e4659){return new BPromise(function(_0x5c86a1,_0x3f3517){if(_0x2e4659[_0xb385('0x54')]===null||_0x2e4659[_0xb385('0x54')]===0x1)_0x5c86a1(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x2e4659['id']},'raw':!![]})[_0xb385('0x2a')](function(_0x2ca770){var _0x23de70=_[_0xb385('0x2f')](_0x2ca770,function(_0x49fad3){return qs[_0xb385('0x55')](_0x49fad3,['id',_0xb385('0x56'),_0xb385('0x4f'),'sectionId']);});_0x5c86a1(_0x23de70);})[_0xb385('0x47')](function(_0x50a019){_0x3f3517(_0x50a019);});})[_0xb385('0x2a')](function(_0xd2b029){var _0x2a9ab0=qs[_0xb385('0x55')](_0x2e4659,['id',_0xb385('0x56'),_0xb385('0x4f')]);_0x2a9ab0[_0xb385('0x57')]=_0xdcefbb['id'];if(_0xd2b029)_0x2a9ab0['Resources']=_0xd2b029;return _0x2a9ab0;})['then'](function(_0x25cdcd){return db[_0xb385('0x52')][_0xb385('0x4d')](_0x25cdcd,{'include':[{'model':db[_0xb385('0x58')],'as':_0xb385('0x59')}],'raw':!![],'transaction':_0x31abc8});});})[_0xb385('0x2a')](function(){return _0xdcefbb;});}});});});}})[_0xb385('0x2a')](respondWithResult(_0xacf9c3,0xc9))[_0xb385('0x47')](handleError(_0xacf9c3,null));};exports[_0xb385('0x5a')]=function(_0x2b1125,_0x4c170f){if(_0x2b1125[_0xb385('0x4e')]['id']){delete _0x2b1125[_0xb385('0x4e')]['id'];}return db[_0xb385('0x30')][_0xb385('0x4c')]({'where':{'id':_0x2b1125[_0xb385('0x49')]['id']}})[_0xb385('0x2a')](handleEntityNotFound(_0x4c170f,null))[_0xb385('0x2a')](saveUpdates(_0x2b1125[_0xb385('0x4e')],null))[_0xb385('0x2a')](respondWithResult(_0x4c170f,null))[_0xb385('0x47')](handleError(_0x4c170f,null));};exports['destroy']=function(_0x2e10c2,_0x43487d){return db[_0xb385('0x30')][_0xb385('0x4c')]({'where':{'id':_0x2e10c2[_0xb385('0x49')]['id']}})[_0xb385('0x2a')](handleEntityNotFound(_0x43487d,null))[_0xb385('0x2a')](removeEntity(_0x43487d,null))[_0xb385('0x47')](handleError(_0x43487d,null));};exports[_0xb385('0x5b')]=function(_0x1b532f,_0x3d6f93){return db[_0xb385('0x30')][_0xb385('0x5b')]()[_0xb385('0x2a')](respondWithResult(_0x3d6f93,null))[_0xb385('0x47')](handleError(_0x3d6f93,null));};exports[_0xb385('0x5c')]=function(_0x52229a,_0x1c4069){var _0x53e53d=_0x52229a['body'];return db[_0xb385('0x30')]['find']({'where':{'id':_0x52229a[_0xb385('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c4069,null))['then'](function(_0x56d3b2){if(_0x56d3b2){return db[_0xb385('0x50')]['transaction'](function(_0xc03d8d){return db[_0xb385('0x52')][_0xb385('0x2b')]({'where':{'userProfileId':_0x52229a[_0xb385('0x49')]['id'],'sectionId':_[_0xb385('0x2f')](_0x53e53d,function(_0x8e74d4){return _0x8e74d4['sectionId'];})},'transaction':_0xc03d8d})[_0xb385('0x2a')](function(){var _0x3418dd=_[_0xb385('0x2f')](_0x53e53d,function(_0x310646){_0x310646[_0xb385('0x57')]=_0x52229a[_0xb385('0x49')]['id'];return _0x310646;});var _0x30a7de=[];return BPromise[_0xb385('0x53')](_0x3418dd,function(_0x59e062){return db[_0xb385('0x52')][_0xb385('0x4d')](_0x59e062,{'include':[{'model':db[_0xb385('0x58')],'as':_0xb385('0x59')}],'raw':!![],'transaction':_0xc03d8d})[_0xb385('0x2a')](function(_0x278f6a){_0x30a7de['push'](_0x278f6a[_0xb385('0x51')]({'plain':!![]}));});})['then'](function(){return _0x30a7de;});});});}})[_0xb385('0x2a')](function(_0x243255){return _0x243255;})[_0xb385('0x2a')](respondWithResult(_0x1c4069,null))[_0xb385('0x47')](handleError(_0x1c4069,null));};exports['removeSections']=function(_0x1a94fc,_0xaae17){var _0x56c1ca;return db[_0xb385('0x30')][_0xb385('0x4c')]({'where':{'id':_0x1a94fc[_0xb385('0x49')]['id']},'attributes':['id','name']})[_0xb385('0x2a')](handleEntityNotFound(_0xaae17,null))[_0xb385('0x2a')](function(_0x904de2){if(_0x904de2){_0x56c1ca=_0x904de2;return db[_0xb385('0x52')][_0xb385('0x2b')]({'where':{'userProfileId':_0x1a94fc['params']['id'],'sectionId':_0x1a94fc[_0xb385('0x36')][_0xb385('0x5d')]}});}})[_0xb385('0x2a')](function(){return _0x56c1ca;})[_0xb385('0x2a')](respondWithStatusCode(_0xaae17,null))[_0xb385('0x47')](handleError(_0xaae17,null));};exports[_0xb385('0x5e')]=function(_0x4d7f48,_0x46dbcd){var _0xe8263=[];var _0x3c44a3=[];return db['UserProfileSection'][_0xb385('0x45')]({'where':{'userProfileId':_0x4d7f48[_0xb385('0x49')]['id']},'raw':!![]})[_0xb385('0x2a')](function(_0x2e5ed1){_0xe8263=_[_0xb385('0x42')](_0x2e5ed1,function(_0x304d71){return _0x304d71[_0xb385('0x5f')]===0x1||_[_0xb385('0x60')]([0x3eb,0x709],_0x304d71[_0xb385('0x61')]);});if(!_[_0xb385('0x62')](_0xe8263)){return _['map'](_0xe8263,function(_0x12fdf8){return _0x12fdf8['sectionId'];});}else{return;}})['then'](function(_0x236b53){if(_0x236b53)_0x3c44a3=_0x236b53;if(_[_0xb385('0x60')](_0x3c44a3,0x64)){var _0x42ecc2=_[_0xb385('0x4c')](_0xe8263,{'sectionId':0x64});return hasDefaultDashboard(_0x42ecc2)[_0xb385('0x2a')](function(_0x421b45){return _[_0xb385('0x2f')](_0xe8263,function(_0x2595da){if(_0x2595da[_0xb385('0x61')]===0x64){_0x2595da[_0xb385('0x63')]=_0x421b45;}return _0x2595da;});});}else{return;}})[_0xb385('0x2a')](function(_0x355bc4){if(_0x355bc4)_0xe8263=_0x355bc4;if(_[_0xb385('0x60')](_0x3c44a3,0x3eb)){var _0x16caf7=_['find'](_0xe8263,{'sectionId':0x3eb});return getCustomDashboards(_0x16caf7)[_0xb385('0x2a')](function(_0x173b95){return _[_0xb385('0x2f')](_0xe8263,function(_0x31ccf6){if(_0x16caf7[_0xb385('0x5f')]){if(_0x31ccf6[_0xb385('0x61')]===0x3eb){_0x31ccf6[_0xb385('0x63')]=_0x173b95;}}else{if(_0x31ccf6['sectionId']===0x64){_0x31ccf6['subsections']=_0x173b95;}}return _0x31ccf6;});});}else{return;}})[_0xb385('0x2a')](function(_0x4a062d){if(_0x4a062d)_0xe8263=_0x4a062d;if(_[_0xb385('0x60')](_0x3c44a3,0x709)){var _0x2336bb=_[_0xb385('0x4c')](_0xe8263,{'sectionId':0x709});return getPlugins(_0x2336bb)[_0xb385('0x2a')](function(_0x16d9e3){if(_0x2336bb['enabled']){return _['map'](_0xe8263,function(_0x115f6d){if(_0x115f6d[_0xb385('0x61')]===0x709){_0x115f6d[_0xb385('0x63')]=_0x16d9e3;}return _0x115f6d;});}else{var _0x49b740={'sectionId':0x76c,'enabled':0x1,'subsections':_0x16d9e3};var _0xcee56f=_['map'](_0xe8263);_0xcee56f[_0xb385('0x64')](_0x49b740);return _0xcee56f;}});}else{return;}})[_0xb385('0x2a')](function(_0x47fefa){if(_0x47fefa)_0xe8263=_0x47fefa;return _[_0xb385('0x42')](_0xe8263,['enabled',0x1]);})[_0xb385('0x2a')](respondWithResult(_0x46dbcd,null))[_0xb385('0x47')](handleError(_0x46dbcd,null));};function hasDefaultDashboard(_0x46f293){var _0x361d4a=[0x65];return new BPromise(function(_0x55d3b9,_0x387907){try{if(_0x46f293['autoAssociation']){_0x55d3b9(_0x361d4a);}else{return db[_0xb385('0x58')][_0xb385('0x65')]({'where':{'sectionId':_0x46f293['id']},'raw':!![]})['then'](function(_0xf0a1b7){_0xf0a1b7?_0x55d3b9(_0x361d4a):_0x55d3b9();});}}catch(_0x285a2e){_0x387907(_0x285a2e);}});}function getCustomDashboards(_0x275904){var _0x6d5222=[];return new BPromise(function(_0x18fc19,_0xf3f37c){try{if(_0x275904[_0xb385('0x54')]){return db['Dashboard'][_0xb385('0x45')]({'raw':!![]})['then'](function(_0x24fe2b){_0x24fe2b['forEach'](function(_0x441a83){_0x6d5222[_0xb385('0x64')](_0x441a83['id']+0x1869f);});_0x18fc19(_0x6d5222);});}else{return db[_0xb385('0x58')][_0xb385('0x45')]({'where':{'sectionId':_0x275904['id']},'raw':!![]})['then'](function(_0x32dab7){_0x32dab7[_0xb385('0x66')](function(_0x43413f){_0x6d5222[_0xb385('0x64')](_0x43413f[_0xb385('0x67')]+0x1869f);});_0x18fc19(_0x6d5222);});}}catch(_0x33a33d){_0xf3f37c(_0x33a33d);}});}function getPlugins(_0x1ff29c){var _0x4fb10e=[];return new BPromise(function(_0x5ac1d9,_0x468306){try{if(_0x1ff29c[_0xb385('0x54')]){return db[_0xb385('0x68')][_0xb385('0x45')]({'raw':!![]})[_0xb385('0x2a')](function(_0x5f3791){_0x5f3791['forEach'](function(_0x130a57){_0x4fb10e[_0xb385('0x64')](_0x130a57['id']+0x15b38);});_0x5ac1d9(_0x4fb10e);});}else{return db[_0xb385('0x58')][_0xb385('0x45')]({'where':{'sectionId':_0x1ff29c['id']},'raw':!![]})[_0xb385('0x2a')](function(_0x2eaf1b){_0x2eaf1b[_0xb385('0x66')](function(_0x24ae1a){_0x4fb10e[_0xb385('0x64')](_0x24ae1a['resourceId']+0x15b38);});_0x5ac1d9(_0x4fb10e);});}}catch(_0x20878e){_0x468306(_0x20878e);}});}exports['addResources']=function(_0x5d7af7,_0x31bee8){return db[_0xb385('0x30')][_0xb385('0x4c')]({'where':{'id':_0x5d7af7[_0xb385('0x49')]['id']}})[_0xb385('0x2a')](handleEntityNotFound(_0x31bee8,null))[_0xb385('0x2a')](function(_0x262465){if(_0x262465){return db[_0xb385('0x50')]['transaction'](function(_0x24fffe){return db[_0xb385('0x52')][_0xb385('0x45')]({'where':{'userProfileId':_0x5d7af7[_0xb385('0x49')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x6582f9){if(_0x6582f9){return db[_0xb385('0x52')][_0xb385('0x2b')]({'where':{'userProfileId':_0x5d7af7['params']['id'],'id':_[_0xb385('0x2f')](_0x6582f9,function(_0x122c5b){return _0x122c5b['id'];})},'transaction':_0x24fffe});}})['then'](function(_0x4f1344){var _0x2eee16=_[_0xb385('0x2f')](_0x5d7af7[_0xb385('0x4e')],function(_0x145213){_0x145213['userProfileId']=_0x5d7af7[_0xb385('0x49')]['id'];return _0x145213;});return db[_0xb385('0x52')][_0xb385('0x69')](_0x2eee16,{'raw':!![],'transaction':_0x24fffe});})['then'](function(_0x379bb6){var _0x2a833d=_[_0xb385('0x42')](_[_0xb385('0x2f')](_0x379bb6,function(_0x3f9aa8){return _0x3f9aa8[_0xb385('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x2a833d){return db[_0xb385('0x52')][_0xb385('0x45')]({'where':{'userProfileId':_0x5d7af7[_0xb385('0x49')]['id'],'sectionId':_['map'](_0x2a833d,function(_0x408c96){return _0x408c96['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xb385('0x2a')](function(_0x2d6607){var _0x4c8889=_[_0xb385('0x2f')](_0x5d7af7[_0xb385('0x4e')],function(_0x45d372){_0x45d372[_0xb385('0x57')]=_0x5d7af7[_0xb385('0x49')]['id'];return _0x45d372;});return db[_0xb385('0x58')]['bulkCreate'](_0x4c8889,{'raw':!![],'transaction':_0x24fffe});});}})[_0xb385('0x47')](handleError(_0x31bee8,null));});}})[_0xb385('0x2a')](function(_0x40a1a7){var _0x573e97=_['map'](_0x40a1a7,function(_0x225533){return _0x225533[_0xb385('0x51')]({'plain':!![]});});})[_0xb385('0x2a')](respondWithResult(_0x31bee8,null))['catch'](handleError(_0x31bee8,null));};exports['removeResources']=function(_0x367471,_0x5492cf,_0x100bd0){return db[_0xb385('0x30')][_0xb385('0x4c')]({'where':{'id':_0x367471['params']['id']}})[_0xb385('0x2a')](handleEntityNotFound(_0x5492cf,null))[_0xb385('0x2a')](function(_0x24a900){if(_0x24a900){return _0x24a900[_0xb385('0x6a')](_0x367471[_0xb385('0x36')][_0xb385('0x5d')]);}})['then'](respondWithStatusCode(_0x5492cf,null))[_0xb385('0x47')](handleError(_0x5492cf,null));};exports[_0xb385('0x6b')]=function(_0x2afc95,_0x42b1fb){var _0x5bb5db={'raw':![],'where':{}};var _0x5dee55={};var _0x1d0bb8={'count':0x0,'rows':[]};var _0x4dc697=_0x2afc95[_0xb385('0x36')][_0xb385('0x6c')];if(typeof _0x4dc697===_0xb385('0x6d')){throw new db[(_0xb385('0x6e'))][(_0xb385('0x6f'))](_0xb385('0x70'));}var _0x1e25f2=_0x2afc95['query'][_0xb385('0x71')]||![];var _0x2869fd=getQueryModels(_0x4dc697,_0x1e25f2);if(typeof _0x2869fd[_0xb385('0x72')]==='undefined'){throw new db['Sequelize'][(_0xb385('0x6f'))](_0xb385('0x73')+_0x4dc697+'\x27');}var _0x365f51=[];if(!_[_0xb385('0x62')](_0x2869fd[_0xb385('0x74')])){_0x365f51=_0x2869fd[_0xb385('0x74')];}else{_0x365f51=[{'name':_0x4dc697}];}return db[_0xb385('0x30')][_0xb385('0x65')]({'where':{'id':_0x2afc95['params']['id']}})[_0xb385('0x2a')](handleEntityNotFound(_0x42b1fb,null))['then'](function(_0x70e6cb){if(_0x70e6cb){var _0x2d3ff9=[];for(var _0xe74763=0x0;_0xe74763<_0x365f51[_0xb385('0x3b')];_0xe74763++){_0x2d3ff9[_0xb385('0x64')](db[_0xb385('0x52')]['findOne']({'where':{'userProfileId':_0x70e6cb['id'],'name':_0x365f51[_0xe74763][_0xb385('0x2d')]},'raw':!![]}));}return BPromise[_0xb385('0x75')](_0x2d3ff9);}})[_0xb385('0x2a')](function(_0x102b81){var _0x1d999b=_[_0xb385('0x42')](_0x102b81,function(_0x493b){return _0x493b?_0x493b:undefined;});var _0x2c21c1=_['filter'](_0x365f51,[_0xb385('0x76'),!![]]);var _0x2e2e89=_['isEmpty'](_0x1d999b)&&_[_0xb385('0x62')](_0x2c21c1)?null:_[_0xb385('0x77')](_0x2c21c1,_0x1d999b);if(_0x2e2e89){var _0x5a4809=[];for(var _0x104efe=0x0;_0x104efe<_0x2e2e89['length'];_0x104efe++){var _0x288db7=_[_0xb385('0x4c')](_0x365f51,function(_0x3b3ebc){return _0x2e2e89[_0x104efe]?_0x3b3ebc[_0xb385('0x2d')]===_0x2e2e89[_0x104efe][_0xb385('0x2d')]:null;});if(_0x288db7){if(_0x2e2e89[_0x104efe][_0xb385('0x76')]){_0x5a4809['push'](getAllResources(_0x2869fd[_0xb385('0x72')],_0x2e2e89[_0x104efe]));}else{if(!_0x2e2e89[_0x104efe][_0xb385('0x54')]){_0x5a4809['push'](getAllowedResources(_0x288db7,_0x2e2e89[_0x104efe],_0x2869fd[_0xb385('0x72')]));}else{if(_0x288db7[_0xb385('0x35')]){_0x5a4809[_0xb385('0x64')](getAllFilteredResources(_0x288db7,_0x2e2e89[_0x104efe]));}}}}}return BPromise[_0xb385('0x75')](_0x5a4809);}else{return null;}})[_0xb385('0x2a')](function(_0x3a60ff){var _0x2821d3=_0x3a60ff;var _0x26c9ec=null;if(_0x2821d3){_0x26c9ec=_0x2821d3[_0xb385('0x3b')]===0x1?_0x2821d3[0x0]:null;}if(_0x26c9ec||_0x2821d3){var _0x54e512=db[_0x2869fd[_0xb385('0x72')]][_0xb385('0x31')];_0x5dee55[_0xb385('0x35')]=_[_0xb385('0x4a')](_0x54e512);_0x5dee55[_0xb385('0x36')]=_[_0xb385('0x4a')](_0x2afc95[_0xb385('0x36')]);_0x5dee55[_0xb385('0x37')]=_[_0xb385('0x38')](_0x5dee55[_0xb385('0x35')],_0x5dee55[_0xb385('0x36')]);_0x5bb5db['attributes']=_[_0xb385('0x38')](_0x5dee55[_0xb385('0x35')],qs[_0xb385('0x3a')](_0x2afc95[_0xb385('0x36')][_0xb385('0x3a')]));_0x5bb5db['attributes']=_0x5bb5db[_0xb385('0x39')][_0xb385('0x3b')]?_0x5bb5db['attributes']:_0x5dee55[_0xb385('0x35')];if(!_0x2afc95[_0xb385('0x36')][_0xb385('0x3c')](_0xb385('0x3d'))){_0x5bb5db[_0xb385('0x23')]=qs[_0xb385('0x23')](_0x2afc95[_0xb385('0x36')][_0xb385('0x23')]);_0x5bb5db[_0xb385('0x22')]=qs[_0xb385('0x22')](_0x2afc95[_0xb385('0x36')][_0xb385('0x22')]);}_0x5bb5db['order']=qs[_0xb385('0x3f')](_0x2afc95[_0xb385('0x36')]['sort']);_0x5bb5db[_0xb385('0x41')]=qs[_0xb385('0x37')](_[_0xb385('0x78')](_0x2afc95[_0xb385('0x36')],_0x5dee55['filters']));if(_0x2afc95[_0xb385('0x36')]['filter']){_0x5bb5db[_0xb385('0x41')]=_[_0xb385('0x40')](_0x5bb5db['where'],{'$or':_['map'](_0x54e512,function(_0x106d09){if(_0x106d09[_0xb385('0x33')][_0xb385('0x34')]!=='VIRTUAL'){var _0x5a62cc={};_0x5a62cc[_0x106d09['field']]={'$like':'%'+_0x2afc95[_0xb385('0x36')]['filter']+'%'};return _0x5a62cc;}})});}var _0x2650fd=[];if(_0x26c9ec){var _0x27274f=_[_0xb385('0x4c')](_0x365f51,[_0xb385('0x2d'),_0x26c9ec[_0xb385('0x2d')]]);if(_0x27274f[_0xb385('0x79')]){var _0x545a13={};if(_0x2869fd[_0xb385('0x72')]===_0xb385('0x7a')){_0x545a13[_0x27274f[_0xb385('0x7b')]]=_[_0xb385('0x2f')](_0x26c9ec[_0xb385('0x7c')],'id');}else{_0x545a13[_0x27274f[_0xb385('0x7b')]]=_0x26c9ec['associatedResources'];}_0x2650fd['push'](_0x545a13);}else{_0x5bb5db['where']['id']=_0x26c9ec[_0xb385('0x7c')];}}else{for(var _0x54f5cc=0x0;_0x54f5cc<_0x2821d3[_0xb385('0x3b')];_0x54f5cc++){var _0x27274f=_[_0xb385('0x4c')](_0x365f51,['name',_0x2821d3[_0x54f5cc][_0xb385('0x2d')]]);if(_0x27274f['field']){var _0x545a13={};_0x545a13[_0x27274f['foreignKey']]=_0x2821d3[_0x54f5cc][_0xb385('0x7c')];_0x2650fd['push'](_0x545a13);}else{if(!_0x5bb5db[_0xb385('0x41')]['id'])_0x5bb5db[_0xb385('0x41')]['id']=[];_0x2821d3[_0x54f5cc][_0xb385('0x7c')][_0xb385('0x66')](function(_0x3fe548){_0x5bb5db[_0xb385('0x41')]['id']['push'](_0x3fe548);});}}}if(!_[_0xb385('0x62')](_0x2650fd)){_0x5bb5db[_0xb385('0x41')]=_['merge'](_0x5bb5db[_0xb385('0x41')],{'$and':{'$or':_0x2650fd}});}_0x5bb5db=_[_0xb385('0x40')]({},_0x5bb5db,_0x2afc95[_0xb385('0x4b')]);if(_0x26c9ec&&!_0x26c9ec[_0xb385('0x54')]&&_0x2869fd[_0xb385('0x72')]===_0xb385('0x7a')){if(_0x2afc95[_0xb385('0x36')][_0xb385('0x43')]){_0x5bb5db['include']=[{'all':!![]}];}return db[_0x2869fd[_0xb385('0x72')]][_0xb385('0x45')](_0x5bb5db)['then'](function(_0xd61c5b){var _0x1fee50=[];_0xd61c5b['forEach'](function(_0xfef439){var _0x506228;switch(_0xfef439[_0xb385('0x7d')]){case _0xb385('0x7e'):_0x506228=_[_0xb385('0x4c')](_0x26c9ec[_0xb385('0x7c')],function(_0x646eb0){return _0x646eb0['id']===_0xfef439[_0xb385('0x7f')]&&_0x646eb0[_0xb385('0x33')]===_0xb385('0x80');});break;case _0xb385('0x81'):_0x506228=_[_0xb385('0x4c')](_0x26c9ec['associatedResources'],function(_0x31af89){return _0x31af89['id']===_0xfef439[_0xb385('0x7f')]&&_0x31af89['type']===_0xb385('0x82');});break;}if(_0x506228)_0x1fee50[_0xb385('0x64')](_0xfef439);});_0x1d0bb8[_0xb385('0x21')]=_0x1fee50[_0xb385('0x3b')];_0x1d0bb8['rows']=_0x1fee50;return _0x1d0bb8;});}else{return db[_0x2869fd[_0xb385('0x72')]][_0xb385('0x21')]({'where':_0x5bb5db[_0xb385('0x41')]})[_0xb385('0x2a')](function(_0xafd4a6){_0x1d0bb8['count']=_0xafd4a6;if(_0x2afc95['query']['includeAll']){if(_0x2869fd[_0xb385('0x72')]===_0xb385('0x83')){_0x5bb5db[_0xb385('0x44')]=[{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xb385('0x84')],'required':_0x2afc95[_0xb385('0x36')][_0xb385('0x85')]?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id',_0xb385('0x2d'),'color'],'through':_0x2afc95[_0xb385('0x36')][_0xb385('0x85')]?{'attributes':[],'where':{'TagId':_0x2afc95[_0xb385('0x36')]['tag']||undefined}}:{},'required':_0x2afc95[_0xb385('0x36')][_0xb385('0x85')]?!![]:![]}];}else{_0x5bb5db[_0xb385('0x44')]=[{'all':!![]}];}}return db[_0x2869fd[_0xb385('0x72')]]['findAll'](_0x5bb5db);})[_0xb385('0x2a')](function(_0x1c2c73){_0x1d0bb8[_0xb385('0x46')]=_0x1c2c73;return _0x1d0bb8;});}}else{return _0x1d0bb8;}})[_0xb385('0x2a')](respondWithFilteredResult(_0x42b1fb,_0x5bb5db))[_0xb385('0x47')](handleError(_0x42b1fb,null));};function getAllResources(_0x235f5f,_0x140c0c){return new BPromise(function(_0x17ffe8,_0x40ed35){if(_0x140c0c){var _0x3a75cb=_0x140c0c['filter']?{[_0x140c0c['filter'][_0xb385('0x79')]]:_0x140c0c[_0xb385('0x42')][_0xb385('0x86')]}:undefined;return db[_0x235f5f][_0xb385('0x45')]({'where':_0x3a75cb,'raw':!![]})[_0xb385('0x2a')](function(_0x2bcb37){_0x140c0c[_0xb385('0x7c')]=_[_0xb385('0x2f')](_0x2bcb37,'id');_0x17ffe8(_0x140c0c);})[_0xb385('0x47')](function(_0x1c7eca){_0x40ed35(_0x1c7eca);});}else{_0x17ffe8(null);}});}function getAllFilteredResources(_0xaba149,_0x2f27d0){return new BPromise(function(_0x2c8e63,_0x4c691c){var _0xdca158=_0xaba149['filter']?{[_0xaba149['filter'][_0xb385('0x79')]]:_0xaba149[_0xb385('0x42')][_0xb385('0x86')]}:undefined;return db[_0xaba149[_0xb385('0x35')]]['findAll']({'where':_0xdca158,'raw':!![]})['then'](function(_0x11a7a0){_0x2f27d0[_0xb385('0x7c')]=_[_0xb385('0x2f')](_0x11a7a0,function(_0x3d7b72){return _0x3d7b72['name'];});_0x2c8e63(_0x2f27d0);})[_0xb385('0x47')](function(_0x4972){_0x4c691c(_0x4972);});});}function getAllowedResources(_0x57f6da,_0x3a91ce,_0x15cc9c){return new BPromise(function(_0x574e2a,_0x4a8d9a){if(_0x3a91ce){return db[_0xb385('0x58')][_0xb385('0x45')]({'where':{'sectionId':_0x3a91ce['id']},'raw':!![]})[_0xb385('0x2a')](function(_0x3e6326){if(_0x57f6da[_0xb385('0x79')]&&_0x57f6da[_0xb385('0x79')]!=='id'){_0x3a91ce['associatedResources']=_[_0xb385('0x2f')](_0x3e6326,function(_0x3e19d5){return _0x3e19d5[_0x57f6da['field']];});}else{if(_0x15cc9c===_0xb385('0x7a')){_0x3a91ce[_0xb385('0x7c')]=_[_0xb385('0x2f')](_0x3e6326,function(_0x487b4f){return{'id':_0x487b4f[_0xb385('0x67')],'type':_0x487b4f[_0xb385('0x33')]};});}else{_0x3a91ce[_0xb385('0x7c')]=_[_0xb385('0x2f')](_0x3e6326,function(_0x8818ee){return _0x8818ee[_0xb385('0x67')];});}}_0x574e2a(_0x3a91ce);})[_0xb385('0x47')](function(_0x4277d6){_0x4a8d9a(_0x4277d6);});}else{_0x574e2a(null);}});}function getQueryModels(_0x5f0c8c,_0x596734){var _0x41132e=_0x5f0c8c[_0xb385('0x87')]();var _0x3865f5={'childModel':undefined,'parentSections':[]};switch(_0x41132e){case'squareprojects':_0x3865f5[_0xb385('0x72')]=_0xb385('0x88');break;case _0xb385('0x89'):_0x3865f5[_0xb385('0x72')]=_0xb385('0x8a');break;case'squarerecordings':_0x3865f5[_0xb385('0x72')]=_0xb385('0x8b');_0x3865f5[_0xb385('0x74')]=[{'name':_0xb385('0x8c'),'field':'name','foreignKey':'projectName'}];break;case'projects':_0x3865f5[_0xb385('0x72')]='JscriptyProject';break;case _0xb385('0x8d'):_0x3865f5['childModel']='CmContact';_0x3865f5[_0xb385('0x74')]=[{'name':_0xb385('0x8e'),'field':'id','foreignKey':_0xb385('0x8f')}];break;case _0xb385('0x90'):_0x3865f5[_0xb385('0x72')]=_0xb385('0x91');break;case _0xb385('0x92'):_0x3865f5[_0xb385('0x72')]=_0xb385('0x93');break;case'globalcustomfields':_0x3865f5[_0xb385('0x72')]=_0xb385('0x94');break;case'chatqueues':_0x3865f5[_0xb385('0x72')]=_0xb385('0x95');break;case _0xb385('0x96'):_0x3865f5['childModel']=_0xb385('0x97');break;case _0xb385('0x98'):_0x3865f5[_0xb385('0x72')]=_0xb385('0x99');break;case'faxaccounts':_0x3865f5[_0xb385('0x72')]=_0xb385('0x9a');break;case _0xb385('0x9b'):case'internalroutes':case'outboundroutes':_0x3865f5[_0xb385('0x72')]=_0xb385('0x9c');break;case _0xb385('0x9d'):_0x3865f5['childModel']=_0xb385('0x9e');break;case _0xb385('0x9f'):_0x3865f5[_0xb385('0x72')]=_0xb385('0xa0');break;case _0xb385('0xa1'):_0x3865f5[_0xb385('0x72')]=_0xb385('0xa2');_0x3865f5[_0xb385('0x74')]=[{'name':_0xb385('0xa3'),'field':'name','foreignKey':_0xb385('0xa4'),'model':_0xb385('0xa5'),'filter':{'field':_0xb385('0xa6'),'value':[_0xb385('0xa7')]}},{'name':_0xb385('0xa8'),'field':_0xb385('0x2d'),'foreignKey':_0xb385('0xa4'),'model':_0xb385('0xa5'),'filter':{'field':'role','value':[_0xb385('0xa9')]}},{'name':_0xb385('0xaa'),'field':_0xb385('0x2d'),'foreignKey':_0xb385('0xab'),'model':_0xb385('0xac'),'filter':{'field':_0xb385('0x33'),'value':[_0xb385('0xad')]}},{'name':'QueueCampaigns','field':_0xb385('0x2d'),'foreignKey':_0xb385('0xab'),'model':_0xb385('0xac'),'filter':{'field':_0xb385('0x33'),'value':[_0xb385('0xae')]}}];break;case'musiconholds':_0x3865f5['childModel']='VoiceMusicOnHold';break;case _0xb385('0xaf'):_0x3865f5[_0xb385('0x72')]='VoiceChanSpy';break;case'voiceprefixes':_0x3865f5[_0xb385('0x72')]=_0xb385('0xb0');break;case _0xb385('0xb1'):_0x3865f5[_0xb385('0x72')]=_0xb385('0xb2');break;case'mailqueues':_0x3865f5[_0xb385('0x72')]=_0xb385('0xb3');break;case _0xb385('0xb4'):_0x3865f5[_0xb385('0x72')]='MailAccount';break;case'mailsubstatuses':_0x3865f5[_0xb385('0x72')]='MailSubstatus';break;case _0xb385('0xb5'):_0x3865f5[_0xb385('0x72')]=_0xb385('0xb6');break;case _0xb385('0xb7'):_0x3865f5[_0xb385('0x72')]='OpenchannelAccount';break;case'smsqueues':_0x3865f5[_0xb385('0x72')]=_0xb385('0xb8');break;case _0xb385('0xb9'):_0x3865f5[_0xb385('0x72')]=_0xb385('0xba');break;case'whatsappqueues':_0x3865f5[_0xb385('0x72')]=_0xb385('0xbb');break;case _0xb385('0xbc'):_0x3865f5[_0xb385('0x72')]='WhatsappAccount';break;case _0xb385('0xbd'):_0x3865f5[_0xb385('0x72')]=_0xb385('0xbe');break;case _0xb385('0xbf'):case'queuecampaigns':_0x3865f5[_0xb385('0x72')]=_0xb385('0xac');if(_0x596734){_0x3865f5['parentSections']=[{'name':'VoiceQueues'},{'name':_0xb385('0xc0')}];}break;case _0xb385('0xc1'):case _0xb385('0xc2'):case _0xb385('0xc3'):_0x3865f5[_0xb385('0x72')]='User';if(_0x596734){_0x3865f5[_0xb385('0x74')]=[{'name':_0xb385('0xc4'),'filter':{'field':_0xb385('0xa6'),'value':[_0xb385('0xc5'),_0xb385('0xc6')]},'ignore':!![]},{'name':_0xb385('0xa3')},{'name':_0xb385('0xa8')}];}break;case _0xb385('0xc7'):_0x3865f5['childModel']=_0xb385('0xc8');break;case _0xb385('0xc9'):_0x3865f5[_0xb385('0x72')]=_0xb385('0xca');break;case _0xb385('0xcb'):_0x3865f5[_0xb385('0x72')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x3865f5[_0xb385('0x72')]=_0xb385('0xcc');break;case _0xb385('0xcd'):_0x3865f5['childModel']=_0xb385('0xce');break;case _0xb385('0xcf'):_0x3865f5[_0xb385('0x72')]=_0xb385('0xd0');break;case _0xb385('0xd1'):_0x3865f5['childModel']=_0xb385('0xa5');break;case'cannedanswers':_0x3865f5[_0xb385('0x72')]=_0xb385('0xd2');break;case _0xb385('0xd3'):_0x3865f5[_0xb385('0x72')]=_0xb385('0xd4');break;case _0xb385('0xd5'):_0x3865f5[_0xb385('0x72')]=_0xb385('0xd6');break;case _0xb385('0xd7'):_0x3865f5[_0xb385('0x72')]='Interval';break;case'pauses':_0x3865f5[_0xb385('0x72')]=_0xb385('0xd8');break;case'scheduler':_0x3865f5[_0xb385('0x72')]='Schedule';break;case _0xb385('0xd9'):_0x3865f5[_0xb385('0x72')]=_0xb385('0xda');break;case'tags':_0x3865f5[_0xb385('0x72')]=_0xb385('0xdb');break;case _0xb385('0xdc'):_0x3865f5[_0xb385('0x72')]=_0xb385('0xdd');break;case'triggers':_0x3865f5[_0xb385('0x72')]=_0xb385('0xde');break;case'trunks':_0x3865f5[_0xb385('0x72')]=_0xb385('0xdf');break;case'variables':_0x3865f5['childModel']=_0xb385('0xe0');break;case'plugins':_0x3865f5[_0xb385('0x72')]=_0xb385('0x68');break;case _0xb385('0xe1'):_0x3865f5[_0xb385('0x72')]=_0xb385('0x7a');_0x3865f5[_0xb385('0x74')]=[{'name':_0xb385('0xe2'),'field':'id','foreignKey':_0xb385('0x7f')}];break;case _0xb385('0xe3'):_0x3865f5[_0xb385('0x72')]='AnalyticMetric';break;case _0xb385('0xbc'):_0x3865f5[_0xb385('0x72')]='WhatsappAccount';break;default:return _0x3865f5;}return _0x3865f5;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 38b984b..48632c4 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 _0xd4a8=['hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd4a8,0x1ce));var _0x8d4a=function(_0x536bed,_0x17aea5){_0x536bed=_0x536bed-0x0;var _0x58f2cf=_0xd4a8[_0x536bed];return _0x58f2cf;};'use strict';var EventEmitter=require(_0x8d4a('0x0'));var UserProfile=require(_0x8d4a('0x1'))['db'][_0x8d4a('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8d4a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8d4a('0x4'),'afterDestroy':_0x8d4a('0x5')};function emitEvent(_0x5e5fec){return function(_0x48f77d,_0x317404,_0x399762){UserProfileEvents['emit'](_0x5e5fec+':'+_0x48f77d['id'],_0x48f77d);UserProfileEvents[_0x8d4a('0x6')](_0x5e5fec,_0x48f77d);_0x399762(null);};}for(var e in events){if(events[_0x8d4a('0x7')](e)){var event=events[e];UserProfile[_0x8d4a('0x8')](e,emitEvent(event));}}module[_0x8d4a('0x9')]=UserProfileEvents; \ No newline at end of file +var _0xa2ed=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x2c2e74,_0x5e8ebf){var _0x50db91=function(_0xfa65e3){while(--_0xfa65e3){_0x2c2e74['push'](_0x2c2e74['shift']());}};_0x50db91(++_0x5e8ebf);}(_0xa2ed,0xce));var _0xda2e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2ed[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xda2e('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xda2e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xda2e('0x2'),'afterDestroy':_0xda2e('0x3')};function emitEvent(_0x430888){return function(_0x58ebc4,_0x5502d4,_0x1ed35f){UserProfileEvents[_0xda2e('0x4')](_0x430888+':'+_0x58ebc4['id'],_0x58ebc4);UserProfileEvents[_0xda2e('0x4')](_0x430888,_0x58ebc4);_0x1ed35f(null);};}for(var e in events){if(events[_0xda2e('0x5')](e)){var event=events[e];UserProfile[_0xda2e('0x6')](e,emitEvent(event));}}module[_0xda2e('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index b4a78bf..890296b 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 _0x4619=['./userProfile.attributes','exports','define','user_profiles','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x553930,_0x250d1e){var _0x41fb15=function(_0x4f34b4){while(--_0x4f34b4){_0x553930['push'](_0x553930['shift']());}};_0x41fb15(++_0x250d1e);}(_0x4619,0x64));var _0x9461=function(_0x309fc8,_0x238564){_0x309fc8=_0x309fc8-0x0;var _0x148b84=_0x4619[_0x309fc8];return _0x148b84;};'use strict';var _=require(_0x9461('0x0'));var util=require(_0x9461('0x1'));var logger=require(_0x9461('0x2'))(_0x9461('0x3'));var moment=require(_0x9461('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9461('0x5'));var rimraf=require(_0x9461('0x6'));var config=require(_0x9461('0x7'));var attributes=require(_0x9461('0x8'));module[_0x9461('0x9')]=function(_0x5d1fd2,_0x4e2113){return _0x5d1fd2[_0x9461('0xa')]('UserProfile',attributes,{'tableName':_0x9461('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0eed=['path','rimraf','./userProfile.attributes','exports','UserProfile','user_profiles','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4d66fb,_0x98e5a6){var _0x2460ff=function(_0x52112c){while(--_0x52112c){_0x4d66fb['push'](_0x4d66fb['shift']());}};_0x2460ff(++_0x98e5a6);}(_0x0eed,0x17a));var _0xd0ee=function(_0x233d52,_0x4a6779){_0x233d52=_0x233d52-0x0;var _0x14ada3=_0x0eed[_0x233d52];return _0x14ada3;};'use strict';var _=require(_0xd0ee('0x0'));var util=require(_0xd0ee('0x1'));var logger=require(_0xd0ee('0x2'))(_0xd0ee('0x3'));var moment=require('moment');var BPromise=require(_0xd0ee('0x4'));var rp=require(_0xd0ee('0x5'));var fs=require('fs');var path=require(_0xd0ee('0x6'));var rimraf=require(_0xd0ee('0x7'));var config=require('../../config/environment');var attributes=require(_0xd0ee('0x8'));module[_0xd0ee('0x9')]=function(_0x3c7efb,_0x59217d){return _0x3c7efb['define'](_0xd0ee('0xa'),attributes,{'tableName':_0xd0ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 592eade..6759df0 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 _0x5d58=['localhost','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d58,0x187));var _0x85d5=function(_0x4c3f5a,_0x336cf9){_0x4c3f5a=_0x4c3f5a-0x0;var _0xb41426=_0x5d58[_0x4c3f5a];return _0xb41426;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d5('0x2'))(_0x85d5('0x3'));var config=require('../../config/environment');var jayson=require(_0x85d5('0x4'));var client=jayson[_0x85d5('0x5')][_0x85d5('0x6')]({'port':0x232a});config[_0x85d5('0x7')]=_['defaults'](config[_0x85d5('0x7')],{'host':_0x85d5('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85d5('0x7')]));require('./userProfile.socket')[_0x85d5('0x9')](socket);function respondWithRpcPromise(_0x2ce6b9,_0x258f0c,_0x488dcb){return new BPromise(function(_0x499b36,_0x4e147a){return client[_0x85d5('0xa')](_0x2ce6b9,_0x488dcb)[_0x85d5('0xb')](function(_0xde1063){logger[_0x85d5('0xc')](_0x85d5('0xd'),_0x258f0c,_0x85d5('0xe'));logger[_0x85d5('0xf')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x258f0c,'request\x20sent',JSON['stringify'](_0xde1063));if(_0xde1063[_0x85d5('0x10')]){if(_0xde1063[_0x85d5('0x10')][_0x85d5('0x11')]===0x1f4){logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);return _0x4e147a(_0xde1063['error'][_0x85d5('0x12')]);}logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);return _0x499b36(_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);}else{logger[_0x85d5('0xc')](_0x85d5('0xd'),_0x258f0c,_0x85d5('0xe'));_0x499b36(_0xde1063[_0x85d5('0x13')][_0x85d5('0x12')]);}})[_0x85d5('0x14')](function(_0x3df634){logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0x3df634);_0x4e147a(_0x3df634);});});} \ No newline at end of file +var _0xbd51=['request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket'];(function(_0x514a8f,_0x14db3f){var _0x307de7=function(_0x60fec8){while(--_0x60fec8){_0x514a8f['push'](_0x514a8f['shift']());}};_0x307de7(++_0x14db3f);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x36a51c,_0x1063ab){_0x36a51c=_0x36a51c-0x0;var _0x131be2=_0xbd51[_0x36a51c];return _0x131be2;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});config[_0x1bd5('0x8')]=_[_0x1bd5('0x9')](config[_0x1bd5('0x8')],{'host':_0x1bd5('0xa'),'port':0x18eb});var socket=require(_0x1bd5('0xb'))(new Redis(config['redis']));require(_0x1bd5('0xc'))['register'](socket);function respondWithRpcPromise(_0x2bd975,_0x28df8e,_0x3b868a){return new BPromise(function(_0x1fbc68,_0x2344e1){return client[_0x1bd5('0xd')](_0x2bd975,_0x3b868a)['then'](function(_0x456ef8){logger['info'](_0x1bd5('0xe'),_0x28df8e,_0x1bd5('0xf'));logger[_0x1bd5('0x10')](_0x1bd5('0x11'),_0x28df8e,_0x1bd5('0xf'),JSON[_0x1bd5('0x12')](_0x456ef8));if(_0x456ef8[_0x1bd5('0x13')]){if(_0x456ef8['error']['code']===0x1f4){logger[_0x1bd5('0x13')](_0x1bd5('0xe'),_0x28df8e,_0x456ef8[_0x1bd5('0x13')][_0x1bd5('0x14')]);return _0x2344e1(_0x456ef8['error']['message']);}logger[_0x1bd5('0x13')](_0x1bd5('0xe'),_0x28df8e,_0x456ef8[_0x1bd5('0x13')][_0x1bd5('0x14')]);return _0x1fbc68(_0x456ef8[_0x1bd5('0x13')][_0x1bd5('0x14')]);}else{logger[_0x1bd5('0x15')](_0x1bd5('0xe'),_0x28df8e,_0x1bd5('0xf'));_0x1fbc68(_0x456ef8['result']['message']);}})[_0x1bd5('0x16')](function(_0x260827){logger[_0x1bd5('0x13')](_0x1bd5('0xe'),_0x28df8e,_0x260827);_0x2344e1(_0x260827);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 5c55b1c..c51cc6c 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 _0xa176=['userProfile:','./userProfile.events','save','remove','update','removeListener','register','length'];(function(_0x291193,_0x463627){var _0x52fe0a=function(_0xc1f806){while(--_0xc1f806){_0x291193['push'](_0x291193['shift']());}};_0x52fe0a(++_0x463627);}(_0xa176,0x1a9));var _0x6a17=function(_0x388b68,_0x51ff9f){_0x388b68=_0x388b68-0x0;var _0x360229=_0xa176[_0x388b68];return _0x360229;};'use strict';var UserProfileEvents=require(_0x6a17('0x0'));var events=[_0x6a17('0x1'),_0x6a17('0x2'),_0x6a17('0x3')];function createListener(_0x18f92e,_0x173a7a){return function(_0x289f68){_0x173a7a['emit'](_0x18f92e,_0x289f68);};}function removeListener(_0x5e346c,_0x2985a7){return function(){UserProfileEvents[_0x6a17('0x4')](_0x5e346c,_0x2985a7);};}exports[_0x6a17('0x5')]=function(_0x239ce7){for(var _0x4a4eca=0x0,_0x5de02c=events[_0x6a17('0x6')];_0x4a4eca<_0x5de02c;_0x4a4eca++){var _0x2f93fc=events[_0x4a4eca];var _0x3f66a3=createListener(_0x6a17('0x7')+_0x2f93fc,_0x239ce7);UserProfileEvents['on'](_0x2f93fc,_0x3f66a3);}}; \ No newline at end of file +var _0xb648=['save','remove','update','emit','removeListener','register','length','userProfile:','./userProfile.events'];(function(_0x10603d,_0x5a0b7d){var _0x283020=function(_0x37d745){while(--_0x37d745){_0x10603d['push'](_0x10603d['shift']());}};_0x283020(++_0x5a0b7d);}(_0xb648,0x1ee));var _0x8b64=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0xb648[_0x90f34f];return _0x4b18cf;};'use strict';var UserProfileEvents=require(_0x8b64('0x0'));var events=[_0x8b64('0x1'),_0x8b64('0x2'),_0x8b64('0x3')];function createListener(_0x295665,_0x526860){return function(_0xd7a35d){_0x526860[_0x8b64('0x4')](_0x295665,_0xd7a35d);};}function removeListener(_0x4d65fc,_0x32293a){return function(){UserProfileEvents[_0x8b64('0x5')](_0x4d65fc,_0x32293a);};}exports[_0x8b64('0x6')]=function(_0x1a20b8){for(var _0x289776=0x0,_0x595d0c=events[_0x8b64('0x7')];_0x289776<_0x595d0c;_0x289776++){var _0x24d4ce=events[_0x289776];var _0x20a4c7=createListener(_0x8b64('0x8')+_0x24d4ce,_0x1a20b8);UserProfileEvents['on'](_0x24d4ce,_0x20a4c7);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index e5f8c02..5f6ef3e 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 _0x7246=['./userProfileResource.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x380236,_0x4e73eb){var _0x594b01=function(_0x40e98a){while(--_0x40e98a){_0x380236['push'](_0x380236['shift']());}};_0x594b01(++_0x4e73eb);}(_0x7246,0x1c2));var _0x6724=function(_0x5330e5,_0x56954a){_0x5330e5=_0x5330e5-0x0;var _0x49dcd6=_0x7246[_0x5330e5];return _0x49dcd6;};'use strict';var multer=require(_0x6724('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6724('0x1')]();var fs_extra=require(_0x6724('0x2'));var auth=require(_0x6724('0x3'));var interaction=require(_0x6724('0x4'));var config=require(_0x6724('0x5'));var controller=require(_0x6724('0x6'));router[_0x6724('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6724('0x7')](_0x6724('0x8'),auth[_0x6724('0x9')](),controller['describe']);router[_0x6724('0x7')](_0x6724('0xa'),auth[_0x6724('0x9')](),controller[_0x6724('0xb')]);router[_0x6724('0xc')]('/',auth[_0x6724('0x9')](),controller[_0x6724('0xd')]);router[_0x6724('0xe')]('/:id',auth[_0x6724('0x9')](),controller[_0x6724('0xf')]);router[_0x6724('0x10')](_0x6724('0xa'),auth['isAuthenticated'](),controller[_0x6724('0x11')]);module[_0x6724('0x12')]=router; \ No newline at end of file +var _0x5d4f=['put','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id','show','post','create'];(function(_0x16304e,_0x228d67){var _0x18cd32=function(_0x574ac6){while(--_0x574ac6){_0x16304e['push'](_0x16304e['shift']());}};_0x18cd32(++_0x228d67);}(_0x5d4f,0x124));var _0xf5d4=function(_0x328e46,_0x1d3af6){_0x328e46=_0x328e46-0x0;var _0x57ed60=_0x5d4f[_0x328e46];return _0x57ed60;};'use strict';var multer=require(_0xf5d4('0x0'));var util=require(_0xf5d4('0x1'));var path=require('path');var timeout=require(_0xf5d4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf5d4('0x3'));var auth=require(_0xf5d4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf5d4('0x5'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xf5d4('0x6')](),controller['index']);router['get'](_0xf5d4('0x7'),auth['isAuthenticated'](),controller[_0xf5d4('0x8')]);router[_0xf5d4('0x9')](_0xf5d4('0xa'),auth['isAuthenticated'](),controller[_0xf5d4('0xb')]);router[_0xf5d4('0xc')]('/',auth[_0xf5d4('0x6')](),controller[_0xf5d4('0xd')]);router[_0xf5d4('0xe')]('/:id',auth[_0xf5d4('0x6')](),controller['update']);router['delete'](_0xf5d4('0xa'),auth[_0xf5d4('0x6')](),controller[_0xf5d4('0xf')]);module[_0xf5d4('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index d72647b..d065471 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 _0xafa6=['sequelize','exports','STRING','INTEGER'];(function(_0x174eda,_0x41382b){var _0x3ad12f=function(_0x48f5b6){while(--_0x48f5b6){_0x174eda['push'](_0x174eda['shift']());}};_0x3ad12f(++_0x41382b);}(_0xafa6,0x168));var _0x6afa=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xafa6[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0x6afa('0x0'));module[_0x6afa('0x1')]={'name':{'type':Sequelize[_0x6afa('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6afa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6afa('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7243=['INTEGER','exports','STRING'];(function(_0xc397a1,_0x38eae3){var _0x250b0e=function(_0x13b900){while(--_0x13b900){_0xc397a1['push'](_0xc397a1['shift']());}};_0x250b0e(++_0x38eae3);}(_0x7243,0xbe));var _0x3724=function(_0x573a9d,_0x1e38e0){_0x573a9d=_0x573a9d-0x0;var _0x3d1a45=_0x7243[_0x573a9d];return _0x3d1a45;};'use strict';var Sequelize=require('sequelize');module[_0x3724('0x0')]={'name':{'type':Sequelize[_0x3724('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x3724('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3724('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 291c329..89196af 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 _0x4621=['Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','VIRTUAL','filter','includeAll','findAll','rows','catch','params','options','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x1e13e6,_0x2575da){var _0xa63048=function(_0x1bd1a1){while(--_0x1bd1a1){_0x1e13e6['push'](_0x1e13e6['shift']());}};_0xa63048(++_0x2575da);}(_0x4621,0x78));var _0x1462=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4621[_0x59ee6f];return _0x4c0979;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1462('0x0'));var rimraf=require(_0x1462('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1462('0x2'));var rp=require('request-promise');var moment=require(_0x1462('0x3'));var BPromise=require(_0x1462('0x4'));var Mustache=require(_0x1462('0x5'));var util=require(_0x1462('0x6'));var path=require('path');var sox=require(_0x1462('0x7'));var csv=require(_0x1462('0x8'));var ejs=require(_0x1462('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1462('0xa'));var squel=require(_0x1462('0xb'));var crypto=require(_0x1462('0xc'));var jsforce=require(_0x1462('0xd'));var deskjs=require(_0x1462('0xe'));var toCsv=require(_0x1462('0x8'));var querystring=require('querystring');var Papa=require(_0x1462('0xf'));var Redis=require(_0x1462('0x10'));var authService=require(_0x1462('0x11'));var qs=require(_0x1462('0x12'));var as=require(_0x1462('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1462('0x14'))('api');var utils=require(_0x1462('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1462('0x16'));var db=require(_0x1462('0x17'))['db'];function respondWithStatusCode(_0x41c618,_0x297b3c){_0x297b3c=_0x297b3c||0xcc;return function(_0x26e6be){if(_0x26e6be){return _0x41c618[_0x1462('0x18')](_0x297b3c);}return _0x41c618[_0x1462('0x19')](_0x297b3c)[_0x1462('0x1a')]();};}function respondWithResult(_0x50acb0,_0x1bbd19){_0x1bbd19=_0x1bbd19||0xc8;return function(_0xf5c841){if(_0xf5c841){return _0x50acb0[_0x1462('0x19')](_0x1bbd19)[_0x1462('0x1b')](_0xf5c841);}};}function respondWithFilteredResult(_0x1d6eca,_0x1f8c96){return function(_0x290c67){if(_0x290c67){var _0x2e11e8=_0x290c67[_0x1462('0x1c')],_0x515926=_0x1f8c96[_0x1462('0x1d')],_0x2eabe8=_0x1f8c96[_0x1462('0x1d')]+_0x1f8c96[_0x1462('0x1e')],_0x2493b6;if(_0x2eabe8>=_0x2e11e8){_0x2eabe8=_0x2e11e8;_0x2493b6=0xc8;}else{_0x2493b6=0xce;}_0x1d6eca[_0x1462('0x19')](_0x2493b6);return _0x1d6eca[_0x1462('0x1f')](_0x1462('0x20'),_0x515926+'-'+_0x2eabe8+'/'+_0x2e11e8)[_0x1462('0x1b')](_0x290c67);}return null;};}function patchUpdates(_0x4ca3fc){return function(_0x5ac421){try{jsonpatch[_0x1462('0x21')](_0x5ac421,_0x4ca3fc,!![]);}catch(_0x328ce1){return BPromise[_0x1462('0x22')](_0x328ce1);}return _0x5ac421[_0x1462('0x23')]();};}function saveUpdates(_0xf11e6c,_0x294d89){return function(_0x282acb){if(_0x282acb){return _0x282acb['update'](_0xf11e6c)[_0x1462('0x24')](function(_0x3c013a){return _0x3c013a;});}return null;};}function removeEntity(_0x5191d6,_0xc27f40){return function(_0x26d8a5){if(_0x26d8a5){return _0x26d8a5[_0x1462('0x25')]()[_0x1462('0x24')](function(){_0x5191d6[_0x1462('0x19')](0xcc)[_0x1462('0x1a')]();});}};}function handleEntityNotFound(_0x54d7dd,_0xdc2a9c){return function(_0x3792b2){if(!_0x3792b2){_0x54d7dd[_0x1462('0x18')](0x194);}return _0x3792b2;};}function handleError(_0x11dc2c,_0x4b033d){_0x4b033d=_0x4b033d||0x1f4;return function(_0x1ffa88){logger[_0x1462('0x26')](_0x1ffa88[_0x1462('0x27')]);if(_0x1ffa88[_0x1462('0x28')]){delete _0x1ffa88[_0x1462('0x28')];}_0x11dc2c['status'](_0x4b033d)[_0x1462('0x29')](_0x1ffa88);};}exports[_0x1462('0x2a')]=function(_0x1e09ba,_0x104362){var _0x4926b1={},_0x34c70a={},_0x2bb6ed={'count':0x0,'rows':[]};var _0x4abcc0=_['map'](db[_0x1462('0x2b')][_0x1462('0x2c')],function(_0x5a4aa5){return{'name':_0x5a4aa5[_0x1462('0x2d')],'type':_0x5a4aa5[_0x1462('0x2e')]['key']};});_0x34c70a[_0x1462('0x2f')]=_['map'](_0x4abcc0,_0x1462('0x28'));_0x34c70a[_0x1462('0x30')]=_[_0x1462('0x31')](_0x1e09ba['query']);_0x34c70a[_0x1462('0x32')]=_['intersection'](_0x34c70a[_0x1462('0x2f')],_0x34c70a[_0x1462('0x30')]);_0x4926b1[_0x1462('0x33')]=_[_0x1462('0x34')](_0x34c70a[_0x1462('0x2f')],qs['fields'](_0x1e09ba['query'][_0x1462('0x35')]));_0x4926b1['attributes']=_0x4926b1[_0x1462('0x33')][_0x1462('0x36')]?_0x4926b1[_0x1462('0x33')]:_0x34c70a[_0x1462('0x2f')];if(!_0x1e09ba['query'][_0x1462('0x37')](_0x1462('0x38'))){_0x4926b1[_0x1462('0x1e')]=qs[_0x1462('0x1e')](_0x1e09ba['query'][_0x1462('0x1e')]);_0x4926b1[_0x1462('0x1d')]=qs[_0x1462('0x1d')](_0x1e09ba['query'][_0x1462('0x1d')]);}_0x4926b1[_0x1462('0x39')]=qs[_0x1462('0x3a')](_0x1e09ba[_0x1462('0x30')][_0x1462('0x3a')]);_0x4926b1['where']=qs['filters'](_[_0x1462('0x3b')](_0x1e09ba[_0x1462('0x30')],_0x34c70a[_0x1462('0x32')]),_0x4abcc0);if(_0x1e09ba['query']['filter']){_0x4926b1[_0x1462('0x3c')]=_[_0x1462('0x3d')](_0x4926b1['where'],{'$or':_[_0x1462('0x3e')](_0x4abcc0,function(_0x6139b){if(_0x6139b['type']!==_0x1462('0x3f')){var _0x41224f={};_0x41224f[_0x6139b[_0x1462('0x28')]]={'$like':'%'+_0x1e09ba['query'][_0x1462('0x40')]+'%'};return _0x41224f;}})});}_0x4926b1=_[_0x1462('0x3d')]({},_0x4926b1,_0x1e09ba['options']);var _0x86915e={'where':_0x4926b1['where']};return db[_0x1462('0x2b')]['count'](_0x86915e)['then'](function(_0x5c05cc){_0x2bb6ed[_0x1462('0x1c')]=_0x5c05cc;if(_0x1e09ba[_0x1462('0x30')][_0x1462('0x41')]){_0x4926b1['include']=[{'all':!![]}];}return db[_0x1462('0x2b')][_0x1462('0x42')](_0x4926b1);})[_0x1462('0x24')](function(_0x2aa2c1){_0x2bb6ed[_0x1462('0x43')]=_0x2aa2c1;return _0x2bb6ed;})[_0x1462('0x24')](respondWithFilteredResult(_0x104362,_0x4926b1))[_0x1462('0x44')](handleError(_0x104362,null));};exports['show']=function(_0x45d937,_0x1cb52d){var _0x25591c={'raw':![],'where':{'id':_0x45d937[_0x1462('0x45')]['id']}},_0x139eca={};_0x139eca[_0x1462('0x2f')]=_['keys'](db[_0x1462('0x2b')][_0x1462('0x2c')]);_0x139eca['query']=_[_0x1462('0x31')](_0x45d937[_0x1462('0x30')]);_0x139eca[_0x1462('0x32')]=_['intersection'](_0x139eca[_0x1462('0x2f')],_0x139eca['query']);_0x25591c[_0x1462('0x33')]=_[_0x1462('0x34')](_0x139eca[_0x1462('0x2f')],qs[_0x1462('0x35')](_0x45d937[_0x1462('0x30')]['fields']));_0x25591c[_0x1462('0x33')]=_0x25591c[_0x1462('0x33')][_0x1462('0x36')]?_0x25591c['attributes']:_0x139eca[_0x1462('0x2f')];if(_0x45d937[_0x1462('0x30')][_0x1462('0x41')]){_0x25591c['include']=[{'all':!![]}];}_0x25591c=_[_0x1462('0x3d')]({},_0x25591c,_0x45d937[_0x1462('0x46')]);return db[_0x1462('0x2b')]['find'](_0x25591c)[_0x1462('0x24')](handleEntityNotFound(_0x1cb52d,null))[_0x1462('0x24')](respondWithResult(_0x1cb52d,null))[_0x1462('0x44')](handleError(_0x1cb52d,null));};exports[_0x1462('0x47')]=function(_0xd92f21,_0x434a9f){return db[_0x1462('0x2b')][_0x1462('0x47')](_0xd92f21[_0x1462('0x48')],{})[_0x1462('0x24')](respondWithResult(_0x434a9f,0xc9))[_0x1462('0x44')](handleError(_0x434a9f,null));};exports[_0x1462('0x49')]=function(_0x470a62,_0x583a36){if(_0x470a62[_0x1462('0x48')]['id']){delete _0x470a62[_0x1462('0x48')]['id'];}return db[_0x1462('0x2b')]['find']({'where':{'id':_0x470a62[_0x1462('0x45')]['id']}})['then'](handleEntityNotFound(_0x583a36,null))['then'](saveUpdates(_0x470a62[_0x1462('0x48')],null))[_0x1462('0x24')](respondWithResult(_0x583a36,null))[_0x1462('0x44')](handleError(_0x583a36,null));};exports['destroy']=function(_0x15f944,_0x162d30){return db[_0x1462('0x2b')][_0x1462('0x4a')]({'where':{'id':_0x15f944['params']['id']}})[_0x1462('0x24')](handleEntityNotFound(_0x162d30,null))[_0x1462('0x24')](removeEntity(_0x162d30,null))[_0x1462('0x44')](handleError(_0x162d30,null));};exports['describe']=function(_0x268341,_0x42ba0f){return db[_0x1462('0x2b')][_0x1462('0x4b')]()[_0x1462('0x24')](respondWithResult(_0x42ba0f,null))[_0x1462('0x44')](handleError(_0x42ba0f,null));}; \ No newline at end of file +var _0xc16e=['count','findAll','rows','catch','show','rawAttributes','includeAll','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','UserProfileResource','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','filters','pick','filter','where','merge','VIRTUAL','options'];(function(_0x1b544f,_0x216fdf){var _0x51a768=function(_0x577294){while(--_0x577294){_0x1b544f['push'](_0x1b544f['shift']());}};_0x51a768(++_0x216fdf);}(_0xc16e,0xa6));var _0xec16=function(_0x3b3932,_0x460402){_0x3b3932=_0x3b3932-0x0;var _0x5eb36e=_0xc16e[_0x3b3932];return _0x5eb36e;};'use strict';var pdf=require(_0xec16('0x0'));var emlformat=require(_0xec16('0x1'));var rimraf=require(_0xec16('0x2'));var zipdir=require(_0xec16('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec16('0x4'));var moment=require('moment');var BPromise=require(_0xec16('0x5'));var Mustache=require(_0xec16('0x6'));var util=require(_0xec16('0x7'));var path=require(_0xec16('0x8'));var sox=require(_0xec16('0x9'));var csv=require(_0xec16('0xa'));var ejs=require(_0xec16('0xb'));var fs=require('fs');var fs_extra=require(_0xec16('0xc'));var _=require(_0xec16('0xd'));var squel=require('squel');var crypto=require(_0xec16('0xe'));var jsforce=require(_0xec16('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xec16('0x10'));var Papa=require(_0xec16('0x11'));var Redis=require('ioredis');var authService=require(_0xec16('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xec16('0x13'));var hardwareService=require(_0xec16('0x14'));var logger=require('../../config/logger')(_0xec16('0x15'));var utils=require(_0xec16('0x16'));var config=require(_0xec16('0x17'));var licenseUtil=require(_0xec16('0x18'));var db=require(_0xec16('0x19'))['db'];function respondWithStatusCode(_0x4c8523,_0x981388){_0x981388=_0x981388||0xcc;return function(_0x484ef5){if(_0x484ef5){return _0x4c8523[_0xec16('0x1a')](_0x981388);}return _0x4c8523[_0xec16('0x1b')](_0x981388)['end']();};}function respondWithResult(_0xbe67ad,_0x23ba42){_0x23ba42=_0x23ba42||0xc8;return function(_0x1891a3){if(_0x1891a3){return _0xbe67ad[_0xec16('0x1b')](_0x23ba42)[_0xec16('0x1c')](_0x1891a3);}};}function respondWithFilteredResult(_0x5a8f2f,_0x1a7eb2){return function(_0x26deaa){if(_0x26deaa){var _0x3e73f2=_0x26deaa['count'],_0x26206c=_0x1a7eb2[_0xec16('0x1d')],_0x2f2dbc=_0x1a7eb2['offset']+_0x1a7eb2[_0xec16('0x1e')],_0x1d543d;if(_0x2f2dbc>=_0x3e73f2){_0x2f2dbc=_0x3e73f2;_0x1d543d=0xc8;}else{_0x1d543d=0xce;}_0x5a8f2f[_0xec16('0x1b')](_0x1d543d);return _0x5a8f2f[_0xec16('0x1f')](_0xec16('0x20'),_0x26206c+'-'+_0x2f2dbc+'/'+_0x3e73f2)[_0xec16('0x1c')](_0x26deaa);}return null;};}function patchUpdates(_0x5b6967){return function(_0x1743d8){try{jsonpatch[_0xec16('0x21')](_0x1743d8,_0x5b6967,!![]);}catch(_0x2fe9ec){return BPromise[_0xec16('0x22')](_0x2fe9ec);}return _0x1743d8[_0xec16('0x23')]();};}function saveUpdates(_0x151ae9,_0x2f552b){return function(_0x54ec87){if(_0x54ec87){return _0x54ec87[_0xec16('0x24')](_0x151ae9)[_0xec16('0x25')](function(_0xcfd41){return _0xcfd41;});}return null;};}function removeEntity(_0x2ac566,_0x44b485){return function(_0x5745c7){if(_0x5745c7){return _0x5745c7[_0xec16('0x26')]()['then'](function(){_0x2ac566['status'](0xcc)[_0xec16('0x27')]();});}};}function handleEntityNotFound(_0x16f36e,_0x1e505e){return function(_0x2506a6){if(!_0x2506a6){_0x16f36e['sendStatus'](0x194);}return _0x2506a6;};}function handleError(_0x57ed8d,_0xab493c){_0xab493c=_0xab493c||0x1f4;return function(_0x5bbb4c){logger[_0xec16('0x28')](_0x5bbb4c['stack']);if(_0x5bbb4c[_0xec16('0x29')]){delete _0x5bbb4c[_0xec16('0x29')];}_0x57ed8d['status'](_0xab493c)[_0xec16('0x2a')](_0x5bbb4c);};}exports[_0xec16('0x2b')]=function(_0x37f56e,_0x2ed313){var _0x3b86a2={},_0x5614a0={},_0x37dfc0={'count':0x0,'rows':[]};var _0x33891d=_[_0xec16('0x2c')](db[_0xec16('0x2d')]['rawAttributes'],function(_0x38d51b){return{'name':_0x38d51b[_0xec16('0x2e')],'type':_0x38d51b[_0xec16('0x2f')][_0xec16('0x30')]};});_0x5614a0['model']=_[_0xec16('0x2c')](_0x33891d,_0xec16('0x29'));_0x5614a0[_0xec16('0x31')]=_[_0xec16('0x32')](_0x37f56e['query']);_0x5614a0['filters']=_[_0xec16('0x33')](_0x5614a0[_0xec16('0x34')],_0x5614a0[_0xec16('0x31')]);_0x3b86a2['attributes']=_['intersection'](_0x5614a0[_0xec16('0x34')],qs[_0xec16('0x35')](_0x37f56e[_0xec16('0x31')][_0xec16('0x35')]));_0x3b86a2[_0xec16('0x36')]=_0x3b86a2[_0xec16('0x36')][_0xec16('0x37')]?_0x3b86a2[_0xec16('0x36')]:_0x5614a0[_0xec16('0x34')];if(!_0x37f56e[_0xec16('0x31')][_0xec16('0x38')](_0xec16('0x39'))){_0x3b86a2[_0xec16('0x1e')]=qs[_0xec16('0x1e')](_0x37f56e[_0xec16('0x31')][_0xec16('0x1e')]);_0x3b86a2[_0xec16('0x1d')]=qs[_0xec16('0x1d')](_0x37f56e[_0xec16('0x31')][_0xec16('0x1d')]);}_0x3b86a2['order']=qs['sort'](_0x37f56e['query']['sort']);_0x3b86a2['where']=qs[_0xec16('0x3a')](_[_0xec16('0x3b')](_0x37f56e[_0xec16('0x31')],_0x5614a0['filters']),_0x33891d);if(_0x37f56e[_0xec16('0x31')][_0xec16('0x3c')]){_0x3b86a2[_0xec16('0x3d')]=_[_0xec16('0x3e')](_0x3b86a2[_0xec16('0x3d')],{'$or':_['map'](_0x33891d,function(_0x4332ac){if(_0x4332ac[_0xec16('0x2f')]!==_0xec16('0x3f')){var _0x14cb86={};_0x14cb86[_0x4332ac[_0xec16('0x29')]]={'$like':'%'+_0x37f56e['query'][_0xec16('0x3c')]+'%'};return _0x14cb86;}})});}_0x3b86a2=_[_0xec16('0x3e')]({},_0x3b86a2,_0x37f56e[_0xec16('0x40')]);var _0x162e19={'where':_0x3b86a2['where']};return db['UserProfileResource'][_0xec16('0x41')](_0x162e19)[_0xec16('0x25')](function(_0x313a82){_0x37dfc0[_0xec16('0x41')]=_0x313a82;if(_0x37f56e[_0xec16('0x31')]['includeAll']){_0x3b86a2['include']=[{'all':!![]}];}return db[_0xec16('0x2d')][_0xec16('0x42')](_0x3b86a2);})[_0xec16('0x25')](function(_0x55e1c8){_0x37dfc0[_0xec16('0x43')]=_0x55e1c8;return _0x37dfc0;})[_0xec16('0x25')](respondWithFilteredResult(_0x2ed313,_0x3b86a2))[_0xec16('0x44')](handleError(_0x2ed313,null));};exports[_0xec16('0x45')]=function(_0x54b9f1,_0x3e23fe){var _0x4a096e={'raw':![],'where':{'id':_0x54b9f1['params']['id']}},_0x1476b8={};_0x1476b8[_0xec16('0x34')]=_['keys'](db[_0xec16('0x2d')][_0xec16('0x46')]);_0x1476b8['query']=_[_0xec16('0x32')](_0x54b9f1[_0xec16('0x31')]);_0x1476b8['filters']=_['intersection'](_0x1476b8['model'],_0x1476b8[_0xec16('0x31')]);_0x4a096e[_0xec16('0x36')]=_[_0xec16('0x33')](_0x1476b8['model'],qs[_0xec16('0x35')](_0x54b9f1['query']['fields']));_0x4a096e['attributes']=_0x4a096e[_0xec16('0x36')][_0xec16('0x37')]?_0x4a096e['attributes']:_0x1476b8[_0xec16('0x34')];if(_0x54b9f1[_0xec16('0x31')][_0xec16('0x47')]){_0x4a096e[_0xec16('0x48')]=[{'all':!![]}];}_0x4a096e=_[_0xec16('0x3e')]({},_0x4a096e,_0x54b9f1[_0xec16('0x40')]);return db[_0xec16('0x2d')][_0xec16('0x49')](_0x4a096e)[_0xec16('0x25')](handleEntityNotFound(_0x3e23fe,null))[_0xec16('0x25')](respondWithResult(_0x3e23fe,null))[_0xec16('0x44')](handleError(_0x3e23fe,null));};exports[_0xec16('0x4a')]=function(_0x2dcaa0,_0x468753){return db[_0xec16('0x2d')]['create'](_0x2dcaa0[_0xec16('0x4b')],{})[_0xec16('0x25')](respondWithResult(_0x468753,0xc9))[_0xec16('0x44')](handleError(_0x468753,null));};exports['update']=function(_0x327dc9,_0x310a98){if(_0x327dc9[_0xec16('0x4b')]['id']){delete _0x327dc9[_0xec16('0x4b')]['id'];}return db[_0xec16('0x2d')][_0xec16('0x49')]({'where':{'id':_0x327dc9['params']['id']}})[_0xec16('0x25')](handleEntityNotFound(_0x310a98,null))['then'](saveUpdates(_0x327dc9[_0xec16('0x4b')],null))['then'](respondWithResult(_0x310a98,null))[_0xec16('0x44')](handleError(_0x310a98,null));};exports[_0xec16('0x26')]=function(_0x19920d,_0x5ab514){return db[_0xec16('0x2d')]['find']({'where':{'id':_0x19920d['params']['id']}})[_0xec16('0x25')](handleEntityNotFound(_0x5ab514,null))[_0xec16('0x25')](removeEntity(_0x5ab514,null))[_0xec16('0x44')](handleError(_0x5ab514,null));};exports['describe']=function(_0x27e250,_0x2d4003){return db[_0xec16('0x2d')][_0xec16('0x4c')]()['then'](respondWithResult(_0x2d4003,null))[_0xec16('0x44')](handleError(_0x2d4003,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 43b5931..84b8e97 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 _0xa9e3=['define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','api','moment','bluebird','request-promise','path','./userProfileResource.attributes','exports'];(function(_0x488818,_0x17c6de){var _0x30783c=function(_0x1b418c){while(--_0x1b418c){_0x488818['push'](_0x488818['shift']());}};_0x30783c(++_0x17c6de);}(_0xa9e3,0x17d));var _0x3a9e=function(_0x149f72,_0x113685){_0x149f72=_0x149f72-0x0;var _0x1fc2b5=_0xa9e3[_0x149f72];return _0x1fc2b5;};'use strict';var _=require('lodash');var util=require(_0x3a9e('0x0'));var logger=require(_0x3a9e('0x1'))(_0x3a9e('0x2'));var moment=require(_0x3a9e('0x3'));var BPromise=require(_0x3a9e('0x4'));var rp=require(_0x3a9e('0x5'));var fs=require('fs');var path=require(_0x3a9e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3a9e('0x7'));module[_0x3a9e('0x8')]=function(_0x1f2a8a,_0x2dc9d5){return _0x1f2a8a[_0x3a9e('0x9')](_0x3a9e('0xa'),attributes,{'tableName':_0x3a9e('0xb'),'paranoid':![],'indexes':[{'name':_0x3a9e('0xc'),'fields':[_0x3a9e('0xd'),_0x3a9e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c02=['../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x400b43,_0x55da4e){var _0x3c330f=function(_0x5bbd52){while(--_0x5bbd52){_0x400b43['push'](_0x400b43['shift']());}};_0x3c330f(++_0x55da4e);}(_0x5c02,0x1f1));var _0x25c0=function(_0x554c78,_0x3141b2){_0x554c78=_0x554c78-0x0;var _0x4ac480=_0x5c02[_0x554c78];return _0x4ac480;};'use strict';var _=require(_0x25c0('0x0'));var util=require(_0x25c0('0x1'));var logger=require(_0x25c0('0x2'))('api');var moment=require('moment');var BPromise=require(_0x25c0('0x3'));var rp=require(_0x25c0('0x4'));var fs=require('fs');var path=require(_0x25c0('0x5'));var rimraf=require(_0x25c0('0x6'));var config=require(_0x25c0('0x7'));var attributes=require(_0x25c0('0x8'));module['exports']=function(_0x47eb6b,_0x5ca764){return _0x47eb6b[_0x25c0('0x9')](_0x25c0('0xa'),attributes,{'tableName':_0x25c0('0xb'),'paranoid':![],'indexes':[{'name':_0x25c0('0xc'),'fields':[_0x25c0('0xd'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 4a9214c..057744c 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 _0x5123=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5123,0xeb));var _0x3512=function(_0x5d9f6d,_0x2f793b){_0x5d9f6d=_0x5d9f6d-0x0;var _0xe15257=_0x5123[_0x5d9f6d];return _0xe15257;};'use strict';var _=require('lodash');var util=require(_0x3512('0x0'));var moment=require(_0x3512('0x1'));var BPromise=require(_0x3512('0x2'));var rs=require(_0x3512('0x3'));var fs=require('fs');var Redis=require(_0x3512('0x4'));var db=require(_0x3512('0x5'))['db'];var utils=require(_0x3512('0x6'));var logger=require(_0x3512('0x7'))(_0x3512('0x8'));var config=require('../../config/environment');var jayson=require(_0x3512('0x9'));var client=jayson[_0x3512('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4114e3,_0x47db68,_0x4d5e3c){return new BPromise(function(_0x4a3c0b,_0x483f93){return client['request'](_0x4114e3,_0x4d5e3c)['then'](function(_0x506b53){logger[_0x3512('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x47db68,_0x3512('0xc'));logger[_0x3512('0xd')](_0x3512('0xe'),_0x47db68,'request\x20sent',JSON[_0x3512('0xf')](_0x506b53));if(_0x506b53[_0x3512('0x10')]){if(_0x506b53[_0x3512('0x10')][_0x3512('0x11')]===0x1f4){logger[_0x3512('0x10')](_0x3512('0x12'),_0x47db68,_0x506b53[_0x3512('0x10')][_0x3512('0x13')]);return _0x483f93(_0x506b53['error'][_0x3512('0x13')]);}logger[_0x3512('0x10')](_0x3512('0x12'),_0x47db68,_0x506b53[_0x3512('0x10')][_0x3512('0x13')]);return _0x4a3c0b(_0x506b53['error'][_0x3512('0x13')]);}else{logger[_0x3512('0xb')](_0x3512('0x12'),_0x47db68,_0x3512('0xc'));_0x4a3c0b(_0x506b53['result']['message']);}})['catch'](function(_0x34022c){logger[_0x3512('0x10')](_0x3512('0x12'),_0x47db68,_0x34022c);_0x483f93(_0x34022c);});});} \ No newline at end of file +var _0x88dc=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash'];(function(_0x3c6c45,_0x402358){var _0x4f95d2=function(_0x129edd){while(--_0x129edd){_0x3c6c45['push'](_0x3c6c45['shift']());}};_0x4f95d2(++_0x402358);}(_0x88dc,0x13f));var _0xc88d=function(_0x27793b,_0x2bec2b){_0x27793b=_0x27793b-0x0;var _0x440715=_0x88dc[_0x27793b];return _0x440715;};'use strict';var _=require(_0xc88d('0x0'));var util=require(_0xc88d('0x1'));var moment=require('moment');var BPromise=require(_0xc88d('0x2'));var rs=require(_0xc88d('0x3'));var fs=require('fs');var Redis=require(_0xc88d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc88d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc88d('0x6'));var jayson=require(_0xc88d('0x7'));var client=jayson['client'][_0xc88d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4770ba,_0x56ab22,_0x137d6d){return new BPromise(function(_0x44749d,_0x1e30d0){return client[_0xc88d('0x9')](_0x4770ba,_0x137d6d)[_0xc88d('0xa')](function(_0x11e045){logger['info'](_0xc88d('0xb'),_0x56ab22,'request\x20sent');logger['debug'](_0xc88d('0xc'),_0x56ab22,'request\x20sent',JSON[_0xc88d('0xd')](_0x11e045));if(_0x11e045[_0xc88d('0xe')]){if(_0x11e045['error'][_0xc88d('0xf')]===0x1f4){logger[_0xc88d('0xe')](_0xc88d('0xb'),_0x56ab22,_0x11e045[_0xc88d('0xe')][_0xc88d('0x10')]);return _0x1e30d0(_0x11e045['error'][_0xc88d('0x10')]);}logger['error'](_0xc88d('0xb'),_0x56ab22,_0x11e045[_0xc88d('0xe')]['message']);return _0x44749d(_0x11e045[_0xc88d('0xe')][_0xc88d('0x10')]);}else{logger['info'](_0xc88d('0xb'),_0x56ab22,_0xc88d('0x11'));_0x44749d(_0x11e045[_0xc88d('0x12')][_0xc88d('0x10')]);}})[_0xc88d('0x13')](function(_0x16d793){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x56ab22,_0x16d793);_0x1e30d0(_0x16d793);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 7a0b884..0715d7b 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 _0xbe46=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','/describe','/:id','show','post','create','put','isAuthenticated','update','delete','path','express','Router','fs-extra'];(function(_0x48bb3e,_0x47f1e0){var _0x244da0=function(_0x1d2751){while(--_0x1d2751){_0x48bb3e['push'](_0x48bb3e['shift']());}};_0x244da0(++_0x47f1e0);}(_0xbe46,0x68));var _0x6be4=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xbe46[_0x521929];return _0x632436;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6be4('0x0'));var timeout=require('connect-timeout');var express=require(_0x6be4('0x1'));var router=express[_0x6be4('0x2')]();var fs_extra=require(_0x6be4('0x3'));var auth=require(_0x6be4('0x4'));var interaction=require(_0x6be4('0x5'));var config=require(_0x6be4('0x6'));var controller=require(_0x6be4('0x7'));router[_0x6be4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6be4('0x8')](_0x6be4('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x6be4('0x8')](_0x6be4('0xa'),auth['isAuthenticated'](),controller[_0x6be4('0xb')]);router[_0x6be4('0xc')]('/',auth['isAuthenticated'](),controller[_0x6be4('0xd')]);router[_0x6be4('0xe')](_0x6be4('0xa'),auth[_0x6be4('0xf')](),controller[_0x6be4('0x10')]);router[_0x6be4('0x11')](_0x6be4('0xa'),auth[_0x6be4('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8faa=['../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x8faa,0x1c1));var _0xa8fa=function(_0x325501,_0x5242f6){_0x325501=_0x325501-0x0;var _0x2c1626=_0x8faa[_0x325501];return _0x2c1626;};'use strict';var multer=require(_0xa8fa('0x0'));var util=require(_0xa8fa('0x1'));var path=require(_0xa8fa('0x2'));var timeout=require(_0xa8fa('0x3'));var express=require('express');var router=express[_0xa8fa('0x4')]();var fs_extra=require(_0xa8fa('0x5'));var auth=require(_0xa8fa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa8fa('0x7'));var controller=require(_0xa8fa('0x8'));router[_0xa8fa('0x9')]('/',auth[_0xa8fa('0xa')](),controller['index']);router['get'](_0xa8fa('0xb'),auth[_0xa8fa('0xa')](),controller[_0xa8fa('0xc')]);router[_0xa8fa('0x9')](_0xa8fa('0xd'),auth['isAuthenticated'](),controller[_0xa8fa('0xe')]);router[_0xa8fa('0xf')]('/',auth[_0xa8fa('0xa')](),controller[_0xa8fa('0x10')]);router[_0xa8fa('0x11')](_0xa8fa('0xd'),auth[_0xa8fa('0xa')](),controller['update']);router['delete'](_0xa8fa('0xd'),auth[_0xa8fa('0xa')](),controller[_0xa8fa('0x12')]);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 00093b9..7ddeab2 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 _0x9ade=['getDataValue','split','sequelize','exports','INTEGER','BOOLEAN','STRING','crudPermissions','join'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x9ade,0x107));var _0xe9ad=function(_0x11e1ef,_0x3cbe5e){_0x11e1ef=_0x11e1ef-0x0;var _0x125d5b=_0x9ade[_0x11e1ef];return _0x125d5b;};'use strict';var Sequelize=require(_0xe9ad('0x0'));module[_0xe9ad('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xe9ad('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe9ad('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xe9ad('0x4')],'set':function(_0x4d4ee0){this['setDataValue'](_0xe9ad('0x5'),_0x4d4ee0?_0x4d4ee0[_0xe9ad('0x6')](''):[]);},'get':function(){return this[_0xe9ad('0x7')](_0xe9ad('0x5'))?this[_0xe9ad('0x7')](_0xe9ad('0x5'))[_0xe9ad('0x8')](''):[];}}}; \ No newline at end of file +var _0xf82e=['split','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x42be60,_0x48b3fb){var _0x323e2b=function(_0xef8bc0){while(--_0xef8bc0){_0x42be60['push'](_0x42be60['shift']());}};_0x323e2b(++_0x48b3fb);}(_0xf82e,0x172));var _0xef82=function(_0x294b13,_0x368a13){_0x294b13=_0x294b13-0x0;var _0x13b88c=_0xf82e[_0x294b13];return _0x13b88c;};'use strict';var Sequelize=require(_0xef82('0x0'));module[_0xef82('0x1')]={'name':{'type':Sequelize[_0xef82('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xef82('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xef82('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xef82('0x2')],'set':function(_0x8a36d1){this[_0xef82('0x4')](_0xef82('0x5'),_0x8a36d1?_0x8a36d1[_0xef82('0x6')](''):[]);},'get':function(){return this[_0xef82('0x7')]('crudPermissions')?this['getDataValue'](_0xef82('0x5'))[_0xef82('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 8a9e2a2..cfd9718 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 _0x698b=['offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileSection','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','catch','show','params','intersection','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x6cbe6d,_0x37bba3){var _0x25e1c9=function(_0x2f8868){while(--_0x2f8868){_0x6cbe6d['push'](_0x6cbe6d['shift']());}};_0x25e1c9(++_0x37bba3);}(_0x698b,0x115));var _0xb698=function(_0x13b255,_0x2a3c52){_0x13b255=_0x13b255-0x0;var _0x48a5a6=_0x698b[_0x13b255];return _0x48a5a6;};'use strict';var pdf=require(_0xb698('0x0'));var emlformat=require(_0xb698('0x1'));var rimraf=require(_0xb698('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb698('0x3'));var rp=require('request-promise');var moment=require(_0xb698('0x4'));var BPromise=require(_0xb698('0x5'));var Mustache=require('mustache');var util=require(_0xb698('0x6'));var path=require(_0xb698('0x7'));var sox=require(_0xb698('0x8'));var csv=require(_0xb698('0x9'));var ejs=require(_0xb698('0xa'));var fs=require('fs');var fs_extra=require(_0xb698('0xb'));var _=require(_0xb698('0xc'));var squel=require(_0xb698('0xd'));var crypto=require(_0xb698('0xe'));var jsforce=require(_0xb698('0xf'));var deskjs=require(_0xb698('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb698('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb698('0x12'));var as=require(_0xb698('0x13'));var hardwareService=require(_0xb698('0x14'));var logger=require('../../config/logger')(_0xb698('0x15'));var utils=require('../../config/utils');var config=require(_0xb698('0x16'));var licenseUtil=require(_0xb698('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x471148,_0x48ed00){_0x48ed00=_0x48ed00||0xcc;return function(_0x57a86d){if(_0x57a86d){return _0x471148[_0xb698('0x18')](_0x48ed00);}return _0x471148[_0xb698('0x19')](_0x48ed00)[_0xb698('0x1a')]();};}function respondWithResult(_0x5929fd,_0x19142c){_0x19142c=_0x19142c||0xc8;return function(_0x2eddc9){if(_0x2eddc9){return _0x5929fd[_0xb698('0x19')](_0x19142c)['json'](_0x2eddc9);}};}function respondWithFilteredResult(_0x6663d5,_0x48089e){return function(_0x536a47){if(_0x536a47){var _0x5e8822=_0x536a47['count'],_0x51021a=_0x48089e[_0xb698('0x1b')],_0x7e9567=_0x48089e[_0xb698('0x1b')]+_0x48089e[_0xb698('0x1c')],_0x470ab2;if(_0x7e9567>=_0x5e8822){_0x7e9567=_0x5e8822;_0x470ab2=0xc8;}else{_0x470ab2=0xce;}_0x6663d5[_0xb698('0x19')](_0x470ab2);return _0x6663d5[_0xb698('0x1d')](_0xb698('0x1e'),_0x51021a+'-'+_0x7e9567+'/'+_0x5e8822)[_0xb698('0x1f')](_0x536a47);}return null;};}function patchUpdates(_0x3a739a){return function(_0x2cabed){try{jsonpatch[_0xb698('0x20')](_0x2cabed,_0x3a739a,!![]);}catch(_0x321e05){return BPromise[_0xb698('0x21')](_0x321e05);}return _0x2cabed[_0xb698('0x22')]();};}function saveUpdates(_0x503b63,_0xc13bd){return function(_0x5c6087){if(_0x5c6087){return _0x5c6087[_0xb698('0x23')](_0x503b63)[_0xb698('0x24')](function(_0x37e9c2){return _0x37e9c2;});}return null;};}function removeEntity(_0x565101,_0xa2a21c){return function(_0x1373a2){if(_0x1373a2){return _0x1373a2[_0xb698('0x25')]()[_0xb698('0x24')](function(){_0x565101[_0xb698('0x19')](0xcc)[_0xb698('0x1a')]();});}};}function handleEntityNotFound(_0x3fff57,_0x20e912){return function(_0x1a68c9){if(!_0x1a68c9){_0x3fff57[_0xb698('0x18')](0x194);}return _0x1a68c9;};}function handleError(_0x42e811,_0x31333b){_0x31333b=_0x31333b||0x1f4;return function(_0x55d9a3){logger[_0xb698('0x26')](_0x55d9a3[_0xb698('0x27')]);if(_0x55d9a3[_0xb698('0x28')]){delete _0x55d9a3[_0xb698('0x28')];}_0x42e811[_0xb698('0x19')](_0x31333b)[_0xb698('0x29')](_0x55d9a3);};}exports[_0xb698('0x2a')]=function(_0x35a2a3,_0x7f8e9){var _0x9d71d1={},_0xd1b89f={},_0x3e4e3a={'count':0x0,'rows':[]};var _0x5b3dbf=_['map'](db[_0xb698('0x2b')][_0xb698('0x2c')],function(_0x18aec4){return{'name':_0x18aec4['fieldName'],'type':_0x18aec4[_0xb698('0x2d')][_0xb698('0x2e')]};});_0xd1b89f[_0xb698('0x2f')]=_[_0xb698('0x30')](_0x5b3dbf,_0xb698('0x28'));_0xd1b89f[_0xb698('0x31')]=_[_0xb698('0x32')](_0x35a2a3[_0xb698('0x31')]);_0xd1b89f[_0xb698('0x33')]=_['intersection'](_0xd1b89f[_0xb698('0x2f')],_0xd1b89f[_0xb698('0x31')]);_0x9d71d1[_0xb698('0x34')]=_['intersection'](_0xd1b89f['model'],qs['fields'](_0x35a2a3[_0xb698('0x31')][_0xb698('0x35')]));_0x9d71d1[_0xb698('0x34')]=_0x9d71d1['attributes'][_0xb698('0x36')]?_0x9d71d1[_0xb698('0x34')]:_0xd1b89f[_0xb698('0x2f')];if(!_0x35a2a3[_0xb698('0x31')][_0xb698('0x37')](_0xb698('0x38'))){_0x9d71d1[_0xb698('0x1c')]=qs['limit'](_0x35a2a3[_0xb698('0x31')]['limit']);_0x9d71d1['offset']=qs[_0xb698('0x1b')](_0x35a2a3[_0xb698('0x31')]['offset']);}_0x9d71d1[_0xb698('0x39')]=qs[_0xb698('0x3a')](_0x35a2a3[_0xb698('0x31')][_0xb698('0x3a')]);_0x9d71d1[_0xb698('0x3b')]=qs['filters'](_['pick'](_0x35a2a3[_0xb698('0x31')],_0xd1b89f['filters']),_0x5b3dbf);if(_0x35a2a3[_0xb698('0x31')][_0xb698('0x3c')]){_0x9d71d1[_0xb698('0x3b')]=_[_0xb698('0x3d')](_0x9d71d1['where'],{'$or':_[_0xb698('0x30')](_0x5b3dbf,function(_0x51802e){if(_0x51802e[_0xb698('0x2d')]!==_0xb698('0x3e')){var _0x216b91={};_0x216b91[_0x51802e[_0xb698('0x28')]]={'$like':'%'+_0x35a2a3[_0xb698('0x31')][_0xb698('0x3c')]+'%'};return _0x216b91;}})});}_0x9d71d1=_[_0xb698('0x3d')]({},_0x9d71d1,_0x35a2a3[_0xb698('0x3f')]);var _0x420292={'where':_0x9d71d1[_0xb698('0x3b')]};return db['UserProfileSection'][_0xb698('0x40')](_0x420292)[_0xb698('0x24')](function(_0xa6d634){_0x3e4e3a['count']=_0xa6d634;if(_0x35a2a3[_0xb698('0x31')]['includeAll']){_0x9d71d1[_0xb698('0x41')]=[{'all':!![]}];}return db['UserProfileSection'][_0xb698('0x42')](_0x9d71d1);})[_0xb698('0x24')](function(_0x3c04e1){_0x3e4e3a['rows']=_0x3c04e1;return _0x3e4e3a;})[_0xb698('0x24')](respondWithFilteredResult(_0x7f8e9,_0x9d71d1))[_0xb698('0x43')](handleError(_0x7f8e9,null));};exports[_0xb698('0x44')]=function(_0x22be03,_0x536d2f){var _0x6c1522={'raw':![],'where':{'id':_0x22be03[_0xb698('0x45')]['id']}},_0x469129={};_0x469129[_0xb698('0x2f')]=_[_0xb698('0x32')](db['UserProfileSection'][_0xb698('0x2c')]);_0x469129['query']=_[_0xb698('0x32')](_0x22be03[_0xb698('0x31')]);_0x469129[_0xb698('0x33')]=_[_0xb698('0x46')](_0x469129['model'],_0x469129['query']);_0x6c1522[_0xb698('0x34')]=_[_0xb698('0x46')](_0x469129[_0xb698('0x2f')],qs[_0xb698('0x35')](_0x22be03['query'][_0xb698('0x35')]));_0x6c1522['attributes']=_0x6c1522[_0xb698('0x34')][_0xb698('0x36')]?_0x6c1522[_0xb698('0x34')]:_0x469129[_0xb698('0x2f')];if(_0x22be03[_0xb698('0x31')][_0xb698('0x47')]){_0x6c1522[_0xb698('0x41')]=[{'all':!![]}];}_0x6c1522=_[_0xb698('0x3d')]({},_0x6c1522,_0x22be03['options']);return db[_0xb698('0x2b')][_0xb698('0x48')](_0x6c1522)[_0xb698('0x24')](handleEntityNotFound(_0x536d2f,null))[_0xb698('0x24')](respondWithResult(_0x536d2f,null))['catch'](handleError(_0x536d2f,null));};exports[_0xb698('0x49')]=function(_0x441c1f,_0x597da5){return db[_0xb698('0x2b')][_0xb698('0x49')](_0x441c1f['body'],{})[_0xb698('0x24')](respondWithResult(_0x597da5,0xc9))[_0xb698('0x43')](handleError(_0x597da5,null));};exports[_0xb698('0x23')]=function(_0x5d5fdd,_0x41c234){if(_0x5d5fdd['body']['id']){delete _0x5d5fdd[_0xb698('0x4a')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x5d5fdd[_0xb698('0x45')]['id']}})[_0xb698('0x24')](handleEntityNotFound(_0x41c234,null))[_0xb698('0x24')](saveUpdates(_0x5d5fdd[_0xb698('0x4a')],null))['then'](respondWithResult(_0x41c234,null))[_0xb698('0x43')](handleError(_0x41c234,null));};exports[_0xb698('0x25')]=function(_0x20191e,_0x262e16){return db[_0xb698('0x2b')][_0xb698('0x48')]({'where':{'id':_0x20191e[_0xb698('0x45')]['id']}})[_0xb698('0x24')](handleEntityNotFound(_0x262e16,null))[_0xb698('0x24')](removeEntity(_0x262e16,null))['catch'](handleError(_0x262e16,null));};exports[_0xb698('0x4b')]=function(_0x1fe003,_0x42037b){return db[_0xb698('0x2b')][_0xb698('0x4b')]()['then'](respondWithResult(_0x42037b,null))[_0xb698('0x43')](handleError(_0x42037b,null));}; \ No newline at end of file +var _0x2cd8=['VIRTUAL','options','then','includeAll','include','rows','catch','show','length','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','order','pick','filters','filter','merge','where'];(function(_0x3f3998,_0x26cbb7){var _0x40e0c1=function(_0x2def78){while(--_0x2def78){_0x3f3998['push'](_0x3f3998['shift']());}};_0x40e0c1(++_0x26cbb7);}(_0x2cd8,0x9a));var _0x82cd=function(_0x4abf10,_0x322d32){_0x4abf10=_0x4abf10-0x0;var _0x5d77d1=_0x2cd8[_0x4abf10];return _0x5d77d1;};'use strict';var pdf=require(_0x82cd('0x0'));var emlformat=require(_0x82cd('0x1'));var rimraf=require(_0x82cd('0x2'));var zipdir=require(_0x82cd('0x3'));var jsonpatch=require(_0x82cd('0x4'));var rp=require(_0x82cd('0x5'));var moment=require('moment');var BPromise=require(_0x82cd('0x6'));var Mustache=require('mustache');var util=require(_0x82cd('0x7'));var path=require('path');var sox=require(_0x82cd('0x8'));var csv=require(_0x82cd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82cd('0xa'));var squel=require('squel');var crypto=require(_0x82cd('0xb'));var jsforce=require(_0x82cd('0xc'));var deskjs=require(_0x82cd('0xd'));var toCsv=require(_0x82cd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x82cd('0xe'));var authService=require(_0x82cd('0xf'));var qs=require(_0x82cd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82cd('0x11'));var logger=require(_0x82cd('0x12'))(_0x82cd('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x82cd('0x14'))['db'];function respondWithStatusCode(_0x59daca,_0x42f8bf){_0x42f8bf=_0x42f8bf||0xcc;return function(_0x1feb2b){if(_0x1feb2b){return _0x59daca[_0x82cd('0x15')](_0x42f8bf);}return _0x59daca[_0x82cd('0x16')](_0x42f8bf)['end']();};}function respondWithResult(_0x245d58,_0x203279){_0x203279=_0x203279||0xc8;return function(_0xb6e59a){if(_0xb6e59a){return _0x245d58[_0x82cd('0x16')](_0x203279)[_0x82cd('0x17')](_0xb6e59a);}};}function respondWithFilteredResult(_0x3b0f5a,_0x3144f6){return function(_0x1e3393){if(_0x1e3393){var _0x1e38e0=_0x1e3393[_0x82cd('0x18')],_0x340dd4=_0x3144f6['offset'],_0x193a97=_0x3144f6[_0x82cd('0x19')]+_0x3144f6[_0x82cd('0x1a')],_0x5af44d;if(_0x193a97>=_0x1e38e0){_0x193a97=_0x1e38e0;_0x5af44d=0xc8;}else{_0x5af44d=0xce;}_0x3b0f5a[_0x82cd('0x16')](_0x5af44d);return _0x3b0f5a[_0x82cd('0x1b')](_0x82cd('0x1c'),_0x340dd4+'-'+_0x193a97+'/'+_0x1e38e0)[_0x82cd('0x17')](_0x1e3393);}return null;};}function patchUpdates(_0x173bed){return function(_0x1d472d){try{jsonpatch[_0x82cd('0x1d')](_0x1d472d,_0x173bed,!![]);}catch(_0x459320){return BPromise[_0x82cd('0x1e')](_0x459320);}return _0x1d472d[_0x82cd('0x1f')]();};}function saveUpdates(_0x119ebd,_0x205c17){return function(_0x37db30){if(_0x37db30){return _0x37db30[_0x82cd('0x20')](_0x119ebd)['then'](function(_0xb217de){return _0xb217de;});}return null;};}function removeEntity(_0x3e6d32,_0x12a53e){return function(_0x35ac18){if(_0x35ac18){return _0x35ac18[_0x82cd('0x21')]()['then'](function(){_0x3e6d32['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23ba73,_0x39e49c){return function(_0x3a8ae2){if(!_0x3a8ae2){_0x23ba73['sendStatus'](0x194);}return _0x3a8ae2;};}function handleError(_0x2d7f94,_0x65acab){_0x65acab=_0x65acab||0x1f4;return function(_0x720910){logger[_0x82cd('0x22')](_0x720910['stack']);if(_0x720910['name']){delete _0x720910['name'];}_0x2d7f94[_0x82cd('0x16')](_0x65acab)[_0x82cd('0x23')](_0x720910);};}exports[_0x82cd('0x24')]=function(_0xb18104,_0x3fe832){var _0x80a146={},_0x10495d={},_0x27c965={'count':0x0,'rows':[]};var _0x59ea7e=_[_0x82cd('0x25')](db[_0x82cd('0x26')][_0x82cd('0x27')],function(_0x59ce5f){return{'name':_0x59ce5f[_0x82cd('0x28')],'type':_0x59ce5f[_0x82cd('0x29')][_0x82cd('0x2a')]};});_0x10495d[_0x82cd('0x2b')]=_[_0x82cd('0x25')](_0x59ea7e,_0x82cd('0x2c'));_0x10495d[_0x82cd('0x2d')]=_[_0x82cd('0x2e')](_0xb18104['query']);_0x10495d['filters']=_[_0x82cd('0x2f')](_0x10495d[_0x82cd('0x2b')],_0x10495d[_0x82cd('0x2d')]);_0x80a146['attributes']=_[_0x82cd('0x2f')](_0x10495d[_0x82cd('0x2b')],qs[_0x82cd('0x30')](_0xb18104['query'][_0x82cd('0x30')]));_0x80a146[_0x82cd('0x31')]=_0x80a146['attributes']['length']?_0x80a146[_0x82cd('0x31')]:_0x10495d[_0x82cd('0x2b')];if(!_0xb18104[_0x82cd('0x2d')]['hasOwnProperty']('nolimit')){_0x80a146[_0x82cd('0x1a')]=qs[_0x82cd('0x1a')](_0xb18104['query'][_0x82cd('0x1a')]);_0x80a146[_0x82cd('0x19')]=qs[_0x82cd('0x19')](_0xb18104[_0x82cd('0x2d')][_0x82cd('0x19')]);}_0x80a146[_0x82cd('0x32')]=qs['sort'](_0xb18104['query']['sort']);_0x80a146['where']=qs['filters'](_[_0x82cd('0x33')](_0xb18104[_0x82cd('0x2d')],_0x10495d[_0x82cd('0x34')]),_0x59ea7e);if(_0xb18104['query'][_0x82cd('0x35')]){_0x80a146['where']=_[_0x82cd('0x36')](_0x80a146[_0x82cd('0x37')],{'$or':_[_0x82cd('0x25')](_0x59ea7e,function(_0x32791e){if(_0x32791e[_0x82cd('0x29')]!==_0x82cd('0x38')){var _0x56f7f8={};_0x56f7f8[_0x32791e[_0x82cd('0x2c')]]={'$like':'%'+_0xb18104['query'][_0x82cd('0x35')]+'%'};return _0x56f7f8;}})});}_0x80a146=_[_0x82cd('0x36')]({},_0x80a146,_0xb18104[_0x82cd('0x39')]);var _0x414852={'where':_0x80a146['where']};return db['UserProfileSection'][_0x82cd('0x18')](_0x414852)[_0x82cd('0x3a')](function(_0x576d0d){_0x27c965['count']=_0x576d0d;if(_0xb18104['query'][_0x82cd('0x3b')]){_0x80a146[_0x82cd('0x3c')]=[{'all':!![]}];}return db[_0x82cd('0x26')]['findAll'](_0x80a146);})[_0x82cd('0x3a')](function(_0x43a3b0){_0x27c965[_0x82cd('0x3d')]=_0x43a3b0;return _0x27c965;})[_0x82cd('0x3a')](respondWithFilteredResult(_0x3fe832,_0x80a146))[_0x82cd('0x3e')](handleError(_0x3fe832,null));};exports[_0x82cd('0x3f')]=function(_0x5f17c5,_0x545da0){var _0x132f8a={'raw':![],'where':{'id':_0x5f17c5['params']['id']}},_0x25c419={};_0x25c419['model']=_['keys'](db['UserProfileSection'][_0x82cd('0x27')]);_0x25c419[_0x82cd('0x2d')]=_['keys'](_0x5f17c5[_0x82cd('0x2d')]);_0x25c419['filters']=_[_0x82cd('0x2f')](_0x25c419[_0x82cd('0x2b')],_0x25c419[_0x82cd('0x2d')]);_0x132f8a[_0x82cd('0x31')]=_[_0x82cd('0x2f')](_0x25c419[_0x82cd('0x2b')],qs['fields'](_0x5f17c5['query']['fields']));_0x132f8a[_0x82cd('0x31')]=_0x132f8a['attributes'][_0x82cd('0x40')]?_0x132f8a[_0x82cd('0x31')]:_0x25c419['model'];if(_0x5f17c5[_0x82cd('0x2d')][_0x82cd('0x3b')]){_0x132f8a[_0x82cd('0x3c')]=[{'all':!![]}];}_0x132f8a=_['merge']({},_0x132f8a,_0x5f17c5[_0x82cd('0x39')]);return db[_0x82cd('0x26')][_0x82cd('0x41')](_0x132f8a)[_0x82cd('0x3a')](handleEntityNotFound(_0x545da0,null))[_0x82cd('0x3a')](respondWithResult(_0x545da0,null))[_0x82cd('0x3e')](handleError(_0x545da0,null));};exports[_0x82cd('0x42')]=function(_0x430771,_0x2a87e7){return db[_0x82cd('0x26')]['create'](_0x430771[_0x82cd('0x43')],{})['then'](respondWithResult(_0x2a87e7,0xc9))[_0x82cd('0x3e')](handleError(_0x2a87e7,null));};exports[_0x82cd('0x20')]=function(_0x28765c,_0x5146c6){if(_0x28765c[_0x82cd('0x43')]['id']){delete _0x28765c[_0x82cd('0x43')]['id'];}return db[_0x82cd('0x26')]['find']({'where':{'id':_0x28765c[_0x82cd('0x44')]['id']}})[_0x82cd('0x3a')](handleEntityNotFound(_0x5146c6,null))[_0x82cd('0x3a')](saveUpdates(_0x28765c['body'],null))[_0x82cd('0x3a')](respondWithResult(_0x5146c6,null))[_0x82cd('0x3e')](handleError(_0x5146c6,null));};exports[_0x82cd('0x21')]=function(_0x36a582,_0x28849c){return db['UserProfileSection']['find']({'where':{'id':_0x36a582[_0x82cd('0x44')]['id']}})[_0x82cd('0x3a')](handleEntityNotFound(_0x28849c,null))[_0x82cd('0x3a')](removeEntity(_0x28849c,null))[_0x82cd('0x3e')](handleError(_0x28849c,null));};exports[_0x82cd('0x45')]=function(_0x51baf8,_0x3fad5e){return db[_0x82cd('0x26')][_0x82cd('0x45')]()[_0x82cd('0x3a')](respondWithResult(_0x3fad5e,null))['catch'](handleError(_0x3fad5e,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 5142f56..dd08170 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 _0xc48a=['request-promise','path','rimraf','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','moment','bluebird'];(function(_0x5607f9,_0x2d9756){var _0xca6370=function(_0x1a057d){while(--_0x1a057d){_0x5607f9['push'](_0x5607f9['shift']());}};_0xca6370(++_0x2d9756);}(_0xc48a,0x1ea));var _0xac48=function(_0x3f78c1,_0xf47030){_0x3f78c1=_0x3f78c1-0x0;var _0x3e8c28=_0xc48a[_0x3f78c1];return _0x3e8c28;};'use strict';var _=require('lodash');var util=require(_0xac48('0x0'));var logger=require(_0xac48('0x1'))(_0xac48('0x2'));var moment=require(_0xac48('0x3'));var BPromise=require(_0xac48('0x4'));var rp=require(_0xac48('0x5'));var fs=require('fs');var path=require(_0xac48('0x6'));var rimraf=require(_0xac48('0x7'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0xac48('0x8')]=function(_0x21efd1,_0x2e4321){return _0x21efd1[_0xac48('0x9')](_0xac48('0xa'),attributes,{'tableName':_0xac48('0xb'),'paranoid':![],'indexes':[{'name':_0xac48('0xc'),'fields':[_0xac48('0xd'),_0xac48('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xddee=['UserProfileSection','compositeIndex','sectionId','userProfileId','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define'];(function(_0x2a0350,_0x249319){var _0x425220=function(_0x1d5f78){while(--_0x1d5f78){_0x2a0350['push'](_0x2a0350['shift']());}};_0x425220(++_0x249319);}(_0xddee,0x1d2));var _0xedde=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xddee[_0x12f688];return _0x59c3de;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xedde('0x0'))(_0xedde('0x1'));var moment=require(_0xedde('0x2'));var BPromise=require('bluebird');var rp=require(_0xedde('0x3'));var fs=require('fs');var path=require(_0xedde('0x4'));var rimraf=require(_0xedde('0x5'));var config=require(_0xedde('0x6'));var attributes=require(_0xedde('0x7'));module[_0xedde('0x8')]=function(_0x2d370e,_0x4483c7){return _0x2d370e[_0xedde('0x9')](_0xedde('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xedde('0xb'),'fields':[_0xedde('0xc'),_0xedde('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index b333ba3..a2113f7 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 _0x8ea3=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0x8ea3,0x192));var _0x38ea=function(_0x307949,_0x128256){_0x307949=_0x307949-0x0;var _0x45b4f2=_0x8ea3[_0x307949];return _0x45b4f2;};'use strict';var _=require(_0x38ea('0x0'));var util=require(_0x38ea('0x1'));var moment=require(_0x38ea('0x2'));var BPromise=require('bluebird');var rs=require(_0x38ea('0x3'));var fs=require('fs');var Redis=require(_0x38ea('0x4'));var db=require(_0x38ea('0x5'))['db'];var utils=require(_0x38ea('0x6'));var logger=require(_0x38ea('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x38ea('0x8')][_0x38ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15fb5b,_0xe01583,_0xe218d9){return new BPromise(function(_0x40da8f,_0x2a2121){return client[_0x38ea('0xa')](_0x15fb5b,_0xe218d9)[_0x38ea('0xb')](function(_0x4518c5){logger[_0x38ea('0xc')](_0x38ea('0xd'),_0xe01583,_0x38ea('0xe'));logger['debug'](_0x38ea('0xf'),_0xe01583,_0x38ea('0xe'),JSON[_0x38ea('0x10')](_0x4518c5));if(_0x4518c5[_0x38ea('0x11')]){if(_0x4518c5[_0x38ea('0x11')][_0x38ea('0x12')]===0x1f4){logger[_0x38ea('0x11')](_0x38ea('0xd'),_0xe01583,_0x4518c5[_0x38ea('0x11')][_0x38ea('0x13')]);return _0x2a2121(_0x4518c5['error'][_0x38ea('0x13')]);}logger[_0x38ea('0x11')](_0x38ea('0xd'),_0xe01583,_0x4518c5[_0x38ea('0x11')]['message']);return _0x40da8f(_0x4518c5['error'][_0x38ea('0x13')]);}else{logger[_0x38ea('0xc')](_0x38ea('0xd'),_0xe01583,_0x38ea('0xe'));_0x40da8f(_0x4518c5[_0x38ea('0x14')]['message']);}})[_0x38ea('0x15')](function(_0x4f56a3){logger['error'](_0x38ea('0xd'),_0xe01583,_0x4f56a3);_0x2a2121(_0x4f56a3);});});} \ No newline at end of file +var _0x3477=['code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x119d4f,_0x393a3f){var _0x35e65f=function(_0x2cd55e){while(--_0x2cd55e){_0x119d4f['push'](_0x119d4f['shift']());}};_0x35e65f(++_0x393a3f);}(_0x3477,0x17d));var _0x7347=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x3477[_0x53fe97];return _0x5c49a2;};'use strict';var _=require('lodash');var util=require(_0x7347('0x0'));var moment=require(_0x7347('0x1'));var BPromise=require(_0x7347('0x2'));var rs=require(_0x7347('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7347('0x4'))['db'];var utils=require(_0x7347('0x5'));var logger=require(_0x7347('0x6'))(_0x7347('0x7'));var config=require(_0x7347('0x8'));var jayson=require(_0x7347('0x9'));var client=jayson[_0x7347('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b1807,_0x49b30b,_0x4629c0){return new BPromise(function(_0x331510,_0x26d682){return client[_0x7347('0xb')](_0x1b1807,_0x4629c0)['then'](function(_0x38a22e){logger[_0x7347('0xc')](_0x7347('0xd'),_0x49b30b,_0x7347('0xe'));logger[_0x7347('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x49b30b,_0x7347('0xe'),JSON[_0x7347('0x10')](_0x38a22e));if(_0x38a22e[_0x7347('0x11')]){if(_0x38a22e['error'][_0x7347('0x12')]===0x1f4){logger[_0x7347('0x11')](_0x7347('0xd'),_0x49b30b,_0x38a22e['error'][_0x7347('0x13')]);return _0x26d682(_0x38a22e[_0x7347('0x11')][_0x7347('0x13')]);}logger[_0x7347('0x11')](_0x7347('0xd'),_0x49b30b,_0x38a22e[_0x7347('0x11')]['message']);return _0x331510(_0x38a22e[_0x7347('0x11')][_0x7347('0x13')]);}else{logger[_0x7347('0xc')](_0x7347('0xd'),_0x49b30b,_0x7347('0xe'));_0x331510(_0x38a22e[_0x7347('0x14')]['message']);}})['catch'](function(_0x425469){logger[_0x7347('0x11')](_0x7347('0xd'),_0x49b30b,_0x425469);_0x26d682(_0x425469);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 1abfc8a..7e04c4e 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 _0x5eef=['../../config/environment','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4aa3f6,_0x4cb7a6){var _0x4a9302=function(_0x423f87){while(--_0x423f87){_0x4aa3f6['push'](_0x4aa3f6['shift']());}};_0x4a9302(++_0x4cb7a6);}(_0x5eef,0x9c));var _0xf5ee=function(_0x131ecb,_0xee3761){_0x131ecb=_0x131ecb-0x0;var _0x464e12=_0x5eef[_0x131ecb];return _0x464e12;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf5ee('0x0'));var timeout=require('connect-timeout');var express=require(_0xf5ee('0x1'));var router=express['Router']();var fs_extra=require(_0xf5ee('0x2'));var auth=require(_0xf5ee('0x3'));var interaction=require(_0xf5ee('0x4'));var config=require(_0xf5ee('0x5'));module[_0xf5ee('0x6')]=router; \ No newline at end of file +var _0x4899=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','express','fs-extra'];(function(_0x5b5d42,_0x4d4ea7){var _0x471d68=function(_0x37f6fe){while(--_0x37f6fe){_0x5b5d42['push'](_0x5b5d42['shift']());}};_0x471d68(++_0x4d4ea7);}(_0x4899,0x74));var _0x9489=function(_0x280e67,_0x102e01){_0x280e67=_0x280e67-0x0;var _0x4d26e0=_0x4899[_0x280e67];return _0x4d26e0;};'use strict';var multer=require(_0x9489('0x0'));var util=require('util');var path=require(_0x9489('0x1'));var timeout=require('connect-timeout');var express=require(_0x9489('0x2'));var router=express['Router']();var fs_extra=require(_0x9489('0x3'));var auth=require(_0x9489('0x4'));var interaction=require(_0x9489('0x5'));var config=require(_0x9489('0x6'));module[_0x9489('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index f32f80e..25f9283 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x28a54a,_0x4b5999){var _0x2cfc12=function(_0x1396f6){while(--_0x1396f6){_0x28a54a['push'](_0x28a54a['shift']());}};_0x2cfc12(++_0x4b5999);}(_0xe706,0xa3));var _0x6e70=function(_0x4ab6a1,_0x4d64d5){_0x4ab6a1=_0x4ab6a1-0x0;var _0x2a24cc=_0xe706[_0x4ab6a1];return _0x2a24cc;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x5e2343,_0x549f4e){var _0x333ce2=function(_0x397289){while(--_0x397289){_0x5e2343['push'](_0x5e2343['shift']());}};_0x333ce2(++_0x549f4e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 343b291..4ae8be5 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 _0xbd87=['bluebird','request-promise','path','rimraf','./userSmsQueue.attributes','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0xa42969,_0x2e6ecf){var _0x33d393=function(_0xbceca4){while(--_0xbceca4){_0xa42969['push'](_0xa42969['shift']());}};_0x33d393(++_0x2e6ecf);}(_0xbd87,0x1e7));var _0x7bd8=function(_0x290907,_0x1e8855){_0x290907=_0x290907-0x0;var _0x4d5e48=_0xbd87[_0x290907];return _0x4d5e48;};'use strict';var _=require(_0x7bd8('0x0'));var util=require(_0x7bd8('0x1'));var logger=require(_0x7bd8('0x2'))(_0x7bd8('0x3'));var moment=require(_0x7bd8('0x4'));var BPromise=require(_0x7bd8('0x5'));var rp=require(_0x7bd8('0x6'));var fs=require('fs');var path=require(_0x7bd8('0x7'));var rimraf=require(_0x7bd8('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bd8('0x9'));module['exports']=function(_0x399a72,_0x4341b3){return _0x399a72['define'](_0x7bd8('0xa'),attributes,{'tableName':_0x7bd8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x340b=['define','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x340b,0x122));var _0xb340=function(_0x1d02f4,_0xca26ce){_0x1d02f4=_0x1d02f4-0x0;var _0x3b9432=_0x340b[_0x1d02f4];return _0x3b9432;};'use strict';var _=require(_0xb340('0x0'));var util=require(_0xb340('0x1'));var logger=require(_0xb340('0x2'))(_0xb340('0x3'));var moment=require(_0xb340('0x4'));var BPromise=require(_0xb340('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb340('0x6'));var rimraf=require('rimraf');var config=require(_0xb340('0x7'));var attributes=require(_0xb340('0x8'));module[_0xb340('0x9')]=function(_0xe60d8c,_0x4b564d){return _0xe60d8c[_0xb340('0xa')]('UserSmsQueue',attributes,{'tableName':_0xb340('0xb'),'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 fe0399a..e3916a9 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 _0x38f0=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x53c4f8,_0x44ccaf){var _0x416458=function(_0x2632aa){while(--_0x2632aa){_0x53c4f8['push'](_0x53c4f8['shift']());}};_0x416458(++_0x44ccaf);}(_0x38f0,0x12c));var _0x038f=function(_0x59ad55,_0x30fb5e){_0x59ad55=_0x59ad55-0x0;var _0x39f7fe=_0x38f0[_0x59ad55];return _0x39f7fe;};'use strict';var _=require(_0x038f('0x0'));var util=require(_0x038f('0x1'));var moment=require(_0x038f('0x2'));var BPromise=require(_0x038f('0x3'));var rs=require(_0x038f('0x4'));var fs=require('fs');var Redis=require(_0x038f('0x5'));var db=require(_0x038f('0x6'))['db'];var utils=require(_0x038f('0x7'));var logger=require(_0x038f('0x8'))('rpc');var config=require(_0x038f('0x9'));var jayson=require(_0x038f('0xa'));var client=jayson[_0x038f('0xb')][_0x038f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4520f4,_0x33fb32,_0x42822d){return new BPromise(function(_0x4ebcab,_0x45054b){return client[_0x038f('0xd')](_0x4520f4,_0x42822d)[_0x038f('0xe')](function(_0x2ef034){logger[_0x038f('0xf')](_0x038f('0x10'),_0x33fb32,'request\x20sent');logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x33fb32,'request\x20sent',JSON[_0x038f('0x11')](_0x2ef034));if(_0x2ef034[_0x038f('0x12')]){if(_0x2ef034[_0x038f('0x12')][_0x038f('0x13')]===0x1f4){logger['error'](_0x038f('0x10'),_0x33fb32,_0x2ef034[_0x038f('0x12')][_0x038f('0x14')]);return _0x45054b(_0x2ef034[_0x038f('0x12')][_0x038f('0x14')]);}logger[_0x038f('0x12')](_0x038f('0x10'),_0x33fb32,_0x2ef034[_0x038f('0x12')][_0x038f('0x14')]);return _0x4ebcab(_0x2ef034['error'][_0x038f('0x14')]);}else{logger[_0x038f('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x33fb32,_0x038f('0x15'));_0x4ebcab(_0x2ef034[_0x038f('0x16')]['message']);}})['catch'](function(_0x1c8529){logger['error'](_0x038f('0x10'),_0x33fb32,_0x1c8529);_0x45054b(_0x1c8529);});});} \ No newline at end of file +var _0x1296=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x28fb03,_0x5d9b89){var _0x24e34b=function(_0x33fd66){while(--_0x33fd66){_0x28fb03['push'](_0x28fb03['shift']());}};_0x24e34b(++_0x5d9b89);}(_0x1296,0xb5));var _0x6129=function(_0x169e20,_0x568843){_0x169e20=_0x169e20-0x0;var _0x4afc8e=_0x1296[_0x169e20];return _0x4afc8e;};'use strict';var _=require(_0x6129('0x0'));var util=require('util');var moment=require(_0x6129('0x1'));var BPromise=require(_0x6129('0x2'));var rs=require(_0x6129('0x3'));var fs=require('fs');var Redis=require(_0x6129('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6129('0x5'));var logger=require(_0x6129('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6129('0x7'));var client=jayson[_0x6129('0x8')][_0x6129('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53d1a0,_0x4f801c,_0x254df0){return new BPromise(function(_0xd4d559,_0xac7db0){return client[_0x6129('0xa')](_0x53d1a0,_0x254df0)[_0x6129('0xb')](function(_0x39f4d2){logger[_0x6129('0xc')](_0x6129('0xd'),_0x4f801c,_0x6129('0xe'));logger['debug'](_0x6129('0xf'),_0x4f801c,'request\x20sent',JSON[_0x6129('0x10')](_0x39f4d2));if(_0x39f4d2[_0x6129('0x11')]){if(_0x39f4d2['error'][_0x6129('0x12')]===0x1f4){logger[_0x6129('0x11')](_0x6129('0xd'),_0x4f801c,_0x39f4d2[_0x6129('0x11')][_0x6129('0x13')]);return _0xac7db0(_0x39f4d2[_0x6129('0x11')][_0x6129('0x13')]);}logger[_0x6129('0x11')](_0x6129('0xd'),_0x4f801c,_0x39f4d2[_0x6129('0x11')]['message']);return _0xd4d559(_0x39f4d2['error'][_0x6129('0x13')]);}else{logger[_0x6129('0xc')](_0x6129('0xd'),_0x4f801c,_0x6129('0xe'));_0xd4d559(_0x39f4d2[_0x6129('0x14')][_0x6129('0x13')]);}})[_0x6129('0x15')](function(_0x30dda3){logger['error'](_0x6129('0xd'),_0x4f801c,_0x30dda3);_0xac7db0(_0x30dda3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 78b29d5..43ab7f0 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 _0x8227=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','exports','util','connect-timeout'];(function(_0x1c2b7c,_0x7d9049){var _0x342381=function(_0x3fd331){while(--_0x3fd331){_0x1c2b7c['push'](_0x1c2b7c['shift']());}};_0x342381(++_0x7d9049);}(_0x8227,0x146));var _0x7822=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8227[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x7822('0x0'));var path=require('path');var timeout=require(_0x7822('0x1'));var express=require(_0x7822('0x2'));var router=express[_0x7822('0x3')]();var fs_extra=require(_0x7822('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7822('0x5'));var config=require(_0x7822('0x6'));module[_0x7822('0x7')]=router; \ No newline at end of file +var _0x4227=['fs-extra','../../components/auth/service','../../config/environment','exports','multer','connect-timeout','Router'];(function(_0x3a73bc,_0x550aef){var _0x32891b=function(_0x20b4cb){while(--_0x20b4cb){_0x3a73bc['push'](_0x3a73bc['shift']());}};_0x32891b(++_0x550aef);}(_0x4227,0x89));var _0x7422=function(_0x21dc9b,_0x35eb94){_0x21dc9b=_0x21dc9b-0x0;var _0x3e0179=_0x4227[_0x21dc9b];return _0x3e0179;};'use strict';var multer=require(_0x7422('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7422('0x1'));var express=require('express');var router=express[_0x7422('0x2')]();var fs_extra=require(_0x7422('0x3'));var auth=require(_0x7422('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7422('0x5'));module[_0x7422('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index c780892..0df47fc 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x247441,_0x100a24){var _0x1d7b2c=function(_0x4378b7){while(--_0x4378b7){_0x247441['push'](_0x247441['shift']());}};_0x1d7b2c(++_0x100a24);}(_0xe706,0xa3));var _0x6e70=function(_0x34ddf1,_0x494e77){_0x34ddf1=_0x34ddf1-0x0;var _0x264cd6=_0xe706[_0x34ddf1];return _0x264cd6;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('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 cc282e4..ab4a181 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 _0x98a8=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define'];(function(_0x1196b0,_0x36c47a){var _0x111c52=function(_0x5604c7){while(--_0x5604c7){_0x1196b0['push'](_0x1196b0['shift']());}};_0x111c52(++_0x36c47a);}(_0x98a8,0x12c));var _0x898a=function(_0x339869,_0x1ba713){_0x339869=_0x339869-0x0;var _0x47bf43=_0x98a8[_0x339869];return _0x47bf43;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var logger=require(_0x898a('0x2'))(_0x898a('0x3'));var moment=require(_0x898a('0x4'));var BPromise=require(_0x898a('0x5'));var rp=require(_0x898a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var attributes=require(_0x898a('0x9'));module[_0x898a('0xa')]=function(_0x3e7ddd,_0x5d7e59){return _0x3e7ddd[_0x898a('0xb')]('UserVoiceQueue',attributes,{'tableName':_0x898a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e5=['request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','util','api','moment','bluebird'];(function(_0x37e4f1,_0x417b5b){var _0x2a654d=function(_0x509980){while(--_0x509980){_0x37e4f1['push'](_0x37e4f1['shift']());}};_0x2a654d(++_0x417b5b);}(_0x34e5,0x172));var _0x534e=function(_0x1811eb,_0xdec4b){_0x1811eb=_0x1811eb-0x0;var _0x5db54f=_0x34e5[_0x1811eb];return _0x5db54f;};'use strict';var _=require('lodash');var util=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var moment=require(_0x534e('0x2'));var BPromise=require(_0x534e('0x3'));var rp=require(_0x534e('0x4'));var fs=require('fs');var path=require(_0x534e('0x5'));var rimraf=require('rimraf');var config=require(_0x534e('0x6'));var attributes=require(_0x534e('0x7'));module[_0x534e('0x8')]=function(_0x117f0c,_0x436a92){return _0x117f0c[_0x534e('0x9')](_0x534e('0xa'),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 d944412..a37ce8d 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 _0x4f56=['code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3489d7,_0x57644d){var _0x21b195=function(_0x1600c6){while(--_0x1600c6){_0x3489d7['push'](_0x3489d7['shift']());}};_0x21b195(++_0x57644d);}(_0x4f56,0x1b4));var _0x64f5=function(_0x2a6698,_0x5c67ed){_0x2a6698=_0x2a6698-0x0;var _0x898048=_0x4f56[_0x2a6698];return _0x898048;};'use strict';var _=require('lodash');var util=require(_0x64f5('0x0'));var moment=require(_0x64f5('0x1'));var BPromise=require(_0x64f5('0x2'));var rs=require(_0x64f5('0x3'));var fs=require('fs');var Redis=require(_0x64f5('0x4'));var db=require(_0x64f5('0x5'))['db'];var utils=require(_0x64f5('0x6'));var logger=require(_0x64f5('0x7'))(_0x64f5('0x8'));var config=require(_0x64f5('0x9'));var jayson=require(_0x64f5('0xa'));var client=jayson[_0x64f5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387b67,_0x5f1120,_0x2a2e80){return new BPromise(function(_0x507bd8,_0x396f33){return client[_0x64f5('0xc')](_0x387b67,_0x2a2e80)[_0x64f5('0xd')](function(_0x4d6ed0){logger['info'](_0x64f5('0xe'),_0x5f1120,'request\x20sent');logger[_0x64f5('0xf')](_0x64f5('0x10'),_0x5f1120,_0x64f5('0x11'),JSON[_0x64f5('0x12')](_0x4d6ed0));if(_0x4d6ed0[_0x64f5('0x13')]){if(_0x4d6ed0[_0x64f5('0x13')][_0x64f5('0x14')]===0x1f4){logger[_0x64f5('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x5f1120,_0x4d6ed0[_0x64f5('0x13')][_0x64f5('0x15')]);return _0x396f33(_0x4d6ed0[_0x64f5('0x13')][_0x64f5('0x15')]);}logger[_0x64f5('0x13')](_0x64f5('0xe'),_0x5f1120,_0x4d6ed0[_0x64f5('0x13')][_0x64f5('0x15')]);return _0x507bd8(_0x4d6ed0[_0x64f5('0x13')]['message']);}else{logger[_0x64f5('0x16')](_0x64f5('0xe'),_0x5f1120,_0x64f5('0x11'));_0x507bd8(_0x4d6ed0['result']['message']);}})[_0x64f5('0x17')](function(_0x2e4473){logger[_0x64f5('0x13')](_0x64f5('0xe'),_0x5f1120,_0x2e4473);_0x396f33(_0x2e4473);});});} \ No newline at end of file +var _0xe1b8=['rpc','../../config/environment','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1afcb7,_0x5adc95){var _0x2c72b8=function(_0x30c608){while(--_0x30c608){_0x1afcb7['push'](_0x1afcb7['shift']());}};_0x2c72b8(++_0x5adc95);}(_0xe1b8,0x1b1));var _0x8e1b=function(_0x5291d8,_0x1ae63f){_0x5291d8=_0x5291d8-0x0;var _0x5ae8ed=_0xe1b8[_0x5291d8];return _0x5ae8ed;};'use strict';var _=require(_0x8e1b('0x0'));var util=require('util');var moment=require(_0x8e1b('0x1'));var BPromise=require('bluebird');var rs=require(_0x8e1b('0x2'));var fs=require('fs');var Redis=require(_0x8e1b('0x3'));var db=require(_0x8e1b('0x4'))['db'];var utils=require(_0x8e1b('0x5'));var logger=require(_0x8e1b('0x6'))(_0x8e1b('0x7'));var config=require(_0x8e1b('0x8'));var jayson=require(_0x8e1b('0x9'));var client=jayson[_0x8e1b('0xa')][_0x8e1b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55eb87,_0x15f408,_0x3d46fb){return new BPromise(function(_0x5b1051,_0x57727e){return client['request'](_0x55eb87,_0x3d46fb)[_0x8e1b('0xc')](function(_0x487441){logger[_0x8e1b('0xd')](_0x8e1b('0xe'),_0x15f408,_0x8e1b('0xf'));logger[_0x8e1b('0x10')](_0x8e1b('0x11'),_0x15f408,'request\x20sent',JSON['stringify'](_0x487441));if(_0x487441[_0x8e1b('0x12')]){if(_0x487441[_0x8e1b('0x12')][_0x8e1b('0x13')]===0x1f4){logger[_0x8e1b('0x12')](_0x8e1b('0xe'),_0x15f408,_0x487441[_0x8e1b('0x12')][_0x8e1b('0x14')]);return _0x57727e(_0x487441[_0x8e1b('0x12')][_0x8e1b('0x14')]);}logger[_0x8e1b('0x12')](_0x8e1b('0xe'),_0x15f408,_0x487441['error'][_0x8e1b('0x14')]);return _0x5b1051(_0x487441[_0x8e1b('0x12')][_0x8e1b('0x14')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x15f408,'request\x20sent');_0x5b1051(_0x487441['result']['message']);}})[_0x8e1b('0x15')](function(_0x34bf55){logger[_0x8e1b('0x12')](_0x8e1b('0xe'),_0x15f408,_0x34bf55);_0x57727e(_0x34bf55);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index e519ac5..4234b92 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 _0x585e=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x32173d,_0x1989f3){var _0x441561=function(_0x4ce4a8){while(--_0x4ce4a8){_0x32173d['push'](_0x32173d['shift']());}};_0x441561(++_0x1989f3);}(_0x585e,0x1c2));var _0xe585=function(_0x14baf6,_0x4d133e){_0x14baf6=_0x14baf6-0x0;var _0x9442dd=_0x585e[_0x14baf6];return _0x9442dd;};'use strict';var multer=require(_0xe585('0x0'));var util=require(_0xe585('0x1'));var path=require(_0xe585('0x2'));var timeout=require(_0xe585('0x3'));var express=require(_0xe585('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe585('0x5'));var interaction=require(_0xe585('0x6'));var config=require('../../config/environment');module[_0xe585('0x7')]=router; \ No newline at end of file +var _0x1399=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x477906,_0x4ffa55){var _0x3ad34e=function(_0x4dee05){while(--_0x4dee05){_0x477906['push'](_0x477906['shift']());}};_0x3ad34e(++_0x4ffa55);}(_0x1399,0x16c));var _0x9139=function(_0x1d79c3,_0x3992a9){_0x1d79c3=_0x1d79c3-0x0;var _0x5ed06c=_0x1399[_0x1d79c3];return _0x5ed06c;};'use strict';var multer=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var path=require('path');var timeout=require(_0x9139('0x2'));var express=require('express');var router=express[_0x9139('0x3')]();var fs_extra=require(_0x9139('0x4'));var auth=require(_0x9139('0x5'));var interaction=require(_0x9139('0x6'));var config=require(_0x9139('0x7'));module[_0x9139('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 5064502..81e99c5 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 _0x1e26=['STRING','queue_interface','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x503412,_0x263967){var _0xfec2e3=function(_0x2f80a0){while(--_0x2f80a0){_0x503412['push'](_0x503412['shift']());}};_0xfec2e3(++_0x263967);}(_0x1e26,0x110));var _0x61e2=function(_0x444090,_0x279677){_0x444090=_0x444090-0x0;var _0x4b97b3=_0x1e26[_0x444090];return _0x4b97b3;};'use strict';var Sequelize=require('sequelize');module[_0x61e2('0x0')]={'uniqueid':{'type':Sequelize[_0x61e2('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x61e2('0x2')},'membername':{'type':Sequelize[_0x61e2('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x61e2('0x3')],'allowNull':![],'unique':_0x61e2('0x4'),'comment':_0x61e2('0x2')},'VoiceQueueId':{'type':Sequelize[_0x61e2('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x61e2('0x3')],'allowNull':![],'unique':_0x61e2('0x4'),'comment':_0x61e2('0x2')},'penalty':{'type':Sequelize[_0x61e2('0x1')](0xb),'defaultValue':0x0,'comment':_0x61e2('0x2')},'paused':{'type':Sequelize[_0x61e2('0x1')](0xb),'defaultValue':0x0,'comment':_0x61e2('0x2')}}; \ No newline at end of file +var _0x3e32=['Required\x20by\x20Asterisk','STRING','queue_interface','exports','INTEGER'];(function(_0x516bfa,_0x59a90d){var _0x2286a6=function(_0x1c0b00){while(--_0x1c0b00){_0x516bfa['push'](_0x516bfa['shift']());}};_0x2286a6(++_0x59a90d);}(_0x3e32,0xe4));var _0x23e3=function(_0x3e5000,_0x21d585){_0x3e5000=_0x3e5000-0x0;var _0x301a98=_0x3e32[_0x3e5000];return _0x301a98;};'use strict';var Sequelize=require('sequelize');module[_0x23e3('0x0')]={'uniqueid':{'type':Sequelize[_0x23e3('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x23e3('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x23e3('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x23e3('0x3')],'allowNull':![],'unique':_0x23e3('0x4'),'comment':_0x23e3('0x2')},'VoiceQueueId':{'type':Sequelize[_0x23e3('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x23e3('0x3')],'allowNull':![],'unique':_0x23e3('0x4'),'comment':_0x23e3('0x2')},'penalty':{'type':Sequelize[_0x23e3('0x1')](0xb),'defaultValue':0x0,'comment':_0x23e3('0x2')},'paused':{'type':Sequelize[_0x23e3('0x1')](0xb),'defaultValue':0x0,'comment':_0x23e3('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 3616475..f480506 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 _0xfdce=['hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','emit','hasOwnProperty'];(function(_0xbae67,_0x3cbdc8){var _0x3a3580=function(_0x2ff693){while(--_0x2ff693){_0xbae67['push'](_0xbae67['shift']());}};_0x3a3580(++_0x3cbdc8);}(_0xfdce,0x1d2));var _0xefdc=function(_0x33af1c,_0x526259){_0x33af1c=_0x33af1c-0x0;var _0x5d5815=_0xfdce[_0x33af1c];return _0x5d5815;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xefdc('0x0'))['db'][_0xefdc('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xefdc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xefdc('0x3'),'afterDestroy':'remove'};function emitEvent(_0x322a8e){return function(_0x4d6369,_0x1be90a,_0x24bc8c){UserVoiceQueueRtEvents[_0xefdc('0x4')](_0x322a8e+':'+_0x4d6369['id'],_0x4d6369);UserVoiceQueueRtEvents['emit'](_0x322a8e,_0x4d6369);_0x24bc8c(null);};}for(var e in events){if(events[_0xefdc('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xefdc('0x6')](e,emitEvent(event));}}module[_0xefdc('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7c97=['events','UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x5156ce,_0x3868e4){var _0x1f5d17=function(_0x396d74){while(--_0x396d74){_0x5156ce['push'](_0x5156ce['shift']());}};_0x1f5d17(++_0x3868e4);}(_0x7c97,0x99));var _0x77c9=function(_0x3de036,_0x2d8919){_0x3de036=_0x3de036-0x0;var _0x338259=_0x7c97[_0x3de036];return _0x338259;};'use strict';var EventEmitter=require(_0x77c9('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x77c9('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x77c9('0x2')](0x0);var events={'afterCreate':_0x77c9('0x3'),'afterUpdate':_0x77c9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x494497){return function(_0x2cdc3c,_0x1ac544,_0x48fa77){UserVoiceQueueRtEvents[_0x77c9('0x5')](_0x494497+':'+_0x2cdc3c['id'],_0x2cdc3c);UserVoiceQueueRtEvents[_0x77c9('0x5')](_0x494497,_0x2cdc3c);_0x48fa77(null);};}for(var e in events){if(events[_0x77c9('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x77c9('0x7')](e,emitEvent(event));}}module[_0x77c9('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 248aa06..ac61463 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 _0xaeed=['bluebird','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','moment'];(function(_0x532850,_0x3a100a){var _0x4ea53f=function(_0x243531){while(--_0x243531){_0x532850['push'](_0x532850['shift']());}};_0x4ea53f(++_0x3a100a);}(_0xaeed,0xd4));var _0xdaee=function(_0x289ed5,_0x289c3c){_0x289ed5=_0x289ed5-0x0;var _0x53ba9e=_0xaeed[_0x289ed5];return _0x53ba9e;};'use strict';var _=require(_0xdaee('0x0'));var util=require(_0xdaee('0x1'));var logger=require(_0xdaee('0x2'))('api');var moment=require(_0xdaee('0x3'));var BPromise=require(_0xdaee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdaee('0x5'));var config=require(_0xdaee('0x6'));var attributes=require(_0xdaee('0x7'));module[_0xdaee('0x8')]=function(_0x2b8a5f,_0x28fcff){return _0x2b8a5f[_0xdaee('0x9')](_0xdaee('0xa'),attributes,{'tableName':_0xdaee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73dd=['./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x32bb6b,_0x1a5fbe){var _0x58dcb4=function(_0x402ee2){while(--_0x402ee2){_0x32bb6b['push'](_0x32bb6b['shift']());}};_0x58dcb4(++_0x1a5fbe);}(_0x73dd,0x112));var _0xd73d=function(_0x2e0f4d,_0x24d803){_0x2e0f4d=_0x2e0f4d-0x0;var _0x14d21d=_0x73dd[_0x2e0f4d];return _0x14d21d;};'use strict';var _=require(_0xd73d('0x0'));var util=require('util');var logger=require(_0xd73d('0x1'))(_0xd73d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd73d('0x3'));var fs=require('fs');var path=require(_0xd73d('0x4'));var rimraf=require('rimraf');var config=require(_0xd73d('0x5'));var attributes=require(_0xd73d('0x6'));module[_0xd73d('0x7')]=function(_0x36b3a9,_0x23f35e){return _0x36b3a9['define'](_0xd73d('0x8'),attributes,{'tableName':_0xd73d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 4ccd3fe..b27638e 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 _0xf8ed=['result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','stringify','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x39ae1b,_0x18cfc0){var _0x539437=function(_0x5c9a4a){while(--_0x5c9a4a){_0x39ae1b['push'](_0x39ae1b['shift']());}};_0x539437(++_0x18cfc0);}(_0xf8ed,0x11d));var _0xdf8e=function(_0x3c2e4e,_0x357207){_0x3c2e4e=_0x3c2e4e-0x0;var _0x773c58=_0xf8ed[_0x3c2e4e];return _0x773c58;};'use strict';var _=require('lodash');var util=require(_0xdf8e('0x0'));var moment=require(_0xdf8e('0x1'));var BPromise=require('bluebird');var rs=require(_0xdf8e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf8e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdf8e('0x4'));var config=require(_0xdf8e('0x5'));var jayson=require(_0xdf8e('0x6'));var client=jayson[_0xdf8e('0x7')][_0xdf8e('0x8')]({'port':0x232a});config[_0xdf8e('0x9')]=_['defaults'](config[_0xdf8e('0x9')],{'host':_0xdf8e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdf8e('0xb'))[_0xdf8e('0xc')](socket);function respondWithRpcPromise(_0x51deb5,_0x41c8dd,_0x3c4825){return new BPromise(function(_0x248eba,_0x53a362){return client['request'](_0x51deb5,_0x3c4825)[_0xdf8e('0xd')](function(_0x544639){logger[_0xdf8e('0xe')](_0xdf8e('0xf'),_0x41c8dd,'request\x20sent');logger['debug'](_0xdf8e('0x10'),_0x41c8dd,_0xdf8e('0x11'),JSON['stringify'](_0x544639));if(_0x544639[_0xdf8e('0x12')]){if(_0x544639[_0xdf8e('0x12')][_0xdf8e('0x13')]===0x1f4){logger[_0xdf8e('0x12')](_0xdf8e('0xf'),_0x41c8dd,_0x544639[_0xdf8e('0x12')][_0xdf8e('0x14')]);return _0x53a362(_0x544639[_0xdf8e('0x12')][_0xdf8e('0x14')]);}logger[_0xdf8e('0x12')](_0xdf8e('0xf'),_0x41c8dd,_0x544639[_0xdf8e('0x12')]['message']);return _0x248eba(_0x544639[_0xdf8e('0x12')][_0xdf8e('0x14')]);}else{logger[_0xdf8e('0xe')](_0xdf8e('0xf'),_0x41c8dd,_0xdf8e('0x11'));_0x248eba(_0x544639[_0xdf8e('0x15')][_0xdf8e('0x14')]);}})[_0xdf8e('0x16')](function(_0x315ba4){logger[_0xdf8e('0x12')](_0xdf8e('0xf'),_0x41c8dd,_0x315ba4);_0x53a362(_0x315ba4);});});}exports[_0xdf8e('0x17')]=function(_0x2c2648){var _0x2bbed0=this;return new Promise(function(_0x5087fa,_0x2bd7ce){return db[_0xdf8e('0x18')][_0xdf8e('0x19')]({'raw':_0x2c2648[_0xdf8e('0x1a')]?_0x2c2648['options'][_0xdf8e('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c2648[_0xdf8e('0x1a')]?_0x2c2648[_0xdf8e('0x1a')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xdf8e('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0xdf8e('0x1d')](_0xdf8e('0x1e')))),_0xdf8e('0x1f')]]})[_0xdf8e('0xd')](function(_0x69ffb3){logger[_0xdf8e('0xe')](_0xdf8e('0x17'),_0x2c2648);logger[_0xdf8e('0x20')]('GetVoiceQueueRtPauses',_0x2c2648,JSON[_0xdf8e('0x21')](_0x69ffb3));_0x5087fa(_0x69ffb3);})[_0xdf8e('0x16')](function(_0x568457){logger['error'](_0xdf8e('0x17'),_0x568457[_0xdf8e('0x14')],_0x2c2648);_0x2bd7ce(_0x2bbed0[_0xdf8e('0x12')](0x1f4,_0x568457[_0xdf8e('0x14')]));});});}; \ No newline at end of file +var _0xceb1=['result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','outboundQueuePauses','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x4c2446,_0x3be381){var _0x33fe96=function(_0x5f572d){while(--_0x5f572d){_0x4c2446['push'](_0x4c2446['shift']());}};_0x33fe96(++_0x3be381);}(_0xceb1,0x96));var _0x1ceb=function(_0x52e777,_0x10f439){_0x52e777=_0x52e777-0x0;var _0x14ac36=_0xceb1[_0x52e777];return _0x14ac36;};'use strict';var _=require(_0x1ceb('0x0'));var util=require(_0x1ceb('0x1'));var moment=require(_0x1ceb('0x2'));var BPromise=require('bluebird');var rs=require(_0x1ceb('0x3'));var fs=require('fs');var Redis=require(_0x1ceb('0x4'));var db=require(_0x1ceb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ceb('0x6'))(_0x1ceb('0x7'));var config=require(_0x1ceb('0x8'));var jayson=require(_0x1ceb('0x9'));var client=jayson[_0x1ceb('0xa')]['http']({'port':0x232a});config[_0x1ceb('0xb')]=_[_0x1ceb('0xc')](config['redis'],{'host':_0x1ceb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ceb('0xb')]));require(_0x1ceb('0xe'))[_0x1ceb('0xf')](socket);function respondWithRpcPromise(_0x289f94,_0x46b42c,_0x541045){return new BPromise(function(_0x1cad8b,_0x5b3902){return client[_0x1ceb('0x10')](_0x289f94,_0x541045)[_0x1ceb('0x11')](function(_0x441a92){logger[_0x1ceb('0x12')](_0x1ceb('0x13'),_0x46b42c,_0x1ceb('0x14'));logger[_0x1ceb('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x46b42c,_0x1ceb('0x14'),JSON['stringify'](_0x441a92));if(_0x441a92[_0x1ceb('0x16')]){if(_0x441a92[_0x1ceb('0x16')][_0x1ceb('0x17')]===0x1f4){logger['error'](_0x1ceb('0x13'),_0x46b42c,_0x441a92[_0x1ceb('0x16')][_0x1ceb('0x18')]);return _0x5b3902(_0x441a92[_0x1ceb('0x16')][_0x1ceb('0x18')]);}logger[_0x1ceb('0x16')](_0x1ceb('0x13'),_0x46b42c,_0x441a92[_0x1ceb('0x16')][_0x1ceb('0x18')]);return _0x1cad8b(_0x441a92['error'][_0x1ceb('0x18')]);}else{logger[_0x1ceb('0x12')](_0x1ceb('0x13'),_0x46b42c,'request\x20sent');_0x1cad8b(_0x441a92[_0x1ceb('0x19')]['message']);}})[_0x1ceb('0x1a')](function(_0x14800e){logger['error'](_0x1ceb('0x13'),_0x46b42c,_0x14800e);_0x5b3902(_0x14800e);});});}exports[_0x1ceb('0x1b')]=function(_0x30d2ec){var _0x563afd=this;return new Promise(function(_0x456f7a,_0x50312d){return db['UserVoiceQueueRt'][_0x1ceb('0x1c')]({'raw':_0x30d2ec[_0x1ceb('0x1d')]?_0x30d2ec[_0x1ceb('0x1d')][_0x1ceb('0x1e')]===undefined?!![]:![]:!![],'where':_0x30d2ec[_0x1ceb('0x1d')]?_0x30d2ec[_0x1ceb('0x1d')][_0x1ceb('0x1f')]||null:null,'attributes':[[db[_0x1ceb('0x20')]['fn']('COUNT',db[_0x1ceb('0x20')]['fn']('IF',db[_0x1ceb('0x20')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x1ceb('0x21')]]})[_0x1ceb('0x11')](function(_0x3454c2){logger[_0x1ceb('0x12')](_0x1ceb('0x1b'),_0x30d2ec);logger[_0x1ceb('0x15')]('GetVoiceQueueRtPauses',_0x30d2ec,JSON[_0x1ceb('0x22')](_0x3454c2));_0x456f7a(_0x3454c2);})[_0x1ceb('0x1a')](function(_0x11f29f){logger['error'](_0x1ceb('0x1b'),_0x11f29f[_0x1ceb('0x18')],_0x30d2ec);_0x50312d(_0x563afd[_0x1ceb('0x16')](0x1f4,_0x11f29f[_0x1ceb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index bd23dce..fa1d494 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 _0xb628=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','register'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xb628,0xb7));var _0x8b62=function(_0x49e0f2,_0x53b037){_0x49e0f2=_0x49e0f2-0x0;var _0x765610=_0xb628[_0x49e0f2];return _0x765610;};'use strict';var UserVoiceQueueRtEvents=require(_0x8b62('0x0'));var events=[_0x8b62('0x1'),_0x8b62('0x2'),_0x8b62('0x3')];function createListener(_0xaf2bf5,_0x4360a5){return function(_0x3a4c0f){_0x4360a5[_0x8b62('0x4')](_0xaf2bf5,_0x3a4c0f);};}function removeListener(_0x1ef999,_0x48b253){return function(){UserVoiceQueueRtEvents['removeListener'](_0x1ef999,_0x48b253);};}exports[_0x8b62('0x5')]=function(_0x401bc0){for(var _0x4e08f5=0x0,_0x12a802=events['length'];_0x4e08f5<_0x12a802;_0x4e08f5++){var _0x80cee1=events[_0x4e08f5];var _0x27be8a=createListener(_0x8b62('0x6')+_0x80cee1,_0x401bc0);UserVoiceQueueRtEvents['on'](_0x80cee1,_0x27be8a);}}; \ No newline at end of file +var _0xc68e=['save','remove','update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x63b6ec,_0x2e4a5d){var _0xea9c40=function(_0x514b7d){while(--_0x514b7d){_0x63b6ec['push'](_0x63b6ec['shift']());}};_0xea9c40(++_0x2e4a5d);}(_0xc68e,0x7d));var _0xec68=function(_0x3d9e4b,_0x4c1281){_0x3d9e4b=_0x3d9e4b-0x0;var _0x4693cc=_0xc68e[_0x3d9e4b];return _0x4693cc;};'use strict';var UserVoiceQueueRtEvents=require(_0xec68('0x0'));var events=[_0xec68('0x1'),_0xec68('0x2'),_0xec68('0x3')];function createListener(_0x3b9952,_0x239c74){return function(_0x204335){_0x239c74[_0xec68('0x4')](_0x3b9952,_0x204335);};}function removeListener(_0x4ccea2,_0x1429fc){return function(){UserVoiceQueueRtEvents[_0xec68('0x5')](_0x4ccea2,_0x1429fc);};}exports[_0xec68('0x6')]=function(_0x1ef3e0){for(var _0x50795f=0x0,_0x5a2dec=events[_0xec68('0x7')];_0x50795f<_0x5a2dec;_0x50795f++){var _0x117129=events[_0x50795f];var _0x5db17a=createListener(_0xec68('0x8')+_0x117129,_0x1ef3e0);UserVoiceQueueRtEvents['on'](_0x117129,_0x5db17a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 74075a6..3006459 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 _0xf4f4=['fs-extra','../../components/auth/service','../../config/environment','multer','util','connect-timeout','express','Router'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4ec8f4,_0x324d08){_0x4ec8f4=_0x4ec8f4-0x0;var _0x37f047=_0xf4f4[_0x4ec8f4];return _0x37f047;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));module['exports']=router; \ No newline at end of file +var _0x4d5a=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports','util','path'];(function(_0x171202,_0x80fcce){var _0x216882=function(_0x1c83d2){while(--_0x1c83d2){_0x171202['push'](_0x171202['shift']());}};_0x216882(++_0x80fcce);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4d5a[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require(_0xa4d5('0x0'));var path=require(_0xa4d5('0x1'));var timeout=require(_0xa4d5('0x2'));var express=require('express');var router=express[_0xa4d5('0x3')]();var fs_extra=require(_0xa4d5('0x4'));var auth=require(_0xa4d5('0x5'));var interaction=require(_0xa4d5('0x6'));var config=require('../../config/environment');module[_0xa4d5('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 44553d6..0625d81 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x461a82,_0x2c47ad){var _0x284c25=function(_0x364e04){while(--_0x364e04){_0x461a82['push'](_0x461a82['shift']());}};_0x284c25(++_0x2c47ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x164be6,_0x43734c){var _0x3e7c89=function(_0x3fae8c){while(--_0x3fae8c){_0x164be6['push'](_0x164be6['shift']());}};_0x3e7c89(++_0x43734c);}(_0xe706,0xa3));var _0x6e70=function(_0x573773,_0x36caa2){_0x573773=_0x573773-0x0;var _0x2b56af=_0xe706[_0x573773];return _0x2b56af;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 866e3ad..69b0580 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 _0xd4a2=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','api','bluebird','path','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x45982a,_0x1f2be4){var _0x59a372=function(_0x1f8ab2){while(--_0x1f8ab2){_0x45982a['push'](_0x45982a['shift']());}};_0x59a372(++_0x1f2be4);}(_0xd4a2,0x173));var _0x2d4a=function(_0x2872d1,_0x13e9fc){_0x2872d1=_0x2872d1-0x0;var _0x4ea0aa=_0xd4a2[_0x2872d1];return _0x4ea0aa;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d4a('0x1'));var moment=require('moment');var BPromise=require(_0x2d4a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d4a('0x3'));var rimraf=require('rimraf');var config=require(_0x2d4a('0x4'));var attributes=require(_0x2d4a('0x5'));module[_0x2d4a('0x6')]=function(_0x3a88e2,_0x1ca10b){return _0x3a88e2['define'](_0x2d4a('0x7'),attributes,{'tableName':_0x2d4a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e2e=['exports','define','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x14a811,_0x4c38ef){_0x14a811=_0x14a811-0x0;var _0x2c78f2=_0x4e2e[_0x14a811];return _0x2c78f2;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var logger=require(_0xe4e2('0x1'))(_0xe4e2('0x2'));var moment=require(_0xe4e2('0x3'));var BPromise=require(_0xe4e2('0x4'));var rp=require(_0xe4e2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4e2('0x6'));var config=require(_0xe4e2('0x7'));var attributes=require(_0xe4e2('0x8'));module[_0xe4e2('0x9')]=function(_0x48e83d,_0x322295){return _0x48e83d[_0xe4e2('0xa')](_0xe4e2('0xb'),attributes,{'tableName':_0xe4e2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 99cc5bc..9278f3a 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 _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x5d8b3a,_0x5e255b){var _0x33f08e=function(_0x2824a4){while(--_0x2824a4){_0x5d8b3a['push'](_0x5d8b3a['shift']());}};_0x33f08e(++_0x5e255b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x361aec,_0x4e2a3c){var _0x12a279=function(_0x5188c8){while(--_0x5188c8){_0x361aec['push'](_0x361aec['shift']());}};_0x12a279(++_0x4e2a3c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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/variable/index.js b/server/api/variable/index.js index a11ab0d..f607dc0 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 _0xda67=['fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','show','create','put','update','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x1d9642,_0x2eb8a0){var _0x4fe6f1=function(_0x62ccbf){while(--_0x62ccbf){_0x1d9642['push'](_0x1d9642['shift']());}};_0x4fe6f1(++_0x2eb8a0);}(_0xda67,0x1e2));var _0x7da6=function(_0xf548e8,_0x3591e8){_0xf548e8=_0xf548e8-0x0;var _0x39827b=_0xda67[_0xf548e8];return _0x39827b;};'use strict';var multer=require(_0x7da6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7da6('0x1'));var express=require(_0x7da6('0x2'));var router=express[_0x7da6('0x3')]();var fs_extra=require(_0x7da6('0x4'));var auth=require(_0x7da6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7da6('0x6'));var controller=require(_0x7da6('0x7'));router[_0x7da6('0x8')]('/',auth['isAuthenticated'](),controller[_0x7da6('0x9')]);router[_0x7da6('0x8')](_0x7da6('0xa'),auth[_0x7da6('0xb')](),controller[_0x7da6('0xc')]);router['post']('/',auth[_0x7da6('0xb')](),controller[_0x7da6('0xd')]);router[_0x7da6('0xe')](_0x7da6('0xa'),auth['isAuthenticated'](),controller[_0x7da6('0xf')]);router['delete'](_0x7da6('0xa'),auth[_0x7da6('0xb')](),controller[_0x7da6('0x10')]);module[_0x7da6('0x11')]=router; \ No newline at end of file +var _0x7e6d=['post','isAuthenticated','put','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/:id','show'];(function(_0x2319f9,_0x1175e9){var _0x52949c=function(_0x5e5b99){while(--_0x5e5b99){_0x2319f9['push'](_0x2319f9['shift']());}};_0x52949c(++_0x1175e9);}(_0x7e6d,0x103));var _0xd7e6=function(_0x3f98f2,_0x19e348){_0x3f98f2=_0x3f98f2-0x0;var _0x19eb6f=_0x7e6d[_0x3f98f2];return _0x19eb6f;};'use strict';var multer=require('multer');var util=require(_0xd7e6('0x0'));var path=require(_0xd7e6('0x1'));var timeout=require(_0xd7e6('0x2'));var express=require(_0xd7e6('0x3'));var router=express[_0xd7e6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd7e6('0x5'));var config=require(_0xd7e6('0x6'));var controller=require('./variable.controller');router[_0xd7e6('0x7')]('/',auth['isAuthenticated'](),controller[_0xd7e6('0x8')]);router[_0xd7e6('0x7')](_0xd7e6('0x9'),auth['isAuthenticated'](),controller[_0xd7e6('0xa')]);router[_0xd7e6('0xb')]('/',auth[_0xd7e6('0xc')](),controller['create']);router[_0xd7e6('0xd')]('/:id',auth[_0xd7e6('0xc')](),controller['update']);router['delete'](_0xd7e6('0x9'),auth[_0xd7e6('0xc')](),controller['destroy']);module[_0xd7e6('0xe')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 23c51bf..3110957 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 _0x22bc=['sequelize','exports','STRING'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x22bc,0x66));var _0xc22b=function(_0x2077ab,_0x2ed933){_0x2077ab=_0x2077ab-0x0;var _0x5db757=_0x22bc[_0x2077ab];return _0x5db757;};'use strict';var Sequelize=require(_0xc22b('0x0'));module[_0xc22b('0x1')]={'name':{'type':Sequelize[_0xc22b('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc22b('0x2')]}}; \ No newline at end of file +var _0xbeed=['name','STRING'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xbeed,0x1ec));var _0xdbee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbeed[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdbee('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdbee('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index bca3022..37923c6 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 _0x6fff=['Variable','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','find','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Variables','UserProfileSection','create','update','params','html-pdf','eml-format','rimraf','zip-dir','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map'];(function(_0xe42b10,_0x3a1a35){var _0x504c6d=function(_0x5b85d0){while(--_0x5b85d0){_0xe42b10['push'](_0xe42b10['shift']());}};_0x504c6d(++_0x3a1a35);}(_0x6fff,0x194));var _0xf6ff=function(_0x46b9fc,_0x416f30){_0x46b9fc=_0x46b9fc-0x0;var _0x2c83d2=_0x6fff[_0x46b9fc];return _0x2c83d2;};'use strict';var pdf=require(_0xf6ff('0x0'));var emlformat=require(_0xf6ff('0x1'));var rimraf=require(_0xf6ff('0x2'));var zipdir=require(_0xf6ff('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf6ff('0x4'));var util=require('util');var path=require(_0xf6ff('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf6ff('0x6'));var fs=require('fs');var fs_extra=require(_0xf6ff('0x7'));var _=require(_0xf6ff('0x8'));var squel=require(_0xf6ff('0x9'));var crypto=require(_0xf6ff('0xa'));var jsforce=require(_0xf6ff('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf6ff('0xc'));var querystring=require('querystring');var Papa=require(_0xf6ff('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf6ff('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6ff('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xf6ff('0x10'));var config=require(_0xf6ff('0x11'));var licenseUtil=require(_0xf6ff('0x12'));var db=require(_0xf6ff('0x13'))['db'];function respondWithStatusCode(_0x1a78e6,_0x374bb3){_0x374bb3=_0x374bb3||0xcc;return function(_0x5595c0){if(_0x5595c0){return _0x1a78e6[_0xf6ff('0x14')](_0x374bb3);}return _0x1a78e6[_0xf6ff('0x15')](_0x374bb3)['end']();};}function respondWithResult(_0x116171,_0x4a7cbd){_0x4a7cbd=_0x4a7cbd||0xc8;return function(_0x513ab8){if(_0x513ab8){return _0x116171['status'](_0x4a7cbd)['json'](_0x513ab8);}};}function respondWithFilteredResult(_0x3cb0a3,_0x2eec4d){return function(_0x2cbac1){if(_0x2cbac1){var _0x3206a1=_0x2cbac1[_0xf6ff('0x16')],_0x2d338a=_0x2eec4d[_0xf6ff('0x17')],_0x187342=_0x2eec4d[_0xf6ff('0x17')]+_0x2eec4d[_0xf6ff('0x18')],_0x2a2327;if(_0x187342>=_0x3206a1){_0x187342=_0x3206a1;_0x2a2327=0xc8;}else{_0x2a2327=0xce;}_0x3cb0a3[_0xf6ff('0x15')](_0x2a2327);return _0x3cb0a3['set'](_0xf6ff('0x19'),_0x2d338a+'-'+_0x187342+'/'+_0x3206a1)['json'](_0x2cbac1);}return null;};}function patchUpdates(_0x458145){return function(_0x59b38b){try{jsonpatch[_0xf6ff('0x1a')](_0x59b38b,_0x458145,!![]);}catch(_0x313140){return BPromise[_0xf6ff('0x1b')](_0x313140);}return _0x59b38b[_0xf6ff('0x1c')]();};}function saveUpdates(_0x3cd4e6,_0x4ce989){return function(_0x23e152){if(_0x23e152){return _0x23e152['update'](_0x3cd4e6)[_0xf6ff('0x1d')](function(_0x15ac75){return _0x15ac75;});}return null;};}function removeEntity(_0x329364,_0x4765ec){return function(_0x3a31fe){if(_0x3a31fe){return _0x3a31fe[_0xf6ff('0x1e')]()[_0xf6ff('0x1d')](function(){var _0x5f43c8=_0x3a31fe[_0xf6ff('0x1f')]({'plain':!![]});var _0x5eba91='Variables';return db[_0xf6ff('0x20')][_0xf6ff('0x1e')]({'where':{'type':_0x5eba91,'resourceId':_0x5f43c8['id']}})['then'](function(){return _0x3a31fe;});})[_0xf6ff('0x1d')](function(){_0x329364[_0xf6ff('0x15')](0xcc)[_0xf6ff('0x21')]();});}};}function handleEntityNotFound(_0x5a2f86,_0xfbb794){return function(_0x475fb8){if(!_0x475fb8){_0x5a2f86[_0xf6ff('0x14')](0x194);}return _0x475fb8;};}function handleError(_0x5810a1,_0x767b18){_0x767b18=_0x767b18||0x1f4;return function(_0x3ddfaa){logger[_0xf6ff('0x22')](_0x3ddfaa[_0xf6ff('0x23')]);if(_0x3ddfaa[_0xf6ff('0x24')]){delete _0x3ddfaa[_0xf6ff('0x24')];}_0x5810a1[_0xf6ff('0x15')](_0x767b18)[_0xf6ff('0x25')](_0x3ddfaa);};}exports[_0xf6ff('0x26')]=function(_0xd8a8e0,_0x5e7071){var _0x2f20c1={},_0x295ed7={},_0x4e5378={'count':0x0,'rows':[]};var _0x4bac1b=_[_0xf6ff('0x27')](db[_0xf6ff('0x28')][_0xf6ff('0x29')],function(_0x38691d){return{'name':_0x38691d['fieldName'],'type':_0x38691d[_0xf6ff('0x2a')][_0xf6ff('0x2b')]};});_0x295ed7[_0xf6ff('0x2c')]=_[_0xf6ff('0x27')](_0x4bac1b,_0xf6ff('0x24'));_0x295ed7['query']=_[_0xf6ff('0x2d')](_0xd8a8e0[_0xf6ff('0x2e')]);_0x295ed7[_0xf6ff('0x2f')]=_[_0xf6ff('0x30')](_0x295ed7[_0xf6ff('0x2c')],_0x295ed7[_0xf6ff('0x2e')]);_0x2f20c1[_0xf6ff('0x31')]=_[_0xf6ff('0x30')](_0x295ed7[_0xf6ff('0x2c')],qs[_0xf6ff('0x32')](_0xd8a8e0[_0xf6ff('0x2e')]['fields']));_0x2f20c1[_0xf6ff('0x31')]=_0x2f20c1[_0xf6ff('0x31')][_0xf6ff('0x33')]?_0x2f20c1[_0xf6ff('0x31')]:_0x295ed7[_0xf6ff('0x2c')];if(!_0xd8a8e0[_0xf6ff('0x2e')][_0xf6ff('0x34')]('nolimit')){_0x2f20c1['limit']=qs[_0xf6ff('0x18')](_0xd8a8e0['query']['limit']);_0x2f20c1['offset']=qs[_0xf6ff('0x17')](_0xd8a8e0[_0xf6ff('0x2e')][_0xf6ff('0x17')]);}_0x2f20c1['order']=qs[_0xf6ff('0x35')](_0xd8a8e0[_0xf6ff('0x2e')][_0xf6ff('0x35')]);_0x2f20c1[_0xf6ff('0x36')]=qs[_0xf6ff('0x2f')](_['pick'](_0xd8a8e0[_0xf6ff('0x2e')],_0x295ed7[_0xf6ff('0x2f')]),_0x4bac1b);if(_0xd8a8e0[_0xf6ff('0x2e')][_0xf6ff('0x37')]){_0x2f20c1['where']=_[_0xf6ff('0x38')](_0x2f20c1[_0xf6ff('0x36')],{'$or':_[_0xf6ff('0x27')](_0x4bac1b,function(_0x2495fa){if(_0x2495fa[_0xf6ff('0x2a')]!=='VIRTUAL'){var _0x2990a1={};_0x2990a1[_0x2495fa[_0xf6ff('0x24')]]={'$like':'%'+_0xd8a8e0[_0xf6ff('0x2e')][_0xf6ff('0x37')]+'%'};return _0x2990a1;}})});}_0x2f20c1=_[_0xf6ff('0x38')]({},_0x2f20c1,_0xd8a8e0[_0xf6ff('0x39')]);var _0x4eb16d={'where':_0x2f20c1[_0xf6ff('0x36')]};return db[_0xf6ff('0x28')][_0xf6ff('0x16')](_0x4eb16d)[_0xf6ff('0x1d')](function(_0x17fea8){_0x4e5378[_0xf6ff('0x16')]=_0x17fea8;if(_0xd8a8e0[_0xf6ff('0x2e')][_0xf6ff('0x3a')]){_0x2f20c1[_0xf6ff('0x3b')]=[{'all':!![]}];}return db[_0xf6ff('0x28')][_0xf6ff('0x3c')](_0x2f20c1);})['then'](function(_0x137e49){_0x4e5378[_0xf6ff('0x3d')]=_0x137e49;return _0x4e5378;})['then'](respondWithFilteredResult(_0x5e7071,_0x2f20c1))['catch'](handleError(_0x5e7071,null));};exports[_0xf6ff('0x3e')]=function(_0x2c5ad2,_0x5a0296){var _0x3f40fb={'raw':!![],'where':{'id':_0x2c5ad2['params']['id']}},_0x217b15={};_0x217b15[_0xf6ff('0x2c')]=_[_0xf6ff('0x2d')](db[_0xf6ff('0x28')][_0xf6ff('0x29')]);_0x217b15['query']=_[_0xf6ff('0x2d')](_0x2c5ad2[_0xf6ff('0x2e')]);_0x217b15[_0xf6ff('0x2f')]=_['intersection'](_0x217b15['model'],_0x217b15[_0xf6ff('0x2e')]);_0x3f40fb[_0xf6ff('0x31')]=_[_0xf6ff('0x30')](_0x217b15[_0xf6ff('0x2c')],qs[_0xf6ff('0x32')](_0x2c5ad2['query'][_0xf6ff('0x32')]));_0x3f40fb['attributes']=_0x3f40fb[_0xf6ff('0x31')][_0xf6ff('0x33')]?_0x3f40fb[_0xf6ff('0x31')]:_0x217b15['model'];if(_0x2c5ad2['query'][_0xf6ff('0x3a')]){_0x3f40fb[_0xf6ff('0x3b')]=[{'all':!![]}];}_0x3f40fb=_[_0xf6ff('0x38')]({},_0x3f40fb,_0x2c5ad2[_0xf6ff('0x39')]);return db[_0xf6ff('0x28')][_0xf6ff('0x3f')](_0x3f40fb)[_0xf6ff('0x1d')](handleEntityNotFound(_0x5a0296,null))[_0xf6ff('0x1d')](respondWithResult(_0x5a0296,null))[_0xf6ff('0x40')](handleError(_0x5a0296,null));};exports['create']=function(_0x450b73,_0x36ccda){return db[_0xf6ff('0x28')]['create'](_0x450b73[_0xf6ff('0x41')],{})[_0xf6ff('0x1d')](function(_0x593e36){var _0xf3eb94=_0x450b73['user'][_0xf6ff('0x1f')]({'plain':!![]});if(!_0xf3eb94)throw new Error(_0xf6ff('0x42'));if(_0xf3eb94[_0xf6ff('0x43')]===_0xf6ff('0x44')){var _0x278483=_0x593e36['get']({'plain':!![]});var _0x49de6a=_0xf6ff('0x45');return db[_0xf6ff('0x46')]['find']({'where':{'name':_0x49de6a,'userProfileId':_0xf3eb94['userProfileId']},'raw':!![]})[_0xf6ff('0x1d')](function(_0x2d9053){if(_0x2d9053&&_0x2d9053['autoAssociation']===0x0){return db[_0xf6ff('0x20')][_0xf6ff('0x47')]({'name':_0x278483['name'],'resourceId':_0x278483['id'],'type':_0x2d9053[_0xf6ff('0x24')],'sectionId':_0x2d9053['id']},{})[_0xf6ff('0x1d')](function(){return _0x593e36;});}else{return _0x593e36;}})[_0xf6ff('0x40')](function(_0x16dfd6){logger[_0xf6ff('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16dfd6);throw _0x16dfd6;});}return _0x593e36;})[_0xf6ff('0x1d')](respondWithResult(_0x36ccda,0xc9))[_0xf6ff('0x40')](handleError(_0x36ccda,null));};exports[_0xf6ff('0x48')]=function(_0x3e0a92,_0x10efd4){if(_0x3e0a92[_0xf6ff('0x41')]['id']){delete _0x3e0a92[_0xf6ff('0x41')]['id'];}return db[_0xf6ff('0x28')][_0xf6ff('0x3f')]({'where':{'id':_0x3e0a92[_0xf6ff('0x49')]['id']}})[_0xf6ff('0x1d')](handleEntityNotFound(_0x10efd4,null))[_0xf6ff('0x1d')](saveUpdates(_0x3e0a92['body'],null))[_0xf6ff('0x1d')](respondWithResult(_0x10efd4,null))[_0xf6ff('0x40')](handleError(_0x10efd4,null));};exports['destroy']=function(_0xa3408b,_0x56a51f){return db['Variable'][_0xf6ff('0x3f')]({'where':{'id':_0xa3408b[_0xf6ff('0x49')]['id']}})[_0xf6ff('0x1d')](handleEntityNotFound(_0x56a51f,null))[_0xf6ff('0x1d')](removeEntity(_0x56a51f,null))[_0xf6ff('0x40')](handleError(_0x56a51f,null));}; \ No newline at end of file +var _0xb9d7=['apply','reject','update','destroy','then','Variables','end','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','body','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb9d7,0x186));var _0x7b9d=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xb9d7[_0x9fd887];return _0x1a54ab;};'use strict';var pdf=require(_0x7b9d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b9d('0x1'));var zipdir=require(_0x7b9d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b9d('0x3'));var moment=require(_0x7b9d('0x4'));var BPromise=require(_0x7b9d('0x5'));var Mustache=require(_0x7b9d('0x6'));var util=require('util');var path=require(_0x7b9d('0x7'));var sox=require(_0x7b9d('0x8'));var csv=require(_0x7b9d('0x9'));var ejs=require(_0x7b9d('0xa'));var fs=require('fs');var fs_extra=require(_0x7b9d('0xb'));var _=require(_0x7b9d('0xc'));var squel=require(_0x7b9d('0xd'));var crypto=require(_0x7b9d('0xe'));var jsforce=require(_0x7b9d('0xf'));var deskjs=require(_0x7b9d('0x10'));var toCsv=require(_0x7b9d('0x9'));var querystring=require(_0x7b9d('0x11'));var Papa=require(_0x7b9d('0x12'));var Redis=require(_0x7b9d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7b9d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9d('0x15'));var logger=require(_0x7b9d('0x16'))(_0x7b9d('0x17'));var utils=require(_0x7b9d('0x18'));var config=require(_0x7b9d('0x19'));var licenseUtil=require(_0x7b9d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5adcd7,_0xb51fcd){_0xb51fcd=_0xb51fcd||0xcc;return function(_0x544137){if(_0x544137){return _0x5adcd7[_0x7b9d('0x1b')](_0xb51fcd);}return _0x5adcd7['status'](_0xb51fcd)['end']();};}function respondWithResult(_0x3d5bdc,_0x10c861){_0x10c861=_0x10c861||0xc8;return function(_0x5970b4){if(_0x5970b4){return _0x3d5bdc[_0x7b9d('0x1c')](_0x10c861)[_0x7b9d('0x1d')](_0x5970b4);}};}function respondWithFilteredResult(_0x48b0b1,_0x670280){return function(_0x45e233){if(_0x45e233){var _0x1ac467=_0x45e233[_0x7b9d('0x1e')],_0x54a6af=_0x670280[_0x7b9d('0x1f')],_0x17f808=_0x670280[_0x7b9d('0x1f')]+_0x670280[_0x7b9d('0x20')],_0x2bbbdf;if(_0x17f808>=_0x1ac467){_0x17f808=_0x1ac467;_0x2bbbdf=0xc8;}else{_0x2bbbdf=0xce;}_0x48b0b1['status'](_0x2bbbdf);return _0x48b0b1[_0x7b9d('0x21')](_0x7b9d('0x22'),_0x54a6af+'-'+_0x17f808+'/'+_0x1ac467)[_0x7b9d('0x1d')](_0x45e233);}return null;};}function patchUpdates(_0x56d33c){return function(_0x12950b){try{jsonpatch[_0x7b9d('0x23')](_0x12950b,_0x56d33c,!![]);}catch(_0x2955a3){return BPromise[_0x7b9d('0x24')](_0x2955a3);}return _0x12950b['save']();};}function saveUpdates(_0x7d9764,_0x2633b7){return function(_0x15fb6f){if(_0x15fb6f){return _0x15fb6f[_0x7b9d('0x25')](_0x7d9764)['then'](function(_0x5973ea){return _0x5973ea;});}return null;};}function removeEntity(_0x3d2a76,_0x319301){return function(_0x4f6399){if(_0x4f6399){return _0x4f6399[_0x7b9d('0x26')]()[_0x7b9d('0x27')](function(){var _0xd19581=_0x4f6399['get']({'plain':!![]});var _0x10d075=_0x7b9d('0x28');return db['UserProfileResource'][_0x7b9d('0x26')]({'where':{'type':_0x10d075,'resourceId':_0xd19581['id']}})['then'](function(){return _0x4f6399;});})[_0x7b9d('0x27')](function(){_0x3d2a76[_0x7b9d('0x1c')](0xcc)[_0x7b9d('0x29')]();});}};}function handleEntityNotFound(_0x459d01,_0x481fe4){return function(_0x2e2404){if(!_0x2e2404){_0x459d01[_0x7b9d('0x1b')](0x194);}return _0x2e2404;};}function handleError(_0x8235db,_0x1446b1){_0x1446b1=_0x1446b1||0x1f4;return function(_0x27d100){logger[_0x7b9d('0x2a')](_0x27d100[_0x7b9d('0x2b')]);if(_0x27d100[_0x7b9d('0x2c')]){delete _0x27d100[_0x7b9d('0x2c')];}_0x8235db[_0x7b9d('0x1c')](_0x1446b1)[_0x7b9d('0x2d')](_0x27d100);};}exports[_0x7b9d('0x2e')]=function(_0x342542,_0x392953){var _0x2a81bf={},_0x5c6901={},_0x216199={'count':0x0,'rows':[]};var _0x143baa=_[_0x7b9d('0x2f')](db[_0x7b9d('0x30')][_0x7b9d('0x31')],function(_0x556535){return{'name':_0x556535[_0x7b9d('0x32')],'type':_0x556535[_0x7b9d('0x33')]['key']};});_0x5c6901[_0x7b9d('0x34')]=_[_0x7b9d('0x2f')](_0x143baa,_0x7b9d('0x2c'));_0x5c6901['query']=_[_0x7b9d('0x35')](_0x342542[_0x7b9d('0x36')]);_0x5c6901['filters']=_[_0x7b9d('0x37')](_0x5c6901[_0x7b9d('0x34')],_0x5c6901[_0x7b9d('0x36')]);_0x2a81bf['attributes']=_[_0x7b9d('0x37')](_0x5c6901[_0x7b9d('0x34')],qs[_0x7b9d('0x38')](_0x342542['query'][_0x7b9d('0x38')]));_0x2a81bf['attributes']=_0x2a81bf[_0x7b9d('0x39')]['length']?_0x2a81bf[_0x7b9d('0x39')]:_0x5c6901[_0x7b9d('0x34')];if(!_0x342542['query'][_0x7b9d('0x3a')](_0x7b9d('0x3b'))){_0x2a81bf[_0x7b9d('0x20')]=qs[_0x7b9d('0x20')](_0x342542[_0x7b9d('0x36')]['limit']);_0x2a81bf['offset']=qs['offset'](_0x342542[_0x7b9d('0x36')][_0x7b9d('0x1f')]);}_0x2a81bf[_0x7b9d('0x3c')]=qs[_0x7b9d('0x3d')](_0x342542['query']['sort']);_0x2a81bf[_0x7b9d('0x3e')]=qs['filters'](_[_0x7b9d('0x3f')](_0x342542[_0x7b9d('0x36')],_0x5c6901[_0x7b9d('0x40')]),_0x143baa);if(_0x342542['query'][_0x7b9d('0x41')]){_0x2a81bf[_0x7b9d('0x3e')]=_['merge'](_0x2a81bf[_0x7b9d('0x3e')],{'$or':_[_0x7b9d('0x2f')](_0x143baa,function(_0xb5d9a){if(_0xb5d9a[_0x7b9d('0x33')]!==_0x7b9d('0x42')){var _0x1ecbd9={};_0x1ecbd9[_0xb5d9a[_0x7b9d('0x2c')]]={'$like':'%'+_0x342542['query'][_0x7b9d('0x41')]+'%'};return _0x1ecbd9;}})});}_0x2a81bf=_['merge']({},_0x2a81bf,_0x342542[_0x7b9d('0x43')]);var _0x25d3e2={'where':_0x2a81bf[_0x7b9d('0x3e')]};return db[_0x7b9d('0x30')]['count'](_0x25d3e2)[_0x7b9d('0x27')](function(_0x36fc83){_0x216199[_0x7b9d('0x1e')]=_0x36fc83;if(_0x342542[_0x7b9d('0x36')][_0x7b9d('0x44')]){_0x2a81bf[_0x7b9d('0x45')]=[{'all':!![]}];}return db['Variable'][_0x7b9d('0x46')](_0x2a81bf);})[_0x7b9d('0x27')](function(_0x4c5bb3){_0x216199[_0x7b9d('0x47')]=_0x4c5bb3;return _0x216199;})[_0x7b9d('0x27')](respondWithFilteredResult(_0x392953,_0x2a81bf))[_0x7b9d('0x48')](handleError(_0x392953,null));};exports[_0x7b9d('0x49')]=function(_0x237080,_0x521e3f){var _0x34582e={'raw':!![],'where':{'id':_0x237080[_0x7b9d('0x4a')]['id']}},_0xc759bd={};_0xc759bd[_0x7b9d('0x34')]=_[_0x7b9d('0x35')](db[_0x7b9d('0x30')][_0x7b9d('0x31')]);_0xc759bd['query']=_[_0x7b9d('0x35')](_0x237080['query']);_0xc759bd[_0x7b9d('0x40')]=_[_0x7b9d('0x37')](_0xc759bd[_0x7b9d('0x34')],_0xc759bd[_0x7b9d('0x36')]);_0x34582e[_0x7b9d('0x39')]=_[_0x7b9d('0x37')](_0xc759bd[_0x7b9d('0x34')],qs[_0x7b9d('0x38')](_0x237080[_0x7b9d('0x36')]['fields']));_0x34582e['attributes']=_0x34582e[_0x7b9d('0x39')][_0x7b9d('0x4b')]?_0x34582e[_0x7b9d('0x39')]:_0xc759bd['model'];if(_0x237080[_0x7b9d('0x36')][_0x7b9d('0x44')]){_0x34582e[_0x7b9d('0x45')]=[{'all':!![]}];}_0x34582e=_['merge']({},_0x34582e,_0x237080[_0x7b9d('0x43')]);return db[_0x7b9d('0x30')][_0x7b9d('0x4c')](_0x34582e)[_0x7b9d('0x27')](handleEntityNotFound(_0x521e3f,null))[_0x7b9d('0x27')](respondWithResult(_0x521e3f,null))['catch'](handleError(_0x521e3f,null));};exports[_0x7b9d('0x4d')]=function(_0x5b19d0,_0x57b133){return db['Variable'][_0x7b9d('0x4d')](_0x5b19d0['body'],{})[_0x7b9d('0x27')](function(_0x4d5bca){var _0x276281=_0x5b19d0['user']['get']({'plain':!![]});if(!_0x276281)throw new Error(_0x7b9d('0x4e'));if(_0x276281[_0x7b9d('0x4f')]==='user'){var _0x525536=_0x4d5bca[_0x7b9d('0x50')]({'plain':!![]});var _0x4de8a8=_0x7b9d('0x28');return db[_0x7b9d('0x51')][_0x7b9d('0x4c')]({'where':{'name':_0x4de8a8,'userProfileId':_0x276281[_0x7b9d('0x52')]},'raw':!![]})[_0x7b9d('0x27')](function(_0x3897df){if(_0x3897df&&_0x3897df[_0x7b9d('0x53')]===0x0){return db['UserProfileResource'][_0x7b9d('0x4d')]({'name':_0x525536[_0x7b9d('0x2c')],'resourceId':_0x525536['id'],'type':_0x3897df[_0x7b9d('0x2c')],'sectionId':_0x3897df['id']},{})[_0x7b9d('0x27')](function(){return _0x4d5bca;});}else{return _0x4d5bca;}})[_0x7b9d('0x48')](function(_0x150bef){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x150bef);throw _0x150bef;});}return _0x4d5bca;})[_0x7b9d('0x27')](respondWithResult(_0x57b133,0xc9))[_0x7b9d('0x48')](handleError(_0x57b133,null));};exports[_0x7b9d('0x25')]=function(_0x4c8d8d,_0x53abcb){if(_0x4c8d8d['body']['id']){delete _0x4c8d8d[_0x7b9d('0x54')]['id'];}return db['Variable'][_0x7b9d('0x4c')]({'where':{'id':_0x4c8d8d[_0x7b9d('0x4a')]['id']}})[_0x7b9d('0x27')](handleEntityNotFound(_0x53abcb,null))[_0x7b9d('0x27')](saveUpdates(_0x4c8d8d[_0x7b9d('0x54')],null))[_0x7b9d('0x27')](respondWithResult(_0x53abcb,null))[_0x7b9d('0x48')](handleError(_0x53abcb,null));};exports[_0x7b9d('0x26')]=function(_0x2a1a44,_0x177c0b){return db['Variable'][_0x7b9d('0x4c')]({'where':{'id':_0x2a1a44['params']['id']}})[_0x7b9d('0x27')](handleEntityNotFound(_0x177c0b,null))[_0x7b9d('0x27')](removeEntity(_0x177c0b,null))[_0x7b9d('0x48')](handleError(_0x177c0b,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index cec847c..d46f2d6 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 _0xb11e=['path','rimraf','../../config/environment','./variable.attributes','Variable','lodash','util','../../config/logger','api','moment'];(function(_0x245a77,_0x211139){var _0x4b8dab=function(_0x54b792){while(--_0x54b792){_0x245a77['push'](_0x245a77['shift']());}};_0x4b8dab(++_0x211139);}(_0xb11e,0x7d));var _0xeb11=function(_0x40568a,_0x382c00){_0x40568a=_0x40568a-0x0;var _0x477732=_0xb11e[_0x40568a];return _0x477732;};'use strict';var _=require(_0xeb11('0x0'));var util=require(_0xeb11('0x1'));var logger=require(_0xeb11('0x2'))(_0xeb11('0x3'));var moment=require(_0xeb11('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb11('0x5'));var rimraf=require(_0xeb11('0x6'));var config=require(_0xeb11('0x7'));var attributes=require(_0xeb11('0x8'));module['exports']=function(_0x252e4f,_0x5c54d8){return _0x252e4f['define'](_0xeb11('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63bb=['tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./variable.attributes','exports','define','Variable'];(function(_0x2eff51,_0x4ddc7f){var _0x2e8047=function(_0x259d9b){while(--_0x259d9b){_0x2eff51['push'](_0x2eff51['shift']());}};_0x2e8047(++_0x4ddc7f);}(_0x63bb,0xf8));var _0xb63b=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0x63bb[_0x210603];return _0x1bcb7d;};'use strict';var _=require(_0xb63b('0x0'));var util=require(_0xb63b('0x1'));var logger=require(_0xb63b('0x2'))(_0xb63b('0x3'));var moment=require(_0xb63b('0x4'));var BPromise=require(_0xb63b('0x5'));var rp=require(_0xb63b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb63b('0x7'));var attributes=require(_0xb63b('0x8'));module[_0xb63b('0x9')]=function(_0x22be29,_0x4fc464){return _0x22be29[_0xb63b('0xa')](_0xb63b('0xb'),attributes,{'tableName':_0xb63b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 3c6385e..04b76eb 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 _0x4350=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0x5c5f74,_0x112d64){var _0x6f9650=function(_0x45aa87){while(--_0x45aa87){_0x5c5f74['push'](_0x5c5f74['shift']());}};_0x6f9650(++_0x112d64);}(_0x4350,0x1b2));var _0x0435=function(_0x1ef3bc,_0x5e1f83){_0x1ef3bc=_0x1ef3bc-0x0;var _0x111ede=_0x4350[_0x1ef3bc];return _0x111ede;};'use strict';var _=require(_0x0435('0x0'));var util=require(_0x0435('0x1'));var moment=require('moment');var BPromise=require(_0x0435('0x2'));var rs=require(_0x0435('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0435('0x4'))['db'];var utils=require(_0x0435('0x5'));var logger=require('../../config/logger')(_0x0435('0x6'));var config=require(_0x0435('0x7'));var jayson=require(_0x0435('0x8'));var client=jayson[_0x0435('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x434207,_0x191dc6,_0x4f2c28){return new BPromise(function(_0x296c67,_0x50a5a4){return client['request'](_0x434207,_0x4f2c28)[_0x0435('0xa')](function(_0x2bb378){logger[_0x0435('0xb')](_0x0435('0xc'),_0x191dc6,_0x0435('0xd'));logger[_0x0435('0xe')](_0x0435('0xf'),_0x191dc6,'request\x20sent',JSON[_0x0435('0x10')](_0x2bb378));if(_0x2bb378[_0x0435('0x11')]){if(_0x2bb378[_0x0435('0x11')]['code']===0x1f4){logger[_0x0435('0x11')](_0x0435('0xc'),_0x191dc6,_0x2bb378[_0x0435('0x11')]['message']);return _0x50a5a4(_0x2bb378[_0x0435('0x11')][_0x0435('0x12')]);}logger[_0x0435('0x11')]('Variable,\x20%s,\x20%s',_0x191dc6,_0x2bb378[_0x0435('0x11')][_0x0435('0x12')]);return _0x296c67(_0x2bb378[_0x0435('0x11')][_0x0435('0x12')]);}else{logger[_0x0435('0xb')]('Variable,\x20%s,\x20%s',_0x191dc6,_0x0435('0xd'));_0x296c67(_0x2bb378[_0x0435('0x13')]['message']);}})[_0x0435('0x14')](function(_0x136b49){logger[_0x0435('0x11')]('Variable,\x20%s,\x20%s',_0x191dc6,_0x136b49);_0x50a5a4(_0x136b49);});});}exports[_0x0435('0x15')]=function(_0x85075){var _0x5b9f61=this;return new Promise(function(_0x4636e6,_0x566b7f){return db[_0x0435('0x16')][_0x0435('0x17')]({'raw':_0x85075['options']?_0x85075[_0x0435('0x18')][_0x0435('0x19')]===undefined?!![]:![]:!![],'where':_0x85075['options']?_0x85075[_0x0435('0x18')][_0x0435('0x1a')]||null:null,'attributes':_0x85075[_0x0435('0x18')]?_0x85075[_0x0435('0x18')][_0x0435('0x1b')]||null:null,'include':_0x85075['options']?_0x85075[_0x0435('0x18')][_0x0435('0x1c')]?_[_0x0435('0x1d')](_0x85075[_0x0435('0x18')]['include'],function(_0x22ba83){return{'model':db[_0x22ba83[_0x0435('0x1e')]],'as':_0x22ba83['as'],'attributes':_0x22ba83[_0x0435('0x1b')],'include':_0x22ba83[_0x0435('0x1c')]?_[_0x0435('0x1d')](_0x22ba83[_0x0435('0x1c')],function(_0x1ed66c){return{'model':db[_0x1ed66c['model']],'as':_0x1ed66c['as'],'attributes':_0x1ed66c[_0x0435('0x1b')],'include':_0x1ed66c[_0x0435('0x1c')]?_[_0x0435('0x1d')](_0x1ed66c[_0x0435('0x1c')],function(_0x1f4162){return{'model':db[_0x1f4162[_0x0435('0x1e')]],'as':_0x1f4162['as'],'attributes':_0x1f4162[_0x0435('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0435('0xa')](function(_0x552914){logger['info'](_0x0435('0x15'),_0x85075);logger[_0x0435('0xe')]('ShowVariable',_0x85075,JSON[_0x0435('0x10')](_0x552914));_0x4636e6(_0x552914);})[_0x0435('0x14')](function(_0x1b107c){logger[_0x0435('0x11')](_0x0435('0x15'),_0x1b107c[_0x0435('0x12')],_0x85075);_0x566b7f(_0x5b9f61[_0x0435('0x11')](0x1f4,_0x1b107c[_0x0435('0x12')]));});});}; \ No newline at end of file +var _0x4075=['Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Variable','find','options','raw','where','include','map','model','attributes','ShowVariable','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x5dc6c5,_0x30fe4a){var _0xbadc9a=function(_0x34b70c){while(--_0x34b70c){_0x5dc6c5['push'](_0x5dc6c5['shift']());}};_0xbadc9a(++_0x30fe4a);}(_0x4075,0x96));var _0x5407=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x4075[_0x2e8418];return _0x548fe6;};'use strict';var _=require(_0x5407('0x0'));var util=require('util');var moment=require(_0x5407('0x1'));var BPromise=require(_0x5407('0x2'));var rs=require(_0x5407('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5407('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5407('0x5'))(_0x5407('0x6'));var config=require(_0x5407('0x7'));var jayson=require(_0x5407('0x8'));var client=jayson[_0x5407('0x9')][_0x5407('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1eb833,_0x21bf28,_0x756918){return new BPromise(function(_0x45ea61,_0x2e990a){return client[_0x5407('0xb')](_0x1eb833,_0x756918)['then'](function(_0x28a625){logger[_0x5407('0xc')](_0x5407('0xd'),_0x21bf28,_0x5407('0xe'));logger['debug'](_0x5407('0xf'),_0x21bf28,'request\x20sent',JSON[_0x5407('0x10')](_0x28a625));if(_0x28a625[_0x5407('0x11')]){if(_0x28a625[_0x5407('0x11')][_0x5407('0x12')]===0x1f4){logger[_0x5407('0x11')](_0x5407('0xd'),_0x21bf28,_0x28a625[_0x5407('0x11')][_0x5407('0x13')]);return _0x2e990a(_0x28a625['error']['message']);}logger[_0x5407('0x11')]('Variable,\x20%s,\x20%s',_0x21bf28,_0x28a625[_0x5407('0x11')]['message']);return _0x45ea61(_0x28a625[_0x5407('0x11')][_0x5407('0x13')]);}else{logger[_0x5407('0xc')](_0x5407('0xd'),_0x21bf28,'request\x20sent');_0x45ea61(_0x28a625[_0x5407('0x14')]['message']);}})[_0x5407('0x15')](function(_0x1d7036){logger[_0x5407('0x11')]('Variable,\x20%s,\x20%s',_0x21bf28,_0x1d7036);_0x2e990a(_0x1d7036);});});}exports['ShowVariable']=function(_0x3b70a6){var _0x41d101=this;return new Promise(function(_0x365975,_0x5c3314){return db[_0x5407('0x16')][_0x5407('0x17')]({'raw':_0x3b70a6[_0x5407('0x18')]?_0x3b70a6['options'][_0x5407('0x19')]===undefined?!![]:![]:!![],'where':_0x3b70a6[_0x5407('0x18')]?_0x3b70a6[_0x5407('0x18')][_0x5407('0x1a')]||null:null,'attributes':_0x3b70a6[_0x5407('0x18')]?_0x3b70a6[_0x5407('0x18')]['attributes']||null:null,'include':_0x3b70a6[_0x5407('0x18')]?_0x3b70a6['options'][_0x5407('0x1b')]?_[_0x5407('0x1c')](_0x3b70a6[_0x5407('0x18')][_0x5407('0x1b')],function(_0x2adcb3){return{'model':db[_0x2adcb3[_0x5407('0x1d')]],'as':_0x2adcb3['as'],'attributes':_0x2adcb3['attributes'],'include':_0x2adcb3[_0x5407('0x1b')]?_[_0x5407('0x1c')](_0x2adcb3[_0x5407('0x1b')],function(_0x161e0d){return{'model':db[_0x161e0d[_0x5407('0x1d')]],'as':_0x161e0d['as'],'attributes':_0x161e0d['attributes'],'include':_0x161e0d[_0x5407('0x1b')]?_[_0x5407('0x1c')](_0x161e0d[_0x5407('0x1b')],function(_0x46a775){return{'model':db[_0x46a775[_0x5407('0x1d')]],'as':_0x46a775['as'],'attributes':_0x46a775[_0x5407('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33c24f){logger[_0x5407('0xc')](_0x5407('0x1f'),_0x3b70a6);logger[_0x5407('0x20')](_0x5407('0x1f'),_0x3b70a6,JSON[_0x5407('0x10')](_0x33c24f));_0x365975(_0x33c24f);})[_0x5407('0x15')](function(_0x2fc94e){logger[_0x5407('0x11')]('ShowVariable',_0x2fc94e[_0x5407('0x13')],_0x3b70a6);_0x5c3314(_0x41d101[_0x5407('0x11')](0x1f4,_0x2fc94e['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 527a939..4be7061 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 _0xabca=['Router','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','reset','pull','/restart','restart','/migrations','migrations','exports','express'];(function(_0x423128,_0x523828){var _0x1665b3=function(_0x150419){while(--_0x150419){_0x423128['push'](_0x423128['shift']());}};_0x1665b3(++_0x523828);}(_0xabca,0x1af));var _0xaabc=function(_0x23dd1e,_0x1d2798){_0x23dd1e=_0x23dd1e-0x0;var _0x46df2e=_0xabca[_0x23dd1e];return _0x46df2e;};'use strict';var express=require(_0xaabc('0x0'));var router=express[_0xaabc('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xaabc('0x2'));router[_0xaabc('0x3')]('/',controller[_0xaabc('0x4')]);router[_0xaabc('0x3')](_0xaabc('0x5'),auth[_0xaabc('0x6')](),auth[_0xaabc('0x7')](),controller[_0xaabc('0x8')]);router[_0xaabc('0x3')]('/reset',auth[_0xaabc('0x6')](),auth['canUpdate'](),controller[_0xaabc('0x9')]);router['get']('/pull',auth['isAuthenticated'](),auth[_0xaabc('0x7')](),controller[_0xaabc('0xa')]);router[_0xaabc('0x3')](_0xaabc('0xb'),auth[_0xaabc('0x6')](),controller[_0xaabc('0xc')]);router[_0xaabc('0x3')](_0xaabc('0xd'),controller[_0xaabc('0xe')]);module[_0xaabc('0xf')]=router; \ No newline at end of file +var _0x0e94=['pull','/restart','restart','/migrations','migrations','exports','express','./version.controller','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull'];(function(_0x5816f8,_0x485433){var _0x306d29=function(_0x13f3c1){while(--_0x13f3c1){_0x5816f8['push'](_0x5816f8['shift']());}};_0x306d29(++_0x485433);}(_0x0e94,0x8e));var _0x40e9=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x0e94[_0x8c43de];return _0xa6591b;};'use strict';var express=require(_0x40e9('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x40e9('0x1'));router[_0x40e9('0x2')]('/',controller[_0x40e9('0x3')]);router[_0x40e9('0x2')](_0x40e9('0x4'),auth[_0x40e9('0x5')](),auth['canUpdate'](),controller[_0x40e9('0x6')]);router[_0x40e9('0x2')](_0x40e9('0x7'),auth[_0x40e9('0x5')](),auth[_0x40e9('0x8')](),controller[_0x40e9('0x9')]);router[_0x40e9('0x2')](_0x40e9('0xa'),auth['isAuthenticated'](),auth[_0x40e9('0x8')](),controller[_0x40e9('0xb')]);router[_0x40e9('0x2')](_0x40e9('0xc'),auth['isAuthenticated'](),controller[_0x40e9('0xd')]);router[_0x40e9('0x2')](_0x40e9('0xe'),controller[_0x40e9('0xf')]);module[_0x40e9('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 898a20b..c8ac9e0 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 _0x24bb=['master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','root','server','length','.js','push','sort','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','version','compare-versions','exec','../../config/pm2','../../config/logger','update','index','exports','query','fetch','tags','latest','status','json','origin'];(function(_0x4888b5,_0x329960){var _0x2dbf2b=function(_0x5f49c5){while(--_0x5f49c5){_0x4888b5['push'](_0x4888b5['shift']());}};_0x2dbf2b(++_0x329960);}(_0x24bb,0x19f));var _0xb24b=function(_0x4d2911,_0x60b9cd){_0x4d2911=_0x4d2911-0x0;var _0x336b92=_0x24bb[_0x4d2911];return _0x336b92;};'use strict';var Umzug=require(_0xb24b('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xb24b('0x1'));var pkginfo=require('pkginfo')(module,_0xb24b('0x2'));var compareVersions=require(_0xb24b('0x3'));var exec=require('child_process')[_0xb24b('0x4')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0xb24b('0x5'));var logger=require(_0xb24b('0x6'))(_0xb24b('0x7'));var git=require('simple-git')(config['root']);exports[_0xb24b('0x8')]=function(_0x3d19e7,_0x2860bb){var _0x8f07ac={'current':module[_0xb24b('0x9')][_0xb24b('0x2')],'phonebar':0x2};if(_0x3d19e7[_0xb24b('0xa')]&&_0x3d19e7[_0xb24b('0xa')]['latest']){return git[_0xb24b('0xb')]()[_0xb24b('0xc')](function(_0x3d68d3,_0x24a9c7){_0x8f07ac['latest']=(_0x3d68d3?module['exports'][_0xb24b('0x2')]:_0x24a9c7[_0xb24b('0xd')])||'2.0.0';return _0x2860bb[_0xb24b('0xe')](0xc8)[_0xb24b('0xf')](_0x8f07ac);});}else{return _0x2860bb[_0xb24b('0xe')](0xc8)['json'](_0x8f07ac);}};exports[_0xb24b('0xb')]=function(_0x1d7894,_0x4f93f6){return git[_0xb24b('0xb')]([_0xb24b('0x10'),_0xb24b('0x11')],function(_0x2f89f5){if(_0x2f89f5){logger[_0xb24b('0x12')](_0x2f89f5);return _0x4f93f6['status'](0x1f4)[_0xb24b('0xf')](_0x2f89f5);}logger[_0xb24b('0x13')](_0xb24b('0x14'));return _0x4f93f6[_0xb24b('0xe')](0xc8)[_0xb24b('0xf')]({'output':_0xb24b('0x15')});});};exports[_0xb24b('0x16')]=function(_0x5cf988,_0x3285c4){return git[_0xb24b('0x16')]([_0xb24b('0x17'),'FETCH_HEAD'],function(_0x70294){if(_0x70294){logger[_0xb24b('0x12')](_0x70294);return _0x3285c4['status'](0x1f4)[_0xb24b('0xf')](_0x70294);}logger[_0xb24b('0x13')](_0xb24b('0x18'));return _0x3285c4[_0xb24b('0xe')](0xc8)[_0xb24b('0xf')]({'output':_0xb24b('0x19')});});};exports['pull']=function(_0x163fd0,_0x37746f){exec(_0xb24b('0x1a'),function(_0x2e8664,_0xfc656d,_0x5cede6){logger[_0xb24b('0x13')](_0xfc656d);logger[_0xb24b('0x13')](_0x5cede6);if(_0x2e8664){logger[_0xb24b('0x12')](_0x2e8664);return _0x37746f[_0xb24b('0xe')](0x1f4)['json'](_0x2e8664);}return _0x37746f[_0xb24b('0xe')](0xc8)['json']({'output':_0xfc656d});});};exports['restart']=function(_0x3981c4,_0x360c3e){return pm2['restart'](_0xb24b('0x1b'))[_0xb24b('0x1c')](function(_0x1f7045){logger[_0xb24b('0x13')]('pm2\x20restart\x20motion\x20%s',_0x1f7045);return _0x360c3e['status'](0xc8)['json']({'output':_0xb24b('0x1d')});})[_0xb24b('0x1e')](function(_0x38975f){logger['error'](_0x38975f);return _0x360c3e[_0xb24b('0xe')](0x1f4)[_0xb24b('0xf')](_0x38975f);});};exports[_0xb24b('0x1f')]=function(_0x53888d,_0x112c4d){var _0x12d30a=fs[_0xb24b('0x20')](path['join'](config[_0xb24b('0x21')],_0xb24b('0x22'),_0xb24b('0x1f')));var _0x36c97e=[];for(var _0x4561b9=0x0;_0x4561b9<_0x12d30a[_0xb24b('0x23')];_0x4561b9++){var _0x1d2b34=_0x12d30a[_0x4561b9]['replace'](_0xb24b('0x24'),'');if(compareVersions(module[_0xb24b('0x9')][_0xb24b('0x2')],_0x1d2b34)===-0x1){_0x36c97e[_0xb24b('0x25')](_0x1d2b34);}}if(_0x36c97e[_0xb24b('0x23')]){var _0x1ee935=_0x36c97e[_0xb24b('0x26')](compareVersions);var _0x2fd3fe=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xb24b('0x27')],'modelName':_0xb24b('0x27'),'columnName':_0xb24b('0x2')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0xb24b('0x28')][_0xb24b('0x29')],function(){throw new Error(_0xb24b('0x2a'));}],'path':path[_0xb24b('0x2b')](config[_0xb24b('0x21')],_0xb24b('0x22'),_0xb24b('0x1f')),'pattern':/\.js$/}});_0x2fd3fe['up']({'migrations':_['map'](_0x1ee935,function(_0x2c2add){return _0x2c2add+'.js';})})[_0xb24b('0x1c')](function(){return _0x112c4d[_0xb24b('0xe')](0xc8)[_0xb24b('0xf')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xb24b('0x9')]['version']+_0xb24b('0x2c')+_[_0xb24b('0x2d')](_0x1ee935),'migrations':_[_0xb24b('0x2b')](_0x1ee935)});})[_0xb24b('0x1e')](function(_0x1dc5e8){if(_0x1dc5e8 instanceof db['sequelize'][_0xb24b('0x2e')]){return _0x112c4d[_0xb24b('0xe')](0xc8)['json']({'output':_0xb24b('0x2f')});}else{return _0x112c4d[_0xb24b('0xe')](0x1f4)[_0xb24b('0xf')](_0x1dc5e8);}});}else{return _0x112c4d['status'](0xc8)['json']({'output':_0xb24b('0x2f')});}}; \ No newline at end of file +var _0x2ff5=['Database\x20already\x20up-to-date','path','lodash','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','json','origin','master','error','info','git\x20fetch','status','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','root','server','length','.js','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','UniqueConstraintError'];(function(_0x1834b6,_0x3d3fd6){var _0x10e77f=function(_0x8b75ac){while(--_0x8b75ac){_0x1834b6['push'](_0x1834b6['shift']());}};_0x10e77f(++_0x3d3fd6);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x2f68d1,_0x576eac){_0x2f68d1=_0x2f68d1-0x0;var _0x6ab296=_0x2ff5[_0x2f68d1];return _0x6ab296;};'use strict';var Umzug=require('umzug');var path=require(_0x52ff('0x0'));var fs=require('fs');var _=require(_0x52ff('0x1'));var pkginfo=require('pkginfo')(module,_0x52ff('0x2'));var compareVersions=require(_0x52ff('0x3'));var exec=require(_0x52ff('0x4'))[_0x52ff('0x5')];var db=require(_0x52ff('0x6'))['db'];var config=require(_0x52ff('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x52ff('0x8'))(_0x52ff('0x9'));var git=require(_0x52ff('0xa'))(config['root']);exports[_0x52ff('0xb')]=function(_0xbbba62,_0x3cfd13){var _0x17ca0b={'current':module[_0x52ff('0xc')][_0x52ff('0x2')],'phonebar':0x2};if(_0xbbba62[_0x52ff('0xd')]&&_0xbbba62[_0x52ff('0xd')][_0x52ff('0xe')]){return git[_0x52ff('0xf')]()[_0x52ff('0x10')](function(_0x111904,_0xe66d8f){_0x17ca0b[_0x52ff('0xe')]=(_0x111904?module[_0x52ff('0xc')]['version']:_0xe66d8f['latest'])||'2.0.0';return _0x3cfd13['status'](0xc8)[_0x52ff('0x11')](_0x17ca0b);});}else{return _0x3cfd13['status'](0xc8)[_0x52ff('0x11')](_0x17ca0b);}};exports[_0x52ff('0xf')]=function(_0x5de1cc,_0xb12d66){return git[_0x52ff('0xf')]([_0x52ff('0x12'),_0x52ff('0x13')],function(_0x418202){if(_0x418202){logger[_0x52ff('0x14')](_0x418202);return _0xb12d66['status'](0x1f4)[_0x52ff('0x11')](_0x418202);}logger[_0x52ff('0x15')](_0x52ff('0x16'));return _0xb12d66[_0x52ff('0x17')](0xc8)[_0x52ff('0x11')]({'output':_0x52ff('0x18')});});};exports['reset']=function(_0x426858,_0x154419){return git[_0x52ff('0x19')]([_0x52ff('0x1a'),'FETCH_HEAD'],function(_0x355ea4){if(_0x355ea4){logger[_0x52ff('0x14')](_0x355ea4);return _0x154419[_0x52ff('0x17')](0x1f4)[_0x52ff('0x11')](_0x355ea4);}logger[_0x52ff('0x15')](_0x52ff('0x1b'));return _0x154419[_0x52ff('0x17')](0xc8)[_0x52ff('0x11')]({'output':_0x52ff('0x1c')});});};exports[_0x52ff('0x1d')]=function(_0x30c1e9,_0x1f4bf3){exec(_0x52ff('0x1e'),function(_0x439011,_0x174a01,_0xe68eb5){logger[_0x52ff('0x15')](_0x174a01);logger[_0x52ff('0x15')](_0xe68eb5);if(_0x439011){logger['error'](_0x439011);return _0x1f4bf3[_0x52ff('0x17')](0x1f4)[_0x52ff('0x11')](_0x439011);}return _0x1f4bf3[_0x52ff('0x17')](0xc8)[_0x52ff('0x11')]({'output':_0x174a01});});};exports['restart']=function(_0x4172ec,_0xc68d3b){return pm2[_0x52ff('0x1f')]('motion2')['then'](function(_0x1ac770){logger[_0x52ff('0x15')](_0x52ff('0x20'),_0x1ac770);return _0xc68d3b[_0x52ff('0x17')](0xc8)[_0x52ff('0x11')]({'output':_0x52ff('0x21')});})[_0x52ff('0x22')](function(_0x322260){logger[_0x52ff('0x14')](_0x322260);return _0xc68d3b[_0x52ff('0x17')](0x1f4)[_0x52ff('0x11')](_0x322260);});};exports[_0x52ff('0x23')]=function(_0x406343,_0x33b41b){var _0x4e4571=fs[_0x52ff('0x24')](path['join'](config[_0x52ff('0x25')],_0x52ff('0x26'),'migrations'));var _0x2d1cba=[];for(var _0x326d23=0x0;_0x326d23<_0x4e4571[_0x52ff('0x27')];_0x326d23++){var _0x2e6c9a=_0x4e4571[_0x326d23]['replace'](_0x52ff('0x28'),'');if(compareVersions(module[_0x52ff('0xc')]['version'],_0x2e6c9a)===-0x1){_0x2d1cba[_0x52ff('0x29')](_0x2e6c9a);}}if(_0x2d1cba[_0x52ff('0x27')]){var _0xef339d=_0x2d1cba[_0x52ff('0x2a')](compareVersions);var _0x52206b=new Umzug({'storage':_0x52ff('0x2b'),'storageOptions':{'model':db[_0x52ff('0x2c')],'modelName':'Migration','columnName':_0x52ff('0x2')},'migrations':{'params':[db[_0x52ff('0x2b')][_0x52ff('0x2d')](),db[_0x52ff('0x2b')]['constructor'],function(){throw new Error(_0x52ff('0x2e'));}],'path':path['join'](config[_0x52ff('0x25')],_0x52ff('0x26'),'migrations'),'pattern':/\.js$/}});_0x52206b['up']({'migrations':_[_0x52ff('0x2f')](_0xef339d,function(_0x10cfdd){return _0x10cfdd+_0x52ff('0x28');})})['then'](function(){return _0x33b41b['status'](0xc8)[_0x52ff('0x11')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x52ff('0xc')]['version']+_0x52ff('0x30')+_[_0x52ff('0x31')](_0xef339d),'migrations':_['join'](_0xef339d)});})[_0x52ff('0x22')](function(_0x2674e5){if(_0x2674e5 instanceof db[_0x52ff('0x2b')][_0x52ff('0x32')]){return _0x33b41b[_0x52ff('0x17')](0xc8)[_0x52ff('0x11')]({'output':_0x52ff('0x33')});}else{return _0x33b41b['status'](0x1f4)[_0x52ff('0x11')](_0x2674e5);}});}else{return _0x33b41b[_0x52ff('0x17')](0xc8)[_0x52ff('0x11')]({'output':_0x52ff('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 8dea5e6..846e4f0 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 _0x2032=['destroy','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','delete'];(function(_0x23942b,_0xfef9d3){var _0x46c97e=function(_0x403899){while(--_0x403899){_0x23942b['push'](_0x23942b['shift']());}};_0x46c97e(++_0xfef9d3);}(_0x2032,0xd9));var _0x2203=function(_0x5e21af,_0x4be76a){_0x5e21af=_0x5e21af-0x0;var _0x39cc91=_0x2032[_0x5e21af];return _0x39cc91;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0xe')]);router[_0x2203('0xf')]('/:id',auth[_0x2203('0x9')](),controller['update']);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0x11')]);module['exports']=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','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x1448f2,_0x5d3304){var _0xd409c2=function(_0x19f2f5){while(--_0x19f2f5){_0x1448f2['push'](_0x1448f2['shift']());}};_0xd409c2(++_0x5d3304);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'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/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index a29d096..394e6b2 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 _0x5d17=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5d17,0x114));var _0x75d1=function(_0x4ac31f,_0x3bf843){_0x4ac31f=_0x4ac31f-0x0;var _0x1f1926=_0x5d17[_0x4ac31f];return _0x1f1926;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x75d1('0x2')]},'calleridname':{'type':Sequelize[_0x75d1('0x2')]},'queue':{'type':Sequelize[_0x75d1('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x75d1('0x2')]},'agentcalledAt':{'type':Sequelize[_0x75d1('0x3')]},'agentconnectAt':{'type':Sequelize[_0x75d1('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x75d1('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x75d1('0x3')]},'holdtime':{'type':Sequelize[_0x75d1('0x4')]},'agentcomplete':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x75d1('0x4')]},'agentacw':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x75d1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x75d1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x75d1('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x75d1('0x2')]},'accountcode':{'type':Sequelize[_0x75d1('0x2')]},'context':{'type':Sequelize[_0x75d1('0x2')]},'exten':{'type':Sequelize[_0x75d1('0x2')]},'priority':{'type':Sequelize[_0x75d1('0x2')]},'destchannel':{'type':Sequelize[_0x75d1('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x75d1('0x2')]},'destcalleridnum':{'type':Sequelize[_0x75d1('0x2')]},'destcalleridname':{'type':Sequelize[_0x75d1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x75d1('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x75d1('0x2')]},'destexten':{'type':Sequelize[_0x75d1('0x2')]},'destpriority':{'type':Sequelize[_0x75d1('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x75d1('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x75d1('0x2')]},'transfer':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x75d1('0x2')],'comment':_0x75d1('0x6')},'transferexten':{'type':Sequelize[_0x75d1('0x2')]},'transferuniqueid':{'type':Sequelize[_0x75d1('0x2')]},'agententerreason':{'type':Sequelize[_0x75d1('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdbf5=['BOOLEAN','exports','STRING','DATE','INTEGER'];(function(_0x4cc1c1,_0x3ad908){var _0x483778=function(_0x358fc5){while(--_0x358fc5){_0x4cc1c1['push'](_0x4cc1c1['shift']());}};_0x483778(++_0x3ad908);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x3db33f,_0x4a223d){_0x3db33f=_0x3db33f-0x0;var _0x5d916f=_0xdbf5[_0x3db33f];return _0x5d916f;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5dbf('0x1')]},'calleridname':{'type':Sequelize[_0x5dbf('0x1')]},'queue':{'type':Sequelize[_0x5dbf('0x1')]},'interface':{'type':Sequelize[_0x5dbf('0x1')]},'membername':{'type':Sequelize[_0x5dbf('0x1')]},'agentcalledAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentconnectAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentdumpAt':{'type':Sequelize[_0x5dbf('0x2')]},'holdtime':{'type':Sequelize[_0x5dbf('0x3')]},'agentcomplete':{'type':Sequelize[_0x5dbf('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x5dbf('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5dbf('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5dbf('0x3')]},'reason':{'type':Sequelize[_0x5dbf('0x1')]},'lastevent':{'type':Sequelize[_0x5dbf('0x1')]},'channel':{'type':Sequelize[_0x5dbf('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x5dbf('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x5dbf('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5dbf('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x5dbf('0x1')]},'destchannelstate':{'type':Sequelize[_0x5dbf('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5dbf('0x1')]},'destcalleridnum':{'type':Sequelize[_0x5dbf('0x1')]},'destcalleridname':{'type':Sequelize[_0x5dbf('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5dbf('0x1')]},'destaccountcode':{'type':Sequelize[_0x5dbf('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x5dbf('0x1')]},'destpriority':{'type':Sequelize[_0x5dbf('0x1')]},'destuniqueid':{'type':Sequelize[_0x5dbf('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x5dbf('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x5dbf('0x1')]},'transfer':{'type':Sequelize[_0x5dbf('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5dbf('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x5dbf('0x1')]},'agententerreason':{'type':Sequelize[_0x5dbf('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 911ce56..44acefc 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 _0x40df=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','where','filter','merge','VIRTUAL','options','includeAll','include','VoiceAgentReport','findAll','rows','catch','show','params','find','create','body','describe','html-pdf'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x40df,0x16c));var _0xf40d=function(_0x2bff88,_0x403bcf){_0x2bff88=_0x2bff88-0x0;var _0x302abc=_0x40df[_0x2bff88];return _0x302abc;};'use strict';var pdf=require(_0xf40d('0x0'));var emlformat=require(_0xf40d('0x1'));var rimraf=require(_0xf40d('0x2'));var zipdir=require(_0xf40d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf40d('0x4'));var moment=require(_0xf40d('0x5'));var BPromise=require(_0xf40d('0x6'));var Mustache=require('mustache');var util=require(_0xf40d('0x7'));var path=require(_0xf40d('0x8'));var sox=require(_0xf40d('0x9'));var csv=require(_0xf40d('0xa'));var ejs=require(_0xf40d('0xb'));var fs=require('fs');var fs_extra=require(_0xf40d('0xc'));var _=require(_0xf40d('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf40d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf40d('0xf'));var Papa=require('papaparse');var Redis=require(_0xf40d('0x10'));var authService=require(_0xf40d('0x11'));var qs=require(_0xf40d('0x12'));var as=require(_0xf40d('0x13'));var hardwareService=require(_0xf40d('0x14'));var logger=require(_0xf40d('0x15'))(_0xf40d('0x16'));var utils=require(_0xf40d('0x17'));var config=require(_0xf40d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf40d('0x19'))['db'];function respondWithStatusCode(_0x5f5c1b,_0x4f400e){_0x4f400e=_0x4f400e||0xcc;return function(_0x329b28){if(_0x329b28){return _0x5f5c1b['sendStatus'](_0x4f400e);}return _0x5f5c1b[_0xf40d('0x1a')](_0x4f400e)[_0xf40d('0x1b')]();};}function respondWithResult(_0x2ab870,_0x386831){_0x386831=_0x386831||0xc8;return function(_0x18dd56){if(_0x18dd56){return _0x2ab870[_0xf40d('0x1a')](_0x386831)[_0xf40d('0x1c')](_0x18dd56);}};}function respondWithFilteredResult(_0x3aa1bb,_0x42a60b){return function(_0x13c587){if(_0x13c587){var _0x576c10=_0x13c587[_0xf40d('0x1d')],_0x4be1e1=_0x42a60b['offset'],_0x3f38aa=_0x42a60b[_0xf40d('0x1e')]+_0x42a60b['limit'],_0x421db7;if(_0x3f38aa>=_0x576c10){_0x3f38aa=_0x576c10;_0x421db7=0xc8;}else{_0x421db7=0xce;}_0x3aa1bb[_0xf40d('0x1a')](_0x421db7);return _0x3aa1bb[_0xf40d('0x1f')](_0xf40d('0x20'),_0x4be1e1+'-'+_0x3f38aa+'/'+_0x576c10)['json'](_0x13c587);}return null;};}function patchUpdates(_0x266f24){return function(_0x18f36b){try{jsonpatch['apply'](_0x18f36b,_0x266f24,!![]);}catch(_0x545236){return BPromise['reject'](_0x545236);}return _0x18f36b['save']();};}function saveUpdates(_0x2dc396,_0x62c670){return function(_0x4dea06){if(_0x4dea06){return _0x4dea06['update'](_0x2dc396)[_0xf40d('0x21')](function(_0x3e0960){return _0x3e0960;});}return null;};}function removeEntity(_0xa65b45,_0xad8f35){return function(_0x4e2737){if(_0x4e2737){return _0x4e2737[_0xf40d('0x22')]()['then'](function(){_0xa65b45[_0xf40d('0x1a')](0xcc)[_0xf40d('0x1b')]();});}};}function handleEntityNotFound(_0x115c0e,_0x2e6b9b){return function(_0x16ef4f){if(!_0x16ef4f){_0x115c0e[_0xf40d('0x23')](0x194);}return _0x16ef4f;};}function handleError(_0x13e43f,_0x3d7612){_0x3d7612=_0x3d7612||0x1f4;return function(_0x201eac){logger[_0xf40d('0x24')](_0x201eac[_0xf40d('0x25')]);if(_0x201eac['name']){delete _0x201eac[_0xf40d('0x26')];}_0x13e43f[_0xf40d('0x1a')](_0x3d7612)['send'](_0x201eac);};}exports[_0xf40d('0x27')]=function(_0x200f5f,_0x1399fa){var _0x4f2806={},_0x9aa6a={},_0x5682dc={'count':0x0,'rows':[]};var _0x37d128=_[_0xf40d('0x28')](db['VoiceAgentReport'][_0xf40d('0x29')],function(_0x7a5b){return{'name':_0x7a5b[_0xf40d('0x2a')],'type':_0x7a5b[_0xf40d('0x2b')][_0xf40d('0x2c')]};});_0x9aa6a[_0xf40d('0x2d')]=_['map'](_0x37d128,_0xf40d('0x26'));_0x9aa6a['query']=_[_0xf40d('0x2e')](_0x200f5f[_0xf40d('0x2f')]);_0x9aa6a[_0xf40d('0x30')]=_[_0xf40d('0x31')](_0x9aa6a[_0xf40d('0x2d')],_0x9aa6a[_0xf40d('0x2f')]);_0x4f2806[_0xf40d('0x32')]=_[_0xf40d('0x31')](_0x9aa6a['model'],qs[_0xf40d('0x33')](_0x200f5f[_0xf40d('0x2f')][_0xf40d('0x33')]));_0x4f2806[_0xf40d('0x32')]=_0x4f2806[_0xf40d('0x32')][_0xf40d('0x34')]?_0x4f2806[_0xf40d('0x32')]:_0x9aa6a[_0xf40d('0x2d')];if(!_0x200f5f[_0xf40d('0x2f')][_0xf40d('0x35')]('nolimit')){_0x4f2806[_0xf40d('0x36')]=qs[_0xf40d('0x36')](_0x200f5f[_0xf40d('0x2f')][_0xf40d('0x36')]);_0x4f2806['offset']=qs[_0xf40d('0x1e')](_0x200f5f['query'][_0xf40d('0x1e')]);}_0x4f2806[_0xf40d('0x37')]=qs['sort'](_0x200f5f['query']['sort']);_0x4f2806[_0xf40d('0x38')]=qs['filters'](_['pick'](_0x200f5f[_0xf40d('0x2f')],_0x9aa6a[_0xf40d('0x30')]),_0x37d128);if(_0x200f5f[_0xf40d('0x2f')][_0xf40d('0x39')]){_0x4f2806[_0xf40d('0x38')]=_[_0xf40d('0x3a')](_0x4f2806[_0xf40d('0x38')],{'$or':_[_0xf40d('0x28')](_0x37d128,function(_0xe0789d){if(_0xe0789d[_0xf40d('0x2b')]!==_0xf40d('0x3b')){var _0x402073={};_0x402073[_0xe0789d['name']]={'$like':'%'+_0x200f5f['query']['filter']+'%'};return _0x402073;}})});}_0x4f2806=_[_0xf40d('0x3a')]({},_0x4f2806,_0x200f5f[_0xf40d('0x3c')]);var _0x225455={'where':_0x4f2806[_0xf40d('0x38')]};return db['VoiceAgentReport']['count'](_0x225455)[_0xf40d('0x21')](function(_0xea08d){_0x5682dc[_0xf40d('0x1d')]=_0xea08d;if(_0x200f5f[_0xf40d('0x2f')][_0xf40d('0x3d')]){_0x4f2806[_0xf40d('0x3e')]=[{'all':!![]}];}return db[_0xf40d('0x3f')][_0xf40d('0x40')](_0x4f2806);})[_0xf40d('0x21')](function(_0x5bee2f){_0x5682dc[_0xf40d('0x41')]=_0x5bee2f;return _0x5682dc;})[_0xf40d('0x21')](respondWithFilteredResult(_0x1399fa,_0x4f2806))[_0xf40d('0x42')](handleError(_0x1399fa,null));};exports[_0xf40d('0x43')]=function(_0x162b92,_0x4bf911){var _0x4dcee8={'raw':![],'where':{'id':_0x162b92[_0xf40d('0x44')]['id']}},_0x297bb8={};_0x297bb8[_0xf40d('0x2d')]=_[_0xf40d('0x2e')](db[_0xf40d('0x3f')][_0xf40d('0x29')]);_0x297bb8['query']=_['keys'](_0x162b92[_0xf40d('0x2f')]);_0x297bb8[_0xf40d('0x30')]=_[_0xf40d('0x31')](_0x297bb8['model'],_0x297bb8[_0xf40d('0x2f')]);_0x4dcee8[_0xf40d('0x32')]=_['intersection'](_0x297bb8['model'],qs[_0xf40d('0x33')](_0x162b92[_0xf40d('0x2f')][_0xf40d('0x33')]));_0x4dcee8[_0xf40d('0x32')]=_0x4dcee8[_0xf40d('0x32')]['length']?_0x4dcee8['attributes']:_0x297bb8[_0xf40d('0x2d')];if(_0x162b92[_0xf40d('0x2f')][_0xf40d('0x3d')]){_0x4dcee8['include']=[{'all':!![]}];}_0x4dcee8=_['merge']({},_0x4dcee8,_0x162b92['options']);return db[_0xf40d('0x3f')][_0xf40d('0x45')](_0x4dcee8)[_0xf40d('0x21')](handleEntityNotFound(_0x4bf911,null))[_0xf40d('0x21')](respondWithResult(_0x4bf911,null))[_0xf40d('0x42')](handleError(_0x4bf911,null));};exports[_0xf40d('0x46')]=function(_0xba7b11,_0x457718){return db['VoiceAgentReport'][_0xf40d('0x46')](_0xba7b11[_0xf40d('0x47')],{})[_0xf40d('0x21')](respondWithResult(_0x457718,0xc9))[_0xf40d('0x42')](handleError(_0x457718,null));};exports['update']=function(_0x2121e9,_0x25a7f3){if(_0x2121e9[_0xf40d('0x47')]['id']){delete _0x2121e9['body']['id'];}return db['VoiceAgentReport'][_0xf40d('0x45')]({'where':{'id':_0x2121e9[_0xf40d('0x44')]['id']}})[_0xf40d('0x21')](handleEntityNotFound(_0x25a7f3,null))[_0xf40d('0x21')](saveUpdates(_0x2121e9[_0xf40d('0x47')],null))[_0xf40d('0x21')](respondWithResult(_0x25a7f3,null))[_0xf40d('0x42')](handleError(_0x25a7f3,null));};exports[_0xf40d('0x22')]=function(_0x31f4d5,_0x5f4edf){return db[_0xf40d('0x3f')][_0xf40d('0x45')]({'where':{'id':_0x31f4d5[_0xf40d('0x44')]['id']}})[_0xf40d('0x21')](handleEntityNotFound(_0x5f4edf,null))['then'](removeEntity(_0x5f4edf,null))[_0xf40d('0x42')](handleError(_0x5f4edf,null));};exports[_0xf40d('0x48')]=function(_0x2a0c25,_0x26a6a3){return db[_0xf40d('0x3f')][_0xf40d('0x48')]()['then'](respondWithResult(_0x26a6a3,null))['catch'](handleError(_0x26a6a3,null));}; \ No newline at end of file +var _0xaac3=['key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','options','VoiceAgentReport','includeAll','include','catch','show','params','keys','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','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','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xaac3,0x150));var _0x3aac=function(_0x1c7279,_0x492626){_0x1c7279=_0x1c7279-0x0;var _0x579104=_0xaac3[_0x1c7279];return _0x579104;};'use strict';var pdf=require(_0x3aac('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3aac('0x1'));var zipdir=require(_0x3aac('0x2'));var jsonpatch=require(_0x3aac('0x3'));var rp=require(_0x3aac('0x4'));var moment=require(_0x3aac('0x5'));var BPromise=require(_0x3aac('0x6'));var Mustache=require(_0x3aac('0x7'));var util=require(_0x3aac('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3aac('0x9'));var ejs=require(_0x3aac('0xa'));var fs=require('fs');var fs_extra=require(_0x3aac('0xb'));var _=require('lodash');var squel=require(_0x3aac('0xc'));var crypto=require(_0x3aac('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3aac('0x9'));var querystring=require(_0x3aac('0xe'));var Papa=require(_0x3aac('0xf'));var Redis=require(_0x3aac('0x10'));var authService=require(_0x3aac('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3aac('0x12'));var hardwareService=require(_0x3aac('0x13'));var logger=require(_0x3aac('0x14'))(_0x3aac('0x15'));var utils=require(_0x3aac('0x16'));var config=require(_0x3aac('0x17'));var licenseUtil=require(_0x3aac('0x18'));var db=require(_0x3aac('0x19'))['db'];function respondWithStatusCode(_0x3640c0,_0x17bac2){_0x17bac2=_0x17bac2||0xcc;return function(_0x18bfc1){if(_0x18bfc1){return _0x3640c0[_0x3aac('0x1a')](_0x17bac2);}return _0x3640c0[_0x3aac('0x1b')](_0x17bac2)[_0x3aac('0x1c')]();};}function respondWithResult(_0x2f72e3,_0x1a309e){_0x1a309e=_0x1a309e||0xc8;return function(_0x1f42e8){if(_0x1f42e8){return _0x2f72e3[_0x3aac('0x1b')](_0x1a309e)[_0x3aac('0x1d')](_0x1f42e8);}};}function respondWithFilteredResult(_0x189f2,_0x588893){return function(_0x5ca7a1){if(_0x5ca7a1){var _0x32a0c4=_0x5ca7a1[_0x3aac('0x1e')],_0x448e5e=_0x588893[_0x3aac('0x1f')],_0x3a59db=_0x588893[_0x3aac('0x1f')]+_0x588893[_0x3aac('0x20')],_0x2cdba0;if(_0x3a59db>=_0x32a0c4){_0x3a59db=_0x32a0c4;_0x2cdba0=0xc8;}else{_0x2cdba0=0xce;}_0x189f2['status'](_0x2cdba0);return _0x189f2[_0x3aac('0x21')](_0x3aac('0x22'),_0x448e5e+'-'+_0x3a59db+'/'+_0x32a0c4)[_0x3aac('0x1d')](_0x5ca7a1);}return null;};}function patchUpdates(_0x58a426){return function(_0x7922b4){try{jsonpatch[_0x3aac('0x23')](_0x7922b4,_0x58a426,!![]);}catch(_0x5277c6){return BPromise[_0x3aac('0x24')](_0x5277c6);}return _0x7922b4[_0x3aac('0x25')]();};}function saveUpdates(_0x36262b,_0x197dae){return function(_0x4d9faf){if(_0x4d9faf){return _0x4d9faf['update'](_0x36262b)[_0x3aac('0x26')](function(_0x2d28c6){return _0x2d28c6;});}return null;};}function removeEntity(_0x118fb8,_0x5aacdd){return function(_0x248e6e){if(_0x248e6e){return _0x248e6e[_0x3aac('0x27')]()[_0x3aac('0x26')](function(){_0x118fb8[_0x3aac('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xef8eab,_0x3166a7){return function(_0x429a86){if(!_0x429a86){_0xef8eab['sendStatus'](0x194);}return _0x429a86;};}function handleError(_0x6f6db2,_0x5579bc){_0x5579bc=_0x5579bc||0x1f4;return function(_0x53ec40){logger[_0x3aac('0x28')](_0x53ec40[_0x3aac('0x29')]);if(_0x53ec40[_0x3aac('0x2a')]){delete _0x53ec40[_0x3aac('0x2a')];}_0x6f6db2[_0x3aac('0x1b')](_0x5579bc)[_0x3aac('0x2b')](_0x53ec40);};}exports[_0x3aac('0x2c')]=function(_0xcafa41,_0x52829e){var _0x2ddc59={},_0x1f0704={},_0x57dfd8={'count':0x0,'rows':[]};var _0x34a233=_[_0x3aac('0x2d')](db['VoiceAgentReport'][_0x3aac('0x2e')],function(_0x121f1a){return{'name':_0x121f1a[_0x3aac('0x2f')],'type':_0x121f1a[_0x3aac('0x30')][_0x3aac('0x31')]};});_0x1f0704[_0x3aac('0x32')]=_[_0x3aac('0x2d')](_0x34a233,'name');_0x1f0704['query']=_['keys'](_0xcafa41[_0x3aac('0x33')]);_0x1f0704['filters']=_[_0x3aac('0x34')](_0x1f0704[_0x3aac('0x32')],_0x1f0704[_0x3aac('0x33')]);_0x2ddc59[_0x3aac('0x35')]=_[_0x3aac('0x34')](_0x1f0704[_0x3aac('0x32')],qs[_0x3aac('0x36')](_0xcafa41['query']['fields']));_0x2ddc59[_0x3aac('0x35')]=_0x2ddc59['attributes'][_0x3aac('0x37')]?_0x2ddc59[_0x3aac('0x35')]:_0x1f0704[_0x3aac('0x32')];if(!_0xcafa41[_0x3aac('0x33')][_0x3aac('0x38')](_0x3aac('0x39'))){_0x2ddc59[_0x3aac('0x20')]=qs['limit'](_0xcafa41[_0x3aac('0x33')][_0x3aac('0x20')]);_0x2ddc59[_0x3aac('0x1f')]=qs[_0x3aac('0x1f')](_0xcafa41[_0x3aac('0x33')][_0x3aac('0x1f')]);}_0x2ddc59['order']=qs[_0x3aac('0x3a')](_0xcafa41[_0x3aac('0x33')]['sort']);_0x2ddc59['where']=qs[_0x3aac('0x3b')](_[_0x3aac('0x3c')](_0xcafa41[_0x3aac('0x33')],_0x1f0704[_0x3aac('0x3b')]),_0x34a233);if(_0xcafa41[_0x3aac('0x33')]['filter']){_0x2ddc59[_0x3aac('0x3d')]=_[_0x3aac('0x3e')](_0x2ddc59[_0x3aac('0x3d')],{'$or':_[_0x3aac('0x2d')](_0x34a233,function(_0x392a56){if(_0x392a56['type']!==_0x3aac('0x3f')){var _0x489253={};_0x489253[_0x392a56[_0x3aac('0x2a')]]={'$like':'%'+_0xcafa41[_0x3aac('0x33')]['filter']+'%'};return _0x489253;}})});}_0x2ddc59=_[_0x3aac('0x3e')]({},_0x2ddc59,_0xcafa41[_0x3aac('0x40')]);var _0xc42448={'where':_0x2ddc59[_0x3aac('0x3d')]};return db[_0x3aac('0x41')][_0x3aac('0x1e')](_0xc42448)['then'](function(_0x2c2afd){_0x57dfd8[_0x3aac('0x1e')]=_0x2c2afd;if(_0xcafa41[_0x3aac('0x33')][_0x3aac('0x42')]){_0x2ddc59[_0x3aac('0x43')]=[{'all':!![]}];}return db['VoiceAgentReport']['findAll'](_0x2ddc59);})['then'](function(_0x13dfe0){_0x57dfd8['rows']=_0x13dfe0;return _0x57dfd8;})[_0x3aac('0x26')](respondWithFilteredResult(_0x52829e,_0x2ddc59))[_0x3aac('0x44')](handleError(_0x52829e,null));};exports[_0x3aac('0x45')]=function(_0x4e1679,_0x1144b9){var _0x5a7d11={'raw':![],'where':{'id':_0x4e1679[_0x3aac('0x46')]['id']}},_0x2c7a60={};_0x2c7a60['model']=_[_0x3aac('0x47')](db[_0x3aac('0x41')][_0x3aac('0x2e')]);_0x2c7a60[_0x3aac('0x33')]=_['keys'](_0x4e1679['query']);_0x2c7a60[_0x3aac('0x3b')]=_[_0x3aac('0x34')](_0x2c7a60[_0x3aac('0x32')],_0x2c7a60[_0x3aac('0x33')]);_0x5a7d11['attributes']=_[_0x3aac('0x34')](_0x2c7a60[_0x3aac('0x32')],qs['fields'](_0x4e1679['query'][_0x3aac('0x36')]));_0x5a7d11[_0x3aac('0x35')]=_0x5a7d11[_0x3aac('0x35')][_0x3aac('0x37')]?_0x5a7d11[_0x3aac('0x35')]:_0x2c7a60[_0x3aac('0x32')];if(_0x4e1679[_0x3aac('0x33')]['includeAll']){_0x5a7d11['include']=[{'all':!![]}];}_0x5a7d11=_[_0x3aac('0x3e')]({},_0x5a7d11,_0x4e1679['options']);return db[_0x3aac('0x41')][_0x3aac('0x48')](_0x5a7d11)[_0x3aac('0x26')](handleEntityNotFound(_0x1144b9,null))['then'](respondWithResult(_0x1144b9,null))[_0x3aac('0x44')](handleError(_0x1144b9,null));};exports[_0x3aac('0x49')]=function(_0x3243f1,_0x42fe71){return db['VoiceAgentReport'][_0x3aac('0x49')](_0x3243f1[_0x3aac('0x4a')],{})[_0x3aac('0x26')](respondWithResult(_0x42fe71,0xc9))[_0x3aac('0x44')](handleError(_0x42fe71,null));};exports[_0x3aac('0x4b')]=function(_0x5687a3,_0xa00e8e){if(_0x5687a3[_0x3aac('0x4a')]['id']){delete _0x5687a3['body']['id'];}return db[_0x3aac('0x41')][_0x3aac('0x48')]({'where':{'id':_0x5687a3[_0x3aac('0x46')]['id']}})[_0x3aac('0x26')](handleEntityNotFound(_0xa00e8e,null))[_0x3aac('0x26')](saveUpdates(_0x5687a3[_0x3aac('0x4a')],null))['then'](respondWithResult(_0xa00e8e,null))[_0x3aac('0x44')](handleError(_0xa00e8e,null));};exports[_0x3aac('0x27')]=function(_0x4961eb,_0x32fa3b){return db[_0x3aac('0x41')][_0x3aac('0x48')]({'where':{'id':_0x4961eb[_0x3aac('0x46')]['id']}})[_0x3aac('0x26')](handleEntityNotFound(_0x32fa3b,null))[_0x3aac('0x26')](removeEntity(_0x32fa3b,null))[_0x3aac('0x44')](handleError(_0x32fa3b,null));};exports[_0x3aac('0x4c')]=function(_0xcf333a,_0x43339e){return db['VoiceAgentReport']['describe']()[_0x3aac('0x26')](respondWithResult(_0x43339e,null))[_0x3aac('0x44')](handleError(_0x43339e,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 95f06d6..c93cbe1 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 _0x60a8=['api','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util'];(function(_0x1ebeea,_0x2f54f4){var _0x576465=function(_0x47fc77){while(--_0x47fc77){_0x1ebeea['push'](_0x1ebeea['shift']());}};_0x576465(++_0x2f54f4);}(_0x60a8,0x108));var _0x860a=function(_0xd83b9b,_0x127a7e){_0xd83b9b=_0xd83b9b-0x0;var _0x5610e8=_0x60a8[_0xd83b9b];return _0x5610e8;};'use strict';var _=require(_0x860a('0x0'));var util=require(_0x860a('0x1'));var logger=require('../../config/logger')(_0x860a('0x2'));var moment=require('moment');var BPromise=require(_0x860a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x860a('0x4'));var rimraf=require(_0x860a('0x5'));var config=require(_0x860a('0x6'));var attributes=require(_0x860a('0x7'));module[_0x860a('0x8')]=function(_0x446bd0,_0x499907){return _0x446bd0[_0x860a('0x9')](_0x860a('0xa'),attributes,{'tableName':_0x860a('0xb'),'paranoid':![],'indexes':[{'fields':[_0x860a('0xc'),_0x860a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4be6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','report_agent','uniqueid','util'];(function(_0x1eb728,_0x4c3303){var _0x490b89=function(_0x48e621){while(--_0x48e621){_0x1eb728['push'](_0x1eb728['shift']());}};_0x490b89(++_0x4c3303);}(_0x4be6,0xb5));var _0x64be=function(_0x59db19,_0x30c1c6){_0x59db19=_0x59db19-0x0;var _0x5f0f09=_0x4be6[_0x59db19];return _0x5f0f09;};'use strict';var _=require('lodash');var util=require(_0x64be('0x0'));var logger=require(_0x64be('0x1'))(_0x64be('0x2'));var moment=require(_0x64be('0x3'));var BPromise=require(_0x64be('0x4'));var rp=require(_0x64be('0x5'));var fs=require('fs');var path=require(_0x64be('0x6'));var rimraf=require(_0x64be('0x7'));var config=require(_0x64be('0x8'));var attributes=require(_0x64be('0x9'));module['exports']=function(_0x131822,_0x2430e2){return _0x131822[_0x64be('0xa')]('VoiceAgentReport',attributes,{'tableName':_0x64be('0xb'),'paranoid':![],'indexes':[{'fields':[_0x64be('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 80b3a68..dea9b58 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 _0x4e68=['debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2f9180,_0x2b57d1){var _0x260448=function(_0x49da51){while(--_0x49da51){_0x2f9180['push'](_0x2f9180['shift']());}};_0x260448(++_0x2b57d1);}(_0x4e68,0x6c));var _0x84e6=function(_0x457752,_0x1ee3d1){_0x457752=_0x457752-0x0;var _0x4e6e46=_0x4e68[_0x457752];return _0x4e6e46;};'use strict';var _=require(_0x84e6('0x0'));var util=require('util');var moment=require(_0x84e6('0x1'));var BPromise=require(_0x84e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84e6('0x3'));var db=require(_0x84e6('0x4'))['db'];var utils=require(_0x84e6('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x84e6('0x6'));var client=jayson[_0x84e6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a13a1,_0x3ba57a,_0x2f4f80){return new BPromise(function(_0x579b66,_0x4a7cd4){return client[_0x84e6('0x8')](_0x4a13a1,_0x2f4f80)[_0x84e6('0x9')](function(_0x1c0543){logger['info'](_0x84e6('0xa'),_0x3ba57a,_0x84e6('0xb'));logger[_0x84e6('0xc')](_0x84e6('0xd'),_0x3ba57a,_0x84e6('0xb'),JSON[_0x84e6('0xe')](_0x1c0543));if(_0x1c0543[_0x84e6('0xf')]){if(_0x1c0543['error'][_0x84e6('0x10')]===0x1f4){logger[_0x84e6('0xf')](_0x84e6('0xa'),_0x3ba57a,_0x1c0543[_0x84e6('0xf')][_0x84e6('0x11')]);return _0x4a7cd4(_0x1c0543[_0x84e6('0xf')][_0x84e6('0x11')]);}logger['error'](_0x84e6('0xa'),_0x3ba57a,_0x1c0543[_0x84e6('0xf')][_0x84e6('0x11')]);return _0x579b66(_0x1c0543[_0x84e6('0xf')][_0x84e6('0x11')]);}else{logger[_0x84e6('0x12')](_0x84e6('0xa'),_0x3ba57a,_0x84e6('0xb'));_0x579b66(_0x1c0543['result'][_0x84e6('0x11')]);}})[_0x84e6('0x13')](function(_0x3c745d){logger[_0x84e6('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x3ba57a,_0x3c745d);_0x4a7cd4(_0x3c745d);});});}exports[_0x84e6('0x14')]=function(_0x188658){var _0x5477ed=this;return new Promise(function(_0x162025,_0x428cb4){return db[_0x84e6('0x15')][_0x84e6('0x16')](_0x188658[_0x84e6('0x17')],{'raw':_0x188658[_0x84e6('0x18')]?_0x188658['options'][_0x84e6('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4423a8){logger[_0x84e6('0x12')](_0x84e6('0x14'),_0x188658);logger[_0x84e6('0xc')](_0x84e6('0x14'),_0x188658,JSON['stringify'](_0x4423a8));_0x162025(_0x4423a8);})[_0x84e6('0x13')](function(_0x2d58f1){logger[_0x84e6('0xf')](_0x84e6('0x14'),_0x2d58f1[_0x84e6('0x11')],_0x188658);_0x428cb4(_0x5477ed[_0x84e6('0xf')](0x1f4,_0x2d58f1[_0x84e6('0x11')]));});});};exports[_0x84e6('0x1a')]=function(_0x172b01){var _0x65e3bb=this;return new Promise(function(_0x21ce89,_0x58f6d5){return db['VoiceAgentReport'][_0x84e6('0x1b')](_0x172b01[_0x84e6('0x17')],{'raw':_0x172b01[_0x84e6('0x18')]?_0x172b01[_0x84e6('0x18')][_0x84e6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x172b01[_0x84e6('0x18')]?_0x172b01[_0x84e6('0x18')][_0x84e6('0x1c')]||null:null,'attributes':_0x172b01[_0x84e6('0x18')]?_0x172b01[_0x84e6('0x18')][_0x84e6('0x1d')]||null:null,'limit':_0x172b01[_0x84e6('0x18')]?_0x172b01['options']['limit']||null:null})[_0x84e6('0x9')](function(_0x3f93d4){logger['info'](_0x84e6('0x1a'),_0x172b01);logger['debug']('UpdateVoiceAgentReport',_0x172b01,JSON[_0x84e6('0xe')](_0x3f93d4));_0x21ce89(_0x3f93d4);})[_0x84e6('0x13')](function(_0x3b1529){logger[_0x84e6('0xf')]('UpdateVoiceAgentReport',_0x3b1529[_0x84e6('0x11')],_0x172b01);_0x58f6d5(_0x65e3bb[_0x84e6('0xf')](0x1f4,_0x3b1529['message']));});});}; \ No newline at end of file +var _0xac67=['request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','info','stringify','UpdateVoiceAgentReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http'];(function(_0x91b128,_0x412ea5){var _0x23a1f3=function(_0x49987b){while(--_0x49987b){_0x91b128['push'](_0x91b128['shift']());}};_0x23a1f3(++_0x412ea5);}(_0xac67,0x1f3));var _0x7ac6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xac67[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x7ac6('0x0'));var util=require(_0x7ac6('0x1'));var moment=require(_0x7ac6('0x2'));var BPromise=require(_0x7ac6('0x3'));var rs=require(_0x7ac6('0x4'));var fs=require('fs');var Redis=require(_0x7ac6('0x5'));var db=require(_0x7ac6('0x6'))['db'];var utils=require(_0x7ac6('0x7'));var logger=require('../../config/logger')(_0x7ac6('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7ac6('0x9')][_0x7ac6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b2364,_0x220f4d,_0x3a1165){return new BPromise(function(_0xf53e3b,_0x2a6c93){return client[_0x7ac6('0xb')](_0x3b2364,_0x3a1165)[_0x7ac6('0xc')](function(_0x4279b1){logger['info'](_0x7ac6('0xd'),_0x220f4d,_0x7ac6('0xe'));logger[_0x7ac6('0xf')](_0x7ac6('0x10'),_0x220f4d,_0x7ac6('0xe'),JSON['stringify'](_0x4279b1));if(_0x4279b1['error']){if(_0x4279b1[_0x7ac6('0x11')][_0x7ac6('0x12')]===0x1f4){logger[_0x7ac6('0x11')](_0x7ac6('0xd'),_0x220f4d,_0x4279b1[_0x7ac6('0x11')]['message']);return _0x2a6c93(_0x4279b1['error'][_0x7ac6('0x13')]);}logger[_0x7ac6('0x11')](_0x7ac6('0xd'),_0x220f4d,_0x4279b1['error']['message']);return _0xf53e3b(_0x4279b1[_0x7ac6('0x11')][_0x7ac6('0x13')]);}else{logger['info'](_0x7ac6('0xd'),_0x220f4d,_0x7ac6('0xe'));_0xf53e3b(_0x4279b1['result']['message']);}})[_0x7ac6('0x14')](function(_0x3accb5){logger[_0x7ac6('0x11')](_0x7ac6('0xd'),_0x220f4d,_0x3accb5);_0x2a6c93(_0x3accb5);});});}exports[_0x7ac6('0x15')]=function(_0x4b2774){var _0x3c86fc=this;return new Promise(function(_0x51cff7,_0x296696){return db[_0x7ac6('0x16')][_0x7ac6('0x17')](_0x4b2774['body'],{'raw':_0x4b2774[_0x7ac6('0x18')]?_0x4b2774[_0x7ac6('0x18')][_0x7ac6('0x19')]===undefined?!![]:![]:!![]})[_0x7ac6('0xc')](function(_0x46fcf7){logger[_0x7ac6('0x1a')](_0x7ac6('0x15'),_0x4b2774);logger[_0x7ac6('0xf')](_0x7ac6('0x15'),_0x4b2774,JSON[_0x7ac6('0x1b')](_0x46fcf7));_0x51cff7(_0x46fcf7);})['catch'](function(_0x3a8e6d){logger[_0x7ac6('0x11')](_0x7ac6('0x15'),_0x3a8e6d[_0x7ac6('0x13')],_0x4b2774);_0x296696(_0x3c86fc[_0x7ac6('0x11')](0x1f4,_0x3a8e6d[_0x7ac6('0x13')]));});});};exports[_0x7ac6('0x1c')]=function(_0x4616a0){var _0x1c6112=this;return new Promise(function(_0x28cdfc,_0x24e71e){return db[_0x7ac6('0x16')][_0x7ac6('0x1d')](_0x4616a0[_0x7ac6('0x1e')],{'raw':_0x4616a0['options']?_0x4616a0[_0x7ac6('0x18')][_0x7ac6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4616a0['options']?_0x4616a0[_0x7ac6('0x18')][_0x7ac6('0x1f')]||null:null,'attributes':_0x4616a0[_0x7ac6('0x18')]?_0x4616a0[_0x7ac6('0x18')][_0x7ac6('0x20')]||null:null,'limit':_0x4616a0['options']?_0x4616a0[_0x7ac6('0x18')][_0x7ac6('0x21')]||null:null})['then'](function(_0x141784){logger[_0x7ac6('0x1a')](_0x7ac6('0x1c'),_0x4616a0);logger[_0x7ac6('0xf')](_0x7ac6('0x1c'),_0x4616a0,JSON[_0x7ac6('0x1b')](_0x141784));_0x28cdfc(_0x141784);})['catch'](function(_0x451821){logger[_0x7ac6('0x11')](_0x7ac6('0x1c'),_0x451821[_0x7ac6('0x13')],_0x4616a0);_0x24e71e(_0x1c6112[_0x7ac6('0x11')](0x1f4,_0x451821[_0x7ac6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 0669ff5..c3fa17c 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index aaeffac..a9c2fd7 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 _0xda19=['outbound','outbound-fax','dialer','DATE','INTEGER','exports','STRING','inbound'];(function(_0x147e56,_0x2efae8){var _0x40c49c=function(_0x380aaa){while(--_0x380aaa){_0x147e56['push'](_0x147e56['shift']());}};_0x40c49c(++_0x2efae8);}(_0xda19,0xd5));var _0x9da1=function(_0x30d5c4,_0x48f423){_0x30d5c4=_0x30d5c4-0x0;var _0x20e7bc=_0xda19[_0x30d5c4];return _0x20e7bc;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'uniqueid':{'type':Sequelize[_0x9da1('0x1')]},'type':{'type':Sequelize['ENUM'](_0x9da1('0x2'),'internal',_0x9da1('0x3'),'inbound-fax',_0x9da1('0x4'),_0x9da1('0x5'))},'tag':{'type':Sequelize[_0x9da1('0x1')]},'accountcode':{'type':Sequelize[_0x9da1('0x1')]},'source':{'type':Sequelize[_0x9da1('0x1')]},'destination':{'type':Sequelize[_0x9da1('0x1')]},'destinationcontext':{'type':Sequelize[_0x9da1('0x1')]},'callerid':{'type':Sequelize[_0x9da1('0x1')]},'channel':{'type':Sequelize[_0x9da1('0x1')]},'destinationchannel':{'type':Sequelize[_0x9da1('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x9da1('0x6')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x9da1('0x6')]},'duration':{'type':Sequelize[_0x9da1('0x7')]},'billableseconds':{'type':Sequelize[_0x9da1('0x7')]},'mohtime':{'type':Sequelize[_0x9da1('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9da1('0x1')]},'amaflags':{'type':Sequelize[_0x9da1('0x1')]},'userfield':{'type':Sequelize[_0x9da1('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x9da1('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x9da1('0x1')]},'routeid':{'type':Sequelize[_0x9da1('0x7')]},'sipcallid':{'type':Sequelize[_0x9da1('0x1')]}}; \ No newline at end of file +var _0x3831=['DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','outbound','outbound-fax','TEXT'];(function(_0x1e28b8,_0x5a5bbf){var _0x179ec5=function(_0x3bd3e7){while(--_0x3bd3e7){_0x1e28b8['push'](_0x1e28b8['shift']());}};_0x179ec5(++_0x5a5bbf);}(_0x3831,0x14c));var _0x1383=function(_0xfecbad,_0x5915f8){_0xfecbad=_0xfecbad-0x0;var _0x5e1806=_0x3831[_0xfecbad];return _0x5e1806;};'use strict';var Sequelize=require(_0x1383('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1383('0x1')]},'type':{'type':Sequelize[_0x1383('0x2')](_0x1383('0x3'),_0x1383('0x4'),_0x1383('0x5'),'inbound-fax',_0x1383('0x6'),'dialer')},'tag':{'type':Sequelize[_0x1383('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x1383('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1383('0x1')]},'destinationchannel':{'type':Sequelize[_0x1383('0x1')]},'lastapplication':{'type':Sequelize[_0x1383('0x1')]},'lastdata':{'type':Sequelize[_0x1383('0x7')]},'starttime':{'type':Sequelize[_0x1383('0x8')]},'systemanswertime':{'type':Sequelize[_0x1383('0x8')]},'answertime':{'type':Sequelize[_0x1383('0x8')]},'endtime':{'type':Sequelize[_0x1383('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x1383('0x9')]},'mohtime':{'type':Sequelize[_0x1383('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1383('0x1')]},'amaflags':{'type':Sequelize[_0x1383('0x1')]},'userfield':{'type':Sequelize[_0x1383('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x1383('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x1383('0x1')]},'note':{'type':Sequelize[_0x1383('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x1383('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 654af27..aa5ecf7 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 _0xa72f=['stack','name','send','index','VoiceCallReport','rawAttributes','type','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','fullname','User','rows','catch','show','params','create','body','describe','uniqueid','find','user','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error'];(function(_0x3e5295,_0x2347f6){var _0x2f90da=function(_0x48cbd3){while(--_0x48cbd3){_0x3e5295['push'](_0x3e5295['shift']());}};_0x2f90da(++_0x2347f6);}(_0xa72f,0x100));var _0xfa72=function(_0x24c135,_0xdb4450){_0x24c135=_0x24c135-0x0;var _0x290c66=_0xa72f[_0x24c135];return _0x290c66;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa72('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa72('0x1'));var moment=require('moment');var BPromise=require(_0xfa72('0x2'));var Mustache=require('mustache');var util=require(_0xfa72('0x3'));var path=require(_0xfa72('0x4'));var sox=require(_0xfa72('0x5'));var csv=require(_0xfa72('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa72('0x7'));var _=require(_0xfa72('0x8'));var squel=require(_0xfa72('0x9'));var crypto=require('crypto');var jsforce=require(_0xfa72('0xa'));var deskjs=require(_0xfa72('0xb'));var toCsv=require(_0xfa72('0x6'));var querystring=require(_0xfa72('0xc'));var Papa=require('papaparse');var Redis=require(_0xfa72('0xd'));var authService=require(_0xfa72('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfa72('0xf'));var hardwareService=require(_0xfa72('0x10'));var logger=require(_0xfa72('0x11'))(_0xfa72('0x12'));var utils=require('../../config/utils');var config=require(_0xfa72('0x13'));var licenseUtil=require(_0xfa72('0x14'));var db=require(_0xfa72('0x15'))['db'];function respondWithStatusCode(_0x11e98f,_0x4c2232){_0x4c2232=_0x4c2232||0xcc;return function(_0x20ac08){if(_0x20ac08){return _0x11e98f[_0xfa72('0x16')](_0x4c2232);}return _0x11e98f[_0xfa72('0x17')](_0x4c2232)[_0xfa72('0x18')]();};}function respondWithResult(_0x4e8fff,_0x522a73){_0x522a73=_0x522a73||0xc8;return function(_0x3681cc){if(_0x3681cc){return _0x4e8fff[_0xfa72('0x17')](_0x522a73)['json'](_0x3681cc);}};}function respondWithFilteredResult(_0x48016c,_0x2b68ee){return function(_0x2d9606){if(_0x2d9606){var _0x4c5d96=_0x2d9606[_0xfa72('0x19')],_0x38e509=_0x2b68ee[_0xfa72('0x1a')],_0x327da7=_0x2b68ee['offset']+_0x2b68ee[_0xfa72('0x1b')],_0x47f622;if(_0x327da7>=_0x4c5d96){_0x327da7=_0x4c5d96;_0x47f622=0xc8;}else{_0x47f622=0xce;}_0x48016c[_0xfa72('0x17')](_0x47f622);return _0x48016c[_0xfa72('0x1c')](_0xfa72('0x1d'),_0x38e509+'-'+_0x327da7+'/'+_0x4c5d96)['json'](_0x2d9606);}return null;};}function patchUpdates(_0x1a06e7){return function(_0x58e4cd){try{jsonpatch[_0xfa72('0x1e')](_0x58e4cd,_0x1a06e7,!![]);}catch(_0x430a88){return BPromise[_0xfa72('0x1f')](_0x430a88);}return _0x58e4cd['save']();};}function saveUpdates(_0x248c61,_0x29b7c0){return function(_0x29a41a){if(_0x29a41a){return _0x29a41a[_0xfa72('0x20')](_0x248c61)['then'](function(_0x69516c){return _0x69516c;});}return null;};}function removeEntity(_0x1ea4e7,_0x29b3fc){return function(_0x5adff7){if(_0x5adff7){return _0x5adff7[_0xfa72('0x21')]()[_0xfa72('0x22')](function(){_0x1ea4e7[_0xfa72('0x17')](0xcc)[_0xfa72('0x18')]();});}};}function handleEntityNotFound(_0x40cc9d,_0x275908){return function(_0x1ba30d){if(!_0x1ba30d){_0x40cc9d[_0xfa72('0x16')](0x194);}return _0x1ba30d;};}function handleError(_0xded18c,_0x111377){_0x111377=_0x111377||0x1f4;return function(_0x3aa2ce){logger[_0xfa72('0x23')](_0x3aa2ce[_0xfa72('0x24')]);if(_0x3aa2ce['name']){delete _0x3aa2ce[_0xfa72('0x25')];}_0xded18c[_0xfa72('0x17')](_0x111377)[_0xfa72('0x26')](_0x3aa2ce);};}exports[_0xfa72('0x27')]=function(_0x49885c,_0x38b44d){var _0x1d0374={},_0x547356={},_0x3836eb={'count':0x0,'rows':[]};var _0x433738=_['map'](db[_0xfa72('0x28')][_0xfa72('0x29')],function(_0x3702c8){return{'name':_0x3702c8['fieldName'],'type':_0x3702c8[_0xfa72('0x2a')]['key']};});_0x547356[_0xfa72('0x2b')]=_[_0xfa72('0x2c')](_0x433738,_0xfa72('0x25'));_0x547356[_0xfa72('0x2d')]=_[_0xfa72('0x2e')](_0x49885c['query']);_0x547356['filters']=_['intersection'](_0x547356['model'],_0x547356[_0xfa72('0x2d')]);_0x1d0374[_0xfa72('0x2f')]=_[_0xfa72('0x30')](_0x547356[_0xfa72('0x2b')],qs['fields'](_0x49885c[_0xfa72('0x2d')][_0xfa72('0x31')]));_0x1d0374[_0xfa72('0x2f')]=_0x1d0374['attributes'][_0xfa72('0x32')]?_0x1d0374[_0xfa72('0x2f')]:_0x547356[_0xfa72('0x2b')];if(!_0x49885c['query'][_0xfa72('0x33')]('nolimit')){_0x1d0374['limit']=qs[_0xfa72('0x1b')](_0x49885c[_0xfa72('0x2d')][_0xfa72('0x1b')]);_0x1d0374[_0xfa72('0x1a')]=qs[_0xfa72('0x1a')](_0x49885c[_0xfa72('0x2d')][_0xfa72('0x1a')]);}_0x1d0374[_0xfa72('0x34')]=qs[_0xfa72('0x35')](_0x49885c[_0xfa72('0x2d')][_0xfa72('0x35')]);_0x1d0374[_0xfa72('0x36')]=qs[_0xfa72('0x37')](_[_0xfa72('0x38')](_0x49885c['query'],_0x547356[_0xfa72('0x37')]),_0x433738);if(_0x49885c[_0xfa72('0x2d')][_0xfa72('0x39')]){_0x1d0374[_0xfa72('0x36')]=_[_0xfa72('0x3a')](_0x1d0374[_0xfa72('0x36')],{'$or':_['map'](_0x433738,function(_0xab798){if(_0xab798[_0xfa72('0x2a')]!==_0xfa72('0x3b')){var _0x1101fa={};_0x1101fa[_0xab798['name']]={'$like':'%'+_0x49885c['query'][_0xfa72('0x39')]+'%'};return _0x1101fa;}})});}_0x1d0374=_[_0xfa72('0x3a')]({},_0x1d0374,_0x49885c[_0xfa72('0x3c')]);var _0x4d7992={'where':_0x1d0374[_0xfa72('0x36')]};return db[_0xfa72('0x28')][_0xfa72('0x19')](_0x4d7992)[_0xfa72('0x22')](function(_0x308a12){_0x3836eb[_0xfa72('0x19')]=_0x308a12;if(_0x49885c[_0xfa72('0x2d')]['includeAll']){_0x1d0374['include']=[{'attributes':['id',_0xfa72('0x25'),_0xfa72('0x3d'),'alias'],'model':db[_0xfa72('0x3e')],'as':_0xfa72('0x3e')}];}return db[_0xfa72('0x28')]['findAll'](_0x1d0374);})[_0xfa72('0x22')](function(_0x78ebec){_0x3836eb[_0xfa72('0x3f')]=_0x78ebec;return _0x3836eb;})[_0xfa72('0x22')](respondWithFilteredResult(_0x38b44d,_0x1d0374))[_0xfa72('0x40')](handleError(_0x38b44d,null));};exports[_0xfa72('0x41')]=function(_0x3b28a7,_0x16998d){var _0x209ac8={'raw':!![],'where':{'id':_0x3b28a7[_0xfa72('0x42')]['id']}},_0x3620d4={};_0x3620d4[_0xfa72('0x2b')]=_[_0xfa72('0x2e')](db[_0xfa72('0x28')]['rawAttributes']);_0x3620d4[_0xfa72('0x2d')]=_[_0xfa72('0x2e')](_0x3b28a7[_0xfa72('0x2d')]);_0x3620d4[_0xfa72('0x37')]=_['intersection'](_0x3620d4[_0xfa72('0x2b')],_0x3620d4[_0xfa72('0x2d')]);_0x209ac8['attributes']=_[_0xfa72('0x30')](_0x3620d4[_0xfa72('0x2b')],qs[_0xfa72('0x31')](_0x3b28a7[_0xfa72('0x2d')]['fields']));_0x209ac8[_0xfa72('0x2f')]=_0x209ac8['attributes'][_0xfa72('0x32')]?_0x209ac8[_0xfa72('0x2f')]:_0x3620d4[_0xfa72('0x2b')];if(_0x3b28a7[_0xfa72('0x2d')]['includeAll']){_0x209ac8['include']=[{'all':!![]}];}_0x209ac8=_[_0xfa72('0x3a')]({},_0x209ac8,_0x3b28a7[_0xfa72('0x3c')]);return db[_0xfa72('0x28')]['find'](_0x209ac8)['then'](handleEntityNotFound(_0x16998d,null))['then'](respondWithResult(_0x16998d,null))[_0xfa72('0x40')](handleError(_0x16998d,null));};exports['create']=function(_0x5a2d9a,_0x298379){return db[_0xfa72('0x28')][_0xfa72('0x43')](_0x5a2d9a[_0xfa72('0x44')],{})[_0xfa72('0x22')](respondWithResult(_0x298379,0xc9))[_0xfa72('0x40')](handleError(_0x298379,null));};exports['destroy']=function(_0x16f3af,_0x3c2b51){return db[_0xfa72('0x28')]['find']({'where':{'id':_0x16f3af[_0xfa72('0x42')]['id']}})[_0xfa72('0x22')](handleEntityNotFound(_0x3c2b51,null))[_0xfa72('0x22')](removeEntity(_0x3c2b51,null))[_0xfa72('0x40')](handleError(_0x3c2b51,null));};exports[_0xfa72('0x45')]=function(_0x4f49f0,_0x8eeb84){return db['VoiceCallReport'][_0xfa72('0x45')]()[_0xfa72('0x22')](respondWithResult(_0x8eeb84,null))['catch'](handleError(_0x8eeb84,null));};exports[_0xfa72('0x20')]=function(_0x62e46e,_0x18027d){if(_0x62e46e[_0xfa72('0x44')][_0xfa72('0x46')]){delete _0x62e46e[_0xfa72('0x44')][_0xfa72('0x46')];}return db['VoiceCallReport'][_0xfa72('0x47')]({'where':{'uniqueid':_0x62e46e[_0xfa72('0x42')]['id'],'UserId':{'$or':[null,_0x62e46e[_0xfa72('0x48')]['id']]}}})[_0xfa72('0x22')](handleEntityNotFound(_0x18027d,null))[_0xfa72('0x22')](saveUpdates(_0x62e46e['body'],null))[_0xfa72('0x22')](respondWithResult(_0x18027d,null))[_0xfa72('0x40')](handleError(_0x18027d,null));}; \ No newline at end of file +var _0x881b=['filter','merge','VIRTUAL','includeAll','include','alias','User','findAll','then','rows','catch','show','keys','length','options','find','create','body','params','describe','uniqueid','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','save','end','stack','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','limit','sort','where','pick'];(function(_0x2d7242,_0x3820f6){var _0x3cf1d8=function(_0x2596f2){while(--_0x2596f2){_0x2d7242['push'](_0x2d7242['shift']());}};_0x3cf1d8(++_0x3820f6);}(_0x881b,0xff));var _0xb881=function(_0x58c85f,_0x3fea0d){_0x58c85f=_0x58c85f-0x0;var _0x30bc76=_0x881b[_0x58c85f];return _0x30bc76;};'use strict';var pdf=require(_0xb881('0x0'));var emlformat=require(_0xb881('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb881('0x2'));var jsonpatch=require(_0xb881('0x3'));var rp=require('request-promise');var moment=require(_0xb881('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb881('0x5'));var util=require(_0xb881('0x6'));var path=require(_0xb881('0x7'));var sox=require(_0xb881('0x8'));var csv=require('to-csv');var ejs=require(_0xb881('0x9'));var fs=require('fs');var fs_extra=require(_0xb881('0xa'));var _=require(_0xb881('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb881('0xc'));var deskjs=require(_0xb881('0xd'));var toCsv=require(_0xb881('0xe'));var querystring=require('querystring');var Papa=require(_0xb881('0xf'));var Redis=require(_0xb881('0x10'));var authService=require(_0xb881('0x11'));var qs=require(_0xb881('0x12'));var as=require(_0xb881('0x13'));var hardwareService=require(_0xb881('0x14'));var logger=require(_0xb881('0x15'))(_0xb881('0x16'));var utils=require(_0xb881('0x17'));var config=require(_0xb881('0x18'));var licenseUtil=require(_0xb881('0x19'));var db=require(_0xb881('0x1a'))['db'];function respondWithStatusCode(_0xc945ba,_0x2b4820){_0x2b4820=_0x2b4820||0xcc;return function(_0x1185f5){if(_0x1185f5){return _0xc945ba[_0xb881('0x1b')](_0x2b4820);}return _0xc945ba[_0xb881('0x1c')](_0x2b4820)['end']();};}function respondWithResult(_0x48d1c6,_0x28b75c){_0x28b75c=_0x28b75c||0xc8;return function(_0x829364){if(_0x829364){return _0x48d1c6[_0xb881('0x1c')](_0x28b75c)[_0xb881('0x1d')](_0x829364);}};}function respondWithFilteredResult(_0x747b4d,_0x10dd6d){return function(_0x359174){if(_0x359174){var _0x3f86e1=_0x359174[_0xb881('0x1e')],_0x51e123=_0x10dd6d[_0xb881('0x1f')],_0x452627=_0x10dd6d[_0xb881('0x1f')]+_0x10dd6d['limit'],_0x2f5a35;if(_0x452627>=_0x3f86e1){_0x452627=_0x3f86e1;_0x2f5a35=0xc8;}else{_0x2f5a35=0xce;}_0x747b4d[_0xb881('0x1c')](_0x2f5a35);return _0x747b4d[_0xb881('0x20')](_0xb881('0x21'),_0x51e123+'-'+_0x452627+'/'+_0x3f86e1)['json'](_0x359174);}return null;};}function patchUpdates(_0x49f197){return function(_0x1cbd7c){try{jsonpatch['apply'](_0x1cbd7c,_0x49f197,!![]);}catch(_0x826729){return BPromise['reject'](_0x826729);}return _0x1cbd7c[_0xb881('0x22')]();};}function saveUpdates(_0x5eae58,_0x5cef1a){return function(_0x9fad47){if(_0x9fad47){return _0x9fad47['update'](_0x5eae58)['then'](function(_0x2edbf9){return _0x2edbf9;});}return null;};}function removeEntity(_0x7320e8,_0xaf7218){return function(_0x4497e8){if(_0x4497e8){return _0x4497e8['destroy']()['then'](function(){_0x7320e8['status'](0xcc)[_0xb881('0x23')]();});}};}function handleEntityNotFound(_0x67e94d,_0x10bfb3){return function(_0x1ef852){if(!_0x1ef852){_0x67e94d[_0xb881('0x1b')](0x194);}return _0x1ef852;};}function handleError(_0x2a70c8,_0xdf40ca){_0xdf40ca=_0xdf40ca||0x1f4;return function(_0x5db00d){logger['error'](_0x5db00d[_0xb881('0x24')]);if(_0x5db00d['name']){delete _0x5db00d[_0xb881('0x25')];}_0x2a70c8[_0xb881('0x1c')](_0xdf40ca)[_0xb881('0x26')](_0x5db00d);};}exports[_0xb881('0x27')]=function(_0x4280fb,_0x4a9529){var _0x233d8e={},_0x11f342={},_0x3c7a70={'count':0x0,'rows':[]};var _0xfbc255=_[_0xb881('0x28')](db[_0xb881('0x29')][_0xb881('0x2a')],function(_0x2f7699){return{'name':_0x2f7699[_0xb881('0x2b')],'type':_0x2f7699[_0xb881('0x2c')][_0xb881('0x2d')]};});_0x11f342[_0xb881('0x2e')]=_['map'](_0xfbc255,'name');_0x11f342[_0xb881('0x2f')]=_['keys'](_0x4280fb[_0xb881('0x2f')]);_0x11f342[_0xb881('0x30')]=_[_0xb881('0x31')](_0x11f342[_0xb881('0x2e')],_0x11f342[_0xb881('0x2f')]);_0x233d8e['attributes']=_[_0xb881('0x31')](_0x11f342[_0xb881('0x2e')],qs[_0xb881('0x32')](_0x4280fb[_0xb881('0x2f')][_0xb881('0x32')]));_0x233d8e[_0xb881('0x33')]=_0x233d8e['attributes']['length']?_0x233d8e['attributes']:_0x11f342[_0xb881('0x2e')];if(!_0x4280fb[_0xb881('0x2f')][_0xb881('0x34')]('nolimit')){_0x233d8e['limit']=qs[_0xb881('0x35')](_0x4280fb['query'][_0xb881('0x35')]);_0x233d8e[_0xb881('0x1f')]=qs[_0xb881('0x1f')](_0x4280fb[_0xb881('0x2f')]['offset']);}_0x233d8e['order']=qs[_0xb881('0x36')](_0x4280fb['query']['sort']);_0x233d8e[_0xb881('0x37')]=qs[_0xb881('0x30')](_[_0xb881('0x38')](_0x4280fb['query'],_0x11f342[_0xb881('0x30')]),_0xfbc255);if(_0x4280fb[_0xb881('0x2f')][_0xb881('0x39')]){_0x233d8e[_0xb881('0x37')]=_[_0xb881('0x3a')](_0x233d8e[_0xb881('0x37')],{'$or':_[_0xb881('0x28')](_0xfbc255,function(_0x48b846){if(_0x48b846['type']!==_0xb881('0x3b')){var _0x55da31={};_0x55da31[_0x48b846[_0xb881('0x25')]]={'$like':'%'+_0x4280fb['query']['filter']+'%'};return _0x55da31;}})});}_0x233d8e=_[_0xb881('0x3a')]({},_0x233d8e,_0x4280fb['options']);var _0x43794c={'where':_0x233d8e['where']};return db[_0xb881('0x29')][_0xb881('0x1e')](_0x43794c)['then'](function(_0x385373){_0x3c7a70['count']=_0x385373;if(_0x4280fb[_0xb881('0x2f')][_0xb881('0x3c')]){_0x233d8e[_0xb881('0x3d')]=[{'attributes':['id','name','fullname',_0xb881('0x3e')],'model':db[_0xb881('0x3f')],'as':_0xb881('0x3f')}];}return db[_0xb881('0x29')][_0xb881('0x40')](_0x233d8e);})[_0xb881('0x41')](function(_0x429c46){_0x3c7a70[_0xb881('0x42')]=_0x429c46;return _0x3c7a70;})['then'](respondWithFilteredResult(_0x4a9529,_0x233d8e))[_0xb881('0x43')](handleError(_0x4a9529,null));};exports[_0xb881('0x44')]=function(_0x2ef4a5,_0x1d07ca){var _0x565cea={'raw':!![],'where':{'id':_0x2ef4a5['params']['id']}},_0x26407b={};_0x26407b['model']=_[_0xb881('0x45')](db[_0xb881('0x29')][_0xb881('0x2a')]);_0x26407b['query']=_[_0xb881('0x45')](_0x2ef4a5[_0xb881('0x2f')]);_0x26407b[_0xb881('0x30')]=_[_0xb881('0x31')](_0x26407b['model'],_0x26407b['query']);_0x565cea[_0xb881('0x33')]=_[_0xb881('0x31')](_0x26407b[_0xb881('0x2e')],qs['fields'](_0x2ef4a5['query'][_0xb881('0x32')]));_0x565cea['attributes']=_0x565cea[_0xb881('0x33')][_0xb881('0x46')]?_0x565cea['attributes']:_0x26407b[_0xb881('0x2e')];if(_0x2ef4a5[_0xb881('0x2f')][_0xb881('0x3c')]){_0x565cea[_0xb881('0x3d')]=[{'all':!![]}];}_0x565cea=_[_0xb881('0x3a')]({},_0x565cea,_0x2ef4a5[_0xb881('0x47')]);return db[_0xb881('0x29')][_0xb881('0x48')](_0x565cea)[_0xb881('0x41')](handleEntityNotFound(_0x1d07ca,null))[_0xb881('0x41')](respondWithResult(_0x1d07ca,null))[_0xb881('0x43')](handleError(_0x1d07ca,null));};exports[_0xb881('0x49')]=function(_0x22f86d,_0x4089cf){return db[_0xb881('0x29')][_0xb881('0x49')](_0x22f86d[_0xb881('0x4a')],{})[_0xb881('0x41')](respondWithResult(_0x4089cf,0xc9))['catch'](handleError(_0x4089cf,null));};exports['destroy']=function(_0x5f42fa,_0x24e504){return db[_0xb881('0x29')][_0xb881('0x48')]({'where':{'id':_0x5f42fa[_0xb881('0x4b')]['id']}})[_0xb881('0x41')](handleEntityNotFound(_0x24e504,null))['then'](removeEntity(_0x24e504,null))[_0xb881('0x43')](handleError(_0x24e504,null));};exports[_0xb881('0x4c')]=function(_0x59735c,_0x363203){return db[_0xb881('0x29')]['describe']()[_0xb881('0x41')](respondWithResult(_0x363203,null))['catch'](handleError(_0x363203,null));};exports['update']=function(_0x3fe8e5,_0x4b4923){if(_0x3fe8e5[_0xb881('0x4a')]['uniqueid']){delete _0x3fe8e5['body'][_0xb881('0x4d')];}return db[_0xb881('0x29')][_0xb881('0x48')]({'where':{'uniqueid':_0x3fe8e5[_0xb881('0x4b')]['id'],'UserId':{'$or':[null,_0x3fe8e5['user']['id']]}}})[_0xb881('0x41')](handleEntityNotFound(_0x4b4923,null))['then'](saveUpdates(_0x3fe8e5[_0xb881('0x4a')],null))[_0xb881('0x41')](respondWithResult(_0x4b4923,null))[_0xb881('0x43')](handleError(_0x4b4923,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index a1e0776..82ecaa0 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 _0xba89=['lodash','util','api','moment','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x58fea6,_0x185072){var _0x3c2b15=function(_0x1bcdd6){while(--_0x1bcdd6){_0x58fea6['push'](_0x58fea6['shift']());}};_0x3c2b15(++_0x185072);}(_0xba89,0x193));var _0x9ba8=function(_0x2718de,_0x3f3f35){_0x2718de=_0x2718de-0x0;var _0x5a27b3=_0xba89[_0x2718de];return _0x5a27b3;};'use strict';var _=require(_0x9ba8('0x0'));var util=require(_0x9ba8('0x1'));var logger=require('../../config/logger')(_0x9ba8('0x2'));var moment=require(_0x9ba8('0x3'));var BPromise=require('bluebird');var rp=require(_0x9ba8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ba8('0x5'));var config=require(_0x9ba8('0x6'));var attributes=require(_0x9ba8('0x7'));module[_0x9ba8('0x8')]=function(_0x97113f,_0x35950b){return _0x97113f[_0x9ba8('0x9')](_0x9ba8('0xa'),attributes,{'tableName':_0x9ba8('0xb'),'paranoid':![],'indexes':[{'fields':[_0x9ba8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x09eb=['request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','../../config/logger','moment','bluebird'];(function(_0x535d2d,_0xbe8a8f){var _0x41db76=function(_0x442a8b){while(--_0x442a8b){_0x535d2d['push'](_0x535d2d['shift']());}};_0x41db76(++_0xbe8a8f);}(_0x09eb,0x1ad));var _0xb09e=function(_0x3b247d,_0xbe4218){_0x3b247d=_0x3b247d-0x0;var _0x131bcf=_0x09eb[_0x3b247d];return _0x131bcf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb09e('0x0'))('api');var moment=require(_0xb09e('0x1'));var BPromise=require(_0xb09e('0x2'));var rp=require(_0xb09e('0x3'));var fs=require('fs');var path=require(_0xb09e('0x4'));var rimraf=require(_0xb09e('0x5'));var config=require(_0xb09e('0x6'));var attributes=require(_0xb09e('0x7'));module[_0xb09e('0x8')]=function(_0x150778,_0x2dfc20){return _0x150778[_0xb09e('0x9')]('VoiceCallReport',attributes,{'tableName':_0xb09e('0xa'),'paranoid':![],'indexes':[{'fields':[_0xb09e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 6ac09cf..f33f889 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 _0x680f=['VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','debug'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x680f,0x10b));var _0xf680=function(_0x4c278a,_0x48bbda){_0x4c278a=_0x4c278a-0x0;var _0x21d848=_0x680f[_0x4c278a];return _0x21d848;};'use strict';var _=require(_0xf680('0x0'));var util=require(_0xf680('0x1'));var moment=require(_0xf680('0x2'));var BPromise=require('bluebird');var rs=require(_0xf680('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf680('0x4'))['db'];var utils=require(_0xf680('0x5'));var logger=require(_0xf680('0x6'))(_0xf680('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf680('0x8')][_0xf680('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21923e,_0x58ce63,_0x5371e7){return new BPromise(function(_0x1b42c5,_0x418896){return client['request'](_0x21923e,_0x5371e7)[_0xf680('0xa')](function(_0x5f0050){logger[_0xf680('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x58ce63,'request\x20sent');logger[_0xf680('0xc')](_0xf680('0xd'),_0x58ce63,_0xf680('0xe'),JSON[_0xf680('0xf')](_0x5f0050));if(_0x5f0050['error']){if(_0x5f0050[_0xf680('0x10')]['code']===0x1f4){logger[_0xf680('0x10')](_0xf680('0x11'),_0x58ce63,_0x5f0050[_0xf680('0x10')][_0xf680('0x12')]);return _0x418896(_0x5f0050[_0xf680('0x10')][_0xf680('0x12')]);}logger[_0xf680('0x10')](_0xf680('0x11'),_0x58ce63,_0x5f0050[_0xf680('0x10')]['message']);return _0x1b42c5(_0x5f0050['error'][_0xf680('0x12')]);}else{logger[_0xf680('0xb')](_0xf680('0x11'),_0x58ce63,_0xf680('0xe'));_0x1b42c5(_0x5f0050['result'][_0xf680('0x12')]);}})[_0xf680('0x13')](function(_0x437e83){logger[_0xf680('0x10')](_0xf680('0x11'),_0x58ce63,_0x437e83);_0x418896(_0x437e83);});});}exports[_0xf680('0x14')]=function(_0xde177e){var _0x448128=this;return new Promise(function(_0xb03579,_0x4b3497){return db[_0xf680('0x15')]['findAll']({'raw':_0xde177e[_0xf680('0x16')]?_0xde177e[_0xf680('0x16')][_0xf680('0x17')]===undefined?!![]:![]:!![],'where':_0xde177e[_0xf680('0x16')]?_0xde177e[_0xf680('0x16')][_0xf680('0x18')]||null:null,'attributes':_0xde177e['options']?_0xde177e['options'][_0xf680('0x19')]||null:null,'limit':_0xde177e[_0xf680('0x16')]?_0xde177e[_0xf680('0x16')][_0xf680('0x1a')]||null:null,'include':_0xde177e[_0xf680('0x16')]?_0xde177e[_0xf680('0x16')][_0xf680('0x1b')]?_[_0xf680('0x1c')](_0xde177e[_0xf680('0x16')][_0xf680('0x1b')],function(_0x1b7120){return{'model':db[_0x1b7120[_0xf680('0x1d')]],'as':_0x1b7120['as'],'attributes':_0x1b7120[_0xf680('0x19')],'include':_0x1b7120[_0xf680('0x1b')]?_[_0xf680('0x1c')](_0x1b7120[_0xf680('0x1b')],function(_0x43184e){return{'model':db[_0x43184e['model']],'as':_0x43184e['as'],'attributes':_0x43184e[_0xf680('0x19')],'include':_0x43184e[_0xf680('0x1b')]?_[_0xf680('0x1c')](_0x43184e[_0xf680('0x1b')],function(_0x320c74){return{'model':db[_0x320c74['model']],'as':_0x320c74['as'],'attributes':_0x320c74[_0xf680('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf680('0xa')](function(_0x1280ec){logger['info']('GetVoiceCallReport',_0xde177e);logger[_0xf680('0xc')](_0xf680('0x14'),_0xde177e,JSON[_0xf680('0xf')](_0x1280ec));_0xb03579(_0x1280ec);})[_0xf680('0x13')](function(_0x12bbe2){logger[_0xf680('0x10')](_0xf680('0x14'),_0x12bbe2['message'],_0xde177e);_0x4b3497(_0x448128[_0xf680('0x10')](0x1f4,_0x12bbe2['message']));});});};exports['CreateVoiceCallReport']=function(_0x40cf2d){var _0x706456=this;return new Promise(function(_0x236717,_0x437556){return db['VoiceCallReport'][_0xf680('0x1e')](_0x40cf2d[_0xf680('0x1f')],{'raw':_0x40cf2d[_0xf680('0x16')]?_0x40cf2d['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x486ad2){logger['info'](_0xf680('0x20'),_0x40cf2d);logger[_0xf680('0xc')]('CreateVoiceCallReport',_0x40cf2d,JSON[_0xf680('0xf')](_0x486ad2));_0x236717(_0x486ad2);})[_0xf680('0x13')](function(_0x559f1a){logger[_0xf680('0x10')](_0xf680('0x20'),_0x559f1a['message'],_0x40cf2d);_0x437556(_0x706456[_0xf680('0x10')](0x1f4,_0x559f1a['message']));});});};exports[_0xf680('0x21')]=function(_0x2fcf86){var _0x121a75=this;return new Promise(function(_0x5ae5c7,_0x1f3f7c){return db[_0xf680('0x15')][_0xf680('0x22')](_0x2fcf86[_0xf680('0x1f')],{'raw':_0x2fcf86[_0xf680('0x16')]?_0x2fcf86['options'][_0xf680('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fcf86[_0xf680('0x16')]?_0x2fcf86[_0xf680('0x16')]['where']||null:null,'attributes':_0x2fcf86[_0xf680('0x16')]?_0x2fcf86[_0xf680('0x16')][_0xf680('0x19')]||null:null,'limit':_0x2fcf86[_0xf680('0x16')]?_0x2fcf86[_0xf680('0x16')][_0xf680('0x1a')]||null:null})[_0xf680('0xa')](function(_0x271619){logger[_0xf680('0xb')]('UpdateVoiceCallReport',_0x2fcf86);logger['debug']('UpdateVoiceCallReport',_0x2fcf86,JSON[_0xf680('0xf')](_0x271619));_0x5ae5c7(_0x271619);})['catch'](function(_0x5afdbc){logger[_0xf680('0x10')](_0xf680('0x21'),_0x5afdbc[_0xf680('0x12')],_0x2fcf86);_0x1f3f7c(_0x121a75[_0xf680('0x10')](0x1f4,_0x5afdbc[_0xf680('0x12')]));});});}; \ No newline at end of file +var _0x1d4f=['rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x700100,_0x4fa0b5){var _0x4437e1=function(_0x1a47a8){while(--_0x1a47a8){_0x700100['push'](_0x700100['shift']());}};_0x4437e1(++_0x4fa0b5);}(_0x1d4f,0xee));var _0xf1d4=function(_0x170d43,_0x1ee216){_0x170d43=_0x170d43-0x0;var _0x53612a=_0x1d4f[_0x170d43];return _0x53612a;};'use strict';var _=require(_0xf1d4('0x0'));var util=require(_0xf1d4('0x1'));var moment=require(_0xf1d4('0x2'));var BPromise=require(_0xf1d4('0x3'));var rs=require(_0xf1d4('0x4'));var fs=require('fs');var Redis=require(_0xf1d4('0x5'));var db=require(_0xf1d4('0x6'))['db'];var utils=require(_0xf1d4('0x7'));var logger=require('../../config/logger')(_0xf1d4('0x8'));var config=require(_0xf1d4('0x9'));var jayson=require(_0xf1d4('0xa'));var client=jayson[_0xf1d4('0xb')][_0xf1d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cde2f,_0x309ab1,_0x3ad0bf){return new BPromise(function(_0x3a94e1,_0x252efd){return client[_0xf1d4('0xd')](_0x3cde2f,_0x3ad0bf)[_0xf1d4('0xe')](function(_0x43d413){logger['info'](_0xf1d4('0xf'),_0x309ab1,_0xf1d4('0x10'));logger[_0xf1d4('0x11')](_0xf1d4('0x12'),_0x309ab1,_0xf1d4('0x10'),JSON[_0xf1d4('0x13')](_0x43d413));if(_0x43d413['error']){if(_0x43d413[_0xf1d4('0x14')][_0xf1d4('0x15')]===0x1f4){logger[_0xf1d4('0x14')](_0xf1d4('0xf'),_0x309ab1,_0x43d413[_0xf1d4('0x14')][_0xf1d4('0x16')]);return _0x252efd(_0x43d413['error'][_0xf1d4('0x16')]);}logger[_0xf1d4('0x14')](_0xf1d4('0xf'),_0x309ab1,_0x43d413[_0xf1d4('0x14')][_0xf1d4('0x16')]);return _0x3a94e1(_0x43d413[_0xf1d4('0x14')]['message']);}else{logger[_0xf1d4('0x17')](_0xf1d4('0xf'),_0x309ab1,_0xf1d4('0x10'));_0x3a94e1(_0x43d413['result']['message']);}})[_0xf1d4('0x18')](function(_0x40aa0a){logger[_0xf1d4('0x14')](_0xf1d4('0xf'),_0x309ab1,_0x40aa0a);_0x252efd(_0x40aa0a);});});}exports[_0xf1d4('0x19')]=function(_0x24d3c9){var _0x3f0752=this;return new Promise(function(_0x26e330,_0x370759){return db[_0xf1d4('0x1a')][_0xf1d4('0x1b')]({'raw':_0x24d3c9[_0xf1d4('0x1c')]?_0x24d3c9[_0xf1d4('0x1c')][_0xf1d4('0x1d')]===undefined?!![]:![]:!![],'where':_0x24d3c9[_0xf1d4('0x1c')]?_0x24d3c9[_0xf1d4('0x1c')][_0xf1d4('0x1e')]||null:null,'attributes':_0x24d3c9[_0xf1d4('0x1c')]?_0x24d3c9[_0xf1d4('0x1c')][_0xf1d4('0x1f')]||null:null,'limit':_0x24d3c9['options']?_0x24d3c9[_0xf1d4('0x1c')][_0xf1d4('0x20')]||null:null,'include':_0x24d3c9[_0xf1d4('0x1c')]?_0x24d3c9['options']['include']?_['map'](_0x24d3c9[_0xf1d4('0x1c')][_0xf1d4('0x21')],function(_0x486f29){return{'model':db[_0x486f29['model']],'as':_0x486f29['as'],'attributes':_0x486f29[_0xf1d4('0x1f')],'include':_0x486f29[_0xf1d4('0x21')]?_['map'](_0x486f29[_0xf1d4('0x21')],function(_0x3f81b6){return{'model':db[_0x3f81b6[_0xf1d4('0x22')]],'as':_0x3f81b6['as'],'attributes':_0x3f81b6[_0xf1d4('0x1f')],'include':_0x3f81b6['include']?_[_0xf1d4('0x23')](_0x3f81b6['include'],function(_0x4ec492){return{'model':db[_0x4ec492[_0xf1d4('0x22')]],'as':_0x4ec492['as'],'attributes':_0x4ec492['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59fe7c){logger[_0xf1d4('0x17')](_0xf1d4('0x19'),_0x24d3c9);logger[_0xf1d4('0x11')]('GetVoiceCallReport',_0x24d3c9,JSON[_0xf1d4('0x13')](_0x59fe7c));_0x26e330(_0x59fe7c);})[_0xf1d4('0x18')](function(_0x4d452d){logger['error'](_0xf1d4('0x19'),_0x4d452d[_0xf1d4('0x16')],_0x24d3c9);_0x370759(_0x3f0752[_0xf1d4('0x14')](0x1f4,_0x4d452d['message']));});});};exports[_0xf1d4('0x24')]=function(_0x27df47){var _0x553c83=this;return new Promise(function(_0x2c0aef,_0x5189eb){return db[_0xf1d4('0x1a')][_0xf1d4('0x25')](_0x27df47[_0xf1d4('0x26')],{'raw':_0x27df47['options']?_0x27df47[_0xf1d4('0x1c')][_0xf1d4('0x1d')]===undefined?!![]:![]:!![]})[_0xf1d4('0xe')](function(_0x5a23c3){logger[_0xf1d4('0x17')](_0xf1d4('0x24'),_0x27df47);logger[_0xf1d4('0x11')]('CreateVoiceCallReport',_0x27df47,JSON[_0xf1d4('0x13')](_0x5a23c3));_0x2c0aef(_0x5a23c3);})[_0xf1d4('0x18')](function(_0x795735){logger[_0xf1d4('0x14')](_0xf1d4('0x24'),_0x795735[_0xf1d4('0x16')],_0x27df47);_0x5189eb(_0x553c83[_0xf1d4('0x14')](0x1f4,_0x795735[_0xf1d4('0x16')]));});});};exports[_0xf1d4('0x27')]=function(_0x1944e4){var _0x4649a7=this;return new Promise(function(_0x289b4e,_0x247a84){return db[_0xf1d4('0x1a')][_0xf1d4('0x28')](_0x1944e4[_0xf1d4('0x26')],{'raw':_0x1944e4[_0xf1d4('0x1c')]?_0x1944e4['options'][_0xf1d4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1944e4[_0xf1d4('0x1c')]?_0x1944e4[_0xf1d4('0x1c')][_0xf1d4('0x1e')]||null:null,'attributes':_0x1944e4['options']?_0x1944e4['options'][_0xf1d4('0x1f')]||null:null,'limit':_0x1944e4[_0xf1d4('0x1c')]?_0x1944e4[_0xf1d4('0x1c')]['limit']||null:null})['then'](function(_0x3b20e7){logger[_0xf1d4('0x17')](_0xf1d4('0x27'),_0x1944e4);logger[_0xf1d4('0x11')](_0xf1d4('0x27'),_0x1944e4,JSON[_0xf1d4('0x13')](_0x3b20e7));_0x289b4e(_0x3b20e7);})[_0xf1d4('0x18')](function(_0x5b5c94){logger[_0xf1d4('0x14')]('UpdateVoiceCallReport',_0x5b5c94[_0xf1d4('0x16')],_0x1944e4);_0x247a84(_0x4649a7['error'](0x1f4,_0x5b5c94[_0xf1d4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 6d5a122..053204d 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 _0x120f=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','put','update','delete','destroy'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0x120f,0x161));var _0xf120=function(_0x4462d1,_0x2d89b1){_0x4462d1=_0x4462d1-0x0;var _0x3a100e=_0x120f[_0x4462d1];return _0x3a100e;};'use strict';var multer=require(_0xf120('0x0'));var util=require('util');var path=require(_0xf120('0x1'));var timeout=require(_0xf120('0x2'));var express=require(_0xf120('0x3'));var router=express['Router']();var fs_extra=require(_0xf120('0x4'));var auth=require(_0xf120('0x5'));var interaction=require(_0xf120('0x6'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0xf120('0x7')](),controller[_0xf120('0x8')]);router['get'](_0xf120('0x9'),auth['isAuthenticated'](),controller[_0xf120('0xa')]);router['post']('/',auth[_0xf120('0x7')](),controller['create']);router[_0xf120('0xb')](_0xf120('0x9'),auth[_0xf120('0x7')](),controller[_0xf120('0xc')]);router[_0xf120('0xd')]('/:id',auth[_0xf120('0x7')](),controller[_0xf120('0xe')]);module[_0xf120('0xf')]=router; \ No newline at end of file +var _0xce58=['create','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','show','post'];(function(_0x1aa5eb,_0x4efec4){var _0x45f0fa=function(_0x35e7d4){while(--_0x35e7d4){_0x1aa5eb['push'](_0x1aa5eb['shift']());}};_0x45f0fa(++_0x4efec4);}(_0xce58,0x1b4));var _0x8ce5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce58[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8ce5('0x0'));var util=require(_0x8ce5('0x1'));var path=require(_0x8ce5('0x2'));var timeout=require(_0x8ce5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8ce5('0x4'));var interaction=require(_0x8ce5('0x5'));var config=require(_0x8ce5('0x6'));var controller=require(_0x8ce5('0x7'));router[_0x8ce5('0x8')]('/',auth[_0x8ce5('0x9')](),controller['index']);router['get']('/:id',auth[_0x8ce5('0x9')](),controller[_0x8ce5('0xa')]);router[_0x8ce5('0xb')]('/',auth[_0x8ce5('0x9')](),controller[_0x8ce5('0xc')]);router['put']('/:id',auth[_0x8ce5('0x9')](),controller[_0x8ce5('0xd')]);router['delete']('/:id',auth[_0x8ce5('0x9')](),controller[_0x8ce5('0xe')]);module[_0x8ce5('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index dbed100..636948f 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 _0x533a=['sequelize','exports','STRING','name','setDataValue','options','getDataValue','BOOLEAN'];(function(_0xd3bdab,_0x5d784a){var _0x1c3178=function(_0x4f7ef4){while(--_0x4f7ef4){_0xd3bdab['push'](_0xd3bdab['shift']());}};_0x1c3178(++_0x5d784a);}(_0x533a,0xd0));var _0xa533=function(_0x3124f8,_0x1a8b23){_0x3124f8=_0x3124f8-0x0;var _0x5bab5f=_0x533a[_0x3124f8];return _0x5bab5f;};'use strict';var Sequelize=require(_0xa533('0x0'));module[_0xa533('0x1')]={'name':{'type':Sequelize[_0xa533('0x2')]},'prefix':{'type':Sequelize[_0xa533('0x2')],'unique':_0xa533('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x37aa19){this[_0xa533('0x4')](_0xa533('0x5'),_0x37aa19?_0x37aa19['join'](''):[]);},'get':function(){return this[_0xa533('0x6')](_0xa533('0x5'))?this[_0xa533('0x6')](_0xa533('0x5'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xa533('0x2')]},'record':{'type':Sequelize[_0xa533('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xa533('0x2')]},'description':{'type':Sequelize[_0xa533('0x2')]}}; \ No newline at end of file +var _0xfe07=['BOOLEAN','sequelize','STRING','name','setDataValue','join','options','getDataValue'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0xfe07,0x161));var _0x7fe0=function(_0xd76b53,_0x22f37e){_0xd76b53=_0xd76b53-0x0;var _0x56c3ab=_0xfe07[_0xd76b53];return _0x56c3ab;};'use strict';var Sequelize=require(_0x7fe0('0x0'));module['exports']={'name':{'type':Sequelize[_0x7fe0('0x1')]},'prefix':{'type':Sequelize[_0x7fe0('0x1')],'unique':_0x7fe0('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x7fe0('0x1')],'set':function(_0x1ef579){this[_0x7fe0('0x3')]('options',_0x1ef579?_0x1ef579[_0x7fe0('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x7fe0('0x5'))?this[_0x7fe0('0x6')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x7fe0('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x7fe0('0x1')]},'record':{'type':Sequelize[_0x7fe0('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7fe0('0x1')]},'description':{'type':Sequelize[_0x7fe0('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 1585a3b..ea9fd56 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 _0xd13e=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','update','then','get','ChanSpies','UserProfileResource','destroy','error','stack','name','index','map','VoiceChanSpy','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd13e,0x193));var _0xed13=function(_0x7cc78a,_0x202096){_0x7cc78a=_0x7cc78a-0x0;var _0x470d11=_0xd13e[_0x7cc78a];return _0x470d11;};'use strict';var pdf=require(_0xed13('0x0'));var emlformat=require(_0xed13('0x1'));var rimraf=require(_0xed13('0x2'));var zipdir=require(_0xed13('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed13('0x4'));var moment=require('moment');var BPromise=require(_0xed13('0x5'));var Mustache=require('mustache');var util=require(_0xed13('0x6'));var path=require(_0xed13('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed13('0x8'));var _=require(_0xed13('0x9'));var squel=require(_0xed13('0xa'));var crypto=require(_0xed13('0xb'));var jsforce=require(_0xed13('0xc'));var deskjs=require(_0xed13('0xd'));var toCsv=require(_0xed13('0xe'));var querystring=require(_0xed13('0xf'));var Papa=require(_0xed13('0x10'));var Redis=require('ioredis');var authService=require(_0xed13('0x11'));var qs=require(_0xed13('0x12'));var as=require(_0xed13('0x13'));var hardwareService=require(_0xed13('0x14'));var logger=require(_0xed13('0x15'))('api');var utils=require(_0xed13('0x16'));var config=require(_0xed13('0x17'));var licenseUtil=require(_0xed13('0x18'));var db=require(_0xed13('0x19'))['db'];function respondWithStatusCode(_0x936103,_0x3295ba){_0x3295ba=_0x3295ba||0xcc;return function(_0x5b950a){if(_0x5b950a){return _0x936103[_0xed13('0x1a')](_0x3295ba);}return _0x936103['status'](_0x3295ba)[_0xed13('0x1b')]();};}function respondWithResult(_0x56fdc6,_0x6e2978){_0x6e2978=_0x6e2978||0xc8;return function(_0x56108d){if(_0x56108d){return _0x56fdc6[_0xed13('0x1c')](_0x6e2978)['json'](_0x56108d);}};}function respondWithFilteredResult(_0x38901a,_0xf900d2){return function(_0x1d3d67){if(_0x1d3d67){var _0xa260ed=_0x1d3d67[_0xed13('0x1d')],_0x1d0ebf=_0xf900d2[_0xed13('0x1e')],_0x1f8585=_0xf900d2[_0xed13('0x1e')]+_0xf900d2[_0xed13('0x1f')],_0x3fef8d;if(_0x1f8585>=_0xa260ed){_0x1f8585=_0xa260ed;_0x3fef8d=0xc8;}else{_0x3fef8d=0xce;}_0x38901a[_0xed13('0x1c')](_0x3fef8d);return _0x38901a[_0xed13('0x20')](_0xed13('0x21'),_0x1d0ebf+'-'+_0x1f8585+'/'+_0xa260ed)[_0xed13('0x22')](_0x1d3d67);}return null;};}function patchUpdates(_0x2f38c9){return function(_0x580870){try{jsonpatch['apply'](_0x580870,_0x2f38c9,!![]);}catch(_0x1f3646){return BPromise[_0xed13('0x23')](_0x1f3646);}return _0x580870['save']();};}function saveUpdates(_0x40dd86,_0x4a85a3){return function(_0x4e9e3b){if(_0x4e9e3b){return _0x4e9e3b[_0xed13('0x24')](_0x40dd86)[_0xed13('0x25')](function(_0x2d62cd){return _0x2d62cd;});}return null;};}function removeEntity(_0x192d12,_0x1d7621){return function(_0x2fc1e4){if(_0x2fc1e4){return _0x2fc1e4['destroy']()['then'](function(){var _0x5d7ae1=_0x2fc1e4[_0xed13('0x26')]({'plain':!![]});var _0x3b1f23=_0xed13('0x27');return db[_0xed13('0x28')][_0xed13('0x29')]({'where':{'type':_0x3b1f23,'resourceId':_0x5d7ae1['id']}})[_0xed13('0x25')](function(){return _0x2fc1e4;});})[_0xed13('0x25')](function(){_0x192d12[_0xed13('0x1c')](0xcc)[_0xed13('0x1b')]();});}};}function handleEntityNotFound(_0x2f05f0,_0x1f064c){return function(_0x3bc666){if(!_0x3bc666){_0x2f05f0[_0xed13('0x1a')](0x194);}return _0x3bc666;};}function handleError(_0x322fc3,_0x4e03d1){_0x4e03d1=_0x4e03d1||0x1f4;return function(_0x5e399c){logger[_0xed13('0x2a')](_0x5e399c[_0xed13('0x2b')]);if(_0x5e399c['name']){delete _0x5e399c[_0xed13('0x2c')];}_0x322fc3[_0xed13('0x1c')](_0x4e03d1)['send'](_0x5e399c);};}exports[_0xed13('0x2d')]=function(_0x2066ca,_0x323156){var _0x570929={},_0x3a5387={},_0x3b2bf4={'count':0x0,'rows':[]};var _0x489840=_[_0xed13('0x2e')](db[_0xed13('0x2f')]['rawAttributes'],function(_0x11cb93){return{'name':_0x11cb93[_0xed13('0x30')],'type':_0x11cb93[_0xed13('0x31')][_0xed13('0x32')]};});_0x3a5387[_0xed13('0x33')]=_[_0xed13('0x2e')](_0x489840,_0xed13('0x2c'));_0x3a5387['query']=_[_0xed13('0x34')](_0x2066ca['query']);_0x3a5387['filters']=_[_0xed13('0x35')](_0x3a5387[_0xed13('0x33')],_0x3a5387[_0xed13('0x36')]);_0x570929['attributes']=_[_0xed13('0x35')](_0x3a5387[_0xed13('0x33')],qs[_0xed13('0x37')](_0x2066ca['query'][_0xed13('0x37')]));_0x570929[_0xed13('0x38')]=_0x570929[_0xed13('0x38')][_0xed13('0x39')]?_0x570929['attributes']:_0x3a5387[_0xed13('0x33')];if(!_0x2066ca[_0xed13('0x36')][_0xed13('0x3a')](_0xed13('0x3b'))){_0x570929[_0xed13('0x1f')]=qs[_0xed13('0x1f')](_0x2066ca[_0xed13('0x36')][_0xed13('0x1f')]);_0x570929[_0xed13('0x1e')]=qs[_0xed13('0x1e')](_0x2066ca['query'][_0xed13('0x1e')]);}_0x570929[_0xed13('0x3c')]=qs['sort'](_0x2066ca['query']['sort']);_0x570929[_0xed13('0x3d')]=qs[_0xed13('0x3e')](_['pick'](_0x2066ca['query'],_0x3a5387[_0xed13('0x3e')]),_0x489840);if(_0x2066ca[_0xed13('0x36')][_0xed13('0x3f')]){_0x570929[_0xed13('0x3d')]=_[_0xed13('0x40')](_0x570929['where'],{'$or':_['map'](_0x489840,function(_0x1e943a){if(_0x1e943a['type']!==_0xed13('0x41')){var _0x4da4ef={};_0x4da4ef[_0x1e943a[_0xed13('0x2c')]]={'$like':'%'+_0x2066ca['query']['filter']+'%'};return _0x4da4ef;}})});}_0x570929=_['merge']({},_0x570929,_0x2066ca[_0xed13('0x42')]);var _0x136fe0={'where':_0x570929[_0xed13('0x3d')]};return db[_0xed13('0x2f')][_0xed13('0x1d')](_0x136fe0)['then'](function(_0xb52363){_0x3b2bf4[_0xed13('0x1d')]=_0xb52363;if(_0x2066ca[_0xed13('0x36')][_0xed13('0x43')]){_0x570929[_0xed13('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xed13('0x45')](_0x570929);})[_0xed13('0x25')](function(_0x24f4ba){_0x3b2bf4[_0xed13('0x46')]=_0x24f4ba;return _0x3b2bf4;})[_0xed13('0x25')](respondWithFilteredResult(_0x323156,_0x570929))[_0xed13('0x47')](handleError(_0x323156,null));};exports['show']=function(_0x2f04ef,_0x3262ac){var _0x4686f1={'raw':![],'where':{'id':_0x2f04ef[_0xed13('0x48')]['id']}},_0x3948ef={};_0x3948ef[_0xed13('0x33')]=_[_0xed13('0x34')](db[_0xed13('0x2f')][_0xed13('0x49')]);_0x3948ef[_0xed13('0x36')]=_[_0xed13('0x34')](_0x2f04ef[_0xed13('0x36')]);_0x3948ef[_0xed13('0x3e')]=_[_0xed13('0x35')](_0x3948ef['model'],_0x3948ef[_0xed13('0x36')]);_0x4686f1[_0xed13('0x38')]=_['intersection'](_0x3948ef[_0xed13('0x33')],qs[_0xed13('0x37')](_0x2f04ef[_0xed13('0x36')]['fields']));_0x4686f1[_0xed13('0x38')]=_0x4686f1[_0xed13('0x38')][_0xed13('0x39')]?_0x4686f1['attributes']:_0x3948ef['model'];if(_0x2f04ef[_0xed13('0x36')][_0xed13('0x43')]){_0x4686f1['include']=[{'all':!![]}];}_0x4686f1=_[_0xed13('0x40')]({},_0x4686f1,_0x2f04ef[_0xed13('0x42')]);return db[_0xed13('0x2f')][_0xed13('0x4a')](_0x4686f1)['then'](handleEntityNotFound(_0x3262ac,null))[_0xed13('0x25')](respondWithResult(_0x3262ac,null))[_0xed13('0x47')](handleError(_0x3262ac,null));};exports[_0xed13('0x4b')]=function(_0x7c4e19,_0x5e1417){return db[_0xed13('0x2f')]['create'](_0x7c4e19[_0xed13('0x4c')],{})['then'](function(_0x5a0828){var _0x45f643=_0x7c4e19[_0xed13('0x4d')]['get']({'plain':!![]});if(!_0x45f643)throw new Error(_0xed13('0x4e'));if(_0x45f643[_0xed13('0x4f')]===_0xed13('0x4d')){var _0x1f2116=_0x5a0828['get']({'plain':!![]});var _0x1d866d='ChanSpies';return db[_0xed13('0x50')][_0xed13('0x4a')]({'where':{'name':_0x1d866d,'userProfileId':_0x45f643[_0xed13('0x51')]},'raw':!![]})[_0xed13('0x25')](function(_0x29dab5){if(_0x29dab5&&_0x29dab5[_0xed13('0x52')]===0x0){return db[_0xed13('0x28')][_0xed13('0x4b')]({'name':_0x1f2116['name'],'resourceId':_0x1f2116['id'],'type':_0x29dab5[_0xed13('0x2c')],'sectionId':_0x29dab5['id']},{})[_0xed13('0x25')](function(){return _0x5a0828;});}else{return _0x5a0828;}})[_0xed13('0x47')](function(_0x30043f){logger['error'](_0xed13('0x53'),_0x30043f);throw _0x30043f;});}return _0x5a0828;})['then'](respondWithResult(_0x5e1417,0xc9))[_0xed13('0x47')](handleError(_0x5e1417,null));};exports['update']=function(_0x4bb9cc,_0x52ace8){if(_0x4bb9cc[_0xed13('0x4c')]['id']){delete _0x4bb9cc[_0xed13('0x4c')]['id'];}return db[_0xed13('0x2f')]['find']({'where':{'id':_0x4bb9cc[_0xed13('0x48')]['id']}})[_0xed13('0x25')](handleEntityNotFound(_0x52ace8,null))[_0xed13('0x25')](saveUpdates(_0x4bb9cc[_0xed13('0x4c')],null))[_0xed13('0x25')](respondWithResult(_0x52ace8,null))['catch'](handleError(_0x52ace8,null));};exports[_0xed13('0x29')]=function(_0x160e0b,_0x254052){return db[_0xed13('0x2f')]['find']({'where':{'id':_0x160e0b[_0xed13('0x48')]['id']}})[_0xed13('0x25')](handleEntityNotFound(_0x254052,null))[_0xed13('0x25')](removeEntity(_0x254052,null))[_0xed13('0x47')](handleError(_0x254052,null));}; \ No newline at end of file +var _0x1353=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','type','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','merge','options','find','body'];(function(_0x181188,_0x4f8e58){var _0x2484ee=function(_0x493cbc){while(--_0x493cbc){_0x181188['push'](_0x181188['shift']());}};_0x2484ee(++_0x4f8e58);}(_0x1353,0xb3));var _0x3135=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x1353[_0x263a74];return _0x2aa86c;};'use strict';var pdf=require(_0x3135('0x0'));var emlformat=require(_0x3135('0x1'));var rimraf=require(_0x3135('0x2'));var zipdir=require(_0x3135('0x3'));var jsonpatch=require(_0x3135('0x4'));var rp=require(_0x3135('0x5'));var moment=require('moment');var BPromise=require(_0x3135('0x6'));var Mustache=require(_0x3135('0x7'));var util=require(_0x3135('0x8'));var path=require(_0x3135('0x9'));var sox=require(_0x3135('0xa'));var csv=require('to-csv');var ejs=require(_0x3135('0xb'));var fs=require('fs');var fs_extra=require(_0x3135('0xc'));var _=require('lodash');var squel=require(_0x3135('0xd'));var crypto=require(_0x3135('0xe'));var jsforce=require(_0x3135('0xf'));var deskjs=require(_0x3135('0x10'));var toCsv=require(_0x3135('0x11'));var querystring=require('querystring');var Papa=require(_0x3135('0x12'));var Redis=require(_0x3135('0x13'));var authService=require(_0x3135('0x14'));var qs=require(_0x3135('0x15'));var as=require(_0x3135('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3135('0x17'))('api');var utils=require(_0x3135('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3135('0x19'));var db=require(_0x3135('0x1a'))['db'];function respondWithStatusCode(_0x4c4ffd,_0x33f93a){_0x33f93a=_0x33f93a||0xcc;return function(_0x4d09eb){if(_0x4d09eb){return _0x4c4ffd[_0x3135('0x1b')](_0x33f93a);}return _0x4c4ffd[_0x3135('0x1c')](_0x33f93a)[_0x3135('0x1d')]();};}function respondWithResult(_0x4ee5f1,_0x44f77f){_0x44f77f=_0x44f77f||0xc8;return function(_0x56b026){if(_0x56b026){return _0x4ee5f1['status'](_0x44f77f)[_0x3135('0x1e')](_0x56b026);}};}function respondWithFilteredResult(_0x332539,_0x51ee05){return function(_0x5ba6c7){if(_0x5ba6c7){var _0x58057b=_0x5ba6c7[_0x3135('0x1f')],_0x1bc775=_0x51ee05['offset'],_0x26da2f=_0x51ee05[_0x3135('0x20')]+_0x51ee05[_0x3135('0x21')],_0x4209b7;if(_0x26da2f>=_0x58057b){_0x26da2f=_0x58057b;_0x4209b7=0xc8;}else{_0x4209b7=0xce;}_0x332539[_0x3135('0x1c')](_0x4209b7);return _0x332539[_0x3135('0x22')](_0x3135('0x23'),_0x1bc775+'-'+_0x26da2f+'/'+_0x58057b)[_0x3135('0x1e')](_0x5ba6c7);}return null;};}function patchUpdates(_0x1f8f45){return function(_0x24092e){try{jsonpatch['apply'](_0x24092e,_0x1f8f45,!![]);}catch(_0x4d41df){return BPromise[_0x3135('0x24')](_0x4d41df);}return _0x24092e[_0x3135('0x25')]();};}function saveUpdates(_0x4c53f3,_0x141707){return function(_0x58259b){if(_0x58259b){return _0x58259b[_0x3135('0x26')](_0x4c53f3)[_0x3135('0x27')](function(_0x51f1dd){return _0x51f1dd;});}return null;};}function removeEntity(_0x355ac3,_0x1d46f8){return function(_0x2fe1ad){if(_0x2fe1ad){return _0x2fe1ad[_0x3135('0x28')]()[_0x3135('0x27')](function(){var _0x40c350=_0x2fe1ad[_0x3135('0x29')]({'plain':!![]});var _0x404943=_0x3135('0x2a');return db[_0x3135('0x2b')][_0x3135('0x28')]({'where':{'type':_0x404943,'resourceId':_0x40c350['id']}})[_0x3135('0x27')](function(){return _0x2fe1ad;});})[_0x3135('0x27')](function(){_0x355ac3[_0x3135('0x1c')](0xcc)[_0x3135('0x1d')]();});}};}function handleEntityNotFound(_0x93af0b,_0x3d8773){return function(_0x3b175a){if(!_0x3b175a){_0x93af0b[_0x3135('0x1b')](0x194);}return _0x3b175a;};}function handleError(_0x2a6c25,_0x1532bd){_0x1532bd=_0x1532bd||0x1f4;return function(_0xa14dbf){logger[_0x3135('0x2c')](_0xa14dbf[_0x3135('0x2d')]);if(_0xa14dbf[_0x3135('0x2e')]){delete _0xa14dbf[_0x3135('0x2e')];}_0x2a6c25[_0x3135('0x1c')](_0x1532bd)[_0x3135('0x2f')](_0xa14dbf);};}exports[_0x3135('0x30')]=function(_0xd2124e,_0x34cd0b){var _0x12da64={},_0x3e70d4={},_0x4c9c84={'count':0x0,'rows':[]};var _0x981e0a=_[_0x3135('0x31')](db[_0x3135('0x32')][_0x3135('0x33')],function(_0x1a01d4){return{'name':_0x1a01d4[_0x3135('0x34')],'type':_0x1a01d4['type'][_0x3135('0x35')]};});_0x3e70d4[_0x3135('0x36')]=_[_0x3135('0x31')](_0x981e0a,_0x3135('0x2e'));_0x3e70d4[_0x3135('0x37')]=_['keys'](_0xd2124e[_0x3135('0x37')]);_0x3e70d4[_0x3135('0x38')]=_[_0x3135('0x39')](_0x3e70d4[_0x3135('0x36')],_0x3e70d4[_0x3135('0x37')]);_0x12da64[_0x3135('0x3a')]=_['intersection'](_0x3e70d4[_0x3135('0x36')],qs[_0x3135('0x3b')](_0xd2124e[_0x3135('0x37')][_0x3135('0x3b')]));_0x12da64[_0x3135('0x3a')]=_0x12da64[_0x3135('0x3a')][_0x3135('0x3c')]?_0x12da64['attributes']:_0x3e70d4[_0x3135('0x36')];if(!_0xd2124e['query'][_0x3135('0x3d')]('nolimit')){_0x12da64['limit']=qs[_0x3135('0x21')](_0xd2124e[_0x3135('0x37')][_0x3135('0x21')]);_0x12da64[_0x3135('0x20')]=qs[_0x3135('0x20')](_0xd2124e['query'][_0x3135('0x20')]);}_0x12da64['order']=qs[_0x3135('0x3e')](_0xd2124e[_0x3135('0x37')]['sort']);_0x12da64['where']=qs[_0x3135('0x38')](_[_0x3135('0x3f')](_0xd2124e[_0x3135('0x37')],_0x3e70d4[_0x3135('0x38')]),_0x981e0a);if(_0xd2124e[_0x3135('0x37')][_0x3135('0x40')]){_0x12da64[_0x3135('0x41')]=_['merge'](_0x12da64['where'],{'$or':_[_0x3135('0x31')](_0x981e0a,function(_0x51ad49){if(_0x51ad49[_0x3135('0x42')]!==_0x3135('0x43')){var _0x5d1051={};_0x5d1051[_0x51ad49[_0x3135('0x2e')]]={'$like':'%'+_0xd2124e['query'][_0x3135('0x40')]+'%'};return _0x5d1051;}})});}_0x12da64=_['merge']({},_0x12da64,_0xd2124e['options']);var _0x249a10={'where':_0x12da64[_0x3135('0x41')]};return db['VoiceChanSpy']['count'](_0x249a10)[_0x3135('0x27')](function(_0x3f1a5b){_0x4c9c84[_0x3135('0x1f')]=_0x3f1a5b;if(_0xd2124e[_0x3135('0x37')][_0x3135('0x44')]){_0x12da64[_0x3135('0x45')]=[{'all':!![]}];}return db[_0x3135('0x32')][_0x3135('0x46')](_0x12da64);})[_0x3135('0x27')](function(_0x5caae9){_0x4c9c84['rows']=_0x5caae9;return _0x4c9c84;})[_0x3135('0x27')](respondWithFilteredResult(_0x34cd0b,_0x12da64))[_0x3135('0x47')](handleError(_0x34cd0b,null));};exports[_0x3135('0x48')]=function(_0x41009b,_0x55f5c1){var _0x2425f7={'raw':![],'where':{'id':_0x41009b[_0x3135('0x49')]['id']}},_0x82a000={};_0x82a000[_0x3135('0x36')]=_[_0x3135('0x4a')](db[_0x3135('0x32')][_0x3135('0x33')]);_0x82a000[_0x3135('0x37')]=_['keys'](_0x41009b[_0x3135('0x37')]);_0x82a000[_0x3135('0x38')]=_[_0x3135('0x39')](_0x82a000[_0x3135('0x36')],_0x82a000[_0x3135('0x37')]);_0x2425f7['attributes']=_[_0x3135('0x39')](_0x82a000[_0x3135('0x36')],qs[_0x3135('0x3b')](_0x41009b[_0x3135('0x37')][_0x3135('0x3b')]));_0x2425f7[_0x3135('0x3a')]=_0x2425f7['attributes'][_0x3135('0x3c')]?_0x2425f7[_0x3135('0x3a')]:_0x82a000[_0x3135('0x36')];if(_0x41009b[_0x3135('0x37')][_0x3135('0x44')]){_0x2425f7[_0x3135('0x45')]=[{'all':!![]}];}_0x2425f7=_[_0x3135('0x4b')]({},_0x2425f7,_0x41009b[_0x3135('0x4c')]);return db[_0x3135('0x32')][_0x3135('0x4d')](_0x2425f7)[_0x3135('0x27')](handleEntityNotFound(_0x55f5c1,null))[_0x3135('0x27')](respondWithResult(_0x55f5c1,null))[_0x3135('0x47')](handleError(_0x55f5c1,null));};exports['create']=function(_0x540085,_0x52d661){return db['VoiceChanSpy']['create'](_0x540085[_0x3135('0x4e')],{})[_0x3135('0x27')](function(_0x37e783){var _0x101c19=_0x540085[_0x3135('0x4f')][_0x3135('0x29')]({'plain':!![]});if(!_0x101c19)throw new Error(_0x3135('0x50'));if(_0x101c19[_0x3135('0x51')]===_0x3135('0x4f')){var _0x6042cc=_0x37e783[_0x3135('0x29')]({'plain':!![]});var _0x3d8fef=_0x3135('0x2a');return db[_0x3135('0x52')][_0x3135('0x4d')]({'where':{'name':_0x3d8fef,'userProfileId':_0x101c19[_0x3135('0x53')]},'raw':!![]})[_0x3135('0x27')](function(_0x84e32d){if(_0x84e32d&&_0x84e32d[_0x3135('0x54')]===0x0){return db['UserProfileResource'][_0x3135('0x55')]({'name':_0x6042cc[_0x3135('0x2e')],'resourceId':_0x6042cc['id'],'type':_0x84e32d[_0x3135('0x2e')],'sectionId':_0x84e32d['id']},{})[_0x3135('0x27')](function(){return _0x37e783;});}else{return _0x37e783;}})[_0x3135('0x47')](function(_0x5154f5){logger[_0x3135('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5154f5);throw _0x5154f5;});}return _0x37e783;})[_0x3135('0x27')](respondWithResult(_0x52d661,0xc9))[_0x3135('0x47')](handleError(_0x52d661,null));};exports[_0x3135('0x26')]=function(_0x5de184,_0x40c164){if(_0x5de184[_0x3135('0x4e')]['id']){delete _0x5de184['body']['id'];}return db[_0x3135('0x32')][_0x3135('0x4d')]({'where':{'id':_0x5de184['params']['id']}})[_0x3135('0x27')](handleEntityNotFound(_0x40c164,null))[_0x3135('0x27')](saveUpdates(_0x5de184['body'],null))['then'](respondWithResult(_0x40c164,null))[_0x3135('0x47')](handleError(_0x40c164,null));};exports[_0x3135('0x28')]=function(_0x217943,_0x1be733){return db[_0x3135('0x32')]['find']({'where':{'id':_0x217943[_0x3135('0x49')]['id']}})[_0x3135('0x27')](handleEntityNotFound(_0x1be733,null))[_0x3135('0x27')](removeEntity(_0x1be733,null))[_0x3135('0x47')](handleError(_0x1be733,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 66b6d21..ffb9781 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 _0x29a5=['lodash','util','bluebird','context','from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','merge','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy'];(function(_0x1e32c9,_0x3501c5){var _0xa705a5=function(_0x194d30){while(--_0x194d30){_0x1e32c9['push'](_0x1e32c9['shift']());}};_0xa705a5(++_0x3501c5);}(_0x29a5,0x1e0));var _0x529a=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x29a5[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0x529a('0x0'));var util=require(_0x529a('0x1'));var BPromise=require(_0x529a('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x27c562,_0x1eac25,_0x4c70fd){var _0x15be39=0x1;var _0x13dd75=[];var _0x5d0666={'context':_0x1eac25[_0x529a('0x3')]||_0x529a('0x4'),'exten':util[_0x529a('0x5')](_0x529a('0x6'),_0x27c562[_0x529a('0x7')],_0x4c70fd),'type':_0x529a('0x8'),'isApp':![],'ChanSpyId':_0x27c562['id'],'UserId':_0x1eac25['id']};_0x13dd75[_0x529a('0x9')](_['merge']({'app':_0x529a('0xa'),'appdata':util[_0x529a('0x5')](_0x529a('0xb'),'chanspy'),'priority':_0x15be39++},_0x5d0666));if(_0x27c562[_0x529a('0xc')]){_0x13dd75['push'](_['merge']({'app':_0x529a('0xd'),'appdata':util[_0x529a('0x5')](_0x529a('0xe'),_0x27c562[_0x529a('0xf')]),'priority':_0x15be39++},_0x5d0666));}if(_0x27c562[_0x529a('0x10')]){_0x13dd75[_0x529a('0x9')](_[_0x529a('0x11')]({'app':_0x529a('0x12'),'appdata':_0x27c562[_0x529a('0x13')],'priority':_0x15be39++},_0x5d0666));}_0x13dd75[_0x529a('0x9')](_[_0x529a('0x11')]({'app':_0x529a('0x14'),'appdata':util[_0x529a('0x5')](_0x529a('0x15'),_0x1eac25[_0x529a('0x16')],_0x27c562[_0x529a('0x17')]?_0x27c562['options'][_0x529a('0x18')](''):''),'priority':_0x15be39++},_0x5d0666));if(_0x27c562[_0x529a('0xc')]){_0x13dd75[_0x529a('0x9')](_['merge']({'app':_0x529a('0x19'),'priority':_0x15be39++},_0x5d0666));}return _0x13dd75;};var getChanSpyApplications=function(_0x155062,_0x42d7cc){var _0x42d818=[];for(var _0x36e235=0x0,_0x199cb1=0x1;_0x36e235<_0x42d7cc['length'];_0x36e235++,_0x199cb1=0x1){_0x42d818=_0x42d818[_0x529a('0x1a')](getUserApplications(_0x155062,_0x42d7cc[_0x36e235],_0x42d7cc[_0x36e235][_0x529a('0x1b')]));if(_0x42d7cc[_0x36e235][_0x529a('0x1b')]!=_0x42d7cc[_0x36e235]['name']){_0x42d818=_0x42d818[_0x529a('0x1a')](getUserApplications(_0x155062,_0x42d7cc[_0x36e235],_0x42d7cc[_0x36e235][_0x529a('0x16')]));}}return _0x42d818;};var getChanSpyPromise=function(_0x1a9e2c,_0x1b1093){return new BPromise(function(_0x4851b0,_0x5036bc){return _0x1a9e2c[_0x529a('0x1c')][_0x529a('0x1d')]({'attributes':['id',_0x529a('0x16'),_0x529a('0x1b')],'where':{'role':_0x529a('0x1e'),'chanspy':!![]},'raw':!![]})[_0x529a('0x1f')](function(_0x30e100){if(_0x30e100){return _0x4851b0(getChanSpyApplications(_0x1b1093,_0x30e100));}return _0x4851b0([]);})[_0x529a('0x20')](function(_0x4e748f){_0x5036bc(_0x4e748f);});});};module[_0x529a('0x21')]=function(_0x45448d,_0x224836){var _0x4c05b1=_0x45448d['models'];return _0x45448d[_0x529a('0x22')](_0x529a('0x23'),attributes,{'tableName':_0x529a('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x20aa30,_0x4049f5,_0x284cdc){return getChanSpyPromise(_0x4c05b1,_0x20aa30)[_0x529a('0x1f')](function(_0x40eac6){if(_0x40eac6&&_0x40eac6['length']){return _0x4c05b1[_0x529a('0x25')][_0x529a('0x26')](_0x40eac6);}})[_0x529a('0x1f')](function(){_0x284cdc();})[_0x529a('0x20')](function(_0x3d91f5){_0x284cdc(_0x3d91f5);});},'afterUpdate':function(_0x51c6ec,_0x3dad1b,_0x11f280){return _0x4c05b1[_0x529a('0x25')][_0x529a('0x27')]({'where':{'ChanSpyId':_0x51c6ec['id']}})[_0x529a('0x1f')](function(){return getChanSpyPromise(_0x4c05b1,_0x51c6ec);})[_0x529a('0x1f')](function(_0x4cb1cd){if(_0x4cb1cd&&_0x4cb1cd['length']){return _0x4c05b1[_0x529a('0x25')][_0x529a('0x26')](_0x4cb1cd);}})[_0x529a('0x1f')](function(){_0x11f280();})[_0x529a('0x20')](function(_0x3b73ed){_0x11f280(_0x3b73ed);});},'afterDestroy':function(_0x10535f,_0x916648,_0x15836b){return _0x4c05b1[_0x529a('0x25')][_0x529a('0x27')]({'where':{'ChanSpyId':_0x10535f['id']}})['then'](function(){_0x15836b();})[_0x529a('0x20')](function(_0x184838){_0x15836b(_0x184838);});}}});}; \ No newline at end of file +var _0x833b=['options','join','record','StopMixMonitor','length','internal','concat','User','findAll','agent','then','catch','exports','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','merge','Set','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','ChanSpy','SIP/%s,%s','name'];(function(_0x4b7146,_0x259a18){var _0x3fa85f=function(_0x3f3166){while(--_0x3f3166){_0x4b7146['push'](_0x4b7146['shift']());}};_0x3fa85f(++_0x259a18);}(_0x833b,0x131));var _0xb833=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x833b[_0xb24a3e];return _0x4038d7;};'use strict';var _=require('lodash');var util=require(_0xb833('0x0'));var BPromise=require('bluebird');var attributes=require(_0xb833('0x1'));var getUserApplications=function(_0x59fa54,_0x3588c8,_0x54d82d){var _0x66e74c=0x1;var _0x37ea87=[];var _0x1f9d90={'context':_0x3588c8[_0xb833('0x2')]||_0xb833('0x3'),'exten':util[_0xb833('0x4')](_0xb833('0x5'),_0x59fa54['prefix'],_0x54d82d),'type':_0xb833('0x6'),'isApp':![],'ChanSpyId':_0x59fa54['id'],'UserId':_0x3588c8['id']};_0x37ea87[_0xb833('0x7')](_[_0xb833('0x8')]({'app':_0xb833('0x9'),'appdata':util[_0xb833('0x4')](_0xb833('0xa'),_0xb833('0xb')),'priority':_0x66e74c++},_0x1f9d90));if(_0x59fa54['record']){_0x37ea87[_0xb833('0x7')](_['merge']({'app':_0xb833('0xc'),'appdata':util[_0xb833('0x4')](_0xb833('0xd'),_0x59fa54[_0xb833('0xe')]),'priority':_0x66e74c++},_0x1f9d90));}if(_0x59fa54['auth']){_0x37ea87['push'](_[_0xb833('0x8')]({'app':_0xb833('0xf'),'appdata':_0x59fa54['password'],'priority':_0x66e74c++},_0x1f9d90));}_0x37ea87[_0xb833('0x7')](_['merge']({'app':_0xb833('0x10'),'appdata':util[_0xb833('0x4')](_0xb833('0x11'),_0x3588c8[_0xb833('0x12')],_0x59fa54[_0xb833('0x13')]?_0x59fa54[_0xb833('0x13')][_0xb833('0x14')](''):''),'priority':_0x66e74c++},_0x1f9d90));if(_0x59fa54[_0xb833('0x15')]){_0x37ea87['push'](_[_0xb833('0x8')]({'app':_0xb833('0x16'),'priority':_0x66e74c++},_0x1f9d90));}return _0x37ea87;};var getChanSpyApplications=function(_0x480417,_0x4854cd){var _0x9d3413=[];for(var _0x59d65f=0x0,_0x40f61e=0x1;_0x59d65f<_0x4854cd[_0xb833('0x17')];_0x59d65f++,_0x40f61e=0x1){_0x9d3413=_0x9d3413['concat'](getUserApplications(_0x480417,_0x4854cd[_0x59d65f],_0x4854cd[_0x59d65f][_0xb833('0x18')]));if(_0x4854cd[_0x59d65f][_0xb833('0x18')]!=_0x4854cd[_0x59d65f]['name']){_0x9d3413=_0x9d3413[_0xb833('0x19')](getUserApplications(_0x480417,_0x4854cd[_0x59d65f],_0x4854cd[_0x59d65f][_0xb833('0x12')]));}}return _0x9d3413;};var getChanSpyPromise=function(_0x38eaac,_0x50a6e9){return new BPromise(function(_0x302c83,_0x3beb25){return _0x38eaac[_0xb833('0x1a')][_0xb833('0x1b')]({'attributes':['id','name','internal'],'where':{'role':_0xb833('0x1c'),'chanspy':!![]},'raw':!![]})[_0xb833('0x1d')](function(_0xb20878){if(_0xb20878){return _0x302c83(getChanSpyApplications(_0x50a6e9,_0xb20878));}return _0x302c83([]);})[_0xb833('0x1e')](function(_0x22f6eb){_0x3beb25(_0x22f6eb);});});};module[_0xb833('0x1f')]=function(_0x52908c,_0x2c9765){var _0x57defe=_0x52908c['models'];return _0x52908c['define'](_0xb833('0x20'),attributes,{'tableName':_0xb833('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e11d0,_0x532661,_0x191349){return getChanSpyPromise(_0x57defe,_0x2e11d0)[_0xb833('0x1d')](function(_0x48f3ad){if(_0x48f3ad&&_0x48f3ad[_0xb833('0x17')]){return _0x57defe[_0xb833('0x22')]['bulkCreate'](_0x48f3ad);}})[_0xb833('0x1d')](function(){_0x191349();})['catch'](function(_0xc7d7){_0x191349(_0xc7d7);});},'afterUpdate':function(_0x46101f,_0x471854,_0x494c20){return _0x57defe[_0xb833('0x22')][_0xb833('0x23')]({'where':{'ChanSpyId':_0x46101f['id']}})[_0xb833('0x1d')](function(){return getChanSpyPromise(_0x57defe,_0x46101f);})['then'](function(_0x148ef3){if(_0x148ef3&&_0x148ef3[_0xb833('0x17')]){return _0x57defe[_0xb833('0x22')]['bulkCreate'](_0x148ef3);}})['then'](function(){_0x494c20();})[_0xb833('0x1e')](function(_0x48838b){_0x494c20(_0x48838b);});},'afterDestroy':function(_0x3830f3,_0x3854e7,_0x3d910f){return _0x57defe[_0xb833('0x22')][_0xb833('0x23')]({'where':{'ChanSpyId':_0x3830f3['id']}})[_0xb833('0x1d')](function(){_0x3d910f();})['catch'](function(_0x5905ab){_0x3d910f(_0x5905ab);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 5e81890..4f35a2d 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 _0x2f9c=['request','then','info','request\x20sent','debug','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f9c,0x1ae));var _0xc2f9=function(_0x3382fb,_0xf3de39){_0x3382fb=_0x3382fb-0x0;var _0x5e687e=_0x2f9c[_0x3382fb];return _0x5e687e;};'use strict';var _=require(_0xc2f9('0x0'));var util=require('util');var moment=require(_0xc2f9('0x1'));var BPromise=require(_0xc2f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2f9('0x3'))['db'];var utils=require(_0xc2f9('0x4'));var logger=require(_0xc2f9('0x5'))(_0xc2f9('0x6'));var config=require('../../config/environment');var jayson=require(_0xc2f9('0x7'));var client=jayson[_0xc2f9('0x8')][_0xc2f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xed155a,_0x1c359f,_0x503a48){return new BPromise(function(_0xe33bf3,_0xd4eae2){return client[_0xc2f9('0xa')](_0xed155a,_0x503a48)[_0xc2f9('0xb')](function(_0x44a2f9){logger[_0xc2f9('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x1c359f,_0xc2f9('0xd'));logger[_0xc2f9('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x1c359f,_0xc2f9('0xd'),JSON[_0xc2f9('0xf')](_0x44a2f9));if(_0x44a2f9['error']){if(_0x44a2f9[_0xc2f9('0x10')][_0xc2f9('0x11')]===0x1f4){logger[_0xc2f9('0x10')](_0xc2f9('0x12'),_0x1c359f,_0x44a2f9[_0xc2f9('0x10')][_0xc2f9('0x13')]);return _0xd4eae2(_0x44a2f9[_0xc2f9('0x10')][_0xc2f9('0x13')]);}logger[_0xc2f9('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x1c359f,_0x44a2f9[_0xc2f9('0x10')]['message']);return _0xe33bf3(_0x44a2f9[_0xc2f9('0x10')][_0xc2f9('0x13')]);}else{logger[_0xc2f9('0xc')](_0xc2f9('0x12'),_0x1c359f,_0xc2f9('0xd'));_0xe33bf3(_0x44a2f9[_0xc2f9('0x14')][_0xc2f9('0x13')]);}})[_0xc2f9('0x15')](function(_0x4806fc){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x1c359f,_0x4806fc);_0xd4eae2(_0x4806fc);});});} \ No newline at end of file +var _0x8a70=['jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','randomstring','../../config/logger'];(function(_0x1cfee5,_0x10a0ef){var _0x13a4d8=function(_0x38c681){while(--_0x38c681){_0x1cfee5['push'](_0x1cfee5['shift']());}};_0x13a4d8(++_0x10a0ef);}(_0x8a70,0x1a4));var _0x08a7=function(_0xcc1cd5,_0x3f7102){_0xcc1cd5=_0xcc1cd5-0x0;var _0x427c0a=_0x8a70[_0xcc1cd5];return _0x427c0a;};'use strict';var _=require(_0x08a7('0x0'));var util=require(_0x08a7('0x1'));var moment=require(_0x08a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x08a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x08a7('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x08a7('0x5'));var client=jayson[_0x08a7('0x6')][_0x08a7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a9e3a,_0x5dab62,_0x357889){return new BPromise(function(_0x515ff2,_0x3bf5b4){return client[_0x08a7('0x8')](_0x1a9e3a,_0x357889)['then'](function(_0x40983e){logger[_0x08a7('0x9')](_0x08a7('0xa'),_0x5dab62,_0x08a7('0xb'));logger[_0x08a7('0xc')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5dab62,_0x08a7('0xb'),JSON['stringify'](_0x40983e));if(_0x40983e['error']){if(_0x40983e[_0x08a7('0xd')][_0x08a7('0xe')]===0x1f4){logger[_0x08a7('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x5dab62,_0x40983e[_0x08a7('0xd')][_0x08a7('0xf')]);return _0x3bf5b4(_0x40983e[_0x08a7('0xd')]['message']);}logger[_0x08a7('0xd')](_0x08a7('0xa'),_0x5dab62,_0x40983e[_0x08a7('0xd')]['message']);return _0x515ff2(_0x40983e[_0x08a7('0xd')]['message']);}else{logger['info'](_0x08a7('0xa'),_0x5dab62,_0x08a7('0xb'));_0x515ff2(_0x40983e[_0x08a7('0x10')][_0x08a7('0xf')]);}})['catch'](function(_0x2e1322){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x5dab62,_0x2e1322);_0x3bf5b4(_0x2e1322);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index fb2e03c..ec4c36c 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 _0x1738=['fs-extra','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','destroy','exports','multer','util','express','Router'];(function(_0x4a2c65,_0x5c203b){var _0x546a1b=function(_0x7d9ac1){while(--_0x7d9ac1){_0x4a2c65['push'](_0x4a2c65['shift']());}};_0x546a1b(++_0x5c203b);}(_0x1738,0x1bc));var _0x8173=function(_0x137d0a,_0x5e2ba2){_0x137d0a=_0x137d0a-0x0;var _0x3d4f4e=_0x1738[_0x137d0a];return _0x3d4f4e;};'use strict';var multer=require(_0x8173('0x0'));var util=require(_0x8173('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8173('0x2'));var router=express[_0x8173('0x3')]();var fs_extra=require(_0x8173('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8173('0x5'));var controller=require(_0x8173('0x6'));router[_0x8173('0x7')]('/',auth[_0x8173('0x8')](),controller[_0x8173('0x9')]);router[_0x8173('0x7')](_0x8173('0xa'),auth[_0x8173('0x8')](),controller[_0x8173('0xb')]);router[_0x8173('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8173('0xd')](_0x8173('0xa'),auth[_0x8173('0x8')](),controller['update']);router['delete'](_0x8173('0xa'),auth[_0x8173('0x8')](),controller[_0x8173('0xe')]);module[_0x8173('0xf')]=router; \ No newline at end of file +var _0x13c0=['../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x4dab51,_0x2a5c13){var _0x2b6f22=function(_0x4dca07){while(--_0x4dca07){_0x4dab51['push'](_0x4dab51['shift']());}};_0x2b6f22(++_0x2a5c13);}(_0x13c0,0x79));var _0x013c=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x13c0[_0x1ac120];return _0x19b703;};'use strict';var multer=require(_0x013c('0x0'));var util=require(_0x013c('0x1'));var path=require(_0x013c('0x2'));var timeout=require(_0x013c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x013c('0x4'));var interaction=require(_0x013c('0x5'));var config=require(_0x013c('0x6'));var controller=require(_0x013c('0x7'));router[_0x013c('0x8')]('/',auth[_0x013c('0x9')](),controller[_0x013c('0xa')]);router[_0x013c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x013c('0xb')]('/',auth[_0x013c('0x9')](),controller['create']);router[_0x013c('0xc')](_0x013c('0xd'),auth[_0x013c('0x9')](),controller[_0x013c('0xe')]);router[_0x013c('0xf')](_0x013c('0xd'),auth[_0x013c('0x9')](),controller[_0x013c('0x10')]);module[_0x013c('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 3d40e3d..c9be863 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 _0x3e74=['name','sequelize','STRING'];(function(_0x673d68,_0x115d89){var _0x51b40b=function(_0x2278d0){while(--_0x2278d0){_0x673d68['push'](_0x673d68['shift']());}};_0x51b40b(++_0x115d89);}(_0x3e74,0x175));var _0x43e7=function(_0x41f068,_0x4365bd){_0x41f068=_0x41f068-0x0;var _0x363b1a=_0x3e74[_0x41f068];return _0x363b1a;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4df722,_0x499003){var _0x58af21=function(_0x4e190f){while(--_0x4e190f){_0x4df722['push'](_0x4df722['shift']());}};_0x58af21(++_0x499003);}(_0xe14b,0x93));var _0xbe14=function(_0x4ec061,_0x332d18){_0x4ec061=_0x4ec061-0x0;var _0x379807=_0xe14b[_0x4ec061];return _0x379807;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xbe14('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbe14('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 086ce2b..f4bf714 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 _0x638a=['rows','show','params','intersection','fields','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','chan_sip.so','find','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0x638a,0x80));var _0xa638=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x638a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa638('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa638('0x1'));var zipdir=require(_0xa638('0x2'));var jsonpatch=require(_0xa638('0x3'));var rp=require('request-promise');var moment=require(_0xa638('0x4'));var BPromise=require(_0xa638('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa638('0x6'));var sox=require(_0xa638('0x7'));var csv=require(_0xa638('0x8'));var ejs=require(_0xa638('0x9'));var fs=require('fs');var fs_extra=require(_0xa638('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa638('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa638('0x8'));var querystring=require(_0xa638('0xc'));var Papa=require(_0xa638('0xd'));var Redis=require(_0xa638('0xe'));var authService=require(_0xa638('0xf'));var qs=require(_0xa638('0x10'));var as=require(_0xa638('0x11'));var hardwareService=require(_0xa638('0x12'));var logger=require(_0xa638('0x13'))(_0xa638('0x14'));var utils=require(_0xa638('0x15'));var config=require(_0xa638('0x16'));var licenseUtil=require(_0xa638('0x17'));var db=require(_0xa638('0x18'))['db'];var jayson=require(_0xa638('0x19'));var client=jayson[_0xa638('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c895d,_0x2828a1,_0x5f3e1b,_0x1e17e6){return new BPromise(function(_0x46a339,_0x137c98){var _0x4a9c50=_0x1e17e6||client;return _0x4a9c50[_0xa638('0x1b')](_0x2c895d,_0x5f3e1b)[_0xa638('0x1c')](function(_0x37909b){logger['info'](_0xa638('0x1d'),_0x2828a1,_0xa638('0x1e'));logger[_0xa638('0x1f')](_0xa638('0x20'),_0x2828a1,_0xa638('0x1e'),JSON['stringify'](_0x37909b));if(_0x37909b['error']){if(_0x37909b['error'][_0xa638('0x21')]===0x1f4){logger[_0xa638('0x22')](_0xa638('0x1d'),_0x2828a1,_0x37909b[_0xa638('0x22')][_0xa638('0x23')]);return _0x137c98(_0x37909b[_0xa638('0x22')][_0xa638('0x23')]);}logger['error'](_0xa638('0x1d'),_0x2828a1,_0x37909b['error'][_0xa638('0x23')]);return _0x46a339(_0x37909b['error'][_0xa638('0x23')]);}else{logger[_0xa638('0x24')](_0xa638('0x1d'),_0x2828a1,'request\x20sent');_0x46a339(_0x37909b[_0xa638('0x25')][_0xa638('0x23')]);}})[_0xa638('0x26')](function(_0x14ff17){logger[_0xa638('0x22')](_0xa638('0x1d'),_0x2828a1,_0x14ff17);_0x137c98(_0x14ff17);});});}function respondWithStatusCode(_0x5d5282,_0x1e934a){_0x1e934a=_0x1e934a||0xcc;return function(_0x18a6d7){if(_0x18a6d7){return _0x5d5282[_0xa638('0x27')](_0x1e934a);}return _0x5d5282['status'](_0x1e934a)[_0xa638('0x28')]();};}function respondWithResult(_0x13761d,_0x4c3ea3){_0x4c3ea3=_0x4c3ea3||0xc8;return function(_0x5c4584){if(_0x5c4584){return _0x13761d[_0xa638('0x29')](_0x4c3ea3)[_0xa638('0x2a')](_0x5c4584);}};}function respondWithFilteredResult(_0x9bd3d0,_0x8a8f8d){return function(_0x2d48c6){if(_0x2d48c6){var _0x344e26=_0x2d48c6[_0xa638('0x2b')],_0x56eee4=_0x8a8f8d[_0xa638('0x2c')],_0x17ead0=_0x8a8f8d['offset']+_0x8a8f8d[_0xa638('0x2d')],_0x5f369c;if(_0x17ead0>=_0x344e26){_0x17ead0=_0x344e26;_0x5f369c=0xc8;}else{_0x5f369c=0xce;}_0x9bd3d0[_0xa638('0x29')](_0x5f369c);return _0x9bd3d0[_0xa638('0x2e')](_0xa638('0x2f'),_0x56eee4+'-'+_0x17ead0+'/'+_0x344e26)['json'](_0x2d48c6);}return null;};}function patchUpdates(_0x506e69){return function(_0x2e0aac){try{jsonpatch[_0xa638('0x30')](_0x2e0aac,_0x506e69,!![]);}catch(_0xe3aa0d){return BPromise[_0xa638('0x31')](_0xe3aa0d);}return _0x2e0aac['save']();};}function saveUpdates(_0x4cdb6f,_0x2c743a){return function(_0x369247){if(_0x369247){return _0x369247[_0xa638('0x32')](_0x4cdb6f)[_0xa638('0x1c')](function(_0xbbe971){return _0xbbe971;});}return null;};}function removeEntity(_0x1c1526,_0xdfe31c){return function(_0x1453e6){if(_0x1453e6){return _0x1453e6[_0xa638('0x33')]()[_0xa638('0x1c')](function(){var _0x252686=_0x1453e6['get']({'plain':!![]});var _0x39d11c='Contexts';return db['UserProfileResource'][_0xa638('0x33')]({'where':{'type':_0x39d11c,'resourceId':_0x252686['id']}})[_0xa638('0x1c')](function(){return _0x1453e6;});})['then'](function(){_0x1c1526[_0xa638('0x29')](0xcc)[_0xa638('0x28')]();});}};}function handleEntityNotFound(_0x2840ae,_0x968e52){return function(_0x38ffa9){if(!_0x38ffa9){_0x2840ae[_0xa638('0x27')](0x194);}return _0x38ffa9;};}function handleError(_0xf8b1e1,_0x1bc5ac){_0x1bc5ac=_0x1bc5ac||0x1f4;return function(_0x9ba463){logger[_0xa638('0x22')](_0x9ba463[_0xa638('0x34')]);if(_0x9ba463[_0xa638('0x35')]){delete _0x9ba463[_0xa638('0x35')];}_0xf8b1e1['status'](_0x1bc5ac)['send'](_0x9ba463);};}exports['index']=function(_0x445cd9,_0x390609){var _0x57d2c6={},_0x2196e7={},_0x36dc78={'count':0x0,'rows':[]};var _0x4f8857=_[_0xa638('0x36')](db['VoiceContext'][_0xa638('0x37')],function(_0x2ca630){return{'name':_0x2ca630[_0xa638('0x38')],'type':_0x2ca630[_0xa638('0x39')][_0xa638('0x3a')]};});_0x2196e7[_0xa638('0x3b')]=_['map'](_0x4f8857,_0xa638('0x35'));_0x2196e7[_0xa638('0x3c')]=_[_0xa638('0x3d')](_0x445cd9[_0xa638('0x3c')]);_0x2196e7['filters']=_['intersection'](_0x2196e7[_0xa638('0x3b')],_0x2196e7[_0xa638('0x3c')]);_0x57d2c6[_0xa638('0x3e')]=_['intersection'](_0x2196e7[_0xa638('0x3b')],qs['fields'](_0x445cd9['query']['fields']));_0x57d2c6[_0xa638('0x3e')]=_0x57d2c6[_0xa638('0x3e')]['length']?_0x57d2c6[_0xa638('0x3e')]:_0x2196e7['model'];if(!_0x445cd9[_0xa638('0x3c')]['hasOwnProperty'](_0xa638('0x3f'))){_0x57d2c6[_0xa638('0x2d')]=qs['limit'](_0x445cd9[_0xa638('0x3c')][_0xa638('0x2d')]);_0x57d2c6[_0xa638('0x2c')]=qs[_0xa638('0x2c')](_0x445cd9[_0xa638('0x3c')]['offset']);}_0x57d2c6[_0xa638('0x40')]=qs[_0xa638('0x41')](_0x445cd9[_0xa638('0x3c')][_0xa638('0x41')]);_0x57d2c6[_0xa638('0x42')]=qs['filters'](_['pick'](_0x445cd9[_0xa638('0x3c')],_0x2196e7[_0xa638('0x43')]),_0x4f8857);if(_0x445cd9[_0xa638('0x3c')][_0xa638('0x44')]){_0x57d2c6[_0xa638('0x42')]=_[_0xa638('0x45')](_0x57d2c6[_0xa638('0x42')],{'$or':_[_0xa638('0x36')](_0x4f8857,function(_0x747048){if(_0x747048[_0xa638('0x39')]!==_0xa638('0x46')){var _0x315f44={};_0x315f44[_0x747048[_0xa638('0x35')]]={'$like':'%'+_0x445cd9['query'][_0xa638('0x44')]+'%'};return _0x315f44;}})});}_0x57d2c6=_[_0xa638('0x45')]({},_0x57d2c6,_0x445cd9[_0xa638('0x47')]);var _0x40e91b={'where':_0x57d2c6[_0xa638('0x42')]};return db[_0xa638('0x48')]['count'](_0x40e91b)[_0xa638('0x1c')](function(_0x3701ba){_0x36dc78['count']=_0x3701ba;if(_0x445cd9[_0xa638('0x3c')][_0xa638('0x49')]){_0x57d2c6[_0xa638('0x4a')]=[{'all':!![]}];}return db['VoiceContext'][_0xa638('0x4b')](_0x57d2c6);})[_0xa638('0x1c')](function(_0x50af23){_0x36dc78[_0xa638('0x4c')]=_0x50af23;return _0x36dc78;})[_0xa638('0x1c')](respondWithFilteredResult(_0x390609,_0x57d2c6))[_0xa638('0x26')](handleError(_0x390609,null));};exports[_0xa638('0x4d')]=function(_0x40ef4b,_0x4a78ba){var _0x5918b3={'raw':![],'where':{'id':_0x40ef4b[_0xa638('0x4e')]['id']}},_0x4c9d12={};_0x4c9d12[_0xa638('0x3b')]=_['keys'](db['VoiceContext'][_0xa638('0x37')]);_0x4c9d12[_0xa638('0x3c')]=_[_0xa638('0x3d')](_0x40ef4b[_0xa638('0x3c')]);_0x4c9d12['filters']=_[_0xa638('0x4f')](_0x4c9d12[_0xa638('0x3b')],_0x4c9d12[_0xa638('0x3c')]);_0x5918b3['attributes']=_[_0xa638('0x4f')](_0x4c9d12['model'],qs['fields'](_0x40ef4b[_0xa638('0x3c')][_0xa638('0x50')]));_0x5918b3[_0xa638('0x3e')]=_0x5918b3[_0xa638('0x3e')]['length']?_0x5918b3[_0xa638('0x3e')]:_0x4c9d12[_0xa638('0x3b')];if(_0x40ef4b[_0xa638('0x3c')]['includeAll']){_0x5918b3['include']=[{'all':!![]}];}_0x5918b3=_[_0xa638('0x45')]({},_0x5918b3,_0x40ef4b[_0xa638('0x47')]);return db[_0xa638('0x48')]['find'](_0x5918b3)[_0xa638('0x1c')](handleEntityNotFound(_0x4a78ba,null))[_0xa638('0x1c')](respondWithResult(_0x4a78ba,null))['catch'](handleError(_0x4a78ba,null));};exports[_0xa638('0x51')]=function(_0x7eb257,_0x2cbd86,_0x103435){var _0x201af7;return db[_0xa638('0x48')][_0xa638('0x51')](_0x7eb257[_0xa638('0x52')],{'raw':!![]})[_0xa638('0x1c')](function(_0x272bb5){_0x201af7=_0x272bb5;return db['VoiceContext'][_0xa638('0x4b')]({'raw':!![]});})[_0xa638('0x1c')](function(_0x333def){var _0x1bbe93=fs[_0xa638('0x53')](path[_0xa638('0x54')](config[_0xa638('0x55')],_0xa638('0x56')),_0xa638('0x57'));var _0x46aba1=ejs[_0xa638('0x58')](_0x1bbe93,{'contexts':_0x333def||[]});fs[_0xa638('0x59')](_0xa638('0x5a'),_0x46aba1);})['then'](function(){return respondWithRpcPromise(_0xa638('0x5b'),'create',{'module':'chan_sip.so'});})[_0xa638('0x1c')](function(){var _0xcbfe62=_0x7eb257[_0xa638('0x5c')][_0xa638('0x5d')]({'plain':!![]});if(!_0xcbfe62)throw new Error(_0xa638('0x5e'));if(_0xcbfe62[_0xa638('0x5f')]===_0xa638('0x5c')){var _0x16605d=_0x201af7[_0xa638('0x5d')]({'plain':!![]});return db[_0xa638('0x60')]['find']({'where':{'name':'Contexts','userProfileId':_0xcbfe62['userProfileId']},'raw':!![]})[_0xa638('0x1c')](function(_0x433cc2){if(_0x433cc2&&_0x433cc2[_0xa638('0x61')]===0x0){return db[_0xa638('0x62')]['create']({'name':_0x16605d[_0xa638('0x35')],'resourceId':_0x16605d['id'],'type':_0x433cc2[_0xa638('0x35')],'sectionId':_0x433cc2['id']},{})['then'](function(){return _0x201af7;});}else{return _0x201af7;}})[_0xa638('0x26')](function(_0x464357){logger['error'](_0xa638('0x63'),_0x464357);throw _0x464357;});}return _0x201af7;})[_0xa638('0x1c')](respondWithResult(_0x2cbd86,0xc9))[_0xa638('0x26')](handleError(_0x2cbd86,null));};exports[_0xa638('0x32')]=function(_0xfe249e,_0x5b19d4,_0x520de6){var _0x36be5d;return db[_0xa638('0x48')]['find']({'where':{'id':_0xfe249e['params']['id']}})[_0xa638('0x1c')](handleEntityNotFound(_0x5b19d4,null))[_0xa638('0x1c')](saveUpdates(_0xfe249e[_0xa638('0x52')],null))[_0xa638('0x1c')](function(_0x5cd9ea){if(_0x5cd9ea){_0x36be5d=_0x5cd9ea;return db[_0xa638('0x48')]['findAll']({'raw':!![]});}})[_0xa638('0x1c')](function(_0x4ab3db){var _0x33b4c1=fs['readFileSync'](path[_0xa638('0x54')](config[_0xa638('0x55')],_0xa638('0x56')),_0xa638('0x57'));var _0x3a0e82=ejs[_0xa638('0x58')](_0x33b4c1,{'contexts':_0x4ab3db||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x3a0e82);})['then'](function(){return respondWithRpcPromise(_0xa638('0x5b'),_0xa638('0x32'),{'module':_0xa638('0x64')});})['then'](function(){return _0x36be5d;})[_0xa638('0x1c')](respondWithResult(_0x5b19d4,null))['catch'](handleError(_0x5b19d4,null));};exports[_0xa638('0x33')]=function(_0x16b716,_0x2de230,_0x6162ba){var _0x591a5b;return db[_0xa638('0x48')][_0xa638('0x65')]({'where':{'id':_0x16b716['params']['id']}})[_0xa638('0x1c')](handleEntityNotFound(_0x2de230,null))['then'](removeEntity(_0x2de230,null))[_0xa638('0x1c')](function(){return db[_0xa638('0x48')][_0xa638('0x4b')]({'raw':!![]});})[_0xa638('0x1c')](function(_0x3ce013){var _0x1e1a46=fs[_0xa638('0x53')](path[_0xa638('0x54')](config['root'],_0xa638('0x56')),_0xa638('0x57'));var _0x53d994=ejs[_0xa638('0x58')](_0x1e1a46,{'contexts':_0x3ce013});fs['writeFileSync'](_0xa638('0x5a'),_0x53d994);return respondWithRpcPromise(_0xa638('0x5b'),'destroy',{'module':'chan_sip.so'});})['catch'](handleError(_0x2de230,null));}; \ No newline at end of file +var _0x148d=['path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','json','count','offset','limit','status','set','apply','reject','update','get','Contexts','UserProfileResource','destroy','stack','name','send','VoiceContext','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','catch','params','includeAll','find','create','body','readFileSync','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','chan_sip.so','utf8','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x464e7b,_0x5eb523){var _0x32cfe2=function(_0x2a0293){while(--_0x2a0293){_0x464e7b['push'](_0x464e7b['shift']());}};_0x32cfe2(++_0x5eb523);}(_0x148d,0x128));var _0xd148=function(_0x5767bd,_0x2c586a){_0x5767bd=_0x5767bd-0x0;var _0x125824=_0x148d[_0x5767bd];return _0x125824;};'use strict';var pdf=require(_0xd148('0x0'));var emlformat=require(_0xd148('0x1'));var rimraf=require(_0xd148('0x2'));var zipdir=require(_0xd148('0x3'));var jsonpatch=require(_0xd148('0x4'));var rp=require(_0xd148('0x5'));var moment=require(_0xd148('0x6'));var BPromise=require(_0xd148('0x7'));var Mustache=require(_0xd148('0x8'));var util=require(_0xd148('0x9'));var path=require(_0xd148('0xa'));var sox=require(_0xd148('0xb'));var csv=require(_0xd148('0xc'));var ejs=require(_0xd148('0xd'));var fs=require('fs');var fs_extra=require(_0xd148('0xe'));var _=require('lodash');var squel=require(_0xd148('0xf'));var crypto=require('crypto');var jsforce=require(_0xd148('0x10'));var deskjs=require(_0xd148('0x11'));var toCsv=require(_0xd148('0xc'));var querystring=require(_0xd148('0x12'));var Papa=require(_0xd148('0x13'));var Redis=require(_0xd148('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd148('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd148('0x16'))('api');var utils=require(_0xd148('0x17'));var config=require(_0xd148('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd148('0x19'))['db'];var jayson=require(_0xd148('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54f48f,_0x5617d1,_0x5c2047,_0x4b2df0){return new BPromise(function(_0x5d947c,_0x51d9e6){var _0x28021a=_0x4b2df0||client;return _0x28021a[_0xd148('0x1b')](_0x54f48f,_0x5c2047)[_0xd148('0x1c')](function(_0x31cccd){logger[_0xd148('0x1d')](_0xd148('0x1e'),_0x5617d1,_0xd148('0x1f'));logger[_0xd148('0x20')](_0xd148('0x21'),_0x5617d1,_0xd148('0x1f'),JSON[_0xd148('0x22')](_0x31cccd));if(_0x31cccd[_0xd148('0x23')]){if(_0x31cccd[_0xd148('0x23')][_0xd148('0x24')]===0x1f4){logger[_0xd148('0x23')](_0xd148('0x1e'),_0x5617d1,_0x31cccd['error'][_0xd148('0x25')]);return _0x51d9e6(_0x31cccd['error'][_0xd148('0x25')]);}logger[_0xd148('0x23')]('VoiceContext,\x20%s,\x20%s',_0x5617d1,_0x31cccd[_0xd148('0x23')]['message']);return _0x5d947c(_0x31cccd[_0xd148('0x23')][_0xd148('0x25')]);}else{logger[_0xd148('0x1d')](_0xd148('0x1e'),_0x5617d1,_0xd148('0x1f'));_0x5d947c(_0x31cccd[_0xd148('0x26')][_0xd148('0x25')]);}})['catch'](function(_0x5924){logger[_0xd148('0x23')](_0xd148('0x1e'),_0x5617d1,_0x5924);_0x51d9e6(_0x5924);});});}function respondWithStatusCode(_0x24bfcb,_0x34f988){_0x34f988=_0x34f988||0xcc;return function(_0x1738c7){if(_0x1738c7){return _0x24bfcb[_0xd148('0x27')](_0x34f988);}return _0x24bfcb['status'](_0x34f988)[_0xd148('0x28')]();};}function respondWithResult(_0x240c89,_0x140b09){_0x140b09=_0x140b09||0xc8;return function(_0x2217ba){if(_0x2217ba){return _0x240c89['status'](_0x140b09)[_0xd148('0x29')](_0x2217ba);}};}function respondWithFilteredResult(_0x8dd5ad,_0x144e67){return function(_0x37124f){if(_0x37124f){var _0x5b766a=_0x37124f[_0xd148('0x2a')],_0x5604aa=_0x144e67['offset'],_0x2d594f=_0x144e67[_0xd148('0x2b')]+_0x144e67[_0xd148('0x2c')],_0x3dedf9;if(_0x2d594f>=_0x5b766a){_0x2d594f=_0x5b766a;_0x3dedf9=0xc8;}else{_0x3dedf9=0xce;}_0x8dd5ad[_0xd148('0x2d')](_0x3dedf9);return _0x8dd5ad[_0xd148('0x2e')]('Content-Range',_0x5604aa+'-'+_0x2d594f+'/'+_0x5b766a)[_0xd148('0x29')](_0x37124f);}return null;};}function patchUpdates(_0x55f62f){return function(_0x4d9a8a){try{jsonpatch[_0xd148('0x2f')](_0x4d9a8a,_0x55f62f,!![]);}catch(_0x5bf482){return BPromise[_0xd148('0x30')](_0x5bf482);}return _0x4d9a8a['save']();};}function saveUpdates(_0x3e2289,_0x253d57){return function(_0x2a4083){if(_0x2a4083){return _0x2a4083[_0xd148('0x31')](_0x3e2289)[_0xd148('0x1c')](function(_0x168c64){return _0x168c64;});}return null;};}function removeEntity(_0x5ba6a6,_0x2c7e56){return function(_0x49ef5a){if(_0x49ef5a){return _0x49ef5a['destroy']()[_0xd148('0x1c')](function(){var _0x3b303d=_0x49ef5a[_0xd148('0x32')]({'plain':!![]});var _0xe24057=_0xd148('0x33');return db[_0xd148('0x34')][_0xd148('0x35')]({'where':{'type':_0xe24057,'resourceId':_0x3b303d['id']}})[_0xd148('0x1c')](function(){return _0x49ef5a;});})['then'](function(){_0x5ba6a6['status'](0xcc)[_0xd148('0x28')]();});}};}function handleEntityNotFound(_0x182010,_0xab8dbf){return function(_0x5b3088){if(!_0x5b3088){_0x182010[_0xd148('0x27')](0x194);}return _0x5b3088;};}function handleError(_0x43f385,_0x3aa388){_0x3aa388=_0x3aa388||0x1f4;return function(_0x398804){logger[_0xd148('0x23')](_0x398804[_0xd148('0x36')]);if(_0x398804[_0xd148('0x37')]){delete _0x398804[_0xd148('0x37')];}_0x43f385[_0xd148('0x2d')](_0x3aa388)[_0xd148('0x38')](_0x398804);};}exports['index']=function(_0x5a87b8,_0x5db5f1){var _0x3f10f7={},_0x3ec374={},_0x1ca721={'count':0x0,'rows':[]};var _0x256695=_['map'](db[_0xd148('0x39')][_0xd148('0x3a')],function(_0x185b4f){return{'name':_0x185b4f[_0xd148('0x3b')],'type':_0x185b4f[_0xd148('0x3c')]['key']};});_0x3ec374[_0xd148('0x3d')]=_[_0xd148('0x3e')](_0x256695,_0xd148('0x37'));_0x3ec374[_0xd148('0x3f')]=_[_0xd148('0x40')](_0x5a87b8['query']);_0x3ec374[_0xd148('0x41')]=_[_0xd148('0x42')](_0x3ec374[_0xd148('0x3d')],_0x3ec374[_0xd148('0x3f')]);_0x3f10f7[_0xd148('0x43')]=_[_0xd148('0x42')](_0x3ec374[_0xd148('0x3d')],qs[_0xd148('0x44')](_0x5a87b8[_0xd148('0x3f')][_0xd148('0x44')]));_0x3f10f7[_0xd148('0x43')]=_0x3f10f7[_0xd148('0x43')][_0xd148('0x45')]?_0x3f10f7[_0xd148('0x43')]:_0x3ec374[_0xd148('0x3d')];if(!_0x5a87b8[_0xd148('0x3f')]['hasOwnProperty'](_0xd148('0x46'))){_0x3f10f7[_0xd148('0x2c')]=qs['limit'](_0x5a87b8[_0xd148('0x3f')][_0xd148('0x2c')]);_0x3f10f7[_0xd148('0x2b')]=qs[_0xd148('0x2b')](_0x5a87b8[_0xd148('0x3f')]['offset']);}_0x3f10f7[_0xd148('0x47')]=qs[_0xd148('0x48')](_0x5a87b8['query']['sort']);_0x3f10f7['where']=qs[_0xd148('0x41')](_[_0xd148('0x49')](_0x5a87b8['query'],_0x3ec374[_0xd148('0x41')]),_0x256695);if(_0x5a87b8[_0xd148('0x3f')][_0xd148('0x4a')]){_0x3f10f7[_0xd148('0x4b')]=_[_0xd148('0x4c')](_0x3f10f7['where'],{'$or':_[_0xd148('0x3e')](_0x256695,function(_0x4ddcbe){if(_0x4ddcbe[_0xd148('0x3c')]!=='VIRTUAL'){var _0x34bcc9={};_0x34bcc9[_0x4ddcbe[_0xd148('0x37')]]={'$like':'%'+_0x5a87b8[_0xd148('0x3f')]['filter']+'%'};return _0x34bcc9;}})});}_0x3f10f7=_['merge']({},_0x3f10f7,_0x5a87b8[_0xd148('0x4d')]);var _0x49335f={'where':_0x3f10f7[_0xd148('0x4b')]};return db[_0xd148('0x39')][_0xd148('0x2a')](_0x49335f)['then'](function(_0x3aafbc){_0x1ca721[_0xd148('0x2a')]=_0x3aafbc;if(_0x5a87b8['query']['includeAll']){_0x3f10f7[_0xd148('0x4e')]=[{'all':!![]}];}return db['VoiceContext'][_0xd148('0x4f')](_0x3f10f7);})['then'](function(_0x8b9fec){_0x1ca721['rows']=_0x8b9fec;return _0x1ca721;})['then'](respondWithFilteredResult(_0x5db5f1,_0x3f10f7))[_0xd148('0x50')](handleError(_0x5db5f1,null));};exports['show']=function(_0x1f59cc,_0x4feaab){var _0x25830c={'raw':![],'where':{'id':_0x1f59cc[_0xd148('0x51')]['id']}},_0x3f26ee={};_0x3f26ee[_0xd148('0x3d')]=_[_0xd148('0x40')](db[_0xd148('0x39')][_0xd148('0x3a')]);_0x3f26ee['query']=_[_0xd148('0x40')](_0x1f59cc['query']);_0x3f26ee[_0xd148('0x41')]=_[_0xd148('0x42')](_0x3f26ee['model'],_0x3f26ee[_0xd148('0x3f')]);_0x25830c['attributes']=_[_0xd148('0x42')](_0x3f26ee[_0xd148('0x3d')],qs[_0xd148('0x44')](_0x1f59cc[_0xd148('0x3f')][_0xd148('0x44')]));_0x25830c[_0xd148('0x43')]=_0x25830c[_0xd148('0x43')][_0xd148('0x45')]?_0x25830c['attributes']:_0x3f26ee[_0xd148('0x3d')];if(_0x1f59cc['query'][_0xd148('0x52')]){_0x25830c[_0xd148('0x4e')]=[{'all':!![]}];}_0x25830c=_[_0xd148('0x4c')]({},_0x25830c,_0x1f59cc[_0xd148('0x4d')]);return db[_0xd148('0x39')][_0xd148('0x53')](_0x25830c)[_0xd148('0x1c')](handleEntityNotFound(_0x4feaab,null))[_0xd148('0x1c')](respondWithResult(_0x4feaab,null))[_0xd148('0x50')](handleError(_0x4feaab,null));};exports['create']=function(_0x4e7edf,_0x3b321d,_0x45a5cb){var _0x197233;return db[_0xd148('0x39')][_0xd148('0x54')](_0x4e7edf[_0xd148('0x55')],{'raw':!![]})[_0xd148('0x1c')](function(_0x5ddcc8){_0x197233=_0x5ddcc8;return db['VoiceContext'][_0xd148('0x4f')]({'raw':!![]});})[_0xd148('0x1c')](function(_0xac869d){var _0x1724c7=fs[_0xd148('0x56')](path['join'](config['root'],_0xd148('0x57')),'utf8');var _0x1b26bb=ejs[_0xd148('0x58')](_0x1724c7,{'contexts':_0xac869d||[]});fs[_0xd148('0x59')](_0xd148('0x5a'),_0x1b26bb);})['then'](function(){return respondWithRpcPromise(_0xd148('0x5b'),'create',{'module':'chan_sip.so'});})[_0xd148('0x1c')](function(){var _0x1dcf3e=_0x4e7edf[_0xd148('0x5c')]['get']({'plain':!![]});if(!_0x1dcf3e)throw new Error(_0xd148('0x5d'));if(_0x1dcf3e[_0xd148('0x5e')]===_0xd148('0x5c')){var _0x3c0b34=_0x197233['get']({'plain':!![]});return db[_0xd148('0x5f')][_0xd148('0x53')]({'where':{'name':_0xd148('0x33'),'userProfileId':_0x1dcf3e[_0xd148('0x60')]},'raw':!![]})[_0xd148('0x1c')](function(_0x281f08){if(_0x281f08&&_0x281f08['autoAssociation']===0x0){return db[_0xd148('0x34')][_0xd148('0x54')]({'name':_0x3c0b34['name'],'resourceId':_0x3c0b34['id'],'type':_0x281f08['name'],'sectionId':_0x281f08['id']},{})['then'](function(){return _0x197233;});}else{return _0x197233;}})['catch'](function(_0x167102){logger[_0xd148('0x23')](_0xd148('0x61'),_0x167102);throw _0x167102;});}return _0x197233;})[_0xd148('0x1c')](respondWithResult(_0x3b321d,0xc9))[_0xd148('0x50')](handleError(_0x3b321d,null));};exports[_0xd148('0x31')]=function(_0x39d9eb,_0x2e78c7,_0x181a00){var _0x325ff1;return db['VoiceContext'][_0xd148('0x53')]({'where':{'id':_0x39d9eb[_0xd148('0x51')]['id']}})[_0xd148('0x1c')](handleEntityNotFound(_0x2e78c7,null))[_0xd148('0x1c')](saveUpdates(_0x39d9eb[_0xd148('0x55')],null))[_0xd148('0x1c')](function(_0x40c2df){if(_0x40c2df){_0x325ff1=_0x40c2df;return db[_0xd148('0x39')][_0xd148('0x4f')]({'raw':!![]});}})[_0xd148('0x1c')](function(_0x19d73b){var _0x16ecf1=fs[_0xd148('0x56')](path[_0xd148('0x62')](config[_0xd148('0x63')],_0xd148('0x57')),'utf8');var _0x1e0cea=ejs[_0xd148('0x58')](_0x16ecf1,{'contexts':_0x19d73b||[]});fs[_0xd148('0x59')](_0xd148('0x5a'),_0x1e0cea);})['then'](function(){return respondWithRpcPromise(_0xd148('0x5b'),_0xd148('0x31'),{'module':_0xd148('0x64')});})[_0xd148('0x1c')](function(){return _0x325ff1;})[_0xd148('0x1c')](respondWithResult(_0x2e78c7,null))['catch'](handleError(_0x2e78c7,null));};exports['destroy']=function(_0x1292a4,_0x4931e9,_0x512bf1){var _0x356f15;return db[_0xd148('0x39')][_0xd148('0x53')]({'where':{'id':_0x1292a4[_0xd148('0x51')]['id']}})['then'](handleEntityNotFound(_0x4931e9,null))[_0xd148('0x1c')](removeEntity(_0x4931e9,null))[_0xd148('0x1c')](function(){return db['VoiceContext'][_0xd148('0x4f')]({'raw':!![]});})[_0xd148('0x1c')](function(_0x3d9589){var _0x3fcabb=fs[_0xd148('0x56')](path[_0xd148('0x62')](config[_0xd148('0x63')],_0xd148('0x57')),_0xd148('0x65'));var _0x169315=ejs[_0xd148('0x58')](_0x3fcabb,{'contexts':_0x3d9589});fs[_0xd148('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x169315);return respondWithRpcPromise(_0xd148('0x5b'),'destroy',{'module':'chan_sip.so'});})[_0xd148('0x50')](handleError(_0x4931e9,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 53aafef..24f871c 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 _0x623a=['rimraf','../../config/environment','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xb55cf2,_0x1ae4e1){var _0x3ccb24=function(_0x5a7e1a){while(--_0x5a7e1a){_0xb55cf2['push'](_0xb55cf2['shift']());}};_0x3ccb24(++_0x1ae4e1);}(_0x623a,0xc0));var _0xa623=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x623a[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xa623('0x0'));var util=require('util');var logger=require(_0xa623('0x1'))(_0xa623('0x2'));var moment=require(_0xa623('0x3'));var BPromise=require(_0xa623('0x4'));var rp=require(_0xa623('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa623('0x6'));var config=require(_0xa623('0x7'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x45c69a,_0x25da8a){return _0x45c69a[_0xa623('0x8')](_0xa623('0x9'),attributes,{'tableName':_0xa623('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5d5=['define','VoiceContext','voice_contexts','lodash','util','../../config/logger','request-promise','path','../../config/environment','./voiceContext.attributes','exports'];(function(_0x2dfc67,_0x18ee18){var _0x1f223b=function(_0x486e67){while(--_0x486e67){_0x2dfc67['push'](_0x2dfc67['shift']());}};_0x1f223b(++_0x18ee18);}(_0xa5d5,0x18f));var _0x5a5d=function(_0x1b17f8,_0x2cdae9){_0x1b17f8=_0x1b17f8-0x0;var _0xb28150=_0xa5d5[_0x1b17f8];return _0xb28150;};'use strict';var _=require(_0x5a5d('0x0'));var util=require(_0x5a5d('0x1'));var logger=require(_0x5a5d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5a5d('0x3'));var fs=require('fs');var path=require(_0x5a5d('0x4'));var rimraf=require('rimraf');var config=require(_0x5a5d('0x5'));var attributes=require(_0x5a5d('0x6'));module[_0x5a5d('0x7')]=function(_0x3c99ba,_0x1694c7){return _0x3c99ba[_0x5a5d('0x8')](_0x5a5d('0x9'),attributes,{'tableName':_0x5a5d('0xa'),'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 17f9e64..009fbfc 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 _0x8f43=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x57c413,_0x37069e){var _0x24176e=function(_0x476717){while(--_0x476717){_0x57c413['push'](_0x57c413['shift']());}};_0x24176e(++_0x37069e);}(_0x8f43,0xd7));var _0x38f4=function(_0x961333,_0x4c183a){_0x961333=_0x961333-0x0;var _0x48d01d=_0x8f43[_0x961333];return _0x48d01d;};'use strict';var _=require(_0x38f4('0x0'));var util=require(_0x38f4('0x1'));var moment=require(_0x38f4('0x2'));var BPromise=require(_0x38f4('0x3'));var rs=require(_0x38f4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x38f4('0x5'))['db'];var utils=require(_0x38f4('0x6'));var logger=require(_0x38f4('0x7'))(_0x38f4('0x8'));var config=require(_0x38f4('0x9'));var jayson=require(_0x38f4('0xa'));var client=jayson['client'][_0x38f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d4292,_0x1b11fd,_0x3bab34){return new BPromise(function(_0x2d4e62,_0x32ee45){return client[_0x38f4('0xc')](_0x4d4292,_0x3bab34)['then'](function(_0x6f7cff){logger[_0x38f4('0xd')](_0x38f4('0xe'),_0x1b11fd,_0x38f4('0xf'));logger[_0x38f4('0x10')](_0x38f4('0x11'),_0x1b11fd,'request\x20sent',JSON[_0x38f4('0x12')](_0x6f7cff));if(_0x6f7cff[_0x38f4('0x13')]){if(_0x6f7cff[_0x38f4('0x13')][_0x38f4('0x14')]===0x1f4){logger[_0x38f4('0x13')](_0x38f4('0xe'),_0x1b11fd,_0x6f7cff['error']['message']);return _0x32ee45(_0x6f7cff[_0x38f4('0x13')]['message']);}logger['error'](_0x38f4('0xe'),_0x1b11fd,_0x6f7cff[_0x38f4('0x13')][_0x38f4('0x15')]);return _0x2d4e62(_0x6f7cff[_0x38f4('0x13')][_0x38f4('0x15')]);}else{logger[_0x38f4('0xd')](_0x38f4('0xe'),_0x1b11fd,'request\x20sent');_0x2d4e62(_0x6f7cff[_0x38f4('0x16')][_0x38f4('0x15')]);}})[_0x38f4('0x17')](function(_0x5b7540){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1b11fd,_0x5b7540);_0x32ee45(_0x5b7540);});});} \ No newline at end of file +var _0xe8dc=['moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','catch','lodash'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xe8dc,0x6b));var _0xce8d=function(_0x5cb139,_0x1a5f77){_0x5cb139=_0x5cb139-0x0;var _0x816e2b=_0xe8dc[_0x5cb139];return _0x816e2b;};'use strict';var _=require(_0xce8d('0x0'));var util=require('util');var moment=require(_0xce8d('0x1'));var BPromise=require('bluebird');var rs=require(_0xce8d('0x2'));var fs=require('fs');var Redis=require(_0xce8d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xce8d('0x4'));var logger=require('../../config/logger')(_0xce8d('0x5'));var config=require(_0xce8d('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xce8d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3db3c4,_0xb1dc9b,_0x1064c8){return new BPromise(function(_0x4ad00c,_0x11c40a){return client[_0xce8d('0x8')](_0x3db3c4,_0x1064c8)[_0xce8d('0x9')](function(_0x27274c){logger[_0xce8d('0xa')](_0xce8d('0xb'),_0xb1dc9b,'request\x20sent');logger['debug'](_0xce8d('0xc'),_0xb1dc9b,_0xce8d('0xd'),JSON['stringify'](_0x27274c));if(_0x27274c['error']){if(_0x27274c['error'][_0xce8d('0xe')]===0x1f4){logger['error'](_0xce8d('0xb'),_0xb1dc9b,_0x27274c[_0xce8d('0xf')][_0xce8d('0x10')]);return _0x11c40a(_0x27274c[_0xce8d('0xf')][_0xce8d('0x10')]);}logger['error'](_0xce8d('0xb'),_0xb1dc9b,_0x27274c[_0xce8d('0xf')][_0xce8d('0x10')]);return _0x4ad00c(_0x27274c[_0xce8d('0xf')][_0xce8d('0x10')]);}else{logger[_0xce8d('0xa')](_0xce8d('0xb'),_0xb1dc9b,_0xce8d('0xd'));_0x4ad00c(_0x27274c['result']['message']);}})[_0xce8d('0x11')](function(_0x28697b){logger[_0xce8d('0xf')](_0xce8d('0xb'),_0xb1dc9b,_0x28697b);_0x11c40a(_0x28697b);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 4662dcf..bcf8a87 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 _0x5db8=['describe','post','create','put','delete','/:id','destroy','multer','util','path','express','Router','fs-extra','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe'];(function(_0x2e9c28,_0x292ed7){var _0x1901f7=function(_0x3c6e41){while(--_0x3c6e41){_0x2e9c28['push'](_0x2e9c28['shift']());}};_0x1901f7(++_0x292ed7);}(_0x5db8,0xbb));var _0x85db=function(_0x20ae13,_0x2a0c8e){_0x20ae13=_0x20ae13-0x0;var _0x533fd5=_0x5db8[_0x20ae13];return _0x533fd5;};'use strict';var multer=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var path=require(_0x85db('0x2'));var timeout=require('connect-timeout');var express=require(_0x85db('0x3'));var router=express[_0x85db('0x4')]();var fs_extra=require(_0x85db('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x85db('0x6'));var controller=require(_0x85db('0x7'));router[_0x85db('0x8')]('/',auth[_0x85db('0x9')](),controller['index']);router['get'](_0x85db('0xa'),auth[_0x85db('0x9')](),controller[_0x85db('0xb')]);router[_0x85db('0x8')]('/:id',auth[_0x85db('0x9')](),controller['show']);router[_0x85db('0xc')]('/',auth[_0x85db('0x9')](),controller[_0x85db('0xd')]);router[_0x85db('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x85db('0xf')](_0x85db('0x10'),auth['isAuthenticated'](),controller[_0x85db('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb903=['../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','isAuthenticated','describe','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x116fe3,_0x284662){var _0x4895f5=function(_0x5e2017){while(--_0x5e2017){_0x116fe3['push'](_0x116fe3['shift']());}};_0x4895f5(++_0x284662);}(_0xb903,0x185));var _0x3b90=function(_0x520e83,_0x387b54){_0x520e83=_0x520e83-0x0;var _0x1cfe5c=_0xb903[_0x520e83];return _0x1cfe5c;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var fs_extra=require(_0x3b90('0x5'));var auth=require(_0x3b90('0x6'));var interaction=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var controller=require(_0x3b90('0x9'));router[_0x3b90('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router['get']('/describe',auth[_0x3b90('0xc')](),controller[_0x3b90('0xd')]);router[_0x3b90('0xa')](_0x3b90('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3b90('0xe'),auth[_0x3b90('0xc')](),controller['update']);router[_0x3b90('0xf')](_0x3b90('0xe'),auth['isAuthenticated'](),controller[_0x3b90('0x10')]);module[_0x3b90('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 78602eb..c783f95 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 _0x5ba4=['STRING','INTEGER','DATE','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5ba4,0x170));var _0x45ba=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x5ba4[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0x45ba('0x0'));module[_0x45ba('0x1')]={'privilege':{'type':Sequelize[_0x45ba('0x2')]},'channel':{'type':Sequelize[_0x45ba('0x2')]},'channelstate':{'type':Sequelize[_0x45ba('0x3')]},'channelstatedesc':{'type':Sequelize[_0x45ba('0x2')]},'calleridnum':{'type':Sequelize[_0x45ba('0x2')]},'calleridname':{'type':Sequelize[_0x45ba('0x2')]},'connectedlinenum':{'type':Sequelize[_0x45ba('0x2')]},'connectedlinename':{'type':Sequelize[_0x45ba('0x2')]},'language':{'type':Sequelize[_0x45ba('0x2')]},'accountcode':{'type':Sequelize[_0x45ba('0x2')]},'context':{'type':Sequelize[_0x45ba('0x2')]},'exten':{'type':Sequelize[_0x45ba('0x2')]},'priority':{'type':Sequelize[_0x45ba('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x45ba('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x45ba('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x45ba('0x2')]},'destcalleridnum':{'type':Sequelize[_0x45ba('0x2')]},'destcalleridname':{'type':Sequelize[_0x45ba('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x45ba('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x45ba('0x2')]},'destlanguage':{'type':Sequelize[_0x45ba('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x45ba('0x2')]},'destexten':{'type':Sequelize[_0x45ba('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x45ba('0x2')]},'destlinkedid':{'type':Sequelize[_0x45ba('0x2')]},'dialstring':{'type':Sequelize[_0x45ba('0x2')]},'dialstatus':{'type':Sequelize[_0x45ba('0x2')]},'starttime':{'type':Sequelize[_0x45ba('0x4')]},'answertime':{'type':Sequelize[_0x45ba('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x45ba('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x45ba('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x45ba('0x3')]},'billableseconds':{'type':Sequelize[_0x45ba('0x3')]}}; \ No newline at end of file +var _0xdf79=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x24cc72,_0x4dc73a){var _0xd49f1e=function(_0x39f581){while(--_0x39f581){_0x24cc72['push'](_0x24cc72['shift']());}};_0xd49f1e(++_0x4dc73a);}(_0xdf79,0x1c3));var _0x9df7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdf79[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x9df7('0x0'));module[_0x9df7('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9df7('0x2')]},'channelstate':{'type':Sequelize[_0x9df7('0x3')]},'channelstatedesc':{'type':Sequelize[_0x9df7('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9df7('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9df7('0x2')]},'language':{'type':Sequelize[_0x9df7('0x2')]},'accountcode':{'type':Sequelize[_0x9df7('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x9df7('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9df7('0x2')]},'destchannelstate':{'type':Sequelize[_0x9df7('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x9df7('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x9df7('0x2')]},'destlanguage':{'type':Sequelize[_0x9df7('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x9df7('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9df7('0x2')]},'dialstring':{'type':Sequelize[_0x9df7('0x2')]},'dialstatus':{'type':Sequelize[_0x9df7('0x2')]},'starttime':{'type':Sequelize[_0x9df7('0x4')]},'answertime':{'type':Sequelize[_0x9df7('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x9df7('0x2')],'comment':_0x9df7('0x5')},'routeId':{'type':Sequelize[_0x9df7('0x3')]},'duration':{'type':Sequelize[_0x9df7('0x3')]},'holdtime':{'type':Sequelize[_0x9df7('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index c448a03..33b5bff 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 _0xb903=['where','pick','merge','VIRTUAL','filter','options','VoiceDialReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','limit','status','set','apply','reject','save','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort'];(function(_0x4b7487,_0xecd238){var _0x429988=function(_0x3491ec){while(--_0x3491ec){_0x4b7487['push'](_0x4b7487['shift']());}};_0x429988(++_0xecd238);}(_0xb903,0x185));var _0x3b90=function(_0x38e135,_0x14499c){_0x38e135=_0x38e135-0x0;var _0x1736e1=_0xb903[_0x38e135];return _0x1736e1;};'use strict';var pdf=require(_0x3b90('0x0'));var emlformat=require(_0x3b90('0x1'));var rimraf=require(_0x3b90('0x2'));var zipdir=require(_0x3b90('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b90('0x4'));var moment=require(_0x3b90('0x5'));var BPromise=require(_0x3b90('0x6'));var Mustache=require(_0x3b90('0x7'));var util=require(_0x3b90('0x8'));var path=require(_0x3b90('0x9'));var sox=require(_0x3b90('0xa'));var csv=require('to-csv');var ejs=require(_0x3b90('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3b90('0xc'));var crypto=require(_0x3b90('0xd'));var jsforce=require(_0x3b90('0xe'));var deskjs=require(_0x3b90('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3b90('0x10'));var hardwareService=require(_0x3b90('0x11'));var logger=require('../../config/logger')(_0x3b90('0x12'));var utils=require(_0x3b90('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3b90('0x14'));var db=require(_0x3b90('0x15'))['db'];function respondWithStatusCode(_0x43c08c,_0x4badcb){_0x4badcb=_0x4badcb||0xcc;return function(_0x5447df){if(_0x5447df){return _0x43c08c[_0x3b90('0x16')](_0x4badcb);}return _0x43c08c['status'](_0x4badcb)['end']();};}function respondWithResult(_0x3a0a55,_0x2c72fb){_0x2c72fb=_0x2c72fb||0xc8;return function(_0x4824f9){if(_0x4824f9){return _0x3a0a55['status'](_0x2c72fb)[_0x3b90('0x17')](_0x4824f9);}};}function respondWithFilteredResult(_0x1b6349,_0x381a9e){return function(_0x1af265){if(_0x1af265){var _0x1efe01=_0x1af265[_0x3b90('0x18')],_0x529421=_0x381a9e['offset'],_0x494970=_0x381a9e[_0x3b90('0x19')]+_0x381a9e[_0x3b90('0x1a')],_0xd83280;if(_0x494970>=_0x1efe01){_0x494970=_0x1efe01;_0xd83280=0xc8;}else{_0xd83280=0xce;}_0x1b6349[_0x3b90('0x1b')](_0xd83280);return _0x1b6349[_0x3b90('0x1c')]('Content-Range',_0x529421+'-'+_0x494970+'/'+_0x1efe01)[_0x3b90('0x17')](_0x1af265);}return null;};}function patchUpdates(_0x5d140f){return function(_0xd8d873){try{jsonpatch[_0x3b90('0x1d')](_0xd8d873,_0x5d140f,!![]);}catch(_0x535894){return BPromise[_0x3b90('0x1e')](_0x535894);}return _0xd8d873[_0x3b90('0x1f')]();};}function saveUpdates(_0x3642c0,_0x3ce411){return function(_0xc74d57){if(_0xc74d57){return _0xc74d57[_0x3b90('0x20')](_0x3642c0)[_0x3b90('0x21')](function(_0x2f4270){return _0x2f4270;});}return null;};}function removeEntity(_0xa98414,_0x3e5bb8){return function(_0x4e2175){if(_0x4e2175){return _0x4e2175[_0x3b90('0x22')]()[_0x3b90('0x21')](function(){_0xa98414[_0x3b90('0x1b')](0xcc)[_0x3b90('0x23')]();});}};}function handleEntityNotFound(_0x1227ed,_0x93b8e7){return function(_0x58fa12){if(!_0x58fa12){_0x1227ed['sendStatus'](0x194);}return _0x58fa12;};}function handleError(_0x40955a,_0x29d472){_0x29d472=_0x29d472||0x1f4;return function(_0x103324){logger[_0x3b90('0x24')](_0x103324['stack']);if(_0x103324[_0x3b90('0x25')]){delete _0x103324[_0x3b90('0x25')];}_0x40955a[_0x3b90('0x1b')](_0x29d472)['send'](_0x103324);};}exports[_0x3b90('0x26')]=function(_0x138d79,_0x17ec7f){var _0x33c07a={},_0x153d7c={},_0x7adf75={'count':0x0,'rows':[]};var _0x4b4d33=_[_0x3b90('0x27')](db['VoiceDialReport'][_0x3b90('0x28')],function(_0x9891e4){return{'name':_0x9891e4[_0x3b90('0x29')],'type':_0x9891e4[_0x3b90('0x2a')][_0x3b90('0x2b')]};});_0x153d7c[_0x3b90('0x2c')]=_[_0x3b90('0x27')](_0x4b4d33,_0x3b90('0x25'));_0x153d7c['query']=_['keys'](_0x138d79[_0x3b90('0x2d')]);_0x153d7c[_0x3b90('0x2e')]=_[_0x3b90('0x2f')](_0x153d7c[_0x3b90('0x2c')],_0x153d7c['query']);_0x33c07a['attributes']=_[_0x3b90('0x2f')](_0x153d7c[_0x3b90('0x2c')],qs[_0x3b90('0x30')](_0x138d79['query'][_0x3b90('0x30')]));_0x33c07a['attributes']=_0x33c07a['attributes'][_0x3b90('0x31')]?_0x33c07a[_0x3b90('0x32')]:_0x153d7c['model'];if(!_0x138d79[_0x3b90('0x2d')][_0x3b90('0x33')](_0x3b90('0x34'))){_0x33c07a['limit']=qs['limit'](_0x138d79[_0x3b90('0x2d')][_0x3b90('0x1a')]);_0x33c07a[_0x3b90('0x19')]=qs[_0x3b90('0x19')](_0x138d79['query']['offset']);}_0x33c07a[_0x3b90('0x35')]=qs[_0x3b90('0x36')](_0x138d79['query']['sort']);_0x33c07a[_0x3b90('0x37')]=qs[_0x3b90('0x2e')](_[_0x3b90('0x38')](_0x138d79[_0x3b90('0x2d')],_0x153d7c['filters']),_0x4b4d33);if(_0x138d79[_0x3b90('0x2d')]['filter']){_0x33c07a[_0x3b90('0x37')]=_[_0x3b90('0x39')](_0x33c07a[_0x3b90('0x37')],{'$or':_[_0x3b90('0x27')](_0x4b4d33,function(_0x2cbae8){if(_0x2cbae8[_0x3b90('0x2a')]!==_0x3b90('0x3a')){var _0x534bea={};_0x534bea[_0x2cbae8[_0x3b90('0x25')]]={'$like':'%'+_0x138d79[_0x3b90('0x2d')][_0x3b90('0x3b')]+'%'};return _0x534bea;}})});}_0x33c07a=_[_0x3b90('0x39')]({},_0x33c07a,_0x138d79[_0x3b90('0x3c')]);var _0x390952={'where':_0x33c07a[_0x3b90('0x37')]};return db[_0x3b90('0x3d')][_0x3b90('0x18')](_0x390952)['then'](function(_0x369d0d){_0x7adf75[_0x3b90('0x18')]=_0x369d0d;if(_0x138d79[_0x3b90('0x2d')][_0x3b90('0x3e')]){_0x33c07a[_0x3b90('0x3f')]=[{'all':!![]}];}return db[_0x3b90('0x3d')][_0x3b90('0x40')](_0x33c07a);})[_0x3b90('0x21')](function(_0x30ff62){_0x7adf75[_0x3b90('0x41')]=_0x30ff62;return _0x7adf75;})[_0x3b90('0x21')](respondWithFilteredResult(_0x17ec7f,_0x33c07a))[_0x3b90('0x42')](handleError(_0x17ec7f,null));};exports[_0x3b90('0x43')]=function(_0x11285e,_0x3f3e6b){var _0x3d2680={'raw':!![],'where':{'id':_0x11285e[_0x3b90('0x44')]['id']}},_0x3a27cf={};_0x3a27cf[_0x3b90('0x2c')]=_[_0x3b90('0x45')](db[_0x3b90('0x3d')]['rawAttributes']);_0x3a27cf[_0x3b90('0x2d')]=_[_0x3b90('0x45')](_0x11285e[_0x3b90('0x2d')]);_0x3a27cf[_0x3b90('0x2e')]=_['intersection'](_0x3a27cf[_0x3b90('0x2c')],_0x3a27cf['query']);_0x3d2680['attributes']=_[_0x3b90('0x2f')](_0x3a27cf[_0x3b90('0x2c')],qs['fields'](_0x11285e[_0x3b90('0x2d')][_0x3b90('0x30')]));_0x3d2680[_0x3b90('0x32')]=_0x3d2680[_0x3b90('0x32')][_0x3b90('0x31')]?_0x3d2680[_0x3b90('0x32')]:_0x3a27cf[_0x3b90('0x2c')];if(_0x11285e[_0x3b90('0x2d')][_0x3b90('0x3e')]){_0x3d2680['include']=[{'all':!![]}];}_0x3d2680=_[_0x3b90('0x39')]({},_0x3d2680,_0x11285e[_0x3b90('0x3c')]);return db['VoiceDialReport'][_0x3b90('0x46')](_0x3d2680)[_0x3b90('0x21')](handleEntityNotFound(_0x3f3e6b,null))[_0x3b90('0x21')](respondWithResult(_0x3f3e6b,null))[_0x3b90('0x42')](handleError(_0x3f3e6b,null));};exports[_0x3b90('0x47')]=function(_0x4908ea,_0x5a0d4e){return db[_0x3b90('0x3d')]['create'](_0x4908ea[_0x3b90('0x48')],{})[_0x3b90('0x21')](respondWithResult(_0x5a0d4e,0xc9))[_0x3b90('0x42')](handleError(_0x5a0d4e,null));};exports[_0x3b90('0x20')]=function(_0x177234,_0x4b1634){if(_0x177234['body']['id']){delete _0x177234[_0x3b90('0x48')]['id'];}return db[_0x3b90('0x3d')][_0x3b90('0x46')]({'where':{'id':_0x177234['params']['id']}})[_0x3b90('0x21')](handleEntityNotFound(_0x4b1634,null))[_0x3b90('0x21')](saveUpdates(_0x177234[_0x3b90('0x48')],null))[_0x3b90('0x21')](respondWithResult(_0x4b1634,null))[_0x3b90('0x42')](handleError(_0x4b1634,null));};exports[_0x3b90('0x22')]=function(_0x44b01b,_0x13b364){return db[_0x3b90('0x3d')]['find']({'where':{'id':_0x44b01b[_0x3b90('0x44')]['id']}})[_0x3b90('0x21')](handleEntityNotFound(_0x13b364,null))[_0x3b90('0x21')](removeEntity(_0x13b364,null))['catch'](handleError(_0x13b364,null));};exports[_0x3b90('0x49')]=function(_0x4e9e75,_0x288fbb){return db[_0x3b90('0x3d')][_0x3b90('0x49')]()['then'](respondWithResult(_0x288fbb,null))[_0x3b90('0x42')](handleError(_0x288fbb,null));}; \ No newline at end of file +var _0xb332=['describe','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','VIRTUAL','merge','options','count','include','catch','params','length','includeAll','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb332,0xd9));var _0x2b33=function(_0x24cc72,_0x4dc73a){_0x24cc72=_0x24cc72-0x0;var _0xd49f1e=_0xb332[_0x24cc72];return _0xd49f1e;};'use strict';var pdf=require(_0x2b33('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2b33('0x1'));var zipdir=require(_0x2b33('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b33('0x3'));var moment=require('moment');var BPromise=require(_0x2b33('0x4'));var Mustache=require('mustache');var util=require(_0x2b33('0x5'));var path=require('path');var sox=require(_0x2b33('0x6'));var csv=require(_0x2b33('0x7'));var ejs=require(_0x2b33('0x8'));var fs=require('fs');var fs_extra=require(_0x2b33('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b33('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2b33('0xb'));var toCsv=require(_0x2b33('0x7'));var querystring=require(_0x2b33('0xc'));var Papa=require(_0x2b33('0xd'));var Redis=require('ioredis');var authService=require(_0x2b33('0xe'));var qs=require(_0x2b33('0xf'));var as=require(_0x2b33('0x10'));var hardwareService=require(_0x2b33('0x11'));var logger=require(_0x2b33('0x12'))(_0x2b33('0x13'));var utils=require(_0x2b33('0x14'));var config=require(_0x2b33('0x15'));var licenseUtil=require(_0x2b33('0x16'));var db=require(_0x2b33('0x17'))['db'];function respondWithStatusCode(_0xca2248,_0x4df129){_0x4df129=_0x4df129||0xcc;return function(_0x183773){if(_0x183773){return _0xca2248[_0x2b33('0x18')](_0x4df129);}return _0xca2248[_0x2b33('0x19')](_0x4df129)['end']();};}function respondWithResult(_0x173c75,_0x4d39db){_0x4d39db=_0x4d39db||0xc8;return function(_0x3fcf4e){if(_0x3fcf4e){return _0x173c75[_0x2b33('0x19')](_0x4d39db)[_0x2b33('0x1a')](_0x3fcf4e);}};}function respondWithFilteredResult(_0x57aea7,_0x52693f){return function(_0x1d8e75){if(_0x1d8e75){var _0x1d50d0=_0x1d8e75['count'],_0x409428=_0x52693f['offset'],_0x2f5119=_0x52693f['offset']+_0x52693f[_0x2b33('0x1b')],_0xf8af33;if(_0x2f5119>=_0x1d50d0){_0x2f5119=_0x1d50d0;_0xf8af33=0xc8;}else{_0xf8af33=0xce;}_0x57aea7['status'](_0xf8af33);return _0x57aea7['set'](_0x2b33('0x1c'),_0x409428+'-'+_0x2f5119+'/'+_0x1d50d0)[_0x2b33('0x1a')](_0x1d8e75);}return null;};}function patchUpdates(_0x205d8f){return function(_0x539c5f){try{jsonpatch[_0x2b33('0x1d')](_0x539c5f,_0x205d8f,!![]);}catch(_0x5e1795){return BPromise[_0x2b33('0x1e')](_0x5e1795);}return _0x539c5f[_0x2b33('0x1f')]();};}function saveUpdates(_0x8c8dc2,_0x2998dd){return function(_0x233ba6){if(_0x233ba6){return _0x233ba6[_0x2b33('0x20')](_0x8c8dc2)[_0x2b33('0x21')](function(_0x4fb725){return _0x4fb725;});}return null;};}function removeEntity(_0x23024c,_0x1d9c98){return function(_0x100c8d){if(_0x100c8d){return _0x100c8d[_0x2b33('0x22')]()[_0x2b33('0x21')](function(){_0x23024c[_0x2b33('0x19')](0xcc)[_0x2b33('0x23')]();});}};}function handleEntityNotFound(_0x2605e6,_0x5e1cba){return function(_0x2b857f){if(!_0x2b857f){_0x2605e6[_0x2b33('0x18')](0x194);}return _0x2b857f;};}function handleError(_0xc1b91d,_0x32b835){_0x32b835=_0x32b835||0x1f4;return function(_0x4df3d4){logger[_0x2b33('0x24')](_0x4df3d4['stack']);if(_0x4df3d4[_0x2b33('0x25')]){delete _0x4df3d4['name'];}_0xc1b91d[_0x2b33('0x19')](_0x32b835)[_0x2b33('0x26')](_0x4df3d4);};}exports['index']=function(_0x195aa2,_0x53c2ad){var _0x267969={},_0x5b16a8={},_0x315ebd={'count':0x0,'rows':[]};var _0xa109f4=_[_0x2b33('0x27')](db[_0x2b33('0x28')][_0x2b33('0x29')],function(_0x312d4d){return{'name':_0x312d4d[_0x2b33('0x2a')],'type':_0x312d4d[_0x2b33('0x2b')][_0x2b33('0x2c')]};});_0x5b16a8[_0x2b33('0x2d')]=_['map'](_0xa109f4,'name');_0x5b16a8[_0x2b33('0x2e')]=_[_0x2b33('0x2f')](_0x195aa2[_0x2b33('0x2e')]);_0x5b16a8[_0x2b33('0x30')]=_[_0x2b33('0x31')](_0x5b16a8['model'],_0x5b16a8['query']);_0x267969[_0x2b33('0x32')]=_[_0x2b33('0x31')](_0x5b16a8[_0x2b33('0x2d')],qs[_0x2b33('0x33')](_0x195aa2[_0x2b33('0x2e')][_0x2b33('0x33')]));_0x267969['attributes']=_0x267969[_0x2b33('0x32')]['length']?_0x267969[_0x2b33('0x32')]:_0x5b16a8[_0x2b33('0x2d')];if(!_0x195aa2[_0x2b33('0x2e')][_0x2b33('0x34')](_0x2b33('0x35'))){_0x267969[_0x2b33('0x1b')]=qs[_0x2b33('0x1b')](_0x195aa2[_0x2b33('0x2e')][_0x2b33('0x1b')]);_0x267969[_0x2b33('0x36')]=qs[_0x2b33('0x36')](_0x195aa2[_0x2b33('0x2e')][_0x2b33('0x36')]);}_0x267969[_0x2b33('0x37')]=qs[_0x2b33('0x38')](_0x195aa2[_0x2b33('0x2e')]['sort']);_0x267969['where']=qs['filters'](_[_0x2b33('0x39')](_0x195aa2[_0x2b33('0x2e')],_0x5b16a8[_0x2b33('0x30')]),_0xa109f4);if(_0x195aa2[_0x2b33('0x2e')][_0x2b33('0x3a')]){_0x267969['where']=_['merge'](_0x267969[_0x2b33('0x3b')],{'$or':_['map'](_0xa109f4,function(_0x44aea1){if(_0x44aea1[_0x2b33('0x2b')]!==_0x2b33('0x3c')){var _0xa638d6={};_0xa638d6[_0x44aea1[_0x2b33('0x25')]]={'$like':'%'+_0x195aa2[_0x2b33('0x2e')][_0x2b33('0x3a')]+'%'};return _0xa638d6;}})});}_0x267969=_[_0x2b33('0x3d')]({},_0x267969,_0x195aa2[_0x2b33('0x3e')]);var _0x17bd1e={'where':_0x267969['where']};return db[_0x2b33('0x28')][_0x2b33('0x3f')](_0x17bd1e)[_0x2b33('0x21')](function(_0x5b7c32){_0x315ebd['count']=_0x5b7c32;if(_0x195aa2[_0x2b33('0x2e')]['includeAll']){_0x267969[_0x2b33('0x40')]=[{'all':!![]}];}return db[_0x2b33('0x28')]['findAll'](_0x267969);})[_0x2b33('0x21')](function(_0x13874a){_0x315ebd['rows']=_0x13874a;return _0x315ebd;})[_0x2b33('0x21')](respondWithFilteredResult(_0x53c2ad,_0x267969))[_0x2b33('0x41')](handleError(_0x53c2ad,null));};exports['show']=function(_0x2168b6,_0x1c7cb2){var _0x264e64={'raw':!![],'where':{'id':_0x2168b6[_0x2b33('0x42')]['id']}},_0x49348c={};_0x49348c[_0x2b33('0x2d')]=_[_0x2b33('0x2f')](db[_0x2b33('0x28')][_0x2b33('0x29')]);_0x49348c['query']=_[_0x2b33('0x2f')](_0x2168b6[_0x2b33('0x2e')]);_0x49348c[_0x2b33('0x30')]=_['intersection'](_0x49348c[_0x2b33('0x2d')],_0x49348c[_0x2b33('0x2e')]);_0x264e64[_0x2b33('0x32')]=_[_0x2b33('0x31')](_0x49348c['model'],qs[_0x2b33('0x33')](_0x2168b6[_0x2b33('0x2e')]['fields']));_0x264e64['attributes']=_0x264e64['attributes'][_0x2b33('0x43')]?_0x264e64['attributes']:_0x49348c[_0x2b33('0x2d')];if(_0x2168b6[_0x2b33('0x2e')][_0x2b33('0x44')]){_0x264e64[_0x2b33('0x40')]=[{'all':!![]}];}_0x264e64=_[_0x2b33('0x3d')]({},_0x264e64,_0x2168b6[_0x2b33('0x3e')]);return db[_0x2b33('0x28')][_0x2b33('0x45')](_0x264e64)['then'](handleEntityNotFound(_0x1c7cb2,null))[_0x2b33('0x21')](respondWithResult(_0x1c7cb2,null))[_0x2b33('0x41')](handleError(_0x1c7cb2,null));};exports[_0x2b33('0x46')]=function(_0x83de95,_0x41c3c1){return db[_0x2b33('0x28')]['create'](_0x83de95['body'],{})['then'](respondWithResult(_0x41c3c1,0xc9))['catch'](handleError(_0x41c3c1,null));};exports[_0x2b33('0x20')]=function(_0x5cdf5d,_0x1c5019){if(_0x5cdf5d['body']['id']){delete _0x5cdf5d['body']['id'];}return db[_0x2b33('0x28')][_0x2b33('0x45')]({'where':{'id':_0x5cdf5d[_0x2b33('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c5019,null))[_0x2b33('0x21')](saveUpdates(_0x5cdf5d['body'],null))[_0x2b33('0x21')](respondWithResult(_0x1c5019,null))[_0x2b33('0x41')](handleError(_0x1c5019,null));};exports[_0x2b33('0x22')]=function(_0x75833f,_0x144435){return db[_0x2b33('0x28')]['find']({'where':{'id':_0x75833f[_0x2b33('0x42')]['id']}})[_0x2b33('0x21')](handleEntityNotFound(_0x144435,null))[_0x2b33('0x21')](removeEntity(_0x144435,null))['catch'](handleError(_0x144435,null));};exports[_0x2b33('0x47')]=function(_0x2084a4,_0x434f0f){return db['VoiceDialReport'][_0x2b33('0x47')]()['then'](respondWithResult(_0x434f0f,null))['catch'](handleError(_0x434f0f,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 9b8d3d1..a050e36 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 _0x56b1=['path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4f4f75,_0x474840){var _0x35e7c5=function(_0x50db75){while(--_0x50db75){_0x4f4f75['push'](_0x4f4f75['shift']());}};_0x35e7c5(++_0x474840);}(_0x56b1,0x1e9));var _0x156b=function(_0xb693ae,_0x56c9fd){_0xb693ae=_0xb693ae-0x0;var _0x4fc992=_0x56b1[_0xb693ae];return _0x4fc992;};'use strict';var _=require(_0x156b('0x0'));var util=require(_0x156b('0x1'));var logger=require(_0x156b('0x2'))(_0x156b('0x3'));var moment=require(_0x156b('0x4'));var BPromise=require(_0x156b('0x5'));var rp=require(_0x156b('0x6'));var fs=require('fs');var path=require(_0x156b('0x7'));var rimraf=require(_0x156b('0x8'));var config=require(_0x156b('0x9'));var attributes=require(_0x156b('0xa'));module[_0x156b('0xb')]=function(_0x512e15,_0x30bfe0){return _0x512e15[_0x156b('0xc')](_0x156b('0xd'),attributes,{'tableName':_0x156b('0xe'),'paranoid':![],'indexes':[{'fields':[_0x156b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3485=['../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x21c181,_0x4dae7b){var _0x101c2b=function(_0x326c44){while(--_0x326c44){_0x21c181['push'](_0x21c181['shift']());}};_0x101c2b(++_0x4dae7b);}(_0x3485,0x89));var _0x5348=function(_0x4bffd4,_0x28b704){_0x4bffd4=_0x4bffd4-0x0;var _0x4b7253=_0x3485[_0x4bffd4];return _0x4b7253;};'use strict';var _=require(_0x5348('0x0'));var util=require(_0x5348('0x1'));var logger=require(_0x5348('0x2'))(_0x5348('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5348('0x4'));var fs=require('fs');var path=require(_0x5348('0x5'));var rimraf=require('rimraf');var config=require(_0x5348('0x6'));var attributes=require(_0x5348('0x7'));module[_0x5348('0x8')]=function(_0x529805,_0x384390){return _0x529805[_0x5348('0x9')](_0x5348('0xa'),attributes,{'tableName':_0x5348('0xb'),'paranoid':![],'indexes':[{'fields':[_0x5348('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 2fe3de3..61e0f37 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 _0x70a1=['VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','attributes','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x1b8982,_0x3ba392){var _0x575d69=function(_0x25db3d){while(--_0x25db3d){_0x1b8982['push'](_0x1b8982['shift']());}};_0x575d69(++_0x3ba392);}(_0x70a1,0x13a));var _0x170a=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x70a1[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x170a('0x0'));var util=require(_0x170a('0x1'));var moment=require('moment');var BPromise=require(_0x170a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x170a('0x3'));var db=require(_0x170a('0x4'))['db'];var utils=require(_0x170a('0x5'));var logger=require(_0x170a('0x6'))(_0x170a('0x7'));var config=require(_0x170a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x170a('0x9')][_0x170a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27b634,_0x313a54,_0x498ad6){return new BPromise(function(_0x357204,_0x1e679c){return client[_0x170a('0xb')](_0x27b634,_0x498ad6)[_0x170a('0xc')](function(_0x292520){logger[_0x170a('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x313a54,_0x170a('0xe'));logger[_0x170a('0xf')](_0x170a('0x10'),_0x313a54,_0x170a('0xe'),JSON[_0x170a('0x11')](_0x292520));if(_0x292520[_0x170a('0x12')]){if(_0x292520[_0x170a('0x12')][_0x170a('0x13')]===0x1f4){logger[_0x170a('0x12')](_0x170a('0x14'),_0x313a54,_0x292520['error'][_0x170a('0x15')]);return _0x1e679c(_0x292520[_0x170a('0x12')][_0x170a('0x15')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x313a54,_0x292520[_0x170a('0x12')][_0x170a('0x15')]);return _0x357204(_0x292520['error'][_0x170a('0x15')]);}else{logger[_0x170a('0xd')](_0x170a('0x14'),_0x313a54,_0x170a('0xe'));_0x357204(_0x292520['result'][_0x170a('0x15')]);}})[_0x170a('0x16')](function(_0x486089){logger[_0x170a('0x12')](_0x170a('0x14'),_0x313a54,_0x486089);_0x1e679c(_0x486089);});});}exports[_0x170a('0x17')]=function(_0x477f98){var _0x576be2=this;return new Promise(function(_0xa09dbc,_0x36db2e){return db[_0x170a('0x18')][_0x170a('0x19')](_0x477f98[_0x170a('0x1a')],{'raw':_0x477f98['options']?_0x477f98[_0x170a('0x1b')][_0x170a('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0xb5b97e){logger[_0x170a('0xd')](_0x170a('0x17'),_0x477f98);logger[_0x170a('0xf')](_0x170a('0x17'),_0x477f98,JSON[_0x170a('0x11')](_0xb5b97e));_0xa09dbc(_0xb5b97e);})['catch'](function(_0x2a35ef){logger[_0x170a('0x12')](_0x170a('0x17'),_0x2a35ef[_0x170a('0x15')],_0x477f98);_0x36db2e(_0x576be2[_0x170a('0x12')](0x1f4,_0x2a35ef['message']));});});};exports[_0x170a('0x1d')]=function(_0x4560da){var _0x28aade=this;return new Promise(function(_0x4325b4,_0x1b7c1e){return db['VoiceDialReport'][_0x170a('0x1e')](_0x4560da['body'],{'raw':_0x4560da['options']?_0x4560da[_0x170a('0x1b')][_0x170a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4560da[_0x170a('0x1b')]?_0x4560da[_0x170a('0x1b')][_0x170a('0x1f')]||null:null,'attributes':_0x4560da[_0x170a('0x1b')]?_0x4560da[_0x170a('0x1b')][_0x170a('0x20')]||null:null,'limit':_0x4560da['options']?_0x4560da[_0x170a('0x1b')]['limit']||null:null})[_0x170a('0xc')](function(_0x3ae042){logger['info']('UpdateVoiceDialReport',_0x4560da);logger[_0x170a('0xf')](_0x170a('0x1d'),_0x4560da,JSON[_0x170a('0x11')](_0x3ae042));_0x4325b4(_0x3ae042);})[_0x170a('0x16')](function(_0x2e6cd5){logger[_0x170a('0x12')](_0x170a('0x1d'),_0x2e6cd5[_0x170a('0x15')],_0x4560da);_0x1b7c1e(_0x28aade['error'](0x1f4,_0x2e6cd5['message']));});});}; \ No newline at end of file +var _0xfd87=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','catch','UpdateVoiceDialReport','where','attributes','limit','debug','lodash'];(function(_0x92aaa3,_0x4f0e12){var _0x5852b1=function(_0x2160c3){while(--_0x2160c3){_0x92aaa3['push'](_0x92aaa3['shift']());}};_0x5852b1(++_0x4f0e12);}(_0xfd87,0xe6));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7fd8('0x0'));var util=require(_0x7fd8('0x1'));var moment=require('moment');var BPromise=require(_0x7fd8('0x2'));var rs=require(_0x7fd8('0x3'));var fs=require('fs');var Redis=require(_0x7fd8('0x4'));var db=require(_0x7fd8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fd8('0x6'))(_0x7fd8('0x7'));var config=require('../../config/environment');var jayson=require(_0x7fd8('0x8'));var client=jayson[_0x7fd8('0x9')][_0x7fd8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4745a7,_0x597c36,_0x1644fb){return new BPromise(function(_0x38fd8b,_0x3fbd9a){return client[_0x7fd8('0xb')](_0x4745a7,_0x1644fb)[_0x7fd8('0xc')](function(_0x15790c){logger[_0x7fd8('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x597c36,_0x7fd8('0xe'));logger['debug'](_0x7fd8('0xf'),_0x597c36,'request\x20sent',JSON[_0x7fd8('0x10')](_0x15790c));if(_0x15790c[_0x7fd8('0x11')]){if(_0x15790c[_0x7fd8('0x11')][_0x7fd8('0x12')]===0x1f4){logger['error'](_0x7fd8('0x13'),_0x597c36,_0x15790c[_0x7fd8('0x11')][_0x7fd8('0x14')]);return _0x3fbd9a(_0x15790c['error'][_0x7fd8('0x14')]);}logger[_0x7fd8('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x597c36,_0x15790c[_0x7fd8('0x11')][_0x7fd8('0x14')]);return _0x38fd8b(_0x15790c[_0x7fd8('0x11')][_0x7fd8('0x14')]);}else{logger[_0x7fd8('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x597c36,_0x7fd8('0xe'));_0x38fd8b(_0x15790c['result'][_0x7fd8('0x14')]);}})['catch'](function(_0x15161e){logger[_0x7fd8('0x11')](_0x7fd8('0x13'),_0x597c36,_0x15161e);_0x3fbd9a(_0x15161e);});});}exports['CreateVoiceDialReport']=function(_0x21be57){var _0x5573f2=this;return new Promise(function(_0x53073e,_0xe91594){return db[_0x7fd8('0x15')][_0x7fd8('0x16')](_0x21be57[_0x7fd8('0x17')],{'raw':_0x21be57[_0x7fd8('0x18')]?_0x21be57[_0x7fd8('0x18')][_0x7fd8('0x19')]===undefined?!![]:![]:!![]})[_0x7fd8('0xc')](function(_0x396e32){logger[_0x7fd8('0xd')](_0x7fd8('0x1a'),_0x21be57);logger['debug'](_0x7fd8('0x1a'),_0x21be57,JSON[_0x7fd8('0x10')](_0x396e32));_0x53073e(_0x396e32);})[_0x7fd8('0x1b')](function(_0x5bbc9f){logger[_0x7fd8('0x11')]('CreateVoiceDialReport',_0x5bbc9f[_0x7fd8('0x14')],_0x21be57);_0xe91594(_0x5573f2['error'](0x1f4,_0x5bbc9f['message']));});});};exports[_0x7fd8('0x1c')]=function(_0x3b38b0){var _0x363193=this;return new Promise(function(_0x3c89ef,_0x296233){return db[_0x7fd8('0x15')]['update'](_0x3b38b0['body'],{'raw':_0x3b38b0[_0x7fd8('0x18')]?_0x3b38b0['options'][_0x7fd8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b38b0[_0x7fd8('0x18')]?_0x3b38b0[_0x7fd8('0x18')][_0x7fd8('0x1d')]||null:null,'attributes':_0x3b38b0['options']?_0x3b38b0[_0x7fd8('0x18')][_0x7fd8('0x1e')]||null:null,'limit':_0x3b38b0[_0x7fd8('0x18')]?_0x3b38b0[_0x7fd8('0x18')][_0x7fd8('0x1f')]||null:null})[_0x7fd8('0xc')](function(_0x17a493){logger[_0x7fd8('0xd')](_0x7fd8('0x1c'),_0x3b38b0);logger[_0x7fd8('0x20')](_0x7fd8('0x1c'),_0x3b38b0,JSON[_0x7fd8('0x10')](_0x17a493));_0x3c89ef(_0x17a493);})[_0x7fd8('0x1b')](function(_0x38f4f7){logger[_0x7fd8('0x11')](_0x7fd8('0x1c'),_0x38f4f7[_0x7fd8('0x14')],_0x3b38b0);_0x296233(_0x363193[_0x7fd8('0x11')](0x1f4,_0x38f4f7[_0x7fd8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f8cb863..d5f1d2d 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 _0xee19=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','exports','path'];(function(_0x4958a0,_0x4a81d4){var _0x1ce89e=function(_0x8f5f00){while(--_0x8f5f00){_0x4958a0['push'](_0x4958a0['shift']());}};_0x1ce89e(++_0x4a81d4);}(_0xee19,0x1da));var _0x9ee1=function(_0x5e9a0e,_0x192bf9){_0x5e9a0e=_0x5e9a0e-0x0;var _0x38fa94=_0xee19[_0x5e9a0e];return _0x38fa94;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9ee1('0x0'));var timeout=require(_0x9ee1('0x1'));var express=require('express');var router=express[_0x9ee1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9ee1('0x3'));var interaction=require(_0x9ee1('0x4'));var config=require('../../config/environment');var controller=require(_0x9ee1('0x5'));router[_0x9ee1('0x6')]('/',auth[_0x9ee1('0x7')](),controller[_0x9ee1('0x8')]);router[_0x9ee1('0x6')](_0x9ee1('0x9'),auth[_0x9ee1('0x7')](),controller[_0x9ee1('0xa')]);router[_0x9ee1('0xb')]('/',auth['isAuthenticated'](),controller[_0x9ee1('0xc')]);router['post'](_0x9ee1('0xd'),auth[_0x9ee1('0x7')](),controller[_0x9ee1('0xe')]);router[_0x9ee1('0xf')]('/:id',auth[_0x9ee1('0x7')](),controller['update']);router[_0x9ee1('0x10')](_0x9ee1('0x9'),auth['isAuthenticated'](),controller[_0x9ee1('0x11')]);module[_0x9ee1('0x12')]=router; \ No newline at end of file +var _0x601d=['addApplications','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','post','create','/:id/applications'];(function(_0x1510b8,_0x3d8e40){var _0x582606=function(_0x51f071){while(--_0x51f071){_0x1510b8['push'](_0x1510b8['shift']());}};_0x582606(++_0x3d8e40);}(_0x601d,0x83));var _0xd601=function(_0x19aafe,_0x29ba12){_0x19aafe=_0x19aafe-0x0;var _0x3bc718=_0x601d[_0x19aafe];return _0x3bc718;};'use strict';var multer=require(_0xd601('0x0'));var util=require('util');var path=require(_0xd601('0x1'));var timeout=require(_0xd601('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd601('0x3'));var auth=require(_0xd601('0x4'));var interaction=require(_0xd601('0x5'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router['get']('/',auth[_0xd601('0x6')](),controller[_0xd601('0x7')]);router[_0xd601('0x8')](_0xd601('0x9'),auth[_0xd601('0x6')](),controller['show']);router[_0xd601('0xa')]('/',auth[_0xd601('0x6')](),controller[_0xd601('0xb')]);router[_0xd601('0xa')](_0xd601('0xc'),auth[_0xd601('0x6')](),controller[_0xd601('0xd')]);router['put'](_0xd601('0x9'),auth['isAuthenticated'](),controller[_0xd601('0xe')]);router[_0xd601('0xf')](_0xd601('0x9'),auth['isAuthenticated'](),controller[_0xd601('0x10')]);module[_0xd601('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 14a9a87..95409c0 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 _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x146958,_0x572fc9){var _0x253f9d=function(_0x21390d){while(--_0x21390d){_0x146958['push'](_0x146958['shift']());}};_0x253f9d(++_0x572fc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x36cb22,_0x340b23){var _0x5f8af7=function(_0x5d395f){while(--_0x5d395f){_0x36cb22['push'](_0x36cb22['shift']());}};_0x5f8af7(++_0x340b23);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 35c9c5d..cbeca91 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 _0x2675=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','mandatoryDisposition','addApplications','findOne','sequelize','transaction','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','destroy','then','get','OutboundRoutes','outbound','internal','ignore','map','value','includes','find','type','error','stack','name','send','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','VoiceExtension','count','include','findAll','show','params','includeAll','catch','create','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','inbound','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x45dee3,_0x5c4075){var _0x2d7c27=function(_0x38fd86){while(--_0x38fd86){_0x45dee3['push'](_0x45dee3['shift']());}};_0x2d7c27(++_0x5c4075);}(_0x2675,0x75));var _0x5267=function(_0x2fedf5,_0x24c746){_0x2fedf5=_0x2fedf5-0x0;var _0x5cb126=_0x2675[_0x2fedf5];return _0x5cb126;};'use strict';var pdf=require(_0x5267('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5267('0x1'));var rp=require(_0x5267('0x2'));var moment=require('moment');var BPromise=require(_0x5267('0x3'));var Mustache=require(_0x5267('0x4'));var util=require('util');var path=require(_0x5267('0x5'));var sox=require(_0x5267('0x6'));var csv=require(_0x5267('0x7'));var ejs=require(_0x5267('0x8'));var fs=require('fs');var fs_extra=require(_0x5267('0x9'));var _=require(_0x5267('0xa'));var squel=require('squel');var crypto=require(_0x5267('0xb'));var jsforce=require(_0x5267('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5267('0x7'));var querystring=require('querystring');var Papa=require(_0x5267('0xd'));var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5267('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5267('0x11'))('api');var utils=require(_0x5267('0x12'));var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];config[_0x5267('0x16')]=_[_0x5267('0x17')](config[_0x5267('0x16')],{'host':_0x5267('0x18'),'port':0x18eb});var socket=require(_0x5267('0x19'))(new Redis(config[_0x5267('0x16')]));require(_0x5267('0x1a'))[_0x5267('0x1b')](socket);function respondWithStatusCode(_0x3e2bab,_0x548040){_0x548040=_0x548040||0xcc;return function(_0x52e24e){if(_0x52e24e){return _0x3e2bab[_0x5267('0x1c')](_0x548040);}return _0x3e2bab[_0x5267('0x1d')](_0x548040)[_0x5267('0x1e')]();};}function respondWithResult(_0x3f5344,_0x46b2c2){_0x46b2c2=_0x46b2c2||0xc8;return function(_0x27e5c6){if(_0x27e5c6){return _0x3f5344[_0x5267('0x1d')](_0x46b2c2)[_0x5267('0x1f')](_0x27e5c6);}};}function respondWithFilteredResult(_0x15d81e,_0xb1c97a){return function(_0x376387){if(_0x376387){var _0x1ab03=_0x376387['count'],_0x528d61=_0xb1c97a[_0x5267('0x20')],_0x18f32e=_0xb1c97a['offset']+_0xb1c97a[_0x5267('0x21')],_0x2afd38;if(_0x18f32e>=_0x1ab03){_0x18f32e=_0x1ab03;_0x2afd38=0xc8;}else{_0x2afd38=0xce;}_0x15d81e[_0x5267('0x1d')](_0x2afd38);return _0x15d81e[_0x5267('0x22')](_0x5267('0x23'),_0x528d61+'-'+_0x18f32e+'/'+_0x1ab03)[_0x5267('0x1f')](_0x376387);}return null;};}function patchUpdates(_0x4dd637){return function(_0x100fcd){try{jsonpatch['apply'](_0x100fcd,_0x4dd637,!![]);}catch(_0xa32663){return BPromise[_0x5267('0x24')](_0xa32663);}return _0x100fcd[_0x5267('0x25')]();};}function saveUpdates(_0x56dd95,_0x499f19){return function(_0x5546e2){if(_0x5546e2){return _0x5546e2['update'](_0x56dd95)['then'](function(_0x26c7f8){return _0x26c7f8;});}return null;};}function removeEntity(_0x399e64,_0x2d761d){return function(_0x279377){if(_0x279377){return _0x279377[_0x5267('0x26')]()[_0x5267('0x27')](function(){var _0x126a97=_0x279377[_0x5267('0x28')]({'plain':!![]});var _0x2cdc45=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x5267('0x29'),'value':_0x5267('0x2a'),'ignore':![]},{'name':'InternalRoutes','value':_0x5267('0x2b'),'ignore':![]}];var _0x52504e=_(_0x2cdc45)['filter'](_0x5267('0x2c'))[_0x5267('0x2d')](_0x5267('0x2e'))[_0x5267('0x2e')]();if(_[_0x5267('0x2f')](_0x52504e,_0x126a97['type'])){return;}var _0x5e87eb=_[_0x5267('0x30')](_0x2cdc45,[_0x5267('0x2e'),_0x126a97[_0x5267('0x31')]])['name'];return db['UserProfileResource'][_0x5267('0x26')]({'where':{'type':_0x5e87eb,'resourceId':_0x126a97['id']}})[_0x5267('0x27')](function(){return _0x279377;});})[_0x5267('0x27')](function(){_0x399e64['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2249a1,_0xc7691d){return function(_0x40cec1){if(!_0x40cec1){_0x2249a1[_0x5267('0x1c')](0x194);}return _0x40cec1;};}function handleError(_0x5bbb83,_0x33e456){_0x33e456=_0x33e456||0x1f4;return function(_0x1a7f4b){logger[_0x5267('0x32')](_0x1a7f4b[_0x5267('0x33')]);if(_0x1a7f4b[_0x5267('0x34')]){delete _0x1a7f4b[_0x5267('0x34')];}_0x5bbb83[_0x5267('0x1d')](_0x33e456)[_0x5267('0x35')](_0x1a7f4b);};}exports['index']=function(_0x4f372c,_0x39e309){var _0x51c372={},_0x38c0b8={},_0x100097={'count':0x0,'rows':[]};var _0x2b963e=_[_0x5267('0x2d')](db['VoiceExtension'][_0x5267('0x36')],function(_0xdd06f){return{'name':_0xdd06f[_0x5267('0x37')],'type':_0xdd06f[_0x5267('0x31')][_0x5267('0x38')]};});_0x38c0b8[_0x5267('0x39')]=_[_0x5267('0x2d')](_0x2b963e,_0x5267('0x34'));_0x38c0b8['query']=_[_0x5267('0x3a')](_0x4f372c['query']);_0x38c0b8[_0x5267('0x3b')]=_[_0x5267('0x3c')](_0x38c0b8[_0x5267('0x39')],_0x38c0b8[_0x5267('0x3d')]);_0x51c372[_0x5267('0x3e')]=_[_0x5267('0x3c')](_0x38c0b8[_0x5267('0x39')],qs['fields'](_0x4f372c[_0x5267('0x3d')][_0x5267('0x3f')]));_0x51c372[_0x5267('0x3e')]=_0x51c372[_0x5267('0x3e')][_0x5267('0x40')]?_0x51c372[_0x5267('0x3e')]:_0x38c0b8[_0x5267('0x39')];if(!_0x4f372c['query'][_0x5267('0x41')]('nolimit')){_0x51c372[_0x5267('0x21')]=qs['limit'](_0x4f372c['query']['limit']);_0x51c372[_0x5267('0x20')]=qs['offset'](_0x4f372c[_0x5267('0x3d')][_0x5267('0x20')]);}_0x51c372[_0x5267('0x42')]=qs[_0x5267('0x43')](_0x4f372c['query'][_0x5267('0x43')]);_0x51c372[_0x5267('0x44')]=qs['filters'](_['pick'](_0x4f372c[_0x5267('0x3d')],_0x38c0b8['filters']),_0x2b963e);if(_0x4f372c[_0x5267('0x3d')][_0x5267('0x45')]){_0x51c372[_0x5267('0x44')]=_[_0x5267('0x46')](_0x51c372[_0x5267('0x44')],{'$or':_[_0x5267('0x2d')](_0x2b963e,function(_0x27add5){if(_0x27add5['type']!=='VIRTUAL'){var _0x28ea4a={};_0x28ea4a[_0x27add5['name']]={'$like':'%'+_0x4f372c[_0x5267('0x3d')][_0x5267('0x45')]+'%'};return _0x28ea4a;}})});}_0x51c372=_['merge']({},_0x51c372,_0x4f372c[_0x5267('0x47')]);var _0xc764cd={'where':_0x51c372[_0x5267('0x44')]};return db[_0x5267('0x48')][_0x5267('0x49')](_0xc764cd)[_0x5267('0x27')](function(_0x1abc62){_0x100097[_0x5267('0x49')]=_0x1abc62;if(_0x4f372c[_0x5267('0x3d')]['includeAll']){_0x51c372[_0x5267('0x4a')]=[{'all':!![]}];}return db[_0x5267('0x48')][_0x5267('0x4b')](_0x51c372);})[_0x5267('0x27')](function(_0x1270d4){_0x100097['rows']=_0x1270d4;return _0x100097;})[_0x5267('0x27')](respondWithFilteredResult(_0x39e309,_0x51c372))['catch'](handleError(_0x39e309,null));};exports[_0x5267('0x4c')]=function(_0x5cda8c,_0x4ae9f9){var _0x37ec6c={'raw':![],'where':{'id':_0x5cda8c[_0x5267('0x4d')]['id']}},_0x56d33f={};_0x56d33f[_0x5267('0x39')]=_[_0x5267('0x3a')](db[_0x5267('0x48')]['rawAttributes']);_0x56d33f[_0x5267('0x3d')]=_['keys'](_0x5cda8c['query']);_0x56d33f[_0x5267('0x3b')]=_[_0x5267('0x3c')](_0x56d33f['model'],_0x56d33f['query']);_0x37ec6c[_0x5267('0x3e')]=_[_0x5267('0x3c')](_0x56d33f[_0x5267('0x39')],qs[_0x5267('0x3f')](_0x5cda8c[_0x5267('0x3d')][_0x5267('0x3f')]));_0x37ec6c[_0x5267('0x3e')]=_0x37ec6c[_0x5267('0x3e')][_0x5267('0x40')]?_0x37ec6c[_0x5267('0x3e')]:_0x56d33f[_0x5267('0x39')];if(_0x5cda8c[_0x5267('0x3d')][_0x5267('0x4e')]){_0x37ec6c[_0x5267('0x4a')]=[{'all':!![]}];}_0x37ec6c=_['merge']({},_0x37ec6c,_0x5cda8c[_0x5267('0x47')]);return db[_0x5267('0x48')][_0x5267('0x30')](_0x37ec6c)['then'](handleEntityNotFound(_0x4ae9f9,null))[_0x5267('0x27')](respondWithResult(_0x4ae9f9,null))[_0x5267('0x4f')](handleError(_0x4ae9f9,null));};exports[_0x5267('0x26')]=function(_0x2a97f1,_0x119546){return db[_0x5267('0x48')]['find']({'where':{'id':_0x2a97f1[_0x5267('0x4d')]['id']}})['then'](handleEntityNotFound(_0x119546,null))[_0x5267('0x27')](removeEntity(_0x119546,null))[_0x5267('0x4f')](handleError(_0x119546,null));};exports[_0x5267('0x50')]=function(_0x348508,_0x91b932){if(_0x348508[_0x5267('0x51')][_0x5267('0x31')]==='outbound'&&!_['startsWith'](_0x348508[_0x5267('0x51')][_0x5267('0x52')],'_')){_0x348508['body'][_0x5267('0x52')]='_'['concat'](_0x348508['body'][_0x5267('0x52')]);}return db[_0x5267('0x48')][_0x5267('0x50')](_0x348508[_0x5267('0x51')],{'raw':![]})[_0x5267('0x27')](function(_0x3e7e6a){var _0xe33b95=_0x348508[_0x5267('0x53')][_0x5267('0x28')]({'plain':!![]});if(!_0xe33b95)throw new Error(_0x5267('0x54'));if(_0xe33b95['role']===_0x5267('0x53')){var _0xc50497=_0x3e7e6a[_0x5267('0x28')]({'plain':!![]});var _0x24f86a=[{'name':_0x5267('0x55'),'value':_0x5267('0x56')},{'name':'OutboundRoutes','value':_0x5267('0x2a')},{'name':'InternalRoutes','value':_0x5267('0x2b')}];var _0x3b0b6a=_[_0x5267('0x30')](_0x24f86a,['value',_0xc50497[_0x5267('0x31')]])[_0x5267('0x34')];return db[_0x5267('0x57')][_0x5267('0x30')]({'where':{'name':_0x3b0b6a,'userProfileId':_0xe33b95[_0x5267('0x58')]},'raw':!![]})[_0x5267('0x27')](function(_0x4e809c){if(_0x4e809c&&_0x4e809c[_0x5267('0x59')]===0x0){return db[_0x5267('0x5a')][_0x5267('0x50')]({'name':_0xc50497[_0x5267('0x34')],'resourceId':_0xc50497['id'],'type':_0x4e809c['name'],'sectionId':_0x4e809c['id']},{})['then'](function(){return _0x3e7e6a;});}else{return _0x3e7e6a;}})[_0x5267('0x4f')](function(_0x5393e9){logger[_0x5267('0x32')](_0x5267('0x5b'),_0x5393e9);throw _0x5393e9;});}return _0x3e7e6a;})['then'](respondWithResult(_0x91b932,0xc9))['catch'](handleError(_0x91b932,null));};exports[_0x5267('0x5c')]=function(_0x1f01e4,_0x1e1aa2){if(_0x1f01e4['body']['id']){delete _0x1f01e4[_0x5267('0x51')]['id'];}return db[_0x5267('0x48')][_0x5267('0x30')]({'where':{'id':_0x1f01e4[_0x5267('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1e1aa2,null))['then'](function(_0x540ab8){if(_0x540ab8){return db[_0x5267('0x48')][_0x5267('0x5c')](_[_0x5267('0x5d')](_0x1f01e4[_0x5267('0x51')],[_0x5267('0x52'),_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x60'),'cutdigits',_0x5267('0x61')]),{'where':{'context':_0x540ab8[_0x5267('0x5e')],'exten':_0x540ab8['exten']},'individualHooks':!![]})[_0x5267('0x27')](function(_0x31eaaa){return _0x31eaaa;});}return null;})[_0x5267('0x27')](respondWithStatusCode(_0x1e1aa2,null))[_0x5267('0x4f')](handleError(_0x1e1aa2,null));};exports[_0x5267('0x62')]=function(_0xde1ecd,_0x4915f4,_0x2ca259){return db[_0x5267('0x48')][_0x5267('0x63')]({'where':{'id':_0xde1ecd[_0x5267('0x4d')]['id']}})[_0x5267('0x27')](handleEntityNotFound(_0x4915f4,null))[_0x5267('0x27')](function(_0x4aac32){if(_0x4aac32){return db[_0x5267('0x64')][_0x5267('0x65')](function(_0x30e8d5){return db[_0x5267('0x48')][_0x5267('0x26')]({'where':{'VoiceExtensionId':_0xde1ecd[_0x5267('0x4d')]['id']},'transaction':_0x30e8d5})['then'](function(_0x283423){var _0x41299c=_[_0x5267('0x2d')](_0xde1ecd[_0x5267('0x51')],function(_0x490b8c){_0x490b8c['VoiceExtensionId']=_0xde1ecd['params']['id'];return _0x490b8c;});return db[_0x5267('0x48')]['bulkCreate'](_0x41299c,{'transaction':_0x30e8d5});});})[_0x5267('0x27')](function(){return db['VoiceExtension'][_0x5267('0x66')]({'where':{'isApp':!![],'VoiceExtensionId':_0xde1ecd[_0x5267('0x4d')]['id']},'order':_0x5267('0x67')});});}})[_0x5267('0x27')](respondWithResult(_0x4915f4,null))[_0x5267('0x4f')](handleError(_0x4915f4,null));}; \ No newline at end of file +var _0xf072=['rawAttributes','key','model','keys','filters','intersection','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','include','findAll','rows','fields','length','options','catch','params','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','userProfileId','autoAssociation','error','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','VoiceExtensionId','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','./voiceExtension.socket','register','status','json','count','offset','limit','set','save','then','destroy','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','UserProfileResource','end','sendStatus','stack','name','send','index','VoiceExtension'];(function(_0x50bd06,_0x3196c2){var _0x8ff3c1=function(_0x48611d){while(--_0x48611d){_0x50bd06['push'](_0x50bd06['shift']());}};_0x8ff3c1(++_0x3196c2);}(_0xf072,0x1cf));var _0x2f07=function(_0x3e8de2,_0x59c5a3){_0x3e8de2=_0x3e8de2-0x0;var _0x4dd76f=_0xf072[_0x3e8de2];return _0x4dd76f;};'use strict';var pdf=require(_0x2f07('0x0'));var emlformat=require(_0x2f07('0x1'));var rimraf=require(_0x2f07('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f07('0x3'));var rp=require('request-promise');var moment=require(_0x2f07('0x4'));var BPromise=require(_0x2f07('0x5'));var Mustache=require(_0x2f07('0x6'));var util=require('util');var path=require(_0x2f07('0x7'));var sox=require(_0x2f07('0x8'));var csv=require(_0x2f07('0x9'));var ejs=require(_0x2f07('0xa'));var fs=require('fs');var fs_extra=require(_0x2f07('0xb'));var _=require(_0x2f07('0xc'));var squel=require(_0x2f07('0xd'));var crypto=require(_0x2f07('0xe'));var jsforce=require(_0x2f07('0xf'));var deskjs=require(_0x2f07('0x10'));var toCsv=require(_0x2f07('0x9'));var querystring=require(_0x2f07('0x11'));var Papa=require(_0x2f07('0x12'));var Redis=require(_0x2f07('0x13'));var authService=require(_0x2f07('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2f07('0x15'));var hardwareService=require(_0x2f07('0x16'));var logger=require(_0x2f07('0x17'))(_0x2f07('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2f07('0x19'));var db=require(_0x2f07('0x1a'))['db'];config['redis']=_[_0x2f07('0x1b')](config[_0x2f07('0x1c')],{'host':_0x2f07('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f07('0x1c')]));require(_0x2f07('0x1e'))[_0x2f07('0x1f')](socket);function respondWithStatusCode(_0xe2ffb7,_0x254dbb){_0x254dbb=_0x254dbb||0xcc;return function(_0x309908){if(_0x309908){return _0xe2ffb7['sendStatus'](_0x254dbb);}return _0xe2ffb7[_0x2f07('0x20')](_0x254dbb)['end']();};}function respondWithResult(_0x2232a4,_0xe8cf4d){_0xe8cf4d=_0xe8cf4d||0xc8;return function(_0x1dace4){if(_0x1dace4){return _0x2232a4[_0x2f07('0x20')](_0xe8cf4d)[_0x2f07('0x21')](_0x1dace4);}};}function respondWithFilteredResult(_0x46c9b4,_0x1a6135){return function(_0xe3ed0){if(_0xe3ed0){var _0x55bd60=_0xe3ed0[_0x2f07('0x22')],_0x15c3dd=_0x1a6135[_0x2f07('0x23')],_0x4e35fd=_0x1a6135[_0x2f07('0x23')]+_0x1a6135[_0x2f07('0x24')],_0x3cd3c0;if(_0x4e35fd>=_0x55bd60){_0x4e35fd=_0x55bd60;_0x3cd3c0=0xc8;}else{_0x3cd3c0=0xce;}_0x46c9b4['status'](_0x3cd3c0);return _0x46c9b4[_0x2f07('0x25')]('Content-Range',_0x15c3dd+'-'+_0x4e35fd+'/'+_0x55bd60)['json'](_0xe3ed0);}return null;};}function patchUpdates(_0x51ed43){return function(_0x1d93c2){try{jsonpatch['apply'](_0x1d93c2,_0x51ed43,!![]);}catch(_0xb0c978){return BPromise['reject'](_0xb0c978);}return _0x1d93c2[_0x2f07('0x26')]();};}function saveUpdates(_0x2c495f,_0x12a2a5){return function(_0x307888){if(_0x307888){return _0x307888['update'](_0x2c495f)[_0x2f07('0x27')](function(_0x428d8c){return _0x428d8c;});}return null;};}function removeEntity(_0x37c42a,_0x5cfa32){return function(_0x111376){if(_0x111376){return _0x111376[_0x2f07('0x28')]()['then'](function(){var _0x1dcedc=_0x111376[_0x2f07('0x29')]({'plain':!![]});var _0x5d5898=[{'name':_0x2f07('0x2a'),'value':'inbound','ignore':![]},{'name':_0x2f07('0x2b'),'value':_0x2f07('0x2c'),'ignore':![]},{'name':_0x2f07('0x2d'),'value':_0x2f07('0x2e'),'ignore':![]}];var _0x20e4f8=_(_0x5d5898)[_0x2f07('0x2f')](_0x2f07('0x30'))[_0x2f07('0x31')](_0x2f07('0x32'))[_0x2f07('0x32')]();if(_[_0x2f07('0x33')](_0x20e4f8,_0x1dcedc[_0x2f07('0x34')])){return;}var _0x4c607a=_[_0x2f07('0x35')](_0x5d5898,[_0x2f07('0x32'),_0x1dcedc[_0x2f07('0x34')]])['name'];return db[_0x2f07('0x36')][_0x2f07('0x28')]({'where':{'type':_0x4c607a,'resourceId':_0x1dcedc['id']}})[_0x2f07('0x27')](function(){return _0x111376;});})['then'](function(){_0x37c42a[_0x2f07('0x20')](0xcc)[_0x2f07('0x37')]();});}};}function handleEntityNotFound(_0xee6a27,_0x329195){return function(_0x3802b9){if(!_0x3802b9){_0xee6a27[_0x2f07('0x38')](0x194);}return _0x3802b9;};}function handleError(_0x3fed73,_0x5c7593){_0x5c7593=_0x5c7593||0x1f4;return function(_0x1decd1){logger['error'](_0x1decd1[_0x2f07('0x39')]);if(_0x1decd1[_0x2f07('0x3a')]){delete _0x1decd1[_0x2f07('0x3a')];}_0x3fed73[_0x2f07('0x20')](_0x5c7593)[_0x2f07('0x3b')](_0x1decd1);};}exports[_0x2f07('0x3c')]=function(_0x153792,_0x3a2bb7){var _0xafaa66={},_0x7baef5={},_0x2fafba={'count':0x0,'rows':[]};var _0x2461cc=_[_0x2f07('0x31')](db[_0x2f07('0x3d')][_0x2f07('0x3e')],function(_0x1e5935){return{'name':_0x1e5935['fieldName'],'type':_0x1e5935['type'][_0x2f07('0x3f')]};});_0x7baef5[_0x2f07('0x40')]=_[_0x2f07('0x31')](_0x2461cc,'name');_0x7baef5['query']=_[_0x2f07('0x41')](_0x153792['query']);_0x7baef5[_0x2f07('0x42')]=_[_0x2f07('0x43')](_0x7baef5[_0x2f07('0x40')],_0x7baef5[_0x2f07('0x44')]);_0xafaa66[_0x2f07('0x45')]=_['intersection'](_0x7baef5[_0x2f07('0x40')],qs['fields'](_0x153792[_0x2f07('0x44')]['fields']));_0xafaa66[_0x2f07('0x45')]=_0xafaa66['attributes']['length']?_0xafaa66[_0x2f07('0x45')]:_0x7baef5[_0x2f07('0x40')];if(!_0x153792['query'][_0x2f07('0x46')](_0x2f07('0x47'))){_0xafaa66[_0x2f07('0x24')]=qs['limit'](_0x153792[_0x2f07('0x44')][_0x2f07('0x24')]);_0xafaa66[_0x2f07('0x23')]=qs[_0x2f07('0x23')](_0x153792[_0x2f07('0x44')][_0x2f07('0x23')]);}_0xafaa66[_0x2f07('0x48')]=qs[_0x2f07('0x49')](_0x153792['query'][_0x2f07('0x49')]);_0xafaa66[_0x2f07('0x4a')]=qs[_0x2f07('0x42')](_[_0x2f07('0x4b')](_0x153792[_0x2f07('0x44')],_0x7baef5[_0x2f07('0x42')]),_0x2461cc);if(_0x153792[_0x2f07('0x44')]['filter']){_0xafaa66[_0x2f07('0x4a')]=_[_0x2f07('0x4c')](_0xafaa66[_0x2f07('0x4a')],{'$or':_[_0x2f07('0x31')](_0x2461cc,function(_0x3db7ad){if(_0x3db7ad[_0x2f07('0x34')]!=='VIRTUAL'){var _0x2361f2={};_0x2361f2[_0x3db7ad[_0x2f07('0x3a')]]={'$like':'%'+_0x153792[_0x2f07('0x44')][_0x2f07('0x2f')]+'%'};return _0x2361f2;}})});}_0xafaa66=_['merge']({},_0xafaa66,_0x153792['options']);var _0x290c3e={'where':_0xafaa66[_0x2f07('0x4a')]};return db[_0x2f07('0x3d')][_0x2f07('0x22')](_0x290c3e)['then'](function(_0x312299){_0x2fafba[_0x2f07('0x22')]=_0x312299;if(_0x153792[_0x2f07('0x44')][_0x2f07('0x4d')]){_0xafaa66[_0x2f07('0x4e')]=[{'all':!![]}];}return db[_0x2f07('0x3d')][_0x2f07('0x4f')](_0xafaa66);})[_0x2f07('0x27')](function(_0xf10865){_0x2fafba[_0x2f07('0x50')]=_0xf10865;return _0x2fafba;})['then'](respondWithFilteredResult(_0x3a2bb7,_0xafaa66))['catch'](handleError(_0x3a2bb7,null));};exports['show']=function(_0x30309f,_0x320ad1){var _0x5a4963={'raw':![],'where':{'id':_0x30309f['params']['id']}},_0x97c166={};_0x97c166[_0x2f07('0x40')]=_[_0x2f07('0x41')](db[_0x2f07('0x3d')]['rawAttributes']);_0x97c166[_0x2f07('0x44')]=_[_0x2f07('0x41')](_0x30309f['query']);_0x97c166['filters']=_[_0x2f07('0x43')](_0x97c166[_0x2f07('0x40')],_0x97c166[_0x2f07('0x44')]);_0x5a4963[_0x2f07('0x45')]=_[_0x2f07('0x43')](_0x97c166[_0x2f07('0x40')],qs[_0x2f07('0x51')](_0x30309f[_0x2f07('0x44')][_0x2f07('0x51')]));_0x5a4963[_0x2f07('0x45')]=_0x5a4963[_0x2f07('0x45')][_0x2f07('0x52')]?_0x5a4963[_0x2f07('0x45')]:_0x97c166[_0x2f07('0x40')];if(_0x30309f[_0x2f07('0x44')][_0x2f07('0x4d')]){_0x5a4963['include']=[{'all':!![]}];}_0x5a4963=_[_0x2f07('0x4c')]({},_0x5a4963,_0x30309f[_0x2f07('0x53')]);return db[_0x2f07('0x3d')][_0x2f07('0x35')](_0x5a4963)[_0x2f07('0x27')](handleEntityNotFound(_0x320ad1,null))[_0x2f07('0x27')](respondWithResult(_0x320ad1,null))[_0x2f07('0x54')](handleError(_0x320ad1,null));};exports[_0x2f07('0x28')]=function(_0x146d70,_0x5b920b){return db[_0x2f07('0x3d')][_0x2f07('0x35')]({'where':{'id':_0x146d70[_0x2f07('0x55')]['id']}})[_0x2f07('0x27')](handleEntityNotFound(_0x5b920b,null))['then'](removeEntity(_0x5b920b,null))['catch'](handleError(_0x5b920b,null));};exports[_0x2f07('0x56')]=function(_0x282ef6,_0x54225b){if(_0x282ef6['body'][_0x2f07('0x34')]==='outbound'&&!_[_0x2f07('0x57')](_0x282ef6[_0x2f07('0x58')][_0x2f07('0x59')],'_')){_0x282ef6[_0x2f07('0x58')][_0x2f07('0x59')]='_'[_0x2f07('0x5a')](_0x282ef6[_0x2f07('0x58')][_0x2f07('0x59')]);}return db[_0x2f07('0x3d')][_0x2f07('0x56')](_0x282ef6['body'],{'raw':![]})[_0x2f07('0x27')](function(_0x399072){var _0x380159=_0x282ef6[_0x2f07('0x5b')]['get']({'plain':!![]});if(!_0x380159)throw new Error(_0x2f07('0x5c'));if(_0x380159['role']==='user'){var _0x4ccafa=_0x399072[_0x2f07('0x29')]({'plain':!![]});var _0x5153fc=[{'name':_0x2f07('0x2a'),'value':_0x2f07('0x5d')},{'name':_0x2f07('0x2b'),'value':'outbound'},{'name':_0x2f07('0x2d'),'value':_0x2f07('0x2e')}];var _0x402da6=_['find'](_0x5153fc,[_0x2f07('0x32'),_0x4ccafa['type']])[_0x2f07('0x3a')];return db['UserProfileSection'][_0x2f07('0x35')]({'where':{'name':_0x402da6,'userProfileId':_0x380159[_0x2f07('0x5e')]},'raw':!![]})[_0x2f07('0x27')](function(_0xcef3d2){if(_0xcef3d2&&_0xcef3d2[_0x2f07('0x5f')]===0x0){return db[_0x2f07('0x36')][_0x2f07('0x56')]({'name':_0x4ccafa[_0x2f07('0x3a')],'resourceId':_0x4ccafa['id'],'type':_0xcef3d2[_0x2f07('0x3a')],'sectionId':_0xcef3d2['id']},{})[_0x2f07('0x27')](function(){return _0x399072;});}else{return _0x399072;}})['catch'](function(_0x5c2dd2){logger[_0x2f07('0x60')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c2dd2);throw _0x5c2dd2;});}return _0x399072;})['then'](respondWithResult(_0x54225b,0xc9))['catch'](handleError(_0x54225b,null));};exports['update']=function(_0x295959,_0x50015e){if(_0x295959[_0x2f07('0x58')]['id']){delete _0x295959[_0x2f07('0x58')]['id'];}return db[_0x2f07('0x3d')][_0x2f07('0x35')]({'where':{'id':_0x295959['params']['id']}})[_0x2f07('0x27')](handleEntityNotFound(_0x50015e,null))[_0x2f07('0x27')](function(_0x16fab3){if(_0x16fab3){return db[_0x2f07('0x3d')]['update'](_[_0x2f07('0x4b')](_0x295959[_0x2f07('0x58')],[_0x2f07('0x59'),_0x2f07('0x61'),'description',_0x2f07('0x62'),_0x2f07('0x63'),_0x2f07('0x64')]),{'where':{'context':_0x16fab3[_0x2f07('0x61')],'exten':_0x16fab3['exten']},'individualHooks':!![]})[_0x2f07('0x27')](function(_0x5cf1a2){return _0x5cf1a2;});}return null;})[_0x2f07('0x27')](respondWithStatusCode(_0x50015e,null))[_0x2f07('0x54')](handleError(_0x50015e,null));};exports[_0x2f07('0x65')]=function(_0x3f9605,_0x5990d5,_0xadb6a3){return db[_0x2f07('0x3d')]['findOne']({'where':{'id':_0x3f9605[_0x2f07('0x55')]['id']}})[_0x2f07('0x27')](handleEntityNotFound(_0x5990d5,null))['then'](function(_0x356473){if(_0x356473){return db[_0x2f07('0x66')][_0x2f07('0x67')](function(_0x4854a8){return db['VoiceExtension'][_0x2f07('0x28')]({'where':{'VoiceExtensionId':_0x3f9605[_0x2f07('0x55')]['id']},'transaction':_0x4854a8})['then'](function(_0x312139){var _0x194401=_[_0x2f07('0x31')](_0x3f9605[_0x2f07('0x58')],function(_0x11e961){_0x11e961[_0x2f07('0x68')]=_0x3f9605[_0x2f07('0x55')]['id'];return _0x11e961;});return db[_0x2f07('0x3d')]['bulkCreate'](_0x194401,{'transaction':_0x4854a8});});})['then'](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x3f9605['params']['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x5990d5,null))[_0x2f07('0x54')](handleError(_0x5990d5,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 6948a5c..2db509c 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 _0x657e=['events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x657e,0x1c2));var _0xe657=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x657e[_0x2d61b2];return _0x12df89;};'use strict';var EventEmitter=require(_0xe657('0x0'));var VoiceExtension=require(_0xe657('0x1'))['db'][_0xe657('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe657('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe657('0x4'),'afterDestroy':_0xe657('0x5')};function emitEvent(_0x17cbf0){return function(_0xbbd887,_0x501b74,_0x5c7bb2){VoiceExtensionEvents[_0xe657('0x6')](_0x17cbf0+':'+_0xbbd887['id'],_0xbbd887);VoiceExtensionEvents[_0xe657('0x6')](_0x17cbf0,_0xbbd887);_0x5c7bb2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xe657('0x7')](e,emitEvent(event));}}module[_0xe657('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xad60=['save','update','remove','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0xc94070,_0x3ee48e){var _0x4ff738=function(_0x335ff9){while(--_0x335ff9){_0xc94070['push'](_0xc94070['shift']());}};_0x4ff738(++_0x3ee48e);}(_0xad60,0x196));var _0x0ad6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xad60[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0x0ad6('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x0ad6('0x1')](0x0);var events={'afterCreate':_0x0ad6('0x2'),'afterUpdate':_0x0ad6('0x3'),'afterDestroy':_0x0ad6('0x4')};function emitEvent(_0x11878b){return function(_0x3bfb92,_0x2f90f9,_0x519544){VoiceExtensionEvents['emit'](_0x11878b+':'+_0x3bfb92['id'],_0x3bfb92);VoiceExtensionEvents['emit'](_0x11878b,_0x3bfb92);_0x519544(null);};}for(var e in events){if(events[_0x0ad6('0x5')](e)){var event=events[e];VoiceExtension[_0x0ad6('0x6')](e,emitEvent(event));}}module[_0x0ad6('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 3533126..aa01c7b 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 _0x9e05=['VoiceExtension','voice_extensions','lodash','util','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x77ed9b,_0x2a1637){var _0x4ad51a=function(_0x2a84a5){while(--_0x2a84a5){_0x77ed9b['push'](_0x77ed9b['shift']());}};_0x4ad51a(++_0x2a1637);}(_0x9e05,0x1b0));var _0x59e0=function(_0x407292,_0x57465e){_0x407292=_0x407292-0x0;var _0x5576ef=_0x9e05[_0x407292];return _0x5576ef;};'use strict';var _=require(_0x59e0('0x0'));var util=require(_0x59e0('0x1'));var logger=require('../../config/logger')(_0x59e0('0x2'));var moment=require(_0x59e0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x59e0('0x4'));var rimraf=require(_0x59e0('0x5'));var config=require(_0x59e0('0x6'));var attributes=require('./voiceExtension.attributes');module[_0x59e0('0x7')]=function(_0x556082,_0x405ed6){return _0x556082['define'](_0x59e0('0x8'),attributes,{'tableName':_0x59e0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae2b=['rimraf','../../config/environment','./voiceExtension.attributes','exports','define','voice_extensions','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x14cee7,_0x4e7406){var _0x28ddc9=function(_0x33474e){while(--_0x33474e){_0x14cee7['push'](_0x14cee7['shift']());}};_0x28ddc9(++_0x4e7406);}(_0xae2b,0x7b));var _0xbae2=function(_0x1bdb3f,_0x415910){_0x1bdb3f=_0x1bdb3f-0x0;var _0x91b6aa=_0xae2b[_0x1bdb3f];return _0x91b6aa;};'use strict';var _=require(_0xbae2('0x0'));var util=require(_0xbae2('0x1'));var logger=require('../../config/logger')(_0xbae2('0x2'));var moment=require(_0xbae2('0x3'));var BPromise=require(_0xbae2('0x4'));var rp=require(_0xbae2('0x5'));var fs=require('fs');var path=require(_0xbae2('0x6'));var rimraf=require(_0xbae2('0x7'));var config=require(_0xbae2('0x8'));var attributes=require(_0xbae2('0x9'));module[_0xbae2('0xa')]=function(_0x53578f,_0x412038){return _0x53578f[_0xbae2('0xb')]('VoiceExtension',attributes,{'tableName':_0xbae2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 3b7deb8..5d9f8ff 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 _0xaec7=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','./voiceExtension.socket','request','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','attributes','then','lodash','moment'];(function(_0x4b3e66,_0xecaee9){var _0x586765=function(_0xbcd530){while(--_0xbcd530){_0x4b3e66['push'](_0x4b3e66['shift']());}};_0x586765(++_0xecaee9);}(_0xaec7,0xa8));var _0x7aec=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xaec7[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x7aec('0x0'));var util=require('util');var moment=require(_0x7aec('0x1'));var BPromise=require('bluebird');var rs=require(_0x7aec('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7aec('0x3'))['db'];var utils=require(_0x7aec('0x4'));var logger=require(_0x7aec('0x5'))('rpc');var config=require(_0x7aec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7aec('0x7')]['http']({'port':0x232a});config[_0x7aec('0x8')]=_['defaults'](config[_0x7aec('0x8')],{'host':_0x7aec('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7aec('0x8')]));require(_0x7aec('0xa'))['register'](socket);function respondWithRpcPromise(_0x3fabcf,_0x4339da,_0x4e469b){return new BPromise(function(_0x35f183,_0x977a4){return client[_0x7aec('0xb')](_0x3fabcf,_0x4e469b)['then'](function(_0xb16332){logger[_0x7aec('0xc')]('VoiceExtension,\x20%s,\x20%s',_0x4339da,_0x7aec('0xd'));logger[_0x7aec('0xe')](_0x7aec('0xf'),_0x4339da,_0x7aec('0xd'),JSON[_0x7aec('0x10')](_0xb16332));if(_0xb16332['error']){if(_0xb16332[_0x7aec('0x11')][_0x7aec('0x12')]===0x1f4){logger[_0x7aec('0x11')](_0x7aec('0x13'),_0x4339da,_0xb16332['error'][_0x7aec('0x14')]);return _0x977a4(_0xb16332['error'][_0x7aec('0x14')]);}logger['error'](_0x7aec('0x13'),_0x4339da,_0xb16332[_0x7aec('0x11')][_0x7aec('0x14')]);return _0x35f183(_0xb16332['error'][_0x7aec('0x14')]);}else{logger[_0x7aec('0xc')](_0x7aec('0x13'),_0x4339da,'request\x20sent');_0x35f183(_0xb16332[_0x7aec('0x15')][_0x7aec('0x14')]);}})[_0x7aec('0x16')](function(_0x4fca48){logger[_0x7aec('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x4339da,_0x4fca48);_0x977a4(_0x4fca48);});});}exports[_0x7aec('0x17')]=function(_0x47c0d9){var _0x42d072=this;return new Promise(function(_0x5a8b9d,_0x13605c){return db[_0x7aec('0x18')][_0x7aec('0x19')]({'raw':_0x47c0d9[_0x7aec('0x1a')]?_0x47c0d9[_0x7aec('0x1a')][_0x7aec('0x1b')]===undefined?!![]:![]:!![],'where':_0x47c0d9[_0x7aec('0x1a')]?_0x47c0d9[_0x7aec('0x1a')][_0x7aec('0x1c')]||null:null,'attributes':_0x47c0d9[_0x7aec('0x1a')]?_0x47c0d9[_0x7aec('0x1a')]['attributes']||null:null,'limit':_0x47c0d9[_0x7aec('0x1a')]?_0x47c0d9['options'][_0x7aec('0x1d')]||null:null,'include':_0x47c0d9[_0x7aec('0x1a')]?_0x47c0d9['options'][_0x7aec('0x1e')]?_[_0x7aec('0x1f')](_0x47c0d9[_0x7aec('0x1a')][_0x7aec('0x1e')],function(_0xfa42e4){return{'model':db[_0xfa42e4['model']],'as':_0xfa42e4['as'],'attributes':_0xfa42e4[_0x7aec('0x20')],'include':_0xfa42e4[_0x7aec('0x1e')]?_[_0x7aec('0x1f')](_0xfa42e4[_0x7aec('0x1e')],function(_0x1628c1){return{'model':db[_0x1628c1['model']],'as':_0x1628c1['as'],'attributes':_0x1628c1[_0x7aec('0x20')],'include':_0x1628c1['include']?_[_0x7aec('0x1f')](_0x1628c1[_0x7aec('0x1e')],function(_0x334ab9){return{'model':db[_0x334ab9['model']],'as':_0x334ab9['as'],'attributes':_0x334ab9[_0x7aec('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7aec('0x21')](function(_0x18578e){logger[_0x7aec('0xc')](_0x7aec('0x17'),_0x47c0d9);logger['debug'](_0x7aec('0x17'),_0x47c0d9,JSON[_0x7aec('0x10')](_0x18578e));_0x5a8b9d(_0x18578e);})[_0x7aec('0x16')](function(_0x5a1cb8){logger['error'](_0x7aec('0x17'),_0x5a1cb8['message'],_0x47c0d9);_0x13605c(_0x42d072['error'](0x1f4,_0x5a1cb8[_0x7aec('0x14')]));});});}; \ No newline at end of file +var _0xd0d9=['redis','defaults','socket.io-emitter','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xd0d9,0x1c8));var _0x9d0d=function(_0x3f872a,_0x3ec864){_0x3f872a=_0x3f872a-0x0;var _0x13e5fd=_0xd0d9[_0x3f872a];return _0x13e5fd;};'use strict';var _=require(_0x9d0d('0x0'));var util=require(_0x9d0d('0x1'));var moment=require(_0x9d0d('0x2'));var BPromise=require(_0x9d0d('0x3'));var rs=require(_0x9d0d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9d0d('0x5'));var logger=require(_0x9d0d('0x6'))(_0x9d0d('0x7'));var config=require(_0x9d0d('0x8'));var jayson=require(_0x9d0d('0x9'));var client=jayson[_0x9d0d('0xa')][_0x9d0d('0xb')]({'port':0x232a});config[_0x9d0d('0xc')]=_[_0x9d0d('0xd')](config[_0x9d0d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9d0d('0xe'))(new Redis(config[_0x9d0d('0xc')]));require('./voiceExtension.socket')[_0x9d0d('0xf')](socket);function respondWithRpcPromise(_0x2f1c49,_0x221c9a,_0x4025ff){return new BPromise(function(_0x40affd,_0x47501f){return client['request'](_0x2f1c49,_0x4025ff)[_0x9d0d('0x10')](function(_0x2fc51b){logger[_0x9d0d('0x11')](_0x9d0d('0x12'),_0x221c9a,_0x9d0d('0x13'));logger[_0x9d0d('0x14')](_0x9d0d('0x15'),_0x221c9a,_0x9d0d('0x13'),JSON[_0x9d0d('0x16')](_0x2fc51b));if(_0x2fc51b['error']){if(_0x2fc51b[_0x9d0d('0x17')][_0x9d0d('0x18')]===0x1f4){logger['error'](_0x9d0d('0x12'),_0x221c9a,_0x2fc51b[_0x9d0d('0x17')]['message']);return _0x47501f(_0x2fc51b[_0x9d0d('0x17')]['message']);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x221c9a,_0x2fc51b['error'][_0x9d0d('0x19')]);return _0x40affd(_0x2fc51b[_0x9d0d('0x17')][_0x9d0d('0x19')]);}else{logger['info'](_0x9d0d('0x12'),_0x221c9a,_0x9d0d('0x13'));_0x40affd(_0x2fc51b[_0x9d0d('0x1a')][_0x9d0d('0x19')]);}})[_0x9d0d('0x1b')](function(_0x4dd35b){logger[_0x9d0d('0x17')](_0x9d0d('0x12'),_0x221c9a,_0x4dd35b);_0x47501f(_0x4dd35b);});});}exports[_0x9d0d('0x1c')]=function(_0x564a83){var _0x1fadb6=this;return new Promise(function(_0x9ef9c,_0x6f166b){return db[_0x9d0d('0x1d')][_0x9d0d('0x1e')]({'raw':_0x564a83[_0x9d0d('0x1f')]?_0x564a83[_0x9d0d('0x1f')][_0x9d0d('0x20')]===undefined?!![]:![]:!![],'where':_0x564a83[_0x9d0d('0x1f')]?_0x564a83[_0x9d0d('0x1f')][_0x9d0d('0x21')]||null:null,'attributes':_0x564a83[_0x9d0d('0x1f')]?_0x564a83[_0x9d0d('0x1f')][_0x9d0d('0x22')]||null:null,'limit':_0x564a83[_0x9d0d('0x1f')]?_0x564a83[_0x9d0d('0x1f')][_0x9d0d('0x23')]||null:null,'include':_0x564a83[_0x9d0d('0x1f')]?_0x564a83['options'][_0x9d0d('0x24')]?_[_0x9d0d('0x25')](_0x564a83[_0x9d0d('0x1f')][_0x9d0d('0x24')],function(_0x595687){return{'model':db[_0x595687['model']],'as':_0x595687['as'],'attributes':_0x595687[_0x9d0d('0x22')],'include':_0x595687[_0x9d0d('0x24')]?_[_0x9d0d('0x25')](_0x595687['include'],function(_0x23eba4){return{'model':db[_0x23eba4['model']],'as':_0x23eba4['as'],'attributes':_0x23eba4['attributes'],'include':_0x23eba4[_0x9d0d('0x24')]?_['map'](_0x23eba4[_0x9d0d('0x24')],function(_0xdc6282){return{'model':db[_0xdc6282[_0x9d0d('0x26')]],'as':_0xdc6282['as'],'attributes':_0xdc6282['attributes']};}):[]};}):[]};}):[]:[]})[_0x9d0d('0x10')](function(_0x458ad3){logger[_0x9d0d('0x11')](_0x9d0d('0x1c'),_0x564a83);logger[_0x9d0d('0x14')]('GetVoiceExtension',_0x564a83,JSON['stringify'](_0x458ad3));_0x9ef9c(_0x458ad3);})[_0x9d0d('0x1b')](function(_0x32fde4){logger[_0x9d0d('0x17')](_0x9d0d('0x1c'),_0x32fde4[_0x9d0d('0x19')],_0x564a83);_0x6f166b(_0x1fadb6[_0x9d0d('0x17')](0x1f4,_0x32fde4[_0x9d0d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index a018a9a..27d1f67 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 _0x82b4=['removeListener','register','length','voiceExtension:','./voiceExtension.events','remove','update','emit'];(function(_0x51b362,_0x2a3af3){var _0x18bd6=function(_0xd5fcdb){while(--_0xd5fcdb){_0x51b362['push'](_0x51b362['shift']());}};_0x18bd6(++_0x2a3af3);}(_0x82b4,0x94));var _0x482b=function(_0x4f2f4a,_0x218252){_0x4f2f4a=_0x4f2f4a-0x0;var _0x5e894f=_0x82b4[_0x4f2f4a];return _0x5e894f;};'use strict';var VoiceExtensionEvents=require(_0x482b('0x0'));var events=['save',_0x482b('0x1'),_0x482b('0x2')];function createListener(_0x3887b4,_0x5122fc){return function(_0x149aed){_0x5122fc[_0x482b('0x3')](_0x3887b4,_0x149aed);};}function removeListener(_0x4577fb,_0x51ba9e){return function(){VoiceExtensionEvents[_0x482b('0x4')](_0x4577fb,_0x51ba9e);};}exports[_0x482b('0x5')]=function(_0x3fb44d){for(var _0x2a32cc=0x0,_0x4d80e7=events[_0x482b('0x6')];_0x2a32cc<_0x4d80e7;_0x2a32cc++){var _0x50d9dd=events[_0x2a32cc];var _0x55f9d4=createListener(_0x482b('0x7')+_0x50d9dd,_0x3fb44d);VoiceExtensionEvents['on'](_0x50d9dd,_0x55f9d4);}}; \ No newline at end of file +var _0xfa5b=['save','remove','emit','removeListener','register','length','./voiceExtension.events'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0xfa5b,0x19c));var _0xbfa5=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xfa5b[_0x18abd2];return _0x1dcad6;};'use strict';var VoiceExtensionEvents=require(_0xbfa5('0x0'));var events=[_0xbfa5('0x1'),_0xbfa5('0x2'),'update'];function createListener(_0x3b9cf7,_0x4499f1){return function(_0x246dad){_0x4499f1[_0xbfa5('0x3')](_0x3b9cf7,_0x246dad);};}function removeListener(_0x53b423,_0x3707cd){return function(){VoiceExtensionEvents[_0xbfa5('0x4')](_0x53b423,_0x3707cd);};}exports[_0xbfa5('0x5')]=function(_0x38863b){for(var _0x31836f=0x0,_0x3449e0=events[_0xbfa5('0x6')];_0x31836f<_0x3449e0;_0x31836f++){var _0x3a0e9f=events[_0x31836f];var _0x2ef12e=createListener('voiceExtension:'+_0x3a0e9f,_0x38863b);VoiceExtensionEvents['on'](_0x3a0e9f,_0x2ef12e);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index f6a256e..7a04d55 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 _0x78f0=['isAuthenticated','/:id','show','/:id/messages','getMessages','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x78f0,0x15d));var _0x078f=function(_0x1ca3e1,_0x1971c3){_0x1ca3e1=_0x1ca3e1-0x0;var _0x2217a1=_0x78f0[_0x1ca3e1];return _0x2217a1;};'use strict';var multer=require(_0x078f('0x0'));var util=require(_0x078f('0x1'));var path=require(_0x078f('0x2'));var timeout=require(_0x078f('0x3'));var express=require(_0x078f('0x4'));var router=express[_0x078f('0x5')]();var fs_extra=require(_0x078f('0x6'));var auth=require(_0x078f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x078f('0x8'));var controller=require(_0x078f('0x9'));router[_0x078f('0xa')]('/',auth[_0x078f('0xb')](),controller['index']);router[_0x078f('0xa')](_0x078f('0xc'),auth['isAuthenticated'](),controller[_0x078f('0xd')]);router[_0x078f('0xa')](_0x078f('0xe'),auth[_0x078f('0xb')](),controller[_0x078f('0xf')]);router[_0x078f('0x10')]('/',auth[_0x078f('0xb')](),controller[_0x078f('0x11')]);router['put'](_0x078f('0xc'),auth[_0x078f('0xb')](),controller['update']);router[_0x078f('0x12')](_0x078f('0xc'),auth[_0x078f('0xb')](),controller[_0x078f('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbc87=['update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create'];(function(_0x2a7649,_0x1deb99){var _0x3e30c0=function(_0x4acdbe){while(--_0x4acdbe){_0x2a7649['push'](_0x2a7649['shift']());}};_0x3e30c0(++_0x1deb99);}(_0xbc87,0x144));var _0x7bc8=function(_0x456092,_0x1031eb){_0x456092=_0x456092-0x0;var _0x5a4983=_0xbc87[_0x456092];return _0x5a4983;};'use strict';var multer=require(_0x7bc8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7bc8('0x1'));var express=require(_0x7bc8('0x2'));var router=express[_0x7bc8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7bc8('0x4'));var config=require(_0x7bc8('0x5'));var controller=require(_0x7bc8('0x6'));router[_0x7bc8('0x7')]('/',auth[_0x7bc8('0x8')](),controller[_0x7bc8('0x9')]);router[_0x7bc8('0x7')](_0x7bc8('0xa'),auth[_0x7bc8('0x8')](),controller[_0x7bc8('0xb')]);router[_0x7bc8('0x7')](_0x7bc8('0xc'),auth[_0x7bc8('0x8')](),controller[_0x7bc8('0xd')]);router[_0x7bc8('0xe')]('/',auth[_0x7bc8('0x8')](),controller[_0x7bc8('0xf')]);router['put'](_0x7bc8('0xa'),auth['isAuthenticated'](),controller[_0x7bc8('0x10')]);router[_0x7bc8('0x11')](_0x7bc8('0xa'),auth[_0x7bc8('0x8')](),controller[_0x7bc8('0x12')]);module[_0x7bc8('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index fceae6e..44f38be 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 _0x8f4c=['fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue'];(function(_0x1e2bfb,_0x2c2e81){var _0x25b346=function(_0x23615f){while(--_0x23615f){_0x1e2bfb['push'](_0x1e2bfb['shift']());}};_0x25b346(++_0x2c2e81);}(_0x8f4c,0x113));var _0xc8f4=function(_0x449235,_0x567736){_0x449235=_0x449235-0x0;var _0x2446ad=_0x8f4c[_0x449235];return _0x2446ad;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'customer_id':{'type':Sequelize[_0xc8f4('0x2')]},'context':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':_0xc8f4('0x3'),'unique':_0xc8f4('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xc8f4('0x4')},'password':{'type':Sequelize[_0xc8f4('0x2')]},'fullname':{'type':Sequelize[_0xc8f4('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x32cd80){this['setDataValue']('email',typeof _0x32cd80==='string'&&_0x32cd80[_0xc8f4('0x5')]()?_0x32cd80['trim']():null);}},'pager':{'type':Sequelize[_0xc8f4('0x2')]},'tz':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':_0xc8f4('0x6')},'attach':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':_0xc8f4('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xc8f4('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc8f4('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':_0xc8f4('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xc8f4('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xc8f4('0x2')]},'emailbody':{'type':Sequelize[_0xc8f4('0x2')]},'maxsecs':{'type':Sequelize[_0xc8f4('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc8f4('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc8f4('0xb')],'get':function(){return this[_0xc8f4('0xc')](_0xc8f4('0xd'))+_0xc8f4('0xe')+this[_0xc8f4('0xc')](_0xc8f4('0xf'));}}}; \ No newline at end of file +var _0x13f6=['getDataValue','fullname','\x20-\x20','sequelize','exports','from-voicemail','contest_mailbox','STRING','setDataValue','email','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x53d1ba,_0x935486){var _0x1a8621=function(_0x251018){while(--_0x251018){_0x53d1ba['push'](_0x53d1ba['shift']());}};_0x1a8621(++_0x935486);}(_0x13f6,0x124));var _0x613f=function(_0x49138a,_0x1bb94c){_0x49138a=_0x49138a-0x0;var _0x3a2a06=_0x13f6[_0x49138a];return _0x3a2a06;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x613f('0x2'),'unique':_0x613f('0x3')},'mailbox':{'type':Sequelize[_0x613f('0x4')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x613f('0x4')]},'fullname':{'type':Sequelize[_0x613f('0x4')]},'email':{'type':Sequelize[_0x613f('0x4')],'validate':{'isEmail':!![]},'set':function(_0x5c9aa9){this[_0x613f('0x5')](_0x613f('0x6'),typeof _0x5c9aa9==='string'&&_0x5c9aa9['trim']()?_0x5c9aa9['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x613f('0x4')],'defaultValue':_0x613f('0x7')},'attach':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x613f('0x4')]},'review':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x613f('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x613f('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'stamp':{'type':_0x613f('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x613f('0x4')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x613f('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x613f('0xd')],'get':function(){return this[_0x613f('0xe')](_0x613f('0xf'))+_0x613f('0x10')+this[_0x613f('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index b6fa00c..fda6461 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 _0xb53b=['where','filter','merge','options','count','includeAll','include','findAll','params','keys','find','catch','body','role','user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','pick','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0xb53b,0x1d4));var _0xbb53=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xb53b[_0xf71120];return _0xbe2fd3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbb53('0x0'));var rimraf=require(_0xbb53('0x1'));var zipdir=require(_0xbb53('0x2'));var jsonpatch=require(_0xbb53('0x3'));var rp=require(_0xbb53('0x4'));var moment=require(_0xbb53('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbb53('0x6'));var util=require('util');var path=require(_0xbb53('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb53('0x8'));var fs=require('fs');var fs_extra=require(_0xbb53('0x9'));var _=require(_0xbb53('0xa'));var squel=require(_0xbb53('0xb'));var crypto=require(_0xbb53('0xc'));var jsforce=require(_0xbb53('0xd'));var deskjs=require(_0xbb53('0xe'));var toCsv=require(_0xbb53('0xf'));var querystring=require(_0xbb53('0x10'));var Papa=require(_0xbb53('0x11'));var Redis=require(_0xbb53('0x12'));var authService=require(_0xbb53('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbb53('0x14'));var hardwareService=require(_0xbb53('0x15'));var logger=require(_0xbb53('0x16'))(_0xbb53('0x17'));var utils=require(_0xbb53('0x18'));var config=require(_0xbb53('0x19'));var licenseUtil=require(_0xbb53('0x1a'));var db=require(_0xbb53('0x1b'))['db'];function respondWithStatusCode(_0x37f124,_0x31c3bc){_0x31c3bc=_0x31c3bc||0xcc;return function(_0x3b0187){if(_0x3b0187){return _0x37f124[_0xbb53('0x1c')](_0x31c3bc);}return _0x37f124[_0xbb53('0x1d')](_0x31c3bc)[_0xbb53('0x1e')]();};}function respondWithResult(_0x264cc3,_0x359b99){_0x359b99=_0x359b99||0xc8;return function(_0x4cf87e){if(_0x4cf87e){return _0x264cc3[_0xbb53('0x1d')](_0x359b99)[_0xbb53('0x1f')](_0x4cf87e);}};}function respondWithFilteredResult(_0x4a5e48,_0x36c84c){return function(_0x9b101f){if(_0x9b101f){var _0x54f24d=_0x9b101f['count'],_0x2f4532=_0x36c84c[_0xbb53('0x20')],_0x265308=_0x36c84c['offset']+_0x36c84c[_0xbb53('0x21')],_0x565880;if(_0x265308>=_0x54f24d){_0x265308=_0x54f24d;_0x565880=0xc8;}else{_0x565880=0xce;}_0x4a5e48[_0xbb53('0x1d')](_0x565880);return _0x4a5e48[_0xbb53('0x22')]('Content-Range',_0x2f4532+'-'+_0x265308+'/'+_0x54f24d)[_0xbb53('0x1f')](_0x9b101f);}return null;};}function patchUpdates(_0x203a00){return function(_0x44b0a5){try{jsonpatch[_0xbb53('0x23')](_0x44b0a5,_0x203a00,!![]);}catch(_0x464ada){return BPromise[_0xbb53('0x24')](_0x464ada);}return _0x44b0a5[_0xbb53('0x25')]();};}function saveUpdates(_0x20ec73,_0x46e506){return function(_0x9dd8c5){if(_0x9dd8c5){return _0x9dd8c5[_0xbb53('0x26')](_0x20ec73)[_0xbb53('0x27')](function(_0x14635b){return _0x14635b;});}return null;};}function removeEntity(_0x1bb4ac,_0x44731a){return function(_0x16aa88){if(_0x16aa88){return _0x16aa88['destroy']()['then'](function(){var _0x490d62=_0x16aa88[_0xbb53('0x28')]({'plain':!![]});var _0x5ba377=_0xbb53('0x29');return db[_0xbb53('0x2a')][_0xbb53('0x2b')]({'where':{'type':_0x5ba377,'resourceId':_0x490d62['id']}})[_0xbb53('0x27')](function(){return _0x16aa88;});})[_0xbb53('0x27')](function(){_0x1bb4ac[_0xbb53('0x1d')](0xcc)[_0xbb53('0x1e')]();});}};}function handleEntityNotFound(_0x4ee9e8,_0x579850){return function(_0x2cfb22){if(!_0x2cfb22){_0x4ee9e8[_0xbb53('0x1c')](0x194);}return _0x2cfb22;};}function handleError(_0x4e5efc,_0x35c49a){_0x35c49a=_0x35c49a||0x1f4;return function(_0x3f3b68){logger[_0xbb53('0x2c')](_0x3f3b68[_0xbb53('0x2d')]);if(_0x3f3b68[_0xbb53('0x2e')]){delete _0x3f3b68[_0xbb53('0x2e')];}_0x4e5efc[_0xbb53('0x1d')](_0x35c49a)[_0xbb53('0x2f')](_0x3f3b68);};}exports[_0xbb53('0x30')]=function(_0x25ebd6,_0x2684ac){var _0x18d8ac={},_0x3c459c={},_0x5a38a6={'count':0x0,'rows':[]};var _0x5c06ea=_[_0xbb53('0x31')](db[_0xbb53('0x32')][_0xbb53('0x33')],function(_0xa8cd9a){return{'name':_0xa8cd9a[_0xbb53('0x34')],'type':_0xa8cd9a[_0xbb53('0x35')][_0xbb53('0x36')]};});_0x3c459c[_0xbb53('0x37')]=_[_0xbb53('0x31')](_0x5c06ea,_0xbb53('0x2e'));_0x3c459c[_0xbb53('0x38')]=_['keys'](_0x25ebd6[_0xbb53('0x38')]);_0x3c459c[_0xbb53('0x39')]=_['intersection'](_0x3c459c['model'],_0x3c459c[_0xbb53('0x38')]);_0x18d8ac['attributes']=_[_0xbb53('0x3a')](_0x3c459c[_0xbb53('0x37')],qs[_0xbb53('0x3b')](_0x25ebd6[_0xbb53('0x38')][_0xbb53('0x3b')]));_0x18d8ac[_0xbb53('0x3c')]=_0x18d8ac[_0xbb53('0x3c')][_0xbb53('0x3d')]?_0x18d8ac[_0xbb53('0x3c')]:_0x3c459c['model'];if(!_0x25ebd6['query'][_0xbb53('0x3e')](_0xbb53('0x3f'))){_0x18d8ac[_0xbb53('0x21')]=qs[_0xbb53('0x21')](_0x25ebd6[_0xbb53('0x38')][_0xbb53('0x21')]);_0x18d8ac['offset']=qs[_0xbb53('0x20')](_0x25ebd6[_0xbb53('0x38')][_0xbb53('0x20')]);}_0x18d8ac[_0xbb53('0x40')]=qs[_0xbb53('0x41')](_0x25ebd6[_0xbb53('0x38')][_0xbb53('0x41')]);_0x18d8ac[_0xbb53('0x42')]=qs['filters'](_['pick'](_0x25ebd6[_0xbb53('0x38')],_0x3c459c[_0xbb53('0x39')]),_0x5c06ea);if(_0x25ebd6[_0xbb53('0x38')][_0xbb53('0x43')]){_0x18d8ac[_0xbb53('0x42')]=_[_0xbb53('0x44')](_0x18d8ac[_0xbb53('0x42')],{'$or':_[_0xbb53('0x31')](_0x5c06ea,function(_0x4a0a90){if(_0x4a0a90[_0xbb53('0x35')]!=='VIRTUAL'){var _0x3baea0={};_0x3baea0[_0x4a0a90['name']]={'$like':'%'+_0x25ebd6[_0xbb53('0x38')][_0xbb53('0x43')]+'%'};return _0x3baea0;}})});}_0x18d8ac=_[_0xbb53('0x44')]({},_0x18d8ac,_0x25ebd6[_0xbb53('0x45')]);var _0x2f57a7={'where':_0x18d8ac['where']};return db[_0xbb53('0x32')][_0xbb53('0x46')](_0x2f57a7)[_0xbb53('0x27')](function(_0x476e0f){_0x5a38a6['count']=_0x476e0f;if(_0x25ebd6[_0xbb53('0x38')][_0xbb53('0x47')]){_0x18d8ac[_0xbb53('0x48')]=[{'all':!![]}];}return db['VoiceMail'][_0xbb53('0x49')](_0x18d8ac);})['then'](function(_0x1b01ac){_0x5a38a6['rows']=_0x1b01ac;return _0x5a38a6;})[_0xbb53('0x27')](respondWithFilteredResult(_0x2684ac,_0x18d8ac))['catch'](handleError(_0x2684ac,null));};exports['show']=function(_0x448531,_0x31de26){var _0x5b29bb={'raw':!![],'where':{'id':_0x448531[_0xbb53('0x4a')]['id']}},_0x25c520={};_0x25c520[_0xbb53('0x37')]=_[_0xbb53('0x4b')](db[_0xbb53('0x32')][_0xbb53('0x33')]);_0x25c520['query']=_[_0xbb53('0x4b')](_0x448531[_0xbb53('0x38')]);_0x25c520[_0xbb53('0x39')]=_[_0xbb53('0x3a')](_0x25c520[_0xbb53('0x37')],_0x25c520['query']);_0x5b29bb['attributes']=_[_0xbb53('0x3a')](_0x25c520[_0xbb53('0x37')],qs[_0xbb53('0x3b')](_0x448531[_0xbb53('0x38')][_0xbb53('0x3b')]));_0x5b29bb[_0xbb53('0x3c')]=_0x5b29bb[_0xbb53('0x3c')][_0xbb53('0x3d')]?_0x5b29bb[_0xbb53('0x3c')]:_0x25c520[_0xbb53('0x37')];if(_0x448531[_0xbb53('0x38')][_0xbb53('0x47')]){_0x5b29bb[_0xbb53('0x48')]=[{'all':!![]}];}_0x5b29bb=_[_0xbb53('0x44')]({},_0x5b29bb,_0x448531[_0xbb53('0x45')]);return db[_0xbb53('0x32')][_0xbb53('0x4c')](_0x5b29bb)[_0xbb53('0x27')](handleEntityNotFound(_0x31de26,null))[_0xbb53('0x27')](respondWithResult(_0x31de26,null))[_0xbb53('0x4d')](handleError(_0x31de26,null));};exports['create']=function(_0x9bbe97,_0x510ece){return db[_0xbb53('0x32')]['create'](_0x9bbe97[_0xbb53('0x4e')],{})[_0xbb53('0x27')](function(_0x434114){var _0x5a2012=_0x9bbe97['user']['get']({'plain':!![]});if(!_0x5a2012)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a2012[_0xbb53('0x4f')]===_0xbb53('0x50')){var _0x4c3e83=_0x434114[_0xbb53('0x28')]({'plain':!![]});var _0x252a80=_0xbb53('0x29');return db['UserProfileSection'][_0xbb53('0x4c')]({'where':{'name':_0x252a80,'userProfileId':_0x5a2012['userProfileId']},'raw':!![]})[_0xbb53('0x27')](function(_0x534bb4){if(_0x534bb4&&_0x534bb4[_0xbb53('0x51')]===0x0){return db[_0xbb53('0x2a')][_0xbb53('0x52')]({'name':_0x4c3e83[_0xbb53('0x2e')],'resourceId':_0x4c3e83['id'],'type':_0x534bb4[_0xbb53('0x2e')],'sectionId':_0x534bb4['id']},{})['then'](function(){return _0x434114;});}else{return _0x434114;}})[_0xbb53('0x4d')](function(_0x199cdb){logger[_0xbb53('0x2c')](_0xbb53('0x53'),_0x199cdb);throw _0x199cdb;});}return _0x434114;})[_0xbb53('0x27')](respondWithResult(_0x510ece,0xc9))['catch'](handleError(_0x510ece,null));};exports[_0xbb53('0x26')]=function(_0x269a38,_0x1efec6){if(_0x269a38[_0xbb53('0x4e')]['id']){delete _0x269a38[_0xbb53('0x4e')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x269a38[_0xbb53('0x4a')]['id']}})[_0xbb53('0x27')](handleEntityNotFound(_0x1efec6,null))['then'](saveUpdates(_0x269a38[_0xbb53('0x4e')],null))['then'](respondWithResult(_0x1efec6,null))[_0xbb53('0x4d')](handleError(_0x1efec6,null));};exports[_0xbb53('0x2b')]=function(_0x42b982,_0x18f9da){return db['VoiceMail'][_0xbb53('0x4c')]({'where':{'id':_0x42b982[_0xbb53('0x4a')]['id']}})[_0xbb53('0x27')](handleEntityNotFound(_0x18f9da,null))[_0xbb53('0x27')](removeEntity(_0x18f9da,null))[_0xbb53('0x4d')](handleError(_0x18f9da,null));};exports['getMessages']=function(_0x2904d9,_0x26ed35,_0x2bc564){return db[_0xbb53('0x32')][_0xbb53('0x54')]({'where':{'id':_0x2904d9[_0xbb53('0x4a')]['id']}})['then'](handleEntityNotFound(_0x26ed35,null))[_0xbb53('0x27')](function(_0x2d6539){var _0x30d1a3;var _0x80a03b={},_0x93e540={};_0x93e540[_0xbb53('0x37')]=_['keys'](db[_0xbb53('0x55')]['rawAttributes']);_0x93e540[_0xbb53('0x38')]=_[_0xbb53('0x4b')](_0x2904d9[_0xbb53('0x38')]);_0x93e540[_0xbb53('0x39')]=_[_0xbb53('0x3a')](_0x93e540[_0xbb53('0x37')],_0x93e540[_0xbb53('0x38')]);_0x80a03b[_0xbb53('0x3c')]=_[_0xbb53('0x3a')](_0x93e540[_0xbb53('0x37')],qs[_0xbb53('0x3b')](_0x2904d9[_0xbb53('0x38')][_0xbb53('0x3b')]));_0x80a03b[_0xbb53('0x3c')]=_0x80a03b[_0xbb53('0x3c')][_0xbb53('0x3d')]?_0x80a03b['attributes']:_0x93e540[_0xbb53('0x37')];if(!_0x2904d9['query']['hasOwnProperty'](_0xbb53('0x3f'))){_0x80a03b['limit']=qs[_0xbb53('0x21')](_0x2904d9[_0xbb53('0x38')][_0xbb53('0x21')]);_0x80a03b[_0xbb53('0x20')]=qs[_0xbb53('0x20')](_0x2904d9[_0xbb53('0x38')]['offset']);}_0x80a03b[_0xbb53('0x40')]=qs['sort'](_0x2904d9[_0xbb53('0x38')][_0xbb53('0x41')]);_0x80a03b['where']=qs['filters'](_[_0xbb53('0x56')](_0x2904d9[_0xbb53('0x38')],_0x93e540[_0xbb53('0x39')]));if(_0x2904d9['query'][_0xbb53('0x43')]){_0x80a03b[_0xbb53('0x42')]=_[_0xbb53('0x44')](_0x80a03b[_0xbb53('0x42')],{'$or':_[_0xbb53('0x31')](_0x80a03b['attributes'],function(_0x40d3bb){var _0x206c55={};_0x206c55[_0x40d3bb]={'$like':'%'+_0x2904d9[_0xbb53('0x38')]['filter']+'%'};return _0x206c55;})});}_0x80a03b[_0xbb53('0x42')]=_[_0xbb53('0x44')](_0x80a03b['where'],{'mailboxuser':_0x2d6539[_0xbb53('0x57')]});_0x80a03b=_['merge']({},_0x80a03b,_0x2904d9[_0xbb53('0x45')]);return db[_0xbb53('0x55')][_0xbb53('0x58')](_0x80a03b)[_0xbb53('0x27')](respondWithFilteredResult(_0x26ed35,_0x80a03b));})['catch'](handleError(_0x26ed35,null));}; \ No newline at end of file +var _0xeb05=['destroy','get','Voicemails','UserProfileResource','error','stack','send','map','VoiceMail','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','pick','findAndCountAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','then'];(function(_0x23629f,_0x4b37fa){var _0x4d810a=function(_0x4a6d95){while(--_0x4a6d95){_0x23629f['push'](_0x23629f['shift']());}};_0x4d810a(++_0x4b37fa);}(_0xeb05,0x88));var _0x5eb0=function(_0x2edd9e,_0x19bc1f){_0x2edd9e=_0x2edd9e-0x0;var _0x35daea=_0xeb05[_0x2edd9e];return _0x35daea;};'use strict';var pdf=require(_0x5eb0('0x0'));var emlformat=require(_0x5eb0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5eb0('0x2'));var jsonpatch=require(_0x5eb0('0x3'));var rp=require(_0x5eb0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5eb0('0x5'));var sox=require(_0x5eb0('0x6'));var csv=require(_0x5eb0('0x7'));var ejs=require(_0x5eb0('0x8'));var fs=require('fs');var fs_extra=require(_0x5eb0('0x9'));var _=require('lodash');var squel=require(_0x5eb0('0xa'));var crypto=require(_0x5eb0('0xb'));var jsforce=require(_0x5eb0('0xc'));var deskjs=require(_0x5eb0('0xd'));var toCsv=require(_0x5eb0('0x7'));var querystring=require('querystring');var Papa=require(_0x5eb0('0xe'));var Redis=require(_0x5eb0('0xf'));var authService=require(_0x5eb0('0x10'));var qs=require(_0x5eb0('0x11'));var as=require(_0x5eb0('0x12'));var hardwareService=require(_0x5eb0('0x13'));var logger=require(_0x5eb0('0x14'))(_0x5eb0('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5eb0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x593fcf,_0x39f6c1){_0x39f6c1=_0x39f6c1||0xcc;return function(_0x2f1956){if(_0x2f1956){return _0x593fcf[_0x5eb0('0x17')](_0x39f6c1);}return _0x593fcf[_0x5eb0('0x18')](_0x39f6c1)[_0x5eb0('0x19')]();};}function respondWithResult(_0xee5571,_0x5a5b47){_0x5a5b47=_0x5a5b47||0xc8;return function(_0x2b1d0c){if(_0x2b1d0c){return _0xee5571['status'](_0x5a5b47)['json'](_0x2b1d0c);}};}function respondWithFilteredResult(_0x36590e,_0x1e784f){return function(_0x1bef92){if(_0x1bef92){var _0x1eb937=_0x1bef92['count'],_0x544cfc=_0x1e784f['offset'],_0x1099f2=_0x1e784f[_0x5eb0('0x1a')]+_0x1e784f[_0x5eb0('0x1b')],_0x3f418e;if(_0x1099f2>=_0x1eb937){_0x1099f2=_0x1eb937;_0x3f418e=0xc8;}else{_0x3f418e=0xce;}_0x36590e['status'](_0x3f418e);return _0x36590e[_0x5eb0('0x1c')](_0x5eb0('0x1d'),_0x544cfc+'-'+_0x1099f2+'/'+_0x1eb937)[_0x5eb0('0x1e')](_0x1bef92);}return null;};}function patchUpdates(_0x335287){return function(_0x1a0a87){try{jsonpatch['apply'](_0x1a0a87,_0x335287,!![]);}catch(_0x533d8f){return BPromise[_0x5eb0('0x1f')](_0x533d8f);}return _0x1a0a87[_0x5eb0('0x20')]();};}function saveUpdates(_0x2529be,_0xa02018){return function(_0x4dfa45){if(_0x4dfa45){return _0x4dfa45['update'](_0x2529be)[_0x5eb0('0x21')](function(_0x19f0cf){return _0x19f0cf;});}return null;};}function removeEntity(_0x3410ff,_0x58480f){return function(_0x55cbda){if(_0x55cbda){return _0x55cbda[_0x5eb0('0x22')]()['then'](function(){var _0x57d0d2=_0x55cbda[_0x5eb0('0x23')]({'plain':!![]});var _0x7829f1=_0x5eb0('0x24');return db[_0x5eb0('0x25')][_0x5eb0('0x22')]({'where':{'type':_0x7829f1,'resourceId':_0x57d0d2['id']}})[_0x5eb0('0x21')](function(){return _0x55cbda;});})['then'](function(){_0x3410ff[_0x5eb0('0x18')](0xcc)[_0x5eb0('0x19')]();});}};}function handleEntityNotFound(_0x3026f9,_0x55ee07){return function(_0x366c3f){if(!_0x366c3f){_0x3026f9['sendStatus'](0x194);}return _0x366c3f;};}function handleError(_0x719a8e,_0x48eae5){_0x48eae5=_0x48eae5||0x1f4;return function(_0x4506b5){logger[_0x5eb0('0x26')](_0x4506b5[_0x5eb0('0x27')]);if(_0x4506b5['name']){delete _0x4506b5['name'];}_0x719a8e[_0x5eb0('0x18')](_0x48eae5)[_0x5eb0('0x28')](_0x4506b5);};}exports['index']=function(_0x29bebe,_0x1d9f65){var _0x5e0568={},_0x1ba576={},_0x2535a8={'count':0x0,'rows':[]};var _0x9056d1=_[_0x5eb0('0x29')](db[_0x5eb0('0x2a')][_0x5eb0('0x2b')],function(_0x52679b){return{'name':_0x52679b['fieldName'],'type':_0x52679b[_0x5eb0('0x2c')][_0x5eb0('0x2d')]};});_0x1ba576[_0x5eb0('0x2e')]=_[_0x5eb0('0x29')](_0x9056d1,_0x5eb0('0x2f'));_0x1ba576[_0x5eb0('0x30')]=_[_0x5eb0('0x31')](_0x29bebe[_0x5eb0('0x30')]);_0x1ba576[_0x5eb0('0x32')]=_[_0x5eb0('0x33')](_0x1ba576['model'],_0x1ba576['query']);_0x5e0568[_0x5eb0('0x34')]=_['intersection'](_0x1ba576['model'],qs[_0x5eb0('0x35')](_0x29bebe['query'][_0x5eb0('0x35')]));_0x5e0568[_0x5eb0('0x34')]=_0x5e0568['attributes'][_0x5eb0('0x36')]?_0x5e0568['attributes']:_0x1ba576[_0x5eb0('0x2e')];if(!_0x29bebe[_0x5eb0('0x30')][_0x5eb0('0x37')](_0x5eb0('0x38'))){_0x5e0568[_0x5eb0('0x1b')]=qs['limit'](_0x29bebe[_0x5eb0('0x30')][_0x5eb0('0x1b')]);_0x5e0568[_0x5eb0('0x1a')]=qs['offset'](_0x29bebe[_0x5eb0('0x30')][_0x5eb0('0x1a')]);}_0x5e0568[_0x5eb0('0x39')]=qs[_0x5eb0('0x3a')](_0x29bebe[_0x5eb0('0x30')]['sort']);_0x5e0568[_0x5eb0('0x3b')]=qs[_0x5eb0('0x32')](_['pick'](_0x29bebe[_0x5eb0('0x30')],_0x1ba576[_0x5eb0('0x32')]),_0x9056d1);if(_0x29bebe[_0x5eb0('0x30')][_0x5eb0('0x3c')]){_0x5e0568['where']=_[_0x5eb0('0x3d')](_0x5e0568['where'],{'$or':_[_0x5eb0('0x29')](_0x9056d1,function(_0x55a17e){if(_0x55a17e['type']!==_0x5eb0('0x3e')){var _0x196ed4={};_0x196ed4[_0x55a17e['name']]={'$like':'%'+_0x29bebe[_0x5eb0('0x30')]['filter']+'%'};return _0x196ed4;}})});}_0x5e0568=_[_0x5eb0('0x3d')]({},_0x5e0568,_0x29bebe['options']);var _0x293623={'where':_0x5e0568['where']};return db[_0x5eb0('0x2a')][_0x5eb0('0x3f')](_0x293623)[_0x5eb0('0x21')](function(_0x17058a){_0x2535a8['count']=_0x17058a;if(_0x29bebe[_0x5eb0('0x30')][_0x5eb0('0x40')]){_0x5e0568['include']=[{'all':!![]}];}return db[_0x5eb0('0x2a')][_0x5eb0('0x41')](_0x5e0568);})['then'](function(_0x664b9){_0x2535a8[_0x5eb0('0x42')]=_0x664b9;return _0x2535a8;})[_0x5eb0('0x21')](respondWithFilteredResult(_0x1d9f65,_0x5e0568))[_0x5eb0('0x43')](handleError(_0x1d9f65,null));};exports[_0x5eb0('0x44')]=function(_0x4f205b,_0x5c4b45){var _0x2d634d={'raw':!![],'where':{'id':_0x4f205b[_0x5eb0('0x45')]['id']}},_0x46ed32={};_0x46ed32['model']=_[_0x5eb0('0x31')](db['VoiceMail']['rawAttributes']);_0x46ed32[_0x5eb0('0x30')]=_[_0x5eb0('0x31')](_0x4f205b['query']);_0x46ed32[_0x5eb0('0x32')]=_['intersection'](_0x46ed32[_0x5eb0('0x2e')],_0x46ed32[_0x5eb0('0x30')]);_0x2d634d[_0x5eb0('0x34')]=_[_0x5eb0('0x33')](_0x46ed32['model'],qs[_0x5eb0('0x35')](_0x4f205b[_0x5eb0('0x30')][_0x5eb0('0x35')]));_0x2d634d[_0x5eb0('0x34')]=_0x2d634d[_0x5eb0('0x34')]['length']?_0x2d634d[_0x5eb0('0x34')]:_0x46ed32[_0x5eb0('0x2e')];if(_0x4f205b[_0x5eb0('0x30')]['includeAll']){_0x2d634d['include']=[{'all':!![]}];}_0x2d634d=_[_0x5eb0('0x3d')]({},_0x2d634d,_0x4f205b[_0x5eb0('0x46')]);return db['VoiceMail']['find'](_0x2d634d)['then'](handleEntityNotFound(_0x5c4b45,null))[_0x5eb0('0x21')](respondWithResult(_0x5c4b45,null))[_0x5eb0('0x43')](handleError(_0x5c4b45,null));};exports[_0x5eb0('0x47')]=function(_0x2a4dac,_0xe6b372){return db['VoiceMail']['create'](_0x2a4dac[_0x5eb0('0x48')],{})[_0x5eb0('0x21')](function(_0x4cd31c){var _0x2c3a02=_0x2a4dac[_0x5eb0('0x49')][_0x5eb0('0x23')]({'plain':!![]});if(!_0x2c3a02)throw new Error(_0x5eb0('0x4a'));if(_0x2c3a02[_0x5eb0('0x4b')]==='user'){var _0x5b98f9=_0x4cd31c[_0x5eb0('0x23')]({'plain':!![]});var _0x48bc28=_0x5eb0('0x24');return db['UserProfileSection'][_0x5eb0('0x4c')]({'where':{'name':_0x48bc28,'userProfileId':_0x2c3a02['userProfileId']},'raw':!![]})[_0x5eb0('0x21')](function(_0x40990e){if(_0x40990e&&_0x40990e[_0x5eb0('0x4d')]===0x0){return db['UserProfileResource'][_0x5eb0('0x47')]({'name':_0x5b98f9['name'],'resourceId':_0x5b98f9['id'],'type':_0x40990e['name'],'sectionId':_0x40990e['id']},{})['then'](function(){return _0x4cd31c;});}else{return _0x4cd31c;}})[_0x5eb0('0x43')](function(_0x508472){logger[_0x5eb0('0x26')](_0x5eb0('0x4e'),_0x508472);throw _0x508472;});}return _0x4cd31c;})[_0x5eb0('0x21')](respondWithResult(_0xe6b372,0xc9))[_0x5eb0('0x43')](handleError(_0xe6b372,null));};exports[_0x5eb0('0x4f')]=function(_0x3b5fe4,_0x5a0ca3){if(_0x3b5fe4['body']['id']){delete _0x3b5fe4['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0x3b5fe4['params']['id']}})[_0x5eb0('0x21')](handleEntityNotFound(_0x5a0ca3,null))[_0x5eb0('0x21')](saveUpdates(_0x3b5fe4['body'],null))[_0x5eb0('0x21')](respondWithResult(_0x5a0ca3,null))[_0x5eb0('0x43')](handleError(_0x5a0ca3,null));};exports['destroy']=function(_0x174855,_0x326ffb){return db[_0x5eb0('0x2a')][_0x5eb0('0x4c')]({'where':{'id':_0x174855[_0x5eb0('0x45')]['id']}})[_0x5eb0('0x21')](handleEntityNotFound(_0x326ffb,null))[_0x5eb0('0x21')](removeEntity(_0x326ffb,null))[_0x5eb0('0x43')](handleError(_0x326ffb,null));};exports[_0x5eb0('0x50')]=function(_0x1f97d1,_0xf77efa,_0x45c6b0){return db[_0x5eb0('0x2a')][_0x5eb0('0x51')]({'where':{'id':_0x1f97d1[_0x5eb0('0x45')]['id']}})['then'](handleEntityNotFound(_0xf77efa,null))[_0x5eb0('0x21')](function(_0x4ee15e){var _0x3750a6;var _0x3e6c96={},_0x3aa177={};_0x3aa177['model']=_['keys'](db[_0x5eb0('0x52')]['rawAttributes']);_0x3aa177[_0x5eb0('0x30')]=_[_0x5eb0('0x31')](_0x1f97d1['query']);_0x3aa177[_0x5eb0('0x32')]=_[_0x5eb0('0x33')](_0x3aa177[_0x5eb0('0x2e')],_0x3aa177[_0x5eb0('0x30')]);_0x3e6c96[_0x5eb0('0x34')]=_['intersection'](_0x3aa177[_0x5eb0('0x2e')],qs[_0x5eb0('0x35')](_0x1f97d1[_0x5eb0('0x30')][_0x5eb0('0x35')]));_0x3e6c96[_0x5eb0('0x34')]=_0x3e6c96[_0x5eb0('0x34')][_0x5eb0('0x36')]?_0x3e6c96[_0x5eb0('0x34')]:_0x3aa177[_0x5eb0('0x2e')];if(!_0x1f97d1[_0x5eb0('0x30')][_0x5eb0('0x37')](_0x5eb0('0x38'))){_0x3e6c96[_0x5eb0('0x1b')]=qs['limit'](_0x1f97d1['query'][_0x5eb0('0x1b')]);_0x3e6c96[_0x5eb0('0x1a')]=qs[_0x5eb0('0x1a')](_0x1f97d1[_0x5eb0('0x30')][_0x5eb0('0x1a')]);}_0x3e6c96[_0x5eb0('0x39')]=qs[_0x5eb0('0x3a')](_0x1f97d1[_0x5eb0('0x30')]['sort']);_0x3e6c96[_0x5eb0('0x3b')]=qs[_0x5eb0('0x32')](_[_0x5eb0('0x53')](_0x1f97d1[_0x5eb0('0x30')],_0x3aa177[_0x5eb0('0x32')]));if(_0x1f97d1['query'][_0x5eb0('0x3c')]){_0x3e6c96[_0x5eb0('0x3b')]=_['merge'](_0x3e6c96['where'],{'$or':_[_0x5eb0('0x29')](_0x3e6c96[_0x5eb0('0x34')],function(_0x4916b9){var _0x1179b2={};_0x1179b2[_0x4916b9]={'$like':'%'+_0x1f97d1['query'][_0x5eb0('0x3c')]+'%'};return _0x1179b2;})});}_0x3e6c96[_0x5eb0('0x3b')]=_[_0x5eb0('0x3d')](_0x3e6c96['where'],{'mailboxuser':_0x4ee15e['mailbox']});_0x3e6c96=_[_0x5eb0('0x3d')]({},_0x3e6c96,_0x1f97d1[_0x5eb0('0x46')]);return db[_0x5eb0('0x52')][_0x5eb0('0x54')](_0x3e6c96)[_0x5eb0('0x21')](respondWithFilteredResult(_0xf77efa,_0x3e6c96));})['catch'](handleError(_0xf77efa,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 88235b5..de712dd 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 _0x0ab9=['define','VoiceMail','mailbox_context','mailbox','context','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x0ab9,0x157));var _0x90ab=function(_0x3b8edb,_0x3ccc3f){_0x3b8edb=_0x3b8edb-0x0;var _0x2e42aa=_0x0ab9[_0x3b8edb];return _0x2e42aa;};'use strict';var _=require(_0x90ab('0x0'));var util=require('util');var logger=require(_0x90ab('0x1'))('api');var moment=require('moment');var BPromise=require(_0x90ab('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90ab('0x3'));var rimraf=require(_0x90ab('0x4'));var config=require(_0x90ab('0x5'));var attributes=require(_0x90ab('0x6'));module[_0x90ab('0x7')]=function(_0x200245,_0x1b7760){return _0x200245[_0x90ab('0x8')](_0x90ab('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x90ab('0xa'),'fields':[_0x90ab('0xb'),_0x90ab('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9da=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','VoiceMail','voice_voicemail','mailbox','context'];(function(_0x32e2f7,_0x301344){var _0xbdfa78=function(_0x54ede){while(--_0x54ede){_0x32e2f7['push'](_0x32e2f7['shift']());}};_0xbdfa78(++_0x301344);}(_0xa9da,0x193));var _0xaa9d=function(_0x3dcd95,_0x4f05bb){_0x3dcd95=_0x3dcd95-0x0;var _0x6885d4=_0xa9da[_0x3dcd95];return _0x6885d4;};'use strict';var _=require(_0xaa9d('0x0'));var util=require('util');var logger=require(_0xaa9d('0x1'))(_0xaa9d('0x2'));var moment=require(_0xaa9d('0x3'));var BPromise=require(_0xaa9d('0x4'));var rp=require(_0xaa9d('0x5'));var fs=require('fs');var path=require(_0xaa9d('0x6'));var rimraf=require(_0xaa9d('0x7'));var config=require('../../config/environment');var attributes=require(_0xaa9d('0x8'));module['exports']=function(_0x47d7ac,_0x25d887){return _0x47d7ac['define'](_0xaa9d('0x9'),attributes,{'tableName':_0xaa9d('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xaa9d('0xb'),_0xaa9d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 0e8bce6..35f4d53 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 _0x852d=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x31193e,_0x5a0185){var _0xc79fc4=function(_0x33015f){while(--_0x33015f){_0x31193e['push'](_0x31193e['shift']());}};_0xc79fc4(++_0x5a0185);}(_0x852d,0x178));var _0xd852=function(_0x409cc3,_0x37cf1f){_0x409cc3=_0x409cc3-0x0;var _0x2fbe31=_0x852d[_0x409cc3];return _0x2fbe31;};'use strict';var _=require('lodash');var util=require(_0xd852('0x0'));var moment=require(_0xd852('0x1'));var BPromise=require(_0xd852('0x2'));var rs=require(_0xd852('0x3'));var fs=require('fs');var Redis=require(_0xd852('0x4'));var db=require(_0xd852('0x5'))['db'];var utils=require(_0xd852('0x6'));var logger=require('../../config/logger')(_0xd852('0x7'));var config=require(_0xd852('0x8'));var jayson=require(_0xd852('0x9'));var client=jayson[_0xd852('0xa')][_0xd852('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbd0948,_0x58a494,_0x2d7d8f){return new BPromise(function(_0x11370c,_0x4e3a4c){return client[_0xd852('0xc')](_0xbd0948,_0x2d7d8f)[_0xd852('0xd')](function(_0x46db61){logger[_0xd852('0xe')](_0xd852('0xf'),_0x58a494,_0xd852('0x10'));logger[_0xd852('0x11')](_0xd852('0x12'),_0x58a494,_0xd852('0x10'),JSON[_0xd852('0x13')](_0x46db61));if(_0x46db61[_0xd852('0x14')]){if(_0x46db61[_0xd852('0x14')][_0xd852('0x15')]===0x1f4){logger['error'](_0xd852('0xf'),_0x58a494,_0x46db61[_0xd852('0x14')][_0xd852('0x16')]);return _0x4e3a4c(_0x46db61[_0xd852('0x14')][_0xd852('0x16')]);}logger[_0xd852('0x14')]('VoiceMail,\x20%s,\x20%s',_0x58a494,_0x46db61[_0xd852('0x14')][_0xd852('0x16')]);return _0x11370c(_0x46db61[_0xd852('0x14')][_0xd852('0x16')]);}else{logger[_0xd852('0xe')](_0xd852('0xf'),_0x58a494,_0xd852('0x10'));_0x11370c(_0x46db61[_0xd852('0x17')][_0xd852('0x16')]);}})[_0xd852('0x18')](function(_0x2c6f34){logger['error']('VoiceMail,\x20%s,\x20%s',_0x58a494,_0x2c6f34);_0x4e3a4c(_0x2c6f34);});});} \ No newline at end of file +var _0xa7f6=['VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x54f060,_0x1de751){var _0xb2b587=function(_0x3d3bd5){while(--_0x3d3bd5){_0x54f060['push'](_0x54f060['shift']());}};_0xb2b587(++_0x1de751);}(_0xa7f6,0x1bf));var _0x6a7f=function(_0x43d25a,_0x4154d9){_0x43d25a=_0x43d25a-0x0;var _0x37531a=_0xa7f6[_0x43d25a];return _0x37531a;};'use strict';var _=require(_0x6a7f('0x0'));var util=require(_0x6a7f('0x1'));var moment=require(_0x6a7f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a7f('0x3'));var db=require(_0x6a7f('0x4'))['db'];var utils=require(_0x6a7f('0x5'));var logger=require(_0x6a7f('0x6'))(_0x6a7f('0x7'));var config=require(_0x6a7f('0x8'));var jayson=require(_0x6a7f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35d76a,_0x89ace2,_0xcb648b){return new BPromise(function(_0x4bef14,_0x206fc2){return client[_0x6a7f('0xa')](_0x35d76a,_0xcb648b)[_0x6a7f('0xb')](function(_0x34600a){logger[_0x6a7f('0xc')](_0x6a7f('0xd'),_0x89ace2,_0x6a7f('0xe'));logger[_0x6a7f('0xf')](_0x6a7f('0x10'),_0x89ace2,'request\x20sent',JSON[_0x6a7f('0x11')](_0x34600a));if(_0x34600a[_0x6a7f('0x12')]){if(_0x34600a[_0x6a7f('0x12')][_0x6a7f('0x13')]===0x1f4){logger[_0x6a7f('0x12')](_0x6a7f('0xd'),_0x89ace2,_0x34600a[_0x6a7f('0x12')][_0x6a7f('0x14')]);return _0x206fc2(_0x34600a[_0x6a7f('0x12')][_0x6a7f('0x14')]);}logger[_0x6a7f('0x12')](_0x6a7f('0xd'),_0x89ace2,_0x34600a[_0x6a7f('0x12')][_0x6a7f('0x14')]);return _0x4bef14(_0x34600a['error'][_0x6a7f('0x14')]);}else{logger[_0x6a7f('0xc')](_0x6a7f('0xd'),_0x89ace2,'request\x20sent');_0x4bef14(_0x34600a[_0x6a7f('0x15')][_0x6a7f('0x14')]);}})[_0x6a7f('0x16')](function(_0x204c31){logger[_0x6a7f('0x12')]('VoiceMail,\x20%s,\x20%s',_0x89ace2,_0x204c31);_0x206fc2(_0x204c31);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index bd2143a..09d1f6d 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 _0x71b1=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/download','download'];(function(_0x1564c0,_0x5980c2){var _0x310ae7=function(_0x890a86){while(--_0x890a86){_0x1564c0['push'](_0x1564c0['shift']());}};_0x310ae7(++_0x5980c2);}(_0x71b1,0x166));var _0x171b=function(_0x3d5416,_0x28a599){_0x3d5416=_0x3d5416-0x0;var _0x17712c=_0x71b1[_0x3d5416];return _0x17712c;};'use strict';var multer=require(_0x171b('0x0'));var util=require(_0x171b('0x1'));var path=require(_0x171b('0x2'));var timeout=require(_0x171b('0x3'));var express=require(_0x171b('0x4'));var router=express[_0x171b('0x5')]();var fs_extra=require(_0x171b('0x6'));var auth=require(_0x171b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x171b('0x8'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0x171b('0x9')](),controller[_0x171b('0xa')]);router[_0x171b('0xb')](_0x171b('0xc'),auth[_0x171b('0x9')](),controller[_0x171b('0xd')]);router[_0x171b('0xb')](_0x171b('0xe'),auth[_0x171b('0x9')](),controller[_0x171b('0xf')]);router[_0x171b('0x10')]('/',auth[_0x171b('0x9')](),controller[_0x171b('0x11')]);router[_0x171b('0x12')]('/:id',auth[_0x171b('0x9')](),controller['update']);router[_0x171b('0x13')](_0x171b('0xc'),auth[_0x171b('0x9')](),controller[_0x171b('0x14')]);module[_0x171b('0x15')]=router; \ No newline at end of file +var _0x75a2=['fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','download','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x75a2,0x187));var _0x275a=function(_0x24c198,_0x4ec51c){_0x24c198=_0x24c198-0x0;var _0xb196ce=_0x75a2[_0x24c198];return _0xb196ce;};'use strict';var multer=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var path=require(_0x275a('0x2'));var timeout=require('connect-timeout');var express=require(_0x275a('0x3'));var router=express[_0x275a('0x4')]();var fs_extra=require(_0x275a('0x5'));var auth=require(_0x275a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x275a('0x7'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x275a('0x8')](_0x275a('0x9'),auth[_0x275a('0xa')](),controller[_0x275a('0xb')]);router['get']('/:id/download',auth[_0x275a('0xa')](),controller[_0x275a('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x275a('0xd')](_0x275a('0x9'),auth[_0x275a('0xa')](),controller[_0x275a('0xe')]);router[_0x275a('0xf')](_0x275a('0x9'),auth[_0x275a('0xa')](),controller[_0x275a('0x10')]);module[_0x275a('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 2d0f114..cb0dd7f 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 _0x67ca=['exports','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','sequelize'];(function(_0x1cd23d,_0xec4ea5){var _0x5e8ad5=function(_0x1603d8){while(--_0x1603d8){_0x1cd23d['push'](_0x1cd23d['shift']());}};_0x5e8ad5(++_0xec4ea5);}(_0x67ca,0x179));var _0xa67c=function(_0x5ab2c1,_0x503874){_0x5ab2c1=_0x5ab2c1-0x0;var _0x4da32d=_0x67ca[_0x5ab2c1];return _0x4da32d;};'use strict';var Sequelize=require(_0xa67c('0x0'));module[_0xa67c('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x13e752){return this[_0xa67c('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xa67c('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa67c('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xa67c('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa67c('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa67c('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa67c('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa67c('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xa67c('0x5')](_0xa67c('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa67c('0x4')],'defaultValue':''},'stamp':{'type':_0xa67c('0x7'),'defaultValue':Sequelize[_0xa67c('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xfd06=['BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','STRING'];(function(_0xd0e268,_0x18863c){var _0x272c9f=function(_0x536f88){while(--_0x536f88){_0xd0e268['push'](_0xd0e268['shift']());}};_0x272c9f(++_0x18863c);}(_0xfd06,0xef));var _0x6fd0=function(_0x323fff,_0x38f93e){_0x323fff=_0x323fff-0x0;var _0x326de5=_0xfd06[_0x323fff];return _0x326de5;};'use strict';var Sequelize=require(_0x6fd0('0x0'));module[_0x6fd0('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5113f0){return this[_0x6fd0('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x6fd0('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6fd0('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6fd0('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6fd0('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x6fd0('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6fd0('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x6fd0('0x4')](_0x6fd0('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x6fd0('0x6'),'defaultValue':Sequelize[_0x6fd0('0x7')](_0x6fd0('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 934e128..8e126a5 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 _0x6772=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','destroy','then','error','stack','send','map','VoiceMailMessage','fieldName','type','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','merge','filter','options','count','includeAll','include','catch','params','rawAttributes','find','body','update','download','msg_id','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x435fd6,_0x401cbc){var _0x5c5944=function(_0x32f366){while(--_0x32f366){_0x435fd6['push'](_0x435fd6['shift']());}};_0x5c5944(++_0x401cbc);}(_0x6772,0x85));var _0x2677=function(_0x4261ab,_0x4757a9){_0x4261ab=_0x4261ab-0x0;var _0x5a20b9=_0x6772[_0x4261ab];return _0x5a20b9;};'use strict';var pdf=require(_0x2677('0x0'));var emlformat=require(_0x2677('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2677('0x2'));var jsonpatch=require(_0x2677('0x3'));var rp=require(_0x2677('0x4'));var moment=require(_0x2677('0x5'));var BPromise=require(_0x2677('0x6'));var Mustache=require(_0x2677('0x7'));var util=require(_0x2677('0x8'));var path=require('path');var sox=require(_0x2677('0x9'));var csv=require('to-csv');var ejs=require(_0x2677('0xa'));var fs=require('fs');var fs_extra=require(_0x2677('0xb'));var _=require(_0x2677('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2677('0xd'));var toCsv=require(_0x2677('0xe'));var querystring=require('querystring');var Papa=require(_0x2677('0xf'));var Redis=require(_0x2677('0x10'));var authService=require(_0x2677('0x11'));var qs=require(_0x2677('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2677('0x13'));var logger=require('../../config/logger')(_0x2677('0x14'));var utils=require(_0x2677('0x15'));var config=require(_0x2677('0x16'));var licenseUtil=require(_0x2677('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ca5a0,_0x64715e){_0x64715e=_0x64715e||0xcc;return function(_0x4218da){if(_0x4218da){return _0x3ca5a0[_0x2677('0x18')](_0x64715e);}return _0x3ca5a0[_0x2677('0x19')](_0x64715e)[_0x2677('0x1a')]();};}function respondWithResult(_0x2d8f47,_0x4f69a3){_0x4f69a3=_0x4f69a3||0xc8;return function(_0x495de0){if(_0x495de0){return _0x2d8f47['status'](_0x4f69a3)[_0x2677('0x1b')](_0x495de0);}};}function respondWithFilteredResult(_0x444b44,_0x20c1f2){return function(_0x25ccb0){if(_0x25ccb0){var _0x227d04=_0x25ccb0['count'],_0x5bb37b=_0x20c1f2[_0x2677('0x1c')],_0x383e05=_0x20c1f2[_0x2677('0x1c')]+_0x20c1f2[_0x2677('0x1d')],_0xac80d2;if(_0x383e05>=_0x227d04){_0x383e05=_0x227d04;_0xac80d2=0xc8;}else{_0xac80d2=0xce;}_0x444b44[_0x2677('0x19')](_0xac80d2);return _0x444b44[_0x2677('0x1e')](_0x2677('0x1f'),_0x5bb37b+'-'+_0x383e05+'/'+_0x227d04)['json'](_0x25ccb0);}return null;};}function patchUpdates(_0x3096a3){return function(_0x1379cf){try{jsonpatch[_0x2677('0x20')](_0x1379cf,_0x3096a3,!![]);}catch(_0x37729a){return BPromise['reject'](_0x37729a);}return _0x1379cf[_0x2677('0x21')]();};}function saveUpdates(_0x73107c,_0x5c1e85){return function(_0x556e18){if(_0x556e18){return _0x556e18['update'](_0x73107c)['then'](function(_0x33a61a){return _0x33a61a;});}return null;};}function removeEntity(_0x73eff9,_0x4514c1){return function(_0x6fcb91){if(_0x6fcb91){return _0x6fcb91[_0x2677('0x22')]()[_0x2677('0x23')](function(){_0x73eff9['status'](0xcc)[_0x2677('0x1a')]();});}};}function handleEntityNotFound(_0x409723,_0x101451){return function(_0x323048){if(!_0x323048){_0x409723['sendStatus'](0x194);}return _0x323048;};}function handleError(_0xf7b5ed,_0x3e63b1){_0x3e63b1=_0x3e63b1||0x1f4;return function(_0x16da56){logger[_0x2677('0x24')](_0x16da56[_0x2677('0x25')]);if(_0x16da56['name']){delete _0x16da56['name'];}_0xf7b5ed[_0x2677('0x19')](_0x3e63b1)[_0x2677('0x26')](_0x16da56);};}exports['index']=function(_0x460f37,_0x9963c8){var _0x5440c2={},_0x4f7c24={},_0x56143b={'count':0x0,'rows':[]};var _0x21dc2d=_[_0x2677('0x27')](db[_0x2677('0x28')]['rawAttributes'],function(_0x3d52a3){return{'name':_0x3d52a3[_0x2677('0x29')],'type':_0x3d52a3[_0x2677('0x2a')]['key']};});_0x4f7c24[_0x2677('0x2b')]=_['differenceBy'](_[_0x2677('0x27')](_0x21dc2d,_0x2677('0x2c')),[_0x2677('0x2c')]);_0x4f7c24[_0x2677('0x2d')]=_[_0x2677('0x2e')](_0x460f37['query']);_0x4f7c24['filters']=_[_0x2677('0x2f')](_0x4f7c24[_0x2677('0x2b')],_0x4f7c24['query']);_0x5440c2[_0x2677('0x30')]=_[_0x2677('0x2f')](_0x4f7c24['model'],qs[_0x2677('0x31')](_0x460f37['query'][_0x2677('0x31')]));_0x5440c2[_0x2677('0x30')]=_0x5440c2[_0x2677('0x30')][_0x2677('0x32')]?_0x5440c2['attributes']:_0x4f7c24['model'];if(!_0x460f37[_0x2677('0x2d')][_0x2677('0x33')](_0x2677('0x34'))){_0x5440c2[_0x2677('0x1d')]=qs[_0x2677('0x1d')](_0x460f37['query'][_0x2677('0x1d')]);_0x5440c2[_0x2677('0x1c')]=qs[_0x2677('0x1c')](_0x460f37['query'][_0x2677('0x1c')]);}_0x5440c2[_0x2677('0x35')]=qs['sort'](_0x460f37[_0x2677('0x2d')]['sort']);_0x5440c2[_0x2677('0x36')]=qs[_0x2677('0x37')](_['pick'](_0x460f37[_0x2677('0x2d')],_0x4f7c24[_0x2677('0x37')]),_0x21dc2d);if(_0x460f37[_0x2677('0x2d')]['filter']){_0x5440c2[_0x2677('0x36')]=_[_0x2677('0x38')](_0x5440c2[_0x2677('0x36')],{'$or':_[_0x2677('0x27')](_0x21dc2d,function(_0x320826){if(_0x320826[_0x2677('0x2a')]!=='VIRTUAL'){var _0x3e728e={};_0x3e728e[_0x320826[_0x2677('0x2c')]]={'$like':'%'+_0x460f37[_0x2677('0x2d')][_0x2677('0x39')]+'%'};return _0x3e728e;}})});}_0x5440c2=_[_0x2677('0x38')]({},_0x5440c2,_0x460f37[_0x2677('0x3a')]);var _0x556dc4={'where':_0x5440c2['where']};return db[_0x2677('0x28')][_0x2677('0x3b')](_0x556dc4)[_0x2677('0x23')](function(_0xd44e5e){_0x56143b[_0x2677('0x3b')]=_0xd44e5e;if(_0x460f37[_0x2677('0x2d')][_0x2677('0x3c')]){_0x5440c2[_0x2677('0x3d')]=[{'all':!![]}];}return db[_0x2677('0x28')]['findAll'](_0x5440c2);})[_0x2677('0x23')](function(_0x3ceb31){_0x56143b['rows']=_0x3ceb31;return _0x56143b;})[_0x2677('0x23')](respondWithFilteredResult(_0x9963c8,_0x5440c2))[_0x2677('0x3e')](handleError(_0x9963c8,null));};exports['show']=function(_0x330c12,_0x560d67){var _0x3550e1={'raw':!![],'where':{'id':_0x330c12[_0x2677('0x3f')]['id']}},_0x117567={};_0x117567[_0x2677('0x2b')]=_[_0x2677('0x2e')](db[_0x2677('0x28')][_0x2677('0x40')]);_0x117567[_0x2677('0x2d')]=_[_0x2677('0x2e')](_0x330c12[_0x2677('0x2d')]);_0x117567[_0x2677('0x37')]=_[_0x2677('0x2f')](_0x117567[_0x2677('0x2b')],_0x117567[_0x2677('0x2d')]);_0x3550e1['attributes']=_['intersection'](_0x117567[_0x2677('0x2b')],qs[_0x2677('0x31')](_0x330c12[_0x2677('0x2d')]['fields']));_0x3550e1[_0x2677('0x30')]=_0x3550e1[_0x2677('0x30')][_0x2677('0x32')]?_0x3550e1[_0x2677('0x30')]:_0x117567['model'];if(_0x330c12['query'][_0x2677('0x3c')]){_0x3550e1[_0x2677('0x3d')]=[{'all':!![]}];}_0x3550e1=_[_0x2677('0x38')]({},_0x3550e1,_0x330c12['options']);return db['VoiceMailMessage'][_0x2677('0x41')](_0x3550e1)[_0x2677('0x23')](handleEntityNotFound(_0x560d67,null))['then'](respondWithResult(_0x560d67,null))[_0x2677('0x3e')](handleError(_0x560d67,null));};exports['create']=function(_0x14a355,_0x4c584a){return db[_0x2677('0x28')]['create'](_0x14a355[_0x2677('0x42')],{})[_0x2677('0x23')](respondWithResult(_0x4c584a,0xc9))['catch'](handleError(_0x4c584a,null));};exports[_0x2677('0x43')]=function(_0x3d6f21,_0x169f1f){if(_0x3d6f21['body']['id']){delete _0x3d6f21[_0x2677('0x42')]['id'];}return db[_0x2677('0x28')][_0x2677('0x41')]({'where':{'id':_0x3d6f21[_0x2677('0x3f')]['id']}})[_0x2677('0x23')](handleEntityNotFound(_0x169f1f,null))[_0x2677('0x23')](saveUpdates(_0x3d6f21[_0x2677('0x42')],null))[_0x2677('0x23')](respondWithResult(_0x169f1f,null))['catch'](handleError(_0x169f1f,null));};exports['destroy']=function(_0x5b739b,_0x3ffa1e){return db[_0x2677('0x28')]['find']({'where':{'id':_0x5b739b[_0x2677('0x3f')]['id']}})[_0x2677('0x23')](handleEntityNotFound(_0x3ffa1e,null))[_0x2677('0x23')](removeEntity(_0x3ffa1e,null))['catch'](handleError(_0x3ffa1e,null));};exports[_0x2677('0x44')]=function(_0x58e23e,_0x2a96d4,_0x18ae54){return db[_0x2677('0x28')][_0x2677('0x41')]({'where':{'id':_0x58e23e['params']['id']},'attributes':['id','recording',_0x2677('0x45')]})[_0x2677('0x23')](handleEntityNotFound(_0x2a96d4,null))['then'](function(_0x801770){if(_0x801770){if(!_0x801770[_0x2677('0x46')]){throw new db[(_0x2677('0x47'))]['ValidationError'](_0x2677('0x48'));}var _0x12eda2={'Content-Type':_0x2677('0x49'),'Content-Disposition':'attachment'};if(_0x801770[_0x2677('0x45')]){_0x12eda2[_0x2677('0x4a')]=_0x2677('0x4b')+_0x801770[_0x2677('0x45')]+_0x2677('0x4c');}_0x2a96d4['set'](_0x12eda2);return _0x2a96d4[_0x2677('0x26')](new Buffer(_0x801770['recording']));}})[_0x2677('0x3e')](handleError(_0x2a96d4,null));}; \ No newline at end of file +var _0x10c1=['show','params','rawAttributes','length','options','find','create','body','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','apply','update','then','destroy','error','stack','name','map','VoiceMailMessage','fieldName','key','model','differenceBy','keys','intersection','fields','query','attributes','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch'];(function(_0x4f520c,_0x5a9724){var _0x37eb89=function(_0x4c509f){while(--_0x4c509f){_0x4f520c['push'](_0x4f520c['shift']());}};_0x37eb89(++_0x5a9724);}(_0x10c1,0x1b0));var _0x110c=function(_0x1b8e65,_0x4f874b){_0x1b8e65=_0x1b8e65-0x0;var _0x299843=_0x10c1[_0x1b8e65];return _0x299843;};'use strict';var pdf=require(_0x110c('0x0'));var emlformat=require(_0x110c('0x1'));var rimraf=require(_0x110c('0x2'));var zipdir=require(_0x110c('0x3'));var jsonpatch=require(_0x110c('0x4'));var rp=require('request-promise');var moment=require(_0x110c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x110c('0x6'));var util=require(_0x110c('0x7'));var path=require(_0x110c('0x8'));var sox=require('sox');var csv=require(_0x110c('0x9'));var ejs=require(_0x110c('0xa'));var fs=require('fs');var fs_extra=require(_0x110c('0xb'));var _=require(_0x110c('0xc'));var squel=require(_0x110c('0xd'));var crypto=require(_0x110c('0xe'));var jsforce=require(_0x110c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x110c('0x10'));var Papa=require(_0x110c('0x11'));var Redis=require(_0x110c('0x12'));var authService=require(_0x110c('0x13'));var qs=require(_0x110c('0x14'));var as=require(_0x110c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x110c('0x16'));var utils=require(_0x110c('0x17'));var config=require(_0x110c('0x18'));var licenseUtil=require(_0x110c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26018d,_0x4d6de5){_0x4d6de5=_0x4d6de5||0xcc;return function(_0x3b6d2c){if(_0x3b6d2c){return _0x26018d[_0x110c('0x1a')](_0x4d6de5);}return _0x26018d[_0x110c('0x1b')](_0x4d6de5)[_0x110c('0x1c')]();};}function respondWithResult(_0x51846e,_0x53d6eb){_0x53d6eb=_0x53d6eb||0xc8;return function(_0x1a9933){if(_0x1a9933){return _0x51846e[_0x110c('0x1b')](_0x53d6eb)[_0x110c('0x1d')](_0x1a9933);}};}function respondWithFilteredResult(_0x4627a3,_0x54dc13){return function(_0x4d732b){if(_0x4d732b){var _0x30e709=_0x4d732b[_0x110c('0x1e')],_0x1ed340=_0x54dc13[_0x110c('0x1f')],_0x4d90a2=_0x54dc13[_0x110c('0x1f')]+_0x54dc13[_0x110c('0x20')],_0x3f6ae6;if(_0x4d90a2>=_0x30e709){_0x4d90a2=_0x30e709;_0x3f6ae6=0xc8;}else{_0x3f6ae6=0xce;}_0x4627a3['status'](_0x3f6ae6);return _0x4627a3[_0x110c('0x21')]('Content-Range',_0x1ed340+'-'+_0x4d90a2+'/'+_0x30e709)['json'](_0x4d732b);}return null;};}function patchUpdates(_0x109a8e){return function(_0x5eae32){try{jsonpatch[_0x110c('0x22')](_0x5eae32,_0x109a8e,!![]);}catch(_0x1bb91b){return BPromise['reject'](_0x1bb91b);}return _0x5eae32['save']();};}function saveUpdates(_0x113301,_0x3b38d4){return function(_0x442806){if(_0x442806){return _0x442806[_0x110c('0x23')](_0x113301)[_0x110c('0x24')](function(_0x328bee){return _0x328bee;});}return null;};}function removeEntity(_0x40c53e,_0x24d64d){return function(_0x78e252){if(_0x78e252){return _0x78e252[_0x110c('0x25')]()[_0x110c('0x24')](function(){_0x40c53e[_0x110c('0x1b')](0xcc)[_0x110c('0x1c')]();});}};}function handleEntityNotFound(_0x248212,_0x37fa22){return function(_0x3b2da7){if(!_0x3b2da7){_0x248212[_0x110c('0x1a')](0x194);}return _0x3b2da7;};}function handleError(_0x3c6c24,_0x5a83da){_0x5a83da=_0x5a83da||0x1f4;return function(_0x4a9d1b){logger[_0x110c('0x26')](_0x4a9d1b[_0x110c('0x27')]);if(_0x4a9d1b[_0x110c('0x28')]){delete _0x4a9d1b[_0x110c('0x28')];}_0x3c6c24[_0x110c('0x1b')](_0x5a83da)['send'](_0x4a9d1b);};}exports['index']=function(_0x4c6e92,_0x5a493d){var _0x314a9b={},_0x5322bc={},_0x360a46={'count':0x0,'rows':[]};var _0x53f6d1=_[_0x110c('0x29')](db[_0x110c('0x2a')]['rawAttributes'],function(_0x5d2cde){return{'name':_0x5d2cde[_0x110c('0x2b')],'type':_0x5d2cde['type'][_0x110c('0x2c')]};});_0x5322bc[_0x110c('0x2d')]=_[_0x110c('0x2e')](_[_0x110c('0x29')](_0x53f6d1,_0x110c('0x28')),[_0x110c('0x28')]);_0x5322bc['query']=_[_0x110c('0x2f')](_0x4c6e92['query']);_0x5322bc['filters']=_[_0x110c('0x30')](_0x5322bc[_0x110c('0x2d')],_0x5322bc['query']);_0x314a9b['attributes']=_[_0x110c('0x30')](_0x5322bc[_0x110c('0x2d')],qs[_0x110c('0x31')](_0x4c6e92[_0x110c('0x32')][_0x110c('0x31')]));_0x314a9b[_0x110c('0x33')]=_0x314a9b[_0x110c('0x33')]['length']?_0x314a9b[_0x110c('0x33')]:_0x5322bc['model'];if(!_0x4c6e92[_0x110c('0x32')]['hasOwnProperty'](_0x110c('0x34'))){_0x314a9b[_0x110c('0x20')]=qs[_0x110c('0x20')](_0x4c6e92['query'][_0x110c('0x20')]);_0x314a9b[_0x110c('0x1f')]=qs[_0x110c('0x1f')](_0x4c6e92[_0x110c('0x32')][_0x110c('0x1f')]);}_0x314a9b[_0x110c('0x35')]=qs[_0x110c('0x36')](_0x4c6e92['query'][_0x110c('0x36')]);_0x314a9b[_0x110c('0x37')]=qs[_0x110c('0x38')](_[_0x110c('0x39')](_0x4c6e92[_0x110c('0x32')],_0x5322bc['filters']),_0x53f6d1);if(_0x4c6e92[_0x110c('0x32')][_0x110c('0x3a')]){_0x314a9b[_0x110c('0x37')]=_[_0x110c('0x3b')](_0x314a9b[_0x110c('0x37')],{'$or':_['map'](_0x53f6d1,function(_0x4f974c){if(_0x4f974c[_0x110c('0x3c')]!==_0x110c('0x3d')){var _0x57caab={};_0x57caab[_0x4f974c[_0x110c('0x28')]]={'$like':'%'+_0x4c6e92[_0x110c('0x32')][_0x110c('0x3a')]+'%'};return _0x57caab;}})});}_0x314a9b=_[_0x110c('0x3b')]({},_0x314a9b,_0x4c6e92['options']);var _0x575dd1={'where':_0x314a9b[_0x110c('0x37')]};return db[_0x110c('0x2a')]['count'](_0x575dd1)['then'](function(_0x3ef700){_0x360a46[_0x110c('0x1e')]=_0x3ef700;if(_0x4c6e92[_0x110c('0x32')][_0x110c('0x3e')]){_0x314a9b['include']=[{'all':!![]}];}return db[_0x110c('0x2a')][_0x110c('0x3f')](_0x314a9b);})[_0x110c('0x24')](function(_0x18f7f0){_0x360a46[_0x110c('0x40')]=_0x18f7f0;return _0x360a46;})['then'](respondWithFilteredResult(_0x5a493d,_0x314a9b))[_0x110c('0x41')](handleError(_0x5a493d,null));};exports[_0x110c('0x42')]=function(_0x36fbc7,_0xfcbea6){var _0xb3ccb0={'raw':!![],'where':{'id':_0x36fbc7[_0x110c('0x43')]['id']}},_0x21b943={};_0x21b943[_0x110c('0x2d')]=_[_0x110c('0x2f')](db[_0x110c('0x2a')][_0x110c('0x44')]);_0x21b943['query']=_['keys'](_0x36fbc7[_0x110c('0x32')]);_0x21b943[_0x110c('0x38')]=_[_0x110c('0x30')](_0x21b943[_0x110c('0x2d')],_0x21b943['query']);_0xb3ccb0[_0x110c('0x33')]=_[_0x110c('0x30')](_0x21b943[_0x110c('0x2d')],qs[_0x110c('0x31')](_0x36fbc7['query'][_0x110c('0x31')]));_0xb3ccb0['attributes']=_0xb3ccb0[_0x110c('0x33')][_0x110c('0x45')]?_0xb3ccb0[_0x110c('0x33')]:_0x21b943[_0x110c('0x2d')];if(_0x36fbc7['query'][_0x110c('0x3e')]){_0xb3ccb0['include']=[{'all':!![]}];}_0xb3ccb0=_[_0x110c('0x3b')]({},_0xb3ccb0,_0x36fbc7[_0x110c('0x46')]);return db[_0x110c('0x2a')][_0x110c('0x47')](_0xb3ccb0)[_0x110c('0x24')](handleEntityNotFound(_0xfcbea6,null))[_0x110c('0x24')](respondWithResult(_0xfcbea6,null))['catch'](handleError(_0xfcbea6,null));};exports['create']=function(_0x7f61dc,_0x3427af){return db[_0x110c('0x2a')][_0x110c('0x48')](_0x7f61dc['body'],{})[_0x110c('0x24')](respondWithResult(_0x3427af,0xc9))['catch'](handleError(_0x3427af,null));};exports[_0x110c('0x23')]=function(_0x5d1a97,_0x3d6859){if(_0x5d1a97[_0x110c('0x49')]['id']){delete _0x5d1a97[_0x110c('0x49')]['id'];}return db[_0x110c('0x2a')][_0x110c('0x47')]({'where':{'id':_0x5d1a97[_0x110c('0x43')]['id']}})[_0x110c('0x24')](handleEntityNotFound(_0x3d6859,null))[_0x110c('0x24')](saveUpdates(_0x5d1a97[_0x110c('0x49')],null))[_0x110c('0x24')](respondWithResult(_0x3d6859,null))[_0x110c('0x41')](handleError(_0x3d6859,null));};exports[_0x110c('0x25')]=function(_0x275303,_0x5a0d2a){return db[_0x110c('0x2a')][_0x110c('0x47')]({'where':{'id':_0x275303[_0x110c('0x43')]['id']}})[_0x110c('0x24')](handleEntityNotFound(_0x5a0d2a,null))[_0x110c('0x24')](removeEntity(_0x5a0d2a,null))[_0x110c('0x41')](handleError(_0x5a0d2a,null));};exports[_0x110c('0x4a')]=function(_0x55f044,_0x5059cf,_0xae31ef){return db['VoiceMailMessage'][_0x110c('0x47')]({'where':{'id':_0x55f044[_0x110c('0x43')]['id']},'attributes':['id','recording',_0x110c('0x4b')]})[_0x110c('0x24')](handleEntityNotFound(_0x5059cf,null))[_0x110c('0x24')](function(_0x59926a){if(_0x59926a){if(!_0x59926a[_0x110c('0x4c')]){throw new db[(_0x110c('0x4d'))][(_0x110c('0x4e'))](_0x110c('0x4f'));}var _0x5c47b5={'Content-Type':'audio/wav','Content-Disposition':_0x110c('0x50')};if(_0x59926a['msg_id']){_0x5c47b5['Content-Disposition']=_0x110c('0x51')+_0x59926a[_0x110c('0x4b')]+_0x110c('0x52');}_0x5059cf[_0x110c('0x21')](_0x5c47b5);return _0x5059cf['send'](new Buffer(_0x59926a[_0x110c('0x4c')]));}})[_0x110c('0x41')](handleError(_0x5059cf,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index ff06e17..bf1a025 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 _0xedd1=['../../config/logger','api','bluebird','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x52a6e8,_0x16240d){var _0x28a198=function(_0x16760e){while(--_0x16760e){_0x52a6e8['push'](_0x52a6e8['shift']());}};_0x28a198(++_0x16240d);}(_0xedd1,0xfb));var _0x1edd=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0xedd1[_0x5a79e2];return _0x266c45;};'use strict';var _=require(_0x1edd('0x0'));var util=require('util');var logger=require(_0x1edd('0x1'))(_0x1edd('0x2'));var moment=require('moment');var BPromise=require(_0x1edd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1edd('0x4'));var config=require(_0x1edd('0x5'));var attributes=require(_0x1edd('0x6'));module[_0x1edd('0x7')]=function(_0x10d74e,_0x1d053e){return _0x10d74e[_0x1edd('0x8')](_0x1edd('0x9'),attributes,{'tableName':_0x1edd('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x1edd('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x253d=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./voiceMailMessage.attributes','exports','define'];(function(_0x1194a0,_0x5a0981){var _0x190f84=function(_0x4be721){while(--_0x4be721){_0x1194a0['push'](_0x1194a0['shift']());}};_0x190f84(++_0x5a0981);}(_0x253d,0xac));var _0xd253=function(_0x26d4fd,_0x385a2e){_0x26d4fd=_0x26d4fd-0x0;var _0x2ef6f0=_0x253d[_0x26d4fd];return _0x2ef6f0;};'use strict';var _=require(_0xd253('0x0'));var util=require(_0xd253('0x1'));var logger=require(_0xd253('0x2'))(_0xd253('0x3'));var moment=require(_0xd253('0x4'));var BPromise=require('bluebird');var rp=require(_0xd253('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd253('0x6'));var attributes=require(_0xd253('0x7'));module[_0xd253('0x8')]=function(_0x48f1e7,_0x483f73){return _0x48f1e7[_0xd253('0x9')](_0xd253('0xa'),attributes,{'tableName':_0xd253('0xb'),'paranoid':![],'indexes':[{'name':_0xd253('0xc'),'fields':[_0xd253('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 eff00f5..7519d71 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4dde74,_0x2c4415){var _0x10fca6=function(_0x1e53bc){while(--_0x1e53bc){_0x4dde74['push'](_0x4dde74['shift']());}};_0x10fca6(++_0x2c4415);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5000be,_0x3f5754){_0x5000be=_0x5000be-0x0;var _0x24ca84=_0x5f2f[_0x5000be];return _0x24ca84;};'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')]('VoiceMailMessage,\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 _0x1967=['then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0x1967,0x173));var _0x7196=function(_0x1df8c3,_0x2426c8){_0x1df8c3=_0x1df8c3-0x0;var _0x7eba89=_0x1967[_0x1df8c3];return _0x7eba89;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index b0eb7d0..2c22bf8 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 _0x1986=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','index','/:id','show','get','/:id/sounds','isAuthenticated','getSounds','post','addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer'];(function(_0x4b5f87,_0x35de99){var _0x41cc50=function(_0x389330){while(--_0x389330){_0x4b5f87['push'](_0x4b5f87['shift']());}};_0x41cc50(++_0x35de99);}(_0x1986,0xf1));var _0x6198=function(_0x1bf20d,_0x3db96f){_0x1bf20d=_0x1bf20d-0x0;var _0x3d9fa1=_0x1986[_0x1bf20d];return _0x3d9fa1;};'use strict';var multer=require(_0x6198('0x0'));var util=require(_0x6198('0x1'));var path=require(_0x6198('0x2'));var timeout=require(_0x6198('0x3'));var express=require('express');var router=express[_0x6198('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6198('0x5'));var interaction=require(_0x6198('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6198('0x7')]);router['get'](_0x6198('0x8'),auth['isAuthenticated'](),controller[_0x6198('0x9')]);router[_0x6198('0xa')](_0x6198('0xb'),auth[_0x6198('0xc')](),controller[_0x6198('0xd')]);router[_0x6198('0xe')]('/',auth[_0x6198('0xc')](),controller['create']);router[_0x6198('0xe')](_0x6198('0xb'),auth[_0x6198('0xc')](),controller[_0x6198('0xf')]);router['put'](_0x6198('0x8'),auth['isAuthenticated'](),controller[_0x6198('0x10')]);router[_0x6198('0x11')]('/:id',auth[_0x6198('0xc')](),controller[_0x6198('0x12')]);router[_0x6198('0x11')](_0x6198('0x13'),auth['isAuthenticated'](),controller[_0x6198('0x14')]);module[_0x6198('0x15')]=router; \ No newline at end of file +var _0xfdac=['addSound','put','update','delete','destroy','removeSound','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceMusicOnHold.controller','index','get','/:id','isAuthenticated','show','/:id/sounds','post','create'];(function(_0x52096b,_0x20bab4){var _0x2b1cc7=function(_0x3f7021){while(--_0x3f7021){_0x52096b['push'](_0x52096b['shift']());}};_0x2b1cc7(++_0x20bab4);}(_0xfdac,0x8a));var _0xcfda=function(_0x208794,_0x1c0f46){_0x208794=_0x208794-0x0;var _0x4b58f1=_0xfdac[_0x208794];return _0x4b58f1;};'use strict';var multer=require(_0xcfda('0x0'));var util=require('util');var path=require(_0xcfda('0x1'));var timeout=require(_0xcfda('0x2'));var express=require(_0xcfda('0x3'));var router=express[_0xcfda('0x4')]();var fs_extra=require(_0xcfda('0x5'));var auth=require(_0xcfda('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcfda('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcfda('0x8')]);router[_0xcfda('0x9')](_0xcfda('0xa'),auth[_0xcfda('0xb')](),controller[_0xcfda('0xc')]);router[_0xcfda('0x9')](_0xcfda('0xd'),auth[_0xcfda('0xb')](),controller['getSounds']);router[_0xcfda('0xe')]('/',auth['isAuthenticated'](),controller[_0xcfda('0xf')]);router['post'](_0xcfda('0xd'),auth[_0xcfda('0xb')](),controller[_0xcfda('0x10')]);router[_0xcfda('0x11')](_0xcfda('0xa'),auth[_0xcfda('0xb')](),controller[_0xcfda('0x12')]);router[_0xcfda('0x13')](_0xcfda('0xa'),auth[_0xcfda('0xb')](),controller[_0xcfda('0x14')]);router['delete']('/:id/sounds/:id2',auth[_0xcfda('0xb')](),controller[_0xcfda('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 9c6fb7f..1550ee7 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 _0x3b4c=['custom','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM'];(function(_0x12adcf,_0x16d51f){var _0x4c0f37=function(_0x47beea){while(--_0x47beea){_0x12adcf['push'](_0x12adcf['shift']());}};_0x4c0f37(++_0x16d51f);}(_0x3b4c,0xf2));var _0xc3b4=function(_0xb8ace2,_0x4a96a3){_0xb8ace2=_0xb8ace2-0x0;var _0xe747d8=_0x3b4c[_0xb8ace2];return _0xe747d8;};'use strict';var Sequelize=require(_0xc3b4('0x0'));module[_0xc3b4('0x1')]={'name':{'type':Sequelize[_0xc3b4('0x2')],'allowNull':![],'unique':_0xc3b4('0x3')},'mode':{'type':Sequelize[_0xc3b4('0x4')](_0xc3b4('0x5'),'files',_0xc3b4('0x6'),_0xc3b4('0x7'),_0xc3b4('0x8'),_0xc3b4('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xc3b4('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xc3b4('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xc3b4('0x2')],'allowNull':!![],'defaultValue':_0xc3b4('0xa')},'format':{'type':Sequelize[_0xc3b4('0x2')],'allowNull':!![]},'stamp':{'type':_0xc3b4('0xb')},'defaultEntry':{'type':Sequelize[_0xc3b4('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x663e=['STRING','name','ENUM','custom','files','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize','exports'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x663e,0x112));var _0xe663=function(_0x2e2e4f,_0x4590ba){_0x2e2e4f=_0x2e2e4f-0x0;var _0x7fdd22=_0x663e[_0x2e2e4f];return _0x7fdd22;};'use strict';var Sequelize=require(_0xe663('0x0'));module[_0xe663('0x1')]={'name':{'type':Sequelize[_0xe663('0x2')],'allowNull':![],'unique':_0xe663('0x3')},'mode':{'type':Sequelize[_0xe663('0x4')](_0xe663('0x5'),_0xe663('0x6'),'mp3nb',_0xe663('0x7'),_0xe663('0x8'),_0xe663('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xe663('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xe663('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xe663('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xe663('0x2')],'allowNull':!![],'defaultValue':_0xe663('0xa')},'format':{'type':Sequelize[_0xe663('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xe663('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 121973e..24755a9 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 _0x570c=['basename','extname','converted_format','ValidationError','removeSound','createdAt','getSounds','Sound','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','get','MusicOnHolds','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','sequelize','transaction','mode','files','directory','join','root','server/files/moh','create','mkdirSync','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','findOne','save_name','server/files/sounds/converted','format','%s.%s'];(function(_0x33b5f1,_0x38811e){var _0x2802cf=function(_0x5d5891){while(--_0x5d5891){_0x33b5f1['push'](_0x33b5f1['shift']());}};_0x2802cf(++_0x38811e);}(_0x570c,0x1d0));var _0xc570=function(_0x12d33b,_0x38a281){_0x12d33b=_0x12d33b-0x0;var _0x5cc815=_0x570c[_0x12d33b];return _0x5cc815;};'use strict';var pdf=require(_0xc570('0x0'));var emlformat=require(_0xc570('0x1'));var rimraf=require(_0xc570('0x2'));var zipdir=require(_0xc570('0x3'));var jsonpatch=require(_0xc570('0x4'));var rp=require('request-promise');var moment=require(_0xc570('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc570('0x6'));var path=require('path');var sox=require(_0xc570('0x7'));var csv=require(_0xc570('0x8'));var ejs=require(_0xc570('0x9'));var fs=require('fs');var fs_extra=require(_0xc570('0xa'));var _=require(_0xc570('0xb'));var squel=require(_0xc570('0xc'));var crypto=require('crypto');var jsforce=require(_0xc570('0xd'));var deskjs=require(_0xc570('0xe'));var toCsv=require(_0xc570('0x8'));var querystring=require(_0xc570('0xf'));var Papa=require(_0xc570('0x10'));var Redis=require(_0xc570('0x11'));var authService=require(_0xc570('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc570('0x13'));var logger=require(_0xc570('0x14'))(_0xc570('0x15'));var utils=require(_0xc570('0x16'));var config=require(_0xc570('0x17'));var licenseUtil=require(_0xc570('0x18'));var db=require(_0xc570('0x19'))['db'];function respondWithStatusCode(_0x3e4faf,_0x10ee7f){_0x10ee7f=_0x10ee7f||0xcc;return function(_0x3c01fd){if(_0x3c01fd){return _0x3e4faf[_0xc570('0x1a')](_0x10ee7f);}return _0x3e4faf[_0xc570('0x1b')](_0x10ee7f)['end']();};}function respondWithResult(_0xf37fa2,_0x2a4c48){_0x2a4c48=_0x2a4c48||0xc8;return function(_0x3c32f0){if(_0x3c32f0){return _0xf37fa2[_0xc570('0x1b')](_0x2a4c48)[_0xc570('0x1c')](_0x3c32f0);}};}function respondWithFilteredResult(_0x3f6db6,_0xe158d){return function(_0x2d69e0){if(_0x2d69e0){var _0x1a66fa=_0x2d69e0[_0xc570('0x1d')],_0x389032=_0xe158d[_0xc570('0x1e')],_0x1d951d=_0xe158d[_0xc570('0x1e')]+_0xe158d[_0xc570('0x1f')],_0x9ac142;if(_0x1d951d>=_0x1a66fa){_0x1d951d=_0x1a66fa;_0x9ac142=0xc8;}else{_0x9ac142=0xce;}_0x3f6db6[_0xc570('0x1b')](_0x9ac142);return _0x3f6db6[_0xc570('0x20')]('Content-Range',_0x389032+'-'+_0x1d951d+'/'+_0x1a66fa)['json'](_0x2d69e0);}return null;};}function patchUpdates(_0x19e1ec){return function(_0x59cb11){try{jsonpatch[_0xc570('0x21')](_0x59cb11,_0x19e1ec,!![]);}catch(_0xc05f54){return BPromise['reject'](_0xc05f54);}return _0x59cb11[_0xc570('0x22')]();};}function saveUpdates(_0x3d1948,_0x3296b6){return function(_0x37a716){if(_0x37a716){return _0x37a716[_0xc570('0x23')](_0x3d1948)[_0xc570('0x24')](function(_0x4df93f){return _0x4df93f;});}return null;};}function removeEntity(_0x2d17c7,_0x154e5a){return function(_0x4fbff1){if(_0x4fbff1){return _0x4fbff1[_0xc570('0x25')]()[_0xc570('0x24')](function(){var _0x42f0b6=_0x4fbff1[_0xc570('0x26')]({'plain':!![]});var _0x1f28af=_0xc570('0x27');return db['UserProfileResource'][_0xc570('0x25')]({'where':{'type':_0x1f28af,'resourceId':_0x42f0b6['id']}})[_0xc570('0x24')](function(){return _0x4fbff1;});})[_0xc570('0x24')](function(){_0x2d17c7[_0xc570('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28877d,_0xa89d46){return function(_0x256723){if(!_0x256723){_0x28877d[_0xc570('0x1a')](0x194);}return _0x256723;};}function handleError(_0x11fdfd,_0x2e7701){_0x2e7701=_0x2e7701||0x1f4;return function(_0x4c9c8b){logger[_0xc570('0x28')](_0x4c9c8b[_0xc570('0x29')]);if(_0x4c9c8b['name']){delete _0x4c9c8b[_0xc570('0x2a')];}_0x11fdfd[_0xc570('0x1b')](_0x2e7701)[_0xc570('0x2b')](_0x4c9c8b);};}exports[_0xc570('0x2c')]=function(_0x2fdf5b,_0xcc80e0){var _0x4303ac={},_0x43c01f={},_0x3750e9={'count':0x0,'rows':[]};var _0x47c1cb=_[_0xc570('0x2d')](db[_0xc570('0x2e')][_0xc570('0x2f')],function(_0x3644d1){return{'name':_0x3644d1[_0xc570('0x30')],'type':_0x3644d1[_0xc570('0x31')][_0xc570('0x32')]};});_0x43c01f[_0xc570('0x33')]=_[_0xc570('0x2d')](_0x47c1cb,_0xc570('0x2a'));_0x43c01f['query']=_[_0xc570('0x34')](_0x2fdf5b[_0xc570('0x35')]);_0x43c01f['filters']=_[_0xc570('0x36')](_0x43c01f[_0xc570('0x33')],_0x43c01f[_0xc570('0x35')]);_0x4303ac[_0xc570('0x37')]=_[_0xc570('0x36')](_0x43c01f[_0xc570('0x33')],qs[_0xc570('0x38')](_0x2fdf5b[_0xc570('0x35')][_0xc570('0x38')]));_0x4303ac[_0xc570('0x37')]=_0x4303ac[_0xc570('0x37')][_0xc570('0x39')]?_0x4303ac['attributes']:_0x43c01f[_0xc570('0x33')];if(!_0x2fdf5b[_0xc570('0x35')][_0xc570('0x3a')](_0xc570('0x3b'))){_0x4303ac[_0xc570('0x1f')]=qs[_0xc570('0x1f')](_0x2fdf5b[_0xc570('0x35')][_0xc570('0x1f')]);_0x4303ac[_0xc570('0x1e')]=qs[_0xc570('0x1e')](_0x2fdf5b[_0xc570('0x35')][_0xc570('0x1e')]);}_0x4303ac[_0xc570('0x3c')]=qs[_0xc570('0x3d')](_0x2fdf5b[_0xc570('0x35')][_0xc570('0x3d')]);_0x4303ac[_0xc570('0x3e')]=qs['filters'](_[_0xc570('0x3f')](_0x2fdf5b[_0xc570('0x35')],_0x43c01f[_0xc570('0x40')]),_0x47c1cb);if(_0x2fdf5b[_0xc570('0x35')][_0xc570('0x41')]){_0x4303ac[_0xc570('0x3e')]=_[_0xc570('0x42')](_0x4303ac[_0xc570('0x3e')],{'$or':_[_0xc570('0x2d')](_0x47c1cb,function(_0x36d8ef){if(_0x36d8ef[_0xc570('0x31')]!==_0xc570('0x43')){var _0x15810e={};_0x15810e[_0x36d8ef[_0xc570('0x2a')]]={'$like':'%'+_0x2fdf5b[_0xc570('0x35')][_0xc570('0x41')]+'%'};return _0x15810e;}})});}_0x4303ac=_[_0xc570('0x42')]({},_0x4303ac,_0x2fdf5b[_0xc570('0x44')]);var _0x35a114={'where':_0x4303ac[_0xc570('0x3e')]};return db['VoiceMusicOnHold'][_0xc570('0x1d')](_0x35a114)['then'](function(_0x24a0cf){_0x3750e9['count']=_0x24a0cf;if(_0x2fdf5b[_0xc570('0x35')][_0xc570('0x45')]){_0x4303ac[_0xc570('0x46')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xc570('0x47')](_0x4303ac);})[_0xc570('0x24')](function(_0x17b672){_0x3750e9[_0xc570('0x48')]=_0x17b672;return _0x3750e9;})['then'](respondWithFilteredResult(_0xcc80e0,_0x4303ac))[_0xc570('0x49')](handleError(_0xcc80e0,null));};exports[_0xc570('0x4a')]=function(_0x3a2944,_0x1bf482){var _0x39af36={'raw':![],'where':{'id':_0x3a2944[_0xc570('0x4b')]['id']}},_0x23ef89={};_0x23ef89[_0xc570('0x33')]=_[_0xc570('0x34')](db[_0xc570('0x2e')]['rawAttributes']);_0x23ef89[_0xc570('0x35')]=_[_0xc570('0x34')](_0x3a2944[_0xc570('0x35')]);_0x23ef89[_0xc570('0x40')]=_[_0xc570('0x36')](_0x23ef89[_0xc570('0x33')],_0x23ef89[_0xc570('0x35')]);_0x39af36[_0xc570('0x37')]=_[_0xc570('0x36')](_0x23ef89[_0xc570('0x33')],qs[_0xc570('0x38')](_0x3a2944['query'][_0xc570('0x38')]));_0x39af36['attributes']=_0x39af36[_0xc570('0x37')][_0xc570('0x39')]?_0x39af36[_0xc570('0x37')]:_0x23ef89[_0xc570('0x33')];if(_0x3a2944['query'][_0xc570('0x45')]){_0x39af36[_0xc570('0x46')]=[{'all':!![]}];}_0x39af36=_[_0xc570('0x42')]({},_0x39af36,_0x3a2944[_0xc570('0x44')]);return db[_0xc570('0x2e')][_0xc570('0x4c')](_0x39af36)[_0xc570('0x24')](handleEntityNotFound(_0x1bf482,null))[_0xc570('0x24')](respondWithResult(_0x1bf482,null))[_0xc570('0x49')](handleError(_0x1bf482,null));};exports[_0xc570('0x23')]=function(_0x2c1abf,_0x34b57a){if(_0x2c1abf['body']['id']){delete _0x2c1abf[_0xc570('0x4d')]['id'];}return db[_0xc570('0x2e')][_0xc570('0x4c')]({'where':{'id':_0x2c1abf['params']['id']}})[_0xc570('0x24')](handleEntityNotFound(_0x34b57a,null))[_0xc570('0x24')](saveUpdates(_0x2c1abf['body'],null))[_0xc570('0x24')](respondWithResult(_0x34b57a,null))['catch'](handleError(_0x34b57a,null));};exports['create']=function(_0x4700f6,_0x467937,_0x194320){return db[_0xc570('0x4e')][_0xc570('0x4f')](function(_0x14f859){if(_0x4700f6[_0xc570('0x4d')][_0xc570('0x50')]===_0xc570('0x51')){_0x4700f6[_0xc570('0x4d')][_0xc570('0x52')]=path[_0xc570('0x53')](config[_0xc570('0x54')],_0xc570('0x55'),_0x4700f6[_0xc570('0x4d')]['name']);}return db['VoiceMusicOnHold'][_0xc570('0x56')](_0x4700f6['body'],{'transaction':_0x14f859})[_0xc570('0x24')](function(_0x5e6b7b){if(_0x4700f6[_0xc570('0x4d')][_0xc570('0x50')]===_0xc570('0x51')){fs[_0xc570('0x57')](_0x5e6b7b['directory'],parseInt('0777',0x8));}var _0x3b447e=_0x4700f6[_0xc570('0x58')][_0xc570('0x26')]({'plain':!![]});if(!_0x3b447e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b447e[_0xc570('0x59')]===_0xc570('0x58')){var _0xbeb980=_0x5e6b7b[_0xc570('0x26')]({'plain':!![]});return db[_0xc570('0x5a')][_0xc570('0x4c')]({'where':{'name':'MusicOnHolds','userProfileId':_0x3b447e[_0xc570('0x5b')]},'raw':!![]})[_0xc570('0x24')](function(_0x3c0800){if(_0x3c0800&&_0x3c0800[_0xc570('0x5c')]===0x0){return db[_0xc570('0x5d')][_0xc570('0x56')]({'name':_0xbeb980[_0xc570('0x2a')],'resourceId':_0xbeb980['id'],'type':_0x3c0800[_0xc570('0x2a')],'sectionId':_0x3c0800['id']},{})['then'](function(){return _0x5e6b7b;});}else{return _0x5e6b7b;}})[_0xc570('0x49')](function(_0x3fe756){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fe756);});}return _0x5e6b7b;});})[_0xc570('0x24')](respondWithResult(_0x467937,0xc9))[_0xc570('0x49')](handleError(_0x467937,null));};exports[_0xc570('0x25')]=function(_0x5aa28e,_0x4ba884,_0x190e4c){var _0x47e528;return db[_0xc570('0x2e')][_0xc570('0x4c')]({'where':{'id':_0x5aa28e['params']['id']}})[_0xc570('0x24')](function(_0x50fc8d){if(_0x50fc8d){return db['sequelize']['transaction'](function(_0x4293a8){return _0x50fc8d[_0xc570('0x25')]({'transaction':_0x4293a8,'raw':!![]})[_0xc570('0x24')](function(_0xe1db17){if(_0xe1db17[_0xc570('0x52')]){fs[_0xc570('0x5e')](_0xe1db17[_0xc570('0x52')])[_0xc570('0x5f')](function(_0x4a9bf7){fs[_0xc570('0x60')](path[_0xc570('0x53')](_0xe1db17['directory'],_0x4a9bf7));});fs[_0xc570('0x61')](_0xe1db17[_0xc570('0x52')]);}return _0xe1db17;});})[_0xc570('0x49')](function(_0x57e6ce){throw new db[(_0xc570('0x62'))]['ValidationError'](_0x57e6ce[_0xc570('0x63')]);});}})['then'](handleEntityNotFound(_0x4ba884,null))['then'](removeEntity(_0x4ba884,null))['catch'](handleError(_0x4ba884,null));};exports[_0xc570('0x64')]=function(_0x5b7d3f,_0x2504dc,_0x1a4ac2){return db[_0xc570('0x4e')][_0xc570('0x4f')](function(_0x334e00){var _0x2faf86;return db[_0xc570('0x2e')][_0xc570('0x4c')]({'where':{'id':_0x5b7d3f[_0xc570('0x4b')]['id']}})[_0xc570('0x24')](function(_0xf8e19f){if(_0xf8e19f){_0x2faf86=_0xf8e19f;return _0xf8e19f[_0xc570('0x64')](_0x5b7d3f[_0xc570('0x4d')]['id'],{'transaction':_0x334e00});}})['then'](function(_0x2f9161){if(_0x2f9161){return db['Sound'][_0xc570('0x65')]({'where':{'id':_0x5b7d3f[_0xc570('0x4d')]['id']},'attributes':['id',_0xc570('0x2a'),_0xc570('0x66'),'converted_format','createdAt'],'raw':!![]});}})[_0xc570('0x24')](function(_0xd3d9f0){if(_0xd3d9f0){var _0x587883=path['join'](config[_0xc570('0x54')],_0xc570('0x67'),util[_0xc570('0x68')](_0xc570('0x69'),path[_0xc570('0x6a')](_0xd3d9f0['save_name'],path[_0xc570('0x6b')](_0xd3d9f0[_0xc570('0x66')])),_0xd3d9f0[_0xc570('0x6c')]));var _0x5b3666=path[_0xc570('0x53')](config[_0xc570('0x54')],_0xc570('0x55'),_0x2faf86[_0xc570('0x2a')],util['format'](_0xc570('0x69'),_0xd3d9f0['name'],_0xd3d9f0[_0xc570('0x6c')]));fs['symlinkSync'](_0x587883,_0x5b3666);return _0xd3d9f0;}})[_0xc570('0x49')](function(_0x9f02c5){throw new db[(_0xc570('0x62'))][(_0xc570('0x6d'))](_0x9f02c5[_0xc570('0x63')]);});})[_0xc570('0x24')](handleEntityNotFound(_0x2504dc,null))[_0xc570('0x24')](respondWithResult(_0x2504dc,0xc9))['catch'](handleError(_0x2504dc,null));};exports[_0xc570('0x6e')]=function(_0x2b8c8b,_0x2cdbd0,_0x9b7015){return db[_0xc570('0x4e')][_0xc570('0x4f')](function(_0x344c37){var _0xd4ae6b;return db[_0xc570('0x2e')]['findOne']({'where':{'id':_0x2b8c8b[_0xc570('0x4b')]['id']}})[_0xc570('0x24')](handleEntityNotFound(_0x2cdbd0,null))[_0xc570('0x24')](function(_0x5e454b){if(_0x5e454b){_0xd4ae6b=_0x5e454b;return _0x5e454b['removeSound'](_0x2b8c8b['params']['id2']);}})[_0xc570('0x24')](function(_0x54c08f){if(_0x54c08f){return db['Sound'][_0xc570('0x65')]({'where':{'id':_0x2b8c8b[_0xc570('0x4b')]['id2']},'attributes':['id','name','save_name','converted_format',_0xc570('0x6f')],'raw':!![]});}})['then'](function(_0x14ed8a){if(_0x14ed8a){fs[_0xc570('0x60')](path[_0xc570('0x53')](_0xd4ae6b[_0xc570('0x52')],util[_0xc570('0x68')](_0xc570('0x69'),_0x14ed8a[_0xc570('0x2a')],_0x14ed8a[_0xc570('0x6c')])));return _0x14ed8a;}})['catch'](function(_0x265f96){throw new db['Sequelize'][(_0xc570('0x6d'))](_0x265f96[_0xc570('0x63')]);});})['then'](handleEntityNotFound(_0x2cdbd0,null))[_0xc570('0x24')](respondWithStatusCode(_0x2cdbd0,0xcc))[_0xc570('0x49')](handleError(_0x2cdbd0,null));};exports[_0xc570('0x70')]=function(_0x149715,_0xd0b7fb,_0x3bb999){var _0x4c46aa={};var _0x13861a={};var _0x38f62f;var _0x519b99;return db[_0xc570('0x2e')]['findOne']({'where':{'id':_0x149715[_0xc570('0x4b')]['id']}})[_0xc570('0x24')](handleEntityNotFound(_0xd0b7fb,null))[_0xc570('0x24')](function(_0x1522ef){if(_0x1522ef){_0x38f62f=_0x1522ef;_0x13861a['model']=_[_0xc570('0x34')](db[_0xc570('0x71')][_0xc570('0x2f')]);_0x13861a['query']=_[_0xc570('0x34')](_0x149715[_0xc570('0x35')]);_0x13861a[_0xc570('0x40')]=_['intersection'](_0x13861a[_0xc570('0x33')],_0x13861a['query']);_0x4c46aa[_0xc570('0x37')]=_[_0xc570('0x36')](_0x13861a[_0xc570('0x33')],qs[_0xc570('0x38')](_0x149715[_0xc570('0x35')][_0xc570('0x38')]));_0x4c46aa[_0xc570('0x37')]=_0x4c46aa['attributes'][_0xc570('0x39')]?_0x4c46aa[_0xc570('0x37')]:_0x13861a[_0xc570('0x33')];_0x4c46aa[_0xc570('0x3c')]=qs[_0xc570('0x3d')](_0x149715['query'][_0xc570('0x3d')]);_0x4c46aa['where']=qs['filters'](_[_0xc570('0x3f')](_0x149715[_0xc570('0x35')],_0x13861a[_0xc570('0x40')]));if(_0x149715[_0xc570('0x35')]['filter']){_0x4c46aa[_0xc570('0x3e')]=_[_0xc570('0x42')](_0x4c46aa[_0xc570('0x3e')],{'$or':_[_0xc570('0x2d')](_0x4c46aa[_0xc570('0x37')],function(_0x3c12c4){var _0x3400f8={};_0x3400f8[_0x3c12c4]={'$like':'%'+_0x149715[_0xc570('0x35')][_0xc570('0x41')]+'%'};return _0x3400f8;})});}_0x4c46aa=_[_0xc570('0x42')]({},_0x4c46aa,_0x149715[_0xc570('0x44')]);return _0x38f62f[_0xc570('0x70')](_0x4c46aa);}})[_0xc570('0x24')](function(_0x5ae686){if(_0x5ae686){_0x519b99=_0x5ae686[_0xc570('0x39')];if(!_0x149715[_0xc570('0x35')]['hasOwnProperty']('nolimit')){_0x4c46aa[_0xc570('0x1f')]=qs[_0xc570('0x1f')](_0x149715[_0xc570('0x35')][_0xc570('0x1f')]);_0x4c46aa[_0xc570('0x1e')]=qs[_0xc570('0x1e')](_0x149715[_0xc570('0x35')]['offset']);}return _0x38f62f[_0xc570('0x70')](_0x4c46aa);}})[_0xc570('0x24')](function(_0x6b9322){if(_0x6b9322){return _0x6b9322?{'count':_0x519b99,'rows':_0x6b9322}:null;}})[_0xc570('0x24')](respondWithResult(_0xd0b7fb,null))[_0xc570('0x49')](handleError(_0xd0b7fb,null));}; \ No newline at end of file +var _0xd0c5=['bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','update','body','sequelize','transaction','mode','files','join','server/files/moh','create','mkdirSync','0777','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','readdirSync','forEach','unlinkSync','directory','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','save_name','extname','symlinkSync','message','removeSound','id2','getSounds','eml-format','zip-dir','request-promise'];(function(_0x19759e,_0x14c2a7){var _0x3170a5=function(_0x2eb5e4){while(--_0x2eb5e4){_0x19759e['push'](_0x19759e['shift']());}};_0x3170a5(++_0x14c2a7);}(_0xd0c5,0xdb));var _0x5d0c=function(_0x4e0de1,_0x588991){_0x4e0de1=_0x4e0de1-0x0;var _0x98c705=_0xd0c5[_0x4e0de1];return _0x98c705;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5d0c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d0c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d0c('0x2'));var moment=require('moment');var BPromise=require(_0x5d0c('0x3'));var Mustache=require(_0x5d0c('0x4'));var util=require('util');var path=require(_0x5d0c('0x5'));var sox=require('sox');var csv=require(_0x5d0c('0x6'));var ejs=require(_0x5d0c('0x7'));var fs=require('fs');var fs_extra=require(_0x5d0c('0x8'));var _=require(_0x5d0c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5d0c('0x6'));var querystring=require(_0x5d0c('0xa'));var Papa=require(_0x5d0c('0xb'));var Redis=require('ioredis');var authService=require(_0x5d0c('0xc'));var qs=require(_0x5d0c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d0c('0xe'))('api');var utils=require(_0x5d0c('0xf'));var config=require(_0x5d0c('0x10'));var licenseUtil=require(_0x5d0c('0x11'));var db=require(_0x5d0c('0x12'))['db'];function respondWithStatusCode(_0x3da69b,_0x56deaf){_0x56deaf=_0x56deaf||0xcc;return function(_0x365d8b){if(_0x365d8b){return _0x3da69b[_0x5d0c('0x13')](_0x56deaf);}return _0x3da69b[_0x5d0c('0x14')](_0x56deaf)['end']();};}function respondWithResult(_0x271b53,_0xe6165b){_0xe6165b=_0xe6165b||0xc8;return function(_0x54b0cd){if(_0x54b0cd){return _0x271b53[_0x5d0c('0x14')](_0xe6165b)['json'](_0x54b0cd);}};}function respondWithFilteredResult(_0x489688,_0x13e1cb){return function(_0x24df2b){if(_0x24df2b){var _0x4a57c1=_0x24df2b[_0x5d0c('0x15')],_0x33efa2=_0x13e1cb['offset'],_0x531336=_0x13e1cb[_0x5d0c('0x16')]+_0x13e1cb[_0x5d0c('0x17')],_0xa6d600;if(_0x531336>=_0x4a57c1){_0x531336=_0x4a57c1;_0xa6d600=0xc8;}else{_0xa6d600=0xce;}_0x489688[_0x5d0c('0x14')](_0xa6d600);return _0x489688[_0x5d0c('0x18')](_0x5d0c('0x19'),_0x33efa2+'-'+_0x531336+'/'+_0x4a57c1)[_0x5d0c('0x1a')](_0x24df2b);}return null;};}function patchUpdates(_0x3907d3){return function(_0x4a447c){try{jsonpatch[_0x5d0c('0x1b')](_0x4a447c,_0x3907d3,!![]);}catch(_0xb8334b){return BPromise[_0x5d0c('0x1c')](_0xb8334b);}return _0x4a447c[_0x5d0c('0x1d')]();};}function saveUpdates(_0x4d8ef9,_0x55921e){return function(_0x4be913){if(_0x4be913){return _0x4be913['update'](_0x4d8ef9)[_0x5d0c('0x1e')](function(_0x579137){return _0x579137;});}return null;};}function removeEntity(_0x17b58d,_0x5442c4){return function(_0x1ac4b2){if(_0x1ac4b2){return _0x1ac4b2['destroy']()[_0x5d0c('0x1e')](function(){var _0x22eeab=_0x1ac4b2['get']({'plain':!![]});var _0x4c9a5f=_0x5d0c('0x1f');return db[_0x5d0c('0x20')]['destroy']({'where':{'type':_0x4c9a5f,'resourceId':_0x22eeab['id']}})[_0x5d0c('0x1e')](function(){return _0x1ac4b2;});})['then'](function(){_0x17b58d[_0x5d0c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d0595,_0x198b63){return function(_0x2ff074){if(!_0x2ff074){_0x1d0595[_0x5d0c('0x13')](0x194);}return _0x2ff074;};}function handleError(_0x4a1e25,_0x45dbce){_0x45dbce=_0x45dbce||0x1f4;return function(_0x7ca31){logger[_0x5d0c('0x21')](_0x7ca31[_0x5d0c('0x22')]);if(_0x7ca31[_0x5d0c('0x23')]){delete _0x7ca31[_0x5d0c('0x23')];}_0x4a1e25[_0x5d0c('0x14')](_0x45dbce)[_0x5d0c('0x24')](_0x7ca31);};}exports[_0x5d0c('0x25')]=function(_0x498182,_0x1740b1){var _0x3bc9fe={},_0x2ae64b={},_0xc3d2e0={'count':0x0,'rows':[]};var _0x27ed11=_[_0x5d0c('0x26')](db[_0x5d0c('0x27')][_0x5d0c('0x28')],function(_0x5cfc9b){return{'name':_0x5cfc9b['fieldName'],'type':_0x5cfc9b[_0x5d0c('0x29')][_0x5d0c('0x2a')]};});_0x2ae64b[_0x5d0c('0x2b')]=_[_0x5d0c('0x26')](_0x27ed11,_0x5d0c('0x23'));_0x2ae64b['query']=_['keys'](_0x498182[_0x5d0c('0x2c')]);_0x2ae64b[_0x5d0c('0x2d')]=_[_0x5d0c('0x2e')](_0x2ae64b[_0x5d0c('0x2b')],_0x2ae64b[_0x5d0c('0x2c')]);_0x3bc9fe[_0x5d0c('0x2f')]=_[_0x5d0c('0x2e')](_0x2ae64b[_0x5d0c('0x2b')],qs[_0x5d0c('0x30')](_0x498182[_0x5d0c('0x2c')][_0x5d0c('0x30')]));_0x3bc9fe['attributes']=_0x3bc9fe['attributes']['length']?_0x3bc9fe[_0x5d0c('0x2f')]:_0x2ae64b[_0x5d0c('0x2b')];if(!_0x498182[_0x5d0c('0x2c')][_0x5d0c('0x31')](_0x5d0c('0x32'))){_0x3bc9fe[_0x5d0c('0x17')]=qs[_0x5d0c('0x17')](_0x498182[_0x5d0c('0x2c')][_0x5d0c('0x17')]);_0x3bc9fe[_0x5d0c('0x16')]=qs[_0x5d0c('0x16')](_0x498182['query'][_0x5d0c('0x16')]);}_0x3bc9fe[_0x5d0c('0x33')]=qs[_0x5d0c('0x34')](_0x498182['query'][_0x5d0c('0x34')]);_0x3bc9fe[_0x5d0c('0x35')]=qs[_0x5d0c('0x2d')](_[_0x5d0c('0x36')](_0x498182[_0x5d0c('0x2c')],_0x2ae64b['filters']),_0x27ed11);if(_0x498182['query'][_0x5d0c('0x37')]){_0x3bc9fe[_0x5d0c('0x35')]=_[_0x5d0c('0x38')](_0x3bc9fe['where'],{'$or':_[_0x5d0c('0x26')](_0x27ed11,function(_0x1d7329){if(_0x1d7329[_0x5d0c('0x29')]!==_0x5d0c('0x39')){var _0x146a32={};_0x146a32[_0x1d7329[_0x5d0c('0x23')]]={'$like':'%'+_0x498182['query'][_0x5d0c('0x37')]+'%'};return _0x146a32;}})});}_0x3bc9fe=_[_0x5d0c('0x38')]({},_0x3bc9fe,_0x498182[_0x5d0c('0x3a')]);var _0x430d0b={'where':_0x3bc9fe[_0x5d0c('0x35')]};return db[_0x5d0c('0x27')][_0x5d0c('0x15')](_0x430d0b)[_0x5d0c('0x1e')](function(_0x214f73){_0xc3d2e0['count']=_0x214f73;if(_0x498182[_0x5d0c('0x2c')][_0x5d0c('0x3b')]){_0x3bc9fe['include']=[{'all':!![]}];}return db[_0x5d0c('0x27')][_0x5d0c('0x3c')](_0x3bc9fe);})['then'](function(_0x5afbf8){_0xc3d2e0[_0x5d0c('0x3d')]=_0x5afbf8;return _0xc3d2e0;})[_0x5d0c('0x1e')](respondWithFilteredResult(_0x1740b1,_0x3bc9fe))[_0x5d0c('0x3e')](handleError(_0x1740b1,null));};exports[_0x5d0c('0x3f')]=function(_0x2ac7d7,_0x465459){var _0x6400d={'raw':![],'where':{'id':_0x2ac7d7[_0x5d0c('0x40')]['id']}},_0xcb76ec={};_0xcb76ec[_0x5d0c('0x2b')]=_['keys'](db['VoiceMusicOnHold'][_0x5d0c('0x28')]);_0xcb76ec[_0x5d0c('0x2c')]=_[_0x5d0c('0x41')](_0x2ac7d7['query']);_0xcb76ec[_0x5d0c('0x2d')]=_[_0x5d0c('0x2e')](_0xcb76ec[_0x5d0c('0x2b')],_0xcb76ec[_0x5d0c('0x2c')]);_0x6400d[_0x5d0c('0x2f')]=_[_0x5d0c('0x2e')](_0xcb76ec[_0x5d0c('0x2b')],qs[_0x5d0c('0x30')](_0x2ac7d7[_0x5d0c('0x2c')][_0x5d0c('0x30')]));_0x6400d[_0x5d0c('0x2f')]=_0x6400d[_0x5d0c('0x2f')][_0x5d0c('0x42')]?_0x6400d[_0x5d0c('0x2f')]:_0xcb76ec[_0x5d0c('0x2b')];if(_0x2ac7d7['query']['includeAll']){_0x6400d[_0x5d0c('0x43')]=[{'all':!![]}];}_0x6400d=_[_0x5d0c('0x38')]({},_0x6400d,_0x2ac7d7['options']);return db[_0x5d0c('0x27')][_0x5d0c('0x44')](_0x6400d)['then'](handleEntityNotFound(_0x465459,null))[_0x5d0c('0x1e')](respondWithResult(_0x465459,null))['catch'](handleError(_0x465459,null));};exports[_0x5d0c('0x45')]=function(_0x4d26fb,_0x3f69ab){if(_0x4d26fb[_0x5d0c('0x46')]['id']){delete _0x4d26fb['body']['id'];}return db[_0x5d0c('0x27')][_0x5d0c('0x44')]({'where':{'id':_0x4d26fb['params']['id']}})['then'](handleEntityNotFound(_0x3f69ab,null))[_0x5d0c('0x1e')](saveUpdates(_0x4d26fb['body'],null))[_0x5d0c('0x1e')](respondWithResult(_0x3f69ab,null))['catch'](handleError(_0x3f69ab,null));};exports['create']=function(_0x3e2f3d,_0x48610c,_0x30b0da){return db[_0x5d0c('0x47')][_0x5d0c('0x48')](function(_0x13c7b0){if(_0x3e2f3d['body'][_0x5d0c('0x49')]===_0x5d0c('0x4a')){_0x3e2f3d[_0x5d0c('0x46')]['directory']=path[_0x5d0c('0x4b')](config['root'],_0x5d0c('0x4c'),_0x3e2f3d[_0x5d0c('0x46')][_0x5d0c('0x23')]);}return db[_0x5d0c('0x27')][_0x5d0c('0x4d')](_0x3e2f3d[_0x5d0c('0x46')],{'transaction':_0x13c7b0})[_0x5d0c('0x1e')](function(_0x5344e7){if(_0x3e2f3d[_0x5d0c('0x46')][_0x5d0c('0x49')]==='files'){fs[_0x5d0c('0x4e')](_0x5344e7['directory'],parseInt(_0x5d0c('0x4f'),0x8));}var _0x2dd819=_0x3e2f3d[_0x5d0c('0x50')]['get']({'plain':!![]});if(!_0x2dd819)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2dd819[_0x5d0c('0x51')]==='user'){var _0x4a620d=_0x5344e7[_0x5d0c('0x52')]({'plain':!![]});return db[_0x5d0c('0x53')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x2dd819[_0x5d0c('0x54')]},'raw':!![]})[_0x5d0c('0x1e')](function(_0x4b458a){if(_0x4b458a&&_0x4b458a[_0x5d0c('0x55')]===0x0){return db['UserProfileResource'][_0x5d0c('0x4d')]({'name':_0x4a620d[_0x5d0c('0x23')],'resourceId':_0x4a620d['id'],'type':_0x4b458a[_0x5d0c('0x23')],'sectionId':_0x4b458a['id']},{})[_0x5d0c('0x1e')](function(){return _0x5344e7;});}else{return _0x5344e7;}})[_0x5d0c('0x3e')](function(_0x5a4161){logger['error'](_0x5d0c('0x56'),_0x5a4161);});}return _0x5344e7;});})[_0x5d0c('0x1e')](respondWithResult(_0x48610c,0xc9))['catch'](handleError(_0x48610c,null));};exports[_0x5d0c('0x57')]=function(_0x1537fb,_0x2fe608,_0x4270c0){var _0x59fb17;return db[_0x5d0c('0x27')]['find']({'where':{'id':_0x1537fb['params']['id']}})[_0x5d0c('0x1e')](function(_0xadc345){if(_0xadc345){return db[_0x5d0c('0x47')][_0x5d0c('0x48')](function(_0x201f38){return _0xadc345['destroy']({'transaction':_0x201f38,'raw':!![]})['then'](function(_0x77bf7f){if(_0x77bf7f['directory']){fs[_0x5d0c('0x58')](_0x77bf7f['directory'])[_0x5d0c('0x59')](function(_0x43deef){fs[_0x5d0c('0x5a')](path[_0x5d0c('0x4b')](_0x77bf7f[_0x5d0c('0x5b')],_0x43deef));});fs[_0x5d0c('0x5c')](_0x77bf7f['directory']);}return _0x77bf7f;});})[_0x5d0c('0x3e')](function(_0xfcdef8){throw new db[(_0x5d0c('0x5d'))][(_0x5d0c('0x5e'))](_0xfcdef8['message']);});}})['then'](handleEntityNotFound(_0x2fe608,null))[_0x5d0c('0x1e')](removeEntity(_0x2fe608,null))[_0x5d0c('0x3e')](handleError(_0x2fe608,null));};exports[_0x5d0c('0x5f')]=function(_0x4ed590,_0x4b50ab,_0x2e4c33){return db[_0x5d0c('0x47')]['transaction'](function(_0xa16a14){var _0x158e11;return db[_0x5d0c('0x27')][_0x5d0c('0x44')]({'where':{'id':_0x4ed590['params']['id']}})['then'](function(_0x52c69b){if(_0x52c69b){_0x158e11=_0x52c69b;return _0x52c69b[_0x5d0c('0x5f')](_0x4ed590[_0x5d0c('0x46')]['id'],{'transaction':_0xa16a14});}})[_0x5d0c('0x1e')](function(_0x486a10){if(_0x486a10){return db[_0x5d0c('0x60')][_0x5d0c('0x61')]({'where':{'id':_0x4ed590[_0x5d0c('0x46')]['id']},'attributes':['id','name','save_name',_0x5d0c('0x62'),_0x5d0c('0x63')],'raw':!![]});}})['then'](function(_0x53be9f){if(_0x53be9f){var _0x14f00f=path[_0x5d0c('0x4b')](config[_0x5d0c('0x64')],_0x5d0c('0x65'),util[_0x5d0c('0x66')](_0x5d0c('0x67'),path['basename'](_0x53be9f[_0x5d0c('0x68')],path[_0x5d0c('0x69')](_0x53be9f[_0x5d0c('0x68')])),_0x53be9f['converted_format']));var _0x393058=path[_0x5d0c('0x4b')](config['root'],_0x5d0c('0x4c'),_0x158e11[_0x5d0c('0x23')],util[_0x5d0c('0x66')](_0x5d0c('0x67'),_0x53be9f[_0x5d0c('0x23')],_0x53be9f[_0x5d0c('0x62')]));fs[_0x5d0c('0x6a')](_0x14f00f,_0x393058);return _0x53be9f;}})[_0x5d0c('0x3e')](function(_0x3ed204){throw new db[(_0x5d0c('0x5d'))]['ValidationError'](_0x3ed204[_0x5d0c('0x6b')]);});})[_0x5d0c('0x1e')](handleEntityNotFound(_0x4b50ab,null))[_0x5d0c('0x1e')](respondWithResult(_0x4b50ab,0xc9))['catch'](handleError(_0x4b50ab,null));};exports['removeSound']=function(_0x475676,_0x44e5c3,_0x3262cb){return db[_0x5d0c('0x47')][_0x5d0c('0x48')](function(_0x52d905){var _0x52580f;return db[_0x5d0c('0x27')][_0x5d0c('0x61')]({'where':{'id':_0x475676['params']['id']}})[_0x5d0c('0x1e')](handleEntityNotFound(_0x44e5c3,null))[_0x5d0c('0x1e')](function(_0x88800f){if(_0x88800f){_0x52580f=_0x88800f;return _0x88800f[_0x5d0c('0x6c')](_0x475676[_0x5d0c('0x40')][_0x5d0c('0x6d')]);}})[_0x5d0c('0x1e')](function(_0xe82231){if(_0xe82231){return db[_0x5d0c('0x60')]['findOne']({'where':{'id':_0x475676[_0x5d0c('0x40')]['id2']},'attributes':['id',_0x5d0c('0x23'),_0x5d0c('0x68'),'converted_format',_0x5d0c('0x63')],'raw':!![]});}})[_0x5d0c('0x1e')](function(_0x385762){if(_0x385762){fs[_0x5d0c('0x5a')](path[_0x5d0c('0x4b')](_0x52580f[_0x5d0c('0x5b')],util[_0x5d0c('0x66')](_0x5d0c('0x67'),_0x385762[_0x5d0c('0x23')],_0x385762['converted_format'])));return _0x385762;}})['catch'](function(_0x293648){throw new db[(_0x5d0c('0x5d'))][(_0x5d0c('0x5e'))](_0x293648[_0x5d0c('0x6b')]);});})[_0x5d0c('0x1e')](handleEntityNotFound(_0x44e5c3,null))[_0x5d0c('0x1e')](respondWithStatusCode(_0x44e5c3,0xcc))['catch'](handleError(_0x44e5c3,null));};exports[_0x5d0c('0x6e')]=function(_0x2b8eb4,_0x18e971,_0x2ab873){var _0x1ac446={};var _0x37415f={};var _0x224092;var _0x5b9520;return db[_0x5d0c('0x27')][_0x5d0c('0x61')]({'where':{'id':_0x2b8eb4[_0x5d0c('0x40')]['id']}})[_0x5d0c('0x1e')](handleEntityNotFound(_0x18e971,null))['then'](function(_0x2b8513){if(_0x2b8513){_0x224092=_0x2b8513;_0x37415f[_0x5d0c('0x2b')]=_[_0x5d0c('0x41')](db[_0x5d0c('0x60')][_0x5d0c('0x28')]);_0x37415f[_0x5d0c('0x2c')]=_[_0x5d0c('0x41')](_0x2b8eb4[_0x5d0c('0x2c')]);_0x37415f[_0x5d0c('0x2d')]=_[_0x5d0c('0x2e')](_0x37415f['model'],_0x37415f[_0x5d0c('0x2c')]);_0x1ac446['attributes']=_['intersection'](_0x37415f[_0x5d0c('0x2b')],qs['fields'](_0x2b8eb4[_0x5d0c('0x2c')][_0x5d0c('0x30')]));_0x1ac446[_0x5d0c('0x2f')]=_0x1ac446['attributes']['length']?_0x1ac446['attributes']:_0x37415f[_0x5d0c('0x2b')];_0x1ac446['order']=qs[_0x5d0c('0x34')](_0x2b8eb4['query'][_0x5d0c('0x34')]);_0x1ac446[_0x5d0c('0x35')]=qs[_0x5d0c('0x2d')](_[_0x5d0c('0x36')](_0x2b8eb4['query'],_0x37415f['filters']));if(_0x2b8eb4[_0x5d0c('0x2c')][_0x5d0c('0x37')]){_0x1ac446['where']=_[_0x5d0c('0x38')](_0x1ac446['where'],{'$or':_[_0x5d0c('0x26')](_0x1ac446[_0x5d0c('0x2f')],function(_0x520a92){var _0x3703d9={};_0x3703d9[_0x520a92]={'$like':'%'+_0x2b8eb4[_0x5d0c('0x2c')][_0x5d0c('0x37')]+'%'};return _0x3703d9;})});}_0x1ac446=_[_0x5d0c('0x38')]({},_0x1ac446,_0x2b8eb4['options']);return _0x224092[_0x5d0c('0x6e')](_0x1ac446);}})[_0x5d0c('0x1e')](function(_0x2fc154){if(_0x2fc154){_0x5b9520=_0x2fc154['length'];if(!_0x2b8eb4[_0x5d0c('0x2c')][_0x5d0c('0x31')](_0x5d0c('0x32'))){_0x1ac446['limit']=qs[_0x5d0c('0x17')](_0x2b8eb4['query']['limit']);_0x1ac446[_0x5d0c('0x16')]=qs['offset'](_0x2b8eb4[_0x5d0c('0x2c')][_0x5d0c('0x16')]);}return _0x224092[_0x5d0c('0x6e')](_0x1ac446);}})['then'](function(_0x5e767e){if(_0x5e767e){return _0x5e767e?{'count':_0x5b9520,'rows':_0x5e767e}:null;}})[_0x5d0c('0x1e')](respondWithResult(_0x18e971,null))[_0x5d0c('0x3e')](handleError(_0x18e971,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 1ef9e48..e0e7d4a 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 _0x33e7=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x2a84a3,_0x3a2bde){var _0x4e64f6=function(_0xfe45ca){while(--_0xfe45ca){_0x2a84a3['push'](_0x2a84a3['shift']());}};_0x4e64f6(++_0x3a2bde);}(_0x33e7,0xfa));var _0x733e=function(_0x986fb3,_0x1e8673){_0x986fb3=_0x986fb3-0x0;var _0xe0f1d=_0x33e7[_0x986fb3];return _0xe0f1d;};'use strict';var _=require(_0x733e('0x0'));var util=require(_0x733e('0x1'));var logger=require('../../config/logger')(_0x733e('0x2'));var moment=require(_0x733e('0x3'));var BPromise=require(_0x733e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x733e('0x5'));var rimraf=require(_0x733e('0x6'));var config=require(_0x733e('0x7'));var attributes=require(_0x733e('0x8'));module['exports']=function(_0x2485a7,_0x448370){return _0x2485a7[_0x733e('0x9')](_0x733e('0xa'),attributes,{'tableName':_0x733e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd70=['util','api','moment','bluebird','request-promise','path','../../config/environment','define','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xcd70,0xfc));var _0x0cd7=function(_0x3216f7,_0x45a5cd){_0x3216f7=_0x3216f7-0x0;var _0x1ea482=_0xcd70[_0x3216f7];return _0x1ea482;};'use strict';var _=require(_0x0cd7('0x0'));var util=require(_0x0cd7('0x1'));var logger=require('../../config/logger')(_0x0cd7('0x2'));var moment=require(_0x0cd7('0x3'));var BPromise=require(_0x0cd7('0x4'));var rp=require(_0x0cd7('0x5'));var fs=require('fs');var path=require(_0x0cd7('0x6'));var rimraf=require('rimraf');var config=require(_0x0cd7('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x181744,_0x4a26f9){return _0x181744[_0x0cd7('0x8')](_0x0cd7('0x9'),attributes,{'tableName':_0x0cd7('0xa'),'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 3c3bed9..77da6db 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 _0xe51f=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xe51f,0x10d));var _0xfe51=function(_0x17e707,_0x111af0){_0x17e707=_0x17e707-0x0;var _0x431b04=_0xe51f[_0x17e707];return _0x431b04;};'use strict';var _=require(_0xfe51('0x0'));var util=require(_0xfe51('0x1'));var moment=require(_0xfe51('0x2'));var BPromise=require('bluebird');var rs=require(_0xfe51('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe51('0x4'))['db'];var utils=require(_0xfe51('0x5'));var logger=require('../../config/logger')(_0xfe51('0x6'));var config=require('../../config/environment');var jayson=require(_0xfe51('0x7'));var client=jayson[_0xfe51('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39cd37,_0x38ba52,_0x1a3fa2){return new BPromise(function(_0xdbf896,_0x3620c3){return client[_0xfe51('0x9')](_0x39cd37,_0x1a3fa2)['then'](function(_0x1f1ee6){logger[_0xfe51('0xa')](_0xfe51('0xb'),_0x38ba52,'request\x20sent');logger[_0xfe51('0xc')](_0xfe51('0xd'),_0x38ba52,_0xfe51('0xe'),JSON[_0xfe51('0xf')](_0x1f1ee6));if(_0x1f1ee6[_0xfe51('0x10')]){if(_0x1f1ee6[_0xfe51('0x10')][_0xfe51('0x11')]===0x1f4){logger[_0xfe51('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x38ba52,_0x1f1ee6['error'][_0xfe51('0x12')]);return _0x3620c3(_0x1f1ee6[_0xfe51('0x10')][_0xfe51('0x12')]);}logger[_0xfe51('0x10')](_0xfe51('0xb'),_0x38ba52,_0x1f1ee6[_0xfe51('0x10')][_0xfe51('0x12')]);return _0xdbf896(_0x1f1ee6[_0xfe51('0x10')][_0xfe51('0x12')]);}else{logger[_0xfe51('0xa')](_0xfe51('0xb'),_0x38ba52,_0xfe51('0xe'));_0xdbf896(_0x1f1ee6[_0xfe51('0x13')][_0xfe51('0x12')]);}})[_0xfe51('0x14')](function(_0x21a781){logger[_0xfe51('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x38ba52,_0x21a781);_0x3620c3(_0x21a781);});});} \ No newline at end of file +var _0x25ce=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5af0e1,_0x224661){var _0x48884f=function(_0x3de9af){while(--_0x3de9af){_0x5af0e1['push'](_0x5af0e1['shift']());}};_0x48884f(++_0x224661);}(_0x25ce,0x1e8));var _0xe25c=function(_0x3b2311,_0x2ec149){_0x3b2311=_0x3b2311-0x0;var _0x13315f=_0x25ce[_0x3b2311];return _0x13315f;};'use strict';var _=require(_0xe25c('0x0'));var util=require(_0xe25c('0x1'));var moment=require(_0xe25c('0x2'));var BPromise=require(_0xe25c('0x3'));var rs=require(_0xe25c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe25c('0x5'))(_0xe25c('0x6'));var config=require(_0xe25c('0x7'));var jayson=require(_0xe25c('0x8'));var client=jayson[_0xe25c('0x9')][_0xe25c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c4781,_0x26b528,_0x4ef910){return new BPromise(function(_0x42af0d,_0xc4c60a){return client['request'](_0x1c4781,_0x4ef910)[_0xe25c('0xb')](function(_0x275c76){logger[_0xe25c('0xc')](_0xe25c('0xd'),_0x26b528,'request\x20sent');logger[_0xe25c('0xe')](_0xe25c('0xf'),_0x26b528,_0xe25c('0x10'),JSON[_0xe25c('0x11')](_0x275c76));if(_0x275c76[_0xe25c('0x12')]){if(_0x275c76[_0xe25c('0x12')][_0xe25c('0x13')]===0x1f4){logger[_0xe25c('0x12')](_0xe25c('0xd'),_0x26b528,_0x275c76[_0xe25c('0x12')][_0xe25c('0x14')]);return _0xc4c60a(_0x275c76[_0xe25c('0x12')]['message']);}logger[_0xe25c('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x26b528,_0x275c76[_0xe25c('0x12')][_0xe25c('0x14')]);return _0x42af0d(_0x275c76['error'][_0xe25c('0x14')]);}else{logger[_0xe25c('0xc')](_0xe25c('0xd'),_0x26b528,_0xe25c('0x10'));_0x42af0d(_0x275c76['result'][_0xe25c('0x14')]);}})[_0xe25c('0x15')](function(_0x28683f){logger[_0xe25c('0x12')](_0xe25c('0xd'),_0x26b528,_0x28683f);_0xc4c60a(_0x28683f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 7452932..46fd513 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 _0x7b84=['index','/describe','describe','/:id','show','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x46ca03,_0x1e57bf){var _0x2f2e6b=function(_0x23e13a){while(--_0x23e13a){_0x46ca03['push'](_0x46ca03['shift']());}};_0x2f2e6b(++_0x1e57bf);}(_0x7b84,0x17c));var _0x47b8=function(_0xe2a103,_0x276709){_0xe2a103=_0xe2a103-0x0;var _0x5358e4=_0x7b84[_0xe2a103];return _0x5358e4;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0xa')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0x13')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0x13')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x15')]);router[_0x47b8('0x16')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x17')]);router[_0x47b8('0x18')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x19')]);router[_0x47b8('0x18')]('/:id/users',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1a')]);module[_0x47b8('0x1b')]=router; \ No newline at end of file +var _0xdbf5=['update','delete','destroy','removeAgents','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','show','/:id/users','getAgents','create','put','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5a2c85,_0x861729){_0x5a2c85=_0x5a2c85-0x0;var _0x1e678c=_0xdbf5[_0x5a2c85];return _0x1e678c;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0x8')](_0x5dbf('0xb'),auth[_0x5dbf('0x9')](),controller['describe']);router[_0x5dbf('0x8')]('/:id',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router[_0x5dbf('0x8')](_0x5dbf('0xd'),auth['isAuthenticated'](),controller[_0x5dbf('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5dbf('0xf')]);router['post']('/:id/users',auth[_0x5dbf('0x9')](),controller['addAgents']);router[_0x5dbf('0x10')](_0x5dbf('0x11'),auth[_0x5dbf('0x9')](),controller[_0x5dbf('0x12')]);router[_0x5dbf('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x5dbf('0x14')]);router[_0x5dbf('0x13')]('/:id/users',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0x15')]);module[_0x5dbf('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 38e9f27..be8cc5a 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 _0xaa51=['getDataValue','STRING','INTEGER','sequelize','exports','name','VIRTUAL'];(function(_0x390ca2,_0x404738){var _0x46fa3a=function(_0x9ea992){while(--_0x9ea992){_0x390ca2['push'](_0x390ca2['shift']());}};_0x46fa3a(++_0x404738);}(_0xaa51,0xf8));var _0x1aa5=function(_0x223b96,_0x27e9e4){_0x223b96=_0x223b96-0x0;var _0x38fd4d=_0xaa51[_0x223b96];return _0x38fd4d;};'use strict';var Sequelize=require(_0x1aa5('0x0'));module[_0x1aa5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1aa5('0x2')},'prefix':{'type':Sequelize[_0x1aa5('0x3')],'get':function(_0x17b846){return'system-'+this[_0x1aa5('0x4')](_0x1aa5('0x2'))+'-';}},'description':{'type':Sequelize[_0x1aa5('0x5')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x1aa5('0x6')]}}; \ No newline at end of file +var _0x1f77=['VIRTUAL','system-','getDataValue','INTEGER','STRING','name'];(function(_0x43dfc8,_0xfc0ea){var _0x348b67=function(_0x395f1d){while(--_0x395f1d){_0x43dfc8['push'](_0x43dfc8['shift']());}};_0x348b67(++_0xfc0ea);}(_0x1f77,0x7c));var _0x71f7=function(_0x28267d,_0x57614c){_0x28267d=_0x28267d-0x0;var _0x157ceb=_0x1f77[_0x28267d];return _0x157ceb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x71f7('0x0')],'allowNull':![],'unique':_0x71f7('0x1')},'prefix':{'type':Sequelize[_0x71f7('0x2')],'get':function(_0x164fa1){return _0x71f7('0x3')+this[_0x71f7('0x4')](_0x71f7('0x1'))+'-';}},'description':{'type':Sequelize[_0x71f7('0x0')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x71f7('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 1317c45..14f97d7 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 _0x13c5=['userVoicePrefix:remove','getAgents','findOne','sort','hasOwnProperty','html-pdf','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','localhost','./voicePrefix.socket','register','sendStatus','end','count','offset','limit','status','set','Content-Range','json','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','index','map','rawAttributes','type','key','name','query','keys','model','attributes','intersection','fields','length','nolimit','order','filters','pick','merge','where','VIRTUAL','filter','options','VoicePrefix','includeAll','include','findAll','rows','show','params','find','catch','describe','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','callerIdAll','NoOp','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','update','system-','sequelize','findById','addAgents','ids','omit','spread','removeAgents','isArray','emit'];(function(_0x1f6690,_0x22a6c8){var _0x3a78ea=function(_0x3b9a76){while(--_0x3b9a76){_0x1f6690['push'](_0x1f6690['shift']());}};_0x3a78ea(++_0x22a6c8);}(_0x13c5,0x7a));var _0x513c=function(_0x202f1a,_0x384924){_0x202f1a=_0x202f1a-0x0;var _0x4cdd89=_0x13c5[_0x202f1a];return _0x4cdd89;};'use strict';var pdf=require(_0x513c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x513c('0x1'));var Mustache=require('mustache');var util=require('util');var path=require(_0x513c('0x2'));var sox=require(_0x513c('0x3'));var csv=require(_0x513c('0x4'));var ejs=require(_0x513c('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x513c('0x6'));var crypto=require(_0x513c('0x7'));var jsforce=require(_0x513c('0x8'));var deskjs=require(_0x513c('0x9'));var toCsv=require(_0x513c('0x4'));var querystring=require(_0x513c('0xa'));var Papa=require(_0x513c('0xb'));var Redis=require(_0x513c('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x513c('0xd'));var as=require(_0x513c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x513c('0xf'));var utils=require(_0x513c('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x513c('0x11')]=_['defaults'](config[_0x513c('0x11')],{'host':_0x513c('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x513c('0x11')]));require(_0x513c('0x13'))[_0x513c('0x14')](socket);function respondWithStatusCode(_0x402067,_0x31e044){_0x31e044=_0x31e044||0xcc;return function(_0x57f359){if(_0x57f359){return _0x402067[_0x513c('0x15')](_0x31e044);}return _0x402067['status'](_0x31e044)[_0x513c('0x16')]();};}function respondWithResult(_0x380a0a,_0x3d0a3f){_0x3d0a3f=_0x3d0a3f||0xc8;return function(_0x2fd03e){if(_0x2fd03e){return _0x380a0a['status'](_0x3d0a3f)['json'](_0x2fd03e);}};}function respondWithFilteredResult(_0x4c2247,_0x100bc7){return function(_0x341b20){if(_0x341b20){var _0x51196d=_0x341b20[_0x513c('0x17')],_0x58b89f=_0x100bc7[_0x513c('0x18')],_0x217e7a=_0x100bc7['offset']+_0x100bc7[_0x513c('0x19')],_0xaa7657;if(_0x217e7a>=_0x51196d){_0x217e7a=_0x51196d;_0xaa7657=0xc8;}else{_0xaa7657=0xce;}_0x4c2247[_0x513c('0x1a')](_0xaa7657);return _0x4c2247[_0x513c('0x1b')](_0x513c('0x1c'),_0x58b89f+'-'+_0x217e7a+'/'+_0x51196d)[_0x513c('0x1d')](_0x341b20);}return null;};}function patchUpdates(_0x52287b){return function(_0x153132){try{jsonpatch['apply'](_0x153132,_0x52287b,!![]);}catch(_0xea28b3){return BPromise[_0x513c('0x1e')](_0xea28b3);}return _0x153132[_0x513c('0x1f')]();};}function saveUpdates(_0xcd8a3b,_0x3661c7){return function(_0x5ac3be){if(_0x5ac3be){return _0x5ac3be['update'](_0xcd8a3b)[_0x513c('0x20')](function(_0x390f1e){return _0x390f1e;});}return null;};}function removeEntity(_0x58dea0,_0x435b57){return function(_0x28c0ee){if(_0x28c0ee){return _0x28c0ee['destroy']()[_0x513c('0x20')](function(){var _0x465522=_0x28c0ee[_0x513c('0x21')]({'plain':!![]});var _0x24cfa7=_0x513c('0x22');return db[_0x513c('0x23')][_0x513c('0x24')]({'where':{'type':_0x24cfa7,'resourceId':_0x465522['id']}})['then'](function(){return _0x28c0ee;});})[_0x513c('0x20')](function(){_0x58dea0[_0x513c('0x1a')](0xcc)[_0x513c('0x16')]();});}};}function handleEntityNotFound(_0x18dec2,_0xf324ee){return function(_0x4a2f3d){if(!_0x4a2f3d){_0x18dec2[_0x513c('0x15')](0x194);}return _0x4a2f3d;};}function handleError(_0x28de12,_0x3cbe93){_0x3cbe93=_0x3cbe93||0x1f4;return function(_0x308466){logger[_0x513c('0x25')](_0x308466[_0x513c('0x26')]);if(_0x308466['name']){delete _0x308466['name'];}_0x28de12[_0x513c('0x1a')](_0x3cbe93)['send'](_0x308466);};}exports[_0x513c('0x27')]=function(_0x2bd36b,_0xb087c2){var _0x5c906a={},_0x1546a7={},_0x24d971={'count':0x0,'rows':[]};var _0x38924e=_[_0x513c('0x28')](db['VoicePrefix'][_0x513c('0x29')],function(_0x198761){return{'name':_0x198761['fieldName'],'type':_0x198761[_0x513c('0x2a')][_0x513c('0x2b')]};});_0x1546a7['model']=_[_0x513c('0x28')](_0x38924e,_0x513c('0x2c'));_0x1546a7[_0x513c('0x2d')]=_[_0x513c('0x2e')](_0x2bd36b[_0x513c('0x2d')]);_0x1546a7['filters']=_['intersection'](_0x1546a7[_0x513c('0x2f')],_0x1546a7['query']);_0x5c906a[_0x513c('0x30')]=_[_0x513c('0x31')](_0x1546a7[_0x513c('0x2f')],qs[_0x513c('0x32')](_0x2bd36b[_0x513c('0x2d')][_0x513c('0x32')]));_0x5c906a[_0x513c('0x30')]=_0x5c906a['attributes'][_0x513c('0x33')]?_0x5c906a[_0x513c('0x30')]:_0x1546a7[_0x513c('0x2f')];if(!_0x2bd36b[_0x513c('0x2d')]['hasOwnProperty'](_0x513c('0x34'))){_0x5c906a['limit']=qs[_0x513c('0x19')](_0x2bd36b[_0x513c('0x2d')]['limit']);_0x5c906a['offset']=qs[_0x513c('0x18')](_0x2bd36b['query']['offset']);}_0x5c906a[_0x513c('0x35')]=qs['sort'](_0x2bd36b[_0x513c('0x2d')]['sort']);_0x5c906a['where']=qs[_0x513c('0x36')](_[_0x513c('0x37')](_0x2bd36b[_0x513c('0x2d')],_0x1546a7['filters']),_0x38924e);if(_0x2bd36b[_0x513c('0x2d')]['filter']){_0x5c906a['where']=_[_0x513c('0x38')](_0x5c906a[_0x513c('0x39')],{'$or':_['map'](_0x38924e,function(_0x3072e5){if(_0x3072e5[_0x513c('0x2a')]!==_0x513c('0x3a')){var _0x57d07f={};_0x57d07f[_0x3072e5[_0x513c('0x2c')]]={'$like':'%'+_0x2bd36b[_0x513c('0x2d')][_0x513c('0x3b')]+'%'};return _0x57d07f;}})});}_0x5c906a=_[_0x513c('0x38')]({},_0x5c906a,_0x2bd36b[_0x513c('0x3c')]);var _0x8b8d33={'where':_0x5c906a['where']};return db[_0x513c('0x3d')][_0x513c('0x17')](_0x8b8d33)[_0x513c('0x20')](function(_0x47f720){_0x24d971[_0x513c('0x17')]=_0x47f720;if(_0x2bd36b[_0x513c('0x2d')][_0x513c('0x3e')]){_0x5c906a[_0x513c('0x3f')]=[{'all':!![]}];}return db[_0x513c('0x3d')][_0x513c('0x40')](_0x5c906a);})['then'](function(_0x13cc1b){_0x24d971[_0x513c('0x41')]=_0x13cc1b;return _0x24d971;})[_0x513c('0x20')](respondWithFilteredResult(_0xb087c2,_0x5c906a))['catch'](handleError(_0xb087c2,null));};exports[_0x513c('0x42')]=function(_0x21acfc,_0x18841c){var _0x12b073={'raw':![],'where':{'id':_0x21acfc[_0x513c('0x43')]['id']}},_0x30b8c4={};_0x30b8c4['model']=_[_0x513c('0x2e')](db[_0x513c('0x3d')][_0x513c('0x29')]);_0x30b8c4[_0x513c('0x2d')]=_[_0x513c('0x2e')](_0x21acfc[_0x513c('0x2d')]);_0x30b8c4[_0x513c('0x36')]=_[_0x513c('0x31')](_0x30b8c4[_0x513c('0x2f')],_0x30b8c4['query']);_0x12b073['attributes']=_['intersection'](_0x30b8c4[_0x513c('0x2f')],qs[_0x513c('0x32')](_0x21acfc[_0x513c('0x2d')]['fields']));_0x12b073[_0x513c('0x30')]=_0x12b073[_0x513c('0x30')][_0x513c('0x33')]?_0x12b073[_0x513c('0x30')]:_0x30b8c4[_0x513c('0x2f')];if(_0x21acfc[_0x513c('0x2d')][_0x513c('0x3e')]){_0x12b073[_0x513c('0x3f')]=[{'all':!![]}];}_0x12b073=_['merge']({},_0x12b073,_0x21acfc[_0x513c('0x3c')]);return db[_0x513c('0x3d')][_0x513c('0x44')](_0x12b073)[_0x513c('0x20')](handleEntityNotFound(_0x18841c,null))[_0x513c('0x20')](respondWithResult(_0x18841c,null))[_0x513c('0x45')](handleError(_0x18841c,null));};exports[_0x513c('0x24')]=function(_0x5f320c,_0x3e87be){return db[_0x513c('0x3d')]['find']({'where':{'id':_0x5f320c['params']['id']}})[_0x513c('0x20')](handleEntityNotFound(_0x3e87be,null))[_0x513c('0x20')](removeEntity(_0x3e87be,null))[_0x513c('0x45')](handleError(_0x3e87be,null));};exports[_0x513c('0x46')]=function(_0x38d706,_0x42cf66){return db[_0x513c('0x3d')][_0x513c('0x46')]()[_0x513c('0x20')](respondWithResult(_0x42cf66,null))[_0x513c('0x45')](handleError(_0x42cf66,null));};exports['create']=function(_0x168ad6,_0x25900d){var _0x3b2dcc;return db['sequelize']['transaction'](function(_0x37671a){return db[_0x513c('0x3d')]['create'](_0x168ad6[_0x513c('0x47')],{'transaction':_0x37671a})['then'](function(_0x1a1242){_0x3b2dcc=_0x1a1242[_0x513c('0x21')]({'plain':!![]});return db[_0x513c('0x48')]['find']({'where':{'id':_0x3b2dcc[_0x513c('0x49')]},'raw':!![]})[_0x513c('0x20')](function(_0x208c04){return createVoicePrefixExtensions(_0x3b2dcc,_0x208c04,_0x37671a);});});})[_0x513c('0x20')](function(){var _0x5c9ba3=_0x168ad6[_0x513c('0x4a')]['get']({'plain':!![]});if(!_0x5c9ba3)throw new Error(_0x513c('0x4b'));if(_0x5c9ba3[_0x513c('0x4c')]==='user'){var _0xa1cceb=_0x3b2dcc;return db[_0x513c('0x4d')][_0x513c('0x44')]({'where':{'name':_0x513c('0x22'),'userProfileId':_0x5c9ba3[_0x513c('0x4e')]},'raw':!![]})[_0x513c('0x20')](function(_0xf30bf9){if(_0xf30bf9&&_0xf30bf9[_0x513c('0x4f')]===0x0){return db[_0x513c('0x23')][_0x513c('0x50')]({'name':_0xa1cceb[_0x513c('0x2c')],'resourceId':_0xa1cceb['id'],'type':_0xf30bf9[_0x513c('0x2c')],'sectionId':_0xf30bf9['id']},{})['then'](function(){return _0x3b2dcc;});}else{return _0x3b2dcc;}})[_0x513c('0x45')](function(_0x38e321){logger[_0x513c('0x25')](_0x513c('0x51'),_0x38e321);throw _0x38e321;});}return _0x3b2dcc;})[_0x513c('0x20')](respondWithResult(_0x25900d,null))[_0x513c('0x45')](handleError(_0x25900d,null));};function Extension(_0x1afff5,_0x2823f0,_0x546c17,_0x41b3b0){this['context']=_0x513c('0x52');this[_0x513c('0x53')]=_0x1afff5;this['app']=_0x546c17;this[_0x513c('0x2a')]='system';this[_0x513c('0x54')]=_0x513c('0x55');this[_0x513c('0x56')]=_0x2823f0;this['appdata']=_0x41b3b0;}function createVoicePrefixExtensions(_0xb457df,_0x4199d0,_0x4f1371){return new BPromise(function(_0x3fa25b,_0x2e54dd){var _0x140769=new Extension(formatPrefixName(_0xb457df[_0x513c('0x57')]),0x1,'NoOp',_0x513c('0x58'));_0x140769[_0x513c('0x59')]=_0xb457df['id'];return db[_0x513c('0x48')]['create'](_0x140769,{'transaction':_0x4f1371})['then'](function(_0x300eb0){var _0x170cc9=_0x300eb0['get']({'plain':!![]});var _0x2fee11=_[_0x513c('0x28')](addVoicePrefixExtensions(_0xb457df,_0x4199d0),function(_0x136f92){_0x136f92['VoiceExtensionId']=_0x170cc9['id'];_0x136f92[_0x513c('0x59')]=_0xb457df['id'];return _0x136f92;});return db[_0x513c('0x48')][_0x513c('0x5a')](_0x2fee11,{'transaction':_0x4f1371})[_0x513c('0x20')](function(_0x1e43ad){if(!_0x1e43ad){return _0x2e54dd(_0x513c('0x5b'));}else{return _0x3fa25b(_0x1e43ad);}})['catch'](function(_0x386ecb){return _0x2e54dd(_0x386ecb);});});;});};function addVoicePrefixExtensions(_0x3e4910,_0x4b3af2){var _0x575175=[];var _0x23f614=formatPrefixName(_0x3e4910[_0x513c('0x57')]);_0x575175[_0x513c('0x5c')](new Extension(_0x23f614,0x2,_0x513c('0x5d'),'CDR(prefix)='+_0x3e4910['name']));if(_0x3e4910[_0x513c('0x5e')]){_0x575175[_0x513c('0x5c')](new Extension(_0x23f614,0x3,_0x513c('0x5d'),'PREFIX-CALLERIDALL='+_0x3e4910[_0x513c('0x5e')]));}else{_0x575175[_0x513c('0x5c')](new Extension(_0x23f614,0x3,_0x513c('0x5f'),_0x513c('0x60')));}_0x575175['push'](new Extension(_0x23f614,0x4,_0x513c('0x61'),_0x4b3af2[_0x513c('0x62')]+','+_0x513c('0x63')+(0x8+_0x3e4910[_0x513c('0x2c')][_0x513c('0x33')])+'}'+','+0x1));return _0x575175;}function formatPrefixName(_0x58f44d){var _0x36544e='_';for(var _0x32dabd=0x0;_0x32dabd<_0x58f44d[_0x513c('0x33')];_0x32dabd++){if(_0x58f44d[_0x513c('0x64')](_0x32dabd)=='-'){_0x36544e+=_0x58f44d[_0x513c('0x64')](_0x32dabd);}else{_0x36544e+='['+_0x58f44d[_0x513c('0x64')](_0x32dabd)+']';}}_0x36544e+='.';return _0x36544e;}exports[_0x513c('0x65')]=function(_0x39192c,_0x5d20fe,_0x31c63f){var _0x4c605e=_0x39192c['body'];_0x4c605e[_0x513c('0x57')]=_0x513c('0x66')+_0x4c605e[_0x513c('0x2c')]+'-';return db[_0x513c('0x67')]['transaction'](function(_0x377a71){return db[_0x513c('0x3d')]['update'](_0x4c605e,{'where':{'id':_0x4c605e['id']},'transaction':_0x377a71})['then'](function(){return db['VoiceExtension'][_0x513c('0x24')]({'where':{'VoicePrefixId':_0x4c605e['id']},'transaction':_0x377a71})[_0x513c('0x20')](function(){return db[_0x513c('0x48')]['find']({'where':{'id':_0x4c605e[_0x513c('0x49')]},'raw':!![]})[_0x513c('0x20')](function(_0x3e442c){return createVoicePrefixExtensions(_0x4c605e,_0x3e442c,_0x377a71);});});});})['then'](function(){return db[_0x513c('0x3d')][_0x513c('0x68')](_0x4c605e['id']);})[_0x513c('0x20')](respondWithResult(_0x5d20fe,null))[_0x513c('0x45')](handleError(_0x5d20fe,null));};exports[_0x513c('0x69')]=function(_0x355703,_0x3aeddf,_0x1afb42){return db['VoicePrefix'][_0x513c('0x44')]({'where':{'id':_0x355703[_0x513c('0x43')]['id']}})[_0x513c('0x20')](handleEntityNotFound(_0x3aeddf,null))[_0x513c('0x20')](function(_0x5be333){if(_0x5be333){return _0x5be333[_0x513c('0x69')](_0x355703[_0x513c('0x47')][_0x513c('0x6a')],_[_0x513c('0x6b')](_0x355703[_0x513c('0x47')],['ids','id'])||{})[_0x513c('0x6c')](function(_0x5143bc){for(var _0x49e39f=0x0;_0x49e39f<_0x355703[_0x513c('0x47')][_0x513c('0x6a')][_0x513c('0x33')];_0x49e39f+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x355703[_0x513c('0x47')][_0x513c('0x6a')][_0x49e39f],'VoicePrefixId':_0x355703[_0x513c('0x43')]['id']});}return _0x5143bc;});}})['then'](respondWithResult(_0x3aeddf,null))['catch'](handleError(_0x3aeddf,null));};exports[_0x513c('0x6d')]=function(_0x2b2072,_0x583355,_0x4c1aa3){return db[_0x513c('0x3d')]['find']({'where':{'id':_0x2b2072[_0x513c('0x43')]['id']}})[_0x513c('0x20')](handleEntityNotFound(_0x583355,null))[_0x513c('0x20')](function(_0x30a1c5){if(_0x30a1c5){return _0x30a1c5['removeAgents'](_0x2b2072[_0x513c('0x2d')][_0x513c('0x6a')])['then'](function(){if(_[_0x513c('0x6e')](_0x2b2072[_0x513c('0x2d')]['ids'])){for(var _0x16a608=0x0;_0x16a608<_0x2b2072[_0x513c('0x2d')][_0x513c('0x6a')][_0x513c('0x33')];_0x16a608+=0x1){socket[_0x513c('0x6f')]('userVoicePrefix:remove',{'UserId':Number(_0x2b2072[_0x513c('0x2d')][_0x513c('0x6a')][_0x16a608]),'VoicePrefixId':Number(_0x2b2072['params']['id'])});}}else{socket[_0x513c('0x6f')](_0x513c('0x70'),{'UserId':Number(_0x2b2072[_0x513c('0x2d')]['ids']),'VoicePrefixId':Number(_0x2b2072[_0x513c('0x43')]['id'])});}});}})['then'](respondWithStatusCode(_0x583355,null))[_0x513c('0x45')](handleError(_0x583355,null));};exports[_0x513c('0x71')]=function(_0x10bfeb,_0xc8705c,_0x4ffff0){var _0x343cad={};var _0x58f050={};var _0x3ca1db;var _0x1b60dc;return db['VoicePrefix'][_0x513c('0x72')]({'where':{'id':_0x10bfeb[_0x513c('0x43')]['id']}})[_0x513c('0x20')](handleEntityNotFound(_0xc8705c,null))[_0x513c('0x20')](function(_0x3abd8d){if(_0x3abd8d){_0x3ca1db=_0x3abd8d;_0x58f050[_0x513c('0x2f')]=_[_0x513c('0x2e')](db['User'][_0x513c('0x29')]);_0x58f050[_0x513c('0x2d')]=_[_0x513c('0x2e')](_0x10bfeb['query']);_0x58f050[_0x513c('0x36')]=_[_0x513c('0x31')](_0x58f050[_0x513c('0x2f')],_0x58f050['query']);_0x343cad[_0x513c('0x30')]=_['intersection'](_0x58f050[_0x513c('0x2f')],qs[_0x513c('0x32')](_0x10bfeb['query'][_0x513c('0x32')]));_0x343cad['attributes']=_0x343cad[_0x513c('0x30')][_0x513c('0x33')]?_0x343cad[_0x513c('0x30')]:_0x58f050[_0x513c('0x2f')];_0x343cad[_0x513c('0x35')]=qs[_0x513c('0x73')](_0x10bfeb[_0x513c('0x2d')][_0x513c('0x73')]);_0x343cad[_0x513c('0x39')]=qs[_0x513c('0x36')](_[_0x513c('0x37')](_0x10bfeb[_0x513c('0x2d')],_0x58f050[_0x513c('0x36')]));if(_0x10bfeb['query'][_0x513c('0x3b')]){_0x343cad['where']=_[_0x513c('0x38')](_0x343cad['where'],{'$or':_['map'](_0x343cad['attributes'],function(_0x125fbb){var _0x1670fc={};_0x1670fc[_0x125fbb]={'$like':'%'+_0x10bfeb[_0x513c('0x2d')][_0x513c('0x3b')]+'%'};return _0x1670fc;})});}_0x343cad=_[_0x513c('0x38')]({},_0x343cad,_0x10bfeb['options']);return _0x3ca1db[_0x513c('0x71')](_0x343cad);}})[_0x513c('0x20')](function(_0x9ef409){if(_0x9ef409){_0x1b60dc=_0x9ef409[_0x513c('0x33')];if(!_0x10bfeb[_0x513c('0x2d')][_0x513c('0x74')](_0x513c('0x34'))){_0x343cad[_0x513c('0x19')]=qs[_0x513c('0x19')](_0x10bfeb[_0x513c('0x2d')]['limit']);_0x343cad['offset']=qs['offset'](_0x10bfeb[_0x513c('0x2d')]['offset']);}return _0x3ca1db[_0x513c('0x71')](_0x343cad);}})[_0x513c('0x20')](function(_0x1cc13c){if(_0x1cc13c){return _0x1cc13c?{'count':_0x1b60dc,'rows':_0x1cc13c}:null;}})[_0x513c('0x20')](respondWithResult(_0xc8705c,null))[_0x513c('0x45')](handleError(_0xc8705c,null));}; \ No newline at end of file +var _0xa3fe=['json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','UserProfileResource','error','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','params','length','merge','catch','describe','create','sequelize','transaction','body','VoiceExtension','find','VoiceExtensionId','user','get','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end'];(function(_0x272b56,_0x4b3d2b){var _0x50dfe3=function(_0x9c9a15){while(--_0x9c9a15){_0x272b56['push'](_0x272b56['shift']());}};_0x50dfe3(++_0x4b3d2b);}(_0xa3fe,0xd8));var _0xea3f=function(_0x38c29b,_0x3fe769){_0x38c29b=_0x38c29b-0x0;var _0x56c702=_0xa3fe[_0x38c29b];return _0x56c702;};'use strict';var pdf=require(_0xea3f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xea3f('0x1'));var zipdir=require(_0xea3f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea3f('0x3'));var moment=require(_0xea3f('0x4'));var BPromise=require(_0xea3f('0x5'));var Mustache=require('mustache');var util=require(_0xea3f('0x6'));var path=require('path');var sox=require(_0xea3f('0x7'));var csv=require(_0xea3f('0x8'));var ejs=require(_0xea3f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xea3f('0xa'));var crypto=require(_0xea3f('0xb'));var jsforce=require(_0xea3f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xea3f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xea3f('0xe'));var qs=require(_0xea3f('0xf'));var as=require(_0xea3f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xea3f('0x11'));var config=require(_0xea3f('0x12'));var licenseUtil=require(_0xea3f('0x13'));var db=require(_0xea3f('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xea3f('0x15'),'port':0x18eb});var socket=require(_0xea3f('0x16'))(new Redis(config['redis']));require(_0xea3f('0x17'))[_0xea3f('0x18')](socket);function respondWithStatusCode(_0x4942ec,_0x1786f6){_0x1786f6=_0x1786f6||0xcc;return function(_0x307409){if(_0x307409){return _0x4942ec[_0xea3f('0x19')](_0x1786f6);}return _0x4942ec[_0xea3f('0x1a')](_0x1786f6)[_0xea3f('0x1b')]();};}function respondWithResult(_0x15e057,_0x7470e3){_0x7470e3=_0x7470e3||0xc8;return function(_0x2585f1){if(_0x2585f1){return _0x15e057[_0xea3f('0x1a')](_0x7470e3)[_0xea3f('0x1c')](_0x2585f1);}};}function respondWithFilteredResult(_0x3a2f1d,_0x31b8ca){return function(_0x453f29){if(_0x453f29){var _0x116d13=_0x453f29[_0xea3f('0x1d')],_0x35798d=_0x31b8ca['offset'],_0xc199e4=_0x31b8ca[_0xea3f('0x1e')]+_0x31b8ca[_0xea3f('0x1f')],_0x24d3b5;if(_0xc199e4>=_0x116d13){_0xc199e4=_0x116d13;_0x24d3b5=0xc8;}else{_0x24d3b5=0xce;}_0x3a2f1d[_0xea3f('0x1a')](_0x24d3b5);return _0x3a2f1d[_0xea3f('0x20')](_0xea3f('0x21'),_0x35798d+'-'+_0xc199e4+'/'+_0x116d13)['json'](_0x453f29);}return null;};}function patchUpdates(_0x4af6e4){return function(_0xd55dea){try{jsonpatch[_0xea3f('0x22')](_0xd55dea,_0x4af6e4,!![]);}catch(_0x4c6d50){return BPromise[_0xea3f('0x23')](_0x4c6d50);}return _0xd55dea[_0xea3f('0x24')]();};}function saveUpdates(_0x1a2cdc,_0x144380){return function(_0x5f452b){if(_0x5f452b){return _0x5f452b['update'](_0x1a2cdc)['then'](function(_0x2f8bdc){return _0x2f8bdc;});}return null;};}function removeEntity(_0x354d26,_0x1499f2){return function(_0x17b381){if(_0x17b381){return _0x17b381[_0xea3f('0x25')]()[_0xea3f('0x26')](function(){var _0x3f07d5=_0x17b381['get']({'plain':!![]});var _0x28f846='VoicePrefixes';return db[_0xea3f('0x27')][_0xea3f('0x25')]({'where':{'type':_0x28f846,'resourceId':_0x3f07d5['id']}})[_0xea3f('0x26')](function(){return _0x17b381;});})[_0xea3f('0x26')](function(){_0x354d26[_0xea3f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaf81bb,_0x52a401){return function(_0xa1bfcf){if(!_0xa1bfcf){_0xaf81bb[_0xea3f('0x19')](0x194);}return _0xa1bfcf;};}function handleError(_0x20e014,_0x4cd4e9){_0x4cd4e9=_0x4cd4e9||0x1f4;return function(_0x437070){logger[_0xea3f('0x28')](_0x437070['stack']);if(_0x437070[_0xea3f('0x29')]){delete _0x437070[_0xea3f('0x29')];}_0x20e014[_0xea3f('0x1a')](_0x4cd4e9)[_0xea3f('0x2a')](_0x437070);};}exports[_0xea3f('0x2b')]=function(_0x177de5,_0x18a7e7){var _0x300b30={},_0x33aed0={},_0x225483={'count':0x0,'rows':[]};var _0x35636d=_[_0xea3f('0x2c')](db[_0xea3f('0x2d')][_0xea3f('0x2e')],function(_0x302fdc){return{'name':_0x302fdc[_0xea3f('0x2f')],'type':_0x302fdc[_0xea3f('0x30')][_0xea3f('0x31')]};});_0x33aed0[_0xea3f('0x32')]=_['map'](_0x35636d,_0xea3f('0x29'));_0x33aed0[_0xea3f('0x33')]=_[_0xea3f('0x34')](_0x177de5[_0xea3f('0x33')]);_0x33aed0[_0xea3f('0x35')]=_[_0xea3f('0x36')](_0x33aed0[_0xea3f('0x32')],_0x33aed0[_0xea3f('0x33')]);_0x300b30[_0xea3f('0x37')]=_['intersection'](_0x33aed0[_0xea3f('0x32')],qs[_0xea3f('0x38')](_0x177de5[_0xea3f('0x33')][_0xea3f('0x38')]));_0x300b30[_0xea3f('0x37')]=_0x300b30['attributes']['length']?_0x300b30[_0xea3f('0x37')]:_0x33aed0['model'];if(!_0x177de5[_0xea3f('0x33')][_0xea3f('0x39')](_0xea3f('0x3a'))){_0x300b30[_0xea3f('0x1f')]=qs[_0xea3f('0x1f')](_0x177de5[_0xea3f('0x33')]['limit']);_0x300b30[_0xea3f('0x1e')]=qs['offset'](_0x177de5['query'][_0xea3f('0x1e')]);}_0x300b30[_0xea3f('0x3b')]=qs[_0xea3f('0x3c')](_0x177de5[_0xea3f('0x33')][_0xea3f('0x3c')]);_0x300b30[_0xea3f('0x3d')]=qs[_0xea3f('0x35')](_[_0xea3f('0x3e')](_0x177de5[_0xea3f('0x33')],_0x33aed0[_0xea3f('0x35')]),_0x35636d);if(_0x177de5[_0xea3f('0x33')][_0xea3f('0x3f')]){_0x300b30[_0xea3f('0x3d')]=_['merge'](_0x300b30[_0xea3f('0x3d')],{'$or':_['map'](_0x35636d,function(_0x3e0359){if(_0x3e0359[_0xea3f('0x30')]!==_0xea3f('0x40')){var _0xea73b8={};_0xea73b8[_0x3e0359[_0xea3f('0x29')]]={'$like':'%'+_0x177de5['query'][_0xea3f('0x3f')]+'%'};return _0xea73b8;}})});}_0x300b30=_['merge']({},_0x300b30,_0x177de5[_0xea3f('0x41')]);var _0x3b1109={'where':_0x300b30[_0xea3f('0x3d')]};return db[_0xea3f('0x2d')][_0xea3f('0x1d')](_0x3b1109)[_0xea3f('0x26')](function(_0x36416d){_0x225483[_0xea3f('0x1d')]=_0x36416d;if(_0x177de5[_0xea3f('0x33')][_0xea3f('0x42')]){_0x300b30[_0xea3f('0x43')]=[{'all':!![]}];}return db[_0xea3f('0x2d')][_0xea3f('0x44')](_0x300b30);})[_0xea3f('0x26')](function(_0x464a1b){_0x225483['rows']=_0x464a1b;return _0x225483;})[_0xea3f('0x26')](respondWithFilteredResult(_0x18a7e7,_0x300b30))['catch'](handleError(_0x18a7e7,null));};exports[_0xea3f('0x45')]=function(_0x525591,_0x306574){var _0x1431c3={'raw':![],'where':{'id':_0x525591[_0xea3f('0x46')]['id']}},_0x5b57e8={};_0x5b57e8[_0xea3f('0x32')]=_['keys'](db[_0xea3f('0x2d')][_0xea3f('0x2e')]);_0x5b57e8[_0xea3f('0x33')]=_['keys'](_0x525591[_0xea3f('0x33')]);_0x5b57e8[_0xea3f('0x35')]=_[_0xea3f('0x36')](_0x5b57e8[_0xea3f('0x32')],_0x5b57e8[_0xea3f('0x33')]);_0x1431c3[_0xea3f('0x37')]=_[_0xea3f('0x36')](_0x5b57e8[_0xea3f('0x32')],qs[_0xea3f('0x38')](_0x525591[_0xea3f('0x33')][_0xea3f('0x38')]));_0x1431c3[_0xea3f('0x37')]=_0x1431c3[_0xea3f('0x37')][_0xea3f('0x47')]?_0x1431c3['attributes']:_0x5b57e8['model'];if(_0x525591[_0xea3f('0x33')]['includeAll']){_0x1431c3[_0xea3f('0x43')]=[{'all':!![]}];}_0x1431c3=_[_0xea3f('0x48')]({},_0x1431c3,_0x525591['options']);return db['VoicePrefix']['find'](_0x1431c3)['then'](handleEntityNotFound(_0x306574,null))[_0xea3f('0x26')](respondWithResult(_0x306574,null))[_0xea3f('0x49')](handleError(_0x306574,null));};exports[_0xea3f('0x25')]=function(_0x155792,_0x2e4b61){return db[_0xea3f('0x2d')]['find']({'where':{'id':_0x155792[_0xea3f('0x46')]['id']}})['then'](handleEntityNotFound(_0x2e4b61,null))[_0xea3f('0x26')](removeEntity(_0x2e4b61,null))[_0xea3f('0x49')](handleError(_0x2e4b61,null));};exports['describe']=function(_0x2362ad,_0x3d261c){return db['VoicePrefix'][_0xea3f('0x4a')]()[_0xea3f('0x26')](respondWithResult(_0x3d261c,null))[_0xea3f('0x49')](handleError(_0x3d261c,null));};exports[_0xea3f('0x4b')]=function(_0x269534,_0x14920f){var _0x983a4b;return db[_0xea3f('0x4c')][_0xea3f('0x4d')](function(_0x2db380){return db[_0xea3f('0x2d')][_0xea3f('0x4b')](_0x269534[_0xea3f('0x4e')],{'transaction':_0x2db380})['then'](function(_0x4c7c41){_0x983a4b=_0x4c7c41['get']({'plain':!![]});return db[_0xea3f('0x4f')][_0xea3f('0x50')]({'where':{'id':_0x983a4b[_0xea3f('0x51')]},'raw':!![]})[_0xea3f('0x26')](function(_0x3e2cb3){return createVoicePrefixExtensions(_0x983a4b,_0x3e2cb3,_0x2db380);});});})[_0xea3f('0x26')](function(){var _0x529cd4=_0x269534[_0xea3f('0x52')][_0xea3f('0x53')]({'plain':!![]});if(!_0x529cd4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x529cd4[_0xea3f('0x54')]==='user'){var _0x20ceda=_0x983a4b;return db[_0xea3f('0x55')][_0xea3f('0x50')]({'where':{'name':_0xea3f('0x56'),'userProfileId':_0x529cd4[_0xea3f('0x57')]},'raw':!![]})[_0xea3f('0x26')](function(_0x20c864){if(_0x20c864&&_0x20c864[_0xea3f('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x20ceda['name'],'resourceId':_0x20ceda['id'],'type':_0x20c864[_0xea3f('0x29')],'sectionId':_0x20c864['id']},{})[_0xea3f('0x26')](function(){return _0x983a4b;});}else{return _0x983a4b;}})[_0xea3f('0x49')](function(_0x4bb935){logger[_0xea3f('0x28')](_0xea3f('0x59'),_0x4bb935);throw _0x4bb935;});}return _0x983a4b;})['then'](respondWithResult(_0x14920f,null))[_0xea3f('0x49')](handleError(_0x14920f,null));};function Extension(_0x5c6841,_0x5ba685,_0xc998ca,_0x5bf5f2){this[_0xea3f('0x5a')]=_0xea3f('0x5b');this[_0xea3f('0x5c')]=_0x5c6841;this[_0xea3f('0x5d')]=_0xc998ca;this[_0xea3f('0x30')]='system';this[_0xea3f('0x5e')]=_0xea3f('0x5f');this[_0xea3f('0x60')]=_0x5ba685;this[_0xea3f('0x61')]=_0x5bf5f2;}function createVoicePrefixExtensions(_0x73e7e4,_0x2ac961,_0x527e46){return new BPromise(function(_0x50bfc4,_0x18627a){var _0x41c544=new Extension(formatPrefixName(_0x73e7e4[_0xea3f('0x62')]),0x1,_0xea3f('0x63'),_0xea3f('0x64'));_0x41c544[_0xea3f('0x65')]=_0x73e7e4['id'];return db['VoiceExtension'][_0xea3f('0x4b')](_0x41c544,{'transaction':_0x527e46})[_0xea3f('0x26')](function(_0x43a1db){var _0x3c255a=_0x43a1db['get']({'plain':!![]});var _0x248a76=_[_0xea3f('0x2c')](addVoicePrefixExtensions(_0x73e7e4,_0x2ac961),function(_0x5102bb){_0x5102bb[_0xea3f('0x51')]=_0x3c255a['id'];_0x5102bb[_0xea3f('0x65')]=_0x73e7e4['id'];return _0x5102bb;});return db[_0xea3f('0x4f')]['bulkCreate'](_0x248a76,{'transaction':_0x527e46})[_0xea3f('0x26')](function(_0x2127e9){if(!_0x2127e9){return _0x18627a('Extensions\x20creation\x20failed');}else{return _0x50bfc4(_0x2127e9);}})['catch'](function(_0x173b12){return _0x18627a(_0x173b12);});});;});};function addVoicePrefixExtensions(_0x316f2d,_0x12b7b9){var _0x2f6580=[];var _0x360268=formatPrefixName(_0x316f2d[_0xea3f('0x62')]);_0x2f6580[_0xea3f('0x66')](new Extension(_0x360268,0x2,_0xea3f('0x67'),_0xea3f('0x68')+_0x316f2d[_0xea3f('0x29')]));if(_0x316f2d[_0xea3f('0x69')]){_0x2f6580[_0xea3f('0x66')](new Extension(_0x360268,0x3,_0xea3f('0x67'),_0xea3f('0x6a')+_0x316f2d[_0xea3f('0x69')]));}else{_0x2f6580[_0xea3f('0x66')](new Extension(_0x360268,0x3,_0xea3f('0x63'),_0xea3f('0x6b')));}_0x2f6580[_0xea3f('0x66')](new Extension(_0x360268,0x4,'goto',_0x12b7b9[_0xea3f('0x5a')]+','+_0xea3f('0x6c')+(0x8+_0x316f2d['name'][_0xea3f('0x47')])+'}'+','+0x1));return _0x2f6580;}function formatPrefixName(_0x6d79e1){var _0x22bcbd='_';for(var _0xf306=0x0;_0xf306<_0x6d79e1[_0xea3f('0x47')];_0xf306++){if(_0x6d79e1[_0xea3f('0x6d')](_0xf306)=='-'){_0x22bcbd+=_0x6d79e1[_0xea3f('0x6d')](_0xf306);}else{_0x22bcbd+='['+_0x6d79e1[_0xea3f('0x6d')](_0xf306)+']';}}_0x22bcbd+='.';return _0x22bcbd;}exports['update']=function(_0x23ccbc,_0x41db71,_0x5119b4){var _0x59169f=_0x23ccbc[_0xea3f('0x4e')];_0x59169f[_0xea3f('0x62')]='system-'+_0x59169f['name']+'-';return db[_0xea3f('0x4c')]['transaction'](function(_0x89a85d){return db[_0xea3f('0x2d')]['update'](_0x59169f,{'where':{'id':_0x59169f['id']},'transaction':_0x89a85d})['then'](function(){return db[_0xea3f('0x4f')][_0xea3f('0x25')]({'where':{'VoicePrefixId':_0x59169f['id']},'transaction':_0x89a85d})['then'](function(){return db[_0xea3f('0x4f')][_0xea3f('0x50')]({'where':{'id':_0x59169f[_0xea3f('0x51')]},'raw':!![]})[_0xea3f('0x26')](function(_0x3fe110){return createVoicePrefixExtensions(_0x59169f,_0x3fe110,_0x89a85d);});});});})[_0xea3f('0x26')](function(){return db[_0xea3f('0x2d')][_0xea3f('0x6e')](_0x59169f['id']);})[_0xea3f('0x26')](respondWithResult(_0x41db71,null))[_0xea3f('0x49')](handleError(_0x41db71,null));};exports[_0xea3f('0x6f')]=function(_0xfc217f,_0x17fda5,_0x310b2f){return db['VoicePrefix'][_0xea3f('0x50')]({'where':{'id':_0xfc217f[_0xea3f('0x46')]['id']}})[_0xea3f('0x26')](handleEntityNotFound(_0x17fda5,null))[_0xea3f('0x26')](function(_0x160b16){if(_0x160b16){return _0x160b16['addAgents'](_0xfc217f['body'][_0xea3f('0x70')],_[_0xea3f('0x71')](_0xfc217f['body'],[_0xea3f('0x70'),'id'])||{})[_0xea3f('0x72')](function(_0x105c6f){for(var _0xc763c6=0x0;_0xc763c6<_0xfc217f[_0xea3f('0x4e')][_0xea3f('0x70')][_0xea3f('0x47')];_0xc763c6+=0x1){socket['emit'](_0xea3f('0x73'),{'UserId':_0xfc217f[_0xea3f('0x4e')][_0xea3f('0x70')][_0xc763c6],'VoicePrefixId':_0xfc217f[_0xea3f('0x46')]['id']});}return _0x105c6f;});}})[_0xea3f('0x26')](respondWithResult(_0x17fda5,null))[_0xea3f('0x49')](handleError(_0x17fda5,null));};exports[_0xea3f('0x74')]=function(_0x521921,_0x2a81d2,_0x5c88f6){return db[_0xea3f('0x2d')]['find']({'where':{'id':_0x521921[_0xea3f('0x46')]['id']}})[_0xea3f('0x26')](handleEntityNotFound(_0x2a81d2,null))[_0xea3f('0x26')](function(_0x1c2f8f){if(_0x1c2f8f){return _0x1c2f8f['removeAgents'](_0x521921[_0xea3f('0x33')][_0xea3f('0x70')])['then'](function(){if(_['isArray'](_0x521921[_0xea3f('0x33')][_0xea3f('0x70')])){for(var _0x1b0758=0x0;_0x1b0758<_0x521921[_0xea3f('0x33')][_0xea3f('0x70')][_0xea3f('0x47')];_0x1b0758+=0x1){socket[_0xea3f('0x75')](_0xea3f('0x76'),{'UserId':Number(_0x521921['query']['ids'][_0x1b0758]),'VoicePrefixId':Number(_0x521921['params']['id'])});}}else{socket[_0xea3f('0x75')](_0xea3f('0x76'),{'UserId':Number(_0x521921[_0xea3f('0x33')][_0xea3f('0x70')]),'VoicePrefixId':Number(_0x521921[_0xea3f('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a81d2,null))[_0xea3f('0x49')](handleError(_0x2a81d2,null));};exports[_0xea3f('0x77')]=function(_0x278e89,_0x338de8,_0x5436fb){var _0x1b6e7e={};var _0xf33e0={};var _0x11c80c;var _0x444f16;return db['VoicePrefix'][_0xea3f('0x78')]({'where':{'id':_0x278e89[_0xea3f('0x46')]['id']}})[_0xea3f('0x26')](handleEntityNotFound(_0x338de8,null))['then'](function(_0x24898f){if(_0x24898f){_0x11c80c=_0x24898f;_0xf33e0[_0xea3f('0x32')]=_[_0xea3f('0x34')](db[_0xea3f('0x79')][_0xea3f('0x2e')]);_0xf33e0[_0xea3f('0x33')]=_[_0xea3f('0x34')](_0x278e89[_0xea3f('0x33')]);_0xf33e0[_0xea3f('0x35')]=_[_0xea3f('0x36')](_0xf33e0['model'],_0xf33e0[_0xea3f('0x33')]);_0x1b6e7e[_0xea3f('0x37')]=_[_0xea3f('0x36')](_0xf33e0[_0xea3f('0x32')],qs['fields'](_0x278e89[_0xea3f('0x33')][_0xea3f('0x38')]));_0x1b6e7e['attributes']=_0x1b6e7e[_0xea3f('0x37')][_0xea3f('0x47')]?_0x1b6e7e[_0xea3f('0x37')]:_0xf33e0[_0xea3f('0x32')];_0x1b6e7e[_0xea3f('0x3b')]=qs[_0xea3f('0x3c')](_0x278e89[_0xea3f('0x33')][_0xea3f('0x3c')]);_0x1b6e7e[_0xea3f('0x3d')]=qs[_0xea3f('0x35')](_[_0xea3f('0x3e')](_0x278e89[_0xea3f('0x33')],_0xf33e0[_0xea3f('0x35')]));if(_0x278e89[_0xea3f('0x33')][_0xea3f('0x3f')]){_0x1b6e7e[_0xea3f('0x3d')]=_[_0xea3f('0x48')](_0x1b6e7e['where'],{'$or':_[_0xea3f('0x2c')](_0x1b6e7e[_0xea3f('0x37')],function(_0x58fa81){var _0x16d0b0={};_0x16d0b0[_0x58fa81]={'$like':'%'+_0x278e89[_0xea3f('0x33')]['filter']+'%'};return _0x16d0b0;})});}_0x1b6e7e=_[_0xea3f('0x48')]({},_0x1b6e7e,_0x278e89['options']);return _0x11c80c['getAgents'](_0x1b6e7e);}})[_0xea3f('0x26')](function(_0x35732a){if(_0x35732a){_0x444f16=_0x35732a['length'];if(!_0x278e89['query'][_0xea3f('0x39')](_0xea3f('0x3a'))){_0x1b6e7e['limit']=qs[_0xea3f('0x1f')](_0x278e89[_0xea3f('0x33')]['limit']);_0x1b6e7e['offset']=qs[_0xea3f('0x1e')](_0x278e89[_0xea3f('0x33')][_0xea3f('0x1e')]);}return _0x11c80c[_0xea3f('0x77')](_0x1b6e7e);}})[_0xea3f('0x26')](function(_0x297897){if(_0x297897){return _0x297897?{'count':_0x444f16,'rows':_0x297897}:null;}})['then'](respondWithResult(_0x338de8,null))['catch'](handleError(_0x338de8,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 98d197f..210b3c8 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 _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xcb91=['save','update','emit','hasOwnProperty','hook','VoicePrefix','setMaxListeners'];(function(_0x9dcc6a,_0x2741d3){var _0x1d514e=function(_0x39f6a9){while(--_0x39f6a9){_0x9dcc6a['push'](_0x9dcc6a['shift']());}};_0x1d514e(++_0x2741d3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0xcb91[_0x189305];return _0xea3406;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x1cb9('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){VoicePrefixEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);VoicePrefixEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];VoicePrefix[_0x1cb9('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 897c639..afe9d25 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 _0xc5b1=['exports','define','voice_prefixes','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes'];(function(_0xa93409,_0x1d4e75){var _0x1fb94f=function(_0x44f009){while(--_0x44f009){_0xa93409['push'](_0xa93409['shift']());}};_0x1fb94f(++_0x1d4e75);}(_0xc5b1,0x177));var _0x1c5b=function(_0x4414af,_0xb3054a){_0x4414af=_0x4414af-0x0;var _0x5dcee7=_0xc5b1[_0x4414af];return _0x5dcee7;};'use strict';var _=require('lodash');var util=require(_0x1c5b('0x0'));var logger=require(_0x1c5b('0x1'))(_0x1c5b('0x2'));var moment=require('moment');var BPromise=require(_0x1c5b('0x3'));var rp=require(_0x1c5b('0x4'));var fs=require('fs');var path=require(_0x1c5b('0x5'));var rimraf=require(_0x1c5b('0x6'));var config=require(_0x1c5b('0x7'));var attributes=require(_0x1c5b('0x8'));module[_0x1c5b('0x9')]=function(_0x59db38,_0x16c138){return _0x59db38[_0x1c5b('0xa')]('VoicePrefix',attributes,{'tableName':_0x1c5b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f50=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','VoicePrefix','voice_prefixes','lodash','util','api'];(function(_0x2bcbc8,_0x3d1f69){var _0xf97356=function(_0x1c792d){while(--_0x1c792d){_0x2bcbc8['push'](_0x2bcbc8['shift']());}};_0xf97356(++_0x3d1f69);}(_0x6f50,0x17e));var _0x06f5=function(_0x587f88,_0x299a03){_0x587f88=_0x587f88-0x0;var _0x306efa=_0x6f50[_0x587f88];return _0x306efa;};'use strict';var _=require(_0x06f5('0x0'));var util=require(_0x06f5('0x1'));var logger=require('../../config/logger')(_0x06f5('0x2'));var moment=require(_0x06f5('0x3'));var BPromise=require(_0x06f5('0x4'));var rp=require(_0x06f5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06f5('0x6'));var config=require(_0x06f5('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x06f5('0x8')]=function(_0x751e9e,_0x4e9619){return _0x751e9e['define'](_0x06f5('0x9'),attributes,{'tableName':_0x06f5('0xa'),'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 1a0a4c4..fff0393 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 _0xdc1a=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xdc1a,0x12f));var _0xadc1=function(_0x2ff7d6,_0x3b84fb){_0x2ff7d6=_0x2ff7d6-0x0;var _0x4dfe51=_0xdc1a[_0x2ff7d6];return _0x4dfe51;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xadc1('0x0'));var BPromise=require(_0xadc1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadc1('0x2'));var db=require(_0xadc1('0x3'))['db'];var utils=require(_0xadc1('0x4'));var logger=require('../../config/logger')(_0xadc1('0x5'));var config=require(_0xadc1('0x6'));var jayson=require(_0xadc1('0x7'));var client=jayson[_0xadc1('0x8')][_0xadc1('0x9')]({'port':0x232a});config[_0xadc1('0xa')]=_[_0xadc1('0xb')](config[_0xadc1('0xa')],{'host':_0xadc1('0xc'),'port':0x18eb});var socket=require(_0xadc1('0xd'))(new Redis(config[_0xadc1('0xa')]));require(_0xadc1('0xe'))[_0xadc1('0xf')](socket);function respondWithRpcPromise(_0x3d55f9,_0x2f8412,_0x121b67){return new BPromise(function(_0xe3de96,_0x4d086c){return client[_0xadc1('0x10')](_0x3d55f9,_0x121b67)[_0xadc1('0x11')](function(_0x5280ef){logger[_0xadc1('0x12')](_0xadc1('0x13'),_0x2f8412,_0xadc1('0x14'));logger['debug'](_0xadc1('0x15'),_0x2f8412,_0xadc1('0x14'),JSON[_0xadc1('0x16')](_0x5280ef));if(_0x5280ef[_0xadc1('0x17')]){if(_0x5280ef[_0xadc1('0x17')][_0xadc1('0x18')]===0x1f4){logger[_0xadc1('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x2f8412,_0x5280ef['error'][_0xadc1('0x19')]);return _0x4d086c(_0x5280ef[_0xadc1('0x17')]['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x2f8412,_0x5280ef['error']['message']);return _0xe3de96(_0x5280ef[_0xadc1('0x17')][_0xadc1('0x19')]);}else{logger[_0xadc1('0x12')](_0xadc1('0x13'),_0x2f8412,'request\x20sent');_0xe3de96(_0x5280ef[_0xadc1('0x1a')][_0xadc1('0x19')]);}})[_0xadc1('0x1b')](function(_0xbe1dff){logger[_0xadc1('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x2f8412,_0xbe1dff);_0x4d086c(_0xbe1dff);});});} \ No newline at end of file +var _0x340e=['localhost','./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','error','message','info','result','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x340e,0x1c3));var _0xe340=function(_0x5a263f,_0x32fe6f){_0x5a263f=_0x5a263f-0x0;var _0x271947=_0x340e[_0x5a263f];return _0x271947;};'use strict';var _=require('lodash');var util=require(_0xe340('0x0'));var moment=require('moment');var BPromise=require(_0xe340('0x1'));var rs=require(_0xe340('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe340('0x3'));var logger=require('../../config/logger')(_0xe340('0x4'));var config=require(_0xe340('0x5'));var jayson=require(_0xe340('0x6'));var client=jayson[_0xe340('0x7')][_0xe340('0x8')]({'port':0x232a});config[_0xe340('0x9')]=_[_0xe340('0xa')](config[_0xe340('0x9')],{'host':_0xe340('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe340('0x9')]));require(_0xe340('0xc'))['register'](socket);function respondWithRpcPromise(_0x53b0ac,_0x1993cd,_0x3261e5){return new BPromise(function(_0x582061,_0xe847c3){return client[_0xe340('0xd')](_0x53b0ac,_0x3261e5)[_0xe340('0xe')](function(_0xd9d222){logger['info'](_0xe340('0xf'),_0x1993cd,_0xe340('0x10'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x1993cd,_0xe340('0x10'),JSON['stringify'](_0xd9d222));if(_0xd9d222['error']){if(_0xd9d222[_0xe340('0x11')]['code']===0x1f4){logger[_0xe340('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x1993cd,_0xd9d222[_0xe340('0x11')][_0xe340('0x12')]);return _0xe847c3(_0xd9d222[_0xe340('0x11')][_0xe340('0x12')]);}logger[_0xe340('0x11')](_0xe340('0xf'),_0x1993cd,_0xd9d222[_0xe340('0x11')][_0xe340('0x12')]);return _0x582061(_0xd9d222[_0xe340('0x11')]['message']);}else{logger[_0xe340('0x13')](_0xe340('0xf'),_0x1993cd,_0xe340('0x10'));_0x582061(_0xd9d222[_0xe340('0x14')][_0xe340('0x12')]);}})['catch'](function(_0xdc063f){logger['error'](_0xe340('0xf'),_0x1993cd,_0xdc063f);_0xe847c3(_0xdc063f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index d4f21e9..cf84000 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 _0x0f5e=['register','length','voicePrefix:','./voicePrefix.events','save','update','removeListener'];(function(_0x15f357,_0x56c58f){var _0x2be40f=function(_0x1b08a2){while(--_0x1b08a2){_0x15f357['push'](_0x15f357['shift']());}};_0x2be40f(++_0x56c58f);}(_0x0f5e,0x96));var _0xe0f5=function(_0x39ea0c,_0x3e248d){_0x39ea0c=_0x39ea0c-0x0;var _0x158c7e=_0x0f5e[_0x39ea0c];return _0x158c7e;};'use strict';var VoicePrefixEvents=require(_0xe0f5('0x0'));var events=[_0xe0f5('0x1'),'remove',_0xe0f5('0x2')];function createListener(_0x3a2917,_0x4ec436){return function(_0x1c70c0){_0x4ec436['emit'](_0x3a2917,_0x1c70c0);};}function removeListener(_0x137d9c,_0x409707){return function(){VoicePrefixEvents[_0xe0f5('0x3')](_0x137d9c,_0x409707);};}exports[_0xe0f5('0x4')]=function(_0x24dde7){for(var _0x102c3a=0x0,_0x3bb37a=events[_0xe0f5('0x5')];_0x102c3a<_0x3bb37a;_0x102c3a++){var _0x525b78=events[_0x102c3a];var _0x4aa43e=createListener(_0xe0f5('0x6')+_0x525b78,_0x24dde7);VoicePrefixEvents['on'](_0x525b78,_0x4aa43e);}}; \ No newline at end of file +var _0xe803=['save','remove','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x590657,_0x4e51ed){var _0x458b06=function(_0x4bc839){while(--_0x4bc839){_0x590657['push'](_0x590657['shift']());}};_0x458b06(++_0x4e51ed);}(_0xe803,0x15e));var _0x3e80=function(_0x298f32,_0x341f6b){_0x298f32=_0x298f32-0x0;var _0x1d224c=_0xe803[_0x298f32];return _0x1d224c;};'use strict';var VoicePrefixEvents=require(_0x3e80('0x0'));var events=[_0x3e80('0x1'),_0x3e80('0x2'),_0x3e80('0x3')];function createListener(_0x41c0f3,_0x38ae9b){return function(_0x18fd07){_0x38ae9b[_0x3e80('0x4')](_0x41c0f3,_0x18fd07);};}function removeListener(_0x3faab9,_0x54e21d){return function(){VoicePrefixEvents[_0x3e80('0x5')](_0x3faab9,_0x54e21d);};}exports[_0x3e80('0x6')]=function(_0x41a1da){for(var _0xc87971=0x0,_0x368e81=events[_0x3e80('0x7')];_0xc87971<_0x368e81;_0xc87971++){var _0x2e5d50=events[_0xc87971];var _0x387bab=createListener(_0x3e80('0x8')+_0x2e5d50,_0x41a1da);VoicePrefixEvents['on'](_0x2e5d50,_0x387bab);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a94956f..8b73d15 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 _0x19d1=['/:id/hopper_finals','getHopperFinals','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addAgents','addLists','/:id/blacklists','addBlackLists','delete','destroy','removeAgents','removeLists','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x57e00e,_0x36e79a){var _0x415e60=function(_0x5cd7fa){while(--_0x5cd7fa){_0x57e00e['push'](_0x57e00e['shift']());}};_0x415e60(++_0x36e79a);}(_0x19d1,0x16c));var _0x119d=function(_0x535382,_0x126fa5){_0x535382=_0x535382-0x0;var _0x1da79b=_0x19d1[_0x535382];return _0x1da79b;};'use strict';var multer=require(_0x119d('0x0'));var util=require(_0x119d('0x1'));var path=require('path');var timeout=require(_0x119d('0x2'));var express=require(_0x119d('0x3'));var router=express[_0x119d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x119d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x119d('0x6'));var controller=require(_0x119d('0x7'));router[_0x119d('0x8')]('/',auth[_0x119d('0x9')](),controller[_0x119d('0xa')]);router[_0x119d('0x8')](_0x119d('0xb'),auth['isAuthenticated'](),controller[_0x119d('0xc')]);router['get']('/:id/hoppers',auth['isAuthenticated'](),controller[_0x119d('0xd')]);router[_0x119d('0x8')](_0x119d('0xe'),auth['isAuthenticated'](),controller[_0x119d('0xf')]);router[_0x119d('0x8')](_0x119d('0x10'),auth[_0x119d('0x9')](),controller[_0x119d('0x11')]);router['get']('/:id/hopper_black',auth[_0x119d('0x9')](),controller['getHopperBlacks']);router[_0x119d('0x8')](_0x119d('0x12'),auth['isAuthenticated'](),controller[_0x119d('0x13')]);router[_0x119d('0x8')](_0x119d('0x14'),auth[_0x119d('0x9')](),controller[_0x119d('0x15')]);router[_0x119d('0x8')](_0x119d('0x16'),auth[_0x119d('0x9')](),controller[_0x119d('0x17')]);router[_0x119d('0x8')](_0x119d('0x18'),auth[_0x119d('0x9')](),controller[_0x119d('0x19')]);router['get']('/:id/blacklists',auth[_0x119d('0x9')](),controller['getBlackLists']);router[_0x119d('0x1a')]('/',auth[_0x119d('0x9')](),controller[_0x119d('0x1b')]);router[_0x119d('0x1a')](_0x119d('0x1c'),auth['isAuthenticated'](),controller[_0x119d('0x1d')]);router[_0x119d('0x1a')](_0x119d('0x12'),auth[_0x119d('0x9')](),controller['addTeams']);router[_0x119d('0x1a')](_0x119d('0x14'),auth[_0x119d('0x9')](),controller[_0x119d('0x1e')]);router[_0x119d('0x1a')](_0x119d('0x18'),auth['isAuthenticated'](),controller[_0x119d('0x1f')]);router[_0x119d('0x1a')](_0x119d('0x20'),auth[_0x119d('0x9')](),controller[_0x119d('0x21')]);router['put'](_0x119d('0xb'),auth[_0x119d('0x9')](),controller['update']);router[_0x119d('0x22')]('/:id',auth['isAuthenticated'](),controller[_0x119d('0x23')]);router[_0x119d('0x22')](_0x119d('0x12'),auth[_0x119d('0x9')](),controller['removeTeams']);router[_0x119d('0x22')](_0x119d('0x14'),auth[_0x119d('0x9')](),controller[_0x119d('0x24')]);router[_0x119d('0x22')](_0x119d('0x18'),auth[_0x119d('0x9')](),controller[_0x119d('0x25')]);router[_0x119d('0x22')]('/:id/blacklists',auth[_0x119d('0x9')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0xb6af=['../../config/environment','./voiceQueue.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','getAgents','getMembers','getLists','getBlackLists','post','create','/:id/clone','clone','/:id/teams','addTeams','/:id/users','addAgents','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','/:id/lists','removeLists','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xc745a3,_0xf6e4fc){var _0x4a03b9=function(_0x43ced1){while(--_0x43ced1){_0xc745a3['push'](_0xc745a3['shift']());}};_0x4a03b9(++_0xf6e4fc);}(_0xb6af,0x1ce));var _0xfb6a=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xb6af[_0x381589];return _0x2a075d;};'use strict';var multer=require(_0xfb6a('0x0'));var util=require(_0xfb6a('0x1'));var path=require(_0xfb6a('0x2'));var timeout=require('connect-timeout');var express=require(_0xfb6a('0x3'));var router=express[_0xfb6a('0x4')]();var fs_extra=require(_0xfb6a('0x5'));var auth=require(_0xfb6a('0x6'));var interaction=require(_0xfb6a('0x7'));var config=require(_0xfb6a('0x8'));var controller=require(_0xfb6a('0x9'));router[_0xfb6a('0xa')]('/',auth[_0xfb6a('0xb')](),controller['index']);router['get'](_0xfb6a('0xc'),auth[_0xfb6a('0xb')](),controller[_0xfb6a('0xd')]);router['get'](_0xfb6a('0xe'),auth['isAuthenticated'](),controller[_0xfb6a('0xf')]);router['get'](_0xfb6a('0x10'),auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x11')]);router['get'](_0xfb6a('0x12'),auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x13')]);router[_0xfb6a('0xa')](_0xfb6a('0x14'),auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x15')]);router[_0xfb6a('0xa')]('/:id/teams',auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x16')]);router[_0xfb6a('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xfb6a('0x17')]);router['get']('/:id/members',auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x18')]);router['get']('/:id/lists',auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x19')]);router['get']('/:id/blacklists',auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x1a')]);router[_0xfb6a('0x1b')]('/',auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x1c')]);router['post'](_0xfb6a('0x1d'),auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x1e')]);router[_0xfb6a('0x1b')](_0xfb6a('0x1f'),auth['isAuthenticated'](),controller[_0xfb6a('0x20')]);router[_0xfb6a('0x1b')](_0xfb6a('0x21'),auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x22')]);router[_0xfb6a('0x1b')]('/:id/lists',auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x23')]);router['post'](_0xfb6a('0x24'),auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x25')]);router[_0xfb6a('0x26')]('/:id',auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x27')]);router[_0xfb6a('0x28')]('/:id',auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x29')]);router[_0xfb6a('0x28')](_0xfb6a('0x1f'),auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x2a')]);router[_0xfb6a('0x28')]('/:id/users',auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x2b')]);router['delete'](_0xfb6a('0x2c'),auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x2d')]);router[_0xfb6a('0x28')](_0xfb6a('0x24'),auth[_0xfb6a('0xb')](),controller['removeBlackLists']);module[_0xfb6a('0x2e')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index f5ea43d..9f6d713 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 _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x430cb0,_0x860700){var _0x4e21d5=function(_0x1369fd){while(--_0x1369fd){_0x430cb0['push'](_0x430cb0['shift']());}};_0x4e21d5(++_0x860700);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x1b0cc8,_0x6e3392){var _0x441d1a=function(_0x248cef){while(--_0x248cef){_0x1b0cc8['push'](_0x1b0cc8['shift']());}};_0x441d1a(++_0x6e3392);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 08ba796..5f37bc5 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 _0x9ab9=['SELECT','every','all','union','transaction','userVoiceQueue:remove','addAgents','spread','online','isEmpty','push','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ListId','NOW()','ContactId','CmListId','toString','cm_contacts','phone\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_hopper','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','status','json','count','offset','limit','reject','save','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','destroy','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','name','query','keys','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileResource','getHoppers','CmHopper','hasOwnProperty','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','voicePause','interface','flatMap','forEach','penalty','sequelize','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?'];(function(_0x598f9a,_0x3a5e55){var _0x23ffa5=function(_0x5607a7){while(--_0x5607a7){_0x598f9a['push'](_0x598f9a['shift']());}};_0x23ffa5(++_0x3a5e55);}(_0x9ab9,0x19d));var _0x99ab=function(_0x29393a,_0x53706c){_0x29393a=_0x29393a-0x0;var _0x2ab78a=_0x9ab9[_0x29393a];return _0x2ab78a;};'use strict';var pdf=require(_0x99ab('0x0'));var emlformat=require(_0x99ab('0x1'));var rimraf=require(_0x99ab('0x2'));var zipdir=require(_0x99ab('0x3'));var jsonpatch=require(_0x99ab('0x4'));var rp=require('request-promise');var moment=require(_0x99ab('0x5'));var BPromise=require(_0x99ab('0x6'));var Mustache=require('mustache');var util=require(_0x99ab('0x7'));var path=require('path');var sox=require(_0x99ab('0x8'));var csv=require(_0x99ab('0x9'));var ejs=require(_0x99ab('0xa'));var fs=require('fs');var fs_extra=require(_0x99ab('0xb'));var _=require(_0x99ab('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x99ab('0xd'));var deskjs=require(_0x99ab('0xe'));var toCsv=require('to-csv');var querystring=require(_0x99ab('0xf'));var Papa=require(_0x99ab('0x10'));var Redis=require(_0x99ab('0x11'));var authService=require(_0x99ab('0x12'));var qs=require(_0x99ab('0x13'));var as=require(_0x99ab('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99ab('0x15'))(_0x99ab('0x16'));var utils=require(_0x99ab('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x99ab('0x18'))['db'];config[_0x99ab('0x19')]=_[_0x99ab('0x1a')](config[_0x99ab('0x19')],{'host':_0x99ab('0x1b'),'port':0x18eb});var socket=require(_0x99ab('0x1c'))(new Redis(config['redis']));require(_0x99ab('0x1d'))[_0x99ab('0x1e')](socket);function respondWithStatusCode(_0x5e51ab,_0x381959){_0x381959=_0x381959||0xcc;return function(_0x36d89e){if(_0x36d89e){return _0x5e51ab[_0x99ab('0x1f')](_0x381959);}return _0x5e51ab['status'](_0x381959)[_0x99ab('0x20')]();};}function respondWithResult(_0x13b9aa,_0x1c52a6){_0x1c52a6=_0x1c52a6||0xc8;return function(_0x31b340){if(_0x31b340){return _0x13b9aa[_0x99ab('0x21')](_0x1c52a6)[_0x99ab('0x22')](_0x31b340);}};}function respondWithFilteredResult(_0x1d841c,_0x2c24c9){return function(_0x478b37){if(_0x478b37){var _0x14a515=_0x478b37[_0x99ab('0x23')],_0x368b52=_0x2c24c9[_0x99ab('0x24')],_0x4193c0=_0x2c24c9[_0x99ab('0x24')]+_0x2c24c9[_0x99ab('0x25')],_0x1cdd6d;if(_0x4193c0>=_0x14a515){_0x4193c0=_0x14a515;_0x1cdd6d=0xc8;}else{_0x1cdd6d=0xce;}_0x1d841c[_0x99ab('0x21')](_0x1cdd6d);return _0x1d841c['set']('Content-Range',_0x368b52+'-'+_0x4193c0+'/'+_0x14a515)[_0x99ab('0x22')](_0x478b37);}return null;};}function patchUpdates(_0x26d94a){return function(_0x194f39){try{jsonpatch['apply'](_0x194f39,_0x26d94a,!![]);}catch(_0x2e0464){return BPromise[_0x99ab('0x26')](_0x2e0464);}return _0x194f39[_0x99ab('0x27')]();};}function saveUpdates(_0x2604ee,_0x624e9b){return function(_0x15fea0){if(_0x15fea0){return _0x15fea0[_0x99ab('0x28')](_0x2604ee)['then'](function(_0x5de675){return _0x5de675;});}return null;};}function removeEntity(_0x4cd112,_0x461f2f){return function(_0x56bdb7){if(_0x56bdb7){return _0x56bdb7['destroy']()[_0x99ab('0x29')](function(){var _0x17df1e=_0x56bdb7[_0x99ab('0x2a')]({'plain':!![]});var _0x570bed=[{'name':_0x99ab('0x2b'),'value':_0x99ab('0x2c'),'ignore':![]},{'name':_0x99ab('0x2d'),'value':_0x99ab('0x2e'),'ignore':![]}];var _0x36414c=_(_0x570bed)[_0x99ab('0x2f')](_0x99ab('0x30'))[_0x99ab('0x31')](_0x99ab('0x32'))['value']();if(_[_0x99ab('0x33')](_0x36414c,_0x17df1e[_0x99ab('0x34')])){return;}var _0x50ffdc=_[_0x99ab('0x35')](_0x570bed,[_0x99ab('0x32'),_0x17df1e[_0x99ab('0x34')]])['name'];return db['UserProfileResource'][_0x99ab('0x36')]({'where':{'type':_0x50ffdc,'resourceId':_0x17df1e['id']}})[_0x99ab('0x29')](function(){return _0x56bdb7;});})[_0x99ab('0x29')](function(){_0x4cd112[_0x99ab('0x21')](0xcc)[_0x99ab('0x20')]();});}};}function handleEntityNotFound(_0x36c0f1,_0x2213e9){return function(_0x85bf48){if(!_0x85bf48){_0x36c0f1['sendStatus'](0x194);}return _0x85bf48;};}function handleError(_0x44bf54,_0x453138){_0x453138=_0x453138||0x1f4;return function(_0x58c8d3){logger[_0x99ab('0x37')](_0x58c8d3[_0x99ab('0x38')]);if(_0x58c8d3['name']){delete _0x58c8d3['name'];}_0x44bf54[_0x99ab('0x21')](_0x453138)[_0x99ab('0x39')](_0x58c8d3);};}exports[_0x99ab('0x3a')]=function(_0x56a440,_0x4eee06){var _0x5ec3fa={},_0x4c086e={},_0x5507b6={'count':0x0,'rows':[]};var _0x482255=_[_0x99ab('0x31')](db[_0x99ab('0x3b')][_0x99ab('0x3c')],function(_0x4a2fea){return{'name':_0x4a2fea[_0x99ab('0x3d')],'type':_0x4a2fea[_0x99ab('0x34')][_0x99ab('0x3e')]};});_0x4c086e['model']=_[_0x99ab('0x31')](_0x482255,_0x99ab('0x3f'));_0x4c086e[_0x99ab('0x40')]=_[_0x99ab('0x41')](_0x56a440[_0x99ab('0x40')]);_0x4c086e[_0x99ab('0x42')]=_[_0x99ab('0x43')](_0x4c086e['model'],_0x4c086e['query']);_0x5ec3fa[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0x4c086e['model'],qs[_0x99ab('0x45')](_0x56a440[_0x99ab('0x40')][_0x99ab('0x45')]));_0x5ec3fa['attributes']=_0x5ec3fa[_0x99ab('0x44')][_0x99ab('0x46')]?_0x5ec3fa[_0x99ab('0x44')]:_0x4c086e[_0x99ab('0x47')];if(!_0x56a440[_0x99ab('0x40')]['hasOwnProperty'](_0x99ab('0x48'))){_0x5ec3fa[_0x99ab('0x25')]=qs['limit'](_0x56a440[_0x99ab('0x40')]['limit']);_0x5ec3fa[_0x99ab('0x24')]=qs[_0x99ab('0x24')](_0x56a440[_0x99ab('0x40')][_0x99ab('0x24')]);}_0x5ec3fa[_0x99ab('0x49')]=qs[_0x99ab('0x4a')](_0x56a440[_0x99ab('0x40')][_0x99ab('0x4a')]);_0x5ec3fa[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_['pick'](_0x56a440[_0x99ab('0x40')],_0x4c086e[_0x99ab('0x42')]),_0x482255);if(_0x56a440['query'][_0x99ab('0x2f')]){_0x5ec3fa['where']=_[_0x99ab('0x4c')](_0x5ec3fa['where'],{'$or':_[_0x99ab('0x31')](_0x482255,function(_0x17c331){if(_0x17c331[_0x99ab('0x34')]!==_0x99ab('0x4d')){var _0x5aac8f={};_0x5aac8f[_0x17c331[_0x99ab('0x3f')]]={'$like':'%'+_0x56a440[_0x99ab('0x40')][_0x99ab('0x2f')]+'%'};return _0x5aac8f;}})});}_0x5ec3fa=_[_0x99ab('0x4c')]({},_0x5ec3fa,_0x56a440[_0x99ab('0x4e')]);var _0x3bdfbc={'where':_0x5ec3fa[_0x99ab('0x4b')]};return db[_0x99ab('0x3b')][_0x99ab('0x23')](_0x3bdfbc)[_0x99ab('0x29')](function(_0x229840){_0x5507b6[_0x99ab('0x23')]=_0x229840;if(_0x56a440[_0x99ab('0x40')][_0x99ab('0x4f')]){_0x5ec3fa[_0x99ab('0x50')]=[{'all':!![]}];}return db['VoiceQueue'][_0x99ab('0x51')](_0x5ec3fa);})[_0x99ab('0x29')](function(_0x5c1695){_0x5507b6[_0x99ab('0x52')]=_0x5c1695;return _0x5507b6;})[_0x99ab('0x29')](respondWithFilteredResult(_0x4eee06,_0x5ec3fa))[_0x99ab('0x53')](handleError(_0x4eee06,null));};exports[_0x99ab('0x54')]=function(_0x63b31b,_0xa73fc3){var _0x33bd1c={'raw':![],'where':{'id':_0x63b31b[_0x99ab('0x55')]['id']}},_0x2a6e69={};_0x2a6e69[_0x99ab('0x47')]=_[_0x99ab('0x41')](db['VoiceQueue'][_0x99ab('0x3c')]);_0x2a6e69[_0x99ab('0x40')]=_[_0x99ab('0x41')](_0x63b31b[_0x99ab('0x40')]);_0x2a6e69['filters']=_['intersection'](_0x2a6e69[_0x99ab('0x47')],_0x2a6e69['query']);_0x33bd1c[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0x2a6e69[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x63b31b[_0x99ab('0x40')][_0x99ab('0x45')]));_0x33bd1c[_0x99ab('0x44')]=_0x33bd1c['attributes'][_0x99ab('0x46')]?_0x33bd1c[_0x99ab('0x44')]:_0x2a6e69[_0x99ab('0x47')];if(_0x63b31b[_0x99ab('0x40')][_0x99ab('0x4f')]){_0x33bd1c[_0x99ab('0x50')]=[{'all':!![]}];}_0x33bd1c=_[_0x99ab('0x4c')]({},_0x33bd1c,_0x63b31b[_0x99ab('0x4e')]);return db[_0x99ab('0x3b')][_0x99ab('0x35')](_0x33bd1c)['then'](handleEntityNotFound(_0xa73fc3,null))[_0x99ab('0x29')](respondWithResult(_0xa73fc3,null))[_0x99ab('0x53')](handleError(_0xa73fc3,null));};exports['create']=function(_0x271ff5,_0x149588){return db[_0x99ab('0x3b')][_0x99ab('0x56')](_0x271ff5[_0x99ab('0x57')],{})[_0x99ab('0x29')](function(_0x135cd6){var _0x530dbb=_0x271ff5[_0x99ab('0x58')][_0x99ab('0x2a')]({'plain':!![]});if(!_0x530dbb)throw new Error(_0x99ab('0x59'));if(_0x530dbb[_0x99ab('0x5a')]===_0x99ab('0x58')){var _0x53dde8=_0x135cd6['get']({'plain':!![]});var _0x10e945=[{'name':_0x99ab('0x2b'),'value':_0x99ab('0x2c')},{'name':_0x99ab('0x2d'),'value':'outbound'}];var _0x3902eb=_['find'](_0x10e945,[_0x99ab('0x32'),_0x53dde8[_0x99ab('0x34')]])['name'];return db[_0x99ab('0x5b')][_0x99ab('0x35')]({'where':{'name':_0x3902eb,'userProfileId':_0x530dbb[_0x99ab('0x5c')]},'raw':!![]})['then'](function(_0x3f0d66){if(_0x3f0d66&&_0x3f0d66[_0x99ab('0x5d')]===0x0){return db['UserProfileResource'][_0x99ab('0x56')]({'name':_0x53dde8[_0x99ab('0x3f')],'resourceId':_0x53dde8['id'],'type':_0x3f0d66[_0x99ab('0x3f')],'sectionId':_0x3f0d66['id']},{})[_0x99ab('0x29')](function(){return _0x135cd6;});}else{return _0x135cd6;}})[_0x99ab('0x53')](function(_0xd646a4){logger[_0x99ab('0x37')](_0x99ab('0x5e'),_0xd646a4);throw _0xd646a4;});}return _0x135cd6;})[_0x99ab('0x29')](respondWithResult(_0x149588,0xc9))[_0x99ab('0x53')](handleError(_0x149588,null));};exports[_0x99ab('0x5f')]=function(_0x283cc6,_0x545df5){var _0x59d71d={'where':{'id':_0x283cc6[_0x99ab('0x55')]['id']}},_0x1099aa={};_0x1099aa[_0x99ab('0x47')]=_['keys'](db[_0x99ab('0x3b')][_0x99ab('0x3c')]);_0x59d71d[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0x1099aa[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x283cc6[_0x99ab('0x40')][_0x99ab('0x45')]));_0x59d71d[_0x99ab('0x44')]=_0x59d71d[_0x99ab('0x44')][_0x99ab('0x46')]?_0x59d71d[_0x99ab('0x44')]:_0x1099aa['model'];if(_0x283cc6[_0x99ab('0x40')][_0x99ab('0x4f')]){_0x59d71d[_0x99ab('0x50')]=[{'all':!![]}];}_0x59d71d=_[_0x99ab('0x4c')]({},_0x59d71d,_0x283cc6['options']);return db[_0x99ab('0x3b')][_0x99ab('0x35')](_0x59d71d)[_0x99ab('0x29')](handleEntityNotFound(_0x545df5,null))['then'](function(_0x32f963){if(_0x32f963){var _0x34846d=_0x32f963['get']({'plain':!![]});_0x34846d=qs[_0x99ab('0x60')](_0x34846d,['id',_0x99ab('0x61'),'updatedAt']);_0x283cc6[_0x99ab('0x57')]=_[_0x99ab('0x60')](_0x283cc6[_0x99ab('0x57')],['id',_0x99ab('0x61'),_0x99ab('0x62')]);return db['VoiceQueue']['create'](_[_0x99ab('0x4c')](_0x34846d,_0x283cc6[_0x99ab('0x57')]),{'include':_0x283cc6['query'][_0x99ab('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x2bbea0){var _0x28c9ec=_0x283cc6[_0x99ab('0x58')][_0x99ab('0x2a')]({'plain':!![]});if(!_0x28c9ec)throw new Error(_0x99ab('0x59'));if(_0x28c9ec[_0x99ab('0x5a')]==='user'){var _0x34ccaa=_0x2bbea0[_0x99ab('0x2a')]({'plain':!![]});var _0x65c456=[{'name':_0x99ab('0x2b'),'value':'inbound'},{'name':_0x99ab('0x2d'),'value':'outbound'}];var _0x42ece6=_[_0x99ab('0x35')](_0x65c456,[_0x99ab('0x32'),_0x34ccaa[_0x99ab('0x34')]])['name'];return db[_0x99ab('0x5b')][_0x99ab('0x35')]({'where':{'name':_0x42ece6,'userProfileId':_0x28c9ec['userProfileId']},'raw':!![]})[_0x99ab('0x29')](function(_0x3cec53){if(_0x3cec53&&_0x3cec53[_0x99ab('0x5d')]===0x0){return db[_0x99ab('0x63')][_0x99ab('0x56')]({'name':_0x34ccaa[_0x99ab('0x3f')],'resourceId':_0x34ccaa['id'],'type':_0x3cec53[_0x99ab('0x3f')],'sectionId':_0x3cec53['id']},{})[_0x99ab('0x29')](function(){return _0x2bbea0;});}else{return _0x2bbea0;}})[_0x99ab('0x53')](function(_0x3312a6){logger[_0x99ab('0x37')](_0x99ab('0x5e'),_0x3312a6);throw _0x3312a6;});}return _0x2bbea0;});}})[_0x99ab('0x29')](respondWithResult(_0x545df5,0xc9))[_0x99ab('0x53')](handleError(_0x545df5,null));};exports[_0x99ab('0x28')]=function(_0x511423,_0x30eb64){if(_0x511423[_0x99ab('0x57')]['id']){delete _0x511423[_0x99ab('0x57')]['id'];}return db[_0x99ab('0x3b')]['find']({'where':{'id':_0x511423[_0x99ab('0x55')]['id']}})['then'](handleEntityNotFound(_0x30eb64,null))[_0x99ab('0x29')](saveUpdates(_0x511423['body'],null))['then'](respondWithResult(_0x30eb64,null))[_0x99ab('0x53')](handleError(_0x30eb64,null));};exports[_0x99ab('0x36')]=function(_0x3f9eb1,_0x3a8d8c){return db[_0x99ab('0x3b')][_0x99ab('0x35')]({'where':{'id':_0x3f9eb1['params']['id']}})['then'](handleEntityNotFound(_0x3a8d8c,null))[_0x99ab('0x29')](removeEntity(_0x3a8d8c,null))[_0x99ab('0x53')](handleError(_0x3a8d8c,null));};exports[_0x99ab('0x64')]=function(_0x7ed2e5,_0x4d3062,_0x2f16e6){var _0x4f11c5={'raw':![],'where':{}};var _0x55992e={};var _0x1e7c7e={'count':0x0,'rows':[]};return db[_0x99ab('0x3b')]['findOne']({'where':{'id':_0x7ed2e5[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x4d3062,null))[_0x99ab('0x29')](function(_0xd96882){if(_0xd96882){_0x55992e[_0x99ab('0x47')]=_[_0x99ab('0x41')](db[_0x99ab('0x65')][_0x99ab('0x3c')]);_0x55992e[_0x99ab('0x40')]=_['keys'](_0x7ed2e5[_0x99ab('0x40')]);_0x55992e['filters']=_[_0x99ab('0x43')](_0x55992e[_0x99ab('0x47')],_0x55992e[_0x99ab('0x40')]);_0x4f11c5['attributes']=_[_0x99ab('0x43')](_0x55992e[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x7ed2e5[_0x99ab('0x40')][_0x99ab('0x45')]));_0x4f11c5[_0x99ab('0x44')]=_0x4f11c5['attributes'][_0x99ab('0x46')]?_0x4f11c5[_0x99ab('0x44')]:_0x55992e[_0x99ab('0x47')];if(!_0x7ed2e5[_0x99ab('0x40')][_0x99ab('0x66')](_0x99ab('0x48'))){_0x4f11c5[_0x99ab('0x25')]=qs[_0x99ab('0x25')](_0x7ed2e5['query'][_0x99ab('0x25')]);_0x4f11c5[_0x99ab('0x24')]=qs['offset'](_0x7ed2e5[_0x99ab('0x40')][_0x99ab('0x24')]);}_0x4f11c5[_0x99ab('0x49')]=qs[_0x99ab('0x4a')](_0x7ed2e5[_0x99ab('0x40')]['sort']);_0x4f11c5[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_[_0x99ab('0x67')](_0x7ed2e5[_0x99ab('0x40')],_0x55992e[_0x99ab('0x42')]));_0x4f11c5['where'][_0x99ab('0x68')]=_0xd96882['id'];if(_0x7ed2e5[_0x99ab('0x40')][_0x99ab('0x2f')]){_0x4f11c5['where']=_[_0x99ab('0x4c')](_0x4f11c5['where'],{'$or':_['map'](_0x4f11c5[_0x99ab('0x44')],function(_0x4552f1){var _0x52e936={};_0x52e936[_0x4552f1]={'$like':'%'+_0x7ed2e5[_0x99ab('0x40')][_0x99ab('0x2f')]+'%'};return _0x52e936;})});}_0x4f11c5=_[_0x99ab('0x4c')]({},_0x4f11c5,_0x7ed2e5[_0x99ab('0x4e')]);return db[_0x99ab('0x65')]['count']({'where':_0x4f11c5[_0x99ab('0x4b')]})[_0x99ab('0x29')](function(_0x11415c){_0x1e7c7e[_0x99ab('0x23')]=_0x11415c;if(_0x7ed2e5[_0x99ab('0x40')][_0x99ab('0x4f')]){_0x4f11c5[_0x99ab('0x50')]=[{'all':!![]}];}return db[_0x99ab('0x65')][_0x99ab('0x51')](_0x4f11c5);})['then'](function(_0x56101f){_0x1e7c7e[_0x99ab('0x52')]=_0x56101f;return _0x1e7c7e;});}})['then'](respondWithFilteredResult(_0x4d3062,_0x4f11c5))[_0x99ab('0x53')](handleError(_0x4d3062,null));};exports[_0x99ab('0x69')]=function(_0x1e2c1e,_0x19c5d1,_0x242159){var _0x4b2b40={'raw':!![],'where':{}};var _0xb5c299={};var _0x1de830={'count':0x0,'rows':[]};return db[_0x99ab('0x3b')][_0x99ab('0x6a')]({'where':{'id':_0x1e2c1e[_0x99ab('0x55')]['id']}})['then'](handleEntityNotFound(_0x19c5d1,null))['then'](function(_0x4c7afe){if(_0x4c7afe){_0xb5c299['model']=_[_0x99ab('0x41')](db[_0x99ab('0x6b')][_0x99ab('0x3c')]);_0xb5c299[_0x99ab('0x40')]=_[_0x99ab('0x41')](_0x1e2c1e[_0x99ab('0x40')]);_0xb5c299[_0x99ab('0x42')]=_['intersection'](_0xb5c299[_0x99ab('0x47')],_0xb5c299[_0x99ab('0x40')]);_0x4b2b40[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0xb5c299[_0x99ab('0x47')],qs['fields'](_0x1e2c1e[_0x99ab('0x40')]['fields']));_0x4b2b40['attributes']=_0x4b2b40[_0x99ab('0x44')]['length']?_0x4b2b40[_0x99ab('0x44')]:_0xb5c299['model'];if(!_0x1e2c1e['query'][_0x99ab('0x66')](_0x99ab('0x48'))){_0x4b2b40['limit']=qs[_0x99ab('0x25')](_0x1e2c1e[_0x99ab('0x40')][_0x99ab('0x25')]);_0x4b2b40[_0x99ab('0x24')]=qs['offset'](_0x1e2c1e[_0x99ab('0x40')][_0x99ab('0x24')]);}_0x4b2b40['order']=qs[_0x99ab('0x4a')](_0x1e2c1e[_0x99ab('0x40')][_0x99ab('0x4a')]);_0x4b2b40[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_['pick'](_0x1e2c1e[_0x99ab('0x40')],_0xb5c299[_0x99ab('0x42')]));_0x4b2b40['where'][_0x99ab('0x68')]=_0x4c7afe['id'];if(_0x1e2c1e['query'][_0x99ab('0x2f')]){_0x4b2b40['where']=_['merge'](_0x4b2b40[_0x99ab('0x4b')],{'$or':_['map'](_0x4b2b40[_0x99ab('0x44')],function(_0x1365e1){var _0x4845c7={};_0x4845c7[_0x1365e1]={'$like':'%'+_0x1e2c1e['query'][_0x99ab('0x2f')]+'%'};return _0x4845c7;})});}_0x4b2b40=_[_0x99ab('0x4c')]({},_0x4b2b40,_0x1e2c1e[_0x99ab('0x4e')]);return db[_0x99ab('0x6b')][_0x99ab('0x23')]({'where':_0x4b2b40[_0x99ab('0x4b')]})[_0x99ab('0x29')](function(_0x5310d4){_0x1de830[_0x99ab('0x23')]=_0x5310d4;if(_0x1e2c1e['query'][_0x99ab('0x4f')]){_0x4b2b40['include']=[{'all':!![]}];}return db[_0x99ab('0x6b')][_0x99ab('0x51')](_0x4b2b40);})[_0x99ab('0x29')](function(_0x9e4751){_0x1de830[_0x99ab('0x52')]=_0x9e4751;return _0x1de830;});}})[_0x99ab('0x29')](respondWithFilteredResult(_0x19c5d1,_0x4b2b40))[_0x99ab('0x53')](handleError(_0x19c5d1,null));};exports[_0x99ab('0x6c')]=function(_0x45da58,_0x11bf37,_0x63e6a7){var _0x475a8d={'raw':!![],'where':{}};var _0x4ad5c1={};var _0x473b06={'count':0x0,'rows':[]};return db[_0x99ab('0x3b')]['findOne']({'where':{'id':_0x45da58[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x11bf37,null))[_0x99ab('0x29')](function(_0x1dbff3){if(_0x1dbff3){_0x4ad5c1[_0x99ab('0x47')]=_[_0x99ab('0x41')](db[_0x99ab('0x6d')]['rawAttributes']);_0x4ad5c1['query']=_[_0x99ab('0x41')](_0x45da58[_0x99ab('0x40')]);_0x4ad5c1[_0x99ab('0x42')]=_['intersection'](_0x4ad5c1[_0x99ab('0x47')],_0x4ad5c1[_0x99ab('0x40')]);_0x475a8d[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0x4ad5c1[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x45da58[_0x99ab('0x40')][_0x99ab('0x45')]));_0x475a8d[_0x99ab('0x44')]=_0x475a8d['attributes'][_0x99ab('0x46')]?_0x475a8d[_0x99ab('0x44')]:_0x4ad5c1[_0x99ab('0x47')];if(!_0x45da58[_0x99ab('0x40')][_0x99ab('0x66')](_0x99ab('0x48'))){_0x475a8d[_0x99ab('0x25')]=qs['limit'](_0x45da58['query']['limit']);_0x475a8d[_0x99ab('0x24')]=qs['offset'](_0x45da58[_0x99ab('0x40')]['offset']);}_0x475a8d['order']=qs[_0x99ab('0x4a')](_0x45da58[_0x99ab('0x40')][_0x99ab('0x4a')]);_0x475a8d[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_['pick'](_0x45da58[_0x99ab('0x40')],_0x4ad5c1[_0x99ab('0x42')]));_0x475a8d[_0x99ab('0x4b')][_0x99ab('0x68')]=_0x1dbff3['id'];if(_0x45da58[_0x99ab('0x40')][_0x99ab('0x2f')]){_0x475a8d['where']=_[_0x99ab('0x4c')](_0x475a8d[_0x99ab('0x4b')],{'$or':_[_0x99ab('0x31')](_0x475a8d[_0x99ab('0x44')],function(_0x44a896){var _0x213fc4={};_0x213fc4[_0x44a896]={'$like':'%'+_0x45da58[_0x99ab('0x40')][_0x99ab('0x2f')]+'%'};return _0x213fc4;})});}_0x475a8d=_[_0x99ab('0x4c')]({},_0x475a8d,_0x45da58[_0x99ab('0x4e')]);return db[_0x99ab('0x6d')][_0x99ab('0x23')]({'where':_0x475a8d[_0x99ab('0x4b')]})[_0x99ab('0x29')](function(_0x37b699){_0x473b06[_0x99ab('0x23')]=_0x37b699;if(_0x45da58[_0x99ab('0x40')][_0x99ab('0x4f')]){_0x475a8d['include']=[{'all':!![]}];}return db[_0x99ab('0x6d')][_0x99ab('0x51')](_0x475a8d);})['then'](function(_0x5c581b){_0x473b06[_0x99ab('0x52')]=_0x5c581b;return _0x473b06;});}})['then'](respondWithFilteredResult(_0x11bf37,_0x475a8d))[_0x99ab('0x53')](handleError(_0x11bf37,null));};exports[_0x99ab('0x6e')]=function(_0x198f25,_0x24215a,_0x38ff92){var _0x68b7b7={'raw':!![],'where':{}};var _0x3b5858={};var _0x3c58a0={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x99ab('0x6a')]({'where':{'id':_0x198f25['params']['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x24215a,null))['then'](function(_0x31d59b){if(_0x31d59b){_0x3b5858[_0x99ab('0x47')]=_[_0x99ab('0x41')](db[_0x99ab('0x6f')][_0x99ab('0x3c')]);_0x3b5858['query']=_[_0x99ab('0x41')](_0x198f25[_0x99ab('0x40')]);_0x3b5858[_0x99ab('0x42')]=_[_0x99ab('0x43')](_0x3b5858[_0x99ab('0x47')],_0x3b5858['query']);_0x68b7b7[_0x99ab('0x44')]=_['intersection'](_0x3b5858['model'],qs[_0x99ab('0x45')](_0x198f25[_0x99ab('0x40')]['fields']));_0x68b7b7['attributes']=_0x68b7b7['attributes'][_0x99ab('0x46')]?_0x68b7b7['attributes']:_0x3b5858[_0x99ab('0x47')];if(!_0x198f25[_0x99ab('0x40')][_0x99ab('0x66')](_0x99ab('0x48'))){_0x68b7b7[_0x99ab('0x25')]=qs[_0x99ab('0x25')](_0x198f25['query'][_0x99ab('0x25')]);_0x68b7b7[_0x99ab('0x24')]=qs['offset'](_0x198f25[_0x99ab('0x40')]['offset']);}_0x68b7b7['order']=qs[_0x99ab('0x4a')](_0x198f25[_0x99ab('0x40')]['sort']);_0x68b7b7[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_[_0x99ab('0x67')](_0x198f25[_0x99ab('0x40')],_0x3b5858['filters']));_0x68b7b7['where'][_0x99ab('0x68')]=_0x31d59b['id'];if(_0x198f25[_0x99ab('0x40')][_0x99ab('0x2f')]){_0x68b7b7['where']=_[_0x99ab('0x4c')](_0x68b7b7['where'],{'$or':_['map'](_0x68b7b7['attributes'],function(_0x421570){var _0x36495c={};_0x36495c[_0x421570]={'$like':'%'+_0x198f25['query'][_0x99ab('0x2f')]+'%'};return _0x36495c;})});}_0x68b7b7=_[_0x99ab('0x4c')]({},_0x68b7b7,_0x198f25[_0x99ab('0x4e')]);return db[_0x99ab('0x6f')]['count']({'where':_0x68b7b7['where']})[_0x99ab('0x29')](function(_0x8cc85c){_0x3c58a0[_0x99ab('0x23')]=_0x8cc85c;if(_0x198f25[_0x99ab('0x40')][_0x99ab('0x4f')]){_0x68b7b7[_0x99ab('0x50')]=[{'all':!![]}];}return db[_0x99ab('0x6f')][_0x99ab('0x51')](_0x68b7b7);})[_0x99ab('0x29')](function(_0x65a22f){_0x3c58a0[_0x99ab('0x52')]=_0x65a22f;return _0x3c58a0;});}})['then'](respondWithFilteredResult(_0x24215a,_0x68b7b7))[_0x99ab('0x53')](handleError(_0x24215a,null));};exports[_0x99ab('0x70')]=function(_0x341ea8,_0x51d364,_0x37db7a){var _0x47a942={};var _0x5d1e26={};var _0x5a733d;var _0xd51728;return db[_0x99ab('0x3b')][_0x99ab('0x6a')]({'where':{'id':_0x341ea8[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x51d364,null))[_0x99ab('0x29')](function(_0x388eee){if(_0x388eee){_0x5a733d=_0x388eee;_0x5d1e26[_0x99ab('0x47')]=_[_0x99ab('0x41')](db[_0x99ab('0x71')][_0x99ab('0x3c')]);_0x5d1e26[_0x99ab('0x40')]=_[_0x99ab('0x41')](_0x341ea8[_0x99ab('0x40')]);_0x5d1e26[_0x99ab('0x42')]=_[_0x99ab('0x43')](_0x5d1e26[_0x99ab('0x47')],_0x5d1e26[_0x99ab('0x40')]);_0x47a942['attributes']=_['intersection'](_0x5d1e26[_0x99ab('0x47')],qs['fields'](_0x341ea8[_0x99ab('0x40')][_0x99ab('0x45')]));_0x47a942[_0x99ab('0x44')]=_0x47a942[_0x99ab('0x44')][_0x99ab('0x46')]?_0x47a942[_0x99ab('0x44')]:_0x5d1e26[_0x99ab('0x47')];_0x47a942['order']=qs[_0x99ab('0x4a')](_0x341ea8['query'][_0x99ab('0x4a')]);_0x47a942['where']=qs[_0x99ab('0x42')](_['pick'](_0x341ea8[_0x99ab('0x40')],_0x5d1e26[_0x99ab('0x42')]));if(_0x341ea8[_0x99ab('0x40')][_0x99ab('0x2f')]){_0x47a942[_0x99ab('0x4b')]=_[_0x99ab('0x4c')](_0x47a942[_0x99ab('0x4b')],{'$or':_[_0x99ab('0x31')](_0x47a942[_0x99ab('0x44')],function(_0x2eb546){var _0x3c7d3c={};_0x3c7d3c[_0x2eb546]={'$like':'%'+_0x341ea8[_0x99ab('0x40')][_0x99ab('0x2f')]+'%'};return _0x3c7d3c;})});}_0x47a942=_[_0x99ab('0x4c')]({},_0x47a942,_0x341ea8[_0x99ab('0x4e')]);return _0x5a733d['getTeams'](_0x47a942);}})[_0x99ab('0x29')](function(_0x16af3a){if(_0x16af3a){_0xd51728=_0x16af3a[_0x99ab('0x46')];if(!_0x341ea8[_0x99ab('0x40')]['hasOwnProperty'](_0x99ab('0x48'))){_0x47a942[_0x99ab('0x25')]=qs['limit'](_0x341ea8[_0x99ab('0x40')]['limit']);_0x47a942['offset']=qs[_0x99ab('0x24')](_0x341ea8[_0x99ab('0x40')][_0x99ab('0x24')]);}return _0x5a733d[_0x99ab('0x70')](_0x47a942);}})[_0x99ab('0x29')](function(_0x469e00){if(_0x469e00){return _0x469e00?{'count':_0xd51728,'rows':_0x469e00}:null;}})[_0x99ab('0x29')](respondWithResult(_0x51d364,null))[_0x99ab('0x53')](handleError(_0x51d364,null));};exports[_0x99ab('0x72')]=function(_0x4a3df5,_0x10d553,_0x3673e9){var _0x1477a7=_0x4a3df5['body'][_0x99ab('0x73')];var _0x2e650a=_[_0x99ab('0x31')](_0x1477a7,'id');return db[_0x99ab('0x71')]['findAll']({'where':{'id':_0x2e650a},'attributes':['id'],'include':[{'model':db[_0x99ab('0x74')],'as':_0x99ab('0x75'),'attributes':['id',_0x99ab('0x3f'),'online',_0x99ab('0x76'),_0x99ab('0x77')],'raw':!![]}]})[_0x99ab('0x29')](function(_0x131134){if(_0x131134){var _0x923bdb=_[_0x99ab('0x78')](_0x131134,function(_0x52ae3e){var _0x413c95=_0x52ae3e[_0x99ab('0x2a')]({'plain':!![]});_0x413c95[_0x99ab('0x75')][_0x99ab('0x79')](function(_0x1e673a){_0x1e673a['penalty']=_['find'](_0x1477a7,{'id':_0x413c95['id']})[_0x99ab('0x7a')];});return _0x413c95['Agents'];});return db[_0x99ab('0x3b')][_0x99ab('0x35')]({'where':{'id':_0x4a3df5[_0x99ab('0x55')]['id']}})['then'](function(_0x1fa172){return db[_0x99ab('0x7b')]['transaction'](function(_0x30968a){return _0x1fa172[_0x99ab('0x72')](_0x2e650a,{'transaction':_0x30968a})['then'](function(){return BPromise['each'](_0x1477a7,function(_0x21523d){return db[_0x99ab('0x7c')]['upsert']({'TeamId':_0x21523d['id'],'VoiceQueueId':_0x4a3df5[_0x99ab('0x55')]['id'],'penalty':_0x21523d['penalty']},{'transaction':_0x30968a});});})[_0x99ab('0x29')](function(){return BPromise[_0x99ab('0x7d')](_0x923bdb,function(_0x15808d){return db[_0x99ab('0x7e')]['findOrCreate']({'where':{'UserId':_0x15808d['id'],'VoiceQueueId':_0x4a3df5['params']['id']},'defaults':{'penalty':_0x15808d[_0x99ab('0x7a')]},'transaction':_0x30968a});});})[_0x99ab('0x29')](function(){return BPromise[_0x99ab('0x7d')](_[_0x99ab('0x2f')](_0x923bdb,{'online':!![]}),function(_0x2aa041){return db[_0x99ab('0x7f')][_0x99ab('0x80')]({'membername':_0x2aa041[_0x99ab('0x3f')],'UserId':_0x2aa041['id'],'queue_name':_0x1fa172[_0x99ab('0x3f')],'VoiceQueueId':_0x1fa172['id'],'interface':_[_0x99ab('0x81')](_0x2aa041[_0x99ab('0x77')])?util[_0x99ab('0x82')](_0x99ab('0x83'),_0x2aa041[_0x99ab('0x3f')]):_0x2aa041['interface'],'paused':_0x2aa041['voicePause']||![],'penalty':_0x2aa041[_0x99ab('0x7a')]},{'transaction':_0x30968a});});})[_0x99ab('0x29')](function(){_0x923bdb[_0x99ab('0x79')](function(_0x3654fa){socket[_0x99ab('0x84')](_0x99ab('0x85'),{'UserId':_0x3654fa['id'],'VoiceQueueId':_0x1fa172['id']});});});});});}})[_0x99ab('0x29')](respondWithStatusCode(_0x10d553,null))[_0x99ab('0x53')](handleError(_0x10d553,null));};exports[_0x99ab('0x86')]=function(_0x4b5da5,_0x2a69f8,_0xf95dce){return db[_0x99ab('0x71')][_0x99ab('0x51')]({'where':{'id':_0x4b5da5['query'][_0x99ab('0x87')]},'attributes':['id'],'include':[{'model':db[_0x99ab('0x74')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x99ab('0x29')](handleEntityNotFound(_0x2a69f8,null))[_0x99ab('0x29')](function(_0x453cc5){var _0xef87c=_[_0x99ab('0x31')](_0x453cc5,'id');var _0x65a389=[];var _0x45aa1c=[];var _0x2c5ad8=squel[_0x99ab('0x88')]();_0x2c5ad8[_0x99ab('0x89')](_0x99ab('0x8a'))[_0x99ab('0x8b')](_0x99ab('0x8c'),'tq')[_0x99ab('0x8d')](_0x99ab('0x8e'),'ut',_0x99ab('0x8f'))[_0x99ab('0x4b')]('VoiceQueueId\x20=\x20?',_0x4b5da5['params']['id']);for(var _0x4641f8=0x0;_0x4641f8<_0x453cc5[_0x99ab('0x46')];_0x4641f8+=0x1){let _0x1a082c=_0x453cc5[_0x4641f8];for(var _0x96e23=0x0;_0x96e23<_0x1a082c[_0x99ab('0x75')][_0x99ab('0x46')];_0x96e23+=0x1){let _0xd72e60=_0x1a082c[_0x99ab('0x75')][_0x96e23];var _0xb40ceb=_0x2c5ad8[_0x99ab('0x5f')]();_0xb40ceb['where'](_0x99ab('0x90'),_0xd72e60['id']);_0x45aa1c['push'](db[_0x99ab('0x7b')]['query'](_0xb40ceb['toString'](),{'type':db[_0x99ab('0x7b')]['QueryTypes'][_0x99ab('0x91')]})[_0x99ab('0x29')](function(_0x28ad32){if(_0x28ad32[_0x99ab('0x46')]===0x1){return _0xd72e60['id'];}else{var _0x33c5f9=_[_0x99ab('0x92')](_['map'](_0x28ad32,'TeamId'),function(_0x10e52d){return _['includes'](_0xef87c,_0x10e52d);});if(_0x33c5f9){return _0xd72e60['id'];}}}));}}return BPromise[_0x99ab('0x93')](_0x45aa1c)[_0x99ab('0x29')](function(_0x49d52d){_0x65a389=_(_0x65a389)[_0x99ab('0x94')](_0x49d52d)['compact']()[_0x99ab('0x32')]();return db[_0x99ab('0x3b')][_0x99ab('0x35')]({'where':{'id':_0x4b5da5[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](function(_0xcfd8a9){return db[_0x99ab('0x7b')][_0x99ab('0x95')](function(_0x254452){return _0xcfd8a9[_0x99ab('0x86')](_0x4b5da5[_0x99ab('0x40')]['ids'],{'transaction':_0x254452})[_0x99ab('0x29')](function(){if(!_['isEmpty'](_0x65a389)){return _0xcfd8a9['removeAgents'](_0x65a389,{'transaction':_0x254452})[_0x99ab('0x29')](function(){return db[_0x99ab('0x7f')]['destroy']({'where':{'VoiceQueueId':_0x4b5da5['params']['id'],'UserId':_0x65a389},'transaction':_0x254452});});}})[_0x99ab('0x29')](function(){_0x65a389['forEach'](function(_0x2a822a){socket['emit'](_0x99ab('0x96'),{'UserId':_0x2a822a,'VoiceQueueId':_0xcfd8a9['id']});});});});});});})[_0x99ab('0x29')](respondWithStatusCode(_0x2a69f8,null))[_0x99ab('0x53')](handleError(_0x2a69f8,null));};exports[_0x99ab('0x97')]=function(_0x33498f,_0x236124,_0x583843){var _0x1ffddf,_0x28ece3;return db['VoiceQueue'][_0x99ab('0x35')]({'where':{'id':_0x33498f[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x236124,null))[_0x99ab('0x29')](function(_0x40bc73){if(_0x40bc73){_0x28ece3=_0x40bc73;return _0x40bc73[_0x99ab('0x97')](_0x33498f[_0x99ab('0x57')][_0x99ab('0x87')],_[_0x99ab('0x60')](_0x33498f[_0x99ab('0x57')],[_0x99ab('0x87'),'id'])||{})[_0x99ab('0x98')](function(_0x6749ed){for(var _0x5f543d=0x0;_0x5f543d<_0x33498f[_0x99ab('0x57')][_0x99ab('0x87')][_0x99ab('0x46')];_0x5f543d+=0x1){socket[_0x99ab('0x84')](_0x99ab('0x85'),{'UserId':_0x33498f[_0x99ab('0x57')][_0x99ab('0x87')][_0x5f543d],'VoiceQueueId':_0x33498f[_0x99ab('0x55')]['id']});}return _0x6749ed;});}})[_0x99ab('0x29')](function(_0x536f00){_0x1ffddf=_0x536f00||[];if(_0x28ece3){return db['User'][_0x99ab('0x51')]({'where':{'id':_0x33498f[_0x99ab('0x57')][_0x99ab('0x87')]},'attributes':['id',_0x99ab('0x3f'),_0x99ab('0x99'),_0x99ab('0x76'),_0x99ab('0x77')],'raw':!![]});}})[_0x99ab('0x29')](function(_0x2ef4b2){if(!_[_0x99ab('0x9a')](_0x2ef4b2)){var _0x2ebeb6=[];for(var _0x12cba7=0x0;_0x12cba7<_0x2ef4b2[_0x99ab('0x46')];_0x12cba7++){if(_0x2ef4b2[_0x12cba7][_0x99ab('0x99')]){_0x2ebeb6[_0x99ab('0x9b')](db[_0x99ab('0x7f')][_0x99ab('0x80')]({'membername':_0x2ef4b2[_0x12cba7]['name'],'UserId':_0x2ef4b2[_0x12cba7]['id'],'queue_name':_0x28ece3['name'],'VoiceQueueId':_0x28ece3['id'],'interface':_[_0x99ab('0x81')](_0x2ef4b2[_0x12cba7][_0x99ab('0x77')])?util[_0x99ab('0x82')](_0x99ab('0x83'),_0x2ef4b2[_0x12cba7][_0x99ab('0x3f')]):_0x2ef4b2[_0x12cba7][_0x99ab('0x77')],'paused':_0x2ef4b2[_0x12cba7]['voicePause']||![],'penalty':_0x33498f[_0x99ab('0x57')]['penalty']||0x0}));}}return BPromise['all'](_0x2ebeb6);}})[_0x99ab('0x29')](function(){return _0x1ffddf;})['then'](respondWithResult(_0x236124,null))[_0x99ab('0x53')](handleError(_0x236124,null));};exports['removeAgents']=function(_0x455847,_0x42bedb,_0x43d79d){return db[_0x99ab('0x3b')]['find']({'where':{'id':_0x455847[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x42bedb,null))['then'](function(_0x5ecf2c){if(_0x5ecf2c){return _0x5ecf2c['removeAgents'](_0x455847[_0x99ab('0x40')][_0x99ab('0x87')])[_0x99ab('0x29')](function(){if(_[_0x99ab('0x9c')](_0x455847['query'][_0x99ab('0x87')])){for(var _0x4bf2e6=0x0;_0x4bf2e6<_0x455847[_0x99ab('0x40')]['ids'][_0x99ab('0x46')];_0x4bf2e6+=0x1){socket[_0x99ab('0x84')](_0x99ab('0x96'),{'UserId':Number(_0x455847[_0x99ab('0x40')]['ids'][_0x4bf2e6]),'VoiceQueueId':Number(_0x455847[_0x99ab('0x55')]['id'])});}}else{socket[_0x99ab('0x84')]('userVoiceQueue:remove',{'UserId':Number(_0x455847[_0x99ab('0x40')]['ids']),'VoiceQueueId':Number(_0x455847[_0x99ab('0x55')]['id'])});}});}})[_0x99ab('0x29')](function(_0x225063){return db[_0x99ab('0x7f')]['destroy']({'where':{'VoiceQueueId':_0x455847['params']['id'],'UserId':_0x455847['query'][_0x99ab('0x87')]}})[_0x99ab('0x29')](function(){return _0x225063;});})[_0x99ab('0x29')](respondWithStatusCode(_0x42bedb,null))[_0x99ab('0x53')](handleError(_0x42bedb,null));};exports[_0x99ab('0x9d')]=function(_0x1e532f,_0x34797f,_0x5914e9){var _0x3023f7={};var _0x2411c8={};var _0x38f165;var _0x2bb6b7;return db[_0x99ab('0x3b')][_0x99ab('0x6a')]({'where':{'id':_0x1e532f[_0x99ab('0x55')]['id']}})['then'](handleEntityNotFound(_0x34797f,null))[_0x99ab('0x29')](function(_0x33d70d){if(_0x33d70d){_0x38f165=_0x33d70d;_0x2411c8[_0x99ab('0x47')]=_[_0x99ab('0x41')](db[_0x99ab('0x74')][_0x99ab('0x3c')]);_0x2411c8['query']=_['keys'](_0x1e532f[_0x99ab('0x40')]);_0x2411c8[_0x99ab('0x42')]=_[_0x99ab('0x43')](_0x2411c8['model'],_0x2411c8[_0x99ab('0x40')]);_0x3023f7[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0x2411c8[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x1e532f[_0x99ab('0x40')][_0x99ab('0x45')]));_0x3023f7[_0x99ab('0x44')]=_0x3023f7[_0x99ab('0x44')]['length']?_0x3023f7[_0x99ab('0x44')]:_0x2411c8['model'];_0x3023f7[_0x99ab('0x49')]=qs[_0x99ab('0x4a')](_0x1e532f[_0x99ab('0x40')][_0x99ab('0x4a')]);_0x3023f7['where']=qs[_0x99ab('0x42')](_[_0x99ab('0x67')](_0x1e532f[_0x99ab('0x40')],_0x2411c8[_0x99ab('0x42')]));if(_0x1e532f[_0x99ab('0x40')]['filter']){_0x3023f7[_0x99ab('0x4b')]=_[_0x99ab('0x4c')](_0x3023f7[_0x99ab('0x4b')],{'$or':_[_0x99ab('0x31')](_0x3023f7['attributes'],function(_0x1bf119){var _0x25bbff={};_0x25bbff[_0x1bf119]={'$like':'%'+_0x1e532f['query']['filter']+'%'};return _0x25bbff;})});}_0x3023f7=_[_0x99ab('0x4c')]({},_0x3023f7,_0x1e532f[_0x99ab('0x4e')]);return _0x38f165[_0x99ab('0x9d')](_0x3023f7);}})[_0x99ab('0x29')](function(_0x2ff4e5){if(_0x2ff4e5){_0x2bb6b7=_0x2ff4e5[_0x99ab('0x46')];if(!_0x1e532f['query'][_0x99ab('0x66')](_0x99ab('0x48'))){_0x3023f7[_0x99ab('0x25')]=qs['limit'](_0x1e532f[_0x99ab('0x40')]['limit']);_0x3023f7[_0x99ab('0x24')]=qs[_0x99ab('0x24')](_0x1e532f[_0x99ab('0x40')]['offset']);}return _0x38f165['getAgents'](_0x3023f7);}})[_0x99ab('0x29')](function(_0xf783dc){if(_0xf783dc){return _0xf783dc?{'count':_0x2bb6b7,'rows':_0xf783dc}:null;}})[_0x99ab('0x29')](respondWithResult(_0x34797f,null))['catch'](handleError(_0x34797f,null));};exports[_0x99ab('0x9e')]=function(_0x548012,_0x2118d3,_0x22a6b6){var _0x401ac9={};var _0x1bca05={};var _0x2d0cb1;var _0x89243d;return db[_0x99ab('0x3b')][_0x99ab('0x6a')]({'where':{'id':_0x548012[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x2118d3,null))[_0x99ab('0x29')](function(_0x260a1e){if(_0x260a1e){_0x2d0cb1=_0x260a1e;_0x1bca05[_0x99ab('0x47')]=_['keys'](db[_0x99ab('0x7f')]['rawAttributes']);_0x1bca05[_0x99ab('0x40')]=_[_0x99ab('0x41')](_0x548012[_0x99ab('0x40')]);_0x1bca05[_0x99ab('0x42')]=_[_0x99ab('0x43')](_0x1bca05[_0x99ab('0x47')],_0x1bca05['query']);_0x401ac9[_0x99ab('0x44')]=_['intersection'](_0x1bca05[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x548012[_0x99ab('0x40')][_0x99ab('0x45')]));_0x401ac9[_0x99ab('0x44')]=_0x401ac9[_0x99ab('0x44')][_0x99ab('0x46')]?_0x401ac9[_0x99ab('0x44')]:_0x1bca05[_0x99ab('0x47')];_0x401ac9[_0x99ab('0x49')]=qs['sort'](_0x548012['query'][_0x99ab('0x4a')]);_0x401ac9[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_['pick'](_0x548012['query'],_0x1bca05['filters']));if(_0x548012[_0x99ab('0x40')][_0x99ab('0x2f')]){_0x401ac9['where']=_[_0x99ab('0x4c')](_0x401ac9['where'],{'$or':_[_0x99ab('0x31')](_0x401ac9[_0x99ab('0x44')],function(_0x2d15f5){var _0xcf9ee9={};_0xcf9ee9[_0x2d15f5]={'$like':'%'+_0x548012[_0x99ab('0x40')][_0x99ab('0x2f')]+'%'};return _0xcf9ee9;})});}_0x401ac9=_[_0x99ab('0x4c')]({},_0x401ac9,_0x548012[_0x99ab('0x4e')]);return _0x2d0cb1[_0x99ab('0x9e')](_0x401ac9);}})[_0x99ab('0x29')](function(_0x4f36ed){if(_0x4f36ed){_0x89243d=_0x4f36ed[_0x99ab('0x46')];if(!_0x548012['query'][_0x99ab('0x66')](_0x99ab('0x48'))){_0x401ac9['limit']=qs[_0x99ab('0x25')](_0x548012['query']['limit']);_0x401ac9['offset']=qs['offset'](_0x548012[_0x99ab('0x40')][_0x99ab('0x24')]);}return _0x2d0cb1[_0x99ab('0x9e')](_0x401ac9);}})[_0x99ab('0x29')](function(_0x1c0598){return _0x1c0598?{'count':_0x89243d,'rows':_0x1c0598}:null;})[_0x99ab('0x29')](respondWithResult(_0x2118d3,null))[_0x99ab('0x53')](handleError(_0x2118d3,null));};exports['getLists']=function(_0x45b14d,_0x141765,_0x454f4e){var _0x15070e={};var _0x76e812={};var _0x30de6c;var _0x35e29f;return db['VoiceQueue'][_0x99ab('0x6a')]({'where':{'id':_0x45b14d[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x141765,null))[_0x99ab('0x29')](function(_0x57fc5d){if(_0x57fc5d){_0x30de6c=_0x57fc5d;_0x76e812['model']=_[_0x99ab('0x41')](db['CmList']['rawAttributes']);_0x76e812[_0x99ab('0x40')]=_['keys'](_0x45b14d[_0x99ab('0x40')]);_0x76e812['filters']=_[_0x99ab('0x43')](_0x76e812[_0x99ab('0x47')],_0x76e812[_0x99ab('0x40')]);_0x15070e[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0x76e812[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x45b14d[_0x99ab('0x40')][_0x99ab('0x45')]));_0x15070e[_0x99ab('0x44')]=_0x15070e[_0x99ab('0x44')]['length']?_0x15070e['attributes']:_0x76e812['model'];_0x15070e['order']=qs['sort'](_0x45b14d[_0x99ab('0x40')][_0x99ab('0x4a')]);_0x15070e[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_[_0x99ab('0x67')](_0x45b14d['query'],_0x76e812[_0x99ab('0x42')]));if(_0x45b14d[_0x99ab('0x40')][_0x99ab('0x2f')]){_0x15070e['where']=_[_0x99ab('0x4c')](_0x15070e[_0x99ab('0x4b')],{'$or':_[_0x99ab('0x31')](_0x15070e[_0x99ab('0x44')],function(_0x233285){var _0x13fb6d={};_0x13fb6d[_0x233285]={'$like':'%'+_0x45b14d['query'][_0x99ab('0x2f')]+'%'};return _0x13fb6d;})});}_0x15070e=_[_0x99ab('0x4c')]({},_0x15070e,_0x45b14d[_0x99ab('0x4e')]);return _0x30de6c[_0x99ab('0x9f')](_0x15070e);}})[_0x99ab('0x29')](function(_0x174cd3){if(_0x174cd3){_0x35e29f=_0x174cd3[_0x99ab('0x46')];if(!_0x45b14d['query'][_0x99ab('0x66')](_0x99ab('0x48'))){_0x15070e['limit']=qs[_0x99ab('0x25')](_0x45b14d[_0x99ab('0x40')]['limit']);_0x15070e[_0x99ab('0x24')]=qs['offset'](_0x45b14d[_0x99ab('0x40')]['offset']);}return _0x30de6c[_0x99ab('0x9f')](_0x15070e);}})[_0x99ab('0x29')](function(_0x24a59a){if(_0x24a59a){return _0x24a59a?{'count':_0x35e29f,'rows':_0x24a59a}:null;}})[_0x99ab('0x29')](respondWithResult(_0x141765,null))[_0x99ab('0x53')](handleError(_0x141765,null));};exports[_0x99ab('0xa0')]=function(_0x1f3040,_0x7ca27e,_0x1fe0af){var _0x5464b1,_0x3a6322;return db[_0x99ab('0x3b')]['find']({'where':{'id':_0x1f3040[_0x99ab('0x55')]['id']}})['then'](handleEntityNotFound(_0x7ca27e,null))[_0x99ab('0x29')](function(_0x2bb53b){if(_0x2bb53b){_0x3a6322=_0x2bb53b;return _0x2bb53b[_0x99ab('0xa0')](_0x1f3040[_0x99ab('0x57')][_0x99ab('0x87')],_[_0x99ab('0x60')](_0x1f3040[_0x99ab('0x57')],['ids','id'])||{});}return null;})[_0x99ab('0x98')](function(_0x1bf34d){var _0x7c4c12;_0x5464b1=_0x1bf34d||[];var _0x37a554=[];if(_0x1bf34d){for(var _0x3d1f19=0x0;_0x3d1f19<_0x1bf34d['length'];_0x3d1f19+=0x1){var _0x1bd031=_0x1bf34d[_0x3d1f19][_0x99ab('0x2a')]({'plain':!![]});_0x3a6322[_0x99ab('0xa1')]=_0x1f3040['body'][_0x99ab('0xa1')]?_0x1f3040[_0x99ab('0x57')][_0x99ab('0xa1')]:_0x3a6322[_0x99ab('0xa1')];switch(_0x3a6322['dialCheckDuplicateType']){case _0x99ab('0xa2'):_0x7c4c12=squel[_0x99ab('0xa3')]()[_0x99ab('0xa4')]('cm_hopper')[_0x99ab('0xa5')]([_0x99ab('0xa6'),_0x99ab('0xa7'),'ContactId',_0x99ab('0xa8'),_0x99ab('0x68'),_0x99ab('0x61'),'updatedAt'],squel[_0x99ab('0x88')]()[_0x99ab('0x89')]('phone',_0x99ab('0xa6'))[_0x99ab('0x89')](_0x99ab('0xa9'),_0x99ab('0xa7'))[_0x99ab('0x89')]('id',_0x99ab('0xaa'))[_0x99ab('0x89')](_0x1bd031[_0x99ab('0xab')]['toString'](),_0x99ab('0xa8'))[_0x99ab('0x89')](_0x1f3040[_0x99ab('0x55')]['id'][_0x99ab('0xac')](),_0x99ab('0x68'))[_0x99ab('0x89')](_0x99ab('0xa9'),'createdAt')[_0x99ab('0x89')](_0x99ab('0xa9'),_0x99ab('0x62'))[_0x99ab('0x8b')](_0x99ab('0xad'))['where']('deletedAt\x20IS\x20NULL')[_0x99ab('0x4b')]('ListId\x20=\x20?',_0x1bd031[_0x99ab('0xab')][_0x99ab('0xac')]())[_0x99ab('0x4b')]('phone\x20IS\x20NOT\x20NULL')[_0x99ab('0x4b')](_0x99ab('0xae'),squel[_0x99ab('0x88')]()[_0x99ab('0x89')]('COALESCE(calleridnum,\x27\x27)')[_0x99ab('0x8b')]('cm_hopper_final')[_0x99ab('0x4b')]('VoiceQueueId\x20=\x20?',_0x1f3040[_0x99ab('0x55')]['id'][_0x99ab('0xac')]()))[_0x99ab('0x4b')](_0x99ab('0xae'),squel[_0x99ab('0x88')]()[_0x99ab('0x89')]('COALESCE(phone,\x27\x27)')[_0x99ab('0x8b')]('cm_hopper')[_0x99ab('0x4b')](_0x99ab('0xaf'),_0x1f3040[_0x99ab('0x55')]['id']['toString']())))[_0x99ab('0xac')]();break;case _0x99ab('0xb0'):_0x7c4c12=squel[_0x99ab('0xa3')]()[_0x99ab('0xa4')](_0x99ab('0xb1'))[_0x99ab('0xa5')]([_0x99ab('0xa6'),_0x99ab('0xa7'),'ContactId',_0x99ab('0xa8'),_0x99ab('0x68'),_0x99ab('0x61'),_0x99ab('0x62')],squel[_0x99ab('0x88')]()[_0x99ab('0x89')](_0x99ab('0xa6'),'phone')[_0x99ab('0x89')](_0x99ab('0xa9'),_0x99ab('0xa7'))[_0x99ab('0x89')]('id',_0x99ab('0xaa'))['field'](_0x1bd031['CmListId'][_0x99ab('0xac')](),_0x99ab('0xa8'))[_0x99ab('0x89')](_0x1f3040[_0x99ab('0x55')]['id'][_0x99ab('0xac')](),'VoiceQueueId')[_0x99ab('0x89')](_0x99ab('0xa9'),_0x99ab('0x61'))[_0x99ab('0x89')](_0x99ab('0xa9'),_0x99ab('0x62'))[_0x99ab('0x8b')](_0x99ab('0xad'))['where'](_0x99ab('0xb2'))[_0x99ab('0x4b')](_0x99ab('0xb3'),_0x1bd031[_0x99ab('0xab')][_0x99ab('0xac')]())['where'](_0x99ab('0xb4'))[_0x99ab('0x4b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x99ab('0x88')]()[_0x99ab('0x89')](_0x99ab('0xb5'))[_0x99ab('0x8b')](_0x99ab('0xb1'))['where'](_0x99ab('0xaf'),_0x1f3040[_0x99ab('0x55')]['id']['toString']())))[_0x99ab('0xac')]();break;default:_0x7c4c12=squel[_0x99ab('0xa3')]()[_0x99ab('0xa4')]('cm_hopper')[_0x99ab('0xa5')]([_0x99ab('0xa6'),_0x99ab('0xa7'),_0x99ab('0xaa'),_0x99ab('0xa8'),_0x99ab('0x68'),'createdAt','updatedAt'],squel['select']()[_0x99ab('0x89')](_0x99ab('0xa6'),_0x99ab('0xa6'))[_0x99ab('0x89')](_0x99ab('0xa9'),_0x99ab('0xa7'))[_0x99ab('0x89')]('id',_0x99ab('0xaa'))[_0x99ab('0x89')](_0x1bd031[_0x99ab('0xab')][_0x99ab('0xac')](),_0x99ab('0xa8'))[_0x99ab('0x89')](_0x1f3040[_0x99ab('0x55')]['id'][_0x99ab('0xac')](),_0x99ab('0x68'))[_0x99ab('0x89')](_0x99ab('0xa9'),_0x99ab('0x61'))[_0x99ab('0x89')](_0x99ab('0xa9'),'updatedAt')[_0x99ab('0x8b')](_0x99ab('0xad'))[_0x99ab('0x4b')]('deletedAt\x20IS\x20NULL')[_0x99ab('0x4b')](_0x99ab('0xb3'),_0x1bd031[_0x99ab('0xab')][_0x99ab('0xac')]())['where'](_0x99ab('0xb4')))[_0x99ab('0xac')]();}_0x37a554['push'](db[_0x99ab('0x7b')][_0x99ab('0x40')](_0x7c4c12));}return BPromise['all'](_0x37a554);}})[_0x99ab('0x29')](function(){return _0x5464b1;})[_0x99ab('0x29')](respondWithResult(_0x7ca27e,null))['catch'](handleError(_0x7ca27e,null));};exports[_0x99ab('0xb6')]=function(_0x52e1a7,_0xb2b2b7,_0x554a22){return db['VoiceQueue'][_0x99ab('0x35')]({'where':{'id':_0x52e1a7[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0xb2b2b7,null))[_0x99ab('0x29')](function(_0x1e4024){if(_0x1e4024){return _0x1e4024[_0x99ab('0xb6')](_0x52e1a7[_0x99ab('0x40')][_0x99ab('0x87')]);}})[_0x99ab('0x29')](function(_0x493919){if(_0x493919){return db[_0x99ab('0x65')][_0x99ab('0x36')]({'where':{'ListId':_0x52e1a7[_0x99ab('0x40')][_0x99ab('0x87')],'VoiceQueueId':_0x52e1a7['params']['id']}})[_0x99ab('0x29')](function(){return _0x493919;});}})[_0x99ab('0x29')](respondWithStatusCode(_0xb2b2b7,null))[_0x99ab('0x53')](handleError(_0xb2b2b7,null));};exports[_0x99ab('0xb7')]=function(_0x29c956,_0x5db0c6,_0x1cd46a){var _0x33f2e7={};var _0x32074e={};var _0x431da5;var _0x2f6273;return db[_0x99ab('0x3b')][_0x99ab('0x6a')]({'where':{'id':_0x29c956['params']['id']}})['then'](handleEntityNotFound(_0x5db0c6,null))[_0x99ab('0x29')](function(_0x2c15b4){if(_0x2c15b4){_0x431da5=_0x2c15b4;_0x32074e['model']=_['keys'](db['CmList']['rawAttributes']);_0x32074e[_0x99ab('0x40')]=_[_0x99ab('0x41')](_0x29c956[_0x99ab('0x40')]);_0x32074e[_0x99ab('0x42')]=_[_0x99ab('0x43')](_0x32074e[_0x99ab('0x47')],_0x32074e[_0x99ab('0x40')]);_0x33f2e7[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0x32074e[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x29c956[_0x99ab('0x40')][_0x99ab('0x45')]));_0x33f2e7[_0x99ab('0x44')]=_0x33f2e7[_0x99ab('0x44')][_0x99ab('0x46')]?_0x33f2e7[_0x99ab('0x44')]:_0x32074e['model'];_0x33f2e7[_0x99ab('0x49')]=qs[_0x99ab('0x4a')](_0x29c956[_0x99ab('0x40')][_0x99ab('0x4a')]);_0x33f2e7[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_['pick'](_0x29c956[_0x99ab('0x40')],_0x32074e[_0x99ab('0x42')]));if(_0x29c956[_0x99ab('0x40')][_0x99ab('0x2f')]){_0x33f2e7['where']=_[_0x99ab('0x4c')](_0x33f2e7[_0x99ab('0x4b')],{'$or':_[_0x99ab('0x31')](_0x33f2e7[_0x99ab('0x44')],function(_0x243b5c){var _0x56d550={};_0x56d550[_0x243b5c]={'$like':'%'+_0x29c956[_0x99ab('0x40')]['filter']+'%'};return _0x56d550;})});}_0x33f2e7=_[_0x99ab('0x4c')]({},_0x33f2e7,_0x29c956[_0x99ab('0x4e')]);return _0x431da5[_0x99ab('0xb7')](_0x33f2e7);}})[_0x99ab('0x29')](function(_0x23f72a){if(_0x23f72a){_0x2f6273=_0x23f72a[_0x99ab('0x46')];if(!_0x29c956[_0x99ab('0x40')][_0x99ab('0x66')](_0x99ab('0x48'))){_0x33f2e7['limit']=qs[_0x99ab('0x25')](_0x29c956['query']['limit']);_0x33f2e7[_0x99ab('0x24')]=qs[_0x99ab('0x24')](_0x29c956['query'][_0x99ab('0x24')]);}return _0x431da5[_0x99ab('0xb7')](_0x33f2e7);}})[_0x99ab('0x29')](function(_0x446a17){if(_0x446a17){return _0x446a17?{'count':_0x2f6273,'rows':_0x446a17}:null;}})[_0x99ab('0x29')](respondWithResult(_0x5db0c6,null))[_0x99ab('0x53')](handleError(_0x5db0c6,null));};exports[_0x99ab('0xb8')]=function(_0x1a99d4,_0xb87da,_0x55177d){var _0x273e9e,_0x4fce5d;return db['VoiceQueue']['find']({'where':{'id':_0x1a99d4[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0xb87da,null))[_0x99ab('0x29')](function(_0x56468d){if(_0x56468d){_0x4fce5d=_0x56468d;return _0x56468d[_0x99ab('0xb8')](_0x1a99d4[_0x99ab('0x57')][_0x99ab('0x87')],_[_0x99ab('0x60')](_0x1a99d4[_0x99ab('0x57')],[_0x99ab('0x87'),'id'])||{});}return null;})[_0x99ab('0x98')](function(_0x4dcd59){var _0x41a3ec;_0x273e9e=_0x4dcd59||[];var _0x19e11c=[];if(_0x4dcd59){for(var _0x2e6504=0x0;_0x2e6504<_0x4dcd59[_0x99ab('0x46')];_0x2e6504+=0x1){var _0x5eee34=_0x4dcd59[_0x2e6504][_0x99ab('0x2a')]({'plain':!![]});_0x41a3ec=squel['insert']()[_0x99ab('0xa4')](_0x99ab('0xb9'))[_0x99ab('0xa5')]([_0x99ab('0xa6'),'ContactId',_0x99ab('0xa8'),_0x99ab('0x68'),_0x99ab('0x61'),_0x99ab('0x62')],squel[_0x99ab('0x88')]()[_0x99ab('0x89')](_0x99ab('0xa6'),_0x99ab('0xa6'))[_0x99ab('0x89')]('id',_0x99ab('0xaa'))[_0x99ab('0x89')](_0x5eee34[_0x99ab('0xab')]['toString'](),_0x99ab('0xa8'))['field'](_0x1a99d4[_0x99ab('0x55')]['id'][_0x99ab('0xac')](),_0x99ab('0x68'))[_0x99ab('0x89')](_0x99ab('0xa9'),'createdAt')[_0x99ab('0x89')]('NOW()',_0x99ab('0x62'))[_0x99ab('0x8b')]('cm_contacts')[_0x99ab('0x4b')](_0x99ab('0xb2'))[_0x99ab('0x4b')]('ListId\x20=\x20?',_0x5eee34[_0x99ab('0xab')][_0x99ab('0xac')]())[_0x99ab('0x4b')]('phone\x20IS\x20NOT\x20NULL'))[_0x99ab('0xac')]();_0x19e11c[_0x99ab('0x9b')](db[_0x99ab('0x7b')][_0x99ab('0x40')](_0x41a3ec));}return BPromise[_0x99ab('0x93')](_0x19e11c);}})[_0x99ab('0x29')](function(){return _0x273e9e;})[_0x99ab('0x29')](respondWithResult(_0xb87da,null))[_0x99ab('0x53')](handleError(_0xb87da,null));};exports['removeBlackLists']=function(_0x18dc5f,_0x2cbd65,_0x21db39){return db[_0x99ab('0x3b')][_0x99ab('0x35')]({'where':{'id':_0x18dc5f[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x2cbd65,null))[_0x99ab('0x29')](function(_0x2ea998){if(_0x2ea998){return _0x2ea998['removeBlackLists'](_0x18dc5f[_0x99ab('0x40')][_0x99ab('0x87')]);}})[_0x99ab('0x29')](function(_0x18e1fc){if(_0x18e1fc){return db['CmHopperBlack'][_0x99ab('0x36')]({'where':{'ListId':_0x18dc5f[_0x99ab('0x40')][_0x99ab('0x87')],'VoiceQueueId':_0x18dc5f[_0x99ab('0x55')]['id']}})['then'](function(){return _0x18e1fc;});}})[_0x99ab('0x29')](respondWithStatusCode(_0x2cbd65,null))[_0x99ab('0x53')](handleError(_0x2cbd65,null));}; \ No newline at end of file +var _0x85ed=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','body','omit','updatedAt','UserProfileSection','autoAssociation','update','getHoppers','findOne','CmHopper','pick','VoiceQueueId','filter','options','getHopperHistories','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','voicePause','interface','flatMap','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','from','team_has_voice_queues','join','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','compact','transaction','isEmpty','removeAgents','addAgents','spread','online','format','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','field','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','CmListId','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','push','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','status','end','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','map','value','type','name','UserProfileResource','error','send','index','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','VoiceQueue','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create'];(function(_0x5957d0,_0x2433e9){var _0x46ca8a=function(_0x5a4c1b){while(--_0x5a4c1b){_0x5957d0['push'](_0x5957d0['shift']());}};_0x46ca8a(++_0x2433e9);}(_0x85ed,0x66));var _0xd85e=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x85ed[_0xcf5436];return _0xc4f5c8;};'use strict';var pdf=require(_0xd85e('0x0'));var emlformat=require(_0xd85e('0x1'));var rimraf=require(_0xd85e('0x2'));var zipdir=require(_0xd85e('0x3'));var jsonpatch=require(_0xd85e('0x4'));var rp=require(_0xd85e('0x5'));var moment=require(_0xd85e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd85e('0x7'));var util=require(_0xd85e('0x8'));var path=require(_0xd85e('0x9'));var sox=require(_0xd85e('0xa'));var csv=require('to-csv');var ejs=require(_0xd85e('0xb'));var fs=require('fs');var fs_extra=require(_0xd85e('0xc'));var _=require('lodash');var squel=require(_0xd85e('0xd'));var crypto=require(_0xd85e('0xe'));var jsforce=require(_0xd85e('0xf'));var deskjs=require(_0xd85e('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd85e('0x11'));var Papa=require(_0xd85e('0x12'));var Redis=require(_0xd85e('0x13'));var authService=require(_0xd85e('0x14'));var qs=require(_0xd85e('0x15'));var as=require(_0xd85e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd85e('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xd85e('0x18'));var licenseUtil=require(_0xd85e('0x19'));var db=require('../../mysqldb')['db'];config[_0xd85e('0x1a')]=_[_0xd85e('0x1b')](config[_0xd85e('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xd85e('0x1c'))(new Redis(config[_0xd85e('0x1a')]));require(_0xd85e('0x1d'))[_0xd85e('0x1e')](socket);function respondWithStatusCode(_0x1765d5,_0x541696){_0x541696=_0x541696||0xcc;return function(_0x356b3f){if(_0x356b3f){return _0x1765d5['sendStatus'](_0x541696);}return _0x1765d5[_0xd85e('0x1f')](_0x541696)[_0xd85e('0x20')]();};}function respondWithResult(_0x398a7b,_0x5d6bb4){_0x5d6bb4=_0x5d6bb4||0xc8;return function(_0x35af60){if(_0x35af60){return _0x398a7b[_0xd85e('0x1f')](_0x5d6bb4)['json'](_0x35af60);}};}function respondWithFilteredResult(_0x425def,_0x673820){return function(_0x25bbfd){if(_0x25bbfd){var _0x4c432d=_0x25bbfd[_0xd85e('0x21')],_0x3a5370=_0x673820[_0xd85e('0x22')],_0x400f86=_0x673820[_0xd85e('0x22')]+_0x673820[_0xd85e('0x23')],_0x124a31;if(_0x400f86>=_0x4c432d){_0x400f86=_0x4c432d;_0x124a31=0xc8;}else{_0x124a31=0xce;}_0x425def[_0xd85e('0x1f')](_0x124a31);return _0x425def[_0xd85e('0x24')](_0xd85e('0x25'),_0x3a5370+'-'+_0x400f86+'/'+_0x4c432d)['json'](_0x25bbfd);}return null;};}function patchUpdates(_0x255785){return function(_0x10390a){try{jsonpatch[_0xd85e('0x26')](_0x10390a,_0x255785,!![]);}catch(_0x2ef958){return BPromise[_0xd85e('0x27')](_0x2ef958);}return _0x10390a['save']();};}function saveUpdates(_0x33e48f,_0x16b133){return function(_0x194173){if(_0x194173){return _0x194173['update'](_0x33e48f)[_0xd85e('0x28')](function(_0x44168e){return _0x44168e;});}return null;};}function removeEntity(_0x250dce,_0x8a438){return function(_0x26e64a){if(_0x26e64a){return _0x26e64a[_0xd85e('0x29')]()['then'](function(){var _0x176a58=_0x26e64a[_0xd85e('0x2a')]({'plain':!![]});var _0x3826c5=[{'name':_0xd85e('0x2b'),'value':_0xd85e('0x2c'),'ignore':![]},{'name':_0xd85e('0x2d'),'value':_0xd85e('0x2e'),'ignore':![]}];var _0x1d659e=_(_0x3826c5)['filter']('ignore')[_0xd85e('0x2f')](_0xd85e('0x30'))[_0xd85e('0x30')]();if(_['includes'](_0x1d659e,_0x176a58['type'])){return;}var _0x305891=_['find'](_0x3826c5,[_0xd85e('0x30'),_0x176a58[_0xd85e('0x31')]])[_0xd85e('0x32')];return db[_0xd85e('0x33')]['destroy']({'where':{'type':_0x305891,'resourceId':_0x176a58['id']}})['then'](function(){return _0x26e64a;});})['then'](function(){_0x250dce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x385823,_0xb0ea8d){return function(_0x33a7b7){if(!_0x33a7b7){_0x385823['sendStatus'](0x194);}return _0x33a7b7;};}function handleError(_0x6a901d,_0x2fa2ec){_0x2fa2ec=_0x2fa2ec||0x1f4;return function(_0x3c79e5){logger[_0xd85e('0x34')](_0x3c79e5['stack']);if(_0x3c79e5[_0xd85e('0x32')]){delete _0x3c79e5[_0xd85e('0x32')];}_0x6a901d[_0xd85e('0x1f')](_0x2fa2ec)[_0xd85e('0x35')](_0x3c79e5);};}exports[_0xd85e('0x36')]=function(_0x554f0d,_0x303905){var _0x4ea736={},_0x4ff62b={},_0x1b13fc={'count':0x0,'rows':[]};var _0x37ee8d=_[_0xd85e('0x2f')](db['VoiceQueue']['rawAttributes'],function(_0x233719){return{'name':_0x233719['fieldName'],'type':_0x233719[_0xd85e('0x31')]['key']};});_0x4ff62b['model']=_[_0xd85e('0x2f')](_0x37ee8d,_0xd85e('0x32'));_0x4ff62b['query']=_[_0xd85e('0x37')](_0x554f0d[_0xd85e('0x38')]);_0x4ff62b[_0xd85e('0x39')]=_[_0xd85e('0x3a')](_0x4ff62b[_0xd85e('0x3b')],_0x4ff62b[_0xd85e('0x38')]);_0x4ea736[_0xd85e('0x3c')]=_[_0xd85e('0x3a')](_0x4ff62b[_0xd85e('0x3b')],qs[_0xd85e('0x3d')](_0x554f0d[_0xd85e('0x38')][_0xd85e('0x3d')]));_0x4ea736[_0xd85e('0x3c')]=_0x4ea736[_0xd85e('0x3c')]['length']?_0x4ea736[_0xd85e('0x3c')]:_0x4ff62b[_0xd85e('0x3b')];if(!_0x554f0d[_0xd85e('0x38')][_0xd85e('0x3e')](_0xd85e('0x3f'))){_0x4ea736[_0xd85e('0x23')]=qs[_0xd85e('0x23')](_0x554f0d[_0xd85e('0x38')][_0xd85e('0x23')]);_0x4ea736[_0xd85e('0x22')]=qs[_0xd85e('0x22')](_0x554f0d[_0xd85e('0x38')][_0xd85e('0x22')]);}_0x4ea736[_0xd85e('0x40')]=qs['sort'](_0x554f0d[_0xd85e('0x38')][_0xd85e('0x41')]);_0x4ea736[_0xd85e('0x42')]=qs['filters'](_['pick'](_0x554f0d[_0xd85e('0x38')],_0x4ff62b[_0xd85e('0x39')]),_0x37ee8d);if(_0x554f0d[_0xd85e('0x38')]['filter']){_0x4ea736[_0xd85e('0x42')]=_[_0xd85e('0x43')](_0x4ea736[_0xd85e('0x42')],{'$or':_[_0xd85e('0x2f')](_0x37ee8d,function(_0xc3a004){if(_0xc3a004[_0xd85e('0x31')]!==_0xd85e('0x44')){var _0x304fb2={};_0x304fb2[_0xc3a004[_0xd85e('0x32')]]={'$like':'%'+_0x554f0d[_0xd85e('0x38')]['filter']+'%'};return _0x304fb2;}})});}_0x4ea736=_[_0xd85e('0x43')]({},_0x4ea736,_0x554f0d['options']);var _0x141db={'where':_0x4ea736[_0xd85e('0x42')]};return db[_0xd85e('0x45')][_0xd85e('0x21')](_0x141db)[_0xd85e('0x28')](function(_0x3e5d2d){_0x1b13fc[_0xd85e('0x21')]=_0x3e5d2d;if(_0x554f0d[_0xd85e('0x38')][_0xd85e('0x46')]){_0x4ea736[_0xd85e('0x47')]=[{'all':!![]}];}return db[_0xd85e('0x45')]['findAll'](_0x4ea736);})['then'](function(_0x3de236){_0x1b13fc[_0xd85e('0x48')]=_0x3de236;return _0x1b13fc;})[_0xd85e('0x28')](respondWithFilteredResult(_0x303905,_0x4ea736))[_0xd85e('0x49')](handleError(_0x303905,null));};exports[_0xd85e('0x4a')]=function(_0x5bba29,_0x5a5620){var _0x11d031={'raw':![],'where':{'id':_0x5bba29[_0xd85e('0x4b')]['id']}},_0x77bb5f={};_0x77bb5f[_0xd85e('0x3b')]=_[_0xd85e('0x37')](db[_0xd85e('0x45')][_0xd85e('0x4c')]);_0x77bb5f['query']=_[_0xd85e('0x37')](_0x5bba29[_0xd85e('0x38')]);_0x77bb5f[_0xd85e('0x39')]=_[_0xd85e('0x3a')](_0x77bb5f[_0xd85e('0x3b')],_0x77bb5f[_0xd85e('0x38')]);_0x11d031[_0xd85e('0x3c')]=_[_0xd85e('0x3a')](_0x77bb5f[_0xd85e('0x3b')],qs[_0xd85e('0x3d')](_0x5bba29[_0xd85e('0x38')][_0xd85e('0x3d')]));_0x11d031[_0xd85e('0x3c')]=_0x11d031[_0xd85e('0x3c')][_0xd85e('0x4d')]?_0x11d031[_0xd85e('0x3c')]:_0x77bb5f['model'];if(_0x5bba29[_0xd85e('0x38')][_0xd85e('0x46')]){_0x11d031[_0xd85e('0x47')]=[{'all':!![]}];}_0x11d031=_[_0xd85e('0x43')]({},_0x11d031,_0x5bba29['options']);return db[_0xd85e('0x45')][_0xd85e('0x4e')](_0x11d031)[_0xd85e('0x28')](handleEntityNotFound(_0x5a5620,null))['then'](respondWithResult(_0x5a5620,null))[_0xd85e('0x49')](handleError(_0x5a5620,null));};exports[_0xd85e('0x4f')]=function(_0x34805c,_0x4a8cbe){return db[_0xd85e('0x45')][_0xd85e('0x4f')](_0x34805c['body'],{})[_0xd85e('0x28')](function(_0xcf1098){var _0x56191c=_0x34805c[_0xd85e('0x50')][_0xd85e('0x2a')]({'plain':!![]});if(!_0x56191c)throw new Error(_0xd85e('0x51'));if(_0x56191c[_0xd85e('0x52')]===_0xd85e('0x50')){var _0x275f00=_0xcf1098[_0xd85e('0x2a')]({'plain':!![]});var _0x50dd6d=[{'name':_0xd85e('0x2b'),'value':_0xd85e('0x2c')},{'name':_0xd85e('0x2d'),'value':_0xd85e('0x2e')}];var _0x1c94a6=_['find'](_0x50dd6d,[_0xd85e('0x30'),_0x275f00['type']])[_0xd85e('0x32')];return db['UserProfileSection']['find']({'where':{'name':_0x1c94a6,'userProfileId':_0x56191c[_0xd85e('0x53')]},'raw':!![]})[_0xd85e('0x28')](function(_0x253e0b){if(_0x253e0b&&_0x253e0b['autoAssociation']===0x0){return db[_0xd85e('0x33')]['create']({'name':_0x275f00[_0xd85e('0x32')],'resourceId':_0x275f00['id'],'type':_0x253e0b['name'],'sectionId':_0x253e0b['id']},{})['then'](function(){return _0xcf1098;});}else{return _0xcf1098;}})[_0xd85e('0x49')](function(_0x2b3e35){logger[_0xd85e('0x34')](_0xd85e('0x54'),_0x2b3e35);throw _0x2b3e35;});}return _0xcf1098;})[_0xd85e('0x28')](respondWithResult(_0x4a8cbe,0xc9))[_0xd85e('0x49')](handleError(_0x4a8cbe,null));};exports[_0xd85e('0x55')]=function(_0x1278a7,_0xf0180e){var _0x4be7d6={'where':{'id':_0x1278a7[_0xd85e('0x4b')]['id']}},_0x4985b6={};_0x4985b6[_0xd85e('0x3b')]=_[_0xd85e('0x37')](db['VoiceQueue'][_0xd85e('0x4c')]);_0x4be7d6[_0xd85e('0x3c')]=_[_0xd85e('0x3a')](_0x4985b6[_0xd85e('0x3b')],qs['fields'](_0x1278a7[_0xd85e('0x38')][_0xd85e('0x3d')]));_0x4be7d6[_0xd85e('0x3c')]=_0x4be7d6['attributes']['length']?_0x4be7d6[_0xd85e('0x3c')]:_0x4985b6[_0xd85e('0x3b')];if(_0x1278a7[_0xd85e('0x38')]['includeAll']){_0x4be7d6[_0xd85e('0x47')]=[{'all':!![]}];}_0x4be7d6=_[_0xd85e('0x43')]({},_0x4be7d6,_0x1278a7['options']);return db[_0xd85e('0x45')][_0xd85e('0x4e')](_0x4be7d6)[_0xd85e('0x28')](handleEntityNotFound(_0xf0180e,null))[_0xd85e('0x28')](function(_0x1e421a){if(_0x1e421a){var _0x3d4f1f=_0x1e421a['get']({'plain':!![]});_0x3d4f1f=qs['omit'](_0x3d4f1f,['id',_0xd85e('0x56'),'updatedAt']);_0x1278a7[_0xd85e('0x57')]=_[_0xd85e('0x58')](_0x1278a7[_0xd85e('0x57')],['id',_0xd85e('0x56'),_0xd85e('0x59')]);return db['VoiceQueue'][_0xd85e('0x4f')](_['merge'](_0x3d4f1f,_0x1278a7[_0xd85e('0x57')]),{'include':_0x1278a7[_0xd85e('0x38')]['includeAll']?[{'all':!![]}]:undefined})[_0xd85e('0x28')](function(_0x15fd20){var _0x5ea51d=_0x1278a7[_0xd85e('0x50')][_0xd85e('0x2a')]({'plain':!![]});if(!_0x5ea51d)throw new Error(_0xd85e('0x51'));if(_0x5ea51d['role']===_0xd85e('0x50')){var _0x2e89e5=_0x15fd20[_0xd85e('0x2a')]({'plain':!![]});var _0x6606a6=[{'name':_0xd85e('0x2b'),'value':_0xd85e('0x2c')},{'name':_0xd85e('0x2d'),'value':'outbound'}];var _0x45109c=_[_0xd85e('0x4e')](_0x6606a6,['value',_0x2e89e5['type']])[_0xd85e('0x32')];return db[_0xd85e('0x5a')]['find']({'where':{'name':_0x45109c,'userProfileId':_0x5ea51d[_0xd85e('0x53')]},'raw':!![]})[_0xd85e('0x28')](function(_0x2c3741){if(_0x2c3741&&_0x2c3741[_0xd85e('0x5b')]===0x0){return db[_0xd85e('0x33')]['create']({'name':_0x2e89e5[_0xd85e('0x32')],'resourceId':_0x2e89e5['id'],'type':_0x2c3741[_0xd85e('0x32')],'sectionId':_0x2c3741['id']},{})[_0xd85e('0x28')](function(){return _0x15fd20;});}else{return _0x15fd20;}})[_0xd85e('0x49')](function(_0x1e808f){logger[_0xd85e('0x34')](_0xd85e('0x54'),_0x1e808f);throw _0x1e808f;});}return _0x15fd20;});}})[_0xd85e('0x28')](respondWithResult(_0xf0180e,0xc9))[_0xd85e('0x49')](handleError(_0xf0180e,null));};exports[_0xd85e('0x5c')]=function(_0x198b75,_0x1a71b0){if(_0x198b75[_0xd85e('0x57')]['id']){delete _0x198b75[_0xd85e('0x57')]['id'];}return db['VoiceQueue'][_0xd85e('0x4e')]({'where':{'id':_0x198b75['params']['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0x1a71b0,null))[_0xd85e('0x28')](saveUpdates(_0x198b75[_0xd85e('0x57')],null))[_0xd85e('0x28')](respondWithResult(_0x1a71b0,null))[_0xd85e('0x49')](handleError(_0x1a71b0,null));};exports[_0xd85e('0x29')]=function(_0x2d62eb,_0x518663){return db[_0xd85e('0x45')][_0xd85e('0x4e')]({'where':{'id':_0x2d62eb[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0x518663,null))[_0xd85e('0x28')](removeEntity(_0x518663,null))[_0xd85e('0x49')](handleError(_0x518663,null));};exports[_0xd85e('0x5d')]=function(_0x40abc4,_0x517a07,_0x2eda21){var _0x1d99b8={'raw':![],'where':{}};var _0x14150e={};var _0x39348a={'count':0x0,'rows':[]};return db[_0xd85e('0x45')][_0xd85e('0x5e')]({'where':{'id':_0x40abc4[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0x517a07,null))['then'](function(_0x278128){if(_0x278128){_0x14150e[_0xd85e('0x3b')]=_['keys'](db[_0xd85e('0x5f')][_0xd85e('0x4c')]);_0x14150e[_0xd85e('0x38')]=_[_0xd85e('0x37')](_0x40abc4[_0xd85e('0x38')]);_0x14150e[_0xd85e('0x39')]=_[_0xd85e('0x3a')](_0x14150e[_0xd85e('0x3b')],_0x14150e[_0xd85e('0x38')]);_0x1d99b8['attributes']=_[_0xd85e('0x3a')](_0x14150e[_0xd85e('0x3b')],qs[_0xd85e('0x3d')](_0x40abc4[_0xd85e('0x38')]['fields']));_0x1d99b8[_0xd85e('0x3c')]=_0x1d99b8['attributes'][_0xd85e('0x4d')]?_0x1d99b8[_0xd85e('0x3c')]:_0x14150e['model'];if(!_0x40abc4[_0xd85e('0x38')][_0xd85e('0x3e')](_0xd85e('0x3f'))){_0x1d99b8[_0xd85e('0x23')]=qs[_0xd85e('0x23')](_0x40abc4[_0xd85e('0x38')]['limit']);_0x1d99b8[_0xd85e('0x22')]=qs['offset'](_0x40abc4['query'][_0xd85e('0x22')]);}_0x1d99b8[_0xd85e('0x40')]=qs[_0xd85e('0x41')](_0x40abc4[_0xd85e('0x38')][_0xd85e('0x41')]);_0x1d99b8[_0xd85e('0x42')]=qs[_0xd85e('0x39')](_[_0xd85e('0x60')](_0x40abc4[_0xd85e('0x38')],_0x14150e[_0xd85e('0x39')]));_0x1d99b8[_0xd85e('0x42')][_0xd85e('0x61')]=_0x278128['id'];if(_0x40abc4[_0xd85e('0x38')][_0xd85e('0x62')]){_0x1d99b8[_0xd85e('0x42')]=_[_0xd85e('0x43')](_0x1d99b8[_0xd85e('0x42')],{'$or':_[_0xd85e('0x2f')](_0x1d99b8['attributes'],function(_0x10a9f7){var _0x4ce462={};_0x4ce462[_0x10a9f7]={'$like':'%'+_0x40abc4[_0xd85e('0x38')][_0xd85e('0x62')]+'%'};return _0x4ce462;})});}_0x1d99b8=_['merge']({},_0x1d99b8,_0x40abc4[_0xd85e('0x63')]);return db[_0xd85e('0x5f')][_0xd85e('0x21')]({'where':_0x1d99b8[_0xd85e('0x42')]})['then'](function(_0xe93111){_0x39348a[_0xd85e('0x21')]=_0xe93111;if(_0x40abc4[_0xd85e('0x38')][_0xd85e('0x46')]){_0x1d99b8[_0xd85e('0x47')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x1d99b8);})[_0xd85e('0x28')](function(_0x4d81f2){_0x39348a[_0xd85e('0x48')]=_0x4d81f2;return _0x39348a;});}})[_0xd85e('0x28')](respondWithFilteredResult(_0x517a07,_0x1d99b8))[_0xd85e('0x49')](handleError(_0x517a07,null));};exports[_0xd85e('0x64')]=function(_0x94989e,_0x5cdcf0,_0x439ea5){var _0x14a619={'raw':!![],'where':{}};var _0x4c3259={};var _0x2cdf0d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd85e('0x5e')]({'where':{'id':_0x94989e['params']['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0x5cdcf0,null))[_0xd85e('0x28')](function(_0x557ce1){if(_0x557ce1){_0x4c3259['model']=_[_0xd85e('0x37')](db[_0xd85e('0x65')][_0xd85e('0x4c')]);_0x4c3259[_0xd85e('0x38')]=_['keys'](_0x94989e[_0xd85e('0x38')]);_0x4c3259[_0xd85e('0x39')]=_[_0xd85e('0x3a')](_0x4c3259[_0xd85e('0x3b')],_0x4c3259['query']);_0x14a619[_0xd85e('0x3c')]=_['intersection'](_0x4c3259[_0xd85e('0x3b')],qs[_0xd85e('0x3d')](_0x94989e[_0xd85e('0x38')][_0xd85e('0x3d')]));_0x14a619[_0xd85e('0x3c')]=_0x14a619[_0xd85e('0x3c')][_0xd85e('0x4d')]?_0x14a619[_0xd85e('0x3c')]:_0x4c3259[_0xd85e('0x3b')];if(!_0x94989e[_0xd85e('0x38')][_0xd85e('0x3e')](_0xd85e('0x3f'))){_0x14a619[_0xd85e('0x23')]=qs[_0xd85e('0x23')](_0x94989e[_0xd85e('0x38')][_0xd85e('0x23')]);_0x14a619[_0xd85e('0x22')]=qs[_0xd85e('0x22')](_0x94989e[_0xd85e('0x38')][_0xd85e('0x22')]);}_0x14a619['order']=qs[_0xd85e('0x41')](_0x94989e[_0xd85e('0x38')][_0xd85e('0x41')]);_0x14a619[_0xd85e('0x42')]=qs[_0xd85e('0x39')](_[_0xd85e('0x60')](_0x94989e[_0xd85e('0x38')],_0x4c3259[_0xd85e('0x39')]));_0x14a619[_0xd85e('0x42')][_0xd85e('0x61')]=_0x557ce1['id'];if(_0x94989e[_0xd85e('0x38')][_0xd85e('0x62')]){_0x14a619[_0xd85e('0x42')]=_[_0xd85e('0x43')](_0x14a619[_0xd85e('0x42')],{'$or':_[_0xd85e('0x2f')](_0x14a619[_0xd85e('0x3c')],function(_0x4831dd){var _0x576770={};_0x576770[_0x4831dd]={'$like':'%'+_0x94989e[_0xd85e('0x38')]['filter']+'%'};return _0x576770;})});}_0x14a619=_['merge']({},_0x14a619,_0x94989e[_0xd85e('0x63')]);return db[_0xd85e('0x65')][_0xd85e('0x21')]({'where':_0x14a619[_0xd85e('0x42')]})[_0xd85e('0x28')](function(_0x428f06){_0x2cdf0d[_0xd85e('0x21')]=_0x428f06;if(_0x94989e[_0xd85e('0x38')][_0xd85e('0x46')]){_0x14a619[_0xd85e('0x47')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xd85e('0x66')](_0x14a619);})[_0xd85e('0x28')](function(_0x3bb8f8){_0x2cdf0d[_0xd85e('0x48')]=_0x3bb8f8;return _0x2cdf0d;});}})[_0xd85e('0x28')](respondWithFilteredResult(_0x5cdcf0,_0x14a619))['catch'](handleError(_0x5cdcf0,null));};exports[_0xd85e('0x67')]=function(_0x172511,_0x544810,_0x3fca9f){var _0x2285da={'raw':!![],'where':{}};var _0x5bd5e4={};var _0x125c1a={'count':0x0,'rows':[]};return db[_0xd85e('0x45')][_0xd85e('0x5e')]({'where':{'id':_0x172511['params']['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0x544810,null))[_0xd85e('0x28')](function(_0x5f402f){if(_0x5f402f){_0x5bd5e4['model']=_[_0xd85e('0x37')](db[_0xd85e('0x68')]['rawAttributes']);_0x5bd5e4[_0xd85e('0x38')]=_[_0xd85e('0x37')](_0x172511['query']);_0x5bd5e4[_0xd85e('0x39')]=_[_0xd85e('0x3a')](_0x5bd5e4[_0xd85e('0x3b')],_0x5bd5e4[_0xd85e('0x38')]);_0x2285da['attributes']=_[_0xd85e('0x3a')](_0x5bd5e4['model'],qs[_0xd85e('0x3d')](_0x172511[_0xd85e('0x38')][_0xd85e('0x3d')]));_0x2285da[_0xd85e('0x3c')]=_0x2285da[_0xd85e('0x3c')][_0xd85e('0x4d')]?_0x2285da['attributes']:_0x5bd5e4['model'];if(!_0x172511['query'][_0xd85e('0x3e')](_0xd85e('0x3f'))){_0x2285da[_0xd85e('0x23')]=qs[_0xd85e('0x23')](_0x172511[_0xd85e('0x38')][_0xd85e('0x23')]);_0x2285da['offset']=qs[_0xd85e('0x22')](_0x172511[_0xd85e('0x38')]['offset']);}_0x2285da[_0xd85e('0x40')]=qs[_0xd85e('0x41')](_0x172511[_0xd85e('0x38')][_0xd85e('0x41')]);_0x2285da['where']=qs[_0xd85e('0x39')](_[_0xd85e('0x60')](_0x172511[_0xd85e('0x38')],_0x5bd5e4[_0xd85e('0x39')]));_0x2285da[_0xd85e('0x42')]['VoiceQueueId']=_0x5f402f['id'];if(_0x172511[_0xd85e('0x38')][_0xd85e('0x62')]){_0x2285da[_0xd85e('0x42')]=_[_0xd85e('0x43')](_0x2285da[_0xd85e('0x42')],{'$or':_[_0xd85e('0x2f')](_0x2285da['attributes'],function(_0x133f40){var _0x427327={};_0x427327[_0x133f40]={'$like':'%'+_0x172511[_0xd85e('0x38')][_0xd85e('0x62')]+'%'};return _0x427327;})});}_0x2285da=_['merge']({},_0x2285da,_0x172511['options']);return db['CmHopperFinal'][_0xd85e('0x21')]({'where':_0x2285da['where']})[_0xd85e('0x28')](function(_0x5db2a6){_0x125c1a[_0xd85e('0x21')]=_0x5db2a6;if(_0x172511[_0xd85e('0x38')][_0xd85e('0x46')]){_0x2285da[_0xd85e('0x47')]=[{'all':!![]}];}return db[_0xd85e('0x68')][_0xd85e('0x66')](_0x2285da);})[_0xd85e('0x28')](function(_0x3c785b){_0x125c1a[_0xd85e('0x48')]=_0x3c785b;return _0x125c1a;});}})[_0xd85e('0x28')](respondWithFilteredResult(_0x544810,_0x2285da))[_0xd85e('0x49')](handleError(_0x544810,null));};exports['getHopperBlacks']=function(_0x5083d1,_0x44fc19,_0x4691f4){var _0x3f010d={'raw':!![],'where':{}};var _0x3a9369={};var _0x2d0f14={'count':0x0,'rows':[]};return db[_0xd85e('0x45')][_0xd85e('0x5e')]({'where':{'id':_0x5083d1[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0x44fc19,null))['then'](function(_0x29ecb7){if(_0x29ecb7){_0x3a9369[_0xd85e('0x3b')]=_['keys'](db[_0xd85e('0x69')][_0xd85e('0x4c')]);_0x3a9369['query']=_[_0xd85e('0x37')](_0x5083d1[_0xd85e('0x38')]);_0x3a9369[_0xd85e('0x39')]=_[_0xd85e('0x3a')](_0x3a9369[_0xd85e('0x3b')],_0x3a9369[_0xd85e('0x38')]);_0x3f010d[_0xd85e('0x3c')]=_[_0xd85e('0x3a')](_0x3a9369[_0xd85e('0x3b')],qs[_0xd85e('0x3d')](_0x5083d1[_0xd85e('0x38')]['fields']));_0x3f010d[_0xd85e('0x3c')]=_0x3f010d[_0xd85e('0x3c')][_0xd85e('0x4d')]?_0x3f010d[_0xd85e('0x3c')]:_0x3a9369[_0xd85e('0x3b')];if(!_0x5083d1['query'][_0xd85e('0x3e')](_0xd85e('0x3f'))){_0x3f010d[_0xd85e('0x23')]=qs[_0xd85e('0x23')](_0x5083d1[_0xd85e('0x38')]['limit']);_0x3f010d['offset']=qs[_0xd85e('0x22')](_0x5083d1[_0xd85e('0x38')][_0xd85e('0x22')]);}_0x3f010d[_0xd85e('0x40')]=qs[_0xd85e('0x41')](_0x5083d1[_0xd85e('0x38')][_0xd85e('0x41')]);_0x3f010d[_0xd85e('0x42')]=qs['filters'](_[_0xd85e('0x60')](_0x5083d1['query'],_0x3a9369[_0xd85e('0x39')]));_0x3f010d[_0xd85e('0x42')][_0xd85e('0x61')]=_0x29ecb7['id'];if(_0x5083d1[_0xd85e('0x38')][_0xd85e('0x62')]){_0x3f010d[_0xd85e('0x42')]=_[_0xd85e('0x43')](_0x3f010d[_0xd85e('0x42')],{'$or':_[_0xd85e('0x2f')](_0x3f010d[_0xd85e('0x3c')],function(_0x324736){var _0x1cac8b={};_0x1cac8b[_0x324736]={'$like':'%'+_0x5083d1[_0xd85e('0x38')][_0xd85e('0x62')]+'%'};return _0x1cac8b;})});}_0x3f010d=_[_0xd85e('0x43')]({},_0x3f010d,_0x5083d1[_0xd85e('0x63')]);return db[_0xd85e('0x69')]['count']({'where':_0x3f010d['where']})['then'](function(_0x40ba86){_0x2d0f14[_0xd85e('0x21')]=_0x40ba86;if(_0x5083d1[_0xd85e('0x38')][_0xd85e('0x46')]){_0x3f010d[_0xd85e('0x47')]=[{'all':!![]}];}return db[_0xd85e('0x69')][_0xd85e('0x66')](_0x3f010d);})['then'](function(_0x49d378){_0x2d0f14['rows']=_0x49d378;return _0x2d0f14;});}})[_0xd85e('0x28')](respondWithFilteredResult(_0x44fc19,_0x3f010d))[_0xd85e('0x49')](handleError(_0x44fc19,null));};exports[_0xd85e('0x6a')]=function(_0x5f5169,_0x1dc202,_0x287500){var _0x269a72={};var _0x58ed5c={};var _0x4306e7;var _0x41182f;return db['VoiceQueue'][_0xd85e('0x5e')]({'where':{'id':_0x5f5169[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0x1dc202,null))[_0xd85e('0x28')](function(_0xa00f5c){if(_0xa00f5c){_0x4306e7=_0xa00f5c;_0x58ed5c[_0xd85e('0x3b')]=_['keys'](db[_0xd85e('0x6b')]['rawAttributes']);_0x58ed5c['query']=_[_0xd85e('0x37')](_0x5f5169[_0xd85e('0x38')]);_0x58ed5c['filters']=_[_0xd85e('0x3a')](_0x58ed5c[_0xd85e('0x3b')],_0x58ed5c[_0xd85e('0x38')]);_0x269a72[_0xd85e('0x3c')]=_[_0xd85e('0x3a')](_0x58ed5c['model'],qs[_0xd85e('0x3d')](_0x5f5169[_0xd85e('0x38')][_0xd85e('0x3d')]));_0x269a72[_0xd85e('0x3c')]=_0x269a72[_0xd85e('0x3c')][_0xd85e('0x4d')]?_0x269a72[_0xd85e('0x3c')]:_0x58ed5c[_0xd85e('0x3b')];_0x269a72[_0xd85e('0x40')]=qs[_0xd85e('0x41')](_0x5f5169[_0xd85e('0x38')]['sort']);_0x269a72[_0xd85e('0x42')]=qs[_0xd85e('0x39')](_[_0xd85e('0x60')](_0x5f5169[_0xd85e('0x38')],_0x58ed5c[_0xd85e('0x39')]));if(_0x5f5169[_0xd85e('0x38')][_0xd85e('0x62')]){_0x269a72[_0xd85e('0x42')]=_[_0xd85e('0x43')](_0x269a72['where'],{'$or':_[_0xd85e('0x2f')](_0x269a72[_0xd85e('0x3c')],function(_0x148a42){var _0x30157e={};_0x30157e[_0x148a42]={'$like':'%'+_0x5f5169['query']['filter']+'%'};return _0x30157e;})});}_0x269a72=_['merge']({},_0x269a72,_0x5f5169['options']);return _0x4306e7[_0xd85e('0x6a')](_0x269a72);}})[_0xd85e('0x28')](function(_0x5a9951){if(_0x5a9951){_0x41182f=_0x5a9951[_0xd85e('0x4d')];if(!_0x5f5169[_0xd85e('0x38')]['hasOwnProperty'](_0xd85e('0x3f'))){_0x269a72['limit']=qs[_0xd85e('0x23')](_0x5f5169[_0xd85e('0x38')][_0xd85e('0x23')]);_0x269a72[_0xd85e('0x22')]=qs['offset'](_0x5f5169[_0xd85e('0x38')]['offset']);}return _0x4306e7[_0xd85e('0x6a')](_0x269a72);}})[_0xd85e('0x28')](function(_0x534d46){if(_0x534d46){return _0x534d46?{'count':_0x41182f,'rows':_0x534d46}:null;}})['then'](respondWithResult(_0x1dc202,null))[_0xd85e('0x49')](handleError(_0x1dc202,null));};exports[_0xd85e('0x6c')]=function(_0x41f842,_0x328bd5,_0x3460f4){var _0x3f47e4=_0x41f842['body'][_0xd85e('0x6d')];var _0x3f6c08=_['map'](_0x3f47e4,'id');return db[_0xd85e('0x6b')][_0xd85e('0x66')]({'where':{'id':_0x3f6c08},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd85e('0x6e'),'attributes':['id',_0xd85e('0x32'),'online',_0xd85e('0x6f'),_0xd85e('0x70')],'raw':!![]}]})['then'](function(_0x217a8c){if(_0x217a8c){var _0x54ecfe=_[_0xd85e('0x71')](_0x217a8c,function(_0x4888e6){var _0x1ae0f8=_0x4888e6[_0xd85e('0x2a')]({'plain':!![]});_0x1ae0f8['Agents'][_0xd85e('0x72')](function(_0x3294e7){_0x3294e7[_0xd85e('0x73')]=_[_0xd85e('0x4e')](_0x3f47e4,{'id':_0x1ae0f8['id']})[_0xd85e('0x73')];});return _0x1ae0f8[_0xd85e('0x6e')];});return db[_0xd85e('0x45')][_0xd85e('0x4e')]({'where':{'id':_0x41f842[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](function(_0x4ee5cd){return db[_0xd85e('0x74')]['transaction'](function(_0x502b40){return _0x4ee5cd[_0xd85e('0x6c')](_0x3f6c08,{'transaction':_0x502b40})[_0xd85e('0x28')](function(){return BPromise[_0xd85e('0x75')](_0x3f47e4,function(_0x336ea1){return db[_0xd85e('0x76')][_0xd85e('0x77')]({'TeamId':_0x336ea1['id'],'VoiceQueueId':_0x41f842[_0xd85e('0x4b')]['id'],'penalty':_0x336ea1[_0xd85e('0x73')]},{'transaction':_0x502b40});});})[_0xd85e('0x28')](function(){return BPromise[_0xd85e('0x75')](_0x54ecfe,function(_0x53ce7b){return db[_0xd85e('0x78')][_0xd85e('0x79')]({'where':{'UserId':_0x53ce7b['id'],'VoiceQueueId':_0x41f842[_0xd85e('0x4b')]['id']},'defaults':{'penalty':_0x53ce7b[_0xd85e('0x73')]},'transaction':_0x502b40});});})[_0xd85e('0x28')](function(){return BPromise[_0xd85e('0x75')](_[_0xd85e('0x62')](_0x54ecfe,{'online':!![]}),function(_0x21b3fc){return db[_0xd85e('0x7a')][_0xd85e('0x77')]({'membername':_0x21b3fc[_0xd85e('0x32')],'UserId':_0x21b3fc['id'],'queue_name':_0x4ee5cd[_0xd85e('0x32')],'VoiceQueueId':_0x4ee5cd['id'],'interface':_[_0xd85e('0x7b')](_0x21b3fc['interface'])?util['format'](_0xd85e('0x7c'),_0x21b3fc[_0xd85e('0x32')]):_0x21b3fc[_0xd85e('0x70')],'paused':_0x21b3fc[_0xd85e('0x6f')]||![],'penalty':_0x21b3fc[_0xd85e('0x73')]},{'transaction':_0x502b40});});})[_0xd85e('0x28')](function(){_0x54ecfe[_0xd85e('0x72')](function(_0xb7c5c5){socket[_0xd85e('0x7d')](_0xd85e('0x7e'),{'UserId':_0xb7c5c5['id'],'VoiceQueueId':_0x4ee5cd['id']});});});});});}})[_0xd85e('0x28')](respondWithStatusCode(_0x328bd5,null))[_0xd85e('0x49')](handleError(_0x328bd5,null));};exports[_0xd85e('0x7f')]=function(_0x5848b1,_0x33241f,_0x62f625){return db[_0xd85e('0x6b')][_0xd85e('0x66')]({'where':{'id':_0x5848b1[_0xd85e('0x38')][_0xd85e('0x80')]},'attributes':['id'],'include':[{'model':db[_0xd85e('0x81')],'as':_0xd85e('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xd85e('0x28')](handleEntityNotFound(_0x33241f,null))['then'](function(_0x31140b){var _0xa1734c=_['map'](_0x31140b,'id');var _0x32e156=[];var _0x2cab23=[];var _0xa095d8=squel[_0xd85e('0x82')]();_0xa095d8['field']('tq.TeamId')[_0xd85e('0x83')](_0xd85e('0x84'),'tq')[_0xd85e('0x85')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd85e('0x42')]('VoiceQueueId\x20=\x20?',_0x5848b1[_0xd85e('0x4b')]['id']);for(var _0xb53be8=0x0;_0xb53be8<_0x31140b[_0xd85e('0x4d')];_0xb53be8+=0x1){let _0x1607ed=_0x31140b[_0xb53be8];for(var _0x1e7e55=0x0;_0x1e7e55<_0x1607ed[_0xd85e('0x6e')][_0xd85e('0x4d')];_0x1e7e55+=0x1){let _0x297e52=_0x1607ed[_0xd85e('0x6e')][_0x1e7e55];var _0x48ca40=_0xa095d8[_0xd85e('0x55')]();_0x48ca40[_0xd85e('0x42')](_0xd85e('0x86'),_0x297e52['id']);_0x2cab23['push'](db['sequelize'][_0xd85e('0x38')](_0x48ca40[_0xd85e('0x87')](),{'type':db['sequelize']['QueryTypes'][_0xd85e('0x88')]})['then'](function(_0x3101ee){if(_0x3101ee[_0xd85e('0x4d')]===0x1){return _0x297e52['id'];}else{var _0x2ceb20=_[_0xd85e('0x89')](_[_0xd85e('0x2f')](_0x3101ee,_0xd85e('0x8a')),function(_0x595ff9){return _['includes'](_0xa1734c,_0x595ff9);});if(_0x2ceb20){return _0x297e52['id'];}}}));}}return BPromise[_0xd85e('0x8b')](_0x2cab23)['then'](function(_0x2f1786){_0x32e156=_(_0x32e156)['union'](_0x2f1786)[_0xd85e('0x8c')]()[_0xd85e('0x30')]();return db[_0xd85e('0x45')][_0xd85e('0x4e')]({'where':{'id':_0x5848b1[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](function(_0x4f5a01){return db[_0xd85e('0x74')][_0xd85e('0x8d')](function(_0x4f4a45){return _0x4f5a01[_0xd85e('0x7f')](_0x5848b1[_0xd85e('0x38')]['ids'],{'transaction':_0x4f4a45})[_0xd85e('0x28')](function(){if(!_[_0xd85e('0x8e')](_0x32e156)){return _0x4f5a01[_0xd85e('0x8f')](_0x32e156,{'transaction':_0x4f4a45})[_0xd85e('0x28')](function(){return db['UserVoiceQueueRt'][_0xd85e('0x29')]({'where':{'VoiceQueueId':_0x5848b1[_0xd85e('0x4b')]['id'],'UserId':_0x32e156},'transaction':_0x4f4a45});});}})['then'](function(){_0x32e156[_0xd85e('0x72')](function(_0x1069f8){socket['emit']('userVoiceQueue:remove',{'UserId':_0x1069f8,'VoiceQueueId':_0x4f5a01['id']});});});});});});})[_0xd85e('0x28')](respondWithStatusCode(_0x33241f,null))['catch'](handleError(_0x33241f,null));};exports[_0xd85e('0x90')]=function(_0x557f2c,_0x3a0233,_0x53bfc0){var _0x46b9d4,_0x85c289;return db[_0xd85e('0x45')][_0xd85e('0x4e')]({'where':{'id':_0x557f2c[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0x3a0233,null))[_0xd85e('0x28')](function(_0x59398f){if(_0x59398f){_0x85c289=_0x59398f;return _0x59398f[_0xd85e('0x90')](_0x557f2c[_0xd85e('0x57')][_0xd85e('0x80')],_[_0xd85e('0x58')](_0x557f2c[_0xd85e('0x57')],['ids','id'])||{})[_0xd85e('0x91')](function(_0xf2f3b4){for(var _0x2381af=0x0;_0x2381af<_0x557f2c[_0xd85e('0x57')][_0xd85e('0x80')][_0xd85e('0x4d')];_0x2381af+=0x1){socket[_0xd85e('0x7d')](_0xd85e('0x7e'),{'UserId':_0x557f2c[_0xd85e('0x57')][_0xd85e('0x80')][_0x2381af],'VoiceQueueId':_0x557f2c[_0xd85e('0x4b')]['id']});}return _0xf2f3b4;});}})[_0xd85e('0x28')](function(_0x5ba339){_0x46b9d4=_0x5ba339||[];if(_0x85c289){return db[_0xd85e('0x81')][_0xd85e('0x66')]({'where':{'id':_0x557f2c[_0xd85e('0x57')][_0xd85e('0x80')]},'attributes':['id',_0xd85e('0x32'),_0xd85e('0x92'),_0xd85e('0x6f'),_0xd85e('0x70')],'raw':!![]});}})[_0xd85e('0x28')](function(_0x29ceae){if(!_[_0xd85e('0x8e')](_0x29ceae)){var _0x52fe7b=[];for(var _0x59595a=0x0;_0x59595a<_0x29ceae[_0xd85e('0x4d')];_0x59595a++){if(_0x29ceae[_0x59595a][_0xd85e('0x92')]){_0x52fe7b['push'](db[_0xd85e('0x7a')][_0xd85e('0x77')]({'membername':_0x29ceae[_0x59595a][_0xd85e('0x32')],'UserId':_0x29ceae[_0x59595a]['id'],'queue_name':_0x85c289[_0xd85e('0x32')],'VoiceQueueId':_0x85c289['id'],'interface':_[_0xd85e('0x7b')](_0x29ceae[_0x59595a][_0xd85e('0x70')])?util[_0xd85e('0x93')](_0xd85e('0x7c'),_0x29ceae[_0x59595a][_0xd85e('0x32')]):_0x29ceae[_0x59595a][_0xd85e('0x70')],'paused':_0x29ceae[_0x59595a]['voicePause']||![],'penalty':_0x557f2c[_0xd85e('0x57')][_0xd85e('0x73')]||0x0}));}}return BPromise[_0xd85e('0x8b')](_0x52fe7b);}})[_0xd85e('0x28')](function(){return _0x46b9d4;})[_0xd85e('0x28')](respondWithResult(_0x3a0233,null))[_0xd85e('0x49')](handleError(_0x3a0233,null));};exports[_0xd85e('0x8f')]=function(_0x5c5018,_0x50d4ed,_0xaf442){return db[_0xd85e('0x45')][_0xd85e('0x4e')]({'where':{'id':_0x5c5018[_0xd85e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x50d4ed,null))[_0xd85e('0x28')](function(_0x26a0aa){if(_0x26a0aa){return _0x26a0aa[_0xd85e('0x8f')](_0x5c5018['query'][_0xd85e('0x80')])['then'](function(){if(_['isArray'](_0x5c5018[_0xd85e('0x38')][_0xd85e('0x80')])){for(var _0x424cbf=0x0;_0x424cbf<_0x5c5018[_0xd85e('0x38')]['ids']['length'];_0x424cbf+=0x1){socket[_0xd85e('0x7d')](_0xd85e('0x94'),{'UserId':Number(_0x5c5018[_0xd85e('0x38')][_0xd85e('0x80')][_0x424cbf]),'VoiceQueueId':Number(_0x5c5018['params']['id'])});}}else{socket['emit'](_0xd85e('0x94'),{'UserId':Number(_0x5c5018[_0xd85e('0x38')][_0xd85e('0x80')]),'VoiceQueueId':Number(_0x5c5018[_0xd85e('0x4b')]['id'])});}});}})[_0xd85e('0x28')](function(_0x43df49){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x5c5018[_0xd85e('0x4b')]['id'],'UserId':_0x5c5018[_0xd85e('0x38')]['ids']}})[_0xd85e('0x28')](function(){return _0x43df49;});})['then'](respondWithStatusCode(_0x50d4ed,null))[_0xd85e('0x49')](handleError(_0x50d4ed,null));};exports['getAgents']=function(_0x35d39d,_0xaec62d,_0x20adb3){var _0x576deb={};var _0x4a4399={};var _0x2a19e4;var _0x172c5f;return db[_0xd85e('0x45')][_0xd85e('0x5e')]({'where':{'id':_0x35d39d[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0xaec62d,null))[_0xd85e('0x28')](function(_0x1d95ea){if(_0x1d95ea){_0x2a19e4=_0x1d95ea;_0x4a4399['model']=_[_0xd85e('0x37')](db[_0xd85e('0x81')][_0xd85e('0x4c')]);_0x4a4399['query']=_[_0xd85e('0x37')](_0x35d39d[_0xd85e('0x38')]);_0x4a4399[_0xd85e('0x39')]=_['intersection'](_0x4a4399[_0xd85e('0x3b')],_0x4a4399[_0xd85e('0x38')]);_0x576deb[_0xd85e('0x3c')]=_['intersection'](_0x4a4399[_0xd85e('0x3b')],qs[_0xd85e('0x3d')](_0x35d39d[_0xd85e('0x38')][_0xd85e('0x3d')]));_0x576deb['attributes']=_0x576deb[_0xd85e('0x3c')]['length']?_0x576deb[_0xd85e('0x3c')]:_0x4a4399[_0xd85e('0x3b')];_0x576deb[_0xd85e('0x40')]=qs[_0xd85e('0x41')](_0x35d39d[_0xd85e('0x38')][_0xd85e('0x41')]);_0x576deb[_0xd85e('0x42')]=qs[_0xd85e('0x39')](_['pick'](_0x35d39d[_0xd85e('0x38')],_0x4a4399[_0xd85e('0x39')]));if(_0x35d39d[_0xd85e('0x38')]['filter']){_0x576deb[_0xd85e('0x42')]=_[_0xd85e('0x43')](_0x576deb[_0xd85e('0x42')],{'$or':_[_0xd85e('0x2f')](_0x576deb[_0xd85e('0x3c')],function(_0x33ea4a){var _0x251d13={};_0x251d13[_0x33ea4a]={'$like':'%'+_0x35d39d['query'][_0xd85e('0x62')]+'%'};return _0x251d13;})});}_0x576deb=_[_0xd85e('0x43')]({},_0x576deb,_0x35d39d[_0xd85e('0x63')]);return _0x2a19e4[_0xd85e('0x95')](_0x576deb);}})[_0xd85e('0x28')](function(_0x40181f){if(_0x40181f){_0x172c5f=_0x40181f['length'];if(!_0x35d39d[_0xd85e('0x38')]['hasOwnProperty'](_0xd85e('0x3f'))){_0x576deb[_0xd85e('0x23')]=qs[_0xd85e('0x23')](_0x35d39d[_0xd85e('0x38')]['limit']);_0x576deb[_0xd85e('0x22')]=qs[_0xd85e('0x22')](_0x35d39d['query'][_0xd85e('0x22')]);}return _0x2a19e4[_0xd85e('0x95')](_0x576deb);}})[_0xd85e('0x28')](function(_0x35137e){if(_0x35137e){return _0x35137e?{'count':_0x172c5f,'rows':_0x35137e}:null;}})[_0xd85e('0x28')](respondWithResult(_0xaec62d,null))[_0xd85e('0x49')](handleError(_0xaec62d,null));};exports[_0xd85e('0x96')]=function(_0x196c32,_0x2f8244,_0x12edd8){var _0x292526={};var _0x332886={};var _0x578320;var _0x4bf4e0;return db[_0xd85e('0x45')][_0xd85e('0x5e')]({'where':{'id':_0x196c32[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0x2f8244,null))[_0xd85e('0x28')](function(_0x1bd632){if(_0x1bd632){_0x578320=_0x1bd632;_0x332886[_0xd85e('0x3b')]=_[_0xd85e('0x37')](db[_0xd85e('0x7a')][_0xd85e('0x4c')]);_0x332886[_0xd85e('0x38')]=_[_0xd85e('0x37')](_0x196c32[_0xd85e('0x38')]);_0x332886[_0xd85e('0x39')]=_[_0xd85e('0x3a')](_0x332886[_0xd85e('0x3b')],_0x332886[_0xd85e('0x38')]);_0x292526[_0xd85e('0x3c')]=_[_0xd85e('0x3a')](_0x332886[_0xd85e('0x3b')],qs[_0xd85e('0x3d')](_0x196c32[_0xd85e('0x38')]['fields']));_0x292526['attributes']=_0x292526['attributes']['length']?_0x292526[_0xd85e('0x3c')]:_0x332886[_0xd85e('0x3b')];_0x292526['order']=qs[_0xd85e('0x41')](_0x196c32['query'][_0xd85e('0x41')]);_0x292526['where']=qs['filters'](_['pick'](_0x196c32[_0xd85e('0x38')],_0x332886['filters']));if(_0x196c32[_0xd85e('0x38')][_0xd85e('0x62')]){_0x292526['where']=_[_0xd85e('0x43')](_0x292526[_0xd85e('0x42')],{'$or':_['map'](_0x292526[_0xd85e('0x3c')],function(_0x55d7e9){var _0x218b51={};_0x218b51[_0x55d7e9]={'$like':'%'+_0x196c32['query'][_0xd85e('0x62')]+'%'};return _0x218b51;})});}_0x292526=_[_0xd85e('0x43')]({},_0x292526,_0x196c32[_0xd85e('0x63')]);return _0x578320[_0xd85e('0x96')](_0x292526);}})[_0xd85e('0x28')](function(_0x5212ad){if(_0x5212ad){_0x4bf4e0=_0x5212ad['length'];if(!_0x196c32[_0xd85e('0x38')][_0xd85e('0x3e')]('nolimit')){_0x292526[_0xd85e('0x23')]=qs[_0xd85e('0x23')](_0x196c32[_0xd85e('0x38')][_0xd85e('0x23')]);_0x292526[_0xd85e('0x22')]=qs[_0xd85e('0x22')](_0x196c32[_0xd85e('0x38')]['offset']);}return _0x578320[_0xd85e('0x96')](_0x292526);}})['then'](function(_0x507bba){return _0x507bba?{'count':_0x4bf4e0,'rows':_0x507bba}:null;})[_0xd85e('0x28')](respondWithResult(_0x2f8244,null))[_0xd85e('0x49')](handleError(_0x2f8244,null));};exports[_0xd85e('0x97')]=function(_0x48458d,_0x1c8733,_0x4b777c){var _0x7dad8d={};var _0x47629e={};var _0x4b820f;var _0x3c34f7;return db[_0xd85e('0x45')][_0xd85e('0x5e')]({'where':{'id':_0x48458d[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0x1c8733,null))[_0xd85e('0x28')](function(_0x4eef6e){if(_0x4eef6e){_0x4b820f=_0x4eef6e;_0x47629e[_0xd85e('0x3b')]=_['keys'](db[_0xd85e('0x98')][_0xd85e('0x4c')]);_0x47629e['query']=_[_0xd85e('0x37')](_0x48458d[_0xd85e('0x38')]);_0x47629e[_0xd85e('0x39')]=_['intersection'](_0x47629e['model'],_0x47629e[_0xd85e('0x38')]);_0x7dad8d[_0xd85e('0x3c')]=_[_0xd85e('0x3a')](_0x47629e[_0xd85e('0x3b')],qs[_0xd85e('0x3d')](_0x48458d[_0xd85e('0x38')][_0xd85e('0x3d')]));_0x7dad8d[_0xd85e('0x3c')]=_0x7dad8d[_0xd85e('0x3c')][_0xd85e('0x4d')]?_0x7dad8d[_0xd85e('0x3c')]:_0x47629e[_0xd85e('0x3b')];_0x7dad8d[_0xd85e('0x40')]=qs[_0xd85e('0x41')](_0x48458d['query']['sort']);_0x7dad8d['where']=qs[_0xd85e('0x39')](_['pick'](_0x48458d['query'],_0x47629e[_0xd85e('0x39')]));if(_0x48458d[_0xd85e('0x38')][_0xd85e('0x62')]){_0x7dad8d['where']=_['merge'](_0x7dad8d[_0xd85e('0x42')],{'$or':_['map'](_0x7dad8d[_0xd85e('0x3c')],function(_0x2783b4){var _0x5d91c3={};_0x5d91c3[_0x2783b4]={'$like':'%'+_0x48458d[_0xd85e('0x38')][_0xd85e('0x62')]+'%'};return _0x5d91c3;})});}_0x7dad8d=_[_0xd85e('0x43')]({},_0x7dad8d,_0x48458d[_0xd85e('0x63')]);return _0x4b820f[_0xd85e('0x97')](_0x7dad8d);}})[_0xd85e('0x28')](function(_0x3cbcdd){if(_0x3cbcdd){_0x3c34f7=_0x3cbcdd[_0xd85e('0x4d')];if(!_0x48458d[_0xd85e('0x38')][_0xd85e('0x3e')]('nolimit')){_0x7dad8d[_0xd85e('0x23')]=qs[_0xd85e('0x23')](_0x48458d[_0xd85e('0x38')]['limit']);_0x7dad8d[_0xd85e('0x22')]=qs['offset'](_0x48458d[_0xd85e('0x38')][_0xd85e('0x22')]);}return _0x4b820f[_0xd85e('0x97')](_0x7dad8d);}})[_0xd85e('0x28')](function(_0x5cfc71){if(_0x5cfc71){return _0x5cfc71?{'count':_0x3c34f7,'rows':_0x5cfc71}:null;}})['then'](respondWithResult(_0x1c8733,null))[_0xd85e('0x49')](handleError(_0x1c8733,null));};exports[_0xd85e('0x99')]=function(_0x413373,_0x29958b,_0x5547e5){var _0x59a8d4,_0x5da3cf;return db[_0xd85e('0x45')][_0xd85e('0x4e')]({'where':{'id':_0x413373[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0x29958b,null))['then'](function(_0x2cbf1d){if(_0x2cbf1d){_0x5da3cf=_0x2cbf1d;return _0x2cbf1d['addLists'](_0x413373[_0xd85e('0x57')][_0xd85e('0x80')],_[_0xd85e('0x58')](_0x413373[_0xd85e('0x57')],[_0xd85e('0x80'),'id'])||{});}return null;})['spread'](function(_0x456e08){var _0x20e5e9;_0x59a8d4=_0x456e08||[];var _0x2fb918=[];if(_0x456e08){for(var _0x4f6fff=0x0;_0x4f6fff<_0x456e08[_0xd85e('0x4d')];_0x4f6fff+=0x1){var _0x4d4631=_0x456e08[_0x4f6fff][_0xd85e('0x2a')]({'plain':!![]});_0x5da3cf[_0xd85e('0x9a')]=_0x413373[_0xd85e('0x57')][_0xd85e('0x9a')]?_0x413373[_0xd85e('0x57')][_0xd85e('0x9a')]:_0x5da3cf[_0xd85e('0x9a')];switch(_0x5da3cf[_0xd85e('0x9a')]){case _0xd85e('0x9b'):_0x20e5e9=squel[_0xd85e('0x9c')]()['into'](_0xd85e('0x9d'))[_0xd85e('0x9e')]([_0xd85e('0x9f'),_0xd85e('0xa0'),_0xd85e('0xa1'),_0xd85e('0xa2'),'VoiceQueueId','createdAt',_0xd85e('0x59')],squel[_0xd85e('0x82')]()['field']('phone',_0xd85e('0x9f'))['field'](_0xd85e('0xa3'),'scheduledAt')[_0xd85e('0xa4')]('id','ContactId')[_0xd85e('0xa4')](_0x4d4631['CmListId'][_0xd85e('0x87')](),_0xd85e('0xa2'))[_0xd85e('0xa4')](_0x413373[_0xd85e('0x4b')]['id'][_0xd85e('0x87')](),'VoiceQueueId')[_0xd85e('0xa4')](_0xd85e('0xa3'),'createdAt')[_0xd85e('0xa4')](_0xd85e('0xa3'),_0xd85e('0x59'))[_0xd85e('0x83')](_0xd85e('0xa5'))[_0xd85e('0x42')](_0xd85e('0xa6'))['where']('ListId\x20=\x20?',_0x4d4631['CmListId']['toString']())[_0xd85e('0x42')](_0xd85e('0xa7'))[_0xd85e('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd85e('0x82')]()[_0xd85e('0xa4')](_0xd85e('0xa8'))['from'](_0xd85e('0xa9'))[_0xd85e('0x42')](_0xd85e('0xaa'),_0x413373['params']['id'][_0xd85e('0x87')]()))[_0xd85e('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd85e('0x82')]()['field'](_0xd85e('0xab'))[_0xd85e('0x83')](_0xd85e('0x9d'))[_0xd85e('0x42')](_0xd85e('0xaa'),_0x413373['params']['id'][_0xd85e('0x87')]())))[_0xd85e('0x87')]();break;case _0xd85e('0xac'):_0x20e5e9=squel[_0xd85e('0x9c')]()[_0xd85e('0xad')](_0xd85e('0x9d'))[_0xd85e('0x9e')]([_0xd85e('0x9f'),_0xd85e('0xa0'),_0xd85e('0xa1'),_0xd85e('0xa2'),'VoiceQueueId',_0xd85e('0x56'),_0xd85e('0x59')],squel[_0xd85e('0x82')]()[_0xd85e('0xa4')](_0xd85e('0x9f'),'phone')[_0xd85e('0xa4')](_0xd85e('0xa3'),_0xd85e('0xa0'))[_0xd85e('0xa4')]('id',_0xd85e('0xa1'))[_0xd85e('0xa4')](_0x4d4631[_0xd85e('0xae')][_0xd85e('0x87')](),_0xd85e('0xa2'))['field'](_0x413373['params']['id'][_0xd85e('0x87')](),_0xd85e('0x61'))[_0xd85e('0xa4')](_0xd85e('0xa3'),_0xd85e('0x56'))[_0xd85e('0xa4')](_0xd85e('0xa3'),'updatedAt')['from'](_0xd85e('0xa5'))['where']('deletedAt\x20IS\x20NULL')[_0xd85e('0x42')](_0xd85e('0xaf'),_0x4d4631[_0xd85e('0xae')][_0xd85e('0x87')]())[_0xd85e('0x42')](_0xd85e('0xa7'))[_0xd85e('0x42')](_0xd85e('0xb0'),squel[_0xd85e('0x82')]()[_0xd85e('0xa4')](_0xd85e('0xab'))[_0xd85e('0x83')](_0xd85e('0x9d'))[_0xd85e('0x42')](_0xd85e('0xaa'),_0x413373[_0xd85e('0x4b')]['id'][_0xd85e('0x87')]())))['toString']();break;default:_0x20e5e9=squel[_0xd85e('0x9c')]()['into'](_0xd85e('0x9d'))['fromQuery'](['phone',_0xd85e('0xa0'),'ContactId',_0xd85e('0xa2'),_0xd85e('0x61'),_0xd85e('0x56'),_0xd85e('0x59')],squel[_0xd85e('0x82')]()[_0xd85e('0xa4')](_0xd85e('0x9f'),_0xd85e('0x9f'))[_0xd85e('0xa4')](_0xd85e('0xa3'),_0xd85e('0xa0'))[_0xd85e('0xa4')]('id','ContactId')['field'](_0x4d4631[_0xd85e('0xae')][_0xd85e('0x87')](),_0xd85e('0xa2'))[_0xd85e('0xa4')](_0x413373[_0xd85e('0x4b')]['id'][_0xd85e('0x87')](),_0xd85e('0x61'))[_0xd85e('0xa4')]('NOW()',_0xd85e('0x56'))[_0xd85e('0xa4')](_0xd85e('0xa3'),_0xd85e('0x59'))['from'](_0xd85e('0xa5'))[_0xd85e('0x42')]('deletedAt\x20IS\x20NULL')['where'](_0xd85e('0xaf'),_0x4d4631[_0xd85e('0xae')][_0xd85e('0x87')]())[_0xd85e('0x42')](_0xd85e('0xa7')))[_0xd85e('0x87')]();}_0x2fb918[_0xd85e('0xb1')](db['sequelize'][_0xd85e('0x38')](_0x20e5e9));}return BPromise[_0xd85e('0x8b')](_0x2fb918);}})[_0xd85e('0x28')](function(){return _0x59a8d4;})['then'](respondWithResult(_0x29958b,null))[_0xd85e('0x49')](handleError(_0x29958b,null));};exports[_0xd85e('0xb2')]=function(_0x347cd9,_0x12ddba,_0x3420ef){return db[_0xd85e('0x45')]['find']({'where':{'id':_0x347cd9[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0x12ddba,null))[_0xd85e('0x28')](function(_0x17eb48){if(_0x17eb48){return _0x17eb48[_0xd85e('0xb2')](_0x347cd9['query']['ids']);}})['then'](function(_0x233edb){if(_0x233edb){return db[_0xd85e('0x5f')][_0xd85e('0x29')]({'where':{'ListId':_0x347cd9[_0xd85e('0x38')][_0xd85e('0x80')],'VoiceQueueId':_0x347cd9[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](function(){return _0x233edb;});}})[_0xd85e('0x28')](respondWithStatusCode(_0x12ddba,null))['catch'](handleError(_0x12ddba,null));};exports[_0xd85e('0xb3')]=function(_0x175967,_0x3c333a,_0xd3a755){var _0x20884f={};var _0x45573f={};var _0x306a52;var _0x38c906;return db['VoiceQueue'][_0xd85e('0x5e')]({'where':{'id':_0x175967[_0xd85e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3c333a,null))['then'](function(_0x485699){if(_0x485699){_0x306a52=_0x485699;_0x45573f[_0xd85e('0x3b')]=_['keys'](db['CmList'][_0xd85e('0x4c')]);_0x45573f[_0xd85e('0x38')]=_[_0xd85e('0x37')](_0x175967[_0xd85e('0x38')]);_0x45573f[_0xd85e('0x39')]=_[_0xd85e('0x3a')](_0x45573f[_0xd85e('0x3b')],_0x45573f[_0xd85e('0x38')]);_0x20884f[_0xd85e('0x3c')]=_[_0xd85e('0x3a')](_0x45573f[_0xd85e('0x3b')],qs['fields'](_0x175967['query']['fields']));_0x20884f[_0xd85e('0x3c')]=_0x20884f[_0xd85e('0x3c')][_0xd85e('0x4d')]?_0x20884f['attributes']:_0x45573f[_0xd85e('0x3b')];_0x20884f[_0xd85e('0x40')]=qs['sort'](_0x175967['query'][_0xd85e('0x41')]);_0x20884f['where']=qs[_0xd85e('0x39')](_['pick'](_0x175967[_0xd85e('0x38')],_0x45573f[_0xd85e('0x39')]));if(_0x175967[_0xd85e('0x38')][_0xd85e('0x62')]){_0x20884f['where']=_[_0xd85e('0x43')](_0x20884f[_0xd85e('0x42')],{'$or':_[_0xd85e('0x2f')](_0x20884f[_0xd85e('0x3c')],function(_0x29e0b7){var _0x1c6c6f={};_0x1c6c6f[_0x29e0b7]={'$like':'%'+_0x175967[_0xd85e('0x38')][_0xd85e('0x62')]+'%'};return _0x1c6c6f;})});}_0x20884f=_[_0xd85e('0x43')]({},_0x20884f,_0x175967['options']);return _0x306a52[_0xd85e('0xb3')](_0x20884f);}})[_0xd85e('0x28')](function(_0x1f0e92){if(_0x1f0e92){_0x38c906=_0x1f0e92[_0xd85e('0x4d')];if(!_0x175967['query'][_0xd85e('0x3e')](_0xd85e('0x3f'))){_0x20884f[_0xd85e('0x23')]=qs['limit'](_0x175967[_0xd85e('0x38')][_0xd85e('0x23')]);_0x20884f[_0xd85e('0x22')]=qs[_0xd85e('0x22')](_0x175967['query'][_0xd85e('0x22')]);}return _0x306a52['getBlackLists'](_0x20884f);}})[_0xd85e('0x28')](function(_0x208fe4){if(_0x208fe4){return _0x208fe4?{'count':_0x38c906,'rows':_0x208fe4}:null;}})[_0xd85e('0x28')](respondWithResult(_0x3c333a,null))[_0xd85e('0x49')](handleError(_0x3c333a,null));};exports[_0xd85e('0xb4')]=function(_0x3f01c9,_0x70988c,_0x4b8d6e){var _0x430e7a,_0x2581bd;return db[_0xd85e('0x45')][_0xd85e('0x4e')]({'where':{'id':_0x3f01c9[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0x70988c,null))[_0xd85e('0x28')](function(_0x56868a){if(_0x56868a){_0x2581bd=_0x56868a;return _0x56868a['addBlackLists'](_0x3f01c9[_0xd85e('0x57')][_0xd85e('0x80')],_['omit'](_0x3f01c9[_0xd85e('0x57')],[_0xd85e('0x80'),'id'])||{});}return null;})['spread'](function(_0x53f137){var _0x2a0eb9;_0x430e7a=_0x53f137||[];var _0x18b0c3=[];if(_0x53f137){for(var _0xe8617b=0x0;_0xe8617b<_0x53f137['length'];_0xe8617b+=0x1){var _0x5e96e2=_0x53f137[_0xe8617b]['get']({'plain':!![]});_0x2a0eb9=squel[_0xd85e('0x9c')]()[_0xd85e('0xad')]('cm_hopper_black')[_0xd85e('0x9e')](['phone',_0xd85e('0xa1'),_0xd85e('0xa2'),_0xd85e('0x61'),'createdAt',_0xd85e('0x59')],squel[_0xd85e('0x82')]()['field'](_0xd85e('0x9f'),_0xd85e('0x9f'))[_0xd85e('0xa4')]('id','ContactId')[_0xd85e('0xa4')](_0x5e96e2[_0xd85e('0xae')][_0xd85e('0x87')](),'ListId')[_0xd85e('0xa4')](_0x3f01c9[_0xd85e('0x4b')]['id'][_0xd85e('0x87')](),_0xd85e('0x61'))[_0xd85e('0xa4')](_0xd85e('0xa3'),_0xd85e('0x56'))[_0xd85e('0xa4')]('NOW()',_0xd85e('0x59'))[_0xd85e('0x83')]('cm_contacts')[_0xd85e('0x42')](_0xd85e('0xa6'))[_0xd85e('0x42')]('ListId\x20=\x20?',_0x5e96e2[_0xd85e('0xae')]['toString']())[_0xd85e('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0xd85e('0x87')]();_0x18b0c3[_0xd85e('0xb1')](db[_0xd85e('0x74')][_0xd85e('0x38')](_0x2a0eb9));}return BPromise[_0xd85e('0x8b')](_0x18b0c3);}})[_0xd85e('0x28')](function(){return _0x430e7a;})[_0xd85e('0x28')](respondWithResult(_0x70988c,null))[_0xd85e('0x49')](handleError(_0x70988c,null));};exports[_0xd85e('0xb5')]=function(_0x3d7111,_0x5e68b2,_0x38bda3){return db[_0xd85e('0x45')][_0xd85e('0x4e')]({'where':{'id':_0x3d7111[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](handleEntityNotFound(_0x5e68b2,null))[_0xd85e('0x28')](function(_0x5b71cf){if(_0x5b71cf){return _0x5b71cf[_0xd85e('0xb5')](_0x3d7111[_0xd85e('0x38')][_0xd85e('0x80')]);}})[_0xd85e('0x28')](function(_0x495f86){if(_0x495f86){return db['CmHopperBlack'][_0xd85e('0x29')]({'where':{'ListId':_0x3d7111[_0xd85e('0x38')][_0xd85e('0x80')],'VoiceQueueId':_0x3d7111[_0xd85e('0x4b')]['id']}})[_0xd85e('0x28')](function(){return _0x495f86;});}})[_0xd85e('0x28')](respondWithStatusCode(_0x5e68b2,null))[_0xd85e('0x49')](handleError(_0x5e68b2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 8172c71..12b8c90 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 _0x00ba=['../../mysqldb','VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x18e93d,_0x296082){var _0x15ee08=function(_0x4afacf){while(--_0x4afacf){_0x18e93d['push'](_0x18e93d['shift']());}};_0x15ee08(++_0x296082);}(_0x00ba,0x18f));var _0xa00b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x00ba[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa00b('0x0'));var VoiceQueue=require(_0xa00b('0x1'))['db'][_0xa00b('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa00b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa00b('0x4'),'afterDestroy':_0xa00b('0x5')};function emitEvent(_0x1aea9c){return function(_0x320004,_0x166846,_0x2152e9){VoiceQueueEvents[_0xa00b('0x6')](_0x1aea9c+':'+_0x320004['id'],_0x320004);VoiceQueueEvents['emit'](_0x1aea9c,_0x320004);_0x2152e9(null);};}for(var e in events){if(events[_0xa00b('0x7')](e)){var event=events[e];VoiceQueue[_0xa00b('0x8')](e,emitEvent(event));}}module[_0xa00b('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x65ed=['exports','events','VoiceQueue','setMaxListeners','emit','hook'];(function(_0x5b81e1,_0x2e6f9c){var _0xf2cc24=function(_0xb09222){while(--_0xb09222){_0x5b81e1['push'](_0x5b81e1['shift']());}};_0xf2cc24(++_0x2e6f9c);}(_0x65ed,0xfd));var _0xd65e=function(_0x305ad3,_0x244a36){_0x305ad3=_0x305ad3-0x0;var _0x3df215=_0x65ed[_0x305ad3];return _0x3df215;};'use strict';var EventEmitter=require(_0xd65e('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xd65e('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xd65e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x40bd99){return function(_0x3cf4dd,_0x1c6be6,_0x5df439){VoiceQueueEvents[_0xd65e('0x3')](_0x40bd99+':'+_0x3cf4dd['id'],_0x3cf4dd);VoiceQueueEvents['emit'](_0x40bd99,_0x3cf4dd);_0x5df439(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xd65e('0x4')](e,emitEvent(event));}}module[_0xd65e('0x5')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index d2aa0ab..db4a224 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 _0x7f19=['path','rimraf','../../config/environment','define','VoiceQueue','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x26f55a,_0x4c69ef){var _0x2846fa=function(_0x188d1d){while(--_0x188d1d){_0x26f55a['push'](_0x26f55a['shift']());}};_0x2846fa(++_0x4c69ef);}(_0x7f19,0x89));var _0x97f1=function(_0x3bb5a9,_0x128223){_0x3bb5a9=_0x3bb5a9-0x0;var _0x43a338=_0x7f19[_0x3bb5a9];return _0x43a338;};'use strict';var _=require('lodash');var util=require(_0x97f1('0x0'));var logger=require(_0x97f1('0x1'))(_0x97f1('0x2'));var moment=require(_0x97f1('0x3'));var BPromise=require(_0x97f1('0x4'));var rp=require(_0x97f1('0x5'));var fs=require('fs');var path=require(_0x97f1('0x6'));var rimraf=require(_0x97f1('0x7'));var config=require(_0x97f1('0x8'));var attributes=require('./voiceQueue.attributes');module['exports']=function(_0x352dc6,_0x21e59d){return _0x352dc6[_0x97f1('0x9')](_0x97f1('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ac=['bluebird','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x4409a2,_0x26a308){var _0x410af9=function(_0x109039){while(--_0x109039){_0x4409a2['push'](_0x4409a2['shift']());}};_0x410af9(++_0x26a308);}(_0x55ac,0x157));var _0xc55a=function(_0x315c73,_0x9e3e9d){_0x315c73=_0x315c73-0x0;var _0xe8c2de=_0x55ac[_0x315c73];return _0xe8c2de;};'use strict';var _=require(_0xc55a('0x0'));var util=require(_0xc55a('0x1'));var logger=require(_0xc55a('0x2'))(_0xc55a('0x3'));var moment=require(_0xc55a('0x4'));var BPromise=require(_0xc55a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc55a('0x6'));var config=require(_0xc55a('0x7'));var attributes=require(_0xc55a('0x8'));module[_0xc55a('0x9')]=function(_0x72cf5b,_0x5d329c){return _0x72cf5b[_0xc55a('0xa')]('VoiceQueue',attributes,{'tableName':_0xc55a('0xb'),'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 207b899..bf16d90 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 _0x2e20=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','options','raw','where','attributes','include','map','model','then','ShowVoiceQueue','VoiceQueue','debug','lodash','util'];(function(_0x5593a1,_0x2726d1){var _0x1cf0e4=function(_0x3f2480){while(--_0x3f2480){_0x5593a1['push'](_0x5593a1['shift']());}};_0x1cf0e4(++_0x2726d1);}(_0x2e20,0x1b6));var _0x02e2=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x2e20[_0x2f4c1c];return _0x25e0f2;};'use strict';var _=require(_0x02e2('0x0'));var util=require(_0x02e2('0x1'));var moment=require('moment');var BPromise=require(_0x02e2('0x2'));var rs=require(_0x02e2('0x3'));var fs=require('fs');var Redis=require(_0x02e2('0x4'));var db=require(_0x02e2('0x5'))['db'];var utils=require(_0x02e2('0x6'));var logger=require(_0x02e2('0x7'))(_0x02e2('0x8'));var config=require(_0x02e2('0x9'));var jayson=require(_0x02e2('0xa'));var client=jayson['client'][_0x02e2('0xb')]({'port':0x232a});config[_0x02e2('0xc')]=_[_0x02e2('0xd')](config[_0x02e2('0xc')],{'host':_0x02e2('0xe'),'port':0x18eb});var socket=require(_0x02e2('0xf'))(new Redis(config[_0x02e2('0xc')]));require(_0x02e2('0x10'))[_0x02e2('0x11')](socket);function respondWithRpcPromise(_0x54c35b,_0xf407dd,_0x270e4a){return new BPromise(function(_0x3be9bb,_0x1fbb47){return client[_0x02e2('0x12')](_0x54c35b,_0x270e4a)['then'](function(_0x976ef0){logger[_0x02e2('0x13')]('VoiceQueue,\x20%s,\x20%s',_0xf407dd,'request\x20sent');logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0xf407dd,_0x02e2('0x14'),JSON[_0x02e2('0x15')](_0x976ef0));if(_0x976ef0[_0x02e2('0x16')]){if(_0x976ef0['error'][_0x02e2('0x17')]===0x1f4){logger[_0x02e2('0x16')](_0x02e2('0x18'),_0xf407dd,_0x976ef0[_0x02e2('0x16')][_0x02e2('0x19')]);return _0x1fbb47(_0x976ef0['error']['message']);}logger[_0x02e2('0x16')](_0x02e2('0x18'),_0xf407dd,_0x976ef0['error'][_0x02e2('0x19')]);return _0x3be9bb(_0x976ef0['error'][_0x02e2('0x19')]);}else{logger[_0x02e2('0x13')]('VoiceQueue,\x20%s,\x20%s',_0xf407dd,'request\x20sent');_0x3be9bb(_0x976ef0[_0x02e2('0x1a')][_0x02e2('0x19')]);}})[_0x02e2('0x1b')](function(_0x5e9c68){logger[_0x02e2('0x16')](_0x02e2('0x18'),_0xf407dd,_0x5e9c68);_0x1fbb47(_0x5e9c68);});});}exports[_0x02e2('0x1c')]=function(_0x270dc1){var _0x4964bf=this;return new Promise(function(_0x2bcb78,_0x18b14b){return db['VoiceQueue']['findAll']({'raw':_0x270dc1[_0x02e2('0x1d')]?_0x270dc1[_0x02e2('0x1d')][_0x02e2('0x1e')]===undefined?!![]:![]:!![],'where':_0x270dc1[_0x02e2('0x1d')]?_0x270dc1[_0x02e2('0x1d')][_0x02e2('0x1f')]||null:null,'attributes':_0x270dc1[_0x02e2('0x1d')]?_0x270dc1[_0x02e2('0x1d')][_0x02e2('0x20')]||null:null,'limit':_0x270dc1[_0x02e2('0x1d')]?_0x270dc1['options']['limit']||null:null,'include':_0x270dc1[_0x02e2('0x1d')]?_0x270dc1[_0x02e2('0x1d')][_0x02e2('0x21')]?_[_0x02e2('0x22')](_0x270dc1[_0x02e2('0x1d')][_0x02e2('0x21')],function(_0x1de813){return{'model':db[_0x1de813['model']],'as':_0x1de813['as'],'attributes':_0x1de813[_0x02e2('0x20')],'include':_0x1de813[_0x02e2('0x21')]?_[_0x02e2('0x22')](_0x1de813[_0x02e2('0x21')],function(_0x2cab10){return{'model':db[_0x2cab10['model']],'as':_0x2cab10['as'],'attributes':_0x2cab10['attributes'],'include':_0x2cab10['include']?_[_0x02e2('0x22')](_0x2cab10['include'],function(_0x5e57f7){return{'model':db[_0x5e57f7[_0x02e2('0x23')]],'as':_0x5e57f7['as'],'attributes':_0x5e57f7[_0x02e2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x02e2('0x24')](function(_0x57f140){logger['info']('GetVoiceQueue',_0x270dc1);logger['debug'](_0x02e2('0x1c'),_0x270dc1,JSON[_0x02e2('0x15')](_0x57f140));_0x2bcb78(_0x57f140);})[_0x02e2('0x1b')](function(_0x183e21){logger[_0x02e2('0x16')]('GetVoiceQueue',_0x183e21['message'],_0x270dc1);_0x18b14b(_0x4964bf[_0x02e2('0x16')](0x1f4,_0x183e21[_0x02e2('0x19')]));});});};exports[_0x02e2('0x25')]=function(_0x281324){var _0xdcec61=this;return new Promise(function(_0x59eaad,_0x168b19){return db[_0x02e2('0x26')]['find']({'raw':_0x281324[_0x02e2('0x1d')]?_0x281324[_0x02e2('0x1d')][_0x02e2('0x1e')]===undefined?!![]:![]:!![],'where':_0x281324['options']?_0x281324['options'][_0x02e2('0x1f')]||null:null,'attributes':_0x281324['options']?_0x281324[_0x02e2('0x1d')]['attributes']||null:null,'include':_0x281324[_0x02e2('0x1d')]?_0x281324[_0x02e2('0x1d')][_0x02e2('0x21')]?_[_0x02e2('0x22')](_0x281324[_0x02e2('0x1d')]['include'],function(_0x1b7205){return{'model':db[_0x1b7205[_0x02e2('0x23')]],'as':_0x1b7205['as'],'attributes':_0x1b7205[_0x02e2('0x20')],'include':_0x1b7205[_0x02e2('0x21')]?_[_0x02e2('0x22')](_0x1b7205[_0x02e2('0x21')],function(_0x24078d){return{'model':db[_0x24078d[_0x02e2('0x23')]],'as':_0x24078d['as'],'attributes':_0x24078d[_0x02e2('0x20')],'include':_0x24078d[_0x02e2('0x21')]?_[_0x02e2('0x22')](_0x24078d['include'],function(_0x593a3d){return{'model':db[_0x593a3d['model']],'as':_0x593a3d['as'],'attributes':_0x593a3d[_0x02e2('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58153e){logger[_0x02e2('0x13')](_0x02e2('0x25'),_0x281324);logger[_0x02e2('0x27')](_0x02e2('0x25'),_0x281324,JSON[_0x02e2('0x15')](_0x58153e));_0x59eaad(_0x58153e);})[_0x02e2('0x1b')](function(_0xb0a6b6){logger[_0x02e2('0x16')](_0x02e2('0x25'),_0xb0a6b6[_0x02e2('0x19')],_0x281324);_0x168b19(_0xdcec61[_0x02e2('0x16')](0x1f4,_0xb0a6b6[_0x02e2('0x19')]));});});}; \ No newline at end of file +var _0xf34b=['request\x20sent','stringify','error','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','find','ShowVoiceQueue','debug','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s'];(function(_0x85d5a8,_0x1977be){var _0x20479b=function(_0x125248){while(--_0x125248){_0x85d5a8['push'](_0x85d5a8['shift']());}};_0x20479b(++_0x1977be);}(_0xf34b,0x1e8));var _0xbf34=function(_0x55774d,_0x1e1b74){_0x55774d=_0x55774d-0x0;var _0x3a3bd8=_0xf34b[_0x55774d];return _0x3a3bd8;};'use strict';var _=require(_0xbf34('0x0'));var util=require(_0xbf34('0x1'));var moment=require('moment');var BPromise=require(_0xbf34('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf34('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf34('0x4'))(_0xbf34('0x5'));var config=require(_0xbf34('0x6'));var jayson=require(_0xbf34('0x7'));var client=jayson[_0xbf34('0x8')][_0xbf34('0x9')]({'port':0x232a});config[_0xbf34('0xa')]=_[_0xbf34('0xb')](config[_0xbf34('0xa')],{'host':_0xbf34('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf34('0xa')]));require(_0xbf34('0xd'))[_0xbf34('0xe')](socket);function respondWithRpcPromise(_0x38b3aa,_0x267b0d,_0x531e58){return new BPromise(function(_0x39edcd,_0x29cb89){return client[_0xbf34('0xf')](_0x38b3aa,_0x531e58)[_0xbf34('0x10')](function(_0x156bf3){logger[_0xbf34('0x11')](_0xbf34('0x12'),_0x267b0d,_0xbf34('0x13'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x267b0d,_0xbf34('0x13'),JSON[_0xbf34('0x14')](_0x156bf3));if(_0x156bf3[_0xbf34('0x15')]){if(_0x156bf3['error']['code']===0x1f4){logger[_0xbf34('0x15')](_0xbf34('0x12'),_0x267b0d,_0x156bf3[_0xbf34('0x15')][_0xbf34('0x16')]);return _0x29cb89(_0x156bf3[_0xbf34('0x15')]['message']);}logger[_0xbf34('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x267b0d,_0x156bf3['error']['message']);return _0x39edcd(_0x156bf3[_0xbf34('0x15')][_0xbf34('0x16')]);}else{logger['info'](_0xbf34('0x12'),_0x267b0d,_0xbf34('0x13'));_0x39edcd(_0x156bf3[_0xbf34('0x17')][_0xbf34('0x16')]);}})['catch'](function(_0x3d25a0){logger[_0xbf34('0x15')](_0xbf34('0x12'),_0x267b0d,_0x3d25a0);_0x29cb89(_0x3d25a0);});});}exports[_0xbf34('0x18')]=function(_0xa1350a){var _0x3bd1f9=this;return new Promise(function(_0x3d4f4b,_0x20ce82){return db[_0xbf34('0x19')][_0xbf34('0x1a')]({'raw':_0xa1350a[_0xbf34('0x1b')]?_0xa1350a[_0xbf34('0x1b')][_0xbf34('0x1c')]===undefined?!![]:![]:!![],'where':_0xa1350a[_0xbf34('0x1b')]?_0xa1350a[_0xbf34('0x1b')][_0xbf34('0x1d')]||null:null,'attributes':_0xa1350a[_0xbf34('0x1b')]?_0xa1350a[_0xbf34('0x1b')][_0xbf34('0x1e')]||null:null,'limit':_0xa1350a['options']?_0xa1350a['options'][_0xbf34('0x1f')]||null:null,'include':_0xa1350a[_0xbf34('0x1b')]?_0xa1350a['options'][_0xbf34('0x20')]?_[_0xbf34('0x21')](_0xa1350a['options'][_0xbf34('0x20')],function(_0x18f49d){return{'model':db[_0x18f49d[_0xbf34('0x22')]],'as':_0x18f49d['as'],'attributes':_0x18f49d[_0xbf34('0x1e')],'include':_0x18f49d[_0xbf34('0x20')]?_[_0xbf34('0x21')](_0x18f49d[_0xbf34('0x20')],function(_0x216044){return{'model':db[_0x216044['model']],'as':_0x216044['as'],'attributes':_0x216044['attributes'],'include':_0x216044[_0xbf34('0x20')]?_[_0xbf34('0x21')](_0x216044[_0xbf34('0x20')],function(_0x4ca0a1){return{'model':db[_0x4ca0a1[_0xbf34('0x22')]],'as':_0x4ca0a1['as'],'attributes':_0x4ca0a1[_0xbf34('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbf34('0x10')](function(_0xcea0d5){logger[_0xbf34('0x11')]('GetVoiceQueue',_0xa1350a);logger['debug'](_0xbf34('0x18'),_0xa1350a,JSON[_0xbf34('0x14')](_0xcea0d5));_0x3d4f4b(_0xcea0d5);})[_0xbf34('0x23')](function(_0x308457){logger[_0xbf34('0x15')](_0xbf34('0x18'),_0x308457[_0xbf34('0x16')],_0xa1350a);_0x20ce82(_0x3bd1f9['error'](0x1f4,_0x308457['message']));});});};exports['ShowVoiceQueue']=function(_0x2f85ba){var _0x3c7f0f=this;return new Promise(function(_0x19fa7c,_0x1393c5){return db[_0xbf34('0x19')][_0xbf34('0x24')]({'raw':_0x2f85ba[_0xbf34('0x1b')]?_0x2f85ba[_0xbf34('0x1b')][_0xbf34('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f85ba[_0xbf34('0x1b')]?_0x2f85ba[_0xbf34('0x1b')]['where']||null:null,'attributes':_0x2f85ba[_0xbf34('0x1b')]?_0x2f85ba['options'][_0xbf34('0x1e')]||null:null,'include':_0x2f85ba[_0xbf34('0x1b')]?_0x2f85ba[_0xbf34('0x1b')][_0xbf34('0x20')]?_[_0xbf34('0x21')](_0x2f85ba['options'][_0xbf34('0x20')],function(_0x20517a){return{'model':db[_0x20517a[_0xbf34('0x22')]],'as':_0x20517a['as'],'attributes':_0x20517a[_0xbf34('0x1e')],'include':_0x20517a[_0xbf34('0x20')]?_[_0xbf34('0x21')](_0x20517a[_0xbf34('0x20')],function(_0xbb1ff1){return{'model':db[_0xbb1ff1[_0xbf34('0x22')]],'as':_0xbb1ff1['as'],'attributes':_0xbb1ff1[_0xbf34('0x1e')],'include':_0xbb1ff1[_0xbf34('0x20')]?_[_0xbf34('0x21')](_0xbb1ff1[_0xbf34('0x20')],function(_0x4eb061){return{'model':db[_0x4eb061[_0xbf34('0x22')]],'as':_0x4eb061['as'],'attributes':_0x4eb061['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x839910){logger['info'](_0xbf34('0x25'),_0x2f85ba);logger[_0xbf34('0x26')](_0xbf34('0x25'),_0x2f85ba,JSON[_0xbf34('0x14')](_0x839910));_0x19fa7c(_0x839910);})['catch'](function(_0x5b4c7b){logger[_0xbf34('0x15')](_0xbf34('0x25'),_0x5b4c7b['message'],_0x2f85ba);_0x1393c5(_0x3c7f0f['error'](0x1f4,_0x5b4c7b[_0xbf34('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index ed04469..6128aa2 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 _0x8409=['remove','update','removeListener','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x463e29,_0xfc1e0c){var _0x4a09ad=function(_0x1a684c){while(--_0x1a684c){_0x463e29['push'](_0x463e29['shift']());}};_0x4a09ad(++_0xfc1e0c);}(_0x8409,0x91));var _0x9840=function(_0x7472aa,_0x3971a1){_0x7472aa=_0x7472aa-0x0;var _0x12e552=_0x8409[_0x7472aa];return _0x12e552;};'use strict';var VoiceQueueEvents=require(_0x9840('0x0'));var events=[_0x9840('0x1'),_0x9840('0x2'),_0x9840('0x3')];function createListener(_0xdd46fe,_0x1bd594){return function(_0x2f8d84){_0x1bd594['emit'](_0xdd46fe,_0x2f8d84);};}function removeListener(_0x302cb1,_0x545416){return function(){VoiceQueueEvents[_0x9840('0x4')](_0x302cb1,_0x545416);};}exports['register']=function(_0x206f57){for(var _0x4d5e34=0x0,_0x3e514f=events[_0x9840('0x5')];_0x4d5e34<_0x3e514f;_0x4d5e34++){var _0xa3195f=events[_0x4d5e34];var _0x1a23a1=createListener(_0x9840('0x6')+_0xa3195f,_0x206f57);VoiceQueueEvents['on'](_0xa3195f,_0x1a23a1);}}; \ No newline at end of file +var _0xf290=['save','update','emit','register','length','voiceQueue:'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf290,0xde));var _0x0f29=function(_0x3d00db,_0x3692b3){_0x3d00db=_0x3d00db-0x0;var _0x41f115=_0xf290[_0x3d00db];return _0x41f115;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x0f29('0x0'),'remove',_0x0f29('0x1')];function createListener(_0x4b16e4,_0xb8a620){return function(_0x1b4f85){_0xb8a620[_0x0f29('0x2')](_0x4b16e4,_0x1b4f85);};}function removeListener(_0x28b644,_0xfdab92){return function(){VoiceQueueEvents['removeListener'](_0x28b644,_0xfdab92);};}exports[_0x0f29('0x3')]=function(_0x4911fb){for(var _0x2d5350=0x0,_0x1c45ec=events[_0x0f29('0x4')];_0x2d5350<_0x1c45ec;_0x2d5350++){var _0xaa2675=events[_0x2d5350];var _0xc78ca2=createListener(_0x0f29('0x5')+_0xaa2675,_0x4911fb);VoiceQueueEvents['on'](_0xaa2675,_0xc78ca2);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 4457753..bb4dea9 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 _0xd3bf=['put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create'];(function(_0x3c722b,_0x16073f){var _0x1afb12=function(_0x16b848){while(--_0x16b848){_0x3c722b['push'](_0x3c722b['shift']());}};_0x1afb12(++_0x16073f);}(_0xd3bf,0x155));var _0xfd3b=function(_0x864853,_0x1b7287){_0x864853=_0x864853-0x0;var _0x2d1509=_0xd3bf[_0x864853];return _0x2d1509;};'use strict';var multer=require(_0xfd3b('0x0'));var util=require(_0xfd3b('0x1'));var path=require(_0xfd3b('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd3b('0x3'));var router=express[_0xfd3b('0x4')]();var fs_extra=require(_0xfd3b('0x5'));var auth=require(_0xfd3b('0x6'));var interaction=require(_0xfd3b('0x7'));var config=require(_0xfd3b('0x8'));var controller=require('./voiceQueueReport.controller');router[_0xfd3b('0x9')]('/',auth[_0xfd3b('0xa')](),controller['index']);router[_0xfd3b('0x9')]('/describe',auth[_0xfd3b('0xa')](),controller[_0xfd3b('0xb')]);router['get']('/index',auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0xfd3b('0x9')](_0xfd3b('0xc'),auth[_0xfd3b('0xa')](),controller[_0xfd3b('0xd')]);router[_0xfd3b('0xe')]('/',auth[_0xfd3b('0xa')](),controller[_0xfd3b('0xf')]);router[_0xfd3b('0x10')]('/:id',auth[_0xfd3b('0xa')](),controller[_0xfd3b('0x11')]);router[_0xfd3b('0x12')]('/:id',auth[_0xfd3b('0xa')](),controller[_0xfd3b('0x13')]);module[_0xfd3b('0x14')]=router; \ No newline at end of file +var _0xa71d=['describe','/index','/:id','show','post','create','update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa71d,0xa4));var _0xda71=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xa71d[_0x500419];return _0x241c1a;};'use strict';var multer=require('multer');var util=require(_0xda71('0x0'));var path=require(_0xda71('0x1'));var timeout=require('connect-timeout');var express=require(_0xda71('0x2'));var router=express['Router']();var fs_extra=require(_0xda71('0x3'));var auth=require(_0xda71('0x4'));var interaction=require(_0xda71('0x5'));var config=require(_0xda71('0x6'));var controller=require(_0xda71('0x7'));router[_0xda71('0x8')]('/',auth['isAuthenticated'](),controller[_0xda71('0x9')]);router[_0xda71('0x8')](_0xda71('0xa'),auth[_0xda71('0xb')](),controller[_0xda71('0xc')]);router[_0xda71('0x8')](_0xda71('0xd'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0xda71('0x8')](_0xda71('0xe'),auth['isAuthenticated'](),controller[_0xda71('0xf')]);router[_0xda71('0x10')]('/',auth[_0xda71('0xb')](),controller[_0xda71('0x11')]);router['put'](_0xda71('0xe'),auth[_0xda71('0xb')](),controller[_0xda71('0x12')]);router[_0xda71('0x13')](_0xda71('0xe'),auth[_0xda71('0xb')](),controller[_0xda71('0x14')]);module[_0xda71('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 5843f4b..9048584 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 _0xe706=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x26ce39,_0x1f3596){var _0x453bb1=function(_0x595744){while(--_0x595744){_0x26ce39['push'](_0x26ce39['shift']());}};_0x453bb1(++_0x1f3596);}(_0xe706,0xa3));var _0x6e70=function(_0xccc0d4,_0x2f6bf7){_0xccc0d4=_0xccc0d4-0x0;var _0x27a653=_0xe706[_0xccc0d4];return _0x27a653;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6e70('0x3')]},'calleridnum':{'type':Sequelize[_0x6e70('0x3')]},'calleridname':{'type':Sequelize[_0x6e70('0x3')]},'queue':{'type':Sequelize[_0x6e70('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x6e70('0x4')],'set':function(_0x376a8d){var _0x506db9=moment(_0x376a8d);var _0x1b0389=moment(this[_0x6e70('0x5')](_0x6e70('0x6')))[_0x6e70('0x7')](_0x6e70('0x8'));var _0x188ed3=_0x506db9[_0x6e70('0x9')](_0x1b0389,_0x6e70('0xa'));this[_0x6e70('0xb')](_0x6e70('0xc'),_0x376a8d);this[_0x6e70('0xb')](_0x6e70('0xd'),_0x188ed3||null);}},'position':{'type':Sequelize[_0x6e70('0xe')]},'count':{'type':Sequelize[_0x6e70('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x6e70('0x3')],'comment':_0x6e70('0x10')},'originalposition':{'type':Sequelize[_0x6e70('0xe')]},'channel':{'type':Sequelize[_0x6e70('0x3')]},'connectedlinenum':{'type':Sequelize[_0x6e70('0x3')]},'connectedlinename':{'type':Sequelize[_0x6e70('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6e70('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6e70('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6e70('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6e70('0x3')]},'transferuniqueid':{'type':Sequelize[_0x6e70('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6e70('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcb91=['setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0xcb91[_0x18e52b];return _0x3d3062;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1cb9('0x0')]={'type':{'type':Sequelize[_0x1cb9('0x1')]},'uniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'calleridnum':{'type':Sequelize[_0x1cb9('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x13d5fd){var _0x1b26cd=moment(_0x13d5fd);var _0x53ffbd=moment(this[_0x1cb9('0x3')](_0x1cb9('0x4')))['format'](_0x1cb9('0x5'));var _0x12567c=_0x1b26cd['diff'](_0x53ffbd,_0x1cb9('0x6'));this['setDataValue']('queuecallerleaveAt',_0x13d5fd);this[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x12567c||null);}},'position':{'type':Sequelize[_0x1cb9('0x9')]},'count':{'type':Sequelize[_0x1cb9('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexit':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x1cb9('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1cb9('0x1')]},'connectedlinename':{'type':Sequelize[_0x1cb9('0x1')]},'accountcode':{'type':Sequelize[_0x1cb9('0x1')]},'context':{'type':Sequelize[_0x1cb9('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1cb9('0x1')]},'holdtime':{'type':Sequelize[_0x1cb9('0x9')]},'mohtime':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1cb9('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x1cb9('0xb')},'transferexten':{'type':Sequelize[_0x1cb9('0x1')]},'transferuniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'disposition':{'type':Sequelize[_0x1cb9('0x1')]},'secondDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'thirdDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x1cb9('0x9')],'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 9377a9e..0a7d0da 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 _0x2144=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','then','sendStatus','error','stack','send','index','VoiceQueueReport','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','include','findAll','rows','catch','show','rawAttributes','find','create','update','body','params','getVoiceQueuesReport','includeAll','html-pdf','eml-format'];(function(_0x44ba07,_0x32f372){var _0x199bf7=function(_0x2f0689){while(--_0x2f0689){_0x44ba07['push'](_0x44ba07['shift']());}};_0x199bf7(++_0x32f372);}(_0x2144,0xfa));var _0x4214=function(_0x5da4d8,_0x31cca6){_0x5da4d8=_0x5da4d8-0x0;var _0x354518=_0x2144[_0x5da4d8];return _0x354518;};'use strict';var pdf=require(_0x4214('0x0'));var emlformat=require(_0x4214('0x1'));var rimraf=require(_0x4214('0x2'));var zipdir=require(_0x4214('0x3'));var jsonpatch=require(_0x4214('0x4'));var rp=require(_0x4214('0x5'));var moment=require(_0x4214('0x6'));var BPromise=require(_0x4214('0x7'));var Mustache=require(_0x4214('0x8'));var util=require(_0x4214('0x9'));var path=require(_0x4214('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4214('0xb'));var fs=require('fs');var fs_extra=require(_0x4214('0xc'));var _=require(_0x4214('0xd'));var squel=require(_0x4214('0xe'));var crypto=require(_0x4214('0xf'));var jsforce=require(_0x4214('0x10'));var deskjs=require(_0x4214('0x11'));var toCsv=require('to-csv');var querystring=require(_0x4214('0x12'));var Papa=require('papaparse');var Redis=require(_0x4214('0x13'));var authService=require(_0x4214('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4214('0x15'));var hardwareService=require(_0x4214('0x16'));var logger=require(_0x4214('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4214('0x18'));var licenseUtil=require(_0x4214('0x19'));var db=require(_0x4214('0x1a'))['db'];config['redis']=_[_0x4214('0x1b')](config[_0x4214('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x4214('0x1d'))(new Redis(config[_0x4214('0x1c')]));require('./voiceQueueReport.socket')[_0x4214('0x1e')](socket);function respondWithStatusCode(_0x18bb06,_0x98ed75){_0x98ed75=_0x98ed75||0xcc;return function(_0x585ba6){if(_0x585ba6){return _0x18bb06['sendStatus'](_0x98ed75);}return _0x18bb06[_0x4214('0x1f')](_0x98ed75)[_0x4214('0x20')]();};}function respondWithResult(_0x1957ea,_0x175ff1){_0x175ff1=_0x175ff1||0xc8;return function(_0x3050c6){if(_0x3050c6){return _0x1957ea[_0x4214('0x1f')](_0x175ff1)[_0x4214('0x21')](_0x3050c6);}};}function respondWithFilteredResult(_0x1ab26a,_0x2b89f1){return function(_0x39c582){if(_0x39c582){var _0x5d8962=_0x39c582[_0x4214('0x22')],_0x2c6129=_0x2b89f1[_0x4214('0x23')],_0x4a824f=_0x2b89f1[_0x4214('0x23')]+_0x2b89f1[_0x4214('0x24')],_0x1ece5d;if(_0x4a824f>=_0x5d8962){_0x4a824f=_0x5d8962;_0x1ece5d=0xc8;}else{_0x1ece5d=0xce;}_0x1ab26a[_0x4214('0x1f')](_0x1ece5d);return _0x1ab26a[_0x4214('0x25')](_0x4214('0x26'),_0x2c6129+'-'+_0x4a824f+'/'+_0x5d8962)[_0x4214('0x21')](_0x39c582);}return null;};}function patchUpdates(_0x4913d2){return function(_0x4061f2){try{jsonpatch[_0x4214('0x27')](_0x4061f2,_0x4913d2,!![]);}catch(_0x19fc97){return BPromise['reject'](_0x19fc97);}return _0x4061f2[_0x4214('0x28')]();};}function saveUpdates(_0x167abe,_0x4f0c9f){return function(_0x3c434f){if(_0x3c434f){return _0x3c434f['update'](_0x167abe)['then'](function(_0x28ee41){return _0x28ee41;});}return null;};}function removeEntity(_0x1c4beb,_0x2dc2d1){return function(_0xd07705){if(_0xd07705){return _0xd07705[_0x4214('0x29')]()[_0x4214('0x2a')](function(){_0x1c4beb['status'](0xcc)[_0x4214('0x20')]();});}};}function handleEntityNotFound(_0xf802db,_0xa91909){return function(_0x270f0e){if(!_0x270f0e){_0xf802db[_0x4214('0x2b')](0x194);}return _0x270f0e;};}function handleError(_0x3b8a35,_0x4d5547){_0x4d5547=_0x4d5547||0x1f4;return function(_0x23cb25){logger[_0x4214('0x2c')](_0x23cb25[_0x4214('0x2d')]);if(_0x23cb25['name']){delete _0x23cb25['name'];}_0x3b8a35[_0x4214('0x1f')](_0x4d5547)[_0x4214('0x2e')](_0x23cb25);};}exports[_0x4214('0x2f')]=function(_0x5e6964,_0x305aef){var _0x4872f0={},_0x255e83={},_0x589220={'count':0x0,'rows':[]};var _0x467235=_['map'](db[_0x4214('0x30')]['rawAttributes'],function(_0xf0654){return{'name':_0xf0654[_0x4214('0x31')],'type':_0xf0654[_0x4214('0x32')][_0x4214('0x33')]};});_0x255e83[_0x4214('0x34')]=_['map'](_0x467235,_0x4214('0x35'));_0x255e83[_0x4214('0x36')]=_[_0x4214('0x37')](_0x5e6964[_0x4214('0x36')]);_0x255e83[_0x4214('0x38')]=_[_0x4214('0x39')](_0x255e83[_0x4214('0x34')],_0x255e83[_0x4214('0x36')]);_0x4872f0[_0x4214('0x3a')]=_[_0x4214('0x39')](_0x255e83[_0x4214('0x34')],qs[_0x4214('0x3b')](_0x5e6964['query'][_0x4214('0x3b')]));_0x4872f0[_0x4214('0x3a')]=_0x4872f0[_0x4214('0x3a')][_0x4214('0x3c')]?_0x4872f0[_0x4214('0x3a')]:_0x255e83['model'];if(!_0x5e6964[_0x4214('0x36')][_0x4214('0x3d')](_0x4214('0x3e'))){_0x4872f0[_0x4214('0x24')]=qs['limit'](_0x5e6964['query'][_0x4214('0x24')]);_0x4872f0[_0x4214('0x23')]=qs[_0x4214('0x23')](_0x5e6964['query']['offset']);}_0x4872f0[_0x4214('0x3f')]=qs['sort'](_0x5e6964['query'][_0x4214('0x40')]);_0x4872f0[_0x4214('0x41')]=qs[_0x4214('0x38')](_[_0x4214('0x42')](_0x5e6964[_0x4214('0x36')],_0x255e83[_0x4214('0x38')]),_0x467235);if(_0x5e6964['query']['filter']){_0x4872f0[_0x4214('0x41')]=_[_0x4214('0x43')](_0x4872f0['where'],{'$or':_[_0x4214('0x44')](_0x467235,function(_0x305f07){if(_0x305f07[_0x4214('0x32')]!=='VIRTUAL'){var _0x345f2d={};_0x345f2d[_0x305f07[_0x4214('0x35')]]={'$like':'%'+_0x5e6964['query'][_0x4214('0x45')]+'%'};return _0x345f2d;}})});}_0x4872f0=_[_0x4214('0x43')]({},_0x4872f0,_0x5e6964[_0x4214('0x46')]);var _0x582cf6={'where':_0x4872f0[_0x4214('0x41')]};return db['VoiceQueueReport'][_0x4214('0x22')](_0x582cf6)[_0x4214('0x2a')](function(_0x4ba00f){_0x589220[_0x4214('0x22')]=_0x4ba00f;if(_0x5e6964[_0x4214('0x36')]['includeAll']){_0x4872f0[_0x4214('0x47')]=[{'all':!![]}];}return db[_0x4214('0x30')][_0x4214('0x48')](_0x4872f0);})['then'](function(_0x2aff42){_0x589220[_0x4214('0x49')]=_0x2aff42;return _0x589220;})[_0x4214('0x2a')](respondWithFilteredResult(_0x305aef,_0x4872f0))[_0x4214('0x4a')](handleError(_0x305aef,null));};exports[_0x4214('0x4b')]=function(_0x18c496,_0x3b2cc3){var _0x1ce721={'raw':![],'where':{'id':_0x18c496['params']['id']}},_0x5af49b={};_0x5af49b[_0x4214('0x34')]=_['keys'](db[_0x4214('0x30')][_0x4214('0x4c')]);_0x5af49b[_0x4214('0x36')]=_['keys'](_0x18c496[_0x4214('0x36')]);_0x5af49b['filters']=_[_0x4214('0x39')](_0x5af49b[_0x4214('0x34')],_0x5af49b[_0x4214('0x36')]);_0x1ce721[_0x4214('0x3a')]=_[_0x4214('0x39')](_0x5af49b[_0x4214('0x34')],qs[_0x4214('0x3b')](_0x18c496[_0x4214('0x36')][_0x4214('0x3b')]));_0x1ce721[_0x4214('0x3a')]=_0x1ce721[_0x4214('0x3a')][_0x4214('0x3c')]?_0x1ce721['attributes']:_0x5af49b[_0x4214('0x34')];if(_0x18c496[_0x4214('0x36')]['includeAll']){_0x1ce721['include']=[{'all':!![]}];}_0x1ce721=_[_0x4214('0x43')]({},_0x1ce721,_0x18c496['options']);return db['VoiceQueueReport'][_0x4214('0x4d')](_0x1ce721)[_0x4214('0x2a')](handleEntityNotFound(_0x3b2cc3,null))[_0x4214('0x2a')](respondWithResult(_0x3b2cc3,null))[_0x4214('0x4a')](handleError(_0x3b2cc3,null));};exports[_0x4214('0x4e')]=function(_0x2a26ec,_0x3ae7b3){return db[_0x4214('0x30')][_0x4214('0x4e')](_0x2a26ec['body'],{})['then'](respondWithResult(_0x3ae7b3,0xc9))[_0x4214('0x4a')](handleError(_0x3ae7b3,null));};exports[_0x4214('0x4f')]=function(_0x4fee59,_0x40cea8){if(_0x4fee59[_0x4214('0x50')]['id']){delete _0x4fee59[_0x4214('0x50')]['id'];}return db['VoiceQueueReport'][_0x4214('0x4d')]({'where':{'id':_0x4fee59[_0x4214('0x51')]['id']}})[_0x4214('0x2a')](handleEntityNotFound(_0x40cea8,null))[_0x4214('0x2a')](saveUpdates(_0x4fee59[_0x4214('0x50')],null))[_0x4214('0x2a')](respondWithResult(_0x40cea8,null))[_0x4214('0x4a')](handleError(_0x40cea8,null));};exports['destroy']=function(_0x2ced9e,_0x466bbd){return db[_0x4214('0x30')][_0x4214('0x4d')]({'where':{'id':_0x2ced9e[_0x4214('0x51')]['id']}})[_0x4214('0x2a')](handleEntityNotFound(_0x466bbd,null))['then'](removeEntity(_0x466bbd,null))['catch'](handleError(_0x466bbd,null));};exports['describe']=function(_0x521fe1,_0x2aebe0){return db[_0x4214('0x30')]['describe']()[_0x4214('0x2a')](respondWithResult(_0x2aebe0,null))[_0x4214('0x4a')](handleError(_0x2aebe0,null));};exports[_0x4214('0x52')]=function(_0x42ce0d,_0x1430d1){var _0x13bae8={},_0x2859fe={},_0x1f1bf5={'count':0x0,'rows':[]};_0x2859fe['model']=_[_0x4214('0x37')](db['VoiceQueueReport']['rawAttributes']);_0x2859fe[_0x4214('0x36')]=_[_0x4214('0x37')](_0x42ce0d['query']);_0x2859fe[_0x4214('0x38')]=_[_0x4214('0x39')](_0x2859fe['model'],_0x2859fe[_0x4214('0x36')]);_0x13bae8[_0x4214('0x3a')]=_[_0x4214('0x39')](_0x2859fe[_0x4214('0x34')],qs[_0x4214('0x3b')](_0x42ce0d[_0x4214('0x36')][_0x4214('0x3b')]));_0x13bae8[_0x4214('0x3a')]=_0x13bae8[_0x4214('0x3a')][_0x4214('0x3c')]?_0x13bae8[_0x4214('0x3a')]:_0x2859fe[_0x4214('0x34')];if(!_0x42ce0d[_0x4214('0x36')][_0x4214('0x3d')](_0x4214('0x3e'))){_0x13bae8[_0x4214('0x24')]=qs[_0x4214('0x24')](_0x42ce0d[_0x4214('0x36')][_0x4214('0x24')]);_0x13bae8['offset']=qs[_0x4214('0x23')](_0x42ce0d['query'][_0x4214('0x23')]);}_0x13bae8[_0x4214('0x3f')]=qs['sort'](_0x42ce0d['query'][_0x4214('0x40')]);_0x13bae8[_0x4214('0x41')]=qs['filters'](_['pick'](_0x42ce0d[_0x4214('0x36')],_0x2859fe['filters']));if(_0x42ce0d['query'][_0x4214('0x45')]){_0x13bae8[_0x4214('0x41')]=_[_0x4214('0x43')](_0x13bae8[_0x4214('0x41')],{'$or':_['map'](_0x13bae8[_0x4214('0x3a')],function(_0x4a3159){var _0x44d2e5={};_0x44d2e5[_0x4a3159]={'$like':'%'+_0x42ce0d[_0x4214('0x36')]['filter']+'%'};return _0x44d2e5;})});}_0x13bae8=_[_0x4214('0x43')]({},_0x13bae8,_0x42ce0d[_0x4214('0x46')]);var _0x5532ec={'where':_0x13bae8[_0x4214('0x41')]};return db['VoiceQueueReport'][_0x4214('0x22')](_0x5532ec)[_0x4214('0x2a')](function(_0x23a27a){_0x1f1bf5[_0x4214('0x22')]=_0x23a27a;if(_0x42ce0d[_0x4214('0x36')][_0x4214('0x53')]){_0x13bae8[_0x4214('0x47')]=[{'all':!![]}];}return db[_0x4214('0x30')][_0x4214('0x48')](_0x13bae8);})[_0x4214('0x2a')](function(_0x33b749){_0x1f1bf5[_0x4214('0x49')]=_0x33b749;return _0x1f1bf5;})['then'](respondWithFilteredResult(_0x1430d1,_0x13bae8,_0x4214('0x52')))['catch'](handleError(_0x1430d1,null,_0x4214('0x52')));}; \ No newline at end of file +var _0xf1b3=['socket.io-emitter','./voiceQueueReport.socket','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','map','VoiceQueueReport','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','catch','create','body','params','find','describe','getVoiceQueuesReport','keys','html-pdf','eml-format','zip-dir','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost'];(function(_0x1a62c0,_0x56b952){var _0x4d1015=function(_0x1556bb){while(--_0x1556bb){_0x1a62c0['push'](_0x1a62c0['shift']());}};_0x4d1015(++_0x56b952);}(_0xf1b3,0x122));var _0x3f1b=function(_0x1a1cf5,_0x143c7f){_0x1a1cf5=_0x1a1cf5-0x0;var _0xff6b62=_0xf1b3[_0x1a1cf5];return _0xff6b62;};'use strict';var pdf=require(_0x3f1b('0x0'));var emlformat=require(_0x3f1b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3f1b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f1b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3f1b('0x4'));var util=require(_0x3f1b('0x5'));var path=require('path');var sox=require(_0x3f1b('0x6'));var csv=require(_0x3f1b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f1b('0x8'));var _=require(_0x3f1b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3f1b('0xa'));var deskjs=require(_0x3f1b('0xb'));var toCsv=require(_0x3f1b('0x7'));var querystring=require(_0x3f1b('0xc'));var Papa=require(_0x3f1b('0xd'));var Redis=require('ioredis');var authService=require(_0x3f1b('0xe'));var qs=require(_0x3f1b('0xf'));var as=require(_0x3f1b('0x10'));var hardwareService=require(_0x3f1b('0x11'));var logger=require(_0x3f1b('0x12'))(_0x3f1b('0x13'));var utils=require(_0x3f1b('0x14'));var config=require(_0x3f1b('0x15'));var licenseUtil=require(_0x3f1b('0x16'));var db=require(_0x3f1b('0x17'))['db'];config[_0x3f1b('0x18')]=_['defaults'](config[_0x3f1b('0x18')],{'host':_0x3f1b('0x19'),'port':0x18eb});var socket=require(_0x3f1b('0x1a'))(new Redis(config[_0x3f1b('0x18')]));require(_0x3f1b('0x1b'))['register'](socket);function respondWithStatusCode(_0x5caffa,_0x205f92){_0x205f92=_0x205f92||0xcc;return function(_0x5cdee5){if(_0x5cdee5){return _0x5caffa['sendStatus'](_0x205f92);}return _0x5caffa[_0x3f1b('0x1c')](_0x205f92)[_0x3f1b('0x1d')]();};}function respondWithResult(_0x50b965,_0xb2a743){_0xb2a743=_0xb2a743||0xc8;return function(_0x49ce97){if(_0x49ce97){return _0x50b965[_0x3f1b('0x1c')](_0xb2a743)[_0x3f1b('0x1e')](_0x49ce97);}};}function respondWithFilteredResult(_0x400ceb,_0x25cd7d){return function(_0x4e71b4){if(_0x4e71b4){var _0x240fa2=_0x4e71b4[_0x3f1b('0x1f')],_0x112a04=_0x25cd7d[_0x3f1b('0x20')],_0x5f5a8f=_0x25cd7d[_0x3f1b('0x20')]+_0x25cd7d[_0x3f1b('0x21')],_0x1ae6d9;if(_0x5f5a8f>=_0x240fa2){_0x5f5a8f=_0x240fa2;_0x1ae6d9=0xc8;}else{_0x1ae6d9=0xce;}_0x400ceb['status'](_0x1ae6d9);return _0x400ceb[_0x3f1b('0x22')](_0x3f1b('0x23'),_0x112a04+'-'+_0x5f5a8f+'/'+_0x240fa2)[_0x3f1b('0x1e')](_0x4e71b4);}return null;};}function patchUpdates(_0x7893dc){return function(_0x2003cc){try{jsonpatch[_0x3f1b('0x24')](_0x2003cc,_0x7893dc,!![]);}catch(_0x39897c){return BPromise[_0x3f1b('0x25')](_0x39897c);}return _0x2003cc['save']();};}function saveUpdates(_0x4619e1,_0xbdaa15){return function(_0x1cf236){if(_0x1cf236){return _0x1cf236[_0x3f1b('0x26')](_0x4619e1)['then'](function(_0x30034a){return _0x30034a;});}return null;};}function removeEntity(_0x572ca0,_0x56d788){return function(_0x299fd4){if(_0x299fd4){return _0x299fd4[_0x3f1b('0x27')]()[_0x3f1b('0x28')](function(){_0x572ca0[_0x3f1b('0x1c')](0xcc)[_0x3f1b('0x1d')]();});}};}function handleEntityNotFound(_0x11c541,_0x2fe1a0){return function(_0x3f5020){if(!_0x3f5020){_0x11c541[_0x3f1b('0x29')](0x194);}return _0x3f5020;};}function handleError(_0x1f93b4,_0x4c2f23){_0x4c2f23=_0x4c2f23||0x1f4;return function(_0xa5c291){logger['error'](_0xa5c291[_0x3f1b('0x2a')]);if(_0xa5c291['name']){delete _0xa5c291[_0x3f1b('0x2b')];}_0x1f93b4[_0x3f1b('0x1c')](_0x4c2f23)['send'](_0xa5c291);};}exports['index']=function(_0x272ee9,_0x12c4fb){var _0x1b90cd={},_0x57b419={},_0x106f65={'count':0x0,'rows':[]};var _0x2b9953=_[_0x3f1b('0x2c')](db[_0x3f1b('0x2d')]['rawAttributes'],function(_0x38b8bb){return{'name':_0x38b8bb[_0x3f1b('0x2e')],'type':_0x38b8bb['type'][_0x3f1b('0x2f')]};});_0x57b419[_0x3f1b('0x30')]=_['map'](_0x2b9953,'name');_0x57b419['query']=_['keys'](_0x272ee9[_0x3f1b('0x31')]);_0x57b419[_0x3f1b('0x32')]=_[_0x3f1b('0x33')](_0x57b419['model'],_0x57b419[_0x3f1b('0x31')]);_0x1b90cd[_0x3f1b('0x34')]=_[_0x3f1b('0x33')](_0x57b419['model'],qs[_0x3f1b('0x35')](_0x272ee9[_0x3f1b('0x31')]['fields']));_0x1b90cd[_0x3f1b('0x34')]=_0x1b90cd['attributes'][_0x3f1b('0x36')]?_0x1b90cd['attributes']:_0x57b419[_0x3f1b('0x30')];if(!_0x272ee9['query'][_0x3f1b('0x37')]('nolimit')){_0x1b90cd[_0x3f1b('0x21')]=qs[_0x3f1b('0x21')](_0x272ee9[_0x3f1b('0x31')][_0x3f1b('0x21')]);_0x1b90cd[_0x3f1b('0x20')]=qs[_0x3f1b('0x20')](_0x272ee9[_0x3f1b('0x31')][_0x3f1b('0x20')]);}_0x1b90cd[_0x3f1b('0x38')]=qs[_0x3f1b('0x39')](_0x272ee9[_0x3f1b('0x31')]['sort']);_0x1b90cd['where']=qs[_0x3f1b('0x32')](_[_0x3f1b('0x3a')](_0x272ee9[_0x3f1b('0x31')],_0x57b419[_0x3f1b('0x32')]),_0x2b9953);if(_0x272ee9['query'][_0x3f1b('0x3b')]){_0x1b90cd[_0x3f1b('0x3c')]=_[_0x3f1b('0x3d')](_0x1b90cd[_0x3f1b('0x3c')],{'$or':_['map'](_0x2b9953,function(_0x2ccbbe){if(_0x2ccbbe[_0x3f1b('0x3e')]!==_0x3f1b('0x3f')){var _0x5ccf6f={};_0x5ccf6f[_0x2ccbbe[_0x3f1b('0x2b')]]={'$like':'%'+_0x272ee9['query'][_0x3f1b('0x3b')]+'%'};return _0x5ccf6f;}})});}_0x1b90cd=_[_0x3f1b('0x3d')]({},_0x1b90cd,_0x272ee9[_0x3f1b('0x40')]);var _0x42826c={'where':_0x1b90cd[_0x3f1b('0x3c')]};return db[_0x3f1b('0x2d')][_0x3f1b('0x1f')](_0x42826c)[_0x3f1b('0x28')](function(_0x17f5d8){_0x106f65['count']=_0x17f5d8;if(_0x272ee9[_0x3f1b('0x31')][_0x3f1b('0x41')]){_0x1b90cd[_0x3f1b('0x42')]=[{'all':!![]}];}return db[_0x3f1b('0x2d')][_0x3f1b('0x43')](_0x1b90cd);})['then'](function(_0x15a89b){_0x106f65[_0x3f1b('0x44')]=_0x15a89b;return _0x106f65;})[_0x3f1b('0x28')](respondWithFilteredResult(_0x12c4fb,_0x1b90cd))['catch'](handleError(_0x12c4fb,null));};exports[_0x3f1b('0x45')]=function(_0x3c2c13,_0x68a763){var _0x24aae7={'raw':![],'where':{'id':_0x3c2c13['params']['id']}},_0x7db50a={};_0x7db50a[_0x3f1b('0x30')]=_['keys'](db['VoiceQueueReport'][_0x3f1b('0x46')]);_0x7db50a['query']=_['keys'](_0x3c2c13[_0x3f1b('0x31')]);_0x7db50a[_0x3f1b('0x32')]=_[_0x3f1b('0x33')](_0x7db50a['model'],_0x7db50a[_0x3f1b('0x31')]);_0x24aae7[_0x3f1b('0x34')]=_[_0x3f1b('0x33')](_0x7db50a['model'],qs[_0x3f1b('0x35')](_0x3c2c13[_0x3f1b('0x31')][_0x3f1b('0x35')]));_0x24aae7['attributes']=_0x24aae7[_0x3f1b('0x34')][_0x3f1b('0x36')]?_0x24aae7[_0x3f1b('0x34')]:_0x7db50a[_0x3f1b('0x30')];if(_0x3c2c13[_0x3f1b('0x31')][_0x3f1b('0x41')]){_0x24aae7['include']=[{'all':!![]}];}_0x24aae7=_[_0x3f1b('0x3d')]({},_0x24aae7,_0x3c2c13['options']);return db[_0x3f1b('0x2d')]['find'](_0x24aae7)['then'](handleEntityNotFound(_0x68a763,null))[_0x3f1b('0x28')](respondWithResult(_0x68a763,null))[_0x3f1b('0x47')](handleError(_0x68a763,null));};exports[_0x3f1b('0x48')]=function(_0x3480f3,_0x28283c){return db[_0x3f1b('0x2d')]['create'](_0x3480f3[_0x3f1b('0x49')],{})[_0x3f1b('0x28')](respondWithResult(_0x28283c,0xc9))[_0x3f1b('0x47')](handleError(_0x28283c,null));};exports[_0x3f1b('0x26')]=function(_0x23f77e,_0x4bf07e){if(_0x23f77e[_0x3f1b('0x49')]['id']){delete _0x23f77e[_0x3f1b('0x49')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x23f77e[_0x3f1b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4bf07e,null))[_0x3f1b('0x28')](saveUpdates(_0x23f77e[_0x3f1b('0x49')],null))[_0x3f1b('0x28')](respondWithResult(_0x4bf07e,null))[_0x3f1b('0x47')](handleError(_0x4bf07e,null));};exports[_0x3f1b('0x27')]=function(_0x29864e,_0x20c43a){return db['VoiceQueueReport'][_0x3f1b('0x4b')]({'where':{'id':_0x29864e['params']['id']}})['then'](handleEntityNotFound(_0x20c43a,null))[_0x3f1b('0x28')](removeEntity(_0x20c43a,null))['catch'](handleError(_0x20c43a,null));};exports[_0x3f1b('0x4c')]=function(_0x7ac0b5,_0x57d265){return db[_0x3f1b('0x2d')][_0x3f1b('0x4c')]()[_0x3f1b('0x28')](respondWithResult(_0x57d265,null))['catch'](handleError(_0x57d265,null));};exports[_0x3f1b('0x4d')]=function(_0x3762b8,_0x30aa83){var _0x776e50={},_0x2a56bd={},_0x38ad46={'count':0x0,'rows':[]};_0x2a56bd[_0x3f1b('0x30')]=_[_0x3f1b('0x4e')](db[_0x3f1b('0x2d')][_0x3f1b('0x46')]);_0x2a56bd['query']=_['keys'](_0x3762b8[_0x3f1b('0x31')]);_0x2a56bd['filters']=_['intersection'](_0x2a56bd[_0x3f1b('0x30')],_0x2a56bd['query']);_0x776e50[_0x3f1b('0x34')]=_[_0x3f1b('0x33')](_0x2a56bd[_0x3f1b('0x30')],qs[_0x3f1b('0x35')](_0x3762b8[_0x3f1b('0x31')]['fields']));_0x776e50[_0x3f1b('0x34')]=_0x776e50[_0x3f1b('0x34')][_0x3f1b('0x36')]?_0x776e50[_0x3f1b('0x34')]:_0x2a56bd[_0x3f1b('0x30')];if(!_0x3762b8[_0x3f1b('0x31')][_0x3f1b('0x37')]('nolimit')){_0x776e50[_0x3f1b('0x21')]=qs[_0x3f1b('0x21')](_0x3762b8[_0x3f1b('0x31')][_0x3f1b('0x21')]);_0x776e50['offset']=qs[_0x3f1b('0x20')](_0x3762b8[_0x3f1b('0x31')][_0x3f1b('0x20')]);}_0x776e50['order']=qs[_0x3f1b('0x39')](_0x3762b8['query'][_0x3f1b('0x39')]);_0x776e50['where']=qs[_0x3f1b('0x32')](_[_0x3f1b('0x3a')](_0x3762b8[_0x3f1b('0x31')],_0x2a56bd[_0x3f1b('0x32')]));if(_0x3762b8[_0x3f1b('0x31')][_0x3f1b('0x3b')]){_0x776e50['where']=_[_0x3f1b('0x3d')](_0x776e50[_0x3f1b('0x3c')],{'$or':_[_0x3f1b('0x2c')](_0x776e50[_0x3f1b('0x34')],function(_0x47ee55){var _0x24ea7e={};_0x24ea7e[_0x47ee55]={'$like':'%'+_0x3762b8['query'][_0x3f1b('0x3b')]+'%'};return _0x24ea7e;})});}_0x776e50=_['merge']({},_0x776e50,_0x3762b8[_0x3f1b('0x40')]);var _0x221688={'where':_0x776e50[_0x3f1b('0x3c')]};return db[_0x3f1b('0x2d')]['count'](_0x221688)['then'](function(_0x1ee2f4){_0x38ad46[_0x3f1b('0x1f')]=_0x1ee2f4;if(_0x3762b8[_0x3f1b('0x31')][_0x3f1b('0x41')]){_0x776e50['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x3f1b('0x43')](_0x776e50);})[_0x3f1b('0x28')](function(_0x448a3c){_0x38ad46[_0x3f1b('0x44')]=_0x448a3c;return _0x38ad46;})[_0x3f1b('0x28')](respondWithFilteredResult(_0x30aa83,_0x776e50,'getVoiceQueuesReport'))['catch'](handleError(_0x30aa83,null,_0x3f1b('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 44ea3de..8e79941 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 _0x99ab=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x6913dd,_0x534d40){var _0x1a5b51=function(_0x4628b0){while(--_0x4628b0){_0x6913dd['push'](_0x6913dd['shift']());}};_0x1a5b51(++_0x534d40);}(_0x99ab,0xce));var _0xb99a=function(_0x3fedb4,_0x4f4444){_0x3fedb4=_0x3fedb4-0x0;var _0xf8b98c=_0x99ab[_0x3fedb4];return _0xf8b98c;};'use strict';var EventEmitter=require(_0xb99a('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xb99a('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xb99a('0x2')](0x0);var events={'afterCreate':_0xb99a('0x3'),'afterUpdate':_0xb99a('0x4'),'afterDestroy':_0xb99a('0x5')};function emitEvent(_0x371067){return function(_0x1d62c9,_0x4e31aa,_0x17c76a){VoiceQueueReportEvents[_0xb99a('0x6')](_0x371067+':'+_0x1d62c9['id'],_0x1d62c9);VoiceQueueReportEvents[_0xb99a('0x6')](_0x371067,_0x1d62c9);_0x17c76a(null);};}for(var e in events){if(events[_0xb99a('0x7')](e)){var event=events[e];VoiceQueueReport[_0xb99a('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x546b=['hasOwnProperty','hook','events','VoiceQueueReport','setMaxListeners','save','remove','emit'];(function(_0x136fc4,_0x161a11){var _0xe53aa8=function(_0x5cb06a){while(--_0x5cb06a){_0x136fc4['push'](_0x136fc4['shift']());}};_0xe53aa8(++_0x161a11);}(_0x546b,0x17a));var _0xb546=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x546b[_0x1e6db3];return _0x1de886;};'use strict';var EventEmitter=require(_0xb546('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xb546('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xb546('0x2')](0x0);var events={'afterCreate':_0xb546('0x3'),'afterUpdate':'update','afterDestroy':_0xb546('0x4')};function emitEvent(_0xc65f53){return function(_0x285467,_0xa510bf,_0x1a71fe){VoiceQueueReportEvents[_0xb546('0x5')](_0xc65f53+':'+_0x285467['id'],_0x285467);VoiceQueueReportEvents[_0xb546('0x5')](_0xc65f53,_0x285467);_0x1a71fe(null);};}for(var e in events){if(events[_0xb546('0x6')](e)){var event=events[e];VoiceQueueReport[_0xb546('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index d605dd2..3851b63 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 _0x5f66=['request-promise','path','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird'];(function(_0x34efe3,_0x1e549c){var _0x569ec1=function(_0x938fec){while(--_0x938fec){_0x34efe3['push'](_0x34efe3['shift']());}};_0x569ec1(++_0x1e549c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'fields':[_0x65f6('0xa')]},{'fields':[_0x65f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0xd7a666,_0x55ba51){var _0x8fb6eb=function(_0xcb77d4){while(--_0xcb77d4){_0xd7a666['push'](_0xd7a666['shift']());}};_0x8fb6eb(++_0x55ba51);}(_0x757a,0xde));var _0xa757=function(_0x1371eb,_0x4b5b22){_0x1371eb=_0x1371eb-0x0;var _0x177fad=_0x757a[_0x1371eb];return _0x177fad;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('VoiceQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa757('0xa')]},{'fields':[_0xa757('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index f79843e..f6e5b5c 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 _0x7bf2=['CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x5a09f3,_0x9ce907){var _0x3665c2=function(_0x3a8581){while(--_0x3a8581){_0x5a09f3['push'](_0x5a09f3['shift']());}};_0x3665c2(++_0x9ce907);}(_0x7bf2,0xe0));var _0x27bf=function(_0x394228,_0x94be60){_0x394228=_0x394228-0x0;var _0x790c28=_0x7bf2[_0x394228];return _0x790c28;};'use strict';var _=require(_0x27bf('0x0'));var util=require(_0x27bf('0x1'));var moment=require(_0x27bf('0x2'));var BPromise=require(_0x27bf('0x3'));var rs=require(_0x27bf('0x4'));var fs=require('fs');var Redis=require(_0x27bf('0x5'));var db=require(_0x27bf('0x6'))['db'];var utils=require(_0x27bf('0x7'));var logger=require(_0x27bf('0x8'))(_0x27bf('0x9'));var config=require(_0x27bf('0xa'));var jayson=require(_0x27bf('0xb'));var client=jayson['client'][_0x27bf('0xc')]({'port':0x232a});config['redis']=_[_0x27bf('0xd')](config[_0x27bf('0xe')],{'host':_0x27bf('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x27bf('0xe')]));require('./voiceQueueReport.socket')[_0x27bf('0x10')](socket);function respondWithRpcPromise(_0x5a89cc,_0x49d8c0,_0x36be09){return new BPromise(function(_0x3801bc,_0x508e92){return client[_0x27bf('0x11')](_0x5a89cc,_0x36be09)[_0x27bf('0x12')](function(_0x5a6aed){logger['info'](_0x27bf('0x13'),_0x49d8c0,_0x27bf('0x14'));logger[_0x27bf('0x15')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x49d8c0,_0x27bf('0x14'),JSON[_0x27bf('0x16')](_0x5a6aed));if(_0x5a6aed[_0x27bf('0x17')]){if(_0x5a6aed[_0x27bf('0x17')][_0x27bf('0x18')]===0x1f4){logger[_0x27bf('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x49d8c0,_0x5a6aed[_0x27bf('0x17')][_0x27bf('0x19')]);return _0x508e92(_0x5a6aed[_0x27bf('0x17')][_0x27bf('0x19')]);}logger[_0x27bf('0x17')](_0x27bf('0x13'),_0x49d8c0,_0x5a6aed[_0x27bf('0x17')][_0x27bf('0x19')]);return _0x3801bc(_0x5a6aed[_0x27bf('0x17')][_0x27bf('0x19')]);}else{logger[_0x27bf('0x1a')](_0x27bf('0x13'),_0x49d8c0,_0x27bf('0x14'));_0x3801bc(_0x5a6aed[_0x27bf('0x1b')]['message']);}})[_0x27bf('0x1c')](function(_0x3ea35a){logger[_0x27bf('0x17')](_0x27bf('0x13'),_0x49d8c0,_0x3ea35a);_0x508e92(_0x3ea35a);});});}exports[_0x27bf('0x1d')]=function(_0xff6170){var _0x3589b0=this;return new Promise(function(_0x14c52e,_0x52f280){return db[_0x27bf('0x1e')][_0x27bf('0x1f')]({'raw':_0xff6170[_0x27bf('0x20')]?_0xff6170['options'][_0x27bf('0x21')]===undefined?!![]:![]:!![],'where':_0xff6170['options']?_0xff6170[_0x27bf('0x20')][_0x27bf('0x22')]||null:null,'attributes':_0xff6170['options']?_0xff6170[_0x27bf('0x20')]['attributes']||null:null,'limit':_0xff6170[_0x27bf('0x20')]?_0xff6170[_0x27bf('0x20')][_0x27bf('0x23')]||null:null,'include':_0xff6170[_0x27bf('0x20')]?_0xff6170[_0x27bf('0x20')][_0x27bf('0x24')]?_[_0x27bf('0x25')](_0xff6170[_0x27bf('0x20')][_0x27bf('0x24')],function(_0x34a7b3){return{'model':db[_0x34a7b3[_0x27bf('0x26')]],'as':_0x34a7b3['as'],'attributes':_0x34a7b3[_0x27bf('0x27')],'include':_0x34a7b3[_0x27bf('0x24')]?_[_0x27bf('0x25')](_0x34a7b3[_0x27bf('0x24')],function(_0x404100){return{'model':db[_0x404100[_0x27bf('0x26')]],'as':_0x404100['as'],'attributes':_0x404100[_0x27bf('0x27')],'include':_0x404100['include']?_[_0x27bf('0x25')](_0x404100[_0x27bf('0x24')],function(_0xbbb8f2){return{'model':db[_0xbbb8f2[_0x27bf('0x26')]],'as':_0xbbb8f2['as'],'attributes':_0xbbb8f2['attributes']};}):[]};}):[]};}):[]:[]})[_0x27bf('0x12')](function(_0x1f9c75){logger[_0x27bf('0x1a')]('GetVoiceQueueReport',_0xff6170);logger[_0x27bf('0x15')](_0x27bf('0x1d'),_0xff6170,JSON[_0x27bf('0x16')](_0x1f9c75));_0x14c52e(_0x1f9c75);})[_0x27bf('0x1c')](function(_0x55707c){logger['error'](_0x27bf('0x1d'),_0x55707c['message'],_0xff6170);_0x52f280(_0x3589b0[_0x27bf('0x17')](0x1f4,_0x55707c['message']));});});};exports[_0x27bf('0x28')]=function(_0x12d140){var _0x9f175c=this;return new Promise(function(_0x3ab59e,_0x2b496b){return db[_0x27bf('0x1e')][_0x27bf('0x29')](_0x12d140[_0x27bf('0x2a')],{'raw':_0x12d140[_0x27bf('0x20')]?_0x12d140[_0x27bf('0x20')][_0x27bf('0x21')]===undefined?!![]:![]:!![]})[_0x27bf('0x12')](function(_0x27c89b){logger[_0x27bf('0x1a')](_0x27bf('0x28'),_0x12d140);logger[_0x27bf('0x15')]('CreateVoiceQueueReport',_0x12d140,JSON[_0x27bf('0x16')](_0x27c89b));_0x3ab59e(_0x27c89b);})[_0x27bf('0x1c')](function(_0x3f65cb){logger[_0x27bf('0x17')](_0x27bf('0x28'),_0x3f65cb['message'],_0x12d140);_0x2b496b(_0x9f175c[_0x27bf('0x17')](0x1f4,_0x3f65cb[_0x27bf('0x19')]));});});};exports[_0x27bf('0x2b')]=function(_0x380d7c){var _0xc690ab=this;return new Promise(function(_0x2e9464,_0x279a86){return db[_0x27bf('0x1e')]['update'](_0x380d7c[_0x27bf('0x2a')],{'raw':_0x380d7c[_0x27bf('0x20')]?_0x380d7c['options'][_0x27bf('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x380d7c[_0x27bf('0x20')]?_0x380d7c[_0x27bf('0x20')]['where']||null:null,'attributes':_0x380d7c['options']?_0x380d7c['options'][_0x27bf('0x27')]||null:null,'limit':_0x380d7c[_0x27bf('0x20')]?_0x380d7c[_0x27bf('0x20')][_0x27bf('0x23')]||null:null})[_0x27bf('0x12')](function(_0x3ea1a1){logger['info'](_0x27bf('0x2b'),_0x380d7c);logger[_0x27bf('0x15')](_0x27bf('0x2b'),_0x380d7c,JSON['stringify'](_0x3ea1a1));_0x2e9464(_0x3ea1a1);})[_0x27bf('0x1c')](function(_0x533fde){logger[_0x27bf('0x17')](_0x27bf('0x2b'),_0x533fde[_0x27bf('0x19')],_0x380d7c);_0x279a86(_0xc690ab['error'](0x1f4,_0x533fde[_0x27bf('0x19')]));});});}; \ No newline at end of file +var _0x4539=['map','model','stringify','catch','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./voiceQueueReport.socket','register','then','info','request\x20sent','debug','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include'];(function(_0x5788fb,_0x41cb52){var _0x19a3f0=function(_0xbcbcf6){while(--_0xbcbcf6){_0x5788fb['push'](_0x5788fb['shift']());}};_0x19a3f0(++_0x41cb52);}(_0x4539,0xf1));var _0x9453=function(_0xb7ccd9,_0xfd15fa){_0xb7ccd9=_0xb7ccd9-0x0;var _0x5bb298=_0x4539[_0xb7ccd9];return _0x5bb298;};'use strict';var _=require(_0x9453('0x0'));var util=require(_0x9453('0x1'));var moment=require(_0x9453('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9453('0x3'));var db=require(_0x9453('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9453('0x5'))(_0x9453('0x6'));var config=require(_0x9453('0x7'));var jayson=require(_0x9453('0x8'));var client=jayson[_0x9453('0x9')][_0x9453('0xa')]({'port':0x232a});config[_0x9453('0xb')]=_['defaults'](config['redis'],{'host':_0x9453('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9453('0xb')]));require(_0x9453('0xd'))[_0x9453('0xe')](socket);function respondWithRpcPromise(_0xe26dfb,_0x1b75e0,_0x26e674){return new BPromise(function(_0x2aaa18,_0x496a86){return client['request'](_0xe26dfb,_0x26e674)[_0x9453('0xf')](function(_0x1a6614){logger[_0x9453('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x1b75e0,_0x9453('0x11'));logger[_0x9453('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x1b75e0,_0x9453('0x11'),JSON['stringify'](_0x1a6614));if(_0x1a6614[_0x9453('0x13')]){if(_0x1a6614['error'][_0x9453('0x14')]===0x1f4){logger['error'](_0x9453('0x15'),_0x1b75e0,_0x1a6614[_0x9453('0x13')][_0x9453('0x16')]);return _0x496a86(_0x1a6614[_0x9453('0x13')][_0x9453('0x16')]);}logger[_0x9453('0x13')](_0x9453('0x15'),_0x1b75e0,_0x1a6614['error'][_0x9453('0x16')]);return _0x2aaa18(_0x1a6614[_0x9453('0x13')]['message']);}else{logger['info'](_0x9453('0x15'),_0x1b75e0,_0x9453('0x11'));_0x2aaa18(_0x1a6614[_0x9453('0x17')][_0x9453('0x16')]);}})['catch'](function(_0x5d7003){logger['error'](_0x9453('0x15'),_0x1b75e0,_0x5d7003);_0x496a86(_0x5d7003);});});}exports[_0x9453('0x18')]=function(_0x12f7e6){var _0x115cf9=this;return new Promise(function(_0x329388,_0x1735cb){return db[_0x9453('0x19')][_0x9453('0x1a')]({'raw':_0x12f7e6[_0x9453('0x1b')]?_0x12f7e6['options'][_0x9453('0x1c')]===undefined?!![]:![]:!![],'where':_0x12f7e6[_0x9453('0x1b')]?_0x12f7e6['options'][_0x9453('0x1d')]||null:null,'attributes':_0x12f7e6[_0x9453('0x1b')]?_0x12f7e6[_0x9453('0x1b')][_0x9453('0x1e')]||null:null,'limit':_0x12f7e6[_0x9453('0x1b')]?_0x12f7e6[_0x9453('0x1b')]['limit']||null:null,'include':_0x12f7e6[_0x9453('0x1b')]?_0x12f7e6['options'][_0x9453('0x1f')]?_[_0x9453('0x20')](_0x12f7e6[_0x9453('0x1b')][_0x9453('0x1f')],function(_0x59c296){return{'model':db[_0x59c296[_0x9453('0x21')]],'as':_0x59c296['as'],'attributes':_0x59c296[_0x9453('0x1e')],'include':_0x59c296[_0x9453('0x1f')]?_[_0x9453('0x20')](_0x59c296[_0x9453('0x1f')],function(_0x4994c1){return{'model':db[_0x4994c1[_0x9453('0x21')]],'as':_0x4994c1['as'],'attributes':_0x4994c1[_0x9453('0x1e')],'include':_0x4994c1['include']?_[_0x9453('0x20')](_0x4994c1[_0x9453('0x1f')],function(_0x4028f7){return{'model':db[_0x4028f7['model']],'as':_0x4028f7['as'],'attributes':_0x4028f7[_0x9453('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ad411){logger[_0x9453('0x10')](_0x9453('0x18'),_0x12f7e6);logger[_0x9453('0x12')](_0x9453('0x18'),_0x12f7e6,JSON[_0x9453('0x22')](_0x5ad411));_0x329388(_0x5ad411);})[_0x9453('0x23')](function(_0x5a7bae){logger[_0x9453('0x13')](_0x9453('0x18'),_0x5a7bae['message'],_0x12f7e6);_0x1735cb(_0x115cf9[_0x9453('0x13')](0x1f4,_0x5a7bae[_0x9453('0x16')]));});});};exports[_0x9453('0x24')]=function(_0x22a5c3){var _0x2a4169=this;return new Promise(function(_0x5e9cfd,_0x5bb4b2){return db['VoiceQueueReport']['create'](_0x22a5c3[_0x9453('0x25')],{'raw':_0x22a5c3[_0x9453('0x1b')]?_0x22a5c3[_0x9453('0x1b')][_0x9453('0x1c')]===undefined?!![]:![]:!![]})[_0x9453('0xf')](function(_0x193597){logger[_0x9453('0x10')]('CreateVoiceQueueReport',_0x22a5c3);logger['debug']('CreateVoiceQueueReport',_0x22a5c3,JSON['stringify'](_0x193597));_0x5e9cfd(_0x193597);})[_0x9453('0x23')](function(_0x358aaa){logger[_0x9453('0x13')](_0x9453('0x24'),_0x358aaa['message'],_0x22a5c3);_0x5bb4b2(_0x2a4169[_0x9453('0x13')](0x1f4,_0x358aaa[_0x9453('0x16')]));});});};exports[_0x9453('0x26')]=function(_0x237a26){var _0x11dbff=this;return new Promise(function(_0x51bedd,_0x341b04){return db[_0x9453('0x19')]['update'](_0x237a26[_0x9453('0x25')],{'raw':_0x237a26[_0x9453('0x1b')]?_0x237a26[_0x9453('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x237a26['options']?_0x237a26['options'][_0x9453('0x1d')]||null:null,'attributes':_0x237a26['options']?_0x237a26[_0x9453('0x1b')][_0x9453('0x1e')]||null:null,'limit':_0x237a26[_0x9453('0x1b')]?_0x237a26[_0x9453('0x1b')]['limit']||null:null})[_0x9453('0xf')](function(_0x390064){logger[_0x9453('0x10')](_0x9453('0x26'),_0x237a26);logger['debug'](_0x9453('0x26'),_0x237a26,JSON[_0x9453('0x22')](_0x390064));_0x51bedd(_0x390064);})[_0x9453('0x23')](function(_0x38d3c7){logger[_0x9453('0x13')](_0x9453('0x26'),_0x38d3c7[_0x9453('0x16')],_0x237a26);_0x341b04(_0x11dbff['error'](0x1f4,_0x38d3c7[_0x9453('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 9ee05df..355f60f 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 _0x83b9=['voiceQueueReport:','remove','update','emit','register','length'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x83b9,0x121));var _0x983b=function(_0xd3444a,_0x411635){_0xd3444a=_0xd3444a-0x0;var _0x11052a=_0x83b9[_0xd3444a];return _0x11052a;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0x983b('0x0'),_0x983b('0x1')];function createListener(_0x50f1c5,_0x3aa438){return function(_0x2f2d98){_0x3aa438[_0x983b('0x2')](_0x50f1c5,_0x2f2d98);};}function removeListener(_0x5ac243,_0x1eacf1){return function(){VoiceQueueReportEvents['removeListener'](_0x5ac243,_0x1eacf1);};}exports[_0x983b('0x3')]=function(_0xc0966e){for(var _0x14f77d=0x0,_0x197e1a=events[_0x983b('0x4')];_0x14f77d<_0x197e1a;_0x14f77d++){var _0x862d01=events[_0x14f77d];var _0x1dad47=createListener(_0x983b('0x5')+_0x862d01,_0xc0966e);VoiceQueueReportEvents['on'](_0x862d01,_0x1dad47);}}; \ No newline at end of file +var _0xbd49=['save','remove','update','removeListener','register','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbd49,0x141));var _0x9bd4=function(_0x4d2a53,_0x3f8337){_0x4d2a53=_0x4d2a53-0x0;var _0x535517=_0xbd49[_0x4d2a53];return _0x535517;};'use strict';var VoiceQueueReportEvents=require(_0x9bd4('0x0'));var events=[_0x9bd4('0x1'),_0x9bd4('0x2'),_0x9bd4('0x3')];function createListener(_0x2b3acc,_0x582e8f){return function(_0x463377){_0x582e8f['emit'](_0x2b3acc,_0x463377);};}function removeListener(_0x559e54,_0xb8ca6a){return function(){VoiceQueueReportEvents[_0x9bd4('0x4')](_0x559e54,_0xb8ca6a);};}exports[_0x9bd4('0x5')]=function(_0x11f2b9){for(var _0x521d4f=0x0,_0x1c6795=events['length'];_0x521d4f<_0x1c6795;_0x521d4f++){var _0x733f5e=events[_0x521d4f];var _0x1cf000=createListener(_0x9bd4('0x6')+_0x733f5e,_0x11f2b9);VoiceQueueReportEvents['on'](_0x733f5e,_0x1cf000);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 867af56..08b3e5c 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 _0x3714=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0xb82b6f,_0x4ac6ff){var _0x5f0341=function(_0x3e84ac){while(--_0x3e84ac){_0xb82b6f['push'](_0xb82b6f['shift']());}};_0x5f0341(++_0x4ac6ff);}(_0x3714,0x95));var _0x4371=function(_0x512faa,_0x4cc8d0){_0x512faa=_0x512faa-0x0;var _0x4dcfe2=_0x3714[_0x512faa];return _0x4dcfe2;};'use strict';var multer=require(_0x4371('0x0'));var util=require(_0x4371('0x1'));var path=require('path');var timeout=require(_0x4371('0x2'));var express=require(_0x4371('0x3'));var router=express[_0x4371('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4371('0x5'));var interaction=require(_0x4371('0x6'));var config=require(_0x4371('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x4371('0x8')]('/',auth['isAuthenticated'](),controller[_0x4371('0x9')]);router[_0x4371('0x8')]('/:id',auth[_0x4371('0xa')](),controller[_0x4371('0xb')]);router[_0x4371('0xc')]('/',auth[_0x4371('0xa')](),controller['create']);router[_0x4371('0xd')]('/:id',auth[_0x4371('0xa')](),controller[_0x4371('0xe')]);router[_0x4371('0xf')](_0x4371('0x10'),auth['isAuthenticated'](),controller[_0x4371('0x11')]);module[_0x4371('0x12')]=router; \ No newline at end of file +var _0xce68=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','show','post','put','/:id','update','delete'];(function(_0x2376c6,_0x4dc112){var _0x433bb0=function(_0xa01ff9){while(--_0xa01ff9){_0x2376c6['push'](_0x2376c6['shift']());}};_0x433bb0(++_0x4dc112);}(_0xce68,0x10c));var _0x8ce6=function(_0x3b6565,_0x20f53d){_0x3b6565=_0x3b6565-0x0;var _0x2871b3=_0xce68[_0x3b6565];return _0x2871b3;};'use strict';var multer=require(_0x8ce6('0x0'));var util=require('util');var path=require(_0x8ce6('0x1'));var timeout=require(_0x8ce6('0x2'));var express=require(_0x8ce6('0x3'));var router=express[_0x8ce6('0x4')]();var fs_extra=require(_0x8ce6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8ce6('0x6'));var config=require(_0x8ce6('0x7'));var controller=require(_0x8ce6('0x8'));router['get']('/',auth[_0x8ce6('0x9')](),controller[_0x8ce6('0xa')]);router['get']('/:id',auth[_0x8ce6('0x9')](),controller[_0x8ce6('0xb')]);router[_0x8ce6('0xc')]('/',auth[_0x8ce6('0x9')](),controller['create']);router[_0x8ce6('0xd')](_0x8ce6('0xe'),auth[_0x8ce6('0x9')](),controller[_0x8ce6('0xf')]);router[_0x8ce6('0x10')](_0x8ce6('0xe'),auth[_0x8ce6('0x9')](),controller[_0x8ce6('0x11')]);module[_0x8ce6('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 911e16c..0d1ebc1 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 _0x6cc0=['exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x7cfe89,_0x1bb2df){var _0xc29c92=function(_0x2efc88){while(--_0x2efc88){_0x7cfe89['push'](_0x7cfe89['shift']());}};_0xc29c92(++_0x1bb2df);}(_0x6cc0,0x87));var _0x06cc=function(_0x1c0781,_0x4a19f1){_0x1c0781=_0x1c0781-0x0;var _0x1f577e=_0x6cc0[_0x1c0781];return _0x1f577e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x06cc('0x0')]={'time':{'type':Sequelize[_0x06cc('0x1')]},'callid':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x06cc('0x2')],'allowNull':![],'defaultValue':moment()[_0x06cc('0x3')](_0x06cc('0x4'))}}; \ No newline at end of file +var _0x1d66=['DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','STRING'];(function(_0x4899ff,_0x178d7a){var _0xaa7e23=function(_0x90ca0b){while(--_0x90ca0b){_0x4899ff['push'](_0x4899ff['shift']());}};_0xaa7e23(++_0x178d7a);}(_0x1d66,0xfc));var _0x61d6=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1d66[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x61d6('0x0'));var moment=require(_0x61d6('0x1'));module['exports']={'time':{'type':Sequelize[_0x61d6('0x2')]},'callid':{'type':Sequelize[_0x61d6('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x61d6('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x61d6('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x61d6('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x61d6('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x61d6('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x61d6('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x61d6('0x3')],'allowNull':![],'defaultValue':moment()['format'](_0x61d6('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 15a1f07..71b9588 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 _0x1a2f=['end','count','offset','limit','set','json','reject','save','then','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','catch','show','fields','find','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x408d71,_0x2977cb){var _0x108cb7=function(_0x3e281a){while(--_0x3e281a){_0x408d71['push'](_0x408d71['shift']());}};_0x108cb7(++_0x2977cb);}(_0x1a2f,0x151));var _0xf1a2=function(_0x3acdab,_0x1f35ca){_0x3acdab=_0x3acdab-0x0;var _0x52666a=_0x1a2f[_0x3acdab];return _0x52666a;};'use strict';var pdf=require(_0xf1a2('0x0'));var emlformat=require(_0xf1a2('0x1'));var rimraf=require(_0xf1a2('0x2'));var zipdir=require(_0xf1a2('0x3'));var jsonpatch=require(_0xf1a2('0x4'));var rp=require('request-promise');var moment=require(_0xf1a2('0x5'));var BPromise=require(_0xf1a2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf1a2('0x7'));var sox=require(_0xf1a2('0x8'));var csv=require(_0xf1a2('0x9'));var ejs=require(_0xf1a2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf1a2('0xb'));var squel=require(_0xf1a2('0xc'));var crypto=require(_0xf1a2('0xd'));var jsforce=require(_0xf1a2('0xe'));var deskjs=require(_0xf1a2('0xf'));var toCsv=require(_0xf1a2('0x9'));var querystring=require(_0xf1a2('0x10'));var Papa=require(_0xf1a2('0x11'));var Redis=require('ioredis');var authService=require(_0xf1a2('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1a2('0x13'));var logger=require(_0xf1a2('0x14'))(_0xf1a2('0x15'));var utils=require(_0xf1a2('0x16'));var config=require(_0xf1a2('0x17'));var licenseUtil=require(_0xf1a2('0x18'));var db=require(_0xf1a2('0x19'))['db'];function respondWithStatusCode(_0xfec362,_0x4b8e2d){_0x4b8e2d=_0x4b8e2d||0xcc;return function(_0x53c808){if(_0x53c808){return _0xfec362[_0xf1a2('0x1a')](_0x4b8e2d);}return _0xfec362[_0xf1a2('0x1b')](_0x4b8e2d)[_0xf1a2('0x1c')]();};}function respondWithResult(_0xa59975,_0x4b4c0){_0x4b4c0=_0x4b4c0||0xc8;return function(_0x17445f){if(_0x17445f){return _0xa59975[_0xf1a2('0x1b')](_0x4b4c0)['json'](_0x17445f);}};}function respondWithFilteredResult(_0x5d004a,_0x12a186){return function(_0x1db5a9){if(_0x1db5a9){var _0x2657e5=_0x1db5a9[_0xf1a2('0x1d')],_0x35584c=_0x12a186[_0xf1a2('0x1e')],_0x5c50b7=_0x12a186['offset']+_0x12a186[_0xf1a2('0x1f')],_0x29a5c7;if(_0x5c50b7>=_0x2657e5){_0x5c50b7=_0x2657e5;_0x29a5c7=0xc8;}else{_0x29a5c7=0xce;}_0x5d004a[_0xf1a2('0x1b')](_0x29a5c7);return _0x5d004a[_0xf1a2('0x20')]('Content-Range',_0x35584c+'-'+_0x5c50b7+'/'+_0x2657e5)[_0xf1a2('0x21')](_0x1db5a9);}return null;};}function patchUpdates(_0x2327c0){return function(_0x42a329){try{jsonpatch['apply'](_0x42a329,_0x2327c0,!![]);}catch(_0x5cf1c5){return BPromise[_0xf1a2('0x22')](_0x5cf1c5);}return _0x42a329[_0xf1a2('0x23')]();};}function saveUpdates(_0x2ff0a2,_0x3c67ba){return function(_0x59b362){if(_0x59b362){return _0x59b362['update'](_0x2ff0a2)[_0xf1a2('0x24')](function(_0x4198aa){return _0x4198aa;});}return null;};}function removeEntity(_0xec6a28,_0x2704b3){return function(_0x82ff8){if(_0x82ff8){return _0x82ff8['destroy']()[_0xf1a2('0x24')](function(){_0xec6a28['status'](0xcc)[_0xf1a2('0x1c')]();});}};}function handleEntityNotFound(_0x49c20d,_0x221cf5){return function(_0xfc82ee){if(!_0xfc82ee){_0x49c20d['sendStatus'](0x194);}return _0xfc82ee;};}function handleError(_0x3aa2f1,_0x2033b6){_0x2033b6=_0x2033b6||0x1f4;return function(_0x12cd1d){logger[_0xf1a2('0x25')](_0x12cd1d[_0xf1a2('0x26')]);if(_0x12cd1d[_0xf1a2('0x27')]){delete _0x12cd1d['name'];}_0x3aa2f1['status'](_0x2033b6)[_0xf1a2('0x28')](_0x12cd1d);};}exports['index']=function(_0x5e990f,_0x51236a){var _0x451353={},_0x5a7f3e={},_0x346a3c={'count':0x0,'rows':[]};var _0x11f233=_[_0xf1a2('0x29')](db[_0xf1a2('0x2a')][_0xf1a2('0x2b')],function(_0x3ee8b7){return{'name':_0x3ee8b7[_0xf1a2('0x2c')],'type':_0x3ee8b7[_0xf1a2('0x2d')][_0xf1a2('0x2e')]};});_0x5a7f3e[_0xf1a2('0x2f')]=_[_0xf1a2('0x29')](_0x11f233,_0xf1a2('0x27'));_0x5a7f3e['query']=_[_0xf1a2('0x30')](_0x5e990f[_0xf1a2('0x31')]);_0x5a7f3e[_0xf1a2('0x32')]=_[_0xf1a2('0x33')](_0x5a7f3e['model'],_0x5a7f3e['query']);_0x451353[_0xf1a2('0x34')]=_['intersection'](_0x5a7f3e[_0xf1a2('0x2f')],qs['fields'](_0x5e990f[_0xf1a2('0x31')]['fields']));_0x451353[_0xf1a2('0x34')]=_0x451353[_0xf1a2('0x34')][_0xf1a2('0x35')]?_0x451353[_0xf1a2('0x34')]:_0x5a7f3e[_0xf1a2('0x2f')];if(!_0x5e990f[_0xf1a2('0x31')][_0xf1a2('0x36')](_0xf1a2('0x37'))){_0x451353['limit']=qs[_0xf1a2('0x1f')](_0x5e990f[_0xf1a2('0x31')][_0xf1a2('0x1f')]);_0x451353['offset']=qs[_0xf1a2('0x1e')](_0x5e990f['query'][_0xf1a2('0x1e')]);}_0x451353[_0xf1a2('0x38')]=qs[_0xf1a2('0x39')](_0x5e990f[_0xf1a2('0x31')]['sort']);_0x451353[_0xf1a2('0x3a')]=qs['filters'](_['pick'](_0x5e990f[_0xf1a2('0x31')],_0x5a7f3e[_0xf1a2('0x32')]),_0x11f233);if(_0x5e990f[_0xf1a2('0x31')][_0xf1a2('0x3b')]){_0x451353[_0xf1a2('0x3a')]=_['merge'](_0x451353['where'],{'$or':_[_0xf1a2('0x29')](_0x11f233,function(_0x265f15){if(_0x265f15[_0xf1a2('0x2d')]!==_0xf1a2('0x3c')){var _0x144c1f={};_0x144c1f[_0x265f15[_0xf1a2('0x27')]]={'$like':'%'+_0x5e990f[_0xf1a2('0x31')][_0xf1a2('0x3b')]+'%'};return _0x144c1f;}})});}_0x451353=_[_0xf1a2('0x3d')]({},_0x451353,_0x5e990f[_0xf1a2('0x3e')]);var _0x1c0cba={'where':_0x451353[_0xf1a2('0x3a')]};return db[_0xf1a2('0x2a')]['count'](_0x1c0cba)['then'](function(_0x3459bd){_0x346a3c[_0xf1a2('0x1d')]=_0x3459bd;if(_0x5e990f[_0xf1a2('0x31')]['includeAll']){_0x451353[_0xf1a2('0x3f')]=[{'all':!![]}];}return db[_0xf1a2('0x2a')][_0xf1a2('0x40')](_0x451353);})['then'](function(_0x4527ea){_0x346a3c['rows']=_0x4527ea;return _0x346a3c;})[_0xf1a2('0x24')](respondWithFilteredResult(_0x51236a,_0x451353))[_0xf1a2('0x41')](handleError(_0x51236a,null));};exports[_0xf1a2('0x42')]=function(_0x8ee3a3,_0x37a3f8){var _0x355dfd={'raw':!![],'where':{'id':_0x8ee3a3['params']['id']}},_0x268a91={};_0x268a91['model']=_[_0xf1a2('0x30')](db[_0xf1a2('0x2a')][_0xf1a2('0x2b')]);_0x268a91[_0xf1a2('0x31')]=_[_0xf1a2('0x30')](_0x8ee3a3[_0xf1a2('0x31')]);_0x268a91[_0xf1a2('0x32')]=_['intersection'](_0x268a91[_0xf1a2('0x2f')],_0x268a91[_0xf1a2('0x31')]);_0x355dfd['attributes']=_[_0xf1a2('0x33')](_0x268a91[_0xf1a2('0x2f')],qs[_0xf1a2('0x43')](_0x8ee3a3[_0xf1a2('0x31')][_0xf1a2('0x43')]));_0x355dfd['attributes']=_0x355dfd[_0xf1a2('0x34')][_0xf1a2('0x35')]?_0x355dfd[_0xf1a2('0x34')]:_0x268a91['model'];if(_0x8ee3a3[_0xf1a2('0x31')]['includeAll']){_0x355dfd[_0xf1a2('0x3f')]=[{'all':!![]}];}_0x355dfd=_[_0xf1a2('0x3d')]({},_0x355dfd,_0x8ee3a3[_0xf1a2('0x3e')]);return db[_0xf1a2('0x2a')][_0xf1a2('0x44')](_0x355dfd)['then'](handleEntityNotFound(_0x37a3f8,null))[_0xf1a2('0x24')](respondWithResult(_0x37a3f8,null))[_0xf1a2('0x41')](handleError(_0x37a3f8,null));};exports[_0xf1a2('0x45')]=function(_0x261dd8,_0x28bb60){return db[_0xf1a2('0x2a')][_0xf1a2('0x45')](_0x261dd8[_0xf1a2('0x46')],{})[_0xf1a2('0x24')](respondWithResult(_0x28bb60,0xc9))[_0xf1a2('0x41')](handleError(_0x28bb60,null));};exports['update']=function(_0x39f586,_0x2b3a79){if(_0x39f586[_0xf1a2('0x46')]['id']){delete _0x39f586[_0xf1a2('0x46')]['id'];}return db['VoiceQueuesLog'][_0xf1a2('0x44')]({'where':{'id':_0x39f586[_0xf1a2('0x47')]['id']}})[_0xf1a2('0x24')](handleEntityNotFound(_0x2b3a79,null))['then'](saveUpdates(_0x39f586['body'],null))[_0xf1a2('0x24')](respondWithResult(_0x2b3a79,null))[_0xf1a2('0x41')](handleError(_0x2b3a79,null));};exports[_0xf1a2('0x48')]=function(_0x4334f4,_0x3cff5e){return db[_0xf1a2('0x2a')][_0xf1a2('0x44')]({'where':{'id':_0x4334f4['params']['id']}})['then'](handleEntityNotFound(_0x3cff5e,null))[_0xf1a2('0x24')](removeEntity(_0x3cff5e,null))[_0xf1a2('0x41')](handleError(_0x3cff5e,null));}; \ No newline at end of file +var _0xbc25=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','status','sendStatus','error','stack','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','keys','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','includeAll','include','catch','intersection','length','create','body','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','fs-extra','lodash','crypto','jsforce','querystring'];(function(_0x2e115c,_0x1c9a51){var _0x562419=function(_0x50a95f){while(--_0x50a95f){_0x2e115c['push'](_0x2e115c['shift']());}};_0x562419(++_0x1c9a51);}(_0xbc25,0x81));var _0x5bc2=function(_0x38dcff,_0x129a00){_0x38dcff=_0x38dcff-0x0;var _0x17c442=_0xbc25[_0x38dcff];return _0x17c442;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5bc2('0x0'));var rimraf=require(_0x5bc2('0x1'));var zipdir=require(_0x5bc2('0x2'));var jsonpatch=require(_0x5bc2('0x3'));var rp=require('request-promise');var moment=require(_0x5bc2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5bc2('0x5'));var path=require(_0x5bc2('0x6'));var sox=require(_0x5bc2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bc2('0x8'));var _=require(_0x5bc2('0x9'));var squel=require('squel');var crypto=require(_0x5bc2('0xa'));var jsforce=require(_0x5bc2('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5bc2('0xc'));var Papa=require(_0x5bc2('0xd'));var Redis=require(_0x5bc2('0xe'));var authService=require(_0x5bc2('0xf'));var qs=require(_0x5bc2('0x10'));var as=require(_0x5bc2('0x11'));var hardwareService=require(_0x5bc2('0x12'));var logger=require(_0x5bc2('0x13'))(_0x5bc2('0x14'));var utils=require(_0x5bc2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5bc2('0x16'));var db=require(_0x5bc2('0x17'))['db'];function respondWithStatusCode(_0x18e441,_0x26c215){_0x26c215=_0x26c215||0xcc;return function(_0x4a32e7){if(_0x4a32e7){return _0x18e441['sendStatus'](_0x26c215);}return _0x18e441['status'](_0x26c215)[_0x5bc2('0x18')]();};}function respondWithResult(_0x24d92c,_0x2e584d){_0x2e584d=_0x2e584d||0xc8;return function(_0x45e77d){if(_0x45e77d){return _0x24d92c['status'](_0x2e584d)[_0x5bc2('0x19')](_0x45e77d);}};}function respondWithFilteredResult(_0x526e63,_0x32278b){return function(_0x270789){if(_0x270789){var _0x1d072b=_0x270789[_0x5bc2('0x1a')],_0x57b6b6=_0x32278b['offset'],_0x285417=_0x32278b[_0x5bc2('0x1b')]+_0x32278b[_0x5bc2('0x1c')],_0x56a5e8;if(_0x285417>=_0x1d072b){_0x285417=_0x1d072b;_0x56a5e8=0xc8;}else{_0x56a5e8=0xce;}_0x526e63['status'](_0x56a5e8);return _0x526e63[_0x5bc2('0x1d')](_0x5bc2('0x1e'),_0x57b6b6+'-'+_0x285417+'/'+_0x1d072b)[_0x5bc2('0x19')](_0x270789);}return null;};}function patchUpdates(_0x520ea5){return function(_0x1e7b10){try{jsonpatch['apply'](_0x1e7b10,_0x520ea5,!![]);}catch(_0x2971cd){return BPromise[_0x5bc2('0x1f')](_0x2971cd);}return _0x1e7b10[_0x5bc2('0x20')]();};}function saveUpdates(_0x3eb071,_0x3696dd){return function(_0x5826e2){if(_0x5826e2){return _0x5826e2['update'](_0x3eb071)['then'](function(_0x36fdc6){return _0x36fdc6;});}return null;};}function removeEntity(_0x25e523,_0x1fd05c){return function(_0xf009bc){if(_0xf009bc){return _0xf009bc[_0x5bc2('0x21')]()[_0x5bc2('0x22')](function(){_0x25e523[_0x5bc2('0x23')](0xcc)[_0x5bc2('0x18')]();});}};}function handleEntityNotFound(_0xb5f38f,_0x333c44){return function(_0x4bf82e){if(!_0x4bf82e){_0xb5f38f[_0x5bc2('0x24')](0x194);}return _0x4bf82e;};}function handleError(_0x426135,_0x76332d){_0x76332d=_0x76332d||0x1f4;return function(_0x2d4bf0){logger[_0x5bc2('0x25')](_0x2d4bf0[_0x5bc2('0x26')]);if(_0x2d4bf0[_0x5bc2('0x27')]){delete _0x2d4bf0[_0x5bc2('0x27')];}_0x426135[_0x5bc2('0x23')](_0x76332d)['send'](_0x2d4bf0);};}exports[_0x5bc2('0x28')]=function(_0x2f0fde,_0x54b186){var _0x2a3d3c={},_0x33514d={},_0x54a8a8={'count':0x0,'rows':[]};var _0x5df7fe=_[_0x5bc2('0x29')](db[_0x5bc2('0x2a')][_0x5bc2('0x2b')],function(_0x4f1127){return{'name':_0x4f1127[_0x5bc2('0x2c')],'type':_0x4f1127['type'][_0x5bc2('0x2d')]};});_0x33514d[_0x5bc2('0x2e')]=_[_0x5bc2('0x29')](_0x5df7fe,_0x5bc2('0x27'));_0x33514d['query']=_[_0x5bc2('0x2f')](_0x2f0fde[_0x5bc2('0x30')]);_0x33514d['filters']=_['intersection'](_0x33514d['model'],_0x33514d[_0x5bc2('0x30')]);_0x2a3d3c['attributes']=_['intersection'](_0x33514d[_0x5bc2('0x2e')],qs[_0x5bc2('0x31')](_0x2f0fde['query'][_0x5bc2('0x31')]));_0x2a3d3c[_0x5bc2('0x32')]=_0x2a3d3c[_0x5bc2('0x32')]['length']?_0x2a3d3c[_0x5bc2('0x32')]:_0x33514d[_0x5bc2('0x2e')];if(!_0x2f0fde['query'][_0x5bc2('0x33')](_0x5bc2('0x34'))){_0x2a3d3c['limit']=qs[_0x5bc2('0x1c')](_0x2f0fde['query']['limit']);_0x2a3d3c['offset']=qs[_0x5bc2('0x1b')](_0x2f0fde[_0x5bc2('0x30')][_0x5bc2('0x1b')]);}_0x2a3d3c[_0x5bc2('0x35')]=qs[_0x5bc2('0x36')](_0x2f0fde['query']['sort']);_0x2a3d3c[_0x5bc2('0x37')]=qs[_0x5bc2('0x38')](_['pick'](_0x2f0fde[_0x5bc2('0x30')],_0x33514d[_0x5bc2('0x38')]),_0x5df7fe);if(_0x2f0fde[_0x5bc2('0x30')][_0x5bc2('0x39')]){_0x2a3d3c['where']=_[_0x5bc2('0x3a')](_0x2a3d3c[_0x5bc2('0x37')],{'$or':_[_0x5bc2('0x29')](_0x5df7fe,function(_0x6d4329){if(_0x6d4329[_0x5bc2('0x3b')]!=='VIRTUAL'){var _0x463eaf={};_0x463eaf[_0x6d4329[_0x5bc2('0x27')]]={'$like':'%'+_0x2f0fde[_0x5bc2('0x30')][_0x5bc2('0x39')]+'%'};return _0x463eaf;}})});}_0x2a3d3c=_[_0x5bc2('0x3a')]({},_0x2a3d3c,_0x2f0fde[_0x5bc2('0x3c')]);var _0x33db4c={'where':_0x2a3d3c[_0x5bc2('0x37')]};return db[_0x5bc2('0x2a')][_0x5bc2('0x1a')](_0x33db4c)[_0x5bc2('0x22')](function(_0xb4bf5a){_0x54a8a8['count']=_0xb4bf5a;if(_0x2f0fde[_0x5bc2('0x30')][_0x5bc2('0x3d')]){_0x2a3d3c[_0x5bc2('0x3e')]=[{'all':!![]}];}return db[_0x5bc2('0x2a')]['findAll'](_0x2a3d3c);})[_0x5bc2('0x22')](function(_0x5e7544){_0x54a8a8['rows']=_0x5e7544;return _0x54a8a8;})['then'](respondWithFilteredResult(_0x54b186,_0x2a3d3c))[_0x5bc2('0x3f')](handleError(_0x54b186,null));};exports['show']=function(_0x2d3b7e,_0x2b1948){var _0x27d51f={'raw':!![],'where':{'id':_0x2d3b7e['params']['id']}},_0x2e4436={};_0x2e4436[_0x5bc2('0x2e')]=_[_0x5bc2('0x2f')](db[_0x5bc2('0x2a')]['rawAttributes']);_0x2e4436[_0x5bc2('0x30')]=_[_0x5bc2('0x2f')](_0x2d3b7e[_0x5bc2('0x30')]);_0x2e4436[_0x5bc2('0x38')]=_[_0x5bc2('0x40')](_0x2e4436['model'],_0x2e4436[_0x5bc2('0x30')]);_0x27d51f[_0x5bc2('0x32')]=_['intersection'](_0x2e4436[_0x5bc2('0x2e')],qs[_0x5bc2('0x31')](_0x2d3b7e[_0x5bc2('0x30')]['fields']));_0x27d51f[_0x5bc2('0x32')]=_0x27d51f[_0x5bc2('0x32')][_0x5bc2('0x41')]?_0x27d51f['attributes']:_0x2e4436[_0x5bc2('0x2e')];if(_0x2d3b7e['query'][_0x5bc2('0x3d')]){_0x27d51f[_0x5bc2('0x3e')]=[{'all':!![]}];}_0x27d51f=_[_0x5bc2('0x3a')]({},_0x27d51f,_0x2d3b7e[_0x5bc2('0x3c')]);return db[_0x5bc2('0x2a')]['find'](_0x27d51f)[_0x5bc2('0x22')](handleEntityNotFound(_0x2b1948,null))['then'](respondWithResult(_0x2b1948,null))[_0x5bc2('0x3f')](handleError(_0x2b1948,null));};exports[_0x5bc2('0x42')]=function(_0x101823,_0x111898){return db[_0x5bc2('0x2a')][_0x5bc2('0x42')](_0x101823[_0x5bc2('0x43')],{})[_0x5bc2('0x22')](respondWithResult(_0x111898,0xc9))['catch'](handleError(_0x111898,null));};exports[_0x5bc2('0x44')]=function(_0x3e1bd7,_0x2dccd5){if(_0x3e1bd7[_0x5bc2('0x43')]['id']){delete _0x3e1bd7[_0x5bc2('0x43')]['id'];}return db[_0x5bc2('0x2a')][_0x5bc2('0x45')]({'where':{'id':_0x3e1bd7[_0x5bc2('0x46')]['id']}})[_0x5bc2('0x22')](handleEntityNotFound(_0x2dccd5,null))[_0x5bc2('0x22')](saveUpdates(_0x3e1bd7['body'],null))[_0x5bc2('0x22')](respondWithResult(_0x2dccd5,null))[_0x5bc2('0x3f')](handleError(_0x2dccd5,null));};exports[_0x5bc2('0x21')]=function(_0xa1ba4d,_0x184a7c){return db[_0x5bc2('0x2a')][_0x5bc2('0x45')]({'where':{'id':_0xa1ba4d[_0x5bc2('0x46')]['id']}})[_0x5bc2('0x22')](handleEntityNotFound(_0x184a7c,null))['then'](removeEntity(_0x184a7c,null))['catch'](handleError(_0x184a7c,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 21deeee..b188017 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 _0xeddc=['util','api','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event','dtm','lodash'];(function(_0x3fec33,_0x3ab7f1){var _0x576dac=function(_0x5a12d3){while(--_0x5a12d3){_0x3fec33['push'](_0x3fec33['shift']());}};_0x576dac(++_0x3ab7f1);}(_0xeddc,0xcf));var _0xcedd=function(_0x793b88,_0x2131d0){_0x793b88=_0x793b88-0x0;var _0x341475=_0xeddc[_0x793b88];return _0x341475;};'use strict';var _=require(_0xcedd('0x0'));var util=require(_0xcedd('0x1'));var logger=require('../../config/logger')(_0xcedd('0x2'));var moment=require('moment');var BPromise=require(_0xcedd('0x3'));var rp=require(_0xcedd('0x4'));var fs=require('fs');var path=require(_0xcedd('0x5'));var rimraf=require('rimraf');var config=require(_0xcedd('0x6'));var attributes=require(_0xcedd('0x7'));module[_0xcedd('0x8')]=function(_0x383cc4,_0x9bebc8){return _0x383cc4['define'](_0xcedd('0x9'),attributes,{'tableName':_0xcedd('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xcedd('0xb'),_0xcedd('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9a58=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueuesLog','event_dtm','event','dtm','lodash','../../config/logger'];(function(_0x1c5173,_0x5b530e){var _0x3949e8=function(_0x229bbe){while(--_0x229bbe){_0x1c5173['push'](_0x1c5173['shift']());}};_0x3949e8(++_0x5b530e);}(_0x9a58,0x116));var _0x89a5=function(_0x24679e,_0x22d9d7){_0x24679e=_0x24679e-0x0;var _0x291f21=_0x9a58[_0x24679e];return _0x291f21;};'use strict';var _=require(_0x89a5('0x0'));var util=require('util');var logger=require(_0x89a5('0x1'))(_0x89a5('0x2'));var moment=require(_0x89a5('0x3'));var BPromise=require(_0x89a5('0x4'));var rp=require(_0x89a5('0x5'));var fs=require('fs');var path=require(_0x89a5('0x6'));var rimraf=require(_0x89a5('0x7'));var config=require(_0x89a5('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x89a5('0x9')]=function(_0x4d9f7e,_0x8ab8cd){return _0x4d9f7e['define'](_0x89a5('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x89a5('0xb'),'fields':[_0x89a5('0xc'),_0x89a5('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index e076adf..ecd3678 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 _0x7d25=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x553a80,_0x29f90d){var _0x4e7151=function(_0xc9fd4b){while(--_0xc9fd4b){_0x553a80['push'](_0x553a80['shift']());}};_0x4e7151(++_0x29f90d);}(_0x7d25,0x8a));var _0x57d2=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x7d25[_0x172747];return _0x509692;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('VoiceQueuesLog,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});} \ No newline at end of file +var _0x263f=['client','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0x263f,0x182));var _0xf263=function(_0x2226b6,_0x4c6608){_0x2226b6=_0x2226b6-0x0;var _0x45f5ef=_0x263f[_0x2226b6];return _0x45f5ef;};'use strict';var _=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var moment=require(_0xf263('0x2'));var BPromise=require(_0xf263('0x3'));var rs=require(_0xf263('0x4'));var fs=require('fs');var Redis=require(_0xf263('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf263('0x6'));var logger=require(_0xf263('0x7'))(_0xf263('0x8'));var config=require('../../config/environment');var jayson=require(_0xf263('0x9'));var client=jayson[_0xf263('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fded6,_0xa2b1b0,_0x9644ab){return new BPromise(function(_0xa2e77e,_0x16ff53){return client['request'](_0x4fded6,_0x9644ab)[_0xf263('0xb')](function(_0x26504c){logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));logger[_0xf263('0xf')](_0xf263('0x10'),_0xa2b1b0,'request\x20sent',JSON[_0xf263('0x11')](_0x26504c));if(_0x26504c['error']){if(_0x26504c[_0xf263('0x12')]['code']===0x1f4){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);return _0x16ff53(_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);}logger[_0xf263('0x12')](_0xf263('0xd'),_0xa2b1b0,_0x26504c['error'][_0xf263('0x13')]);return _0xa2e77e(_0x26504c['error'][_0xf263('0x13')]);}else{logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));_0xa2e77e(_0x26504c[_0xf263('0x14')][_0xf263('0x13')]);}})[_0xf263('0x15')](function(_0x57c655){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x57c655);_0x16ff53(_0x57c655);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index fb2e78f..93d41b9 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 _0xbeaf=['exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','update','destroy'];(function(_0x222efe,_0x350c67){var _0xe44156=function(_0x3591e1){while(--_0x3591e1){_0x222efe['push'](_0x222efe['shift']());}};_0xe44156(++_0x350c67);}(_0xbeaf,0xeb));var _0xfbea=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbeaf[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfbea('0x0'));var express=require(_0xfbea('0x1'));var router=express[_0xfbea('0x2')]();var fs_extra=require(_0xfbea('0x3'));var auth=require(_0xfbea('0x4'));var interaction=require(_0xfbea('0x5'));var config=require('../../config/environment');var controller=require(_0xfbea('0x6'));router[_0xfbea('0x7')]('/',auth[_0xfbea('0x8')](),controller[_0xfbea('0x9')]);router[_0xfbea('0x7')](_0xfbea('0xa'),auth['isAuthenticated'](),controller[_0xfbea('0xb')]);router[_0xfbea('0x7')](_0xfbea('0xc'),auth[_0xfbea('0x8')](),controller[_0xfbea('0xd')]);router[_0xfbea('0x7')](_0xfbea('0xe'),auth[_0xfbea('0x8')](),controller['download']);router[_0xfbea('0x7')](_0xfbea('0xf'),controller[_0xfbea('0x10')]);router['get'](_0xfbea('0x11'),auth[_0xfbea('0x8')](),controller[_0xfbea('0x12')]);router['post']('/',auth[_0xfbea('0x8')](),controller[_0xfbea('0x13')]);router[_0xfbea('0x14')](_0xfbea('0x11'),auth['isAuthenticated'](),controller[_0xfbea('0x15')]);router[_0xfbea('0x16')]('/:id',auth[_0xfbea('0x8')](),controller[_0xfbea('0x17')]);router['delete'](_0xfbea('0xc'),auth[_0xfbea('0x8')](),controller[_0xfbea('0x18')]);module[_0xfbea('0x19')]=router; \ No newline at end of file +var _0xf391=['/:id','show','/:id/download','download','downloads','downloadTranscribe','post','/:id/transcribe','runTranscribe','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x7ffc8b,_0x45de1f){var _0x3dc6c2=function(_0x2bec5f){while(--_0x2bec5f){_0x7ffc8b['push'](_0x7ffc8b['shift']());}};_0x3dc6c2(++_0x45de1f);}(_0xf391,0xaf));var _0x1f39=function(_0x322419,_0x3cfe8f){_0x322419=_0x322419-0x0;var _0x3945fd=_0xf391[_0x322419];return _0x3945fd;};'use strict';var multer=require('multer');var util=require(_0x1f39('0x0'));var path=require(_0x1f39('0x1'));var timeout=require(_0x1f39('0x2'));var express=require(_0x1f39('0x3'));var router=express[_0x1f39('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1f39('0x5'));var interaction=require(_0x1f39('0x6'));var config=require(_0x1f39('0x7'));var controller=require(_0x1f39('0x8'));router[_0x1f39('0x9')]('/',auth[_0x1f39('0xa')](),controller[_0x1f39('0xb')]);router[_0x1f39('0x9')](_0x1f39('0xc'),auth[_0x1f39('0xa')](),controller[_0x1f39('0xd')]);router[_0x1f39('0x9')](_0x1f39('0xe'),auth[_0x1f39('0xa')](),controller[_0x1f39('0xf')]);router['get'](_0x1f39('0x10'),auth[_0x1f39('0xa')](),controller[_0x1f39('0x11')]);router[_0x1f39('0x9')]('/:id/downloads',controller[_0x1f39('0x12')]);router['get']('/:id/transcribe',auth[_0x1f39('0xa')](),controller[_0x1f39('0x13')]);router[_0x1f39('0x14')]('/',auth[_0x1f39('0xa')](),controller['create']);router[_0x1f39('0x14')](_0x1f39('0x15'),auth['isAuthenticated'](),controller[_0x1f39('0x16')]);router[_0x1f39('0x17')](_0x1f39('0xe'),auth[_0x1f39('0xa')](),controller[_0x1f39('0x18')]);router[_0x1f39('0x19')](_0x1f39('0xe'),auth[_0x1f39('0xa')](),controller['destroy']);module[_0x1f39('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 62629bb..1e047f0 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 _0x8a06=['channel','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','exports','getDataValue','value','STRING','setDataValue'];(function(_0x36a5d5,_0xf25c69){var _0x1c356e=function(_0x106192){while(--_0x106192){_0x36a5d5['push'](_0x36a5d5['shift']());}};_0x1c356e(++_0xf25c69);}(_0x8a06,0x160));var _0x68a0=function(_0x332109,_0x474add){_0x332109=_0x332109-0x0;var _0x7a6ab2=_0x8a06[_0x332109];return _0x7a6ab2;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require('path');module[_0x68a0('0x0')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x68a0('0x1')](_0x68a0('0x2'))?path['extname'](this['getDataValue'](_0x68a0('0x2'))):undefined;}},'uniqueid':{'type':Sequelize[_0x68a0('0x3')]},'channel':{'type':Sequelize[_0x68a0('0x3')],'set':function(_0x3fe37e){if(_0x3fe37e){this[_0x68a0('0x4')](_0x68a0('0x5'),_0x3fe37e);this['setDataValue'](_0x68a0('0x6'),_0x3fe37e[_0x68a0('0x7')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x68a0('0x3')]},'calleridname':{'type':Sequelize[_0x68a0('0x3')]},'connectedlinenum':{'type':Sequelize[_0x68a0('0x3')]},'connectedlinename':{'type':Sequelize[_0x68a0('0x3')]},'accountcode':{'type':Sequelize[_0x68a0('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x68a0('0x3')]},'value':{'type':Sequelize[_0x68a0('0x3')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x68a0('0x8')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x68a0('0x3')]},'userSecondDisposition':{'type':Sequelize[_0x68a0('0x3')]},'userThirdDisposition':{'type':Sequelize[_0x68a0('0x3')]},'location':{'type':Sequelize[_0x68a0('0x9')]},'transcribeName':{'type':Sequelize[_0x68a0('0x3')]},'transcribeStatus':{'type':Sequelize[_0x68a0('0x3')],'defaultValue':_0x68a0('0xa')},'fileUri':{'type':Sequelize[_0x68a0('0x9')]},'fileText':{'type':Sequelize[_0x68a0('0x9')]},'failureReason':{'type':Sequelize[_0x68a0('0x9')]},'sentiment':{'type':Sequelize[_0x68a0('0x3')]},'sPositive':{'type':Sequelize[_0x68a0('0xb')]},'sNegative':{'type':Sequelize[_0x68a0('0xb')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x68a0('0xb')]},'tempSentiment':{'type':Sequelize[_0x68a0('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x68a0('0x1')](_0x68a0('0xd')))[_0x68a0('0xe')](_0x68a0('0xf'))[_0x68a0('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x68a0('0x1')]('updatedAt'))[_0x68a0('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x18e3=['updatedAt','toString','sequelize','moment','path','exports','getDataValue','value','extname','STRING','channel','setDataValue','membername','split','INTEGER','TEXT','NEW','FLOAT','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm'];(function(_0x2865c9,_0x575948){var _0x585985=function(_0x3f03c2){while(--_0x3f03c2){_0x2865c9['push'](_0x2865c9['shift']());}};_0x585985(++_0x575948);}(_0x18e3,0xf4));var _0x318e=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0x18e3[_0x2892da];return _0x28cff2;};'use strict';var Sequelize=require(_0x318e('0x0'));var moment=require(_0x318e('0x1'));var path=require(_0x318e('0x2'));module[_0x318e('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x318e('0x4')](_0x318e('0x5'))?path[_0x318e('0x6')](this['getDataValue']('value')):undefined;}},'uniqueid':{'type':Sequelize[_0x318e('0x7')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x583ee4){if(_0x583ee4){this['setDataValue'](_0x318e('0x8'),_0x583ee4);this[_0x318e('0x9')](_0x318e('0xa'),_0x583ee4[_0x318e('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x318e('0x7')]},'calleridnum':{'type':Sequelize[_0x318e('0x7')]},'calleridname':{'type':Sequelize[_0x318e('0x7')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x318e('0x7')]},'accountcode':{'type':Sequelize[_0x318e('0x7')]},'context':{'type':Sequelize[_0x318e('0x7')]},'exten':{'type':Sequelize[_0x318e('0x7')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x318e('0x7')]},'rating':{'type':Sequelize[_0x318e('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x318e('0x7')]},'userDisposition':{'type':Sequelize[_0x318e('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x318e('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x318e('0xd')]},'transcribeName':{'type':Sequelize[_0x318e('0x7')]},'transcribeStatus':{'type':Sequelize[_0x318e('0x7')],'defaultValue':_0x318e('0xe')},'fileUri':{'type':Sequelize[_0x318e('0xd')]},'fileText':{'type':Sequelize[_0x318e('0xd')]},'failureReason':{'type':Sequelize[_0x318e('0xd')]},'sentiment':{'type':Sequelize[_0x318e('0x7')]},'sPositive':{'type':Sequelize[_0x318e('0xf')]},'sNegative':{'type':Sequelize[_0x318e('0xf')]},'sNeutral':{'type':Sequelize[_0x318e('0xf')]},'sMixed':{'type':Sequelize[_0x318e('0xf')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x318e('0x10')],'get':function(){return moment(this[_0x318e('0x4')](_0x318e('0x11')))[_0x318e('0x12')](_0x318e('0x13'))['toString']();}},'updatedAt':{'type':Sequelize[_0x318e('0x10')],'get':function(){return moment(this['getDataValue'](_0x318e('0x14')))[_0x318e('0x12')](_0x318e('0x13'))[_0x318e('0x15')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index a0c9f7d..18e0917 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 _0x056b=['[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','then','destroy','error','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','map','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request'];(function(_0x4d0df6,_0x4634f3){var _0x4e2615=function(_0x5285e2){while(--_0x5285e2){_0x4d0df6['push'](_0x4d0df6['shift']());}};_0x4e2615(++_0x4634f3);}(_0x056b,0xb6));var _0xb056=function(_0x34e51c,_0x1f46b0){_0x34e51c=_0x34e51c-0x0;var _0x31643c=_0x056b[_0x34e51c];return _0x31643c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb056('0x0'));var rimraf=require(_0xb056('0x1'));var zipdir=require(_0xb056('0x2'));var jsonpatch=require(_0xb056('0x3'));var rp=require(_0xb056('0x4'));var moment=require(_0xb056('0x5'));var BPromise=require(_0xb056('0x6'));var Mustache=require(_0xb056('0x7'));var util=require(_0xb056('0x8'));var path=require(_0xb056('0x9'));var sox=require(_0xb056('0xa'));var csv=require('to-csv');var ejs=require(_0xb056('0xb'));var fs=require('fs');var fs_extra=require(_0xb056('0xc'));var _=require(_0xb056('0xd'));var squel=require(_0xb056('0xe'));var crypto=require(_0xb056('0xf'));var jsforce=require(_0xb056('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb056('0x11'));var Papa=require(_0xb056('0x12'));var AWS=require(_0xb056('0x13'));var uuidv4=require(_0xb056('0x14'));var Redis=require('ioredis');var authService=require(_0xb056('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xb056('0x16'));var hardwareService=require(_0xb056('0x17'));var logger=require(_0xb056('0x18'))(_0xb056('0x19'));var utils=require(_0xb056('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb056('0x1b'))['db'];function respondWithStatusCode(_0x33acb2,_0x51999c){_0x51999c=_0x51999c||0xcc;return function(_0x81c9fc){if(_0x81c9fc){return _0x33acb2[_0xb056('0x1c')](_0x51999c);}return _0x33acb2[_0xb056('0x1d')](_0x51999c)[_0xb056('0x1e')]();};}function respondWithResult(_0x10dd19,_0x3776a1){_0x3776a1=_0x3776a1||0xc8;return function(_0x179e49){if(_0x179e49){return _0x10dd19['status'](_0x3776a1)[_0xb056('0x1f')](_0x179e49);}};}function respondWithFilteredResult(_0x43565e,_0x9e2eed){return function(_0x65d7ca){if(_0x65d7ca){var _0x5a4ef1=_0x65d7ca[_0xb056('0x20')],_0x16085d=_0x9e2eed['offset'],_0x4e501a=_0x9e2eed[_0xb056('0x21')]+_0x9e2eed['limit'],_0x2daffc;if(_0x4e501a>=_0x5a4ef1){_0x4e501a=_0x5a4ef1;_0x2daffc=0xc8;}else{_0x2daffc=0xce;}_0x43565e[_0xb056('0x1d')](_0x2daffc);return _0x43565e[_0xb056('0x22')]('Content-Range',_0x16085d+'-'+_0x4e501a+'/'+_0x5a4ef1)[_0xb056('0x1f')](_0x65d7ca);}return null;};}function patchUpdates(_0x48cdaf){return function(_0x2107ee){try{jsonpatch[_0xb056('0x23')](_0x2107ee,_0x48cdaf,!![]);}catch(_0x457b54){return BPromise[_0xb056('0x24')](_0x457b54);}return _0x2107ee['save']();};}function saveUpdates(_0x1db585,_0x5b481c){return function(_0x1565d8){if(_0x1565d8){return _0x1565d8['update'](_0x1db585)[_0xb056('0x25')](function(_0x40ac2d){return _0x40ac2d;});}return null;};}function removeEntity(_0x1de11b,_0x3e0298){return function(_0x36e539){if(_0x36e539){return _0x36e539[_0xb056('0x26')]()['then'](function(){_0x1de11b[_0xb056('0x1d')](0xcc)[_0xb056('0x1e')]();});}};}function handleEntityNotFound(_0x341544,_0x1bd6ac){return function(_0x5577a9){if(!_0x5577a9){_0x341544[_0xb056('0x1c')](0x194);}return _0x5577a9;};}function handleError(_0x10b9b3,_0x5c39db){_0x5c39db=_0x5c39db||0x1f4;return function(_0x6d0483){logger[_0xb056('0x27')](_0x6d0483[_0xb056('0x28')]);if(_0x6d0483[_0xb056('0x29')]){delete _0x6d0483[_0xb056('0x29')];}_0x10b9b3[_0xb056('0x1d')](_0x5c39db)[_0xb056('0x2a')](_0x6d0483);};}exports[_0xb056('0x2b')]=function(_0x571e54,_0x29fbc1){var _0x51b06b={},_0x3d83d3={},_0x9c6f4a={'count':0x0,'rows':[]};var _0x294874=_['map'](db[_0xb056('0x2c')][_0xb056('0x2d')],function(_0x4ba5f8){return{'name':_0x4ba5f8[_0xb056('0x2e')],'type':_0x4ba5f8[_0xb056('0x2f')][_0xb056('0x30')]};});_0x3d83d3[_0xb056('0x31')]=_[_0xb056('0x32')](_['map'](_0x294874,_0xb056('0x29')),[_0xb056('0x33')]);_0x3d83d3[_0xb056('0x34')]=_[_0xb056('0x35')](_0x571e54[_0xb056('0x34')]);_0x3d83d3['filters']=_[_0xb056('0x36')](_0x3d83d3[_0xb056('0x31')],_0x3d83d3[_0xb056('0x34')]);_0x51b06b[_0xb056('0x37')]=_[_0xb056('0x36')](_0x3d83d3[_0xb056('0x31')],qs[_0xb056('0x38')](_0x571e54[_0xb056('0x34')]['fields']));_0x51b06b[_0xb056('0x37')]=_0x51b06b['attributes'][_0xb056('0x39')]?_0x51b06b['attributes']:_0x3d83d3['model'];if(!_0x571e54[_0xb056('0x34')][_0xb056('0x3a')](_0xb056('0x3b'))){_0x51b06b[_0xb056('0x3c')]=qs[_0xb056('0x3c')](_0x571e54[_0xb056('0x34')][_0xb056('0x3c')]);_0x51b06b['offset']=qs[_0xb056('0x21')](_0x571e54[_0xb056('0x34')]['offset']);}_0x51b06b['order']=qs[_0xb056('0x3d')](_0x571e54[_0xb056('0x34')][_0xb056('0x3d')]);_0x51b06b['where']=qs[_0xb056('0x3e')](_[_0xb056('0x3f')](_0x571e54[_0xb056('0x34')],_0x3d83d3[_0xb056('0x3e')]),_0x294874);if(_0x571e54[_0xb056('0x34')][_0xb056('0x40')]){_0x51b06b[_0xb056('0x41')]=_[_0xb056('0x42')](_0x51b06b[_0xb056('0x41')],{'$or':_[_0xb056('0x43')](_0x294874,function(_0x3a4549){if(_0x3a4549[_0xb056('0x2f')]!=='VIRTUAL'){var _0x40d1cf={};_0x40d1cf[_0x3a4549['name']]={'$like':'%'+_0x571e54[_0xb056('0x34')][_0xb056('0x40')]+'%'};return _0x40d1cf;}})});}_0x51b06b=_[_0xb056('0x42')]({},_0x51b06b,_0x571e54[_0xb056('0x44')]);var _0x460f28={'where':_0x51b06b[_0xb056('0x41')]};return db[_0xb056('0x2c')][_0xb056('0x20')](_0x460f28)['then'](function(_0x3ffd4e){_0x9c6f4a[_0xb056('0x20')]=_0x3ffd4e;if(_0x571e54[_0xb056('0x34')][_0xb056('0x45')]){_0x51b06b[_0xb056('0x46')]=[{'all':!![]}];}return db['VoiceRecording'][_0xb056('0x47')](_0x51b06b);})[_0xb056('0x25')](function(_0x17eb0f){_0x9c6f4a[_0xb056('0x48')]=_0x17eb0f;return _0x9c6f4a;})[_0xb056('0x25')](respondWithFilteredResult(_0x29fbc1,_0x51b06b))[_0xb056('0x49')](handleError(_0x29fbc1,null));};exports['show']=function(_0x29b6c2,_0x5040f6){var _0x3bcc3d={'raw':![],'where':{'id':_0x29b6c2[_0xb056('0x4a')]['id']}},_0xc729f3={};_0xc729f3[_0xb056('0x31')]=_[_0xb056('0x35')](db[_0xb056('0x2c')][_0xb056('0x2d')]);_0xc729f3[_0xb056('0x34')]=_[_0xb056('0x35')](_0x29b6c2[_0xb056('0x34')]);_0xc729f3['filters']=_[_0xb056('0x36')](_0xc729f3[_0xb056('0x31')],_0xc729f3[_0xb056('0x34')]);_0x3bcc3d['attributes']=_[_0xb056('0x36')](_0xc729f3[_0xb056('0x31')],qs['fields'](_0x29b6c2['query'][_0xb056('0x38')]));_0x3bcc3d[_0xb056('0x37')]=_0x3bcc3d[_0xb056('0x37')][_0xb056('0x39')]?_0x3bcc3d['attributes']:_0xc729f3['model'];if(_0x29b6c2['query']['includeAll']){_0x3bcc3d['include']=[{'all':!![]}];}_0x3bcc3d=_['merge']({},_0x3bcc3d,_0x29b6c2[_0xb056('0x44')]);return db['VoiceRecording'][_0xb056('0x4b')](_0x3bcc3d)[_0xb056('0x25')](handleEntityNotFound(_0x5040f6,null))[_0xb056('0x25')](respondWithResult(_0x5040f6,null))[_0xb056('0x49')](handleError(_0x5040f6,null));};exports[_0xb056('0x4c')]=function(_0x240e27,_0x45b4aa){return db[_0xb056('0x2c')]['create'](_0x240e27[_0xb056('0x4d')],{})[_0xb056('0x25')](respondWithResult(_0x45b4aa,0xc9))['catch'](handleError(_0x45b4aa,null));};exports[_0xb056('0x4e')]=function(_0x36c472,_0xe40439){if(_0x36c472[_0xb056('0x4d')]['id']){delete _0x36c472[_0xb056('0x4d')]['id'];}return db[_0xb056('0x2c')]['find']({'where':{'id':_0x36c472[_0xb056('0x4a')]['id']}})['then'](handleEntityNotFound(_0xe40439,null))[_0xb056('0x25')](saveUpdates(_0x36c472[_0xb056('0x4d')],null))[_0xb056('0x25')](respondWithResult(_0xe40439,null))[_0xb056('0x49')](handleError(_0xe40439,null));};exports[_0xb056('0x4f')]=function(_0x26cebb,_0x2b6733){return db[_0xb056('0x2c')]['describe']()[_0xb056('0x25')](respondWithResult(_0x2b6733,null))[_0xb056('0x49')](handleError(_0x2b6733,null));};exports[_0xb056('0x50')]=function(_0x26708f,_0x2015b9,_0x35acab){var _0x3de967=require(_0xb056('0x51'));var _0x4a9968=![];var _0x122ed7={};if(_0x26708f[_0xb056('0x34')][_0xb056('0x2f')]&&_0x26708f[_0xb056('0x34')][_0xb056('0x2f')]===_0xb056('0x52')){_0x122ed7['uniqueid']=_0x26708f[_0xb056('0x4a')]['id'];}else{_0x122ed7['id']=_0x26708f[_0xb056('0x4a')]['id'];}return db[_0xb056('0x2c')]['find']({'where':_0x122ed7,'attributes':['id',_0xb056('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x2015b9,null))[_0xb056('0x25')](function(_0x8682d4){if(_0x8682d4){var _0x2a064f=_0x8682d4[_0xb056('0x53')];var _0x58c533=util[_0xb056('0x33')](_0xb056('0x54'),_0x2a064f);if(fs['existsSync'](_0x58c533)){_0x4a9968=!![];return _0x3de967[_0xb056('0x55')](_0x58c533,_0x2a064f,config[_0xb056('0x56')][_0xb056('0x57')])[_0xb056('0x25')](function(){return _0x8682d4;});}return _0x8682d4;}})[_0xb056('0x25')](function(_0x51bd1b){if(_0x51bd1b){var _0x3a0854=_0x51bd1b[_0xb056('0x53')];if(!fs[_0xb056('0x58')](_0x3a0854)){throw new db[(_0xb056('0x59'))][(_0xb056('0x5a'))](_0xb056('0x5b'));}if(_0x51bd1b[_0xb056('0x5c')]){return _0x2015b9[_0xb056('0x50')](_0x3a0854,_0x51bd1b[_0xb056('0x5c')]+path[_0xb056('0x5d')](_0x3a0854),function(){if(_0x4a9968){fs[_0xb056('0x5e')](_0x3a0854);}});}else{return _0x2015b9[_0xb056('0x50')](_0x3a0854,function(_0x2ab5a8){if(_0x4a9968){fs[_0xb056('0x5e')](_0x3a0854);}});}}})[_0xb056('0x49')](function(_0x282c31){if(_0x282c31[_0xb056('0x5f')]===_0xb056('0x5b')){_0x2015b9[_0xb056('0x1d')](0x194)[_0xb056('0x2a')](_0xb056('0x60'));}else{return handleError(_0x2015b9,null);}});};exports['downloads']=function(_0x249d51,_0x39b34d,_0x41ae10){var _0x1ffa10=require(_0xb056('0x51'));var _0x2ee6ca=![];var _0x2012b5={'$and':[db['sequelize']['where'](db[_0xb056('0x61')]['fn'](_0xb056('0x62'),db[_0xb056('0x61')][_0xb056('0x63')](_0xb056('0x52'))),_0x249d51['query'][_0xb056('0x64')])]};if(_0x249d51[_0xb056('0x34')][_0xb056('0x2f')]&&_0x249d51[_0xb056('0x34')]['type']===_0xb056('0x52')){_0x2012b5[_0xb056('0x65')][_0xb056('0x66')]({'uniqueid':_0x249d51['params']['id']});}else{_0x2012b5[_0xb056('0x65')][_0xb056('0x66')]({'id':_0x249d51[_0xb056('0x4a')]['id']});}return db['VoiceRecording'][_0xb056('0x4b')]({'where':_0x2012b5,'attributes':['id',_0xb056('0x53')],'raw':!![]})[_0xb056('0x25')](handleEntityNotFound(_0x39b34d,null))['then'](function(_0x415de6){if(_0x415de6){var _0x544cbb=util[_0xb056('0x33')](_0xb056('0x54'),_0x415de6[_0xb056('0x53')]);if(fs['existsSync'](_0x544cbb)){_0x2ee6ca=!![];return _0x1ffa10[_0xb056('0x55')](_0x544cbb,_0x415de6[_0xb056('0x53')],config['secrets'][_0xb056('0x57')])[_0xb056('0x25')](function(){return _0x415de6;});}return _0x415de6;}})[_0xb056('0x25')](function(_0x31a0d1){if(_0x31a0d1){if(!fs[_0xb056('0x58')](_0x31a0d1['value'])){throw new db['Sequelize'][(_0xb056('0x5a'))]('VoiceRecording\x20not\x20found');}if(_0x31a0d1[_0xb056('0x5c')]){return _0x39b34d['download'](_0x31a0d1[_0xb056('0x53')],_0x31a0d1[_0xb056('0x5c')]+path[_0xb056('0x5d')](_0x31a0d1[_0xb056('0x53')]),function(){if(_0x2ee6ca){fs['unlink'](_0x31a0d1['value']);}});}else{return _0x39b34d[_0xb056('0x50')](_0x31a0d1[_0xb056('0x53')],function(_0x3b3bbf){if(_0x2ee6ca){fs[_0xb056('0x5e')](_0x31a0d1['value']);}});}}})[_0xb056('0x49')](handleError(_0x39b34d,null));};exports['destroy']=function(_0x349d7e,_0x5f0278){return db[_0xb056('0x2c')]['find']({'where':{'id':_0x349d7e[_0xb056('0x4a')]['id']}})[_0xb056('0x25')](function(_0x2bff6b){if(!_0x2bff6b)throw new ReferenceError(_0xb056('0x67'));return _0x2bff6b;})['then'](function(_0x272534){var _0x479332=_0x272534[_0xb056('0x53')];logger[_0xb056('0x68')](_0xb056('0x69'),_0x479332);if(!_[_0xb056('0x6a')](_0x272534[_0xb056('0x53')])&&fs[_0xb056('0x58')](_0x479332)){logger[_0xb056('0x68')](_0xb056('0x6b')+_0x479332+_0xb056('0x6c'));fs[_0xb056('0x6d')](_0x479332);}_0x479332=_0x479332+_0xb056('0x6e');if(!_[_0xb056('0x6a')](_0x272534['value'])&&fs['existsSync'](_0x479332)){logger[_0xb056('0x68')]('File:\x20\x22'+_0x479332+_0xb056('0x6c'));fs['unlinkSync'](_0x479332);}return _0x272534;})[_0xb056('0x25')](function(_0x5df962){if(!_0x5df962)throw new InternalError();return _0x5df962['destroy']();})['then'](function(){_0x5f0278[_0xb056('0x1d')](0xcc)['end']();})['catch'](handleError(_0x5f0278,null));};function getBucketslist(_0x3c9d5a,_0xb6fd9b,_0x343326){return new Promise(function(_0x4ca52b,_0x547cb4){var _0x5b9442=new AWS['S3']({'accessKeyId':_0xb6fd9b,'secretAccessKey':_0x3c9d5a,'region':_0x343326});_0x5b9442[_0xb056('0x6f')]({},function(_0x15b074,_0x396d52){if(_0x15b074){return _0x547cb4(_0x15b074);}else{return _0x4ca52b(_0x396d52);}});});}function createBucket(_0x13bd5f,_0x9185c,_0x6a0bfc,_0x627a5e){return new Promise(function(_0x377cd6,_0x2dec80){var _0xd88228=new AWS['S3']({'accessKeyId':_0x9185c,'secretAccessKey':_0x13bd5f,'region':_0x6a0bfc});_0xd88228[_0xb056('0x70')]({'Bucket':_0x627a5e},function(_0x366cba,_0x216920){if(_0x366cba){return _0x2dec80(_0x366cba);}else{return _0x377cd6(_0x216920);}});});}function uploadFile(_0x19243d,_0x4dbd50,_0x5def29,_0x18feb4,_0x5ef886,_0x11ef5f){return new Promise(function(_0x4532ad,_0x2a737f){var _0xc2833b=new AWS['S3']({'accessKeyId':_0x4dbd50,'secretAccessKey':_0x19243d,'region':_0x5def29});_0xc2833b['upload']({'Bucket':_0x18feb4,'Key':_0x5ef886,'Body':_0x11ef5f},function(_0x5d84ff,_0x2e027a){if(_0x5d84ff){return _0x2a737f(_0x5d84ff);}else{return _0x4532ad(_0x2e027a);}});});}function startTranscribe(_0x13a0f1,_0x131cef,_0x5aa3f5,_0x53e1a5,_0x3a14f3,_0x72b81d){return new Promise(function(_0x5dc3b5,_0x345cf9){var _0x456588=new AWS[(_0xb056('0x71'))]({'accessKeyId':_0x131cef,'secretAccessKey':_0x13a0f1,'region':_0x5aa3f5});_0x456588[_0xb056('0x72')]({'TranscriptionJobName':_0x53e1a5,'LanguageCode':_0x3a14f3,'Media':{'MediaFileUri':_0x72b81d}},function(_0xf637bd,_0x315b19){if(_0xf637bd){return _0x345cf9(_0xf637bd);}else{return _0x5dc3b5(_0x315b19);}});});}function transcribe(_0xb96f3c,_0x27b31f,_0x141634,_0x416d33,_0xfad362,_0x5a7a61,_0x394224){return new Promise(function(_0x2d0d1e,_0x397617){var _0x4dda81={};logger[_0xb056('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0xb96f3c,_0xfad362));return uploadFile(_0x27b31f,_0x141634,_0x416d33,_0xfad362,path[_0xb056('0x73')](_0x5a7a61),fs[_0xb056('0x74')](_0x5a7a61))[_0xb056('0x25')](function(_0x56578e){logger['info'](util[_0xb056('0x33')](_0xb056('0x75'),_0xb96f3c,_0xfad362,_0x56578e['Location']));_0x4dda81[_0xb056('0x76')]=_0x56578e['Bucket'];_0x4dda81[_0xb056('0x77')]=_0x56578e[_0xb056('0x78')];logger['info'](util['format'](_0xb056('0x79'),_0xb96f3c));return startTranscribe(_0x27b31f,_0x141634,_0x416d33,uuidv4(),_0x394224,_0x56578e[_0xb056('0x78')]);})['then'](function(_0x1cc5b1){logger['info'](util['format'](_0xb056('0x7a'),_0xb96f3c,_0x1cc5b1[_0xb056('0x7b')][_0xb056('0x7c')]));_0x4dda81[_0xb056('0x7d')]=_0x1cc5b1[_0xb056('0x7b')][_0xb056('0x7c')];_0x4dda81['transcribeStatus']=_0x1cc5b1[_0xb056('0x7b')]['TranscriptionJobStatus'];return _0x2d0d1e(_0x4dda81);})[_0xb056('0x49')](function(_0x3efaf6){return _0x397617(_0x3efaf6);});});}exports['runTranscribe']=function(_0xdb2025,_0x2e92ee,_0x4d7f67){var _0x6751b0;var _0x5bbe03;var _0x449637;var _0x4fdcbd=require(_0xb056('0x51'));return db[_0xb056('0x2c')]['findOne']({'where':{'id':_0xdb2025[_0xb056('0x4a')]['id']}})['then'](function(_0x2d51af){if(_0x2d51af){var _0x1c81ce=util[_0xb056('0x33')](_0xb056('0x54'),_0x2d51af[_0xb056('0x53')]);if(fs[_0xb056('0x58')](_0x1c81ce)){cypher=!![];return _0x4fdcbd[_0xb056('0x55')](_0x1c81ce,_0x2d51af[_0xb056('0x53')],config['secrets'][_0xb056('0x57')])['then'](function(){return _0x2d51af;});}return _0x2d51af;}})['then'](function(_0x5dd905){if(!_0x5dd905){throw new db[(_0xb056('0x59'))][(_0xb056('0x5a'))](_0xb056('0x7e'));}_0x5bbe03=_0x5dd905;return db[_0xb056('0x7f')]['findOne']({'where':{'id':0x1}});})[_0xb056('0x25')](handleEntityNotFound(_0x2e92ee,null))[_0xb056('0x25')](function(_0x7d93d0){if(_0x7d93d0){_0x6751b0=_0x7d93d0;if(!_0x6751b0[_0xb056('0x80')]||!_0x6751b0[_0xb056('0x81')]||!_0x6751b0['transcribeRegion']||!_0x6751b0[_0xb056('0x82')]||!_0x6751b0[_0xb056('0x76')]){throw new db[(_0xb056('0x59'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0xdb2025['body']['runSentiment']&&(!_0x6751b0['sentiment']||!_0x6751b0['sentimentAccountId']||!_0x6751b0[_0xb056('0x83')]||!_0x6751b0[_0xb056('0x82')]||!_0x6751b0[_0xb056('0x76')])){throw new db[(_0xb056('0x59'))][(_0xb056('0x5a'))](_0xb056('0x84'));}return db['CloudProvider'][_0xb056('0x85')]({'where':{'id':_0x6751b0[_0xb056('0x81')]}});}})[_0xb056('0x25')](function(_0x3e4ba5){if(!_0x3e4ba5){throw new db[(_0xb056('0x59'))][(_0xb056('0x5a'))](_0xb056('0x86'));}if(!_0x3e4ba5[_0xb056('0x87')]||!_0x3e4ba5[_0xb056('0x88')]){throw new db[(_0xb056('0x59'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x449637=_0x3e4ba5;return getBucketslist(_0x449637['data1'],_0x449637[_0xb056('0x88')],_0x6751b0['transcribeRegion']);})[_0xb056('0x25')](function(_0x1851b8){if(_0x1851b8&&_0x1851b8[_0xb056('0x89')]){var _0x189f33=_[_0xb056('0x4b')](_0x1851b8[_0xb056('0x89')],function(_0x34702f){return _0x34702f[_0xb056('0x8a')]===_0x6751b0[_0xb056('0x76')];});if(!_0x189f33){logger['info'](util[_0xb056('0x33')](_0xb056('0x8b'),_0xdb2025[_0xb056('0x4a')]['id'],_0x6751b0[_0xb056('0x76')]));return createBucket(_0x449637['data1'],_0x449637['data2'],_0x6751b0[_0xb056('0x8c')],_0x6751b0[_0xb056('0x76')]);}logger[_0xb056('0x68')](util[_0xb056('0x33')](_0xb056('0x8d'),_0xdb2025[_0xb056('0x4a')]['id'],_0x6751b0[_0xb056('0x76')]));return;}})['then'](function(_0x2b6ac8){if(_0x5bbe03['transcribeStatus']===_0xb056('0x8e')){return transcribe(_0xdb2025[_0xb056('0x4a')]['id'],_0x449637['data1'],_0x449637[_0xb056('0x88')],_0x6751b0['transcribeRegion'],_0x6751b0[_0xb056('0x76')],_0x5bbe03[_0xb056('0x53')],_0x6751b0[_0xb056('0x82')]);}else{logger[_0xb056('0x68')](util[_0xb056('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0xdb2025[_0xb056('0x4a')]['id']));return{'transcribeStatus':_0xb056('0x8f')};}})[_0xb056('0x25')](function(_0xca6cf7){if(_0xca6cf7){_0xca6cf7[_0xb056('0x90')]=_0xdb2025[_0xb056('0x4d')][_0xb056('0x91')];return _0x5bbe03[_0xb056('0x92')](_0xca6cf7);}})[_0xb056('0x25')](respondWithResult(_0x2e92ee,null))[_0xb056('0x49')](handleError(_0x2e92ee,null));};function writeFile(_0x62da08,_0x1636e0){return new Promise(function(_0x44a1de,_0x19990d){fs[_0xb056('0x93')](_0x1636e0,_0x62da08,function(_0x40ae8d,_0x10e3b2){if(_0x40ae8d){return _0x19990d(_0x40ae8d);}else{return _0x44a1de(_0x10e3b2);}});});}exports[_0xb056('0x94')]=function(_0x1a8d5b,_0x341a86,_0x506e61){return db[_0xb056('0x2c')][_0xb056('0x85')]({'where':{'id':_0x1a8d5b[_0xb056('0x4a')]['id']}})[_0xb056('0x25')](handleEntityNotFound(_0x341a86))[_0xb056('0x25')](function(_0x430cba){if(_0x430cba&&_0x430cba[_0xb056('0x95')]){var _0xab1c91=_0x430cba[_0xb056('0x95')];var _0xa49c52=config[_0xb056('0x96')]+'/server/files/transcribes/transcribe_'+_0x430cba['id']+'.txt';if(fs[_0xb056('0x58')](_0xa49c52)){return _0xa49c52;}return writeFile(_0xab1c91,_0xa49c52)['then'](function(){return _0xa49c52;});}else{throw new db[(_0xb056('0x59'))][(_0xb056('0x5a'))](_0xb056('0x97'));}})['then'](function(_0x41bbff){return _0x341a86[_0xb056('0x50')](_0x41bbff);})['catch'](handleError(_0x341a86));}; \ No newline at end of file +var _0x4888=['order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','sequelize','col','token','push','$and','decryptFile','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','end','listBuckets','upload','TranscribeService','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','data2','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','key','model','differenceBy','format','keys','query','filters','intersection','attributes','fields','nolimit'];(function(_0x28ccb6,_0x14c679){var _0x538f02=function(_0x4785a3){while(--_0x4785a3){_0x28ccb6['push'](_0x28ccb6['shift']());}};_0x538f02(++_0x14c679);}(_0x4888,0x198));var _0x8488=function(_0x4c378e,_0x286afb){_0x4c378e=_0x4c378e-0x0;var _0xf41ce7=_0x4888[_0x4c378e];return _0xf41ce7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8488('0x0'));var rimraf=require(_0x8488('0x1'));var zipdir=require(_0x8488('0x2'));var jsonpatch=require(_0x8488('0x3'));var rp=require(_0x8488('0x4'));var moment=require(_0x8488('0x5'));var BPromise=require(_0x8488('0x6'));var Mustache=require('mustache');var util=require(_0x8488('0x7'));var path=require(_0x8488('0x8'));var sox=require(_0x8488('0x9'));var csv=require(_0x8488('0xa'));var ejs=require(_0x8488('0xb'));var fs=require('fs');var fs_extra=require(_0x8488('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8488('0xd'));var toCsv=require(_0x8488('0xa'));var querystring=require('querystring');var Papa=require(_0x8488('0xe'));var AWS=require(_0x8488('0xf'));var uuidv4=require(_0x8488('0x10'));var Redis=require(_0x8488('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8488('0x12'));var as=require(_0x8488('0x13'));var hardwareService=require(_0x8488('0x14'));var logger=require(_0x8488('0x15'))(_0x8488('0x16'));var utils=require('../../config/utils');var config=require(_0x8488('0x17'));var licenseUtil=require(_0x8488('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a9ae2,_0x150b52){_0x150b52=_0x150b52||0xcc;return function(_0x496dd1){if(_0x496dd1){return _0x4a9ae2[_0x8488('0x19')](_0x150b52);}return _0x4a9ae2['status'](_0x150b52)['end']();};}function respondWithResult(_0x24d0a0,_0x3635da){_0x3635da=_0x3635da||0xc8;return function(_0x5700b){if(_0x5700b){return _0x24d0a0[_0x8488('0x1a')](_0x3635da)[_0x8488('0x1b')](_0x5700b);}};}function respondWithFilteredResult(_0x8d3b3d,_0x165139){return function(_0x4e44af){if(_0x4e44af){var _0x3dad45=_0x4e44af[_0x8488('0x1c')],_0x322264=_0x165139[_0x8488('0x1d')],_0x3edfe4=_0x165139[_0x8488('0x1d')]+_0x165139[_0x8488('0x1e')],_0x37361d;if(_0x3edfe4>=_0x3dad45){_0x3edfe4=_0x3dad45;_0x37361d=0xc8;}else{_0x37361d=0xce;}_0x8d3b3d[_0x8488('0x1a')](_0x37361d);return _0x8d3b3d[_0x8488('0x1f')](_0x8488('0x20'),_0x322264+'-'+_0x3edfe4+'/'+_0x3dad45)[_0x8488('0x1b')](_0x4e44af);}return null;};}function patchUpdates(_0x3dd93e){return function(_0x554ec6){try{jsonpatch['apply'](_0x554ec6,_0x3dd93e,!![]);}catch(_0x340d6b){return BPromise[_0x8488('0x21')](_0x340d6b);}return _0x554ec6[_0x8488('0x22')]();};}function saveUpdates(_0x3c9fc2,_0x892236){return function(_0x1bef99){if(_0x1bef99){return _0x1bef99[_0x8488('0x23')](_0x3c9fc2)[_0x8488('0x24')](function(_0x39dd43){return _0x39dd43;});}return null;};}function removeEntity(_0x5123d0,_0x476a14){return function(_0x4e07e1){if(_0x4e07e1){return _0x4e07e1[_0x8488('0x25')]()[_0x8488('0x24')](function(){_0x5123d0[_0x8488('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x577234,_0x5b8885){return function(_0x59b5e2){if(!_0x59b5e2){_0x577234[_0x8488('0x19')](0x194);}return _0x59b5e2;};}function handleError(_0x51fe30,_0x58057a){_0x58057a=_0x58057a||0x1f4;return function(_0x26bdbb){logger[_0x8488('0x26')](_0x26bdbb[_0x8488('0x27')]);if(_0x26bdbb[_0x8488('0x28')]){delete _0x26bdbb[_0x8488('0x28')];}_0x51fe30['status'](_0x58057a)[_0x8488('0x29')](_0x26bdbb);};}exports[_0x8488('0x2a')]=function(_0xf9720e,_0x3df1f9){var _0x460001={},_0x27f5cf={},_0x2c15ff={'count':0x0,'rows':[]};var _0x296b6c=_[_0x8488('0x2b')](db[_0x8488('0x2c')][_0x8488('0x2d')],function(_0x58d0cc){return{'name':_0x58d0cc['fieldName'],'type':_0x58d0cc['type'][_0x8488('0x2e')]};});_0x27f5cf[_0x8488('0x2f')]=_[_0x8488('0x30')](_[_0x8488('0x2b')](_0x296b6c,_0x8488('0x28')),[_0x8488('0x31')]);_0x27f5cf['query']=_[_0x8488('0x32')](_0xf9720e[_0x8488('0x33')]);_0x27f5cf[_0x8488('0x34')]=_[_0x8488('0x35')](_0x27f5cf[_0x8488('0x2f')],_0x27f5cf['query']);_0x460001[_0x8488('0x36')]=_[_0x8488('0x35')](_0x27f5cf['model'],qs[_0x8488('0x37')](_0xf9720e[_0x8488('0x33')][_0x8488('0x37')]));_0x460001[_0x8488('0x36')]=_0x460001[_0x8488('0x36')]['length']?_0x460001[_0x8488('0x36')]:_0x27f5cf[_0x8488('0x2f')];if(!_0xf9720e[_0x8488('0x33')]['hasOwnProperty'](_0x8488('0x38'))){_0x460001['limit']=qs[_0x8488('0x1e')](_0xf9720e[_0x8488('0x33')][_0x8488('0x1e')]);_0x460001[_0x8488('0x1d')]=qs['offset'](_0xf9720e[_0x8488('0x33')][_0x8488('0x1d')]);}_0x460001[_0x8488('0x39')]=qs['sort'](_0xf9720e[_0x8488('0x33')][_0x8488('0x3a')]);_0x460001[_0x8488('0x3b')]=qs[_0x8488('0x34')](_[_0x8488('0x3c')](_0xf9720e[_0x8488('0x33')],_0x27f5cf[_0x8488('0x34')]),_0x296b6c);if(_0xf9720e[_0x8488('0x33')][_0x8488('0x3d')]){_0x460001[_0x8488('0x3b')]=_[_0x8488('0x3e')](_0x460001['where'],{'$or':_['map'](_0x296b6c,function(_0x149818){if(_0x149818[_0x8488('0x3f')]!==_0x8488('0x40')){var _0x390a17={};_0x390a17[_0x149818[_0x8488('0x28')]]={'$like':'%'+_0xf9720e[_0x8488('0x33')][_0x8488('0x3d')]+'%'};return _0x390a17;}})});}_0x460001=_[_0x8488('0x3e')]({},_0x460001,_0xf9720e[_0x8488('0x41')]);var _0x5f561c={'where':_0x460001[_0x8488('0x3b')]};return db[_0x8488('0x2c')][_0x8488('0x1c')](_0x5f561c)['then'](function(_0x207429){_0x2c15ff[_0x8488('0x1c')]=_0x207429;if(_0xf9720e[_0x8488('0x33')][_0x8488('0x42')]){_0x460001[_0x8488('0x43')]=[{'all':!![]}];}return db[_0x8488('0x2c')][_0x8488('0x44')](_0x460001);})['then'](function(_0x45db70){_0x2c15ff[_0x8488('0x45')]=_0x45db70;return _0x2c15ff;})[_0x8488('0x24')](respondWithFilteredResult(_0x3df1f9,_0x460001))['catch'](handleError(_0x3df1f9,null));};exports[_0x8488('0x46')]=function(_0x522dbb,_0x40ee7e){var _0x34b11b={'raw':![],'where':{'id':_0x522dbb[_0x8488('0x47')]['id']}},_0x5cbd11={};_0x5cbd11[_0x8488('0x2f')]=_[_0x8488('0x32')](db[_0x8488('0x2c')][_0x8488('0x2d')]);_0x5cbd11['query']=_[_0x8488('0x32')](_0x522dbb['query']);_0x5cbd11[_0x8488('0x34')]=_[_0x8488('0x35')](_0x5cbd11[_0x8488('0x2f')],_0x5cbd11[_0x8488('0x33')]);_0x34b11b[_0x8488('0x36')]=_[_0x8488('0x35')](_0x5cbd11[_0x8488('0x2f')],qs[_0x8488('0x37')](_0x522dbb[_0x8488('0x33')][_0x8488('0x37')]));_0x34b11b[_0x8488('0x36')]=_0x34b11b[_0x8488('0x36')][_0x8488('0x48')]?_0x34b11b[_0x8488('0x36')]:_0x5cbd11[_0x8488('0x2f')];if(_0x522dbb[_0x8488('0x33')][_0x8488('0x42')]){_0x34b11b['include']=[{'all':!![]}];}_0x34b11b=_[_0x8488('0x3e')]({},_0x34b11b,_0x522dbb[_0x8488('0x41')]);return db[_0x8488('0x2c')][_0x8488('0x49')](_0x34b11b)['then'](handleEntityNotFound(_0x40ee7e,null))[_0x8488('0x24')](respondWithResult(_0x40ee7e,null))[_0x8488('0x4a')](handleError(_0x40ee7e,null));};exports[_0x8488('0x4b')]=function(_0x425c75,_0x52042c){return db[_0x8488('0x2c')][_0x8488('0x4b')](_0x425c75[_0x8488('0x4c')],{})[_0x8488('0x24')](respondWithResult(_0x52042c,0xc9))[_0x8488('0x4a')](handleError(_0x52042c,null));};exports[_0x8488('0x23')]=function(_0x886a9e,_0x299d8e){if(_0x886a9e[_0x8488('0x4c')]['id']){delete _0x886a9e[_0x8488('0x4c')]['id'];}return db[_0x8488('0x2c')][_0x8488('0x49')]({'where':{'id':_0x886a9e[_0x8488('0x47')]['id']}})['then'](handleEntityNotFound(_0x299d8e,null))['then'](saveUpdates(_0x886a9e[_0x8488('0x4c')],null))[_0x8488('0x24')](respondWithResult(_0x299d8e,null))[_0x8488('0x4a')](handleError(_0x299d8e,null));};exports[_0x8488('0x4d')]=function(_0x3ed7fb,_0x22d22c){return db[_0x8488('0x2c')][_0x8488('0x4d')]()[_0x8488('0x24')](respondWithResult(_0x22d22c,null))['catch'](handleError(_0x22d22c,null));};exports[_0x8488('0x4e')]=function(_0x347867,_0x51d1eb,_0x35e08a){var _0x313e00=require(_0x8488('0x4f'));var _0x1ff9c5=![];var _0x4f80fb={};if(_0x347867[_0x8488('0x33')][_0x8488('0x3f')]&&_0x347867[_0x8488('0x33')]['type']===_0x8488('0x50')){_0x4f80fb[_0x8488('0x50')]=_0x347867[_0x8488('0x47')]['id'];}else{_0x4f80fb['id']=_0x347867[_0x8488('0x47')]['id'];}return db['VoiceRecording'][_0x8488('0x49')]({'where':_0x4f80fb,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x51d1eb,null))[_0x8488('0x24')](function(_0x5ca135){if(_0x5ca135){var _0x3453c7=_0x5ca135[_0x8488('0x51')];var _0x417afa=util[_0x8488('0x31')](_0x8488('0x52'),_0x3453c7);if(fs[_0x8488('0x53')](_0x417afa)){_0x1ff9c5=!![];return _0x313e00['decryptFile'](_0x417afa,_0x3453c7,config[_0x8488('0x54')][_0x8488('0x55')])[_0x8488('0x24')](function(){return _0x5ca135;});}return _0x5ca135;}})[_0x8488('0x24')](function(_0x1e3737){if(_0x1e3737){var _0x5660de=_0x1e3737[_0x8488('0x51')];if(!fs['existsSync'](_0x5660de)){throw new db[(_0x8488('0x56'))][(_0x8488('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x1e3737[_0x8488('0x58')]){return _0x51d1eb[_0x8488('0x4e')](_0x5660de,_0x1e3737[_0x8488('0x58')]+path[_0x8488('0x59')](_0x5660de),function(){if(_0x1ff9c5){fs[_0x8488('0x5a')](_0x5660de);}});}else{return _0x51d1eb[_0x8488('0x4e')](_0x5660de,function(_0x59d0d4){if(_0x1ff9c5){fs[_0x8488('0x5a')](_0x5660de);}});}}})['catch'](function(_0x31dcc6){if(_0x31dcc6[_0x8488('0x5b')]===_0x8488('0x5c')){_0x51d1eb[_0x8488('0x1a')](0x194)[_0x8488('0x29')](_0x8488('0x5d'));}else{return handleError(_0x51d1eb,null);}});};exports['downloads']=function(_0x43ec52,_0x4dba5a,_0x1598db){var _0x24b8d3=require(_0x8488('0x4f'));var _0x353013=![];var _0x1971f3={'$and':[db[_0x8488('0x5e')]['where'](db['sequelize']['fn']('MD5',db[_0x8488('0x5e')][_0x8488('0x5f')](_0x8488('0x50'))),_0x43ec52[_0x8488('0x33')][_0x8488('0x60')])]};if(_0x43ec52[_0x8488('0x33')][_0x8488('0x3f')]&&_0x43ec52[_0x8488('0x33')][_0x8488('0x3f')]===_0x8488('0x50')){_0x1971f3['$and'][_0x8488('0x61')]({'uniqueid':_0x43ec52[_0x8488('0x47')]['id']});}else{_0x1971f3[_0x8488('0x62')]['push']({'id':_0x43ec52['params']['id']});}return db[_0x8488('0x2c')][_0x8488('0x49')]({'where':_0x1971f3,'attributes':['id',_0x8488('0x51')],'raw':!![]})[_0x8488('0x24')](handleEntityNotFound(_0x4dba5a,null))['then'](function(_0x4b7475){if(_0x4b7475){var _0x1577ce=util[_0x8488('0x31')](_0x8488('0x52'),_0x4b7475['value']);if(fs[_0x8488('0x53')](_0x1577ce)){_0x353013=!![];return _0x24b8d3[_0x8488('0x63')](_0x1577ce,_0x4b7475[_0x8488('0x51')],config[_0x8488('0x54')][_0x8488('0x55')])['then'](function(){return _0x4b7475;});}return _0x4b7475;}})[_0x8488('0x24')](function(_0x3babee){if(_0x3babee){if(!fs['existsSync'](_0x3babee[_0x8488('0x51')])){throw new db[(_0x8488('0x56'))]['ValidationError'](_0x8488('0x5c'));}if(_0x3babee[_0x8488('0x58')]){return _0x4dba5a[_0x8488('0x4e')](_0x3babee[_0x8488('0x51')],_0x3babee[_0x8488('0x58')]+path[_0x8488('0x59')](_0x3babee[_0x8488('0x51')]),function(){if(_0x353013){fs['unlink'](_0x3babee[_0x8488('0x51')]);}});}else{return _0x4dba5a[_0x8488('0x4e')](_0x3babee['value'],function(_0x49ef10){if(_0x353013){fs[_0x8488('0x5a')](_0x3babee[_0x8488('0x51')]);}});}}})[_0x8488('0x4a')](handleError(_0x4dba5a,null));};exports['destroy']=function(_0xb85159,_0x852e08){return db['VoiceRecording'][_0x8488('0x49')]({'where':{'id':_0xb85159['params']['id']}})[_0x8488('0x24')](function(_0x1a3988){if(!_0x1a3988)throw new ReferenceError(_0x8488('0x64'));return _0x1a3988;})['then'](function(_0xbee86e){var _0x3b908f=_0xbee86e['value'];logger['info'](_0x8488('0x65'),_0x3b908f);if(!_[_0x8488('0x66')](_0xbee86e[_0x8488('0x51')])&&fs[_0x8488('0x53')](_0x3b908f)){logger[_0x8488('0x67')](_0x8488('0x68')+_0x3b908f+_0x8488('0x69'));fs[_0x8488('0x6a')](_0x3b908f);}_0x3b908f=_0x3b908f+_0x8488('0x6b');if(!_[_0x8488('0x66')](_0xbee86e['value'])&&fs[_0x8488('0x53')](_0x3b908f)){logger['info'](_0x8488('0x68')+_0x3b908f+_0x8488('0x69'));fs[_0x8488('0x6a')](_0x3b908f);}return _0xbee86e;})[_0x8488('0x24')](function(_0x54283a){if(!_0x54283a)throw new InternalError();return _0x54283a[_0x8488('0x25')]();})[_0x8488('0x24')](function(){_0x852e08['status'](0xcc)[_0x8488('0x6c')]();})['catch'](handleError(_0x852e08,null));};function getBucketslist(_0x26241b,_0x15b919,_0x429044){return new Promise(function(_0x2562cf,_0x25b725){var _0x251149=new AWS['S3']({'accessKeyId':_0x15b919,'secretAccessKey':_0x26241b,'region':_0x429044});_0x251149[_0x8488('0x6d')]({},function(_0x452131,_0x510f42){if(_0x452131){return _0x25b725(_0x452131);}else{return _0x2562cf(_0x510f42);}});});}function createBucket(_0x1ce726,_0x53d87e,_0x5330cf,_0xdd1752){return new Promise(function(_0x26db35,_0x110df2){var _0x481e4b=new AWS['S3']({'accessKeyId':_0x53d87e,'secretAccessKey':_0x1ce726,'region':_0x5330cf});_0x481e4b['createBucket']({'Bucket':_0xdd1752},function(_0x1f89f9,_0xee1aac){if(_0x1f89f9){return _0x110df2(_0x1f89f9);}else{return _0x26db35(_0xee1aac);}});});}function uploadFile(_0x50aded,_0x1acaf7,_0x688527,_0x924138,_0x173d35,_0x2a3acf){return new Promise(function(_0x1f6031,_0x4e69e8){var _0x2527ea=new AWS['S3']({'accessKeyId':_0x1acaf7,'secretAccessKey':_0x50aded,'region':_0x688527});_0x2527ea[_0x8488('0x6e')]({'Bucket':_0x924138,'Key':_0x173d35,'Body':_0x2a3acf},function(_0x829001,_0x4a2fd9){if(_0x829001){return _0x4e69e8(_0x829001);}else{return _0x1f6031(_0x4a2fd9);}});});}function startTranscribe(_0x1cfe70,_0x2b5ea4,_0x2ce905,_0x52e034,_0x28468b,_0xaf7f76){return new Promise(function(_0x54918e,_0x48860c){var _0x92f0ec=new AWS[(_0x8488('0x6f'))]({'accessKeyId':_0x2b5ea4,'secretAccessKey':_0x1cfe70,'region':_0x2ce905});_0x92f0ec['startTranscriptionJob']({'TranscriptionJobName':_0x52e034,'LanguageCode':_0x28468b,'Media':{'MediaFileUri':_0xaf7f76}},function(_0x353514,_0x249a32){if(_0x353514){return _0x48860c(_0x353514);}else{return _0x54918e(_0x249a32);}});});}function transcribe(_0x5c63b1,_0x4a7047,_0x877856,_0x4a0804,_0x13e315,_0x202d16,_0x219123){return new Promise(function(_0x42761b,_0x581ea2){var _0xde3227={};logger['info'](util[_0x8488('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x5c63b1,_0x13e315));return uploadFile(_0x4a7047,_0x877856,_0x4a0804,_0x13e315,path[_0x8488('0x70')](_0x202d16),fs[_0x8488('0x71')](_0x202d16))[_0x8488('0x24')](function(_0x1e635a){logger[_0x8488('0x67')](util[_0x8488('0x31')](_0x8488('0x72'),_0x5c63b1,_0x13e315,_0x1e635a[_0x8488('0x73')]));_0xde3227[_0x8488('0x74')]=_0x1e635a[_0x8488('0x75')];_0xde3227[_0x8488('0x76')]=_0x1e635a[_0x8488('0x73')];logger[_0x8488('0x67')](util[_0x8488('0x31')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x5c63b1));return startTranscribe(_0x4a7047,_0x877856,_0x4a0804,uuidv4(),_0x219123,_0x1e635a[_0x8488('0x73')]);})[_0x8488('0x24')](function(_0x55ddaf){logger[_0x8488('0x67')](util[_0x8488('0x31')](_0x8488('0x77'),_0x5c63b1,_0x55ddaf[_0x8488('0x78')][_0x8488('0x79')]));_0xde3227[_0x8488('0x7a')]=_0x55ddaf[_0x8488('0x78')][_0x8488('0x79')];_0xde3227[_0x8488('0x7b')]=_0x55ddaf[_0x8488('0x78')][_0x8488('0x7c')];return _0x42761b(_0xde3227);})['catch'](function(_0x2b3723){return _0x581ea2(_0x2b3723);});});}exports[_0x8488('0x7d')]=function(_0x51814e,_0x1e509a,_0x7426b2){var _0x76c3c;var _0x1099ae;var _0x2df32b;var _0x5b19b9=require('../../components/encryptor');return db[_0x8488('0x2c')][_0x8488('0x7e')]({'where':{'id':_0x51814e[_0x8488('0x47')]['id']}})[_0x8488('0x24')](function(_0x1b3e23){if(_0x1b3e23){var _0x476251=util[_0x8488('0x31')](_0x8488('0x52'),_0x1b3e23[_0x8488('0x51')]);if(fs[_0x8488('0x53')](_0x476251)){cypher=!![];return _0x5b19b9[_0x8488('0x63')](_0x476251,_0x1b3e23[_0x8488('0x51')],config[_0x8488('0x54')][_0x8488('0x55')])[_0x8488('0x24')](function(){return _0x1b3e23;});}return _0x1b3e23;}})['then'](function(_0x8695e5){if(!_0x8695e5){throw new db['Sequelize']['ValidationError'](_0x8488('0x7f'));}_0x1099ae=_0x8695e5;return db[_0x8488('0x80')][_0x8488('0x7e')]({'where':{'id':0x1}});})[_0x8488('0x24')](handleEntityNotFound(_0x1e509a,null))[_0x8488('0x24')](function(_0x100efc){if(_0x100efc){_0x76c3c=_0x100efc;if(!_0x76c3c[_0x8488('0x81')]||!_0x76c3c[_0x8488('0x82')]||!_0x76c3c[_0x8488('0x83')]||!_0x76c3c[_0x8488('0x84')]||!_0x76c3c['bucket']){throw new db[(_0x8488('0x56'))][(_0x8488('0x57'))](_0x8488('0x85'));}if(_0x51814e[_0x8488('0x4c')][_0x8488('0x86')]&&(!_0x76c3c[_0x8488('0x87')]||!_0x76c3c['sentimentAccountId']||!_0x76c3c[_0x8488('0x88')]||!_0x76c3c['language']||!_0x76c3c[_0x8488('0x74')])){throw new db[(_0x8488('0x56'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x8488('0x89')][_0x8488('0x7e')]({'where':{'id':_0x76c3c[_0x8488('0x82')]}});}})[_0x8488('0x24')](function(_0xbec8a6){if(!_0xbec8a6){throw new db['Sequelize'][(_0x8488('0x57'))](_0x8488('0x8a'));}if(!_0xbec8a6['data1']||!_0xbec8a6['data2']){throw new db[(_0x8488('0x56'))][(_0x8488('0x57'))](_0x8488('0x8b'));}_0x2df32b=_0xbec8a6;return getBucketslist(_0x2df32b['data1'],_0x2df32b['data2'],_0x76c3c[_0x8488('0x83')]);})[_0x8488('0x24')](function(_0x27f439){if(_0x27f439&&_0x27f439['Buckets']){var _0x337d0f=_[_0x8488('0x49')](_0x27f439[_0x8488('0x8c')],function(_0x39851c){return _0x39851c[_0x8488('0x8d')]===_0x76c3c[_0x8488('0x74')];});if(!_0x337d0f){logger[_0x8488('0x67')](util[_0x8488('0x31')](_0x8488('0x8e'),_0x51814e[_0x8488('0x47')]['id'],_0x76c3c[_0x8488('0x74')]));return createBucket(_0x2df32b[_0x8488('0x8f')],_0x2df32b[_0x8488('0x90')],_0x76c3c['transcribeRegion'],_0x76c3c[_0x8488('0x74')]);}logger[_0x8488('0x67')](util[_0x8488('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x51814e[_0x8488('0x47')]['id'],_0x76c3c['bucket']));return;}})[_0x8488('0x24')](function(_0x52fe9f){if(_0x1099ae['transcribeStatus']===_0x8488('0x91')){return transcribe(_0x51814e['params']['id'],_0x2df32b[_0x8488('0x8f')],_0x2df32b[_0x8488('0x90')],_0x76c3c[_0x8488('0x83')],_0x76c3c[_0x8488('0x74')],_0x1099ae['value'],_0x76c3c[_0x8488('0x84')]);}else{logger[_0x8488('0x67')](util[_0x8488('0x31')](_0x8488('0x92'),_0x51814e['params']['id']));return{'transcribeStatus':_0x8488('0x93')};}})[_0x8488('0x24')](function(_0x279096){if(_0x279096){_0x279096[_0x8488('0x94')]=_0x51814e[_0x8488('0x4c')]['runSentiment'];return _0x1099ae['updateAttributes'](_0x279096);}})[_0x8488('0x24')](respondWithResult(_0x1e509a,null))[_0x8488('0x4a')](handleError(_0x1e509a,null));};function writeFile(_0x42e1c0,_0x197ed0){return new Promise(function(_0x2b92bb,_0x5969c3){fs['writeFile'](_0x197ed0,_0x42e1c0,function(_0x5aedd6,_0x205922){if(_0x5aedd6){return _0x5969c3(_0x5aedd6);}else{return _0x2b92bb(_0x205922);}});});}exports[_0x8488('0x95')]=function(_0x2bab71,_0x5dacab,_0x30aab3){return db[_0x8488('0x2c')]['findOne']({'where':{'id':_0x2bab71[_0x8488('0x47')]['id']}})[_0x8488('0x24')](handleEntityNotFound(_0x5dacab))[_0x8488('0x24')](function(_0xbb8f1f){if(_0xbb8f1f&&_0xbb8f1f[_0x8488('0x96')]){var _0x3449c2=_0xbb8f1f[_0x8488('0x96')];var _0x2f8dd9=config[_0x8488('0x97')]+_0x8488('0x98')+_0xbb8f1f['id']+_0x8488('0x99');if(fs[_0x8488('0x53')](_0x2f8dd9)){return _0x2f8dd9;}return writeFile(_0x3449c2,_0x2f8dd9)[_0x8488('0x24')](function(){return _0x2f8dd9;});}else{throw new db['Sequelize'][(_0x8488('0x57'))](_0x8488('0x9a'));}})['then'](function(_0x5baa9e){return _0x5dacab['download'](_0x5baa9e);})[_0x8488('0x4a')](handleError(_0x5dacab));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 6ca5e0b..791c128 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 _0xc095=['bluebird','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','util','api','moment'];(function(_0x385a99,_0x486c59){var _0x4731e3=function(_0x200222){while(--_0x200222){_0x385a99['push'](_0x385a99['shift']());}};_0x4731e3(++_0x486c59);}(_0xc095,0x10e));var _0x5c09=function(_0x491915,_0x56d66f){_0x491915=_0x491915-0x0;var _0x14fb36=_0xc095[_0x491915];return _0x14fb36;};'use strict';var _=require('lodash');var util=require(_0x5c09('0x0'));var logger=require('../../config/logger')(_0x5c09('0x1'));var moment=require(_0x5c09('0x2'));var BPromise=require(_0x5c09('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c09('0x4'));var rimraf=require(_0x5c09('0x5'));var config=require(_0x5c09('0x6'));var attributes=require(_0x5c09('0x7'));module[_0x5c09('0x8')]=function(_0x335548,_0x586469){return _0x335548[_0x5c09('0x9')](_0x5c09('0xa'),attributes,{'tableName':_0x5c09('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5c09('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd189=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x37860d,_0x39139b){var _0x3a6fe9=function(_0x358736){while(--_0x358736){_0x37860d['push'](_0x37860d['shift']());}};_0x3a6fe9(++_0x39139b);}(_0xd189,0x97));var _0x9d18=function(_0x3ca0c5,_0x579929){_0x3ca0c5=_0x3ca0c5-0x0;var _0x1a7547=_0xd189[_0x3ca0c5];return _0x1a7547;};'use strict';var _=require(_0x9d18('0x0'));var util=require(_0x9d18('0x1'));var logger=require(_0x9d18('0x2'))(_0x9d18('0x3'));var moment=require(_0x9d18('0x4'));var BPromise=require(_0x9d18('0x5'));var rp=require(_0x9d18('0x6'));var fs=require('fs');var path=require(_0x9d18('0x7'));var rimraf=require(_0x9d18('0x8'));var config=require('../../config/environment');var attributes=require(_0x9d18('0x9'));module[_0x9d18('0xa')]=function(_0x1b4679,_0x3aaefa){return _0x1b4679[_0x9d18('0xb')](_0x9d18('0xc'),attributes,{'tableName':_0x9d18('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9d18('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 4e1f4e7..610af47 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 _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x4da196,_0x357dc9){var _0x375df3=function(_0x366603){while(--_0x366603){_0x4da196['push'](_0x4da196['shift']());}};_0x375df3(++_0x357dc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x3a096c,_0x1f9d72){var _0x44a6a4=function(_0x5d482c){while(--_0x5d482c){_0x3a096c['push'](_0x3a096c['shift']());}};_0x44a6a4(++_0x1f9d72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index bb2555c..8808f1e 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 _0xe05e=['index','/describe','describe','show','create','put','/:id','delete','util','express','../../components/auth/service','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0xe05e,0x158));var _0xee05=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0xe05e[_0x32f9ca];return _0x52e083;};'use strict';var multer=require('multer');var util=require(_0xee05('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xee05('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xee05('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xee05('0x3'));router[_0xee05('0x4')]('/',auth[_0xee05('0x5')](),controller[_0xee05('0x6')]);router[_0xee05('0x4')](_0xee05('0x7'),auth[_0xee05('0x5')](),controller[_0xee05('0x8')]);router[_0xee05('0x4')]('/:id',auth[_0xee05('0x5')](),controller[_0xee05('0x9')]);router['post']('/',auth[_0xee05('0x5')](),controller[_0xee05('0xa')]);router[_0xee05('0xb')](_0xee05('0xc'),auth[_0xee05('0x5')](),controller['update']);router[_0xee05('0xd')](_0xee05('0xc'),auth[_0xee05('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa2bd=['show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x35de8a,_0x7acd4b){var _0x9c759d=function(_0x1fc3d3){while(--_0x1fc3d3){_0x35de8a['push'](_0x35de8a['shift']());}};_0x9c759d(++_0x7acd4b);}(_0xa2bd,0x86));var _0xda2b=function(_0x36bfe3,_0x358938){_0x36bfe3=_0x36bfe3-0x0;var _0x9b0436=_0xa2bd[_0x36bfe3];return _0x9b0436;};'use strict';var multer=require(_0xda2b('0x0'));var util=require(_0xda2b('0x1'));var path=require('path');var timeout=require(_0xda2b('0x2'));var express=require('express');var router=express[_0xda2b('0x3')]();var fs_extra=require(_0xda2b('0x4'));var auth=require(_0xda2b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xda2b('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xda2b('0x7')]('/',auth[_0xda2b('0x8')](),controller[_0xda2b('0x9')]);router['get'](_0xda2b('0xa'),auth['isAuthenticated'](),controller[_0xda2b('0xb')]);router['get'](_0xda2b('0xc'),auth[_0xda2b('0x8')](),controller[_0xda2b('0xd')]);router[_0xda2b('0xe')]('/',auth['isAuthenticated'](),controller[_0xda2b('0xf')]);router[_0xda2b('0x10')](_0xda2b('0xc'),auth[_0xda2b('0x8')](),controller[_0xda2b('0x11')]);router[_0xda2b('0x12')](_0xda2b('0xc'),auth[_0xda2b('0x8')](),controller[_0xda2b('0x13')]);module[_0xda2b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index a6e2232..f050ac1 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 _0xc3ba=['attended','STRING','ENUM','Yes','sequelize','moment','exports','blind'];(function(_0x3943fe,_0x553e86){var _0x3193d6=function(_0x8fdf1e){while(--_0x8fdf1e){_0x3943fe['push'](_0x3943fe['shift']());}};_0x3193d6(++_0x553e86);}(_0xc3ba,0x1b4));var _0xac3b=function(_0x2d340c,_0x28a8f7){_0x2d340c=_0x2d340c-0x0;var _0x2c1a32=_0xc3ba[_0x2d340c];return _0x2c1a32;};'use strict';var Sequelize=require(_0xac3b('0x0'));var moment=require(_0xac3b('0x1'));module[_0xac3b('0x2')]={'type':{'type':Sequelize['ENUM'](_0xac3b('0x3'),_0xac3b('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xac3b('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xac3b('0x5')]},'transferercalleridname':{'type':Sequelize[_0xac3b('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xac3b('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xac3b('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xac3b('0x5')]},'transferercontext':{'type':Sequelize[_0xac3b('0x5')]},'transfererexten':{'type':Sequelize[_0xac3b('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xac3b('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xac3b('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xac3b('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xac3b('0x5')]},'transfereecontext':{'type':Sequelize[_0xac3b('0x5')]},'transfereeexten':{'type':Sequelize[_0xac3b('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xac3b('0x5')]},'isexternal':{'type':Sequelize[_0xac3b('0x6')](_0xac3b('0x7'),'No')},'context':{'type':Sequelize[_0xac3b('0x5')]},'extension':{'type':Sequelize[_0xac3b('0x5')]}}; \ No newline at end of file +var _0x84e6=['ENUM','attended','STRING','Yes','sequelize','exports'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0x84e6,0x172));var _0x684e=function(_0x10a743,_0x29160d){_0x10a743=_0x10a743-0x0;var _0x89dae3=_0x84e6[_0x10a743];return _0x89dae3;};'use strict';var Sequelize=require(_0x684e('0x0'));var moment=require('moment');module[_0x684e('0x1')]={'type':{'type':Sequelize[_0x684e('0x2')]('blind',_0x684e('0x3'))},'result':{'type':Sequelize[_0x684e('0x4')]},'transfererchannel':{'type':Sequelize[_0x684e('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x684e('0x4')]},'transferercalleridname':{'type':Sequelize[_0x684e('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x684e('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x684e('0x4')]},'transferercontext':{'type':Sequelize[_0x684e('0x4')]},'transfererexten':{'type':Sequelize[_0x684e('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x684e('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x684e('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x684e('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x684e('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0x684e('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x684e('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 9c32815..d588f9f 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 _0xd0fa=['query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','catch','show','rawAttributes','keys','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','json','apply','reject','update','then','destroy','end','sendStatus','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model'];(function(_0x50c29c,_0x3ab851){var _0x30cec4=function(_0xaaf6d3){while(--_0xaaf6d3){_0x50c29c['push'](_0x50c29c['shift']());}};_0x30cec4(++_0x3ab851);}(_0xd0fa,0x191));var _0xad0f=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xd0fa[_0x8c43de];return _0xa6591b;};'use strict';var pdf=require(_0xad0f('0x0'));var emlformat=require(_0xad0f('0x1'));var rimraf=require(_0xad0f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad0f('0x3'));var rp=require(_0xad0f('0x4'));var moment=require(_0xad0f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xad0f('0x6'));var util=require(_0xad0f('0x7'));var path=require(_0xad0f('0x8'));var sox=require(_0xad0f('0x9'));var csv=require(_0xad0f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad0f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xad0f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xad0f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xad0f('0xe'));var Papa=require(_0xad0f('0xf'));var Redis=require(_0xad0f('0x10'));var authService=require(_0xad0f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xad0f('0x12'));var hardwareService=require(_0xad0f('0x13'));var logger=require(_0xad0f('0x14'))(_0xad0f('0x15'));var utils=require(_0xad0f('0x16'));var config=require(_0xad0f('0x17'));var licenseUtil=require(_0xad0f('0x18'));var db=require(_0xad0f('0x19'))['db'];function respondWithStatusCode(_0x453645,_0x1cc6f4){_0x1cc6f4=_0x1cc6f4||0xcc;return function(_0x8ae605){if(_0x8ae605){return _0x453645['sendStatus'](_0x1cc6f4);}return _0x453645[_0xad0f('0x1a')](_0x1cc6f4)['end']();};}function respondWithResult(_0x3a8fbe,_0x10e201){_0x10e201=_0x10e201||0xc8;return function(_0x51c705){if(_0x51c705){return _0x3a8fbe[_0xad0f('0x1a')](_0x10e201)['json'](_0x51c705);}};}function respondWithFilteredResult(_0x43721f,_0x517476){return function(_0x549956){if(_0x549956){var _0x38526f=_0x549956[_0xad0f('0x1b')],_0x4b2ad8=_0x517476[_0xad0f('0x1c')],_0x579a66=_0x517476['offset']+_0x517476[_0xad0f('0x1d')],_0x14dbbe;if(_0x579a66>=_0x38526f){_0x579a66=_0x38526f;_0x14dbbe=0xc8;}else{_0x14dbbe=0xce;}_0x43721f[_0xad0f('0x1a')](_0x14dbbe);return _0x43721f[_0xad0f('0x1e')]('Content-Range',_0x4b2ad8+'-'+_0x579a66+'/'+_0x38526f)[_0xad0f('0x1f')](_0x549956);}return null;};}function patchUpdates(_0x1ddc73){return function(_0x415530){try{jsonpatch[_0xad0f('0x20')](_0x415530,_0x1ddc73,!![]);}catch(_0x27ceb2){return BPromise[_0xad0f('0x21')](_0x27ceb2);}return _0x415530['save']();};}function saveUpdates(_0xd3ddd,_0x4e210){return function(_0x219b78){if(_0x219b78){return _0x219b78[_0xad0f('0x22')](_0xd3ddd)[_0xad0f('0x23')](function(_0x125feb){return _0x125feb;});}return null;};}function removeEntity(_0x1e4e18,_0x5c9153){return function(_0x508ba3){if(_0x508ba3){return _0x508ba3[_0xad0f('0x24')]()[_0xad0f('0x23')](function(){_0x1e4e18[_0xad0f('0x1a')](0xcc)[_0xad0f('0x25')]();});}};}function handleEntityNotFound(_0x44d9a4,_0x527b2a){return function(_0x4b6912){if(!_0x4b6912){_0x44d9a4[_0xad0f('0x26')](0x194);}return _0x4b6912;};}function handleError(_0x7fda1d,_0x4b5fb4){_0x4b5fb4=_0x4b5fb4||0x1f4;return function(_0x272291){logger['error'](_0x272291[_0xad0f('0x27')]);if(_0x272291[_0xad0f('0x28')]){delete _0x272291[_0xad0f('0x28')];}_0x7fda1d['status'](_0x4b5fb4)[_0xad0f('0x29')](_0x272291);};}exports[_0xad0f('0x2a')]=function(_0x2280f2,_0x381ae0){var _0xa653ff={},_0x548e6b={},_0x351809={'count':0x0,'rows':[]};var _0x26889b=_[_0xad0f('0x2b')](db[_0xad0f('0x2c')]['rawAttributes'],function(_0x41377f){return{'name':_0x41377f[_0xad0f('0x2d')],'type':_0x41377f[_0xad0f('0x2e')][_0xad0f('0x2f')]};});_0x548e6b[_0xad0f('0x30')]=_[_0xad0f('0x2b')](_0x26889b,_0xad0f('0x28'));_0x548e6b['query']=_['keys'](_0x2280f2[_0xad0f('0x31')]);_0x548e6b['filters']=_[_0xad0f('0x32')](_0x548e6b['model'],_0x548e6b[_0xad0f('0x31')]);_0xa653ff[_0xad0f('0x33')]=_['intersection'](_0x548e6b[_0xad0f('0x30')],qs[_0xad0f('0x34')](_0x2280f2[_0xad0f('0x31')][_0xad0f('0x34')]));_0xa653ff[_0xad0f('0x33')]=_0xa653ff[_0xad0f('0x33')][_0xad0f('0x35')]?_0xa653ff[_0xad0f('0x33')]:_0x548e6b[_0xad0f('0x30')];if(!_0x2280f2[_0xad0f('0x31')]['hasOwnProperty'](_0xad0f('0x36'))){_0xa653ff['limit']=qs[_0xad0f('0x1d')](_0x2280f2[_0xad0f('0x31')][_0xad0f('0x1d')]);_0xa653ff[_0xad0f('0x1c')]=qs[_0xad0f('0x1c')](_0x2280f2[_0xad0f('0x31')]['offset']);}_0xa653ff[_0xad0f('0x37')]=qs[_0xad0f('0x38')](_0x2280f2[_0xad0f('0x31')][_0xad0f('0x38')]);_0xa653ff[_0xad0f('0x39')]=qs[_0xad0f('0x3a')](_[_0xad0f('0x3b')](_0x2280f2['query'],_0x548e6b[_0xad0f('0x3a')]),_0x26889b);if(_0x2280f2[_0xad0f('0x31')]['filter']){_0xa653ff['where']=_[_0xad0f('0x3c')](_0xa653ff[_0xad0f('0x39')],{'$or':_[_0xad0f('0x2b')](_0x26889b,function(_0x3d7d29){if(_0x3d7d29[_0xad0f('0x2e')]!==_0xad0f('0x3d')){var _0x2cad23={};_0x2cad23[_0x3d7d29['name']]={'$like':'%'+_0x2280f2[_0xad0f('0x31')][_0xad0f('0x3e')]+'%'};return _0x2cad23;}})});}_0xa653ff=_['merge']({},_0xa653ff,_0x2280f2['options']);var _0x49847c={'where':_0xa653ff[_0xad0f('0x39')]};return db[_0xad0f('0x2c')][_0xad0f('0x1b')](_0x49847c)[_0xad0f('0x23')](function(_0x3625d1){_0x351809['count']=_0x3625d1;if(_0x2280f2[_0xad0f('0x31')][_0xad0f('0x3f')]){_0xa653ff[_0xad0f('0x40')]=[{'all':!![]}];}return db[_0xad0f('0x2c')]['findAll'](_0xa653ff);})[_0xad0f('0x23')](function(_0x1b6e1f){_0x351809['rows']=_0x1b6e1f;return _0x351809;})[_0xad0f('0x23')](respondWithFilteredResult(_0x381ae0,_0xa653ff))[_0xad0f('0x41')](handleError(_0x381ae0,null));};exports[_0xad0f('0x42')]=function(_0x24d163,_0x55e89d){var _0x3d9ead={'raw':!![],'where':{'id':_0x24d163['params']['id']}},_0x3352be={};_0x3352be[_0xad0f('0x30')]=_['keys'](db[_0xad0f('0x2c')][_0xad0f('0x43')]);_0x3352be['query']=_[_0xad0f('0x44')](_0x24d163['query']);_0x3352be['filters']=_[_0xad0f('0x32')](_0x3352be[_0xad0f('0x30')],_0x3352be['query']);_0x3d9ead[_0xad0f('0x33')]=_[_0xad0f('0x32')](_0x3352be['model'],qs['fields'](_0x24d163[_0xad0f('0x31')]['fields']));_0x3d9ead[_0xad0f('0x33')]=_0x3d9ead[_0xad0f('0x33')]['length']?_0x3d9ead[_0xad0f('0x33')]:_0x3352be[_0xad0f('0x30')];if(_0x24d163['query'][_0xad0f('0x3f')]){_0x3d9ead[_0xad0f('0x40')]=[{'all':!![]}];}_0x3d9ead=_['merge']({},_0x3d9ead,_0x24d163[_0xad0f('0x45')]);return db[_0xad0f('0x2c')][_0xad0f('0x46')](_0x3d9ead)[_0xad0f('0x23')](handleEntityNotFound(_0x55e89d,null))[_0xad0f('0x23')](respondWithResult(_0x55e89d,null))[_0xad0f('0x41')](handleError(_0x55e89d,null));};exports[_0xad0f('0x47')]=function(_0x5f11b2,_0x5930d8){return db[_0xad0f('0x2c')][_0xad0f('0x47')](_0x5f11b2['body'],{})[_0xad0f('0x23')](respondWithResult(_0x5930d8,0xc9))[_0xad0f('0x41')](handleError(_0x5930d8,null));};exports[_0xad0f('0x22')]=function(_0x570674,_0x275eca){if(_0x570674[_0xad0f('0x48')]['id']){delete _0x570674[_0xad0f('0x48')]['id'];}return db['VoiceTransferReport'][_0xad0f('0x46')]({'where':{'id':_0x570674['params']['id']}})[_0xad0f('0x23')](handleEntityNotFound(_0x275eca,null))['then'](saveUpdates(_0x570674['body'],null))[_0xad0f('0x23')](respondWithResult(_0x275eca,null))[_0xad0f('0x41')](handleError(_0x275eca,null));};exports[_0xad0f('0x24')]=function(_0x5de315,_0x2ae1df){return db[_0xad0f('0x2c')][_0xad0f('0x46')]({'where':{'id':_0x5de315[_0xad0f('0x49')]['id']}})[_0xad0f('0x23')](handleEntityNotFound(_0x2ae1df,null))[_0xad0f('0x23')](removeEntity(_0x2ae1df,null))[_0xad0f('0x41')](handleError(_0x2ae1df,null));};exports['describe']=function(_0x3245fd,_0x2fc5f6){return db['VoiceTransferReport'][_0xad0f('0x4a')]()[_0xad0f('0x23')](respondWithResult(_0x2fc5f6,null))[_0xad0f('0x41')](handleError(_0x2fc5f6,null));}; \ No newline at end of file +var _0x857c=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','VoiceTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','length','merge','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x20af3b,_0x8a33a5){var _0x4f815d=function(_0x1e93b3){while(--_0x1e93b3){_0x20af3b['push'](_0x20af3b['shift']());}};_0x4f815d(++_0x8a33a5);}(_0x857c,0xd6));var _0xc857=function(_0x576826,_0x4cd297){_0x576826=_0x576826-0x0;var _0x1e8675=_0x857c[_0x576826];return _0x1e8675;};'use strict';var pdf=require(_0xc857('0x0'));var emlformat=require(_0xc857('0x1'));var rimraf=require(_0xc857('0x2'));var zipdir=require(_0xc857('0x3'));var jsonpatch=require(_0xc857('0x4'));var rp=require(_0xc857('0x5'));var moment=require('moment');var BPromise=require(_0xc857('0x6'));var Mustache=require('mustache');var util=require(_0xc857('0x7'));var path=require('path');var sox=require(_0xc857('0x8'));var csv=require(_0xc857('0x9'));var ejs=require(_0xc857('0xa'));var fs=require('fs');var fs_extra=require(_0xc857('0xb'));var _=require(_0xc857('0xc'));var squel=require(_0xc857('0xd'));var crypto=require(_0xc857('0xe'));var jsforce=require(_0xc857('0xf'));var deskjs=require(_0xc857('0x10'));var toCsv=require(_0xc857('0x9'));var querystring=require(_0xc857('0x11'));var Papa=require(_0xc857('0x12'));var Redis=require(_0xc857('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc857('0x14'));var as=require(_0xc857('0x15'));var hardwareService=require(_0xc857('0x16'));var logger=require(_0xc857('0x17'))(_0xc857('0x18'));var utils=require(_0xc857('0x19'));var config=require(_0xc857('0x1a'));var licenseUtil=require(_0xc857('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2896f1,_0x12a117){_0x12a117=_0x12a117||0xcc;return function(_0x4786d0){if(_0x4786d0){return _0x2896f1[_0xc857('0x1c')](_0x12a117);}return _0x2896f1[_0xc857('0x1d')](_0x12a117)[_0xc857('0x1e')]();};}function respondWithResult(_0x1078ea,_0x2db74a){_0x2db74a=_0x2db74a||0xc8;return function(_0x548635){if(_0x548635){return _0x1078ea[_0xc857('0x1d')](_0x2db74a)[_0xc857('0x1f')](_0x548635);}};}function respondWithFilteredResult(_0x3c578a,_0x4da52c){return function(_0x1133fc){if(_0x1133fc){var _0x348617=_0x1133fc['count'],_0x91204e=_0x4da52c[_0xc857('0x20')],_0x327b36=_0x4da52c[_0xc857('0x20')]+_0x4da52c['limit'],_0x564f71;if(_0x327b36>=_0x348617){_0x327b36=_0x348617;_0x564f71=0xc8;}else{_0x564f71=0xce;}_0x3c578a['status'](_0x564f71);return _0x3c578a[_0xc857('0x21')](_0xc857('0x22'),_0x91204e+'-'+_0x327b36+'/'+_0x348617)[_0xc857('0x1f')](_0x1133fc);}return null;};}function patchUpdates(_0x3d7623){return function(_0x55b76a){try{jsonpatch[_0xc857('0x23')](_0x55b76a,_0x3d7623,!![]);}catch(_0x3b90bc){return BPromise['reject'](_0x3b90bc);}return _0x55b76a[_0xc857('0x24')]();};}function saveUpdates(_0x1fd411,_0x144d93){return function(_0x3d57c4){if(_0x3d57c4){return _0x3d57c4[_0xc857('0x25')](_0x1fd411)[_0xc857('0x26')](function(_0x2c3d81){return _0x2c3d81;});}return null;};}function removeEntity(_0x9b257c,_0x30b33f){return function(_0x4200f8){if(_0x4200f8){return _0x4200f8[_0xc857('0x27')]()[_0xc857('0x26')](function(){_0x9b257c['status'](0xcc)[_0xc857('0x1e')]();});}};}function handleEntityNotFound(_0xd847f,_0x13f9fe){return function(_0x5a818e){if(!_0x5a818e){_0xd847f[_0xc857('0x1c')](0x194);}return _0x5a818e;};}function handleError(_0x357827,_0x197e26){_0x197e26=_0x197e26||0x1f4;return function(_0x2359a8){logger['error'](_0x2359a8[_0xc857('0x28')]);if(_0x2359a8['name']){delete _0x2359a8[_0xc857('0x29')];}_0x357827[_0xc857('0x1d')](_0x197e26)['send'](_0x2359a8);};}exports['index']=function(_0x16b47b,_0x47e373){var _0x985bf6={},_0xc45c68={},_0xa3fdf9={'count':0x0,'rows':[]};var _0x101956=_['map'](db[_0xc857('0x2a')][_0xc857('0x2b')],function(_0x569b41){return{'name':_0x569b41[_0xc857('0x2c')],'type':_0x569b41[_0xc857('0x2d')][_0xc857('0x2e')]};});_0xc45c68[_0xc857('0x2f')]=_[_0xc857('0x30')](_0x101956,_0xc857('0x29'));_0xc45c68[_0xc857('0x31')]=_[_0xc857('0x32')](_0x16b47b['query']);_0xc45c68[_0xc857('0x33')]=_[_0xc857('0x34')](_0xc45c68[_0xc857('0x2f')],_0xc45c68[_0xc857('0x31')]);_0x985bf6[_0xc857('0x35')]=_[_0xc857('0x34')](_0xc45c68['model'],qs['fields'](_0x16b47b[_0xc857('0x31')][_0xc857('0x36')]));_0x985bf6['attributes']=_0x985bf6[_0xc857('0x35')]['length']?_0x985bf6[_0xc857('0x35')]:_0xc45c68[_0xc857('0x2f')];if(!_0x16b47b['query'][_0xc857('0x37')]('nolimit')){_0x985bf6[_0xc857('0x38')]=qs['limit'](_0x16b47b[_0xc857('0x31')]['limit']);_0x985bf6[_0xc857('0x20')]=qs[_0xc857('0x20')](_0x16b47b[_0xc857('0x31')]['offset']);}_0x985bf6[_0xc857('0x39')]=qs[_0xc857('0x3a')](_0x16b47b[_0xc857('0x31')][_0xc857('0x3a')]);_0x985bf6[_0xc857('0x3b')]=qs[_0xc857('0x33')](_[_0xc857('0x3c')](_0x16b47b['query'],_0xc45c68[_0xc857('0x33')]),_0x101956);if(_0x16b47b[_0xc857('0x31')][_0xc857('0x3d')]){_0x985bf6[_0xc857('0x3b')]=_['merge'](_0x985bf6[_0xc857('0x3b')],{'$or':_[_0xc857('0x30')](_0x101956,function(_0x6f82ce){if(_0x6f82ce[_0xc857('0x2d')]!==_0xc857('0x3e')){var _0x456159={};_0x456159[_0x6f82ce['name']]={'$like':'%'+_0x16b47b[_0xc857('0x31')][_0xc857('0x3d')]+'%'};return _0x456159;}})});}_0x985bf6=_['merge']({},_0x985bf6,_0x16b47b[_0xc857('0x3f')]);var _0x3ac065={'where':_0x985bf6[_0xc857('0x3b')]};return db[_0xc857('0x2a')]['count'](_0x3ac065)['then'](function(_0x2e388a){_0xa3fdf9[_0xc857('0x40')]=_0x2e388a;if(_0x16b47b[_0xc857('0x31')][_0xc857('0x41')]){_0x985bf6['include']=[{'all':!![]}];}return db[_0xc857('0x2a')][_0xc857('0x42')](_0x985bf6);})[_0xc857('0x26')](function(_0x2faae1){_0xa3fdf9[_0xc857('0x43')]=_0x2faae1;return _0xa3fdf9;})[_0xc857('0x26')](respondWithFilteredResult(_0x47e373,_0x985bf6))[_0xc857('0x44')](handleError(_0x47e373,null));};exports[_0xc857('0x45')]=function(_0x41284e,_0x1c73c8){var _0x16ffc0={'raw':!![],'where':{'id':_0x41284e[_0xc857('0x46')]['id']}},_0x1d7abe={};_0x1d7abe['model']=_['keys'](db[_0xc857('0x2a')][_0xc857('0x2b')]);_0x1d7abe[_0xc857('0x31')]=_[_0xc857('0x32')](_0x41284e[_0xc857('0x31')]);_0x1d7abe[_0xc857('0x33')]=_[_0xc857('0x34')](_0x1d7abe[_0xc857('0x2f')],_0x1d7abe[_0xc857('0x31')]);_0x16ffc0[_0xc857('0x35')]=_['intersection'](_0x1d7abe[_0xc857('0x2f')],qs[_0xc857('0x36')](_0x41284e['query'][_0xc857('0x36')]));_0x16ffc0[_0xc857('0x35')]=_0x16ffc0['attributes'][_0xc857('0x47')]?_0x16ffc0[_0xc857('0x35')]:_0x1d7abe[_0xc857('0x2f')];if(_0x41284e[_0xc857('0x31')][_0xc857('0x41')]){_0x16ffc0['include']=[{'all':!![]}];}_0x16ffc0=_[_0xc857('0x48')]({},_0x16ffc0,_0x41284e[_0xc857('0x3f')]);return db[_0xc857('0x2a')][_0xc857('0x49')](_0x16ffc0)[_0xc857('0x26')](handleEntityNotFound(_0x1c73c8,null))[_0xc857('0x26')](respondWithResult(_0x1c73c8,null))[_0xc857('0x44')](handleError(_0x1c73c8,null));};exports[_0xc857('0x4a')]=function(_0x2fad1d,_0x502739){return db[_0xc857('0x2a')][_0xc857('0x4a')](_0x2fad1d[_0xc857('0x4b')],{})[_0xc857('0x26')](respondWithResult(_0x502739,0xc9))[_0xc857('0x44')](handleError(_0x502739,null));};exports[_0xc857('0x25')]=function(_0x3d2ac7,_0x42e09e){if(_0x3d2ac7['body']['id']){delete _0x3d2ac7[_0xc857('0x4b')]['id'];}return db[_0xc857('0x2a')][_0xc857('0x49')]({'where':{'id':_0x3d2ac7[_0xc857('0x46')]['id']}})['then'](handleEntityNotFound(_0x42e09e,null))[_0xc857('0x26')](saveUpdates(_0x3d2ac7['body'],null))[_0xc857('0x26')](respondWithResult(_0x42e09e,null))['catch'](handleError(_0x42e09e,null));};exports[_0xc857('0x27')]=function(_0x5ae626,_0x18a8fc){return db[_0xc857('0x2a')][_0xc857('0x49')]({'where':{'id':_0x5ae626[_0xc857('0x46')]['id']}})[_0xc857('0x26')](handleEntityNotFound(_0x18a8fc,null))[_0xc857('0x26')](removeEntity(_0x18a8fc,null))[_0xc857('0x44')](handleError(_0x18a8fc,null));};exports[_0xc857('0x4c')]=function(_0x378a7e,_0x155d8f){return db[_0xc857('0x2a')][_0xc857('0x4c')]()[_0xc857('0x26')](respondWithResult(_0x155d8f,null))['catch'](handleError(_0x155d8f,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index e9e3957..00edb13 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 _0x46a7=['define','report_call_transfer','../../config/logger','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes'];(function(_0x323021,_0x30f030){var _0x52cb3e=function(_0x3b5a4e){while(--_0x3b5a4e){_0x323021['push'](_0x323021['shift']());}};_0x52cb3e(++_0x30f030);}(_0x46a7,0x92));var _0x746a=function(_0x208e8f,_0x830c3e){_0x208e8f=_0x208e8f-0x0;var _0x283291=_0x46a7[_0x208e8f];return _0x283291;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x746a('0x0'))('api');var moment=require('moment');var BPromise=require(_0x746a('0x1'));var rp=require(_0x746a('0x2'));var fs=require('fs');var path=require(_0x746a('0x3'));var rimraf=require('rimraf');var config=require(_0x746a('0x4'));var attributes=require(_0x746a('0x5'));module['exports']=function(_0x46d6fe,_0xbb31d7){return _0x46d6fe[_0x746a('0x6')]('VoiceTransferReport',attributes,{'tableName':_0x746a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc19a=['api','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','VoiceTransferReport','lodash','util','../../config/logger'];(function(_0x534434,_0x3309d0){var _0x1a4e2c=function(_0x5b339d){while(--_0x5b339d){_0x534434['push'](_0x534434['shift']());}};_0x1a4e2c(++_0x3309d0);}(_0xc19a,0x7f));var _0xac19=function(_0x38feae,_0x51a3cc){_0x38feae=_0x38feae-0x0;var _0x596951=_0xc19a[_0x38feae];return _0x596951;};'use strict';var _=require(_0xac19('0x0'));var util=require(_0xac19('0x1'));var logger=require(_0xac19('0x2'))(_0xac19('0x3'));var moment=require('moment');var BPromise=require(_0xac19('0x4'));var rp=require(_0xac19('0x5'));var fs=require('fs');var path=require(_0xac19('0x6'));var rimraf=require('rimraf');var config=require(_0xac19('0x7'));var attributes=require(_0xac19('0x8'));module['exports']=function(_0x473377,_0x17c0d7){return _0x473377['define'](_0xac19('0x9'),attributes,{'tableName':'report_call_transfer','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 7f4f7ca..95dfced 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 _0x3f49=['VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','body','options','raw','CreateVoiceTransferReport','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0xf5f512,_0x131ec0){var _0x1940c9=function(_0x3e6795){while(--_0x3e6795){_0xf5f512['push'](_0xf5f512['shift']());}};_0x1940c9(++_0x131ec0);}(_0x3f49,0x11f));var _0x93f4=function(_0x232c58,_0x3c3b08){_0x232c58=_0x232c58-0x0;var _0x211154=_0x3f49[_0x232c58];return _0x211154;};'use strict';var _=require(_0x93f4('0x0'));var util=require(_0x93f4('0x1'));var moment=require('moment');var BPromise=require(_0x93f4('0x2'));var rs=require(_0x93f4('0x3'));var fs=require('fs');var Redis=require(_0x93f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x93f4('0x5'));var logger=require(_0x93f4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x93f4('0x7'));var client=jayson[_0x93f4('0x8')][_0x93f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a86ad,_0x956b50,_0x5d22d9){return new BPromise(function(_0x144f31,_0x5e5b4d){return client[_0x93f4('0xa')](_0x5a86ad,_0x5d22d9)[_0x93f4('0xb')](function(_0x325984){logger[_0x93f4('0xc')](_0x93f4('0xd'),_0x956b50,_0x93f4('0xe'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x956b50,_0x93f4('0xe'),JSON[_0x93f4('0xf')](_0x325984));if(_0x325984[_0x93f4('0x10')]){if(_0x325984[_0x93f4('0x10')][_0x93f4('0x11')]===0x1f4){logger[_0x93f4('0x10')](_0x93f4('0xd'),_0x956b50,_0x325984[_0x93f4('0x10')]['message']);return _0x5e5b4d(_0x325984[_0x93f4('0x10')]['message']);}logger['error'](_0x93f4('0xd'),_0x956b50,_0x325984[_0x93f4('0x10')][_0x93f4('0x12')]);return _0x144f31(_0x325984['error']['message']);}else{logger[_0x93f4('0xc')](_0x93f4('0xd'),_0x956b50,_0x93f4('0xe'));_0x144f31(_0x325984['result'][_0x93f4('0x12')]);}})[_0x93f4('0x13')](function(_0x53151e){logger[_0x93f4('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x956b50,_0x53151e);_0x5e5b4d(_0x53151e);});});}exports['CreateVoiceTransferReport']=function(_0x1d4773){var _0x5b6488=this;return new Promise(function(_0x38d8b6,_0x556fc6){return db['VoiceTransferReport']['create'](_0x1d4773[_0x93f4('0x14')],{'raw':_0x1d4773[_0x93f4('0x15')]?_0x1d4773['options'][_0x93f4('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x3ead08){logger[_0x93f4('0xc')](_0x93f4('0x17'),_0x1d4773);logger[_0x93f4('0x18')]('CreateVoiceTransferReport',_0x1d4773,JSON['stringify'](_0x3ead08));_0x38d8b6(_0x3ead08);})[_0x93f4('0x13')](function(_0x432f99){logger['error']('CreateVoiceTransferReport',_0x432f99['message'],_0x1d4773);_0x556fc6(_0x5b6488[_0x93f4('0x10')](0x1f4,_0x432f99[_0x93f4('0x12')]));});});}; \ No newline at end of file +var _0x1020=['VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x33f777,_0x42e860){var _0x56024d=function(_0x3f7327){while(--_0x3f7327){_0x33f777['push'](_0x33f777['shift']());}};_0x56024d(++_0x42e860);}(_0x1020,0x1a4));var _0x0102=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0x1020[_0x4d674b];return _0x535a1f;};'use strict';var _=require(_0x0102('0x0'));var util=require('util');var moment=require(_0x0102('0x1'));var BPromise=require(_0x0102('0x2'));var rs=require(_0x0102('0x3'));var fs=require('fs');var Redis=require(_0x0102('0x4'));var db=require(_0x0102('0x5'))['db'];var utils=require(_0x0102('0x6'));var logger=require(_0x0102('0x7'))(_0x0102('0x8'));var config=require(_0x0102('0x9'));var jayson=require(_0x0102('0xa'));var client=jayson[_0x0102('0xb')][_0x0102('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55229f,_0x26804d,_0x1aa60e){return new BPromise(function(_0x43df9f,_0x5ea57e){return client['request'](_0x55229f,_0x1aa60e)[_0x0102('0xd')](function(_0x566659){logger['info'](_0x0102('0xe'),_0x26804d,_0x0102('0xf'));logger[_0x0102('0x10')](_0x0102('0x11'),_0x26804d,_0x0102('0xf'),JSON['stringify'](_0x566659));if(_0x566659[_0x0102('0x12')]){if(_0x566659[_0x0102('0x12')][_0x0102('0x13')]===0x1f4){logger[_0x0102('0x12')](_0x0102('0xe'),_0x26804d,_0x566659[_0x0102('0x12')][_0x0102('0x14')]);return _0x5ea57e(_0x566659[_0x0102('0x12')][_0x0102('0x14')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x26804d,_0x566659[_0x0102('0x12')][_0x0102('0x14')]);return _0x43df9f(_0x566659[_0x0102('0x12')][_0x0102('0x14')]);}else{logger[_0x0102('0x15')](_0x0102('0xe'),_0x26804d,_0x0102('0xf'));_0x43df9f(_0x566659[_0x0102('0x16')][_0x0102('0x14')]);}})[_0x0102('0x17')](function(_0x38fab3){logger['error'](_0x0102('0xe'),_0x26804d,_0x38fab3);_0x5ea57e(_0x38fab3);});});}exports['CreateVoiceTransferReport']=function(_0x58ba05){var _0x4f3266=this;return new Promise(function(_0x246a2a,_0x1ac23e){return db[_0x0102('0x18')][_0x0102('0x19')](_0x58ba05[_0x0102('0x1a')],{'raw':_0x58ba05[_0x0102('0x1b')]?_0x58ba05[_0x0102('0x1b')][_0x0102('0x1c')]===undefined?!![]:![]:!![]})[_0x0102('0xd')](function(_0x43eb89){logger[_0x0102('0x15')](_0x0102('0x1d'),_0x58ba05);logger[_0x0102('0x10')](_0x0102('0x1d'),_0x58ba05,JSON[_0x0102('0x1e')](_0x43eb89));_0x246a2a(_0x43eb89);})['catch'](function(_0x2e33a6){logger[_0x0102('0x12')](_0x0102('0x1d'),_0x2e33a6[_0x0102('0x14')],_0x58ba05);_0x1ac23e(_0x4f3266[_0x0102('0x12')](0x1f4,_0x2e33a6['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c039256..f3b51ac 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 _0x6183=['/originate','isAuthenticated','canUpdate','originate','post','/hangup','hangup','answer','/hold','hold','/unhold','unhold','calls','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x287059,_0x499940){var _0x225c79=function(_0x3aa36e){while(--_0x3aa36e){_0x287059['push'](_0x287059['shift']());}};_0x225c79(++_0x499940);}(_0x6183,0x19b));var _0x3618=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x6183[_0x44bcb0];return _0xfaf881;};'use strict';var express=require('express');var router=express[_0x3618('0x0')]();var auth=require(_0x3618('0x1'));var controller=require(_0x3618('0x2'));router['post'](_0x3618('0x3'),auth[_0x3618('0x4')](),auth[_0x3618('0x5')](),controller[_0x3618('0x6')]);router[_0x3618('0x7')](_0x3618('0x8'),auth[_0x3618('0x4')](),auth[_0x3618('0x5')](),controller[_0x3618('0x9')]);router[_0x3618('0x7')]('/answer',auth['isAuthenticated'](),auth[_0x3618('0x5')](),controller[_0x3618('0xa')]);router[_0x3618('0x7')](_0x3618('0xb'),auth[_0x3618('0x4')](),auth[_0x3618('0x5')](),controller[_0x3618('0xc')]);router[_0x3618('0x7')](_0x3618('0xd'),auth[_0x3618('0x4')](),auth[_0x3618('0x5')](),controller[_0x3618('0xe')]);router['post']('/calls',auth[_0x3618('0x4')](),auth['canUpdate'](),controller[_0x3618('0xf')]);router[_0x3618('0x7')]('/transfer',auth[_0x3618('0x4')](),auth[_0x3618('0x5')](),controller[_0x3618('0x10')]);module[_0x3618('0x11')]=router; \ No newline at end of file +var _0x1da1=['unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','canUpdate','originate','isAuthenticated','hangup','/hold','hold','/unhold'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0x1da1,0x1a4));var _0x11da=function(_0x15efef,_0x150e24){_0x15efef=_0x15efef-0x0;var _0x5aa2a6=_0x1da1[_0x15efef];return _0x5aa2a6;};'use strict';var express=require(_0x11da('0x0'));var router=express[_0x11da('0x1')]();var auth=require(_0x11da('0x2'));var controller=require(_0x11da('0x3'));router[_0x11da('0x4')]('/originate',auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0x6')]);router[_0x11da('0x4')]('/hangup',auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller[_0x11da('0x8')]);router['post']('/answer',auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller['answer']);router[_0x11da('0x4')](_0x11da('0x9'),auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0xa')]);router[_0x11da('0x4')](_0x11da('0xb'),auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller[_0x11da('0xc')]);router[_0x11da('0x4')](_0x11da('0xd'),auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0xe')]);router[_0x11da('0x4')](_0x11da('0xf'),auth[_0x11da('0x7')](),auth['canUpdate'](),controller[_0x11da('0x10')]);module[_0x11da('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index e2d1146..ec9b3f5 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 _0x34ea=['catch','hangup','hangup\x20fired:','entityFound:','webbar:hangup','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','userId','hold\x20executed!','unhold','unhold\x20executed!','calls','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','NotFound','code','message','result','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!'];(function(_0x49e58d,_0x5393ab){var _0x432667=function(_0x306803){while(--_0x306803){_0x49e58d['push'](_0x49e58d['shift']());}};_0x432667(++_0x5393ab);}(_0x34ea,0xa8));var _0xa34e=function(_0x31ab6c,_0x1e2c45){_0x31ab6c=_0x31ab6c-0x0;var _0x1f63ea=_0x34ea[_0x31ab6c];return _0x1f63ea;};'use strict';var path=require(_0xa34e('0x0'));var fs=require('fs');var _=require(_0xa34e('0x1'));var db=require(_0xa34e('0x2'))['db'];var config=require(_0xa34e('0x3'));var util=require(_0xa34e('0x4'));var BPromise=require(_0xa34e('0x5'));var jayson=require(_0xa34e('0x6'));var amiClient=jayson[_0xa34e('0x7')][_0xa34e('0x8')]({'port':0x232a});var logger=require(_0xa34e('0x9'))('webbarapi');var Redis=require(_0xa34e('0xa'));config['redis']=_['defaults'](config[_0xa34e('0xb')],{'host':_0xa34e('0xc'),'port':0x18eb});var io=require(_0xa34e('0xd'))(new Redis(config['redis']));var Schema=require(_0xa34e('0xe'));var originateValidation=new Schema({'userId':{'type':_0xa34e('0xf'),'required':[!![],_0xa34e('0x10')]},'callNumber':{'type':_0xa34e('0x11'),'required':[!![],_0xa34e('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xa34e('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa34e('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa34e('0x10')]},'sessionId':{'type':_0xa34e('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa34e('0xf'),'required':[!![],_0xa34e('0x10')]},'sessionId':{'type':_0xa34e('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xa34e('0x11'),'required':[!![],_0xa34e('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xa34e('0xf'),'required':[!![],_0xa34e('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa34e('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa34e('0xf'),'required':[!![],_0xa34e('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa34e('0xf'),'required':[!![],_0xa34e('0x10')]}});function emit(_0x121383,_0x51a28f,_0x54cc26){logger[_0xa34e('0x14')](_0x121383,_0x51a28f,JSON[_0xa34e('0x15')](_0x54cc26));io['to'](_0x121383)[_0xa34e('0x16')](_0x51a28f,_0x54cc26);}function handleError(_0x1b94cc){return function(_0x1d5cf5){console[_0xa34e('0x17')](_0xa34e('0x18'),_0x1d5cf5,_0x1d5cf5 instanceof RangeError);logger[_0xa34e('0x19')](_0x1d5cf5[_0xa34e('0x1a')]);if(_0x1d5cf5 instanceof RangeError){if(_0x1d5cf5[_0xa34e('0x1b')]){delete _0x1d5cf5[_0xa34e('0x1b')];}_0x1b94cc[_0xa34e('0x1c')](0x194)['send'](_0x1d5cf5);}else{if(_0x1d5cf5['name']){delete _0x1d5cf5[_0xa34e('0x1b')];}_0x1b94cc[_0xa34e('0x1c')](0x1f4)['send'](_0x1d5cf5);}};}function checkError(){return function(_0x19cd49){if(!_0x19cd49){throw new RangeError(_0xa34e('0x1d'));}return _0x19cd49;};}function respondWithRpcPromise(_0x521e1b,_0x4c4258){return new BPromise(function(_0x3d5795,_0x1ce637){var _0x99801=amiClient;return _0x99801['request'](_0x521e1b,_0x4c4258)['then'](function(_0xcc8b78){if(_0xcc8b78[_0xa34e('0x19')]){if(_0xcc8b78[_0xa34e('0x19')][_0xa34e('0x1e')]===0x1f4){return _0x1ce637(_0xcc8b78[_0xa34e('0x19')][_0xa34e('0x1f')]);}return _0x3d5795(_0xcc8b78[_0xa34e('0x19')]['message']);}else{_0x3d5795(_0xcc8b78[_0xa34e('0x20')]);}})['catch'](function(_0x2cb68f){_0x1ce637(_0x2cb68f);});});}function getAgent(_0x13fbfc){return db['User']['findOne']({'where':{'id':_0x13fbfc,'role':_0xa34e('0x21')}})[_0xa34e('0x22')](checkError());}function getAgentCheckSession(_0x594878,_0x10563c){return new BPromise(function(_0x5abd21,_0x334073){var _0xbb76ec=respondWithRpcPromise(_0xa34e('0x23'));var _0x4c7e10=getAgent(_0x594878);Promise[_0xa34e('0x24')]([_0xbb76ec,_0x4c7e10])['then'](function(_0x5d0ab5){var _0x50c65f=_0x5d0ab5[0x0];var _0x5d4c63=_0x5d0ab5[0x1];var _0x1cea47=_[_0xa34e('0x25')](_0x50c65f[_0xa34e('0x26')],function(_0x1ee157){return _0x1ee157[_0xa34e('0x27')]==_0x5d4c63['id']&&_0x1ee157[_0xa34e('0x28')]==_0x10563c;});if(_0x1cea47[_0xa34e('0x29')]==0x1){_0x5abd21(_0x5d4c63);}else{_0x334073(new RangeError(_0xa34e('0x2a')+_0x10563c+_0xa34e('0x2b')));}});});}exports[_0xa34e('0x2c')]=function(_0x4b7716,_0x374fbb){logger[_0xa34e('0x14')](_0xa34e('0x2d'),_0x4b7716[_0xa34e('0x2e')]);var _0x485df8=originateValidation['validate'](_0x4b7716[_0xa34e('0x2e')]);if(_0x485df8[_0xa34e('0x29')]>0x0){return _0x374fbb[_0xa34e('0x1c')](0x190)[_0xa34e('0x2f')](_0x485df8);}var _0x1da873=_0x4b7716[_0xa34e('0x2e')]['userId'];var _0x32b7ea=_0x4b7716[_0xa34e('0x2e')][_0xa34e('0x30')];var _0x3623ff=_0x4b7716[_0xa34e('0x2e')]['callerId'];var _0x316260=_0x4b7716[_0xa34e('0x2e')][_0xa34e('0x31')];return getAgent(_0x1da873)[_0xa34e('0x22')](function(_0x217081){logger[_0xa34e('0x14')]('entityFound:',_0x217081[_0xa34e('0x1b')]);emit(util[_0xa34e('0x32')](_0xa34e('0x33'),_0x217081[_0xa34e('0x1b')]),_0xa34e('0x34'),{'callNumber':_0x32b7ea,'callerId':_0x3623ff,'callbackUrl':_0x316260});return _0x374fbb[_0xa34e('0x1c')](0xc8)['json']({'error':![],'message':_0xa34e('0x35')});})[_0xa34e('0x36')](handleError(_0x374fbb));};exports[_0xa34e('0x37')]=function(_0x33cac2,_0x4a11be){logger[_0xa34e('0x14')](_0xa34e('0x38'),_0x33cac2[_0xa34e('0x2e')]);var _0x2db59e=hangupValidation[_0xa34e('0xe')](_0x33cac2[_0xa34e('0x2e')]);if(_0x2db59e[_0xa34e('0x29')]>0x0){return _0x4a11be[_0xa34e('0x1c')](0x190)[_0xa34e('0x2f')](_0x2db59e);}var _0x2d8484=_0x33cac2[_0xa34e('0x2e')]['userId'];var _0x55d9a8=_0x33cac2['body'][_0xa34e('0x28')];return getAgent(_0x2d8484)[_0xa34e('0x22')](function(_0x1fc253){logger[_0xa34e('0x14')](_0xa34e('0x39'),_0x1fc253[_0xa34e('0x1b')]);emit(util[_0xa34e('0x32')](_0xa34e('0x33'),_0x1fc253['name']),_0xa34e('0x3a'),{'sessionId':_0x55d9a8});return _0x4a11be['status'](0xc8)[_0xa34e('0x2f')]({'error':![],'message':'hangup\x20executed!'});})[_0xa34e('0x36')](handleError(_0x4a11be));};exports[_0xa34e('0x3b')]=function(_0x906f0c,_0x227666){logger[_0xa34e('0x14')](_0xa34e('0x3c'),_0x906f0c['body']);var _0x478b44=answerValidation['validate'](_0x906f0c[_0xa34e('0x2e')]);if(_0x478b44[_0xa34e('0x29')]>0x0){return _0x227666[_0xa34e('0x1c')](0x190)[_0xa34e('0x2f')](_0x478b44);}var _0x505b73=_0x906f0c[_0xa34e('0x2e')]['userId'];var _0x16bbfc=_0x906f0c[_0xa34e('0x2e')]['sessionId'];return getAgent(_0x505b73)[_0xa34e('0x22')](function(_0xbb253b){logger[_0xa34e('0x14')](_0xa34e('0x39'),_0xbb253b[_0xa34e('0x1b')]);emit(util['format'](_0xa34e('0x33'),_0xbb253b['name']),'webbar:answer',{'sessionId':_0x16bbfc});return _0x227666['status'](0xc8)[_0xa34e('0x2f')]({'error':![],'message':_0xa34e('0x3d')});})[_0xa34e('0x36')](handleError(_0x227666));};exports[_0xa34e('0x3e')]=function(_0x2f6f9d,_0x5e2372){logger['info'](_0xa34e('0x3f'),_0x2f6f9d[_0xa34e('0x2e')]);var _0x30c317=holdValidation[_0xa34e('0xe')](_0x2f6f9d[_0xa34e('0x2e')]);if(_0x30c317[_0xa34e('0x29')]>0x0){return _0x5e2372[_0xa34e('0x1c')](0x190)[_0xa34e('0x2f')](_0x30c317);}var _0x444f6a=_0x2f6f9d[_0xa34e('0x2e')][_0xa34e('0x40')];var _0x318adb=_0x2f6f9d[_0xa34e('0x2e')]['sessionId'];return getAgent(_0x444f6a)['then'](function(_0xcf6e73){logger[_0xa34e('0x14')](_0xa34e('0x39'),_0xcf6e73['name']);emit(util[_0xa34e('0x32')](_0xa34e('0x33'),_0xcf6e73[_0xa34e('0x1b')]),'webbar:hold',{'sessionId':_0x318adb});return _0x5e2372[_0xa34e('0x1c')](0xc8)['json']({'error':![],'message':_0xa34e('0x41')});})['catch'](handleError(_0x5e2372));};exports[_0xa34e('0x42')]=function(_0x3c3aa9,_0x5709e8){logger[_0xa34e('0x14')]('unhold\x20fired:',_0x3c3aa9[_0xa34e('0x2e')]);var _0x2e086c=unholdValidation['validate'](_0x3c3aa9[_0xa34e('0x2e')]);if(_0x2e086c[_0xa34e('0x29')]>0x0){return _0x5709e8['status'](0x190)[_0xa34e('0x2f')](_0x2e086c);}var _0x290aa6=_0x3c3aa9[_0xa34e('0x2e')][_0xa34e('0x40')];var _0x203a87=_0x3c3aa9[_0xa34e('0x2e')][_0xa34e('0x28')];return getAgent(_0x290aa6)['then'](function(_0x570736){logger[_0xa34e('0x14')]('entityFound:',_0x570736[_0xa34e('0x1b')]);emit(util[_0xa34e('0x32')]('user:%s',_0x570736[_0xa34e('0x1b')]),'webbar:unhold',{'sessionId':_0x203a87});return _0x5709e8[_0xa34e('0x1c')](0xc8)[_0xa34e('0x2f')]({'error':![],'message':_0xa34e('0x43')});})[_0xa34e('0x36')](handleError(_0x5709e8));};exports[_0xa34e('0x44')]=function(_0x5d1890,_0x944ada){logger[_0xa34e('0x14')]('calls\x20fired:',_0x944ada['body']);var _0x138ab1=callsValidation[_0xa34e('0xe')](_0x5d1890[_0xa34e('0x2e')]);if(_0x138ab1[_0xa34e('0x29')]>0x0){return _0x944ada[_0xa34e('0x1c')](0x190)[_0xa34e('0x2f')](_0x138ab1);}var _0x49b3b2=_0x5d1890[_0xa34e('0x2e')][_0xa34e('0x40')];var _0x3769de=respondWithRpcPromise(_0xa34e('0x23'));var _0x46766b=getAgent(_0x49b3b2);return Promise[_0xa34e('0x24')]([_0x3769de,_0x46766b])[_0xa34e('0x22')](function(_0x46fa75){var _0x545bf9=_0x46fa75[0x0];var _0xcd0f89=_0x46fa75[0x1];var _0x23e4c6=_[_0xa34e('0x25')](_0x545bf9[_0xa34e('0x26')],function(_0x4d1680){return _0x4d1680[_0xa34e('0x27')]==_0xcd0f89['id'];});return _0x944ada[_0xa34e('0x1c')](0xc8)[_0xa34e('0x2f')]({'count':_0x23e4c6['length'],'rows':_0x23e4c6});})[_0xa34e('0x36')](handleError(_0x944ada));};exports['conference']=function(_0x35bfd5,_0x46b047){logger[_0xa34e('0x14')]('conference\x20fired:',_0x35bfd5['body']);var _0x420bca=conferenceValidation['validate'](_0x35bfd5[_0xa34e('0x2e')]);if(_0x420bca[_0xa34e('0x29')]>0x0){return _0x46b047[_0xa34e('0x1c')](0x190)[_0xa34e('0x2f')](_0x420bca);}var _0x4fd092=_0x35bfd5['body'][_0xa34e('0x40')];return getAgent(_0x4fd092)['then'](function(_0xd9d7d0){logger[_0xa34e('0x14')](_0xa34e('0x39'),_0xd9d7d0['name']);emit(util['format'](_0xa34e('0x33'),_0xd9d7d0['name']),'webbar:conference');return _0x46b047[_0xa34e('0x1c')](0xc8)[_0xa34e('0x2f')]({'error':![],'message':_0xa34e('0x45')});})[_0xa34e('0x36')](handleError(_0x46b047));};exports[_0xa34e('0x46')]=function(_0x34ef83,_0x248635){logger[_0xa34e('0x14')]('transfer\x20fired:',_0x34ef83[_0xa34e('0x2e')]);var _0x5ac1e2=transferValidation[_0xa34e('0xe')](_0x34ef83[_0xa34e('0x2e')]);if(_0x5ac1e2[_0xa34e('0x29')]>0x0){return _0x248635['status'](0x190)['json'](_0x5ac1e2);}var _0xa72124=_0x34ef83[_0xa34e('0x2e')][_0xa34e('0x40')];var _0x3ec4cb=_0x34ef83['body'][_0xa34e('0x28')];var _0x577996=_0x34ef83[_0xa34e('0x2e')][_0xa34e('0x47')];return getAgent(_0xa72124)[_0xa34e('0x22')](function(_0x311ecc){logger['info']('entityFound:',_0x311ecc[_0xa34e('0x1b')]);emit(util['format'](_0xa34e('0x33'),_0x311ecc[_0xa34e('0x1b')]),_0xa34e('0x48'),{'sessionId':_0x3ec4cb,'transferNumber':_0x577996});return _0x248635['status'](0xc8)[_0xa34e('0x2f')]({'error':![],'message':_0xa34e('0x49')});})[_0xa34e('0x36')](handleError(_0x248635));}; \ No newline at end of file +var _0x8bdf=['stringify','handleError:','error','stack','name','status','send','NotFound','then','message','catch','findOne','all','sessionId','length','\x20not\x20found!','originate','body','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','userId','webbar:answer','json','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','filter','rows','UserId','conference','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','localhost','socket.io-emitter','redis','validate','userId\x20is\x20required','string','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info'];(function(_0x35bad0,_0x21927d){var _0x4fe50f=function(_0x1873df){while(--_0x1873df){_0x35bad0['push'](_0x35bad0['shift']());}};_0x4fe50f(++_0x21927d);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x8bdf[_0x46aff0];return _0x9d78cf;};'use strict';var path=require(_0xf8bd('0x0'));var fs=require('fs');var _=require(_0xf8bd('0x1'));var db=require(_0xf8bd('0x2'))['db'];var config=require(_0xf8bd('0x3'));var util=require(_0xf8bd('0x4'));var BPromise=require('bluebird');var jayson=require(_0xf8bd('0x5'));var amiClient=jayson[_0xf8bd('0x6')][_0xf8bd('0x7')]({'port':0x232a});var logger=require(_0xf8bd('0x8'))(_0xf8bd('0x9'));var Redis=require(_0xf8bd('0xa'));config['redis']=_['defaults'](config['redis'],{'host':_0xf8bd('0xb'),'port':0x18eb});var io=require(_0xf8bd('0xc'))(new Redis(config[_0xf8bd('0xd')]));var Schema=require(_0xf8bd('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf8bd('0xf')]},'callNumber':{'type':_0xf8bd('0x10'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xf8bd('0x10')},'callbackUrl':{'type':_0xf8bd('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf8bd('0xf')]},'sessionId':{'type':_0xf8bd('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf8bd('0x11'),'required':[!![],_0xf8bd('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf8bd('0x11'),'required':[!![],_0xf8bd('0xf')]},'sessionId':{'type':'string','required':[!![],_0xf8bd('0x12')]},'transferNumber':{'type':'string','required':[!![],_0xf8bd('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xf8bd('0x11'),'required':[!![],_0xf8bd('0xf')]},'sessionId':{'type':_0xf8bd('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf8bd('0x11'),'required':[!![],_0xf8bd('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xf8bd('0x11'),'required':[!![],_0xf8bd('0xf')]}});function emit(_0x54dc30,_0x277123,_0x9d454){logger[_0xf8bd('0x14')](_0x54dc30,_0x277123,JSON[_0xf8bd('0x15')](_0x9d454));io['to'](_0x54dc30)['emit'](_0x277123,_0x9d454);}function handleError(_0x2b9fff){return function(_0x3e69be){console['log'](_0xf8bd('0x16'),_0x3e69be,_0x3e69be instanceof RangeError);logger[_0xf8bd('0x17')](_0x3e69be[_0xf8bd('0x18')]);if(_0x3e69be instanceof RangeError){if(_0x3e69be[_0xf8bd('0x19')]){delete _0x3e69be[_0xf8bd('0x19')];}_0x2b9fff[_0xf8bd('0x1a')](0x194)['send'](_0x3e69be);}else{if(_0x3e69be[_0xf8bd('0x19')]){delete _0x3e69be[_0xf8bd('0x19')];}_0x2b9fff['status'](0x1f4)[_0xf8bd('0x1b')](_0x3e69be);}};}function checkError(){return function(_0x528373){if(!_0x528373){throw new RangeError(_0xf8bd('0x1c'));}return _0x528373;};}function respondWithRpcPromise(_0x1dc352,_0x4b493d){return new BPromise(function(_0x469813,_0x45eb2d){var _0x4c575f=amiClient;return _0x4c575f['request'](_0x1dc352,_0x4b493d)[_0xf8bd('0x1d')](function(_0x4c6ff){if(_0x4c6ff['error']){if(_0x4c6ff[_0xf8bd('0x17')]['code']===0x1f4){return _0x45eb2d(_0x4c6ff[_0xf8bd('0x17')][_0xf8bd('0x1e')]);}return _0x469813(_0x4c6ff['error'][_0xf8bd('0x1e')]);}else{_0x469813(_0x4c6ff['result']);}})[_0xf8bd('0x1f')](function(_0x5b85f5){_0x45eb2d(_0x5b85f5);});});}function getAgent(_0x261e8f){return db['User'][_0xf8bd('0x20')]({'where':{'id':_0x261e8f,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x329a09,_0x5f3453){return new BPromise(function(_0x14b51b,_0x27baa0){var _0x384f2e=respondWithRpcPromise('VoiceChannels');var _0x258d09=getAgent(_0x329a09);Promise[_0xf8bd('0x21')]([_0x384f2e,_0x258d09])[_0xf8bd('0x1d')](function(_0x3aa54a){var _0x4fc088=_0x3aa54a[0x0];var _0x4bff64=_0x3aa54a[0x1];var _0x36a606=_['filter'](_0x4fc088['rows'],function(_0x5407f9){return _0x5407f9['UserId']==_0x4bff64['id']&&_0x5407f9[_0xf8bd('0x22')]==_0x5f3453;});if(_0x36a606[_0xf8bd('0x23')]==0x1){_0x14b51b(_0x4bff64);}else{_0x27baa0(new RangeError('sessionId\x20'+_0x5f3453+_0xf8bd('0x24')));}});});}exports[_0xf8bd('0x25')]=function(_0x4f19f0,_0x588b4c){logger[_0xf8bd('0x14')]('originate\x20fired:',_0x4f19f0[_0xf8bd('0x26')]);var _0x3bc9ed=originateValidation[_0xf8bd('0xe')](_0x4f19f0[_0xf8bd('0x26')]);if(_0x3bc9ed[_0xf8bd('0x23')]>0x0){return _0x588b4c[_0xf8bd('0x1a')](0x190)['json'](_0x3bc9ed);}var _0x3ce045=_0x4f19f0[_0xf8bd('0x26')]['userId'];var _0x4d1c56=_0x4f19f0[_0xf8bd('0x26')][_0xf8bd('0x27')];var _0x48ea32=_0x4f19f0[_0xf8bd('0x26')][_0xf8bd('0x28')];var _0x126529=_0x4f19f0[_0xf8bd('0x26')][_0xf8bd('0x29')];return getAgent(_0x3ce045)[_0xf8bd('0x1d')](function(_0x1b1fe7){logger['info'](_0xf8bd('0x2a'),_0x1b1fe7[_0xf8bd('0x19')]);emit(util[_0xf8bd('0x2b')](_0xf8bd('0x2c'),_0x1b1fe7[_0xf8bd('0x19')]),_0xf8bd('0x2d'),{'callNumber':_0x4d1c56,'callerId':_0x48ea32,'callbackUrl':_0x126529});return _0x588b4c[_0xf8bd('0x1a')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0xf8bd('0x1f')](handleError(_0x588b4c));};exports['hangup']=function(_0x49dee1,_0x393011){logger[_0xf8bd('0x14')](_0xf8bd('0x2e'),_0x49dee1[_0xf8bd('0x26')]);var _0x263522=hangupValidation['validate'](_0x49dee1[_0xf8bd('0x26')]);if(_0x263522[_0xf8bd('0x23')]>0x0){return _0x393011[_0xf8bd('0x1a')](0x190)['json'](_0x263522);}var _0x55b92f=_0x49dee1[_0xf8bd('0x26')]['userId'];var _0x4f4eac=_0x49dee1[_0xf8bd('0x26')]['sessionId'];return getAgent(_0x55b92f)[_0xf8bd('0x1d')](function(_0x37ec39){logger[_0xf8bd('0x14')](_0xf8bd('0x2a'),_0x37ec39[_0xf8bd('0x19')]);emit(util[_0xf8bd('0x2b')](_0xf8bd('0x2c'),_0x37ec39[_0xf8bd('0x19')]),_0xf8bd('0x2f'),{'sessionId':_0x4f4eac});return _0x393011[_0xf8bd('0x1a')](0xc8)['json']({'error':![],'message':_0xf8bd('0x30')});})[_0xf8bd('0x1f')](handleError(_0x393011));};exports[_0xf8bd('0x31')]=function(_0x33af32,_0x48b6da){logger[_0xf8bd('0x14')](_0xf8bd('0x32'),_0x33af32[_0xf8bd('0x26')]);var _0x282a35=answerValidation[_0xf8bd('0xe')](_0x33af32['body']);if(_0x282a35['length']>0x0){return _0x48b6da['status'](0x190)['json'](_0x282a35);}var _0x134da8=_0x33af32[_0xf8bd('0x26')][_0xf8bd('0x33')];var _0x5b9901=_0x33af32[_0xf8bd('0x26')][_0xf8bd('0x22')];return getAgent(_0x134da8)[_0xf8bd('0x1d')](function(_0x187a5e){logger['info'](_0xf8bd('0x2a'),_0x187a5e[_0xf8bd('0x19')]);emit(util[_0xf8bd('0x2b')](_0xf8bd('0x2c'),_0x187a5e[_0xf8bd('0x19')]),_0xf8bd('0x34'),{'sessionId':_0x5b9901});return _0x48b6da[_0xf8bd('0x1a')](0xc8)[_0xf8bd('0x35')]({'error':![],'message':_0xf8bd('0x36')});})['catch'](handleError(_0x48b6da));};exports[_0xf8bd('0x37')]=function(_0x3118ae,_0x3d95af){logger[_0xf8bd('0x14')](_0xf8bd('0x38'),_0x3118ae[_0xf8bd('0x26')]);var _0x714adc=holdValidation['validate'](_0x3118ae[_0xf8bd('0x26')]);if(_0x714adc[_0xf8bd('0x23')]>0x0){return _0x3d95af[_0xf8bd('0x1a')](0x190)['json'](_0x714adc);}var _0x1d6912=_0x3118ae['body'][_0xf8bd('0x33')];var _0x3cebed=_0x3118ae[_0xf8bd('0x26')]['sessionId'];return getAgent(_0x1d6912)[_0xf8bd('0x1d')](function(_0x411023){logger[_0xf8bd('0x14')](_0xf8bd('0x2a'),_0x411023[_0xf8bd('0x19')]);emit(util[_0xf8bd('0x2b')](_0xf8bd('0x2c'),_0x411023[_0xf8bd('0x19')]),_0xf8bd('0x39'),{'sessionId':_0x3cebed});return _0x3d95af[_0xf8bd('0x1a')](0xc8)[_0xf8bd('0x35')]({'error':![],'message':_0xf8bd('0x3a')});})[_0xf8bd('0x1f')](handleError(_0x3d95af));};exports[_0xf8bd('0x3b')]=function(_0x13dbe6,_0x2b0cb9){logger[_0xf8bd('0x14')]('unhold\x20fired:',_0x13dbe6[_0xf8bd('0x26')]);var _0x327377=unholdValidation[_0xf8bd('0xe')](_0x13dbe6[_0xf8bd('0x26')]);if(_0x327377[_0xf8bd('0x23')]>0x0){return _0x2b0cb9[_0xf8bd('0x1a')](0x190)[_0xf8bd('0x35')](_0x327377);}var _0xcf4b86=_0x13dbe6[_0xf8bd('0x26')]['userId'];var _0x2ea54a=_0x13dbe6[_0xf8bd('0x26')][_0xf8bd('0x22')];return getAgent(_0xcf4b86)[_0xf8bd('0x1d')](function(_0xe157f5){logger['info'](_0xf8bd('0x2a'),_0xe157f5[_0xf8bd('0x19')]);emit(util[_0xf8bd('0x2b')](_0xf8bd('0x2c'),_0xe157f5[_0xf8bd('0x19')]),'webbar:unhold',{'sessionId':_0x2ea54a});return _0x2b0cb9[_0xf8bd('0x1a')](0xc8)[_0xf8bd('0x35')]({'error':![],'message':_0xf8bd('0x3c')});})[_0xf8bd('0x1f')](handleError(_0x2b0cb9));};exports[_0xf8bd('0x3d')]=function(_0x5ec466,_0x565c7f){logger['info'](_0xf8bd('0x3e'),_0x565c7f[_0xf8bd('0x26')]);var _0x5ea241=callsValidation['validate'](_0x5ec466['body']);if(_0x5ea241['length']>0x0){return _0x565c7f[_0xf8bd('0x1a')](0x190)['json'](_0x5ea241);}var _0x2f9f5a=_0x5ec466[_0xf8bd('0x26')][_0xf8bd('0x33')];var _0x5163c8=respondWithRpcPromise(_0xf8bd('0x3f'));var _0x312429=getAgent(_0x2f9f5a);return Promise[_0xf8bd('0x21')]([_0x5163c8,_0x312429])[_0xf8bd('0x1d')](function(_0x4a5d3e){var _0x4d24df=_0x4a5d3e[0x0];var _0x483b88=_0x4a5d3e[0x1];var _0x16aa74=_[_0xf8bd('0x40')](_0x4d24df[_0xf8bd('0x41')],function(_0x38f4c7){return _0x38f4c7[_0xf8bd('0x42')]==_0x483b88['id'];});return _0x565c7f['status'](0xc8)[_0xf8bd('0x35')]({'count':_0x16aa74[_0xf8bd('0x23')],'rows':_0x16aa74});})['catch'](handleError(_0x565c7f));};exports[_0xf8bd('0x43')]=function(_0x5962c9,_0x330778){logger[_0xf8bd('0x14')]('conference\x20fired:',_0x5962c9[_0xf8bd('0x26')]);var _0x98993b=conferenceValidation[_0xf8bd('0xe')](_0x5962c9[_0xf8bd('0x26')]);if(_0x98993b[_0xf8bd('0x23')]>0x0){return _0x330778['status'](0x190)[_0xf8bd('0x35')](_0x98993b);}var _0x350101=_0x5962c9[_0xf8bd('0x26')]['userId'];return getAgent(_0x350101)['then'](function(_0x5367ac){logger[_0xf8bd('0x14')]('entityFound:',_0x5367ac['name']);emit(util[_0xf8bd('0x2b')](_0xf8bd('0x2c'),_0x5367ac[_0xf8bd('0x19')]),_0xf8bd('0x44'));return _0x330778[_0xf8bd('0x1a')](0xc8)[_0xf8bd('0x35')]({'error':![],'message':_0xf8bd('0x45')});})[_0xf8bd('0x1f')](handleError(_0x330778));};exports['transfer']=function(_0x16fa16,_0x1af941){logger[_0xf8bd('0x14')](_0xf8bd('0x46'),_0x16fa16['body']);var _0x2266c3=transferValidation[_0xf8bd('0xe')](_0x16fa16[_0xf8bd('0x26')]);if(_0x2266c3[_0xf8bd('0x23')]>0x0){return _0x1af941[_0xf8bd('0x1a')](0x190)['json'](_0x2266c3);}var _0x20d424=_0x16fa16[_0xf8bd('0x26')][_0xf8bd('0x33')];var _0x2e9d18=_0x16fa16[_0xf8bd('0x26')][_0xf8bd('0x22')];var _0xdfa1d4=_0x16fa16[_0xf8bd('0x26')][_0xf8bd('0x47')];return getAgent(_0x20d424)[_0xf8bd('0x1d')](function(_0x12805f){logger[_0xf8bd('0x14')](_0xf8bd('0x2a'),_0x12805f[_0xf8bd('0x19')]);emit(util[_0xf8bd('0x2b')]('user:%s',_0x12805f[_0xf8bd('0x19')]),_0xf8bd('0x48'),{'sessionId':_0x2e9d18,'transferNumber':_0xdfa1d4});return _0x1af941['status'](0xc8)[_0xf8bd('0x35')]({'error':![],'message':_0xf8bd('0x49')});})[_0xf8bd('0x1f')](handleError(_0x1af941));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 53cd02b..c95d356 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 _0xf6ba=['/:id/applications','getApplications','post','create','addAnswer','addAgents','notify','/:id/send','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users'];(function(_0x656c0e,_0x1bfe70){var _0x579406=function(_0x492213){while(--_0x492213){_0x656c0e['push'](_0x656c0e['shift']());}};_0x579406(++_0x1bfe70);}(_0xf6ba,0xae));var _0xaf6b=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xf6ba[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0xaf6b('0x0'));var util=require(_0xaf6b('0x1'));var path=require('path');var timeout=require(_0xaf6b('0x2'));var express=require(_0xaf6b('0x3'));var router=express['Router']();var fs_extra=require(_0xaf6b('0x4'));var auth=require(_0xaf6b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaf6b('0x6'));var controller=require(_0xaf6b('0x7'));router[_0xaf6b('0x8')]('/',auth[_0xaf6b('0x9')](),controller[_0xaf6b('0xa')]);router[_0xaf6b('0x8')]('/describe',auth[_0xaf6b('0x9')](),controller['describe']);router['get'](_0xaf6b('0xb'),auth[_0xaf6b('0x9')](),controller[_0xaf6b('0xc')]);router[_0xaf6b('0x8')](_0xaf6b('0xd'),auth['isAuthenticated'](),controller[_0xaf6b('0xe')]);router['get'](_0xaf6b('0xf'),auth[_0xaf6b('0x9')](),controller[_0xaf6b('0x10')]);router[_0xaf6b('0x8')](_0xaf6b('0x11'),auth[_0xaf6b('0x9')](),controller['getAgents']);router[_0xaf6b('0x8')](_0xaf6b('0x12'),auth[_0xaf6b('0x9')](),controller[_0xaf6b('0x13')]);router[_0xaf6b('0x14')]('/',auth['isAuthenticated'](),controller[_0xaf6b('0x15')]);router['post']('/:id/dispositions',auth[_0xaf6b('0x9')](),controller['addDisposition']);router[_0xaf6b('0x14')](_0xaf6b('0xf'),auth['isAuthenticated'](),controller[_0xaf6b('0x16')]);router[_0xaf6b('0x14')]('/:id/users',auth[_0xaf6b('0x9')](),controller[_0xaf6b('0x17')]);router[_0xaf6b('0x14')](_0xaf6b('0x12'),auth[_0xaf6b('0x9')](),controller['addApplications']);router[_0xaf6b('0x14')]('/:id/notify',controller[_0xaf6b('0x18')]);router['post'](_0xaf6b('0x19'),auth[_0xaf6b('0x9')](),controller['send']);router['put'](_0xaf6b('0xb'),auth['isAuthenticated'](),controller[_0xaf6b('0x1a')]);router[_0xaf6b('0x1b')](_0xaf6b('0xb'),auth[_0xaf6b('0x9')](),controller['destroy']);router[_0xaf6b('0x1b')](_0xaf6b('0xd'),auth[_0xaf6b('0x9')](),controller[_0xaf6b('0x1c')]);router['delete'](_0xaf6b('0xf'),auth[_0xaf6b('0x9')](),controller[_0xaf6b('0x1d')]);router[_0xaf6b('0x1b')](_0xaf6b('0x11'),auth[_0xaf6b('0x9')](),controller[_0xaf6b('0x1e')]);module[_0xaf6b('0x1f')]=router; \ No newline at end of file +var _0xf21b=['addApplications','/:id/send','send','destroy','delete','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','addDisposition','addAgents'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xf21b,0x88));var _0xbf21=function(_0x196c35,_0x3d6371){_0x196c35=_0x196c35-0x0;var _0xcbd020=_0xf21b[_0x196c35];return _0xcbd020;};'use strict';var multer=require(_0xbf21('0x0'));var util=require(_0xbf21('0x1'));var path=require('path');var timeout=require(_0xbf21('0x2'));var express=require(_0xbf21('0x3'));var router=express['Router']();var fs_extra=require(_0xbf21('0x4'));var auth=require(_0xbf21('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbf21('0x6'));var controller=require(_0xbf21('0x7'));router['get']('/',auth[_0xbf21('0x8')](),controller[_0xbf21('0x9')]);router[_0xbf21('0xa')]('/describe',auth[_0xbf21('0x8')](),controller['describe']);router['get'](_0xbf21('0xb'),auth['isAuthenticated'](),controller[_0xbf21('0xc')]);router['get'](_0xbf21('0xd'),auth[_0xbf21('0x8')](),controller[_0xbf21('0xe')]);router[_0xbf21('0xa')](_0xbf21('0xf'),auth[_0xbf21('0x8')](),controller[_0xbf21('0x10')]);router[_0xbf21('0xa')](_0xbf21('0x11'),auth[_0xbf21('0x8')](),controller['getAgents']);router[_0xbf21('0xa')](_0xbf21('0x12'),auth[_0xbf21('0x8')](),controller[_0xbf21('0x13')]);router[_0xbf21('0x14')]('/',auth['isAuthenticated'](),controller[_0xbf21('0x15')]);router[_0xbf21('0x14')](_0xbf21('0xd'),auth[_0xbf21('0x8')](),controller[_0xbf21('0x16')]);router[_0xbf21('0x14')](_0xbf21('0xf'),auth[_0xbf21('0x8')](),controller['addAnswer']);router[_0xbf21('0x14')](_0xbf21('0x11'),auth[_0xbf21('0x8')](),controller[_0xbf21('0x17')]);router[_0xbf21('0x14')](_0xbf21('0x12'),auth['isAuthenticated'](),controller[_0xbf21('0x18')]);router[_0xbf21('0x14')]('/:id/notify',controller['notify']);router[_0xbf21('0x14')](_0xbf21('0x19'),auth[_0xbf21('0x8')](),controller[_0xbf21('0x1a')]);router['put'](_0xbf21('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbf21('0x1b')]);router[_0xbf21('0x1c')](_0xbf21('0xd'),auth[_0xbf21('0x8')](),controller[_0xbf21('0x1d')]);router[_0xbf21('0x1c')](_0xbf21('0xf'),auth[_0xbf21('0x8')](),controller['removeAnswers']);router[_0xbf21('0x1c')]('/:id/users',auth['isAuthenticated'](),controller[_0xbf21('0x1e')]);module[_0xbf21('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index b11b52d..00eeafb 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 _0x2255=['sequelize','randomstring','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x345154,_0x5cc6e4){var _0x28656b=function(_0x41d538){while(--_0x41d538){_0x345154['push'](_0x345154['shift']());}};_0x28656b(++_0x5cc6e4);}(_0x2255,0x1ec));var _0x5225=function(_0x5c016e,_0x259842){_0x5c016e=_0x5c016e-0x0;var _0x988385=_0x2255[_0x5c016e];return _0x988385;};'use strict';var Sequelize=require(_0x5225('0x0'));var rs=require(_0x5225('0x1'));module[_0x5225('0x2')]={'name':{'type':Sequelize[_0x5225('0x3')],'unique':_0x5225('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x5225('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x5225('0x3')],'defaultValue':function(){return rs[_0x5225('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize[_0x5225('0x3')]},'authToken':{'type':Sequelize[_0x5225('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5225('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5225('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5225('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x5225('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x5225('0x7')],'defaultValue':![],'comment':_0x5225('0x9'),'set':function(_0x22ac64){if(!_0x22ac64){this[_0x5225('0xa')](_0x5225('0xb'),null);}this[_0x5225('0xa')]('mandatoryDisposition',_0x22ac64);}},'description':{'type':Sequelize[_0x5225('0x3')]}}; \ No newline at end of file +var _0x6997=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','name','STRING','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x1e18f9,_0xc3049b){var _0x46d2cd=function(_0x237cd6){while(--_0x237cd6){_0x1e18f9['push'](_0x1e18f9['shift']());}};_0x46d2cd(++_0xc3049b);}(_0x6997,0x171));var _0x7699=function(_0x3d8faf,_0x532992){_0x3d8faf=_0x3d8faf-0x0;var _0x84bcd0=_0x6997[_0x3d8faf];return _0x84bcd0;};'use strict';var Sequelize=require(_0x7699('0x0'));var rs=require(_0x7699('0x1'));module[_0x7699('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x7699('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x7699('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x7699('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x7699('0x4')]},'type':{'type':Sequelize[_0x7699('0x5')]('twilio')},'accountSid':{'type':Sequelize[_0x7699('0x4')]},'authToken':{'type':Sequelize[_0x7699('0x4')]},'notificationTemplate':{'type':Sequelize[_0x7699('0x6')],'defaultValue':function(){return _0x7699('0x7');}},'notificationSound':{'type':Sequelize[_0x7699('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x7699('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7699('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7699('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7699('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x7699('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x7699('0x8')],'defaultValue':![],'comment':_0x7699('0xb'),'set':function(_0x417ec7){if(!_0x417ec7){this['setDataValue'](_0x7699('0xc'),null);}this[_0x7699('0xd')]('mandatoryDisposition',_0x417ec7);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index c03f6e6..3ab84e3 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 _0xb098=['waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','Content-Type','send','\x0a','to\x20is\x20mandatory','List','dataValues','Messages','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','include','rows','show','params','find','create','body','user','role','WhatsappAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','WhatsappAccountId','Disposition','getDispositions','length','findAll','removeDispositions','CannedAnswer','getAnswers','findOne','order','options','removeAnswers','addAgents','ids','omit','spread','emit','userWhatsappAccount:save','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','Applications','account','applications','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','messageId','MessageSid','ValidationError','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','WhatsappMessage','UserId','unshift','agent'];(function(_0xe437db,_0x424765){var _0x36efba=function(_0x16d06e){while(--_0x16d06e){_0xe437db['push'](_0xe437db['shift']());}};_0x36efba(++_0x424765);}(_0xb098,0x173));var _0x8b09=function(_0xe12f46,_0x3b5866){_0xe12f46=_0xe12f46-0x0;var _0x464bb4=_0xb098[_0xe12f46];return _0x464bb4;};'use strict';var pdf=require(_0x8b09('0x0'));var emlformat=require(_0x8b09('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8b09('0x2'));var jsonpatch=require(_0x8b09('0x3'));var rp=require('request-promise');var moment=require(_0x8b09('0x4'));var BPromise=require(_0x8b09('0x5'));var Mustache=require('mustache');var util=require(_0x8b09('0x6'));var path=require(_0x8b09('0x7'));var sox=require(_0x8b09('0x8'));var csv=require(_0x8b09('0x9'));var ejs=require(_0x8b09('0xa'));var fs=require('fs');var fs_extra=require(_0x8b09('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8b09('0xc'));var jsforce=require(_0x8b09('0xd'));var deskjs=require(_0x8b09('0xe'));var toCsv=require(_0x8b09('0x9'));var querystring=require('querystring');var Papa=require(_0x8b09('0xf'));var Redis=require(_0x8b09('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8b09('0x11'));var as=require(_0x8b09('0x12'));var hardwareService=require(_0x8b09('0x13'));var logger=require(_0x8b09('0x14'))('api');var utils=require(_0x8b09('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8b09('0x16'));var db=require('../../mysqldb')['db'];config[_0x8b09('0x17')]=_[_0x8b09('0x18')](config[_0x8b09('0x17')],{'host':_0x8b09('0x19'),'port':0x18eb});var socket=require(_0x8b09('0x1a'))(new Redis(config['redis']));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x8b09('0x1b'));var client=jayson[_0x8b09('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0xb9cad8,_0x2bbf42,_0x281145,_0x55e41a){return new BPromise(function(_0x5195c5,_0x5897cc){var _0x261340=_0x55e41a||client;return _0x261340['request'](_0xb9cad8,_0x281145)[_0x8b09('0x1d')](function(_0x298c45){logger[_0x8b09('0x1e')](_0x8b09('0x1f'),_0x2bbf42,_0x8b09('0x20'));logger[_0x8b09('0x21')](_0x8b09('0x22'),_0x2bbf42,'request\x20sent',JSON[_0x8b09('0x23')](_0x298c45));if(_0x298c45[_0x8b09('0x24')]){if(_0x298c45[_0x8b09('0x24')][_0x8b09('0x25')]===0x1f4){logger[_0x8b09('0x24')](_0x8b09('0x1f'),_0x2bbf42,_0x298c45[_0x8b09('0x24')][_0x8b09('0x26')]);return _0x5897cc(_0x298c45[_0x8b09('0x24')][_0x8b09('0x26')]);}logger[_0x8b09('0x24')](_0x8b09('0x1f'),_0x2bbf42,_0x298c45[_0x8b09('0x24')][_0x8b09('0x26')]);return _0x5195c5(_0x298c45[_0x8b09('0x24')][_0x8b09('0x26')]);}else{logger[_0x8b09('0x1e')](_0x8b09('0x1f'),_0x2bbf42,_0x8b09('0x20'));_0x5195c5(_0x298c45[_0x8b09('0x27')][_0x8b09('0x26')]);}})[_0x8b09('0x28')](function(_0x1fb92e){logger[_0x8b09('0x24')](_0x8b09('0x1f'),_0x2bbf42,_0x1fb92e);_0x5897cc(_0x1fb92e);});});}function respondWithStatusCode(_0x40d5a9,_0xe43df8){_0xe43df8=_0xe43df8||0xcc;return function(_0x5db37f){if(_0x5db37f){return _0x40d5a9['sendStatus'](_0xe43df8);}return _0x40d5a9['status'](_0xe43df8)[_0x8b09('0x29')]();};}function respondWithResult(_0xe7848,_0x409055){_0x409055=_0x409055||0xc8;return function(_0x44c42d){if(_0x44c42d){return _0xe7848[_0x8b09('0x2a')](_0x409055)[_0x8b09('0x2b')](_0x44c42d);}};}function respondWithFilteredResult(_0x5debff,_0x3a67ac){return function(_0x561564){if(_0x561564){var _0x9acbc2=_0x561564[_0x8b09('0x2c')],_0x30649c=_0x3a67ac[_0x8b09('0x2d')],_0x55c0c6=_0x3a67ac[_0x8b09('0x2d')]+_0x3a67ac[_0x8b09('0x2e')],_0x20d8eb;if(_0x55c0c6>=_0x9acbc2){_0x55c0c6=_0x9acbc2;_0x20d8eb=0xc8;}else{_0x20d8eb=0xce;}_0x5debff[_0x8b09('0x2a')](_0x20d8eb);return _0x5debff[_0x8b09('0x2f')](_0x8b09('0x30'),_0x30649c+'-'+_0x55c0c6+'/'+_0x9acbc2)[_0x8b09('0x2b')](_0x561564);}return null;};}function patchUpdates(_0x45ee34){return function(_0x26090f){try{jsonpatch[_0x8b09('0x31')](_0x26090f,_0x45ee34,!![]);}catch(_0x3f27a){return BPromise[_0x8b09('0x32')](_0x3f27a);}return _0x26090f[_0x8b09('0x33')]();};}function saveUpdates(_0x489120,_0x2389cc){return function(_0x559eea){if(_0x559eea){return _0x559eea['update'](_0x489120)[_0x8b09('0x1d')](function(_0x40098d){return _0x40098d;});}return null;};}function removeEntity(_0x3305d5,_0xdca075){return function(_0x549471){if(_0x549471){return _0x549471[_0x8b09('0x34')]()[_0x8b09('0x1d')](function(){var _0x49cb75=_0x549471[_0x8b09('0x35')]({'plain':!![]});var _0x67bcff='WhatsappAccounts';return db[_0x8b09('0x36')][_0x8b09('0x34')]({'where':{'type':_0x67bcff,'resourceId':_0x49cb75['id']}})[_0x8b09('0x1d')](function(){return _0x549471;});})[_0x8b09('0x1d')](function(){_0x3305d5[_0x8b09('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10a501,_0x5514ce){return function(_0x3b21f2){if(!_0x3b21f2){_0x10a501['sendStatus'](0x194);}return _0x3b21f2;};}function handleError(_0x42fc6b,_0x20f06){_0x20f06=_0x20f06||0x1f4;return function(_0x1bd862){logger[_0x8b09('0x24')](_0x1bd862[_0x8b09('0x37')]);if(_0x1bd862['name']){delete _0x1bd862[_0x8b09('0x38')];}_0x42fc6b[_0x8b09('0x2a')](_0x20f06)['send'](_0x1bd862);};}exports[_0x8b09('0x39')]=function(_0x14930c,_0x15a604){var _0x1d0c4e={'include':[{'model':db[_0x8b09('0x3a')],'as':_0x8b09('0x3b')}]},_0x146e3e={},_0x13058e={'count':0x0,'rows':[]};var _0x5f2aeb=_[_0x8b09('0x3c')](db[_0x8b09('0x3d')][_0x8b09('0x3e')],function(_0x1f6755){return{'name':_0x1f6755[_0x8b09('0x3f')],'type':_0x1f6755[_0x8b09('0x40')][_0x8b09('0x41')]};});_0x146e3e['model']=_[_0x8b09('0x3c')](_0x5f2aeb,_0x8b09('0x38'));_0x146e3e[_0x8b09('0x42')]=_[_0x8b09('0x43')](_0x14930c[_0x8b09('0x42')]);_0x146e3e['filters']=_[_0x8b09('0x44')](_0x146e3e['model'],_0x146e3e[_0x8b09('0x42')]);_0x1d0c4e[_0x8b09('0x45')]=_[_0x8b09('0x44')](_0x146e3e[_0x8b09('0x46')],qs[_0x8b09('0x47')](_0x14930c[_0x8b09('0x42')][_0x8b09('0x47')]));_0x1d0c4e[_0x8b09('0x45')]=_0x1d0c4e[_0x8b09('0x45')]['length']?_0x1d0c4e['attributes']:_0x146e3e[_0x8b09('0x46')];if(!_0x14930c[_0x8b09('0x42')][_0x8b09('0x48')](_0x8b09('0x49'))){_0x1d0c4e[_0x8b09('0x2e')]=qs[_0x8b09('0x2e')](_0x14930c['query'][_0x8b09('0x2e')]);_0x1d0c4e['offset']=qs[_0x8b09('0x2d')](_0x14930c[_0x8b09('0x42')][_0x8b09('0x2d')]);}_0x1d0c4e['order']=qs[_0x8b09('0x4a')](_0x14930c['query'][_0x8b09('0x4a')]);_0x1d0c4e[_0x8b09('0x4b')]=qs[_0x8b09('0x4c')](_[_0x8b09('0x4d')](_0x14930c[_0x8b09('0x42')],_0x146e3e[_0x8b09('0x4c')]),_0x5f2aeb);if(_0x14930c[_0x8b09('0x42')]['filter']){_0x1d0c4e[_0x8b09('0x4b')]=_['merge'](_0x1d0c4e[_0x8b09('0x4b')],{'$or':_['map'](_0x5f2aeb,function(_0x382dda){if(_0x382dda[_0x8b09('0x40')]!==_0x8b09('0x4e')){var _0x477f82={};_0x477f82[_0x382dda[_0x8b09('0x38')]]={'$like':'%'+_0x14930c['query'][_0x8b09('0x4f')]+'%'};return _0x477f82;}})});}_0x1d0c4e=_[_0x8b09('0x50')]({},_0x1d0c4e,_0x14930c['options']);var _0x464098={'where':_0x1d0c4e[_0x8b09('0x4b')]};return db[_0x8b09('0x3d')][_0x8b09('0x2c')](_0x464098)[_0x8b09('0x1d')](function(_0x43b7bd){_0x13058e['count']=_0x43b7bd;if(_0x14930c[_0x8b09('0x42')][_0x8b09('0x51')]){_0x1d0c4e[_0x8b09('0x52')]=[{'all':!![]}];}return db[_0x8b09('0x3d')]['findAll'](_0x1d0c4e);})[_0x8b09('0x1d')](function(_0x2a5b16){_0x13058e[_0x8b09('0x53')]=_0x2a5b16;return _0x13058e;})[_0x8b09('0x1d')](respondWithFilteredResult(_0x15a604,_0x1d0c4e))[_0x8b09('0x28')](handleError(_0x15a604,null));};exports[_0x8b09('0x54')]=function(_0x13cbed,_0x371775){var _0xa83315={'raw':![],'where':{'id':_0x13cbed[_0x8b09('0x55')]['id']},'include':[{'model':db[_0x8b09('0x3a')],'as':_0x8b09('0x3b')}]},_0x21539a={};_0x21539a[_0x8b09('0x46')]=_[_0x8b09('0x43')](db[_0x8b09('0x3d')][_0x8b09('0x3e')]);_0x21539a['query']=_[_0x8b09('0x43')](_0x13cbed[_0x8b09('0x42')]);_0x21539a[_0x8b09('0x4c')]=_[_0x8b09('0x44')](_0x21539a[_0x8b09('0x46')],_0x21539a[_0x8b09('0x42')]);_0xa83315[_0x8b09('0x45')]=_[_0x8b09('0x44')](_0x21539a[_0x8b09('0x46')],qs['fields'](_0x13cbed['query'][_0x8b09('0x47')]));_0xa83315[_0x8b09('0x45')]=_0xa83315['attributes']['length']?_0xa83315[_0x8b09('0x45')]:_0x21539a['model'];if(_0x13cbed['query'][_0x8b09('0x51')]){_0xa83315[_0x8b09('0x52')]=[{'all':!![]}];}_0xa83315=_[_0x8b09('0x50')]({},_0xa83315,_0x13cbed['options']);return db[_0x8b09('0x3d')][_0x8b09('0x56')](_0xa83315)[_0x8b09('0x1d')](handleEntityNotFound(_0x371775,null))['then'](respondWithResult(_0x371775,null))[_0x8b09('0x28')](handleError(_0x371775,null));};exports['create']=function(_0xf3566,_0x566dad){return db[_0x8b09('0x3d')][_0x8b09('0x57')](_0xf3566[_0x8b09('0x58')],{})['then'](function(_0x580143){var _0x338799=_0xf3566[_0x8b09('0x59')][_0x8b09('0x35')]({'plain':!![]});if(!_0x338799)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x338799[_0x8b09('0x5a')]==='user'){var _0x3986be=_0x580143[_0x8b09('0x35')]({'plain':!![]});var _0x6418d0=_0x8b09('0x5b');return db[_0x8b09('0x5c')]['find']({'where':{'name':_0x6418d0,'userProfileId':_0x338799[_0x8b09('0x5d')]},'raw':!![]})['then'](function(_0x21b1bf){if(_0x21b1bf&&_0x21b1bf['autoAssociation']===0x0){return db[_0x8b09('0x36')][_0x8b09('0x57')]({'name':_0x3986be['name'],'resourceId':_0x3986be['id'],'type':_0x21b1bf['name'],'sectionId':_0x21b1bf['id']},{})[_0x8b09('0x1d')](function(){return _0x580143;});}else{return _0x580143;}})[_0x8b09('0x28')](function(_0x29ea9c){logger[_0x8b09('0x24')](_0x8b09('0x5e'),_0x29ea9c);throw _0x29ea9c;});}return _0x580143;})['then'](respondWithResult(_0x566dad,0xc9))[_0x8b09('0x28')](handleError(_0x566dad,null));};exports[_0x8b09('0x5f')]=function(_0x4d7d2f,_0x339a09){if(_0x4d7d2f[_0x8b09('0x58')]['id']){delete _0x4d7d2f[_0x8b09('0x58')]['id'];}return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0x4d7d2f[_0x8b09('0x55')]['id']},'include':[{'model':db[_0x8b09('0x3a')],'as':_0x8b09('0x3b')}]})[_0x8b09('0x1d')](handleEntityNotFound(_0x339a09,null))[_0x8b09('0x1d')](saveUpdates(_0x4d7d2f[_0x8b09('0x58')],null))['then'](respondWithResult(_0x339a09,null))[_0x8b09('0x28')](handleError(_0x339a09,null));};exports[_0x8b09('0x34')]=function(_0x5a5a0e,_0x5a5b29){return db[_0x8b09('0x3d')]['find']({'where':{'id':_0x5a5a0e[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0x5a5b29,null))[_0x8b09('0x1d')](removeEntity(_0x5a5b29,null))[_0x8b09('0x28')](handleError(_0x5a5b29,null));};exports['describe']=function(_0x45bd45,_0x13f607){return db[_0x8b09('0x3d')][_0x8b09('0x60')]()[_0x8b09('0x1d')](respondWithResult(_0x13f607,null))[_0x8b09('0x28')](handleError(_0x13f607,null));};exports['addDisposition']=function(_0x488104,_0x3abf72,_0x3cb2af){if(_0x488104[_0x8b09('0x58')]['id']){delete _0x488104['body']['id'];}return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0x488104['params']['id']}})['then'](handleEntityNotFound(_0x3abf72,null))['then'](function(_0x263a6b){if(_0x263a6b){_0x488104[_0x8b09('0x58')][_0x8b09('0x61')]=_0x263a6b['id'];return db[_0x8b09('0x62')][_0x8b09('0x57')](_0x488104[_0x8b09('0x58')]);}})[_0x8b09('0x1d')](respondWithResult(_0x3abf72,null))[_0x8b09('0x28')](handleError(_0x3abf72,null));};exports[_0x8b09('0x63')]=function(_0x4b7313,_0x402e0f,_0x1dada8){var _0x203dc2={'raw':![],'where':{}};var _0x13ab48={};var _0x264f50={'count':0x0,'rows':[]};return db[_0x8b09('0x3d')]['findOne']({'where':{'id':_0x4b7313[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0x402e0f,null))[_0x8b09('0x1d')](function(_0xc41f1c){if(_0xc41f1c){_0x13ab48[_0x8b09('0x46')]=_[_0x8b09('0x43')](db[_0x8b09('0x62')][_0x8b09('0x3e')]);_0x13ab48['query']=_[_0x8b09('0x43')](_0x4b7313[_0x8b09('0x42')]);_0x13ab48['filters']=_['intersection'](_0x13ab48[_0x8b09('0x46')],_0x13ab48[_0x8b09('0x42')]);_0x203dc2[_0x8b09('0x45')]=_[_0x8b09('0x44')](_0x13ab48[_0x8b09('0x46')],qs['fields'](_0x4b7313[_0x8b09('0x42')]['fields']));_0x203dc2[_0x8b09('0x45')]=_0x203dc2[_0x8b09('0x45')][_0x8b09('0x64')]?_0x203dc2[_0x8b09('0x45')]:_0x13ab48['model'];if(!_0x4b7313['query'][_0x8b09('0x48')](_0x8b09('0x49'))){_0x203dc2[_0x8b09('0x2e')]=qs[_0x8b09('0x2e')](_0x4b7313[_0x8b09('0x42')][_0x8b09('0x2e')]);_0x203dc2[_0x8b09('0x2d')]=qs[_0x8b09('0x2d')](_0x4b7313['query'][_0x8b09('0x2d')]);}_0x203dc2['order']=qs['sort'](_0x4b7313['query'][_0x8b09('0x4a')]);_0x203dc2[_0x8b09('0x4b')]=qs['filters'](_[_0x8b09('0x4d')](_0x4b7313[_0x8b09('0x42')],_0x13ab48[_0x8b09('0x4c')]));_0x203dc2[_0x8b09('0x4b')][_0x8b09('0x61')]=_0xc41f1c['id'];if(_0x4b7313[_0x8b09('0x42')][_0x8b09('0x4f')]){_0x203dc2[_0x8b09('0x4b')]=_[_0x8b09('0x50')](_0x203dc2[_0x8b09('0x4b')],{'$or':_['map'](_0x203dc2[_0x8b09('0x45')],function(_0xb2265c){var _0x2a1b8e={};_0x2a1b8e[_0xb2265c]={'$like':'%'+_0x4b7313['query'][_0x8b09('0x4f')]+'%'};return _0x2a1b8e;})});}_0x203dc2=_[_0x8b09('0x50')]({},_0x203dc2,_0x4b7313['options']);return db['Disposition'][_0x8b09('0x2c')]({'where':_0x203dc2[_0x8b09('0x4b')]})[_0x8b09('0x1d')](function(_0xddcefb){_0x264f50[_0x8b09('0x2c')]=_0xddcefb;if(_0x4b7313[_0x8b09('0x42')][_0x8b09('0x51')]){_0x203dc2[_0x8b09('0x52')]=[{'all':!![]}];}return db[_0x8b09('0x62')][_0x8b09('0x65')](_0x203dc2);})[_0x8b09('0x1d')](function(_0x31ce7d){_0x264f50[_0x8b09('0x53')]=_0x31ce7d;return _0x264f50;});}})['then'](respondWithFilteredResult(_0x402e0f,_0x203dc2))['catch'](handleError(_0x402e0f,null));};exports[_0x8b09('0x66')]=function(_0xd1deb3,_0xa0e629,_0x764fb4){return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0xd1deb3[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0xa0e629,null))[_0x8b09('0x1d')](function(_0x6cc33d){if(_0x6cc33d){return _0x6cc33d[_0x8b09('0x66')](_0xd1deb3[_0x8b09('0x42')]['ids']);}})[_0x8b09('0x1d')](respondWithStatusCode(_0xa0e629,null))[_0x8b09('0x28')](handleError(_0xa0e629,null));};exports['addAnswer']=function(_0x2365f0,_0xec117,_0xdc5fd1){if(_0x2365f0[_0x8b09('0x58')]['id']){delete _0x2365f0[_0x8b09('0x58')]['id'];}return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0x2365f0['params']['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0xec117,null))[_0x8b09('0x1d')](function(_0x10052a){if(_0x10052a){_0x2365f0['body'][_0x8b09('0x61')]=_0x10052a['id'];return db[_0x8b09('0x67')]['create'](_0x2365f0[_0x8b09('0x58')]);}})['then'](respondWithResult(_0xec117,null))[_0x8b09('0x28')](handleError(_0xec117,null));};exports[_0x8b09('0x68')]=function(_0x56fa83,_0x766464,_0x425671){var _0x266736={'raw':![],'where':{}};var _0x70f86c={};var _0x290ff0={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x8b09('0x69')]({'where':{'id':_0x56fa83[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0x766464,null))[_0x8b09('0x1d')](function(_0x5ebe3a){if(_0x5ebe3a){_0x70f86c[_0x8b09('0x46')]=_[_0x8b09('0x43')](db[_0x8b09('0x67')]['rawAttributes']);_0x70f86c[_0x8b09('0x42')]=_['keys'](_0x56fa83[_0x8b09('0x42')]);_0x70f86c[_0x8b09('0x4c')]=_[_0x8b09('0x44')](_0x70f86c[_0x8b09('0x46')],_0x70f86c[_0x8b09('0x42')]);_0x266736[_0x8b09('0x45')]=_['intersection'](_0x70f86c[_0x8b09('0x46')],qs[_0x8b09('0x47')](_0x56fa83[_0x8b09('0x42')][_0x8b09('0x47')]));_0x266736[_0x8b09('0x45')]=_0x266736[_0x8b09('0x45')]['length']?_0x266736[_0x8b09('0x45')]:_0x70f86c['model'];if(!_0x56fa83[_0x8b09('0x42')][_0x8b09('0x48')](_0x8b09('0x49'))){_0x266736['limit']=qs['limit'](_0x56fa83[_0x8b09('0x42')][_0x8b09('0x2e')]);_0x266736['offset']=qs['offset'](_0x56fa83['query'][_0x8b09('0x2d')]);}_0x266736[_0x8b09('0x6a')]=qs['sort'](_0x56fa83[_0x8b09('0x42')]['sort']);_0x266736['where']=qs[_0x8b09('0x4c')](_[_0x8b09('0x4d')](_0x56fa83[_0x8b09('0x42')],_0x70f86c[_0x8b09('0x4c')]));_0x266736[_0x8b09('0x4b')][_0x8b09('0x61')]=_0x5ebe3a['id'];if(_0x56fa83[_0x8b09('0x42')][_0x8b09('0x4f')]){_0x266736[_0x8b09('0x4b')]=_[_0x8b09('0x50')](_0x266736['where'],{'$or':_[_0x8b09('0x3c')](_0x266736[_0x8b09('0x45')],function(_0x15fbb3){var _0x4aba70={};_0x4aba70[_0x15fbb3]={'$like':'%'+_0x56fa83[_0x8b09('0x42')][_0x8b09('0x4f')]+'%'};return _0x4aba70;})});}_0x266736=_[_0x8b09('0x50')]({},_0x266736,_0x56fa83[_0x8b09('0x6b')]);return db['CannedAnswer'][_0x8b09('0x2c')]({'where':_0x266736['where']})[_0x8b09('0x1d')](function(_0x38e0e4){_0x290ff0[_0x8b09('0x2c')]=_0x38e0e4;if(_0x56fa83[_0x8b09('0x42')][_0x8b09('0x51')]){_0x266736[_0x8b09('0x52')]=[{'all':!![]}];}return db[_0x8b09('0x67')][_0x8b09('0x65')](_0x266736);})[_0x8b09('0x1d')](function(_0x2d6f2e){_0x290ff0['rows']=_0x2d6f2e;return _0x290ff0;});}})[_0x8b09('0x1d')](respondWithFilteredResult(_0x766464,_0x266736))[_0x8b09('0x28')](handleError(_0x766464,null));};exports[_0x8b09('0x6c')]=function(_0x34d093,_0x4d576b,_0x1afd35){return db['WhatsappAccount'][_0x8b09('0x56')]({'where':{'id':_0x34d093[_0x8b09('0x55')]['id']}})['then'](handleEntityNotFound(_0x4d576b,null))[_0x8b09('0x1d')](function(_0x3fb537){if(_0x3fb537){return _0x3fb537[_0x8b09('0x6c')](_0x34d093[_0x8b09('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x4d576b,null))[_0x8b09('0x28')](handleError(_0x4d576b,null));};exports[_0x8b09('0x6d')]=function(_0x109a1e,_0x19e543,_0x51c92f){return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0x109a1e[_0x8b09('0x55')]['id']}})['then'](handleEntityNotFound(_0x19e543,null))['then'](function(_0x2469e3){if(_0x2469e3){return _0x2469e3[_0x8b09('0x6d')](_0x109a1e[_0x8b09('0x58')][_0x8b09('0x6e')],_[_0x8b09('0x6f')](_0x109a1e[_0x8b09('0x58')],[_0x8b09('0x6e'),'id'])||{})[_0x8b09('0x70')](function(_0x45950c){for(var _0x164bb9=0x0;_0x164bb9<_0x109a1e['body'][_0x8b09('0x6e')][_0x8b09('0x64')];_0x164bb9+=0x1){socket[_0x8b09('0x71')](_0x8b09('0x72'),{'UserId':_0x109a1e[_0x8b09('0x58')][_0x8b09('0x6e')][_0x164bb9],'WhatsappAccountId':_0x109a1e[_0x8b09('0x55')]['id']});}return _0x45950c;});}})[_0x8b09('0x1d')](respondWithResult(_0x19e543,null))[_0x8b09('0x28')](handleError(_0x19e543,null));};exports['removeAgents']=function(_0x3e0afc,_0x3816a4,_0x4e79f1){return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0x3e0afc[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0x3816a4,null))[_0x8b09('0x1d')](function(_0xea092b){if(_0xea092b){return _0xea092b['removeAgents'](_0x3e0afc[_0x8b09('0x42')][_0x8b09('0x6e')])[_0x8b09('0x1d')](function(){if(_['isArray'](_0x3e0afc[_0x8b09('0x42')][_0x8b09('0x6e')])){for(var _0x13f8f2=0x0;_0x13f8f2<_0x3e0afc[_0x8b09('0x42')][_0x8b09('0x6e')]['length'];_0x13f8f2+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x3e0afc[_0x8b09('0x42')]['ids'][_0x13f8f2]),'WhatsappAccountId':Number(_0x3e0afc[_0x8b09('0x55')]['id'])});}}else{socket[_0x8b09('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x3e0afc[_0x8b09('0x42')][_0x8b09('0x6e')]),'WhatsappAccountId':Number(_0x3e0afc[_0x8b09('0x55')]['id'])});}});}})[_0x8b09('0x1d')](respondWithStatusCode(_0x3816a4,null))[_0x8b09('0x28')](handleError(_0x3816a4,null));};exports[_0x8b09('0x73')]=function(_0x50cf45,_0x3b8356,_0x392efa){var _0x1fdd48={};var _0x59de86={};var _0x522593;var _0x575487;return db[_0x8b09('0x3d')][_0x8b09('0x69')]({'where':{'id':_0x50cf45[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0x3b8356,null))[_0x8b09('0x1d')](function(_0x40d3d2){if(_0x40d3d2){_0x522593=_0x40d3d2;_0x59de86[_0x8b09('0x46')]=_[_0x8b09('0x43')](db['User'][_0x8b09('0x3e')]);_0x59de86['query']=_[_0x8b09('0x43')](_0x50cf45[_0x8b09('0x42')]);_0x59de86[_0x8b09('0x4c')]=_[_0x8b09('0x44')](_0x59de86[_0x8b09('0x46')],_0x59de86[_0x8b09('0x42')]);_0x1fdd48[_0x8b09('0x45')]=_['intersection'](_0x59de86[_0x8b09('0x46')],qs[_0x8b09('0x47')](_0x50cf45[_0x8b09('0x42')][_0x8b09('0x47')]));_0x1fdd48[_0x8b09('0x45')]=_0x1fdd48['attributes']['length']?_0x1fdd48['attributes']:_0x59de86['model'];_0x1fdd48[_0x8b09('0x6a')]=qs[_0x8b09('0x4a')](_0x50cf45[_0x8b09('0x42')][_0x8b09('0x4a')]);_0x1fdd48['where']=qs[_0x8b09('0x4c')](_[_0x8b09('0x4d')](_0x50cf45[_0x8b09('0x42')],_0x59de86[_0x8b09('0x4c')]));if(_0x50cf45[_0x8b09('0x42')]['filter']){_0x1fdd48[_0x8b09('0x4b')]=_[_0x8b09('0x50')](_0x1fdd48['where'],{'$or':_[_0x8b09('0x3c')](_0x1fdd48[_0x8b09('0x45')],function(_0x2b2ee6){var _0xc08656={};_0xc08656[_0x2b2ee6]={'$like':'%'+_0x50cf45[_0x8b09('0x42')]['filter']+'%'};return _0xc08656;})});}_0x1fdd48=_[_0x8b09('0x50')]({},_0x1fdd48,_0x50cf45['options']);return _0x522593[_0x8b09('0x73')](_0x1fdd48);}})[_0x8b09('0x1d')](function(_0x28af05){if(_0x28af05){_0x575487=_0x28af05[_0x8b09('0x64')];if(!_0x50cf45['query'][_0x8b09('0x48')](_0x8b09('0x49'))){_0x1fdd48[_0x8b09('0x2e')]=qs['limit'](_0x50cf45[_0x8b09('0x42')][_0x8b09('0x2e')]);_0x1fdd48[_0x8b09('0x2d')]=qs['offset'](_0x50cf45[_0x8b09('0x42')]['offset']);}return _0x522593[_0x8b09('0x73')](_0x1fdd48);}})[_0x8b09('0x1d')](function(_0x3cd7f0){if(_0x3cd7f0){return _0x3cd7f0?{'count':_0x575487,'rows':_0x3cd7f0}:null;}})[_0x8b09('0x1d')](respondWithResult(_0x3b8356,null))[_0x8b09('0x28')](handleError(_0x3b8356,null));};exports[_0x8b09('0x74')]=function(_0x4ea0e8,_0x2c02ea,_0x196776){return db[_0x8b09('0x3d')][_0x8b09('0x69')]({'where':{'id':_0x4ea0e8[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0x2c02ea,null))[_0x8b09('0x1d')](function(_0x225c6e){if(_0x225c6e){return db[_0x8b09('0x75')][_0x8b09('0x76')](function(_0x2517f6){return db[_0x8b09('0x77')][_0x8b09('0x34')]({'where':{'WhatsappAccountId':_0x4ea0e8[_0x8b09('0x55')]['id']},'transaction':_0x2517f6})[_0x8b09('0x1d')](function(_0x48ac8b){var _0x120da4=_['map'](_0x4ea0e8[_0x8b09('0x58')],function(_0x3676ce){_0x3676ce[_0x8b09('0x61')]=_0x4ea0e8[_0x8b09('0x55')]['id'];return _0x3676ce;});return db[_0x8b09('0x77')]['bulkCreate'](_0x120da4,{'transaction':_0x2517f6});});})[_0x8b09('0x1d')](function(){return db['WhatsappApplication'][_0x8b09('0x78')]({'where':{'WhatsappAccountId':_0x4ea0e8['params']['id']},'order':_0x8b09('0x79')});});}})[_0x8b09('0x1d')](respondWithResult(_0x2c02ea,null))['catch'](handleError(_0x2c02ea,null));};exports[_0x8b09('0x7a')]=function(_0x342d25,_0x54d442,_0x71550b){var _0x326097={};var _0x144192={};var _0x473510;var _0x52ecab;return db[_0x8b09('0x3d')][_0x8b09('0x69')]({'where':{'id':_0x342d25[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0x54d442,null))['then'](function(_0xc78d32){if(_0xc78d32){_0x473510=_0xc78d32;_0x144192['model']=_[_0x8b09('0x43')](db[_0x8b09('0x77')]['rawAttributes']);_0x144192[_0x8b09('0x42')]=_[_0x8b09('0x43')](_0x342d25[_0x8b09('0x42')]);_0x144192[_0x8b09('0x4c')]=_[_0x8b09('0x44')](_0x144192[_0x8b09('0x46')],_0x144192[_0x8b09('0x42')]);_0x326097[_0x8b09('0x45')]=_['intersection'](_0x144192['model'],qs[_0x8b09('0x47')](_0x342d25[_0x8b09('0x42')][_0x8b09('0x47')]));_0x326097[_0x8b09('0x45')]=_0x326097[_0x8b09('0x45')][_0x8b09('0x64')]?_0x326097[_0x8b09('0x45')]:_0x144192[_0x8b09('0x46')];_0x326097['order']=qs[_0x8b09('0x4a')](_0x342d25[_0x8b09('0x42')][_0x8b09('0x4a')]);_0x326097['where']=qs['filters'](_[_0x8b09('0x4d')](_0x342d25[_0x8b09('0x42')],_0x144192[_0x8b09('0x4c')]));if(_0x342d25['query'][_0x8b09('0x4f')]){_0x326097[_0x8b09('0x4b')]=_[_0x8b09('0x50')](_0x326097[_0x8b09('0x4b')],{'$or':_[_0x8b09('0x3c')](_0x326097['attributes'],function(_0x5cb650){var _0x572988={};_0x572988[_0x5cb650]={'$like':'%'+_0x342d25[_0x8b09('0x42')]['filter']+'%'};return _0x572988;})});}_0x326097=_[_0x8b09('0x50')]({},_0x326097,_0x342d25[_0x8b09('0x6b')]);return _0x473510[_0x8b09('0x7a')](_0x326097);}})[_0x8b09('0x1d')](function(_0xf5d72c){if(_0xf5d72c){_0x52ecab=_0xf5d72c[_0x8b09('0x64')];if(!_0x342d25[_0x8b09('0x42')][_0x8b09('0x48')](_0x8b09('0x49'))){_0x326097['limit']=qs[_0x8b09('0x2e')](_0x342d25[_0x8b09('0x42')][_0x8b09('0x2e')]);_0x326097[_0x8b09('0x2d')]=qs[_0x8b09('0x2d')](_0x342d25['query'][_0x8b09('0x2d')]);}return _0x473510['getApplications'](_0x326097);}})[_0x8b09('0x1d')](function(_0x122a8c){if(_0x122a8c){return _0x122a8c?{'count':_0x52ecab,'rows':_0x122a8c}:null;}})[_0x8b09('0x1d')](respondWithResult(_0x54d442,null))['catch'](handleError(_0x54d442,null));};exports[_0x8b09('0x7b')]=function(_0x4c0f4c,_0x5329fa,_0x435e52){var _0x2e7dad={'channel':'whatsapp'};var _0x3b49d2=[];var _0x2e796a=[];var _0x10809a={};return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0x4c0f4c[_0x8b09('0x55')]['id']},'include':[{'model':db[_0x8b09('0x77')],'as':_0x8b09('0x7c')}]})[_0x8b09('0x1d')](handleEntityNotFound(_0x5329fa,null))[_0x8b09('0x1d')](function(_0x321329){_0x2e7dad[_0x8b09('0x7d')]=_0x321329;_0x2e7dad[_0x8b09('0x7e')]=_[_0x8b09('0x7f')](_0x321329['Applications'],['priority'],[_0x8b09('0x80')]);if(_0x2e7dad[_0x8b09('0x7d')][_0x8b09('0x7c')]){delete _0x2e7dad[_0x8b09('0x7d')][_0x8b09('0x7c')];}return db[_0x8b09('0x81')][_0x8b09('0x60')]();})[_0x8b09('0x1d')](function(_0x5b8b08){if(!_0x5b8b08){throw new db[(_0x8b09('0x82'))]['ValidationError'](_0x8b09('0x83'));}_0x3b49d2=_[_0x8b09('0x84')](_[_0x8b09('0x43')](_0x5b8b08),[_0x8b09('0x85'),'updatedAt']);_0x2e796a=_[_0x8b09('0x84')](_[_0x8b09('0x43')](_0x5b8b08),[_0x8b09('0x85'),_0x8b09('0x86'),_0x8b09('0x87'),_0x8b09('0x88')]);_0x2e7dad['body']={'mapKey':'mobile'};if(_0x2e7dad['account'][_0x8b09('0x40')]&&_0x2e7dad[_0x8b09('0x7d')][_0x8b09('0x40')]===_0x8b09('0x89')){_0x2e7dad['body'][_0x8b09('0x8a')]=_0x4c0f4c[_0x8b09('0x58')][_0x8b09('0x8b')][_0x8b09('0x8c')](_0x8b09('0x8d'),'');_0x2e7dad[_0x8b09('0x58')]['body']=_0x4c0f4c[_0x8b09('0x58')]['Body'];_0x2e7dad['body'][_0x8b09('0x8e')]=_0x4c0f4c[_0x8b09('0x58')][_0x8b09('0x8f')];}if(_0x2e7dad[_0x8b09('0x58')]['id']){delete _0x2e7dad[_0x8b09('0x58')]['id'];}if(_['isNil'](_0x2e7dad[_0x8b09('0x58')][_0x8b09('0x8a')])){throw new db['Sequelize'][(_0x8b09('0x90'))]('from\x20is\x20mandatory');}if(_[_0x8b09('0x91')](_0x2e7dad[_0x8b09('0x58')]['body'])||_0x2e7dad[_0x8b09('0x58')]['body']===''){throw new db[(_0x8b09('0x82'))]['ValidationError'](_0x8b09('0x92'));}if(_['isNil'](_0x2e7dad['body'][_0x8b09('0x93')])){throw new db[(_0x8b09('0x82'))][(_0x8b09('0x90'))](_0x8b09('0x94')+_0x2e796a);}if(!_[_0x8b09('0x95')](_0x2e796a,_0x2e7dad[_0x8b09('0x58')][_0x8b09('0x93')])){throw new db[(_0x8b09('0x82'))][(_0x8b09('0x90'))](_0x8b09('0x96')+_0x2e796a);}_0x10809a[_0x2e7dad['body'][_0x8b09('0x93')]]=_0x2e7dad[_0x8b09('0x58')][_0x8b09('0x8a')];return db[_0x8b09('0x97')]['find']({'where':{'id':_0x2e7dad[_0x8b09('0x7d')]['ListId']},'include':[{'model':db[_0x8b09('0x81')],'as':_0x8b09('0x98'),'where':_0x10809a,'limit':0x1,'order':[[_0x8b09('0x86'),_0x8b09('0x99')]]}]});})['then'](handleEntityNotFound(_0x5329fa,null))[_0x8b09('0x1d')](function(_0x269bd5){if(_0x269bd5){_0x2e7dad[_0x8b09('0x9a')]=_['omit'](_0x269bd5,[_0x8b09('0x98')]);if(_0x269bd5[_0x8b09('0x98')][_0x8b09('0x64')]){return _0x269bd5[_0x8b09('0x98')][0x0];}var _0x3ac077=_[_0x8b09('0x18')](_0x2e7dad[_0x8b09('0x58')],{'firstName':_0x2e7dad[_0x8b09('0x58')][_0x8b09('0x8a')],'ListId':_0x269bd5['id']});_0x3ac077[_0x2e7dad[_0x8b09('0x58')]['mapKey']]=_0x2e7dad[_0x8b09('0x58')][_0x8b09('0x8a')];return db[_0x8b09('0x81')][_0x8b09('0x57')](_0x3ac077,{'fields':_0x3b49d2,'raw':!![]});}})['then'](handleEntityNotFound(_0x5329fa,null))[_0x8b09('0x1d')](function(_0x325a38){if(_0x325a38){_0x2e7dad[_0x8b09('0x9b')]=_0x325a38;var _0x48ea62={'ContactId':_0x325a38['id'],'phone':_0x2e7dad[_0x8b09('0x58')]['from'],'WhatsappAccountId':_0x4c0f4c[_0x8b09('0x55')]['id']};var _0x34512f={'ContactId':_0x325a38['id'],'WhatsappAccountId':_0x4c0f4c[_0x8b09('0x55')]['id'],'closed':![]};return db[_0x8b09('0x9c')][_0x8b09('0x56')]({'where':_0x34512f})[_0x8b09('0x1d')](function(_0x577dfb){if(_0x577dfb){return[_0x577dfb,![]];}return db[_0x8b09('0x9c')][_0x8b09('0x57')](_0x48ea62)[_0x8b09('0x1d')](function(_0x3da27c){return[_0x3da27c,!![]];});});}})[_0x8b09('0x70')](function(_0x212d3a,_0x270253){_0x2e7dad[_0x8b09('0x9d')]=_0x212d3a[_0x8b09('0x35')]({'plain':!![]});_0x2e7dad[_0x8b09('0x9d')][_0x8b09('0x9e')]=![];if(_0x270253){if(_0x2e7dad[_0x8b09('0x7d')][_0x8b09('0x9f')]){_0x2e7dad[_0x8b09('0x7e')][_0x8b09('0xa0')]({'id':0x0,'priority':_0x2e7dad['applications'][_0x8b09('0x64')]+0x1,'app':_0x8b09('0xa1'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x2e7dad[_0x8b09('0x9d')]['created']=!![];}return db[_0x8b09('0xa2')][_0x8b09('0x57')]({'phone':_0x2e7dad['body']['from'],'messageId':_0x2e7dad[_0x8b09('0x58')][_0x8b09('0x8e')],'body':_0x2e7dad[_0x8b09('0x58')][_0x8b09('0x58')],'WhatsappAccountId':_0x4c0f4c[_0x8b09('0x55')]['id'],'WhatsappInteractionId':_0x212d3a['id'],'direction':'in','ContactId':_0x212d3a['ContactId'],'AttachmentId':_0x2e7dad[_0x8b09('0x58')]['AttachmentId']});})['then'](function(_0x54993d){_0x2e7dad[_0x8b09('0x26')]=_0x54993d;if(_0x2e7dad[_0x8b09('0x9d')][_0x8b09('0xa3')]){return db['User'][_0x8b09('0x56')]({'attributes':['id',_0x8b09('0x38')],'where':{'id':_0x2e7dad[_0x8b09('0x9d')][_0x8b09('0xa3')]}})['then'](function(_0x9116f3){if(_0x9116f3){_0x2e7dad[_0x8b09('0x7e')][_0x8b09('0xa4')]({'id':0x0,'priority':0x0,'app':_0x8b09('0xa5'),'appdata':_0x9116f3[_0x8b09('0x38')]+','+(_0x2e7dad[_0x8b09('0x7d')][_0x8b09('0xa6')]||0xa),'interval':_0x8b09('0xa7')});}return respondWithRpcPromise(_0x8b09('0xa8'),'startRouting',_0x2e7dad);});}return respondWithRpcPromise(_0x8b09('0xa8'),_0x8b09('0xa9'),_0x2e7dad);})[_0x8b09('0x1d')](function(_0x5911c2){if(_0x5911c2){var _0x3d0d65=0xc8;var _0x359c77=_0x8b09('0xaa');logger[_0x8b09('0x1e')](_0x8b09('0x22'),_0x359c77,_0x3d0d65,_0x8b09('0xab'));logger[_0x8b09('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x359c77,_0x3d0d65,'entity\x20found',JSON[_0x8b09('0x23')](_0x5911c2));if(_0x2e7dad['account'][_0x8b09('0x40')]===_0x8b09('0x89')){return _0x5329fa[_0x8b09('0x2a')](_0x3d0d65)[_0x8b09('0x2f')](_0x8b09('0xac'),'text/xml')[_0x8b09('0xad')](_0x8b09('0xae'));}else{return _0x5329fa[_0x8b09('0x2a')](_0x3d0d65)[_0x8b09('0x2b')](_0x5911c2);}}})[_0x8b09('0x28')](handleError(_0x5329fa,null));};exports[_0x8b09('0xad')]=function(_0x29db92,_0x1091fd,_0x15fbc0){var _0x2bede1,_0x549bc2,_0x4bcacf;if(_[_0x8b09('0x91')](_0x29db92[_0x8b09('0x58')][_0x8b09('0x58')])||_0x29db92[_0x8b09('0x58')][_0x8b09('0x58')]===''){throw new db[(_0x8b09('0x82'))][(_0x8b09('0x90'))](_0x8b09('0x92'));}if(_['isNil'](_0x29db92[_0x8b09('0x58')]['to'])){throw new db[(_0x8b09('0x82'))][(_0x8b09('0x90'))](_0x8b09('0xaf'));}_0x2bede1=_0x29db92[_0x8b09('0x58')]['to'];return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0x29db92[_0x8b09('0x55')]['id']},'include':[{'model':db[_0x8b09('0x97')],'as':_0x8b09('0xb0'),'include':[{'model':db['CmContact'],'as':_0x8b09('0x98'),'where':{'mobile':_0x2bede1},'limit':0x1,'order':[[_0x8b09('0x86'),_0x8b09('0x99')]]}]}]})[_0x8b09('0x1d')](handleEntityNotFound(_0x1091fd,null))[_0x8b09('0x1d')](function(_0x252734){if(_0x252734&&_0x252734[_0x8b09('0xb0')]){_0x549bc2=_0x252734[_0x8b09('0x35')]({'plain':!![]});if(_0x549bc2[_0x8b09('0xb0')]&&_0x549bc2[_0x8b09('0xb0')][_0x8b09('0x98')][_0x8b09('0x64')]){return _0x549bc2['List'][_0x8b09('0x98')][0x0];}return db[_0x8b09('0x81')]['create'](_[_0x8b09('0x18')](_0x29db92[_0x8b09('0x58')],{'firstName':_0x2bede1,'mobile':_0x2bede1,'phone':_0x2bede1,'ListId':_0x549bc2[_0x8b09('0x88')]}));}})[_0x8b09('0x1d')](handleEntityNotFound(_0x1091fd,null))[_0x8b09('0x1d')](function(_0x40cb1c){if(_0x40cb1c){_0x4bcacf=_0x40cb1c;return db[_0x8b09('0x9c')][_0x8b09('0x56')]({'where':{'ContactId':_0x4bcacf['id'],'closed':![],'WhatsappAccountId':_0x549bc2['id']}})[_0x8b09('0x1d')](function(_0x48f76c){if(_0x48f76c){return[_0x48f76c,![]];}return db[_0x8b09('0x9c')][_0x8b09('0x57')]({'UserId':_0x29db92[_0x8b09('0x59')]['id'],'ContactId':_0x4bcacf['id'],'WhatsappAccountId':_0x549bc2['id'],'phone':_0x2bede1,'firstMsgDirection':'out','Messages':[_['merge'](_0x29db92[_0x8b09('0x58')],{'read':![],'body':_0x29db92[_0x8b09('0x58')][_0x8b09('0x58')],'phone':_0x2bede1,'WhatsappAccountId':_0x549bc2['id'],'UserId':_0x29db92[_0x8b09('0x59')]['id'],'ContactId':_0x4bcacf['id']})]},{'include':[{'model':db[_0x8b09('0xa2')],'as':'Messages'}]})[_0x8b09('0x1d')](function(_0x47045e){return[_0x47045e,!![]];});});}})[_0x8b09('0x70')](function(_0x506817,_0x208a88){if(_0x208a88){return _0x506817;}return db[_0x8b09('0xa2')][_0x8b09('0x57')](_[_0x8b09('0x50')](_0x29db92[_0x8b09('0x58')],{'read':![],'body':_0x29db92[_0x8b09('0x58')]['body'],'phone':_0x2bede1,'WhatsappAccountId':_0x549bc2['id'],'WhatsappInteractionId':_0x506817['id'],'UserId':_0x29db92[_0x8b09('0x59')]['id'],'ContactId':_0x4bcacf['id']}))[_0x8b09('0x1d')](function(_0x461527){_0x506817[_0x8b09('0xb1')][_0x8b09('0xb2')]=[];_0x506817['dataValues'][_0x8b09('0xb2')]['push'](_0x461527['dataValues']);return _0x506817;});})[_0x8b09('0x1d')](respondWithResult(_0x1091fd,null))[_0x8b09('0x28')](handleError(_0x1091fd,null));}; \ No newline at end of file +var _0x3676=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','find','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','CannedAnswer','map','removeAnswers','ids','addAgents','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','emit','User','getAgents','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','account','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','twilio','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','updatedAt','list','omit','Contacts','WhatsappInteraction','created','autoclose','push','close','unmanaged','interaction','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','send','to\x20is\x20mandatory','List','DESC','out','Messages','spread','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','create','body','user'];(function(_0x596734,_0x11bfa5){var _0x4c003a=function(_0x508e13){while(--_0x508e13){_0x596734['push'](_0x596734['shift']());}};_0x4c003a(++_0x11bfa5);}(_0x3676,0x11b));var _0x6367=function(_0x40b2ed,_0x2b1765){_0x40b2ed=_0x40b2ed-0x0;var _0x18397d=_0x3676[_0x40b2ed];return _0x18397d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6367('0x0'));var rimraf=require(_0x6367('0x1'));var zipdir=require(_0x6367('0x2'));var jsonpatch=require(_0x6367('0x3'));var rp=require(_0x6367('0x4'));var moment=require(_0x6367('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6367('0x6'));var util=require(_0x6367('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6367('0x8'));var ejs=require(_0x6367('0x9'));var fs=require('fs');var fs_extra=require(_0x6367('0xa'));var _=require(_0x6367('0xb'));var squel=require('squel');var crypto=require(_0x6367('0xc'));var jsforce=require(_0x6367('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6367('0x8'));var querystring=require(_0x6367('0xe'));var Papa=require(_0x6367('0xf'));var Redis=require(_0x6367('0x10'));var authService=require(_0x6367('0x11'));var qs=require(_0x6367('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6367('0x13'))(_0x6367('0x14'));var utils=require(_0x6367('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6367('0x16'));var db=require(_0x6367('0x17'))['db'];config['redis']=_[_0x6367('0x18')](config[_0x6367('0x19')],{'host':_0x6367('0x1a'),'port':0x18eb});var socket=require(_0x6367('0x1b'))(new Redis(config[_0x6367('0x19')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x6367('0x1c'));var client=jayson[_0x6367('0x1d')][_0x6367('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x1f58a9,_0x6965e8,_0x17a221,_0x34541e){return new BPromise(function(_0x58fe15,_0x29d81b){var _0x200f9b=_0x34541e||client;return _0x200f9b['request'](_0x1f58a9,_0x17a221)[_0x6367('0x1f')](function(_0x378837){logger[_0x6367('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x6965e8,_0x6367('0x21'));logger['debug'](_0x6367('0x22'),_0x6965e8,_0x6367('0x21'),JSON['stringify'](_0x378837));if(_0x378837['error']){if(_0x378837[_0x6367('0x23')][_0x6367('0x24')]===0x1f4){logger[_0x6367('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x6965e8,_0x378837[_0x6367('0x23')][_0x6367('0x25')]);return _0x29d81b(_0x378837[_0x6367('0x23')][_0x6367('0x25')]);}logger[_0x6367('0x23')](_0x6367('0x26'),_0x6965e8,_0x378837['error']['message']);return _0x58fe15(_0x378837[_0x6367('0x23')][_0x6367('0x25')]);}else{logger[_0x6367('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x6965e8,_0x6367('0x21'));_0x58fe15(_0x378837[_0x6367('0x27')][_0x6367('0x25')]);}})[_0x6367('0x28')](function(_0x538c86){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x6965e8,_0x538c86);_0x29d81b(_0x538c86);});});}function respondWithStatusCode(_0x21cd7b,_0x125655){_0x125655=_0x125655||0xcc;return function(_0x48126d){if(_0x48126d){return _0x21cd7b[_0x6367('0x29')](_0x125655);}return _0x21cd7b[_0x6367('0x2a')](_0x125655)['end']();};}function respondWithResult(_0x389ac0,_0x3ecbb0){_0x3ecbb0=_0x3ecbb0||0xc8;return function(_0x3a583b){if(_0x3a583b){return _0x389ac0['status'](_0x3ecbb0)[_0x6367('0x2b')](_0x3a583b);}};}function respondWithFilteredResult(_0x265953,_0x59acbe){return function(_0x5f2d0e){if(_0x5f2d0e){var _0x3683a2=_0x5f2d0e[_0x6367('0x2c')],_0x52d333=_0x59acbe[_0x6367('0x2d')],_0x385b2c=_0x59acbe[_0x6367('0x2d')]+_0x59acbe[_0x6367('0x2e')],_0x111046;if(_0x385b2c>=_0x3683a2){_0x385b2c=_0x3683a2;_0x111046=0xc8;}else{_0x111046=0xce;}_0x265953[_0x6367('0x2a')](_0x111046);return _0x265953[_0x6367('0x2f')](_0x6367('0x30'),_0x52d333+'-'+_0x385b2c+'/'+_0x3683a2)[_0x6367('0x2b')](_0x5f2d0e);}return null;};}function patchUpdates(_0x36de8d){return function(_0x286bea){try{jsonpatch[_0x6367('0x31')](_0x286bea,_0x36de8d,!![]);}catch(_0x1805c){return BPromise[_0x6367('0x32')](_0x1805c);}return _0x286bea[_0x6367('0x33')]();};}function saveUpdates(_0x43bc30,_0x4bd9ef){return function(_0xf6c451){if(_0xf6c451){return _0xf6c451[_0x6367('0x34')](_0x43bc30)[_0x6367('0x1f')](function(_0x5206ec){return _0x5206ec;});}return null;};}function removeEntity(_0xd3983e,_0x2facd0){return function(_0x29d384){if(_0x29d384){return _0x29d384[_0x6367('0x35')]()[_0x6367('0x1f')](function(){var _0x3f08d0=_0x29d384[_0x6367('0x36')]({'plain':!![]});var _0x3284d1=_0x6367('0x37');return db[_0x6367('0x38')][_0x6367('0x35')]({'where':{'type':_0x3284d1,'resourceId':_0x3f08d0['id']}})[_0x6367('0x1f')](function(){return _0x29d384;});})[_0x6367('0x1f')](function(){_0xd3983e[_0x6367('0x2a')](0xcc)[_0x6367('0x39')]();});}};}function handleEntityNotFound(_0x221762,_0x3cd9df){return function(_0x25cd08){if(!_0x25cd08){_0x221762['sendStatus'](0x194);}return _0x25cd08;};}function handleError(_0xf4769e,_0x3481b4){_0x3481b4=_0x3481b4||0x1f4;return function(_0x349f97){logger[_0x6367('0x23')](_0x349f97[_0x6367('0x3a')]);if(_0x349f97[_0x6367('0x3b')]){delete _0x349f97[_0x6367('0x3b')];}_0xf4769e['status'](_0x3481b4)['send'](_0x349f97);};}exports[_0x6367('0x3c')]=function(_0x16d4d0,_0x195eb7){var _0x2492a9={'include':[{'model':db[_0x6367('0x3d')],'as':_0x6367('0x3e')}]},_0x2e5d08={},_0x47d8ab={'count':0x0,'rows':[]};var _0xbbf099=_['map'](db[_0x6367('0x3f')][_0x6367('0x40')],function(_0x1e9d8d){return{'name':_0x1e9d8d[_0x6367('0x41')],'type':_0x1e9d8d[_0x6367('0x42')][_0x6367('0x43')]};});_0x2e5d08[_0x6367('0x44')]=_['map'](_0xbbf099,_0x6367('0x3b'));_0x2e5d08[_0x6367('0x45')]=_[_0x6367('0x46')](_0x16d4d0[_0x6367('0x45')]);_0x2e5d08[_0x6367('0x47')]=_[_0x6367('0x48')](_0x2e5d08[_0x6367('0x44')],_0x2e5d08[_0x6367('0x45')]);_0x2492a9[_0x6367('0x49')]=_['intersection'](_0x2e5d08[_0x6367('0x44')],qs[_0x6367('0x4a')](_0x16d4d0[_0x6367('0x45')][_0x6367('0x4a')]));_0x2492a9[_0x6367('0x49')]=_0x2492a9[_0x6367('0x49')]['length']?_0x2492a9[_0x6367('0x49')]:_0x2e5d08[_0x6367('0x44')];if(!_0x16d4d0[_0x6367('0x45')][_0x6367('0x4b')](_0x6367('0x4c'))){_0x2492a9[_0x6367('0x2e')]=qs[_0x6367('0x2e')](_0x16d4d0[_0x6367('0x45')][_0x6367('0x2e')]);_0x2492a9[_0x6367('0x2d')]=qs['offset'](_0x16d4d0[_0x6367('0x45')][_0x6367('0x2d')]);}_0x2492a9[_0x6367('0x4d')]=qs[_0x6367('0x4e')](_0x16d4d0[_0x6367('0x45')][_0x6367('0x4e')]);_0x2492a9[_0x6367('0x4f')]=qs[_0x6367('0x47')](_[_0x6367('0x50')](_0x16d4d0[_0x6367('0x45')],_0x2e5d08[_0x6367('0x47')]),_0xbbf099);if(_0x16d4d0[_0x6367('0x45')][_0x6367('0x51')]){_0x2492a9[_0x6367('0x4f')]=_[_0x6367('0x52')](_0x2492a9[_0x6367('0x4f')],{'$or':_['map'](_0xbbf099,function(_0x1c312c){if(_0x1c312c[_0x6367('0x42')]!==_0x6367('0x53')){var _0x5eee63={};_0x5eee63[_0x1c312c['name']]={'$like':'%'+_0x16d4d0[_0x6367('0x45')]['filter']+'%'};return _0x5eee63;}})});}_0x2492a9=_[_0x6367('0x52')]({},_0x2492a9,_0x16d4d0[_0x6367('0x54')]);var _0x6a6b58={'where':_0x2492a9[_0x6367('0x4f')]};return db[_0x6367('0x3f')][_0x6367('0x2c')](_0x6a6b58)[_0x6367('0x1f')](function(_0x4aa671){_0x47d8ab['count']=_0x4aa671;if(_0x16d4d0['query'][_0x6367('0x55')]){_0x2492a9[_0x6367('0x56')]=[{'all':!![]}];}return db[_0x6367('0x3f')][_0x6367('0x57')](_0x2492a9);})[_0x6367('0x1f')](function(_0x45d0ef){_0x47d8ab[_0x6367('0x58')]=_0x45d0ef;return _0x47d8ab;})[_0x6367('0x1f')](respondWithFilteredResult(_0x195eb7,_0x2492a9))['catch'](handleError(_0x195eb7,null));};exports[_0x6367('0x59')]=function(_0x3db47b,_0x1319ad){var _0x254339={'raw':![],'where':{'id':_0x3db47b[_0x6367('0x5a')]['id']},'include':[{'model':db[_0x6367('0x3d')],'as':'mandatoryDispositionPause'}]},_0x188b70={};_0x188b70[_0x6367('0x44')]=_[_0x6367('0x46')](db[_0x6367('0x3f')]['rawAttributes']);_0x188b70[_0x6367('0x45')]=_['keys'](_0x3db47b[_0x6367('0x45')]);_0x188b70['filters']=_[_0x6367('0x48')](_0x188b70[_0x6367('0x44')],_0x188b70[_0x6367('0x45')]);_0x254339[_0x6367('0x49')]=_[_0x6367('0x48')](_0x188b70['model'],qs[_0x6367('0x4a')](_0x3db47b[_0x6367('0x45')]['fields']));_0x254339['attributes']=_0x254339[_0x6367('0x49')][_0x6367('0x5b')]?_0x254339['attributes']:_0x188b70[_0x6367('0x44')];if(_0x3db47b[_0x6367('0x45')][_0x6367('0x55')]){_0x254339[_0x6367('0x56')]=[{'all':!![]}];}_0x254339=_['merge']({},_0x254339,_0x3db47b['options']);return db[_0x6367('0x3f')]['find'](_0x254339)[_0x6367('0x1f')](handleEntityNotFound(_0x1319ad,null))['then'](respondWithResult(_0x1319ad,null))['catch'](handleError(_0x1319ad,null));};exports['create']=function(_0x2eb357,_0x47de48){return db[_0x6367('0x3f')][_0x6367('0x5c')](_0x2eb357[_0x6367('0x5d')],{})['then'](function(_0x1ea65f){var _0x18f0c4=_0x2eb357[_0x6367('0x5e')][_0x6367('0x36')]({'plain':!![]});if(!_0x18f0c4)throw new Error(_0x6367('0x5f'));if(_0x18f0c4['role']===_0x6367('0x5e')){var _0x21bd8c=_0x1ea65f[_0x6367('0x36')]({'plain':!![]});var _0x8c2b3e=_0x6367('0x37');return db[_0x6367('0x60')]['find']({'where':{'name':_0x8c2b3e,'userProfileId':_0x18f0c4[_0x6367('0x61')]},'raw':!![]})[_0x6367('0x1f')](function(_0x5a8d1e){if(_0x5a8d1e&&_0x5a8d1e[_0x6367('0x62')]===0x0){return db[_0x6367('0x38')]['create']({'name':_0x21bd8c[_0x6367('0x3b')],'resourceId':_0x21bd8c['id'],'type':_0x5a8d1e['name'],'sectionId':_0x5a8d1e['id']},{})[_0x6367('0x1f')](function(){return _0x1ea65f;});}else{return _0x1ea65f;}})['catch'](function(_0x91425d){logger[_0x6367('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x91425d);throw _0x91425d;});}return _0x1ea65f;})[_0x6367('0x1f')](respondWithResult(_0x47de48,0xc9))['catch'](handleError(_0x47de48,null));};exports[_0x6367('0x34')]=function(_0x20b709,_0x2ec6ee){if(_0x20b709[_0x6367('0x5d')]['id']){delete _0x20b709[_0x6367('0x5d')]['id'];}return db['WhatsappAccount'][_0x6367('0x63')]({'where':{'id':_0x20b709[_0x6367('0x5a')]['id']},'include':[{'model':db[_0x6367('0x3d')],'as':_0x6367('0x3e')}]})[_0x6367('0x1f')](handleEntityNotFound(_0x2ec6ee,null))[_0x6367('0x1f')](saveUpdates(_0x20b709[_0x6367('0x5d')],null))[_0x6367('0x1f')](respondWithResult(_0x2ec6ee,null))[_0x6367('0x28')](handleError(_0x2ec6ee,null));};exports['destroy']=function(_0x4c3d3c,_0x373f04){return db[_0x6367('0x3f')][_0x6367('0x63')]({'where':{'id':_0x4c3d3c[_0x6367('0x5a')]['id']}})[_0x6367('0x1f')](handleEntityNotFound(_0x373f04,null))['then'](removeEntity(_0x373f04,null))[_0x6367('0x28')](handleError(_0x373f04,null));};exports[_0x6367('0x64')]=function(_0x520ff8,_0x43454f){return db[_0x6367('0x3f')][_0x6367('0x64')]()['then'](respondWithResult(_0x43454f,null))[_0x6367('0x28')](handleError(_0x43454f,null));};exports[_0x6367('0x65')]=function(_0x163f4d,_0x35e116,_0x13a350){if(_0x163f4d['body']['id']){delete _0x163f4d[_0x6367('0x5d')]['id'];}return db[_0x6367('0x3f')][_0x6367('0x63')]({'where':{'id':_0x163f4d['params']['id']}})[_0x6367('0x1f')](handleEntityNotFound(_0x35e116,null))[_0x6367('0x1f')](function(_0x38bda9){if(_0x38bda9){_0x163f4d[_0x6367('0x5d')][_0x6367('0x66')]=_0x38bda9['id'];return db['Disposition'][_0x6367('0x5c')](_0x163f4d[_0x6367('0x5d')]);}})[_0x6367('0x1f')](respondWithResult(_0x35e116,null))[_0x6367('0x28')](handleError(_0x35e116,null));};exports[_0x6367('0x67')]=function(_0x2673ae,_0x589ab3,_0x1048ec){var _0x388624={'raw':![],'where':{}};var _0x1be0a8={};var _0x3889ac={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x6367('0x68')]({'where':{'id':_0x2673ae['params']['id']}})[_0x6367('0x1f')](handleEntityNotFound(_0x589ab3,null))[_0x6367('0x1f')](function(_0x11e09b){if(_0x11e09b){_0x1be0a8[_0x6367('0x44')]=_[_0x6367('0x46')](db[_0x6367('0x69')][_0x6367('0x40')]);_0x1be0a8['query']=_[_0x6367('0x46')](_0x2673ae['query']);_0x1be0a8[_0x6367('0x47')]=_[_0x6367('0x48')](_0x1be0a8['model'],_0x1be0a8[_0x6367('0x45')]);_0x388624[_0x6367('0x49')]=_['intersection'](_0x1be0a8[_0x6367('0x44')],qs[_0x6367('0x4a')](_0x2673ae[_0x6367('0x45')][_0x6367('0x4a')]));_0x388624[_0x6367('0x49')]=_0x388624['attributes'][_0x6367('0x5b')]?_0x388624[_0x6367('0x49')]:_0x1be0a8[_0x6367('0x44')];if(!_0x2673ae['query'][_0x6367('0x4b')](_0x6367('0x4c'))){_0x388624['limit']=qs[_0x6367('0x2e')](_0x2673ae[_0x6367('0x45')]['limit']);_0x388624[_0x6367('0x2d')]=qs[_0x6367('0x2d')](_0x2673ae['query'][_0x6367('0x2d')]);}_0x388624['order']=qs[_0x6367('0x4e')](_0x2673ae['query'][_0x6367('0x4e')]);_0x388624[_0x6367('0x4f')]=qs['filters'](_['pick'](_0x2673ae[_0x6367('0x45')],_0x1be0a8[_0x6367('0x47')]));_0x388624[_0x6367('0x4f')][_0x6367('0x66')]=_0x11e09b['id'];if(_0x2673ae['query'][_0x6367('0x51')]){_0x388624[_0x6367('0x4f')]=_[_0x6367('0x52')](_0x388624[_0x6367('0x4f')],{'$or':_['map'](_0x388624[_0x6367('0x49')],function(_0x2c3c20){var _0x45914c={};_0x45914c[_0x2c3c20]={'$like':'%'+_0x2673ae[_0x6367('0x45')][_0x6367('0x51')]+'%'};return _0x45914c;})});}_0x388624=_[_0x6367('0x52')]({},_0x388624,_0x2673ae['options']);return db['Disposition'][_0x6367('0x2c')]({'where':_0x388624[_0x6367('0x4f')]})['then'](function(_0x39f570){_0x3889ac[_0x6367('0x2c')]=_0x39f570;if(_0x2673ae[_0x6367('0x45')][_0x6367('0x55')]){_0x388624[_0x6367('0x56')]=[{'all':!![]}];}return db[_0x6367('0x69')][_0x6367('0x57')](_0x388624);})[_0x6367('0x1f')](function(_0x4f584f){_0x3889ac[_0x6367('0x58')]=_0x4f584f;return _0x3889ac;});}})['then'](respondWithFilteredResult(_0x589ab3,_0x388624))[_0x6367('0x28')](handleError(_0x589ab3,null));};exports[_0x6367('0x6a')]=function(_0x309e67,_0x3fed22,_0x31e395){return db[_0x6367('0x3f')]['find']({'where':{'id':_0x309e67['params']['id']}})['then'](handleEntityNotFound(_0x3fed22,null))['then'](function(_0x3e1ae3){if(_0x3e1ae3){return _0x3e1ae3[_0x6367('0x6a')](_0x309e67['query']['ids']);}})[_0x6367('0x1f')](respondWithStatusCode(_0x3fed22,null))['catch'](handleError(_0x3fed22,null));};exports['addAnswer']=function(_0x2f48b9,_0x12aa46,_0x44fa3f){if(_0x2f48b9[_0x6367('0x5d')]['id']){delete _0x2f48b9['body']['id'];}return db[_0x6367('0x3f')][_0x6367('0x63')]({'where':{'id':_0x2f48b9[_0x6367('0x5a')]['id']}})[_0x6367('0x1f')](handleEntityNotFound(_0x12aa46,null))[_0x6367('0x1f')](function(_0x2b15d1){if(_0x2b15d1){_0x2f48b9[_0x6367('0x5d')][_0x6367('0x66')]=_0x2b15d1['id'];return db[_0x6367('0x6b')][_0x6367('0x5c')](_0x2f48b9[_0x6367('0x5d')]);}})[_0x6367('0x1f')](respondWithResult(_0x12aa46,null))[_0x6367('0x28')](handleError(_0x12aa46,null));};exports['getAnswers']=function(_0x413240,_0x24762a,_0x118f71){var _0x5bf314={'raw':![],'where':{}};var _0x233833={};var _0x1985eb={'count':0x0,'rows':[]};return db[_0x6367('0x3f')][_0x6367('0x68')]({'where':{'id':_0x413240['params']['id']}})['then'](handleEntityNotFound(_0x24762a,null))[_0x6367('0x1f')](function(_0x22b922){if(_0x22b922){_0x233833['model']=_[_0x6367('0x46')](db[_0x6367('0x6b')][_0x6367('0x40')]);_0x233833[_0x6367('0x45')]=_[_0x6367('0x46')](_0x413240['query']);_0x233833[_0x6367('0x47')]=_[_0x6367('0x48')](_0x233833[_0x6367('0x44')],_0x233833[_0x6367('0x45')]);_0x5bf314['attributes']=_[_0x6367('0x48')](_0x233833['model'],qs[_0x6367('0x4a')](_0x413240[_0x6367('0x45')]['fields']));_0x5bf314[_0x6367('0x49')]=_0x5bf314[_0x6367('0x49')][_0x6367('0x5b')]?_0x5bf314[_0x6367('0x49')]:_0x233833[_0x6367('0x44')];if(!_0x413240['query'][_0x6367('0x4b')]('nolimit')){_0x5bf314[_0x6367('0x2e')]=qs['limit'](_0x413240['query'][_0x6367('0x2e')]);_0x5bf314['offset']=qs[_0x6367('0x2d')](_0x413240['query'][_0x6367('0x2d')]);}_0x5bf314['order']=qs[_0x6367('0x4e')](_0x413240['query']['sort']);_0x5bf314[_0x6367('0x4f')]=qs[_0x6367('0x47')](_[_0x6367('0x50')](_0x413240[_0x6367('0x45')],_0x233833[_0x6367('0x47')]));_0x5bf314['where'][_0x6367('0x66')]=_0x22b922['id'];if(_0x413240[_0x6367('0x45')][_0x6367('0x51')]){_0x5bf314['where']=_['merge'](_0x5bf314[_0x6367('0x4f')],{'$or':_[_0x6367('0x6c')](_0x5bf314[_0x6367('0x49')],function(_0x4cb8df){var _0x403245={};_0x403245[_0x4cb8df]={'$like':'%'+_0x413240['query'][_0x6367('0x51')]+'%'};return _0x403245;})});}_0x5bf314=_[_0x6367('0x52')]({},_0x5bf314,_0x413240[_0x6367('0x54')]);return db[_0x6367('0x6b')][_0x6367('0x2c')]({'where':_0x5bf314[_0x6367('0x4f')]})['then'](function(_0x2bdd50){_0x1985eb[_0x6367('0x2c')]=_0x2bdd50;if(_0x413240[_0x6367('0x45')][_0x6367('0x55')]){_0x5bf314[_0x6367('0x56')]=[{'all':!![]}];}return db[_0x6367('0x6b')]['findAll'](_0x5bf314);})[_0x6367('0x1f')](function(_0x53a120){_0x1985eb['rows']=_0x53a120;return _0x1985eb;});}})['then'](respondWithFilteredResult(_0x24762a,_0x5bf314))[_0x6367('0x28')](handleError(_0x24762a,null));};exports[_0x6367('0x6d')]=function(_0x42ca66,_0x1e4e8f,_0x38a688){return db[_0x6367('0x3f')][_0x6367('0x63')]({'where':{'id':_0x42ca66[_0x6367('0x5a')]['id']}})[_0x6367('0x1f')](handleEntityNotFound(_0x1e4e8f,null))['then'](function(_0x439471){if(_0x439471){return _0x439471[_0x6367('0x6d')](_0x42ca66['query'][_0x6367('0x6e')]);}})[_0x6367('0x1f')](respondWithStatusCode(_0x1e4e8f,null))['catch'](handleError(_0x1e4e8f,null));};exports['addAgents']=function(_0x40bc83,_0x57ff6c,_0x1b1057){return db[_0x6367('0x3f')][_0x6367('0x63')]({'where':{'id':_0x40bc83[_0x6367('0x5a')]['id']}})[_0x6367('0x1f')](handleEntityNotFound(_0x57ff6c,null))[_0x6367('0x1f')](function(_0x682bd2){if(_0x682bd2){return _0x682bd2[_0x6367('0x6f')](_0x40bc83[_0x6367('0x5d')][_0x6367('0x6e')],_['omit'](_0x40bc83[_0x6367('0x5d')],['ids','id'])||{})['spread'](function(_0x11e7a9){for(var _0x4b1a3d=0x0;_0x4b1a3d<_0x40bc83['body']['ids'][_0x6367('0x5b')];_0x4b1a3d+=0x1){socket['emit'](_0x6367('0x70'),{'UserId':_0x40bc83[_0x6367('0x5d')][_0x6367('0x6e')][_0x4b1a3d],'WhatsappAccountId':_0x40bc83['params']['id']});}return _0x11e7a9;});}})['then'](respondWithResult(_0x57ff6c,null))[_0x6367('0x28')](handleError(_0x57ff6c,null));};exports['removeAgents']=function(_0x2cdc66,_0x3e5255,_0x191f7a){return db['WhatsappAccount']['find']({'where':{'id':_0x2cdc66['params']['id']}})['then'](handleEntityNotFound(_0x3e5255,null))[_0x6367('0x1f')](function(_0x556272){if(_0x556272){return _0x556272[_0x6367('0x71')](_0x2cdc66[_0x6367('0x45')][_0x6367('0x6e')])[_0x6367('0x1f')](function(){if(_['isArray'](_0x2cdc66[_0x6367('0x45')][_0x6367('0x6e')])){for(var _0x1124d5=0x0;_0x1124d5<_0x2cdc66['query'][_0x6367('0x6e')][_0x6367('0x5b')];_0x1124d5+=0x1){socket['emit'](_0x6367('0x72'),{'UserId':Number(_0x2cdc66['query'][_0x6367('0x6e')][_0x1124d5]),'WhatsappAccountId':Number(_0x2cdc66[_0x6367('0x5a')]['id'])});}}else{socket[_0x6367('0x73')](_0x6367('0x72'),{'UserId':Number(_0x2cdc66['query'][_0x6367('0x6e')]),'WhatsappAccountId':Number(_0x2cdc66[_0x6367('0x5a')]['id'])});}});}})[_0x6367('0x1f')](respondWithStatusCode(_0x3e5255,null))[_0x6367('0x28')](handleError(_0x3e5255,null));};exports['getAgents']=function(_0x4b09b9,_0x24caf4,_0x5d2f42){var _0x167e78={};var _0x40e502={};var _0xb3684c;var _0x2d1c9c;return db[_0x6367('0x3f')][_0x6367('0x68')]({'where':{'id':_0x4b09b9[_0x6367('0x5a')]['id']}})[_0x6367('0x1f')](handleEntityNotFound(_0x24caf4,null))[_0x6367('0x1f')](function(_0x22d6f0){if(_0x22d6f0){_0xb3684c=_0x22d6f0;_0x40e502[_0x6367('0x44')]=_[_0x6367('0x46')](db[_0x6367('0x74')][_0x6367('0x40')]);_0x40e502[_0x6367('0x45')]=_['keys'](_0x4b09b9[_0x6367('0x45')]);_0x40e502['filters']=_['intersection'](_0x40e502[_0x6367('0x44')],_0x40e502[_0x6367('0x45')]);_0x167e78[_0x6367('0x49')]=_[_0x6367('0x48')](_0x40e502[_0x6367('0x44')],qs['fields'](_0x4b09b9['query'][_0x6367('0x4a')]));_0x167e78['attributes']=_0x167e78[_0x6367('0x49')][_0x6367('0x5b')]?_0x167e78['attributes']:_0x40e502['model'];_0x167e78[_0x6367('0x4d')]=qs[_0x6367('0x4e')](_0x4b09b9[_0x6367('0x45')][_0x6367('0x4e')]);_0x167e78['where']=qs[_0x6367('0x47')](_[_0x6367('0x50')](_0x4b09b9[_0x6367('0x45')],_0x40e502[_0x6367('0x47')]));if(_0x4b09b9['query'][_0x6367('0x51')]){_0x167e78[_0x6367('0x4f')]=_[_0x6367('0x52')](_0x167e78[_0x6367('0x4f')],{'$or':_[_0x6367('0x6c')](_0x167e78[_0x6367('0x49')],function(_0x19225e){var _0x5283ce={};_0x5283ce[_0x19225e]={'$like':'%'+_0x4b09b9[_0x6367('0x45')]['filter']+'%'};return _0x5283ce;})});}_0x167e78=_[_0x6367('0x52')]({},_0x167e78,_0x4b09b9['options']);return _0xb3684c[_0x6367('0x75')](_0x167e78);}})[_0x6367('0x1f')](function(_0x29ff43){if(_0x29ff43){_0x2d1c9c=_0x29ff43[_0x6367('0x5b')];if(!_0x4b09b9[_0x6367('0x45')][_0x6367('0x4b')](_0x6367('0x4c'))){_0x167e78['limit']=qs['limit'](_0x4b09b9[_0x6367('0x45')]['limit']);_0x167e78[_0x6367('0x2d')]=qs['offset'](_0x4b09b9[_0x6367('0x45')][_0x6367('0x2d')]);}return _0xb3684c[_0x6367('0x75')](_0x167e78);}})[_0x6367('0x1f')](function(_0x12ce65){if(_0x12ce65){return _0x12ce65?{'count':_0x2d1c9c,'rows':_0x12ce65}:null;}})[_0x6367('0x1f')](respondWithResult(_0x24caf4,null))[_0x6367('0x28')](handleError(_0x24caf4,null));};exports['addApplications']=function(_0x2bd55a,_0x5f345d,_0x6c8f0f){return db[_0x6367('0x3f')][_0x6367('0x68')]({'where':{'id':_0x2bd55a['params']['id']}})[_0x6367('0x1f')](handleEntityNotFound(_0x5f345d,null))['then'](function(_0x16c315){if(_0x16c315){return db[_0x6367('0x76')][_0x6367('0x77')](function(_0x417c5c){return db[_0x6367('0x78')][_0x6367('0x35')]({'where':{'WhatsappAccountId':_0x2bd55a[_0x6367('0x5a')]['id']},'transaction':_0x417c5c})[_0x6367('0x1f')](function(_0x3cc848){var _0x202168=_[_0x6367('0x6c')](_0x2bd55a['body'],function(_0x20bdc8){_0x20bdc8[_0x6367('0x66')]=_0x2bd55a[_0x6367('0x5a')]['id'];return _0x20bdc8;});return db[_0x6367('0x78')][_0x6367('0x79')](_0x202168,{'transaction':_0x417c5c});});})['then'](function(){return db['WhatsappApplication'][_0x6367('0x7a')]({'where':{'WhatsappAccountId':_0x2bd55a['params']['id']},'order':_0x6367('0x7b')});});}})[_0x6367('0x1f')](respondWithResult(_0x5f345d,null))[_0x6367('0x28')](handleError(_0x5f345d,null));};exports[_0x6367('0x7c')]=function(_0x19eb0d,_0x56c386,_0x1b9a40){var _0x33b1b3={};var _0x3aad43={};var _0x2f5536;var _0x5f496e;return db['WhatsappAccount']['findOne']({'where':{'id':_0x19eb0d[_0x6367('0x5a')]['id']}})[_0x6367('0x1f')](handleEntityNotFound(_0x56c386,null))[_0x6367('0x1f')](function(_0x52390c){if(_0x52390c){_0x2f5536=_0x52390c;_0x3aad43[_0x6367('0x44')]=_[_0x6367('0x46')](db['WhatsappApplication']['rawAttributes']);_0x3aad43[_0x6367('0x45')]=_['keys'](_0x19eb0d[_0x6367('0x45')]);_0x3aad43[_0x6367('0x47')]=_[_0x6367('0x48')](_0x3aad43[_0x6367('0x44')],_0x3aad43['query']);_0x33b1b3[_0x6367('0x49')]=_[_0x6367('0x48')](_0x3aad43[_0x6367('0x44')],qs['fields'](_0x19eb0d['query'][_0x6367('0x4a')]));_0x33b1b3[_0x6367('0x49')]=_0x33b1b3[_0x6367('0x49')]['length']?_0x33b1b3[_0x6367('0x49')]:_0x3aad43['model'];_0x33b1b3['order']=qs[_0x6367('0x4e')](_0x19eb0d[_0x6367('0x45')][_0x6367('0x4e')]);_0x33b1b3['where']=qs['filters'](_[_0x6367('0x50')](_0x19eb0d['query'],_0x3aad43[_0x6367('0x47')]));if(_0x19eb0d[_0x6367('0x45')]['filter']){_0x33b1b3[_0x6367('0x4f')]=_['merge'](_0x33b1b3[_0x6367('0x4f')],{'$or':_['map'](_0x33b1b3[_0x6367('0x49')],function(_0x5bf3ee){var _0x30f8c7={};_0x30f8c7[_0x5bf3ee]={'$like':'%'+_0x19eb0d[_0x6367('0x45')]['filter']+'%'};return _0x30f8c7;})});}_0x33b1b3=_[_0x6367('0x52')]({},_0x33b1b3,_0x19eb0d['options']);return _0x2f5536[_0x6367('0x7c')](_0x33b1b3);}})[_0x6367('0x1f')](function(_0x5e6126){if(_0x5e6126){_0x5f496e=_0x5e6126[_0x6367('0x5b')];if(!_0x19eb0d['query'][_0x6367('0x4b')](_0x6367('0x4c'))){_0x33b1b3[_0x6367('0x2e')]=qs[_0x6367('0x2e')](_0x19eb0d['query'][_0x6367('0x2e')]);_0x33b1b3[_0x6367('0x2d')]=qs[_0x6367('0x2d')](_0x19eb0d[_0x6367('0x45')]['offset']);}return _0x2f5536[_0x6367('0x7c')](_0x33b1b3);}})['then'](function(_0x3ea358){if(_0x3ea358){return _0x3ea358?{'count':_0x5f496e,'rows':_0x3ea358}:null;}})['then'](respondWithResult(_0x56c386,null))['catch'](handleError(_0x56c386,null));};exports[_0x6367('0x7d')]=function(_0x425d29,_0x11d0e4,_0x104c6d){var _0x4fe21b={'channel':_0x6367('0x7e')};var _0x41766=[];var _0x34dde6=[];var _0x2d8e47={};return db[_0x6367('0x3f')]['find']({'where':{'id':_0x425d29[_0x6367('0x5a')]['id']},'include':[{'model':db[_0x6367('0x78')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x11d0e4,null))[_0x6367('0x1f')](function(_0x452d0f){_0x4fe21b[_0x6367('0x7f')]=_0x452d0f;_0x4fe21b[_0x6367('0x80')]=_[_0x6367('0x81')](_0x452d0f[_0x6367('0x82')],['priority'],[_0x6367('0x83')]);if(_0x4fe21b[_0x6367('0x7f')][_0x6367('0x82')]){delete _0x4fe21b[_0x6367('0x7f')][_0x6367('0x82')];}return db[_0x6367('0x84')][_0x6367('0x64')]();})[_0x6367('0x1f')](function(_0x251a84){if(!_0x251a84){throw new db[(_0x6367('0x85'))][(_0x6367('0x86'))](_0x6367('0x87'));}_0x41766=_[_0x6367('0x88')](_[_0x6367('0x46')](_0x251a84),[_0x6367('0x89'),'updatedAt']);_0x34dde6=_[_0x6367('0x88')](_[_0x6367('0x46')](_0x251a84),[_0x6367('0x89'),'updatedAt',_0x6367('0x8a'),_0x6367('0x8b')]);_0x4fe21b[_0x6367('0x5d')]={'mapKey':'mobile'};if(_0x4fe21b['account'][_0x6367('0x42')]&&_0x4fe21b[_0x6367('0x7f')][_0x6367('0x42')]===_0x6367('0x8c')){_0x4fe21b[_0x6367('0x5d')]['from']=_0x425d29[_0x6367('0x5d')][_0x6367('0x8d')][_0x6367('0x8e')](_0x6367('0x8f'),'');_0x4fe21b[_0x6367('0x5d')][_0x6367('0x5d')]=_0x425d29['body'][_0x6367('0x90')];_0x4fe21b[_0x6367('0x5d')][_0x6367('0x91')]=_0x425d29[_0x6367('0x5d')][_0x6367('0x92')];}if(_0x4fe21b[_0x6367('0x5d')]['id']){delete _0x4fe21b['body']['id'];}if(_[_0x6367('0x93')](_0x4fe21b['body'][_0x6367('0x94')])){throw new db[(_0x6367('0x85'))][(_0x6367('0x86'))]('from\x20is\x20mandatory');}if(_[_0x6367('0x93')](_0x4fe21b[_0x6367('0x5d')]['body'])||_0x4fe21b[_0x6367('0x5d')][_0x6367('0x5d')]===''){throw new db[(_0x6367('0x85'))][(_0x6367('0x86'))](_0x6367('0x95'));}if(_[_0x6367('0x93')](_0x4fe21b[_0x6367('0x5d')][_0x6367('0x96')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x34dde6);}if(!_[_0x6367('0x97')](_0x34dde6,_0x4fe21b['body']['mapKey'])){throw new db[(_0x6367('0x85'))][(_0x6367('0x86'))](_0x6367('0x98')+_0x34dde6);}_0x2d8e47[_0x4fe21b['body'][_0x6367('0x96')]]=_0x4fe21b[_0x6367('0x5d')][_0x6367('0x94')];return db[_0x6367('0x99')]['find']({'where':{'id':_0x4fe21b[_0x6367('0x7f')][_0x6367('0x8b')]},'include':[{'model':db[_0x6367('0x84')],'as':'Contacts','where':_0x2d8e47,'limit':0x1,'order':[[_0x6367('0x9a'),'DESC']]}]});})[_0x6367('0x1f')](handleEntityNotFound(_0x11d0e4,null))[_0x6367('0x1f')](function(_0x407ebd){if(_0x407ebd){_0x4fe21b[_0x6367('0x9b')]=_[_0x6367('0x9c')](_0x407ebd,[_0x6367('0x9d')]);if(_0x407ebd['Contacts'][_0x6367('0x5b')]){return _0x407ebd[_0x6367('0x9d')][0x0];}var _0x1b594e=_[_0x6367('0x18')](_0x4fe21b[_0x6367('0x5d')],{'firstName':_0x4fe21b['body'][_0x6367('0x94')],'ListId':_0x407ebd['id']});_0x1b594e[_0x4fe21b[_0x6367('0x5d')][_0x6367('0x96')]]=_0x4fe21b[_0x6367('0x5d')][_0x6367('0x94')];return db[_0x6367('0x84')]['create'](_0x1b594e,{'fields':_0x41766,'raw':!![]});}})['then'](handleEntityNotFound(_0x11d0e4,null))['then'](function(_0x512322){if(_0x512322){_0x4fe21b['contact']=_0x512322;var _0xa87c3d={'ContactId':_0x512322['id'],'phone':_0x4fe21b[_0x6367('0x5d')][_0x6367('0x94')],'WhatsappAccountId':_0x425d29['params']['id']};var _0x12f327={'ContactId':_0x512322['id'],'WhatsappAccountId':_0x425d29['params']['id'],'closed':![]};return db[_0x6367('0x9e')][_0x6367('0x63')]({'where':_0x12f327})['then'](function(_0x4d14a7){if(_0x4d14a7){return[_0x4d14a7,![]];}return db['WhatsappInteraction'][_0x6367('0x5c')](_0xa87c3d)[_0x6367('0x1f')](function(_0x1532a4){return[_0x1532a4,!![]];});});}})['spread'](function(_0x200b98,_0x4d22b9){_0x4fe21b['interaction']=_0x200b98['get']({'plain':!![]});_0x4fe21b['interaction'][_0x6367('0x9f')]=![];if(_0x4d22b9){if(_0x4fe21b[_0x6367('0x7f')][_0x6367('0xa0')]){_0x4fe21b[_0x6367('0x80')][_0x6367('0xa1')]({'id':0x0,'priority':_0x4fe21b['applications'][_0x6367('0x5b')]+0x1,'app':_0x6367('0xa2'),'appdata':_0x6367('0xa3'),'interval':'*,*,*,*'});}_0x4fe21b[_0x6367('0xa4')][_0x6367('0x9f')]=!![];}return db[_0x6367('0xa5')][_0x6367('0x5c')]({'phone':_0x4fe21b[_0x6367('0x5d')]['from'],'messageId':_0x4fe21b['body'][_0x6367('0x91')],'body':_0x4fe21b['body'][_0x6367('0x5d')],'WhatsappAccountId':_0x425d29[_0x6367('0x5a')]['id'],'WhatsappInteractionId':_0x200b98['id'],'direction':'in','ContactId':_0x200b98[_0x6367('0xa6')],'AttachmentId':_0x4fe21b['body'][_0x6367('0xa7')]});})[_0x6367('0x1f')](function(_0x460509){_0x4fe21b[_0x6367('0x25')]=_0x460509;if(_0x4fe21b['interaction']['UserId']){return db[_0x6367('0x74')][_0x6367('0x63')]({'attributes':['id',_0x6367('0x3b')],'where':{'id':_0x4fe21b['interaction'][_0x6367('0xa8')]}})[_0x6367('0x1f')](function(_0x4341e3){if(_0x4341e3){_0x4fe21b[_0x6367('0x80')][_0x6367('0xa9')]({'id':0x0,'priority':0x0,'app':_0x6367('0xaa'),'appdata':_0x4341e3[_0x6367('0x3b')]+','+(_0x4fe21b[_0x6367('0x7f')][_0x6367('0xab')]||0xa),'interval':_0x6367('0xac')});}return respondWithRpcPromise(_0x6367('0xad'),_0x6367('0xae'),_0x4fe21b);});}return respondWithRpcPromise(_0x6367('0xad'),_0x6367('0xae'),_0x4fe21b);})[_0x6367('0x1f')](function(_0x193e24){if(_0x193e24){var _0x59a953=0xc8;var _0x4c0d42=_0x6367('0xaf');logger[_0x6367('0x20')](_0x6367('0x22'),_0x4c0d42,_0x59a953,_0x6367('0xb0'));logger['debug'](_0x6367('0xb1'),_0x4c0d42,_0x59a953,'entity\x20found',JSON[_0x6367('0xb2')](_0x193e24));if(_0x4fe21b['account'][_0x6367('0x42')]===_0x6367('0x8c')){return _0x11d0e4[_0x6367('0x2a')](_0x59a953)[_0x6367('0x2f')](_0x6367('0xb3'),_0x6367('0xb4'))[_0x6367('0xb5')]('\x0a');}else{return _0x11d0e4['status'](_0x59a953)['json'](_0x193e24);}}})[_0x6367('0x28')](handleError(_0x11d0e4,null));};exports[_0x6367('0xb5')]=function(_0x401f74,_0x49f6cd,_0x7f30a0){var _0x1354f5,_0x56b40a,_0x357b58;if(_[_0x6367('0x93')](_0x401f74[_0x6367('0x5d')][_0x6367('0x5d')])||_0x401f74[_0x6367('0x5d')][_0x6367('0x5d')]===''){throw new db[(_0x6367('0x85'))]['ValidationError'](_0x6367('0x95'));}if(_['isNil'](_0x401f74[_0x6367('0x5d')]['to'])){throw new db[(_0x6367('0x85'))][(_0x6367('0x86'))](_0x6367('0xb6'));}_0x1354f5=_0x401f74[_0x6367('0x5d')]['to'];return db[_0x6367('0x3f')][_0x6367('0x63')]({'where':{'id':_0x401f74['params']['id']},'include':[{'model':db[_0x6367('0x99')],'as':_0x6367('0xb7'),'include':[{'model':db['CmContact'],'as':_0x6367('0x9d'),'where':{'mobile':_0x1354f5},'limit':0x1,'order':[[_0x6367('0x9a'),_0x6367('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x49f6cd,null))['then'](function(_0x317d79){if(_0x317d79&&_0x317d79[_0x6367('0xb7')]){_0x56b40a=_0x317d79[_0x6367('0x36')]({'plain':!![]});if(_0x56b40a[_0x6367('0xb7')]&&_0x56b40a[_0x6367('0xb7')][_0x6367('0x9d')][_0x6367('0x5b')]){return _0x56b40a[_0x6367('0xb7')][_0x6367('0x9d')][0x0];}return db[_0x6367('0x84')]['create'](_[_0x6367('0x18')](_0x401f74[_0x6367('0x5d')],{'firstName':_0x1354f5,'mobile':_0x1354f5,'phone':_0x1354f5,'ListId':_0x56b40a[_0x6367('0x8b')]}));}})[_0x6367('0x1f')](handleEntityNotFound(_0x49f6cd,null))[_0x6367('0x1f')](function(_0x152071){if(_0x152071){_0x357b58=_0x152071;return db['WhatsappInteraction'][_0x6367('0x63')]({'where':{'ContactId':_0x357b58['id'],'closed':![],'WhatsappAccountId':_0x56b40a['id']}})['then'](function(_0x37dc1a){if(_0x37dc1a){return[_0x37dc1a,![]];}return db[_0x6367('0x9e')][_0x6367('0x5c')]({'UserId':_0x401f74['user']['id'],'ContactId':_0x357b58['id'],'WhatsappAccountId':_0x56b40a['id'],'phone':_0x1354f5,'firstMsgDirection':_0x6367('0xb9'),'Messages':[_[_0x6367('0x52')](_0x401f74[_0x6367('0x5d')],{'read':![],'body':_0x401f74[_0x6367('0x5d')]['body'],'phone':_0x1354f5,'WhatsappAccountId':_0x56b40a['id'],'UserId':_0x401f74[_0x6367('0x5e')]['id'],'ContactId':_0x357b58['id']})]},{'include':[{'model':db[_0x6367('0xa5')],'as':_0x6367('0xba')}]})[_0x6367('0x1f')](function(_0x1a4e4b){return[_0x1a4e4b,!![]];});});}})[_0x6367('0xbb')](function(_0x4d674b,_0x2c108d){if(_0x2c108d){return _0x4d674b;}return db[_0x6367('0xa5')]['create'](_[_0x6367('0x52')](_0x401f74['body'],{'read':![],'body':_0x401f74[_0x6367('0x5d')][_0x6367('0x5d')],'phone':_0x1354f5,'WhatsappAccountId':_0x56b40a['id'],'WhatsappInteractionId':_0x4d674b['id'],'UserId':_0x401f74['user']['id'],'ContactId':_0x357b58['id']}))[_0x6367('0x1f')](function(_0x222c60){_0x4d674b[_0x6367('0xbc')][_0x6367('0xba')]=[];_0x4d674b[_0x6367('0xbc')][_0x6367('0xba')][_0x6367('0xa1')](_0x222c60[_0x6367('0xbc')]);return _0x4d674b;});})[_0x6367('0x1f')](respondWithResult(_0x49f6cd,null))[_0x6367('0x28')](handleError(_0x49f6cd,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index d836f6f..c4d9705 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 _0x7046=['events','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0xe4a604,_0x225d31){var _0x240f2f=function(_0x34d36e){while(--_0x34d36e){_0xe4a604['push'](_0xe4a604['shift']());}};_0x240f2f(++_0x225d31);}(_0x7046,0x144));var _0x6704=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7046[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x6704('0x0'));var WhatsappAccount=require(_0x6704('0x1'))['db'][_0x6704('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x6704('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6704('0x4'),'afterDestroy':_0x6704('0x5')};function emitEvent(_0x2899c5){return function(_0x5258e7,_0x1e9b2a,_0x35bcc6){WhatsappAccountEvents[_0x6704('0x6')](_0x2899c5+':'+_0x5258e7['id'],_0x5258e7);WhatsappAccountEvents[_0x6704('0x6')](_0x2899c5,_0x5258e7);_0x35bcc6(null);};}for(var e in events){if(events[_0x6704('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x6704('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xfb11=['hasOwnProperty','exports','events','WhatsappAccount','setMaxListeners','update','emit'];(function(_0x8cb7fb,_0x5c0631){var _0x43e2cf=function(_0x42efad){while(--_0x42efad){_0x8cb7fb['push'](_0x8cb7fb['shift']());}};_0x43e2cf(++_0x5c0631);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xfb11[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require(_0x1fb1('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x1fb1('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1fb1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1fb1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x18108f){return function(_0x5a830e,_0x190f74,_0x2ae20f){WhatsappAccountEvents['emit'](_0x18108f+':'+_0x5a830e['id'],_0x5a830e);WhatsappAccountEvents[_0x1fb1('0x4')](_0x18108f,_0x5a830e);_0x2ae20f(null);};}for(var e in events){if(events[_0x1fb1('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x1fb1('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index b59c10b..6c8248d 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 _0x3439=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3439,0xd8));var _0x9343=function(_0x1f39da,_0x3be429){_0x1f39da=_0x1f39da-0x0;var _0x321255=_0x3439[_0x1f39da];return _0x321255;};'use strict';var _=require(_0x9343('0x0'));var util=require(_0x9343('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9343('0x2'));var BPromise=require(_0x9343('0x3'));var rp=require(_0x9343('0x4'));var fs=require('fs');var path=require(_0x9343('0x5'));var rimraf=require(_0x9343('0x6'));var config=require(_0x9343('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0x9343('0x8')]=function(_0x137d4b,_0x1f34f0){return _0x137d4b[_0x9343('0x9')](_0x9343('0xa'),attributes,{'tableName':_0x9343('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f8f=['api','moment','bluebird','request-promise','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x3f8f,0x111));var _0xf3f8=function(_0x48837c,_0x31b10c){_0x48837c=_0x48837c-0x0;var _0x1b6bab=_0x3f8f[_0x48837c];return _0x1b6bab;};'use strict';var _=require(_0xf3f8('0x0'));var util=require(_0xf3f8('0x1'));var logger=require(_0xf3f8('0x2'))(_0xf3f8('0x3'));var moment=require(_0xf3f8('0x4'));var BPromise=require(_0xf3f8('0x5'));var rp=require(_0xf3f8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf3f8('0x7'));var attributes=require(_0xf3f8('0x8'));module[_0xf3f8('0x9')]=function(_0x297eb0,_0xa475e7){return _0x297eb0['define'](_0xf3f8('0xa'),attributes,{'tableName':_0xf3f8('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 ab6de42..39506ae 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 _0x1305=['info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','find','options','raw','where','attributes','include','model','map','ShowWhatsappAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1305,0x172));var _0x5130=function(_0x4d5409,_0x47fde8){_0x4d5409=_0x4d5409-0x0;var _0x14e175=_0x1305[_0x4d5409];return _0x14e175;};'use strict';var _=require(_0x5130('0x0'));var util=require(_0x5130('0x1'));var moment=require(_0x5130('0x2'));var BPromise=require(_0x5130('0x3'));var rs=require(_0x5130('0x4'));var fs=require('fs');var Redis=require(_0x5130('0x5'));var db=require(_0x5130('0x6'))['db'];var utils=require(_0x5130('0x7'));var logger=require(_0x5130('0x8'))('rpc');var config=require(_0x5130('0x9'));var jayson=require(_0x5130('0xa'));var client=jayson[_0x5130('0xb')]['http']({'port':0x232a});config[_0x5130('0xc')]=_[_0x5130('0xd')](config['redis'],{'host':_0x5130('0xe'),'port':0x18eb});var socket=require(_0x5130('0xf'))(new Redis(config[_0x5130('0xc')]));require(_0x5130('0x10'))[_0x5130('0x11')](socket);function respondWithRpcPromise(_0x4c402c,_0x165e2c,_0x462f3){return new BPromise(function(_0xba8a9e,_0x3950cf){return client[_0x5130('0x12')](_0x4c402c,_0x462f3)[_0x5130('0x13')](function(_0x28dde7){logger[_0x5130('0x14')](_0x5130('0x15'),_0x165e2c,'request\x20sent');logger[_0x5130('0x16')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x165e2c,_0x5130('0x17'),JSON[_0x5130('0x18')](_0x28dde7));if(_0x28dde7[_0x5130('0x19')]){if(_0x28dde7[_0x5130('0x19')][_0x5130('0x1a')]===0x1f4){logger[_0x5130('0x19')](_0x5130('0x15'),_0x165e2c,_0x28dde7[_0x5130('0x19')][_0x5130('0x1b')]);return _0x3950cf(_0x28dde7[_0x5130('0x19')]['message']);}logger[_0x5130('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x165e2c,_0x28dde7['error'][_0x5130('0x1b')]);return _0xba8a9e(_0x28dde7[_0x5130('0x19')][_0x5130('0x1b')]);}else{logger[_0x5130('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x165e2c,_0x5130('0x17'));_0xba8a9e(_0x28dde7[_0x5130('0x1c')][_0x5130('0x1b')]);}})['catch'](function(_0x227ede){logger[_0x5130('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x165e2c,_0x227ede);_0x3950cf(_0x227ede);});});}exports['ShowWhatsappAccount']=function(_0x1959be){var _0x48ae56=this;return new Promise(function(_0x41cb81,_0x3e8568){return db['WhatsappAccount'][_0x5130('0x1d')]({'raw':_0x1959be[_0x5130('0x1e')]?_0x1959be[_0x5130('0x1e')][_0x5130('0x1f')]===undefined?!![]:![]:!![],'where':_0x1959be[_0x5130('0x1e')]?_0x1959be[_0x5130('0x1e')][_0x5130('0x20')]||null:null,'attributes':_0x1959be['options']?_0x1959be['options'][_0x5130('0x21')]||null:null,'include':_0x1959be[_0x5130('0x1e')]?_0x1959be[_0x5130('0x1e')][_0x5130('0x22')]?_['map'](_0x1959be['options'][_0x5130('0x22')],function(_0x57c4a8){return{'model':db[_0x57c4a8[_0x5130('0x23')]],'as':_0x57c4a8['as'],'attributes':_0x57c4a8[_0x5130('0x21')],'include':_0x57c4a8[_0x5130('0x22')]?_[_0x5130('0x24')](_0x57c4a8['include'],function(_0x33c121){return{'model':db[_0x33c121[_0x5130('0x23')]],'as':_0x33c121['as'],'attributes':_0x33c121[_0x5130('0x21')],'include':_0x33c121['include']?_[_0x5130('0x24')](_0x33c121[_0x5130('0x22')],function(_0x39e539){return{'model':db[_0x39e539[_0x5130('0x23')]],'as':_0x39e539['as'],'attributes':_0x39e539[_0x5130('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e76a9){logger['info'](_0x5130('0x25'),_0x1959be);logger[_0x5130('0x16')](_0x5130('0x25'),_0x1959be,JSON[_0x5130('0x18')](_0x3e76a9));_0x41cb81(_0x3e76a9);})[_0x5130('0x26')](function(_0x410942){logger[_0x5130('0x19')](_0x5130('0x25'),_0x410942[_0x5130('0x1b')],_0x1959be);_0x3e8568(_0x48ae56[_0x5130('0x19')](0x1f4,_0x410942[_0x5130('0x1b')]));});});}; \ No newline at end of file +var _0xe0bf=['find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','defaults','redis','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','WhatsappAccount'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0xe0bf,0x75));var _0xfe0b=function(_0x50e525,_0x465676){_0x50e525=_0x50e525-0x0;var _0x1b09e3=_0xe0bf[_0x50e525];return _0x1b09e3;};'use strict';var _=require(_0xfe0b('0x0'));var util=require(_0xfe0b('0x1'));var moment=require(_0xfe0b('0x2'));var BPromise=require(_0xfe0b('0x3'));var rs=require(_0xfe0b('0x4'));var fs=require('fs');var Redis=require(_0xfe0b('0x5'));var db=require(_0xfe0b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xfe0b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfe0b('0x8')][_0xfe0b('0x9')]({'port':0x232a});config['redis']=_[_0xfe0b('0xa')](config[_0xfe0b('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe0b('0xb')]));require('./whatsappAccount.socket')[_0xfe0b('0xc')](socket);function respondWithRpcPromise(_0x295dd9,_0x102e4d,_0x18507c){return new BPromise(function(_0x184b4f,_0x278e90){return client[_0xfe0b('0xd')](_0x295dd9,_0x18507c)[_0xfe0b('0xe')](function(_0x40d9f9){logger['info'](_0xfe0b('0xf'),_0x102e4d,_0xfe0b('0x10'));logger[_0xfe0b('0x11')](_0xfe0b('0x12'),_0x102e4d,_0xfe0b('0x10'),JSON[_0xfe0b('0x13')](_0x40d9f9));if(_0x40d9f9[_0xfe0b('0x14')]){if(_0x40d9f9[_0xfe0b('0x14')][_0xfe0b('0x15')]===0x1f4){logger[_0xfe0b('0x14')](_0xfe0b('0xf'),_0x102e4d,_0x40d9f9[_0xfe0b('0x14')][_0xfe0b('0x16')]);return _0x278e90(_0x40d9f9[_0xfe0b('0x14')]['message']);}logger[_0xfe0b('0x14')](_0xfe0b('0xf'),_0x102e4d,_0x40d9f9['error'][_0xfe0b('0x16')]);return _0x184b4f(_0x40d9f9[_0xfe0b('0x14')][_0xfe0b('0x16')]);}else{logger[_0xfe0b('0x17')](_0xfe0b('0xf'),_0x102e4d,_0xfe0b('0x10'));_0x184b4f(_0x40d9f9[_0xfe0b('0x18')][_0xfe0b('0x16')]);}})[_0xfe0b('0x19')](function(_0x1dea71){logger['error'](_0xfe0b('0xf'),_0x102e4d,_0x1dea71);_0x278e90(_0x1dea71);});});}exports['ShowWhatsappAccount']=function(_0x4ec272){var _0x396487=this;return new Promise(function(_0x1b0e9a,_0x1ecdff){return db[_0xfe0b('0x1a')][_0xfe0b('0x1b')]({'raw':_0x4ec272[_0xfe0b('0x1c')]?_0x4ec272['options'][_0xfe0b('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ec272[_0xfe0b('0x1c')]?_0x4ec272['options'][_0xfe0b('0x1e')]||null:null,'attributes':_0x4ec272['options']?_0x4ec272['options'][_0xfe0b('0x1f')]||null:null,'include':_0x4ec272['options']?_0x4ec272[_0xfe0b('0x1c')][_0xfe0b('0x20')]?_[_0xfe0b('0x21')](_0x4ec272[_0xfe0b('0x1c')]['include'],function(_0x4261c4){return{'model':db[_0x4261c4[_0xfe0b('0x22')]],'as':_0x4261c4['as'],'attributes':_0x4261c4[_0xfe0b('0x1f')],'include':_0x4261c4[_0xfe0b('0x20')]?_[_0xfe0b('0x21')](_0x4261c4[_0xfe0b('0x20')],function(_0x2cf3d5){return{'model':db[_0x2cf3d5[_0xfe0b('0x22')]],'as':_0x2cf3d5['as'],'attributes':_0x2cf3d5['attributes'],'include':_0x2cf3d5[_0xfe0b('0x20')]?_[_0xfe0b('0x21')](_0x2cf3d5['include'],function(_0x449b44){return{'model':db[_0x449b44[_0xfe0b('0x22')]],'as':_0x449b44['as'],'attributes':_0x449b44[_0xfe0b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfe0b('0xe')](function(_0x596f41){logger[_0xfe0b('0x17')]('ShowWhatsappAccount',_0x4ec272);logger['debug'](_0xfe0b('0x23'),_0x4ec272,JSON[_0xfe0b('0x13')](_0x596f41));_0x1b0e9a(_0x596f41);})[_0xfe0b('0x19')](function(_0x9780b4){logger['error']('ShowWhatsappAccount',_0x9780b4[_0xfe0b('0x16')],_0x4ec272);_0x1ecdff(_0x396487['error'](0x1f4,_0x9780b4[_0xfe0b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b64aaa5..bec5493 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 _0xc837=['register','whatsappAccount:','./whatsappAccount.events','save','remove','emit'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xc837,0xa4));var _0x7c83=function(_0x104297,_0x45200f){_0x104297=_0x104297-0x0;var _0x194246=_0xc837[_0x104297];return _0x194246;};'use strict';var WhatsappAccountEvents=require(_0x7c83('0x0'));var events=[_0x7c83('0x1'),_0x7c83('0x2'),'update'];function createListener(_0x587af2,_0x337a62){return function(_0x1e17b7){_0x337a62[_0x7c83('0x3')](_0x587af2,_0x1e17b7);};}function removeListener(_0x32fc84,_0xc0a76a){return function(){WhatsappAccountEvents['removeListener'](_0x32fc84,_0xc0a76a);};}exports[_0x7c83('0x4')]=function(_0xda4488){for(var _0x1d3133=0x0,_0x5033d3=events['length'];_0x1d3133<_0x5033d3;_0x1d3133++){var _0x23f477=events[_0x1d3133];var _0x381a29=createListener(_0x7c83('0x5')+_0x23f477,_0xda4488);WhatsappAccountEvents['on'](_0x23f477,_0x381a29);}}; \ No newline at end of file +var _0xde7b=['update','removeListener','register','length','whatsappAccount:','save'];(function(_0x49a784,_0x2549f4){var _0x222475=function(_0x2b0be7){while(--_0x2b0be7){_0x49a784['push'](_0x49a784['shift']());}};_0x222475(++_0x2549f4);}(_0xde7b,0x137));var _0xbde7=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xde7b[_0x2aea9e];return _0x430b92;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xbde7('0x0'),'remove',_0xbde7('0x1')];function createListener(_0x683201,_0x5cd5f4){return function(_0x4cca3a){_0x5cd5f4['emit'](_0x683201,_0x4cca3a);};}function removeListener(_0x170a0f,_0x33f806){return function(){WhatsappAccountEvents[_0xbde7('0x2')](_0x170a0f,_0x33f806);};}exports[_0xbde7('0x3')]=function(_0xc6e7d){for(var _0x39996a=0x0,_0x57fc80=events[_0xbde7('0x4')];_0x39996a<_0x57fc80;_0x39996a++){var _0x2638fd=events[_0x39996a];var _0x3cc413=createListener(_0xbde7('0x5')+_0x2638fd,_0xc6e7d);WhatsappAccountEvents['on'](_0x2638fd,_0x3cc413);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index f5da596..4a93772 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 _0xbb35=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x310ad9,_0x3e1e8b){var _0x22fc69=function(_0x254949){while(--_0x254949){_0x310ad9['push'](_0x310ad9['shift']());}};_0x22fc69(++_0x3e1e8b);}(_0xbb35,0x11e));var _0x5bb3=function(_0x5cdade,_0x51e89c){_0x5cdade=_0x5cdade-0x0;var _0x41da1c=_0xbb35[_0x5cdade];return _0x41da1c;};'use strict';var multer=require(_0x5bb3('0x0'));var util=require(_0x5bb3('0x1'));var path=require(_0x5bb3('0x2'));var timeout=require(_0x5bb3('0x3'));var express=require(_0x5bb3('0x4'));var router=express['Router']();var fs_extra=require(_0x5bb3('0x5'));var auth=require(_0x5bb3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bb3('0x7'));var controller=require('./whatsappApplication.controller');router[_0x5bb3('0x8')]('/',auth[_0x5bb3('0x9')](),controller['index']);router[_0x5bb3('0x8')](_0x5bb3('0xa'),auth[_0x5bb3('0x9')](),controller['show']);router[_0x5bb3('0xb')]('/',auth[_0x5bb3('0x9')](),controller[_0x5bb3('0xc')]);router[_0x5bb3('0xd')](_0x5bb3('0xa'),auth[_0x5bb3('0x9')](),controller[_0x5bb3('0xe')]);router[_0x5bb3('0xf')](_0x5bb3('0xa'),auth[_0x5bb3('0x9')](),controller[_0x5bb3('0x10')]);module[_0x5bb3('0x11')]=router; \ No newline at end of file +var _0xb0fb=['../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','post','create','put','destroy','multer','path','connect-timeout','express','fs-extra'];(function(_0x5ef5c8,_0x572b9d){var _0x4df554=function(_0x12e0bb){while(--_0x12e0bb){_0x5ef5c8['push'](_0x5ef5c8['shift']());}};_0x4df554(++_0x572b9d);}(_0xb0fb,0x1ae));var _0xbb0f=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xb0fb[_0x5cb1af];return _0x8d7940;};'use strict';var multer=require(_0xbb0f('0x0'));var util=require('util');var path=require(_0xbb0f('0x1'));var timeout=require(_0xbb0f('0x2'));var express=require(_0xbb0f('0x3'));var router=express['Router']();var fs_extra=require(_0xbb0f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbb0f('0x5'));var controller=require(_0xbb0f('0x6'));router[_0xbb0f('0x7')]('/',auth['isAuthenticated'](),controller[_0xbb0f('0x8')]);router[_0xbb0f('0x7')](_0xbb0f('0x9'),auth[_0xbb0f('0xa')](),controller['show']);router[_0xbb0f('0xb')]('/',auth[_0xbb0f('0xa')](),controller[_0xbb0f('0xc')]);router[_0xbb0f('0xd')](_0xbb0f('0x9'),auth[_0xbb0f('0xa')](),controller['update']);router['delete']('/:id',auth[_0xbb0f('0xa')](),controller[_0xbb0f('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 4f08f7b..3bfe87d 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 _0x7887=['sequelize','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x1b0eb6,_0x2bc619){var _0x62a560=function(_0x1af811){while(--_0x1af811){_0x1b0eb6['push'](_0x1b0eb6['shift']());}};_0x62a560(++_0x2bc619);}(_0x7887,0x91));var _0x7788=function(_0xc58a29,_0x384afa){_0xc58a29=_0xc58a29-0x0;var _0x2f8cf3=_0x7887[_0xc58a29];return _0x2f8cf3;};'use strict';var Sequelize=require(_0x7788('0x0'));module['exports']={'priority':{'type':Sequelize[_0x7788('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7788('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7788('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7788('0x2')],'defaultValue':_0x7788('0x4')}}; \ No newline at end of file +var _0x6589=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x30cfdc,_0x5a0260){var _0x54e0ac=function(_0x5497d3){while(--_0x5497d3){_0x30cfdc['push'](_0x30cfdc['shift']());}};_0x54e0ac(++_0x5a0260);}(_0x6589,0xd7));var _0x9658=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x6589[_0x318840];return _0x223da4;};'use strict';var Sequelize=require(_0x9658('0x0'));module[_0x9658('0x1')]={'priority':{'type':Sequelize[_0x9658('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9658('0x3')],'allowNull':![],'defaultValue':_0x9658('0x4')},'appdata':{'type':Sequelize[_0x9658('0x5')]()},'description':{'type':Sequelize[_0x9658('0x3')]},'interval':{'type':Sequelize[_0x9658('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index fa39b22..3c8d9d7 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 _0x9e68=['request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','options','WhatsappApplication','includeAll','findAll','rows','catch','show','params','filters','include','find','create','body','zip-dir','fast-json-patch'];(function(_0x2cb373,_0x187773){var _0x4e8335=function(_0x226eea){while(--_0x226eea){_0x2cb373['push'](_0x2cb373['shift']());}};_0x4e8335(++_0x187773);}(_0x9e68,0x16b));var _0x89e6=function(_0x2e1c23,_0x8ae59e){_0x2e1c23=_0x2e1c23-0x0;var _0x30a785=_0x9e68[_0x2e1c23];return _0x30a785;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x89e6('0x0'));var jsonpatch=require(_0x89e6('0x1'));var rp=require(_0x89e6('0x2'));var moment=require(_0x89e6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x89e6('0x4'));var util=require('util');var path=require(_0x89e6('0x5'));var sox=require(_0x89e6('0x6'));var csv=require(_0x89e6('0x7'));var ejs=require(_0x89e6('0x8'));var fs=require('fs');var fs_extra=require(_0x89e6('0x9'));var _=require(_0x89e6('0xa'));var squel=require(_0x89e6('0xb'));var crypto=require('crypto');var jsforce=require(_0x89e6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x89e6('0x7'));var querystring=require(_0x89e6('0xd'));var Papa=require(_0x89e6('0xe'));var Redis=require(_0x89e6('0xf'));var authService=require(_0x89e6('0x10'));var qs=require(_0x89e6('0x11'));var as=require(_0x89e6('0x12'));var hardwareService=require(_0x89e6('0x13'));var logger=require('../../config/logger')(_0x89e6('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x89e6('0x15'));var db=require(_0x89e6('0x16'))['db'];function respondWithStatusCode(_0xc1ab28,_0x556b60){_0x556b60=_0x556b60||0xcc;return function(_0x29173b){if(_0x29173b){return _0xc1ab28[_0x89e6('0x17')](_0x556b60);}return _0xc1ab28[_0x89e6('0x18')](_0x556b60)[_0x89e6('0x19')]();};}function respondWithResult(_0x4e1fe7,_0xc14aea){_0xc14aea=_0xc14aea||0xc8;return function(_0x495a9c){if(_0x495a9c){return _0x4e1fe7[_0x89e6('0x18')](_0xc14aea)[_0x89e6('0x1a')](_0x495a9c);}};}function respondWithFilteredResult(_0x425c2d,_0x4438a0){return function(_0xe2b76e){if(_0xe2b76e){var _0x4f6880=_0xe2b76e[_0x89e6('0x1b')],_0x1d5848=_0x4438a0[_0x89e6('0x1c')],_0x32d8e2=_0x4438a0['offset']+_0x4438a0[_0x89e6('0x1d')],_0x11714b;if(_0x32d8e2>=_0x4f6880){_0x32d8e2=_0x4f6880;_0x11714b=0xc8;}else{_0x11714b=0xce;}_0x425c2d['status'](_0x11714b);return _0x425c2d[_0x89e6('0x1e')](_0x89e6('0x1f'),_0x1d5848+'-'+_0x32d8e2+'/'+_0x4f6880)['json'](_0xe2b76e);}return null;};}function patchUpdates(_0x246d20){return function(_0x4f4dca){try{jsonpatch[_0x89e6('0x20')](_0x4f4dca,_0x246d20,!![]);}catch(_0x3c5834){return BPromise[_0x89e6('0x21')](_0x3c5834);}return _0x4f4dca[_0x89e6('0x22')]();};}function saveUpdates(_0x3d6f27,_0x442a45){return function(_0x55d4ad){if(_0x55d4ad){return _0x55d4ad[_0x89e6('0x23')](_0x3d6f27)[_0x89e6('0x24')](function(_0x123c4d){return _0x123c4d;});}return null;};}function removeEntity(_0x2fe574,_0x4b275b){return function(_0x42df01){if(_0x42df01){return _0x42df01[_0x89e6('0x25')]()[_0x89e6('0x24')](function(){_0x2fe574[_0x89e6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1deb92,_0x13b7e8){return function(_0x38fc44){if(!_0x38fc44){_0x1deb92['sendStatus'](0x194);}return _0x38fc44;};}function handleError(_0x2b99d8,_0x13268f){_0x13268f=_0x13268f||0x1f4;return function(_0x587ed5){logger[_0x89e6('0x26')](_0x587ed5[_0x89e6('0x27')]);if(_0x587ed5[_0x89e6('0x28')]){delete _0x587ed5['name'];}_0x2b99d8[_0x89e6('0x18')](_0x13268f)['send'](_0x587ed5);};}exports[_0x89e6('0x29')]=function(_0x319320,_0x395c5b){var _0x3456d={},_0x5cac2c={},_0x20286c={'count':0x0,'rows':[]};var _0x44c423=_[_0x89e6('0x2a')](db['WhatsappApplication'][_0x89e6('0x2b')],function(_0x1ba943){return{'name':_0x1ba943[_0x89e6('0x2c')],'type':_0x1ba943[_0x89e6('0x2d')][_0x89e6('0x2e')]};});_0x5cac2c[_0x89e6('0x2f')]=_['map'](_0x44c423,_0x89e6('0x28'));_0x5cac2c[_0x89e6('0x30')]=_[_0x89e6('0x31')](_0x319320[_0x89e6('0x30')]);_0x5cac2c['filters']=_['intersection'](_0x5cac2c[_0x89e6('0x2f')],_0x5cac2c[_0x89e6('0x30')]);_0x3456d[_0x89e6('0x32')]=_[_0x89e6('0x33')](_0x5cac2c['model'],qs[_0x89e6('0x34')](_0x319320[_0x89e6('0x30')][_0x89e6('0x34')]));_0x3456d[_0x89e6('0x32')]=_0x3456d[_0x89e6('0x32')][_0x89e6('0x35')]?_0x3456d[_0x89e6('0x32')]:_0x5cac2c['model'];if(!_0x319320[_0x89e6('0x30')]['hasOwnProperty'](_0x89e6('0x36'))){_0x3456d[_0x89e6('0x1d')]=qs[_0x89e6('0x1d')](_0x319320[_0x89e6('0x30')]['limit']);_0x3456d['offset']=qs[_0x89e6('0x1c')](_0x319320[_0x89e6('0x30')]['offset']);}_0x3456d[_0x89e6('0x37')]=qs[_0x89e6('0x38')](_0x319320['query'][_0x89e6('0x38')]);_0x3456d[_0x89e6('0x39')]=qs['filters'](_['pick'](_0x319320['query'],_0x5cac2c['filters']),_0x44c423);if(_0x319320[_0x89e6('0x30')]['filter']){_0x3456d[_0x89e6('0x39')]=_[_0x89e6('0x3a')](_0x3456d[_0x89e6('0x39')],{'$or':_[_0x89e6('0x2a')](_0x44c423,function(_0x3aaa13){if(_0x3aaa13[_0x89e6('0x2d')]!==_0x89e6('0x3b')){var _0x1e2f8f={};_0x1e2f8f[_0x3aaa13['name']]={'$like':'%'+_0x319320[_0x89e6('0x30')]['filter']+'%'};return _0x1e2f8f;}})});}_0x3456d=_[_0x89e6('0x3a')]({},_0x3456d,_0x319320[_0x89e6('0x3c')]);var _0x468582={'where':_0x3456d[_0x89e6('0x39')]};return db[_0x89e6('0x3d')][_0x89e6('0x1b')](_0x468582)[_0x89e6('0x24')](function(_0x3b9250){_0x20286c[_0x89e6('0x1b')]=_0x3b9250;if(_0x319320[_0x89e6('0x30')][_0x89e6('0x3e')]){_0x3456d['include']=[{'all':!![]}];}return db[_0x89e6('0x3d')][_0x89e6('0x3f')](_0x3456d);})[_0x89e6('0x24')](function(_0x5a29be){_0x20286c[_0x89e6('0x40')]=_0x5a29be;return _0x20286c;})[_0x89e6('0x24')](respondWithFilteredResult(_0x395c5b,_0x3456d))[_0x89e6('0x41')](handleError(_0x395c5b,null));};exports[_0x89e6('0x42')]=function(_0x44b9ef,_0x7c7bbf){var _0x23e0ef={'raw':!![],'where':{'id':_0x44b9ef[_0x89e6('0x43')]['id']}},_0x42dd38={};_0x42dd38[_0x89e6('0x2f')]=_[_0x89e6('0x31')](db[_0x89e6('0x3d')][_0x89e6('0x2b')]);_0x42dd38[_0x89e6('0x30')]=_['keys'](_0x44b9ef[_0x89e6('0x30')]);_0x42dd38[_0x89e6('0x44')]=_[_0x89e6('0x33')](_0x42dd38[_0x89e6('0x2f')],_0x42dd38[_0x89e6('0x30')]);_0x23e0ef[_0x89e6('0x32')]=_[_0x89e6('0x33')](_0x42dd38[_0x89e6('0x2f')],qs[_0x89e6('0x34')](_0x44b9ef[_0x89e6('0x30')][_0x89e6('0x34')]));_0x23e0ef['attributes']=_0x23e0ef[_0x89e6('0x32')][_0x89e6('0x35')]?_0x23e0ef[_0x89e6('0x32')]:_0x42dd38['model'];if(_0x44b9ef[_0x89e6('0x30')][_0x89e6('0x3e')]){_0x23e0ef[_0x89e6('0x45')]=[{'all':!![]}];}_0x23e0ef=_[_0x89e6('0x3a')]({},_0x23e0ef,_0x44b9ef['options']);return db[_0x89e6('0x3d')][_0x89e6('0x46')](_0x23e0ef)[_0x89e6('0x24')](handleEntityNotFound(_0x7c7bbf,null))[_0x89e6('0x24')](respondWithResult(_0x7c7bbf,null))[_0x89e6('0x41')](handleError(_0x7c7bbf,null));};exports[_0x89e6('0x47')]=function(_0x15c228,_0x339479){return db[_0x89e6('0x3d')]['create'](_0x15c228[_0x89e6('0x48')],{})['then'](respondWithResult(_0x339479,0xc9))[_0x89e6('0x41')](handleError(_0x339479,null));};exports['update']=function(_0x32d634,_0x24f982){if(_0x32d634[_0x89e6('0x48')]['id']){delete _0x32d634['body']['id'];}return db[_0x89e6('0x3d')][_0x89e6('0x46')]({'where':{'id':_0x32d634[_0x89e6('0x43')]['id']}})[_0x89e6('0x24')](handleEntityNotFound(_0x24f982,null))[_0x89e6('0x24')](saveUpdates(_0x32d634[_0x89e6('0x48')],null))['then'](respondWithResult(_0x24f982,null))[_0x89e6('0x41')](handleError(_0x24f982,null));};exports[_0x89e6('0x25')]=function(_0x5c0f66,_0x30461e){return db[_0x89e6('0x3d')]['find']({'where':{'id':_0x5c0f66[_0x89e6('0x43')]['id']}})[_0x89e6('0x24')](handleEntityNotFound(_0x30461e,null))[_0x89e6('0x24')](removeEntity(_0x30461e,null))[_0x89e6('0x41')](handleError(_0x30461e,null));}; \ No newline at end of file +var _0x0d39=['jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','intersection','fields','length','attributes','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','squel'];(function(_0x8c1b23,_0x188476){var _0x14dd40=function(_0xe04b33){while(--_0xe04b33){_0x8c1b23['push'](_0x8c1b23['shift']());}};_0x14dd40(++_0x188476);}(_0x0d39,0x85));var _0x90d3=function(_0xb18373,_0x5e9cf8){_0xb18373=_0xb18373-0x0;var _0x5af1e2=_0x0d39[_0xb18373];return _0x5af1e2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x90d3('0x0'));var rimraf=require(_0x90d3('0x1'));var zipdir=require(_0x90d3('0x2'));var jsonpatch=require(_0x90d3('0x3'));var rp=require('request-promise');var moment=require(_0x90d3('0x4'));var BPromise=require(_0x90d3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x90d3('0x6'));var csv=require(_0x90d3('0x7'));var ejs=require(_0x90d3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x90d3('0x9'));var squel=require(_0x90d3('0xa'));var crypto=require('crypto');var jsforce=require(_0x90d3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x90d3('0x7'));var querystring=require(_0x90d3('0xc'));var Papa=require('papaparse');var Redis=require(_0x90d3('0xd'));var authService=require(_0x90d3('0xe'));var qs=require(_0x90d3('0xf'));var as=require(_0x90d3('0x10'));var hardwareService=require(_0x90d3('0x11'));var logger=require('../../config/logger')(_0x90d3('0x12'));var utils=require(_0x90d3('0x13'));var config=require(_0x90d3('0x14'));var licenseUtil=require(_0x90d3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14a4a5,_0x5a482c){_0x5a482c=_0x5a482c||0xcc;return function(_0xd778b0){if(_0xd778b0){return _0x14a4a5[_0x90d3('0x16')](_0x5a482c);}return _0x14a4a5[_0x90d3('0x17')](_0x5a482c)[_0x90d3('0x18')]();};}function respondWithResult(_0x287ea8,_0x3316a7){_0x3316a7=_0x3316a7||0xc8;return function(_0x10b080){if(_0x10b080){return _0x287ea8[_0x90d3('0x17')](_0x3316a7)[_0x90d3('0x19')](_0x10b080);}};}function respondWithFilteredResult(_0x58a440,_0x5ccbdd){return function(_0xdd0ac7){if(_0xdd0ac7){var _0x5040ec=_0xdd0ac7['count'],_0x77e644=_0x5ccbdd[_0x90d3('0x1a')],_0x608955=_0x5ccbdd[_0x90d3('0x1a')]+_0x5ccbdd['limit'],_0x41dea4;if(_0x608955>=_0x5040ec){_0x608955=_0x5040ec;_0x41dea4=0xc8;}else{_0x41dea4=0xce;}_0x58a440[_0x90d3('0x17')](_0x41dea4);return _0x58a440[_0x90d3('0x1b')]('Content-Range',_0x77e644+'-'+_0x608955+'/'+_0x5040ec)['json'](_0xdd0ac7);}return null;};}function patchUpdates(_0x7d7d0f){return function(_0x23f6a3){try{jsonpatch[_0x90d3('0x1c')](_0x23f6a3,_0x7d7d0f,!![]);}catch(_0x5295e5){return BPromise[_0x90d3('0x1d')](_0x5295e5);}return _0x23f6a3[_0x90d3('0x1e')]();};}function saveUpdates(_0x534a01,_0x2e3b40){return function(_0xa76516){if(_0xa76516){return _0xa76516[_0x90d3('0x1f')](_0x534a01)[_0x90d3('0x20')](function(_0x5ca7e8){return _0x5ca7e8;});}return null;};}function removeEntity(_0x2dbe13,_0x491e28){return function(_0x43c522){if(_0x43c522){return _0x43c522[_0x90d3('0x21')]()[_0x90d3('0x20')](function(){_0x2dbe13[_0x90d3('0x17')](0xcc)[_0x90d3('0x18')]();});}};}function handleEntityNotFound(_0x403e13,_0x39880d){return function(_0x373e8c){if(!_0x373e8c){_0x403e13[_0x90d3('0x16')](0x194);}return _0x373e8c;};}function handleError(_0x52e5e6,_0x334b1e){_0x334b1e=_0x334b1e||0x1f4;return function(_0x16ef62){logger[_0x90d3('0x22')](_0x16ef62[_0x90d3('0x23')]);if(_0x16ef62[_0x90d3('0x24')]){delete _0x16ef62[_0x90d3('0x24')];}_0x52e5e6[_0x90d3('0x17')](_0x334b1e)[_0x90d3('0x25')](_0x16ef62);};}exports[_0x90d3('0x26')]=function(_0x5a3fae,_0x5118ec){var _0x314856={},_0xd5ce5b={},_0x37225b={'count':0x0,'rows':[]};var _0x243200=_[_0x90d3('0x27')](db[_0x90d3('0x28')][_0x90d3('0x29')],function(_0xba4734){return{'name':_0xba4734[_0x90d3('0x2a')],'type':_0xba4734[_0x90d3('0x2b')]['key']};});_0xd5ce5b[_0x90d3('0x2c')]=_[_0x90d3('0x27')](_0x243200,_0x90d3('0x24'));_0xd5ce5b[_0x90d3('0x2d')]=_[_0x90d3('0x2e')](_0x5a3fae['query']);_0xd5ce5b['filters']=_[_0x90d3('0x2f')](_0xd5ce5b['model'],_0xd5ce5b[_0x90d3('0x2d')]);_0x314856['attributes']=_[_0x90d3('0x2f')](_0xd5ce5b['model'],qs['fields'](_0x5a3fae['query'][_0x90d3('0x30')]));_0x314856['attributes']=_0x314856['attributes'][_0x90d3('0x31')]?_0x314856[_0x90d3('0x32')]:_0xd5ce5b[_0x90d3('0x2c')];if(!_0x5a3fae[_0x90d3('0x2d')]['hasOwnProperty'](_0x90d3('0x33'))){_0x314856[_0x90d3('0x34')]=qs['limit'](_0x5a3fae[_0x90d3('0x2d')]['limit']);_0x314856['offset']=qs[_0x90d3('0x1a')](_0x5a3fae[_0x90d3('0x2d')][_0x90d3('0x1a')]);}_0x314856[_0x90d3('0x35')]=qs[_0x90d3('0x36')](_0x5a3fae[_0x90d3('0x2d')][_0x90d3('0x36')]);_0x314856[_0x90d3('0x37')]=qs[_0x90d3('0x38')](_[_0x90d3('0x39')](_0x5a3fae[_0x90d3('0x2d')],_0xd5ce5b['filters']),_0x243200);if(_0x5a3fae[_0x90d3('0x2d')]['filter']){_0x314856[_0x90d3('0x37')]=_[_0x90d3('0x3a')](_0x314856[_0x90d3('0x37')],{'$or':_[_0x90d3('0x27')](_0x243200,function(_0x117d50){if(_0x117d50[_0x90d3('0x2b')]!==_0x90d3('0x3b')){var _0x139048={};_0x139048[_0x117d50['name']]={'$like':'%'+_0x5a3fae[_0x90d3('0x2d')][_0x90d3('0x3c')]+'%'};return _0x139048;}})});}_0x314856=_[_0x90d3('0x3a')]({},_0x314856,_0x5a3fae[_0x90d3('0x3d')]);var _0x4ada90={'where':_0x314856['where']};return db['WhatsappApplication']['count'](_0x4ada90)['then'](function(_0x5b5740){_0x37225b[_0x90d3('0x3e')]=_0x5b5740;if(_0x5a3fae['query'][_0x90d3('0x3f')]){_0x314856[_0x90d3('0x40')]=[{'all':!![]}];}return db[_0x90d3('0x28')]['findAll'](_0x314856);})[_0x90d3('0x20')](function(_0x61c7e8){_0x37225b[_0x90d3('0x41')]=_0x61c7e8;return _0x37225b;})[_0x90d3('0x20')](respondWithFilteredResult(_0x5118ec,_0x314856))['catch'](handleError(_0x5118ec,null));};exports[_0x90d3('0x42')]=function(_0xc115b2,_0x53ea78){var _0x3b054a={'raw':!![],'where':{'id':_0xc115b2[_0x90d3('0x43')]['id']}},_0x48f1e5={};_0x48f1e5[_0x90d3('0x2c')]=_[_0x90d3('0x2e')](db['WhatsappApplication'][_0x90d3('0x29')]);_0x48f1e5[_0x90d3('0x2d')]=_[_0x90d3('0x2e')](_0xc115b2[_0x90d3('0x2d')]);_0x48f1e5[_0x90d3('0x38')]=_[_0x90d3('0x2f')](_0x48f1e5['model'],_0x48f1e5[_0x90d3('0x2d')]);_0x3b054a[_0x90d3('0x32')]=_[_0x90d3('0x2f')](_0x48f1e5[_0x90d3('0x2c')],qs[_0x90d3('0x30')](_0xc115b2[_0x90d3('0x2d')][_0x90d3('0x30')]));_0x3b054a[_0x90d3('0x32')]=_0x3b054a[_0x90d3('0x32')][_0x90d3('0x31')]?_0x3b054a['attributes']:_0x48f1e5['model'];if(_0xc115b2[_0x90d3('0x2d')][_0x90d3('0x3f')]){_0x3b054a[_0x90d3('0x40')]=[{'all':!![]}];}_0x3b054a=_[_0x90d3('0x3a')]({},_0x3b054a,_0xc115b2[_0x90d3('0x3d')]);return db[_0x90d3('0x28')][_0x90d3('0x44')](_0x3b054a)['then'](handleEntityNotFound(_0x53ea78,null))['then'](respondWithResult(_0x53ea78,null))[_0x90d3('0x45')](handleError(_0x53ea78,null));};exports[_0x90d3('0x46')]=function(_0x37c6b2,_0xc51a93){return db['WhatsappApplication'][_0x90d3('0x46')](_0x37c6b2[_0x90d3('0x47')],{})['then'](respondWithResult(_0xc51a93,0xc9))[_0x90d3('0x45')](handleError(_0xc51a93,null));};exports[_0x90d3('0x1f')]=function(_0x51966e,_0x531feb){if(_0x51966e['body']['id']){delete _0x51966e['body']['id'];}return db[_0x90d3('0x28')][_0x90d3('0x44')]({'where':{'id':_0x51966e[_0x90d3('0x43')]['id']}})['then'](handleEntityNotFound(_0x531feb,null))[_0x90d3('0x20')](saveUpdates(_0x51966e[_0x90d3('0x47')],null))[_0x90d3('0x20')](respondWithResult(_0x531feb,null))[_0x90d3('0x45')](handleError(_0x531feb,null));};exports[_0x90d3('0x21')]=function(_0x1990f9,_0x168a7a){return db[_0x90d3('0x28')][_0x90d3('0x44')]({'where':{'id':_0x1990f9[_0x90d3('0x43')]['id']}})[_0x90d3('0x20')](handleEntityNotFound(_0x168a7a,null))[_0x90d3('0x20')](removeEntity(_0x168a7a,null))['catch'](handleError(_0x168a7a,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index f8a6085..94e4117 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 _0x2bd1=['request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0x2bd1,0x136));var _0x12bd=function(_0x4bb396,_0x4113c9){_0x4bb396=_0x4bb396-0x0;var _0x4003af=_0x2bd1[_0x4bb396];return _0x4003af;};'use strict';var _=require(_0x12bd('0x0'));var util=require('util');var logger=require(_0x12bd('0x1'))(_0x12bd('0x2'));var moment=require(_0x12bd('0x3'));var BPromise=require(_0x12bd('0x4'));var rp=require(_0x12bd('0x5'));var fs=require('fs');var path=require(_0x12bd('0x6'));var rimraf=require(_0x12bd('0x7'));var config=require(_0x12bd('0x8'));var attributes=require(_0x12bd('0x9'));module[_0x12bd('0xa')]=function(_0x29072d,_0x695b9){return _0x29072d[_0x12bd('0xb')](_0x12bd('0xc'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x12bd('0xd'),'collate':_0x12bd('0xe')});}; \ No newline at end of file +var _0x2bdd=['api','moment','bluebird','../../config/environment','./whatsappApplication.attributes','exports','utf8mb4_unicode_ci','../../config/logger'];(function(_0x18a5c7,_0xc947fd){var _0x520dc0=function(_0x2992a1){while(--_0x2992a1){_0x18a5c7['push'](_0x18a5c7['shift']());}};_0x520dc0(++_0xc947fd);}(_0x2bdd,0x6f));var _0xd2bd=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x2bdd[_0x235482];return _0x5f5bea;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd2bd('0x0'))(_0xd2bd('0x1'));var moment=require(_0xd2bd('0x2'));var BPromise=require(_0xd2bd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd2bd('0x4'));var attributes=require(_0xd2bd('0x5'));module[_0xd2bd('0x6')]=function(_0x367030,_0xb0ca56){return _0x367030['define']('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd2bd('0x7')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index ac1f261..834a92c 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 _0x7c49=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x420123,_0x11f9c3){var _0x1948e4=function(_0x2c5d01){while(--_0x2c5d01){_0x420123['push'](_0x420123['shift']());}};_0x1948e4(++_0x11f9c3);}(_0x7c49,0x141));var _0x97c4=function(_0x1e832e,_0x513d0a){_0x1e832e=_0x1e832e-0x0;var _0x2da441=_0x7c49[_0x1e832e];return _0x2da441;};'use strict';var _=require(_0x97c4('0x0'));var util=require(_0x97c4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x97c4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97c4('0x3'))['db'];var utils=require(_0x97c4('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x97c4('0x5'));var jayson=require(_0x97c4('0x6'));var client=jayson[_0x97c4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x249c86,_0x165334,_0x585222){return new BPromise(function(_0x373855,_0x339817){return client[_0x97c4('0x8')](_0x249c86,_0x585222)[_0x97c4('0x9')](function(_0x12e98d){logger[_0x97c4('0xa')](_0x97c4('0xb'),_0x165334,_0x97c4('0xc'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x165334,_0x97c4('0xc'),JSON[_0x97c4('0xd')](_0x12e98d));if(_0x12e98d['error']){if(_0x12e98d[_0x97c4('0xe')][_0x97c4('0xf')]===0x1f4){logger[_0x97c4('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x165334,_0x12e98d['error'][_0x97c4('0x10')]);return _0x339817(_0x12e98d[_0x97c4('0xe')]['message']);}logger[_0x97c4('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x165334,_0x12e98d[_0x97c4('0xe')][_0x97c4('0x10')]);return _0x373855(_0x12e98d[_0x97c4('0xe')][_0x97c4('0x10')]);}else{logger[_0x97c4('0xa')](_0x97c4('0xb'),_0x165334,'request\x20sent');_0x373855(_0x12e98d[_0x97c4('0x11')]['message']);}})[_0x97c4('0x12')](function(_0x465c79){logger[_0x97c4('0xe')](_0x97c4('0xb'),_0x165334,_0x465c79);_0x339817(_0x465c79);});});} \ No newline at end of file +var _0xd1f9=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0xd1f9,0x88));var _0x9d1f=function(_0x380b8f,_0x32271d){_0x380b8f=_0x380b8f-0x0;var _0x646c69=_0xd1f9[_0x380b8f];return _0x646c69;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9d1f('0x0'));var BPromise=require(_0x9d1f('0x1'));var rs=require(_0x9d1f('0x2'));var fs=require('fs');var Redis=require(_0x9d1f('0x3'));var db=require(_0x9d1f('0x4'))['db'];var utils=require(_0x9d1f('0x5'));var logger=require(_0x9d1f('0x6'))(_0x9d1f('0x7'));var config=require(_0x9d1f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d1f('0x9')][_0x9d1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c146b,_0x432319,_0x10ce17){return new BPromise(function(_0x270b08,_0xb6b61c){return client[_0x9d1f('0xb')](_0x2c146b,_0x10ce17)[_0x9d1f('0xc')](function(_0x259a49){logger[_0x9d1f('0xd')](_0x9d1f('0xe'),_0x432319,_0x9d1f('0xf'));logger[_0x9d1f('0x10')](_0x9d1f('0x11'),_0x432319,_0x9d1f('0xf'),JSON[_0x9d1f('0x12')](_0x259a49));if(_0x259a49[_0x9d1f('0x13')]){if(_0x259a49[_0x9d1f('0x13')]['code']===0x1f4){logger[_0x9d1f('0x13')](_0x9d1f('0xe'),_0x432319,_0x259a49[_0x9d1f('0x13')]['message']);return _0xb6b61c(_0x259a49[_0x9d1f('0x13')]['message']);}logger['error'](_0x9d1f('0xe'),_0x432319,_0x259a49[_0x9d1f('0x13')][_0x9d1f('0x14')]);return _0x270b08(_0x259a49[_0x9d1f('0x13')][_0x9d1f('0x14')]);}else{logger[_0x9d1f('0xd')](_0x9d1f('0xe'),_0x432319,_0x9d1f('0xf'));_0x270b08(_0x259a49[_0x9d1f('0x15')][_0x9d1f('0x14')]);}})[_0x9d1f('0x16')](function(_0x1dd0bd){logger[_0x9d1f('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x432319,_0x1dd0bd);_0xb6b61c(_0x1dd0bd);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 1633739..f4e6b11 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 _0x6b2c=['../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','addTags','put','tracked','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6b2c,0x17e));var _0xc6b2=function(_0x2b7f96,_0x4dba87){_0x2b7f96=_0x2b7f96-0x0;var _0x58fbde=_0x6b2c[_0x2b7f96];return _0x58fbde;};'use strict';var multer=require(_0xc6b2('0x0'));var util=require(_0xc6b2('0x1'));var path=require(_0xc6b2('0x2'));var timeout=require('connect-timeout');var express=require(_0xc6b2('0x3'));var router=express[_0xc6b2('0x4')]();var fs_extra=require(_0xc6b2('0x5'));var auth=require(_0xc6b2('0x6'));var interaction=require(_0xc6b2('0x7'));var config=require(_0xc6b2('0x8'));var controller=require(_0xc6b2('0x9'));router[_0xc6b2('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc6b2('0xa')](_0xc6b2('0xb'),auth[_0xc6b2('0xc')](),controller['describe']);router[_0xc6b2('0xa')](_0xc6b2('0xd'),auth[_0xc6b2('0xc')](),controller['show']);router[_0xc6b2('0xa')](_0xc6b2('0xe'),auth['isAuthenticated'](),controller[_0xc6b2('0xf')]);router[_0xc6b2('0xa')](_0xc6b2('0x10'),auth[_0xc6b2('0xc')](),controller[_0xc6b2('0x11')]);router[_0xc6b2('0x12')]('/',auth[_0xc6b2('0xc')](),controller['create']);router[_0xc6b2('0x12')](_0xc6b2('0xe'),auth[_0xc6b2('0xc')](),controller[_0xc6b2('0x13')]);router[_0xc6b2('0x12')](_0xc6b2('0x14'),auth[_0xc6b2('0xc')](),interaction['tracked']('whatsapp','whatsappinteraction:addtags'),controller[_0xc6b2('0x15')]);router[_0xc6b2('0x16')](_0xc6b2('0xd'),auth[_0xc6b2('0xc')](),interaction[_0xc6b2('0x17')]('whatsapp',_0xc6b2('0x18')),controller['update']);router['delete']('/:id',auth[_0xc6b2('0xc')](),interaction[_0xc6b2('0x17')]('whatsapp',_0xc6b2('0x19')),controller[_0xc6b2('0x1a')]);router[_0xc6b2('0x1b')]('/:id/tags',auth[_0xc6b2('0xc')](),controller[_0xc6b2('0x1c')]);module[_0xc6b2('0x1d')]=router; \ No newline at end of file +var _0xe70b=['/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','update','delete','whatsappinteraction:destroy','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download','download','post','create','addMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe70b,0xb8));var _0xbe70=function(_0xcb6f84,_0x2e0fc4){_0xcb6f84=_0xcb6f84-0x0;var _0x5dad15=_0xe70b[_0xcb6f84];return _0x5dad15;};'use strict';var multer=require('multer');var util=require(_0xbe70('0x0'));var path=require(_0xbe70('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbe70('0x2')]();var fs_extra=require(_0xbe70('0x3'));var auth=require(_0xbe70('0x4'));var interaction=require(_0xbe70('0x5'));var config=require('../../config/environment');var controller=require(_0xbe70('0x6'));router[_0xbe70('0x7')]('/',auth[_0xbe70('0x8')](),controller[_0xbe70('0x9')]);router[_0xbe70('0x7')](_0xbe70('0xa'),auth[_0xbe70('0x8')](),controller[_0xbe70('0xb')]);router['get'](_0xbe70('0xc'),auth[_0xbe70('0x8')](),controller['show']);router[_0xbe70('0x7')](_0xbe70('0xd'),auth[_0xbe70('0x8')](),controller['getMessages']);router['get'](_0xbe70('0xe'),auth[_0xbe70('0x8')](),controller[_0xbe70('0xf')]);router[_0xbe70('0x10')]('/',auth[_0xbe70('0x8')](),controller[_0xbe70('0x11')]);router['post'](_0xbe70('0xd'),auth[_0xbe70('0x8')](),controller[_0xbe70('0x12')]);router[_0xbe70('0x10')](_0xbe70('0x13'),auth[_0xbe70('0x8')](),interaction[_0xbe70('0x14')](_0xbe70('0x15'),_0xbe70('0x16')),controller[_0xbe70('0x17')]);router['put'](_0xbe70('0xc'),auth[_0xbe70('0x8')](),interaction['tracked'](_0xbe70('0x15'),'whatsappinteraction:update'),controller[_0xbe70('0x18')]);router[_0xbe70('0x19')](_0xbe70('0xc'),auth[_0xbe70('0x8')](),interaction[_0xbe70('0x14')]('whatsapp',_0xbe70('0x1a')),controller[_0xbe70('0x1b')]);router['delete'](_0xbe70('0x13'),auth[_0xbe70('0x8')](),controller['removeTags']);module[_0xbe70('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index b3a9215..94e83ba 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 _0x74ca=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x3e6854,_0x5b37dc){var _0x238a93=function(_0x16193d){while(--_0x16193d){_0x3e6854['push'](_0x3e6854['shift']());}};_0x238a93(++_0x5b37dc);}(_0x74ca,0xfa));var _0xa74c=function(_0xab7458,_0x3f7578){_0xab7458=_0xab7458-0x0;var _0x3be2c=_0x74ca[_0xab7458];return _0x3be2c;};'use strict';var Sequelize=require(_0xa74c('0x0'));var moment=require(_0xa74c('0x1'));module[_0xa74c('0x2')]={'closed':{'type':Sequelize[_0xa74c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa74c('0x4')]},'disposition':{'type':Sequelize[_0xa74c('0x5')]},'secondDisposition':{'type':Sequelize[_0xa74c('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa74c('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa74c('0x5')]},'read1stAt':{'type':Sequelize[_0xa74c('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xa74c('0x6')]('in',_0xa74c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa74c('0x6')]('in',_0xa74c('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x93ed=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x93ed,0xfe));var _0xd93e=function(_0x5e9823,_0x1ec34c){_0x5e9823=_0x5e9823-0x0;var _0x106fdc=_0x93ed[_0x5e9823];return _0x106fdc;};'use strict';var Sequelize=require(_0xd93e('0x0'));var moment=require(_0xd93e('0x1'));module[_0xd93e('0x2')]={'closed':{'type':Sequelize[_0xd93e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd93e('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd93e('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd93e('0x5')]},'phone':{'type':Sequelize[_0xd93e('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xd93e('0x6')]('in',_0xd93e('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd93e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd93e('0x6')]('in',_0xd93e('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index b6b65e6..eff32ba 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 _0xee11=['toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','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','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','all','rows','show','params','includeAll','create','describe','addMessage','omit','ids','getMessages','findOne','nolimit','options','WhatsappMessage','include','addTags','setTags','spread','Tag','findAll','removeTags','root','tmp','join','server','files','attachments','format','CmContact','Contact','firstName','lastName','Attachment','Messages','secret','Account','10px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','basename','existsSync','createReadStream','pipe','direction','out','views','toFile','transcript-','.pdf','download','err','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fullname','TagIds','Tags','push','catch','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20>\x200','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','start','body','text','some','compact','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','role','agent','sequelize'];(function(_0x4bae70,_0x46d7ea){var _0x32deb6=function(_0x13c410){while(--_0x13c410){_0x4bae70['push'](_0x4bae70['shift']());}};_0x32deb6(++_0x46d7ea);}(_0xee11,0x146));var _0x1ee1=function(_0x1163c3,_0x3aedc6){_0x1163c3=_0x1163c3-0x0;var _0x7a7cb5=_0xee11[_0x1163c3];return _0x7a7cb5;};'use strict';var pdf=require(_0x1ee1('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1ee1('0x1'));var jsonpatch=require(_0x1ee1('0x2'));var rp=require(_0x1ee1('0x3'));var moment=require(_0x1ee1('0x4'));var BPromise=require(_0x1ee1('0x5'));var Mustache=require(_0x1ee1('0x6'));var util=require(_0x1ee1('0x7'));var path=require(_0x1ee1('0x8'));var sox=require('sox');var csv=require(_0x1ee1('0x9'));var ejs=require(_0x1ee1('0xa'));var fs=require('fs');var fs_extra=require(_0x1ee1('0xb'));var _=require(_0x1ee1('0xc'));var squel=require(_0x1ee1('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1ee1('0xe'));var toCsv=require(_0x1ee1('0x9'));var querystring=require(_0x1ee1('0xf'));var Papa=require(_0x1ee1('0x10'));var Redis=require('ioredis');var authService=require(_0x1ee1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1ee1('0x12'));var hardwareService=require(_0x1ee1('0x13'));var logger=require(_0x1ee1('0x14'))(_0x1ee1('0x15'));var utils=require('../../config/utils');var config=require(_0x1ee1('0x16'));var licenseUtil=require(_0x1ee1('0x17'));var db=require('../../mysqldb')['db'];config[_0x1ee1('0x18')]=_[_0x1ee1('0x19')](config[_0x1ee1('0x18')],{'host':_0x1ee1('0x1a'),'port':0x18eb});var socket=require(_0x1ee1('0x1b'))(new Redis(config[_0x1ee1('0x18')]));require(_0x1ee1('0x1c'))[_0x1ee1('0x1d')](socket);function respondWithStatusCode(_0x2f4c8d,_0x189191){_0x189191=_0x189191||0xcc;return function(_0x2bc943){if(_0x2bc943){return _0x2f4c8d[_0x1ee1('0x1e')](_0x189191);}return _0x2f4c8d[_0x1ee1('0x1f')](_0x189191)[_0x1ee1('0x20')]();};}function respondWithResult(_0x4828ba,_0x4f4d55){_0x4f4d55=_0x4f4d55||0xc8;return function(_0x7ff856){if(_0x7ff856){return _0x4828ba[_0x1ee1('0x1f')](_0x4f4d55)[_0x1ee1('0x21')](_0x7ff856);}};}function respondWithFilteredResult(_0x2752ba,_0x1e18b9){return function(_0xff3d76){if(_0xff3d76){var _0x55abff=_0xff3d76[_0x1ee1('0x22')],_0x39229e=_0x1e18b9[_0x1ee1('0x23')],_0x3c97aa=_0x1e18b9['offset']+_0x1e18b9['limit'],_0x5c380f;if(_0x3c97aa>=_0x55abff){_0x3c97aa=_0x55abff;_0x5c380f=0xc8;}else{_0x5c380f=0xce;}_0x2752ba[_0x1ee1('0x1f')](_0x5c380f);return _0x2752ba[_0x1ee1('0x24')](_0x1ee1('0x25'),_0x39229e+'-'+_0x3c97aa+'/'+_0x55abff)[_0x1ee1('0x21')](_0xff3d76);}return null;};}function patchUpdates(_0x47eb1a){return function(_0x1c3851){try{jsonpatch[_0x1ee1('0x26')](_0x1c3851,_0x47eb1a,!![]);}catch(_0x482d0){return BPromise['reject'](_0x482d0);}return _0x1c3851[_0x1ee1('0x27')]();};}function saveUpdates(_0x277cd8,_0x28c0e9){return function(_0x307672){if(_0x307672){return _0x307672[_0x1ee1('0x28')](_0x277cd8)[_0x1ee1('0x29')](function(_0x55921f){return _0x55921f;});}return null;};}function removeEntity(_0x1142fd,_0x5d1948){return function(_0x4932cd){if(_0x4932cd){return _0x4932cd[_0x1ee1('0x2a')]()[_0x1ee1('0x29')](function(){_0x1142fd['status'](0xcc)[_0x1ee1('0x20')]();});}};}function handleEntityNotFound(_0x1a90b3,_0x1036f5){return function(_0x31ede7){if(!_0x31ede7){_0x1a90b3[_0x1ee1('0x1e')](0x194);}return _0x31ede7;};}function handleError(_0x12c583,_0x56a1e3){_0x56a1e3=_0x56a1e3||0x1f4;return function(_0x14f388){logger[_0x1ee1('0x2b')](_0x14f388[_0x1ee1('0x2c')]);if(_0x14f388[_0x1ee1('0x2d')]){delete _0x14f388[_0x1ee1('0x2d')];}_0x12c583[_0x1ee1('0x1f')](_0x56a1e3)['send'](_0x14f388);};}function getInteractionUsers(_0x19e4cc,_0x576bf4){return new BPromise(function(_0x1fab9d,_0x153731){try{if(_0x576bf4[_0x19e4cc['id']]){_0x19e4cc['Users']=_['map'](_0x576bf4[_0x19e4cc['id']],function(_0x444ed9){return{'id':_0x444ed9['id'],'fullname':_0x444ed9[_0x1ee1('0x2e')]};});}}catch(_0xf63d67){_0x153731(_0xf63d67);}_0x1fab9d(_0x19e4cc);});}function getInteractionTags(_0x209592,_0x49241e){return new BPromise(function(_0x4b9ea4,_0x1b8205){try{if(_0x209592[_0x1ee1('0x2f')]){_0x209592[_0x1ee1('0x30')]=[];_0x209592[_0x1ee1('0x2f')]['split'](',')['forEach'](function(_0x100e42){_0x209592['Tags'][_0x1ee1('0x31')](_0x49241e[_0x100e42]);});}delete _0x209592[_0x1ee1('0x2f')];}catch(_0x5b6a17){_0x1b8205(_0x5b6a17);}_0x4b9ea4(_0x209592);});}function updateWhatsappInteraction(_0x2fe0a8,_0x556191,_0x4c99f9){return new BPromise(function(_0x4866a9,_0x285110){return getInteractionUsers(_0x2fe0a8,_0x4c99f9)['then'](function(_0x4699f8){return getInteractionTags(_0x4699f8,_0x556191);})[_0x1ee1('0x29')](function(_0x513124){_0x4866a9(_0x513124);})[_0x1ee1('0x32')](function(_0x3a2746){_0x285110(_0x3a2746);});});}exports[_0x1ee1('0x33')]=function(_0x50340c,_0x208845){var _0xc72d91={},_0x80fbc={},_0x3d9e0a={'count':0x0,'rows':[]};var _0x40964d=_[_0x1ee1('0x34')](db[_0x1ee1('0x35')][_0x1ee1('0x36')],function(_0x24ca9e){return{'name':_0x24ca9e[_0x1ee1('0x37')],'type':_0x24ca9e[_0x1ee1('0x38')][_0x1ee1('0x39')]};});_0x80fbc[_0x1ee1('0x3a')]=_[_0x1ee1('0x34')](_0x40964d,_0x1ee1('0x2d'));_0x80fbc[_0x1ee1('0x3b')]=_[_0x1ee1('0x3c')](_0x50340c[_0x1ee1('0x3b')]);_0x80fbc[_0x1ee1('0x3d')]=_[_0x1ee1('0x3e')](_0x80fbc[_0x1ee1('0x3a')],_0x80fbc[_0x1ee1('0x3b')]);_0xc72d91['attributes']=_[_0x1ee1('0x3e')](_0x80fbc[_0x1ee1('0x3a')],qs[_0x1ee1('0x3f')](_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x3f')]));_0xc72d91[_0x1ee1('0x40')]=_0xc72d91[_0x1ee1('0x40')][_0x1ee1('0x41')]?_0xc72d91[_0x1ee1('0x40')]:_0x80fbc[_0x1ee1('0x3a')];if(!_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x42')]('nolimit')){_0xc72d91[_0x1ee1('0x43')]=qs[_0x1ee1('0x43')](_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x43')]);_0xc72d91[_0x1ee1('0x23')]=qs[_0x1ee1('0x23')](_0x50340c[_0x1ee1('0x3b')]['offset']);}_0xc72d91[_0x1ee1('0x44')]=qs[_0x1ee1('0x45')](_0x50340c['query'][_0x1ee1('0x45')]);_0xc72d91['where']=qs['filters'](_[_0x1ee1('0x46')](_0x50340c[_0x1ee1('0x3b')],_0x80fbc['filters']),_0x40964d);var _0x1b5f05=[];var _0x395f8b=squel[_0x1ee1('0x47')]()[_0x1ee1('0x48')]('id')[_0x1ee1('0x48')]('name')['field'](_0x1ee1('0x49'))[_0x1ee1('0x4a')](_0x1ee1('0x4b'));var _0x51d960=squel[_0x1ee1('0x47')]()[_0x1ee1('0x48')](_0x1ee1('0x4c'))['field'](_0x1ee1('0x4d'))['field'](_0x1ee1('0x4e'))[_0x1ee1('0x4a')](_0x1ee1('0x4f'),'ui')[_0x1ee1('0x50')](_0x1ee1('0x51'),'u',_0x1ee1('0x52'));var _0x28a29c=squel[_0x1ee1('0x47')]()[_0x1ee1('0x4a')](_0x1ee1('0x53'),'i')['left_join'](_0x1ee1('0x54'),'c',_0x1ee1('0x55'))[_0x1ee1('0x50')]('users','o',_0x1ee1('0x56'))[_0x1ee1('0x50')](_0x1ee1('0x57'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x1ee1('0x50')](_0x1ee1('0x58'),'me',_0x1ee1('0x59'))[_0x1ee1('0x50')]('whatsapp_interaction_has_tags','it',_0x1ee1('0x5a'))[_0x1ee1('0x50')](_0x1ee1('0x4b'),'t',_0x1ee1('0x5b'));var _0x58f7c6=squel['expr']();var _0x5ffe26=[];var _0x13462f=squel[_0x1ee1('0x5c')]();var _0x2798fb;if(_0x50340c['query'][_0x1ee1('0x5d')]){_0x2798fb=as[_0x1ee1('0x5e')](_0x50340c['query'][_0x1ee1('0x5d')]);var _0x345991=_0x2798fb[_0x1ee1('0x5f')];for(var _0x2f9049=0x0;_0x2f9049<_0x2798fb[_0x1ee1('0x60')][_0x1ee1('0x41')];_0x2f9049++){var _0x53287c=_0x2798fb[_0x1ee1('0x60')][_0x2f9049];var _0xb894af='i';var _0x40b8ff=_[_0x1ee1('0x61')](_0x40964d,[_0x1ee1('0x2d'),_0x53287c[_0x1ee1('0x48')]]);if(!_0x40b8ff){switch(_0x53287c['field']){case'unreadMessages':if(_0x53287c[_0x1ee1('0x62')]==0x1){_0x28a29c[_0x1ee1('0x63')]('`'+_0x53287c['field']+'`\x20=\x200');}else{_0x28a29c[_0x1ee1('0x63')]('`'+_0x53287c[_0x1ee1('0x48')]+_0x1ee1('0x64'));}break;case'Contact':if(_0x53287c[_0x1ee1('0x65')]===_0x1ee1('0x66')){if(_0x53287c[_0x1ee1('0x62')][_0x1ee1('0x67')]('\x20')[_0x1ee1('0x41')]>0x1){_0x58f7c6[_0x345991](_0x1ee1('0x68'),qs[_0x1ee1('0x69')](_0x53287c[_0x1ee1('0x62')]),null);}else{var _0x51a643='%'+_0x53287c['value']+'%';_0x58f7c6[_0x345991](_0x1ee1('0x6a'),_0x51a643,_0x51a643,_0x51a643);}}else{_0x40b8ff=_['find'](_0x40964d,['name',_0x1ee1('0x6b')]);_0x53287c['field']='ContactId';_0x229639=as[_0x1ee1('0x6c')](_0xb894af,_0x40b8ff[_0x1ee1('0x38')],_0x53287c);_0x58f7c6[_0x345991](_0x229639['text'],_0x229639[_0x1ee1('0x62')]['start'],_0x229639[_0x1ee1('0x62')][_0x1ee1('0x20')]);}break;case'Tag':var _0x117f90=_0x53287c[_0x1ee1('0x62')][_0x1ee1('0x67')](',')[_0x1ee1('0x34')](function(_0xf6499d){return Number(_0xf6499d);});_0x117f90[_0x1ee1('0x6d')](function(_0x3e0d09){_0x13462f['or'](_0x1ee1('0x6e'),'%,'+_0x3e0d09+',%');});_0x5ffe26=_[_0x1ee1('0x6f')](_0x5ffe26,_0x117f90);break;case _0x1ee1('0x70'):if(_0x53287c[_0x1ee1('0x65')]===_0x1ee1('0x66')){_0x58f7c6[_0x345991]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x53287c[_0x1ee1('0x62')]+'%',null);}else{_0x40b8ff=_[_0x1ee1('0x61')](_0x40964d,['name','UserId']);_0x53287c[_0x1ee1('0x48')]=_0x1ee1('0x71');_0x229639=as['buildExpression'](_0xb894af,_0x40b8ff[_0x1ee1('0x38')],_0x53287c);_0x58f7c6[_0x345991](_0x229639['text'],_0x229639[_0x1ee1('0x62')][_0x1ee1('0x72')],_0x229639[_0x1ee1('0x62')][_0x1ee1('0x20')]);}break;case _0x1ee1('0x73'):_0x229639=as[_0x1ee1('0x6c')]('me',null,_0x53287c);_0x58f7c6[_0x345991](_0x229639['text'],_0x229639[_0x1ee1('0x62')]['start'],_0x229639[_0x1ee1('0x62')][_0x1ee1('0x20')]);break;}}else{var _0x229639=as[_0x1ee1('0x6c')](_0xb894af,_0x40b8ff[_0x1ee1('0x38')],_0x53287c);_0x58f7c6[_0x345991](_0x229639[_0x1ee1('0x74')],_0x229639[_0x1ee1('0x62')][_0x1ee1('0x72')],_0x229639[_0x1ee1('0x62')]['end']);}}}else{var _0x4095d5=_(_0x50340c[_0x1ee1('0x3b')])[_0x1ee1('0x3c')]()['map'](function(_0xa91b85){return _[_0x1ee1('0x75')](_0x40964d,[_0x1ee1('0x2d'),_0xa91b85])?_0xa91b85:undefined;})[_0x1ee1('0x76')]()[_0x1ee1('0x62')]();if(!_[_0x1ee1('0x77')](_0x4095d5)){_0x4095d5[_0x1ee1('0x6d')](function(_0x37a6bd){if(_0x37a6bd===_0x1ee1('0x78')){_0x28a29c[_0x1ee1('0x79')](_0x1ee1('0x7a'),[]['concat'](_0x50340c['query'][_0x37a6bd]));}else if(_0x37a6bd===_0x1ee1('0x7b')){var _0x4d63b4=JSON['parse'](_0x50340c[_0x1ee1('0x3b')][_0x37a6bd])[_0x1ee1('0x7c')];var _0x58eec7=JSON['parse'](_0x50340c[_0x1ee1('0x3b')][_0x37a6bd])[_0x1ee1('0x7d')];_0x28a29c[_0x1ee1('0x79')](_0x1ee1('0x7e'),_0x4d63b4,_0x58eec7);}else{if(_0x50340c[_0x1ee1('0x3b')][_0x37a6bd]===_0x1ee1('0x7f')){_0x28a29c['where']('i.'+_0x37a6bd+_0x1ee1('0x80'));}else{_0x28a29c[_0x1ee1('0x79')]('i.'+_0x37a6bd+_0x1ee1('0x81'),_0x50340c[_0x1ee1('0x3b')][_0x37a6bd]);}}});}if(_0x50340c[_0x1ee1('0x3b')]['read']){if(_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x82')]==0x1){_0x28a29c['having'](_0x1ee1('0x83'));}else{_0x28a29c['having'](_0x1ee1('0x84'));}}if(_0x50340c[_0x1ee1('0x3b')]['tag']){_0x5ffe26=_['isArray'](_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x85')])?_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x85')]:new Array(_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x85')]);_0x5ffe26[_0x1ee1('0x6d')](function(_0x5eb139){_0x13462f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5eb139+',%');});}if(_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x86')]){var _0x4c6ba0=_0x50340c[_0x1ee1('0x3b')]['filter'][_0x1ee1('0x87')]('\x5c','\x5c\x5c')[_0x1ee1('0x87')](/'/g,'\x27\x27');if(qs[_0x1ee1('0x88')](_0x4c6ba0)){_0x58f7c6['or'](_0x1ee1('0x89'),_0x4c6ba0+'%')['or'](_0x1ee1('0x8a'),_0x4c6ba0+'%');}else{_0x58f7c6['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1ee1('0x69')](_0x4c6ba0))['or'](_0x1ee1('0x8b'),_0x4c6ba0+'%');}}}_0x28a29c[_0x1ee1('0x79')](_0x58f7c6);_0x28a29c[_0x1ee1('0x8c')](_0x1ee1('0x8d'));var _0x45e580={'type':db['Sequelize'][_0x1ee1('0x8e')]['SELECT'],'raw':!![]};var _0x12394e=_0x28a29c[_0x1ee1('0x8f')]();_0x12394e['field']('i.id');_0x12394e[_0x1ee1('0x48')](_0x1ee1('0x90'),_0x1ee1('0x91'));if(_0xc72d91[_0x1ee1('0x44')]){_0xc72d91[_0x1ee1('0x44')][_0x1ee1('0x6d')](function(_0x435730){var _0x3d6edc=_0x435730[0x0]===_0x1ee1('0x92')?_0x435730[0x0]:'i.'+_0x435730[0x0];_0x28a29c[_0x1ee1('0x44')](_0x3d6edc,_0x435730[0x1]===_0x1ee1('0x93')?![]:!![]);});}if(!_[_0x1ee1('0x77')](_0x5ffe26)){_0x28a29c[_0x1ee1('0x63')](_0x13462f);_0x12394e[_0x1ee1('0x79')](_0x1ee1('0x94'),_0x5ffe26);}BPromise[_0x1ee1('0x95')]()[_0x1ee1('0x29')](function(){if(!_0x2798fb){if(_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x78')])return;_0x12394e['where'](_0x1ee1('0x96'));_0x28a29c[_0x1ee1('0x79')](_0x1ee1('0x96'));return;}if(_0x50340c[_0x1ee1('0x97')]['role']!=='agent')return;return _0x50340c[_0x1ee1('0x97')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x1ee1('0x29')](function(_0x3e78d6){if(_[_0x1ee1('0x77')](_0x3e78d6)){_0x12394e[_0x1ee1('0x79')](_0x1ee1('0x98'));_0x28a29c[_0x1ee1('0x79')](_0x1ee1('0x98'));}else{_0x12394e['where'](_0x1ee1('0x7a'),_[_0x1ee1('0x34')](_0x3e78d6,'id'));_0x28a29c[_0x1ee1('0x79')](_0x1ee1('0x7a'),_['map'](_0x3e78d6,'id'));}});})['then'](function(){if(_0x50340c[_0x1ee1('0x97')][_0x1ee1('0x99')]===_0x1ee1('0x9a')&&!_0x2798fb&&!_0x50340c['query']['WhatsappAccountId'])return[];return db[_0x1ee1('0x9b')][_0x1ee1('0x3b')](_0x12394e[_0x1ee1('0x9c')](),_0x45e580);})['then'](function(_0x2ec43e){_0x3d9e0a['count']=_0x2ec43e[_0x1ee1('0x41')];if(_0x3d9e0a['count']===0x0)return[];return db[_0x1ee1('0x9b')][_0x1ee1('0x3b')](_0x395f8b[_0x1ee1('0x9c')](),_0x45e580)[_0x1ee1('0x29')](function(_0x151096){_0x1b5f05=_[_0x1ee1('0x9d')](_0x151096,'id');_0x45e580=_[_0x1ee1('0x9e')](_0x45e580,{'model':db[_0x1ee1('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x50340c['query'][_0x1ee1('0x3f')]){_0xc72d91[_0x1ee1('0x40')][_0x1ee1('0x6d')](function(_0x31bc79){_0x28a29c[_0x1ee1('0x48')]('i.'+_0x31bc79);});}else{_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0x90'),_0x1ee1('0x91'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0x9f'),_0x1ee1('0xa0'));_0x28a29c[_0x1ee1('0x48')]('a.mandatoryDisposition',_0x1ee1('0xa1'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xa2'),'contactName');_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xa3'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xa4'),_0x1ee1('0xa5'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xa6'),_0x1ee1('0xa7'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xa8'),_0x1ee1('0xa9'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xaa'),_0x1ee1('0xab'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xac'),_0x1ee1('0xad'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xae'),_0x1ee1('0xaf'));_0x28a29c['field'](_0x1ee1('0xb0'),_0x1ee1('0xb1'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xb2'),_0x1ee1('0xb3'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xb4'),'TagIds');}if(_0xc72d91[_0x1ee1('0x43')])_0x28a29c[_0x1ee1('0x43')](_0xc72d91['limit']);if(_0xc72d91[_0x1ee1('0x23')])_0x28a29c[_0x1ee1('0x23')](_0xc72d91[_0x1ee1('0x23')]);return db['sequelize'][_0x1ee1('0x3b')](_0x28a29c['toString'](),_0x45e580);})[_0x1ee1('0x29')](function(_0x4db77b){_0x51d960['where'](_0x1ee1('0xb5'),_[_0x1ee1('0x34')](_0x4db77b,'id'));return db[_0x1ee1('0x9b')][_0x1ee1('0x3b')](_0x51d960[_0x1ee1('0x9c')](),_0x45e580)['then'](function(_0x3cd870){var _0x1e80ec=_['groupBy'](_0x3cd870,_0x1ee1('0xb6'));var _0x5e7764=[];_0x4db77b[_0x1ee1('0x6d')](function(_0x3d416a){_0x5e7764[_0x1ee1('0x31')](updateWhatsappInteraction(_0x3d416a,_0x1b5f05,_0x1e80ec));});return BPromise[_0x1ee1('0xb7')](_0x5e7764);});});})['then'](function(_0x3e3027){_0x3d9e0a[_0x1ee1('0xb8')]=_0x3e3027;return _0x3d9e0a;})[_0x1ee1('0x29')](respondWithFilteredResult(_0x208845,_0xc72d91))[_0x1ee1('0x32')](handleError(_0x208845,null));};exports[_0x1ee1('0xb9')]=function(_0x757adb,_0x2756b9){var _0x444ea1={'raw':![],'where':{'id':_0x757adb[_0x1ee1('0xba')]['id']}},_0xfa5bbb={};_0xfa5bbb[_0x1ee1('0x3a')]=_[_0x1ee1('0x3c')](db[_0x1ee1('0x35')]['rawAttributes']);_0xfa5bbb[_0x1ee1('0x3b')]=_[_0x1ee1('0x3c')](_0x757adb['query']);_0xfa5bbb[_0x1ee1('0x3d')]=_[_0x1ee1('0x3e')](_0xfa5bbb[_0x1ee1('0x3a')],_0xfa5bbb[_0x1ee1('0x3b')]);_0x444ea1[_0x1ee1('0x40')]=_['intersection'](_0xfa5bbb[_0x1ee1('0x3a')],qs[_0x1ee1('0x3f')](_0x757adb[_0x1ee1('0x3b')]['fields']));_0x444ea1['attributes']=_0x444ea1['attributes'][_0x1ee1('0x41')]?_0x444ea1[_0x1ee1('0x40')]:_0xfa5bbb[_0x1ee1('0x3a')];if(_0x757adb['query'][_0x1ee1('0xbb')]){_0x444ea1['include']=[{'all':!![]}];}_0x444ea1=_[_0x1ee1('0x9e')]({},_0x444ea1,_0x757adb['options']);return db[_0x1ee1('0x35')][_0x1ee1('0x61')](_0x444ea1)['then'](handleEntityNotFound(_0x2756b9,null))[_0x1ee1('0x29')](respondWithResult(_0x2756b9,null))['catch'](handleError(_0x2756b9,null));};exports[_0x1ee1('0xbc')]=function(_0x3a36c0,_0x29071a){return db[_0x1ee1('0x35')][_0x1ee1('0xbc')](_0x3a36c0[_0x1ee1('0x73')],{})['then'](respondWithResult(_0x29071a,0xc9))[_0x1ee1('0x32')](handleError(_0x29071a,null));};exports[_0x1ee1('0x28')]=function(_0x5991df,_0x50aa00){if(_0x5991df['body']['id']){delete _0x5991df[_0x1ee1('0x73')]['id'];}return db[_0x1ee1('0x35')]['find']({'where':{'id':_0x5991df[_0x1ee1('0xba')]['id']}})[_0x1ee1('0x29')](handleEntityNotFound(_0x50aa00,null))['then'](saveUpdates(_0x5991df[_0x1ee1('0x73')],null))[_0x1ee1('0x29')](respondWithResult(_0x50aa00,null))[_0x1ee1('0x32')](handleError(_0x50aa00,null));};exports[_0x1ee1('0x2a')]=function(_0x2cfb84,_0x4d26e9){return db['WhatsappInteraction'][_0x1ee1('0x61')]({'where':{'id':_0x2cfb84[_0x1ee1('0xba')]['id']}})[_0x1ee1('0x29')](handleEntityNotFound(_0x4d26e9,null))['then'](removeEntity(_0x4d26e9,null))[_0x1ee1('0x32')](handleError(_0x4d26e9,null));};exports[_0x1ee1('0xbd')]=function(_0x443e49,_0x3f2ab0){return db[_0x1ee1('0x35')][_0x1ee1('0xbd')]()['then'](respondWithResult(_0x3f2ab0,null))['catch'](handleError(_0x3f2ab0,null));};exports[_0x1ee1('0xbe')]=function(_0x3a073f,_0x2b43c7,_0x7167ed){return db['WhatsappMessage'][_0x1ee1('0x61')]({'where':{'id':_0x3a073f['params']['id']}})[_0x1ee1('0x29')](handleEntityNotFound(_0x2b43c7,null))[_0x1ee1('0x29')](function(_0x1364aa){if(_0x1364aa){return _0x1364aa[_0x1ee1('0xbe')](_0x3a073f[_0x1ee1('0x73')]['ids'],_[_0x1ee1('0xbf')](_0x3a073f[_0x1ee1('0x73')],[_0x1ee1('0xc0'),'id'])||{});}})['then'](respondWithResult(_0x2b43c7,null))[_0x1ee1('0x32')](handleError(_0x2b43c7,null));};exports[_0x1ee1('0xc1')]=function(_0x18d182,_0xd185dc,_0x3a0c1d){var _0x2abd29={'raw':![],'where':{}};var _0x483fbe={};var _0x390100={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x1ee1('0xc2')]({'where':{'id':_0x18d182[_0x1ee1('0xba')]['id']}})[_0x1ee1('0x29')](handleEntityNotFound(_0xd185dc,null))[_0x1ee1('0x29')](function(_0xb5cfde){if(_0xb5cfde){_0x483fbe[_0x1ee1('0x3a')]=_[_0x1ee1('0x3c')](db['WhatsappMessage'][_0x1ee1('0x36')]);_0x483fbe[_0x1ee1('0x3b')]=_['keys'](_0x18d182[_0x1ee1('0x3b')]);_0x483fbe['filters']=_[_0x1ee1('0x3e')](_0x483fbe[_0x1ee1('0x3a')],_0x483fbe[_0x1ee1('0x3b')]);_0x2abd29['attributes']=_[_0x1ee1('0x3e')](_0x483fbe[_0x1ee1('0x3a')],qs[_0x1ee1('0x3f')](_0x18d182['query'][_0x1ee1('0x3f')]));_0x2abd29[_0x1ee1('0x40')]=_0x2abd29[_0x1ee1('0x40')]['length']?_0x2abd29[_0x1ee1('0x40')]:_0x483fbe[_0x1ee1('0x3a')];if(!_0x18d182[_0x1ee1('0x3b')]['hasOwnProperty'](_0x1ee1('0xc3'))){_0x2abd29[_0x1ee1('0x43')]=qs[_0x1ee1('0x43')](_0x18d182['query'][_0x1ee1('0x43')]);_0x2abd29[_0x1ee1('0x23')]=qs[_0x1ee1('0x23')](_0x18d182[_0x1ee1('0x3b')][_0x1ee1('0x23')]);}_0x2abd29[_0x1ee1('0x44')]=qs[_0x1ee1('0x45')](_0x18d182[_0x1ee1('0x3b')]['sort']);_0x2abd29[_0x1ee1('0x79')]=qs[_0x1ee1('0x3d')](_['pick'](_0x18d182[_0x1ee1('0x3b')],_0x483fbe[_0x1ee1('0x3d')]));_0x2abd29[_0x1ee1('0x79')][_0x1ee1('0xb6')]=_0xb5cfde['id'];if(_0x18d182[_0x1ee1('0x3b')][_0x1ee1('0x86')]){_0x2abd29[_0x1ee1('0x79')]=_[_0x1ee1('0x9e')](_0x2abd29[_0x1ee1('0x79')],{'$or':_[_0x1ee1('0x34')](_0x2abd29[_0x1ee1('0x40')],function(_0x42c283){var _0x585ad3={};_0x585ad3[_0x42c283]={'$like':'%'+_0x18d182[_0x1ee1('0x3b')]['filter']+'%'};return _0x585ad3;})});}if(_0x18d182[_0x1ee1('0x3b')]['$gte']){var _0x44b353=_0x18d182[_0x1ee1('0x3b')][_0x1ee1('0x7c')][_0x1ee1('0x67')](',');var _0x57afeb={};_0x57afeb[_0x44b353[0x0]]={'$gte':moment(_0x44b353[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2abd29[_0x1ee1('0x79')]=_[_0x1ee1('0x9e')](_0x2abd29[_0x1ee1('0x79')],_0x57afeb);}_0x2abd29=_['merge']({},_0x2abd29,_0x18d182[_0x1ee1('0xc4')]);return db[_0x1ee1('0xc5')][_0x1ee1('0x22')]({'where':_0x2abd29['where']})['then'](function(_0x2f9b36){_0x390100[_0x1ee1('0x22')]=_0x2f9b36;if(_0x18d182['query']['includeAll']){_0x2abd29[_0x1ee1('0xc6')]=[{'all':!![]}];}return db[_0x1ee1('0xc5')]['findAll'](_0x2abd29);})[_0x1ee1('0x29')](function(_0x57747d){_0x390100['rows']=_0x57747d;return _0x390100;});}})[_0x1ee1('0x29')](respondWithFilteredResult(_0xd185dc,_0x2abd29))[_0x1ee1('0x32')](handleError(_0xd185dc,null));};exports[_0x1ee1('0xc7')]=function(_0x1acbf6,_0xd318fa,_0x17165f){return db[_0x1ee1('0x35')]['find']({'where':{'id':_0x1acbf6[_0x1ee1('0xba')]['id']}})['then'](handleEntityNotFound(_0xd318fa,null))[_0x1ee1('0x29')](function(_0x499866){if(_0x499866){return _0x499866[_0x1ee1('0xc8')](_0x1acbf6[_0x1ee1('0x73')][_0x1ee1('0xc0')],_[_0x1ee1('0xbf')](_0x1acbf6[_0x1ee1('0x73')],[_0x1ee1('0xc0'),'id'])||{})[_0x1ee1('0xc9')](function(){return db[_0x1ee1('0xca')][_0x1ee1('0xcb')]({'attributes':['id',_0x1ee1('0x2d'),_0x1ee1('0x49')],'where':{'id':_0x1acbf6[_0x1ee1('0x73')][_0x1ee1('0xc0')]}});})[_0x1ee1('0x29')](function(_0x2a121d){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x1acbf6['params']['id']),'tags':_0x2a121d||[]});return{'id':Number(_0x1acbf6['params']['id']),'tags':_0x2a121d||[]};});}})[_0x1ee1('0x29')](respondWithResult(_0xd318fa,null))[_0x1ee1('0x32')](handleError(_0xd318fa,null));};exports['removeTags']=function(_0x1797af,_0x42e7e7,_0x4ed766){return db['WhatsappInteraction'][_0x1ee1('0x61')]({'where':{'id':_0x1797af['params']['id']}})[_0x1ee1('0x29')](handleEntityNotFound(_0x42e7e7,null))['then'](function(_0x1c07b2){if(_0x1c07b2){return _0x1c07b2[_0x1ee1('0xcc')](_0x1797af[_0x1ee1('0x3b')]['ids']);}})[_0x1ee1('0x29')](respondWithStatusCode(_0x42e7e7,null))['catch'](handleError(_0x42e7e7,null));};exports['download']=function(_0x1f5bd4,_0x2229ac){var _0x3a2432=moment()['unix']()[_0x1ee1('0x9c')]();var _0x39f6ae=path['join'](config[_0x1ee1('0xcd')],'server','files',_0x1ee1('0xce'));var _0x480fcc=path[_0x1ee1('0xcf')](config[_0x1ee1('0xcd')],_0x1ee1('0xd0'),_0x1ee1('0xd1'),_0x1ee1('0xd2'));var _0x143217=path[_0x1ee1('0xcf')](_0x39f6ae,_0x3a2432);var _0x1b8cb8=util[_0x1ee1('0xd3')]('transcript-%d-%s.zip',_0x1f5bd4[_0x1ee1('0xba')]['id'],_0x3a2432);var _0x9cf71f=path[_0x1ee1('0xcf')](_0x39f6ae,_0x1b8cb8);var _0x1ee2b4=[];_0x1ee2b4[_0x1ee1('0x31')]({'model':db[_0x1ee1('0x70')],'as':_0x1ee1('0x70'),'attributes':['id',_0x1ee1('0x2e')],'raw':!![]});_0x1ee2b4['push']({'model':db[_0x1ee1('0xd4')],'as':_0x1ee1('0xd5'),'attributes':['id',_0x1ee1('0xd6'),_0x1ee1('0xd7')],'raw':!![]});if(_0x1f5bd4[_0x1ee1('0x3b')][_0x1ee1('0xd2')]){_0x1ee2b4[_0x1ee1('0x31')]({'model':db[_0x1ee1('0xd8')],'as':_0x1ee1('0xd8'),'raw':!![]});}var _0x40de9e=[{'model':db[_0x1ee1('0xc5')],'as':_0x1ee1('0xd9'),'attributes':['id',_0x1ee1('0x73'),_0x1ee1('0x7b'),'direction',_0x1ee1('0xda'),_0x1ee1('0x82')],'include':_0x1ee2b4}];_0x40de9e['push']({'model':db['WhatsappAccount'],'as':_0x1ee1('0xdb'),'attributes':['id','name']});_0x40de9e[_0x1ee1('0x31')]({'model':db[_0x1ee1('0x70')],'as':'Owner','attributes':['id',_0x1ee1('0x2e')]});return db[_0x1ee1('0x35')][_0x1ee1('0x61')]({'where':{'id':_0x1f5bd4[_0x1ee1('0xba')]['id']},'include':_0x40de9e})['then'](handleEntityNotFound(_0x2229ac,null))[_0x1ee1('0x29')](function(_0x36a848){if(_0x36a848){var _0x24a1e9=_0x36a848['get']({'plain':!![]});fs['mkdirSync'](_0x143217);var _0x42184c={'format':'A4','border':_0x1ee1('0xdc'),'header':{'height':'40px','contents':{'first':_0x1ee1('0xdd')}},'footer':{'height':'30px','contents':{'default':util[_0x1ee1('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x1ee1('0xd3')](_0x1ee1('0xde'),_0x1ee1('0xdf'),_0x24a1e9['id']),moment()[_0x1ee1('0xd3')](_0x1ee1('0xe0'))[_0x1ee1('0x9c')]())}}};var _0x19546d={'channel':_0x1ee1('0xdf'),'account':_0x24a1e9['Account']['name'],'agent':_0x24a1e9[_0x1ee1('0xe1')]?_0x24a1e9[_0x1ee1('0xe1')]['fullname']:'N.A.','createdAt':moment(_0x24a1e9[_0x1ee1('0x7b')])[_0x1ee1('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x24a1e9[_0x1ee1('0xe2')]?moment(_0x24a1e9[_0x1ee1('0xe3')])[_0x1ee1('0xd3')](_0x1ee1('0xe4'))[_0x1ee1('0x9c')]():'','disposition':_0x24a1e9['disposition'],'messages':_(_0x24a1e9[_0x1ee1('0xd9')])[_0x1ee1('0x86')]({'secret':![]})[_0x1ee1('0x34')](function(_0x274b3b){if(_0x274b3b['Attachment']){var _0x2a7e02=path[_0x1ee1('0xcf')](_0x480fcc,_0x274b3b[_0x1ee1('0xd8')][_0x1ee1('0xe5')]);if(fs[_0x1ee1('0xe6')](_0x2a7e02)){fs[_0x1ee1('0xe7')](_0x2a7e02)[_0x1ee1('0xe8')](fs['createWriteStream'](path['join'](_0x143217,_0x274b3b[_0x1ee1('0xd8')]['basename'])));}}return{'date':moment(_0x274b3b['createdAt'])[_0x1ee1('0xd3')](_0x1ee1('0xe4'))[_0x1ee1('0x9c')](),'sender':_0x274b3b[_0x1ee1('0xe9')]===_0x1ee1('0xea')?_0x274b3b[_0x1ee1('0x70')]?_0x274b3b[_0x1ee1('0x70')]['fullname']:'System':_0x274b3b[_0x1ee1('0xd5')][_0x1ee1('0xd6')]+(_0x274b3b[_0x1ee1('0xd5')][_0x1ee1('0xd7')]?'\x20'+_0x274b3b[_0x1ee1('0xd5')][_0x1ee1('0xd7')]:''),'body':_0x274b3b[_0x1ee1('0xd8')]?_0x274b3b[_0x1ee1('0xd8')][_0x1ee1('0xe5')]:_0x274b3b['body'],'direction':_0x274b3b[_0x1ee1('0xe9')]===_0x1ee1('0xea')?'A':'C','secret':_0x274b3b[_0x1ee1('0xda')],'read':_0x274b3b[_0x1ee1('0x82')],'attachment':_0x274b3b['Attachment']};})['value']()};return ejs['renderFile'](path[_0x1ee1('0xcf')](config[_0x1ee1('0xcd')],_0x1ee1('0xd0'),_0x1ee1('0xeb'),'downloadInteraction.html'),{'interaction':_0x19546d})[_0x1ee1('0x29')](function(_0x398b83){return new BPromise(function(_0x214b04,_0x30ade6){pdf['create'](_0x398b83,_0x42184c)[_0x1ee1('0xec')](path[_0x1ee1('0xcf')](_0x143217,_0x1ee1('0xed')+_0x24a1e9['id']+'-'+_0x3a2432+_0x1ee1('0xee')),function(_0x3d8b7e,_0x23f265){if(_0x3d8b7e)return _0x30ade6(_0x3d8b7e);_0x214b04(_0x23f265);});});})['then'](function(){return new BPromise(function(_0xfd57ef,_0x4fb42d){zipdir(_0x143217,{'saveTo':_0x9cf71f},function(_0x2ff53a,_0x152f9f){if(_0x2ff53a)return _0x4fb42d(_0x2ff53a);return _0xfd57ef(_0x152f9f);});})[_0x1ee1('0x29')](function(){return new BPromise(function(_0x52cec6,_0x4a7213){rimraf(_0x143217,function(_0x553486){if(_0x553486)_0x4a7213(_0x553486);return _0x52cec6();});});})[_0x1ee1('0x29')](function(){return _0x2229ac[_0x1ee1('0xef')](_0x9cf71f,_0x1b8cb8,function(_0x36a211){if(_0x36a211){console['log'](_0x1ee1('0xf0'),_0x36a211);}else{fs['unlinkSync'](_0x9cf71f);}});});});}else{return _0x2229ac['sendStatus'](0xc8);}})[_0x1ee1('0x32')](handleError(_0x2229ac,null));}; \ No newline at end of file +var _0x3f19=['reject','update','then','end','error','stack','name','send','Users','map','TagIds','push','catch','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','tools_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','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','body','start','some','isEmpty','forEach','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','where','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','count','keyBy','merge','a.key','Account.mandatoryDisposition','contactName','Contact.firstName','c.lastName','Contact.lastName','c.phone','c.mobile','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','params','includeAll','options','create','destroy','describe','addMessage','omit','ids','getMessages','WhatsappMessage','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Attachment','secret','Account','fullname','get','10px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Owner','N.A.','closed','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','direction','renderFile','transcript-','.pdf','err','unlinkSync','html-pdf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset','set','Content-Range'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x3f19,0xc0));var _0x93f1=function(_0x469218,_0x440d05){_0x469218=_0x469218-0x0;var _0x187b4a=_0x3f19[_0x469218];return _0x187b4a;};'use strict';var pdf=require(_0x93f1('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x93f1('0x1'));var rp=require('request-promise');var moment=require(_0x93f1('0x2'));var BPromise=require(_0x93f1('0x3'));var Mustache=require(_0x93f1('0x4'));var util=require(_0x93f1('0x5'));var path=require('path');var sox=require(_0x93f1('0x6'));var csv=require(_0x93f1('0x7'));var ejs=require(_0x93f1('0x8'));var fs=require('fs');var fs_extra=require(_0x93f1('0x9'));var _=require(_0x93f1('0xa'));var squel=require(_0x93f1('0xb'));var crypto=require('crypto');var jsforce=require(_0x93f1('0xc'));var deskjs=require(_0x93f1('0xd'));var toCsv=require(_0x93f1('0x7'));var querystring=require(_0x93f1('0xe'));var Papa=require(_0x93f1('0xf'));var Redis=require('ioredis');var authService=require(_0x93f1('0x10'));var qs=require(_0x93f1('0x11'));var as=require(_0x93f1('0x12'));var hardwareService=require(_0x93f1('0x13'));var logger=require(_0x93f1('0x14'))(_0x93f1('0x15'));var utils=require(_0x93f1('0x16'));var config=require(_0x93f1('0x17'));var licenseUtil=require(_0x93f1('0x18'));var db=require(_0x93f1('0x19'))['db'];config['redis']=_[_0x93f1('0x1a')](config[_0x93f1('0x1b')],{'host':_0x93f1('0x1c'),'port':0x18eb});var socket=require(_0x93f1('0x1d'))(new Redis(config['redis']));require(_0x93f1('0x1e'))[_0x93f1('0x1f')](socket);function respondWithStatusCode(_0x1bb542,_0x3bb9b0){_0x3bb9b0=_0x3bb9b0||0xcc;return function(_0x176cf2){if(_0x176cf2){return _0x1bb542[_0x93f1('0x20')](_0x3bb9b0);}return _0x1bb542[_0x93f1('0x21')](_0x3bb9b0)['end']();};}function respondWithResult(_0x2c8445,_0x415f1a){_0x415f1a=_0x415f1a||0xc8;return function(_0x3e3afa){if(_0x3e3afa){return _0x2c8445[_0x93f1('0x21')](_0x415f1a)[_0x93f1('0x22')](_0x3e3afa);}};}function respondWithFilteredResult(_0x278079,_0xaed1b5){return function(_0xf3d769){if(_0xf3d769){var _0x15c213=_0xf3d769['count'],_0x380e78=_0xaed1b5['offset'],_0x2c6d6b=_0xaed1b5[_0x93f1('0x23')]+_0xaed1b5['limit'],_0x577751;if(_0x2c6d6b>=_0x15c213){_0x2c6d6b=_0x15c213;_0x577751=0xc8;}else{_0x577751=0xce;}_0x278079[_0x93f1('0x21')](_0x577751);return _0x278079[_0x93f1('0x24')](_0x93f1('0x25'),_0x380e78+'-'+_0x2c6d6b+'/'+_0x15c213)[_0x93f1('0x22')](_0xf3d769);}return null;};}function patchUpdates(_0x595943){return function(_0x39654f){try{jsonpatch['apply'](_0x39654f,_0x595943,!![]);}catch(_0xe7cea3){return BPromise[_0x93f1('0x26')](_0xe7cea3);}return _0x39654f['save']();};}function saveUpdates(_0x809b23,_0x52d9e5){return function(_0x578ccc){if(_0x578ccc){return _0x578ccc[_0x93f1('0x27')](_0x809b23)[_0x93f1('0x28')](function(_0x5c30a5){return _0x5c30a5;});}return null;};}function removeEntity(_0x634591,_0x54659c){return function(_0x1a6357){if(_0x1a6357){return _0x1a6357['destroy']()['then'](function(){_0x634591[_0x93f1('0x21')](0xcc)[_0x93f1('0x29')]();});}};}function handleEntityNotFound(_0x119385,_0x46719c){return function(_0x2e9444){if(!_0x2e9444){_0x119385[_0x93f1('0x20')](0x194);}return _0x2e9444;};}function handleError(_0x5a508a,_0x2eff69){_0x2eff69=_0x2eff69||0x1f4;return function(_0x4d501d){logger[_0x93f1('0x2a')](_0x4d501d[_0x93f1('0x2b')]);if(_0x4d501d[_0x93f1('0x2c')]){delete _0x4d501d[_0x93f1('0x2c')];}_0x5a508a[_0x93f1('0x21')](_0x2eff69)[_0x93f1('0x2d')](_0x4d501d);};}function getInteractionUsers(_0x2e6661,_0x35a2d5){return new BPromise(function(_0x58786d,_0x475201){try{if(_0x35a2d5[_0x2e6661['id']]){_0x2e6661[_0x93f1('0x2e')]=_[_0x93f1('0x2f')](_0x35a2d5[_0x2e6661['id']],function(_0x12e9d4){return{'id':_0x12e9d4['id'],'fullname':_0x12e9d4['fullname']};});}}catch(_0x104fe9){_0x475201(_0x104fe9);}_0x58786d(_0x2e6661);});}function getInteractionTags(_0x2d2b40,_0x4c6604){return new BPromise(function(_0x27efe0,_0x387363){try{if(_0x2d2b40['TagIds']){_0x2d2b40['Tags']=[];_0x2d2b40[_0x93f1('0x30')]['split'](',')['forEach'](function(_0x4cd227){_0x2d2b40['Tags'][_0x93f1('0x31')](_0x4c6604[_0x4cd227]);});}delete _0x2d2b40[_0x93f1('0x30')];}catch(_0x588360){_0x387363(_0x588360);}_0x27efe0(_0x2d2b40);});}function updateWhatsappInteraction(_0x4582f5,_0x1d4847,_0x8917da){return new BPromise(function(_0x180dff,_0x1e9358){return getInteractionUsers(_0x4582f5,_0x8917da)[_0x93f1('0x28')](function(_0x7798d2){return getInteractionTags(_0x7798d2,_0x1d4847);})[_0x93f1('0x28')](function(_0x13929d){_0x180dff(_0x13929d);})[_0x93f1('0x32')](function(_0x2a1a75){_0x1e9358(_0x2a1a75);});});}exports['index']=function(_0x4b7cdb,_0x35f23c){var _0x22e526={},_0x38b8fb={},_0x159ffd={'count':0x0,'rows':[]};var _0x5a5094=_['map'](db[_0x93f1('0x33')][_0x93f1('0x34')],function(_0x5d2d36){return{'name':_0x5d2d36[_0x93f1('0x35')],'type':_0x5d2d36[_0x93f1('0x36')][_0x93f1('0x37')]};});_0x38b8fb[_0x93f1('0x38')]=_[_0x93f1('0x2f')](_0x5a5094,_0x93f1('0x2c'));_0x38b8fb[_0x93f1('0x39')]=_[_0x93f1('0x3a')](_0x4b7cdb[_0x93f1('0x39')]);_0x38b8fb[_0x93f1('0x3b')]=_['intersection'](_0x38b8fb['model'],_0x38b8fb[_0x93f1('0x39')]);_0x22e526[_0x93f1('0x3c')]=_[_0x93f1('0x3d')](_0x38b8fb[_0x93f1('0x38')],qs[_0x93f1('0x3e')](_0x4b7cdb[_0x93f1('0x39')][_0x93f1('0x3e')]));_0x22e526[_0x93f1('0x3c')]=_0x22e526[_0x93f1('0x3c')][_0x93f1('0x3f')]?_0x22e526[_0x93f1('0x3c')]:_0x38b8fb['model'];if(!_0x4b7cdb[_0x93f1('0x39')]['hasOwnProperty'](_0x93f1('0x40'))){_0x22e526[_0x93f1('0x41')]=qs[_0x93f1('0x41')](_0x4b7cdb[_0x93f1('0x39')][_0x93f1('0x41')]);_0x22e526[_0x93f1('0x23')]=qs[_0x93f1('0x23')](_0x4b7cdb[_0x93f1('0x39')][_0x93f1('0x23')]);}_0x22e526[_0x93f1('0x42')]=qs[_0x93f1('0x43')](_0x4b7cdb['query']['sort']);_0x22e526['where']=qs[_0x93f1('0x3b')](_[_0x93f1('0x44')](_0x4b7cdb[_0x93f1('0x39')],_0x38b8fb[_0x93f1('0x3b')]),_0x5a5094);var _0x4d63f0=[];var _0x33f3e9=squel[_0x93f1('0x45')]()[_0x93f1('0x46')]('id')[_0x93f1('0x46')]('name')['field'](_0x93f1('0x47'))[_0x93f1('0x48')]('tools_tags');var _0x15999d=squel[_0x93f1('0x45')]()[_0x93f1('0x46')](_0x93f1('0x49'))[_0x93f1('0x46')](_0x93f1('0x4a'))[_0x93f1('0x46')](_0x93f1('0x4b'))['from'](_0x93f1('0x4c'),'ui')['left_join']('users','u',_0x93f1('0x4d'));var _0x164b61=squel[_0x93f1('0x45')]()[_0x93f1('0x48')](_0x93f1('0x4e'),'i')['left_join'](_0x93f1('0x4f'),'c',_0x93f1('0x50'))[_0x93f1('0x51')](_0x93f1('0x52'),'o',_0x93f1('0x53'))[_0x93f1('0x51')]('whatsapp_accounts','a',_0x93f1('0x54'))['left_join'](_0x93f1('0x55'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x93f1('0x51')](_0x93f1('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x93f1('0x51')](_0x93f1('0x57'),'t',_0x93f1('0x58'));var _0x2e3622=squel['expr']();var _0x5620a3=[];var _0x39113f=squel[_0x93f1('0x59')]();var _0x527361;if(_0x4b7cdb[_0x93f1('0x39')][_0x93f1('0x5a')]){_0x527361=as['parseSearch'](_0x4b7cdb[_0x93f1('0x39')][_0x93f1('0x5a')]);var _0xc0a20d=_0x527361[_0x93f1('0x5b')];for(var _0x5ac581=0x0;_0x5ac581<_0x527361[_0x93f1('0x5c')][_0x93f1('0x3f')];_0x5ac581++){var _0x190c03=_0x527361[_0x93f1('0x5c')][_0x5ac581];var _0x13918d='i';var _0x35e330=_[_0x93f1('0x5d')](_0x5a5094,[_0x93f1('0x2c'),_0x190c03[_0x93f1('0x46')]]);if(!_0x35e330){switch(_0x190c03[_0x93f1('0x46')]){case _0x93f1('0x5e'):if(_0x190c03[_0x93f1('0x5f')]==0x1){_0x164b61['having']('`'+_0x190c03[_0x93f1('0x46')]+'`\x20=\x200');}else{_0x164b61[_0x93f1('0x60')]('`'+_0x190c03[_0x93f1('0x46')]+_0x93f1('0x61'));}break;case _0x93f1('0x62'):if(_0x190c03[_0x93f1('0x63')]===_0x93f1('0x64')){if(_0x190c03[_0x93f1('0x5f')]['split']('\x20')[_0x93f1('0x3f')]>0x1){_0x2e3622[_0xc0a20d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x93f1('0x65')](_0x190c03['value']),null);}else{var _0x1bf771='%'+_0x190c03[_0x93f1('0x5f')]+'%';_0x2e3622[_0xc0a20d](_0x93f1('0x66'),_0x1bf771,_0x1bf771,_0x1bf771);}}else{_0x35e330=_[_0x93f1('0x5d')](_0x5a5094,[_0x93f1('0x2c'),_0x93f1('0x67')]);_0x190c03[_0x93f1('0x46')]=_0x93f1('0x67');_0xfa4b44=as[_0x93f1('0x68')](_0x13918d,_0x35e330[_0x93f1('0x36')],_0x190c03);_0x2e3622[_0xc0a20d](_0xfa4b44[_0x93f1('0x69')],_0xfa4b44[_0x93f1('0x5f')]['start'],_0xfa4b44['value']['end']);}break;case _0x93f1('0x6a'):var _0x362702=_0x190c03['value']['split'](',')['map'](function(_0x56fae1){return Number(_0x56fae1);});_0x362702['forEach'](function(_0x472e6f){_0x39113f['or'](_0x93f1('0x6b'),'%,'+_0x472e6f+',%');});_0x5620a3=_[_0x93f1('0x6c')](_0x5620a3,_0x362702);break;case'User':if(_0x190c03[_0x93f1('0x63')]==='$substring'){_0x2e3622[_0xc0a20d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x190c03['value']+'%',null);}else{_0x35e330=_[_0x93f1('0x5d')](_0x5a5094,['name',_0x93f1('0x6d')]);_0x190c03['field']=_0x93f1('0x6d');_0xfa4b44=as[_0x93f1('0x68')](_0x13918d,_0x35e330[_0x93f1('0x36')],_0x190c03);_0x2e3622[_0xc0a20d](_0xfa4b44['text'],_0xfa4b44[_0x93f1('0x5f')]['start'],_0xfa4b44[_0x93f1('0x5f')]['end']);}break;case _0x93f1('0x6e'):_0xfa4b44=as[_0x93f1('0x68')]('me',null,_0x190c03);_0x2e3622[_0xc0a20d](_0xfa4b44[_0x93f1('0x69')],_0xfa4b44['value'][_0x93f1('0x6f')],_0xfa4b44[_0x93f1('0x5f')][_0x93f1('0x29')]);break;}}else{var _0xfa4b44=as[_0x93f1('0x68')](_0x13918d,_0x35e330[_0x93f1('0x36')],_0x190c03);_0x2e3622[_0xc0a20d](_0xfa4b44[_0x93f1('0x69')],_0xfa4b44[_0x93f1('0x5f')][_0x93f1('0x6f')],_0xfa4b44[_0x93f1('0x5f')][_0x93f1('0x29')]);}}}else{var _0x18e889=_(_0x4b7cdb[_0x93f1('0x39')])[_0x93f1('0x3a')]()[_0x93f1('0x2f')](function(_0x2f6d1c){return _[_0x93f1('0x70')](_0x5a5094,[_0x93f1('0x2c'),_0x2f6d1c])?_0x2f6d1c:undefined;})['compact']()[_0x93f1('0x5f')]();if(!_[_0x93f1('0x71')](_0x18e889)){_0x18e889[_0x93f1('0x72')](function(_0x309c21){if(_0x309c21===_0x93f1('0x73')){_0x164b61['where'](_0x93f1('0x74'),[][_0x93f1('0x75')](_0x4b7cdb[_0x93f1('0x39')][_0x309c21]));}else if(_0x309c21===_0x93f1('0x76')){var _0x396eb4=JSON['parse'](_0x4b7cdb['query'][_0x309c21])[_0x93f1('0x77')];var _0x42d667=JSON[_0x93f1('0x78')](_0x4b7cdb[_0x93f1('0x39')][_0x309c21])[_0x93f1('0x79')];_0x164b61['where'](_0x93f1('0x7a'),_0x396eb4,_0x42d667);}else{if(_0x4b7cdb[_0x93f1('0x39')][_0x309c21]==='null'){_0x164b61['where']('i.'+_0x309c21+_0x93f1('0x7b'));}else{_0x164b61[_0x93f1('0x7c')]('i.'+_0x309c21+_0x93f1('0x7d'),_0x4b7cdb[_0x93f1('0x39')][_0x309c21]);}}});}if(_0x4b7cdb[_0x93f1('0x39')]['read']){if(_0x4b7cdb['query'][_0x93f1('0x7e')]==0x1){_0x164b61[_0x93f1('0x60')](_0x93f1('0x7f'));}else{_0x164b61[_0x93f1('0x60')]('`unreadMessages`\x20>\x200');}}if(_0x4b7cdb[_0x93f1('0x39')][_0x93f1('0x80')]){_0x5620a3=_[_0x93f1('0x81')](_0x4b7cdb[_0x93f1('0x39')]['tag'])?_0x4b7cdb[_0x93f1('0x39')][_0x93f1('0x80')]:new Array(_0x4b7cdb[_0x93f1('0x39')]['tag']);_0x5620a3['forEach'](function(_0x2fa86b){_0x39113f['or'](_0x93f1('0x6b'),'%,'+_0x2fa86b+',%');});}if(_0x4b7cdb['query']['filter']){var _0x361a45=_0x4b7cdb[_0x93f1('0x39')][_0x93f1('0x82')][_0x93f1('0x83')]('\x5c','\x5c\x5c')[_0x93f1('0x83')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x361a45)){_0x2e3622['or']('i.id\x20LIKE\x20?',_0x361a45+'%')['or'](_0x93f1('0x84'),_0x361a45+'%');}else{_0x2e3622['or'](_0x93f1('0x85'),qs[_0x93f1('0x65')](_0x361a45))['or'](_0x93f1('0x86'),_0x361a45+'%');}}}_0x164b61['where'](_0x2e3622);_0x164b61['group']('i.id');var _0x708e2c={'type':db[_0x93f1('0x87')][_0x93f1('0x88')][_0x93f1('0x89')],'raw':!![]};var _0x4c8672=_0x164b61[_0x93f1('0x8a')]();_0x4c8672[_0x93f1('0x46')]('i.id');_0x4c8672[_0x93f1('0x46')](_0x93f1('0x8b'),'unreadMessages');if(_0x22e526[_0x93f1('0x42')]){_0x22e526[_0x93f1('0x42')][_0x93f1('0x72')](function(_0x4fec03){var _0x2f494e=_0x4fec03[0x0]==='contactName'?_0x4fec03[0x0]:'i.'+_0x4fec03[0x0];_0x164b61[_0x93f1('0x42')](_0x2f494e,_0x4fec03[0x1]===_0x93f1('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x5620a3)){_0x164b61[_0x93f1('0x60')](_0x39113f);_0x4c8672['where'](_0x93f1('0x8d'),_0x5620a3);}BPromise[_0x93f1('0x8e')]()[_0x93f1('0x28')](function(){if(!_0x527361){if(_0x4b7cdb[_0x93f1('0x39')]['WhatsappAccountId'])return;_0x4c8672[_0x93f1('0x7c')](_0x93f1('0x8f'));_0x164b61['where'](_0x93f1('0x8f'));return;}if(_0x4b7cdb[_0x93f1('0x90')][_0x93f1('0x91')]!==_0x93f1('0x92'))return;return _0x4b7cdb[_0x93f1('0x90')][_0x93f1('0x93')]({'attributes':['id'],'raw':!![]})[_0x93f1('0x28')](function(_0x311fef){if(_[_0x93f1('0x71')](_0x311fef)){_0x4c8672[_0x93f1('0x7c')](_0x93f1('0x94'));_0x164b61[_0x93f1('0x7c')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x4c8672[_0x93f1('0x7c')](_0x93f1('0x74'),_['map'](_0x311fef,'id'));_0x164b61[_0x93f1('0x7c')](_0x93f1('0x74'),_[_0x93f1('0x2f')](_0x311fef,'id'));}});})[_0x93f1('0x28')](function(){if(_0x4b7cdb['user'][_0x93f1('0x91')]===_0x93f1('0x92')&&!_0x527361&&!_0x4b7cdb['query'][_0x93f1('0x73')])return[];return db[_0x93f1('0x95')][_0x93f1('0x39')](_0x4c8672['toString'](),_0x708e2c);})[_0x93f1('0x28')](function(_0x2ff3f9){_0x159ffd[_0x93f1('0x96')]=_0x2ff3f9['length'];if(_0x159ffd[_0x93f1('0x96')]===0x0)return[];return db['sequelize'][_0x93f1('0x39')](_0x33f3e9['toString'](),_0x708e2c)[_0x93f1('0x28')](function(_0x5cb7d9){_0x4d63f0=_[_0x93f1('0x97')](_0x5cb7d9,'id');_0x708e2c=_[_0x93f1('0x98')](_0x708e2c,{'model':db[_0x93f1('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b7cdb['query']['fields']){_0x22e526[_0x93f1('0x3c')][_0x93f1('0x72')](function(_0x594974){_0x164b61['field']('i.'+_0x594974);});}else{_0x164b61[_0x93f1('0x46')](_0x93f1('0x8b'),_0x93f1('0x5e'));_0x164b61[_0x93f1('0x46')](_0x93f1('0x99'),'Account.key');_0x164b61[_0x93f1('0x46')]('a.mandatoryDisposition',_0x93f1('0x9a'));_0x164b61[_0x93f1('0x46')]('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',_0x93f1('0x9b'));_0x164b61[_0x93f1('0x46')]('i.*');_0x164b61[_0x93f1('0x46')]('c.firstName',_0x93f1('0x9c'));_0x164b61[_0x93f1('0x46')](_0x93f1('0x9d'),_0x93f1('0x9e'));_0x164b61[_0x93f1('0x46')]('c.email','Contact.email');_0x164b61[_0x93f1('0x46')](_0x93f1('0x9f'),'Contact.phone');_0x164b61['field'](_0x93f1('0xa0'),'Contact.mobile');_0x164b61[_0x93f1('0x46')]('c.fax',_0x93f1('0xa1'));_0x164b61[_0x93f1('0x46')]('o.fullname','Owner.fullname');_0x164b61[_0x93f1('0x46')](_0x93f1('0xa2'),_0x93f1('0xa3'));_0x164b61[_0x93f1('0x46')](_0x93f1('0xa4'),_0x93f1('0x30'));}if(_0x22e526[_0x93f1('0x41')])_0x164b61['limit'](_0x22e526[_0x93f1('0x41')]);if(_0x22e526['offset'])_0x164b61[_0x93f1('0x23')](_0x22e526['offset']);return db[_0x93f1('0x95')][_0x93f1('0x39')](_0x164b61[_0x93f1('0xa5')](),_0x708e2c);})[_0x93f1('0x28')](function(_0xc5510c){_0x15999d[_0x93f1('0x7c')](_0x93f1('0xa6'),_[_0x93f1('0x2f')](_0xc5510c,'id'));return db[_0x93f1('0x95')][_0x93f1('0x39')](_0x15999d[_0x93f1('0xa5')](),_0x708e2c)[_0x93f1('0x28')](function(_0x14d8a4){var _0x3eb974=_[_0x93f1('0xa7')](_0x14d8a4,'WhatsappInteractionId');var _0x1a9f5e=[];_0xc5510c[_0x93f1('0x72')](function(_0x54fcca){_0x1a9f5e[_0x93f1('0x31')](updateWhatsappInteraction(_0x54fcca,_0x4d63f0,_0x3eb974));});return BPromise[_0x93f1('0xa8')](_0x1a9f5e);});});})['then'](function(_0x57a99f){_0x159ffd[_0x93f1('0xa9')]=_0x57a99f;return _0x159ffd;})[_0x93f1('0x28')](respondWithFilteredResult(_0x35f23c,_0x22e526))[_0x93f1('0x32')](handleError(_0x35f23c,null));};exports['show']=function(_0xd2d531,_0xb81620){var _0x320708={'raw':![],'where':{'id':_0xd2d531[_0x93f1('0xaa')]['id']}},_0x55fa74={};_0x55fa74['model']=_[_0x93f1('0x3a')](db[_0x93f1('0x33')][_0x93f1('0x34')]);_0x55fa74[_0x93f1('0x39')]=_[_0x93f1('0x3a')](_0xd2d531[_0x93f1('0x39')]);_0x55fa74[_0x93f1('0x3b')]=_[_0x93f1('0x3d')](_0x55fa74[_0x93f1('0x38')],_0x55fa74[_0x93f1('0x39')]);_0x320708[_0x93f1('0x3c')]=_['intersection'](_0x55fa74[_0x93f1('0x38')],qs['fields'](_0xd2d531[_0x93f1('0x39')][_0x93f1('0x3e')]));_0x320708[_0x93f1('0x3c')]=_0x320708[_0x93f1('0x3c')][_0x93f1('0x3f')]?_0x320708[_0x93f1('0x3c')]:_0x55fa74['model'];if(_0xd2d531[_0x93f1('0x39')][_0x93f1('0xab')]){_0x320708['include']=[{'all':!![]}];}_0x320708=_['merge']({},_0x320708,_0xd2d531[_0x93f1('0xac')]);return db[_0x93f1('0x33')][_0x93f1('0x5d')](_0x320708)[_0x93f1('0x28')](handleEntityNotFound(_0xb81620,null))[_0x93f1('0x28')](respondWithResult(_0xb81620,null))[_0x93f1('0x32')](handleError(_0xb81620,null));};exports[_0x93f1('0xad')]=function(_0x1c6b0d,_0x372dac){return db[_0x93f1('0x33')][_0x93f1('0xad')](_0x1c6b0d[_0x93f1('0x6e')],{})[_0x93f1('0x28')](respondWithResult(_0x372dac,0xc9))[_0x93f1('0x32')](handleError(_0x372dac,null));};exports[_0x93f1('0x27')]=function(_0x1fd448,_0x55d7c1){if(_0x1fd448[_0x93f1('0x6e')]['id']){delete _0x1fd448[_0x93f1('0x6e')]['id'];}return db[_0x93f1('0x33')][_0x93f1('0x5d')]({'where':{'id':_0x1fd448[_0x93f1('0xaa')]['id']}})[_0x93f1('0x28')](handleEntityNotFound(_0x55d7c1,null))['then'](saveUpdates(_0x1fd448[_0x93f1('0x6e')],null))[_0x93f1('0x28')](respondWithResult(_0x55d7c1,null))[_0x93f1('0x32')](handleError(_0x55d7c1,null));};exports[_0x93f1('0xae')]=function(_0x5911c2,_0x296bd3){return db['WhatsappInteraction'][_0x93f1('0x5d')]({'where':{'id':_0x5911c2[_0x93f1('0xaa')]['id']}})[_0x93f1('0x28')](handleEntityNotFound(_0x296bd3,null))[_0x93f1('0x28')](removeEntity(_0x296bd3,null))[_0x93f1('0x32')](handleError(_0x296bd3,null));};exports[_0x93f1('0xaf')]=function(_0x50bedb,_0x261dea){return db[_0x93f1('0x33')]['describe']()[_0x93f1('0x28')](respondWithResult(_0x261dea,null))[_0x93f1('0x32')](handleError(_0x261dea,null));};exports[_0x93f1('0xb0')]=function(_0x31b8ad,_0x529e77,_0x25fe8a){return db['WhatsappMessage']['find']({'where':{'id':_0x31b8ad['params']['id']}})['then'](handleEntityNotFound(_0x529e77,null))[_0x93f1('0x28')](function(_0x599a09){if(_0x599a09){return _0x599a09[_0x93f1('0xb0')](_0x31b8ad[_0x93f1('0x6e')]['ids'],_[_0x93f1('0xb1')](_0x31b8ad[_0x93f1('0x6e')],[_0x93f1('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x529e77,null))[_0x93f1('0x32')](handleError(_0x529e77,null));};exports[_0x93f1('0xb3')]=function(_0x2ac43f,_0x1cefde,_0x1dbb0a){var _0x446a70={'raw':![],'where':{}};var _0x34c8d2={};var _0x20ac15={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x2ac43f[_0x93f1('0xaa')]['id']}})[_0x93f1('0x28')](handleEntityNotFound(_0x1cefde,null))[_0x93f1('0x28')](function(_0x2ae5e4){if(_0x2ae5e4){_0x34c8d2['model']=_[_0x93f1('0x3a')](db[_0x93f1('0xb4')]['rawAttributes']);_0x34c8d2[_0x93f1('0x39')]=_['keys'](_0x2ac43f['query']);_0x34c8d2['filters']=_['intersection'](_0x34c8d2['model'],_0x34c8d2[_0x93f1('0x39')]);_0x446a70['attributes']=_[_0x93f1('0x3d')](_0x34c8d2[_0x93f1('0x38')],qs['fields'](_0x2ac43f['query'][_0x93f1('0x3e')]));_0x446a70[_0x93f1('0x3c')]=_0x446a70[_0x93f1('0x3c')][_0x93f1('0x3f')]?_0x446a70[_0x93f1('0x3c')]:_0x34c8d2['model'];if(!_0x2ac43f['query'][_0x93f1('0xb5')](_0x93f1('0x40'))){_0x446a70['limit']=qs[_0x93f1('0x41')](_0x2ac43f[_0x93f1('0x39')]['limit']);_0x446a70['offset']=qs[_0x93f1('0x23')](_0x2ac43f[_0x93f1('0x39')][_0x93f1('0x23')]);}_0x446a70[_0x93f1('0x42')]=qs[_0x93f1('0x43')](_0x2ac43f[_0x93f1('0x39')]['sort']);_0x446a70[_0x93f1('0x7c')]=qs[_0x93f1('0x3b')](_['pick'](_0x2ac43f['query'],_0x34c8d2['filters']));_0x446a70[_0x93f1('0x7c')]['WhatsappInteractionId']=_0x2ae5e4['id'];if(_0x2ac43f[_0x93f1('0x39')][_0x93f1('0x82')]){_0x446a70[_0x93f1('0x7c')]=_['merge'](_0x446a70[_0x93f1('0x7c')],{'$or':_[_0x93f1('0x2f')](_0x446a70['attributes'],function(_0x2cf8bc){var _0x57e61f={};_0x57e61f[_0x2cf8bc]={'$like':'%'+_0x2ac43f[_0x93f1('0x39')][_0x93f1('0x82')]+'%'};return _0x57e61f;})});}if(_0x2ac43f[_0x93f1('0x39')][_0x93f1('0x77')]){var _0x5f091e=_0x2ac43f[_0x93f1('0x39')][_0x93f1('0x77')]['split'](',');var _0x41f68f={};_0x41f68f[_0x5f091e[0x0]]={'$gte':moment(_0x5f091e[0x1])[_0x93f1('0xb6')](_0x93f1('0xb7'))};_0x446a70[_0x93f1('0x7c')]=_['merge'](_0x446a70[_0x93f1('0x7c')],_0x41f68f);}_0x446a70=_[_0x93f1('0x98')]({},_0x446a70,_0x2ac43f[_0x93f1('0xac')]);return db[_0x93f1('0xb4')]['count']({'where':_0x446a70['where']})[_0x93f1('0x28')](function(_0x153c00){_0x20ac15['count']=_0x153c00;if(_0x2ac43f[_0x93f1('0x39')][_0x93f1('0xab')]){_0x446a70[_0x93f1('0xb8')]=[{'all':!![]}];}return db[_0x93f1('0xb4')][_0x93f1('0xb9')](_0x446a70);})['then'](function(_0x2817e1){_0x20ac15[_0x93f1('0xa9')]=_0x2817e1;return _0x20ac15;});}})[_0x93f1('0x28')](respondWithFilteredResult(_0x1cefde,_0x446a70))[_0x93f1('0x32')](handleError(_0x1cefde,null));};exports[_0x93f1('0xba')]=function(_0x2f6b7c,_0x4ea0e0,_0x52da5f){return db['WhatsappInteraction'][_0x93f1('0x5d')]({'where':{'id':_0x2f6b7c[_0x93f1('0xaa')]['id']}})[_0x93f1('0x28')](handleEntityNotFound(_0x4ea0e0,null))['then'](function(_0x5737c8){if(_0x5737c8){return _0x5737c8['setTags'](_0x2f6b7c[_0x93f1('0x6e')]['ids'],_[_0x93f1('0xb1')](_0x2f6b7c['body'],[_0x93f1('0xb2'),'id'])||{})[_0x93f1('0xbb')](function(){return db[_0x93f1('0x6a')][_0x93f1('0xb9')]({'attributes':['id',_0x93f1('0x2c'),'color'],'where':{'id':_0x2f6b7c['body'][_0x93f1('0xb2')]}});})[_0x93f1('0x28')](function(_0x1cca2e){socket[_0x93f1('0xbc')](_0x93f1('0xbd'),{'id':Number(_0x2f6b7c['params']['id']),'tags':_0x1cca2e||[]});return{'id':Number(_0x2f6b7c[_0x93f1('0xaa')]['id']),'tags':_0x1cca2e||[]};});}})[_0x93f1('0x28')](respondWithResult(_0x4ea0e0,null))[_0x93f1('0x32')](handleError(_0x4ea0e0,null));};exports[_0x93f1('0xbe')]=function(_0xd2ffbd,_0x161a72,_0xf7eb77){return db[_0x93f1('0x33')]['find']({'where':{'id':_0xd2ffbd[_0x93f1('0xaa')]['id']}})[_0x93f1('0x28')](handleEntityNotFound(_0x161a72,null))[_0x93f1('0x28')](function(_0x5b3ee4){if(_0x5b3ee4){return _0x5b3ee4[_0x93f1('0xbe')](_0xd2ffbd[_0x93f1('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x161a72,null))[_0x93f1('0x32')](handleError(_0x161a72,null));};exports[_0x93f1('0xbf')]=function(_0x3efdb6,_0x83b49e){var _0x1e0b7b=moment()[_0x93f1('0xc0')]()[_0x93f1('0xa5')]();var _0x2af993=path['join'](config[_0x93f1('0xc1')],_0x93f1('0xc2'),_0x93f1('0xc3'),_0x93f1('0xc4'));var _0x26c1ad=path[_0x93f1('0xc5')](config[_0x93f1('0xc1')],_0x93f1('0xc2'),_0x93f1('0xc3'),_0x93f1('0xc6'));var _0x1f0419=path[_0x93f1('0xc5')](_0x2af993,_0x1e0b7b);var _0x579541=util[_0x93f1('0xb6')](_0x93f1('0xc7'),_0x3efdb6[_0x93f1('0xaa')]['id'],_0x1e0b7b);var _0x35449a=path[_0x93f1('0xc5')](_0x2af993,_0x579541);var _0x3f13a7=[];_0x3f13a7[_0x93f1('0x31')]({'model':db['User'],'as':_0x93f1('0xc8'),'attributes':['id','fullname'],'raw':!![]});_0x3f13a7[_0x93f1('0x31')]({'model':db[_0x93f1('0xc9')],'as':_0x93f1('0x62'),'attributes':['id',_0x93f1('0xca'),_0x93f1('0xcb')],'raw':!![]});if(_0x3efdb6['query'][_0x93f1('0xc6')]){_0x3f13a7['push']({'model':db[_0x93f1('0xcc')],'as':_0x93f1('0xcc'),'raw':!![]});}var _0x548e26=[{'model':db[_0x93f1('0xb4')],'as':'Messages','attributes':['id','body',_0x93f1('0x76'),'direction',_0x93f1('0xcd'),_0x93f1('0x7e')],'include':_0x3f13a7}];_0x548e26[_0x93f1('0x31')]({'model':db['WhatsappAccount'],'as':_0x93f1('0xce'),'attributes':['id',_0x93f1('0x2c')]});_0x548e26[_0x93f1('0x31')]({'model':db[_0x93f1('0xc8')],'as':'Owner','attributes':['id',_0x93f1('0xcf')]});return db[_0x93f1('0x33')][_0x93f1('0x5d')]({'where':{'id':_0x3efdb6[_0x93f1('0xaa')]['id']},'include':_0x548e26})[_0x93f1('0x28')](handleEntityNotFound(_0x83b49e,null))[_0x93f1('0x28')](function(_0x451dab){if(_0x451dab){var _0x54f4e9=_0x451dab[_0x93f1('0xd0')]({'plain':!![]});fs['mkdirSync'](_0x1f0419);var _0xfc4496={'format':'A4','border':_0x93f1('0xd1'),'header':{'height':'40px','contents':{'first':_0x93f1('0xd2')}},'footer':{'height':'30px','contents':{'default':util[_0x93f1('0xb6')](_0x93f1('0xd3'),util[_0x93f1('0xb6')](_0x93f1('0xd4'),'Whatsapp',_0x54f4e9['id']),moment()[_0x93f1('0xb6')]('YYYY-MM-DD')[_0x93f1('0xa5')]())}}};var _0x26ddb3={'channel':'Whatsapp','account':_0x54f4e9[_0x93f1('0xce')]['name'],'agent':_0x54f4e9[_0x93f1('0xd5')]?_0x54f4e9[_0x93f1('0xd5')][_0x93f1('0xcf')]:_0x93f1('0xd6'),'createdAt':moment(_0x54f4e9[_0x93f1('0x76')])[_0x93f1('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x93f1('0xa5')](),'closedAt':_0x54f4e9[_0x93f1('0xd7')]?moment(_0x54f4e9['closedAt'])[_0x93f1('0xb6')](_0x93f1('0xb7'))[_0x93f1('0xa5')]():'','disposition':_0x54f4e9['disposition'],'messages':_(_0x54f4e9[_0x93f1('0xd8')])[_0x93f1('0x82')]({'secret':![]})[_0x93f1('0x2f')](function(_0x36e418){if(_0x36e418['Attachment']){var _0x47bae0=path[_0x93f1('0xc5')](_0x26c1ad,_0x36e418[_0x93f1('0xcc')]['basename']);if(fs[_0x93f1('0xd9')](_0x47bae0)){fs[_0x93f1('0xda')](_0x47bae0)[_0x93f1('0xdb')](fs[_0x93f1('0xdc')](path[_0x93f1('0xc5')](_0x1f0419,_0x36e418['Attachment'][_0x93f1('0xdd')])));}}return{'date':moment(_0x36e418[_0x93f1('0x76')])[_0x93f1('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x93f1('0xa5')](),'sender':_0x36e418['direction']===_0x93f1('0xde')?_0x36e418[_0x93f1('0xc8')]?_0x36e418[_0x93f1('0xc8')][_0x93f1('0xcf')]:_0x93f1('0xdf'):_0x36e418[_0x93f1('0x62')][_0x93f1('0xca')]+(_0x36e418['Contact'][_0x93f1('0xcb')]?'\x20'+_0x36e418[_0x93f1('0x62')][_0x93f1('0xcb')]:''),'body':_0x36e418['Attachment']?_0x36e418[_0x93f1('0xcc')][_0x93f1('0xdd')]:_0x36e418[_0x93f1('0x6e')],'direction':_0x36e418[_0x93f1('0xe0')]===_0x93f1('0xde')?'A':'C','secret':_0x36e418[_0x93f1('0xcd')],'read':_0x36e418[_0x93f1('0x7e')],'attachment':_0x36e418['Attachment']};})[_0x93f1('0x5f')]()};return ejs[_0x93f1('0xe1')](path['join'](config['root'],'server','views','downloadInteraction.html'),{'interaction':_0x26ddb3})[_0x93f1('0x28')](function(_0x5d076a){return new BPromise(function(_0x16cb0d,_0x3c21fc){pdf[_0x93f1('0xad')](_0x5d076a,_0xfc4496)['toFile'](path[_0x93f1('0xc5')](_0x1f0419,_0x93f1('0xe2')+_0x54f4e9['id']+'-'+_0x1e0b7b+_0x93f1('0xe3')),function(_0x25658a,_0x4a6415){if(_0x25658a)return _0x3c21fc(_0x25658a);_0x16cb0d(_0x4a6415);});});})[_0x93f1('0x28')](function(){return new BPromise(function(_0x5559a6,_0x8e0d4e){zipdir(_0x1f0419,{'saveTo':_0x35449a},function(_0x29d208,_0x37ad2a){if(_0x29d208)return _0x8e0d4e(_0x29d208);return _0x5559a6(_0x37ad2a);});})[_0x93f1('0x28')](function(){return new BPromise(function(_0x5983b4,_0x33a32b){rimraf(_0x1f0419,function(_0x3f637e){if(_0x3f637e)_0x33a32b(_0x3f637e);return _0x5983b4();});});})['then'](function(){return _0x83b49e[_0x93f1('0xbf')](_0x35449a,_0x579541,function(_0x439eff){if(_0x439eff){console['log'](_0x93f1('0xe4'),_0x439eff);}else{fs[_0x93f1('0xe5')](_0x35449a);}});});});}else{return _0x83b49e[_0x93f1('0x20')](0xc8);}})[_0x93f1('0x32')](handleError(_0x83b49e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index f695e93..15f2657 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 _0x9ddc=['map','findAll','emit','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','remove','getUsers','then','setDataValue'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9ddc,0x171));var _0xc9dd=function(_0x4743d3,_0x6735a0){_0x4743d3=_0x4743d3-0x0;var _0x1197f7=_0x9ddc[_0x4743d3];return _0x1197f7;};'use strict';var EventEmitter=require(_0xc9dd('0x0'));var WhatsappInteraction=require(_0xc9dd('0x1'))['db'][_0xc9dd('0x2')];var WhatsappMessage=require(_0xc9dd('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc9dd('0x3')](0x0);var events={'afterCreate':_0xc9dd('0x4'),'afterUpdate':'update','afterDestroy':_0xc9dd('0x5')};function emitEvent(_0x4157c8){return function(_0x25e0ae,_0x136820,_0x280fdd){_0x25e0ae[_0xc9dd('0x6')]({'attributes':['id'],'raw':!![]})[_0xc9dd('0x7')](function(_0x676a8){_0x25e0ae[_0xc9dd('0x8')]('Users',_0x676a8[_0xc9dd('0x9')](function(_0x32715c){return{'id':_0x32715c['id']};}));return WhatsappMessage[_0xc9dd('0xa')]({'where':{'WhatsappInteractionId':_0x25e0ae['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc9dd('0x7')](function(_0x294459){_0x25e0ae['setDataValue']('unreadMessages',_0x294459['length']);WhatsappInteractionEvents['emit'](_0x4157c8+':'+_0x25e0ae['id'],_0x25e0ae);WhatsappInteractionEvents[_0xc9dd('0xb')](_0x4157c8,_0x25e0ae);_0x280fdd(null);})['catch'](_0x280fdd(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xc9dd('0xc')](e,emitEvent(event));}}module[_0xc9dd('0xd')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x1d03=['catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','getUsers','then','setDataValue','Users','findAll','emit'];(function(_0x4f2d7e,_0x1a91b7){var _0x108784=function(_0x5508a9){while(--_0x5508a9){_0x4f2d7e['push'](_0x4f2d7e['shift']());}};_0x108784(++_0x1a91b7);}(_0x1d03,0x18a));var _0x31d0=function(_0x1de81e,_0x333335){_0x1de81e=_0x1de81e-0x0;var _0x2aebe0=_0x1d03[_0x1de81e];return _0x2aebe0;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x31d0('0x0'))['db'][_0x31d0('0x1')];var WhatsappMessage=require(_0x31d0('0x0'))['db'][_0x31d0('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x31d0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x31d0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x15b472){return function(_0x35c7cf,_0x5c7760,_0x1f4e58){_0x35c7cf[_0x31d0('0x5')]({'attributes':['id'],'raw':!![]})[_0x31d0('0x6')](function(_0x3fabcb){_0x35c7cf[_0x31d0('0x7')](_0x31d0('0x8'),_0x3fabcb['map'](function(_0x447dc9){return{'id':_0x447dc9['id']};}));return WhatsappMessage[_0x31d0('0x9')]({'where':{'WhatsappInteractionId':_0x35c7cf['id'],'direction':'in','read':![]},'raw':!![]});})[_0x31d0('0x6')](function(_0x32a15a){_0x35c7cf[_0x31d0('0x7')]('unreadMessages',_0x32a15a['length']);WhatsappInteractionEvents[_0x31d0('0xa')](_0x15b472+':'+_0x35c7cf['id'],_0x35c7cf);WhatsappInteractionEvents['emit'](_0x15b472,_0x35c7cf);_0x1f4e58(null);})[_0x31d0('0xb')](_0x1f4e58(null));};}for(var e in events){if(events[_0x31d0('0xc')](e)){var event=events[e];WhatsappInteraction[_0x31d0('0xd')](e,emitEvent(event));}}module[_0x31d0('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 910cf62..c0a92e6 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 _0x2f59=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closed','format'];(function(_0x458775,_0x523411){var _0x48eb06=function(_0x98a4ac){while(--_0x98a4ac){_0x458775['push'](_0x458775['shift']());}};_0x48eb06(++_0x523411);}(_0x2f59,0x96));var _0x92f5=function(_0xfbc931,_0x2fb6bc){_0xfbc931=_0xfbc931-0x0;var _0x4e11f8=_0x2f59[_0xfbc931];return _0x4e11f8;};'use strict';var _=require(_0x92f5('0x0'));var util=require(_0x92f5('0x1'));var logger=require('../../config/logger')(_0x92f5('0x2'));var moment=require(_0x92f5('0x3'));var BPromise=require(_0x92f5('0x4'));var rp=require(_0x92f5('0x5'));var fs=require('fs');var path=require(_0x92f5('0x6'));var rimraf=require(_0x92f5('0x7'));var config=require('../../config/environment');var attributes=require(_0x92f5('0x8'));module[_0x92f5('0x9')]=function(_0x2ba22c,_0x27a8c3){return _0x2ba22c[_0x92f5('0xa')](_0x92f5('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30ec69,_0x39ab1b,_0x14f835){if(_0x30ec69[_0x92f5('0xc')](_0x92f5('0xd'))){_0x30ec69['closedAt']=moment()[_0x92f5('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x14f835(null,_0x30ec69);}}});}; \ No newline at end of file +var _0xc35a=['path','rimraf','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','request-promise'];(function(_0x104da6,_0x395486){var _0x218923=function(_0x5984af){while(--_0x5984af){_0x104da6['push'](_0x104da6['shift']());}};_0x218923(++_0x395486);}(_0xc35a,0x114));var _0xac35=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc35a[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xac35('0x0'));var util=require('util');var logger=require(_0xac35('0x1'))(_0xac35('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xac35('0x3'));var fs=require('fs');var path=require(_0xac35('0x4'));var rimraf=require(_0xac35('0x5'));var config=require('../../config/environment');var attributes=require(_0xac35('0x6'));module['exports']=function(_0x2fb6e7,_0x289bf3){return _0x2fb6e7[_0xac35('0x7')](_0xac35('0x8'),attributes,{'tableName':_0xac35('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ad697,_0x46103c,_0x470b02){if(_0x2ad697[_0xac35('0xa')](_0xac35('0xb'))){_0x2ad697['closedAt']=moment()[_0xac35('0xc')](_0xac35('0xd'));}_0x470b02(null,_0x2ad697);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 9cabeaf..a3400fd 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 _0x21a6=['redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','AddTagsToWhatsappInteraction','find','addTags','ids','omit','AddTags','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xce4c29,_0x4029e5){var _0x3e7922=function(_0x17c742){while(--_0x17c742){_0xce4c29['push'](_0xce4c29['shift']());}};_0x3e7922(++_0x4029e5);}(_0x21a6,0x1c4));var _0x621a=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x21a6[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x621a('0x0'));var util=require(_0x621a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x621a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x621a('0x3'))['db'];var utils=require(_0x621a('0x4'));var logger=require(_0x621a('0x5'))(_0x621a('0x6'));var config=require(_0x621a('0x7'));var jayson=require(_0x621a('0x8'));var client=jayson[_0x621a('0x9')]['http']({'port':0x232a});config[_0x621a('0xa')]=_[_0x621a('0xb')](config[_0x621a('0xa')],{'host':_0x621a('0xc'),'port':0x18eb});var socket=require(_0x621a('0xd'))(new Redis(config['redis']));require(_0x621a('0xe'))[_0x621a('0xf')](socket);function respondWithRpcPromise(_0x4b6ef2,_0xfbe0db,_0x1f83b0){return new BPromise(function(_0x1cdda2,_0x2c7151){return client[_0x621a('0x10')](_0x4b6ef2,_0x1f83b0)[_0x621a('0x11')](function(_0x47fd15){logger['info'](_0x621a('0x12'),_0xfbe0db,'request\x20sent');logger[_0x621a('0x13')](_0x621a('0x14'),_0xfbe0db,_0x621a('0x15'),JSON[_0x621a('0x16')](_0x47fd15));if(_0x47fd15[_0x621a('0x17')]){if(_0x47fd15[_0x621a('0x17')]['code']===0x1f4){logger[_0x621a('0x17')](_0x621a('0x12'),_0xfbe0db,_0x47fd15[_0x621a('0x17')][_0x621a('0x18')]);return _0x2c7151(_0x47fd15[_0x621a('0x17')]['message']);}logger['error'](_0x621a('0x12'),_0xfbe0db,_0x47fd15[_0x621a('0x17')][_0x621a('0x18')]);return _0x1cdda2(_0x47fd15[_0x621a('0x17')][_0x621a('0x18')]);}else{logger[_0x621a('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0xfbe0db,_0x621a('0x15'));_0x1cdda2(_0x47fd15[_0x621a('0x1a')][_0x621a('0x18')]);}})[_0x621a('0x1b')](function(_0x2ef751){logger['error'](_0x621a('0x12'),_0xfbe0db,_0x2ef751);_0x2c7151(_0x2ef751);});});}exports[_0x621a('0x1c')]=function(_0x1c7935){var _0x438d1c=this;return new Promise(function(_0x27579f,_0x32a7e1){return db[_0x621a('0x1d')][_0x621a('0x1e')](_0x1c7935[_0x621a('0x1f')],{'raw':_0x1c7935[_0x621a('0x20')]?_0x1c7935[_0x621a('0x20')][_0x621a('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c7935['options']?_0x1c7935[_0x621a('0x20')][_0x621a('0x22')]||null:null,'attributes':_0x1c7935[_0x621a('0x20')]?_0x1c7935[_0x621a('0x20')][_0x621a('0x23')]||null:null,'limit':_0x1c7935['options']?_0x1c7935[_0x621a('0x20')]['limit']||null:null})[_0x621a('0x11')](function(_0x19fcd9){logger[_0x621a('0x19')]('UpdateWhatsappInteraction',_0x1c7935);logger[_0x621a('0x13')](_0x621a('0x1c'),_0x1c7935,JSON[_0x621a('0x16')](_0x19fcd9));_0x27579f(_0x19fcd9);})['catch'](function(_0x2bfd00){logger[_0x621a('0x17')](_0x621a('0x1c'),_0x2bfd00[_0x621a('0x18')],_0x1c7935);_0x32a7e1(_0x438d1c[_0x621a('0x17')](0x1f4,_0x2bfd00[_0x621a('0x18')]));});});};exports[_0x621a('0x24')]=function(_0x43f491){return new Promise(function(_0x593ea2,_0x318326){return db['WhatsappInteraction'][_0x621a('0x25')]({'where':_0x43f491[_0x621a('0x20')]?_0x43f491[_0x621a('0x20')][_0x621a('0x22')]||null:null})[_0x621a('0x11')](function(_0x49aaf2){if(_0x49aaf2){return _0x49aaf2[_0x621a('0x26')](_0x43f491[_0x621a('0x1f')][_0x621a('0x27')],_[_0x621a('0x28')](_0x43f491[_0x621a('0x1f')],[_0x621a('0x27'),'id'])||{});}})['spread'](function(_0x5ac564){logger[_0x621a('0x19')](_0x621a('0x29'),_0x43f491);logger[_0x621a('0x13')](_0x621a('0x29'),_0x43f491,JSON[_0x621a('0x16')](_0x5ac564));_0x593ea2(_0x5ac564);})[_0x621a('0x1b')](function(_0x5457fe){logger['error']('AddTags',_0x5457fe[_0x621a('0x18')],_0x43f491);_0x318326(_this[_0x621a('0x17')](0x1f4,_0x5457fe['message']));});});}; \ No newline at end of file +var _0x219f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','debug','stringify','AddTagsToWhatsappInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment'];(function(_0x1e91eb,_0x5829a3){var _0x2af75a=function(_0x1815d1){while(--_0x1815d1){_0x1e91eb['push'](_0x1e91eb['shift']());}};_0x2af75a(++_0x5829a3);}(_0x219f,0x1ea));var _0xf219=function(_0x2fc748,_0x41696e){_0x2fc748=_0x2fc748-0x0;var _0x32d4f3=_0x219f[_0x2fc748];return _0x32d4f3;};'use strict';var _=require(_0xf219('0x0'));var util=require('util');var moment=require(_0xf219('0x1'));var BPromise=require(_0xf219('0x2'));var rs=require(_0xf219('0x3'));var fs=require('fs');var Redis=require(_0xf219('0x4'));var db=require(_0xf219('0x5'))['db'];var utils=require(_0xf219('0x6'));var logger=require(_0xf219('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf219('0x8'));var client=jayson['client'][_0xf219('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf219('0xa')],{'host':_0xf219('0xb'),'port':0x18eb});var socket=require(_0xf219('0xc'))(new Redis(config[_0xf219('0xa')]));require(_0xf219('0xd'))[_0xf219('0xe')](socket);function respondWithRpcPromise(_0x2467eb,_0xe1750a,_0x58b1cc){return new BPromise(function(_0x435cac,_0x51c017){return client[_0xf219('0xf')](_0x2467eb,_0x58b1cc)[_0xf219('0x10')](function(_0x4410f8){logger[_0xf219('0x11')](_0xf219('0x12'),_0xe1750a,_0xf219('0x13'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xe1750a,_0xf219('0x13'),JSON['stringify'](_0x4410f8));if(_0x4410f8[_0xf219('0x14')]){if(_0x4410f8[_0xf219('0x14')][_0xf219('0x15')]===0x1f4){logger['error'](_0xf219('0x12'),_0xe1750a,_0x4410f8[_0xf219('0x14')][_0xf219('0x16')]);return _0x51c017(_0x4410f8['error'][_0xf219('0x16')]);}logger[_0xf219('0x14')](_0xf219('0x12'),_0xe1750a,_0x4410f8['error'][_0xf219('0x16')]);return _0x435cac(_0x4410f8['error']['message']);}else{logger['info'](_0xf219('0x12'),_0xe1750a,_0xf219('0x13'));_0x435cac(_0x4410f8['result'][_0xf219('0x16')]);}})[_0xf219('0x17')](function(_0x41fbe9){logger[_0xf219('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0xe1750a,_0x41fbe9);_0x51c017(_0x41fbe9);});});}exports[_0xf219('0x18')]=function(_0x2450fe){var _0x1ac8ee=this;return new Promise(function(_0x5054bd,_0x30d814){return db[_0xf219('0x19')][_0xf219('0x1a')](_0x2450fe[_0xf219('0x1b')],{'raw':_0x2450fe[_0xf219('0x1c')]?_0x2450fe[_0xf219('0x1c')][_0xf219('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2450fe[_0xf219('0x1c')]?_0x2450fe[_0xf219('0x1c')][_0xf219('0x1e')]||null:null,'attributes':_0x2450fe['options']?_0x2450fe[_0xf219('0x1c')]['attributes']||null:null,'limit':_0x2450fe[_0xf219('0x1c')]?_0x2450fe[_0xf219('0x1c')][_0xf219('0x1f')]||null:null})[_0xf219('0x10')](function(_0x491012){logger[_0xf219('0x11')](_0xf219('0x18'),_0x2450fe);logger[_0xf219('0x20')](_0xf219('0x18'),_0x2450fe,JSON[_0xf219('0x21')](_0x491012));_0x5054bd(_0x491012);})[_0xf219('0x17')](function(_0x14f27c){logger[_0xf219('0x14')]('UpdateWhatsappInteraction',_0x14f27c[_0xf219('0x16')],_0x2450fe);_0x30d814(_0x1ac8ee[_0xf219('0x14')](0x1f4,_0x14f27c[_0xf219('0x16')]));});});};exports[_0xf219('0x22')]=function(_0x5b299d){return new Promise(function(_0x518acd,_0x1ef123){return db[_0xf219('0x19')][_0xf219('0x23')]({'where':_0x5b299d[_0xf219('0x1c')]?_0x5b299d[_0xf219('0x1c')][_0xf219('0x1e')]||null:null})[_0xf219('0x10')](function(_0x119101){if(_0x119101){return _0x119101[_0xf219('0x24')](_0x5b299d[_0xf219('0x1b')]['ids'],_[_0xf219('0x25')](_0x5b299d[_0xf219('0x1b')],[_0xf219('0x26'),'id'])||{});}})[_0xf219('0x27')](function(_0x243820){logger['info']('AddTags',_0x5b299d);logger[_0xf219('0x20')](_0xf219('0x28'),_0x5b299d,JSON[_0xf219('0x21')](_0x243820));_0x518acd(_0x243820);})[_0xf219('0x17')](function(_0x1b9f0d){logger['error'](_0xf219('0x28'),_0x1b9f0d[_0xf219('0x16')],_0x5b299d);_0x1ef123(_this['error'](0x1f4,_0x1b9f0d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 8d8f49e..b2adfad 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 _0x0f5e=['removeListener','register','length','save','remove','update','emit'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x0f5e,0x184));var _0xe0f5=function(_0x569bd0,_0x4766e){_0x569bd0=_0x569bd0-0x0;var _0x42c0fc=_0x0f5e[_0x569bd0];return _0x42c0fc;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xe0f5('0x0'),_0xe0f5('0x1'),_0xe0f5('0x2')];function createListener(_0x1acaa0,_0x3a5a06){return function(_0x3946ea){_0x3a5a06[_0xe0f5('0x3')](_0x1acaa0,_0x3946ea);};}function removeListener(_0x5616e5,_0x39d82d){return function(){WhatsappInteractionEvents[_0xe0f5('0x4')](_0x5616e5,_0x39d82d);};}exports[_0xe0f5('0x5')]=function(_0x7f38d7){for(var _0x2a17ba=0x0,_0x5c3ea5=events[_0xe0f5('0x6')];_0x2a17ba<_0x5c3ea5;_0x2a17ba++){var _0x1c5599=events[_0x2a17ba];var _0x4b8272=createListener('whatsappInteraction:'+_0x1c5599,_0x7f38d7);WhatsappInteractionEvents['on'](_0x1c5599,_0x4b8272);}}; \ No newline at end of file +var _0x95db=['remove','update','emit','removeListener','register','length','save'];(function(_0x1787d3,_0x371fba){var _0x22d1f7=function(_0x338f87){while(--_0x338f87){_0x1787d3['push'](_0x1787d3['shift']());}};_0x22d1f7(++_0x371fba);}(_0x95db,0xdf));var _0xb95d=function(_0x329e2e,_0x2f2310){_0x329e2e=_0x329e2e-0x0;var _0x19c77f=_0x95db[_0x329e2e];return _0x19c77f;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xb95d('0x0'),_0xb95d('0x1'),_0xb95d('0x2')];function createListener(_0x1640b8,_0x425d73){return function(_0x2ac19a){_0x425d73[_0xb95d('0x3')](_0x1640b8,_0x2ac19a);};}function removeListener(_0x22177b,_0x46caaa){return function(){WhatsappInteractionEvents[_0xb95d('0x4')](_0x22177b,_0x46caaa);};}exports[_0xb95d('0x5')]=function(_0x5101b3){for(var _0x271f5a=0x0,_0x1a3e66=events[_0xb95d('0x6')];_0x271f5a<_0x1a3e66;_0x271f5a++){var _0x420d45=events[_0x271f5a];var _0x4631a4=createListener('whatsappInteraction:'+_0x420d45,_0x5101b3);WhatsappInteractionEvents['on'](_0x420d45,_0x4631a4);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 44fed83..ab72412 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 _0x2d17=['describe','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated'];(function(_0x4467c4,_0x582fbd){var _0x3085ec=function(_0x418196){while(--_0x418196){_0x4467c4['push'](_0x4467c4['shift']());}};_0x3085ec(++_0x582fbd);}(_0x2d17,0x17e));var _0x72d1=function(_0x495320,_0x54e457){_0x495320=_0x495320-0x0;var _0x2d4e9d=_0x2d17[_0x495320];return _0x2d4e9d;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var fs_extra=require(_0x72d1('0x4'));var auth=require(_0x72d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72d1('0x6'));var controller=require('./whatsappMessage.controller');router[_0x72d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x72d1('0x8')]);router[_0x72d1('0x7')]('/describe',auth[_0x72d1('0x9')](),controller[_0x72d1('0xa')]);router[_0x72d1('0x7')]('/:id',auth[_0x72d1('0x9')](),controller[_0x72d1('0xb')]);router[_0x72d1('0xc')]('/',auth['isAuthenticated'](),interaction[_0x72d1('0xd')](_0x72d1('0xe'),_0x72d1('0xf')),controller[_0x72d1('0x10')]);router[_0x72d1('0xc')](_0x72d1('0x11'),controller[_0x72d1('0x12')]);router[_0x72d1('0x13')](_0x72d1('0x14'),auth[_0x72d1('0x9')](),controller['update']);router[_0x72d1('0x13')](_0x72d1('0x15'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x16')]);router[_0x72d1('0x13')](_0x72d1('0x17'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x18')]);router[_0x72d1('0x19')](_0x72d1('0x14'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x1a')]);module[_0x72d1('0x1b')]=router; \ No newline at end of file +var _0x8d0e=['/:id','post','tracked','create','/:id/status','status','put','update','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x10628d,_0x5cf0d7){_0x10628d=_0x10628d-0x0;var _0x423b86=_0x8d0e[_0x10628d];return _0x423b86;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8d0('0xa')]);router[_0xe8d0('0xb')](_0xe8d0('0xc'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0xe')]);router[_0xe8d0('0xb')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller['show']);router[_0xe8d0('0x10')]('/',auth[_0xe8d0('0xd')](),interaction[_0xe8d0('0x11')]('whatsapp','whatsappmessage:create'),controller[_0xe8d0('0x12')]);router[_0xe8d0('0x10')](_0xe8d0('0x13'),controller[_0xe8d0('0x14')]);router[_0xe8d0('0x15')](_0xe8d0('0xf'),auth['isAuthenticated'](),controller[_0xe8d0('0x16')]);router[_0xe8d0('0x15')]('/:id/accept',auth[_0xe8d0('0xd')](),controller['accept']);router['put'](_0xe8d0('0x17'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x18')]);router[_0xe8d0('0x19')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller['destroy']);module[_0xe8d0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 6835d2d..0dbf4df 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 _0x2f16=['sequelize','exports','TEXT','medium','BOOLEAN','out','STRING','DATE'];(function(_0x2b7b9d,_0x89a529){var _0x57e721=function(_0x3ee189){while(--_0x3ee189){_0x2b7b9d['push'](_0x2b7b9d['shift']());}};_0x57e721(++_0x89a529);}(_0x2f16,0x178));var _0x62f1=function(_0x21e6ef,_0x54469c){_0x21e6ef=_0x21e6ef-0x0;var _0x12c919=_0x2f16[_0x21e6ef];return _0x12c919;};'use strict';var Sequelize=require(_0x62f1('0x0'));module[_0x62f1('0x1')]={'body':{'type':Sequelize[_0x62f1('0x2')](_0x62f1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x62f1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x62f1('0x5')),'defaultValue':_0x62f1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x62f1('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x62f1('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x62f1('0x6')]},'providerResponse':{'type':Sequelize[_0x62f1('0x2')]}}; \ No newline at end of file +var _0x5c14=['exports','TEXT','BOOLEAN','out','STRING','DATE','sequelize'];(function(_0x435619,_0x359323){var _0x1a86d2=function(_0x2769c4){while(--_0x2769c4){_0x435619['push'](_0x435619['shift']());}};_0x1a86d2(++_0x359323);}(_0x5c14,0xed));var _0x45c1=function(_0x259dbe,_0x1cb9f4){_0x259dbe=_0x259dbe-0x0;var _0x2e0f46=_0x5c14[_0x259dbe];return _0x2e0f46;};'use strict';var Sequelize=require(_0x45c1('0x0'));module[_0x45c1('0x1')]={'body':{'type':Sequelize[_0x45c1('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x45c1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x45c1('0x4')),'defaultValue':_0x45c1('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x45c1('0x5')](0xbe)},'phone':{'type':Sequelize[_0x45c1('0x5')]},'readAt':{'type':Sequelize[_0x45c1('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 6e6177e..525c382 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 _0x74a1=['sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','WhatsappMessage','findAll','rows','show','includeAll','find','create','body','params','accept','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectmessage','WhatsappAccountId','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x39f4b7,_0x4d299e){var _0x3d3dc2=function(_0x15c21d){while(--_0x15c21d){_0x39f4b7['push'](_0x39f4b7['shift']());}};_0x3d3dc2(++_0x4d299e);}(_0x74a1,0x16e));var _0x174a=function(_0x4a8893,_0x38f6ee){_0x4a8893=_0x4a8893-0x0;var _0x2b6e06=_0x74a1[_0x4a8893];return _0x2b6e06;};'use strict';var pdf=require(_0x174a('0x0'));var emlformat=require(_0x174a('0x1'));var rimraf=require(_0x174a('0x2'));var zipdir=require(_0x174a('0x3'));var jsonpatch=require(_0x174a('0x4'));var rp=require(_0x174a('0x5'));var moment=require(_0x174a('0x6'));var BPromise=require(_0x174a('0x7'));var Mustache=require('mustache');var util=require(_0x174a('0x8'));var path=require('path');var sox=require(_0x174a('0x9'));var csv=require(_0x174a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x174a('0xb'));var crypto=require('crypto');var jsforce=require(_0x174a('0xc'));var deskjs=require(_0x174a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x174a('0xe'));var Papa=require(_0x174a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x174a('0x10'));var as=require(_0x174a('0x11'));var hardwareService=require(_0x174a('0x12'));var logger=require('../../config/logger')(_0x174a('0x13'));var utils=require('../../config/utils');var config=require(_0x174a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x174a('0x15'))['db'];config['redis']=_['defaults'](config[_0x174a('0x16')],{'host':_0x174a('0x17'),'port':0x18eb});var socket=require(_0x174a('0x18'))(new Redis(config['redis']));require(_0x174a('0x19'))[_0x174a('0x1a')](socket);var jayson=require(_0x174a('0x1b'));var client=jayson[_0x174a('0x1c')][_0x174a('0x1d')]({'port':0x232c});var client9002=jayson[_0x174a('0x1c')][_0x174a('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x9304ce,_0x10456a,_0x5ddb10,_0x3ca4f6){return new BPromise(function(_0xa1de5f,_0x12fc6a){var _0x378bb7=_0x3ca4f6||client;return _0x378bb7[_0x174a('0x1e')](_0x9304ce,_0x5ddb10)[_0x174a('0x1f')](function(_0x53c3d1){logger[_0x174a('0x20')](_0x174a('0x21'),_0x10456a,'request\x20sent');logger[_0x174a('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x10456a,_0x174a('0x23'),JSON[_0x174a('0x24')](_0x53c3d1));if(_0x53c3d1[_0x174a('0x25')]){if(_0x53c3d1['error'][_0x174a('0x26')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x10456a,_0x53c3d1['error'][_0x174a('0x27')]);return _0x12fc6a(_0x53c3d1['error']['message']);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x10456a,_0x53c3d1['error']['message']);return _0xa1de5f(_0x53c3d1[_0x174a('0x25')][_0x174a('0x27')]);}else{logger[_0x174a('0x20')](_0x174a('0x21'),_0x10456a,_0x174a('0x23'));_0xa1de5f(_0x53c3d1[_0x174a('0x28')][_0x174a('0x27')]);}})[_0x174a('0x29')](function(_0x1d28f5){logger[_0x174a('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x10456a,_0x1d28f5);_0x12fc6a(_0x1d28f5);});});}function respondWithStatusCode(_0x200b3b,_0x29c83a){_0x29c83a=_0x29c83a||0xcc;return function(_0x43cd41){if(_0x43cd41){return _0x200b3b[_0x174a('0x2a')](_0x29c83a);}return _0x200b3b[_0x174a('0x2b')](_0x29c83a)[_0x174a('0x2c')]();};}function respondWithResult(_0x96ae3c,_0x4af617){_0x4af617=_0x4af617||0xc8;return function(_0x2a9979){if(_0x2a9979){return _0x96ae3c[_0x174a('0x2b')](_0x4af617)['json'](_0x2a9979);}};}function respondWithFilteredResult(_0x571e36,_0x30d78e){return function(_0x53bbd2){if(_0x53bbd2){var _0x3472b8=_0x53bbd2[_0x174a('0x2d')],_0x1448f5=_0x30d78e[_0x174a('0x2e')],_0x18152d=_0x30d78e[_0x174a('0x2e')]+_0x30d78e[_0x174a('0x2f')],_0xaa38d;if(_0x18152d>=_0x3472b8){_0x18152d=_0x3472b8;_0xaa38d=0xc8;}else{_0xaa38d=0xce;}_0x571e36[_0x174a('0x2b')](_0xaa38d);return _0x571e36[_0x174a('0x30')](_0x174a('0x31'),_0x1448f5+'-'+_0x18152d+'/'+_0x3472b8)[_0x174a('0x32')](_0x53bbd2);}return null;};}function patchUpdates(_0x5106f8){return function(_0x3bc8ce){try{jsonpatch[_0x174a('0x33')](_0x3bc8ce,_0x5106f8,!![]);}catch(_0x2eafbc){return BPromise['reject'](_0x2eafbc);}return _0x3bc8ce[_0x174a('0x34')]();};}function saveUpdates(_0x453257,_0x5b54bc){return function(_0x18460f){if(_0x18460f){return _0x18460f[_0x174a('0x35')](_0x453257)[_0x174a('0x1f')](function(_0x20b93a){return _0x20b93a;});}return null;};}function removeEntity(_0x3a8202,_0x1adef8){return function(_0x39d39a){if(_0x39d39a){return _0x39d39a[_0x174a('0x36')]()['then'](function(){_0x3a8202[_0x174a('0x2b')](0xcc)[_0x174a('0x2c')]();});}};}function handleEntityNotFound(_0x4294b9,_0x3c0568){return function(_0x5af3d7){if(!_0x5af3d7){_0x4294b9[_0x174a('0x2a')](0x194);}return _0x5af3d7;};}function handleError(_0x2a911c,_0x236235){_0x236235=_0x236235||0x1f4;return function(_0x55c070){logger[_0x174a('0x25')](_0x55c070[_0x174a('0x37')]);if(_0x55c070[_0x174a('0x38')]){delete _0x55c070[_0x174a('0x38')];}_0x2a911c['status'](_0x236235)[_0x174a('0x39')](_0x55c070);};}exports[_0x174a('0x3a')]=function(_0x5dd675,_0x2428ea){var _0x22eb85={},_0xc84d5c={},_0x543cf9={'count':0x0,'rows':[]};var _0x4ddfb5=_['map'](db['WhatsappMessage'][_0x174a('0x3b')],function(_0x457724){return{'name':_0x457724[_0x174a('0x3c')],'type':_0x457724[_0x174a('0x3d')]['key']};});_0xc84d5c[_0x174a('0x3e')]=_[_0x174a('0x3f')](_0x4ddfb5,_0x174a('0x38'));_0xc84d5c[_0x174a('0x40')]=_[_0x174a('0x41')](_0x5dd675[_0x174a('0x40')]);_0xc84d5c[_0x174a('0x42')]=_[_0x174a('0x43')](_0xc84d5c[_0x174a('0x3e')],_0xc84d5c[_0x174a('0x40')]);_0x22eb85[_0x174a('0x44')]=_[_0x174a('0x43')](_0xc84d5c[_0x174a('0x3e')],qs[_0x174a('0x45')](_0x5dd675[_0x174a('0x40')][_0x174a('0x45')]));_0x22eb85[_0x174a('0x44')]=_0x22eb85['attributes'][_0x174a('0x46')]?_0x22eb85[_0x174a('0x44')]:_0xc84d5c[_0x174a('0x3e')];if(!_0x5dd675[_0x174a('0x40')][_0x174a('0x47')](_0x174a('0x48'))){_0x22eb85[_0x174a('0x2f')]=qs[_0x174a('0x2f')](_0x5dd675['query'][_0x174a('0x2f')]);_0x22eb85[_0x174a('0x2e')]=qs['offset'](_0x5dd675[_0x174a('0x40')]['offset']);}_0x22eb85[_0x174a('0x49')]=qs[_0x174a('0x4a')](_0x5dd675[_0x174a('0x40')][_0x174a('0x4a')]);_0x22eb85[_0x174a('0x4b')]=qs[_0x174a('0x42')](_[_0x174a('0x4c')](_0x5dd675[_0x174a('0x40')],_0xc84d5c[_0x174a('0x42')]),_0x4ddfb5);if(_0x5dd675[_0x174a('0x40')]['filter']){_0x22eb85[_0x174a('0x4b')]=_[_0x174a('0x4d')](_0x22eb85[_0x174a('0x4b')],{'$or':_['map'](_0x4ddfb5,function(_0x47951f){if(_0x47951f[_0x174a('0x3d')]!==_0x174a('0x4e')){var _0x307419={};_0x307419[_0x47951f[_0x174a('0x38')]]={'$like':'%'+_0x5dd675[_0x174a('0x40')][_0x174a('0x4f')]+'%'};return _0x307419;}})});}_0x22eb85=_['merge']({},_0x22eb85,_0x5dd675[_0x174a('0x50')]);var _0x3c5e74={'where':_0x22eb85[_0x174a('0x4b')]};return db[_0x174a('0x51')][_0x174a('0x2d')](_0x3c5e74)[_0x174a('0x1f')](function(_0x28dcb0){_0x543cf9[_0x174a('0x2d')]=_0x28dcb0;if(_0x5dd675[_0x174a('0x40')]['includeAll']){_0x22eb85['include']=[{'all':!![]}];}return db[_0x174a('0x51')][_0x174a('0x52')](_0x22eb85);})[_0x174a('0x1f')](function(_0x418e35){_0x543cf9[_0x174a('0x53')]=_0x418e35;return _0x543cf9;})['then'](respondWithFilteredResult(_0x2428ea,_0x22eb85))[_0x174a('0x29')](handleError(_0x2428ea,null));};exports[_0x174a('0x54')]=function(_0x7268d2,_0x2f7ce1){var _0x4b5da1={'raw':!![],'where':{'id':_0x7268d2['params']['id']}},_0x358858={};_0x358858['model']=_['keys'](db[_0x174a('0x51')][_0x174a('0x3b')]);_0x358858[_0x174a('0x40')]=_['keys'](_0x7268d2[_0x174a('0x40')]);_0x358858[_0x174a('0x42')]=_['intersection'](_0x358858['model'],_0x358858[_0x174a('0x40')]);_0x4b5da1[_0x174a('0x44')]=_[_0x174a('0x43')](_0x358858[_0x174a('0x3e')],qs[_0x174a('0x45')](_0x7268d2[_0x174a('0x40')][_0x174a('0x45')]));_0x4b5da1[_0x174a('0x44')]=_0x4b5da1[_0x174a('0x44')][_0x174a('0x46')]?_0x4b5da1[_0x174a('0x44')]:_0x358858[_0x174a('0x3e')];if(_0x7268d2['query'][_0x174a('0x55')]){_0x4b5da1['include']=[{'all':!![]}];}_0x4b5da1=_[_0x174a('0x4d')]({},_0x4b5da1,_0x7268d2[_0x174a('0x50')]);return db['WhatsappMessage'][_0x174a('0x56')](_0x4b5da1)['then'](handleEntityNotFound(_0x2f7ce1,null))[_0x174a('0x1f')](respondWithResult(_0x2f7ce1,null))['catch'](handleError(_0x2f7ce1,null));};exports[_0x174a('0x57')]=function(_0x62018a,_0x8e12c3){return db[_0x174a('0x51')][_0x174a('0x57')](_0x62018a[_0x174a('0x58')],{})[_0x174a('0x1f')](respondWithResult(_0x8e12c3,0xc9))[_0x174a('0x29')](handleError(_0x8e12c3,null));};exports[_0x174a('0x35')]=function(_0x4b11ef,_0x7a434b){if(_0x4b11ef[_0x174a('0x58')]['id']){delete _0x4b11ef[_0x174a('0x58')]['id'];}return db[_0x174a('0x51')][_0x174a('0x56')]({'where':{'id':_0x4b11ef[_0x174a('0x59')]['id']}})[_0x174a('0x1f')](handleEntityNotFound(_0x7a434b,null))[_0x174a('0x1f')](saveUpdates(_0x4b11ef['body'],null))['then'](respondWithResult(_0x7a434b,null))[_0x174a('0x29')](handleError(_0x7a434b,null));};exports[_0x174a('0x36')]=function(_0xe4756a,_0x510e08){return db[_0x174a('0x51')][_0x174a('0x56')]({'where':{'id':_0xe4756a['params']['id']}})[_0x174a('0x1f')](handleEntityNotFound(_0x510e08,null))['then'](removeEntity(_0x510e08,null))[_0x174a('0x29')](handleError(_0x510e08,null));};exports['describe']=function(_0x4768f1,_0x183c1c){return db[_0x174a('0x51')]['describe']()[_0x174a('0x1f')](respondWithResult(_0x183c1c,null))[_0x174a('0x29')](handleError(_0x183c1c,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x174a('0x5a')]=function(_0x2a19c4,_0x4a1454,_0x38566e){var _0x1381d2={'agent':{},'channel':'whatsapp'};if(_0x2a19c4[_0x174a('0x58')]['id']){delete _0x2a19c4[_0x174a('0x58')]['id'];}_0x2a19c4[_0x174a('0x58')][_0x174a('0x5b')]=!![];_0x2a19c4['body'][_0x174a('0x5c')]=moment()[_0x174a('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a19c4[_0x174a('0x58')]['UserId']=_0x2a19c4['body'][_0x174a('0x5e')]||_0x2a19c4[_0x174a('0x5f')]['id'];_0x1381d2[_0x174a('0x60')]['id']=_0x2a19c4[_0x174a('0x58')][_0x174a('0x5e')];return db[_0x174a('0x51')][_0x174a('0x56')]({'where':{'id':_0x2a19c4[_0x174a('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x174a('0x1f')](handleEntityNotFound(_0x4a1454,null))['then'](saveUpdates(_0x2a19c4['body'],null))[_0x174a('0x1f')](function(_0x32e0d9){if(_0x32e0d9){_0x1381d2['message']=_0x32e0d9[_0x174a('0x61')]({'plain':!![]});return db[_0x174a('0x62')]['find']({'where':{'id':_0x32e0d9[_0x174a('0x63')]}});}return null;})[_0x174a('0x1f')](handleEntityNotFound(_0x4a1454,null))['then'](function(_0x459b54){if(_0x459b54){return _0x459b54[_0x174a('0x35')]({'UserId':_0x2a19c4[_0x174a('0x58')][_0x174a('0x5e')],'read1stAt':_[_0x174a('0x64')](_0x459b54[_0x174a('0x65')])?moment()[_0x174a('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x174a('0x1f')](function(_0x9549c7){if(_0x9549c7){_0x1381d2['interaction']=_0x9549c7['get']({'plain':!![]});interaction_log[_0x174a('0x20')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a19c4['user']['id'],_0x2a19c4['user'][_0x174a('0x38')],_0x2a19c4[_0x174a('0x5f')]['role'],_0x1381d2[_0x174a('0x66')]['id'],_0x2a19c4['body']?JSON[_0x174a('0x24')](_0x2a19c4['body']):_0x174a('0x67'));return respondWithRpcPromise(_0x174a('0x68'),_0x174a('0x69'),_0x1381d2);}return null;})[_0x174a('0x1f')](function(_0x500b3c){if(_0x500b3c){if(_0x2a19c4[_0x174a('0x58')][_0x174a('0x6a')]){_0x1381d2[_0x174a('0x27')][_0x174a('0x6b')]=util[_0x174a('0x5d')](_0x174a('0x6c'),_0x2a19c4[_0x174a('0x5f')][_0x174a('0x38')]);_0x1381d2['message'][_0x174a('0x6d')]=_0x1381d2[_0x174a('0x6d')];_0x1381d2[_0x174a('0x27')][_0x174a('0x6e')]=_0x174a('0x5a');return respondWithRpcPromise(_0x174a('0x6f'),_0x174a('0x6f'),{'event':_0x174a('0x70'),'message':_0x1381d2[_0x174a('0x27')]},client9002)[_0x174a('0x1f')](function(){return _0x1381d2;});}return _0x1381d2;}return null;})[_0x174a('0x1f')](respondWithResult(_0x4a1454,null))[_0x174a('0x29')](handleError(_0x4a1454,null));};var interaction_log=require(_0x174a('0x71'))('whatsapp-interactions');exports[_0x174a('0x72')]=function(_0x436553,_0x47e6cf,_0xe1f368){var _0x4df24b={'agent':{},'channel':'whatsapp'};if(_0x436553[_0x174a('0x58')]['id']){delete _0x436553[_0x174a('0x58')]['id'];}_0x436553[_0x174a('0x58')][_0x174a('0x5e')]=_0x436553[_0x174a('0x58')][_0x174a('0x5e')]||_0x436553[_0x174a('0x5f')]['id'];_0x4df24b[_0x174a('0x60')]['id']=_0x436553[_0x174a('0x58')][_0x174a('0x5e')];return db[_0x174a('0x51')]['find']({'where':{'id':_0x436553[_0x174a('0x59')]['id'],'UserId':null}})[_0x174a('0x1f')](handleEntityNotFound(_0x47e6cf,null))['then'](function(_0xeb1789){if(_0xeb1789){_0x4df24b[_0x174a('0x27')]=_0xeb1789[_0x174a('0x61')]({'plain':!![]});return db[_0x174a('0x62')][_0x174a('0x56')]({'where':{'id':_0xeb1789[_0x174a('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x47e6cf,null))[_0x174a('0x1f')](function(_0x526fcb){if(_0x526fcb){_0x4df24b[_0x174a('0x66')]=_0x526fcb[_0x174a('0x61')]({'plain':!![]});interaction_log[_0x174a('0x20')](_0x174a('0x73'),_0x436553[_0x174a('0x5f')]['id'],_0x436553[_0x174a('0x5f')]['name'],_0x436553[_0x174a('0x5f')][_0x174a('0x74')],_0x4df24b['interaction']['id'],_0x436553[_0x174a('0x58')]?JSON[_0x174a('0x24')](_0x436553[_0x174a('0x58')]):_0x174a('0x67'));return respondWithRpcPromise(_0x174a('0x75'),'rejectMessage',_0x4df24b);}return null;})[_0x174a('0x1f')](function(_0x50a46f){if(_0x50a46f){_0x50a46f[_0x174a('0x27')][_0x174a('0x6b')]=util[_0x174a('0x5d')](_0x174a('0x6c'),_0x436553[_0x174a('0x5f')][_0x174a('0x38')]);_0x50a46f[_0x174a('0x27')][_0x174a('0x6d')]=_0x4df24b[_0x174a('0x6d')];_0x50a46f['message'][_0x174a('0x6e')]=_0x174a('0x72');respondWithRpcPromise(_0x174a('0x6f'),_0x174a('0x6f'),{'event':_0x174a('0x76'),'message':_0x50a46f['message']},client9002);return _0x4df24b;}return null;})[_0x174a('0x1f')](respondWithResult(_0x47e6cf,null))[_0x174a('0x29')](handleError(_0x47e6cf,null));};exports['status']=function(_0x3617fb,_0x555403,_0x3ebbe0){if(_0x3617fb[_0x174a('0x58')]['id']){delete _0x3617fb[_0x174a('0x58')]['id'];}var _0x338814;return db[_0x174a('0x51')][_0x174a('0x56')]({'where':{'id':_0x3617fb[_0x174a('0x59')]['id']}})['then'](handleEntityNotFound(_0x555403,null))[_0x174a('0x1f')](function(_0xa52f09){if(_0xa52f09){_0x338814=_0xa52f09;return db['WhatsappAccount'][_0x174a('0x56')]({'where':{'id':_0xa52f09[_0x174a('0x77')]}});}})['then'](handleEntityNotFound(_0x555403,null))[_0x174a('0x1f')](function(_0x28cd15){if(_0x28cd15){logger[_0x174a('0x22')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x28cd15[_0x174a('0x3d')],util['inspect'](_0x3617fb[_0x174a('0x58')],{'showHidden':![],'depth':null}));switch(_0x28cd15[_0x174a('0x3d')]){case _0x174a('0x78'):if(_0x3617fb[_0x174a('0x58')][_0x174a('0x79')]&&_0x3617fb[_0x174a('0x58')]['MessageSid']===_0x338814['messageId']&&_0x3617fb[_0x174a('0x58')][_0x174a('0x7a')]&&_0x3617fb[_0x174a('0x58')][_0x174a('0x7a')]===_0x174a('0x5b')){return _0x338814['update']({'read':!![]});}else{logger[_0x174a('0x25')](_0x174a('0x7b'),_0x174a('0x2b'),_0x174a('0x78'),util[_0x174a('0x7c')](_0x3617fb[_0x174a('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x338814;}})[_0x174a('0x1f')](respondWithResult(_0x555403,null))['catch'](handleError(_0x555403,null));}; \ No newline at end of file +var _0x9dc5=['stack','name','index','WhatsappMessage','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','limit','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','create','body','find','params','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','WhatsappInteraction','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','WhatsappAccount','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','messageId','MessageStatus','twilio','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','request\x20sent','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','status','count','offset','set','Content-Range','apply','reject','update','destroy'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x9dc5,0x1af));var _0x59dc=function(_0x503fce,_0x8a5b60){_0x503fce=_0x503fce-0x0;var _0x36bef5=_0x9dc5[_0x503fce];return _0x36bef5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x59dc('0x0'));var rimraf=require(_0x59dc('0x1'));var zipdir=require(_0x59dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x59dc('0x3'));var moment=require(_0x59dc('0x4'));var BPromise=require(_0x59dc('0x5'));var Mustache=require(_0x59dc('0x6'));var util=require(_0x59dc('0x7'));var path=require(_0x59dc('0x8'));var sox=require(_0x59dc('0x9'));var csv=require('to-csv');var ejs=require(_0x59dc('0xa'));var fs=require('fs');var fs_extra=require(_0x59dc('0xb'));var _=require(_0x59dc('0xc'));var squel=require(_0x59dc('0xd'));var crypto=require(_0x59dc('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x59dc('0xf'));var toCsv=require('to-csv');var querystring=require(_0x59dc('0x10'));var Papa=require(_0x59dc('0x11'));var Redis=require('ioredis');var authService=require(_0x59dc('0x12'));var qs=require(_0x59dc('0x13'));var as=require(_0x59dc('0x14'));var hardwareService=require(_0x59dc('0x15'));var logger=require(_0x59dc('0x16'))(_0x59dc('0x17'));var utils=require('../../config/utils');var config=require(_0x59dc('0x18'));var licenseUtil=require(_0x59dc('0x19'));var db=require(_0x59dc('0x1a'))['db'];config['redis']=_[_0x59dc('0x1b')](config[_0x59dc('0x1c')],{'host':_0x59dc('0x1d'),'port':0x18eb});var socket=require(_0x59dc('0x1e'))(new Redis(config[_0x59dc('0x1c')]));require(_0x59dc('0x1f'))[_0x59dc('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x59dc('0x21')][_0x59dc('0x22')]({'port':0x232c});var client9002=jayson['client'][_0x59dc('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3b3fd7,_0x42dfab,_0x1b5de3,_0x4722ed){return new BPromise(function(_0x4e00e5,_0x4e68d6){var _0x8c3340=_0x4722ed||client;return _0x8c3340[_0x59dc('0x23')](_0x3b3fd7,_0x1b5de3)[_0x59dc('0x24')](function(_0x1f2ab7){logger[_0x59dc('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x42dfab,_0x59dc('0x26'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x42dfab,_0x59dc('0x26'),JSON[_0x59dc('0x27')](_0x1f2ab7));if(_0x1f2ab7[_0x59dc('0x28')]){if(_0x1f2ab7[_0x59dc('0x28')]['code']===0x1f4){logger[_0x59dc('0x28')](_0x59dc('0x29'),_0x42dfab,_0x1f2ab7[_0x59dc('0x28')]['message']);return _0x4e68d6(_0x1f2ab7['error']['message']);}logger[_0x59dc('0x28')](_0x59dc('0x29'),_0x42dfab,_0x1f2ab7[_0x59dc('0x28')]['message']);return _0x4e00e5(_0x1f2ab7[_0x59dc('0x28')][_0x59dc('0x2a')]);}else{logger[_0x59dc('0x25')](_0x59dc('0x29'),_0x42dfab,_0x59dc('0x26'));_0x4e00e5(_0x1f2ab7[_0x59dc('0x2b')][_0x59dc('0x2a')]);}})['catch'](function(_0x590f9c){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x42dfab,_0x590f9c);_0x4e68d6(_0x590f9c);});});}function respondWithStatusCode(_0x254937,_0x45cfac){_0x45cfac=_0x45cfac||0xcc;return function(_0x122490){if(_0x122490){return _0x254937['sendStatus'](_0x45cfac);}return _0x254937[_0x59dc('0x2c')](_0x45cfac)['end']();};}function respondWithResult(_0x401c89,_0x11e889){_0x11e889=_0x11e889||0xc8;return function(_0x3015cc){if(_0x3015cc){return _0x401c89[_0x59dc('0x2c')](_0x11e889)['json'](_0x3015cc);}};}function respondWithFilteredResult(_0x2539ef,_0x5026f8){return function(_0x5ec614){if(_0x5ec614){var _0x352dbf=_0x5ec614[_0x59dc('0x2d')],_0x1d2260=_0x5026f8[_0x59dc('0x2e')],_0x47e1a4=_0x5026f8[_0x59dc('0x2e')]+_0x5026f8['limit'],_0x74fbd0;if(_0x47e1a4>=_0x352dbf){_0x47e1a4=_0x352dbf;_0x74fbd0=0xc8;}else{_0x74fbd0=0xce;}_0x2539ef[_0x59dc('0x2c')](_0x74fbd0);return _0x2539ef[_0x59dc('0x2f')](_0x59dc('0x30'),_0x1d2260+'-'+_0x47e1a4+'/'+_0x352dbf)['json'](_0x5ec614);}return null;};}function patchUpdates(_0x4c7db6){return function(_0x20c9aa){try{jsonpatch[_0x59dc('0x31')](_0x20c9aa,_0x4c7db6,!![]);}catch(_0xac3078){return BPromise[_0x59dc('0x32')](_0xac3078);}return _0x20c9aa['save']();};}function saveUpdates(_0x515b89,_0x5430ac){return function(_0x2d0b8a){if(_0x2d0b8a){return _0x2d0b8a[_0x59dc('0x33')](_0x515b89)['then'](function(_0xff6a60){return _0xff6a60;});}return null;};}function removeEntity(_0x2b8450,_0x41777c){return function(_0x3f0334){if(_0x3f0334){return _0x3f0334[_0x59dc('0x34')]()[_0x59dc('0x24')](function(){_0x2b8450[_0x59dc('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5ee9,_0x343f78){return function(_0x1c19ce){if(!_0x1c19ce){_0x3c5ee9['sendStatus'](0x194);}return _0x1c19ce;};}function handleError(_0x4bbe8d,_0x439cdb){_0x439cdb=_0x439cdb||0x1f4;return function(_0x4eceaa){logger[_0x59dc('0x28')](_0x4eceaa[_0x59dc('0x35')]);if(_0x4eceaa[_0x59dc('0x36')]){delete _0x4eceaa[_0x59dc('0x36')];}_0x4bbe8d['status'](_0x439cdb)['send'](_0x4eceaa);};}exports[_0x59dc('0x37')]=function(_0x1c0620,_0x40725d){var _0x57b0aa={},_0x4e3f38={},_0x557f2f={'count':0x0,'rows':[]};var _0x59813=_['map'](db[_0x59dc('0x38')]['rawAttributes'],function(_0x13591a){return{'name':_0x13591a[_0x59dc('0x39')],'type':_0x13591a[_0x59dc('0x3a')]['key']};});_0x4e3f38[_0x59dc('0x3b')]=_[_0x59dc('0x3c')](_0x59813,_0x59dc('0x36'));_0x4e3f38[_0x59dc('0x3d')]=_[_0x59dc('0x3e')](_0x1c0620['query']);_0x4e3f38['filters']=_[_0x59dc('0x3f')](_0x4e3f38[_0x59dc('0x3b')],_0x4e3f38['query']);_0x57b0aa[_0x59dc('0x40')]=_[_0x59dc('0x3f')](_0x4e3f38[_0x59dc('0x3b')],qs[_0x59dc('0x41')](_0x1c0620[_0x59dc('0x3d')][_0x59dc('0x41')]));_0x57b0aa[_0x59dc('0x40')]=_0x57b0aa['attributes'][_0x59dc('0x42')]?_0x57b0aa['attributes']:_0x4e3f38[_0x59dc('0x3b')];if(!_0x1c0620[_0x59dc('0x3d')]['hasOwnProperty']('nolimit')){_0x57b0aa[_0x59dc('0x43')]=qs[_0x59dc('0x43')](_0x1c0620[_0x59dc('0x3d')]['limit']);_0x57b0aa[_0x59dc('0x2e')]=qs['offset'](_0x1c0620[_0x59dc('0x3d')][_0x59dc('0x2e')]);}_0x57b0aa['order']=qs[_0x59dc('0x44')](_0x1c0620[_0x59dc('0x3d')][_0x59dc('0x44')]);_0x57b0aa[_0x59dc('0x45')]=qs[_0x59dc('0x46')](_[_0x59dc('0x47')](_0x1c0620[_0x59dc('0x3d')],_0x4e3f38[_0x59dc('0x46')]),_0x59813);if(_0x1c0620[_0x59dc('0x3d')]['filter']){_0x57b0aa[_0x59dc('0x45')]=_[_0x59dc('0x48')](_0x57b0aa[_0x59dc('0x45')],{'$or':_[_0x59dc('0x3c')](_0x59813,function(_0x36f8a3){if(_0x36f8a3[_0x59dc('0x3a')]!==_0x59dc('0x49')){var _0x275771={};_0x275771[_0x36f8a3[_0x59dc('0x36')]]={'$like':'%'+_0x1c0620[_0x59dc('0x3d')]['filter']+'%'};return _0x275771;}})});}_0x57b0aa=_[_0x59dc('0x48')]({},_0x57b0aa,_0x1c0620[_0x59dc('0x4a')]);var _0x31d20e={'where':_0x57b0aa['where']};return db[_0x59dc('0x38')][_0x59dc('0x2d')](_0x31d20e)[_0x59dc('0x24')](function(_0x4d3cd6){_0x557f2f[_0x59dc('0x2d')]=_0x4d3cd6;if(_0x1c0620[_0x59dc('0x3d')][_0x59dc('0x4b')]){_0x57b0aa[_0x59dc('0x4c')]=[{'all':!![]}];}return db[_0x59dc('0x38')]['findAll'](_0x57b0aa);})[_0x59dc('0x24')](function(_0x8ba22e){_0x557f2f[_0x59dc('0x4d')]=_0x8ba22e;return _0x557f2f;})[_0x59dc('0x24')](respondWithFilteredResult(_0x40725d,_0x57b0aa))[_0x59dc('0x4e')](handleError(_0x40725d,null));};exports[_0x59dc('0x4f')]=function(_0x6f52df,_0x4cc277){var _0x1da788={'raw':!![],'where':{'id':_0x6f52df['params']['id']}},_0x58c2ae={};_0x58c2ae[_0x59dc('0x3b')]=_['keys'](db[_0x59dc('0x38')][_0x59dc('0x50')]);_0x58c2ae[_0x59dc('0x3d')]=_[_0x59dc('0x3e')](_0x6f52df['query']);_0x58c2ae[_0x59dc('0x46')]=_['intersection'](_0x58c2ae[_0x59dc('0x3b')],_0x58c2ae[_0x59dc('0x3d')]);_0x1da788[_0x59dc('0x40')]=_['intersection'](_0x58c2ae[_0x59dc('0x3b')],qs['fields'](_0x6f52df['query']['fields']));_0x1da788[_0x59dc('0x40')]=_0x1da788['attributes'][_0x59dc('0x42')]?_0x1da788[_0x59dc('0x40')]:_0x58c2ae['model'];if(_0x6f52df[_0x59dc('0x3d')][_0x59dc('0x4b')]){_0x1da788[_0x59dc('0x4c')]=[{'all':!![]}];}_0x1da788=_[_0x59dc('0x48')]({},_0x1da788,_0x6f52df['options']);return db[_0x59dc('0x38')]['find'](_0x1da788)[_0x59dc('0x24')](handleEntityNotFound(_0x4cc277,null))['then'](respondWithResult(_0x4cc277,null))['catch'](handleError(_0x4cc277,null));};exports[_0x59dc('0x51')]=function(_0x31b0ea,_0x50c2b7){return db[_0x59dc('0x38')]['create'](_0x31b0ea[_0x59dc('0x52')],{})['then'](respondWithResult(_0x50c2b7,0xc9))['catch'](handleError(_0x50c2b7,null));};exports[_0x59dc('0x33')]=function(_0x18a061,_0xe53f64){if(_0x18a061[_0x59dc('0x52')]['id']){delete _0x18a061[_0x59dc('0x52')]['id'];}return db[_0x59dc('0x38')][_0x59dc('0x53')]({'where':{'id':_0x18a061[_0x59dc('0x54')]['id']}})[_0x59dc('0x24')](handleEntityNotFound(_0xe53f64,null))[_0x59dc('0x24')](saveUpdates(_0x18a061[_0x59dc('0x52')],null))[_0x59dc('0x24')](respondWithResult(_0xe53f64,null))[_0x59dc('0x4e')](handleError(_0xe53f64,null));};exports['destroy']=function(_0x14e39b,_0x242cb1){return db[_0x59dc('0x38')][_0x59dc('0x53')]({'where':{'id':_0x14e39b[_0x59dc('0x54')]['id']}})[_0x59dc('0x24')](handleEntityNotFound(_0x242cb1,null))['then'](removeEntity(_0x242cb1,null))[_0x59dc('0x4e')](handleError(_0x242cb1,null));};exports['describe']=function(_0x1abcc3,_0x28afdc){return db[_0x59dc('0x38')]['describe']()['then'](respondWithResult(_0x28afdc,null))[_0x59dc('0x4e')](handleError(_0x28afdc,null));};var interaction_log=require('../../config/logger')(_0x59dc('0x55'));exports[_0x59dc('0x56')]=function(_0x2e8613,_0x8b0604,_0x296cc7){var _0x54283b={'agent':{},'channel':'whatsapp'};if(_0x2e8613['body']['id']){delete _0x2e8613[_0x59dc('0x52')]['id'];}_0x2e8613['body'][_0x59dc('0x57')]=!![];_0x2e8613['body'][_0x59dc('0x58')]=moment()[_0x59dc('0x59')](_0x59dc('0x5a'));_0x2e8613[_0x59dc('0x52')][_0x59dc('0x5b')]=_0x2e8613[_0x59dc('0x52')]['UserId']||_0x2e8613[_0x59dc('0x5c')]['id'];_0x54283b['agent']['id']=_0x2e8613['body'][_0x59dc('0x5b')];return db[_0x59dc('0x38')]['find']({'where':{'id':_0x2e8613['params']['id'],'UserId':null},'include':[{'model':db[_0x59dc('0x5d')],'as':'Contact'}]})[_0x59dc('0x24')](handleEntityNotFound(_0x8b0604,null))[_0x59dc('0x24')](saveUpdates(_0x2e8613['body'],null))['then'](function(_0xb19039){if(_0xb19039){_0x54283b['message']=_0xb19039[_0x59dc('0x5e')]({'plain':!![]});return db[_0x59dc('0x5f')][_0x59dc('0x53')]({'where':{'id':_0xb19039['WhatsappInteractionId']}});}return null;})[_0x59dc('0x24')](handleEntityNotFound(_0x8b0604,null))['then'](function(_0x345b37){if(_0x345b37){return _0x345b37['update']({'UserId':_0x2e8613[_0x59dc('0x52')][_0x59dc('0x5b')],'read1stAt':_['isNil'](_0x345b37['read1stAt'])?moment()[_0x59dc('0x59')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4b85ba){if(_0x4b85ba){_0x54283b[_0x59dc('0x60')]=_0x4b85ba[_0x59dc('0x5e')]({'plain':!![]});interaction_log[_0x59dc('0x25')](_0x59dc('0x61'),_0x2e8613[_0x59dc('0x5c')]['id'],_0x2e8613[_0x59dc('0x5c')][_0x59dc('0x36')],_0x2e8613[_0x59dc('0x5c')][_0x59dc('0x62')],_0x54283b[_0x59dc('0x60')]['id'],_0x2e8613['body']?JSON['stringify'](_0x2e8613[_0x59dc('0x52')]):_0x59dc('0x63'));return respondWithRpcPromise(_0x59dc('0x64'),_0x59dc('0x65'),_0x54283b);}return null;})[_0x59dc('0x24')](function(_0x552b68){if(_0x552b68){if(_0x2e8613[_0x59dc('0x52')][_0x59dc('0x66')]){_0x54283b[_0x59dc('0x2a')][_0x59dc('0x67')]=util[_0x59dc('0x59')](_0x59dc('0x68'),_0x2e8613[_0x59dc('0x5c')][_0x59dc('0x36')]);_0x54283b[_0x59dc('0x2a')][_0x59dc('0x69')]=_0x54283b['channel'];_0x54283b[_0x59dc('0x2a')][_0x59dc('0x6a')]=_0x59dc('0x56');return respondWithRpcPromise('EventManager',_0x59dc('0x6b'),{'event':_0x59dc('0x6c'),'message':_0x54283b[_0x59dc('0x2a')]},client9002)[_0x59dc('0x24')](function(){return _0x54283b;});}return _0x54283b;}return null;})['then'](respondWithResult(_0x8b0604,null))[_0x59dc('0x4e')](handleError(_0x8b0604,null));};var interaction_log=require(_0x59dc('0x16'))(_0x59dc('0x55'));exports[_0x59dc('0x32')]=function(_0x772577,_0x4ab5e8,_0x5112aa){var _0x2b590f={'agent':{},'channel':_0x59dc('0x6d')};if(_0x772577['body']['id']){delete _0x772577['body']['id'];}_0x772577[_0x59dc('0x52')]['UserId']=_0x772577[_0x59dc('0x52')][_0x59dc('0x5b')]||_0x772577[_0x59dc('0x5c')]['id'];_0x2b590f[_0x59dc('0x6e')]['id']=_0x772577['body']['UserId'];return db[_0x59dc('0x38')][_0x59dc('0x53')]({'where':{'id':_0x772577[_0x59dc('0x54')]['id'],'UserId':null}})[_0x59dc('0x24')](handleEntityNotFound(_0x4ab5e8,null))[_0x59dc('0x24')](function(_0x1b3db7){if(_0x1b3db7){_0x2b590f[_0x59dc('0x2a')]=_0x1b3db7[_0x59dc('0x5e')]({'plain':!![]});return db[_0x59dc('0x5f')][_0x59dc('0x53')]({'where':{'id':_0x1b3db7['WhatsappInteractionId']}});}return null;})[_0x59dc('0x24')](handleEntityNotFound(_0x4ab5e8,null))[_0x59dc('0x24')](function(_0x463620){if(_0x463620){_0x2b590f[_0x59dc('0x60')]=_0x463620['get']({'plain':!![]});interaction_log[_0x59dc('0x25')](_0x59dc('0x6f'),_0x772577[_0x59dc('0x5c')]['id'],_0x772577[_0x59dc('0x5c')][_0x59dc('0x36')],_0x772577[_0x59dc('0x5c')][_0x59dc('0x62')],_0x2b590f['interaction']['id'],_0x772577['body']?JSON[_0x59dc('0x27')](_0x772577[_0x59dc('0x52')]):'null');return respondWithRpcPromise(_0x59dc('0x70'),'rejectMessage',_0x2b590f);}return null;})[_0x59dc('0x24')](function(_0x32bbf2){if(_0x32bbf2){_0x32bbf2[_0x59dc('0x2a')][_0x59dc('0x67')]=util['format']('SIP/%s',_0x772577['user']['name']);_0x32bbf2[_0x59dc('0x2a')][_0x59dc('0x69')]=_0x2b590f[_0x59dc('0x69')];_0x32bbf2[_0x59dc('0x2a')]['event']=_0x59dc('0x32');respondWithRpcPromise('EventManager',_0x59dc('0x6b'),{'event':'rejectmessage','message':_0x32bbf2[_0x59dc('0x2a')]},client9002);return _0x2b590f;}return null;})[_0x59dc('0x24')](respondWithResult(_0x4ab5e8,null))['catch'](handleError(_0x4ab5e8,null));};exports[_0x59dc('0x2c')]=function(_0x2605fd,_0xd1990d,_0x2c26e9){if(_0x2605fd['body']['id']){delete _0x2605fd[_0x59dc('0x52')]['id'];}var _0x1a8901;return db[_0x59dc('0x38')][_0x59dc('0x53')]({'where':{'id':_0x2605fd[_0x59dc('0x54')]['id']}})[_0x59dc('0x24')](handleEntityNotFound(_0xd1990d,null))[_0x59dc('0x24')](function(_0x419bad){if(_0x419bad){_0x1a8901=_0x419bad;return db[_0x59dc('0x71')][_0x59dc('0x53')]({'where':{'id':_0x419bad['WhatsappAccountId']}});}})[_0x59dc('0x24')](handleEntityNotFound(_0xd1990d,null))['then'](function(_0xf883c1){if(_0xf883c1){logger[_0x59dc('0x72')](_0x59dc('0x73'),_0x59dc('0x2c'),'received\x20delivery\x20report\x20from',_0xf883c1[_0x59dc('0x3a')],util[_0x59dc('0x74')](_0x2605fd['body'],{'showHidden':![],'depth':null}));switch(_0xf883c1[_0x59dc('0x3a')]){case'twilio':if(_0x2605fd[_0x59dc('0x52')][_0x59dc('0x75')]&&_0x2605fd[_0x59dc('0x52')][_0x59dc('0x75')]===_0x1a8901[_0x59dc('0x76')]&&_0x2605fd[_0x59dc('0x52')]['MessageStatus']&&_0x2605fd[_0x59dc('0x52')][_0x59dc('0x77')]===_0x59dc('0x57')){return _0x1a8901[_0x59dc('0x33')]({'read':!![]});}else{logger[_0x59dc('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x59dc('0x2c'),_0x59dc('0x78'),util['inspect'](_0x2605fd[_0x59dc('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x1a8901;}})[_0x59dc('0x24')](respondWithResult(_0xd1990d,null))['catch'](handleError(_0xd1990d,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index c7713a3..c29f872 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0xc9bed8,_0x1c04b6){var _0x243eb8=function(_0x254af6){while(--_0x254af6){_0xc9bed8['push'](_0xc9bed8['shift']());}};_0x243eb8(++_0x1c04b6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2ab089,_0x5cf7d4){_0x2ab089=_0x2ab089-0x0;var _0x1c8e3d=_0x5f2f[_0x2ab089];return _0x1c8e3d;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x45b7b1,_0x1009bb){var _0x3d4fa8=function(_0x52ac3b){while(--_0x52ac3b){_0x45b7b1['push'](_0x45b7b1['shift']());}};_0x3d4fa8(++_0x1009bb);}(_0x7a54,0x106));var _0x47a5=function(_0x4fe3aa,_0x384fc5){_0x4fe3aa=_0x4fe3aa-0x0;var _0x1c4236=_0x7a54[_0x4fe3aa];return _0x1c4236;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index c25edfa..eeeaa71 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 _0xb4de=['catch','error','out','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','isNil','UserId','findOne','then','update'];(function(_0x3e5457,_0xd17e2d){var _0x1503b9=function(_0x287543){while(--_0x287543){_0x3e5457['push'](_0x3e5457['shift']());}};_0x1503b9(++_0xd17e2d);}(_0xb4de,0xa2));var _0xeb4d=function(_0x25aafd,_0x1e7727){_0x25aafd=_0x25aafd-0x0;var _0x369433=_0xb4de[_0x25aafd];return _0x369433;};'use strict';var _=require('lodash');var util=require(_0xeb4d('0x0'));var logger=require(_0xeb4d('0x1'))(_0xeb4d('0x2'));var moment=require(_0xeb4d('0x3'));var BPromise=require(_0xeb4d('0x4'));var rp=require(_0xeb4d('0x5'));var fs=require('fs');var path=require(_0xeb4d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0xeb4d('0x7')]=function(_0x3b93b4,_0x10815e){return _0x3b93b4[_0xeb4d('0x8')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xeb4d('0x9'),'fields':['messageId']},{'name':_0xeb4d('0xa'),'fields':[_0xeb4d('0xb')],'type':_0xeb4d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x391dea,_0x39c47c,_0x19f3b7){var _0x5ed494=_0x3b93b4[_0xeb4d('0xd')];var _0x139f22=_0x391dea[_0xeb4d('0xe')]({'plain':!![]});if(_0x139f22['direction'][_0xeb4d('0xf')]()==='in'||_0x139f22[_0xeb4d('0x10')][_0xeb4d('0xf')]()==='out'&&!_0x139f22['secret']&&!_[_0xeb4d('0x11')](_0x139f22[_0xeb4d('0x12')])){_0x5ed494['WhatsappInteraction'][_0xeb4d('0x13')]({'where':{'id':_0x139f22['WhatsappInteractionId']}})[_0xeb4d('0x14')](function(_0xcafdb9){if(_0xcafdb9){_0xcafdb9[_0xeb4d('0x15')]({'lastMsgAt':_0x139f22['createdAt'],'lastMsgDirection':_0x139f22[_0xeb4d('0x10')][_0xeb4d('0xf')]()});}})[_0xeb4d('0x16')](function(_0x5edd47){console[_0xeb4d('0x17')](_0x5edd47);});}if(_0x139f22[_0xeb4d('0x10')]===_0xeb4d('0x18')&&!_0x139f22[_0xeb4d('0x19')]){var _0x1a0359;_0x5ed494[_0xeb4d('0x1a')][_0xeb4d('0x1b')]({'where':{'id':_0x139f22[_0xeb4d('0x1c')]},'raw':!![]})[_0xeb4d('0x14')](function(_0x2c496c){_0x1a0359=_0x2c496c;if(_0x1a0359&&_0x1a0359[_0xeb4d('0x1d')]){switch(_0x1a0359[_0xeb4d('0x1d')]){case _0xeb4d('0x1e'):var _0x401d33=require('twilio');if(_0x1a0359[_0xeb4d('0x1f')]&&_0x1a0359['authToken']&&_0x1a0359[_0xeb4d('0x20')]){var _0x50242b=new _0x401d33(_0x1a0359[_0xeb4d('0x1f')],_0x1a0359[_0xeb4d('0x21')]);_0x50242b[_0xeb4d('0x22')][_0xeb4d('0x23')]({'body':_0x139f22['body'],'to':_0xeb4d('0x24')+_0x139f22[_0xeb4d('0x20')],'from':_0xeb4d('0x24')+_0x1a0359[_0xeb4d('0x20')],'statusCallback':_0x1a0359['remote']+_0xeb4d('0x25')+_0x139f22['id']+'/status?token='+_0x1a0359[_0xeb4d('0x26')]})['then'](function(_0x179e55){if(_0x179e55[_0xeb4d('0x27')]){return _0x391dea['update']({'messageId':_0x179e55[_0xeb4d('0x27')]});}})[_0xeb4d('0x16')](function(_0xeb18b2){logger[_0xeb4d('0x17')](_0xeb4d('0x28'),'afterCreate',_0xeb4d('0x1e'),util[_0xeb4d('0x29')](_0xeb18b2,{'showHidden':![],'depth':null}));});}else{logger[_0xeb4d('0x17')](_0xeb4d('0x28'),'afterCreate',_0xeb4d('0x1e'),_0xeb4d('0x2a'));}break;}}})[_0xeb4d('0x2b')](function(){_0x19f3b7();});}else{_0x19f3b7();}}},'charset':_0xeb4d('0x2c'),'collate':_0xeb4d('0x2d')});}; \ No newline at end of file +var _0x8b51=['secret','isNil','UserId','findOne','WhatsappInteractionId','then','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','inspect','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x5779ac,_0x37aa5d){var _0x269771=function(_0x5274c7){while(--_0x5274c7){_0x5779ac['push'](_0x5779ac['shift']());}};_0x269771(++_0x37aa5d);}(_0x8b51,0x192));var _0x18b5=function(_0x48c742,_0x4725df){_0x48c742=_0x48c742-0x0;var _0x484c7a=_0x8b51[_0x48c742];return _0x484c7a;};'use strict';var _=require(_0x18b5('0x0'));var util=require(_0x18b5('0x1'));var logger=require('../../config/logger')(_0x18b5('0x2'));var moment=require(_0x18b5('0x3'));var BPromise=require(_0x18b5('0x4'));var rp=require(_0x18b5('0x5'));var fs=require('fs');var path=require(_0x18b5('0x6'));var rimraf=require(_0x18b5('0x7'));var config=require(_0x18b5('0x8'));var attributes=require(_0x18b5('0x9'));module[_0x18b5('0xa')]=function(_0x1c80f4,_0x1f7ad8){return _0x1c80f4[_0x18b5('0xb')](_0x18b5('0xc'),attributes,{'tableName':_0x18b5('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x18b5('0xe'),'fields':[_0x18b5('0xf')],'type':_0x18b5('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c89fa,_0x18538c,_0x2e6896){var _0x6212da=_0x1c80f4[_0x18b5('0x11')];var _0x3e593a=_0x3c89fa[_0x18b5('0x12')]({'plain':!![]});if(_0x3e593a[_0x18b5('0x13')][_0x18b5('0x14')]()==='in'||_0x3e593a[_0x18b5('0x13')]['toLowerCase']()===_0x18b5('0x15')&&!_0x3e593a[_0x18b5('0x16')]&&!_[_0x18b5('0x17')](_0x3e593a[_0x18b5('0x18')])){_0x6212da['WhatsappInteraction'][_0x18b5('0x19')]({'where':{'id':_0x3e593a[_0x18b5('0x1a')]}})[_0x18b5('0x1b')](function(_0x16804b){if(_0x16804b){_0x16804b[_0x18b5('0x1c')]({'lastMsgAt':_0x3e593a[_0x18b5('0x1d')],'lastMsgDirection':_0x3e593a[_0x18b5('0x13')]['toLowerCase']()});}})[_0x18b5('0x1e')](function(_0x5212bd){console['error'](_0x5212bd);});}if(_0x3e593a[_0x18b5('0x13')]==='out'&&!_0x3e593a[_0x18b5('0x16')]){var _0x1a1c49;_0x6212da[_0x18b5('0x1f')][_0x18b5('0x20')]({'where':{'id':_0x3e593a[_0x18b5('0x21')]},'raw':!![]})['then'](function(_0x202b26){_0x1a1c49=_0x202b26;if(_0x1a1c49&&_0x1a1c49[_0x18b5('0x22')]){switch(_0x1a1c49[_0x18b5('0x22')]){case'twilio':var _0x1cce18=require(_0x18b5('0x23'));if(_0x1a1c49['accountSid']&&_0x1a1c49[_0x18b5('0x24')]&&_0x1a1c49[_0x18b5('0x25')]){var _0x3b5f11=new _0x1cce18(_0x1a1c49[_0x18b5('0x26')],_0x1a1c49[_0x18b5('0x24')]);_0x3b5f11[_0x18b5('0x27')]['create']({'body':_0x3e593a[_0x18b5('0xf')],'to':_0x18b5('0x28')+_0x3e593a[_0x18b5('0x25')],'from':_0x18b5('0x28')+_0x1a1c49[_0x18b5('0x25')],'statusCallback':_0x1a1c49[_0x18b5('0x29')]+_0x18b5('0x2a')+_0x3e593a['id']+_0x18b5('0x2b')+_0x1a1c49[_0x18b5('0x2c')]})['then'](function(_0x557ba1){if(_0x557ba1[_0x18b5('0x2d')]){return _0x3c89fa[_0x18b5('0x1c')]({'messageId':_0x557ba1['sid']});}})[_0x18b5('0x1e')](function(_0x1d6487){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x18b5('0x2e'),_0x18b5('0x23'),util[_0x18b5('0x2f')](_0x1d6487,{'showHidden':![],'depth':null}));});}else{logger[_0x18b5('0x30')](_0x18b5('0x31'),'afterCreate',_0x18b5('0x23'),_0x18b5('0x32'));}break;}}})[_0x18b5('0x33')](function(){_0x2e6896();});}else{_0x2e6896();}}},'charset':_0x18b5('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 5fe69b7..215ab73 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 _0x23f2=['options','raw','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body'];(function(_0x2ab97a,_0x36f9ed){var _0xfc17b5=function(_0x6bf21e){while(--_0x6bf21e){_0x2ab97a['push'](_0x2ab97a['shift']());}};_0xfc17b5(++_0x36f9ed);}(_0x23f2,0x176));var _0x223f=function(_0x5e27b3,_0x313962){_0x5e27b3=_0x5e27b3-0x0;var _0x333a24=_0x23f2[_0x5e27b3];return _0x333a24;};'use strict';var _=require(_0x223f('0x0'));var util=require(_0x223f('0x1'));var moment=require('moment');var BPromise=require(_0x223f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x223f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x223f('0x4'));var logger=require(_0x223f('0x5'))(_0x223f('0x6'));var config=require(_0x223f('0x7'));var jayson=require(_0x223f('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x223f('0x9')]=_[_0x223f('0xa')](config['redis'],{'host':_0x223f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x223f('0x9')]));require(_0x223f('0xc'))['register'](socket);function respondWithRpcPromise(_0x50f3ee,_0xf64ecb,_0x53c8a9){return new BPromise(function(_0x12fb7b,_0x21bce5){return client[_0x223f('0xd')](_0x50f3ee,_0x53c8a9)[_0x223f('0xe')](function(_0x5d494b){logger[_0x223f('0xf')](_0x223f('0x10'),_0xf64ecb,_0x223f('0x11'));logger[_0x223f('0x12')](_0x223f('0x13'),_0xf64ecb,'request\x20sent',JSON['stringify'](_0x5d494b));if(_0x5d494b[_0x223f('0x14')]){if(_0x5d494b[_0x223f('0x14')][_0x223f('0x15')]===0x1f4){logger[_0x223f('0x14')](_0x223f('0x10'),_0xf64ecb,_0x5d494b['error'][_0x223f('0x16')]);return _0x21bce5(_0x5d494b[_0x223f('0x14')]['message']);}logger['error'](_0x223f('0x10'),_0xf64ecb,_0x5d494b[_0x223f('0x14')][_0x223f('0x16')]);return _0x12fb7b(_0x5d494b['error'][_0x223f('0x16')]);}else{logger[_0x223f('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0xf64ecb,_0x223f('0x11'));_0x12fb7b(_0x5d494b[_0x223f('0x17')][_0x223f('0x16')]);}})[_0x223f('0x18')](function(_0x57fb2f){logger[_0x223f('0x14')](_0x223f('0x10'),_0xf64ecb,_0x57fb2f);_0x21bce5(_0x57fb2f);});});}exports[_0x223f('0x19')]=function(_0x28d31d){var _0x37723b=this;return new Promise(function(_0x4b57c5,_0x582432){return db[_0x223f('0x1a')][_0x223f('0x1b')](_0x28d31d[_0x223f('0x1c')],{'raw':_0x28d31d[_0x223f('0x1d')]?_0x28d31d[_0x223f('0x1d')][_0x223f('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x3dc997){logger['info']('CreateWhatsappMessage',_0x28d31d);logger['debug']('CreateWhatsappMessage',_0x28d31d,JSON['stringify'](_0x3dc997));_0x4b57c5(_0x3dc997);})['catch'](function(_0x3b8b5f){logger[_0x223f('0x14')]('CreateWhatsappMessage',_0x3b8b5f[_0x223f('0x16')],_0x28d31d);_0x582432(_0x37723b['error'](0x1f4,_0x3b8b5f['message']));});});}; \ No newline at end of file +var _0x59d6=['CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x529341,_0x23ce70){var _0x1f21e3=function(_0x555418){while(--_0x555418){_0x529341['push'](_0x529341['shift']());}};_0x1f21e3(++_0x23ce70);}(_0x59d6,0x150));var _0x659d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x59d6[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x659d('0x0'));var BPromise=require(_0x659d('0x1'));var rs=require(_0x659d('0x2'));var fs=require('fs');var Redis=require(_0x659d('0x3'));var db=require(_0x659d('0x4'))['db'];var utils=require(_0x659d('0x5'));var logger=require(_0x659d('0x6'))(_0x659d('0x7'));var config=require(_0x659d('0x8'));var jayson=require(_0x659d('0x9'));var client=jayson[_0x659d('0xa')][_0x659d('0xb')]({'port':0x232a});config[_0x659d('0xc')]=_['defaults'](config[_0x659d('0xc')],{'host':_0x659d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x659d('0xc')]));require(_0x659d('0xe'))[_0x659d('0xf')](socket);function respondWithRpcPromise(_0x5e363b,_0x1549f3,_0x459e76){return new BPromise(function(_0xda149a,_0x19b123){return client[_0x659d('0x10')](_0x5e363b,_0x459e76)[_0x659d('0x11')](function(_0x3f5d4e){logger[_0x659d('0x12')](_0x659d('0x13'),_0x1549f3,_0x659d('0x14'));logger[_0x659d('0x15')](_0x659d('0x16'),_0x1549f3,_0x659d('0x14'),JSON[_0x659d('0x17')](_0x3f5d4e));if(_0x3f5d4e[_0x659d('0x18')]){if(_0x3f5d4e[_0x659d('0x18')][_0x659d('0x19')]===0x1f4){logger[_0x659d('0x18')](_0x659d('0x13'),_0x1549f3,_0x3f5d4e[_0x659d('0x18')][_0x659d('0x1a')]);return _0x19b123(_0x3f5d4e[_0x659d('0x18')][_0x659d('0x1a')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1549f3,_0x3f5d4e['error'][_0x659d('0x1a')]);return _0xda149a(_0x3f5d4e[_0x659d('0x18')][_0x659d('0x1a')]);}else{logger[_0x659d('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x1549f3,'request\x20sent');_0xda149a(_0x3f5d4e['result'][_0x659d('0x1a')]);}})['catch'](function(_0x457f2b){logger[_0x659d('0x18')](_0x659d('0x13'),_0x1549f3,_0x457f2b);_0x19b123(_0x457f2b);});});}exports[_0x659d('0x1b')]=function(_0x17b3f1){var _0x41c4ff=this;return new Promise(function(_0x5c8f3e,_0x1bace0){return db[_0x659d('0x1c')][_0x659d('0x1d')](_0x17b3f1[_0x659d('0x1e')],{'raw':_0x17b3f1[_0x659d('0x1f')]?_0x17b3f1[_0x659d('0x1f')][_0x659d('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x4a438d){logger['info'](_0x659d('0x1b'),_0x17b3f1);logger[_0x659d('0x15')](_0x659d('0x1b'),_0x17b3f1,JSON[_0x659d('0x17')](_0x4a438d));_0x5c8f3e(_0x4a438d);})['catch'](function(_0x32dfaf){logger[_0x659d('0x18')]('CreateWhatsappMessage',_0x32dfaf['message'],_0x17b3f1);_0x1bace0(_0x41c4ff[_0x659d('0x18')](0x1f4,_0x32dfaf[_0x659d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index b87effb..aa60065 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 _0x3bda=['emit','length','save'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x3bda,0x143));var _0xa3bd=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x3bda[_0x1928c9];return _0x51b5fb;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xa3bd('0x0'),'remove','update'];function createListener(_0x3ebc9a,_0x148ad7){return function(_0x11ba90){_0x148ad7[_0xa3bd('0x1')](_0x3ebc9a,_0x11ba90);};}function removeListener(_0x3e7b4a,_0x4e5409){return function(){WhatsappMessageEvents['removeListener'](_0x3e7b4a,_0x4e5409);};}exports['register']=function(_0x934af5){for(var _0x2c5625=0x0,_0x17e659=events[_0xa3bd('0x2')];_0x2c5625<_0x17e659;_0x2c5625++){var _0x31d1f4=events[_0x2c5625];var _0xd47cd8=createListener('whatsappMessage:'+_0x31d1f4,_0x934af5);WhatsappMessageEvents['on'](_0x31d1f4,_0xd47cd8);}}; \ No newline at end of file +var _0x7ba0=['emit','removeListener','whatsappMessage:','./whatsappMessage.events','save','remove','update'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x7ba0,0x1bc));var _0x07ba=function(_0x59d7a7,_0x2cb4da){_0x59d7a7=_0x59d7a7-0x0;var _0x17296a=_0x7ba0[_0x59d7a7];return _0x17296a;};'use strict';var WhatsappMessageEvents=require(_0x07ba('0x0'));var events=[_0x07ba('0x1'),_0x07ba('0x2'),_0x07ba('0x3')];function createListener(_0x26493e,_0x291a3e){return function(_0x3c50ce){_0x291a3e[_0x07ba('0x4')](_0x26493e,_0x3c50ce);};}function removeListener(_0x670c22,_0x1e974e){return function(){WhatsappMessageEvents[_0x07ba('0x5')](_0x670c22,_0x1e974e);};}exports['register']=function(_0x108d98){for(var _0x506476=0x0,_0x526a8e=events['length'];_0x506476<_0x526a8e;_0x506476++){var _0xd33c43=events[_0x506476];var _0x3adcf5=createListener(_0x07ba('0x6')+_0xd33c43,_0x108d98);WhatsappMessageEvents['on'](_0xd33c43,_0x3adcf5);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index f0343d6..2ea2aad 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 _0xe0eb=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','put','update','delete','destroy'];(function(_0x4dc2f7,_0x68dbab){var _0x2e483e=function(_0x1eeb6c){while(--_0x1eeb6c){_0x4dc2f7['push'](_0x4dc2f7['shift']());}};_0x2e483e(++_0x68dbab);}(_0xe0eb,0x1a7));var _0xbe0e=function(_0x5b3820,_0x51889c){_0x5b3820=_0x5b3820-0x0;var _0x442af8=_0xe0eb[_0x5b3820];return _0x442af8;};'use strict';var multer=require(_0xbe0e('0x0'));var util=require(_0xbe0e('0x1'));var path=require(_0xbe0e('0x2'));var timeout=require(_0xbe0e('0x3'));var express=require(_0xbe0e('0x4'));var router=express[_0xbe0e('0x5')]();var fs_extra=require(_0xbe0e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbe0e('0x7'));var config=require('../../config/environment');var controller=require(_0xbe0e('0x8'));router['get']('/',auth[_0xbe0e('0x9')](),controller[_0xbe0e('0xa')]);router[_0xbe0e('0xb')](_0xbe0e('0xc'),auth[_0xbe0e('0x9')](),controller[_0xbe0e('0xd')]);router[_0xbe0e('0xb')](_0xbe0e('0xe'),auth[_0xbe0e('0x9')](),controller[_0xbe0e('0xf')]);router[_0xbe0e('0xb')](_0xbe0e('0x10'),auth[_0xbe0e('0x9')](),controller[_0xbe0e('0x11')]);router[_0xbe0e('0xb')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbe0e('0x12')]);router['get'](_0xbe0e('0x13'),auth['isAuthenticated'](),controller[_0xbe0e('0x14')]);router[_0xbe0e('0x15')]('/',auth[_0xbe0e('0x9')](),controller['create']);router[_0xbe0e('0x15')](_0xbe0e('0x16'),auth[_0xbe0e('0x9')](),controller['addTeams']);router[_0xbe0e('0x15')](_0xbe0e('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xbe0e('0x17')](_0xbe0e('0xe'),auth['isAuthenticated'](),controller[_0xbe0e('0x18')]);router[_0xbe0e('0x19')](_0xbe0e('0xe'),auth[_0xbe0e('0x9')](),controller[_0xbe0e('0x1a')]);router[_0xbe0e('0x19')](_0xbe0e('0x16'),auth['isAuthenticated'](),controller[_0xbe0e('0x1b')]);router[_0xbe0e('0x19')]('/:id/users',auth[_0xbe0e('0x9')](),controller[_0xbe0e('0x1c')]);module[_0xbe0e('0x1d')]=router; \ No newline at end of file +var _0x0f9a=['put','update','delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents'];(function(_0x329a87,_0x4e6894){var _0x312808=function(_0xc81c71){while(--_0xc81c71){_0x329a87['push'](_0x329a87['shift']());}};_0x312808(++_0x4e6894);}(_0x0f9a,0x7f));var _0xa0f9=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x0f9a[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0xa0f9('0x0'));var path=require('path');var timeout=require(_0xa0f9('0x1'));var express=require('express');var router=express[_0xa0f9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa0f9('0x3'));var interaction=require(_0xa0f9('0x4'));var config=require(_0xa0f9('0x5'));var controller=require(_0xa0f9('0x6'));router[_0xa0f9('0x7')]('/',auth[_0xa0f9('0x8')](),controller['index']);router[_0xa0f9('0x7')](_0xa0f9('0x9'),auth[_0xa0f9('0x8')](),controller[_0xa0f9('0xa')]);router[_0xa0f9('0x7')](_0xa0f9('0xb'),auth['isAuthenticated'](),controller[_0xa0f9('0xc')]);router[_0xa0f9('0x7')](_0xa0f9('0xd'),auth[_0xa0f9('0x8')](),controller[_0xa0f9('0xe')]);router[_0xa0f9('0x7')](_0xa0f9('0xf'),auth['isAuthenticated'](),controller[_0xa0f9('0x10')]);router[_0xa0f9('0x7')]('/:id/users',auth[_0xa0f9('0x8')](),controller[_0xa0f9('0x11')]);router[_0xa0f9('0x12')]('/',auth[_0xa0f9('0x8')](),controller[_0xa0f9('0x13')]);router[_0xa0f9('0x12')]('/:id/teams',auth[_0xa0f9('0x8')](),controller[_0xa0f9('0x14')]);router[_0xa0f9('0x12')](_0xa0f9('0x15'),auth[_0xa0f9('0x8')](),controller[_0xa0f9('0x16')]);router[_0xa0f9('0x17')](_0xa0f9('0xb'),auth['isAuthenticated'](),controller[_0xa0f9('0x18')]);router[_0xa0f9('0x19')](_0xa0f9('0xb'),auth[_0xa0f9('0x8')](),controller[_0xa0f9('0x1a')]);router[_0xa0f9('0x19')]('/:id/teams',auth[_0xa0f9('0x8')](),controller[_0xa0f9('0x1b')]);router['delete'](_0xa0f9('0x15'),auth[_0xa0f9('0x8')](),controller[_0xa0f9('0x1c')]);module[_0xa0f9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 3150b8b..a96ac10 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 _0x0f09=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name'];(function(_0x267767,_0x47ad13){var _0x19b874=function(_0x5386e9){while(--_0x5386e9){_0x267767['push'](_0x267767['shift']());}};_0x19b874(++_0x47ad13);}(_0x0f09,0xe4));var _0x90f0=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0f09[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module[_0x90f0('0x0')]={'name':{'type':Sequelize[_0x90f0('0x1')],'unique':_0x90f0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x90f0('0x3')](_0x90f0('0x4'),_0x90f0('0x5'),_0x90f0('0x6'))},'description':{'type':Sequelize[_0x90f0('0x1')]}}; \ No newline at end of file +var _0x36fb=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x2bdcea,_0x5a8e39){var _0x6b4d2d=function(_0xc1c10c){while(--_0xc1c10c){_0x2bdcea['push'](_0x2bdcea['shift']());}};_0x6b4d2d(++_0x5a8e39);}(_0x36fb,0x115));var _0xb36f=function(_0x2904f2,_0x3001ad){_0x2904f2=_0x2904f2-0x0;var _0x17936d=_0x36fb[_0x2904f2];return _0x17936d;};'use strict';var Sequelize=require(_0xb36f('0x0'));module[_0xb36f('0x1')]={'name':{'type':Sequelize[_0xb36f('0x2')],'unique':_0xb36f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xb36f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb36f('0x5'),_0xb36f('0x6'),_0xb36f('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 6ff8699..f845c75 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 _0x6ae0=['filter','merge','type','VIRTUAL','options','count','include','findAll','rows','catch','show','params','filters','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','map','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','%s/%s','SIP','updatedAt','Team','order','getTeams','addTeams','ids','Agents','voicePause','interface','each','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','transaction','removeAgents','userWhatsappQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','WhatsappQueues','end','stack','name','WhatsappQueue','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick'];(function(_0x516fa4,_0x3a79c9){var _0x42126a=function(_0x4f9b18){while(--_0x4f9b18){_0x516fa4['push'](_0x516fa4['shift']());}};_0x42126a(++_0x3a79c9);}(_0x6ae0,0xd3));var _0x06ae=function(_0x4ce02e,_0x4486a9){_0x4ce02e=_0x4ce02e-0x0;var _0x4aab50=_0x6ae0[_0x4ce02e];return _0x4aab50;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x06ae('0x0'));var rimraf=require(_0x06ae('0x1'));var zipdir=require(_0x06ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x06ae('0x3'));var Mustache=require(_0x06ae('0x4'));var util=require('util');var path=require(_0x06ae('0x5'));var sox=require('sox');var csv=require(_0x06ae('0x6'));var ejs=require(_0x06ae('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06ae('0x8'));var squel=require(_0x06ae('0x9'));var crypto=require(_0x06ae('0xa'));var jsforce=require(_0x06ae('0xb'));var deskjs=require(_0x06ae('0xc'));var toCsv=require(_0x06ae('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x06ae('0xd'));var authService=require(_0x06ae('0xe'));var qs=require(_0x06ae('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06ae('0x10'));var logger=require(_0x06ae('0x11'))(_0x06ae('0x12'));var utils=require(_0x06ae('0x13'));var config=require(_0x06ae('0x14'));var licenseUtil=require(_0x06ae('0x15'));var db=require(_0x06ae('0x16'))['db'];config[_0x06ae('0x17')]=_[_0x06ae('0x18')](config[_0x06ae('0x17')],{'host':_0x06ae('0x19'),'port':0x18eb});var socket=require(_0x06ae('0x1a'))(new Redis(config['redis']));require(_0x06ae('0x1b'))[_0x06ae('0x1c')](socket);function respondWithStatusCode(_0x3507b4,_0x428e70){_0x428e70=_0x428e70||0xcc;return function(_0x4d4fd8){if(_0x4d4fd8){return _0x3507b4[_0x06ae('0x1d')](_0x428e70);}return _0x3507b4[_0x06ae('0x1e')](_0x428e70)['end']();};}function respondWithResult(_0xeee41f,_0x3a59bc){_0x3a59bc=_0x3a59bc||0xc8;return function(_0x551c40){if(_0x551c40){return _0xeee41f[_0x06ae('0x1e')](_0x3a59bc)[_0x06ae('0x1f')](_0x551c40);}};}function respondWithFilteredResult(_0x35ff9f,_0x1eadcb){return function(_0x3b36c7){if(_0x3b36c7){var _0x1aa551=_0x3b36c7['count'],_0x14afea=_0x1eadcb[_0x06ae('0x20')],_0x2c3a9b=_0x1eadcb[_0x06ae('0x20')]+_0x1eadcb[_0x06ae('0x21')],_0x3cafe4;if(_0x2c3a9b>=_0x1aa551){_0x2c3a9b=_0x1aa551;_0x3cafe4=0xc8;}else{_0x3cafe4=0xce;}_0x35ff9f[_0x06ae('0x1e')](_0x3cafe4);return _0x35ff9f[_0x06ae('0x22')](_0x06ae('0x23'),_0x14afea+'-'+_0x2c3a9b+'/'+_0x1aa551)[_0x06ae('0x1f')](_0x3b36c7);}return null;};}function patchUpdates(_0x6087ea){return function(_0x2bc007){try{jsonpatch[_0x06ae('0x24')](_0x2bc007,_0x6087ea,!![]);}catch(_0x16840a){return BPromise[_0x06ae('0x25')](_0x16840a);}return _0x2bc007[_0x06ae('0x26')]();};}function saveUpdates(_0x446e89,_0x3e54f8){return function(_0x1ab241){if(_0x1ab241){return _0x1ab241[_0x06ae('0x27')](_0x446e89)[_0x06ae('0x28')](function(_0x4ba0ba){return _0x4ba0ba;});}return null;};}function removeEntity(_0x25023a,_0x177dde){return function(_0xd51d34){if(_0xd51d34){return _0xd51d34[_0x06ae('0x29')]()['then'](function(){var _0x178d2f=_0xd51d34['get']({'plain':!![]});var _0x83f3dc=_0x06ae('0x2a');return db['UserProfileResource'][_0x06ae('0x29')]({'where':{'type':_0x83f3dc,'resourceId':_0x178d2f['id']}})['then'](function(){return _0xd51d34;});})['then'](function(){_0x25023a[_0x06ae('0x1e')](0xcc)[_0x06ae('0x2b')]();});}};}function handleEntityNotFound(_0x3a84fd,_0x3a2f1c){return function(_0x3aca51){if(!_0x3aca51){_0x3a84fd[_0x06ae('0x1d')](0x194);}return _0x3aca51;};}function handleError(_0x31340c,_0x9f81fb){_0x9f81fb=_0x9f81fb||0x1f4;return function(_0x1481f3){logger['error'](_0x1481f3[_0x06ae('0x2c')]);if(_0x1481f3[_0x06ae('0x2d')]){delete _0x1481f3['name'];}_0x31340c[_0x06ae('0x1e')](_0x9f81fb)['send'](_0x1481f3);};}exports['index']=function(_0x1594cc,_0x151214){var _0x13b713={},_0x3a66ed={},_0x145b8f={'count':0x0,'rows':[]};var _0x254134=_['map'](db[_0x06ae('0x2e')][_0x06ae('0x2f')],function(_0x2f578f){return{'name':_0x2f578f[_0x06ae('0x30')],'type':_0x2f578f['type'][_0x06ae('0x31')]};});_0x3a66ed['model']=_['map'](_0x254134,_0x06ae('0x2d'));_0x3a66ed[_0x06ae('0x32')]=_[_0x06ae('0x33')](_0x1594cc[_0x06ae('0x32')]);_0x3a66ed['filters']=_[_0x06ae('0x34')](_0x3a66ed[_0x06ae('0x35')],_0x3a66ed[_0x06ae('0x32')]);_0x13b713[_0x06ae('0x36')]=_[_0x06ae('0x34')](_0x3a66ed[_0x06ae('0x35')],qs[_0x06ae('0x37')](_0x1594cc['query'][_0x06ae('0x37')]));_0x13b713[_0x06ae('0x36')]=_0x13b713[_0x06ae('0x36')][_0x06ae('0x38')]?_0x13b713['attributes']:_0x3a66ed[_0x06ae('0x35')];if(!_0x1594cc[_0x06ae('0x32')][_0x06ae('0x39')]('nolimit')){_0x13b713['limit']=qs[_0x06ae('0x21')](_0x1594cc[_0x06ae('0x32')][_0x06ae('0x21')]);_0x13b713[_0x06ae('0x20')]=qs[_0x06ae('0x20')](_0x1594cc[_0x06ae('0x32')][_0x06ae('0x20')]);}_0x13b713['order']=qs['sort'](_0x1594cc[_0x06ae('0x32')][_0x06ae('0x3a')]);_0x13b713[_0x06ae('0x3b')]=qs['filters'](_[_0x06ae('0x3c')](_0x1594cc['query'],_0x3a66ed['filters']),_0x254134);if(_0x1594cc[_0x06ae('0x32')][_0x06ae('0x3d')]){_0x13b713['where']=_[_0x06ae('0x3e')](_0x13b713['where'],{'$or':_['map'](_0x254134,function(_0x930dba){if(_0x930dba[_0x06ae('0x3f')]!==_0x06ae('0x40')){var _0x587c61={};_0x587c61[_0x930dba[_0x06ae('0x2d')]]={'$like':'%'+_0x1594cc[_0x06ae('0x32')][_0x06ae('0x3d')]+'%'};return _0x587c61;}})});}_0x13b713=_['merge']({},_0x13b713,_0x1594cc[_0x06ae('0x41')]);var _0x4ca717={'where':_0x13b713['where']};return db[_0x06ae('0x2e')][_0x06ae('0x42')](_0x4ca717)[_0x06ae('0x28')](function(_0x3d95c9){_0x145b8f[_0x06ae('0x42')]=_0x3d95c9;if(_0x1594cc[_0x06ae('0x32')]['includeAll']){_0x13b713[_0x06ae('0x43')]=[{'all':!![]}];}return db[_0x06ae('0x2e')][_0x06ae('0x44')](_0x13b713);})['then'](function(_0x4b5012){_0x145b8f[_0x06ae('0x45')]=_0x4b5012;return _0x145b8f;})[_0x06ae('0x28')](respondWithFilteredResult(_0x151214,_0x13b713))[_0x06ae('0x46')](handleError(_0x151214,null));};exports[_0x06ae('0x47')]=function(_0x30dd58,_0x49f266){var _0x84bad1={'raw':!![],'where':{'id':_0x30dd58[_0x06ae('0x48')]['id']}},_0x4515b3={};_0x4515b3[_0x06ae('0x35')]=_[_0x06ae('0x33')](db[_0x06ae('0x2e')][_0x06ae('0x2f')]);_0x4515b3['query']=_[_0x06ae('0x33')](_0x30dd58[_0x06ae('0x32')]);_0x4515b3[_0x06ae('0x49')]=_[_0x06ae('0x34')](_0x4515b3['model'],_0x4515b3[_0x06ae('0x32')]);_0x84bad1[_0x06ae('0x36')]=_[_0x06ae('0x34')](_0x4515b3[_0x06ae('0x35')],qs['fields'](_0x30dd58[_0x06ae('0x32')][_0x06ae('0x37')]));_0x84bad1[_0x06ae('0x36')]=_0x84bad1[_0x06ae('0x36')]['length']?_0x84bad1[_0x06ae('0x36')]:_0x4515b3['model'];if(_0x30dd58['query'][_0x06ae('0x4a')]){_0x84bad1[_0x06ae('0x43')]=[{'all':!![]}];}_0x84bad1=_['merge']({},_0x84bad1,_0x30dd58['options']);return db[_0x06ae('0x2e')][_0x06ae('0x4b')](_0x84bad1)[_0x06ae('0x28')](handleEntityNotFound(_0x49f266,null))[_0x06ae('0x28')](respondWithResult(_0x49f266,null))[_0x06ae('0x46')](handleError(_0x49f266,null));};exports['create']=function(_0x323aac,_0x492ebf){return db[_0x06ae('0x2e')][_0x06ae('0x4c')](_0x323aac[_0x06ae('0x4d')],{})['then'](function(_0x136fda){var _0x1065ce=_0x323aac['user'][_0x06ae('0x4e')]({'plain':!![]});if(!_0x1065ce)throw new Error(_0x06ae('0x4f'));if(_0x1065ce[_0x06ae('0x50')]===_0x06ae('0x51')){var _0x5762de=_0x136fda[_0x06ae('0x4e')]({'plain':!![]});var _0x4852a3=_0x06ae('0x2a');return db[_0x06ae('0x52')]['find']({'where':{'name':_0x4852a3,'userProfileId':_0x1065ce['userProfileId']},'raw':!![]})[_0x06ae('0x28')](function(_0x36dd0a){if(_0x36dd0a&&_0x36dd0a['autoAssociation']===0x0){return db['UserProfileResource'][_0x06ae('0x4c')]({'name':_0x5762de[_0x06ae('0x2d')],'resourceId':_0x5762de['id'],'type':_0x36dd0a['name'],'sectionId':_0x36dd0a['id']},{})[_0x06ae('0x28')](function(){return _0x136fda;});}else{return _0x136fda;}})[_0x06ae('0x46')](function(_0x1b9b1b){logger[_0x06ae('0x53')](_0x06ae('0x54'),_0x1b9b1b);throw _0x1b9b1b;});}return _0x136fda;})[_0x06ae('0x28')](respondWithResult(_0x492ebf,0xc9))['catch'](handleError(_0x492ebf,null));};exports[_0x06ae('0x27')]=function(_0x11b0d1,_0x3970f8){if(_0x11b0d1[_0x06ae('0x4d')]['id']){delete _0x11b0d1[_0x06ae('0x4d')]['id'];}return db[_0x06ae('0x2e')][_0x06ae('0x4b')]({'where':{'id':_0x11b0d1[_0x06ae('0x48')]['id']}})['then'](handleEntityNotFound(_0x3970f8,null))[_0x06ae('0x28')](saveUpdates(_0x11b0d1['body'],null))['then'](respondWithResult(_0x3970f8,null))['catch'](handleError(_0x3970f8,null));};exports['destroy']=function(_0x148da4,_0xdf817a){return db[_0x06ae('0x2e')][_0x06ae('0x4b')]({'where':{'id':_0x148da4[_0x06ae('0x48')]['id']}})['then'](handleEntityNotFound(_0xdf817a,null))[_0x06ae('0x28')](removeEntity(_0xdf817a,null))[_0x06ae('0x46')](handleError(_0xdf817a,null));};exports['describe']=function(_0x32f702,_0x2f3892){return db['WhatsappQueue'][_0x06ae('0x55')]()[_0x06ae('0x28')](respondWithResult(_0x2f3892,null))[_0x06ae('0x46')](handleError(_0x2f3892,null));};exports[_0x06ae('0x56')]=function(_0x5315bb,_0x314e7e,_0x4cc2e8){var _0x2a1542={'raw':!![],'where':{}},_0x419ac7={},_0x34a4b7;return db[_0x06ae('0x2e')][_0x06ae('0x57')]({'where':{'id':_0x5315bb[_0x06ae('0x48')]['id']}})[_0x06ae('0x28')](handleEntityNotFound(_0x314e7e,null))['then'](function(_0xfb779){if(_0xfb779){_0x34a4b7=_0xfb779[_0x06ae('0x4e')]({'plain':!![]});_0x419ac7[_0x06ae('0x35')]=_['keys'](db['UserWhatsappQueue'][_0x06ae('0x2f')]);_0x419ac7[_0x06ae('0x32')]=_[_0x06ae('0x33')](_0x5315bb['query']);_0x419ac7[_0x06ae('0x49')]=_[_0x06ae('0x34')](_0x419ac7[_0x06ae('0x35')],_0x419ac7[_0x06ae('0x32')]);_0x2a1542['attributes']=_[_0x06ae('0x34')](_0x419ac7[_0x06ae('0x35')],qs['fields'](_0x5315bb[_0x06ae('0x32')][_0x06ae('0x37')]));_0x2a1542[_0x06ae('0x36')]=_0x2a1542[_0x06ae('0x36')][_0x06ae('0x38')]?_0x2a1542[_0x06ae('0x36')]:_0x419ac7[_0x06ae('0x35')];if(!_0x5315bb[_0x06ae('0x32')]['hasOwnProperty'](_0x06ae('0x58'))){_0x2a1542[_0x06ae('0x21')]=qs['limit'](_0x5315bb[_0x06ae('0x32')][_0x06ae('0x21')]);_0x2a1542[_0x06ae('0x20')]=qs['offset'](_0x5315bb['query'][_0x06ae('0x20')]);}_0x2a1542['order']=qs[_0x06ae('0x3a')](_0x5315bb[_0x06ae('0x32')][_0x06ae('0x3a')]);_0x2a1542[_0x06ae('0x3b')]=qs[_0x06ae('0x49')](_['pick'](_0x5315bb['query'],_0x419ac7[_0x06ae('0x49')]));_0x2a1542['where']['WhatsappQueueId']=_0xfb779['id'];if(_0x5315bb[_0x06ae('0x32')][_0x06ae('0x3d')]){_0x2a1542[_0x06ae('0x3b')]=_[_0x06ae('0x3e')](_0x2a1542[_0x06ae('0x3b')],{'$or':_[_0x06ae('0x59')](_0x2a1542['attributes'],function(_0x297dc5){var _0x3e9263={};_0x3e9263[_0x297dc5]={'$like':'%'+_0x5315bb[_0x06ae('0x32')]['filter']+'%'};return _0x3e9263;})});}_0x2a1542=_['merge']({},_0x2a1542,_0x5315bb[_0x06ae('0x41')]);return db[_0x06ae('0x5a')][_0x06ae('0x44')](_0x2a1542);}})['then'](function(_0x5c4d8c){if(_0x5c4d8c){return db[_0x06ae('0x5b')][_0x06ae('0x5c')]({'where':{'id':_[_0x06ae('0x59')](_0x5c4d8c,_0x06ae('0x5d')),'role':_0x06ae('0x5e')},'attributes':['id','name',_0x06ae('0x5f'),'updatedAt',_0x06ae('0x60')]});}})[_0x06ae('0x28')](function(_0xc68eb3){if(_0xc68eb3){return{'count':_0xc68eb3[_0x06ae('0x42')],'rows':_['map'](_0xc68eb3[_0x06ae('0x45')],function(_0x5cbd8a){return{'membername':_0x5cbd8a[_0x06ae('0x2d')],'UserId':_0x5cbd8a['id'],'queue_name':_0x34a4b7[_0x06ae('0x2d')],'WhatsappQueueId':_0x34a4b7['id'],'interface':util['format'](_0x06ae('0x61'),_0x06ae('0x62'),_0x5cbd8a[_0x06ae('0x2d')]),'penalty':0x0,'paused':_0x5cbd8a['whatsappPause'],'createdAt':_0x5cbd8a[_0x06ae('0x60')],'updatedAt':_0x5cbd8a[_0x06ae('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x314e7e,_0x2a1542))[_0x06ae('0x46')](handleError(_0x314e7e,null));};exports['getTeams']=function(_0x292445,_0x352a4f,_0x4d7f3f){var _0x1dc307={};var _0x3823f3={};var _0x4a3dac;var _0x1116b6;return db[_0x06ae('0x2e')][_0x06ae('0x57')]({'where':{'id':_0x292445['params']['id']}})[_0x06ae('0x28')](handleEntityNotFound(_0x352a4f,null))[_0x06ae('0x28')](function(_0xd2b677){if(_0xd2b677){_0x4a3dac=_0xd2b677;_0x3823f3[_0x06ae('0x35')]=_['keys'](db[_0x06ae('0x64')][_0x06ae('0x2f')]);_0x3823f3[_0x06ae('0x32')]=_[_0x06ae('0x33')](_0x292445[_0x06ae('0x32')]);_0x3823f3[_0x06ae('0x49')]=_[_0x06ae('0x34')](_0x3823f3[_0x06ae('0x35')],_0x3823f3[_0x06ae('0x32')]);_0x1dc307[_0x06ae('0x36')]=_['intersection'](_0x3823f3[_0x06ae('0x35')],qs[_0x06ae('0x37')](_0x292445['query'][_0x06ae('0x37')]));_0x1dc307[_0x06ae('0x36')]=_0x1dc307[_0x06ae('0x36')][_0x06ae('0x38')]?_0x1dc307['attributes']:_0x3823f3[_0x06ae('0x35')];_0x1dc307[_0x06ae('0x65')]=qs['sort'](_0x292445['query'][_0x06ae('0x3a')]);_0x1dc307['where']=qs[_0x06ae('0x49')](_[_0x06ae('0x3c')](_0x292445[_0x06ae('0x32')],_0x3823f3['filters']));if(_0x292445[_0x06ae('0x32')]['filter']){_0x1dc307['where']=_['merge'](_0x1dc307['where'],{'$or':_[_0x06ae('0x59')](_0x1dc307['attributes'],function(_0x505e6c){var _0x2dc67b={};_0x2dc67b[_0x505e6c]={'$like':'%'+_0x292445['query']['filter']+'%'};return _0x2dc67b;})});}_0x1dc307=_[_0x06ae('0x3e')]({},_0x1dc307,_0x292445[_0x06ae('0x41')]);return _0x4a3dac[_0x06ae('0x66')](_0x1dc307);}})[_0x06ae('0x28')](function(_0x485bb5){if(_0x485bb5){_0x1116b6=_0x485bb5[_0x06ae('0x38')];if(!_0x292445[_0x06ae('0x32')]['hasOwnProperty']('nolimit')){_0x1dc307[_0x06ae('0x21')]=qs[_0x06ae('0x21')](_0x292445[_0x06ae('0x32')][_0x06ae('0x21')]);_0x1dc307[_0x06ae('0x20')]=qs['offset'](_0x292445['query'][_0x06ae('0x20')]);}return _0x4a3dac['getTeams'](_0x1dc307);}})[_0x06ae('0x28')](function(_0x2c72fc){if(_0x2c72fc){return _0x2c72fc?{'count':_0x1116b6,'rows':_0x2c72fc}:null;}})[_0x06ae('0x28')](respondWithResult(_0x352a4f,null))[_0x06ae('0x46')](handleError(_0x352a4f,null));};exports[_0x06ae('0x67')]=function(_0x4c9006,_0x2a0306,_0x105a10){var _0x571a88=_0x4c9006[_0x06ae('0x4d')][_0x06ae('0x68')];return db['Team'][_0x06ae('0x44')]({'where':{'id':_0x571a88},'attributes':['id'],'include':[{'model':db[_0x06ae('0x5b')],'as':_0x06ae('0x69'),'attributes':['id',_0x06ae('0x2d'),'online',_0x06ae('0x6a'),_0x06ae('0x6b')],'raw':!![]}]})[_0x06ae('0x28')](function(_0x131480){if(_0x131480){var _0x5666e9=_['flatMap'](_0x131480,function(_0x5aa344){var _0x45eca4=_0x5aa344[_0x06ae('0x4e')]({'plain':!![]});return _0x45eca4[_0x06ae('0x69')];});return db[_0x06ae('0x2e')][_0x06ae('0x4b')]({'where':{'id':_0x4c9006[_0x06ae('0x48')]['id']}})[_0x06ae('0x28')](function(_0x40fde1){return db['sequelize']['transaction'](function(_0x4dc9cd){return _0x40fde1['addTeams'](_0x571a88,{'transaction':_0x4dc9cd})[_0x06ae('0x28')](function(){return BPromise[_0x06ae('0x6c')](_0x5666e9,function(_0x39db3c){return db[_0x06ae('0x5a')]['findOrCreate']({'where':{'UserId':_0x39db3c['id'],'WhatsappQueueId':_0x4c9006[_0x06ae('0x48')]['id']},'transaction':_0x4dc9cd});});})[_0x06ae('0x28')](function(){_0x5666e9[_0x06ae('0x6d')](function(_0x24f8c6){socket[_0x06ae('0x6e')](_0x06ae('0x6f'),{'UserId':_0x24f8c6['id'],'WhatsappQueueId':_0x40fde1['id']});});});});});}})['then'](respondWithStatusCode(_0x2a0306,null))[_0x06ae('0x46')](handleError(_0x2a0306,null));};exports[_0x06ae('0x70')]=function(_0x10a684,_0x34d001,_0x1ff64f){return db[_0x06ae('0x64')][_0x06ae('0x44')]({'where':{'id':_0x10a684['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x06ae('0x28')](handleEntityNotFound(_0x34d001,null))['then'](function(_0x1aab62){var _0x37652a=_[_0x06ae('0x59')](_0x1aab62,'id');var _0x31bce7=[];var _0x20a1ba=[];var _0x36ff0e=squel['select']();_0x36ff0e[_0x06ae('0x71')](_0x06ae('0x72'))['from']('team_has_whatsapp_queues','tq')['join']('user_has_teams','ut',_0x06ae('0x73'))[_0x06ae('0x3b')](_0x06ae('0x74'),_0x10a684['params']['id']);for(var _0x3bbd60=0x0;_0x3bbd60<_0x1aab62[_0x06ae('0x38')];_0x3bbd60+=0x1){let _0xfc03b9=_0x1aab62[_0x3bbd60];for(var _0x2779ad=0x0;_0x2779ad<_0xfc03b9[_0x06ae('0x69')][_0x06ae('0x38')];_0x2779ad+=0x1){let _0x47a752=_0xfc03b9[_0x06ae('0x69')][_0x2779ad];var _0x59791b=_0x36ff0e[_0x06ae('0x75')]();_0x59791b[_0x06ae('0x3b')](_0x06ae('0x76'),_0x47a752['id']);_0x20a1ba[_0x06ae('0x77')](db[_0x06ae('0x78')][_0x06ae('0x32')](_0x59791b[_0x06ae('0x79')](),{'type':db[_0x06ae('0x78')][_0x06ae('0x7a')]['SELECT']})['then'](function(_0x36c1e5){if(_0x36c1e5[_0x06ae('0x38')]===0x1){return _0x47a752['id'];}else{var _0x77de6d=_[_0x06ae('0x7b')](_['map'](_0x36c1e5,_0x06ae('0x7c')),function(_0x210ab2){return _[_0x06ae('0x7d')](_0x37652a,_0x210ab2);});if(_0x77de6d){return _0x47a752['id'];}}}));}}return BPromise[_0x06ae('0x7e')](_0x20a1ba)[_0x06ae('0x28')](function(_0x5d318f){_0x31bce7=_(_0x31bce7)[_0x06ae('0x7f')](_0x5d318f)[_0x06ae('0x80')]()[_0x06ae('0x81')]();return db[_0x06ae('0x2e')][_0x06ae('0x4b')]({'where':{'id':_0x10a684['params']['id']}})[_0x06ae('0x28')](function(_0x5d15ab){return db['sequelize'][_0x06ae('0x82')](function(_0x59a4d0){return _0x5d15ab[_0x06ae('0x70')](_0x10a684[_0x06ae('0x32')][_0x06ae('0x68')],{'transaction':_0x59a4d0})[_0x06ae('0x28')](function(){if(!_['isEmpty'](_0x31bce7)){return _0x5d15ab[_0x06ae('0x83')](_0x31bce7,{'transaction':_0x59a4d0});}})[_0x06ae('0x28')](function(){_0x31bce7[_0x06ae('0x6d')](function(_0xb251fa){socket[_0x06ae('0x6e')](_0x06ae('0x84'),{'UserId':_0xb251fa,'WhatsappQueueId':_0x5d15ab['id']});});});});});});})[_0x06ae('0x28')](respondWithStatusCode(_0x34d001,null))[_0x06ae('0x46')](handleError(_0x34d001,null));};exports[_0x06ae('0x85')]=function(_0x194ccc,_0x58fea0,_0x1983a0){return db[_0x06ae('0x2e')]['find']({'where':{'id':_0x194ccc[_0x06ae('0x48')]['id']}})[_0x06ae('0x28')](handleEntityNotFound(_0x58fea0,null))[_0x06ae('0x28')](function(_0x2ff426){if(_0x2ff426){return _0x2ff426[_0x06ae('0x85')](_0x194ccc['body'][_0x06ae('0x68')],_[_0x06ae('0x86')](_0x194ccc['body'],[_0x06ae('0x68'),'id'])||{})['spread'](function(_0x466f98){for(var _0xa3a764=0x0;_0xa3a764<_0x194ccc[_0x06ae('0x4d')][_0x06ae('0x68')]['length'];_0xa3a764+=0x1){socket[_0x06ae('0x6e')](_0x06ae('0x6f'),{'UserId':_0x194ccc[_0x06ae('0x4d')][_0x06ae('0x68')][_0xa3a764],'WhatsappQueueId':_0x194ccc['params']['id']});}return _0x466f98;});}})[_0x06ae('0x28')](respondWithResult(_0x58fea0,null))[_0x06ae('0x46')](handleError(_0x58fea0,null));};exports[_0x06ae('0x83')]=function(_0x32baaf,_0x25a7f2,_0x576832){return db[_0x06ae('0x2e')][_0x06ae('0x4b')]({'where':{'id':_0x32baaf[_0x06ae('0x48')]['id']}})[_0x06ae('0x28')](handleEntityNotFound(_0x25a7f2,null))['then'](function(_0x3bb446){if(_0x3bb446){return _0x3bb446[_0x06ae('0x83')](_0x32baaf['query'][_0x06ae('0x68')])[_0x06ae('0x28')](function(){if(_['isArray'](_0x32baaf[_0x06ae('0x32')][_0x06ae('0x68')])){for(var _0x1b1708=0x0;_0x1b1708<_0x32baaf[_0x06ae('0x32')][_0x06ae('0x68')][_0x06ae('0x38')];_0x1b1708+=0x1){socket[_0x06ae('0x6e')](_0x06ae('0x84'),{'UserId':Number(_0x32baaf[_0x06ae('0x32')]['ids'][_0x1b1708]),'WhatsappQueueId':Number(_0x32baaf['params']['id'])});}}else{socket[_0x06ae('0x6e')](_0x06ae('0x84'),{'UserId':Number(_0x32baaf[_0x06ae('0x32')][_0x06ae('0x68')]),'WhatsappQueueId':Number(_0x32baaf['params']['id'])});}});}})[_0x06ae('0x28')](respondWithStatusCode(_0x25a7f2,null))[_0x06ae('0x46')](handleError(_0x25a7f2,null));};exports[_0x06ae('0x87')]=function(_0x2e0966,_0x442c5b,_0x14b2be){var _0xc0021c={};var _0x12c270={};var _0x511d23;var _0x50446f;return db[_0x06ae('0x2e')]['findOne']({'where':{'id':_0x2e0966['params']['id']}})[_0x06ae('0x28')](handleEntityNotFound(_0x442c5b,null))[_0x06ae('0x28')](function(_0x1736f3){if(_0x1736f3){_0x511d23=_0x1736f3;_0x12c270[_0x06ae('0x35')]=_[_0x06ae('0x33')](db[_0x06ae('0x5b')][_0x06ae('0x2f')]);_0x12c270['query']=_[_0x06ae('0x33')](_0x2e0966[_0x06ae('0x32')]);_0x12c270[_0x06ae('0x49')]=_['intersection'](_0x12c270[_0x06ae('0x35')],_0x12c270[_0x06ae('0x32')]);_0xc0021c[_0x06ae('0x36')]=_['intersection'](_0x12c270[_0x06ae('0x35')],qs['fields'](_0x2e0966['query']['fields']));_0xc0021c[_0x06ae('0x36')]=_0xc0021c['attributes'][_0x06ae('0x38')]?_0xc0021c[_0x06ae('0x36')]:_0x12c270[_0x06ae('0x35')];_0xc0021c[_0x06ae('0x65')]=qs['sort'](_0x2e0966[_0x06ae('0x32')][_0x06ae('0x3a')]);_0xc0021c['where']=qs[_0x06ae('0x49')](_['pick'](_0x2e0966[_0x06ae('0x32')],_0x12c270[_0x06ae('0x49')]));if(_0x2e0966[_0x06ae('0x32')][_0x06ae('0x3d')]){_0xc0021c[_0x06ae('0x3b')]=_['merge'](_0xc0021c['where'],{'$or':_[_0x06ae('0x59')](_0xc0021c['attributes'],function(_0x5b7619){var _0x2d7e66={};_0x2d7e66[_0x5b7619]={'$like':'%'+_0x2e0966[_0x06ae('0x32')][_0x06ae('0x3d')]+'%'};return _0x2d7e66;})});}_0xc0021c=_[_0x06ae('0x3e')]({},_0xc0021c,_0x2e0966[_0x06ae('0x41')]);return _0x511d23['getAgents'](_0xc0021c);}})[_0x06ae('0x28')](function(_0x1f0b92){if(_0x1f0b92){_0x50446f=_0x1f0b92[_0x06ae('0x38')];if(!_0x2e0966[_0x06ae('0x32')]['hasOwnProperty'](_0x06ae('0x58'))){_0xc0021c[_0x06ae('0x21')]=qs[_0x06ae('0x21')](_0x2e0966[_0x06ae('0x32')][_0x06ae('0x21')]);_0xc0021c[_0x06ae('0x20')]=qs['offset'](_0x2e0966[_0x06ae('0x32')][_0x06ae('0x20')]);}return _0x511d23['getAgents'](_0xc0021c);}})['then'](function(_0x2ac969){if(_0x2ac969){return _0x2ac969?{'count':_0x50446f,'rows':_0x2ac969}:null;}})[_0x06ae('0x28')](respondWithResult(_0x442c5b,null))[_0x06ae('0x46')](handleError(_0x442c5b,null));}; \ No newline at end of file +var _0x97aa=['end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','get','WhatsappQueues','stack','name','map','WhatsappQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','destroy','describe','getMembers','UserWhatsappQueue','findAll','User','UserId','whatsappPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','ids','Agents','voicePause','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','field','tq.TeamId','from','user_has_teams','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','transaction','removeTeams','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status'];(function(_0x2c350c,_0x2d308e){var _0x5bc5a0=function(_0x227730){while(--_0x227730){_0x2c350c['push'](_0x2c350c['shift']());}};_0x5bc5a0(++_0x2d308e);}(_0x97aa,0xf2));var _0xa97a=function(_0x2c3483,_0x22f134){_0x2c3483=_0x2c3483-0x0;var _0x4e945f=_0x97aa[_0x2c3483];return _0x4e945f;};'use strict';var pdf=require(_0xa97a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa97a('0x1'));var zipdir=require(_0xa97a('0x2'));var jsonpatch=require(_0xa97a('0x3'));var rp=require(_0xa97a('0x4'));var moment=require(_0xa97a('0x5'));var BPromise=require(_0xa97a('0x6'));var Mustache=require(_0xa97a('0x7'));var util=require('util');var path=require(_0xa97a('0x8'));var sox=require(_0xa97a('0x9'));var csv=require(_0xa97a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa97a('0xb'));var _=require(_0xa97a('0xc'));var squel=require(_0xa97a('0xd'));var crypto=require(_0xa97a('0xe'));var jsforce=require(_0xa97a('0xf'));var deskjs=require(_0xa97a('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa97a('0x11'));var Papa=require('papaparse');var Redis=require(_0xa97a('0x12'));var authService=require(_0xa97a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa97a('0x14'));var hardwareService=require(_0xa97a('0x15'));var logger=require(_0xa97a('0x16'))(_0xa97a('0x17'));var utils=require('../../config/utils');var config=require(_0xa97a('0x18'));var licenseUtil=require(_0xa97a('0x19'));var db=require(_0xa97a('0x1a'))['db'];config[_0xa97a('0x1b')]=_[_0xa97a('0x1c')](config[_0xa97a('0x1b')],{'host':_0xa97a('0x1d'),'port':0x18eb});var socket=require(_0xa97a('0x1e'))(new Redis(config['redis']));require(_0xa97a('0x1f'))[_0xa97a('0x20')](socket);function respondWithStatusCode(_0x30585a,_0x33de2c){_0x33de2c=_0x33de2c||0xcc;return function(_0x5439c1){if(_0x5439c1){return _0x30585a['sendStatus'](_0x33de2c);}return _0x30585a[_0xa97a('0x21')](_0x33de2c)[_0xa97a('0x22')]();};}function respondWithResult(_0x325ca9,_0x48aaac){_0x48aaac=_0x48aaac||0xc8;return function(_0x3c2d52){if(_0x3c2d52){return _0x325ca9[_0xa97a('0x21')](_0x48aaac)['json'](_0x3c2d52);}};}function respondWithFilteredResult(_0x1e2f5c,_0x12fa84){return function(_0x259455){if(_0x259455){var _0x1d4dde=_0x259455[_0xa97a('0x23')],_0x585de2=_0x12fa84[_0xa97a('0x24')],_0x3866f4=_0x12fa84[_0xa97a('0x24')]+_0x12fa84[_0xa97a('0x25')],_0x3da3f3;if(_0x3866f4>=_0x1d4dde){_0x3866f4=_0x1d4dde;_0x3da3f3=0xc8;}else{_0x3da3f3=0xce;}_0x1e2f5c[_0xa97a('0x21')](_0x3da3f3);return _0x1e2f5c['set'](_0xa97a('0x26'),_0x585de2+'-'+_0x3866f4+'/'+_0x1d4dde)[_0xa97a('0x27')](_0x259455);}return null;};}function patchUpdates(_0x403086){return function(_0x34ed4c){try{jsonpatch[_0xa97a('0x28')](_0x34ed4c,_0x403086,!![]);}catch(_0x125a31){return BPromise[_0xa97a('0x29')](_0x125a31);}return _0x34ed4c[_0xa97a('0x2a')]();};}function saveUpdates(_0x3ec85b,_0x3b329b){return function(_0x26b7d6){if(_0x26b7d6){return _0x26b7d6[_0xa97a('0x2b')](_0x3ec85b)['then'](function(_0x1ccda7){return _0x1ccda7;});}return null;};}function removeEntity(_0x407ba1,_0x4a53ed){return function(_0x28995b){if(_0x28995b){return _0x28995b['destroy']()[_0xa97a('0x2c')](function(){var _0x13a428=_0x28995b[_0xa97a('0x2d')]({'plain':!![]});var _0x56eb81=_0xa97a('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x56eb81,'resourceId':_0x13a428['id']}})[_0xa97a('0x2c')](function(){return _0x28995b;});})['then'](function(){_0x407ba1['status'](0xcc)[_0xa97a('0x22')]();});}};}function handleEntityNotFound(_0x3d3d13,_0x2b260d){return function(_0x46fdcf){if(!_0x46fdcf){_0x3d3d13['sendStatus'](0x194);}return _0x46fdcf;};}function handleError(_0x1ccb12,_0x34c6a2){_0x34c6a2=_0x34c6a2||0x1f4;return function(_0x1efc0a){logger['error'](_0x1efc0a[_0xa97a('0x2f')]);if(_0x1efc0a[_0xa97a('0x30')]){delete _0x1efc0a[_0xa97a('0x30')];}_0x1ccb12['status'](_0x34c6a2)['send'](_0x1efc0a);};}exports['index']=function(_0x4cf676,_0x6cbc9a){var _0x379d30={},_0x3f3e5a={},_0xc82437={'count':0x0,'rows':[]};var _0x2b1391=_[_0xa97a('0x31')](db[_0xa97a('0x32')]['rawAttributes'],function(_0x1d60e2){return{'name':_0x1d60e2[_0xa97a('0x33')],'type':_0x1d60e2[_0xa97a('0x34')][_0xa97a('0x35')]};});_0x3f3e5a[_0xa97a('0x36')]=_['map'](_0x2b1391,_0xa97a('0x30'));_0x3f3e5a[_0xa97a('0x37')]=_[_0xa97a('0x38')](_0x4cf676[_0xa97a('0x37')]);_0x3f3e5a[_0xa97a('0x39')]=_[_0xa97a('0x3a')](_0x3f3e5a['model'],_0x3f3e5a['query']);_0x379d30[_0xa97a('0x3b')]=_[_0xa97a('0x3a')](_0x3f3e5a[_0xa97a('0x36')],qs[_0xa97a('0x3c')](_0x4cf676['query']['fields']));_0x379d30[_0xa97a('0x3b')]=_0x379d30['attributes'][_0xa97a('0x3d')]?_0x379d30['attributes']:_0x3f3e5a['model'];if(!_0x4cf676[_0xa97a('0x37')][_0xa97a('0x3e')](_0xa97a('0x3f'))){_0x379d30[_0xa97a('0x25')]=qs[_0xa97a('0x25')](_0x4cf676[_0xa97a('0x37')]['limit']);_0x379d30['offset']=qs['offset'](_0x4cf676[_0xa97a('0x37')]['offset']);}_0x379d30[_0xa97a('0x40')]=qs[_0xa97a('0x41')](_0x4cf676[_0xa97a('0x37')][_0xa97a('0x41')]);_0x379d30['where']=qs[_0xa97a('0x39')](_[_0xa97a('0x42')](_0x4cf676['query'],_0x3f3e5a['filters']),_0x2b1391);if(_0x4cf676[_0xa97a('0x37')][_0xa97a('0x43')]){_0x379d30[_0xa97a('0x44')]=_[_0xa97a('0x45')](_0x379d30['where'],{'$or':_['map'](_0x2b1391,function(_0x5dd689){if(_0x5dd689['type']!==_0xa97a('0x46')){var _0x1b8977={};_0x1b8977[_0x5dd689[_0xa97a('0x30')]]={'$like':'%'+_0x4cf676[_0xa97a('0x37')][_0xa97a('0x43')]+'%'};return _0x1b8977;}})});}_0x379d30=_[_0xa97a('0x45')]({},_0x379d30,_0x4cf676[_0xa97a('0x47')]);var _0x9ca217={'where':_0x379d30[_0xa97a('0x44')]};return db[_0xa97a('0x32')][_0xa97a('0x23')](_0x9ca217)['then'](function(_0x37cf14){_0xc82437[_0xa97a('0x23')]=_0x37cf14;if(_0x4cf676['query'][_0xa97a('0x48')]){_0x379d30['include']=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x379d30);})[_0xa97a('0x2c')](function(_0xc2d1b2){_0xc82437[_0xa97a('0x49')]=_0xc2d1b2;return _0xc82437;})['then'](respondWithFilteredResult(_0x6cbc9a,_0x379d30))[_0xa97a('0x4a')](handleError(_0x6cbc9a,null));};exports[_0xa97a('0x4b')]=function(_0x223d3f,_0x521366){var _0x498c48={'raw':!![],'where':{'id':_0x223d3f[_0xa97a('0x4c')]['id']}},_0x3aeba8={};_0x3aeba8[_0xa97a('0x36')]=_[_0xa97a('0x38')](db[_0xa97a('0x32')][_0xa97a('0x4d')]);_0x3aeba8[_0xa97a('0x37')]=_['keys'](_0x223d3f[_0xa97a('0x37')]);_0x3aeba8[_0xa97a('0x39')]=_[_0xa97a('0x3a')](_0x3aeba8[_0xa97a('0x36')],_0x3aeba8[_0xa97a('0x37')]);_0x498c48['attributes']=_[_0xa97a('0x3a')](_0x3aeba8[_0xa97a('0x36')],qs[_0xa97a('0x3c')](_0x223d3f['query'][_0xa97a('0x3c')]));_0x498c48[_0xa97a('0x3b')]=_0x498c48[_0xa97a('0x3b')]['length']?_0x498c48[_0xa97a('0x3b')]:_0x3aeba8[_0xa97a('0x36')];if(_0x223d3f['query'][_0xa97a('0x48')]){_0x498c48[_0xa97a('0x4e')]=[{'all':!![]}];}_0x498c48=_[_0xa97a('0x45')]({},_0x498c48,_0x223d3f[_0xa97a('0x47')]);return db[_0xa97a('0x32')]['find'](_0x498c48)[_0xa97a('0x2c')](handleEntityNotFound(_0x521366,null))[_0xa97a('0x2c')](respondWithResult(_0x521366,null))['catch'](handleError(_0x521366,null));};exports[_0xa97a('0x4f')]=function(_0x314ed1,_0x506653){return db[_0xa97a('0x32')]['create'](_0x314ed1[_0xa97a('0x50')],{})[_0xa97a('0x2c')](function(_0x2c9d2e){var _0x1f659d=_0x314ed1[_0xa97a('0x51')][_0xa97a('0x2d')]({'plain':!![]});if(!_0x1f659d)throw new Error(_0xa97a('0x52'));if(_0x1f659d[_0xa97a('0x53')]===_0xa97a('0x51')){var _0x465e3f=_0x2c9d2e['get']({'plain':!![]});var _0x41143d=_0xa97a('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x41143d,'userProfileId':_0x1f659d[_0xa97a('0x54')]},'raw':!![]})[_0xa97a('0x2c')](function(_0x4dc1b5){if(_0x4dc1b5&&_0x4dc1b5[_0xa97a('0x55')]===0x0){return db[_0xa97a('0x56')][_0xa97a('0x4f')]({'name':_0x465e3f[_0xa97a('0x30')],'resourceId':_0x465e3f['id'],'type':_0x4dc1b5['name'],'sectionId':_0x4dc1b5['id']},{})[_0xa97a('0x2c')](function(){return _0x2c9d2e;});}else{return _0x2c9d2e;}})[_0xa97a('0x4a')](function(_0x1a10e2){logger[_0xa97a('0x57')](_0xa97a('0x58'),_0x1a10e2);throw _0x1a10e2;});}return _0x2c9d2e;})[_0xa97a('0x2c')](respondWithResult(_0x506653,0xc9))[_0xa97a('0x4a')](handleError(_0x506653,null));};exports['update']=function(_0x59d6e1,_0x4dc6c5){if(_0x59d6e1[_0xa97a('0x50')]['id']){delete _0x59d6e1['body']['id'];}return db[_0xa97a('0x32')][_0xa97a('0x59')]({'where':{'id':_0x59d6e1['params']['id']}})[_0xa97a('0x2c')](handleEntityNotFound(_0x4dc6c5,null))[_0xa97a('0x2c')](saveUpdates(_0x59d6e1[_0xa97a('0x50')],null))[_0xa97a('0x2c')](respondWithResult(_0x4dc6c5,null))[_0xa97a('0x4a')](handleError(_0x4dc6c5,null));};exports[_0xa97a('0x5a')]=function(_0x538388,_0x48f1aa){return db[_0xa97a('0x32')][_0xa97a('0x59')]({'where':{'id':_0x538388[_0xa97a('0x4c')]['id']}})[_0xa97a('0x2c')](handleEntityNotFound(_0x48f1aa,null))[_0xa97a('0x2c')](removeEntity(_0x48f1aa,null))[_0xa97a('0x4a')](handleError(_0x48f1aa,null));};exports[_0xa97a('0x5b')]=function(_0x3fee63,_0x23407a){return db[_0xa97a('0x32')][_0xa97a('0x5b')]()[_0xa97a('0x2c')](respondWithResult(_0x23407a,null))['catch'](handleError(_0x23407a,null));};exports[_0xa97a('0x5c')]=function(_0x1c6d0b,_0x5d2f12,_0x532e1f){var _0x5f1d1d={'raw':!![],'where':{}},_0x528132={},_0x163adc;return db['WhatsappQueue']['findOne']({'where':{'id':_0x1c6d0b[_0xa97a('0x4c')]['id']}})[_0xa97a('0x2c')](handleEntityNotFound(_0x5d2f12,null))['then'](function(_0xb4ae64){if(_0xb4ae64){_0x163adc=_0xb4ae64[_0xa97a('0x2d')]({'plain':!![]});_0x528132[_0xa97a('0x36')]=_['keys'](db[_0xa97a('0x5d')][_0xa97a('0x4d')]);_0x528132[_0xa97a('0x37')]=_[_0xa97a('0x38')](_0x1c6d0b['query']);_0x528132[_0xa97a('0x39')]=_[_0xa97a('0x3a')](_0x528132['model'],_0x528132['query']);_0x5f1d1d[_0xa97a('0x3b')]=_[_0xa97a('0x3a')](_0x528132[_0xa97a('0x36')],qs['fields'](_0x1c6d0b[_0xa97a('0x37')][_0xa97a('0x3c')]));_0x5f1d1d['attributes']=_0x5f1d1d[_0xa97a('0x3b')]['length']?_0x5f1d1d[_0xa97a('0x3b')]:_0x528132[_0xa97a('0x36')];if(!_0x1c6d0b[_0xa97a('0x37')]['hasOwnProperty'](_0xa97a('0x3f'))){_0x5f1d1d[_0xa97a('0x25')]=qs[_0xa97a('0x25')](_0x1c6d0b[_0xa97a('0x37')][_0xa97a('0x25')]);_0x5f1d1d[_0xa97a('0x24')]=qs[_0xa97a('0x24')](_0x1c6d0b[_0xa97a('0x37')]['offset']);}_0x5f1d1d[_0xa97a('0x40')]=qs[_0xa97a('0x41')](_0x1c6d0b[_0xa97a('0x37')]['sort']);_0x5f1d1d['where']=qs[_0xa97a('0x39')](_[_0xa97a('0x42')](_0x1c6d0b[_0xa97a('0x37')],_0x528132[_0xa97a('0x39')]));_0x5f1d1d['where']['WhatsappQueueId']=_0xb4ae64['id'];if(_0x1c6d0b[_0xa97a('0x37')][_0xa97a('0x43')]){_0x5f1d1d['where']=_[_0xa97a('0x45')](_0x5f1d1d[_0xa97a('0x44')],{'$or':_[_0xa97a('0x31')](_0x5f1d1d[_0xa97a('0x3b')],function(_0x4d499d){var _0x4faef2={};_0x4faef2[_0x4d499d]={'$like':'%'+_0x1c6d0b[_0xa97a('0x37')][_0xa97a('0x43')]+'%'};return _0x4faef2;})});}_0x5f1d1d=_[_0xa97a('0x45')]({},_0x5f1d1d,_0x1c6d0b[_0xa97a('0x47')]);return db[_0xa97a('0x5d')][_0xa97a('0x5e')](_0x5f1d1d);}})[_0xa97a('0x2c')](function(_0x5d8840){if(_0x5d8840){return db[_0xa97a('0x5f')]['findAndCountAll']({'where':{'id':_[_0xa97a('0x31')](_0x5d8840,_0xa97a('0x60')),'role':'agent'},'attributes':['id',_0xa97a('0x30'),_0xa97a('0x61'),_0xa97a('0x62'),_0xa97a('0x63')]});}})[_0xa97a('0x2c')](function(_0x33c5e1){if(_0x33c5e1){return{'count':_0x33c5e1[_0xa97a('0x23')],'rows':_[_0xa97a('0x31')](_0x33c5e1[_0xa97a('0x49')],function(_0x3be1f4){return{'membername':_0x3be1f4[_0xa97a('0x30')],'UserId':_0x3be1f4['id'],'queue_name':_0x163adc[_0xa97a('0x30')],'WhatsappQueueId':_0x163adc['id'],'interface':util['format'](_0xa97a('0x64'),_0xa97a('0x65'),_0x3be1f4[_0xa97a('0x30')]),'penalty':0x0,'paused':_0x3be1f4[_0xa97a('0x61')],'createdAt':_0x3be1f4[_0xa97a('0x63')],'updatedAt':_0x3be1f4[_0xa97a('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa97a('0x2c')](respondWithFilteredResult(_0x5d2f12,_0x5f1d1d))['catch'](handleError(_0x5d2f12,null));};exports['getTeams']=function(_0x573be3,_0x5cc729,_0x29b9ab){var _0x427462={};var _0x3180f6={};var _0x46eb8b;var _0x1a98c8;return db[_0xa97a('0x32')]['findOne']({'where':{'id':_0x573be3[_0xa97a('0x4c')]['id']}})[_0xa97a('0x2c')](handleEntityNotFound(_0x5cc729,null))['then'](function(_0x22c5ce){if(_0x22c5ce){_0x46eb8b=_0x22c5ce;_0x3180f6['model']=_['keys'](db[_0xa97a('0x66')]['rawAttributes']);_0x3180f6[_0xa97a('0x37')]=_[_0xa97a('0x38')](_0x573be3[_0xa97a('0x37')]);_0x3180f6[_0xa97a('0x39')]=_[_0xa97a('0x3a')](_0x3180f6['model'],_0x3180f6[_0xa97a('0x37')]);_0x427462[_0xa97a('0x3b')]=_[_0xa97a('0x3a')](_0x3180f6[_0xa97a('0x36')],qs[_0xa97a('0x3c')](_0x573be3['query'][_0xa97a('0x3c')]));_0x427462['attributes']=_0x427462['attributes'][_0xa97a('0x3d')]?_0x427462['attributes']:_0x3180f6[_0xa97a('0x36')];_0x427462[_0xa97a('0x40')]=qs[_0xa97a('0x41')](_0x573be3[_0xa97a('0x37')]['sort']);_0x427462[_0xa97a('0x44')]=qs[_0xa97a('0x39')](_['pick'](_0x573be3['query'],_0x3180f6['filters']));if(_0x573be3[_0xa97a('0x37')]['filter']){_0x427462[_0xa97a('0x44')]=_[_0xa97a('0x45')](_0x427462[_0xa97a('0x44')],{'$or':_[_0xa97a('0x31')](_0x427462[_0xa97a('0x3b')],function(_0x30d40b){var _0x55cde1={};_0x55cde1[_0x30d40b]={'$like':'%'+_0x573be3['query'][_0xa97a('0x43')]+'%'};return _0x55cde1;})});}_0x427462=_[_0xa97a('0x45')]({},_0x427462,_0x573be3[_0xa97a('0x47')]);return _0x46eb8b[_0xa97a('0x67')](_0x427462);}})[_0xa97a('0x2c')](function(_0x3eb569){if(_0x3eb569){_0x1a98c8=_0x3eb569['length'];if(!_0x573be3[_0xa97a('0x37')][_0xa97a('0x3e')](_0xa97a('0x3f'))){_0x427462['limit']=qs[_0xa97a('0x25')](_0x573be3[_0xa97a('0x37')]['limit']);_0x427462[_0xa97a('0x24')]=qs[_0xa97a('0x24')](_0x573be3[_0xa97a('0x37')]['offset']);}return _0x46eb8b[_0xa97a('0x67')](_0x427462);}})[_0xa97a('0x2c')](function(_0x3d3735){if(_0x3d3735){return _0x3d3735?{'count':_0x1a98c8,'rows':_0x3d3735}:null;}})[_0xa97a('0x2c')](respondWithResult(_0x5cc729,null))[_0xa97a('0x4a')](handleError(_0x5cc729,null));};exports['addTeams']=function(_0x1f6410,_0x433076,_0xc6f445){var _0x5a5b0f=_0x1f6410[_0xa97a('0x50')][_0xa97a('0x68')];return db['Team'][_0xa97a('0x5e')]({'where':{'id':_0x5a5b0f},'attributes':['id'],'include':[{'model':db[_0xa97a('0x5f')],'as':_0xa97a('0x69'),'attributes':['id','name','online',_0xa97a('0x6a'),'interface'],'raw':!![]}]})[_0xa97a('0x2c')](function(_0x16d478){if(_0x16d478){var _0x574658=_['flatMap'](_0x16d478,function(_0xd60ffe){var _0x3e42e4=_0xd60ffe[_0xa97a('0x2d')]({'plain':!![]});return _0x3e42e4[_0xa97a('0x69')];});return db[_0xa97a('0x32')][_0xa97a('0x59')]({'where':{'id':_0x1f6410[_0xa97a('0x4c')]['id']}})['then'](function(_0xb31445){return db['sequelize']['transaction'](function(_0x58ab3d){return _0xb31445[_0xa97a('0x6b')](_0x5a5b0f,{'transaction':_0x58ab3d})[_0xa97a('0x2c')](function(){return BPromise[_0xa97a('0x6c')](_0x574658,function(_0xa7f2ae){return db[_0xa97a('0x5d')][_0xa97a('0x6d')]({'where':{'UserId':_0xa7f2ae['id'],'WhatsappQueueId':_0x1f6410[_0xa97a('0x4c')]['id']},'transaction':_0x58ab3d});});})[_0xa97a('0x2c')](function(){_0x574658[_0xa97a('0x6e')](function(_0xb34a38){socket[_0xa97a('0x6f')](_0xa97a('0x70'),{'UserId':_0xb34a38['id'],'WhatsappQueueId':_0xb31445['id']});});});});});}})[_0xa97a('0x2c')](respondWithStatusCode(_0x433076,null))[_0xa97a('0x4a')](handleError(_0x433076,null));};exports['removeTeams']=function(_0x92ad35,_0x5ded5a,_0x2959b2){return db[_0xa97a('0x66')][_0xa97a('0x5e')]({'where':{'id':_0x92ad35['query'][_0xa97a('0x68')]},'attributes':['id'],'include':[{'model':db[_0xa97a('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa97a('0x2c')](handleEntityNotFound(_0x5ded5a,null))[_0xa97a('0x2c')](function(_0x2c1b58){var _0x41ba49=_[_0xa97a('0x31')](_0x2c1b58,'id');var _0x50ae9c=[];var _0x104824=[];var _0x52b1dc=squel['select']();_0x52b1dc[_0xa97a('0x71')](_0xa97a('0x72'))[_0xa97a('0x73')]('team_has_whatsapp_queues','tq')['join'](_0xa97a('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa97a('0x44')]('WhatsappQueueId\x20=\x20?',_0x92ad35[_0xa97a('0x4c')]['id']);for(var _0x42d5d2=0x0;_0x42d5d2<_0x2c1b58['length'];_0x42d5d2+=0x1){let _0x355ab6=_0x2c1b58[_0x42d5d2];for(var _0x554867=0x0;_0x554867<_0x355ab6['Agents'][_0xa97a('0x3d')];_0x554867+=0x1){let _0x144f90=_0x355ab6['Agents'][_0x554867];var _0x357771=_0x52b1dc[_0xa97a('0x75')]();_0x357771[_0xa97a('0x44')](_0xa97a('0x76'),_0x144f90['id']);_0x104824[_0xa97a('0x77')](db[_0xa97a('0x78')][_0xa97a('0x37')](_0x357771[_0xa97a('0x79')](),{'type':db[_0xa97a('0x78')][_0xa97a('0x7a')][_0xa97a('0x7b')]})[_0xa97a('0x2c')](function(_0x14dc82){if(_0x14dc82[_0xa97a('0x3d')]===0x1){return _0x144f90['id'];}else{var _0x55539f=_['every'](_['map'](_0x14dc82,_0xa97a('0x7c')),function(_0x4f1f15){return _[_0xa97a('0x7d')](_0x41ba49,_0x4f1f15);});if(_0x55539f){return _0x144f90['id'];}}}));}}return BPromise[_0xa97a('0x7e')](_0x104824)[_0xa97a('0x2c')](function(_0x5a19de){_0x50ae9c=_(_0x50ae9c)[_0xa97a('0x7f')](_0x5a19de)[_0xa97a('0x80')]()['value']();return db[_0xa97a('0x32')]['find']({'where':{'id':_0x92ad35[_0xa97a('0x4c')]['id']}})[_0xa97a('0x2c')](function(_0x189be3){return db[_0xa97a('0x78')][_0xa97a('0x81')](function(_0x5ca975){return _0x189be3[_0xa97a('0x82')](_0x92ad35[_0xa97a('0x37')][_0xa97a('0x68')],{'transaction':_0x5ca975})[_0xa97a('0x2c')](function(){if(!_[_0xa97a('0x83')](_0x50ae9c)){return _0x189be3[_0xa97a('0x84')](_0x50ae9c,{'transaction':_0x5ca975});}})[_0xa97a('0x2c')](function(){_0x50ae9c[_0xa97a('0x6e')](function(_0x251a43){socket[_0xa97a('0x6f')](_0xa97a('0x85'),{'UserId':_0x251a43,'WhatsappQueueId':_0x189be3['id']});});});});});});})[_0xa97a('0x2c')](respondWithStatusCode(_0x5ded5a,null))[_0xa97a('0x4a')](handleError(_0x5ded5a,null));};exports[_0xa97a('0x86')]=function(_0x2b2689,_0x354c1a,_0x89dc27){return db[_0xa97a('0x32')]['find']({'where':{'id':_0x2b2689['params']['id']}})[_0xa97a('0x2c')](handleEntityNotFound(_0x354c1a,null))['then'](function(_0x1ebd59){if(_0x1ebd59){return _0x1ebd59[_0xa97a('0x86')](_0x2b2689['body'][_0xa97a('0x68')],_[_0xa97a('0x87')](_0x2b2689['body'],[_0xa97a('0x68'),'id'])||{})['spread'](function(_0x2b044c){for(var _0x515597=0x0;_0x515597<_0x2b2689[_0xa97a('0x50')][_0xa97a('0x68')][_0xa97a('0x3d')];_0x515597+=0x1){socket[_0xa97a('0x6f')](_0xa97a('0x70'),{'UserId':_0x2b2689[_0xa97a('0x50')][_0xa97a('0x68')][_0x515597],'WhatsappQueueId':_0x2b2689['params']['id']});}return _0x2b044c;});}})[_0xa97a('0x2c')](respondWithResult(_0x354c1a,null))[_0xa97a('0x4a')](handleError(_0x354c1a,null));};exports[_0xa97a('0x84')]=function(_0x20ac40,_0x25af7e,_0x2c6a20){return db[_0xa97a('0x32')][_0xa97a('0x59')]({'where':{'id':_0x20ac40[_0xa97a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x25af7e,null))[_0xa97a('0x2c')](function(_0x5980bc){if(_0x5980bc){return _0x5980bc['removeAgents'](_0x20ac40[_0xa97a('0x37')][_0xa97a('0x68')])[_0xa97a('0x2c')](function(){if(_[_0xa97a('0x88')](_0x20ac40[_0xa97a('0x37')]['ids'])){for(var _0x132d09=0x0;_0x132d09<_0x20ac40[_0xa97a('0x37')]['ids'][_0xa97a('0x3d')];_0x132d09+=0x1){socket['emit'](_0xa97a('0x85'),{'UserId':Number(_0x20ac40['query'][_0xa97a('0x68')][_0x132d09]),'WhatsappQueueId':Number(_0x20ac40[_0xa97a('0x4c')]['id'])});}}else{socket[_0xa97a('0x6f')](_0xa97a('0x85'),{'UserId':Number(_0x20ac40['query'][_0xa97a('0x68')]),'WhatsappQueueId':Number(_0x20ac40[_0xa97a('0x4c')]['id'])});}});}})[_0xa97a('0x2c')](respondWithStatusCode(_0x25af7e,null))[_0xa97a('0x4a')](handleError(_0x25af7e,null));};exports[_0xa97a('0x89')]=function(_0xb82fa4,_0x1961de,_0x5939b7){var _0x38fd0d={};var _0x207e1a={};var _0x268881;var _0x388499;return db[_0xa97a('0x32')]['findOne']({'where':{'id':_0xb82fa4[_0xa97a('0x4c')]['id']}})[_0xa97a('0x2c')](handleEntityNotFound(_0x1961de,null))[_0xa97a('0x2c')](function(_0x5188f0){if(_0x5188f0){_0x268881=_0x5188f0;_0x207e1a['model']=_[_0xa97a('0x38')](db['User'][_0xa97a('0x4d')]);_0x207e1a[_0xa97a('0x37')]=_[_0xa97a('0x38')](_0xb82fa4[_0xa97a('0x37')]);_0x207e1a['filters']=_[_0xa97a('0x3a')](_0x207e1a[_0xa97a('0x36')],_0x207e1a['query']);_0x38fd0d[_0xa97a('0x3b')]=_[_0xa97a('0x3a')](_0x207e1a[_0xa97a('0x36')],qs[_0xa97a('0x3c')](_0xb82fa4[_0xa97a('0x37')]['fields']));_0x38fd0d['attributes']=_0x38fd0d[_0xa97a('0x3b')][_0xa97a('0x3d')]?_0x38fd0d[_0xa97a('0x3b')]:_0x207e1a['model'];_0x38fd0d['order']=qs[_0xa97a('0x41')](_0xb82fa4[_0xa97a('0x37')][_0xa97a('0x41')]);_0x38fd0d[_0xa97a('0x44')]=qs['filters'](_[_0xa97a('0x42')](_0xb82fa4[_0xa97a('0x37')],_0x207e1a[_0xa97a('0x39')]));if(_0xb82fa4[_0xa97a('0x37')][_0xa97a('0x43')]){_0x38fd0d[_0xa97a('0x44')]=_[_0xa97a('0x45')](_0x38fd0d[_0xa97a('0x44')],{'$or':_[_0xa97a('0x31')](_0x38fd0d['attributes'],function(_0x3850d9){var _0x258f30={};_0x258f30[_0x3850d9]={'$like':'%'+_0xb82fa4[_0xa97a('0x37')]['filter']+'%'};return _0x258f30;})});}_0x38fd0d=_['merge']({},_0x38fd0d,_0xb82fa4[_0xa97a('0x47')]);return _0x268881[_0xa97a('0x89')](_0x38fd0d);}})[_0xa97a('0x2c')](function(_0x26dfb0){if(_0x26dfb0){_0x388499=_0x26dfb0[_0xa97a('0x3d')];if(!_0xb82fa4[_0xa97a('0x37')]['hasOwnProperty'](_0xa97a('0x3f'))){_0x38fd0d[_0xa97a('0x25')]=qs[_0xa97a('0x25')](_0xb82fa4['query'][_0xa97a('0x25')]);_0x38fd0d[_0xa97a('0x24')]=qs[_0xa97a('0x24')](_0xb82fa4[_0xa97a('0x37')][_0xa97a('0x24')]);}return _0x268881[_0xa97a('0x89')](_0x38fd0d);}})[_0xa97a('0x2c')](function(_0x6d1d0){if(_0x6d1d0){return _0x6d1d0?{'count':_0x388499,'rows':_0x6d1d0}:null;}})[_0xa97a('0x2c')](respondWithResult(_0x1961de,null))[_0xa97a('0x4a')](handleError(_0x1961de,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 61dc503..72a0dff 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 _0x5b5d=['events','WhatsappQueue','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3b36d7,_0x1c9225){var _0xaa920f=function(_0x2bf842){while(--_0x2bf842){_0x3b36d7['push'](_0x3b36d7['shift']());}};_0xaa920f(++_0x1c9225);}(_0x5b5d,0x88));var _0xd5b5=function(_0xdc953c,_0xf75325){_0xdc953c=_0xdc953c-0x0;var _0x16ac24=_0x5b5d[_0xdc953c];return _0x16ac24;};'use strict';var EventEmitter=require(_0xd5b5('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xd5b5('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd5b5('0x2'),'afterUpdate':_0xd5b5('0x3'),'afterDestroy':_0xd5b5('0x4')};function emitEvent(_0x47f670){return function(_0x392ab6,_0x36b5db,_0x265f27){WhatsappQueueEvents[_0xd5b5('0x5')](_0x47f670+':'+_0x392ab6['id'],_0x392ab6);WhatsappQueueEvents[_0xd5b5('0x5')](_0x47f670,_0x392ab6);_0x265f27(null);};}for(var e in events){if(events[_0xd5b5('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xd5b5('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x666b=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x55408b,_0x1aadf2){var _0x321ba7=function(_0x54a985){while(--_0x54a985){_0x55408b['push'](_0x55408b['shift']());}};_0x321ba7(++_0x1aadf2);}(_0x666b,0x1a7));var _0xb666=function(_0x576b49,_0x2fa7f8){_0x576b49=_0x576b49-0x0;var _0x18cea3=_0x666b[_0x576b49];return _0x18cea3;};'use strict';var EventEmitter=require(_0xb666('0x0'));var WhatsappQueue=require(_0xb666('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb666('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb666('0x3'),'afterDestroy':_0xb666('0x4')};function emitEvent(_0x24ab7b){return function(_0x128509,_0x4e0c7d,_0xbe8c8b){WhatsappQueueEvents[_0xb666('0x5')](_0x24ab7b+':'+_0x128509['id'],_0x128509);WhatsappQueueEvents[_0xb666('0x5')](_0x24ab7b,_0x128509);_0xbe8c8b(null);};}for(var e in events){if(events[_0xb666('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xb666('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 6f28a9c..5c32def 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 _0x5118=['rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x19de7a,_0x53cac4){var _0x43b8b2=function(_0x1e5da6){while(--_0x1e5da6){_0x19de7a['push'](_0x19de7a['shift']());}};_0x43b8b2(++_0x53cac4);}(_0x5118,0x14b));var _0x8511=function(_0x4ae63d,_0x152404){_0x4ae63d=_0x4ae63d-0x0;var _0x4c1e01=_0x5118[_0x4ae63d];return _0x4c1e01;};'use strict';var _=require(_0x8511('0x0'));var util=require(_0x8511('0x1'));var logger=require(_0x8511('0x2'))('api');var moment=require(_0x8511('0x3'));var BPromise=require(_0x8511('0x4'));var rp=require(_0x8511('0x5'));var fs=require('fs');var path=require(_0x8511('0x6'));var rimraf=require(_0x8511('0x7'));var config=require(_0x8511('0x8'));var attributes=require(_0x8511('0x9'));module[_0x8511('0xa')]=function(_0x254134,_0xaa3197){return _0x254134[_0x8511('0xb')]('WhatsappQueue',attributes,{'tableName':_0x8511('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecb6=['path','define','WhatsappQueue','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4d7533,_0x5ebb9b){var _0x525bed=function(_0x5084ec){while(--_0x5084ec){_0x4d7533['push'](_0x4d7533['shift']());}};_0x525bed(++_0x5ebb9b);}(_0xecb6,0x93));var _0x6ecb=function(_0x13c8a3,_0x5512c5){_0x13c8a3=_0x13c8a3-0x0;var _0x284447=_0xecb6[_0x13c8a3];return _0x284447;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6ecb('0x0'))(_0x6ecb('0x1'));var moment=require(_0x6ecb('0x2'));var BPromise=require(_0x6ecb('0x3'));var rp=require(_0x6ecb('0x4'));var fs=require('fs');var path=require(_0x6ecb('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x388ffa,_0x1a9ee4){return _0x388ffa[_0x6ecb('0x6')](_0x6ecb('0x7'),attributes,{'tableName':'whatsapp_queues','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 8780fb4..9c9ee41 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 _0x359e=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowWhatsappQueue','find','lodash','util'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x359e,0x10f));var _0xe359=function(_0xda8417,_0x169bff){_0xda8417=_0xda8417-0x0;var _0x5f48bd=_0x359e[_0xda8417];return _0x5f48bd;};'use strict';var _=require(_0xe359('0x0'));var util=require(_0xe359('0x1'));var moment=require(_0xe359('0x2'));var BPromise=require(_0xe359('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe359('0x4'));var db=require(_0xe359('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe359('0x6'))(_0xe359('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe359('0x8')][_0xe359('0x9')]({'port':0x232a});config[_0xe359('0xa')]=_[_0xe359('0xb')](config[_0xe359('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe359('0xc'))(new Redis(config[_0xe359('0xa')]));require(_0xe359('0xd'))[_0xe359('0xe')](socket);function respondWithRpcPromise(_0x12902a,_0x16b7ed,_0x3b57be){return new BPromise(function(_0x534c30,_0x36c137){return client['request'](_0x12902a,_0x3b57be)[_0xe359('0xf')](function(_0x556ba2){logger[_0xe359('0x10')](_0xe359('0x11'),_0x16b7ed,_0xe359('0x12'));logger[_0xe359('0x13')](_0xe359('0x14'),_0x16b7ed,_0xe359('0x12'),JSON[_0xe359('0x15')](_0x556ba2));if(_0x556ba2[_0xe359('0x16')]){if(_0x556ba2[_0xe359('0x16')][_0xe359('0x17')]===0x1f4){logger['error'](_0xe359('0x11'),_0x16b7ed,_0x556ba2[_0xe359('0x16')][_0xe359('0x18')]);return _0x36c137(_0x556ba2['error'][_0xe359('0x18')]);}logger[_0xe359('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x16b7ed,_0x556ba2['error']['message']);return _0x534c30(_0x556ba2[_0xe359('0x16')][_0xe359('0x18')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x16b7ed,_0xe359('0x12'));_0x534c30(_0x556ba2['result']['message']);}})[_0xe359('0x19')](function(_0xd5984){logger[_0xe359('0x16')](_0xe359('0x11'),_0x16b7ed,_0xd5984);_0x36c137(_0xd5984);});});}exports[_0xe359('0x1a')]=function(_0x3297f6){var _0x2851ac=this;return new Promise(function(_0x201206,_0x2c90ea){return db[_0xe359('0x1b')][_0xe359('0x1c')]({'raw':_0x3297f6[_0xe359('0x1d')]?_0x3297f6[_0xe359('0x1d')][_0xe359('0x1e')]===undefined?!![]:![]:!![],'where':_0x3297f6['options']?_0x3297f6[_0xe359('0x1d')][_0xe359('0x1f')]||null:null,'attributes':_0x3297f6['options']?_0x3297f6[_0xe359('0x1d')][_0xe359('0x20')]||null:null,'limit':_0x3297f6['options']?_0x3297f6[_0xe359('0x1d')][_0xe359('0x21')]||null:null,'include':_0x3297f6[_0xe359('0x1d')]?_0x3297f6['options'][_0xe359('0x22')]?_['map'](_0x3297f6[_0xe359('0x1d')]['include'],function(_0x43d476){return{'model':db[_0x43d476[_0xe359('0x23')]],'as':_0x43d476['as'],'attributes':_0x43d476[_0xe359('0x20')],'include':_0x43d476[_0xe359('0x22')]?_[_0xe359('0x24')](_0x43d476[_0xe359('0x22')],function(_0x21b06b){return{'model':db[_0x21b06b[_0xe359('0x23')]],'as':_0x21b06b['as'],'attributes':_0x21b06b['attributes'],'include':_0x21b06b[_0xe359('0x22')]?_[_0xe359('0x24')](_0x21b06b[_0xe359('0x22')],function(_0x3d28a5){return{'model':db[_0x3d28a5[_0xe359('0x23')]],'as':_0x3d28a5['as'],'attributes':_0x3d28a5[_0xe359('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x537b54){logger[_0xe359('0x10')]('GetWhatsappQueue',_0x3297f6);logger[_0xe359('0x13')](_0xe359('0x1a'),_0x3297f6,JSON[_0xe359('0x15')](_0x537b54));_0x201206(_0x537b54);})['catch'](function(_0x3bea2e){logger['error']('GetWhatsappQueue',_0x3bea2e[_0xe359('0x18')],_0x3297f6);_0x2c90ea(_0x2851ac['error'](0x1f4,_0x3bea2e[_0xe359('0x18')]));});});};exports[_0xe359('0x25')]=function(_0x3713e3){var _0x4cdd42=this;return new Promise(function(_0x1eb530,_0x3b41da){return db[_0xe359('0x1b')][_0xe359('0x26')]({'raw':_0x3713e3['options']?_0x3713e3['options'][_0xe359('0x1e')]===undefined?!![]:![]:!![],'where':_0x3713e3[_0xe359('0x1d')]?_0x3713e3[_0xe359('0x1d')][_0xe359('0x1f')]||null:null,'attributes':_0x3713e3[_0xe359('0x1d')]?_0x3713e3[_0xe359('0x1d')][_0xe359('0x20')]||null:null,'include':_0x3713e3['options']?_0x3713e3[_0xe359('0x1d')][_0xe359('0x22')]?_['map'](_0x3713e3[_0xe359('0x1d')][_0xe359('0x22')],function(_0x297d07){return{'model':db[_0x297d07[_0xe359('0x23')]],'as':_0x297d07['as'],'attributes':_0x297d07[_0xe359('0x20')],'include':_0x297d07['include']?_[_0xe359('0x24')](_0x297d07[_0xe359('0x22')],function(_0x3f888a){return{'model':db[_0x3f888a[_0xe359('0x23')]],'as':_0x3f888a['as'],'attributes':_0x3f888a['attributes'],'include':_0x3f888a[_0xe359('0x22')]?_[_0xe359('0x24')](_0x3f888a[_0xe359('0x22')],function(_0x29a17d){return{'model':db[_0x29a17d[_0xe359('0x23')]],'as':_0x29a17d['as'],'attributes':_0x29a17d[_0xe359('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x154f74){logger[_0xe359('0x10')]('ShowWhatsappQueue',_0x3713e3);logger[_0xe359('0x13')](_0xe359('0x25'),_0x3713e3,JSON[_0xe359('0x15')](_0x154f74));_0x1eb530(_0x154f74);})[_0xe359('0x19')](function(_0x2e9d43){logger['error'](_0xe359('0x25'),_0x2e9d43[_0xe359('0x18')],_0x3713e3);_0x3b41da(_0x4cdd42[_0xe359('0x16')](0x1f4,_0x2e9d43[_0xe359('0x18')]));});});}; \ No newline at end of file +var _0xdf2c=['limit','include','map','model','debug','ShowWhatsappQueue','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdf2c,0x1ab));var _0xcdf2=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xdf2c[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xcdf2('0x0'));var util=require(_0xcdf2('0x1'));var moment=require(_0xcdf2('0x2'));var BPromise=require(_0xcdf2('0x3'));var rs=require(_0xcdf2('0x4'));var fs=require('fs');var Redis=require(_0xcdf2('0x5'));var db=require(_0xcdf2('0x6'))['db'];var utils=require(_0xcdf2('0x7'));var logger=require(_0xcdf2('0x8'))(_0xcdf2('0x9'));var config=require('../../config/environment');var jayson=require(_0xcdf2('0xa'));var client=jayson[_0xcdf2('0xb')]['http']({'port':0x232a});config[_0xcdf2('0xc')]=_[_0xcdf2('0xd')](config['redis'],{'host':_0xcdf2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcdf2('0xf'))[_0xcdf2('0x10')](socket);function respondWithRpcPromise(_0x13c6ac,_0x449d97,_0x2de583){return new BPromise(function(_0x236b4,_0x287a50){return client[_0xcdf2('0x11')](_0x13c6ac,_0x2de583)[_0xcdf2('0x12')](function(_0x907ddf){logger['info'](_0xcdf2('0x13'),_0x449d97,_0xcdf2('0x14'));logger['debug'](_0xcdf2('0x15'),_0x449d97,_0xcdf2('0x14'),JSON[_0xcdf2('0x16')](_0x907ddf));if(_0x907ddf[_0xcdf2('0x17')]){if(_0x907ddf[_0xcdf2('0x17')][_0xcdf2('0x18')]===0x1f4){logger[_0xcdf2('0x17')](_0xcdf2('0x13'),_0x449d97,_0x907ddf[_0xcdf2('0x17')][_0xcdf2('0x19')]);return _0x287a50(_0x907ddf[_0xcdf2('0x17')]['message']);}logger[_0xcdf2('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x449d97,_0x907ddf['error'][_0xcdf2('0x19')]);return _0x236b4(_0x907ddf['error'][_0xcdf2('0x19')]);}else{logger[_0xcdf2('0x1a')](_0xcdf2('0x13'),_0x449d97,_0xcdf2('0x14'));_0x236b4(_0x907ddf[_0xcdf2('0x1b')][_0xcdf2('0x19')]);}})['catch'](function(_0xe2926b){logger[_0xcdf2('0x17')](_0xcdf2('0x13'),_0x449d97,_0xe2926b);_0x287a50(_0xe2926b);});});}exports[_0xcdf2('0x1c')]=function(_0x128226){var _0x49a018=this;return new Promise(function(_0x11f140,_0x24fe98){return db[_0xcdf2('0x1d')][_0xcdf2('0x1e')]({'raw':_0x128226[_0xcdf2('0x1f')]?_0x128226[_0xcdf2('0x1f')][_0xcdf2('0x20')]===undefined?!![]:![]:!![],'where':_0x128226[_0xcdf2('0x1f')]?_0x128226[_0xcdf2('0x1f')][_0xcdf2('0x21')]||null:null,'attributes':_0x128226[_0xcdf2('0x1f')]?_0x128226[_0xcdf2('0x1f')][_0xcdf2('0x22')]||null:null,'limit':_0x128226['options']?_0x128226[_0xcdf2('0x1f')][_0xcdf2('0x23')]||null:null,'include':_0x128226['options']?_0x128226[_0xcdf2('0x1f')][_0xcdf2('0x24')]?_[_0xcdf2('0x25')](_0x128226[_0xcdf2('0x1f')][_0xcdf2('0x24')],function(_0x51f264){return{'model':db[_0x51f264['model']],'as':_0x51f264['as'],'attributes':_0x51f264[_0xcdf2('0x22')],'include':_0x51f264[_0xcdf2('0x24')]?_[_0xcdf2('0x25')](_0x51f264[_0xcdf2('0x24')],function(_0x1a3232){return{'model':db[_0x1a3232[_0xcdf2('0x26')]],'as':_0x1a3232['as'],'attributes':_0x1a3232[_0xcdf2('0x22')],'include':_0x1a3232[_0xcdf2('0x24')]?_[_0xcdf2('0x25')](_0x1a3232['include'],function(_0x3dd705){return{'model':db[_0x3dd705['model']],'as':_0x3dd705['as'],'attributes':_0x3dd705[_0xcdf2('0x22')]};}):[]};}):[]};}):[]:[]})[_0xcdf2('0x12')](function(_0x36303a){logger['info'](_0xcdf2('0x1c'),_0x128226);logger[_0xcdf2('0x27')](_0xcdf2('0x1c'),_0x128226,JSON[_0xcdf2('0x16')](_0x36303a));_0x11f140(_0x36303a);})['catch'](function(_0x317ab7){logger[_0xcdf2('0x17')]('GetWhatsappQueue',_0x317ab7[_0xcdf2('0x19')],_0x128226);_0x24fe98(_0x49a018['error'](0x1f4,_0x317ab7[_0xcdf2('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x377d0c){var _0x2a7a53=this;return new Promise(function(_0x2d6cb8,_0x488d45){return db[_0xcdf2('0x1d')]['find']({'raw':_0x377d0c[_0xcdf2('0x1f')]?_0x377d0c['options']['raw']===undefined?!![]:![]:!![],'where':_0x377d0c[_0xcdf2('0x1f')]?_0x377d0c['options'][_0xcdf2('0x21')]||null:null,'attributes':_0x377d0c[_0xcdf2('0x1f')]?_0x377d0c[_0xcdf2('0x1f')][_0xcdf2('0x22')]||null:null,'include':_0x377d0c['options']?_0x377d0c[_0xcdf2('0x1f')][_0xcdf2('0x24')]?_[_0xcdf2('0x25')](_0x377d0c[_0xcdf2('0x1f')]['include'],function(_0x261da6){return{'model':db[_0x261da6['model']],'as':_0x261da6['as'],'attributes':_0x261da6[_0xcdf2('0x22')],'include':_0x261da6[_0xcdf2('0x24')]?_['map'](_0x261da6[_0xcdf2('0x24')],function(_0x508810){return{'model':db[_0x508810[_0xcdf2('0x26')]],'as':_0x508810['as'],'attributes':_0x508810[_0xcdf2('0x22')],'include':_0x508810[_0xcdf2('0x24')]?_[_0xcdf2('0x25')](_0x508810[_0xcdf2('0x24')],function(_0x3d2e85){return{'model':db[_0x3d2e85[_0xcdf2('0x26')]],'as':_0x3d2e85['as'],'attributes':_0x3d2e85['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xe0b34f){logger[_0xcdf2('0x1a')]('ShowWhatsappQueue',_0x377d0c);logger[_0xcdf2('0x27')](_0xcdf2('0x28'),_0x377d0c,JSON[_0xcdf2('0x16')](_0xe0b34f));_0x2d6cb8(_0xe0b34f);})[_0xcdf2('0x29')](function(_0x1b008a){logger[_0xcdf2('0x17')](_0xcdf2('0x28'),_0x1b008a['message'],_0x377d0c);_0x488d45(_0x2a7a53[_0xcdf2('0x17')](0x1f4,_0x1b008a['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 13e72a0..018d19b 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 _0xff58=['whatsappQueue:','./whatsappQueue.events','save','update','removeListener','length'];(function(_0x543268,_0x13a058){var _0x2a726a=function(_0xedf073){while(--_0xedf073){_0x543268['push'](_0x543268['shift']());}};_0x2a726a(++_0x13a058);}(_0xff58,0x7f));var _0x8ff5=function(_0x56de9d,_0x413b89){_0x56de9d=_0x56de9d-0x0;var _0x5b63fd=_0xff58[_0x56de9d];return _0x5b63fd;};'use strict';var WhatsappQueueEvents=require(_0x8ff5('0x0'));var events=[_0x8ff5('0x1'),'remove',_0x8ff5('0x2')];function createListener(_0x527540,_0x548d51){return function(_0x5f2f8e){_0x548d51['emit'](_0x527540,_0x5f2f8e);};}function removeListener(_0x201ced,_0x4e431f){return function(){WhatsappQueueEvents[_0x8ff5('0x3')](_0x201ced,_0x4e431f);};}exports['register']=function(_0x16795a){for(var _0x5417be=0x0,_0x565db1=events[_0x8ff5('0x4')];_0x5417be<_0x565db1;_0x5417be++){var _0x479642=events[_0x5417be];var _0x10f861=createListener(_0x8ff5('0x5')+_0x479642,_0x16795a);WhatsappQueueEvents['on'](_0x479642,_0x10f861);}}; \ No newline at end of file +var _0x7e55=['removeListener','length','./whatsappQueue.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e55,0x16a));var _0x57e5=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0x7e55[_0x4ea413];return _0x51cf25;};'use strict';var WhatsappQueueEvents=require(_0x57e5('0x0'));var events=[_0x57e5('0x1'),_0x57e5('0x2'),'update'];function createListener(_0x1110f0,_0x493872){return function(_0x4e5b7f){_0x493872['emit'](_0x1110f0,_0x4e5b7f);};}function removeListener(_0x51d2a8,_0x24eeda){return function(){WhatsappQueueEvents[_0x57e5('0x3')](_0x51d2a8,_0x24eeda);};}exports['register']=function(_0x24ecea){for(var _0x258e9a=0x0,_0x448169=events[_0x57e5('0x4')];_0x258e9a<_0x448169;_0x258e9a++){var _0x202c2e=events[_0x258e9a];var _0x20f47f=createListener('whatsappQueue:'+_0x202c2e,_0x24ecea);WhatsappQueueEvents['on'](_0x202c2e,_0x20f47f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index ca94a7b..19e522d 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 _0x3299=['put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0x3299,0x1bc));var _0x9329=function(_0x269b36,_0x3290fb){_0x269b36=_0x269b36-0x0;var _0x27755d=_0x3299[_0x269b36];return _0x27755d;};'use strict';var multer=require('multer');var util=require(_0x9329('0x0'));var path=require(_0x9329('0x1'));var timeout=require(_0x9329('0x2'));var express=require(_0x9329('0x3'));var router=express[_0x9329('0x4')]();var fs_extra=require(_0x9329('0x5'));var auth=require(_0x9329('0x6'));var interaction=require(_0x9329('0x7'));var config=require(_0x9329('0x8'));var controller=require(_0x9329('0x9'));router[_0x9329('0xa')]('/',auth[_0x9329('0xb')](),controller[_0x9329('0xc')]);router[_0x9329('0xa')](_0x9329('0xd'),auth[_0x9329('0xb')](),controller[_0x9329('0xe')]);router['get'](_0x9329('0xf'),auth[_0x9329('0xb')](),controller[_0x9329('0x10')]);router[_0x9329('0x11')]('/',auth[_0x9329('0xb')](),controller['create']);router[_0x9329('0x12')](_0x9329('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9329('0xf'),auth[_0x9329('0xb')](),controller[_0x9329('0x13')]);module[_0x9329('0x14')]=router; \ No newline at end of file +var _0x8cfd=['/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0x8cfd[_0x1ebe90];return _0x447c82;};'use strict';var multer=require(_0xd8cf('0x0'));var util=require(_0xd8cf('0x1'));var path=require(_0xd8cf('0x2'));var timeout=require(_0xd8cf('0x3'));var express=require(_0xd8cf('0x4'));var router=express[_0xd8cf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd8cf('0x6'));var interaction=require(_0xd8cf('0x7'));var config=require(_0xd8cf('0x8'));var controller=require(_0xd8cf('0x9'));router[_0xd8cf('0xa')]('/',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xc')]);router['get']('/describe',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xd')]);router[_0xd8cf('0xa')](_0xd8cf('0xe'),auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xf')]);router['post']('/',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0x10')]);router[_0xd8cf('0x11')](_0xd8cf('0xe'),auth[_0xd8cf('0xb')](),controller[_0xd8cf('0x12')]);router[_0xd8cf('0x13')](_0xd8cf('0xe'),auth[_0xd8cf('0xb')](),controller[_0xd8cf('0x14')]);module[_0xd8cf('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 249e43e..e499d6d 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 _0x3e74=['DATE','sequelize','STRING'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x3e74,0x175));var _0x43e7=function(_0x5d3473,_0x58421f){_0x5d3473=_0x5d3473-0x0;var _0x1c44c8=_0x3e74[_0x5d3473];return _0x1c44c8;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x43e7('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x43e7('0x1')]},'joinAt':{'type':Sequelize[_0x43e7('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x43e7('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3e74=['DATE','sequelize','STRING'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x3e74,0x175));var _0x43e7=function(_0x24007d,_0x55cf65){_0x24007d=_0x24007d-0x0;var _0x3f7930=_0x3e74[_0x24007d];return _0x3f7930;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x43e7('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x43e7('0x1')]},'joinAt':{'type':Sequelize[_0x43e7('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x43e7('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 56cb65f..6633ace 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 _0x88ba=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x88ba,0x12d));var _0xa88b=function(_0x26d9b3,_0x591f4e){_0x26d9b3=_0x26d9b3-0x0;var _0x15c226=_0x88ba[_0x26d9b3];return _0x15c226;};'use strict';var pdf=require(_0xa88b('0x0'));var emlformat=require(_0xa88b('0x1'));var rimraf=require(_0xa88b('0x2'));var zipdir=require(_0xa88b('0x3'));var jsonpatch=require(_0xa88b('0x4'));var rp=require(_0xa88b('0x5'));var moment=require('moment');var BPromise=require(_0xa88b('0x6'));var Mustache=require('mustache');var util=require(_0xa88b('0x7'));var path=require(_0xa88b('0x8'));var sox=require(_0xa88b('0x9'));var csv=require(_0xa88b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa88b('0xb'));var _=require(_0xa88b('0xc'));var squel=require(_0xa88b('0xd'));var crypto=require(_0xa88b('0xe'));var jsforce=require(_0xa88b('0xf'));var deskjs=require(_0xa88b('0x10'));var toCsv=require(_0xa88b('0xa'));var querystring=require(_0xa88b('0x11'));var Papa=require(_0xa88b('0x12'));var Redis=require(_0xa88b('0x13'));var authService=require(_0xa88b('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xa88b('0x15'));var hardwareService=require(_0xa88b('0x16'));var logger=require(_0xa88b('0x17'))(_0xa88b('0x18'));var utils=require(_0xa88b('0x19'));var config=require(_0xa88b('0x1a'));var licenseUtil=require(_0xa88b('0x1b'));var db=require(_0xa88b('0x1c'))['db'];function respondWithStatusCode(_0x10d37e,_0x15c920){_0x15c920=_0x15c920||0xcc;return function(_0x26236d){if(_0x26236d){return _0x10d37e[_0xa88b('0x1d')](_0x15c920);}return _0x10d37e[_0xa88b('0x1e')](_0x15c920)[_0xa88b('0x1f')]();};}function respondWithResult(_0x4f679f,_0x29aa65){_0x29aa65=_0x29aa65||0xc8;return function(_0x43f32f){if(_0x43f32f){return _0x4f679f[_0xa88b('0x1e')](_0x29aa65)['json'](_0x43f32f);}};}function respondWithFilteredResult(_0x14fd12,_0x532dec){return function(_0x376af8){if(_0x376af8){var _0x216b67=_0x376af8[_0xa88b('0x20')],_0x502732=_0x532dec[_0xa88b('0x21')],_0x5c4fc4=_0x532dec[_0xa88b('0x21')]+_0x532dec[_0xa88b('0x22')],_0x13231d;if(_0x5c4fc4>=_0x216b67){_0x5c4fc4=_0x216b67;_0x13231d=0xc8;}else{_0x13231d=0xce;}_0x14fd12[_0xa88b('0x1e')](_0x13231d);return _0x14fd12[_0xa88b('0x23')](_0xa88b('0x24'),_0x502732+'-'+_0x5c4fc4+'/'+_0x216b67)[_0xa88b('0x25')](_0x376af8);}return null;};}function patchUpdates(_0x3a8b06){return function(_0x4dd9ac){try{jsonpatch[_0xa88b('0x26')](_0x4dd9ac,_0x3a8b06,!![]);}catch(_0x5daf13){return BPromise[_0xa88b('0x27')](_0x5daf13);}return _0x4dd9ac[_0xa88b('0x28')]();};}function saveUpdates(_0xc76459,_0x593e0f){return function(_0x3eaf0b){if(_0x3eaf0b){return _0x3eaf0b['update'](_0xc76459)[_0xa88b('0x29')](function(_0x34713c){return _0x34713c;});}return null;};}function removeEntity(_0x5d38af,_0x1ff913){return function(_0x1e272b){if(_0x1e272b){return _0x1e272b[_0xa88b('0x2a')]()[_0xa88b('0x29')](function(){_0x5d38af['status'](0xcc)[_0xa88b('0x1f')]();});}};}function handleEntityNotFound(_0x42fbad,_0x5cbdc0){return function(_0x1aacd5){if(!_0x1aacd5){_0x42fbad['sendStatus'](0x194);}return _0x1aacd5;};}function handleError(_0x1dc10d,_0x456a20){_0x456a20=_0x456a20||0x1f4;return function(_0x414f93){logger[_0xa88b('0x2b')](_0x414f93[_0xa88b('0x2c')]);if(_0x414f93['name']){delete _0x414f93[_0xa88b('0x2d')];}_0x1dc10d[_0xa88b('0x1e')](_0x456a20)[_0xa88b('0x2e')](_0x414f93);};}exports[_0xa88b('0x2f')]=function(_0x121a44,_0x317d37){var _0x508a69={},_0xbc8262={},_0x186bc9={'count':0x0,'rows':[]};var _0x351e4a=_[_0xa88b('0x30')](db[_0xa88b('0x31')][_0xa88b('0x32')],function(_0x5a00dd){return{'name':_0x5a00dd[_0xa88b('0x33')],'type':_0x5a00dd['type']['key']};});_0xbc8262[_0xa88b('0x34')]=_[_0xa88b('0x30')](_0x351e4a,_0xa88b('0x2d'));_0xbc8262[_0xa88b('0x35')]=_[_0xa88b('0x36')](_0x121a44[_0xa88b('0x35')]);_0xbc8262[_0xa88b('0x37')]=_[_0xa88b('0x38')](_0xbc8262[_0xa88b('0x34')],_0xbc8262['query']);_0x508a69[_0xa88b('0x39')]=_[_0xa88b('0x38')](_0xbc8262['model'],qs[_0xa88b('0x3a')](_0x121a44[_0xa88b('0x35')][_0xa88b('0x3a')]));_0x508a69[_0xa88b('0x39')]=_0x508a69[_0xa88b('0x39')]['length']?_0x508a69[_0xa88b('0x39')]:_0xbc8262[_0xa88b('0x34')];if(!_0x121a44[_0xa88b('0x35')][_0xa88b('0x3b')](_0xa88b('0x3c'))){_0x508a69[_0xa88b('0x22')]=qs[_0xa88b('0x22')](_0x121a44[_0xa88b('0x35')][_0xa88b('0x22')]);_0x508a69[_0xa88b('0x21')]=qs['offset'](_0x121a44['query']['offset']);}_0x508a69[_0xa88b('0x3d')]=qs['sort'](_0x121a44['query'][_0xa88b('0x3e')]);_0x508a69['where']=qs[_0xa88b('0x37')](_['pick'](_0x121a44['query'],_0xbc8262['filters']),_0x351e4a);if(_0x121a44[_0xa88b('0x35')][_0xa88b('0x3f')]){_0x508a69['where']=_[_0xa88b('0x40')](_0x508a69[_0xa88b('0x41')],{'$or':_[_0xa88b('0x30')](_0x351e4a,function(_0x2e5c92){if(_0x2e5c92['type']!==_0xa88b('0x42')){var _0x4a4de={};_0x4a4de[_0x2e5c92[_0xa88b('0x2d')]]={'$like':'%'+_0x121a44[_0xa88b('0x35')]['filter']+'%'};return _0x4a4de;}})});}_0x508a69=_['merge']({},_0x508a69,_0x121a44[_0xa88b('0x43')]);var _0x2c977d={'where':_0x508a69[_0xa88b('0x41')]};return db[_0xa88b('0x31')][_0xa88b('0x20')](_0x2c977d)[_0xa88b('0x29')](function(_0x801b12){_0x186bc9[_0xa88b('0x20')]=_0x801b12;if(_0x121a44[_0xa88b('0x35')]['includeAll']){_0x508a69[_0xa88b('0x44')]=[{'all':!![]}];}return db[_0xa88b('0x31')]['findAll'](_0x508a69);})[_0xa88b('0x29')](function(_0x2a8adc){_0x186bc9[_0xa88b('0x45')]=_0x2a8adc;return _0x186bc9;})[_0xa88b('0x29')](respondWithFilteredResult(_0x317d37,_0x508a69))[_0xa88b('0x46')](handleError(_0x317d37,null));};exports[_0xa88b('0x47')]=function(_0x2eaf0c,_0x517f63){var _0x4a38be={'raw':!![],'where':{'id':_0x2eaf0c[_0xa88b('0x48')]['id']}},_0x5df135={};_0x5df135[_0xa88b('0x34')]=_[_0xa88b('0x36')](db[_0xa88b('0x31')][_0xa88b('0x32')]);_0x5df135[_0xa88b('0x35')]=_[_0xa88b('0x36')](_0x2eaf0c[_0xa88b('0x35')]);_0x5df135[_0xa88b('0x37')]=_[_0xa88b('0x38')](_0x5df135[_0xa88b('0x34')],_0x5df135[_0xa88b('0x35')]);_0x4a38be[_0xa88b('0x39')]=_[_0xa88b('0x38')](_0x5df135['model'],qs['fields'](_0x2eaf0c[_0xa88b('0x35')][_0xa88b('0x3a')]));_0x4a38be['attributes']=_0x4a38be[_0xa88b('0x39')][_0xa88b('0x49')]?_0x4a38be[_0xa88b('0x39')]:_0x5df135[_0xa88b('0x34')];if(_0x2eaf0c['query'][_0xa88b('0x4a')]){_0x4a38be[_0xa88b('0x44')]=[{'all':!![]}];}_0x4a38be=_['merge']({},_0x4a38be,_0x2eaf0c[_0xa88b('0x43')]);return db[_0xa88b('0x31')]['find'](_0x4a38be)[_0xa88b('0x29')](handleEntityNotFound(_0x517f63,null))[_0xa88b('0x29')](respondWithResult(_0x517f63,null))['catch'](handleError(_0x517f63,null));};exports[_0xa88b('0x4b')]=function(_0x1db5d8,_0x2f5797){return db['WhatsappQueueReport']['create'](_0x1db5d8[_0xa88b('0x4c')],{})[_0xa88b('0x29')](respondWithResult(_0x2f5797,0xc9))[_0xa88b('0x46')](handleError(_0x2f5797,null));};exports[_0xa88b('0x4d')]=function(_0xaf7f69,_0xb28f64){if(_0xaf7f69[_0xa88b('0x4c')]['id']){delete _0xaf7f69[_0xa88b('0x4c')]['id'];}return db['WhatsappQueueReport'][_0xa88b('0x4e')]({'where':{'id':_0xaf7f69[_0xa88b('0x48')]['id']}})[_0xa88b('0x29')](handleEntityNotFound(_0xb28f64,null))[_0xa88b('0x29')](saveUpdates(_0xaf7f69['body'],null))[_0xa88b('0x29')](respondWithResult(_0xb28f64,null))[_0xa88b('0x46')](handleError(_0xb28f64,null));};exports[_0xa88b('0x2a')]=function(_0x5e28ec,_0x4512db){return db['WhatsappQueueReport'][_0xa88b('0x4e')]({'where':{'id':_0x5e28ec[_0xa88b('0x48')]['id']}})[_0xa88b('0x29')](handleEntityNotFound(_0x4512db,null))[_0xa88b('0x29')](removeEntity(_0x4512db,null))[_0xa88b('0x46')](handleError(_0x4512db,null));};exports[_0xa88b('0x4f')]=function(_0x36841c,_0x14e595){return db[_0xa88b('0x31')]['describe']()[_0xa88b('0x29')](respondWithResult(_0x14e595,null))['catch'](handleError(_0x14e595,null));}; \ No newline at end of file +var _0x9584=['update','then','destroy','sendStatus','error','stack','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','include','show','find','catch','create','body','params','describe','html-pdf','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x4edd82,_0x58ef7d){var _0x4da29e=function(_0x173742){while(--_0x173742){_0x4edd82['push'](_0x4edd82['shift']());}};_0x4da29e(++_0x58ef7d);}(_0x9584,0x1d0));var _0x4958=function(_0x24d512,_0x329f0d){_0x24d512=_0x24d512-0x0;var _0xdd57c6=_0x9584[_0x24d512];return _0xdd57c6;};'use strict';var pdf=require(_0x4958('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4958('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4958('0x2'));var rp=require('request-promise');var moment=require(_0x4958('0x3'));var BPromise=require(_0x4958('0x4'));var Mustache=require('mustache');var util=require(_0x4958('0x5'));var path=require(_0x4958('0x6'));var sox=require(_0x4958('0x7'));var csv=require(_0x4958('0x8'));var ejs=require(_0x4958('0x9'));var fs=require('fs');var fs_extra=require(_0x4958('0xa'));var _=require(_0x4958('0xb'));var squel=require(_0x4958('0xc'));var crypto=require('crypto');var jsforce=require(_0x4958('0xd'));var deskjs=require(_0x4958('0xe'));var toCsv=require(_0x4958('0x8'));var querystring=require(_0x4958('0xf'));var Papa=require('papaparse');var Redis=require(_0x4958('0x10'));var authService=require(_0x4958('0x11'));var qs=require(_0x4958('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4958('0x13'))(_0x4958('0x14'));var utils=require(_0x4958('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4958('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bc4f6,_0x541e45){_0x541e45=_0x541e45||0xcc;return function(_0x4aed66){if(_0x4aed66){return _0x2bc4f6['sendStatus'](_0x541e45);}return _0x2bc4f6[_0x4958('0x17')](_0x541e45)[_0x4958('0x18')]();};}function respondWithResult(_0x562d7d,_0x5c7d53){_0x5c7d53=_0x5c7d53||0xc8;return function(_0x375150){if(_0x375150){return _0x562d7d[_0x4958('0x17')](_0x5c7d53)[_0x4958('0x19')](_0x375150);}};}function respondWithFilteredResult(_0x5946a,_0x397eeb){return function(_0x1fff0a){if(_0x1fff0a){var _0x22c554=_0x1fff0a[_0x4958('0x1a')],_0x4b06b3=_0x397eeb[_0x4958('0x1b')],_0x206fe=_0x397eeb['offset']+_0x397eeb[_0x4958('0x1c')],_0x172a4a;if(_0x206fe>=_0x22c554){_0x206fe=_0x22c554;_0x172a4a=0xc8;}else{_0x172a4a=0xce;}_0x5946a[_0x4958('0x17')](_0x172a4a);return _0x5946a[_0x4958('0x1d')](_0x4958('0x1e'),_0x4b06b3+'-'+_0x206fe+'/'+_0x22c554)['json'](_0x1fff0a);}return null;};}function patchUpdates(_0x519023){return function(_0x42cb1a){try{jsonpatch[_0x4958('0x1f')](_0x42cb1a,_0x519023,!![]);}catch(_0x557d93){return BPromise[_0x4958('0x20')](_0x557d93);}return _0x42cb1a['save']();};}function saveUpdates(_0xe112da,_0x1d0049){return function(_0x3858e5){if(_0x3858e5){return _0x3858e5[_0x4958('0x21')](_0xe112da)[_0x4958('0x22')](function(_0x4f97c3){return _0x4f97c3;});}return null;};}function removeEntity(_0xf7ca40,_0x45f6cc){return function(_0xea22c2){if(_0xea22c2){return _0xea22c2[_0x4958('0x23')]()[_0x4958('0x22')](function(){_0xf7ca40[_0x4958('0x17')](0xcc)[_0x4958('0x18')]();});}};}function handleEntityNotFound(_0x990b2f,_0x2fe86b){return function(_0x47242e){if(!_0x47242e){_0x990b2f[_0x4958('0x24')](0x194);}return _0x47242e;};}function handleError(_0x2fc23c,_0x484dd4){_0x484dd4=_0x484dd4||0x1f4;return function(_0x5187df){logger[_0x4958('0x25')](_0x5187df[_0x4958('0x26')]);if(_0x5187df[_0x4958('0x27')]){delete _0x5187df[_0x4958('0x27')];}_0x2fc23c['status'](_0x484dd4)[_0x4958('0x28')](_0x5187df);};}exports[_0x4958('0x29')]=function(_0x55f142,_0x29502b){var _0x347ad5={},_0x594194={},_0x184f4c={'count':0x0,'rows':[]};var _0x15cae0=_['map'](db[_0x4958('0x2a')][_0x4958('0x2b')],function(_0x565a92){return{'name':_0x565a92[_0x4958('0x2c')],'type':_0x565a92[_0x4958('0x2d')][_0x4958('0x2e')]};});_0x594194[_0x4958('0x2f')]=_[_0x4958('0x30')](_0x15cae0,_0x4958('0x27'));_0x594194['query']=_[_0x4958('0x31')](_0x55f142[_0x4958('0x32')]);_0x594194[_0x4958('0x33')]=_[_0x4958('0x34')](_0x594194[_0x4958('0x2f')],_0x594194[_0x4958('0x32')]);_0x347ad5['attributes']=_[_0x4958('0x34')](_0x594194['model'],qs[_0x4958('0x35')](_0x55f142[_0x4958('0x32')][_0x4958('0x35')]));_0x347ad5[_0x4958('0x36')]=_0x347ad5[_0x4958('0x36')][_0x4958('0x37')]?_0x347ad5[_0x4958('0x36')]:_0x594194['model'];if(!_0x55f142[_0x4958('0x32')][_0x4958('0x38')]('nolimit')){_0x347ad5[_0x4958('0x1c')]=qs['limit'](_0x55f142[_0x4958('0x32')][_0x4958('0x1c')]);_0x347ad5[_0x4958('0x1b')]=qs[_0x4958('0x1b')](_0x55f142[_0x4958('0x32')][_0x4958('0x1b')]);}_0x347ad5['order']=qs[_0x4958('0x39')](_0x55f142[_0x4958('0x32')]['sort']);_0x347ad5[_0x4958('0x3a')]=qs[_0x4958('0x33')](_['pick'](_0x55f142[_0x4958('0x32')],_0x594194[_0x4958('0x33')]),_0x15cae0);if(_0x55f142['query'][_0x4958('0x3b')]){_0x347ad5[_0x4958('0x3a')]=_['merge'](_0x347ad5[_0x4958('0x3a')],{'$or':_[_0x4958('0x30')](_0x15cae0,function(_0x1fe843){if(_0x1fe843['type']!==_0x4958('0x3c')){var _0x392414={};_0x392414[_0x1fe843['name']]={'$like':'%'+_0x55f142[_0x4958('0x32')][_0x4958('0x3b')]+'%'};return _0x392414;}})});}_0x347ad5=_[_0x4958('0x3d')]({},_0x347ad5,_0x55f142[_0x4958('0x3e')]);var _0x2d1f2f={'where':_0x347ad5[_0x4958('0x3a')]};return db[_0x4958('0x2a')][_0x4958('0x1a')](_0x2d1f2f)[_0x4958('0x22')](function(_0x346d69){_0x184f4c[_0x4958('0x1a')]=_0x346d69;if(_0x55f142[_0x4958('0x32')]['includeAll']){_0x347ad5[_0x4958('0x3f')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x347ad5);})[_0x4958('0x22')](function(_0x418eb1){_0x184f4c['rows']=_0x418eb1;return _0x184f4c;})[_0x4958('0x22')](respondWithFilteredResult(_0x29502b,_0x347ad5))['catch'](handleError(_0x29502b,null));};exports[_0x4958('0x40')]=function(_0x32a0d0,_0x106b7b){var _0x4f9daf={'raw':!![],'where':{'id':_0x32a0d0['params']['id']}},_0x4e3969={};_0x4e3969[_0x4958('0x2f')]=_['keys'](db[_0x4958('0x2a')]['rawAttributes']);_0x4e3969[_0x4958('0x32')]=_[_0x4958('0x31')](_0x32a0d0[_0x4958('0x32')]);_0x4e3969[_0x4958('0x33')]=_[_0x4958('0x34')](_0x4e3969[_0x4958('0x2f')],_0x4e3969[_0x4958('0x32')]);_0x4f9daf[_0x4958('0x36')]=_['intersection'](_0x4e3969[_0x4958('0x2f')],qs[_0x4958('0x35')](_0x32a0d0[_0x4958('0x32')][_0x4958('0x35')]));_0x4f9daf['attributes']=_0x4f9daf[_0x4958('0x36')][_0x4958('0x37')]?_0x4f9daf['attributes']:_0x4e3969[_0x4958('0x2f')];if(_0x32a0d0[_0x4958('0x32')]['includeAll']){_0x4f9daf[_0x4958('0x3f')]=[{'all':!![]}];}_0x4f9daf=_['merge']({},_0x4f9daf,_0x32a0d0['options']);return db[_0x4958('0x2a')][_0x4958('0x41')](_0x4f9daf)['then'](handleEntityNotFound(_0x106b7b,null))[_0x4958('0x22')](respondWithResult(_0x106b7b,null))[_0x4958('0x42')](handleError(_0x106b7b,null));};exports[_0x4958('0x43')]=function(_0x48000d,_0x479abd){return db[_0x4958('0x2a')][_0x4958('0x43')](_0x48000d['body'],{})[_0x4958('0x22')](respondWithResult(_0x479abd,0xc9))[_0x4958('0x42')](handleError(_0x479abd,null));};exports['update']=function(_0x5e6f93,_0x2e9d82){if(_0x5e6f93[_0x4958('0x44')]['id']){delete _0x5e6f93[_0x4958('0x44')]['id'];}return db[_0x4958('0x2a')][_0x4958('0x41')]({'where':{'id':_0x5e6f93[_0x4958('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e9d82,null))[_0x4958('0x22')](saveUpdates(_0x5e6f93['body'],null))['then'](respondWithResult(_0x2e9d82,null))[_0x4958('0x42')](handleError(_0x2e9d82,null));};exports['destroy']=function(_0x4ed2f2,_0x1981da){return db[_0x4958('0x2a')][_0x4958('0x41')]({'where':{'id':_0x4ed2f2[_0x4958('0x45')]['id']}})[_0x4958('0x22')](handleEntityNotFound(_0x1981da,null))[_0x4958('0x22')](removeEntity(_0x1981da,null))[_0x4958('0x42')](handleError(_0x1981da,null));};exports[_0x4958('0x46')]=function(_0x1809b3,_0x10beb5){return db[_0x4958('0x2a')][_0x4958('0x46')]()['then'](respondWithResult(_0x10beb5,null))[_0x4958('0x42')](handleError(_0x10beb5,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 43d82cf..20f8939 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 _0xb067=['moment','bluebird','request-promise','rimraf','./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3c2e6b,_0x12f686){var _0x4ddeb7=function(_0x5d8a22){while(--_0x5d8a22){_0x3c2e6b['push'](_0x3c2e6b['shift']());}};_0x4ddeb7(++_0x12f686);}(_0xb067,0xc8));var _0x7b06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb067[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7b06('0x0'));var util=require(_0x7b06('0x1'));var logger=require(_0x7b06('0x2'))(_0x7b06('0x3'));var moment=require(_0x7b06('0x4'));var BPromise=require(_0x7b06('0x5'));var rp=require(_0x7b06('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b06('0x7'));var config=require('../../config/environment');var attributes=require(_0x7b06('0x8'));module[_0x7b06('0x9')]=function(_0x15f511,_0x4261c6){return _0x15f511[_0x7b06('0xa')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7b06('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0dac=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x2bddd1,_0x43a74d){var _0x55ca88=function(_0x3ea724){while(--_0x3ea724){_0x2bddd1['push'](_0x2bddd1['shift']());}};_0x55ca88(++_0x43a74d);}(_0x0dac,0x6b));var _0xc0da=function(_0x42c50e,_0x3cedaf){_0x42c50e=_0x42c50e-0x0;var _0x2aff67=_0x0dac[_0x42c50e];return _0x2aff67;};'use strict';var _=require('lodash');var util=require(_0xc0da('0x0'));var logger=require(_0xc0da('0x1'))(_0xc0da('0x2'));var moment=require(_0xc0da('0x3'));var BPromise=require(_0xc0da('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0da('0x5'));var rimraf=require(_0xc0da('0x6'));var config=require(_0xc0da('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0xc0da('0x8')]=function(_0x44e213,_0x3531f7){return _0x44e213[_0xc0da('0x9')](_0xc0da('0xa'),attributes,{'tableName':_0xc0da('0xb'),'paranoid':![],'indexes':[{'name':_0xc0da('0xc'),'fields':[_0xc0da('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 006c1e1..1530d46 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 _0xc962=['WhatsappQueueReport','create','body','options','UpdateWhatsappQueueReport','update','raw','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappQueueReport'];(function(_0x208a09,_0x1952ec){var _0x54fbb4=function(_0x5920ff){while(--_0x5920ff){_0x208a09['push'](_0x208a09['shift']());}};_0x54fbb4(++_0x1952ec);}(_0xc962,0x18a));var _0x2c96=function(_0x386f0b,_0x3ad023){_0x386f0b=_0x386f0b-0x0;var _0x48227a=_0xc962[_0x386f0b];return _0x48227a;};'use strict';var _=require(_0x2c96('0x0'));var util=require(_0x2c96('0x1'));var moment=require(_0x2c96('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c96('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c96('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c96('0x5'));var config=require(_0x2c96('0x6'));var jayson=require(_0x2c96('0x7'));var client=jayson[_0x2c96('0x8')][_0x2c96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x551f70,_0x21bfb6,_0x5d2a27){return new BPromise(function(_0x5e13d2,_0x55acd5){return client['request'](_0x551f70,_0x5d2a27)[_0x2c96('0xa')](function(_0x19c433){logger[_0x2c96('0xb')](_0x2c96('0xc'),_0x21bfb6,_0x2c96('0xd'));logger[_0x2c96('0xe')](_0x2c96('0xf'),_0x21bfb6,'request\x20sent',JSON[_0x2c96('0x10')](_0x19c433));if(_0x19c433['error']){if(_0x19c433[_0x2c96('0x11')][_0x2c96('0x12')]===0x1f4){logger[_0x2c96('0x11')](_0x2c96('0xc'),_0x21bfb6,_0x19c433[_0x2c96('0x11')]['message']);return _0x55acd5(_0x19c433[_0x2c96('0x11')][_0x2c96('0x13')]);}logger[_0x2c96('0x11')](_0x2c96('0xc'),_0x21bfb6,_0x19c433[_0x2c96('0x11')][_0x2c96('0x13')]);return _0x5e13d2(_0x19c433[_0x2c96('0x11')][_0x2c96('0x13')]);}else{logger[_0x2c96('0xb')](_0x2c96('0xc'),_0x21bfb6,_0x2c96('0xd'));_0x5e13d2(_0x19c433[_0x2c96('0x14')]['message']);}})['catch'](function(_0x5d8637){logger[_0x2c96('0x11')](_0x2c96('0xc'),_0x21bfb6,_0x5d8637);_0x55acd5(_0x5d8637);});});}exports[_0x2c96('0x15')]=function(_0x349906){var _0x4b1294=this;return new Promise(function(_0x9783c6,_0x30dbbf){return db[_0x2c96('0x16')][_0x2c96('0x17')](_0x349906[_0x2c96('0x18')],{'raw':_0x349906[_0x2c96('0x19')]?_0x349906[_0x2c96('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2c96('0xa')](function(_0x20e2a9){logger['info'](_0x2c96('0x15'),_0x349906);logger[_0x2c96('0xe')]('CreateWhatsappQueueReport',_0x349906,JSON[_0x2c96('0x10')](_0x20e2a9));_0x9783c6(_0x20e2a9);})['catch'](function(_0x3a033f){logger['error']('CreateWhatsappQueueReport',_0x3a033f[_0x2c96('0x13')],_0x349906);_0x30dbbf(_0x4b1294['error'](0x1f4,_0x3a033f[_0x2c96('0x13')]));});});};exports[_0x2c96('0x1a')]=function(_0x133505){var _0x1c3586=this;return new Promise(function(_0x4ee5c4,_0x5389f0){return db[_0x2c96('0x16')][_0x2c96('0x1b')](_0x133505[_0x2c96('0x18')],{'raw':_0x133505[_0x2c96('0x19')]?_0x133505[_0x2c96('0x19')][_0x2c96('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x133505[_0x2c96('0x19')]?_0x133505[_0x2c96('0x19')][_0x2c96('0x1d')]||null:null,'attributes':_0x133505[_0x2c96('0x19')]?_0x133505[_0x2c96('0x19')][_0x2c96('0x1e')]||null:null,'limit':_0x133505[_0x2c96('0x19')]?_0x133505[_0x2c96('0x19')][_0x2c96('0x1f')]||null:null})[_0x2c96('0xa')](function(_0x130400){logger['info']('UpdateWhatsappQueueReport',_0x133505);logger[_0x2c96('0xe')]('UpdateWhatsappQueueReport',_0x133505,JSON[_0x2c96('0x10')](_0x130400));_0x4ee5c4(_0x130400);})['catch'](function(_0x30db66){logger[_0x2c96('0x11')](_0x2c96('0x1a'),_0x30db66['message'],_0x133505);_0x5389f0(_0x1c3586[_0x2c96('0x11')](0x1f4,_0x30db66[_0x2c96('0x13')]));});});}; \ No newline at end of file +var _0x17d8=['code','WhatsappQueueReport,\x20%s,\x20%s','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','UpdateWhatsappQueueReport','options','where','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5c0628,_0x53364e){var _0x5bbd16=function(_0x2b844b){while(--_0x2b844b){_0x5c0628['push'](_0x5c0628['shift']());}};_0x5bbd16(++_0x53364e);}(_0x17d8,0x111));var _0x817d=function(_0x400e23,_0x263deb){_0x400e23=_0x400e23-0x0;var _0x2f5e9d=_0x17d8[_0x400e23];return _0x2f5e9d;};'use strict';var _=require(_0x817d('0x0'));var util=require(_0x817d('0x1'));var moment=require('moment');var BPromise=require(_0x817d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x817d('0x3'));var db=require(_0x817d('0x4'))['db'];var utils=require(_0x817d('0x5'));var logger=require(_0x817d('0x6'))('rpc');var config=require(_0x817d('0x7'));var jayson=require(_0x817d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12ffab,_0x41e387,_0x5c1606){return new BPromise(function(_0x63253,_0x1229da){return client[_0x817d('0x9')](_0x12ffab,_0x5c1606)[_0x817d('0xa')](function(_0x19d904){logger[_0x817d('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x41e387,_0x817d('0xc'));logger[_0x817d('0xd')](_0x817d('0xe'),_0x41e387,'request\x20sent',JSON[_0x817d('0xf')](_0x19d904));if(_0x19d904[_0x817d('0x10')]){if(_0x19d904[_0x817d('0x10')][_0x817d('0x11')]===0x1f4){logger[_0x817d('0x10')](_0x817d('0x12'),_0x41e387,_0x19d904[_0x817d('0x10')][_0x817d('0x13')]);return _0x1229da(_0x19d904['error']['message']);}logger[_0x817d('0x10')](_0x817d('0x12'),_0x41e387,_0x19d904[_0x817d('0x10')][_0x817d('0x13')]);return _0x63253(_0x19d904[_0x817d('0x10')][_0x817d('0x13')]);}else{logger[_0x817d('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x41e387,'request\x20sent');_0x63253(_0x19d904['result'][_0x817d('0x13')]);}})[_0x817d('0x14')](function(_0x198998){logger[_0x817d('0x10')](_0x817d('0x12'),_0x41e387,_0x198998);_0x1229da(_0x198998);});});}exports[_0x817d('0x15')]=function(_0x43a12b){var _0x4e1ca3=this;return new Promise(function(_0x1ab0de,_0x33c4d9){return db[_0x817d('0x16')]['create'](_0x43a12b[_0x817d('0x17')],{'raw':_0x43a12b['options']?_0x43a12b['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x38a2e2){logger['info'](_0x817d('0x15'),_0x43a12b);logger['debug'](_0x817d('0x15'),_0x43a12b,JSON['stringify'](_0x38a2e2));_0x1ab0de(_0x38a2e2);})[_0x817d('0x14')](function(_0x144f42){logger[_0x817d('0x10')](_0x817d('0x15'),_0x144f42[_0x817d('0x13')],_0x43a12b);_0x33c4d9(_0x4e1ca3[_0x817d('0x10')](0x1f4,_0x144f42[_0x817d('0x13')]));});});};exports[_0x817d('0x18')]=function(_0x1905d7){var _0x427e9f=this;return new Promise(function(_0x45018f,_0x48e111){return db[_0x817d('0x16')]['update'](_0x1905d7[_0x817d('0x17')],{'raw':_0x1905d7['options']?_0x1905d7[_0x817d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1905d7[_0x817d('0x19')]?_0x1905d7[_0x817d('0x19')][_0x817d('0x1a')]||null:null,'attributes':_0x1905d7[_0x817d('0x19')]?_0x1905d7['options'][_0x817d('0x1b')]||null:null,'limit':_0x1905d7[_0x817d('0x19')]?_0x1905d7['options'][_0x817d('0x1c')]||null:null})[_0x817d('0xa')](function(_0x30e457){logger['info']('UpdateWhatsappQueueReport',_0x1905d7);logger[_0x817d('0xd')](_0x817d('0x18'),_0x1905d7,JSON['stringify'](_0x30e457));_0x45018f(_0x30e457);})[_0x817d('0x14')](function(_0x532df2){logger[_0x817d('0x10')](_0x817d('0x18'),_0x532df2[_0x817d('0x13')],_0x1905d7);_0x48e111(_0x427e9f[_0x817d('0x10')](0x1f4,_0x532df2[_0x817d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index eb9b451..0934caf 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 _0x0085=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','exports','multer','connect-timeout','express','fs-extra'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0x0085,0x150));var _0x5008=function(_0x2821a9,_0x54d53f){_0x2821a9=_0x2821a9-0x0;var _0x30bf24=_0x0085[_0x2821a9];return _0x30bf24;};'use strict';var multer=require(_0x5008('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5008('0x1'));var express=require(_0x5008('0x2'));var router=express['Router']();var fs_extra=require(_0x5008('0x3'));var auth=require(_0x5008('0x4'));var interaction=require(_0x5008('0x5'));var config=require(_0x5008('0x6'));var controller=require(_0x5008('0x7'));router[_0x5008('0x8')]('/',auth[_0x5008('0x9')](),controller[_0x5008('0xa')]);router[_0x5008('0x8')](_0x5008('0xb'),auth[_0x5008('0x9')](),controller[_0x5008('0xc')]);router[_0x5008('0x8')](_0x5008('0xd'),auth['isAuthenticated'](),controller[_0x5008('0xe')]);router['post']('/',auth[_0x5008('0x9')](),controller['create']);router[_0x5008('0xf')](_0x5008('0xd'),auth[_0x5008('0x9')](),controller['update']);router['delete'](_0x5008('0xd'),auth[_0x5008('0x9')](),controller['destroy']);module[_0x5008('0x10')]=router; \ No newline at end of file +var _0x28f2=['isAuthenticated','describe','/:id','show','post','create','put','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','index','/describe'];(function(_0x3c6a76,_0x1c5d6b){var _0x1cb742=function(_0x25f6ee){while(--_0x25f6ee){_0x3c6a76['push'](_0x3c6a76['shift']());}};_0x1cb742(++_0x1c5d6b);}(_0x28f2,0xf2));var _0x228f=function(_0x17a191,_0x1e56f0){_0x17a191=_0x17a191-0x0;var _0x279428=_0x28f2[_0x17a191];return _0x279428;};'use strict';var multer=require(_0x228f('0x0'));var util=require('util');var path=require(_0x228f('0x1'));var timeout=require(_0x228f('0x2'));var express=require(_0x228f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x228f('0x4'));var interaction=require(_0x228f('0x5'));var config=require('../../config/environment');var controller=require(_0x228f('0x6'));router[_0x228f('0x7')]('/',auth['isAuthenticated'](),controller[_0x228f('0x8')]);router[_0x228f('0x7')](_0x228f('0x9'),auth[_0x228f('0xa')](),controller[_0x228f('0xb')]);router['get'](_0x228f('0xc'),auth[_0x228f('0xa')](),controller[_0x228f('0xd')]);router[_0x228f('0xe')]('/',auth['isAuthenticated'](),controller[_0x228f('0xf')]);router[_0x228f('0x10')]('/:id',auth[_0x228f('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x228f('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 16ec971..916097e 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 _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file +var _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xb10b,0x12a));var _0xbb10=function(_0x6182ff,_0x59d492){_0x6182ff=_0x6182ff-0x0;var _0x1cec22=_0xb10b[_0x6182ff];return _0x1cec22;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 14609e7..dbac468 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 _0xde81=['offset','set','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','includeAll','find','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count'];(function(_0x23d13d,_0x41c91a){var _0x32a174=function(_0x5e3f7d){while(--_0x5e3f7d){_0x23d13d['push'](_0x23d13d['shift']());}};_0x32a174(++_0x41c91a);}(_0xde81,0x109));var _0x1de8=function(_0x5567dd,_0x35d872){_0x5567dd=_0x5567dd-0x0;var _0x11f96c=_0xde81[_0x5567dd];return _0x11f96c;};'use strict';var pdf=require(_0x1de8('0x0'));var emlformat=require(_0x1de8('0x1'));var rimraf=require(_0x1de8('0x2'));var zipdir=require(_0x1de8('0x3'));var jsonpatch=require(_0x1de8('0x4'));var rp=require(_0x1de8('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1de8('0x6'));var util=require('util');var path=require(_0x1de8('0x7'));var sox=require(_0x1de8('0x8'));var csv=require(_0x1de8('0x9'));var ejs=require(_0x1de8('0xa'));var fs=require('fs');var fs_extra=require(_0x1de8('0xb'));var _=require(_0x1de8('0xc'));var squel=require(_0x1de8('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1de8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1de8('0xf'));var Papa=require(_0x1de8('0x10'));var Redis=require(_0x1de8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1de8('0x12'));var as=require(_0x1de8('0x13'));var hardwareService=require(_0x1de8('0x14'));var logger=require(_0x1de8('0x15'))(_0x1de8('0x16'));var utils=require(_0x1de8('0x17'));var config=require(_0x1de8('0x18'));var licenseUtil=require(_0x1de8('0x19'));var db=require(_0x1de8('0x1a'))['db'];function respondWithStatusCode(_0x430fcf,_0x56126e){_0x56126e=_0x56126e||0xcc;return function(_0x389e31){if(_0x389e31){return _0x430fcf['sendStatus'](_0x56126e);}return _0x430fcf[_0x1de8('0x1b')](_0x56126e)[_0x1de8('0x1c')]();};}function respondWithResult(_0x4d0ed6,_0x547627){_0x547627=_0x547627||0xc8;return function(_0xd1dc7){if(_0xd1dc7){return _0x4d0ed6[_0x1de8('0x1b')](_0x547627)[_0x1de8('0x1d')](_0xd1dc7);}};}function respondWithFilteredResult(_0x1b6ca1,_0x578dbc){return function(_0x297130){if(_0x297130){var _0x44516f=_0x297130[_0x1de8('0x1e')],_0x407a54=_0x578dbc['offset'],_0x4d5fbc=_0x578dbc[_0x1de8('0x1f')]+_0x578dbc['limit'],_0x10efc1;if(_0x4d5fbc>=_0x44516f){_0x4d5fbc=_0x44516f;_0x10efc1=0xc8;}else{_0x10efc1=0xce;}_0x1b6ca1['status'](_0x10efc1);return _0x1b6ca1[_0x1de8('0x20')]('Content-Range',_0x407a54+'-'+_0x4d5fbc+'/'+_0x44516f)[_0x1de8('0x1d')](_0x297130);}return null;};}function patchUpdates(_0x475c40){return function(_0x2bf1b6){try{jsonpatch['apply'](_0x2bf1b6,_0x475c40,!![]);}catch(_0x3f0a5f){return BPromise[_0x1de8('0x21')](_0x3f0a5f);}return _0x2bf1b6[_0x1de8('0x22')]();};}function saveUpdates(_0x1e0dcf,_0x3b38ef){return function(_0x307426){if(_0x307426){return _0x307426[_0x1de8('0x23')](_0x1e0dcf)[_0x1de8('0x24')](function(_0x4af449){return _0x4af449;});}return null;};}function removeEntity(_0x9d0996,_0x441fcd){return function(_0x404696){if(_0x404696){return _0x404696[_0x1de8('0x25')]()[_0x1de8('0x24')](function(){_0x9d0996[_0x1de8('0x1b')](0xcc)[_0x1de8('0x1c')]();});}};}function handleEntityNotFound(_0x4ee74f,_0x43fe66){return function(_0x5051f6){if(!_0x5051f6){_0x4ee74f['sendStatus'](0x194);}return _0x5051f6;};}function handleError(_0xb6b4ce,_0x4600c7){_0x4600c7=_0x4600c7||0x1f4;return function(_0x1a4f2f){logger[_0x1de8('0x26')](_0x1a4f2f[_0x1de8('0x27')]);if(_0x1a4f2f[_0x1de8('0x28')]){delete _0x1a4f2f[_0x1de8('0x28')];}_0xb6b4ce[_0x1de8('0x1b')](_0x4600c7)[_0x1de8('0x29')](_0x1a4f2f);};}exports[_0x1de8('0x2a')]=function(_0x3b2ef5,_0x1b8870){var _0x2f207a={},_0x5a13b1={},_0x5e5156={'count':0x0,'rows':[]};var _0x9fcd44=_[_0x1de8('0x2b')](db[_0x1de8('0x2c')][_0x1de8('0x2d')],function(_0x5aee91){return{'name':_0x5aee91[_0x1de8('0x2e')],'type':_0x5aee91[_0x1de8('0x2f')]['key']};});_0x5a13b1[_0x1de8('0x30')]=_[_0x1de8('0x2b')](_0x9fcd44,_0x1de8('0x28'));_0x5a13b1[_0x1de8('0x31')]=_[_0x1de8('0x32')](_0x3b2ef5[_0x1de8('0x31')]);_0x5a13b1[_0x1de8('0x33')]=_[_0x1de8('0x34')](_0x5a13b1[_0x1de8('0x30')],_0x5a13b1[_0x1de8('0x31')]);_0x2f207a[_0x1de8('0x35')]=_[_0x1de8('0x34')](_0x5a13b1[_0x1de8('0x30')],qs[_0x1de8('0x36')](_0x3b2ef5[_0x1de8('0x31')]['fields']));_0x2f207a[_0x1de8('0x35')]=_0x2f207a[_0x1de8('0x35')][_0x1de8('0x37')]?_0x2f207a[_0x1de8('0x35')]:_0x5a13b1[_0x1de8('0x30')];if(!_0x3b2ef5[_0x1de8('0x31')]['hasOwnProperty']('nolimit')){_0x2f207a[_0x1de8('0x38')]=qs[_0x1de8('0x38')](_0x3b2ef5[_0x1de8('0x31')][_0x1de8('0x38')]);_0x2f207a[_0x1de8('0x1f')]=qs['offset'](_0x3b2ef5[_0x1de8('0x31')]['offset']);}_0x2f207a[_0x1de8('0x39')]=qs[_0x1de8('0x3a')](_0x3b2ef5[_0x1de8('0x31')]['sort']);_0x2f207a['where']=qs[_0x1de8('0x33')](_[_0x1de8('0x3b')](_0x3b2ef5[_0x1de8('0x31')],_0x5a13b1['filters']),_0x9fcd44);if(_0x3b2ef5['query'][_0x1de8('0x3c')]){_0x2f207a[_0x1de8('0x3d')]=_[_0x1de8('0x3e')](_0x2f207a[_0x1de8('0x3d')],{'$or':_['map'](_0x9fcd44,function(_0x40d62d){if(_0x40d62d[_0x1de8('0x2f')]!==_0x1de8('0x3f')){var _0x4775df={};_0x4775df[_0x40d62d[_0x1de8('0x28')]]={'$like':'%'+_0x3b2ef5[_0x1de8('0x31')][_0x1de8('0x3c')]+'%'};return _0x4775df;}})});}_0x2f207a=_['merge']({},_0x2f207a,_0x3b2ef5[_0x1de8('0x40')]);var _0x5bb7e4={'where':_0x2f207a['where']};return db[_0x1de8('0x2c')][_0x1de8('0x1e')](_0x5bb7e4)[_0x1de8('0x24')](function(_0x319034){_0x5e5156['count']=_0x319034;if(_0x3b2ef5[_0x1de8('0x31')]['includeAll']){_0x2f207a[_0x1de8('0x41')]=[{'all':!![]}];}return db[_0x1de8('0x2c')][_0x1de8('0x42')](_0x2f207a);})[_0x1de8('0x24')](function(_0x2cb2c7){_0x5e5156[_0x1de8('0x43')]=_0x2cb2c7;return _0x5e5156;})[_0x1de8('0x24')](respondWithFilteredResult(_0x1b8870,_0x2f207a))[_0x1de8('0x44')](handleError(_0x1b8870,null));};exports['show']=function(_0x5bba82,_0x131188){var _0x5038d6={'raw':!![],'where':{'id':_0x5bba82['params']['id']}},_0x356f36={};_0x356f36[_0x1de8('0x30')]=_['keys'](db[_0x1de8('0x2c')][_0x1de8('0x2d')]);_0x356f36['query']=_['keys'](_0x5bba82[_0x1de8('0x31')]);_0x356f36[_0x1de8('0x33')]=_[_0x1de8('0x34')](_0x356f36[_0x1de8('0x30')],_0x356f36[_0x1de8('0x31')]);_0x5038d6[_0x1de8('0x35')]=_[_0x1de8('0x34')](_0x356f36[_0x1de8('0x30')],qs['fields'](_0x5bba82[_0x1de8('0x31')]['fields']));_0x5038d6[_0x1de8('0x35')]=_0x5038d6[_0x1de8('0x35')][_0x1de8('0x37')]?_0x5038d6['attributes']:_0x356f36[_0x1de8('0x30')];if(_0x5bba82[_0x1de8('0x31')][_0x1de8('0x45')]){_0x5038d6['include']=[{'all':!![]}];}_0x5038d6=_['merge']({},_0x5038d6,_0x5bba82[_0x1de8('0x40')]);return db[_0x1de8('0x2c')][_0x1de8('0x46')](_0x5038d6)[_0x1de8('0x24')](handleEntityNotFound(_0x131188,null))[_0x1de8('0x24')](respondWithResult(_0x131188,null))[_0x1de8('0x44')](handleError(_0x131188,null));};exports['create']=function(_0x5e6450,_0x3bc48c){return db['WhatsappTransferReport']['create'](_0x5e6450[_0x1de8('0x47')],{})[_0x1de8('0x24')](respondWithResult(_0x3bc48c,0xc9))[_0x1de8('0x44')](handleError(_0x3bc48c,null));};exports['update']=function(_0x420782,_0x3d4d8f){if(_0x420782[_0x1de8('0x47')]['id']){delete _0x420782['body']['id'];}return db[_0x1de8('0x2c')][_0x1de8('0x46')]({'where':{'id':_0x420782['params']['id']}})['then'](handleEntityNotFound(_0x3d4d8f,null))[_0x1de8('0x24')](saveUpdates(_0x420782['body'],null))[_0x1de8('0x24')](respondWithResult(_0x3d4d8f,null))['catch'](handleError(_0x3d4d8f,null));};exports[_0x1de8('0x25')]=function(_0x581683,_0x56fa7c){return db['WhatsappTransferReport']['find']({'where':{'id':_0x581683[_0x1de8('0x48')]['id']}})[_0x1de8('0x24')](handleEntityNotFound(_0x56fa7c,null))[_0x1de8('0x24')](removeEntity(_0x56fa7c,null))['catch'](handleError(_0x56fa7c,null));};exports[_0x1de8('0x49')]=function(_0x1bb02a,_0x27a96e){return db[_0x1de8('0x2c')][_0x1de8('0x49')]()[_0x1de8('0x24')](respondWithResult(_0x27a96e,null))[_0x1de8('0x44')](handleError(_0x27a96e,null));}; \ No newline at end of file +var _0x4e47=['merge','type','VIRTUAL','options','findAll','rows','catch','params','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','then','destroy','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x4e47,0x17f));var _0x74e4=function(_0x4e60a3,_0x29f793){_0x4e60a3=_0x4e60a3-0x0;var _0x1ba685=_0x4e47[_0x4e60a3];return _0x1ba685;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x74e4('0x0'));var zipdir=require(_0x74e4('0x1'));var jsonpatch=require(_0x74e4('0x2'));var rp=require(_0x74e4('0x3'));var moment=require(_0x74e4('0x4'));var BPromise=require(_0x74e4('0x5'));var Mustache=require(_0x74e4('0x6'));var util=require(_0x74e4('0x7'));var path=require('path');var sox=require(_0x74e4('0x8'));var csv=require(_0x74e4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x74e4('0xa'));var _=require(_0x74e4('0xb'));var squel=require(_0x74e4('0xc'));var crypto=require(_0x74e4('0xd'));var jsforce=require(_0x74e4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x74e4('0x9'));var querystring=require(_0x74e4('0xf'));var Papa=require(_0x74e4('0x10'));var Redis=require(_0x74e4('0x11'));var authService=require(_0x74e4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x74e4('0x13'));var hardwareService=require(_0x74e4('0x14'));var logger=require('../../config/logger')(_0x74e4('0x15'));var utils=require('../../config/utils');var config=require(_0x74e4('0x16'));var licenseUtil=require(_0x74e4('0x17'));var db=require(_0x74e4('0x18'))['db'];function respondWithStatusCode(_0x1af9a1,_0x2b2e65){_0x2b2e65=_0x2b2e65||0xcc;return function(_0x3aac88){if(_0x3aac88){return _0x1af9a1[_0x74e4('0x19')](_0x2b2e65);}return _0x1af9a1[_0x74e4('0x1a')](_0x2b2e65)[_0x74e4('0x1b')]();};}function respondWithResult(_0x41aad9,_0x1126ce){_0x1126ce=_0x1126ce||0xc8;return function(_0x55503e){if(_0x55503e){return _0x41aad9['status'](_0x1126ce)['json'](_0x55503e);}};}function respondWithFilteredResult(_0x564953,_0x22cbed){return function(_0x436369){if(_0x436369){var _0x2c427b=_0x436369[_0x74e4('0x1c')],_0x565321=_0x22cbed[_0x74e4('0x1d')],_0x386f18=_0x22cbed[_0x74e4('0x1d')]+_0x22cbed[_0x74e4('0x1e')],_0x46998b;if(_0x386f18>=_0x2c427b){_0x386f18=_0x2c427b;_0x46998b=0xc8;}else{_0x46998b=0xce;}_0x564953[_0x74e4('0x1a')](_0x46998b);return _0x564953[_0x74e4('0x1f')]('Content-Range',_0x565321+'-'+_0x386f18+'/'+_0x2c427b)[_0x74e4('0x20')](_0x436369);}return null;};}function patchUpdates(_0x21c91f){return function(_0x4d837f){try{jsonpatch['apply'](_0x4d837f,_0x21c91f,!![]);}catch(_0x4aebb0){return BPromise[_0x74e4('0x21')](_0x4aebb0);}return _0x4d837f[_0x74e4('0x22')]();};}function saveUpdates(_0x394adc,_0x129d02){return function(_0x1fb664){if(_0x1fb664){return _0x1fb664[_0x74e4('0x23')](_0x394adc)[_0x74e4('0x24')](function(_0x2e56a6){return _0x2e56a6;});}return null;};}function removeEntity(_0x2e991d,_0x4c270f){return function(_0x198ea8){if(_0x198ea8){return _0x198ea8[_0x74e4('0x25')]()[_0x74e4('0x24')](function(){_0x2e991d['status'](0xcc)[_0x74e4('0x1b')]();});}};}function handleEntityNotFound(_0x5b013a,_0x400d02){return function(_0x590718){if(!_0x590718){_0x5b013a[_0x74e4('0x19')](0x194);}return _0x590718;};}function handleError(_0x278bdc,_0x131893){_0x131893=_0x131893||0x1f4;return function(_0x4baf61){logger[_0x74e4('0x26')](_0x4baf61['stack']);if(_0x4baf61[_0x74e4('0x27')]){delete _0x4baf61[_0x74e4('0x27')];}_0x278bdc[_0x74e4('0x1a')](_0x131893)[_0x74e4('0x28')](_0x4baf61);};}exports[_0x74e4('0x29')]=function(_0x59203d,_0x55a7a4){var _0x265b21={},_0x1dd270={},_0x68ad72={'count':0x0,'rows':[]};var _0x4a0b02=_[_0x74e4('0x2a')](db[_0x74e4('0x2b')][_0x74e4('0x2c')],function(_0x316142){return{'name':_0x316142[_0x74e4('0x2d')],'type':_0x316142['type'][_0x74e4('0x2e')]};});_0x1dd270[_0x74e4('0x2f')]=_[_0x74e4('0x2a')](_0x4a0b02,_0x74e4('0x27'));_0x1dd270[_0x74e4('0x30')]=_[_0x74e4('0x31')](_0x59203d[_0x74e4('0x30')]);_0x1dd270['filters']=_['intersection'](_0x1dd270[_0x74e4('0x2f')],_0x1dd270['query']);_0x265b21['attributes']=_[_0x74e4('0x32')](_0x1dd270[_0x74e4('0x2f')],qs[_0x74e4('0x33')](_0x59203d['query'][_0x74e4('0x33')]));_0x265b21[_0x74e4('0x34')]=_0x265b21['attributes'][_0x74e4('0x35')]?_0x265b21[_0x74e4('0x34')]:_0x1dd270[_0x74e4('0x2f')];if(!_0x59203d[_0x74e4('0x30')]['hasOwnProperty'](_0x74e4('0x36'))){_0x265b21[_0x74e4('0x1e')]=qs[_0x74e4('0x1e')](_0x59203d['query']['limit']);_0x265b21[_0x74e4('0x1d')]=qs[_0x74e4('0x1d')](_0x59203d[_0x74e4('0x30')][_0x74e4('0x1d')]);}_0x265b21[_0x74e4('0x37')]=qs[_0x74e4('0x38')](_0x59203d[_0x74e4('0x30')][_0x74e4('0x38')]);_0x265b21[_0x74e4('0x39')]=qs[_0x74e4('0x3a')](_[_0x74e4('0x3b')](_0x59203d[_0x74e4('0x30')],_0x1dd270[_0x74e4('0x3a')]),_0x4a0b02);if(_0x59203d[_0x74e4('0x30')][_0x74e4('0x3c')]){_0x265b21[_0x74e4('0x39')]=_[_0x74e4('0x3d')](_0x265b21[_0x74e4('0x39')],{'$or':_[_0x74e4('0x2a')](_0x4a0b02,function(_0x49b315){if(_0x49b315[_0x74e4('0x3e')]!==_0x74e4('0x3f')){var _0x3cdb9f={};_0x3cdb9f[_0x49b315[_0x74e4('0x27')]]={'$like':'%'+_0x59203d['query'][_0x74e4('0x3c')]+'%'};return _0x3cdb9f;}})});}_0x265b21=_[_0x74e4('0x3d')]({},_0x265b21,_0x59203d[_0x74e4('0x40')]);var _0x22bce9={'where':_0x265b21[_0x74e4('0x39')]};return db[_0x74e4('0x2b')][_0x74e4('0x1c')](_0x22bce9)[_0x74e4('0x24')](function(_0x448e8a){_0x68ad72[_0x74e4('0x1c')]=_0x448e8a;if(_0x59203d[_0x74e4('0x30')]['includeAll']){_0x265b21['include']=[{'all':!![]}];}return db[_0x74e4('0x2b')][_0x74e4('0x41')](_0x265b21);})['then'](function(_0x1dd5f0){_0x68ad72[_0x74e4('0x42')]=_0x1dd5f0;return _0x68ad72;})[_0x74e4('0x24')](respondWithFilteredResult(_0x55a7a4,_0x265b21))[_0x74e4('0x43')](handleError(_0x55a7a4,null));};exports['show']=function(_0x1495f0,_0x429344){var _0xa3672a={'raw':!![],'where':{'id':_0x1495f0[_0x74e4('0x44')]['id']}},_0x4a092e={};_0x4a092e['model']=_[_0x74e4('0x31')](db[_0x74e4('0x2b')][_0x74e4('0x2c')]);_0x4a092e[_0x74e4('0x30')]=_['keys'](_0x1495f0[_0x74e4('0x30')]);_0x4a092e['filters']=_['intersection'](_0x4a092e[_0x74e4('0x2f')],_0x4a092e[_0x74e4('0x30')]);_0xa3672a[_0x74e4('0x34')]=_[_0x74e4('0x32')](_0x4a092e[_0x74e4('0x2f')],qs[_0x74e4('0x33')](_0x1495f0[_0x74e4('0x30')][_0x74e4('0x33')]));_0xa3672a[_0x74e4('0x34')]=_0xa3672a['attributes']['length']?_0xa3672a['attributes']:_0x4a092e[_0x74e4('0x2f')];if(_0x1495f0['query']['includeAll']){_0xa3672a[_0x74e4('0x45')]=[{'all':!![]}];}_0xa3672a=_['merge']({},_0xa3672a,_0x1495f0[_0x74e4('0x40')]);return db[_0x74e4('0x2b')][_0x74e4('0x46')](_0xa3672a)[_0x74e4('0x24')](handleEntityNotFound(_0x429344,null))[_0x74e4('0x24')](respondWithResult(_0x429344,null))[_0x74e4('0x43')](handleError(_0x429344,null));};exports[_0x74e4('0x47')]=function(_0x52396a,_0x39d517){return db[_0x74e4('0x2b')][_0x74e4('0x47')](_0x52396a[_0x74e4('0x48')],{})['then'](respondWithResult(_0x39d517,0xc9))[_0x74e4('0x43')](handleError(_0x39d517,null));};exports[_0x74e4('0x23')]=function(_0x5b25d9,_0x1d1abc){if(_0x5b25d9['body']['id']){delete _0x5b25d9['body']['id'];}return db['WhatsappTransferReport'][_0x74e4('0x46')]({'where':{'id':_0x5b25d9[_0x74e4('0x44')]['id']}})[_0x74e4('0x24')](handleEntityNotFound(_0x1d1abc,null))[_0x74e4('0x24')](saveUpdates(_0x5b25d9[_0x74e4('0x48')],null))[_0x74e4('0x24')](respondWithResult(_0x1d1abc,null))[_0x74e4('0x43')](handleError(_0x1d1abc,null));};exports['destroy']=function(_0x4689cd,_0x4d4a6a){return db[_0x74e4('0x2b')][_0x74e4('0x46')]({'where':{'id':_0x4689cd[_0x74e4('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4a6a,null))[_0x74e4('0x24')](removeEntity(_0x4d4a6a,null))[_0x74e4('0x43')](handleError(_0x4d4a6a,null));};exports['describe']=function(_0x97d180,_0x1e108e){return db[_0x74e4('0x2b')][_0x74e4('0x49')]()[_0x74e4('0x24')](respondWithResult(_0x1e108e,null))['catch'](handleError(_0x1e108e,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 055f000..a339bbf 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 _0x105f=['report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','request-promise','../../config/environment','./whatsappTransferReport.attributes','exports','define'];(function(_0x3637a2,_0x3de087){var _0x439550=function(_0x5e5c26){while(--_0x5e5c26){_0x3637a2['push'](_0x3637a2['shift']());}};_0x439550(++_0x3de087);}(_0x105f,0x188));var _0xf105=function(_0x2068f7,_0x45455d){_0x2068f7=_0x2068f7-0x0;var _0x593fd5=_0x105f[_0x2068f7];return _0x593fd5;};'use strict';var _=require(_0xf105('0x0'));var util=require(_0xf105('0x1'));var logger=require(_0xf105('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf105('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf105('0x4'));var attributes=require(_0xf105('0x5'));module[_0xf105('0x6')]=function(_0x15c899,_0xe3df76){return _0x15c899[_0xf105('0x7')]('WhatsappTransferReport',attributes,{'tableName':_0xf105('0x8'),'paranoid':![],'indexes':[{'name':_0xf105('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9cf8=['bluebird','request-promise','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api'];(function(_0x15fbd7,_0x1980ff){var _0x4bb927=function(_0xcedefa){while(--_0xcedefa){_0x15fbd7['push'](_0x15fbd7['shift']());}};_0x4bb927(++_0x1980ff);}(_0x9cf8,0x101));var _0x89cf=function(_0x14ef09,_0x48ae6e){_0x14ef09=_0x14ef09-0x0;var _0x17dc7b=_0x9cf8[_0x14ef09];return _0x17dc7b;};'use strict';var _=require('lodash');var util=require(_0x89cf('0x0'));var logger=require(_0x89cf('0x1'))(_0x89cf('0x2'));var moment=require('moment');var BPromise=require(_0x89cf('0x3'));var rp=require(_0x89cf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x89cf('0x5'));module['exports']=function(_0x35c675,_0xabad33){return _0x35c675[_0x89cf('0x6')](_0x89cf('0x7'),attributes,{'tableName':_0x89cf('0x8'),'paranoid':![],'indexes':[{'name':_0x89cf('0x9'),'fields':[_0x89cf('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 88a5808..d327115 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 _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x3ab1c8,_0x4932e3){var _0x5992f3=function(_0x3072a9){while(--_0x3072a9){_0x3ab1c8['push'](_0x3ab1c8['shift']());}};_0x5992f3(++_0x4932e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x310b04,_0x39df04){var _0x32f154=function(_0xa9e566){while(--_0xa9e566){_0x310b04['push'](_0x310b04['shift']());}};_0x32f154(++_0x39df04);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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/app.js b/server/app.js index 92276ca..efcc424 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3a8=['seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/logger','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','filter','online','join','Offline\x20apps:','name','None'];(function(_0x2fc7fa,_0x3281fe){var _0x19b421=function(_0x8810b5){while(--_0x8810b5){_0x2fc7fa['push'](_0x2fc7fa['shift']());}};_0x19b421(++_0x3281fe);}(_0xf3a8,0xf2));var _0x8f3a=function(_0x579bb4,_0xe79966){_0x579bb4=_0x579bb4-0x0;var _0x1e66e4=_0xf3a8[_0x579bb4];return _0x1e66e4;};'use strict';var _=require('lodash');var mysqldb=require(_0x8f3a('0x0'));var rpc=require(_0x8f3a('0x1'));var config=require('./config/environment');var logger=require(_0x8f3a('0x2'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0x8f3a('0x3'));var schedule=require('./config/schedule');var chat=require(_0x8f3a('0x4'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x8f3a('0x5'));function main(){return mysqldb['db'][_0x8f3a('0x6')][_0x8f3a('0x7')]()[_0x8f3a('0x8')](function(){return rpc[_0x8f3a('0x9')]();})[_0x8f3a('0x8')](function(_0x3dc1ea){logger[_0x8f3a('0xa')](_0x3dc1ea);return chat[_0x8f3a('0xb')]();})['then'](function(){return whatsapp[_0x8f3a('0xb')]();})['then'](function(){return schedule[_0x8f3a('0xb')]();})[_0x8f3a('0x8')](function(){return transcribe[_0x8f3a('0xb')]();})[_0x8f3a('0x8')](function(_0x1d3385){logger['info'](_0x1d3385);return pm2[_0x8f3a('0xb')](pm2Config);})[_0x8f3a('0x8')](function(_0x594252){logger[_0x8f3a('0xa')]('Online\x20apps:',_['map'](_[_0x8f3a('0xc')](_0x594252,{'status':_0x8f3a('0xd')}),'name')[_0x8f3a('0xe')]());logger[_0x8f3a('0xa')](_0x8f3a('0xf'),_['map'](_[_0x8f3a('0xc')](_0x594252,function(_0x475f2a){return _0x475f2a['status']!==_0x8f3a('0xd');}),_0x8f3a('0x10'))['join']()||_0x8f3a('0x11'));config[_0x8f3a('0x12')]&&require(_0x8f3a('0x13'))[_0x8f3a('0x14')]();require(_0x8f3a('0x15'))['default']();})[_0x8f3a('0x16')](function(_0x2b05ef){logger[_0x8f3a('0x17')](_0x8f3a('0x18'),_0x2b05ef);process[_0x8f3a('0x19')](0x1);});}main(); \ No newline at end of file +var _0xb19a=['lodash','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','listen','start','info','Online\x20apps:','filter','online','name','join','Offline\x20apps:','map','status','./config/seedDB','default','./config/license','error','exit'];(function(_0x219d87,_0x1cb6f7){var _0x22823d=function(_0x5357bf){while(--_0x5357bf){_0x219d87['push'](_0x219d87['shift']());}};_0x22823d(++_0x1cb6f7);}(_0xb19a,0xd0));var _0xab19=function(_0x1d28da,_0x4a31a3){_0x1d28da=_0x1d28da-0x0;var _0x518824=_0xb19a[_0x1d28da];return _0x518824;};'use strict';var _=require(_0xab19('0x0'));var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require(_0xab19('0x1'));var logger=require('./config/logger')('app');var pm2=require(_0xab19('0x2'));var pm2Config=require(_0xab19('0x3'));var schedule=require(_0xab19('0x4'));var chat=require(_0xab19('0x5'));var whatsapp=require(_0xab19('0x6'));var transcribe=require(_0xab19('0x7'));function main(){return mysqldb['db'][_0xab19('0x8')]['sync']()[_0xab19('0x9')](function(){return rpc[_0xab19('0xa')]();})['then'](function(_0x300038){logger['info'](_0x300038);return chat[_0xab19('0xb')]();})[_0xab19('0x9')](function(){return whatsapp[_0xab19('0xb')]();})[_0xab19('0x9')](function(){return schedule[_0xab19('0xb')]();})[_0xab19('0x9')](function(){return transcribe[_0xab19('0xb')]();})[_0xab19('0x9')](function(_0x7102e){logger[_0xab19('0xc')](_0x7102e);return pm2[_0xab19('0xb')](pm2Config);})[_0xab19('0x9')](function(_0x4b10a7){logger['info'](_0xab19('0xd'),_['map'](_[_0xab19('0xe')](_0x4b10a7,{'status':_0xab19('0xf')}),_0xab19('0x10'))[_0xab19('0x11')]());logger[_0xab19('0xc')](_0xab19('0x12'),_[_0xab19('0x13')](_['filter'](_0x4b10a7,function(_0x412eb8){return _0x412eb8[_0xab19('0x14')]!=='online';}),_0xab19('0x10'))[_0xab19('0x11')]()||'None');config['seedDB']&&require(_0xab19('0x15'))[_0xab19('0x16')]();require(_0xab19('0x17'))[_0xab19('0x16')]();})['catch'](function(_0x37af3d){logger[_0xab19('0x18')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x37af3d);process[_0xab19('0x19')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index a89a5c1..2f37131 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 _0x988b=['toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','bluebird','secrets','fullname','internal','email','userpic','md5secret','voicePause','chatPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Forbidden.','catch','headers','authorization','startsWith','User','find','pass','Wrong\x20credentials.','apikey','getUuid','query','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','session','payload','options','verify','randomBytes'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0x988b,0x16d));var _0xb988=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x988b[_0x28d18d];return _0x470640;};'use strict';var db=require(_0xb988('0x0'))['db'];var config=require(_0xb988('0x1'));var hardwareConf=require(_0xb988('0x2'));var licenseUtil=require(_0xb988('0x3'));var encryptor=require('../encryptor');var _=require(_0xb988('0x4'));var jwt=require(_0xb988('0x5'));var expressJwt=require(_0xb988('0x6'));var compose=require(_0xb988('0x7'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0xb988('0x8'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb988('0x9')]['session']});var userAttributes=['id','role',_0xb988('0xa'),'name',_0xb988('0xb'),_0xb988('0xc'),_0xb988('0xd'),'permissions',_0xb988('0xe'),_0xb988('0xf'),_0xb988('0x10'),'mailPause','faxPause','smsPause',_0xb988('0x11'),_0xb988('0x12'),_0xb988('0x13'),_0xb988('0x14'),_0xb988('0x15'),_0xb988('0x16'),_0xb988('0x17'),_0xb988('0x18'),_0xb988('0x19'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0xb988('0x1a'),_0xb988('0x1b'),_0xb988('0x1c'),'phoneBarEnableSettings',_0xb988('0x1d'),_0xb988('0x1e'),_0xb988('0x1f'),'phoneBarRemoteControlPort',_0xb988('0x20'),_0xb988('0x21'),_0xb988('0x22'),_0xb988('0x23')];exports[_0xb988('0x24')]=function(){return this[_0xb988('0x25')](!![])[_0xb988('0x26')](function(_0x461bde,_0x45de18,_0x9bdd21){if(_0x461bde[_0xb988('0x27')]){_0x9bdd21();}else{return db[_0xb988('0x28')][_0xb988('0x29')]({'where':{'id':_0x461bde[_0xb988('0x2a')]['id']},'attributes':['id',_0xb988('0x2b'),_0xb988('0x2c')],'raw':!![]})[_0xb988('0x2d')](function(_0x44abc3){if(_0x44abc3&&_0x44abc3[_0xb988('0x2b')]){return _0x45de18[_0xb988('0x2e')](_0x44abc3['disposition']===_0xb988('0x2f')?0x195:0x193)[_0xb988('0x30')]({'message':_0x44abc3[_0xb988('0x2c')]===_0xb988('0x2f')?'Unmanaged.':_0xb988('0x31')});}else{_0x9bdd21();}})[_0xb988('0x32')](function(_0x5c87ad){_0x9bdd21(_0x5c87ad);});}});};exports[_0xb988('0x25')]=function isAuthenticated(_0x44e177){return compose()[_0xb988('0x26')](function(_0x1444cb,_0x4e3e51,_0x6d6d55){var _0x2d2018;if(_0x1444cb[_0xb988('0x33')][_0xb988('0x34')]){if(_[_0xb988('0x35')](_0x1444cb[_0xb988('0x33')][_0xb988('0x34')],'Basic')){var _0x346dc5=basicAuth(_0x1444cb);db[_0xb988('0x36')][_0xb988('0x37')]({'where':{'name':_0x346dc5['name']}})[_0xb988('0x2d')](function(_0x568af1){if(!_0x568af1||!_0x568af1['authenticate'](_0x346dc5[_0xb988('0x38')])){return _0x4e3e51[_0xb988('0x2e')](0x191)[_0xb988('0x30')]({'message':_0xb988('0x39')});}_0x1444cb['user']={'id':_0x568af1['id']};_0x6d6d55();})[_0xb988('0x32')](function(_0x41e823){_0x6d6d55(_0x41e823);});}else if(_[_0xb988('0x35')](_0x1444cb['headers'][_0xb988('0x34')],'Bearer')){validateJwt(_0x1444cb,_0x4e3e51,_0x6d6d55);}else{if(_0x44e177){_0x6d6d55();}else{return _0x4e3e51[_0xb988('0x2e')](0x193)[_0xb988('0x30')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x1444cb['query'][_0xb988('0x3a')]){try{var _0x456ddc={'audience':hardwareConf[_0xb988('0x3b')](),'issuer':hardwareConf[_0xb988('0x3b')]()};verifyJwt(_0x1444cb[_0xb988('0x3c')][_0xb988('0x3a')],_0x456ddc)[_0xb988('0x2d')](function(_0x1bf1f9){return db[_0xb988('0x36')][_0xb988('0x37')]({'where':{'id':_0x1bf1f9[_0xb988('0x3d')]}})[_0xb988('0x2d')](function(_0x3b0171){_0x2d2018=_0x3b0171;return db[_0xb988('0x3e')]['findOne']({'where':{'id':0x1},'attributes':[_0xb988('0x3f'),_0xb988('0x40')],'raw':!![]});})['then'](function(_0x475b87){if(!_0x2d2018||!_[_0xb988('0x41')](_0x2d2018[_0xb988('0x42')],_0x1bf1f9['nonce'])){return _0x4e3e51[_0xb988('0x2e')](0x191)[_0xb988('0x30')]({'message':_0xb988('0x43')});}if(_0x2d2018[_0xb988('0x44')]){return _0x4e3e51[_0xb988('0x2e')](0x191)[_0xb988('0x30')]({'message':_0xb988('0x45')});}if(_0x2d2018[_0xb988('0x46')]){if(_0x475b87[_0xb988('0x40')]>0x0){if(moment(_0x2d2018[_0xb988('0x47')])[_0xb988('0x48')](_0x475b87[_0xb988('0x40')],_0xb988('0x49'))>moment()){return _0x4e3e51[_0xb988('0x2e')](0x191)[_0xb988('0x30')]({'message':_0xb988('0x45')});}}else{return _0x4e3e51[_0xb988('0x2e')](0x191)[_0xb988('0x30')]({'message':_0xb988('0x45')});}}_0x1444cb[_0xb988('0x27')]={'id':_0x2d2018['id']};_0x6d6d55();});})['catch'](function(){return _0x4e3e51[_0xb988('0x2e')](0x191)['json']({'message':_0xb988('0x45')});});}catch(_0x326af5){_0x6d6d55(_0x326af5);}}else if(_0x44e177){_0x6d6d55();}else{return _0x4e3e51[_0xb988('0x2e')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x42a862,_0x4e74dc,_0x3aa23e){if(_0x42a862[_0xb988('0x27')]){db['User'][_0xb988('0x37')]({'where':{'id':_0x42a862['user']['id']},'attributes':userAttributes})[_0xb988('0x2d')](function(_0x1d7589){if(!_0x1d7589){return _0x4e74dc['status'](0x194)[_0xb988('0x30')]({'message':_0xb988('0x4a')});}_0x42a862[_0xb988('0x27')]=_0x1d7589;_0x3aa23e();})[_0xb988('0x32')](function(_0x40018a){_0x3aa23e(_0x40018a);});}else if(_0x44e177){_0x3aa23e();}else{return _0x4e74dc[_0xb988('0x2e')](0x194)[_0xb988('0x30')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xb988('0x4b')]=function canUpdate(){return compose()['use'](function(_0x55310f,_0x40f0e1,_0x5cea91){return licenseUtil[_0xb988('0x4c')]()[_0xb988('0x2d')](function(_0x6aa4b3){if(_0x6aa4b3[_0xb988('0x4d')]){_0x5cea91();}else{return _0x40f0e1[_0xb988('0x2e')](0x193)['json']({'message':_0xb988('0x4e')});}})[_0xb988('0x32')](function(_0x203e2){_0x5cea91(_0x203e2);});});};exports[_0xb988('0x4f')]=function(_0x6b901d,_0x23975c,_0x56e3b7){_0x6b901d[_0xb988('0x4f')]=!![];return _0x56e3b7();};exports['signToken']=function signToken(_0x5c4588){return signJwt(_0x5c4588);};exports[_0xb988('0x50')]=function(_0x27368f,_0x5ccd19){if(!_0x27368f[_0xb988('0x27')]){return _0x5ccd19[_0xb988('0x2e')](0x194)[_0xb988('0x30')]({'message':_0xb988('0x51')});}var _0x19cbe6={'payload':{'id':_0x27368f[_0xb988('0x27')]['id'],'role':_0x27368f[_0xb988('0x27')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x19cbe6)[_0xb988('0x2d')](function(_0x44106d){_0x5ccd19[_0xb988('0x52')](_0xb988('0x53'),_0x44106d);_0x5ccd19[_0xb988('0x54')](_0xb988('0x55'));})['catch'](function(_0x44bbd7){return _0x5ccd19[_0xb988('0x2e')](0x1f4)[_0xb988('0x56')](_0x44bbd7);});};exports[_0xb988('0x57')]=function(_0x42d200){if(_[_0xb988('0x58')](_0x42d200['apiKeyNonce'])||_['isNil'](_0x42d200[_0xb988('0x59')])){return null;}else{return createJwt(_0x42d200);}};exports[_0xb988('0x5a')]=function(_0x11c0ba){_0x11c0ba['apiKeyNonce']=generateNonce();_0x11c0ba[_0xb988('0x59')]=generateIssuedAt();return createJwt(_0x11c0ba);};exports['regenerateApiKey']=function(_0x48e493,_0x48f3ff){var _0x5c94d1=_0x48e493[_0xb988('0x3c')][_0xb988('0x3a')];if(_0x5c94d1){var _0x4de21c={'nonce':_0x48f3ff[_0xb988('0x42')],'iat':_0x48f3ff['apiKeyIat'],'audience':hardwareConf[_0xb988('0x3b')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x5c94d1,_0x4de21c)[_0xb988('0x2d')](function(){return generateApiKey(_0x48f3ff);});}else{throw{'message':_0xb988('0x5b')};}};exports[_0xb988('0x5c')]=function(_0x5955b6){var _0x21dd13=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x21dd13['test'](_0x5955b6))throw new db[(_0xb988('0x5d'))][(_0xb988('0x5e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xb988('0x5f')]=function(_0x51c76e,_0x5841c0,_0x2c514d){var _0x46e252=encryptor[_0xb988('0x60')](_0x5841c0)[_0xb988('0x61')](',');for(var _0x2b0da1=0x0;_0x2b0da1<_0x2c514d;_0x2b0da1++){if(!_0x46e252[_0x2b0da1])break;if(_0x51c76e[_0xb988('0x62')]()===_0x46e252[_0x2b0da1][_0xb988('0x62')]()){var _0x2138ef=util[_0xb988('0x63')](_0xb988('0x64'),_0x2c514d);if(_0x2c514d===0x1){_0x2138ef=_0xb988('0x65');}throw new db[(_0xb988('0x5d'))][(_0xb988('0x5e'))](_0x2138ef);}}return;};exports[_0xb988('0x66')]=function(_0x96ab6e,_0x38b4db){var _0x4c2688=_0x38b4db?encryptor[_0xb988('0x60')](_0x38b4db)[_0xb988('0x61')](','):[];if(_0x4c2688[_0xb988('0x67')]===0x5){_0x4c2688[_0xb988('0x68')](-0x1,0x1);}_0x4c2688[_0xb988('0x69')](_0x96ab6e);return encryptor[_0xb988('0x6a')](_0x4c2688[_0xb988('0x6b')](','));};function signJwt(_0xa7c29){var _0xed0028=BPromise[_0xb988('0x6c')](jwt[_0xb988('0x6d')],{'context':jwt});var _0x530d8a=_0xa7c29['secret']||config[_0xb988('0x9')][_0xb988('0x6e')];return new BPromise(function(_0x5ccd74,_0x28a86f){_0xed0028(_0xa7c29[_0xb988('0x6f')],_0x530d8a,_0xa7c29[_0xb988('0x70')])[_0xb988('0x2d')](function(_0x13ecd5){_0x5ccd74(_0x13ecd5);})[_0xb988('0x32')](function(_0xfeb5d3){_0x28a86f(_0xfeb5d3);});});}function verifyJwt(_0x437d2a,_0x20f05d,_0x547658){var _0x3df612=BPromise[_0xb988('0x6c')](jwt[_0xb988('0x71')],{'context':jwt});var _0x1efab7=_0x547658||config[_0xb988('0x9')][_0xb988('0x6e')];return new BPromise(function(_0x290407,_0x13b0b5){_0x3df612(_0x437d2a,_0x1efab7,_0x20f05d)['then'](function(_0x1d787c){_0x290407(_0x1d787c);})[_0xb988('0x32')](function(_0x585344){_0x13b0b5(_0x585344);});});}function generateNonce(){return crypto[_0xb988('0x72')](0x10)[_0xb988('0x73')](_0xb988('0x74'));}function generateIssuedAt(){return Math[_0xb988('0x75')](Date[_0xb988('0x76')]()/0x3e8)['toString']();}function createJwt(_0x23264c){var _0x2131a1={'payload':{'iat':_0x23264c[_0xb988('0x59')],'nonce':_0x23264c[_0xb988('0x42')]},'options':{'algorithm':_0xb988('0x77'),'subject':_0x23264c['id']['toString'](),'issuer':hardwareConf[_0xb988('0x3b')](),'audience':hardwareConf[_0xb988('0x3b')]()}};return signJwt(_0x2131a1)[_0xb988('0x2d')](function(_0x853ccd){return{'iat':_0x23264c[_0xb988('0x59')],'nonce':_0x23264c[_0xb988('0x42')],'token':_0x853ccd};});} \ No newline at end of file +var _0x51c4=['authorization','startsWith','User','find','authenticate','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20object\x20not\x20found.','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','encryptString','join','promisify','secret','payload','options','verify','randomBytes','toString','HS512','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','bluebird','moment','secrets','session','role','fullname','email','userpic','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','then','status','disposition','unmanaged','json','Forbidden.','catch','use','headers'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x51c4,0x12a));var _0x451c=function(_0x20d5bc,_0xf207b8){_0x20d5bc=_0x20d5bc-0x0;var _0x1830af=_0x51c4[_0x20d5bc];return _0x1830af;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x451c('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x451c('0x1'));var encryptor=require(_0x451c('0x2'));var _=require(_0x451c('0x3'));var jwt=require(_0x451c('0x4'));var expressJwt=require(_0x451c('0x5'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0x451c('0x6'));var util=require('util');var moment=require(_0x451c('0x7'));var validateJwt=expressJwt({'secret':config[_0x451c('0x8')][_0x451c('0x9')]});var userAttributes=['id',_0x451c('0xa'),_0x451c('0xb'),'name','internal',_0x451c('0xc'),_0x451c('0xd'),_0x451c('0xe'),_0x451c('0xf'),_0x451c('0x10'),'chatPause',_0x451c('0x11'),_0x451c('0x12'),_0x451c('0x13'),_0x451c('0x14'),_0x451c('0x15'),'showWebBar',_0x451c('0x16'),_0x451c('0x17'),_0x451c('0x18'),_0x451c('0x19'),_0x451c('0x1a'),_0x451c('0x1b'),_0x451c('0x1c'),'phoneBarAutoAnswerDelay',_0x451c('0x1d'),_0x451c('0x1e'),_0x451c('0x1f'),_0x451c('0x20'),_0x451c('0x21'),_0x451c('0x22'),_0x451c('0x23'),_0x451c('0x24'),_0x451c('0x25'),'interface',_0x451c('0x26'),_0x451c('0x27')];exports[_0x451c('0x28')]=function(){return this[_0x451c('0x29')](!![])['use'](function(_0x4a16e2,_0x2b1754,_0x58fc1e){if(_0x4a16e2[_0x451c('0x2a')]){_0x58fc1e();}else{return db[_0x451c('0x2b')][_0x451c('0x2c')]({'where':{'id':_0x4a16e2[_0x451c('0x2d')]['id']},'attributes':['id',_0x451c('0x2e'),'disposition'],'raw':!![]})[_0x451c('0x2f')](function(_0xc608eb){if(_0xc608eb&&_0xc608eb[_0x451c('0x2e')]){return _0x2b1754[_0x451c('0x30')](_0xc608eb[_0x451c('0x31')]===_0x451c('0x32')?0x195:0x193)[_0x451c('0x33')]({'message':_0xc608eb[_0x451c('0x31')]==='unmanaged'?'Unmanaged.':_0x451c('0x34')});}else{_0x58fc1e();}})[_0x451c('0x35')](function(_0x41ec56){_0x58fc1e(_0x41ec56);});}});};exports[_0x451c('0x29')]=function isAuthenticated(_0x336683){return compose()[_0x451c('0x36')](function(_0x5e8a84,_0x5eecdc,_0x2061d4){var _0x2d5a43;if(_0x5e8a84[_0x451c('0x37')][_0x451c('0x38')]){if(_[_0x451c('0x39')](_0x5e8a84[_0x451c('0x37')]['authorization'],'Basic')){var _0x5512cc=basicAuth(_0x5e8a84);db[_0x451c('0x3a')][_0x451c('0x3b')]({'where':{'name':_0x5512cc['name']}})['then'](function(_0x1143bb){if(!_0x1143bb||!_0x1143bb[_0x451c('0x3c')](_0x5512cc['pass'])){return _0x5eecdc[_0x451c('0x30')](0x191)['json']({'message':_0x451c('0x3d')});}_0x5e8a84['user']={'id':_0x1143bb['id']};_0x2061d4();})[_0x451c('0x35')](function(_0x25acb2){_0x2061d4(_0x25acb2);});}else if(_[_0x451c('0x39')](_0x5e8a84[_0x451c('0x37')][_0x451c('0x38')],_0x451c('0x3e'))){validateJwt(_0x5e8a84,_0x5eecdc,_0x2061d4);}else{if(_0x336683){_0x2061d4();}else{return _0x5eecdc[_0x451c('0x30')](0x193)[_0x451c('0x33')]({'message':_0x451c('0x3f')});}}}else if(_0x5e8a84['query'][_0x451c('0x40')]){try{var _0x5af174={'audience':hardwareConf[_0x451c('0x41')](),'issuer':hardwareConf[_0x451c('0x41')]()};verifyJwt(_0x5e8a84[_0x451c('0x42')][_0x451c('0x40')],_0x5af174)[_0x451c('0x2f')](function(_0x221237){return db[_0x451c('0x3a')][_0x451c('0x3b')]({'where':{'id':_0x221237['sub']}})[_0x451c('0x2f')](function(_0x3d9667){_0x2d5a43=_0x3d9667;return db[_0x451c('0x43')][_0x451c('0x2c')]({'where':{'id':0x1},'attributes':[_0x451c('0x44'),_0x451c('0x45')],'raw':!![]});})[_0x451c('0x2f')](function(_0x5e4a72){if(!_0x2d5a43||!_['isEqual'](_0x2d5a43[_0x451c('0x46')],_0x221237[_0x451c('0x47')])){return _0x5eecdc[_0x451c('0x30')](0x191)[_0x451c('0x33')]({'message':_0x451c('0x48')});}if(_0x2d5a43[_0x451c('0x49')]){return _0x5eecdc[_0x451c('0x30')](0x191)[_0x451c('0x33')]({'message':_0x451c('0x4a')});}if(_0x2d5a43[_0x451c('0x4b')]){if(_0x5e4a72['blockDuration']>0x0){if(moment(_0x2d5a43[_0x451c('0x4c')])[_0x451c('0x4d')](_0x5e4a72[_0x451c('0x45')],_0x451c('0x4e'))>moment()){return _0x5eecdc[_0x451c('0x30')](0x191)[_0x451c('0x33')]({'message':_0x451c('0x4a')});}}else{return _0x5eecdc['status'](0x191)[_0x451c('0x33')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x5e8a84[_0x451c('0x2a')]={'id':_0x2d5a43['id']};_0x2061d4();});})[_0x451c('0x35')](function(){return _0x5eecdc[_0x451c('0x30')](0x191)[_0x451c('0x33')]({'message':_0x451c('0x4a')});});}catch(_0x56d6e5){_0x2061d4(_0x56d6e5);}}else if(_0x336683){_0x2061d4();}else{return _0x5eecdc[_0x451c('0x30')](0x193)[_0x451c('0x33')]({'message':_0x451c('0x3f')});}})[_0x451c('0x36')](function(_0xe97a92,_0xb0b9f8,_0x44ba3a){if(_0xe97a92[_0x451c('0x2a')]){db[_0x451c('0x3a')][_0x451c('0x3b')]({'where':{'id':_0xe97a92['user']['id']},'attributes':userAttributes})['then'](function(_0x3d0733){if(!_0x3d0733){return _0xb0b9f8['status'](0x194)[_0x451c('0x33')]({'message':'User\x20not\x20found.'});}_0xe97a92[_0x451c('0x2a')]=_0x3d0733;_0x44ba3a();})[_0x451c('0x35')](function(_0x267ce3){_0x44ba3a(_0x267ce3);});}else if(_0x336683){_0x44ba3a();}else{return _0xb0b9f8['status'](0x194)['json']({'message':_0x451c('0x4f')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x460ea9,_0x40c21e,_0x1a85d4){return licenseUtil['getLicense']()[_0x451c('0x2f')](function(_0x4de127){if(_0x4de127[_0x451c('0x50')]){_0x1a85d4();}else{return _0x40c21e[_0x451c('0x30')](0x193)[_0x451c('0x33')]({'message':_0x451c('0x51')});}})['catch'](function(_0xcede99){_0x1a85d4(_0xcede99);});});};exports[_0x451c('0x52')]=function(_0x1bac65,_0x3b9184,_0x3cda61){_0x1bac65['isMiddleware']=!![];return _0x3cda61();};exports[_0x451c('0x53')]=function signToken(_0x19fdf1){return signJwt(_0x19fdf1);};exports['setTokenCookie']=function(_0x1318d6,_0x4aa2b9){if(!_0x1318d6[_0x451c('0x2a')]){return _0x4aa2b9[_0x451c('0x30')](0x194)[_0x451c('0x33')]({'message':_0x451c('0x54')});}var _0x5a47bf={'payload':{'id':_0x1318d6['user']['id'],'role':_0x1318d6['user'][_0x451c('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5a47bf)[_0x451c('0x2f')](function(_0x2806f4){_0x4aa2b9[_0x451c('0x55')](_0x451c('0x56'),_0x2806f4);_0x4aa2b9[_0x451c('0x57')](_0x451c('0x58'));})['catch'](function(_0x572c70){return _0x4aa2b9[_0x451c('0x30')](0x1f4)[_0x451c('0x59')](_0x572c70);});};exports['retrieveApiKey']=function(_0x3c6179){if(_['isNil'](_0x3c6179[_0x451c('0x46')])||_[_0x451c('0x5a')](_0x3c6179['apiKeyIat'])){return null;}else{return createJwt(_0x3c6179);}};exports[_0x451c('0x5b')]=function(_0x395a18){_0x395a18[_0x451c('0x46')]=generateNonce();_0x395a18[_0x451c('0x5c')]=generateIssuedAt();return createJwt(_0x395a18);};exports[_0x451c('0x5d')]=function(_0x4bc771,_0x3a4449){var _0xf9965b=_0x4bc771['query'][_0x451c('0x40')];if(_0xf9965b){var _0x2e25c7={'nonce':_0x3a4449[_0x451c('0x46')],'iat':_0x3a4449[_0x451c('0x5c')],'audience':hardwareConf[_0x451c('0x41')](),'issuer':hardwareConf[_0x451c('0x41')]()};return verifyJwt(_0xf9965b,_0x2e25c7)[_0x451c('0x2f')](function(){return generateApiKey(_0x3a4449);});}else{throw{'message':_0x451c('0x5e')};}};exports[_0x451c('0x5f')]=function(_0x4dbb74){var _0x3d60a9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3d60a9['test'](_0x4dbb74))throw new db[(_0x451c('0x60'))][(_0x451c('0x61'))](_0x451c('0x62'));return;};exports['validatePasswordHistory']=function(_0x279004,_0x32ac13,_0x13ef52){var _0x515c13=encryptor[_0x451c('0x63')](_0x32ac13)[_0x451c('0x64')](',');for(var _0x56b3ba=0x0;_0x56b3ba<_0x13ef52;_0x56b3ba++){if(!_0x515c13[_0x56b3ba])break;if(_0x279004[_0x451c('0x65')]()===_0x515c13[_0x56b3ba][_0x451c('0x65')]()){var _0xeb52d6=util[_0x451c('0x66')](_0x451c('0x67'),_0x13ef52);if(_0x13ef52===0x1){_0xeb52d6=_0x451c('0x68');}throw new db['Sequelize'][(_0x451c('0x61'))](_0xeb52d6);}}return;};exports[_0x451c('0x69')]=function(_0xdcb56c,_0x2e8244){var _0x164d6e=_0x2e8244?encryptor['decryptString'](_0x2e8244)['split'](','):[];if(_0x164d6e[_0x451c('0x6a')]===0x5){_0x164d6e[_0x451c('0x6b')](-0x1,0x1);}_0x164d6e['unshift'](_0xdcb56c);return encryptor[_0x451c('0x6c')](_0x164d6e[_0x451c('0x6d')](','));};function signJwt(_0x10ba31){var _0x4d6d26=BPromise[_0x451c('0x6e')](jwt['sign'],{'context':jwt});var _0xe5e4=_0x10ba31[_0x451c('0x6f')]||config[_0x451c('0x8')][_0x451c('0x9')];return new BPromise(function(_0x9d3f8d,_0x28a6bf){_0x4d6d26(_0x10ba31[_0x451c('0x70')],_0xe5e4,_0x10ba31[_0x451c('0x71')])[_0x451c('0x2f')](function(_0x5b5a1b){_0x9d3f8d(_0x5b5a1b);})[_0x451c('0x35')](function(_0x545405){_0x28a6bf(_0x545405);});});}function verifyJwt(_0x12693c,_0x9dec0e,_0x2efac8){var _0x2dd01e=BPromise[_0x451c('0x6e')](jwt[_0x451c('0x72')],{'context':jwt});var _0x377244=_0x2efac8||config['secrets'][_0x451c('0x9')];return new BPromise(function(_0x5583aa,_0x7e45d3){_0x2dd01e(_0x12693c,_0x377244,_0x9dec0e)['then'](function(_0x17ff8e){_0x5583aa(_0x17ff8e);})[_0x451c('0x35')](function(_0x8c743e){_0x7e45d3(_0x8c743e);});});}function generateNonce(){return crypto[_0x451c('0x73')](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x451c('0x74')]();}function createJwt(_0x173c4c){var _0x19ef16={'payload':{'iat':_0x173c4c[_0x451c('0x5c')],'nonce':_0x173c4c[_0x451c('0x46')]},'options':{'algorithm':_0x451c('0x75'),'subject':_0x173c4c['id'][_0x451c('0x74')](),'issuer':hardwareConf[_0x451c('0x41')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x19ef16)[_0x451c('0x2f')](function(_0x1ecb23){return{'iat':_0x173c4c[_0x451c('0x5c')],'nonce':_0x173c4c['apiKeyNonce'],'token':_0x1ecb23};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 7b7ac46..7f27c71 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 _0x5334=['write','end','createWriteStream','createDecipher','final','close','unlink','secret','update','utf8','base64','decryptString','crypto','bluebird','../../config/environment','secrets','session','aes192','encryptFile','createReadStream','createCipher','algorithm','data','binary'];(function(_0x4b9a8d,_0x12b15b){var _0x19c1d1=function(_0x218fde){while(--_0x218fde){_0x4b9a8d['push'](_0x4b9a8d['shift']());}};_0x19c1d1(++_0x12b15b);}(_0x5334,0x84));var _0x4533=function(_0x2b5b07,_0x2f7762){_0x2b5b07=_0x2b5b07-0x0;var _0x46f2ec=_0x5334[_0x2b5b07];return _0x46f2ec;};'use strict';var crypto=require(_0x4533('0x0'));var fs=require('fs');var BPromise=require(_0x4533('0x1'));var config=require(_0x4533('0x2'));const stringOptions={'secret':config[_0x4533('0x3')][_0x4533('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x4533('0x5')};function combineOptions(_0x5176b5){var _0x42184d={};for(var _0x11ce61 in fileOptions){if(fileOptions['hasOwnProperty'](_0x11ce61)){_0x42184d[_0x11ce61]=fileOptions[_0x11ce61];}}if(_0x5176b5){for(var _0x4a576a in _0x5176b5){if(_0x5176b5['hasOwnProperty'](_0x4a576a)){_0x42184d[_0x4a576a]=_0x5176b5[_0x4a576a];}}}return _0x42184d;}exports[_0x4533('0x6')]=function(_0x4dea06,_0x4d89e7,_0x487906,_0x3fbdc3){return new BPromise(function(_0x42f94b,_0x300877){_0x3fbdc3=combineOptions(_0x3fbdc3);var _0x2489b6=new Buffer(_0x487906);var _0x31018b=fs[_0x4533('0x7')](_0x4dea06);var _0xd417=fs['createWriteStream'](_0x4d89e7);var _0x5533=crypto[_0x4533('0x8')](_0x3fbdc3[_0x4533('0x9')],_0x2489b6);_0x31018b['on'](_0x4533('0xa'),function(_0x5465bf){var _0x7b2420=new Buffer(_0x5533['update'](_0x5465bf),_0x4533('0xb'));_0xd417[_0x4533('0xc')](_0x7b2420);});_0x31018b['on'](_0x4533('0xd'),function(){try{var _0x19b74e=new Buffer(_0x5533['final'](_0x4533('0xb')),_0x4533('0xb'));_0xd417[_0x4533('0xc')](_0x19b74e);_0xd417[_0x4533('0xd')]();_0xd417['on']('close',function(){return _0x42f94b(_0x4d89e7);});}catch(_0xe47213){fs['unlink'](_0x4d89e7);return _0x300877(_0xe47213);}});});};exports['decryptFile']=function(_0x466545,_0x34dea9,_0x5da8b8,_0x30c68c){return new BPromise(function(_0x1e6a1a,_0x2a9877){_0x30c68c=combineOptions(_0x30c68c);var _0x551b0d=new Buffer(_0x5da8b8);var _0x3ed873=fs['createReadStream'](_0x466545);var _0x3ddb36=fs[_0x4533('0xe')](_0x34dea9);var _0x56ab4f=crypto[_0x4533('0xf')](_0x30c68c['algorithm'],_0x551b0d);_0x3ed873['on']('data',function(_0x1c5cdd){var _0x9740a6=new Buffer(_0x56ab4f['update'](_0x1c5cdd),'binary');_0x3ddb36[_0x4533('0xc')](_0x9740a6);});_0x3ed873['on'](_0x4533('0xd'),function(){try{var _0x3467ba=new Buffer(_0x56ab4f[_0x4533('0x10')](_0x4533('0xb')),_0x4533('0xb'));_0x3ddb36[_0x4533('0xc')](_0x3467ba);_0x3ddb36['end']();_0x3ddb36['on'](_0x4533('0x11'),function(){return _0x1e6a1a(_0x34dea9);});}catch(_0xd55c04){fs[_0x4533('0x12')](_0x34dea9);return _0x2a9877(_0xd55c04);}});});};exports['encryptString']=function(_0x513011,_0x138fd9,_0x11e93a){var _0x4c640c=_0x11e93a||stringOptions['algorithm'];var _0x307bdd=_0x138fd9||stringOptions[_0x4533('0x13')];var _0xfd9409=crypto['createCipher'](_0x4c640c,_0x307bdd);var _0x44786f=_0xfd9409[_0x4533('0x14')](_0x513011,_0x4533('0x15'),_0x4533('0x16'));_0x44786f+=_0xfd9409[_0x4533('0x10')](_0x4533('0x16'));return _0x44786f;};exports[_0x4533('0x17')]=function(_0x27b653,_0x45ad98,_0x5f16bb){var _0x5c1e24=_0x5f16bb||stringOptions[_0x4533('0x9')];var _0x5aaf2d=_0x45ad98||stringOptions[_0x4533('0x13')];var _0x4e2b80=crypto[_0x4533('0xf')](_0x5c1e24,_0x5aaf2d);var _0x42ba2d=_0x4e2b80[_0x4533('0x14')](_0x27b653,_0x4533('0x16'),_0x4533('0x15'));_0x42ba2d+=_0x4e2b80[_0x4533('0x10')](_0x4533('0x15'));return _0x42ba2d;}; \ No newline at end of file +var _0x4975=['final','close','unlink','update','encryptString','secret','utf8','base64','decryptString','crypto','../../config/environment','secrets','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end'];(function(_0x555ebb,_0x4b1b68){var _0x3c0a4a=function(_0x312e2f){while(--_0x312e2f){_0x555ebb['push'](_0x555ebb['shift']());}};_0x3c0a4a(++_0x4b1b68);}(_0x4975,0x86));var _0x5497=function(_0x3e8a4b,_0x31bd4c){_0x3e8a4b=_0x3e8a4b-0x0;var _0x4849d7=_0x4975[_0x3e8a4b];return _0x4849d7;};'use strict';var crypto=require(_0x5497('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require(_0x5497('0x1'));const stringOptions={'secret':config[_0x5497('0x2')][_0x5497('0x3')],'algorithm':_0x5497('0x4')};const fileOptions={'algorithm':_0x5497('0x5')};function combineOptions(_0x235986){var _0x14cecb={};for(var _0xeb31af in fileOptions){if(fileOptions[_0x5497('0x6')](_0xeb31af)){_0x14cecb[_0xeb31af]=fileOptions[_0xeb31af];}}if(_0x235986){for(var _0x5d5272 in _0x235986){if(_0x235986['hasOwnProperty'](_0x5d5272)){_0x14cecb[_0x5d5272]=_0x235986[_0x5d5272];}}}return _0x14cecb;}exports[_0x5497('0x7')]=function(_0x4f563d,_0x1d0019,_0x674a2a,_0x368e8b){return new BPromise(function(_0x57f930,_0x42af11){_0x368e8b=combineOptions(_0x368e8b);var _0x49d94b=new Buffer(_0x674a2a);var _0x1f63d8=fs[_0x5497('0x8')](_0x4f563d);var _0x2ec5a4=fs[_0x5497('0x9')](_0x1d0019);var _0x131627=crypto[_0x5497('0xa')](_0x368e8b[_0x5497('0xb')],_0x49d94b);_0x1f63d8['on'](_0x5497('0xc'),function(_0x50d716){var _0x5874ef=new Buffer(_0x131627['update'](_0x50d716),_0x5497('0xd'));_0x2ec5a4[_0x5497('0xe')](_0x5874ef);});_0x1f63d8['on'](_0x5497('0xf'),function(){try{var _0x984990=new Buffer(_0x131627[_0x5497('0x10')](_0x5497('0xd')),_0x5497('0xd'));_0x2ec5a4[_0x5497('0xe')](_0x984990);_0x2ec5a4[_0x5497('0xf')]();_0x2ec5a4['on'](_0x5497('0x11'),function(){return _0x57f930(_0x1d0019);});}catch(_0x55f590){fs[_0x5497('0x12')](_0x1d0019);return _0x42af11(_0x55f590);}});});};exports['decryptFile']=function(_0x4237a9,_0x2bfd8a,_0x19e5f3,_0x3ce50b){return new BPromise(function(_0x37c18e,_0x4073e6){_0x3ce50b=combineOptions(_0x3ce50b);var _0x2f2997=new Buffer(_0x19e5f3);var _0x575f6b=fs['createReadStream'](_0x4237a9);var _0x3f4d20=fs[_0x5497('0x9')](_0x2bfd8a);var _0x3a47fd=crypto['createDecipher'](_0x3ce50b[_0x5497('0xb')],_0x2f2997);_0x575f6b['on'](_0x5497('0xc'),function(_0x18e8a8){var _0x43da2c=new Buffer(_0x3a47fd[_0x5497('0x13')](_0x18e8a8),_0x5497('0xd'));_0x3f4d20[_0x5497('0xe')](_0x43da2c);});_0x575f6b['on'](_0x5497('0xf'),function(){try{var _0x2e3960=new Buffer(_0x3a47fd[_0x5497('0x10')](_0x5497('0xd')),'binary');_0x3f4d20[_0x5497('0xe')](_0x2e3960);_0x3f4d20['end']();_0x3f4d20['on'](_0x5497('0x11'),function(){return _0x37c18e(_0x2bfd8a);});}catch(_0xd0868d){fs[_0x5497('0x12')](_0x2bfd8a);return _0x4073e6(_0xd0868d);}});});};exports[_0x5497('0x14')]=function(_0x35ecd9,_0x3b2fbc,_0x5018fa){var _0x54043a=_0x5018fa||stringOptions[_0x5497('0xb')];var _0x34b97f=_0x3b2fbc||stringOptions[_0x5497('0x15')];var _0x281155=crypto['createCipher'](_0x54043a,_0x34b97f);var _0x13b7a4=_0x281155['update'](_0x35ecd9,_0x5497('0x16'),_0x5497('0x17'));_0x13b7a4+=_0x281155[_0x5497('0x10')](_0x5497('0x17'));return _0x13b7a4;};exports[_0x5497('0x18')]=function(_0x31cd01,_0x48b835,_0x4af5f4){var _0x5406e2=_0x4af5f4||stringOptions['algorithm'];var _0x498f15=_0x48b835||stringOptions[_0x5497('0x15')];var _0x48d146=crypto['createDecipher'](_0x5406e2,_0x498f15);var _0xc3465=_0x48d146[_0x5497('0x13')](_0x31cd01,_0x5497('0x17'),'utf8');_0xc3465+=_0x48d146['final']('utf8');return _0xc3465;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 6758eb1..c857e1d 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 _0x5636=['mkdirSync','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','num','%s\x20limit\x20%d\x20OFFSET\x20%d','push','.csv','join'];(function(_0x2478df,_0x4f96ed){var _0x396975=function(_0x1497bb){while(--_0x1497bb){_0x2478df['push'](_0x2478df['shift']());}};_0x396975(++_0x4f96ed);}(_0x5636,0x102));var _0x6563=function(_0x2e3919,_0x2f9b84){_0x2e3919=_0x2e3919-0x0;var _0x43c861=_0x5636[_0x2e3919];return _0x43c861;};'use strict';var util=require(_0x6563('0x0'));var path=require(_0x6563('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x6563('0x2'));var rimraf=require(_0x6563('0x3'));var db=require(_0x6563('0x4'))['db'];var dbH=require('../../mysqldb')[_0x6563('0x5')];var logger=require(_0x6563('0x6'))(_0x6563('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x6563('0x8')][0x2]);var QUERY=process[_0x6563('0x8')][0x3];var PATH=process[_0x6563('0x8')][0x4];function analyticExtractedReport(_0x9884a9,_0x2d57d5){var _0x2d0d5b={'status':_0x9884a9};var _0x98fcd4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d57d5){_0x2d0d5b[_0x6563('0x9')]=_0x2d57d5;}return db[_0x6563('0xa')][_0x6563('0xb')](_0x2d0d5b,_0x98fcd4);}function main(){var _0x516d1a=0x1388;var _0x51fdc2;logger[_0x6563('0xc')](util[_0x6563('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x6563('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6563('0xf'),_0x6563('0x10')]})[_0x6563('0x11')](function(_0x33816e){if(_0x33816e){_0x51fdc2=_0x33816e;_0x516d1a=_0x51fdc2[_0x6563('0x10')]||0x1388;}})[_0x6563('0x11')](function(){return dbH[_0x6563('0x12')][_0x6563('0x13')](util['format'](_0x6563('0x14'),QUERY),{'type':dbH['sequelize'][_0x6563('0x15')][_0x6563('0x16')]});})[_0x6563('0x11')](function(_0x10d08c){if(!_0x10d08c[0x0]['num']){return analyticExtractedReport(_0x6563('0x17'));}var _0x11baa2=[];var _0x477d9b=0x0;var _0xd398ce=!![];if(_0x10d08c&&_0x10d08c['length']){var _0x3563fd=_0x10d08c[0x0]['num']%(_0x477d9b+_0x516d1a);if(_0x51fdc2['split']){for(;_0xd398ce;_0x477d9b+=_0x516d1a,_0x3563fd=_0x10d08c[0x0]['num']%(_0x477d9b+_0x516d1a)){if(_0x3563fd==0x0||_0x3563fd==_0x10d08c[0x0][_0x6563('0x18')]){_0xd398ce=![];}_0x11baa2['push'](dbH['sequelize'][_0x6563('0x13')](util[_0x6563('0xd')](_0x6563('0x19'),QUERY,_0x516d1a,_0x477d9b),{'type':dbH[_0x6563('0x12')][_0x6563('0x15')][_0x6563('0x16')]}));}}else{_0x11baa2[_0x6563('0x1a')](dbH[_0x6563('0x12')][_0x6563('0x13')](QUERY,{'type':dbH['sequelize'][_0x6563('0x15')][_0x6563('0x16')]}));}}var _0x20b478=path['dirname'](PATH);var _0x293db2=path['basename'](PATH,_0x6563('0x1b'));var _0x105379=_0x51fdc2['split']&&_0x11baa2['length']>0x1;var _0x3ab7f6=[];if(!fs['existsSync'](path[_0x6563('0x1c')](_0x20b478,_0x293db2))&&_0x105379){fs[_0x6563('0x1d')](path[_0x6563('0x1c')](_0x20b478,_0x293db2));}return BPromise['each'](_0x11baa2,function(_0xd860d5){_0x3ab7f6['push'](_0xd860d5);})[_0x6563('0x11')](function(){for(var _0x1590e6=0x0;_0x1590e6<_0x3ab7f6['length'];_0x1590e6+=0x1){var _0x365b16;var _0x28252d=_0x3ab7f6[_0x1590e6];if(_0x105379){_0x365b16=path['join'](_0x20b478,_0x293db2,util[_0x6563('0xd')]('%s%d.%s',_0x293db2,_0x1590e6,_0x6563('0x1e')));}else{_0x365b16=path['join'](_0x20b478,util['format'](_0x6563('0x1f'),_0x293db2,_0x6563('0x1e')));}fs[_0x6563('0x20')](_0x365b16,csv(_0x28252d));}})[_0x6563('0x11')](function(){if(_0x105379){zipdir(path[_0x6563('0x1c')](_0x20b478,_0x293db2),{'saveTo':path['join'](_0x20b478,util[_0x6563('0xd')]('%s.%s',_0x293db2,'zip'))},function(_0x3582c9,_0x35af37){});rimraf(path[_0x6563('0x1c')](_0x20b478,_0x293db2),function(){});}})[_0x6563('0x11')](function(){logger[_0x6563('0xc')](util[_0x6563('0xd')](_0x6563('0x21'),EXTRACTED_REPORT_ID,_0x6563('0x22')));return analyticExtractedReport(_0x6563('0x23'),_0x105379?util[_0x6563('0xd')]('%s.%s',_0x293db2,_0x105379?_0x6563('0x24'):_0x6563('0x1e')):null);});})[_0x6563('0x25')](function(_0x1558fb){logger[_0x6563('0xc')](util[_0x6563('0xd')](_0x6563('0x26'),EXTRACTED_REPORT_ID,'CSV'),util[_0x6563('0x27')](_0x1558fb,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6563('0x28'));});}main(); \ No newline at end of file +var _0x6c76=['argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','analytics'];(function(_0xbebce0,_0x3bb745){var _0x3ac9b6=function(_0x355518){while(--_0x355518){_0xbebce0['push'](_0xbebce0['shift']());}};_0x3ac9b6(++_0x3bb745);}(_0x6c76,0x184));var _0x66c7=function(_0xf0e3ad,_0x269d0f){_0xf0e3ad=_0xf0e3ad-0x0;var _0x59805e=_0x6c76[_0xf0e3ad];return _0x59805e;};'use strict';var util=require(_0x66c7('0x0'));var path=require(_0x66c7('0x1'));var _=require(_0x66c7('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x66c7('0x3'));var zipdir=require(_0x66c7('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x66c7('0x5'))[_0x66c7('0x6')];var logger=require('../../config/logger')(_0x66c7('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x66c7('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x66c7('0x8')][0x4];function analyticExtractedReport(_0x4dffcd,_0x4fa6ce){var _0x208d06={'status':_0x4dffcd};var _0x2b0065={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4fa6ce){_0x208d06[_0x66c7('0x9')]=_0x4fa6ce;}return db['AnalyticExtractedReport'][_0x66c7('0xa')](_0x208d06,_0x2b0065);}function main(){var _0xbc35d9=0x1388;var _0xf44e2;logger[_0x66c7('0xb')](util['format'](_0x66c7('0xc'),EXTRACTED_REPORT_ID,_0x66c7('0xd')));return db[_0x66c7('0xe')][_0x66c7('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x66c7('0x10'),_0x66c7('0x11')]})[_0x66c7('0x12')](function(_0x5176a3){if(_0x5176a3){_0xf44e2=_0x5176a3;_0xbc35d9=_0xf44e2[_0x66c7('0x11')]||0x1388;}})[_0x66c7('0x12')](function(){return dbH[_0x66c7('0x13')][_0x66c7('0x14')](util[_0x66c7('0x15')](_0x66c7('0x16'),QUERY),{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')][_0x66c7('0x18')]});})['then'](function(_0x110f6d){if(!_0x110f6d[0x0]['num']){return analyticExtractedReport(_0x66c7('0x19'));}var _0x39f951=[];var _0x3c81c0=0x0;var _0x42e930=!![];if(_0x110f6d&&_0x110f6d[_0x66c7('0x1a')]){var _0x4e229a=_0x110f6d[0x0]['num']%(_0x3c81c0+_0xbc35d9);if(_0xf44e2['split']){for(;_0x42e930;_0x3c81c0+=_0xbc35d9,_0x4e229a=_0x110f6d[0x0]['num']%(_0x3c81c0+_0xbc35d9)){if(_0x4e229a==0x0||_0x4e229a==_0x110f6d[0x0][_0x66c7('0x1b')]){_0x42e930=![];}_0x39f951[_0x66c7('0x1c')](dbH['sequelize']['query'](util[_0x66c7('0x15')](_0x66c7('0x1d'),QUERY,_0xbc35d9,_0x3c81c0),{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')]['SELECT']}));}}else{_0x39f951['push'](dbH[_0x66c7('0x13')][_0x66c7('0x14')](QUERY,{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')][_0x66c7('0x18')]}));}}var _0x75f118=path['dirname'](PATH);var _0x4ddbd2=path[_0x66c7('0x1e')](PATH,'.csv');var _0x7462f1=_0xf44e2[_0x66c7('0x10')]&&_0x39f951[_0x66c7('0x1a')]>0x1;var _0x1fc9d3=[];if(!fs['existsSync'](path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2))&&_0x7462f1){fs[_0x66c7('0x20')](path['join'](_0x75f118,_0x4ddbd2));}return BPromise[_0x66c7('0x21')](_0x39f951,function(_0x11a6b9){_0x1fc9d3[_0x66c7('0x1c')](_0x11a6b9);})[_0x66c7('0x12')](function(){for(var _0x2af0a3=0x0;_0x2af0a3<_0x1fc9d3['length'];_0x2af0a3+=0x1){var _0x5bc4e6;var _0x4e514a=_0x1fc9d3[_0x2af0a3];if(_0x7462f1){_0x5bc4e6=path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2,util[_0x66c7('0x15')]('%s%d.%s',_0x4ddbd2,_0x2af0a3,_0x66c7('0x22')));}else{_0x5bc4e6=path[_0x66c7('0x1f')](_0x75f118,util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x66c7('0x22')));}fs[_0x66c7('0x24')](_0x5bc4e6,csv(_0x4e514a));}})['then'](function(){if(_0x7462f1){zipdir(path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2),{'saveTo':path[_0x66c7('0x1f')](_0x75f118,util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x66c7('0x25')))},function(_0x592f0e,_0x263b48){});rimraf(path['join'](_0x75f118,_0x4ddbd2),function(){});}})[_0x66c7('0x12')](function(){logger['info'](util[_0x66c7('0x15')](_0x66c7('0x26'),EXTRACTED_REPORT_ID,_0x66c7('0xd')));return analyticExtractedReport(_0x66c7('0x27'),_0x7462f1?util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x7462f1?'zip':'csv'):null);});})[_0x66c7('0x28')](function(_0x12e7c6){logger[_0x66c7('0xb')](util[_0x66c7('0x15')](_0x66c7('0x29'),EXTRACTED_REPORT_ID,_0x66c7('0xd')),util[_0x66c7('0x2a')](_0x12e7c6,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x66c7('0x2b'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index fe4c044..a85ccc8 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 _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x19e923,_0x2c63e1){var _0x3e9a29=function(_0x46f59a){while(--_0x46f59a){_0x19e923['push'](_0x19e923['shift']());}};_0x3e9a29(++_0x2c63e1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +var _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','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','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x9d7ad4,_0x5e82f0){var _0x5d53db=function(_0x278e52){while(--_0x278e52){_0x9d7ad4['push'](_0x9d7ad4['shift']());}};_0x5d53db(++_0x5e82f0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4eeb05,_0xd22898){_0x4eeb05=_0x4eeb05-0x0;var _0x313626=_0x5f2f[_0x4eeb05];return _0x313626;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 61af2c3..3bed28c 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 _0x1261=['%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','inspect','Failed','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','split','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.xlsx','length','mkdirSync','join','each','xlsx','writeFileSync'];(function(_0xeb3a70,_0x37fdd7){var _0x1e34db=function(_0x2b269a){while(--_0x2b269a){_0xeb3a70['push'](_0xeb3a70['shift']());}};_0x1e34db(++_0x37fdd7);}(_0x1261,0x144));var _0x1126=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0x1261[_0xd67723];return _0x53b62b;};'use strict';var util=require('util');var path=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));var fs=require('fs');var json2xls=require(_0x1126('0x2'));var BPromise=require(_0x1126('0x3'));var zipdir=require(_0x1126('0x4'));var rimraf=require(_0x1126('0x5'));var db=require(_0x1126('0x6'))['db'];var dbH=require(_0x1126('0x6'))[_0x1126('0x7')];var logger=require(_0x1126('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x1126('0x9')][0x3];var PATH=process[_0x1126('0x9')][0x4];function analyticExtractedReport(_0x4f239c,_0x17e5f0){var _0x28772d={'status':_0x4f239c};var _0x245be9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x17e5f0){_0x28772d[_0x1126('0xa')]=_0x17e5f0;}return db[_0x1126('0xb')]['update'](_0x28772d,_0x245be9);}function main(){var _0x3f09ac=0x1388;var _0x18dbe6;logger[_0x1126('0xc')](util['format'](_0x1126('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0x1126('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1126('0xf')]})[_0x1126('0x10')](function(_0xd26a32){if(_0xd26a32){_0x18dbe6=_0xd26a32;_0x3f09ac=_0x18dbe6[_0x1126('0xf')]||0x1388;}})[_0x1126('0x10')](function(){return dbH[_0x1126('0x11')][_0x1126('0x12')](util[_0x1126('0x13')](_0x1126('0x14'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x1126('0x15')]});})[_0x1126('0x10')](function(_0x279455){if(!_0x279455[0x0]['num']){return analyticExtractedReport(_0x1126('0x16'));}var _0x4794a7=[];var _0x35fe9f=0x0;var _0x42f379=!![];if(_0x18dbe6[_0x1126('0x17')]){if(_0x279455&&_0x279455['length']){var _0x245cd7=_0x279455[0x0][_0x1126('0x18')]%(_0x35fe9f+_0x3f09ac);for(;_0x42f379;_0x35fe9f+=_0x3f09ac,_0x245cd7=_0x279455[0x0]['num']%(_0x35fe9f+_0x3f09ac)){if(_0x245cd7==0x0||_0x245cd7==_0x279455[0x0]['num']){_0x42f379=![];}_0x4794a7[_0x1126('0x19')](dbH[_0x1126('0x11')]['query'](util['format'](_0x1126('0x1a'),QUERY,_0x3f09ac,_0x35fe9f),{'type':dbH['sequelize'][_0x1126('0x1b')][_0x1126('0x15')]}));}}}else{_0x4794a7[_0x1126('0x19')](dbH['sequelize'][_0x1126('0x12')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x1126('0x15')]}));}var _0x3a9bed=path[_0x1126('0x1c')](PATH);var _0x36d254=path['basename'](PATH,_0x1126('0x1d'));var _0x477e6a=_0x18dbe6['split']&&_0x4794a7[_0x1126('0x1e')]>0x1;var _0x59cd8e=[];if(!fs['existsSync'](path['join'](_0x3a9bed,_0x36d254))&&_0x477e6a){fs[_0x1126('0x1f')](path[_0x1126('0x20')](_0x3a9bed,_0x36d254));}return BPromise[_0x1126('0x21')](_0x4794a7,function(_0x34bcf1){_0x59cd8e[_0x1126('0x19')](_0x34bcf1);})[_0x1126('0x10')](function(){for(var _0xea0971=0x0;_0xea0971<_0x59cd8e[_0x1126('0x1e')];_0xea0971+=0x1){var _0x589725;var _0x35eec3=_0x59cd8e[_0xea0971];if(_0x477e6a){_0x589725=path[_0x1126('0x20')](_0x3a9bed,_0x36d254,util[_0x1126('0x13')]('%s%d.%s',_0x36d254,_0xea0971,'xlsx'));}else{_0x589725=path[_0x1126('0x20')](_0x3a9bed,util[_0x1126('0x13')]('%s.%s',_0x36d254,_0x1126('0x22')));}fs[_0x1126('0x23')](_0x589725,json2xls(_0x35eec3),'binary');}})[_0x1126('0x10')](function(){if(_0x477e6a){zipdir(path['join'](_0x3a9bed,_0x36d254),{'saveTo':path[_0x1126('0x20')](_0x3a9bed,util['format'](_0x1126('0x24'),_0x36d254,'zip'))},function(_0x378f4d,_0x5f2611){});rimraf(path['join'](_0x3a9bed,_0x36d254),function(){});}})['then'](function(){logger[_0x1126('0xc')](util[_0x1126('0x13')](_0x1126('0x25'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x1126('0x26'),_0x477e6a?util[_0x1126('0x13')]('%s.%s',_0x36d254,_0x477e6a?_0x1126('0x27'):_0x1126('0x22')):null);});})[_0x1126('0x28')](function(_0x29fbfa){logger['info'](util['format'](_0x1126('0x29'),EXTRACTED_REPORT_ID,_0x1126('0x2a')),util[_0x1126('0x2b')](_0x29fbfa,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x1126('0x2c'));});}main(); \ No newline at end of file +var _0x92f8=['join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','catch','inspect','Failed','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Setting','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','basename','.xlsx','split'];(function(_0x165959,_0x385c20){var _0x211175=function(_0x2c650f){while(--_0x2c650f){_0x165959['push'](_0x165959['shift']());}};_0x211175(++_0x385c20);}(_0x92f8,0xe4));var _0x892f=function(_0x74064f,_0x18646a){_0x74064f=_0x74064f-0x0;var _0x2f2e70=_0x92f8[_0x74064f];return _0x2f2e70;};'use strict';var util=require('util');var path=require(_0x892f('0x0'));var _=require(_0x892f('0x1'));var fs=require('fs');var json2xls=require(_0x892f('0x2'));var BPromise=require(_0x892f('0x3'));var zipdir=require(_0x892f('0x4'));var rimraf=require(_0x892f('0x5'));var db=require(_0x892f('0x6'))['db'];var dbH=require(_0x892f('0x6'))['dbH'];var logger=require(_0x892f('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x892f('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x892f('0x8')][0x4];function analyticExtractedReport(_0x435a5d,_0x272012){var _0x106a60={'status':_0x435a5d};var _0x20d704={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x272012){_0x106a60[_0x892f('0x9')]=_0x272012;}return db[_0x892f('0xa')][_0x892f('0xb')](_0x106a60,_0x20d704);}function main(){var _0x2448de=0x1388;var _0x516ba1;logger[_0x892f('0xc')](util[_0x892f('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x892f('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x892f('0xf')]})[_0x892f('0x10')](function(_0x5158e3){if(_0x5158e3){_0x516ba1=_0x5158e3;_0x2448de=_0x516ba1[_0x892f('0xf')]||0x1388;}})[_0x892f('0x10')](function(){return dbH['sequelize'][_0x892f('0x11')](util[_0x892f('0xd')](_0x892f('0x12'),QUERY),{'type':dbH[_0x892f('0x13')][_0x892f('0x14')]['SELECT']});})[_0x892f('0x10')](function(_0x20a3db){if(!_0x20a3db[0x0][_0x892f('0x15')]){return analyticExtractedReport(_0x892f('0x16'));}var _0x5397cd=[];var _0x47def2=0x0;var _0x381dba=!![];if(_0x516ba1['split']){if(_0x20a3db&&_0x20a3db[_0x892f('0x17')]){var _0x358a10=_0x20a3db[0x0][_0x892f('0x15')]%(_0x47def2+_0x2448de);for(;_0x381dba;_0x47def2+=_0x2448de,_0x358a10=_0x20a3db[0x0][_0x892f('0x15')]%(_0x47def2+_0x2448de)){if(_0x358a10==0x0||_0x358a10==_0x20a3db[0x0][_0x892f('0x15')]){_0x381dba=![];}_0x5397cd['push'](dbH[_0x892f('0x13')]['query'](util[_0x892f('0xd')](_0x892f('0x18'),QUERY,_0x2448de,_0x47def2),{'type':dbH[_0x892f('0x13')][_0x892f('0x14')][_0x892f('0x19')]}));}}}else{_0x5397cd[_0x892f('0x1a')](dbH[_0x892f('0x13')][_0x892f('0x11')](QUERY,{'type':dbH[_0x892f('0x13')][_0x892f('0x14')][_0x892f('0x19')]}));}var _0x5dd636=path['dirname'](PATH);var _0x4856af=path[_0x892f('0x1b')](PATH,_0x892f('0x1c'));var _0x37da1d=_0x516ba1[_0x892f('0x1d')]&&_0x5397cd[_0x892f('0x17')]>0x1;var _0x314cfd=[];if(!fs['existsSync'](path['join'](_0x5dd636,_0x4856af))&&_0x37da1d){fs['mkdirSync'](path[_0x892f('0x1e')](_0x5dd636,_0x4856af));}return BPromise[_0x892f('0x1f')](_0x5397cd,function(_0x3a7e3c){_0x314cfd[_0x892f('0x1a')](_0x3a7e3c);})[_0x892f('0x10')](function(){for(var _0x5c2cd2=0x0;_0x5c2cd2<_0x314cfd[_0x892f('0x17')];_0x5c2cd2+=0x1){var _0x3f5acd;var _0x481167=_0x314cfd[_0x5c2cd2];if(_0x37da1d){_0x3f5acd=path['join'](_0x5dd636,_0x4856af,util['format'](_0x892f('0x20'),_0x4856af,_0x5c2cd2,_0x892f('0x21')));}else{_0x3f5acd=path[_0x892f('0x1e')](_0x5dd636,util[_0x892f('0xd')](_0x892f('0x22'),_0x4856af,_0x892f('0x21')));}fs[_0x892f('0x23')](_0x3f5acd,json2xls(_0x481167),_0x892f('0x24'));}})[_0x892f('0x10')](function(){if(_0x37da1d){zipdir(path['join'](_0x5dd636,_0x4856af),{'saveTo':path[_0x892f('0x1e')](_0x5dd636,util['format']('%s.%s',_0x4856af,_0x892f('0x25')))},function(_0x24b76e,_0x275a4c){});rimraf(path[_0x892f('0x1e')](_0x5dd636,_0x4856af),function(){});}})[_0x892f('0x10')](function(){logger[_0x892f('0xc')](util[_0x892f('0xd')](_0x892f('0x26'),EXTRACTED_REPORT_ID,_0x892f('0x27')));return analyticExtractedReport('Completed',_0x37da1d?util['format'](_0x892f('0x22'),_0x4856af,_0x37da1d?_0x892f('0x25'):_0x892f('0x21')):null);});})[_0x892f('0x28')](function(_0x2bb5ec){logger[_0x892f('0xc')](util[_0x892f('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x892f('0x27')),util[_0x892f('0x29')](_0x2bb5ec,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x892f('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index c007970..ebe588a 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 _0xfbac=['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','toLowerCase','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','Hangup','destroy','bulkCreate','sortBy','catch','error','util','models','Interval','intervals','findAll','then','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','context','VoiceExtensionId','outbound','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','):Goto(','outboundrouteid=','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','callerID'];(function(_0x1f4345,_0x2819fc){var _0x4a7fb6=function(_0x303d17){while(--_0x303d17){_0x1f4345['push'](_0x1f4345['shift']());}};_0x4a7fb6(++_0x2819fc);}(_0xfbac,0x167));var _0xcfba=function(_0x101e91,_0x33db0d){_0x101e91=_0x101e91-0x0;var _0xe515ed=_0xfbac[_0x101e91];return _0xe515ed;};'use strict';var _=require('lodash');var util=require(_0xcfba('0x0'));function rewrite(_0x45553f,_0x314f02){var _0x2f647e=this;return _0x45553f[_0xcfba('0x1')][_0xcfba('0x2')]['findAll']({'raw':!![]})['then'](function(_0x37dc6e){_0x2f647e[_0xcfba('0x3')]=_0x37dc6e;return _0x45553f['models']['VoiceExtension'][_0xcfba('0x4')]({'where':{'IntervalId':_0x314f02['IntervalId']},'raw':!![]});})[_0xcfba('0x5')](function(_0x5b7669){return _0x45553f[_0xcfba('0x1')][_0xcfba('0x6')]['findAll']({'where':{'exten':{'$in':_[_0xcfba('0x7')](_[_0xcfba('0x8')](_0x5b7669,_0xcfba('0x9')))}},'order':[{'raw':_0xcfba('0xa')}],'raw':!![]});})[_0xcfba('0x5')](function(_0x44af2e){var _0x37ed2d=_[_0xcfba('0xb')](_0x44af2e,{'priority':'1'});var _0x3b3a64=_[_0xcfba('0xb')](_0x44af2e,{'isApp':0x1});var _0x3e0c34=_[_0xcfba('0xc')](_0x3b3a64,'exten');var _0x48d6f1=[_0xcfba('0xd'),_0xcfba('0xe')];var _0x4c2ae0=[];var _0x42691d=[];for(var _0xf4a1db in _0x3e0c34){if(_0x3e0c34[_0xcfba('0xf')](_0xf4a1db)){_0x2f647e[_0xcfba('0x10')]=0x2;_0x2f647e[_0xcfba('0x11')]=[];_0x2f647e[_0xcfba('0x12')]=_[_0xcfba('0x13')](_0x37ed2d,{'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')]});_0x2f647e[_0xcfba('0x11')][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':util[_0xcfba('0x17')]('CDR(type)=%s',_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')]),'context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'priority':_0x2f647e[_0xcfba('0x10')]++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});if(_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')]===_0xcfba('0x1a')){if(_0x2f647e['extension']){_0x2f647e[_0xcfba('0x11')][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':'Set','appdata':'CDR(destination)='+(_0x2f647e[_0xcfba('0x12')][_0xcfba('0x1b')]?_0xcfba('0x1c')+_0x2f647e[_0xcfba('0x12')][_0xcfba('0x1b')]+'}':_0xcfba('0x1d')),'context':_0x3e0c34[_0xf4a1db][0x0]['context'],'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'priority':_0x2f647e['priority']++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});}_0x2f647e[_0xcfba('0x11')]['push']({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x1e')+_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')],'context':_0x3e0c34[_0xf4a1db][0x0]['context'],'exten':_0x3e0c34[_0xf4a1db][0x0]['exten'],'priority':_0x2f647e[_0xcfba('0x10')]++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});var _0x200a77=_0x2f647e['priority']++;_0x2f647e[_0xcfba('0x11')]['push']({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x200a77+0x2)+_0xcfba('0x1f')+(_0x200a77+0x1)+')','context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0]['exten'],'priority':_0x200a77,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});if(_0x2f647e[_0xcfba('0x12')]){_0x2f647e[_0xcfba('0x11')][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0x2f647e[_0xcfba('0x12')][_0xcfba('0x1b')]?'CDR(prefix)=${EXTEN:0:'+_0x2f647e[_0xcfba('0x12')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0]['exten'],'priority':_0x2f647e[_0xcfba('0x10')]++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0]['VoiceExtensionId']});}_0x2f647e[_0xcfba('0x11')][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x20')+_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')],'context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'priority':_0x2f647e['priority']++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0]['VoiceExtensionId']});if(_0x2f647e['extension']&&_0x2f647e[_0xcfba('0x12')][_0xcfba('0xf')]('recordingFormat')&&_0x2f647e[_0xcfba('0x12')]['recordingFormat']!==_0xcfba('0x21')){_0x2f647e[_0xcfba('0x11')][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x22'),'context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'priority':_0x2f647e['priority']++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});_0x2f647e[_0xcfba('0x11')][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x23')+_0x2f647e[_0xcfba('0x12')]['recordingFormat']||_0xcfba('0x24'),'context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'priority':_0x2f647e[_0xcfba('0x10')]++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});}}_0x2f647e['extensions']['push']({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x25'),'context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0]['exten'],'priority':_0x2f647e[_0xcfba('0x10')]++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});_0x2f647e['extensions']['push']({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x26'),'context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'priority':_0x2f647e[_0xcfba('0x10')]++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});_0x2f647e['extensions'][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':'Set','appdata':_0xcfba('0x27'),'context':_0x3e0c34[_0xf4a1db][0x0]['context'],'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'priority':_0x2f647e['priority']++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});for(var _0xd7d697=0x0,_0x2d24ea=0x0;_0xd7d697<_0x3e0c34[_0xf4a1db][_0xcfba('0x28')];_0xd7d697+=0x1,_0x2d24ea=0x0){var _0x7c4eeb=_0x3e0c34[_0xf4a1db][_0xd7d697];if(_0x7c4eeb[_0xcfba('0x15')]){_0x7c4eeb['type']=_0x7c4eeb[_0xcfba('0x15')]['toLowerCase']();}var _0x59c5bd=[];var _0x1ff57d=[];delete _0x7c4eeb['id'];delete _0x7c4eeb[_0xcfba('0x29')];delete _0x7c4eeb[_0xcfba('0x2a')];var _0x237015=_0x7c4eeb[_0xcfba('0x2b')]!==_0xcfba('0x2c')?[_0x7c4eeb['interval']]:_0x7c4eeb['IntervalId']?_['map'](_[_0xcfba('0xb')](_0x2f647e[_0xcfba('0x3')],{'IntervalId':_0x7c4eeb[_0xcfba('0x2d')]}),_0xcfba('0x2b')):[];if(_0x7c4eeb[_0xcfba('0xf')](_0xcfba('0x2e'))){if(_0x7c4eeb[_0xcfba('0x2e')]&&_0x7c4eeb[_0xcfba('0x2e')]!=='--'){_0x59c5bd[_0xcfba('0x14')]({'type':_0x7c4eeb['type'],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x2f')+_0x7c4eeb[_0xcfba('0x2e')],'context':_0x7c4eeb[_0xcfba('0x18')],'exten':_0x7c4eeb[_0xcfba('0x9')],'priority':_0x237015[_0xcfba('0x28')]+_0x2f647e[_0xcfba('0x10')]+_0x2d24ea++,'VoiceExtensionId':_0x7c4eeb['VoiceExtensionId']});}}if(_0x7c4eeb[_0xcfba('0x15')]===_0xcfba('0x1a')&&_0x7c4eeb[_0xcfba('0xf')](_0xcfba('0x30'))){if(_0x7c4eeb['callerID']){_0x59c5bd[_0xcfba('0x14')]({'type':_0x7c4eeb[_0xcfba('0x15')],'app':_0xcfba('0x31'),'appdata':_0xcfba('0x32')+_0x7c4eeb[_0xcfba('0x30')]+')','context':_0x7c4eeb[_0xcfba('0x18')],'exten':_0x7c4eeb[_0xcfba('0x9')],'priority':_0x237015['length']+_0x2f647e['priority']+_0x2d24ea++,'VoiceExtensionId':_0x7c4eeb[_0xcfba('0x19')]});}else{_0x59c5bd[_0xcfba('0x14')]({'type':_0x7c4eeb[_0xcfba('0x15')],'app':_0xcfba('0x31'),'appdata':_0xcfba('0x33'),'context':_0x7c4eeb[_0xcfba('0x18')],'exten':_0x7c4eeb['exten'],'priority':_0x237015['length']+_0x2f647e['priority']+_0x2d24ea++,'VoiceExtensionId':_0x7c4eeb[_0xcfba('0x19')]});}}if(_0x7c4eeb['hasOwnProperty'](_0xcfba('0x34'))){if(_0x48d6f1[_0xcfba('0x35')](_0x7c4eeb[_0xcfba('0x36')][_0xcfba('0x37')]())>=0x0&&_0x7c4eeb['appType']!=='custom'){if(_0x7c4eeb[_0xcfba('0x34')]){_0x59c5bd[_0xcfba('0x14')]({'type':_0x7c4eeb[_0xcfba('0x15')],'app':_0xcfba('0x31'),'appdata':_0xcfba('0x38'),'context':_0x7c4eeb[_0xcfba('0x18')],'exten':_0x7c4eeb[_0xcfba('0x9')],'priority':_0x237015[_0xcfba('0x28')]+_0x2f647e['priority']+_0x2d24ea++,'VoiceExtensionId':_0x7c4eeb['VoiceExtensionId']});_0x59c5bd[_0xcfba('0x14')]({'type':_0x7c4eeb[_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x39'),'context':_0x7c4eeb[_0xcfba('0x18')],'exten':_0x7c4eeb[_0xcfba('0x9')],'priority':_0x237015[_0xcfba('0x28')]+_0x2f647e[_0xcfba('0x10')]+_0x2d24ea++,'VoiceExtensionId':_0x7c4eeb[_0xcfba('0x19')]});}else{_0x59c5bd[_0xcfba('0x14')]({'type':_0x7c4eeb[_0xcfba('0x15')],'app':_0xcfba('0x31'),'appdata':_0xcfba('0x3a'),'context':_0x7c4eeb[_0xcfba('0x18')],'exten':_0x7c4eeb['exten'],'priority':_0x237015['length']+_0x2f647e[_0xcfba('0x10')]+_0x2d24ea++,'VoiceExtensionId':_0x7c4eeb[_0xcfba('0x19')]});_0x59c5bd[_0xcfba('0x14')]({'type':_0x7c4eeb[_0xcfba('0x15')],'app':'Set','appdata':_0xcfba('0x3b'),'context':_0x7c4eeb[_0xcfba('0x18')],'exten':_0x7c4eeb[_0xcfba('0x9')],'priority':_0x237015['length']+_0x2f647e[_0xcfba('0x10')]+_0x2d24ea++,'VoiceExtensionId':_0x7c4eeb[_0xcfba('0x19')]});}}}for(var _0x21ee2b=0x0;_0x21ee2b<_0x237015['length'];_0x21ee2b+=0x1){var _0x13e20e=_0x2f647e[_0xcfba('0x10')]+_0x237015[_0xcfba('0x28')];var _0x35c6dc=_0x21ee2b===_0x237015['length']-0x1?_0x2f647e['priority']+_0x59c5bd[_0xcfba('0x28')]+_0x1ff57d[_0xcfba('0x28')]+0x2:_0x2f647e['priority']+_0x21ee2b+0x1;_0x59c5bd['splice'](_0x21ee2b,0x0,{'type':_0x7c4eeb[_0xcfba('0x15')],'app':'GotoIfTime','appdata':_0x237015[_0x21ee2b]+'?'+_0x7c4eeb[_0xcfba('0x18')]+_0xcfba('0x3c')+_0x13e20e+':'+_0x7c4eeb[_0xcfba('0x18')]+',${EXTEN},'+_0x35c6dc,'exten':_0x7c4eeb[_0xcfba('0x9')],'context':_0x7c4eeb[_0xcfba('0x18')],'priority':_0x2f647e[_0xcfba('0x10')]+_0x21ee2b,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});}_0x7c4eeb['priority']=_0x59c5bd[_0xcfba('0x28')]?_[_0xcfba('0x3d')](_0x59c5bd)[_0xcfba('0x10')]+0x1:_0x2f647e[_0xcfba('0x10')];_0x2f647e[_0xcfba('0x10')]=(_0x1ff57d[_0xcfba('0x28')]?_['last'](_0x1ff57d)[_0xcfba('0x10')]:_0x7c4eeb[_0xcfba('0x10')])+0x1;_0x2f647e[_0xcfba('0x11')]=_['concat'](_0x2f647e[_0xcfba('0x11')],_0x59c5bd,[_0x7c4eeb],_0x1ff57d);}_0x2f647e['extensions'][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x3e'),'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'context':_0x3e0c34[_0xf4a1db][0x0]['context'],'priority':_0x2f647e[_0xcfba('0x10')],'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});_0x4c2ae0[_0xcfba('0x14')](_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]);_0x42691d=_['concat'](_0x42691d,_0x2f647e[_0xcfba('0x11')]);}}return _0x45553f['transaction'](function(_0xb9d1bf){return _0x45553f[_0xcfba('0x1')][_0xcfba('0x6')][_0xcfba('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x4c2ae0}},'transaction':_0xb9d1bf})[_0xcfba('0x5')](function(_0x4f352b){return _0x45553f[_0xcfba('0x1')]['VoiceExtension'][_0xcfba('0x40')](_[_0xcfba('0x41')](_0x42691d,_0xcfba('0x10')),{'transaction':_0xb9d1bf});});});})[_0xcfba('0x42')](function(_0x5a3251){console[_0xcfba('0x43')](_0x5a3251);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x2b51=['wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','indexOf','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','IntervalId','map','exten','filter','groupBy','queue','playback','hasOwnProperty','extensions','extension','find','push','format','CDR(type)=%s','type','priority','VoiceExtensionId','outbound','Set','CDR(destination)=','cutdigits','${EXTEN}','context','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none'];(function(_0x52ca59,_0x279dda){var _0x1ab7e5=function(_0x2b8c74){while(--_0x2b8c74){_0x52ca59['push'](_0x52ca59['shift']());}};_0x1ab7e5(++_0x279dda);}(_0x2b51,0xe7));var _0x12b5=function(_0x20a0d6,_0x27c4c4){_0x20a0d6=_0x20a0d6-0x0;var _0x245ccf=_0x2b51[_0x20a0d6];return _0x245ccf;};'use strict';var _=require(_0x12b5('0x0'));var util=require(_0x12b5('0x1'));function rewrite(_0x2fad5d,_0xff436f){var _0x555338=this;return _0x2fad5d[_0x12b5('0x2')][_0x12b5('0x3')][_0x12b5('0x4')]({'raw':!![]})[_0x12b5('0x5')](function(_0x5bc5a9){_0x555338[_0x12b5('0x6')]=_0x5bc5a9;return _0x2fad5d[_0x12b5('0x2')]['VoiceExtension'][_0x12b5('0x4')]({'where':{'IntervalId':_0xff436f[_0x12b5('0x7')]},'raw':!![]});})[_0x12b5('0x5')](function(_0x2114d9){return _0x2fad5d['models']['VoiceExtension'][_0x12b5('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0x12b5('0x8')](_0x2114d9,_0x12b5('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x12b5('0x5')](function(_0x2c0d6e){var _0x24fe9a=_[_0x12b5('0xa')](_0x2c0d6e,{'priority':'1'});var _0x59a4b1=_[_0x12b5('0xa')](_0x2c0d6e,{'isApp':0x1});var _0x48d6c2=_[_0x12b5('0xb')](_0x59a4b1,_0x12b5('0x9'));var _0x147da7=[_0x12b5('0xc'),_0x12b5('0xd')];var _0x5c9ac8=[];var _0x26cb4b=[];for(var _0x32ff24 in _0x48d6c2){if(_0x48d6c2[_0x12b5('0xe')](_0x32ff24)){_0x555338['priority']=0x2;_0x555338[_0x12b5('0xf')]=[];_0x555338[_0x12b5('0x10')]=_[_0x12b5('0x11')](_0x24fe9a,{'exten':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x9')]});_0x555338[_0x12b5('0xf')][_0x12b5('0x12')]({'type':_0x48d6c2[_0x32ff24][0x0]['type'],'app':'Set','appdata':util[_0x12b5('0x13')](_0x12b5('0x14'),_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x15')]),'context':_0x48d6c2[_0x32ff24][0x0]['context'],'exten':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x9')],'priority':_0x555338[_0x12b5('0x16')]++,'VoiceExtensionId':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x17')]});if(_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x15')]===_0x12b5('0x18')){if(_0x555338[_0x12b5('0x10')]){_0x555338[_0x12b5('0xf')]['push']({'type':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x15')],'app':_0x12b5('0x19'),'appdata':_0x12b5('0x1a')+(_0x555338[_0x12b5('0x10')][_0x12b5('0x1b')]?'${EXTEN:'+_0x555338[_0x12b5('0x10')][_0x12b5('0x1b')]+'}':_0x12b5('0x1c')),'context':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x1d')],'exten':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x9')],'priority':_0x555338[_0x12b5('0x16')]++,'VoiceExtensionId':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x17')]});}_0x555338[_0x12b5('0xf')][_0x12b5('0x12')]({'type':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x15')],'app':_0x12b5('0x19'),'appdata':_0x12b5('0x1e')+_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x17')],'context':_0x48d6c2[_0x32ff24][0x0]['context'],'exten':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x9')],'priority':_0x555338[_0x12b5('0x16')]++,'VoiceExtensionId':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x17')]});var _0x5bbeed=_0x555338[_0x12b5('0x16')]++;_0x555338[_0x12b5('0xf')][_0x12b5('0x12')]({'type':_0x48d6c2[_0x32ff24][0x0]['type'],'app':_0x12b5('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5bbeed+0x2)+_0x12b5('0x20')+(_0x5bbeed+0x1)+')','context':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x1d')],'exten':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x9')],'priority':_0x5bbeed,'VoiceExtensionId':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x17')]});if(_0x555338[_0x12b5('0x10')]){_0x555338[_0x12b5('0xf')][_0x12b5('0x12')]({'type':_0x48d6c2[_0x32ff24][0x0]['type'],'app':_0x12b5('0x19'),'appdata':_0x555338['extension']['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x555338['extension'][_0x12b5('0x1b')]+'}':_0x12b5('0x21'),'context':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x1d')],'exten':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x9')],'priority':_0x555338['priority']++,'VoiceExtensionId':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x17')]});}_0x555338[_0x12b5('0xf')]['push']({'type':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x15')],'app':_0x12b5('0x19'),'appdata':_0x12b5('0x22')+_0x48d6c2[_0x32ff24][0x0]['VoiceExtensionId'],'context':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x1d')],'exten':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x9')],'priority':_0x555338[_0x12b5('0x16')]++,'VoiceExtensionId':_0x48d6c2[_0x32ff24][0x0]['VoiceExtensionId']});if(_0x555338[_0x12b5('0x10')]&&_0x555338[_0x12b5('0x10')][_0x12b5('0xe')](_0x12b5('0x23'))&&_0x555338[_0x12b5('0x10')]['recordingFormat']!==_0x12b5('0x24')){_0x555338['extensions'][_0x12b5('0x12')]({'type':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x15')],'app':_0x12b5('0x19'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x1d')],'exten':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x9')],'priority':_0x555338[_0x12b5('0x16')]++,'VoiceExtensionId':_0x48d6c2[_0x32ff24][0x0]['VoiceExtensionId']});_0x555338['extensions'][_0x12b5('0x12')]({'type':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x15')],'app':_0x12b5('0x19'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x555338['extension'][_0x12b5('0x23')]||_0x12b5('0x25'),'context':_0x48d6c2[_0x32ff24][0x0]['context'],'exten':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x9')],'priority':_0x555338[_0x12b5('0x16')]++,'VoiceExtensionId':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x17')]});}}_0x555338['extensions']['push']({'type':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x15')],'app':_0x12b5('0x19'),'appdata':_0x12b5('0x26'),'context':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x1d')],'exten':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x9')],'priority':_0x555338[_0x12b5('0x16')]++,'VoiceExtensionId':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x17')]});_0x555338[_0x12b5('0xf')][_0x12b5('0x12')]({'type':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x15')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x1d')],'exten':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x9')],'priority':_0x555338['priority']++,'VoiceExtensionId':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x17')]});_0x555338[_0x12b5('0xf')][_0x12b5('0x12')]({'type':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x15')],'app':_0x12b5('0x19'),'appdata':_0x12b5('0x27'),'context':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x1d')],'exten':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x9')],'priority':_0x555338[_0x12b5('0x16')]++,'VoiceExtensionId':_0x48d6c2[_0x32ff24][0x0]['VoiceExtensionId']});for(var _0x195a2e=0x0,_0x5d7bda=0x0;_0x195a2e<_0x48d6c2[_0x32ff24][_0x12b5('0x28')];_0x195a2e+=0x1,_0x5d7bda=0x0){var _0x46137f=_0x48d6c2[_0x32ff24][_0x195a2e];if(_0x46137f['type']){_0x46137f[_0x12b5('0x15')]=_0x46137f[_0x12b5('0x15')][_0x12b5('0x29')]();}var _0x41e1f5=[];var _0x110034=[];delete _0x46137f['id'];delete _0x46137f[_0x12b5('0x2a')];delete _0x46137f[_0x12b5('0x2b')];var _0x227e01=_0x46137f['interval']!==_0x12b5('0x2c')?[_0x46137f[_0x12b5('0x2d')]]:_0x46137f[_0x12b5('0x7')]?_[_0x12b5('0x8')](_[_0x12b5('0xa')](_0x555338[_0x12b5('0x6')],{'IntervalId':_0x46137f[_0x12b5('0x7')]}),'interval'):[];if(_0x46137f[_0x12b5('0xe')](_0x12b5('0x2e'))){if(_0x46137f[_0x12b5('0x2e')]&&_0x46137f[_0x12b5('0x2e')]!=='--'){_0x41e1f5[_0x12b5('0x12')]({'type':_0x46137f[_0x12b5('0x15')],'app':'Set','appdata':_0x12b5('0x2f')+_0x46137f['tag'],'context':_0x46137f[_0x12b5('0x1d')],'exten':_0x46137f['exten'],'priority':_0x227e01[_0x12b5('0x28')]+_0x555338[_0x12b5('0x16')]+_0x5d7bda++,'VoiceExtensionId':_0x46137f['VoiceExtensionId']});}}if(_0x46137f[_0x12b5('0x15')]===_0x12b5('0x18')&&_0x46137f[_0x12b5('0xe')](_0x12b5('0x30'))){if(_0x46137f[_0x12b5('0x30')]){_0x41e1f5['push']({'type':_0x46137f['type'],'app':_0x12b5('0x1f'),'appdata':_0x12b5('0x31')+_0x46137f[_0x12b5('0x30')]+')','context':_0x46137f[_0x12b5('0x1d')],'exten':_0x46137f['exten'],'priority':_0x227e01[_0x12b5('0x28')]+_0x555338[_0x12b5('0x16')]+_0x5d7bda++,'VoiceExtensionId':_0x46137f['VoiceExtensionId']});}else{_0x41e1f5[_0x12b5('0x12')]({'type':_0x46137f[_0x12b5('0x15')],'app':_0x12b5('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x46137f[_0x12b5('0x1d')],'exten':_0x46137f[_0x12b5('0x9')],'priority':_0x227e01[_0x12b5('0x28')]+_0x555338['priority']+_0x5d7bda++,'VoiceExtensionId':_0x46137f['VoiceExtensionId']});}}if(_0x46137f['hasOwnProperty']('answer')){if(_0x147da7[_0x12b5('0x32')](_0x46137f['app'][_0x12b5('0x29')]())>=0x0&&_0x46137f[_0x12b5('0x33')]!=='custom'){if(_0x46137f['answer']){_0x41e1f5[_0x12b5('0x12')]({'type':_0x46137f[_0x12b5('0x15')],'app':_0x12b5('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x46137f['context'],'exten':_0x46137f[_0x12b5('0x9')],'priority':_0x227e01['length']+_0x555338[_0x12b5('0x16')]+_0x5d7bda++,'VoiceExtensionId':_0x46137f[_0x12b5('0x17')]});_0x41e1f5[_0x12b5('0x12')]({'type':_0x46137f['type'],'app':_0x12b5('0x19'),'appdata':_0x12b5('0x34'),'context':_0x46137f['context'],'exten':_0x46137f[_0x12b5('0x9')],'priority':_0x227e01['length']+_0x555338[_0x12b5('0x16')]+_0x5d7bda++,'VoiceExtensionId':_0x46137f[_0x12b5('0x17')]});}else{_0x41e1f5['push']({'type':_0x46137f[_0x12b5('0x15')],'app':_0x12b5('0x1f'),'appdata':_0x12b5('0x35'),'context':_0x46137f['context'],'exten':_0x46137f[_0x12b5('0x9')],'priority':_0x227e01[_0x12b5('0x28')]+_0x555338[_0x12b5('0x16')]+_0x5d7bda++,'VoiceExtensionId':_0x46137f['VoiceExtensionId']});_0x41e1f5[_0x12b5('0x12')]({'type':_0x46137f['type'],'app':'Set','appdata':_0x12b5('0x36'),'context':_0x46137f[_0x12b5('0x1d')],'exten':_0x46137f[_0x12b5('0x9')],'priority':_0x227e01[_0x12b5('0x28')]+_0x555338[_0x12b5('0x16')]+_0x5d7bda++,'VoiceExtensionId':_0x46137f[_0x12b5('0x17')]});}}}for(var _0x90dd7=0x0;_0x90dd7<_0x227e01[_0x12b5('0x28')];_0x90dd7+=0x1){var _0x7ec675=_0x555338[_0x12b5('0x16')]+_0x227e01[_0x12b5('0x28')];var _0xdea95b=_0x90dd7===_0x227e01['length']-0x1?_0x555338[_0x12b5('0x16')]+_0x41e1f5[_0x12b5('0x28')]+_0x110034[_0x12b5('0x28')]+0x2:_0x555338['priority']+_0x90dd7+0x1;_0x41e1f5['splice'](_0x90dd7,0x0,{'type':_0x46137f[_0x12b5('0x15')],'app':_0x12b5('0x37'),'appdata':_0x227e01[_0x90dd7]+'?'+_0x46137f['context']+_0x12b5('0x38')+_0x7ec675+':'+_0x46137f[_0x12b5('0x1d')]+',${EXTEN},'+_0xdea95b,'exten':_0x46137f['exten'],'context':_0x46137f['context'],'priority':_0x555338['priority']+_0x90dd7,'VoiceExtensionId':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x17')]});}_0x46137f[_0x12b5('0x16')]=_0x41e1f5['length']?_[_0x12b5('0x39')](_0x41e1f5)['priority']+0x1:_0x555338[_0x12b5('0x16')];_0x555338[_0x12b5('0x16')]=(_0x110034[_0x12b5('0x28')]?_[_0x12b5('0x39')](_0x110034)[_0x12b5('0x16')]:_0x46137f['priority'])+0x1;_0x555338[_0x12b5('0xf')]=_[_0x12b5('0x3a')](_0x555338['extensions'],_0x41e1f5,[_0x46137f],_0x110034);}_0x555338[_0x12b5('0xf')][_0x12b5('0x12')]({'type':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x15')],'app':_0x12b5('0x3b'),'exten':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x9')],'context':_0x48d6c2[_0x32ff24][0x0][_0x12b5('0x1d')],'priority':_0x555338[_0x12b5('0x16')],'VoiceExtensionId':_0x48d6c2[_0x32ff24][0x0]['VoiceExtensionId']});_0x5c9ac8[_0x12b5('0x12')](_0x48d6c2[_0x32ff24][0x0]['VoiceExtensionId']);_0x26cb4b=_['concat'](_0x26cb4b,_0x555338[_0x12b5('0xf')]);}}return _0x2fad5d[_0x12b5('0x3c')](function(_0x471a26){return _0x2fad5d[_0x12b5('0x2')]['VoiceExtension'][_0x12b5('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x5c9ac8}},'transaction':_0x471a26})[_0x12b5('0x5')](function(_0x38cb55){return _0x2fad5d['models']['VoiceExtension'][_0x12b5('0x3e')](_[_0x12b5('0x3f')](_0x26cb4b,_0x12b5('0x16')),{'transaction':_0x471a26});});});})[_0x12b5('0x40')](function(_0x18d3a0){console[_0x12b5('0x41')](_0x18d3a0);});}exports[_0x12b5('0x42')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 7860929..a27c49d 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 _0xb7e7=['birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','where','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','phone','phone\x20not\x20specified!'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb7e7[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0x7b7e('0x0'));var util=require('util');var _=require(_0x7b7e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7b7e('0x2'));var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));config[_0x7b7e('0x6')]=_['defaults'](config['redis'],{'host':_0x7b7e('0x7'),'port':0x18eb});var socket=require(_0x7b7e('0x8'))(new Redis(config[_0x7b7e('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x7b7e('0x9')](socket);try{if(!process[_0x7b7e('0xa')][0x2]||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xc')){throw new Error(_0x7b7e('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7b7e('0xa')][0x3]||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xc')||!process[_0x7b7e('0xa')][0x4]||process[_0x7b7e('0xa')][0x4]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x4]==='null'){throw new Error(_0x7b7e('0xe'));}var FIELDS=_[_0x7b7e('0xf')](process['argv'][0x3][_0x7b7e('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x7b7e('0xa')][0x5]||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7b7e('0xa')][0x6]&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x6]:null;var DUPLICATES=process[_0x7b7e('0xa')][0x7]&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x7]:null;if(!process[_0x7b7e('0xa')][0x8]||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7b7e('0xa')][0x8];}catch(_0x43db4f){logger[_0x7b7e('0x11')](_0x43db4f);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(_0x4c0647,_0x313122,_0xbf0cb3,_0x14243b){var _0x200156={'message':_0x313122};_0x200156[_0x4c0647]=!![];if(_0xbf0cb3){_0x200156[_0x7b7e('0x12')]=_0xbf0cb3;}if(_0x14243b){_0x200156[_0x7b7e('0x13')]=_0x14243b;}return _0x200156;}function isEmail(_0x28bf43){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))*$/[_0x7b7e('0x14')](_0x28bf43);}function checkRow(_0x53bbb3,_0x5d6215,_0x4a836a){return new BPromise(function(_0x26ee14,_0x22598e){if(_[_0x7b7e('0x15')](_0x53bbb3)){return _0x22598e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4a836a));}if(_0x53bbb3['errors']&&_0x53bbb3[_0x7b7e('0x16')][_0x7b7e('0x17')]){var _0x16a3c7=_[_0x7b7e('0x18')](_0x53bbb3[_0x7b7e('0x16')],'message')[_0x7b7e('0x19')](';');return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x16a3c7,null,_0x4a836a));}var _0x4c46b8={};for(var _0x57b9da in FIELDS){if(FIELDS['hasOwnProperty'](_0x57b9da)&&FIELDS[_0x57b9da]){_0x4c46b8[_0x57b9da]=_0x53bbb3[_0x7b7e('0x1a')][0x0][FIELDS[_0x57b9da]]||_0x53bbb3[_0x7b7e('0x1a')][0x0]['\ufeff'+FIELDS[_0x57b9da]];}}if(!_0x4c46b8['firstName']){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'firstName\x20not\x20specified!',null,_0x4a836a));}if(!_0x4c46b8[_0x7b7e('0x1b')]){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x1c'),null,_0x4a836a));}if(_0x4c46b8['birthDate']){var _0x3960b8=moment(_0x4c46b8[_0x7b7e('0x1d')],_0x7b7e('0x1e'));if(!_0x3960b8[_0x7b7e('0x1f')]()){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a836a));}}if(_0x4c46b8[_0x7b7e('0x20')]){if(!isEmail(_0x4c46b8['email'])){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x21'),null,_0x4a836a));}}_0x4c46b8[_0x7b7e('0x22')]=LISTID;_0x4c46b8[_0x7b7e('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){var _0x247ea0={};for(var _0x29cb58=0x0,_0x4bfe7f=DUPLICATES['length'];_0x29cb58<_0x4bfe7f;_0x29cb58+=0x1){_0x247ea0[DUPLICATES[_0x29cb58]]=_0x4c46b8[DUPLICATES[_0x29cb58]];}var _0xebcdbc=_[_0x7b7e('0x24')](_0x5d6215,_0x247ea0);if(_0xebcdbc){return _0x22598e(handleCheckRowError('duplicate',_0x7b7e('0x25'),_0xebcdbc,_0x4a836a));}}return db[_0x7b7e('0x26')][_0x7b7e('0x27')](_0x4c46b8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c46b8)})[_0x7b7e('0x28')](function(_0x256908){if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){_0x5d6215[_0x7b7e('0x29')](_[_0x7b7e('0x2a')](_0x4c46b8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x256908['id'];return _0x26ee14();})[_0x7b7e('0x2b')](function(_0x3e8cf4){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x2c')+(_0x3e8cf4[_0x7b7e('0x2d')]||JSON[_0x7b7e('0x2e')](_0x3e8cf4)),null,_0x4a836a));});});}function checkHopper(){function _0x2d0620(){return function(_0x442366){logger[_0x7b7e('0x11')](_0x7b7e('0x2f'),_0x7b7e('0x30'),util['inspect'](_0x442366,{'showHidden':![],'depth':null}));};}var _0x8c80d5=function(_0x156dca,_0xb20532){var _0x242609=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),'ContactId',_0x7b7e('0x22'),_0xb20532,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))[_0x7b7e('0x39')]('NOW()','scheduledAt')[_0x7b7e('0x39')]('id','ContactId')[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x156dca['id'][_0x7b7e('0x3a')](),_0xb20532)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID['toString']())['where'](_0x7b7e('0x3f'))['where'](_0x7b7e('0x40'),squel['select']()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xb20532+_0x7b7e('0x41'),_0x156dca['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x242609;};var _0x37895a=function(_0x3e4f21,_0xccdfc7){var _0x5e8572=squel['insert']()['into'](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0xccdfc7,'createdAt',_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))['field'](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x3e4f21['id'][_0x7b7e('0x3a')](),_0xccdfc7)[_0x7b7e('0x39')](_0x7b7e('0x3b'),'createdAt')[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())[_0x7b7e('0x44')]('id\x20IN\x20?',squel[_0x7b7e('0x45')](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f'))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')]('calleridnum')[_0x7b7e('0x3c')]('cm_hopper_final')[_0x7b7e('0x44')](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id']['toString']()))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x5e8572;};function _0x24481a(_0x5b9ab5,_0x527403){var _0x5bdf1d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))['fromQuery'](['phone',_0x7b7e('0x35'),_0x7b7e('0x42'),'ListId',_0x527403,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5b9ab5['id'][_0x7b7e('0x3a')](),_0x527403)['field'](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')[_0x7b7e('0x44')]('deletedAt\x20IS\x20NULL')[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID['toString']())[_0x7b7e('0x44')](_0x7b7e('0x46'),squel['str'](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x5bdf1d;}function _0x3b1adb(_0x5eb32c,_0x101896){var _0x73904d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x47'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0x101896,_0x7b7e('0x36'),'updatedAt'],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID['toString'](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5eb32c['id'][_0x7b7e('0x3a')](),_0x101896)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),'updatedAt')['from'](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())['where'](_0x7b7e('0x46'),squel[_0x7b7e('0x45')](hopperContacts))['where'](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x73904d;}return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id',_0x7b7e('0x4b')],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x17e5ba){var _0x589b02=[];if(_0x17e5ba){var _0x59ecf9;for(var _0x34e7df=0x0,_0x46ac1f;_0x34e7df<_0x17e5ba[_0x7b7e('0x17')];_0x34e7df+=0x1){_0x46ac1f=_0x17e5ba[_0x34e7df][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x46ac1f[_0x7b7e('0x4b')]){case _0x7b7e('0x4f'):_0x589b02[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x46ac1f,_0x7b7e('0x51')))['then'](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case _0x7b7e('0x52'):_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x46ac1f,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x46ac1f,'VoiceQueueId'))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x589b02;})[_0x7b7e('0x54')]()[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1eb5ce){var _0x49f0a4=[];if(_0x1eb5ce){var _0x1d6aa4;for(var _0x195ae2=0x0,_0x381ee6;_0x195ae2<_0x1eb5ce[_0x7b7e('0x17')];_0x195ae2+=0x1){_0x381ee6=_0x1eb5ce[_0x195ae2][_0x7b7e('0x4e')]({'plain':!![]});_0x49f0a4['push'](db['sequelize']['query'](_0x3b1adb(_0x381ee6,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}return _0x49f0a4;})['all']();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x34a06c){var _0x538c5f=[];if(_0x34a06c){for(var _0x315923=0x0,_0x40b4ae;_0x315923<_0x34a06c[_0x7b7e('0x17')];_0x315923+=0x1){_0x40b4ae=_0x34a06c[_0x315923][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x40b4ae['dialCheckDuplicateType']){case'always':_0x538c5f[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case'onlyIfOpen':_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x538c5f;})[_0x7b7e('0x54')]();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1d9e08){var _0xa03d7a=[];if(_0x1d9e08){for(var _0x10c35e=0x0,_0x302462;_0x10c35e<_0x1d9e08[_0x7b7e('0x17')];_0x10c35e+=0x1){_0x302462=_0x1d9e08[_0x10c35e]['get']({'plain':!![]});_0xa03d7a[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x3b1adb(_0x302462,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})['catch'](_0x2d0620()));}}return _0xa03d7a;})['all']();})[_0x7b7e('0x2b')](function(_0x110f2b){logger[_0x7b7e('0x11')](_0x7b7e('0x58'),_0x7b7e('0x59'),_0x110f2b[_0x7b7e('0x2d')]);});}var processPromises=function(_0x2c65b8){return BPromise[_0x7b7e('0x54')](promises)[_0x7b7e('0x28')](function(_0x850d0f){})['catch'](function(_0x27402a){logger[_0x7b7e('0x11')](_0x7b7e('0x5a'),JSON[_0x7b7e('0x2e')](_0x27402a));})[_0x7b7e('0x5b')](function(){socket[_0x7b7e('0x5c')](_0x7b7e('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2c65b8){return _0x2c65b8['resume']();}});};var endCsv=function(){return BPromise[_0x7b7e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7b7e('0x28')](function(){socket[_0x7b7e('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7b7e('0x5f')](FILEPATH);}catch(_0x38fd40){logger[_0x7b7e('0x11')](_0x7b7e('0x60'),JSON[_0x7b7e('0x2e')](_0x38fd40));}finally{process['exit'](0x0);}});};process['on'](_0x7b7e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7b7e('0x5e')]()[_0x7b7e('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7b7e('0x10')](',');return db[_0x7b7e('0x26')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7b7e('0x28')](function(_0x5cedd4){var _0x25233a=fs[_0x7b7e('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7b7e('0x63')](_0x25233a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71ab,_0x11d615){total+=0x1;var _0x3afd15=total;promises[_0x7b7e('0x29')](checkRow(_0x1e71ab,_0x5cedd4,_0x3afd15)['then'](function(){success+=0x1;})[_0x7b7e('0x2b')](function(_0x30eeee){if(_0x30eeee['error']){errors+=0x1;delete _0x30eeee[_0x7b7e('0x11')];}else if(_0x30eeee[_0x7b7e('0x64')]){duplicates+=0x1;delete _0x30eeee[_0x7b7e('0x64')];}rows[_0x7b7e('0x29')](_0x30eeee);}));if(total%0xc8===0x0){_0x11d615[_0x7b7e('0x65')]();return processPromises(_0x11d615);}},'complete':function(){return processPromises()[_0x7b7e('0x28')](function(){logger[_0x7b7e('0x66')](_0x7b7e('0x67'));endCsv();});},'error':function(_0x41e2b5,_0x97232d){logger[_0x7b7e('0x66')](_0x7b7e('0x68'),JSON[_0x7b7e('0x2e')](_0x41e2b5));endCsv();}});})[_0x7b7e('0x2b')](function(_0x12d0cb){logger[_0x7b7e('0x11')](_0x7b7e('0x69'),JSON[_0x7b7e('0x2e')](_0x12d0cb));});}main(); \ No newline at end of file +var _0xe706=['toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','insert','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','push','sequelize','VoiceQueueId','catch','onlyIfOpen','query','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','split','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()'];(function(_0x17ef0c,_0x4be9aa){var _0xb5c78a=function(_0x4d6445){while(--_0x4d6445){_0x17ef0c['push'](_0x17ef0c['shift']());}};_0xb5c78a(++_0x4be9aa);}(_0xe706,0xa3));var _0x6e70=function(_0x449235,_0x567736){_0x449235=_0x449235-0x0;var _0x2446ad=_0xe706[_0x449235];return _0x2446ad;};'use strict';var BPromise=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var socket=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));require(_0x6e70('0xd'))[_0x6e70('0xe')](socket);try{if(!process[_0x6e70('0xf')][0x2]||process[_0x6e70('0xf')][0x2]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x2]===_0x6e70('0x11')){throw new Error(_0x6e70('0x12'));}var FILEPATH=process[_0x6e70('0xf')][0x2];if(!process[_0x6e70('0xf')][0x3]||process[_0x6e70('0xf')][0x3]===_0x6e70('0x10')||process['argv'][0x3]==='null'||!process[_0x6e70('0xf')][0x4]||process[_0x6e70('0xf')][0x4]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x4]===_0x6e70('0x11')){throw new Error(_0x6e70('0x13'));}var FIELDS=_[_0x6e70('0x14')](process[_0x6e70('0xf')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0x6e70('0xf')][0x5]||process['argv'][0x5]==='undefined'||process[_0x6e70('0xf')][0x5]===_0x6e70('0x11')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x6e70('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x6e70('0xf')][0x6]!==_0x6e70('0x10')&&process['argv'][0x6]!=='null'?process[_0x6e70('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x6e70('0xf')][0x7]!==_0x6e70('0x10')&&process['argv'][0x7]!=='null'?process[_0x6e70('0xf')][0x7]:null;if(!process[_0x6e70('0xf')][0x8]||process[_0x6e70('0xf')][0x8]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x8]===_0x6e70('0x11')){throw new Error(_0x6e70('0x15'));}var SOCKET_TIMESTAMP=process[_0x6e70('0xf')][0x8];}catch(_0x29326f){logger[_0x6e70('0x16')](_0x29326f);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(_0x4a0cfe,_0x228350,_0x344b65,_0x27b294){var _0x502b2d={'message':_0x228350};_0x502b2d[_0x4a0cfe]=!![];if(_0x344b65){_0x502b2d[_0x6e70('0x17')]=_0x344b65;}if(_0x27b294){_0x502b2d[_0x6e70('0x18')]=_0x27b294;}return _0x502b2d;}function isEmail(_0x3337a6){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'](_0x3337a6);}function checkRow(_0x10fc91,_0x538b9c,_0x50aec2){return new BPromise(function(_0x4e97c7,_0x41e352){if(_[_0x6e70('0x19')](_0x10fc91)){return _0x41e352(handleCheckRowError('error',_0x6e70('0x1a'),null,_0x50aec2));}if(_0x10fc91[_0x6e70('0x1b')]&&_0x10fc91['errors'][_0x6e70('0x1c')]){var _0x67fb43=_[_0x6e70('0x1d')](_0x10fc91['errors'],'message')[_0x6e70('0x1e')](';');return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x67fb43,null,_0x50aec2));}var _0x83c836={};for(var _0x114344 in FIELDS){if(FIELDS[_0x6e70('0x1f')](_0x114344)&&FIELDS[_0x114344]){_0x83c836[_0x114344]=_0x10fc91['data'][0x0][FIELDS[_0x114344]]||_0x10fc91[_0x6e70('0x20')][0x0]['\ufeff'+FIELDS[_0x114344]];}}if(!_0x83c836[_0x6e70('0x21')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x22'),null,_0x50aec2));}if(!_0x83c836[_0x6e70('0x23')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x24'),null,_0x50aec2));}if(_0x83c836[_0x6e70('0x25')]){var _0x3a0821=moment(_0x83c836[_0x6e70('0x25')],'YYYY-MM-DD');if(!_0x3a0821[_0x6e70('0x26')]()){return _0x41e352(handleCheckRowError('error',_0x6e70('0x27'),null,_0x50aec2));}}if(_0x83c836['email']){if(!isEmail(_0x83c836[_0x6e70('0x28')])){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x29'),null,_0x50aec2));}}_0x83c836['ListId']=LISTID;_0x83c836[_0x6e70('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){var _0x5780a1={};for(var _0x13d673=0x0,_0x154925=DUPLICATES['length'];_0x13d673<_0x154925;_0x13d673+=0x1){_0x5780a1[DUPLICATES[_0x13d673]]=_0x83c836[DUPLICATES[_0x13d673]];}var _0x10d8f6=_[_0x6e70('0x2b')](_0x538b9c,_0x5780a1);if(_0x10d8f6){return _0x41e352(handleCheckRowError(_0x6e70('0x2c'),_0x6e70('0x2d'),_0x10d8f6,_0x50aec2));}}return db[_0x6e70('0x2e')][_0x6e70('0x2f')](_0x83c836,{'raw':!![],'hooks':![],'fields':_[_0x6e70('0x30')](_0x83c836)})[_0x6e70('0x31')](function(_0xf146fd){if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){_0x538b9c['push'](_[_0x6e70('0x32')](_0x83c836,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xf146fd['id'];return _0x4e97c7();})['catch'](function(_0x23cd1a){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x33')+(_0x23cd1a[_0x6e70('0x34')]||JSON[_0x6e70('0x35')](_0x23cd1a)),null,_0x50aec2));});});}function checkHopper(){function _0x989b80(){return function(_0x2440be){logger[_0x6e70('0x16')](_0x6e70('0x36'),_0x6e70('0x37'),util[_0x6e70('0x38')](_0x2440be,{'showHidden':![],'depth':null}));};}var _0x23d5e2=function(_0x5594d3,_0x501b53){var _0x5446a2=squel['insert']()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),'ListId',_0x501b53,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x5594d3['id'][_0x6e70('0x43')](),_0x501b53)['field']('NOW()','createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x6e70('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x501b53+'\x20=\x20?',_0x5594d3['id'][_0x6e70('0x43')]())))[_0x6e70('0x43')]();return _0x5446a2;};var _0x2dafb5=function(_0x3478e2,_0x5bbc3a){var _0x291de6=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),'ContactId',_0x6e70('0x44'),_0x5bbc3a,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))['field'](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))['field'](LISTID['toString'](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x3478e2['id'][_0x6e70('0x43')](),_0x5bbc3a)['field']('NOW()',_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b'))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()['field'](_0x6e70('0x4d'))[_0x6e70('0x45')](_0x6e70('0x4e'))[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']()))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']())))[_0x6e70('0x43')]();return _0x291de6;};function _0xebe5f7(_0x54efdf,_0x3cfaa9){var _0xb3f06c=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))['fromQuery']([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),_0x6e70('0x44'),_0x3cfaa9,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3c'))[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x54efdf['id'][_0x6e70('0x43')](),_0x3cfaa9)['field'](_0x6e70('0x42'),_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')]('cm_contacts')[_0x6e70('0x48')](_0x6e70('0x47'))['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0xb3f06c;}function _0x41a861(_0x10d299,_0x739946){var _0x30cd88=squel['insert']()['into'](_0x6e70('0x50'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3d'),'ListId',_0x739946,'createdAt',_0x6e70('0x3f')],squel[_0x6e70('0x40')]()['field']('phone',_0x6e70('0x23'))['field']('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x10d299['id'][_0x6e70('0x43')](),_0x739946)[_0x6e70('0x41')](_0x6e70('0x42'),'createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0x30cd88;}return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x55'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x82a9a){var _0x515c0c=[];if(_0x82a9a){var _0xce964b;for(var _0x531097=0x0,_0x5b4046;_0x531097<_0x82a9a[_0x6e70('0x1c')];_0x531097+=0x1){_0x5b4046=_0x82a9a[_0x531097][_0x6e70('0x56')]({'plain':!![]});switch(_0x5b4046[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')]['query'](_0x2dafb5(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;default:_0x515c0c['push'](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x5b4046,_0x6e70('0x5b')))['then'](function(){})['catch'](_0x989b80()));}}}return _0x515c0c;})[_0x6e70('0x5f')]()[_0x6e70('0x31')](function(){return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x241a21){var _0x56d4d9=[];if(_0x241a21){var _0x58666a;for(var _0x1c7c5f=0x0,_0xf7a034;_0x1c7c5f<_0x241a21[_0x6e70('0x1c')];_0x1c7c5f+=0x1){_0xf7a034=_0x241a21[_0x1c7c5f][_0x6e70('0x56')]({'plain':!![]});_0x56d4d9[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x41a861(_0xf7a034,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}return _0x56d4d9;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':'Lists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x4b2d40){var _0x5b5471=[];if(_0x4b2d40){for(var _0x402f6f=0x0,_0x48e04b;_0x402f6f<_0x4b2d40['length'];_0x402f6f+=0x1){_0x48e04b=_0x4b2d40[_0x402f6f][_0x6e70('0x56')]({'plain':!![]});switch(_0x48e04b[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x5b5471['push'](db['sequelize']['query'](_0x2dafb5(_0x48e04b,_0x6e70('0x61')))['then'](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x48e04b,_0x6e70('0x61')))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));break;default:_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x48e04b,'CampaignId'))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}}return _0x5b5471;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')][_0x6e70('0x52')]({'attributes':['id'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x62'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x48f6fd){var _0x463eed=[];if(_0x48f6fd){for(var _0x39e6db=0x0,_0x53acc8;_0x39e6db<_0x48f6fd[_0x6e70('0x1c')];_0x39e6db+=0x1){_0x53acc8=_0x48f6fd[_0x39e6db][_0x6e70('0x56')]({'plain':!![]});_0x463eed['push'](db['sequelize'][_0x6e70('0x5e')](_0x41a861(_0x53acc8,'CampaignId'))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));}}return _0x463eed;})[_0x6e70('0x5f')]();})[_0x6e70('0x5c')](function(_0x106f32){logger[_0x6e70('0x16')](_0x6e70('0x63'),_0x6e70('0x64'),_0x106f32[_0x6e70('0x34')]);});}var processPromises=function(_0x5afbf5){return BPromise['all'](promises)[_0x6e70('0x31')](function(_0x4bf451){})[_0x6e70('0x5c')](function(_0xa2a4d5){logger[_0x6e70('0x16')](_0x6e70('0x65'),JSON['stringify'](_0xa2a4d5));})[_0x6e70('0x66')](function(){socket['emit'](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5afbf5){return _0x5afbf5[_0x6e70('0x68')]();}});};var endCsv=function(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(hopperContacts){return checkHopper();}})[_0x6e70('0x31')](function(){socket[_0x6e70('0x6a')](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1d6acf){logger['error'](_0x6e70('0x6b'),JSON['stringify'](_0x1d6acf));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x6e70('0x6c')](_0x6e70('0x6d'));endCsv();});function main(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6e70('0x6e')](',');return db['CmContact'][_0x6e70('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6e70('0x31')](function(_0x48c30c){var _0x3c2d33=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6e70('0x6f')](_0x3c2d33,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d0585,_0x4a87e2){total+=0x1;var _0x25f60c=total;promises[_0x6e70('0x59')](checkRow(_0x5d0585,_0x48c30c,_0x25f60c)[_0x6e70('0x31')](function(){success+=0x1;})[_0x6e70('0x5c')](function(_0x3e6661){if(_0x3e6661[_0x6e70('0x16')]){errors+=0x1;delete _0x3e6661[_0x6e70('0x16')];}else if(_0x3e6661['duplicate']){duplicates+=0x1;delete _0x3e6661[_0x6e70('0x2c')];}rows['push'](_0x3e6661);}));if(total%0xc8===0x0){_0x4a87e2[_0x6e70('0x70')]();return processPromises(_0x4a87e2);}},'complete':function(){return processPromises()[_0x6e70('0x31')](function(){logger[_0x6e70('0x6c')](_0x6e70('0x71'));endCsv();});},'error':function(_0x4764d5,_0x41b7de){logger[_0x6e70('0x6c')]('CSV\x20parse\x20error',JSON[_0x6e70('0x35')](_0x4764d5));endCsv();}});})['catch'](function(_0x27bdf2){logger[_0x6e70('0x16')](_0x6e70('0x72'),JSON[_0x6e70('0x35')](_0x27bdf2));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 1819740..3b60182 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 _0x8abb=['bluebird','moment','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','insert','into','cm_hopper_black','fromQuery','fields','\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','error','errors','code','message','info','sequelize','query','spread','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','push','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','UserId','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','lodash','papaparse','util'];(function(_0x799197,_0x667c04){var _0x26444e=function(_0x41089f){while(--_0x41089f){_0x799197['push'](_0x799197['shift']());}};_0x26444e(++_0x667c04);}(_0x8abb,0x195));var _0xb8ab=function(_0x5bd018,_0x489e23){_0x5bd018=_0x5bd018-0x0;var _0x225ff3=_0x8abb[_0x5bd018];return _0x225ff3;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xb8ab('0x0'));var Papa=require(_0xb8ab('0x1'));var util=require(_0xb8ab('0x2'));var BPromise=require(_0xb8ab('0x3'));var moment=require(_0xb8ab('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xb8ab('0x5'));var logger=require(_0xb8ab('0x6'))(_0xb8ab('0x7'));config[_0xb8ab('0x8')]=_[_0xb8ab('0x9')](config[_0xb8ab('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb8ab('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xb8ab('0xb')](_0xb8ab('0xc'));function isEmail(_0x1fbd5e){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'](_0x1fbd5e);}function selectNotIn(_0x5a70f3,_0x5504b8,_0x2cc4ff,_0x103720,_0x1eeb15){return squel[_0xb8ab('0xd')]()[_0xb8ab('0xe')](_0xb8ab('0xf'))[_0xb8ab('0x10')](_0x103720)['join'](_0x5504b8,null,_0x5504b8+_0xb8ab('0x11')+_0x103720+'.'+_0x2cc4ff)[_0xb8ab('0x12')](_0x103720+'.'+_0x2cc4ff+'\x20=\x20'+_0x5a70f3+'.'+_0x2cc4ff)['where'](_0x5504b8+_0xb8ab('0x13')+_0x1eeb15[_0xb8ab('0x14')]()+')');}function insertCmHopper(_0x5ce789,_0x578195,_0xba7205,_0x9d7b51,_0x38dd6b){var _0x5d3bf1=[_0xb8ab('0x15'),'cm_contacts.scheduledat',_0xb8ab('0x16'),_0xb8ab('0x17'),_0x578195+'.'+_0x9d7b51,_0xb8ab('0x18'),_0xb8ab('0x19'),_0xb8ab('0x1a'),_0xb8ab('0x1b'),'\x22'+_0x38dd6b+'\x22'];return squel['insert']()['into'](_0xb8ab('0x1c'))['fromQuery']([_0xb8ab('0xf'),_0xb8ab('0x1d'),_0xb8ab('0x1e'),_0xb8ab('0x1f'),_0x9d7b51,_0xb8ab('0x20'),_0xb8ab('0x21'),_0xb8ab('0x22'),'UserId','recallme'],squel[_0xb8ab('0xd')]()['fields'](_0x5d3bf1)[_0xb8ab('0x10')](_0x578195)[_0xb8ab('0x14')](_0xb8ab('0x23'),null,_0xb8ab('0x24')+_0x578195+_0xb8ab('0x25'))[_0xb8ab('0x14')](_0xba7205,null,_0xba7205+_0xb8ab('0x11')+_0x578195+'.'+_0x9d7b51)['where'](_0x578195+_0xb8ab('0x26'),_0x5ce789)[_0xb8ab('0x12')](_0xb8ab('0x27'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x578195,_0xba7205,_0x9d7b51,'cm_hopper',[_0xb8ab('0x28'),_0xb8ab('0x29')]))[_0xb8ab('0x12')](_0xb8ab('0x2a'),selectNotIn(_0x578195,_0xba7205,_0x9d7b51,_0xb8ab('0x1c'),['\x22always\x22'])))[_0xb8ab('0x2b')]();}function insertCmHopperBlack(_0x52737b,_0x3a9e29,_0x1851df,_0x242449){var _0x13f64c=[_0xb8ab('0x15'),_0xb8ab('0x16'),_0xb8ab('0x17'),_0x3a9e29+'.'+_0x242449,_0xb8ab('0x18'),_0xb8ab('0x19')];return squel[_0xb8ab('0x2c')]()[_0xb8ab('0x2d')](_0xb8ab('0x2e'))[_0xb8ab('0x2f')]([_0xb8ab('0xf'),_0xb8ab('0x1e'),'ListId',_0x242449,_0xb8ab('0x20'),'updatedAt'],squel['select']()[_0xb8ab('0x30')](_0x13f64c)[_0xb8ab('0x10')](_0x3a9e29)['join'](_0xb8ab('0x23'),null,_0xb8ab('0x24')+_0x3a9e29+_0xb8ab('0x25'))[_0xb8ab('0x14')](_0x1851df,null,_0x1851df+_0xb8ab('0x11')+_0x3a9e29+'.'+_0x242449)[_0xb8ab('0x12')](_0x3a9e29+_0xb8ab('0x26'),_0x52737b)[_0xb8ab('0x12')](_0xb8ab('0x27'),NOW)[_0xb8ab('0x12')](_0xb8ab('0x2a'),squel[_0xb8ab('0xd')]()[_0xb8ab('0xe')](_0xb8ab('0xf'))[_0xb8ab('0x10')](_0xb8ab('0x2e'))[_0xb8ab('0x12')]('ListId\x20=\x20?',_0x52737b)[_0xb8ab('0x12')](_0x242449+_0xb8ab('0x31'),_0x3a9e29+'.'+_0x242449)))['toString']();}function insertCmContact(_0x3e8ec9,_0x39dd3b,_0x2a4ef9,_0xd8f502){var _0x3bd9f5=_['concat'](_[_0xb8ab('0x32')](_0xd8f502),['ListId',_0xb8ab('0x33'),'createdAt',_0xb8ab('0x21')]);return squel[_0xb8ab('0x2c')]()[_0xb8ab('0x2d')](_0xb8ab('0x23'))['fromQuery'](_0x3bd9f5,squel[_0xb8ab('0xd')]()[_0xb8ab('0x30')](_0x3bd9f5)[_0xb8ab('0x10')](_0x39dd3b)[_0xb8ab('0x12')]('('+_0x2a4ef9[_0xb8ab('0x14')](',')+_0xb8ab('0x34'),squel[_0xb8ab('0xd')]()[_0xb8ab('0x30')](_0x2a4ef9)[_0xb8ab('0x10')]('cm_contacts')[_0xb8ab('0x12')]('ListId\x20=\x20?',_0x3e8ec9)[_0xb8ab('0x12')](_0xb8ab('0x35')))['where'](_0xb8ab('0x36'),squel[_0xb8ab('0xd')]()['field']('MIN(id)',_0xb8ab('0x37'))['from'](_0x39dd3b)[_0xb8ab('0x38')](_0x2a4ef9[_0xb8ab('0x14')](','))))[_0xb8ab('0x2b')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x18c3d3){logger[_0xb8ab('0x39')](_0x18c3d3['message']);process['exit'](0x1);}function handleError(_0x288977,_0x155c20){stats[_0xb8ab('0x3a')]['push']({'name':_0x155c20[_0xb8ab('0x3b')],'message':_0x155c20[_0xb8ab('0x3c')],'row':_0x288977});}function handleQuery(_0x2f5729){logger[_0xb8ab('0x3d')](_0x2f5729);return db[_0xb8ab('0x3e')][_0xb8ab('0x3f')](_0x2f5729)[_0xb8ab('0x40')](function(_0xabe361){results['push'](_0xabe361);})[_0xb8ab('0x41')](function(_0x58ff33){logger[_0xb8ab('0x39')](_0x58ff33[_0xb8ab('0x3c')]);});}function main(_0xf32136,_0x272de0,_0x5421ef,_0x4ef2ed){logger[_0xb8ab('0x3d')](_0xb8ab('0x42'),_0xf32136,JSON[_0xb8ab('0x43')](_0x272de0));process[_0xb8ab('0x44')](_0xb8ab('0x45'));var _0x3e2a69=_0x272de0[_0xb8ab('0x46')];var _0x483bf6=_0x272de0[_0xb8ab('0x47')];var _0x3742b5=path[_0xb8ab('0x14')](config[_0xb8ab('0x48')],_0xb8ab('0x49'),_0x483bf6+'.csv');var _0xd77a67=_[_0xb8ab('0x32')](_0x3e2a69)[_0xb8ab('0x14')]();logger['info'](_0xb8ab('0x4a'),_0xd77a67);fs[_0xb8ab('0x4b')](_0x3742b5,_0xd77a67+'\x0a');Papa[_0xb8ab('0x4c')](fs[_0xb8ab('0x4d')](_0xf32136),{'header':!![],'skipEmptyLines':!![],'step':function(_0x57089b,_0x514299){try{for(var _0x307f87=0x0,_0x1f6f8f=[];_0x307f87<_0x57089b[_0xb8ab('0x4e')][_0xb8ab('0x4f')];_0x307f87++){stats[_0xb8ab('0x50')]+=0x1;if(_0x57089b[_0xb8ab('0x3a')][_0x307f87]){handleError(_0x57089b[_0xb8ab('0x4e')][_0x307f87],_0x57089b[_0xb8ab('0x3a')][_0x307f87]);}else{var _0x3a12de=[];for(var _0x337c8b in _0x3e2a69){if(_0x3e2a69[_0xb8ab('0x51')](_0x337c8b)){if(_0x57089b[_0xb8ab('0x4e')][_0x307f87][_0x3e2a69[_0x337c8b]]){var _0x5d41cd=_[_0xb8ab('0x52')](_0x57089b[_0xb8ab('0x4e')][_0x307f87][_0x3e2a69[_0x337c8b]][_0xb8ab('0x53')](/"/g,'\x27'));switch(_0x337c8b){case _0xb8ab('0x1d'):var _0x1f0366=moment(_0x5d41cd,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1f0366['isValid']()){_0x1f6f8f[_0xb8ab('0x54')]('\x22'+_0x5d41cd+'\x22');}else{_0x3a12de['push'](_0xb8ab('0x55'));}break;case _0xb8ab('0x22'):var _0x4ea3cd=parseInt(_0x5d41cd);_0x5d41cd=_['isNaN'](_0x4ea3cd)||_0x4ea3cd<0x0||_0x4ea3cd>0x4?_0x4ef2ed?0x3:0x2:_0x4ea3cd;_0x1f6f8f[_0xb8ab('0x54')]('\x22'+_0x5d41cd+'\x22');break;case _0xb8ab('0x56'):var _0x27b230=parseInt(_0x5d41cd);if(_[_0xb8ab('0x57')](_0x27b230)&&_[_0xb8ab('0x58')](_0x5421ef,_0x27b230)){_0x1f6f8f[_0xb8ab('0x54')]('\x22'+_0x27b230+'\x22');}else{_0x3a12de[_0xb8ab('0x54')](_0xb8ab('0x59'));}break;case _0xb8ab('0x5a'):if(isEmail(_0x5d41cd)){_0x1f6f8f[_0xb8ab('0x54')]('\x22'+_0x5d41cd+'\x22');}else{_0x3a12de['push']('email\x20wrong\x20format');}break;case _0xb8ab('0x5b'):var _0x4eaa20=moment(_0x5d41cd,_0xb8ab('0x5c'),!![]);if(_0x4eaa20[_0xb8ab('0x5d')]()){_0x1f6f8f[_0xb8ab('0x54')]('\x22'+_0x5d41cd+'\x22');}else{_0x3a12de[_0xb8ab('0x54')](_0xb8ab('0x5e'));}break;default:_0x1f6f8f['push']('\x22'+_0x5d41cd+'\x22');}}else{switch(_0x337c8b){case'firstName':case _0xb8ab('0xf'):_0x3a12de[_0xb8ab('0x54')](_0x337c8b+_0xb8ab('0x5f'));break;default:_0x1f6f8f[_0xb8ab('0x54')]('\x22\x22');}}}}if(_0x3a12de['length']){handleError(_0x57089b[_0xb8ab('0x4e')][_0x307f87],{'code':_0xb8ab('0x60'),'message':_0x3a12de[_0xb8ab('0x14')]()});}else{fs[_0xb8ab('0x61')](_0x3742b5,_0x1f6f8f[_0xb8ab('0x14')]()+'\x0a');}_0x1f6f8f=[];}if(!(stats[_0xb8ab('0x50')]%0xc8)){socket[_0xb8ab('0x62')](_0xb8ab('0x63')+_0x483bf6,stats);stats[_0xb8ab('0x3a')]=[];}}if(stopped){logger[_0xb8ab('0x3d')](_0xb8ab('0x64'));_0x514299[_0xb8ab('0x65')]();}}catch(_0x3f0bd7){handleError(_0x57089b[_0xb8ab('0x4e')][_0x307f87],{'code':_0xb8ab('0x66'),'message':_0x3f0bd7['message']});logger[_0xb8ab('0x39')](_0xb8ab('0x67'),_0x3f0bd7[_0xb8ab('0x3c')]);}},'complete':function(){try{var _0x467400=[];var _0x25b697=_0xb8ab('0x23');if(_0x272de0[_0xb8ab('0x68')]&&_0x272de0[_0xb8ab('0x68')][_0xb8ab('0x4f')]){_0x25b697=_0xb8ab('0x69')+_0x483bf6;_0x467400[_0xb8ab('0x54')](_0xb8ab('0x6a')+_0x25b697+_0xb8ab('0x6b'));}var _0x5660c6=util[_0xb8ab('0xb')](_0xb8ab('0x6c'),_0x3742b5,_0x25b697,_0xd77a67,_0x272de0[_0xb8ab('0x1f')],_0x272de0[_0xb8ab('0x33')]||null,NOW,NOW);if(_[_0xb8ab('0x6d')](_0x3e2a69[_0xb8ab('0x1d')])){_0x5660c6+=_0xb8ab('0x6e');}_0x467400[_0xb8ab('0x54')](_0x5660c6);if(_0x272de0[_0xb8ab('0x68')]&&_0x272de0[_0xb8ab('0x68')][_0xb8ab('0x4f')]){_0x467400[_0xb8ab('0x54')](insertCmContact(_0x272de0[_0xb8ab('0x1f')],_0x25b697,_0x272de0[_0xb8ab('0x68')],_0x3e2a69));_0x467400[_0xb8ab('0x54')](_0xb8ab('0x6f')+_0x25b697+';');}_0x467400[_0xb8ab('0x54')](insertCmHopper(_0x272de0['ListId'],_0xb8ab('0x70'),'voice_queues',_0xb8ab('0x71'),_0x4ef2ed));_0x467400[_0xb8ab('0x54')](insertCmHopperBlack(_0x272de0[_0xb8ab('0x1f')],_0xb8ab('0x72'),_0xb8ab('0x73'),'VoiceQueueId'));_0x467400['push'](insertCmHopper(_0x272de0[_0xb8ab('0x1f')],_0xb8ab('0x74'),_0xb8ab('0x75'),_0xb8ab('0x76'),_0x4ef2ed));_0x467400[_0xb8ab('0x54')](insertCmHopperBlack(_0x272de0[_0xb8ab('0x1f')],_0xb8ab('0x77'),_0xb8ab('0x75'),_0xb8ab('0x76')));BPromise[_0xb8ab('0x78')](_0x467400,handleQuery)[_0xb8ab('0x79')](function(_0x40ba34){stats['finish']=!![];stats['affectedRows']=_0x272de0[_0xb8ab('0x68')]&&_0x272de0['duplicates'][_0xb8ab('0x4f')]?results[0x2][_0xb8ab('0x7a')]:results[0x0][_0xb8ab('0x7a')];socket[_0xb8ab('0x62')]('contact:import:'+_0x483bf6,stats);fs[_0xb8ab('0x7b')](_0xf32136);fs['unlink'](_0x3742b5);process[_0xb8ab('0x7c')](0x0);})[_0xb8ab('0x41')](function(_0x291f7c){logger['error'](_0x291f7c[_0xb8ab('0x3c')]);process[_0xb8ab('0x7c')](0x1);});}catch(_0x4f2484){logger['error'](_0xb8ab('0x7d'),_0x4f2484[_0xb8ab('0x3c')]);process[_0xb8ab('0x7c')](0x1);}},'error':function(_0x51f411,_0x14f0b1,_0x19f654,_0x3903af){throw new Error(_0x3903af);}});}function validate(){if(process[_0xb8ab('0x7e')]&&process[_0xb8ab('0x7e')][_0xb8ab('0x4f')]<0x4){throw new Error(_0xb8ab('0x7f'));}var _0x282c6b=path[_0xb8ab('0x14')](config[_0xb8ab('0x48')],_0xb8ab('0x49'),process['argv'][0x2]);if(!fs['existsSync'](_0x282c6b)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x59902a={};try{_0x59902a=JSON[_0xb8ab('0x4c')](process[_0xb8ab('0x7e')][0x3]);if(!_0x59902a['binding']){throw new Error(_0xb8ab('0x80'));}if(!_0x59902a[_0xb8ab('0x46')][_0xb8ab('0xf')]){throw new Error(_0xb8ab('0x81'));}if(!_0x59902a[_0xb8ab('0x46')]['firstName']){throw new Error(_0xb8ab('0x82'));}var _0x5b8446=0x0;if(_0x59902a['binding'][_0xb8ab('0x56')]){_0x5b8446=0x1;}if(!_0x59902a['ListId']){throw new Error(_0xb8ab('0x83'));}}catch(_0x34d9ea){throw new Error(_0xb8ab('0x84'));}var _0x56a38a=[];try{_0x56a38a=_[_0xb8ab('0x85')](JSON['parse'](process[_0xb8ab('0x7e')][0x4]),'id');}catch(_0x257d6f){logger[_0xb8ab('0x3d')](_0xb8ab('0x86'));}main(_0x282c6b,_0x59902a,_0x56a38a,_0x5b8446);}validate();process['on'](_0xb8ab('0x87'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xca65=['unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','phone','ListId','updatedAt','UserId','recallme','select','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.phone','cm_contacts.createdAt','into','ContactId','createdAt','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','concat','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','errors','push','code','message','query','spread','catch','main','stringify','send','socket_timestamp','.csv','keys','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','emit','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','each','then','affectedRows'];(function(_0x58cbc5,_0x3cb48d){var _0x302163=function(_0x341690){while(--_0x341690){_0x58cbc5['push'](_0x58cbc5['shift']());}};_0x302163(++_0x3cb48d);}(_0xca65,0x9b));var _0x5ca6=function(_0x1a3c8c,_0x45564d){_0x1a3c8c=_0x1a3c8c-0x0;var _0xbabdb9=_0xca65[_0x1a3c8c];return _0xbabdb9;};'use strict';var fs=require('fs');var path=require(_0x5ca6('0x0'));var _=require(_0x5ca6('0x1'));var Papa=require(_0x5ca6('0x2'));var util=require(_0x5ca6('0x3'));var BPromise=require('bluebird');var moment=require(_0x5ca6('0x4'));var squel=require('squel');var Redis=require(_0x5ca6('0x5'));var db=require(_0x5ca6('0x6'))['db'];var config=require(_0x5ca6('0x7'));var logger=require('../../../config/logger')(_0x5ca6('0x8'));config[_0x5ca6('0x9')]=_[_0x5ca6('0xa')](config[_0x5ca6('0x9')],{'host':_0x5ca6('0xb'),'port':0x18eb});var socket=require(_0x5ca6('0xc'))(new Redis(config[_0x5ca6('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x5ca6('0xd')](_0x5ca6('0xe'));function isEmail(_0x5be1da){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'](_0x5be1da);}function selectNotIn(_0x2f984d,_0x586ae4,_0x475fe8,_0x13a0fe,_0x2583d9){return squel['select']()[_0x5ca6('0xf')]('phone')[_0x5ca6('0x10')](_0x13a0fe)['join'](_0x586ae4,null,_0x586ae4+_0x5ca6('0x11')+_0x13a0fe+'.'+_0x475fe8)[_0x5ca6('0x12')](_0x13a0fe+'.'+_0x475fe8+_0x5ca6('0x13')+_0x2f984d+'.'+_0x475fe8)['where'](_0x586ae4+_0x5ca6('0x14')+_0x2583d9[_0x5ca6('0x15')]()+')');}function insertCmHopper(_0x18a6b1,_0x531fca,_0x4f53df,_0x304457,_0x5bff79){var _0x12b935=['cm_contacts.phone',_0x5ca6('0x16'),_0x5ca6('0x17'),_0x5ca6('0x18'),_0x531fca+'.'+_0x304457,'cm_contacts.createdAt',_0x5ca6('0x19'),_0x5ca6('0x1a'),_0x5ca6('0x1b'),'\x22'+_0x5bff79+'\x22'];return squel[_0x5ca6('0x1c')]()['into'](_0x5ca6('0x1d'))[_0x5ca6('0x1e')]([_0x5ca6('0x1f'),'scheduledat','ContactId',_0x5ca6('0x20'),_0x304457,'createdAt',_0x5ca6('0x21'),'priority',_0x5ca6('0x22'),_0x5ca6('0x23')],squel[_0x5ca6('0x24')]()['fields'](_0x12b935)[_0x5ca6('0x10')](_0x531fca)[_0x5ca6('0x15')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x531fca+'.CmListId')[_0x5ca6('0x15')](_0x4f53df,null,_0x4f53df+'.id\x20=\x20'+_0x531fca+'.'+_0x304457)[_0x5ca6('0x12')](_0x531fca+'.CmListId\x20=\x20?',_0x18a6b1)[_0x5ca6('0x12')](_0x5ca6('0x25'),NOW)[_0x5ca6('0x12')](_0x5ca6('0x26'),selectNotIn(_0x531fca,_0x4f53df,_0x304457,'cm_hopper',['\x22always\x22',_0x5ca6('0x27')]))['where'](_0x5ca6('0x26'),selectNotIn(_0x531fca,_0x4f53df,_0x304457,_0x5ca6('0x1d'),[_0x5ca6('0x28')])))[_0x5ca6('0x29')]();}function insertCmHopperBlack(_0x2bd603,_0x2beee5,_0x590682,_0x387940){var _0x29886f=[_0x5ca6('0x2a'),_0x5ca6('0x17'),_0x5ca6('0x18'),_0x2beee5+'.'+_0x387940,_0x5ca6('0x2b'),_0x5ca6('0x19')];return squel[_0x5ca6('0x1c')]()[_0x5ca6('0x2c')]('cm_hopper_black')[_0x5ca6('0x1e')]([_0x5ca6('0x1f'),_0x5ca6('0x2d'),'ListId',_0x387940,_0x5ca6('0x2e'),_0x5ca6('0x21')],squel[_0x5ca6('0x24')]()[_0x5ca6('0x2f')](_0x29886f)[_0x5ca6('0x10')](_0x2beee5)[_0x5ca6('0x15')](_0x5ca6('0x30'),null,_0x5ca6('0x31')+_0x2beee5+_0x5ca6('0x32'))[_0x5ca6('0x15')](_0x590682,null,_0x590682+_0x5ca6('0x11')+_0x2beee5+'.'+_0x387940)['where'](_0x2beee5+_0x5ca6('0x33'),_0x2bd603)[_0x5ca6('0x12')](_0x5ca6('0x25'),NOW)[_0x5ca6('0x12')](_0x5ca6('0x26'),squel['select']()['field']('phone')['from'](_0x5ca6('0x34'))[_0x5ca6('0x12')](_0x5ca6('0x35'),_0x2bd603)[_0x5ca6('0x12')](_0x387940+'\x20=\x20?',_0x2beee5+'.'+_0x387940)))[_0x5ca6('0x29')]();}function insertCmContact(_0x4135a1,_0x2697ad,_0x139ef1,_0x45b2b0){var _0x2b8e8a=_[_0x5ca6('0x36')](_['keys'](_0x45b2b0),[_0x5ca6('0x20'),'CompanyId',_0x5ca6('0x2e'),'updatedAt']);return squel['insert']()[_0x5ca6('0x2c')](_0x5ca6('0x30'))['fromQuery'](_0x2b8e8a,squel['select']()[_0x5ca6('0x2f')](_0x2b8e8a)[_0x5ca6('0x10')](_0x2697ad)[_0x5ca6('0x12')]('('+_0x139ef1['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x5ca6('0x24')]()[_0x5ca6('0x2f')](_0x139ef1)[_0x5ca6('0x10')](_0x5ca6('0x30'))[_0x5ca6('0x12')]('ListId\x20=\x20?',_0x4135a1)[_0x5ca6('0x12')](_0x5ca6('0x37')))['where'](_0x5ca6('0x38'),squel['select']()['field'](_0x5ca6('0x39'),_0x5ca6('0x3a'))[_0x5ca6('0x10')](_0x2697ad)[_0x5ca6('0x3b')](_0x139ef1['join'](','))))[_0x5ca6('0x29')]();}function handleStop(){logger[_0x5ca6('0x3c')](_0x5ca6('0x3d'));stopped=!![];}function handleUncaughtException(_0x287661){logger[_0x5ca6('0x3e')](_0x287661['message']);process[_0x5ca6('0x3f')](0x1);}function handleError(_0x5df77b,_0x2acf4b){stats[_0x5ca6('0x40')][_0x5ca6('0x41')]({'name':_0x2acf4b[_0x5ca6('0x42')],'message':_0x2acf4b[_0x5ca6('0x43')],'row':_0x5df77b});}function handleQuery(_0x164b58){logger[_0x5ca6('0x3c')](_0x164b58);return db['sequelize'][_0x5ca6('0x44')](_0x164b58)[_0x5ca6('0x45')](function(_0x278e00){results[_0x5ca6('0x41')](_0x278e00);})[_0x5ca6('0x46')](function(_0x5753b5){logger['error'](_0x5753b5[_0x5ca6('0x43')]);});}function main(_0xe6ca41,_0x5efbe4,_0x27abcf,_0x2b85d1){logger[_0x5ca6('0x3c')](_0x5ca6('0x47'),_0xe6ca41,JSON[_0x5ca6('0x48')](_0x5efbe4));process[_0x5ca6('0x49')]('start');var _0x29dcf2=_0x5efbe4['binding'];var _0x2277a7=_0x5efbe4[_0x5ca6('0x4a')];var _0x2138ff=path['join'](config['root'],'server/files/tmp',_0x2277a7+_0x5ca6('0x4b'));var _0x1e293f=_[_0x5ca6('0x4c')](_0x29dcf2)[_0x5ca6('0x15')]();logger[_0x5ca6('0x3c')]('header',_0x1e293f);fs[_0x5ca6('0x4d')](_0x2138ff,_0x1e293f+'\x0a');Papa[_0x5ca6('0x4e')](fs[_0x5ca6('0x4f')](_0xe6ca41),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4b99cf,_0x4542d9){try{for(var _0x3e1a93=0x0,_0x1765b2=[];_0x3e1a93<_0x4b99cf[_0x5ca6('0x50')][_0x5ca6('0x51')];_0x3e1a93++){stats[_0x5ca6('0x52')]+=0x1;if(_0x4b99cf['errors'][_0x3e1a93]){handleError(_0x4b99cf[_0x5ca6('0x50')][_0x3e1a93],_0x4b99cf[_0x5ca6('0x40')][_0x3e1a93]);}else{var _0x4b1d94=[];for(var _0xba7703 in _0x29dcf2){if(_0x29dcf2[_0x5ca6('0x53')](_0xba7703)){if(_0x4b99cf[_0x5ca6('0x50')][_0x3e1a93][_0x29dcf2[_0xba7703]]){var _0x5e8b9c=_[_0x5ca6('0x54')](_0x4b99cf[_0x5ca6('0x50')][_0x3e1a93][_0x29dcf2[_0xba7703]][_0x5ca6('0x55')](/"/g,'\x27'));switch(_0xba7703){case _0x5ca6('0x56'):var _0x33aadc=moment(_0x5e8b9c,_0x5ca6('0xe'),!![]);if(_0x33aadc[_0x5ca6('0x57')]()){_0x1765b2[_0x5ca6('0x41')]('\x22'+_0x5e8b9c+'\x22');}else{_0x4b1d94[_0x5ca6('0x41')](_0x5ca6('0x58'));}break;case _0x5ca6('0x59'):var _0x53f5e7=parseInt(_0x5e8b9c);_0x5e8b9c=_[_0x5ca6('0x5a')](_0x53f5e7)||_0x53f5e7<0x0||_0x53f5e7>0x4?_0x2b85d1?0x3:0x2:_0x53f5e7;_0x1765b2[_0x5ca6('0x41')]('\x22'+_0x5e8b9c+'\x22');break;case _0x5ca6('0x22'):var _0xa83165=parseInt(_0x5e8b9c);if(_[_0x5ca6('0x5b')](_0xa83165)&&_[_0x5ca6('0x5c')](_0x27abcf,_0xa83165)){_0x1765b2[_0x5ca6('0x41')]('\x22'+_0xa83165+'\x22');}else{_0x4b1d94[_0x5ca6('0x41')](_0x5ca6('0x5d'));}break;case'email':if(isEmail(_0x5e8b9c)){_0x1765b2[_0x5ca6('0x41')]('\x22'+_0x5e8b9c+'\x22');}else{_0x4b1d94[_0x5ca6('0x41')](_0x5ca6('0x5e'));}break;case _0x5ca6('0x5f'):var _0x11fb29=moment(_0x5e8b9c,_0x5ca6('0x60'),!![]);if(_0x11fb29[_0x5ca6('0x57')]()){_0x1765b2[_0x5ca6('0x41')]('\x22'+_0x5e8b9c+'\x22');}else{_0x4b1d94['push'](_0x5ca6('0x61'));}break;default:_0x1765b2[_0x5ca6('0x41')]('\x22'+_0x5e8b9c+'\x22');}}else{switch(_0xba7703){case _0x5ca6('0x62'):case'phone':_0x4b1d94[_0x5ca6('0x41')](_0xba7703+_0x5ca6('0x63'));break;default:_0x1765b2['push']('\x22\x22');}}}}if(_0x4b1d94[_0x5ca6('0x51')]){handleError(_0x4b99cf['data'][_0x3e1a93],{'code':_0x5ca6('0x64'),'message':_0x4b1d94[_0x5ca6('0x15')]()});}else{fs['appendFileSync'](_0x2138ff,_0x1765b2[_0x5ca6('0x15')]()+'\x0a');}_0x1765b2=[];}if(!(stats['rows']%0xc8)){socket[_0x5ca6('0x65')](_0x5ca6('0x66')+_0x2277a7,stats);stats[_0x5ca6('0x40')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x4542d9[_0x5ca6('0x67')]();}}catch(_0x124b51){handleError(_0x4b99cf[_0x5ca6('0x50')][_0x3e1a93],{'code':_0x5ca6('0x68'),'message':_0x124b51['message']});logger[_0x5ca6('0x3e')](_0x5ca6('0x69'),_0x124b51['message']);}},'complete':function(){try{var _0x37ae69=[];var _0x8e98d0=_0x5ca6('0x30');if(_0x5efbe4[_0x5ca6('0x6a')]&&_0x5efbe4[_0x5ca6('0x6a')]['length']){_0x8e98d0=_0x5ca6('0x6b')+_0x2277a7;_0x37ae69[_0x5ca6('0x41')](_0x5ca6('0x6c')+_0x8e98d0+_0x5ca6('0x6d'));}var _0x1c0086=util[_0x5ca6('0xd')](_0x5ca6('0x6e'),_0x2138ff,_0x8e98d0,_0x1e293f,_0x5efbe4[_0x5ca6('0x20')],_0x5efbe4[_0x5ca6('0x6f')]||null,NOW,NOW);if(_[_0x5ca6('0x70')](_0x29dcf2[_0x5ca6('0x56')])){_0x1c0086+=_0x5ca6('0x71');}_0x37ae69[_0x5ca6('0x41')](_0x1c0086);if(_0x5efbe4[_0x5ca6('0x6a')]&&_0x5efbe4[_0x5ca6('0x6a')][_0x5ca6('0x51')]){_0x37ae69['push'](insertCmContact(_0x5efbe4[_0x5ca6('0x20')],_0x8e98d0,_0x5efbe4[_0x5ca6('0x6a')],_0x29dcf2));_0x37ae69[_0x5ca6('0x41')](_0x5ca6('0x72')+_0x8e98d0+';');}_0x37ae69[_0x5ca6('0x41')](insertCmHopper(_0x5efbe4['ListId'],_0x5ca6('0x73'),'voice_queues',_0x5ca6('0x74'),_0x2b85d1));_0x37ae69['push'](insertCmHopperBlack(_0x5efbe4[_0x5ca6('0x20')],'voice_queues_has_cm_blacklists','voice_queues',_0x5ca6('0x74')));_0x37ae69['push'](insertCmHopper(_0x5efbe4[_0x5ca6('0x20')],_0x5ca6('0x75'),_0x5ca6('0x76'),'CampaignId',_0x2b85d1));_0x37ae69[_0x5ca6('0x41')](insertCmHopperBlack(_0x5efbe4[_0x5ca6('0x20')],'campaigns_has_cm_blacklists',_0x5ca6('0x76'),_0x5ca6('0x77')));BPromise[_0x5ca6('0x78')](_0x37ae69,handleQuery)[_0x5ca6('0x79')](function(_0x1a8f39){stats['finish']=!![];stats[_0x5ca6('0x7a')]=_0x5efbe4[_0x5ca6('0x6a')]&&_0x5efbe4[_0x5ca6('0x6a')][_0x5ca6('0x51')]?results[0x2][_0x5ca6('0x7a')]:results[0x0][_0x5ca6('0x7a')];socket[_0x5ca6('0x65')]('contact:import:'+_0x2277a7,stats);fs[_0x5ca6('0x7b')](_0xe6ca41);fs[_0x5ca6('0x7b')](_0x2138ff);process[_0x5ca6('0x3f')](0x0);})['catch'](function(_0x4f5cdc){logger['error'](_0x4f5cdc['message']);process[_0x5ca6('0x3f')](0x1);});}catch(_0x175472){logger[_0x5ca6('0x3e')](_0x5ca6('0x7c'),_0x175472['message']);process[_0x5ca6('0x3f')](0x1);}},'error':function(_0x2a7835,_0xe0ee31,_0x21bf44,_0x11665c){throw new Error(_0x11665c);}});}function validate(){if(process['argv']&&process[_0x5ca6('0x7d')][_0x5ca6('0x51')]<0x4){throw new Error(_0x5ca6('0x7e'));}var _0x559dd6=path['join'](config[_0x5ca6('0x7f')],'server/files/tmp',process[_0x5ca6('0x7d')][0x2]);if(!fs[_0x5ca6('0x80')](_0x559dd6)){throw new Error(_0x5ca6('0x81'));}var _0x21cadf={};try{_0x21cadf=JSON[_0x5ca6('0x4e')](process[_0x5ca6('0x7d')][0x3]);if(!_0x21cadf['binding']){throw new Error(_0x5ca6('0x82'));}if(!_0x21cadf[_0x5ca6('0x83')][_0x5ca6('0x1f')]){throw new Error(_0x5ca6('0x84'));}if(!_0x21cadf[_0x5ca6('0x83')]['firstName']){throw new Error(_0x5ca6('0x85'));}var _0x23aeea=0x0;if(_0x21cadf[_0x5ca6('0x83')][_0x5ca6('0x22')]){_0x23aeea=0x1;}if(!_0x21cadf[_0x5ca6('0x20')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x5ed202){throw new Error(_0x5ca6('0x86'));}var _0x1e89b1=[];try{_0x1e89b1=_[_0x5ca6('0x87')](JSON[_0x5ca6('0x4e')](process['argv'][0x4]),'id');}catch(_0x4162b0){logger[_0x5ca6('0x3c')](_0x5ca6('0x88'));}main(_0x559dd6,_0x21cadf,_0x1e89b1,_0x23aeea);}validate();process['on'](_0x5ca6('0x89'),handleStop);process['on'](_0x5ca6('0x8a'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 35ea1cc..a26b337 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfff0=['agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','destcalleridnum','Member\x20Name','membername','uniqueid','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','variable','outbound','string','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','UniqueId','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xfff0,0x139));var _0x0fff=function(_0x95a588,_0x3c4938){_0x95a588=_0x95a588-0x0;var _0x304d9e=_0xfff0[_0x95a588];return _0x304d9e;};'use strict';exports['getSubjects']=function(_0x960312,_0x2b95e0){var _0x148db8=[{'type':'string','content':_0x0fff('0x0'),'variableName':null}];switch(_0x960312[_0x0fff('0x1')]()){case _0x0fff('0x2'):switch(_0x2b95e0['toLowerCase']()){case _0x0fff('0x3'):_0x148db8[_0x0fff('0x4')]({'type':'variable','content':'','variableName':_0x0fff('0x5')});_0x148db8[_0x0fff('0x4')]({'type':_0x0fff('0x6'),'content':'','variableName':'calleridnum'});break;case _0x0fff('0x7'):_0x148db8['push']({'type':_0x0fff('0x8'),'content':'Outbound\x20Call','variableName':null});_0x148db8[_0x0fff('0x4')]({'type':_0x0fff('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x148db8;};exports[_0x0fff('0x9')]=function(_0x377b2f,_0x1de923){var _0x289e01=[];switch(_0x377b2f[_0x0fff('0x1')]()){case _0x0fff('0x2'):switch(_0x1de923[_0x0fff('0x1')]()){case _0x0fff('0x3'):_0x289e01=[{'type':_0x0fff('0x8'),'content':_0x0fff('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':'Caller\x20Number','keyType':_0x0fff('0x6'),'variableName':'calleridnum'},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0xc'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0xd')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x0fff('0x6'),'variableName':'destexten'},{'type':'keyValue','content':'','key':'Queue','keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x5')},{'type':'keyValue','content':'','key':_0x0fff('0xe'),'keyType':_0x0fff('0x6'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':_0x0fff('0x6'),'variableName':_0x0fff('0xf')},{'type':_0x0fff('0x8'),'content':_0x0fff('0x10'),'key':null,'keyType':null,'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x11'),'keyType':'variable','variableName':_0x0fff('0x12')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x13'),'keyType':'variable','variableName':'destcalleridnum'},{'type':_0x0fff('0x8'),'content':_0x0fff('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x15'),'keyType':'variable','variableName':_0x0fff('0xf')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x16'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x17')},{'type':_0x0fff('0xb'),'content':'','key':'Agent\x20Complete','keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x18')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x19'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x1a')},{'type':'keyValue','content':'','key':_0x0fff('0x1b'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x1c')}];break;case _0x0fff('0x7'):_0x289e01=[{'type':_0x0fff('0x8'),'content':_0x0fff('0xa'),'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x1d'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x1e')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x1f'),'keyType':'variable','keyContent':'','variableName':_0x0fff('0x20')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0xe'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x21')},{'type':_0x0fff('0xb'),'content':'','key':'Date','keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x22')},{'type':_0x0fff('0x8'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x23'),'keyType':'variable','keyContent':'','variableName':_0x0fff('0x24')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x25'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x26')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x27'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x28')},{'type':_0x0fff('0xb'),'content':'','key':'Billable\x20Time','keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x29')}];break;}}return _0x289e01;}; \ No newline at end of file +var _0xb78e=['Caller\x20Name','Call\x20To','Queue','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','membername','UniqueId','uniqueid','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','variable','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb78e,0x1c9));var _0xeb78=function(_0x304c84,_0x5232e8){_0x304c84=_0x304c84-0x0;var _0x86dc85=_0xb78e[_0x304c84];return _0x86dc85;};'use strict';exports[_0xeb78('0x0')]=function(_0x261300,_0x4b8534){var _0x1570f5=[{'type':_0xeb78('0x1'),'content':_0xeb78('0x2'),'variableName':null}];switch(_0x261300[_0xeb78('0x3')]()){case _0xeb78('0x4'):switch(_0x4b8534[_0xeb78('0x3')]()){case _0xeb78('0x5'):_0x1570f5[_0xeb78('0x6')]({'type':'variable','content':'','variableName':_0xeb78('0x7')});_0x1570f5[_0xeb78('0x6')]({'type':_0xeb78('0x8'),'content':'','variableName':_0xeb78('0x9')});break;case _0xeb78('0xa'):_0x1570f5[_0xeb78('0x6')]({'type':_0xeb78('0x1'),'content':'Outbound\x20Call','variableName':null});_0x1570f5[_0xeb78('0x6')]({'type':_0xeb78('0x8'),'content':'','variableName':_0xeb78('0xb')});break;}}return _0x1570f5;};exports[_0xeb78('0xc')]=function(_0x125e97,_0x402680){var _0x15137b=[];switch(_0x125e97[_0xeb78('0x3')]()){case _0xeb78('0x4'):switch(_0x402680['toLowerCase']()){case _0xeb78('0x5'):_0x15137b=[{'type':_0xeb78('0x1'),'content':_0xeb78('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0xf'),'keyType':_0xeb78('0x8'),'variableName':_0xeb78('0x9')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x10'),'keyType':_0xeb78('0x8'),'variableName':'calleridname'},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x11'),'keyType':'variable','variableName':'destexten'},{'type':'keyValue','content':'','key':_0xeb78('0x12'),'keyType':'variable','variableName':_0xeb78('0x7')},{'type':_0xeb78('0xe'),'content':'','key':'UniqueId','keyType':_0xeb78('0x8'),'variableName':'uniqueid'},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x13'),'keyType':'variable','variableName':_0xeb78('0x14')},{'type':_0xeb78('0x1'),'content':_0xeb78('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xeb78('0x16'),'keyType':_0xeb78('0x8'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0xeb78('0x17'),'keyType':_0xeb78('0x8'),'variableName':_0xeb78('0xb')},{'type':_0xeb78('0x1'),'content':_0xeb78('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x19'),'keyType':_0xeb78('0x8'),'variableName':_0xeb78('0x14')},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':'variable','variableName':'agentconnectAt'},{'type':_0xeb78('0xe'),'content':'','key':'Agent\x20Complete','keyType':_0xeb78('0x8'),'variableName':_0xeb78('0x1a')},{'type':'keyValue','content':'','key':_0xeb78('0x1b'),'keyType':'variable','variableName':_0xeb78('0x1c')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x1d'),'keyType':_0xeb78('0x8'),'variableName':'talktime'}];break;case _0xeb78('0xa'):_0x15137b=[{'type':'string','content':_0xeb78('0xd'),'variableName':null},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x1e'),'keyType':'variable','keyContent':'','variableName':_0xeb78('0xb')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x1f'),'keyType':_0xeb78('0x8'),'keyContent':'','variableName':_0xeb78('0x20')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x21'),'keyType':_0xeb78('0x8'),'keyContent':'','variableName':_0xeb78('0x22')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x13'),'keyType':'variable','keyContent':'','variableName':'starttime'},{'type':'string','content':_0xeb78('0x18')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x23'),'keyType':'variable','keyContent':'','variableName':_0xeb78('0x24')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x25'),'keyType':_0xeb78('0x8'),'keyContent':'','variableName':_0xeb78('0x26')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x27'),'keyType':_0xeb78('0x8'),'keyContent':'','variableName':_0xeb78('0x28')},{'type':'keyValue','content':'','key':_0xeb78('0x29'),'keyType':'variable','keyContent':'','variableName':_0xeb78('0x2a')}];break;}}return _0x15137b;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index a5f9404..a2d0686 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3a7=['query','clone','body','omit','html','phone','fax','mobile','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','then','update','info','catch','tracked'];(function(_0x302d1a,_0x387081){var _0xd82ca=function(_0x24912b){while(--_0x24912b){_0x302d1a['push'](_0x302d1a['shift']());}};_0xd82ca(++_0x387081);}(_0xf3a7,0x99));var _0x7f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var db=require(_0x7f3a('0x0'))['db'];var loggers={'openchannel':require(_0x7f3a('0x1'))(_0x7f3a('0x2')),'mail':require(_0x7f3a('0x1'))(_0x7f3a('0x3')),'fax':require(_0x7f3a('0x1'))(_0x7f3a('0x4')),'sms':require(_0x7f3a('0x1'))(_0x7f3a('0x5')),'chat':require(_0x7f3a('0x1'))('chat-interactions'),'whatsapp':require(_0x7f3a('0x1'))(_0x7f3a('0x6'))};function getInteractionId(_0x2a7d66,_0x2c6b8b,_0x1dd804){if(_0x2a7d66&&_0x2a7d66[_[_0x7f3a('0x7')](_0x1dd804)+_0x7f3a('0x8')]){return _0x2a7d66[_['upperFirst'](_0x1dd804)+_0x7f3a('0x8')];}else if(_0x2a7d66&&_0x2a7d66['id']){return _0x2a7d66['id'];}else if(_0x2c6b8b&&_0x2c6b8b['id']){return _0x2c6b8b['id'];}else{return _0x7f3a('0x9');}}function log(_0x59a5dc,_0x5abe24,_0x265fb7,_0x2c9726,_0x5e8521,_0xe9c398){loggers[_0x5e8521['toLowerCase']()][_0x59a5dc](_0x7f3a('0xa'),_0xe9c398['toUpperCase'](),_0x5abe24?_0x5abe24['id']:null,_0x5abe24?_0x5abe24[_0x7f3a('0xb')]:null,_0x5abe24?_0x5abe24[_0x7f3a('0xc')]:null,getInteractionId(_0x265fb7,_0x2c9726,_0x5e8521),_0x265fb7?JSON[_0x7f3a('0xd')](_0x265fb7):_0x7f3a('0xe'));}function updateUser(_0x46b8e3,_0x1ac26c,_0x3edf35,_0x14c307,_0x42b28f){db[_['upperFirst'](_0x14c307)+_0x7f3a('0xf')]['findOne']({'where':{'id':getInteractionId(_0x1ac26c,_0x3edf35,_0x14c307)}})[_0x7f3a('0x10')](function(_0x238e50){if(_0x238e50){return _0x238e50[_0x7f3a('0x11')]({'UserId':_0x46b8e3?_0x46b8e3['id']:null});}})[_0x7f3a('0x10')](function(_0x22112c){if(_0x22112c){log(_0x7f3a('0x12'),_0x46b8e3,_0x1ac26c,_0x3edf35,_0x14c307,_0x42b28f);}})[_0x7f3a('0x13')](function(){log('error',_0x46b8e3,_0x1ac26c,_0x3edf35,_0x14c307,_0x42b28f);});}exports[_0x7f3a('0x14')]=function(_0x1a9dab,_0x512762){return function(_0x2eefb1,_0x2f46fb,_0x235e64){var _0xe5faef=_0x2eefb1['user'];var _0x5a678d={};var _0x2d2164=_0x2eefb1[_0x7f3a('0x15')];if(_0x5a678d){_0x5a678d=_[_0x7f3a('0x16')](_0x2eefb1[_0x7f3a('0x17')]);_0x5a678d=_[_0x7f3a('0x18')](_0x5a678d,['body',_0x7f3a('0x19'),_0x7f3a('0x1a'),_0x7f3a('0x1b'),_0x7f3a('0x1c')]);}updateUser(_0xe5faef,_0x5a678d,_0x2d2164,_0x1a9dab,_0x512762);_0x235e64(null);};}; \ No newline at end of file +var _0xf4d9=['lodash','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','whatsapp-interactions','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','info','catch','error','tracked','user','query','clone','body','omit','html','phone','fax','mobile'];(function(_0x652b90,_0x52865b){var _0x523368=function(_0x36e0a3){while(--_0x36e0a3){_0x652b90['push'](_0x652b90['shift']());}};_0x523368(++_0x52865b);}(_0xf4d9,0x7c));var _0x9f4d=function(_0x12168d,_0x684681){_0x12168d=_0x12168d-0x0;var _0x5ec578=_0xf4d9[_0x12168d];return _0x5ec578;};'use strict';var _=require(_0x9f4d('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x9f4d('0x1'))(_0x9f4d('0x2')),'mail':require(_0x9f4d('0x1'))(_0x9f4d('0x3')),'fax':require(_0x9f4d('0x1'))('fax-interactions'),'sms':require(_0x9f4d('0x1'))(_0x9f4d('0x4')),'chat':require(_0x9f4d('0x1'))('chat-interactions'),'whatsapp':require(_0x9f4d('0x1'))(_0x9f4d('0x5'))};function getInteractionId(_0x2d7228,_0x4ee67d,_0x415499){if(_0x2d7228&&_0x2d7228[_['upperFirst'](_0x415499)+_0x9f4d('0x6')]){return _0x2d7228[_['upperFirst'](_0x415499)+_0x9f4d('0x6')];}else if(_0x2d7228&&_0x2d7228['id']){return _0x2d7228['id'];}else if(_0x4ee67d&&_0x4ee67d['id']){return _0x4ee67d['id'];}else{return _0x9f4d('0x7');}}function log(_0x40ddba,_0x4311f4,_0x5e33b7,_0x3f4851,_0x5ec1f0,_0x474cc6){loggers[_0x5ec1f0[_0x9f4d('0x8')]()][_0x40ddba](_0x9f4d('0x9'),_0x474cc6[_0x9f4d('0xa')](),_0x4311f4?_0x4311f4['id']:null,_0x4311f4?_0x4311f4[_0x9f4d('0xb')]:null,_0x4311f4?_0x4311f4[_0x9f4d('0xc')]:null,getInteractionId(_0x5e33b7,_0x3f4851,_0x5ec1f0),_0x5e33b7?JSON[_0x9f4d('0xd')](_0x5e33b7):_0x9f4d('0xe'));}function updateUser(_0xfb475c,_0x479cb4,_0x1defb7,_0x426157,_0x35e7d4){db[_['upperFirst'](_0x426157)+_0x9f4d('0xf')][_0x9f4d('0x10')]({'where':{'id':getInteractionId(_0x479cb4,_0x1defb7,_0x426157)}})[_0x9f4d('0x11')](function(_0x178d8e){if(_0x178d8e){return _0x178d8e['update']({'UserId':_0xfb475c?_0xfb475c['id']:null});}})['then'](function(_0x50534f){if(_0x50534f){log(_0x9f4d('0x12'),_0xfb475c,_0x479cb4,_0x1defb7,_0x426157,_0x35e7d4);}})[_0x9f4d('0x13')](function(){log(_0x9f4d('0x14'),_0xfb475c,_0x479cb4,_0x1defb7,_0x426157,_0x35e7d4);});}exports[_0x9f4d('0x15')]=function(_0x214195,_0x385787){return function(_0x4f8bb9,_0x39c30e,_0x3e0b7d){var _0x34ef44=_0x4f8bb9[_0x9f4d('0x16')];var _0x3611e1={};var _0x566d56=_0x4f8bb9[_0x9f4d('0x17')];if(_0x3611e1){_0x3611e1=_[_0x9f4d('0x18')](_0x4f8bb9[_0x9f4d('0x19')]);_0x3611e1=_[_0x9f4d('0x1a')](_0x3611e1,[_0x9f4d('0x19'),_0x9f4d('0x1b'),_0x9f4d('0x1c'),_0x9f4d('0x1d'),_0x9f4d('0x1e')]);}updateUser(_0x34ef44,_0x3611e1,_0x566d56,_0x214195,_0x385787);_0x3e0b7d(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 5e3a295..3f57e60 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf204=['hasOwnProperty','use','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','user','crypto','util','composable-middleware','../../mysqldb','data1','license','aes-256-ctr','format','%s:%s:%s','base64','utf8','parse'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0xf204,0x14d));var _0x4f20=function(_0x379ab0,_0x34dfe1){_0x379ab0=_0x379ab0-0x0;var _0x3ccfbb=_0xf204[_0x379ab0];return _0x3ccfbb;};'use strict';var crypto=require(_0x4f20('0x0'));var util=require(_0x4f20('0x1'));var compose=require(_0x4f20('0x2'));var db=require(_0x4f20('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x31837d,_0x4af1fa){if(_0x31837d&&_0x4af1fa){if(_0x4af1fa[_0x4f20('0x4')]&&_0x4af1fa[_0x4f20('0x5')]){var _0x36cae9=_0x4af1fa['data1'];var _0x40bdfc=_0x4af1fa[_0x4f20('0x5')];var _0x36a102=_0x36cae9['split']('-')[0x4];var _0x54057a=_0x36cae9['split']('-')[0x0];var _0x30f75d=crypto['createDecipher'](_0x4f20('0x6'),util[_0x4f20('0x7')](_0x4f20('0x8'),_0x36a102,_0x36cae9,_0x54057a));var _0x200af4=_0x30f75d['update'](_0x40bdfc,_0x4f20('0x9'),_0x4f20('0xa'));_0x200af4+=_0x30f75d['final']('utf8');var _0x4c30b6=JSON[_0x4f20('0xb')](_0x200af4);return _0x4c30b6[_0x4f20('0xc')](_0x31837d)?_0x4c30b6[_0x31837d]:null;}}return null;}function isLimit(_0x3c1b4e,_0x14bf6c,_0xfbcdd3,_0x44eb3d){var _0x4f6044=_0x14bf6c;return compose()[_0x4f20('0xd')](function(_0x2f84be,_0x566d74,_0x477712){return db[_0x4f20('0xe')][_0x4f20('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x3c5111){var _0x219d24=getValueFromLicense(_0x3c1b4e,_0x3c5111);return _0x219d24?_0x219d24:_0x4f6044;})[_0x4f20('0x10')](function(_0x5dc483){_0x4f6044=_0x5dc483;return _0xfbcdd3[_0x4f20('0x11')](_0x44eb3d);})[_0x4f20('0x10')](function(_0x3e72b5){if(_0x3e72b5>=_0x4f6044){return _0x566d74[_0x4f20('0x12')](0x193)['json']({'message':util[_0x4f20('0x7')](_0x4f20('0x13'),_0x3c1b4e)});}_0x477712();})[_0x4f20('0x14')](function(_0x2b0884){_0x477712(_0x2b0884);});});}function isUserLimit(){return isLimit(_0x4f20('0x15'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x4f20('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xea52=['json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','crypto','composable-middleware','../../config/environment','data1','license','createDecipher','aes-256-ctr','base64','utf8','final','hasOwnProperty','findOne','then'];(function(_0xce2ee4,_0x3fe1e1){var _0x3fd000=function(_0x554493){while(--_0x554493){_0xce2ee4['push'](_0xce2ee4['shift']());}};_0x3fd000(++_0x3fe1e1);}(_0xea52,0x1ac));var _0x2ea5=function(_0x15d469,_0x533556){_0x15d469=_0x15d469-0x0;var _0x3dccfd=_0xea52[_0x15d469];return _0x3dccfd;};'use strict';var crypto=require(_0x2ea5('0x0'));var util=require('util');var compose=require(_0x2ea5('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x2ea5('0x2'));function getValueFromLicense(_0x1fab62,_0x200440){if(_0x1fab62&&_0x200440){if(_0x200440[_0x2ea5('0x3')]&&_0x200440[_0x2ea5('0x4')]){var _0x59e827=_0x200440['data1'];var _0x86dcc4=_0x200440['license'];var _0x25e102=_0x59e827['split']('-')[0x4];var _0x1b8e00=_0x59e827['split']('-')[0x0];var _0x3fb07c=crypto[_0x2ea5('0x5')](_0x2ea5('0x6'),util['format']('%s:%s:%s',_0x25e102,_0x59e827,_0x1b8e00));var _0x330d53=_0x3fb07c['update'](_0x86dcc4,_0x2ea5('0x7'),_0x2ea5('0x8'));_0x330d53+=_0x3fb07c[_0x2ea5('0x9')](_0x2ea5('0x8'));var _0x529772=JSON['parse'](_0x330d53);return _0x529772[_0x2ea5('0xa')](_0x1fab62)?_0x529772[_0x1fab62]:null;}}return null;}function isLimit(_0x41793a,_0x16b3d7,_0xf47fed,_0x450bc6){var _0x113b84=_0x16b3d7;return compose()['use'](function(_0x4bf861,_0x3d2500,_0x16df02){return db['License'][_0x2ea5('0xb')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x2c14cb){var _0xd3fe8e=getValueFromLicense(_0x41793a,_0x2c14cb);return _0xd3fe8e?_0xd3fe8e:_0x113b84;})['then'](function(_0x20e3f0){_0x113b84=_0x20e3f0;return _0xf47fed['count'](_0x450bc6);})[_0x2ea5('0xc')](function(_0x812bdf){if(_0x812bdf>=_0x113b84){return _0x3d2500['status'](0x193)[_0x2ea5('0xd')]({'message':util[_0x2ea5('0xe')](_0x2ea5('0xf'),_0x41793a)});}_0x16df02();})[_0x2ea5('0x10')](function(_0x1bb8e5){_0x16df02(_0x1bb8e5);});});}function isUserLimit(){return isLimit(_0x2ea5('0x11'),0x1,db[_0x2ea5('0x12')],{'where':{'$or':[{'role':'admin'},{'role':_0x2ea5('0x13')}]}});}exports[_0x2ea5('0x14')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index f45f2da..4f04535 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 _0x0aad=['YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','$gt','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','$notIn','start','$endsWith','pop','utcOffset','add','hours','minutes','seconds','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','slice','forEach','split','shift','match','indexOf','map','conditions','DATE','operator','$eq','$between','value','$lte','days','format'];(function(_0x202d43,_0x47dc6d){var _0x2e77af=function(_0x1eefeb){while(--_0x1eefeb){_0x202d43['push'](_0x202d43['shift']());}};_0x2e77af(++_0x47dc6d);}(_0x0aad,0x16a));var _0xd0aa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0aad[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var moment=require(_0xd0aa('0x0'));exports['parseSearch']=function(_0x224ba2){var _0x3469e4={'conditions':[]};_0x3469e4[_0xd0aa('0x1')]=_[_0xd0aa('0x2')](_0x224ba2,_0xd0aa('0x3'))?'or':_0xd0aa('0x4');var _0x47c75c=_0x224ba2[_0xd0aa('0x5')](_0xd0aa('0x6'),'')['replace'](_0xd0aa('0x3'),'')['split']('||');for(var _0x4c6497=0x0;_0x4c6497<_0x47c75c['length'];_0x4c6497++){var _0x3042d8=_0x47c75c[_0x4c6497]['split'](':=');var _0x3612e3=_0x3042d8[0x0];var _0x1be0d5=_0x3042d8[_0xd0aa('0x7')](0x1);_0x1be0d5[_0xd0aa('0x8')](function(_0x41d5ad){var _0x446b07=_0x41d5ad[_0xd0aa('0x9')]('[')[_0xd0aa('0xa')]();var _0x57a2dc=_0x41d5ad[_0xd0aa('0xb')](/\[(.*?)\]/g);_0x57a2dc['forEach'](function(_0x19de80){var _0x5c41ae=_0x19de80[_0xd0aa('0x9')]('[')['filter'](function(_0x580529){return _0x580529[_0xd0aa('0xc')](']')>-0x1;})[_0xd0aa('0xd')](function(_0x52cc6b){return _0x52cc6b['split'](']')[0x0];})[0x0];_0x3469e4[_0xd0aa('0xe')]['push']({'field':_0x3612e3,'operator':_0x446b07,'value':_0x5c41ae});});});}return _0x3469e4;};exports['buildExpression']=function(_0x535ae9,_0xdfbe48,_0x16566b){var _0x5b9a9c={};if(_0xdfbe48===_0xd0aa('0xf')){if(_0x16566b[_0xd0aa('0x10')]===_0xd0aa('0x11')){_0x16566b[_0xd0aa('0x10')]=_0xd0aa('0x12');_0x16566b[_0xd0aa('0x13')]+=','+_0x16566b[_0xd0aa('0x13')];}else if(_['includes'](['$gt',_0xd0aa('0x14')],_0x16566b[_0xd0aa('0x10')])){_0x16566b[_0xd0aa('0x13')]=moment(_0x16566b[_0xd0aa('0x13')])['add'](0x1,_0xd0aa('0x15'))[_0xd0aa('0x16')](_0xd0aa('0x17'));}}if(_0x16566b[_0xd0aa('0x18')]){_0xdfbe48=_0x16566b[_0xd0aa('0x18')];_0x5b9a9c[_0xd0aa('0x19')]=_0xd0aa('0x1a')+_0x535ae9+'.'+_0x16566b[_0xd0aa('0x1b')]+_0xd0aa('0x1c')+_0x16566b[_0xd0aa('0x18')]+')\x20'+parseOperator(_0x16566b[_0xd0aa('0x10')]);}else{_0x5b9a9c[_0xd0aa('0x19')]=_0x535ae9+'.'+_0x16566b['field']+'\x20'+parseOperator(_0x16566b[_0xd0aa('0x10')]);}if(_[_0xd0aa('0x1d')]([_0xd0aa('0x1e'),'$notIn'],_0x16566b[_0xd0aa('0x10')]))_0x5b9a9c['text']='('+_0x5b9a9c[_0xd0aa('0x19')]+_0xd0aa('0x1f')+_0x535ae9+'.'+_0x16566b['field']+_0xd0aa('0x20');_0x5b9a9c[_0xd0aa('0x13')]=parseValue(_0xdfbe48,_0x16566b['operator'],_0x16566b[_0xd0aa('0x13')]);return _0x5b9a9c;};function parseOperator(_0x46ef0a){var _0x189baf;switch(_0x46ef0a){case'$in':_0x189baf=_0xd0aa('0x21');break;case'$notIn':_0x189baf=_0xd0aa('0x22');break;case _0xd0aa('0x11'):_0x189baf=_0xd0aa('0x23');break;case _0xd0aa('0x1e'):_0x189baf='<>\x20?';break;case _0xd0aa('0x24'):case _0xd0aa('0x25'):case'$endsWith':_0x189baf=_0xd0aa('0x26');break;case _0xd0aa('0x27'):_0x189baf=_0xd0aa('0x28');break;case _0xd0aa('0x29'):_0x189baf='>\x20?';break;case _0xd0aa('0x14'):_0x189baf=_0xd0aa('0x2a');break;case'$gte':_0x189baf=_0xd0aa('0x2b');break;case _0xd0aa('0x12'):_0x189baf=_0xd0aa('0x2c');break;}return _0x189baf;}function parseValue(_0x499f71,_0x25a3f2,_0x2e7178){var _0xdd4ab8={'start':undefined,'end':undefined};switch(_0x25a3f2){case _0xd0aa('0x2d'):case _0xd0aa('0x2e'):_0xdd4ab8[_0xd0aa('0x2f')]=_0x2e7178[_0xd0aa('0x9')](',');break;case _0xd0aa('0x24'):_0xdd4ab8['start']='%'+_0x2e7178+'%';break;case _0xd0aa('0x25'):_0xdd4ab8[_0xd0aa('0x2f')]=_0x2e7178+'%';break;case _0xd0aa('0x30'):_0xdd4ab8['start']='%'+_0x2e7178;break;case _0xd0aa('0x12'):var _0x45adc3=_0x2e7178[_0xd0aa('0x9')](',');var _0x2e7178=_0x45adc3[_0xd0aa('0xa')]();var _0x28f9f3=_0x45adc3[_0xd0aa('0x31')]();if(_0x499f71===_0xd0aa('0xf')){_0x2e7178=moment(_0x2e7178)['utcOffset'](0x0,!![])[_0xd0aa('0x16')]();_0x28f9f3=moment(_0x28f9f3)[_0xd0aa('0x32')](0x0,!![])[_0xd0aa('0x33')](0x17,_0xd0aa('0x34'))['add'](0x3b,_0xd0aa('0x35'))['add'](0x3b,_0xd0aa('0x36'))['format']();}_0xdd4ab8={'start':_0x2e7178,'end':_0x28f9f3};break;default:_0xdd4ab8[_0xd0aa('0x2f')]=_0x2e7178;break;}return _0xdd4ab8;} \ No newline at end of file +var _0x0cee=['pop','utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','[$and]','length','split','slice','forEach','shift','filter','indexOf','map','conditions','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x0cee,0xac));var _0xe0ce=function(_0x59ceef,_0x4c32f7){_0x59ceef=_0x59ceef-0x0;var _0x289904=_0x0cee[_0x59ceef];return _0x289904;};'use strict';var _=require(_0xe0ce('0x0'));var moment=require(_0xe0ce('0x1'));exports[_0xe0ce('0x2')]=function(_0x3fdc73){var _0x3bc705={'conditions':[]};_0x3bc705[_0xe0ce('0x3')]=_[_0xe0ce('0x4')](_0x3fdc73,_0xe0ce('0x5'))?'or':'and';var _0x5aff03=_0x3fdc73['replace'](_0xe0ce('0x6'),'')['replace'](_0xe0ce('0x5'),'')['split']('||');for(var _0x11ef12=0x0;_0x11ef12<_0x5aff03[_0xe0ce('0x7')];_0x11ef12++){var _0x78381b=_0x5aff03[_0x11ef12][_0xe0ce('0x8')](':=');var _0x27a484=_0x78381b[0x0];var _0x20f337=_0x78381b[_0xe0ce('0x9')](0x1);_0x20f337[_0xe0ce('0xa')](function(_0x16f788){var _0x5a6184=_0x16f788[_0xe0ce('0x8')]('[')[_0xe0ce('0xb')]();var _0x4b534d=_0x16f788['match'](/\[(.*?)\]/g);_0x4b534d['forEach'](function(_0x5de239){var _0x21bdb2=_0x5de239[_0xe0ce('0x8')]('[')[_0xe0ce('0xc')](function(_0x76917){return _0x76917[_0xe0ce('0xd')](']')>-0x1;})[_0xe0ce('0xe')](function(_0x50ec0b){return _0x50ec0b[_0xe0ce('0x8')](']')[0x0];})[0x0];_0x3bc705[_0xe0ce('0xf')]['push']({'field':_0x27a484,'operator':_0x5a6184,'value':_0x21bdb2});});});}return _0x3bc705;};exports[_0xe0ce('0x10')]=function(_0xc979e0,_0x354312,_0x584ab1){var _0x2bccee={};if(_0x354312===_0xe0ce('0x11')){if(_0x584ab1[_0xe0ce('0x12')]===_0xe0ce('0x13')){_0x584ab1['operator']=_0xe0ce('0x14');_0x584ab1['value']+=','+_0x584ab1[_0xe0ce('0x15')];}else if(_[_0xe0ce('0x16')]([_0xe0ce('0x17'),_0xe0ce('0x18')],_0x584ab1[_0xe0ce('0x12')])){_0x584ab1[_0xe0ce('0x15')]=moment(_0x584ab1[_0xe0ce('0x15')])[_0xe0ce('0x19')](0x1,_0xe0ce('0x1a'))[_0xe0ce('0x1b')]('YYYY-MM-DD');}}if(_0x584ab1[_0xe0ce('0x1c')]){_0x354312=_0x584ab1[_0xe0ce('0x1c')];_0x2bccee[_0xe0ce('0x1d')]=_0xe0ce('0x1e')+_0xc979e0+'.'+_0x584ab1[_0xe0ce('0x1f')]+_0xe0ce('0x20')+_0x584ab1[_0xe0ce('0x1c')]+')\x20'+parseOperator(_0x584ab1[_0xe0ce('0x12')]);}else{_0x2bccee[_0xe0ce('0x1d')]=_0xc979e0+'.'+_0x584ab1[_0xe0ce('0x1f')]+'\x20'+parseOperator(_0x584ab1[_0xe0ce('0x12')]);}if(_[_0xe0ce('0x16')]([_0xe0ce('0x21'),_0xe0ce('0x22')],_0x584ab1[_0xe0ce('0x12')]))_0x2bccee[_0xe0ce('0x1d')]='('+_0x2bccee[_0xe0ce('0x1d')]+_0xe0ce('0x23')+_0xc979e0+'.'+_0x584ab1[_0xe0ce('0x1f')]+'\x20IS\x20NULL)';_0x2bccee[_0xe0ce('0x15')]=parseValue(_0x354312,_0x584ab1[_0xe0ce('0x12')],_0x584ab1['value']);return _0x2bccee;};function parseOperator(_0x44567b){var _0x2b6ce9;switch(_0x44567b){case'$in':_0x2b6ce9=_0xe0ce('0x24');break;case _0xe0ce('0x22'):_0x2b6ce9=_0xe0ce('0x25');break;case'$eq':_0x2b6ce9=_0xe0ce('0x26');break;case _0xe0ce('0x21'):_0x2b6ce9=_0xe0ce('0x27');break;case _0xe0ce('0x28'):case _0xe0ce('0x29'):case _0xe0ce('0x2a'):_0x2b6ce9=_0xe0ce('0x2b');break;case'$lt':_0x2b6ce9=_0xe0ce('0x2c');break;case'$gt':_0x2b6ce9=_0xe0ce('0x2d');break;case'$lte':_0x2b6ce9=_0xe0ce('0x2e');break;case _0xe0ce('0x2f'):_0x2b6ce9=_0xe0ce('0x30');break;case _0xe0ce('0x14'):_0x2b6ce9=_0xe0ce('0x31');break;}return _0x2b6ce9;}function parseValue(_0x505555,_0x1ccc55,_0x860b38){var _0x1285a8={'start':undefined,'end':undefined};switch(_0x1ccc55){case _0xe0ce('0x32'):case'$notIn':_0x1285a8[_0xe0ce('0x33')]=_0x860b38[_0xe0ce('0x8')](',');break;case _0xe0ce('0x28'):_0x1285a8[_0xe0ce('0x33')]='%'+_0x860b38+'%';break;case _0xe0ce('0x29'):_0x1285a8[_0xe0ce('0x33')]=_0x860b38+'%';break;case _0xe0ce('0x2a'):_0x1285a8[_0xe0ce('0x33')]='%'+_0x860b38;break;case _0xe0ce('0x14'):var _0xdca260=_0x860b38[_0xe0ce('0x8')](',');var _0x860b38=_0xdca260['shift']();var _0x1a96d8=_0xdca260[_0xe0ce('0x34')]();if(_0x505555===_0xe0ce('0x11')){_0x860b38=moment(_0x860b38)[_0xe0ce('0x35')](0x0,!![])[_0xe0ce('0x1b')]();_0x1a96d8=moment(_0x1a96d8)['utcOffset'](0x0,!![])[_0xe0ce('0x19')](0x17,_0xe0ce('0x36'))['add'](0x3b,_0xe0ce('0x37'))[_0xe0ce('0x19')](0x3b,'seconds')['format']();}_0x1285a8={'start':_0x860b38,'end':_0x1a96d8};break;default:_0x1285a8[_0xe0ce('0x33')]=_0x860b38;break;}return _0x1285a8;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 4a71895..ed9a0fc 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 _0x9cad=['DESC','omit','isEmpty','length','isObject','isString','unset','isNumeric','isEmail','match','getFullTextValue','forEach','replace','includes','push','join','moment','fields','split','filters','find','type','DATE','isPlainObject','parse','$gte','YYYY-MM-DD','utc','$lte','format','name','uniqueid','isArray','map','indexOf','priority','cast','col','unsigned','substr'];(function(_0x421216,_0x2b81c9){var _0x4f9d5c=function(_0x54a147){while(--_0x54a147){_0x421216['push'](_0x421216['shift']());}};_0x4f9d5c(++_0x2b81c9);}(_0x9cad,0xd8));var _0xd9ca=function(_0x4afe3b,_0x255e0d){_0x4afe3b=_0x4afe3b-0x0;var _0x2c22d1=_0x9cad[_0x4afe3b];return _0x2c22d1;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0xd9ca('0x0'));var LIMIT_VALUE=0xfa;exports[_0xd9ca('0x1')]=function(_0x10c2d8){var _0x137b0b=null;if(_0x10c2d8){_0x137b0b=_0x10c2d8[_0xd9ca('0x2')](',');}return _0x137b0b;};exports[_0xd9ca('0x3')]=function(_0x1a9b72,_0x260390){var _0x775865={};if(!_['isEmpty'](_0x1a9b72)){_['forOwn'](_0x1a9b72,function(_0xda11b9,_0x1b8d85){try{if(_0x260390){var _0x473d2e=_[_0xd9ca('0x4')](_0x260390,{'name':_0x1b8d85})||{};if(_0x473d2e[_0xd9ca('0x5')]===_0xd9ca('0x6')&&_[_0xd9ca('0x7')](_0xda11b9)){var _0x5bb31f=JSON[_0xd9ca('0x8')](_0xda11b9);var _0x1a510a={'$gte':moment(moment(_0x5bb31f[_0xd9ca('0x9')])['format'](_0xd9ca('0xa')))[_0xd9ca('0xb')]()['format'](),'$lte':moment(moment(_0x5bb31f[_0xd9ca('0xc')])[_0xd9ca('0xd')](_0xd9ca('0xa')))[_0xd9ca('0xb')]()['subtract'](0x1,'s')[_0xd9ca('0xd')]()};_0x775865[_0x1b8d85]=_0x1a510a;}else if(_0x473d2e[_0xd9ca('0xe')]===_0xd9ca('0xf')){_0x775865[_0x1b8d85]=_0xda11b9;}else{_0x775865[_0x1b8d85]=_[_0xd9ca('0x10')](_0xda11b9)?_0xda11b9:JSON[_0xd9ca('0x8')](_0xda11b9);}}else{_0x775865[_0x1b8d85]=_[_0xd9ca('0x10')](_0xda11b9)?_0xda11b9:JSON[_0xd9ca('0x8')](_0xda11b9);}}catch(_0x46bdfd){_0x775865[_0x1b8d85]=_0xda11b9[_0xd9ca('0x2')](',');}});}return _0x775865;};exports['limit']=function(_0x30fe69){_0x30fe69=parseInt(_0x30fe69,0xa);if(!_0x30fe69||_0x30fe69<0x0){_0x30fe69=LIMIT_VALUE;}return _0x30fe69;};exports['offset']=function(_0x29236c){_0x29236c=parseInt(_0x29236c,0xa);if(!_0x29236c||_0x29236c<0x0){_0x29236c=0x0;}return _0x29236c;};exports['sort']=function(_0x37e36c){var _0x46e4ff,_0x5deb17=null;if(_0x37e36c){_0x46e4ff=_0x37e36c[_0xd9ca('0x2')](',');_0x5deb17=_[_0xd9ca('0x11')](_0x46e4ff,function(_0x7aef94){if(_0x7aef94[_0xd9ca('0x12')]('-')===0x0){return[_0x7aef94===_0xd9ca('0x13')?sequelize[_0xd9ca('0x14')](sequelize[_0xd9ca('0x15')](_0xd9ca('0x13')),_0xd9ca('0x16')):_0x7aef94[_0xd9ca('0x17')](0x1),_0xd9ca('0x18')];}else{return[_0x7aef94===_0xd9ca('0x13')?sequelize[_0xd9ca('0x14')](sequelize[_0xd9ca('0x15')]('priority'),'unsigned'):_0x7aef94,'ASC'];}});}return _0x5deb17;};exports[_0xd9ca('0x19')]=function(_0x5ce5b9,_0x473254){if(_[_0xd9ca('0x1a')](_0x5ce5b9)){return _0x5ce5b9;}if(_[_0xd9ca('0x10')](_0x5ce5b9)){for(var _0x2866cf=0x0;_0x2866cf<_0x5ce5b9[_0xd9ca('0x1b')];_0x2866cf+=0x1){_0x5ce5b9[_0x2866cf]=this[_0xd9ca('0x19')](_0x5ce5b9[_0x2866cf],_0x473254);}return _0x5ce5b9;}if(!_[_0xd9ca('0x1c')](_0x5ce5b9)){return _0x5ce5b9;}if(_[_0xd9ca('0x1d')](_0x473254)){_0x473254=[_0x473254];}if(!_[_0xd9ca('0x10')](_0x473254)){return _0x5ce5b9;}for(var _0xbe3f38=0x0;_0xbe3f38<_0x473254[_0xd9ca('0x1b')];_0xbe3f38+=0x1){_[_0xd9ca('0x1e')](_0x5ce5b9,_0x473254[_0xbe3f38]);}for(var _0x11019c in _0x5ce5b9){if(_0x5ce5b9['hasOwnProperty'](_0x11019c)){_0x5ce5b9[_0x11019c]=this[_0xd9ca('0x19')](_0x5ce5b9[_0x11019c],_0x473254);}}return _0x5ce5b9;};exports[_0xd9ca('0x1f')]=function(_0x38e972){return _0x38e972['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xd9ca('0x20')]=function(_0x2df73a){return _0x2df73a[_0xd9ca('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xd9ca('0x22')]=function(_0xc67f92){var _0x11b74f=[];_0xc67f92[_0xd9ca('0x2')](/[ ,]+/)[_0xd9ca('0x23')](function(_0x4d236e){_0x4d236e=_0x4d236e[_0xd9ca('0x24')](/([^:]")"+/g,'$1');_0x4d236e='+'+_0x4d236e+'*';if(_0x4d236e[_0xd9ca('0x25')]('@'))_0x4d236e='\x22'+_0x4d236e+'\x22';_0x11b74f[_0xd9ca('0x26')](_0x4d236e);});return _0x11b74f[_0xd9ca('0x27')]('\x20');}; \ No newline at end of file +var _0xe535=['indexOf','col','unsigned','substr','priority','cast','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','getFullTextValue','includes','push','lodash','sequelize','moment','fields','split','isEmpty','forOwn','type','DATE','parse','$gte','format','YYYY-MM-DD','$lte','utc','name','isArray','limit','offset','sort'];(function(_0x64fa5d,_0x4ba48d){var _0x39618c=function(_0x4e0672){while(--_0x4e0672){_0x64fa5d['push'](_0x64fa5d['shift']());}};_0x39618c(++_0x4ba48d);}(_0xe535,0x1f2));var _0x5e53=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xe535[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x5e53('0x0'));var sequelize=require(_0x5e53('0x1'));var moment=require(_0x5e53('0x2'));var LIMIT_VALUE=0xfa;exports[_0x5e53('0x3')]=function(_0x57a449){var _0x33df12=null;if(_0x57a449){_0x33df12=_0x57a449[_0x5e53('0x4')](',');}return _0x33df12;};exports['filters']=function(_0x322ef0,_0x42d5c3){var _0x4c612f={};if(!_[_0x5e53('0x5')](_0x322ef0)){_[_0x5e53('0x6')](_0x322ef0,function(_0x2a8bfe,_0x4943e3){try{if(_0x42d5c3){var _0x853f02=_['find'](_0x42d5c3,{'name':_0x4943e3})||{};if(_0x853f02[_0x5e53('0x7')]===_0x5e53('0x8')&&_['isPlainObject'](_0x2a8bfe)){var _0x13197e=JSON[_0x5e53('0x9')](_0x2a8bfe);var _0x43b0be={'$gte':moment(moment(_0x13197e[_0x5e53('0xa')])[_0x5e53('0xb')](_0x5e53('0xc')))['utc']()['format'](),'$lte':moment(moment(_0x13197e[_0x5e53('0xd')])['format'](_0x5e53('0xc')))[_0x5e53('0xe')]()['subtract'](0x1,'s')[_0x5e53('0xb')]()};_0x4c612f[_0x4943e3]=_0x43b0be;}else if(_0x853f02[_0x5e53('0xf')]==='uniqueid'){_0x4c612f[_0x4943e3]=_0x2a8bfe;}else{_0x4c612f[_0x4943e3]=_[_0x5e53('0x10')](_0x2a8bfe)?_0x2a8bfe:JSON[_0x5e53('0x9')](_0x2a8bfe);}}else{_0x4c612f[_0x4943e3]=_[_0x5e53('0x10')](_0x2a8bfe)?_0x2a8bfe:JSON[_0x5e53('0x9')](_0x2a8bfe);}}catch(_0x15ccee){_0x4c612f[_0x4943e3]=_0x2a8bfe[_0x5e53('0x4')](',');}});}return _0x4c612f;};exports[_0x5e53('0x11')]=function(_0x3ec50b){_0x3ec50b=parseInt(_0x3ec50b,0xa);if(!_0x3ec50b||_0x3ec50b<0x0){_0x3ec50b=LIMIT_VALUE;}return _0x3ec50b;};exports[_0x5e53('0x12')]=function(_0x39122e){_0x39122e=parseInt(_0x39122e,0xa);if(!_0x39122e||_0x39122e<0x0){_0x39122e=0x0;}return _0x39122e;};exports[_0x5e53('0x13')]=function(_0x5b9789){var _0x1f9e59,_0x3fb11d=null;if(_0x5b9789){_0x1f9e59=_0x5b9789[_0x5e53('0x4')](',');_0x3fb11d=_['map'](_0x1f9e59,function(_0x3fed11){if(_0x3fed11[_0x5e53('0x14')]('-')===0x0){return[_0x3fed11==='priority'?sequelize['cast'](sequelize[_0x5e53('0x15')]('priority'),_0x5e53('0x16')):_0x3fed11[_0x5e53('0x17')](0x1),'DESC'];}else{return[_0x3fed11===_0x5e53('0x18')?sequelize[_0x5e53('0x19')](sequelize[_0x5e53('0x15')](_0x5e53('0x18')),_0x5e53('0x16')):_0x3fed11,_0x5e53('0x1a')];}});}return _0x3fb11d;};exports[_0x5e53('0x1b')]=function(_0x10cfc1,_0x41d5dc){if(_['isEmpty'](_0x10cfc1)){return _0x10cfc1;}if(_['isArray'](_0x10cfc1)){for(var _0x2c8ff5=0x0;_0x2c8ff5<_0x10cfc1[_0x5e53('0x1c')];_0x2c8ff5+=0x1){_0x10cfc1[_0x2c8ff5]=this['omit'](_0x10cfc1[_0x2c8ff5],_0x41d5dc);}return _0x10cfc1;}if(!_[_0x5e53('0x1d')](_0x10cfc1)){return _0x10cfc1;}if(_['isString'](_0x41d5dc)){_0x41d5dc=[_0x41d5dc];}if(!_[_0x5e53('0x10')](_0x41d5dc)){return _0x10cfc1;}for(var _0x4080b7=0x0;_0x4080b7<_0x41d5dc[_0x5e53('0x1c')];_0x4080b7+=0x1){_[_0x5e53('0x1e')](_0x10cfc1,_0x41d5dc[_0x4080b7]);}for(var _0x282da5 in _0x10cfc1){if(_0x10cfc1[_0x5e53('0x1f')](_0x282da5)){_0x10cfc1[_0x282da5]=this[_0x5e53('0x1b')](_0x10cfc1[_0x282da5],_0x41d5dc);}}return _0x10cfc1;};exports[_0x5e53('0x20')]=function(_0xc4aead){return _0xc4aead['match'](RegExp(_0x5e53('0x21')))?!![]:![];};exports['isEmail']=function(_0x1ec0c4){return _0x1ec0c4['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x5e53('0x22')]=function(_0x158b9f){var _0x2716dc=[];_0x158b9f['split'](/[ ,]+/)['forEach'](function(_0x2fb3dd){_0x2fb3dd=_0x2fb3dd['replace'](/([^:]")"+/g,'$1');_0x2fb3dd='+'+_0x2fb3dd+'*';if(_0x2fb3dd[_0x5e53('0x23')]('@'))_0x2fb3dd='\x22'+_0x2fb3dd+'\x22';_0x2716dc[_0x5e53('0x24')](_0x2fb3dd);});return _0x2716dc['join']('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 3a1379c..75275ac 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa809=['passport','moment','./environment','../mysqldb','get','env','production','set','appPath','join','root','public','development','test','use','json\x20replacer','toISOString','split','static','views','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','method-override','errorhandler','path'];(function(_0x44dff6,_0x5d385b){var _0x396551=function(_0xe0f820){while(--_0xe0f820){_0x44dff6['push'](_0x44dff6['shift']());}};_0x396551(++_0x5d385b);}(_0xa809,0xf0));var _0x9a80=function(_0x40da45,_0x29029f){_0x40da45=_0x40da45-0x0;var _0x29f717=_0xa809[_0x40da45];return _0x29f717;};'use strict';var express=require(_0x9a80('0x0'));var favicon=require(_0x9a80('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x9a80('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x9a80('0x3'));var path=require(_0x9a80('0x4'));var passport=require(_0x9a80('0x5'));var cors=require('cors');var moment=require(_0x9a80('0x6'));var config=require(_0x9a80('0x7'));var db=require(_0x9a80('0x8'))['db'];exports['default']=function(_0x1178af){var _0x4b5b0c=_0x1178af[_0x9a80('0x9')](_0x9a80('0xa'));if(_0x4b5b0c===_0x9a80('0xb')){_0x1178af[_0x9a80('0xc')](_0x9a80('0xd'),path[_0x9a80('0xe')](config[_0x9a80('0xf')],_0x9a80('0x10')));}if(_0x4b5b0c===_0x9a80('0x11')||_0x4b5b0c===_0x9a80('0x12')){_0x1178af['set']('appPath',path['join'](config[_0x9a80('0xf')],'client'));_0x1178af[_0x9a80('0x13')](errorHandler());}_0x1178af['set'](_0x9a80('0x14'),function(_0x10454f,_0x4e03fc){if(this[_0x10454f]instanceof Date){_0x4e03fc=this[_0x10454f][_0x9a80('0x15')]()[_0x9a80('0x16')]('.')[0x0]+'Z';}return _0x4e03fc;});_0x1178af[_0x9a80('0x13')](express[_0x9a80('0x17')](_0x1178af[_0x9a80('0x9')](_0x9a80('0xd'))));_0x1178af['set'](_0x9a80('0x18'),config[_0x9a80('0xf')]+_0x9a80('0x19'));_0x1178af[_0x9a80('0x1a')](_0x9a80('0x1b'),require(_0x9a80('0x1c'))[_0x9a80('0x1d')]);_0x1178af[_0x9a80('0xc')](_0x9a80('0x1e'),'html');_0x1178af[_0x9a80('0x13')](bodyParser[_0x9a80('0x1f')]({'limit':_0x9a80('0x20'),'extended':!![]}));_0x1178af[_0x9a80('0x13')](bodyParser[_0x9a80('0x21')]({'limit':_0x9a80('0x20')}));_0x1178af[_0x9a80('0x13')](cors());_0x1178af['use'](methodOverride());_0x1178af[_0x9a80('0x13')](cookieParser());_0x1178af['use'](passport[_0x9a80('0x22')]());}; \ No newline at end of file +var _0x1c3c=['renderFile','view\x20engine','json','initialize','express','serve-favicon','body-parser','method-override','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','set','appPath','join','public','test','root','use','json\x20replacer','toISOString','split','views','engine','html'];(function(_0x26fc81,_0x57fc19){var _0x9feece=function(_0x4344c3){while(--_0x4344c3){_0x26fc81['push'](_0x26fc81['shift']());}};_0x9feece(++_0x57fc19);}(_0x1c3c,0x1b6));var _0xc1c3=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x1c3c[_0x31a371];return _0x2a5bd6;};'use strict';var express=require(_0xc1c3('0x0'));var favicon=require(_0xc1c3('0x1'));var bodyParser=require(_0xc1c3('0x2'));var methodOverride=require(_0xc1c3('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xc1c3('0x4'));var path=require(_0xc1c3('0x5'));var passport=require(_0xc1c3('0x6'));var cors=require(_0xc1c3('0x7'));var moment=require(_0xc1c3('0x8'));var config=require(_0xc1c3('0x9'));var db=require(_0xc1c3('0xa'))['db'];exports[_0xc1c3('0xb')]=function(_0x17d143){var _0x2c7b9d=_0x17d143[_0xc1c3('0xc')](_0xc1c3('0xd'));if(_0x2c7b9d==='production'){_0x17d143[_0xc1c3('0xe')](_0xc1c3('0xf'),path[_0xc1c3('0x10')](config['root'],_0xc1c3('0x11')));}if(_0x2c7b9d==='development'||_0x2c7b9d===_0xc1c3('0x12')){_0x17d143[_0xc1c3('0xe')](_0xc1c3('0xf'),path[_0xc1c3('0x10')](config[_0xc1c3('0x13')],'client'));_0x17d143[_0xc1c3('0x14')](errorHandler());}_0x17d143[_0xc1c3('0xe')](_0xc1c3('0x15'),function(_0x383511,_0x33eb1d){if(this[_0x383511]instanceof Date){_0x33eb1d=this[_0x383511][_0xc1c3('0x16')]()[_0xc1c3('0x17')]('.')[0x0]+'Z';}return _0x33eb1d;});_0x17d143[_0xc1c3('0x14')](express['static'](_0x17d143[_0xc1c3('0xc')]('appPath')));_0x17d143[_0xc1c3('0xe')](_0xc1c3('0x18'),config[_0xc1c3('0x13')]+'/server/views');_0x17d143[_0xc1c3('0x19')](_0xc1c3('0x1a'),require('ejs')[_0xc1c3('0x1b')]);_0x17d143['set'](_0xc1c3('0x1c'),'html');_0x17d143[_0xc1c3('0x14')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x17d143[_0xc1c3('0x14')](bodyParser[_0xc1c3('0x1d')]({'limit':'50mb'}));_0x17d143[_0xc1c3('0x14')](cors());_0x17d143[_0xc1c3('0x14')](methodOverride());_0x17d143[_0xc1c3('0x14')](cookieParser());_0x17d143[_0xc1c3('0x14')](passport[_0xc1c3('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 53dd5f1..c87bc13 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 _0x98a8=['lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','map','model','update','digest','hex','getUuid','platform','win32','utf8','macAddress','createHash','md5','substring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98a8,0x12c));var _0x898a=function(_0xe4eb9a,_0x10c9e){_0xe4eb9a=_0xe4eb9a-0x0;var _0x10d039=_0x98a8[_0xe4eb9a];return _0x10d039;};'use strict';var _=require(_0x898a('0x0'));var os=require('os');var crypto=require(_0x898a('0x1'));var machine=require(_0x898a('0x2'));var exec=require(_0x898a('0x3'))[_0x898a('0x4')];function getInterfaces(){var _0x226db7=[];var _0x69c61f=os['networkInterfaces']();var _0x2bb3e2=_[_0x898a('0x5')](_[_0x898a('0x6')](_0x69c61f));for(var _0x101b7b=0x0;_0x101b7b<_0x2bb3e2[_0x898a('0x7')];_0x101b7b++){var _0x5d7e59=_0x69c61f[_0x2bb3e2[_0x101b7b]][_0x898a('0x8')](function(_0x564583){return _0x564583[_0x898a('0x9')]==='IPv4'&&_0x564583[_0x898a('0xa')]===![];});_0x226db7=_0x226db7[_0x898a('0xb')](_0x5d7e59);}return _0x226db7;}function getFirstInterface(){var _0x2101b3=_[_0x898a('0xc')](getInterfaces());return{'macAddress':_0x2101b3&&_0x2101b3[_0x898a('0xd')]?_0x2101b3[_0x898a('0xd')]:_0x898a('0xe'),'ipAddress':_0x2101b3&&_0x2101b3[_0x898a('0xf')]?_0x2101b3[_0x898a('0xf')]:'127.0.0.1'};}exports[_0x898a('0x10')]=getFirstInterface;function getCPUhash(){var _0x502e95=_[_0x898a('0x5')](os['cpus']()[_0x898a('0x11')](function(_0x2c76b7){return _0x2c76b7[_0x898a('0x12')];}))['join'](':');return crypto['createHash']('md5')[_0x898a('0x13')](_0x502e95)[_0x898a('0x14')](_0x898a('0x15'));}exports[_0x898a('0x16')]=function(){switch(os[_0x898a('0x17')]()){case _0x898a('0x18'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x898a('0x19')})['replace']('\x0d\x0a','');default:var _0x3fec7a=getFirstInterface();var _0x5c96a6=getCPUhash();var _0x303321=_0x5c96a6+'|'+os['hostname']()+'|'+_0x3fec7a[_0x898a('0x1a')]+'|'+_0x3fec7a['ipAddress'];var _0xee4408=crypto[_0x898a('0x1b')](_0x898a('0x1c'))['update'](_0x303321)[_0x898a('0x14')]('hex');return _0xee4408['substring'](0x0,0x8)+'-'+_0xee4408[_0x898a('0x1d')](0x8,0xc)+'-'+_0xee4408[_0x898a('0x1d')](0xc,0x10)+'-'+_0xee4408['substring'](0x10,0x14)+'-'+_0xee4408['substring'](0x14);}}; \ No newline at end of file +var _0x6f47=['address','getFirstInterface','cpus','map','model','join','createHash','update','digest','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','md5','hex','substring','crypto','bimedia-machine-uuid','execSync','orderBy','keys','filter','IPv4','internal','concat','head','00:00:00:00:00:00'];(function(_0xc0c066,_0x55c1c7){var _0x1a3675=function(_0x519352){while(--_0x519352){_0xc0c066['push'](_0xc0c066['shift']());}};_0x1a3675(++_0x55c1c7);}(_0x6f47,0xc7));var _0x76f4=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x6f47[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x76f4('0x0'));var machine=require(_0x76f4('0x1'));var exec=require('child_process')[_0x76f4('0x2')];function getInterfaces(){var _0x5765c1=[];var _0x698b39=os['networkInterfaces']();var _0xe214ad=_[_0x76f4('0x3')](_[_0x76f4('0x4')](_0x698b39));for(var _0x2523ba=0x0;_0x2523ba<_0xe214ad['length'];_0x2523ba++){var _0x35602f=_0x698b39[_0xe214ad[_0x2523ba]][_0x76f4('0x5')](function(_0x2176a7){return _0x2176a7['family']===_0x76f4('0x6')&&_0x2176a7[_0x76f4('0x7')]===![];});_0x5765c1=_0x5765c1[_0x76f4('0x8')](_0x35602f);}return _0x5765c1;}function getFirstInterface(){var _0xf9b468=_[_0x76f4('0x9')](getInterfaces());return{'macAddress':_0xf9b468&&_0xf9b468['mac']?_0xf9b468['mac']:_0x76f4('0xa'),'ipAddress':_0xf9b468&&_0xf9b468[_0x76f4('0xb')]?_0xf9b468['address']:'127.0.0.1'};}exports[_0x76f4('0xc')]=getFirstInterface;function getCPUhash(){var _0x458c22=_[_0x76f4('0x3')](os[_0x76f4('0xd')]()[_0x76f4('0xe')](function(_0xafd21e){return _0xafd21e[_0x76f4('0xf')];}))[_0x76f4('0x10')](':');return crypto[_0x76f4('0x11')]('md5')[_0x76f4('0x12')](_0x458c22)[_0x76f4('0x13')]('hex');}exports['getUuid']=function(){switch(os['platform']()){case _0x76f4('0x14'):return exec(_0x76f4('0x15'),{'encoding':_0x76f4('0x16')})[_0x76f4('0x17')]('\x0d\x0a','');default:var _0x3d8f5a=getFirstInterface();var _0x2b5e23=getCPUhash();var _0x46ba51=_0x2b5e23+'|'+os[_0x76f4('0x18')]()+'|'+_0x3d8f5a[_0x76f4('0x19')]+'|'+_0x3d8f5a[_0x76f4('0x1a')];var _0x672960=crypto[_0x76f4('0x11')](_0x76f4('0x1b'))[_0x76f4('0x12')](_0x46ba51)[_0x76f4('0x13')](_0x76f4('0x1c'));return _0x672960[_0x76f4('0x1d')](0x0,0x8)+'-'+_0x672960[_0x76f4('0x1d')](0x8,0xc)+'-'+_0x672960[_0x76f4('0x1d')](0xc,0x10)+'-'+_0x672960[_0x76f4('0x1d')](0x10,0x14)+'-'+_0x672960[_0x76f4('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index c04c5ba..c2a6bb9 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 _0x0a8c=['getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','request-promise','version','../logger','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','message','finally'];(function(_0x4302b9,_0x43fc87){var _0x23e4f8=function(_0x2bf2ce){while(--_0x2bf2ce){_0x4302b9['push'](_0x4302b9['shift']());}};_0x23e4f8(++_0x43fc87);}(_0x0a8c,0xf1));var _0xc0a8=function(_0x1fdf54,_0x5a646f){_0x1fdf54=_0x1fdf54-0x0;var _0x4c5e64=_0x0a8c[_0x1fdf54];return _0x4c5e64;};'use strict';var util=require(_0xc0a8('0x0'));var moment=require('moment');var rp=require(_0xc0a8('0x1'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0xc0a8('0x2'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0xc0a8('0x3'))('license');var HOST=_0xc0a8('0x4');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xc9fecb){return new BPromise(function(_0x5b1777,_0x384a43){var _0x1ff909=util[_0xc0a8('0x5')]('%s/api/servers/%s/check?version=%s',HOST,_0xc9fecb,module[_0xc0a8('0x6')][_0xc0a8('0x2')]);if(oldToken){_0x1ff909=util['format'](_0xc0a8('0x7'),HOST,_0xc9fecb,module['exports'][_0xc0a8('0x2')],oldToken);}var _0x6f6b27={'uri':_0x1ff909,'method':_0xc0a8('0x8'),'timeout':0xea60,'json':!![]};return rp(_0x6f6b27)['then'](function(_0x407fc3){_0x5b1777(_0x407fc3);})[_0xc0a8('0x9')](function(_0x2a6d65){_0x384a43(_0x2a6d65);});});}function manageLicense(_0x5e1a48,_0x5e4f45){var _0x3ce694=_0x5e4f45[_0xc0a8('0xa')]({'plain':!![]});if(!isOldTokenSent&&_0x3ce694[_0xc0a8('0xb')]!==_0x5e1a48&&!_0x3ce694[_0xc0a8('0xc')]){oldToken=_0x3ce694[_0xc0a8('0xb')];}httpRequest(_0x5e1a48)[_0xc0a8('0xd')](function(_0x312dc4){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x312dc4[_0xc0a8('0xe')]){isOldTokenSent=![];if(!_0x3ce694[_0xc0a8('0xf')]&&_0x3ce694[_0xc0a8('0xf')]!=_0x312dc4['license']||_0x3ce694[_0xc0a8('0xf')]&&_0x3ce694[_0xc0a8('0xc')]){logger[_0xc0a8('0x10')](_0xc0a8('0x11'));}if(_0x3ce694[_0xc0a8('0xf')]&&!_0x3ce694[_0xc0a8('0xc')]&&_0x3ce694[_0xc0a8('0xf')]!=_0x312dc4[_0xc0a8('0xf')]){logger['info'](_0xc0a8('0x12'));}if(_0x3ce694[_0xc0a8('0xf')]&&!_0x3ce694[_0xc0a8('0xc')]&&_0x3ce694['license']==_0x312dc4['license']){return _0x5e4f45;}return _0x5e4f45[_0xc0a8('0x13')]({'data1':_0x5e1a48,'data2':null,'license':_0x312dc4[_0xc0a8('0xf')]});}else{if(_0x312dc4['license']||_0x3ce694['license']){if(!_0x3ce694[_0xc0a8('0xc')]){if(_0x3ce694[_0xc0a8('0xb')]==_0x5e1a48){GRAY_PERIOD_REASON=_0xc0a8('0x14');logger[_0xc0a8('0x10')](_0xc0a8('0x15'));}else{GRAY_PERIOD_REASON=_0xc0a8('0x16');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3ce694['data1'],_0x5e1a48);}logger[_0xc0a8('0x10')](_0xc0a8('0x17'),GRAY_PERIOD_REASON[_0xc0a8('0x18')](),moment()['format'](_0xc0a8('0x19')));return _0x5e4f45[_0xc0a8('0x13')]({'data2':encryptor[_0xc0a8('0x1a')](moment()[_0xc0a8('0x5')](_0xc0a8('0x19')))});}else{if(moment()[_0xc0a8('0x1b')](encryptor['decryptString'](_0x3ce694[_0xc0a8('0xc')]),_0xc0a8('0x1c'))>DAYS){logger[_0xc0a8('0x10')](_0xc0a8('0x1d'),moment()[_0xc0a8('0x5')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x5e4f45['update']({'data1':_0x5e1a48,'data2':null,'license':null});}}}else{if(_0x3ce694[_0xc0a8('0xb')]!=_0x5e1a48){logger[_0xc0a8('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3ce694[_0xc0a8('0xb')],_0x5e1a48);return _0x5e4f45[_0xc0a8('0x13')]({'data1':_0x5e1a48,'data2':null,'license':null});}}}return _0x5e4f45;})[_0xc0a8('0xd')](function(_0x9114fd){_0x5e4f45=_0x9114fd;})[_0xc0a8('0x9')](function(_0x2d65a7){logger['error'](_0x2d65a7[_0xc0a8('0x1e')]);})[_0xc0a8('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0xc0a8('0x20')](),_0x5e4f45);},TIME);});}function defaultLicense(){var _0x1a7167=hardware[_0xc0a8('0x20')]();if(_0x1a7167){return db[_0xc0a8('0x21')][_0xc0a8('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x1a7167}})[_0xc0a8('0x23')](function(_0x1e9669,_0x7872da){logger['info'](_0xc0a8('0x24'),_0x1a7167);manageLicense(_0x1a7167,_0x1e9669);})[_0xc0a8('0x9')](function(_0x113e04){logger[_0xc0a8('0x25')](_0x113e04[_0xc0a8('0x1e')]);});}}exports[_0xc0a8('0x26')]=defaultLicense; \ No newline at end of file +var _0x3e0e=['diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm'];(function(_0x5a1d97,_0x265b5a){var _0x401646=function(_0x4dd898){while(--_0x4dd898){_0x5a1d97['push'](_0x5a1d97['shift']());}};_0x401646(++_0x265b5a);}(_0x3e0e,0x10e));var _0xe3e0=function(_0x10a017,_0x2035c5){_0x10a017=_0x10a017-0x0;var _0x50df9d=_0x3e0e[_0x10a017];return _0x50df9d;};'use strict';var util=require(_0xe3e0('0x0'));var moment=require(_0xe3e0('0x1'));var rp=require('request-promise');var BPromise=require(_0xe3e0('0x2'));var pkginfo=require(_0xe3e0('0x3'))(module,_0xe3e0('0x4'));var db=require(_0xe3e0('0x5'))['db'];var encryptor=require(_0xe3e0('0x6'));var hardware=require(_0xe3e0('0x7'));var logger=require(_0xe3e0('0x8'))('license');var HOST=_0xe3e0('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x46bb17){return new BPromise(function(_0x742953,_0x3b10ef){var _0x1abcd2=util[_0xe3e0('0xa')]('%s/api/servers/%s/check?version=%s',HOST,_0x46bb17,module[_0xe3e0('0xb')][_0xe3e0('0x4')]);if(oldToken){_0x1abcd2=util[_0xe3e0('0xa')](_0xe3e0('0xc'),HOST,_0x46bb17,module['exports'][_0xe3e0('0x4')],oldToken);}var _0x5990cc={'uri':_0x1abcd2,'method':_0xe3e0('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x5990cc)[_0xe3e0('0xe')](function(_0x240eec){_0x742953(_0x240eec);})[_0xe3e0('0xf')](function(_0x10c4df){_0x3b10ef(_0x10c4df);});});}function manageLicense(_0x5dc2d2,_0x53b049){var _0x475c32=_0x53b049[_0xe3e0('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x475c32[_0xe3e0('0x11')]!==_0x5dc2d2&&!_0x475c32[_0xe3e0('0x12')]){oldToken=_0x475c32['data1'];}httpRequest(_0x5dc2d2)[_0xe3e0('0xe')](function(_0x4ddb5d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4ddb5d['active']){isOldTokenSent=![];if(!_0x475c32[_0xe3e0('0x13')]&&_0x475c32['license']!=_0x4ddb5d[_0xe3e0('0x13')]||_0x475c32[_0xe3e0('0x13')]&&_0x475c32[_0xe3e0('0x12')]){logger[_0xe3e0('0x14')](_0xe3e0('0x15'));}if(_0x475c32[_0xe3e0('0x13')]&&!_0x475c32['data2']&&_0x475c32[_0xe3e0('0x13')]!=_0x4ddb5d[_0xe3e0('0x13')]){logger['info'](_0xe3e0('0x16'));}if(_0x475c32['license']&&!_0x475c32[_0xe3e0('0x12')]&&_0x475c32[_0xe3e0('0x13')]==_0x4ddb5d[_0xe3e0('0x13')]){return _0x53b049;}return _0x53b049[_0xe3e0('0x17')]({'data1':_0x5dc2d2,'data2':null,'license':_0x4ddb5d['license']});}else{if(_0x4ddb5d['license']||_0x475c32[_0xe3e0('0x13')]){if(!_0x475c32[_0xe3e0('0x12')]){if(_0x475c32[_0xe3e0('0x11')]==_0x5dc2d2){GRAY_PERIOD_REASON=_0xe3e0('0x18');logger[_0xe3e0('0x14')](_0xe3e0('0x19'));}else{GRAY_PERIOD_REASON=_0xe3e0('0x1a');logger[_0xe3e0('0x14')](_0xe3e0('0x1b'),_0x475c32['data1'],_0x5dc2d2);}logger[_0xe3e0('0x14')](_0xe3e0('0x1c'),GRAY_PERIOD_REASON[_0xe3e0('0x1d')](),moment()['format'](_0xe3e0('0x1e')));return _0x53b049[_0xe3e0('0x17')]({'data2':encryptor['encryptString'](moment()[_0xe3e0('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xe3e0('0x1f')](encryptor[_0xe3e0('0x20')](_0x475c32[_0xe3e0('0x12')]),_0xe3e0('0x21'))>DAYS){logger[_0xe3e0('0x14')](_0xe3e0('0x22'),moment()[_0xe3e0('0xa')](_0xe3e0('0x1e')));isOldTokenSent=![];return _0x53b049[_0xe3e0('0x17')]({'data1':_0x5dc2d2,'data2':null,'license':null});}}}else{if(_0x475c32['data1']!=_0x5dc2d2){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x475c32['data1'],_0x5dc2d2);return _0x53b049[_0xe3e0('0x17')]({'data1':_0x5dc2d2,'data2':null,'license':null});}}}return _0x53b049;})[_0xe3e0('0xe')](function(_0x47ccd0){_0x53b049=_0x47ccd0;})[_0xe3e0('0xf')](function(_0x203e29){logger[_0xe3e0('0x23')](_0x203e29[_0xe3e0('0x24')]);})[_0xe3e0('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0xe3e0('0x26')](),_0x53b049);},TIME);});}function defaultLicense(){var _0x205b97=hardware[_0xe3e0('0x26')]();if(_0x205b97){return db[_0xe3e0('0x27')][_0xe3e0('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x205b97}})[_0xe3e0('0x29')](function(_0x42d0ca,_0x5288c9){logger[_0xe3e0('0x14')](_0xe3e0('0x2a'),_0x205b97);manageLicense(_0x205b97,_0x42d0ca);})['catch'](function(_0xfbf832){logger[_0xe3e0('0x23')](_0xfbf832[_0xe3e0('0x24')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index b1a615d..8b536aa 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 _0x0dc3=['findAll','sequelize','COUNT','col','count','role','forEach','admin','user','countBy','telephone','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','demo','uuid','machineUuid','gray','deadline','add','days','grayReason','changed','message','User'];(function(_0x5c2829,_0x2e1482){var _0x4d6544=function(_0x63b01e){while(--_0x63b01e){_0x5c2829['push'](_0x5c2829['shift']());}};_0x4d6544(++_0x2e1482);}(_0x0dc3,0x65));var _0x30dc=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0x0dc3[_0xd0cd0b];return _0x59cced;};'use strict';var util=require(_0x30dc('0x0'));var _=require('lodash');var moment=require(_0x30dc('0x1'));var BPromise=require('bluebird');var hardware=require(_0x30dc('0x2'));var encryptor=require(_0x30dc('0x3'));var db=require(_0x30dc('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x30dc('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x30dc('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x30dc('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x30dc('0x7'),'machineUuid':hardware[_0x30dc('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x503a08){return new BPromise(function(_0x34081c,_0x46e827){return db[_0x30dc('0x8')][_0x30dc('0x9')](_[_0x30dc('0xa')](_0x503a08,{'raw':!![],'where':{'id':0x1}}))[_0x30dc('0xb')](function(_0x26f831){return checkLicense(_0x26f831,null);})[_0x30dc('0xb')](function(_0x2476f6){_0x34081c(_0x2476f6);return;})[_0x30dc('0xc')](function(_0x554d7d){_0x46e827(_0x554d7d);});});}function checkLicense(_0x1c00d4,_0x8f20f8){if(!_0x1c00d4){demoLicense['uuid']=_0x1c00d4[_0x30dc('0xd')];return demoLicense;}try{var _0x4dc2d9=_0x8f20f8||_0x1c00d4[_0x30dc('0xe')];if(_['isEmpty'](_0x4dc2d9)){throw new Error(_0x30dc('0xf'));}var _0xdfbe25=_0x1c00d4['data1'];var _0x2b5dae=_0x1c00d4[_0x30dc('0x10')];var _0x27d239=_0xdfbe25[_0x30dc('0x11')]('-')[0x4];var _0x3aa0ce=_0xdfbe25[_0x30dc('0x11')]('-')[0x0];var _0x4fa806=encryptor[_0x30dc('0x12')](_0x4dc2d9,util['format'](_0x30dc('0x13'),_0x27d239,_0xdfbe25,_0x3aa0ce));var _0x1c3e46=JSON['parse'](_0x4fa806);_0x1c3e46[_0x30dc('0x14')]=![];_0x1c3e46[_0x30dc('0x15')]=_0xdfbe25;_0x1c3e46[_0x30dc('0x16')]=hardware['getUuid']();if(_0x2b5dae){var _0x300315=encryptor['decryptString'](_0x2b5dae);_0x1c3e46[_0x30dc('0x17')]=_0x300315;_0x1c3e46[_0x30dc('0x18')]=moment(_0x300315)[_0x30dc('0x19')](0x7,_0x30dc('0x1a'))['format']();_0x1c3e46[_0x30dc('0x1b')]=_0x1c3e46[_0x30dc('0x15')]!=_0x1c3e46[_0x30dc('0x16')]?_0x30dc('0x1c'):'disabled';}return _0x1c3e46;}catch(_0x3dc11c){breakingLicense[_0x30dc('0x15')]=_0x1c00d4[_0x30dc('0xd')];breakingLicense[_0x30dc('0x1d')]=_0x3dc11c['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x98b8c3,_0x16694a){getLicense()[_0x30dc('0xb')](function(_0x5b6bfb){return db[_0x30dc('0x1e')][_0x30dc('0x1f')]({'attributes':['role',[db[_0x30dc('0x20')]['fn'](_0x30dc('0x21'),db[_0x30dc('0x20')][_0x30dc('0x22')]('role')),_0x30dc('0x23')]],'group':_0x30dc('0x24'),'where':{'role':{'$or':['admin','user','telephone']}},'raw':!![]})[_0x30dc('0xb')](function(_0x491499){var _0x69ca7f={'user':_0x5b6bfb['users']||0x0,'telephone':_0x5b6bfb['telephones']||0x0};_0x491499[_0x30dc('0x25')](function(_0x2dcd30){var _0x4e5f0d=_0x2dcd30[_0x30dc('0x24')]===_0x30dc('0x26')?_0x30dc('0x27'):_0x2dcd30[_0x30dc('0x24')];_0x69ca7f[_0x4e5f0d]-=_0x2dcd30[_0x30dc('0x23')];if(_0x69ca7f[_0x4e5f0d]<0x0)_0x69ca7f[_0x4e5f0d]=0x0;});_0x98b8c3(_0x69ca7f);return;});})[_0x30dc('0xc')](function(_0x4515c5){_0x16694a(_0x4515c5);});});}function checkUserLimits(_0xcf0c26){return new BPromise(function(_0x1bc0b3,_0x5917a9){getLimits()[_0x30dc('0xb')](function(_0x3bc643){var _0x57f1e1=_['pick'](_[_0x30dc('0x28')](_0xcf0c26,_0x30dc('0x24')),[_0x30dc('0x26'),_0x30dc('0x27'),_0x30dc('0x29')]);var _0x3c73da=(_0x57f1e1[_0x30dc('0x26')]||0x0)+(_0x57f1e1[_0x30dc('0x27')]||0x0);var _0x5c940f=_0x57f1e1[_0x30dc('0x29')]||0x0;if(_0x3c73da>_0x3bc643[_0x30dc('0x27')])return _0x5917a9('License\x20limit\x20reached\x20for\x20users');if(_0x5c940f>_0x3bc643[_0x30dc('0x29')])return _0x5917a9(_0x30dc('0x2a'));return _0x1bc0b3();})[_0x30dc('0xc')](function(_0x80ed6){_0x5917a9(_0x80ed6);});});}module[_0x30dc('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xbe26=['License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','defaults','then','catch','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','add','days','grayReason','changed','message','User','findAll','role','sequelize','count','admin','user','telephone','users','forEach','pick','countBy'];(function(_0x52949d,_0x5750ec){var _0x570250=function(_0xd9636a){while(--_0xd9636a){_0x52949d['push'](_0x52949d['shift']());}};_0x570250(++_0x5750ec);}(_0xbe26,0x162));var _0x6be2=function(_0x3e807c,_0x3dcbbf){_0x3e807c=_0x3e807c-0x0;var _0x38c0d8=_0xbe26[_0x3e807c];return _0x38c0d8;};'use strict';var util=require(_0x6be2('0x0'));var _=require('lodash');var moment=require(_0x6be2('0x1'));var BPromise=require('bluebird');var hardware=require(_0x6be2('0x2'));var encryptor=require(_0x6be2('0x3'));var db=require(_0x6be2('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6be2('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x6be2('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6be2('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6be2('0x7'),'machineUuid':hardware[_0x6be2('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x436313){return new BPromise(function(_0x43299b,_0x23c5b3){return db['License']['find'](_[_0x6be2('0x8')](_0x436313,{'raw':!![],'where':{'id':0x1}}))[_0x6be2('0x9')](function(_0x10d79b){return checkLicense(_0x10d79b,null);})[_0x6be2('0x9')](function(_0x33f2bf){_0x43299b(_0x33f2bf);return;})[_0x6be2('0xa')](function(_0x12011a){_0x23c5b3(_0x12011a);});});}function checkLicense(_0x14fe95,_0x33b906){if(!_0x14fe95){demoLicense['uuid']=_0x14fe95['data1'];return demoLicense;}try{var _0x2a7843=_0x33b906||_0x14fe95['license'];if(_[_0x6be2('0xb')](_0x2a7843)){throw new Error(_0x6be2('0xc'));}var _0x449835=_0x14fe95[_0x6be2('0xd')];var _0x19899a=_0x14fe95[_0x6be2('0xe')];var _0x163eb4=_0x449835[_0x6be2('0xf')]('-')[0x4];var _0x27a323=_0x449835[_0x6be2('0xf')]('-')[0x0];var _0x3120d7=encryptor[_0x6be2('0x10')](_0x2a7843,util[_0x6be2('0x11')](_0x6be2('0x12'),_0x163eb4,_0x449835,_0x27a323));var _0x561356=JSON[_0x6be2('0x13')](_0x3120d7);_0x561356[_0x6be2('0x14')]=![];_0x561356[_0x6be2('0x15')]=_0x449835;_0x561356[_0x6be2('0x16')]=hardware[_0x6be2('0x6')]();if(_0x19899a){var _0x523dca=encryptor[_0x6be2('0x10')](_0x19899a);_0x561356[_0x6be2('0x17')]=_0x523dca;_0x561356[_0x6be2('0x18')]=moment(_0x523dca)[_0x6be2('0x19')](0x7,_0x6be2('0x1a'))[_0x6be2('0x11')]();_0x561356[_0x6be2('0x1b')]=_0x561356['uuid']!=_0x561356['machineUuid']?_0x6be2('0x1c'):'disabled';}return _0x561356;}catch(_0x1b485f){breakingLicense['uuid']=_0x14fe95['data1'];breakingLicense[_0x6be2('0x1d')]=_0x1b485f[_0x6be2('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x557d83,_0x471ebd){getLicense()[_0x6be2('0x9')](function(_0x3fb3e0){return db[_0x6be2('0x1e')][_0x6be2('0x1f')]({'attributes':[_0x6be2('0x20'),[db[_0x6be2('0x21')]['fn']('COUNT',db[_0x6be2('0x21')]['col'](_0x6be2('0x20'))),_0x6be2('0x22')]],'group':_0x6be2('0x20'),'where':{'role':{'$or':[_0x6be2('0x23'),_0x6be2('0x24'),_0x6be2('0x25')]}},'raw':!![]})[_0x6be2('0x9')](function(_0x2e1a0e){var _0x3149c5={'user':_0x3fb3e0[_0x6be2('0x26')]||0x0,'telephone':_0x3fb3e0['telephones']||0x0};_0x2e1a0e[_0x6be2('0x27')](function(_0x2feeba){var _0x497dda=_0x2feeba[_0x6be2('0x20')]===_0x6be2('0x23')?'user':_0x2feeba[_0x6be2('0x20')];_0x3149c5[_0x497dda]-=_0x2feeba[_0x6be2('0x22')];if(_0x3149c5[_0x497dda]<0x0)_0x3149c5[_0x497dda]=0x0;});_0x557d83(_0x3149c5);return;});})[_0x6be2('0xa')](function(_0x2bf619){_0x471ebd(_0x2bf619);});});}function checkUserLimits(_0x573868){return new BPromise(function(_0x274e69,_0x267947){getLimits()[_0x6be2('0x9')](function(_0x1b0878){var _0xf6b0d5=_[_0x6be2('0x28')](_[_0x6be2('0x29')](_0x573868,_0x6be2('0x20')),[_0x6be2('0x23'),_0x6be2('0x24'),'telephone']);var _0x5108e4=(_0xf6b0d5['admin']||0x0)+(_0xf6b0d5['user']||0x0);var _0x8ee18=_0xf6b0d5[_0x6be2('0x25')]||0x0;if(_0x5108e4>_0x1b0878['user'])return _0x267947(_0x6be2('0x2a'));if(_0x8ee18>_0x1b0878[_0x6be2('0x25')])return _0x267947(_0x6be2('0x2b'));return _0x274e69();})['catch'](function(_0x2c3c31){_0x267947(_0x2c3c31);});});}module['exports']={'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 6423f75..faed6a7 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 _0x0b95=['http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0xea6018,_0x4cf082){var _0x57b54d=function(_0x49099a){while(--_0x49099a){_0xea6018['push'](_0xea6018['shift']());}};_0x57b54d(++_0x4cf082);}(_0x0b95,0x198));var _0x50b9=function(_0x50736d,_0x5064a7){_0x50736d=_0x50736d-0x0;var _0x32b493=_0x0b95[_0x50736d];return _0x32b493;};'use strict';module['exports']={'DOMAIN':_0x50b9('0x0'),'SESSION_SECRET':_0x50b9('0x1'),'GOOGLE_ID':_0x50b9('0x2'),'GOOGLE_SECRET':_0x50b9('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x686a=['app-id','secret','exports','http://localhost:9000'];(function(_0x1ba2c5,_0xa1a53d){var _0x2e306e=function(_0x38ad0b){while(--_0x38ad0b){_0x1ba2c5['push'](_0x1ba2c5['shift']());}};_0x2e306e(++_0xa1a53d);}(_0x686a,0x162));var _0xa686=function(_0x58f6b2,_0x834e0a){_0x58f6b2=_0x58f6b2-0x0;var _0x21d159=_0x686a[_0x58f6b2];return _0x21d159;};'use strict';module[_0xa686('0x0')]={'DOMAIN':_0xa686('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xa686('0x2'),'GOOGLE_SECRET':_0xa686('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index ecf0316..2bfc3c8 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf77a=['YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console','moment','winston','util','path','INFO','join','xcally','%s-%s.log','message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s'];(function(_0x7e678c,_0x2aa892){var _0x59a688=function(_0x2d9149){while(--_0x2d9149){_0x7e678c['push'](_0x7e678c['shift']());}};_0x59a688(++_0x2aa892);}(_0xf77a,0x17a));var _0xaf77=function(_0x50c4e7,_0x4705b9){_0x50c4e7=_0x50c4e7-0x0;var _0x2aa946=_0xf77a[_0x50c4e7];return _0x2aa946;};'use strict';var moment=require(_0xaf77('0x0'));var winston=require(_0xaf77('0x1'));var util=require(_0xaf77('0x2'));var path=require(_0xaf77('0x3'));var debugLevel=_0xaf77('0x4');function filename(_0x962714,_0x129286){return path[_0xaf77('0x5')]('/var','log',_0xaf77('0x6'),util['format'](_0xaf77('0x7'),_0x962714,_0x129286));}function formatter(_0x4ac178,_0x3e9419){_0x3e9419[_0xaf77('0x8')]=_0x3e9419[_0xaf77('0x8')][_0xaf77('0x9')](/@@{/g,'{{{')[_0xaf77('0x9')](/}@@/g,_0xaf77('0xa'))[_0xaf77('0x9')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xaf77('0xb')](_0xaf77('0xc'),moment()['format'](_0xaf77('0xd')),_0x3e9419['level'][_0xaf77('0xe')](),_0x4ac178,_0x3e9419[_0xaf77('0x8')]);}module[_0xaf77('0xf')]=function(_0x4f34d2){return new winston[(_0xaf77('0x10'))]({'transports':[new winston[(_0xaf77('0x11'))][(_0xaf77('0x12'))]({'name':util[_0xaf77('0xb')](_0xaf77('0x13'),_0x4f34d2,_0xaf77('0x14')),'filename':filename(_0x4f34d2,_0xaf77('0x14')),'level':_0xaf77('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x48733e){return formatter(_0x4f34d2,_0x48733e);}}),new winston[(_0xaf77('0x11'))][(_0xaf77('0x12'))]({'name':util['format'](_0xaf77('0x13'),_0x4f34d2,_0xaf77('0x15')),'filename':filename(_0x4f34d2,_0xaf77('0x15')),'level':_0xaf77('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5b6df2){return formatter(_0x4f34d2,_0x5b6df2);}}),new winston[(_0xaf77('0x11'))][(_0xaf77('0x16'))]({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x5ce058){return formatter(_0x4f34d2,_0x5ce058);}})]});}; \ No newline at end of file +var _0x7938=['Console','env','debugLevel','moment','winston','util','path','join','log','xcally','format','message','{{{','replace','}}}','level','toUpperCase','exports','transports','%s-%s','error','File','info'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x7938,0xd2));var _0x8793=function(_0x5152ec,_0x37d2c5){_0x5152ec=_0x5152ec-0x0;var _0x3b5fe3=_0x7938[_0x5152ec];return _0x3b5fe3;};'use strict';var moment=require(_0x8793('0x0'));var winston=require(_0x8793('0x1'));var util=require(_0x8793('0x2'));var path=require(_0x8793('0x3'));var debugLevel='INFO';function filename(_0x1dbf07,_0x45cbad){return path[_0x8793('0x4')]('/var',_0x8793('0x5'),_0x8793('0x6'),util[_0x8793('0x7')]('%s-%s.log',_0x1dbf07,_0x45cbad));}function formatter(_0x158da8,_0x3ee12c){_0x3ee12c[_0x8793('0x8')]=_0x3ee12c[_0x8793('0x8')]['replace'](/@@{/g,_0x8793('0x9'))[_0x8793('0xa')](/}@@/g,_0x8793('0xb'))[_0x8793('0xa')](/@{/g,'{{')[_0x8793('0xa')](/}@/g,'}}');return util[_0x8793('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x8793('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0x3ee12c[_0x8793('0xc')][_0x8793('0xd')](),_0x158da8,_0x3ee12c[_0x8793('0x8')]);}module[_0x8793('0xe')]=function(_0x2bd82a){return new winston['Logger']({'transports':[new winston[(_0x8793('0xf'))]['File']({'name':util[_0x8793('0x7')](_0x8793('0x10'),_0x2bd82a,'error'),'filename':filename(_0x2bd82a,_0x8793('0x11')),'level':_0x8793('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x861d73){return formatter(_0x2bd82a,_0x861d73);}}),new winston[(_0x8793('0xf'))][(_0x8793('0x12'))]({'name':util[_0x8793('0x7')](_0x8793('0x10'),_0x2bd82a,_0x8793('0x13')),'filename':filename(_0x2bd82a,'info'),'level':_0x8793('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1b82cc){return formatter(_0x2bd82a,_0x1b82cc);}}),new winston['transports'][(_0x8793('0x14'))]({'level':process[_0x8793('0x15')][_0x8793('0x16')]||debugLevel,'json':![],'formatter':function(_0x17d91b){return formatter(_0x2bd82a,_0x17d91b);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 8c65cfe..79d935a 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 _0xb205=['ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js'];(function(_0x5b4742,_0x304b37){var _0x2c6b94=function(_0x34b922){while(--_0x34b922){_0x5b4742['push'](_0x5b4742['shift']());}};_0x2c6b94(++_0x304b37);}(_0xb205,0xcc));var _0x5b20=function(_0x412b97,_0x584710){_0x412b97=_0x412b97-0x0;var _0xffc2e4=_0xb205[_0x412b97];return _0xffc2e4;};'use strict';var path=require(_0x5b20('0x0'));var os=require('os');var config={'apps':[{'name':_0x5b20('0x1'),'script':path[_0x5b20('0x2')](__dirname,_0x5b20('0x3'))},{'name':_0x5b20('0x4'),'script':path['join'](__dirname,_0x5b20('0x5'))},{'name':_0x5b20('0x6'),'script':path[_0x5b20('0x2')](__dirname,_0x5b20('0x7'))},{'name':_0x5b20('0x8'),'script':path[_0x5b20('0x2')](__dirname,_0x5b20('0x9'))},{'name':'routing','script':path['join'](__dirname,'../../services/routing/index.js')},{'name':_0x5b20('0xa'),'script':path[_0x5b20('0x2')](__dirname,_0x5b20('0xb'))}]};module[_0x5b20('0xc')]=config; \ No newline at end of file +var _0x5fa2=['path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x460666,_0x24bfa0){var _0x555cbf=function(_0x3b4743){while(--_0x3b4743){_0x460666['push'](_0x460666['shift']());}};_0x555cbf(++_0x24bfa0);}(_0x5fa2,0x1b2));var _0x25fa=function(_0xd94707,_0x3cacec){_0xd94707=_0xd94707-0x0;var _0x273bf8=_0x5fa2[_0xd94707];return _0x273bf8;};'use strict';var path=require(_0x25fa('0x0'));var os=require('os');var config={'apps':[{'name':_0x25fa('0x1'),'script':path[_0x25fa('0x2')](__dirname,_0x25fa('0x3'))},{'name':_0x25fa('0x4'),'script':path[_0x25fa('0x2')](__dirname,_0x25fa('0x5'))},{'name':_0x25fa('0x6'),'script':path['join'](__dirname,_0x25fa('0x7'))},{'name':'email','script':path[_0x25fa('0x2')](__dirname,_0x25fa('0x8'))},{'name':_0x25fa('0x9'),'script':path[_0x25fa('0x2')](__dirname,_0x25fa('0xa'))},{'name':_0x25fa('0xb'),'script':path['join'](__dirname,_0x25fa('0xc'))}]};module[_0x25fa('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index fd03f7b..0ce71ac 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 _0x25fa=['./config','connect','connected','then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2'];(function(_0x3450c8,_0x120aa7){var _0x14defc=function(_0x139793){while(--_0x139793){_0x3450c8['push'](_0x3450c8['shift']());}};_0x14defc(++_0x120aa7);}(_0x25fa,0x109));var _0xa25f=function(_0x3d434b,_0x259794){_0x3d434b=_0x3d434b-0x0;var _0x3cbc64=_0x25fa[_0x3d434b];return _0x3cbc64;};'use strict';var pm2=require(_0xa25f('0x0'));var BPromise=require('bluebird');var config=require(_0xa25f('0x1'));function connect(){return new BPromise(function(_0x37129d,_0x57e272){return pm2[_0xa25f('0x2')](function(_0xb88bd8){if(_0xb88bd8){return _0x57e272(_0xb88bd8);}return _0x37129d(_0xa25f('0x3'));});});};exports['start']=function(_0x4e444d){return connect()[_0xa25f('0x4')](function(){return new BPromise(function(_0x50dafc,_0x2ea9ea){return pm2[_0xa25f('0x5')](_0x4e444d,function(_0x29666d,_0x455225){if(_0x29666d){return _0x2ea9ea(_0x29666d);}pm2[_0xa25f('0x6')]();return _0x50dafc(_0x455225);});});});};exports[_0xa25f('0x7')]=function(_0x64bbbf){return connect()[_0xa25f('0x4')](function(){return new BPromise(function(_0xa27a42,_0x55ef98){return pm2[_0xa25f('0x7')](_0x64bbbf,function(_0x31bd1d,_0x507a36){if(_0x31bd1d){return _0x55ef98(_0x31bd1d);}pm2[_0xa25f('0x6')]();return _0xa27a42(_0x507a36);});});});};exports[_0xa25f('0x8')]=function(_0x1f65b3){return connect()[_0xa25f('0x4')](function(){return new BPromise(function(_0x5168c1,_0x2f7fc5){return pm2[_0xa25f('0x8')](_0x1f65b3,function(_0x5962e7,_0x3e970c){if(_0x5962e7){return _0x2f7fc5(_0x5962e7);}pm2[_0xa25f('0x6')]();return _0x5168c1(_0x3e970c);});});});};exports['list']=function(){return connect()[_0xa25f('0x4')](function(){return new BPromise(function(_0x20f411,_0x1c6052){return pm2[_0xa25f('0x9')](function(_0x199e18,_0x2a627f){if(_0x199e18){return _0x1c6052(_0x199e18);}pm2[_0xa25f('0x6')]();return _0x20f411(_0x2a627f);});});});};exports[_0xa25f('0xa')]=function(_0x465809){return connect()[_0xa25f('0x4')](function(){return new BPromise(function(_0x1e5836,_0x1859ba){return pm2['describe'](_0x465809,function(_0x2d4f0f,_0x471679){if(_0x2d4f0f){return _0x1859ba(_0x2d4f0f);}pm2[_0xa25f('0x6')]();return _0x1e5836(_0x471679);});});});};exports[_0xa25f('0xb')]=function(_0x18705c){return connect()[_0xa25f('0x4')](function(){return new BPromise(function(_0x4a4805,_0x292171){return pm2['delete'](_0x18705c,function(_0x32b868,_0x562573){if(_0x32b868){return _0x292171(_0x32b868);}pm2['disconnect']();return _0x4a4805(_0x562573);});});});};exports[_0xa25f('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x46bb31,_0x131c68){return pm2[_0xa25f('0xc')](function(_0x3c2665){if(_0x3c2665){return _0x131c68(_0x3c2665);}return _0x46bb31(_0xa25f('0xd'));});});});}; \ No newline at end of file +var _0xd43e=['list','delete','dump','saved','pm2','./config','connect','start','then','stop','disconnect'];(function(_0x1fc18b,_0x13d27d){var _0x16a351=function(_0x54a799){while(--_0x54a799){_0x1fc18b['push'](_0x1fc18b['shift']());}};_0x16a351(++_0x13d27d);}(_0xd43e,0x88));var _0xed43=function(_0x26ef16,_0x24fa15){_0x26ef16=_0x26ef16-0x0;var _0x4b471a=_0xd43e[_0x26ef16];return _0x4b471a;};'use strict';var pm2=require(_0xed43('0x0'));var BPromise=require('bluebird');var config=require(_0xed43('0x1'));function connect(){return new BPromise(function(_0x38cc48,_0x23e25b){return pm2[_0xed43('0x2')](function(_0x5d957e){if(_0x5d957e){return _0x23e25b(_0x5d957e);}return _0x38cc48('connected');});});};exports[_0xed43('0x3')]=function(_0x2c6a4b){return connect()[_0xed43('0x4')](function(){return new BPromise(function(_0x39dbc8,_0x52425d){return pm2[_0xed43('0x3')](_0x2c6a4b,function(_0x463645,_0x4875eb){if(_0x463645){return _0x52425d(_0x463645);}pm2['disconnect']();return _0x39dbc8(_0x4875eb);});});});};exports['stop']=function(_0x3d603f){return connect()[_0xed43('0x4')](function(){return new BPromise(function(_0x46239d,_0xd39ac0){return pm2[_0xed43('0x5')](_0x3d603f,function(_0x5dbd4b,_0x2d698a){if(_0x5dbd4b){return _0xd39ac0(_0x5dbd4b);}pm2[_0xed43('0x6')]();return _0x46239d(_0x2d698a);});});});};exports['restart']=function(_0x1eaf12){return connect()[_0xed43('0x4')](function(){return new BPromise(function(_0xb026ab,_0x52a6e1){return pm2['restart'](_0x1eaf12,function(_0x2bb700,_0x34027b){if(_0x2bb700){return _0x52a6e1(_0x2bb700);}pm2['disconnect']();return _0xb026ab(_0x34027b);});});});};exports[_0xed43('0x7')]=function(){return connect()[_0xed43('0x4')](function(){return new BPromise(function(_0x446f34,_0x4995f1){return pm2[_0xed43('0x7')](function(_0x403a89,_0x597544){if(_0x403a89){return _0x4995f1(_0x403a89);}pm2[_0xed43('0x6')]();return _0x446f34(_0x597544);});});});};exports['describe']=function(_0x2ec9c3){return connect()['then'](function(){return new BPromise(function(_0x2d457a,_0x4caa03){return pm2['describe'](_0x2ec9c3,function(_0xbee228,_0x572df2){if(_0xbee228){return _0x4caa03(_0xbee228);}pm2[_0xed43('0x6')]();return _0x2d457a(_0x572df2);});});});};exports[_0xed43('0x8')]=function(_0x3c4bc3){return connect()['then'](function(){return new BPromise(function(_0x15d67a,_0xa8a443){return pm2['delete'](_0x3c4bc3,function(_0x594458,_0x18f31c){if(_0x594458){return _0xa8a443(_0x594458);}pm2[_0xed43('0x6')]();return _0x15d67a(_0x18f31c);});});});};exports[_0xed43('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x52e265,_0x456527){return pm2['dump'](function(_0x3570ef){if(_0x3570ef){return _0x456527(_0x3570ef);}return _0x52e265(_0xed43('0xa'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index a7e67af..637bf40 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 _0x1396=['then','ChatInteraction','findAll','lastMsgAt','subtract','length','info','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','chatTimeout'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0x1396,0x87));var _0x6139=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x1396[_0x874cf1];return _0x233579;};'use strict';var _=require(_0x6139('0x0'));var moment=require(_0x6139('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x6139('0x2'));var db=require(_0x6139('0x3'))['db'];var logger=require(_0x6139('0x4'))('schedule');config[_0x6139('0x5')]=_[_0x6139('0x6')](config[_0x6139('0x5')],{'host':_0x6139('0x7'),'port':0x18eb});var io=require(_0x6139('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x5d4adf=0x0;var _0x1e358b=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x6139('0x9')],'where':{'id':0x1}})[_0x6139('0xa')](function(_0x32f9fe){_0x5d4adf=_0x32f9fe[_0x6139('0x9')];if(_0x5d4adf){return db[_0x6139('0xb')][_0x6139('0xc')]({'raw':!![],'attributes':['id',_0x6139('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6139('0xe')](_0x32f9fe[_0x6139('0x9')],'minutes')}}});}else{return[];}})[_0x6139('0xa')](function(_0x4d9c32){if(_0x4d9c32&&_0x4d9c32[_0x6139('0xf')]){_0x1e358b=_['map'](_0x4d9c32||[],'id');logger[_0x6139('0x10')]('[CHAT]\x20Interactions\x20to\x20close:',_0x1e358b[_0x6139('0x11')]());return db[_0x6139('0xb')][_0x6139('0x12')]({'closeReason':_0x6139('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x6139('0x14')](_0x6139('0x15'))},{'where':{'id':_0x1e358b}});}})['then'](function(){if(_0x1e358b&&_0x1e358b[_0x6139('0xf')]){logger[_0x6139('0x10')](_0x6139('0x16'),_0x1e358b[_0x6139('0x11')]());for(var _0x3a1993=0x0;_0x3a1993<_0x1e358b['length'];_0x3a1993++){io[_0x6139('0x17')](_0x6139('0x18'),{'id':_0x1e358b[_0x3a1993],'closed':!![]});}}})[_0x6139('0x19')](function(_0x503ea5){logger[_0x6139('0x1a')](_0x6139('0x1b'),_0x503ea5?util[_0x6139('0x1c')](_0x503ea5,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xdfe2=['inspect','start','ioredis','util','../../config/environment','schedule','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','info','catch'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0xdfe2,0x12b));var _0x2dfe=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xdfe2[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x2dfe('0x0'));var util=require(_0x2dfe('0x1'));var config=require(_0x2dfe('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x2dfe('0x3'));config[_0x2dfe('0x4')]=_['defaults'](config[_0x2dfe('0x4')],{'host':_0x2dfe('0x5'),'port':0x18eb});var io=require(_0x2dfe('0x6'))(new Redis(config[_0x2dfe('0x4')]));function closeInteractions(){var _0x4f0ffe=0x0;var _0x4a1cc5=[];return db[_0x2dfe('0x7')][_0x2dfe('0x8')]({'raw':!![],'attributes':['id',_0x2dfe('0x9')],'where':{'id':0x1}})[_0x2dfe('0xa')](function(_0x500191){_0x4f0ffe=_0x500191[_0x2dfe('0x9')];if(_0x4f0ffe){return db[_0x2dfe('0xb')][_0x2dfe('0xc')]({'raw':!![],'attributes':['id',_0x2dfe('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2dfe('0xe')](_0x500191[_0x2dfe('0x9')],_0x2dfe('0xf'))}}});}else{return[];}})[_0x2dfe('0xa')](function(_0x387150){if(_0x387150&&_0x387150[_0x2dfe('0x10')]){_0x4a1cc5=_[_0x2dfe('0x11')](_0x387150||[],'id');logger['info'](_0x2dfe('0x12'),_0x4a1cc5[_0x2dfe('0x13')]());return db['ChatInteraction']['update']({'closeReason':_0x2dfe('0x14'),'disposition':_0x2dfe('0x15'),'closed':!![],'closedAt':moment()[_0x2dfe('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4a1cc5}});}})[_0x2dfe('0xa')](function(){if(_0x4a1cc5&&_0x4a1cc5[_0x2dfe('0x10')]){logger[_0x2dfe('0x17')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x4a1cc5[_0x2dfe('0x13')]());for(var _0x3eba74=0x0;_0x3eba74<_0x4a1cc5[_0x2dfe('0x10')];_0x3eba74++){io['emit']('chatInteraction:update',{'id':_0x4a1cc5[_0x3eba74],'closed':!![]});}}})[_0x2dfe('0x18')](function(_0x22ebac){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x22ebac?util[_0x2dfe('0x19')](_0x22ebac,{'showHidden':![],'depth':null}):'');});}exports[_0x2dfe('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 06c4af9..e658e9f 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 _0x909a=['../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','email','MailAccount','Smtp','service','port','secure','authentication','auth','user','pass','format','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','join','Sent','message','attachments','existsSync','status','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','stringify','isNil','subtractNumber','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','keys','jobs','map','keyBy','difference','intersection','length','stop','deleteJob','toRun','toString','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add\x20cron','exists','update','update\x20cron','stop\x20cron','start','path','moment','cron-job-manager','jayson/promise','bluebird'];(function(_0x2f71bf,_0x161acb){var _0x540399=function(_0x1a88e7){while(--_0x1a88e7){_0x2f71bf['push'](_0x2f71bf['shift']());}};_0x540399(++_0x161acb);}(_0x909a,0x100));var _0xa909=function(_0x280146,_0x45c87d){_0x280146=_0x280146-0x0;var _0x5ede73=_0x909a[_0x280146];return _0x5ede73;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xa909('0x0'));var _=require('lodash');var moment=require(_0xa909('0x1'));var CronJobManager=require(_0xa909('0x2'));var jayson=require(_0xa909('0x3'));var BPromise=require(_0xa909('0x4'));var logger=require(_0xa909('0x5'))(_0xa909('0x6'));var db=require(_0xa909('0x7'))['db'];var analyticCustomReportController=require(_0xa909('0x8'));var analyticDefaultReportController=require(_0xa909('0x9'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3a0cf5,_0x103f65){return function(){logger[_0xa909('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x3a0cf5[_0xa909('0xb')]);var _0x2ce2be=!![];var _0x43b232={'tls':{'rejectUnauthorized':![]}};if(_0x3a0cf5[_0xa909('0xc')][_0xa909('0xd')][_0xa909('0xe')]){_0x43b232[_0xa909('0xe')]=_0x3a0cf5[_0xa909('0xc')][_0xa909('0xd')][_0xa909('0xe')];}else{_0x43b232['host']=_0x3a0cf5[_0xa909('0xc')][_0xa909('0xd')]['host'];_0x43b232[_0xa909('0xf')]=_0x3a0cf5[_0xa909('0xc')]['Smtp'][_0xa909('0xf')];_0x43b232[_0xa909('0x10')]=_0x3a0cf5[_0xa909('0xc')][_0xa909('0xd')][_0xa909('0x10')];}if(_0x3a0cf5['MailAccount']['Smtp'][_0xa909('0x11')]){_0x43b232[_0xa909('0x12')]={'user':_0x3a0cf5['MailAccount'][_0xa909('0xd')][_0xa909('0x13')],'pass':_0x3a0cf5[_0xa909('0xc')][_0xa909('0xd')][_0xa909('0x14')]};}var _0x2c055c={'account':_0x43b232,'message':{'from':util[_0xa909('0x15')]('\x22%s\x22\x20<%s>',_0x3a0cf5['MailAccount']['name'],_0x3a0cf5['MailAccount'][_0xa909('0xb')]||_0x3a0cf5[_0xa909('0xc')][_0xa909('0xd')][_0xa909('0x13')]),'to':_0x3a0cf5['email'],'cc':_0x3a0cf5['cc'],'bcc':_0x3a0cf5[_0xa909('0x16')],'subject':util[_0xa909('0x15')](_0xa909('0x17'),_0x103f65[_0xa909('0x18')],_0x3a0cf5['subtractNumber'],_0x3a0cf5[_0xa909('0x19')])}};var _0x5b1a54=path['join'](__dirname,_0xa909('0x1a'));var _0x2dcd34=_0x103f65[_0xa909('0x1b')];var _0x39e7ae=util[_0xa909('0x15')](_0xa909('0x1c'),path[_0xa909('0x1d')](_0x103f65[_0xa909('0x1b')],path[_0xa909('0x1e')](_0x103f65[_0xa909('0x1b')])),_0xa909('0x1f'));var _0x17b54c=path[_0xa909('0x20')](_0x5b1a54,_0x2dcd34);var _0x1b519e=path[_0xa909('0x20')](_0x5b1a54,_0x39e7ae);if(fs['existsSync'](_0x17b54c)){_0x103f65['status']=_0xa909('0x21');_0x2c055c[_0xa909('0x22')][_0xa909('0x23')]=[{'filename':_0x2dcd34,'path':_0x17b54c}];_0x2c055c['message']['text']=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x103f65,null,0x2));}else if(fs[_0xa909('0x24')](_0x1b519e)){_0x103f65[_0xa909('0x25')]='Sent';_0x2c055c['message'][_0xa909('0x23')]=[{'filename':_0x39e7ae,'path':_0x1b519e}];}else{_0x2c055c[_0xa909('0x22')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x3a0cf5[_0xa909('0x26')]){_0x2ce2be=![];logger[_0xa909('0xa')](_0xa909('0x27'));}}if(_0x2ce2be){return client[_0xa909('0x28')](_0xa909('0x29'),_0x2c055c)[_0xa909('0x2a')](function(_0x39ddc6){if(_0x39ddc6[_0xa909('0x2b')]){return logger[_0xa909('0x2b')](_0xa909('0x2c'),JSON['stringify'](_0x39ddc6));}return logger[_0xa909('0xa')](_0xa909('0x2d'));})[_0xa909('0x2e')](function(_0x1c1762){return logger[_0xa909('0x2b')](_0xa909('0x2c'),JSON['stringify'](_0x1c1762));});}};}function handleError(){return function(_0x236ba2){return logger[_0xa909('0x2b')](JSON[_0xa909('0x2f')](_0x236ba2));};}function handleResult(_0xbd1793){return function(_0x47ba66){logger[_0xa909('0xa')]('data',JSON['stringify'](_0x47ba66));if(_0xbd1793[_0xa909('0xc')]&&_0xbd1793[_0xa909('0xc')][_0xa909('0xd')]&&!_[_0xa909('0x30')](_0xbd1793[_0xa909('0xb')])){setTimeout(handleSendEmail(_0xbd1793,_0x47ba66),0x3c*0x3e8);}};}function handleJob(_0x5f5403){return function(){try{if(_[_0xa909('0x30')](_0x5f5403[_0xa909('0x31')])){return logger[_0xa909('0xa')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xa909('0x30')](_0x5f5403[_0xa909('0x19')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x2a4a88={'startDate':moment()[_0xa909('0x32')](_0x5f5403[_0xa909('0x31')],_0x5f5403[_0xa909('0x19')])['format'](_0xa909('0x33')),'endDate':moment()[_0xa909('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xa909('0x34'),'output':_0x5f5403[_0xa909('0x35')],'name':_0x5f5403[_0xa909('0x18')]};if(!_[_0xa909('0x30')](_0x5f5403[_0xa909('0x36')])){logger[_0xa909('0xa')](_0xa909('0x37'),_0x5f5403[_0xa909('0x36')]);return analyticDefaultReportController[_0xa909('0x38')]({'id':_0x5f5403[_0xa909('0x36')]},_0x2a4a88)['then'](handleResult(_0x5f5403))[_0xa909('0x2e')](handleError());}if(!_['isNil'](_0x5f5403[_0xa909('0x39')])){logger[_0xa909('0xa')]('exec\x20custom\x20report\x20id:%s',_0x5f5403[_0xa909('0x39')]);return analyticCustomReportController['runReport']({'id':_0x5f5403[_0xa909('0x39')]},_0x2a4a88)[_0xa909('0x2a')](handleResult(_0x5f5403))[_0xa909('0x2e')](handleError());}}catch(_0x59e12d){logger[_0xa909('0x2b')](JSON[_0xa909('0x2f')](_0x59e12d));}return logger[_0xa909('0xa')](_0xa909('0x3a'));};}function getJobs(_0x4050ce){var _0x3266b3={};if(_0x4050ce){_0x3266b3['id']=_0x4050ce;}return db[_0xa909('0x3b')]['findAll']({'where':_0x3266b3,'include':[{'model':db[_0xa909('0xc')],'attributes':['id','name','email'],'include':[{'model':db[_0xa909('0x3c')],'as':_0xa909('0xd')}]}]})['then'](function(_0x415a2c){var _0x199002=_[_0xa909('0x3d')](manager[_0xa909('0x3e')]);var _0x503dc5=_[_0xa909('0x3f')](_0x415a2c,function(_0x4e82cd){return _0x4e82cd['id']['toString']();});var _0x205951=_[_0xa909('0x40')](_0x415a2c,function(_0x42a852){return _0x42a852['id']['toString']();});var _0x12b237=_0x4050ce?_0x503dc5:_[_0xa909('0x41')](_0x503dc5,_0x199002);var _0x271f6f=_[_0xa909('0x42')](_0x503dc5,_0x199002);var _0x437092=_[_0xa909('0x41')](_0x199002,_0x503dc5);var _0x27db3f;var _0x228be4;for(_0x27db3f=0x0;_0x27db3f<_0x437092[_0xa909('0x43')]&&!_0x4050ce;_0x27db3f+=0x1){_0x228be4=_0x437092[_0x27db3f]['toString']();if(manager['exists'](_0x228be4)){manager[_0xa909('0x44')](_0x228be4);manager[_0xa909('0x45')](_0x228be4);logger[_0xa909('0xa')]('delete\x20cron',_0x228be4);}}logger[_0xa909('0xa')](_0xa909('0x46'),JSON[_0xa909('0x2f')](_0x12b237));for(_0x27db3f=0x0;_0x27db3f<_0x12b237[_0xa909('0x43')];_0x27db3f+=0x1){_0x228be4=_0x12b237[_0x27db3f][_0xa909('0x47')]();logger[_0xa909('0xa')](_0xa909('0x48'),_0x228be4);if(_0x4050ce){logger[_0xa909('0xa')](_0xa909('0x49'),_0x4050ce);logger[_0xa909('0xa')](JSON[_0xa909('0x2f')](_0x205951[_0x228be4]));BPromise[_0xa909('0x4a')]()['then'](handleJob(_0x205951[_0x228be4]));logger[_0xa909('0xa')](_0xa909('0x4b'),_0x205951[_0x228be4][_0xa909('0x18')],_0x205951[_0x228be4]['cron']);}else if(_0x205951[_0x228be4][_0xa909('0x4c')]&&_0x205951[_0x228be4][_0xa909('0x4d')]&&moment()[_0xa909('0x4e')](_0x205951[_0x228be4][_0xa909('0x4f')],_0x205951[_0x228be4][_0xa909('0x50')])){manager['add'](_0x228be4,_0x205951[_0x228be4][_0xa909('0x4c')],handleJob(_0x205951[_0x228be4]));manager['start'](_0x228be4);logger[_0xa909('0xa')](_0xa909('0x51'),_0x205951[_0x228be4][_0xa909('0x18')],_0x205951[_0x228be4][_0xa909('0x4c')]);}else if(manager[_0xa909('0x52')](_0x228be4)){manager['stop'](_0x228be4);manager[_0xa909('0x45')](_0x228be4);logger[_0xa909('0xa')]('stop\x20cron',_0x205951[_0x228be4][_0xa909('0x18')],_0x205951[_0x228be4][_0xa909('0x4c')]);}}for(_0x27db3f=0x0,_0x228be4;_0x27db3f<_0x271f6f[_0xa909('0x43')]&&!_0x4050ce;_0x27db3f+=0x1){_0x228be4=_0x271f6f[_0x27db3f][_0xa909('0x47')]();if(manager['exists'](_0x228be4)){if(_0x205951[_0x228be4][_0xa909('0x4c')]&&_0x205951[_0x228be4][_0xa909('0x4d')]&&moment()[_0xa909('0x4e')](_0x205951[_0x228be4][_0xa909('0x4f')],_0x205951[_0x228be4][_0xa909('0x50')])){manager[_0xa909('0x53')](_0x228be4,_0x205951[_0x228be4][_0xa909('0x4c')],handleJob(_0x205951[_0x228be4]));logger['info'](_0xa909('0x54'),_0x205951[_0x228be4]['name'],_0x205951[_0x228be4]['cron']);}else{manager[_0xa909('0x44')](_0x228be4);manager[_0xa909('0x45')](_0x228be4);logger[_0xa909('0xa')](_0xa909('0x55'),_0x205951[_0x228be4]['name'],_0x205951[_0x228be4]['cron']);}}}})[_0xa909('0x2e')](function(_0x5d78b6){logger[_0xa909('0x2b')](JSON[_0xa909('0x2f')](_0x5d78b6));});}exports['run']=function(_0x2b91a3){return getJobs(_0x2b91a3);};exports[_0xa909('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xe5ad=['bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','authentication','user','pass','format','\x22%s\x22\x20<%s>','email','name','subtractNumber','savename','%s.%s','extname','join','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','email\x20sent','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','catch','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','keyBy','toString','difference','length','exists','stop','delete\x20cron','toRun','index','resolve','run\x20job','cron','active','isBetween','endAt','add','start','stop\x20cron','startAt','update','deleteJob','run','path','lodash','moment','jayson/promise'];(function(_0x457a04,_0x428ee4){var _0x581e9c=function(_0x4f13aa){while(--_0x4f13aa){_0x457a04['push'](_0x457a04['shift']());}};_0x581e9c(++_0x428ee4);}(_0xe5ad,0x1a0));var _0xde5a=function(_0x51b8f3,_0x2f4bfc){_0x51b8f3=_0x51b8f3-0x0;var _0x388f6d=_0xe5ad[_0x51b8f3];return _0x388f6d;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xde5a('0x0'));var _=require(_0xde5a('0x1'));var moment=require(_0xde5a('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xde5a('0x3'));var BPromise=require(_0xde5a('0x4'));var logger=require(_0xde5a('0x5'))(_0xde5a('0x6'));var db=require(_0xde5a('0x7'))['db'];var analyticCustomReportController=require(_0xde5a('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0xde5a('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4888c9,_0x38a411){return function(){logger[_0xde5a('0xa')](_0xde5a('0xb'),_0x4888c9['email']);var _0x29271c=!![];var _0x1514ba={'tls':{'rejectUnauthorized':![]}};if(_0x4888c9[_0xde5a('0xc')][_0xde5a('0xd')]['service']){_0x1514ba[_0xde5a('0xe')]=_0x4888c9[_0xde5a('0xc')][_0xde5a('0xd')][_0xde5a('0xe')];}else{_0x1514ba[_0xde5a('0xf')]=_0x4888c9['MailAccount'][_0xde5a('0xd')][_0xde5a('0xf')];_0x1514ba[_0xde5a('0x10')]=_0x4888c9[_0xde5a('0xc')][_0xde5a('0xd')][_0xde5a('0x10')];_0x1514ba['secure']=_0x4888c9[_0xde5a('0xc')][_0xde5a('0xd')]['secure'];}if(_0x4888c9[_0xde5a('0xc')]['Smtp'][_0xde5a('0x11')]){_0x1514ba['auth']={'user':_0x4888c9[_0xde5a('0xc')][_0xde5a('0xd')][_0xde5a('0x12')],'pass':_0x4888c9[_0xde5a('0xc')][_0xde5a('0xd')][_0xde5a('0x13')]};}var _0x533bdb={'account':_0x1514ba,'message':{'from':util[_0xde5a('0x14')](_0xde5a('0x15'),_0x4888c9['MailAccount']['name'],_0x4888c9[_0xde5a('0xc')][_0xde5a('0x16')]||_0x4888c9[_0xde5a('0xc')][_0xde5a('0xd')]['user']),'to':_0x4888c9[_0xde5a('0x16')],'cc':_0x4888c9['cc'],'bcc':_0x4888c9['bcc'],'subject':util[_0xde5a('0x14')]('Report\x20%s\x20last\x20%s\x20%s',_0x38a411[_0xde5a('0x17')],_0x4888c9[_0xde5a('0x18')],_0x4888c9['subtractUnit'])}};var _0x13e941=path['join'](__dirname,'../../files/reports');var _0x41251b=_0x38a411[_0xde5a('0x19')];var _0x31b85c=util[_0xde5a('0x14')](_0xde5a('0x1a'),path['basename'](_0x38a411[_0xde5a('0x19')],path[_0xde5a('0x1b')](_0x38a411[_0xde5a('0x19')])),'zip');var _0xfd9b2a=path[_0xde5a('0x1c')](_0x13e941,_0x41251b);var _0xd5ccba=path[_0xde5a('0x1c')](_0x13e941,_0x31b85c);if(fs['existsSync'](_0xfd9b2a)){_0x38a411[_0xde5a('0x1d')]=_0xde5a('0x1e');_0x533bdb[_0xde5a('0x1f')][_0xde5a('0x20')]=[{'filename':_0x41251b,'path':_0xfd9b2a}];_0x533bdb[_0xde5a('0x1f')][_0xde5a('0x21')]=util['format'](_0xde5a('0x22'),JSON[_0xde5a('0x23')](_0x38a411,null,0x2));}else if(fs[_0xde5a('0x24')](_0xd5ccba)){_0x38a411[_0xde5a('0x1d')]=_0xde5a('0x1e');_0x533bdb[_0xde5a('0x1f')]['attachments']=[{'filename':_0x31b85c,'path':_0xd5ccba}];}else{_0x533bdb['message'][_0xde5a('0x21')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x4888c9['sendIfEmpty']){_0x29271c=![];logger[_0xde5a('0xa')](_0xde5a('0x25'));}}if(_0x29271c){return client[_0xde5a('0x26')](_0xde5a('0x27'),_0x533bdb)['then'](function(_0x54da5){if(_0x54da5[_0xde5a('0x28')]){return logger['error']('error\x20mail',JSON['stringify'](_0x54da5));}return logger['info'](_0xde5a('0x29'));})['catch'](function(_0x3bb1e5){return logger[_0xde5a('0x28')](_0xde5a('0x2a'),JSON[_0xde5a('0x23')](_0x3bb1e5));});}};}function handleError(){return function(_0x4142de){return logger[_0xde5a('0x28')](JSON[_0xde5a('0x23')](_0x4142de));};}function handleResult(_0x4ba935){return function(_0x57f61d){logger[_0xde5a('0xa')](_0xde5a('0x2b'),JSON[_0xde5a('0x23')](_0x57f61d));if(_0x4ba935['MailAccount']&&_0x4ba935[_0xde5a('0xc')][_0xde5a('0xd')]&&!_[_0xde5a('0x2c')](_0x4ba935[_0xde5a('0x16')])){setTimeout(handleSendEmail(_0x4ba935,_0x57f61d),0x3c*0x3e8);}};}function handleJob(_0x33d3cc){return function(){try{if(_[_0xde5a('0x2c')](_0x33d3cc[_0xde5a('0x18')])){return logger[_0xde5a('0xa')](_0xde5a('0x2d'));}if(_[_0xde5a('0x2c')](_0x33d3cc[_0xde5a('0x2e')])){return logger[_0xde5a('0xa')](_0xde5a('0x2f'));}var _0x1489e8={'startDate':moment()[_0xde5a('0x30')](_0x33d3cc[_0xde5a('0x18')],_0x33d3cc['subtractUnit'])[_0xde5a('0x14')](_0xde5a('0x31')),'endDate':moment()['format'](_0xde5a('0x31')),'type':'scheduled','output':_0x33d3cc['output'],'name':_0x33d3cc[_0xde5a('0x17')]};if(!_[_0xde5a('0x2c')](_0x33d3cc[_0xde5a('0x32')])){logger[_0xde5a('0xa')](_0xde5a('0x33'),_0x33d3cc[_0xde5a('0x32')]);return analyticDefaultReportController[_0xde5a('0x34')]({'id':_0x33d3cc['DefaultReportId']},_0x1489e8)[_0xde5a('0x35')](handleResult(_0x33d3cc))['catch'](handleError());}if(!_['isNil'](_0x33d3cc['CustomReportId'])){logger['info'](_0xde5a('0x36'),_0x33d3cc[_0xde5a('0x37')]);return analyticCustomReportController[_0xde5a('0x34')]({'id':_0x33d3cc[_0xde5a('0x37')]},_0x1489e8)[_0xde5a('0x35')](handleResult(_0x33d3cc))[_0xde5a('0x38')](handleError());}}catch(_0x3b552f){logger['error'](JSON['stringify'](_0x3b552f));}return logger[_0xde5a('0xa')](_0xde5a('0x39'));};}function getJobs(_0x228dee){var _0x529da6={};if(_0x228dee){_0x529da6['id']=_0x228dee;}return db[_0xde5a('0x3a')][_0xde5a('0x3b')]({'where':_0x529da6,'include':[{'model':db['MailAccount'],'attributes':['id',_0xde5a('0x17'),_0xde5a('0x16')],'include':[{'model':db[_0xde5a('0x3c')],'as':_0xde5a('0xd')}]}]})[_0xde5a('0x35')](function(_0x31b60c){var _0x1cab30=_['keys'](manager[_0xde5a('0x3d')]);var _0x135d49=_['map'](_0x31b60c,function(_0x1d9bdf){return _0x1d9bdf['id']['toString']();});var _0x256ba2=_[_0xde5a('0x3e')](_0x31b60c,function(_0x30ce9f){return _0x30ce9f['id'][_0xde5a('0x3f')]();});var _0x1aa961=_0x228dee?_0x135d49:_[_0xde5a('0x40')](_0x135d49,_0x1cab30);var _0x28f6a9=_['intersection'](_0x135d49,_0x1cab30);var _0x4e2ba9=_['difference'](_0x1cab30,_0x135d49);var _0x7ce64f;var _0x1ffebe;for(_0x7ce64f=0x0;_0x7ce64f<_0x4e2ba9[_0xde5a('0x41')]&&!_0x228dee;_0x7ce64f+=0x1){_0x1ffebe=_0x4e2ba9[_0x7ce64f][_0xde5a('0x3f')]();if(manager[_0xde5a('0x42')](_0x1ffebe)){manager[_0xde5a('0x43')](_0x1ffebe);manager['deleteJob'](_0x1ffebe);logger['info'](_0xde5a('0x44'),_0x1ffebe);}}logger[_0xde5a('0xa')](_0xde5a('0x45'),JSON[_0xde5a('0x23')](_0x1aa961));for(_0x7ce64f=0x0;_0x7ce64f<_0x1aa961[_0xde5a('0x41')];_0x7ce64f+=0x1){_0x1ffebe=_0x1aa961[_0x7ce64f][_0xde5a('0x3f')]();logger['info'](_0xde5a('0x46'),_0x1ffebe);if(_0x228dee){logger['info']('my\x20id',_0x228dee);logger[_0xde5a('0xa')](JSON[_0xde5a('0x23')](_0x256ba2[_0x1ffebe]));BPromise[_0xde5a('0x47')]()[_0xde5a('0x35')](handleJob(_0x256ba2[_0x1ffebe]));logger['info'](_0xde5a('0x48'),_0x256ba2[_0x1ffebe]['name'],_0x256ba2[_0x1ffebe][_0xde5a('0x49')]);}else if(_0x256ba2[_0x1ffebe][_0xde5a('0x49')]&&_0x256ba2[_0x1ffebe][_0xde5a('0x4a')]&&moment()[_0xde5a('0x4b')](_0x256ba2[_0x1ffebe]['startAt'],_0x256ba2[_0x1ffebe][_0xde5a('0x4c')])){manager[_0xde5a('0x4d')](_0x1ffebe,_0x256ba2[_0x1ffebe][_0xde5a('0x49')],handleJob(_0x256ba2[_0x1ffebe]));manager[_0xde5a('0x4e')](_0x1ffebe);logger[_0xde5a('0xa')]('add\x20cron',_0x256ba2[_0x1ffebe][_0xde5a('0x17')],_0x256ba2[_0x1ffebe]['cron']);}else if(manager[_0xde5a('0x42')](_0x1ffebe)){manager['stop'](_0x1ffebe);manager['deleteJob'](_0x1ffebe);logger[_0xde5a('0xa')](_0xde5a('0x4f'),_0x256ba2[_0x1ffebe]['name'],_0x256ba2[_0x1ffebe][_0xde5a('0x49')]);}}for(_0x7ce64f=0x0,_0x1ffebe;_0x7ce64f<_0x28f6a9[_0xde5a('0x41')]&&!_0x228dee;_0x7ce64f+=0x1){_0x1ffebe=_0x28f6a9[_0x7ce64f]['toString']();if(manager[_0xde5a('0x42')](_0x1ffebe)){if(_0x256ba2[_0x1ffebe][_0xde5a('0x49')]&&_0x256ba2[_0x1ffebe]['active']&&moment()[_0xde5a('0x4b')](_0x256ba2[_0x1ffebe][_0xde5a('0x50')],_0x256ba2[_0x1ffebe]['endAt'])){manager[_0xde5a('0x51')](_0x1ffebe,_0x256ba2[_0x1ffebe][_0xde5a('0x49')],handleJob(_0x256ba2[_0x1ffebe]));logger[_0xde5a('0xa')]('update\x20cron',_0x256ba2[_0x1ffebe][_0xde5a('0x17')],_0x256ba2[_0x1ffebe][_0xde5a('0x49')]);}else{manager[_0xde5a('0x43')](_0x1ffebe);manager[_0xde5a('0x52')](_0x1ffebe);logger[_0xde5a('0xa')](_0xde5a('0x4f'),_0x256ba2[_0x1ffebe][_0xde5a('0x17')],_0x256ba2[_0x1ffebe]['cron']);}}}})[_0xde5a('0x38')](function(_0x103147){logger[_0xde5a('0x28')](JSON['stringify'](_0x103147));});}exports[_0xde5a('0x53')]=function(_0x2d2d2e){return getJobs(_0x2d2d2e);};exports[_0xde5a('0x4e')]=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 4dbfb9a..f4d2508 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 _0x72e2=['Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','Negative','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','catch','error','start','lodash','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','info','format','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','then','Cloud\x20Provider\x20not\x20available','data1','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed'];(function(_0x3247cc,_0x33dfc7){var _0x58fb80=function(_0x200d79){while(--_0x200d79){_0x3247cc['push'](_0x3247cc['shift']());}};_0x58fb80(++_0x33dfc7);}(_0x72e2,0x131));var _0x272e=function(_0x180b16,_0x3fad7f){_0x180b16=_0x180b16-0x0;var _0x1041c1=_0x72e2[_0x180b16];return _0x1041c1;};var _=require(_0x272e('0x0'));var AWS=require('aws-sdk');var rp=require(_0x272e('0x1'));var util=require('util');var BPromise=require(_0x272e('0x2'));var db=require(_0x272e('0x3'))['db'];var logger=require(_0x272e('0x4'))(_0x272e('0x5'));function getTranscriptionJob(_0x27fb80,_0x3579b0,_0x455949,_0x434b20){return new Promise(function(_0x186328,_0x1f6c17){var _0x5bfb01=new AWS[(_0x272e('0x6'))]({'accessKeyId':_0x3579b0,'secretAccessKey':_0x27fb80,'region':_0x455949});_0x5bfb01[_0x272e('0x7')]({'TranscriptionJobName':_0x434b20},function(_0x313f5c,_0x4383b7){if(_0x313f5c){return _0x1f6c17(_0x313f5c);}else{return _0x186328(_0x4383b7);}});});}function sentiment(_0x37316c,_0x1aeeae,_0x409082,_0x2a2e8a,_0x4880cc){return new Promise(function(_0x2126f9,_0x4e027b){var _0x8c98e0=new AWS['Comprehend']({'accessKeyId':_0x1aeeae,'secretAccessKey':_0x37316c,'region':_0x409082});_0x8c98e0[_0x272e('0x8')]({'Text':_0x2a2e8a,'LanguageCode':_0x4880cc[_0x272e('0x9')](0x0,0x2)},function(_0xbe0a5d,_0x5eaab0){if(_0xbe0a5d){return _0x4e027b(_0xbe0a5d);}else{return _0x2126f9(_0x5eaab0);}});});}function checkTranscribeJob(_0x4f19f3,_0x2ffe99,_0x3b62ad){var _0x414d1a;return new BPromise(function(_0x5803bd,_0x2b614d){logger['info'](util['format'](_0x272e('0xa'),_0x4f19f3['id'],_0x4f19f3[_0x272e('0xb')]));return getTranscriptionJob(_0x3b62ad['data1'],_0x3b62ad[_0x272e('0xc')],_0x2ffe99['transcribeRegion'],_0x4f19f3[_0x272e('0xb')])['then'](function(_0x1b205e){logger['info'](util['format'](_0x272e('0xd'),_0x4f19f3['id'],_0x4f19f3['transcribeName'],_0x1b205e[_0x272e('0xe')]['TranscriptionJobStatus']));if(!_0x4f19f3[_0x272e('0xf')]){switch(_0x1b205e[_0x272e('0xe')][_0x272e('0x10')]){case _0x272e('0x11'):var _0x500cbb={'transcribeStatus':_0x1b205e[_0x272e('0xe')][_0x272e('0x10')],'fileUri':_0x1b205e[_0x272e('0xe')][_0x272e('0x12')]['TranscriptFileUri']};logger[_0x272e('0x13')](util[_0x272e('0x14')]('[RECORDING:%d]\x20Get\x20transcript',_0x4f19f3['id']));return rp({'uri':_0x1b205e[_0x272e('0xe')][_0x272e('0x12')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x384b2b){logger[_0x272e('0x13')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x4f19f3['id']));if(_0x384b2b&&_0x384b2b[_0x272e('0x15')]&&_0x384b2b['results']['transcripts']&&_0x384b2b[_0x272e('0x15')][_0x272e('0x16')][_0x272e('0x17')]){_0x500cbb[_0x272e('0xf')]='';for(var _0x5d5ee1=0x0;_0x5d5ee1<_0x384b2b[_0x272e('0x15')]['transcripts'][_0x272e('0x17')];_0x5d5ee1++){_0x500cbb[_0x272e('0xf')]+=_0x384b2b[_0x272e('0x15')][_0x272e('0x16')][_0x5d5ee1]['transcript']+'';}}return _0x4f19f3[_0x272e('0x18')](_0x500cbb);})['then'](function(){logger[_0x272e('0x13')](util['format'](_0x272e('0x19'),_0x4f19f3['id']));if(!_0x4f19f3[_0x272e('0x1a')]){throw new db[(_0x272e('0x1b'))][(_0x272e('0x1c'))](_0x272e('0x1d'));}if(!_0x2ffe99['sentiment']||!_0x2ffe99[_0x272e('0x1e')]||!_0x2ffe99[_0x272e('0x1f')]||!_0x2ffe99['language']||!_0x2ffe99[_0x272e('0x20')]){throw new db[(_0x272e('0x1b'))][(_0x272e('0x1c'))](_0x272e('0x21'));}if(!_0x500cbb['fileText']){throw new Error(_0x272e('0x22'));}if(_0x2ffe99['sentimentAccountId']===_0x3b62ad['id']){return _0x3b62ad;}else{return db[_0x272e('0x23')][_0x272e('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x272e('0x25')](function(_0x5cb7b0){if(!_0x5cb7b0){throw new db[(_0x272e('0x1b'))]['ValidationError'](_0x272e('0x26'));}if(!_0x5cb7b0[_0x272e('0x27')]||!_0x5cb7b0[_0x272e('0xc')]){throw new db[(_0x272e('0x1b'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x414d1a=_0x5cb7b0;logger[_0x272e('0x13')](util[_0x272e('0x14')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4f19f3['id']));return sentiment(_0x414d1a[_0x272e('0x27')],_0x414d1a[_0x272e('0xc')],_0x2ffe99[_0x272e('0x1f')],_0x500cbb[_0x272e('0xf')],_0x2ffe99[_0x272e('0x28')]);})['then'](function(_0x4e8bcd){logger[_0x272e('0x13')](util['format'](_0x272e('0x29'),_0x4f19f3['id']));return _0x4f19f3['update']({'sentiment':_0x4e8bcd['Sentiment'],'sPositive':_0x4e8bcd[_0x272e('0x2a')][_0x272e('0x2b')],'sNegative':_0x4e8bcd[_0x272e('0x2a')]['Negative'],'sMixed':_0x4e8bcd[_0x272e('0x2a')][_0x272e('0x2c')],'sNeutral':_0x4e8bcd[_0x272e('0x2a')][_0x272e('0x2d')]});})[_0x272e('0x25')](function(){logger[_0x272e('0x13')](util[_0x272e('0x14')](_0x272e('0x19'),_0x4f19f3['id']));_0x5803bd();});case _0x272e('0x2e'):return _0x4f19f3[_0x272e('0x18')]({'transcribeStatus':_0x272e('0x2e'),'failureReason':_0x1b205e[_0x272e('0xe')][_0x272e('0x2f')]})['then'](function(){logger[_0x272e('0x13')](util[_0x272e('0x14')](_0x272e('0x19'),_0x4f19f3['id']));_0x5803bd();});default:logger['info'](util[_0x272e('0x14')](_0x272e('0x30'),_0x4f19f3['id']));break;}}else{return BPromise[_0x272e('0x31')]()[_0x272e('0x25')](function(){if(!_0x4f19f3[_0x272e('0x1a')]){throw new db[(_0x272e('0x1b'))][(_0x272e('0x1c'))](_0x272e('0x1d'));}if(!_0x2ffe99[_0x272e('0x32')]||!_0x2ffe99[_0x272e('0x1e')]||!_0x2ffe99['sentimentRegion']||!_0x2ffe99['language']||!_0x2ffe99[_0x272e('0x20')]){throw new db[(_0x272e('0x1b'))]['ValidationError'](_0x272e('0x21'));}if(!_0x4f19f3[_0x272e('0xf')]){throw new Error(_0x272e('0x22'));}if(_0x2ffe99[_0x272e('0x1e')]===_0x3b62ad['id']){return _0x3b62ad;}else{return db[_0x272e('0x23')][_0x272e('0x24')]({'where':{'id':_settings[_0x272e('0x1e')]}});}})[_0x272e('0x25')](function(_0x379206){if(!_0x379206){throw new db['Sequelize'][(_0x272e('0x1c'))](_0x272e('0x26'));}if(!_0x379206[_0x272e('0x27')]||!_0x379206[_0x272e('0xc')]){throw new db['Sequelize'][(_0x272e('0x1c'))](_0x272e('0x33'));}_0x414d1a=_0x379206;logger[_0x272e('0x13')](util[_0x272e('0x14')](_0x272e('0x34'),_0x4f19f3['id']));return sentiment(_0x414d1a[_0x272e('0x27')],_0x414d1a['data2'],_0x2ffe99['sentimentRegion'],_0x4f19f3['fileText'],_0x2ffe99[_0x272e('0x28')]);})[_0x272e('0x25')](function(_0xce7f55){logger['info'](util['format'](_0x272e('0x29'),_0x4f19f3['id']));return _0x4f19f3[_0x272e('0x18')]({'sentiment':_0xce7f55[_0x272e('0x35')],'sPositive':_0xce7f55[_0x272e('0x2a')][_0x272e('0x2b')],'sNegative':_0xce7f55[_0x272e('0x2a')][_0x272e('0x36')],'sMixed':_0xce7f55[_0x272e('0x2a')]['Mixed'],'sNeutral':_0xce7f55[_0x272e('0x2a')][_0x272e('0x2d')],'transcribeStatus':'COMPLETED'});})[_0x272e('0x25')](function(){logger[_0x272e('0x13')](util[_0x272e('0x14')](_0x272e('0x19'),_0x4f19f3['id']));_0x5803bd();});}})['catch'](function(_0x3d160c){if(_0x3d160c){if(!_0x3d160c[_0x272e('0x37')]||_0x3d160c[_0x272e('0x37')]!==_0x272e('0x38')){logger['error'](util['format'](_0x272e('0x39'),_0x4f19f3['id']),util[_0x272e('0x3a')](_0x3d160c,{'showHidden':![],'depth':null}));}}_0x5803bd();});});}function checkTranscribe(){var _0x38fc5b;var _0x2062c3;var _0xf34253;return db[_0x272e('0x3b')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x272e('0x25')](function(_0x5542ef){if(!_0x5542ef||!_0x5542ef[_0x272e('0x17')]){throw new db[(_0x272e('0x1b'))][(_0x272e('0x1c'))](_0x272e('0x3c'));}_0x38fc5b=_0x5542ef;return db[_0x272e('0x3d')][_0x272e('0x24')]({'where':{'id':0x1}});})[_0x272e('0x25')](function(_0x50f6b6){if(!_0x50f6b6){throw new db[(_0x272e('0x1b'))][(_0x272e('0x1c'))](_0x272e('0x3e'));}_0x2062c3=_0x50f6b6;if(!_0x2062c3[_0x272e('0x5')]||!_0x2062c3[_0x272e('0x3f')]||!_0x2062c3['transcribeRegion']||!_0x2062c3['language']||!_0x2062c3['bucket']){throw new db[(_0x272e('0x1b'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x272e('0x23')][_0x272e('0x24')]({'where':{'id':_0x2062c3['transcribeAccountId']}});})['then'](function(_0x224db2){if(!_0x224db2){throw new db[(_0x272e('0x1b'))][(_0x272e('0x1c'))](_0x272e('0x26'));}if(!_0x224db2[_0x272e('0x27')]||!_0x224db2[_0x272e('0xc')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xf34253=_0x224db2;var _0x275972=[];_0x38fc5b[_0x272e('0x40')](function(_0x1c422a){_0x275972[_0x272e('0x41')](checkTranscribeJob(_0x1c422a,_0x2062c3,_0xf34253));});return BPromise[_0x272e('0x42')](_0x275972);})[_0x272e('0x43')](function(_0x543c63){if(_0x543c63){if(!_0x543c63[_0x272e('0x37')]||_0x543c63[_0x272e('0x37')]!==_0x272e('0x38')){logger[_0x272e('0x44')](util[_0x272e('0x3a')](_0x543c63,{'showHidden':![],'depth':null}));}}});}exports[_0x272e('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xf644=['data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','fileText','transcript','update','then','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','error','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','data1'];(function(_0x15f8ba,_0x218e4a){var _0x598a6e=function(_0x51ff58){while(--_0x51ff58){_0x15f8ba['push'](_0x15f8ba['shift']());}};_0x598a6e(++_0x218e4a);}(_0xf644,0x8d));var _0x4f64=function(_0x4b20ed,_0xfc7fd){_0x4b20ed=_0x4b20ed-0x0;var _0x5addf6=_0xf644[_0x4b20ed];return _0x5addf6;};var _=require(_0x4f64('0x0'));var AWS=require(_0x4f64('0x1'));var rp=require(_0x4f64('0x2'));var util=require(_0x4f64('0x3'));var BPromise=require(_0x4f64('0x4'));var db=require(_0x4f64('0x5'))['db'];var logger=require(_0x4f64('0x6'))(_0x4f64('0x7'));function getTranscriptionJob(_0x144265,_0x51a914,_0x5481c0,_0x3c7ee9){return new Promise(function(_0x4945dc,_0x3a638f){var _0x23f86f=new AWS[(_0x4f64('0x8'))]({'accessKeyId':_0x51a914,'secretAccessKey':_0x144265,'region':_0x5481c0});_0x23f86f[_0x4f64('0x9')]({'TranscriptionJobName':_0x3c7ee9},function(_0x5d86ad,_0x5cfd75){if(_0x5d86ad){return _0x3a638f(_0x5d86ad);}else{return _0x4945dc(_0x5cfd75);}});});}function sentiment(_0x3521ba,_0x31ec08,_0x1bca19,_0x4d75da,_0x106380){return new Promise(function(_0x236e15,_0x1af795){var _0x1fb0e1=new AWS[(_0x4f64('0xa'))]({'accessKeyId':_0x31ec08,'secretAccessKey':_0x3521ba,'region':_0x1bca19});_0x1fb0e1[_0x4f64('0xb')]({'Text':_0x4d75da,'LanguageCode':_0x106380[_0x4f64('0xc')](0x0,0x2)},function(_0x4ba148,_0x176615){if(_0x4ba148){return _0x1af795(_0x4ba148);}else{return _0x236e15(_0x176615);}});});}function checkTranscribeJob(_0x5b7d7b,_0x199754,_0xc38555){var _0x20f08f;return new BPromise(function(_0xc7b2d7,_0x93191){logger[_0x4f64('0xd')](util[_0x4f64('0xe')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5b7d7b['id'],_0x5b7d7b[_0x4f64('0xf')]));return getTranscriptionJob(_0xc38555[_0x4f64('0x10')],_0xc38555[_0x4f64('0x11')],_0x199754[_0x4f64('0x12')],_0x5b7d7b['transcribeName'])['then'](function(_0x514763){logger[_0x4f64('0xd')](util[_0x4f64('0xe')](_0x4f64('0x13'),_0x5b7d7b['id'],_0x5b7d7b[_0x4f64('0xf')],_0x514763[_0x4f64('0x14')]['TranscriptionJobStatus']));if(!_0x5b7d7b['fileText']){switch(_0x514763[_0x4f64('0x14')][_0x4f64('0x15')]){case _0x4f64('0x16'):var _0x5ba28e={'transcribeStatus':_0x514763[_0x4f64('0x14')][_0x4f64('0x15')],'fileUri':_0x514763[_0x4f64('0x14')][_0x4f64('0x17')]['TranscriptFileUri']};logger[_0x4f64('0xd')](util[_0x4f64('0xe')](_0x4f64('0x18'),_0x5b7d7b['id']));return rp({'uri':_0x514763['TranscriptionJob'][_0x4f64('0x17')][_0x4f64('0x19')],'json':!![]})['then'](function(_0x3f3c4b){logger[_0x4f64('0xd')](util['format'](_0x4f64('0x1a'),_0x5b7d7b['id']));if(_0x3f3c4b&&_0x3f3c4b[_0x4f64('0x1b')]&&_0x3f3c4b[_0x4f64('0x1b')][_0x4f64('0x1c')]&&_0x3f3c4b[_0x4f64('0x1b')][_0x4f64('0x1c')]['length']){_0x5ba28e[_0x4f64('0x1d')]='';for(var _0x2d19d9=0x0;_0x2d19d9<_0x3f3c4b[_0x4f64('0x1b')][_0x4f64('0x1c')]['length'];_0x2d19d9++){_0x5ba28e['fileText']+=_0x3f3c4b['results'][_0x4f64('0x1c')][_0x2d19d9][_0x4f64('0x1e')]+'';}}return _0x5b7d7b[_0x4f64('0x1f')](_0x5ba28e);})[_0x4f64('0x20')](function(){logger[_0x4f64('0xd')](util[_0x4f64('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5b7d7b['id']));if(!_0x5b7d7b[_0x4f64('0x21')]){throw new db[(_0x4f64('0x22'))][(_0x4f64('0x23'))](_0x4f64('0x24'));}if(!_0x199754[_0x4f64('0x25')]||!_0x199754[_0x4f64('0x26')]||!_0x199754[_0x4f64('0x27')]||!_0x199754['language']||!_0x199754['bucket']){throw new db['Sequelize']['ValidationError'](_0x4f64('0x28'));}if(!_0x5ba28e['fileText']){throw new Error(_0x4f64('0x29'));}if(_0x199754[_0x4f64('0x26')]===_0xc38555['id']){return _0xc38555;}else{return db[_0x4f64('0x2a')][_0x4f64('0x2b')]({'where':{'id':_settings[_0x4f64('0x26')]}});}})['then'](function(_0x171e38){if(!_0x171e38){throw new db[(_0x4f64('0x22'))]['ValidationError'](_0x4f64('0x2c'));}if(!_0x171e38[_0x4f64('0x10')]||!_0x171e38['data2']){throw new db[(_0x4f64('0x22'))]['ValidationError'](_0x4f64('0x2d'));}_0x20f08f=_0x171e38;logger['info'](util[_0x4f64('0xe')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5b7d7b['id']));return sentiment(_0x20f08f[_0x4f64('0x10')],_0x20f08f[_0x4f64('0x11')],_0x199754['sentimentRegion'],_0x5ba28e[_0x4f64('0x1d')],_0x199754[_0x4f64('0x2e')]);})[_0x4f64('0x20')](function(_0x29f3d6){logger[_0x4f64('0xd')](util[_0x4f64('0xe')](_0x4f64('0x2f'),_0x5b7d7b['id']));return _0x5b7d7b['update']({'sentiment':_0x29f3d6[_0x4f64('0x30')],'sPositive':_0x29f3d6[_0x4f64('0x31')][_0x4f64('0x32')],'sNegative':_0x29f3d6['SentimentScore'][_0x4f64('0x33')],'sMixed':_0x29f3d6['SentimentScore'][_0x4f64('0x34')],'sNeutral':_0x29f3d6['SentimentScore'][_0x4f64('0x35')]});})[_0x4f64('0x20')](function(){logger['info'](util[_0x4f64('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5b7d7b['id']));_0xc7b2d7();});case _0x4f64('0x36'):return _0x5b7d7b['update']({'transcribeStatus':'FAILED','failureReason':_0x514763[_0x4f64('0x14')][_0x4f64('0x37')]})[_0x4f64('0x20')](function(){logger['info'](util[_0x4f64('0xe')](_0x4f64('0x38'),_0x5b7d7b['id']));_0xc7b2d7();});default:logger[_0x4f64('0xd')](util[_0x4f64('0xe')](_0x4f64('0x39'),_0x5b7d7b['id']));break;}}else{return BPromise[_0x4f64('0x3a')]()[_0x4f64('0x20')](function(){if(!_0x5b7d7b[_0x4f64('0x21')]){throw new db[(_0x4f64('0x22'))][(_0x4f64('0x23'))](_0x4f64('0x24'));}if(!_0x199754[_0x4f64('0x25')]||!_0x199754['sentimentAccountId']||!_0x199754['sentimentRegion']||!_0x199754['language']||!_0x199754[_0x4f64('0x3b')]){throw new db[(_0x4f64('0x22'))][(_0x4f64('0x23'))](_0x4f64('0x28'));}if(!_0x5b7d7b[_0x4f64('0x1d')]){throw new Error('Transcript\x20not\x20available');}if(_0x199754[_0x4f64('0x26')]===_0xc38555['id']){return _0xc38555;}else{return db[_0x4f64('0x2a')][_0x4f64('0x2b')]({'where':{'id':_settings[_0x4f64('0x26')]}});}})[_0x4f64('0x20')](function(_0x23ef7d){if(!_0x23ef7d){throw new db[(_0x4f64('0x22'))][(_0x4f64('0x23'))](_0x4f64('0x2c'));}if(!_0x23ef7d[_0x4f64('0x10')]||!_0x23ef7d['data2']){throw new db['Sequelize'][(_0x4f64('0x23'))](_0x4f64('0x2d'));}_0x20f08f=_0x23ef7d;logger[_0x4f64('0xd')](util['format'](_0x4f64('0x3c'),_0x5b7d7b['id']));return sentiment(_0x20f08f[_0x4f64('0x10')],_0x20f08f[_0x4f64('0x11')],_0x199754['sentimentRegion'],_0x5b7d7b[_0x4f64('0x1d')],_0x199754['language']);})[_0x4f64('0x20')](function(_0x521352){logger[_0x4f64('0xd')](util[_0x4f64('0xe')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5b7d7b['id']));return _0x5b7d7b[_0x4f64('0x1f')]({'sentiment':_0x521352[_0x4f64('0x30')],'sPositive':_0x521352['SentimentScore']['Positive'],'sNegative':_0x521352['SentimentScore'][_0x4f64('0x33')],'sMixed':_0x521352['SentimentScore']['Mixed'],'sNeutral':_0x521352['SentimentScore'][_0x4f64('0x35')],'transcribeStatus':_0x4f64('0x16')});})['then'](function(){logger[_0x4f64('0xd')](util[_0x4f64('0xe')](_0x4f64('0x38'),_0x5b7d7b['id']));_0xc7b2d7();});}})[_0x4f64('0x3d')](function(_0x3542f3){if(_0x3542f3){if(!_0x3542f3[_0x4f64('0x3e')]||_0x3542f3[_0x4f64('0x3e')]!==_0x4f64('0x3f')){logger['error'](util['format'](_0x4f64('0x40'),_0x5b7d7b['id']),util[_0x4f64('0x41')](_0x3542f3,{'showHidden':![],'depth':null}));}}_0xc7b2d7();});});}function checkTranscribe(){var _0x3e238e;var _0x5c6ca0;var _0x6b7b09;return db[_0x4f64('0x42')]['findAll']({'where':{'transcribeStatus':_0x4f64('0x43')}})[_0x4f64('0x20')](function(_0x5c70e8){if(!_0x5c70e8||!_0x5c70e8[_0x4f64('0x44')]){throw new db[(_0x4f64('0x22'))][(_0x4f64('0x23'))](_0x4f64('0x45'));}_0x3e238e=_0x5c70e8;return db[_0x4f64('0x46')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x10c49e){if(!_0x10c49e){throw new db[(_0x4f64('0x22'))][(_0x4f64('0x23'))](_0x4f64('0x47'));}_0x5c6ca0=_0x10c49e;if(!_0x5c6ca0[_0x4f64('0x7')]||!_0x5c6ca0[_0x4f64('0x48')]||!_0x5c6ca0[_0x4f64('0x12')]||!_0x5c6ca0[_0x4f64('0x2e')]||!_0x5c6ca0[_0x4f64('0x3b')]){throw new db[(_0x4f64('0x22'))][(_0x4f64('0x23'))](_0x4f64('0x49'));}return db['CloudProvider'][_0x4f64('0x2b')]({'where':{'id':_0x5c6ca0[_0x4f64('0x48')]}});})[_0x4f64('0x20')](function(_0x3d16db){if(!_0x3d16db){throw new db[(_0x4f64('0x22'))][(_0x4f64('0x23'))](_0x4f64('0x2c'));}if(!_0x3d16db['data1']||!_0x3d16db[_0x4f64('0x11')]){throw new db[(_0x4f64('0x22'))][(_0x4f64('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x6b7b09=_0x3d16db;var _0x2c2e71=[];_0x3e238e[_0x4f64('0x4a')](function(_0x585a63){_0x2c2e71[_0x4f64('0x4b')](checkTranscribeJob(_0x585a63,_0x5c6ca0,_0x6b7b09));});return BPromise[_0x4f64('0x4c')](_0x2c2e71);})[_0x4f64('0x3d')](function(_0x1ad514){if(_0x1ad514){if(!_0x1ad514[_0x4f64('0x3e')]||_0x1ad514['name']!==_0x4f64('0x3f')){logger[_0x4f64('0x4d')](util[_0x4f64('0x41')](_0x1ad514,{'showHidden':![],'depth':null}));}}});}exports[_0x4f64('0x4e')]=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 d5a5406..ddc85d8 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 _0x451d=['whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','timeout','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x451d,0x1a3));var _0xd451=function(_0x21415f,_0x9c483d){_0x21415f=_0x21415f-0x0;var _0x3ca17a=_0x451d[_0x21415f];return _0x3ca17a;};'use strict';var _=require(_0xd451('0x0'));var moment=require(_0xd451('0x1'));var Redis=require(_0xd451('0x2'));var util=require(_0xd451('0x3'));var config=require('../../config/environment');var db=require(_0xd451('0x4'))['db'];var logger=require(_0xd451('0x5'))(_0xd451('0x6'));config[_0xd451('0x7')]=_[_0xd451('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd451('0x9'))(new Redis(config[_0xd451('0x7')]));function closeInteractions(){var _0x35718c=[];return db[_0xd451('0xa')][_0xd451('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xd451('0xc'))}}})[_0xd451('0xd')](function(_0x450215){if(_0x450215&&_0x450215['length']){_0x35718c=_[_0xd451('0xe')](_0x450215||[],'id');logger[_0xd451('0xf')](_0xd451('0x10'),_0x35718c[_0xd451('0x11')]());return db['WhatsappInteraction']['update']({'closeReason':'system','disposition':_0xd451('0x12'),'closed':!![],'closedAt':moment()['format'](_0xd451('0x13'))},{'where':{'id':_0x35718c}});}})[_0xd451('0xd')](function(){if(_0x35718c&&_0x35718c[_0xd451('0x14')]){logger[_0xd451('0xf')](_0xd451('0x15'),_0x35718c[_0xd451('0x11')]());for(var _0x163441=0x0;_0x163441<_0x35718c[_0xd451('0x14')];_0x163441++){io[_0xd451('0x16')](_0xd451('0x17'),{'id':_0x35718c[_0x163441],'closed':!![]});}}})[_0xd451('0x18')](function(_0x185fd0){logger['error'](_0xd451('0x19'),_0x185fd0?util['inspect'](_0x185fd0,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x4b13=['schedule','defaults','localhost','WhatsappInteraction','subtract','hours','then','length','info','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x4b13,0x1f0));var _0x34b1=function(_0x4d5251,_0x5ca174){_0x4d5251=_0x4d5251-0x0;var _0x3a3cee=_0x4b13[_0x4d5251];return _0x3a3cee;};'use strict';var _=require(_0x34b1('0x0'));var moment=require(_0x34b1('0x1'));var Redis=require(_0x34b1('0x2'));var util=require('util');var config=require(_0x34b1('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x34b1('0x4'));config['redis']=_[_0x34b1('0x5')](config['redis'],{'host':_0x34b1('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x4696b3=[];return db[_0x34b1('0x7')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x34b1('0x8')](0x18,_0x34b1('0x9'))}}})[_0x34b1('0xa')](function(_0x43a086){if(_0x43a086&&_0x43a086[_0x34b1('0xb')]){_0x4696b3=_['map'](_0x43a086||[],'id');logger[_0x34b1('0xc')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4696b3[_0x34b1('0xd')]());return db[_0x34b1('0x7')]['update']({'closeReason':_0x34b1('0xe'),'disposition':_0x34b1('0xf'),'closed':!![],'closedAt':moment()[_0x34b1('0x10')](_0x34b1('0x11'))},{'where':{'id':_0x4696b3}});}})['then'](function(){if(_0x4696b3&&_0x4696b3[_0x34b1('0xb')]){logger[_0x34b1('0xc')](_0x34b1('0x12'),_0x4696b3['join']());for(var _0x3bd9c0=0x0;_0x3bd9c0<_0x4696b3[_0x34b1('0xb')];_0x3bd9c0++){io['emit'](_0x34b1('0x13'),{'id':_0x4696b3[_0x3bd9c0],'closed':!![]});}}})[_0x34b1('0x14')](function(_0x4b4b88){logger[_0x34b1('0x15')](_0x34b1('0x16'),_0x4b4b88?util[_0x34b1('0x17')](_0x4b4b88,{'showHidden':![],'depth':null}):'');});}exports[_0x34b1('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index d505800..a45daf9 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3734=['Biondo','@xcally.com','now','innocenzo.biondo','CmContact','destroy','then','finished\x20populating','bulkCreate','log','CmHopper','hopper2','push','Innocenzo'];(function(_0x47354e,_0x4328c9){var _0x46cbe2=function(_0x30f8bb){while(--_0x30f8bb){_0x47354e['push'](_0x47354e['shift']());}};_0x46cbe2(++_0x4328c9);}(_0x3734,0x98));var _0x4373=function(_0x4efe4f,_0x5df9d6){_0x4efe4f=_0x4efe4f-0x0;var _0x5111bc=_0x3734[_0x4efe4f];return _0x5111bc;};'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[_0x4373('0x0')]({'id':i,'firstName':_0x4373('0x1')+i,'lastName':_0x4373('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x4373('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4373('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x4373('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x4373('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4373('0x0')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4373('0x2')+i,'phone':0xf879fb460+i,'email':_0x4373('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4373('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x4373('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4373('0x4')](),'updatedAt':Date[_0x4373('0x4')]()});}db[_0x4373('0x6')][_0x4373('0x7')]({'where':{}})['then'](function(){return db[_0x4373('0x6')]['bulkCreate'](contacts);})[_0x4373('0x8')](function(){console['log'](_0x4373('0x9'),'contacts1');return db['CmHopper'][_0x4373('0x7')]({'where':{}});})[_0x4373('0x8')](function(){return db['CmHopper'][_0x4373('0xa')](hopper);})[_0x4373('0x8')](function(){console[_0x4373('0xb')](_0x4373('0x9'),'hopper1');return db['CmContact']['bulkCreate'](contacts2);})[_0x4373('0x8')](function(){console[_0x4373('0xb')](_0x4373('0x9'),'contacts2');return db[_0x4373('0xc')][_0x4373('0xa')](hopper2);})[_0x4373('0x8')](function(){console[_0x4373('0xb')](_0x4373('0x9'),_0x4373('0xd'));})['catch'](function(_0x3a96ed){console[_0x4373('0xb')](_0x3a96ed);}); \ No newline at end of file +var _0x37ae=['then','log','finished\x20populating','contacts1','CmHopper','destroy','bulkCreate','contacts2','hopper2','util','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x37ae,0x16e));var _0xe37a=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x37ae[_0x550d12];return _0x12103d;};'use strict';var util=require(_0xe37a('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe37a('0x1')]({'id':i,'firstName':_0xe37a('0x2')+i,'lastName':_0xe37a('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xe37a('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe37a('0x5')](),'updatedAt':Date[_0xe37a('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xe37a('0x3')+i,'phone':0xf879fb460+i,'email':_0xe37a('0x6')+i+_0xe37a('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe37a('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xe37a('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0xe37a('0x7')]['destroy']({'where':{}})[_0xe37a('0x8')](function(){return db[_0xe37a('0x7')]['bulkCreate'](contacts);})[_0xe37a('0x8')](function(){console[_0xe37a('0x9')](_0xe37a('0xa'),_0xe37a('0xb'));return db[_0xe37a('0xc')][_0xe37a('0xd')]({'where':{}});})[_0xe37a('0x8')](function(){return db['CmHopper'][_0xe37a('0xe')](hopper);})[_0xe37a('0x8')](function(){console[_0xe37a('0x9')](_0xe37a('0xa'),'hopper1');return db[_0xe37a('0x7')]['bulkCreate'](contacts2);})['then'](function(){console['log'](_0xe37a('0xa'),_0xe37a('0xf'));return db[_0xe37a('0xc')]['bulkCreate'](hopper2);})[_0xe37a('0x8')](function(){console['log'](_0xe37a('0xa'),_0xe37a('0x10'));})['catch'](function(_0x1b91b6){console[_0xe37a('0x9')](_0x1b91b6);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e161f1b..4415097 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf251=['agent','password','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s'];(function(_0x14e5e0,_0x478f9c){var _0x2076de=function(_0x339a20){while(--_0x339a20){_0x14e5e0['push'](_0x14e5e0['shift']());}};_0x2076de(++_0x478f9c);}(_0xf251,0xb8));var _0x1f25=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xf251[_0x1a7846];return _0x48049;};'use strict';var util=require(_0x1f25('0x0'));var db=require(_0x1f25('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1f25('0x2')]({'name':util[_0x1f25('0x3')](_0x1f25('0x4'),'agent',i),'fullname':util['format'](_0x1f25('0x4'),'agent',i),'email':util[_0x1f25('0x3')]('%s%s@xcally.com','agent',i),'role':_0x1f25('0x5'),'password':_0x1f25('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x1f25('0x7'),'ws','wss'],'disallow':[_0x1f25('0x8')],'allow':[_0x1f25('0x9')],'defaultuser':util[_0x1f25('0x3')](_0x1f25('0x4'),_0x1f25('0x5'),i),'encryption':_0x1f25('0xa'),'avpf':_0x1f25('0xa'),'force_avp':_0x1f25('0xa'),'icesupport':'yes','dtlsenable':_0x1f25('0xa'),'dtlsverify':'no','dtlscertfile':_0x1f25('0xb'),'dtlsprivatekey':_0x1f25('0xc'),'dtlssetup':_0x1f25('0xd'),'callerid':util[_0x1f25('0x3')](_0x1f25('0xe'),util['format'](_0x1f25('0x4'),_0x1f25('0x5'),i),0xfa0+i)});}db[_0x1f25('0xf')][_0x1f25('0x10')](users)[_0x1f25('0x11')](function(){console[_0x1f25('0x12')](_0x1f25('0x13'));})[_0x1f25('0x14')](function(_0x174b9d){console[_0x1f25('0x12')](_0x174b9d);}); \ No newline at end of file +var _0x82c2=['actpass','User','log','add\x20user','util','%s%s','agent','format','%s%s@xcally.com','password','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x82c2,0xf4));var _0x282c=function(_0x6d070a,_0x47e825){_0x6d070a=_0x6d070a-0x0;var _0x2c065d=_0x82c2[_0x6d070a];return _0x2c065d;};'use strict';var util=require(_0x282c('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x282c('0x1'),_0x282c('0x2'),i),'fullname':util['format'](_0x282c('0x1'),_0x282c('0x2'),i),'email':util[_0x282c('0x3')](_0x282c('0x4'),_0x282c('0x2'),i),'role':'agent','password':_0x282c('0x5'),'internal':0xfa0+i,'type':'friend','transport':[_0x282c('0x6'),'ws',_0x282c('0x7')],'disallow':[_0x282c('0x8')],'allow':['ulaw'],'defaultuser':util[_0x282c('0x3')]('%s%s','agent',i),'encryption':_0x282c('0x9'),'avpf':'yes','force_avp':_0x282c('0x9'),'icesupport':_0x282c('0x9'),'dtlsenable':_0x282c('0x9'),'dtlsverify':'no','dtlscertfile':_0x282c('0xa'),'dtlsprivatekey':_0x282c('0xb'),'dtlssetup':_0x282c('0xc'),'callerid':util[_0x282c('0x3')]('\x22%s\x22\x20<%s>',util[_0x282c('0x3')]('%s%s','agent',i),0xfa0+i)});}db[_0x282c('0xd')]['bulkCreate'](users)['then'](function(){console[_0x282c('0xe')](_0x282c('0xf'));})['catch'](function(_0x25341c){console['log'](_0x25341c);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index ce35a0b..565c9a3 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d0d=['then','map','User','where','Campaign','%s:queue:%s','format','query','find','userProfileId','handshake','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','user:%s','admin','voice:inbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','VoiceQueue','FaxQueues','SmsQueue','Telephones','IvrCampaigns','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','WhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','role','telephone','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','UserProfileResource','resourceId'];(function(_0x41b38f,_0xb90fd4){var _0x358d01=function(_0xba7d38){while(--_0xba7d38){_0x41b38f['push'](_0x41b38f['shift']());}};_0x358d01(++_0xb90fd4);}(_0x1d0d,0x184));var _0xd1d0=function(_0x11db20,_0x3a411a){_0x11db20=_0x11db20-0x0;var _0x1f5019=_0x1d0d[_0x11db20];return _0x1f5019;};'use strict';var _=require(_0xd1d0('0x0'));var util=require(_0xd1d0('0x1'));var BPromise=require(_0xd1d0('0x2'));var db=require(_0xd1d0('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xd1d0('0x4')],'include':[{'as':_0xd1d0('0x5'),'model':db['User'],'attributes':['id',_0xd1d0('0x4'),_0xd1d0('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd1d0('0x4')],'where':{'role':_0xd1d0('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xd1d0('0x4')],'where':{'role':_0xd1d0('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd1d0('0x4'),_0xd1d0('0x9')],'where':{'type':_0xd1d0('0xa')}};function getAssociatedResources(_0x374a19,_0x30389f,_0x100b48){return db[_0xd1d0('0xb')][_0xd1d0('0xc')]({'where':{'name':_0x374a19,'userProfileId':_0x30389f},'raw':!![]})['then'](function(_0x329775){if(_0x329775){if(_0x329775[_0xd1d0('0xd')]){switch(_0x374a19){case _0xd1d0('0xe'):case _0xd1d0('0xf'):case'FaxQueues':case _0xd1d0('0x10'):case _0xd1d0('0x11'):case _0xd1d0('0x12'):case _0xd1d0('0x13'):return db[_0x100b48][_0xd1d0('0x14')](queryQueues);case'Telephones':return db[_0x100b48][_0xd1d0('0x14')](queryTelephones);case _0xd1d0('0x15'):return db[_0x100b48][_0xd1d0('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x100b48][_0xd1d0('0x14')](queryCampaigns);}}else{return db[_0xd1d0('0x16')][_0xd1d0('0x14')]({'attributes':[_0xd1d0('0x17')],'where':{'sectionId':_0x329775['id']},'raw':!![]})[_0xd1d0('0x18')](function(_0x17bd9b){if(_0x17bd9b){var _0x2d1051={'where':{'id':_[_0xd1d0('0x19')](_0x17bd9b,_0xd1d0('0x17'))},'raw':!![]};switch(_0x100b48){case _0xd1d0('0x1a'):_0x2d1051[_0xd1d0('0x1b')]['role']=_0xd1d0('0x7');break;case _0xd1d0('0x1c'):_0x2d1051[_0xd1d0('0x1b')]['type']='ivr';break;}return db[_0x100b48][_0xd1d0('0x14')](_0x2d1051);}else{return[];}});}}else{return[];}})[_0xd1d0('0x18')](function(_0x5d7765){return _0x5d7765;});}function joinOrLeaveQueues(_0x334985,_0x3d9fc9,_0x51759d,_0x36623d){_0x334985[_0x3d9fc9](util['format'](_0xd1d0('0x1d'),_0x51759d,_0x36623d[_0xd1d0('0x4')]));if(_0x36623d['Agents']){for(var _0x1e11a4=0x0;_0x1e11a4<_0x36623d['Agents']['length'];_0x1e11a4+=0x1){_0x334985[_0x3d9fc9](util[_0xd1d0('0x1e')]('user:%s',_0x36623d[_0xd1d0('0x5')][_0x1e11a4][_0xd1d0('0x4')]));}}}function joinOrLeave(_0xf357cd,_0x2064d3,_0x272ea2){var _0x3169c7;if(_0xf357cd['handshake'][_0xd1d0('0x1f')]['id']){db[_0xd1d0('0x1a')][_0xd1d0('0x20')]({'attributes':['id','name',_0xd1d0('0x6'),_0xd1d0('0x21')],'where':{'id':_0xf357cd[_0xd1d0('0x22')][_0xd1d0('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xd1d0('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xd1d0('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xd1d0('0x25')],'as':_0xd1d0('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xd1d0('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd1d0('0x28')],'as':_0xd1d0('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xd1d0('0x2a')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x5b9735){if(_0x5b9735){_0x3169c7=_0x5b9735;_0xf357cd[_0x2064d3](util[_0xd1d0('0x1e')](_0xd1d0('0x2b'),_0x5b9735[_0xd1d0('0x4')]));var _0x51c5fb=[];switch(_0x5b9735[_0xd1d0('0x6')]){case _0xd1d0('0x2c'):_0xf357cd[_0x2064d3](_0xd1d0('0x2d'));_0xf357cd[_0x2064d3]('voice:outbound');if(queryQueues[_0xd1d0('0x2e')](_0xd1d0('0x2f'))){delete queryQueues[_0xd1d0('0x2f')];}_0x51c5fb[_0xd1d0('0x30')](db['VoiceQueue'][_0xd1d0('0x14')](queryQueues));_0x51c5fb[_0xd1d0('0x30')](db[_0xd1d0('0x31')][_0xd1d0('0x14')](queryQueues));_0x51c5fb[_0xd1d0('0x30')](db[_0xd1d0('0x32')][_0xd1d0('0x14')](queryQueues));_0x51c5fb[_0xd1d0('0x30')](db['SmsQueue'][_0xd1d0('0x14')](queryQueues));_0x51c5fb['push'](db[_0xd1d0('0x33')][_0xd1d0('0x14')](queryQueues));_0x51c5fb[_0xd1d0('0x30')](db[_0xd1d0('0x34')]['findAll'](queryQueues));_0x51c5fb[_0xd1d0('0x30')](db[_0xd1d0('0x35')][_0xd1d0('0x14')](queryQueues));_0x51c5fb[_0xd1d0('0x30')](db['User'][_0xd1d0('0x14')](queryTelephones));_0x51c5fb[_0xd1d0('0x30')](db[_0xd1d0('0x36')][_0xd1d0('0x14')](queryTrunks));_0x51c5fb[_0xd1d0('0x30')](db[_0xd1d0('0x1c')][_0xd1d0('0x14')](queryCampaigns));_0x51c5fb['push'](db[_0xd1d0('0x1a')]['findAll'](queryAgents));break;case _0xd1d0('0x37'):_0xf357cd[_0x2064d3](_0xd1d0('0x2d'));_0xf357cd[_0x2064d3](_0xd1d0('0x38'));_0x51c5fb[_0xd1d0('0x30')](getAssociatedResources(_0xd1d0('0xe'),_0x5b9735['userProfileId'],_0xd1d0('0x39')));_0x51c5fb['push'](getAssociatedResources(_0xd1d0('0xf'),_0x5b9735[_0xd1d0('0x21')],_0xd1d0('0x31')));_0x51c5fb['push'](getAssociatedResources(_0xd1d0('0x3a'),_0x5b9735['userProfileId'],_0xd1d0('0x32')));_0x51c5fb['push'](getAssociatedResources(_0xd1d0('0x10'),_0x5b9735['userProfileId'],_0xd1d0('0x3b')));_0x51c5fb[_0xd1d0('0x30')](getAssociatedResources('MailQueues',_0x5b9735['userProfileId'],_0xd1d0('0x33')));_0x51c5fb[_0xd1d0('0x30')](getAssociatedResources(_0xd1d0('0x12'),_0x5b9735[_0xd1d0('0x21')],_0xd1d0('0x34')));_0x51c5fb[_0xd1d0('0x30')](getAssociatedResources(_0xd1d0('0x13'),_0x5b9735['userProfileId'],_0xd1d0('0x35')));_0x51c5fb[_0xd1d0('0x30')](getAssociatedResources(_0xd1d0('0x3c'),_0x5b9735['userProfileId'],_0xd1d0('0x1a')));_0x51c5fb[_0xd1d0('0x30')](getAssociatedResources(_0xd1d0('0x15'),_0x5b9735['userProfileId'],'Trunk'));_0x51c5fb[_0xd1d0('0x30')](getAssociatedResources(_0xd1d0('0x3d'),_0x5b9735['userProfileId'],_0xd1d0('0x1c')));_0x51c5fb[_0xd1d0('0x30')](db[_0xd1d0('0x1a')][_0xd1d0('0x14')](queryAgents));break;case _0xd1d0('0x8'):_0xf357cd[_0x2064d3](_0xd1d0('0x2d'));_0xf357cd[_0x2064d3](_0xd1d0('0x38'));_0x51c5fb[_0xd1d0('0x30')](_0x5b9735[_0xd1d0('0x3e')]({'attributes':['id',_0xd1d0('0x4')]}));_0x51c5fb[_0xd1d0('0x30')](_0x5b9735['getChatQueues']({'attributes':['id',_0xd1d0('0x4')]}));_0x51c5fb[_0xd1d0('0x30')](_0x5b9735[_0xd1d0('0x3f')]({'attributes':['id',_0xd1d0('0x4')]}));_0x51c5fb['push'](_0x5b9735[_0xd1d0('0x40')]({'attributes':['id',_0xd1d0('0x4')]}));_0x51c5fb[_0xd1d0('0x30')](_0x5b9735[_0xd1d0('0x41')]({'attributes':['id','name']}));_0x51c5fb[_0xd1d0('0x30')](_0x5b9735[_0xd1d0('0x42')]({'attributes':['id','name']}));_0x51c5fb[_0xd1d0('0x30')](_0x5b9735[_0xd1d0('0x43')]({'attributes':['id',_0xd1d0('0x4')]}));break;}return BPromise[_0xd1d0('0x44')](_0x51c5fb);}})[_0xd1d0('0x18')](function(_0x571a01){if(_0x571a01&&_0x571a01['length']){for(var _0x1e2179=0x0;_0x1e2179<_0x571a01[_0xd1d0('0x45')];_0x1e2179+=0x1){for(var _0x61e3=0x0;_0x61e3<_0x571a01[_0x1e2179]['length'];_0x61e3+=0x1){switch(_0x1e2179){case 0x0:joinOrLeaveQueues(_0xf357cd,_0x2064d3,_0xd1d0('0x46'),_0x571a01[_0x1e2179][_0x61e3]);break;case 0x1:joinOrLeaveQueues(_0xf357cd,_0x2064d3,_0xd1d0('0x47'),_0x571a01[_0x1e2179][_0x61e3]);break;case 0x2:joinOrLeaveQueues(_0xf357cd,_0x2064d3,_0xd1d0('0x48'),_0x571a01[_0x1e2179][_0x61e3]);break;case 0x3:joinOrLeaveQueues(_0xf357cd,_0x2064d3,_0xd1d0('0x49'),_0x571a01[_0x1e2179][_0x61e3]);break;case 0x4:joinOrLeaveQueues(_0xf357cd,_0x2064d3,_0xd1d0('0x4a'),_0x571a01[_0x1e2179][_0x61e3]);break;case 0x5:joinOrLeaveQueues(_0xf357cd,_0x2064d3,_0xd1d0('0x4b'),_0x571a01[_0x1e2179][_0x61e3]);break;case 0x6:joinOrLeaveQueues(_0xf357cd,_0x2064d3,_0xd1d0('0x4c'),_0x571a01[_0x1e2179][_0x61e3]);break;case 0x7:if(_0x3169c7[_0xd1d0('0x6')]!==_0xd1d0('0x8'))_0xf357cd[_0x2064d3](util['format'](_0xd1d0('0x4d'),_0x571a01[_0x1e2179][_0x61e3][_0xd1d0('0x4')]));break;case 0x8:if(_0x3169c7[_0xd1d0('0x6')]!=='agent')_0xf357cd[_0x2064d3](util['format']('trunk:%s',_0x571a01[_0x1e2179][_0x61e3][_0xd1d0('0x4')]));break;case 0x9:if(_0x3169c7[_0xd1d0('0x6')]!=='agent')_0xf357cd[_0x2064d3](util['format'](_0xd1d0('0x4e'),_0x571a01[_0x1e2179][_0x61e3]['type'],_0x571a01[_0x1e2179][_0x61e3][_0xd1d0('0x4')]));break;case 0xa:_0xf357cd[_0x2064d3](util[_0xd1d0('0x1e')](_0xd1d0('0x2b'),_0x571a01[_0x1e2179][_0x61e3][_0xd1d0('0x4')]));break;}}}}})[_0xd1d0('0x18')](function(){if(_0x2064d3===_0xd1d0('0x4f')){var _0x4b25bd=_['map'](_0x3169c7['ChatInteractions'],'id');return _0x3169c7['removeChatInteractions'](_0x4b25bd)[_0xd1d0('0x18')](function(){for(var _0x51b987=0x0;_0x51b987<_0x4b25bd['length'];_0x51b987+=0x1){_0x272ea2[_0xd1d0('0x50')](_0xd1d0('0x51'),{'ChatInteractionId':Number(_0x4b25bd[_0x51b987]),'UserId':Number(_0x3169c7['id'])});}});}})[_0xd1d0('0x18')](function(){if(_0x2064d3===_0xd1d0('0x4f')){var _0x16aded=_[_0xd1d0('0x19')](_0x3169c7[_0xd1d0('0x24')],'id');return _0x3169c7[_0xd1d0('0x52')](_0x16aded)[_0xd1d0('0x18')](function(){for(var _0x384e65=0x0;_0x384e65<_0x16aded[_0xd1d0('0x45')];_0x384e65+=0x1){_0x272ea2[_0xd1d0('0x50')](_0xd1d0('0x53'),{'MailInteractionId':Number(_0x16aded[_0x384e65]),'UserId':Number(_0x3169c7['id'])});}});}})[_0xd1d0('0x18')](function(){if(_0x2064d3===_0xd1d0('0x4f')){var _0x4f05b7=_[_0xd1d0('0x19')](_0x3169c7[_0xd1d0('0x26')],'id');return _0x3169c7['removeFaxInteractions'](_0x4f05b7)['then'](function(){for(var _0x5520d1=0x0;_0x5520d1<_0x4f05b7['length'];_0x5520d1+=0x1){_0x272ea2[_0xd1d0('0x50')](_0xd1d0('0x54'),{'FaxInteractionId':Number(_0x4f05b7[_0x5520d1]),'UserId':Number(_0x3169c7['id'])});}});}})[_0xd1d0('0x18')](function(){if(_0x2064d3===_0xd1d0('0x4f')){var _0x1b713e=_['map'](_0x3169c7[_0xd1d0('0x55')],'id');return _0x3169c7[_0xd1d0('0x56')](_0x1b713e)[_0xd1d0('0x18')](function(){for(var _0xff07e2=0x0;_0xff07e2<_0x1b713e[_0xd1d0('0x45')];_0xff07e2+=0x1){_0x272ea2['emit'](_0xd1d0('0x57'),{'SmsInteractionId':Number(_0x1b713e[_0xff07e2]),'UserId':Number(_0x3169c7['id'])});}});}})['then'](function(){if(_0x2064d3===_0xd1d0('0x4f')){var _0x1ebce3=_['map'](_0x3169c7[_0xd1d0('0x29')],'id');return _0x3169c7['removeOpenchannelInteractions'](_0x1ebce3)['then'](function(){for(var _0x23ef2b=0x0;_0x23ef2b<_0x1ebce3[_0xd1d0('0x45')];_0x23ef2b+=0x1){_0x272ea2['emit'](_0xd1d0('0x58'),{'OpenchannelInteractionId':Number(_0x1ebce3[_0x23ef2b]),'UserId':Number(_0x3169c7['id'])});}});}})[_0xd1d0('0x18')](function(){if(_0x2064d3===_0xd1d0('0x4f')){var _0x262f7b=_[_0xd1d0('0x19')](_0x3169c7[_0xd1d0('0x59')],'id');return _0x3169c7['removeWhatsappInteractions'](_0x262f7b)[_0xd1d0('0x18')](function(){for(var _0x180913=0x0;_0x180913<_0x262f7b[_0xd1d0('0x45')];_0x180913+=0x1){_0x272ea2[_0xd1d0('0x50')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x262f7b[_0x180913]),'UserId':Number(_0x3169c7['id'])});}});}})[_0xd1d0('0x5a')](function(_0x5e9a5d){_0xf357cd[_0xd1d0('0x5b')](_0x5e9a5d);});}}function onDisconnect(_0x3caff6,_0x4eec9a){joinOrLeave(_0x3caff6,'leave',_0x4eec9a);}function onConnect(_0x36283f){joinOrLeave(_0x36283f,_0xd1d0('0x5c'));}exports[_0xd1d0('0x5d')]=function(_0x2d8610){_0x2d8610['on'](_0xd1d0('0x5e'),function(_0x1187b2){_0x1187b2[_0xd1d0('0x5f')](0x0);_0x1187b2[_0xd1d0('0x60')]=_0x1187b2[_0xd1d0('0x61')]['connection'][_0xd1d0('0x62')]+':'+_0x1187b2[_0xd1d0('0x61')][_0xd1d0('0x5e')][_0xd1d0('0x63')];_0x1187b2['connectedAt']=new Date();_0x1187b2[_0xd1d0('0x5b')]=function(_0x76aa63){console[_0xd1d0('0x5b')](_0xd1d0('0x64')+_0x1187b2['nsp']['name']+'['+_0x1187b2[_0xd1d0('0x60')]+']',_0x76aa63);};_0x1187b2['on'](_0xd1d0('0x65'),function(){onDisconnect(_0x1187b2,_0x2d8610);_0x1187b2['log'](_0xd1d0('0x66'));});onConnect(_0x1187b2);_0x1187b2[_0xd1d0('0x5b')]('CONNECTED');});}; \ No newline at end of file +var _0x1fba=['autoAssociation','VoiceQueues','ChatQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','role','Campaign','where','format','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','WhatsappQueue','Trunk','user','SmsQueues','OpenchannelQueue','Telephones','getVoiceQueues','getMailQueues','getOpenchannelQueues','all','length','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','./environment','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','findOne','then'];(function(_0x20106b,_0x33ef63){var _0x34c65c=function(_0x2625fb){while(--_0x2625fb){_0x20106b['push'](_0x20106b['shift']());}};_0x34c65c(++_0x33ef63);}(_0x1fba,0x17b));var _0xa1fb=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x1fba[_0xd39959];return _0x1ff69c;};'use strict';var _=require('lodash');var util=require(_0xa1fb('0x0'));var BPromise=require(_0xa1fb('0x1'));var db=require('../mysqldb')['db'];var config=require(_0xa1fb('0x2'));var queryQueues={'attributes':['id',_0xa1fb('0x3')],'include':[{'as':_0xa1fb('0x4'),'model':db[_0xa1fb('0x5')],'attributes':['id',_0xa1fb('0x3'),'role'],'raw':!![],'where':{'role':_0xa1fb('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xa1fb('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xa1fb('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0xa1fb('0x3')],'where':{'role':_0xa1fb('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xa1fb('0x3'),_0xa1fb('0x8')],'where':{'type':_0xa1fb('0x9')}};function getAssociatedResources(_0x289d77,_0x1f8402,_0x172d23){return db[_0xa1fb('0xa')][_0xa1fb('0xb')]({'where':{'name':_0x289d77,'userProfileId':_0x1f8402},'raw':!![]})[_0xa1fb('0xc')](function(_0x5ca764){if(_0x5ca764){if(_0x5ca764[_0xa1fb('0xd')]){switch(_0x289d77){case _0xa1fb('0xe'):case _0xa1fb('0xf'):case'FaxQueues':case'SmsQueues':case _0xa1fb('0x10'):case _0xa1fb('0x11'):case _0xa1fb('0x12'):return db[_0x172d23][_0xa1fb('0x13')](queryQueues);case'Telephones':return db[_0x172d23][_0xa1fb('0x13')](queryTelephones);case _0xa1fb('0x14'):return db[_0x172d23][_0xa1fb('0x13')](queryTrunks);case _0xa1fb('0x15'):return db[_0x172d23][_0xa1fb('0x13')](queryCampaigns);}}else{return db[_0xa1fb('0x16')]['findAll']({'attributes':[_0xa1fb('0x17')],'where':{'sectionId':_0x5ca764['id']},'raw':!![]})['then'](function(_0x25245c){if(_0x25245c){var _0x35a621={'where':{'id':_[_0xa1fb('0x18')](_0x25245c,_0xa1fb('0x17'))},'raw':!![]};switch(_0x172d23){case'User':_0x35a621['where'][_0xa1fb('0x19')]='telephone';break;case _0xa1fb('0x1a'):_0x35a621[_0xa1fb('0x1b')][_0xa1fb('0x8')]=_0xa1fb('0x9');break;}return db[_0x172d23][_0xa1fb('0x13')](_0x35a621);}else{return[];}});}}else{return[];}})['then'](function(_0x5e26f6){return _0x5e26f6;});}function joinOrLeaveQueues(_0x2238ca,_0x265b79,_0x5b4f05,_0x43fbfe){_0x2238ca[_0x265b79](util[_0xa1fb('0x1c')]('%s:queue:%s',_0x5b4f05,_0x43fbfe['name']));if(_0x43fbfe[_0xa1fb('0x4')]){for(var _0x59a7e=0x0;_0x59a7e<_0x43fbfe[_0xa1fb('0x4')]['length'];_0x59a7e+=0x1){_0x2238ca[_0x265b79](util['format'](_0xa1fb('0x1d'),_0x43fbfe[_0xa1fb('0x4')][_0x59a7e][_0xa1fb('0x3')]));}}}function joinOrLeave(_0x294e91,_0x1541cf,_0x3e24e8){var _0x228bc6;if(_0x294e91[_0xa1fb('0x1e')][_0xa1fb('0x1f')]['id']){db[_0xa1fb('0x5')]['find']({'attributes':['id',_0xa1fb('0x3'),_0xa1fb('0x19'),_0xa1fb('0x20')],'where':{'id':_0x294e91['handshake'][_0xa1fb('0x1f')]['id']},'include':[{'model':db[_0xa1fb('0x21')],'as':_0xa1fb('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xa1fb('0x23')],'as':_0xa1fb('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xa1fb('0x25')],'as':_0xa1fb('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xa1fb('0x27')],'as':_0xa1fb('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xa1fb('0x29')],'as':_0xa1fb('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xa1fb('0x2b')],'as':_0xa1fb('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xa1fb('0xc')](function(_0x470bd8){if(_0x470bd8){_0x228bc6=_0x470bd8;_0x294e91[_0x1541cf](util['format']('user:%s',_0x470bd8[_0xa1fb('0x3')]));var _0x477104=[];switch(_0x470bd8[_0xa1fb('0x19')]){case'admin':_0x294e91[_0x1541cf](_0xa1fb('0x2d'));_0x294e91[_0x1541cf](_0xa1fb('0x2e'));if(queryQueues['hasOwnProperty'](_0xa1fb('0x2f'))){delete queryQueues[_0xa1fb('0x2f')];}_0x477104[_0xa1fb('0x30')](db[_0xa1fb('0x31')][_0xa1fb('0x13')](queryQueues));_0x477104[_0xa1fb('0x30')](db[_0xa1fb('0x32')][_0xa1fb('0x13')](queryQueues));_0x477104['push'](db[_0xa1fb('0x33')][_0xa1fb('0x13')](queryQueues));_0x477104['push'](db[_0xa1fb('0x34')][_0xa1fb('0x13')](queryQueues));_0x477104[_0xa1fb('0x30')](db['MailQueue']['findAll'](queryQueues));_0x477104[_0xa1fb('0x30')](db['OpenchannelQueue'][_0xa1fb('0x13')](queryQueues));_0x477104[_0xa1fb('0x30')](db[_0xa1fb('0x35')][_0xa1fb('0x13')](queryQueues));_0x477104[_0xa1fb('0x30')](db[_0xa1fb('0x5')][_0xa1fb('0x13')](queryTelephones));_0x477104['push'](db[_0xa1fb('0x36')]['findAll'](queryTrunks));_0x477104[_0xa1fb('0x30')](db[_0xa1fb('0x1a')][_0xa1fb('0x13')](queryCampaigns));_0x477104[_0xa1fb('0x30')](db['User'][_0xa1fb('0x13')](queryAgents));break;case _0xa1fb('0x37'):_0x294e91[_0x1541cf]('voice:inbound');_0x294e91[_0x1541cf](_0xa1fb('0x2e'));_0x477104[_0xa1fb('0x30')](getAssociatedResources(_0xa1fb('0xe'),_0x470bd8[_0xa1fb('0x20')],_0xa1fb('0x31')));_0x477104['push'](getAssociatedResources(_0xa1fb('0xf'),_0x470bd8['userProfileId'],'ChatQueue'));_0x477104[_0xa1fb('0x30')](getAssociatedResources('FaxQueues',_0x470bd8['userProfileId'],_0xa1fb('0x33')));_0x477104['push'](getAssociatedResources(_0xa1fb('0x38'),_0x470bd8[_0xa1fb('0x20')],_0xa1fb('0x34')));_0x477104[_0xa1fb('0x30')](getAssociatedResources(_0xa1fb('0x10'),_0x470bd8[_0xa1fb('0x20')],'MailQueue'));_0x477104[_0xa1fb('0x30')](getAssociatedResources(_0xa1fb('0x11'),_0x470bd8[_0xa1fb('0x20')],_0xa1fb('0x39')));_0x477104[_0xa1fb('0x30')](getAssociatedResources('WhatsappQueues',_0x470bd8[_0xa1fb('0x20')],'WhatsappQueue'));_0x477104['push'](getAssociatedResources(_0xa1fb('0x3a'),_0x470bd8[_0xa1fb('0x20')],'User'));_0x477104['push'](getAssociatedResources(_0xa1fb('0x14'),_0x470bd8['userProfileId'],_0xa1fb('0x36')));_0x477104[_0xa1fb('0x30')](getAssociatedResources(_0xa1fb('0x15'),_0x470bd8[_0xa1fb('0x20')],_0xa1fb('0x1a')));_0x477104[_0xa1fb('0x30')](db[_0xa1fb('0x5')][_0xa1fb('0x13')](queryAgents));break;case _0xa1fb('0x6'):_0x294e91[_0x1541cf]('voice:inbound');_0x294e91[_0x1541cf]('voice:outbound');_0x477104[_0xa1fb('0x30')](_0x470bd8[_0xa1fb('0x3b')]({'attributes':['id',_0xa1fb('0x3')]}));_0x477104[_0xa1fb('0x30')](_0x470bd8['getChatQueues']({'attributes':['id',_0xa1fb('0x3')]}));_0x477104['push'](_0x470bd8['getFaxQueues']({'attributes':['id','name']}));_0x477104[_0xa1fb('0x30')](_0x470bd8['getSmsQueues']({'attributes':['id','name']}));_0x477104['push'](_0x470bd8[_0xa1fb('0x3c')]({'attributes':['id',_0xa1fb('0x3')]}));_0x477104[_0xa1fb('0x30')](_0x470bd8[_0xa1fb('0x3d')]({'attributes':['id','name']}));_0x477104[_0xa1fb('0x30')](_0x470bd8['getWhatsappQueues']({'attributes':['id',_0xa1fb('0x3')]}));break;}return BPromise[_0xa1fb('0x3e')](_0x477104);}})['then'](function(_0x5554aa){if(_0x5554aa&&_0x5554aa[_0xa1fb('0x3f')]){for(var _0x16a267=0x0;_0x16a267<_0x5554aa[_0xa1fb('0x3f')];_0x16a267+=0x1){for(var _0x325043=0x0;_0x325043<_0x5554aa[_0x16a267]['length'];_0x325043+=0x1){switch(_0x16a267){case 0x0:joinOrLeaveQueues(_0x294e91,_0x1541cf,_0xa1fb('0x40'),_0x5554aa[_0x16a267][_0x325043]);break;case 0x1:joinOrLeaveQueues(_0x294e91,_0x1541cf,'chat',_0x5554aa[_0x16a267][_0x325043]);break;case 0x2:joinOrLeaveQueues(_0x294e91,_0x1541cf,_0xa1fb('0x41'),_0x5554aa[_0x16a267][_0x325043]);break;case 0x3:joinOrLeaveQueues(_0x294e91,_0x1541cf,_0xa1fb('0x42'),_0x5554aa[_0x16a267][_0x325043]);break;case 0x4:joinOrLeaveQueues(_0x294e91,_0x1541cf,_0xa1fb('0x43'),_0x5554aa[_0x16a267][_0x325043]);break;case 0x5:joinOrLeaveQueues(_0x294e91,_0x1541cf,_0xa1fb('0x44'),_0x5554aa[_0x16a267][_0x325043]);break;case 0x6:joinOrLeaveQueues(_0x294e91,_0x1541cf,_0xa1fb('0x45'),_0x5554aa[_0x16a267][_0x325043]);break;case 0x7:if(_0x228bc6['role']!==_0xa1fb('0x6'))_0x294e91[_0x1541cf](util[_0xa1fb('0x1c')](_0xa1fb('0x46'),_0x5554aa[_0x16a267][_0x325043][_0xa1fb('0x3')]));break;case 0x8:if(_0x228bc6[_0xa1fb('0x19')]!==_0xa1fb('0x6'))_0x294e91[_0x1541cf](util[_0xa1fb('0x1c')](_0xa1fb('0x47'),_0x5554aa[_0x16a267][_0x325043][_0xa1fb('0x3')]));break;case 0x9:if(_0x228bc6[_0xa1fb('0x19')]!==_0xa1fb('0x6'))_0x294e91[_0x1541cf](util[_0xa1fb('0x1c')](_0xa1fb('0x48'),_0x5554aa[_0x16a267][_0x325043][_0xa1fb('0x8')],_0x5554aa[_0x16a267][_0x325043][_0xa1fb('0x3')]));break;case 0xa:_0x294e91[_0x1541cf](util[_0xa1fb('0x1c')](_0xa1fb('0x1d'),_0x5554aa[_0x16a267][_0x325043][_0xa1fb('0x3')]));break;}}}}})[_0xa1fb('0xc')](function(){if(_0x1541cf==='leave'){var _0x49c3fb=_['map'](_0x228bc6['ChatInteractions'],'id');return _0x228bc6['removeChatInteractions'](_0x49c3fb)['then'](function(){for(var _0x2c47ec=0x0;_0x2c47ec<_0x49c3fb[_0xa1fb('0x3f')];_0x2c47ec+=0x1){_0x3e24e8[_0xa1fb('0x49')](_0xa1fb('0x4a'),{'ChatInteractionId':Number(_0x49c3fb[_0x2c47ec]),'UserId':Number(_0x228bc6['id'])});}});}})[_0xa1fb('0xc')](function(){if(_0x1541cf===_0xa1fb('0x4b')){var _0x4ae80b=_[_0xa1fb('0x18')](_0x228bc6['MailInteractions'],'id');return _0x228bc6[_0xa1fb('0x4c')](_0x4ae80b)[_0xa1fb('0xc')](function(){for(var _0x2f6266=0x0;_0x2f6266<_0x4ae80b[_0xa1fb('0x3f')];_0x2f6266+=0x1){_0x3e24e8['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4ae80b[_0x2f6266]),'UserId':Number(_0x228bc6['id'])});}});}})[_0xa1fb('0xc')](function(){if(_0x1541cf===_0xa1fb('0x4b')){var _0xed6045=_[_0xa1fb('0x18')](_0x228bc6[_0xa1fb('0x26')],'id');return _0x228bc6[_0xa1fb('0x4d')](_0xed6045)[_0xa1fb('0xc')](function(){for(var _0x2510e0=0x0;_0x2510e0<_0xed6045[_0xa1fb('0x3f')];_0x2510e0+=0x1){_0x3e24e8[_0xa1fb('0x49')](_0xa1fb('0x4e'),{'FaxInteractionId':Number(_0xed6045[_0x2510e0]),'UserId':Number(_0x228bc6['id'])});}});}})[_0xa1fb('0xc')](function(){if(_0x1541cf===_0xa1fb('0x4b')){var _0x4ac1a3=_['map'](_0x228bc6[_0xa1fb('0x28')],'id');return _0x228bc6['removeSmsInteractions'](_0x4ac1a3)[_0xa1fb('0xc')](function(){for(var _0xcfb68f=0x0;_0xcfb68f<_0x4ac1a3['length'];_0xcfb68f+=0x1){_0x3e24e8['emit'](_0xa1fb('0x4f'),{'SmsInteractionId':Number(_0x4ac1a3[_0xcfb68f]),'UserId':Number(_0x228bc6['id'])});}});}})[_0xa1fb('0xc')](function(){if(_0x1541cf===_0xa1fb('0x4b')){var _0x6cf603=_[_0xa1fb('0x18')](_0x228bc6[_0xa1fb('0x2a')],'id');return _0x228bc6[_0xa1fb('0x50')](_0x6cf603)['then'](function(){for(var _0x24eef7=0x0;_0x24eef7<_0x6cf603[_0xa1fb('0x3f')];_0x24eef7+=0x1){_0x3e24e8['emit'](_0xa1fb('0x51'),{'OpenchannelInteractionId':Number(_0x6cf603[_0x24eef7]),'UserId':Number(_0x228bc6['id'])});}});}})[_0xa1fb('0xc')](function(){if(_0x1541cf===_0xa1fb('0x4b')){var _0x584eae=_[_0xa1fb('0x18')](_0x228bc6[_0xa1fb('0x2c')],'id');return _0x228bc6[_0xa1fb('0x52')](_0x584eae)[_0xa1fb('0xc')](function(){for(var _0x285eef=0x0;_0x285eef<_0x584eae['length'];_0x285eef+=0x1){_0x3e24e8[_0xa1fb('0x49')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x584eae[_0x285eef]),'UserId':Number(_0x228bc6['id'])});}});}})[_0xa1fb('0x53')](function(_0x4aa2d7){_0x294e91[_0xa1fb('0x54')](_0x4aa2d7);});}}function onDisconnect(_0x80e8c2,_0x3ed217){joinOrLeave(_0x80e8c2,_0xa1fb('0x4b'),_0x3ed217);}function onConnect(_0x3b7dff){joinOrLeave(_0x3b7dff,_0xa1fb('0x55'));}exports[_0xa1fb('0x56')]=function(_0x381c85){_0x381c85['on'](_0xa1fb('0x57'),function(_0x251808){_0x251808[_0xa1fb('0x58')](0x0);_0x251808[_0xa1fb('0x59')]=_0x251808['request'][_0xa1fb('0x57')][_0xa1fb('0x5a')]+':'+_0x251808[_0xa1fb('0x5b')]['connection'][_0xa1fb('0x5c')];_0x251808['connectedAt']=new Date();_0x251808[_0xa1fb('0x54')]=function(_0x1f0985){console['log'](_0xa1fb('0x5d')+_0x251808[_0xa1fb('0x5e')][_0xa1fb('0x3')]+'['+_0x251808[_0xa1fb('0x59')]+']',_0x1f0985);};_0x251808['on'](_0xa1fb('0x5f'),function(){onDisconnect(_0x251808,_0x381c85);_0x251808['log'](_0xa1fb('0x60'));});onConnect(_0x251808);_0x251808[_0xa1fb('0x54')](_0xa1fb('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 9db7322..1fb3f14 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 _0x0cfe=['MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','code','catch','get','channel','event','UserId','User','find','name','interface','SIP/%s','incomingmessage','outgoingmessage','closed','format','default','hasOwnProperty','model','callback','toLowerCase','condition','util','../../mysqldb','../logger','client','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','Sms','SmsInteraction','SmsMessage','newmessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction'];(function(_0x3f4168,_0x16b271){var _0x36e67b=function(_0x1701dd){while(--_0x1701dd){_0x3f4168['push'](_0x3f4168['shift']());}};_0x36e67b(++_0x16b271);}(_0x0cfe,0x162));var _0xe0cf=function(_0x482be2,_0x112060){_0x482be2=_0x482be2-0x0;var _0x56eea3=_0x0cfe[_0x482be2];return _0x56eea3;};'use strict';var util=require(_0xe0cf('0x0'));var db=require(_0xe0cf('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0xe0cf('0x2'))('triggers');var client=jayson[_0xe0cf('0x3')][_0xe0cf('0x4')]({'port':0x232a});var triggers=[{'channel':_0xe0cf('0x5'),'model':_0xe0cf('0x6'),'event':'afterCreate','condition':_0xe0cf('0x7'),'callback':afterCreate},{'channel':'Chat','model':_0xe0cf('0x6'),'event':_0xe0cf('0x8'),'condition':_0xe0cf('0x9'),'callback':afterUpdate},{'channel':_0xe0cf('0x5'),'model':_0xe0cf('0xa'),'event':_0xe0cf('0xb'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xe0cf('0xc'),'model':_0xe0cf('0xd'),'event':_0xe0cf('0xb'),'condition':_0xe0cf('0x7'),'callback':afterCreate},{'channel':_0xe0cf('0xc'),'model':_0xe0cf('0xd'),'event':_0xe0cf('0x8'),'condition':_0xe0cf('0x9'),'callback':afterUpdate},{'channel':_0xe0cf('0xc'),'model':_0xe0cf('0xe'),'event':'afterCreate','condition':_0xe0cf('0xf'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xe0cf('0x10'),'event':'afterCreate','condition':_0xe0cf('0x7'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xe0cf('0x10'),'event':_0xe0cf('0x8'),'condition':_0xe0cf('0x9'),'callback':afterUpdate},{'channel':_0xe0cf('0x11'),'model':_0xe0cf('0x12'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xe0cf('0x13'),'model':_0xe0cf('0x14'),'event':_0xe0cf('0xb'),'condition':_0xe0cf('0x7'),'callback':afterCreate},{'channel':_0xe0cf('0x13'),'model':_0xe0cf('0x14'),'event':_0xe0cf('0x8'),'condition':_0xe0cf('0x9'),'callback':afterUpdate},{'channel':_0xe0cf('0x13'),'model':_0xe0cf('0x15'),'event':_0xe0cf('0xb'),'condition':_0xe0cf('0xf'),'callback':afterCreateMessage},{'channel':_0xe0cf('0x16'),'model':_0xe0cf('0x17'),'event':_0xe0cf('0xb'),'condition':_0xe0cf('0x7'),'callback':afterCreate},{'channel':_0xe0cf('0x16'),'model':_0xe0cf('0x17'),'event':'afterUpdate','condition':_0xe0cf('0x9'),'callback':afterUpdate},{'channel':_0xe0cf('0x16'),'model':_0xe0cf('0x18'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xe0cf('0x19'),'model':'OpenchannelInteraction','event':_0xe0cf('0xb'),'condition':_0xe0cf('0x7'),'callback':afterCreate},{'channel':_0xe0cf('0x19'),'model':_0xe0cf('0x1a'),'event':_0xe0cf('0x8'),'condition':_0xe0cf('0x9'),'callback':afterUpdate},{'channel':_0xe0cf('0x19'),'model':_0xe0cf('0x1b'),'event':'afterCreate','condition':_0xe0cf('0xf'),'callback':afterCreateMessage}];function request(_0x43f797){return client[_0xe0cf('0x1c')](_0xe0cf('0x1d'),_0x43f797)[_0xe0cf('0x1e')](function(_0x34bffa){logger['info'](_0xe0cf('0x1f'),'EventManager',_0x34bffa);if(_0x34bffa['error']){if(_0x34bffa[_0xe0cf('0x20')][_0xe0cf('0x21')]===0x1f4){logger[_0xe0cf('0x20')](_0xe0cf('0x1f'),'EventManager',_0x34bffa[_0xe0cf('0x20')]);}}})[_0xe0cf('0x22')](function(_0x504e26){logger[_0xe0cf('0x20')](_0xe0cf('0x1f'),'EventManager',_0x504e26);});}function afterCreateMessage(_0x5730ee,_0x27cd99){return function(_0x2b79bf,_0x5d532d){_0x2b79bf=_0x2b79bf[_0xe0cf('0x23')]({'plain':!![]});_0x2b79bf[_0xe0cf('0x24')]=_0x5730ee;_0x2b79bf[_0xe0cf('0x25')]=_0x2b79bf['direction'];if(_0x2b79bf[_0xe0cf('0x26')]){return db[_0xe0cf('0x27')][_0xe0cf('0x28')]({'where':{'id':_0x2b79bf['UserId']},'attributes':['id',_0xe0cf('0x29')],'raw':!![]})[_0xe0cf('0x1e')](function(_0x28f29e){_0x2b79bf[_0xe0cf('0x2a')]=util['format'](_0xe0cf('0x2b'),_0x28f29e[_0xe0cf('0x29')]);_0x2b79bf['channel']=_0x5730ee;return request({'event':_0xe0cf('0x2c'),'message':_0x2b79bf});})['catch'](function(_0x2412a5){console[_0xe0cf('0x20')](_0x2412a5);});}else{return request({'event':_0xe0cf('0x2d'),'message':_0x2b79bf});}};}function afterCreate(_0x4c2448,_0x35a264){return function(_0x4260d9,_0x2c2c61){_0x4260d9=_0x4260d9[_0xe0cf('0x23')]({'plain':!![]});_0x4260d9[_0xe0cf('0x24')]=_0x4c2448;_0x4260d9[_0xe0cf('0x25')]='opened';return request({'event':_0x35a264,'message':_0x4260d9});};}function afterUpdate(_0x57c7b1,_0x31c21a){return function(_0x3187a7,_0x443172){if(_0x3187a7['changed'](_0xe0cf('0x2e'))&&_0x3187a7['closed']){_0x3187a7=_0x3187a7['get']({'plain':!![]});_0x3187a7[_0xe0cf('0x24')]=_0x57c7b1;_0x3187a7[_0xe0cf('0x25')]=_0xe0cf('0x2e');if(_0x3187a7[_0xe0cf('0x26')]){return db[_0xe0cf('0x27')][_0xe0cf('0x28')]({'where':{'id':_0x3187a7[_0xe0cf('0x26')]},'attributes':['id','name'],'raw':!![]})['then'](function(_0x3d20e7){_0x3187a7[_0xe0cf('0x2a')]=util[_0xe0cf('0x2f')](_0xe0cf('0x2b'),_0x3d20e7[_0xe0cf('0x29')]);return request({'event':_0x31c21a,'message':_0x3187a7});})[_0xe0cf('0x22')](function(_0x46006d){console[_0xe0cf('0x20')](_0x46006d);});}else{return request({'event':_0x31c21a,'message':_0x3187a7});}}};}exports[_0xe0cf('0x30')]=function(){for(var _0x310d2f=0x0;_0x310d2f=_0x437bb7[_0x9974('0x16')]){throw Error(_0x9974('0x17'));}_0x2c28b9(_0x93f021);})[_0x9974('0x18')](function(_0x91c481){_0xc821de(_0x91c481);});});}; \ No newline at end of file +var _0x86df=['toLowerCase','includes','clearBlockUser','blockedAt','getLicense','User','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','chat','sms','whatsapp','openchannel','isValidChannel'];(function(_0x4cbb8e,_0x1047c8){var _0x17846f=function(_0x29e1e0){while(--_0x29e1e0){_0x4cbb8e['push'](_0x4cbb8e['shift']());}};_0x17846f(++_0x1047c8);}(_0x86df,0x7a));var _0xf86d=function(_0x4150f1,_0x4a2ba6){_0x4150f1=_0x4150f1-0x0;var _0xba6ea=_0x86df[_0x4150f1];return _0xba6ea;};'use strict';var _=require(_0xf86d('0x0'));var BPromise=require(_0xf86d('0x1'));var db=require(_0xf86d('0x2'))['db'];var util=require(_0xf86d('0x3'));var channels=[_0xf86d('0x4'),'mail',_0xf86d('0x5'),'fax',_0xf86d('0x6'),_0xf86d('0x7'),_0xf86d('0x8')];exports['getChannels']=function(){return channels;};exports[_0xf86d('0x9')]=function(_0x391271){_0x391271=_0x391271[_0xf86d('0xa')]();return _[_0xf86d('0xb')](channels,_0x391271);};exports[_0xf86d('0xc')]=function(_0x1b96eb,_0x24cc0b,_0x4b4906,_0x13bdae){var _0x22adcb={'loginAttempts':_0x24cc0b,'blocked':_0x4b4906};if(!_['isUndefined'](_0x13bdae)){_0x22adcb[_0xf86d('0xd')]=_0x13bdae;}return _0x1b96eb['updateAttributes'](_0x22adcb);};exports[_0xf86d('0xe')]=function(_0xcbcde7){return new BPromise(function(_0x1b073a,_0x5b5951){var _0x58c529=0x0;if(_0xcbcde7['role']!=='agent'){_0x1b073a(_0xcbcde7);}db[_0xf86d('0xf')][_0xf86d('0x10')]({'where':{'role':_0xf86d('0x11'),'online':!![],'id':{'$ne':_0xcbcde7['id']}}})[_0xf86d('0x12')](function(_0x3d3534){_0x58c529=_0x3d3534;return util[_0xf86d('0xe')]();})['then'](function(_0x5072fc){if(_0x5072fc&&_0x5072fc[_0xf86d('0x13')]&&_0x58c529>=_0x5072fc[_0xf86d('0x13')]){throw Error(_0xf86d('0x14'));}_0x1b073a(_0xcbcde7);})[_0xf86d('0x15')](function(_0x514850){_0x5b5951(_0x514850);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 77693d4..f3ab8ae 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a95=['status','json','exports','404'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0x5a95,0x146));var _0x55a9=function(_0x516459,_0x1914b7){_0x516459=_0x516459-0x0;var _0x5427fe=_0x5a95[_0x516459];return _0x5427fe;};'use strict';module[_0x55a9('0x0')][0x194]=function pageNotFound(_0x4cd4ff,_0x356522){var _0x38ab8a=_0x55a9('0x1');var _0x13e335=0x194;var _0x372555={'status':_0x13e335};_0x356522['status'](_0x372555[_0x55a9('0x2')]);_0x356522['render'](_0x38ab8a,{},function(_0x28d385,_0x460d37){if(_0x28d385){return _0x356522['status'](_0x372555['status'])[_0x55a9('0x3')](_0x372555);}_0x356522['send'](_0x460d37);});}; \ No newline at end of file +var _0xe329=['404','status','render','json','exports'];(function(_0x35c3bb,_0x2ef959){var _0x2ac02d=function(_0x383a39){while(--_0x383a39){_0x35c3bb['push'](_0x35c3bb['shift']());}};_0x2ac02d(++_0x2ef959);}(_0xe329,0x126));var _0x9e32=function(_0x58e1f2,_0x34d44b){_0x58e1f2=_0x58e1f2-0x0;var _0x44aa17=_0xe329[_0x58e1f2];return _0x44aa17;};'use strict';module[_0x9e32('0x0')][0x194]=function pageNotFound(_0x47f0dd,_0x22b25e){var _0x40ac89=_0x9e32('0x1');var _0x4a806d=0x194;var _0x41ba46={'status':_0x4a806d};_0x22b25e[_0x9e32('0x2')](_0x41ba46['status']);_0x22b25e[_0x9e32('0x3')](_0x40ac89,{},function(_0x388d36,_0x1fa2a7){if(_0x388d36){return _0x22b25e[_0x9e32('0x2')](_0x41ba46[_0x9e32('0x2')])[_0x9e32('0x4')](_0x41ba46);}_0x22b25e['send'](_0x1fa2a7);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e5df2a6..0ca5bd6 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89b3=['FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Pause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','MailAccountId','Dispositions','Answers','Interactions','List','ListId','mandatoryDispositionPause','user_has_mail_accounts','UserMailQueue','Team','team_has_mail_queues','Teams','MailMessage','MailInteractionId','CmContact','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Account','ChatOfflineMessageId','restrict','MailApplication','IntervalId','TagId','MailQueueReport','ContactId','Items','FaxAccount','FaxAccountId','Exntensions','Messages','fax_interaction_has_tags','user_has_fax_interactions','FaxInteractionId','AttachmentId','FaxQueueReport','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Interaction','team_has_chat_queues','ChatGroupId','Members','chat_group_has_users','CmCompany','CompanyId','Hoppers','CmHopperFinal','cm_contact_has_tags','OwnerId','CampaignId','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyCondition','Fields','AnalyticDefaultReport','DefaultReportId','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','Variable','VariableId','SugarcrmConfiguration','FieldId','DeskAccount','int_desk_configuration_has_tags','ZohoConfiguration','ZohoField','FreshdeskAccount','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','ServicenowField','Dynamics365Account','Dynamics365Configuration','FreshsalesConfiguration','FreshsalesField','FreshsalesAccount','ChatQueueReport','FromId','ToId','SessionId','ProjectId','JscriptyAnswerReport','team_has_fax_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToAgent','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','user_has_voice_prefixes','UserProfileSection','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappQueueReport','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','UserWhatsappQueue','WhatsappQueueId','exports','path','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','name','utf8','username','password','database','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../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/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/tag/tag.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','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','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','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','hasMany','Recordings','UserId','HopperFinals','CmHopperHistory','HopperHistory','ChatInteractions','SmsInteraction','SmsInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','ChatGroup','Groups','Contacts','cm_user_has_contacts','belongsToMany','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','FaxInteractions','OpenchannelInteraction','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','UserFaxQueue','SmsQueue','SmsQueues','UserSmsQueue','WhatsappQueues','CmList','VoicePrefixes','user_has_chat_websites'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x89b3,0xd1));var _0x389b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x89b3[_0x122ef9];return _0x42fba0;};'use strict';var path=require(_0x389b('0x0'));var config=require(_0x389b('0x1'));var Sequelize=require(_0x389b('0x2'));var _=require('lodash');var jstz=require(_0x389b('0x3'));var timezone=jstz[_0x389b('0x4')]();config['sequelize']=_[_0x389b('0x5')](config[_0x389b('0x2')],{'database':_0x389b('0x6'),'username':_0x389b('0x7'),'password':_0x389b('0x8'),'options':{'host':_0x389b('0x9'),'port':0xcea,'dialect':_0x389b('0xa'),'dialectOptions':{'charset':_0x389b('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x389b('0xc')}}});config[_0x389b('0xd')]=_[_0x389b('0x5')](config[_0x389b('0xd')],{'database':'motion2','username':_0x389b('0x7'),'password':_0x389b('0x8'),'options':{'host':_0x389b('0x9'),'port':0xcea,'dialect':_0x389b('0xa'),'dialectOptions':{'charset':_0x389b('0xb')},'logging':![],'timezone':timezone[_0x389b('0xe')](),'define':{'charset':_0x389b('0xf'),'collate':_0x389b('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x389b('0x2')][_0x389b('0x10')],config[_0x389b('0x2')][_0x389b('0x11')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x389b('0x12')],config['sequelizeHistory'][_0x389b('0x10')],config['sequelizeHistory'][_0x389b('0x11')],config['sequelizeHistory'][_0x389b('0x13')])};db[_0x389b('0x14')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x16'));db[_0x389b('0x17')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x18'));db[_0x389b('0x19')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x1a'));db[_0x389b('0x1b')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x1c'));db[_0x389b('0x1d')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x1e'));db[_0x389b('0x1f')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x20'));db[_0x389b('0x21')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x22'));db[_0x389b('0x23')]=db[_0x389b('0x2')]['import'](_0x389b('0x24'));db[_0x389b('0x25')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x26'));db[_0x389b('0x27')]=db['sequelize'][_0x389b('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x389b('0x28')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x29'));db[_0x389b('0x2a')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x2b'));db[_0x389b('0x2c')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x2d'));db[_0x389b('0x2e')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db['sequelize'][_0x389b('0x15')](_0x389b('0x2f'));db['Trunk']=db['sequelize'][_0x389b('0x15')]('../api/trunk/trunk.model');db[_0x389b('0x30')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x31'));db[_0x389b('0x32')]=db[_0x389b('0x2')]['import'](_0x389b('0x33'));db[_0x389b('0x34')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x35'));db[_0x389b('0x36')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x37'));db['UserMailQueue']=db['sequelize'][_0x389b('0x15')](_0x389b('0x38'));db['UserFaxQueue']=db[_0x389b('0x2')]['import'](_0x389b('0x39'));db['UserSmsQueue']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x3a'));db[_0x389b('0x3b')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x3c'));db['UserWhatsappQueue']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x389b('0x3d')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x3e'));db[_0x389b('0x3f')]=db['sequelize']['import'](_0x389b('0x40'));db[_0x389b('0x41')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x42'));db[_0x389b('0x43')]=db['sequelize'][_0x389b('0x15')]('../api/mailQueue/mailQueue.model');db[_0x389b('0x44')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x45'));db[_0x389b('0x46')]=db[_0x389b('0x2')]['import'](_0x389b('0x47'));db['MailMessage']=db['sequelize'][_0x389b('0x15')](_0x389b('0x48'));db['MailApplication']=db[_0x389b('0x2')]['import'](_0x389b('0x49'));db['MailQueueReport']=db[_0x389b('0x2')]['import'](_0x389b('0x4a'));db['Dashboard']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x4b'));db[_0x389b('0x4c')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x4d'));db[_0x389b('0x4e')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x4f'));db[_0x389b('0x50')]=db[_0x389b('0x2')]['import']('../api/faxInteraction/faxInteraction.model');db[_0x389b('0x51')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x52'));db[_0x389b('0x53')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x54'));db['FaxQueueReport']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x55'));db[_0x389b('0x56')]=db['sequelize'][_0x389b('0x15')]('../api/smsAccount/smsAccount.model');db[_0x389b('0x57')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x58'));db['SmsInteraction']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x59'));db['SmsMessage']=db['sequelize'][_0x389b('0x15')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db['sequelize']['import'](_0x389b('0x5a'));db[_0x389b('0x5b')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/openchannelAccount/openchannelAccount.model');db[_0x389b('0x5c')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x5d'));db['OpenchannelInteraction']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db['sequelize'][_0x389b('0x15')](_0x389b('0x5e'));db[_0x389b('0x5f')]=db['sequelize']['import'](_0x389b('0x60'));db[_0x389b('0x61')]=db[_0x389b('0x2')]['import'](_0x389b('0x62'));db[_0x389b('0x63')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x64'));db[_0x389b('0x65')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/chatApplication/chatApplication.model');db[_0x389b('0x66')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x67'));db[_0x389b('0x68')]=db[_0x389b('0x2')]['import'](_0x389b('0x69'));db[_0x389b('0x6a')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x6b'));db[_0x389b('0x6c')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x6d'));db['ChatGroup']=db[_0x389b('0x2')]['import'](_0x389b('0x6e'));db[_0x389b('0x6f')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x70'));db['CmCompany']=db[_0x389b('0x2')]['import'](_0x389b('0x71'));db['CmContact']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x72'));db[_0x389b('0x73')]=db[_0x389b('0x2')]['import']('../api/cmHopper/cmHopper.model');db[_0x389b('0x74')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x75'));db['CmHopperFinal']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db['sequelize'][_0x389b('0x15')](_0x389b('0x76'));db[_0x389b('0x77')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x78'));db[_0x389b('0x79')]=db[_0x389b('0x2')]['import']('../api/cmCustomField/cmCustomField.model');db[_0x389b('0x7a')]=db[_0x389b('0x2')]['import']('../api/action/action.model');db[_0x389b('0x7b')]=db[_0x389b('0x2')]['import'](_0x389b('0x7c'));db[_0x389b('0x7d')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/cannedAnswer/cannedAnswer.model');db[_0x389b('0x7e')]=db[_0x389b('0x2')]['import'](_0x389b('0x7f'));db[_0x389b('0x80')]=db[_0x389b('0x2')]['import'](_0x389b('0x81'));db[_0x389b('0x82')]=db['sequelize']['import'](_0x389b('0x83'));db['Pause']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x84'));db[_0x389b('0x85')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x86'));db[_0x389b('0x87')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x88'));db[_0x389b('0x89')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x8a'));db['Sound']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/sound/sound.model');db['Tag']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x8b'));db[_0x389b('0x8c')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x8d'));db[_0x389b('0x8e')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x8f'));db['Variable']=db['sequelize'][_0x389b('0x15')](_0x389b('0x90'));db[_0x389b('0x91')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x92'));db[_0x389b('0x93')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x94'));db[_0x389b('0x95')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x96'));db['AnalyticDefaultReport']=db['sequelize']['import'](_0x389b('0x97'));db[_0x389b('0x98')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/analyticMetric/analyticMetric.model');db[_0x389b('0x99')]=db[_0x389b('0x2')]['import'](_0x389b('0x9a'));db[_0x389b('0x9b')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x9c'));db[_0x389b('0x9d')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x9e'));db[_0x389b('0x9f')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xa0'));db[_0x389b('0xa1')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xa2'));db[_0x389b('0xa3')]=db['sequelize']['import'](_0x389b('0xa4'));db['SugarcrmConfiguration']=db[_0x389b('0x2')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x389b('0xa5')]=db['sequelize'][_0x389b('0x15')](_0x389b('0xa6'));db['DeskAccount']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xa7'));db[_0x389b('0xa8')]=db[_0x389b('0x2')]['import'](_0x389b('0xa9'));db[_0x389b('0xaa')]=db['sequelize'][_0x389b('0x15')]('../api/intDeskField/intDeskField.model');db[_0x389b('0xab')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xac'));db['ZohoConfiguration']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xad'));db['ZohoField']=db['sequelize'][_0x389b('0x15')](_0x389b('0xae'));db[_0x389b('0xaf')]=db[_0x389b('0x2')]['import'](_0x389b('0xb0'));db[_0x389b('0xb1')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x389b('0xb2')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xb3'));db['FreshdeskAccount']=db[_0x389b('0x2')]['import'](_0x389b('0xb4'));db[_0x389b('0xb5')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xb6'));db['FreshdeskField']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xb7'));db['VtigerAccount']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xb8'));db['VtigerConfiguration']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xb9'));db[_0x389b('0xba')]=db[_0x389b('0x2')]['import'](_0x389b('0xbb'));db['ServicenowAccount']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xbc'));db[_0x389b('0xbd')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xbe'));db['Dynamics365Account']=db['sequelize'][_0x389b('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db['sequelize'][_0x389b('0x15')](_0x389b('0xbf'));db[_0x389b('0xc0')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xc1'));db['FreshsalesAccount']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xc2'));db['FreshsalesField']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x389b('0x91')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x92'));db[_0x389b('0xc3')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xc4'));db['ChatQueueReport']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xc5'));db[_0x389b('0xc6')]=db['sequelize'][_0x389b('0x15')](_0x389b('0xc7'));db['JscriptyAnswerReport']=db['sequelize'][_0x389b('0x15')](_0x389b('0xc8'));db[_0x389b('0xc9')]=db['sequelize'][_0x389b('0x15')](_0x389b('0xca'));db[_0x389b('0xcb')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xcc'));db[_0x389b('0xcd')]=db['sequelize'][_0x389b('0x15')]('../api/smsQueueReport/smsQueueReport.model');db[_0x389b('0xce')]=db['sequelize'][_0x389b('0x15')](_0x389b('0xcf'));db[_0x389b('0xd0')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xd1'));db[_0x389b('0xd2')]=db['sequelize']['import'](_0x389b('0xd3'));db[_0x389b('0xd4')]=db['sequelize']['import'](_0x389b('0xd5'));db[_0x389b('0xd6')]=db['sequelize']['import'](_0x389b('0xd7'));db[_0x389b('0xd8')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xd9'));db['SquareRecording']=db[_0x389b('0x2')]['import'](_0x389b('0xda'));db[_0x389b('0xdb')]=db['sequelize'][_0x389b('0x15')](_0x389b('0xdc'));db['Team']=db[_0x389b('0x2')]['import'](_0x389b('0xdd'));db['License']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/license/license.model');db[_0x389b('0xde')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xdf'));db[_0x389b('0xe0')]=db['sequelize'][_0x389b('0x15')](_0x389b('0xe1'));db[_0x389b('0xe2')]=db['sequelize'][_0x389b('0x15')]('../api/attachment/attachment.model');db['Plugin']=db[_0x389b('0x2')]['import'](_0x389b('0xe3'));db[_0x389b('0xe4')]=db['sequelize']['import'](_0x389b('0xe5'));db[_0x389b('0xe6')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xe7'));db['FaxTransferReport']=db[_0x389b('0x2')]['import'](_0x389b('0xe8'));db['OpenchannelTransferReport']=db[_0x389b('0x2')]['import'](_0x389b('0xe9'));db[_0x389b('0xea')]=db['sequelize']['import'](_0x389b('0xeb'));db['CmList']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xec'));db[_0x389b('0xed')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/voicePrefix/voicePrefix.model');db[_0x389b('0xee')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xef'));db['UserProfileSection']=db[_0x389b('0x2')]['import'](_0x389b('0xf0'));db['UserProfileResource']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xf1'));db[_0x389b('0xf2')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xf3'));db[_0x389b('0xf4')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/whatsappAccount/whatsappAccount.model');db[_0x389b('0xf5')]=db[_0x389b('0x2')]['import'](_0x389b('0xf6'));db[_0x389b('0xf7')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xf8'));db['WhatsappMessage']=db[_0x389b('0x2')]['import']('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db[_0x389b('0x2')]['import'](_0x389b('0xf9'));db['WhatsappTransferReport']=db['sequelize'][_0x389b('0x15')](_0x389b('0xfa'));db[_0x389b('0xfb')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xfc'));db[_0x389b('0xfd')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xfe'));db[_0x389b('0xff')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x100'));db['User'][_0x389b('0x101')](db[_0x389b('0x25')],{'as':_0x389b('0x25'),'onDelete':_0x389b('0x102'),'foreignKey':'UserId'});db[_0x389b('0x14')][_0x389b('0x103')](db[_0x389b('0x21')],{'as':_0x389b('0x104'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x14')][_0x389b('0x103')](db[_0x389b('0x32')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x389b('0x14')][_0x389b('0x103')](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0x389b('0x14')][_0x389b('0x103')](db['CmHopperFinal'],{'as':_0x389b('0x106'),'foreignKey':_0x389b('0x105')});db['User'][_0x389b('0x103')](db[_0x389b('0x107')],{'as':_0x389b('0x108'),'foreignKey':_0x389b('0x105')});db['User'][_0x389b('0x103')](db['ReportAgentPreview'],{'as':_0x389b('0x77'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x14')][_0x389b('0x103')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x389b('0x105')});db['User'][_0x389b('0x103')](db['ChatInteraction'],{'as':_0x389b('0x109'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x14')][_0x389b('0x103')](db[_0x389b('0x10a')],{'as':_0x389b('0x10b'),'foreignKey':'UserId'});db[_0x389b('0x14')][_0x389b('0x103')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x389b('0x105')});db[_0x389b('0x14')]['hasMany'](db[_0x389b('0x46')],{'as':_0x389b('0x10c'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x14')]['hasMany'](db[_0x389b('0xf7')],{'as':_0x389b('0x10d'),'foreignKey':_0x389b('0x105')});db['User'][_0x389b('0x103')](db[_0x389b('0xf2')],{'as':_0x389b('0x10e'),'foreignKey':'SenderId'});db[_0x389b('0x14')][_0x389b('0x10f')](db['UserProfile'],{'as':_0x389b('0xee'),'foreignKey':_0x389b('0x110')});db[_0x389b('0x14')]['belongsToMany'](db[_0x389b('0x111')],{'as':_0x389b('0x112'),'through':'chat_group_has_users'});db[_0x389b('0x14')]['belongsToMany'](db['CmContact'],{'as':_0x389b('0x113'),'through':_0x389b('0x114')});db[_0x389b('0x14')][_0x389b('0x115')](db['CmList'],{'as':_0x389b('0x116'),'through':_0x389b('0x117')});db[_0x389b('0x14')][_0x389b('0x115')](db['Team'],{'through':_0x389b('0x118')});db[_0x389b('0x14')][_0x389b('0x115')](db['MailInteraction'],{'as':'MailInteractions','through':_0x389b('0x119')});db[_0x389b('0x14')]['belongsToMany'](db[_0x389b('0x66')],{'as':_0x389b('0x109'),'through':'user_has_chat_interactions'});db[_0x389b('0x14')][_0x389b('0x115')](db[_0x389b('0x50')],{'as':_0x389b('0x11a'),'through':'user_has_fax_interactions'});db[_0x389b('0x14')][_0x389b('0x115')](db['SmsInteraction'],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x389b('0x14')]['belongsToMany'](db[_0x389b('0x11b')],{'as':_0x389b('0x11c'),'through':_0x389b('0x11d')});db[_0x389b('0x14')][_0x389b('0x115')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db['User']['belongsToMany'](db[_0x389b('0x1f')],{'as':_0x389b('0x11e'),'through':_0x389b('0x34'),'required':![]});db['User'][_0x389b('0x115')](db['MailQueue'],{'as':_0x389b('0x11f'),'through':'UserMailQueue','required':![]});db[_0x389b('0x14')]['belongsToMany'](db[_0x389b('0x6c')],{'as':_0x389b('0x120'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x389b('0x115')](db[_0x389b('0x53')],{'as':_0x389b('0x121'),'through':_0x389b('0x122'),'required':![]});db['User'][_0x389b('0x115')](db[_0x389b('0x123')],{'as':_0x389b('0x124'),'through':_0x389b('0x125'),'required':![]});db[_0x389b('0x14')][_0x389b('0x115')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x389b('0x3b'),'required':![]});db[_0x389b('0x14')][_0x389b('0x115')](db[_0x389b('0xfb')],{'as':_0x389b('0x126'),'through':'UserWhatsappQueue','required':![]});db[_0x389b('0x14')]['belongsToMany'](db[_0x389b('0x127')],{'through':_0x389b('0x117')});db['User'][_0x389b('0x115')](db[_0x389b('0xed')],{'as':_0x389b('0x128'),'through':'user_has_voice_prefixes','required':![]});db['User'][_0x389b('0x115')](db[_0x389b('0x61')],{'as':'ChatWebsites','through':_0x389b('0x129')});db[_0x389b('0x14')][_0x389b('0x115')](db['FaxAccount'],{'as':_0x389b('0x12a'),'through':_0x389b('0x12b')});db[_0x389b('0x14')][_0x389b('0x115')](db[_0x389b('0x41')],{'as':_0x389b('0x12c'),'through':'user_has_mail_accounts'});db['User'][_0x389b('0x115')](db[_0x389b('0x5b')],{'as':_0x389b('0x12d'),'through':_0x389b('0x12e')});db[_0x389b('0x14')][_0x389b('0x115')](db[_0x389b('0x56')],{'as':_0x389b('0x12f'),'through':_0x389b('0x130')});db['User'][_0x389b('0x115')](db[_0x389b('0xf4')],{'as':'WhatsappAccounts','through':_0x389b('0x131')});db[_0x389b('0x14')]['belongsToMany'](db[_0x389b('0xd8')],{'as':_0x389b('0x132'),'through':_0x389b('0x133')});db[_0x389b('0x17')][_0x389b('0x103')](db['VoiceExtension'],{'as':_0x389b('0x134'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x135')});db[_0x389b('0x19')][_0x389b('0x103')](db[_0x389b('0x1b')],{'onDelete':'cascade'});db['VoiceExtension'][_0x389b('0x103')](db[_0x389b('0x1b')],{'as':_0x389b('0x136'),'onDelete':_0x389b('0x102')});db[_0x389b('0x1d')]['belongsToMany'](db[_0x389b('0x137')],{'as':_0x389b('0x138'),'through':_0x389b('0x139')});db[_0x389b('0x1f')]['hasMany'](db[_0x389b('0x32')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x389b('0x1f')]['hasMany'](db[_0x389b('0x73')],{'as':'Hoppers','foreignKey':_0x389b('0x13a')});db[_0x389b('0x1f')][_0x389b('0x103')](db['CmHopperFinal'],{'as':_0x389b('0x106'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x389b('0x103')](db[_0x389b('0x107')],{'as':_0x389b('0x13b'),'foreignKey':_0x389b('0x13a')});db[_0x389b('0x1f')][_0x389b('0x103')](db['ReportAgentPreview'],{'as':_0x389b('0x77'),'foreignKey':_0x389b('0x13a')});db[_0x389b('0x1f')][_0x389b('0x103')](db[_0x389b('0x74')],{'as':_0x389b('0x13c'),'foreignKey':_0x389b('0x13a')});db[_0x389b('0x1f')]['hasMany'](db[_0x389b('0xcb')],{'as':_0x389b('0x13d'),'foreignKey':_0x389b('0x13a')});db['VoiceQueue'][_0x389b('0x10f')](db[_0x389b('0x13e')],{'as':_0x389b('0x13e'),'foreignKey':_0x389b('0x13f')});db['VoiceQueue']['belongsTo'](db[_0x389b('0x13e')],{'as':_0x389b('0x140'),'foreignKey':_0x389b('0x141')});db[_0x389b('0x1f')][_0x389b('0x10f')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x389b('0x1f')][_0x389b('0x10f')](db[_0x389b('0x142')],{'as':'mandatoryDispositionPause','foreignKey':_0x389b('0x143')});db[_0x389b('0x1f')][_0x389b('0x115')](db[_0x389b('0x127')],{'as':_0x389b('0x116'),'through':_0x389b('0x144')});db[_0x389b('0x1f')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':_0x389b('0x34')});db[_0x389b('0x1f')][_0x389b('0x115')](db['Team'],{'as':'Teams','through':_0x389b('0xff')});db['VoiceQueue']['belongsToMany'](db[_0x389b('0x127')],{'as':_0x389b('0x146'),'through':_0x389b('0x147')});db['VoiceRecording']['belongsTo'](db[_0x389b('0x14')],{'as':_0x389b('0x14'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x23')]['belongsTo'](db[_0x389b('0x14')],{'as':'User','foreignKey':_0x389b('0x105')});db[_0x389b('0x25')][_0x389b('0x103')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x148'),'sourceKey':_0x389b('0x149')});db[_0x389b('0x27')][_0x389b('0x10f')](db[_0x389b('0x25')],{'foreignKey':_0x389b('0x148'),'targetKey':'mailbox'});db[_0x389b('0x28')][_0x389b('0x103')](db['VoiceQueueReport'],{'as':_0x389b('0x14a'),'foreignKey':_0x389b('0x14b'),'constraints':![]});db[_0x389b('0x28')][_0x389b('0x103')](db['VoiceAgentReport'],{'as':_0x389b('0x14c'),'foreignKey':'uniqueid','constraints':![]});db[_0x389b('0x28')][_0x389b('0x10f')](db[_0x389b('0x14')],{'as':_0x389b('0x14'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x28')][_0x389b('0x10f')](db['CmContact'],{'as':_0x389b('0x14d'),'foreignKey':'ContactId'});db[_0x389b('0x3d')][_0x389b('0x10f')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x389b('0x14e')});db[_0x389b('0x3f')][_0x389b('0x10f')](db[_0x389b('0x41')],{'as':_0x389b('0x41'),'foreignKey':'MailAccountId'});db[_0x389b('0x41')][_0x389b('0x101')](db[_0x389b('0x3d')],{'as':'Imap','onDelete':_0x389b('0x102')});db[_0x389b('0x41')][_0x389b('0x101')](db['MailServerOut'],{'as':'Smtp','onDelete':_0x389b('0x102')});db[_0x389b('0x41')][_0x389b('0x103')](db[_0x389b('0x7e')],{'as':_0x389b('0x14f'),'foreignKey':_0x389b('0x14e')});db['MailAccount']['hasMany'](db[_0x389b('0x7d')],{'as':_0x389b('0x150'),'foreignKey':_0x389b('0x14e')});db['MailAccount']['hasMany'](db['MailMessage'],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x389b('0x41')]['hasMany'](db['MailInteraction'],{'as':_0x389b('0x151')});db[_0x389b('0x41')][_0x389b('0x103')](db['MailApplication'],{'as':_0x389b('0x136')});db[_0x389b('0x41')][_0x389b('0x10f')](db['CmList'],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x41')][_0x389b('0x10f')](db[_0x389b('0x8c')],{'as':'Template','foreignKey':'TemplateId'});db[_0x389b('0x41')][_0x389b('0x10f')](db[_0x389b('0x142')],{'as':_0x389b('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount']['belongsToMany'](db[_0x389b('0x14')],{'as':'Agents','through':_0x389b('0x155')});db['MailQueue'][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':_0x389b('0x156')});db[_0x389b('0x43')]['belongsToMany'](db[_0x389b('0x157')],{'through':_0x389b('0x158'),'as':_0x389b('0x159')});db[_0x389b('0x46')][_0x389b('0x103')](db[_0x389b('0x15a')],{'as':'Messages','onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x15b')});db[_0x389b('0x46')][_0x389b('0x10f')](db[_0x389b('0x41')],{'as':'Account','foreignKey':'MailAccountId'});db['MailInteraction'][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':'Contact','foreignKey':'ContactId'});db[_0x389b('0x46')]['belongsTo'](db[_0x389b('0x14')],{'as':_0x389b('0x15d'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x46')]['belongsToMany'](db[_0x389b('0x15e')],{'through':_0x389b('0x15f'),'as':_0x389b('0x160')});db[_0x389b('0x46')]['belongsToMany'](db[_0x389b('0x15e')],{'through':_0x389b('0x15f'),'as':_0x389b('0x161')});db[_0x389b('0x46')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'through':_0x389b('0x119'),'foreignKey':_0x389b('0x15b')});db[_0x389b('0x15a')][_0x389b('0x103')](db[_0x389b('0xe2')],{'as':_0x389b('0x163'),'onDelete':_0x389b('0x102')});db[_0x389b('0x15a')][_0x389b('0x10f')](db[_0x389b('0x14')],{'as':_0x389b('0x14')});db[_0x389b('0x15a')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'onDelete':'cascade','as':_0x389b('0x14d')});db[_0x389b('0x15a')][_0x389b('0x10f')](db[_0x389b('0x46')],{'as':'Interaction','foreignKey':_0x389b('0x15b')});db['MailMessage'][_0x389b('0x10f')](db[_0x389b('0x41')],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x14e')});db[_0x389b('0x15a')][_0x389b('0x10f')](db[_0x389b('0x61')],{'as':_0x389b('0x61'),'foreignKey':'ChatWebsiteId'});db['MailMessage'][_0x389b('0x10f')](db[_0x389b('0x6a')],{'as':_0x389b('0x6a'),'foreignKey':_0x389b('0x165')});db['MailApplication']['belongsTo'](db[_0x389b('0x14')],{'onDelete':_0x389b('0x166')});db['MailApplication']['belongsTo'](db['MailQueue'],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x389b('0x41')],{'onDelete':_0x389b('0x166')});db[_0x389b('0x167')][_0x389b('0x10f')](db[_0x389b('0x82')],{'onDelete':'restrict','foreignKey':_0x389b('0x168')});db[_0x389b('0x167')]['belongsTo'](db[_0x389b('0x15e')],{'onDelete':_0x389b('0x166'),'foreignKey':_0x389b('0x169')});db[_0x389b('0x16a')][_0x389b('0x10f')](db[_0x389b('0x41')],{});db['MailQueueReport'][_0x389b('0x10f')](db[_0x389b('0x127')],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153')});db['MailQueueReport'][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':'Contact','foreignKey':_0x389b('0x16b')});db[_0x389b('0x16a')][_0x389b('0x10f')](db['MailInteraction'],{});db[_0x389b('0x16a')]['belongsTo'](db['MailMessage'],{});db[_0x389b('0x16a')][_0x389b('0x10f')](db[_0x389b('0x14')],{});db[_0x389b('0x16a')][_0x389b('0x10f')](db[_0x389b('0x43')],{});db['Dashboard']['hasMany'](db[_0x389b('0x4c')],{'as':_0x389b('0x16c'),'onDelete':_0x389b('0x102')});db[_0x389b('0x16d')][_0x389b('0x103')](db[_0x389b('0x7e')],{'as':_0x389b('0x14f'),'foreignKey':'FaxAccountId'});db[_0x389b('0x16d')][_0x389b('0x103')](db['CannedAnswer'],{'as':_0x389b('0x150'),'foreignKey':_0x389b('0x16e')});db[_0x389b('0x16d')]['hasMany'](db['FaxInteraction'],{'as':_0x389b('0x151')});db[_0x389b('0x16d')]['hasMany'](db[_0x389b('0x4e')],{'as':_0x389b('0x136')});db[_0x389b('0x16d')][_0x389b('0x103')](db[_0x389b('0x1b')],{'as':_0x389b('0x16f'),'onDelete':_0x389b('0x102')});db['FaxAccount']['hasMany'](db[_0x389b('0x51')],{'as':_0x389b('0x170')});db[_0x389b('0x16d')][_0x389b('0x10f')](db[_0x389b('0x13e')],{'as':'Trunk'});db[_0x389b('0x16d')][_0x389b('0x10f')](db['CmList'],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x16d')]['belongsTo'](db[_0x389b('0x142')],{'as':_0x389b('0x154'),'foreignKey':_0x389b('0x143')});db[_0x389b('0x16d')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0x389b('0x4e')]['belongsTo'](db['User'],{'onDelete':_0x389b('0x166')});db[_0x389b('0x4e')][_0x389b('0x10f')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x389b('0x4e')][_0x389b('0x10f')](db['FaxAccount'],{'onDelete':'restrict'});db[_0x389b('0x4e')][_0x389b('0x10f')](db[_0x389b('0x15e')],{'onDelete':_0x389b('0x166'),'foreignKey':_0x389b('0x169')});db[_0x389b('0x50')][_0x389b('0x103')](db['FaxMessage'],{'as':_0x389b('0x170'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0x389b('0x50')][_0x389b('0x10f')](db[_0x389b('0x16d')],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x16e')});db[_0x389b('0x50')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':'Contact','foreignKey':'ContactId'});db[_0x389b('0x50')][_0x389b('0x10f')](db['User'],{'as':_0x389b('0x15d'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x50')][_0x389b('0x115')](db[_0x389b('0x15e')],{'through':_0x389b('0x171'),'as':_0x389b('0x160')});db[_0x389b('0x50')]['belongsToMany'](db[_0x389b('0x15e')],{'through':_0x389b('0x171'),'as':'ThroughTags'});db[_0x389b('0x50')]['belongsToMany'](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'through':_0x389b('0x172'),'foreignKey':'FaxInteractionId'});db[_0x389b('0x51')][_0x389b('0x10f')](db['User'],{'onDelete':_0x389b('0x102'),'as':'User'});db[_0x389b('0x51')]['belongsTo'](db[_0x389b('0x50')],{'as':'Interaction','foreignKey':_0x389b('0x173')});db['FaxMessage'][_0x389b('0x10f')](db['CmContact'],{'onDelete':_0x389b('0x102'),'as':_0x389b('0x14d')});db[_0x389b('0x51')][_0x389b('0x10f')](db[_0x389b('0xe2')],{'as':_0x389b('0xe2'),'foreignKey':_0x389b('0x174')});db[_0x389b('0x51')]['belongsTo'](db[_0x389b('0x16d')],{'as':'Account','foreignKey':_0x389b('0x16e')});db['FaxQueue'][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':_0x389b('0x122')});db[_0x389b('0x53')][_0x389b('0x115')](db[_0x389b('0x157')],{'through':'team_has_fax_queues','as':_0x389b('0x159')});db['FaxQueueReport'][_0x389b('0x10f')](db[_0x389b('0x16d')],{});db[_0x389b('0x175')][_0x389b('0x10f')](db[_0x389b('0x127')],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153')});db['FaxQueueReport']['belongsTo'](db[_0x389b('0x15c')],{'as':_0x389b('0x14d'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0x389b('0x10f')](db['FaxInteraction'],{});db[_0x389b('0x175')][_0x389b('0x10f')](db[_0x389b('0x51')],{});db[_0x389b('0x175')][_0x389b('0x10f')](db['User'],{});db[_0x389b('0x175')]['belongsTo'](db[_0x389b('0x53')],{});db['SmsAccount'][_0x389b('0x103')](db[_0x389b('0x7e')],{'as':_0x389b('0x14f'),'foreignKey':_0x389b('0x176')});db[_0x389b('0x56')][_0x389b('0x103')](db[_0x389b('0x7d')],{'as':'Answers','foreignKey':_0x389b('0x176')});db[_0x389b('0x56')]['hasMany'](db[_0x389b('0x177')],{'as':_0x389b('0x170'),'foreignKey':'SmsAccountId'});db[_0x389b('0x56')][_0x389b('0x103')](db[_0x389b('0x10a')],{'as':_0x389b('0x151')});db['SmsAccount']['hasMany'](db[_0x389b('0x57')],{'as':_0x389b('0x136')});db[_0x389b('0x56')]['belongsTo'](db[_0x389b('0x127')],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x56')]['belongsTo'](db[_0x389b('0x142')],{'as':_0x389b('0x154'),'foreignKey':_0x389b('0x143')});db[_0x389b('0x56')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':_0x389b('0x130')});db[_0x389b('0x57')][_0x389b('0x10f')](db[_0x389b('0x14')],{'onDelete':'restrict'});db[_0x389b('0x57')]['belongsTo'](db['SmsQueue'],{'onDelete':_0x389b('0x166')});db['SmsApplication'][_0x389b('0x10f')](db[_0x389b('0x56')],{'onDelete':_0x389b('0x166')});db[_0x389b('0x57')][_0x389b('0x10f')](db[_0x389b('0x82')],{'onDelete':_0x389b('0x166'),'foreignKey':_0x389b('0x168')});db['SmsApplication'][_0x389b('0x10f')](db[_0x389b('0x15e')],{'onDelete':_0x389b('0x166'),'foreignKey':_0x389b('0x169')});db[_0x389b('0x10a')][_0x389b('0x103')](db[_0x389b('0x177')],{'as':_0x389b('0x170'),'onDelete':'cascade','foreignKey':_0x389b('0x178')});db[_0x389b('0x10a')]['belongsTo'](db['SmsAccount'],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x176')});db[_0x389b('0x10a')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':_0x389b('0x14d'),'foreignKey':'ContactId'});db[_0x389b('0x10a')][_0x389b('0x10f')](db[_0x389b('0x14')],{'as':_0x389b('0x15d'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x10a')][_0x389b('0x115')](db['Tag'],{'through':_0x389b('0x179'),'as':_0x389b('0x160')});db[_0x389b('0x10a')][_0x389b('0x115')](db[_0x389b('0x15e')],{'through':_0x389b('0x179'),'as':_0x389b('0x161')});db[_0x389b('0x10a')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0x389b('0x14')],{'as':_0x389b('0x14')});db[_0x389b('0x177')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'onDelete':'cascade','as':_0x389b('0x14d')});db[_0x389b('0x177')][_0x389b('0x10f')](db[_0x389b('0x10a')],{'onDelete':_0x389b('0x102'),'as':'Interaction','foreignKey':_0x389b('0x178')});db['SmsMessage'][_0x389b('0x10f')](db[_0x389b('0x56')],{'as':_0x389b('0x164'),'foreignKey':'SmsAccountId'});db[_0x389b('0x123')][_0x389b('0x115')](db['User'],{'as':_0x389b('0x145'),'through':_0x389b('0x125'),'foreignKey':_0x389b('0x17a')});db['SmsQueue'][_0x389b('0x115')](db[_0x389b('0x157')],{'through':_0x389b('0x17b'),'as':_0x389b('0x159')});db[_0x389b('0x5b')][_0x389b('0x103')](db[_0x389b('0x7e')],{'as':'Dispositions','foreignKey':_0x389b('0x17c')});db[_0x389b('0x5b')]['hasMany'](db[_0x389b('0x7d')],{'as':_0x389b('0x150'),'foreignKey':_0x389b('0x17c')});db[_0x389b('0x5b')][_0x389b('0x103')](db[_0x389b('0x11b')],{'as':'Interactions','foreignKey':_0x389b('0x17c')});db[_0x389b('0x5b')][_0x389b('0x103')](db[_0x389b('0x17d')],{'as':'Messages','foreignKey':_0x389b('0x17c')});db['OpenchannelAccount'][_0x389b('0x103')](db[_0x389b('0x5c')],{'as':'Applications','foreignKey':_0x389b('0x17c')});db[_0x389b('0x5b')][_0x389b('0x10f')](db[_0x389b('0x127')],{'as':'List','foreignKey':_0x389b('0x153')});db[_0x389b('0x5b')][_0x389b('0x10f')](db[_0x389b('0x142')],{'as':_0x389b('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x389b('0x5b')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':'user_has_openchannel_accounts'});db[_0x389b('0x5c')][_0x389b('0x10f')](db[_0x389b('0x14')],{'onDelete':'restrict'});db[_0x389b('0x5c')][_0x389b('0x10f')](db[_0x389b('0x5f')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0x389b('0x10f')](db[_0x389b('0x5b')],{'onDelete':'restrict','foreignKey':_0x389b('0x17c')});db[_0x389b('0x5c')][_0x389b('0x10f')](db[_0x389b('0x82')],{'onDelete':_0x389b('0x166'),'foreignKey':_0x389b('0x168')});db['OpenchannelApplication'][_0x389b('0x10f')](db['Tag'],{'onDelete':_0x389b('0x166'),'foreignKey':_0x389b('0x169')});db[_0x389b('0x11b')][_0x389b('0x103')](db[_0x389b('0x17d')],{'as':_0x389b('0x170'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x17e')});db[_0x389b('0x11b')][_0x389b('0x10f')](db[_0x389b('0x5b')],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x17c')});db[_0x389b('0x11b')]['belongsTo'](db['CmContact'],{'as':_0x389b('0x14d'),'foreignKey':_0x389b('0x16b')});db['OpenchannelInteraction'][_0x389b('0x10f')](db[_0x389b('0x14')],{'as':'Owner','foreignKey':_0x389b('0x105')});db[_0x389b('0x11b')]['belongsToMany'](db[_0x389b('0x15e')],{'through':_0x389b('0x17f'),'as':_0x389b('0x160')});db[_0x389b('0x11b')]['belongsToMany'](db[_0x389b('0x15e')],{'through':_0x389b('0x17f'),'as':_0x389b('0x161')});db['OpenchannelInteraction'][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'through':_0x389b('0x11d'),'foreignKey':'OpenchannelInteractionId'});db[_0x389b('0x17d')][_0x389b('0x10f')](db['User'],{'onDelete':'cascade','as':_0x389b('0x14')});db[_0x389b('0x17d')]['belongsTo'](db[_0x389b('0x15c')],{'onDelete':_0x389b('0x102'),'as':_0x389b('0x14d')});db[_0x389b('0x17d')][_0x389b('0x10f')](db[_0x389b('0x11b')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x389b('0x17e')});db[_0x389b('0x17d')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x389b('0x17d')][_0x389b('0x10f')](db[_0x389b('0x5b')],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x17c')});db['OpenchannelQueue'][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':_0x389b('0x3b'),'foreignKey':_0x389b('0x180')});db[_0x389b('0x5f')][_0x389b('0x115')](db[_0x389b('0x157')],{'through':_0x389b('0x181'),'as':_0x389b('0x159')});db[_0x389b('0x61')][_0x389b('0x103')](db['Disposition'],{'as':'Dispositions','foreignKey':'ChatWebsiteId'});db[_0x389b('0x61')][_0x389b('0x103')](db[_0x389b('0x7d')],{'as':_0x389b('0x150'),'foreignKey':_0x389b('0x182')});db[_0x389b('0x61')][_0x389b('0x103')](db[_0x389b('0x6f')],{'as':_0x389b('0x183')});db[_0x389b('0x61')][_0x389b('0x103')](db[_0x389b('0x66')],{'as':_0x389b('0x151')});db['ChatWebsite'][_0x389b('0x103')](db[_0x389b('0x65')],{'as':_0x389b('0x136')});db[_0x389b('0x61')][_0x389b('0x103')](db[_0x389b('0x68')],{'as':_0x389b('0x170')});db[_0x389b('0x61')][_0x389b('0x10f')](db['CmList'],{'as':'List','foreignKey':_0x389b('0x153')});db['ChatWebsite'][_0x389b('0x10f')](db[_0x389b('0x82')],{'as':_0x389b('0x82'),'foreignKey':_0x389b('0x168')});db[_0x389b('0x61')][_0x389b('0x10f')](db[_0x389b('0x41')],{'as':_0x389b('0x41'),'foreignKey':_0x389b('0x14e')});db['ChatWebsite'][_0x389b('0x10f')](db['Pause'],{'as':_0x389b('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x389b('0x61')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0x389b('0x10f')](db[_0x389b('0x5b')],{});db[_0x389b('0x63')]['belongsTo'](db[_0x389b('0x127')],{'as':'List','foreignKey':_0x389b('0x153')});db['OpenchannelQueueReport'][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':'Contact','foreignKey':'ContactId'});db[_0x389b('0x63')][_0x389b('0x10f')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x389b('0x10f')](db[_0x389b('0x17d')],{});db[_0x389b('0x63')][_0x389b('0x10f')](db[_0x389b('0x14')],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelQueue'],{});db['ChatApplication'][_0x389b('0x10f')](db['User'],{'as':_0x389b('0x184'),'foreignKey':_0x389b('0x105'),'onDelete':'restrict'});db[_0x389b('0x65')][_0x389b('0x10f')](db[_0x389b('0x6c')],{'as':_0x389b('0x185'),'foreignKey':_0x389b('0x186'),'onDelete':_0x389b('0x166')});db[_0x389b('0x65')]['belongsTo'](db[_0x389b('0x61')],{'as':_0x389b('0x187'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x389b('0x65')][_0x389b('0x10f')](db[_0x389b('0x15e')],{'onDelete':'restrict','foreignKey':_0x389b('0x169')});db[_0x389b('0x66')]['hasMany'](db[_0x389b('0x68')],{'as':'Messages','onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x188')});db[_0x389b('0x66')]['belongsTo'](db['ChatWebsite'],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x182')});db['ChatInteraction'][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':'Contact','foreignKey':'ContactId'});db[_0x389b('0x66')][_0x389b('0x10f')](db[_0x389b('0x14')],{'as':_0x389b('0x15d'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x66')][_0x389b('0x115')](db[_0x389b('0x15e')],{'through':_0x389b('0x189'),'as':_0x389b('0x160')});db[_0x389b('0x66')][_0x389b('0x115')](db[_0x389b('0x15e')],{'through':_0x389b('0x189'),'as':_0x389b('0x161')});db[_0x389b('0x66')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':'Users','through':_0x389b('0x18a'),'foreignKey':_0x389b('0x188')});db['ChatMessage'][_0x389b('0x10f')](db['User'],{'onDelete':'cascade','as':_0x389b('0x14')});db[_0x389b('0x68')][_0x389b('0x10f')](db['CmContact'],{'onDelete':_0x389b('0x102'),'as':_0x389b('0x14d'),'foreignKey':_0x389b('0x16b')});db[_0x389b('0x68')][_0x389b('0x10f')](db[_0x389b('0x66')],{'onDelete':'cascade','as':_0x389b('0x18b'),'foreignKey':'ChatInteractionId'});db[_0x389b('0x68')][_0x389b('0x10f')](db['Attachment'],{'as':_0x389b('0xe2'),'foreignKey':_0x389b('0x174')});db[_0x389b('0x68')][_0x389b('0x10f')](db['ChatWebsite'],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x182')});db[_0x389b('0x6a')][_0x389b('0x103')](db[_0x389b('0xe2')],{'as':'Attachments','foreignKey':_0x389b('0x165'),'onDelete':_0x389b('0x102'),'hooks':!![]});db[_0x389b('0x6a')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'onDelete':'cascade','as':_0x389b('0x14d'),'foreignKey':_0x389b('0x16b')});db[_0x389b('0x6a')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0x389b('0x115')](db[_0x389b('0x157')],{'through':_0x389b('0x18c'),'as':_0x389b('0x159')});db['ChatGroup'][_0x389b('0x103')](db[_0x389b('0xc6')],{'as':_0x389b('0x170'),'foreignKey':_0x389b('0x18d'),'onDelete':_0x389b('0x102')});db['ChatGroup']['belongsToMany'](db[_0x389b('0x14')],{'as':_0x389b('0x18e'),'through':_0x389b('0x18f')});db[_0x389b('0x6f')][_0x389b('0x10f')](db[_0x389b('0x61')],{'as':_0x389b('0x187'),'foreignKey':'ChatWebsiteId'});db[_0x389b('0x190')][_0x389b('0x103')](db[_0x389b('0x15c')],{'as':_0x389b('0x113'),'foreignKey':_0x389b('0x191')});db[_0x389b('0x15c')][_0x389b('0x103')](db[_0x389b('0x73')],{'as':_0x389b('0x192'),'foreignKey':_0x389b('0x16b')});db[_0x389b('0x15c')][_0x389b('0x103')](db[_0x389b('0x193')],{'as':_0x389b('0x106'),'foreignKey':_0x389b('0x16b')});db[_0x389b('0x15c')][_0x389b('0x103')](db[_0x389b('0x107')],{'as':'HopperHistories','foreignKey':_0x389b('0x16b')});db['CmContact'][_0x389b('0x103')](db[_0x389b('0x77')],{'as':_0x389b('0x77'),'foreignKey':'ContactId'});db['CmContact'][_0x389b('0x103')](db[_0x389b('0xcb')],{'as':_0x389b('0x13d'),'foreignKey':'ContactId'});db['CmContact'][_0x389b('0x103')](db[_0x389b('0x11b')],{'as':_0x389b('0x11c'),'foreignKey':_0x389b('0x16b'),'onDelete':_0x389b('0x166')});db['CmContact'][_0x389b('0x103')](db[_0x389b('0x66')],{'as':_0x389b('0x109'),'foreignKey':_0x389b('0x16b'),'onDelete':_0x389b('0x166')});db[_0x389b('0x15c')][_0x389b('0x103')](db[_0x389b('0x10a')],{'as':'SmsInteractions','foreignKey':_0x389b('0x16b'),'onDelete':_0x389b('0x166')});db[_0x389b('0x15c')][_0x389b('0x103')](db[_0x389b('0x50')],{'as':'FaxInteractions','foreignKey':_0x389b('0x16b'),'onDelete':'restrict'});db['CmContact']['hasMany'](db[_0x389b('0x46')],{'as':'MailInteractions','foreignKey':_0x389b('0x16b'),'onDelete':_0x389b('0x166')});db[_0x389b('0x15c')][_0x389b('0x10f')](db[_0x389b('0x190')],{'as':'Company','foreignKey':'CompanyId'});db[_0x389b('0x15c')]['belongsTo'](db['CmList'],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153'),'onDelete':'cascade'});db[_0x389b('0x15c')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'through':_0x389b('0x114')});db[_0x389b('0x15c')][_0x389b('0x115')](db[_0x389b('0x15e')],{'as':_0x389b('0x160'),'through':_0x389b('0x194')});db['CmContact'][_0x389b('0x115')](db['Tag'],{'through':_0x389b('0x194'),'as':_0x389b('0x161')});db['CmHopper'][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':'Contact','foreignKey':_0x389b('0x16b'),'onDelete':_0x389b('0x102')});db['CmHopper']['belongsTo'](db[_0x389b('0x127')],{'as':'List','foreignKey':_0x389b('0x153'),'onDelete':'cascade'});db[_0x389b('0x73')][_0x389b('0x10f')](db[_0x389b('0x14')],{'as':'Agent','foreignKey':_0x389b('0x105')});db[_0x389b('0x73')][_0x389b('0x10f')](db[_0x389b('0x1f')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x389b('0x102')});db[_0x389b('0x73')][_0x389b('0x10f')](db['Campaign'],{'as':'Campaign','foreignKey':'CampaignId','onDelete':'cascade'});db[_0x389b('0x73')]['belongsTo'](db[_0x389b('0x14')],{'as':'Owner','foreignKey':_0x389b('0x195')});db[_0x389b('0x74')][_0x389b('0x10f')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0x389b('0x74')][_0x389b('0x10f')](db['CmList'],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153'),'onDelete':_0x389b('0x102')});db[_0x389b('0x74')][_0x389b('0x10f')](db[_0x389b('0x1f')],{'as':_0x389b('0x185'),'foreignKey':_0x389b('0x13a'),'onDelete':'cascade'});db[_0x389b('0x74')][_0x389b('0x10f')](db[_0x389b('0xde')],{'as':_0x389b('0xde'),'foreignKey':_0x389b('0x196'),'onDelete':_0x389b('0x102')});db['Automation']['hasMany'](db[_0x389b('0x80')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x389b('0x197'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x389b('0x103')](db['Condition'],{'as':{'plural':_0x389b('0x198'),'singular':_0x389b('0x199')},'foreignKey':_0x389b('0x19a'),'onDelete':_0x389b('0x102'),'hooks':!![]});db['Automation']['hasMany'](db[_0x389b('0x7a')],{'as':_0x389b('0x19b'),'foreignKey':_0x389b('0x19c'),'onDelete':_0x389b('0x102'),'hooks':!![]});db['Disposition'][_0x389b('0x103')](db['Disposition'],{'as':_0x389b('0x14f'),'foreignKey':_0x389b('0x19d'),'onDelete':'cascade'});db[_0x389b('0x82')]['hasMany'](db[_0x389b('0x82')],{'as':_0x389b('0x19e'),'foreignKey':_0x389b('0x168'),'onDelete':_0x389b('0x102'),'hooks':!![],'required':![]});db[_0x389b('0x82')]['hasMany'](db[_0x389b('0x1b')],{'as':_0x389b('0x19f'),'foreignKey':_0x389b('0x168'),'onDelete':_0x389b('0x166')});db['Interval'][_0x389b('0x103')](db[_0x389b('0x167')],{'as':_0x389b('0x1a0'),'foreignKey':_0x389b('0x168')});db['Interval'][_0x389b('0x103')](db['ChatApplication'],{'as':_0x389b('0x1a1'),'foreignKey':_0x389b('0x168')});db[_0x389b('0x82')][_0x389b('0x103')](db[_0x389b('0x4e')],{'as':_0x389b('0x1a2'),'foreignKey':'IntervalId'});db['Interval'][_0x389b('0x103')](db[_0x389b('0x57')],{'as':'SmsApplications','foreignKey':_0x389b('0x168')});db[_0x389b('0x89')][_0x389b('0x10f')](db[_0x389b('0x41')],{});db[_0x389b('0x89')][_0x389b('0x10f')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0x389b('0x89')][_0x389b('0x10f')](db[_0x389b('0x95')],{'foreignKey':_0x389b('0x1a3')});db['Sound'][_0x389b('0x115')](db[_0x389b('0x1d')],{'as':_0x389b('0x1a4'),'through':_0x389b('0x139'),'onDelete':_0x389b('0x166')});db['Tag'][_0x389b('0x115')](db[_0x389b('0x15c')],{'through':'cm_contact_has_tags'});db['Tag']['belongsToMany'](db['ChatInteraction'],{'through':_0x389b('0x189')});db[_0x389b('0x15e')][_0x389b('0x115')](db[_0x389b('0x46')],{'through':_0x389b('0x15f')});db['Tag']['belongsToMany'](db[_0x389b('0x10a')],{'through':_0x389b('0x179')});db[_0x389b('0x15e')][_0x389b('0x115')](db[_0x389b('0x50')],{'through':_0x389b('0x171')});db[_0x389b('0x15e')][_0x389b('0x115')](db['OpenchannelInteraction'],{'through':_0x389b('0x17f')});db[_0x389b('0x15e')][_0x389b('0x115')](db[_0x389b('0xf7')],{'through':_0x389b('0x1a5')});db[_0x389b('0x8e')][_0x389b('0x103')](db[_0x389b('0x80')],{'as':{'plural':_0x389b('0x1a6'),'singular':_0x389b('0x1a7')},'foreignKey':_0x389b('0x1a8'),'onDelete':_0x389b('0x102'),'hooks':!![]});db['Trigger'][_0x389b('0x103')](db[_0x389b('0x80')],{'as':{'plural':'AnyConditions','singular':_0x389b('0x1a9')},'foreignKey':'TriggerAnyId','onDelete':_0x389b('0x102'),'hooks':!![]});db[_0x389b('0x8e')][_0x389b('0x103')](db[_0x389b('0x7a')],{'as':_0x389b('0x19b'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x389b('0x95')][_0x389b('0x103')](db['AnalyticFieldReport'],{'as':_0x389b('0x1aa'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1a3'),'hooks':!![]});db[_0x389b('0x1ab')]['hasMany'](db[_0x389b('0x99')],{'as':_0x389b('0x1aa'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1ac')});db[_0x389b('0x1ad')][_0x389b('0x103')](db['AnalyticFieldReport'],{'as':_0x389b('0x1aa'),'onDelete':_0x389b('0x102'),'foreignKey':'MetricId'});db[_0x389b('0x99')][_0x389b('0x10f')](db[_0x389b('0x1ad')],{'foreignKey':_0x389b('0x1ae')});db[_0x389b('0x9d')][_0x389b('0x103')](db[_0x389b('0x9f')],{'as':_0x389b('0x1af'),'onDelete':'cascade','foreignKey':_0x389b('0x1b0')});db[_0x389b('0x9f')]['hasMany'](db[_0x389b('0xa1')],{'as':_0x389b('0x1b1'),'onDelete':'cascade','foreignKey':_0x389b('0x1b2')});db[_0x389b('0x9f')]['hasMany'](db[_0x389b('0xa1')],{'as':_0x389b('0x1b3'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0x9f')][_0x389b('0x103')](db[_0x389b('0xa1')],{'as':_0x389b('0x1aa'),'onDelete':_0x389b('0x102'),'foreignKey':'FieldId'});db['SalesforceConfiguration']['belongsTo'](db[_0x389b('0x9d')],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x1b0')});db[_0x389b('0xa1')][_0x389b('0x103')](db[_0x389b('0xa1')],{'as':_0x389b('0x1b5'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0xa1')]['hasMany'](db[_0x389b('0xa1')],{'as':_0x389b('0x1b6'),'foreignKey':_0x389b('0x1b4')});db['SalesforceField']['hasMany'](db[_0x389b('0xa1')],{'as':_0x389b('0x1b7'),'foreignKey':'FieldId'});db[_0x389b('0xa1')][_0x389b('0x10f')](db[_0x389b('0x1b8')],{'as':_0x389b('0x1b8'),'foreignKey':_0x389b('0x1b9')});db[_0x389b('0xa3')][_0x389b('0x103')](db[_0x389b('0x1ba')],{'as':_0x389b('0x1af'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b0')});db[_0x389b('0x1ba')][_0x389b('0x103')](db[_0x389b('0xa5')],{'as':_0x389b('0x1b1'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0x1ba')][_0x389b('0x103')](db[_0x389b('0xa5')],{'as':_0x389b('0x1b3'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0x1ba')][_0x389b('0x103')](db[_0x389b('0xa5')],{'as':_0x389b('0x1aa'),'onDelete':'cascade','foreignKey':_0x389b('0x1bb')});db['SugarcrmConfiguration']['belongsTo'](db[_0x389b('0xa3')],{'as':_0x389b('0x164'),'foreignKey':'AccountId'});db[_0x389b('0xa5')]['hasMany'](db[_0x389b('0xa5')],{'as':_0x389b('0x1b5'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0xa5')][_0x389b('0x103')](db[_0x389b('0xa5')],{'as':_0x389b('0x1b6'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0xa5')][_0x389b('0x103')](db[_0x389b('0xa5')],{'as':_0x389b('0x1b7'),'foreignKey':_0x389b('0x1bb')});db[_0x389b('0xa5')]['belongsTo'](db[_0x389b('0x1b8')],{'as':'Variable','foreignKey':'VariableId'});db['DeskAccount'][_0x389b('0x103')](db[_0x389b('0xa8')],{'as':'Configurations','onDelete':_0x389b('0x102'),'foreignKey':'AccountId'});db[_0x389b('0xa8')][_0x389b('0x103')](db['DeskField'],{'as':'Subjects','onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0xa8')]['hasMany'](db['DeskField'],{'as':_0x389b('0x1b3'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0xa8')]['hasMany'](db[_0x389b('0xaa')],{'as':_0x389b('0x1aa'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1bb')});db['DeskConfiguration'][_0x389b('0x10f')](db[_0x389b('0x1bc')],{'as':'Account','foreignKey':_0x389b('0x1b0')});db[_0x389b('0xa8')][_0x389b('0x115')](db['Tag'],{'through':_0x389b('0x1bd')});db['DeskField']['hasMany'](db[_0x389b('0xaa')],{'as':'Subject','foreignKey':_0x389b('0x1b2')});db[_0x389b('0xaa')]['hasMany'](db[_0x389b('0xaa')],{'as':'Description','foreignKey':_0x389b('0x1b4')});db[_0x389b('0xaa')][_0x389b('0x103')](db[_0x389b('0xaa')],{'as':_0x389b('0x1b7'),'foreignKey':'FieldId'});db[_0x389b('0xaa')][_0x389b('0x10f')](db[_0x389b('0x1b8')],{'as':'Variable','foreignKey':'VariableId'});db[_0x389b('0xab')][_0x389b('0x103')](db[_0x389b('0x1be')],{'as':_0x389b('0x1af'),'onDelete':_0x389b('0x102'),'foreignKey':'AccountId'});db[_0x389b('0x1be')]['hasMany'](db[_0x389b('0x1bf')],{'as':_0x389b('0x1b1'),'onDelete':_0x389b('0x102'),'foreignKey':'SubjectId'});db[_0x389b('0x1be')]['hasMany'](db[_0x389b('0x1bf')],{'as':_0x389b('0x1b3'),'onDelete':'cascade','foreignKey':_0x389b('0x1b4')});db[_0x389b('0x1be')][_0x389b('0x103')](db[_0x389b('0x1bf')],{'as':_0x389b('0x1aa'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x389b('0x1be')][_0x389b('0x10f')](db[_0x389b('0xab')],{'as':'Account','foreignKey':'AccountId'});db[_0x389b('0x1bf')][_0x389b('0x103')](db[_0x389b('0x1bf')],{'as':_0x389b('0x1b5'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0x1bf')][_0x389b('0x103')](db[_0x389b('0x1bf')],{'as':_0x389b('0x1b6'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0x1bf')]['hasMany'](db[_0x389b('0x1bf')],{'as':_0x389b('0x1b7'),'foreignKey':_0x389b('0x1bb')});db['ZohoField']['belongsTo'](db[_0x389b('0x1b8')],{'as':_0x389b('0x1b8'),'foreignKey':_0x389b('0x1b9')});db['ZendeskAccount'][_0x389b('0x103')](db['ZendeskConfiguration'],{'as':_0x389b('0x1af'),'onDelete':'cascade','foreignKey':_0x389b('0x1b0')});db['ZendeskConfiguration'][_0x389b('0x103')](db['ZendeskField'],{'as':_0x389b('0x1b1'),'foreignKey':_0x389b('0x1b2')});db['ZendeskConfiguration'][_0x389b('0x103')](db[_0x389b('0xb2')],{'as':_0x389b('0x1b3'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0xb1')]['hasMany'](db[_0x389b('0xb2')],{'as':'Fields','foreignKey':'FieldId'});db[_0x389b('0xb1')][_0x389b('0x10f')](db[_0x389b('0xaf')],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x1b0')});db[_0x389b('0xb1')][_0x389b('0x115')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x389b('0xb2')][_0x389b('0x103')](db[_0x389b('0xb2')],{'as':_0x389b('0x1b5'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0xb2')]['hasMany'](db['ZendeskField'],{'as':'Description','foreignKey':_0x389b('0x1b4')});db['ZendeskField']['hasMany'](db[_0x389b('0xb2')],{'as':_0x389b('0x1b7'),'foreignKey':'FieldId'});db[_0x389b('0xb2')][_0x389b('0x10f')](db['Variable'],{'as':_0x389b('0x1b8'),'foreignKey':_0x389b('0x1b9')});db[_0x389b('0x1c0')]['hasMany'](db[_0x389b('0xb5')],{'as':_0x389b('0x1af'),'onDelete':'cascade','foreignKey':_0x389b('0x1b0')});db[_0x389b('0xb5')][_0x389b('0x103')](db[_0x389b('0x1c1')],{'as':'Subjects','onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0xb5')][_0x389b('0x103')](db['FreshdeskField'],{'as':_0x389b('0x1b3'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0xb5')]['hasMany'](db[_0x389b('0x1c1')],{'as':_0x389b('0x1aa'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1bb')});db[_0x389b('0xb5')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x1b0')});db['FreshdeskConfiguration'][_0x389b('0x115')](db['Tag'],{'through':_0x389b('0x1c2')});db[_0x389b('0x1c1')]['hasMany'](db[_0x389b('0x1c1')],{'as':'Subject','foreignKey':_0x389b('0x1b2')});db[_0x389b('0x1c1')][_0x389b('0x103')](db['FreshdeskField'],{'as':_0x389b('0x1b6'),'foreignKey':'DescriptionId'});db[_0x389b('0x1c1')]['hasMany'](db['FreshdeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0x389b('0x1c1')][_0x389b('0x10f')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['VtigerAccount']['hasMany'](db[_0x389b('0x1c3')],{'as':_0x389b('0x1af'),'onDelete':'cascade','foreignKey':_0x389b('0x1b0')});db[_0x389b('0x1c3')][_0x389b('0x103')](db[_0x389b('0xba')],{'as':'Subjects','foreignKey':_0x389b('0x1b2')});db['VtigerConfiguration'][_0x389b('0x103')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x389b('0x1b4')});db[_0x389b('0x1c3')]['hasMany'](db[_0x389b('0xba')],{'as':_0x389b('0x1aa'),'foreignKey':_0x389b('0x1bb')});db[_0x389b('0x1c3')]['belongsTo'](db['VtigerAccount'],{'as':_0x389b('0x164'),'foreignKey':'AccountId'});db[_0x389b('0xba')][_0x389b('0x103')](db[_0x389b('0xba')],{'as':_0x389b('0x1b5'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0xba')]['hasMany'](db[_0x389b('0xba')],{'as':_0x389b('0x1b6'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0xba')]['hasMany'](db[_0x389b('0xba')],{'as':'Field','foreignKey':_0x389b('0x1bb')});db[_0x389b('0xba')][_0x389b('0x10f')](db['Variable'],{'as':_0x389b('0x1b8'),'foreignKey':_0x389b('0x1b9')});db[_0x389b('0x1c4')][_0x389b('0x103')](db[_0x389b('0xbd')],{'as':_0x389b('0x1af'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b0')});db[_0x389b('0xbd')][_0x389b('0x103')](db[_0x389b('0x1c5')],{'as':'Subjects','foreignKey':_0x389b('0x1b2')});db['ServicenowConfiguration']['hasMany'](db[_0x389b('0x1c5')],{'as':_0x389b('0x1b3'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0xbd')][_0x389b('0x103')](db[_0x389b('0x1c5')],{'as':_0x389b('0x1aa'),'foreignKey':_0x389b('0x1bb')});db[_0x389b('0xbd')][_0x389b('0x10f')](db[_0x389b('0x1c4')],{'as':_0x389b('0x164'),'foreignKey':'AccountId'});db[_0x389b('0x1c5')]['hasMany'](db[_0x389b('0x1c5')],{'as':_0x389b('0x1b5'),'foreignKey':_0x389b('0x1b2')});db['ServicenowField'][_0x389b('0x103')](db[_0x389b('0x1c5')],{'as':'Description','foreignKey':_0x389b('0x1b4')});db[_0x389b('0x1c5')]['hasMany'](db[_0x389b('0x1c5')],{'as':_0x389b('0x1b7'),'foreignKey':_0x389b('0x1bb')});db[_0x389b('0x1c5')][_0x389b('0x10f')](db[_0x389b('0x1b8')],{'as':'Variable','foreignKey':'VariableId'});db[_0x389b('0x1c6')][_0x389b('0x103')](db[_0x389b('0x1c7')],{'as':_0x389b('0x1af'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b0')});db[_0x389b('0x1c7')][_0x389b('0x103')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0x1c7')][_0x389b('0x103')](db[_0x389b('0xc0')],{'as':_0x389b('0x1b3'),'onDelete':_0x389b('0x102'),'foreignKey':'DescriptionId'});db[_0x389b('0x1c7')]['hasMany'](db[_0x389b('0xc0')],{'as':_0x389b('0x1aa'),'onDelete':_0x389b('0x102'),'foreignKey':'FieldId'});db[_0x389b('0x1c7')][_0x389b('0x10f')](db[_0x389b('0x1c6')],{'as':_0x389b('0x164'),'foreignKey':'AccountId'});db[_0x389b('0xc0')][_0x389b('0x103')](db[_0x389b('0xc0')],{'as':_0x389b('0x1b5'),'foreignKey':_0x389b('0x1b2')});db['Dynamics365Field']['hasMany'](db[_0x389b('0xc0')],{'as':_0x389b('0x1b6'),'foreignKey':'DescriptionId'});db[_0x389b('0xc0')][_0x389b('0x103')](db[_0x389b('0xc0')],{'as':'Field','foreignKey':'FieldId'});db[_0x389b('0xc0')][_0x389b('0x10f')](db[_0x389b('0x1b8')],{'as':'Variable','foreignKey':'VariableId'});db['FreshsalesAccount']['hasMany'](db[_0x389b('0x1c8')],{'as':_0x389b('0x1af'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b0')});db[_0x389b('0x1c8')]['hasMany'](db[_0x389b('0x1c9')],{'as':_0x389b('0x1b1'),'foreignKey':_0x389b('0x1b2')});db['FreshsalesConfiguration'][_0x389b('0x103')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0x389b('0x1b4')});db[_0x389b('0x1c8')]['hasMany'](db[_0x389b('0x1c9')],{'as':_0x389b('0x1aa'),'foreignKey':_0x389b('0x1bb')});db[_0x389b('0x1c8')]['belongsTo'](db[_0x389b('0x1ca')],{'as':_0x389b('0x164'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x389b('0x103')](db[_0x389b('0x1c9')],{'as':_0x389b('0x1b5'),'foreignKey':'SubjectId'});db[_0x389b('0x1c9')]['hasMany'](db[_0x389b('0x1c9')],{'as':_0x389b('0x1b6'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0x1c9')][_0x389b('0x103')](db[_0x389b('0x1c9')],{'as':'Field','foreignKey':_0x389b('0x1bb')});db[_0x389b('0x1c9')]['belongsTo'](db[_0x389b('0x1b8')],{'as':_0x389b('0x1b8'),'foreignKey':_0x389b('0x1b9')});db[_0x389b('0x1cb')][_0x389b('0x10f')](db[_0x389b('0x61')],{});db[_0x389b('0x1cb')][_0x389b('0x10f')](db[_0x389b('0x127')],{'as':'List','foreignKey':'ListId'});db[_0x389b('0x1cb')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':_0x389b('0x14d'),'foreignKey':'ContactId'});db[_0x389b('0x1cb')][_0x389b('0x10f')](db[_0x389b('0x66')],{});db[_0x389b('0x1cb')][_0x389b('0x10f')](db[_0x389b('0x68')],{});db[_0x389b('0x1cb')][_0x389b('0x10f')](db['User'],{});db[_0x389b('0x1cb')]['belongsTo'](db[_0x389b('0x6c')],{});db[_0x389b('0xc6')]['belongsTo'](db[_0x389b('0x14')],{'onDelete':'cascade','foreignKey':_0x389b('0x1cc')});db[_0x389b('0xc6')][_0x389b('0x10f')](db['User'],{'onDelete':'cascade','foreignKey':_0x389b('0x1cd')});db[_0x389b('0xcb')][_0x389b('0x103')](db[_0x389b('0xc9')],{'foreignKey':_0x389b('0x1ce'),'onDelete':'cascade'});db['JscriptySessionReport'][_0x389b('0x103')](db['JscriptyAnswerReport'],{'foreignKey':_0x389b('0x1ce'),'onDelete':_0x389b('0x102')});db[_0x389b('0xcd')][_0x389b('0x10f')](db[_0x389b('0x56')],{});db[_0x389b('0xcd')][_0x389b('0x10f')](db[_0x389b('0x127')],{'as':'List','foreignKey':_0x389b('0x153')});db[_0x389b('0xcd')]['belongsTo'](db[_0x389b('0x15c')],{'as':_0x389b('0x14d'),'foreignKey':_0x389b('0x16b')});db['SmsQueueReport'][_0x389b('0x10f')](db[_0x389b('0x10a')],{});db[_0x389b('0xcd')]['belongsTo'](db[_0x389b('0x177')],{});db['SmsQueueReport'][_0x389b('0x10f')](db[_0x389b('0x14')],{});db[_0x389b('0xcd')][_0x389b('0x10f')](db[_0x389b('0x123')],{});db[_0x389b('0xd2')][_0x389b('0x103')](db[_0x389b('0xcb')],{'foreignKey':'ProjectId'});db[_0x389b('0xd2')][_0x389b('0x103')](db['JscriptyQuestionReport'],{'foreignKey':_0x389b('0x1cf')});db[_0x389b('0xd2')][_0x389b('0x103')](db[_0x389b('0x1d0')],{'foreignKey':_0x389b('0x1cf')});db[_0x389b('0xd8')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'through':_0x389b('0x133')});db[_0x389b('0x157')]['belongsToMany'](db['User'],{'as':_0x389b('0x145'),'through':_0x389b('0x118')});db['Team']['belongsToMany'](db[_0x389b('0x1f')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db['Team'][_0x389b('0x115')](db[_0x389b('0x43')],{'through':'team_has_mail_queues','as':_0x389b('0x11f')});db[_0x389b('0x157')]['belongsToMany'](db[_0x389b('0x6c')],{'through':_0x389b('0x18c'),'as':_0x389b('0x120')});db[_0x389b('0x157')][_0x389b('0x115')](db[_0x389b('0x53')],{'through':_0x389b('0x1d1'),'as':_0x389b('0x121')});db[_0x389b('0x157')][_0x389b('0x115')](db[_0x389b('0x123')],{'through':_0x389b('0x17b'),'as':_0x389b('0x124')});db[_0x389b('0x157')][_0x389b('0x115')](db[_0x389b('0x5f')],{'through':_0x389b('0x181'),'as':'OpenchannelQueues'});db[_0x389b('0x157')]['belongsToMany'](db[_0x389b('0xfb')],{'through':_0x389b('0x1d2'),'as':_0x389b('0x126')});db[_0x389b('0xde')][_0x389b('0x103')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x389b('0x196')});db[_0x389b('0xde')][_0x389b('0x103')](db[_0x389b('0x193')],{'as':_0x389b('0x106'),'foreignKey':_0x389b('0x196')});db['Campaign'][_0x389b('0x103')](db[_0x389b('0x107')],{'as':_0x389b('0x13b'),'foreignKey':_0x389b('0x196')});db[_0x389b('0xde')][_0x389b('0x103')](db['CmHopperBlack'],{'as':_0x389b('0x13c'),'foreignKey':_0x389b('0x196')});db[_0x389b('0xde')]['belongsTo'](db[_0x389b('0x13e')],{'as':_0x389b('0x13e'),'foreignKey':_0x389b('0x13f')});db[_0x389b('0xde')][_0x389b('0x10f')](db[_0x389b('0x13e')],{'as':_0x389b('0x140'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x389b('0x10f')](db[_0x389b('0x82')],{'as':_0x389b('0x82'),'foreignKey':'IntervalId'});db['Campaign'][_0x389b('0x10f')](db[_0x389b('0xd8')],{'as':_0x389b('0xd8'),'foreignKey':_0x389b('0x1d3')});db[_0x389b('0xde')][_0x389b('0x115')](db[_0x389b('0x127')],{'as':'Lists','through':_0x389b('0x1d4')});db[_0x389b('0xde')][_0x389b('0x115')](db[_0x389b('0x127')],{'as':_0x389b('0x146'),'through':_0x389b('0x1d5')});db[_0x389b('0xe2')][_0x389b('0x10f')](db[_0x389b('0x6a')],{'as':_0x389b('0x6a'),'foreignKey':_0x389b('0x165')});db['MailTransferReport'][_0x389b('0x10f')](db[_0x389b('0x15a')],{});db['MailTransferReport']['belongsTo'](db[_0x389b('0x46')],{});db[_0x389b('0xe4')][_0x389b('0x10f')](db[_0x389b('0x41')],{'foreignKey':_0x389b('0x1d6'),'as':_0x389b('0x1d7')});db[_0x389b('0xe4')][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1d8'),'as':_0x389b('0x1d9')});db[_0x389b('0xe4')]['belongsTo'](db['User'],{'foreignKey':_0x389b('0x1da'),'as':'ToAgent'});db[_0x389b('0xe4')]['belongsTo'](db[_0x389b('0x43')],{'foreignKey':_0x389b('0x1db'),'as':_0x389b('0x1dc')});db[_0x389b('0xe4')][_0x389b('0x10f')](db[_0x389b('0x41')],{'foreignKey':_0x389b('0x1dd'),'as':_0x389b('0x1de')});db[_0x389b('0xe6')][_0x389b('0x10f')](db[_0x389b('0x68')],{});db[_0x389b('0xe6')]['belongsTo'](db[_0x389b('0x66')],{});db['ChatTransferReport'][_0x389b('0x10f')](db[_0x389b('0x61')],{'foreignKey':'FromChatWebsiteId','as':_0x389b('0x1d7')});db['ChatTransferReport']['belongsTo'](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1d8'),'as':_0x389b('0x1d9')});db[_0x389b('0xe6')][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1da'),'as':_0x389b('0x1df')});db[_0x389b('0xe6')]['belongsTo'](db[_0x389b('0x6c')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0x389b('0xe6')][_0x389b('0x10f')](db[_0x389b('0x61')],{'foreignKey':_0x389b('0x1e0'),'as':'ToAccount'});db[_0x389b('0x1e1')]['belongsTo'](db[_0x389b('0x51')],{});db[_0x389b('0x1e1')][_0x389b('0x10f')](db[_0x389b('0x50')],{});db[_0x389b('0x1e1')]['belongsTo'](db[_0x389b('0x16d')],{'foreignKey':_0x389b('0x1e2'),'as':'FromAccount'});db[_0x389b('0x1e1')]['belongsTo'](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1d8'),'as':_0x389b('0x1d9')});db[_0x389b('0x1e1')][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1da'),'as':'ToAgent'});db['FaxTransferReport']['belongsTo'](db[_0x389b('0x53')],{'foreignKey':_0x389b('0x1e3'),'as':'ToQueue'});db[_0x389b('0x1e1')][_0x389b('0x10f')](db[_0x389b('0x16d')],{'foreignKey':_0x389b('0x1e4'),'as':_0x389b('0x1de')});db[_0x389b('0x1e5')][_0x389b('0x10f')](db[_0x389b('0x17d')],{});db[_0x389b('0x1e5')][_0x389b('0x10f')](db[_0x389b('0x11b')],{});db['OpenchannelTransferReport'][_0x389b('0x10f')](db[_0x389b('0x5b')],{'foreignKey':_0x389b('0x1e6'),'as':_0x389b('0x1d7')});db[_0x389b('0x1e5')][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':'FromUserId','as':_0x389b('0x1d9')});db[_0x389b('0x1e5')][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':'ToUserId','as':_0x389b('0x1df')});db['OpenchannelTransferReport'][_0x389b('0x10f')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x389b('0x1dc')});db[_0x389b('0x1e5')][_0x389b('0x10f')](db[_0x389b('0x5b')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0x389b('0xea')][_0x389b('0x10f')](db[_0x389b('0x177')],{});db[_0x389b('0xea')][_0x389b('0x10f')](db[_0x389b('0x10a')],{});db['SmsTransferReport'][_0x389b('0x10f')](db[_0x389b('0x56')],{'foreignKey':'FromSmsAccountId','as':_0x389b('0x1d7')});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x389b('0x1d8'),'as':_0x389b('0x1d9')});db[_0x389b('0xea')][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1da'),'as':_0x389b('0x1df')});db['SmsTransferReport']['belongsTo'](db[_0x389b('0x123')],{'foreignKey':_0x389b('0x1e7'),'as':_0x389b('0x1dc')});db[_0x389b('0xea')][_0x389b('0x10f')](db[_0x389b('0x56')],{'foreignKey':_0x389b('0x1e8'),'as':_0x389b('0x1de')});db[_0x389b('0x127')]['hasMany'](db[_0x389b('0x7e')],{'as':_0x389b('0x14f'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x127')][_0x389b('0x103')](db[_0x389b('0x79')],{'as':_0x389b('0x1e9'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x127')]['hasMany'](db[_0x389b('0x15c')],{'as':'Contacts','onDelete':_0x389b('0x102'),'foreignKey':'ListId'});db['CmList']['hasMany'](db[_0x389b('0x193')],{'as':_0x389b('0x106'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x127')][_0x389b('0x103')](db[_0x389b('0x107')],{'as':_0x389b('0x108'),'foreignKey':'ListId'});db[_0x389b('0x127')][_0x389b('0x103')](db['ReportAgentPreview'],{'as':_0x389b('0x77'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x127')][_0x389b('0x115')](db[_0x389b('0x1f')],{'as':_0x389b('0x1ea'),'through':_0x389b('0x144')});db[_0x389b('0x127')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':'cm_user_has_lists'});db[_0x389b('0xed')][_0x389b('0x103')](db[_0x389b('0x1b')],{'as':_0x389b('0x19f'),'onDelete':_0x389b('0x102')});db[_0x389b('0xed')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':_0x389b('0x1eb')});db[_0x389b('0xee')][_0x389b('0x103')](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'foreignKey':_0x389b('0x110')});db[_0x389b('0xee')][_0x389b('0x103')](db[_0x389b('0x1ec')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':'cascade'});db['UserProfileSection']['hasMany'](db[_0x389b('0x1ed')],{'as':_0x389b('0x1ee'),'foreignKey':_0x389b('0x1ef'),'onDelete':_0x389b('0x102')});db[_0x389b('0xf4')][_0x389b('0x103')](db[_0x389b('0x7e')],{'as':_0x389b('0x14f'),'foreignKey':_0x389b('0x1f0')});db[_0x389b('0xf4')][_0x389b('0x103')](db[_0x389b('0x7d')],{'as':_0x389b('0x150'),'foreignKey':_0x389b('0x1f0')});db['WhatsappAccount'][_0x389b('0x103')](db['WhatsappMessage'],{'as':_0x389b('0x170'),'foreignKey':_0x389b('0x1f0')});db[_0x389b('0xf4')]['hasMany'](db[_0x389b('0xf7')],{'as':_0x389b('0x151')});db[_0x389b('0xf4')][_0x389b('0x103')](db[_0x389b('0xf5')],{'as':_0x389b('0x136')});db[_0x389b('0xf4')]['belongsTo'](db[_0x389b('0x127')],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153')});db[_0x389b('0xf4')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x389b('0x143')});db['WhatsappAccount']['belongsToMany'](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':_0x389b('0x131')});db['WhatsappApplication'][_0x389b('0x10f')](db[_0x389b('0x14')],{'onDelete':_0x389b('0x166')});db['WhatsappApplication'][_0x389b('0x10f')](db[_0x389b('0xfb')],{'onDelete':_0x389b('0x166')});db[_0x389b('0xf5')]['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x389b('0x166')});db['WhatsappApplication'][_0x389b('0x10f')](db[_0x389b('0x82')],{'onDelete':'restrict','foreignKey':_0x389b('0x168')});db[_0x389b('0xf5')][_0x389b('0x10f')](db[_0x389b('0x15e')],{'onDelete':_0x389b('0x166'),'foreignKey':'TagId'});db['WhatsappInteraction'][_0x389b('0x103')](db[_0x389b('0x1f1')],{'as':_0x389b('0x170'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1f2')});db[_0x389b('0xf7')][_0x389b('0x10f')](db[_0x389b('0xf4')],{'as':_0x389b('0x164'),'foreignKey':'WhatsappAccountId'});db[_0x389b('0xf7')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':'Contact','foreignKey':_0x389b('0x16b')});db[_0x389b('0xf7')][_0x389b('0x10f')](db[_0x389b('0x14')],{'as':_0x389b('0x15d'),'foreignKey':'UserId'});db[_0x389b('0xf7')][_0x389b('0x115')](db[_0x389b('0x15e')],{'through':'whatsapp_interaction_has_tags','as':_0x389b('0x160')});db[_0x389b('0xf7')][_0x389b('0x115')](db['Tag'],{'through':_0x389b('0x1a5'),'as':_0x389b('0x161')});db[_0x389b('0xf7')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'through':_0x389b('0x1f3'),'foreignKey':'WhatsappInteractionId'});db[_0x389b('0x1f1')]['belongsTo'](db[_0x389b('0x14')],{'as':'User'});db[_0x389b('0x1f1')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'onDelete':_0x389b('0x102'),'as':_0x389b('0x14d')});db[_0x389b('0x1f1')][_0x389b('0x10f')](db[_0x389b('0xf7')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x389b('0x1f2')});db[_0x389b('0x1f1')][_0x389b('0x10f')](db[_0x389b('0xf4')],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x1f0')});db[_0x389b('0x1f4')][_0x389b('0x10f')](db[_0x389b('0xf4')],{});db[_0x389b('0x1f4')]['belongsTo'](db[_0x389b('0x127')],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x1f4')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':_0x389b('0x14d'),'foreignKey':_0x389b('0x16b')});db[_0x389b('0x1f4')][_0x389b('0x10f')](db[_0x389b('0xf7')],{});db['WhatsappQueueReport'][_0x389b('0x10f')](db[_0x389b('0xfb')],{});db['WhatsappQueueReport'][_0x389b('0x10f')](db[_0x389b('0x1f1')],{});db['WhatsappQueueReport'][_0x389b('0x10f')](db['User'],{});db[_0x389b('0x1f5')][_0x389b('0x10f')](db['WhatsappMessage'],{});db[_0x389b('0x1f5')][_0x389b('0x10f')](db[_0x389b('0xf7')],{});db[_0x389b('0x1f5')][_0x389b('0x10f')](db[_0x389b('0xf4')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x389b('0x1f5')][_0x389b('0x10f')](db[_0x389b('0xf4')],{'foreignKey':_0x389b('0x1f6'),'as':_0x389b('0x1de')});db[_0x389b('0x1f5')][_0x389b('0x10f')](db['WhatsappQueue'],{'foreignKey':_0x389b('0x1f7'),'as':_0x389b('0x1dc')});db['WhatsappTransferReport'][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1d8'),'as':_0x389b('0x1d9')});db[_0x389b('0x1f5')][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1da'),'as':_0x389b('0x1df')});db[_0x389b('0xfb')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':'Agents','through':_0x389b('0x1f8'),'foreignKey':_0x389b('0x1f9')});db[_0x389b('0xfb')]['belongsToMany'](db[_0x389b('0x157')],{'through':_0x389b('0x1d2'),'as':_0x389b('0x159')});module[_0x389b('0x1fa')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xaffa=['ToWhatsappAccountId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8','utf8_general_ci','sequelizeHistory','xcall','utf8mb4','name','username','password','options','database','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','../api/condition/condition.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','Tag','../api/template/template.model','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','Dynamics365Field','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','Migration','Attachment','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','User','hasOne','VoiceMail','Recordings','UserId','hasMany','VoiceQueuesRt','VoiceExtension','Extensions','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','UserProfile','belongsToMany','Groups','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','MailQueues','ChatQueues','UserChatQueue','FaxQueue','FaxQueues','SmsQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','SpiedAgents','Applications','cascade','Sounds','Members','VoiceQueueId','HopperFinals','CmHopperHistory','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','belongsTo','TrunkBackup','TrunkBackupId','Interval','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceCallReport','Contact','MailAccountId','Imap','Smtp','Disposition','Dispositions','Interactions','MailApplication','ListId','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','Interaction','ChatWebsiteId','restrict','MailQueueReport','List','FaxAccountId','CannedAnswer','FaxApplication','TagId','fax_interaction_has_tags','FaxInteractionId','team_has_fax_queues','FaxQueueReport','Answers','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','ThroughTags','Users','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','AttachmentId','ProactiveActions','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','chat_group_has_users','Website','CompanyId','Hoppers','cm_contact_has_tags','CampaignId','OwnerId','Condition','All','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','AnalyticCustomReport','VoiceMusicOnHold','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','AnalyticFieldReport','Fields','CustomReportId','AnalyticDefaultReport','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','Field','Variable','VariableId','SugarcrmAccount','SugarcrmField','DeskField','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowField','FreshsalesAccount','ChatQueueReport','SessionId','ProjectId','user_has_square_projects','team_has_openchannel_queues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','ChatOfflineMessageId','MailTransferReport','FromMailAccountId','FromUserId','ToUserId','ToAgent','MailQueue','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','FaxTransferReport','FromFaxAccountId','FromAccount','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','HopperHistory','Queues','VoicePrefix','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId'];(function(_0x125d8e,_0x753f01){var _0x113968=function(_0x15521c){while(--_0x15521c){_0x125d8e['push'](_0x125d8e['shift']());}};_0x113968(++_0x753f01);}(_0xaffa,0x1e8));var _0xaaff=function(_0x2b0fe4,_0x25b42e){_0x2b0fe4=_0x2b0fe4-0x0;var _0x30ef8c=_0xaffa[_0x2b0fe4];return _0x30ef8c;};'use strict';var path=require('path');var config=require(_0xaaff('0x0'));var Sequelize=require(_0xaaff('0x1'));var _=require(_0xaaff('0x2'));var jstz=require(_0xaaff('0x3'));var timezone=jstz[_0xaaff('0x4')]();config['sequelize']=_[_0xaaff('0x5')](config[_0xaaff('0x1')],{'database':_0xaaff('0x6'),'username':'xcall','password':_0xaaff('0x7'),'options':{'host':_0xaaff('0x8'),'port':0xcea,'dialect':_0xaaff('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xaaff('0xa'),'collate':_0xaaff('0xb')}}});config[_0xaaff('0xc')]=_[_0xaaff('0x5')](config[_0xaaff('0xc')],{'database':_0xaaff('0x6'),'username':_0xaaff('0xd'),'password':'xC@LL1234','options':{'host':_0xaaff('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xaaff('0xe')},'logging':![],'timezone':timezone[_0xaaff('0xf')](),'define':{'charset':_0xaaff('0xa'),'collate':_0xaaff('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xaaff('0x1')]['database'],config['sequelize'][_0xaaff('0x10')],config['sequelize'][_0xaaff('0x11')],config['sequelize'][_0xaaff('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xaaff('0xc')][_0xaaff('0x13')],config[_0xaaff('0xc')]['username'],config[_0xaaff('0xc')][_0xaaff('0x11')],config[_0xaaff('0xc')][_0xaaff('0x12')])};db['User']=db['sequelize'][_0xaaff('0x14')](_0xaaff('0x15'));db[_0xaaff('0x16')]=db['sequelize'][_0xaaff('0x14')](_0xaaff('0x17'));db[_0xaaff('0x18')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db['sequelize'][_0xaaff('0x14')](_0xaaff('0x19'));db['VoiceMusicOnHold']=db['sequelize'][_0xaaff('0x14')](_0xaaff('0x1a'));db[_0xaaff('0x1b')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x1c'));db[_0xaaff('0x1d')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x1e'));db[_0xaaff('0x1f')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x20'));db['VoiceMail']=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xaaff('0x1')]['import'](_0xaaff('0x21'));db['VoiceCallReport']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x22'));db[_0xaaff('0x23')]=db[_0xaaff('0x1')]['import'](_0xaaff('0x24'));db[_0xaaff('0x25')]=db[_0xaaff('0x1')]['import'](_0xaaff('0x26'));db[_0xaaff('0x27')]=db[_0xaaff('0x1')]['import'](_0xaaff('0x28'));db[_0xaaff('0x29')]=db['sequelize'][_0xaaff('0x14')](_0xaaff('0x2a'));db[_0xaaff('0x2b')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x2c'));db['VoiceTransferReport']=db['sequelize']['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0xaaff('0x2d')]=db['sequelize'][_0xaaff('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xaaff('0x2e')]=db['sequelize'][_0xaaff('0x14')](_0xaaff('0x2f'));db['UserChatQueue']=db[_0xaaff('0x1')]['import'](_0xaaff('0x30'));db['UserMailQueue']=db['sequelize']['import']('../api/userMailQueue/userMailQueue.model');db[_0xaaff('0x31')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x32'));db[_0xaaff('0x33')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/userSmsQueue/userSmsQueue.model');db[_0xaaff('0x34')]=db[_0xaaff('0x1')]['import'](_0xaaff('0x35'));db[_0xaaff('0x36')]=db[_0xaaff('0x1')]['import'](_0xaaff('0x37'));db[_0xaaff('0x38')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x39'));db[_0xaaff('0x3a')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x3b'));db[_0xaaff('0x3c')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x3d'));db['MailQueue']=db['sequelize']['import']('../api/mailQueue/mailQueue.model');db[_0xaaff('0x3e')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x3f'));db[_0xaaff('0x40')]=db['sequelize']['import']('../api/mailInteraction/mailInteraction.model');db[_0xaaff('0x41')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x42'));db['MailApplication']=db['sequelize'][_0xaaff('0x14')](_0xaaff('0x43'));db['MailQueueReport']=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/mailQueueReport/mailQueueReport.model');db[_0xaaff('0x44')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x45'));db[_0xaaff('0x46')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x47'));db[_0xaaff('0x48')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x49'));db['FaxApplication']=db['sequelize'][_0xaaff('0x14')](_0xaaff('0x4a'));db[_0xaaff('0x4b')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0xaaff('0x4c')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x4d'));db['FaxQueue']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x4e'));db['FaxQueueReport']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x4f'));db[_0xaaff('0x50')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x51'));db['SmsApplication']=db[_0xaaff('0x1')]['import'](_0xaaff('0x52'));db['SmsInteraction']=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/smsInteraction/smsInteraction.model');db[_0xaaff('0x53')]=db[_0xaaff('0x1')]['import'](_0xaaff('0x54'));db[_0xaaff('0x55')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/smsQueue/smsQueue.model');db[_0xaaff('0x56')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x57'));db[_0xaaff('0x58')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/openchannelApplication/openchannelApplication.model');db[_0xaaff('0x59')]=db['sequelize'][_0xaaff('0x14')](_0xaaff('0x5a'));db[_0xaaff('0x5b')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/openchannelMessage/openchannelMessage.model');db[_0xaaff('0x5c')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/openchannelQueue/openchannelQueue.model');db[_0xaaff('0x5d')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x5e'));db[_0xaaff('0x5f')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x60'));db[_0xaaff('0x61')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/chatApplication/chatApplication.model');db[_0xaaff('0x62')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x63'));db[_0xaaff('0x64')]=db[_0xaaff('0x1')]['import']('../api/chatMessage/chatMessage.model');db[_0xaaff('0x65')]=db[_0xaaff('0x1')]['import'](_0xaaff('0x66'));db[_0xaaff('0x67')]=db[_0xaaff('0x1')]['import'](_0xaaff('0x68'));db[_0xaaff('0x69')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x6a'));db[_0xaaff('0x6b')]=db['sequelize'][_0xaaff('0x14')](_0xaaff('0x6c'));db[_0xaaff('0x6d')]=db['sequelize'][_0xaaff('0x14')](_0xaaff('0x6e'));db[_0xaaff('0x6f')]=db['sequelize'][_0xaaff('0x14')]('../api/cmContact/cmContact.model');db[_0xaaff('0x70')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/cmHopper/cmHopper.model');db[_0xaaff('0x71')]=db[_0xaaff('0x1')]['import'](_0xaaff('0x72'));db[_0xaaff('0x73')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x74'));db['CmHopperHistory']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x75'));db[_0xaaff('0x76')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xaaff('0x77')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x78'));db[_0xaaff('0x79')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x7a'));db[_0xaaff('0x7b')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x7c'));db['CannedAnswer']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x7d'));db['Disposition']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x7e'));db['Condition']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x7f'));db['Interval']=db[_0xaaff('0x1')]['import']('../api/interval/interval.model');db['Pause']=db['sequelize'][_0xaaff('0x14')]('../api/pause/pause.model');db[_0xaaff('0x80')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x81'));db[_0xaaff('0x82')]=db['sequelize'][_0xaaff('0x14')](_0xaaff('0x83'));db['Schedule']=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/schedule/schedule.model');db[_0xaaff('0x84')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x85'));db[_0xaaff('0x86')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/tag/tag.model');db['Template']=db[_0xaaff('0x1')]['import'](_0xaaff('0x87'));db['Trigger']=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/trigger/trigger.model');db['Variable']=db[_0xaaff('0x1')]['import'](_0xaaff('0x88'));db[_0xaaff('0x89')]=db['sequelize']['import']('../api/integration/integration.model');db[_0xaaff('0x8a')]=db[_0xaaff('0x1')]['import'](_0xaaff('0x8b'));db['AnalyticCustomReport']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x8c'));db['AnalyticDefaultReport']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x8d'));db[_0xaaff('0x8e')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xaaff('0x8f')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x90'));db['AnalyticFieldReport']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x91'));db[_0xaaff('0x92')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x93'));db[_0xaaff('0x94')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x95'));db[_0xaaff('0x96')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x97'));db['SalesforceField']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x98'));db['SugarcrmAccount']=db['sequelize'][_0xaaff('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xaaff('0x99')]=db[_0xaaff('0x1')]['import'](_0xaaff('0x9a'));db['SugarcrmField']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x9b'));db[_0xaaff('0x9c')]=db['sequelize'][_0xaaff('0x14')]('../api/intDeskAccount/intDeskAccount.model');db[_0xaaff('0x9d')]=db['sequelize'][_0xaaff('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0x9e'));db[_0xaaff('0x9f')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xa0'));db['ZohoConfiguration']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xa1'));db[_0xaaff('0xa2')]=db[_0xaaff('0x1')]['import'](_0xaaff('0xa3'));db[_0xaaff('0xa4')]=db['sequelize']['import']('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xa5'));db[_0xaaff('0xa6')]=db['sequelize'][_0xaaff('0x14')]('../api/intZendeskField/intZendeskField.model');db[_0xaaff('0xa7')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xa8'));db[_0xaaff('0xa9')]=db['sequelize'][_0xaaff('0x14')](_0xaaff('0xaa'));db[_0xaaff('0xab')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xaaff('0xac')]=db['sequelize'][_0xaaff('0x14')](_0xaaff('0xad'));db['VtigerConfiguration']=db['sequelize'][_0xaaff('0x14')](_0xaaff('0xae'));db[_0xaaff('0xaf')]=db['sequelize'][_0xaaff('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0xaaff('0xb0')]=db['sequelize'][_0xaaff('0x14')](_0xaaff('0xb1'));db[_0xaaff('0xb2')]=db[_0xaaff('0x1')]['import'](_0xaaff('0xb3'));db['ServicenowField']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xb4'));db[_0xaaff('0xb5')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xaaff('0xb6')]=db['sequelize'][_0xaaff('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xaaff('0xb7')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db['sequelize'][_0xaaff('0x14')](_0xaaff('0xb8'));db[_0xaaff('0xb9')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xba'));db[_0xaaff('0xbb')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xbc'));db['Integration']=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/integration/integration.model');db['Network']=db['sequelize'][_0xaaff('0x14')](_0xaaff('0xbd'));db['ChatQueueReport']=db['sequelize']['import'](_0xaaff('0xbe'));db[_0xaaff('0xbf')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xc0'));db[_0xaaff('0xc1')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xc2'));db[_0xaaff('0xc3')]=db[_0xaaff('0x1')]['import'](_0xaaff('0xc4'));db['JscriptySessionReport']=db['sequelize'][_0xaaff('0x14')](_0xaaff('0xc5'));db[_0xaaff('0xc6')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xc7'));db[_0xaaff('0xc8')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xc9'));db[_0xaaff('0xca')]=db[_0xaaff('0x1')]['import'](_0xaaff('0xcb'));db[_0xaaff('0xcc')]=db[_0xaaff('0x1')]['import'](_0xaaff('0xcd'));db['SquareProject']=db['sequelize'][_0xaaff('0x14')]('../api/squareProject/squareProject.model');db[_0xaaff('0xce')]=db['sequelize'][_0xaaff('0x14')](_0xaaff('0xcf'));db['SquareMessage']=db['sequelize'][_0xaaff('0x14')](_0xaaff('0xd0'));db[_0xaaff('0xd1')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xd2'));db[_0xaaff('0xd3')]=db[_0xaaff('0x1')]['import']('../api/license/license.model');db[_0xaaff('0xd4')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/campaign/campaign.model');db[_0xaaff('0xd5')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/migration/migration.model');db[_0xaaff('0xd6')]=db[_0xaaff('0x1')]['import']('../api/attachment/attachment.model');db['Plugin']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xd7'));db['MailTransferReport']=db['sequelize'][_0xaaff('0x14')](_0xaaff('0xd8'));db[_0xaaff('0xd9')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xda'));db['FaxTransferReport']=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/faxTransferReport/faxTransferReport.model');db[_0xaaff('0xdb')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xaaff('0xdc')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xdd'));db['VoicePrefix']=db['sequelize'][_0xaaff('0x14')](_0xaaff('0xde'));db['UserProfile']=db[_0xaaff('0x1')]['import'](_0xaaff('0xdf'));db[_0xaaff('0xe0')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xe1'));db[_0xaaff('0xe2')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xe3'));db['UserNotification']=db[_0xaaff('0x1')]['import'](_0xaaff('0xe4'));db['WhatsappAccount']=db['sequelize']['import'](_0xaaff('0xe5'));db[_0xaaff('0xe6')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xe7'));db[_0xaaff('0xe8')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xaaff('0xe9')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/whatsappMessage/whatsappMessage.model');db[_0xaaff('0xea')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xaaff('0xeb')]=db[_0xaaff('0x1')][_0xaaff('0x14')](_0xaaff('0xec'));db[_0xaaff('0xed')]=db[_0xaaff('0x1')][_0xaaff('0x14')]('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db['sequelize'][_0xaaff('0x14')](_0xaaff('0xee'));db[_0xaaff('0xef')]=db['sequelize'][_0xaaff('0x14')](_0xaaff('0xf0'));db[_0xaaff('0xf1')][_0xaaff('0xf2')](db[_0xaaff('0xf3')],{'as':_0xaaff('0xf3'),'onDelete':'cascade','foreignKey':'UserId'});db[_0xaaff('0xf1')]['hasMany'](db[_0xaaff('0x1d')],{'as':_0xaaff('0xf4'),'foreignKey':_0xaaff('0xf5')});db[_0xaaff('0xf1')][_0xaaff('0xf6')](db[_0xaaff('0x2d')],{'as':_0xaaff('0xf7'),'foreignKey':_0xaaff('0xf5')});db[_0xaaff('0xf1')][_0xaaff('0xf6')](db[_0xaaff('0xf8')],{'as':_0xaaff('0xf9'),'onDelete':'cascade','hooks':!![]});db['User'][_0xaaff('0xf6')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xaaff('0xf5')});db[_0xaaff('0xf1')][_0xaaff('0xf6')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':'UserId'});db['User'][_0xaaff('0xf6')](db[_0xaaff('0x76')],{'as':'ReportAgentPreview','foreignKey':_0xaaff('0xf5')});db['User'][_0xaaff('0xf6')](db[_0xaaff('0x59')],{'as':_0xaaff('0xfa'),'foreignKey':_0xaaff('0xf5')});db[_0xaaff('0xf1')][_0xaaff('0xf6')](db[_0xaaff('0x62')],{'as':_0xaaff('0xfb'),'foreignKey':_0xaaff('0xf5')});db[_0xaaff('0xf1')][_0xaaff('0xf6')](db[_0xaaff('0xfc')],{'as':_0xaaff('0xfd'),'foreignKey':_0xaaff('0xf5')});db[_0xaaff('0xf1')][_0xaaff('0xf6')](db[_0xaaff('0x4b')],{'as':_0xaaff('0xfe'),'foreignKey':_0xaaff('0xf5')});db[_0xaaff('0xf1')]['hasMany'](db[_0xaaff('0x40')],{'as':_0xaaff('0xff'),'foreignKey':_0xaaff('0xf5')});db[_0xaaff('0xf1')][_0xaaff('0xf6')](db[_0xaaff('0xe8')],{'as':_0xaaff('0x100'),'foreignKey':_0xaaff('0xf5')});db[_0xaaff('0xf1')][_0xaaff('0xf6')](db[_0xaaff('0x101')],{'as':_0xaaff('0x102'),'foreignKey':_0xaaff('0x103')});db[_0xaaff('0xf1')]['belongsTo'](db['UserProfile'],{'as':_0xaaff('0x104'),'foreignKey':'userProfileId'});db[_0xaaff('0xf1')][_0xaaff('0x105')](db['ChatGroup'],{'as':_0xaaff('0x106'),'through':'chat_group_has_users'});db[_0xaaff('0xf1')]['belongsToMany'](db[_0xaaff('0x6f')],{'as':_0xaaff('0x107'),'through':_0xaaff('0x108')});db['User'][_0xaaff('0x105')](db[_0xaaff('0x109')],{'as':_0xaaff('0x10a'),'through':_0xaaff('0x10b')});db[_0xaaff('0xf1')]['belongsToMany'](db[_0xaaff('0xd1')],{'through':_0xaaff('0x10c')});db[_0xaaff('0xf1')][_0xaaff('0x105')](db[_0xaaff('0x40')],{'as':_0xaaff('0xff'),'through':_0xaaff('0x10d')});db[_0xaaff('0xf1')]['belongsToMany'](db[_0xaaff('0x62')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0xaaff('0xf1')][_0xaaff('0x105')](db[_0xaaff('0x4b')],{'as':_0xaaff('0xfe'),'through':_0xaaff('0x10e')});db[_0xaaff('0xf1')]['belongsToMany'](db[_0xaaff('0xfc')],{'as':_0xaaff('0xfd'),'through':_0xaaff('0x10f')});db['User']['belongsToMany'](db[_0xaaff('0x59')],{'as':_0xaaff('0xfa'),'through':_0xaaff('0x110')});db['User']['belongsToMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0xaaff('0x111')});db[_0xaaff('0xf1')][_0xaaff('0x105')](db[_0xaaff('0x1b')],{'as':'VoiceQueues','through':_0xaaff('0x2e'),'required':![]});db[_0xaaff('0xf1')][_0xaaff('0x105')](db['MailQueue'],{'as':_0xaaff('0x112'),'through':'UserMailQueue','required':![]});db['User'][_0xaaff('0x105')](db[_0xaaff('0x67')],{'as':_0xaaff('0x113'),'through':_0xaaff('0x114'),'required':![],'hooks':!![]});db[_0xaaff('0xf1')][_0xaaff('0x105')](db[_0xaaff('0x115')],{'as':_0xaaff('0x116'),'through':_0xaaff('0x31'),'required':![]});db[_0xaaff('0xf1')][_0xaaff('0x105')](db[_0xaaff('0x55')],{'as':_0xaaff('0x117'),'through':'UserSmsQueue','required':![]});db[_0xaaff('0xf1')][_0xaaff('0x105')](db[_0xaaff('0x5c')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xaaff('0xf1')][_0xaaff('0x105')](db['WhatsappQueue'],{'as':_0xaaff('0x118'),'through':_0xaaff('0x36'),'required':![]});db[_0xaaff('0xf1')]['belongsToMany'](db[_0xaaff('0x109')],{'through':'cm_user_has_lists'});db[_0xaaff('0xf1')][_0xaaff('0x105')](db['VoicePrefix'],{'as':_0xaaff('0x119'),'through':_0xaaff('0x11a'),'required':![]});db[_0xaaff('0xf1')][_0xaaff('0x105')](db[_0xaaff('0x5d')],{'as':_0xaaff('0x11b'),'through':_0xaaff('0x11c')});db['User'][_0xaaff('0x105')](db[_0xaaff('0x48')],{'as':_0xaaff('0x11d'),'through':_0xaaff('0x11e')});db[_0xaaff('0xf1')][_0xaaff('0x105')](db['MailAccount'],{'as':_0xaaff('0x11f'),'through':_0xaaff('0x120')});db[_0xaaff('0xf1')]['belongsToMany'](db[_0xaaff('0x56')],{'as':_0xaaff('0x121'),'through':_0xaaff('0x122')});db[_0xaaff('0xf1')][_0xaaff('0x105')](db[_0xaaff('0x50')],{'as':_0xaaff('0x123'),'through':_0xaaff('0x124')});db[_0xaaff('0xf1')][_0xaaff('0x105')](db[_0xaaff('0x125')],{'as':_0xaaff('0x126'),'through':_0xaaff('0x127')});db[_0xaaff('0xf1')][_0xaaff('0x105')](db[_0xaaff('0x128')],{'as':_0xaaff('0x129'),'through':'user_has_square_projects'});db['VoiceChanSpy'][_0xaaff('0xf6')](db[_0xaaff('0xf8')],{'as':_0xaaff('0x12a'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0xaaff('0x18')]['hasMany'](db['VoiceExtension'],{'onDelete':'cascade'});db[_0xaaff('0xf8')][_0xaaff('0xf6')](db[_0xaaff('0xf8')],{'as':_0xaaff('0x12b'),'onDelete':_0xaaff('0x12c')});db['VoiceMusicOnHold'][_0xaaff('0x105')](db[_0xaaff('0x84')],{'as':_0xaaff('0x12d'),'through':'moh_has_sounds'});db[_0xaaff('0x1b')][_0xaaff('0xf6')](db['UserVoiceQueueRt'],{'as':_0xaaff('0x12e'),'foreignKey':'VoiceQueueId'});db[_0xaaff('0x1b')][_0xaaff('0xf6')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xaaff('0x12f')});db[_0xaaff('0x1b')][_0xaaff('0xf6')](db[_0xaaff('0x73')],{'as':_0xaaff('0x130'),'foreignKey':_0xaaff('0x12f')});db[_0xaaff('0x1b')][_0xaaff('0xf6')](db[_0xaaff('0x131')],{'as':_0xaaff('0x132'),'foreignKey':'VoiceQueueId'});db[_0xaaff('0x1b')][_0xaaff('0xf6')](db['ReportAgentPreview'],{'as':_0xaaff('0x76'),'foreignKey':_0xaaff('0x12f')});db[_0xaaff('0x1b')]['hasMany'](db[_0xaaff('0x71')],{'as':_0xaaff('0x133'),'foreignKey':_0xaaff('0x12f')});db[_0xaaff('0x1b')][_0xaaff('0xf6')](db[_0xaaff('0x134')],{'as':_0xaaff('0x135'),'foreignKey':_0xaaff('0x12f')});db['VoiceQueue'][_0xaaff('0x136')](db[_0xaaff('0x2b')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xaaff('0x1b')]['belongsTo'](db[_0xaaff('0x2b')],{'as':_0xaaff('0x137'),'foreignKey':_0xaaff('0x138')});db['VoiceQueue'][_0xaaff('0x136')](db['Interval'],{'as':_0xaaff('0x139'),'foreignKey':_0xaaff('0x13a')});db[_0xaaff('0x1b')]['belongsTo'](db[_0xaaff('0x13b')],{'as':_0xaaff('0x13c'),'foreignKey':_0xaaff('0x13d')});db[_0xaaff('0x1b')][_0xaaff('0x105')](db[_0xaaff('0x109')],{'as':_0xaaff('0x10a'),'through':_0xaaff('0x13e')});db[_0xaaff('0x1b')][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x13f'),'through':'UserVoiceQueue'});db[_0xaaff('0x1b')][_0xaaff('0x105')](db['Team'],{'as':_0xaaff('0x140'),'through':_0xaaff('0xef')});db[_0xaaff('0x1b')][_0xaaff('0x105')](db['CmList'],{'as':_0xaaff('0x141'),'through':'voice_queues_has_cm_blacklists'});db[_0xaaff('0x1d')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'as':_0xaaff('0xf1'),'foreignKey':'UserId'});db[_0xaaff('0x1f')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'as':_0xaaff('0xf1'),'foreignKey':'UserId'});db['VoiceMail'][_0xaaff('0xf6')](db[_0xaaff('0x142')],{'as':_0xaaff('0x143'),'onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x144'),'sourceKey':_0xaaff('0x145')});db[_0xaaff('0x142')][_0xaaff('0x136')](db[_0xaaff('0xf3')],{'foreignKey':_0xaaff('0x144'),'targetKey':_0xaaff('0x145')});db['VoiceCallReport'][_0xaaff('0xf6')](db[_0xaaff('0x27')],{'as':_0xaaff('0x146'),'foreignKey':_0xaaff('0x147'),'constraints':![]});db['VoiceCallReport'][_0xaaff('0xf6')](db[_0xaaff('0x25')],{'as':'AgentReports','foreignKey':_0xaaff('0x147'),'constraints':![]});db[_0xaaff('0x148')]['belongsTo'](db[_0xaaff('0xf1')],{'as':_0xaaff('0xf1'),'foreignKey':'UserId'});db[_0xaaff('0x148')][_0xaaff('0x136')](db[_0xaaff('0x6f')],{'as':_0xaaff('0x149'),'foreignKey':'ContactId'});db[_0xaaff('0x38')][_0xaaff('0x136')](db[_0xaaff('0x3c')],{'as':_0xaaff('0x3c'),'foreignKey':_0xaaff('0x14a')});db[_0xaaff('0x3a')][_0xaaff('0x136')](db[_0xaaff('0x3c')],{'as':_0xaaff('0x3c'),'foreignKey':_0xaaff('0x14a')});db[_0xaaff('0x3c')][_0xaaff('0xf2')](db['MailServerIn'],{'as':_0xaaff('0x14b'),'onDelete':_0xaaff('0x12c')});db[_0xaaff('0x3c')][_0xaaff('0xf2')](db[_0xaaff('0x3a')],{'as':_0xaaff('0x14c'),'onDelete':_0xaaff('0x12c')});db['MailAccount'][_0xaaff('0xf6')](db[_0xaaff('0x14d')],{'as':_0xaaff('0x14e'),'foreignKey':_0xaaff('0x14a')});db['MailAccount']['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':'MailAccountId'});db[_0xaaff('0x3c')][_0xaaff('0xf6')](db['MailMessage'],{'as':_0xaaff('0x143'),'foreignKey':_0xaaff('0x14a')});db[_0xaaff('0x3c')][_0xaaff('0xf6')](db[_0xaaff('0x40')],{'as':_0xaaff('0x14f')});db[_0xaaff('0x3c')]['hasMany'](db[_0xaaff('0x150')],{'as':'Applications'});db[_0xaaff('0x3c')][_0xaaff('0x136')](db[_0xaaff('0x109')],{'as':'List','foreignKey':_0xaaff('0x151')});db[_0xaaff('0x3c')][_0xaaff('0x136')](db[_0xaaff('0x152')],{'as':'Template','foreignKey':_0xaaff('0x153')});db['MailAccount'][_0xaaff('0x136')](db[_0xaaff('0x13b')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xaaff('0x3c')][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x13f'),'through':_0xaaff('0x120')});db['MailQueue'][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':'Agents','through':'UserMailQueue'});db['MailQueue'][_0xaaff('0x105')](db[_0xaaff('0xd1')],{'through':_0xaaff('0x154'),'as':_0xaaff('0x140')});db[_0xaaff('0x40')]['hasMany'](db[_0xaaff('0x41')],{'as':_0xaaff('0x143'),'onDelete':'cascade','foreignKey':_0xaaff('0x155')});db['MailInteraction'][_0xaaff('0x136')](db[_0xaaff('0x3c')],{'as':_0xaaff('0x156'),'foreignKey':'MailAccountId'});db[_0xaaff('0x40')]['belongsTo'](db[_0xaaff('0x6f')],{'as':'Contact','foreignKey':_0xaaff('0x157')});db[_0xaaff('0x40')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x158'),'foreignKey':_0xaaff('0xf5')});db[_0xaaff('0x40')][_0xaaff('0x105')](db[_0xaaff('0x86')],{'through':_0xaaff('0x159'),'as':_0xaaff('0x15a')});db[_0xaaff('0x40')]['belongsToMany'](db[_0xaaff('0x86')],{'through':_0xaaff('0x159'),'as':'ThroughTags'});db[_0xaaff('0x40')][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':'Users','through':_0xaaff('0x10d'),'foreignKey':_0xaaff('0x155')});db[_0xaaff('0x41')][_0xaaff('0xf6')](db[_0xaaff('0xd6')],{'as':'Attachments','onDelete':_0xaaff('0x12c')});db['MailMessage'][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'as':_0xaaff('0xf1')});db[_0xaaff('0x41')][_0xaaff('0x136')](db[_0xaaff('0x6f')],{'onDelete':_0xaaff('0x12c'),'as':_0xaaff('0x149')});db[_0xaaff('0x41')][_0xaaff('0x136')](db[_0xaaff('0x40')],{'as':_0xaaff('0x15b'),'foreignKey':_0xaaff('0x155')});db[_0xaaff('0x41')]['belongsTo'](db['MailAccount'],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x14a')});db['MailMessage'][_0xaaff('0x136')](db[_0xaaff('0x5d')],{'as':_0xaaff('0x5d'),'foreignKey':_0xaaff('0x15c')});db[_0xaaff('0x41')][_0xaaff('0x136')](db[_0xaaff('0x65')],{'as':_0xaaff('0x65'),'foreignKey':'ChatOfflineMessageId'});db[_0xaaff('0x150')][_0xaaff('0x136')](db['User'],{'onDelete':_0xaaff('0x15d')});db[_0xaaff('0x150')][_0xaaff('0x136')](db['MailQueue'],{'onDelete':'restrict'});db[_0xaaff('0x150')][_0xaaff('0x136')](db[_0xaaff('0x3c')],{'onDelete':_0xaaff('0x15d')});db[_0xaaff('0x150')]['belongsTo'](db[_0xaaff('0x139')],{'onDelete':'restrict','foreignKey':_0xaaff('0x13a')});db['MailApplication'][_0xaaff('0x136')](db[_0xaaff('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xaaff('0x15e')][_0xaaff('0x136')](db['MailAccount'],{});db[_0xaaff('0x15e')][_0xaaff('0x136')](db['CmList'],{'as':_0xaaff('0x15f'),'foreignKey':_0xaaff('0x151')});db['MailQueueReport'][_0xaaff('0x136')](db[_0xaaff('0x6f')],{'as':_0xaaff('0x149'),'foreignKey':_0xaaff('0x157')});db[_0xaaff('0x15e')][_0xaaff('0x136')](db[_0xaaff('0x40')],{});db[_0xaaff('0x15e')][_0xaaff('0x136')](db[_0xaaff('0x41')],{});db[_0xaaff('0x15e')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{});db[_0xaaff('0x15e')][_0xaaff('0x136')](db['MailQueue'],{});db[_0xaaff('0x44')][_0xaaff('0xf6')](db[_0xaaff('0x46')],{'as':'Items','onDelete':_0xaaff('0x12c')});db[_0xaaff('0x48')][_0xaaff('0xf6')](db[_0xaaff('0x14d')],{'as':'Dispositions','foreignKey':_0xaaff('0x160')});db['FaxAccount']['hasMany'](db[_0xaaff('0x161')],{'as':'Answers','foreignKey':_0xaaff('0x160')});db[_0xaaff('0x48')][_0xaaff('0xf6')](db[_0xaaff('0x4b')],{'as':_0xaaff('0x14f')});db[_0xaaff('0x48')]['hasMany'](db[_0xaaff('0x162')],{'as':'Applications'});db[_0xaaff('0x48')][_0xaaff('0xf6')](db[_0xaaff('0xf8')],{'as':'Exntensions','onDelete':_0xaaff('0x12c')});db[_0xaaff('0x48')][_0xaaff('0xf6')](db[_0xaaff('0x4c')],{'as':_0xaaff('0x143')});db['FaxAccount'][_0xaaff('0x136')](db[_0xaaff('0x2b')],{'as':'Trunk'});db[_0xaaff('0x48')][_0xaaff('0x136')](db[_0xaaff('0x109')],{'as':_0xaaff('0x15f'),'foreignKey':'ListId'});db[_0xaaff('0x48')][_0xaaff('0x136')](db['Pause'],{'as':_0xaaff('0x13c'),'foreignKey':_0xaaff('0x13d')});db[_0xaaff('0x48')][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x13f'),'through':_0xaaff('0x11e')});db['FaxApplication'][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'onDelete':_0xaaff('0x15d')});db[_0xaaff('0x162')]['belongsTo'](db['FaxQueue'],{'onDelete':_0xaaff('0x15d')});db['FaxApplication'][_0xaaff('0x136')](db[_0xaaff('0x48')],{'onDelete':_0xaaff('0x15d')});db['FaxApplication'][_0xaaff('0x136')](db[_0xaaff('0x86')],{'onDelete':'restrict','foreignKey':_0xaaff('0x163')});db[_0xaaff('0x4b')][_0xaaff('0xf6')](db[_0xaaff('0x4c')],{'as':'Messages','onDelete':_0xaaff('0x12c'),'foreignKey':'FaxInteractionId'});db[_0xaaff('0x4b')][_0xaaff('0x136')](db['FaxAccount'],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x160')});db[_0xaaff('0x4b')][_0xaaff('0x136')](db[_0xaaff('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db['FaxInteraction'][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x158'),'foreignKey':_0xaaff('0xf5')});db[_0xaaff('0x4b')]['belongsToMany'](db['Tag'],{'through':_0xaaff('0x164'),'as':_0xaaff('0x15a')});db[_0xaaff('0x4b')][_0xaaff('0x105')](db[_0xaaff('0x86')],{'through':_0xaaff('0x164'),'as':'ThroughTags'});db[_0xaaff('0x4b')][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0xaaff('0x165')});db[_0xaaff('0x4c')]['belongsTo'](db['User'],{'onDelete':_0xaaff('0x12c'),'as':_0xaaff('0xf1')});db['FaxMessage'][_0xaaff('0x136')](db[_0xaaff('0x4b')],{'as':_0xaaff('0x15b'),'foreignKey':_0xaaff('0x165')});db['FaxMessage']['belongsTo'](db[_0xaaff('0x6f')],{'onDelete':_0xaaff('0x12c'),'as':_0xaaff('0x149')});db[_0xaaff('0x4c')][_0xaaff('0x136')](db[_0xaaff('0xd6')],{'as':_0xaaff('0xd6'),'foreignKey':'AttachmentId'});db[_0xaaff('0x4c')][_0xaaff('0x136')](db[_0xaaff('0x48')],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x160')});db[_0xaaff('0x115')][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x13f'),'through':_0xaaff('0x31')});db[_0xaaff('0x115')]['belongsToMany'](db['Team'],{'through':_0xaaff('0x166'),'as':_0xaaff('0x140')});db[_0xaaff('0x167')][_0xaaff('0x136')](db[_0xaaff('0x48')],{});db[_0xaaff('0x167')][_0xaaff('0x136')](db[_0xaaff('0x109')],{'as':_0xaaff('0x15f'),'foreignKey':'ListId'});db[_0xaaff('0x167')][_0xaaff('0x136')](db['CmContact'],{'as':_0xaaff('0x149'),'foreignKey':_0xaaff('0x157')});db[_0xaaff('0x167')][_0xaaff('0x136')](db[_0xaaff('0x4b')],{});db[_0xaaff('0x167')][_0xaaff('0x136')](db['FaxMessage'],{});db['FaxQueueReport'][_0xaaff('0x136')](db['User'],{});db[_0xaaff('0x167')][_0xaaff('0x136')](db['FaxQueue'],{});db[_0xaaff('0x50')][_0xaaff('0xf6')](db[_0xaaff('0x14d')],{'as':'Dispositions','foreignKey':'SmsAccountId'});db[_0xaaff('0x50')]['hasMany'](db['CannedAnswer'],{'as':_0xaaff('0x168'),'foreignKey':_0xaaff('0x169')});db[_0xaaff('0x50')][_0xaaff('0xf6')](db['SmsMessage'],{'as':_0xaaff('0x143'),'foreignKey':_0xaaff('0x169')});db['SmsAccount'][_0xaaff('0xf6')](db[_0xaaff('0xfc')],{'as':_0xaaff('0x14f')});db[_0xaaff('0x50')][_0xaaff('0xf6')](db[_0xaaff('0x16a')],{'as':_0xaaff('0x12b')});db[_0xaaff('0x50')][_0xaaff('0x136')](db[_0xaaff('0x109')],{'as':_0xaaff('0x15f'),'foreignKey':_0xaaff('0x151')});db[_0xaaff('0x50')][_0xaaff('0x136')](db[_0xaaff('0x13b')],{'as':_0xaaff('0x13c'),'foreignKey':_0xaaff('0x13d')});db[_0xaaff('0x50')]['belongsToMany'](db['User'],{'as':_0xaaff('0x13f'),'through':'user_has_sms_accounts'});db[_0xaaff('0x16a')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'onDelete':_0xaaff('0x15d')});db[_0xaaff('0x16a')][_0xaaff('0x136')](db[_0xaaff('0x55')],{'onDelete':_0xaaff('0x15d')});db[_0xaaff('0x16a')][_0xaaff('0x136')](db[_0xaaff('0x50')],{'onDelete':_0xaaff('0x15d')});db[_0xaaff('0x16a')]['belongsTo'](db[_0xaaff('0x139')],{'onDelete':_0xaaff('0x15d'),'foreignKey':'IntervalId'});db[_0xaaff('0x16a')][_0xaaff('0x136')](db[_0xaaff('0x86')],{'onDelete':_0xaaff('0x15d'),'foreignKey':_0xaaff('0x163')});db['SmsInteraction'][_0xaaff('0xf6')](db[_0xaaff('0x53')],{'as':_0xaaff('0x143'),'onDelete':'cascade','foreignKey':_0xaaff('0x16b')});db['SmsInteraction'][_0xaaff('0x136')](db[_0xaaff('0x50')],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x169')});db[_0xaaff('0xfc')][_0xaaff('0x136')](db[_0xaaff('0x6f')],{'as':_0xaaff('0x149'),'foreignKey':_0xaaff('0x157')});db['SmsInteraction'][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x158'),'foreignKey':_0xaaff('0xf5')});db[_0xaaff('0xfc')][_0xaaff('0x105')](db[_0xaaff('0x86')],{'through':_0xaaff('0x16c'),'as':_0xaaff('0x15a')});db[_0xaaff('0xfc')]['belongsToMany'](db[_0xaaff('0x86')],{'through':'sms_interaction_has_tags','as':_0xaaff('0x16d')});db[_0xaaff('0xfc')][_0xaaff('0x105')](db['User'],{'as':_0xaaff('0x16e'),'through':_0xaaff('0x10f'),'foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0xaaff('0xf1')],{'as':_0xaaff('0xf1')});db['SmsMessage'][_0xaaff('0x136')](db[_0xaaff('0x6f')],{'onDelete':_0xaaff('0x12c'),'as':_0xaaff('0x149')});db[_0xaaff('0x53')][_0xaaff('0x136')](db[_0xaaff('0xfc')],{'onDelete':_0xaaff('0x12c'),'as':'Interaction','foreignKey':_0xaaff('0x16b')});db[_0xaaff('0x53')][_0xaaff('0x136')](db['SmsAccount'],{'as':'Account','foreignKey':_0xaaff('0x169')});db['SmsQueue'][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x13f'),'through':_0xaaff('0x33'),'foreignKey':_0xaaff('0x16f')});db[_0xaaff('0x55')][_0xaaff('0x105')](db[_0xaaff('0xd1')],{'through':_0xaaff('0x170'),'as':_0xaaff('0x140')});db[_0xaaff('0x56')][_0xaaff('0xf6')](db[_0xaaff('0x14d')],{'as':_0xaaff('0x14e'),'foreignKey':_0xaaff('0x171')});db[_0xaaff('0x56')]['hasMany'](db[_0xaaff('0x161')],{'as':'Answers','foreignKey':_0xaaff('0x171')});db['OpenchannelAccount'][_0xaaff('0xf6')](db[_0xaaff('0x59')],{'as':_0xaaff('0x14f'),'foreignKey':_0xaaff('0x171')});db[_0xaaff('0x56')][_0xaaff('0xf6')](db['OpenchannelMessage'],{'as':_0xaaff('0x143'),'foreignKey':_0xaaff('0x171')});db[_0xaaff('0x56')]['hasMany'](db[_0xaaff('0x58')],{'as':_0xaaff('0x12b'),'foreignKey':'OpenchannelAccountId'});db[_0xaaff('0x56')][_0xaaff('0x136')](db[_0xaaff('0x109')],{'as':_0xaaff('0x15f'),'foreignKey':_0xaaff('0x151')});db[_0xaaff('0x56')][_0xaaff('0x136')](db[_0xaaff('0x13b')],{'as':_0xaaff('0x13c'),'foreignKey':_0xaaff('0x13d')});db[_0xaaff('0x56')][_0xaaff('0x105')](db['User'],{'as':'Agents','through':_0xaaff('0x122')});db[_0xaaff('0x58')]['belongsTo'](db[_0xaaff('0xf1')],{'onDelete':_0xaaff('0x15d')});db['OpenchannelApplication'][_0xaaff('0x136')](db[_0xaaff('0x5c')],{'onDelete':_0xaaff('0x15d'),'foreignKey':_0xaaff('0x172')});db['OpenchannelApplication'][_0xaaff('0x136')](db[_0xaaff('0x56')],{'onDelete':_0xaaff('0x15d'),'foreignKey':_0xaaff('0x171')});db[_0xaaff('0x58')]['belongsTo'](db[_0xaaff('0x139')],{'onDelete':_0xaaff('0x15d'),'foreignKey':_0xaaff('0x13a')});db['OpenchannelApplication'][_0xaaff('0x136')](db['Tag'],{'onDelete':_0xaaff('0x15d'),'foreignKey':_0xaaff('0x163')});db[_0xaaff('0x59')][_0xaaff('0xf6')](db[_0xaaff('0x5b')],{'as':_0xaaff('0x143'),'onDelete':_0xaaff('0x12c'),'foreignKey':'OpenchannelInteractionId'});db[_0xaaff('0x59')][_0xaaff('0x136')](db[_0xaaff('0x56')],{'as':'Account','foreignKey':_0xaaff('0x171')});db[_0xaaff('0x59')]['belongsTo'](db['CmContact'],{'as':_0xaaff('0x149'),'foreignKey':_0xaaff('0x157')});db[_0xaaff('0x59')]['belongsTo'](db[_0xaaff('0xf1')],{'as':_0xaaff('0x158'),'foreignKey':_0xaaff('0xf5')});db['OpenchannelInteraction'][_0xaaff('0x105')](db[_0xaaff('0x86')],{'through':_0xaaff('0x173'),'as':_0xaaff('0x15a')});db['OpenchannelInteraction'][_0xaaff('0x105')](db[_0xaaff('0x86')],{'through':_0xaaff('0x173'),'as':'ThroughTags'});db[_0xaaff('0x59')][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x16e'),'through':_0xaaff('0x110'),'foreignKey':_0xaaff('0x174')});db[_0xaaff('0x5b')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'onDelete':_0xaaff('0x12c'),'as':_0xaaff('0xf1')});db[_0xaaff('0x5b')]['belongsTo'](db['CmContact'],{'onDelete':_0xaaff('0x12c'),'as':'Contact'});db[_0xaaff('0x5b')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xaaff('0x174')});db['OpenchannelMessage']['belongsTo'](db[_0xaaff('0xd6')],{'as':_0xaaff('0xd6'),'foreignKey':_0xaaff('0x175')});db[_0xaaff('0x5b')][_0xaaff('0x136')](db['OpenchannelAccount'],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x171')});db[_0xaaff('0x5c')]['belongsToMany'](db[_0xaaff('0xf1')],{'as':_0xaaff('0x13f'),'through':_0xaaff('0x34'),'foreignKey':_0xaaff('0x172')});db[_0xaaff('0x5c')][_0xaaff('0x105')](db[_0xaaff('0xd1')],{'through':'team_has_openchannel_queues','as':_0xaaff('0x140')});db[_0xaaff('0x5d')][_0xaaff('0xf6')](db[_0xaaff('0x14d')],{'as':_0xaaff('0x14e'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xaaff('0xf6')](db[_0xaaff('0x161')],{'as':_0xaaff('0x168'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xaaff('0xf6')](db[_0xaaff('0x6b')],{'as':_0xaaff('0x176')});db[_0xaaff('0x5d')][_0xaaff('0xf6')](db['ChatInteraction'],{'as':'Interactions'});db[_0xaaff('0x5d')]['hasMany'](db[_0xaaff('0x61')],{'as':'Applications'});db[_0xaaff('0x5d')][_0xaaff('0xf6')](db[_0xaaff('0x64')],{'as':_0xaaff('0x143')});db[_0xaaff('0x5d')][_0xaaff('0x136')](db[_0xaaff('0x109')],{'as':_0xaaff('0x15f'),'foreignKey':_0xaaff('0x151')});db[_0xaaff('0x5d')]['belongsTo'](db[_0xaaff('0x139')],{'as':_0xaaff('0x139'),'foreignKey':_0xaaff('0x13a')});db[_0xaaff('0x5d')][_0xaaff('0x136')](db[_0xaaff('0x3c')],{'as':_0xaaff('0x3c'),'foreignKey':'MailAccountId'});db[_0xaaff('0x5d')][_0xaaff('0x136')](db[_0xaaff('0x13b')],{'as':_0xaaff('0x13c'),'foreignKey':_0xaaff('0x13d')});db[_0xaaff('0x5d')][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x13f'),'through':_0xaaff('0x11c')});db[_0xaaff('0x5f')]['belongsTo'](db[_0xaaff('0x56')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xaaff('0x109')],{'as':_0xaaff('0x15f'),'foreignKey':_0xaaff('0x151')});db[_0xaaff('0x5f')]['belongsTo'](db['CmContact'],{'as':_0xaaff('0x149'),'foreignKey':_0xaaff('0x157')});db[_0xaaff('0x5f')]['belongsTo'](db[_0xaaff('0x59')],{});db[_0xaaff('0x5f')]['belongsTo'](db[_0xaaff('0x5b')],{});db[_0xaaff('0x5f')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{});db[_0xaaff('0x5f')][_0xaaff('0x136')](db[_0xaaff('0x5c')],{});db[_0xaaff('0x61')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x177'),'foreignKey':'UserId','onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0xaaff('0x67')],{'as':_0xaaff('0x178'),'foreignKey':_0xaaff('0x179'),'onDelete':'restrict'});db['ChatApplication'][_0xaaff('0x136')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xaaff('0x15c'),'onDelete':_0xaaff('0x15d')});db[_0xaaff('0x61')][_0xaaff('0x136')](db[_0xaaff('0x86')],{'onDelete':'restrict','foreignKey':_0xaaff('0x163')});db[_0xaaff('0x62')][_0xaaff('0xf6')](db[_0xaaff('0x64')],{'as':_0xaaff('0x143'),'onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x17a')});db['ChatInteraction'][_0xaaff('0x136')](db[_0xaaff('0x5d')],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x15c')});db['ChatInteraction']['belongsTo'](db[_0xaaff('0x6f')],{'as':_0xaaff('0x149'),'foreignKey':_0xaaff('0x157')});db[_0xaaff('0x62')]['belongsTo'](db[_0xaaff('0xf1')],{'as':_0xaaff('0x158'),'foreignKey':_0xaaff('0xf5')});db[_0xaaff('0x62')]['belongsToMany'](db[_0xaaff('0x86')],{'through':_0xaaff('0x17b'),'as':_0xaaff('0x15a')});db[_0xaaff('0x62')][_0xaaff('0x105')](db['Tag'],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db[_0xaaff('0x62')][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0xaaff('0x17a')});db[_0xaaff('0x64')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'onDelete':_0xaaff('0x12c'),'as':_0xaaff('0xf1')});db['ChatMessage'][_0xaaff('0x136')](db[_0xaaff('0x6f')],{'onDelete':_0xaaff('0x12c'),'as':_0xaaff('0x149'),'foreignKey':_0xaaff('0x157')});db[_0xaaff('0x64')][_0xaaff('0x136')](db[_0xaaff('0x62')],{'onDelete':'cascade','as':_0xaaff('0x15b'),'foreignKey':_0xaaff('0x17a')});db[_0xaaff('0x64')][_0xaaff('0x136')](db[_0xaaff('0xd6')],{'as':_0xaaff('0xd6'),'foreignKey':_0xaaff('0x175')});db['ChatMessage']['belongsTo'](db['ChatWebsite'],{'as':_0xaaff('0x156'),'foreignKey':'ChatWebsiteId'});db[_0xaaff('0x65')][_0xaaff('0xf6')](db['Attachment'],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0xaaff('0x12c'),'hooks':!![]});db[_0xaaff('0x65')][_0xaaff('0x136')](db[_0xaaff('0x6f')],{'onDelete':_0xaaff('0x12c'),'as':'Contact','foreignKey':_0xaaff('0x157')});db[_0xaaff('0x65')][_0xaaff('0x136')](db['ChatWebsite'],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x15c')});db[_0xaaff('0x67')][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x13f'),'through':_0xaaff('0x114'),'hooks':!![]});db[_0xaaff('0x67')][_0xaaff('0x105')](db[_0xaaff('0xd1')],{'through':_0xaaff('0x17c'),'as':_0xaaff('0x140')});db[_0xaaff('0x69')]['hasMany'](db[_0xaaff('0xbf')],{'as':_0xaaff('0x143'),'foreignKey':_0xaaff('0x17d'),'onDelete':'cascade'});db['ChatGroup'][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x12e'),'through':_0xaaff('0x17e')});db[_0xaaff('0x6b')][_0xaaff('0x136')](db[_0xaaff('0x5d')],{'as':_0xaaff('0x17f'),'foreignKey':'ChatWebsiteId'});db[_0xaaff('0x6d')][_0xaaff('0xf6')](db[_0xaaff('0x6f')],{'as':_0xaaff('0x107'),'foreignKey':_0xaaff('0x180')});db[_0xaaff('0x6f')][_0xaaff('0xf6')](db[_0xaaff('0x70')],{'as':_0xaaff('0x181'),'foreignKey':_0xaaff('0x157')});db[_0xaaff('0x6f')][_0xaaff('0xf6')](db['CmHopperFinal'],{'as':_0xaaff('0x130'),'foreignKey':_0xaaff('0x157')});db[_0xaaff('0x6f')][_0xaaff('0xf6')](db[_0xaaff('0x131')],{'as':_0xaaff('0x132'),'foreignKey':_0xaaff('0x157')});db[_0xaaff('0x6f')][_0xaaff('0xf6')](db[_0xaaff('0x76')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0xaaff('0x6f')]['hasMany'](db['JscriptySessionReport'],{'as':_0xaaff('0x135'),'foreignKey':_0xaaff('0x157')});db[_0xaaff('0x6f')][_0xaaff('0xf6')](db[_0xaaff('0x59')],{'as':_0xaaff('0xfa'),'foreignKey':'ContactId','onDelete':_0xaaff('0x15d')});db[_0xaaff('0x6f')][_0xaaff('0xf6')](db[_0xaaff('0x62')],{'as':_0xaaff('0xfb'),'foreignKey':_0xaaff('0x157'),'onDelete':_0xaaff('0x15d')});db[_0xaaff('0x6f')][_0xaaff('0xf6')](db[_0xaaff('0xfc')],{'as':_0xaaff('0xfd'),'foreignKey':_0xaaff('0x157'),'onDelete':_0xaaff('0x15d')});db[_0xaaff('0x6f')][_0xaaff('0xf6')](db[_0xaaff('0x4b')],{'as':_0xaaff('0xfe'),'foreignKey':_0xaaff('0x157'),'onDelete':_0xaaff('0x15d')});db[_0xaaff('0x6f')][_0xaaff('0xf6')](db[_0xaaff('0x40')],{'as':'MailInteractions','foreignKey':_0xaaff('0x157'),'onDelete':_0xaaff('0x15d')});db[_0xaaff('0x6f')][_0xaaff('0x136')](db[_0xaaff('0x6d')],{'as':'Company','foreignKey':_0xaaff('0x180')});db[_0xaaff('0x6f')][_0xaaff('0x136')](db[_0xaaff('0x109')],{'as':_0xaaff('0x15f'),'foreignKey':_0xaaff('0x151'),'onDelete':_0xaaff('0x12c')});db[_0xaaff('0x6f')][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x16e'),'through':_0xaaff('0x108')});db['CmContact'][_0xaaff('0x105')](db[_0xaaff('0x86')],{'as':_0xaaff('0x15a'),'through':_0xaaff('0x182')});db[_0xaaff('0x6f')]['belongsToMany'](db[_0xaaff('0x86')],{'through':'cm_contact_has_tags','as':_0xaaff('0x16d')});db[_0xaaff('0x70')][_0xaaff('0x136')](db['CmContact'],{'as':'Contact','foreignKey':_0xaaff('0x157'),'onDelete':_0xaaff('0x12c')});db['CmHopper']['belongsTo'](db[_0xaaff('0x109')],{'as':_0xaaff('0x15f'),'foreignKey':_0xaaff('0x151'),'onDelete':'cascade'});db[_0xaaff('0x70')]['belongsTo'](db[_0xaaff('0xf1')],{'as':_0xaaff('0x177'),'foreignKey':_0xaaff('0xf5')});db['CmHopper'][_0xaaff('0x136')](db[_0xaaff('0x1b')],{'as':_0xaaff('0x178'),'foreignKey':'VoiceQueueId','onDelete':_0xaaff('0x12c')});db[_0xaaff('0x70')][_0xaaff('0x136')](db[_0xaaff('0xd4')],{'as':'Campaign','foreignKey':_0xaaff('0x183'),'onDelete':_0xaaff('0x12c')});db[_0xaaff('0x70')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'as':'Owner','foreignKey':_0xaaff('0x184')});db[_0xaaff('0x71')]['belongsTo'](db[_0xaaff('0x6f')],{'as':_0xaaff('0x149'),'foreignKey':_0xaaff('0x157'),'onDelete':_0xaaff('0x12c')});db[_0xaaff('0x71')][_0xaaff('0x136')](db[_0xaaff('0x109')],{'as':_0xaaff('0x15f'),'foreignKey':_0xaaff('0x151'),'onDelete':_0xaaff('0x12c')});db[_0xaaff('0x71')][_0xaaff('0x136')](db[_0xaaff('0x1b')],{'as':_0xaaff('0x178'),'foreignKey':_0xaaff('0x12f'),'onDelete':_0xaaff('0x12c')});db[_0xaaff('0x71')][_0xaaff('0x136')](db[_0xaaff('0xd4')],{'as':_0xaaff('0xd4'),'foreignKey':_0xaaff('0x183'),'onDelete':'cascade'});db[_0xaaff('0x7b')][_0xaaff('0xf6')](db[_0xaaff('0x185')],{'as':{'plural':_0xaaff('0x186'),'singular':'OneAll'},'foreignKey':_0xaaff('0x187'),'onDelete':_0xaaff('0x12c'),'hooks':!![]});db['Automation']['hasMany'](db[_0xaaff('0x185')],{'as':{'plural':_0xaaff('0x188'),'singular':_0xaaff('0x189')},'foreignKey':_0xaaff('0x18a'),'onDelete':'cascade','hooks':!![]});db[_0xaaff('0x7b')][_0xaaff('0xf6')](db[_0xaaff('0x79')],{'as':_0xaaff('0x18b'),'foreignKey':_0xaaff('0x18c'),'onDelete':'cascade','hooks':!![]});db[_0xaaff('0x14d')][_0xaaff('0xf6')](db[_0xaaff('0x14d')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0xaaff('0x12c')});db['Interval'][_0xaaff('0xf6')](db[_0xaaff('0x139')],{'as':_0xaaff('0x18d'),'foreignKey':_0xaaff('0x13a'),'onDelete':_0xaaff('0x12c'),'hooks':!![],'required':![]});db['Interval'][_0xaaff('0xf6')](db['VoiceExtension'],{'as':_0xaaff('0xf9'),'foreignKey':_0xaaff('0x13a'),'onDelete':'restrict'});db[_0xaaff('0x139')][_0xaaff('0xf6')](db[_0xaaff('0x150')],{'as':_0xaaff('0x18e'),'foreignKey':_0xaaff('0x13a')});db[_0xaaff('0x139')][_0xaaff('0xf6')](db[_0xaaff('0x61')],{'as':_0xaaff('0x18f'),'foreignKey':_0xaaff('0x13a')});db[_0xaaff('0x139')][_0xaaff('0xf6')](db[_0xaaff('0x162')],{'as':_0xaaff('0x190'),'foreignKey':'IntervalId'});db[_0xaaff('0x139')]['hasMany'](db['SmsApplication'],{'as':_0xaaff('0x191'),'foreignKey':_0xaaff('0x13a')});db['Schedule'][_0xaaff('0x136')](db[_0xaaff('0x3c')],{});db[_0xaaff('0x192')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0xaaff('0x193')});db[_0xaaff('0x192')]['belongsTo'](db[_0xaaff('0x194')],{'foreignKey':'CustomReportId'});db[_0xaaff('0x84')][_0xaaff('0x105')](db[_0xaaff('0x195')],{'as':_0xaaff('0x196'),'through':_0xaaff('0x197'),'onDelete':_0xaaff('0x15d')});db['Tag'][_0xaaff('0x105')](db[_0xaaff('0x6f')],{'through':'cm_contact_has_tags'});db[_0xaaff('0x86')]['belongsToMany'](db['ChatInteraction'],{'through':_0xaaff('0x17b')});db[_0xaaff('0x86')]['belongsToMany'](db['MailInteraction'],{'through':_0xaaff('0x159')});db[_0xaaff('0x86')][_0xaaff('0x105')](db[_0xaaff('0xfc')],{'through':_0xaaff('0x16c')});db[_0xaaff('0x86')][_0xaaff('0x105')](db[_0xaaff('0x4b')],{'through':_0xaaff('0x164')});db['Tag'][_0xaaff('0x105')](db[_0xaaff('0x59')],{'through':_0xaaff('0x173')});db['Tag'][_0xaaff('0x105')](db[_0xaaff('0xe8')],{'through':_0xaaff('0x198')});db[_0xaaff('0x199')]['hasMany'](db[_0xaaff('0x185')],{'as':{'plural':_0xaaff('0x19a'),'singular':_0xaaff('0x19b')},'foreignKey':_0xaaff('0x19c'),'onDelete':_0xaaff('0x12c'),'hooks':!![]});db['Trigger'][_0xaaff('0xf6')](db[_0xaaff('0x185')],{'as':{'plural':'AnyConditions','singular':_0xaaff('0x19d')},'foreignKey':_0xaaff('0x19e'),'onDelete':_0xaaff('0x12c'),'hooks':!![]});db[_0xaaff('0x199')]['hasMany'](db['Action'],{'as':_0xaaff('0x18b'),'foreignKey':'TriggerId','onDelete':_0xaaff('0x12c'),'hooks':!![]});db[_0xaaff('0x194')][_0xaaff('0xf6')](db[_0xaaff('0x19f')],{'as':_0xaaff('0x1a0'),'onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1a1'),'hooks':!![]});db[_0xaaff('0x1a2')][_0xaaff('0xf6')](db[_0xaaff('0x19f')],{'as':_0xaaff('0x1a0'),'onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x193')});db[_0xaaff('0x8f')][_0xaaff('0xf6')](db[_0xaaff('0x19f')],{'as':_0xaaff('0x1a0'),'onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1a3')});db[_0xaaff('0x19f')]['belongsTo'](db[_0xaaff('0x8f')],{'foreignKey':_0xaaff('0x1a3')});db[_0xaaff('0x94')][_0xaaff('0xf6')](db[_0xaaff('0x96')],{'as':_0xaaff('0x1a4'),'onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1a5')});db[_0xaaff('0x96')][_0xaaff('0xf6')](db[_0xaaff('0x1a6')],{'as':_0xaaff('0x1a7'),'onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1a8')});db[_0xaaff('0x96')][_0xaaff('0xf6')](db[_0xaaff('0x1a6')],{'as':_0xaaff('0x1a9'),'onDelete':_0xaaff('0x12c'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0xaaff('0xf6')](db['SalesforceField'],{'as':_0xaaff('0x1a0'),'onDelete':'cascade','foreignKey':_0xaaff('0x1aa')});db[_0xaaff('0x96')]['belongsTo'](db[_0xaaff('0x94')],{'as':_0xaaff('0x156'),'foreignKey':'AccountId'});db[_0xaaff('0x1a6')][_0xaaff('0xf6')](db['SalesforceField'],{'as':_0xaaff('0x1ab'),'foreignKey':'SubjectId'});db[_0xaaff('0x1a6')][_0xaaff('0xf6')](db[_0xaaff('0x1a6')],{'as':_0xaaff('0x1ac'),'foreignKey':_0xaaff('0x1ad')});db['SalesforceField'][_0xaaff('0xf6')](db['SalesforceField'],{'as':_0xaaff('0x1ae'),'foreignKey':_0xaaff('0x1aa')});db['SalesforceField'][_0xaaff('0x136')](db[_0xaaff('0x1af')],{'as':_0xaaff('0x1af'),'foreignKey':_0xaaff('0x1b0')});db[_0xaaff('0x1b1')]['hasMany'](db[_0xaaff('0x99')],{'as':_0xaaff('0x1a4'),'onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1a5')});db[_0xaaff('0x99')]['hasMany'](db[_0xaaff('0x1b2')],{'as':'Subjects','onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1a8')});db[_0xaaff('0x99')][_0xaaff('0xf6')](db[_0xaaff('0x1b2')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0xaaff('0xf6')](db['SugarcrmField'],{'as':_0xaaff('0x1a0'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xaaff('0x99')][_0xaaff('0x136')](db[_0xaaff('0x1b1')],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x1a5')});db[_0xaaff('0x1b2')]['hasMany'](db[_0xaaff('0x1b2')],{'as':_0xaaff('0x1ab'),'foreignKey':_0xaaff('0x1a8')});db[_0xaaff('0x1b2')]['hasMany'](db[_0xaaff('0x1b2')],{'as':_0xaaff('0x1ac'),'foreignKey':_0xaaff('0x1ad')});db[_0xaaff('0x1b2')][_0xaaff('0xf6')](db[_0xaaff('0x1b2')],{'as':_0xaaff('0x1ae'),'foreignKey':'FieldId'});db[_0xaaff('0x1b2')][_0xaaff('0x136')](db[_0xaaff('0x1af')],{'as':_0xaaff('0x1af'),'foreignKey':_0xaaff('0x1b0')});db[_0xaaff('0x9c')]['hasMany'](db['DeskConfiguration'],{'as':_0xaaff('0x1a4'),'onDelete':_0xaaff('0x12c'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0xaaff('0xf6')](db['DeskField'],{'as':'Subjects','onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1a8')});db[_0xaaff('0x9d')][_0xaaff('0xf6')](db[_0xaaff('0x1b3')],{'as':_0xaaff('0x1a9'),'onDelete':_0xaaff('0x12c'),'foreignKey':'DescriptionId'});db[_0xaaff('0x9d')]['hasMany'](db[_0xaaff('0x1b3')],{'as':'Fields','onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1aa')});db[_0xaaff('0x9d')][_0xaaff('0x136')](db[_0xaaff('0x9c')],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x1a5')});db[_0xaaff('0x9d')]['belongsToMany'](db[_0xaaff('0x86')],{'through':_0xaaff('0x1b4')});db[_0xaaff('0x1b3')][_0xaaff('0xf6')](db[_0xaaff('0x1b3')],{'as':_0xaaff('0x1ab'),'foreignKey':_0xaaff('0x1a8')});db[_0xaaff('0x1b3')][_0xaaff('0xf6')](db[_0xaaff('0x1b3')],{'as':_0xaaff('0x1ac'),'foreignKey':_0xaaff('0x1ad')});db[_0xaaff('0x1b3')][_0xaaff('0xf6')](db[_0xaaff('0x1b3')],{'as':_0xaaff('0x1ae'),'foreignKey':_0xaaff('0x1aa')});db[_0xaaff('0x1b3')]['belongsTo'](db[_0xaaff('0x1af')],{'as':_0xaaff('0x1af'),'foreignKey':_0xaaff('0x1b0')});db[_0xaaff('0x9f')][_0xaaff('0xf6')](db[_0xaaff('0x1b5')],{'as':_0xaaff('0x1a4'),'onDelete':_0xaaff('0x12c'),'foreignKey':'AccountId'});db[_0xaaff('0x1b5')][_0xaaff('0xf6')](db['ZohoField'],{'as':_0xaaff('0x1a7'),'onDelete':_0xaaff('0x12c'),'foreignKey':'SubjectId'});db[_0xaaff('0x1b5')]['hasMany'](db[_0xaaff('0xa2')],{'as':_0xaaff('0x1a9'),'onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1ad')});db[_0xaaff('0x1b5')][_0xaaff('0xf6')](db[_0xaaff('0xa2')],{'as':_0xaaff('0x1a0'),'onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1aa')});db[_0xaaff('0x1b5')][_0xaaff('0x136')](db['ZohoAccount'],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x1a5')});db[_0xaaff('0xa2')][_0xaaff('0xf6')](db[_0xaaff('0xa2')],{'as':_0xaaff('0x1ab'),'foreignKey':_0xaaff('0x1a8')});db[_0xaaff('0xa2')]['hasMany'](db['ZohoField'],{'as':_0xaaff('0x1ac'),'foreignKey':_0xaaff('0x1ad')});db['ZohoField'][_0xaaff('0xf6')](db['ZohoField'],{'as':_0xaaff('0x1ae'),'foreignKey':'FieldId'});db[_0xaaff('0xa2')][_0xaaff('0x136')](db[_0xaaff('0x1af')],{'as':_0xaaff('0x1af'),'foreignKey':_0xaaff('0x1b0')});db[_0xaaff('0xa4')]['hasMany'](db['ZendeskConfiguration'],{'as':_0xaaff('0x1a4'),'onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1a5')});db[_0xaaff('0x1b6')]['hasMany'](db['ZendeskField'],{'as':_0xaaff('0x1a7'),'foreignKey':_0xaaff('0x1a8')});db[_0xaaff('0x1b6')][_0xaaff('0xf6')](db[_0xaaff('0xa6')],{'as':_0xaaff('0x1a9'),'foreignKey':_0xaaff('0x1ad')});db[_0xaaff('0x1b6')][_0xaaff('0xf6')](db['ZendeskField'],{'as':_0xaaff('0x1a0'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0xaaff('0x136')](db[_0xaaff('0xa4')],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x1a5')});db[_0xaaff('0x1b6')][_0xaaff('0x105')](db[_0xaaff('0x86')],{'through':_0xaaff('0x1b7')});db['ZendeskField'][_0xaaff('0xf6')](db['ZendeskField'],{'as':_0xaaff('0x1ab'),'foreignKey':_0xaaff('0x1a8')});db['ZendeskField']['hasMany'](db[_0xaaff('0xa6')],{'as':_0xaaff('0x1ac'),'foreignKey':_0xaaff('0x1ad')});db['ZendeskField'][_0xaaff('0xf6')](db[_0xaaff('0xa6')],{'as':_0xaaff('0x1ae'),'foreignKey':_0xaaff('0x1aa')});db[_0xaaff('0xa6')][_0xaaff('0x136')](db['Variable'],{'as':_0xaaff('0x1af'),'foreignKey':_0xaaff('0x1b0')});db[_0xaaff('0xa7')][_0xaaff('0xf6')](db[_0xaaff('0xa9')],{'as':_0xaaff('0x1a4'),'onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1a5')});db[_0xaaff('0xa9')]['hasMany'](db[_0xaaff('0xab')],{'as':'Subjects','onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1a8')});db['FreshdeskConfiguration'][_0xaaff('0xf6')](db[_0xaaff('0xab')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xaaff('0xa9')][_0xaaff('0xf6')](db[_0xaaff('0xab')],{'as':'Fields','onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1aa')});db['FreshdeskConfiguration'][_0xaaff('0x136')](db['FreshdeskAccount'],{'as':_0xaaff('0x156'),'foreignKey':'AccountId'});db[_0xaaff('0xa9')][_0xaaff('0x105')](db[_0xaaff('0x86')],{'through':_0xaaff('0x1b8')});db[_0xaaff('0xab')][_0xaaff('0xf6')](db['FreshdeskField'],{'as':_0xaaff('0x1ab'),'foreignKey':_0xaaff('0x1a8')});db[_0xaaff('0xab')][_0xaaff('0xf6')](db[_0xaaff('0xab')],{'as':_0xaaff('0x1ac'),'foreignKey':_0xaaff('0x1ad')});db[_0xaaff('0xab')][_0xaaff('0xf6')](db['FreshdeskField'],{'as':_0xaaff('0x1ae'),'foreignKey':'FieldId'});db[_0xaaff('0xab')][_0xaaff('0x136')](db[_0xaaff('0x1af')],{'as':_0xaaff('0x1af'),'foreignKey':_0xaaff('0x1b0')});db['VtigerAccount']['hasMany'](db[_0xaaff('0x1b9')],{'as':_0xaaff('0x1a4'),'onDelete':_0xaaff('0x12c'),'foreignKey':'AccountId'});db[_0xaaff('0x1b9')]['hasMany'](db['VtigerField'],{'as':_0xaaff('0x1a7'),'foreignKey':_0xaaff('0x1a8')});db[_0xaaff('0x1b9')][_0xaaff('0xf6')](db[_0xaaff('0xaf')],{'as':_0xaaff('0x1a9'),'foreignKey':_0xaaff('0x1ad')});db['VtigerConfiguration'][_0xaaff('0xf6')](db[_0xaaff('0xaf')],{'as':_0xaaff('0x1a0'),'foreignKey':_0xaaff('0x1aa')});db[_0xaaff('0x1b9')][_0xaaff('0x136')](db['VtigerAccount'],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x1a5')});db[_0xaaff('0xaf')][_0xaaff('0xf6')](db[_0xaaff('0xaf')],{'as':_0xaaff('0x1ab'),'foreignKey':'SubjectId'});db[_0xaaff('0xaf')][_0xaaff('0xf6')](db[_0xaaff('0xaf')],{'as':_0xaaff('0x1ac'),'foreignKey':_0xaaff('0x1ad')});db[_0xaaff('0xaf')]['hasMany'](db['VtigerField'],{'as':_0xaaff('0x1ae'),'foreignKey':_0xaaff('0x1aa')});db[_0xaaff('0xaf')][_0xaaff('0x136')](db[_0xaaff('0x1af')],{'as':_0xaaff('0x1af'),'foreignKey':_0xaaff('0x1b0')});db[_0xaaff('0xb0')][_0xaaff('0xf6')](db[_0xaaff('0xb2')],{'as':'Configurations','onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1a5')});db['ServicenowConfiguration'][_0xaaff('0xf6')](db[_0xaaff('0x1ba')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xaaff('0xb2')][_0xaaff('0xf6')](db[_0xaaff('0x1ba')],{'as':_0xaaff('0x1a9'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0xaaff('0xf6')](db['ServicenowField'],{'as':'Fields','foreignKey':'FieldId'});db[_0xaaff('0xb2')][_0xaaff('0x136')](db[_0xaaff('0xb0')],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x1a5')});db[_0xaaff('0x1ba')][_0xaaff('0xf6')](db[_0xaaff('0x1ba')],{'as':_0xaaff('0x1ab'),'foreignKey':_0xaaff('0x1a8')});db[_0xaaff('0x1ba')][_0xaaff('0xf6')](db[_0xaaff('0x1ba')],{'as':_0xaaff('0x1ac'),'foreignKey':_0xaaff('0x1ad')});db[_0xaaff('0x1ba')][_0xaaff('0xf6')](db[_0xaaff('0x1ba')],{'as':_0xaaff('0x1ae'),'foreignKey':_0xaaff('0x1aa')});db[_0xaaff('0x1ba')][_0xaaff('0x136')](db[_0xaaff('0x1af')],{'as':_0xaaff('0x1af'),'foreignKey':_0xaaff('0x1b0')});db[_0xaaff('0xb5')][_0xaaff('0xf6')](db[_0xaaff('0xb6')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xaaff('0x1a5')});db[_0xaaff('0xb6')][_0xaaff('0xf6')](db['Dynamics365Field'],{'as':_0xaaff('0x1a7'),'onDelete':'cascade','foreignKey':_0xaaff('0x1a8')});db['Dynamics365Configuration'][_0xaaff('0xf6')](db[_0xaaff('0xb7')],{'as':_0xaaff('0x1a9'),'onDelete':'cascade','foreignKey':_0xaaff('0x1ad')});db['Dynamics365Configuration'][_0xaaff('0xf6')](db[_0xaaff('0xb7')],{'as':_0xaaff('0x1a0'),'onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1aa')});db[_0xaaff('0xb6')][_0xaaff('0x136')](db['Dynamics365Account'],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x1a5')});db[_0xaaff('0xb7')][_0xaaff('0xf6')](db[_0xaaff('0xb7')],{'as':_0xaaff('0x1ab'),'foreignKey':_0xaaff('0x1a8')});db['Dynamics365Field']['hasMany'](db[_0xaaff('0xb7')],{'as':_0xaaff('0x1ac'),'foreignKey':_0xaaff('0x1ad')});db[_0xaaff('0xb7')]['hasMany'](db[_0xaaff('0xb7')],{'as':_0xaaff('0x1ae'),'foreignKey':'FieldId'});db[_0xaaff('0xb7')][_0xaaff('0x136')](db['Variable'],{'as':_0xaaff('0x1af'),'foreignKey':'VariableId'});db['FreshsalesAccount'][_0xaaff('0xf6')](db[_0xaaff('0xb9')],{'as':_0xaaff('0x1a4'),'onDelete':'cascade','foreignKey':_0xaaff('0x1a5')});db[_0xaaff('0xb9')][_0xaaff('0xf6')](db[_0xaaff('0xbb')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xaaff('0xb9')][_0xaaff('0xf6')](db[_0xaaff('0xbb')],{'as':_0xaaff('0x1a9'),'foreignKey':_0xaaff('0x1ad')});db['FreshsalesConfiguration']['hasMany'](db[_0xaaff('0xbb')],{'as':_0xaaff('0x1a0'),'foreignKey':_0xaaff('0x1aa')});db[_0xaaff('0xb9')][_0xaaff('0x136')](db[_0xaaff('0x1bb')],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x1a5')});db[_0xaaff('0xbb')]['hasMany'](db[_0xaaff('0xbb')],{'as':_0xaaff('0x1ab'),'foreignKey':_0xaaff('0x1a8')});db[_0xaaff('0xbb')]['hasMany'](db['FreshsalesField'],{'as':_0xaaff('0x1ac'),'foreignKey':_0xaaff('0x1ad')});db[_0xaaff('0xbb')][_0xaaff('0xf6')](db[_0xaaff('0xbb')],{'as':'Field','foreignKey':_0xaaff('0x1aa')});db['FreshsalesField']['belongsTo'](db[_0xaaff('0x1af')],{'as':_0xaaff('0x1af'),'foreignKey':_0xaaff('0x1b0')});db['ChatQueueReport'][_0xaaff('0x136')](db['ChatWebsite'],{});db[_0xaaff('0x1bc')]['belongsTo'](db[_0xaaff('0x109')],{'as':_0xaaff('0x15f'),'foreignKey':_0xaaff('0x151')});db[_0xaaff('0x1bc')][_0xaaff('0x136')](db['CmContact'],{'as':'Contact','foreignKey':_0xaaff('0x157')});db[_0xaaff('0x1bc')]['belongsTo'](db[_0xaaff('0x62')],{});db['ChatQueueReport'][_0xaaff('0x136')](db[_0xaaff('0x64')],{});db['ChatQueueReport']['belongsTo'](db[_0xaaff('0xf1')],{});db['ChatQueueReport'][_0xaaff('0x136')](db['ChatQueue'],{});db[_0xaaff('0xbf')]['belongsTo'](db['User'],{'onDelete':_0xaaff('0x12c'),'foreignKey':'FromId'});db[_0xaaff('0xbf')]['belongsTo'](db['User'],{'onDelete':_0xaaff('0x12c'),'foreignKey':'ToId'});db[_0xaaff('0x134')][_0xaaff('0xf6')](db[_0xaaff('0xc3')],{'foreignKey':_0xaaff('0x1bd'),'onDelete':_0xaaff('0x12c')});db[_0xaaff('0x134')]['hasMany'](db[_0xaaff('0xc1')],{'foreignKey':_0xaaff('0x1bd'),'onDelete':'cascade'});db[_0xaaff('0xc6')][_0xaaff('0x136')](db[_0xaaff('0x50')],{});db[_0xaaff('0xc6')][_0xaaff('0x136')](db[_0xaaff('0x109')],{'as':_0xaaff('0x15f'),'foreignKey':_0xaaff('0x151')});db[_0xaaff('0xc6')]['belongsTo'](db[_0xaaff('0x6f')],{'as':_0xaaff('0x149'),'foreignKey':'ContactId'});db[_0xaaff('0xc6')][_0xaaff('0x136')](db['SmsInteraction'],{});db[_0xaaff('0xc6')][_0xaaff('0x136')](db[_0xaaff('0x53')],{});db['SmsQueueReport'][_0xaaff('0x136')](db['User'],{});db['SmsQueueReport']['belongsTo'](db[_0xaaff('0x55')],{});db[_0xaaff('0xc8')][_0xaaff('0xf6')](db[_0xaaff('0x134')],{'foreignKey':_0xaaff('0x1be')});db[_0xaaff('0xc8')][_0xaaff('0xf6')](db[_0xaaff('0xc3')],{'foreignKey':_0xaaff('0x1be')});db[_0xaaff('0xc8')][_0xaaff('0xf6')](db[_0xaaff('0xc1')],{'foreignKey':_0xaaff('0x1be')});db[_0xaaff('0x128')][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x16e'),'through':_0xaaff('0x1bf')});db['Team'][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x13f'),'through':_0xaaff('0x10c')});db['Team']['belongsToMany'](db[_0xaaff('0x1b')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db[_0xaaff('0xd1')][_0xaaff('0x105')](db['MailQueue'],{'through':_0xaaff('0x154'),'as':'MailQueues'});db[_0xaaff('0xd1')][_0xaaff('0x105')](db[_0xaaff('0x67')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0xaaff('0xd1')][_0xaaff('0x105')](db[_0xaaff('0x115')],{'through':_0xaaff('0x166'),'as':_0xaaff('0x116')});db[_0xaaff('0xd1')]['belongsToMany'](db[_0xaaff('0x55')],{'through':_0xaaff('0x170'),'as':_0xaaff('0x117')});db[_0xaaff('0xd1')]['belongsToMany'](db[_0xaaff('0x5c')],{'through':_0xaaff('0x1c0'),'as':_0xaaff('0x1c1')});db['Team'][_0xaaff('0x105')](db[_0xaaff('0xed')],{'through':_0xaaff('0x1c2'),'as':_0xaaff('0x118')});db[_0xaaff('0xd4')][_0xaaff('0xf6')](db[_0xaaff('0x70')],{'as':_0xaaff('0x181'),'foreignKey':_0xaaff('0x183')});db[_0xaaff('0xd4')][_0xaaff('0xf6')](db[_0xaaff('0x73')],{'as':_0xaaff('0x130'),'foreignKey':_0xaaff('0x183')});db[_0xaaff('0xd4')][_0xaaff('0xf6')](db[_0xaaff('0x131')],{'as':_0xaaff('0x132'),'foreignKey':'CampaignId'});db[_0xaaff('0xd4')][_0xaaff('0xf6')](db[_0xaaff('0x71')],{'as':_0xaaff('0x133'),'foreignKey':_0xaaff('0x183')});db[_0xaaff('0xd4')][_0xaaff('0x136')](db[_0xaaff('0x2b')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xaaff('0xd4')][_0xaaff('0x136')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0xaaff('0x138')});db[_0xaaff('0xd4')]['belongsTo'](db[_0xaaff('0x139')],{'as':_0xaaff('0x139'),'foreignKey':_0xaaff('0x13a')});db['Campaign'][_0xaaff('0x136')](db['SquareProject'],{'as':_0xaaff('0x128'),'foreignKey':_0xaaff('0x1c3')});db['Campaign']['belongsToMany'](db[_0xaaff('0x109')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0xaaff('0xd4')][_0xaaff('0x105')](db[_0xaaff('0x109')],{'as':_0xaaff('0x141'),'through':'campaigns_has_cm_blacklists'});db[_0xaaff('0xd6')][_0xaaff('0x136')](db[_0xaaff('0x65')],{'as':_0xaaff('0x65'),'foreignKey':_0xaaff('0x1c4')});db[_0xaaff('0x1c5')]['belongsTo'](db[_0xaaff('0x41')],{});db[_0xaaff('0x1c5')][_0xaaff('0x136')](db['MailInteraction'],{});db[_0xaaff('0x1c5')][_0xaaff('0x136')](db[_0xaaff('0x3c')],{'foreignKey':_0xaaff('0x1c6'),'as':'FromAccount'});db['MailTransferReport']['belongsTo'](db[_0xaaff('0xf1')],{'foreignKey':_0xaaff('0x1c7'),'as':'FromAgent'});db[_0xaaff('0x1c5')][_0xaaff('0x136')](db['User'],{'foreignKey':_0xaaff('0x1c8'),'as':_0xaaff('0x1c9')});db[_0xaaff('0x1c5')][_0xaaff('0x136')](db[_0xaaff('0x1ca')],{'foreignKey':'ToMailQueueId','as':_0xaaff('0x1cb')});db[_0xaaff('0x1c5')][_0xaaff('0x136')](db['MailAccount'],{'foreignKey':_0xaaff('0x1cc'),'as':_0xaaff('0x1cd')});db[_0xaaff('0xd9')][_0xaaff('0x136')](db['ChatMessage'],{});db[_0xaaff('0xd9')][_0xaaff('0x136')](db[_0xaaff('0x62')],{});db[_0xaaff('0xd9')][_0xaaff('0x136')](db[_0xaaff('0x5d')],{'foreignKey':_0xaaff('0x1ce'),'as':'FromAccount'});db[_0xaaff('0xd9')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'foreignKey':'FromUserId','as':_0xaaff('0x1cf')});db[_0xaaff('0xd9')][_0xaaff('0x136')](db['User'],{'foreignKey':_0xaaff('0x1c8'),'as':_0xaaff('0x1c9')});db['ChatTransferReport'][_0xaaff('0x136')](db[_0xaaff('0x67')],{'foreignKey':'ToChatQueueId','as':_0xaaff('0x1cb')});db[_0xaaff('0xd9')][_0xaaff('0x136')](db[_0xaaff('0x5d')],{'foreignKey':'ToChatWebsiteId','as':_0xaaff('0x1cd')});db['FaxTransferReport']['belongsTo'](db[_0xaaff('0x4c')],{});db['FaxTransferReport'][_0xaaff('0x136')](db[_0xaaff('0x4b')],{});db[_0xaaff('0x1d0')][_0xaaff('0x136')](db['FaxAccount'],{'foreignKey':_0xaaff('0x1d1'),'as':_0xaaff('0x1d2')});db[_0xaaff('0x1d0')][_0xaaff('0x136')](db['User'],{'foreignKey':_0xaaff('0x1c7'),'as':_0xaaff('0x1cf')});db[_0xaaff('0x1d0')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'foreignKey':_0xaaff('0x1c8'),'as':'ToAgent'});db[_0xaaff('0x1d0')][_0xaaff('0x136')](db[_0xaaff('0x115')],{'foreignKey':_0xaaff('0x1d3'),'as':'ToQueue'});db[_0xaaff('0x1d0')][_0xaaff('0x136')](db[_0xaaff('0x48')],{'foreignKey':'ToFaxAccountId','as':_0xaaff('0x1cd')});db[_0xaaff('0xdb')]['belongsTo'](db[_0xaaff('0x5b')],{});db['OpenchannelTransferReport'][_0xaaff('0x136')](db[_0xaaff('0x59')],{});db[_0xaaff('0xdb')][_0xaaff('0x136')](db[_0xaaff('0x56')],{'foreignKey':_0xaaff('0x1d4'),'as':_0xaaff('0x1d2')});db['OpenchannelTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0xaaff('0x1cf')});db[_0xaaff('0xdb')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'foreignKey':_0xaaff('0x1c8'),'as':_0xaaff('0x1c9')});db['OpenchannelTransferReport']['belongsTo'](db[_0xaaff('0x5c')],{'foreignKey':_0xaaff('0x1d5'),'as':_0xaaff('0x1cb')});db['OpenchannelTransferReport']['belongsTo'](db[_0xaaff('0x56')],{'foreignKey':_0xaaff('0x1d6'),'as':_0xaaff('0x1cd')});db['SmsTransferReport'][_0xaaff('0x136')](db[_0xaaff('0x53')],{});db['SmsTransferReport'][_0xaaff('0x136')](db[_0xaaff('0xfc')],{});db[_0xaaff('0xdc')][_0xaaff('0x136')](db['SmsAccount'],{'foreignKey':_0xaaff('0x1d7'),'as':_0xaaff('0x1d2')});db[_0xaaff('0xdc')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'foreignKey':_0xaaff('0x1c7'),'as':'FromAgent'});db['SmsTransferReport'][_0xaaff('0x136')](db['User'],{'foreignKey':_0xaaff('0x1c8'),'as':_0xaaff('0x1c9')});db['SmsTransferReport'][_0xaaff('0x136')](db[_0xaaff('0x55')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db['SmsTransferReport'][_0xaaff('0x136')](db['SmsAccount'],{'foreignKey':_0xaaff('0x1d8'),'as':_0xaaff('0x1cd')});db[_0xaaff('0x109')][_0xaaff('0xf6')](db[_0xaaff('0x14d')],{'as':_0xaaff('0x14e'),'foreignKey':_0xaaff('0x151')});db[_0xaaff('0x109')][_0xaaff('0xf6')](db[_0xaaff('0x77')],{'as':_0xaaff('0x1d9'),'foreignKey':_0xaaff('0x151')});db['CmList'][_0xaaff('0xf6')](db['CmContact'],{'as':_0xaaff('0x107'),'onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x151')});db[_0xaaff('0x109')][_0xaaff('0xf6')](db[_0xaaff('0x73')],{'as':'HopperFinals','foreignKey':_0xaaff('0x151')});db[_0xaaff('0x109')][_0xaaff('0xf6')](db[_0xaaff('0x131')],{'as':_0xaaff('0x1da'),'foreignKey':_0xaaff('0x151')});db[_0xaaff('0x109')][_0xaaff('0xf6')](db[_0xaaff('0x76')],{'as':'ReportAgentPreview','foreignKey':_0xaaff('0x151')});db[_0xaaff('0x109')]['belongsToMany'](db[_0xaaff('0x1b')],{'as':_0xaaff('0x1db'),'through':_0xaaff('0x13e')});db['CmList'][_0xaaff('0x105')](db[_0xaaff('0xf1')],{'as':_0xaaff('0x13f'),'through':'cm_user_has_lists'});db[_0xaaff('0x1dc')][_0xaaff('0xf6')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0xaaff('0x12c')});db[_0xaaff('0x1dc')]['belongsToMany'](db['User'],{'as':_0xaaff('0x13f'),'through':_0xaaff('0x11a')});db['UserProfile'][_0xaaff('0xf6')](db[_0xaaff('0xf1')],{'as':'Users','foreignKey':'userProfileId'});db[_0xaaff('0x104')][_0xaaff('0xf6')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0xaaff('0x12c')});db['UserProfileSection'][_0xaaff('0xf6')](db[_0xaaff('0xe2')],{'as':_0xaaff('0x1dd'),'foreignKey':_0xaaff('0x1de'),'onDelete':_0xaaff('0x12c')});db[_0xaaff('0x125')][_0xaaff('0xf6')](db[_0xaaff('0x14d')],{'as':'Dispositions','foreignKey':_0xaaff('0x1df')});db[_0xaaff('0x125')][_0xaaff('0xf6')](db[_0xaaff('0x161')],{'as':'Answers','foreignKey':_0xaaff('0x1df')});db[_0xaaff('0x125')][_0xaaff('0xf6')](db[_0xaaff('0xe9')],{'as':_0xaaff('0x143'),'foreignKey':_0xaaff('0x1df')});db['WhatsappAccount'][_0xaaff('0xf6')](db['WhatsappInteraction'],{'as':_0xaaff('0x14f')});db['WhatsappAccount'][_0xaaff('0xf6')](db[_0xaaff('0xe6')],{'as':_0xaaff('0x12b')});db['WhatsappAccount'][_0xaaff('0x136')](db[_0xaaff('0x109')],{'as':'List','foreignKey':'ListId'});db['WhatsappAccount'][_0xaaff('0x136')](db[_0xaaff('0x13b')],{'as':_0xaaff('0x13c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xaaff('0x125')]['belongsToMany'](db[_0xaaff('0xf1')],{'as':_0xaaff('0x13f'),'through':_0xaaff('0x127')});db[_0xaaff('0xe6')][_0xaaff('0x136')](db['User'],{'onDelete':_0xaaff('0x15d')});db[_0xaaff('0xe6')][_0xaaff('0x136')](db['WhatsappQueue'],{'onDelete':_0xaaff('0x15d')});db[_0xaaff('0xe6')][_0xaaff('0x136')](db[_0xaaff('0x125')],{'onDelete':_0xaaff('0x15d')});db['WhatsappApplication'][_0xaaff('0x136')](db['Interval'],{'onDelete':_0xaaff('0x15d'),'foreignKey':_0xaaff('0x13a')});db[_0xaaff('0xe6')][_0xaaff('0x136')](db['Tag'],{'onDelete':_0xaaff('0x15d'),'foreignKey':'TagId'});db[_0xaaff('0xe8')][_0xaaff('0xf6')](db[_0xaaff('0xe9')],{'as':'Messages','onDelete':_0xaaff('0x12c'),'foreignKey':_0xaaff('0x1e0')});db[_0xaaff('0xe8')][_0xaaff('0x136')](db[_0xaaff('0x125')],{'as':_0xaaff('0x156'),'foreignKey':'WhatsappAccountId'});db[_0xaaff('0xe8')][_0xaaff('0x136')](db[_0xaaff('0x6f')],{'as':'Contact','foreignKey':_0xaaff('0x157')});db[_0xaaff('0xe8')][_0xaaff('0x136')](db['User'],{'as':_0xaaff('0x158'),'foreignKey':_0xaaff('0xf5')});db['WhatsappInteraction'][_0xaaff('0x105')](db['Tag'],{'through':_0xaaff('0x198'),'as':_0xaaff('0x15a')});db[_0xaaff('0xe8')][_0xaaff('0x105')](db[_0xaaff('0x86')],{'through':_0xaaff('0x198'),'as':_0xaaff('0x16d')});db[_0xaaff('0xe8')]['belongsToMany'](db[_0xaaff('0xf1')],{'as':'Users','through':_0xaaff('0x111'),'foreignKey':_0xaaff('0x1e0')});db['WhatsappMessage'][_0xaaff('0x136')](db['User'],{'as':_0xaaff('0xf1')});db[_0xaaff('0xe9')][_0xaaff('0x136')](db[_0xaaff('0x6f')],{'onDelete':_0xaaff('0x12c'),'as':_0xaaff('0x149')});db['WhatsappMessage'][_0xaaff('0x136')](db[_0xaaff('0xe8')],{'onDelete':'cascade','as':_0xaaff('0x15b'),'foreignKey':_0xaaff('0x1e0')});db['WhatsappMessage'][_0xaaff('0x136')](db[_0xaaff('0x125')],{'as':_0xaaff('0x156'),'foreignKey':_0xaaff('0x1df')});db[_0xaaff('0xea')]['belongsTo'](db[_0xaaff('0x125')],{});db[_0xaaff('0xea')]['belongsTo'](db[_0xaaff('0x109')],{'as':_0xaaff('0x15f'),'foreignKey':_0xaaff('0x151')});db[_0xaaff('0xea')][_0xaaff('0x136')](db[_0xaaff('0x6f')],{'as':_0xaaff('0x149'),'foreignKey':_0xaaff('0x157')});db[_0xaaff('0xea')][_0xaaff('0x136')](db[_0xaaff('0xe8')],{});db[_0xaaff('0xea')][_0xaaff('0x136')](db[_0xaaff('0xed')],{});db[_0xaaff('0xea')][_0xaaff('0x136')](db[_0xaaff('0xe9')],{});db['WhatsappQueueReport'][_0xaaff('0x136')](db[_0xaaff('0xf1')],{});db['WhatsappTransferReport'][_0xaaff('0x136')](db['WhatsappMessage'],{});db[_0xaaff('0xeb')]['belongsTo'](db[_0xaaff('0xe8')],{});db[_0xaaff('0xeb')]['belongsTo'](db[_0xaaff('0x125')],{'foreignKey':_0xaaff('0x1e1'),'as':'FromAccount'});db[_0xaaff('0xeb')][_0xaaff('0x136')](db[_0xaaff('0x125')],{'foreignKey':_0xaaff('0x1e2'),'as':_0xaaff('0x1cd')});db['WhatsappTransferReport'][_0xaaff('0x136')](db[_0xaaff('0xed')],{'foreignKey':'ToQueueId','as':_0xaaff('0x1cb')});db[_0xaaff('0xeb')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'foreignKey':_0xaaff('0x1c7'),'as':_0xaaff('0x1cf')});db[_0xaaff('0xeb')][_0xaaff('0x136')](db[_0xaaff('0xf1')],{'foreignKey':_0xaaff('0x1c8'),'as':_0xaaff('0x1c9')});db[_0xaaff('0xed')][_0xaaff('0x105')](db['User'],{'as':'Agents','through':_0xaaff('0x36'),'foreignKey':_0xaaff('0x1e3')});db[_0xaaff('0xed')]['belongsToMany'](db[_0xaaff('0xd1')],{'through':'team_has_whatsapp_queues','as':'Teams'});module[_0xaaff('0x1e4')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 57b4ff7..25897dd 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdda2=['./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/recordings','/api/square/messages','./api/squareMessage','./api/team','./api/license','/api/campaigns','/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/sms/reports/transfer','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','/api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','root','/www','static','join','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','tenantId','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','lodash','path','express','express-winston','util','./errors','./config/environment','./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','statusCode','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','url','responseTime','agent_id','agent_name','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/triggers','./api/trigger','/api/variables'];(function(_0x5639bc,_0x2a84a7){var _0x2d83f1=function(_0x2b3d9b){while(--_0x2b3d9b){_0x5639bc['push'](_0x5639bc['shift']());}};_0x2d83f1(++_0x2a84a7);}(_0xdda2,0xbd));var _0x2dda=function(_0x4c9d24,_0x3eb4ce){_0x4c9d24=_0x4c9d24-0x0;var _0xcb0cda=_0xdda2[_0x4c9d24];return _0xcb0cda;};'use strict';var _=require(_0x2dda('0x0'));var path=require(_0x2dda('0x1'));var express=require(_0x2dda('0x2'));var ewinston=require(_0x2dda('0x3'));var util=require(_0x2dda('0x4'));var errors=require(_0x2dda('0x5'));var config=require(_0x2dda('0x6'));var logger=require(_0x2dda('0x7'))('api');var authLogger=require(_0x2dda('0x7'))(_0x2dda('0x8'));exports[_0x2dda('0x9')]=function(_0x54af73){_0x54af73[_0x2dda('0xa')](ewinston[_0x2dda('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1bdb81,_0x3e140b){var _0x50a1e3=_0x2dda('0xc');if(!_[_0x2dda('0xd')](_0x1bdb81[_0x2dda('0xe')])){_0x50a1e3+=_0x2dda('0xf');var _0x20e478=_0x1bdb81['body'];maskSensitiveData(_0x20e478);}return util[_0x2dda('0x10')](_0x50a1e3,_0x1bdb81[_0x2dda('0x11')],_0x1bdb81[_0x2dda('0x12')][_0x2dda('0x13')]?_0x1bdb81[_0x2dda('0x12')][_0x2dda('0x13')]:_0x1bdb81['connection'][_0x2dda('0x14')]||_0x1bdb81['ip'],_0x1bdb81['url'],_0x3e140b[_0x2dda('0x15')],_0x3e140b['responseTime'],_0x1bdb81[_0x2dda('0x16')]?_0x1bdb81[_0x2dda('0x16')]['id']:null,_0x1bdb81['user']?_0x1bdb81[_0x2dda('0x16')][_0x2dda('0x17')]:null,_0x1bdb81[_0x2dda('0x16')]?_0x1bdb81[_0x2dda('0x16')][_0x2dda('0x18')]:null,_0x20e478?util[_0x2dda('0x19')](_0x20e478,![],null):'');}}));_0x54af73[_0x2dda('0xa')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xb1ce17,_0x5520f2){var _0x49a944=_0x2dda('0x1a');if(_0xb1ce17[_0x2dda('0xe')]&&_0xb1ce17['body'][_0x2dda('0x1b')]&&_0xb1ce17['body']['agent_id']){_0x49a944=_0x2dda('0x1c');}return util[_0x2dda('0x10')](_0x49a944,_0xb1ce17[_0x2dda('0x11')],_0xb1ce17[_0x2dda('0x12')][_0x2dda('0x13')]?_0xb1ce17[_0x2dda('0x12')][_0x2dda('0x13')]:_0xb1ce17[_0x2dda('0x1d')]['remoteAddress']||_0xb1ce17['ip'],_0xb1ce17[_0x2dda('0x1e')],_0x5520f2['statusCode'],_0x5520f2[_0x2dda('0x1f')],_0xb1ce17[_0x2dda('0x16')]?_0xb1ce17[_0x2dda('0x16')]['id']:null,_0xb1ce17['user']?_0xb1ce17[_0x2dda('0x16')][_0x2dda('0x17')]:null,_0xb1ce17[_0x2dda('0x16')]?_0xb1ce17['user'][_0x2dda('0x18')]:null,_0xb1ce17[_0x2dda('0xe')]&&_0xb1ce17[_0x2dda('0xe')][_0x2dda('0x1b')]?_0xb1ce17[_0x2dda('0xe')][_0x2dda('0x1b')]:'other',_0xb1ce17[_0x2dda('0xe')]&&_0xb1ce17['body'][_0x2dda('0x20')]?_0xb1ce17['body'][_0x2dda('0x20')]:'',_0xb1ce17['body']&&_0xb1ce17[_0x2dda('0xe')][_0x2dda('0x21')]?_0xb1ce17['body']['agent_name']:'');},'ignoreRoute':function(_0x468626){var _0x5d22d4=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5d22d4['test'](_0x468626[_0x2dda('0x1e')]);}}));_0x54af73[_0x2dda('0xa')](_0x2dda('0x22'),require(_0x2dda('0x23')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x24'),require('./api/voiceChanSpy'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x25'),require(_0x2dda('0x26')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x27'),require(_0x2dda('0x28')));_0x54af73['use'](_0x2dda('0x29'),require(_0x2dda('0x2a')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x2b'),require(_0x2dda('0x2c')));_0x54af73['use'](_0x2dda('0x2d'),require(_0x2dda('0x2e')));_0x54af73[_0x2dda('0xa')]('/api/screen/recordings',require(_0x2dda('0x2f')));_0x54af73['use'](_0x2dda('0x30'),require(_0x2dda('0x31')));_0x54af73['use'](_0x2dda('0x32'),require(_0x2dda('0x33')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x34'),require(_0x2dda('0x35')));_0x54af73[_0x2dda('0xa')]('/api/voice/dials/reports',require(_0x2dda('0x36')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x37'),require(_0x2dda('0x38')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x39'),require(_0x2dda('0x3a')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x3b'),require('./api/memberReport'));_0x54af73['use'](_0x2dda('0x3c'),require('./api/trunk'));_0x54af73[_0x2dda('0xa')]('/api/voice/transfers/reports',require(_0x2dda('0x3d')));_0x54af73['use'](_0x2dda('0x3e'),require(_0x2dda('0x3f')));_0x54af73['use']('/api/mail/accounts',require(_0x2dda('0x40')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x41'),require(_0x2dda('0x42')));_0x54af73[_0x2dda('0xa')]('/api/mail/substatuses',require(_0x2dda('0x43')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x44'),require(_0x2dda('0x45')));_0x54af73['use'](_0x2dda('0x46'),require('./api/mailMessage'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x47'),require(_0x2dda('0x48')));_0x54af73['use'](_0x2dda('0x49'),require(_0x2dda('0x4a')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x4b'),require(_0x2dda('0x4c')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x4d'),require(_0x2dda('0x4e')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x4f'),require(_0x2dda('0x50')));_0x54af73['use']('/api/fax/applications',require('./api/faxApplication'));_0x54af73['use'](_0x2dda('0x51'),require(_0x2dda('0x52')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x53'),require(_0x2dda('0x54')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x55'),require(_0x2dda('0x56')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x57'),require(_0x2dda('0x58')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x59'),require(_0x2dda('0x5a')));_0x54af73['use'](_0x2dda('0x5b'),require(_0x2dda('0x5c')));_0x54af73['use'](_0x2dda('0x5d'),require(_0x2dda('0x5e')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x5f'),require(_0x2dda('0x60')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x61'),require(_0x2dda('0x62')));_0x54af73[_0x2dda('0xa')]('/api/openchannel/accounts',require(_0x2dda('0x63')));_0x54af73['use'](_0x2dda('0x64'),require(_0x2dda('0x65')));_0x54af73[_0x2dda('0xa')]('/api/openchannel/interactions',require(_0x2dda('0x66')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x67'),require('./api/openchannelMessage'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x68'),require('./api/openchannelQueue'));_0x54af73['use']('/api/chat/websites',require(_0x2dda('0x69')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x6a'),require(_0x2dda('0x6b')));_0x54af73['use'](_0x2dda('0x6c'),require(_0x2dda('0x6d')));_0x54af73['use'](_0x2dda('0x6e'),require(_0x2dda('0x6f')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x70'),require('./api/chatMessage'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x71'),require(_0x2dda('0x72')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x73'),require(_0x2dda('0x74')));_0x54af73['use']('/api/chat/groups',require(_0x2dda('0x75')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x76'),require(_0x2dda('0x77')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x78'),require('./api/cmCompany'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x79'),require(_0x2dda('0x7a')));_0x54af73['use'](_0x2dda('0x7b'),require(_0x2dda('0x7c')));_0x54af73['use'](_0x2dda('0x7d'),require(_0x2dda('0x7e')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x7f'),require(_0x2dda('0x80')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x81'),require(_0x2dda('0x82')));_0x54af73['use'](_0x2dda('0x83'),require(_0x2dda('0x84')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x85'),require(_0x2dda('0x86')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x87'),require(_0x2dda('0x88')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x89'),require(_0x2dda('0x8a')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x8b'),require(_0x2dda('0x8c')));_0x54af73[_0x2dda('0xa')]('/api/conditions',require(_0x2dda('0x8d')));_0x54af73['use'](_0x2dda('0x8e'),require(_0x2dda('0x8f')));_0x54af73[_0x2dda('0xa')]('/api/pauses',require(_0x2dda('0x90')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x91'),require(_0x2dda('0x92')));_0x54af73['use'](_0x2dda('0x93'),require('./api/voiceQueuesLog'));_0x54af73['use'](_0x2dda('0x94'),require(_0x2dda('0x95')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x96'),require(_0x2dda('0x97')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x98'),require(_0x2dda('0x99')));_0x54af73[_0x2dda('0xa')]('/api/templates',require('./api/template'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x9a'),require(_0x2dda('0x9b')));_0x54af73['use'](_0x2dda('0x9c'),require(_0x2dda('0x9d')));_0x54af73['use'](_0x2dda('0x9e'),require(_0x2dda('0x9f')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xa0'),require('./api/integrationReport'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xa1'),require(_0x2dda('0xa2')));_0x54af73['use'](_0x2dda('0xa3'),require(_0x2dda('0xa4')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xa5'),require('./api/analyticExtractedReport'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xa6'),require(_0x2dda('0xa7')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xa8'),require(_0x2dda('0xa9')));_0x54af73[_0x2dda('0xa')]('/api/analytics/tree_reports',require(_0x2dda('0xaa')));_0x54af73[_0x2dda('0xa')]('/api/integrations/salesforce/accounts',require(_0x2dda('0xab')));_0x54af73['use'](_0x2dda('0xac'),require(_0x2dda('0xad')));_0x54af73['use']('/api/integrations/salesforce/fields',require(_0x2dda('0xae')));_0x54af73['use'](_0x2dda('0xaf'),require(_0x2dda('0xb0')));_0x54af73[_0x2dda('0xa')]('/api/integrations/sugarcrm/configurations',require(_0x2dda('0xb1')));_0x54af73[_0x2dda('0xa')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xb2'),require(_0x2dda('0xb3')));_0x54af73[_0x2dda('0xa')]('/api/integrations/desk/configurations',require(_0x2dda('0xb4')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xb5'),require(_0x2dda('0xb6')));_0x54af73[_0x2dda('0xa')]('/api/integrations/zoho/accounts',require(_0x2dda('0xb7')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xb8'),require(_0x2dda('0xb9')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xba'),require(_0x2dda('0xbb')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xbc'),require(_0x2dda('0xbd')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xbe'),require(_0x2dda('0xbf')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xc0'),require(_0x2dda('0xc1')));_0x54af73[_0x2dda('0xa')]('/api/integrations/freshdesk/accounts',require(_0x2dda('0xc2')));_0x54af73[_0x2dda('0xa')]('/api/integrations/freshdesk/configurations',require(_0x2dda('0xc3')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xc4'),require(_0x2dda('0xc5')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xc6'),require(_0x2dda('0xc7')));_0x54af73['use']('/api/integrations/vtiger/configurations',require(_0x2dda('0xc8')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xc9'),require(_0x2dda('0xca')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xcb'),require(_0x2dda('0xcc')));_0x54af73[_0x2dda('0xa')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x54af73['use'](_0x2dda('0xcd'),require(_0x2dda('0xce')));_0x54af73['use']('/api/integrations/dynamics365/accounts',require(_0x2dda('0xcf')));_0x54af73[_0x2dda('0xa')]('/api/integrations/dynamics365/configurations',require(_0x2dda('0xd0')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xd1'),require(_0x2dda('0xd2')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xd3'),require(_0x2dda('0xd4')));_0x54af73[_0x2dda('0xa')]('/api/integrations/freshsales/configurations',require(_0x2dda('0xd5')));_0x54af73['use'](_0x2dda('0xd6'),require(_0x2dda('0xd7')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xd8'),require(_0x2dda('0xd9')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xda'),require('./api/chatQueueReport'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xdb'),require(_0x2dda('0xdc')));_0x54af73[_0x2dda('0xa')]('/api/jscripty/answers/reports',require(_0x2dda('0xdd')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xde'),require(_0x2dda('0xdf')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xe0'),require('./api/jscriptySessionReport'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xe1'),require(_0x2dda('0xe2')));_0x54af73['use']('/api/square/reports',require(_0x2dda('0xe3')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xe4'),require('./api/squareReportDetail'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xe5'),require(_0x2dda('0xe6')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xe7'),require(_0x2dda('0xe8')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xe9'),require(_0x2dda('0xea')));_0x54af73[_0x2dda('0xa')]('/api/square/projects',require('./api/squareProject'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xeb'),require('./api/squareRecording'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xec'),require(_0x2dda('0xed')));_0x54af73[_0x2dda('0xa')]('/api/teams',require(_0x2dda('0xee')));_0x54af73[_0x2dda('0xa')]('/api/license',require(_0x2dda('0xef')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xf0'),require('./api/campaign'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xf1'),require(_0x2dda('0xf2')));_0x54af73['use'](_0x2dda('0xf3'),require(_0x2dda('0xf4')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xf5'),require(_0x2dda('0xf6')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xf7'),require(_0x2dda('0xf8')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xf9'),require(_0x2dda('0xfa')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xfb'),require(_0x2dda('0xfc')));_0x54af73[_0x2dda('0xa')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x54af73['use'](_0x2dda('0xfd'),require('./api/smsTransferReport'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xfe'),require(_0x2dda('0xff')));_0x54af73[_0x2dda('0xa')]('/api/voice/prefixes',require(_0x2dda('0x100')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x101'),require('./api/userProfile'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x102'),require(_0x2dda('0x103')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x104'),require(_0x2dda('0x105')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x106'),require(_0x2dda('0x107')));_0x54af73[_0x2dda('0xa')]('/api/whatsapp/accounts',require(_0x2dda('0x108')));_0x54af73['use'](_0x2dda('0x109'),require(_0x2dda('0x10a')));_0x54af73['use'](_0x2dda('0x10b'),require(_0x2dda('0x10c')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x10d'),require(_0x2dda('0x10e')));_0x54af73['use'](_0x2dda('0x10f'),require(_0x2dda('0x110')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x111'),require('./api/whatsappTransferReport'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x112'),require(_0x2dda('0x113')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x114'),require(_0x2dda('0x115')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x116'),require(_0x2dda('0x117')));_0x54af73['use'](_0x2dda('0x118'),require('./api/authGoogle'));_0x54af73['use'](_0x2dda('0x119'),require(_0x2dda('0x11a')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x11b'),require('./api/rpc'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x11c'),require('./api/version'));_0x54af73['use'](_0x2dda('0x11d'),require(_0x2dda('0x11e')));_0x54af73[_0x2dda('0xa')]('/api/pm2',require(_0x2dda('0x11f')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x120'),require(_0x2dda('0x121')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x122'),express['static'](path['join'](config[_0x2dda('0x123')],_0x2dda('0x122'))));_0x54af73['use'](_0x2dda('0x124'),express[_0x2dda('0x125')](path[_0x2dda('0x126')](config['root'],_0x2dda('0x124'))));_0x54af73[_0x2dda('0xa')](_0x2dda('0x127'),express[_0x2dda('0x125')](path[_0x2dda('0x126')](config[_0x2dda('0x123')],'/demo')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x128'),express[_0x2dda('0x125')](path['join'](config['root'],_0x2dda('0x129'),'3.0.0')));_0x54af73['use'](_0x2dda('0x12a'),express[_0x2dda('0x125')](path[_0x2dda('0x126')](config[_0x2dda('0x123')],_0x2dda('0x12b'))));_0x54af73[_0x2dda('0x12c')](_0x2dda('0x12d'))['get'](errors[0x194]);_0x54af73[_0x2dda('0x12c')]('/*')['get'](function(_0x1f0815,_0x557d72){_0x557d72['sendFile'](path['resolve'](_0x54af73[_0x2dda('0x12e')](_0x2dda('0x12f'))+_0x2dda('0x130')));});};var sensitiveFields=[_0x2dda('0x131'),_0x2dda('0x132'),_0x2dda('0x133'),_0x2dda('0x134'),_0x2dda('0x135'),_0x2dda('0x136'),_0x2dda('0x137'),_0x2dda('0x138'),_0x2dda('0x139'),_0x2dda('0x13a'),_0x2dda('0x13b'),_0x2dda('0x13c'),_0x2dda('0x13d'),_0x2dda('0x13e'),_0x2dda('0x13f'),'accessKey',_0x2dda('0x140'),'token','channelSecret',_0x2dda('0x141'),'accessTokenSecret',_0x2dda('0x142'),'consumerKey',_0x2dda('0x143'),_0x2dda('0x144'),_0x2dda('0x145'),'calleridnum',_0x2dda('0x146'),_0x2dda('0x147'),_0x2dda('0x148'),_0x2dda('0x149'),_0x2dda('0x14a'),_0x2dda('0x14b'),_0x2dda('0x14c'),_0x2dda('0x16'),_0x2dda('0x14d'),_0x2dda('0x14e'),_0x2dda('0x14f'),_0x2dda('0x150'),'secret',_0x2dda('0x151'),'oldPassword'];function maskSensitiveData(_0x1cbcc9){var _0x367511=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x1cbcc9))return;for(var _0x195e72 in _0x1cbcc9){if(_[_0x2dda('0x152')](_0x1cbcc9[_0x195e72])){for(var _0x32dc06=0x0;_0x32dc06<_0x1cbcc9[_0x195e72][_0x2dda('0x153')];_0x32dc06++){maskSensitiveData(_0x1cbcc9[_0x195e72][_0x32dc06]);}}else if(_[_0x2dda('0x154')](_0x1cbcc9[_0x195e72])){maskSensitiveData(_0x1cbcc9[_0x195e72]);}else if(_[_0x2dda('0x155')](_0x1cbcc9[_0x195e72])){_0x1cbcc9[_0x195e72]=_0x1cbcc9[_0x195e72][_0x2dda('0x156')](/{{{/g,_0x2dda('0x157'))[_0x2dda('0x156')](/}}}/g,_0x2dda('0x158'))[_0x2dda('0x156')](/{{/g,'@{')[_0x2dda('0x156')](/}}/g,'}@');if(_[_0x2dda('0x159')](sensitiveFields,_0x195e72)){_0x1cbcc9[_0x195e72]=_0x1cbcc9[_0x195e72]['replace'](_0x367511,'*');}}}} \ No newline at end of file +var _0x32ff=['connection','url','statusCode','responseTime','user','name','role','inspect','use','logger','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)','remoteAddress','other','agent_name','test','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','./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/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','/api/version','./api/system','/api/pm2','./api/pm2','./api/webbar','static','root','/apidoc','/www','join','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','apiKey','firstName','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerSecret','membername','calleridname','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','lodash','path','express','express-winston','util','./errors','./config/environment','api','./config/logger','auth','default','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0x32ff,0x13c));var _0xf32f=function(_0x269b48,_0x52d63a){_0x269b48=_0x269b48-0x0;var _0x55cf64=_0x32ff[_0x269b48];return _0x55cf64;};'use strict';var _=require(_0xf32f('0x0'));var path=require(_0xf32f('0x1'));var express=require(_0xf32f('0x2'));var ewinston=require(_0xf32f('0x3'));var util=require(_0xf32f('0x4'));var errors=require(_0xf32f('0x5'));var config=require(_0xf32f('0x6'));var logger=require('./config/logger')(_0xf32f('0x7'));var authLogger=require(_0xf32f('0x8'))(_0xf32f('0x9'));exports[_0xf32f('0xa')]=function(_0x1425c7){_0x1425c7['use'](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x43679f,_0x559218){var _0xdcb8e5=_0xf32f('0xb');if(!_[_0xf32f('0xc')](_0x43679f[_0xf32f('0xd')])){_0xdcb8e5+=_0xf32f('0xe');var _0x586cc0=_0x43679f[_0xf32f('0xd')];maskSensitiveData(_0x586cc0);}return util[_0xf32f('0xf')](_0xdcb8e5,_0x43679f[_0xf32f('0x10')],_0x43679f[_0xf32f('0x11')][_0xf32f('0x12')]?_0x43679f[_0xf32f('0x11')]['x-forwarded-for']:_0x43679f[_0xf32f('0x13')]['remoteAddress']||_0x43679f['ip'],_0x43679f[_0xf32f('0x14')],_0x559218[_0xf32f('0x15')],_0x559218[_0xf32f('0x16')],_0x43679f[_0xf32f('0x17')]?_0x43679f[_0xf32f('0x17')]['id']:null,_0x43679f[_0xf32f('0x17')]?_0x43679f['user'][_0xf32f('0x18')]:null,_0x43679f[_0xf32f('0x17')]?_0x43679f[_0xf32f('0x17')][_0xf32f('0x19')]:null,_0x586cc0?util[_0xf32f('0x1a')](_0x586cc0,![],null):'');}}));_0x1425c7[_0xf32f('0x1b')](ewinston[_0xf32f('0x1c')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x46d965,_0x51b65c){var _0x186e57='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x46d965['body']&&_0x46d965[_0xf32f('0xd')][_0xf32f('0x1d')]&&_0x46d965[_0xf32f('0xd')][_0xf32f('0x1e')]){_0x186e57=_0xf32f('0x1f');}return util[_0xf32f('0xf')](_0x186e57,_0x46d965[_0xf32f('0x10')],_0x46d965[_0xf32f('0x11')][_0xf32f('0x12')]?_0x46d965['headers'][_0xf32f('0x12')]:_0x46d965['connection'][_0xf32f('0x20')]||_0x46d965['ip'],_0x46d965[_0xf32f('0x14')],_0x51b65c['statusCode'],_0x51b65c['responseTime'],_0x46d965[_0xf32f('0x17')]?_0x46d965[_0xf32f('0x17')]['id']:null,_0x46d965[_0xf32f('0x17')]?_0x46d965['user'][_0xf32f('0x18')]:null,_0x46d965['user']?_0x46d965[_0xf32f('0x17')][_0xf32f('0x19')]:null,_0x46d965[_0xf32f('0xd')]&&_0x46d965[_0xf32f('0xd')][_0xf32f('0x1d')]?_0x46d965[_0xf32f('0xd')][_0xf32f('0x1d')]:_0xf32f('0x21'),_0x46d965[_0xf32f('0xd')]&&_0x46d965['body']['agent_id']?_0x46d965['body']['agent_id']:'',_0x46d965[_0xf32f('0xd')]&&_0x46d965[_0xf32f('0xd')]['agent_name']?_0x46d965[_0xf32f('0xd')][_0xf32f('0x22')]:'');},'ignoreRoute':function(_0x59ea17){var _0x58d07d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x58d07d[_0xf32f('0x23')](_0x59ea17[_0xf32f('0x14')]);}}));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x24'),require(_0xf32f('0x25')));_0x1425c7['use']('/api/voice/chanspy',require(_0xf32f('0x26')));_0x1425c7['use'](_0xf32f('0x27'),require(_0xf32f('0x28')));_0x1425c7['use']('/api/voice/extensions',require(_0xf32f('0x29')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x2a'),require('./api/voiceMusicOnHold'));_0x1425c7['use']('/api/voice/queues',require('./api/voiceQueue'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x2b'),require(_0xf32f('0x2c')));_0x1425c7[_0xf32f('0x1b')]('/api/screen/recordings',require(_0xf32f('0x2d')));_0x1425c7['use'](_0xf32f('0x2e'),require(_0xf32f('0x2f')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x30'),require(_0xf32f('0x31')));_0x1425c7['use'](_0xf32f('0x32'),require(_0xf32f('0x33')));_0x1425c7['use']('/api/voice/dials/reports',require(_0xf32f('0x34')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x35'),require('./api/voiceAgentReport'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x36'),require(_0xf32f('0x37')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x38'),require(_0xf32f('0x39')));_0x1425c7['use'](_0xf32f('0x3a'),require(_0xf32f('0x3b')));_0x1425c7[_0xf32f('0x1b')]('/api/voice/transfers/reports',require(_0xf32f('0x3c')));_0x1425c7['use']('/api/mail/out_servers',require(_0xf32f('0x3d')));_0x1425c7['use']('/api/mail/accounts',require('./api/mailAccount'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x3e'),require(_0xf32f('0x3f')));_0x1425c7['use'](_0xf32f('0x40'),require('./api/mailSubstatus'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x41'),require(_0xf32f('0x42')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x43'),require(_0xf32f('0x44')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x45'),require(_0xf32f('0x46')));_0x1425c7['use'](_0xf32f('0x47'),require('./api/mailQueueReport'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x48'),require(_0xf32f('0x49')));_0x1425c7['use'](_0xf32f('0x4a'),require(_0xf32f('0x4b')));_0x1425c7[_0xf32f('0x1b')]('/api/fax/accounts',require('./api/faxAccount'));_0x1425c7[_0xf32f('0x1b')]('/api/fax/applications',require(_0xf32f('0x4c')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x4d'),require(_0xf32f('0x4e')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x4f'),require(_0xf32f('0x50')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x51'),require('./api/faxQueue'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x52'),require('./api/faxQueueReport'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x53'),require(_0xf32f('0x54')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x55'),require(_0xf32f('0x56')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x57'),require('./api/smsInteraction'));_0x1425c7['use'](_0xf32f('0x58'),require(_0xf32f('0x59')));_0x1425c7[_0xf32f('0x1b')]('/api/sms/queues',require(_0xf32f('0x5a')));_0x1425c7['use'](_0xf32f('0x5b'),require('./api/openchannelAccount'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x5c'),require('./api/openchannelApplication'));_0x1425c7['use'](_0xf32f('0x5d'),require(_0xf32f('0x5e')));_0x1425c7['use'](_0xf32f('0x5f'),require(_0xf32f('0x60')));_0x1425c7['use'](_0xf32f('0x61'),require('./api/openchannelQueue'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x62'),require(_0xf32f('0x63')));_0x1425c7['use'](_0xf32f('0x64'),require(_0xf32f('0x65')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x66'),require(_0xf32f('0x67')));_0x1425c7[_0xf32f('0x1b')]('/api/chat/interactions',require('./api/chatInteraction'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x68'),require(_0xf32f('0x69')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x6a'),require('./api/chatOfflineMessage'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x6b'),require(_0xf32f('0x6c')));_0x1425c7[_0xf32f('0x1b')]('/api/chat/groups',require('./api/chatGroup'));_0x1425c7['use']('/api/chat/proactive_actions',require(_0xf32f('0x6d')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x6e'),require(_0xf32f('0x6f')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x70'),require(_0xf32f('0x71')));_0x1425c7['use'](_0xf32f('0x72'),require(_0xf32f('0x73')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x74'),require(_0xf32f('0x75')));_0x1425c7['use']('/api/cm/hopper_final',require(_0xf32f('0x76')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x77'),require(_0xf32f('0x78')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x79'),require('./api/cmCustomField'));_0x1425c7[_0xf32f('0x1b')]('/api/actions',require(_0xf32f('0x7a')));_0x1425c7[_0xf32f('0x1b')]('/api/automations',require(_0xf32f('0x7b')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x7c'),require(_0xf32f('0x7d')));_0x1425c7['use'](_0xf32f('0x7e'),require(_0xf32f('0x7f')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x80'),require(_0xf32f('0x81')));_0x1425c7['use'](_0xf32f('0x82'),require(_0xf32f('0x83')));_0x1425c7['use']('/api/pauses',require('./api/pause'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x84'),require(_0xf32f('0x85')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x86'),require(_0xf32f('0x87')));_0x1425c7['use'](_0xf32f('0x88'),require(_0xf32f('0x89')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x8a'),require(_0xf32f('0x8b')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x8c'),require(_0xf32f('0x8d')));_0x1425c7['use'](_0xf32f('0x8e'),require(_0xf32f('0x8f')));_0x1425c7[_0xf32f('0x1b')]('/api/triggers',require('./api/trigger'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x90'),require(_0xf32f('0x91')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x92'),require(_0xf32f('0x93')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x94'),require(_0xf32f('0x95')));_0x1425c7['use'](_0xf32f('0x96'),require(_0xf32f('0x97')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x98'),require(_0xf32f('0x99')));_0x1425c7['use']('/api/analytics/extracted_reports',require(_0xf32f('0x9a')));_0x1425c7['use'](_0xf32f('0x9b'),require(_0xf32f('0x9c')));_0x1425c7[_0xf32f('0x1b')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x9d'),require('./api/analyticTreeReport'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x9e'),require('./api/intSalesforceAccount'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x9f'),require(_0xf32f('0xa0')));_0x1425c7['use']('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xa1'),require(_0xf32f('0xa2')));_0x1425c7[_0xf32f('0x1b')]('/api/integrations/sugarcrm/configurations',require(_0xf32f('0xa3')));_0x1425c7['use'](_0xf32f('0xa4'),require(_0xf32f('0xa5')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xa6'),require('./api/intDeskAccount'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xa7'),require(_0xf32f('0xa8')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xa9'),require(_0xf32f('0xaa')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xab'),require(_0xf32f('0xac')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xad'),require(_0xf32f('0xae')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xaf'),require(_0xf32f('0xb0')));_0x1425c7[_0xf32f('0x1b')]('/api/integrations/zendesk/accounts',require(_0xf32f('0xb1')));_0x1425c7[_0xf32f('0x1b')]('/api/integrations/zendesk/configurations',require(_0xf32f('0xb2')));_0x1425c7['use'](_0xf32f('0xb3'),require(_0xf32f('0xb4')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xb5'),require('./api/intFreshdeskAccount'));_0x1425c7['use'](_0xf32f('0xb6'),require(_0xf32f('0xb7')));_0x1425c7['use'](_0xf32f('0xb8'),require(_0xf32f('0xb9')));_0x1425c7[_0xf32f('0x1b')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xba'),require(_0xf32f('0xbb')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xbc'),require(_0xf32f('0xbd')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xbe'),require(_0xf32f('0xbf')));_0x1425c7[_0xf32f('0x1b')]('/api/integrations/servicenow/configurations',require(_0xf32f('0xc0')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xc1'),require(_0xf32f('0xc2')));_0x1425c7[_0xf32f('0x1b')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xc3'),require(_0xf32f('0xc4')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xc5'),require(_0xf32f('0xc6')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xc7'),require(_0xf32f('0xc8')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xc9'),require(_0xf32f('0xca')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xcb'),require(_0xf32f('0xcc')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xcd'),require(_0xf32f('0xce')));_0x1425c7['use'](_0xf32f('0xcf'),require(_0xf32f('0xd0')));_0x1425c7['use'](_0xf32f('0xd1'),require(_0xf32f('0xd2')));_0x1425c7[_0xf32f('0x1b')]('/api/jscripty/answers/reports',require(_0xf32f('0xd3')));_0x1425c7['use'](_0xf32f('0xd4'),require(_0xf32f('0xd5')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xd6'),require(_0xf32f('0xd7')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xd8'),require(_0xf32f('0xd9')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xda'),require('./api/squareReport'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xdb'),require(_0xf32f('0xdc')));_0x1425c7['use'](_0xf32f('0xdd'),require('./api/jscriptyProject'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xde'),require(_0xf32f('0xdf')));_0x1425c7['use'](_0xf32f('0xe0'),require(_0xf32f('0xe1')));_0x1425c7[_0xf32f('0x1b')]('/api/square/projects',require(_0xf32f('0xe2')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xe3'),require('./api/squareRecording'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xe4'),require(_0xf32f('0xe5')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xe6'),require(_0xf32f('0xe7')));_0x1425c7['use'](_0xf32f('0xe8'),require('./api/license'));_0x1425c7['use'](_0xf32f('0xe9'),require('./api/campaign'));_0x1425c7[_0xf32f('0x1b')]('/api/migrations',require(_0xf32f('0xea')));_0x1425c7['use'](_0xf32f('0xeb'),require('./api/attachment'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xec'),require(_0xf32f('0xed')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xee'),require(_0xf32f('0xef')));_0x1425c7[_0xf32f('0x1b')]('/api/chat/reports/transfer',require(_0xf32f('0xf0')));_0x1425c7['use'](_0xf32f('0xf1'),require(_0xf32f('0xf2')));_0x1425c7[_0xf32f('0x1b')]('/api/openchannel/reports/transfer',require(_0xf32f('0xf3')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xf4'),require(_0xf32f('0xf5')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xf6'),require(_0xf32f('0xf7')));_0x1425c7[_0xf32f('0x1b')]('/api/voice/prefixes',require(_0xf32f('0xf8')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xf9'),require('./api/userProfile'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xfa'),require('./api/userProfileSection'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xfb'),require(_0xf32f('0xfc')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0xfd'),require(_0xf32f('0xfe')));_0x1425c7[_0xf32f('0x1b')]('/api/whatsapp/accounts',require(_0xf32f('0xff')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x100'),require('./api/whatsappApplication'));_0x1425c7['use'](_0xf32f('0x101'),require('./api/whatsappInteraction'));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x102'),require(_0xf32f('0x103')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x104'),require(_0xf32f('0x105')));_0x1425c7[_0xf32f('0x1b')]('/api/whatsapp/reports/transfer',require(_0xf32f('0x106')));_0x1425c7['use'](_0xf32f('0x107'),require('./api/whatsappQueue'));_0x1425c7['use'](_0xf32f('0x108'),require('./api/cloudProvider'));_0x1425c7['use'](_0xf32f('0x109'),require(_0xf32f('0x10a')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x10b'),require(_0xf32f('0x10c')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x10d'),require(_0xf32f('0x10e')));_0x1425c7[_0xf32f('0x1b')]('/api/rpc',require(_0xf32f('0x10f')));_0x1425c7['use'](_0xf32f('0x110'),require('./api/version'));_0x1425c7[_0xf32f('0x1b')]('/api/system',require(_0xf32f('0x111')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x112'),require(_0xf32f('0x113')));_0x1425c7['use']('/api/webbar',require(_0xf32f('0x114')));_0x1425c7[_0xf32f('0x1b')]('/apidoc',express[_0xf32f('0x115')](path['join'](config[_0xf32f('0x116')],_0xf32f('0x117'))));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x118'),express[_0xf32f('0x115')](path[_0xf32f('0x119')](config['root'],_0xf32f('0x118'))));_0x1425c7[_0xf32f('0x1b')]('/demo',express[_0xf32f('0x115')](path[_0xf32f('0x119')](config[_0xf32f('0x116')],'/demo')));_0x1425c7[_0xf32f('0x1b')](_0xf32f('0x11a'),express[_0xf32f('0x115')](path['join'](config[_0xf32f('0x116')],_0xf32f('0x11b'),_0xf32f('0x11c'))));_0x1425c7['use'](_0xf32f('0x11d'),express[_0xf32f('0x115')](path['join'](config[_0xf32f('0x116')],_0xf32f('0x11e'))));_0x1425c7['route'](_0xf32f('0x11f'))[_0xf32f('0x120')](errors[0x194]);_0x1425c7['route']('/*')[_0xf32f('0x120')](function(_0x31609c,_0x4a389a){_0x4a389a[_0xf32f('0x121')](path[_0xf32f('0x122')](_0x1425c7[_0xf32f('0x120')](_0xf32f('0x123'))+_0xf32f('0x124')));});};var sensitiveFields=[_0xf32f('0x125'),_0xf32f('0x126'),_0xf32f('0x127'),_0xf32f('0x128'),_0xf32f('0x129'),'lastName','street',_0xf32f('0x12a'),_0xf32f('0x12b'),_0xf32f('0x12c'),_0xf32f('0x12d'),_0xf32f('0x12e'),_0xf32f('0x12f'),_0xf32f('0x130'),_0xf32f('0x131'),_0xf32f('0x132'),_0xf32f('0x133'),_0xf32f('0x134'),_0xf32f('0x135'),_0xf32f('0x136'),_0xf32f('0x137'),'authToken','consumerKey',_0xf32f('0x138'),_0xf32f('0x139'),_0xf32f('0x13a'),'calleridnum','exten',_0xf32f('0x13b'),_0xf32f('0x13c'),_0xf32f('0x13d'),_0xf32f('0x13e'),_0xf32f('0x13f'),'key',_0xf32f('0x17'),_0xf32f('0x140'),_0xf32f('0x141'),_0xf32f('0x142'),_0xf32f('0x143'),_0xf32f('0x144'),_0xf32f('0x145'),_0xf32f('0x146')];function maskSensitiveData(_0x3b02a5){var _0x4c13a4=/(?!^)[\s\S](?!$)/g;if(!_[_0xf32f('0x147')](_0x3b02a5))return;for(var _0x45de9c in _0x3b02a5){if(_[_0xf32f('0x148')](_0x3b02a5[_0x45de9c])){for(var _0x1c080c=0x0;_0x1c080c<_0x3b02a5[_0x45de9c][_0xf32f('0x149')];_0x1c080c++){maskSensitiveData(_0x3b02a5[_0x45de9c][_0x1c080c]);}}else if(_[_0xf32f('0x147')](_0x3b02a5[_0x45de9c])){maskSensitiveData(_0x3b02a5[_0x45de9c]);}else if(_[_0xf32f('0x14a')](_0x3b02a5[_0x45de9c])){_0x3b02a5[_0x45de9c]=_0x3b02a5[_0x45de9c][_0xf32f('0x14b')](/{{{/g,_0xf32f('0x14c'))[_0xf32f('0x14b')](/}}}/g,_0xf32f('0x14d'))[_0xf32f('0x14b')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0xf32f('0x14e')](sensitiveFields,_0x45de9c)){_0x3b02a5[_0x45de9c]=_0x3b02a5[_0x45de9c]['replace'](_0x4c13a4,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 86a91c3..d44185a 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaceb=['../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.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'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0xaceb,0x190));var _0xbace=function(_0x4b6800,_0x315e58){_0x4b6800=_0x4b6800-0x0;var _0x48f4cb=_0xaceb[_0x4b6800];return _0x48f4cb;};'use strict';var jayson=require(_0xbace('0x0'));var BPromise=require(_0xbace('0x1'));var _=require('lodash');var config=require('../config/environment');exports[_0xbace('0x2')]=function(){return new BPromise(function(_0x33ef95,_0x598c1d){var _0x29356a={};_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x4')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x5')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x6')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/voiceRecording/voiceRecording.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x7')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x8')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x9')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0xa')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0xb')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0xc')));_0x29356a=_['merge'](_0x29356a,require('../api/mailServerIn/mailServerIn.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0xd')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0xe')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0xf')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x10')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/mailApplication/mailApplication.rpc'));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x11')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x12')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x13')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/faxInteraction/faxInteraction.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x14')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x15')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x16')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x17')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/smsInteraction/smsInteraction.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x18')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/smsQueue/smsQueue.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x19')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x1a')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x1b')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x1c')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x1d')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x1e')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x1f')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x20')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/cmContact/cmContact.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x21')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x22')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x23')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x24')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x25')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x26')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/sound/sound.rpc'));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x27')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x28')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x29')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x2a')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x2b')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x2c')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x2d')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x2e')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x2f')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x30')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x31')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x32')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x33')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x34')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x35')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x36')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x37')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x38')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x39')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x3a')));_0x29356a=_['merge'](_0x29356a,require('../api/attachment/attachment.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x3b')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x3c')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x3d')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x3e')));var _0x1bbcfe=jayson[_0xbace('0x3f')](_0x29356a)[_0xbace('0x40')]();var _0x1e5ed4=config[_0xbace('0x41')]['port']||config['port']+0x1;var _0x3fcadf=config[_0xbace('0x41')]['ip']||_0xbace('0x42');_0x1bbcfe['on'](_0xbace('0x43'),function(_0xb2d197){return _0x598c1d(_0xb2d197);});_0x1bbcfe[_0xbace('0x2')](_0x1e5ed4,_0x3fcadf,function(){console[_0xbace('0x44')](_0xbace('0x45'),_0x3fcadf,_0x1e5ed4);require(_0xbace('0x46'))['default']();return _0x33ef95(_0xbace('0x47')+_0x3fcadf+':'+_0x1e5ed4);});});}; \ No newline at end of file +var _0x6e30=['../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.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/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc'];(function(_0x53fd59,_0x401c05){var _0x450ab9=function(_0x51f899){while(--_0x51f899){_0x53fd59['push'](_0x53fd59['shift']());}};_0x450ab9(++_0x401c05);}(_0x6e30,0x1c3));var _0x06e3=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x6e30[_0x67f95e];return _0x538f5a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x06e3('0x0'));var _=require(_0x06e3('0x1'));var config=require(_0x06e3('0x2'));exports[_0x06e3('0x3')]=function(){return new BPromise(function(_0x5df1a8,_0x2b3f3e){var _0x4dfd0c={};_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x5')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require('../api/voiceExtension/voiceExtension.rpc'));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x6')));_0x4dfd0c=_['merge'](_0x4dfd0c,require('../api/voiceRecording/voiceRecording.rpc'));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x7')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x8')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x9')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0xa')));_0x4dfd0c=_['merge'](_0x4dfd0c,require(_0x06e3('0xb')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require('../api/trunk/trunk.rpc'));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0xc')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0xd')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0xe')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0xf')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x10')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x11')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require('../api/mailMessage/mailMessage.rpc'));_0x4dfd0c=_['merge'](_0x4dfd0c,require(_0x06e3('0x12')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x13')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x14')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x15')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require('../api/faxInteraction/faxInteraction.rpc'));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x16')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x17')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x18')));_0x4dfd0c=_['merge'](_0x4dfd0c,require(_0x06e3('0x19')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require('../api/smsInteraction/smsInteraction.rpc'));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x1a')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x1b')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x1c')));_0x4dfd0c=_['merge'](_0x4dfd0c,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x1d')));_0x4dfd0c=_['merge'](_0x4dfd0c,require('../api/chatInteraction/chatInteraction.rpc'));_0x4dfd0c=_['merge'](_0x4dfd0c,require(_0x06e3('0x1e')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require('../api/chatQueue/chatQueue.rpc'));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x1f')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x20')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x21')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x22')));_0x4dfd0c=_['merge'](_0x4dfd0c,require(_0x06e3('0x23')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x24')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x25')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x26')));_0x4dfd0c=_['merge'](_0x4dfd0c,require(_0x06e3('0x27')));_0x4dfd0c=_['merge'](_0x4dfd0c,require(_0x06e3('0x28')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x29')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x2a')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x2b')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x2c')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x2d')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x2e')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x2f')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x30')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x31')));_0x4dfd0c=_['merge'](_0x4dfd0c,require(_0x06e3('0x32')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x33')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x34')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x35')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x36')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x37')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x38')));_0x4dfd0c=_['merge'](_0x4dfd0c,require(_0x06e3('0x39')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x3a')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require('../api/campaign/campaign.rpc'));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x3b')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x3c')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x4dfd0c=_['merge'](_0x4dfd0c,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4dfd0c=_['merge'](_0x4dfd0c,require(_0x06e3('0x3d')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x3e')));_0x4dfd0c=_[_0x06e3('0x4')](_0x4dfd0c,require(_0x06e3('0x3f')));var _0x3c230a=jayson[_0x06e3('0x40')](_0x4dfd0c)['http']();var _0x2f0e9e=config[_0x06e3('0x41')][_0x06e3('0x42')]||config[_0x06e3('0x42')]+0x1;var _0x632d28=config['rpc']['ip']||_0x06e3('0x43');_0x3c230a['on']('error',function(_0x5dbc84){return _0x2b3f3e(_0x5dbc84);});_0x3c230a[_0x06e3('0x3')](_0x2f0e9e,_0x632d28,function(){console[_0x06e3('0x44')](_0x06e3('0x45'),_0x632d28,_0x2f0e9e);require('../config/triggers')[_0x06e3('0x46')]();return _0x5df1a8(_0x06e3('0x47')+_0x632d28+':'+_0x2f0e9e);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 7ec9b61..7c51aea 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 _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call'];(function(_0x38877e,_0x2bf44c){var _0x4ed8f0=function(_0x4c4eb1){while(--_0x4c4eb1){_0x38877e['push'](_0x38877e['shift']());}};_0x4ed8f0(++_0x2bf44c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file +var _0xedd9=['getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','sendRequest','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xedd9,0xfc));var _0x9edd=function(_0x3b2b59,_0x23f009){_0x3b2b59=_0x3b2b59-0x0;var _0x1ecf1e=_0xedd9[_0x3b2b59];return _0x1ecf1e;};'use strict';var util=require('util');var _=require(_0x9edd('0x0'));var EventEmitter=require(_0x9edd('0x1'))[_0x9edd('0x2')];var AGIReply=require(_0x9edd('0x3'));var AGIError=require(_0x9edd('0x4'));function AGIChannel(_0x127cbe){var _0x3e6d3a=this,_0x36b53f=new AGIReply(),_0x5943b3=![],_0x33679f={};EventEmitter[_0x9edd('0x5')](_0x3e6d3a);_0x127cbe[_0x9edd('0x6')](_0x9edd('0x7'));_0x127cbe['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x36b53f[_0x9edd('0x6')]('utf8');_0x36b53f['on'](_0x9edd('0x8'),function(_0x190185){for(var _0x1355be in _0x190185){_0x3e6d3a[_0x1355be]=_0x190185[_0x1355be];}_0x3e6d3a[_0x9edd('0x9')]('ready');});_0x36b53f['on'](_0x9edd('0xa'),function(_0x5d2f90){if(_0x5d2f90[_0x9edd('0xb')]()==_0x9edd('0xc')){_0x3e6d3a['emit'](_0x9edd('0xc'));return;}if(_0x5d2f90[_0x9edd('0xd')](0x0,0xb)=='520-Invalid'){_0x5943b3=!![];}if(_0x5943b3){_0x33679f['rx']+=_0x5d2f90+'\x0a';if(_0x5d2f90[_0x9edd('0xe')](_0x9edd('0xf'))!=-0x1){_0x5943b3=![];}}else{_0x33679f['rx']=_0x5d2f90;}if(_0x5943b3){return;}if(typeof _0x33679f['cb']==_0x9edd('0x10')){var _0xfd544a=_0x33679f['rx'][_0x9edd('0xd')](0x0,0x3),_0x287ddd=null,_0x3a7b84=null;_0xfd544a=parseInt(_0xfd544a);if(isNaN(_0xfd544a)){_0x33679f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9edd('0x11')});return;}if(_0xfd544a!=0xc8){_0x33679f['cb'](null,{'code':_0xfd544a,'result':-0x1,'extra':'KO'});return;}_0x287ddd=_0x33679f['rx']['substring'](0x4)[_0x9edd('0x12')](_0x9edd('0x13'),'');if(_0x287ddd[_0x9edd('0x14')]('\x20')!=-0x1){_0x287ddd=_0x287ddd[_0x9edd('0x15')](0x0,_0x287ddd[_0x9edd('0x14')]('\x20'));}if(_[_0x9edd('0x16')](_0x287ddd,'-1')){_0x287ddd=parseInt(_0x287ddd);}_0x3a7b84=_0x33679f['rx'][_0x9edd('0x17')]('\x20');if(_0x3a7b84[_0x9edd('0x18')]==0x3){_0x3a7b84=_0x3a7b84[0x2]['substring'](0x1,_0x3a7b84[0x2][_0x9edd('0x18')]-0x1);}else if(_0x3a7b84[_0x9edd('0x18')]>0x3){var _0x449cee=/\((.+)\)/;var _0x5acf65=_0x33679f['rx'][_0x9edd('0x19')](_0x449cee);if(_0x5acf65){_0x3a7b84=_0x5acf65[0x1];}else{_0x3a7b84=null;}}else{_0x3a7b84=null;}_0x33679f['cb'](null,{'code':_0xfd544a,'result':_0x287ddd,'extra':_0x3a7b84});}});_0x127cbe['on'](_0x9edd('0x1a'),function(_0x40ba32){_0x3e6d3a['emit'](_0x9edd('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x40ba32[_0x9edd('0x1b')]));});_0x127cbe['on'](_0x9edd('0x1c'),function(){_0x3e6d3a['emit']('close',new AGIError(_0x9edd('0x1d')));});_0x127cbe['on']('timeout',function(){_0x3e6d3a[_0x9edd('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x127cbe[_0x9edd('0x1e')]();});_0x127cbe[_0x9edd('0x1f')](_0x36b53f);this['command']=function(_0x5823bc,_0x341d67){var _0x5823bc=_0x5823bc||'',_0x341d67=typeof _0x341d67=='function'?_0x341d67:new Function();_0x33679f={'tx':_0x5823bc,'rx':'','cb':_0x341d67};_0x127cbe[_0x9edd('0x20')](_0x5823bc+'\x0a');},this[_0x9edd('0x1c')]=function(){_0x127cbe[_0x9edd('0x1e')]();};}util[_0x9edd('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x9edd('0x22')]['sendRequest']=function(_0x46c383){return this[_0x9edd('0x23')][_0x9edd('0x24')](this,_0x46c383);};AGIChannel[_0x9edd('0x22')][_0x9edd('0x25')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x9edd('0x22')][_0x9edd('0x26')]=function(_0x8d67aa,_0x25e135,_0x3c2227){_0x8d67aa=_0x8d67aa===undefined?'beep':_0x8d67aa;_0x25e135=_0x25e135===undefined?'5':_0x25e135;_0x3c2227=_0x3c2227===undefined?'1':_0x3c2227;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x28'),_0x8d67aa,_0x25e135*0x3e8,_0x3c2227));};AGIChannel[_0x9edd('0x22')]['noop']=function(_0x238b22){_0x238b22=_0x238b22||_0x9edd('0x29');return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('VERBOSE\x20\x22%s\x22',_0x238b22));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2b')]=function(_0xbe87e1,_0x12c1bc){if(_[_0x9edd('0x2c')](_0x12c1bc)){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc[_0x9edd('0x2e')](',')));}return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2f')]=function(_0x1a6c23){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x30'),_0x1a6c23));};AGIChannel[_0x9edd('0x22')]['setExtension']=function(_0x2d2f88){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x31'),_0x2d2f88));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x32')]=function(_0x473068){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x33'),_0x473068));};AGIChannel[_0x9edd('0x22')][_0x9edd('0xc')]=function(){return this[_0x9edd('0x2a')](_0x9edd('0x34'));};AGIChannel['prototype'][_0x9edd('0x35')]=function(_0x5ed62d,_0x968303){var _0x148630=_[_0x9edd('0x36')](_0x968303)||_[_0x9edd('0x37')](_0x968303)?_0x968303[_0x9edd('0x38')]():_0x968303;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x39'),_0x5ed62d,_0x148630?_0x148630[_0x9edd('0x38')]()[_0x9edd('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3a')]=function(_0x5c0627,_0x1cbbac){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x5c0627,_0x1cbbac));};AGIChannel[_0x9edd('0x22')]['sayDigits']=function(_0x3ef1d5,_0x5658d6){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x3b'),_0x3ef1d5,_0x5658d6));};AGIChannel['prototype'][_0x9edd('0x3c')]=function(_0xcbd0ef,_0x2f8f61){return this['sendRequest'](util[_0x9edd('0x27')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xcbd0ef,_0x2f8f61));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3d')]=function(_0x50be2c,_0x315f52,_0x40fdfb){_0x315f52=_0x315f52||this[_0x9edd('0x3e')];_0x40fdfb=_0x40fdfb||0x1;this[_0x9edd('0x2f')](_0x50be2c);this['setExtension'](_0x315f52);this[_0x9edd('0x32')](_0x40fdfb);return this['noop'](util[_0x9edd('0x27')](_0x9edd('0x3f'),_0x50be2c,_0x315f52,_0x40fdfb));};AGIChannel['prototype'][_0x9edd('0x40')]=function(_0x49a128){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x41'),_0x49a128));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x42')]=function(_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x18c149,_0x2b081a){_0x4737ae=_0x4737ae||_0x9edd('0x43');_0x3ff512=_0x3ff512||'';_0x75efbe=_0x75efbe===undefined?-0x1:_0x75efbe==='-1'?-0x1:_0x75efbe*0x3e8;_0x18c149=_0x18c149===undefined?'':'s='+_0x18c149;_0x2b081a=_0x2b081a?_0x9edd('0x44'):'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x45'),_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x2b081a,_0x18c149));};AGIChannel['prototype'][_0x9edd('0x46')]=function(_0x2570e3,_0x2231c1){_0x2231c1=_0x2231c1||'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x47'),_0x2570e3,_0x2231c1));};AGIChannel[_0x9edd('0x22')]['agi']=function(_0x4a4656){return this['exec'](_0x9edd('0x48'),_0x4a4656);};AGIChannel['prototype'][_0x9edd('0x49')]=function(_0x19b56b){return this[_0x9edd('0x2b')](_0x9edd('0x4a'),_0x19b56b);};AGIChannel[_0x9edd('0x22')]['error']=function(_0x387fb8,_0x35e63c){this[_0x9edd('0x4b')](util['format'](_0x9edd('0x4c'),_0x387fb8['id'],_0x387fb8[_0x9edd('0x4d')],_0x35e63c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9edd('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 4b1db74..ff24375 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 _0x2367=['exports','util','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\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name'];(function(_0x210720,_0x3bebf1){var _0x2309b9=function(_0x3b3e1c){while(--_0x3b3e1c){_0x210720['push'](_0x210720['shift']());}};_0x2309b9(++_0x3bebf1);}(_0x2367,0x7f));var _0x7236=function(_0x7c572,_0x4f740e){_0x7c572=_0x7c572-0x0;var _0x1186d2=_0x2367[_0x7c572];return _0x1186d2;};'use strict';var util=require(_0x7236('0x0'));var error={'E_AGI_UNDEFINED':_0x7236('0x1'),'E_AGI_ARGUMENT_PORT':_0x7236('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x7236('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x7236('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x7236('0x5'),'E_AGI_SOCKET_ERROR':_0x7236('0x6'),'E_AGI_SOCKET_CLOSE':_0x7236('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x7236('0x8'),'E_AGI_COMMAND_EMPTY':_0x7236('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7236('0xa'),'E_AGI_IVR_ENTRY':_0x7236('0xb')};function AGIError(_0x3189ac){var _0x3189ac=_0x3189ac||null,_0xe5f0b3=_0xe5f0b3||[],_0x8322ed=0x1,_0x2cfc6a='';if(!error[_0x3189ac]){_0x3189ac=_0x7236('0xc');}_0xe5f0b3[_0x7236('0xd')](error[_0x3189ac]);while(arguments[_0x8322ed]){_0xe5f0b3[_0x7236('0xd')](arguments[_0x8322ed]);_0x8322ed++;}_0x2cfc6a=util['format'][_0x7236('0xe')](util,_0xe5f0b3);this[_0x7236('0xf')]=_0x2cfc6a;this[_0x7236('0x10')]=_0x3189ac;}module[_0x7236('0x11')]=AGIError; \ No newline at end of file +var _0x31c2=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x32bc5d,_0x7ad417){var _0x1450ca=function(_0x4dc276){while(--_0x4dc276){_0x32bc5d['push'](_0x32bc5d['shift']());}};_0x1450ca(++_0x7ad417);}(_0x31c2,0x98));var _0x231c=function(_0x190b73,_0x3f95b7){_0x190b73=_0x190b73-0x0;var _0xc71b27=_0x31c2[_0x190b73];return _0xc71b27;};'use strict';var util=require(_0x231c('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x231c('0x1'),'E_AGI_SERVER_CLOSE':_0x231c('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x231c('0x3'),'E_AGI_SOCKET_ERROR':_0x231c('0x4'),'E_AGI_SOCKET_CLOSE':_0x231c('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x231c('0x6'),'E_AGI_COMMAND_EMPTY':_0x231c('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x231c('0x8'),'E_AGI_IVR_ENTRY':_0x231c('0x9')};function AGIError(_0x4442b9){var _0x4442b9=_0x4442b9||null,_0x1e3997=_0x1e3997||[],_0x4fd8b8=0x1,_0x3dfccb='';if(!error[_0x4442b9]){_0x4442b9=_0x231c('0xa');}_0x1e3997[_0x231c('0xb')](error[_0x4442b9]);while(arguments[_0x4fd8b8]){_0x1e3997[_0x231c('0xb')](arguments[_0x4fd8b8]);_0x4fd8b8++;}_0x3dfccb=util['format'][_0x231c('0xc')](util,_0x1e3997);this[_0x231c('0xd')]=_0x3dfccb;this[_0x231c('0xe')]=_0x4442b9;}module[_0x231c('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 6241bef..f1efc50 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 _0x407f=['push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','exports','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge'];(function(_0x240a29,_0x2e281c){var _0x67dac5=function(_0x558f32){while(--_0x558f32){_0x240a29['push'](_0x240a29['shift']());}};_0x67dac5(++_0x2e281c);}(_0x407f,0xc2));var _0xf407=function(_0x28c5ed,_0x1d47d3){_0x28c5ed=_0x28c5ed-0x0;var _0x412eea=_0x407f[_0x28c5ed];return _0x412eea;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')('agi');var verticesWithRetry=[_0xf407('0x0'),_0xf407('0x1'),_0xf407('0x2')];var Graph=function(){this[_0xf407('0x3')]={};this[_0xf407('0x4')]={};this[_0xf407('0x5')]=0x0;};Graph[_0xf407('0x6')][_0xf407('0x7')]=function(_0x14df0c){this[_0xf407('0x3')][_0x14df0c['id']]=_0x14df0c;this[_0xf407('0x4')][_0x14df0c['id']]=[];};Graph[_0xf407('0x6')][_0xf407('0x8')]=function(_0x3ac774,_0x38ee37,_0x3ab539){this['edges'][_0x3ac774][_0xf407('0x9')]({'target':_0x38ee37,'condition':_0x3ab539});this[_0xf407('0x5')]+=0x1;};Graph[_0xf407('0x6')][_0xf407('0xa')]=function(){return _['size'](this['vertices']);};Graph['prototype'][_0xf407('0xb')]=function(){return this[_0xf407('0x5')];};Graph[_0xf407('0x6')][_0xf407('0xc')]=function(_0x261ac2){return this['vertices'][_0x261ac2];};Graph[_0xf407('0x6')][_0xf407('0xd')]=function(_0x3b26ae,_0x12e1fc){if(!this[_0xf407('0x3')][_0x3b26ae]){return logger[_0xf407('0xe')](_0xf407('0xf'));}var _0x5257ef=_0x12e1fc(this['vertices'][_0x3b26ae]);if(!_0x5257ef){return logger['info'](_0xf407('0x10'));}if(this['edges'][_0x3b26ae][_0xf407('0x11')]===0x0){return logger['info']('no\x20edge/s\x20available');}for(var _0x768926=0x0,_0x331782=[],_0x1cdc81=![];_0x768926\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','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','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','syncho','util','moment','../../config/logger','agi','../../config/license/util','./mailRpc','./graph','defaults','127.0.0.1','nextTick','error','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','evtHangup','toJson','mxGraphModel','root','agicommand','retry','addVertex','omit','mxCell','hasOwnProperty','length','source','target','addEdge','value','getSquareProject','catch','createSquareReport','then','substring','inspect','debug'];(function(_0x5d5177,_0x24d3c8){var _0x195c11=function(_0x5e4f32){while(--_0x5e4f32){_0x5d5177['push'](_0x5d5177['shift']());}};_0x195c11(++_0x24d3c8);}(_0x4b19,0x195));var _0x94b1=function(_0x52e7f5,_0x54a808){_0x52e7f5=_0x52e7f5-0x0;var _0x27014b=_0x4b19[_0x52e7f5];return _0x27014b;};'use strict';var parser=require(_0x94b1('0x0'));var _=require('lodash');var syncho=require(_0x94b1('0x1'));var util=require(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var config=require('../../config/environment');var logger=require(_0x94b1('0x4'))(_0x94b1('0x5'));var utilLicense=require(_0x94b1('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x94b1('0x7'));var Graph=require(_0x94b1('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x94b1('0x5')]=_[_0x94b1('0x9')](config['agi'],{'ip':_0x94b1('0xa'),'port':0x11dd});function connectionHandler(_0x201a02){process[_0x94b1('0xb')](function(){syncho(function(){try{setChannelVariables(_0x201a02);agiHandler(_0x201a02);}catch(_0x5aee5f){logger[_0x94b1('0xc')](_0x5aee5f['stack']);}});});}function listeningHandler(){console['log'](_0x94b1('0xd'),config[_0x94b1('0x5')][_0x94b1('0xe')]);logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x11'),config['agi']['ip'],config[_0x94b1('0x5')][_0x94b1('0xe')]));}function errorHandler(_0x340a29){if(_0x340a29&&_0x340a29[_0x94b1('0x12')]&&_0x340a29['message']){logger['error'](util[_0x94b1('0x10')](_0x94b1('0x13'),_0x340a29['name'],_0x340a29['message']));}else{logger[_0x94b1('0xc')](util[_0x94b1('0x10')]('[ERROR]\x20%s',_0x340a29[_0x94b1('0x14')]));}}function closeHandler(){logger['info'](util['format'](_0x94b1('0x15'),this[_0x94b1('0x16')],this[_0x94b1('0x17')],this[_0x94b1('0x18')],this['dnid'],this[_0x94b1('0x19')]));try{createSquareReport(this);}catch(_0x424c45){logger[_0x94b1('0xc')](_0x424c45[_0x94b1('0x14')]);}}function timeoutHandler(){logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x1a'),this['arg_1'],this[_0x94b1('0x17')],this[_0x94b1('0x18')],this[_0x94b1('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x94b1('0xf')](util[_0x94b1('0x10')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x94b1('0x16')],this[_0x94b1('0x17')],this[_0x94b1('0x18')],this[_0x94b1('0x1b')],this[_0x94b1('0x19')]));this[_0x94b1('0x1c')]=!![];}function getRoot(_0x36180a){return parser[_0x94b1('0x1d')](_0x36180a,{'object':!![]})[_0x94b1('0x1e')][_0x94b1('0x1f')];}function addVertex(_0x49c248,_0xa333a8,_0xa112b1){_0xa333a8[_0x94b1('0x20')]=_0xa112b1;if(_0xa333a8['hasOwnProperty'](_0x94b1('0x21'))){_0xa333a8['maxRetry']=parseInt(_0xa333a8[_0x94b1('0x21')],0xa);}_0x49c248[_0x94b1('0x22')](_[_0x94b1('0x23')](_0xa333a8,_0x94b1('0x24')));}function initGraph(_0x5ad3e4,_0x4ea6d9){var _0x1d6ea6=new Graph();for(var _0x4d5685 in _0x5ad3e4){if(_0x5ad3e4[_0x94b1('0x25')](_0x4d5685)){if(_['isArray'](_0x5ad3e4[_0x4d5685])){for(var _0x4694de=0x0;_0x4694de<_0x5ad3e4[_0x4d5685][_0x94b1('0x26')];_0x4694de+=0x1){addVertex(_0x1d6ea6,_0x5ad3e4[_0x4d5685][_0x4694de],_0x4d5685);}}else{addVertex(_0x1d6ea6,_0x5ad3e4[_0x4d5685],_0x4d5685);}}}for(var _0x1eda8c=0x0;_0x1eda8c<_0x4ea6d9['length'];_0x1eda8c+=0x1){if(_0x4ea6d9[_0x1eda8c][_0x94b1('0x27')]&&_0x4ea6d9[_0x1eda8c][_0x94b1('0x28')]){_0x1d6ea6[_0x94b1('0x29')](_0x4ea6d9[_0x1eda8c][_0x94b1('0x27')],_0x4ea6d9[_0x1eda8c][_0x94b1('0x28')],_0x4ea6d9[_0x1eda8c][_0x94b1('0x2a')]);}}return _0x1d6ea6;}function getSquareProject(_0x2661ca,_0xcd778f){rpc[_0x94b1('0x2b')](_0x2661ca)['then'](function(_0x2eb1fa){_0xcd778f(null,_0x2eb1fa);})[_0x94b1('0x2c')](function(_0x47f019){_0xcd778f(null,_0x47f019);});}function createSquareReport(_0x42630a,_0x1fe766){rpc[_0x94b1('0x2d')](_0x42630a)[_0x94b1('0x2e')](function(_0x28dc1d){if(_0x1fe766){_0x1fe766(null,_0x28dc1d);}})[_0x94b1('0x2c')](function(_0x5a5148){if(_0x1fe766){_0x1fe766(null,_0x5a5148);}});}function setChannelVariables(_0x1a26eb){for(var _0x5d765b in _0x1a26eb){if(_0x1a26eb[_0x94b1('0x25')](_0x5d765b)){if(_0x5d765b['indexOf']('agi_')===0x0){_0x1a26eb[_0x5d765b[_0x94b1('0x2f')](0x4)]=_0x1a26eb[_0x5d765b];delete _0x1a26eb[_0x5d765b];}}}}function getLogFromObject(_0x171d44){return util[_0x94b1('0x30')](_0x171d44,{'showHidden':![],'depth':null});}function agiHandler(_0x44e595){var _0x35b97c,_0x195514,_0x26f33d,_0x19511b,_0x288ae5;logger[_0x94b1('0x31')](_0x94b1('0x32'),JSON[_0x94b1('0x33')](_0x44e595,null,0x2));logger['info'](util['format'](_0x94b1('0x34'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595[_0x94b1('0x19')]));_0x44e595['on'](_0x94b1('0xc'),errorHandler);_0x44e595['on'](_0x94b1('0x35'),closeHandler);_0x44e595['on'](_0x94b1('0x36'),timeoutHandler);_0x44e595['evtHangup']=![];_0x44e595['on'](_0x94b1('0x37'),hangupHandler);var _0x4d18e8=getSquareProject[_0x94b1('0x38')](null,_0x44e595[_0x94b1('0x16')]);if(_0x4d18e8){if(_0x4d18e8[_0x94b1('0x39')]){_0x35b97c=getRoot(_0x4d18e8['production']);if(_0x35b97c&&_0x35b97c[_0x94b1('0x3a')]){logger[_0x94b1('0x31')](_0x94b1('0x1f'),JSON['stringify'](_0x35b97c,null,0x2));_0x44e595[_0x94b1('0x3b')]=moment()[_0x94b1('0x10')](_0x94b1('0x3c'));_0x195514=initGraph(_[_0x94b1('0x23')](_0x35b97c,_0x94b1('0x24')),_0x35b97c[_0x94b1('0x24')]);_0x26f33d=new Vertices(_0x44e595,rpc,mailRpc);logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x3d'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595['uniqueid']));_0x195514[_0x94b1('0x3e')](_0x35b97c[_0x94b1('0x3a')]['id'],function(_0xf29a10){try{_0xf29a10=_0x26f33d[_0x94b1('0x3f')](_0xf29a10);logger[_0x94b1('0x31')]('vertex',JSON[_0x94b1('0x33')](_0xf29a10,null,0x2));if(_0xf29a10[_0x94b1('0x20')]===_0x94b1('0x40')){logger[_0x94b1('0xf')](_0x94b1('0x41'));_0x44e595[_0x94b1('0x42')]=_0xf29a10['context']||_0x44e595[_0x94b1('0x42')];_0x44e595[_0x94b1('0x43')]=_0xf29a10['extension'];_0x44e595[_0x94b1('0x44')]=_0xf29a10[_0x94b1('0x44')]?_0xf29a10['priority']-0x1:0x1;return null;}else if(_0xf29a10&&_0x26f33d[_0xf29a10[_0x94b1('0x20')]]){_0x288ae5=_0x26f33d[_0xf29a10[_0x94b1('0x20')]](_0xf29a10);logger[_0x94b1('0xf')]('response',JSON[_0x94b1('0x33')](_0x288ae5,null,0x2));if(_0x288ae5&&_0x288ae5[_0x94b1('0x45')]===AGI_CODE_SUCCESS&&_0x288ae5[_0x94b1('0x46')]!==AGI_RESULT_ERROR&&!_0x44e595[_0x94b1('0x1c')]){logger[_0x94b1('0x31')](_0x94b1('0x47'),getLogFromObject(_0x288ae5));return _[_0x94b1('0x48')](_0x288ae5['result'])?null:_0x288ae5[_0x94b1('0x46')][_0x94b1('0x49')]();}else{logger[_0x94b1('0xc')]('response',getLogFromObject(_0x288ae5));return null;}}else{logger[_0x94b1('0xc')](_0x94b1('0x4a'));return null;}}catch(_0x5323c2){logger[_0x94b1('0xc')](_0x5323c2[_0x94b1('0x14')]);return null;}});if(_0x35b97c[_0x94b1('0x4b')]){logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x4c'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595[_0x94b1('0x19')]));_0x195514[_0x94b1('0x3e')](_0x35b97c[_0x94b1('0x4b')]['id'],function(_0x7753ff){try{_0x7753ff=_0x26f33d[_0x94b1('0x3f')](_0x7753ff);logger[_0x94b1('0x31')](_0x94b1('0x4d'),JSON[_0x94b1('0x33')](_0x7753ff,null,0x2));if(_0x7753ff&&_0x26f33d[_0x7753ff[_0x94b1('0x20')]]){_0x288ae5=_0x26f33d[_0x7753ff['agicommand']](_0x7753ff);if(_0x288ae5){logger[_0x94b1('0x31')]('response',getLogFromObject(_0x288ae5));return _[_0x94b1('0x48')](_0x288ae5[_0x94b1('0x46')])?null:_0x288ae5[_0x94b1('0x46')]['toString']();}else{logger['error']('response',getLogFromObject(_0x288ae5));return null;}}else{logger[_0x94b1('0xc')](_0x94b1('0x4a'));return null;}}catch(_0x276ab1){logger['error'](_0x276ab1['stack']);return null;}});}logger['info'](util[_0x94b1('0x10')](_0x94b1('0x4e'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595[_0x94b1('0x19')]));logger['info'](util[_0x94b1('0x10')](_0x94b1('0x4f'),_0x44e595[_0x94b1('0x42')],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1));_0x44e595[_0x94b1('0x50')](_0x44e595[_0x94b1('0x42')],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1);_0x44e595[_0x94b1('0x35')]();}}else{logger[_0x94b1('0xc')](util[_0x94b1('0x10')](_0x94b1('0x51'),_0x44e595[_0x94b1('0x16')]));_0x44e595['continueAt'](_0x44e595[_0x94b1('0x42')],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1);_0x44e595[_0x94b1('0x35')]();}}else{logger[_0x94b1('0xc')](util[_0x94b1('0x10')](_0x94b1('0x52'),_0x44e595[_0x94b1('0x16')]));_0x44e595[_0x94b1('0x50')](_0x44e595['context'],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1);_0x44e595[_0x94b1('0x35')]();}}function main(){var _0x29ccc4;return utilLicense[_0x94b1('0x53')]()[_0x94b1('0x2e')](function(_0x572657){if(_0x572657){if(_0x572657[_0x94b1('0x54')]){if(_0x572657[_0x94b1('0x55')]&&_0x572657[_0x94b1('0x55')]>0x0){logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x56'),_0x572657[_0x94b1('0x55')]));_0x29ccc4=_0x572657[_0x94b1('0x55')];}else{logger[_0x94b1('0xf')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0x94b1('0x57'));_0x29ccc4=-0x1;}}})[_0x94b1('0x2c')](function(_0x13228e){logger[_0x94b1('0xc')](_0x94b1('0x58'),_0x13228e[_0x94b1('0x14')]);})[_0x94b1('0x4b')](function(){var _0xcdf3e8=require(_0x94b1('0x59'))(config[_0x94b1('0x5')][_0x94b1('0xe')],config[_0x94b1('0x5')]['ip'],_0x29ccc4);_0xcdf3e8['on'](_0x94b1('0xc'),errorHandler);_0xcdf3e8['on']('listening',listeningHandler);_0xcdf3e8['on'](_0x94b1('0x5a'),connectionHandler);_0xcdf3e8['on'](_0x94b1('0x35'),closeHandler);});}main(); \ No newline at end of file +var _0x5178=['callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/license/util','./rpc','./graph','agi','defaults','127.0.0.1','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','error','[%s]\x20%s','name','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','addVertex','mxCell','isArray','source','target','addEdge','value','then','catch','createSquareReport','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','hangup','production','start','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc','context','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense'];(function(_0x3c0649,_0x37b12f){var _0x29882f=function(_0x6de367){while(--_0x6de367){_0x3c0649['push'](_0x3c0649['shift']());}};_0x29882f(++_0x37b12f);}(_0x5178,0x171));var _0x8517=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5178[_0x501510];return _0x1e6ee5;};'use strict';var parser=require('xml2json');var _=require(_0x8517('0x0'));var syncho=require(_0x8517('0x1'));var util=require(_0x8517('0x2'));var moment=require(_0x8517('0x3'));var config=require(_0x8517('0x4'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x8517('0x5'));var rpc=require(_0x8517('0x6'));var mailRpc=require('./mailRpc');var Graph=require(_0x8517('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x8517('0x8')]=_[_0x8517('0x9')](config[_0x8517('0x8')],{'ip':_0x8517('0xa'),'port':0x11dd});function connectionHandler(_0x25146d){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x25146d);agiHandler(_0x25146d);}catch(_0x46f6aa){logger['error'](_0x46f6aa['stack']);}});});}function listeningHandler(){console[_0x8517('0xb')](_0x8517('0xc'),config['agi'][_0x8517('0xd')]);logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x10'),config[_0x8517('0x8')]['ip'],config[_0x8517('0x8')][_0x8517('0xd')]));}function errorHandler(_0x12388f){if(_0x12388f&&_0x12388f['name']&&_0x12388f[_0x8517('0x11')]){logger[_0x8517('0x12')](util[_0x8517('0xf')](_0x8517('0x13'),_0x12388f[_0x8517('0x14')],_0x12388f['message']));}else{logger[_0x8517('0x12')](util[_0x8517('0xf')](_0x8517('0x15'),_0x12388f[_0x8517('0x16')]));}}function closeHandler(){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x17'),this[_0x8517('0x18')],this[_0x8517('0x19')],this[_0x8517('0x1a')],this[_0x8517('0x1b')],this[_0x8517('0x1c')]));try{createSquareReport(this);}catch(_0x50e2de){logger[_0x8517('0x12')](_0x50e2de[_0x8517('0x16')]);}}function timeoutHandler(){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x1d'),this[_0x8517('0x18')],this[_0x8517('0x19')],this['callerid'],this[_0x8517('0x1b')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x8517('0xf')](_0x8517('0x1e'),this[_0x8517('0x18')],this[_0x8517('0x19')],this[_0x8517('0x1a')],this[_0x8517('0x1b')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x2dd1df){return parser[_0x8517('0x1f')](_0x2dd1df,{'object':!![]})[_0x8517('0x20')][_0x8517('0x21')];}function addVertex(_0x3a5f0b,_0x2e6e47,_0x5f02ee){_0x2e6e47[_0x8517('0x22')]=_0x5f02ee;if(_0x2e6e47[_0x8517('0x23')]('retry')){_0x2e6e47[_0x8517('0x24')]=parseInt(_0x2e6e47[_0x8517('0x25')],0xa);}_0x3a5f0b[_0x8517('0x26')](_['omit'](_0x2e6e47,_0x8517('0x27')));}function initGraph(_0x572ce4,_0x2880b6){var _0x2a2b7e=new Graph();for(var _0x448211 in _0x572ce4){if(_0x572ce4[_0x8517('0x23')](_0x448211)){if(_[_0x8517('0x28')](_0x572ce4[_0x448211])){for(var _0x300e3f=0x0;_0x300e3f<_0x572ce4[_0x448211]['length'];_0x300e3f+=0x1){addVertex(_0x2a2b7e,_0x572ce4[_0x448211][_0x300e3f],_0x448211);}}else{addVertex(_0x2a2b7e,_0x572ce4[_0x448211],_0x448211);}}}for(var _0x39764e=0x0;_0x39764e<_0x2880b6['length'];_0x39764e+=0x1){if(_0x2880b6[_0x39764e][_0x8517('0x29')]&&_0x2880b6[_0x39764e][_0x8517('0x2a')]){_0x2a2b7e[_0x8517('0x2b')](_0x2880b6[_0x39764e][_0x8517('0x29')],_0x2880b6[_0x39764e][_0x8517('0x2a')],_0x2880b6[_0x39764e][_0x8517('0x2c')]);}}return _0x2a2b7e;}function getSquareProject(_0x4c691f,_0x20ec0a){rpc['getSquareProject'](_0x4c691f)[_0x8517('0x2d')](function(_0x4b9983){_0x20ec0a(null,_0x4b9983);})[_0x8517('0x2e')](function(_0x2d360c){_0x20ec0a(null,_0x2d360c);});}function createSquareReport(_0x3cf945,_0x14eb04){rpc[_0x8517('0x2f')](_0x3cf945)[_0x8517('0x2d')](function(_0x647d81){if(_0x14eb04){_0x14eb04(null,_0x647d81);}})['catch'](function(_0x3e8f81){if(_0x14eb04){_0x14eb04(null,_0x3e8f81);}});}function setChannelVariables(_0x1031b3){for(var _0x773e3c in _0x1031b3){if(_0x1031b3['hasOwnProperty'](_0x773e3c)){if(_0x773e3c['indexOf']('agi_')===0x0){_0x1031b3[_0x773e3c[_0x8517('0x30')](0x4)]=_0x1031b3[_0x773e3c];delete _0x1031b3[_0x773e3c];}}}}function getLogFromObject(_0x4102b4){return util[_0x8517('0x31')](_0x4102b4,{'showHidden':![],'depth':null});}function agiHandler(_0x2abad4){var _0x5ed2a9,_0x254566,_0x5d9d04,_0x19dd26,_0x234da4;logger[_0x8517('0x32')]('variables',JSON[_0x8517('0x33')](_0x2abad4,null,0x2));logger['info'](util[_0x8517('0xf')](_0x8517('0x34'),_0x2abad4['arg_1'],_0x2abad4['calleridname'],_0x2abad4[_0x8517('0x1a')],_0x2abad4[_0x8517('0x1b')],_0x2abad4[_0x8517('0x1c')]));_0x2abad4['on'](_0x8517('0x12'),errorHandler);_0x2abad4['on']('close',closeHandler);_0x2abad4['on']('timeout',timeoutHandler);_0x2abad4[_0x8517('0x35')]=![];_0x2abad4['on'](_0x8517('0x36'),hangupHandler);var _0x1835ac=getSquareProject['sync'](null,_0x2abad4[_0x8517('0x18')]);if(_0x1835ac){if(_0x1835ac[_0x8517('0x37')]){_0x5ed2a9=getRoot(_0x1835ac['production']);if(_0x5ed2a9&&_0x5ed2a9[_0x8517('0x38')]){logger[_0x8517('0x32')](_0x8517('0x21'),JSON[_0x8517('0x33')](_0x5ed2a9,null,0x2));_0x2abad4['joinAt']=moment()[_0x8517('0xf')](_0x8517('0x39'));_0x254566=initGraph(_[_0x8517('0x3a')](_0x5ed2a9,_0x8517('0x27')),_0x5ed2a9[_0x8517('0x27')]);_0x5d9d04=new Vertices(_0x2abad4,rpc,mailRpc);logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x3b'),_0x2abad4[_0x8517('0x18')],_0x2abad4[_0x8517('0x19')],_0x2abad4[_0x8517('0x1a')],_0x2abad4[_0x8517('0x1b')],_0x2abad4[_0x8517('0x1c')]));_0x254566['traverseBFS'](_0x5ed2a9['start']['id'],function(_0x3f1219){try{_0x3f1219=_0x5d9d04[_0x8517('0x3c')](_0x3f1219);logger[_0x8517('0x32')](_0x8517('0x3d'),JSON[_0x8517('0x33')](_0x3f1219,null,0x2));if(_0x3f1219['agicommand']===_0x8517('0x3e')){logger[_0x8517('0xe')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x2abad4[_0x8517('0x3f')]=_0x3f1219[_0x8517('0x3f')]||_0x2abad4[_0x8517('0x3f')];_0x2abad4[_0x8517('0x40')]=_0x3f1219['extension'];_0x2abad4[_0x8517('0x41')]=_0x3f1219[_0x8517('0x41')]?_0x3f1219['priority']-0x1:0x1;return null;}else if(_0x3f1219&&_0x5d9d04[_0x3f1219[_0x8517('0x22')]]){_0x234da4=_0x5d9d04[_0x3f1219[_0x8517('0x22')]](_0x3f1219);logger[_0x8517('0xe')]('response',JSON[_0x8517('0x33')](_0x234da4,null,0x2));if(_0x234da4&&_0x234da4[_0x8517('0x42')]===AGI_CODE_SUCCESS&&_0x234da4[_0x8517('0x43')]!==AGI_RESULT_ERROR&&!_0x2abad4[_0x8517('0x35')]){logger[_0x8517('0x32')](_0x8517('0x44'),getLogFromObject(_0x234da4));return _[_0x8517('0x45')](_0x234da4['result'])?null:_0x234da4[_0x8517('0x43')][_0x8517('0x46')]();}else{logger['error'](_0x8517('0x44'),getLogFromObject(_0x234da4));return null;}}else{logger[_0x8517('0x12')](_0x8517('0x47'));return null;}}catch(_0x333553){logger[_0x8517('0x12')](_0x333553[_0x8517('0x16')]);return null;}});if(_0x5ed2a9['finally']){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x48'),_0x2abad4['arg_1'],_0x2abad4[_0x8517('0x19')],_0x2abad4[_0x8517('0x1a')],_0x2abad4['dnid'],_0x2abad4[_0x8517('0x1c')]));_0x254566[_0x8517('0x49')](_0x5ed2a9['finally']['id'],function(_0x54b346){try{_0x54b346=_0x5d9d04['clear'](_0x54b346);logger[_0x8517('0x32')](_0x8517('0x3d'),JSON['stringify'](_0x54b346,null,0x2));if(_0x54b346&&_0x5d9d04[_0x54b346[_0x8517('0x22')]]){_0x234da4=_0x5d9d04[_0x54b346['agicommand']](_0x54b346);if(_0x234da4){logger['debug'](_0x8517('0x44'),getLogFromObject(_0x234da4));return _[_0x8517('0x45')](_0x234da4[_0x8517('0x43')])?null:_0x234da4[_0x8517('0x43')]['toString']();}else{logger[_0x8517('0x12')](_0x8517('0x44'),getLogFromObject(_0x234da4));return null;}}else{logger[_0x8517('0x12')]('agicommand\x20not\x20found');return null;}}catch(_0x15102f){logger[_0x8517('0x12')](_0x15102f[_0x8517('0x16')]);return null;}});}logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x4a'),_0x2abad4[_0x8517('0x18')],_0x2abad4['calleridname'],_0x2abad4[_0x8517('0x1a')],_0x2abad4['dnid'],_0x2abad4['uniqueid']));logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x4b'),_0x2abad4[_0x8517('0x3f')],_0x2abad4['extension'],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1));_0x2abad4[_0x8517('0x4c')](_0x2abad4['context'],_0x2abad4['extension'],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1);_0x2abad4[_0x8517('0x4d')]();}}else{logger[_0x8517('0x12')](util['format'](_0x8517('0x4e'),_0x2abad4['arg_1']));_0x2abad4[_0x8517('0x4c')](_0x2abad4[_0x8517('0x3f')],_0x2abad4[_0x8517('0x40')],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1);_0x2abad4[_0x8517('0x4d')]();}}else{logger[_0x8517('0x12')](util[_0x8517('0xf')](_0x8517('0x4f'),_0x2abad4[_0x8517('0x18')]));_0x2abad4['continueAt'](_0x2abad4['context'],_0x2abad4[_0x8517('0x40')],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1);_0x2abad4[_0x8517('0x4d')]();}}function main(){var _0x5e82ab;return utilLicense[_0x8517('0x50')]()[_0x8517('0x2d')](function(_0x445f9b){if(_0x445f9b){if(_0x445f9b['voice']){if(_0x445f9b['callysquare']&&_0x445f9b[_0x8517('0x51')]>0x0){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x52'),_0x445f9b[_0x8517('0x51')]));_0x5e82ab=_0x445f9b[_0x8517('0x51')];}else{logger[_0x8517('0xe')](_0x8517('0x53'));}}else{logger[_0x8517('0xe')](_0x8517('0x54'));_0x5e82ab=-0x1;}}})[_0x8517('0x2e')](function(_0x3c5462){logger[_0x8517('0x12')](_0x8517('0x55'),_0x3c5462[_0x8517('0x16')]);})[_0x8517('0x56')](function(){var _0x5c3932=require(_0x8517('0x57'))(config[_0x8517('0x8')][_0x8517('0xd')],config[_0x8517('0x8')]['ip'],_0x5e82ab);_0x5c3932['on'](_0x8517('0x12'),errorHandler);_0x5c3932['on'](_0x8517('0x58'),listeningHandler);_0x5c3932['on'](_0x8517('0x59'),connectionHandler);_0x5c3932['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index d5e4249..9b7d21a 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 _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x3bebd4,_0x3e7f8a){var _0x3c494a=function(_0x2d210a){while(--_0x2d210a){_0x3bebd4['push'](_0x3bebd4['shift']());}};_0x3c494a(++_0x3e7f8a);}(_0x34e8,0x12c));var _0x834e=function(_0x417017,_0x147c6b){_0x417017=_0x417017-0x0;var _0x2d7135=_0x34e8[_0x417017];return _0x2d7135;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0xcef527,_0x4756af){var _0x1c7d86=function(_0x2ccf81){while(--_0x2ccf81){_0xcef527['push'](_0xcef527['shift']());}};_0x1c7d86(++_0x4756af);}(_0x814b,0x1a2));var _0xb814=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0x814b[_0x143a91];return _0x1906f5;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 13b9853..623428a 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 _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x4f04e8,_0x5e3c43){var _0x20c11d=function(_0x1bb27d){while(--_0x1bb27d){_0x4f04e8['push'](_0x4f04e8['shift']());}};_0x20c11d(++_0x5e3c43);}(_0x5f2f,0x73));var _0xf5f2=function(_0x264182,_0xba6d7a){_0x264182=_0x264182-0x0;var _0x5a1b53=_0x5f2f[_0x264182];return _0x5a1b53;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x3833f4,_0xb7f4ec){var _0x393f0b=function(_0x2eb3a9){while(--_0x2eb3a9){_0x3833f4['push'](_0x3833f4['shift']());}};_0x393f0b(++_0xb7f4ec);}(_0x5f2f,0x73));var _0xf5f2=function(_0x311cb0,_0x25ae42){_0x311cb0=_0x311cb0-0x0;var _0x158feb=_0x5f2f[_0x311cb0];return _0x158feb;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index ee7ba0f..6be97c9 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 _0xd5e5=['ShowVariable','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','format','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','util','client','http','request','error','message','result','catch','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd5e5,0x187));var _0x5d5e=function(_0x190c9f,_0x1c29e7){_0x190c9f=_0x190c9f-0x0;var _0x2151b8=_0xd5e5[_0x190c9f];return _0x2151b8;};'use strict';var BPromise=require('bluebird');var moment=require(_0x5d5e('0x0'));var _=require('lodash');var util=require(_0x5d5e('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x5d5e('0x2')][_0x5d5e('0x3')]({'port':0x2329});function request(_0x3b58c5,_0x4033dd){return new BPromise(function(_0xff3d1,_0x2818ae){return client[_0x5d5e('0x4')](_0x3b58c5,_0x4033dd)['then'](function(_0x38de77){if(_0x38de77[_0x5d5e('0x5')]){return _0x2818ae(_0x38de77[_0x5d5e('0x5')][_0x5d5e('0x6')]);}else{return _0xff3d1(_0x38de77[_0x5d5e('0x7')]);}})[_0x5d5e('0x8')](function(_0x21e55e){return _0x2818ae(_0x21e55e);});});}exports[_0x5d5e('0x9')]=function(_0x35c3f1){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x35c3f1},'attributes':[_0x5d5e('0xa')]}});};exports[_0x5d5e('0xb')]=function(_0x1af62a){return request(_0x5d5e('0xc'),{'options':{'raw':![],'where':{'id':_0x1af62a},'include':[{'model':_0x5d5e('0xd'),'as':_0x5d5e('0xe')}],'attributes':['id',_0x5d5e('0xf'),_0x5d5e('0x10')]}});};exports[_0x5d5e('0x11')]=function(_0xb09e1e){return request(_0x5d5e('0x12'),{'options':{'where':{'id':_0xb09e1e},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x13')]=function(_0x3a7480){return request(_0x5d5e('0x14'),{'options':{'where':{'id':_0x3a7480},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x15')]=function(_0x1eb073){return request(_0x5d5e('0x16'),{'options':{'where':{'id':_0x1eb073},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x2e47f2){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2e47f2},'attributes':['dsn']}});};exports[_0x5d5e('0x17')]=function(_0x4dfac7){return request('ShowUser',{'options':{'where':{'id':_0x4dfac7},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x18')]=function(_0x219d21){return request(_0x5d5e('0x19'),{'options':{'where':{'id':_0x219d21},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x1a')]=function(_0x4e9bbf){return request(_0x5d5e('0x1b'),{'options':{'where':{'id':_0x4e9bbf},'attributes':[_0x5d5e('0x1c')]}});};exports[_0x5d5e('0x1d')]=function(_0x553c79){return request(_0x5d5e('0x1e'),{'options':{'raw':![],'where':{'id':_0x553c79},'include':[{'model':_0x5d5e('0x1f'),'as':_0x5d5e('0x20')}]}});};exports[_0x5d5e('0x21')]=function(_0x439c11){return request(_0x5d5e('0x22'),{'options':{'where':{'id':_0x439c11},'attributes':['id',_0x5d5e('0xf')]}});};exports['createSmsMessage']=function(_0x7eb0d3){return request(_0x5d5e('0x23'),{'body':_0x7eb0d3});};exports[_0x5d5e('0x24')]=function(_0x2261ae){return request(_0x5d5e('0x25'),{'body':_0x2261ae});};exports[_0x5d5e('0x26')]=function(_0x121402){return request(_0x5d5e('0x27'),{'body':_['merge'](_0x121402,{'project_name':_0x121402['arg_1'],'prev_project_name':_0x121402['arg_2']||'','is_subproject':_0x121402[_0x5d5e('0x28')]?!![]:![],'leaveAt':moment()[_0x5d5e('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x2798ec){return request('CreateSquareRecording',{'body':_0x2798ec});};exports[_0x5d5e('0x2a')]=function(_0xdeebc6){return request(_0x5d5e('0x2b'),{'body':_0xdeebc6});};exports[_0x5d5e('0x2c')]=function(_0x5132a4){return request(_0x5d5e('0x2d'),{'options':{'raw':![],'where':{'phone':_0x5132a4[_0x5d5e('0x2e')],'ListId':_0x5132a4[_0x5d5e('0x2f')]}}})[_0x5d5e('0x30')](function(_0x2b76b1){if(_0x2b76b1){return _0x2b76b1;}return request(_0x5d5e('0x31'),{'body':_0x5132a4});});};exports[_0x5d5e('0x32')]=function(_0x352487){return request(_0x5d5e('0x33'),{'options':{'where':{'id':_0x352487},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x34')]=function(_0x41cdfc,_0x265532){return request(_0x5d5e('0x35'),{'body':{'interface':_0x265532},'options':{'where':_0x41cdfc}});};exports[_0x5d5e('0x36')]=function(_0x1d4066,_0x569427,_0x1f0bd9){return request(_0x5d5e('0x37'),{'body':{'type':_0x569427,'uniqueid':_0x1f0bd9},'options':{'where':_0x1d4066}});};exports['agentUnpause']=function(_0x192b07){return request(_0x5d5e('0x38'),{'body':{},'options':{'where':_0x192b07}});};exports[_0x5d5e('0x39')]=function(_0x5328d7){return request(_0x5d5e('0x3a'),{'body':{},'options':{'where':_0x5328d7}});}; \ No newline at end of file +var _0x18a6=['ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','getUserById','getTrunkById','ShowTrunk','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','format','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentLogout','LogoutUser','lodash','util','jayson/promise','request','then','error','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','name','email'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x18a6,0x190));var _0x618a=function(_0x517cf1,_0x3d7b0b){_0x517cf1=_0x517cf1-0x0;var _0x1f97c9=_0x18a6[_0x517cf1];return _0x1f97c9;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x618a('0x0'));var util=require(_0x618a('0x1'));var jayson=require(_0x618a('0x2'));var client=jayson['client']['http']({'port':0x2329});function request(_0x85ccc1,_0x288005){return new BPromise(function(_0xfeed68,_0x4fe16b){return client[_0x618a('0x3')](_0x85ccc1,_0x288005)[_0x618a('0x4')](function(_0x10ad50){if(_0x10ad50[_0x618a('0x5')]){return _0x4fe16b(_0x10ad50[_0x618a('0x5')]['message']);}else{return _0xfeed68(_0x10ad50['result']);}})[_0x618a('0x6')](function(_0x1392ea){return _0x4fe16b(_0x1392ea);});});}exports['getSquareProject']=function(_0x1f71a3){return request(_0x618a('0x7'),{'options':{'raw':![],'where':{'name':_0x1f71a3},'attributes':[_0x618a('0x8')]}});};exports[_0x618a('0x9')]=function(_0x3d7c1f){return request(_0x618a('0xa'),{'options':{'raw':![],'where':{'id':_0x3d7c1f},'include':[{'model':'MailServerOut','as':_0x618a('0xb')}],'attributes':['id',_0x618a('0xc'),_0x618a('0xd')]}});};exports['getSquareProjectById']=function(_0x3e0e81){return request(_0x618a('0x7'),{'options':{'where':{'id':_0x3e0e81},'attributes':[_0x618a('0xc')]}});};exports['getVoiceQueueById']=function(_0x364b9a){return request(_0x618a('0xe'),{'options':{'where':{'id':_0x364b9a},'attributes':[_0x618a('0xc')]}});};exports[_0x618a('0xf')]=function(_0x3e7055){return request(_0x618a('0x10'),{'options':{'where':{'id':_0x3e7055},'attributes':[_0x618a('0xc')]}});};exports['getSquareOdbcById']=function(_0x4d434c){return request(_0x618a('0x11'),{'options':{'where':{'id':_0x4d434c},'attributes':['dsn']}});};exports[_0x618a('0x12')]=function(_0x4ff6bc){return request('ShowUser',{'options':{'where':{'id':_0x4ff6bc},'attributes':[_0x618a('0xc')]}});};exports[_0x618a('0x13')]=function(_0x50cbb9){return request(_0x618a('0x14'),{'options':{'where':{'id':_0x50cbb9},'attributes':[_0x618a('0xc')]}});};exports['getSoundById']=function(_0x18ed4a){return request(_0x618a('0x15'),{'options':{'where':{'id':_0x18ed4a},'attributes':['save_name']}});};exports[_0x618a('0x16')]=function(_0x4edc39){return request(_0x618a('0x17'),{'options':{'raw':![],'where':{'id':_0x4edc39},'include':[{'model':_0x618a('0x18'),'as':_0x618a('0x19')}]}});};exports['getSmsAccountById']=function(_0x521b60){return request(_0x618a('0x1a'),{'options':{'where':{'id':_0x521b60},'attributes':['id',_0x618a('0xc')]}});};exports['createSmsMessage']=function(_0x130488){return request('CreateSmsMessage',{'body':_0x130488});};exports[_0x618a('0x1b')]=function(_0x5a3179){return request(_0x618a('0x1c'),{'body':_0x5a3179});};exports[_0x618a('0x1d')]=function(_0xec2c5a){return request(_0x618a('0x1e'),{'body':_['merge'](_0xec2c5a,{'project_name':_0xec2c5a['arg_1'],'prev_project_name':_0xec2c5a['arg_2']||'','is_subproject':_0xec2c5a[_0x618a('0x1f')]?!![]:![],'leaveAt':moment()[_0x618a('0x20')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x1a17c9){return request(_0x618a('0x21'),{'body':_0x1a17c9});};exports['createSquareMessage']=function(_0x4397b6){return request(_0x618a('0x22'),{'body':_0x4397b6});};exports[_0x618a('0x23')]=function(_0x3996ae){return request(_0x618a('0x24'),{'options':{'raw':![],'where':{'phone':_0x3996ae[_0x618a('0x25')],'ListId':_0x3996ae['ListId']}}})[_0x618a('0x4')](function(_0x410429){if(_0x410429){return _0x410429;}return request(_0x618a('0x26'),{'body':_0x3996ae});});};exports[_0x618a('0x27')]=function(_0x30613a){return request(_0x618a('0x28'),{'options':{'where':{'id':_0x30613a},'attributes':[_0x618a('0xc')]}});};exports[_0x618a('0x29')]=function(_0xb659d9,_0x485e70){return request('LoginUser',{'body':{'interface':_0x485e70},'options':{'where':_0xb659d9}});};exports[_0x618a('0x2a')]=function(_0x197930,_0x47554a,_0x2d90cc){return request(_0x618a('0x2b'),{'body':{'type':_0x47554a,'uniqueid':_0x2d90cc},'options':{'where':_0x197930}});};exports['agentUnpause']=function(_0x72a2d0){return request('UnpauseUser',{'body':{},'options':{'where':_0x72a2d0}});};exports[_0x618a('0x2c')]=function(_0x5dca04){return request(_0x618a('0x2d'),{'body':{},'options':{'where':_0x5dca04}});}; \ 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 d0cc532..8ed4ce9 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 _0xca66=['./polly'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0xca66,0x8b));var _0x6ca6=function(_0xe91125,_0x791acb){_0xe91125=_0xe91125-0x0;var _0x4536b2=_0xca66[_0xe91125];return _0x4536b2;};var polly=require(_0x6ca6('0x0'));var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xd0bb=['./lex','exports','./polly'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x4989fe,_0x201e34){_0x4989fe=_0x4989fe-0x0;var _0x4afd24=_0xd0bb[_0x4989fe];return _0x4afd24;};var polly=require(_0xbd0b('0x0'));var lex=require(_0xbd0b('0x1'));module[_0xbd0b('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 97c42ff..2883678 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 _0xac55=['./lib/api','exports'];(function(_0xcac916,_0x360113){var _0x4ae255=function(_0x5f3a69){while(--_0x5f3a69){_0xcac916['push'](_0xcac916['shift']());}};_0x4ae255(++_0x360113);}(_0xac55,0x1c8));var _0x5ac5=function(_0x1ec508,_0x291d20){_0x1ec508=_0x1ec508-0x0;var _0x1cb231=_0xac55[_0x1ec508];return _0x1cb231;};'use strict';var lex=require(_0x5ac5('0x0'));module[_0x5ac5('0x1')]=function(_0x22f811,_0x2de0ff,_0x5ac30d,_0x17b1d9,_0x13fcc6,_0x192f9d){return lex(_0x22f811,_0x2de0ff,_0x5ac30d,_0x17b1d9,_0x13fcc6,_0x192f9d);}; \ No newline at end of file +var _0x2dae=['./lib/api'];(function(_0x1474fd,_0x30b9aa){var _0x1b76e3=function(_0x380cd9){while(--_0x380cd9){_0x1474fd['push'](_0x1474fd['shift']());}};_0x1b76e3(++_0x30b9aa);}(_0x2dae,0xc3));var _0xe2da=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0x2dae[_0x547456];return _0xc1fd7b;};'use strict';var lex=require(_0xe2da('0x0'));module['exports']=function(_0x11ec30,_0x31359d,_0xcd0055,_0x167432,_0x99b46f,_0x481d97){return lex(_0x11ec30,_0x31359d,_0xcd0055,_0x167432,_0x99b46f,_0x481d97);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 1ced720..2014349 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 _0xf6c9=['postText','slots','hasOwnProperty','slot_','exports','LexRuntime','$LATEST','aws-sdk'];(function(_0x250e97,_0x388d3a){var _0x382133=function(_0x28f3c6){while(--_0x28f3c6){_0x250e97['push'](_0x250e97['shift']());}};_0x382133(++_0x388d3a);}(_0xf6c9,0x11f));var _0x9f6c=function(_0x30eed2,_0x6786f9){_0x30eed2=_0x30eed2-0x0;var _0x355151=_0xf6c9[_0x30eed2];return _0x355151;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x9f6c('0x0'));function lexResult(_0x4f713e,_0x30ae54){return new BPromise(function(_0xf1ae2c,_0x3e7274){_0x4f713e[_0x9f6c('0x1')](_0x30ae54,function(_0x116463,_0x38dae8){if(_0x116463){_0x3e7274(_0x116463);}if(_0x38dae8[_0x9f6c('0x2')]){for(const _0x4822ec in _0x38dae8[_0x9f6c('0x2')]){if(_0x38dae8[_0x9f6c('0x2')][_0x9f6c('0x3')](_0x4822ec)){var _0x3d5b81=_0x38dae8['slots'][_0x4822ec];_0x38dae8[_0x9f6c('0x4')+_0x4822ec]=_0x3d5b81;}}}_0xf1ae2c(_0x38dae8);});});}module[_0x9f6c('0x5')]=function(_0x4ed219,_0x1b9fb8,_0x544dcc,_0x458707,_0x1a02f2,_0x2dff60){var _0x469e17=new AWS[(_0x9f6c('0x6'))]({'accessKeyId':_0x1b9fb8,'secretAccessKey':_0x544dcc,'region':_0x458707});var _0x5e704d={'botAlias':_0x9f6c('0x7'),'botName':_0x2dff60,'inputText':_0x1a02f2,'userId':_0x4ed219};return lexResult(_0x469e17,_0x5e704d);}; \ No newline at end of file +var _0xf47b=['bluebird','postText','slots','hasOwnProperty','slot_','exports','LexRuntime','$LATEST'];(function(_0x394bdb,_0x129f18){var _0x53ea73=function(_0x153e42){while(--_0x153e42){_0x394bdb['push'](_0x394bdb['shift']());}};_0x53ea73(++_0x129f18);}(_0xf47b,0x128));var _0xbf47=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xf47b[_0x2b4411];return _0x8e41ef;};'use strict';var BPromise=require(_0xbf47('0x0'));var AWS=require('aws-sdk');function lexResult(_0x46c7a5,_0x399cb9){return new BPromise(function(_0x383eab,_0x3aaa55){_0x46c7a5[_0xbf47('0x1')](_0x399cb9,function(_0x5a77b0,_0x30794b){if(_0x5a77b0){_0x3aaa55(_0x5a77b0);}if(_0x30794b[_0xbf47('0x2')]){for(const _0x35eddd in _0x30794b[_0xbf47('0x2')]){if(_0x30794b[_0xbf47('0x2')][_0xbf47('0x3')](_0x35eddd)){var _0x22b0ac=_0x30794b[_0xbf47('0x2')][_0x35eddd];_0x30794b[_0xbf47('0x4')+_0x35eddd]=_0x22b0ac;}}}_0x383eab(_0x30794b);});});}module[_0xbf47('0x5')]=function(_0x1bc158,_0x31f836,_0x40323b,_0x1e18dd,_0x4158af,_0x283c9d){var _0x17c809=new AWS[(_0xbf47('0x6'))]({'accessKeyId':_0x31f836,'secretAccessKey':_0x40323b,'region':_0x1e18dd});var _0x3788ba={'botAlias':_0xbf47('0x7'),'botName':_0x283c9d,'inputText':_0x4158af,'userId':_0x1bc158};return lexResult(_0x17c809,_0x3788ba);}; \ 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 24cd0da..c990961 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 _0x74a0=['exports'];(function(_0x13117b,_0xb1a8eb){var _0x56b193=function(_0x205655){while(--_0x205655){_0x13117b['push'](_0x13117b['shift']());}};_0x56b193(++_0xb1a8eb);}(_0x74a0,0xf8));var _0x074a=function(_0x45cfd1,_0x215bc7){_0x45cfd1=_0x45cfd1-0x0;var _0x28e9f3=_0x74a0[_0x45cfd1];return _0x28e9f3;};'use strict';var polly=require('./lib/api');module[_0x074a('0x0')]=function(_0x1629f4,_0x355bc4,_0x4ba521,_0x593cd4,_0x24f1cf,_0x13e328,_0x25f3d3){return polly(_0x1629f4,_0x355bc4,_0x4ba521,_0x593cd4,_0x24f1cf,_0x13e328,_0x25f3d3);}; \ No newline at end of file +var _0xabba=['exports'];(function(_0x5e9141,_0x4cbccd){var _0x32d40d=function(_0x15c50e){while(--_0x15c50e){_0x5e9141['push'](_0x5e9141['shift']());}};_0x32d40d(++_0x4cbccd);}(_0xabba,0x195));var _0xaabb=function(_0x477d9f,_0xcbe847){_0x477d9f=_0x477d9f-0x0;var _0xd0ba14=_0xabba[_0x477d9f];return _0xd0ba14;};'use strict';var polly=require('./lib/api');module[_0xaabb('0x0')]=function(_0x1efee7,_0x280862,_0x3b227a,_0x3c8629,_0x3b8c14,_0x5b855b,_0x33da27){return polly(_0x1efee7,_0x280862,_0x3b227a,_0x3c8629,_0x3b8c14,_0x5b855b,_0x33da27);}; \ 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 8108e35..2985d30 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 _0xea73=['bluebird','randomstring','aws-sdk','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path'];(function(_0x2eed21,_0x575fed){var _0x40c06a=function(_0x145cbe){while(--_0x145cbe){_0x2eed21['push'](_0x2eed21['shift']());}};_0x40c06a(++_0x575fed);}(_0xea73,0x113));var _0x3ea7=function(_0x303c19,_0x4d7002){_0x303c19=_0x303c19-0x0;var _0x1dc836=_0xea73[_0x303c19];return _0x1dc836;};'use strict';var fs=require('fs');var path=require(_0x3ea7('0x0'));var BPromise=require(_0x3ea7('0x1'));var rs=require(_0x3ea7('0x2'));var AWS=require(_0x3ea7('0x3'));function pollyResult(_0x1c5d89,_0x58bf78,_0x285af9){return new BPromise(function(_0x4699b5,_0x4eef4e){_0x1c5d89['synthesizeSpeech'](_0x58bf78,function(_0x540a13,_0x161d6f){if(_0x540a13){_0x4eef4e(_0x540a13);}else if(_0x161d6f){if(_0x161d6f['AudioStream']instanceof Buffer){fs[_0x3ea7('0x4')](_0x285af9,_0x161d6f[_0x3ea7('0x5')],function(_0x4072fb){if(_0x4072fb){_0x4eef4e(_0x4072fb);}else{_0x4699b5();}});}else{_0x4eef4e(new Error(_0x3ea7('0x6')));}}else{_0x4eef4e(new Error(_0x3ea7('0x7')));}});});}module[_0x3ea7('0x8')]=function(_0x1f28f4,_0x183367,_0x10e1fa,_0x15306a,_0x214f6b,_0x4b6944,_0x12196c){var _0x35f6ac=new AWS[(_0x3ea7('0x9'))]({'accessKeyId':_0x1f28f4,'secretAccessKey':_0x183367,'region':_0x10e1fa});var _0x196668={'Text':_0x214f6b,'TextType':_0x4b6944||_0x3ea7('0xa'),'OutputFormat':_0x3ea7('0xb'),'VoiceId':_0x15306a};return pollyResult(_0x35f6ac,_0x196668,_0x12196c);}; \ No newline at end of file +var _0xc99f=['Polly','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc99f,0x105));var _0xfc99=function(_0x76ced3,_0x8abc01){_0x76ced3=_0x76ced3-0x0;var _0x4fea70=_0xc99f[_0x76ced3];return _0x4fea70;};'use strict';var fs=require('fs');var path=require(_0xfc99('0x0'));var BPromise=require(_0xfc99('0x1'));var rs=require(_0xfc99('0x2'));var AWS=require(_0xfc99('0x3'));function pollyResult(_0x3ca730,_0x326569,_0x37d2bd){return new BPromise(function(_0xd41615,_0x3e3861){_0x3ca730[_0xfc99('0x4')](_0x326569,function(_0xfc8676,_0x23e4be){if(_0xfc8676){_0x3e3861(_0xfc8676);}else if(_0x23e4be){if(_0x23e4be[_0xfc99('0x5')]instanceof Buffer){fs[_0xfc99('0x6')](_0x37d2bd,_0x23e4be[_0xfc99('0x5')],function(_0x4fdfa6){if(_0x4fdfa6){_0x3e3861(_0x4fdfa6);}else{_0xd41615();}});}else{_0x3e3861(new Error(_0xfc99('0x7')));}}else{_0x3e3861(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xfc99('0x8')]=function(_0x20662c,_0x1360a8,_0x52626f,_0x468215,_0x3e45f7,_0x2c8d4f,_0x2d73c4){var _0x9c3de6=new AWS[(_0xfc99('0x9'))]({'accessKeyId':_0x20662c,'secretAccessKey':_0x1360a8,'region':_0x52626f});var _0x253b8e={'Text':_0x3e45f7,'TextType':_0x2c8d4f||'text','OutputFormat':'mp3','VoiceId':_0x468215};return pollyResult(_0x9c3de6,_0x253b8e,_0x2d73c4);}; \ 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 b0c3847..1d17e25 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(_0x5302d4,_0x4cf1fb,_0x1ba5f0,_0x47ca5f){return asr(_0x5302d4,_0x4cf1fb,_0x1ba5f0);}; \ No newline at end of file +var _0x5f95=['./lib/api','exports'];(function(_0x566cda,_0x5ef10f){var _0x4c0fd5=function(_0x5f13dd){while(--_0x5f13dd){_0x566cda['push'](_0x566cda['shift']());}};_0x4c0fd5(++_0x5ef10f);}(_0x5f95,0x110));var _0x55f9=function(_0x145444,_0x37a03f){_0x145444=_0x145444-0x0;var _0x1bfff0=_0x5f95[_0x145444];return _0x1bfff0;};'use strict';var asr=require(_0x55f9('0x0'));module[_0x55f9('0x1')]=function(_0x3f4069,_0x33114b,_0x51e47e,_0xbff845){return asr(_0x3f4069,_0x33114b,_0x51e47e);}; \ 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 2012e71..82b78b3 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 _0xd8c8=['https://speech.googleapis.com','exports','filepath\x20should\x20be\x20a\x20string','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xd8c8,0x14f));var _0x8d8c=function(_0x20adb6,_0x545b62){_0x20adb6=_0x20adb6-0x0;var _0x433c43=_0xd8c8[_0x20adb6];return _0x433c43;};'use strict';var url=require('url');var BPromise=require(_0x8d8c('0x0'));var fs=require('fs');var host=_0x8d8c('0x1');module[_0x8d8c('0x2')]=function(_0x1bf4e6,_0x31f4c1,_0x1282c2){return new BPromise(function(_0xe78447,_0x341b73){var _0x133d51;if(typeof _0x1bf4e6!=='string'||_0x1bf4e6['length']===0x0){return _0x341b73(_0x8d8c('0x3'));}if(typeof _0x31f4c1!==_0x8d8c('0x4')||_0x31f4c1[_0x8d8c('0x5')]===0x0){return _0x341b73(_0x8d8c('0x6'));}if(typeof _0x1282c2!==_0x8d8c('0x7')&&(typeof _0x1282c2!==_0x8d8c('0x4')||_0x1282c2[_0x8d8c('0x5')]===0x0)){return _0x341b73(_0x8d8c('0x8'));}try{_0x133d51=fs[_0x8d8c('0x9')](_0x1bf4e6)[_0x8d8c('0xa')](_0x8d8c('0xb'));}catch(_0x1b6b0c){return _0x341b73(_0x1b6b0c);}return _0xe78447({'method':_0x8d8c('0xc'),'uri':host+_0x8d8c('0xd')+_0x31f4c1,'body':{'config':{'encoding':_0x8d8c('0xe'),'sampleRateHertz':_0x8d8c('0xf'),'languageCode':_0x1282c2},'audio':{'content':_0x133d51}},'json':!![]});});}; \ No newline at end of file +var _0x1561=['length','filepath\x20should\x20be\x20a\x20string','string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0x1561,0x175));var _0x1156=function(_0xb1027f,_0x56346a){_0xb1027f=_0xb1027f-0x0;var _0x2b2c29=_0x1561[_0xb1027f];return _0x2b2c29;};'use strict';var url=require(_0x1156('0x0'));var BPromise=require(_0x1156('0x1'));var fs=require('fs');var host=_0x1156('0x2');module[_0x1156('0x3')]=function(_0x6d1c9,_0x36de1a,_0x5ec85c){return new BPromise(function(_0x5d5b53,_0x556a19){var _0x4e1aeb;if(typeof _0x6d1c9!=='string'||_0x6d1c9[_0x1156('0x4')]===0x0){return _0x556a19(_0x1156('0x5'));}if(typeof _0x36de1a!==_0x1156('0x6')||_0x36de1a[_0x1156('0x4')]===0x0){return _0x556a19('key\x20should\x20be\x20a\x20string');}if(typeof _0x5ec85c!=='undefined'&&(typeof _0x5ec85c!==_0x1156('0x6')||_0x5ec85c[_0x1156('0x4')]===0x0)){return _0x556a19(_0x1156('0x7'));}try{_0x4e1aeb=fs[_0x1156('0x8')](_0x6d1c9)[_0x1156('0x9')](_0x1156('0xa'));}catch(_0x30be35){return _0x556a19(_0x30be35);}return _0x5d5b53({'method':'POST','uri':host+_0x1156('0xb')+_0x36de1a,'body':{'config':{'encoding':_0x1156('0xc'),'sampleRateHertz':'8000','languageCode':_0x5ec85c},'audio':{'content':_0x4e1aeb}},'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 3d3a62a..89c5568 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 _0x7d8a=['exports','./asr'];(function(_0x4d69d1,_0x211712){var _0x4950ad=function(_0x4868b8){while(--_0x4868b8){_0x4d69d1['push'](_0x4d69d1['shift']());}};_0x4950ad(++_0x211712);}(_0x7d8a,0xbf));var _0xa7d8=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x7d8a[_0x2f71f6];return _0x2b23ea;};var asr=require(_0xa7d8('0x0'));module[_0xa7d8('0x1')]={'asr':asr}; \ No newline at end of file +var _0xbc71=['./asr'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xbc71,0x86));var _0x1bc7=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xbc71[_0x24061a];return _0x82054e;};var asr=require(_0x1bc7('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index a1e928e..36cfbe7 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 _0xd5ba=['resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','from','audioContent','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','googleASR','asr','uri','alternatives','transcript','results','confidence','join','googleASR\x20transcription','catch','name','message','googleDialogflow','textRequest','source','result','action','actionIncomplete','fulfillment','speech','score','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','polly','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','text','CustomAction','channelData','CustomActionData','AudioFromTts','Data','dirName','http','https','md5','path','querystring','request-promise','randomstring','google-tts-api','parse','./aws','./google','./tilde','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','download\x20error','pipe','data','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert'];(function(_0xf23ae0,_0x13041f){var _0x441c81=function(_0x3964c9){while(--_0x3964c9){_0xf23ae0['push'](_0xf23ae0['shift']());}};_0x441c81(++_0x13041f);}(_0xd5ba,0x1ee));var _0xad5b=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd5ba[_0x5f09c5];return _0x426ad9;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xad5b('0x0'));var https=require(_0xad5b('0x1'));var md5=require(_0xad5b('0x2'));var path=require(_0xad5b('0x3'));var querystring=require(_0xad5b('0x4'));var rp=require(_0xad5b('0x5'));var rs=require(_0xad5b('0x6'));var sox=require('sox');var tts=require(_0xad5b('0x7'));var urlParse=require('url')[_0xad5b('0x8')];var util=require('util');var aws=require(_0xad5b('0x9'));var google=require(_0xad5b('0xa'));var sestek=require('./sestek');var tilde=require(_0xad5b('0xb'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0xad5b('0xc');function downloadFile(_0x24cf6f,_0x413ae9){return new BPromise(function(_0x677bfa,_0x12f9bd){var _0x1f1f7f=urlParse(_0x24cf6f);var _0x405899=_0x1f1f7f[_0xad5b('0xd')]===_0xad5b('0xe')?https:http;var _0x2d3e64={'host':_0x1f1f7f[_0xad5b('0xf')],'path':_0x1f1f7f[_0xad5b('0x3')],'headers':{'user-agent':_0xad5b('0x10')}};_0x405899[_0xad5b('0x11')](_0x2d3e64,function(_0x14fa58){if(_0x14fa58[_0xad5b('0x12')]!==0xc8){logger[_0xad5b('0x13')](_0xad5b('0x14')+_0x24cf6f+'\x20failed,\x20status\x20code\x20=\x20'+_0x14fa58[_0xad5b('0x12')]+'\x20('+_0x14fa58[_0xad5b('0x15')]+')');_0x12f9bd(new Error('request\x20to\x20'+_0x24cf6f+_0xad5b('0x16')+_0x14fa58[_0xad5b('0x12')]+'\x20('+_0x14fa58[_0xad5b('0x15')]+')'));return;}var _0x4dcbc0=fs[_0xad5b('0x17')](_0x413ae9);_0x4dcbc0['on'](_0xad5b('0x18'),function(){logger['info']('finish\x20download\x20file');_0x4dcbc0['close'](_0x677bfa);});_0x4dcbc0['on']('error',function(_0x2ef372){fs['unlink'](_0x413ae9);logger[_0xad5b('0x13')](_0xad5b('0x19'),_0x2ef372);_0x12f9bd(_0x2ef372);});_0x14fa58[_0xad5b('0x1a')](_0x4dcbc0);})['on'](_0xad5b('0x13'),function(_0x53d94c){logger[_0xad5b('0x13')](_0x53d94c);_0x12f9bd(_0x53d94c);})['end']();});}function uploadFile(_0x2c2635){return new BPromise(function(_0x446302,_0x354f8c){var _0x53c499=urlParse(_0x2c2635);var _0x2a9b30=_0x53c499[_0xad5b('0xd')]===_0xad5b('0xe')?https:http;var _0x194480={'host':_0x53c499['host'],'path':_0x53c499[_0xad5b('0x3')],'headers':{'user-agent':_0xad5b('0x10')}};_0x2a9b30[_0xad5b('0x11')](_0x194480,function(_0x1b5504){if(_0x1b5504[_0xad5b('0x12')]!==0xc8){_0x354f8c(new Error(_0xad5b('0x14')+_0x2c2635+'\x20failed,\x20status\x20code\x20=\x20'+_0x1b5504[_0xad5b('0x12')]+'\x20('+_0x1b5504[_0xad5b('0x15')]+')'));return;}var _0xcdf7da='';_0x1b5504['on'](_0xad5b('0x1b'),function(_0x5030c1){_0xcdf7da+=_0x5030c1;});_0x1b5504['on'](_0xad5b('0x1c'),function(){_0x446302(_0xcdf7da);});})['on'](_0xad5b('0x13'),function(_0x183f78){_0x354f8c(_0x183f78);})[_0xad5b('0x1c')]();});}function convertFile(_0xc59535,_0x3e3108){return new BPromise(function(_0x5568e2,_0x15ff84){var _0x3fcf35=sox[_0xad5b('0x1d')](_0xc59535,_0x3e3108,{'sampleRate':0x1f40,'format':_0xad5b('0x1e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3fcf35['on']('error',function(_0x47548a){logger[_0xad5b('0x13')](_0xad5b('0x1f'),_0x47548a);_0x15ff84(_0x47548a);});_0x3fcf35['on'](_0xad5b('0x1c'),function(){logger[_0xad5b('0x20')](_0xad5b('0x21'));_0x5568e2();});_0x3fcf35['start']();});}function base64Decode(_0x207cc7,_0xc29536){var _0x21df72=path[_0xad5b('0x22')](__dirname,_0xad5b('0x23'),rs[_0xad5b('0x24')](0x4)+_0xad5b('0x25'));fs[_0xad5b('0x26')](_0x21df72,_0x207cc7,_0xad5b('0x27'));return convertFile(_0x21df72,_0xc29536)[_0xad5b('0x28')](function(){try{fs[_0xad5b('0x29')](_0x21df72);fs[_0xad5b('0x2a')](_0xc29536,_0xad5b('0x2b'));}catch(_0x1d42a0){logger['error'](_0x1d42a0);}return _0xc29536[_0xad5b('0x2c')]('.')[0x0];});}function base64Encode(_0x244c9f){var _0xfd3783=fs[_0xad5b('0x2d')](_0x244c9f);return new Buffer(_0xfd3783)[_0xad5b('0x2e')](_0xad5b('0x27'));}exports[_0xad5b('0x2f')]=function(_0x410dc5,_0x24222f,_0x146963,_0x282465,_0x13ba2f,_0x2c79c8){var _0x1c6653,_0x3de8ff;var _0x65025b=_0xad5b('0x30');var _0x4c62a0='?key='+_0x410dc5;var _0x37dea8={};if(_0x24222f===_0xad5b('0x31')){_0x37dea8[_0xad5b('0x32')]={'ssml':_0x146963};}else{_0x37dea8['input']={'text':_0x146963};};_0x37dea8[_0xad5b('0x33')]={'languageCode':_0x282465,'ssmlGender':_0x13ba2f};_0x37dea8[_0xad5b('0x34')]={'audioEncoding':_0xad5b('0x35'),'sampleRateHertz':0x1f40};var _0x16ef77={'url':_0x65025b+_0xad5b('0x36')+_0x4c62a0,'method':_0xad5b('0x37'),'json':!![],'body':_0x37dea8};return rp(_0x16ef77)[_0xad5b('0x28')](function(_0x2824f5){return new BPromise(function(_0x53a0b7,_0x2e6cd3){_0x1c6653=path['resolve'](__dirname,'tmp',rs[_0xad5b('0x24')](0x4)+'.mp3');var _0x15ebef=Buffer[_0xad5b('0x38')](_0x2824f5[_0xad5b('0x39')],_0xad5b('0x27'));return fs[_0xad5b('0x3a')](_0x1c6653,_0x15ebef,function(_0x5a31ce){_0x2e6cd3(_0x5a31ce);},function(_0x63eb33){fs[_0xad5b('0x2a')](_0x1c6653,'777');_0x53a0b7(_0x63eb33);});});})[_0xad5b('0x28')](function(_0x4e98da){_0x3de8ff=path['resolve'](__dirname,_0xad5b('0x23'),rs['generate'](0x4)+_0xad5b('0x25'));return convertFile(_0x1c6653,_0x3de8ff);})[_0xad5b('0x28')](function(){try{fs['unlink'](_0x1c6653);fs[_0xad5b('0x2a')](_0x3de8ff,_0xad5b('0x2b'));}catch(_0x1c03b2){logger[_0xad5b('0x13')](_0x1c03b2);}logger[_0xad5b('0x20')](_0xad5b('0x3b'),_0x3de8ff[_0xad5b('0x2c')]('.')[0x0]);return _0x3de8ff['split']('.')[0x0];});};exports['googleTTS']=function(_0x224b6b,_0x40013f){var _0x1f40f6=_0xad5b('0x3c');var _0x1182fc,_0x833ae5;var _0x15b99d;var _0x401e81={'encoding':_0xad5b('0x3d'),'method':_0xad5b('0x37'),'timeout':0x2710,'url':_0x1f40f6,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0xad5b('0x3e')]([[[_0xad5b('0x3f'),JSON['stringify']([_0x224b6b,_0x40013f||'en',![],_0xad5b('0x40')]),null,_0xad5b('0x41')]]]))};return rp(_0x401e81)[_0xad5b('0x28')](function(_0x37681e){try{_0x15b99d=eval(_0x37681e['slice'](0x5))[0x0][0x2];}catch(_0x3b0e6b){throw new Error(_0xad5b('0x42')+_0x37681e[_0xad5b('0x1b')]);}if(!_0x15b99d){if(_0x224b6b[_0xad5b('0x43')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xad5b('0x44')+_0x40013f+_0xad5b('0x45'));}}try{_0x15b99d=eval(_0x15b99d)[0x0];}catch(_0x5a74e5){throw new Error(_0xad5b('0x42')+res[_0xad5b('0x1b')]);}const _0xe58001=_0x15b99d;_0x1182fc=path[_0xad5b('0x22')](__dirname,_0xad5b('0x23'),rs[_0xad5b('0x24')](0x4)+_0xad5b('0x46'));fs[_0xad5b('0x26')](_0x1182fc,_0x15b99d,{'encoding':_0xad5b('0x27')});_0x833ae5=path['resolve'](__dirname,_0xad5b('0x23'),rs[_0xad5b('0x24')](0x4)+'.wav');return convertFile(_0x1182fc,_0x833ae5);})['then'](function(){try{fs[_0xad5b('0x29')](_0x1182fc);fs['chmodSync'](_0x833ae5,_0xad5b('0x2b'));}catch(_0x15e8e){logger['error'](_0x15e8e);}logger[_0xad5b('0x20')]('goggleTTS\x20path',_0x833ae5[_0xad5b('0x2c')]('.')[0x0]);return _0x833ae5[_0xad5b('0x2c')]('.')[0x0];});};exports[_0xad5b('0x47')]=function(_0x29c356,_0x5b1589,_0x3183d9){return google[_0xad5b('0x48')](_0x29c356,_0x5b1589,_0x3183d9)[_0xad5b('0x28')](function(_0x354de8){logger[_0xad5b('0x20')](_0x354de8[_0xad5b('0x49')]);return rp(_0x354de8);})[_0xad5b('0x28')](function(_0x2cd9a9){var _0x148719='';var _0x35b221=0x0;try{fs[_0xad5b('0x29')](_0x29c356);}catch(_0x213cc7){logger[_0xad5b('0x13')](_0x213cc7);}if(_0x2cd9a9&&_0x2cd9a9['results']){_0x148719=_0x2cd9a9['results']['map'](function(_0x48b1ac){return _0x48b1ac&&_0x48b1ac['alternatives'][0x0]&&_0x48b1ac[_0xad5b('0x4a')][0x0][_0xad5b('0x4b')]?_0x48b1ac[_0xad5b('0x4a')][0x0][_0xad5b('0x4b')]:'';})['join']('\x0a');_0x35b221=_0x2cd9a9[_0xad5b('0x4c')]['map'](function(_0x5b40c6){return _0x5b40c6&&_0x5b40c6[_0xad5b('0x4a')][0x0]&&_0x5b40c6[_0xad5b('0x4a')][0x0]['confidence']?_0x5b40c6[_0xad5b('0x4a')][0x0][_0xad5b('0x4d')]:0x0;})[_0xad5b('0x4e')]('\x0a');}logger[_0xad5b('0x20')](_0xad5b('0x4f'),_0x148719);logger['info']('googleASR\x20confidence',_0x35b221);return{'transcript':_0x148719,'confidence':_0x35b221};})[_0xad5b('0x50')](function(_0xdbf1f2){logger[_0xad5b('0x13')]('[%s]\x20%s:%s',_0xdbf1f2[_0xad5b('0x12')],_0xdbf1f2[_0xad5b('0x51')],_0xdbf1f2[_0xad5b('0x52')]);});};exports[_0xad5b('0x53')]=function(_0x56cd6b,_0x122b95,_0x5b7c47,_0xe85af9){var _0x255fdc=apiai(_0x122b95,{'language':_0xe85af9||'en'});return _0x255fdc[_0xad5b('0x54')](_0x5b7c47,{'sessionId':md5(_0x56cd6b)})[_0xad5b('0x28')](function(_0x1b8f79){logger[_0xad5b('0x20')](JSON[_0xad5b('0x3e')](_0x1b8f79));return{'source':_0x1b8f79['result'][_0xad5b('0x55')],'resolvedQuery':_0x1b8f79[_0xad5b('0x56')]['resolvedQuery'],'action':_0x1b8f79[_0xad5b('0x56')][_0xad5b('0x57')],'actionIncomplete':_0x1b8f79[_0xad5b('0x56')][_0xad5b('0x58')],'speech':_0x1b8f79[_0xad5b('0x56')][_0xad5b('0x59')][_0xad5b('0x5a')],'score':_0x1b8f79['result'][_0xad5b('0x5b')],'statusCode':_0x1b8f79['status']['code'],'endConversation':_0x1b8f79[_0xad5b('0x56')]['metadata'][_0xad5b('0x5c')]||![],'isFallbackIntent':_0x1b8f79['result'][_0xad5b('0x5d')][_0xad5b('0x5e')]};});};exports[_0xad5b('0x5f')]=function(_0x564871,_0x182b04,_0x219cca,_0x496a18,_0x168270,_0x5a26bb){var _0x3e94ab=_0x496a18[_0xad5b('0x60')](/\\n/g,'\x0a');var _0x5daede={'credentials':{'private_key':_0x3e94ab,'client_email':_0x219cca}};var _0x19d9c7=new dialogflow[(_0xad5b('0x61'))](_0x5daede);var _0x2bdf7d=_0x19d9c7[_0xad5b('0x62')](_0x182b04,md5(_0x564871));var _0x571e19={'session':_0x2bdf7d,'queryInput':{'text':{'text':_0x168270,'languageCode':_0x5a26bb}}};return _0x19d9c7[_0xad5b('0x63')](_0x571e19)[_0xad5b('0x28')](function(_0x3ab54c){if(_0x3ab54c&&_0x3ab54c[_0xad5b('0x43')]){logger[_0xad5b('0x20')](_0xad5b('0x64'),JSON[_0xad5b('0x3e')](_0x3ab54c));var _0x4d0fa6=_0x3ab54c[0x0];if(_0x4d0fa6){var _0x2fab88={'action':_0x4d0fa6['queryResult'][_0xad5b('0x57')],'allRequiredParamsPresent':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x66')],'endConversation':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x67')]&&_0x4d0fa6['queryResult']['diagnosticInfo'][_0xad5b('0x68')]?_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x67')]['fields']['end_conversation'][_0xad5b('0x69')]:![],'fulfillmentText':_0x4d0fa6['queryResult'][_0xad5b('0x6a')],'intentName':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x6b')][_0xad5b('0x51')],'intentDisplayName':_0x4d0fa6['queryResult'][_0xad5b('0x6b')][_0xad5b('0x6c')],'isFallbackIntent':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x6b')][_0xad5b('0x6d')],'languageCode':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x6e')],'queryText':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x6f')],'responseId':_0x4d0fa6[_0xad5b('0x70')],'score':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x71')],'speech':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x6a')],'providerResponse':JSON[_0xad5b('0x3e')](_0x3ab54c)};return _0x2fab88;}}});};exports[_0xad5b('0x72')]=function(_0x222f7b,_0x51c5a2,_0x533b83,_0x5c1a0b){return tilde[_0xad5b('0x48')](_0x222f7b,_0x51c5a2,_0x533b83,_0x5c1a0b)[_0xad5b('0x28')](function(_0x2b846b){try{fs[_0xad5b('0x29')](_0x222f7b);}catch(_0x603af3){logger[_0xad5b('0x13')](_0x603af3);}logger[_0xad5b('0x20')](_0xad5b('0x73'),_0x2b846b[_0xad5b('0x4b')]);logger[_0xad5b('0x20')]('Tilde\x20ASR\x20confidence',_0x2b846b[_0xad5b('0x4d')]);return _0x2b846b;});};exports['awsPolly']=function(_0x422ab6,_0x32523e,_0x3136c5,_0x1e23a5,_0x5bd7b0,_0x10a06a){var _0x1b20c4=path[_0xad5b('0x22')](__dirname,'tmp',rs[_0xad5b('0x24')](0x4)+_0xad5b('0x46'));var _0xd7f263;return aws[_0xad5b('0x74')](_0x422ab6,_0x32523e,_0x3136c5,_0x1e23a5,_0x5bd7b0,_0x10a06a,_0x1b20c4)[_0xad5b('0x28')](function(){_0xd7f263=path['resolve'](__dirname,_0xad5b('0x23'),rs[_0xad5b('0x24')](0x4)+_0xad5b('0x25'));return convertFile(_0x1b20c4,_0xd7f263);})['then'](function(){try{fs[_0xad5b('0x29')](_0x1b20c4);fs[_0xad5b('0x2a')](_0xd7f263,_0xad5b('0x2b'));}catch(_0x53ae05){logger[_0xad5b('0x13')](_0x53ae05);}return _0xd7f263[_0xad5b('0x2c')]('.')[0x0];});};exports['awsLex']=function(_0x507a38,_0x5407b7,_0x5843bd,_0xc31eed,_0x56cffc,_0x57f38d){return aws[_0xad5b('0x75')](_0x507a38,_0x5407b7,_0x5843bd,_0xc31eed,_0x56cffc,_0x57f38d)[_0xad5b('0x28')](function(_0x51ce57){logger[_0xad5b('0x20')](JSON[_0xad5b('0x3e')](_0x51ce57));return _0x51ce57;});};exports[_0xad5b('0x76')]=function(_0x2b4b62,_0x394fb9,_0x3dc37d,_0x25c1fa){var _0x555144=util['format'](_0xad5b('0x77'),ISPEECH_API,_0x2b4b62,encodeURIComponent(_0x394fb9),_0x3dc37d,_0x25c1fa);var _0x2ff6a6=path[_0xad5b('0x22')](__dirname,_0xad5b('0x23'),rs[_0xad5b('0x24')](0x4)+'.mp3');var _0x1b066e;return downloadFile(_0x555144,_0x2ff6a6)[_0xad5b('0x28')](function(){_0x1b066e=path[_0xad5b('0x22')](__dirname,_0xad5b('0x23'),rs[_0xad5b('0x24')](0x4)+_0xad5b('0x25'));return convertFile(_0x2ff6a6,_0x1b066e);})[_0xad5b('0x28')](function(){try{fs[_0xad5b('0x29')](_0x2ff6a6);fs['chmodSync'](_0x1b066e,_0xad5b('0x2b'));}catch(_0x311482){logger[_0xad5b('0x13')](_0x311482);}return _0x1b066e[_0xad5b('0x2c')]('.')[0x0];});};exports[_0xad5b('0x78')]=function(_0x3308cf,_0x3e1ed1,_0x500f5d,_0x492bff){var _0x18cf83=util[_0xad5b('0x79')](_0xad5b('0x7a'),ISPEECH_API,_0x3e1ed1,_0x500f5d,base64Encode(_0x3308cf),_0x492bff?util[_0xad5b('0x79')](_0xad5b('0x7b'),encodeURIComponent(_0x492bff)):'freeform=3');return uploadFile(_0x18cf83)[_0xad5b('0x28')](function(_0x1a0e13){return querystring[_0xad5b('0x8')](_0x1a0e13);});};exports[_0xad5b('0x7c')]=function(_0x28140a,_0x4a2739){return sestek['nda'](_0x28140a,_0x4a2739)['then'](function(_0x2f3c9b){logger['info'](JSON[_0xad5b('0x3e')](_0x2f3c9b));var _0x5cfea7={'speech':_0x2f3c9b[_0xad5b('0x7d')],'action':_0x2f3c9b['channelData']?_0x2f3c9b['channelData'][_0xad5b('0x7e')]:undefined,'actiondata':_0x2f3c9b[_0xad5b('0x7f')]?_0x2f3c9b[_0xad5b('0x7f')][_0xad5b('0x80')]:undefined};if(_0x2f3c9b[_0xad5b('0x7f')]&&_0x2f3c9b[_0xad5b('0x7f')][_0xad5b('0x81')]){return base64Decode(_0x2f3c9b[_0xad5b('0x7f')][_0xad5b('0x81')][_0xad5b('0x82')],path[_0xad5b('0x22')](__dirname,'tmp',rs['generate'](0x4)+_0xad5b('0x25')))['then'](function(_0xeaa19a){_0x5cfea7['audiofile']=_0xeaa19a;return _0x5cfea7;});}return _0x5cfea7;});};exports[_0xad5b('0x83')]=function(){return __dirname;}; \ No newline at end of file +var _0x2801=['textRequest','result','resolvedQuery','action','fulfillment','speech','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','%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','format','freeform=3','sestekNDA','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','sox','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','pipe','end','wav','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','input','voice','audioConfig','MP3','text:synthesize','tmp','.mp3','from','audioContent','writeFile','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','split','asr','uri','results','map','alternatives','transcript','join','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x2801,0xb5));var _0x1280=function(_0x453cd1,_0x3a4163){_0x453cd1=_0x453cd1-0x0;var _0x4c3d83=_0x2801[_0x453cd1];return _0x4c3d83;};'use strict';var apiai=require(_0x1280('0x0'));var BPromise=require(_0x1280('0x1'));var dialogflow=require(_0x1280('0x2'));var fs=require('fs');var http=require(_0x1280('0x3'));var https=require(_0x1280('0x4'));var md5=require(_0x1280('0x5'));var path=require(_0x1280('0x6'));var querystring=require('querystring');var rp=require(_0x1280('0x7'));var rs=require(_0x1280('0x8'));var sox=require(_0x1280('0x9'));var tts=require('google-tts-api');var urlParse=require('url')[_0x1280('0xa')];var util=require(_0x1280('0xb'));var aws=require(_0x1280('0xc'));var google=require(_0x1280('0xd'));var sestek=require(_0x1280('0xe'));var tilde=require('./tilde');var logger=require(_0x1280('0xf'))(_0x1280('0x10'));var ISPEECH_API=_0x1280('0x11');function downloadFile(_0x4912e7,_0x5428c9){return new BPromise(function(_0x6a7efd,_0x423c04){var _0x565556=urlParse(_0x4912e7);var _0x343fdf=_0x565556[_0x1280('0x12')]===_0x1280('0x13')?https:http;var _0x277398={'host':_0x565556[_0x1280('0x14')],'path':_0x565556[_0x1280('0x6')],'headers':{'user-agent':_0x1280('0x15')}};_0x343fdf[_0x1280('0x16')](_0x277398,function(_0x9697d2){if(_0x9697d2['statusCode']!==0xc8){logger[_0x1280('0x17')](_0x1280('0x18')+_0x4912e7+_0x1280('0x19')+_0x9697d2[_0x1280('0x1a')]+'\x20('+_0x9697d2[_0x1280('0x1b')]+')');_0x423c04(new Error(_0x1280('0x18')+_0x4912e7+_0x1280('0x19')+_0x9697d2[_0x1280('0x1a')]+'\x20('+_0x9697d2[_0x1280('0x1b')]+')'));return;}var _0x38212d=fs[_0x1280('0x1c')](_0x5428c9);_0x38212d['on'](_0x1280('0x1d'),function(){logger[_0x1280('0x1e')](_0x1280('0x1f'));_0x38212d[_0x1280('0x20')](_0x6a7efd);});_0x38212d['on'](_0x1280('0x17'),function(_0x530129){fs['unlink'](_0x5428c9);logger[_0x1280('0x17')](_0x1280('0x21'),_0x530129);_0x423c04(_0x530129);});_0x9697d2[_0x1280('0x22')](_0x38212d);})['on']('error',function(_0x443a81){logger[_0x1280('0x17')](_0x443a81);_0x423c04(_0x443a81);})[_0x1280('0x23')]();});}function uploadFile(_0x570ecc){return new BPromise(function(_0x2bd70f,_0x234d61){var _0xca1d38=urlParse(_0x570ecc);var _0x12a6d9=_0xca1d38[_0x1280('0x12')]===_0x1280('0x13')?https:http;var _0x2218a1={'host':_0xca1d38[_0x1280('0x14')],'path':_0xca1d38[_0x1280('0x6')],'headers':{'user-agent':_0x1280('0x15')}};_0x12a6d9[_0x1280('0x16')](_0x2218a1,function(_0x323127){if(_0x323127['statusCode']!==0xc8){_0x234d61(new Error(_0x1280('0x18')+_0x570ecc+'\x20failed,\x20status\x20code\x20=\x20'+_0x323127[_0x1280('0x1a')]+'\x20('+_0x323127[_0x1280('0x1b')]+')'));return;}var _0x1e1c56='';_0x323127['on']('data',function(_0x2c7d3e){_0x1e1c56+=_0x2c7d3e;});_0x323127['on']('end',function(){_0x2bd70f(_0x1e1c56);});})['on']('error',function(_0x364dfc){_0x234d61(_0x364dfc);})[_0x1280('0x23')]();});}function convertFile(_0xe0a47d,_0x483573){return new BPromise(function(_0x5b109c,_0x32d1e5){var _0x27bfb3=sox['transcode'](_0xe0a47d,_0x483573,{'sampleRate':0x1f40,'format':_0x1280('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x27bfb3['on']('error',function(_0x20f91c){logger['error'](_0x1280('0x25'),_0x20f91c);_0x32d1e5(_0x20f91c);});_0x27bfb3['on']('end',function(){logger[_0x1280('0x1e')](_0x1280('0x26'));_0x5b109c();});_0x27bfb3[_0x1280('0x27')]();});}function base64Decode(_0x5cf26b,_0x5f0745){var _0x1ae624=path[_0x1280('0x28')](__dirname,'tmp',rs[_0x1280('0x29')](0x4)+_0x1280('0x2a'));fs[_0x1280('0x2b')](_0x1ae624,_0x5cf26b,_0x1280('0x2c'));return convertFile(_0x1ae624,_0x5f0745)[_0x1280('0x2d')](function(){try{fs[_0x1280('0x2e')](_0x1ae624);fs[_0x1280('0x2f')](_0x5f0745,_0x1280('0x30'));}catch(_0x47efd9){logger['error'](_0x47efd9);}return _0x5f0745['split']('.')[0x0];});}function base64Encode(_0x31167e){var _0x290624=fs['readFileSync'](_0x31167e);return new Buffer(_0x290624)['toString']('base64');}exports['googleCloudTTS']=function(_0x14d6c8,_0x389757,_0x3138c5,_0x38a35a,_0x3f3f74,_0x123bbb){var _0x1e2af9,_0x24cc01;var _0x2a9b09='https://texttospeech.googleapis.com/v1/';var _0x2db23f='?key='+_0x14d6c8;var _0x13d33a={};if(_0x389757==='ssml'){_0x13d33a[_0x1280('0x31')]={'ssml':_0x3138c5};}else{_0x13d33a['input']={'text':_0x3138c5};};_0x13d33a[_0x1280('0x32')]={'languageCode':_0x38a35a,'ssmlGender':_0x3f3f74};_0x13d33a[_0x1280('0x33')]={'audioEncoding':_0x1280('0x34'),'sampleRateHertz':0x1f40};var _0x51e549={'url':_0x2a9b09+_0x1280('0x35')+_0x2db23f,'method':'POST','json':!![],'body':_0x13d33a};return rp(_0x51e549)[_0x1280('0x2d')](function(_0x5128e6){return new BPromise(function(_0x4c97a1,_0x17c4ed){_0x1e2af9=path[_0x1280('0x28')](__dirname,_0x1280('0x36'),rs[_0x1280('0x29')](0x4)+_0x1280('0x37'));var _0x463cdd=Buffer[_0x1280('0x38')](_0x5128e6[_0x1280('0x39')],_0x1280('0x2c'));return fs[_0x1280('0x3a')](_0x1e2af9,_0x463cdd,function(_0x2490aa){_0x17c4ed(_0x2490aa);},function(_0x5c5fd9){fs[_0x1280('0x2f')](_0x1e2af9,_0x1280('0x30'));_0x4c97a1(_0x5c5fd9);});});})['then'](function(_0x59a232){_0x24cc01=path[_0x1280('0x28')](__dirname,_0x1280('0x36'),rs[_0x1280('0x29')](0x4)+_0x1280('0x2a'));return convertFile(_0x1e2af9,_0x24cc01);})[_0x1280('0x2d')](function(){try{fs[_0x1280('0x2e')](_0x1e2af9);fs['chmodSync'](_0x24cc01,_0x1280('0x30'));}catch(_0x17b88e){logger[_0x1280('0x17')](_0x17b88e);}logger[_0x1280('0x1e')]('googleCloudTTS\x20path',_0x24cc01['split']('.')[0x0]);return _0x24cc01['split']('.')[0x0];});};exports['googleTTS']=function(_0x1cb657,_0x4c6a6c){var _0x4eaa9a=_0x1280('0x3b');var _0x19532f,_0x1eee69;var _0xfe796d;var _0x126182={'encoding':'utf8','method':_0x1280('0x3c'),'timeout':0x2710,'url':_0x4eaa9a,'headers':{'Content-Type':_0x1280('0x3d')},'body':_0x1280('0x3e')+encodeURIComponent(JSON[_0x1280('0x3f')]([[[_0x1280('0x40'),JSON[_0x1280('0x3f')]([_0x1cb657,_0x4c6a6c||'en',![],_0x1280('0x41')]),null,'generic']]]))};return rp(_0x126182)[_0x1280('0x2d')](function(_0xd34007){try{_0xfe796d=eval(_0xd34007['slice'](0x5))[0x0][0x2];}catch(_0x1a0b2e){throw new Error(_0x1280('0x42')+_0xd34007[_0x1280('0x43')]);}if(!_0xfe796d){if(_0x1cb657[_0x1280('0x44')]>0xc8){throw new Error(_0x1280('0x45'));}else{throw new Error('lang\x20\x22'+_0x4c6a6c+_0x1280('0x46'));}}try{_0xfe796d=eval(_0xfe796d)[0x0];}catch(_0x2231ac){throw new Error(_0x1280('0x42')+res[_0x1280('0x43')]);}const _0x4af88d=_0xfe796d;_0x19532f=path[_0x1280('0x28')](__dirname,_0x1280('0x36'),rs['generate'](0x4)+_0x1280('0x37'));fs[_0x1280('0x2b')](_0x19532f,_0xfe796d,{'encoding':_0x1280('0x2c')});_0x1eee69=path[_0x1280('0x28')](__dirname,'tmp',rs[_0x1280('0x29')](0x4)+_0x1280('0x2a'));return convertFile(_0x19532f,_0x1eee69);})[_0x1280('0x2d')](function(){try{fs[_0x1280('0x2e')](_0x19532f);fs[_0x1280('0x2f')](_0x1eee69,_0x1280('0x30'));}catch(_0x89606e){logger[_0x1280('0x17')](_0x89606e);}logger[_0x1280('0x1e')](_0x1280('0x47'),_0x1eee69[_0x1280('0x48')]('.')[0x0]);return _0x1eee69[_0x1280('0x48')]('.')[0x0];});};exports['googleASR']=function(_0x2cb5e0,_0x313812,_0x366903){return google[_0x1280('0x49')](_0x2cb5e0,_0x313812,_0x366903)[_0x1280('0x2d')](function(_0x2a0919){logger[_0x1280('0x1e')](_0x2a0919[_0x1280('0x4a')]);return rp(_0x2a0919);})[_0x1280('0x2d')](function(_0x77866f){var _0x4661ee='';var _0x392904=0x0;try{fs[_0x1280('0x2e')](_0x2cb5e0);}catch(_0x11695f){logger[_0x1280('0x17')](_0x11695f);}if(_0x77866f&&_0x77866f[_0x1280('0x4b')]){_0x4661ee=_0x77866f['results'][_0x1280('0x4c')](function(_0x2dca9f){return _0x2dca9f&&_0x2dca9f[_0x1280('0x4d')][0x0]&&_0x2dca9f['alternatives'][0x0][_0x1280('0x4e')]?_0x2dca9f['alternatives'][0x0][_0x1280('0x4e')]:'';})[_0x1280('0x4f')]('\x0a');_0x392904=_0x77866f[_0x1280('0x4b')][_0x1280('0x4c')](function(_0x2eaa04){return _0x2eaa04&&_0x2eaa04['alternatives'][0x0]&&_0x2eaa04[_0x1280('0x4d')][0x0]['confidence']?_0x2eaa04[_0x1280('0x4d')][0x0]['confidence']:0x0;})[_0x1280('0x4f')]('\x0a');}logger[_0x1280('0x1e')](_0x1280('0x50'),_0x4661ee);logger[_0x1280('0x1e')](_0x1280('0x51'),_0x392904);return{'transcript':_0x4661ee,'confidence':_0x392904};})['catch'](function(_0x28c6e2){logger[_0x1280('0x17')](_0x1280('0x52'),_0x28c6e2['statusCode'],_0x28c6e2[_0x1280('0x53')],_0x28c6e2[_0x1280('0x54')]);});};exports['googleDialogflow']=function(_0x2e0852,_0x416aa3,_0x574baa,_0x130744){var _0x1b33f3=apiai(_0x416aa3,{'language':_0x130744||'en'});return _0x1b33f3[_0x1280('0x55')](_0x574baa,{'sessionId':md5(_0x2e0852)})[_0x1280('0x2d')](function(_0x1c03bb){logger[_0x1280('0x1e')](JSON['stringify'](_0x1c03bb));return{'source':_0x1c03bb[_0x1280('0x56')]['source'],'resolvedQuery':_0x1c03bb[_0x1280('0x56')][_0x1280('0x57')],'action':_0x1c03bb['result'][_0x1280('0x58')],'actionIncomplete':_0x1c03bb[_0x1280('0x56')]['actionIncomplete'],'speech':_0x1c03bb[_0x1280('0x56')][_0x1280('0x59')][_0x1280('0x5a')],'score':_0x1c03bb[_0x1280('0x56')][_0x1280('0x5b')],'statusCode':_0x1c03bb[_0x1280('0x5c')][_0x1280('0x5d')],'endConversation':_0x1c03bb['result']['metadata'][_0x1280('0x5e')]||![],'isFallbackIntent':_0x1c03bb[_0x1280('0x56')][_0x1280('0x5f')][_0x1280('0x60')]};});};exports[_0x1280('0x61')]=function(_0x215d2a,_0x430917,_0x151069,_0x40343b,_0x1d4b11,_0x2a9483){var _0x2a9b80=_0x40343b[_0x1280('0x62')](/\\n/g,'\x0a');var _0x3ace0c={'credentials':{'private_key':_0x2a9b80,'client_email':_0x151069}};var _0x35e28b=new dialogflow[(_0x1280('0x63'))](_0x3ace0c);var _0x4681d2=_0x35e28b[_0x1280('0x64')](_0x430917,md5(_0x215d2a));var _0x5277af={'session':_0x4681d2,'queryInput':{'text':{'text':_0x1d4b11,'languageCode':_0x2a9483}}};return _0x35e28b['detectIntent'](_0x5277af)[_0x1280('0x2d')](function(_0x3f1717){if(_0x3f1717&&_0x3f1717[_0x1280('0x44')]){logger[_0x1280('0x1e')](_0x1280('0x65'),JSON[_0x1280('0x3f')](_0x3f1717));var _0x1ba358=_0x3f1717[0x0];if(_0x1ba358){var _0x50ff95={'action':_0x1ba358[_0x1280('0x66')][_0x1280('0x58')],'allRequiredParamsPresent':_0x1ba358[_0x1280('0x66')][_0x1280('0x67')],'endConversation':_0x1ba358[_0x1280('0x66')][_0x1280('0x68')]&&_0x1ba358[_0x1280('0x66')]['diagnosticInfo']['fields']?_0x1ba358[_0x1280('0x66')]['diagnosticInfo'][_0x1280('0x69')][_0x1280('0x6a')]['boolValue']:![],'fulfillmentText':_0x1ba358[_0x1280('0x66')][_0x1280('0x6b')],'intentName':_0x1ba358[_0x1280('0x66')][_0x1280('0x6c')][_0x1280('0x53')],'intentDisplayName':_0x1ba358[_0x1280('0x66')]['intent'][_0x1280('0x6d')],'isFallbackIntent':_0x1ba358[_0x1280('0x66')][_0x1280('0x6c')][_0x1280('0x6e')],'languageCode':_0x1ba358[_0x1280('0x66')][_0x1280('0x6f')],'queryText':_0x1ba358[_0x1280('0x66')][_0x1280('0x70')],'responseId':_0x1ba358[_0x1280('0x71')],'score':_0x1ba358[_0x1280('0x66')][_0x1280('0x72')],'speech':_0x1ba358[_0x1280('0x66')]['fulfillmentText'],'providerResponse':JSON[_0x1280('0x3f')](_0x3f1717)};return _0x50ff95;}}});};exports[_0x1280('0x73')]=function(_0x29129e,_0x18efa5,_0x59c970,_0x24ab73){return tilde[_0x1280('0x49')](_0x29129e,_0x18efa5,_0x59c970,_0x24ab73)[_0x1280('0x2d')](function(_0x1b5d41){try{fs[_0x1280('0x2e')](_0x29129e);}catch(_0x52c5bd){logger[_0x1280('0x17')](_0x52c5bd);}logger['info'](_0x1280('0x74'),_0x1b5d41['transcript']);logger[_0x1280('0x1e')](_0x1280('0x75'),_0x1b5d41['confidence']);return _0x1b5d41;});};exports[_0x1280('0x76')]=function(_0x17a698,_0x532d5c,_0x32e242,_0x40ec65,_0x3fe698,_0x36a7af){var _0x5eeebc=path[_0x1280('0x28')](__dirname,_0x1280('0x36'),rs[_0x1280('0x29')](0x4)+'.mp3');var _0x4be41e;return aws['polly'](_0x17a698,_0x532d5c,_0x32e242,_0x40ec65,_0x3fe698,_0x36a7af,_0x5eeebc)[_0x1280('0x2d')](function(){_0x4be41e=path[_0x1280('0x28')](__dirname,_0x1280('0x36'),rs[_0x1280('0x29')](0x4)+_0x1280('0x2a'));return convertFile(_0x5eeebc,_0x4be41e);})[_0x1280('0x2d')](function(){try{fs[_0x1280('0x2e')](_0x5eeebc);fs[_0x1280('0x2f')](_0x4be41e,_0x1280('0x30'));}catch(_0x42c149){logger[_0x1280('0x17')](_0x42c149);}return _0x4be41e[_0x1280('0x48')]('.')[0x0];});};exports[_0x1280('0x77')]=function(_0x3c639e,_0x36e365,_0x865fac,_0x586ef6,_0x4ad0d2,_0x44f783){return aws[_0x1280('0x78')](_0x3c639e,_0x36e365,_0x865fac,_0x586ef6,_0x4ad0d2,_0x44f783)[_0x1280('0x2d')](function(_0x48407e){logger[_0x1280('0x1e')](JSON[_0x1280('0x3f')](_0x48407e));return _0x48407e;});};exports['ispeechTTS']=function(_0x377e19,_0x49878f,_0xf7d27e,_0x4925e0){var _0x49606=util['format'](_0x1280('0x79'),ISPEECH_API,_0x377e19,encodeURIComponent(_0x49878f),_0xf7d27e,_0x4925e0);var _0x1e8685=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x1280('0x37'));var _0x53a9ca;return downloadFile(_0x49606,_0x1e8685)['then'](function(){_0x53a9ca=path['resolve'](__dirname,_0x1280('0x36'),rs[_0x1280('0x29')](0x4)+_0x1280('0x2a'));return convertFile(_0x1e8685,_0x53a9ca);})[_0x1280('0x2d')](function(){try{fs[_0x1280('0x2e')](_0x1e8685);fs[_0x1280('0x2f')](_0x53a9ca,'777');}catch(_0x1912b7){logger[_0x1280('0x17')](_0x1912b7);}return _0x53a9ca[_0x1280('0x48')]('.')[0x0];});};exports['ispeechASR']=function(_0xc0a5f2,_0x3f64ff,_0x377b23,_0xd32db7){var _0x62f2d4=util['format'](_0x1280('0x7a'),ISPEECH_API,_0x3f64ff,_0x377b23,base64Encode(_0xc0a5f2),_0xd32db7?util[_0x1280('0x7b')]('model=%s',encodeURIComponent(_0xd32db7)):_0x1280('0x7c'));return uploadFile(_0x62f2d4)[_0x1280('0x2d')](function(_0x34d0b4){return querystring[_0x1280('0xa')](_0x34d0b4);});};exports[_0x1280('0x7d')]=function(_0x366190,_0x234bac){return sestek['nda'](_0x366190,_0x234bac)[_0x1280('0x2d')](function(_0x33d70c){logger[_0x1280('0x1e')](JSON['stringify'](_0x33d70c));var _0x466994={'speech':_0x33d70c[_0x1280('0x7e')],'action':_0x33d70c[_0x1280('0x7f')]?_0x33d70c[_0x1280('0x7f')][_0x1280('0x80')]:undefined,'actiondata':_0x33d70c['channelData']?_0x33d70c[_0x1280('0x7f')]['CustomActionData']:undefined};if(_0x33d70c[_0x1280('0x7f')]&&_0x33d70c[_0x1280('0x7f')][_0x1280('0x81')]){return base64Decode(_0x33d70c[_0x1280('0x7f')][_0x1280('0x81')][_0x1280('0x82')],path['resolve'](__dirname,_0x1280('0x36'),rs[_0x1280('0x29')](0x4)+_0x1280('0x2a')))[_0x1280('0x2d')](function(_0x316f39){_0x466994[_0x1280('0x83')]=_0x316f39;return _0x466994;});}return _0x466994;});};exports[_0x1280('0x84')]=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 fc9297e..7748efb 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 _0x2d7b=['exports'];(function(_0x549d16,_0x4d069a){var _0x344ccc=function(_0x1d992a){while(--_0x1d992a){_0x549d16['push'](_0x549d16['shift']());}};_0x344ccc(++_0x4d069a);}(_0x2d7b,0x19b));var _0xb2d7=function(_0x2b50be,_0x4e3d61){_0x2b50be=_0x2b50be-0x0;var _0x212cd4=_0x2d7b[_0x2b50be];return _0x212cd4;};var nda=require('./nda');module[_0xb2d7('0x0')]={'nda':nda}; \ No newline at end of file +var _0xdede=['./nda','exports'];(function(_0x17ea55,_0x305b46){var _0x166f40=function(_0x37e2d6){while(--_0x37e2d6){_0x17ea55['push'](_0x17ea55['shift']());}};_0x166f40(++_0x305b46);}(_0xdede,0x1cc));var _0xeded=function(_0x41e23b,_0x2ba2eb){_0x41e23b=_0x41e23b-0x0;var _0x147d9d=_0xdede[_0x41e23b];return _0x147d9d;};var nda=require(_0xeded('0x0'));module[_0xeded('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 4e4d984..7c42887 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 _0xa0bf=['calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','agi','POST','resolve','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid'];(function(_0x33d928,_0x2b289c){var _0x4c2316=function(_0x901667){while(--_0x901667){_0x33d928['push'](_0x33d928['shift']());}};_0x4c2316(++_0x2b289c);}(_0xa0bf,0x92));var _0xfa0b=function(_0x36e2b9,_0xc2d2a4){_0x36e2b9=_0x36e2b9-0x0;var _0x265d5d=_0xa0bf[_0x36e2b9];return _0x265d5d;};'use strict';var rp=require(_0xfa0b('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0xfa0b('0x1'));module['exports']=function(_0x37280c,_0x2de3e4){var _0x18c6af={'method':_0xfa0b('0x2'),'uri':url[_0xfa0b('0x3')](_0x2de3e4['ndauth_url'],'/token'),'form':{'grant_type':_0xfa0b('0x4'),'username':_0x2de3e4[_0xfa0b('0x5')],'password':_0x2de3e4[_0xfa0b('0x4')]},'json':!![]};return rp(_0x18c6af)[_0xfa0b('0x6')](function(_0x530f58){var _0x34fa78={'method':'POST','uri':url[_0xfa0b('0x3')](_0x2de3e4[_0xfa0b('0x7')],_0xfa0b('0x8')),'body':{'type':_0x2de3e4[_0xfa0b('0x9')]||_0xfa0b('0xa'),'channelId':_0xfa0b('0xb'),'conversation':{'id':_0x37280c[_0xfa0b('0xc')]},'from':{'id':_0x37280c[_0xfa0b('0xd')],'name':_0x37280c[_0xfa0b('0xe')]},'recipient':{'id':_0x37280c[_0xfa0b('0xf')],'name':_0x37280c[_0xfa0b('0x10')]},'text':_0x2de3e4[_0xfa0b('0x11')],'channelData':{}},'headers':{'Authorization':_0xfa0b('0x12')+_0x530f58[_0xfa0b('0x13')]},'json':!![]};if(_0x2de3e4[_0xfa0b('0x14')]){_0x34fa78[_0xfa0b('0x15')][_0xfa0b('0x16')][_0xfa0b('0x17')]=_0x2de3e4[_0xfa0b('0x14')];}if(_0x2de3e4[_0xfa0b('0x18')]=='1'){_0x34fa78[_0xfa0b('0x15')][_0xfa0b('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xfa0b('0x19')};}if(_0x2de3e4[_0xfa0b('0x1a')]){_0x34fa78[_0xfa0b('0x15')][_0xfa0b('0x16')][_0xfa0b('0x1b')]=_0x2de3e4[_0xfa0b('0x1a')];if(_0x2de3e4[_0xfa0b('0x1c')]){_0x34fa78[_0xfa0b('0x15')][_0xfa0b('0x16')][_0xfa0b('0x1d')]=_0x2de3e4[_0xfa0b('0x1c')];}}logger[_0xfa0b('0x1e')](JSON[_0xfa0b('0x1f')](_0x34fa78));return rp(_0x34fa78);});}; \ No newline at end of file +var _0x6f0e=['custom_action_data','info','stringify','request-promise','../../../../../config/logger','agi','exports','resolve','ndauth_url','password','username','then','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','Bearer\x20','access_token','body','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction'];(function(_0x46c6b7,_0x24d9bb){var _0x33cb0c=function(_0x586dfd){while(--_0x586dfd){_0x46c6b7['push'](_0x46c6b7['shift']());}};_0x33cb0c(++_0x24d9bb);}(_0x6f0e,0x18f));var _0xe6f0=function(_0x20e811,_0x112ad9){_0x20e811=_0x20e811-0x0;var _0x254301=_0x6f0e[_0x20e811];return _0x254301;};'use strict';var rp=require(_0xe6f0('0x0'));var url=require('url');var logger=require(_0xe6f0('0x1'))(_0xe6f0('0x2'));module[_0xe6f0('0x3')]=function(_0x8dddc1,_0x56c17c){var _0x3032c9={'method':'POST','uri':url[_0xe6f0('0x4')](_0x56c17c[_0xe6f0('0x5')],'/token'),'form':{'grant_type':_0xe6f0('0x6'),'username':_0x56c17c[_0xe6f0('0x7')],'password':_0x56c17c[_0xe6f0('0x6')]},'json':!![]};return rp(_0x3032c9)[_0xe6f0('0x8')](function(_0x49ef76){var _0x58be44={'method':_0xe6f0('0x9'),'uri':url['resolve'](_0x56c17c['ndassistant_url'],_0xe6f0('0xa')),'body':{'type':_0x56c17c[_0xe6f0('0xb')]||_0xe6f0('0xc'),'channelId':_0xe6f0('0xd'),'conversation':{'id':_0x8dddc1[_0xe6f0('0xe')]},'from':{'id':_0x8dddc1[_0xe6f0('0xf')],'name':_0x8dddc1[_0xe6f0('0x10')]},'recipient':{'id':_0x8dddc1[_0xe6f0('0x11')],'name':_0x8dddc1[_0xe6f0('0x12')]},'text':_0x56c17c['text'],'channelData':{}},'headers':{'Authorization':_0xe6f0('0x13')+_0x49ef76[_0xe6f0('0x14')]},'json':!![]};if(_0x56c17c['project']){_0x58be44[_0xe6f0('0x15')][_0xe6f0('0x16')][_0xe6f0('0x17')]=_0x56c17c[_0xe6f0('0x18')];}if(_0x56c17c[_0xe6f0('0x19')]=='1'){_0x58be44[_0xe6f0('0x15')][_0xe6f0('0x16')][_0xe6f0('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe6f0('0x1b')};}if(_0x56c17c[_0xe6f0('0x1c')]){_0x58be44[_0xe6f0('0x15')]['channelData'][_0xe6f0('0x1d')]=_0x56c17c[_0xe6f0('0x1c')];if(_0x56c17c[_0xe6f0('0x1e')]){_0x58be44[_0xe6f0('0x15')]['channelData']['CustomActionData']=_0x56c17c['custom_action_data'];}}logger[_0xe6f0('0x1f')](JSON[_0xe6f0('0x20')](_0x58be44));return rp(_0x58be44);});}; \ 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 af40c03..4f524b1 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 _0x1eaa=['exports'];(function(_0x17abc2,_0xa835c5){var _0x516419=function(_0x19a2e9){while(--_0x19a2e9){_0x17abc2['push'](_0x17abc2['shift']());}};_0x516419(++_0xa835c5);}(_0x1eaa,0x1f0));var _0xa1ea=function(_0x455582,_0xe40e92){_0x455582=_0x455582-0x0;var _0x4048ff=_0x1eaa[_0x455582];return _0x4048ff;};'use strict';var asr=require('./lib/api');module[_0xa1ea('0x0')]=function(_0x3fa40c,_0x2dd0db,_0x2c1b5a,_0x377120){return asr(_0x3fa40c,_0x2dd0db,_0x2c1b5a,_0x377120);}; \ No newline at end of file +var _0x0605=['./lib/api','exports'];(function(_0x177a40,_0x264f86){var _0x393e6b=function(_0x58f5bd){while(--_0x58f5bd){_0x177a40['push'](_0x177a40['shift']());}};_0x393e6b(++_0x264f86);}(_0x0605,0x1c2));var _0x5060=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x0605[_0x2160a9];return _0xa88cf7;};'use strict';var asr=require(_0x5060('0x0'));module[_0x5060('0x1')]=function(_0x5916e5,_0x31b390,_0x619dd7,_0x9b8452){return asr(_0x5916e5,_0x31b390,_0x619dd7,_0x9b8452);}; \ 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 49117f9..224baf3 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 _0xbd1f=['Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','bluebird','lodash','moment','../../../../../../config/logger','agi','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error'];(function(_0x462f40,_0x43ae99){var _0xa930e3=function(_0x2223a3){while(--_0x2223a3){_0x462f40['push'](_0x462f40['shift']());}};_0xa930e3(++_0x43ae99);}(_0xbd1f,0x139));var _0xfbd1=function(_0x508c11,_0x308545){_0x508c11=_0x508c11-0x0;var _0x438f65=_0xbd1f[_0x508c11];return _0x438f65;};'use strict';var BPromise=require(_0xfbd1('0x0'));var _=require(_0xfbd1('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xfbd1('0x2'));var crypto=require('crypto');var logger=require(_0xfbd1('0x3'))(_0xfbd1('0x4'));module['exports']=function(_0x4524a9,_0x261954,_0x3b14cb,_0x5942ce){return new BPromise(function(_0x651bcd,_0x29be70){logger[_0xfbd1('0x5')]('Tilde\x20URI',_0x5942ce||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x3c5b5a=new WebSocket(_0x5942ce||_0xfbd1('0x6'),{'perMessageDeflate':![]});var _0x41b2a2='';var _0x43de97='0';var _0x447fe2='1';var _0x471a05=_0xfbd1('0x7');function _0x441945(_0x1fc8f5){var _0x1dddb0=crypto[_0xfbd1('0x8')]('sha1');_0x1dddb0[_0xfbd1('0x9')](_0x1fc8f5);return _0x1dddb0[_0xfbd1('0xa')](_0xfbd1('0xb'));}function _0x20242c(){try{logger[_0xfbd1('0x5')](_0xfbd1('0xc'));var _0x3911ee=moment()[_0xfbd1('0xd')]();var _0x3b263e=_0x441945(_0x3911ee+_0x261954+_0x3b14cb);_0x3c5b5a[_0xfbd1('0xe')](JSON['stringify']({'appID':_0x261954,'timestamp':_0x3911ee,'appKey':_0x3b263e}));var _0x32f1e7=fs[_0xfbd1('0xf')](_0x4524a9);_0x32f1e7['on'](_0xfbd1('0x10'),function(_0x4bd7a2){_0x3c5b5a[_0xfbd1('0xe')](_0x4bd7a2);});_0x32f1e7['on'](_0xfbd1('0x11'),function(){_0x3c5b5a['send'](_0xfbd1('0x12'));});}catch(_0x58dc2e){logger[_0xfbd1('0x13')](_0xfbd1('0x14'),JSON[_0xfbd1('0x15')](_0x58dc2e));_0x3c5b5a[_0xfbd1('0x16')]();}}function _0x55c34b(_0x2d2925){try{if(_0x2d2925){var _0x481dc2=JSON[_0xfbd1('0x17')](_0x2d2925);switch(_0x481dc2[_0xfbd1('0x18')]){case 0x0:if(_0x481dc2[_0xfbd1('0x19')]){if(_0x481dc2[_0xfbd1('0x19')][_0xfbd1('0x1a')]){logger['info'](_0xfbd1('0x1b'),JSON[_0xfbd1('0x15')](_0x481dc2[_0xfbd1('0x19')][_0xfbd1('0x1c')]));_0x41b2a2=_0x481dc2[_0xfbd1('0x19')][_0xfbd1('0x1c')][0x0][_0xfbd1('0x1d')];_0x43de97=_0x481dc2[_0xfbd1('0x19')][_0xfbd1('0x1c')][0x0]['likelihood'];_0x447fe2='0';_0x471a05='Success.';_0x3c5b5a[_0xfbd1('0x16')]();}}break;case 0x1:logger[_0xfbd1('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x447fe2='1';_0x471a05='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xfbd1('0x5')](_0xfbd1('0x1e'));_0x447fe2='2';_0x471a05=_0xfbd1('0x1e');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x447fe2='9';_0x471a05='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0x447fe2='10';_0x471a05=_0xfbd1('0x1f');break;case 0xb:logger[_0xfbd1('0x5')](_0xfbd1('0x20'));_0x447fe2='11';_0x471a05=_0xfbd1('0x20');}}}catch(_0x2daa5b){logger[_0xfbd1('0x13')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xfbd1('0x15')](_0x2daa5b));_0x3c5b5a['terminate']();}}function _0x325b7b(){logger['info'](_0xfbd1('0x21'));_0x651bcd({'transcript':_0x41b2a2,'confidence':_0x43de97,'status':_0x447fe2,'status_message':_0x471a05});}function _0x553900(_0x119075){logger[_0xfbd1('0x13')](_0xfbd1('0x22'));if(!_['isNil'](_0x119075)){logger['error'](_[_0xfbd1('0x23')](_0x119075)?JSON[_0xfbd1('0x15')](_0x119075):_0x119075);}}_0x3c5b5a['on']('open',_0x20242c);_0x3c5b5a['on'](_0xfbd1('0x24'),_0x55c34b);_0x3c5b5a['on'](_0xfbd1('0x11'),_0x325b7b);_0x3c5b5a['on']('error',_0x553900);});}; \ No newline at end of file +var _0x4890=['Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','close','bluebird','moment','crypto','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','status','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.'];(function(_0xafd3df,_0x500365){var _0x4d90b1=function(_0xe3bc2e){while(--_0xe3bc2e){_0xafd3df['push'](_0xafd3df['shift']());}};_0x4d90b1(++_0x500365);}(_0x4890,0x19f));var _0x0489=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x4890[_0x3227c1];return _0x31fd48;};'use strict';var BPromise=require(_0x0489('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0489('0x1'));var crypto=require(_0x0489('0x2'));var logger=require('../../../../../../config/logger')('agi');module[_0x0489('0x3')]=function(_0x1fec7f,_0x18c819,_0x2ece15,_0x5b01ae){return new BPromise(function(_0x281a99,_0x5764ca){logger[_0x0489('0x4')](_0x0489('0x5'),_0x5b01ae||_0x0489('0x6'));var _0x22616e=new WebSocket(_0x5b01ae||_0x0489('0x6'),{'perMessageDeflate':![]});var _0x42cba1='';var _0x2e1c7d='0';var _0x4802f2='1';var _0x11702d=_0x0489('0x7');function _0x48895f(_0x55badd){var _0x44d63a=crypto['createHash'](_0x0489('0x8'));_0x44d63a[_0x0489('0x9')](_0x55badd);return _0x44d63a[_0x0489('0xa')](_0x0489('0xb'));}function _0x59861b(){try{logger['info'](_0x0489('0xc'));var _0x34550e=moment()[_0x0489('0xd')]();var _0x4c50e3=_0x48895f(_0x34550e+_0x18c819+_0x2ece15);_0x22616e[_0x0489('0xe')](JSON['stringify']({'appID':_0x18c819,'timestamp':_0x34550e,'appKey':_0x4c50e3}));var _0x381163=fs[_0x0489('0xf')](_0x1fec7f);_0x381163['on']('data',function(_0x5cb7ce){_0x22616e[_0x0489('0xe')](_0x5cb7ce);});_0x381163['on']('close',function(){_0x22616e['send']('EOS');});}catch(_0x21be70){logger[_0x0489('0x10')](_0x0489('0x11'),JSON[_0x0489('0x12')](_0x21be70));_0x22616e[_0x0489('0x13')]();}}function _0x1bb1f0(_0x5aa8bd){try{if(_0x5aa8bd){var _0x40a2d2=JSON['parse'](_0x5aa8bd);switch(_0x40a2d2[_0x0489('0x14')]){case 0x0:if(_0x40a2d2[_0x0489('0x15')]){if(_0x40a2d2[_0x0489('0x15')][_0x0489('0x16')]){logger[_0x0489('0x4')]('Tilde\x20ASR\x20hypoteses',JSON[_0x0489('0x12')](_0x40a2d2[_0x0489('0x15')][_0x0489('0x17')]));_0x42cba1=_0x40a2d2[_0x0489('0x15')][_0x0489('0x17')][0x0][_0x0489('0x18')];_0x2e1c7d=_0x40a2d2[_0x0489('0x15')][_0x0489('0x17')][0x0][_0x0489('0x19')];_0x4802f2='0';_0x11702d=_0x0489('0x1a');_0x22616e[_0x0489('0x13')]();}}break;case 0x1:logger[_0x0489('0x4')](_0x0489('0x7'));_0x4802f2='1';_0x11702d='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x0489('0x4')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x4802f2='2';_0x11702d=_0x0489('0x1b');break;case 0x9:logger[_0x0489('0x4')](_0x0489('0x1c'));_0x4802f2='9';_0x11702d=_0x0489('0x1c');break;case 0xa:logger['info']('Authentication\x20failed.');_0x4802f2='10';_0x11702d=_0x0489('0x1d');break;case 0xb:logger[_0x0489('0x4')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x4802f2='11';_0x11702d=_0x0489('0x1e');}}}catch(_0x527b2b){logger['error'](_0x0489('0x1f'),JSON[_0x0489('0x12')](_0x527b2b));_0x22616e[_0x0489('0x13')]();}}function _0x94cf34(){logger[_0x0489('0x4')]('Close\x20Tilde\x20ASR\x20socket');_0x281a99({'transcript':_0x42cba1,'confidence':_0x2e1c7d,'status':_0x4802f2,'status_message':_0x11702d});}function _0x58d259(_0x4237e1){logger['error'](_0x0489('0x20'));if(!_[_0x0489('0x21')](_0x4237e1)){logger[_0x0489('0x10')](_['isObject'](_0x4237e1)?JSON[_0x0489('0x12')](_0x4237e1):_0x4237e1);}}_0x22616e['on'](_0x0489('0x22'),_0x59861b);_0x22616e['on'](_0x0489('0x23'),_0x1bb1f0);_0x22616e['on'](_0x0489('0x24'),_0x94cf34);_0x22616e['on'](_0x0489('0x10'),_0x58d259);});}; \ 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 a27f2ac..07810d1 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 _0x4b1b=['exports','./asr'];(function(_0x1d1e83,_0x434d18){var _0x4cd90e=function(_0x167add){while(--_0x167add){_0x1d1e83['push'](_0x1d1e83['shift']());}};_0x4cd90e(++_0x434d18);}(_0x4b1b,0x17f));var _0xb4b1=function(_0x13da99,_0x568894){_0x13da99=_0x13da99-0x0;var _0x54d8a3=_0x4b1b[_0x13da99];return _0x54d8a3;};var asr=require(_0xb4b1('0x0'));module[_0xb4b1('0x1')]={'asr':asr}; \ No newline at end of file +var _0xf12f=['./asr','exports'];(function(_0x22adde,_0x3fb401){var _0x4e158d=function(_0x273771){while(--_0x273771){_0x22adde['push'](_0x22adde['shift']());}};_0x4e158d(++_0x3fb401);}(_0xf12f,0x104));var _0xff12=function(_0x17ab4f,_0x4b2ce8){_0x17ab4f=_0x17ab4f-0x0;var _0x4f4148=_0xf12f[_0x17ab4f];return _0x4f4148;};var asr=require(_0xff12('0x0'));module[_0xff12('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index f90fcb5..0b51556 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 _0x0d6a=['E_AGI_SERVER_CLOSE','nextTick','inherits','util','net','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','createServer','listening','getConnections','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','E_AGI_SERVER_ERROR','code','close'];(function(_0x514401,_0x2e4fba){var _0x464b38=function(_0x41450b){while(--_0x41450b){_0x514401['push'](_0x514401['shift']());}};_0x464b38(++_0x2e4fba);}(_0x0d6a,0xc9));var _0xa0d6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0d6a[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0xa0d6('0x0'));var net=require(_0xa0d6('0x1'));var EventEmitter=require('events')[_0xa0d6('0x2')];var AGIError=require(_0xa0d6('0x3'));var AGIChannel=require(_0xa0d6('0x4'));var AGIServer=function(_0xa452b8,_0x71d654,_0x236047){var _0x344b8d=this,_0xa452b8=_0xa452b8||0x11dd,_0x71d654=_0x71d654||_0xa0d6('0x5'),_0x179a70=null,_0x4857ce=0x0;EventEmitter[_0xa0d6('0x6')](_0x344b8d);function _0xba6194(){if(!_0xa452b8){_0x344b8d[_0xa0d6('0x7')](_0xa0d6('0x8'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x179a70=net[_0xa0d6('0x9')]();_0x179a70['listen'](_0xa452b8,_0x71d654);_0x179a70['on'](_0xa0d6('0xa'),function(){_0x344b8d['emit'](_0xa0d6('0xa'));});_0x179a70['on']('connection',function(_0x419a08){_0x179a70[_0xa0d6('0xb')](function(_0x25653e,_0x37e9e2){if(_0x25653e){_0x344b8d[_0xa0d6('0x7')](_0xa0d6('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x25653e));}else if(_0x236047&&_0x236047<0x0){_0x344b8d[_0xa0d6('0x7')](_0xa0d6('0x8'),new AGIError(_0xa0d6('0xc')));_0x419a08['destroy']();}else if(_0x236047&&_0x236047>0x0&&_0x236047<_0x37e9e2){_0x4857ce+=0x1;_0x344b8d[_0xa0d6('0x7')](_0xa0d6('0x8'),new AGIError(_0xa0d6('0xd'),_0x4857ce));_0x419a08[_0xa0d6('0xe')]();}else{var _0x3c3c15=new AGIChannel(_0x419a08);_0x3c3c15['on'](_0xa0d6('0xf'),function(){_0x344b8d[_0xa0d6('0x7')]('connection',_0x3c3c15);});}});});_0x179a70['on']('error',function(_0x39e63f){_0x344b8d[_0xa0d6('0x7')](_0xa0d6('0x8'),new AGIError(_0xa0d6('0x10'),_0x39e63f[_0xa0d6('0x11')]));});_0x179a70['on'](_0xa0d6('0x12'),function(){_0x344b8d[_0xa0d6('0x7')]('close',new AGIError(_0xa0d6('0x13')));});}process[_0xa0d6('0x14')](function(){_0xba6194();});};util[_0xa0d6('0x15')](AGIServer,EventEmitter);module['exports']=function(_0xf4b8e2,_0x54020a,_0x1dc618){return new AGIServer(_0xf4b8e2,_0x54020a,_0x1dc618);}; \ No newline at end of file +var _0xa0bc=['./error','./channel','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening','getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','ready','connection','close','nextTick','inherits','exports','net','events'];(function(_0x52ae40,_0x23c2bf){var _0xab6ed1=function(_0x36d880){while(--_0x36d880){_0x52ae40['push'](_0x52ae40['shift']());}};_0xab6ed1(++_0x23c2bf);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var net=require(_0xca0b('0x0'));var EventEmitter=require(_0xca0b('0x1'))['EventEmitter'];var AGIError=require(_0xca0b('0x2'));var AGIChannel=require(_0xca0b('0x3'));var AGIServer=function(_0x113486,_0x68ff4,_0x2f7b56){var _0x3a53b4=this,_0x113486=_0x113486||0x11dd,_0x68ff4=_0x68ff4||_0xca0b('0x4'),_0x3cb084=null,_0x1aac00=0x0;EventEmitter[_0xca0b('0x5')](_0x3a53b4);function _0xa506a4(){if(!_0x113486){_0x3a53b4[_0xca0b('0x6')]('error',new AGIError(_0xca0b('0x7')));return![];}_0x3cb084=net[_0xca0b('0x8')]();_0x3cb084[_0xca0b('0x9')](_0x113486,_0x68ff4);_0x3cb084['on'](_0xca0b('0xa'),function(){_0x3a53b4[_0xca0b('0x6')](_0xca0b('0xa'));});_0x3cb084['on']('connection',function(_0x31a0d1){_0x3cb084[_0xca0b('0xb')](function(_0x3a25b4,_0x18af13){if(_0x3a25b4){_0x3a53b4[_0xca0b('0x6')](_0xca0b('0xc'),new AGIError(_0xca0b('0xd'),_0x3a25b4));}else if(_0x2f7b56&&_0x2f7b56<0x0){_0x3a53b4[_0xca0b('0x6')](_0xca0b('0xc'),new AGIError(_0xca0b('0xe')));_0x31a0d1['destroy']();}else if(_0x2f7b56&&_0x2f7b56>0x0&&_0x2f7b56<_0x18af13){_0x1aac00+=0x1;_0x3a53b4[_0xca0b('0x6')](_0xca0b('0xc'),new AGIError(_0xca0b('0xf'),_0x1aac00));_0x31a0d1['destroy']();}else{var _0x106ed6=new AGIChannel(_0x31a0d1);_0x106ed6['on'](_0xca0b('0x10'),function(){_0x3a53b4[_0xca0b('0x6')](_0xca0b('0x11'),_0x106ed6);});}});});_0x3cb084['on'](_0xca0b('0xc'),function(_0x404c6d){_0x3a53b4['emit'](_0xca0b('0xc'),new AGIError(_0xca0b('0xd'),_0x404c6d['code']));});_0x3cb084['on'](_0xca0b('0x12'),function(){_0x3a53b4['emit'](_0xca0b('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xca0b('0x13')](function(){_0xa506a4();});};util[_0xca0b('0x14')](AGIServer,EventEmitter);module[_0xca0b('0x15')]=function(_0x54f614,_0x36c0b2,_0x2c0c53){return new AGIServer(_0x54f614,_0x36c0b2,_0x2c0c53);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 4e12099..02bd1b0 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 _0x2e54=['Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_bot_name','googleASR','tildeASR','clone','hasOwnProperty','isString','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','replaceAllVariables','split','replaceAll','getAndSetVariable','result','extra','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','callback','delay','add','minutes','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','createSquareMessage','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','variable_id','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','streamFile','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','GoogleASR\x20Result\x20%s','tildeasr','appid','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','intKey','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','recordFile','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','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','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','QUEUE','macro','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','no\x20url\x20configured','restAPI','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','service','host','port','authentication','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','join','exports','path','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','./scripts','rawHeaders','rawBody','menu','getsecretdigits','channel','mailRpc','getVariable','rpc','getVariableById','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s'];(function(_0x127e74,_0x241e1e){var _0x9ca186=function(_0x84398){while(--_0x84398){_0x127e74['push'](_0x127e74['shift']());}};_0x9ca186(++_0x241e1e);}(_0x2e54,0x194));var _0x42e5=function(_0x38d1a5,_0x10402f){_0x38d1a5=_0x38d1a5-0x0;var _0x2e4d92=_0x2e54[_0x38d1a5];return _0x2e4d92;};'use strict';var fs=require('fs');var path=require(_0x42e5('0x0'));var util=require(_0x42e5('0x1'));var _=require('lodash');var sh=require(_0x42e5('0x2'));var odbc=require(_0x42e5('0x3'))();var rs=require(_0x42e5('0x4'));var moment=require(_0x42e5('0x5'));var Mustache=require(_0x42e5('0x6'));var rp=require(_0x42e5('0x7'));var logger=require(_0x42e5('0x8'))(_0x42e5('0x9'));var config=require('../../config/environment');var scripts=require(_0x42e5('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x42e5('0xb'),_0x42e5('0xc')];var verticesWithRetry=[_0x42e5('0xd'),'getdigits',_0x42e5('0xe')];var AGIVertices=function(_0x2f2792,_0x570fc0,_0x1bfbbf){this[_0x42e5('0xf')]=_0x2f2792;this['rpc']=_0x570fc0;this[_0x42e5('0x10')]=_0x1bfbbf;};AGIVertices['prototype'][_0x42e5('0x11')]=function(_0x59ab19,_0x5e455f){this[_0x42e5('0x12')][_0x42e5('0x13')](_0x59ab19)[_0x42e5('0x14')](function(_0x37b3db){_0x5e455f(null,_0x37b3db?_0x37b3db[_0x42e5('0x15')]:![]);})[_0x42e5('0x16')](function(_0x4bfd67){_0x5e455f(_0x4bfd67);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x18')]=function(_0x39207f,_0x227dea){this[_0x42e5('0x12')][_0x42e5('0x19')](_0x39207f)[_0x42e5('0x14')](function(_0x4cf7cd){_0x227dea(null,_0x4cf7cd?_0x4cf7cd['name']:![]);})[_0x42e5('0x16')](function(_0x4b89eb){_0x227dea(_0x4b89eb);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x1a')]=function(_0x376519,_0x5cc2ce){this['rpc'][_0x42e5('0x1b')](_0x376519)[_0x42e5('0x14')](function(_0x49578e){_0x5cc2ce(null,_0x49578e?_0x49578e[_0x42e5('0x15')]:![]);})['catch'](function(_0x283cd4){_0x5cc2ce(_0x283cd4);});};AGIVertices[_0x42e5('0x17')]['getSquareOdbc']=function(_0x3f6339,_0x2185a5){this[_0x42e5('0x12')][_0x42e5('0x1c')](_0x3f6339)[_0x42e5('0x14')](function(_0x69a594){_0x2185a5(null,_0x69a594?_0x69a594[_0x42e5('0x1d')]:![]);})['catch'](function(_0x283a32){_0x2185a5(_0x283a32);});};AGIVertices['prototype'][_0x42e5('0x1e')]=function(_0x20b216,_0x5c427c){this[_0x42e5('0x12')]['getUserById'](_0x20b216)['then'](function(_0x3abf5a){_0x5c427c(null,_0x3abf5a?_0x3abf5a[_0x42e5('0x15')]:![]);})[_0x42e5('0x16')](function(_0x317c09){_0x5c427c(_0x317c09);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x1f')]=function(_0x4cad60,_0xb96af){this[_0x42e5('0x12')][_0x42e5('0x20')](_0x4cad60)[_0x42e5('0x14')](function(_0x21bcc6){_0xb96af(null,_0x21bcc6?_0x21bcc6[_0x42e5('0x15')]:![]);})['catch'](function(_0x467019){_0xb96af(_0x467019);});};AGIVertices['prototype'][_0x42e5('0x21')]=function(_0xc24ba0,_0x374186){var _0x23b60b=this;this['rpc'][_0x42e5('0x22')](_0xc24ba0)[_0x42e5('0x14')](function(_0x2b40a2){_0x374186(null,_0x2b40a2?_0x23b60b[_0x42e5('0x23')](_0x2b40a2[_0x42e5('0x24')]):![]);})[_0x42e5('0x16')](function(_0xca10af){_0x374186(_0xca10af);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x25')]=function(_0x53c349,_0x4c84a7){this['rpc']['getMailAccountById'](_0x53c349)[_0x42e5('0x14')](function(_0x4b4dfa){_0x4c84a7(null,_0x4b4dfa?_0x4b4dfa:![]);})[_0x42e5('0x16')](function(_0x150da2){_0x4c84a7(_0x150da2);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x26')]=function(_0x34f65c,_0x5761ba,_0x1b4348){this[_0x42e5('0x10')]['sendMailMessage'](_0x34f65c,_0x5761ba)[_0x42e5('0x14')](function(){_0x1b4348(null);})[_0x42e5('0x16')](function(_0x5f178b){_0x1b4348(_0x5f178b);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x27')]=function(_0x419598,_0x39e9b3){this['rpc'][_0x42e5('0x28')](_0x419598)[_0x42e5('0x14')](function(_0x4cedb6){if(_0x4cedb6){if(_0x4cedb6[_0x42e5('0x29')]){_0x39e9b3(null,[_0x4cedb6[_0x42e5('0x2a')]]);}else{_0x39e9b3(null,_[_0x42e5('0x2b')](_0x4cedb6[_0x42e5('0x2c')],_0x42e5('0x2a')));}}else{_0x39e9b3(null,![]);}})['catch'](function(_0x5cc409){_0x39e9b3(_0x5cc409);});};AGIVertices['prototype'][_0x42e5('0x23')]=function(_0x469915){return util[_0x42e5('0x2d')]('%s/sounds/converted/%s',FILES_PATH,_0x469915);};AGIVertices['prototype'][_0x42e5('0x2e')]=function(_0x5bbe7c,_0x33eb95,_0xa8b42a){odbc['open'](_0x5bbe7c,function(_0x4353d2){if(_0x4353d2){logger[_0x42e5('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x4353d2);_0xa8b42a(_0x4353d2);}else{logger[_0x42e5('0x30')](_0x42e5('0x31'));odbc[_0x42e5('0x32')](_0x33eb95,function(_0x4e3431,_0x131795){if(_0x4e3431){logger[_0x42e5('0x30')](_0x42e5('0x33'),_0x33eb95);_0xa8b42a(_0x4e3431);}else{logger['info'](_0x42e5('0x34'),_0x33eb95);odbc[_0x42e5('0x35')](function(_0x4d0f40){if(_0x4d0f40){logger[_0x42e5('0x2f')](_0x42e5('0x36'),_0x4d0f40);}_0xa8b42a(null,_0x131795);});}});}});};AGIVertices[_0x42e5('0x17')]['getSmsAccount']=function(_0x12fca7,_0xbb961b){this['rpc'][_0x42e5('0x37')](_0x12fca7)[_0x42e5('0x14')](function(_0x22b0b4){_0xbb961b(null,_0x22b0b4?_0x22b0b4:![]);})[_0x42e5('0x16')](function(_0x49263b){_0xbb961b(_0x49263b);});};AGIVertices['prototype'][_0x42e5('0x38')]=function(_0x4cdc7c,_0x14b950){this['rpc'][_0x42e5('0x38')](_0x4cdc7c)['then'](function(_0x5bd760){_0x14b950(null,_0x5bd760);})[_0x42e5('0x16')](function(_0x3ba7ef){_0x14b950(_0x3ba7ef);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x39')]=function(_0x58f8e0,_0x1ea6f2,_0x4892aa){this[_0x42e5('0x12')][_0x42e5('0x39')]({'uniqueid':this[_0x42e5('0xf')][_0x42e5('0x3a')],'node':_0x58f8e0[_0x42e5('0x3b')],'application':_0x58f8e0[_0x42e5('0x3c')],'data':_0x1ea6f2||null,'project_name':this[_0x42e5('0xf')][_0x42e5('0x3d')],'callerid':this[_0x42e5('0xf')][_0x42e5('0x3e')]})['then'](function(_0x442da1){if(_0x4892aa){_0x4892aa(null,_0x442da1);}})[_0x42e5('0x16')](function(_0x5300e0){if(_0x4892aa){_0x4892aa(_0x5300e0);}});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x3f')]=function(_0x5101b8,_0x443a72,_0x985197,_0x228e30){this[_0x42e5('0x12')][_0x42e5('0x3f')]({'uniqueid':this[_0x42e5('0xf')][_0x42e5('0x3a')],'callerid':this[_0x42e5('0xf')][_0x42e5('0x3e')],'calleridname':this[_0x42e5('0xf')]['calleridname'],'context':this[_0x42e5('0xf')][_0x42e5('0x40')],'extension':this['channel'][_0x42e5('0x41')],'priority':this['channel'][_0x42e5('0x42')],'accountcode':this[_0x42e5('0xf')][_0x42e5('0x43')],'dnid':this['channel'][_0x42e5('0x44')],'projectName':this['channel']['arg_1'],'saveName':_0x443a72,'filename':_0x5101b8[_0x42e5('0x45')]||_0x443a72,'savePath':_0x985197})[_0x42e5('0x14')](function(_0x114253){_0x228e30(null,_0x114253);})[_0x42e5('0x16')](function(_0x15ebb6){_0x228e30(_0x15ebb6);});};AGIVertices[_0x42e5('0x17')]['createSquareMessage']=function(_0xf6fa09,_0x2cad69,_0x19663c,_0x5cae7e,_0x33b405){this['rpc']['createSquareMessage']({'uniqueid':this['channel'][_0x42e5('0x3a')],'body':_0xf6fa09,'direction':_0x2cad69,'providerName':_0x19663c,'providerResponse':_0x5cae7e})[_0x42e5('0x14')](function(_0x46b4ee){if(_0x33b405){_0x33b405(null,_0x46b4ee);}})[_0x42e5('0x16')](function(_0xd323f5){if(_0x33b405){_0x33b405(_0xd323f5);}});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x46')]=function(_0x5cecfc,_0x1a8383){this[_0x42e5('0x12')][_0x42e5('0x46')]({'firstName':_[_0x42e5('0x47')](_0x5cecfc['name'])||_['isNil'](_0x5cecfc[_0x42e5('0x15')])?_0x42e5('0x48')+Math[_0x42e5('0x49')]():_0x5cecfc[_0x42e5('0x15')],'lastName':_['isEmpty'](_0x5cecfc[_0x42e5('0x4a')])||_[_0x42e5('0x4b')](_0x5cecfc[_0x42e5('0x4a')])?null:_0x5cecfc['lastName'],'phone':_0x5cecfc[_0x42e5('0x4c')],'ListId':_0x5cecfc[_0x42e5('0x4d')],'scheduledat':_0x5cecfc[_0x42e5('0x4e')],'callbackUniqueid':this[_0x42e5('0xf')][_0x42e5('0x3a')],'tags':'callback','description':_0x42e5('0x4f')+_0x5cecfc['scheduledAt'][_0x42e5('0x50')](),'priority':_0x5cecfc[_0x42e5('0x51')]})[_0x42e5('0x14')](function(_0x990f4f){_0x1a8383(null,_0x990f4f);})[_0x42e5('0x16')](function(_0x427958){_0x1a8383(_0x427958);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x52')]=function(_0xe4044b,_0x4c096c){this[_0x42e5('0x12')][_0x42e5('0x53')](_0xe4044b)[_0x42e5('0x14')](function(_0x172cb4){_0x4c096c(null,_0x172cb4?_0x172cb4[_0x42e5('0x15')]:![]);})[_0x42e5('0x16')](function(_0x491a47){_0x4c096c(_0x491a47);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x54')]=function(_0x8a2a00,_0x3bc7b0,_0x33bef5){var _0x22ddda={'role':_0x42e5('0x55')};_0x22ddda[_0x8a2a00]=this[_0x42e5('0xf')][_0x42e5('0x3e')];this[_0x42e5('0x12')][_0x42e5('0x54')](_0x22ddda,_0x3bc7b0,this[_0x42e5('0xf')]['uniqueid'])[_0x42e5('0x14')](function(_0x5d16a0){_0x33bef5(null,_[_0x42e5('0x4b')](_0x5d16a0)?![]:!![]);})[_0x42e5('0x16')](function(_0x5097e7){logger[_0x42e5('0x2f')](_0x5097e7);_0x33bef5(null,![]);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x56')]=function(_0x4c6da6,_0x18e744){var _0x575fe9={'role':_0x42e5('0x55')};_0x575fe9[_0x4c6da6]=this[_0x42e5('0xf')][_0x42e5('0x3e')];this[_0x42e5('0x12')][_0x42e5('0x56')](_0x575fe9)[_0x42e5('0x14')](function(_0x6fd6f5){_0x18e744(null,_['isNil'](_0x6fd6f5)?![]:!![]);})[_0x42e5('0x16')](function(_0x2fff29){logger['error'](_0x2fff29);_0x18e744(null,![]);});};AGIVertices['prototype'][_0x42e5('0x57')]=function(_0x4b96e4,_0x2b50e0){var _0x52b142={'role':'agent'};_0x52b142[_0x4b96e4]=this['channel'][_0x42e5('0x3e')];this[_0x42e5('0x12')][_0x42e5('0x57')](_0x52b142)[_0x42e5('0x14')](function(_0x44b741){_0x2b50e0(null,_[_0x42e5('0x4b')](_0x44b741)?![]:!![]);})['catch'](function(_0xb48140){logger[_0x42e5('0x2f')](_0xb48140);_0x2b50e0(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x3bc923,_0x21cdd8){var _0x3d4401={'role':_0x42e5('0x55')};_0x3d4401[_0x3bc923]=this[_0x42e5('0xf')]['callerid'];var _0xd6b6f8=_0x3bc923!=_0x42e5('0x58')?util[_0x42e5('0x2d')]('%s/%s@from-sip/n',_0x42e5('0x59'),this['channel'][_0x42e5('0x3e')]):undefined;this[_0x42e5('0x12')][_0x42e5('0x5a')](_0x3d4401,_0xd6b6f8)[_0x42e5('0x14')](function(_0x2340fb){_0x21cdd8(null,_[_0x42e5('0x4b')](_0x2340fb)?![]:!![]);})['catch'](function(_0x6a5ba9){logger['error'](_0x6a5ba9);_0x21cdd8(null,![]);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x5b')]=function(_0x5b7182,_0x1b126f){sh[_0x42e5('0x5c')](_[_0x42e5('0x5d')](_0x5b7182),function(_0x2a1e71,_0x2dabe7){var _0xeba431=_0x2dabe7[_0x42e5('0x5e')](/(\r\n|\n|\r)/gm,'');_0x1b126f(null,_0xeba431);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x5f')]=function(_0x46f462,_0x354c13){scripts[_0x42e5('0x5f')](_0x46f462[_0x42e5('0x60')],_0x46f462[_0x42e5('0x61')]||_0x42e5('0x62'),_0x46f462[_0x42e5('0x62')],_0x46f462['languageCode']||_0x42e5('0x63'),_0x46f462[_0x42e5('0x64')]||_0x42e5('0x65'),_0x46f462[_0x42e5('0x66')]||_0x42e5('0x67'))['then'](function(_0x1c5b46){_0x354c13(null,_0x1c5b46);})[_0x42e5('0x16')](function(_0x53037d){_0x354c13(_0x53037d);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x68')]=function(_0x2e1ef9,_0x5515b7){scripts[_0x42e5('0x68')](_0x2e1ef9['text'],_0x2e1ef9[_0x42e5('0x69')]||'en',0x1)['then'](function(_0x259e05){_0x5515b7(null,_0x259e05);})[_0x42e5('0x16')](function(_0x430436){_0x5515b7(_0x430436);});};AGIVertices['prototype']['restAPI']=function(_0x20fc33,_0x2eb2d8){var _0x37fd62={'uri':_0x20fc33[_0x42e5('0x6a')],'method':_0x20fc33[_0x42e5('0x6b')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x20fc33[_0x42e5('0x6c')])==='number'&&parseInt(_0x20fc33[_0x42e5('0x6c')])>=0x1?parseInt(_0x20fc33[_0x42e5('0x6c')])*0x3e8:0x5*0x3e8};if(_[_0x42e5('0x6d')]([_0x42e5('0x6e'),_0x42e5('0x6f')],_0x37fd62[_0x42e5('0x6b')][_0x42e5('0x70')]())){try{_0x37fd62[_0x42e5('0x71')]=_0x20fc33[_0x42e5('0xc')]?JSON[_0x42e5('0x72')](_0x20fc33[_0x42e5('0xc')]):{};}catch(_0x419f98){logger[_0x42e5('0x2f')](_0x42e5('0x73'),_0x419f98);}}try{_0x37fd62[_0x42e5('0x74')]=_0x20fc33[_0x42e5('0xb')]?JSON[_0x42e5('0x72')](_0x20fc33[_0x42e5('0xb')]):{};}catch(_0x79ae4a){logger['error'](_0x42e5('0x75'),_0x79ae4a);}if(_0x20fc33['computedVariables']){try{var _0x2e6b25=require(_0x20fc33['computedVariables'])['sync'](this,_0x37fd62);_0x37fd62[_0x42e5('0x76')]=Mustache['render'](_0x20fc33[_0x42e5('0x6a')],_0x2e6b25,{},['$$','$$']);if(_0x37fd62[_0x42e5('0x74')]){_0x37fd62[_0x42e5('0x74')]=JSON['parse'](Mustache[_0x42e5('0x77')](JSON['stringify'](_0x37fd62[_0x42e5('0x74')]),_0x2e6b25,{},['$$','$$']));}if(_0x37fd62[_0x42e5('0x71')]){_0x37fd62[_0x42e5('0x71')]=JSON[_0x42e5('0x72')](Mustache[_0x42e5('0x77')](JSON[_0x42e5('0x78')](_0x37fd62[_0x42e5('0x71')]),_0x2e6b25,{},['$$','$$']));}}catch(_0x2aba45){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2aba45);}}rp(_0x37fd62)[_0x42e5('0x14')](function(_0xdef73b){var _0x4f2125={'statusCode':_0xdef73b[_0x42e5('0x79')]||0xc8,'statusMessage':_0xdef73b[_0x42e5('0x7a')]||'OK','headers':_0xdef73b[_0x42e5('0x74')]||{},'body':_0xdef73b['body']||{}};_0x2eb2d8(null,_0x4f2125);})[_0x42e5('0x16')](function(_0x265e41){var _0x472a2b={'statusCode':_0x265e41[_0x42e5('0x79')]||0x1f4,'statusMessage':_0x265e41[_0x42e5('0x7b')]||_0x42e5('0x7c'),'headers':_0x265e41[_0x42e5('0x7d')][_0x42e5('0x74')]||{},'body':_0x265e41['options']['body']||{}};_0x2eb2d8(null,_0x472a2b);});};AGIVertices['prototype']['googleDialogflow']=function(_0x444ba7,_0x1a7605){scripts[_0x42e5('0x7e')](this['channel'][_0x42e5('0x3a')],_0x444ba7['key'],_0x444ba7['text'],_0x444ba7['dialogflow_language']||'en')[_0x42e5('0x14')](function(_0xe5ac2d){_0x1a7605(null,_0xe5ac2d);})[_0x42e5('0x16')](function(_0x58e572){_0x1a7605(_0x58e572);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x7f')]=function(_0x26d5dd,_0x4e32ae){scripts[_0x42e5('0x7f')](this['channel'][_0x42e5('0x3a')],_0x26d5dd[_0x42e5('0x80')],_0x26d5dd[_0x42e5('0x81')],_0x26d5dd[_0x42e5('0x82')],_0x26d5dd[_0x42e5('0x62')],_0x26d5dd[_0x42e5('0x83')]||'en')[_0x42e5('0x14')](function(_0xc88258){_0x4e32ae(null,_0xc88258);})[_0x42e5('0x16')](function(_0x352693){_0x4e32ae(_0x352693);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x84')]=function(_0x4d57f8,_0x4e129e){scripts[_0x42e5('0x84')](this[_0x42e5('0xf')],_0x4d57f8)[_0x42e5('0x14')](function(_0x4fe47e){_0x4e129e(null,_0x4fe47e);})[_0x42e5('0x16')](function(_0x4241c9){_0x4e129e(_0x4241c9);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x85')]=function(_0xcfee0b,_0x468054){scripts[_0x42e5('0x85')](_0xcfee0b[_0x42e5('0x86')],_0xcfee0b['text'],_0xcfee0b[_0x42e5('0x87')]||_0x42e5('0x63'),_0xcfee0b[_0x42e5('0x88')])[_0x42e5('0x14')](function(_0x2d20ae){_0x468054(null,_0x2d20ae);})['catch'](function(_0x4286f0){_0x468054(_0x4286f0);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x89')]=function(_0x139b98,_0x4c7154,_0x8bda98){scripts[_0x42e5('0x89')](_0x4c7154,_0x139b98[_0x42e5('0x86')],_0x139b98[_0x42e5('0x8a')]||_0x42e5('0x63'),this[_0x42e5('0x8b')](_0x139b98[_0x42e5('0x8c')])?_0x139b98['model']:undefined)['then'](function(_0x5e9638){_0x8bda98(null,_0x5e9638);})[_0x42e5('0x16')](function(_0x490408){_0x8bda98(_0x490408);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x8d')]=function(_0x1c0921,_0x4a57aa){scripts['awsPolly'](_0x1c0921[_0x42e5('0x8e')],_0x1c0921[_0x42e5('0x8f')],_0x1c0921['aws_polly_region'],_0x1c0921[_0x42e5('0x90')]||'Amy',_0x1c0921[_0x42e5('0x62')],_0x1c0921[_0x42e5('0x91')]||_0x42e5('0x62'))[_0x42e5('0x14')](function(_0x23c4cb){_0x4a57aa(null,_0x23c4cb);})['catch'](function(_0x5d1905){_0x4a57aa(_0x5d1905);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x92')]=function(_0x3cd210,_0x3bfc42){scripts[_0x42e5('0x92')](this[_0x42e5('0xf')][_0x42e5('0x3a')],_0x3cd210['aws_access_key_id'],_0x3cd210[_0x42e5('0x8f')],_0x3cd210['aws_lex_region'],_0x3cd210[_0x42e5('0x62')],_0x3cd210[_0x42e5('0x93')])['then'](function(_0x44bb48){_0x3bfc42(null,_0x44bb48);})[_0x42e5('0x16')](function(_0x204b8b){_0x3bfc42(_0x204b8b);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x94')]=function(_0xade95a,_0x15dd54,_0x49753f){scripts['googleASR'](_0x15dd54,_0xade95a[_0x42e5('0x86')],_0xade95a['google_asr_language']||_0x42e5('0x63'))[_0x42e5('0x14')](function(_0x4aaaf2){_0x49753f(null,_0x4aaaf2);})[_0x42e5('0x16')](function(_0x667f3a){_0x49753f(_0x667f3a);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x95')]=function(_0x29c655,_0x1d32e4,_0xa3e98e){scripts[_0x42e5('0x95')](_0x1d32e4,_0x29c655['appid'],_0x29c655['appsecret'],_0x29c655[_0x42e5('0x76')])[_0x42e5('0x14')](function(_0x1bc5ea){_0xa3e98e(null,_0x1bc5ea);})[_0x42e5('0x16')](function(_0x4bf123){_0xa3e98e(_0x4bf123);});};AGIVertices['prototype']['clear']=function(_0x379ce7){var _0xd79d2d=_[_0x42e5('0x6d')](verticesWithRetry,_0x379ce7[_0x42e5('0x3c')])?_0x379ce7:_[_0x42e5('0x96')](_0x379ce7);for(var _0x1c929e in _0xd79d2d){if(_0xd79d2d[_0x42e5('0x97')](_0x1c929e)){if(_0xd79d2d[_0x1c929e]&&_[_0x42e5('0x98')](_0xd79d2d[_0x1c929e])){if(_[_0x42e5('0x6d')](recursiveMapAttributes,_0x1c929e)){_0xd79d2d[_0x1c929e]=this['replaceObjectAllVariables'](_0xd79d2d[_0x1c929e]);}else{_0xd79d2d[_0x1c929e]=this['replaceAllVariables'](_0xd79d2d[_0x1c929e]);}}}}return _0xd79d2d;};AGIVertices['prototype'][_0x42e5('0x99')]=function(_0x2167fc){for(var _0x1e8508 in _0x2167fc){if(_0x2167fc['hasOwnProperty'](_0x1e8508)){if(_[_0x42e5('0x9a')](_0x2167fc[_0x1e8508])){this[_0x42e5('0x99')](_0x2167fc[_0x1e8508]);}else if(_[_0x42e5('0x9b')](_0x2167fc[_0x1e8508])){for(var _0x5baed1=0x0;_0x5baed1<_0x2167fc[_0x1e8508][_0x42e5('0x9c')];_0x5baed1++){this[_0x42e5('0x99')](_0x2167fc[_0x1e8508][_0x5baed1]);}}else if(_[_0x42e5('0x98')](_0x2167fc[_0x1e8508])){_0x2167fc[_0x1e8508]=this['replaceAllVariables'](_0x2167fc[_0x1e8508]);}}}};AGIVertices[_0x42e5('0x17')][_0x42e5('0x9d')]=function(_0x3447a5,_0x37a10c){for(var _0x255fe2 in _0x3447a5){if(_0x3447a5[_0x42e5('0x97')](_0x255fe2)){if(_[_0x42e5('0x9a')](_0x3447a5[_0x255fe2])){if(!_[_0x42e5('0x47')](_0x3447a5[_0x255fe2])){this[_0x42e5('0x9d')](_0x3447a5[_0x255fe2],util['format']('%s.%s',_0x37a10c,_0x255fe2));}}else if(_[_0x42e5('0x9b')](_0x3447a5[_0x255fe2])){for(var _0x48bae1=0x0;_0x48bae1<_0x3447a5[_0x255fe2]['length'];_0x48bae1++){this['saveRestApiResult'](_0x3447a5[_0x255fe2][_0x48bae1],util[_0x42e5('0x2d')](_0x42e5('0x9e'),_0x37a10c,_0x255fe2+'['+_0x48bae1+']'));}}else{if(!_[_0x42e5('0x4b')](_0x3447a5[_0x255fe2])){this[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0x9e'),_0x37a10c,_0x255fe2),_0x3447a5[_0x255fe2]);}}}}};AGIVertices[_0x42e5('0x17')][_0x42e5('0xa0')]=function(_0x4c6337){try{var _0x4fa665=JSON[_0x42e5('0x72')](_0x4c6337);this[_0x42e5('0x99')](_0x4fa665);return JSON['stringify'](_0x4fa665);}catch(_0x2de54e){return this[_0x42e5('0xa1')](_0x4c6337);}};AGIVertices[_0x42e5('0x17')]['replaceAllVariables']=function(_0x2bdea2){var _0x492169=_0x2bdea2[_0x42e5('0xa2')]('{');for(var _0x5adc55=0x1;_0x5adc55<_0x492169[_0x42e5('0x9c')];_0x5adc55+=0x1){var _0x4e1a2b=_0x492169[_0x5adc55][_0x42e5('0xa2')]('}');if(_0x4e1a2b[_0x42e5('0x9c')]>0x1){_0x2bdea2=_0x2bdea2[_0x42e5('0xa3')]('{'+_0x4e1a2b[0x0]+'}',this[_0x42e5('0xf')][_0x42e5('0x11')](_0x4e1a2b[0x0])['extra']||_0x4e1a2b[0x0]);}}if(_0x492169['length']===0x1){return _0x2bdea2[_0x42e5('0x50')]();}return this[_0x42e5('0xa1')](_0x2bdea2);};AGIVertices[_0x42e5('0x17')][_0x42e5('0xa4')]=function(_0x4cfe57,_0x2a274c){var _0x56f3fd=this[_0x42e5('0xf')][_0x42e5('0x11')](_0x4cfe57);if(_0x56f3fd[_0x42e5('0xa5')]===-0x1){return _0x56f3fd;}logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x2a274c,_0x56f3fd[_0x42e5('0xa6')]));return this[_0x42e5('0xf')][_0x42e5('0x9f')](_0x2a274c,_0x56f3fd['extra']);};AGIVertices[_0x42e5('0x17')][_0x42e5('0x8b')]=function(_0x249b32){return _0x249b32&&_0x249b32!=='0'&&_0x249b32!=='-1'&&_0x249b32!=='';};AGIVertices['prototype'][_0x42e5('0xa7')]=function(_0x18e89c){this[_0x42e5('0x39')]['sync'](this,_0x18e89c,'-');_0x18e89c['retry']=_0x18e89c[_0x42e5('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x42e5('0x17')][_0x42e5('0xa8')]=function(_0xb7eab4){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0xa9'),_0xb7eab4[_0x42e5('0x3b')]));if(!this['isConfigured'](_0xb7eab4[_0x42e5('0x62')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xab'));}var _0x2d67b9='\x22'+_0xb7eab4[_0x42e5('0x62')]+'\x22';if(this['isConfigured'](_0xb7eab4[_0x42e5('0x7d')])){_0x2d67b9+=','+_0xb7eab4[_0x42e5('0x7d')];}var _0x206cbe=this[_0x42e5('0xf')]['exec'](_0x42e5('0xac'),_0x2d67b9);if(_0x206cbe[_0x42e5('0xa5')]===-0x1){return _0x206cbe;}return this['channel'][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xad'),_0x2d67b9));};AGIVertices[_0x42e5('0x17')][_0x42e5('0xae')]=function(_0x2371a0){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0xaf'),_0x2371a0['label']));if(!this['isConfigured'](_0x2371a0[_0x42e5('0xb0')])){return this[_0x42e5('0xf')]['noop'](_0x42e5('0xb1'));}var _0x283f09=_0x2371a0[_0x42e5('0xb0')];if(this[_0x42e5('0x8b')](_0x2371a0['options'])){_0x283f09+=','+_0x2371a0['options'];}var _0x2346cd=this[_0x42e5('0xf')][_0x42e5('0x5c')](_0x42e5('0xb2'),_0x283f09);if(_0x2346cd[_0x42e5('0xa5')]===-0x1){return _0x2346cd;}var _0x17bdec=this[_0x42e5('0xa4')](_0x42e5('0xb3'),_0x42e5('0xb4'));if(_0x17bdec[_0x42e5('0xa5')]===-0x1){return _0x17bdec;}var _0x4479fc=this[_0x42e5('0xa4')]('RECOG_INPUT()',_0x42e5('0xb5'));if(_0x4479fc[_0x42e5('0xa5')]===-0x1){return _0x4479fc;}var _0x21790e=this[_0x42e5('0xa4')](_0x42e5('0xb6'),'MRCP_RECOG_INSTANCE');if(_0x21790e['result']===-0x1){return _0x21790e;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xb7'),_0x283f09));};AGIVertices[_0x42e5('0x17')]['agi']=function(_0x1b267c){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0xb8'),_0x1b267c[_0x42e5('0x3b')]));return this[_0x42e5('0xf')][_0x42e5('0x9')]([_0x1b267c[_0x42e5('0xb9')],_0x1b267c[_0x42e5('0xba')]]);};AGIVertices['prototype'][_0x42e5('0xbb')]=function(_0x339c0e){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0xbc'),_0x339c0e[_0x42e5('0x3b')]));if(this[_0x42e5('0x8b')](_0x339c0e[_0x42e5('0x6c')])){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0xbd'),_0x339c0e[_0x42e5('0x6c')]));var _0x48ffc3=this[_0x42e5('0xf')]['wait'](_0x339c0e[_0x42e5('0x6c')]);if(_0x48ffc3['result']===-0x1){return _0x48ffc3;}}return this[_0x42e5('0xf')][_0x42e5('0xbb')]();};AGIVertices[_0x42e5('0x17')][_0x42e5('0xbe')]=function(_0xdb28e4){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0xdb28e4[_0x42e5('0x3b')]));if(!this['isConfigured'](_0xdb28e4['list_id'])){return this[_0x42e5('0xf')]['error'](_0xdb28e4,'no\x20list\x20selected');}_0xdb28e4[_0x42e5('0x4e')]=moment();if(this['isConfigured'](_0xdb28e4[_0x42e5('0xbf')])){_0xdb28e4[_0x42e5('0x4e')]=moment()[_0x42e5('0xc0')](_0xdb28e4[_0x42e5('0xbf')],_0x42e5('0xc1'));}if(!this[_0x42e5('0x8b')](_0xdb28e4[_0x42e5('0x51')])){_0xdb28e4[_0x42e5('0x51')]=0x2;}this['createCmContact'][_0x42e5('0xc2')](this,_0xdb28e4);return this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0xc3'),_0xdb28e4[_0x42e5('0x4c')],_0xdb28e4[_0x42e5('0x4d')],_0xdb28e4[_0x42e5('0x4e')]));};AGIVertices[_0x42e5('0x17')][_0x42e5('0xc4')]=function(_0xadf4c){logger['info'](util['format'](_0x42e5('0xc5'),_0xadf4c[_0x42e5('0x3b')]));var _0x2bf5e3=this[_0x42e5('0xf')][_0x42e5('0x5c')](_0xadf4c['application'],_0xadf4c['options']);if(_0x2bf5e3[_0x42e5('0xa5')]===-0x1){return _0x2bf5e3;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xc6'),_0xadf4c[_0x42e5('0xc7')],_0xadf4c['options']));};AGIVertices[_0x42e5('0x17')][_0x42e5('0xc8')]=function(_0x23ce2a){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x23ce2a[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x23ce2a['text'])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xab'));}var _0x581986='\x22'+_0x23ce2a[_0x42e5('0x62')]+'\x22';if(this[_0x42e5('0x8b')](_0x23ce2a['options'])){_0x581986+=','+_0x23ce2a[_0x42e5('0x7d')];}var _0xb49a33=this['channel'][_0x42e5('0x5c')](_0x42e5('0xac'),_0x581986);if(_0xb49a33[_0x42e5('0xa5')]===-0x1){return _0xb49a33;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0xad'),_0x581986));};AGIVertices[_0x42e5('0x17')]['sestektts']=function(_0x5799e2){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5799e2[_0x42e5('0x3b')]));if(!this['isConfigured'](_0x5799e2[_0x42e5('0x62')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xab'));}var _0x5c3ab0='\x22'+_0x5799e2[_0x42e5('0x62')]+'\x22';if(this[_0x42e5('0x8b')](_0x5799e2[_0x42e5('0x7d')])){_0x5c3ab0+=','+_0x5799e2[_0x42e5('0x7d')];}var _0x18423d=this['channel'][_0x42e5('0x5c')](_0x42e5('0xac'),_0x5c3ab0);if(_0x18423d[_0x42e5('0xa5')]===-0x1){return _0x18423d;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x5c3ab0));};AGIVertices[_0x42e5('0x17')]['lumenvoxasr']=function(_0x505356){logger[_0x42e5('0x30')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x505356[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x505356[_0x42e5('0xb0')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xb1'));}var _0x27aae3=_0x505356['grammar'];if(this[_0x42e5('0x8b')](_0x505356['options'])){_0x27aae3+=','+_0x505356[_0x42e5('0x7d')];}var _0x33241a=this[_0x42e5('0xf')][_0x42e5('0x5c')]('MRCPRecog',_0x27aae3);if(_0x33241a[_0x42e5('0xa5')]===-0x1){return _0x33241a;}var _0x5a97e2=this[_0x42e5('0xa4')](_0x42e5('0xb3'),_0x42e5('0xc9'));if(_0x5a97e2[_0x42e5('0xa5')]===-0x1){return _0x5a97e2;}var _0x14abfa=this[_0x42e5('0xa4')](_0x42e5('0xca'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x14abfa[_0x42e5('0xa5')]===-0x1){return _0x14abfa;}var _0x56fcf0=this[_0x42e5('0xa4')](_0x42e5('0xb6'),_0x42e5('0xcb'));if(_0x56fcf0[_0x42e5('0xa5')]===-0x1){return _0x56fcf0;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xb7'),_0x27aae3));};AGIVertices[_0x42e5('0x17')][_0x42e5('0xcc')]=function(_0x356938){logger['info'](util[_0x42e5('0x2d')](_0x42e5('0xcd'),_0x356938['label']));if(!this[_0x42e5('0x8b')](_0x356938[_0x42e5('0xb0')])){return this['channel']['noop'](_0x42e5('0xb1'));}var _0x4178da=_0x356938[_0x42e5('0xb0')];if(this[_0x42e5('0x8b')](_0x356938[_0x42e5('0x7d')])){_0x4178da+=','+_0x356938[_0x42e5('0x7d')];}var _0x53a4a4=this['channel'][_0x42e5('0x5c')]('MRCPRecog',_0x4178da);if(_0x53a4a4[_0x42e5('0xa5')]===-0x1){return _0x53a4a4;}var _0x74e0ee=this[_0x42e5('0xa4')](_0x42e5('0xb3'),_0x42e5('0xce'));if(_0x74e0ee[_0x42e5('0xa5')]===-0x1){return _0x74e0ee;}var _0x1477d1=this[_0x42e5('0xa4')](_0x42e5('0xca'),_0x42e5('0xcf'));if(_0x1477d1[_0x42e5('0xa5')]===-0x1){return _0x1477d1;}var _0x58daf9=this['getAndSetVariable'](_0x42e5('0xb6'),_0x42e5('0xd0'));if(_0x58daf9[_0x42e5('0xa5')]===-0x1){return _0x58daf9;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xb7'),_0x4178da));};AGIVertices['prototype'][_0x42e5('0xd1')]=function(_0xa13dc2){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0xd2'),_0xa13dc2[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0xa13dc2[_0x42e5('0xd3')])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0xa13dc2,_0x42e5('0xd4'));}var _0x22adec=this[_0x42e5('0xd5')][_0x42e5('0xc2')](this,_0xa13dc2['odbc_id']);if(!_0x22adec){return this['channel']['error'](_0xa13dc2,_0x42e5('0xd6'));}if(!this[_0x42e5('0x8b')](_0xa13dc2[_0x42e5('0x32')])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0xa13dc2,_0x42e5('0xd7'));}var _0x1e44a5=_0xa13dc2[_0x42e5('0x32')][_0x42e5('0x5e')](/(\r\n|\n|\r)/gm,'\x20');this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xd8'),_0x1e44a5));var _0x566a7e=this[_0x42e5('0x2e')]['sync'](this,_0x22adec,_0x1e44a5);this['createSquareDetailsReport'][_0x42e5('0xc2')](this,_0xa13dc2,_0x1e44a5);if(!this['isConfigured'](_0xa13dc2['variable_id'])){return this['channel'][_0x42e5('0xaa')](_0x42e5('0xd9'));}var _0x5cf1f3=this[_0x42e5('0x11')][_0x42e5('0xc2')](this,_0xa13dc2['variable_id']);if(!_0x5cf1f3){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0xa13dc2,_0x42e5('0xda'));}var _0x49bf67=this;_0x566a7e[_0x42e5('0xdb')](function(_0x5030f8,_0x4835c6){Object[_0x42e5('0xdc')](_0x5030f8)[_0x42e5('0xdb')](function(_0x16bf58){_0x49bf67[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0xdd'),_0x5cf1f3,_0x4835c6,_0x16bf58),_0x5030f8[_0x16bf58]);});});this[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0xde'),_0x5cf1f3),_0x566a7e[_0x42e5('0x9c')]);return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('variable\x20%s\x20set',_0x5cf1f3));};AGIVertices[_0x42e5('0x17')]['dial']=function(_0x9b89e6){logger[_0x42e5('0xdf')](util[_0x42e5('0x2d')](_0x42e5('0xe0'),_0x9b89e6[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x9b89e6[_0x42e5('0xe1')])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x9b89e6,'no\x20user\x20selected');}var _0x1e56d4=this['getUser'][_0x42e5('0xc2')](this,_0x9b89e6[_0x42e5('0xe1')]);if(!_0x1e56d4){return this[_0x42e5('0xf')]['error'](_0x9b89e6,'no\x20user\x20found');}var _0x19421f=this[_0x42e5('0xf')]['exec'](_0x42e5('0xe2'),[util[_0x42e5('0x2d')]('SIP/%s',_0x1e56d4),_0x9b89e6[_0x42e5('0x6c')],_0x9b89e6[_0x42e5('0xe3')],_0x9b89e6[_0x42e5('0x6a')]]);if(_0x19421f[_0x42e5('0xa5')]===-0x1){return _0x19421f;}return this[_0x42e5('0xf')]['noop'](util['format'](_0x42e5('0xe4'),'DIAL'));};AGIVertices[_0x42e5('0x17')][_0x42e5('0xe5')]=function(_0x2852de){logger['info'](util[_0x42e5('0x2d')](_0x42e5('0xe6'),_0x2852de[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x2852de['key'])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xe7'));}if(!this['isConfigured'](_0x2852de[_0x42e5('0x62')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xab'));}this[_0x42e5('0xf')][_0x42e5('0xe8')]=!![];this['createSquareDetailsReport'](_0x2852de);this[_0x42e5('0xe9')](_0x2852de[_0x42e5('0x62')],'in','','');this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xea'),_0x2852de['text']));var _0x330af9=this['googleDialogflow'][_0x42e5('0xc2')](this,_0x2852de);if(_0x330af9){for(var _0x465173 in _0x330af9){if(_0x330af9[_0x42e5('0x97')](_0x465173)){this[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0xeb'),_0x465173[_0x42e5('0x70')]()),_0x330af9[_0x465173]);}}this[_0x42e5('0xe9')](_0x330af9[_0x42e5('0xec')],_0x42e5('0xed'),_0x42e5('0xe5'),'');return this[_0x42e5('0xf')]['noop'](util['format'](_0x42e5('0xee'),_0x330af9[_0x42e5('0xec')]));}return this[_0x42e5('0xf')]['error'](_0x2852de,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x42e5('0xef')]=function(_0x4d954c){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0xf0'),_0x4d954c[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x4d954c[_0x42e5('0x80')])){return this['channel'][_0x42e5('0xaa')](_0x42e5('0xf1'));}if(!this[_0x42e5('0x8b')](_0x4d954c['client_email'])){return this['channel']['noop']('no\x20client_email\x20configured');}if(!this[_0x42e5('0x8b')](_0x4d954c[_0x42e5('0x82')])){return this[_0x42e5('0xf')]['noop'](_0x42e5('0xf2'));}if(!this['isConfigured'](_0x4d954c['dialogflowV2_language'])){return this[_0x42e5('0xf')]['noop']('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x4d954c[_0x42e5('0x62')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xab'));}this[_0x42e5('0xf')]['bot']=!![];this['createSquareDetailsReport'](_0x4d954c);this[_0x42e5('0xe9')](_0x4d954c['text'],'in','','');this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xf3'),_0x4d954c[_0x42e5('0x62')]));var _0x41783b=this[_0x42e5('0x7f')]['sync'](this,_0x4d954c);if(_0x41783b){for(var _0x1cd60e in _0x41783b){if(_0x41783b[_0x42e5('0x97')](_0x1cd60e)){if(_0x1cd60e!==_0x42e5('0xf4')){this[_0x42e5('0xf')]['setVariable'](util[_0x42e5('0x2d')]('DIALOGFLOW_%s',_0x1cd60e[_0x42e5('0x70')]()),_0x41783b[_0x1cd60e]);}}}this[_0x42e5('0xe9')](_0x41783b[_0x42e5('0xec')],'out','dialogflowV2',_0x41783b[_0x42e5('0xf4')]);return this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format']('DialogflowV2\x20Result\x20%s',_0x41783b['speech']));}return this[_0x42e5('0xf')]['error'](_0x4d954c,_0x42e5('0xf5'));};AGIVertices[_0x42e5('0x17')]['sesteknda']=function(_0x39f203){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x39f203[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x39f203[_0x42e5('0xf6')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xf7'));}if(!this[_0x42e5('0x8b')](_0x39f203['username'])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xf8'));}if(!this['isConfigured'](_0x39f203[_0x42e5('0xf9')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xfa'));}if(!this[_0x42e5('0x8b')](_0x39f203['ndassistant_url'])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xab'));}this[_0x42e5('0xf')][_0x42e5('0xe8')]=!![];this[_0x42e5('0x39')](_0x39f203);this[_0x42e5('0xe9')](_0x39f203[_0x42e5('0x62')],'in','','');this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xfb'),_0x39f203[_0x42e5('0x62')]));var _0x3ebcc7=this[_0x42e5('0x84')][_0x42e5('0xc2')](this,_0x39f203);if(_0x3ebcc7){for(var _0x33cd3a in _0x3ebcc7){if(_0x3ebcc7[_0x42e5('0x97')](_0x33cd3a)){this[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0xfc'),_0x33cd3a[_0x42e5('0x70')]()),_0x3ebcc7[_0x33cd3a]);}}this[_0x42e5('0xe9')](_0x3ebcc7[_0x42e5('0xec')],'out',_0x42e5('0xfd'),'');if(_0x3ebcc7[_0x42e5('0xfe')]){this['channel'][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xff'),_0x3ebcc7[_0x42e5('0xfe')]));var _0x5bdb14=this[_0x42e5('0xf')]['streamFile'](_0x3ebcc7['audiofile']);try{fs[_0x42e5('0x100')](_0x3ebcc7['audiofile']+_0x42e5('0x101'));}catch(_0x133a9e){logger[_0x42e5('0x2f')](_0x133a9e);}return _0x5bdb14;}else{return this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x102'),_0x3ebcc7[_0x42e5('0xec')]));}}return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x39f203,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x42e5('0x17')][_0x42e5('0x103')]=function(_0x419328){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x104'),_0x419328[_0x42e5('0x3b')]));return this[_0x42e5('0xf')]['noop'](_0x42e5('0x103'));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x105')]=function(_0x4fa716){logger['info'](util['format'](_0x42e5('0x106'),_0x4fa716['label']));var _0x168ed9='';if(_0x4fa716[_0x42e5('0x107')]){if(!this['isConfigured'](_0x4fa716['trunk_id'])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x4fa716,_0x42e5('0x108'));}else{var _0x2e5a01=parseInt(_0x4fa716[_0x42e5('0x107')],0xa);if(isNaN(_0x2e5a01)){_0x168ed9=_0x4fa716[_0x42e5('0x107')];}else{_0x168ed9=this['getTrunk'][_0x42e5('0xc2')](this,_0x4fa716[_0x42e5('0x107')]);if(!_0x168ed9){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x4fa716,_0x42e5('0x109'));}}}}else if(_0x4fa716['trunk_name']){_0x168ed9=_0x4fa716[_0x42e5('0x10a')];}else{return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x4fa716,_0x42e5('0x108'));}var _0x20a318=this[_0x42e5('0xf')]['exec'](_0x42e5('0xe2'),[util[_0x42e5('0x2d')]('SIP/%s/%s',_0x168ed9,_0x4fa716[_0x42e5('0x4c')]),_0x4fa716[_0x42e5('0x6c')],_0x4fa716[_0x42e5('0xe3')],_0x4fa716[_0x42e5('0x6a')]]);if(_0x20a318[_0x42e5('0xa5')]===-0x1){return _0x20a318;}return this[_0x42e5('0xf')]['noop'](util[_0x42e5('0x2d')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype']['finally']=function(_0x5928a8){logger['info'](util[_0x42e5('0x2d')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x5928a8['label']));return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x10b'));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x10c')]=function(_0x584e0){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x10d'),_0x584e0['label']));if(_0x584e0[_0x42e5('0x10e')]===0x0){return this[_0x42e5('0xa7')](_0x584e0);}_0x584e0[_0x42e5('0x10e')]-=0x1;if(!this['isConfigured'](_0x584e0['file_id'])){return this[_0x42e5('0xf')]['error'](_0x584e0,_0x42e5('0x10f'));}var _0x455a7c=this[_0x42e5('0x21')][_0x42e5('0xc2')](this,_0x584e0['file_id']);if(!_0x455a7c){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x584e0,_0x42e5('0x110'));}if(!this[_0x42e5('0x8b')](_0x584e0[_0x42e5('0x111')])){return this['channel'][_0x42e5('0x2f')](_0x42e5('0xd9'));}var _0x4f5f1c=this['channel']['getData'](_0x455a7c,_0x584e0[_0x42e5('0x112')],_0x584e0[_0x42e5('0x113')]);var _0xde4e38=_0x4f5f1c[_0x42e5('0xa5')]?_0x4f5f1c[_0x42e5('0xa5')][_0x42e5('0x50')]():'';logger[_0x42e5('0x30')](_0x42e5('0x114'),JSON['stringify'](_0x4f5f1c));if(_0x4f5f1c[_0x42e5('0xa5')]===-0x1){this[_0x42e5('0x39')][_0x42e5('0xc2')](this,_0x584e0,_0xde4e38);return _0x4f5f1c;}else if(_0x4f5f1c[_0x42e5('0xa6')]===_0x42e5('0x6c')){_0x4f5f1c[_0x42e5('0xa5')]=_0xde4e38[_0x42e5('0x9c')]>=parseInt(_0x584e0[_0x42e5('0x115')])?'x':'i';}else{_0x4f5f1c[_0x42e5('0xa5')]=_0xde4e38[_0x42e5('0x9c')]>=parseInt(_0x584e0[_0x42e5('0x115')])&&_0xde4e38[_0x42e5('0x9c')]<=parseInt(_0x584e0[_0x42e5('0x113')])?'x':'i';}var _0x2bb03d=this['getVariable'][_0x42e5('0xc2')](this,_0x584e0['variable_id']);if(!_0x2bb03d){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x584e0,_0x42e5('0xda'));}this['channel'][_0x42e5('0x9f')](_0x2bb03d,_0xde4e38);if(this['isConfigured'](_0x584e0[_0x42e5('0x116')])){var _0x278a9b=parseInt(_0x584e0[_0x42e5('0x116')],0xa);var _0x422355=rs[_0x42e5('0x117')]({'charset':'*','length':_0x278a9b});var _0x538080=_0xde4e38[_0x42e5('0x9c')];if(_0x538080>0x0){if(_0x538080>_0x278a9b){this[_0x42e5('0x39')][_0x42e5('0xc2')](this,_0x584e0,_0x584e0[_0x42e5('0x118')]===_0x42e5('0x119')?_0x422355+_0xde4e38[_0x42e5('0x11a')](_0x278a9b):_0xde4e38[_0x42e5('0x11a')](0x0,_0x538080-_0x278a9b)+_0x422355);}else{this[_0x42e5('0x39')][_0x42e5('0xc2')](this,_0x584e0,rs['generate']({'charset':'*','length':_0x538080}));}}else{this[_0x42e5('0x39')][_0x42e5('0xc2')](this,_0x584e0,'');}}else{this['createSquareDetailsReport'][_0x42e5('0xc2')](this,_0x584e0,_0xde4e38);}return _0x4f5f1c;};AGIVertices[_0x42e5('0x17')][_0x42e5('0xe')]=function(_0x259e31){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x11b'),_0x259e31['label']));return this[_0x42e5('0x10c')](_0x259e31);};AGIVertices[_0x42e5('0x17')]['goal']=function(_0x3264f2){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x11c'),_0x3264f2[_0x42e5('0x3b')]));this[_0x42e5('0x39')]['sync'](this,_0x3264f2,_0x3264f2[_0x42e5('0x11d')]);return this['channel'][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x11e'),_0x3264f2[_0x42e5('0x11d')]));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x11f')]=function(_0x48fd16){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x120'),_0x48fd16['label']));if(!this[_0x42e5('0x8b')](_0x48fd16['aws_access_key_id'])||!this[_0x42e5('0x8b')](_0x48fd16[_0x42e5('0x8f')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x121'));}if(!this[_0x42e5('0x8b')](_0x48fd16[_0x42e5('0x62')])){return this[_0x42e5('0xf')]['noop'](_0x42e5('0xab'));}this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('Trying\x20aws\x20Polly\x20%s',_0x48fd16[_0x42e5('0x62')]));var _0x1b16c0=this[_0x42e5('0x8d')][_0x42e5('0xc2')](this,_0x48fd16);if(_0x1b16c0){this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x122'),_0x1b16c0));var _0x1bad06=this[_0x42e5('0xf')][_0x42e5('0x123')](_0x1b16c0);try{fs[_0x42e5('0x100')](_0x1b16c0+_0x42e5('0x101'));}catch(_0x375d39){logger[_0x42e5('0x2f')](_0x375d39);}return _0x1bad06;}return this['channel'][_0x42e5('0x2f')](_0x48fd16,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x42e5('0x124')]=function(_0x5442b8){logger['info'](util['format'](_0x42e5('0x125'),_0x5442b8[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x5442b8[_0x42e5('0x8e')])||!this[_0x42e5('0x8b')](_0x5442b8[_0x42e5('0x8f')])){return this['channel']['noop'](_0x42e5('0x121'));}if(!this[_0x42e5('0x8b')](_0x5442b8[_0x42e5('0x93')])){return this[_0x42e5('0xf')]['noop'](_0x42e5('0x126'));}if(!this[_0x42e5('0x8b')](_0x5442b8['text'])){return this['channel'][_0x42e5('0xaa')](_0x42e5('0xab'));}this['channel'][_0x42e5('0xe8')]=!![];this[_0x42e5('0x39')](_0x5442b8);this[_0x42e5('0xe9')](_0x5442b8['text'],'in','','');this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x127'),_0x5442b8[_0x42e5('0x62')]));var _0x109c6b=this['awsLex'][_0x42e5('0xc2')](this,_0x5442b8);if(_0x109c6b){for(var _0x3e0151 in _0x109c6b){if(_0x109c6b[_0x42e5('0x97')](_0x3e0151)&&_['isString'](_0x109c6b[_0x3e0151])){this[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0x128'),_0x3e0151['toUpperCase']()),_0x109c6b[_0x3e0151]);}}if(_[_0x42e5('0x4b')](_0x109c6b[_0x42e5('0x7b')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x129'));}else{this[_0x42e5('0xe9')](_0x109c6b[_0x42e5('0x7b')],_0x42e5('0xed'),_0x42e5('0x12a'),'');return this['channel'][_0x42e5('0xaa')](util['format'](_0x42e5('0x12b'),_0x109c6b[_0x42e5('0x7b')]));}}return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x5442b8,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x42e5('0x17')]['googleasr']=function(_0x11ece8){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x12c'),_0x11ece8[_0x42e5('0x3b')],_0x11ece8['timeout']));if(!this[_0x42e5('0x8b')](_0x11ece8[_0x42e5('0x86')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xe7'));}var _0x3598fe=_0x42e5('0x12d');var _0x2e7bfb=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x4307a5=util[_0x42e5('0x2d')](_0x42e5('0x9e'),_0x2e7bfb,_0x3598fe);var _0x5d0e30=!![];if(_0x11ece8[_0x42e5('0x12e')]===_0x42e5('0x12f')){_0x5d0e30=![];}var _0x5d044a=this[_0x42e5('0xf')]['recordFile'](_0x2e7bfb,_0x3598fe,_0x11ece8['intKey'],_0x11ece8['timeout'],undefined,_0x5d0e30);if(_0x5d044a[_0x42e5('0xa5')]!==-0x1){this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format']('google\x20%s\x20file\x20created',_0x4307a5));var _0x2c70ad=this[_0x42e5('0x94')][_0x42e5('0xc2')](this,_0x11ece8,_0x4307a5);if(_0x2c70ad){for(var _0x548b5f in _0x2c70ad){if(_0x2c70ad['hasOwnProperty'](_0x548b5f)){this[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')]('GOOGLE_ASR_%s',_0x548b5f['toUpperCase']()),_0x2c70ad[_0x548b5f]);}}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x130'),JSON[_0x42e5('0x78')](_0x2c70ad)));}}return _0x5d044a;};AGIVertices[_0x42e5('0x17')][_0x42e5('0x131')]=function(_0x2f6da7){logger[_0x42e5('0x30')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x2f6da7[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x2f6da7[_0x42e5('0x132')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x133'));}if(!this[_0x42e5('0x8b')](_0x2f6da7[_0x42e5('0x134')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x135'));}var _0x5c8ff2=_0x42e5('0x12d');var _0x2f61d7=util[_0x42e5('0x2d')]('%s/recordings/%s',FILES_PATH,rs[_0x42e5('0x117')](0x4));var _0x2dedc2=util[_0x42e5('0x2d')](_0x42e5('0x9e'),_0x2f61d7,_0x5c8ff2);var _0x133120=!![];if(_0x2f6da7[_0x42e5('0x12e')]===_0x42e5('0x12f')){_0x133120=![];}var _0x2b22ec=this[_0x42e5('0xf')]['recordFile'](_0x2f61d7,_0x5c8ff2,_0x2f6da7[_0x42e5('0x136')],_0x2f6da7[_0x42e5('0x6c')],undefined,_0x133120);if(_0x2b22ec[_0x42e5('0xa5')]!==-0x1){this['channel'][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('tilde\x20%s\x20file\x20created',_0x2dedc2));var _0x28666b=this[_0x42e5('0x95')]['sync'](this,_0x2f6da7,_0x2dedc2);if(_0x28666b){for(var _0x42a8bc in _0x28666b){if(_0x28666b[_0x42e5('0x97')](_0x42a8bc)){this[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0x137'),_0x42a8bc['toUpperCase']()),_0x28666b[_0x42a8bc]);}}return this[_0x42e5('0xf')]['noop'](util[_0x42e5('0x2d')](_0x42e5('0x138'),JSON[_0x42e5('0x78')](_0x28666b)));}}return _0x2b22ec;};AGIVertices[_0x42e5('0x17')][_0x42e5('0x139')]=function(_0x260762){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x13a'),_0x260762[_0x42e5('0x3b')]));return this[_0x42e5('0xf')][_0x42e5('0x13b')](_0x260762[_0x42e5('0x40')],_0x260762[_0x42e5('0x41')],_0x260762[_0x42e5('0x42')]);};AGIVertices['prototype'][_0x42e5('0x13c')]=function(_0xfb7ed1){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x13d'),_0xfb7ed1[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0xfb7ed1['condition'])){return this['channel'][_0x42e5('0x2f')](_0xfb7ed1,_0x42e5('0x13e'));}try{var _0x347c56=eval(_0xfb7ed1[_0x42e5('0x13f')])?_0x42e5('0x140'):_0x42e5('0x141');this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x142'),_0xfb7ed1[_0x42e5('0x13f')],_0x347c56));return{'code':0xc8,'result':_0x347c56};}catch(_0x53b9a9){return{'code':0xc8,'result':_0x42e5('0x141')};}};AGIVertices[_0x42e5('0x17')][_0x42e5('0x143')]=function(_0x233e35){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x144'),_0x233e35[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x233e35[_0x42e5('0x145')])){return this['channel'][_0x42e5('0x2f')](_0x233e35,_0x42e5('0x146'));}var _0x547002=this[_0x42e5('0x27')][_0x42e5('0xc2')](this,_0x233e35[_0x42e5('0x145')]);if(!_0x547002){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x233e35,'no\x20intervals\x20found');}for(var _0x1392e0=0x0;_0x1392e0<_0x547002[_0x42e5('0x9c')];_0x1392e0+=0x1){var _0xf53c50=this[_0x42e5('0xf')]['getVariable'](util[_0x42e5('0x2d')](_0x42e5('0x147'),_0x547002[_0x1392e0]));if(_0xf53c50['result']===-0x1){return _0xf53c50;}logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('IFTIME\x20%s\x20%s',_0x547002[_0x1392e0],_0xf53c50[_0x42e5('0xa6')]));if(_0xf53c50['extra']===_0x42e5('0x140')){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('IFTIME\x20%s\x20%s',_0x547002[_0x1392e0],_0x42e5('0x140')));this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x148'),_0x547002[_0x1392e0],'true'));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x42e5('0x2d')]('IFTIME\x20%s\x20%s',_0x547002[_0x1392e0],_0x42e5('0x141')));this[_0x42e5('0xf')]['noop'](util[_0x42e5('0x2d')](_0x42e5('0x148'),_0x547002[_0x1392e0],_0x42e5('0x141')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x42e5('0x149')]=function(_0x477086){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x14a'),_0x477086['label']));return this[_0x42e5('0xf')][_0x42e5('0x149')]();};AGIVertices[_0x42e5('0x17')][_0x42e5('0x14b')]=function(_0x50e982){logger['info'](util[_0x42e5('0x2d')](_0x42e5('0x14c'),_0x50e982[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x50e982[_0x42e5('0x86')])){return this[_0x42e5('0xf')]['noop'](_0x42e5('0xe7'));}var _0x31087d=_0x42e5('0x12d');var _0x2db7b9=util[_0x42e5('0x2d')](_0x42e5('0x14d'),FILES_PATH,rs['generate'](0x4));var _0x3da8c4=util[_0x42e5('0x2d')]('%s.%s',_0x2db7b9,_0x31087d);var _0x4d69db=!![];if(_0x50e982[_0x42e5('0x12e')]===_0x42e5('0x12f')){_0x4d69db=![];}var _0x5744fd=this[_0x42e5('0xf')][_0x42e5('0x14e')](_0x2db7b9,_0x31087d,_0x50e982[_0x42e5('0x136')],_0x50e982['timeout'],undefined,_0x4d69db);if(_0x5744fd['result']!==-0x1){this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x14f'),_0x3da8c4));var _0x23579a=this[_0x42e5('0x89')][_0x42e5('0xc2')](this,_0x50e982,_0x3da8c4);if(_0x23579a){for(var _0x5ea662 in _0x23579a){if(_0x23579a[_0x42e5('0x97')](_0x5ea662)){this['channel'][_0x42e5('0x9f')](util['format']('ISPEECH_ASR_%s',_0x5ea662[_0x42e5('0x70')]()),_0x23579a[_0x5ea662]);}}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x23579a)));}}return _0x5744fd;};AGIVertices['prototype'][_0x42e5('0x150')]=function(_0x4e19ca){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x151'),_0x4e19ca[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x4e19ca[_0x42e5('0x86')])){return this['channel'][_0x42e5('0xaa')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x4e19ca['text'])){return this[_0x42e5('0xf')][_0x42e5('0xaa')]('no\x20text\x20configured');}this['channel'][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('Trying\x20ispeech\x20TTS\x20%s',_0x4e19ca['text']));var _0x2e58ec=this[_0x42e5('0x85')]['sync'](this,_0x4e19ca);if(_0x2e58ec){this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('ispeech\x20%s\x20file\x20created',_0x2e58ec));var _0xccbf2b=this[_0x42e5('0xf')]['streamFile'](_0x2e58ec,_0x4e19ca[_0x42e5('0x136')]);try{fs[_0x42e5('0x100')](_0x2e58ec+'.wav');}catch(_0x1a614a){logger[_0x42e5('0x2f')](_0x1a614a);}return _0xccbf2b;}return this['channel'][_0x42e5('0x2f')](_0x4e19ca,_0x42e5('0x152'));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x153')]=function(_0x22c72c){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x154'),_0x22c72c[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x22c72c['findBy'])){return this[_0x42e5('0xf')]['error'](_0x22c72c,'no\x20find\x20by\x20configured');}logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x22c72c['findBy']));var _0x585d2e=this[_0x42e5('0x5a')]['sync'](this,_0x22c72c[_0x42e5('0x155')]);if(_0x585d2e){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x156'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x22c72c[_0x42e5('0x155')]));this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x156'),this['channel'][_0x42e5('0x3e')],_0x22c72c[_0x42e5('0x155')]));return{'code':0xc8,'result':_0x42e5('0x157')};}else{logger['info'](util[_0x42e5('0x2d')](_0x42e5('0x158'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x22c72c[_0x42e5('0x155')]));this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x158'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x22c72c[_0x42e5('0x155')]));return{'code':0xc8,'result':_0x42e5('0x159')};}};AGIVertices[_0x42e5('0x17')][_0x42e5('0x15a')]=function(_0x277911){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x15b'),_0x277911['label']));if(!this[_0x42e5('0x8b')](_0x277911[_0x42e5('0x155')])){return this['channel'][_0x42e5('0x2f')](_0x277911,_0x42e5('0x15c'));}logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x15d'),this[_0x42e5('0xf')]['callerid'],_0x277911[_0x42e5('0x155')]));var _0x33d564=this[_0x42e5('0x57')][_0x42e5('0xc2')](this,_0x277911[_0x42e5('0x155')]);if(_0x33d564){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x277911[_0x42e5('0x155')]));this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x156'),this['channel']['callerid'],_0x277911[_0x42e5('0x155')]));return{'code':0xc8,'result':_0x42e5('0x157')};}else{logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x158'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x277911[_0x42e5('0x155')]));this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x158'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x277911[_0x42e5('0x155')]));return{'code':0xc8,'result':_0x42e5('0x159')};}};AGIVertices[_0x42e5('0x17')]['math']=function(_0x1861c9){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x15e'),_0x1861c9['label']));if(!this[_0x42e5('0x8b')](_0x1861c9[_0x42e5('0x15f')])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x1861c9,_0x42e5('0x160'));}this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('math\x20%s',_0x1861c9[_0x42e5('0x15f')]));var _0x2d2b13=eval(_0x1861c9[_0x42e5('0x15f')]);if(!this['isConfigured'](_0x1861c9[_0x42e5('0x111')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xd9'));}var _0x275587=this[_0x42e5('0x11')][_0x42e5('0xc2')](this,_0x1861c9[_0x42e5('0x111')]);if(!_0x275587){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x1861c9,_0x42e5('0xda'));}if(_[_0x42e5('0x9b')](_0x2d2b13)){var _0x1db3d7=this;_0x2d2b13[_0x42e5('0xdb')](function(_0x2ddd33,_0x39dc7a){_0x1db3d7[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0x161'),_0x275587,_0x39dc7a),_0x2ddd33);});return this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x162'),_0x275587));}else{return this[_0x42e5('0xf')][_0x42e5('0x9f')](_0x275587,_0x2d2b13);}};AGIVertices['prototype']['menu']=function(_0x3b7351){logger['info'](util[_0x42e5('0x2d')](_0x42e5('0x163'),_0x3b7351['label']));if(_0x3b7351[_0x42e5('0x10e')]===0x0){return this[_0x42e5('0xa7')](_0x3b7351);}_0x3b7351[_0x42e5('0x10e')]-=0x1;if(!this[_0x42e5('0x8b')](_0x3b7351[_0x42e5('0x164')])){return this['channel']['error'](_0x3b7351,_0x42e5('0x10f'));}var _0x513fea=this[_0x42e5('0x21')][_0x42e5('0xc2')](this,_0x3b7351[_0x42e5('0x164')]);if(!_0x513fea){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x3b7351,'no\x20file\x20audio\x20found');}var _0x21a349=this[_0x42e5('0xf')]['getData'](_0x513fea,_0x3b7351['response'],_0x3b7351['digit']);var _0x2cc911=_0x21a349[_0x42e5('0xa5')];if(_0x21a349[_0x42e5('0xa5')]===-0x1){this[_0x42e5('0x39')][_0x42e5('0xc2')](this,_0x3b7351,'-1');return _0x21a349;}else if(_0x21a349[_0x42e5('0xa6')]===_0x42e5('0x6c')){_0x21a349['result']=_0x21a349[_0x42e5('0xa5')][_0x42e5('0x9c')]>0x0?_0x21a349[_0x42e5('0xa5')]:'t';}else if(_[_0x42e5('0x47')](_0x21a349[_0x42e5('0xa5')])){_0x21a349[_0x42e5('0xa5')]='#';_0x2cc911='#';}if(!this[_0x42e5('0x8b')](_0x3b7351[_0x42e5('0x111')])){this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xd9'));}else{var _0x42d96d=this[_0x42e5('0x11')][_0x42e5('0xc2')](this,_0x3b7351['variable_id']);if(!_0x42d96d){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x3b7351,_0x42e5('0xda'));}this[_0x42e5('0xf')][_0x42e5('0x9f')](_0x42d96d,_0x2cc911);}this[_0x42e5('0x39')][_0x42e5('0xc2')](this,_0x3b7351,_0x2cc911);return _0x21a349;};AGIVertices[_0x42e5('0x17')][_0x42e5('0xaa')]=function(_0x3d1807){logger['info'](util['format'](_0x42e5('0x165'),_0x3d1807[_0x42e5('0x3b')]));return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x3d1807[_0x42e5('0x166')]||_0x3d1807[_0x42e5('0x3b')]);};AGIVertices[_0x42e5('0x17')][_0x42e5('0x167')]=function(_0x15986c){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x168'),_0x15986c[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x15986c[_0x42e5('0x155')])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x15986c,'no\x20find\x20by\x20configured');}logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x15986c[_0x42e5('0x155')]));var _0x4873a6=this[_0x42e5('0x52')]['sync'](this,_0x15986c[_0x42e5('0x169')]);var _0x3346a0=this['agentPause']['sync'](this,_0x15986c[_0x42e5('0x155')],_0x4873a6);if(_0x3346a0){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x156'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x15986c[_0x42e5('0x155')]));this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x42e5('0x3e')],_0x15986c[_0x42e5('0x155')]));return{'code':0xc8,'result':_0x42e5('0x157')};}else{logger['info'](util[_0x42e5('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x42e5('0x3e')],_0x15986c['findBy']));this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x156'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x15986c[_0x42e5('0x155')]));return{'code':0xc8,'result':_0x42e5('0x159')};}};AGIVertices[_0x42e5('0x17')][_0x42e5('0x16a')]=function(_0x743a2f){logger['info'](util['format'](_0x42e5('0x16b'),_0x743a2f['label']));if(!this[_0x42e5('0x8b')](_0x743a2f[_0x42e5('0x164')])){return this['channel'][_0x42e5('0x2f')](_0x743a2f,_0x42e5('0x10f'));}var _0x2aa311=this[_0x42e5('0x21')]['sync'](this,_0x743a2f[_0x42e5('0x164')]);if(!_0x2aa311){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x743a2f,'no\x20file\x20audio\x20found');}var _0xdda89a=this['channel'][_0x42e5('0x5c')](_0x42e5('0x16c'),[_0x2aa311,_0x743a2f[_0x42e5('0xe3')]]);if(_0xdda89a[_0x42e5('0xa5')]===-0x1){return _0xdda89a;}return this[_0x42e5('0xf')]['noop'](util[_0x42e5('0x2d')]('Executed\x20command\x20%s\x20%s',_0x42e5('0x16c'),_0x2aa311));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x16d')]=function(_0x52f931){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x16e'),_0x52f931[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x52f931[_0x42e5('0x16f')])){return this['channel'][_0x42e5('0x2f')](_0x52f931,'no\x20queue\x20selected');}var _0x4f4b78='';var _0xef5b18=parseInt(_0x52f931['queue_id'],0xa);if(isNaN(_0xef5b18)){_0x4f4b78=_0x52f931[_0x42e5('0x16f')];}else{_0x4f4b78=this[_0x42e5('0x18')]['sync'](this,_0x52f931[_0x42e5('0x16f')]);if(!_0x4f4b78){return this[_0x42e5('0xf')]['error'](_0x52f931,_0x42e5('0x170'));}}var _0x6df173='';if(this[_0x42e5('0x8b')](_0x52f931['file_id'])){var _0x4aa1fc=this[_0x42e5('0x21')][_0x42e5('0xc2')](this,_0x52f931[_0x42e5('0x164')]);if(_0x4aa1fc){_0x6df173=_0x4aa1fc;}}this[_0x42e5('0x39')][_0x42e5('0xc2')](this,_0x52f931,_0x4f4b78);if(_0x52f931[_0x42e5('0xe3')]['indexOf']('x')<0x0){_0x52f931[_0x42e5('0xe3')]+='x';}if(_0x52f931[_0x42e5('0xe3')][_0x42e5('0x171')]('X')<0x0){_0x52f931[_0x42e5('0xe3')]+='X';}this[_0x42e5('0xf')][_0x42e5('0x9f')]('XMCS-QUEUE',_0x4f4b78?_0x4f4b78['toLowerCase']():'');var _0x24346e=this[_0x42e5('0xf')][_0x42e5('0x5c')](_0x42e5('0x172'),[_0x4f4b78,_0x52f931['opts'],_0x52f931['url'],_0x6df173,_0x52f931[_0x42e5('0x6c')],_0x52f931['agi'],_0x52f931[_0x42e5('0x173')],_0x52f931['gosub'],'',_0x52f931['position']]);if(_0x24346e[_0x42e5('0xa5')]===-0x1){return _0x24346e;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xc6'),_0x42e5('0x172'),_0x4f4b78));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x174')]=function(_0x2d6cfb){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x175'),_0x2d6cfb[_0x42e5('0x3b')]));var _0x114897=_0x2d6cfb[_0x42e5('0x176')]||'wav';var _0x1d7c48=util[_0x42e5('0x2d')](_0x42e5('0x177'),this[_0x42e5('0xf')][_0x42e5('0x3a')],rs['generate'](0x5));var _0x2aa6e6=util[_0x42e5('0x2d')](_0x42e5('0x178'),FILES_PATH,_0x1d7c48,_0x114897);var _0x5321aa=util[_0x42e5('0x2d')](_0x42e5('0x14d'),FILES_PATH,_0x1d7c48);this[_0x42e5('0x3f')][_0x42e5('0xc2')](this,_0x2d6cfb,_0x1d7c48,_0x2aa6e6);this['channel'][_0x42e5('0x9f')](_0x42e5('0x179'),_0x1d7c48);logger[_0x42e5('0x30')](_0x42e5('0x17a'),_0x5321aa,_0x114897,_0x2d6cfb[_0x42e5('0x17b')],_0x2d6cfb[_0x42e5('0x6c')]);return this['channel'][_0x42e5('0x14e')](_0x5321aa,_0x114897,_0x2d6cfb[_0x42e5('0x17b')],_0x2d6cfb['timeout'],undefined,!![]);};AGIVertices[_0x42e5('0x17')][_0x42e5('0x17c')]=function(_0x3dd7f4){logger['info'](util[_0x42e5('0x2d')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x3dd7f4[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x3dd7f4[_0x42e5('0x6a')])){return this[_0x42e5('0xf')]['noop'](_0x42e5('0x17d'));}var _0x59de76=this[_0x42e5('0x17e')][_0x42e5('0xc2')](this,_0x3dd7f4);logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Response:',util['inspect'](_0x59de76,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3dd7f4[_0x42e5('0x111')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x17f'));}var _0x1eef2d=this['getVariable'][_0x42e5('0xc2')](this,_0x3dd7f4[_0x42e5('0x111')]);if(!_0x1eef2d){return this['channel'][_0x42e5('0x2f')](_0x3dd7f4,'no\x20variable\x20found');}this['channel'][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0x180'),_0x1eef2d),_0x59de76['statusCode']?_0x59de76['statusCode']:_0x42e5('0x181'));this['channel'][_0x42e5('0x9f')](util['format']('%s_STATUS_MESSAGE',_0x1eef2d),_0x59de76['statusMessage']?_0x59de76[_0x42e5('0x7a')]:'OK');if(_0x59de76[_0x42e5('0x71')]){try{this['saveRestApiResult'](_0x59de76['body'],_0x1eef2d);}catch(_0x5d2e6b){logger['error'](util[_0x42e5('0x2d')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x1eef2d));}}return this[_0x42e5('0xf')]['noop'](util[_0x42e5('0x2d')](_0x42e5('0x182'),_0x1eef2d));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x183')]=function(_0x3af492){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x184'),_0x3af492[_0x42e5('0x3b')]));return this[_0x42e5('0xf')][_0x42e5('0x185')](_0x3af492['digits'][_0x42e5('0x5e')](/\s+/g,''),_0x3af492[_0x42e5('0x17b')]);};AGIVertices['prototype']['saynumber']=function(_0x370ece){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x186'),_0x370ece[_0x42e5('0x3b')]));return this[_0x42e5('0xf')][_0x42e5('0x187')](_0x370ece['number'][_0x42e5('0x5e')](/\s+/g,''),_0x370ece[_0x42e5('0x17b')]);};AGIVertices[_0x42e5('0x17')][_0x42e5('0x188')]=function(_0x3dcba3){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x189'),_0x3dcba3[_0x42e5('0x3b')]));return this[_0x42e5('0xf')][_0x42e5('0x18a')](_0x3dcba3[_0x42e5('0x62')],_0x3dcba3[_0x42e5('0x17b')]);};AGIVertices[_0x42e5('0x17')][_0x42e5('0x18b')]=function(_0x5f0401){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x18c'),_0x5f0401[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x5f0401[_0x42e5('0x18d')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')]('no\x20mail\x20account\x20configured');}var _0x4c47e0=this[_0x42e5('0x25')][_0x42e5('0xc2')](this,_0x5f0401[_0x42e5('0x18d')]);if(!_0x4c47e0||!_0x4c47e0[_0x42e5('0x18e')]){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x5f0401,_0x42e5('0x18f'));}var _0x544fac={'from':util[_0x42e5('0x2d')](_0x42e5('0x190'),_0x4c47e0[_0x42e5('0x15')],_0x4c47e0[_0x42e5('0x191')]||_0x4c47e0[_0x42e5('0x18e')][_0x42e5('0x192')]),'to':_0x5f0401['to']||'','cc':_0x5f0401['cc']||'','bcc':_0x5f0401[_0x42e5('0x193')]||'','subject':_0x5f0401['subject'],'html':_0x5f0401[_0x42e5('0x62')],'text':_0x5f0401[_0x42e5('0x62')]};var _0x37f48e={'tls':{'rejectUnauthorized':![]}};if(_0x4c47e0[_0x42e5('0x18e')][_0x42e5('0x194')]){_0x37f48e[_0x42e5('0x194')]=_0x4c47e0[_0x42e5('0x18e')][_0x42e5('0x194')];}else{_0x37f48e['host']=_0x4c47e0[_0x42e5('0x18e')][_0x42e5('0x195')];_0x37f48e[_0x42e5('0x196')]=_0x4c47e0['Smtp'][_0x42e5('0x196')];_0x37f48e['secure']=_0x4c47e0[_0x42e5('0x18e')]['secure'];}if(_0x4c47e0[_0x42e5('0x18e')][_0x42e5('0x197')]){_0x37f48e['auth']={'user':_0x4c47e0[_0x42e5('0x18e')][_0x42e5('0x192')],'pass':_0x4c47e0[_0x42e5('0x18e')][_0x42e5('0x198')]};}if(this[_0x42e5('0x8b')](_0x5f0401[_0x42e5('0x199')])){}logger['debug']('sendMail\x20message',JSON[_0x42e5('0x78')](_0x544fac));this['createSquareDetailsReport'][_0x42e5('0xc2')](this,_0x5f0401,_0x5f0401[_0x42e5('0x18d')]);this['channel'][_0x42e5('0xaa')](util['format'](_0x42e5('0x19a'),_0x4c47e0[_0x42e5('0x15')]));this[_0x42e5('0x26')][_0x42e5('0xc2')](this,_0x37f48e,_0x544fac);return this[_0x42e5('0xf')][_0x42e5('0xaa')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x42e5('0x17')][_0x42e5('0x19b')]=function(_0xf24c88){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x19c'),_0xf24c88[_0x42e5('0x3b')]));return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x19d'));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x19e')]=function(_0x4dbb18){logger['info'](util[_0x42e5('0x2d')](_0x42e5('0x19f'),_0x4dbb18[_0x42e5('0x3b')]));if(!this['isConfigured'](_0x4dbb18[_0x42e5('0x1a0')])){return this['channel']['noop'](_0x42e5('0x1a1'));}var _0x5ec47b=this[_0x42e5('0x1a2')][_0x42e5('0xc2')](this,_0x4dbb18[_0x42e5('0x1a0')]);if(!_0x5ec47b){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x4dbb18,_0x42e5('0x1a3'));}var _0x4f372d={'body':_0x4dbb18[_0x42e5('0x1a4')],'phone':_0x4dbb18['to']||'','SmsAccountId':_0x5ec47b['id']};logger[_0x42e5('0xdf')](_0x42e5('0x1a5'),JSON[_0x42e5('0x78')](_0x4f372d));this[_0x42e5('0x39')]['sync'](this,_0x4dbb18,_0x4dbb18['sms_account_id']);this['channel'][_0x42e5('0xaa')](util['format'](_0x42e5('0x1a6'),_0x5ec47b['name']));this[_0x42e5('0x38')][_0x42e5('0xc2')](this,_0x4f372d);return this['channel'][_0x42e5('0xaa')](_0x42e5('0x1a7'));};AGIVertices['prototype']['set']=function(_0x3c1667){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x1a8'),_0x3c1667[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x3c1667['variable_id'])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x3c1667,_0x42e5('0x1a9'));}var _0x42401a=this[_0x42e5('0x11')][_0x42e5('0xc2')](this,_0x3c1667['variable_id']);if(!_0x42401a){return this[_0x42e5('0xf')]['error'](_0x3c1667,_0x42e5('0xda'));}return this[_0x42e5('0xf')]['setVariable'](_0x42401a,_0x3c1667[_0x42e5('0x1aa')]);};AGIVertices['prototype']['start']=function(_0x5c2d7e){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Enter\x20in\x20START\x20(%s)\x20block',_0x5c2d7e['label']));this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x1ab'));if(_0x5c2d7e[_0x42e5('0xbb')]===_0x42e5('0x1ac')){this['channel'][_0x42e5('0xaa')](_0x42e5('0x1ad'));return this['channel'][_0x42e5('0xbb')]();}return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x1ae'));};AGIVertices['prototype'][_0x42e5('0x1af')]=function(_0x2a6d97){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x1b0'),_0x2a6d97[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x2a6d97[_0x42e5('0x1b1')])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x2a6d97,_0x42e5('0x1b2'));}var _0x36958a=this[_0x42e5('0x1a')][_0x42e5('0xc2')](this,_0x2a6d97[_0x42e5('0x1b1')]);if(!this[_0x42e5('0x8b')](_0x36958a)){return this[_0x42e5('0xf')]['error'](_0x2a6d97,util[_0x42e5('0x2d')](_0x42e5('0x1b3'),_0x2a6d97[_0x42e5('0x1b1')]));}if(_0x36958a===this['channel'][_0x42e5('0x3d')]){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x2a6d97,_0x42e5('0x1b4'));}this[_0x42e5('0x39')]['sync'](this,_0x2a6d97,_0x36958a);var _0x540829=this['channel']['exec'](_0x42e5('0x1b5'),util[_0x42e5('0x2d')](_0x42e5('0x1b6'),config[_0x42e5('0x9')][_0x42e5('0x195')]||_0x42e5('0x1b7'),_0x36958a,this[_0x42e5('0xf')][_0x42e5('0x3d')]));if(_0x540829[_0x42e5('0xa5')]===-0x1){return _0x540829;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xc6'),_0x42e5('0x1b5'),_0x36958a));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x1b8')]=function(_0x1fb6f6){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x1fb6f6[_0x42e5('0x3b')]));var _0x5cba68=this['shellCommand'][_0x42e5('0xc2')](this,_0x1fb6f6[_0x42e5('0xb9')]);this[_0x42e5('0x39')]['sync'](this,_0x1fb6f6,_0x1fb6f6[_0x42e5('0xb9')]);if(this[_0x42e5('0x8b')](_0x1fb6f6['variable_id'])){var _0x3a423a=this[_0x42e5('0x11')][_0x42e5('0xc2')](this,_0x1fb6f6['variable_id']);if(_0x3a423a){this['channel'][_0x42e5('0x9f')](_0x3a423a,_0x5cba68);return this['channel']['noop'](util['format'](_0x42e5('0x1b9'),_0x1fb6f6['command'],_0x3a423a));}}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x1ba'),_0x1fb6f6['command']));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x1bb')]=function(_0x30c2d4){logger[_0x42e5('0x30')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x30c2d4[_0x42e5('0x3b')]));_0x30c2d4[_0x42e5('0x62')]=_0x30c2d4[_0x42e5('0x62')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x42e5('0x8b')](_0x30c2d4[_0x42e5('0x60')])){return this['channel'][_0x42e5('0xaa')](_0x42e5('0x1bc'));}if(!this['isConfigured'](_0x30c2d4['text'])){return this['channel'][_0x42e5('0xaa')]('no\x20text\x20configured');}this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x30c2d4[_0x42e5('0x62')]));var _0x2ab5ed=this[_0x42e5('0x5f')][_0x42e5('0xc2')](this,_0x30c2d4);if(_0x2ab5ed){this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x2ab5ed));var _0x2f5abb=this[_0x42e5('0xf')][_0x42e5('0x123')](_0x2ab5ed);try{fs[_0x42e5('0x100')](_0x2ab5ed+'.wav');}catch(_0x266bd0){logger[_0x42e5('0x2f')](_0x266bd0);}return _0x2f5abb;}return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x30c2d4,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['tts']=function(_0x57d595){logger['info'](util[_0x42e5('0x2d')](_0x42e5('0x1bd'),_0x57d595[_0x42e5('0x3b')]));_0x57d595['text']=_0x57d595[_0x42e5('0x62')][_0x42e5('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x57d595['text'])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xab'));}this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x1be'),_0x57d595[_0x42e5('0x62')]));var _0x371e9c=this[_0x42e5('0x68')][_0x42e5('0xc2')](this,_0x57d595);if(_0x371e9c){this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x1bf'),_0x371e9c));var _0x229ec0=this[_0x42e5('0xf')][_0x42e5('0x123')](_0x371e9c);try{fs[_0x42e5('0x100')](_0x371e9c+'.wav');}catch(_0x1a4084){logger[_0x42e5('0x2f')](_0x1a4084);}return _0x229ec0;}return this['channel'][_0x42e5('0x2f')](_0x57d595,_0x42e5('0x1c0'));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x1c1')]=function(_0x32b6ea){logger['info'](util[_0x42e5('0x2d')](_0x42e5('0x1c2'),_0x32b6ea['label']));if(!this['isConfigured'](_0x32b6ea['findBy'])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x32b6ea,_0x42e5('0x15c'));}logger['info'](util[_0x42e5('0x2d')](_0x42e5('0x15d'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x32b6ea[_0x42e5('0x155')]));var _0x10f098=this[_0x42e5('0x56')][_0x42e5('0xc2')](this,_0x32b6ea['findBy']);if(_0x10f098){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x156'),this['channel'][_0x42e5('0x3e')],_0x32b6ea['findBy']));this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x156'),this['channel']['callerid'],_0x32b6ea[_0x42e5('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x158'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x32b6ea[_0x42e5('0x155')]));this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x158'),this['channel'][_0x42e5('0x3e')],_0x32b6ea['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x42e5('0x17')][_0x42e5('0x1c3')]=function(_0x34bab8){logger['info'](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x34bab8[_0x42e5('0x3b')]));var _0x4a6df6=this[_0x42e5('0xf')][_0x42e5('0x5c')](_0x42e5('0x1c4'),[_0x34bab8[_0x42e5('0x1c5')],_0x34bab8[_0x42e5('0x7d')]]);if(_0x4a6df6[_0x42e5('0xa5')]===-0x1){return _0x4a6df6;}return this['channel'][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xc6'),_0x42e5('0x1c4'),_0x34bab8['mailbox']));};AGIVertices[_0x42e5('0x17')]['vswitch']=function(_0x23dc9e){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x23dc9e[_0x42e5('0x3b')]));if(!this['isConfigured'](_0x23dc9e[_0x42e5('0x111')])){return this[_0x42e5('0xf')]['error'](_0x23dc9e,_0x42e5('0x1a9'));}var _0x1f77cb=this['getVariable'][_0x42e5('0xc2')](this,_0x23dc9e['variable_id']);if(!_0x1f77cb){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x23dc9e,_0x42e5('0xda'));}var _0x150bcf=this[_0x42e5('0xf')]['getVariable'](_0x1f77cb);return{'code':0xc8,'result':_0x150bcf[_0x42e5('0xa6')]?_0x150bcf['extra']:'-'};};String['prototype'][_0x42e5('0xa3')]=function(_0x17e8f1,_0x3fa4e0){return this[_0x42e5('0xa2')](_0x17e8f1)[_0x42e5('0x1c6')](_0x3fa4e0);};module[_0x42e5('0x1c7')]=AGIVertices; \ No newline at end of file +var _0x2dbc=['aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','includes','replaceAllVariables','recursiveNodeIndex','isArray','length','%s.%s','saveRestApiResult','setVariable','replaceObjectAllVariables','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','options','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','result','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','test','generate','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','failure','math','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','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','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','service','host','port','secure','auth','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','agentUnpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','lodash','shelljs','randomstring','moment','../../config/logger','../../config/environment','./scripts','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','sendMailMessage','getIntervalById','interval','map','Intervals','format','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','exec','trim','replace','googleCloudTTS','text','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','computedVariables','sync','uri','render','url','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id'];(function(_0x32ef5f,_0x1eb4bf){var _0x2239fa=function(_0x5967ca){while(--_0x5967ca){_0x32ef5f['push'](_0x32ef5f['shift']());}};_0x2239fa(++_0x1eb4bf);}(_0x2dbc,0x14b));var _0xc2db=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x2dbc[_0x1bbc08];return _0x5d825b;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0xc2db('0x0'));var sh=require(_0xc2db('0x1'));var odbc=require('odbc')();var rs=require(_0xc2db('0x2'));var moment=require(_0xc2db('0x3'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0xc2db('0x4'))('agi');var config=require(_0xc2db('0x5'));var scripts=require(_0xc2db('0x6'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0xc2db('0x7')];var verticesWithRetry=[_0xc2db('0x8'),_0xc2db('0x9'),_0xc2db('0xa')];var AGIVertices=function(_0x5f1567,_0x3a65ee,_0x368c59){this[_0xc2db('0xb')]=_0x5f1567;this[_0xc2db('0xc')]=_0x3a65ee;this[_0xc2db('0xd')]=_0x368c59;};AGIVertices[_0xc2db('0xe')][_0xc2db('0xf')]=function(_0x2ff905,_0x4853ed){this[_0xc2db('0xc')][_0xc2db('0x10')](_0x2ff905)[_0xc2db('0x11')](function(_0x1256fd){_0x4853ed(null,_0x1256fd?_0x1256fd[_0xc2db('0x12')]:![]);})[_0xc2db('0x13')](function(_0x29cac0){_0x4853ed(_0x29cac0);});};AGIVertices['prototype'][_0xc2db('0x14')]=function(_0x211439,_0x2d2ba4){this[_0xc2db('0xc')][_0xc2db('0x15')](_0x211439)[_0xc2db('0x11')](function(_0x36032f){_0x2d2ba4(null,_0x36032f?_0x36032f[_0xc2db('0x12')]:![]);})[_0xc2db('0x13')](function(_0xd791a){_0x2d2ba4(_0xd791a);});};AGIVertices['prototype'][_0xc2db('0x16')]=function(_0x457513,_0xea85a){this[_0xc2db('0xc')][_0xc2db('0x17')](_0x457513)[_0xc2db('0x11')](function(_0x54b0c8){_0xea85a(null,_0x54b0c8?_0x54b0c8['name']:![]);})[_0xc2db('0x13')](function(_0x34fe4b){_0xea85a(_0x34fe4b);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x18')]=function(_0x3bb311,_0x2d8a87){this[_0xc2db('0xc')][_0xc2db('0x19')](_0x3bb311)[_0xc2db('0x11')](function(_0x3c9e6b){_0x2d8a87(null,_0x3c9e6b?_0x3c9e6b[_0xc2db('0x1a')]:![]);})[_0xc2db('0x13')](function(_0x10a159){_0x2d8a87(_0x10a159);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x1b')]=function(_0x3f51be,_0xfa37d3){this[_0xc2db('0xc')][_0xc2db('0x1c')](_0x3f51be)[_0xc2db('0x11')](function(_0x8852eb){_0xfa37d3(null,_0x8852eb?_0x8852eb[_0xc2db('0x12')]:![]);})[_0xc2db('0x13')](function(_0x2b5f5c){_0xfa37d3(_0x2b5f5c);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x1d')]=function(_0x563a16,_0x220137){this[_0xc2db('0xc')][_0xc2db('0x1e')](_0x563a16)['then'](function(_0x597380){_0x220137(null,_0x597380?_0x597380[_0xc2db('0x12')]:![]);})[_0xc2db('0x13')](function(_0xc2b38e){_0x220137(_0xc2b38e);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x1f')]=function(_0x55e49a,_0x4f10ff){var _0x52e940=this;this[_0xc2db('0xc')][_0xc2db('0x20')](_0x55e49a)[_0xc2db('0x11')](function(_0x38ac4b){_0x4f10ff(null,_0x38ac4b?_0x52e940[_0xc2db('0x21')](_0x38ac4b['save_name']):![]);})[_0xc2db('0x13')](function(_0x542747){_0x4f10ff(_0x542747);});};AGIVertices[_0xc2db('0xe')]['getMailAccount']=function(_0x5e70d4,_0x4415be){this['rpc']['getMailAccountById'](_0x5e70d4)[_0xc2db('0x11')](function(_0x327cc0){_0x4415be(null,_0x327cc0?_0x327cc0:![]);})[_0xc2db('0x13')](function(_0x322b2c){_0x4415be(_0x322b2c);});};AGIVertices['prototype'][_0xc2db('0x22')]=function(_0x2e484b,_0x2a988b,_0x3aac7e){this[_0xc2db('0xd')][_0xc2db('0x22')](_0x2e484b,_0x2a988b)[_0xc2db('0x11')](function(){_0x3aac7e(null);})[_0xc2db('0x13')](function(_0x19efdb){_0x3aac7e(_0x19efdb);});};AGIVertices['prototype']['getIntervals']=function(_0xf83272,_0x2e4ef3){this[_0xc2db('0xc')][_0xc2db('0x23')](_0xf83272)[_0xc2db('0x11')](function(_0x421bbd){if(_0x421bbd){if(_0x421bbd['IntervalId']){_0x2e4ef3(null,[_0x421bbd[_0xc2db('0x24')]]);}else{_0x2e4ef3(null,_[_0xc2db('0x25')](_0x421bbd[_0xc2db('0x26')],_0xc2db('0x24')));}}else{_0x2e4ef3(null,![]);}})[_0xc2db('0x13')](function(_0x4d7ce1){_0x2e4ef3(_0x4d7ce1);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x21')]=function(_0x18de87){return util[_0xc2db('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x18de87);};AGIVertices[_0xc2db('0xe')]['getQueryOdbc']=function(_0x5b5c34,_0x30ae9e,_0x11509a){odbc[_0xc2db('0x28')](_0x5b5c34,function(_0x18f315){if(_0x18f315){logger[_0xc2db('0x29')](_0xc2db('0x2a'),_0x18f315);_0x11509a(_0x18f315);}else{logger['info'](_0xc2db('0x2b'));odbc[_0xc2db('0x2c')](_0x30ae9e,function(_0x4f01ed,_0x37bd7d){if(_0x4f01ed){logger[_0xc2db('0x2d')]('Error\x20executing\x20query\x20%s',_0x30ae9e);_0x11509a(_0x4f01ed);}else{logger[_0xc2db('0x2d')](_0xc2db('0x2e'),_0x30ae9e);odbc[_0xc2db('0x2f')](function(_0x36b346){if(_0x36b346){logger['error'](_0xc2db('0x30'),_0x36b346);}_0x11509a(null,_0x37bd7d);});}});}});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x31')]=function(_0x5d4bfb,_0x29abde){this[_0xc2db('0xc')][_0xc2db('0x32')](_0x5d4bfb)[_0xc2db('0x11')](function(_0x1d038a){_0x29abde(null,_0x1d038a?_0x1d038a:![]);})[_0xc2db('0x13')](function(_0x30f06f){_0x29abde(_0x30f06f);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x33')]=function(_0x41a9f7,_0x20ace8){this[_0xc2db('0xc')][_0xc2db('0x33')](_0x41a9f7)[_0xc2db('0x11')](function(_0x1ce360){_0x20ace8(null,_0x1ce360);})[_0xc2db('0x13')](function(_0xcc70db){_0x20ace8(_0xcc70db);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x34')]=function(_0x5bae5f,_0x23e170,_0xcc8083){this[_0xc2db('0xc')][_0xc2db('0x34')]({'uniqueid':this[_0xc2db('0xb')][_0xc2db('0x35')],'node':_0x5bae5f[_0xc2db('0x36')],'application':_0x5bae5f[_0xc2db('0x37')],'data':_0x23e170||null,'project_name':this[_0xc2db('0xb')][_0xc2db('0x38')],'callerid':this[_0xc2db('0xb')][_0xc2db('0x39')]})[_0xc2db('0x11')](function(_0x32cf60){if(_0xcc8083){_0xcc8083(null,_0x32cf60);}})[_0xc2db('0x13')](function(_0x2a41e9){if(_0xcc8083){_0xcc8083(_0x2a41e9);}});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x3a')]=function(_0x49584c,_0x5538a9,_0xba1a07,_0x51c137){this[_0xc2db('0xc')][_0xc2db('0x3a')]({'uniqueid':this[_0xc2db('0xb')]['uniqueid'],'callerid':this[_0xc2db('0xb')]['callerid'],'calleridname':this[_0xc2db('0xb')][_0xc2db('0x3b')],'context':this[_0xc2db('0xb')][_0xc2db('0x3c')],'extension':this[_0xc2db('0xb')][_0xc2db('0x3d')],'priority':this['channel'][_0xc2db('0x3e')],'accountcode':this[_0xc2db('0xb')]['accountcode'],'dnid':this[_0xc2db('0xb')][_0xc2db('0x3f')],'projectName':this[_0xc2db('0xb')]['arg_1'],'saveName':_0x5538a9,'filename':_0x49584c[_0xc2db('0x40')]||_0x5538a9,'savePath':_0xba1a07})['then'](function(_0x3d101c){_0x51c137(null,_0x3d101c);})['catch'](function(_0x584016){_0x51c137(_0x584016);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x41')]=function(_0x5bd07c,_0xe94208,_0x233eba,_0xf59bce,_0x4fbccb){this[_0xc2db('0xc')][_0xc2db('0x41')]({'uniqueid':this[_0xc2db('0xb')][_0xc2db('0x35')],'body':_0x5bd07c,'direction':_0xe94208,'providerName':_0x233eba,'providerResponse':_0xf59bce})[_0xc2db('0x11')](function(_0x450ae5){if(_0x4fbccb){_0x4fbccb(null,_0x450ae5);}})[_0xc2db('0x13')](function(_0x5b853c){if(_0x4fbccb){_0x4fbccb(_0x5b853c);}});};AGIVertices[_0xc2db('0xe')]['createCmContact']=function(_0x15e37c,_0x59e50a){this['rpc'][_0xc2db('0x42')]({'firstName':_[_0xc2db('0x43')](_0x15e37c[_0xc2db('0x12')])||_[_0xc2db('0x44')](_0x15e37c[_0xc2db('0x12')])?_0xc2db('0x45')+Math[_0xc2db('0x46')]():_0x15e37c[_0xc2db('0x12')],'lastName':_[_0xc2db('0x43')](_0x15e37c[_0xc2db('0x47')])||_['isNil'](_0x15e37c[_0xc2db('0x47')])?null:_0x15e37c[_0xc2db('0x47')],'phone':_0x15e37c[_0xc2db('0x48')],'ListId':_0x15e37c[_0xc2db('0x49')],'scheduledat':_0x15e37c[_0xc2db('0x4a')],'callbackUniqueid':this[_0xc2db('0xb')][_0xc2db('0x35')],'tags':'callback','description':_0xc2db('0x4b')+_0x15e37c[_0xc2db('0x4a')][_0xc2db('0x4c')](),'priority':_0x15e37c[_0xc2db('0x4d')]})[_0xc2db('0x11')](function(_0x5746ab){_0x59e50a(null,_0x5746ab);})[_0xc2db('0x13')](function(_0x5b571a){_0x59e50a(_0x5b571a);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x4e')]=function(_0x12f750,_0x143ecd){this[_0xc2db('0xc')]['getPauseById'](_0x12f750)[_0xc2db('0x11')](function(_0x63d8f2){_0x143ecd(null,_0x63d8f2?_0x63d8f2[_0xc2db('0x12')]:![]);})['catch'](function(_0x37efa3){_0x143ecd(_0x37efa3);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x4f')]=function(_0x5660ef,_0x49b0d6,_0x53cd35){var _0x23c043={'role':_0xc2db('0x50')};_0x23c043[_0x5660ef]=this[_0xc2db('0xb')][_0xc2db('0x39')];this['rpc'][_0xc2db('0x4f')](_0x23c043,_0x49b0d6,this['channel'][_0xc2db('0x35')])[_0xc2db('0x11')](function(_0x53e743){_0x53cd35(null,_['isNil'](_0x53e743)?![]:!![]);})[_0xc2db('0x13')](function(_0x5aa2cf){logger[_0xc2db('0x29')](_0x5aa2cf);_0x53cd35(null,![]);});};AGIVertices[_0xc2db('0xe')]['agentUnpause']=function(_0x46ddb1,_0x35db29){var _0x4f9df4={'role':_0xc2db('0x50')};_0x4f9df4[_0x46ddb1]=this[_0xc2db('0xb')]['callerid'];this['rpc']['agentUnpause'](_0x4f9df4)[_0xc2db('0x11')](function(_0x92ef1){_0x35db29(null,_['isNil'](_0x92ef1)?![]:!![]);})[_0xc2db('0x13')](function(_0x2a645d){logger[_0xc2db('0x29')](_0x2a645d);_0x35db29(null,![]);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x51')]=function(_0x3f37bb,_0x1a1f0d){var _0x344a41={'role':_0xc2db('0x50')};_0x344a41[_0x3f37bb]=this['channel'][_0xc2db('0x39')];this['rpc']['agentLogout'](_0x344a41)[_0xc2db('0x11')](function(_0x23f2b3){_0x1a1f0d(null,_['isNil'](_0x23f2b3)?![]:!![]);})['catch'](function(_0xea36ae){logger[_0xc2db('0x29')](_0xea36ae);_0x1a1f0d(null,![]);});};AGIVertices[_0xc2db('0xe')]['agentLogin']=function(_0x4193d1,_0x26a587){var _0x5226e7={'role':_0xc2db('0x50')};_0x5226e7[_0x4193d1]=this[_0xc2db('0xb')][_0xc2db('0x39')];var _0x21e534=_0x4193d1!=_0xc2db('0x52')?util[_0xc2db('0x27')](_0xc2db('0x53'),_0xc2db('0x54'),this[_0xc2db('0xb')][_0xc2db('0x39')]):undefined;this[_0xc2db('0xc')][_0xc2db('0x55')](_0x5226e7,_0x21e534)[_0xc2db('0x11')](function(_0x2f6a03){_0x26a587(null,_[_0xc2db('0x44')](_0x2f6a03)?![]:!![]);})[_0xc2db('0x13')](function(_0x45aafd){logger['error'](_0x45aafd);_0x26a587(null,![]);});};AGIVertices[_0xc2db('0xe')]['shellCommand']=function(_0x213f27,_0x16252e){sh[_0xc2db('0x56')](_[_0xc2db('0x57')](_0x213f27),function(_0x6ec1cf,_0x4606cc){var _0x29f2fd=_0x4606cc[_0xc2db('0x58')](/(\r\n|\n|\r)/gm,'');_0x16252e(null,_0x29f2fd);});};AGIVertices[_0xc2db('0xe')]['googleCloudTTS']=function(_0x327989,_0x5396ae){scripts[_0xc2db('0x59')](_0x327989['apiKey'],_0x327989['google_cloud_tts_text_type']||_0xc2db('0x5a'),_0x327989[_0xc2db('0x5a')],_0x327989['languageCode']||_0xc2db('0x5b'),_0x327989['ssmlGender']||_0xc2db('0x5c'),_0x327989[_0xc2db('0x5d')]||_0xc2db('0x5e'))[_0xc2db('0x11')](function(_0x401bf1){_0x5396ae(null,_0x401bf1);})[_0xc2db('0x13')](function(_0x42f734){_0x5396ae(_0x42f734);});};AGIVertices['prototype'][_0xc2db('0x5f')]=function(_0xa27ac5,_0x22933f){scripts[_0xc2db('0x5f')](_0xa27ac5[_0xc2db('0x5a')],_0xa27ac5[_0xc2db('0x60')]||'en',0x1)[_0xc2db('0x11')](function(_0x5001d1){_0x22933f(null,_0x5001d1);})[_0xc2db('0x13')](function(_0x2e6dfd){_0x22933f(_0x2e6dfd);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x61')]=function(_0x550f99,_0x542027){var _0x5dae0a={'uri':_0x550f99['url'],'method':_0x550f99[_0xc2db('0x62')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x550f99[_0xc2db('0x63')])==='number'&&parseInt(_0x550f99['timeout'])>=0x1?parseInt(_0x550f99['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xc2db('0x64'),_0xc2db('0x65')],_0x5dae0a['method'][_0xc2db('0x66')]())){try{_0x5dae0a[_0xc2db('0x67')]=_0x550f99[_0xc2db('0x7')]?JSON[_0xc2db('0x68')](_0x550f99['rawBody']):{};}catch(_0x5ef77a){logger[_0xc2db('0x29')](_0xc2db('0x69'),_0x5ef77a);}}try{_0x5dae0a['headers']=_0x550f99[_0xc2db('0x6a')]?JSON[_0xc2db('0x68')](_0x550f99[_0xc2db('0x6a')]):{};}catch(_0xa4d15c){logger[_0xc2db('0x29')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0xa4d15c);}if(_0x550f99[_0xc2db('0x6b')]){try{var _0x489c7a=require(_0x550f99[_0xc2db('0x6b')])[_0xc2db('0x6c')](this,_0x5dae0a);_0x5dae0a[_0xc2db('0x6d')]=Mustache[_0xc2db('0x6e')](_0x550f99[_0xc2db('0x6f')],_0x489c7a,{},['$$','$$']);if(_0x5dae0a[_0xc2db('0x70')]){_0x5dae0a['headers']=JSON[_0xc2db('0x68')](Mustache[_0xc2db('0x6e')](JSON[_0xc2db('0x71')](_0x5dae0a[_0xc2db('0x70')]),_0x489c7a,{},['$$','$$']));}if(_0x5dae0a['body']){_0x5dae0a[_0xc2db('0x67')]=JSON[_0xc2db('0x68')](Mustache[_0xc2db('0x6e')](JSON[_0xc2db('0x71')](_0x5dae0a['body']),_0x489c7a,{},['$$','$$']));}}catch(_0x47a637){logger[_0xc2db('0x29')](_0xc2db('0x72'),_0x47a637);}}rp(_0x5dae0a)[_0xc2db('0x11')](function(_0x37ea91){var _0x912adb={'statusCode':_0x37ea91[_0xc2db('0x73')]||0xc8,'statusMessage':_0x37ea91[_0xc2db('0x74')]||'OK','headers':_0x37ea91['headers']||{},'body':_0x37ea91[_0xc2db('0x67')]||{}};_0x542027(null,_0x912adb);})[_0xc2db('0x13')](function(_0x57ba10){var _0x10984d={'statusCode':_0x57ba10[_0xc2db('0x73')]||0x1f4,'statusMessage':_0x57ba10[_0xc2db('0x75')]||_0xc2db('0x76'),'headers':_0x57ba10['options']['headers']||{},'body':_0x57ba10['options'][_0xc2db('0x67')]||{}};_0x542027(null,_0x10984d);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x77')]=function(_0x47eba3,_0x3f5891){scripts['googleDialogflow'](this[_0xc2db('0xb')][_0xc2db('0x35')],_0x47eba3[_0xc2db('0x78')],_0x47eba3['text'],_0x47eba3['dialogflow_language']||'en')['then'](function(_0x378eb3){_0x3f5891(null,_0x378eb3);})[_0xc2db('0x13')](function(_0xd3a3ef){_0x3f5891(_0xd3a3ef);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x79')]=function(_0x25c11e,_0x81bd9c){scripts[_0xc2db('0x79')](this[_0xc2db('0xb')]['uniqueid'],_0x25c11e[_0xc2db('0x7a')],_0x25c11e[_0xc2db('0x7b')],_0x25c11e['private_key'],_0x25c11e[_0xc2db('0x5a')],_0x25c11e[_0xc2db('0x7c')]||'en')[_0xc2db('0x11')](function(_0x44fefb){_0x81bd9c(null,_0x44fefb);})['catch'](function(_0x1d379d){_0x81bd9c(_0x1d379d);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x7d')]=function(_0x42dc81,_0x30e7ab){scripts[_0xc2db('0x7d')](this['channel'],_0x42dc81)['then'](function(_0x5da084){_0x30e7ab(null,_0x5da084);})[_0xc2db('0x13')](function(_0x4ab1f7){_0x30e7ab(_0x4ab1f7);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x7e')]=function(_0x51938c,_0x2100e0){scripts['ispeechTTS'](_0x51938c[_0xc2db('0x78')],_0x51938c[_0xc2db('0x5a')],_0x51938c[_0xc2db('0x7f')]||_0xc2db('0x5b'),_0x51938c[_0xc2db('0x80')])[_0xc2db('0x11')](function(_0x5b1f04){_0x2100e0(null,_0x5b1f04);})[_0xc2db('0x13')](function(_0x250848){_0x2100e0(_0x250848);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x81')]=function(_0xb6a468,_0x5c483b,_0x4aa930){scripts[_0xc2db('0x81')](_0x5c483b,_0xb6a468[_0xc2db('0x78')],_0xb6a468[_0xc2db('0x82')]||'en-US',this['isConfigured'](_0xb6a468[_0xc2db('0x83')])?_0xb6a468[_0xc2db('0x83')]:undefined)[_0xc2db('0x11')](function(_0x2cf4a3){_0x4aa930(null,_0x2cf4a3);})['catch'](function(_0x3c41e6){_0x4aa930(_0x3c41e6);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x84')]=function(_0x22681f,_0x3cdc6e){scripts['awsPolly'](_0x22681f['aws_access_key_id'],_0x22681f[_0xc2db('0x85')],_0x22681f['aws_polly_region'],_0x22681f[_0xc2db('0x86')]||_0xc2db('0x87'),_0x22681f['text'],_0x22681f[_0xc2db('0x88')]||_0xc2db('0x5a'))[_0xc2db('0x11')](function(_0x326213){_0x3cdc6e(null,_0x326213);})[_0xc2db('0x13')](function(_0x326aae){_0x3cdc6e(_0x326aae);});};AGIVertices[_0xc2db('0xe')]['awsLex']=function(_0x54d045,_0x411689){scripts[_0xc2db('0x89')](this[_0xc2db('0xb')][_0xc2db('0x35')],_0x54d045[_0xc2db('0x8a')],_0x54d045[_0xc2db('0x85')],_0x54d045[_0xc2db('0x8b')],_0x54d045[_0xc2db('0x5a')],_0x54d045[_0xc2db('0x8c')])['then'](function(_0x607b0b){_0x411689(null,_0x607b0b);})['catch'](function(_0x450e6b){_0x411689(_0x450e6b);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x8d')]=function(_0x523f09,_0x2a4fe8,_0x10bab4){scripts['googleASR'](_0x2a4fe8,_0x523f09[_0xc2db('0x78')],_0x523f09[_0xc2db('0x8e')]||_0xc2db('0x5b'))[_0xc2db('0x11')](function(_0x1aefec){_0x10bab4(null,_0x1aefec);})[_0xc2db('0x13')](function(_0x46b905){_0x10bab4(_0x46b905);});};AGIVertices[_0xc2db('0xe')][_0xc2db('0x8f')]=function(_0x4126b4,_0x4cee48,_0x4d318f){scripts['tildeASR'](_0x4cee48,_0x4126b4[_0xc2db('0x90')],_0x4126b4[_0xc2db('0x91')],_0x4126b4[_0xc2db('0x6d')])[_0xc2db('0x11')](function(_0x822fef){_0x4d318f(null,_0x822fef);})[_0xc2db('0x13')](function(_0x3b2c65){_0x4d318f(_0x3b2c65);});};AGIVertices['prototype'][_0xc2db('0x92')]=function(_0x340833){var _0x266890=_['includes'](verticesWithRetry,_0x340833[_0xc2db('0x37')])?_0x340833:_[_0xc2db('0x93')](_0x340833);for(var _0x3a1348 in _0x266890){if(_0x266890[_0xc2db('0x94')](_0x3a1348)){if(_0x266890[_0x3a1348]&&_[_0xc2db('0x95')](_0x266890[_0x3a1348])){if(_[_0xc2db('0x96')](recursiveMapAttributes,_0x3a1348)){_0x266890[_0x3a1348]=this['replaceObjectAllVariables'](_0x266890[_0x3a1348]);}else{_0x266890[_0x3a1348]=this[_0xc2db('0x97')](_0x266890[_0x3a1348]);}}}}return _0x266890;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x26564e){for(var _0x46d255 in _0x26564e){if(_0x26564e['hasOwnProperty'](_0x46d255)){if(_['isPlainObject'](_0x26564e[_0x46d255])){this[_0xc2db('0x98')](_0x26564e[_0x46d255]);}else if(_[_0xc2db('0x99')](_0x26564e[_0x46d255])){for(var _0x4a7f3c=0x0;_0x4a7f3c<_0x26564e[_0x46d255][_0xc2db('0x9a')];_0x4a7f3c++){this[_0xc2db('0x98')](_0x26564e[_0x46d255][_0x4a7f3c]);}}else if(_[_0xc2db('0x95')](_0x26564e[_0x46d255])){_0x26564e[_0x46d255]=this[_0xc2db('0x97')](_0x26564e[_0x46d255]);}}}};AGIVertices[_0xc2db('0xe')]['saveRestApiResult']=function(_0x2cbcb6,_0x4c0bc7){for(var _0x332d96 in _0x2cbcb6){if(_0x2cbcb6[_0xc2db('0x94')](_0x332d96)){if(_['isPlainObject'](_0x2cbcb6[_0x332d96])){if(!_[_0xc2db('0x43')](_0x2cbcb6[_0x332d96])){this['saveRestApiResult'](_0x2cbcb6[_0x332d96],util[_0xc2db('0x27')](_0xc2db('0x9b'),_0x4c0bc7,_0x332d96));}}else if(_[_0xc2db('0x99')](_0x2cbcb6[_0x332d96])){for(var _0x9386c=0x0;_0x9386c<_0x2cbcb6[_0x332d96]['length'];_0x9386c++){this[_0xc2db('0x9c')](_0x2cbcb6[_0x332d96][_0x9386c],util['format'](_0xc2db('0x9b'),_0x4c0bc7,_0x332d96+'['+_0x9386c+']'));}}else{if(!_[_0xc2db('0x44')](_0x2cbcb6[_0x332d96])){this[_0xc2db('0xb')][_0xc2db('0x9d')](util[_0xc2db('0x27')](_0xc2db('0x9b'),_0x4c0bc7,_0x332d96),_0x2cbcb6[_0x332d96]);}}}}};AGIVertices[_0xc2db('0xe')][_0xc2db('0x9e')]=function(_0x4a35f4){try{var _0x1d7e01=JSON[_0xc2db('0x68')](_0x4a35f4);this[_0xc2db('0x98')](_0x1d7e01);return JSON[_0xc2db('0x71')](_0x1d7e01);}catch(_0x9ad9ad){return this['replaceAllVariables'](_0x4a35f4);}};AGIVertices[_0xc2db('0xe')]['replaceAllVariables']=function(_0x88bef7){var _0x8ee93c=_0x88bef7[_0xc2db('0x9f')]('{');for(var _0x2058cf=0x1;_0x2058cf<_0x8ee93c[_0xc2db('0x9a')];_0x2058cf+=0x1){var _0x1a949a=_0x8ee93c[_0x2058cf]['split']('}');if(_0x1a949a[_0xc2db('0x9a')]>0x1){_0x88bef7=_0x88bef7[_0xc2db('0xa0')]('{'+_0x1a949a[0x0]+'}',this['channel']['getVariable'](_0x1a949a[0x0])[_0xc2db('0xa1')]||_0x1a949a[0x0]);}}if(_0x8ee93c['length']===0x1){return _0x88bef7[_0xc2db('0x4c')]();}return this[_0xc2db('0x97')](_0x88bef7);};AGIVertices[_0xc2db('0xe')][_0xc2db('0xa2')]=function(_0x27dba3,_0x10f7ac){var _0x10b577=this[_0xc2db('0xb')][_0xc2db('0xf')](_0x27dba3);if(_0x10b577['result']===-0x1){return _0x10b577;}logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0xa3'),_0x10f7ac,_0x10b577['extra']));return this[_0xc2db('0xb')][_0xc2db('0x9d')](_0x10f7ac,_0x10b577['extra']);};AGIVertices[_0xc2db('0xe')][_0xc2db('0xa4')]=function(_0xaf1a23){return _0xaf1a23&&_0xaf1a23!=='0'&&_0xaf1a23!=='-1'&&_0xaf1a23!=='';};AGIVertices['prototype'][_0xc2db('0xa5')]=function(_0x1e55eb){this[_0xc2db('0x34')][_0xc2db('0x6c')](this,_0x1e55eb,'-');_0x1e55eb[_0xc2db('0xa6')]=_0x1e55eb[_0xc2db('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xc2db('0xe')][_0xc2db('0xa7')]=function(_0x36d2ec){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0xa8'),_0x36d2ec[_0xc2db('0x36')]));if(!this['isConfigured'](_0x36d2ec[_0xc2db('0x5a')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')]('no\x20text\x20configured');}var _0x5b4f41='\x22'+_0x36d2ec[_0xc2db('0x5a')]+'\x22';if(this[_0xc2db('0xa4')](_0x36d2ec[_0xc2db('0xaa')])){_0x5b4f41+=','+_0x36d2ec[_0xc2db('0xaa')];}var _0x505688=this['channel']['exec'](_0xc2db('0xab'),_0x5b4f41);if(_0x505688['result']===-0x1){return _0x505688;}return this[_0xc2db('0xb')]['noop'](util['format'](_0xc2db('0xac'),_0x5b4f41));};AGIVertices[_0xc2db('0xe')][_0xc2db('0xad')]=function(_0x1bd393){logger['info'](util[_0xc2db('0x27')](_0xc2db('0xae'),_0x1bd393['label']));if(!this['isConfigured'](_0x1bd393['grammar'])){return this['channel']['noop'](_0xc2db('0xaf'));}var _0x23802c=_0x1bd393['grammar'];if(this[_0xc2db('0xa4')](_0x1bd393[_0xc2db('0xaa')])){_0x23802c+=','+_0x1bd393[_0xc2db('0xaa')];}var _0x3f607b=this[_0xc2db('0xb')][_0xc2db('0x56')](_0xc2db('0xb0'),_0x23802c);if(_0x3f607b[_0xc2db('0xb1')]===-0x1){return _0x3f607b;}var _0x3763a3=this[_0xc2db('0xa2')](_0xc2db('0xb2'),_0xc2db('0xb3'));if(_0x3763a3[_0xc2db('0xb1')]===-0x1){return _0x3763a3;}var _0x66638=this[_0xc2db('0xa2')](_0xc2db('0xb4'),_0xc2db('0xb5'));if(_0x66638[_0xc2db('0xb1')]===-0x1){return _0x66638;}var _0x3acb8d=this['getAndSetVariable'](_0xc2db('0xb6'),_0xc2db('0xb7'));if(_0x3acb8d['result']===-0x1){return _0x3acb8d;}return this[_0xc2db('0xb')]['noop'](util[_0xc2db('0x27')](_0xc2db('0xb8'),_0x23802c));};AGIVertices['prototype'][_0xc2db('0xb9')]=function(_0x4a9d7c){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0xba'),_0x4a9d7c[_0xc2db('0x36')]));return this[_0xc2db('0xb')][_0xc2db('0xb9')]([_0x4a9d7c[_0xc2db('0xbb')],_0x4a9d7c[_0xc2db('0xbc')]]);};AGIVertices[_0xc2db('0xe')]['answer']=function(_0x38b013){logger['info'](util['format'](_0xc2db('0xbd'),_0x38b013[_0xc2db('0x36')]));if(this[_0xc2db('0xa4')](_0x38b013[_0xc2db('0x63')])){logger['info'](util['format'](_0xc2db('0xbe'),_0x38b013[_0xc2db('0x63')]));var _0x5a6612=this[_0xc2db('0xb')]['wait'](_0x38b013[_0xc2db('0x63')]);if(_0x5a6612[_0xc2db('0xb1')]===-0x1){return _0x5a6612;}}return this[_0xc2db('0xb')]['answer']();};AGIVertices[_0xc2db('0xe')][_0xc2db('0xbf')]=function(_0x498588){logger[_0xc2db('0x2d')](util['format'](_0xc2db('0xc0'),_0x498588[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x498588[_0xc2db('0x49')])){return this['channel'][_0xc2db('0x29')](_0x498588,_0xc2db('0xc1'));}_0x498588[_0xc2db('0x4a')]=moment();if(this[_0xc2db('0xa4')](_0x498588[_0xc2db('0xc2')])){_0x498588['scheduledAt']=moment()[_0xc2db('0xc3')](_0x498588[_0xc2db('0xc2')],_0xc2db('0xc4'));}if(!this[_0xc2db('0xa4')](_0x498588[_0xc2db('0x4d')])){_0x498588[_0xc2db('0x4d')]=0x2;}this['createCmContact'][_0xc2db('0x6c')](this,_0x498588);return this['channel']['noop'](util[_0xc2db('0x27')](_0xc2db('0xc5'),_0x498588[_0xc2db('0x48')],_0x498588[_0xc2db('0x49')],_0x498588[_0xc2db('0x4a')]));};AGIVertices[_0xc2db('0xe')][_0xc2db('0xc6')]=function(_0x9bc8ca){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0xc7'),_0x9bc8ca[_0xc2db('0x36')]));var _0x536588=this[_0xc2db('0xb')]['exec'](_0x9bc8ca[_0xc2db('0xc8')],_0x9bc8ca[_0xc2db('0xaa')]);if(_0x536588[_0xc2db('0xb1')]===-0x1){return _0x536588;}return this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0xc9'),_0x9bc8ca['application'],_0x9bc8ca[_0xc2db('0xaa')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x5af902){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0xca'),_0x5af902[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x5af902[_0xc2db('0x5a')])){return this[_0xc2db('0xb')]['noop'](_0xc2db('0xcb'));}var _0x18b1a5='\x22'+_0x5af902[_0xc2db('0x5a')]+'\x22';if(this[_0xc2db('0xa4')](_0x5af902[_0xc2db('0xaa')])){_0x18b1a5+=','+_0x5af902['options'];}var _0x3fddf4=this[_0xc2db('0xb')][_0xc2db('0x56')](_0xc2db('0xab'),_0x18b1a5);if(_0x3fddf4[_0xc2db('0xb1')]===-0x1){return _0x3fddf4;}return this[_0xc2db('0xb')]['noop'](util[_0xc2db('0x27')](_0xc2db('0xac'),_0x18b1a5));};AGIVertices[_0xc2db('0xe')][_0xc2db('0xcc')]=function(_0x2a7994){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0xcd'),_0x2a7994['label']));if(!this[_0xc2db('0xa4')](_0x2a7994['text'])){return this[_0xc2db('0xb')]['noop']('no\x20text\x20configured');}var _0x36984e='\x22'+_0x2a7994[_0xc2db('0x5a')]+'\x22';if(this[_0xc2db('0xa4')](_0x2a7994[_0xc2db('0xaa')])){_0x36984e+=','+_0x2a7994[_0xc2db('0xaa')];}var _0x294303=this[_0xc2db('0xb')][_0xc2db('0x56')](_0xc2db('0xab'),_0x36984e);if(_0x294303[_0xc2db('0xb1')]===-0x1){return _0x294303;}return this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0xac'),_0x36984e));};AGIVertices[_0xc2db('0xe')]['lumenvoxasr']=function(_0x7e0da2){logger['info'](util[_0xc2db('0x27')](_0xc2db('0xce'),_0x7e0da2[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x7e0da2[_0xc2db('0xcf')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')]('no\x20grammar\x20configured');}var _0x371df9=_0x7e0da2[_0xc2db('0xcf')];if(this[_0xc2db('0xa4')](_0x7e0da2[_0xc2db('0xaa')])){_0x371df9+=','+_0x7e0da2[_0xc2db('0xaa')];}var _0x5a0bfc=this[_0xc2db('0xb')][_0xc2db('0x56')](_0xc2db('0xb0'),_0x371df9);if(_0x5a0bfc[_0xc2db('0xb1')]===-0x1){return _0x5a0bfc;}var _0x5d6eed=this[_0xc2db('0xa2')](_0xc2db('0xb2'),_0xc2db('0xd0'));if(_0x5d6eed[_0xc2db('0xb1')]===-0x1){return _0x5d6eed;}var _0x98702a=this['getAndSetVariable'](_0xc2db('0xb4'),_0xc2db('0xd1'));if(_0x98702a[_0xc2db('0xb1')]===-0x1){return _0x98702a;}var _0x44c7be=this['getAndSetVariable'](_0xc2db('0xb6'),_0xc2db('0xd2'));if(_0x44c7be[_0xc2db('0xb1')]===-0x1){return _0x44c7be;}return this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0xb8'),_0x371df9));};AGIVertices['prototype'][_0xc2db('0xd3')]=function(_0x5236e4){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0xd4'),_0x5236e4['label']));if(!this['isConfigured'](_0x5236e4[_0xc2db('0xcf')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0xaf'));}var _0x297505=_0x5236e4[_0xc2db('0xcf')];if(this[_0xc2db('0xa4')](_0x5236e4['options'])){_0x297505+=','+_0x5236e4[_0xc2db('0xaa')];}var _0x3e4722=this['channel'][_0xc2db('0x56')](_0xc2db('0xb0'),_0x297505);if(_0x3e4722[_0xc2db('0xb1')]===-0x1){return _0x3e4722;}var _0xe790ab=this['getAndSetVariable'](_0xc2db('0xb2'),_0xc2db('0xd5'));if(_0xe790ab[_0xc2db('0xb1')]===-0x1){return _0xe790ab;}var _0x4d5ef6=this['getAndSetVariable'](_0xc2db('0xb4'),_0xc2db('0xd6'));if(_0x4d5ef6['result']===-0x1){return _0x4d5ef6;}var _0x510dea=this[_0xc2db('0xa2')](_0xc2db('0xb6'),'SESTEK_ASR_INSTANCE');if(_0x510dea['result']===-0x1){return _0x510dea;}return this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0xb8'),_0x297505));};AGIVertices[_0xc2db('0xe')][_0xc2db('0xd7')]=function(_0x3eb5f1){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0xd8'),_0x3eb5f1[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x3eb5f1[_0xc2db('0xd9')])){return this[_0xc2db('0xb')]['error'](_0x3eb5f1,_0xc2db('0xda'));}var _0x5b4e80=this[_0xc2db('0x18')]['sync'](this,_0x3eb5f1[_0xc2db('0xd9')]);if(!_0x5b4e80){return this['channel']['error'](_0x3eb5f1,_0xc2db('0xdb'));}if(!this[_0xc2db('0xa4')](_0x3eb5f1[_0xc2db('0x2c')])){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x3eb5f1,_0xc2db('0xdc'));}var _0x48c4cd=_0x3eb5f1[_0xc2db('0x2c')][_0xc2db('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0xc2db('0xb')]['noop'](util[_0xc2db('0x27')](_0xc2db('0xdd'),_0x48c4cd));var _0x765279=this[_0xc2db('0xde')][_0xc2db('0x6c')](this,_0x5b4e80,_0x48c4cd);this[_0xc2db('0x34')][_0xc2db('0x6c')](this,_0x3eb5f1,_0x48c4cd);if(!this[_0xc2db('0xa4')](_0x3eb5f1[_0xc2db('0xdf')])){return this[_0xc2db('0xb')]['noop'](_0xc2db('0xe0'));}var _0x25d9fc=this['getVariable'][_0xc2db('0x6c')](this,_0x3eb5f1['variable_id']);if(!_0x25d9fc){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x3eb5f1,_0xc2db('0xe1'));}var _0x2ea120=this;_0x765279['forEach'](function(_0x20e4c7,_0x5e7117){Object[_0xc2db('0xe2')](_0x20e4c7)[_0xc2db('0xe3')](function(_0x1c6599){_0x2ea120[_0xc2db('0xb')][_0xc2db('0x9d')](util['format'](_0xc2db('0xe4'),_0x25d9fc,_0x5e7117,_0x1c6599),_0x20e4c7[_0x1c6599]);});});this[_0xc2db('0xb')][_0xc2db('0x9d')](util['format'](_0xc2db('0xe5'),_0x25d9fc),_0x765279[_0xc2db('0x9a')]);return this[_0xc2db('0xb')]['noop'](util[_0xc2db('0x27')]('variable\x20%s\x20set',_0x25d9fc));};AGIVertices[_0xc2db('0xe')][_0xc2db('0xe6')]=function(_0x3a3858){logger[_0xc2db('0xe7')](util[_0xc2db('0x27')](_0xc2db('0xe8'),_0x3a3858[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x3a3858[_0xc2db('0xe9')])){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x3a3858,'no\x20user\x20selected');}var _0x3e2a7c=this[_0xc2db('0x1b')][_0xc2db('0x6c')](this,_0x3a3858['sip_id']);if(!_0x3e2a7c){return this[_0xc2db('0xb')]['error'](_0x3a3858,_0xc2db('0xea'));}var _0x31ffeb=this[_0xc2db('0xb')][_0xc2db('0x56')](_0xc2db('0xeb'),[util['format'](_0xc2db('0xec'),_0x3e2a7c),_0x3a3858['timeout'],_0x3a3858[_0xc2db('0xed')],_0x3a3858[_0xc2db('0x6f')]]);if(_0x31ffeb[_0xc2db('0xb1')]===-0x1){return _0x31ffeb;}return this['channel']['noop'](util[_0xc2db('0x27')]('Executed\x20command\x20%s',_0xc2db('0xeb')));};AGIVertices[_0xc2db('0xe')][_0xc2db('0xee')]=function(_0x5e09b2){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0xef'),_0x5e09b2[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x5e09b2[_0xc2db('0x78')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0xf0'));}if(!this[_0xc2db('0xa4')](_0x5e09b2[_0xc2db('0x5a')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0xcb'));}this[_0xc2db('0xb')][_0xc2db('0xf1')]=!![];this[_0xc2db('0x34')](_0x5e09b2);this['createSquareMessage'](_0x5e09b2[_0xc2db('0x5a')],'in','','');this['channel']['noop'](util[_0xc2db('0x27')](_0xc2db('0xf2'),_0x5e09b2['text']));var _0x40d870=this[_0xc2db('0x77')][_0xc2db('0x6c')](this,_0x5e09b2);if(_0x40d870){for(var _0x7a74bf in _0x40d870){if(_0x40d870[_0xc2db('0x94')](_0x7a74bf)){this[_0xc2db('0xb')]['setVariable'](util[_0xc2db('0x27')](_0xc2db('0xf3'),_0x7a74bf[_0xc2db('0x66')]()),_0x40d870[_0x7a74bf]);}}this[_0xc2db('0x41')](_0x40d870[_0xc2db('0xf4')],_0xc2db('0xf5'),_0xc2db('0xee'),'');return this['channel'][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0xf6'),_0x40d870['speech']));}return this['channel']['error'](_0x5e09b2,_0xc2db('0xf7'));};AGIVertices[_0xc2db('0xe')][_0xc2db('0xf8')]=function(_0x5a1ca6){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0xf9'),_0x5a1ca6[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x5a1ca6['dialogflowV2_project_id'])){return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0xfa'));}if(!this['isConfigured'](_0x5a1ca6[_0xc2db('0x7b')])){return this['channel']['noop'](_0xc2db('0xfb'));}if(!this[_0xc2db('0xa4')](_0x5a1ca6['private_key'])){return this[_0xc2db('0xb')][_0xc2db('0xa9')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x5a1ca6['dialogflowV2_language'])){return this['channel'][_0xc2db('0xa9')](_0xc2db('0xfc'));}if(!this[_0xc2db('0xa4')](_0x5a1ca6[_0xc2db('0x5a')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')]('no\x20text\x20configured');}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x5a1ca6);this['createSquareMessage'](_0x5a1ca6['text'],'in','','');this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0xfd'),_0x5a1ca6[_0xc2db('0x5a')]));var _0x536ef4=this[_0xc2db('0x79')]['sync'](this,_0x5a1ca6);if(_0x536ef4){for(var _0x466a37 in _0x536ef4){if(_0x536ef4[_0xc2db('0x94')](_0x466a37)){if(_0x466a37!=='providerResponse'){this[_0xc2db('0xb')][_0xc2db('0x9d')](util[_0xc2db('0x27')]('DIALOGFLOW_%s',_0x466a37[_0xc2db('0x66')]()),_0x536ef4[_0x466a37]);}}}this[_0xc2db('0x41')](_0x536ef4['speech'],_0xc2db('0xf5'),_0xc2db('0xf8'),_0x536ef4['providerResponse']);return this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0xfe'),_0x536ef4[_0xc2db('0xf4')]));}return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x5a1ca6,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xc2db('0xe')][_0xc2db('0xff')]=function(_0x496b9e){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x100'),_0x496b9e[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x496b9e[_0xc2db('0x101')])){return this['channel']['noop'](_0xc2db('0x102'));}if(!this[_0xc2db('0xa4')](_0x496b9e[_0xc2db('0x103')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0x104'));}if(!this[_0xc2db('0xa4')](_0x496b9e[_0xc2db('0x105')])){return this['channel'][_0xc2db('0xa9')](_0xc2db('0x106'));}if(!this[_0xc2db('0xa4')](_0x496b9e[_0xc2db('0x107')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0xcb'));}this[_0xc2db('0xb')][_0xc2db('0xf1')]=!![];this[_0xc2db('0x34')](_0x496b9e);this['createSquareMessage'](_0x496b9e[_0xc2db('0x5a')],'in','','');this['channel'][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x108'),_0x496b9e['text']));var _0x5d4dba=this[_0xc2db('0x7d')][_0xc2db('0x6c')](this,_0x496b9e);if(_0x5d4dba){for(var _0x4c65cb in _0x5d4dba){if(_0x5d4dba[_0xc2db('0x94')](_0x4c65cb)){this[_0xc2db('0xb')][_0xc2db('0x9d')](util[_0xc2db('0x27')](_0xc2db('0x109'),_0x4c65cb[_0xc2db('0x66')]()),_0x5d4dba[_0x4c65cb]);}}this[_0xc2db('0x41')](_0x5d4dba[_0xc2db('0xf4')],_0xc2db('0xf5'),_0xc2db('0xff'),'');if(_0x5d4dba[_0xc2db('0x10a')]){this['channel'][_0xc2db('0xa9')](util[_0xc2db('0x27')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5d4dba[_0xc2db('0x10a')]));var _0x2befd6=this[_0xc2db('0xb')][_0xc2db('0x10b')](_0x5d4dba[_0xc2db('0x10a')]);try{fs[_0xc2db('0x10c')](_0x5d4dba['audiofile']+_0xc2db('0x10d'));}catch(_0x2a9a17){logger[_0xc2db('0x29')](_0x2a9a17);}return _0x2befd6;}else{return this['channel'][_0xc2db('0xa9')](util['format'](_0xc2db('0x10e'),_0x5d4dba[_0xc2db('0xf4')]));}}return this['channel'][_0xc2db('0x29')](_0x496b9e,_0xc2db('0x10f'));};AGIVertices[_0xc2db('0xe')]['end']=function(_0x20a7ae){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x110'),_0x20a7ae['label']));return this[_0xc2db('0xb')][_0xc2db('0xa9')]('end');};AGIVertices[_0xc2db('0xe')]['ext_dial']=function(_0x413f05){logger['info'](util[_0xc2db('0x27')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x413f05['label']));var _0x4c3c72='';if(_0x413f05[_0xc2db('0x111')]){if(!this['isConfigured'](_0x413f05[_0xc2db('0x111')])){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x413f05,'no\x20trunk\x20selected');}else{var _0x10b043=parseInt(_0x413f05[_0xc2db('0x111')],0xa);if(isNaN(_0x10b043)){_0x4c3c72=_0x413f05[_0xc2db('0x111')];}else{_0x4c3c72=this[_0xc2db('0x1d')][_0xc2db('0x6c')](this,_0x413f05['trunk_id']);if(!_0x4c3c72){return this['channel'][_0xc2db('0x29')](_0x413f05,_0xc2db('0x112'));}}}}else if(_0x413f05['trunk_name']){_0x4c3c72=_0x413f05[_0xc2db('0x113')];}else{return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x413f05,_0xc2db('0x114'));}var _0x45c740=this['channel'][_0xc2db('0x56')](_0xc2db('0xeb'),[util['format']('SIP/%s/%s',_0x4c3c72,_0x413f05[_0xc2db('0x48')]),_0x413f05[_0xc2db('0x63')],_0x413f05['opts'],_0x413f05['url']]);if(_0x45c740['result']===-0x1){return _0x45c740;}return this[_0xc2db('0xb')][_0xc2db('0xa9')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype'][_0xc2db('0x115')]=function(_0x83c6a4){logger['info'](util[_0xc2db('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x83c6a4['label']));return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0x115'));};AGIVertices[_0xc2db('0xe')]['getdigits']=function(_0x3b1878){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x3b1878[_0xc2db('0x36')]));if(_0x3b1878['retry']===0x0){return this['maxRetry'](_0x3b1878);}_0x3b1878[_0xc2db('0xa6')]-=0x1;if(!this[_0xc2db('0xa4')](_0x3b1878[_0xc2db('0x116')])){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x3b1878,_0xc2db('0x117'));}var _0x34061f=this[_0xc2db('0x1f')]['sync'](this,_0x3b1878[_0xc2db('0x116')]);if(!_0x34061f){return this[_0xc2db('0xb')]['error'](_0x3b1878,_0xc2db('0x118'));}if(!this[_0xc2db('0xa4')](_0x3b1878[_0xc2db('0xdf')])){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0xc2db('0xe0'));}var _0x2b8bba=this[_0xc2db('0xb')]['getData'](_0x34061f,_0x3b1878[_0xc2db('0x119')],_0x3b1878[_0xc2db('0x11a')]);var _0x1ae93c=_0x2b8bba[_0xc2db('0xb1')]?_0x2b8bba['result']['toString']():'';logger[_0xc2db('0x2d')](_0xc2db('0x11b'),JSON['stringify'](_0x2b8bba));if(_0x2b8bba[_0xc2db('0xb1')]===-0x1){this['createSquareDetailsReport'][_0xc2db('0x6c')](this,_0x3b1878,_0x1ae93c);return _0x2b8bba;}else if(_0x2b8bba[_0xc2db('0xa1')]===_0xc2db('0x63')){_0x2b8bba['result']=_0x1ae93c[_0xc2db('0x9a')]>=parseInt(_0x3b1878['mindigit'])?'x':'i';}else{_0x2b8bba[_0xc2db('0xb1')]=_0x1ae93c[_0xc2db('0x9a')]>=parseInt(_0x3b1878['mindigit'])&&_0x1ae93c['length']<=parseInt(_0x3b1878[_0xc2db('0x11a')])?'x':'i';}var _0x5927e3=this[_0xc2db('0xf')][_0xc2db('0x6c')](this,_0x3b1878['variable_id']);if(!_0x5927e3){return this[_0xc2db('0xb')]['error'](_0x3b1878,'no\x20variable\x20found');}this['channel']['setVariable'](_0x5927e3,_0x1ae93c);if(this[_0xc2db('0xa4')](_0x3b1878['hiddendigitsnum'])){var _0x17193a=parseInt(_0x3b1878['hiddendigitsnum'],0xa);var _0x1989a0=rs[_0xc2db('0x11c')]({'charset':'*','length':_0x17193a});var _0x2ffbdc=_0x1ae93c[_0xc2db('0x9a')];if(_0x2ffbdc>0x0){if(_0x2ffbdc>_0x17193a){this[_0xc2db('0x34')]['sync'](this,_0x3b1878,_0x3b1878['hiddendigitspos']===_0xc2db('0x11d')?_0x1989a0+_0x1ae93c[_0xc2db('0x11e')](_0x17193a):_0x1ae93c[_0xc2db('0x11e')](0x0,_0x2ffbdc-_0x17193a)+_0x1989a0);}else{this['createSquareDetailsReport'][_0xc2db('0x6c')](this,_0x3b1878,rs[_0xc2db('0x11c')]({'charset':'*','length':_0x2ffbdc}));}}else{this[_0xc2db('0x34')][_0xc2db('0x6c')](this,_0x3b1878,'');}}else{this['createSquareDetailsReport'][_0xc2db('0x6c')](this,_0x3b1878,_0x1ae93c);}return _0x2b8bba;};AGIVertices['prototype'][_0xc2db('0xa')]=function(_0x13503e){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x13503e[_0xc2db('0x36')]));return this['getdigits'](_0x13503e);};AGIVertices[_0xc2db('0xe')][_0xc2db('0x11f')]=function(_0x56166f){logger['info'](util[_0xc2db('0x27')](_0xc2db('0x120'),_0x56166f['label']));this['createSquareDetailsReport'][_0xc2db('0x6c')](this,_0x56166f,_0x56166f['goalname']);return this[_0xc2db('0xb')][_0xc2db('0xa9')](util['format'](_0xc2db('0x121'),_0x56166f[_0xc2db('0x122')]));};AGIVertices[_0xc2db('0xe')][_0xc2db('0x123')]=function(_0x25ef40){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x124'),_0x25ef40[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x25ef40[_0xc2db('0x8a')])||!this[_0xc2db('0xa4')](_0x25ef40[_0xc2db('0x85')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0x125'));}if(!this[_0xc2db('0xa4')](_0x25ef40[_0xc2db('0x5a')])){return this[_0xc2db('0xb')]['noop'](_0xc2db('0xcb'));}this[_0xc2db('0xb')][_0xc2db('0xa9')](util['format'](_0xc2db('0x126'),_0x25ef40[_0xc2db('0x5a')]));var _0x1a3cf1=this['awsPolly']['sync'](this,_0x25ef40);if(_0x1a3cf1){this[_0xc2db('0xb')]['noop'](util[_0xc2db('0x27')](_0xc2db('0x127'),_0x1a3cf1));var _0x37b529=this[_0xc2db('0xb')][_0xc2db('0x10b')](_0x1a3cf1);try{fs[_0xc2db('0x10c')](_0x1a3cf1+_0xc2db('0x10d'));}catch(_0x52bb0b){logger[_0xc2db('0x29')](_0x52bb0b);}return _0x37b529;}return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x25ef40,_0xc2db('0x128'));};AGIVertices[_0xc2db('0xe')][_0xc2db('0x129')]=function(_0x50d74e){logger[_0xc2db('0x2d')](util['format'](_0xc2db('0x12a'),_0x50d74e['label']));if(!this[_0xc2db('0xa4')](_0x50d74e[_0xc2db('0x8a')])||!this[_0xc2db('0xa4')](_0x50d74e[_0xc2db('0x85')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0x125'));}if(!this[_0xc2db('0xa4')](_0x50d74e[_0xc2db('0x8c')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x50d74e[_0xc2db('0x5a')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')]('no\x20text\x20configured');}this[_0xc2db('0xb')][_0xc2db('0xf1')]=!![];this[_0xc2db('0x34')](_0x50d74e);this[_0xc2db('0x41')](_0x50d74e[_0xc2db('0x5a')],'in','','');this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x12b'),_0x50d74e[_0xc2db('0x5a')]));var _0x56c8d9=this[_0xc2db('0x89')][_0xc2db('0x6c')](this,_0x50d74e);if(_0x56c8d9){for(var _0x33c81b in _0x56c8d9){if(_0x56c8d9[_0xc2db('0x94')](_0x33c81b)&&_[_0xc2db('0x95')](_0x56c8d9[_0x33c81b])){this[_0xc2db('0xb')]['setVariable'](util[_0xc2db('0x27')](_0xc2db('0x12c'),_0x33c81b[_0xc2db('0x66')]()),_0x56c8d9[_0x33c81b]);}}if(_[_0xc2db('0x44')](_0x56c8d9[_0xc2db('0x75')])){return this[_0xc2db('0xb')]['noop'](_0xc2db('0x12d'));}else{this['createSquareMessage'](_0x56c8d9['message'],_0xc2db('0xf5'),_0xc2db('0x12e'),'');return this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x12f'),_0x56c8d9[_0xc2db('0x75')]));}}return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x50d74e,_0xc2db('0x130'));};AGIVertices['prototype'][_0xc2db('0x131')]=function(_0x91c366){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x132'),_0x91c366['label'],_0x91c366[_0xc2db('0x63')]));if(!this[_0xc2db('0xa4')](_0x91c366[_0xc2db('0x78')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')]('no\x20key\x20configured');}var _0x34c74c=_0xc2db('0x133');var _0x15c4cb=util[_0xc2db('0x27')](_0xc2db('0x134'),FILES_PATH,rs['generate'](0x4));var _0x20ceab=util[_0xc2db('0x27')](_0xc2db('0x9b'),_0x15c4cb,_0x34c74c);var _0x3fdd72=!![];if(_0x91c366[_0xc2db('0x135')]===_0xc2db('0x136')){_0x3fdd72=![];}var _0x13b4fe=this[_0xc2db('0xb')]['recordFile'](_0x15c4cb,_0x34c74c,_0x91c366[_0xc2db('0x137')],_0x91c366[_0xc2db('0x63')],undefined,_0x3fdd72);if(_0x13b4fe[_0xc2db('0xb1')]!==-0x1){this[_0xc2db('0xb')][_0xc2db('0xa9')](util['format'](_0xc2db('0x138'),_0x20ceab));var _0x58621a=this[_0xc2db('0x8d')][_0xc2db('0x6c')](this,_0x91c366,_0x20ceab);if(_0x58621a){for(var _0x167a6a in _0x58621a){if(_0x58621a['hasOwnProperty'](_0x167a6a)){this['channel'][_0xc2db('0x9d')](util[_0xc2db('0x27')](_0xc2db('0x139'),_0x167a6a[_0xc2db('0x66')]()),_0x58621a[_0x167a6a]);}}return this[_0xc2db('0xb')]['noop'](util[_0xc2db('0x27')](_0xc2db('0x13a'),JSON[_0xc2db('0x71')](_0x58621a)));}}return _0x13b4fe;};AGIVertices[_0xc2db('0xe')][_0xc2db('0x13b')]=function(_0x3efe6b){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x13c'),_0x3efe6b[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x3efe6b['appid'])){return this['channel'][_0xc2db('0xa9')](_0xc2db('0x13d'));}if(!this[_0xc2db('0xa4')](_0x3efe6b['appsecret'])){return this[_0xc2db('0xb')]['noop'](_0xc2db('0x13e'));}var _0x148495='wav';var _0x3acdb6=util['format'](_0xc2db('0x134'),FILES_PATH,rs[_0xc2db('0x11c')](0x4));var _0x2da9fa=util[_0xc2db('0x27')](_0xc2db('0x9b'),_0x3acdb6,_0x148495);var _0xf66803=!![];if(_0x3efe6b['beep']===_0xc2db('0x136')){_0xf66803=![];}var _0x5659f4=this[_0xc2db('0xb')][_0xc2db('0x13f')](_0x3acdb6,_0x148495,_0x3efe6b[_0xc2db('0x137')],_0x3efe6b[_0xc2db('0x63')],undefined,_0xf66803);if(_0x5659f4[_0xc2db('0xb1')]!==-0x1){this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x140'),_0x2da9fa));var _0x3e9e55=this[_0xc2db('0x8f')][_0xc2db('0x6c')](this,_0x3efe6b,_0x2da9fa);if(_0x3e9e55){for(var _0x18572c in _0x3e9e55){if(_0x3e9e55['hasOwnProperty'](_0x18572c)){this[_0xc2db('0xb')][_0xc2db('0x9d')](util['format']('TILDE_ASR_%s',_0x18572c['toUpperCase']()),_0x3e9e55[_0x18572c]);}}return this['channel'][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x141'),JSON[_0xc2db('0x71')](_0x3e9e55)));}}return _0x5659f4;};AGIVertices[_0xc2db('0xe')][_0xc2db('0x142')]=function(_0x286ab5){logger['info'](util[_0xc2db('0x27')](_0xc2db('0x143'),_0x286ab5[_0xc2db('0x36')]));return this[_0xc2db('0xb')][_0xc2db('0x144')](_0x286ab5[_0xc2db('0x3c')],_0x286ab5[_0xc2db('0x3d')],_0x286ab5['priority']);};AGIVertices[_0xc2db('0xe')]['gotoif']=function(_0xa26a2e){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0xa26a2e[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0xa26a2e[_0xc2db('0x145')])){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0xa26a2e,_0xc2db('0x146'));}try{var _0x231e2b=eval(_0xa26a2e[_0xc2db('0x145')])?_0xc2db('0x147'):'false';this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x148'),_0xa26a2e[_0xc2db('0x145')],_0x231e2b));return{'code':0xc8,'result':_0x231e2b};}catch(_0x14853a){return{'code':0xc8,'result':_0xc2db('0x149')};}};AGIVertices[_0xc2db('0xe')][_0xc2db('0x14a')]=function(_0x53a32c){logger[_0xc2db('0x2d')](util['format'](_0xc2db('0x14b'),_0x53a32c['label']));if(!this[_0xc2db('0xa4')](_0x53a32c[_0xc2db('0x14c')])){return this['channel'][_0xc2db('0x29')](_0x53a32c,_0xc2db('0x14d'));}var _0x2827c6=this[_0xc2db('0x14e')][_0xc2db('0x6c')](this,_0x53a32c[_0xc2db('0x14c')]);if(!_0x2827c6){return this['channel'][_0xc2db('0x29')](_0x53a32c,_0xc2db('0x14f'));}for(var _0x4e5f2c=0x0;_0x4e5f2c<_0x2827c6[_0xc2db('0x9a')];_0x4e5f2c+=0x1){var _0x11086c=this['channel'][_0xc2db('0xf')](util[_0xc2db('0x27')](_0xc2db('0x150'),_0x2827c6[_0x4e5f2c]));if(_0x11086c[_0xc2db('0xb1')]===-0x1){return _0x11086c;}logger['info'](util[_0xc2db('0x27')]('IFTIME\x20%s\x20%s',_0x2827c6[_0x4e5f2c],_0x11086c[_0xc2db('0xa1')]));if(_0x11086c[_0xc2db('0xa1')]==='true'){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')]('IFTIME\x20%s\x20%s',_0x2827c6[_0x4e5f2c],_0xc2db('0x147')));this[_0xc2db('0xb')][_0xc2db('0xa9')](util['format'](_0xc2db('0x151'),_0x2827c6[_0x4e5f2c],_0xc2db('0x147')));return{'code':0xc8,'result':'true'};}else{logger[_0xc2db('0x2d')](util['format'](_0xc2db('0x151'),_0x2827c6[_0x4e5f2c],_0xc2db('0x149')));this[_0xc2db('0xb')]['noop'](util[_0xc2db('0x27')](_0xc2db('0x151'),_0x2827c6[_0x4e5f2c],_0xc2db('0x149')));}}return{'code':0xc8,'result':_0xc2db('0x149')};};AGIVertices[_0xc2db('0xe')][_0xc2db('0x152')]=function(_0x13c9b4){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x13c9b4['label']));return this[_0xc2db('0xb')][_0xc2db('0x152')]();};AGIVertices[_0xc2db('0xe')]['ispeechasr']=function(_0x5174f8){logger[_0xc2db('0x2d')](util['format'](_0xc2db('0x153'),_0x5174f8[_0xc2db('0x36')]));if(!this['isConfigured'](_0x5174f8[_0xc2db('0x78')])){return this['channel'][_0xc2db('0xa9')](_0xc2db('0xf0'));}var _0x34c229='wav';var _0x13aa79=util[_0xc2db('0x27')](_0xc2db('0x134'),FILES_PATH,rs[_0xc2db('0x11c')](0x4));var _0x3221dc=util['format']('%s.%s',_0x13aa79,_0x34c229);var _0x5e108b=!![];if(_0x5174f8[_0xc2db('0x135')]===_0xc2db('0x136')){_0x5e108b=![];}var _0x1c5719=this[_0xc2db('0xb')]['recordFile'](_0x13aa79,_0x34c229,_0x5174f8[_0xc2db('0x137')],_0x5174f8[_0xc2db('0x63')],undefined,_0x5e108b);if(_0x1c5719['result']!==-0x1){this['channel']['noop'](util['format'](_0xc2db('0x154'),_0x3221dc));var _0x594362=this['ispeechASR']['sync'](this,_0x5174f8,_0x3221dc);if(_0x594362){for(var _0x503722 in _0x594362){if(_0x594362[_0xc2db('0x94')](_0x503722)){this[_0xc2db('0xb')][_0xc2db('0x9d')](util[_0xc2db('0x27')](_0xc2db('0x155'),_0x503722[_0xc2db('0x66')]()),_0x594362[_0x503722]);}}return this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x594362)));}}return _0x1c5719;};AGIVertices[_0xc2db('0xe')][_0xc2db('0x156')]=function(_0x5d125){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x157'),_0x5d125[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x5d125[_0xc2db('0x78')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0xf0'));}if(!this[_0xc2db('0xa4')](_0x5d125[_0xc2db('0x5a')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')]('no\x20text\x20configured');}this[_0xc2db('0xb')][_0xc2db('0xa9')](util['format'](_0xc2db('0x158'),_0x5d125[_0xc2db('0x5a')]));var _0x15c48c=this[_0xc2db('0x7e')][_0xc2db('0x6c')](this,_0x5d125);if(_0x15c48c){this[_0xc2db('0xb')][_0xc2db('0xa9')](util['format'](_0xc2db('0x154'),_0x15c48c));var _0x4faab2=this[_0xc2db('0xb')][_0xc2db('0x10b')](_0x15c48c,_0x5d125[_0xc2db('0x137')]);try{fs[_0xc2db('0x10c')](_0x15c48c+'.wav');}catch(_0x14016f){logger[_0xc2db('0x29')](_0x14016f);}return _0x4faab2;}return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x5d125,_0xc2db('0x159'));};AGIVertices[_0xc2db('0xe')]['login']=function(_0x41dd69){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x15a'),_0x41dd69[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x41dd69[_0xc2db('0x15b')])){return this[_0xc2db('0xb')]['error'](_0x41dd69,_0xc2db('0x15c'));}logger[_0xc2db('0x2d')](util[_0xc2db('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xc2db('0xb')]['callerid'],_0x41dd69['findBy']));var _0x2307e2=this['agentLogin']['sync'](this,_0x41dd69['findBy']);if(_0x2307e2){logger['info'](util[_0xc2db('0x27')](_0xc2db('0x15d'),this[_0xc2db('0xb')][_0xc2db('0x39')],_0x41dd69[_0xc2db('0x15b')]));this[_0xc2db('0xb')]['noop'](util[_0xc2db('0x27')](_0xc2db('0x15d'),this[_0xc2db('0xb')][_0xc2db('0x39')],_0x41dd69['findBy']));return{'code':0xc8,'result':_0xc2db('0x15e')};}else{logger['info'](util[_0xc2db('0x27')](_0xc2db('0x15f'),this[_0xc2db('0xb')][_0xc2db('0x39')],_0x41dd69[_0xc2db('0x15b')]));this['channel'][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x15f'),this[_0xc2db('0xb')][_0xc2db('0x39')],_0x41dd69['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xc2db('0xe')]['logout']=function(_0x4ea4e6){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x160'),_0x4ea4e6[_0xc2db('0x36')]));if(!this['isConfigured'](_0x4ea4e6['findBy'])){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x4ea4e6,_0xc2db('0x15c'));}logger[_0xc2db('0x2d')](util['format'](_0xc2db('0x161'),this['channel'][_0xc2db('0x39')],_0x4ea4e6[_0xc2db('0x15b')]));var _0xe39430=this['agentLogout']['sync'](this,_0x4ea4e6[_0xc2db('0x15b')]);if(_0xe39430){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x15d'),this[_0xc2db('0xb')][_0xc2db('0x39')],_0x4ea4e6[_0xc2db('0x15b')]));this[_0xc2db('0xb')]['noop'](util[_0xc2db('0x27')](_0xc2db('0x15d'),this[_0xc2db('0xb')][_0xc2db('0x39')],_0x4ea4e6[_0xc2db('0x15b')]));return{'code':0xc8,'result':_0xc2db('0x15e')};}else{logger[_0xc2db('0x2d')](util['format'](_0xc2db('0x15f'),this[_0xc2db('0xb')][_0xc2db('0x39')],_0x4ea4e6[_0xc2db('0x15b')]));this[_0xc2db('0xb')][_0xc2db('0xa9')](util['format'](_0xc2db('0x15f'),this[_0xc2db('0xb')][_0xc2db('0x39')],_0x4ea4e6['findBy']));return{'code':0xc8,'result':_0xc2db('0x162')};}};AGIVertices[_0xc2db('0xe')][_0xc2db('0x163')]=function(_0x1eafac){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x1eafac[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x1eafac[_0xc2db('0x164')])){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x1eafac,'no\x20operation\x20configured');}this['channel'][_0xc2db('0xa9')](util['format'](_0xc2db('0x165'),_0x1eafac[_0xc2db('0x164')]));var _0x2c9083=eval(_0x1eafac[_0xc2db('0x164')]);if(!this[_0xc2db('0xa4')](_0x1eafac['variable_id'])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3e83ee=this[_0xc2db('0xf')][_0xc2db('0x6c')](this,_0x1eafac[_0xc2db('0xdf')]);if(!_0x3e83ee){return this['channel']['error'](_0x1eafac,'no\x20variable\x20found');}if(_[_0xc2db('0x99')](_0x2c9083)){var _0x2bedd5=this;_0x2c9083[_0xc2db('0xe3')](function(_0x366fb9,_0x54d388){_0x2bedd5[_0xc2db('0xb')]['setVariable'](util[_0xc2db('0x27')](_0xc2db('0x166'),_0x3e83ee,_0x54d388),_0x366fb9);});return this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x167'),_0x3e83ee));}else{return this[_0xc2db('0xb')][_0xc2db('0x9d')](_0x3e83ee,_0x2c9083);}};AGIVertices[_0xc2db('0xe')][_0xc2db('0x8')]=function(_0x153392){logger['info'](util[_0xc2db('0x27')](_0xc2db('0x168'),_0x153392[_0xc2db('0x36')]));if(_0x153392[_0xc2db('0xa6')]===0x0){return this[_0xc2db('0xa5')](_0x153392);}_0x153392['retry']-=0x1;if(!this[_0xc2db('0xa4')](_0x153392[_0xc2db('0x116')])){return this['channel'][_0xc2db('0x29')](_0x153392,_0xc2db('0x117'));}var _0x38084f=this[_0xc2db('0x1f')][_0xc2db('0x6c')](this,_0x153392['file_id']);if(!_0x38084f){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x153392,_0xc2db('0x118'));}var _0x1d3a89=this[_0xc2db('0xb')][_0xc2db('0x169')](_0x38084f,_0x153392['response'],_0x153392[_0xc2db('0x16a')]);var _0x59ad59=_0x1d3a89[_0xc2db('0xb1')];if(_0x1d3a89['result']===-0x1){this['createSquareDetailsReport'][_0xc2db('0x6c')](this,_0x153392,'-1');return _0x1d3a89;}else if(_0x1d3a89[_0xc2db('0xa1')]===_0xc2db('0x63')){_0x1d3a89[_0xc2db('0xb1')]=_0x1d3a89[_0xc2db('0xb1')][_0xc2db('0x9a')]>0x0?_0x1d3a89[_0xc2db('0xb1')]:'t';}else if(_[_0xc2db('0x43')](_0x1d3a89[_0xc2db('0xb1')])){_0x1d3a89[_0xc2db('0xb1')]='#';_0x59ad59='#';}if(!this[_0xc2db('0xa4')](_0x153392[_0xc2db('0xdf')])){this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0xe0'));}else{var _0x5b51b1=this['getVariable'][_0xc2db('0x6c')](this,_0x153392[_0xc2db('0xdf')]);if(!_0x5b51b1){return this[_0xc2db('0xb')]['error'](_0x153392,_0xc2db('0xe1'));}this[_0xc2db('0xb')][_0xc2db('0x9d')](_0x5b51b1,_0x59ad59);}this[_0xc2db('0x34')][_0xc2db('0x6c')](this,_0x153392,_0x59ad59);return _0x1d3a89;};AGIVertices['prototype']['noop']=function(_0x330926){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x16b'),_0x330926[_0xc2db('0x36')]));return this['channel'][_0xc2db('0xa9')](_0x330926[_0xc2db('0x16c')]||_0x330926[_0xc2db('0x36')]);};AGIVertices[_0xc2db('0xe')]['pause']=function(_0x554b92){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x16d'),_0x554b92['label']));if(!this[_0xc2db('0xa4')](_0x554b92[_0xc2db('0x15b')])){return this['channel'][_0xc2db('0x29')](_0x554b92,'no\x20find\x20by\x20configured');}logger[_0xc2db('0x2d')](util[_0xc2db('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xc2db('0xb')]['callerid'],_0x554b92[_0xc2db('0x15b')]));var _0x307f16=this[_0xc2db('0x4e')][_0xc2db('0x6c')](this,_0x554b92['pause_id']);var _0x492209=this[_0xc2db('0x4f')][_0xc2db('0x6c')](this,_0x554b92['findBy'],_0x307f16);if(_0x492209){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x15d'),this[_0xc2db('0xb')][_0xc2db('0x39')],_0x554b92[_0xc2db('0x15b')]));this['channel'][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x15d'),this[_0xc2db('0xb')]['callerid'],_0x554b92[_0xc2db('0x15b')]));return{'code':0xc8,'result':_0xc2db('0x15e')};}else{logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x15f'),this[_0xc2db('0xb')]['callerid'],_0x554b92['findBy']));this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x15d'),this[_0xc2db('0xb')][_0xc2db('0x39')],_0x554b92[_0xc2db('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xc2db('0xe')][_0xc2db('0x16e')]=function(_0x239d2e){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x16f'),_0x239d2e[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x239d2e[_0xc2db('0x116')])){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x239d2e,_0xc2db('0x117'));}var _0x269ab5=this['getSound'][_0xc2db('0x6c')](this,_0x239d2e[_0xc2db('0x116')]);if(!_0x269ab5){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x239d2e,_0xc2db('0x118'));}var _0x46caf2=this['channel']['exec'](_0xc2db('0x170'),[_0x269ab5,_0x239d2e[_0xc2db('0xed')]]);if(_0x46caf2['result']===-0x1){return _0x46caf2;}return this['channel'][_0xc2db('0xa9')](util[_0xc2db('0x27')]('Executed\x20command\x20%s\x20%s',_0xc2db('0x170'),_0x269ab5));};AGIVertices[_0xc2db('0xe')]['queue']=function(_0xfe5d08){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x171'),_0xfe5d08[_0xc2db('0x36')]));if(!this['isConfigured'](_0xfe5d08['queue_id'])){return this[_0xc2db('0xb')]['error'](_0xfe5d08,_0xc2db('0x172'));}var _0x5de43e='';var _0x61772c=parseInt(_0xfe5d08[_0xc2db('0x173')],0xa);if(isNaN(_0x61772c)){_0x5de43e=_0xfe5d08[_0xc2db('0x173')];}else{_0x5de43e=this[_0xc2db('0x14')]['sync'](this,_0xfe5d08[_0xc2db('0x173')]);if(!_0x5de43e){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0xfe5d08,_0xc2db('0x174'));}}var _0x28c0d3='';if(this[_0xc2db('0xa4')](_0xfe5d08[_0xc2db('0x116')])){var _0x38b183=this[_0xc2db('0x1f')][_0xc2db('0x6c')](this,_0xfe5d08[_0xc2db('0x116')]);if(_0x38b183){_0x28c0d3=_0x38b183;}}this['createSquareDetailsReport']['sync'](this,_0xfe5d08,_0x5de43e);if(_0xfe5d08[_0xc2db('0xed')][_0xc2db('0x175')]('x')<0x0){_0xfe5d08[_0xc2db('0xed')]+='x';}if(_0xfe5d08[_0xc2db('0xed')]['indexOf']('X')<0x0){_0xfe5d08[_0xc2db('0xed')]+='X';}this[_0xc2db('0xb')][_0xc2db('0x9d')](_0xc2db('0x176'),_0x5de43e?_0x5de43e[_0xc2db('0x177')]():'');var _0x53932c=this['channel']['exec'](_0xc2db('0x178'),[_0x5de43e,_0xfe5d08[_0xc2db('0xed')],_0xfe5d08['url'],_0x28c0d3,_0xfe5d08['timeout'],_0xfe5d08['agi'],_0xfe5d08[_0xc2db('0x179')],_0xfe5d08[_0xc2db('0x17a')],'',_0xfe5d08[_0xc2db('0x17b')]]);if(_0x53932c[_0xc2db('0xb1')]===-0x1){return _0x53932c;}return this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0xc9'),'QUEUE',_0x5de43e));};AGIVertices[_0xc2db('0xe')]['record']=function(_0x24d585){logger['info'](util['format'](_0xc2db('0x17c'),_0x24d585['label']));var _0xa46d6b=_0x24d585[_0xc2db('0x17d')]||_0xc2db('0x133');var _0x3ae1e5=util['format'](_0xc2db('0x17e'),this['channel']['uniqueid'],rs['generate'](0x5));var _0x47a051=util[_0xc2db('0x27')](_0xc2db('0x17f'),FILES_PATH,_0x3ae1e5,_0xa46d6b);var _0x43f1d3=util['format'](_0xc2db('0x134'),FILES_PATH,_0x3ae1e5);this[_0xc2db('0x3a')][_0xc2db('0x6c')](this,_0x24d585,_0x3ae1e5,_0x47a051);this['channel'][_0xc2db('0x9d')](_0xc2db('0x180'),_0x3ae1e5);logger[_0xc2db('0x2d')](_0xc2db('0x181'),_0x43f1d3,_0xa46d6b,_0x24d585[_0xc2db('0x182')],_0x24d585[_0xc2db('0x63')]);return this['channel']['recordFile'](_0x43f1d3,_0xa46d6b,_0x24d585[_0xc2db('0x182')],_0x24d585['timeout'],undefined,!![]);};AGIVertices[_0xc2db('0xe')][_0xc2db('0x183')]=function(_0x514b6d){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x184'),_0x514b6d[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x514b6d[_0xc2db('0x6f')])){return this['channel'][_0xc2db('0xa9')]('no\x20url\x20configured');}var _0x3c5897=this[_0xc2db('0x61')][_0xc2db('0x6c')](this,_0x514b6d);logger['info'](util['format'](_0xc2db('0x185'),util[_0xc2db('0x186')](_0x3c5897,{'showHidden':![],'depth':null})));if(!this[_0xc2db('0xa4')](_0x514b6d[_0xc2db('0xdf')])){return this[_0xc2db('0xb')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x5d856b=this[_0xc2db('0xf')][_0xc2db('0x6c')](this,_0x514b6d[_0xc2db('0xdf')]);if(!_0x5d856b){return this['channel'][_0xc2db('0x29')](_0x514b6d,_0xc2db('0xe1'));}this[_0xc2db('0xb')][_0xc2db('0x9d')](util['format'](_0xc2db('0x187'),_0x5d856b),_0x3c5897[_0xc2db('0x73')]?_0x3c5897[_0xc2db('0x73')]:'200');this[_0xc2db('0xb')][_0xc2db('0x9d')](util[_0xc2db('0x27')](_0xc2db('0x188'),_0x5d856b),_0x3c5897[_0xc2db('0x74')]?_0x3c5897[_0xc2db('0x74')]:'OK');if(_0x3c5897[_0xc2db('0x67')]){try{this['saveRestApiResult'](_0x3c5897[_0xc2db('0x67')],_0x5d856b);}catch(_0x519bda){logger['error'](util[_0xc2db('0x27')](_0xc2db('0x189'),_0x5d856b));}}return this[_0xc2db('0xb')]['noop'](util[_0xc2db('0x27')](_0xc2db('0x18a'),_0x5d856b));};AGIVertices[_0xc2db('0xe')][_0xc2db('0x18b')]=function(_0x4d32fa){logger[_0xc2db('0x2d')](util['format'](_0xc2db('0x18c'),_0x4d32fa['label']));return this[_0xc2db('0xb')][_0xc2db('0x18d')](_0x4d32fa[_0xc2db('0x18e')][_0xc2db('0x58')](/\s+/g,''),_0x4d32fa['escape_digits']);};AGIVertices[_0xc2db('0xe')][_0xc2db('0x18f')]=function(_0x13ddb8){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x190'),_0x13ddb8[_0xc2db('0x36')]));return this[_0xc2db('0xb')][_0xc2db('0x191')](_0x13ddb8[_0xc2db('0x192')][_0xc2db('0x58')](/\s+/g,''),_0x13ddb8[_0xc2db('0x182')]);};AGIVertices[_0xc2db('0xe')][_0xc2db('0x193')]=function(_0x5ab343){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x5ab343['label']));return this[_0xc2db('0xb')][_0xc2db('0x194')](_0x5ab343[_0xc2db('0x5a')],_0x5ab343[_0xc2db('0x182')]);};AGIVertices['prototype'][_0xc2db('0x195')]=function(_0x2d7e6d){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x196'),_0x2d7e6d[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x2d7e6d[_0xc2db('0x197')])){return this[_0xc2db('0xb')]['noop'](_0xc2db('0x198'));}var _0x57354d=this['getMailAccount'][_0xc2db('0x6c')](this,_0x2d7e6d[_0xc2db('0x197')]);if(!_0x57354d||!_0x57354d[_0xc2db('0x199')]){return this['channel']['error'](_0x2d7e6d,_0xc2db('0x19a'));}var _0x24a67f={'from':util['format']('\x22%s\x22\x20<%s>',_0x57354d[_0xc2db('0x12')],_0x57354d[_0xc2db('0x19b')]||_0x57354d[_0xc2db('0x199')][_0xc2db('0x19c')]),'to':_0x2d7e6d['to']||'','cc':_0x2d7e6d['cc']||'','bcc':_0x2d7e6d[_0xc2db('0x19d')]||'','subject':_0x2d7e6d[_0xc2db('0x19e')],'html':_0x2d7e6d[_0xc2db('0x5a')],'text':_0x2d7e6d['text']};var _0x5b73e3={'tls':{'rejectUnauthorized':![]}};if(_0x57354d[_0xc2db('0x199')][_0xc2db('0x19f')]){_0x5b73e3[_0xc2db('0x19f')]=_0x57354d[_0xc2db('0x199')][_0xc2db('0x19f')];}else{_0x5b73e3[_0xc2db('0x1a0')]=_0x57354d[_0xc2db('0x199')][_0xc2db('0x1a0')];_0x5b73e3[_0xc2db('0x1a1')]=_0x57354d[_0xc2db('0x199')][_0xc2db('0x1a1')];_0x5b73e3['secure']=_0x57354d[_0xc2db('0x199')][_0xc2db('0x1a2')];}if(_0x57354d[_0xc2db('0x199')]['authentication']){_0x5b73e3[_0xc2db('0x1a3')]={'user':_0x57354d[_0xc2db('0x199')]['user'],'pass':_0x57354d[_0xc2db('0x199')][_0xc2db('0x1a4')]};}if(this[_0xc2db('0xa4')](_0x2d7e6d[_0xc2db('0x1a5')])){}logger[_0xc2db('0xe7')]('sendMail\x20message',JSON['stringify'](_0x24a67f));this[_0xc2db('0x34')][_0xc2db('0x6c')](this,_0x2d7e6d,_0x2d7e6d['account_id']);this['channel'][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x1a6'),_0x57354d[_0xc2db('0x12')]));this[_0xc2db('0x22')]['sync'](this,_0x5b73e3,_0x24a67f);return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0x1a7'));};AGIVertices[_0xc2db('0xe')][_0xc2db('0x1a8')]=function(_0x119e36){logger['info'](util[_0xc2db('0x27')](_0xc2db('0x1a9'),_0x119e36['label']));return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0x1aa'));};AGIVertices[_0xc2db('0xe')]['sendSMS']=function(_0x4248fd){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x1ab'),_0x4248fd['label']));if(!this['isConfigured'](_0x4248fd[_0xc2db('0x1ac')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0x1ad'));}var _0xd6e174=this['getSmsAccount'][_0xc2db('0x6c')](this,_0x4248fd[_0xc2db('0x1ac')]);if(!_0xd6e174){return this['channel'][_0xc2db('0x29')](_0x4248fd,_0xc2db('0x1ae'));}var _0xff71dd={'body':_0x4248fd[_0xc2db('0x1af')],'phone':_0x4248fd['to']||'','SmsAccountId':_0xd6e174['id']};logger[_0xc2db('0xe7')](_0xc2db('0x1b0'),JSON[_0xc2db('0x71')](_0xff71dd));this['createSquareDetailsReport']['sync'](this,_0x4248fd,_0x4248fd[_0xc2db('0x1ac')]);this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0xd6e174[_0xc2db('0x12')]));this[_0xc2db('0x33')][_0xc2db('0x6c')](this,_0xff71dd);return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0x1b1'));};AGIVertices[_0xc2db('0xe')][_0xc2db('0x1b2')]=function(_0x35cda5){logger['info'](util[_0xc2db('0x27')](_0xc2db('0x1b3'),_0x35cda5[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x35cda5['variable_id'])){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x35cda5,_0xc2db('0x1b4'));}var _0x20aba3=this[_0xc2db('0xf')][_0xc2db('0x6c')](this,_0x35cda5[_0xc2db('0xdf')]);if(!_0x20aba3){return this[_0xc2db('0xb')]['error'](_0x35cda5,_0xc2db('0xe1'));}return this['channel'][_0xc2db('0x9d')](_0x20aba3,_0x35cda5['variable_value']);};AGIVertices[_0xc2db('0xe')][_0xc2db('0x1b5')]=function(_0x31f88e){logger['info'](util[_0xc2db('0x27')]('Enter\x20in\x20START\x20(%s)\x20block',_0x31f88e['label']));this[_0xc2db('0xb')][_0xc2db('0xa9')]('START\x20CALLY\x20SQUARE');if(_0x31f88e['answer']==='yes'){this[_0xc2db('0xb')]['noop'](_0xc2db('0x1b6'));return this[_0xc2db('0xb')]['answer']();}return this[_0xc2db('0xb')][_0xc2db('0xa9')]('Skipped\x20Answer');};AGIVertices[_0xc2db('0xe')][_0xc2db('0x1b7')]=function(_0x33cf8b){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x1b8'),_0x33cf8b[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x33cf8b[_0xc2db('0x1b9')])){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x33cf8b,_0xc2db('0x1ba'));}var _0xc12258=this[_0xc2db('0x16')][_0xc2db('0x6c')](this,_0x33cf8b['project_id']);if(!this[_0xc2db('0xa4')](_0xc12258)){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x33cf8b,util['format'](_0xc2db('0x1bb'),_0x33cf8b[_0xc2db('0x1b9')]));}if(_0xc12258===this['channel']['arg_1']){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x33cf8b,_0xc2db('0x1bc'));}this[_0xc2db('0x34')]['sync'](this,_0x33cf8b,_0xc12258);var _0x340055=this['channel'][_0xc2db('0x56')](_0xc2db('0x1bd'),util[_0xc2db('0x27')](_0xc2db('0x1be'),config[_0xc2db('0xb9')][_0xc2db('0x1a0')]||_0xc2db('0x1bf'),_0xc12258,this[_0xc2db('0xb')][_0xc2db('0x38')]));if(_0x340055['result']===-0x1){return _0x340055;}return this[_0xc2db('0xb')][_0xc2db('0xa9')](util['format']('Executed\x20command\x20%s\x20%s','AGI',_0xc12258));};AGIVertices[_0xc2db('0xe')][_0xc2db('0x1c0')]=function(_0x1a22de){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x1c1'),_0x1a22de['label']));var _0x2dcea3=this['shellCommand']['sync'](this,_0x1a22de['command']);this[_0xc2db('0x34')][_0xc2db('0x6c')](this,_0x1a22de,_0x1a22de[_0xc2db('0xbb')]);if(this[_0xc2db('0xa4')](_0x1a22de[_0xc2db('0xdf')])){var _0x29ea4b=this[_0xc2db('0xf')][_0xc2db('0x6c')](this,_0x1a22de[_0xc2db('0xdf')]);if(_0x29ea4b){this[_0xc2db('0xb')]['setVariable'](_0x29ea4b,_0x2dcea3);return this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x1c2'),_0x1a22de[_0xc2db('0xbb')],_0x29ea4b));}}return this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x1c3'),_0x1a22de['command']));};AGIVertices[_0xc2db('0xe')]['google_cloud_tts']=function(_0x1b4688){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1b4688[_0xc2db('0x36')]));_0x1b4688[_0xc2db('0x5a')]=_0x1b4688['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc2db('0xa4')](_0x1b4688[_0xc2db('0x1c4')])){return this['channel'][_0xc2db('0xa9')](_0xc2db('0x1c5'));}if(!this[_0xc2db('0xa4')](_0x1b4688[_0xc2db('0x5a')])){return this[_0xc2db('0xb')]['noop'](_0xc2db('0xcb'));}this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x1c6'),_0x1b4688[_0xc2db('0x5a')]));var _0x5816ad=this[_0xc2db('0x59')][_0xc2db('0x6c')](this,_0x1b4688);if(_0x5816ad){this['channel'][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x1c7'),_0x5816ad));var _0x64e027=this[_0xc2db('0xb')][_0xc2db('0x10b')](_0x5816ad);try{fs[_0xc2db('0x10c')](_0x5816ad+_0xc2db('0x10d'));}catch(_0x5856ff){logger['error'](_0x5856ff);}return _0x64e027;}return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x1b4688,_0xc2db('0x1c8'));};AGIVertices['prototype'][_0xc2db('0x1c9')]=function(_0x406479){logger[_0xc2db('0x2d')](util['format'](_0xc2db('0x1ca'),_0x406479[_0xc2db('0x36')]));_0x406479[_0xc2db('0x5a')]=_0x406479[_0xc2db('0x5a')][_0xc2db('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc2db('0xa4')](_0x406479[_0xc2db('0x5a')])){return this[_0xc2db('0xb')][_0xc2db('0xa9')](_0xc2db('0xcb'));}this['channel'][_0xc2db('0xa9')](util['format'](_0xc2db('0x1cb'),_0x406479[_0xc2db('0x5a')]));var _0x42d17b=this[_0xc2db('0x5f')]['sync'](this,_0x406479);if(_0x42d17b){this[_0xc2db('0xb')][_0xc2db('0xa9')](util['format'](_0xc2db('0x1cc'),_0x42d17b));var _0x1e9037=this['channel'][_0xc2db('0x10b')](_0x42d17b);try{fs[_0xc2db('0x10c')](_0x42d17b+'.wav');}catch(_0x203b86){logger[_0xc2db('0x29')](_0x203b86);}return _0x1e9037;}return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x406479,_0xc2db('0x1cd'));};AGIVertices[_0xc2db('0xe')]['unpause']=function(_0x537e1d){logger['info'](util[_0xc2db('0x27')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x537e1d['label']));if(!this[_0xc2db('0xa4')](_0x537e1d['findBy'])){return this[_0xc2db('0xb')][_0xc2db('0x29')](_0x537e1d,'no\x20find\x20by\x20configured');}logger[_0xc2db('0x2d')](util['format'](_0xc2db('0x161'),this['channel'][_0xc2db('0x39')],_0x537e1d['findBy']));var _0x17248a=this[_0xc2db('0x1ce')][_0xc2db('0x6c')](this,_0x537e1d[_0xc2db('0x15b')]);if(_0x17248a){logger[_0xc2db('0x2d')](util['format'](_0xc2db('0x15d'),this[_0xc2db('0xb')]['callerid'],_0x537e1d[_0xc2db('0x15b')]));this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x15d'),this[_0xc2db('0xb')][_0xc2db('0x39')],_0x537e1d['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xc2db('0x2d')](util['format'](_0xc2db('0x15f'),this[_0xc2db('0xb')][_0xc2db('0x39')],_0x537e1d[_0xc2db('0x15b')]));this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0x15f'),this['channel']['callerid'],_0x537e1d['findBy']));return{'code':0xc8,'result':_0xc2db('0x162')};}};AGIVertices['prototype'][_0xc2db('0x1cf')]=function(_0x46c086){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x1d0'),_0x46c086[_0xc2db('0x36')]));var _0x399018=this[_0xc2db('0xb')][_0xc2db('0x56')](_0xc2db('0x1d1'),[_0x46c086[_0xc2db('0x1d2')],_0x46c086[_0xc2db('0xaa')]]);if(_0x399018[_0xc2db('0xb1')]===-0x1){return _0x399018;}return this[_0xc2db('0xb')][_0xc2db('0xa9')](util[_0xc2db('0x27')](_0xc2db('0xc9'),_0xc2db('0x1d1'),_0x46c086[_0xc2db('0x1d2')]));};AGIVertices[_0xc2db('0xe')][_0xc2db('0x1d3')]=function(_0x7cd78d){logger[_0xc2db('0x2d')](util[_0xc2db('0x27')](_0xc2db('0x1d4'),_0x7cd78d[_0xc2db('0x36')]));if(!this[_0xc2db('0xa4')](_0x7cd78d[_0xc2db('0xdf')])){return this['channel'][_0xc2db('0x29')](_0x7cd78d,_0xc2db('0x1b4'));}var _0x539e7e=this[_0xc2db('0xf')][_0xc2db('0x6c')](this,_0x7cd78d[_0xc2db('0xdf')]);if(!_0x539e7e){return this[_0xc2db('0xb')]['error'](_0x7cd78d,_0xc2db('0xe1'));}var _0x265a28=this[_0xc2db('0xb')]['getVariable'](_0x539e7e);return{'code':0xc8,'result':_0x265a28['extra']?_0x265a28['extra']:'-'};};String[_0xc2db('0xe')][_0xc2db('0xa0')]=function(_0x8d6dab,_0x15a8f0){return this[_0xc2db('0x9f')](_0x8d6dab)[_0xc2db('0x1d5')](_0x15a8f0);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 6583a80..1a51818 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 _0x0e85=['[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','queue','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[ACW][START]\x20%s','prototype','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','acw','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','linkedid','isUndefined','attended','[%s][HANGUP:LINKEDID]','startAcw','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','milliseconds','diff','seconds','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','QueuePause','then','voicePause','info','destlinkedid','savePause'];(function(_0x57700c,_0x2ce00d){var _0x4af434=function(_0x4ebeab){while(--_0x4ebeab){_0x57700c['push'](_0x57700c['shift']());}};_0x4af434(++_0x2ce00d);}(_0x0e85,0x7c));var _0x50e8=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x0e85[_0x476bf4];return _0x788ffe;};'use strict';var util=require(_0x50e8('0x0'));var _=require(_0x50e8('0x1'));var moment=require('moment');var ami=require(_0x50e8('0x2'));var logger=require(_0x50e8('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x236cf3){this['voiceQueues']=_0x236cf3[_0x50e8('0x4')];this[_0x50e8('0x5')]=_0x236cf3[_0x50e8('0x5')];this[_0x50e8('0x6')]=_0x236cf3['timers'];this[_0x50e8('0x7')]={};ami['on'](_0x50e8('0x8'),this[_0x50e8('0x9')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0xb'),this[_0x50e8('0xc')]['bind'](this));ami['on'](_0x50e8('0xd'),this[_0x50e8('0xe')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0xf'),this[_0x50e8('0x10')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0x11'),this[_0x50e8('0x12')]['bind'](this));ami['on']('blindtransfer',this[_0x50e8('0x13')][_0x50e8('0xa')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x50e8('0xa')](this));}function getDiff(_0x2abda1){var _0x1a4c85=moment()[_0x50e8('0x14')](0x0);var _0x54efd3=moment(_0x2abda1)[_0x50e8('0x14')](0x0);return _0x1a4c85[_0x50e8('0x15')](_0x54efd3,_0x50e8('0x16'));}Acw['prototype']['startAcw']=function(_0x30a872){try{var _0xf02b48=this;var _0x40c184=this[_0x50e8('0x7')][_0x30a872][_0x50e8('0x17')];var _0x1f0338=this['channels'][_0x30a872]['queue'];var _0x441f25=this[_0x50e8('0x4')][_0x1f0338];var _0x40d060=![];var _0x45ce11=_0x50e8('0x18');if(_0x441f25[_0x50e8('0x19')]){if(_0x441f25[_0x50e8('0x1a')]['name']){_0x40d060=!![];_0x45ce11=_0x441f25[_0x50e8('0x1a')]['name'];}}ami[_0x50e8('0x1b')]({'action':_0x50e8('0x1c'),'interface':_0x40c184,'paused':!![],'reason':_0x45ce11})[_0x50e8('0x1d')](function(_0x20f835){if(_0xf02b48[_0x50e8('0x5')][_0x40c184]){return RpcUser['getAgent'](_0xf02b48[_0x50e8('0x5')][_0x40c184]['id'])[_0x50e8('0x1d')](function(_0x58110d){if(_0x58110d&&!_0x58110d[_0x50e8('0x1e')]){logger[_0x50e8('0x1f')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x30a872,_0x40c184,_0x1f0338);var _0x1ce7fc=_0xf02b48[_0x50e8('0x7')][_0x30a872]['attended']&&_0xf02b48['channels'][_0x30a872]['destlinkedid']?_0xf02b48[_0x50e8('0x7')][_0x30a872][_0x50e8('0x20')]:_0x30a872;return RpcUser[_0x50e8('0x21')](_0xf02b48[_0x50e8('0x5')][_0x40c184],_0x45ce11,_0x1ce7fc)[_0x50e8('0x1d')](function(_0x13b6e9){if(!_0x40d060){_0xf02b48['timers'][_0x40c184]={};logger[_0x50e8('0x1f')](_0x50e8('0x22'),_0x30a872,_0xf02b48['voiceQueues'][_0x1f0338][_0x50e8('0x23')],_0x40c184,_0x1f0338);_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x24')]=setTimeout(_0xf02b48[_0x50e8('0x25')]['bind'](_0xf02b48,_0x40c184),_0xf02b48[_0x50e8('0x4')][_0x1f0338]['acwTimeout']*0x3e8);_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x26')]=moment()[_0x50e8('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x28')]=_0x30a872;_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x29')]=_0x1f0338;_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x2a')]=function(){var _0x2c6fb3=getDiff(_0xf02b48['timers'][_0x40c184][_0x50e8('0x26')]);clearTimeout(_0xf02b48[_0x50e8('0x6')][_0x40c184]['timer']);_0xf02b48['timers'][_0x40c184][_0x50e8('0x24')]=![];RpcVoiceAgentReport[_0x50e8('0x2b')]({'acwtime':_0x2c6fb3},_0xf02b48[_0x50e8('0x6')][_0x40c184]['uniqueid'],_0x40c184)['then'](function(_0x3e58a9){logger[_0x50e8('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x30a872,_0x2c6fb3,_0x3e58a9);})[_0x50e8('0x2c')](function(_0x17c6a5){logger[_0x50e8('0x2d')](_0x50e8('0x2e'),_0x30a872,_0x17c6a5);});delete _0xf02b48['timers'][_0x40c184];};}});}else{logger[_0x50e8('0x1f')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x30a872,_0x40c184,_0x1f0338);}});}})[_0x50e8('0x2c')](function(_0x33fc5b){logger[_0x50e8('0x2d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x30a872,_0xf02b48[_0x50e8('0x4')][_0x1f0338][_0x50e8('0x23')],_0x40c184,_0x1f0338);})['finally'](function(){delete _0xf02b48[_0x50e8('0x7')][_0x30a872];});}catch(_0x1c2fdb){logger[_0x50e8('0x2d')](_0x50e8('0x2f'),_0x1c2fdb['message']);}};Acw[_0x50e8('0x30')][_0x50e8('0x25')]=function(_0x24d3ea){try{var _0x4e2a37=this;if(_0x4e2a37['timers'][_0x24d3ea]){_0x4e2a37[_0x50e8('0x6')][_0x24d3ea][_0x50e8('0x24')]=![];var _0x3f01ee=_0x4e2a37['timers'][_0x24d3ea]['uniqueid'];var _0x5dff99=_0x4e2a37[_0x50e8('0x6')][_0x24d3ea][_0x50e8('0x29')];var _0x2cbee3=_0x4e2a37[_0x50e8('0x4')][_0x5dff99][_0x50e8('0x23')];logger[_0x50e8('0x1f')](_0x50e8('0x31'),_0x24d3ea);RpcUser[_0x50e8('0x32')](this[_0x50e8('0x5')][_0x24d3ea]);RpcVoiceAgentReport[_0x50e8('0x2b')]({'acwtime':_0x2cbee3,'agentacw':!![]},_0x3f01ee,_0x24d3ea)['then'](function(_0x3371a4){logger[_0x50e8('0x1f')](_0x50e8('0x33'),_0x3f01ee,_0x2cbee3,_0x3371a4);})[_0x50e8('0x2c')](function(_0x5dbbe1){logger[_0x50e8('0x2d')](_0x50e8('0x2e'),_0x3f01ee,_0x5dbbe1);});}else{logger[_0x50e8('0x2d')](_0x50e8('0x34'),_0x24d3ea);if(_0x4e2a37[_0x50e8('0x6')]){logger['info']('[ACW][TIMERS]',JSON[_0x50e8('0x35')](_0x4e2a37[_0x50e8('0x6')]));}}}catch(_0x53705e){logger[_0x50e8('0x2d')](_0x50e8('0x36'),_0x53705e[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0x9')]=function(_0x313e7b){try{if(this[_0x50e8('0x4')][_0x313e7b[_0x50e8('0x29')]]&&(this['voiceQueues'][_0x313e7b[_0x50e8('0x29')]][_0x50e8('0x38')]||this[_0x50e8('0x4')][_0x313e7b[_0x50e8('0x29')]]['mandatoryDisposition'])){if(this[_0x50e8('0x5')][_0x313e7b[_0x50e8('0x17')]]){this[_0x50e8('0x7')][_0x313e7b[_0x50e8('0x28')]]={'queue':_0x313e7b['queue'],'interface':_0x313e7b[_0x50e8('0x17')],'destlinkedid':_0x313e7b['destlinkedid']};}}}catch(_0x4a2619){logger['error'](_0x50e8('0x39'),_0x4a2619[_0x50e8('0x37')]);}};Acw['prototype'][_0x50e8('0x3a')]=function(_0x2007c4){try{if(this[_0x50e8('0x4')][_0x2007c4[_0x50e8('0x29')]]&&(this[_0x50e8('0x4')][_0x2007c4[_0x50e8('0x29')]]['acw']||this[_0x50e8('0x4')][_0x2007c4['queue']][_0x50e8('0x19')])){if(this[_0x50e8('0x5')][_0x2007c4['interface']]){this[_0x50e8('0x7')][_0x2007c4['uniqueid']]={'queue':_0x2007c4[_0x50e8('0x29')],'interface':_0x2007c4[_0x50e8('0x17')]};}}}catch(_0x2e55ed){logger[_0x50e8('0x2d')](_0x50e8('0x3b'),_0x2e55ed[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0xc')]=function(_0x141bd4){try{if(this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x28')]]&&_['isUndefined'](this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x28')]]['attended'])){logger[_0x50e8('0x1f')]('[%s][HANGUP:UNIQUEID]',_0x141bd4[_0x50e8('0x28')]);this['startAcw'](_0x141bd4[_0x50e8('0x28')]);}else if(this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x3c')]]&&_[_0x50e8('0x3d')](this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x3c')]][_0x50e8('0x3e')])){logger['info'](_0x50e8('0x3f'),_0x141bd4[_0x50e8('0x3c')]);this[_0x50e8('0x40')](_0x141bd4[_0x50e8('0x3c')]);}}catch(_0x3303f5){logger[_0x50e8('0x2d')]('[ACW][syncHangupRequest]\x20%s',_0x3303f5[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0xe')]=function(_0x27c80a){try{if(this['channels'][_0x27c80a[_0x50e8('0x28')]]&&this[_0x50e8('0x7')][_0x27c80a[_0x50e8('0x28')]][_0x50e8('0x3e')]){logger[_0x50e8('0x1f')](_0x50e8('0x41'),_0x27c80a[_0x50e8('0x28')]);this['startAcw'](_0x27c80a['uniqueid']);}else if(this['channels'][_0x27c80a[_0x50e8('0x3c')]]&&this[_0x50e8('0x7')][_0x27c80a[_0x50e8('0x3c')]][_0x50e8('0x3e')]){logger[_0x50e8('0x1f')](_0x50e8('0x42'),_0x27c80a['linkedid']);this[_0x50e8('0x40')](_0x27c80a[_0x50e8('0x3c')]);}}catch(_0x460c8e){logger[_0x50e8('0x2d')]('[ACW][syncHangup]\x20%s',_0x460c8e[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0x12')]=function(_0x1cc5ba){try{if(!_[_0x50e8('0x43')](this[_0x50e8('0x7')][_0x1cc5ba['transfereeuniqueid']])){this[_0x50e8('0x40')](_0x1cc5ba['transfereeuniqueid']);if(this['channels'][_0x1cc5ba['secondtransfereruniqueid']]){this[_0x50e8('0x7')][_0x1cc5ba['secondtransfereruniqueid']][_0x50e8('0x3e')]=!![];this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x44')]]=this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x45')]];delete this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x45')]];}}else if(!_['isNil'](this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x44')]])){this[_0x50e8('0x40')](_0x1cc5ba['transfertargetuniqueid']);if(this['channels'][_0x1cc5ba['origtransfereruniqueid']]){this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x46')]][_0x50e8('0x3e')]=!![];this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x47')]]=this[_0x50e8('0x7')][_0x1cc5ba['origtransfereruniqueid']];delete this[_0x50e8('0x7')][_0x1cc5ba['origtransfereruniqueid']];}}}catch(_0x255b48){logger[_0x50e8('0x2d')]('[ACW][syncAttendedTransfer]\x20%s',_0x255b48['message']);}};Acw['prototype'][_0x50e8('0x13')]=function(_0x3588f0){try{if(this['channels'][_0x3588f0[_0x50e8('0x48')]]){logger[_0x50e8('0x1f')](_0x50e8('0x49'),JSON[_0x50e8('0x35')](_0x3588f0[_0x50e8('0x48')]));this['startAcw'](_0x3588f0[_0x50e8('0x48')]);}else if(this[_0x50e8('0x7')][_0x3588f0[_0x50e8('0x4a')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x50e8('0x35')](_0x3588f0[_0x50e8('0x4a')]));this[_0x50e8('0x40')](_0x3588f0[_0x50e8('0x4a')]);}}catch(_0x2b59f5){logger[_0x50e8('0x2d')]('[ACW][syncBlindTransfer]\x20%s',_0x2b59f5['message']);}};Acw[_0x50e8('0x30')]['syncAgentRingNoAnswer']=function(_0x1fc530){try{if(this[_0x50e8('0x4')][_0x1fc530['queue']]&&this[_0x50e8('0x4')][_0x1fc530['queue']]['autopause']==='all'){if(this[_0x50e8('0x5')][_0x1fc530[_0x50e8('0x17')]]){logger[_0x50e8('0x1f')](_0x50e8('0x4b'),_0x1fc530['uniqueid'],_0x1fc530['interface'],_0x1fc530[_0x50e8('0x29')]);return RpcUser[_0x50e8('0x21')](this[_0x50e8('0x5')][_0x1fc530[_0x50e8('0x17')]],_0x50e8('0x4c'),_0x1fc530[_0x50e8('0x28')]);}}}catch(_0x42e1dd){logger[_0x50e8('0x2d')](_0x50e8('0x4d'),_0x42e1dd[_0x50e8('0x37')]);}};module[_0x50e8('0x4e')]=Acw; \ No newline at end of file +var _0x17ba=['exports','util','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','diff','seconds','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','attended','destlinkedid','savePause','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','prototype','[TIMER][STOP][AGENT:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','autopause','all','[ACW][syncAgentRingNoAnswer]\x20%s'];(function(_0x4b7a56,_0x7813b9){var _0x3fa0f3=function(_0x6a6c6b){while(--_0x6a6c6b){_0x4b7a56['push'](_0x4b7a56['shift']());}};_0x3fa0f3(++_0x7813b9);}(_0x17ba,0xab));var _0xa17b=function(_0x4c5196,_0x1334db){_0x4c5196=_0x4c5196-0x0;var _0x592e7a=_0x17ba[_0x4c5196];return _0x592e7a;};'use strict';var util=require(_0xa17b('0x0'));var _=require(_0xa17b('0x1'));var moment=require('moment');var ami=require(_0xa17b('0x2'));var logger=require(_0xa17b('0x3'))(_0xa17b('0x4'));var RpcUser=require(_0xa17b('0x5'));var RpcVoiceAgentReport=require(_0xa17b('0x6'));function Acw(_0x38c13c){this[_0xa17b('0x7')]=_0x38c13c[_0xa17b('0x7')];this[_0xa17b('0x8')]=_0x38c13c[_0xa17b('0x8')];this[_0xa17b('0x9')]=_0x38c13c[_0xa17b('0x9')];this[_0xa17b('0xa')]={};ami['on'](_0xa17b('0xb'),this[_0xa17b('0xc')][_0xa17b('0xd')](this));ami['on'](_0xa17b('0xe'),this[_0xa17b('0xf')][_0xa17b('0xd')](this));ami['on']('hangup',this[_0xa17b('0x10')][_0xa17b('0xd')](this));ami['on'](_0xa17b('0x11'),this[_0xa17b('0x12')][_0xa17b('0xd')](this));ami['on'](_0xa17b('0x13'),this[_0xa17b('0x14')]['bind'](this));ami['on'](_0xa17b('0x15'),this[_0xa17b('0x16')][_0xa17b('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0xa17b('0x17')][_0xa17b('0xd')](this));}function getDiff(_0x30236c){var _0xeeacaa=moment()['milliseconds'](0x0);var _0x117ad9=moment(_0x30236c)['milliseconds'](0x0);return _0xeeacaa[_0xa17b('0x18')](_0x117ad9,_0xa17b('0x19'));}Acw['prototype'][_0xa17b('0x1a')]=function(_0x3c63e3){try{var _0x1c0578=this;var _0x1f8141=this['channels'][_0x3c63e3][_0xa17b('0x1b')];var _0x5e21c2=this['channels'][_0x3c63e3]['queue'];var _0x36f985=this[_0xa17b('0x7')][_0x5e21c2];var _0x53a0f7=![];var _0x2ceafa=_0xa17b('0x1c');if(_0x36f985[_0xa17b('0x1d')]){if(_0x36f985[_0xa17b('0x1e')][_0xa17b('0x1f')]){_0x53a0f7=!![];_0x2ceafa=_0x36f985[_0xa17b('0x1e')][_0xa17b('0x1f')];}}ami['Action']({'action':_0xa17b('0x20'),'interface':_0x1f8141,'paused':!![],'reason':_0x2ceafa})[_0xa17b('0x21')](function(_0x45bd0c){if(_0x1c0578['agents'][_0x1f8141]){return RpcUser[_0xa17b('0x22')](_0x1c0578[_0xa17b('0x8')][_0x1f8141]['id'])[_0xa17b('0x21')](function(_0xbbbb62){if(_0xbbbb62&&!_0xbbbb62[_0xa17b('0x23')]){logger[_0xa17b('0x24')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x3c63e3,_0x1f8141,_0x5e21c2);var _0x3df11f=_0x1c0578['channels'][_0x3c63e3][_0xa17b('0x25')]&&_0x1c0578[_0xa17b('0xa')][_0x3c63e3]['destlinkedid']?_0x1c0578['channels'][_0x3c63e3][_0xa17b('0x26')]:_0x3c63e3;return RpcUser[_0xa17b('0x27')](_0x1c0578[_0xa17b('0x8')][_0x1f8141],_0x2ceafa,_0x3df11f)[_0xa17b('0x21')](function(_0x3c32a5){if(!_0x53a0f7){_0x1c0578[_0xa17b('0x9')][_0x1f8141]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3c63e3,_0x1c0578['voiceQueues'][_0x5e21c2]['acwTimeout'],_0x1f8141,_0x5e21c2);_0x1c0578[_0xa17b('0x9')][_0x1f8141]['timer']=setTimeout(_0x1c0578[_0xa17b('0x28')]['bind'](_0x1c0578,_0x1f8141),_0x1c0578[_0xa17b('0x7')][_0x5e21c2][_0xa17b('0x29')]*0x3e8);_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2a')]=moment()[_0xa17b('0x2b')](_0xa17b('0x2c'));_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2d')]=_0x3c63e3;_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2e')]=_0x5e21c2;_0x1c0578[_0xa17b('0x9')][_0x1f8141]['updateAcw']=function(){var _0x57a2c4=getDiff(_0x1c0578['timers'][_0x1f8141][_0xa17b('0x2a')]);clearTimeout(_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2f')]);_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2f')]=![];RpcVoiceAgentReport[_0xa17b('0x30')]({'acwtime':_0x57a2c4},_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2d')],_0x1f8141)['then'](function(_0x1e33bf){logger['info'](_0xa17b('0x31'),_0x3c63e3,_0x57a2c4,_0x1e33bf);})[_0xa17b('0x32')](function(_0x198ceb){logger[_0xa17b('0x33')](_0xa17b('0x34'),_0x3c63e3,_0x198ceb);});delete _0x1c0578[_0xa17b('0x9')][_0x1f8141];};}});}else{logger['info'](_0xa17b('0x35'),_0x3c63e3,_0x1f8141,_0x5e21c2);}});}})[_0xa17b('0x32')](function(_0x323e0e){logger[_0xa17b('0x33')](_0xa17b('0x36'),_0x3c63e3,_0x1c0578['voiceQueues'][_0x5e21c2][_0xa17b('0x29')],_0x1f8141,_0x5e21c2);})['finally'](function(){delete _0x1c0578[_0xa17b('0xa')][_0x3c63e3];});}catch(_0x5a0b00){logger[_0xa17b('0x33')](_0xa17b('0x37'),_0x5a0b00['message']);}};Acw[_0xa17b('0x38')][_0xa17b('0x28')]=function(_0x487e9a){try{var _0x2fb380=this;if(_0x2fb380[_0xa17b('0x9')][_0x487e9a]){_0x2fb380[_0xa17b('0x9')][_0x487e9a][_0xa17b('0x2f')]=![];var _0xd71efd=_0x2fb380['timers'][_0x487e9a][_0xa17b('0x2d')];var _0x506488=_0x2fb380[_0xa17b('0x9')][_0x487e9a]['queue'];var _0x118ad9=_0x2fb380['voiceQueues'][_0x506488][_0xa17b('0x29')];logger['info'](_0xa17b('0x39'),_0x487e9a);RpcUser['saveUnpause'](this[_0xa17b('0x8')][_0x487e9a]);RpcVoiceAgentReport[_0xa17b('0x30')]({'acwtime':_0x118ad9,'agentacw':!![]},_0xd71efd,_0x487e9a)[_0xa17b('0x21')](function(_0x318b1c){logger[_0xa17b('0x24')](_0xa17b('0x31'),_0xd71efd,_0x118ad9,_0x318b1c);})[_0xa17b('0x32')](function(_0xe57f94){logger['error'](_0xa17b('0x34'),_0xd71efd,_0xe57f94);});}else{logger[_0xa17b('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x487e9a);if(_0x2fb380[_0xa17b('0x9')]){logger[_0xa17b('0x24')](_0xa17b('0x3a'),JSON[_0xa17b('0x3b')](_0x2fb380[_0xa17b('0x9')]));}}}catch(_0x2fe669){logger['error'](_0xa17b('0x3c'),_0x2fe669[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')]['syncAgentConnect']=function(_0x54b65c){try{if(this['voiceQueues'][_0x54b65c[_0xa17b('0x2e')]]&&(this[_0xa17b('0x7')][_0x54b65c[_0xa17b('0x2e')]][_0xa17b('0x4')]||this[_0xa17b('0x7')][_0x54b65c[_0xa17b('0x2e')]][_0xa17b('0x1d')])){if(this[_0xa17b('0x8')][_0x54b65c[_0xa17b('0x1b')]]){this[_0xa17b('0xa')][_0x54b65c[_0xa17b('0x2d')]]={'queue':_0x54b65c[_0xa17b('0x2e')],'interface':_0x54b65c['interface'],'destlinkedid':_0x54b65c[_0xa17b('0x26')]};}}}catch(_0x16db4a){logger[_0xa17b('0x33')](_0xa17b('0x3e'),_0x16db4a[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')]['syncAgentConnectPreview']=function(_0x43d6d6){try{if(this[_0xa17b('0x7')][_0x43d6d6[_0xa17b('0x2e')]]&&(this[_0xa17b('0x7')][_0x43d6d6[_0xa17b('0x2e')]]['acw']||this[_0xa17b('0x7')][_0x43d6d6[_0xa17b('0x2e')]][_0xa17b('0x1d')])){if(this[_0xa17b('0x8')][_0x43d6d6['interface']]){this[_0xa17b('0xa')][_0x43d6d6[_0xa17b('0x2d')]]={'queue':_0x43d6d6[_0xa17b('0x2e')],'interface':_0x43d6d6[_0xa17b('0x1b')]};}}}catch(_0x11b256){logger[_0xa17b('0x33')](_0xa17b('0x3f'),_0x11b256['message']);}};Acw[_0xa17b('0x38')][_0xa17b('0xf')]=function(_0x4ffe5a){try{if(this[_0xa17b('0xa')][_0x4ffe5a[_0xa17b('0x2d')]]&&_[_0xa17b('0x40')](this['channels'][_0x4ffe5a[_0xa17b('0x2d')]][_0xa17b('0x25')])){logger['info'](_0xa17b('0x41'),_0x4ffe5a[_0xa17b('0x2d')]);this['startAcw'](_0x4ffe5a[_0xa17b('0x2d')]);}else if(this[_0xa17b('0xa')][_0x4ffe5a['linkedid']]&&_[_0xa17b('0x40')](this[_0xa17b('0xa')][_0x4ffe5a[_0xa17b('0x42')]][_0xa17b('0x25')])){logger[_0xa17b('0x24')](_0xa17b('0x43'),_0x4ffe5a[_0xa17b('0x42')]);this['startAcw'](_0x4ffe5a[_0xa17b('0x42')]);}}catch(_0x3ff07a){logger[_0xa17b('0x33')](_0xa17b('0x44'),_0x3ff07a[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')][_0xa17b('0x10')]=function(_0x100d14){try{if(this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x2d')]]&&this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x2d')]][_0xa17b('0x25')]){logger['info'](_0xa17b('0x45'),_0x100d14[_0xa17b('0x2d')]);this[_0xa17b('0x1a')](_0x100d14[_0xa17b('0x2d')]);}else if(this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x42')]]&&this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x42')]][_0xa17b('0x25')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x100d14[_0xa17b('0x42')]);this[_0xa17b('0x1a')](_0x100d14['linkedid']);}}catch(_0x568f27){logger['error'](_0xa17b('0x46'),_0x568f27[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')][_0xa17b('0x14')]=function(_0x301019){try{if(!_[_0xa17b('0x47')](this['channels'][_0x301019['transfereeuniqueid']])){this['startAcw'](_0x301019['transfereeuniqueid']);if(this['channels'][_0x301019[_0xa17b('0x48')]]){this[_0xa17b('0xa')][_0x301019[_0xa17b('0x48')]][_0xa17b('0x25')]=!![];this[_0xa17b('0xa')][_0x301019[_0xa17b('0x49')]]=this[_0xa17b('0xa')][_0x301019['secondtransfereruniqueid']];delete this[_0xa17b('0xa')][_0x301019[_0xa17b('0x48')]];}}else if(!_[_0xa17b('0x47')](this[_0xa17b('0xa')][_0x301019[_0xa17b('0x49')]])){this[_0xa17b('0x1a')](_0x301019[_0xa17b('0x49')]);if(this[_0xa17b('0xa')][_0x301019[_0xa17b('0x4a')]]){this[_0xa17b('0xa')][_0x301019[_0xa17b('0x4a')]][_0xa17b('0x25')]=!![];this['channels'][_0x301019[_0xa17b('0x4b')]]=this['channels'][_0x301019[_0xa17b('0x4a')]];delete this[_0xa17b('0xa')][_0x301019[_0xa17b('0x4a')]];}}}catch(_0x2ac414){logger['error'](_0xa17b('0x4c'),_0x2ac414['message']);}};Acw[_0xa17b('0x38')]['syncBlindTransfer']=function(_0x5be3d1){try{if(this[_0xa17b('0xa')][_0x5be3d1[_0xa17b('0x4d')]]){logger['info'](_0xa17b('0x4e'),JSON[_0xa17b('0x3b')](_0x5be3d1['transfereruniqueid']));this['startAcw'](_0x5be3d1[_0xa17b('0x4d')]);}else if(this[_0xa17b('0xa')][_0x5be3d1['transfererlinkedid']]){logger[_0xa17b('0x24')](_0xa17b('0x4f'),JSON['stringify'](_0x5be3d1[_0xa17b('0x50')]));this[_0xa17b('0x1a')](_0x5be3d1[_0xa17b('0x50')]);}}catch(_0x7b5a5d){logger[_0xa17b('0x33')]('[ACW][syncBlindTransfer]\x20%s',_0x7b5a5d[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')][_0xa17b('0x12')]=function(_0x29cdfc){try{if(this[_0xa17b('0x7')][_0x29cdfc[_0xa17b('0x2e')]]&&this[_0xa17b('0x7')][_0x29cdfc[_0xa17b('0x2e')]][_0xa17b('0x51')]===_0xa17b('0x52')){if(this['agents'][_0x29cdfc[_0xa17b('0x1b')]]){logger[_0xa17b('0x24')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x29cdfc['uniqueid'],_0x29cdfc[_0xa17b('0x1b')],_0x29cdfc[_0xa17b('0x2e')]);return RpcUser[_0xa17b('0x27')](this[_0xa17b('0x8')][_0x29cdfc[_0xa17b('0x1b')]],'Auto-Pause',_0x29cdfc[_0xa17b('0x2d')]);}}}catch(_0x469ecd){logger[_0xa17b('0x33')](_0xa17b('0x53'),_0x469ecd['message']);}};module[_0xa17b('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 028a8c5..ef4dec6 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 _0x65b3=['Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','exports','asterisk-manager','bluebird','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','password','keepConnected'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x65b3,0x18f));var _0x365b=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0x65b3[_0x3f94f9];return _0x46f84f;};'use strict';var Manager=require(_0x365b('0x0'));var BPromise=require(_0x365b('0x1'));var moment=require('moment');var util=require(_0x365b('0x2'));var _=require(_0x365b('0x3'));var logger=require(_0x365b('0x4'))(_0x365b('0x5'));var config=require(_0x365b('0x6'));var ami=new Manager(config[_0x365b('0x7')][_0x365b('0x8')],config[_0x365b('0x7')]['ip'],config[_0x365b('0x7')]['username'],config['asterisk'][_0x365b('0x9')],!![]);ami[_0x365b('0xa')]();ami[_0x365b('0xb')]=BPromise[_0x365b('0xc')](ami[_0x365b('0xd')]);function error(_0xe71860){logger[_0x365b('0xe')](util[_0x365b('0xf')](_0x365b('0x10'),config[_0x365b('0x7')][_0x365b('0x11')],config[_0x365b('0x7')]['ip'],config[_0x365b('0x7')][_0x365b('0x8')],util[_0x365b('0x12')](_0xe71860,![],null)));}function close(){logger[_0x365b('0xe')](util[_0x365b('0xf')](_0x365b('0x13'),config[_0x365b('0x7')][_0x365b('0x11')],config['asterisk']['ip'],config[_0x365b('0x7')][_0x365b('0x8')]));}ami[_0x365b('0x14')]=function(){return function(){return ami['Action']({'action':_0x365b('0x15')});};};ami[_0x365b('0x16')]=function(){return function(){return ami[_0x365b('0xb')]({'action':_0x365b('0x17')});};};ami[_0x365b('0x18')]=function(){return function(){return ami[_0x365b('0xb')]({'action':_0x365b('0x19')});};};ami[_0x365b('0x1a')]=function(){return function(){return ami[_0x365b('0xb')]({'action':'queuesummary'});};};ami[_0x365b('0x1b')]=function(){return function(){return ami['Action']({'action':_0x365b('0x1c')});};};function connect(_0x180649){logger[_0x365b('0x1d')](util['format'](_0x365b('0x1e'),config[_0x365b('0x7')][_0x365b('0x11')],config[_0x365b('0x7')]['ip'],config[_0x365b('0x7')][_0x365b('0x8')]));ami[_0x365b('0x1f')](_0x365b('0xe'),error);ami[_0x365b('0x1f')]('close',close);}ami['on'](_0x365b('0x20'),connect);ami['on'](_0x365b('0x21'),function(_0x56ca2f){logger[_0x365b('0x1d')](util[_0x365b('0xf')](_0x365b('0x22'),config[_0x365b('0x7')][_0x365b('0x11')],config['asterisk']['ip'],config[_0x365b('0x7')][_0x365b('0x8')],util[_0x365b('0x12')](_0x56ca2f,![],null)));});ami['on'](_0x365b('0x23'),function(_0x227d7a){logger[_0x365b('0x1d')](util[_0x365b('0xf')](_0x365b('0x24'),config[_0x365b('0x7')][_0x365b('0x11')],config[_0x365b('0x7')]['ip'],config['asterisk'][_0x365b('0x8')]));return BPromise[_0x365b('0x25')]()[_0x365b('0x26')](ami[_0x365b('0x14')]())['then'](ami[_0x365b('0x16')]())[_0x365b('0x26')](ami[_0x365b('0x18')]())['then'](ami['actionQueueSummary']())[_0x365b('0x26')](ami[_0x365b('0x1b')]())['catch'](function(_0x558d84){console[_0x365b('0x27')](_0x558d84);});});ami['once'](_0x365b('0xe'),error);ami[_0x365b('0x1f')]('close',close);module[_0x365b('0x28')]=ami; \ No newline at end of file +var _0xe30e=['actionCoreShowChannels','coreshowchannels','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\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','exports','asterisk-manager','bluebird','moment','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','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','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','actionQueueSummary'];(function(_0x2c106b,_0x4ec79e){var _0x41c60e=function(_0x5cd1d5){while(--_0x5cd1d5){_0x2c106b['push'](_0x2c106b['shift']());}};_0x41c60e(++_0x4ec79e);}(_0xe30e,0xde));var _0xee30=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0xe30e[_0x4cfa2e];return _0x279b50;};'use strict';var Manager=require(_0xee30('0x0'));var BPromise=require(_0xee30('0x1'));var moment=require(_0xee30('0x2'));var util=require('util');var _=require('lodash');var logger=require(_0xee30('0x3'))(_0xee30('0x4'));var config=require(_0xee30('0x5'));var ami=new Manager(config[_0xee30('0x6')][_0xee30('0x7')],config['asterisk']['ip'],config[_0xee30('0x6')][_0xee30('0x8')],config[_0xee30('0x6')][_0xee30('0x9')],!![]);ami['keepConnected']();ami[_0xee30('0xa')]=BPromise[_0xee30('0xb')](ami[_0xee30('0xc')]);function error(_0x26ab55){logger[_0xee30('0xd')](util[_0xee30('0xe')](_0xee30('0xf'),config[_0xee30('0x6')][_0xee30('0x8')],config[_0xee30('0x6')]['ip'],config[_0xee30('0x6')]['port'],util[_0xee30('0x10')](_0x26ab55,![],null)));}function close(){logger[_0xee30('0xd')](util[_0xee30('0xe')](_0xee30('0x11'),config[_0xee30('0x6')][_0xee30('0x8')],config[_0xee30('0x6')]['ip'],config[_0xee30('0x6')][_0xee30('0x7')]));}ami[_0xee30('0x12')]=function(){return function(){return ami[_0xee30('0xa')]({'action':_0xee30('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xee30('0xa')]({'action':_0xee30('0x14')});};};ami[_0xee30('0x15')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xee30('0x16')]=function(){return function(){return ami[_0xee30('0xa')]({'action':'queuesummary'});};};ami[_0xee30('0x17')]=function(){return function(){return ami[_0xee30('0xa')]({'action':_0xee30('0x18')});};};function connect(_0x193574){logger['info'](util[_0xee30('0xe')](_0xee30('0x19'),config[_0xee30('0x6')][_0xee30('0x8')],config[_0xee30('0x6')]['ip'],config['asterisk']['port']));ami[_0xee30('0x1a')](_0xee30('0xd'),error);ami[_0xee30('0x1a')](_0xee30('0x1b'),close);}ami['on']('connect',connect);ami['on'](_0xee30('0x1c'),function(_0x450ba6){logger['info'](util[_0xee30('0xe')](_0xee30('0x1d'),config['asterisk'][_0xee30('0x8')],config['asterisk']['ip'],config['asterisk']['port'],util[_0xee30('0x10')](_0x450ba6,![],null)));});ami['on']('fullybooted',function(_0x5298c2){logger['info'](util['format'](_0xee30('0x1e'),config[_0xee30('0x6')][_0xee30('0x8')],config[_0xee30('0x6')]['ip'],config[_0xee30('0x6')]['port']));return BPromise[_0xee30('0x1f')]()[_0xee30('0x20')](ami[_0xee30('0x12')]())[_0xee30('0x20')](ami[_0xee30('0x21')]())['then'](ami[_0xee30('0x15')]())[_0xee30('0x20')](ami[_0xee30('0x16')]())[_0xee30('0x20')](ami['actionCoreShowChannels']())['catch'](function(_0x33630a){console['log'](_0x33630a);});});ami[_0xee30('0x1a')](_0xee30('0xd'),error);ami[_0xee30('0x1a')](_0xee30('0x1b'),close);module[_0xee30('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 22c1d38..3b56046 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 _0x5f74=['debug','rpc','memberReport','error','message','result','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','then'];(function(_0x4d935e,_0x1c3a7c){var _0x217fe5=function(_0x2a4650){while(--_0x2a4650){_0x4d935e['push'](_0x4d935e['shift']());}};_0x217fe5(++_0x1c3a7c);}(_0x5f74,0x12d));var _0x45f7=function(_0x502773,_0x482c17){_0x502773=_0x502773-0x0;var _0x55a2f6=_0x5f74[_0x502773];return _0x55a2f6;};'use strict';var jayson=require(_0x45f7('0x0'));var BPromise=require(_0x45f7('0x1'));var logger=require(_0x45f7('0x2'))('ami');var client=jayson[_0x45f7('0x3')][_0x45f7('0x4')]({'port':0x2329});client[_0x45f7('0x5')]=function(_0xb313d,_0x4c7fa1){return new BPromise(function(_0x9abe0b,_0x2ae1fa){return client['request'](_0xb313d,_0x4c7fa1)[_0x45f7('0x6')](function(_0x1ae1ae){logger[_0x45f7('0x7')](_0x45f7('0x8'),_0x45f7('0x9'),_0xb313d,_0x4c7fa1,_0x1ae1ae);if(_0x1ae1ae[_0x45f7('0xa')]){logger['error'](_0x45f7('0x8'),_0x45f7('0x9'),_0xb313d,_0x1ae1ae[_0x45f7('0xa')][_0x45f7('0xb')],_0x4c7fa1);return _0x2ae1fa(_0x1ae1ae[_0x45f7('0xa')][_0x45f7('0xb')]);}else{return _0x9abe0b(_0x1ae1ae[_0x45f7('0xc')]);}})['catch'](function(_0x20ad23){logger[_0x45f7('0xa')](_0x45f7('0x8'),_0x45f7('0x9'),_0xb313d,_0x20ad23,_0x4c7fa1);return _0x2ae1fa(_0x20ad23);});});};module[_0x45f7('0xd')]=client; \ No newline at end of file +var _0x9b13=['request','then','debug','memberReport','error','rpc','message','result','catch','jayson/promise','bluebird','../../config/logger','client','Request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9b13,0x1ad));var _0x39b1=function(_0x17f361,_0x2041e2){_0x17f361=_0x17f361-0x0;var _0x2fbc56=_0x9b13[_0x17f361];return _0x2fbc56;};'use strict';var jayson=require(_0x39b1('0x0'));var BPromise=require(_0x39b1('0x1'));var logger=require(_0x39b1('0x2'))('ami');var client=jayson[_0x39b1('0x3')]['http']({'port':0x2329});client[_0x39b1('0x4')]=function(_0x2cbecd,_0x30984e){return new BPromise(function(_0x138a1f,_0x1f377d){return client[_0x39b1('0x5')](_0x2cbecd,_0x30984e)[_0x39b1('0x6')](function(_0xdb046){logger[_0x39b1('0x7')]('rpc',_0x39b1('0x8'),_0x2cbecd,_0x30984e,_0xdb046);if(_0xdb046[_0x39b1('0x9')]){logger['error'](_0x39b1('0xa'),_0x39b1('0x8'),_0x2cbecd,_0xdb046[_0x39b1('0x9')][_0x39b1('0xb')],_0x30984e);return _0x1f377d(_0xdb046[_0x39b1('0x9')][_0x39b1('0xb')]);}else{return _0x138a1f(_0xdb046[_0x39b1('0xc')]);}})[_0x39b1('0xd')](function(_0x565e6f){logger['error'](_0x39b1('0xa'),_0x39b1('0x8'),_0x2cbecd,_0x565e6f,_0x30984e);return _0x1f377d(_0x565e6f);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 3cd9a8c..09abfbf 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 _0xf603=['getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype'];(function(_0x470d3d,_0x48eac8){var _0x35c062=function(_0x2c1e4c){while(--_0x2c1e4c){_0x470d3d['push'](_0x470d3d['shift']());}};_0x35c062(++_0x48eac8);}(_0xf603,0xeb));var _0x3f60=function(_0x295928,_0xaea684){_0x295928=_0x295928-0x0;var _0x2271aa=_0xf603[_0x295928];return _0x2271aa;};'use strict';var util=require(_0x3f60('0x0'));var _=require(_0x3f60('0x1'));var moment=require(_0x3f60('0x2'));function checkNameSurname(_0x5a9fe7,_0x16d28f,_0xb20102){var _0x3da9d6='';if(!_[_0x3f60('0x3')](_0x16d28f)&&_0x3f60('0x4')===typeof _0x16d28f){_0x3da9d6+=_0x16d28f;}if(!_['isNil'](_0xb20102)&&_0x3f60('0x4')===typeof _0xb20102){_0x3da9d6+='\x20'+_0xb20102;}if(_0x3da9d6!==''){return _0x3da9d6;}return _0x5a9fe7;}function Action(_0x5559e4,_0x5914cd,_0x2910c7){this[_0x3f60('0x5')]=_0x5559e4;this[_0x3f60('0x6')]=_0x2910c7||undefined;this[_0x3f60('0x7')]=checkNameSurname(_0x5914cd[_0x3f60('0x8')][_0x3f60('0x9')],_0x5914cd['Contact'][_0x3f60('0xa')],_0x5914cd[_0x3f60('0x8')][_0x3f60('0xb')]);this[_0x3f60('0xc')]=_0x5914cd['Contact']['phone'];this[_0x3f60('0xd')]=_0x5559e4[_0x3f60('0x7')];this[_0x3f60('0xe')]=_0x5914cd['active']||![];this[_0x3f60('0xf')]=_0x5559e4[_0x3f60('0xf')];this[_0x3f60('0x10')]=_0x5559e4['dialQueueTimeout']||0x3;this[_0x3f60('0x11')]=_0x5914cd[_0x3f60('0x11')];this[_0x3f60('0x12')]=_0x5914cd[_0x3f60('0x12')];this[_0x3f60('0x13')]=_0x5914cd[_0x3f60('0x13')];this[_0x3f60('0x14')]=_0x5914cd[_0x3f60('0x14')];this['countnosuchnumberretry']=_0x5914cd['countnosuchnumberretry'];this['countdropretry']=_0x5914cd[_0x3f60('0x15')];this[_0x3f60('0x16')]=_0x5914cd[_0x3f60('0x16')];this[_0x3f60('0x17')]=_0x5914cd[_0x3f60('0x17')];this[_0x3f60('0x18')]=_0x5914cd[_0x3f60('0x18')];this[_0x3f60('0x19')]=_0x5914cd[_0x3f60('0x19')];this['ListId']=_0x5914cd[_0x3f60('0x1a')];this[_0x3f60('0x1b')]=_0x5914cd[_0x3f60('0x1b')];this[_0x3f60('0x1c')]=_0x5914cd['VoiceQueueId'];this['CampaignId']=_0x5914cd[_0x3f60('0x1d')];this[_0x3f60('0x1e')]=_0x5914cd['id'];this[_0x3f60('0x1f')]=_0x5914cd[_0x3f60('0x8')]['firstName']||'';this[_0x3f60('0x20')]=moment()[_0x3f60('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x5914cd[_0x3f60('0x22')];this[_0x3f60('0x23')]=_0x5914cd[_0x3f60('0x23')];this[_0x3f60('0x24')]=_0x5914cd['callbackat'];this[_0x3f60('0x25')]=_0x5914cd[_0x3f60('0x25')];this[_0x3f60('0x26')]='';this[_0x3f60('0x27')]='';}Action[_0x3f60('0x28')][_0x3f60('0x29')]=function(){return util[_0x3f60('0x21')](_0x3f60('0x2a'),this[_0x3f60('0x7')],this[_0x3f60('0x5')]['dialCutDigit']>0x0?this[_0x3f60('0xc')][_0x3f60('0x2b')](this[_0x3f60('0x5')][_0x3f60('0x2c')]):this[_0x3f60('0xc')]);};Action[_0x3f60('0x28')]['getQueue']=function(){return this[_0x3f60('0xd')];};module[_0x3f60('0x2d')]=Action; \ No newline at end of file +var _0x97f5=['firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone'];(function(_0x5c9fde,_0xea127){var _0x2ea25d=function(_0x2786da){while(--_0x2786da){_0x5c9fde['push'](_0x5c9fde['shift']());}};_0x2ea25d(++_0xea127);}(_0x97f5,0x72));var _0x597f=function(_0x50ba4f,_0x1bec0e){_0x50ba4f=_0x50ba4f-0x0;var _0x10348a=_0x97f5[_0x50ba4f];return _0x10348a;};'use strict';var util=require(_0x597f('0x0'));var _=require(_0x597f('0x1'));var moment=require(_0x597f('0x2'));function checkNameSurname(_0x4afccb,_0x5c0754,_0xae9eeb){var _0x4058fa='';if(!_[_0x597f('0x3')](_0x5c0754)&&_0x597f('0x4')===typeof _0x5c0754){_0x4058fa+=_0x5c0754;}if(!_[_0x597f('0x3')](_0xae9eeb)&&_0x597f('0x4')===typeof _0xae9eeb){_0x4058fa+='\x20'+_0xae9eeb;}if(_0x4058fa!==''){return _0x4058fa;}return _0x4afccb;}function Action(_0x38560e,_0x1abf16,_0x89d13a){this['voiceQueue']=_0x38560e;this[_0x597f('0x5')]=_0x89d13a||undefined;this[_0x597f('0x6')]=checkNameSurname(_0x1abf16[_0x597f('0x7')][_0x597f('0x8')],_0x1abf16[_0x597f('0x7')][_0x597f('0x9')],_0x1abf16['Contact'][_0x597f('0xa')]);this[_0x597f('0xb')]=_0x1abf16[_0x597f('0x7')]['phone'];this['queue']=_0x38560e[_0x597f('0x6')];this['active']=_0x1abf16[_0x597f('0xc')]||![];this[_0x597f('0xd')]=_0x38560e[_0x597f('0xd')];this['dialQueueTimeout']=_0x38560e[_0x597f('0xe')]||0x3;this[_0x597f('0xf')]=_0x1abf16[_0x597f('0xf')];this[_0x597f('0x10')]=_0x1abf16[_0x597f('0x10')];this[_0x597f('0x11')]=_0x1abf16[_0x597f('0x11')];this[_0x597f('0x12')]=_0x1abf16[_0x597f('0x12')];this[_0x597f('0x13')]=_0x1abf16[_0x597f('0x13')];this[_0x597f('0x14')]=_0x1abf16[_0x597f('0x14')];this['countabandonedretry']=_0x1abf16[_0x597f('0x15')];this[_0x597f('0x16')]=_0x1abf16[_0x597f('0x16')];this['countagentrejectretry']=_0x1abf16[_0x597f('0x17')];this['ContactId']=_0x1abf16['ContactId'];this['ListId']=_0x1abf16['ListId'];this['UserId']=_0x1abf16['UserId'];this[_0x597f('0x18')]=_0x1abf16[_0x597f('0x18')];this['CampaignId']=_0x1abf16[_0x597f('0x19')];this[_0x597f('0x1a')]=_0x1abf16['id'];this[_0x597f('0x1b')]=_0x1abf16[_0x597f('0x7')]['firstName']||'';this['starttime']=moment()[_0x597f('0x1c')](_0x597f('0x1d'));this[_0x597f('0x1e')]=_0x1abf16[_0x597f('0x1e')];this['callbackuniqueid']=_0x1abf16['callbackuniqueid'];this[_0x597f('0x1f')]=_0x1abf16['callbackat'];this['recallme']=_0x1abf16[_0x597f('0x20')];this[_0x597f('0x21')]='';this[_0x597f('0x22')]='';}Action['prototype']['getCaller']=function(){return util['format'](_0x597f('0x23'),this[_0x597f('0x6')],this['voiceQueue'][_0x597f('0x24')]>0x0?this[_0x597f('0xb')][_0x597f('0x25')](this['voiceQueue']['dialCutDigit']):this[_0x597f('0xb')]);};Action['prototype'][_0x597f('0x26')]=function(){return this[_0x597f('0x27')];};module[_0x597f('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index e22d882..65c87d8 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 _0xa724=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0xa724,0xe2));var _0x4a72=function(_0x15d4fc,_0x5d91dc){_0x15d4fc=_0x15d4fc-0x0;var _0x126ee2=_0xa724[_0x15d4fc];return _0x126ee2;};'use strict';var util=require('util');var _=require(_0x4a72('0x0'));var moment=require(_0x4a72('0x1'));function getSeconds(_0x14b3b2,_0x18feed){var _0x636fe2=moment(_0x14b3b2)[_0x4a72('0x2')](0x0);var _0x4ea2c1=moment(_0x18feed)[_0x4a72('0x2')](0x0);return _0x636fe2[_0x4a72('0x3')](_0x4ea2c1,'seconds');}function AgentComplete(_0x21e327,_0x7787cd){this['state']=0x4;this[_0x4a72('0x4')]='Answer';this[_0x4a72('0x5')]=_0x21e327[_0x4a72('0x5')];this[_0x4a72('0x6')]=_0x21e327['type'];this[_0x4a72('0x7')]=_0x21e327['type']==='outbound'?_0x4a72('0x8'):_0x21e327[_0x4a72('0x6')];this[_0x4a72('0x9')]=_0x21e327[_0x4a72('0x9')];this[_0x4a72('0xa')]=_0x21e327[_0x4a72('0xa')];this[_0x4a72('0xb')]=_0x21e327[_0x4a72('0xb')];this[_0x4a72('0xc')]=_0x21e327['countbusyretry']+_0x21e327[_0x4a72('0xa')]+_0x21e327[_0x4a72('0xb')]+_0x21e327['countnosuchnumberretry']+_0x21e327[_0x4a72('0xd')]+_0x21e327[_0x4a72('0xe')]+_0x21e327[_0x4a72('0xf')]+_0x21e327['countagentrejectretry'];this[_0x4a72('0x10')]=_0x21e327[_0x4a72('0x10')];this[_0x4a72('0xd')]=_0x21e327[_0x4a72('0xd')];this[_0x4a72('0xe')]=_0x21e327[_0x4a72('0xe')];this['countmachineretry']=_0x21e327[_0x4a72('0xf')];this[_0x4a72('0x11')]=_0x21e327[_0x4a72('0x11')];this[_0x4a72('0x12')]=_0x7787cd[_0x4a72('0x12')];this[_0x4a72('0x13')]=_0x21e327['name'];this[_0x4a72('0x14')]=_0x21e327['number'];this[_0x4a72('0x15')]=_0x21e327['starttime'];this[_0x4a72('0x16')]=_0x21e327[_0x4a72('0x16')];this[_0x4a72('0x17')]=_0x21e327[_0x4a72('0x17')];this[_0x4a72('0x18')]=moment()[_0x4a72('0x19')](_0x4a72('0x1a'));this[_0x4a72('0x1b')]=getSeconds(_0x21e327[_0x4a72('0x16')],_0x21e327['starttime']);this[_0x4a72('0x1c')]=getSeconds(_0x21e327[_0x4a72('0x17')],_0x21e327[_0x4a72('0x16')]);this[_0x4a72('0x1d')]=getSeconds(this[_0x4a72('0x18')],_0x21e327['answertime']);this[_0x4a72('0x8')]=_0x7787cd[_0x4a72('0x8')];this[_0x4a72('0x1e')]=_0x7787cd[_0x4a72('0x1e')];this[_0x4a72('0x1f')]=_0x7787cd['reason'];this['callback']=_0x21e327['callback'];this[_0x4a72('0x20')]=_0x21e327['callbackuniqueid'];this[_0x4a72('0x21')]=_0x21e327[_0x4a72('0x21')];this['recallme']=_0x21e327[_0x4a72('0x22')];this[_0x4a72('0x23')]=_0x21e327[_0x4a72('0x23')];this[_0x4a72('0x24')]=_0x21e327[_0x4a72('0x24')];this[_0x4a72('0x25')]=_0x21e327['UserId'];this[_0x4a72('0x26')]=_0x21e327[_0x4a72('0x26')];this['CampaignId']=_0x21e327[_0x4a72('0x27')];this[_0x4a72('0x28')]=_0x21e327['originatecalleridnum']||'';this[_0x4a72('0x29')]=_0x21e327[_0x4a72('0x29')]||'';}module[_0x4a72('0x2a')]=AgentComplete; \ No newline at end of file +var _0xdf68=['queue','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','type','outbound'];(function(_0x45c536,_0x52a556){var _0x10e06d=function(_0x3fcca0){while(--_0x3fcca0){_0x45c536['push'](_0x45c536['shift']());}};_0x10e06d(++_0x52a556);}(_0xdf68,0xa6));var _0x8df6=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0xdf68[_0x142020];return _0x40da8f;};'use strict';var util=require(_0x8df6('0x0'));var _=require(_0x8df6('0x1'));var moment=require(_0x8df6('0x2'));function getSeconds(_0x49bafb,_0x30dee4){var _0x31c29a=moment(_0x49bafb)[_0x8df6('0x3')](0x0);var _0x28e3cf=moment(_0x30dee4)[_0x8df6('0x3')](0x0);return _0x31c29a[_0x8df6('0x4')](_0x28e3cf,'seconds');}function AgentComplete(_0x244f41,_0x336eda){this[_0x8df6('0x5')]=0x4;this[_0x8df6('0x6')]=_0x8df6('0x7');this['scheduledat']=_0x244f41['scheduledat'];this['type']=_0x244f41['type'];this['campaigntype']=_0x244f41[_0x8df6('0x8')]===_0x8df6('0x9')?_0x8df6('0xa'):_0x244f41[_0x8df6('0x8')];this[_0x8df6('0xb')]=_0x244f41[_0x8df6('0xb')];this[_0x8df6('0xc')]=_0x244f41['countcongestionretry'];this['countnoanswerretry']=_0x244f41['countnoanswerretry'];this['countglobal']=_0x244f41['countbusyretry']+_0x244f41[_0x8df6('0xc')]+_0x244f41['countnoanswerretry']+_0x244f41[_0x8df6('0xd')]+_0x244f41['countdropretry']+_0x244f41[_0x8df6('0xe')]+_0x244f41[_0x8df6('0xf')]+_0x244f41[_0x8df6('0x10')];this['countnosuchnumberretry']=_0x244f41[_0x8df6('0xd')];this[_0x8df6('0x11')]=_0x244f41[_0x8df6('0x11')];this[_0x8df6('0xe')]=_0x244f41[_0x8df6('0xe')];this['countmachineretry']=_0x244f41[_0x8df6('0xf')];this[_0x8df6('0x10')]=_0x244f41['countagentrejectretry'];this[_0x8df6('0x12')]=_0x336eda['uniqueid'];this[_0x8df6('0x13')]=_0x244f41[_0x8df6('0x14')];this[_0x8df6('0x15')]=_0x244f41['number'];this['starttime']=_0x244f41[_0x8df6('0x16')];this[_0x8df6('0x17')]=_0x244f41[_0x8df6('0x17')];this[_0x8df6('0x18')]=_0x244f41['answertime'];this[_0x8df6('0x19')]=moment()[_0x8df6('0x1a')](_0x8df6('0x1b'));this[_0x8df6('0x1c')]=getSeconds(_0x244f41['responsetime'],_0x244f41['starttime']);this[_0x8df6('0x1d')]=getSeconds(_0x244f41[_0x8df6('0x18')],_0x244f41['responsetime']);this['talktime']=getSeconds(this[_0x8df6('0x19')],_0x244f41[_0x8df6('0x18')]);this[_0x8df6('0xa')]=_0x336eda[_0x8df6('0xa')];this['membername']=_0x336eda[_0x8df6('0x1e')];this[_0x8df6('0x1f')]=_0x336eda[_0x8df6('0x1f')];this[_0x8df6('0x20')]=_0x244f41[_0x8df6('0x20')];this['callbackuniqueid']=_0x244f41[_0x8df6('0x21')];this[_0x8df6('0x22')]=_0x244f41['callbackat'];this['recallme']=_0x244f41[_0x8df6('0x23')];this['ContactId']=_0x244f41[_0x8df6('0x24')];this[_0x8df6('0x25')]=_0x244f41[_0x8df6('0x25')];this[_0x8df6('0x26')]=_0x244f41[_0x8df6('0x26')];this[_0x8df6('0x27')]=_0x244f41[_0x8df6('0x27')];this[_0x8df6('0x28')]=_0x244f41['CampaignId'];this[_0x8df6('0x29')]=_0x244f41[_0x8df6('0x29')]||'';this[_0x8df6('0x2a')]=_0x244f41['originatecalleridname']||'';}module[_0x8df6('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index b2b2857..640faee 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 _0x23d5=['scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','diff','seconds'];(function(_0x43d191,_0x1a6715){var _0x59ce92=function(_0x45464f){while(--_0x45464f){_0x43d191['push'](_0x43d191['shift']());}};_0x59ce92(++_0x1a6715);}(_0x23d5,0x1f4));var _0x523d=function(_0x100fdb,_0x3f53ac){_0x100fdb=_0x100fdb-0x0;var _0xd6670b=_0x23d5[_0x100fdb];return _0xd6670b;};'use strict';var util=require('util');var _=require(_0x523d('0x0'));var moment=require(_0x523d('0x1'));function getSeconds(_0x2979e2,_0x9b2d05){var _0x310098=moment(_0x2979e2)['milliseconds'](0x0);var _0x1e0b5d=moment(_0x9b2d05)['milliseconds'](0x0);return _0x310098[_0x523d('0x2')](_0x1e0b5d,_0x523d('0x3'));}function Final(_0x3a9448){this['uniqueid']=_0x3a9448['uniqueid'];this[_0x523d('0x4')]=_0x3a9448[_0x523d('0x4')];this[_0x523d('0x5')]=_0x3a9448[_0x523d('0x5')];this[_0x523d('0x6')]=_0x3a9448[_0x523d('0x5')]===_0x523d('0x7')?'queue':_0x3a9448[_0x523d('0x5')];this['countbusyretry']=_0x3a9448['countbusyretry'];this[_0x523d('0x8')]=_0x3a9448[_0x523d('0x8')];this[_0x523d('0x9')]=_0x3a9448[_0x523d('0x9')];this[_0x523d('0xa')]=_0x3a9448[_0x523d('0xb')]+_0x3a9448[_0x523d('0x8')]+_0x3a9448['countnoanswerretry']+_0x3a9448[_0x523d('0xc')]+_0x3a9448[_0x523d('0xd')]+_0x3a9448[_0x523d('0xe')]+_0x3a9448[_0x523d('0xf')]+_0x3a9448[_0x523d('0x10')];this[_0x523d('0xc')]=_0x3a9448['countnosuchnumberretry'];this[_0x523d('0xd')]=_0x3a9448['countdropretry'];this[_0x523d('0xe')]=_0x3a9448['countabandonedretry'];this[_0x523d('0xf')]=_0x3a9448[_0x523d('0xf')];this[_0x523d('0x10')]=_0x3a9448[_0x523d('0x10')];this[_0x523d('0x11')]=_0x3a9448[_0x523d('0x11')];this['calleridname']=_0x3a9448[_0x523d('0x12')];this[_0x523d('0x13')]=_0x3a9448['calleridnum'];this[_0x523d('0x14')]=_0x3a9448[_0x523d('0x14')];this[_0x523d('0x15')]=_0x3a9448[_0x523d('0x15')];this[_0x523d('0x16')]=_0x3a9448[_0x523d('0x15')];this['ringtime']=_0x3a9448[_0x523d('0x17')]||0x0;this[_0x523d('0x18')]=_0x3a9448['holdtime']||0x0;this[_0x523d('0x19')]=_0x3a9448['talktime']||0x0;this['callback']=_0x3a9448[_0x523d('0x1a')];this['callbackuniqueid']=_0x3a9448[_0x523d('0x1b')];this['callbackat']=_0x3a9448['callbackat'];this['recallme']=_0x3a9448[_0x523d('0x1c')];this[_0x523d('0x1d')]=_0x3a9448[_0x523d('0x1d')];this[_0x523d('0x1e')]=_0x3a9448[_0x523d('0x1e')];this[_0x523d('0x1f')]=_0x3a9448[_0x523d('0x1f')];this[_0x523d('0x20')]=_0x3a9448[_0x523d('0x20')];this[_0x523d('0x21')]=_0x3a9448[_0x523d('0x21')];this[_0x523d('0x22')]=_0x3a9448[_0x523d('0x22')]||'';this[_0x523d('0x23')]=_0x3a9448[_0x523d('0x23')]||'';}module['exports']=Final; \ No newline at end of file +var _0xfbcf=['originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x273f77,_0xe5b0cb){var _0x71e147=function(_0x564056){while(--_0x564056){_0x273f77['push'](_0x273f77['shift']());}};_0x71e147(++_0xe5b0cb);}(_0xfbcf,0x12b));var _0xffbc=function(_0x1861ea,_0x5e2b75){_0x1861ea=_0x1861ea-0x0;var _0x16278d=_0xfbcf[_0x1861ea];return _0x16278d;};'use strict';var util=require('util');var _=require(_0xffbc('0x0'));var moment=require('moment');function getSeconds(_0x3564bb,_0x20619d){var _0x1c2625=moment(_0x3564bb)[_0xffbc('0x1')](0x0);var _0x437350=moment(_0x20619d)[_0xffbc('0x1')](0x0);return _0x1c2625[_0xffbc('0x2')](_0x437350,_0xffbc('0x3'));}function Final(_0x527f10){this[_0xffbc('0x4')]=_0x527f10[_0xffbc('0x4')];this[_0xffbc('0x5')]=_0x527f10['scheduledat'];this[_0xffbc('0x6')]=_0x527f10['type'];this['campaigntype']=_0x527f10['type']===_0xffbc('0x7')?_0xffbc('0x8'):_0x527f10[_0xffbc('0x6')];this[_0xffbc('0x9')]=_0x527f10[_0xffbc('0x9')];this['countcongestionretry']=_0x527f10[_0xffbc('0xa')];this[_0xffbc('0xb')]=_0x527f10[_0xffbc('0xb')];this[_0xffbc('0xc')]=_0x527f10[_0xffbc('0x9')]+_0x527f10['countcongestionretry']+_0x527f10[_0xffbc('0xb')]+_0x527f10[_0xffbc('0xd')]+_0x527f10[_0xffbc('0xe')]+_0x527f10['countabandonedretry']+_0x527f10[_0xffbc('0xf')]+_0x527f10['countagentrejectretry'];this[_0xffbc('0xd')]=_0x527f10[_0xffbc('0xd')];this['countdropretry']=_0x527f10['countdropretry'];this[_0xffbc('0x10')]=_0x527f10[_0xffbc('0x10')];this[_0xffbc('0xf')]=_0x527f10[_0xffbc('0xf')];this['countagentrejectretry']=_0x527f10[_0xffbc('0x11')];this[_0xffbc('0x8')]=_0x527f10[_0xffbc('0x8')];this[_0xffbc('0x12')]=_0x527f10[_0xffbc('0x12')];this[_0xffbc('0x13')]=_0x527f10[_0xffbc('0x13')];this[_0xffbc('0x14')]=_0x527f10[_0xffbc('0x14')];this['responsetime']=_0x527f10['responsetime'];this[_0xffbc('0x15')]=_0x527f10[_0xffbc('0x16')];this[_0xffbc('0x17')]=_0x527f10['ringtime']||0x0;this[_0xffbc('0x18')]=_0x527f10[_0xffbc('0x18')]||0x0;this['talktime']=_0x527f10['talktime']||0x0;this[_0xffbc('0x19')]=_0x527f10['callback'];this[_0xffbc('0x1a')]=_0x527f10[_0xffbc('0x1a')];this[_0xffbc('0x1b')]=_0x527f10[_0xffbc('0x1b')];this[_0xffbc('0x1c')]=_0x527f10[_0xffbc('0x1c')];this[_0xffbc('0x1d')]=_0x527f10[_0xffbc('0x1d')];this[_0xffbc('0x1e')]=_0x527f10[_0xffbc('0x1e')];this[_0xffbc('0x1f')]=_0x527f10[_0xffbc('0x1f')];this['VoiceQueueId']=_0x527f10[_0xffbc('0x20')];this['CampaignId']=_0x527f10[_0xffbc('0x21')];this[_0xffbc('0x22')]=_0x527f10['originatecalleridnum']||'';this[_0xffbc('0x23')]=_0x527f10[_0xffbc('0x23')]||'';}module[_0xffbc('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 51f9a37..f4f858c 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 _0x1868=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','IVR','reason','callback','callbackuniqueid'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0x1868,0x168));var _0x8186=function(_0xa19ec5,_0x5742bf){_0xa19ec5=_0xa19ec5-0x0;var _0x3d2c82=_0x1868[_0xa19ec5];return _0x3d2c82;};'use strict';var util=require(_0x8186('0x0'));var _=require(_0x8186('0x1'));var moment=require(_0x8186('0x2'));function getSeconds(_0x2eef77,_0x3a6c95){var _0x3b43c9=moment(_0x2eef77)[_0x8186('0x3')](0x0);var _0x220a7f=moment(_0x3a6c95)[_0x8186('0x3')](0x0);return _0x3b43c9[_0x8186('0x4')](_0x220a7f,'seconds');}function Hangup(_0x5be6d0,_0x593e71){this[_0x8186('0x5')]=0x4;this[_0x8186('0x6')]=_0x8186('0x7');this['scheduledat']=_0x5be6d0[_0x8186('0x8')];this[_0x8186('0x9')]=_0x5be6d0['type'];this['campaigntype']=_0x5be6d0[_0x8186('0x9')]===_0x8186('0xa')?_0x8186('0xb'):_0x5be6d0['type'];this[_0x8186('0xc')]=_0x5be6d0[_0x8186('0xc')];this[_0x8186('0xd')]=_0x5be6d0[_0x8186('0xd')];this[_0x8186('0xe')]=_0x5be6d0['countnoanswerretry'];this[_0x8186('0xf')]=_0x5be6d0['countbusyretry']+_0x5be6d0[_0x8186('0xd')]+_0x5be6d0[_0x8186('0xe')]+_0x5be6d0[_0x8186('0x10')]+_0x5be6d0[_0x8186('0x11')]+_0x5be6d0['countabandonedretry']+_0x5be6d0[_0x8186('0x12')]+_0x5be6d0[_0x8186('0x13')];this[_0x8186('0x10')]=_0x5be6d0[_0x8186('0x10')];this[_0x8186('0x11')]=_0x5be6d0[_0x8186('0x11')];this['countabandonedretry']=_0x5be6d0[_0x8186('0x14')];this['countmachineretry']=_0x5be6d0[_0x8186('0x12')];this[_0x8186('0x13')]=_0x5be6d0[_0x8186('0x13')];this[_0x8186('0x15')]=_0x593e71[_0x8186('0x15')];this[_0x8186('0x16')]=_0x5be6d0[_0x8186('0x17')];this['calleridnum']=_0x5be6d0[_0x8186('0x18')];this[_0x8186('0x19')]=_0x5be6d0[_0x8186('0x19')];this[_0x8186('0x1a')]=_0x5be6d0[_0x8186('0x1a')];this['endtime']=moment()[_0x8186('0x1b')](_0x8186('0x1c'));this[_0x8186('0x1d')]=getSeconds(_0x5be6d0[_0x8186('0x1a')],_0x5be6d0[_0x8186('0x19')]);this['holdtime']=0x0;this[_0x8186('0x1e')]=getSeconds(this['endtime'],_0x5be6d0[_0x8186('0x1a')]);this[_0x8186('0xb')]=_0x5be6d0[_0x8186('0xb')];this[_0x8186('0x1f')]=_0x8186('0x20');this[_0x8186('0x21')]=_0x593e71['cause-txt'];this[_0x8186('0x22')]=_0x5be6d0[_0x8186('0x22')];this['callbackuniqueid']=_0x5be6d0[_0x8186('0x23')];this[_0x8186('0x24')]=_0x5be6d0[_0x8186('0x24')];this[_0x8186('0x25')]=_0x5be6d0[_0x8186('0x25')];this[_0x8186('0x26')]=_0x5be6d0[_0x8186('0x26')];this[_0x8186('0x27')]=_0x5be6d0[_0x8186('0x27')];this[_0x8186('0x28')]=_0x5be6d0[_0x8186('0x28')];this[_0x8186('0x29')]=_0x5be6d0[_0x8186('0x29')];this[_0x8186('0x2a')]=_0x5be6d0[_0x8186('0x2a')];}module[_0x8186('0x2b')]=Hangup; \ No newline at end of file +var _0x06c8=['seconds','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','util','lodash','moment','milliseconds','diff'];(function(_0x3c9626,_0x2bf37e){var _0x5c001f=function(_0x3f0691){while(--_0x3f0691){_0x3c9626['push'](_0x3c9626['shift']());}};_0x5c001f(++_0x2bf37e);}(_0x06c8,0x143));var _0x806c=function(_0x48c8bf,_0x4cc9cc){_0x48c8bf=_0x48c8bf-0x0;var _0x2ab998=_0x06c8[_0x48c8bf];return _0x2ab998;};'use strict';var util=require(_0x806c('0x0'));var _=require(_0x806c('0x1'));var moment=require(_0x806c('0x2'));function getSeconds(_0xdcfa3a,_0x33ab65){var _0x327db3=moment(_0xdcfa3a)[_0x806c('0x3')](0x0);var _0x38e129=moment(_0x33ab65)[_0x806c('0x3')](0x0);return _0x327db3[_0x806c('0x4')](_0x38e129,_0x806c('0x5'));}function Hangup(_0x2afa52,_0x52603a){this['state']=0x4;this['statedesc']=_0x806c('0x6');this[_0x806c('0x7')]=_0x2afa52['scheduledat'];this[_0x806c('0x8')]=_0x2afa52['type'];this[_0x806c('0x9')]=_0x2afa52['type']===_0x806c('0xa')?_0x806c('0xb'):_0x2afa52[_0x806c('0x8')];this[_0x806c('0xc')]=_0x2afa52[_0x806c('0xc')];this['countcongestionretry']=_0x2afa52['countcongestionretry'];this[_0x806c('0xd')]=_0x2afa52[_0x806c('0xd')];this[_0x806c('0xe')]=_0x2afa52['countbusyretry']+_0x2afa52[_0x806c('0xf')]+_0x2afa52[_0x806c('0xd')]+_0x2afa52[_0x806c('0x10')]+_0x2afa52[_0x806c('0x11')]+_0x2afa52[_0x806c('0x12')]+_0x2afa52[_0x806c('0x13')]+_0x2afa52[_0x806c('0x14')];this[_0x806c('0x10')]=_0x2afa52[_0x806c('0x10')];this[_0x806c('0x11')]=_0x2afa52[_0x806c('0x11')];this[_0x806c('0x12')]=_0x2afa52['countabandonedretry'];this[_0x806c('0x13')]=_0x2afa52['countmachineretry'];this[_0x806c('0x14')]=_0x2afa52[_0x806c('0x14')];this[_0x806c('0x15')]=_0x52603a[_0x806c('0x15')];this[_0x806c('0x16')]=_0x2afa52[_0x806c('0x17')];this['calleridnum']=_0x2afa52['number'];this['starttime']=_0x2afa52[_0x806c('0x18')];this[_0x806c('0x19')]=_0x2afa52[_0x806c('0x19')];this[_0x806c('0x1a')]=moment()['format'](_0x806c('0x1b'));this['ringtime']=getSeconds(_0x2afa52['responsetime'],_0x2afa52[_0x806c('0x18')]);this['holdtime']=0x0;this[_0x806c('0x1c')]=getSeconds(this['endtime'],_0x2afa52[_0x806c('0x19')]);this[_0x806c('0xb')]=_0x2afa52[_0x806c('0xb')];this[_0x806c('0x1d')]=_0x806c('0x1e');this['reason']=_0x52603a[_0x806c('0x1f')];this['callback']=_0x2afa52[_0x806c('0x20')];this['callbackuniqueid']=_0x2afa52[_0x806c('0x21')];this[_0x806c('0x22')]=_0x2afa52[_0x806c('0x22')];this['recallme']=_0x2afa52[_0x806c('0x23')];this[_0x806c('0x24')]=_0x2afa52[_0x806c('0x24')];this[_0x806c('0x25')]=_0x2afa52[_0x806c('0x25')];this['UserId']=_0x2afa52[_0x806c('0x26')];this['VoiceQueueId']=_0x2afa52['VoiceQueueId'];this[_0x806c('0x27')]=_0x2afa52[_0x806c('0x27')];}module[_0x806c('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 28a8bee..531dd97 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 _0x151b=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme'];(function(_0x39d7bb,_0xd40500){var _0x4dfafb=function(_0x557635){while(--_0x557635){_0x39d7bb['push'](_0x39d7bb['shift']());}};_0x4dfafb(++_0xd40500);}(_0x151b,0x1dc));var _0xb151=function(_0x2317f5,_0x2fbcfc){_0x2317f5=_0x2317f5-0x0;var _0x25d4f5=_0x151b[_0x2317f5];return _0x25d4f5;};'use strict';var util=require(_0xb151('0x0'));var _=require('lodash');var moment=require(_0xb151('0x1'));function getSeconds(_0x4540ec,_0x1e9a47){var _0x1f7d2b=moment(_0x4540ec)['milliseconds'](0x0);var _0x44eba9=moment(_0x1e9a47)['milliseconds'](0x0);return _0x1f7d2b[_0xb151('0x2')](_0x44eba9,_0xb151('0x3'));}function History(_0x3dd447){this[_0xb151('0x4')]=_0x3dd447[_0xb151('0x4')];this[_0xb151('0x5')]=_0x3dd447[_0xb151('0x5')]||undefined;this[_0xb151('0x6')]=_0x3dd447['type'];this[_0xb151('0x7')]=_0x3dd447['type']==='outbound'?_0xb151('0x8'):_0x3dd447[_0xb151('0x6')];this[_0xb151('0x9')]=_0x3dd447[_0xb151('0x9')];this[_0xb151('0xa')]=_0x3dd447[_0xb151('0xa')];this['countnoanswerretry']=_0x3dd447[_0xb151('0xb')];this[_0xb151('0xc')]=_0x3dd447['countbusyretry']+_0x3dd447[_0xb151('0xa')]+_0x3dd447[_0xb151('0xb')]+_0x3dd447[_0xb151('0xd')]+_0x3dd447[_0xb151('0xe')]+_0x3dd447[_0xb151('0xf')]+_0x3dd447[_0xb151('0x10')]+_0x3dd447[_0xb151('0x11')];this[_0xb151('0xd')]=_0x3dd447[_0xb151('0xd')];this[_0xb151('0xe')]=_0x3dd447[_0xb151('0xe')];this[_0xb151('0xf')]=_0x3dd447[_0xb151('0xf')];this[_0xb151('0x10')]=_0x3dd447[_0xb151('0x10')];this[_0xb151('0x11')]=_0x3dd447[_0xb151('0x11')];this[_0xb151('0x8')]=_0x3dd447['queue'];this[_0xb151('0x12')]=_0x3dd447[_0xb151('0x13')];this[_0xb151('0x14')]=_0x3dd447[_0xb151('0x15')];this[_0xb151('0x16')]=_0x3dd447[_0xb151('0x16')];this['responsetime']=_0x3dd447[_0xb151('0x17')];this[_0xb151('0x18')]=_0x3dd447[_0xb151('0x17')];this[_0xb151('0x19')]=getSeconds(_0x3dd447[_0xb151('0x17')],_0x3dd447['starttime']);this[_0xb151('0x1a')]=0x0;this[_0xb151('0x1b')]=0x0;this[_0xb151('0x1c')]=_0x3dd447[_0xb151('0x1c')];this['callbackuniqueid']=_0x3dd447[_0xb151('0x1d')];this['callbackat']=_0x3dd447['callbackat'];this[_0xb151('0x1e')]=_0x3dd447[_0xb151('0x1e')];this[_0xb151('0x1f')]=_0x3dd447[_0xb151('0x1f')];this[_0xb151('0x20')]=_0x3dd447['ListId'];this[_0xb151('0x21')]=_0x3dd447['UserId'];this[_0xb151('0x22')]=_0x3dd447[_0xb151('0x22')];this[_0xb151('0x23')]=_0x3dd447['CampaignId'];this[_0xb151('0x24')]=_0x3dd447[_0xb151('0x24')]||'';this['originatecalleridname']=_0x3dd447[_0xb151('0x25')]||'';}module[_0xb151('0x26')]=History; \ No newline at end of file +var _0xa251=['milliseconds','seconds','uniqueid','type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','name','calleridnum','number','responsetime','endtime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment'];(function(_0xc84b4e,_0x5dc5b1){var _0x260a86=function(_0x216f2b){while(--_0x216f2b){_0xc84b4e['push'](_0xc84b4e['shift']());}};_0x260a86(++_0x5dc5b1);}(_0xa251,0x1de));var _0x1a25=function(_0x249dfe,_0x21f85c){_0x249dfe=_0x249dfe-0x0;var _0xc7c7be=_0xa251[_0x249dfe];return _0xc7c7be;};'use strict';var util=require(_0x1a25('0x0'));var _=require(_0x1a25('0x1'));var moment=require(_0x1a25('0x2'));function getSeconds(_0x416df5,_0x54dc50){var _0x135051=moment(_0x416df5)[_0x1a25('0x3')](0x0);var _0x39a6a8=moment(_0x54dc50)[_0x1a25('0x3')](0x0);return _0x135051['diff'](_0x39a6a8,_0x1a25('0x4'));}function History(_0x3d4c8e){this[_0x1a25('0x5')]=_0x3d4c8e[_0x1a25('0x5')];this['scheduledat']=_0x3d4c8e['scheduledat']||undefined;this['type']=_0x3d4c8e[_0x1a25('0x6')];this[_0x1a25('0x7')]=_0x3d4c8e['type']===_0x1a25('0x8')?'queue':_0x3d4c8e[_0x1a25('0x6')];this[_0x1a25('0x9')]=_0x3d4c8e[_0x1a25('0x9')];this[_0x1a25('0xa')]=_0x3d4c8e[_0x1a25('0xa')];this['countnoanswerretry']=_0x3d4c8e['countnoanswerretry'];this[_0x1a25('0xb')]=_0x3d4c8e[_0x1a25('0x9')]+_0x3d4c8e[_0x1a25('0xa')]+_0x3d4c8e['countnoanswerretry']+_0x3d4c8e[_0x1a25('0xc')]+_0x3d4c8e[_0x1a25('0xd')]+_0x3d4c8e['countabandonedretry']+_0x3d4c8e[_0x1a25('0xe')]+_0x3d4c8e[_0x1a25('0xf')];this[_0x1a25('0xc')]=_0x3d4c8e[_0x1a25('0xc')];this[_0x1a25('0xd')]=_0x3d4c8e[_0x1a25('0xd')];this[_0x1a25('0x10')]=_0x3d4c8e[_0x1a25('0x10')];this[_0x1a25('0xe')]=_0x3d4c8e[_0x1a25('0xe')];this[_0x1a25('0xf')]=_0x3d4c8e[_0x1a25('0xf')];this['queue']=_0x3d4c8e[_0x1a25('0x11')];this['calleridname']=_0x3d4c8e[_0x1a25('0x12')];this[_0x1a25('0x13')]=_0x3d4c8e[_0x1a25('0x14')];this['starttime']=_0x3d4c8e['starttime'];this[_0x1a25('0x15')]=_0x3d4c8e[_0x1a25('0x15')];this[_0x1a25('0x16')]=_0x3d4c8e[_0x1a25('0x15')];this['ringtime']=getSeconds(_0x3d4c8e[_0x1a25('0x15')],_0x3d4c8e[_0x1a25('0x17')]);this[_0x1a25('0x18')]=0x0;this[_0x1a25('0x19')]=0x0;this[_0x1a25('0x1a')]=_0x3d4c8e[_0x1a25('0x1a')];this[_0x1a25('0x1b')]=_0x3d4c8e[_0x1a25('0x1b')];this[_0x1a25('0x1c')]=_0x3d4c8e[_0x1a25('0x1c')];this[_0x1a25('0x1d')]=_0x3d4c8e[_0x1a25('0x1d')];this[_0x1a25('0x1e')]=_0x3d4c8e[_0x1a25('0x1e')];this[_0x1a25('0x1f')]=_0x3d4c8e[_0x1a25('0x1f')];this['UserId']=_0x3d4c8e['UserId'];this[_0x1a25('0x20')]=_0x3d4c8e[_0x1a25('0x20')];this[_0x1a25('0x21')]=_0x3d4c8e[_0x1a25('0x21')];this[_0x1a25('0x22')]=_0x3d4c8e[_0x1a25('0x22')]||'';this[_0x1a25('0x23')]=_0x3d4c8e[_0x1a25('0x23')]||'';}module[_0x1a25('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 694950b..e25edd2 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 _0xcae6=['notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','status','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','HANGUP','membername','[syncHangupInAMD]','dialAMDActive','value','MACHINE','statedesc','Machine','AMD','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','state','countbusyretry','dialGlobalMaxRetry','createStateFinal','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','interval','content','indexOf','true','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialTimezone','checkDialMethod','[syncQueueSummary]','syncCampaigns','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','random','match','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','dialCutDigit','SIP/%s/%s%s','trim','substring','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','reason','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalTotalCalls','abandonmentRate','agentBusyFactor','busyFactor','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','[getDataPredictive]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[booked][checkContactBlack][else]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','maxNumberOriginate','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','pTalking','not_inuse','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','[abandonmentRate]','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]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','agentcomplete','syncAgentComplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','stringify','format','voice:queue:%s','ivr','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','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','inspect','error','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','talking','sendMessageOneNotActive','available','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','actions','[actions]','sequence','isNil','Action','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','catch','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact'];(function(_0x47d067,_0x48eed6){var _0x3e2163=function(_0x3d7a6d){while(--_0x3d7a6d){_0x47d067['push'](_0x47d067['shift']());}};_0x3e2163(++_0x48eed6);}(_0xcae6,0x146));var _0x6cae=function(_0x47bc58,_0x1e1998){_0x47bc58=_0x47bc58-0x0;var _0x4a0860=_0xcae6[_0x47bc58];return _0x4a0860;};'use strict';var util=require(_0x6cae('0x0'));var _=require(_0x6cae('0x1'));var BPromise=require('bluebird');var uuid=require(_0x6cae('0x2'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x6cae('0x3'));var config=require(_0x6cae('0x4'));var logger=require(_0x6cae('0x5'))(_0x6cae('0x6'));var loggerBooked=require(_0x6cae('0x5'))(_0x6cae('0x7'));var loggerPredictive=require(_0x6cae('0x5'))(_0x6cae('0x8'));var loggerPredictiveCalls=require(_0x6cae('0x5'))(_0x6cae('0x9'));var loggerSyncQueueSummary=require(_0x6cae('0x5'))(_0x6cae('0xa'));var ami=require(_0x6cae('0xb'));config[_0x6cae('0xc')]=_[_0x6cae('0xd')](config[_0x6cae('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x6cae('0xe'))(new Redis(config[_0x6cae('0xc')]));var cmHopper=require(_0x6cae('0xf'));var cmHopperHistory=require(_0x6cae('0x10'));var cmHopperBlack=require(_0x6cae('0x11'));var voiceQueueRt=require(_0x6cae('0x12'));var Action=require(_0x6cae('0x13'));var History=require(_0x6cae('0x14'));var Final=require(_0x6cae('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x6cae('0x16'));var Hangup=require(_0x6cae('0x17'));var ipAgi=process[_0x6cae('0x18')][_0x6cae('0x19')]||_0x6cae('0x1a');var strategy={'rrmemory':_0x6cae('0x1b'),'roundrobin':_0x6cae('0x1c')};var Sequence=function(){};Sequence[_0x6cae('0x1d')]['enqueue']=function(_0x262354){this['tail']=this[_0x6cae('0x1e')]?this[_0x6cae('0x1e')][_0x6cae('0x1f')](_0x262354):_0x262354();};function Dialer(_0x3968f9,_0x52a4f3){this['sequence']=new Sequence();this[_0x6cae('0x20')]=_0x52a4f3;this['voiceQueues']=_0x3968f9[_0x6cae('0x21')];this[_0x6cae('0x22')]=_0x3968f9[_0x6cae('0x22')];this[_0x6cae('0x23')]=_0x3968f9[_0x6cae('0x23')];this[_0x6cae('0x24')]=_0x3968f9[_0x6cae('0x24')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this['channels']={};this['actions']={};this[_0x6cae('0x25')]={};this[_0x6cae('0x26')]={};this[_0x6cae('0x27')]={};this[_0x6cae('0x28')]={};this[_0x6cae('0x29')]={};this[_0x6cae('0x2a')]={};this[_0x6cae('0x2b')]={};this[_0x6cae('0x2c')]={};ami['on'](_0x6cae('0x2d'),this[_0x6cae('0x2e')][_0x6cae('0x2f')](this));ami['on'](_0x6cae('0x30'),this['syncQueueCallerAbandon'][_0x6cae('0x2f')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0x6cae('0x31'),this[_0x6cae('0x32')][_0x6cae('0x2f')](this));ami['on']('custom:queuesummary',this[_0x6cae('0xa')][_0x6cae('0x2f')](this));ami['on'](_0x6cae('0x33'),this[_0x6cae('0x34')][_0x6cae('0x2f')](this));ami['on']('newexten',this[_0x6cae('0x35')]['bind'](this));ami['on'](_0x6cae('0x36'),this[_0x6cae('0x37')]['bind'](this));ami['on'](_0x6cae('0x38'),this[_0x6cae('0x39')]['bind'](this));ami['on'](_0x6cae('0x3a'),this[_0x6cae('0x3b')][_0x6cae('0x2f')](this));this[_0x6cae('0x3c')]();this['loopClearZombieChannels']();}function isNotNull(_0x26cefe){return _0x26cefe!==null&&!_[_0x6cae('0x3d')](_0x26cefe);}function checkIsLoggedIn(_0x2cbbf0,_0x21a8e1){return function(){if(_0x21a8e1<=0x0){_0x2cbbf0[_0x6cae('0x3e')]='AGENTS_NOT_LOGGED';throw _0x2cbbf0[_0x6cae('0x3f')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x18d077){return _0x18d077;}function checkIsActive(_0x5916d5,_0x1c570c){return function(){if(!isActive(_0x1c570c)){_0x5916d5['message']=_0x6cae('0x40');throw _0x5916d5[_0x6cae('0x3f')]+_0x6cae('0x41');}};}function checkInterval(_0x5168d3){return function(){if(!isNotNull(_0x5168d3[_0x6cae('0x42')])){_0x5168d3[_0x6cae('0x3e')]=_0x6cae('0x43');throw _0x5168d3[_0x6cae('0x3f')]+_0x6cae('0x44');}if(!isNotNull(_0x5168d3[_0x6cae('0x42')]['Intervals'])){_0x5168d3[_0x6cae('0x3e')]=_0x6cae('0x43');throw _0x5168d3[_0x6cae('0x3f')]+_0x6cae('0x44');}if(!isNotNull(_[_0x6cae('0x45')](_0x5168d3['Interval']['Intervals']))){_0x5168d3['message']=_0x6cae('0x43');throw _0x5168d3['name']+_0x6cae('0x44');}};}function msgResponse(_0x3cd50d,_0x2e7da1,_0x3a7d6a){return{'action':_0x3cd50d,'response':_0x2e7da1,'message':_0x3a7d6a,'stack':_0x3a7d6a};}function myreject(_0x4f0ef7){return function(_0x239235){return _0x4f0ef7(msgResponse(_0x6cae('0x46'),_0x6cae('0x47'),JSON['stringify'](_0x239235)));};}function getSeconds(_0x233ddc,_0x2e9a56){var _0x2190ca=moment(_0x233ddc)[_0x6cae('0x48')](0x0);var _0x52eebf=moment(_0x2e9a56)['milliseconds'](0x0);return _0x2190ca[_0x6cae('0x49')](_0x52eebf,_0x6cae('0x4a'));}function emit(_0x5c1724,_0xd97848,_0x168cc7){io['to'](_0x5c1724)[_0x6cae('0x4b')](_0xd97848,_0x168cc7);}function emitVoiceQueueSummary(_0x1f5c1f){if(_0x1f5c1f[_0x6cae('0x4c')]===_0x6cae('0x4d')){var _0x12b858={'id':_0x1f5c1f['id'],'name':_0x1f5c1f[_0x6cae('0x3f')],'strategy':_0x1f5c1f[_0x6cae('0x4e')],'answered':_0x1f5c1f[_0x6cae('0x4f')],'available':_0x1f5c1f['available'],'loggedIn':_0x1f5c1f[_0x6cae('0x50')],'pTalking':_0x1f5c1f['pTalking'],'sumBillable':_0x1f5c1f[_0x6cae('0x51')],'sumDuration':_0x1f5c1f[_0x6cae('0x52')],'sumHoldTime':_0x1f5c1f[_0x6cae('0x53')]||0x0,'talking':_0x1f5c1f['talking'],'total':_0x1f5c1f[_0x6cae('0x54')],'type':_0x1f5c1f[_0x6cae('0x4c')],'unmanaged':_0x1f5c1f[_0x6cae('0x55')],'abandoned':_0x1f5c1f['abandoned'],'waiting':_0x1f5c1f[_0x6cae('0x56')],'loggedInDb':_0x1f5c1f[_0x6cae('0x57')],'dialActive':_0x1f5c1f[_0x6cae('0x58')],'dialMethod':_0x1f5c1f[_0x6cae('0x59')],'dialOriginateCallerIdName':_0x1f5c1f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x1f5c1f[_0x6cae('0x5a')],'dialOriginateTimeout':_0x1f5c1f[_0x6cae('0x5b')],'dialPrefix':_0x1f5c1f[_0x6cae('0x5c')],'outboundAnswerAgiCallsDay':_0x1f5c1f[_0x6cae('0x5d')],'outboundAnswerCallsDay':_0x1f5c1f[_0x6cae('0x5e')],'outboundBlacklistCallsDay':_0x1f5c1f[_0x6cae('0x5f')],'outboundBusyCallsDay':_0x1f5c1f[_0x6cae('0x60')],'outboundCongestionCallsDay':_0x1f5c1f[_0x6cae('0x61')],'outboundDropCallsDayACS':_0x1f5c1f[_0x6cae('0x62')],'outboundDropCallsDayCallersExit':_0x1f5c1f[_0x6cae('0x63')],'outboundDropCallsDayTimeout':_0x1f5c1f['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x1f5c1f[_0x6cae('0x64')],'outboundNoSuchCallsDay':_0x1f5c1f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1f5c1f[_0x6cae('0x65')],'outboundReCallsDay':_0x1f5c1f[_0x6cae('0x66')],'outboundRejectCallsDay':_0x1f5c1f[_0x6cae('0x67')],'outboundUnknownCallsDay':_0x1f5c1f[_0x6cae('0x68')],'predictiveIntervalAnsweredCalls':_0x1f5c1f[_0x6cae('0x69')],'predictiveIntervalAvgHoldtime':_0x1f5c1f['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1f5c1f[_0x6cae('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x1f5c1f[_0x6cae('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x1f5c1f[_0x6cae('0x6c')],'predictiveIntervalErlangCalls':_0x1f5c1f['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1f5c1f[_0x6cae('0x6d')],'predictiveIntervalHitRate':_0x1f5c1f[_0x6cae('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x1f5c1f[_0x6cae('0x6f')],'predictiveIntervalPauses':_0x1f5c1f[_0x6cae('0x70')],'predictiveIntervalAvailable':_0x1f5c1f[_0x6cae('0x71')],'predictiveIntervalTotalCalls':_0x1f5c1f['predictiveIntervalTotalCalls'],'message':_0x1f5c1f['message'],'originated':_0x1f5c1f['originated'],'erlangCalls':_0x1f5c1f['erlangCalls'],'erlangCallToSecond':_0x1f5c1f[_0x6cae('0x72')],'erlangAbandonmentRate':_0x1f5c1f[_0x6cae('0x73')],'erlangBusyFactor':_0x1f5c1f[_0x6cae('0x74')],'startPredictive':_0x1f5c1f[_0x6cae('0x28')],'startProgressive':_0x1f5c1f[_0x6cae('0x29')]};if(_0x1f5c1f[_0x6cae('0x75')]){_0x12b858['Trunk']={'id':_0x1f5c1f[_0x6cae('0x75')]['id'],'name':_0x1f5c1f['Trunk'][_0x6cae('0x3f')],'active':_0x1f5c1f[_0x6cae('0x75')][_0x6cae('0x76')],'callerid':_0x1f5c1f[_0x6cae('0x75')][_0x6cae('0x77')]};}if(_0x1f5c1f[_0x6cae('0x42')]){_0x12b858[_0x6cae('0x42')]={'id':_0x1f5c1f[_0x6cae('0x42')]['id'],'name':_0x1f5c1f['Interval'][_0x6cae('0x3f')]};}var _0x16409e=md5(JSON[_0x6cae('0x78')](_0x12b858));if(_0x1f5c1f['md5']!==_0x16409e){_0x1f5c1f['md5']=_0x16409e;emit(util[_0x6cae('0x79')](_0x6cae('0x7a'),_0x12b858[_0x6cae('0x3f')]),'voice_queue:save',_0x12b858);}}}function emitCampaignSummary(_0x3a7e7f){if(_0x3a7e7f[_0x6cae('0x4c')]===_0x6cae('0x7b')){emit(util[_0x6cae('0x79')](_0x6cae('0x7c'),_0x3a7e7f['name']),_0x6cae('0x7d'),_0x3a7e7f);}}function checkGetDataPredictive(_0x18dc1d){if(isNotNull(_0x18dc1d)&&!_[_0x6cae('0x45')](_0x18dc1d)){loggerPredictive[_0x6cae('0x7e')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x6cae('0x7e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x18dc1d['predictiveIntervalTotalCalls']);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x7f'),_0x18dc1d['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x80'),_0x18dc1d[_0x6cae('0x6c')]);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x81'),_0x18dc1d['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x6cae('0x7e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x18dc1d['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x6cae('0x82'),_0x18dc1d[_0x6cae('0x6a')]);loggerPredictive['info'](_0x6cae('0x83'));if(_0x18dc1d['predictiveIntervalTotalCalls']>0x0){if(!_[_0x6cae('0x3d')](_0x18dc1d[_0x6cae('0x6a')])&&_0x18dc1d[_0x6cae('0x6a')]>0x0){return!![];}loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x84'));if(!_[_0x6cae('0x3d')](_0x18dc1d[_0x6cae('0x85')])&&_0x18dc1d[_0x6cae('0x85')]>0x0){return!![];}loggerPredictive[_0x6cae('0x7e')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x86'));}}else{loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x87'));}return![];}function mergeDataErlangB(_0xe666aa){return function(_0x1127d1){loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x88'));loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x89'),_0x1127d1[_0x6cae('0x8a')]);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x8b'),_0x1127d1[_0x6cae('0x72')]);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x8c'),_0x1127d1[_0x6cae('0x73')]);loggerPredictive['info'](_0x6cae('0x8d'),_0x1127d1[_0x6cae('0x74')]);loggerPredictive[_0x6cae('0x7e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1127d1['erlangAbandonmentRate']);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x83'));_[_0x6cae('0x8e')](_0xe666aa,_0x1127d1);};}function getDiff(_0x7cedbc){var _0x3bcb29=moment()['milliseconds'](0x0);var _0xef1a1e=moment(_0x7cedbc)[_0x6cae('0x48')](0x0);return _0x3bcb29[_0x6cae('0x49')](_0xef1a1e,_0x6cae('0x4a'));}function ifInterval(_0x1b9e58,_0x3d2b19){if(_[_0x6cae('0x3d')](_0x3d2b19)){return![];}return getDiff(_0x3d2b19)<_0x1b9e58*0x3c;}function freeVariablesPredictive(_0x387077){if(isNotNull(_0x387077)){if(!_['isUndefined'](_0x387077[_0x6cae('0x29')])){_0x387077['startProgressive']=undefined;loggerPredictive[_0x6cae('0x7e')](_0x387077[_0x6cae('0x3f')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x387077[_0x6cae('0x28')])){_0x387077[_0x6cae('0x28')]=undefined;loggerPredictive[_0x6cae('0x7e')](_0x387077[_0x6cae('0x3f')],_0x6cae('0x8f'));}if(!_['isUndefined'](_0x387077[_0x6cae('0x90')])){clearInterval(_0x387077[_0x6cae('0x90')]);_0x387077[_0x6cae('0x90')]=undefined;loggerPredictive[_0x6cae('0x7e')](_0x387077['name'],_0x6cae('0x91'));}}}function erlangb(_0x36b41d,_0x2147d9){if(_0x2147d9===0x0){return 0x0;}var _0x4e9460=0x1;for(var _0x9d70e=0x1;_0x9d70e<=_0x2147d9;_0x9d70e+=0x1){_0x4e9460=0x1+_0x4e9460*_0x9d70e/_0x36b41d;}return 0x1/_0x4e9460;}function isVoiceQueueOutbound(_0x20c234){return _0x20c234==='outbound';}function isNotPreview(_0x2c47b3){return _0x2c47b3!=='preview';}function isCampaignIvr(_0x175545){return _0x175545==='ivr';}function getCallerId(_0x408d87,_0x27bfbc,_0x545a2e){if(!_[_0x6cae('0x3d')](_0x545a2e)&&typeof _0x545a2e===_0x6cae('0x92')&&!_[_0x6cae('0x45')](_0x545a2e)){if(!_[_0x6cae('0x3d')](_0x27bfbc)&&typeof _0x27bfbc===_0x6cae('0x92')&&!_[_0x6cae('0x45')](_0x27bfbc)){return util[_0x6cae('0x79')](_0x6cae('0x93'),_0x27bfbc,_0x545a2e);}return util[_0x6cae('0x79')]('\x22%s\x22\x20<%s>',_0x545a2e,_0x545a2e);}if(!_[_0x6cae('0x3d')](_0x408d87)&&typeof _0x408d87===_0x6cae('0x92')&&!_[_0x6cae('0x45')](_0x408d87)){return _0x408d87;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x36b188,_0x24035d){return function(_0x569925){freeVariablesPredictive(_0x24035d);emitVoiceQueueSummary(_0x24035d);emitCampaignSummary(_0x24035d);loggerSyncQueueSummary['error'](_0x36b188,util[_0x6cae('0x94')](_0x569925,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5246ad,_0x478596){return function(_0x2338a0){loggerPredictive[_0x6cae('0x95')](_0x478596[_0x6cae('0x3f')],_0x5246ad);loggerPredictive[_0x6cae('0x95')](_0x2338a0[_0x6cae('0x96')]);freeVariablesPredictive(_0x478596);};}function loggerCatch(_0x4a0d9f){return function(_0x561046){logger[_0x6cae('0x95')](_0x4a0d9f,util[_0x6cae('0x94')](_0x561046,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x519c6a){return _0x519c6a&&!_['isUndefined'](_0x519c6a)&&_0x519c6a[_0x6cae('0x97')]>0x0;}function decremetOriginate(_0x2e1200){if(!_[_0x6cae('0x3d')](_0x2e1200)&&_0x2e1200!==null){if(typeof _0x2e1200[_0x6cae('0x98')]!==_0x6cae('0x99')){if(_0x2e1200[_0x6cae('0x98')]>0x0){_0x2e1200['originated']-=0x1;}else{logger[_0x6cae('0x95')](_0x6cae('0x9a'));}}}else{logger[_0x6cae('0x95')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x3e4e5b,_0x36ed10,_0xca926f){if(_0x36ed10>_0xca926f){for(var _0x1783fd=0x0;_0x1783fd<_0x36ed10-_0xca926f;_0x1783fd+=0x1){decremetOriginate(_0x3e4e5b);}}}function loggerGetContactDialer(_0x20774e,_0x2367e4,_0x1393bb){return function(_0x1deda9){checkContactLowerLimitOriginate(_0x2367e4,_0x1393bb,0x0);logger[_0x6cae('0x95')](_0x20774e,util[_0x6cae('0x94')](_0x1deda9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1b1c70){return function(_0x278be9){if(isNotNull(_0x278be9)&&isNotNull(_0x278be9[0x0])){if(_0x278be9[0x0][_0x6cae('0x9b')]>0x0){_0x1b1c70[_0x6cae('0x3e')]='RESCHEDULED_CONTACTS';logger[_0x6cae('0x7e')](_0x6cae('0x9c')+_0x1b1c70[_0x6cae('0x3f')],_0x278be9[0x0]['contactsRescheduled'],_0x6cae('0x9d'));}else{_0x1b1c70[_0x6cae('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x6cae('0x7e')](_0x6cae('0x9e')+_0x1b1c70['name']);}}};}function notSendMessagesQueue(_0x16f364){if(_0x16f364['sendMessageOneNotActive']){freeVariablesPredictive(_0x16f364);if(_0x16f364[_0x6cae('0x98')]===0x0&&_0x16f364[_0x6cae('0x9f')]===0x0&&_0x16f364[_0x6cae('0x56')]===0x0&&(_0x16f364['pTalking']||0x0)===0x0){_0x16f364[_0x6cae('0xa0')]=![];_0x16f364[_0x6cae('0xa1')]=0x0;_0x16f364[_0x6cae('0x3e')]=_0x6cae('0x40');loggerSyncQueueSummary[_0x6cae('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x16f364[_0x6cae('0x3f')],'is\x20not\x20active');}else{_0x16f364[_0x6cae('0x3e')]=_0x6cae('0xa2');loggerSyncQueueSummary[_0x6cae('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x16f364['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x16f364);}}function notSendMessagesCampaign(_0x402f37){if(_0x402f37[_0x6cae('0xa0')]){if(_0x402f37[_0x6cae('0x98')]===0x0){_0x402f37[_0x6cae('0xa0')]=![];_0x402f37[_0x6cae('0x3e')]=_0x6cae('0x40');loggerSyncQueueSummary[_0x6cae('0x95')](_0x6cae('0xa3'),_0x402f37['name'],_0x6cae('0xa4'));}else{_0x402f37[_0x6cae('0x3e')]=_0x6cae('0xa2');loggerSyncQueueSummary[_0x6cae('0x95')](_0x6cae('0xa3'),_0x402f37[_0x6cae('0x3f')],'is\x20disactive');}emitCampaignSummary(_0x402f37);}}function createObjHistory(_0x3c75f0,_0x366e32,_0x3f8bd2,_0x4c9b72,_0x4b9bfd){_0x3c75f0[_0x6cae('0x3e')]=_0x3f8bd2;var _0x11e5e3=new Action(_0x3c75f0,_0x366e32);var _0x3d7879=new History(_0x11e5e3);_0x3d7879['state']=_0x4c9b72;_0x3d7879['statedesc']=_0x4b9bfd;_0x3d7879[_0x6cae('0xa5')]=_0x11e5e3[_0x6cae('0xa6')];return _0x3d7879;}Dialer[_0x6cae('0x1d')][_0x6cae('0xa7')]=function(){var _0x1fd942=this;setInterval(function(){_0x1fd942[_0x6cae('0xa8')](_0x1fd942[_0x6cae('0x26')],_0x6cae('0xa9'));_0x1fd942['clearZombieChannels'](_0x1fd942[_0x6cae('0xaa')],_0x6cae('0xab'));},0x32c8);};Dialer[_0x6cae('0x1d')]['clearZombieChannels']=function(_0x3a8838,_0x1aeace){var _0x27e709=this;for(var _0x1b28a8 in _0x3a8838){if(typeof _0x3a8838[_0x1b28a8]!=='undefined'){this[_0x6cae('0xac')]['enqueue'](function(){if(!_[_0x6cae('0xad')](_0x3a8838[_0x1b28a8])){return ami[_0x6cae('0xae')]({'action':'status','channel':_0x3a8838[_0x1b28a8][_0x6cae('0xaf')]})['catch'](function(_0x2fa3b7){if(_0x2fa3b7[_0x6cae('0x3e')]===_0x6cae('0xb0')){setTimeout(function(){if(_0x3a8838[_0x1b28a8]&&_0x3a8838[_0x1b28a8]['type']!==_0x6cae('0x7b')){_0x27e709[_0x6cae('0xb1')](_0x27e709[_0x6cae('0x21')][_0x3a8838[_0x1b28a8][_0x6cae('0xb2')]]);logger[_0x6cae('0x95')](_0x6cae('0xb3'),_0x1aeace,_0x1b28a8,_0x3a8838[_0x1b28a8]['queue']);delete _0x3a8838[_0x1b28a8];}if(_0x3a8838[_0x1b28a8]&&_0x3a8838[_0x1b28a8]['type']===_0x6cae('0x7b')){_0x27e709[_0x6cae('0xb1')](_0x27e709['campaigns'][_0x3a8838[_0x1b28a8][_0x6cae('0xb2')]]);logger['error'](_0x6cae('0xb4'),_0x1aeace,_0x1b28a8,_0x3a8838[_0x1b28a8]['queue']);delete _0x3a8838[_0x1b28a8];}},0x2328);}});}});}}};Dialer[_0x6cae('0x1d')][_0x6cae('0xb5')]=function(_0x68f9aa){return BPromise[_0x6cae('0xb6')]()[_0x6cae('0xb7')](cmHopper[_0x6cae('0xb5')](_0x68f9aa))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x6cae('0x1d')][_0x6cae('0xb8')]=function(_0x2b4100){return BPromise['resolve']()[_0x6cae('0xb7')](cmHopperBlack[_0x6cae('0xb8')](_0x2b4100))[_0x6cae('0xb9')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x6cae('0x1d')][_0x6cae('0xba')]=function(_0xaea9fd){return BPromise[_0x6cae('0xb6')]()['then'](cmHopperBlack[_0x6cae('0xba')](_0xaea9fd))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xbb')));};Dialer['prototype'][_0x6cae('0xbc')]=function(_0x28a973){return BPromise[_0x6cae('0xb6')]()['then'](cmHopperHistory['avgHandleTime'](_0x28a973))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xbd')));};Dialer[_0x6cae('0x1d')][_0x6cae('0xbe')]=function(_0xda3009){return BPromise[_0x6cae('0xb6')]()[_0x6cae('0xb7')](cmHopper[_0x6cae('0xbe')](_0xda3009))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xbf')));};Dialer[_0x6cae('0x1d')][_0x6cae('0xc0')]=function(_0x1a4fe1,_0x2119fd,_0x56426a){return BPromise['resolve']()[_0x6cae('0xb7')](cmHopper[_0x6cae('0xc0')](_0x1a4fe1,_0x2119fd,_0x56426a))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xc1')));};Dialer[_0x6cae('0x1d')][_0x6cae('0xc2')]=function(_0xc7d01d,_0x196d5e,_0x36153b,_0x2786ea){return BPromise[_0x6cae('0xb6')]()[_0x6cae('0xb7')](cmHopper[_0x6cae('0xc2')](_0xc7d01d,_0x196d5e,_0x36153b,_0x2786ea))['catch'](loggerCatch(_0x6cae('0xc3')));};Dialer['prototype']['getContactDialerIvr']=function(_0x327aa1,_0x16635e,_0x547c77){return BPromise['resolve']()[_0x6cae('0xb7')](cmHopper[_0x6cae('0xc4')](_0x327aa1,_0x16635e,_0x547c77))['catch'](loggerCatch(_0x6cae('0xc3')));};Dialer[_0x6cae('0x1d')][_0x6cae('0xc5')]=function(_0x32b6f2){return BPromise[_0x6cae('0xb6')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x32b6f2))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xc6')));};Dialer[_0x6cae('0x1d')][_0x6cae('0xc7')]=function(_0x4065ad){return BPromise[_0x6cae('0xb6')]()[_0x6cae('0xb7')](cmHopper[_0x6cae('0xc7')](_0x4065ad))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xc8')));};Dialer[_0x6cae('0x1d')][_0x6cae('0xc9')]=function(_0x5413de){return BPromise['resolve']()[_0x6cae('0xb7')](cmHopperHistory[_0x6cae('0xc9')](_0x5413de))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xca')));};Dialer['prototype'][_0x6cae('0xb1')]=function(_0x6448d0){if(!_[_0x6cae('0x3d')](_0x6448d0)&&_0x6448d0!==null){if(typeof _0x6448d0[_0x6cae('0x98')]!==_0x6cae('0x99')){if(_0x6448d0[_0x6cae('0x98')]>0x0){_0x6448d0['originated']-=0x1;}else{logger[_0x6cae('0x95')](_0x6cae('0xcb'));}}}else{logger[_0x6cae('0x95')](_0x6cae('0xcc'));}};Dialer['prototype'][_0x6cae('0xcd')]=function(_0x49de16,_0x2b8aea){var _0x48d6f7=this;return function(_0x27e313){_0x48d6f7[_0x6cae('0xb1')](_0x2b8aea);logger[_0x6cae('0x95')](_0x49de16,util[_0x6cae('0x94')](_0x27e313,{'showHidden':![],'depth':null}));};};Dialer[_0x6cae('0x1d')][_0x6cae('0xce')]=function(_0x3ed9b9,_0x32acda,_0x50b281){var _0x50a8c9={'state':0x19,'statedesc':_0x6cae('0xcf')};this[_0x6cae('0xb1')](_0x32acda);this[_0x6cae('0xd0')](_['merge'](_0x50a8c9,_[_0x6cae('0xd1')](_0x50b281,[_0x6cae('0xd2'),_0x6cae('0xd3'),_0x6cae('0xd4'),_0x6cae('0xd5'),'CampaignId'])),_0x6cae('0xd6'),_0x6cae('0xd7'));logger[_0x6cae('0x95')](_0x3ed9b9);};Dialer[_0x6cae('0x1d')][_0x6cae('0xd8')]=function(_0x739f6a){return _0x739f6a===_0x6cae('0xd9');};Dialer[_0x6cae('0x1d')][_0x6cae('0xda')]=function(_0x3a67a3){return!_['isUndefined'](_0x3a67a3)&&_0x3a67a3&&!_['isUndefined'](_0x3a67a3[_0x6cae('0x3f')])&&!_[_0x6cae('0x3d')](_0x3a67a3[_0x6cae('0x76')])&&_0x3a67a3[_0x6cae('0x76')]&&(this[_0x6cae('0x24')][util[_0x6cae('0x79')]('SIP/%s',_0x3a67a3['name'])][_0x6cae('0xdb')]===_0x6cae('0xdc')||this[_0x6cae('0x24')][util[_0x6cae('0x79')]('SIP/%s',_0x3a67a3[_0x6cae('0x3f')])][_0x6cae('0xdb')]===_0x6cae('0xdd'));};Dialer[_0x6cae('0x1d')][_0x6cae('0xd0')]=function(_0x5c3bb2,_0x312bb8,_0x329641){this[_0x6cae('0xc9')](_0x5c3bb2)[_0x6cae('0xb9')](loggerCatch(_0x312bb8));this['moveContactManagedDialer'](_0x5c3bb2)[_0x6cae('0xb9')](loggerCatch(_0x329641));};Dialer[_0x6cae('0x1d')][_0x6cae('0x37')]=function(_0x298ff0){var _0x58a826=this[_0x6cae('0x26')][_0x298ff0[_0x6cae('0xde')]];var _0x11de65;if(!_[_0x6cae('0xad')](_0x298ff0)&&!_[_0x6cae('0xad')](_0x298ff0[_0x6cae('0xdf')])&&!_[_0x6cae('0xad')](_0x298ff0[_0x6cae('0xdf')][_0x6cae('0xe0')])&&_0x298ff0[_0x6cae('0xe1')]===_0x6cae('0xe2')&&_0x58a826){if(_0x58a826[_0x6cae('0x4c')]!==_0x6cae('0x7b')&&this['voiceQueues'][_0x58a826['queue']]['dialAMDActive']&&_0x298ff0['value']===_0x6cae('0xe3')){delete this[_0x6cae('0x26')][_0x298ff0[_0x6cae('0xde')]];this[_0x6cae('0xb1')](this[_0x6cae('0x21')][_0x58a826['queue']]);this[_0x6cae('0x21')][_0x58a826[_0x6cae('0xb2')]][_0x6cae('0x5e')]+=0x1;this['voiceQueues'][_0x58a826[_0x6cae('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;_0x11de65=new Hangup(_0x58a826,_0x298ff0);_0x11de65['state']=0x12;_0x11de65['statedesc']='HangupInAMD';_0x11de65[_0x6cae('0xe4')]='AMD';this[_0x6cae('0xd0')](_0x11de65,'[syncHangupInAMD][createHistory]',_0x6cae('0xe5'));}if(_0x58a826['type']!==_0x6cae('0x7b')&&this[_0x6cae('0x21')][_0x58a826[_0x6cae('0xb2')]][_0x6cae('0xe6')]&&_0x298ff0[_0x6cae('0xe7')]===_0x6cae('0xe8')){var _0x12bf97=this;return new BPromise(function(_0x5e2879,_0xa3bbca){delete _0x12bf97['uniqueId'][_0x298ff0[_0x6cae('0xde')]];_0x12bf97[_0x6cae('0xb1')](_0x12bf97[_0x6cae('0x21')][_0x58a826[_0x6cae('0xb2')]]);_0x12bf97[_0x6cae('0x21')][_0x58a826[_0x6cae('0xb2')]]['outboundAnswerCallsDay']+=0x1;_0x12bf97[_0x6cae('0x21')][_0x58a826[_0x6cae('0xb2')]][_0x6cae('0x5d')]+=0x1;var _0x901d3=_0x12bf97[_0x6cae('0x21')][_0x58a826[_0x6cae('0xb2')]];var _0x1814ba=new Hangup(_0x58a826,_0x298ff0);_0x1814ba['state']=0x13;_0x1814ba[_0x6cae('0xe9')]=_0x6cae('0xea');_0x1814ba[_0x6cae('0xe4')]=_0x6cae('0xeb');_0x1814ba['countmachineretry']+=0x1;_0x1814ba[_0x6cae('0xec')]+=0x1;_0x1814ba[_0x6cae('0xed')]=!![];_0x12bf97['createHistory'](_0x1814ba)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xee')));if(_0x1814ba['countbusyretry']+_0x1814ba[_0x6cae('0xef')]+_0x1814ba[_0x6cae('0xf0')]+_0x1814ba[_0x6cae('0xf1')]+_0x1814ba[_0x6cae('0xf2')]+_0x1814ba[_0x6cae('0xf3')]+_0x1814ba[_0x6cae('0xf4')]+_0x1814ba[_0x6cae('0xf5')]>=_0x901d3['dialGlobalMaxRetry']){_0x12bf97[_0x6cae('0xf6')](_0x1814ba,_0x5e2879,_0xa3bbca,_0x6cae('0xf7'));}else{if(_0x1814ba['countmachineretry']>=_0x901d3[_0x6cae('0xf8')]){_0x12bf97['createStateFinal'](_0x1814ba,_0x5e2879,_0xa3bbca,_0x6cae('0xf9'));}else{_0x12bf97[_0x6cae('0xbe')]({'active':![],'countmachineretry':_0x1814ba[_0x6cae('0xf4')],'scheduledat':moment()[_0x6cae('0xfa')](_0x901d3[_0x6cae('0xfb')],'minutes')[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x1814ba['ContactId'],'ListId':_0x1814ba['ListId'],'VoiceQueueId':_0x1814ba[_0x6cae('0xd5')]||undefined,'CampaignId':_0x1814ba[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xfe')));_0x5e2879({'reschedule':0x1});}}});}if(_0x58a826[_0x6cae('0x4c')]===_0x6cae('0x7b')&&this['campaigns'][_0x58a826[_0x6cae('0xb2')]][_0x6cae('0xe6')]&&_0x298ff0[_0x6cae('0xe7')]===_0x6cae('0xe3')){delete this[_0x6cae('0x26')][_0x298ff0[_0x6cae('0xde')]];this[_0x6cae('0xb1')](this[_0x6cae('0x22')][_0x58a826[_0x6cae('0xb2')]]);_0x11de65=new Hangup(_0x58a826,_0x298ff0);_0x11de65['state']=0x12;_0x11de65[_0x6cae('0xe9')]='HangupInAMD';_0x11de65['membername']=_0x6cae('0xeb');this[_0x6cae('0xd0')](_0x11de65,'[syncHangupInAMDIvr][createHistory]',_0x6cae('0xff'));}if(_0x58a826[_0x6cae('0x4c')]===_0x6cae('0x7b')&&this['campaigns'][_0x58a826[_0x6cae('0xb2')]]['dialAMDActive']&&_0x298ff0[_0x6cae('0xe7')]===_0x6cae('0xe8')){var _0x12bf97=this;return new BPromise(function(_0x4ba228,_0x1fdcbc){delete _0x12bf97['uniqueId'][_0x298ff0[_0x6cae('0xde')]];_0x12bf97[_0x6cae('0xb1')](_0x12bf97[_0x6cae('0x22')][_0x58a826['queue']]);_0x12bf97[_0x6cae('0x22')][_0x58a826[_0x6cae('0xb2')]][_0x6cae('0x5e')]+=0x1;_0x12bf97[_0x6cae('0x22')][_0x58a826['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x5e46ff=_0x12bf97[_0x6cae('0x22')][_0x58a826['queue']];var _0x5553f6=new Hangup(_0x58a826,_0x298ff0);_0x5553f6[_0x6cae('0x100')]=0x13;_0x5553f6[_0x6cae('0xe9')]=_0x6cae('0xea');_0x5553f6[_0x6cae('0xe4')]=_0x6cae('0xeb');_0x5553f6['countmachineretry']+=0x1;_0x5553f6[_0x6cae('0xec')]+=0x1;_0x5553f6['amd']=!![];_0x12bf97['createHistory'](_0x5553f6)['catch'](loggerCatch(_0x6cae('0xee')));if(_0x5553f6[_0x6cae('0x101')]+_0x5553f6['countcongestionretry']+_0x5553f6[_0x6cae('0xf0')]+_0x5553f6['countnosuchnumberretry']+_0x5553f6['countdropretry']+_0x5553f6[_0x6cae('0xf3')]+_0x5553f6['countmachineretry']+_0x5553f6[_0x6cae('0xf5')]>=_0x5e46ff[_0x6cae('0x102')]){_0x12bf97[_0x6cae('0xf6')](_0x5553f6,_0x4ba228,_0x1fdcbc,_0x6cae('0xf7'));}else{if(_0x5553f6[_0x6cae('0xf4')]>=_0x5e46ff['dialMachineMaxRetry']){_0x12bf97[_0x6cae('0x103')](_0x5553f6,_0x4ba228,_0x1fdcbc,'reason\x2019\x20machine....');}else{_0x12bf97[_0x6cae('0xbe')]({'active':![],'countmachineretry':_0x5553f6[_0x6cae('0xf4')],'scheduledat':moment()[_0x6cae('0xfa')](_0x5e46ff['dialMachineRetryFrequency'],_0x6cae('0x104'))[_0x6cae('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5553f6[_0x6cae('0xd2')],'ListId':_0x5553f6['ListId'],'VoiceQueueId':_0x5553f6[_0x6cae('0xd5')]||undefined,'CampaignId':_0x5553f6[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xfe')));_0x4ba228({'reschedule':0x1});}}});}}};Dialer[_0x6cae('0x1d')][_0x6cae('0x34')]=function(_0x3e5472){var _0x4175a1=this[_0x6cae('0x26')][_0x3e5472[_0x6cae('0xde')]];var _0x5603ba=this;var _0xd6b15b;if(_0x4175a1&&_0x4175a1['type']===_0x6cae('0x7b')){delete this['uniqueId'][_0x3e5472[_0x6cae('0xde')]];this[_0x6cae('0xb1')](this[_0x6cae('0x22')][_0x4175a1['queue']]);this['campaigns'][_0x4175a1[_0x6cae('0xb2')]][_0x6cae('0x105')]+=0x1;_0xd6b15b=new Hangup(_0x4175a1,_0x3e5472);this['createHistory'](_0xd6b15b)['catch'](loggerCatch(_0x6cae('0x106')));this[_0x6cae('0xc7')](_0xd6b15b)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x107')));}if(_0x4175a1&&_0x4175a1[_0x6cae('0x4c')]!==_0x6cae('0x7b')&&isNotNull(this[_0x6cae('0x21')][_0x4175a1['queue']][_0x6cae('0x108')])){delete this[_0x6cae('0x26')][_0x3e5472[_0x6cae('0xde')]];this[_0x6cae('0xb1')](this[_0x6cae('0x21')][_0x4175a1[_0x6cae('0xb2')]]);this[_0x6cae('0x21')][_0x4175a1[_0x6cae('0xb2')]]['outboundAnswerCallsDay']+=0x1;this[_0x6cae('0x21')][_0x4175a1[_0x6cae('0xb2')]][_0x6cae('0x5d')]+=0x1;_0xd6b15b=new Hangup(_0x4175a1,_0x3e5472);_0xd6b15b[_0x6cae('0x100')]=0x10;_0xd6b15b[_0x6cae('0xe9')]=_0x6cae('0x109');_0xd6b15b['membername']=_0x6cae('0x10a');this['createHistory'](_0xd6b15b)['catch'](loggerCatch(_0x6cae('0x106')));this['moveContactManagedDialer'](_0xd6b15b)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x107')));}if(_0x4175a1&&_0x4175a1['type']!=='ivr'&&!isNotNull(this['voiceQueues'][_0x4175a1['queue']][_0x6cae('0x108')])){delete this['uniqueId'][_0x3e5472[_0x6cae('0xde')]];this[_0x6cae('0xb1')](this[_0x6cae('0x21')][_0x4175a1[_0x6cae('0xb2')]]);this['voiceQueues'][_0x4175a1[_0x6cae('0xb2')]][_0x6cae('0x68')]+=0x1;_0xd6b15b=new Hangup(_0x4175a1,_0x3e5472);_0xd6b15b[_0x6cae('0x100')]=0xc;_0xd6b15b[_0x6cae('0xe9')]=_0x3e5472['cause-txt'];_0xd6b15b[_0x6cae('0xe4')]=_0x6cae('0x10b');this[_0x6cae('0xc9')](_0xd6b15b)['catch'](loggerCatch(_0x6cae('0x106')));this['moveContactManagedDialer'](_0xd6b15b)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x107')));}};Dialer[_0x6cae('0x1d')][_0x6cae('0x32')]=function(_0x29b0fa){var _0x4416b1=this[_0x6cae('0x26')][_0x29b0fa[_0x6cae('0xde')]];var _0x2f0c1c=this;if(this[_0x6cae('0x21')][_0x29b0fa['queue']]){if(_0x4416b1&&_0x4416b1[_0x6cae('0x4c')]!==_0x6cae('0x7b')){delete this[_0x6cae('0x26')][_0x29b0fa[_0x6cae('0xde')]];this[_0x6cae('0x21')][_0x29b0fa[_0x6cae('0xb2')]][_0x6cae('0x5e')]+=0x1;var _0x462442=new AgentComplete(_0x4416b1,_0x29b0fa);if(_0x29b0fa['reason']===_0x6cae('0x10c')){_0x462442[_0x6cae('0x10d')]=this[_0x6cae('0x21')][_0x29b0fa[_0x6cae('0xb2')]][_0x6cae('0x10e')]&&this[_0x6cae('0x21')][_0x29b0fa[_0x6cae('0xb2')]][_0x6cae('0x10f')]?moment()[_0x6cae('0x79')](_0x6cae('0xfc')):undefined;}this[_0x6cae('0xc9')](_0x462442)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x110')));this[_0x6cae('0xc7')](_0x462442)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x111')));}}};Dialer[_0x6cae('0x1d')][_0x6cae('0x2e')]=function(_0x45c63a){if(this[_0x6cae('0x21')][_0x45c63a['queue']]){if(this[_0x6cae('0x26')][_0x45c63a[_0x6cae('0xde')]]&&this['uniqueId'][_0x45c63a['uniqueid']][_0x6cae('0x4c')]!==_0x6cae('0x7b')){this[_0x6cae('0xb1')](this[_0x6cae('0x21')][_0x45c63a[_0x6cae('0xb2')]]);this['uniqueId'][_0x45c63a[_0x6cae('0xde')]][_0x6cae('0x112')]=moment()[_0x6cae('0x79')](_0x6cae('0xfc'));}}};Dialer['prototype'][_0x6cae('0x113')]=function(_0x5138d4){this['createHistory'](_0x5138d4)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x110')));this[_0x6cae('0xc7')](_0x5138d4)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x114')));};Dialer[_0x6cae('0x1d')][_0x6cae('0x115')]=function(_0x3a789c){var _0x385157=this[_0x6cae('0x26')][_0x3a789c[_0x6cae('0xde')]];var _0x9146d3=this;if(this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]]){if(_0x385157&&_0x385157[_0x6cae('0x4c')]!==_0x6cae('0x7b')){delete this[_0x6cae('0x26')][_0x3a789c[_0x6cae('0xde')]];this['updateOriginated'](this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]]);_0x385157['droptime']=moment()[_0x6cae('0x79')](_0x6cae('0xfc'));var _0xb7557=new QueueCallerAbandon(_0x385157,_0x3a789c);if(getSeconds(_0x385157['droptime'],_0x385157[_0x6cae('0x116')])>=_0x385157[_0x6cae('0x117')]){this[_0x6cae('0x21')][_0x3a789c['queue']][_0x6cae('0x6c')]+=0x1;this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]][_0x6cae('0x118')]+=0x1;this[_0x6cae('0x21')][_0x3a789c['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0xb7557[_0x6cae('0x100')]=0xa;_0xb7557['statedesc']=_0x6cae('0x119');_0xb7557[_0x6cae('0x11a')]=_0x6cae('0x11b');_0xb7557['agiafterat']=this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]][_0x6cae('0x10e')]?moment()['format'](_0x6cae('0xfc')):undefined;_0xb7557['countdropretry']+=0x1;_0xb7557[_0x6cae('0xec')]+=0x1;if(_0xb7557[_0x6cae('0xf2')]>=this[_0x6cae('0x21')][_0x3a789c['queue']][_0x6cae('0x11c')]){this['queueCallerAbandonCreateState'](_0xb7557);}else{this[_0x6cae('0xbe')]({'active':![],'countdropretry':_0xb7557[_0x6cae('0xf2')],'scheduledat':moment()[_0x6cae('0xfa')](this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]]['dialDropRetryFrequency'],_0x6cae('0x104'))[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x385157[_0x6cae('0xd2')],'ListId':_0x385157[_0x6cae('0xd3')],'VoiceQueueId':_0x385157[_0x6cae('0xd5')]||undefined,'CampaignId':_0x385157[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch('[rescheduleContact][Drop]'));var _0x4a779d=new History(_0xb7557);_0x4a779d[_0x6cae('0x100')]=0xa;_0x4a779d['statedesc']=_0x6cae('0x119');_0x4a779d[_0x6cae('0xa6')]=moment()['format'](_0x6cae('0xfc'));_0x4a779d[_0x6cae('0xa5')]=_0x4a779d[_0x6cae('0xa6')];_0x4a779d[_0x6cae('0x11d')]=_0xb7557[_0x6cae('0x11d')];_0x4a779d['calleridnum']=_0xb7557[_0x6cae('0x11e')];this[_0x6cae('0xc9')](_0x4a779d)['catch'](loggerCatch(_0x6cae('0x11f')));}}else{this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]][_0x6cae('0x6b')]+=0x1;this[_0x6cae('0x21')][_0x3a789c['queue']][_0x6cae('0x63')]+=0x1;_0xb7557['state']=0xb;_0xb7557[_0x6cae('0xe9')]=_0x6cae('0x120');_0xb7557['dropreason']='CALLEREXIT';_0xb7557['countabandonedretry']+=0x1;_0xb7557[_0x6cae('0xec')]+=0x1;if(_0xb7557[_0x6cae('0xf3')]>=this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]][_0x6cae('0x121')]){this[_0x6cae('0x113')](_0xb7557);}else{this[_0x6cae('0xbe')]({'active':![],'countabandonedretry':_0xb7557['countabandonedretry'],'scheduledat':moment()[_0x6cae('0xfa')](this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]][_0x6cae('0x122')],'minutes')[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x385157[_0x6cae('0xd2')],'ListId':_0x385157['ListId'],'VoiceQueueId':_0x385157[_0x6cae('0xd5')]||undefined,'CampaignId':_0x385157[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x123')));var _0x4a779d=new History(_0xb7557);_0x4a779d[_0x6cae('0x100')]=0xb;_0x4a779d[_0x6cae('0xe9')]=_0x6cae('0x120');_0x4a779d[_0x6cae('0xa6')]=moment()[_0x6cae('0x79')](_0x6cae('0xfc'));_0x4a779d['endtime']=_0x4a779d[_0x6cae('0xa6')];_0x4a779d[_0x6cae('0x11d')]=_0xb7557['calleridname'];_0x4a779d[_0x6cae('0x11e')]=_0xb7557['calleridnum'];this['createHistory'](_0x4a779d)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x124')));}}}}};Dialer[_0x6cae('0x1d')][_0x6cae('0x35')]=function(_0xf16465){if(this[_0x6cae('0xaa')][_0xf16465[_0x6cae('0xde')]]){this[_0x6cae('0xaa')][_0xf16465[_0x6cae('0xde')]][_0x6cae('0xaf')]=_0xf16465[_0x6cae('0xaf')];}if(this[_0x6cae('0x26')][_0xf16465[_0x6cae('0xde')]]){this[_0x6cae('0x26')][_0xf16465[_0x6cae('0xde')]][_0x6cae('0xaf')]=_0xf16465[_0x6cae('0xaf')];}};Dialer[_0x6cae('0x1d')][_0x6cae('0x39')]=function(_0x4cf257){if(strategy[this[_0x6cae('0x21')][this[_0x6cae('0xaa')][_0x4cf257[_0x6cae('0x125')]][_0x6cae('0xb2')]][_0x6cae('0x4e')]]===_0x6cae('0x1c')){if(this[_0x6cae('0xaa')][_0x4cf257['actionid']]&&_[_0x6cae('0xad')](this['actions'][_0x4cf257[_0x6cae('0x125')]]['locked'])&&_0x4cf257[_0x6cae('0xdb')]==='1'&&_0x4cf257[_0x6cae('0x126')]==='0'){if(this[_0x6cae('0x23')][_0x4cf257[_0x6cae('0x127')]]){if(!this[_0x6cae('0x23')][_0x4cf257[_0x6cae('0x127')]][_0x6cae('0x128')]){this['agents'][_0x4cf257[_0x6cae('0x127')]][_0x6cae('0x128')]=!![];this[_0x6cae('0xaa')][_0x4cf257[_0x6cae('0x125')]][_0x6cae('0x128')]=!![];this[_0x6cae('0xaa')][_0x4cf257[_0x6cae('0x125')]][_0x6cae('0x127')]=_0x4cf257[_0x6cae('0x127')];}}}}else if((strategy[this[_0x6cae('0x21')][this['actions'][_0x4cf257[_0x6cae('0x125')]][_0x6cae('0xb2')]][_0x6cae('0x4e')]]||_0x6cae('0x1b'))===_0x6cae('0x1b')){if(this[_0x6cae('0xaa')][_0x4cf257['actionid']]){if(this['agents'][_0x4cf257[_0x6cae('0x127')]]){this[_0x6cae('0xaa')][_0x4cf257[_0x6cae('0x125')]]['stateinterface']=_0x4cf257[_0x6cae('0x127')];if(_[_0x6cae('0xad')](this[_0x6cae('0x2b')][this[_0x6cae('0xaa')][_0x4cf257[_0x6cae('0x125')]][_0x6cae('0xb2')]])){this[_0x6cae('0x2b')][this['actions'][_0x4cf257[_0x6cae('0x125')]][_0x6cae('0xb2')]]=[];}this[_0x6cae('0x2b')][this[_0x6cae('0xaa')][_0x4cf257[_0x6cae('0x125')]][_0x6cae('0xb2')]][_0x6cae('0x129')](_[_0x6cae('0x8e')](_['pick'](this[_0x6cae('0xaa')][_0x4cf257['actionid']],[_0x6cae('0x12a'),'stateinterface']),{'status':_0x4cf257['status'],'paused':_0x4cf257[_0x6cae('0x126')]}));}}}};function unlockQueueStatus(_0xcc14ee,_0x195d43){setTimeout(function(){if(_[_0x6cae('0x3d')](_0xcc14ee[_0x6cae('0x12b')])){loggerBooked[_0x6cae('0x95')]('[unlockQueueStatus][undefined]',_0x195d43);}_0xcc14ee['queueStatusComplete']=!![];loggerBooked[_0x6cae('0x7e')](_0x6cae('0x12c'),_0x195d43,JSON[_0x6cae('0x78')](_[_0x6cae('0xd1')](_0xcc14ee,[_0x6cae('0x3f'),_0x6cae('0x12b')])));},0x1f3);}Dialer[_0x6cae('0x1d')][_0x6cae('0x3b')]=function(_0x1301f9){var _0x1973dc=this;var _0x31a78a=_0x1973dc[_0x6cae('0x21')][_0x1973dc[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0xb2')]];if(strategy[this[_0x6cae('0x21')][this['actions'][_0x1301f9['actionid']]['queue']][_0x6cae('0x4e')]]==='roundrobin'){if(this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]]&&this['actions'][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0x127')]){this[_0x6cae('0x20')][_0x6cae('0x12d')](this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]]['idHopper'],this['actions'][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0x127')])['catch'](function(_0x423f2d){logger['error'](_0x6cae('0x12e'),util['inspect'](_0x423f2d,{'showHidden':![],'depth':null}));})[_0x6cae('0x1f')](function(){_0x1973dc[_0x6cae('0xb1')](_0x1973dc[_0x6cae('0x21')][_0x1973dc[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0xb2')]]);_0x1973dc['agents'][_0x1973dc[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0x127')]]['locked']=![];delete _0x1973dc[_0x6cae('0xaa')][_0x1301f9['actionid']];unlockQueueStatus(_0x31a78a);});}else{this[_0x6cae('0xb1')](this['voiceQueues'][this[_0x6cae('0xaa')][_0x1301f9['actionid']][_0x6cae('0xb2')]]);this[_0x6cae('0xbe')]({'active':![],'ContactId':this[_0x6cae('0xaa')][_0x1301f9['actionid']][_0x6cae('0xd2')],'ListId':this[_0x6cae('0xaa')][_0x1301f9['actionid']]['ListId'],'VoiceQueueId':this[_0x6cae('0xaa')][_0x1301f9['actionid']][_0x6cae('0xd5')]||undefined,'CampaignId':this['actions'][_0x1301f9['actionid']][_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x12f')));delete this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]];unlockQueueStatus(_0x31a78a);}}else if((strategy[this[_0x6cae('0x21')][this['actions'][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0xb2')]][_0x6cae('0x4e')]]||'rrmemory')==='rrmemory'){var _0xed72b4;if(this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]]&&!_[_0x6cae('0x45')](this[_0x6cae('0x2b')][this['actions'][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0xb2')]])){if(this[_0x6cae('0x2c')][_0x1973dc['actions'][_0x1301f9['actionid']][_0x6cae('0xb2')]]){this[_0x6cae('0x2c')][_0x1973dc[_0x6cae('0xaa')][_0x1301f9['actionid']][_0x6cae('0xb2')]]=this[_0x6cae('0x2c')][this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0xb2')]]?this[_0x6cae('0x2c')][this['actions'][_0x1301f9['actionid']][_0x6cae('0xb2')]]:this['queueBooked'][this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]]['queue']]?this[_0x6cae('0x2b')][this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]]['queue']][_0x6cae('0x130')]||0x0:0x0;}this[_0x6cae('0x2b')][this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0xb2')]][_0x6cae('0x130')]=this['queueBookedRR'][this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0xb2')]];for(var _0x38e452=0x0;_0x38e452=0x0;})[_0x6cae('0xb9')](myreject(_0x1afa4a)));}}else{_0x48d1f9[_0x6cae('0x129')](ami['Action']({'action':'command','command':util[_0x6cae('0x79')](_0x6cae('0x14a'),_0x1c6475,!_['isUndefined'](config[_0x6cae('0x142')][_0x2702d4])?_0x2702d4:'')})[_0x6cae('0xb7')](function(_0x1199f1){return _0x1199f1[_0x6cae('0x147')][_0x6cae('0x148')]('true')>=0x0;})[_0x6cae('0xb9')](myreject(_0x1afa4a)));}BPromise[_0x6cae('0x14b')](_0x48d1f9)[_0x6cae('0xb7')](function(_0x10de09){var _0x5e80d9=_[_0x6cae('0x14c')](_0x10de09);if(_0x5e80d9){return _0x2d22cc(_0x5e80d9);}else{_0x59289d['message']=_0x4bd25c?_0x6cae('0x14d'):_0x6cae('0x14e');return _0x1afa4a(msgResponse(_0x6cae('0x14f'),_0x6cae('0x13f'),_0x6cae('0x150')+_0x4bd25c+'\x20'+_0x5db3b7+_0x6cae('0x151')+util[_0x6cae('0x94')](_0x1c6475,{'showHidden':![],'depth':null})+_0x6cae('0x152')+_0x2702d4));}})[_0x6cae('0xb9')](function(_0x5e5c29){return _0x1afa4a(msgResponse('ifTime',_0x6cae('0x13f'),JSON['stringify'](_0x5e5c29)));});});};Dialer['prototype']['checkDialMethod']=function(_0x59892c){var _0x29b3e9=this;return function(){switch(_0x59892c[_0x6cae('0x59')]){case'progressive':freeVariablesPredictive(_0x59892c);_0x29b3e9[_0x6cae('0x153')](_0x59892c,0x1);break;case'power':freeVariablesPredictive(_0x59892c);_0x29b3e9[_0x6cae('0x153')](_0x59892c,_0x59892c[_0x6cae('0x154')]);break;case _0x6cae('0x8'):_0x29b3e9[_0x6cae('0x8')](_0x59892c);break;case _0x6cae('0x7'):freeVariablesPredictive(_0x59892c);_0x29b3e9['handlePower'](_0x59892c,0x1);break;default:freeVariablesPredictive(_0x59892c);logger[_0x6cae('0x95')](_0x6cae('0x155'),_0x59892c[_0x6cae('0x3f')],_0x6cae('0x156'));}};};Dialer[_0x6cae('0x1d')][_0x6cae('0x157')]=function(_0x315f82){var _0x34713f=this;return function(){_0x34713f[_0x6cae('0x158')](_0x315f82);};};Dialer['prototype'][_0x6cae('0xa')]=function(_0x98f098){var _0x15b0ed=this;if(isNotPreview(_0x98f098[_0x6cae('0x59')])){if(isVoiceQueueOutbound(_0x98f098['type'])&&isActive(_0x98f098[_0x6cae('0x58')])){_0x98f098[_0x6cae('0xa0')]=!![];BPromise[_0x6cae('0xb6')]()[_0x6cae('0xb7')](checkIsLoggedIn(_0x98f098,_0x98f098[_0x6cae('0x50')]))[_0x6cae('0xb7')](checkIsActive(_0x98f098,_0x98f098['dialActive']))[_0x6cae('0xb7')](checkInterval(_0x98f098))['then'](_0x15b0ed[_0x6cae('0x139')](_0x98f098))[_0x6cae('0xb7')](_0x15b0ed['checkIfTime'](_0x98f098['dialGlobalInterval'],_0x98f098[_0x6cae('0x159')],_0x98f098[_0x6cae('0x3f')],_0x98f098))['then'](_0x15b0ed['checkIfTimeIntervals'](_0x98f098['Interval'],_0x98f098['dialTimezone'],_0x98f098[_0x6cae('0x3f')],_0x98f098))[_0x6cae('0xb7')](_0x15b0ed[_0x6cae('0x15a')](_0x98f098))[_0x6cae('0xb9')](loggerCatchQueueSummary(_0x6cae('0x15b'),_0x98f098));}else{notSendMessagesQueue(_0x98f098);}}else{freeVariablesPredictive(_0x98f098);}};Dialer['prototype'][_0x6cae('0x15c')]=function(){var _0x5c7d99=this;var _0x5190c7;for(var _0x535b69 in this[_0x6cae('0x22')]){if(typeof this[_0x6cae('0x22')][_0x535b69]!=='undefined'){_0x5190c7=this['campaigns'][_0x535b69];if(isCampaignIvr(_0x5190c7[_0x6cae('0x4c')])&&isActive(_0x5190c7[_0x6cae('0x76')])){_0x5190c7[_0x6cae('0xa0')]=!![];BPromise[_0x6cae('0xb6')]()['then'](checkIsActive(_0x5190c7,_0x5190c7[_0x6cae('0x76')]))['then'](checkInterval(_0x5190c7))[_0x6cae('0xb7')](_0x5c7d99[_0x6cae('0x139')](_0x5190c7))[_0x6cae('0xb7')](_0x5c7d99[_0x6cae('0x13c')](_0x5190c7[_0x6cae('0x15d')],_0x5190c7[_0x6cae('0x159')],_0x5190c7['name'],_0x5190c7))[_0x6cae('0xb7')](_0x5c7d99['checkIfTimeIntervals'](_0x5190c7[_0x6cae('0x42')],_0x5190c7['dialTimezone'],_0x5190c7[_0x6cae('0x3f')],_0x5190c7))[_0x6cae('0xb7')](_0x5c7d99[_0x6cae('0x157')](_0x5190c7))[_0x6cae('0xb9')](loggerCatchQueueSummary(_0x6cae('0x15e'),_0x5190c7));}else{notSendMessagesCampaign(_0x5190c7);}}}};function getCallerIdRandom(_0x1802af,_0xc0648b){var _0x78f044;var _0x39c3c1;var _0x1313a5;if(_0xc0648b<=0x0){_0xc0648b=0x1;}_0x78f044=new RegExp(_0x6cae('0x15f')+_0xc0648b+'}$');_0x39c3c1=Math[_0x6cae('0x160')](0xa,_0xc0648b-0x1);_0x1313a5=Math[_0x6cae('0x160')](0xa,_0xc0648b)-0x1;return util['format']('%s',_['replace'](_0x1802af,_0x78f044,_[_0x6cae('0x161')](_0x39c3c1,_0x1313a5)));}function extractCalleridName(_0x57817d){var _0x2102ec=_0x57817d[_0x6cae('0x162')](/"(.*?)"/);return _0x2102ec?_0x2102ec[0x1]:_0x57817d;}function extractCalleridNumber(_0x21b98e){var _0x5a09ca=_0x21b98e[_0x6cae('0x162')](/<(.*?)>/);return _0x5a09ca?_0x5a09ca[0x1]:_0x21b98e;}Dialer[_0x6cae('0x1d')]['actionOriginate']=function(_0x201e6,_0x2abbc3){var _0x14424a=this;var _0x1cc3ac=uuid['v4']();this[_0x6cae('0xaa')][_0x1cc3ac]=new Action(_0x201e6,_0x2abbc3,_0x1cc3ac);return new BPromise(function(_0x43d4ca,_0x505685){if(_[_0x6cae('0x3d')](_0x201e6)&&typeof _0x201e6!==_0x6cae('0x163')){return _0x505685(msgResponse(_0x6cae('0x164'),_0x6cae('0x13f'),'voiceQueue\x20is\x20undefine'));}if(_[_0x6cae('0x3d')](_0x2abbc3['Contact'][_0x6cae('0x165')])||_0x2abbc3['Contact'][_0x6cae('0x165')]===null){return _0x505685(msgResponse(_0x6cae('0x164'),'Failure',_0x6cae('0x166')));}var _0x20b513={'XMD-CALLERID':_0x14424a[_0x6cae('0xaa')][_0x1cc3ac][_0x6cae('0x167')](),'XMD-AGI':_0x201e6[_0x6cae('0x108')]?util[_0x6cae('0x79')](_0x6cae('0x168'),ipAgi,_0x201e6[_0x6cae('0x108')]):_0x6cae('0x169'),'XMD-AGIAFTER':_0x201e6['dialQueueProject2']?util[_0x6cae('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x201e6['dialQueueProject2']):_0x6cae('0x169'),'XMD-QUEUE':_0x201e6['type']==='outbound'?util['format'](_0x6cae('0x16a'),_0x201e6[_0x6cae('0x3f')],_0x201e6['dialQueueOptions']||'',_0x201e6[_0x6cae('0x10f')]?'c':'',_0x201e6[_0x6cae('0x117')]||0x3):'NONE','XMD-CONTACTID':_0x2abbc3[_0x6cae('0xd2')],'XMD-CDRTYPE':_0x6cae('0x6'),'CALLERID(all)':_0x14424a[_0x6cae('0xaa')][_0x1cc3ac][_0x6cae('0x167')](),'XMD-AMD':_0x201e6[_0x6cae('0xe6')]?_0x6cae('0x16b'):_0x6cae('0x169'),'XMD-DESTINATION':_0x6cae('0xe2')};if(_0x201e6[_0x6cae('0xe6')]){_0x20b513[_0x6cae('0x16c')]=_0x201e6[_0x6cae('0x16d')]||0x9c4;_0x20b513[_0x6cae('0x16e')]=_0x201e6['dialAMDGreeting']||0x5dc;_0x20b513[_0x6cae('0x16f')]=_0x201e6[_0x6cae('0x170')]||0x320;_0x20b513[_0x6cae('0x171')]=_0x201e6[_0x6cae('0x172')]||0x1388;_0x20b513[_0x6cae('0x173')]=_0x201e6['dialAMDMinWordLength']||0x64;_0x20b513[_0x6cae('0x174')]=_0x201e6['dialAMDBetweenWordsSilence']||0x32;_0x20b513[_0x6cae('0x175')]=_0x201e6[_0x6cae('0x176')]||0x3;_0x20b513[_0x6cae('0x177')]=_0x201e6[_0x6cae('0x178')]||0x100;_0x20b513['XMD-AMDMAXIMUMWORDLENGTH']=_0x201e6[_0x6cae('0x179')]||0x1388;}if(_0x201e6[_0x6cae('0x4c')]===_0x6cae('0x4d')){_0x20b513[_0x6cae('0x17a')]=_0x2abbc3[_0x6cae('0xd5')];}else{_0x20b513[_0x6cae('0x17b')]=_0x2abbc3[_0x6cae('0xfd')];}for(var _0x41255b in _0x2abbc3[_0x6cae('0x17c')]){if(typeof _0x2abbc3[_0x6cae('0x17c')][_0x41255b]!==_0x6cae('0x99')){if(isNotNull(_0x2abbc3[_0x6cae('0x17c')][_0x41255b])&&_0x41255b!=='id'&&_0x41255b!==_0x6cae('0x17d')&&_0x41255b!==_0x6cae('0x17e')&&_0x41255b!=='updatedAt'){_0x20b513[util[_0x6cae('0x79')]('%s%s',_0x6cae('0x17f'),_[_0x6cae('0x180')](_0x41255b))]=_0x2abbc3['Contact'][_0x41255b];}}}var _0x402fa8=_0x14424a[_0x6cae('0xda')](_0x201e6[_0x6cae('0x75')])?getCallerId(_0x201e6[_0x6cae('0x75')][_0x6cae('0x77')],_0x201e6[_0x6cae('0x181')],_0x201e6[_0x6cae('0x182')]>0x0?getCallerIdRandom(_0x201e6['dialOriginateCallerIdNumber'],_0x201e6[_0x6cae('0x182')]):_0x201e6['dialOriginateCallerIdNumber']):getCallerId(_[_0x6cae('0xad')](_0x201e6[_0x6cae('0x13a')])?_0x201e6[_0x6cae('0x75')][_0x6cae('0x77')]:_0x201e6[_0x6cae('0x13a')]['callerid'],_0x201e6['dialOriginateCallerIdName'],_0x201e6[_0x6cae('0x182')]>0x0?getCallerIdRandom(_0x201e6[_0x6cae('0x5a')],_0x201e6[_0x6cae('0x182')]):_0x201e6['dialOriginateCallerIdNumber']);if(_0x402fa8){_0x20b513[_0x6cae('0x183')]=_0x14424a['actions'][_0x1cc3ac][_0x6cae('0x184')]=extractCalleridName(_0x402fa8);_0x20b513['XMD-ORIGINATECALLERIDNUM']=_0x14424a['actions'][_0x1cc3ac][_0x6cae('0x185')]=extractCalleridNumber(_0x402fa8);}return ami[_0x6cae('0xae')]({'actionid':_0x1cc3ac,'action':_0x6cae('0x164'),'channel':_0x14424a['isTrunkReachable'](_0x201e6[_0x6cae('0x75')])?util[_0x6cae('0x79')]('SIP/%s/%s%s',_0x201e6[_0x6cae('0x75')][_0x6cae('0x3f')],isNotNull(_0x201e6[_0x6cae('0x5c')])?_0x201e6[_0x6cae('0x5c')]['trim']()||'':'',_0x201e6[_0x6cae('0x186')]>0x0?_0x2abbc3[_0x6cae('0x17c')]['phone']['substring'](_0x201e6[_0x6cae('0x186')]):_0x2abbc3['Contact'][_0x6cae('0x165')]):util[_0x6cae('0x79')](_0x6cae('0x187'),_['isNil'](_0x201e6[_0x6cae('0x13a')])?_0x201e6['Trunk'][_0x6cae('0x3f')]:_0x201e6[_0x6cae('0x13a')][_0x6cae('0x3f')],isNotNull(_0x201e6[_0x6cae('0x5c')])?_0x201e6[_0x6cae('0x5c')][_0x6cae('0x188')]()||'':'',_0x201e6[_0x6cae('0x186')]>0x0?_0x2abbc3['Contact'][_0x6cae('0x165')][_0x6cae('0x189')](_0x201e6[_0x6cae('0x186')]):_0x2abbc3['Contact'][_0x6cae('0x165')]),'callerid':_0x402fa8,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x20b513,'timeout':(_0x201e6[_0x6cae('0x5b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1cc3ac})['then'](function(_0x108cc6){return _0x43d4ca(_0x108cc6);})[_0x6cae('0xb9')](function(_0x28d2d5){_0x201e6[_0x6cae('0x65')]+=0x1;var _0x5293e5=new History(_0x14424a[_0x6cae('0xaa')][_0x1cc3ac]);logger[_0x6cae('0x95')](util[_0x6cae('0x79')](_0x6cae('0x18a'),JSON[_0x6cae('0x78')](_0x28d2d5)));_0x5293e5[_0x6cae('0x100')]=0xe;_0x5293e5[_0x6cae('0xe9')]=_0x6cae('0x18b');_0x5293e5[_0x6cae('0xa6')]=moment()[_0x6cae('0x79')](_0x6cae('0xfc'));_0x5293e5[_0x6cae('0xa5')]=_0x5293e5[_0x6cae('0xa6')];_0x14424a[_0x6cae('0xc9')](_0x5293e5)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x18c')));_0x14424a[_0x6cae('0xc7')](_0x5293e5)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x18c')))[_0x6cae('0x1f')](function(){delete _0x14424a[_0x6cae('0xaa')][_0x1cc3ac];return _0x505685(msgResponse(_0x6cae('0x164'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0x6cae('0x1d')]['syncOriginateResponse']=function(_0x2f7342){var _0xafe339=this[_0x6cae('0xaa')][_0x2f7342[_0x6cae('0x125')]];if(_0xafe339){delete this[_0x6cae('0xaa')][_0x2f7342[_0x6cae('0x125')]];_0xafe339['responsetime']=moment()[_0x6cae('0x79')](_0x6cae('0xfc'));var _0xa6b54e=_0xafe339[_0x6cae('0x4c')]===_0x6cae('0x7b')?this[_0x6cae('0x22')][_0xafe339[_0x6cae('0xb2')]]:this[_0x6cae('0x21')][_0xafe339[_0x6cae('0x18d')]()];if(!this[_0x6cae('0xd8')](_0x2f7342['response'])){this[_0x6cae('0xb1')](_0xa6b54e);return this[_0x6cae('0x18e')](_0xafe339,_0xa6b54e,_0x2f7342)['catch'](loggerCatch(_0x6cae('0x18f')));}this[_0x6cae('0x26')][_0x2f7342['uniqueid']]=_0xafe339;}};Dialer[_0x6cae('0x1d')]['checkRetriveMax']=function(_0x383e03,_0x184ca6,_0x3fc190){var _0x178b7d=new History(_0x184ca6);if(_0x178b7d[_0x6cae('0x101')]+_0x178b7d[_0x6cae('0xef')]+_0x178b7d[_0x6cae('0xf0')]+_0x178b7d['countnosuchnumberretry']+_0x178b7d[_0x6cae('0xf2')]+_0x178b7d[_0x6cae('0xf3')]+_0x178b7d[_0x6cae('0xf4')]+_0x178b7d[_0x6cae('0xf5')]>=_0x3fc190['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x383e03){case 0x3:if(_0x178b7d['countnoanswerretry']>=_0x3fc190['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x178b7d[_0x6cae('0xf0')]+=0x1,'scheduledat':moment()[_0x6cae('0xfa')](_0x3fc190[_0x6cae('0x190')],_0x6cae('0x104'))[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x178b7d[_0x6cae('0xd2')],'ListId':_0x178b7d[_0x6cae('0xd3')],'VoiceQueueId':_0x178b7d[_0x6cae('0xd5')]||undefined,'CampaignId':_0x178b7d[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x178b7d['countbusyretry']>=_0x3fc190[_0x6cae('0x191')]-0x1){return!![];}this[_0x6cae('0xbe')]({'active':![],'countbusyretry':_0x178b7d['countbusyretry']+=0x1,'scheduledat':moment()[_0x6cae('0xfa')](_0x3fc190[_0x6cae('0x192')],'minutes')[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x178b7d[_0x6cae('0xd2')],'ListId':_0x178b7d['ListId'],'VoiceQueueId':_0x178b7d['VoiceQueueId']||undefined,'CampaignId':_0x178b7d['CampaignId']||undefined})[_0x6cae('0xb9')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x178b7d[_0x6cae('0xef')]>=_0x3fc190[_0x6cae('0x193')]-0x1){return!![];}this[_0x6cae('0xbe')]({'active':![],'countcongestionretry':_0x178b7d['countcongestionretry']+=0x1,'scheduledat':moment()[_0x6cae('0xfa')](_0x3fc190[_0x6cae('0x194')],_0x6cae('0x104'))[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x178b7d[_0x6cae('0xd2')],'ListId':_0x178b7d[_0x6cae('0xd3')],'VoiceQueueId':_0x178b7d[_0x6cae('0xd5')]||undefined,'CampaignId':_0x178b7d[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x178b7d[_0x6cae('0xf1')]>=_0x3fc190['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x6cae('0xbe')]({'active':![],'countnosuchnumberretry':_0x178b7d['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x6cae('0xfa')](_0x3fc190['dialNoSuchNumberRetryFrequency'],_0x6cae('0x104'))[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x178b7d['ContactId'],'ListId':_0x178b7d[_0x6cae('0xd3')],'VoiceQueueId':_0x178b7d[_0x6cae('0xd5')]||undefined,'CampaignId':_0x178b7d[_0x6cae('0xfd')]||undefined})['catch'](loggerCatch(_0x6cae('0x195')));}break;case 0xa:if(_0x178b7d[_0x6cae('0xf2')]>=_0x3fc190[_0x6cae('0x11c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x178b7d[_0x6cae('0xf2')]+=0x1,'scheduledat':moment()[_0x6cae('0xfa')](_0x3fc190['dialDropRetryFrequency'],_0x6cae('0x104'))['format'](_0x6cae('0xfc')),'ContactId':_0x178b7d[_0x6cae('0xd2')],'ListId':_0x178b7d[_0x6cae('0xd3')],'VoiceQueueId':_0x178b7d['VoiceQueueId']||undefined,'CampaignId':_0x178b7d[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x178b7d[_0x6cae('0xf3')]>=_0x3fc190[_0x6cae('0x121')]-0x1){return!![];}this[_0x6cae('0xbe')]({'active':![],'countabandonedretry':_0x178b7d[_0x6cae('0xf3')]+=0x1,'scheduledat':moment()[_0x6cae('0xfa')](_0x3fc190[_0x6cae('0x122')],'minutes')['format'](_0x6cae('0xfc')),'ContactId':_0x178b7d[_0x6cae('0xd2')],'ListId':_0x178b7d[_0x6cae('0xd3')],'VoiceQueueId':_0x178b7d[_0x6cae('0xd5')]||undefined,'CampaignId':_0x178b7d[_0x6cae('0xfd')]||undefined})['catch'](loggerCatch(_0x6cae('0x123')));break;case 0x13:if(_0x178b7d['countmachineretry']>=_0x3fc190[_0x6cae('0xf8')]-0x1){return!![];}this[_0x6cae('0xbe')]({'active':![],'countmachineretry':_0x178b7d[_0x6cae('0xf4')]+=0x1,'scheduledat':moment()[_0x6cae('0xfa')](_0x3fc190[_0x6cae('0xfb')],_0x6cae('0x104'))[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x178b7d[_0x6cae('0xd2')],'ListId':_0x178b7d[_0x6cae('0xd3')],'VoiceQueueId':_0x178b7d[_0x6cae('0xd5')]||undefined,'CampaignId':_0x178b7d[_0x6cae('0xfd')]||undefined})['catch'](loggerCatch(_0x6cae('0xfe')));break;case 0x14:if(_0x178b7d[_0x6cae('0xf5')]>=_0x3fc190[_0x6cae('0x196')]-0x1){return!![];}this[_0x6cae('0xbe')]({'active':![],'countagentrejectretry':_0x178b7d[_0x6cae('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x3fc190['dialAgentRejectRetryFrequency'],_0x6cae('0x104'))[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x178b7d['ContactId'],'ListId':_0x178b7d[_0x6cae('0xd3')],'VoiceQueueId':_0x178b7d[_0x6cae('0xd5')]||undefined,'CampaignId':_0x178b7d[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x197')));break;default:return!![];}};Dialer[_0x6cae('0x1d')]['callProgressDetecting']=function(_0x3dbd15,_0x59682a,_0x9482ca){var _0x477ec1=this;var _0x165477=new History(_0x3dbd15);return new BPromise(function(_0x294ff6,_0x484cd6){if(_[_0x6cae('0x3d')](_0x59682a)&&typeof _0x59682a!==_0x6cae('0x163')){return _0x484cd6(msgResponse(_0x6cae('0x198'),_0x6cae('0x13f'),_0x6cae('0x199')));}if(_[_0x6cae('0x3d')](_0x9482ca)&&typeof _0x9482ca!==_0x6cae('0x163')){return _0x484cd6(msgResponse(_0x6cae('0x198'),_0x6cae('0x13f'),'evt\x20is\x20undefine'));}switch(_0x9482ca['reason']){case'0':_0x59682a['outboundNoSuchCallsDay']+=0x1;_0x165477[_0x6cae('0x100')]=0x0;_0x165477[_0x6cae('0xe9')]=_0x6cae('0x19a');_0x165477[_0x6cae('0xf1')]+=0x1;_0x165477['countglobal']+=0x1;ami[_0x6cae('0x4b')](_0x6cae('0x19b'),ut[_0x6cae('0x19c')](_0x3dbd15,_0x6cae('0x19d')));_0x477ec1[_0x6cae('0xc9')](_0x165477)['catch'](loggerCatch(_0x6cae('0xee')));if(_0x477ec1['checkRetriveMax'](0x0,_0x3dbd15,_0x59682a)){if(_0x165477[_0x6cae('0xf1')]>=_0x59682a['dialNoSuchNumberMaxRetry']){_0x477ec1['createStateFinal'](_0x165477,_0x294ff6,_0x484cd6,'reason\x200\x20no\x20such\x20number....');}else{_0x477ec1[_0x6cae('0xf6')](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x19e'));}}break;case'3':_0x59682a[_0x6cae('0x64')]+=0x1;_0x165477[_0x6cae('0x100')]=0x3;_0x165477[_0x6cae('0xe9')]='NoAnswer';_0x165477[_0x6cae('0xf0')]+=0x1;_0x165477[_0x6cae('0xec')]+=0x1;ami[_0x6cae('0x4b')](_0x6cae('0x19f'),ut[_0x6cae('0x19c')](_0x3dbd15,_0x6cae('0x1a0')));_0x477ec1['createHistory'](_0x165477)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x1a1')));if(_0x477ec1[_0x6cae('0x1a2')](0x3,_0x3dbd15,_0x59682a)){if(_0x165477[_0x6cae('0xf0')]>=_0x59682a[_0x6cae('0x1a3')]){_0x477ec1[_0x6cae('0x103')](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1a4'));}else{_0x477ec1[_0x6cae('0xf6')](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1a4'));}}break;case'5':_0x59682a[_0x6cae('0x60')]+=0x1;_0x165477['state']=0x5;_0x165477['statedesc']='Busy';_0x165477['countbusyretry']+=0x1;_0x165477[_0x6cae('0xec')]+=0x1;ami[_0x6cae('0x4b')](_0x6cae('0x1a5'),ut[_0x6cae('0x19c')](_0x3dbd15,'busy'));_0x477ec1['createHistory'](_0x165477)['catch'](loggerCatch(_0x6cae('0x1a6')));if(_0x477ec1[_0x6cae('0x1a2')](0x5,_0x3dbd15,_0x59682a)){if(_0x165477[_0x6cae('0x101')]>=_0x59682a['dialBusyMaxRetry']){_0x477ec1['createStateFinal'](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1a7'));}else{_0x477ec1['stateGlobal'](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1a7'));}}break;case'8':_0x59682a[_0x6cae('0x61')]+=0x1;_0x165477['state']=0x8;_0x165477[_0x6cae('0xe9')]=_0x6cae('0x1a8');_0x165477['countcongestionretry']+=0x1;_0x165477[_0x6cae('0xec')]+=0x1;ami[_0x6cae('0x4b')](_0x6cae('0x1a9'),ut['buildObj'](_0x3dbd15,_0x6cae('0x1aa')));_0x477ec1[_0x6cae('0xc9')](_0x165477)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x1ab')));if(_0x477ec1[_0x6cae('0x1a2')](0x8,_0x3dbd15,_0x59682a)){if(_0x165477[_0x6cae('0xef')]>=_0x59682a[_0x6cae('0x193')]){_0x477ec1[_0x6cae('0x103')](_0x165477,_0x294ff6,_0x484cd6,'reason\x208\x20congestion');}else{_0x477ec1[_0x6cae('0xf6')](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1ac'));}}break;case'11':_0x59682a[_0x6cae('0x1ad')]+=0x1;_0x165477[_0x6cae('0x100')]=0xb;_0x165477['statedesc']='Abandoned';_0x165477['countabandonedretry']+=0x1;_0x165477[_0x6cae('0xec')]+=0x1;_0x477ec1[_0x6cae('0xc9')](_0x165477)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x124')));if(_0x477ec1[_0x6cae('0x1a2')](0xb,_0x3dbd15,_0x59682a)){if(_0x165477[_0x6cae('0xf3')]>=_0x59682a[_0x6cae('0x121')]){_0x477ec1['createStateFinal'](_0x165477,_0x294ff6,_0x484cd6,'reason\x2011\x20abandoned');}else{_0x477ec1[_0x6cae('0xf6')](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1ae'));}}break;case'20':_0x59682a['outboundRejectCallsDay']+=0x1;_0x165477[_0x6cae('0x100')]=0x14;_0x165477['statedesc']=_0x6cae('0x1af');_0x165477[_0x6cae('0xf5')]+=0x1;_0x165477[_0x6cae('0xec')]+=0x1;ami[_0x6cae('0x4b')](_0x6cae('0x1b0'),ut[_0x6cae('0x19c')](_0x3dbd15,_0x6cae('0x1b1')));_0x477ec1[_0x6cae('0xc9')](_0x165477)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x1b2')));if(_0x477ec1[_0x6cae('0x1a2')](0x14,_0x3dbd15,_0x59682a)){if(_0x165477[_0x6cae('0xf5')]>=_0x59682a[_0x6cae('0x196')]){_0x477ec1[_0x6cae('0x103')](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1b3'));}else{_0x477ec1[_0x6cae('0xf6')](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1b3'));}}break;default:_0x59682a[_0x6cae('0x68')]+=0x1;_0x165477[_0x6cae('0x100')]=0xc;_0x165477[_0x6cae('0xe9')]=_0x9482ca['reason'];_0x477ec1[_0x6cae('0xc9')](_0x165477)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x1b4')));if(_0x477ec1[_0x6cae('0x1a2')](_0x9482ca[_0x6cae('0x1b5')],_0x3dbd15,_0x59682a)){if(_0x165477['countbusyretry']+_0x165477[_0x6cae('0xef')]+_0x165477[_0x6cae('0xf0')]+_0x165477['countnosuchnumberretry']+_0x165477[_0x6cae('0xf2')]+_0x165477[_0x6cae('0xf3')]+_0x165477[_0x6cae('0xf4')]+_0x165477[_0x6cae('0xf5')]>=_0x59682a[_0x6cae('0x102')]){_0x477ec1['stateGlobal'](_0x165477,_0x294ff6,_0x484cd6,_0x9482ca[_0x6cae('0x1b5')]);}else{_0x477ec1['createStateFinal'](_0x165477,_0x294ff6,_0x484cd6,_0x9482ca[_0x6cae('0x1b5')]);}}}});};Dialer[_0x6cae('0x1d')][_0x6cae('0xf6')]=function(_0x4a63e0,_0x2060af,_0x1b0720,_0x4de3e2){var _0x15efdd=new Final(_0x4a63e0);_0x15efdd[_0x6cae('0x100')]=0xf;_0x15efdd[_0x6cae('0xe9')]=_0x6cae('0x1b6');this[_0x6cae('0x103')](_0x15efdd,_0x2060af,_0x1b0720,_0x4de3e2);};Dialer[_0x6cae('0x1d')][_0x6cae('0x103')]=function(_0x4a3c4e,_0x3ca558,_0x55958f,_0x1b73b3){this['moveContactManagedDialer'](_0x4a3c4e)[_0x6cae('0xb7')](function(){return _0x3ca558(msgResponse(_0x6cae('0x198'),_0x6cae('0xd9'),_0x1b73b3));})[_0x6cae('0xb9')](function(){return _0x55958f(msgResponse(_0x6cae('0x1b7'),_0x6cae('0x13f'),_0x6cae('0x1b8')));});};Dialer[_0x6cae('0x1d')][_0x6cae('0x8')]=function(_0x17df85){var _0x2a8464=_0x17df85[_0x6cae('0x1b9')]/0x64;var _0x1d7e1b=_0x17df85[_0x6cae('0x118')]/(_0x17df85['outboundDropCallsDayTimeout']+_0x17df85['outboundAnswerCallsDay']);var _0xf84e51=Math[_0x6cae('0x1ba')](_0x17df85[_0x6cae('0x71')]*(_0x17df85[_0x6cae('0x1bb')]/0x64));var _0x3d6424=Math[_0x6cae('0x1ba')](_0x17df85['predictiveIntervalAvailable']*(_0x17df85['predictiveIntervalMinThreshold']/0x64));var _0x43d6fb=_0x17df85[_0x6cae('0xa1')]+_0x17df85['talking'];var _0x3fbf86=Math[_0x6cae('0x1bc')](_0x17df85['erlangCalls']*_0x17df85[_0x6cae('0x73')]*_0x17df85[_0x6cae('0x6e')]*_0x17df85[_0x6cae('0x6f')]);if(_[_0x6cae('0x3d')](_0x17df85['startProgressive'])){if(!_[_0x6cae('0x3d')](_0x17df85[_0x6cae('0x28')])){_0x17df85[_0x6cae('0x28')]=undefined;loggerPredictive[_0x6cae('0x95')](_0x6cae('0x1bd'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x6cae('0x3d')](_0x17df85[_0x6cae('0x90')])){loggerPredictive[_0x6cae('0x95')]('[startMethodPredictive][StartProgressive]',_0x6cae('0x1be'));clearInterval(_0x17df85['handlePredictive']);_0x17df85[_0x6cae('0x90')]=undefined;}_0x17df85[_0x6cae('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x17df85[_0x6cae('0x3f')],_0x6cae('0x1bf'),_0x17df85[_0x6cae('0x29')]);this[_0x6cae('0x153')](_0x17df85,0x1);}else if(ifInterval(_0x17df85[_0x6cae('0x1c0')],_0x17df85[_0x6cae('0x29')])){this[_0x6cae('0x153')](_0x17df85,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x17df85[_0x6cae('0x29')],_0x17df85[_0x6cae('0x3f')]);_0x17df85['erlangCalls']=0x0;_0x17df85['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2a8464<_0x1d7e1b&&_0x17df85[_0x6cae('0x1c1')]===_0x6cae('0x1c2')){freeVariablesPredictive(_0x17df85);loggerPredictive[_0x6cae('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x6cae('0x1c3'),_0x1d7e1b,_0x6cae('0x29'),_0x17df85['name']);}else if(_0x3fbf86<_0x17df85[_0x6cae('0x6d')]&&_0x17df85[_0x6cae('0x1c1')]===_0x6cae('0x1c2')){freeVariablesPredictive(_0x17df85);loggerPredictive['info'](_0x6cae('0x1c4'),_0x6cae('0x1c5'),_0x3fbf86,_0x6cae('0x1c6'),_0x17df85['predictiveIntervalErlangCallsDroppedCalls'],_0x6cae('0x29'),_0x17df85[_0x6cae('0x3f')]);}else if(!ifInterval(_0x17df85['dialPredictiveInterval'],_0x17df85[_0x6cae('0x29')])&&_[_0x6cae('0x3d')](_0x17df85[_0x6cae('0x28')])&&!_['isUndefined'](_0x17df85[_0x6cae('0x29')])){_0x17df85[_0x6cae('0x28')]=moment()[_0x6cae('0x79')](_0x6cae('0xfc'));loggerPredictive['info'](_0x17df85['name'],'started\x20in\x20predictive\x20at',_0x17df85[_0x6cae('0x28')]);this[_0x6cae('0xbc')](_0x17df85[_0x6cae('0x1c0')])[_0x6cae('0xb7')](this[_0x6cae('0x1c7')](_0x17df85))[_0x6cae('0xb7')](mergeDataErlangB(_0x17df85))[_0x6cae('0xb7')](this['startMethodPredictive'](_0x17df85))[_0x6cae('0xb9')](loggerCatchPredictive(_0x6cae('0x1c8'),_0x17df85));}else if(!ifInterval(_0x17df85['dialPredictiveInterval'],_0x17df85['startPredictive'])){_0x17df85['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x17df85[_0x6cae('0x28')]=moment()[_0x6cae('0x79')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x17df85['name'],_0x6cae('0x1c9'),_0x17df85[_0x6cae('0x28')]);clearInterval(_0x17df85[_0x6cae('0x90')]);_0x17df85[_0x6cae('0x90')]=undefined;this[_0x6cae('0xbc')](_0x17df85[_0x6cae('0x1c0')])['then'](this[_0x6cae('0x1c7')](_0x17df85))[_0x6cae('0xb7')](mergeDataErlangB(_0x17df85))[_0x6cae('0xb7')](this[_0x6cae('0x1ca')](_0x17df85))['catch'](loggerCatchPredictive(_0x6cae('0x1cb'),_0x17df85));}else if(_0x17df85[_0x6cae('0x71')]&&_0x43d6fb<_0x17df85['predictiveIntervalAvailable']-_0x3d6424){freeVariablesPredictive(_0x17df85);loggerPredictive[_0x6cae('0x7e')](_0x17df85[_0x6cae('0x3f')],_0x6cae('0x1cc'),_0x43d6fb,_0x6cae('0x1cd'),_0x17df85['predictiveIntervalAvailable'],'-',_0x3d6424,'=',_0x17df85[_0x6cae('0x71')]-_0x3d6424,')');}else if(_0x17df85[_0x6cae('0x71')]&&_0x43d6fb>_0x17df85[_0x6cae('0x71')]+_0xf84e51){freeVariablesPredictive(_0x17df85);loggerPredictive[_0x6cae('0x7e')](_0x17df85[_0x6cae('0x3f')],_0x6cae('0x1cc'),_0x43d6fb,_0x6cae('0x1ce'),_0x17df85[_0x6cae('0x71')],'+',_0xf84e51,'=',_0x17df85[_0x6cae('0x71')]+_0xf84e51,')');}};Dialer['prototype'][_0x6cae('0x1c7')]=function(_0x35e49e){var _0x34ed0d=this;return function(_0x2c68c3){return new BPromise(function(_0x430c71,_0x3231dd){_[_0x6cae('0x8e')](_0x35e49e,_0x2c68c3[0x0]);if(checkGetDataPredictive(_0x2c68c3[0x0])){var _0x4203e6=_0x35e49e[_0x6cae('0x71')]=_0x35e49e[_0x6cae('0x9f')]+_0x35e49e[_0x6cae('0xa1')];var _0x23dc0e=_0x35e49e['dialPredictiveInterval']*0x3c;var _0x52fef4=_0x2c68c3[0x0][_0x6cae('0x6a')]+_0x2c68c3[0x0]['predictiveIntervalAvgHoldtime'];var _0x519009=(_0x2c68c3[0x0][_0x6cae('0x69')]+_0x2c68c3[0x0][_0x6cae('0x6c')]+_0x2c68c3[0x0][_0x6cae('0x6b')])/_0x2c68c3[0x0][_0x6cae('0x1cf')];_0x35e49e[_0x6cae('0x6e')]=_0x519009>0x0?_0x519009:0x1;switch(_0x35e49e[_0x6cae('0x1c1')]){case _0x6cae('0x1c2'):var _0x43d5e2=_0x35e49e[_0x6cae('0x1b9')]/0x64;return _0x34ed0d[_0x6cae('0x1d0')](_0x4203e6,_0x23dc0e,_0x52fef4,_0x519009,_0x43d5e2)[_0x6cae('0xb7')](function(_0x24c4f9){return _0x430c71(_0x24c4f9);});case _0x6cae('0x1d1'):var _0x2778a7=_0x35e49e[_0x6cae('0x1b9')]/0x64;return _0x34ed0d[_0x6cae('0x1d2')](_0x4203e6,_0x23dc0e,_0x52fef4,_0x519009,_0x2778a7)[_0x6cae('0xb7')](function(_0x3e649e){return _0x430c71(_0x3e649e);});default:return _0x3231dd(msgResponse('[getDataPredictive]',_0x6cae('0x13f'),'Unknown\x20Predictive'));}}else{return _0x3231dd(msgResponse('[getDataPredictive]',_0x6cae('0x13f'),_0x6cae('0x1d3')));}});};};Dialer[_0x6cae('0x1d')][_0x6cae('0x1d4')]=function(_0x480779){var _0x287ac2=this;return function(_0x2a2ce6){return new BPromise(function(_0x1cd111,_0x5d877a){_['merge'](_0x480779,_0x2a2ce6[0x0]);if(checkGetDataPredictive(_0x2a2ce6[0x0])){loggerPredictive['info'](JSON[_0x6cae('0x78')](_0x2a2ce6[0x0]));if(_0x480779[_0x6cae('0x1c1')]==='dropRate'){return _0x287ac2[_0x6cae('0xc5')](_0x480779['id'])['then'](function(_0x27e662){var _0x4e3ab6=_0x480779['loggedIn']-_0x27e662[0x0]['outboundQueuePauses'];var _0x12f7c8=_0x480779[_0x6cae('0x1c0')]*0x3c;var _0x2fafdc=_0x2a2ce6[0x0][_0x6cae('0x6a')]+_0x2a2ce6[0x0][_0x6cae('0x85')];var _0x1b221c=(_0x2a2ce6[0x0]['predictiveIntervalAnsweredCalls']+_0x2a2ce6[0x0][_0x6cae('0x6c')]+_0x2a2ce6[0x0][_0x6cae('0x6b')])/_0x2a2ce6[0x0][_0x6cae('0x1cf')];var _0x41ad83=_0x480779['dialPredictiveOptimizationPercentage']/0x64;_0x480779[_0x6cae('0x70')]=_0x27e662[0x0][_0x6cae('0x1d5')]||0x0;_0x480779[_0x6cae('0x6e')]=_0x1b221c>0x0?_0x1b221c:0x1;return _0x287ac2[_0x6cae('0x1d0')](_0x4e3ab6,_0x12f7c8,_0x2fafdc,_0x1b221c,_0x41ad83);})[_0x6cae('0xb7')](function(_0x19ba06){return _0x1cd111(_0x19ba06);})['catch'](function(_0x235fb7){return _0x5d877a(msgResponse('[CatchErlangB]',_0x6cae('0x13f'),JSON[_0x6cae('0x78')](_0x235fb7)));});}if(_0x480779[_0x6cae('0x1c1')]===_0x6cae('0x1d1')){return _0x287ac2['getVoiceQueueRtPauses'](_0x480779['id'])[_0x6cae('0xb7')](function(_0x419740){var _0x1fa839=_0x480779[_0x6cae('0x50')]-_0x419740[0x0][_0x6cae('0x1d5')];var _0x3b1eea=_0x480779[_0x6cae('0x1c0')]*0x3c;var _0x2bf610=_0x2a2ce6[0x0]['predictiveIntervalAvgTalktime']+_0x2a2ce6[0x0][_0x6cae('0x85')];var _0x34c756=(_0x2a2ce6[0x0]['predictiveIntervalAnsweredCalls']+_0x2a2ce6[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2a2ce6[0x0][_0x6cae('0x6b')])/_0x2a2ce6[0x0]['predictiveIntervalTotalCalls'];var _0xae04e0=_0x480779['dialPredictiveOptimizationPercentage']/0x64;_0x480779[_0x6cae('0x70')]=_0x419740[0x0][_0x6cae('0x1d5')]||0x0;_0x480779[_0x6cae('0x6e')]=_0x34c756>0x0?_0x34c756:0x1;return _0x287ac2[_0x6cae('0x1d2')](_0x1fa839,_0x3b1eea,_0x2bf610,_0x34c756,_0xae04e0);})[_0x6cae('0xb7')](function(_0x74d09f){return _0x1cd111(_0x74d09f);})[_0x6cae('0xb9')](function(_0x8c15f6){return _0x5d877a(msgResponse(_0x6cae('0x1d6'),_0x6cae('0x13f'),JSON[_0x6cae('0x78')](_0x8c15f6)));});}}else{return _0x5d877a(msgResponse(_0x6cae('0x1d7'),'Failure',_0x6cae('0x1d3')));}});};};Dialer[_0x6cae('0x1d')][_0x6cae('0x1ca')]=function(_0x5cf4a8){var _0x5c5bc1=this;return function(){var _0x4dcf80=0x0;var _0x394ccd=Math[_0x6cae('0x1bc')](_0x5cf4a8[_0x6cae('0x72')]*0x3e8);if(_0x394ccd>0x0){_0x394ccd=_0x394ccd<0x64?0x64:_0x394ccd;loggerPredictive[_0x6cae('0x7e')](_0x5cf4a8['name'],_0x6cae('0x1d8'),_0x394ccd,_0x6cae('0x48'));_0x5cf4a8['handlePredictive']=setInterval(function(){_0x5c5bc1['handlePredictive'](_0x5cf4a8);loggerPredictiveCalls[_0x6cae('0x7e')]('[handlePredictive]',_0x4dcf80+=0x1);},_0x394ccd);}else{loggerPredictive[_0x6cae('0x7e')](_0x5cf4a8[_0x6cae('0x3f')],_0x6cae('0x1d9'));}};};Dialer[_0x6cae('0x1d')][_0x6cae('0x1da')]=function(_0x602876,_0x3eddda){var _0x78bea5=this;return function(_0x515d12){if(_['isEmpty'](_0x515d12)){if(_['isNil'](_0x3eddda[_0x6cae('0xd4')])||!_0x3eddda[_0x6cae('0x1db')]){if(_0x602876[_0x6cae('0x59')]===_0x6cae('0x7')){_0x602876[_0x6cae('0x12b')]=_['isUndefined'](_0x602876[_0x6cae('0x12b')])?!![]:_0x602876['queueStatusComplete'];var _0x3d1182=uuid['v4']();_0x78bea5[_0x6cae('0xaa')][_0x3d1182]=new Action(_0x602876,_0x3eddda,_0x3d1182);loggerBooked[_0x6cae('0x7e')](_0x6cae('0x1dc'),_0x3d1182,_0x6cae('0x1dd'),JSON[_0x6cae('0x78')](_0x602876['queueStatusComplete']),'Queue:\x20',_0x602876[_0x6cae('0x3f')]);if(_0x602876[_0x6cae('0x12b')]){_0x602876[_0x6cae('0x12b')]=![];_0x78bea5[_0x6cae('0x2b')][_0x78bea5[_0x6cae('0xaa')][_0x3d1182][_0x6cae('0xb2')]]=[];ami[_0x6cae('0xae')]({'actionid':_0x3d1182,'action':_0x6cae('0x1de'),'queue':_0x602876['name']})[_0x6cae('0xb9')](function(){_0x78bea5[_0x6cae('0xb1')](_0x602876);_0x78bea5[_0x6cae('0xbe')]({'active':![],'ContactId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182][_0x6cae('0xd2')],'ListId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182]['ListId'],'VoiceQueueId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182]['VoiceQueueId']||undefined,'CampaignId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182][_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x78bea5[_0x6cae('0xaa')][_0x3d1182];});}else{loggerBooked['info'](_0x6cae('0x1df'),JSON['stringify'](_0x602876[_0x6cae('0x12b')]),_0x6cae('0x1e0'),_0x602876[_0x6cae('0x3f')]);_0x78bea5[_0x6cae('0xb1')](_0x602876);_0x78bea5[_0x6cae('0xbe')]({'active':![],'ContactId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182]['ContactId'],'ListId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182][_0x6cae('0xd3')],'VoiceQueueId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182]['VoiceQueueId']||undefined,'CampaignId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182][_0x6cae('0xfd')]||undefined})['catch'](loggerCatch(_0x6cae('0x1e1')));delete _0x78bea5['actions'][_0x3d1182];}}else{return _0x78bea5[_0x6cae('0x1e2')](_0x602876,_0x3eddda);}}else{if(getDiff(_0x3eddda[_0x6cae('0x1e3')])<_0x602876[_0x6cae('0x1e4')]*0x3c){if(_0x3eddda[_0x6cae('0x1e5')]&&!_0x3eddda['Agent'][_0x6cae('0x1e6')]){_0x78bea5['preview'][_0x6cae('0x12d')](_0x3eddda['id'])[_0x6cae('0x1f')](function(){_0x78bea5[_0x6cae('0xb1')](_0x602876);});}else{_0x78bea5[_0x6cae('0xc0')]({'active':![]},_0x3eddda['id'],0x1)[_0x6cae('0x1f')](function(){_0x78bea5[_0x6cae('0xb1')](_0x602876);});}}else{_0x602876[_0x6cae('0x66')]+=0x1;_0x78bea5[_0x6cae('0xb1')](_0x602876);if(_0x602876[_0x6cae('0x1e7')]){_0x78bea5['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3eddda[_0x6cae('0xd2')],'ListId':_0x3eddda[_0x6cae('0xd3')],'VoiceQueueId':_0x3eddda['VoiceQueueId']||undefined,'CampaignId':_0x3eddda[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x1e8')));_0x78bea5['createHistory'](createObjHistory(_0x602876,_0x3eddda,_0x6cae('0x1e9'),0x17,_0x6cae('0x1ea')))[_0x6cae('0xb9')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x78bea5[_0x6cae('0xd0')](createObjHistory(_0x602876,_0x3eddda,_0x6cae('0x1eb'),0x16,_0x6cae('0x1ec')),_0x6cae('0x1ed'),_0x6cae('0x1ee'));}}}}else{_0x602876[_0x6cae('0x5f')]+=0x1;_0x78bea5[_0x6cae('0xd0')](createObjHistory(_0x602876,_0x3eddda,'BLACKLIST',0xd,_0x6cae('0x1ef')),_0x6cae('0x1f0'),'[Originate][MoveBlacklist]');throw _0x6cae('0x1f1');}};};Dialer[_0x6cae('0x1d')][_0x6cae('0x158')]=function(_0x164b42){var _0x433d96=this;var _0x51bd74=_0x164b42[_0x6cae('0x1f2')]-_0x164b42[_0x6cae('0x98')]-_0x164b42[_0x6cae('0x1f3')];emitCampaignSummary(_0x164b42);if(_0x51bd74>0x0){if(_0x51bd74>this[_0x6cae('0x1f4')]){_0x51bd74=this[_0x6cae('0x1f4')];}_0x164b42[_0x6cae('0x1f3')]+=_0x51bd74;this[_0x6cae('0xc4')](_0x164b42['id'],_0x51bd74,_0x164b42[_0x6cae('0x1f5')])[_0x6cae('0xb7')](function(_0xf1d3df){_0x164b42['temp']-=_0x51bd74;_0x164b42[_0x6cae('0x1f3')]=_0x164b42['temp']>0x0?_0x164b42[_0x6cae('0x1f3')]:0x0;if(!checkContactEmpty(_0xf1d3df)){_0x164b42[_0x6cae('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x6cae('0x7e')](_0x6cae('0x1f6')+_0x164b42['name']);}else{_0x164b42[_0x6cae('0x98')]+=_0xf1d3df[_0x6cae('0x97')];_0x164b42['message']=_0x6cae('0x1f7');for(var _0x2cfff2=0x0;_0x2cfff2<_0xf1d3df[_0x6cae('0x97')];_0x2cfff2+=0x1){_0x164b42['ivrTotalCallsDays']+=0x1;if(_[_0x6cae('0xad')](_0xf1d3df[_0x2cfff2])||_['isNil'](_0xf1d3df[_0x2cfff2][_0x6cae('0x17c')])||_[_0x6cae('0xad')](_0xf1d3df[_0x2cfff2]['Contact'][_0x6cae('0x165')])){_0x433d96[_0x6cae('0xce')](_0x6cae('0x1f8'),_0x164b42,_0xf1d3df[_0x2cfff2]);}else{_0x433d96[_0x6cae('0xba')](_[_0x6cae('0xd1')](_0xf1d3df[_0x2cfff2],[_0x6cae('0xfd'),_0x6cae('0x1f9')]))[_0x6cae('0xb7')](_0x433d96[_0x6cae('0x1da')](_0x164b42,_0xf1d3df[_0x2cfff2]))[_0x6cae('0xb9')](_0x433d96[_0x6cae('0xcd')](_0x6cae('0x1fa'),_0x164b42));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x164b42,_0x51bd74));}};Dialer[_0x6cae('0x1d')][_0x6cae('0x153')]=function(_0x5a8959,_0x47b79d){var _0x2163e1=this;var _0x30ff00=[];var _0x4432d7=_0x47b79d>=0x1?_0x47b79d:0x1;if(_0x5a8959[_0x6cae('0x59')]===_0x6cae('0x7')){_0x4432d7=0x1;}var _0x16dba5=Math['floor'](_0x5a8959[_0x6cae('0xa1')]*_0x4432d7)-_0x5a8959['originated']-_0x5a8959[_0x6cae('0x1f3')];emitVoiceQueueSummary(_0x5a8959);if(_0x5a8959[_0x6cae('0x1fb')]>0x0){var _0x45b8b5=_0x5a8959[_0x6cae('0x1fb')]-_0x5a8959[_0x6cae('0x98')]-_0x5a8959[_0x6cae('0x9f')]-_0x5a8959[_0x6cae('0x1f3')]-_0x5a8959[_0x6cae('0x1fc')];if(_0x16dba5>_0x45b8b5){_0x16dba5=_0x45b8b5;}}if(_0x16dba5>0x0){if(_0x5a8959[_0x6cae('0x59')]===_0x6cae('0x7')){_0x16dba5=0x1;}if(_0x16dba5>this[_0x6cae('0x1f4')]){_0x16dba5=this['maxNumberOriginate'];}_0x5a8959['temp']+=_0x16dba5;for(var _0x4f8fa9 in this['agents']){if(typeof this['agents'][_0x4f8fa9]!==_0x6cae('0x99')){if(this['agents'][_0x4f8fa9][_0x6cae('0x100')]===_0x6cae('0x1fd')&&this['agents'][_0x4f8fa9][_0x6cae('0xdb')]===_0x6cae('0xdc')){_0x30ff00[_0x6cae('0x129')](this[_0x6cae('0x23')][_0x4f8fa9]['id']);}}}this[_0x6cae('0xc2')](_0x5a8959['id'],_0x30ff00,_0x16dba5,_0x5a8959[_0x6cae('0x1f5')])['then'](function(_0x422308){_0x5a8959['temp']-=_0x16dba5;_0x5a8959[_0x6cae('0x1f3')]=_0x5a8959[_0x6cae('0x1f3')]>0x0?_0x5a8959[_0x6cae('0x1f3')]:0x0;if(!checkContactEmpty(_0x422308)){_0x2163e1['countReScheduled'](_0x5a8959)[_0x6cae('0xb7')](sendMessageReschedule(_0x5a8959))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x1fe')));}else{_0x5a8959['originated']+=_0x422308[_0x6cae('0x97')];_0x5a8959['message']=_0x5a8959['dialMethod']==='booked'?_0x6cae('0x16b'):_0x6cae('0x1f7');for(var _0x2ba916=0x0;_0x2ba916<_0x422308[_0x6cae('0x97')];_0x2ba916+=0x1){if(_['isNil'](_0x422308[_0x2ba916])||_[_0x6cae('0xad')](_0x422308[_0x2ba916][_0x6cae('0x17c')])||_[_0x6cae('0xad')](_0x422308[_0x2ba916][_0x6cae('0x17c')][_0x6cae('0x165')])){_0x2163e1[_0x6cae('0xce')]('[actionOriginate]\x20',_0x5a8959,_0x422308[_0x2ba916]);}else{_0x2163e1[_0x6cae('0xb8')](_['pick'](_0x422308[_0x2ba916],[_0x6cae('0xd5'),'Contact.phone']))['then'](_0x2163e1[_0x6cae('0x1da')](_0x5a8959,_0x422308[_0x2ba916]))[_0x6cae('0xb9')](_0x2163e1[_0x6cae('0xcd')]('[actionOriginate]\x20',_0x5a8959));}}}})['catch'](loggerGetContactDialer(_0x6cae('0x1ff'),_0x5a8959,_0x16dba5));}};Dialer[_0x6cae('0x1d')][_0x6cae('0x90')]=function(_0x3cdc54){if(_0x3cdc54['dialLimitQueue']>0x0){var _0x492aef=_0x3cdc54['dialLimitQueue']-_0x3cdc54[_0x6cae('0x98')]-_0x3cdc54[_0x6cae('0x9f')];if(_0x492aef>0x0){this[_0x6cae('0x200')](_0x3cdc54);}else{loggerPredictiveCalls[_0x6cae('0x7e')](_0x6cae('0x201'));}}else{this[_0x6cae('0x200')](_0x3cdc54);}};Dialer[_0x6cae('0x1d')][_0x6cae('0x200')]=function(_0x5c9139){var _0xe20bb1=this;var _0x317eb2=[];_0x5c9139[_0x6cae('0x98')]+=0x1;for(var _0x27ceb5 in this[_0x6cae('0x23')]){if(typeof this[_0x6cae('0x23')][_0x27ceb5]!==_0x6cae('0x99')){if(this[_0x6cae('0x23')][_0x27ceb5][_0x6cae('0x100')]===_0x6cae('0x1fd')&&this[_0x6cae('0x23')][_0x27ceb5][_0x6cae('0xdb')]===_0x6cae('0xdc')){_0x317eb2[_0x6cae('0x129')](this[_0x6cae('0x23')][_0x27ceb5]['id']);}}}this['getContactDialer'](_0x5c9139['id'],_0x317eb2,0x1,_0x5c9139[_0x6cae('0x1f5')])['then'](function(_0x7337dc){if(!checkContactEmpty(_0x7337dc)){checkContactLowerLimitOriginate(_0x5c9139,0x1,0x0);_0xe20bb1['countReScheduled'](_0x5c9139)['then'](sendMessageReschedule(_0x5c9139))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x1fe')));}else{_0x5c9139[_0x6cae('0x3e')]=_0x6cae('0x1f7');if(_['isNil'](_0x7337dc[0x0])||_['isNil'](_0x7337dc[0x0][_0x6cae('0x17c')])||_[_0x6cae('0xad')](_0x7337dc[0x0][_0x6cae('0x17c')][_0x6cae('0x165')])){_0xe20bb1[_0x6cae('0xce')](_0x6cae('0x1f8'),_0x5c9139,_0x7337dc[0x0]);}else{_0xe20bb1[_0x6cae('0xb8')](_[_0x6cae('0xd1')](_0x7337dc[0x0],[_0x6cae('0xd5'),'Contact.phone']))[_0x6cae('0xb7')](_0xe20bb1[_0x6cae('0x1da')](_0x5c9139,_0x7337dc[0x0]))[_0x6cae('0xb9')](_0xe20bb1[_0x6cae('0xcd')](_0x6cae('0x202'),_0x5c9139));}}})[_0x6cae('0xb9')](loggerGetContactDialer(_0x6cae('0x203'),_0x5c9139,0x1));emitVoiceQueueSummary(_0x5c9139);};Dialer[_0x6cae('0x1d')][_0x6cae('0x1d0')]=function(_0x7e9e34,_0x143915,_0x5dcf0b,_0x3a70e0,_0x51d714,_0x204882){loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x204'));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',_0x7e9e34);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x205'),_0x143915);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x206'),_0x5dcf0b);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x207'),_0x3a70e0);loggerPredictive['info'](_0x6cae('0x208'),_0x51d714);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x83'));return new BPromise(function(_0x2c9132,_0x3b46f9){if(_0x7e9e34<=0x0||isNaN(_0x7e9e34)){return _0x3b46f9(msgResponse('[abandonmentRate]',_0x6cae('0x47'),_0x6cae('0x209')+_0x7e9e34));}if(_0x5dcf0b<=0x0||isNaN(_0x5dcf0b)){return _0x3b46f9(msgResponse(_0x6cae('0x20a'),'Error','Ts\x20=\x20'+_0x5dcf0b));}if(_0x3a70e0<=0x0||isNaN(_0x3a70e0)){return _0x3b46f9(msgResponse(_0x6cae('0x20a'),_0x6cae('0x47'),'p\x20=\x20'+_0x3a70e0));}if(_0x143915<=0x0||isNaN(_0x143915)){return _0x3b46f9(msgResponse(_0x6cae('0x20a'),_0x6cae('0x47'),'interval\x20=\x20'+_0x143915));}if(_0x51d714<=0x0||isNaN(_0x51d714)){return _0x3b46f9(msgResponse(_0x6cae('0x20a'),'Error',_0x6cae('0x20b')+_0x51d714));}_0x204882=_0x204882||0x0;var _0x2958f8=0x1/_0x5dcf0b;var _0x32e031=0x0;var _0x4f82db=0x0;var _0x415ab3=0x0;var _0x3de05a=0x0;for(var _0x3b9dd3=0x0;_0x415ab3<_0x51d714;_0x3b9dd3+=0x1){_0x4f82db=_0x3b9dd3/_0x143915;_0x32e031=(_0x3a70e0*_0x4f82db+_0x204882)/_0x2958f8;_0x415ab3=erlangb(_0x32e031,_0x7e9e34);_0x3de05a=_0x32e031/_0x7e9e34*(0x1-erlangb(_0x32e031,_0x7e9e34));}return _0x2c9132({'erlangCalls':_0x3b9dd3,'erlangCallToSecond':_0x143915/_0x3b9dd3,'erlangAbandonmentRate':_0x415ab3,'erlangBusyFactor':_0x3de05a});});};Dialer[_0x6cae('0x1d')][_0x6cae('0x1d2')]=function(_0x3f505b,_0x5e8d4d,_0x43adde,_0x1f089a,_0x2be63f,_0x22f5a8){loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x20c'));loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x20d'),_0x3f505b);loggerPredictive['info'](_0x6cae('0x205'),_0x5e8d4d);loggerPredictive['info'](_0x6cae('0x206'),_0x43adde);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f089a);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x20e'),_0x2be63f);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x83'));return new BPromise(function(_0x178f43,_0x94198){if(_0x3f505b<=0x0||isNaN(_0x3f505b)){return _0x94198(msgResponse(_0x6cae('0x20f'),_0x6cae('0x47'),_0x6cae('0x209')+_0x3f505b));}if(_0x43adde<=0x0||isNaN(_0x43adde)){return _0x94198(msgResponse(_0x6cae('0x20f'),_0x6cae('0x47'),_0x6cae('0x210')+_0x43adde));}if(_0x1f089a<=0x0||isNaN(_0x1f089a)){return _0x94198(msgResponse(_0x6cae('0x20f'),'Error',_0x6cae('0x211')+_0x1f089a));}if(_0x5e8d4d<=0x0||isNaN(_0x5e8d4d)){return _0x94198(msgResponse(_0x6cae('0x20f'),_0x6cae('0x47'),_0x6cae('0x212')+_0x5e8d4d));}if(_0x2be63f<=0x0||isNaN(_0x2be63f)){return _0x94198(msgResponse(_0x6cae('0x20f'),_0x6cae('0x47'),_0x6cae('0x213')+_0x2be63f));}_0x22f5a8=_0x22f5a8||0x0;var _0x2a3cee=0x1/_0x43adde;var _0x1ee2e9=0x0;var _0x5b4c7d=0x0;var _0x1277db=0x0;var _0xfe7c3f=0x0;for(var _0x328ea7=0x0;_0xfe7c3f<_0x2be63f;_0x328ea7+=0x1){_0x5b4c7d=_0x328ea7/_0x5e8d4d;_0x1ee2e9=(_0x1f089a*_0x5b4c7d+_0x22f5a8)/_0x2a3cee;_0x1277db=erlangb(_0x1ee2e9,_0x3f505b);_0xfe7c3f=_0x1ee2e9/_0x3f505b*(0x1-erlangb(_0x1ee2e9,_0x3f505b));}return _0x178f43({'erlangCalls':_0x328ea7,'erlangCallToSecond':_0x5e8d4d/_0x328ea7,'erlangAbandonmentRate':_0x1277db,'erlangBusyFactor':_0xfe7c3f});});};module[_0x6cae('0x214')]=Dialer; \ No newline at end of file +var _0xabe7=['outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','format','voice:queue:%s','voice_queue:save','type','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','milliseconds','startProgressive','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','starttime','clearZombieChannels','[actions]','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','voiceQueues','queue','[Dialer][checkChannel]','campaigns','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackListIvr','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','saveInDb','pick','ContactId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','active','SIP/%s','reachable','unmonitored','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','state','membername','AMD','statedesc','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','Machine','countglobal','countnoanswerretry','countnosuchnumberretry','countabandonedretry','dialMachineRetryFrequency','VoiceQueueId','[rescheduleContact][Machine]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','[syncHangupIvr]','Unknow','reason','agent','dialAgiAfterHangupAgent','[syncAgentComplete]','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','agiafterat','dialQueueProject2','dialDropMaxRetry','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','endtime','actionid','stateinterface','locked','rrmemory','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','isTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','timezones','\x20Timezone\x20unknow\x20','isArray','command','interval','indexOf','push','iftime\x20%s,%s','content','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','Queue','launchHandleIvr','handleIvr','checkIsTrunkReachable','checkIfTime','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialCutDigit','trim','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialNoSuchNumberMaxRetry','[rescheduleContact][Drop]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','AgentReject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','contact\x20not\x20moved','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','averageHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','check\x20failure','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','[getContactCampaign2][Empty]','RUNNING','emptyContact','[actionOriginate]\x20','checkContactBlack','dialLimitQueue','dialOrderByScheduledAt','checkIsBlackList','Contact.phone','loggerHandler','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','exports','util','lodash','bluebird','moment','md5','ioredis','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperBlack','./action','./history','./agentComplete','./queueCallerAbandon','127.0.0.1','roundrobin','prototype','enqueue','tail','sequence','preview','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','stringify','diff','seconds','emit','outbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay'];(function(_0x342fee,_0x4346c4){var _0x54fa77=function(_0x232b84){while(--_0x232b84){_0x342fee['push'](_0x342fee['shift']());}};_0x54fa77(++_0x4346c4);}(_0xabe7,0x1b0));var _0x7abe=function(_0x41bbf9,_0x125fb3){_0x41bbf9=_0x41bbf9-0x0;var _0x500148=_0xabe7[_0x41bbf9];return _0x500148;};'use strict';var util=require(_0x7abe('0x0'));var _=require(_0x7abe('0x1'));var BPromise=require(_0x7abe('0x2'));var uuid=require('uuid');var moment=require(_0x7abe('0x3'));var rr=require('rr');var md5=require(_0x7abe('0x4'));var Redis=require(_0x7abe('0x5'));var ut=require('../preview/util/util');var config=require(_0x7abe('0x6'));var logger=require(_0x7abe('0x7'))('dialer');var loggerBooked=require(_0x7abe('0x7'))(_0x7abe('0x8'));var loggerPredictive=require('../../../config/logger')(_0x7abe('0x9'));var loggerPredictiveCalls=require(_0x7abe('0x7'))(_0x7abe('0xa'));var loggerSyncQueueSummary=require(_0x7abe('0x7'))('syncQueueSummary');var ami=require('../ami');config[_0x7abe('0xb')]=_[_0x7abe('0xc')](config[_0x7abe('0xb')],{'host':_0x7abe('0xd'),'port':0x18eb});var io=require(_0x7abe('0xe'))(new Redis(config[_0x7abe('0xb')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x7abe('0xf'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x7abe('0x10'));var History=require(_0x7abe('0x11'));var Final=require('./final');var AgentComplete=require(_0x7abe('0x12'));var QueueCallerAbandon=require(_0x7abe('0x13'));var Hangup=require('./hangup');var ipAgi=process['env']['XCALLY_IP_AGI']||_0x7abe('0x14');var strategy={'rrmemory':'rrmemory','roundrobin':_0x7abe('0x15')};var Sequence=function(){};Sequence[_0x7abe('0x16')][_0x7abe('0x17')]=function(_0x136514){this[_0x7abe('0x18')]=this[_0x7abe('0x18')]?this['tail']['finally'](_0x136514):_0x136514();};function Dialer(_0x467052,_0x4a6cbf){this[_0x7abe('0x19')]=new Sequence();this[_0x7abe('0x1a')]=_0x4a6cbf;this['voiceQueues']=_0x467052['voiceQueues'];this['campaigns']=_0x467052['campaigns'];this[_0x7abe('0x1b')]=_0x467052['agents'];this[_0x7abe('0x1c')]=_0x467052[_0x7abe('0x1c')];this[_0x7abe('0x1d')]=config[_0x7abe('0x1d')]||0x2;this[_0x7abe('0x1e')]={};this[_0x7abe('0x1f')]={};this['contactsId']={};this[_0x7abe('0x20')]={};this['optionPredictive']={};this[_0x7abe('0x21')]={};this['startProgressive']={};this[_0x7abe('0x22')]={};this[_0x7abe('0x23')]={};this[_0x7abe('0x24')]={};ami['on'](_0x7abe('0x25'),this[_0x7abe('0x26')][_0x7abe('0x27')](this));ami['on']('queuecallerabandon',this[_0x7abe('0x28')][_0x7abe('0x27')](this));ami['on']('originateresponse',this[_0x7abe('0x29')][_0x7abe('0x27')](this));ami['on'](_0x7abe('0x2a'),this[_0x7abe('0x2b')][_0x7abe('0x27')](this));ami['on'](_0x7abe('0x2c'),this[_0x7abe('0x2d')][_0x7abe('0x27')](this));ami['on']('hangup',this['syncHangup'][_0x7abe('0x27')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0x7abe('0x2e'),this[_0x7abe('0x2f')][_0x7abe('0x27')](this));ami['on'](_0x7abe('0x30'),this[_0x7abe('0x31')][_0x7abe('0x27')](this));ami['on'](_0x7abe('0x32'),this[_0x7abe('0x33')][_0x7abe('0x27')](this));this[_0x7abe('0x34')]();this[_0x7abe('0x35')]();}function isNotNull(_0x779d2e){return _0x779d2e!==null&&!_[_0x7abe('0x36')](_0x779d2e);}function checkIsLoggedIn(_0x2b1975,_0x140b7a){return function(){if(_0x140b7a<=0x0){_0x2b1975[_0x7abe('0x37')]=_0x7abe('0x38');throw _0x2b1975['name']+_0x7abe('0x39');}};}function isActive(_0x2b30f5){return _0x2b30f5;}function checkIsActive(_0xbcbe6f,_0x3b3fcb){return function(){if(!isActive(_0x3b3fcb)){_0xbcbe6f[_0x7abe('0x37')]=_0x7abe('0x3a');throw _0xbcbe6f[_0x7abe('0x3b')]+_0x7abe('0x3c');}};}function checkInterval(_0xe1b38b){return function(){if(!isNotNull(_0xe1b38b[_0x7abe('0x3d')])){_0xe1b38b[_0x7abe('0x37')]=_0x7abe('0x3e');throw _0xe1b38b[_0x7abe('0x3b')]+_0x7abe('0x3f');}if(!isNotNull(_0xe1b38b[_0x7abe('0x3d')]['Intervals'])){_0xe1b38b[_0x7abe('0x37')]=_0x7abe('0x3e');throw _0xe1b38b['name']+_0x7abe('0x3f');}if(!isNotNull(_[_0x7abe('0x40')](_0xe1b38b[_0x7abe('0x3d')][_0x7abe('0x41')]))){_0xe1b38b['message']=_0x7abe('0x3e');throw _0xe1b38b[_0x7abe('0x3b')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x322292,_0x3c4f00,_0x1a6ab0){return{'action':_0x322292,'response':_0x3c4f00,'message':_0x1a6ab0,'stack':_0x1a6ab0};}function myreject(_0x3d506e){return function(_0x3180d8){return _0x3d506e(msgResponse(_0x7abe('0x42'),_0x7abe('0x43'),JSON[_0x7abe('0x44')](_0x3180d8)));};}function getSeconds(_0x2f447a,_0x13ab7c){var _0x383a3d=moment(_0x2f447a)['milliseconds'](0x0);var _0x3ba854=moment(_0x13ab7c)['milliseconds'](0x0);return _0x383a3d[_0x7abe('0x45')](_0x3ba854,_0x7abe('0x46'));}function emit(_0x30fdf3,_0x22d41a,_0xd96721){io['to'](_0x30fdf3)[_0x7abe('0x47')](_0x22d41a,_0xd96721);}function emitVoiceQueueSummary(_0x90a0d1){if(_0x90a0d1['type']===_0x7abe('0x48')){var _0x4a5f6a={'id':_0x90a0d1['id'],'name':_0x90a0d1[_0x7abe('0x3b')],'strategy':_0x90a0d1[_0x7abe('0x49')],'answered':_0x90a0d1[_0x7abe('0x4a')],'available':_0x90a0d1[_0x7abe('0x4b')],'loggedIn':_0x90a0d1[_0x7abe('0x4c')],'pTalking':_0x90a0d1['pTalking'],'sumBillable':_0x90a0d1[_0x7abe('0x4d')],'sumDuration':_0x90a0d1[_0x7abe('0x4e')],'sumHoldTime':_0x90a0d1[_0x7abe('0x4f')]||0x0,'talking':_0x90a0d1[_0x7abe('0x50')],'total':_0x90a0d1[_0x7abe('0x51')],'type':_0x90a0d1['type'],'unmanaged':_0x90a0d1[_0x7abe('0x52')],'abandoned':_0x90a0d1[_0x7abe('0x53')],'waiting':_0x90a0d1[_0x7abe('0x54')],'loggedInDb':_0x90a0d1[_0x7abe('0x55')],'dialActive':_0x90a0d1[_0x7abe('0x56')],'dialMethod':_0x90a0d1[_0x7abe('0x57')],'dialOriginateCallerIdName':_0x90a0d1[_0x7abe('0x58')],'dialOriginateCallerIdNumber':_0x90a0d1[_0x7abe('0x59')],'dialOriginateTimeout':_0x90a0d1[_0x7abe('0x5a')],'dialPrefix':_0x90a0d1[_0x7abe('0x5b')],'outboundAnswerAgiCallsDay':_0x90a0d1[_0x7abe('0x5c')],'outboundAnswerCallsDay':_0x90a0d1[_0x7abe('0x5d')],'outboundBlacklistCallsDay':_0x90a0d1[_0x7abe('0x5e')],'outboundBusyCallsDay':_0x90a0d1[_0x7abe('0x5f')],'outboundCongestionCallsDay':_0x90a0d1['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x90a0d1[_0x7abe('0x60')],'outboundDropCallsDayCallersExit':_0x90a0d1[_0x7abe('0x61')],'outboundDropCallsDayTimeout':_0x90a0d1[_0x7abe('0x62')],'outboundNoAnswerCallsDay':_0x90a0d1['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x90a0d1['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x90a0d1[_0x7abe('0x63')],'outboundReCallsDay':_0x90a0d1['outboundReCallsDay'],'outboundRejectCallsDay':_0x90a0d1[_0x7abe('0x64')],'outboundUnknownCallsDay':_0x90a0d1[_0x7abe('0x65')],'predictiveIntervalAnsweredCalls':_0x90a0d1[_0x7abe('0x66')],'predictiveIntervalAvgHoldtime':_0x90a0d1[_0x7abe('0x67')],'predictiveIntervalAvgTalktime':_0x90a0d1[_0x7abe('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x90a0d1[_0x7abe('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x90a0d1[_0x7abe('0x6a')],'predictiveIntervalErlangCalls':_0x90a0d1['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x90a0d1['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x90a0d1[_0x7abe('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x90a0d1['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x90a0d1['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x90a0d1[_0x7abe('0x6c')],'predictiveIntervalTotalCalls':_0x90a0d1[_0x7abe('0x6d')],'message':_0x90a0d1[_0x7abe('0x37')],'originated':_0x90a0d1[_0x7abe('0x6e')],'erlangCalls':_0x90a0d1[_0x7abe('0x6f')],'erlangCallToSecond':_0x90a0d1[_0x7abe('0x70')],'erlangAbandonmentRate':_0x90a0d1[_0x7abe('0x71')],'erlangBusyFactor':_0x90a0d1[_0x7abe('0x72')],'startPredictive':_0x90a0d1[_0x7abe('0x21')],'startProgressive':_0x90a0d1['startProgressive']};if(_0x90a0d1[_0x7abe('0x73')]){_0x4a5f6a[_0x7abe('0x73')]={'id':_0x90a0d1[_0x7abe('0x73')]['id'],'name':_0x90a0d1[_0x7abe('0x73')][_0x7abe('0x3b')],'active':_0x90a0d1[_0x7abe('0x73')]['active'],'callerid':_0x90a0d1[_0x7abe('0x73')][_0x7abe('0x74')]};}if(_0x90a0d1['Interval']){_0x4a5f6a[_0x7abe('0x3d')]={'id':_0x90a0d1[_0x7abe('0x3d')]['id'],'name':_0x90a0d1[_0x7abe('0x3d')][_0x7abe('0x3b')]};}var _0x1ee2ec=md5(JSON['stringify'](_0x4a5f6a));if(_0x90a0d1[_0x7abe('0x4')]!==_0x1ee2ec){_0x90a0d1[_0x7abe('0x4')]=_0x1ee2ec;emit(util[_0x7abe('0x75')](_0x7abe('0x76'),_0x4a5f6a[_0x7abe('0x3b')]),_0x7abe('0x77'),_0x4a5f6a);}}}function emitCampaignSummary(_0xc61f27){if(_0xc61f27[_0x7abe('0x78')]===_0x7abe('0x79')){emit(util['format'](_0x7abe('0x7a'),_0xc61f27[_0x7abe('0x3b')]),_0x7abe('0x7b'),_0xc61f27);}}function checkGetDataPredictive(_0x36d9de){if(isNotNull(_0x36d9de)&&!_[_0x7abe('0x40')](_0x36d9de)){loggerPredictive['info'](_0x7abe('0x7c'));loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x7e'),_0x36d9de[_0x7abe('0x6d')]);loggerPredictive[_0x7abe('0x7d')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x36d9de[_0x7abe('0x66')]);loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x7f'),_0x36d9de[_0x7abe('0x6a')]);loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x80'),_0x36d9de['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x7abe('0x81'),_0x36d9de['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x7abe('0x7d')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x36d9de['predictiveIntervalAvgTalktime']);loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x82'));if(_0x36d9de[_0x7abe('0x6d')]>0x0){if(!_[_0x7abe('0x36')](_0x36d9de['predictiveIntervalAvgTalktime'])&&_0x36d9de['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x83'));if(!_[_0x7abe('0x36')](_0x36d9de[_0x7abe('0x67')])&&_0x36d9de[_0x7abe('0x67')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x84'));}}else{loggerPredictive['info'](_0x7abe('0x85'));}return![];}function mergeDataErlangB(_0x4f8d68){return function(_0x5216db){loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x86'));loggerPredictive['info'](_0x7abe('0x87'),_0x5216db['erlangCalls']);loggerPredictive['info'](_0x7abe('0x88'),_0x5216db['erlangCallToSecond']);loggerPredictive['info'](_0x7abe('0x89'),_0x5216db[_0x7abe('0x71')]);loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x8a'),_0x5216db[_0x7abe('0x72')]);loggerPredictive['info'](_0x7abe('0x89'),_0x5216db[_0x7abe('0x71')]);loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x82'));_[_0x7abe('0x8b')](_0x4f8d68,_0x5216db);};}function getDiff(_0x32afdf){var _0x3ed870=moment()[_0x7abe('0x8c')](0x0);var _0x52dc6f=moment(_0x32afdf)[_0x7abe('0x8c')](0x0);return _0x3ed870[_0x7abe('0x45')](_0x52dc6f,'seconds');}function ifInterval(_0x1fc3f7,_0x49e0cb){if(_[_0x7abe('0x36')](_0x49e0cb)){return![];}return getDiff(_0x49e0cb)<_0x1fc3f7*0x3c;}function freeVariablesPredictive(_0x381648){if(isNotNull(_0x381648)){if(!_['isUndefined'](_0x381648['startProgressive'])){_0x381648[_0x7abe('0x8d')]=undefined;loggerPredictive[_0x7abe('0x7d')](_0x381648[_0x7abe('0x3b')],_0x7abe('0x8e'));}if(!_[_0x7abe('0x36')](_0x381648[_0x7abe('0x21')])){_0x381648[_0x7abe('0x21')]=undefined;loggerPredictive['info'](_0x381648[_0x7abe('0x3b')],_0x7abe('0x8f'));}if(!_['isUndefined'](_0x381648[_0x7abe('0x90')])){clearInterval(_0x381648[_0x7abe('0x90')]);_0x381648[_0x7abe('0x90')]=undefined;loggerPredictive[_0x7abe('0x7d')](_0x381648['name'],_0x7abe('0x91'));}}}function erlangb(_0x39f42a,_0x4af73c){if(_0x4af73c===0x0){return 0x0;}var _0x54c750=0x1;for(var _0x35d59a=0x1;_0x35d59a<=_0x4af73c;_0x35d59a+=0x1){_0x54c750=0x1+_0x54c750*_0x35d59a/_0x39f42a;}return 0x1/_0x54c750;}function isVoiceQueueOutbound(_0x5d78b1){return _0x5d78b1===_0x7abe('0x48');}function isNotPreview(_0x5b38c5){return _0x5b38c5!==_0x7abe('0x1a');}function isCampaignIvr(_0x2bbb18){return _0x2bbb18===_0x7abe('0x79');}function getCallerId(_0x25d24a,_0x56c16a,_0x113625){if(!_[_0x7abe('0x36')](_0x113625)&&typeof _0x113625===_0x7abe('0x92')&&!_[_0x7abe('0x40')](_0x113625)){if(!_[_0x7abe('0x36')](_0x56c16a)&&typeof _0x56c16a===_0x7abe('0x92')&&!_[_0x7abe('0x40')](_0x56c16a)){return util['format'](_0x7abe('0x93'),_0x56c16a,_0x113625);}return util['format'](_0x7abe('0x93'),_0x113625,_0x113625);}if(!_[_0x7abe('0x36')](_0x25d24a)&&typeof _0x25d24a===_0x7abe('0x92')&&!_[_0x7abe('0x40')](_0x25d24a)){return _0x25d24a;}return _0x7abe('0x94');}function loggerCatchQueueSummary(_0xc7b22a,_0xdf76a0){return function(_0x3024aa){freeVariablesPredictive(_0xdf76a0);emitVoiceQueueSummary(_0xdf76a0);emitCampaignSummary(_0xdf76a0);loggerSyncQueueSummary[_0x7abe('0x95')](_0xc7b22a,util['inspect'](_0x3024aa,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xdcb254,_0x4acc30){return function(_0x453d05){loggerPredictive['error'](_0x4acc30[_0x7abe('0x3b')],_0xdcb254);loggerPredictive[_0x7abe('0x95')](_0x453d05[_0x7abe('0x96')]);freeVariablesPredictive(_0x4acc30);};}function loggerCatch(_0x22869a){return function(_0x8e8751){logger[_0x7abe('0x95')](_0x22869a,util['inspect'](_0x8e8751,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x48e426){return _0x48e426&&!_[_0x7abe('0x36')](_0x48e426)&&_0x48e426['length']>0x0;}function decremetOriginate(_0x125491){if(!_[_0x7abe('0x36')](_0x125491)&&_0x125491!==null){if(typeof _0x125491[_0x7abe('0x6e')]!==_0x7abe('0x97')){if(_0x125491[_0x7abe('0x6e')]>0x0){_0x125491[_0x7abe('0x6e')]-=0x1;}else{logger['error'](_0x7abe('0x98'));}}}else{logger[_0x7abe('0x95')](_0x7abe('0x99'));}}function checkContactLowerLimitOriginate(_0x389674,_0x588da8,_0x259119){if(_0x588da8>_0x259119){for(var _0x1fb126=0x0;_0x1fb126<_0x588da8-_0x259119;_0x1fb126+=0x1){decremetOriginate(_0x389674);}}}function loggerGetContactDialer(_0x59d7c9,_0x2d1ec7,_0x543a38){return function(_0x181bd0){checkContactLowerLimitOriginate(_0x2d1ec7,_0x543a38,0x0);logger[_0x7abe('0x95')](_0x59d7c9,util[_0x7abe('0x9a')](_0x181bd0,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5ca10d){return function(_0x2008fb){if(isNotNull(_0x2008fb)&&isNotNull(_0x2008fb[0x0])){if(_0x2008fb[0x0][_0x7abe('0x9b')]>0x0){_0x5ca10d['message']=_0x7abe('0x9c');logger[_0x7abe('0x7d')]('[getContactDialer2][ReScheduled]'+_0x5ca10d[_0x7abe('0x3b')],_0x2008fb[0x0][_0x7abe('0x9b')],_0x7abe('0x9d'));}else{_0x5ca10d[_0x7abe('0x37')]=_0x7abe('0x9e');logger[_0x7abe('0x7d')](_0x7abe('0x9f')+_0x5ca10d[_0x7abe('0x3b')]);}}};}function notSendMessagesQueue(_0x4295bf){if(_0x4295bf[_0x7abe('0xa0')]){freeVariablesPredictive(_0x4295bf);if(_0x4295bf['originated']===0x0&&_0x4295bf['talking']===0x0&&_0x4295bf['waiting']===0x0&&(_0x4295bf[_0x7abe('0xa1')]||0x0)===0x0){_0x4295bf[_0x7abe('0xa0')]=![];_0x4295bf[_0x7abe('0x4b')]=0x0;_0x4295bf[_0x7abe('0x37')]=_0x7abe('0x3a');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4295bf[_0x7abe('0x3b')],_0x7abe('0xa2'));}else{_0x4295bf[_0x7abe('0x37')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x7abe('0x95')](_0x7abe('0xa3'),_0x4295bf[_0x7abe('0x3b')],_0x7abe('0xa4'));}emitVoiceQueueSummary(_0x4295bf);}}function notSendMessagesCampaign(_0x570cac){if(_0x570cac[_0x7abe('0xa0')]){if(_0x570cac[_0x7abe('0x6e')]===0x0){_0x570cac[_0x7abe('0xa0')]=![];_0x570cac[_0x7abe('0x37')]=_0x7abe('0x3a');loggerSyncQueueSummary['error'](_0x7abe('0xa5'),_0x570cac[_0x7abe('0x3b')],_0x7abe('0xa2'));}else{_0x570cac['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x7abe('0x95')](_0x7abe('0xa5'),_0x570cac[_0x7abe('0x3b')],_0x7abe('0xa4'));}emitCampaignSummary(_0x570cac);}}function createObjHistory(_0xf2677c,_0x1003c3,_0x1e49e4,_0x4d1b5b,_0x1266fc){_0xf2677c[_0x7abe('0x37')]=_0x1e49e4;var _0x28a7e2=new Action(_0xf2677c,_0x1003c3);var _0x394385=new History(_0x28a7e2);_0x394385['state']=_0x4d1b5b;_0x394385['statedesc']=_0x1266fc;_0x394385['endtime']=_0x28a7e2[_0x7abe('0xa6')];return _0x394385;}Dialer['prototype'][_0x7abe('0x35')]=function(){var _0x3d1608=this;setInterval(function(){_0x3d1608[_0x7abe('0xa7')](_0x3d1608['uniqueId'],'[uniqueid]');_0x3d1608[_0x7abe('0xa7')](_0x3d1608[_0x7abe('0x1f')],_0x7abe('0xa8'));},0x32c8);};Dialer[_0x7abe('0x16')][_0x7abe('0xa7')]=function(_0x27931f,_0x216d40){var _0x4d3f9d=this;for(var _0xed6354 in _0x27931f){if(typeof _0x27931f[_0xed6354]!==_0x7abe('0x97')){this[_0x7abe('0x19')][_0x7abe('0x17')](function(){if(!_['isNil'](_0x27931f[_0xed6354])){return ami[_0x7abe('0xa9')]({'action':_0x7abe('0xaa'),'channel':_0x27931f[_0xed6354][_0x7abe('0xab')]})[_0x7abe('0xac')](function(_0x540c66){if(_0x540c66[_0x7abe('0x37')]===_0x7abe('0xad')){setTimeout(function(){if(_0x27931f[_0xed6354]&&_0x27931f[_0xed6354][_0x7abe('0x78')]!==_0x7abe('0x79')){_0x4d3f9d[_0x7abe('0xae')](_0x4d3f9d[_0x7abe('0xaf')][_0x27931f[_0xed6354][_0x7abe('0xb0')]]);logger[_0x7abe('0x95')](_0x7abe('0xb1'),_0x216d40,_0xed6354,_0x27931f[_0xed6354][_0x7abe('0xb0')]);delete _0x27931f[_0xed6354];}if(_0x27931f[_0xed6354]&&_0x27931f[_0xed6354]['type']==='ivr'){_0x4d3f9d[_0x7abe('0xae')](_0x4d3f9d[_0x7abe('0xb2')][_0x27931f[_0xed6354]['queue']]);logger[_0x7abe('0x95')](_0x7abe('0xb3'),_0x216d40,_0xed6354,_0x27931f[_0xed6354]['queue']);delete _0x27931f[_0xed6354];}},0x2328);}});}});}}};Dialer[_0x7abe('0x16')][_0x7abe('0xb4')]=function(_0x52a425){return BPromise[_0x7abe('0xb5')]()[_0x7abe('0xb6')](cmHopper[_0x7abe('0xb4')](_0x52a425))[_0x7abe('0xac')](loggerCatch(_0x7abe('0xb7')));};Dialer[_0x7abe('0x16')]['checkIsBlackList']=function(_0xfe45c1){return BPromise[_0x7abe('0xb5')]()[_0x7abe('0xb6')](cmHopperBlack['checkIsBlackList'](_0xfe45c1))[_0x7abe('0xac')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0x7abe('0xb8')]=function(_0x1b8b4b){return BPromise[_0x7abe('0xb5')]()[_0x7abe('0xb6')](cmHopperBlack[_0x7abe('0xb8')](_0x1b8b4b))['catch'](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype']['averageHandleTime']=function(_0x5edd22){return BPromise[_0x7abe('0xb5')]()['then'](cmHopperHistory[_0x7abe('0xb9')](_0x5edd22))[_0x7abe('0xac')](loggerCatch(_0x7abe('0xba')));};Dialer[_0x7abe('0x16')][_0x7abe('0xbb')]=function(_0x16c667){return BPromise[_0x7abe('0xb5')]()[_0x7abe('0xb6')](cmHopper[_0x7abe('0xbb')](_0x16c667))[_0x7abe('0xac')](loggerCatch(_0x7abe('0xbc')));};Dialer[_0x7abe('0x16')][_0x7abe('0xbd')]=function(_0x79f89b,_0x7bec92,_0x465b06){return BPromise[_0x7abe('0xb5')]()[_0x7abe('0xb6')](cmHopper['unlockContact'](_0x79f89b,_0x7bec92,_0x465b06))[_0x7abe('0xac')](loggerCatch(_0x7abe('0xbe')));};Dialer[_0x7abe('0x16')][_0x7abe('0xbf')]=function(_0x404192,_0x32dd6d,_0x25374c,_0xdbeec7){return BPromise['resolve']()['then'](cmHopper[_0x7abe('0xbf')](_0x404192,_0x32dd6d,_0x25374c,_0xdbeec7))[_0x7abe('0xac')](loggerCatch(_0x7abe('0xc0')));};Dialer['prototype']['getContactDialerIvr']=function(_0x49b04d,_0x326ed4,_0x445a6f){return BPromise['resolve']()['then'](cmHopper[_0x7abe('0xc1')](_0x49b04d,_0x326ed4,_0x445a6f))[_0x7abe('0xac')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x7abe('0x16')][_0x7abe('0xc2')]=function(_0x341ce1){return BPromise['resolve']()[_0x7abe('0xb6')](voiceQueueRt['getVoiceQueueRtPauses'](_0x341ce1))[_0x7abe('0xac')](loggerCatch(_0x7abe('0xc3')));};Dialer[_0x7abe('0x16')]['moveContactManagedDialer']=function(_0x21303b){return BPromise[_0x7abe('0xb5')]()['then'](cmHopper[_0x7abe('0xc4')](_0x21303b))['catch'](loggerCatch(_0x7abe('0xc5')));};Dialer[_0x7abe('0x16')]['createHistory']=function(_0x1970e7){return BPromise[_0x7abe('0xb5')]()['then'](cmHopperHistory[_0x7abe('0xc6')](_0x1970e7))[_0x7abe('0xac')](loggerCatch(_0x7abe('0xc7')));};Dialer[_0x7abe('0x16')]['updateOriginated']=function(_0x12358d){if(!_[_0x7abe('0x36')](_0x12358d)&&_0x12358d!==null){if(typeof _0x12358d[_0x7abe('0x6e')]!==_0x7abe('0x97')){if(_0x12358d[_0x7abe('0x6e')]>0x0){_0x12358d[_0x7abe('0x6e')]-=0x1;}else{logger[_0x7abe('0x95')](_0x7abe('0xc8'));}}}else{logger['error'](_0x7abe('0xc9'));}};Dialer['prototype']['loggerHandler']=function(_0x70b1ca,_0x5bc4d7){var _0x36afcd=this;return function(_0x5905b7){_0x36afcd['updateOriginated'](_0x5bc4d7);logger[_0x7abe('0x95')](_0x70b1ca,util['inspect'](_0x5905b7,{'showHidden':![],'depth':null}));};};Dialer[_0x7abe('0x16')]['emptyContact']=function(_0x494adb,_0x3cbfca,_0x462d5b){var _0x34436c={'state':0x19,'statedesc':'notFound'};this[_0x7abe('0xae')](_0x3cbfca);this[_0x7abe('0xca')](_[_0x7abe('0x8b')](_0x34436c,_[_0x7abe('0xcb')](_0x462d5b,[_0x7abe('0xcc'),'ListId','UserId','VoiceQueueId',_0x7abe('0xcd')])),_0x7abe('0xce'),_0x7abe('0xcf'));logger['error'](_0x494adb);};Dialer[_0x7abe('0x16')][_0x7abe('0xd0')]=function(_0x5a9ba3){return _0x5a9ba3==='Success';};Dialer[_0x7abe('0x16')]['isTrunkReachable']=function(_0x523916){return!_[_0x7abe('0x36')](_0x523916)&&_0x523916&&!_[_0x7abe('0x36')](_0x523916['name'])&&!_[_0x7abe('0x36')](_0x523916[_0x7abe('0xd1')])&&_0x523916[_0x7abe('0xd1')]&&(this['trunks'][util[_0x7abe('0x75')](_0x7abe('0xd2'),_0x523916[_0x7abe('0x3b')])][_0x7abe('0xaa')]===_0x7abe('0xd3')||this[_0x7abe('0x1c')][util[_0x7abe('0x75')](_0x7abe('0xd2'),_0x523916[_0x7abe('0x3b')])][_0x7abe('0xaa')]===_0x7abe('0xd4'));};Dialer['prototype'][_0x7abe('0xca')]=function(_0x3122c3,_0x36f13b,_0x4f5d40){this['createHistory'](_0x3122c3)[_0x7abe('0xac')](loggerCatch(_0x36f13b));this[_0x7abe('0xc4')](_0x3122c3)['catch'](loggerCatch(_0x4f5d40));};Dialer[_0x7abe('0x16')][_0x7abe('0x2f')]=function(_0x125132){var _0x19957a=this[_0x7abe('0x20')][_0x125132[_0x7abe('0xd5')]];var _0x30b7dc;if(!_['isNil'](_0x125132)&&!_[_0x7abe('0xd6')](_0x125132[_0x7abe('0xd7')])&&!_[_0x7abe('0xd6')](_0x125132[_0x7abe('0xd7')][_0x7abe('0xd8')])&&_0x125132[_0x7abe('0xd9')]===_0x7abe('0xda')&&_0x19957a){if(_0x19957a[_0x7abe('0x78')]!==_0x7abe('0x79')&&this[_0x7abe('0xaf')][_0x19957a['queue']][_0x7abe('0xdb')]&&_0x125132[_0x7abe('0xdc')]==='HANGUP'){delete this[_0x7abe('0x20')][_0x125132['uniqueid']];this['updateOriginated'](this[_0x7abe('0xaf')][_0x19957a['queue']]);this[_0x7abe('0xaf')][_0x19957a[_0x7abe('0xb0')]][_0x7abe('0x5d')]+=0x1;this['voiceQueues'][_0x19957a[_0x7abe('0xb0')]][_0x7abe('0x5c')]+=0x1;_0x30b7dc=new Hangup(_0x19957a,_0x125132);_0x30b7dc[_0x7abe('0xdd')]=0x12;_0x30b7dc['statedesc']='HangupInAMD';_0x30b7dc[_0x7abe('0xde')]=_0x7abe('0xdf');this[_0x7abe('0xca')](_0x30b7dc,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x19957a[_0x7abe('0x78')]!=='ivr'&&this['voiceQueues'][_0x19957a[_0x7abe('0xb0')]]['dialAMDActive']&&_0x125132[_0x7abe('0xdc')]==='MACHINE'){var _0x54f204=this;return new BPromise(function(_0x5368de,_0x5e7d7a){delete _0x54f204['uniqueId'][_0x125132[_0x7abe('0xd5')]];_0x54f204[_0x7abe('0xae')](_0x54f204['voiceQueues'][_0x19957a[_0x7abe('0xb0')]]);_0x54f204[_0x7abe('0xaf')][_0x19957a[_0x7abe('0xb0')]]['outboundAnswerCallsDay']+=0x1;_0x54f204[_0x7abe('0xaf')][_0x19957a[_0x7abe('0xb0')]][_0x7abe('0x5c')]+=0x1;var _0x23d9b6=_0x54f204[_0x7abe('0xaf')][_0x19957a['queue']];var _0x5125e8=new Hangup(_0x19957a,_0x125132);_0x5125e8['state']=0x13;_0x5125e8[_0x7abe('0xe0')]='Machine';_0x5125e8[_0x7abe('0xde')]='AMD';_0x5125e8[_0x7abe('0xe1')]+=0x1;_0x5125e8['countglobal']+=0x1;_0x5125e8[_0x7abe('0xe2')]=!![];_0x54f204['createHistory'](_0x5125e8)[_0x7abe('0xac')](loggerCatch(_0x7abe('0xe3')));if(_0x5125e8[_0x7abe('0xe4')]+_0x5125e8[_0x7abe('0xe5')]+_0x5125e8['countnoanswerretry']+_0x5125e8['countnosuchnumberretry']+_0x5125e8[_0x7abe('0xe6')]+_0x5125e8['countabandonedretry']+_0x5125e8['countmachineretry']+_0x5125e8[_0x7abe('0xe7')]>=_0x23d9b6[_0x7abe('0xe8')]){_0x54f204[_0x7abe('0xe9')](_0x5125e8,_0x5368de,_0x5e7d7a,_0x7abe('0xea'));}else{if(_0x5125e8[_0x7abe('0xe1')]>=_0x23d9b6[_0x7abe('0xeb')]){_0x54f204[_0x7abe('0xec')](_0x5125e8,_0x5368de,_0x5e7d7a,_0x7abe('0xed'));}else{_0x54f204['rescheduleContact']({'active':![],'countmachineretry':_0x5125e8[_0x7abe('0xe1')],'scheduledat':moment()[_0x7abe('0xee')](_0x23d9b6['dialMachineRetryFrequency'],_0x7abe('0xef'))[_0x7abe('0x75')](_0x7abe('0xf0')),'ContactId':_0x5125e8[_0x7abe('0xcc')],'ListId':_0x5125e8[_0x7abe('0xf1')],'VoiceQueueId':_0x5125e8['VoiceQueueId']||undefined,'CampaignId':_0x5125e8[_0x7abe('0xcd')]||undefined})[_0x7abe('0xac')](loggerCatch('[rescheduleContact][Machine]'));_0x5368de({'reschedule':0x1});}}});}if(_0x19957a[_0x7abe('0x78')]===_0x7abe('0x79')&&this[_0x7abe('0xb2')][_0x19957a[_0x7abe('0xb0')]][_0x7abe('0xdb')]&&_0x125132['value']===_0x7abe('0xf2')){delete this[_0x7abe('0x20')][_0x125132[_0x7abe('0xd5')]];this['updateOriginated'](this[_0x7abe('0xb2')][_0x19957a[_0x7abe('0xb0')]]);_0x30b7dc=new Hangup(_0x19957a,_0x125132);_0x30b7dc['state']=0x12;_0x30b7dc[_0x7abe('0xe0')]='HangupInAMD';_0x30b7dc[_0x7abe('0xde')]=_0x7abe('0xdf');this['saveInDb'](_0x30b7dc,_0x7abe('0xf3'),_0x7abe('0xf4'));}if(_0x19957a[_0x7abe('0x78')]===_0x7abe('0x79')&&this[_0x7abe('0xb2')][_0x19957a[_0x7abe('0xb0')]]['dialAMDActive']&&_0x125132[_0x7abe('0xdc')]===_0x7abe('0xf5')){var _0x54f204=this;return new BPromise(function(_0x182858,_0x2ef3b8){delete _0x54f204[_0x7abe('0x20')][_0x125132[_0x7abe('0xd5')]];_0x54f204[_0x7abe('0xae')](_0x54f204[_0x7abe('0xb2')][_0x19957a['queue']]);_0x54f204[_0x7abe('0xb2')][_0x19957a[_0x7abe('0xb0')]][_0x7abe('0x5d')]+=0x1;_0x54f204[_0x7abe('0xb2')][_0x19957a[_0x7abe('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1dda8e=_0x54f204[_0x7abe('0xb2')][_0x19957a[_0x7abe('0xb0')]];var _0x37ad1e=new Hangup(_0x19957a,_0x125132);_0x37ad1e[_0x7abe('0xdd')]=0x13;_0x37ad1e['statedesc']=_0x7abe('0xf6');_0x37ad1e[_0x7abe('0xde')]=_0x7abe('0xdf');_0x37ad1e[_0x7abe('0xe1')]+=0x1;_0x37ad1e[_0x7abe('0xf7')]+=0x1;_0x37ad1e[_0x7abe('0xe2')]=!![];_0x54f204['createHistory'](_0x37ad1e)['catch'](loggerCatch(_0x7abe('0xe3')));if(_0x37ad1e['countbusyretry']+_0x37ad1e[_0x7abe('0xe5')]+_0x37ad1e[_0x7abe('0xf8')]+_0x37ad1e[_0x7abe('0xf9')]+_0x37ad1e[_0x7abe('0xe6')]+_0x37ad1e[_0x7abe('0xfa')]+_0x37ad1e[_0x7abe('0xe1')]+_0x37ad1e[_0x7abe('0xe7')]>=_0x1dda8e[_0x7abe('0xe8')]){_0x54f204['stateGlobal'](_0x37ad1e,_0x182858,_0x2ef3b8,'reason19\x20machine....');}else{if(_0x37ad1e[_0x7abe('0xe1')]>=_0x1dda8e[_0x7abe('0xeb')]){_0x54f204[_0x7abe('0xec')](_0x37ad1e,_0x182858,_0x2ef3b8,_0x7abe('0xed'));}else{_0x54f204['rescheduleContact']({'active':![],'countmachineretry':_0x37ad1e[_0x7abe('0xe1')],'scheduledat':moment()[_0x7abe('0xee')](_0x1dda8e[_0x7abe('0xfb')],_0x7abe('0xef'))[_0x7abe('0x75')](_0x7abe('0xf0')),'ContactId':_0x37ad1e['ContactId'],'ListId':_0x37ad1e[_0x7abe('0xf1')],'VoiceQueueId':_0x37ad1e[_0x7abe('0xfc')]||undefined,'CampaignId':_0x37ad1e['CampaignId']||undefined})[_0x7abe('0xac')](loggerCatch(_0x7abe('0xfd')));_0x182858({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x7abe('0xfe')]=function(_0x462a9d){var _0x585de7=this[_0x7abe('0x20')][_0x462a9d[_0x7abe('0xd5')]];var _0x5752bd=this;var _0x4c97a7;if(_0x585de7&&_0x585de7[_0x7abe('0x78')]===_0x7abe('0x79')){delete this[_0x7abe('0x20')][_0x462a9d[_0x7abe('0xd5')]];this['updateOriginated'](this[_0x7abe('0xb2')][_0x585de7[_0x7abe('0xb0')]]);this['campaigns'][_0x585de7['queue']][_0x7abe('0xff')]+=0x1;_0x4c97a7=new Hangup(_0x585de7,_0x462a9d);this[_0x7abe('0xc6')](_0x4c97a7)[_0x7abe('0xac')](loggerCatch(_0x7abe('0x100')));this[_0x7abe('0xc4')](_0x4c97a7)[_0x7abe('0xac')](loggerCatch('[syncHangupIvr]'));}if(_0x585de7&&_0x585de7[_0x7abe('0x78')]!==_0x7abe('0x79')&&isNotNull(this[_0x7abe('0xaf')][_0x585de7[_0x7abe('0xb0')]][_0x7abe('0x101')])){delete this[_0x7abe('0x20')][_0x462a9d[_0x7abe('0xd5')]];this['updateOriginated'](this[_0x7abe('0xaf')][_0x585de7[_0x7abe('0xb0')]]);this[_0x7abe('0xaf')][_0x585de7[_0x7abe('0xb0')]]['outboundAnswerCallsDay']+=0x1;this[_0x7abe('0xaf')][_0x585de7[_0x7abe('0xb0')]][_0x7abe('0x5c')]+=0x1;_0x4c97a7=new Hangup(_0x585de7,_0x462a9d);_0x4c97a7['state']=0x10;_0x4c97a7['statedesc']='AnswerAGI';_0x4c97a7[_0x7abe('0xde')]='AGI';this[_0x7abe('0xc6')](_0x4c97a7)[_0x7abe('0xac')](loggerCatch(_0x7abe('0x100')));this[_0x7abe('0xc4')](_0x4c97a7)[_0x7abe('0xac')](loggerCatch(_0x7abe('0x102')));}if(_0x585de7&&_0x585de7['type']!==_0x7abe('0x79')&&!isNotNull(this[_0x7abe('0xaf')][_0x585de7['queue']][_0x7abe('0x101')])){delete this[_0x7abe('0x20')][_0x462a9d[_0x7abe('0xd5')]];this[_0x7abe('0xae')](this[_0x7abe('0xaf')][_0x585de7[_0x7abe('0xb0')]]);this[_0x7abe('0xaf')][_0x585de7['queue']][_0x7abe('0x65')]+=0x1;_0x4c97a7=new Hangup(_0x585de7,_0x462a9d);_0x4c97a7[_0x7abe('0xdd')]=0xc;_0x4c97a7['statedesc']=_0x462a9d['cause-txt'];_0x4c97a7[_0x7abe('0xde')]=_0x7abe('0x103');this[_0x7abe('0xc6')](_0x4c97a7)['catch'](loggerCatch(_0x7abe('0x100')));this[_0x7abe('0xc4')](_0x4c97a7)[_0x7abe('0xac')](loggerCatch(_0x7abe('0x102')));}};Dialer[_0x7abe('0x16')][_0x7abe('0x2b')]=function(_0x288e23){var _0x513f06=this[_0x7abe('0x20')][_0x288e23[_0x7abe('0xd5')]];var _0x10237d=this;if(this[_0x7abe('0xaf')][_0x288e23[_0x7abe('0xb0')]]){if(_0x513f06&&_0x513f06[_0x7abe('0x78')]!==_0x7abe('0x79')){delete this[_0x7abe('0x20')][_0x288e23['uniqueid']];this[_0x7abe('0xaf')][_0x288e23[_0x7abe('0xb0')]]['outboundAnswerCallsDay']+=0x1;var _0x54627e=new AgentComplete(_0x513f06,_0x288e23);if(_0x288e23[_0x7abe('0x104')]===_0x7abe('0x105')){_0x54627e['agiafterat']=this[_0x7abe('0xaf')][_0x288e23[_0x7abe('0xb0')]]['dialQueueProject2']&&this['voiceQueues'][_0x288e23[_0x7abe('0xb0')]][_0x7abe('0x106')]?moment()[_0x7abe('0x75')](_0x7abe('0xf0')):undefined;}this[_0x7abe('0xc6')](_0x54627e)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x54627e)['catch'](loggerCatch(_0x7abe('0x107')));}}};Dialer[_0x7abe('0x16')]['syncAgentConnect']=function(_0x5aae25){if(this[_0x7abe('0xaf')][_0x5aae25['queue']]){if(this['uniqueId'][_0x5aae25[_0x7abe('0xd5')]]&&this[_0x7abe('0x20')][_0x5aae25[_0x7abe('0xd5')]]['type']!==_0x7abe('0x79')){this[_0x7abe('0xae')](this[_0x7abe('0xaf')][_0x5aae25[_0x7abe('0xb0')]]);this[_0x7abe('0x20')][_0x5aae25['uniqueid']]['answertime']=moment()['format'](_0x7abe('0xf0'));}}};Dialer['prototype'][_0x7abe('0x108')]=function(_0x2cb0f7){this[_0x7abe('0xc6')](_0x2cb0f7)['catch'](loggerCatch(_0x7abe('0x109')));this['moveContactManagedDialer'](_0x2cb0f7)['catch'](loggerCatch(_0x7abe('0x10a')));};Dialer['prototype'][_0x7abe('0x28')]=function(_0x230b15){var _0x32c6c2=this['uniqueId'][_0x230b15[_0x7abe('0xd5')]];var _0x18d38e=this;if(this[_0x7abe('0xaf')][_0x230b15['queue']]){if(_0x32c6c2&&_0x32c6c2[_0x7abe('0x78')]!==_0x7abe('0x79')){delete this[_0x7abe('0x20')][_0x230b15[_0x7abe('0xd5')]];this[_0x7abe('0xae')](this['voiceQueues'][_0x230b15['queue']]);_0x32c6c2[_0x7abe('0x10b')]=moment()[_0x7abe('0x75')](_0x7abe('0xf0'));var _0x490eee=new QueueCallerAbandon(_0x32c6c2,_0x230b15);if(getSeconds(_0x32c6c2[_0x7abe('0x10b')],_0x32c6c2[_0x7abe('0x10c')])>=_0x32c6c2[_0x7abe('0x10d')]){this[_0x7abe('0xaf')][_0x230b15['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x7abe('0xaf')][_0x230b15[_0x7abe('0xb0')]][_0x7abe('0x62')]+=0x1;this['voiceQueues'][_0x230b15[_0x7abe('0xb0')]][_0x7abe('0x10e')]+=0x1;_0x490eee[_0x7abe('0xdd')]=0xa;_0x490eee['statedesc']=_0x7abe('0x10f');_0x490eee[_0x7abe('0x110')]=_0x7abe('0x111');_0x490eee[_0x7abe('0x112')]=this[_0x7abe('0xaf')][_0x230b15[_0x7abe('0xb0')]][_0x7abe('0x113')]?moment()[_0x7abe('0x75')](_0x7abe('0xf0')):undefined;_0x490eee[_0x7abe('0xe6')]+=0x1;_0x490eee[_0x7abe('0xf7')]+=0x1;if(_0x490eee[_0x7abe('0xe6')]>=this[_0x7abe('0xaf')][_0x230b15['queue']][_0x7abe('0x114')]){this[_0x7abe('0x108')](_0x490eee);}else{this[_0x7abe('0xbb')]({'active':![],'countdropretry':_0x490eee[_0x7abe('0xe6')],'scheduledat':moment()[_0x7abe('0xee')](this['voiceQueues'][_0x230b15[_0x7abe('0xb0')]]['dialDropRetryFrequency'],_0x7abe('0xef'))[_0x7abe('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x32c6c2[_0x7abe('0xcc')],'ListId':_0x32c6c2['ListId'],'VoiceQueueId':_0x32c6c2[_0x7abe('0xfc')]||undefined,'CampaignId':_0x32c6c2['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x51c75a=new History(_0x490eee);_0x51c75a[_0x7abe('0xdd')]=0xa;_0x51c75a[_0x7abe('0xe0')]=_0x7abe('0x10f');_0x51c75a[_0x7abe('0xa6')]=moment()[_0x7abe('0x75')]('YYYY-MM-DD\x20HH:mm:ss');_0x51c75a['endtime']=_0x51c75a['starttime'];_0x51c75a['calleridname']=_0x490eee[_0x7abe('0x115')];_0x51c75a['calleridnum']=_0x490eee[_0x7abe('0x116')];this[_0x7abe('0xc6')](_0x51c75a)['catch'](loggerCatch(_0x7abe('0x117')));}}else{this[_0x7abe('0xaf')][_0x230b15[_0x7abe('0xb0')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x230b15[_0x7abe('0xb0')]][_0x7abe('0x61')]+=0x1;_0x490eee[_0x7abe('0xdd')]=0xb;_0x490eee[_0x7abe('0xe0')]='Abandoned';_0x490eee[_0x7abe('0x110')]=_0x7abe('0x118');_0x490eee[_0x7abe('0xfa')]+=0x1;_0x490eee[_0x7abe('0xf7')]+=0x1;if(_0x490eee[_0x7abe('0xfa')]>=this[_0x7abe('0xaf')][_0x230b15[_0x7abe('0xb0')]][_0x7abe('0x119')]){this[_0x7abe('0x108')](_0x490eee);}else{this[_0x7abe('0xbb')]({'active':![],'countabandonedretry':_0x490eee[_0x7abe('0xfa')],'scheduledat':moment()[_0x7abe('0xee')](this[_0x7abe('0xaf')][_0x230b15[_0x7abe('0xb0')]][_0x7abe('0x11a')],_0x7abe('0xef'))[_0x7abe('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x32c6c2[_0x7abe('0xcc')],'ListId':_0x32c6c2[_0x7abe('0xf1')],'VoiceQueueId':_0x32c6c2[_0x7abe('0xfc')]||undefined,'CampaignId':_0x32c6c2[_0x7abe('0xcd')]||undefined})[_0x7abe('0xac')](loggerCatch(_0x7abe('0x11b')));var _0x51c75a=new History(_0x490eee);_0x51c75a[_0x7abe('0xdd')]=0xb;_0x51c75a['statedesc']='Abandoned';_0x51c75a[_0x7abe('0xa6')]=moment()[_0x7abe('0x75')](_0x7abe('0xf0'));_0x51c75a[_0x7abe('0x11c')]=_0x51c75a[_0x7abe('0xa6')];_0x51c75a[_0x7abe('0x115')]=_0x490eee['calleridname'];_0x51c75a[_0x7abe('0x116')]=_0x490eee['calleridnum'];this[_0x7abe('0xc6')](_0x51c75a)[_0x7abe('0xac')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype']['syncNewExten']=function(_0x1cfe5f){if(this[_0x7abe('0x1f')][_0x1cfe5f[_0x7abe('0xd5')]]){this[_0x7abe('0x1f')][_0x1cfe5f['uniqueid']][_0x7abe('0xab')]=_0x1cfe5f[_0x7abe('0xab')];}if(this[_0x7abe('0x20')][_0x1cfe5f['uniqueid']]){this['uniqueId'][_0x1cfe5f[_0x7abe('0xd5')]][_0x7abe('0xab')]=_0x1cfe5f['channel'];}};Dialer[_0x7abe('0x16')]['syncQueueMember']=function(_0x32e250){if(strategy[this['voiceQueues'][this[_0x7abe('0x1f')][_0x32e250['actionid']][_0x7abe('0xb0')]][_0x7abe('0x49')]]===_0x7abe('0x15')){if(this[_0x7abe('0x1f')][_0x32e250[_0x7abe('0x11d')]]&&_['isNil'](this['actions'][_0x32e250[_0x7abe('0x11d')]]['locked'])&&_0x32e250[_0x7abe('0xaa')]==='1'&&_0x32e250['paused']==='0'){if(this['agents'][_0x32e250['stateinterface']]){if(!this['agents'][_0x32e250[_0x7abe('0x11e')]][_0x7abe('0x11f')]){this[_0x7abe('0x1b')][_0x32e250[_0x7abe('0x11e')]]['locked']=!![];this[_0x7abe('0x1f')][_0x32e250[_0x7abe('0x11d')]][_0x7abe('0x11f')]=!![];this[_0x7abe('0x1f')][_0x32e250['actionid']][_0x7abe('0x11e')]=_0x32e250[_0x7abe('0x11e')];}}}}else if((strategy[this[_0x7abe('0xaf')][this[_0x7abe('0x1f')][_0x32e250['actionid']][_0x7abe('0xb0')]][_0x7abe('0x49')]]||_0x7abe('0x120'))===_0x7abe('0x120')){if(this['actions'][_0x32e250[_0x7abe('0x11d')]]){if(this['agents'][_0x32e250[_0x7abe('0x11e')]]){this[_0x7abe('0x1f')][_0x32e250['actionid']][_0x7abe('0x11e')]=_0x32e250['stateinterface'];if(_[_0x7abe('0xd6')](this['queueBooked'][this[_0x7abe('0x1f')][_0x32e250[_0x7abe('0x11d')]][_0x7abe('0xb0')]])){this['queueBooked'][this[_0x7abe('0x1f')][_0x32e250[_0x7abe('0x11d')]][_0x7abe('0xb0')]]=[];}this['queueBooked'][this[_0x7abe('0x1f')][_0x32e250[_0x7abe('0x11d')]]['queue']]['push'](_[_0x7abe('0x8b')](_['pick'](this[_0x7abe('0x1f')][_0x32e250[_0x7abe('0x11d')]],[_0x7abe('0x121'),_0x7abe('0x11e')]),{'status':_0x32e250['status'],'paused':_0x32e250[_0x7abe('0x122')]}));}}}};function unlockQueueStatus(_0x29c110,_0x487cbe){setTimeout(function(){if(_['isUndefined'](_0x29c110[_0x7abe('0x123')])){loggerBooked[_0x7abe('0x95')](_0x7abe('0x124'),_0x487cbe);}_0x29c110[_0x7abe('0x123')]=!![];loggerBooked[_0x7abe('0x7d')]('[booked][unlockQueueStatus]',_0x487cbe,JSON[_0x7abe('0x44')](_[_0x7abe('0xcb')](_0x29c110,[_0x7abe('0x3b'),_0x7abe('0x123')])));},0x1f3);}Dialer[_0x7abe('0x16')]['syncQueueStatusComplete']=function(_0x3e8431){var _0x585439=this;var _0x481de4=_0x585439[_0x7abe('0xaf')][_0x585439[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]][_0x7abe('0xb0')]];if(strategy[this[_0x7abe('0xaf')][this[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]]['queue']][_0x7abe('0x49')]]==='roundrobin'){if(this[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]]&&this[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]][_0x7abe('0x11e')]){this['preview'][_0x7abe('0x125')](this['actions'][_0x3e8431['actionid']]['idHopper'],this[_0x7abe('0x1f')][_0x3e8431['actionid']][_0x7abe('0x11e')])[_0x7abe('0xac')](function(_0x3ca882){logger[_0x7abe('0x95')](_0x7abe('0x126'),util['inspect'](_0x3ca882,{'showHidden':![],'depth':null}));})[_0x7abe('0x127')](function(){_0x585439['updateOriginated'](_0x585439['voiceQueues'][_0x585439[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]][_0x7abe('0xb0')]]);_0x585439[_0x7abe('0x1b')][_0x585439[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]][_0x7abe('0x11e')]]['locked']=![];delete _0x585439[_0x7abe('0x1f')][_0x3e8431['actionid']];unlockQueueStatus(_0x481de4);});}else{this[_0x7abe('0xae')](this[_0x7abe('0xaf')][this[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]][_0x7abe('0xb0')]]);this[_0x7abe('0xbb')]({'active':![],'ContactId':this[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]]['ContactId'],'ListId':this['actions'][_0x3e8431[_0x7abe('0x11d')]]['ListId'],'VoiceQueueId':this[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]][_0x7abe('0xfc')]||undefined,'CampaignId':this[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]]['CampaignId']||undefined})[_0x7abe('0xac')](loggerCatch(_0x7abe('0x128')));delete this[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]];unlockQueueStatus(_0x481de4);}}else if((strategy[this[_0x7abe('0xaf')][this[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]][_0x7abe('0xb0')]][_0x7abe('0x49')]]||_0x7abe('0x120'))==='rrmemory'){var _0x54f6b3;if(this[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]]&&!_[_0x7abe('0x40')](this[_0x7abe('0x23')][this['actions'][_0x3e8431[_0x7abe('0x11d')]]['queue']])){if(this[_0x7abe('0x24')][_0x585439[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]][_0x7abe('0xb0')]]){this['queueBookedRR'][_0x585439[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]]['queue']]=this[_0x7abe('0x24')][this['actions'][_0x3e8431[_0x7abe('0x11d')]][_0x7abe('0xb0')]]?this['queueBookedRR'][this[_0x7abe('0x1f')][_0x3e8431['actionid']]['queue']]:this[_0x7abe('0x23')][this['actions'][_0x3e8431[_0x7abe('0x11d')]][_0x7abe('0xb0')]]?this[_0x7abe('0x23')][this['actions'][_0x3e8431[_0x7abe('0x11d')]][_0x7abe('0xb0')]][_0x7abe('0x129')]||0x0:0x0;}this[_0x7abe('0x23')][this['actions'][_0x3e8431['actionid']][_0x7abe('0xb0')]][_0x7abe('0x129')]=this[_0x7abe('0x24')][this[_0x7abe('0x1f')][_0x3e8431[_0x7abe('0x11d')]][_0x7abe('0xb0')]];for(var _0x2e064a=0x0;_0x2e064a=0x0;})[_0x7abe('0xac')](myreject(_0x2d9258)));}}else{_0x111b59[_0x7abe('0x140')](ami[_0x7abe('0xa9')]({'action':_0x7abe('0x13d'),'command':util[_0x7abe('0x75')](_0x7abe('0x141'),_0x49a143,!_['isUndefined'](config[_0x7abe('0x13a')][_0x229480])?_0x229480:'')})[_0x7abe('0xb6')](function(_0x51a198){return _0x51a198[_0x7abe('0x142')][_0x7abe('0x13f')](_0x7abe('0x143'))>=0x0;})[_0x7abe('0xac')](myreject(_0x2d9258)));}BPromise[_0x7abe('0x144')](_0x111b59)[_0x7abe('0xb6')](function(_0x595443){var _0x34d143=_[_0x7abe('0x145')](_0x595443);if(_0x34d143){return _0x41ea64(_0x34d143);}else{_0x52d6d5[_0x7abe('0x37')]=_0x366275?_0x7abe('0x146'):_0x7abe('0x147');return _0x2d9258(msgResponse(_0x7abe('0x148'),_0x7abe('0x138'),_0x7abe('0x149')+_0x366275+'\x20'+_0x9a409d+_0x7abe('0x14a')+util[_0x7abe('0x9a')](_0x49a143,{'showHidden':![],'depth':null})+_0x7abe('0x14b')+_0x229480));}})['catch'](function(_0x102b55){return _0x2d9258(msgResponse('ifTime',_0x7abe('0x138'),JSON[_0x7abe('0x44')](_0x102b55)));});});};Dialer[_0x7abe('0x16')]['checkDialMethod']=function(_0x252d43){var _0xf8e260=this;return function(){switch(_0x252d43[_0x7abe('0x57')]){case _0x7abe('0x14c'):freeVariablesPredictive(_0x252d43);_0xf8e260[_0x7abe('0x14d')](_0x252d43,0x1);break;case _0x7abe('0x14e'):freeVariablesPredictive(_0x252d43);_0xf8e260[_0x7abe('0x14d')](_0x252d43,_0x252d43['dialPowerLevel']);break;case _0x7abe('0x9'):_0xf8e260[_0x7abe('0x9')](_0x252d43);break;case _0x7abe('0x8'):freeVariablesPredictive(_0x252d43);_0xf8e260['handlePower'](_0x252d43,0x1);break;default:freeVariablesPredictive(_0x252d43);logger['error'](_0x7abe('0x14f'),_0x252d43[_0x7abe('0x3b')],'method\x20not\x20recognized');}};};Dialer[_0x7abe('0x16')][_0x7abe('0x150')]=function(_0xf69406){var _0x462b67=this;return function(){_0x462b67[_0x7abe('0x151')](_0xf69406);};};Dialer[_0x7abe('0x16')][_0x7abe('0x2d')]=function(_0x41caee){var _0x14d010=this;if(isNotPreview(_0x41caee[_0x7abe('0x57')])){if(isVoiceQueueOutbound(_0x41caee[_0x7abe('0x78')])&&isActive(_0x41caee[_0x7abe('0x56')])){_0x41caee[_0x7abe('0xa0')]=!![];BPromise[_0x7abe('0xb5')]()[_0x7abe('0xb6')](checkIsLoggedIn(_0x41caee,_0x41caee[_0x7abe('0x4c')]))[_0x7abe('0xb6')](checkIsActive(_0x41caee,_0x41caee['dialActive']))[_0x7abe('0xb6')](checkInterval(_0x41caee))[_0x7abe('0xb6')](_0x14d010[_0x7abe('0x152')](_0x41caee))['then'](_0x14d010[_0x7abe('0x153')](_0x41caee[_0x7abe('0x154')],_0x41caee[_0x7abe('0x155')],_0x41caee['name'],_0x41caee))[_0x7abe('0xb6')](_0x14d010[_0x7abe('0x137')](_0x41caee[_0x7abe('0x3d')],_0x41caee[_0x7abe('0x155')],_0x41caee['name'],_0x41caee))['then'](_0x14d010[_0x7abe('0x156')](_0x41caee))['catch'](loggerCatchQueueSummary(_0x7abe('0x157'),_0x41caee));}else{notSendMessagesQueue(_0x41caee);}}else{freeVariablesPredictive(_0x41caee);}};Dialer['prototype'][_0x7abe('0x158')]=function(){var _0x375edc=this;var _0x23bb9b;for(var _0x3cd515 in this[_0x7abe('0xb2')]){if(typeof this['campaigns'][_0x3cd515]!=='undefined'){_0x23bb9b=this[_0x7abe('0xb2')][_0x3cd515];if(isCampaignIvr(_0x23bb9b[_0x7abe('0x78')])&&isActive(_0x23bb9b[_0x7abe('0xd1')])){_0x23bb9b[_0x7abe('0xa0')]=!![];BPromise[_0x7abe('0xb5')]()['then'](checkIsActive(_0x23bb9b,_0x23bb9b['active']))[_0x7abe('0xb6')](checkInterval(_0x23bb9b))[_0x7abe('0xb6')](_0x375edc['checkIsTrunkReachable'](_0x23bb9b))[_0x7abe('0xb6')](_0x375edc[_0x7abe('0x153')](_0x23bb9b[_0x7abe('0x154')],_0x23bb9b['dialTimezone'],_0x23bb9b[_0x7abe('0x3b')],_0x23bb9b))[_0x7abe('0xb6')](_0x375edc[_0x7abe('0x137')](_0x23bb9b['Interval'],_0x23bb9b[_0x7abe('0x155')],_0x23bb9b[_0x7abe('0x3b')],_0x23bb9b))['then'](_0x375edc[_0x7abe('0x150')](_0x23bb9b))[_0x7abe('0xac')](loggerCatchQueueSummary(_0x7abe('0x159'),_0x23bb9b));}else{notSendMessagesCampaign(_0x23bb9b);}}}};function getCallerIdRandom(_0x97f4f1,_0x112edf){var _0x5d5f58;var _0x11da3f;var _0x355558;if(_0x112edf<=0x0){_0x112edf=0x1;}_0x5d5f58=new RegExp(_0x7abe('0x15a')+_0x112edf+'}$');_0x11da3f=Math[_0x7abe('0x15b')](0xa,_0x112edf-0x1);_0x355558=Math['pow'](0xa,_0x112edf)-0x1;return util['format']('%s',_[_0x7abe('0x15c')](_0x97f4f1,_0x5d5f58,_[_0x7abe('0x15d')](_0x11da3f,_0x355558)));}function extractCalleridName(_0x2302fd){var _0x339272=_0x2302fd['match'](/"(.*?)"/);return _0x339272?_0x339272[0x1]:_0x2302fd;}function extractCalleridNumber(_0x1ec4ba){var _0x477bcf=_0x1ec4ba[_0x7abe('0x15e')](/<(.*?)>/);return _0x477bcf?_0x477bcf[0x1]:_0x1ec4ba;}Dialer[_0x7abe('0x16')]['actionOriginate']=function(_0x42b3ef,_0x22cb8d){var _0x520b4d=this;var _0x298643=uuid['v4']();this['actions'][_0x298643]=new Action(_0x42b3ef,_0x22cb8d,_0x298643);return new BPromise(function(_0x158f01,_0x2bdc89){if(_[_0x7abe('0x36')](_0x42b3ef)&&typeof _0x42b3ef!==_0x7abe('0x15f')){return _0x2bdc89(msgResponse(_0x7abe('0x160'),_0x7abe('0x138'),_0x7abe('0x161')));}if(_[_0x7abe('0x36')](_0x22cb8d[_0x7abe('0x162')][_0x7abe('0x163')])||_0x22cb8d[_0x7abe('0x162')][_0x7abe('0x163')]===null){return _0x2bdc89(msgResponse(_0x7abe('0x160'),_0x7abe('0x138'),'contact\x20is\x20undefine'));}var _0x307c4e={'XMD-CALLERID':_0x520b4d[_0x7abe('0x1f')][_0x298643][_0x7abe('0x164')](),'XMD-AGI':_0x42b3ef['dialQueueProject']?util[_0x7abe('0x75')](_0x7abe('0x165'),ipAgi,_0x42b3ef[_0x7abe('0x101')]):_0x7abe('0x166'),'XMD-AGIAFTER':_0x42b3ef[_0x7abe('0x113')]?util[_0x7abe('0x75')](_0x7abe('0x165'),ipAgi,_0x42b3ef[_0x7abe('0x113')]):_0x7abe('0x166'),'XMD-QUEUE':_0x42b3ef['type']===_0x7abe('0x48')?util[_0x7abe('0x75')](_0x7abe('0x167'),_0x42b3ef['name'],_0x42b3ef[_0x7abe('0x168')]||'',_0x42b3ef[_0x7abe('0x106')]?'c':'',_0x42b3ef['dialQueueTimeout']||0x3):_0x7abe('0x166'),'XMD-CONTACTID':_0x22cb8d[_0x7abe('0xcc')],'XMD-CDRTYPE':_0x7abe('0x169'),'CALLERID(all)':_0x520b4d[_0x7abe('0x1f')][_0x298643][_0x7abe('0x164')](),'XMD-AMD':_0x42b3ef[_0x7abe('0xdb')]?_0x7abe('0x16a'):_0x7abe('0x166'),'XMD-DESTINATION':_0x7abe('0xda')};if(_0x42b3ef['dialAMDActive']){_0x307c4e[_0x7abe('0x16b')]=_0x42b3ef[_0x7abe('0x16c')]||0x9c4;_0x307c4e['XMD-AMDGREETING']=_0x42b3ef['dialAMDGreeting']||0x5dc;_0x307c4e[_0x7abe('0x16d')]=_0x42b3ef[_0x7abe('0x16e')]||0x320;_0x307c4e[_0x7abe('0x16f')]=_0x42b3ef[_0x7abe('0x170')]||0x1388;_0x307c4e[_0x7abe('0x171')]=_0x42b3ef[_0x7abe('0x172')]||0x64;_0x307c4e[_0x7abe('0x173')]=_0x42b3ef['dialAMDBetweenWordsSilence']||0x32;_0x307c4e['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x42b3ef[_0x7abe('0x174')]||0x3;_0x307c4e['XMD-AMDSILENCETHRESHOLD']=_0x42b3ef[_0x7abe('0x175')]||0x100;_0x307c4e['XMD-AMDMAXIMUMWORDLENGTH']=_0x42b3ef[_0x7abe('0x176')]||0x1388;}if(_0x42b3ef[_0x7abe('0x78')]===_0x7abe('0x48')){_0x307c4e[_0x7abe('0x177')]=_0x22cb8d[_0x7abe('0xfc')];}else{_0x307c4e[_0x7abe('0x178')]=_0x22cb8d['CampaignId'];}for(var _0x4d5e79 in _0x22cb8d[_0x7abe('0x162')]){if(typeof _0x22cb8d[_0x7abe('0x162')][_0x4d5e79]!==_0x7abe('0x97')){if(isNotNull(_0x22cb8d['Contact'][_0x4d5e79])&&_0x4d5e79!=='id'&&_0x4d5e79!==_0x7abe('0x179')&&_0x4d5e79!==_0x7abe('0x17a')&&_0x4d5e79!=='updatedAt'){_0x307c4e[util[_0x7abe('0x75')](_0x7abe('0x17b'),_0x7abe('0x17c'),_[_0x7abe('0x17d')](_0x4d5e79))]=_0x22cb8d[_0x7abe('0x162')][_0x4d5e79];}}}var _0x44abca=_0x520b4d[_0x7abe('0x133')](_0x42b3ef[_0x7abe('0x73')])?getCallerId(_0x42b3ef[_0x7abe('0x73')][_0x7abe('0x74')],_0x42b3ef[_0x7abe('0x58')],_0x42b3ef[_0x7abe('0x17e')]>0x0?getCallerIdRandom(_0x42b3ef[_0x7abe('0x59')],_0x42b3ef['dialRandomLastDigitCallerIdNumber']):_0x42b3ef[_0x7abe('0x59')]):getCallerId(_[_0x7abe('0xd6')](_0x42b3ef[_0x7abe('0x134')])?_0x42b3ef[_0x7abe('0x73')][_0x7abe('0x74')]:_0x42b3ef['TrunkBackup'][_0x7abe('0x74')],_0x42b3ef[_0x7abe('0x58')],_0x42b3ef[_0x7abe('0x17e')]>0x0?getCallerIdRandom(_0x42b3ef[_0x7abe('0x59')],_0x42b3ef[_0x7abe('0x17e')]):_0x42b3ef['dialOriginateCallerIdNumber']);if(_0x44abca){_0x307c4e[_0x7abe('0x17f')]=_0x520b4d[_0x7abe('0x1f')][_0x298643]['originatecalleridname']=extractCalleridName(_0x44abca);_0x307c4e[_0x7abe('0x180')]=_0x520b4d[_0x7abe('0x1f')][_0x298643]['originatecalleridnum']=extractCalleridNumber(_0x44abca);}return ami[_0x7abe('0xa9')]({'actionid':_0x298643,'action':_0x7abe('0x160'),'channel':_0x520b4d[_0x7abe('0x133')](_0x42b3ef['Trunk'])?util['format'](_0x7abe('0x181'),_0x42b3ef['Trunk']['name'],isNotNull(_0x42b3ef[_0x7abe('0x5b')])?_0x42b3ef[_0x7abe('0x5b')]['trim']()||'':'',_0x42b3ef[_0x7abe('0x182')]>0x0?_0x22cb8d['Contact']['phone']['substring'](_0x42b3ef[_0x7abe('0x182')]):_0x22cb8d[_0x7abe('0x162')][_0x7abe('0x163')]):util[_0x7abe('0x75')]('SIP/%s/%s%s',_[_0x7abe('0xd6')](_0x42b3ef[_0x7abe('0x134')])?_0x42b3ef[_0x7abe('0x73')][_0x7abe('0x3b')]:_0x42b3ef[_0x7abe('0x134')][_0x7abe('0x3b')],isNotNull(_0x42b3ef[_0x7abe('0x5b')])?_0x42b3ef[_0x7abe('0x5b')][_0x7abe('0x183')]()||'':'',_0x42b3ef[_0x7abe('0x182')]>0x0?_0x22cb8d[_0x7abe('0x162')][_0x7abe('0x163')][_0x7abe('0x184')](_0x42b3ef[_0x7abe('0x182')]):_0x22cb8d[_0x7abe('0x162')]['phone']),'callerid':_0x44abca,'Exten':_0x7abe('0xda'),'Context':_0x7abe('0x185'),'Priority':'1','variable':_0x307c4e,'timeout':(_0x42b3ef[_0x7abe('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x298643})[_0x7abe('0xb6')](function(_0x2b8396){return _0x158f01(_0x2b8396);})['catch'](function(_0x340564){_0x42b3ef[_0x7abe('0x63')]+=0x1;var _0x96b3c5=new History(_0x520b4d[_0x7abe('0x1f')][_0x298643]);logger[_0x7abe('0x95')](util['format'](_0x7abe('0x186'),JSON[_0x7abe('0x44')](_0x340564)));_0x96b3c5[_0x7abe('0xdd')]=0xe;_0x96b3c5['statedesc']=_0x7abe('0x187');_0x96b3c5[_0x7abe('0xa6')]=moment()[_0x7abe('0x75')]('YYYY-MM-DD\x20HH:mm:ss');_0x96b3c5[_0x7abe('0x11c')]=_0x96b3c5[_0x7abe('0xa6')];_0x520b4d[_0x7abe('0xc6')](_0x96b3c5)[_0x7abe('0xac')](loggerCatch(_0x7abe('0x188')));_0x520b4d['moveContactManagedDialer'](_0x96b3c5)['catch'](loggerCatch('[originate][error]'))[_0x7abe('0x127')](function(){delete _0x520b4d[_0x7abe('0x1f')][_0x298643];return _0x2bdc89(msgResponse(_0x7abe('0x160'),_0x7abe('0x43'),_0x7abe('0x189')));});});});};Dialer[_0x7abe('0x16')][_0x7abe('0x29')]=function(_0x57ff74){var _0x461d36=this[_0x7abe('0x1f')][_0x57ff74[_0x7abe('0x11d')]];if(_0x461d36){delete this['actions'][_0x57ff74[_0x7abe('0x11d')]];_0x461d36[_0x7abe('0x10c')]=moment()[_0x7abe('0x75')](_0x7abe('0xf0'));var _0x329d0f=_0x461d36[_0x7abe('0x78')]===_0x7abe('0x79')?this[_0x7abe('0xb2')][_0x461d36[_0x7abe('0xb0')]]:this[_0x7abe('0xaf')][_0x461d36[_0x7abe('0x18a')]()];if(!this[_0x7abe('0xd0')](_0x57ff74[_0x7abe('0x18b')])){this[_0x7abe('0xae')](_0x329d0f);return this['callProgressDetecting'](_0x461d36,_0x329d0f,_0x57ff74)['catch'](loggerCatch(_0x7abe('0x18c')));}this[_0x7abe('0x20')][_0x57ff74['uniqueid']]=_0x461d36;}};Dialer[_0x7abe('0x16')][_0x7abe('0x18d')]=function(_0x231b25,_0x2498dc,_0x10542a){var _0x141c6d=new History(_0x2498dc);if(_0x141c6d[_0x7abe('0xe4')]+_0x141c6d[_0x7abe('0xe5')]+_0x141c6d[_0x7abe('0xf8')]+_0x141c6d['countnosuchnumberretry']+_0x141c6d[_0x7abe('0xe6')]+_0x141c6d['countabandonedretry']+_0x141c6d[_0x7abe('0xe1')]+_0x141c6d[_0x7abe('0xe7')]>=_0x10542a[_0x7abe('0xe8')]-0x1){return!![];}switch(_0x231b25){case 0x3:if(_0x141c6d[_0x7abe('0xf8')]>=_0x10542a[_0x7abe('0x18e')]-0x1){return!![];}this[_0x7abe('0xbb')]({'active':![],'countnoanswerretry':_0x141c6d[_0x7abe('0xf8')]+=0x1,'scheduledat':moment()['add'](_0x10542a[_0x7abe('0x18f')],_0x7abe('0xef'))[_0x7abe('0x75')](_0x7abe('0xf0')),'ContactId':_0x141c6d[_0x7abe('0xcc')],'ListId':_0x141c6d[_0x7abe('0xf1')],'VoiceQueueId':_0x141c6d['VoiceQueueId']||undefined,'CampaignId':_0x141c6d[_0x7abe('0xcd')]||undefined})[_0x7abe('0xac')](loggerCatch(_0x7abe('0x190')));break;case 0x5:if(_0x141c6d[_0x7abe('0xe4')]>=_0x10542a['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x141c6d[_0x7abe('0xe4')]+=0x1,'scheduledat':moment()[_0x7abe('0xee')](_0x10542a[_0x7abe('0x191')],_0x7abe('0xef'))[_0x7abe('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x141c6d[_0x7abe('0xcc')],'ListId':_0x141c6d['ListId'],'VoiceQueueId':_0x141c6d[_0x7abe('0xfc')]||undefined,'CampaignId':_0x141c6d[_0x7abe('0xcd')]||undefined})['catch'](loggerCatch(_0x7abe('0x192')));break;case 0x8:if(_0x141c6d[_0x7abe('0xe5')]>=_0x10542a['dialCongestionMaxRetry']-0x1){return!![];}this[_0x7abe('0xbb')]({'active':![],'countcongestionretry':_0x141c6d[_0x7abe('0xe5')]+=0x1,'scheduledat':moment()[_0x7abe('0xee')](_0x10542a['dialCongestionRetryFrequency'],'minutes')[_0x7abe('0x75')](_0x7abe('0xf0')),'ContactId':_0x141c6d[_0x7abe('0xcc')],'ListId':_0x141c6d[_0x7abe('0xf1')],'VoiceQueueId':_0x141c6d[_0x7abe('0xfc')]||undefined,'CampaignId':_0x141c6d[_0x7abe('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x141c6d['countnosuchnumberretry']>=_0x10542a[_0x7abe('0x193')]-0x1){return!![];}else{this[_0x7abe('0xbb')]({'active':![],'countnosuchnumberretry':_0x141c6d[_0x7abe('0xf9')]+=0x1,'scheduledat':moment()[_0x7abe('0xee')](_0x10542a['dialNoSuchNumberRetryFrequency'],_0x7abe('0xef'))['format'](_0x7abe('0xf0')),'ContactId':_0x141c6d['ContactId'],'ListId':_0x141c6d[_0x7abe('0xf1')],'VoiceQueueId':_0x141c6d['VoiceQueueId']||undefined,'CampaignId':_0x141c6d[_0x7abe('0xcd')]||undefined})[_0x7abe('0xac')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x141c6d[_0x7abe('0xe6')]>=_0x10542a[_0x7abe('0x114')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x141c6d[_0x7abe('0xe6')]+=0x1,'scheduledat':moment()[_0x7abe('0xee')](_0x10542a['dialDropRetryFrequency'],_0x7abe('0xef'))[_0x7abe('0x75')](_0x7abe('0xf0')),'ContactId':_0x141c6d[_0x7abe('0xcc')],'ListId':_0x141c6d[_0x7abe('0xf1')],'VoiceQueueId':_0x141c6d[_0x7abe('0xfc')]||undefined,'CampaignId':_0x141c6d[_0x7abe('0xcd')]||undefined})[_0x7abe('0xac')](loggerCatch(_0x7abe('0x194')));break;case 0xb:if(_0x141c6d['countabandonedretry']>=_0x10542a[_0x7abe('0x119')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x141c6d[_0x7abe('0xfa')]+=0x1,'scheduledat':moment()[_0x7abe('0xee')](_0x10542a[_0x7abe('0x11a')],_0x7abe('0xef'))[_0x7abe('0x75')](_0x7abe('0xf0')),'ContactId':_0x141c6d[_0x7abe('0xcc')],'ListId':_0x141c6d['ListId'],'VoiceQueueId':_0x141c6d['VoiceQueueId']||undefined,'CampaignId':_0x141c6d[_0x7abe('0xcd')]||undefined})['catch'](loggerCatch(_0x7abe('0x11b')));break;case 0x13:if(_0x141c6d[_0x7abe('0xe1')]>=_0x10542a[_0x7abe('0xeb')]-0x1){return!![];}this[_0x7abe('0xbb')]({'active':![],'countmachineretry':_0x141c6d['countmachineretry']+=0x1,'scheduledat':moment()[_0x7abe('0xee')](_0x10542a[_0x7abe('0xfb')],_0x7abe('0xef'))[_0x7abe('0x75')](_0x7abe('0xf0')),'ContactId':_0x141c6d[_0x7abe('0xcc')],'ListId':_0x141c6d[_0x7abe('0xf1')],'VoiceQueueId':_0x141c6d['VoiceQueueId']||undefined,'CampaignId':_0x141c6d[_0x7abe('0xcd')]||undefined})['catch'](loggerCatch(_0x7abe('0xfd')));break;case 0x14:if(_0x141c6d[_0x7abe('0xe7')]>=_0x10542a['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x7abe('0xbb')]({'active':![],'countagentrejectretry':_0x141c6d[_0x7abe('0xe7')]+=0x1,'scheduledat':moment()['add'](_0x10542a[_0x7abe('0x195')],_0x7abe('0xef'))[_0x7abe('0x75')](_0x7abe('0xf0')),'ContactId':_0x141c6d['ContactId'],'ListId':_0x141c6d[_0x7abe('0xf1')],'VoiceQueueId':_0x141c6d[_0x7abe('0xfc')]||undefined,'CampaignId':_0x141c6d['CampaignId']||undefined})['catch'](loggerCatch(_0x7abe('0x196')));break;default:return!![];}};Dialer['prototype'][_0x7abe('0x197')]=function(_0x1e5e98,_0x24b875,_0x1d7e9c){var _0x14d6f5=this;var _0x1ca87a=new History(_0x1e5e98);return new BPromise(function(_0x56a21c,_0x392168){if(_[_0x7abe('0x36')](_0x24b875)&&typeof _0x24b875!==_0x7abe('0x15f')){return _0x392168(msgResponse(_0x7abe('0x198'),'Failure',_0x7abe('0x199')));}if(_['isUndefined'](_0x1d7e9c)&&typeof _0x1d7e9c!==_0x7abe('0x15f')){return _0x392168(msgResponse(_0x7abe('0x198'),_0x7abe('0x138'),'evt\x20is\x20undefine'));}switch(_0x1d7e9c[_0x7abe('0x104')]){case'0':_0x24b875['outboundNoSuchCallsDay']+=0x1;_0x1ca87a[_0x7abe('0xdd')]=0x0;_0x1ca87a[_0x7abe('0xe0')]=_0x7abe('0x19a');_0x1ca87a[_0x7abe('0xf9')]+=0x1;_0x1ca87a[_0x7abe('0xf7')]+=0x1;ami[_0x7abe('0x47')](_0x7abe('0x19b'),ut[_0x7abe('0x19c')](_0x1e5e98,_0x7abe('0x19d')));_0x14d6f5[_0x7abe('0xc6')](_0x1ca87a)[_0x7abe('0xac')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x14d6f5[_0x7abe('0x18d')](0x0,_0x1e5e98,_0x24b875)){if(_0x1ca87a[_0x7abe('0xf9')]>=_0x24b875[_0x7abe('0x193')]){_0x14d6f5['createStateFinal'](_0x1ca87a,_0x56a21c,_0x392168,_0x7abe('0x19e'));}else{_0x14d6f5[_0x7abe('0xe9')](_0x1ca87a,_0x56a21c,_0x392168,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x24b875[_0x7abe('0x19f')]+=0x1;_0x1ca87a[_0x7abe('0xdd')]=0x3;_0x1ca87a[_0x7abe('0xe0')]=_0x7abe('0x1a0');_0x1ca87a[_0x7abe('0xf8')]+=0x1;_0x1ca87a['countglobal']+=0x1;ami[_0x7abe('0x47')](_0x7abe('0x1a1'),ut[_0x7abe('0x19c')](_0x1e5e98,'noanswer'));_0x14d6f5['createHistory'](_0x1ca87a)[_0x7abe('0xac')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x14d6f5[_0x7abe('0x18d')](0x3,_0x1e5e98,_0x24b875)){if(_0x1ca87a[_0x7abe('0xf8')]>=_0x24b875[_0x7abe('0x18e')]){_0x14d6f5['createStateFinal'](_0x1ca87a,_0x56a21c,_0x392168,_0x7abe('0x1a2'));}else{_0x14d6f5[_0x7abe('0xe9')](_0x1ca87a,_0x56a21c,_0x392168,_0x7abe('0x1a2'));}}break;case'5':_0x24b875[_0x7abe('0x5f')]+=0x1;_0x1ca87a[_0x7abe('0xdd')]=0x5;_0x1ca87a[_0x7abe('0xe0')]='Busy';_0x1ca87a[_0x7abe('0xe4')]+=0x1;_0x1ca87a[_0x7abe('0xf7')]+=0x1;ami[_0x7abe('0x47')](_0x7abe('0x1a3'),ut[_0x7abe('0x19c')](_0x1e5e98,'busy'));_0x14d6f5[_0x7abe('0xc6')](_0x1ca87a)[_0x7abe('0xac')](loggerCatch(_0x7abe('0x1a4')));if(_0x14d6f5[_0x7abe('0x18d')](0x5,_0x1e5e98,_0x24b875)){if(_0x1ca87a['countbusyretry']>=_0x24b875['dialBusyMaxRetry']){_0x14d6f5[_0x7abe('0xec')](_0x1ca87a,_0x56a21c,_0x392168,_0x7abe('0x1a5'));}else{_0x14d6f5[_0x7abe('0xe9')](_0x1ca87a,_0x56a21c,_0x392168,'reason\x205\x20busy');}}break;case'8':_0x24b875[_0x7abe('0x1a6')]+=0x1;_0x1ca87a['state']=0x8;_0x1ca87a[_0x7abe('0xe0')]=_0x7abe('0x1a7');_0x1ca87a[_0x7abe('0xe5')]+=0x1;_0x1ca87a['countglobal']+=0x1;ami['emit'](_0x7abe('0x1a8'),ut[_0x7abe('0x19c')](_0x1e5e98,_0x7abe('0x1a9')));_0x14d6f5[_0x7abe('0xc6')](_0x1ca87a)['catch'](loggerCatch(_0x7abe('0x1aa')));if(_0x14d6f5[_0x7abe('0x18d')](0x8,_0x1e5e98,_0x24b875)){if(_0x1ca87a['countcongestionretry']>=_0x24b875[_0x7abe('0x1ab')]){_0x14d6f5[_0x7abe('0xec')](_0x1ca87a,_0x56a21c,_0x392168,'reason\x208\x20congestion');}else{_0x14d6f5[_0x7abe('0xe9')](_0x1ca87a,_0x56a21c,_0x392168,'reason\x208\x20congestion');}}break;case'11':_0x24b875[_0x7abe('0x1ac')]+=0x1;_0x1ca87a[_0x7abe('0xdd')]=0xb;_0x1ca87a[_0x7abe('0xe0')]=_0x7abe('0x1ad');_0x1ca87a[_0x7abe('0xfa')]+=0x1;_0x1ca87a['countglobal']+=0x1;_0x14d6f5[_0x7abe('0xc6')](_0x1ca87a)[_0x7abe('0xac')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x14d6f5[_0x7abe('0x18d')](0xb,_0x1e5e98,_0x24b875)){if(_0x1ca87a[_0x7abe('0xfa')]>=_0x24b875[_0x7abe('0x119')]){_0x14d6f5['createStateFinal'](_0x1ca87a,_0x56a21c,_0x392168,_0x7abe('0x1ae'));}else{_0x14d6f5['stateGlobal'](_0x1ca87a,_0x56a21c,_0x392168,_0x7abe('0x1ae'));}}break;case'20':_0x24b875[_0x7abe('0x64')]+=0x1;_0x1ca87a[_0x7abe('0xdd')]=0x14;_0x1ca87a[_0x7abe('0xe0')]=_0x7abe('0x1af');_0x1ca87a[_0x7abe('0xe7')]+=0x1;_0x1ca87a['countglobal']+=0x1;ami['emit']('custom:agentreject',ut['buildObj'](_0x1e5e98,'agentreject'));_0x14d6f5['createHistory'](_0x1ca87a)[_0x7abe('0xac')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x14d6f5[_0x7abe('0x18d')](0x14,_0x1e5e98,_0x24b875)){if(_0x1ca87a[_0x7abe('0xe7')]>=_0x24b875[_0x7abe('0x1b0')]){_0x14d6f5[_0x7abe('0xec')](_0x1ca87a,_0x56a21c,_0x392168,_0x7abe('0x1b1'));}else{_0x14d6f5[_0x7abe('0xe9')](_0x1ca87a,_0x56a21c,_0x392168,_0x7abe('0x1b1'));}}break;default:_0x24b875['outboundUnknownCallsDay']+=0x1;_0x1ca87a['state']=0xc;_0x1ca87a[_0x7abe('0xe0')]=_0x1d7e9c[_0x7abe('0x104')];_0x14d6f5['createHistory'](_0x1ca87a)['catch'](loggerCatch(_0x7abe('0x1b2')));if(_0x14d6f5[_0x7abe('0x18d')](_0x1d7e9c['reason'],_0x1e5e98,_0x24b875)){if(_0x1ca87a['countbusyretry']+_0x1ca87a['countcongestionretry']+_0x1ca87a[_0x7abe('0xf8')]+_0x1ca87a[_0x7abe('0xf9')]+_0x1ca87a[_0x7abe('0xe6')]+_0x1ca87a[_0x7abe('0xfa')]+_0x1ca87a[_0x7abe('0xe1')]+_0x1ca87a[_0x7abe('0xe7')]>=_0x24b875[_0x7abe('0xe8')]){_0x14d6f5[_0x7abe('0xe9')](_0x1ca87a,_0x56a21c,_0x392168,_0x1d7e9c[_0x7abe('0x104')]);}else{_0x14d6f5['createStateFinal'](_0x1ca87a,_0x56a21c,_0x392168,_0x1d7e9c[_0x7abe('0x104')]);}}}});};Dialer[_0x7abe('0x16')]['stateGlobal']=function(_0x380965,_0x2dd8b8,_0x25f7a,_0x53b970){var _0x49c975=new Final(_0x380965);_0x49c975[_0x7abe('0xdd')]=0xf;_0x49c975[_0x7abe('0xe0')]=_0x7abe('0x1b3');this['createStateFinal'](_0x49c975,_0x2dd8b8,_0x25f7a,_0x53b970);};Dialer[_0x7abe('0x16')][_0x7abe('0xec')]=function(_0x2b9c35,_0x432847,_0x15af20,_0x2ba00b){this[_0x7abe('0xc4')](_0x2b9c35)[_0x7abe('0xb6')](function(){return _0x432847(msgResponse('[callProgressDetecting]',_0x7abe('0x1b4'),_0x2ba00b));})[_0x7abe('0xac')](function(){return _0x15af20(msgResponse('[moveContactManagedDialer][0]',_0x7abe('0x138'),_0x7abe('0x1b5')));});};Dialer[_0x7abe('0x16')]['predictive']=function(_0x84fa5c){var _0x18be68=_0x84fa5c['dialPredictiveOptimizationPercentage']/0x64;var _0x10f14a=_0x84fa5c[_0x7abe('0x62')]/(_0x84fa5c[_0x7abe('0x62')]+_0x84fa5c[_0x7abe('0x5d')]);var _0x11596b=Math['round'](_0x84fa5c['predictiveIntervalAvailable']*(_0x84fa5c[_0x7abe('0x1b6')]/0x64));var _0x135b8c=Math['round'](_0x84fa5c[_0x7abe('0x6c')]*(_0x84fa5c[_0x7abe('0x1b7')]/0x64));var _0x1d9479=_0x84fa5c[_0x7abe('0x4b')]+_0x84fa5c[_0x7abe('0x50')];var _0x32b7e8=Math['floor'](_0x84fa5c[_0x7abe('0x6f')]*_0x84fa5c[_0x7abe('0x71')]*_0x84fa5c[_0x7abe('0x6b')]*_0x84fa5c['predictiveIntervalMultiplicativeFactor']);if(_[_0x7abe('0x36')](_0x84fa5c[_0x7abe('0x8d')])){if(!_['isUndefined'](_0x84fa5c[_0x7abe('0x21')])){_0x84fa5c[_0x7abe('0x21')]=undefined;loggerPredictive[_0x7abe('0x95')](_0x7abe('0x1b8'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x7abe('0x36')](_0x84fa5c[_0x7abe('0x90')])){loggerPredictive[_0x7abe('0x95')](_0x7abe('0x1b8'),_0x7abe('0x1b9'));clearInterval(_0x84fa5c[_0x7abe('0x90')]);_0x84fa5c[_0x7abe('0x90')]=undefined;}_0x84fa5c[_0x7abe('0x8d')]=moment()[_0x7abe('0x75')](_0x7abe('0xf0'));loggerPredictive['info'](_0x84fa5c[_0x7abe('0x3b')],_0x7abe('0x1ba'),_0x84fa5c['startProgressive']);this[_0x7abe('0x14d')](_0x84fa5c,0x1);}else if(ifInterval(_0x84fa5c[_0x7abe('0x1bb')],_0x84fa5c[_0x7abe('0x8d')])){this[_0x7abe('0x14d')](_0x84fa5c,0x1);loggerPredictiveCalls[_0x7abe('0x7d')](_0x7abe('0x1bc'),_0x84fa5c[_0x7abe('0x8d')],_0x84fa5c['name']);_0x84fa5c['erlangCalls']=0x0;_0x84fa5c[_0x7abe('0x10e')]=0x0;}else if(_0x18be68<_0x10f14a&&_0x84fa5c[_0x7abe('0x1bd')]===_0x7abe('0x1be')){freeVariablesPredictive(_0x84fa5c);loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x1bf'),'Dropped\x20calls\x20day',_0x10f14a,_0x7abe('0x8d'),_0x84fa5c[_0x7abe('0x3b')]);}else if(_0x32b7e8<_0x84fa5c[_0x7abe('0x10e')]&&_0x84fa5c[_0x7abe('0x1bd')]==='dropRate'){freeVariablesPredictive(_0x84fa5c);loggerPredictive[_0x7abe('0x7d')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x7abe('0x1c0'),_0x32b7e8,_0x7abe('0x1c1'),_0x84fa5c[_0x7abe('0x10e')],'startProgressive',_0x84fa5c[_0x7abe('0x3b')]);}else if(!ifInterval(_0x84fa5c[_0x7abe('0x1bb')],_0x84fa5c['startProgressive'])&&_[_0x7abe('0x36')](_0x84fa5c[_0x7abe('0x21')])&&!_[_0x7abe('0x36')](_0x84fa5c['startProgressive'])){_0x84fa5c['startPredictive']=moment()[_0x7abe('0x75')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x7abe('0x7d')](_0x84fa5c[_0x7abe('0x3b')],_0x7abe('0x1c2'),_0x84fa5c[_0x7abe('0x21')]);this['averageHandleTime'](_0x84fa5c['dialPredictiveInterval'])[_0x7abe('0xb6')](this[_0x7abe('0x1c3')](_0x84fa5c))[_0x7abe('0xb6')](mergeDataErlangB(_0x84fa5c))[_0x7abe('0xb6')](this[_0x7abe('0x1c4')](_0x84fa5c))[_0x7abe('0xac')](loggerCatchPredictive(_0x7abe('0x1c5'),_0x84fa5c));}else if(!ifInterval(_0x84fa5c[_0x7abe('0x1bb')],_0x84fa5c['startPredictive'])){_0x84fa5c[_0x7abe('0x10e')]=0x0;_0x84fa5c[_0x7abe('0x21')]=moment()[_0x7abe('0x75')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x7abe('0x7d')](_0x84fa5c[_0x7abe('0x3b')],_0x7abe('0x1c6'),_0x84fa5c[_0x7abe('0x21')]);clearInterval(_0x84fa5c[_0x7abe('0x90')]);_0x84fa5c[_0x7abe('0x90')]=undefined;this[_0x7abe('0x1c7')](_0x84fa5c[_0x7abe('0x1bb')])[_0x7abe('0xb6')](this[_0x7abe('0x1c3')](_0x84fa5c))['then'](mergeDataErlangB(_0x84fa5c))[_0x7abe('0xb6')](this[_0x7abe('0x1c4')](_0x84fa5c))[_0x7abe('0xac')](loggerCatchPredictive(_0x7abe('0x1c8'),_0x84fa5c));}else if(_0x84fa5c['predictiveIntervalAvailable']&&_0x1d9479<_0x84fa5c[_0x7abe('0x6c')]-_0x135b8c){freeVariablesPredictive(_0x84fa5c);loggerPredictive['info'](_0x84fa5c['name'],_0x7abe('0x1c9'),_0x1d9479,_0x7abe('0x1ca'),_0x84fa5c[_0x7abe('0x6c')],'-',_0x135b8c,'=',_0x84fa5c[_0x7abe('0x6c')]-_0x135b8c,')');}else if(_0x84fa5c[_0x7abe('0x6c')]&&_0x1d9479>_0x84fa5c[_0x7abe('0x6c')]+_0x11596b){freeVariablesPredictive(_0x84fa5c);loggerPredictive['info'](_0x84fa5c[_0x7abe('0x3b')],_0x7abe('0x1c9'),_0x1d9479,')\x20are\x20more\x20than\x20threshold\x20(',_0x84fa5c[_0x7abe('0x6c')],'+',_0x11596b,'=',_0x84fa5c[_0x7abe('0x6c')]+_0x11596b,')');}};Dialer[_0x7abe('0x16')][_0x7abe('0x1c3')]=function(_0xeebea4){var _0x5dd497=this;return function(_0x12561e){return new BPromise(function(_0x195377,_0x656a80){_[_0x7abe('0x8b')](_0xeebea4,_0x12561e[0x0]);if(checkGetDataPredictive(_0x12561e[0x0])){var _0x14f3ed=_0xeebea4[_0x7abe('0x6c')]=_0xeebea4[_0x7abe('0x50')]+_0xeebea4[_0x7abe('0x4b')];var _0x25cec2=_0xeebea4[_0x7abe('0x1bb')]*0x3c;var _0x52b2b0=_0x12561e[0x0][_0x7abe('0x68')]+_0x12561e[0x0][_0x7abe('0x67')];var _0x439ffb=(_0x12561e[0x0]['predictiveIntervalAnsweredCalls']+_0x12561e[0x0][_0x7abe('0x6a')]+_0x12561e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x12561e[0x0]['predictiveIntervalTotalCalls'];_0xeebea4[_0x7abe('0x6b')]=_0x439ffb>0x0?_0x439ffb:0x1;switch(_0xeebea4[_0x7abe('0x1bd')]){case _0x7abe('0x1be'):var _0x6727fe=_0xeebea4[_0x7abe('0x1cb')]/0x64;return _0x5dd497[_0x7abe('0x1cc')](_0x14f3ed,_0x25cec2,_0x52b2b0,_0x439ffb,_0x6727fe)[_0x7abe('0xb6')](function(_0x465beb){return _0x195377(_0x465beb);});case'agentBusyFactor':var _0x537271=_0xeebea4[_0x7abe('0x1cb')]/0x64;return _0x5dd497[_0x7abe('0x1cd')](_0x14f3ed,_0x25cec2,_0x52b2b0,_0x439ffb,_0x537271)[_0x7abe('0xb6')](function(_0x18ea90){return _0x195377(_0x18ea90);});default:return _0x656a80(msgResponse(_0x7abe('0x1ce'),_0x7abe('0x138'),_0x7abe('0x1cf')));}}else{return _0x656a80(msgResponse(_0x7abe('0x1ce'),_0x7abe('0x138'),'check\x20failure'));}});};};Dialer['prototype'][_0x7abe('0x1d0')]=function(_0x2dcff6){var _0x3ede32=this;return function(_0x4b5720){return new BPromise(function(_0x17b688,_0x4b5938){_[_0x7abe('0x8b')](_0x2dcff6,_0x4b5720[0x0]);if(checkGetDataPredictive(_0x4b5720[0x0])){loggerPredictive[_0x7abe('0x7d')](JSON[_0x7abe('0x44')](_0x4b5720[0x0]));if(_0x2dcff6[_0x7abe('0x1bd')]===_0x7abe('0x1be')){return _0x3ede32[_0x7abe('0xc2')](_0x2dcff6['id'])[_0x7abe('0xb6')](function(_0xa85ae3){var _0x1b03dd=_0x2dcff6['loggedIn']-_0xa85ae3[0x0][_0x7abe('0x1d1')];var _0x21dc56=_0x2dcff6[_0x7abe('0x1bb')]*0x3c;var _0x38cb66=_0x4b5720[0x0][_0x7abe('0x68')]+_0x4b5720[0x0]['predictiveIntervalAvgHoldtime'];var _0x4de683=(_0x4b5720[0x0]['predictiveIntervalAnsweredCalls']+_0x4b5720[0x0][_0x7abe('0x6a')]+_0x4b5720[0x0][_0x7abe('0x69')])/_0x4b5720[0x0]['predictiveIntervalTotalCalls'];var _0x18f9be=_0x2dcff6[_0x7abe('0x1cb')]/0x64;_0x2dcff6[_0x7abe('0x1d2')]=_0xa85ae3[0x0][_0x7abe('0x1d1')]||0x0;_0x2dcff6[_0x7abe('0x6b')]=_0x4de683>0x0?_0x4de683:0x1;return _0x3ede32[_0x7abe('0x1cc')](_0x1b03dd,_0x21dc56,_0x38cb66,_0x4de683,_0x18f9be);})['then'](function(_0x1964e5){return _0x17b688(_0x1964e5);})[_0x7abe('0xac')](function(_0x505754){return _0x4b5938(msgResponse(_0x7abe('0x1d3'),_0x7abe('0x138'),JSON[_0x7abe('0x44')](_0x505754)));});}if(_0x2dcff6[_0x7abe('0x1bd')]==='agentBusyFactor'){return _0x3ede32[_0x7abe('0xc2')](_0x2dcff6['id'])[_0x7abe('0xb6')](function(_0x31248c){var _0x39f03a=_0x2dcff6[_0x7abe('0x4c')]-_0x31248c[0x0][_0x7abe('0x1d1')];var _0x3d2922=_0x2dcff6[_0x7abe('0x1bb')]*0x3c;var _0x3da0c7=_0x4b5720[0x0][_0x7abe('0x68')]+_0x4b5720[0x0]['predictiveIntervalAvgHoldtime'];var _0x1dbd25=(_0x4b5720[0x0][_0x7abe('0x66')]+_0x4b5720[0x0][_0x7abe('0x6a')]+_0x4b5720[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4b5720[0x0][_0x7abe('0x6d')];var _0x22cda1=_0x2dcff6[_0x7abe('0x1cb')]/0x64;_0x2dcff6['predictiveIntervalPauses']=_0x31248c[0x0]['outboundQueuePauses']||0x0;_0x2dcff6[_0x7abe('0x6b')]=_0x1dbd25>0x0?_0x1dbd25:0x1;return _0x3ede32['busyFactor'](_0x39f03a,_0x3d2922,_0x3da0c7,_0x1dbd25,_0x22cda1);})[_0x7abe('0xb6')](function(_0x8741d1){return _0x17b688(_0x8741d1);})[_0x7abe('0xac')](function(_0x513b16){return _0x4b5938(msgResponse('[CatchErlangB]',_0x7abe('0x138'),JSON[_0x7abe('0x44')](_0x513b16)));});}}else{return _0x4b5938(msgResponse(_0x7abe('0x1ce'),_0x7abe('0x138'),_0x7abe('0x1d4')));}});};};Dialer[_0x7abe('0x16')]['startMethodPredictive']=function(_0x4d1492){var _0x66392e=this;return function(){var _0x1ecf91=0x0;var _0x52dd4f=Math[_0x7abe('0x1d5')](_0x4d1492[_0x7abe('0x70')]*0x3e8);if(_0x52dd4f>0x0){_0x52dd4f=_0x52dd4f<0x64?0x64:_0x52dd4f;loggerPredictive['info'](_0x4d1492[_0x7abe('0x3b')],_0x7abe('0x1d6'),_0x52dd4f,_0x7abe('0x8c'));_0x4d1492[_0x7abe('0x90')]=setInterval(function(){_0x66392e[_0x7abe('0x90')](_0x4d1492);loggerPredictiveCalls['info'](_0x7abe('0x1d7'),_0x1ecf91+=0x1);},_0x52dd4f);}else{loggerPredictive['info'](_0x4d1492[_0x7abe('0x3b')],_0x7abe('0x1d8'));}};};Dialer['prototype']['checkContactBlack']=function(_0x4c8000,_0x52007f){var _0x180aa2=this;return function(_0x50a480){if(_[_0x7abe('0x40')](_0x50a480)){if(_[_0x7abe('0xd6')](_0x52007f[_0x7abe('0x1d9')])||!_0x52007f[_0x7abe('0x1da')]){if(_0x4c8000[_0x7abe('0x57')]===_0x7abe('0x8')){_0x4c8000['queueStatusComplete']=_[_0x7abe('0x36')](_0x4c8000[_0x7abe('0x123')])?!![]:_0x4c8000['queueStatusComplete'];var _0x3c0dc8=uuid['v4']();_0x180aa2[_0x7abe('0x1f')][_0x3c0dc8]=new Action(_0x4c8000,_0x52007f,_0x3c0dc8);loggerBooked['info'](_0x7abe('0x1db'),_0x3c0dc8,_0x7abe('0x1dc'),JSON[_0x7abe('0x44')](_0x4c8000[_0x7abe('0x123')]),_0x7abe('0x1dd'),_0x4c8000[_0x7abe('0x3b')]);if(_0x4c8000[_0x7abe('0x123')]){_0x4c8000[_0x7abe('0x123')]=![];_0x180aa2[_0x7abe('0x23')][_0x180aa2[_0x7abe('0x1f')][_0x3c0dc8]['queue']]=[];ami['Action']({'actionid':_0x3c0dc8,'action':'queuestatus','queue':_0x4c8000[_0x7abe('0x3b')]})[_0x7abe('0xac')](function(){_0x180aa2['updateOriginated'](_0x4c8000);_0x180aa2[_0x7abe('0xbb')]({'active':![],'ContactId':_0x180aa2[_0x7abe('0x1f')][_0x3c0dc8][_0x7abe('0xcc')],'ListId':_0x180aa2[_0x7abe('0x1f')][_0x3c0dc8][_0x7abe('0xf1')],'VoiceQueueId':_0x180aa2['actions'][_0x3c0dc8][_0x7abe('0xfc')]||undefined,'CampaignId':_0x180aa2[_0x7abe('0x1f')][_0x3c0dc8][_0x7abe('0xcd')]||undefined})['catch'](loggerCatch(_0x7abe('0x1de')));delete _0x180aa2[_0x7abe('0x1f')][_0x3c0dc8];});}else{loggerBooked[_0x7abe('0x7d')](_0x7abe('0x1df'),JSON[_0x7abe('0x44')](_0x4c8000[_0x7abe('0x123')]),'Queue:\x20',_0x4c8000[_0x7abe('0x3b')]);_0x180aa2['updateOriginated'](_0x4c8000);_0x180aa2['rescheduleContact']({'active':![],'ContactId':_0x180aa2[_0x7abe('0x1f')][_0x3c0dc8][_0x7abe('0xcc')],'ListId':_0x180aa2['actions'][_0x3c0dc8][_0x7abe('0xf1')],'VoiceQueueId':_0x180aa2[_0x7abe('0x1f')][_0x3c0dc8][_0x7abe('0xfc')]||undefined,'CampaignId':_0x180aa2[_0x7abe('0x1f')][_0x3c0dc8][_0x7abe('0xcd')]||undefined})[_0x7abe('0xac')](loggerCatch(_0x7abe('0x1de')));delete _0x180aa2[_0x7abe('0x1f')][_0x3c0dc8];}}else{return _0x180aa2['actionOriginate'](_0x4c8000,_0x52007f);}}else{if(getDiff(_0x52007f[_0x7abe('0x1e0')])<_0x4c8000[_0x7abe('0x1e1')]*0x3c){if(_0x52007f['Agent']&&!_0x52007f[_0x7abe('0x1e2')]['voicePause']){_0x180aa2[_0x7abe('0x1a')][_0x7abe('0x125')](_0x52007f['id'])['finally'](function(){_0x180aa2[_0x7abe('0xae')](_0x4c8000);});}else{_0x180aa2[_0x7abe('0xbd')]({'active':![]},_0x52007f['id'],0x1)[_0x7abe('0x127')](function(){_0x180aa2[_0x7abe('0xae')](_0x4c8000);});}}else{_0x4c8000[_0x7abe('0x1e3')]+=0x1;_0x180aa2[_0x7abe('0xae')](_0x4c8000);if(_0x4c8000[_0x7abe('0x1e4')]){_0x180aa2[_0x7abe('0xbb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x52007f[_0x7abe('0xcc')],'ListId':_0x52007f[_0x7abe('0xf1')],'VoiceQueueId':_0x52007f[_0x7abe('0xfc')]||undefined,'CampaignId':_0x52007f[_0x7abe('0xcd')]||undefined})[_0x7abe('0xac')](loggerCatch(_0x7abe('0x1e5')));_0x180aa2[_0x7abe('0xc6')](createObjHistory(_0x4c8000,_0x52007f,_0x7abe('0x1e6'),0x17,_0x7abe('0x1e7')))[_0x7abe('0xac')](loggerCatch(_0x7abe('0x1e8')));}else{_0x180aa2[_0x7abe('0xca')](createObjHistory(_0x4c8000,_0x52007f,_0x7abe('0x1e9'),0x16,_0x7abe('0x1ea')),_0x7abe('0x1eb'),_0x7abe('0x1ec'));}}}}else{_0x4c8000[_0x7abe('0x5e')]+=0x1;_0x180aa2[_0x7abe('0xca')](createObjHistory(_0x4c8000,_0x52007f,_0x7abe('0x1ed'),0xd,_0x7abe('0x1ee')),_0x7abe('0x1ef'),_0x7abe('0x1f0'));throw _0x7abe('0x1f1');}};};Dialer[_0x7abe('0x16')]['handleIvr']=function(_0x5271c2){var _0x5bc0f1=this;var _0x1b1187=_0x5271c2['limitCalls']-_0x5271c2['originated']-_0x5271c2['temp'];emitCampaignSummary(_0x5271c2);if(_0x1b1187>0x0){if(_0x1b1187>this['maxNumberOriginate']){_0x1b1187=this[_0x7abe('0x1d')];}_0x5271c2[_0x7abe('0x1f2')]+=_0x1b1187;this[_0x7abe('0xc1')](_0x5271c2['id'],_0x1b1187,_0x5271c2['dialOrderByScheduledAt'])[_0x7abe('0xb6')](function(_0x2f229d){_0x5271c2[_0x7abe('0x1f2')]-=_0x1b1187;_0x5271c2[_0x7abe('0x1f2')]=_0x5271c2[_0x7abe('0x1f2')]>0x0?_0x5271c2[_0x7abe('0x1f2')]:0x0;if(!checkContactEmpty(_0x2f229d)){_0x5271c2[_0x7abe('0x37')]=_0x7abe('0x9e');logger[_0x7abe('0x7d')](_0x7abe('0x1f3')+_0x5271c2[_0x7abe('0x3b')]);}else{_0x5271c2[_0x7abe('0x6e')]+=_0x2f229d['length'];_0x5271c2[_0x7abe('0x37')]=_0x7abe('0x1f4');for(var _0x307aac=0x0;_0x307aac<_0x2f229d[_0x7abe('0x12a')];_0x307aac+=0x1){_0x5271c2['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x2f229d[_0x307aac])||_['isNil'](_0x2f229d[_0x307aac][_0x7abe('0x162')])||_['isNil'](_0x2f229d[_0x307aac][_0x7abe('0x162')][_0x7abe('0x163')])){_0x5bc0f1[_0x7abe('0x1f5')](_0x7abe('0x1f6'),_0x5271c2,_0x2f229d[_0x307aac]);}else{_0x5bc0f1['checkIsBlackListIvr'](_[_0x7abe('0xcb')](_0x2f229d[_0x307aac],['CampaignId','Contact.phone']))['then'](_0x5bc0f1[_0x7abe('0x1f7')](_0x5271c2,_0x2f229d[_0x307aac]))[_0x7abe('0xac')](_0x5bc0f1['loggerHandler']('[actionOriginateIvr]\x20',_0x5271c2));}}}})[_0x7abe('0xac')](loggerGetContactDialer('[getContactCampaign2]',_0x5271c2,_0x1b1187));}};Dialer[_0x7abe('0x16')][_0x7abe('0x14d')]=function(_0x3c722d,_0x468684){var _0x6c72b2=this;var _0x609acf=[];var _0x2261ab=_0x468684>=0x1?_0x468684:0x1;if(_0x3c722d['dialMethod']===_0x7abe('0x8')){_0x2261ab=0x1;}var _0x1dcfe4=Math['floor'](_0x3c722d[_0x7abe('0x4b')]*_0x2261ab)-_0x3c722d['originated']-_0x3c722d[_0x7abe('0x1f2')];emitVoiceQueueSummary(_0x3c722d);if(_0x3c722d['dialLimitQueue']>0x0){var _0x410daf=_0x3c722d[_0x7abe('0x1f8')]-_0x3c722d['originated']-_0x3c722d['talking']-_0x3c722d[_0x7abe('0x1f2')]-_0x3c722d[_0x7abe('0xa1')];if(_0x1dcfe4>_0x410daf){_0x1dcfe4=_0x410daf;}}if(_0x1dcfe4>0x0){if(_0x3c722d[_0x7abe('0x57')]===_0x7abe('0x8')){_0x1dcfe4=0x1;}if(_0x1dcfe4>this[_0x7abe('0x1d')]){_0x1dcfe4=this['maxNumberOriginate'];}_0x3c722d['temp']+=_0x1dcfe4;for(var _0xf2efea in this['agents']){if(typeof this['agents'][_0xf2efea]!==_0x7abe('0x97')){if(this[_0x7abe('0x1b')][_0xf2efea]['state']==='not_inuse'&&this[_0x7abe('0x1b')][_0xf2efea][_0x7abe('0xaa')]===_0x7abe('0xd3')){_0x609acf[_0x7abe('0x140')](this['agents'][_0xf2efea]['id']);}}}this[_0x7abe('0xbf')](_0x3c722d['id'],_0x609acf,_0x1dcfe4,_0x3c722d[_0x7abe('0x1f9')])[_0x7abe('0xb6')](function(_0x57e468){_0x3c722d['temp']-=_0x1dcfe4;_0x3c722d[_0x7abe('0x1f2')]=_0x3c722d[_0x7abe('0x1f2')]>0x0?_0x3c722d[_0x7abe('0x1f2')]:0x0;if(!checkContactEmpty(_0x57e468)){_0x6c72b2[_0x7abe('0xb4')](_0x3c722d)[_0x7abe('0xb6')](sendMessageReschedule(_0x3c722d))[_0x7abe('0xac')](loggerCatch(_0x7abe('0xb7')));}else{_0x3c722d['originated']+=_0x57e468[_0x7abe('0x12a')];_0x3c722d[_0x7abe('0x37')]=_0x3c722d[_0x7abe('0x57')]==='booked'?_0x7abe('0x16a'):_0x7abe('0x1f4');for(var _0x452df2=0x0;_0x452df2<_0x57e468[_0x7abe('0x12a')];_0x452df2+=0x1){if(_[_0x7abe('0xd6')](_0x57e468[_0x452df2])||_['isNil'](_0x57e468[_0x452df2]['Contact'])||_[_0x7abe('0xd6')](_0x57e468[_0x452df2][_0x7abe('0x162')]['phone'])){_0x6c72b2[_0x7abe('0x1f5')]('[actionOriginate]\x20',_0x3c722d,_0x57e468[_0x452df2]);}else{_0x6c72b2[_0x7abe('0x1fa')](_[_0x7abe('0xcb')](_0x57e468[_0x452df2],['VoiceQueueId',_0x7abe('0x1fb')]))[_0x7abe('0xb6')](_0x6c72b2[_0x7abe('0x1f7')](_0x3c722d,_0x57e468[_0x452df2]))['catch'](_0x6c72b2[_0x7abe('0x1fc')]('[actionOriginate]\x20',_0x3c722d));}}}})[_0x7abe('0xac')](loggerGetContactDialer('[getContactDialer2]',_0x3c722d,_0x1dcfe4));}};Dialer[_0x7abe('0x16')][_0x7abe('0x90')]=function(_0xb6a0e2){if(_0xb6a0e2['dialLimitQueue']>0x0){var _0x36f433=_0xb6a0e2[_0x7abe('0x1f8')]-_0xb6a0e2[_0x7abe('0x6e')]-_0xb6a0e2['talking'];if(_0x36f433>0x0){this['tryOriginatePredictive'](_0xb6a0e2);}else{loggerPredictiveCalls[_0x7abe('0x7d')]('[handlePredictive][limitChannel]');}}else{this[_0x7abe('0x1fd')](_0xb6a0e2);}};Dialer[_0x7abe('0x16')][_0x7abe('0x1fd')]=function(_0x63abf4){var _0xebc3e6=this;var _0x50c763=[];_0x63abf4['originated']+=0x1;for(var _0x39dd8e in this[_0x7abe('0x1b')]){if(typeof this[_0x7abe('0x1b')][_0x39dd8e]!==_0x7abe('0x97')){if(this[_0x7abe('0x1b')][_0x39dd8e][_0x7abe('0xdd')]===_0x7abe('0x1fe')&&this[_0x7abe('0x1b')][_0x39dd8e][_0x7abe('0xaa')]===_0x7abe('0xd3')){_0x50c763[_0x7abe('0x140')](this['agents'][_0x39dd8e]['id']);}}}this['getContactDialer'](_0x63abf4['id'],_0x50c763,0x1,_0x63abf4[_0x7abe('0x1f9')])['then'](function(_0x2b1cb7){if(!checkContactEmpty(_0x2b1cb7)){checkContactLowerLimitOriginate(_0x63abf4,0x1,0x0);_0xebc3e6['countReScheduled'](_0x63abf4)[_0x7abe('0xb6')](sendMessageReschedule(_0x63abf4))[_0x7abe('0xac')](loggerCatch(_0x7abe('0xb7')));}else{_0x63abf4['message']='RUNNING';if(_['isNil'](_0x2b1cb7[0x0])||_['isNil'](_0x2b1cb7[0x0][_0x7abe('0x162')])||_[_0x7abe('0xd6')](_0x2b1cb7[0x0][_0x7abe('0x162')][_0x7abe('0x163')])){_0xebc3e6['emptyContact'](_0x7abe('0x1f6'),_0x63abf4,_0x2b1cb7[0x0]);}else{_0xebc3e6[_0x7abe('0x1fa')](_[_0x7abe('0xcb')](_0x2b1cb7[0x0],[_0x7abe('0xfc'),'Contact.phone']))[_0x7abe('0xb6')](_0xebc3e6[_0x7abe('0x1f7')](_0x63abf4,_0x2b1cb7[0x0]))['catch'](_0xebc3e6[_0x7abe('0x1fc')](_0x7abe('0x1ff'),_0x63abf4));}}})[_0x7abe('0xac')](loggerGetContactDialer('[getContactDialerPredictive]',_0x63abf4,0x1));emitVoiceQueueSummary(_0x63abf4);};Dialer[_0x7abe('0x16')][_0x7abe('0x1cc')]=function(_0x1755d4,_0x5be92a,_0x236f67,_0x4371f2,_0x42a558,_0x111e73){loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x200'));loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x201'),_0x1755d4);loggerPredictive[_0x7abe('0x7d')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5be92a);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x236f67);loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x202'),_0x4371f2);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42a558);loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x82'));return new BPromise(function(_0xe660a5,_0x56a994){if(_0x1755d4<=0x0||isNaN(_0x1755d4)){return _0x56a994(msgResponse(_0x7abe('0x203'),_0x7abe('0x43'),_0x7abe('0x204')+_0x1755d4));}if(_0x236f67<=0x0||isNaN(_0x236f67)){return _0x56a994(msgResponse(_0x7abe('0x203'),'Error',_0x7abe('0x205')+_0x236f67));}if(_0x4371f2<=0x0||isNaN(_0x4371f2)){return _0x56a994(msgResponse(_0x7abe('0x203'),_0x7abe('0x43'),_0x7abe('0x206')+_0x4371f2));}if(_0x5be92a<=0x0||isNaN(_0x5be92a)){return _0x56a994(msgResponse('[abandonmentRate]',_0x7abe('0x43'),_0x7abe('0x207')+_0x5be92a));}if(_0x42a558<=0x0||isNaN(_0x42a558)){return _0x56a994(msgResponse(_0x7abe('0x203'),'Error','Amax\x20=\x20'+_0x42a558));}_0x111e73=_0x111e73||0x0;var _0x5ac4cd=0x1/_0x236f67;var _0x3b55de=0x0;var _0x4eef2d=0x0;var _0x3e05a2=0x0;var _0x365825=0x0;for(var _0x56cb10=0x0;_0x3e05a2<_0x42a558;_0x56cb10+=0x1){_0x4eef2d=_0x56cb10/_0x5be92a;_0x3b55de=(_0x4371f2*_0x4eef2d+_0x111e73)/_0x5ac4cd;_0x3e05a2=erlangb(_0x3b55de,_0x1755d4);_0x365825=_0x3b55de/_0x1755d4*(0x1-erlangb(_0x3b55de,_0x1755d4));}return _0xe660a5({'erlangCalls':_0x56cb10,'erlangCallToSecond':_0x5be92a/_0x56cb10,'erlangAbandonmentRate':_0x3e05a2,'erlangBusyFactor':_0x365825});});};Dialer[_0x7abe('0x16')]['busyFactor']=function(_0x50e9cd,_0x5350a0,_0x56e4ae,_0xf6577e,_0x1d6499,_0x1eb2a6){loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x208'));loggerPredictive['info'](_0x7abe('0x201'),_0x50e9cd);loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x209'),_0x5350a0);loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x20a'),_0x56e4ae);loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x202'),_0xf6577e);loggerPredictive[_0x7abe('0x7d')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1d6499);loggerPredictive[_0x7abe('0x7d')](_0x7abe('0x82'));return new BPromise(function(_0x38ac0f,_0x172d69){if(_0x50e9cd<=0x0||isNaN(_0x50e9cd)){return _0x172d69(msgResponse('[busyFactor]',_0x7abe('0x43'),'m\x20=\x20'+_0x50e9cd));}if(_0x56e4ae<=0x0||isNaN(_0x56e4ae)){return _0x172d69(msgResponse(_0x7abe('0x20b'),_0x7abe('0x43'),'Ts\x20=\x20'+_0x56e4ae));}if(_0xf6577e<=0x0||isNaN(_0xf6577e)){return _0x172d69(msgResponse(_0x7abe('0x20b'),_0x7abe('0x43'),_0x7abe('0x206')+_0xf6577e));}if(_0x5350a0<=0x0||isNaN(_0x5350a0)){return _0x172d69(msgResponse('[busyFactor]','Error',_0x7abe('0x207')+_0x5350a0));}if(_0x1d6499<=0x0||isNaN(_0x1d6499)){return _0x172d69(msgResponse(_0x7abe('0x20b'),_0x7abe('0x43'),'Umin\x20=\x20'+_0x1d6499));}_0x1eb2a6=_0x1eb2a6||0x0;var _0x5b17e9=0x1/_0x56e4ae;var _0x3d3a63=0x0;var _0x2681bd=0x0;var _0x63a8f0=0x0;var _0x4c880a=0x0;for(var _0x57046d=0x0;_0x4c880a<_0x1d6499;_0x57046d+=0x1){_0x2681bd=_0x57046d/_0x5350a0;_0x3d3a63=(_0xf6577e*_0x2681bd+_0x1eb2a6)/_0x5b17e9;_0x63a8f0=erlangb(_0x3d3a63,_0x50e9cd);_0x4c880a=_0x3d3a63/_0x50e9cd*(0x1-erlangb(_0x3d3a63,_0x50e9cd));}return _0x38ac0f({'erlangCalls':_0x57046d,'erlangCallToSecond':_0x5350a0/_0x57046d,'erlangAbandonmentRate':_0x63a8f0,'erlangBusyFactor':_0x4c880a});});};module[_0x7abe('0x20c')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index a57dd65..8f2b9df 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 _0xdfc1=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x723cce,_0x1740f9){var _0x1b3c1f=function(_0x481d3d){while(--_0x481d3d){_0x723cce['push'](_0x723cce['shift']());}};_0x1b3c1f(++_0x1740f9);}(_0xdfc1,0xbf));var _0x1dfc=function(_0x558fe9,_0x1ca3f7){_0x558fe9=_0x558fe9-0x0;var _0x554d2a=_0xdfc1[_0x558fe9];return _0x554d2a;};'use strict';var util=require(_0x1dfc('0x0'));var _=require(_0x1dfc('0x1'));var moment=require(_0x1dfc('0x2'));function getSeconds(_0x300438,_0x5d4467){var _0x3ecf1d=moment(_0x300438)[_0x1dfc('0x3')](0x0);var _0x38e1b9=moment(_0x5d4467)[_0x1dfc('0x3')](0x0);return _0x3ecf1d[_0x1dfc('0x4')](_0x38e1b9,'seconds');}function QueueCallerAbandon(_0x56347a,_0x39709f){this[_0x1dfc('0x5')]=_0x56347a[_0x1dfc('0x5')];this[_0x1dfc('0x6')]=_0x56347a[_0x1dfc('0x6')];this[_0x1dfc('0x7')]=_0x56347a[_0x1dfc('0x6')]===_0x1dfc('0x8')?_0x1dfc('0x9'):_0x56347a['type'];this[_0x1dfc('0xa')]=_0x56347a[_0x1dfc('0xa')];this[_0x1dfc('0xb')]=_0x56347a['countcongestionretry'];this[_0x1dfc('0xc')]=_0x56347a['countnoanswerretry'];this[_0x1dfc('0xd')]=_0x56347a[_0x1dfc('0xa')]+_0x56347a['countcongestionretry']+_0x56347a[_0x1dfc('0xc')]+_0x56347a[_0x1dfc('0xe')]+_0x56347a[_0x1dfc('0xf')]+_0x56347a[_0x1dfc('0x10')]+_0x56347a[_0x1dfc('0x11')]+_0x56347a[_0x1dfc('0x12')];this[_0x1dfc('0xe')]=_0x56347a[_0x1dfc('0xe')];this[_0x1dfc('0xf')]=_0x56347a[_0x1dfc('0xf')];this[_0x1dfc('0x10')]=_0x56347a[_0x1dfc('0x10')];this[_0x1dfc('0x11')]=_0x56347a[_0x1dfc('0x11')];this[_0x1dfc('0x12')]=_0x56347a['countagentrejectretry'];this[_0x1dfc('0x13')]=_0x39709f[_0x1dfc('0x13')];this[_0x1dfc('0x14')]=_0x56347a['name'];this[_0x1dfc('0x15')]=_0x56347a[_0x1dfc('0x16')];this[_0x1dfc('0x17')]=_0x56347a['starttime'];this[_0x1dfc('0x18')]=_0x56347a['responsetime'];this[_0x1dfc('0x19')]=_0x56347a[_0x1dfc('0x19')];this['endtime']=this[_0x1dfc('0x19')];this[_0x1dfc('0x1a')]=getSeconds(_0x56347a['responsetime'],_0x56347a['starttime']);this[_0x1dfc('0x1b')]=getSeconds(this['droptime'],_0x56347a[_0x1dfc('0x18')]);this['talktime']=0x0;this[_0x1dfc('0x9')]=_0x39709f['queue'];this['membername']=_0x39709f['connectedlinename'];this[_0x1dfc('0x1c')]=_0x39709f[_0x1dfc('0x1c')];this['callback']=_0x56347a[_0x1dfc('0x1d')];this[_0x1dfc('0x1e')]=_0x56347a['callbackuniqueid'];this[_0x1dfc('0x1f')]=_0x56347a[_0x1dfc('0x1f')];this[_0x1dfc('0x20')]=_0x56347a['recallme'];this[_0x1dfc('0x21')]=_0x56347a[_0x1dfc('0x21')];this[_0x1dfc('0x22')]=_0x56347a[_0x1dfc('0x22')];this[_0x1dfc('0x23')]=_0x56347a[_0x1dfc('0x23')];this[_0x1dfc('0x24')]=_0x56347a['VoiceQueueId'];this[_0x1dfc('0x25')]=_0x56347a[_0x1dfc('0x25')];this[_0x1dfc('0x26')]=_0x56347a[_0x1dfc('0x26')]||'';this[_0x1dfc('0x27')]=_0x56347a[_0x1dfc('0x27')]||'';}module[_0x1dfc('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x2c30=['holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime'];(function(_0x2cd560,_0x145c9f){var _0x304e8b=function(_0x2826e9){while(--_0x2826e9){_0x2cd560['push'](_0x2cd560['shift']());}};_0x304e8b(++_0x145c9f);}(_0x2c30,0x14e));var _0x02c3=function(_0x266d0a,_0x56f76c){_0x266d0a=_0x266d0a-0x0;var _0x1945d2=_0x2c30[_0x266d0a];return _0x1945d2;};'use strict';var util=require('util');var _=require(_0x02c3('0x0'));var moment=require('moment');function getSeconds(_0x491367,_0x506061){var _0xda5424=moment(_0x491367)[_0x02c3('0x1')](0x0);var _0x42c434=moment(_0x506061)[_0x02c3('0x1')](0x0);return _0xda5424[_0x02c3('0x2')](_0x42c434,_0x02c3('0x3'));}function QueueCallerAbandon(_0x2a1457,_0x27b4c2){this['scheduledat']=_0x2a1457['scheduledat'];this['type']=_0x2a1457[_0x02c3('0x4')];this[_0x02c3('0x5')]=_0x2a1457[_0x02c3('0x4')]===_0x02c3('0x6')?_0x02c3('0x7'):_0x2a1457['type'];this[_0x02c3('0x8')]=_0x2a1457[_0x02c3('0x8')];this[_0x02c3('0x9')]=_0x2a1457[_0x02c3('0x9')];this[_0x02c3('0xa')]=_0x2a1457[_0x02c3('0xa')];this['countglobal']=_0x2a1457['countbusyretry']+_0x2a1457[_0x02c3('0x9')]+_0x2a1457['countnoanswerretry']+_0x2a1457[_0x02c3('0xb')]+_0x2a1457[_0x02c3('0xc')]+_0x2a1457[_0x02c3('0xd')]+_0x2a1457[_0x02c3('0xe')]+_0x2a1457[_0x02c3('0xf')];this[_0x02c3('0xb')]=_0x2a1457[_0x02c3('0xb')];this[_0x02c3('0xc')]=_0x2a1457[_0x02c3('0xc')];this[_0x02c3('0xd')]=_0x2a1457[_0x02c3('0xd')];this['countmachineretry']=_0x2a1457[_0x02c3('0xe')];this['countagentrejectretry']=_0x2a1457[_0x02c3('0xf')];this[_0x02c3('0x10')]=_0x27b4c2[_0x02c3('0x10')];this[_0x02c3('0x11')]=_0x2a1457[_0x02c3('0x12')];this[_0x02c3('0x13')]=_0x2a1457[_0x02c3('0x14')];this[_0x02c3('0x15')]=_0x2a1457[_0x02c3('0x15')];this[_0x02c3('0x16')]=_0x2a1457['responsetime'];this[_0x02c3('0x17')]=_0x2a1457[_0x02c3('0x17')];this[_0x02c3('0x18')]=this[_0x02c3('0x17')];this[_0x02c3('0x19')]=getSeconds(_0x2a1457[_0x02c3('0x16')],_0x2a1457[_0x02c3('0x15')]);this[_0x02c3('0x1a')]=getSeconds(this['droptime'],_0x2a1457[_0x02c3('0x16')]);this['talktime']=0x0;this[_0x02c3('0x7')]=_0x27b4c2['queue'];this[_0x02c3('0x1b')]=_0x27b4c2['connectedlinename'];this['reason']=_0x27b4c2[_0x02c3('0x1c')];this[_0x02c3('0x1d')]=_0x2a1457[_0x02c3('0x1d')];this[_0x02c3('0x1e')]=_0x2a1457[_0x02c3('0x1e')];this[_0x02c3('0x1f')]=_0x2a1457['callbackat'];this[_0x02c3('0x20')]=_0x2a1457[_0x02c3('0x20')];this['ContactId']=_0x2a1457[_0x02c3('0x21')];this['ListId']=_0x2a1457['ListId'];this[_0x02c3('0x22')]=_0x2a1457[_0x02c3('0x22')];this[_0x02c3('0x23')]=_0x2a1457[_0x02c3('0x23')];this[_0x02c3('0x24')]=_0x2a1457[_0x02c3('0x24')];this[_0x02c3('0x25')]=_0x2a1457[_0x02c3('0x25')]||'';this['originatecalleridname']=_0x2a1457[_0x02c3('0x26')]||'';}module[_0x02c3('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 75d6f2d..4b5e7ed 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 _0xe904=['Trunk','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid','channel','format','%s/%s/%s'];(function(_0x534e71,_0x46f901){var _0x3b5fcc=function(_0x3d4407){while(--_0x3d4407){_0x534e71['push'](_0x534e71['shift']());}};_0x3b5fcc(++_0x46f901);}(_0xe904,0x149));var _0x4e90=function(_0x33b94a,_0x275fc3){_0x33b94a=_0x33b94a-0x0;var _0x33efca=_0xe904[_0x33b94a];return _0x33efca;};'use strict';var util=require(_0x4e90('0x0'));var _=require(_0x4e90('0x1'));var moment=require(_0x4e90('0x2'));function Action(_0x250798,_0x436418,_0xb31b56){this[_0x4e90('0x3')]=_0x250798||undefined;this[_0x4e90('0x4')]=util[_0x4e90('0x5')](_0x4e90('0x6'),_0x436418['tech'],_0x436418[_0x4e90('0x7')]['name'],_0xb31b56[_0x4e90('0x8')]);this[_0x4e90('0x9')]=_0x436418[_0x4e90('0x9')];this[_0x4e90('0xa')]=_0x436418[_0x4e90('0xa')];this[_0x4e90('0xb')]=_0xb31b56[_0x4e90('0xb')];this[_0x4e90('0xc')]=_0xb31b56[_0x4e90('0xc')];}module[_0x4e90('0xd')]=Action; \ No newline at end of file +var _0xdf00=['fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','channel','%s/%s/%s','tech','Trunk'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xdf00,0x1ce));var _0x0df0=function(_0x2e7511,_0x21fa66){_0x2e7511=_0x2e7511-0x0;var _0x3b1c62=_0xdf00[_0x2e7511];return _0x3b1c62;};'use strict';var util=require(_0x0df0('0x0'));var _=require(_0x0df0('0x1'));var moment=require('moment');function Action(_0x21fb36,_0x26d242,_0x3ca594){this['uniqueid']=_0x21fb36||undefined;this[_0x0df0('0x2')]=util['format'](_0x0df0('0x3'),_0x26d242[_0x0df0('0x4')],_0x26d242[_0x0df0('0x5')]['name'],_0x3ca594[_0x0df0('0x6')]);this[_0x0df0('0x7')]=_0x26d242[_0x0df0('0x7')];this[_0x0df0('0x8')]=_0x26d242['headerinfo'];this[_0x0df0('0x9')]=_0x3ca594[_0x0df0('0x9')];this[_0x0df0('0xa')]=_0x3ca594[_0x0df0('0xa')];}module[_0x0df0('0xb')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 2f20ee6..608afc9 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 _0x3425=['./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','from-voip-provider','localstationid','channel','uniqueid','name','info','\x20syncNewchannel\x20','prototype','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','actions','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path'];(function(_0x158e6c,_0xaab4ed){var _0x3c26db=function(_0x3c57dd){while(--_0x3c57dd){_0x158e6c['push'](_0x158e6c['shift']());}};_0x3c26db(++_0xaab4ed);}(_0x3425,0xee));var _0x5342=function(_0x2a9d1f,_0x2d2116){_0x2a9d1f=_0x2a9d1f-0x0;var _0x161345=_0x3425[_0x2a9d1f];return _0x161345;};'use strict';var util=require(_0x5342('0x0'));var _=require(_0x5342('0x1'));var BPromise=require(_0x5342('0x2'));var uuid=require(_0x5342('0x3'));var moment=require(_0x5342('0x4'));var path=require(_0x5342('0x5'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x5342('0x6'));var logger=require(_0x5342('0x7'))('fax');var ami=require(_0x5342('0x8'));var rpcDb=require(_0x5342('0x9'));var Channel=require(_0x5342('0xa'));var ut=require(_0x5342('0xb'));var Action=require(_0x5342('0xc'));var faxAccount=require(_0x5342('0xd'));var attachment=require(_0x5342('0xe'));var faxMessage=require(_0x5342('0xf'));function Fax(_0x2bb545){this[_0x5342('0x10')]={};this[_0x5342('0x11')]=_0x2bb545[_0x5342('0x11')];this[_0x5342('0x12')]=_0x2bb545[_0x5342('0x12')];this['actions']={};ami['on'](_0x5342('0x13'),this['syncNewchannel'][_0x5342('0x14')](this));ami['on'](_0x5342('0x15'),this[_0x5342('0x16')][_0x5342('0x14')](this));ami['on'](_0x5342('0x17'),this[_0x5342('0x18')][_0x5342('0x14')](this));ami['on']('newexten',this[_0x5342('0x19')]['bind'](this));ami['on'](_0x5342('0x1a'),this[_0x5342('0x1b')][_0x5342('0x14')](this));ami['on'](_0x5342('0x1c'),this[_0x5342('0x1d')][_0x5342('0x14')](this));ami['on']('hangup',this[_0x5342('0x1e')]['bind'](this));ami['on'](_0x5342('0x1f'),this[_0x5342('0x20')]['bind'](this));}Fax['prototype'][_0x5342('0x21')]=function(_0x2289a6){if(_0x2289a6[_0x5342('0x22')]===_0x5342('0x23')){for(var _0x53258e in this[_0x5342('0x11')]){if(this[_0x5342('0x11')]['hasOwnProperty'](_0x53258e)){if(_0x2289a6['exten']===this['faxAccounts'][_0x53258e][_0x5342('0x24')]){this[_0x5342('0x10')][_0x2289a6['uniqueid']]={};this[_0x5342('0x10')][_0x2289a6['uniqueid']]['channel']=_0x2289a6[_0x5342('0x25')];this['channels'][_0x2289a6['uniqueid']]['id']=this[_0x5342('0x11')][_0x53258e]['id'];this['channels'][_0x2289a6[_0x5342('0x26')]][_0x5342('0x27')]=this[_0x5342('0x11')][_0x53258e]['name'];logger[_0x5342('0x28')](_0x2289a6['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x2289a6[_0x5342('0x26')]]){this[_0x5342('0x10')][_0x2289a6['uniqueid']]={};this['channels'][_0x2289a6[_0x5342('0x26')]][_0x5342('0x25')]=_0x2289a6[_0x5342('0x25')];logger[_0x5342('0x28')](_0x2289a6[_0x5342('0x26')],_0x5342('0x29'));}};Fax[_0x5342('0x2a')][_0x5342('0x16')]=function(_0x4389ec){if(this['channels'][_0x4389ec[_0x5342('0x26')]]){for(var _0x2bc287 in _0x4389ec[_0x5342('0x2b')]){if(_0x4389ec[_0x5342('0x2b')][_0x5342('0x2c')](_0x2bc287)){this[_0x5342('0x10')][_0x4389ec[_0x5342('0x26')]][_0x2bc287]=_0x4389ec[_0x5342('0x2d')];}}}};Fax[_0x5342('0x2a')][_0x5342('0x18')]=function(_0x625c42){if(this[_0x5342('0x10')][_0x625c42[_0x5342('0x26')]]){this[_0x5342('0x10')][_0x625c42['uniqueid']][_0x5342('0x2e')]=_0x625c42[_0x5342('0x2e')];this[_0x5342('0x10')][_0x625c42[_0x5342('0x26')]][_0x5342('0x2f')]=_0x625c42[_0x5342('0x2f')];}};Fax[_0x5342('0x2a')][_0x5342('0x19')]=function(_0xa75188){if(this['channels'][_0xa75188['uniqueid']]){for(var _0x3594e6 in _0xa75188['variable']){if(_0xa75188[_0x5342('0x2b')][_0x5342('0x2c')](_0x3594e6)){this[_0x5342('0x10')][_0xa75188[_0x5342('0x26')]][_0x3594e6]=_0xa75188['value'];}}}};Fax['prototype']['syncFaxStatus']=function(_0x2d2fbc){if(this[_0x5342('0x10')][_0x2d2fbc[_0x5342('0x26')]]){this['channels'][_0x2d2fbc['uniqueid']]['operation']=_0x2d2fbc[_0x5342('0x30')];this[_0x5342('0x10')][_0x2d2fbc[_0x5342('0x26')]][_0x5342('0x31')]=_0x2d2fbc[_0x5342('0x31')];this['channels'][_0x2d2fbc['uniqueid']]['localstationid']=_0x2d2fbc[_0x5342('0x24')];this['channels'][_0x2d2fbc['uniqueid']][_0x5342('0x32')]=_0x2d2fbc['filename'];logger[_0x5342('0x28')](_0x2d2fbc[_0x5342('0x26')],_0x5342('0x33'));}};Fax[_0x5342('0x2a')][_0x5342('0x1d')]=function(_0x3c7b67){var _0x33f0e4=this;if(this[_0x5342('0x10')][_0x3c7b67[_0x5342('0x26')]]){var _0x9e7dcb=this[_0x5342('0x10')][_0x3c7b67[_0x5342('0x26')]]['id'];this[_0x5342('0x10')][_0x3c7b67[_0x5342('0x26')]][_0x5342('0x34')]=_0x3c7b67[_0x5342('0x34')];this[_0x5342('0x10')][_0x3c7b67[_0x5342('0x26')]]['pagestransferred']=_0x3c7b67[_0x5342('0x35')];this[_0x5342('0x10')][_0x3c7b67['uniqueid']][_0x5342('0x24')]=_0x3c7b67[_0x5342('0x24')];this['channels'][_0x3c7b67[_0x5342('0x26')]][_0x5342('0x36')]=_0x3c7b67[_0x5342('0x36')];this['channels'][_0x3c7b67[_0x5342('0x26')]][_0x5342('0x37')]=_0x3c7b67[_0x5342('0x37')];this[_0x5342('0x10')][_0x3c7b67[_0x5342('0x26')]][_0x5342('0x32')]=_0x3c7b67[_0x5342('0x32')];this[_0x5342('0x10')][_0x3c7b67[_0x5342('0x26')]][_0x5342('0x38')]=_0x3c7b67[_0x5342('0x38')];if(this[_0x5342('0x10')][_0x3c7b67[_0x5342('0x26')]][_0x5342('0x35')]>0x0){tiff2pdf(_0x3c7b67['filename'],_0x5342('0x39'),function(_0x227ea8){logger['info'](_0x3c7b67[_0x5342('0x26')],_0x5342('0x3a'),_0x227ea8[_0x5342('0x3b')]);attachment[_0x5342('0x3c')]({'name':path[_0x5342('0x3d')](_0x3c7b67['filename'])[_0x5342('0x27')],'basename':path[_0x5342('0x3d')](_0x3c7b67[_0x5342('0x32')])['name']+_0x5342('0x3e'),'type':_0x5342('0x3f')})['then'](function(_0x4519e8){faxAccount[_0x5342('0x40')](_0x9e7dcb,{'from':_0x3c7b67[_0x5342('0x38')],'mapKey':'fax','body':path['parse'](_0x3c7b67[_0x5342('0x32')])[_0x5342('0x27')]+_0x5342('0x3e'),'AttachmentId':_0x4519e8['id']})[_0x5342('0x41')](function(_0x131a10){logger[_0x5342('0x42')](_0x3c7b67[_0x5342('0x26')],_0x5342('0x43'),JSON[_0x5342('0x44')](_0x131a10));});})['catch'](function(_0x4ab3e2){logger[_0x5342('0x42')](_0x3c7b67[_0x5342('0x26')],'\x20receiveFax\x20',JSON['stringify'](_0x4ab3e2));});});}logger[_0x5342('0x28')](_0x3c7b67[_0x5342('0x26')],_0x5342('0x45'));}};Fax[_0x5342('0x2a')][_0x5342('0x20')]=function(_0x1cc91e){if(this['actions'][_0x1cc91e['uniqueid']]){_[_0x5342('0x46')](this[_0x5342('0x10')][_0x1cc91e['uniqueid']],_[_0x5342('0x47')](_0x1cc91e,[_0x5342('0x48'),_0x5342('0x49')]));}};function updateStatus(_0x152bfd){if(_0x152bfd['AttachmentId']){faxMessage[_0x5342('0x4a')](_0x152bfd['AttachmentId'],{'failMessage':_0x5342('0x4b')})[_0x5342('0x4c')](function(_0x5526b7){ut[_0x5342('0x4d')]('[Fax][Message][Error][Updated]',_0x5526b7);})['catch'](function(_0x43fada){ut['logger'](_0x5342('0x4e'),_0x43fada);});}else{ut[_0x5342('0x4d')](_0x5342('0x4f'));}}Fax['prototype'][_0x5342('0x50')]=function(_0x3ad44a,_0x469960,_0x5c073d){var _0x47abb5=this;var _0x105afb={};if(_0x469960){_0x105afb={'read':_0x469960};}else{_0x105afb={'failMessage':_0x5c073d};}if(this[_0x5342('0x51')][_0x3ad44a][_0x5342('0x52')]){faxMessage[_0x5342('0x4a')](this['actions'][_0x3ad44a][_0x5342('0x52')],_0x105afb)[_0x5342('0x4c')](function(_0x3df967){ut[_0x5342('0x4d')](_0x5342('0x53'),_0x3df967);})[_0x5342('0x41')](function(_0xbd0a37){ut[_0x5342('0x4d')](_0x5342('0x54'),_0xbd0a37);})[_0x5342('0x55')](function(){delete _0x47abb5[_0x5342('0x10')][_0x3ad44a];delete _0x47abb5[_0x5342('0x51')][_0x3ad44a];});}else{ut[_0x5342('0x4d')](_0x5342('0x56'));delete this[_0x5342('0x10')][_0x3ad44a];delete this[_0x5342('0x51')][_0x3ad44a];}};Fax['prototype'][_0x5342('0x1e')]=function(_0x3dbe3d){var _0xbbf92=this;if(this[_0x5342('0x10')][_0x3dbe3d[_0x5342('0x26')]]){if(this[_0x5342('0x51')][_0x3dbe3d['uniqueid']]){this[_0x5342('0x10')][_0x3dbe3d['uniqueid']]['id']=this['actions'][_0x3dbe3d[_0x5342('0x26')]]['id'];this[_0x5342('0x10')][_0x3dbe3d[_0x5342('0x26')]]['name']=this[_0x5342('0x51')][_0x3dbe3d[_0x5342('0x26')]][_0x5342('0x27')];}logger['info'](_0x3dbe3d[_0x5342('0x26')],this[_0x5342('0x51')][_0x3dbe3d[_0x5342('0x26')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0x5342('0x44')](this[_0x5342('0x10')][_0x3dbe3d[_0x5342('0x26')]]));if(this['actions'][_0x3dbe3d['uniqueid']]){if(this[_0x5342('0x10')][_0x3dbe3d['uniqueid']][_0x5342('0x57')]>0x0&&this[_0x5342('0x10')][_0x3dbe3d[_0x5342('0x26')]]['faxstatus']===_0x5342('0x58')){this[_0x5342('0x50')](_0x3dbe3d[_0x5342('0x26')],!![]);}else{this[_0x5342('0x50')](_0x3dbe3d[_0x5342('0x26')],![],this[_0x5342('0x10')][_0x3dbe3d[_0x5342('0x26')]][_0x5342('0x59')]?'SENDING\x20FAILED:\x20'+this[_0x5342('0x10')][_0x3dbe3d['uniqueid']][_0x5342('0x59')]:_0x5342('0x5a'));}}}};Fax['prototype'][_0x5342('0x5b')]=function(_0x42c676){var _0x10c1fa=this;return new BPromise(function(_0x50d1de,_0x50b478){_0x10c1fa[_0x5342('0x5c')](_0x42c676,_0x10c1fa[_0x5342('0x11')][_0x42c676['FaxAccountId']])[_0x5342('0x4c')](function(_0x287c8f){ut[_0x5342('0x4d')]('[Fax][execOriginate][success]',_0x287c8f);_0x50d1de(ut[_0x5342('0x3b')](_0x5342('0x5d')));})[_0x5342('0x41')](function(_0x192e4d){ut[_0x5342('0x4d')]('[Fax][execOriginate][failure]',_0x192e4d);updateStatus(_0x42c676);_0x50b478(ut[_0x5342('0x3b')](_0x5342('0x5e')));});});};Fax['prototype'][_0x5342('0x5f')]=function(_0x4566cc){var _0x1b81cc=this;return new BPromise(function(_0x22d591,_0x19df23){var _0x4f27b7=_0x1b81cc[_0x5342('0x60')](_0x1b81cc['faxAccounts'][_0x4566cc[_0x5342('0x61')]][_0x5342('0x62')],_0x4566cc);if(_0x4f27b7[_0x5342('0x63')]){_0x22d591(ut[_0x5342('0x3b')](_0x5342('0x64')));}else{_0x19df23(ut[_0x5342('0x3b')](_0x4f27b7[_0x5342('0x3b')]));}});};function originate(_0x3ef1f6,_0x1e6dc0,_0x1cdbe3){return new BPromise(function(_0x2603b0,_0x182e74){if(_0x1cdbe3){var _0x8371d3=util[_0x5342('0x65')](_0x5342('0x66'),path[_0x5342('0x3d')](_0x3ef1f6['path'])[_0x5342('0x27')],_0x3ef1f6[_0x5342('0x5')]);gs[_0x5342('0x67')](_0x8371d3)[_0x5342('0x4c')](function(){_0x3ef1f6[_0x5342('0x5')]=util[_0x5342('0x65')](_0x5342('0x68'),path['parse'](_0x3ef1f6[_0x5342('0x5')])[_0x5342('0x69')],path[_0x5342('0x3d')](_0x3ef1f6['path'])[_0x5342('0x27')]);_0x1e6dc0['XMF-PATH']=_0x3ef1f6[_0x5342('0x5')];ut[_0x5342('0x4d')](_0x5342('0x6a'),'');ami[_0x5342('0x6b')](ut['variablesAction'](_0x3ef1f6,_0x1e6dc0))['then'](function(_0x32988c){_0x2603b0(_0x32988c);})[_0x5342('0x41')](function(_0x4a82dc){_0x182e74(_0x4a82dc);});})[_0x5342('0x41')](function(_0x34b702){_0x182e74(_0x34b702);});}else{ami[_0x5342('0x6b')](ut[_0x5342('0x6c')](_0x3ef1f6,_0x1e6dc0))['then'](function(_0x1501c6){_0x2603b0(_0x1501c6);})[_0x5342('0x41')](function(_0x307030){_0x182e74(_0x307030);});}});}Fax[_0x5342('0x2a')][_0x5342('0x5c')]=function(_0x30f915,_0x29cc90){var _0x5090ef=this;return new BPromise(function(_0xbc8d6b,_0x2e66ba){var _0x332f00=uuid['v4']();var _0x199b8c=ut[_0x5342('0x6d')](_0x30f915,_0x29cc90);_0x5090ef[_0x5342('0x51')][_0x332f00]=new Action(_0x332f00,_0x29cc90,_0x30f915);var _0xff0636=_0x5090ef[_0x5342('0x51')][_0x332f00];if(path[_0x5342('0x3d')](_0x30f915['path'])['ext']==='.pdf'){originate(_0xff0636,_0x199b8c,!![])['then'](function(_0x4151dd){_0xbc8d6b(_0x4151dd);})[_0x5342('0x41')](function(_0x38671e){_0x2e66ba(_0x38671e);});}else{originate(_0xff0636,_0x199b8c,![])[_0x5342('0x4c')](function(_0x26d973){_0xbc8d6b(_0x26d973);})[_0x5342('0x41')](function(_0x4f344b){_0x2e66ba(_0x4f344b);});}});};Fax[_0x5342('0x2a')][_0x5342('0x6e')]=function(_0x2c6257){return!_['isNil'](_0x2c6257)&&!_[_0x5342('0x6f')](_0x2c6257[_0x5342('0x27')])&&!_[_0x5342('0x6f')](_0x2c6257[_0x5342('0x70')])&&_0x2c6257[_0x5342('0x70')]&&!_['isNil'](this['trunks'][util[_0x5342('0x65')](_0x5342('0x71'),_0x2c6257[_0x5342('0x27')])])&&!_[_0x5342('0x6f')](this[_0x5342('0x12')][util[_0x5342('0x65')](_0x5342('0x71'),_0x2c6257[_0x5342('0x27')])][_0x5342('0x31')])&&(this[_0x5342('0x12')][util[_0x5342('0x65')](_0x5342('0x71'),_0x2c6257[_0x5342('0x27')])][_0x5342('0x31')]===_0x5342('0x72')||this[_0x5342('0x12')][util[_0x5342('0x65')](_0x5342('0x71'),_0x2c6257[_0x5342('0x27')])][_0x5342('0x31')]===_0x5342('0x73'));};Fax[_0x5342('0x2a')]['checkTrunk']=function(_0x37b49b,_0x232c67){if(!this[_0x5342('0x6e')](_0x37b49b)){ut[_0x5342('0x4d')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x5342('0x6f')](_0x37b49b)?'':_0x37b49b[_0x5342('0x27')]+_0x5342('0x74'));return{'isValid':![],'message':_0x5342('0x75')};}if(_[_0x5342('0x6f')](_0x232c67['fax'])){ut[_0x5342('0x4d')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x5342('0x44')](_0x232c67));return{'isValid':![],'message':_0x5342('0x76')};}if(_[_0x5342('0x6f')](_0x232c67[_0x5342('0x5')])){ut['logger'](_0x5342('0x77'),JSON[_0x5342('0x44')](_0x232c67));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x5342('0x78')};};module[_0x5342('0x79')]=Fax; \ No newline at end of file +var _0x31c9=['channelstate','channelstatedesc','syncNewExten','value','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','message','checkAfterSend','checkTrunk','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','path','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','tiff2pdf','./util/gs','../../../config/logger','fax','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','actions','\x20syncNewchannel\x20','variable'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0x31c9,0xb8));var _0x931c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x31c9[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x931c('0x0'));var _=require(_0x931c('0x1'));var BPromise=require(_0x931c('0x2'));var uuid=require('uuid');var moment=require(_0x931c('0x3'));var path=require('path');var tiff2pdf=require(_0x931c('0x4'));var gs=require(_0x931c('0x5'));var logger=require(_0x931c('0x6'))(_0x931c('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x931c('0x8'));var ut=require(_0x931c('0x9'));var Action=require(_0x931c('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x931c('0xb'));var faxMessage=require(_0x931c('0xc'));function Fax(_0x103aed){this[_0x931c('0xd')]={};this['faxAccounts']=_0x103aed[_0x931c('0xe')];this[_0x931c('0xf')]=_0x103aed['trunks'];this['actions']={};ami['on'](_0x931c('0x10'),this['syncNewchannel'][_0x931c('0x11')](this));ami['on'](_0x931c('0x12'),this[_0x931c('0x13')]['bind'](this));ami['on'](_0x931c('0x14'),this[_0x931c('0x15')]['bind'](this));ami['on'](_0x931c('0x16'),this['syncNewExten']['bind'](this));ami['on']('faxstatus',this['syncFaxStatus']['bind'](this));ami['on'](_0x931c('0x17'),this[_0x931c('0x18')][_0x931c('0x11')](this));ami['on']('hangup',this[_0x931c('0x19')][_0x931c('0x11')](this));ami['on'](_0x931c('0x1a'),this[_0x931c('0x1b')][_0x931c('0x11')](this));}Fax[_0x931c('0x1c')]['syncNewchannel']=function(_0x46cde1){if(_0x46cde1['context']===_0x931c('0x1d')){for(var _0x109877 in this['faxAccounts']){if(this[_0x931c('0xe')][_0x931c('0x1e')](_0x109877)){if(_0x46cde1[_0x931c('0x1f')]===this[_0x931c('0xe')][_0x109877][_0x931c('0x20')]){this[_0x931c('0xd')][_0x46cde1['uniqueid']]={};this[_0x931c('0xd')][_0x46cde1[_0x931c('0x21')]]['channel']=_0x46cde1[_0x931c('0x22')];this[_0x931c('0xd')][_0x46cde1[_0x931c('0x21')]]['id']=this['faxAccounts'][_0x109877]['id'];this[_0x931c('0xd')][_0x46cde1[_0x931c('0x21')]][_0x931c('0x23')]=this[_0x931c('0xe')][_0x109877][_0x931c('0x23')];logger[_0x931c('0x24')](_0x46cde1[_0x931c('0x21')],'\x20syncNewchannel\x20');}}}}if(this[_0x931c('0x25')][_0x46cde1[_0x931c('0x21')]]){this['channels'][_0x46cde1[_0x931c('0x21')]]={};this['channels'][_0x46cde1['uniqueid']][_0x931c('0x22')]=_0x46cde1[_0x931c('0x22')];logger['info'](_0x46cde1[_0x931c('0x21')],_0x931c('0x26'));}};Fax[_0x931c('0x1c')][_0x931c('0x13')]=function(_0x39b822){if(this['channels'][_0x39b822[_0x931c('0x21')]]){for(var _0x505c77 in _0x39b822[_0x931c('0x27')]){if(_0x39b822['variable'][_0x931c('0x1e')](_0x505c77)){this[_0x931c('0xd')][_0x39b822[_0x931c('0x21')]][_0x505c77]=_0x39b822['value'];}}}};Fax[_0x931c('0x1c')][_0x931c('0x15')]=function(_0x1a95c8){if(this[_0x931c('0xd')][_0x1a95c8[_0x931c('0x21')]]){this[_0x931c('0xd')][_0x1a95c8[_0x931c('0x21')]]['channelstate']=_0x1a95c8[_0x931c('0x28')];this['channels'][_0x1a95c8[_0x931c('0x21')]][_0x931c('0x29')]=_0x1a95c8['channelstatedesc'];}};Fax[_0x931c('0x1c')][_0x931c('0x2a')]=function(_0x2f9e03){if(this['channels'][_0x2f9e03[_0x931c('0x21')]]){for(var _0x301538 in _0x2f9e03['variable']){if(_0x2f9e03['variable']['hasOwnProperty'](_0x301538)){this[_0x931c('0xd')][_0x2f9e03[_0x931c('0x21')]][_0x301538]=_0x2f9e03[_0x931c('0x2b')];}}}};Fax[_0x931c('0x1c')][_0x931c('0x2c')]=function(_0x3b0647){if(this[_0x931c('0xd')][_0x3b0647[_0x931c('0x21')]]){this['channels'][_0x3b0647['uniqueid']][_0x931c('0x2d')]=_0x3b0647['operation'];this[_0x931c('0xd')][_0x3b0647[_0x931c('0x21')]][_0x931c('0x2e')]=_0x3b0647[_0x931c('0x2e')];this[_0x931c('0xd')][_0x3b0647['uniqueid']]['localstationid']=_0x3b0647[_0x931c('0x20')];this[_0x931c('0xd')][_0x3b0647[_0x931c('0x21')]][_0x931c('0x2f')]=_0x3b0647[_0x931c('0x2f')];logger[_0x931c('0x24')](_0x3b0647[_0x931c('0x21')],_0x931c('0x30'));}};Fax[_0x931c('0x1c')][_0x931c('0x18')]=function(_0x322062){var _0x105d81=this;if(this[_0x931c('0xd')][_0x322062[_0x931c('0x21')]]){var _0x32c07b=this['channels'][_0x322062[_0x931c('0x21')]]['id'];this[_0x931c('0xd')][_0x322062[_0x931c('0x21')]][_0x931c('0x31')]=_0x322062['remotestationid'];this[_0x931c('0xd')][_0x322062['uniqueid']]['pagestransferred']=_0x322062[_0x931c('0x32')];this[_0x931c('0xd')][_0x322062[_0x931c('0x21')]][_0x931c('0x20')]=_0x322062['localstationid'];this['channels'][_0x322062[_0x931c('0x21')]]['resolution']=_0x322062[_0x931c('0x33')];this['channels'][_0x322062[_0x931c('0x21')]][_0x931c('0x34')]=_0x322062[_0x931c('0x34')];this[_0x931c('0xd')][_0x322062[_0x931c('0x21')]][_0x931c('0x2f')]=_0x322062[_0x931c('0x2f')];this[_0x931c('0xd')][_0x322062['uniqueid']][_0x931c('0x35')]=_0x322062[_0x931c('0x35')];if(this['channels'][_0x322062[_0x931c('0x21')]][_0x931c('0x32')]>0x0){tiff2pdf(_0x322062[_0x931c('0x2f')],'/var/opt/motion2/server/files/attachments/',function(_0x2b0d42){logger[_0x931c('0x24')](_0x322062['uniqueid'],_0x931c('0x36'),_0x2b0d42['message']);attachment[_0x931c('0x37')]({'name':path[_0x931c('0x38')](_0x322062['filename'])[_0x931c('0x23')],'basename':path[_0x931c('0x38')](_0x322062[_0x931c('0x2f')])[_0x931c('0x23')]+_0x931c('0x39'),'type':_0x931c('0x3a')})[_0x931c('0x3b')](function(_0x33892d){faxAccount['notify'](_0x32c07b,{'from':_0x322062[_0x931c('0x35')],'mapKey':'fax','body':path[_0x931c('0x38')](_0x322062[_0x931c('0x2f')])['name']+_0x931c('0x39'),'AttachmentId':_0x33892d['id']})[_0x931c('0x3c')](function(_0x5b9670){logger[_0x931c('0x3d')](_0x322062[_0x931c('0x21')],_0x931c('0x3e'),JSON[_0x931c('0x3f')](_0x5b9670));});})[_0x931c('0x3c')](function(_0xd023d2){logger[_0x931c('0x3d')](_0x322062[_0x931c('0x21')],_0x931c('0x40'),JSON['stringify'](_0xd023d2));});});}logger['info'](_0x322062['uniqueid'],'\x20receiveFax\x20');}};Fax[_0x931c('0x1c')]['syncOriginateResponse']=function(_0x21f4d6){if(this[_0x931c('0x25')][_0x21f4d6[_0x931c('0x21')]]){_[_0x931c('0x41')](this[_0x931c('0xd')][_0x21f4d6[_0x931c('0x21')]],_[_0x931c('0x42')](_0x21f4d6,['response','reason']));}};function updateStatus(_0x1098c8){if(_0x1098c8[_0x931c('0x43')]){faxMessage[_0x931c('0x44')](_0x1098c8[_0x931c('0x43')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x931c('0x3b')](function(_0x108868){ut[_0x931c('0x45')](_0x931c('0x46'),_0x108868);})[_0x931c('0x3c')](function(_0x504da6){ut[_0x931c('0x45')](_0x931c('0x47'),_0x504da6);});}else{ut['logger'](_0x931c('0x48'));}}Fax[_0x931c('0x1c')][_0x931c('0x49')]=function(_0x2a4ce5,_0x4c9e12,_0xb3ca37){var _0x4e147d=this;var _0x305320={};if(_0x4c9e12){_0x305320={'read':_0x4c9e12};}else{_0x305320={'failMessage':_0xb3ca37};}if(this[_0x931c('0x25')][_0x2a4ce5][_0x931c('0x43')]){faxMessage[_0x931c('0x44')](this[_0x931c('0x25')][_0x2a4ce5][_0x931c('0x43')],_0x305320)[_0x931c('0x3b')](function(_0x19a3d4){ut[_0x931c('0x45')](_0x931c('0x4a'),_0x19a3d4);})[_0x931c('0x3c')](function(_0x41fdc5){ut['logger'](_0x931c('0x4b'),_0x41fdc5);})[_0x931c('0x4c')](function(){delete _0x4e147d[_0x931c('0xd')][_0x2a4ce5];delete _0x4e147d['actions'][_0x2a4ce5];});}else{ut[_0x931c('0x45')](_0x931c('0x4d'));delete this[_0x931c('0xd')][_0x2a4ce5];delete this[_0x931c('0x25')][_0x2a4ce5];}};Fax[_0x931c('0x1c')][_0x931c('0x19')]=function(_0x507221){var _0x59691e=this;if(this[_0x931c('0xd')][_0x507221[_0x931c('0x21')]]){if(this[_0x931c('0x25')][_0x507221[_0x931c('0x21')]]){this[_0x931c('0xd')][_0x507221[_0x931c('0x21')]]['id']=this[_0x931c('0x25')][_0x507221[_0x931c('0x21')]]['id'];this[_0x931c('0xd')][_0x507221[_0x931c('0x21')]]['name']=this[_0x931c('0x25')][_0x507221[_0x931c('0x21')]]['name'];}logger[_0x931c('0x24')](_0x507221[_0x931c('0x21')],this[_0x931c('0x25')][_0x507221[_0x931c('0x21')]]?_0x931c('0x4e'):'\x20hangup\x20faxRiceive\x20',JSON[_0x931c('0x3f')](this[_0x931c('0xd')][_0x507221[_0x931c('0x21')]]));if(this['actions'][_0x507221[_0x931c('0x21')]]){if(this[_0x931c('0xd')][_0x507221[_0x931c('0x21')]]['faxpages']>0x0&&this[_0x931c('0xd')][_0x507221['uniqueid']]['faxstatus']==='SUCCESS'){this[_0x931c('0x49')](_0x507221[_0x931c('0x21')],!![]);}else{this[_0x931c('0x49')](_0x507221[_0x931c('0x21')],![],this[_0x931c('0xd')][_0x507221[_0x931c('0x21')]][_0x931c('0x4f')]?_0x931c('0x50')+this['channels'][_0x507221[_0x931c('0x21')]][_0x931c('0x4f')]:'SENDING\x20FAILED');}}}};Fax[_0x931c('0x1c')]['send']=function(_0x368e72){var _0x106fb7=this;return new BPromise(function(_0x194643,_0x4eb7ab){_0x106fb7[_0x931c('0x51')](_0x368e72,_0x106fb7['faxAccounts'][_0x368e72[_0x931c('0x52')]])[_0x931c('0x3b')](function(_0x1f2603){ut['logger'](_0x931c('0x53'),_0x1f2603);_0x194643(ut['message']('Fax\x20received'));})['catch'](function(_0xf08d2b){ut[_0x931c('0x45')](_0x931c('0x54'),_0xf08d2b);updateStatus(_0x368e72);_0x4eb7ab(ut[_0x931c('0x55')]('Fax\x20failed'));});});};Fax['prototype'][_0x931c('0x56')]=function(_0x5d079c){var _0x958485=this;return new BPromise(function(_0xf76d79,_0x572043){var _0x3fc96f=_0x958485[_0x931c('0x57')](_0x958485['faxAccounts'][_0x5d079c['FaxAccountId']]['Trunk'],_0x5d079c);if(_0x3fc96f[_0x931c('0x58')]){_0xf76d79(ut['message'](_0x931c('0x59')));}else{_0x572043(ut[_0x931c('0x55')](_0x3fc96f[_0x931c('0x55')]));}});};function originate(_0x5c4d05,_0x4f0433,_0x25ecdd){return new BPromise(function(_0x1c14b9,_0x5735a5){if(_0x25ecdd){var _0x100c3e=util[_0x931c('0x5a')](_0x931c('0x5b'),path[_0x931c('0x38')](_0x5c4d05[_0x931c('0x5c')])[_0x931c('0x23')],_0x5c4d05[_0x931c('0x5c')]);gs[_0x931c('0x5d')](_0x100c3e)[_0x931c('0x3b')](function(){_0x5c4d05['path']=util['format'](_0x931c('0x5e'),path['parse'](_0x5c4d05[_0x931c('0x5c')])['dir'],path['parse'](_0x5c4d05[_0x931c('0x5c')])['name']);_0x4f0433[_0x931c('0x5f')]=_0x5c4d05[_0x931c('0x5c')];ut[_0x931c('0x45')](_0x931c('0x60'),'');ami[_0x931c('0x61')](ut[_0x931c('0x62')](_0x5c4d05,_0x4f0433))[_0x931c('0x3b')](function(_0x125b51){_0x1c14b9(_0x125b51);})[_0x931c('0x3c')](function(_0x105b4b){_0x5735a5(_0x105b4b);});})[_0x931c('0x3c')](function(_0xbd4af2){_0x5735a5(_0xbd4af2);});}else{ami[_0x931c('0x61')](ut[_0x931c('0x62')](_0x5c4d05,_0x4f0433))['then'](function(_0x3cbb26){_0x1c14b9(_0x3cbb26);})['catch'](function(_0x5b6059){_0x5735a5(_0x5b6059);});}});}Fax['prototype'][_0x931c('0x51')]=function(_0x33c8dc,_0x3cbea2){var _0x65a17d=this;return new BPromise(function(_0x2af2d6,_0x3cb64d){var _0x259cbc=uuid['v4']();var _0x1dd1c1=ut['addVariables'](_0x33c8dc,_0x3cbea2);_0x65a17d[_0x931c('0x25')][_0x259cbc]=new Action(_0x259cbc,_0x3cbea2,_0x33c8dc);var _0x11fd23=_0x65a17d[_0x931c('0x25')][_0x259cbc];if(path[_0x931c('0x38')](_0x33c8dc[_0x931c('0x5c')])[_0x931c('0x63')]===_0x931c('0x39')){originate(_0x11fd23,_0x1dd1c1,!![])['then'](function(_0x23e48d){_0x2af2d6(_0x23e48d);})['catch'](function(_0x3a31de){_0x3cb64d(_0x3a31de);});}else{originate(_0x11fd23,_0x1dd1c1,![])[_0x931c('0x3b')](function(_0x555de7){_0x2af2d6(_0x555de7);})['catch'](function(_0x563d2f){_0x3cb64d(_0x563d2f);});}});};Fax[_0x931c('0x1c')][_0x931c('0x64')]=function(_0x203a70){return!_[_0x931c('0x65')](_0x203a70)&&!_[_0x931c('0x65')](_0x203a70[_0x931c('0x23')])&&!_[_0x931c('0x65')](_0x203a70[_0x931c('0x66')])&&_0x203a70[_0x931c('0x66')]&&!_[_0x931c('0x65')](this['trunks'][util[_0x931c('0x5a')](_0x931c('0x67'),_0x203a70[_0x931c('0x23')])])&&!_[_0x931c('0x65')](this[_0x931c('0xf')][util[_0x931c('0x5a')]('SIP/%s',_0x203a70[_0x931c('0x23')])][_0x931c('0x2e')])&&(this[_0x931c('0xf')][util[_0x931c('0x5a')](_0x931c('0x67'),_0x203a70['name'])]['status']==='reachable'||this[_0x931c('0xf')][util[_0x931c('0x5a')](_0x931c('0x67'),_0x203a70[_0x931c('0x23')])]['status']===_0x931c('0x68'));};Fax['prototype'][_0x931c('0x57')]=function(_0x9c68,_0x4c5211){if(!this[_0x931c('0x64')](_0x9c68)){ut[_0x931c('0x45')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x931c('0x65')](_0x9c68)?'':_0x9c68['name']+_0x931c('0x69'));return{'isValid':![],'message':_0x931c('0x6a')};}if(_[_0x931c('0x65')](_0x4c5211['fax'])){ut['logger'](_0x931c('0x6b'),JSON[_0x931c('0x3f')](_0x4c5211));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x931c('0x65')](_0x4c5211[_0x931c('0x5c')])){ut[_0x931c('0x45')](_0x931c('0x6c'),JSON[_0x931c('0x3f')](_0x4c5211));return{'isValid':![],'message':_0x931c('0x6d')};}return{'isValid':!![],'message':_0x931c('0x6e')};};module[_0x931c('0x6f')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 48115bd..8792700 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 _0x97c0=['../../../config/logger','lodash','inspect','notify','resolve','then','catch','[Notify]\x20','util'];(function(_0x103303,_0x114a7c){var _0x297960=function(_0x2837d7){while(--_0x2837d7){_0x103303['push'](_0x103303['shift']());}};_0x297960(++_0x114a7c);}(_0x97c0,0xa1));var _0x097c=function(_0x26fc17,_0x5ab35e){_0x26fc17=_0x26fc17-0x0;var _0x47be11=_0x97c0[_0x26fc17];return _0x47be11;};'use strict';var util=require(_0x097c('0x0'));var BPromise=require('bluebird');var logger=require(_0x097c('0x1'))('preview');var _=require(_0x097c('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x430d3f){return function(_0x403727){logger['error'](_0x430d3f,util[_0x097c('0x3')](_0x403727,{'showHidden':![],'depth':null}));};}exports[_0x097c('0x4')]=function(_0x461dc2,_0x3c9b8b){return BPromise[_0x097c('0x5')]()[_0x097c('0x6')](faxAccount['notify'](_0x461dc2,_0x3c9b8b))[_0x097c('0x7')](loggerCatch(_0x097c('0x8')));}; \ No newline at end of file +var _0x64e5=['catch','[Notify]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then'];(function(_0x5090d4,_0x1950a7){var _0x56c310=function(_0x3d3d5c){while(--_0x3d3d5c){_0x5090d4['push'](_0x5090d4['shift']());}};_0x56c310(++_0x1950a7);}(_0x64e5,0x146));var _0x564e=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x64e5[_0x5bd426];return _0x23a7eb;};'use strict';var util=require('util');var BPromise=require(_0x564e('0x0'));var logger=require(_0x564e('0x1'))(_0x564e('0x2'));var _=require(_0x564e('0x3'));var faxAccount=require(_0x564e('0x4'));function loggerCatch(_0xcf6f85){return function(_0x480ff5){logger[_0x564e('0x5')](_0xcf6f85,util[_0x564e('0x6')](_0x480ff5,{'showHidden':![],'depth':null}));};}exports[_0x564e('0x7')]=function(_0x2d5d14,_0xd2ede5){return BPromise[_0x564e('0x8')]()[_0x564e('0x9')](faxAccount[_0x564e('0x7')](_0x2d5d14,_0xd2ede5))[_0x564e('0xa')](loggerCatch(_0x564e('0xb')));}; \ 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 dfbdb63..ac5cd97 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 _0x0035=['info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','exec'];(function(_0x2795cd,_0x1e59d4){var _0x208d9c=function(_0x386f2f){while(--_0x386f2f){_0x2795cd['push'](_0x2795cd['shift']());}};_0x208d9c(++_0x1e59d4);}(_0x0035,0x1cc));var _0x5003=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x0035[_0x469a3c];return _0x968f4;};'use strict';var util=require('util');var logger=require(_0x5003('0x0'))(_0x5003('0x1'));var BPromise=require(_0x5003('0x2'));var exec=require('child_process')[_0x5003('0x3')];exports['execute']=function(_0x5d1815){return new BPromise(function(_0x1965fc,_0x1134ec){exec(_0x5d1815,function(_0xe9829f,_0x8f149c,_0x133284){logger[_0x5003('0x4')](_0x5003('0x5'),_0x8f149c);if(_0xe9829f){logger[_0x5003('0x4')](_0x5003('0x5'),_0x5003('0x6'),util[_0x5003('0x7')](_0xe9829f,{'showHidden':![],'depth':null}),_0x8f149c,_0x133284);_0x1134ec(_0xe9829f);}_0x1965fc(_0x8f149c);});});}; \ No newline at end of file +var _0x2dd9=['exec','execute','Exec\x20gs','\x20Error\x20:','util','fax','child_process'];(function(_0x33c8cb,_0x56cff2){var _0x2d28bb=function(_0x1fcc9b){while(--_0x1fcc9b){_0x33c8cb['push'](_0x33c8cb['shift']());}};_0x2d28bb(++_0x56cff2);}(_0x2dd9,0x74));var _0x92dd=function(_0x237e22,_0x1a728d){_0x237e22=_0x237e22-0x0;var _0x2c5244=_0x2dd9[_0x237e22];return _0x2c5244;};'use strict';var util=require(_0x92dd('0x0'));var logger=require('../../../../config/logger')(_0x92dd('0x1'));var BPromise=require('bluebird');var exec=require(_0x92dd('0x2'))[_0x92dd('0x3')];exports[_0x92dd('0x4')]=function(_0x35df2c){return new BPromise(function(_0xed41c7,_0x3880c3){exec(_0x35df2c,function(_0x344c5e,_0x9c05d5,_0x10d199){logger['info']('Exec\x20gs',_0x9c05d5);if(_0x344c5e){logger['info'](_0x92dd('0x5'),_0x92dd('0x6'),util['inspect'](_0x344c5e,{'showHidden':![],'depth':null}),_0x9c05d5,_0x10d199);_0x3880c3(_0x344c5e);}_0xed41c7(_0x9c05d5);});});}; \ 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 b2be6de..ea4c705 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 _0xec56=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0xec56,0x1bd));var _0x6ec5=function(_0x202d63,_0xb52947){_0x202d63=_0x202d63-0x0;var _0x103b6f=_0xec56[_0x202d63];return _0x103b6f;};'use strict';var util=require(_0x6ec5('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x6ec5('0x1'))(_0x6ec5('0x2'));exports[_0x6ec5('0x3')]=function(_0x240ccf){return{'message':_0x240ccf};};exports[_0x6ec5('0x4')]=function(_0x399441,_0x469679){logger[_0x6ec5('0x5')](_0x399441,util[_0x6ec5('0x6')](_0x469679,{'showHidden':![],'depth':null}));};exports[_0x6ec5('0x7')]=function(_0x2d0a93,_0x3bb683){var _0x35be4e={'XMF-ECM':_0x3bb683[_0x6ec5('0x8')],'XMF-HEADERINFO':_0x3bb683[_0x6ec5('0x9')],'XMF-MINRATE':_0x3bb683[_0x6ec5('0xa')],'XMF-MAXRATE':_0x3bb683[_0x6ec5('0xb')],'XMF-MODEM':util[_0x6ec5('0xc')](_0x6ec5('0xd'),_0x3bb683['modem']),'XMF-GATEWAY':_0x3bb683[_0x6ec5('0xe')],'XMF-FAXDETECT':_0x3bb683[_0x6ec5('0xf')],'XMF-T38TIMEOUT':_0x3bb683[_0x6ec5('0x10')],'XMF-LOCALSTATIONID':_0x3bb683[_0x6ec5('0x11')],'XMF-PATH':_0x2d0a93[_0x6ec5('0x12')]};return _0x35be4e;};exports[_0x6ec5('0x13')]=function(_0x1d5b76,_0x50eb2d){return{'actionid':_0x1d5b76[_0x6ec5('0x14')],'action':_0x6ec5('0x15'),'channel':_0x1d5b76[_0x6ec5('0x16')],'Exten':_0x6ec5('0x17'),'Context':_0x6ec5('0x18'),'Priority':'1','callerid':util[_0x6ec5('0xc')](_0x6ec5('0x19'),_0x1d5b76[_0x6ec5('0x9')]?_0x1d5b76['headerinfo']:'',_0x1d5b76[_0x6ec5('0x11')]),'variable':_0x50eb2d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1d5b76['uniqueid']};}; \ No newline at end of file +var _0xd3d1=['gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','util','lodash','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','modem'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd3d1,0x172));var _0x1d3d=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xd3d1[_0x263a74];return _0x2aa86c;};'use strict';var util=require(_0x1d3d('0x0'));var _=require(_0x1d3d('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x1d3d('0x2'));exports[_0x1d3d('0x3')]=function(_0x1b8ea2){return{'message':_0x1b8ea2};};exports[_0x1d3d('0x4')]=function(_0x41a806,_0x328a4e){logger[_0x1d3d('0x5')](_0x41a806,util[_0x1d3d('0x6')](_0x328a4e,{'showHidden':![],'depth':null}));};exports[_0x1d3d('0x7')]=function(_0x449475,_0x3831ce){var _0xb1b3c6={'XMF-ECM':_0x3831ce[_0x1d3d('0x8')],'XMF-HEADERINFO':_0x3831ce[_0x1d3d('0x9')],'XMF-MINRATE':_0x3831ce[_0x1d3d('0xa')],'XMF-MAXRATE':_0x3831ce[_0x1d3d('0xb')],'XMF-MODEM':util[_0x1d3d('0xc')]('\x22%s\x22',_0x3831ce[_0x1d3d('0xd')]),'XMF-GATEWAY':_0x3831ce[_0x1d3d('0xe')],'XMF-FAXDETECT':_0x3831ce[_0x1d3d('0xf')],'XMF-T38TIMEOUT':_0x3831ce[_0x1d3d('0x10')],'XMF-LOCALSTATIONID':_0x3831ce[_0x1d3d('0x11')],'XMF-PATH':_0x449475[_0x1d3d('0x12')]};return _0xb1b3c6;};exports[_0x1d3d('0x13')]=function(_0x2fa11e,_0x3b3913){return{'actionid':_0x2fa11e[_0x1d3d('0x14')],'action':_0x1d3d('0x15'),'channel':_0x2fa11e['channel'],'Exten':_0x1d3d('0x16'),'Context':_0x1d3d('0x17'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x2fa11e[_0x1d3d('0x9')]?_0x2fa11e[_0x1d3d('0x9')]:'',_0x2fa11e[_0x1d3d('0x11')]),'variable':_0x3b3913,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2fa11e['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 91f55dd..4aec020 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 _0x9c42=['./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','resolve','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','bluebird','util','moment','./server','./realtime','./trigger'];(function(_0x203153,_0x47984d){var _0x577060=function(_0x5dff91){while(--_0x5dff91){_0x203153['push'](_0x203153['shift']());}};_0x577060(++_0x47984d);}(_0x9c42,0xf2));var _0x29c4=function(_0x24a654,_0x2ca441){_0x24a654=_0x24a654-0x0;var _0x458651=_0x9c42[_0x24a654];return _0x458651;};'use strict';var BPromise=require(_0x29c4('0x0'));var util=require(_0x29c4('0x1'));var moment=require(_0x29c4('0x2'));var server=require(_0x29c4('0x3'));var Realtime=require(_0x29c4('0x4'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0x29c4('0x5'));var Dialer=require(_0x29c4('0x6'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x29c4('0x7'));var voiceQueue=require(_0x29c4('0x8'));var voiceQueueReport=require(_0x29c4('0x9'));var voiceCallReport=require(_0x29c4('0xa'));var trunk=require(_0x29c4('0xb'));var trigger=require(_0x29c4('0xc'));var template=require(_0x29c4('0xd'));var cmHopperHistory=require(_0x29c4('0xe'));var campaign=require(_0x29c4('0xf'));var voiceExtension=require(_0x29c4('0x10'));var faxAccount=require(_0x29c4('0x11'));var zendesk=require(_0x29c4('0x12'));var salesforce=require(_0x29c4('0x13'));var sugarcrm=require(_0x29c4('0x14'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0x29c4('0x15'));var vtiger=require(_0x29c4('0x16'));var freshsales=require(_0x29c4('0x17'));var servicenow=require(_0x29c4('0x18'));var dynamics365=require(_0x29c4('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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x29c4('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x29c4('0x1a')](_0x29c4('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x29c4('0x1c')](user[_0x29c4('0x1d')]())['then'](realtime['initAgents']())[_0x29c4('0x1c')](user[_0x29c4('0x1e')]())['then'](realtime[_0x29c4('0x1f')]())['then'](trunk[_0x29c4('0x20')]())[_0x29c4('0x1c')](realtime['initTrunks']())[_0x29c4('0x1c')](voiceQueue[_0x29c4('0x21')]())['then'](realtime[_0x29c4('0x22')]())[_0x29c4('0x1c')](trigger['getTriggers']())[_0x29c4('0x1c')](realtime[_0x29c4('0x23')]())[_0x29c4('0x1c')](template['getTemplates']())[_0x29c4('0x1c')](realtime[_0x29c4('0x24')]())[_0x29c4('0x1c')](zendesk[_0x29c4('0x25')]())[_0x29c4('0x1c')](realtime[_0x29c4('0x26')]())[_0x29c4('0x1c')](salesforce[_0x29c4('0x27')]())['then'](realtime[_0x29c4('0x28')]())['then'](sugarcrm[_0x29c4('0x29')]())[_0x29c4('0x1c')](realtime[_0x29c4('0x2a')]())[_0x29c4('0x1c')](freshdesk[_0x29c4('0x2b')]())['then'](realtime['initFreshdeskAccounts']())[_0x29c4('0x1c')](desk[_0x29c4('0x2c')]())[_0x29c4('0x1c')](realtime['initDeskAccounts']())['then'](zoho['getZohoAccounts']())[_0x29c4('0x1c')](realtime['initZohoAccounts']())[_0x29c4('0x1c')](vtiger['getVtigerAccounts']())[_0x29c4('0x1c')](realtime['initVtigerAccounts']())[_0x29c4('0x1c')](freshsales[_0x29c4('0x2d')]())[_0x29c4('0x1c')](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x29c4('0x2e')]())[_0x29c4('0x1c')](realtime[_0x29c4('0x2f')]())['then'](dynamics365['getDynamics365Accounts']())[_0x29c4('0x1c')](realtime[_0x29c4('0x30')]())[_0x29c4('0x1c')](campaign[_0x29c4('0x31')]())[_0x29c4('0x1c')](realtime[_0x29c4('0x32')]())['then'](voiceExtension[_0x29c4('0x33')]())[_0x29c4('0x1c')](realtime['initVoiceExtensions']())[_0x29c4('0x1c')](faxAccount[_0x29c4('0x34')]())[_0x29c4('0x1c')](realtime['initFaxAccounts']())[_0x29c4('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0x29c4('0x35')]()[_0x29c4('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0x29c4('0x1c')](realtime[_0x29c4('0x36')]())[_0x29c4('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x29c4('0x1c')](realtime[_0x29c4('0x37')]())[_0x29c4('0x1c')](cmHopperHistory['getCampaignHopperHistory']())[_0x29c4('0x1c')](realtime[_0x29c4('0x38')]())[_0x29c4('0x1c')](voiceCallReport[_0x29c4('0x39')]())[_0x29c4('0x1c')](realtime[_0x29c4('0x3a')]())[_0x29c4('0x1c')](function(_0x57d6e8){})[_0x29c4('0x3b')](function(_0x1b8150){console[_0x29c4('0x3c')](_0x1b8150);});}function main(){return server[_0x29c4('0x3d')](realtime,preview,fax)[_0x29c4('0x1c')](function(_0x5284f4){return initRealtime();})[_0x29c4('0x1c')](function(){return initParams();})[_0x29c4('0x1c')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x29c4('0x3b')](function(_0x54de05){console[_0x29c4('0x3c')](_0x54de05);});}main(); \ No newline at end of file +var _0xa1bf=['getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','catch','log','listen','sync','bluebird','util','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates'];(function(_0x1591d4,_0x4ea3bd){var _0x4c46bb=function(_0x13b7e7){while(--_0x13b7e7){_0x1591d4['push'](_0x1591d4['shift']());}};_0x4c46bb(++_0x4ea3bd);}(_0xa1bf,0x96));var _0xfa1b=function(_0x242225,_0x23e175){_0x242225=_0x242225-0x0;var _0x272125=_0xa1bf[_0x242225];return _0x272125;};'use strict';var BPromise=require(_0xfa1b('0x0'));var util=require(_0xfa1b('0x1'));var moment=require('moment');var server=require('./server');var Realtime=require(_0xfa1b('0x2'));var Report=require(_0xfa1b('0x3'));var Acw=require('./acw');var Trigger=require(_0xfa1b('0x4'));var Dialer=require(_0xfa1b('0x5'));var Preview=require(_0xfa1b('0x6'));var Fax=require(_0xfa1b('0x7'));var user=require(_0xfa1b('0x8'));var voiceQueue=require(_0xfa1b('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0xfa1b('0xa'));var cmHopperHistory=require(_0xfa1b('0xb'));var campaign=require(_0xfa1b('0xc'));var voiceExtension=require(_0xfa1b('0xd'));var faxAccount=require(_0xfa1b('0xe'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xfa1b('0xf'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0xfa1b('0x10'));var vtiger=require(_0xfa1b('0x11'));var freshsales=require(_0xfa1b('0x12'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xfa1b('0x13')](_0xfa1b('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xfa1b('0x13')](_0xfa1b('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xfa1b('0x15')]()[_0xfa1b('0x16')](user[_0xfa1b('0x17')]())[_0xfa1b('0x16')](realtime[_0xfa1b('0x18')]())[_0xfa1b('0x16')](user[_0xfa1b('0x19')]())[_0xfa1b('0x16')](realtime[_0xfa1b('0x1a')]())[_0xfa1b('0x16')](trunk[_0xfa1b('0x1b')]())[_0xfa1b('0x16')](realtime['initTrunks']())[_0xfa1b('0x16')](voiceQueue[_0xfa1b('0x1c')]())['then'](realtime[_0xfa1b('0x1d')]())['then'](trigger['getTriggers']())['then'](realtime[_0xfa1b('0x1e')]())[_0xfa1b('0x16')](template[_0xfa1b('0x1f')]())[_0xfa1b('0x16')](realtime[_0xfa1b('0x20')]())[_0xfa1b('0x16')](zendesk[_0xfa1b('0x21')]())[_0xfa1b('0x16')](realtime[_0xfa1b('0x22')]())[_0xfa1b('0x16')](salesforce[_0xfa1b('0x23')]())[_0xfa1b('0x16')](realtime['initSalesforceAccounts']())[_0xfa1b('0x16')](sugarcrm[_0xfa1b('0x24')]())[_0xfa1b('0x16')](realtime[_0xfa1b('0x25')]())[_0xfa1b('0x16')](freshdesk[_0xfa1b('0x26')]())[_0xfa1b('0x16')](realtime[_0xfa1b('0x27')]())[_0xfa1b('0x16')](desk[_0xfa1b('0x28')]())[_0xfa1b('0x16')](realtime[_0xfa1b('0x29')]())['then'](zoho['getZohoAccounts']())[_0xfa1b('0x16')](realtime['initZohoAccounts']())[_0xfa1b('0x16')](vtiger[_0xfa1b('0x2a')]())['then'](realtime[_0xfa1b('0x2b')]())[_0xfa1b('0x16')](freshsales[_0xfa1b('0x2c')]())[_0xfa1b('0x16')](realtime[_0xfa1b('0x2d')]())[_0xfa1b('0x16')](servicenow['getServicenowAccounts']())[_0xfa1b('0x16')](realtime[_0xfa1b('0x2e')]())[_0xfa1b('0x16')](dynamics365[_0xfa1b('0x2f')]())['then'](realtime[_0xfa1b('0x30')]())[_0xfa1b('0x16')](campaign['getCampaigns']())[_0xfa1b('0x16')](realtime[_0xfa1b('0x31')]())[_0xfa1b('0x16')](voiceExtension[_0xfa1b('0x32')]())[_0xfa1b('0x16')](realtime[_0xfa1b('0x33')]())[_0xfa1b('0x16')](faxAccount['getFaxAccounts']())[_0xfa1b('0x16')](realtime[_0xfa1b('0x34')]())[_0xfa1b('0x16')](function(){return realtime;});}function initParams(){return BPromise[_0xfa1b('0x15')]()[_0xfa1b('0x16')](voiceQueueReport[_0xfa1b('0x35')]())[_0xfa1b('0x16')](realtime[_0xfa1b('0x36')]())[_0xfa1b('0x16')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xfa1b('0x16')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0xfa1b('0x37')]())[_0xfa1b('0x16')](realtime[_0xfa1b('0x38')]())[_0xfa1b('0x16')](voiceCallReport['getVoiceCallReports']())[_0xfa1b('0x16')](realtime['initVoiceCallReports']())[_0xfa1b('0x16')](function(_0x460a4f){})[_0xfa1b('0x39')](function(_0x4ec0fb){console[_0xfa1b('0x3a')](_0x4ec0fb);});}function main(){return server[_0xfa1b('0x3b')](realtime,preview,fax)[_0xfa1b('0x16')](function(_0xdd4ca9){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0xfa1b('0x3c')]();setInterval(initRealtime,0x1388);})[_0xfa1b('0x39')](function(_0x2d0130){console[_0xfa1b('0x3a')](_0x2d0130);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index a07790a..ffefc08 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 _0x8d63=['ioredis','../../../config/environment','redis','defaults','localhost','email','accountcode','fullname','state','unknown','status','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','idle','inuse','talking','statePause','toNumber','name','stateTime','voiceStatusCallerIdNumber','stringify','format','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','md5'];(function(_0xa20401,_0x1d3e18){var _0x1106f9=function(_0x143654){while(--_0x143654){_0xa20401['push'](_0xa20401['shift']());}};_0x1106f9(++_0x1d3e18);}(_0x8d63,0xa4));var _0x38d6=function(_0x34260d,_0x401ebb){_0x34260d=_0x34260d-0x0;var _0x174c68=_0x8d63[_0x34260d];return _0x174c68;};'use strict';var _=require(_0x38d6('0x0'));var util=require(_0x38d6('0x1'));var moment=require(_0x38d6('0x2'));var md5=require(_0x38d6('0x3'));var Redis=require(_0x38d6('0x4'));var config=require(_0x38d6('0x5'));config[_0x38d6('0x6')]=_[_0x38d6('0x7')](config[_0x38d6('0x6')],{'host':_0x38d6('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x38d6('0x6')]));function Agent(_0x377f45){this['id']=_0x377f45['id']||0x0;this['name']=_0x377f45['name']||'';this[_0x38d6('0x9')]=_0x377f45[_0x38d6('0x9')]||'';this[_0x38d6('0xa')]=_0x377f45['accountcode']||'';this[_0x38d6('0xb')]=_0x377f45[_0x38d6('0xb')]||'';this[_0x38d6('0xc')]=_0x38d6('0xd');this['stateTime']=0x0;this[_0x38d6('0xe')]=_0x38d6('0xd');this['address']='';this[_0x38d6('0xf')]='';this[_0x38d6('0x10')]='';this[_0x38d6('0x11')]='';this['online']=_0x377f45[_0x38d6('0x12')]||![];this[_0x38d6('0x13')]=_0x38d6('0xd');this[_0x38d6('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x38d6('0x15')]='';this[_0x38d6('0x16')]=![];this[_0x38d6('0x17')]=![];this[_0x38d6('0x3')]='';}Agent[_0x38d6('0x18')][_0x38d6('0x19')]=function(_0x2e1001){var _0x666e42;if(_0x2e1001&&_0x2e1001[_0x38d6('0xc')]){_0x666e42=_0x2e1001[_0x38d6('0xc')][_0x38d6('0x1a')]();switch(_0x666e42){case'not_inuse':_0x666e42=_0x38d6('0x1b');break;case _0x38d6('0x1c'):_0x666e42=_0x38d6('0x1d');break;}}if(_0x666e42&&this['voiceStatus']!==_0x666e42||_0x2e1001[_0x38d6('0x1e')]){this[_0x38d6('0x14')]=_[_0x38d6('0x1f')](moment()['format']('x'));}if(_0x666e42){this[_0x38d6('0x13')]=_0x666e42;}var _0x373151={'id':this['id'],'name':this[_0x38d6('0x20')],'email':this[_0x38d6('0x9')],'accountcode':this[_0x38d6('0xa')],'fullname':this[_0x38d6('0xb')],'state':this[_0x38d6('0xc')],'stateTime':this[_0x38d6('0x21')],'status':this[_0x38d6('0xe')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x38d6('0x13')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x38d6('0x22')],'voiceStatusQueue':this[_0x38d6('0x15')],'interface':this[_0x38d6('0x11')],'onhold':this[_0x38d6('0x16')]};var _0x5a0a03=md5(JSON[_0x38d6('0x23')](_0x373151));if(this[_0x38d6('0x3')]!==_0x5a0a03){this[_0x38d6('0x3')]=_0x5a0a03;io['to'](util[_0x38d6('0x24')](_0x38d6('0x25'),_0x373151[_0x38d6('0x20')]))[_0x38d6('0x26')](_0x38d6('0x27'),_0x373151);io[_0x38d6('0x26')](_0x38d6('0x28'),_0x373151);}};module[_0x38d6('0x29')]=Agent; \ No newline at end of file +var _0x8627=['moment','md5','ioredis','../../../config/environment','localhost','socket.io-emitter','redis','name','email','accountcode','fullname','status','unknown','address','phone','interface','online','voiceStatusCallerIdNumber','voiceStatusQueue','local','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','voiceStatusTime','format','stateTime','onhold','stringify','user:%s','emit','user:save','exports','lodash','util'];(function(_0x3cd025,_0x1e2adf){var _0xaa86eb=function(_0x1029d0){while(--_0x1029d0){_0x3cd025['push'](_0x3cd025['shift']());}};_0xaa86eb(++_0x1e2adf);}(_0x8627,0x18e));var _0x7862=function(_0x103f71,_0x28d487){_0x103f71=_0x103f71-0x0;var _0x13f009=_0x8627[_0x103f71];return _0x13f009;};'use strict';var _=require(_0x7862('0x0'));var util=require(_0x7862('0x1'));var moment=require(_0x7862('0x2'));var md5=require(_0x7862('0x3'));var Redis=require(_0x7862('0x4'));var config=require(_0x7862('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0x7862('0x6'),'port':0x18eb});var io=require(_0x7862('0x7'))(new Redis(config[_0x7862('0x8')]));function Agent(_0x55ddb6){this['id']=_0x55ddb6['id']||0x0;this[_0x7862('0x9')]=_0x55ddb6['name']||'';this[_0x7862('0xa')]=_0x55ddb6[_0x7862('0xa')]||'';this['accountcode']=_0x55ddb6[_0x7862('0xb')]||'';this[_0x7862('0xc')]=_0x55ddb6[_0x7862('0xc')]||'';this['state']='unknown';this['stateTime']=0x0;this[_0x7862('0xd')]=_0x7862('0xe');this[_0x7862('0xf')]='';this[_0x7862('0x10')]='';this['mobile']='';this[_0x7862('0x11')]='';this[_0x7862('0x12')]=_0x55ddb6[_0x7862('0x12')]||![];this['voiceStatus']=_0x7862('0xe');this['voiceStatusTime']=0x0;this[_0x7862('0x13')]='';this[_0x7862('0x14')]='';this['onhold']=![];this[_0x7862('0x15')]=![];this[_0x7862('0x3')]='';}Agent['prototype'][_0x7862('0x16')]=function(_0x2ad106){var _0x3787a4;if(_0x2ad106&&_0x2ad106[_0x7862('0x17')]){_0x3787a4=_0x2ad106[_0x7862('0x17')][_0x7862('0x18')]();switch(_0x3787a4){case _0x7862('0x19'):_0x3787a4=_0x7862('0x1a');break;case _0x7862('0x1b'):_0x3787a4=_0x7862('0x1c');break;}}if(_0x3787a4&&this[_0x7862('0x1d')]!==_0x3787a4||_0x2ad106[_0x7862('0x1e')]){this[_0x7862('0x1f')]=_['toNumber'](moment()[_0x7862('0x20')]('x'));}if(_0x3787a4){this[_0x7862('0x1d')]=_0x3787a4;}var _0x149bf1={'id':this['id'],'name':this[_0x7862('0x9')],'email':this[_0x7862('0xa')],'accountcode':this[_0x7862('0xb')],'fullname':this[_0x7862('0xc')],'state':this[_0x7862('0x17')],'stateTime':this[_0x7862('0x21')],'status':this['status'],'address':this['address'],'online':this[_0x7862('0x12')],'voiceStatus':this[_0x7862('0x1d')],'voiceStatusTime':this[_0x7862('0x1f')],'voiceStatusCallerIdNumber':this[_0x7862('0x13')],'voiceStatusQueue':this[_0x7862('0x14')],'interface':this[_0x7862('0x11')],'onhold':this[_0x7862('0x22')]};var _0x1e8535=md5(JSON[_0x7862('0x23')](_0x149bf1));if(this['md5']!==_0x1e8535){this[_0x7862('0x3')]=_0x1e8535;io['to'](util[_0x7862('0x20')](_0x7862('0x24'),_0x149bf1[_0x7862('0x9')]))[_0x7862('0x25')](_0x7862('0x26'),_0x149bf1);io[_0x7862('0x25')]('user:presence',_0x149bf1);}};module[_0x7862('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 352a0e7..6b2d50b 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 _0x4b66=['SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval'];(function(_0x5621e3,_0x26c84c){var _0x4f225b=function(_0x3fb651){while(--_0x3fb651){_0x5621e3['push'](_0x5621e3['shift']());}};_0x4f225b(++_0x26c84c);}(_0x4b66,0x6a));var _0x64b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4b66[_0x321bb2];return _0x9c12ed;};'use strict';function Campaign(_0xe4c8ed){this['id']=_0xe4c8ed['id']||0x0;this[_0x64b6('0x0')]=_0xe4c8ed[_0x64b6('0x0')]||'';this[_0x64b6('0x1')]=_0xe4c8ed[_0x64b6('0x1')]||_0x64b6('0x2');this['originated']=0x0;this['temp']=0x0;this[_0x64b6('0x3')]=0x0;this[_0x64b6('0x4')]=0x0;this['message']='';this[_0x64b6('0x5')]=!![];this[_0x64b6('0x6')]=_0xe4c8ed[_0x64b6('0x6')];this[_0x64b6('0x7')]=_0xe4c8ed[_0x64b6('0x7')];this[_0x64b6('0x8')]=_0xe4c8ed['dialTimezone']||null;this['dialGlobalInterval']=_0xe4c8ed[_0x64b6('0x9')]?_0xe4c8ed[_0x64b6('0x9')]:null;this['dialOriginateCallerIdName']=_0xe4c8ed[_0x64b6('0xa')];this[_0x64b6('0xb')]=_0xe4c8ed[_0x64b6('0xb')];this['dialOriginateTimeout']=_0xe4c8ed['dialOriginateTimeout']||0x1e;this[_0x64b6('0xc')]=_0xe4c8ed[_0x64b6('0xc')];this[_0x64b6('0xd')]=_0xe4c8ed[_0x64b6('0xd')];this[_0x64b6('0xe')]=_0xe4c8ed['dialBusyMaxRetry'];this[_0x64b6('0xf')]=_0xe4c8ed['dialBusyRetryFrequency'];this[_0x64b6('0x10')]=_0xe4c8ed[_0x64b6('0x10')];this[_0x64b6('0x11')]=_0xe4c8ed[_0x64b6('0x11')];this['dialGlobalMaxRetry']=_0xe4c8ed[_0x64b6('0x12')];this[_0x64b6('0x13')]=_0xe4c8ed['dialNoSuchNumberMaxRetry']||0x3;this[_0x64b6('0x14')]=_0xe4c8ed[_0x64b6('0x14')]||0x96;this['dialDropMaxRetry']=_0xe4c8ed['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0xe4c8ed[_0x64b6('0x15')]||0x96;this[_0x64b6('0x16')]=_0xe4c8ed['dialAbandonedMaxRetry']||0x3;this[_0x64b6('0x17')]=_0xe4c8ed[_0x64b6('0x17')]||0x96;this[_0x64b6('0x18')]=_0xe4c8ed[_0x64b6('0x18')]||0x3;this[_0x64b6('0x19')]=_0xe4c8ed[_0x64b6('0x19')]||0x96;this[_0x64b6('0x1a')]=_0xe4c8ed['dialAgentRejectMaxRetry']||0x3;this[_0x64b6('0x1b')]=_0xe4c8ed[_0x64b6('0x1b')]||0x96;this[_0x64b6('0x1c')]=_0xe4c8ed['dialOrderByScheduledAt']||'DESC';this[_0x64b6('0x1d')]=_0xe4c8ed[_0x64b6('0x1d')]||undefined;this[_0x64b6('0x1e')]=_0xe4c8ed['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x64b6('0x1f')]=_0xe4c8ed[_0x64b6('0x1f')]||undefined;this['TrunkBackup']=_0xe4c8ed[_0x64b6('0x20')]?_0xe4c8ed[_0x64b6('0x20')]:undefined;this[_0x64b6('0x21')]=_0xe4c8ed[_0x64b6('0x21')]?_0xe4c8ed[_0x64b6('0x21')]:undefined;this[_0x64b6('0x22')]=_0xe4c8ed[_0x64b6('0x22')]?_0xe4c8ed[_0x64b6('0x22')]:undefined;this[_0x64b6('0x23')]=_0xe4c8ed[_0x64b6('0x23')]?_0xe4c8ed[_0x64b6('0x23')]:undefined;this['dialQueueProject']=_0xe4c8ed[_0x64b6('0x23')]?_0xe4c8ed[_0x64b6('0x23')][_0x64b6('0x0')]:undefined;this[_0x64b6('0x24')]=_0xe4c8ed[_0x64b6('0x24')]||![];this[_0x64b6('0x25')]=_0xe4c8ed[_0x64b6('0x25')];this[_0x64b6('0x26')]=_0xe4c8ed['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0xe4c8ed[_0x64b6('0x27')];this[_0x64b6('0x28')]=_0xe4c8ed[_0x64b6('0x28')];this[_0x64b6('0x29')]=_0xe4c8ed[_0x64b6('0x29')];this['dialAMDBetweenWordsSilence']=_0xe4c8ed[_0x64b6('0x2a')];this['dialAMDMaximumNumberOfWords']=_0xe4c8ed[_0x64b6('0x2b')];this['dialAMDSilenceThreshold']=_0xe4c8ed[_0x64b6('0x2c')];this[_0x64b6('0x2d')]=_0xe4c8ed[_0x64b6('0x2d')];}module[_0x64b6('0x2e')]=Campaign; \ No newline at end of file +var _0xd8b5=['type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name'];(function(_0x4cfa39,_0x2fc965){var _0x3e6dda=function(_0x231b3f){while(--_0x231b3f){_0x4cfa39['push'](_0x4cfa39['shift']());}};_0x3e6dda(++_0x2fc965);}(_0xd8b5,0x141));var _0x5d8b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd8b5[_0x14add3];return _0x4a174f;};'use strict';function Campaign(_0x1da9b1){this['id']=_0x1da9b1['id']||0x0;this['name']=_0x1da9b1[_0x5d8b('0x0')]||'';this[_0x5d8b('0x1')]=_0x1da9b1[_0x5d8b('0x1')]||'campaign';this['originated']=0x0;this[_0x5d8b('0x2')]=0x0;this[_0x5d8b('0x3')]=0x0;this[_0x5d8b('0x4')]=0x0;this[_0x5d8b('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x5d8b('0x6')]=_0x1da9b1['active'];this['limitCalls']=_0x1da9b1['limitCalls'];this[_0x5d8b('0x7')]=_0x1da9b1[_0x5d8b('0x7')]||null;this[_0x5d8b('0x8')]=_0x1da9b1['dialGlobalInterval']?_0x1da9b1['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x1da9b1[_0x5d8b('0x9')];this[_0x5d8b('0xa')]=_0x1da9b1[_0x5d8b('0xa')];this[_0x5d8b('0xb')]=_0x1da9b1[_0x5d8b('0xb')]||0x1e;this[_0x5d8b('0xc')]=_0x1da9b1['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x1da9b1['dialCongestionRetryFrequency'];this[_0x5d8b('0xd')]=_0x1da9b1[_0x5d8b('0xd')];this[_0x5d8b('0xe')]=_0x1da9b1[_0x5d8b('0xe')];this[_0x5d8b('0xf')]=_0x1da9b1['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x1da9b1['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x1da9b1[_0x5d8b('0x10')];this[_0x5d8b('0x11')]=_0x1da9b1[_0x5d8b('0x11')]||0x3;this[_0x5d8b('0x12')]=_0x1da9b1[_0x5d8b('0x12')]||0x96;this[_0x5d8b('0x13')]=_0x1da9b1[_0x5d8b('0x13')]||0x3;this['dialDropRetryFrequency']=_0x1da9b1[_0x5d8b('0x14')]||0x96;this[_0x5d8b('0x15')]=_0x1da9b1[_0x5d8b('0x15')]||0x3;this['dialAbandonedRetryFrequency']=_0x1da9b1[_0x5d8b('0x16')]||0x96;this[_0x5d8b('0x17')]=_0x1da9b1[_0x5d8b('0x17')]||0x3;this[_0x5d8b('0x18')]=_0x1da9b1[_0x5d8b('0x18')]||0x96;this[_0x5d8b('0x19')]=_0x1da9b1[_0x5d8b('0x19')]||0x3;this[_0x5d8b('0x1a')]=_0x1da9b1['dialAgentRejectRetryFrequency']||0x96;this[_0x5d8b('0x1b')]=_0x1da9b1[_0x5d8b('0x1b')]||_0x5d8b('0x1c');this[_0x5d8b('0x1d')]=_0x1da9b1['dialPrefix']||undefined;this[_0x5d8b('0x1e')]=_0x1da9b1[_0x5d8b('0x1e')]||undefined;this['dialCutDigit']=_0x1da9b1['dialCutDigit']||undefined;this[_0x5d8b('0x1f')]=_0x1da9b1[_0x5d8b('0x1f')]?_0x1da9b1[_0x5d8b('0x1f')]:undefined;this[_0x5d8b('0x20')]=_0x1da9b1['Trunk']?_0x1da9b1[_0x5d8b('0x20')]:undefined;this[_0x5d8b('0x21')]=_0x1da9b1[_0x5d8b('0x21')]?_0x1da9b1[_0x5d8b('0x21')]:undefined;this[_0x5d8b('0x22')]=_0x1da9b1[_0x5d8b('0x22')]?_0x1da9b1['SquareProject']:undefined;this[_0x5d8b('0x23')]=_0x1da9b1[_0x5d8b('0x22')]?_0x1da9b1['SquareProject'][_0x5d8b('0x0')]:undefined;this['dialAMDActive']=_0x1da9b1[_0x5d8b('0x24')]||![];this['dialAMDInitialSilence']=_0x1da9b1[_0x5d8b('0x25')];this['dialAMDGreeting']=_0x1da9b1[_0x5d8b('0x26')];this[_0x5d8b('0x27')]=_0x1da9b1[_0x5d8b('0x27')];this[_0x5d8b('0x28')]=_0x1da9b1[_0x5d8b('0x28')];this[_0x5d8b('0x29')]=_0x1da9b1[_0x5d8b('0x29')];this['dialAMDBetweenWordsSilence']=_0x1da9b1[_0x5d8b('0x2a')];this[_0x5d8b('0x2b')]=_0x1da9b1[_0x5d8b('0x2b')];this[_0x5d8b('0x2c')]=_0x1da9b1[_0x5d8b('0x2c')];this[_0x5d8b('0x2d')]=_0x1da9b1[_0x5d8b('0x2d')];}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 5aa362d..7dddfcb 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 _0x6426=['channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','mohtime','exports','starttime'];(function(_0x460f08,_0x9d73f1){var _0x5b64ad=function(_0x26de9b){while(--_0x26de9b){_0x460f08['push'](_0x460f08['shift']());}};_0x5b64ad(++_0x9d73f1);}(_0x6426,0x15b));var _0x6642=function(_0x19f748,_0x502312){_0x19f748=_0x19f748-0x0;var _0x5c4b0b=_0x6426[_0x19f748];return _0x5c4b0b;};'use strict';function Channel(){this[_0x6642('0x0')]=null;this[_0x6642('0x1')]='';this[_0x6642('0x2')]='';this[_0x6642('0x3')]=0x0;this[_0x6642('0x4')]='';this['connectedlinenum']=undefined;this[_0x6642('0x5')]=undefined;this[_0x6642('0x6')]=0x0;this['context']='';this[_0x6642('0x7')]=0x0;this[_0x6642('0x8')]=0x0;this[_0x6642('0x9')]=0x0;this[_0x6642('0xa')]=![];this[_0x6642('0xb')]=null;this[_0x6642('0xc')]=null;this['unmanaged']=![];this[_0x6642('0xd')]=![];this[_0x6642('0xe')]='';this[_0x6642('0xf')]='';this[_0x6642('0x10')]=0x0;this[_0x6642('0x11')]=0x0;this[_0x6642('0x12')]=0x0;this[_0x6642('0x13')]=null;this[_0x6642('0x14')]=null;this[_0x6642('0x15')]=null;this[_0x6642('0x16')]=![];this[_0x6642('0x17')]=null;this[_0x6642('0x18')]=null;this[_0x6642('0x19')]=[];this['transfercalleridnum']=undefined;this[_0x6642('0x1a')]=undefined;this[_0x6642('0x1b')]=0x0;}module[_0x6642('0x1c')]=Channel; \ No newline at end of file +var _0xb0d2=['transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','tag','monitor','monitorFilename','queue'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0xb0d2,0x1b4));var _0x2b0d=function(_0x22612c,_0x71ec5d){_0x22612c=_0x22612c-0x0;var _0x5c1d67=_0xb0d2[_0x22612c];return _0x5c1d67;};'use strict';function Channel(){this[_0x2b0d('0x0')]=null;this['channel']='';this[_0x2b0d('0x1')]='';this[_0x2b0d('0x2')]=0x0;this[_0x2b0d('0x3')]='';this['connectedlinenum']=undefined;this[_0x2b0d('0x4')]=undefined;this[_0x2b0d('0x5')]=0x0;this[_0x2b0d('0x6')]='';this[_0x2b0d('0x7')]=0x0;this[_0x2b0d('0x8')]=0x0;this['exten']=0x0;this[_0x2b0d('0x9')]=![];this[_0x2b0d('0xa')]=null;this[_0x2b0d('0xb')]=null;this[_0x2b0d('0xc')]=![];this[_0x2b0d('0xd')]=![];this[_0x2b0d('0xe')]='';this[_0x2b0d('0xf')]='';this[_0x2b0d('0x10')]=0x0;this[_0x2b0d('0x11')]=0x0;this[_0x2b0d('0x12')]=0x0;this['type']=null;this[_0x2b0d('0x13')]=null;this['disposition']=null;this[_0x2b0d('0x14')]=![];this[_0x2b0d('0x15')]=null;this[_0x2b0d('0x16')]=null;this['monitors']=[];this[_0x2b0d('0x17')]=undefined;this[_0x2b0d('0x18')]=undefined;this[_0x2b0d('0x19')]=0x0;}module[_0x2b0d('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 32913bb..5e493d8 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 _0xe8f7=['username','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x29e6de,_0x4b4df5){var _0x3cd844=function(_0x2bd136){while(--_0x2bd136){_0x29e6de['push'](_0x29e6de['shift']());}};_0x3cd844(++_0x4b4df5);}(_0xe8f7,0x137));var _0x7e8f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe8f7[_0x2641f9];return _0x585741;};'use strict';function DeskAccount(_0x277c33){this['id']=_0x277c33['id']||0x0;this['name']=_0x277c33[_0x7e8f('0x0')]||'';this[_0x7e8f('0x1')]=_0x277c33[_0x7e8f('0x1')]||'';this[_0x7e8f('0x2')]=_0x277c33[_0x7e8f('0x2')]||'';this[_0x7e8f('0x3')]=_0x277c33[_0x7e8f('0x3')]||'';this['password']=_0x277c33['password']||'';this[_0x7e8f('0x4')]=_0x277c33[_0x7e8f('0x4')]||'';this['consumerSecret']=_0x277c33[_0x7e8f('0x5')]||'';this[_0x7e8f('0x6')]=_0x277c33[_0x7e8f('0x6')]||'';this[_0x7e8f('0x7')]=_0x277c33[_0x7e8f('0x7')]||'';this[_0x7e8f('0x8')]=_0x277c33[_0x7e8f('0x8')]||'';this['serverUrl']=_0x277c33[_0x7e8f('0x9')]||'';this[_0x7e8f('0xa')]=_0x277c33['Configurations']||{};}module[_0x7e8f('0xb')]=DeskAccount; \ No newline at end of file +var _0x0207=['serverUrl','Configurations','name','username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0207,0x162));var _0x7020=function(_0x3d7734,_0x19179e){_0x3d7734=_0x3d7734-0x0;var _0x2a3275=_0x0207[_0x3d7734];return _0x2a3275;};'use strict';function DeskAccount(_0x289598){this['id']=_0x289598['id']||0x0;this[_0x7020('0x0')]=_0x289598['name']||'';this['username']=_0x289598[_0x7020('0x1')]||'';this[_0x7020('0x2')]=_0x289598[_0x7020('0x2')]||'';this[_0x7020('0x3')]=_0x289598[_0x7020('0x3')]||'';this[_0x7020('0x4')]=_0x289598[_0x7020('0x4')]||'';this['consumerKey']=_0x289598['consumerKey']||'';this[_0x7020('0x5')]=_0x289598[_0x7020('0x5')]||'';this[_0x7020('0x6')]=_0x289598[_0x7020('0x6')]||'';this[_0x7020('0x7')]=_0x289598[_0x7020('0x7')]||'';this[_0x7020('0x8')]=_0x289598['type']||'';this['serverUrl']=_0x289598[_0x7020('0x9')]||'';this[_0x7020('0xa')]=_0x289598[_0x7020('0xa')]||{};}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 2115d2f..023d274 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 _0x3840=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x3840,0x94));var _0x0384=function(_0x483df9,_0x2eafef){_0x483df9=_0x483df9-0x0;var _0x4d2796=_0x3840[_0x483df9];return _0x4d2796;};'use strict';function Dynamics365Account(_0x2380ac){this['id']=_0x2380ac['id']||0x0;this['name']=_0x2380ac[_0x0384('0x0')]||'';this[_0x0384('0x1')]=_0x2380ac[_0x0384('0x1')]||'';this['password']=_0x2380ac[_0x0384('0x2')]||'';this[_0x0384('0x3')]=_0x2380ac[_0x0384('0x3')]||'';this[_0x0384('0x4')]=_0x2380ac['tenantId']||'';this['clientId']=_0x2380ac[_0x0384('0x5')]||'';this[_0x0384('0x6')]=_0x2380ac[_0x0384('0x6')]||{};this[_0x0384('0x7')]=_0x2380ac['serverUrl']||'';this[_0x0384('0x8')]=_0x2380ac[_0x0384('0x8')]||{};}module[_0x0384('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x3255=['serverUrl','Configurations','exports','name','username','password','clientId','clientSecret'];(function(_0x4678d4,_0x37d95c){var _0x4bd739=function(_0xe77ce2){while(--_0xe77ce2){_0x4678d4['push'](_0x4678d4['shift']());}};_0x4bd739(++_0x37d95c);}(_0x3255,0x163));var _0x5325=function(_0x44f85e,_0x5ca584){_0x44f85e=_0x44f85e-0x0;var _0x19ab5a=_0x3255[_0x44f85e];return _0x19ab5a;};'use strict';function Dynamics365Account(_0x24c7fa){this['id']=_0x24c7fa['id']||0x0;this[_0x5325('0x0')]=_0x24c7fa['name']||'';this[_0x5325('0x1')]=_0x24c7fa[_0x5325('0x1')]||'';this[_0x5325('0x2')]=_0x24c7fa[_0x5325('0x2')]||'';this['remoteUri']=_0x24c7fa['remoteUri']||'';this['tenantId']=_0x24c7fa['tenantId']||'';this[_0x5325('0x3')]=_0x24c7fa[_0x5325('0x3')]||'';this[_0x5325('0x4')]=_0x24c7fa[_0x5325('0x4')]||{};this[_0x5325('0x5')]=_0x24c7fa[_0x5325('0x5')]||'';this[_0x5325('0x6')]=_0x24c7fa[_0x5325('0x6')]||{};}module[_0x5325('0x7')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 9c4fcc0..c34bc1f 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 _0x05f4=['modem','gateway','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x05f4,0x149));var _0x405f=function(_0x4185d6,_0x2a3eda){_0x4185d6=_0x4185d6-0x0;var _0x31b522=_0x05f4[_0x4185d6];return _0x31b522;};'use strict';function FaxAccount(_0x55a068){this['id']=_0x55a068['id']||0x0;this[_0x405f('0x0')]=_0x55a068[_0x405f('0x0')]||'';this[_0x405f('0x1')]=_0x55a068[_0x405f('0x1')];this[_0x405f('0x2')]=_0x55a068[_0x405f('0x2')];this[_0x405f('0x3')]=_0x55a068[_0x405f('0x3')];this[_0x405f('0x4')]=_0x55a068['localstationid'];this[_0x405f('0x5')]=_0x55a068['minrate']||0x960;this[_0x405f('0x6')]=_0x55a068[_0x405f('0x6')]||0x3840;this[_0x405f('0x7')]=_0x55a068[_0x405f('0x7')]||'v17,v27,v29';this[_0x405f('0x8')]=_0x55a068['gateway']||'no';this['faxdetect']=_0x55a068['faxdetect']||'no';this[_0x405f('0x9')]=_0x55a068[_0x405f('0x9')]||0x1388;this[_0x405f('0xa')]=_0x55a068['tech']||_0x405f('0xb');this[_0x405f('0xc')]=_0x55a068['Trunk']?_0x55a068[_0x405f('0xc')]:undefined;this[_0x405f('0xd')]=_0x55a068['ListId'];this['key']=_0x55a068[_0x405f('0xe')];}module[_0x405f('0xf')]=FaxAccount; \ No newline at end of file +var _0xa71f=['minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid'];(function(_0x526c9e,_0x5ac026){var _0x2dd763=function(_0x349f9b){while(--_0x349f9b){_0x526c9e['push'](_0x526c9e['shift']());}};_0x2dd763(++_0x5ac026);}(_0xa71f,0xab));var _0xfa71=function(_0x591428,_0x54bd5b){_0x591428=_0x591428-0x0;var _0x262188=_0xa71f[_0x591428];return _0x262188;};'use strict';function FaxAccount(_0x5b96a2){this['id']=_0x5b96a2['id']||0x0;this[_0xfa71('0x0')]=_0x5b96a2[_0xfa71('0x0')]||'';this[_0xfa71('0x1')]=_0x5b96a2[_0xfa71('0x1')];this[_0xfa71('0x2')]=_0x5b96a2[_0xfa71('0x2')];this[_0xfa71('0x3')]=_0x5b96a2[_0xfa71('0x3')];this[_0xfa71('0x4')]=_0x5b96a2[_0xfa71('0x4')];this['minrate']=_0x5b96a2[_0xfa71('0x5')]||0x960;this[_0xfa71('0x6')]=_0x5b96a2['maxrate']||0x3840;this[_0xfa71('0x7')]=_0x5b96a2[_0xfa71('0x7')]||_0xfa71('0x8');this[_0xfa71('0x9')]=_0x5b96a2[_0xfa71('0x9')]||'no';this[_0xfa71('0xa')]=_0x5b96a2[_0xfa71('0xa')]||'no';this[_0xfa71('0xb')]=_0x5b96a2[_0xfa71('0xb')]||0x1388;this['tech']=_0x5b96a2[_0xfa71('0xc')]||'SIP';this[_0xfa71('0xd')]=_0x5b96a2[_0xfa71('0xd')]?_0x5b96a2[_0xfa71('0xd')]:undefined;this[_0xfa71('0xe')]=_0x5b96a2['ListId'];this['key']=_0x5b96a2[_0xfa71('0xf')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index d9a9ac6..b5553a4 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 _0x84f6=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x54afe9,_0x281c8d){var _0x3afef4=function(_0x3c1930){while(--_0x3c1930){_0x54afe9['push'](_0x54afe9['shift']());}};_0x3afef4(++_0x281c8d);}(_0x84f6,0x67));var _0x684f=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x84f6[_0x14a862];return _0x245eb5;};'use strict';function FreshdeskAccount(_0x18b3f6){this['id']=_0x18b3f6['id']||0x0;this[_0x684f('0x0')]=_0x18b3f6['name']||'';this[_0x684f('0x1')]=_0x18b3f6['username']||'';this['apiKey']=_0x18b3f6[_0x684f('0x2')]||'';this[_0x684f('0x3')]=_0x18b3f6[_0x684f('0x3')]||'';this['serverUrl']=_0x18b3f6[_0x684f('0x4')]||'';this[_0x684f('0x5')]=_0x18b3f6[_0x684f('0x5')]||{};}module[_0x684f('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xa581=['remoteUri','serverUrl','Configurations','name','username'];(function(_0x13b442,_0x448c33){var _0x49d09c=function(_0x477277){while(--_0x477277){_0x13b442['push'](_0x13b442['shift']());}};_0x49d09c(++_0x448c33);}(_0xa581,0x125));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';function FreshdeskAccount(_0x1978e4){this['id']=_0x1978e4['id']||0x0;this[_0x1a58('0x0')]=_0x1978e4[_0x1a58('0x0')]||'';this[_0x1a58('0x1')]=_0x1978e4[_0x1a58('0x1')]||'';this['apiKey']=_0x1978e4['token']||'';this[_0x1a58('0x2')]=_0x1978e4[_0x1a58('0x2')]||'';this[_0x1a58('0x3')]=_0x1978e4[_0x1a58('0x3')]||'';this[_0x1a58('0x4')]=_0x1978e4['Configurations']||{};}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 83398ba..cde3dc6 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 _0xfc22=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x27ba79,_0x466682){var _0x22837c=function(_0x4f9d36){while(--_0x4f9d36){_0x27ba79['push'](_0x27ba79['shift']());}};_0x22837c(++_0x466682);}(_0xfc22,0xd7));var _0x2fc2=function(_0x3b724b,_0xed6fb6){_0x3b724b=_0x3b724b-0x0;var _0x4aefa5=_0xfc22[_0x3b724b];return _0x4aefa5;};'use strict';function FreshsalesAccount(_0x4e1012){this['id']=_0x4e1012['id']||0x0;this[_0x2fc2('0x0')]=_0x4e1012[_0x2fc2('0x0')]||'';this[_0x2fc2('0x1')]=_0x4e1012[_0x2fc2('0x1')]||'';this[_0x2fc2('0x2')]=_0x4e1012[_0x2fc2('0x3')]||'';this[_0x2fc2('0x4')]=_0x4e1012['remoteUri']||'';this[_0x2fc2('0x5')]=_0x4e1012[_0x2fc2('0x5')]||'';this[_0x2fc2('0x6')]=_0x4e1012[_0x2fc2('0x6')]||{};}module[_0x2fc2('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x7e27=['exports','name','username','token','remoteUri','serverUrl'];(function(_0x23bad2,_0x2223a1){var _0x4f23fe=function(_0x2ae68b){while(--_0x2ae68b){_0x23bad2['push'](_0x23bad2['shift']());}};_0x4f23fe(++_0x2223a1);}(_0x7e27,0x1f3));var _0x77e2=function(_0x1d3ae2,_0x2d29b0){_0x1d3ae2=_0x1d3ae2-0x0;var _0xddfee5=_0x7e27[_0x1d3ae2];return _0xddfee5;};'use strict';function FreshsalesAccount(_0x1a7f8b){this['id']=_0x1a7f8b['id']||0x0;this['name']=_0x1a7f8b[_0x77e2('0x0')]||'';this[_0x77e2('0x1')]=_0x1a7f8b[_0x77e2('0x1')]||'';this['apiKey']=_0x1a7f8b[_0x77e2('0x2')]||'';this[_0x77e2('0x3')]=_0x1a7f8b[_0x77e2('0x3')]||'';this[_0x77e2('0x4')]=_0x1a7f8b[_0x77e2('0x4')]||'';this['Configurations']=_0x1a7f8b['Configurations']||{};}module[_0x77e2('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 28f7dd5..17b47db 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 _0xef1e=['queuecallerabandon','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','context','exten','priority','holdtime','lastAssignedTo','mohtime','variables','exports','type','inbound','calleridname','queuecallerleaveAt','position','count'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xef1e,0x10b));var _0xeef1=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xef1e[_0x17d9e3];return _0x14192d;};'use strict';function QueueReport(){this[_0xeef1('0x0')]=_0xeef1('0x1');this['uniqueid']='';this['calleridnum']='';this[_0xeef1('0x2')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0xeef1('0x3')]=null;this[_0xeef1('0x4')]=0x1;this[_0xeef1('0x5')]=0x1;this[_0xeef1('0x6')]=![];this['queuecallerabandonAt']=null;this[_0xeef1('0x7')]=![];this['queuecallercompleteAt']=null;this[_0xeef1('0x8')]=![];this[_0xeef1('0x9')]=null;this[_0xeef1('0xa')]=0x1;this['channel']='';this[_0xeef1('0xb')]='';this[_0xeef1('0xc')]='';this['accountcode']='';this[_0xeef1('0xd')]='';this[_0xeef1('0xe')]='';this[_0xeef1('0xf')]='';this[_0xeef1('0x10')]=0x0;this['assigned']=![];this[_0xeef1('0x11')]='';this[_0xeef1('0x12')]=0x0;this[_0xeef1('0x13')]={};}module[_0xeef1('0x14')]=QueueReport; \ No newline at end of file +var _0x79ca=['priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','accountcode','context','exten'];(function(_0x31f32b,_0x57e2ca){var _0x5d2a64=function(_0x53d3f3){while(--_0x53d3f3){_0x31f32b['push'](_0x31f32b['shift']());}};_0x5d2a64(++_0x57e2ca);}(_0x79ca,0x1c1));var _0xa79c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x79ca[_0x321bb2];return _0x9c12ed;};'use strict';function QueueReport(){this[_0xa79c('0x0')]='inbound';this[_0xa79c('0x1')]='';this[_0xa79c('0x2')]='';this[_0xa79c('0x3')]='';this[_0xa79c('0x4')]='';this[_0xa79c('0x5')]=null;this[_0xa79c('0x6')]=null;this[_0xa79c('0x7')]=0x1;this[_0xa79c('0x8')]=0x1;this[_0xa79c('0x9')]=![];this[_0xa79c('0xa')]=null;this[_0xa79c('0xb')]=![];this['queuecallercompleteAt']=null;this[_0xa79c('0xc')]=![];this[_0xa79c('0xd')]=null;this[_0xa79c('0xe')]=0x1;this[_0xa79c('0xf')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0xa79c('0x10')]='';this[_0xa79c('0x11')]='';this[_0xa79c('0x12')]='';this[_0xa79c('0x13')]='';this[_0xa79c('0x14')]=0x0;this[_0xa79c('0x15')]=![];this[_0xa79c('0x16')]='';this[_0xa79c('0x17')]=0x0;this[_0xa79c('0x18')]={};}module[_0xa79c('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 f456a14..3943b7f 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 _0x71c2=['username','remoteUri','password','clientId','clientSecret','securityToken','serverUrl','Configurations','exports'];(function(_0x45cb89,_0x99520e){var _0x5948c1=function(_0x4c81c3){while(--_0x4c81c3){_0x45cb89['push'](_0x45cb89['shift']());}};_0x5948c1(++_0x99520e);}(_0x71c2,0x132));var _0x271c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x71c2[_0x3dd15e];return _0x231fd0;};'use strict';function SalesforceAccount(_0x4ead2f){this['id']=_0x4ead2f['id']||0x0;this['name']=_0x4ead2f['name']||'';this['username']=_0x4ead2f[_0x271c('0x0')]||'';this[_0x271c('0x1')]=_0x4ead2f[_0x271c('0x1')]||'';this[_0x271c('0x2')]=_0x4ead2f[_0x271c('0x2')]||'';this[_0x271c('0x3')]=_0x4ead2f[_0x271c('0x3')]||'';this[_0x271c('0x4')]=_0x4ead2f[_0x271c('0x4')]||'';this['securityToken']=_0x4ead2f[_0x271c('0x5')]||'';this['type']=_0x4ead2f['type']||'integrationTab';this[_0x271c('0x6')]=_0x4ead2f[_0x271c('0x6')]||'';this['Configurations']=_0x4ead2f[_0x271c('0x7')]||{};}module[_0x271c('0x8')]=SalesforceAccount; \ No newline at end of file +var _0x3ba4=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password'];(function(_0x5a9c4c,_0x5c476a){var _0x282d5f=function(_0x2a3662){while(--_0x2a3662){_0x5a9c4c['push'](_0x5a9c4c['shift']());}};_0x282d5f(++_0x5c476a);}(_0x3ba4,0xc2));var _0x43ba=function(_0x313fa2,_0xbf4d43){_0x313fa2=_0x313fa2-0x0;var _0x590d9c=_0x3ba4[_0x313fa2];return _0x590d9c;};'use strict';function SalesforceAccount(_0x241d43){this['id']=_0x241d43['id']||0x0;this['name']=_0x241d43[_0x43ba('0x0')]||'';this[_0x43ba('0x1')]=_0x241d43[_0x43ba('0x1')]||'';this[_0x43ba('0x2')]=_0x241d43['remoteUri']||'';this[_0x43ba('0x3')]=_0x241d43[_0x43ba('0x3')]||'';this[_0x43ba('0x4')]=_0x241d43[_0x43ba('0x4')]||'';this[_0x43ba('0x5')]=_0x241d43[_0x43ba('0x5')]||'';this[_0x43ba('0x6')]=_0x241d43[_0x43ba('0x6')]||'';this[_0x43ba('0x7')]=_0x241d43['type']||_0x43ba('0x8');this['serverUrl']=_0x241d43[_0x43ba('0x9')]||'';this[_0x43ba('0xa')]=_0x241d43[_0x43ba('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 6d75456..67dc732 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 _0xd0b2=['Configurations','exports','name','username','password','remoteUri'];(function(_0x58212d,_0x59edaf){var _0x24277d=function(_0x52e5b3){while(--_0x52e5b3){_0x58212d['push'](_0x58212d['shift']());}};_0x24277d(++_0x59edaf);}(_0xd0b2,0x74));var _0x2d0b=function(_0x4adec4,_0x31740d){_0x4adec4=_0x4adec4-0x0;var _0x338cc5=_0xd0b2[_0x4adec4];return _0x338cc5;};'use strict';function ServicenowAccount(_0x5f1ef9){this['id']=_0x5f1ef9['id']||0x0;this['name']=_0x5f1ef9[_0x2d0b('0x0')]||'';this[_0x2d0b('0x1')]=_0x5f1ef9['username']||'';this[_0x2d0b('0x2')]=_0x5f1ef9['password']||'';this[_0x2d0b('0x3')]=_0x5f1ef9['remoteUri']||'';this['serverUrl']=_0x5f1ef9['serverUrl']||'';this['Configurations']=_0x5f1ef9[_0x2d0b('0x4')]||{};}module[_0x2d0b('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xb5c2=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0xb5c2,0x75));var _0x2b5c=function(_0x3f6d66,_0x13f5c3){_0x3f6d66=_0x3f6d66-0x0;var _0x1a723c=_0xb5c2[_0x3f6d66];return _0x1a723c;};'use strict';function ServicenowAccount(_0x15af06){this['id']=_0x15af06['id']||0x0;this[_0x2b5c('0x0')]=_0x15af06[_0x2b5c('0x0')]||'';this[_0x2b5c('0x1')]=_0x15af06['username']||'';this[_0x2b5c('0x2')]=_0x15af06[_0x2b5c('0x2')]||'';this[_0x2b5c('0x3')]=_0x15af06[_0x2b5c('0x3')]||'';this[_0x2b5c('0x4')]=_0x15af06[_0x2b5c('0x4')]||'';this[_0x2b5c('0x5')]=_0x15af06[_0x2b5c('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 395f0a5..aad46b4 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 _0xe244=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x528056,_0x3522a0){var _0x57cb6a=function(_0x4929d4){while(--_0x4929d4){_0x528056['push'](_0x528056['shift']());}};_0x57cb6a(++_0x3522a0);}(_0xe244,0x1e1));var _0x4e24=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xe244[_0x160c73];return _0xd9302;};'use strict';function SugarcrmAccount(_0x427569){this['id']=_0x427569['id']||0x0;this[_0x4e24('0x0')]=_0x427569[_0x4e24('0x0')]||'';this[_0x4e24('0x1')]=_0x427569[_0x4e24('0x1')]||'';this['password']=_0x427569[_0x4e24('0x2')]||'';this[_0x4e24('0x3')]=_0x427569['remoteUri']||'';this[_0x4e24('0x4')]=_0x427569[_0x4e24('0x4')]||'';this[_0x4e24('0x5')]=_0x427569['Configurations']||{};}module[_0x4e24('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x1967=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x596c8f,_0x21ce52){var _0x1c9ef4=function(_0x11c6e8){while(--_0x11c6e8){_0x596c8f['push'](_0x596c8f['shift']());}};_0x1c9ef4(++_0x21ce52);}(_0x1967,0x163));var _0x7196=function(_0x2797ba,_0x2b926a){_0x2797ba=_0x2797ba-0x0;var _0x18977=_0x1967[_0x2797ba];return _0x18977;};'use strict';function SugarcrmAccount(_0xa2a2d6){this['id']=_0xa2a2d6['id']||0x0;this[_0x7196('0x0')]=_0xa2a2d6[_0x7196('0x0')]||'';this[_0x7196('0x1')]=_0xa2a2d6[_0x7196('0x1')]||'';this[_0x7196('0x2')]=_0xa2a2d6[_0x7196('0x2')]||'';this[_0x7196('0x3')]=_0xa2a2d6[_0x7196('0x3')]||'';this[_0x7196('0x4')]=_0xa2a2d6[_0x7196('0x4')]||'';this[_0x7196('0x5')]=_0xa2a2d6[_0x7196('0x5')]||{};}module[_0x7196('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 4024f61..d7ee991 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 _0xee0b=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x324adb,_0x3106d3){var _0x45f1ac=function(_0x26f651){while(--_0x26f651){_0x324adb['push'](_0x324adb['shift']());}};_0x45f1ac(++_0x3106d3);}(_0xee0b,0x138));var _0xbee0=function(_0x2485d8,_0xb06cc3){_0x2485d8=_0x2485d8-0x0;var _0xd3fefb=_0xee0b[_0x2485d8];return _0xd3fefb;};'use strict';function Telephone(_0x2a79d9){this['id']=_0x2a79d9['id']||0x0;this[_0xbee0('0x0')]=_0x2a79d9[_0xbee0('0x0')]||'';this[_0xbee0('0x1')]=_0x2a79d9[_0xbee0('0x1')]||'';this[_0xbee0('0x2')]=_0xbee0('0x3');this[_0xbee0('0x4')]=0x0;this[_0xbee0('0x5')]=_0xbee0('0x3');this[_0xbee0('0x6')]='';}module[_0xbee0('0x7')]=Telephone; \ No newline at end of file +var _0x2f9a=['unknown','address','exports','name'];(function(_0x526d85,_0x512156){var _0x59fbe1=function(_0x591cc2){while(--_0x591cc2){_0x526d85['push'](_0x526d85['shift']());}};_0x59fbe1(++_0x512156);}(_0x2f9a,0x14f));var _0xa2f9=function(_0x479f6f,_0x1c26c4){_0x479f6f=_0x479f6f-0x0;var _0x24e701=_0x2f9a[_0x479f6f];return _0x24e701;};'use strict';function Telephone(_0x2b5088){this['id']=_0x2b5088['id']||0x0;this[_0xa2f9('0x0')]=_0x2b5088[_0xa2f9('0x0')]||'';this['accountcode']=_0x2b5088['accountcode']||'';this['state']=_0xa2f9('0x1');this['stateTime']=0x0;this['status']='unknown';this[_0xa2f9('0x2')]='';}module[_0xa2f9('0x3')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 7753bfe..e6ab97f 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 _0x7fc4=['exports','name','html'];(function(_0x58712a,_0x1d88a9){var _0x342032=function(_0x5365f0){while(--_0x5365f0){_0x58712a['push'](_0x58712a['shift']());}};_0x342032(++_0x1d88a9);}(_0x7fc4,0x1cf));var _0x47fc=function(_0x5efc1a,_0x3c3aa7){_0x5efc1a=_0x5efc1a-0x0;var _0x4184a2=_0x7fc4[_0x5efc1a];return _0x4184a2;};'use strict';function template(_0x4fc577){this['id']=_0x4fc577['id']||0x0;this[_0x47fc('0x0')]=_0x4fc577['name']||'';this[_0x47fc('0x1')]=_0x4fc577['html']||'';}module[_0x47fc('0x2')]=template; \ No newline at end of file +var _0x5b5a=['name','html','exports'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x554b96,_0xa7f28){_0x554b96=_0x554b96-0x0;var _0xe445a8=_0x5b5a[_0x554b96];return _0xe445a8;};'use strict';function template(_0x3fdff1){this['id']=_0x3fdff1['id']||0x0;this[_0xa5b5('0x0')]=_0x3fdff1[_0xa5b5('0x0')]||'';this['html']=_0x3fdff1[_0xa5b5('0x1')]||'';}module[_0xa5b5('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 9b13a11..4a6dbdc 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 _0xa41a=['AnyConditions','Actions','name','channel','voice','status','AllConditions'];(function(_0x21c64a,_0x3f4839){var _0x2e038d=function(_0x5a8ae4){while(--_0x5a8ae4){_0x21c64a['push'](_0x21c64a['shift']());}};_0x2e038d(++_0x3f4839);}(_0xa41a,0x6b));var _0xaa41=function(_0x1e7518,_0x2f66b5){_0x1e7518=_0x1e7518-0x0;var _0x377f20=_0xa41a[_0x1e7518];return _0x377f20;};'use strict';function Trigger(_0x33e667){this['id']=_0x33e667['id']||0x0;this[_0xaa41('0x0')]=_0x33e667['name']||'';this[_0xaa41('0x1')]=_0x33e667[_0xaa41('0x1')]||_0xaa41('0x2');this[_0xaa41('0x3')]=_0x33e667[_0xaa41('0x3')]||![];this[_0xaa41('0x4')]=_0x33e667[_0xaa41('0x4')]||[];this[_0xaa41('0x5')]=_0x33e667['AnyConditions']||[];this[_0xaa41('0x6')]=_0x33e667[_0xaa41('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xa41a=['AnyConditions','Actions','name','channel','voice','status','AllConditions'];(function(_0xef232f,_0x2a2c3d){var _0x18e363=function(_0x5feda7){while(--_0x5feda7){_0xef232f['push'](_0xef232f['shift']());}};_0x18e363(++_0x2a2c3d);}(_0xa41a,0x6b));var _0xaa41=function(_0x16d29c,_0x32abdb){_0x16d29c=_0x16d29c-0x0;var _0xdbd299=_0xa41a[_0x16d29c];return _0xdbd299;};'use strict';function Trigger(_0x33e667){this['id']=_0x33e667['id']||0x0;this[_0xaa41('0x0')]=_0x33e667['name']||'';this[_0xaa41('0x1')]=_0x33e667[_0xaa41('0x1')]||_0xaa41('0x2');this[_0xaa41('0x3')]=_0x33e667[_0xaa41('0x3')]||![];this[_0xaa41('0x4')]=_0x33e667[_0xaa41('0x4')]||[];this[_0xaa41('0x5')]=_0x33e667['AnyConditions']||[];this[_0xaa41('0x6')]=_0x33e667[_0xaa41('0x6')]||[];}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 0267180..9327716 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 _0x553f=['stateRegistry','unknown','registrationtime','address','exports','active','name','stateTime','registry','host','port','domainport'];(function(_0x2c6294,_0x5c270c){var _0x14199e=function(_0xb38fe1){while(--_0xb38fe1){_0x2c6294['push'](_0x2c6294['shift']());}};_0x14199e(++_0x5c270c);}(_0x553f,0xc5));var _0xf553=function(_0x4e0fe8,_0x276220){_0x4e0fe8=_0x4e0fe8-0x0;var _0x1ee15b=_0x553f[_0x4e0fe8];return _0x1ee15b;};'use strict';function Trunk(_0x1d5097){this['id']=_0x1d5097['id']||0x0;this[_0xf553('0x0')]=_0x1d5097[_0xf553('0x0')]||![];this[_0xf553('0x1')]=_0x1d5097[_0xf553('0x1')]||'';this['state']='unknown';this[_0xf553('0x2')]=0x0;this['status']='unknown';this['registry']=_0x1d5097[_0xf553('0x3')]&&_0x1d5097[_0xf553('0x3')]['indexOf'](':')?_0x1d5097[_0xf553('0x3')]['split'](':')[0x0]:'';this[_0xf553('0x4')]='';this[_0xf553('0x5')]='';this['domain']='';this[_0xf553('0x6')]='';this['refresh']='';this[_0xf553('0x7')]=_0xf553('0x8');this[_0xf553('0x9')]='';this[_0xf553('0xa')]='';}module[_0xf553('0xb')]=Trunk; \ No newline at end of file +var _0x4443=['split','port','domain','domainport','stateRegistry','registrationtime','address','exports','active','name','state','unknown','status','registry','indexOf'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x4443,0x71));var _0x3444=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x4443[_0x199572];return _0x13cfa3;};'use strict';function Trunk(_0x170ea4){this['id']=_0x170ea4['id']||0x0;this['active']=_0x170ea4[_0x3444('0x0')]||![];this[_0x3444('0x1')]=_0x170ea4[_0x3444('0x1')]||'';this[_0x3444('0x2')]=_0x3444('0x3');this['stateTime']=0x0;this[_0x3444('0x4')]=_0x3444('0x3');this[_0x3444('0x5')]=_0x170ea4[_0x3444('0x5')]&&_0x170ea4[_0x3444('0x5')][_0x3444('0x6')](':')?_0x170ea4[_0x3444('0x5')][_0x3444('0x7')](':')[0x0]:'';this['host']='';this[_0x3444('0x8')]='';this[_0x3444('0x9')]='';this[_0x3444('0xa')]='';this['refresh']='';this[_0x3444('0xb')]=_0x3444('0x3');this[_0x3444('0xc')]='';this[_0x3444('0xd')]='';}module[_0x3444('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 8f44245..7614d6a 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 _0xb017=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x2f8be8,_0x46cff7){var _0x58b0d7=function(_0x3fc1a8){while(--_0x3fc1a8){_0x2f8be8['push'](_0x2f8be8['shift']());}};_0x58b0d7(++_0x46cff7);}(_0xb017,0x76));var _0x7b01=function(_0x13bbaf,_0x3004d3){_0x13bbaf=_0x13bbaf-0x0;var _0xb5ee38=_0xb017[_0x13bbaf];return _0xb5ee38;};'use strict';function voiceExtension(_0x50e266){this['id']=_0x50e266['id']||0x0;this[_0x7b01('0x0')]=_0x50e266[_0x7b01('0x0')]||'';this[_0x7b01('0x1')]=_0x50e266[_0x7b01('0x1')]||_0x7b01('0x2');this[_0x7b01('0x3')]=_0x50e266[_0x7b01('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xed32=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x5b6ec3,_0x3ea193){var _0x220e28=function(_0x16049b){while(--_0x16049b){_0x5b6ec3['push'](_0x5b6ec3['shift']());}};_0x220e28(++_0x3ea193);}(_0xed32,0x7f));var _0x2ed3=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xed32[_0x3511d3];return _0x5d6321;};'use strict';function voiceExtension(_0x3b3914){this['id']=_0x3b3914['id']||0x0;this[_0x2ed3('0x0')]=_0x3b3914[_0x2ed3('0x0')]||'';this[_0x2ed3('0x1')]=_0x3b3914[_0x2ed3('0x1')]||_0x2ed3('0x2');this['mandatoryDisposition']=_0x3b3914[_0x2ed3('0x3')]||![];}module[_0x2ed3('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index bd862b4..2b9f03c 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 _0xb7be=['name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','ringing','ringinuse','onhold','wav','wav49','gsm'];(function(_0x2607ab,_0x10cd53){var _0x24a92b=function(_0x51f282){while(--_0x51f282){_0x2607ab['push'](_0x2607ab['shift']());}};_0x24a92b(++_0x10cd53);}(_0xb7be,0x6a));var _0xeb7b=function(_0xe1f858,_0xb86c44){_0xe1f858=_0xe1f858-0x0;var _0x367af6=_0xb7be[_0xe1f858];return _0x367af6;};'use strict';var statusDesc=[_0xeb7b('0x0'),_0xeb7b('0x1'),_0xeb7b('0x2'),_0xeb7b('0x3'),'invalid','unavailable',_0xeb7b('0x4'),_0xeb7b('0x5'),_0xeb7b('0x6')];var monitorFormat={'wav':_0xeb7b('0x7'),'wav49':_0xeb7b('0x8'),'gsm':_0xeb7b('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x5d52a2){this['id']=_0x5d52a2['id']||0x0;this[_0xeb7b('0xa')]=_0x5d52a2[_0xeb7b('0xa')]||'';this['monitor_format']=_0x5d52a2[_0xeb7b('0xb')]||'';this[_0xeb7b('0xc')]=_0x5d52a2['type']||_0xeb7b('0xd');this[_0xeb7b('0xe')]=0x0;this[_0xeb7b('0xf')]=0x0;this[_0xeb7b('0x10')]=0x0;this[_0xeb7b('0x11')]=0x0;this[_0xeb7b('0x12')]=0x0;this[_0xeb7b('0x13')]=0x0;this[_0xeb7b('0x14')]=0x0;this[_0xeb7b('0x15')]=0x0;this[_0xeb7b('0x16')]=0x0;this['loggedIn']=0x0;this['available']=0x0;this['acw']=_0x5d52a2[_0xeb7b('0x17')]||![];this['acwTimeout']=_0x5d52a2[_0xeb7b('0x18')]||0xa;this[_0xeb7b('0x19')]=_0x5d52a2[_0xeb7b('0x19')]||'no';this[_0xeb7b('0x1a')]=!![];this[_0xeb7b('0x1b')]='';this['originated']=0x0;this['temp']=0x0;this['dialTimezone']=_0x5d52a2[_0xeb7b('0x1c')]||null;this[_0xeb7b('0x1d')]=_0x5d52a2[_0xeb7b('0x1d')]?_0x5d52a2[_0xeb7b('0x1d')]:null;this[_0xeb7b('0x1e')]=_0x5d52a2[_0xeb7b('0x1e')];this[_0xeb7b('0x1f')]=_0x5d52a2[_0xeb7b('0x1f')]||_0xeb7b('0x20');this['dialLimitChannel']=_0x5d52a2[_0xeb7b('0x21')]||0x0;this[_0xeb7b('0x22')]=_0x5d52a2[_0xeb7b('0x22')]||0x0;this[_0xeb7b('0x23')]=_0x5d52a2[_0xeb7b('0x23')]||0x1;this['dialPredictiveOptimization']=_0x5d52a2[_0xeb7b('0x24')]||'dropRate';this[_0xeb7b('0x25')]=_0x5d52a2[_0xeb7b('0x25')]||0.03;this['dialPredictiveInterval']=_0x5d52a2[_0xeb7b('0x26')]||0x258;this[_0xeb7b('0x27')]=_0x5d52a2[_0xeb7b('0x27')]||'anonymous';this[_0xeb7b('0x28')]=_0x5d52a2['dialOriginateCallerIdNumber']||_0xeb7b('0x29');this[_0xeb7b('0x2a')]=_0x5d52a2['dialOriginateTimeout']||0x1e;this[_0xeb7b('0x2b')]=_0x5d52a2['dialQueueOptions']||_0xeb7b('0x2c');this[_0xeb7b('0x2d')]=_0x5d52a2[_0xeb7b('0x2d')]||0x3;this[_0xeb7b('0x2e')]=_0x5d52a2['dialQueueProject']||undefined;this[_0xeb7b('0x2f')]=_0x5d52a2[_0xeb7b('0x2f')]||0x3;this[_0xeb7b('0x30')]=_0x5d52a2[_0xeb7b('0x30')]||0x96;this[_0xeb7b('0x31')]=_0x5d52a2['dialBusyMaxRetry']||0x3;this[_0xeb7b('0x32')]=_0x5d52a2[_0xeb7b('0x32')]||0x96;this[_0xeb7b('0x33')]=_0x5d52a2[_0xeb7b('0x33')]||0x3;this[_0xeb7b('0x34')]=_0x5d52a2['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x5d52a2[_0xeb7b('0x35')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5d52a2[_0xeb7b('0x36')]||0x96;this[_0xeb7b('0x37')]=_0x5d52a2[_0xeb7b('0x37')]||0x3;this['dialDropRetryFrequency']=_0x5d52a2['dialDropRetryFrequency']||0x96;this[_0xeb7b('0x38')]=_0x5d52a2[_0xeb7b('0x38')]||0x3;this[_0xeb7b('0x39')]=_0x5d52a2[_0xeb7b('0x39')]||0x96;this[_0xeb7b('0x3a')]=_0x5d52a2[_0xeb7b('0x3a')]||0x3;this[_0xeb7b('0x3b')]=_0x5d52a2[_0xeb7b('0x3b')]||0x96;this[_0xeb7b('0x3c')]=_0x5d52a2[_0xeb7b('0x3c')]||0x3;this[_0xeb7b('0x3d')]=_0x5d52a2[_0xeb7b('0x3d')]||0x96;this['dialGlobalMaxRetry']=_0x5d52a2[_0xeb7b('0x3e')]||0x4;this['Trunk']=_0x5d52a2[_0xeb7b('0x3f')]?_0x5d52a2['Trunk']:undefined;this[_0xeb7b('0x40')]=_0x5d52a2[_0xeb7b('0x40')]?_0x5d52a2[_0xeb7b('0x40')]:undefined;this[_0xeb7b('0x41')]=_0x5d52a2[_0xeb7b('0x41')]||undefined;this['Interval']=_0x5d52a2[_0xeb7b('0x42')]?_0x5d52a2[_0xeb7b('0x42')]:undefined;this[_0xeb7b('0x43')]=_0x5d52a2[_0xeb7b('0x43')]||_0xeb7b('0x44');this[_0xeb7b('0x45')]=_0x5d52a2[_0xeb7b('0x45')]||undefined;this[_0xeb7b('0x46')]=_0x5d52a2[_0xeb7b('0x46')]||undefined;this[_0xeb7b('0x47')]=strategy[_0x5d52a2[_0xeb7b('0x47')]]||_0xeb7b('0x48');this['queueStatusComplete']=!![];this[_0xeb7b('0x49')]=_0x5d52a2[_0xeb7b('0x49')]||![];this[_0xeb7b('0x4a')]=_0x5d52a2[_0xeb7b('0x4a')];this[_0xeb7b('0x4b')]=_0x5d52a2[_0xeb7b('0x4b')];this[_0xeb7b('0x4c')]=_0x5d52a2[_0xeb7b('0x4c')];this[_0xeb7b('0x4d')]=_0x5d52a2[_0xeb7b('0x4d')];this['dialAMDMinWordLength']=_0x5d52a2[_0xeb7b('0x4e')];this[_0xeb7b('0x4f')]=_0x5d52a2[_0xeb7b('0x4f')];this[_0xeb7b('0x50')]=_0x5d52a2[_0xeb7b('0x50')];this[_0xeb7b('0x51')]=_0x5d52a2[_0xeb7b('0x51')];this[_0xeb7b('0x52')]=_0x5d52a2[_0xeb7b('0x52')];this['outboundRejectCallsDay']=0x0;this[_0xeb7b('0x53')]=0x0;this[_0xeb7b('0x54')]=_0x5d52a2[_0xeb7b('0x54')];this[_0xeb7b('0x55')]=0x0;this[_0xeb7b('0x56')]=0x0;this[_0xeb7b('0x57')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xeb7b('0x58')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xeb7b('0x59')]=0x0;this[_0xeb7b('0x5a')]=0x0;this[_0xeb7b('0x5b')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xeb7b('0x5c')]=0x0;this[_0xeb7b('0x5d')]=0x0;this['startProgressive']=undefined;this[_0xeb7b('0x5e')]=undefined;this['handlePredictive']=undefined;this[_0xeb7b('0x5f')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xeb7b('0x60')]=0x0;this[_0xeb7b('0x61')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xeb7b('0x62')]=0x0;this[_0xeb7b('0x63')]=0x0;this[_0xeb7b('0x64')]=_0x5d52a2[_0xeb7b('0x65')]||0x14;this[_0xeb7b('0x66')]=_0x5d52a2['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xeb7b('0x67')]=0x0;this[_0xeb7b('0x68')]=0x0;this[_0xeb7b('0x69')]=0x1;this[_0xeb7b('0x6a')]=0x0;this[_0xeb7b('0x6b')]=0x0;this[_0xeb7b('0x6c')]=0x0;this['erlangBusyFactor']=0x0;this[_0xeb7b('0x6d')]=_0x5d52a2[_0xeb7b('0x6d')]||0x1e;this['dialRecallInQueue']=_0x5d52a2[_0xeb7b('0x6e')]||![];this[_0xeb7b('0x6f')]=_0x5d52a2[_0xeb7b('0x6f')]||undefined;this[_0xeb7b('0x70')]=_0x5d52a2[_0xeb7b('0x70')]||![];this['dialAgiAfterHangupAgent']=_0x5d52a2['dialAgiAfterHangupAgent']||![];this[_0xeb7b('0xb')]=monitorFormat[_0x5d52a2['monitor_format']]?monitorFormat[_0x5d52a2[_0xeb7b('0xb')]]:undefined;this[_0xeb7b('0x71')]=_0x5d52a2[_0xeb7b('0x71')]||![];this[_0xeb7b('0x72')]=_0x5d52a2['mandatoryDispositionPause']?_0x5d52a2[_0xeb7b('0x72')]:undefined;}module[_0xeb7b('0x73')]=VoiceQueue; \ No newline at end of file +var _0xb002=['Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','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','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix'];(function(_0x541e5a,_0x3803c9){var _0x4d7f75=function(_0x90924b){while(--_0x90924b){_0x541e5a['push'](_0x541e5a['shift']());}};_0x4d7f75(++_0x3803c9);}(_0xb002,0xa7));var _0x2b00=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb002[_0xfae23b];return _0x200640;};'use strict';var statusDesc=[_0x2b00('0x0'),_0x2b00('0x1'),_0x2b00('0x2'),_0x2b00('0x3'),_0x2b00('0x4'),_0x2b00('0x5'),_0x2b00('0x6'),_0x2b00('0x7'),_0x2b00('0x8')];var monitorFormat={'wav':_0x2b00('0x9'),'wav49':_0x2b00('0xa'),'gsm':'gsm'};var strategy={'rrmemory':_0x2b00('0xb'),'roundrobin':_0x2b00('0xc')};function VoiceQueue(_0x5c0622){this['id']=_0x5c0622['id']||0x0;this[_0x2b00('0xd')]=_0x5c0622['name']||'';this[_0x2b00('0xe')]=_0x5c0622[_0x2b00('0xe')]||'';this[_0x2b00('0xf')]=_0x5c0622[_0x2b00('0xf')]||_0x2b00('0x10');this[_0x2b00('0x11')]=0x0;this[_0x2b00('0x12')]=0x0;this[_0x2b00('0x13')]=0x0;this[_0x2b00('0x14')]=0x0;this[_0x2b00('0x15')]=0x0;this[_0x2b00('0x16')]=0x0;this[_0x2b00('0x17')]=0x0;this[_0x2b00('0x18')]=0x0;this['abandoned']=0x0;this[_0x2b00('0x19')]=0x0;this[_0x2b00('0x1a')]=0x0;this[_0x2b00('0x1b')]=_0x5c0622[_0x2b00('0x1b')]||![];this['acwTimeout']=_0x5c0622[_0x2b00('0x1c')]||0xa;this['autopause']=_0x5c0622[_0x2b00('0x1d')]||'no';this[_0x2b00('0x1e')]=!![];this[_0x2b00('0x1f')]='';this[_0x2b00('0x20')]=0x0;this[_0x2b00('0x21')]=0x0;this[_0x2b00('0x22')]=_0x5c0622['dialTimezone']||null;this[_0x2b00('0x23')]=_0x5c0622[_0x2b00('0x23')]?_0x5c0622[_0x2b00('0x23')]:null;this[_0x2b00('0x24')]=_0x5c0622[_0x2b00('0x24')];this[_0x2b00('0x25')]=_0x5c0622[_0x2b00('0x25')]||_0x2b00('0x26');this[_0x2b00('0x27')]=_0x5c0622['dialLimitChannel']||0x0;this[_0x2b00('0x28')]=_0x5c0622['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x5c0622[_0x2b00('0x29')]||0x1;this[_0x2b00('0x2a')]=_0x5c0622[_0x2b00('0x2a')]||_0x2b00('0x2b');this[_0x2b00('0x2c')]=_0x5c0622[_0x2b00('0x2c')]||0.03;this[_0x2b00('0x2d')]=_0x5c0622[_0x2b00('0x2d')]||0x258;this[_0x2b00('0x2e')]=_0x5c0622[_0x2b00('0x2e')]||_0x2b00('0x2f');this['dialOriginateCallerIdNumber']=_0x5c0622['dialOriginateCallerIdNumber']||_0x2b00('0x2f');this[_0x2b00('0x30')]=_0x5c0622[_0x2b00('0x30')]||0x1e;this[_0x2b00('0x31')]=_0x5c0622[_0x2b00('0x31')]||'tTxX';this[_0x2b00('0x32')]=_0x5c0622[_0x2b00('0x32')]||0x3;this['dialQueueProject']=_0x5c0622['dialQueueProject']||undefined;this[_0x2b00('0x33')]=_0x5c0622[_0x2b00('0x33')]||0x3;this['dialCongestionRetryFrequency']=_0x5c0622[_0x2b00('0x34')]||0x96;this[_0x2b00('0x35')]=_0x5c0622['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x5c0622['dialBusyRetryFrequency']||0x96;this[_0x2b00('0x36')]=_0x5c0622[_0x2b00('0x36')]||0x3;this['dialNoAnswerRetryFrequency']=_0x5c0622['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x5c0622[_0x2b00('0x37')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5c0622[_0x2b00('0x38')]||0x96;this[_0x2b00('0x39')]=_0x5c0622['dialDropMaxRetry']||0x3;this[_0x2b00('0x3a')]=_0x5c0622[_0x2b00('0x3a')]||0x96;this[_0x2b00('0x3b')]=_0x5c0622['dialAbandonedMaxRetry']||0x3;this[_0x2b00('0x3c')]=_0x5c0622[_0x2b00('0x3c')]||0x96;this[_0x2b00('0x3d')]=_0x5c0622[_0x2b00('0x3d')]||0x3;this['dialMachineRetryFrequency']=_0x5c0622[_0x2b00('0x3e')]||0x96;this[_0x2b00('0x3f')]=_0x5c0622['dialAgentRejectMaxRetry']||0x3;this[_0x2b00('0x40')]=_0x5c0622['dialAgentRejectRetryFrequency']||0x96;this[_0x2b00('0x41')]=_0x5c0622['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x5c0622[_0x2b00('0x42')]?_0x5c0622[_0x2b00('0x42')]:undefined;this[_0x2b00('0x43')]=_0x5c0622[_0x2b00('0x43')]?_0x5c0622[_0x2b00('0x43')]:undefined;this[_0x2b00('0x44')]=_0x5c0622[_0x2b00('0x44')]||undefined;this['Interval']=_0x5c0622[_0x2b00('0x45')]?_0x5c0622['Interval']:undefined;this[_0x2b00('0x46')]=_0x5c0622['dialOrderByScheduledAt']||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x5c0622[_0x2b00('0x47')]||undefined;this[_0x2b00('0x48')]=_0x5c0622[_0x2b00('0x48')]||undefined;this['strategy']=strategy[_0x5c0622['strategy']]||_0x2b00('0xb');this['queueStatusComplete']=!![];this[_0x2b00('0x49')]=_0x5c0622[_0x2b00('0x49')]||![];this[_0x2b00('0x4a')]=_0x5c0622[_0x2b00('0x4a')];this[_0x2b00('0x4b')]=_0x5c0622[_0x2b00('0x4b')];this[_0x2b00('0x4c')]=_0x5c0622[_0x2b00('0x4c')];this[_0x2b00('0x4d')]=_0x5c0622[_0x2b00('0x4d')];this[_0x2b00('0x4e')]=_0x5c0622[_0x2b00('0x4e')];this[_0x2b00('0x4f')]=_0x5c0622[_0x2b00('0x4f')];this[_0x2b00('0x50')]=_0x5c0622[_0x2b00('0x50')];this['dialAMDSilenceThreshold']=_0x5c0622['dialAMDSilenceThreshold'];this[_0x2b00('0x51')]=_0x5c0622[_0x2b00('0x51')];this[_0x2b00('0x52')]=0x0;this[_0x2b00('0x53')]=0x0;this[_0x2b00('0x54')]=_0x5c0622[_0x2b00('0x54')];this[_0x2b00('0x55')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x2b00('0x56')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x2b00('0x57')]=0x0;this[_0x2b00('0x58')]=0x0;this[_0x2b00('0x59')]=0x0;this[_0x2b00('0x5a')]=0x0;this[_0x2b00('0x5b')]=0x0;this[_0x2b00('0x5c')]=0x0;this[_0x2b00('0x5d')]=0x0;this['outboundReCallsDay']=0x0;this[_0x2b00('0x5e')]=0x0;this[_0x2b00('0x5f')]=undefined;this['startPredictive']=undefined;this[_0x2b00('0x60')]=undefined;this[_0x2b00('0x61')]=1.05;this[_0x2b00('0x62')]=0x0;this[_0x2b00('0x63')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x2b00('0x64')]=0x0;this[_0x2b00('0x65')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x2b00('0x66')]=_0x5c0622[_0x2b00('0x67')]||0x14;this[_0x2b00('0x68')]=_0x5c0622[_0x2b00('0x67')]||0xa;this[_0x2b00('0x69')]=0x0;this[_0x2b00('0x6a')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x2b00('0x6b')]=0x0;this[_0x2b00('0x6c')]=0x0;this[_0x2b00('0x6d')]=0x0;this[_0x2b00('0x6e')]=0x0;this['dialRecallMeTimeout']=_0x5c0622['dialRecallMeTimeout']||0x1e;this[_0x2b00('0x6f')]=_0x5c0622[_0x2b00('0x6f')]||![];this[_0x2b00('0x70')]=_0x5c0622[_0x2b00('0x70')]||undefined;this['dialAgiAfterHangupClient']=_0x5c0622[_0x2b00('0x71')]||![];this[_0x2b00('0x72')]=_0x5c0622[_0x2b00('0x72')]||![];this[_0x2b00('0xe')]=monitorFormat[_0x5c0622['monitor_format']]?monitorFormat[_0x5c0622[_0x2b00('0xe')]]:undefined;this[_0x2b00('0x73')]=_0x5c0622[_0x2b00('0x73')]||![];this[_0x2b00('0x74')]=_0x5c0622[_0x2b00('0x74')]?_0x5c0622[_0x2b00('0x74')]:undefined;}module[_0x2b00('0x75')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 8316d42..7f87112 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 _0x8ed9=['name','username','accessKey','remoteUri','serverUrl','exports'];(function(_0x3fecf4,_0x34047e){var _0x388ba6=function(_0x3aec46){while(--_0x3aec46){_0x3fecf4['push'](_0x3fecf4['shift']());}};_0x388ba6(++_0x34047e);}(_0x8ed9,0x186));var _0x98ed=function(_0x4bdad2,_0x3bb56b){_0x4bdad2=_0x4bdad2-0x0;var _0x249aa7=_0x8ed9[_0x4bdad2];return _0x249aa7;};'use strict';function VtigerAccount(_0x2557e2){this['id']=_0x2557e2['id']||0x0;this[_0x98ed('0x0')]=_0x2557e2[_0x98ed('0x0')]||'';this[_0x98ed('0x1')]=_0x2557e2[_0x98ed('0x1')]||'';this[_0x98ed('0x2')]=_0x2557e2['accessKey']||'';this[_0x98ed('0x3')]=_0x2557e2[_0x98ed('0x3')]||'';this['serverUrl']=_0x2557e2[_0x98ed('0x4')]||'';this['Configurations']=_0x2557e2['Configurations']||{};}module[_0x98ed('0x5')]=VtigerAccount; \ No newline at end of file +var _0xec5e=['accessKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x268701,_0x4487c7){var _0x561b62=function(_0x3b4c74){while(--_0x3b4c74){_0x268701['push'](_0x268701['shift']());}};_0x561b62(++_0x4487c7);}(_0xec5e,0x178));var _0xeec5=function(_0x2ccc4c,_0x3c0ced){_0x2ccc4c=_0x2ccc4c-0x0;var _0x4d9ba7=_0xec5e[_0x2ccc4c];return _0x4d9ba7;};'use strict';function VtigerAccount(_0x303860){this['id']=_0x303860['id']||0x0;this[_0xeec5('0x0')]=_0x303860[_0xeec5('0x0')]||'';this[_0xeec5('0x1')]=_0x303860[_0xeec5('0x1')]||'';this[_0xeec5('0x2')]=_0x303860['accessKey']||'';this[_0xeec5('0x3')]=_0x303860[_0xeec5('0x3')]||'';this[_0xeec5('0x4')]=_0x303860[_0xeec5('0x4')]||'';this[_0xeec5('0x5')]=_0x303860[_0xeec5('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 82592fc..ffe6eb3 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 _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x340699,_0x18d5f4){_0x340699=_0x340699-0x0;var _0x5b1374=_0xadb5[_0x340699];return _0x5b1374;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x1bbdcf,_0x2632b4){var _0x7f84a4=function(_0x302e12){while(--_0x302e12){_0x1bbdcf['push'](_0x1bbdcf['shift']());}};_0x7f84a4(++_0x2632b4);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 14c2d4b..725b0f0 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 _0x7fb3=['description','host','zone','clientId','clientSecret','serverUrl','code','Configurations','exports','name'];(function(_0x5df7a0,_0x4bd2e6){var _0x50f924=function(_0x125a1d){while(--_0x125a1d){_0x5df7a0['push'](_0x5df7a0['shift']());}};_0x50f924(++_0x4bd2e6);}(_0x7fb3,0xf9));var _0x37fb=function(_0x2a3e5f,_0x24c745){_0x2a3e5f=_0x2a3e5f-0x0;var _0xfdbebc=_0x7fb3[_0x2a3e5f];return _0xfdbebc;};'use strict';function ZohoAccount(_0x23e22f){this['id']=_0x23e22f['id']||0x0;this[_0x37fb('0x0')]=_0x23e22f[_0x37fb('0x0')]||'';this[_0x37fb('0x1')]=_0x23e22f['description']||'';this[_0x37fb('0x2')]=_0x23e22f[_0x37fb('0x2')]||'';this[_0x37fb('0x3')]=_0x23e22f[_0x37fb('0x3')]||'';this['clientId']=_0x23e22f[_0x37fb('0x4')]||'';this[_0x37fb('0x5')]=_0x23e22f[_0x37fb('0x5')]||'';this[_0x37fb('0x6')]=_0x23e22f[_0x37fb('0x6')]||'';this[_0x37fb('0x7')]=_0x23e22f['code']||'';this['refreshToken']=_0x23e22f['refreshToken']||'';this[_0x37fb('0x8')]=_0x23e22f[_0x37fb('0x8')]||{};}module[_0x37fb('0x9')]=ZohoAccount; \ No newline at end of file +var _0x087b=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x51a1e3,_0x24e680){var _0x1331ff=function(_0x4f6304){while(--_0x4f6304){_0x51a1e3['push'](_0x51a1e3['shift']());}};_0x1331ff(++_0x24e680);}(_0x087b,0x11a));var _0xb087=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x087b[_0x44946b];return _0x249bc4;};'use strict';function ZohoAccount(_0x534915){this['id']=_0x534915['id']||0x0;this[_0xb087('0x0')]=_0x534915['name']||'';this['description']=_0x534915[_0xb087('0x1')]||'';this['host']=_0x534915[_0xb087('0x2')]||'';this[_0xb087('0x3')]=_0x534915[_0xb087('0x3')]||'';this[_0xb087('0x4')]=_0x534915[_0xb087('0x4')]||'';this[_0xb087('0x5')]=_0x534915[_0xb087('0x5')]||'';this[_0xb087('0x6')]=_0x534915[_0xb087('0x6')]||'';this[_0xb087('0x7')]=_0x534915[_0xb087('0x7')]||'';this[_0xb087('0x8')]=_0x534915[_0xb087('0x8')]||'';this[_0xb087('0x9')]=_0x534915[_0xb087('0x9')]||{};}module[_0xb087('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index f4a433b..8365c11 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 _0xcb87=['number','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','membername','Agent','channelAgent','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','calleridname'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xcb87,0xb2));var _0x7cb8=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xcb87[_0x3511d3];return _0x5d6321;};'use strict';var util=require(_0x7cb8('0x0'));var _=require('lodash');var moment=require(_0x7cb8('0x1'));function checkNameSurname(_0x22b38f,_0x302099,_0x576091){var _0x137d4b='';if(!_[_0x7cb8('0x2')](_0x302099)&&_0x7cb8('0x3')===typeof _0x302099){_0x137d4b+=_0x302099;}if(!_['isNil'](_0x576091)&&_0x7cb8('0x3')===typeof _0x576091){_0x137d4b+='\x20'+_0x576091;}if(_0x137d4b!==''){return _0x137d4b;}return _0x22b38f;}function Action(_0x5da7fd,_0xcca257,_0x43dea2,_0x3e3b21,_0x28a23a){this[_0x7cb8('0x4')]=_0x43dea2||undefined;this[_0x7cb8('0x5')]=_0x5da7fd['id'];this[_0x7cb8('0x6')]=_0xcca257[_0x7cb8('0x7')];this[_0x7cb8('0x8')]=_0xcca257[_0x7cb8('0x8')];this['campaigntype']='queue';this['dialAnswer']=![];this[_0x7cb8('0x9')]=_[_0x7cb8('0x2')](_0x5da7fd[_0x7cb8('0xa')])?undefined:_0x5da7fd[_0x7cb8('0xa')][_0x7cb8('0x7')];this[_0x7cb8('0xb')]=this[_0x7cb8('0x9')]?util['format']('SIP/%s',this[_0x7cb8('0x9')]):_0x3e3b21||undefined;this['calleridname']=checkNameSurname(_0x5da7fd[_0x7cb8('0xc')][_0x7cb8('0xd')],_0x5da7fd[_0x7cb8('0xc')][_0x7cb8('0xe')],_0x5da7fd[_0x7cb8('0xc')][_0x7cb8('0xf')]);this[_0x7cb8('0x10')]=_0x5da7fd[_0x7cb8('0x10')]||![];this[_0x7cb8('0x11')]=_0x5da7fd[_0x7cb8('0xc')][_0x7cb8('0xd')];this[_0x7cb8('0x12')]=_0x5da7fd[_0x7cb8('0x12')];this['countbusyretry']=_0x5da7fd[_0x7cb8('0x13')]||0x0;this[_0x7cb8('0x14')]=_0x5da7fd[_0x7cb8('0x14')]||0x0;this[_0x7cb8('0x15')]=_0x5da7fd[_0x7cb8('0x15')]||0x0;this[_0x7cb8('0x16')]=(_0x5da7fd['countbusyretry']||0x0)+(_0x5da7fd['countcongestionretry']||0x0)+(_0x5da7fd[_0x7cb8('0x15')]||0x0)+(_0x5da7fd[_0x7cb8('0x17')]||0x0)+(_0x5da7fd['countdropretry']||0x0)+(_0x5da7fd[_0x7cb8('0x18')]||0x0)+(_0x5da7fd[_0x7cb8('0x19')]||0x0)+(_0x5da7fd['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x5da7fd['countnosuchnumberretry']||0x0;this[_0x7cb8('0x1a')]=_0x5da7fd[_0x7cb8('0x1a')]||0x0;this[_0x7cb8('0x18')]=_0x5da7fd[_0x7cb8('0x18')]||0x0;this[_0x7cb8('0x19')]=_0x5da7fd['countmachineretry']||0x0;this[_0x7cb8('0x1b')]=_0x5da7fd[_0x7cb8('0x1b')]||0x0;this[_0x7cb8('0x1c')]=_0x5da7fd['callback'];this[_0x7cb8('0x1d')]=_0x5da7fd[_0x7cb8('0x1d')];this[_0x7cb8('0x1e')]=_0x5da7fd[_0x7cb8('0x1e')];this[_0x7cb8('0x1f')]=_0x5da7fd[_0x7cb8('0x1f')];this[_0x7cb8('0x20')]=_0x5da7fd['ContactId'];this['ListId']=_0x5da7fd['ListId'];this[_0x7cb8('0x21')]=_[_0x7cb8('0x2')](_0x5da7fd[_0x7cb8('0xa')])?_0x5da7fd[_0x7cb8('0x21')]:_0x5da7fd[_0x7cb8('0xa')]['id'];this[_0x7cb8('0x22')]=_0x5da7fd['VoiceQueueId'];this[_0x7cb8('0x23')]='';this[_0x7cb8('0x24')]='';}Action[_0x7cb8('0x25')][_0x7cb8('0x26')]=function(){return util[_0x7cb8('0x27')](_0x7cb8('0x28'),this[_0x7cb8('0x29')],this[_0x7cb8('0x2a')]);};module[_0x7cb8('0x2b')]=Action; \ No newline at end of file +var _0x529c=['isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','format','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment'];(function(_0x517869,_0x1f383b){var _0x2e6dd7=function(_0x550e2e){while(--_0x550e2e){_0x517869['push'](_0x517869['shift']());}};_0x2e6dd7(++_0x1f383b);}(_0x529c,0xa9));var _0xc529=function(_0x1965d6,_0x1e8d86){_0x1965d6=_0x1965d6-0x0;var _0x3d0399=_0x529c[_0x1965d6];return _0x3d0399;};'use strict';var util=require(_0xc529('0x0'));var _=require(_0xc529('0x1'));var moment=require(_0xc529('0x2'));function checkNameSurname(_0x209129,_0x405b8f,_0x23d915){var _0x3b759d='';if(!_[_0xc529('0x3')](_0x405b8f)&&_0xc529('0x4')===typeof _0x405b8f){_0x3b759d+=_0x405b8f;}if(!_[_0xc529('0x3')](_0x23d915)&&'string'===typeof _0x23d915){_0x3b759d+='\x20'+_0x23d915;}if(_0x3b759d!==''){return _0x3b759d;}return _0x209129;}function Action(_0x4c154e,_0x54a108,_0x4e5f83,_0x36f191,_0x4e16a4){this[_0xc529('0x5')]=_0x4e5f83||undefined;this[_0xc529('0x6')]=_0x4c154e['id'];this[_0xc529('0x7')]=_0x54a108[_0xc529('0x8')];this['type']=_0x54a108[_0xc529('0x9')];this[_0xc529('0xa')]=_0xc529('0x7');this['dialAnswer']=![];this[_0xc529('0xb')]=_[_0xc529('0x3')](_0x4c154e['Agent'])?undefined:_0x4c154e[_0xc529('0xc')][_0xc529('0x8')];this['channelAgent']=this['membername']?util[_0xc529('0xd')](_0xc529('0xe'),this['membername']):_0x36f191||undefined;this[_0xc529('0xf')]=checkNameSurname(_0x4c154e['Contact'][_0xc529('0x10')],_0x4c154e[_0xc529('0x11')][_0xc529('0x12')],_0x4c154e[_0xc529('0x11')][_0xc529('0x13')]);this[_0xc529('0x14')]=_0x4c154e[_0xc529('0x14')]||![];this['calleridnum']=_0x4c154e[_0xc529('0x11')][_0xc529('0x10')];this[_0xc529('0x15')]=_0x4c154e[_0xc529('0x15')];this[_0xc529('0x16')]=_0x4c154e[_0xc529('0x16')]||0x0;this[_0xc529('0x17')]=_0x4c154e[_0xc529('0x17')]||0x0;this[_0xc529('0x18')]=_0x4c154e[_0xc529('0x18')]||0x0;this[_0xc529('0x19')]=(_0x4c154e[_0xc529('0x16')]||0x0)+(_0x4c154e[_0xc529('0x17')]||0x0)+(_0x4c154e['countnoanswerretry']||0x0)+(_0x4c154e['countnosuchnumberretry']||0x0)+(_0x4c154e[_0xc529('0x1a')]||0x0)+(_0x4c154e[_0xc529('0x1b')]||0x0)+(_0x4c154e[_0xc529('0x1c')]||0x0)+(_0x4c154e['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x4c154e['countnosuchnumberretry']||0x0;this['countdropretry']=_0x4c154e[_0xc529('0x1a')]||0x0;this[_0xc529('0x1b')]=_0x4c154e[_0xc529('0x1b')]||0x0;this['countmachineretry']=_0x4c154e['countmachineretry']||0x0;this[_0xc529('0x1d')]=_0x4c154e['countagentrejectretry']||0x0;this[_0xc529('0x1e')]=_0x4c154e[_0xc529('0x1e')];this['callbackuniqueid']=_0x4c154e[_0xc529('0x1f')];this[_0xc529('0x20')]=_0x4c154e[_0xc529('0x20')];this[_0xc529('0x21')]=_0x4c154e['recallme'];this[_0xc529('0x22')]=_0x4c154e[_0xc529('0x22')];this[_0xc529('0x23')]=_0x4c154e[_0xc529('0x23')];this['UserId']=_[_0xc529('0x3')](_0x4c154e['Agent'])?_0x4c154e['UserId']:_0x4c154e['Agent']['id'];this[_0xc529('0x24')]=_0x4c154e['VoiceQueueId'];this[_0xc529('0x25')]='';this[_0xc529('0x26')]='';}Action[_0xc529('0x27')][_0xc529('0x28')]=function(){return util[_0xc529('0xd')](_0xc529('0x29'),this[_0xc529('0xf')],this['number']);};module[_0xc529('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 2d9bd2a..841a66b 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 _0x5655=['destuniqueid','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','../../../config/logger','actionPreview','../ami','./rpcDb','./action','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','outbound','name','answered','loggedIn','pTalking','sumHoldTime','talking','total','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','prototype','hasOwnProperty','preview','booked','type','setMessage','recallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','linkedid','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','unlockAgent','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','outboundUnknownCallsDay','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','SIP/%s','unmonitored','run','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','Action','variablesAction','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','reason','channelstate','transfer','disableContact','[syncHangup][talking][transfer]'];(function(_0x4cbb1d,_0x121d99){var _0x133d6f=function(_0xea0575){while(--_0xea0575){_0x4cbb1d['push'](_0x4cbb1d['shift']());}};_0x133d6f(++_0x121d99);}(_0x5655,0x15e));var _0x5565=function(_0x1bba35,_0x4c4eb5){_0x1bba35=_0x1bba35-0x0;var _0x3002ad=_0x5655[_0x1bba35];return _0x3002ad;};'use strict';var util=require(_0x5565('0x0'));var _=require(_0x5565('0x1'));var BPromise=require(_0x5565('0x2'));var uuid=require(_0x5565('0x3'));var moment=require(_0x5565('0x4'));var md5=require(_0x5565('0x5'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x5565('0x6'))('preview');var loggerAction=require(_0x5565('0x6'))(_0x5565('0x7'));var ami=require(_0x5565('0x8'));var rpcDb=require(_0x5565('0x9'));var Action=require(_0x5565('0xa'));var ut=require('./util/util');config[_0x5565('0xb')]=_[_0x5565('0xc')](config[_0x5565('0xb')],{'host':_0x5565('0xd'),'port':0x18eb});var io=require(_0x5565('0xe'))(new Redis(config[_0x5565('0xb')]));var Sequence=function(){};Sequence['prototype'][_0x5565('0xf')]=function(_0x367ce8){this['tail']=this['tail']?this[_0x5565('0x10')][_0x5565('0x11')](_0x367ce8):_0x367ce8();};function Preview(_0x5d0d99){this['sequence']=new Sequence();this[_0x5565('0x12')]=_0x5d0d99[_0x5565('0x13')];this[_0x5565('0x14')]=_0x5d0d99[_0x5565('0x14')];this[_0x5565('0x15')]={};this[_0x5565('0x16')]=_0x5d0d99[_0x5565('0x16')];this[_0x5565('0x17')]=0x0;ami['on']('originateresponse',this[_0x5565('0x18')][_0x5565('0x19')](this));ami['on'](_0x5565('0x1a'),this[_0x5565('0x1b')]['bind'](this));ami['on'](_0x5565('0x1c'),this[_0x5565('0x1d')][_0x5565('0x19')](this));ami['on'](_0x5565('0x1e'),this[_0x5565('0x1f')]['bind'](this));ami['on']('newexten',this[_0x5565('0x20')][_0x5565('0x19')](this));ami['on']('varset',this[_0x5565('0x21')][_0x5565('0x19')](this));ami['on'](_0x5565('0x22'),this[_0x5565('0x23')]['bind'](this));ami['on']('blindtransfer',this[_0x5565('0x24')][_0x5565('0x19')](this));this[_0x5565('0x25')](this[_0x5565('0x12')]);}function emit(_0x183e20,_0x298f4f,_0x47b0e3){io['to'](_0x183e20)[_0x5565('0x26')](_0x298f4f,_0x47b0e3);}function emitCampaignPreview(_0x11e42b){if(_0x11e42b['type']===_0x5565('0x27')){var _0x25f8c9={'id':_0x11e42b['id'],'name':_0x11e42b[_0x5565('0x28')],'strategy':_0x11e42b['strategy'],'answered':_0x11e42b[_0x5565('0x29')],'available':_0x11e42b['available'],'loggedIn':_0x11e42b[_0x5565('0x2a')],'pTalking':_0x11e42b[_0x5565('0x2b')],'sumBillable':_0x11e42b['sumBillable'],'sumDuration':_0x11e42b['sumDuration'],'sumHoldTime':_0x11e42b[_0x5565('0x2c')]||0x0,'talking':_0x11e42b[_0x5565('0x2d')],'total':_0x11e42b[_0x5565('0x2e')],'type':_0x11e42b['type'],'unmanaged':_0x11e42b['unmanaged'],'abandoned':_0x11e42b[_0x5565('0x2f')],'waiting':_0x11e42b[_0x5565('0x30')],'loggedInDb':_0x11e42b['loggedInDb'],'dialActive':_0x11e42b[_0x5565('0x31')],'dialMethod':_0x11e42b[_0x5565('0x32')],'dialOriginateCallerIdName':_0x11e42b['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x11e42b[_0x5565('0x33')],'dialOriginateTimeout':_0x11e42b['dialOriginateTimeout'],'dialPrefix':_0x11e42b[_0x5565('0x34')],'outboundAnswerAgiCallsDay':_0x11e42b[_0x5565('0x35')],'outboundAnswerCallsDay':_0x11e42b[_0x5565('0x36')],'outboundBlacklistCallsDay':_0x11e42b[_0x5565('0x37')],'outboundBusyCallsDay':_0x11e42b[_0x5565('0x38')],'outboundCongestionCallsDay':_0x11e42b[_0x5565('0x39')],'outboundDropCallsDayACS':_0x11e42b[_0x5565('0x3a')],'outboundDropCallsDayCallersExit':_0x11e42b[_0x5565('0x3b')],'outboundDropCallsDayTimeout':_0x11e42b[_0x5565('0x3c')],'outboundNoAnswerCallsDay':_0x11e42b['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x11e42b[_0x5565('0x3d')],'outboundOriginateFailureCallsDay':_0x11e42b['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x11e42b['outboundReCallsDay'],'outboundRejectCallsDay':_0x11e42b[_0x5565('0x3e')],'outboundUnknownCallsDay':_0x11e42b['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x11e42b[_0x5565('0x3f')],'predictiveIntervalAnsweredCalls':_0x11e42b[_0x5565('0x40')],'predictiveIntervalAvgHoldtime':_0x11e42b[_0x5565('0x41')],'predictiveIntervalAvgTalktime':_0x11e42b['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x11e42b['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x11e42b[_0x5565('0x42')],'predictiveIntervalErlangCalls':_0x11e42b[_0x5565('0x43')],'predictiveIntervalErlangCallsDroppedCalls':_0x11e42b[_0x5565('0x44')],'predictiveIntervalHitRate':_0x11e42b['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x11e42b['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x11e42b[_0x5565('0x45')],'predictiveIntervalAvailable':_0x11e42b['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x11e42b[_0x5565('0x46')],'message':_0x11e42b['message'],'originated':_0x11e42b[_0x5565('0x47')],'erlangCalls':_0x11e42b['erlangCalls'],'erlangCallToSecond':_0x11e42b['erlangCallToSecond'],'erlangAbandonmentRate':_0x11e42b[_0x5565('0x48')],'erlangBusyFactor':_0x11e42b[_0x5565('0x49')],'startPredictive':_0x11e42b['startPredictive'],'startProgressive':_0x11e42b[_0x5565('0x4a')]};if(_0x11e42b[_0x5565('0x4b')]){_0x25f8c9[_0x5565('0x4b')]={'id':_0x11e42b[_0x5565('0x4b')]['id'],'name':_0x11e42b[_0x5565('0x4b')][_0x5565('0x28')],'active':_0x11e42b[_0x5565('0x4b')][_0x5565('0x4c')],'callerid':_0x11e42b[_0x5565('0x4b')][_0x5565('0x4d')]};}if(_0x11e42b['Interval']){_0x25f8c9[_0x5565('0x4e')]={'id':_0x11e42b[_0x5565('0x4e')]['id'],'name':_0x11e42b['Interval'][_0x5565('0x28')]};}var _0x2480bf=md5(JSON['stringify'](_0x25f8c9));if(_0x11e42b[_0x5565('0x5')]!==_0x2480bf){_0x11e42b[_0x5565('0x5')]=_0x2480bf;emit(util['format']('voice:queue:%s',_0x25f8c9[_0x5565('0x28')]),_0x5565('0x4f'),_0x25f8c9);}}}function emitVoiceQueueChannelRemove(_0x29b2f9){logger[_0x5565('0x50')](_0x5565('0x51'),JSON[_0x5565('0x52')](_0x29b2f9));emit(util[_0x5565('0x53')](_0x5565('0x54'),_0x29b2f9['name']),'voice_queue_channel:remove',_0x29b2f9);this['emit'](_0x5565('0x55'),_0x29b2f9);}function notSendMessagesQueue(_0x16a0f9){if(_0x16a0f9['sendMessageOneNotActive']){if(_0x16a0f9[_0x5565('0x47')]===0x0&&_0x16a0f9['pTalking']===0x0){_0x16a0f9[_0x5565('0x56')]=![];_0x16a0f9['available']=0x0;_0x16a0f9['paused']=0x0;_0x16a0f9[_0x5565('0x57')]=_0x5565('0x58');ut[_0x5565('0x59')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x16a0f9[_0x5565('0x28')]+'\x20is\x20not\x20active');}else{_0x16a0f9[_0x5565('0x57')]='IS_DISACTIVED';ut['logger'](_0x5565('0x5a'),_0x16a0f9['name']+_0x5565('0x5b'));}emitCampaignPreview(_0x16a0f9);}}Preview['prototype']['loopCampaigns']=function(){var _0x269b22=this;setInterval(function(){_0x269b22[_0x5565('0x5c')]();},0x7cf);};Preview[_0x5565('0x5d')][_0x5565('0x5c')]=function(){var _0x1dda95=this[_0x5565('0x12')];this[_0x5565('0x17')]+=0x1;for(var _0x556ef7 in _0x1dda95){if(_0x1dda95[_0x5565('0x5e')](_0x556ef7)&&(_0x1dda95[_0x556ef7][_0x5565('0x32')]===_0x5565('0x5f')||_0x1dda95[_0x556ef7][_0x5565('0x32')]===_0x5565('0x60'))&&_0x1dda95[_0x556ef7][_0x5565('0x61')]===_0x5565('0x27')){if(this[_0x5565('0x17')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x1dda95['hasOwnProperty'](_0x556ef7)&&_0x1dda95[_0x556ef7][_0x5565('0x32')]===_0x5565('0x5f')&&_0x1dda95[_0x556ef7][_0x5565('0x61')]===_0x5565('0x27')){if(_0x1dda95[_0x556ef7]['dialActive']){this[_0x5565('0x62')](_0x1dda95[_0x556ef7]);this[_0x5565('0x63')](_0x1dda95[_0x556ef7]);}else{notSendMessagesQueue(_0x1dda95[_0x556ef7]);}}}};Preview[_0x5565('0x5d')][_0x5565('0x64')]=function(_0x216e4e){var _0x5c9931=this;this[_0x5565('0x65')]['enqueue'](function(){if(!_[_0x5565('0x66')](_0x5c9931[_0x5565('0x15')][_0x216e4e])){loggerAction[_0x5565('0x50')](_0x5565('0x67'),_0x216e4e,_0x5565('0x68'),_0x5c9931[_0x5565('0x15')][_0x216e4e][_0x5565('0x69')],_0x5565('0x6a'),JSON['stringify'](_0x5c9931[_0x5565('0x12')][_0x5c9931[_0x5565('0x15')][_0x216e4e]['queue']][_0x5565('0x47')]),_0x5565('0x6b'),JSON['stringify'](_0x5c9931['campaignsPreview'][_0x5c9931[_0x5565('0x15')][_0x216e4e]['queue']][_0x5565('0x2b')]),JSON[_0x5565('0x52')](_0x5c9931['actions'][_0x216e4e][_0x5565('0x6c')]),JSON['stringify'](_['pick'](_0x5c9931['actions'][_0x216e4e],[_0x5565('0x6d'),_0x5565('0x6e'),_0x5565('0x6f'),'ListId'])));return ami['Action']({'action':_0x5565('0x70'),'channel':_0x5c9931[_0x5565('0x15')][_0x216e4e][_0x5565('0x71')]})[_0x5565('0x72')](function(_0x143472){if(_0x143472['message']===_0x5565('0x73')){setTimeout(function(){if(_0x5c9931['actions'][_0x216e4e]){ut[_0x5565('0x74')](_0x5c9931[_0x5565('0x12')][_0x5c9931[_0x5565('0x15')][_0x216e4e][_0x5565('0x69')]],_0x5565('0x75'));if(_0x5c9931[_0x5565('0x15')][_0x216e4e][_0x5565('0x6c')]===!![]){ut[_0x5565('0x76')](_0x5c9931[_0x5565('0x12')][_0x5c9931[_0x5565('0x15')][_0x216e4e][_0x5565('0x69')]],_0x5565('0x75'));ut[_0x5565('0x77')](_0x5565('0x78')+_0x216e4e,_0x5c9931[_0x5565('0x15')][_0x216e4e][_0x5565('0x69')]);}ut[_0x5565('0x77')](_0x5565('0x79')+_0x216e4e,_0x5c9931[_0x5565('0x15')][_0x216e4e][_0x5565('0x69')]);delete _0x5c9931['actions'][_0x216e4e];}},0x2328);}});}});};Preview[_0x5565('0x5d')][_0x5565('0x7a')]=function(){var _0x2213c9=this;loggerAction[_0x5565('0x50')](_0x5565('0x7b'),_[_0x5565('0x7c')](this['actions']));for(var _0x30f0da in this[_0x5565('0x15')]){if(_0x2213c9[_0x5565('0x15')][_0x5565('0x5e')](_0x30f0da)){_0x2213c9['clearZombieChannel'](_0x30f0da);}}};Preview[_0x5565('0x5d')]['recallMe']=function(_0x1e26af){var _0x3a5e7c=this;rpcDb[_0x5565('0x7d')](_0x1e26af['id'],ut[_0x5565('0x7e')](this[_0x5565('0x16')]))[_0x5565('0x7f')](function(_0x51a5f0){if(!_[_0x5565('0x66')](_0x51a5f0)){for(var _0x2db1e6=0x0;_0x2db1e6<_0x51a5f0[_0x5565('0x80')];_0x2db1e6+=0x1){if(ut[_0x5565('0x81')](_0x51a5f0[_0x2db1e6][_0x5565('0x82')])<_0x1e26af[_0x5565('0x83')]*0x3c){if(_0x51a5f0[_0x2db1e6][_0x5565('0x84')]&&!_0x51a5f0[_0x2db1e6]['Agent'][_0x5565('0x85')]){_0x3a5e7c['run'](_0x51a5f0[_0x2db1e6]['id'])['then'](ut[_0x5565('0x86')]('[RecallMe]'))['catch'](ut[_0x5565('0x86')](_0x5565('0x87')));}else{rpcDb['disableContact'](_0x51a5f0[_0x2db1e6]['id']);}}else{var _0x1e4ee9=new Action(_0x51a5f0[_0x2db1e6],_0x1e26af);_0x1e4ee9[_0x5565('0x88')]=moment()['format'](_0x5565('0x89'));_0x1e26af['outboundReCallsDay']+=0x1;ut[_0x5565('0x8a')](_0x1e4ee9,0x17,_0x5565('0x8b'));if(_0x1e26af[_0x5565('0x8c')]){rpcDb[_0x5565('0x8d')](ut[_0x5565('0x8e')](_0x51a5f0[_0x2db1e6]));rpcDb[_0x5565('0x8f')](_0x1e4ee9,_0x5565('0x90'));}else{ut[_0x5565('0x8a')](_0x1e4ee9,0x16,_0x5565('0x91'));rpcDb['createCustomerHistory'](_0x1e4ee9,_0x5565('0x92'));rpcDb[_0x5565('0x93')](_0x1e4ee9,_0x5565('0x92'));}}}}})['catch'](ut['logger2'](_0x5565('0x94')));};Preview[_0x5565('0x5d')]['setMessage']=function(_0x3288e7){_0x3288e7['sendMessageOneNotActive']=!![];if(ut[_0x5565('0x95')](_0x3288e7[_0x5565('0x2a')])){_0x3288e7[_0x5565('0x57')]=_0x5565('0x96');}else if(!ut[_0x5565('0x97')](_0x3288e7[_0x5565('0x31')])){_0x3288e7[_0x5565('0x57')]=_0x5565('0x58');}else if(!this[_0x5565('0x98')](_0x3288e7['Trunk'])){if(!this[_0x5565('0x98')](_0x3288e7[_0x5565('0x99')])){_0x3288e7[_0x5565('0x57')]='TRUNK_IS_NOT_REACHABLE';}else{_0x3288e7[_0x5565('0x57')]=_0x5565('0x9a');}}else{_0x3288e7[_0x5565('0x57')]='ACTIVE';}emitCampaignPreview(_0x3288e7);};Preview[_0x5565('0x5d')][_0x5565('0x9b')]=function(_0x30aef3,_0x5981e4,_0x163846){var _0xceb74e=this;var _0x36435b=this['actions'][_0x5981e4];var _0x2f8d41=this[_0x5565('0x12')][_0x36435b[_0x5565('0x69')]];var _0x374122;if(_0x2f8d41){switch(_0x163846){case'1':_0x2f8d41[_0x5565('0x3d')]+=0x1;_0x36435b[_0x5565('0x9c')]+=0x1;_0x36435b[_0x5565('0x9d')]=ut[_0x5565('0x9e')](_0x36435b);ut['logCustomer'](_0x36435b,0x0,_0x5565('0x9f'));ami[_0x5565('0x26')](_0x5565('0xa0'),ut[_0x5565('0xa1')](_0x36435b,_0x5565('0xa2')));rpcDb['createCustomerHistory'](_0x36435b,_0x5565('0xa3'));if(ut[_0x5565('0x9e')](_0x36435b)>=_0x2f8d41[_0x5565('0xa4')]){_0x374122=ut[_0x5565('0xa5')](_0x36435b,0xf,_0x5565('0xa6'));rpcDb[_0x5565('0x93')](_0x374122,_0x5565('0xa7'));}else{if(_0x36435b['countnosuchnumberretry']>=_0x2f8d41[_0x5565('0xa8')]){rpcDb[_0x5565('0x93')](_0x36435b,_0x5565('0xa7'));}else{rpcDb['rescheduleContact'](ut[_0x5565('0xa9')](_0x36435b,_0x5565('0x9c'),_0x2f8d41[_0x5565('0xaa')]),_0x36435b['unlockAgent'],_0x36435b[_0x5565('0xab')]);}}delete this[_0x5565('0x15')][_0x30aef3['linkedid']];break;case'ANSWER':var _0x5b77f4=moment()[_0x5565('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x36435b[_0x5565('0xac')]=_0x5b77f4;_0x36435b[_0x5565('0xad')]=_0x5b77f4;_0x36435b[_0x5565('0x6c')]=!![];_0x2f8d41[_0x5565('0x2b')]+=0x1;logger[_0x5565('0x50')]('[syncHangup][talking][increment]',_0x36435b[_0x5565('0xae')],_0x5565('0xaf'),_0x2f8d41[_0x5565('0x28')],'pTalking:\x20',_0x2f8d41[_0x5565('0x2b')]);ami[_0x5565('0x26')](_0x5565('0xb0'),ut[_0x5565('0xa1')](_0x36435b,'connect',this['campaignsPreview'][_0x36435b['queue']]));if(_0x2f8d41[_0x5565('0xb1')]){ami['emit'](_0x5565('0xb2'),ut[_0x5565('0xb3')](_0x36435b));}break;case'16':ami[_0x5565('0x26')](_0x5565('0xb4'),ut[_0x5565('0xa1')](_0x36435b,'complete',this['campaignsPreview'][_0x36435b[_0x5565('0x69')]]));emitVoiceQueueChannelRemove(ut[_0x5565('0xa1')](_0x36435b,_0x5565('0xb5')));_0x2f8d41[_0x5565('0x36')]+=0x1;_0x2f8d41[_0x5565('0x2e')]+=0x1;_0x2f8d41[_0x5565('0x29')]+=0x1;ut[_0x5565('0x76')](_0x2f8d41,_0x5565('0xb6'));_0x36435b['countglobal']=ut[_0x5565('0x9e')](_0x36435b);ut[_0x5565('0x8a')](_0x36435b,0x4,_0x5565('0xb7'));rpcDb[_0x5565('0x8f')](_0x36435b,_0x5565('0xb8'));rpcDb[_0x5565('0x93')](_0x36435b,_0x5565('0xb9'));rpcDb['crateCustomerReportQueue'](_0x36435b);_0x2f8d41[_0x5565('0xba')]+=_0x36435b[_0x5565('0xbb')];_0x2f8d41[_0x5565('0xbc')]+=_0x36435b[_0x5565('0xbb')];logger[_0x5565('0x50')](_0x5565('0xbd'),_0x36435b[_0x5565('0xae')],_0x5565('0xaf'),_0x2f8d41[_0x5565('0x28')],_0x5565('0x6b'),_0x2f8d41[_0x5565('0x2b')]);delete this['actions'][_0x30aef3[_0x5565('0xbe')]];break;case _0x5565('0xbf'):_0x2f8d41['outboundBusyCallsDay']+=0x1;_0x36435b[_0x5565('0xc0')]+=0x1;_0x36435b[_0x5565('0x9d')]=ut[_0x5565('0x9e')](_0x36435b);ut[_0x5565('0x8a')](_0x36435b,0x5,'Busy');ami[_0x5565('0x26')](_0x5565('0xc1'),ut['buildObj'](_0x36435b,_0x5565('0xc2')));rpcDb[_0x5565('0x8f')](_0x36435b,_0x5565('0xc3'));if(ut[_0x5565('0x9e')](_0x36435b)>=_0x2f8d41['dialGlobalMaxRetry']){_0x374122=ut[_0x5565('0xa5')](_0x36435b,0xf,_0x5565('0xa6'));rpcDb[_0x5565('0x93')](_0x374122,_0x5565('0xc4'));}else{if(_0x36435b['countbusyretry']>=_0x2f8d41[_0x5565('0xc5')]){rpcDb['createCustomerFinal'](_0x36435b,_0x5565('0xc3'));}else{rpcDb[_0x5565('0xc6')](ut[_0x5565('0xa9')](_0x36435b,'countbusyretry',_0x2f8d41['dialBusyRetryFrequency']),_0x36435b[_0x5565('0xc7')],_0x36435b[_0x5565('0xab')]);}}break;case'NOANSWER':_0x2f8d41['outboundNoAnswerCallsDay']+=0x1;_0x36435b[_0x5565('0xc8')]+=0x1;_0x36435b[_0x5565('0x9d')]=ut[_0x5565('0x9e')](_0x36435b);ut[_0x5565('0x8a')](_0x36435b,0x3,_0x5565('0xc9'));ami[_0x5565('0x26')](_0x5565('0xca'),ut['buildObj'](_0x36435b,_0x5565('0xcb')));rpcDb[_0x5565('0x8f')](_0x36435b,_0x5565('0xcc'));if(ut['totalGlobal'](_0x36435b)>=_0x2f8d41['dialGlobalMaxRetry']){_0x374122=ut[_0x5565('0xa5')](_0x36435b,0xf,'Global');rpcDb[_0x5565('0x93')](_0x374122,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x36435b[_0x5565('0xc8')]>=_0x2f8d41[_0x5565('0xcd')]){rpcDb[_0x5565('0x93')](_0x36435b,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0x5565('0xa9')](_0x36435b,_0x5565('0xc8'),_0x2f8d41['dialNoAnswerRetryFrequency']),_0x36435b['unlockAgent'],_0x36435b[_0x5565('0xab')]);}}break;case _0x5565('0xce'):_0x2f8d41[_0x5565('0x39')]+=0x1;_0x36435b[_0x5565('0xcf')]+=0x1;_0x36435b[_0x5565('0x9d')]=ut[_0x5565('0x9e')](_0x36435b);ut[_0x5565('0x8a')](_0x36435b,0x8,'Congestion');ami['emit'](_0x5565('0xd0'),ut[_0x5565('0xa1')](_0x36435b,_0x5565('0xd1')));rpcDb[_0x5565('0x8f')](_0x36435b,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x5565('0x9e')](_0x36435b)>=_0x2f8d41[_0x5565('0xa4')]){_0x374122=ut[_0x5565('0xa5')](_0x36435b,0xf,_0x5565('0xa6'));rpcDb[_0x5565('0x93')](_0x374122,_0x5565('0xd2'));}else{if(_0x36435b[_0x5565('0xcf')]>=_0x2f8d41[_0x5565('0xd3')]){rpcDb['createCustomerFinal'](_0x36435b,_0x5565('0xd4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x36435b,_0x5565('0xcf'),_0x2f8d41['dialBusyRetryFrequency']),_0x36435b['unlockAgent'],_0x36435b[_0x5565('0xab')]);}}break;case _0x5565('0xd5'):_0x2f8d41[_0x5565('0x3e')]+=0x1;_0x36435b[_0x5565('0xd6')]+=0x1;_0x36435b[_0x5565('0x9d')]=ut[_0x5565('0x9e')](_0x36435b);ut[_0x5565('0x8a')](_0x36435b,0x14,_0x5565('0xd7'));ami[_0x5565('0x26')](_0x5565('0xd8'),ut['buildObj'](_0x36435b,'agentreject'));rpcDb[_0x5565('0x8f')](_0x36435b,_0x5565('0xd9'));if(ut[_0x5565('0x9e')](_0x36435b)>=_0x2f8d41[_0x5565('0xa4')]){_0x374122=ut['cloneAction'](_0x36435b,0x14,_0x5565('0xd7'));rpcDb['createCustomerFinal'](_0x374122,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x36435b[_0x5565('0xd6')]>=_0x2f8d41[_0x5565('0xda')]){rpcDb['createCustomerFinal'](_0x36435b,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x5565('0xc6')](ut[_0x5565('0xa9')](_0x36435b,'countagentrejectretry',_0x2f8d41[_0x5565('0xdb')]),_0x36435b[_0x5565('0xc7')],_0x36435b[_0x5565('0xab')]);}}break;case _0x5565('0xdc'):_0x2f8d41['outboundAbandonedCallsDay']+=0x1;_0x36435b[_0x5565('0xdd')]+=0x1;_0x36435b[_0x5565('0x9d')]=ut['totalGlobal'](_0x36435b);ut[_0x5565('0x8a')](_0x36435b,0xb,'Abandoned');rpcDb[_0x5565('0x8f')](_0x36435b,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x5565('0x9e')](_0x36435b)>=_0x2f8d41[_0x5565('0xa4')]){_0x374122=ut[_0x5565('0xa5')](_0x36435b,0xf,_0x5565('0xa6'));rpcDb[_0x5565('0x93')](_0x374122,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x36435b[_0x5565('0xde')]>=_0x2f8d41[_0x5565('0xdf')]){rpcDb[_0x5565('0x93')](_0x36435b,_0x5565('0xe0'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x36435b,_0x5565('0xdd'),_0x2f8d41[_0x5565('0xe1')]),_0x36435b[_0x5565('0xc7')],_0x36435b[_0x5565('0xab')]);}}break;default:if(_0x36435b['dialAnswer']){ut[_0x5565('0x76')](_0x2f8d41,_0x5565('0xe2'));ut[_0x5565('0x77')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x2f8d41[_0x5565('0x28')],_0x30aef3);}_0x2f8d41[_0x5565('0xe3')]+=0x1;_0x36435b[_0x5565('0x9d')]=ut[_0x5565('0x9e')](_0x36435b);ut['logCustomer'](_0x36435b,0xc,_0x30aef3[_0x5565('0xe4')]||_0x30aef3[_0x5565('0xe5')]);rpcDb[_0x5565('0x8f')](_0x36435b,_0x5565('0xe6'));if(ut[_0x5565('0x9e')](_0x36435b)>=_0x2f8d41[_0x5565('0xa4')]){_0x374122=ut[_0x5565('0xa5')](_0x36435b,0xf,_0x5565('0xa6'));rpcDb[_0x5565('0x93')](_0x374122,_0x5565('0xe7'));}else{rpcDb[_0x5565('0x93')](_0x36435b,_0x5565('0xe7'));}delete this[_0x5565('0x15')][_0x30aef3['linkedid']];}if(!(_0x36435b[_0x5565('0x6c')]&&_0x163846==='16')){ut[_0x5565('0x74')](_0x2f8d41,_0x5565('0xe8'));logger[_0x5565('0x50')](_0x5565('0xe9'),_0x36435b[_0x5565('0xae')],_0x5565('0xaf'),_0x2f8d41[_0x5565('0x28')],'originated:\x20',_0x2f8d41[_0x5565('0x47')]);}if(_0x163846!=='ANSWER'){delete this['actions'][_0x30aef3[_0x5565('0xbe')]];delete this['actions'][_0x30aef3[_0x5565('0xea')]];}}};Preview[_0x5565('0x5d')][_0x5565('0xeb')]=function(_0x2c9e51,_0x3a740f,_0xd14d62){if(_['isUndefined'](_0x3a740f)&&'object'!==typeof _0x3a740f){return;}if(_['isUndefined'](_0xd14d62)&&'object'!==typeof _0xd14d62){return;}switch(_0xd14d62['reason']){case'0':ut['logAgent'](_0x2c9e51,0x0,_0x5565('0x9f'));rpcDb['createAgentHistory'](_0x2c9e51,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x5565('0xec')](_0x2c9e51,0x3,'NoAnswer');rpcDb[_0x5565('0xed')](_0x2c9e51,_0x5565('0xee'));break;case'5':ut[_0x5565('0xec')](_0x2c9e51,0x5,_0x5565('0xef'));rpcDb[_0x5565('0xed')](_0x2c9e51,_0x5565('0xf0'));break;case'8':ut[_0x5565('0xec')](_0x2c9e51,0x8,_0x5565('0xf1'));rpcDb['createAgentHistory'](_0x2c9e51,_0x5565('0xf2'));break;case'22':ut['logAgent'](_0x2c9e51,0x16,_0x5565('0xf3'));rpcDb['createAgentHistory'](_0x2c9e51,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x5565('0xec')](_0x2c9e51,0xc,_0xd14d62['reason']);rpcDb[_0x5565('0xed')](_0x2c9e51,_0x5565('0xf2'));}ut['updateOriginated'](_0x3a740f,_0x5565('0xf4'));logger[_0x5565('0x50')](_0x5565('0xf5'),_0x2c9e51[_0x5565('0xae')],'\x20Queue',_0x3a740f[_0x5565('0x28')],_0x5565('0x6a'),_0x3a740f[_0x5565('0x47')]);delete this[_0x5565('0x15')][_0x2c9e51['uniqueid']];};Preview[_0x5565('0x5d')][_0x5565('0xf6')]=function(_0xaff99b,_0x313244,_0x56ad33,_0x588d21,_0x13764b){var _0x25ddc5=this;return new BPromise(function(_0x25f4a0,_0x5bb66c){if(_[_0x5565('0x66')](_0x313244)||_[_0x5565('0x66')](_0x313244['Contact'])||_[_0x5565('0x66')](_0x313244[_0x5565('0xf7')][_0x5565('0xf8')])||_[_0x5565('0x66')](_0x313244[_0x5565('0x6f')])){_0x5bb66c(ut[_0x5565('0x57')](_0x5565('0xf9'),_0x588d21,_0x13764b));return;}var _0x32def6=uuid['v4']();var _0x228b0b=_0x25ddc5['campaignsPreview'][_0x313244[_0x5565('0x68')][_0x5565('0x28')]];var _0x577840=_0x56ad33?_0x25ddc5[_0x5565('0x16')][_0x56ad33]['id']:undefined;_0x25ddc5[_0x5565('0x15')][_0x32def6]=new Action(_0x313244,_0x228b0b,_0x32def6,_0x56ad33,_0x577840);var _0x1e14da=_0x25ddc5[_0x5565('0x15')][_0x32def6];_0x1e14da['unlockAgent']=_0x588d21;_0x1e14da[_0x5565('0xab')]=_0x13764b;_0x1e14da[_0x5565('0xfa')]=_0x56ad33;if(_[_0x5565('0xfb')](_0xaff99b)){_0x25ddc5[_0x5565('0xfc')](_0x1e14da,_0x228b0b,_0x313244,_0x56ad33)[_0x5565('0x7f')](function(_0x2b781b){logger[_0x5565('0x50')](_0x5565('0xfd'),_0x5565('0xfe')+_0x1e14da[_0x5565('0x69')]+_0x5565('0xff')+_0x1e14da[_0x5565('0x100')],JSON[_0x5565('0x52')](_0x2b781b));ami[_0x5565('0x26')](_0x5565('0x101'),ut[_0x5565('0xa1')](_0x1e14da,_0x5565('0x102'),_0x25ddc5['campaignsPreview'][_0x1e14da[_0x5565('0x69')]]));_0x25f4a0(ut[_0x5565('0x57')](_0x5565('0x103')));})[_0x5565('0x72')](function(_0x491017){ut[_0x5565('0x59')](_0x5565('0x104'),_0x491017);_0x5bb66c(ut['message'](_0x5565('0x105'),_0x588d21,_0x13764b));});}else{_0x228b0b[_0x5565('0x37')]+=0x1;ut[_0x5565('0x106')](_0x1e14da);rpcDb[_0x5565('0x107')](_0x1e14da,'[Blacklist][error]');delete _0x25ddc5[_0x5565('0x15')][_0x32def6];_0x5bb66c(ut[_0x5565('0x57')]('Contact\x20in\x20black\x20List',_0x588d21,_0x13764b));}});};Preview[_0x5565('0x5d')][_0x5565('0x98')]=function(_0x389a97){return!_[_0x5565('0x66')](_0x389a97)&&!_[_0x5565('0x66')](_0x389a97[_0x5565('0x28')])&&!_[_0x5565('0x66')](_0x389a97[_0x5565('0x4c')])&&_0x389a97['active']&&!_[_0x5565('0x66')](this[_0x5565('0x14')][util[_0x5565('0x53')](_0x5565('0x108'),_0x389a97[_0x5565('0x28')])])&&!_[_0x5565('0x66')](this[_0x5565('0x14')][util[_0x5565('0x53')](_0x5565('0x108'),_0x389a97[_0x5565('0x28')])][_0x5565('0x70')])&&(this[_0x5565('0x14')][util[_0x5565('0x53')](_0x5565('0x108'),_0x389a97[_0x5565('0x28')])]['status']==='reachable'||this[_0x5565('0x14')][util[_0x5565('0x53')](_0x5565('0x108'),_0x389a97[_0x5565('0x28')])][_0x5565('0x70')]===_0x5565('0x109'));};Preview['prototype'][_0x5565('0x10a')]=function(_0x274ad2,_0x5b3c04){var _0x33dfc1=this;return new BPromise(function(_0xecbd65,_0x178e05){_0x33dfc1[_0x5565('0x10b')](_0x274ad2,_0x5b3c04)[_0x5565('0x7f')](function(_0xd32387){_0xecbd65(_[_0x5565('0x10c')](_0xd32387,[_0x5565('0x57')]));})[_0x5565('0x72')](function(_0x25928b){if(_0x25928b[_0x5565('0x10d')]){rpcDb[_0x5565('0x10e')](_0x274ad2);}if(_0x25928b[_0x5565('0x4c')]){rpcDb['disableContact'](_0x274ad2);}_0x178e05(_[_0x5565('0x10c')](_0x25928b,['message']));});});};Preview[_0x5565('0x5d')][_0x5565('0x10b')]=function(_0xa107dd,_0x8c7c1d){var _0x191772=this;return new BPromise(function(_0x2502f9,_0x9bc0d3){var _0x1d1683,_0x496fc1;rpcDb[_0x5565('0x10f')](_0xa107dd)[_0x5565('0x7f')](function(_0x119782){if(!_[_0x5565('0x66')](_0x119782[0x0])){_0x496fc1=_0x119782[0x0][_0x5565('0x110')]?![]:!![];_0x1d1683=_0x119782[0x0][_0x5565('0x110')]?!![]:![];_0x1d1683=_0x8c7c1d?!![]:_0x1d1683;}var _0x2dfc59=_0x191772[_0x5565('0x111')](_0x119782);if(_0x2dfc59[_0x5565('0x112')]){rpcDb[_0x5565('0x113')](_[_0x5565('0x10c')](_0x119782[0x0],[_0x5565('0x6f'),_0x5565('0x114')]))[_0x5565('0x7f')](function(_0x5704ee){_0x191772[_0x5565('0xf6')](_0x5704ee,_0x119782[0x0],_0x8c7c1d,_0x496fc1,_0x1d1683)['then'](function(_0x1d149e){_0x2502f9(_0x1d149e);})[_0x5565('0x72')](function(_0x47b311){_0x9bc0d3(_0x47b311);});})['catch'](function(_0x48c77a){ut[_0x5565('0x59')]('[Preview][checkIsBlackList]',_0x48c77a);_0x9bc0d3(ut['message'](_0x5565('0x115'),_0x496fc1,_0x1d1683));});}else{_0x9bc0d3(ut[_0x5565('0x57')](_0x2dfc59[_0x5565('0x57')],_0x496fc1,_0x1d1683));}})[_0x5565('0x72')](function(_0x167580){ut[_0x5565('0x59')](_0x5565('0x116'),_0x167580);_0x9bc0d3(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview['prototype'][_0x5565('0x111')]=function(_0x456d63){if(_[_0x5565('0x66')](_0x456d63)||_[_0x5565('0xfb')](_0x456d63)||!_[_0x5565('0x66')](_0x456d63[0x0][_0x5565('0x84')])&&_[_0x5565('0x66')](_0x456d63[0x0][_0x5565('0x84')][_0x5565('0x28')])){ut[_0x5565('0x59')](_0x5565('0x117'),_0x456d63);return{'isValid':![],'message':_0x5565('0x118')};}var _0x5700ee=this[_0x5565('0x12')][_0x456d63[0x0][_0x5565('0x68')][_0x5565('0x28')]];_0x5700ee[_0x5565('0x57')]=_0x5565('0x9a');if(_[_0x5565('0x66')](_0x5700ee)){ut[_0x5565('0x59')](_0x5565('0x119'),_0x5700ee);return{'isValid':![],'message':_0x5565('0x11a')};}if(!this[_0x5565('0x98')](_0x5700ee[_0x5565('0x4b')])){ut[_0x5565('0x59')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x5565('0x11b')+_0x5700ee[_0x5565('0x28')]+_0x5565('0x11c'));if(!this['isTrunkReachable'](_0x5700ee[_0x5565('0x99')])){ut['logger'](_0x5565('0x11d'),_0x5700ee[_0x5565('0x28')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x5565('0x11e')};}}if(!ut[_0x5565('0x97')](_0x5700ee[_0x5565('0x31')])){ut[_0x5565('0x59')](_0x5565('0x11f'),_0x5700ee[_0x5565('0x28')]+_0x5565('0x120'));return{'isValid':![],'message':_0x5565('0x11b')+_0x5700ee[_0x5565('0x28')]+_0x5565('0x120')};}return{'isValid':!![],'message':_0x5565('0x121')};};Preview['prototype'][_0x5565('0xfc')]=function(_0x269af0,_0x31a448,_0x428a1d,_0x4ec859){var _0x488787=this;return new BPromise(function(_0x5c9ca1,_0x900282){var _0x3e0550=_0x269af0[_0x5565('0xae')];var _0x2161a2=_0x488787[_0x5565('0x98')](_0x31a448[_0x5565('0x4b')])?util['format'](_0x5565('0x122'),_0x31a448['Trunk'][_0x5565('0x28')],_['isNil'](_0x31a448[_0x5565('0x34')])?'':_0x31a448[_0x5565('0x34')][_0x5565('0x123')]()||'',_0x31a448[_0x5565('0x124')]>0x0?_0x428a1d[_0x5565('0xf7')][_0x5565('0xf8')][_0x5565('0x125')](_0x31a448[_0x5565('0x124')]):_0x428a1d[_0x5565('0xf7')][_0x5565('0xf8')]):util[_0x5565('0x53')](_0x5565('0x122'),_[_0x5565('0x66')](_0x31a448[_0x5565('0x99')])?_0x31a448['Trunk'][_0x5565('0x28')]:_0x31a448[_0x5565('0x99')]['name'],_[_0x5565('0x66')](_0x31a448[_0x5565('0x34')])?'':_0x31a448[_0x5565('0x34')][_0x5565('0x123')]()||'',_0x31a448[_0x5565('0x124')]>0x0?_0x428a1d['Contact'][_0x5565('0xf8')][_0x5565('0x125')](_0x31a448[_0x5565('0x124')]):_0x428a1d[_0x5565('0xf7')]['phone']);var _0x405df9=_0x488787[_0x5565('0x98')](_0x31a448[_0x5565('0x4b')])?ut['getCallerId'](_0x31a448[_0x5565('0x4b')][_0x5565('0x4d')],_0x31a448['dialOriginateCallerIdName'],_0x31a448[_0x5565('0x126')]>0x0?ut[_0x5565('0x127')](_0x31a448[_0x5565('0x33')],_0x31a448[_0x5565('0x126')]):_0x31a448['dialOriginateCallerIdNumber']):ut[_0x5565('0x128')](_[_0x5565('0x66')](_0x31a448[_0x5565('0x99')])?_0x31a448['Trunk'][_0x5565('0x4d')]:_0x31a448['TrunkBackup'][_0x5565('0x4d')],_0x31a448[_0x5565('0x129')],_0x31a448[_0x5565('0x126')]>0x0?ut[_0x5565('0x127')](_0x31a448['dialOriginateCallerIdNumber'],_0x31a448[_0x5565('0x126')]):_0x31a448[_0x5565('0x33')]);if(_0x405df9){_0x269af0[_0x5565('0x12a')]=ut[_0x5565('0x12b')](_0x405df9);_0x269af0[_0x5565('0x12c')]=ut[_0x5565('0x12d')](_0x405df9);}var _0x4bed05=ut[_0x5565('0x12e')](_0x31a448,_0x428a1d,_0x2161a2,_0x405df9,_0x3e0550,_0x269af0);_[_0x5565('0x12f')](_0x269af0,ut['toLowerVariables'](_0x4bed05));_0x269af0[_0x5565('0x88')]=moment()[_0x5565('0x53')](_0x5565('0x89'));ami[_0x5565('0x130')](ut[_0x5565('0x131')](_0x269af0,_0x31a448,_0x4bed05,_0x269af0[_0x5565('0xab')],_0x4ec859))[_0x5565('0x7f')](function(_0x2c1507){_0x31a448['originated']+=0x1;logger[_0x5565('0x50')]('[originated][increment]',_0x3e0550,_0x5565('0xaf'),_0x31a448['name'],_0x5565('0x6a'),_0x31a448[_0x5565('0x47')]);_0x5c9ca1(_0x2c1507);})[_0x5565('0x72')](function(_0x5f07de){ut['logAgent'](_0x269af0,0xe,'OriginateError');rpcDb[_0x5565('0xed')](_0x269af0,_0x5565('0x132'));_0x900282(_0x5f07de);});});};Preview[_0x5565('0x5d')][_0x5565('0x20')]=function(_0x5d96f2){if(this[_0x5565('0x15')][_0x5d96f2['linkedid']]){this[_0x5565('0x15')][_0x5d96f2[_0x5565('0xbe')]]['channel']=_0x5d96f2[_0x5565('0x71')];}};Preview[_0x5565('0x5d')][_0x5565('0x18')]=function(_0x254442){var _0x37a4cb=this;var _0x3549ad=this[_0x5565('0x15')][_0x254442[_0x5565('0x133')]];if(_0x3549ad){if(_0x3549ad[_0x5565('0xfa')]&&this[_0x5565('0x16')][_0x3549ad[_0x5565('0xfa')]]){ut[_0x5565('0x134')](_0x3549ad,this['agents'][_0x3549ad['lookAgent']][_0x5565('0x28')],this[_0x5565('0x16')][_0x3549ad[_0x5565('0xfa')]]['id']);}var _0x16c29d=_[_0x5565('0x135')](_0x3549ad);_0x16c29d['responsetime']=moment()[_0x5565('0x53')](_0x5565('0x89'));var _0x481460=_0x37a4cb[_0x5565('0x12')][_0x3549ad[_0x5565('0x69')]];if(ut[_0x5565('0x136')](_0x254442[_0x5565('0x137')])){if(_0x3549ad[_0x5565('0xc7')]){rpcDb[_0x5565('0x10e')](_0x3549ad[_0x5565('0x100')]);}if(_0x3549ad[_0x5565('0xab')]){rpcDb['disableContact'](_0x3549ad[_0x5565('0x100')]);}ami[_0x5565('0x26')](_0x5565('0x138'),ut[_0x5565('0xa1')](_0x3549ad,_0x5565('0x139'),this[_0x5565('0x12')][_0x3549ad[_0x5565('0x69')]]));this[_0x5565('0xeb')](_0x16c29d,_0x481460,_0x254442);}else{_0x3549ad[_0x5565('0x88')]=moment()[_0x5565('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x5565('0xec')](_0x16c29d,0x4,_0x5565('0xb7'));rpcDb[_0x5565('0xed')](_0x16c29d,_0x5565('0x13a'));}}};Preview[_0x5565('0x5d')]['syncHangup']=function(_0x49bc8f){var _0x4b565b=this;var _0x5085ee=this['actions'][_0x49bc8f[_0x5565('0xbe')]];var _0x16e264;if(_0x5085ee){_0x16e264=this['campaignsPreview'][_0x5085ee['queue']];logger['info']('[syncHangup][talking]',_0x49bc8f[_0x5565('0xbe')],_0x5565('0xaf'),_0x16e264[_0x5565('0x28')],_0x5565('0x6b'),_0x16e264[_0x5565('0x2b')]);}if(this[_0x5565('0x15')][_0x49bc8f['linkedid']]&&_0x49bc8f['linkedid']!==_0x49bc8f['uniqueid']){if(_0x49bc8f['cause']==='16'&&this[_0x5565('0x15')][_0x49bc8f[_0x5565('0xbe')]]['dialAnswer']){this[_0x5565('0x9b')](_0x49bc8f,_0x49bc8f[_0x5565('0xbe')],_0x49bc8f[_0x5565('0x13b')]);}else if(this['actions'][_0x49bc8f[_0x5565('0xbe')]][_0x5565('0x6c')]){logger['info'](_0x5565('0x13c'),_0x49bc8f[_0x5565('0xbe')],_0x49bc8f[_0x5565('0x13b')],_0x5565('0xaf'),_0x16e264['name'],'pTalking:\x20',_0x16e264[_0x5565('0x2b')]);this[_0x5565('0x9b')](_0x49bc8f,_0x49bc8f[_0x5565('0xbe')],_0x49bc8f[_0x5565('0x13b')]);}}else if(_0x5085ee&&_[_0x5565('0x66')](_0x5085ee[_0x5565('0x13d')])&&_0x16e264[_0x5565('0x13e')]&&_0x49bc8f[_0x5565('0xbe')]===_0x49bc8f[_0x5565('0xae')]&&_[_0x5565('0x66')](_0x49bc8f[_0x5565('0x13f')])&&_0x49bc8f[_0x5565('0x13b')]==='16'&&_0x49bc8f[_0x5565('0x140')]==='6'&&_['isUndefined'](_0x5085ee[_0x5565('0x141')])){if(_0x5085ee['unlockAgent']){rpcDb[_0x5565('0x10e')](_0x5085ee[_0x5565('0x100')]);}if(_0x5085ee[_0x5565('0xab')]){rpcDb[_0x5565('0x142')](_0x5085ee[_0x5565('0x100')]);}_0x49bc8f['reason']='22';this[_0x5565('0xeb')](_0x5085ee,_0x16e264,_0x49bc8f);}else if(_0x5085ee&&_0x5085ee[_0x5565('0x141')]){if(_0x49bc8f[_0x5565('0x13b')]==='16'&&this['actions'][_0x49bc8f[_0x5565('0xbe')]][_0x5565('0x6c')]){logger[_0x5565('0x50')](_0x5565('0x143'),_0x49bc8f[_0x5565('0xbe')],_0x49bc8f[_0x5565('0x13b')],_0x5565('0xaf'),_0x16e264[_0x5565('0x28')],_0x5565('0x6b'),_0x16e264[_0x5565('0x2b')]);this[_0x5565('0x9b')](_0x49bc8f,_0x49bc8f[_0x5565('0xbe')],_0x49bc8f[_0x5565('0x13b')]);}else if(this['actions'][_0x49bc8f[_0x5565('0xbe')]][_0x5565('0x6c')]){logger[_0x5565('0x50')](_0x5565('0x13c'),_0x49bc8f['linkedid'],_0x49bc8f[_0x5565('0x13b')],'\x20Queue',_0x16e264[_0x5565('0x28')],_0x5565('0x6b'),_0x16e264[_0x5565('0x2b')]);this[_0x5565('0x9b')](_0x49bc8f,_0x49bc8f[_0x5565('0xbe')],_0x49bc8f['cause']);}}};Preview[_0x5565('0x5d')][_0x5565('0x1f')]=function(_0x4450cb){if(this[_0x5565('0x15')][_0x4450cb[_0x5565('0xea')]]&&_0x4450cb[_0x5565('0xea')]!==_0x4450cb[_0x5565('0x144')]){this[_0x5565('0x9b')](_0x4450cb,_0x4450cb['destlinkedid'],_0x4450cb['dialstatus']);}};Preview[_0x5565('0x5d')][_0x5565('0x1d')]=function(_0x34c240){if(this[_0x5565('0x15')][_0x34c240[_0x5565('0xbe')]]&&_0x34c240[_0x5565('0xbe')]!==_0x34c240[_0x5565('0xae')]&&!this['actions'][_0x34c240['linkedid']]['dialAnswer']){if(_0x34c240[_0x5565('0x13b')]==='1'){this[_0x5565('0x9b')](_0x34c240,_0x34c240[_0x5565('0xbe')],_0x34c240[_0x5565('0x13b')]);}}};Preview['prototype']['addVariable']=function(_0x25362d,_0x1eeacf,_0x2c4eb6){if(this[_0x5565('0x15')][_0x25362d]){if(_['isNil'](this[_0x5565('0x15')][_0x25362d]['variables'])){this[_0x5565('0x15')][_0x25362d][_0x5565('0x145')]={};}this[_0x5565('0x15')][_0x25362d][_0x5565('0x145')][_0x1eeacf]=_0x2c4eb6;}};Preview[_0x5565('0x5d')][_0x5565('0x21')]=function(_0xeacf41){try{if(!_[_0x5565('0x66')](_0xeacf41)){if(ut[_0x5565('0x146')](_[_0x5565('0x147')](_0xeacf41[_0x5565('0x148')])[0x0])){this[_0x5565('0x149')](_0xeacf41[_0x5565('0xae')],_[_0x5565('0x147')](_0xeacf41['variable'])[0x0],_0xeacf41[_0x5565('0x14a')]);}}}catch(_0x53a45f){logger[_0x5565('0x14b')](_0x5565('0x14c'),util[_0x5565('0x14d')](_0x53a45f,{'showHidden':![],'depth':null}));}};Preview[_0x5565('0x5d')]['syncAttendedTransfer']=function(_0xd5d48e){if(_0xd5d48e){if(this['actions'][_0xd5d48e[_0x5565('0x14e')]]){this[_0x5565('0x15')][_0xd5d48e[_0x5565('0x14e')]][_0x5565('0x141')]=!![];}}};Preview[_0x5565('0x5d')][_0x5565('0x24')]=function(_0x384bd0){if(_0x384bd0){if(this[_0x5565('0x15')][_0x384bd0[_0x5565('0x14f')]]){this['actions'][_0x384bd0[_0x5565('0x14f')]][_0x5565('0x141')]=!![];}}};module[_0x5565('0x150')]=Preview; \ No newline at end of file +var _0xd916=['Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','syncNewExten','logLookAgent','isFailure','response','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','variables','syncVarSet','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','./rpcDb','./action','./util/util','redis','defaults','localhost','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','pTalking','sumBillable','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','originated','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','prototype','syncCampaigns','preview','booked','hasOwnProperty','dialActive','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','originated:\x20','pTalking:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','setMessage','sendMessageOneNotActive','loggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','totalGlobal','dialGlobalMaxRetry','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','buildAcw','complete','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','decrementTalkink','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','then','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Queue','[Preview][validateContact][Empty\x20Campaign]'];(function(_0xb862d5,_0x2270b0){var _0x28d11b=function(_0x4c964e){while(--_0x4c964e){_0xb862d5['push'](_0xb862d5['shift']());}};_0x28d11b(++_0x2270b0);}(_0xd916,0x18a));var _0x6d91=function(_0x3f03c5,_0x177741){_0x3f03c5=_0x3f03c5-0x0;var _0x2b5c24=_0xd916[_0x3f03c5];return _0x2b5c24;};'use strict';var util=require(_0x6d91('0x0'));var _=require(_0x6d91('0x1'));var BPromise=require(_0x6d91('0x2'));var uuid=require(_0x6d91('0x3'));var moment=require(_0x6d91('0x4'));var md5=require('md5');var Redis=require(_0x6d91('0x5'));var config=require(_0x6d91('0x6'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x6d91('0x7'))(_0x6d91('0x8'));var ami=require('../ami');var rpcDb=require(_0x6d91('0x9'));var Action=require(_0x6d91('0xa'));var ut=require(_0x6d91('0xb'));config[_0x6d91('0xc')]=_[_0x6d91('0xd')](config[_0x6d91('0xc')],{'host':_0x6d91('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0xab3051){this[_0x6d91('0xf')]=this[_0x6d91('0xf')]?this[_0x6d91('0xf')][_0x6d91('0x10')](_0xab3051):_0xab3051();};function Preview(_0x540ddd){this[_0x6d91('0x11')]=new Sequence();this[_0x6d91('0x12')]=_0x540ddd[_0x6d91('0x13')];this[_0x6d91('0x14')]=_0x540ddd[_0x6d91('0x14')];this[_0x6d91('0x15')]={};this[_0x6d91('0x16')]=_0x540ddd[_0x6d91('0x16')];this[_0x6d91('0x17')]=0x0;ami['on'](_0x6d91('0x18'),this[_0x6d91('0x19')][_0x6d91('0x1a')](this));ami['on'](_0x6d91('0x1b'),this[_0x6d91('0x1c')][_0x6d91('0x1a')](this));ami['on']('hanguprequest',this[_0x6d91('0x1d')][_0x6d91('0x1a')](this));ami['on'](_0x6d91('0x1e'),this[_0x6d91('0x1f')][_0x6d91('0x1a')](this));ami['on'](_0x6d91('0x20'),this['syncNewExten'][_0x6d91('0x1a')](this));ami['on']('varset',this['syncVarSet'][_0x6d91('0x1a')](this));ami['on']('attendedtransfer',this[_0x6d91('0x21')]['bind'](this));ami['on']('blindtransfer',this[_0x6d91('0x22')][_0x6d91('0x1a')](this));this[_0x6d91('0x23')](this['campaignsPreview']);}function emit(_0x36f8fd,_0x3b573d,_0x42e064){io['to'](_0x36f8fd)[_0x6d91('0x24')](_0x3b573d,_0x42e064);}function emitCampaignPreview(_0x1ad01b){if(_0x1ad01b[_0x6d91('0x25')]===_0x6d91('0x26')){var _0x351290={'id':_0x1ad01b['id'],'name':_0x1ad01b[_0x6d91('0x27')],'strategy':_0x1ad01b[_0x6d91('0x28')],'answered':_0x1ad01b[_0x6d91('0x29')],'available':_0x1ad01b[_0x6d91('0x2a')],'loggedIn':_0x1ad01b['loggedIn'],'pTalking':_0x1ad01b[_0x6d91('0x2b')],'sumBillable':_0x1ad01b[_0x6d91('0x2c')],'sumDuration':_0x1ad01b[_0x6d91('0x2d')],'sumHoldTime':_0x1ad01b['sumHoldTime']||0x0,'talking':_0x1ad01b[_0x6d91('0x2e')],'total':_0x1ad01b[_0x6d91('0x2f')],'type':_0x1ad01b['type'],'unmanaged':_0x1ad01b[_0x6d91('0x30')],'abandoned':_0x1ad01b[_0x6d91('0x31')],'waiting':_0x1ad01b[_0x6d91('0x32')],'loggedInDb':_0x1ad01b[_0x6d91('0x33')],'dialActive':_0x1ad01b['dialActive'],'dialMethod':_0x1ad01b[_0x6d91('0x34')],'dialOriginateCallerIdName':_0x1ad01b[_0x6d91('0x35')],'dialOriginateCallerIdNumber':_0x1ad01b[_0x6d91('0x36')],'dialOriginateTimeout':_0x1ad01b['dialOriginateTimeout'],'dialPrefix':_0x1ad01b[_0x6d91('0x37')],'outboundAnswerAgiCallsDay':_0x1ad01b[_0x6d91('0x38')],'outboundAnswerCallsDay':_0x1ad01b[_0x6d91('0x39')],'outboundBlacklistCallsDay':_0x1ad01b[_0x6d91('0x3a')],'outboundBusyCallsDay':_0x1ad01b['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1ad01b[_0x6d91('0x3b')],'outboundDropCallsDayACS':_0x1ad01b[_0x6d91('0x3c')],'outboundDropCallsDayCallersExit':_0x1ad01b[_0x6d91('0x3d')],'outboundDropCallsDayTimeout':_0x1ad01b['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x1ad01b[_0x6d91('0x3e')],'outboundNoSuchCallsDay':_0x1ad01b[_0x6d91('0x3f')],'outboundOriginateFailureCallsDay':_0x1ad01b['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x1ad01b[_0x6d91('0x40')],'outboundRejectCallsDay':_0x1ad01b['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1ad01b['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x1ad01b['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x1ad01b[_0x6d91('0x41')],'predictiveIntervalAvgHoldtime':_0x1ad01b[_0x6d91('0x42')],'predictiveIntervalAvgTalktime':_0x1ad01b[_0x6d91('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x1ad01b[_0x6d91('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x1ad01b[_0x6d91('0x45')],'predictiveIntervalErlangCalls':_0x1ad01b[_0x6d91('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x1ad01b[_0x6d91('0x47')],'predictiveIntervalHitRate':_0x1ad01b[_0x6d91('0x48')],'predictiveIntervalMultiplicativeFactor':_0x1ad01b[_0x6d91('0x49')],'predictiveIntervalPauses':_0x1ad01b['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x1ad01b[_0x6d91('0x4a')],'predictiveIntervalTotalCalls':_0x1ad01b[_0x6d91('0x4b')],'message':_0x1ad01b[_0x6d91('0x4c')],'originated':_0x1ad01b['originated'],'erlangCalls':_0x1ad01b[_0x6d91('0x4d')],'erlangCallToSecond':_0x1ad01b['erlangCallToSecond'],'erlangAbandonmentRate':_0x1ad01b[_0x6d91('0x4e')],'erlangBusyFactor':_0x1ad01b[_0x6d91('0x4f')],'startPredictive':_0x1ad01b[_0x6d91('0x50')],'startProgressive':_0x1ad01b[_0x6d91('0x51')]};if(_0x1ad01b[_0x6d91('0x52')]){_0x351290[_0x6d91('0x52')]={'id':_0x1ad01b[_0x6d91('0x52')]['id'],'name':_0x1ad01b['Trunk'][_0x6d91('0x27')],'active':_0x1ad01b['Trunk']['active'],'callerid':_0x1ad01b[_0x6d91('0x52')]['callerid']};}if(_0x1ad01b['Interval']){_0x351290['Interval']={'id':_0x1ad01b['Interval']['id'],'name':_0x1ad01b[_0x6d91('0x53')][_0x6d91('0x27')]};}var _0x3cd4be=md5(JSON['stringify'](_0x351290));if(_0x1ad01b[_0x6d91('0x54')]!==_0x3cd4be){_0x1ad01b[_0x6d91('0x54')]=_0x3cd4be;emit(util[_0x6d91('0x55')](_0x6d91('0x56'),_0x351290['name']),_0x6d91('0x57'),_0x351290);}}}function emitVoiceQueueChannelRemove(_0x54448b){logger[_0x6d91('0x58')](_0x6d91('0x59'),JSON[_0x6d91('0x5a')](_0x54448b));emit(util[_0x6d91('0x55')](_0x6d91('0x56'),_0x54448b['name']),_0x6d91('0x5b'),_0x54448b);this['emit']('voice_queue_presence:remove',_0x54448b);}function notSendMessagesQueue(_0x2cee96){if(_0x2cee96['sendMessageOneNotActive']){if(_0x2cee96[_0x6d91('0x5c')]===0x0&&_0x2cee96[_0x6d91('0x2b')]===0x0){_0x2cee96['sendMessageOneNotActive']=![];_0x2cee96[_0x6d91('0x2a')]=0x0;_0x2cee96['paused']=0x0;_0x2cee96[_0x6d91('0x4c')]=_0x6d91('0x5d');ut['logger'](_0x6d91('0x5e'),_0x2cee96['name']+_0x6d91('0x5f'));}else{_0x2cee96[_0x6d91('0x4c')]=_0x6d91('0x60');ut[_0x6d91('0x61')](_0x6d91('0x5e'),_0x2cee96[_0x6d91('0x27')]+'\x20is\x20disactive');}emitCampaignPreview(_0x2cee96);}}Preview[_0x6d91('0x62')][_0x6d91('0x23')]=function(){var _0x1fbd54=this;setInterval(function(){_0x1fbd54[_0x6d91('0x63')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x4b0e2b=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x2addcf in _0x4b0e2b){if(_0x4b0e2b['hasOwnProperty'](_0x2addcf)&&(_0x4b0e2b[_0x2addcf]['dialMethod']===_0x6d91('0x64')||_0x4b0e2b[_0x2addcf][_0x6d91('0x34')]===_0x6d91('0x65'))&&_0x4b0e2b[_0x2addcf][_0x6d91('0x25')]===_0x6d91('0x26')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x4b0e2b[_0x6d91('0x66')](_0x2addcf)&&_0x4b0e2b[_0x2addcf][_0x6d91('0x34')]===_0x6d91('0x64')&&_0x4b0e2b[_0x2addcf]['type']===_0x6d91('0x26')){if(_0x4b0e2b[_0x2addcf][_0x6d91('0x67')]){this['setMessage'](_0x4b0e2b[_0x2addcf]);this['recallMe'](_0x4b0e2b[_0x2addcf]);}else{notSendMessagesQueue(_0x4b0e2b[_0x2addcf]);}}}};Preview[_0x6d91('0x62')][_0x6d91('0x68')]=function(_0x40a63d){var _0x11067a=this;this[_0x6d91('0x11')][_0x6d91('0x69')](function(){if(!_[_0x6d91('0x6a')](_0x11067a['actions'][_0x40a63d])){loggerAction['info'](_0x6d91('0x6b'),_0x40a63d,'Queue',_0x11067a[_0x6d91('0x15')][_0x40a63d]['queue'],_0x6d91('0x6c'),JSON[_0x6d91('0x5a')](_0x11067a[_0x6d91('0x12')][_0x11067a[_0x6d91('0x15')][_0x40a63d]['queue']][_0x6d91('0x5c')]),_0x6d91('0x6d'),JSON[_0x6d91('0x5a')](_0x11067a[_0x6d91('0x12')][_0x11067a[_0x6d91('0x15')][_0x40a63d][_0x6d91('0x6e')]][_0x6d91('0x2b')]),JSON[_0x6d91('0x5a')](_0x11067a['actions'][_0x40a63d][_0x6d91('0x6f')]),JSON[_0x6d91('0x5a')](_[_0x6d91('0x70')](_0x11067a['actions'][_0x40a63d],[_0x6d91('0x71'),_0x6d91('0x72'),_0x6d91('0x73'),_0x6d91('0x74')])));return ami['Action']({'action':_0x6d91('0x75'),'channel':_0x11067a[_0x6d91('0x15')][_0x40a63d][_0x6d91('0x76')]})[_0x6d91('0x77')](function(_0x2edeef){if(_0x2edeef['message']===_0x6d91('0x78')){setTimeout(function(){if(_0x11067a[_0x6d91('0x15')][_0x40a63d]){ut[_0x6d91('0x79')](_0x11067a[_0x6d91('0x12')][_0x11067a[_0x6d91('0x15')][_0x40a63d][_0x6d91('0x6e')]],_0x6d91('0x7a'));if(_0x11067a[_0x6d91('0x15')][_0x40a63d][_0x6d91('0x6f')]===!![]){ut['decrementTalkink'](_0x11067a[_0x6d91('0x12')][_0x11067a[_0x6d91('0x15')][_0x40a63d][_0x6d91('0x6e')]],_0x6d91('0x7a'));ut[_0x6d91('0x7b')](_0x6d91('0x7c')+_0x40a63d,_0x11067a[_0x6d91('0x15')][_0x40a63d][_0x6d91('0x6e')]);}ut[_0x6d91('0x7b')](_0x6d91('0x7d')+_0x40a63d,_0x11067a[_0x6d91('0x15')][_0x40a63d][_0x6d91('0x6e')]);delete _0x11067a['actions'][_0x40a63d];}},0x2328);}});}});};Preview['prototype'][_0x6d91('0x7e')]=function(){var _0x4a8706=this;loggerAction[_0x6d91('0x58')](_0x6d91('0x7f'),_[_0x6d91('0x80')](this[_0x6d91('0x15')]));for(var _0x440c94 in this[_0x6d91('0x15')]){if(_0x4a8706[_0x6d91('0x15')][_0x6d91('0x66')](_0x440c94)){_0x4a8706[_0x6d91('0x68')](_0x440c94);}}};Preview[_0x6d91('0x62')]['recallMe']=function(_0x131605){var _0x3c3bdb=this;rpcDb[_0x6d91('0x81')](_0x131605['id'],ut[_0x6d91('0x82')](this['agents']))['then'](function(_0x129a4b){if(!_['isNil'](_0x129a4b)){for(var _0x1d8b81=0x0;_0x1d8b81<_0x129a4b[_0x6d91('0x83')];_0x1d8b81+=0x1){if(ut[_0x6d91('0x84')](_0x129a4b[_0x1d8b81]['scheduledat'])<_0x131605[_0x6d91('0x85')]*0x3c){if(_0x129a4b[_0x1d8b81]['Agent']&&!_0x129a4b[_0x1d8b81][_0x6d91('0x86')][_0x6d91('0x87')]){_0x3c3bdb[_0x6d91('0x88')](_0x129a4b[_0x1d8b81]['id'])['then'](ut[_0x6d91('0x89')](_0x6d91('0x8a')))[_0x6d91('0x77')](ut[_0x6d91('0x89')](_0x6d91('0x8a')));}else{rpcDb[_0x6d91('0x8b')](_0x129a4b[_0x1d8b81]['id']);}}else{var _0x50b3d6=new Action(_0x129a4b[_0x1d8b81],_0x131605);_0x50b3d6[_0x6d91('0x8c')]=moment()[_0x6d91('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x131605[_0x6d91('0x40')]+=0x1;ut[_0x6d91('0x8d')](_0x50b3d6,0x17,_0x6d91('0x8e'));if(_0x131605[_0x6d91('0x8f')]){rpcDb['rescheduleContactInQueue'](ut[_0x6d91('0x90')](_0x129a4b[_0x1d8b81]));rpcDb[_0x6d91('0x91')](_0x50b3d6,_0x6d91('0x92'));}else{ut[_0x6d91('0x8d')](_0x50b3d6,0x16,'RecallFailedTimeout');rpcDb[_0x6d91('0x91')](_0x50b3d6,'[HistoryRecallClose]');rpcDb[_0x6d91('0x93')](_0x50b3d6,_0x6d91('0x94'));}}}}})[_0x6d91('0x77')](ut[_0x6d91('0x89')]('[getContactRecallMe]'));};Preview[_0x6d91('0x62')][_0x6d91('0x95')]=function(_0x4a8442){_0x4a8442[_0x6d91('0x96')]=!![];if(ut['IsNotLoggedIn'](_0x4a8442[_0x6d91('0x97')])){_0x4a8442[_0x6d91('0x4c')]=_0x6d91('0x98');}else if(!ut['isActive'](_0x4a8442['dialActive'])){_0x4a8442[_0x6d91('0x4c')]=_0x6d91('0x5d');}else if(!this[_0x6d91('0x99')](_0x4a8442[_0x6d91('0x52')])){if(!this[_0x6d91('0x99')](_0x4a8442[_0x6d91('0x9a')])){_0x4a8442[_0x6d91('0x4c')]=_0x6d91('0x9b');}else{_0x4a8442[_0x6d91('0x4c')]=_0x6d91('0x9c');}}else{_0x4a8442[_0x6d91('0x4c')]='ACTIVE';}emitCampaignPreview(_0x4a8442);};Preview[_0x6d91('0x62')][_0x6d91('0x9d')]=function(_0x4d0fc2,_0xf8df64,_0x718642){var _0x47a5c2=this;var _0x2fb071=this[_0x6d91('0x15')][_0xf8df64];var _0x3a91c8=this[_0x6d91('0x12')][_0x2fb071[_0x6d91('0x6e')]];var _0x1ace79;if(_0x3a91c8){switch(_0x718642){case'1':_0x3a91c8['outboundNoSuchCallsDay']+=0x1;_0x2fb071[_0x6d91('0x9e')]+=0x1;_0x2fb071['countglobal']=ut['totalGlobal'](_0x2fb071);ut[_0x6d91('0x8d')](_0x2fb071,0x0,_0x6d91('0x9f'));ami[_0x6d91('0x24')](_0x6d91('0xa0'),ut[_0x6d91('0xa1')](_0x2fb071,_0x6d91('0xa2')));rpcDb[_0x6d91('0x91')](_0x2fb071,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x6d91('0xa3')](_0x2fb071)>=_0x3a91c8[_0x6d91('0xa4')]){_0x1ace79=ut['cloneAction'](_0x2fb071,0xf,_0x6d91('0xa5'));rpcDb['createCustomerFinal'](_0x1ace79,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x2fb071['countnosuchnumberretry']>=_0x3a91c8[_0x6d91('0xa6')]){rpcDb[_0x6d91('0x93')](_0x2fb071,_0x6d91('0xa7'));}else{rpcDb[_0x6d91('0xa8')](ut['scheduledAt'](_0x2fb071,_0x6d91('0x9e'),_0x3a91c8[_0x6d91('0xa9')]),_0x2fb071[_0x6d91('0xaa')],_0x2fb071[_0x6d91('0xab')]);}}delete this['actions'][_0x4d0fc2[_0x6d91('0xac')]];break;case _0x6d91('0xad'):var _0x25dca1=moment()[_0x6d91('0x55')](_0x6d91('0xae'));_0x2fb071['responsetime']=_0x25dca1;_0x2fb071[_0x6d91('0xaf')]=_0x25dca1;_0x2fb071[_0x6d91('0x6f')]=!![];_0x3a91c8[_0x6d91('0x2b')]+=0x1;logger[_0x6d91('0x58')](_0x6d91('0xb0'),_0x2fb071['uniqueid'],_0x6d91('0xb1'),_0x3a91c8[_0x6d91('0x27')],_0x6d91('0x6d'),_0x3a91c8[_0x6d91('0x2b')]);ami['emit'](_0x6d91('0xb2'),ut[_0x6d91('0xa1')](_0x2fb071,'connect',this[_0x6d91('0x12')][_0x2fb071['queue']]));if(_0x3a91c8['acw']){ami['emit']('custom:agentConnectPreview',ut[_0x6d91('0xb3')](_0x2fb071));}break;case'16':ami[_0x6d91('0x24')]('custom:agentcomplete',ut['buildObj'](_0x2fb071,_0x6d91('0xb4'),this[_0x6d91('0x12')][_0x2fb071[_0x6d91('0x6e')]]));emitVoiceQueueChannelRemove(ut[_0x6d91('0xa1')](_0x2fb071,_0x6d91('0xb4')));_0x3a91c8[_0x6d91('0x39')]+=0x1;_0x3a91c8['total']+=0x1;_0x3a91c8['answered']+=0x1;ut['decrementTalkink'](_0x3a91c8,'[16]');_0x2fb071[_0x6d91('0xb5')]=ut[_0x6d91('0xa3')](_0x2fb071);ut[_0x6d91('0x8d')](_0x2fb071,0x4,_0x6d91('0xb6'));rpcDb[_0x6d91('0x91')](_0x2fb071,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x6d91('0x93')](_0x2fb071,_0x6d91('0xb7'));rpcDb[_0x6d91('0xb8')](_0x2fb071);_0x3a91c8[_0x6d91('0x2d')]+=_0x2fb071[_0x6d91('0xb9')];_0x3a91c8['sumBillable']+=_0x2fb071[_0x6d91('0xb9')];logger[_0x6d91('0x58')](_0x6d91('0xba'),_0x2fb071[_0x6d91('0xbb')],_0x6d91('0xb1'),_0x3a91c8['name'],_0x6d91('0x6d'),_0x3a91c8['pTalking']);delete this[_0x6d91('0x15')][_0x4d0fc2[_0x6d91('0xac')]];break;case'BUSY':_0x3a91c8[_0x6d91('0xbc')]+=0x1;_0x2fb071[_0x6d91('0xbd')]+=0x1;_0x2fb071[_0x6d91('0xb5')]=ut[_0x6d91('0xa3')](_0x2fb071);ut[_0x6d91('0x8d')](_0x2fb071,0x5,_0x6d91('0xbe'));ami[_0x6d91('0x24')](_0x6d91('0xbf'),ut[_0x6d91('0xa1')](_0x2fb071,_0x6d91('0xc0')));rpcDb['createCustomerHistory'](_0x2fb071,_0x6d91('0xc1'));if(ut[_0x6d91('0xa3')](_0x2fb071)>=_0x3a91c8[_0x6d91('0xa4')]){_0x1ace79=ut[_0x6d91('0xc2')](_0x2fb071,0xf,_0x6d91('0xa5'));rpcDb[_0x6d91('0x93')](_0x1ace79,_0x6d91('0xc3'));}else{if(_0x2fb071[_0x6d91('0xbd')]>=_0x3a91c8[_0x6d91('0xc4')]){rpcDb['createCustomerFinal'](_0x2fb071,_0x6d91('0xc1'));}else{rpcDb[_0x6d91('0xa8')](ut[_0x6d91('0xc5')](_0x2fb071,_0x6d91('0xbd'),_0x3a91c8['dialBusyRetryFrequency']),_0x2fb071[_0x6d91('0xaa')],_0x2fb071[_0x6d91('0xab')]);}}break;case _0x6d91('0xc6'):_0x3a91c8[_0x6d91('0x3e')]+=0x1;_0x2fb071['countnoanswerretry']+=0x1;_0x2fb071[_0x6d91('0xb5')]=ut[_0x6d91('0xa3')](_0x2fb071);ut[_0x6d91('0x8d')](_0x2fb071,0x3,_0x6d91('0xc7'));ami['emit'](_0x6d91('0xc8'),ut[_0x6d91('0xa1')](_0x2fb071,_0x6d91('0xc9')));rpcDb[_0x6d91('0x91')](_0x2fb071,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x6d91('0xa3')](_0x2fb071)>=_0x3a91c8['dialGlobalMaxRetry']){_0x1ace79=ut[_0x6d91('0xc2')](_0x2fb071,0xf,_0x6d91('0xa5'));rpcDb[_0x6d91('0x93')](_0x1ace79,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x2fb071[_0x6d91('0xca')]>=_0x3a91c8[_0x6d91('0xcb')]){rpcDb[_0x6d91('0x93')](_0x2fb071,_0x6d91('0xcc'));}else{rpcDb[_0x6d91('0xa8')](ut['scheduledAt'](_0x2fb071,_0x6d91('0xca'),_0x3a91c8[_0x6d91('0xcd')]),_0x2fb071[_0x6d91('0xaa')],_0x2fb071[_0x6d91('0xab')]);}}break;case'CONGESTION':_0x3a91c8[_0x6d91('0x3b')]+=0x1;_0x2fb071[_0x6d91('0xce')]+=0x1;_0x2fb071[_0x6d91('0xb5')]=ut[_0x6d91('0xa3')](_0x2fb071);ut[_0x6d91('0x8d')](_0x2fb071,0x8,_0x6d91('0xcf'));ami[_0x6d91('0x24')](_0x6d91('0xd0'),ut['buildObj'](_0x2fb071,_0x6d91('0xd1')));rpcDb[_0x6d91('0x91')](_0x2fb071,_0x6d91('0xd2'));if(ut[_0x6d91('0xa3')](_0x2fb071)>=_0x3a91c8[_0x6d91('0xa4')]){_0x1ace79=ut['cloneAction'](_0x2fb071,0xf,'Global');rpcDb[_0x6d91('0x93')](_0x1ace79,_0x6d91('0xd3'));}else{if(_0x2fb071[_0x6d91('0xce')]>=_0x3a91c8[_0x6d91('0xd4')]){rpcDb[_0x6d91('0x93')](_0x2fb071,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x6d91('0xa8')](ut[_0x6d91('0xc5')](_0x2fb071,_0x6d91('0xce'),_0x3a91c8[_0x6d91('0xd5')]),_0x2fb071[_0x6d91('0xaa')],_0x2fb071['activeContact']);}}break;case'CANCEL':_0x3a91c8[_0x6d91('0xd6')]+=0x1;_0x2fb071[_0x6d91('0xd7')]+=0x1;_0x2fb071[_0x6d91('0xb5')]=ut['totalGlobal'](_0x2fb071);ut[_0x6d91('0x8d')](_0x2fb071,0x14,_0x6d91('0xd8'));ami[_0x6d91('0x24')](_0x6d91('0xd9'),ut[_0x6d91('0xa1')](_0x2fb071,_0x6d91('0xda')));rpcDb[_0x6d91('0x91')](_0x2fb071,_0x6d91('0xdb'));if(ut[_0x6d91('0xa3')](_0x2fb071)>=_0x3a91c8[_0x6d91('0xa4')]){_0x1ace79=ut[_0x6d91('0xc2')](_0x2fb071,0x14,_0x6d91('0xd8'));rpcDb['createCustomerFinal'](_0x1ace79,_0x6d91('0xdc'));}else{if(_0x2fb071[_0x6d91('0xd7')]>=_0x3a91c8[_0x6d91('0xdd')]){rpcDb[_0x6d91('0x93')](_0x2fb071,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x6d91('0xc5')](_0x2fb071,'countagentrejectretry',_0x3a91c8[_0x6d91('0xde')]),_0x2fb071[_0x6d91('0xaa')],_0x2fb071[_0x6d91('0xab')]);}}break;case'ABANDONED':_0x3a91c8['outboundAbandonedCallsDay']+=0x1;_0x2fb071['countabandonedretry']+=0x1;_0x2fb071[_0x6d91('0xb5')]=ut[_0x6d91('0xa3')](_0x2fb071);ut[_0x6d91('0x8d')](_0x2fb071,0xb,_0x6d91('0xdf'));rpcDb[_0x6d91('0x91')](_0x2fb071,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x6d91('0xa3')](_0x2fb071)>=_0x3a91c8['dialGlobalMaxRetry']){_0x1ace79=ut[_0x6d91('0xc2')](_0x2fb071,0xf,_0x6d91('0xa5'));rpcDb[_0x6d91('0x93')](_0x1ace79,_0x6d91('0xe0'));}else{if(_0x2fb071[_0x6d91('0xe1')]>=_0x3a91c8[_0x6d91('0xe2')]){rpcDb[_0x6d91('0x93')](_0x2fb071,_0x6d91('0xe0'));}else{rpcDb[_0x6d91('0xa8')](ut[_0x6d91('0xc5')](_0x2fb071,_0x6d91('0xe3'),_0x3a91c8[_0x6d91('0xe4')]),_0x2fb071[_0x6d91('0xaa')],_0x2fb071[_0x6d91('0xab')]);}}break;default:if(_0x2fb071[_0x6d91('0x6f')]){ut[_0x6d91('0xe5')](_0x3a91c8,_0x6d91('0xe6'));ut[_0x6d91('0x7b')](_0x6d91('0xe7')+_0x3a91c8[_0x6d91('0x27')],_0x4d0fc2);}_0x3a91c8[_0x6d91('0xe8')]+=0x1;_0x2fb071[_0x6d91('0xb5')]=ut[_0x6d91('0xa3')](_0x2fb071);ut[_0x6d91('0x8d')](_0x2fb071,0xc,_0x4d0fc2[_0x6d91('0xe9')]||_0x4d0fc2['dialstatus']);rpcDb[_0x6d91('0x91')](_0x2fb071,_0x6d91('0xea'));if(ut[_0x6d91('0xa3')](_0x2fb071)>=_0x3a91c8[_0x6d91('0xa4')]){_0x1ace79=ut['cloneAction'](_0x2fb071,0xf,_0x6d91('0xa5'));rpcDb[_0x6d91('0x93')](_0x1ace79,_0x6d91('0xeb'));}else{rpcDb['createCustomerFinal'](_0x2fb071,_0x6d91('0xeb'));}delete this['actions'][_0x4d0fc2['linkedid']];}if(!(_0x2fb071[_0x6d91('0x6f')]&&_0x718642==='16')){ut[_0x6d91('0x79')](_0x3a91c8,_0x6d91('0xec'));logger['info'](_0x6d91('0xed'),_0x2fb071['uniqueid'],_0x6d91('0xb1'),_0x3a91c8[_0x6d91('0x27')],_0x6d91('0x6c'),_0x3a91c8['originated']);}if(_0x718642!==_0x6d91('0xad')){delete this['actions'][_0x4d0fc2[_0x6d91('0xac')]];delete this[_0x6d91('0x15')][_0x4d0fc2[_0x6d91('0xee')]];}}};Preview[_0x6d91('0x62')]['callProgressDetectingAgent']=function(_0x4fa106,_0x53019b,_0x4da1a2){if(_[_0x6d91('0xef')](_0x53019b)&&_0x6d91('0xf0')!==typeof _0x53019b){return;}if(_['isUndefined'](_0x4da1a2)&&_0x6d91('0xf0')!==typeof _0x4da1a2){return;}switch(_0x4da1a2['reason']){case'0':ut['logAgent'](_0x4fa106,0x0,'NoSuchNumber');rpcDb[_0x6d91('0xf1')](_0x4fa106,_0x6d91('0xf2'));break;case'3':ut[_0x6d91('0xf3')](_0x4fa106,0x3,_0x6d91('0xc7'));rpcDb[_0x6d91('0xf1')](_0x4fa106,_0x6d91('0xf4'));break;case'5':ut[_0x6d91('0xf3')](_0x4fa106,0x5,_0x6d91('0xbe'));rpcDb[_0x6d91('0xf1')](_0x4fa106,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x4fa106,0x8,_0x6d91('0xcf'));rpcDb[_0x6d91('0xf1')](_0x4fa106,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x6d91('0xf3')](_0x4fa106,0x16,_0x6d91('0xf5'));rpcDb[_0x6d91('0xf1')](_0x4fa106,_0x6d91('0xf6'));break;default:ut['logAgent'](_0x4fa106,0xc,_0x4da1a2[_0x6d91('0xf7')]);rpcDb[_0x6d91('0xf1')](_0x4fa106,_0x6d91('0xf8'));}ut[_0x6d91('0x79')](_0x53019b,'[callProgressDetectingAgent]');logger[_0x6d91('0x58')](_0x6d91('0xf9'),_0x4fa106['uniqueid'],_0x6d91('0xb1'),_0x53019b[_0x6d91('0x27')],_0x6d91('0x6c'),_0x53019b[_0x6d91('0x5c')]);delete this[_0x6d91('0x15')][_0x4fa106[_0x6d91('0xbb')]];};Preview['prototype'][_0x6d91('0xfa')]=function(_0x1bd205,_0x1a713f,_0x2248de,_0x34798,_0x25ab15){var _0x516722=this;return new BPromise(function(_0x1c3841,_0x7d6613){if(_[_0x6d91('0x6a')](_0x1a713f)||_[_0x6d91('0x6a')](_0x1a713f[_0x6d91('0xfb')])||_[_0x6d91('0x6a')](_0x1a713f[_0x6d91('0xfb')][_0x6d91('0xfc')])||_[_0x6d91('0x6a')](_0x1a713f[_0x6d91('0x73')])){_0x7d6613(ut['message'](_0x6d91('0xfd'),_0x34798,_0x25ab15));return;}var _0x40734c=uuid['v4']();var _0x5621ab=_0x516722[_0x6d91('0x12')][_0x1a713f['Queue']['name']];var _0x1e2103=_0x2248de?_0x516722[_0x6d91('0x16')][_0x2248de]['id']:undefined;_0x516722[_0x6d91('0x15')][_0x40734c]=new Action(_0x1a713f,_0x5621ab,_0x40734c,_0x2248de,_0x1e2103);var _0xb54dcb=_0x516722['actions'][_0x40734c];_0xb54dcb[_0x6d91('0xaa')]=_0x34798;_0xb54dcb[_0x6d91('0xab')]=_0x25ab15;_0xb54dcb[_0x6d91('0xfe')]=_0x2248de;if(_[_0x6d91('0xff')](_0x1bd205)){_0x516722['execCall'](_0xb54dcb,_0x5621ab,_0x1a713f,_0x2248de)['then'](function(_0x4d178d){logger[_0x6d91('0x58')](_0x6d91('0x100'),'Queue:\x20'+_0xb54dcb[_0x6d91('0x6e')]+_0x6d91('0x101')+_0xb54dcb[_0x6d91('0x102')],JSON['stringify'](_0x4d178d));ami[_0x6d91('0x24')](_0x6d91('0x103'),ut[_0x6d91('0xa1')](_0xb54dcb,_0x6d91('0x104'),_0x516722[_0x6d91('0x12')][_0xb54dcb[_0x6d91('0x6e')]]));_0x1c3841(ut['message'](_0x6d91('0x105')));})[_0x6d91('0x77')](function(_0x2e539f){ut[_0x6d91('0x61')](_0x6d91('0x106'),_0x2e539f);_0x7d6613(ut[_0x6d91('0x4c')](_0x6d91('0x107'),_0x34798,_0x25ab15));});}else{_0x5621ab[_0x6d91('0x3a')]+=0x1;ut['logBlacklist'](_0xb54dcb);rpcDb[_0x6d91('0x108')](_0xb54dcb,'[Blacklist][error]');delete _0x516722[_0x6d91('0x15')][_0x40734c];_0x7d6613(ut['message'](_0x6d91('0x109'),_0x34798,_0x25ab15));}});};Preview[_0x6d91('0x62')][_0x6d91('0x99')]=function(_0x2e194c){return!_[_0x6d91('0x6a')](_0x2e194c)&&!_[_0x6d91('0x6a')](_0x2e194c[_0x6d91('0x27')])&&!_[_0x6d91('0x6a')](_0x2e194c[_0x6d91('0x10a')])&&_0x2e194c['active']&&!_['isNil'](this['trunks'][util['format'](_0x6d91('0x10b'),_0x2e194c['name'])])&&!_[_0x6d91('0x6a')](this[_0x6d91('0x14')][util[_0x6d91('0x55')](_0x6d91('0x10b'),_0x2e194c[_0x6d91('0x27')])][_0x6d91('0x75')])&&(this[_0x6d91('0x14')][util['format'](_0x6d91('0x10b'),_0x2e194c[_0x6d91('0x27')])][_0x6d91('0x75')]===_0x6d91('0x10c')||this['trunks'][util['format'](_0x6d91('0x10b'),_0x2e194c['name'])]['status']===_0x6d91('0x10d'));};Preview[_0x6d91('0x62')][_0x6d91('0x88')]=function(_0x30b177,_0x586eb9){var _0x39c491=this;return new BPromise(function(_0x2362f5,_0x5edb7d){_0x39c491[_0x6d91('0x10e')](_0x30b177,_0x586eb9)[_0x6d91('0x10f')](function(_0x4242c4){_0x2362f5(_[_0x6d91('0x70')](_0x4242c4,[_0x6d91('0x4c')]));})[_0x6d91('0x77')](function(_0x24ce0a){if(_0x24ce0a[_0x6d91('0x110')]){rpcDb[_0x6d91('0x111')](_0x30b177);}if(_0x24ce0a[_0x6d91('0x10a')]){rpcDb[_0x6d91('0x8b')](_0x30b177);}_0x5edb7d(_['pick'](_0x24ce0a,[_0x6d91('0x4c')]));});});};Preview[_0x6d91('0x62')][_0x6d91('0x10e')]=function(_0x6fa95b,_0x37222b){var _0x5a1ffd=this;return new BPromise(function(_0x4ee5f8,_0x328b6a){var _0x332c56,_0x4d90f7;rpcDb[_0x6d91('0x112')](_0x6fa95b)[_0x6d91('0x10f')](function(_0x40c1bd){if(!_['isNil'](_0x40c1bd[0x0])){_0x4d90f7=_0x40c1bd[0x0][_0x6d91('0x113')]?![]:!![];_0x332c56=_0x40c1bd[0x0]['recallme']?!![]:![];_0x332c56=_0x37222b?!![]:_0x332c56;}var _0x35d575=_0x5a1ffd[_0x6d91('0x114')](_0x40c1bd);if(_0x35d575[_0x6d91('0x115')]){rpcDb['checkIsBlackList'](_[_0x6d91('0x70')](_0x40c1bd[0x0],['VoiceQueueId',_0x6d91('0x116')]))['then'](function(_0x902802){_0x5a1ffd[_0x6d91('0xfa')](_0x902802,_0x40c1bd[0x0],_0x37222b,_0x4d90f7,_0x332c56)[_0x6d91('0x10f')](function(_0x9aa84f){_0x4ee5f8(_0x9aa84f);})['catch'](function(_0x2f4688){_0x328b6a(_0x2f4688);});})['catch'](function(_0x21a55b){ut[_0x6d91('0x61')](_0x6d91('0x117'),_0x21a55b);_0x328b6a(ut['message'](_0x6d91('0x118'),_0x4d90f7,_0x332c56));});}else{_0x328b6a(ut[_0x6d91('0x4c')](_0x35d575[_0x6d91('0x4c')],_0x4d90f7,_0x332c56));}})[_0x6d91('0x77')](function(_0x47c4ad){ut[_0x6d91('0x61')](_0x6d91('0x119'),_0x47c4ad);_0x328b6a(ut[_0x6d91('0x4c')](_0x6d91('0x118'),![],!![]));});});};Preview[_0x6d91('0x62')][_0x6d91('0x114')]=function(_0x371a0c){if(_['isNil'](_0x371a0c)||_[_0x6d91('0xff')](_0x371a0c)||!_['isNil'](_0x371a0c[0x0][_0x6d91('0x86')])&&_[_0x6d91('0x6a')](_0x371a0c[0x0][_0x6d91('0x86')][_0x6d91('0x27')])){ut['logger'](_0x6d91('0x11a'),_0x371a0c);return{'isValid':![],'message':_0x6d91('0x11b')};}var _0x5b6cee=this[_0x6d91('0x12')][_0x371a0c[0x0][_0x6d91('0x11c')][_0x6d91('0x27')]];_0x5b6cee[_0x6d91('0x4c')]=_0x6d91('0x9c');if(_[_0x6d91('0x6a')](_0x5b6cee)){ut[_0x6d91('0x61')](_0x6d91('0x11d'),_0x5b6cee);return{'isValid':![],'message':_0x6d91('0x11e')};}if(!this[_0x6d91('0x99')](_0x5b6cee[_0x6d91('0x52')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x6d91('0x11f')+_0x5b6cee[_0x6d91('0x27')]+_0x6d91('0x120'));if(!this[_0x6d91('0x99')](_0x5b6cee['TrunkBackup'])){ut['logger'](_0x6d91('0x121'),_0x5b6cee[_0x6d91('0x27')]+_0x6d91('0x122'));return{'isValid':![],'message':_0x6d91('0x123')};}}if(!ut[_0x6d91('0x124')](_0x5b6cee[_0x6d91('0x67')])){ut[_0x6d91('0x61')](_0x6d91('0x125'),_0x5b6cee[_0x6d91('0x27')]+_0x6d91('0x126'));return{'isValid':![],'message':_0x6d91('0x11f')+_0x5b6cee['name']+_0x6d91('0x126')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x6d91('0x62')][_0x6d91('0x127')]=function(_0x4852e4,_0x17b869,_0x35a730,_0x49943d){var _0x2269e3=this;return new BPromise(function(_0x423dbc,_0x4aa4d0){var _0x5314b4=_0x4852e4[_0x6d91('0xbb')];var _0x492db8=_0x2269e3['isTrunkReachable'](_0x17b869['Trunk'])?util[_0x6d91('0x55')](_0x6d91('0x128'),_0x17b869[_0x6d91('0x52')][_0x6d91('0x27')],_[_0x6d91('0x6a')](_0x17b869['dialPrefix'])?'':_0x17b869['dialPrefix'][_0x6d91('0x129')]()||'',_0x17b869[_0x6d91('0x12a')]>0x0?_0x35a730[_0x6d91('0xfb')][_0x6d91('0xfc')][_0x6d91('0x12b')](_0x17b869['dialCutDigit']):_0x35a730[_0x6d91('0xfb')][_0x6d91('0xfc')]):util[_0x6d91('0x55')](_0x6d91('0x128'),_[_0x6d91('0x6a')](_0x17b869['TrunkBackup'])?_0x17b869[_0x6d91('0x52')][_0x6d91('0x27')]:_0x17b869[_0x6d91('0x9a')][_0x6d91('0x27')],_[_0x6d91('0x6a')](_0x17b869['dialPrefix'])?'':_0x17b869[_0x6d91('0x37')][_0x6d91('0x129')]()||'',_0x17b869['dialCutDigit']>0x0?_0x35a730[_0x6d91('0xfb')][_0x6d91('0xfc')]['substring'](_0x17b869[_0x6d91('0x12a')]):_0x35a730[_0x6d91('0xfb')][_0x6d91('0xfc')]);var _0x391f46=_0x2269e3['isTrunkReachable'](_0x17b869[_0x6d91('0x52')])?ut[_0x6d91('0x12c')](_0x17b869[_0x6d91('0x52')][_0x6d91('0x12d')],_0x17b869[_0x6d91('0x35')],_0x17b869['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x17b869[_0x6d91('0x36')],_0x17b869[_0x6d91('0x12e')]):_0x17b869[_0x6d91('0x36')]):ut[_0x6d91('0x12c')](_[_0x6d91('0x6a')](_0x17b869[_0x6d91('0x9a')])?_0x17b869[_0x6d91('0x52')][_0x6d91('0x12d')]:_0x17b869[_0x6d91('0x9a')][_0x6d91('0x12d')],_0x17b869[_0x6d91('0x35')],_0x17b869[_0x6d91('0x12e')]>0x0?ut[_0x6d91('0x12f')](_0x17b869[_0x6d91('0x36')],_0x17b869[_0x6d91('0x12e')]):_0x17b869[_0x6d91('0x36')]);if(_0x391f46){_0x4852e4[_0x6d91('0x130')]=ut[_0x6d91('0x131')](_0x391f46);_0x4852e4[_0x6d91('0x132')]=ut[_0x6d91('0x133')](_0x391f46);}var _0x5af4f0=ut[_0x6d91('0x134')](_0x17b869,_0x35a730,_0x492db8,_0x391f46,_0x5314b4,_0x4852e4);_[_0x6d91('0x135')](_0x4852e4,ut[_0x6d91('0x136')](_0x5af4f0));_0x4852e4['starttime']=moment()[_0x6d91('0x55')]('YYYY-MM-DD\x20HH:mm:ss');ami['Action'](ut[_0x6d91('0x137')](_0x4852e4,_0x17b869,_0x5af4f0,_0x4852e4[_0x6d91('0xab')],_0x49943d))[_0x6d91('0x10f')](function(_0x37416b){_0x17b869[_0x6d91('0x5c')]+=0x1;logger[_0x6d91('0x58')](_0x6d91('0x138'),_0x5314b4,_0x6d91('0xb1'),_0x17b869[_0x6d91('0x27')],'originated:\x20',_0x17b869[_0x6d91('0x5c')]);_0x423dbc(_0x37416b);})['catch'](function(_0x4d64bd){ut[_0x6d91('0xf3')](_0x4852e4,0xe,_0x6d91('0x139'));rpcDb[_0x6d91('0xf1')](_0x4852e4,'[originateFailure][logOriginateFailure]');_0x4aa4d0(_0x4d64bd);});});};Preview[_0x6d91('0x62')][_0x6d91('0x13a')]=function(_0x4681d6){if(this['actions'][_0x4681d6[_0x6d91('0xac')]]){this[_0x6d91('0x15')][_0x4681d6[_0x6d91('0xac')]][_0x6d91('0x76')]=_0x4681d6[_0x6d91('0x76')];}};Preview['prototype'][_0x6d91('0x19')]=function(_0x125368){var _0x3e3189=this;var _0x3aecc6=this[_0x6d91('0x15')][_0x125368['actionid']];if(_0x3aecc6){if(_0x3aecc6[_0x6d91('0xfe')]&&this[_0x6d91('0x16')][_0x3aecc6[_0x6d91('0xfe')]]){ut[_0x6d91('0x13b')](_0x3aecc6,this['agents'][_0x3aecc6['lookAgent']]['name'],this[_0x6d91('0x16')][_0x3aecc6[_0x6d91('0xfe')]]['id']);}var _0x5a1959=_['clone'](_0x3aecc6);_0x5a1959['responsetime']=moment()[_0x6d91('0x55')](_0x6d91('0xae'));var _0x21d691=_0x3e3189['campaignsPreview'][_0x3aecc6[_0x6d91('0x6e')]];if(ut[_0x6d91('0x13c')](_0x125368[_0x6d91('0x13d')])){if(_0x3aecc6[_0x6d91('0xaa')]){rpcDb[_0x6d91('0x111')](_0x3aecc6[_0x6d91('0x102')]);}if(_0x3aecc6[_0x6d91('0xab')]){rpcDb[_0x6d91('0x8b')](_0x3aecc6[_0x6d91('0x102')]);}ami[_0x6d91('0x24')]('custom:agentringnoanswer',ut[_0x6d91('0xa1')](_0x3aecc6,_0x6d91('0x13e'),this[_0x6d91('0x12')][_0x3aecc6[_0x6d91('0x6e')]]));this[_0x6d91('0x13f')](_0x5a1959,_0x21d691,_0x125368);}else{_0x3aecc6[_0x6d91('0x8c')]=moment()[_0x6d91('0x55')](_0x6d91('0xae'));ut['logAgent'](_0x5a1959,0x4,'Answer');rpcDb[_0x6d91('0xf1')](_0x5a1959,_0x6d91('0x140'));}}};Preview[_0x6d91('0x62')][_0x6d91('0x1c')]=function(_0x15a3b1){var _0x5619da=this;var _0x36e8dd=this[_0x6d91('0x15')][_0x15a3b1[_0x6d91('0xac')]];var _0x588c39;if(_0x36e8dd){_0x588c39=this[_0x6d91('0x12')][_0x36e8dd[_0x6d91('0x6e')]];logger[_0x6d91('0x58')](_0x6d91('0x141'),_0x15a3b1[_0x6d91('0xac')],_0x6d91('0xb1'),_0x588c39[_0x6d91('0x27')],_0x6d91('0x6d'),_0x588c39[_0x6d91('0x2b')]);}if(this[_0x6d91('0x15')][_0x15a3b1['linkedid']]&&_0x15a3b1[_0x6d91('0xac')]!==_0x15a3b1[_0x6d91('0xbb')]){if(_0x15a3b1[_0x6d91('0x142')]==='16'&&this[_0x6d91('0x15')][_0x15a3b1[_0x6d91('0xac')]][_0x6d91('0x6f')]){this['callProgressDetectingCustomer'](_0x15a3b1,_0x15a3b1[_0x6d91('0xac')],_0x15a3b1['cause']);}else if(this[_0x6d91('0x15')][_0x15a3b1[_0x6d91('0xac')]][_0x6d91('0x6f')]){logger[_0x6d91('0x58')](_0x6d91('0x143'),_0x15a3b1[_0x6d91('0xac')],_0x15a3b1[_0x6d91('0x142')],_0x6d91('0xb1'),_0x588c39[_0x6d91('0x27')],_0x6d91('0x6d'),_0x588c39[_0x6d91('0x2b')]);this['callProgressDetectingCustomer'](_0x15a3b1,_0x15a3b1['linkedid'],_0x15a3b1[_0x6d91('0x142')]);}}else if(_0x36e8dd&&_[_0x6d91('0x6a')](_0x36e8dd[_0x6d91('0x144')])&&_0x588c39[_0x6d91('0x145')]&&_0x15a3b1['linkedid']===_0x15a3b1[_0x6d91('0xbb')]&&_[_0x6d91('0x6a')](_0x15a3b1[_0x6d91('0xf7')])&&_0x15a3b1[_0x6d91('0x142')]==='16'&&_0x15a3b1[_0x6d91('0x146')]==='6'&&_[_0x6d91('0xef')](_0x36e8dd['transfer'])){if(_0x36e8dd[_0x6d91('0xaa')]){rpcDb[_0x6d91('0x111')](_0x36e8dd[_0x6d91('0x102')]);}if(_0x36e8dd['activeContact']){rpcDb[_0x6d91('0x8b')](_0x36e8dd[_0x6d91('0x102')]);}_0x15a3b1[_0x6d91('0xf7')]='22';this[_0x6d91('0x13f')](_0x36e8dd,_0x588c39,_0x15a3b1);}else if(_0x36e8dd&&_0x36e8dd[_0x6d91('0x147')]){if(_0x15a3b1[_0x6d91('0x142')]==='16'&&this['actions'][_0x15a3b1[_0x6d91('0xac')]][_0x6d91('0x6f')]){logger[_0x6d91('0x58')](_0x6d91('0x148'),_0x15a3b1[_0x6d91('0xac')],_0x15a3b1['cause'],_0x6d91('0xb1'),_0x588c39[_0x6d91('0x27')],'pTalking:\x20',_0x588c39['pTalking']);this['callProgressDetectingCustomer'](_0x15a3b1,_0x15a3b1['linkedid'],_0x15a3b1['cause']);}else if(this['actions'][_0x15a3b1[_0x6d91('0xac')]][_0x6d91('0x6f')]){logger[_0x6d91('0x58')](_0x6d91('0x143'),_0x15a3b1['linkedid'],_0x15a3b1[_0x6d91('0x142')],_0x6d91('0xb1'),_0x588c39[_0x6d91('0x27')],_0x6d91('0x6d'),_0x588c39['pTalking']);this['callProgressDetectingCustomer'](_0x15a3b1,_0x15a3b1[_0x6d91('0xac')],_0x15a3b1['cause']);}}};Preview[_0x6d91('0x62')][_0x6d91('0x1f')]=function(_0x5bf1e4){if(this['actions'][_0x5bf1e4[_0x6d91('0xee')]]&&_0x5bf1e4[_0x6d91('0xee')]!==_0x5bf1e4[_0x6d91('0x149')]){this[_0x6d91('0x9d')](_0x5bf1e4,_0x5bf1e4[_0x6d91('0xee')],_0x5bf1e4['dialstatus']);}};Preview['prototype'][_0x6d91('0x1d')]=function(_0x23b0bb){if(this['actions'][_0x23b0bb[_0x6d91('0xac')]]&&_0x23b0bb[_0x6d91('0xac')]!==_0x23b0bb[_0x6d91('0xbb')]&&!this[_0x6d91('0x15')][_0x23b0bb[_0x6d91('0xac')]]['dialAnswer']){if(_0x23b0bb[_0x6d91('0x142')]==='1'){this['callProgressDetectingCustomer'](_0x23b0bb,_0x23b0bb[_0x6d91('0xac')],_0x23b0bb[_0x6d91('0x142')]);}}};Preview[_0x6d91('0x62')]['addVariable']=function(_0x51538b,_0x85a75a,_0x4fb2f4){if(this[_0x6d91('0x15')][_0x51538b]){if(_[_0x6d91('0x6a')](this[_0x6d91('0x15')][_0x51538b][_0x6d91('0x14a')])){this[_0x6d91('0x15')][_0x51538b]['variables']={};}this[_0x6d91('0x15')][_0x51538b][_0x6d91('0x14a')][_0x85a75a]=_0x4fb2f4;}};Preview[_0x6d91('0x62')][_0x6d91('0x14b')]=function(_0x21b490){try{if(!_['isNil'](_0x21b490)){if(ut[_0x6d91('0x14c')](_[_0x6d91('0x14d')](_0x21b490['variable'])[0x0])){this['addVariable'](_0x21b490[_0x6d91('0xbb')],_['keys'](_0x21b490[_0x6d91('0x14e')])[0x0],_0x21b490[_0x6d91('0x14f')]);}}}catch(_0x4034c6){logger['error'](_0x6d91('0x150'),util[_0x6d91('0x151')](_0x4034c6,{'showHidden':![],'depth':null}));}};Preview[_0x6d91('0x62')]['syncAttendedTransfer']=function(_0x2a193f){if(_0x2a193f){if(this[_0x6d91('0x15')][_0x2a193f[_0x6d91('0x152')]]){this[_0x6d91('0x15')][_0x2a193f[_0x6d91('0x152')]][_0x6d91('0x147')]=!![];}}};Preview[_0x6d91('0x62')][_0x6d91('0x22')]=function(_0x460c0e){if(_0x460c0e){if(this[_0x6d91('0x15')][_0x460c0e[_0x6d91('0x153')]]){this['actions'][_0x460c0e[_0x6d91('0x153')]]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 58da8ac..5d1712c 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 _0xcb66=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','createAgentHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type'];(function(_0x2f5035,_0x46e6b7){var _0x54dd06=function(_0x1a91e5){while(--_0x1a91e5){_0x2f5035['push'](_0x2f5035['shift']());}};_0x54dd06(++_0x46e6b7);}(_0xcb66,0x19f));var _0x6cb6=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0xcb66[_0x319e2e];return _0x302524;};'use strict';var util=require('util');var BPromise=require(_0x6cb6('0x0'));var logger=require(_0x6cb6('0x1'))(_0x6cb6('0x2'));var _=require(_0x6cb6('0x3'));var cmHopper=require(_0x6cb6('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x6cb6('0x5'));var cmHopperBlack=require(_0x6cb6('0x6'));var voiceQueueRt=require(_0x6cb6('0x7'));var agentReportPreview=require(_0x6cb6('0x8'));var voiceQueueReport=require(_0x6cb6('0x9'));function loggerCatch(_0x506d14){return function(_0x53078d){logger[_0x6cb6('0xa')](_0x506d14,util[_0x6cb6('0xb')](_0x53078d,{'showHidden':![],'depth':null}));};}function create(_0x1028b3){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopperHistory[_0x6cb6('0xe')](_0x1028b3))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x10')));}function createAgent(_0x332bce){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](agentReportPreview[_0x6cb6('0xe')](_0x332bce))[_0x6cb6('0xf')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x4923a2){return BPromise['resolve']()['then'](cmHopper[_0x6cb6('0x11')](_0x4923a2,!![]))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x12')));}exports[_0x6cb6('0x13')]=function(_0x585233){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopperBlack['checkIsBlackList'](_0x585233))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x14')));};exports['getContactPreview']=function(_0x107492){return BPromise[_0x6cb6('0xc')]()['then'](cmHopper['getContactPreview'](_0x107492))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0x6cb6('0xe')]=function(_0x298daa,_0x9c901a){create(_0x298daa)[_0x6cb6('0xf')](loggerCatch(_0x9c901a));moveContact(_0x298daa)[_0x6cb6('0xf')](loggerCatch(_0x9c901a));};exports[_0x6cb6('0x15')]=function(_0x5b8a17,_0x1e8b7e){createAgent(_0x5b8a17)[_0x6cb6('0xf')](loggerCatch(_0x1e8b7e));};exports['createCustomerHistory']=function(_0x4b9da5,_0x5ef3d2){create(_0x4b9da5)['catch'](loggerCatch(_0x5ef3d2));};exports['createCustomerFinal']=function(_0x5e5349,_0x390c9b){moveContact(_0x5e5349)[_0x6cb6('0xf')](loggerCatch(_0x390c9b));};exports[_0x6cb6('0x16')]=function(_0x2d41c4,_0xc5dea0,_0x5e14c8){if(_0xc5dea0){_0x2d41c4['UserId']=null;}if(_0x5e14c8){_0x2d41c4[_0x6cb6('0x17')]=![];}return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopper[_0x6cb6('0x16')](_0x2d41c4))['catch'](loggerCatch(_0x6cb6('0x18')));};exports[_0x6cb6('0x19')]=function(_0x58a6ed){return BPromise['resolve']()[_0x6cb6('0xd')](cmHopper['countReScheduled'](_0x58a6ed))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x1a')));};exports[_0x6cb6('0x1b')]=function(_0x18ecb9){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopper[_0x6cb6('0x1b')]({'UserId':null},_0x18ecb9,0x1))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x1c')));};exports[_0x6cb6('0x1d')]=function(_0x47a81b){return BPromise['resolve']()['then'](cmHopper[_0x6cb6('0x1b')]({'active':![]},_0x47a81b,0x1))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x1e')));};exports[_0x6cb6('0x1f')]=function(_0x1f8c9d){var _0x3b62e6={};_0x3b62e6['type']=_0x1f8c9d[_0x6cb6('0x20')];_0x3b62e6['uniqueid']=_0x1f8c9d[_0x6cb6('0x21')];_0x3b62e6['calleridnum']=_0x1f8c9d[_0x6cb6('0x22')];_0x3b62e6[_0x6cb6('0x23')]=_0x1f8c9d[_0x6cb6('0x23')];_0x3b62e6['queue']=_0x1f8c9d[_0x6cb6('0x24')];_0x3b62e6[_0x6cb6('0x25')]=_0x1f8c9d[_0x6cb6('0x26')];_0x3b62e6['queuecallerleaveAt']=_0x1f8c9d[_0x6cb6('0x26')];_0x3b62e6[_0x6cb6('0x27')]=0x1;_0x3b62e6[_0x6cb6('0x28')]=_0x1f8c9d['endtime'];_0x3b62e6[_0x6cb6('0x29')]=_0x1f8c9d[_0x6cb6('0x2a')];_0x3b62e6['context']=_0x6cb6('0x2b');_0x3b62e6[_0x6cb6('0x2c')]=_0x6cb6('0x2d');_0x3b62e6[_0x6cb6('0x2e')]=0x0;_0x3b62e6[_0x6cb6('0x2f')]=0x1;_0x3b62e6[_0x6cb6('0x30')]=_0x1f8c9d[_0x6cb6('0x2a')];_0x3b62e6[_0x6cb6('0x31')]=_0x6cb6('0x32');return BPromise[_0x6cb6('0xc')]()['then'](voiceQueueReport[_0x6cb6('0x33')](_0x3b62e6))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x34')));};exports[_0x6cb6('0x35')]=function(_0x586cf9,_0x558494){return BPromise['resolve']()[_0x6cb6('0xd')](cmHopper[_0x6cb6('0x35')](_0x586cf9,_0x558494))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x36')));};exports[_0x6cb6('0x37')]=function(_0xa9f21b){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopper['rescheduleContact'](_0xa9f21b,!![],!![]))[_0x6cb6('0xf')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xcca7=['calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','create','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum'];(function(_0x2d18e9,_0x18e20a){var _0x1dbe38=function(_0x478e15){while(--_0x478e15){_0x2d18e9['push'](_0x2d18e9['shift']());}};_0x1dbe38(++_0x18e20a);}(_0xcca7,0x1aa));var _0x7cca=function(_0x49910d,_0x4d19f5){_0x49910d=_0x49910d-0x0;var _0x1f7f5b=_0xcca7[_0x49910d];return _0x1f7f5b;};'use strict';var util=require(_0x7cca('0x0'));var BPromise=require(_0x7cca('0x1'));var logger=require(_0x7cca('0x2'))(_0x7cca('0x3'));var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x7cca('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x7cca('0x5'));var voiceQueueRt=require(_0x7cca('0x6'));var agentReportPreview=require(_0x7cca('0x7'));var voiceQueueReport=require(_0x7cca('0x8'));function loggerCatch(_0x1c6c95){return function(_0xe70805){logger['error'](_0x1c6c95,util['inspect'](_0xe70805,{'showHidden':![],'depth':null}));};}function create(_0x937fad){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopperHistory[_0x7cca('0xb')](_0x937fad))[_0x7cca('0xc')](loggerCatch(_0x7cca('0xd')));}function createAgent(_0x20ffa9){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](agentReportPreview[_0x7cca('0xb')](_0x20ffa9))['catch'](loggerCatch(_0x7cca('0xd')));}function moveContact(_0x464911){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopper[_0x7cca('0xe')](_0x464911,!![]))['catch'](loggerCatch(_0x7cca('0xf')));}exports[_0x7cca('0x10')]=function(_0x2854c7){return BPromise['resolve']()['then'](cmHopperBlack[_0x7cca('0x10')](_0x2854c7))[_0x7cca('0xc')](loggerCatch(_0x7cca('0x11')));};exports[_0x7cca('0x12')]=function(_0x444465){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopper['getContactPreview'](_0x444465))[_0x7cca('0xc')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x4eb7fa,_0x33a466){create(_0x4eb7fa)[_0x7cca('0xc')](loggerCatch(_0x33a466));moveContact(_0x4eb7fa)[_0x7cca('0xc')](loggerCatch(_0x33a466));};exports[_0x7cca('0x13')]=function(_0x44294b,_0x5e7c42){createAgent(_0x44294b)[_0x7cca('0xc')](loggerCatch(_0x5e7c42));};exports['createCustomerHistory']=function(_0x5d47f8,_0x5d7ac6){create(_0x5d47f8)[_0x7cca('0xc')](loggerCatch(_0x5d7ac6));};exports[_0x7cca('0x14')]=function(_0x2beb6c,_0x1a20be){moveContact(_0x2beb6c)[_0x7cca('0xc')](loggerCatch(_0x1a20be));};exports[_0x7cca('0x15')]=function(_0x2e023c,_0x1e183f,_0x4d7804){if(_0x1e183f){_0x2e023c[_0x7cca('0x16')]=null;}if(_0x4d7804){_0x2e023c[_0x7cca('0x17')]=![];}return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopper['rescheduleContact'](_0x2e023c))[_0x7cca('0xc')](loggerCatch(_0x7cca('0x18')));};exports[_0x7cca('0x19')]=function(_0x119d76){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopper[_0x7cca('0x19')](_0x119d76))[_0x7cca('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0x7cca('0x1a')]=function(_0x1dd3b3){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopper[_0x7cca('0x1a')]({'UserId':null},_0x1dd3b3,0x1))[_0x7cca('0xc')](loggerCatch(_0x7cca('0x1b')));};exports[_0x7cca('0x1c')]=function(_0x583846){return BPromise[_0x7cca('0x9')]()['then'](cmHopper[_0x7cca('0x1a')]({'active':![]},_0x583846,0x1))[_0x7cca('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0x7cca('0x1d')]=function(_0x3d91b1){var _0x5533fb={};_0x5533fb[_0x7cca('0x1e')]=_0x3d91b1[_0x7cca('0x1e')];_0x5533fb[_0x7cca('0x1f')]=_0x3d91b1['uniqueid'];_0x5533fb['calleridnum']=_0x3d91b1[_0x7cca('0x20')];_0x5533fb[_0x7cca('0x21')]=_0x3d91b1[_0x7cca('0x21')];_0x5533fb[_0x7cca('0x22')]=_0x3d91b1[_0x7cca('0x22')];_0x5533fb[_0x7cca('0x23')]=_0x3d91b1[_0x7cca('0x24')];_0x5533fb['queuecallerleaveAt']=_0x3d91b1['answertime'];_0x5533fb[_0x7cca('0x25')]=0x1;_0x5533fb[_0x7cca('0x26')]=_0x3d91b1[_0x7cca('0x27')];_0x5533fb['connectedlinename']=_0x3d91b1[_0x7cca('0x28')];_0x5533fb['context']=_0x7cca('0x29');_0x5533fb[_0x7cca('0x2a')]=_0x7cca('0x2b');_0x5533fb[_0x7cca('0x2c')]=0x0;_0x5533fb['assigned']=0x1;_0x5533fb[_0x7cca('0x2d')]=_0x3d91b1[_0x7cca('0x28')];_0x5533fb[_0x7cca('0x2e')]='COMPLETED';return BPromise['resolve']()['then'](voiceQueueReport[_0x7cca('0x2f')](_0x5533fb))[_0x7cca('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x7cca('0x30')]=function(_0xc34146,_0x193a4c){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopper[_0x7cca('0x30')](_0xc34146,_0x193a4c))[_0x7cca('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x7cca('0x31')]=function(_0x1f9bce){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopper['rescheduleContact'](_0x1f9bce,!![],!![]))[_0x7cca('0xc')](loggerCatch(_0x7cca('0x32')));}; \ 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 8d2b0df..36eb300 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 _0x13cc=['getDiff','seconds','createBody','filterKey','idContact','type','campaigntype','dialAnswer','active','calleridnum','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','milliseconds','diff','loggerCatch','error','logger','info','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','%s%s','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','endtime','logAgent','responsetime','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','mandatoryDisposition','agentReadyId','not_inuse','status','reachable','push'];(function(_0x32d330,_0xe907c8){var _0xe81a43=function(_0x322e56){while(--_0x322e56){_0x32d330['push'](_0x32d330['shift']());}};_0xe81a43(++_0xe907c8);}(_0x13cc,0x142));var _0xc13c=function(_0x32a4b4,_0x233a38){_0x32a4b4=_0x32a4b4-0x0;var _0x3c7f32=_0x13cc[_0x32a4b4];return _0x3c7f32;};'use strict';var util=require(_0xc13c('0x0'));var _=require(_0xc13c('0x1'));var moment=require(_0xc13c('0x2'));var logger=require(_0xc13c('0x3'))('preview');var ipAgi=process[_0xc13c('0x4')][_0xc13c('0x5')]||'127.0.0.1';function getSeconds(_0x2d9ad3,_0x1f49b2){var _0x286444=moment(_0x2d9ad3)[_0xc13c('0x6')](0x0);var _0x56baa4=moment(_0x1f49b2)['milliseconds'](0x0);return _0x286444[_0xc13c('0x7')](_0x56baa4,'seconds');}exports[_0xc13c('0x8')]=function(_0x2fa60a){return function(_0x4f94df){logger[_0xc13c('0x9')](_0x2fa60a,util['inspect'](_0x4f94df,{'showHidden':![],'depth':null}));};};exports[_0xc13c('0xa')]=function(_0x576e37,_0x2ba7fb){logger[_0xc13c('0xb')](_0x576e37,util[_0xc13c('0xc')](_0x2ba7fb,{'showHidden':![],'depth':null}));};exports[_0xc13c('0xd')]=function(_0x3f4667,_0x1a8bbc){logger['error'](_0x3f4667,util[_0xc13c('0xc')](_0x1a8bbc,{'showHidden':![],'depth':null}));};exports[_0xc13c('0xe')]=function(_0xc25735){return function(_0x14c1e2){logger['info'](_0xc25735,util[_0xc13c('0xc')](_0x14c1e2,{'showHidden':![],'depth':null}));};};exports[_0xc13c('0xf')]=function(_0x5227b6,_0x31268f,_0x5842a0){return{'message':_0x5227b6,'unlock':_0x31268f,'active':_0x5842a0};};exports[_0xc13c('0x10')]=function(_0x49f65f,_0x28ef75,_0x22e4cc){if(!_[_0xc13c('0x11')](_0x22e4cc)&&_0xc13c('0x12')===typeof _0x22e4cc&&!_['isEmpty'](_0x22e4cc)){if(!_[_0xc13c('0x11')](_0x28ef75)&&_0xc13c('0x12')===typeof _0x28ef75&&!_[_0xc13c('0x13')](_0x28ef75)){return util[_0xc13c('0x14')](_0xc13c('0x15'),_0x28ef75,_0x22e4cc);}return util['format']('\x22%s\x22\x20<%s>',_0x22e4cc,_0x22e4cc);}if(!_['isUndefined'](_0x49f65f)&&_0xc13c('0x12')===typeof _0x49f65f&&!_[_0xc13c('0x13')](_0x49f65f)){return _0x49f65f;}return _0xc13c('0x16');};exports[_0xc13c('0x17')]=function(_0x368869){if(_[_0xc13c('0x18')](_0x368869)){return![];}return _0x368869;};exports[_0xc13c('0x19')]=function(_0x19e752,_0x54dcbf,_0x30c412,_0x59ca4a,_0xa1df7,_0x27dda4){var _0x5b85cd={'XMD-QUEUE':_0x54dcbf['Queue']?_0x54dcbf[_0xc13c('0x1a')][_0xc13c('0x1b')]:'','XMD-CALLERID':_0x59ca4a,'XMD-CALLERID-PREVIEW':_0x27dda4?util[_0xc13c('0x14')]('\x22%s\x22\x20<%s>',_0x27dda4[_0xc13c('0x1c')],_0x27dda4['calleridnum']):_0x59ca4a,'XMD-DIALID':_0xa1df7,'XMD-CONTACTID':_0x54dcbf[_0xc13c('0x1d')],'XMD-CDRTYPE':_0xc13c('0x1e'),'CALLERID(all)':_0x59ca4a,'XMD-VOICEQUEUEID':_0x54dcbf[_0xc13c('0x1f')],'XMD-DIALCHANNEL':_0x30c412,'XMD-DIALTIMEOUT':_0x19e752[_0xc13c('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0xc13c('0x14')]('\x22rtTxX%s%s\x22',_0x19e752[_0xc13c('0x21')]?'g':'',_[_0xc13c('0x13')](_0x19e752[_0xc13c('0x22')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x19e752[_0xc13c('0x23')]||'','XMD-AGI':_0x19e752[_0xc13c('0x24')]?util[_0xc13c('0x14')](_0xc13c('0x25'),ipAgi,_0x19e752[_0xc13c('0x24')]):_0xc13c('0x26'),'XMD-AGIAFTER':_0x19e752['dialQueueProject2']?util[_0xc13c('0x14')](_0xc13c('0x25'),ipAgi,_0x19e752[_0xc13c('0x21')]):_0xc13c('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x27dda4?_0x27dda4['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x27dda4?_0x27dda4[_0xc13c('0x27')]:'','XMD-DESTINATION':_0xc13c('0x28')};if(!_[_0xc13c('0x13')](_0x19e752[_0xc13c('0x22')])){_0x5b85cd[util[_0xc13c('0x14')]('%s',_0xc13c('0x29'))]=_0x19e752[_0xc13c('0x22')];_0x5b85cd[util[_0xc13c('0x14')]('%s',_0xc13c('0x2a'))]=_0xa1df7;}if(_0x54dcbf&&_0x54dcbf['Contact']){for(var _0x4b2a3c in _0x54dcbf[_0xc13c('0x2b')]){if(_0x54dcbf[_0xc13c('0x2b')][_0xc13c('0x2c')](_0x4b2a3c)){if(!_[_0xc13c('0x18')](_0x54dcbf[_0xc13c('0x2b')][_0x4b2a3c])&&_0x4b2a3c!=='id'&&_0x4b2a3c!==_0xc13c('0x2d')&&_0x4b2a3c!=='createdAt'&&_0x4b2a3c!==_0xc13c('0x2e')){_0x5b85cd[util['format'](_0xc13c('0x2f'),'XMD-',_[_0xc13c('0x30')](_0x4b2a3c))]=_0x54dcbf[_0xc13c('0x2b')][_0x4b2a3c];}}}}return _0x5b85cd;};exports[_0xc13c('0x31')]=function(_0xd2b570){var _0x1f510c={};for(var _0x1aabde in _0xd2b570){if(_0xd2b570[_0xc13c('0x2c')](_0x1aabde)){_0x1f510c[util[_0xc13c('0x14')]('%s',_[_0xc13c('0x32')](_0x1aabde))]=_0xd2b570[_0x1aabde];}}return{'variables':_0x1f510c};};exports[_0xc13c('0x33')]=function(_0x2ca466,_0x54afb7){if(!_[_0xc13c('0x18')](_0x2ca466)){if(_0x2ca466[_0xc13c('0x2c')]('originated')){if(_0x2ca466[_0xc13c('0x34')]>0x0){_0x2ca466[_0xc13c('0x34')]-=0x1;}else{logger[_0xc13c('0x9')](_0xc13c('0x35'),_0x54afb7);}}}else{logger[_0xc13c('0x9')](_0xc13c('0x36'),_0x54afb7);}};exports[_0xc13c('0x37')]=function(_0x256c67){var _0x5de39f=moment()[_0xc13c('0x14')](_0xc13c('0x38'));_0x256c67[_0xc13c('0x39')]=0xd;_0x256c67[_0xc13c('0x3a')]=_0xc13c('0x3b');_0x256c67[_0xc13c('0x3c')]=_0x5de39f;_0x256c67['responsetime']=_0x5de39f;_0x256c67[_0xc13c('0x3d')]=_0x5de39f;};exports[_0xc13c('0x3e')]=function(_0x4da5b3,_0x38519a,_0x59a216){var _0x53a6b4=moment()[_0xc13c('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x4da5b3[_0xc13c('0x39')]=_0x38519a;_0x4da5b3[_0xc13c('0x3a')]=_0x59a216;_0x4da5b3[_0xc13c('0x3f')]=_0x53a6b4;_0x4da5b3[_0xc13c('0x40')]=getSeconds(_0x4da5b3[_0xc13c('0x3f')],_0x4da5b3[_0xc13c('0x3c')]);};exports[_0xc13c('0x41')]=function(_0x2d6aab,_0x391cc5,_0x172b31){_0x2d6aab['membername']=_0x391cc5;_0x2d6aab[_0xc13c('0x42')]=_0x172b31;};exports[_0xc13c('0x43')]=function(_0x3b7a4,_0x4546da,_0x305313){var _0x18c132=moment()[_0xc13c('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b7a4[_0xc13c('0x39')]=_0x4546da;_0x3b7a4[_0xc13c('0x3a')]=_0x305313;_0x3b7a4[_0xc13c('0x3f')]=_0x3b7a4['responsetime']?_0x3b7a4[_0xc13c('0x3f')]:_0x18c132;_0x3b7a4['endtime']=_0x3b7a4[_0xc13c('0x3d')]?_0x3b7a4['endtime']:_0x18c132;_0x3b7a4[_0xc13c('0x40')]=getSeconds(_0x3b7a4[_0xc13c('0x3f')]||0x0,_0x3b7a4[_0xc13c('0x3c')]||0x0);_0x3b7a4[_0xc13c('0x44')]=_0x3b7a4[_0xc13c('0x45')]?getSeconds(_0x3b7a4[_0xc13c('0x3d')],_0x3b7a4[_0xc13c('0x45')]):0x0;};exports[_0xc13c('0x46')]=function(_0x3b424b){return _0x3b424b===_0xc13c('0x47');};exports[_0xc13c('0x48')]=function(_0x2c61fb,_0x3a314e,_0x43195a,_0x49f8c1,_0x2ef17a){var _0x4d0b4b=_0x49f8c1?'RECALL':_0x2c61fb[_0xc13c('0x1c')];_0x4d0b4b=_0x2ef17a?_0xc13c('0x49'):_0x4d0b4b;return{'actionid':_0x2c61fb['uniqueid'],'action':_0xc13c('0x4a'),'channel':_0x2c61fb[_0xc13c('0x4b')],'callerid':util[_0xc13c('0x14')]('\x22%s\x22\x20<%s>',_0x4d0b4b,_0x2c61fb['calleridnum']),'Exten':'xcally-motion-preview','Context':_0xc13c('0x4c'),'Priority':'1','variable':_0x43195a,'timeout':(_0x3a314e[_0xc13c('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2c61fb[_0xc13c('0x4e')]};};exports[_0xc13c('0x4f')]=function(_0x419acf){return _0x419acf[_0xc13c('0x50')]+_0x419acf[_0xc13c('0x51')]+_0x419acf[_0xc13c('0x52')]+_0x419acf[_0xc13c('0x53')]+_0x419acf[_0xc13c('0x54')];};exports[_0xc13c('0x55')]=function(_0x3eaf20){var _0x331302=_[_0xc13c('0x56')](_0x3eaf20);_0x331302[_0xc13c('0x39')]=0xf;_0x331302[_0xc13c('0x3a')]='Global';return _0x331302;};exports[_0xc13c('0x57')]=function(_0x1ceb9a,_0x3d5274,_0x205bee){var _0x13afc3={};_0x13afc3[_0x3d5274]=_0x1ceb9a[_0x3d5274];_0x13afc3['active']=![];_0x13afc3[_0xc13c('0x58')]=moment()[_0xc13c('0x59')](_0x205bee,_0xc13c('0x5a'))[_0xc13c('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x13afc3['ContactId']=_0x1ceb9a[_0xc13c('0x1d')];_0x13afc3[_0xc13c('0x5b')]=_0x1ceb9a[_0xc13c('0x5b')];_0x13afc3[_0xc13c('0x1f')]=_0x1ceb9a['VoiceQueueId']||undefined;return _0x13afc3;};exports[_0xc13c('0x5c')]=function(_0x5363cf,_0x220930){if(!_[_0xc13c('0x18')](_0x5363cf)){if(_0x5363cf[_0xc13c('0x5d')]>0x0){_0x5363cf['pTalking']-=0x1;}else{logger[_0xc13c('0x9')](_0x220930,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xc13c('0x9')](_0x220930,_0xc13c('0x5e'));}};exports[_0xc13c('0x5f')]=function(_0x4069ca){if(_0x4069ca<=0x0){return!![];}return![];};exports['buildObj']=function(_0x32ceb0,_0x223aed,_0x12ff1a){_0x32ceb0['lastevent']=_0x223aed;_0x32ceb0[_0xc13c('0x1b')]=_0x32ceb0[_0xc13c('0x60')];_0x32ceb0[_0xc13c('0x61')]=_0x32ceb0['channelAgent'];if(_0x12ff1a){_0x32ceb0[_0xc13c('0x62')]=_0x12ff1a[_0xc13c('0x62')];}return _0x32ceb0;};exports['buildAcw']=function(_0x2d0617){var _0x480c80={};_0x480c80['queue']=_0x2d0617[_0xc13c('0x60')];_0x480c80[_0xc13c('0x61')]=_0x2d0617['channelAgent'];_0x480c80['uniqueid']=_0x2d0617[_0xc13c('0x4e')];return _0x480c80;};exports[_0xc13c('0x63')]=function(_0x1470e5){var _0x3f04c6=[];for(var _0x4af0d0 in _0x1470e5){if(_0x1470e5[_0xc13c('0x2c')](_0x4af0d0)){if(!_[_0xc13c('0x18')](_0x1470e5[_0x4af0d0])&&_0x1470e5[_0x4af0d0]['state']===_0xc13c('0x64')&&_0x1470e5[_0x4af0d0][_0xc13c('0x65')]===_0xc13c('0x66')){_0x3f04c6[_0xc13c('0x67')](_0x1470e5[_0x4af0d0]['id']);}}}return _0x3f04c6;};exports[_0xc13c('0x68')]=function(_0x868766){var _0x5ba137=moment()[_0xc13c('0x6')](0x0);var _0x5a46b6=moment(_0x868766)[_0xc13c('0x6')](0x0);return _0x5ba137['diff'](_0x5a46b6,_0xc13c('0x69'));};exports[_0xc13c('0x6a')]=function(_0x34b858){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x34b858['ContactId'],'ListId':_0x34b858[_0xc13c('0x5b')],'VoiceQueueId':_0x34b858['VoiceQueueId']||undefined,'CampaignId':_0x34b858['CampaignId']||undefined};};exports[_0xc13c('0x6b')]=function(_0x17c87a){if(_0x17c87a===_0xc13c('0x4e')||_0x17c87a===_0xc13c('0x6c')||_0x17c87a===_0xc13c('0x60')||_0x17c87a===_0xc13c('0x6d')||_0x17c87a===_0xc13c('0x6e')||_0x17c87a===_0xc13c('0x6f')||_0x17c87a==='membername'||_0x17c87a===_0xc13c('0x4b')||_0x17c87a===_0xc13c('0x1c')||_0x17c87a===_0xc13c('0x70')||_0x17c87a===_0xc13c('0x71')||_0x17c87a===_0xc13c('0x58')||_0x17c87a===_0xc13c('0x50')||_0x17c87a==='countcongestionretry'||_0x17c87a===_0xc13c('0x52')||_0x17c87a==='countglobal'||_0x17c87a===_0xc13c('0x72')||_0x17c87a===_0xc13c('0x73')||_0x17c87a===_0xc13c('0x74')||_0x17c87a===_0xc13c('0x75')||_0x17c87a===_0xc13c('0x1d')||_0x17c87a===_0xc13c('0x5b')||_0x17c87a===_0xc13c('0x42')||_0x17c87a===_0xc13c('0x1f')||_0x17c87a===_0xc13c('0x76')||_0x17c87a===_0xc13c('0x77')||_0x17c87a===_0xc13c('0x78')||_0x17c87a==='xmd-phone'||_0x17c87a===_0xc13c('0x79')||_0x17c87a==='xmd-dialurl'||_0x17c87a==='xmd-dialtimeout'||_0x17c87a===_0xc13c('0x7a')||_0x17c87a===_0xc13c('0x7b')||_0x17c87a==='xmd-dialchannel'||_0x17c87a==='xmd-contactid'||_0x17c87a===_0xc13c('0x7c')||_0x17c87a==='xmd-callerid'||_0x17c87a===_0xc13c('0x7d')||_0x17c87a==='xmd-agi'||_0x17c87a===_0xc13c('0x7e')||_0x17c87a==='rtpaudioqosbridged'||_0x17c87a===_0xc13c('0x7f')||_0x17c87a==='rtpaudioqosjitterbridged'||_0x17c87a===_0xc13c('0x80')||_0x17c87a===_0xc13c('0x81')||_0x17c87a===_0xc13c('0x82')||_0x17c87a===_0xc13c('0x83')||_0x17c87a==='rtpaudioqos'||_0x17c87a==='rtpaudioqosbridged'||_0x17c87a===_0xc13c('0x7f')||_0x17c87a===_0xc13c('0x84')||_0x17c87a==='rtpaudioqosloss'||_0x17c87a===_0xc13c('0x81')||_0x17c87a===_0xc13c('0x82')||_0x17c87a===_0xc13c('0x83')||_0x17c87a===_0xc13c('0x85')||_0x17c87a===_0xc13c('0x86')||_0x17c87a===_0xc13c('0x39')||_0x17c87a==='statedesc'){return![];}return!![];};exports[_0xc13c('0x87')]=function(_0x130d96,_0x191468){var _0x1c4b74,_0x338a67,_0x4f427e;if(_0x191468<=0x0){_0x191468=0x1;}_0x1c4b74=new RegExp(_0xc13c('0x88')+_0x191468+'}$');_0x338a67=Math[_0xc13c('0x89')](0xa,_0x191468-0x1);_0x4f427e=Math[_0xc13c('0x89')](0xa,_0x191468)-0x1;return util[_0xc13c('0x14')]('%s',_['replace'](_0x130d96,_0x1c4b74,_[_0xc13c('0x8a')](_0x338a67,_0x4f427e)));};exports[_0xc13c('0x8b')]=function(_0x4e7b60){var _0x475615=_0x4e7b60['match'](/"(.*?)"/);return _0x475615?_0x475615[0x1]:_0x4e7b60;};exports[_0xc13c('0x8c')]=function(_0x26f92a){var _0x2ddab3=_0x26f92a[_0xc13c('0x8d')](/<(.*?)>/);return _0x2ddab3?_0x2ddab3[0x1]:_0x26f92a;}; \ No newline at end of file +var _0x0ad9=['127.0.0.1','milliseconds','seconds','inspect','info','loggerError','error','logger2','getCallerId','isUndefined','isEmpty','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','%s%s','XMD-','toUpper','toLowerVariables','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','responsetime','ringtime','logLookAgent','membername','UserId','logCustomer','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','channelAgent','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','CampaignId','filterKey','idContact','campaigntype','dialAnswer','calleridname','scheduledat','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI'];(function(_0x1d9270,_0x1f890d){var _0x3f0249=function(_0x273990){while(--_0x273990){_0x1d9270['push'](_0x1d9270['shift']());}};_0x3f0249(++_0x1f890d);}(_0x0ad9,0x11a));var _0x90ad=function(_0x30a565,_0x1337bf){_0x30a565=_0x30a565-0x0;var _0x388956=_0x0ad9[_0x30a565];return _0x388956;};'use strict';var util=require(_0x90ad('0x0'));var _=require(_0x90ad('0x1'));var moment=require(_0x90ad('0x2'));var logger=require(_0x90ad('0x3'))(_0x90ad('0x4'));var ipAgi=process['env'][_0x90ad('0x5')]||_0x90ad('0x6');function getSeconds(_0x3546c9,_0x16e3f7){var _0x2ece66=moment(_0x3546c9)[_0x90ad('0x7')](0x0);var _0x5405ec=moment(_0x16e3f7)['milliseconds'](0x0);return _0x2ece66['diff'](_0x5405ec,_0x90ad('0x8'));}exports['loggerCatch']=function(_0x489531){return function(_0x56ce96){logger['error'](_0x489531,util[_0x90ad('0x9')](_0x56ce96,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0xfbf948,_0x213620){logger[_0x90ad('0xa')](_0xfbf948,util[_0x90ad('0x9')](_0x213620,{'showHidden':![],'depth':null}));};exports[_0x90ad('0xb')]=function(_0x4721d8,_0x3e924c){logger[_0x90ad('0xc')](_0x4721d8,util[_0x90ad('0x9')](_0x3e924c,{'showHidden':![],'depth':null}));};exports[_0x90ad('0xd')]=function(_0x3b48e5){return function(_0x2604f8){logger[_0x90ad('0xa')](_0x3b48e5,util[_0x90ad('0x9')](_0x2604f8,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x1b3e83,_0x38f526,_0x197362){return{'message':_0x1b3e83,'unlock':_0x38f526,'active':_0x197362};};exports[_0x90ad('0xe')]=function(_0x2caf06,_0x5e4ada,_0x1396a5){if(!_[_0x90ad('0xf')](_0x1396a5)&&'string'===typeof _0x1396a5&&!_[_0x90ad('0x10')](_0x1396a5)){if(!_[_0x90ad('0xf')](_0x5e4ada)&&_0x90ad('0x11')===typeof _0x5e4ada&&!_['isEmpty'](_0x5e4ada)){return util['format'](_0x90ad('0x12'),_0x5e4ada,_0x1396a5);}return util[_0x90ad('0x13')](_0x90ad('0x12'),_0x1396a5,_0x1396a5);}if(!_[_0x90ad('0xf')](_0x2caf06)&&_0x90ad('0x11')===typeof _0x2caf06&&!_['isEmpty'](_0x2caf06)){return _0x2caf06;}return _0x90ad('0x14');};exports['isActive']=function(_0x15048b){if(_[_0x90ad('0x15')](_0x15048b)){return![];}return _0x15048b;};exports[_0x90ad('0x16')]=function(_0x500e8f,_0x44eae1,_0x19f04b,_0x423073,_0x137155,_0x27e059){var _0x484cc4={'XMD-QUEUE':_0x44eae1[_0x90ad('0x17')]?_0x44eae1[_0x90ad('0x17')][_0x90ad('0x18')]:'','XMD-CALLERID':_0x423073,'XMD-CALLERID-PREVIEW':_0x27e059?util[_0x90ad('0x13')](_0x90ad('0x12'),_0x27e059['calleridname'],_0x27e059[_0x90ad('0x19')]):_0x423073,'XMD-DIALID':_0x137155,'XMD-CONTACTID':_0x44eae1['ContactId'],'XMD-CDRTYPE':_0x90ad('0x1a'),'CALLERID(all)':_0x423073,'XMD-VOICEQUEUEID':_0x44eae1[_0x90ad('0x1b')],'XMD-DIALCHANNEL':_0x19f04b,'XMD-DIALTIMEOUT':_0x500e8f[_0x90ad('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x90ad('0x13')](_0x90ad('0x1d'),_0x500e8f[_0x90ad('0x1e')]?'g':'',_[_0x90ad('0x10')](_0x500e8f[_0x90ad('0x1f')])?'':_0x90ad('0x20')),'XMD-DIALURL':_0x500e8f[_0x90ad('0x21')]||'','XMD-AGI':_0x500e8f['dialQueueProject']?util[_0x90ad('0x13')](_0x90ad('0x22'),ipAgi,_0x500e8f[_0x90ad('0x23')]):_0x90ad('0x24'),'XMD-AGIAFTER':_0x500e8f[_0x90ad('0x1e')]?util[_0x90ad('0x13')](_0x90ad('0x22'),ipAgi,_0x500e8f['dialQueueProject2']):_0x90ad('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x27e059?_0x27e059[_0x90ad('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x27e059?_0x27e059[_0x90ad('0x26')]:'','XMD-DESTINATION':_0x90ad('0x27')};if(!_[_0x90ad('0x10')](_0x500e8f['monitor_format'])){_0x484cc4[util[_0x90ad('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x500e8f['monitor_format'];_0x484cc4[util[_0x90ad('0x13')]('%s',_0x90ad('0x28'))]=_0x137155;}if(_0x44eae1&&_0x44eae1[_0x90ad('0x29')]){for(var _0x5c7a20 in _0x44eae1[_0x90ad('0x29')]){if(_0x44eae1[_0x90ad('0x29')][_0x90ad('0x2a')](_0x5c7a20)){if(!_['isNil'](_0x44eae1[_0x90ad('0x29')][_0x5c7a20])&&_0x5c7a20!=='id'&&_0x5c7a20!=='tags'&&_0x5c7a20!=='createdAt'&&_0x5c7a20!=='updatedAt'){_0x484cc4[util[_0x90ad('0x13')](_0x90ad('0x2b'),_0x90ad('0x2c'),_[_0x90ad('0x2d')](_0x5c7a20))]=_0x44eae1[_0x90ad('0x29')][_0x5c7a20];}}}}return _0x484cc4;};exports[_0x90ad('0x2e')]=function(_0x3130b2){var _0xc94305={};for(var _0x1c6c38 in _0x3130b2){if(_0x3130b2['hasOwnProperty'](_0x1c6c38)){_0xc94305[util[_0x90ad('0x13')]('%s',_['toLower'](_0x1c6c38))]=_0x3130b2[_0x1c6c38];}}return{'variables':_0xc94305};};exports['updateOriginated']=function(_0x2b9684,_0x4503fd){if(!_[_0x90ad('0x15')](_0x2b9684)){if(_0x2b9684[_0x90ad('0x2a')](_0x90ad('0x2f'))){if(_0x2b9684[_0x90ad('0x2f')]>0x0){_0x2b9684[_0x90ad('0x2f')]-=0x1;}else{logger['error'](_0x90ad('0x30'),_0x4503fd);}}}else{logger[_0x90ad('0xc')](_0x90ad('0x31'),_0x4503fd);}};exports[_0x90ad('0x32')]=function(_0x1dc73f){var _0x487205=moment()['format'](_0x90ad('0x33'));_0x1dc73f[_0x90ad('0x34')]=0xd;_0x1dc73f[_0x90ad('0x35')]=_0x90ad('0x36');_0x1dc73f[_0x90ad('0x37')]=_0x487205;_0x1dc73f['responsetime']=_0x487205;_0x1dc73f[_0x90ad('0x38')]=_0x487205;};exports[_0x90ad('0x39')]=function(_0x36644a,_0x3c7d0e,_0x3b7251){var _0x1aa1e4=moment()[_0x90ad('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x36644a[_0x90ad('0x34')]=_0x3c7d0e;_0x36644a[_0x90ad('0x35')]=_0x3b7251;_0x36644a[_0x90ad('0x3a')]=_0x1aa1e4;_0x36644a[_0x90ad('0x3b')]=getSeconds(_0x36644a[_0x90ad('0x3a')],_0x36644a['starttime']);};exports[_0x90ad('0x3c')]=function(_0x5b41ee,_0x39c750,_0x93933){_0x5b41ee[_0x90ad('0x3d')]=_0x39c750;_0x5b41ee[_0x90ad('0x3e')]=_0x93933;};exports[_0x90ad('0x3f')]=function(_0x579ed0,_0x32b0eb,_0x60410c){var _0x254e5a=moment()['format'](_0x90ad('0x33'));_0x579ed0['state']=_0x32b0eb;_0x579ed0[_0x90ad('0x35')]=_0x60410c;_0x579ed0['responsetime']=_0x579ed0['responsetime']?_0x579ed0[_0x90ad('0x3a')]:_0x254e5a;_0x579ed0[_0x90ad('0x38')]=_0x579ed0['endtime']?_0x579ed0[_0x90ad('0x38')]:_0x254e5a;_0x579ed0['ringtime']=getSeconds(_0x579ed0[_0x90ad('0x3a')]||0x0,_0x579ed0[_0x90ad('0x37')]||0x0);_0x579ed0['talktime']=_0x579ed0['answertime']?getSeconds(_0x579ed0[_0x90ad('0x38')],_0x579ed0[_0x90ad('0x40')]):0x0;};exports['isFailure']=function(_0x28515f){return _0x28515f===_0x90ad('0x41');};exports[_0x90ad('0x42')]=function(_0x4264a6,_0x1dfb15,_0x4fe22c,_0x3a5d34,_0x3ddcbb){var _0x5bb2e4=_0x3a5d34?_0x90ad('0x43'):_0x4264a6['calleridname'];_0x5bb2e4=_0x3ddcbb?_0x90ad('0x44'):_0x5bb2e4;return{'actionid':_0x4264a6[_0x90ad('0x45')],'action':_0x90ad('0x46'),'channel':_0x4264a6['channelAgent'],'callerid':util['format'](_0x90ad('0x12'),_0x5bb2e4,_0x4264a6[_0x90ad('0x19')]),'Exten':'xcally-motion-preview','Context':_0x90ad('0x47'),'Priority':'1','variable':_0x4fe22c,'timeout':(_0x1dfb15[_0x90ad('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4264a6[_0x90ad('0x45')]};};exports[_0x90ad('0x49')]=function(_0x28743a){return _0x28743a[_0x90ad('0x4a')]+_0x28743a[_0x90ad('0x4b')]+_0x28743a[_0x90ad('0x4c')]+_0x28743a[_0x90ad('0x4d')]+_0x28743a[_0x90ad('0x4e')];};exports[_0x90ad('0x4f')]=function(_0x49c353){var _0x585581=_[_0x90ad('0x50')](_0x49c353);_0x585581['state']=0xf;_0x585581['statedesc']='Global';return _0x585581;};exports[_0x90ad('0x51')]=function(_0x5842b0,_0x221221,_0x25c035){var _0x47280f={};_0x47280f[_0x221221]=_0x5842b0[_0x221221];_0x47280f['active']=![];_0x47280f['scheduledat']=moment()[_0x90ad('0x52')](_0x25c035,_0x90ad('0x53'))[_0x90ad('0x13')](_0x90ad('0x33'));_0x47280f['ContactId']=_0x5842b0[_0x90ad('0x54')];_0x47280f['ListId']=_0x5842b0[_0x90ad('0x55')];_0x47280f[_0x90ad('0x1b')]=_0x5842b0[_0x90ad('0x1b')]||undefined;return _0x47280f;};exports[_0x90ad('0x56')]=function(_0x14e62d,_0x455048){if(!_[_0x90ad('0x15')](_0x14e62d)){if(_0x14e62d[_0x90ad('0x57')]>0x0){_0x14e62d[_0x90ad('0x57')]-=0x1;}else{logger[_0x90ad('0xc')](_0x455048,_0x90ad('0x58'));}}else{logger[_0x90ad('0xc')](_0x455048,_0x90ad('0x59'));}};exports[_0x90ad('0x5a')]=function(_0x543447){if(_0x543447<=0x0){return!![];}return![];};exports[_0x90ad('0x5b')]=function(_0x11c1b0,_0x1aafa0,_0x442d2a){_0x11c1b0[_0x90ad('0x5c')]=_0x1aafa0;_0x11c1b0[_0x90ad('0x18')]=_0x11c1b0[_0x90ad('0x5d')];_0x11c1b0[_0x90ad('0x5e')]=_0x11c1b0[_0x90ad('0x5f')];if(_0x442d2a){_0x11c1b0[_0x90ad('0x60')]=_0x442d2a['mandatoryDisposition'];}return _0x11c1b0;};exports[_0x90ad('0x61')]=function(_0x5a85cd){var _0x50e6bc={};_0x50e6bc[_0x90ad('0x5d')]=_0x5a85cd[_0x90ad('0x5d')];_0x50e6bc['interface']=_0x5a85cd[_0x90ad('0x5f')];_0x50e6bc['uniqueid']=_0x5a85cd[_0x90ad('0x45')];return _0x50e6bc;};exports[_0x90ad('0x62')]=function(_0x1d5462){var _0x5a9410=[];for(var _0x2f20a9 in _0x1d5462){if(_0x1d5462[_0x90ad('0x2a')](_0x2f20a9)){if(!_[_0x90ad('0x15')](_0x1d5462[_0x2f20a9])&&_0x1d5462[_0x2f20a9][_0x90ad('0x34')]===_0x90ad('0x63')&&_0x1d5462[_0x2f20a9][_0x90ad('0x64')]===_0x90ad('0x65')){_0x5a9410[_0x90ad('0x66')](_0x1d5462[_0x2f20a9]['id']);}}}return _0x5a9410;};exports[_0x90ad('0x67')]=function(_0x2be4be){var _0x53c0a3=moment()[_0x90ad('0x7')](0x0);var _0x1dda83=moment(_0x2be4be)[_0x90ad('0x7')](0x0);return _0x53c0a3['diff'](_0x1dda83,_0x90ad('0x8'));};exports['createBody']=function(_0x5b122e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5b122e['ContactId'],'ListId':_0x5b122e[_0x90ad('0x55')],'VoiceQueueId':_0x5b122e[_0x90ad('0x1b')]||undefined,'CampaignId':_0x5b122e[_0x90ad('0x68')]||undefined};};exports[_0x90ad('0x69')]=function(_0x540cb4){if(_0x540cb4===_0x90ad('0x45')||_0x540cb4===_0x90ad('0x6a')||_0x540cb4===_0x90ad('0x5d')||_0x540cb4==='type'||_0x540cb4===_0x90ad('0x6b')||_0x540cb4===_0x90ad('0x6c')||_0x540cb4===_0x90ad('0x3d')||_0x540cb4===_0x90ad('0x5f')||_0x540cb4===_0x90ad('0x6d')||_0x540cb4==='active'||_0x540cb4==='calleridnum'||_0x540cb4===_0x90ad('0x6e')||_0x540cb4===_0x90ad('0x4a')||_0x540cb4==='countcongestionretry'||_0x540cb4==='countnoanswerretry'||_0x540cb4===_0x90ad('0x6f')||_0x540cb4===_0x90ad('0x70')||_0x540cb4===_0x90ad('0x71')||_0x540cb4==='callbackat'||_0x540cb4===_0x90ad('0x72')||_0x540cb4===_0x90ad('0x54')||_0x540cb4==='ListId'||_0x540cb4==='UserId'||_0x540cb4==='VoiceQueueId'||_0x540cb4===_0x90ad('0x73')||_0x540cb4===_0x90ad('0x74')||_0x540cb4===_0x90ad('0x75')||_0x540cb4===_0x90ad('0x76')||_0x540cb4==='xmd-listid'||_0x540cb4===_0x90ad('0x77')||_0x540cb4===_0x90ad('0x78')||_0x540cb4===_0x90ad('0x79')||_0x540cb4===_0x90ad('0x7a')||_0x540cb4===_0x90ad('0x7b')||_0x540cb4===_0x90ad('0x7c')||_0x540cb4===_0x90ad('0x7d')||_0x540cb4==='xmd-callerid'||_0x540cb4==='xmd-agiafter'||_0x540cb4===_0x90ad('0x7e')||_0x540cb4==='rtpaudioqos'||_0x540cb4===_0x90ad('0x7f')||_0x540cb4===_0x90ad('0x80')||_0x540cb4===_0x90ad('0x81')||_0x540cb4===_0x90ad('0x82')||_0x540cb4==='rtpaudioqoslossbridged'||_0x540cb4===_0x90ad('0x83')||_0x540cb4===_0x90ad('0x84')||_0x540cb4==='rtpaudioqos'||_0x540cb4===_0x90ad('0x7f')||_0x540cb4===_0x90ad('0x80')||_0x540cb4===_0x90ad('0x81')||_0x540cb4===_0x90ad('0x82')||_0x540cb4===_0x90ad('0x85')||_0x540cb4===_0x90ad('0x83')||_0x540cb4===_0x90ad('0x84')||_0x540cb4===_0x90ad('0x86')||_0x540cb4===_0x90ad('0x87')||_0x540cb4==='state'||_0x540cb4===_0x90ad('0x35')){return![];}return!![];};exports[_0x90ad('0x88')]=function(_0x417cc0,_0x205f41){var _0x574280,_0x12923f,_0x1ca99b;if(_0x205f41<=0x0){_0x205f41=0x1;}_0x574280=new RegExp(_0x90ad('0x89')+_0x205f41+'}$');_0x12923f=Math['pow'](0xa,_0x205f41-0x1);_0x1ca99b=Math[_0x90ad('0x8a')](0xa,_0x205f41)-0x1;return util['format']('%s',_[_0x90ad('0x8b')](_0x417cc0,_0x574280,_[_0x90ad('0x8c')](_0x12923f,_0x1ca99b)));};exports[_0x90ad('0x8d')]=function(_0x199749){var _0x10ffe8=_0x199749[_0x90ad('0x8e')](/"(.*?)"/);return _0x10ffe8?_0x10ffe8[0x1]:_0x199749;};exports[_0x90ad('0x8f')]=function(_0x4800ab){var _0x281375=_0x4800ab[_0x90ad('0x8e')](/<(.*?)>/);return _0x281375?_0x281375[0x1]:_0x4800ab;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index f06092b..844df8b 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 _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x3b65ed,_0x5b8cb1){var _0x3a1a19=function(_0x40185a){while(--_0x40185a){_0x3b65ed['push'](_0x3b65ed['shift']());}};_0x3a1a19(++_0x5b8cb1);}(_0x7a54,0x106));var _0x47a5=function(_0x20acfd,_0x151f7f){_0x20acfd=_0x20acfd-0x0;var _0x5d0359=_0x7a54[_0x20acfd];return _0x5d0359;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x4b94e7,_0x4043de){var _0x1edd07=function(_0x52e145){while(--_0x52e145){_0x4b94e7['push'](_0x4b94e7['shift']());}};_0x1edd07(++_0x4043de);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f25ca,_0x2577d9){_0x2f25ca=_0x2f25ca-0x0;var _0x1f10f8=_0x5f2f[_0x2f25ca];return _0x1f10f8;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','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 e58ab72..ae4e063 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 _0xa1ab=['queuecallerleaveAt','initVoiceCallReports','duration','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','exports','lodash','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/faxAccount','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','queueChannels','outboundChannels','timers','zendeskAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','agents','length','isUndefined','prototype','initTelephones','telephones','initVoiceQueues','initTriggers','initTemplates','templates','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete'];(function(_0x5db80a,_0x1cc26d){var _0x5984fc=function(_0x233557){while(--_0x233557){_0x5db80a['push'](_0x5db80a['shift']());}};_0x5984fc(++_0x1cc26d);}(_0xa1ab,0x1ae));var _0xba1a=function(_0x5eba49,_0x55282f){_0x5eba49=_0x5eba49-0x0;var _0x2cc0d9=_0xa1ab[_0x5eba49];return _0x2cc0d9;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xba1a('0x0'));var moment=require('moment');var Agent=require(_0xba1a('0x1'));var Telephone=require(_0xba1a('0x2'));var Trunk=require(_0xba1a('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xba1a('0x4'));var Template=require(_0xba1a('0x5'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xba1a('0x6'));var ZendeskAccount=require(_0xba1a('0x7'));var SalesforceAccount=require(_0xba1a('0x8'));var FreshdeskAccount=require(_0xba1a('0x9'));var SugarcrmAccount=require(_0xba1a('0xa'));var ZohoAccount=require(_0xba1a('0xb'));var DeskAccount=require(_0xba1a('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xba1a('0xd'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0xba1a('0xe')]={};this[_0xba1a('0xf')]={};this[_0xba1a('0x10')]={};this[_0xba1a('0x11')]={};this['templates']={};this[_0xba1a('0x12')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xba1a('0x13')]={};this['channels']={};this[_0xba1a('0x14')]={};this[_0xba1a('0x15')]={};this[_0xba1a('0x16')]={};this[_0xba1a('0x17')]={};this['salesforceAccounts']={};this[_0xba1a('0x18')]={};this['freshdeskAccounts']={};this[_0xba1a('0x19')]={};this['deskAccounts']={};this[_0xba1a('0x1a')]={};this[_0xba1a('0x1b')]={};this[_0xba1a('0x1c')]={};this[_0xba1a('0x1d')]={};this[_0xba1a('0x1e')]={};};function freeIsNotKey(_0x28a818,_0x127158,_0x58464f){var _0x511d8a=_[_0xba1a('0x1f')](_0x28a818,function(_0x27133c,_0x464dae){return _0x27133c[_0x58464f];});for(var _0x3434ed in _0x127158){if(_0x127158[_0xba1a('0x20')](_0x3434ed)){if(!_0x511d8a[_0x3434ed]){delete _0x127158[_0x3434ed];}}}}function freeIsNotKeySip(_0x5ea513,_0x72bde3){var _0x5099d8=_[_0xba1a('0x1f')](_0x5ea513,function(_0x15a068,_0x27a73b){return util[_0xba1a('0x21')]('SIP/%s',_0x15a068[_0xba1a('0x22')]);});for(var _0x59b48d in _0x72bde3){if(_0x72bde3[_0xba1a('0x20')](_0x59b48d)){if(!_0x5099d8[_0x59b48d]){delete _0x72bde3[_0x59b48d];}}}}function freeIsNotKeyAgent(_0x78ac04,_0x3f37f7){var _0x435b94=_[_0xba1a('0x1f')](_0x78ac04,function(_0x24d5c2,_0x4d77e2){var _0x11a6f2=_[_0xba1a('0x23')](_0x24d5c2[_0xba1a('0x24')])?util[_0xba1a('0x21')](_0xba1a('0x25'),_0x24d5c2['name']):_0x24d5c2['interface'];return _0x11a6f2;});for(var _0x1805b0 in _0x3f37f7){if(_0x3f37f7['hasOwnProperty'](_0x1805b0)){if(!_0x435b94[_0x1805b0]){delete _0x3f37f7[_0x1805b0];}}}}function clearVoiceCallReports(_0x5af364){_0x5af364[_0xba1a('0x26')]=0x0;_0x5af364[_0xba1a('0x27')]=0x0;_0x5af364[_0xba1a('0x28')]=0x0;_0x5af364[_0xba1a('0x29')]=0x0;_0x5af364[_0xba1a('0x2a')]=0x0;}function clearCampaigns(_0x545633){if(!_[_0xba1a('0x2b')](_0x545633)){for(var _0x50069a in _0x545633){if(_0x545633['hasOwnProperty'](_0x50069a)){_0x545633[_0x50069a][_0xba1a('0x2c')]=0x0;_0x545633[_0x50069a][_0xba1a('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x2b1469){if(!_[_0xba1a('0x2b')](_0x2b1469)){for(var _0x405ab4 in _0x2b1469){if(_0x2b1469[_0xba1a('0x20')](_0x405ab4)){_0x2b1469[_0x405ab4][_0xba1a('0x26')]=0x0;_0x2b1469[_0x405ab4]['answered']=0x0;_0x2b1469[_0x405ab4]['unmanaged']=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x2e')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x28')]=0x0;_0x2b1469[_0x405ab4]['sumDuration']=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x2a')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x2f')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x30')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x31')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x32')]=0x0;_0x2b1469[_0x405ab4]['outboundNoSuchCallsDay']=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x33')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x34')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x35')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x36')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x37')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x38')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x39')]=0x0;_0x2b1469[_0x405ab4]['outboundAnswerAgiCallsDay']=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x3a')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x3b')]=!![];}}}}Realtime['prototype'][_0xba1a('0x3c')]=function(_0x2a6b82,_0x58eecb){for(var _0x63126e in _0x58eecb){if(_0x2a6b82[_0xba1a('0x20')](_0x63126e)){_0x2a6b82[_0x63126e]=_0x58eecb[_0x63126e];}}};Realtime['prototype'][_0xba1a('0x3d')]=function(){var _0xcc27d3=this;return function(_0x5cf891){if(_0x5cf891){freeIsNotKeyAgent(_0x5cf891,_0xcc27d3[_0xba1a('0x3e')]);for(var _0x345326=0x0,_0x26382c={},_0x52a308={};_0x345326<_0x5cf891[_0xba1a('0x3f')];_0x345326+=0x1){_0x26382c=_0x5cf891[_0x345326];var _0x3f5e1f=_[_0xba1a('0x23')](_0x26382c[_0xba1a('0x24')])?util['format']('SIP/%s',_0x26382c[_0xba1a('0x22')]):_0x26382c[_0xba1a('0x24')];if(_[_0xba1a('0x40')](_0xcc27d3[_0xba1a('0x3e')][_0x3f5e1f])){_0xcc27d3['agents'][_0x3f5e1f]=new Agent(_0x26382c);}else{_0xcc27d3[_0xba1a('0x3c')](_0xcc27d3[_0xba1a('0x3e')][_0x3f5e1f],_0x26382c);}}}return _0xcc27d3[_0xba1a('0x3e')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x42')]=function(){var _0x31ab76=this;return function(_0x2fe79c){if(_0x2fe79c){freeIsNotKeySip(_0x2fe79c,_0x31ab76['telephones']);for(var _0x573642=0x0,_0x2bbdf0={},_0x18b659={};_0x573642<_0x2fe79c[_0xba1a('0x3f')];_0x573642+=0x1){_0x2bbdf0=_0x2fe79c[_0x573642];if(_[_0xba1a('0x40')](_0x31ab76[_0xba1a('0x43')][util[_0xba1a('0x21')](_0xba1a('0x25'),_0x2bbdf0[_0xba1a('0x22')])])){_0x31ab76[_0xba1a('0x43')][util[_0xba1a('0x21')](_0xba1a('0x25'),_0x2bbdf0[_0xba1a('0x22')])]=new Telephone(_0x2bbdf0);}else{_0x31ab76[_0xba1a('0x3c')](_0x31ab76[_0xba1a('0x43')][util[_0xba1a('0x21')](_0xba1a('0x25'),_0x2bbdf0[_0xba1a('0x22')])],_0x2bbdf0);}}}return _0x31ab76[_0xba1a('0x43')];};};Realtime[_0xba1a('0x41')]['initTrunks']=function(){var _0x3d1b8a=this;return function(_0x45b84e){if(_0x45b84e){freeIsNotKeySip(_0x45b84e,_0x3d1b8a[_0xba1a('0xe')]);for(var _0x5d9943=0x0,_0x4c1fc4={},_0x45a22f={};_0x5d9943<_0x45b84e[_0xba1a('0x3f')];_0x5d9943+=0x1){_0x4c1fc4=_0x45b84e[_0x5d9943];if(_[_0xba1a('0x40')](_0x3d1b8a[_0xba1a('0xe')][util['format']('SIP/%s',_0x4c1fc4[_0xba1a('0x22')])])){_0x3d1b8a['trunks'][util['format'](_0xba1a('0x25'),_0x4c1fc4['name'])]=new Trunk(_0x4c1fc4);}else{_0x3d1b8a[_0xba1a('0x3c')](_0x3d1b8a[_0xba1a('0xe')][util['format'](_0xba1a('0x25'),_0x4c1fc4[_0xba1a('0x22')])],_0x4c1fc4);}}}return _0x3d1b8a['trunks'];};};Realtime[_0xba1a('0x41')][_0xba1a('0x44')]=function(){var _0x37e0b5=this;return function(_0x57384c){if(_0x57384c){freeIsNotKey(_0x57384c,_0x37e0b5[_0xba1a('0xf')],'name');for(var _0x116ee4=0x0,_0x13ebdd={},_0x3e1995={};_0x116ee4<_0x57384c[_0xba1a('0x3f')];_0x116ee4+=0x1){_0x13ebdd=_0x57384c[_0x116ee4];if(_['isUndefined'](_0x37e0b5[_0xba1a('0xf')][_0x13ebdd[_0xba1a('0x22')]])){_0x37e0b5[_0xba1a('0xf')][_0x13ebdd[_0xba1a('0x22')]]=new VoiceQueue(_0x13ebdd);}else{_0x37e0b5[_0xba1a('0x3c')](_0x37e0b5[_0xba1a('0xf')][_0x13ebdd['name']],_0x13ebdd);}}}return _0x37e0b5[_0xba1a('0xf')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x45')]=function(){var _0x4dc0e4=this;return function(_0x4ab269){if(_0x4ab269){freeIsNotKey(_0x4ab269,_0x4dc0e4[_0xba1a('0x10')],'id');for(var _0x388589=0x0,_0x54d60b={},_0x4fcc23={};_0x388589<_0x4ab269[_0xba1a('0x3f')];_0x388589+=0x1){_0x54d60b=_0x4ab269[_0x388589];if(_[_0xba1a('0x40')](_0x4dc0e4['triggers'][_0x54d60b['id']])){_0x4dc0e4[_0xba1a('0x10')][_0x54d60b['id']]=new Trigger(_0x54d60b);}else{_0x4dc0e4[_0xba1a('0x3c')](_0x4dc0e4[_0xba1a('0x10')][_0x54d60b['id']],_0x54d60b);}}}return _0x4dc0e4[_0xba1a('0x10')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x46')]=function(){var _0x243586=this;return function(_0x7e5cce){if(_0x7e5cce){freeIsNotKey(_0x7e5cce,_0x243586[_0xba1a('0x47')],'id');for(var _0x4f1ed3=0x0,_0x3001c6={},_0x473019={};_0x4f1ed3<_0x7e5cce[_0xba1a('0x3f')];_0x4f1ed3+=0x1){_0x3001c6=_0x7e5cce[_0x4f1ed3];if(_[_0xba1a('0x40')](_0x243586['templates'][_0x3001c6['id']])){_0x243586[_0xba1a('0x47')][_0x3001c6['id']]=new Template(_0x3001c6);}else{_0x243586['mergeFromDatabase'](_0x243586['templates'][_0x3001c6['id']],_0x3001c6);}}}return _0x243586['templates'];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x17e191=this;return function(_0x5d2837){if(_0x5d2837){freeIsNotKey(_0x5d2837,_0x17e191[_0xba1a('0x17')],'id');for(var _0x11612e=0x0,_0x544d4a={},_0x4c2692={};_0x11612e<_0x5d2837[_0xba1a('0x3f')];_0x11612e+=0x1){_0x544d4a=_0x5d2837[_0x11612e];if(_[_0xba1a('0x40')](_0x17e191[_0xba1a('0x17')][_0x544d4a['id']])){_0x17e191[_0xba1a('0x17')][_0x544d4a['id']]=new ZendeskAccount(_0x544d4a);}else{_0x17e191[_0xba1a('0x3c')](_0x17e191['zendeskAccounts'][_0x544d4a['id']],_0x544d4a);}}}return _0x17e191[_0xba1a('0x17')];};};Realtime['prototype'][_0xba1a('0x48')]=function(){var _0x426d9c=this;return function(_0x328b6a){if(_0x328b6a){freeIsNotKey(_0x328b6a,_0x426d9c[_0xba1a('0x49')],'id');for(var _0x2c1261=0x0,_0x5b2d46={},_0x215751={};_0x2c1261<_0x328b6a[_0xba1a('0x3f')];_0x2c1261+=0x1){_0x5b2d46=_0x328b6a[_0x2c1261];if(_[_0xba1a('0x40')](_0x426d9c[_0xba1a('0x49')][_0x5b2d46['id']])){_0x426d9c[_0xba1a('0x49')][_0x5b2d46['id']]=new SalesforceAccount(_0x5b2d46);}else{_0x426d9c['mergeFromDatabase'](_0x426d9c['salesforceAccounts'][_0x5b2d46['id']],_0x5b2d46);}}}return _0x426d9c[_0xba1a('0x49')];};};Realtime['prototype'][_0xba1a('0x4a')]=function(){var _0x1cb404=this;return function(_0x52942d){if(_0x52942d){freeIsNotKey(_0x52942d,_0x1cb404['freshdeskAccounts'],'id');for(var _0x332036=0x0,_0x4c57a8={},_0x5ce3b9={};_0x332036<_0x52942d[_0xba1a('0x3f')];_0x332036+=0x1){_0x4c57a8=_0x52942d[_0x332036];if(_['isUndefined'](_0x1cb404[_0xba1a('0x4b')][_0x4c57a8['id']])){_0x1cb404['freshdeskAccounts'][_0x4c57a8['id']]=new FreshdeskAccount(_0x4c57a8);}else{_0x1cb404[_0xba1a('0x3c')](_0x1cb404[_0xba1a('0x4b')][_0x4c57a8['id']],_0x4c57a8);}}}return _0x1cb404['freshdeskAccounts'];};};Realtime['prototype'][_0xba1a('0x4c')]=function(){var _0x499281=this;return function(_0x335059){if(_0x335059){freeIsNotKey(_0x335059,_0x499281['zohoAccounts'],'id');for(var _0x58af3d=0x0,_0x2fc2a9={},_0x3cf85e={};_0x58af3d<_0x335059['length'];_0x58af3d+=0x1){_0x2fc2a9=_0x335059[_0x58af3d];if(_[_0xba1a('0x40')](_0x499281['zohoAccounts'][_0x2fc2a9['id']])){_0x499281[_0xba1a('0x19')][_0x2fc2a9['id']]=new ZohoAccount(_0x2fc2a9);}else{_0x499281[_0xba1a('0x3c')](_0x499281[_0xba1a('0x19')][_0x2fc2a9['id']],_0x2fc2a9);}}}return _0x499281[_0xba1a('0x19')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x4d')]=function(){var _0x402010=this;return function(_0x30bf93){if(_0x30bf93){freeIsNotKey(_0x30bf93,_0x402010[_0xba1a('0x4e')],'id');for(var _0x2e28c4=0x0,_0x1e46b7={},_0x1564c5={};_0x2e28c4<_0x30bf93['length'];_0x2e28c4+=0x1){_0x1e46b7=_0x30bf93[_0x2e28c4];if(_['isUndefined'](_0x402010[_0xba1a('0x4e')][_0x1e46b7['id']])){_0x402010[_0xba1a('0x4e')][_0x1e46b7['id']]=new DeskAccount(_0x1e46b7);}else{_0x402010[_0xba1a('0x3c')](_0x402010[_0xba1a('0x4e')][_0x1e46b7['id']],_0x1e46b7);}}}return _0x402010[_0xba1a('0x4e')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x4f')]=function(){var _0x50b860=this;return function(_0x5846a4){if(_0x5846a4){freeIsNotKey(_0x5846a4,_0x50b860[_0xba1a('0x18')],'id');for(var _0x23c221=0x0,_0x378298={},_0x3cf6f3={};_0x23c221<_0x5846a4[_0xba1a('0x3f')];_0x23c221+=0x1){_0x378298=_0x5846a4[_0x23c221];if(_[_0xba1a('0x40')](_0x50b860[_0xba1a('0x18')][_0x378298['id']])){_0x50b860[_0xba1a('0x18')][_0x378298['id']]=new SugarcrmAccount(_0x378298);}else{_0x50b860[_0xba1a('0x3c')](_0x50b860[_0xba1a('0x18')][_0x378298['id']],_0x378298);}}}return _0x50b860[_0xba1a('0x18')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x50')]=function(){var _0x26858e=this;return function(_0x475675){if(_0x475675){freeIsNotKey(_0x475675,_0x26858e[_0xba1a('0x1a')],'id');for(var _0x5c39cf=0x0,_0x2680fc={},_0x2987f5={};_0x5c39cf<_0x475675[_0xba1a('0x3f')];_0x5c39cf+=0x1){_0x2680fc=_0x475675[_0x5c39cf];if(_[_0xba1a('0x40')](_0x26858e[_0xba1a('0x1a')][_0x2680fc['id']])){_0x26858e['vtigerAccounts'][_0x2680fc['id']]=new VtigerAccount(_0x2680fc);}else{_0x26858e[_0xba1a('0x3c')](_0x26858e[_0xba1a('0x1a')][_0x2680fc['id']],_0x2680fc);}}}return _0x26858e[_0xba1a('0x1a')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x51')]=function(){var _0x295fdc=this;return function(_0x266dff){if(_0x266dff){freeIsNotKey(_0x266dff,_0x295fdc[_0xba1a('0x1b')],'id');for(var _0x1fdb47=0x0,_0x3d14fe={},_0x197c14={};_0x1fdb47<_0x266dff[_0xba1a('0x3f')];_0x1fdb47+=0x1){_0x3d14fe=_0x266dff[_0x1fdb47];if(_[_0xba1a('0x40')](_0x295fdc[_0xba1a('0x1b')][_0x3d14fe['id']])){_0x295fdc[_0xba1a('0x1b')][_0x3d14fe['id']]=new ServicenowAccount(_0x3d14fe);}else{_0x295fdc['mergeFromDatabase'](_0x295fdc[_0xba1a('0x1b')][_0x3d14fe['id']],_0x3d14fe);}}}return _0x295fdc[_0xba1a('0x1b')];};};Realtime['prototype'][_0xba1a('0x52')]=function(){var _0x3aaeff=this;return function(_0x2ba468){if(_0x2ba468){freeIsNotKey(_0x2ba468,_0x3aaeff[_0xba1a('0x1c')],'id');for(var _0x5049f4=0x0,_0x9d835c={},_0x114bb1={};_0x5049f4<_0x2ba468[_0xba1a('0x3f')];_0x5049f4+=0x1){_0x9d835c=_0x2ba468[_0x5049f4];if(_[_0xba1a('0x40')](_0x3aaeff[_0xba1a('0x1c')][_0x9d835c['id']])){_0x3aaeff[_0xba1a('0x1c')][_0x9d835c['id']]=new Dynamics365Account(_0x9d835c);}else{_0x3aaeff[_0xba1a('0x3c')](_0x3aaeff['dynamics365Accounts'][_0x9d835c['id']],_0x9d835c);}}}return _0x3aaeff[_0xba1a('0x1c')];};};Realtime[_0xba1a('0x41')]['initFreshsalesAccounts']=function(){var _0x4c0387=this;return function(_0x328f16){if(_0x328f16){freeIsNotKey(_0x328f16,_0x4c0387[_0xba1a('0x1d')],'id');for(var _0x109599=0x0,_0xa38df5={},_0xbffd4c={};_0x109599<_0x328f16['length'];_0x109599+=0x1){_0xa38df5=_0x328f16[_0x109599];if(_[_0xba1a('0x40')](_0x4c0387[_0xba1a('0x1d')][_0xa38df5['id']])){_0x4c0387[_0xba1a('0x1d')][_0xa38df5['id']]=new FreshsalesAccount(_0xa38df5);}else{_0x4c0387[_0xba1a('0x3c')](_0x4c0387[_0xba1a('0x1d')][_0xa38df5['id']],_0xa38df5);}}}return _0x4c0387[_0xba1a('0x1d')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x53')]=function(){var _0x131bf=this;return function(_0x5f4674){for(var _0x129ae7=0x0;_0x129ae7<_0x5f4674[_0xba1a('0x3f')];_0x129ae7+=0x1){_['merge'](_0x131bf['voiceQueues'][_0x5f4674[_0x129ae7][_0xba1a('0x22')]],_0x5f4674[_0x129ae7]);}return _0x131bf['voiceQueues'];};};Realtime[_0xba1a('0x41')][_0xba1a('0x54')]=function(){var _0xba951a=this;return function(_0x575324){clearVoiceQueues(_0xba951a[_0xba1a('0xf')]);if(_0x575324){_0x575324=_[_0xba1a('0x55')](_0x575324,'uniqueid');for(var _0x18ea6b in _0x575324){if(_0x575324[_0xba1a('0x20')](_0x18ea6b)){var _0x1ed222={};for(var _0x45c901=0x0;_0x45c901<_0x575324[_0x18ea6b][_0xba1a('0x3f')];_0x45c901+=0x1){var _0x117c98=_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x56')];if(_0xba951a[_0xba1a('0xf')][_0x117c98]){if(_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x57')]){_0xba951a['voiceQueues'][_0x117c98]['unmanaged']+=0x1;}if(_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x58')]){_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x2e')]+=0x1;}_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x28')]+=moment(_0x575324[_0x18ea6b][_0x45c901]['queuecallerleaveAt'])[_0xba1a('0x59')](moment(_0x575324[_0x18ea6b][_0x45c901]['queuecallerjoinAt']),_0xba1a('0x5a'))||0x0;if(_0x45c901===_0x575324[_0x18ea6b][_0xba1a('0x3f')]-0x1){_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x29')]+=moment(_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x5b')]||_0x575324[_0x18ea6b][_0x45c901]['queuecallerabandonAt']||_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x5c')])[_0xba1a('0x59')](moment(_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x5d')]),'seconds')||0x0;_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x26')]+=0x1;if(_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x5e')]){_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x27')]+=0x1;_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x2a')]+=moment(_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x5b')])['diff'](moment(_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x5f')]),_0xba1a('0x5a'))||0x0;}}else{_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x29')]+=_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x28')]||0x0;}}}}}}return _0xba951a['voiceQueues'];};};Realtime[_0xba1a('0x41')][_0xba1a('0x60')]=function(){var _0xd21272=this;return function(_0x3a1e73){clearVoiceCallReports(_0xd21272[_0xba1a('0x12')]);if(_0x3a1e73){for(var _0x5c4f7f=0x0;_0x5c4f7f<_0x3a1e73[_0xba1a('0x3f')];_0x5c4f7f+=0x1){_0xd21272['outbound'][_0xba1a('0x26')]+=0x1;_0xd21272['outbound'][_0xba1a('0x29')]+=_0x3a1e73[_0x5c4f7f][_0xba1a('0x61')];if(_0x3a1e73[_0x5c4f7f]['disposition']===_0xba1a('0x62')){_0xd21272[_0xba1a('0x12')][_0xba1a('0x27')]+=0x1;_0xd21272['outbound']['sumHoldTime']+=_0x3a1e73[_0x5c4f7f]['duration']-_0x3a1e73[_0x5c4f7f][_0xba1a('0x63')]||0x0;_0xd21272['outbound'][_0xba1a('0x2a')]+=_0x3a1e73[_0x5c4f7f][_0xba1a('0x63')];}}}return _0xd21272[_0xba1a('0x12')];};};Realtime['prototype']['initCampaigns']=function(){var _0x5ed6d1=this;return function(_0x1525be){if(_0x1525be){freeIsNotKey(_0x1525be,_0x5ed6d1[_0xba1a('0x11')],_0xba1a('0x22'));for(var _0x5d668d=0x0,_0x53de40={};_0x5d668d<_0x1525be[_0xba1a('0x3f')];_0x5d668d+=0x1){_0x53de40=_0x1525be[_0x5d668d];if(_[_0xba1a('0x40')](_0x5ed6d1[_0xba1a('0x11')][_0x53de40[_0xba1a('0x22')]])){_0x5ed6d1[_0xba1a('0x11')][_0x53de40[_0xba1a('0x22')]]=new Campaign(_0x53de40);}else{_0x5ed6d1[_0xba1a('0x3c')](_0x5ed6d1[_0xba1a('0x11')][_0x53de40['name']],_0x53de40);_0x5ed6d1[_0xba1a('0x11')][_0x53de40[_0xba1a('0x22')]][_0xba1a('0x64')]=_0x53de40['SquareProject']?_0x53de40[_0xba1a('0x65')][_0xba1a('0x22')]:undefined;}}}return _0x5ed6d1[_0xba1a('0x11')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x66')]=function(){var _0x331b90=this;return function(_0x71e03a){if(_0x71e03a){freeIsNotKey(_0x71e03a,_0x331b90['voiceExtensions'],'id');for(var _0x56ba94=0x0,_0x5a10de={};_0x56ba94<_0x71e03a[_0xba1a('0x3f')];_0x56ba94+=0x1){_0x5a10de=_0x71e03a[_0x56ba94];if(_[_0xba1a('0x40')](_0x331b90['voiceExtensions'][_0x5a10de['id']])){_0x331b90[_0xba1a('0x13')][_0x5a10de['id']]=new VoiceExtension(_0x5a10de);}else{_0x331b90[_0xba1a('0x3c')](_0x331b90[_0xba1a('0x13')][_0x5a10de['id']],_0x5a10de);}}}return _0x331b90[_0xba1a('0x13')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x67')]=function(){var _0x3e4887=this;return function(_0x30bd34){clearCampaigns(_0x3e4887[_0xba1a('0x11')]);for(var _0x48829e=0x0;_0x48829e<_0x30bd34[_0xba1a('0x3f')];_0x48829e+=0x1){_['merge'](_0x3e4887['campaigns'][_0x30bd34[_0x48829e][_0xba1a('0x22')]],_0x30bd34[_0x48829e]);}return _0x3e4887[_0xba1a('0x11')];};};Realtime[_0xba1a('0x41')]['initFaxAccounts']=function(){var _0x12fe95=this;return function(_0x22d33c){if(_0x22d33c){freeIsNotKey(_0x22d33c,_0x12fe95[_0xba1a('0x1e')],'id');for(var _0x905965=0x0,_0x2532f7={},_0x575ea4={};_0x905965<_0x22d33c[_0xba1a('0x3f')];_0x905965+=0x1){_0x2532f7=_0x22d33c[_0x905965];if(_['isUndefined'](_0x12fe95[_0xba1a('0x1e')][_0x2532f7['id']])){_0x12fe95[_0xba1a('0x1e')][_0x2532f7['id']]=new FaxAccount(_0x2532f7);}else{_0x12fe95['mergeFromDatabase'](_0x12fe95[_0xba1a('0x1e')][_0x2532f7['id']],_0x2532f7);}}}return _0x12fe95[_0xba1a('0x1e')];};};module[_0xba1a('0x68')]=Realtime; \ No newline at end of file +var _0x20a3=['initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','uniqueid','queue','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','initVoiceCallReports','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','outboundChannels','timers','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumDuration','sumBillable','isEmpty','unmanaged','sumHoldTime','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','mergeFromDatabase','initTelephones','trunks','initVoiceQueues'];(function(_0x555615,_0x5125de){var _0x52461a=function(_0xef5ac2){while(--_0xef5ac2){_0x555615['push'](_0x555615['shift']());}};_0x52461a(++_0x5125de);}(_0x20a3,0x15b));var _0x320a=function(_0x298fca,_0x501450){_0x298fca=_0x298fca-0x0;var _0x34ca1c=_0x20a3[_0x298fca];return _0x34ca1c;};'use strict';var BPromise=require(_0x320a('0x0'));var util=require('util');var _=require(_0x320a('0x1'));var moment=require(_0x320a('0x2'));var Agent=require(_0x320a('0x3'));var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x320a('0x4'));var Template=require(_0x320a('0x5'));var Campaign=require(_0x320a('0x6'));var VoiceExtension=require(_0x320a('0x7'));var ZendeskAccount=require(_0x320a('0x8'));var SalesforceAccount=require(_0x320a('0x9'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x320a('0xa'));var DeskAccount=require(_0x320a('0xb'));var VtigerAccount=require(_0x320a('0xc'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x320a('0xd'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x320a('0xe')]={};this[_0x320a('0xf')]={};this['trunks']={};this[_0x320a('0x10')]={};this[_0x320a('0x11')]={};this['campaigns']={};this[_0x320a('0x12')]={};this[_0x320a('0x13')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x320a('0x14')]={};this[_0x320a('0x15')]={};this['queueChannels']={};this[_0x320a('0x16')]={};this[_0x320a('0x17')]={};this[_0x320a('0x18')]={};this['salesforceAccounts']={};this[_0x320a('0x19')]={};this[_0x320a('0x1a')]={};this['zohoAccounts']={};this[_0x320a('0x1b')]={};this['vtigerAccounts']={};this[_0x320a('0x1c')]={};this[_0x320a('0x1d')]={};this[_0x320a('0x1e')]={};this[_0x320a('0x1f')]={};};function freeIsNotKey(_0x501cd2,_0x25124f,_0x52544c){var _0x51ae9d=_[_0x320a('0x20')](_0x501cd2,function(_0x59733d,_0x34f183){return _0x59733d[_0x52544c];});for(var _0x3a1911 in _0x25124f){if(_0x25124f[_0x320a('0x21')](_0x3a1911)){if(!_0x51ae9d[_0x3a1911]){delete _0x25124f[_0x3a1911];}}}}function freeIsNotKeySip(_0x45bb6b,_0x15cd33){var _0x5e20b7=_[_0x320a('0x20')](_0x45bb6b,function(_0x147c7f,_0x57fd83){return util[_0x320a('0x22')](_0x320a('0x23'),_0x147c7f[_0x320a('0x24')]);});for(var _0x37b0ae in _0x15cd33){if(_0x15cd33[_0x320a('0x21')](_0x37b0ae)){if(!_0x5e20b7[_0x37b0ae]){delete _0x15cd33[_0x37b0ae];}}}}function freeIsNotKeyAgent(_0xdf229d,_0x1471aa){var _0x3029b9=_[_0x320a('0x20')](_0xdf229d,function(_0x4e5c99,_0x9001c0){var _0x20f59d=_[_0x320a('0x25')](_0x4e5c99['interface'])?util[_0x320a('0x22')](_0x320a('0x23'),_0x4e5c99[_0x320a('0x24')]):_0x4e5c99[_0x320a('0x26')];return _0x20f59d;});for(var _0x18854a in _0x1471aa){if(_0x1471aa[_0x320a('0x21')](_0x18854a)){if(!_0x3029b9[_0x18854a]){delete _0x1471aa[_0x18854a];}}}}function clearVoiceCallReports(_0x40af50){_0x40af50[_0x320a('0x27')]=0x0;_0x40af50[_0x320a('0x28')]=0x0;_0x40af50['sumHoldTime']=0x0;_0x40af50[_0x320a('0x29')]=0x0;_0x40af50[_0x320a('0x2a')]=0x0;}function clearCampaigns(_0x2cf1d1){if(!_[_0x320a('0x2b')](_0x2cf1d1)){for(var _0xbc3212 in _0x2cf1d1){if(_0x2cf1d1['hasOwnProperty'](_0xbc3212)){_0x2cf1d1[_0xbc3212]['ivrTotalCallsDays']=0x0;_0x2cf1d1[_0xbc3212]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x8457e3){if(!_[_0x320a('0x2b')](_0x8457e3)){for(var _0x225f02 in _0x8457e3){if(_0x8457e3[_0x320a('0x21')](_0x225f02)){_0x8457e3[_0x225f02][_0x320a('0x27')]=0x0;_0x8457e3[_0x225f02][_0x320a('0x28')]=0x0;_0x8457e3[_0x225f02][_0x320a('0x2c')]=0x0;_0x8457e3[_0x225f02]['abandoned']=0x0;_0x8457e3[_0x225f02][_0x320a('0x2d')]=0x0;_0x8457e3[_0x225f02][_0x320a('0x29')]=0x0;_0x8457e3[_0x225f02][_0x320a('0x2a')]=0x0;_0x8457e3[_0x225f02][_0x320a('0x2e')]=0x0;_0x8457e3[_0x225f02]['outboundNoAnswerCallsDay']=0x0;_0x8457e3[_0x225f02]['outboundBusyCallsDay']=0x0;_0x8457e3[_0x225f02][_0x320a('0x2f')]=0x0;_0x8457e3[_0x225f02][_0x320a('0x30')]=0x0;_0x8457e3[_0x225f02][_0x320a('0x31')]=0x0;_0x8457e3[_0x225f02]['outboundDropCallsDayTimeout']=0x0;_0x8457e3[_0x225f02][_0x320a('0x32')]=0x0;_0x8457e3[_0x225f02][_0x320a('0x33')]=0x0;_0x8457e3[_0x225f02][_0x320a('0x34')]=0x0;_0x8457e3[_0x225f02][_0x320a('0x35')]=0x0;_0x8457e3[_0x225f02][_0x320a('0x36')]=0x0;_0x8457e3[_0x225f02][_0x320a('0x2e')]=0x0;_0x8457e3[_0x225f02][_0x320a('0x37')]=0x0;_0x8457e3[_0x225f02][_0x320a('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x3a7d87,_0x3f5d0f){for(var _0x14553c in _0x3f5d0f){if(_0x3a7d87['hasOwnProperty'](_0x14553c)){_0x3a7d87[_0x14553c]=_0x3f5d0f[_0x14553c];}}};Realtime[_0x320a('0x39')][_0x320a('0x3a')]=function(){var _0x403839=this;return function(_0xb06745){if(_0xb06745){freeIsNotKeyAgent(_0xb06745,_0x403839[_0x320a('0xe')]);for(var _0x5a8e98=0x0,_0x518335={},_0x4c269f={};_0x5a8e98<_0xb06745[_0x320a('0x3b')];_0x5a8e98+=0x1){_0x518335=_0xb06745[_0x5a8e98];var _0x2b33b4=_[_0x320a('0x25')](_0x518335[_0x320a('0x26')])?util[_0x320a('0x22')](_0x320a('0x23'),_0x518335[_0x320a('0x24')]):_0x518335['interface'];if(_[_0x320a('0x3c')](_0x403839['agents'][_0x2b33b4])){_0x403839[_0x320a('0xe')][_0x2b33b4]=new Agent(_0x518335);}else{_0x403839[_0x320a('0x3d')](_0x403839[_0x320a('0xe')][_0x2b33b4],_0x518335);}}}return _0x403839[_0x320a('0xe')];};};Realtime['prototype'][_0x320a('0x3e')]=function(){var _0x12be96=this;return function(_0x31096a){if(_0x31096a){freeIsNotKeySip(_0x31096a,_0x12be96['telephones']);for(var _0x1977b9=0x0,_0x199816={},_0x706ed2={};_0x1977b9<_0x31096a[_0x320a('0x3b')];_0x1977b9+=0x1){_0x199816=_0x31096a[_0x1977b9];if(_[_0x320a('0x3c')](_0x12be96[_0x320a('0xf')][util[_0x320a('0x22')](_0x320a('0x23'),_0x199816[_0x320a('0x24')])])){_0x12be96['telephones'][util['format']('SIP/%s',_0x199816['name'])]=new Telephone(_0x199816);}else{_0x12be96[_0x320a('0x3d')](_0x12be96[_0x320a('0xf')][util[_0x320a('0x22')](_0x320a('0x23'),_0x199816[_0x320a('0x24')])],_0x199816);}}}return _0x12be96[_0x320a('0xf')];};};Realtime['prototype']['initTrunks']=function(){var _0x4ce8ac=this;return function(_0x3e39af){if(_0x3e39af){freeIsNotKeySip(_0x3e39af,_0x4ce8ac[_0x320a('0x3f')]);for(var _0x1da289=0x0,_0x2f42eb={},_0x314f45={};_0x1da289<_0x3e39af[_0x320a('0x3b')];_0x1da289+=0x1){_0x2f42eb=_0x3e39af[_0x1da289];if(_[_0x320a('0x3c')](_0x4ce8ac['trunks'][util[_0x320a('0x22')](_0x320a('0x23'),_0x2f42eb[_0x320a('0x24')])])){_0x4ce8ac['trunks'][util[_0x320a('0x22')](_0x320a('0x23'),_0x2f42eb['name'])]=new Trunk(_0x2f42eb);}else{_0x4ce8ac['mergeFromDatabase'](_0x4ce8ac[_0x320a('0x3f')][util[_0x320a('0x22')](_0x320a('0x23'),_0x2f42eb['name'])],_0x2f42eb);}}}return _0x4ce8ac[_0x320a('0x3f')];};};Realtime[_0x320a('0x39')][_0x320a('0x40')]=function(){var _0x42ebeb=this;return function(_0x283637){if(_0x283637){freeIsNotKey(_0x283637,_0x42ebeb[_0x320a('0x10')],_0x320a('0x24'));for(var _0x3b5276=0x0,_0xfb54d9={},_0x445b92={};_0x3b5276<_0x283637[_0x320a('0x3b')];_0x3b5276+=0x1){_0xfb54d9=_0x283637[_0x3b5276];if(_[_0x320a('0x3c')](_0x42ebeb[_0x320a('0x10')][_0xfb54d9['name']])){_0x42ebeb[_0x320a('0x10')][_0xfb54d9[_0x320a('0x24')]]=new VoiceQueue(_0xfb54d9);}else{_0x42ebeb[_0x320a('0x3d')](_0x42ebeb[_0x320a('0x10')][_0xfb54d9[_0x320a('0x24')]],_0xfb54d9);}}}return _0x42ebeb['voiceQueues'];};};Realtime[_0x320a('0x39')][_0x320a('0x41')]=function(){var _0x33d23c=this;return function(_0x1410e3){if(_0x1410e3){freeIsNotKey(_0x1410e3,_0x33d23c[_0x320a('0x11')],'id');for(var _0x54e870=0x0,_0x31ae5f={},_0x59f107={};_0x54e870<_0x1410e3['length'];_0x54e870+=0x1){_0x31ae5f=_0x1410e3[_0x54e870];if(_[_0x320a('0x3c')](_0x33d23c[_0x320a('0x11')][_0x31ae5f['id']])){_0x33d23c[_0x320a('0x11')][_0x31ae5f['id']]=new Trigger(_0x31ae5f);}else{_0x33d23c[_0x320a('0x3d')](_0x33d23c[_0x320a('0x11')][_0x31ae5f['id']],_0x31ae5f);}}}return _0x33d23c[_0x320a('0x11')];};};Realtime[_0x320a('0x39')][_0x320a('0x42')]=function(){var _0x236158=this;return function(_0x51825b){if(_0x51825b){freeIsNotKey(_0x51825b,_0x236158[_0x320a('0x12')],'id');for(var _0xb1b798=0x0,_0x404416={},_0x2010fc={};_0xb1b798<_0x51825b['length'];_0xb1b798+=0x1){_0x404416=_0x51825b[_0xb1b798];if(_['isUndefined'](_0x236158[_0x320a('0x12')][_0x404416['id']])){_0x236158[_0x320a('0x12')][_0x404416['id']]=new Template(_0x404416);}else{_0x236158['mergeFromDatabase'](_0x236158[_0x320a('0x12')][_0x404416['id']],_0x404416);}}}return _0x236158[_0x320a('0x12')];};};Realtime['prototype'][_0x320a('0x43')]=function(){var _0x35717c=this;return function(_0x435912){if(_0x435912){freeIsNotKey(_0x435912,_0x35717c['zendeskAccounts'],'id');for(var _0x14a838=0x0,_0x54561a={},_0x2b927d={};_0x14a838<_0x435912['length'];_0x14a838+=0x1){_0x54561a=_0x435912[_0x14a838];if(_[_0x320a('0x3c')](_0x35717c['zendeskAccounts'][_0x54561a['id']])){_0x35717c['zendeskAccounts'][_0x54561a['id']]=new ZendeskAccount(_0x54561a);}else{_0x35717c[_0x320a('0x3d')](_0x35717c['zendeskAccounts'][_0x54561a['id']],_0x54561a);}}}return _0x35717c[_0x320a('0x18')];};};Realtime[_0x320a('0x39')][_0x320a('0x44')]=function(){var _0x18216e=this;return function(_0x40dea2){if(_0x40dea2){freeIsNotKey(_0x40dea2,_0x18216e['salesforceAccounts'],'id');for(var _0x59cb26=0x0,_0x13cbca={},_0x21d02f={};_0x59cb26<_0x40dea2['length'];_0x59cb26+=0x1){_0x13cbca=_0x40dea2[_0x59cb26];if(_['isUndefined'](_0x18216e['salesforceAccounts'][_0x13cbca['id']])){_0x18216e['salesforceAccounts'][_0x13cbca['id']]=new SalesforceAccount(_0x13cbca);}else{_0x18216e[_0x320a('0x3d')](_0x18216e[_0x320a('0x45')][_0x13cbca['id']],_0x13cbca);}}}return _0x18216e[_0x320a('0x45')];};};Realtime[_0x320a('0x39')][_0x320a('0x46')]=function(){var _0x39ce20=this;return function(_0x2c080a){if(_0x2c080a){freeIsNotKey(_0x2c080a,_0x39ce20[_0x320a('0x1a')],'id');for(var _0x40d046=0x0,_0x4cdc38={},_0x5914be={};_0x40d046<_0x2c080a['length'];_0x40d046+=0x1){_0x4cdc38=_0x2c080a[_0x40d046];if(_[_0x320a('0x3c')](_0x39ce20[_0x320a('0x1a')][_0x4cdc38['id']])){_0x39ce20['freshdeskAccounts'][_0x4cdc38['id']]=new FreshdeskAccount(_0x4cdc38);}else{_0x39ce20[_0x320a('0x3d')](_0x39ce20[_0x320a('0x1a')][_0x4cdc38['id']],_0x4cdc38);}}}return _0x39ce20[_0x320a('0x1a')];};};Realtime[_0x320a('0x39')][_0x320a('0x47')]=function(){var _0x50aa44=this;return function(_0x34a708){if(_0x34a708){freeIsNotKey(_0x34a708,_0x50aa44[_0x320a('0x48')],'id');for(var _0x208a56=0x0,_0x279227={},_0x327e24={};_0x208a56<_0x34a708[_0x320a('0x3b')];_0x208a56+=0x1){_0x279227=_0x34a708[_0x208a56];if(_[_0x320a('0x3c')](_0x50aa44['zohoAccounts'][_0x279227['id']])){_0x50aa44[_0x320a('0x48')][_0x279227['id']]=new ZohoAccount(_0x279227);}else{_0x50aa44[_0x320a('0x3d')](_0x50aa44['zohoAccounts'][_0x279227['id']],_0x279227);}}}return _0x50aa44[_0x320a('0x48')];};};Realtime[_0x320a('0x39')][_0x320a('0x49')]=function(){var _0x2c63fb=this;return function(_0x13a90f){if(_0x13a90f){freeIsNotKey(_0x13a90f,_0x2c63fb[_0x320a('0x1b')],'id');for(var _0x4c0cc8=0x0,_0x316ac7={},_0x44e4a0={};_0x4c0cc8<_0x13a90f['length'];_0x4c0cc8+=0x1){_0x316ac7=_0x13a90f[_0x4c0cc8];if(_['isUndefined'](_0x2c63fb[_0x320a('0x1b')][_0x316ac7['id']])){_0x2c63fb[_0x320a('0x1b')][_0x316ac7['id']]=new DeskAccount(_0x316ac7);}else{_0x2c63fb[_0x320a('0x3d')](_0x2c63fb[_0x320a('0x1b')][_0x316ac7['id']],_0x316ac7);}}}return _0x2c63fb['deskAccounts'];};};Realtime[_0x320a('0x39')][_0x320a('0x4a')]=function(){var _0x29b207=this;return function(_0x2150d0){if(_0x2150d0){freeIsNotKey(_0x2150d0,_0x29b207['sugarcrmAccounts'],'id');for(var _0x1c3e2b=0x0,_0x1e0ab1={},_0x49cd8e={};_0x1c3e2b<_0x2150d0[_0x320a('0x3b')];_0x1c3e2b+=0x1){_0x1e0ab1=_0x2150d0[_0x1c3e2b];if(_[_0x320a('0x3c')](_0x29b207[_0x320a('0x19')][_0x1e0ab1['id']])){_0x29b207['sugarcrmAccounts'][_0x1e0ab1['id']]=new SugarcrmAccount(_0x1e0ab1);}else{_0x29b207[_0x320a('0x3d')](_0x29b207[_0x320a('0x19')][_0x1e0ab1['id']],_0x1e0ab1);}}}return _0x29b207['sugarcrmAccounts'];};};Realtime[_0x320a('0x39')][_0x320a('0x4b')]=function(){var _0x51847e=this;return function(_0x2a01e0){if(_0x2a01e0){freeIsNotKey(_0x2a01e0,_0x51847e[_0x320a('0x4c')],'id');for(var _0x383c3b=0x0,_0x117a5a={},_0x30769c={};_0x383c3b<_0x2a01e0['length'];_0x383c3b+=0x1){_0x117a5a=_0x2a01e0[_0x383c3b];if(_[_0x320a('0x3c')](_0x51847e[_0x320a('0x4c')][_0x117a5a['id']])){_0x51847e[_0x320a('0x4c')][_0x117a5a['id']]=new VtigerAccount(_0x117a5a);}else{_0x51847e[_0x320a('0x3d')](_0x51847e[_0x320a('0x4c')][_0x117a5a['id']],_0x117a5a);}}}return _0x51847e['vtigerAccounts'];};};Realtime[_0x320a('0x39')][_0x320a('0x4d')]=function(){var _0x470a7b=this;return function(_0x293a30){if(_0x293a30){freeIsNotKey(_0x293a30,_0x470a7b[_0x320a('0x1c')],'id');for(var _0x16dd77=0x0,_0x37ba87={},_0x84d50e={};_0x16dd77<_0x293a30[_0x320a('0x3b')];_0x16dd77+=0x1){_0x37ba87=_0x293a30[_0x16dd77];if(_[_0x320a('0x3c')](_0x470a7b[_0x320a('0x1c')][_0x37ba87['id']])){_0x470a7b[_0x320a('0x1c')][_0x37ba87['id']]=new ServicenowAccount(_0x37ba87);}else{_0x470a7b[_0x320a('0x3d')](_0x470a7b[_0x320a('0x1c')][_0x37ba87['id']],_0x37ba87);}}}return _0x470a7b[_0x320a('0x1c')];};};Realtime[_0x320a('0x39')][_0x320a('0x4e')]=function(){var _0x50a700=this;return function(_0x5618f3){if(_0x5618f3){freeIsNotKey(_0x5618f3,_0x50a700[_0x320a('0x1d')],'id');for(var _0x4ae5a6=0x0,_0x422ad1={},_0x3dffff={};_0x4ae5a6<_0x5618f3[_0x320a('0x3b')];_0x4ae5a6+=0x1){_0x422ad1=_0x5618f3[_0x4ae5a6];if(_['isUndefined'](_0x50a700[_0x320a('0x1d')][_0x422ad1['id']])){_0x50a700[_0x320a('0x1d')][_0x422ad1['id']]=new Dynamics365Account(_0x422ad1);}else{_0x50a700['mergeFromDatabase'](_0x50a700[_0x320a('0x1d')][_0x422ad1['id']],_0x422ad1);}}}return _0x50a700['dynamics365Accounts'];};};Realtime[_0x320a('0x39')][_0x320a('0x4f')]=function(){var _0x54c72c=this;return function(_0x1057b2){if(_0x1057b2){freeIsNotKey(_0x1057b2,_0x54c72c[_0x320a('0x1e')],'id');for(var _0x3f1ae7=0x0,_0x58eb87={},_0x165916={};_0x3f1ae7<_0x1057b2['length'];_0x3f1ae7+=0x1){_0x58eb87=_0x1057b2[_0x3f1ae7];if(_[_0x320a('0x3c')](_0x54c72c[_0x320a('0x1e')][_0x58eb87['id']])){_0x54c72c[_0x320a('0x1e')][_0x58eb87['id']]=new FreshsalesAccount(_0x58eb87);}else{_0x54c72c['mergeFromDatabase'](_0x54c72c['freshsalesAccounts'][_0x58eb87['id']],_0x58eb87);}}}return _0x54c72c[_0x320a('0x1e')];};};Realtime[_0x320a('0x39')]['initVoiceQueueHopperHistory']=function(){var _0x4b2723=this;return function(_0x4430e4){for(var _0x1c8ecf=0x0;_0x1c8ecf<_0x4430e4[_0x320a('0x3b')];_0x1c8ecf+=0x1){_[_0x320a('0x50')](_0x4b2723[_0x320a('0x10')][_0x4430e4[_0x1c8ecf][_0x320a('0x24')]],_0x4430e4[_0x1c8ecf]);}return _0x4b2723[_0x320a('0x10')];};};Realtime[_0x320a('0x39')][_0x320a('0x51')]=function(){var _0x202685=this;return function(_0x537615){clearVoiceQueues(_0x202685[_0x320a('0x10')]);if(_0x537615){_0x537615=_['groupBy'](_0x537615,_0x320a('0x52'));for(var _0x1e044b in _0x537615){if(_0x537615[_0x320a('0x21')](_0x1e044b)){var _0x3f10cd={};for(var _0x5a11b9=0x0;_0x5a11b9<_0x537615[_0x1e044b][_0x320a('0x3b')];_0x5a11b9+=0x1){var _0x4eef03=_0x537615[_0x1e044b][_0x5a11b9][_0x320a('0x53')];if(_0x202685['voiceQueues'][_0x4eef03]){if(_0x537615[_0x1e044b][_0x5a11b9]['queuecallerexit']){_0x202685[_0x320a('0x10')][_0x4eef03][_0x320a('0x2c')]+=0x1;}if(_0x537615[_0x1e044b][_0x5a11b9][_0x320a('0x54')]){_0x202685[_0x320a('0x10')][_0x4eef03][_0x320a('0x55')]+=0x1;}_0x202685[_0x320a('0x10')][_0x4eef03][_0x320a('0x2d')]+=moment(_0x537615[_0x1e044b][_0x5a11b9][_0x320a('0x56')])[_0x320a('0x57')](moment(_0x537615[_0x1e044b][_0x5a11b9]['queuecallerjoinAt']),_0x320a('0x58'))||0x0;if(_0x5a11b9===_0x537615[_0x1e044b][_0x320a('0x3b')]-0x1){_0x202685['voiceQueues'][_0x4eef03]['sumDuration']+=moment(_0x537615[_0x1e044b][_0x5a11b9][_0x320a('0x59')]||_0x537615[_0x1e044b][_0x5a11b9][_0x320a('0x5a')]||_0x537615[_0x1e044b][_0x5a11b9][_0x320a('0x5b')])[_0x320a('0x57')](moment(_0x537615[_0x1e044b][_0x5a11b9][_0x320a('0x5c')]),_0x320a('0x58'))||0x0;_0x202685['voiceQueues'][_0x4eef03][_0x320a('0x27')]+=0x1;if(_0x537615[_0x1e044b][_0x5a11b9]['queuecallercomplete']){_0x202685[_0x320a('0x10')][_0x4eef03][_0x320a('0x28')]+=0x1;_0x202685['voiceQueues'][_0x4eef03][_0x320a('0x2a')]+=moment(_0x537615[_0x1e044b][_0x5a11b9]['queuecallercompleteAt'])['diff'](moment(_0x537615[_0x1e044b][_0x5a11b9][_0x320a('0x56')]),_0x320a('0x58'))||0x0;}}else{_0x202685[_0x320a('0x10')][_0x4eef03][_0x320a('0x29')]+=_0x202685[_0x320a('0x10')][_0x4eef03][_0x320a('0x2d')]||0x0;}}}}}}return _0x202685[_0x320a('0x10')];};};Realtime[_0x320a('0x39')][_0x320a('0x5d')]=function(){var _0x37215c=this;return function(_0x39e83c){clearVoiceCallReports(_0x37215c[_0x320a('0x13')]);if(_0x39e83c){for(var _0x6393fd=0x0;_0x6393fd<_0x39e83c[_0x320a('0x3b')];_0x6393fd+=0x1){_0x37215c[_0x320a('0x13')][_0x320a('0x27')]+=0x1;_0x37215c[_0x320a('0x13')]['sumDuration']+=_0x39e83c[_0x6393fd][_0x320a('0x5e')];if(_0x39e83c[_0x6393fd]['disposition']==='ANSWERED'){_0x37215c['outbound'][_0x320a('0x28')]+=0x1;_0x37215c[_0x320a('0x13')]['sumHoldTime']+=_0x39e83c[_0x6393fd]['duration']-_0x39e83c[_0x6393fd]['billableseconds']||0x0;_0x37215c[_0x320a('0x13')][_0x320a('0x2a')]+=_0x39e83c[_0x6393fd][_0x320a('0x5f')];}}}return _0x37215c[_0x320a('0x13')];};};Realtime[_0x320a('0x39')][_0x320a('0x60')]=function(){var _0x2228b8=this;return function(_0x4434f9){if(_0x4434f9){freeIsNotKey(_0x4434f9,_0x2228b8[_0x320a('0x61')],_0x320a('0x24'));for(var _0x273d02=0x0,_0x12e1bc={};_0x273d02<_0x4434f9[_0x320a('0x3b')];_0x273d02+=0x1){_0x12e1bc=_0x4434f9[_0x273d02];if(_[_0x320a('0x3c')](_0x2228b8[_0x320a('0x61')][_0x12e1bc[_0x320a('0x24')]])){_0x2228b8[_0x320a('0x61')][_0x12e1bc[_0x320a('0x24')]]=new Campaign(_0x12e1bc);}else{_0x2228b8[_0x320a('0x3d')](_0x2228b8[_0x320a('0x61')][_0x12e1bc[_0x320a('0x24')]],_0x12e1bc);_0x2228b8[_0x320a('0x61')][_0x12e1bc[_0x320a('0x24')]][_0x320a('0x62')]=_0x12e1bc[_0x320a('0x63')]?_0x12e1bc[_0x320a('0x63')][_0x320a('0x24')]:undefined;}}}return _0x2228b8[_0x320a('0x61')];};};Realtime[_0x320a('0x39')][_0x320a('0x64')]=function(){var _0x41c20c=this;return function(_0x535cc6){if(_0x535cc6){freeIsNotKey(_0x535cc6,_0x41c20c[_0x320a('0x14')],'id');for(var _0x40e045=0x0,_0x1fc670={};_0x40e045<_0x535cc6[_0x320a('0x3b')];_0x40e045+=0x1){_0x1fc670=_0x535cc6[_0x40e045];if(_[_0x320a('0x3c')](_0x41c20c[_0x320a('0x14')][_0x1fc670['id']])){_0x41c20c[_0x320a('0x14')][_0x1fc670['id']]=new VoiceExtension(_0x1fc670);}else{_0x41c20c[_0x320a('0x3d')](_0x41c20c['voiceExtensions'][_0x1fc670['id']],_0x1fc670);}}}return _0x41c20c[_0x320a('0x14')];};};Realtime[_0x320a('0x39')]['initCampaignHopperHistory']=function(){var _0x6d7779=this;return function(_0x145b88){clearCampaigns(_0x6d7779[_0x320a('0x61')]);for(var _0x1f504a=0x0;_0x1f504a<_0x145b88['length'];_0x1f504a+=0x1){_[_0x320a('0x50')](_0x6d7779[_0x320a('0x61')][_0x145b88[_0x1f504a][_0x320a('0x24')]],_0x145b88[_0x1f504a]);}return _0x6d7779[_0x320a('0x61')];};};Realtime[_0x320a('0x39')][_0x320a('0x65')]=function(){var _0x1f3637=this;return function(_0x5e7928){if(_0x5e7928){freeIsNotKey(_0x5e7928,_0x1f3637[_0x320a('0x1f')],'id');for(var _0x9ab07a=0x0,_0x4fcffc={},_0x5237a0={};_0x9ab07a<_0x5e7928[_0x320a('0x3b')];_0x9ab07a+=0x1){_0x4fcffc=_0x5e7928[_0x9ab07a];if(_['isUndefined'](_0x1f3637[_0x320a('0x1f')][_0x4fcffc['id']])){_0x1f3637[_0x320a('0x1f')][_0x4fcffc['id']]=new FaxAccount(_0x4fcffc);}else{_0x1f3637[_0x320a('0x3d')](_0x1f3637['faxAccounts'][_0x4fcffc['id']],_0x4fcffc);}}}return _0x1f3637[_0x320a('0x1f')];};};module[_0x320a('0x66')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 38d353c..78bfabf 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 _0xed23=['transfers','uniqueid','create','monitor','monitors','filename','createdAt','connectedlinename','exten','voiceAgentReport','isArray','startsWith','substring','indexOf','mobile','phone','lastIndexOf','membername','transfererlinkedid','lodash','moment','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','agents','telephones','prototype','sync','realtime','xdr','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','isNil','accountcode','interface','name','length','connectedlinenum','assigned','lastAssignedTo','format','SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','type','dialer','lastapplication','queue','lastdata','from-voip-provider','callerid','context','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0xed23,0x68));var _0x3ed2=function(_0x28497c,_0x54df74){_0x28497c=_0x28497c-0x0;var _0x3a2568=_0xed23[_0x28497c];return _0x3a2568;};'use strict';var _=require(_0x3ed2('0x0'));var moment=require(_0x3ed2('0x1'));var util=require(_0x3ed2('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x3ed2('0x3'));var RpcVoiceCallReport=require(_0x3ed2('0x4'));var RpcVoiceDialReport=require(_0x3ed2('0x5'));var RpcMemberReport=require(_0x3ed2('0x6'));var RpcVoiceQueueReport=require(_0x3ed2('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x3ed2('0x8'));var VoiceQueueReport=require(_0x3ed2('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x3ed2('0xa'));var VoiceDialReport=require(_0x3ed2('0xb'));var UserReport=require('./userReport');function Report(_0x33b8aa){this['realtime']=_0x33b8aa;this[_0x3ed2('0xc')]=_0x33b8aa[_0x3ed2('0xc')];this['telephones']=_0x33b8aa[_0x3ed2('0xd')];}Report[_0x3ed2('0xe')][_0x3ed2('0xf')]=function(_0x55fe7a){var _0x2b1ac6=new VoiceQueueReport(this[_0x3ed2('0x10')]);var _0x4ea2ba=new VoiceAgentReport(this['realtime']);var _0x4cc30e=new VoiceDialReport(this[_0x3ed2('0x10')]);var _0x564ac4=new VoiceCallReport(this['realtime']);var _0x1dd0dc=new UserReport(this['realtime']);if(config[_0x3ed2('0x11')]&&config[_0x3ed2('0x11')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0x3ed2('0x12')][_0x3ed2('0x13')](this));ami['on'](_0x3ed2('0x14'),this[_0x3ed2('0x15')][_0x3ed2('0x13')](this));ami['on'](_0x3ed2('0x16'),this['voiceAgentReport'][_0x3ed2('0x13')](this));ami['on'](_0x3ed2('0x17'),this[_0x3ed2('0x18')][_0x3ed2('0x13')](this));ami['on'](_0x3ed2('0x19'),this[_0x3ed2('0x1a')][_0x3ed2('0x13')](this));ami['on'](_0x3ed2('0x1b'),this[_0x3ed2('0x1c')][_0x3ed2('0x13')](this));}};Report['prototype'][_0x3ed2('0x1d')]=function(_0x1d746e){var _0x114324;_0x114324=_[_0x3ed2('0x1e')](this['agents'],function(_0x5d2186){return _0x5d2186['accountcode']==_0x1d746e||_0x5d2186['name']==_0x1d746e;});if(_[_0x3ed2('0x1f')](_0x114324)){var _0x116235=_[_0x3ed2('0x1e')](this[_0x3ed2('0xd')],function(_0x30a7a4){return _0x30a7a4[_0x3ed2('0x20')]==_0x1d746e||_0x30a7a4['name']==_0x1d746e;});if(_0x116235){_0x114324=_['find'](this[_0x3ed2('0xc')],function(_0x493bc4){return _0x493bc4[_0x3ed2('0x21')]==util['format']('SIP/%s',_0x116235[_0x3ed2('0x22')]);});}}return _0x114324;};Report[_0x3ed2('0xe')][_0x3ed2('0x12')]=function(_0x4c5c79){for(var _0x4bb65a=0x0;_0x4bb65a<_0x4c5c79[_0x3ed2('0x23')];_0x4bb65a+=0x1){var _0x38d7a0=this[_0x3ed2('0x1d')](_0x4c5c79[_0x4bb65a][_0x3ed2('0x24')]);if(_0x38d7a0){_0x4c5c79[_0x4bb65a][_0x3ed2('0x20')]=_0x38d7a0[_0x3ed2('0x20')];_0x4c5c79[_0x4bb65a][_0x3ed2('0x25')]=!![];_0x4c5c79[_0x4bb65a][_0x3ed2('0x26')]=_0x38d7a0['name'];_0x4c5c79[_0x4bb65a][_0x3ed2('0x21')]=_[_0x3ed2('0x1f')](_0x38d7a0['interface'])?util[_0x3ed2('0x27')](_0x3ed2('0x28'),_0x38d7a0[_0x3ed2('0x22')]):_0x38d7a0[_0x3ed2('0x21')];if(_0x4c5c79[_0x4bb65a][_0x3ed2('0x29')]){_0x4c5c79[_0x4bb65a]['queuecallercompleteAt']=moment()['format'](_0x3ed2('0x2a'));}if(_0x4c5c79[_0x4bb65a][_0x3ed2('0x2b')]){_0x4c5c79[_0x4bb65a][_0x3ed2('0x2c')]=moment()[_0x3ed2('0x27')](_0x3ed2('0x2a'));}RpcMemberReport[_0x3ed2('0x12')](_0x4c5c79[_0x4bb65a]);}RpcVoiceQueueReport['create'](_0x4c5c79[_0x4bb65a]);}};function extractCalleridNumber(_0x1edf0e){var _0x8e1767=_0x1edf0e[_0x3ed2('0x2d')](/<(.*?)>/);return _0x8e1767?_0x8e1767[0x1]:_0x1edf0e;}Report['prototype']['voiceCallReport']=function(_0x221f86){_0x221f86[_0x3ed2('0x2e')]=_0x221f86[_0x3ed2('0x2e')]||_0x221f86['exten'];if(_0x221f86[_0x3ed2('0x2f')]==_0x3ed2('0x30')){_0x221f86[_0x3ed2('0x31')]=_0x3ed2('0x32');_0x221f86[_0x3ed2('0x33')]=_0x221f86[_0x3ed2('0x32')];if(_0x221f86['context']==_0x3ed2('0x34')){_0x221f86[_0x3ed2('0x20')]='';_0x221f86[_0x3ed2('0x2e')]=extractCalleridNumber(_0x221f86[_0x3ed2('0x35')]);}else if(_0x221f86[_0x3ed2('0x36')]=='from-sip'){if(_0x221f86['destination']==_0x3ed2('0x37')){_0x221f86[_0x3ed2('0x2e')]=extractCalleridNumber(_0x221f86[_0x3ed2('0x38')]);_0x221f86[_0x3ed2('0x39')]=_0x221f86['originatecalleridnum'];_0x221f86[_0x3ed2('0x3a')]=[_0x221f86['channel'],_0x221f86[_0x3ed2('0x3b')]=_0x221f86[_0x3ed2('0x3a')]][0x0];_0x221f86[_0x3ed2('0x35')]=_0x221f86[_0x3ed2('0x38')];}else{_0x221f86[_0x3ed2('0x2e')]=_0x221f86['calleridnum'];_0x221f86[_0x3ed2('0x39')]=_0x221f86[_0x3ed2('0x3c')];if(_0x221f86[_0x3ed2('0x3d')]==_0x3ed2('0x3e')){_0x221f86[_0x3ed2('0x20')]=_0x221f86[_0x3ed2('0x24')];}else{_0x221f86[_0x3ed2('0x20')]='';}}}}else{_0x221f86['callerid']=util[_0x3ed2('0x27')](_0x3ed2('0x3f'),_0x221f86[_0x3ed2('0x40')],_0x221f86[_0x3ed2('0x39')]);}if(RpcVoiceTransferReport['transfers'][_0x221f86[_0x3ed2('0x41')]]){var _0x21742c=RpcVoiceTransferReport[_0x3ed2('0x42')][_0x221f86['linkedid']];_0x21742c['transfereelinkedid']=_0x221f86[_0x3ed2('0x43')];RpcVoiceTransferReport['blindTransfer'](_0x21742c);delete RpcVoiceTransferReport['transfers'][_0x221f86[_0x3ed2('0x41')]];}RpcVoiceCallReport[_0x3ed2('0x44')](_0x221f86);if(_0x221f86[_0x3ed2('0x45')]){for(var _0x33a1a9=0x0;_0x33a1a9<_0x221f86[_0x3ed2('0x46')][_0x3ed2('0x23')];_0x33a1a9+=0x1){_0x221f86['monitorFilename']=_0x221f86[_0x3ed2('0x46')][_0x33a1a9][_0x3ed2('0x47')];_0x221f86[_0x3ed2('0x48')]=_0x221f86['monitors'][_0x33a1a9][_0x3ed2('0x48')];if(_0x221f86['exten']=='xcally-motion-preview'){_0x221f86['calleridnum']=_0x221f86[_0x3ed2('0x24')];_0x221f86[_0x3ed2('0x40')]=_0x221f86[_0x3ed2('0x49')];_0x221f86[_0x3ed2('0x24')]=_0x221f86[_0x3ed2('0x20')];_0x221f86[_0x3ed2('0x49')]=_0x221f86['membername'];_0x221f86[_0x3ed2('0x4a')]=_0x221f86['originatecalleridnum'];}else if(_0x221f86[_0x3ed2('0x4a')]=='xcally-motion-dialer'){_0x221f86[_0x3ed2('0x39')]=_0x221f86[_0x3ed2('0x2e')];_0x221f86[_0x3ed2('0x4a')]=_0x221f86[_0x3ed2('0x3c')];}RpcVoiceRecording[_0x3ed2('0x44')](_0x221f86);}}};Report[_0x3ed2('0xe')][_0x3ed2('0x4b')]=function(_0x5bad74){if(_[_0x3ed2('0x4c')](_0x5bad74)){_0x5bad74['forEach'](function(_0x137948){RpcVoiceAgentReport['create'](_0x137948);});}else{RpcVoiceAgentReport[_0x3ed2('0x44')](_0x5bad74);}};Report[_0x3ed2('0xe')][_0x3ed2('0x18')]=function(_0x4e3c3d){RpcVoiceDialReport[_0x3ed2('0x44')](_0x4e3c3d);var _0x4a8967;var _0x93905f;var _0x27f4cb=_0x4e3c3d['channel'];if(_[_0x3ed2('0x4d')](_0x27f4cb,'Local')){_0x93905f=_0x27f4cb[_0x3ed2('0x4e')](_0x27f4cb[_0x3ed2('0x4f')]('/')+0x1,_0x27f4cb[_0x3ed2('0x4f')]('@'));_0x4a8967=_[_0x3ed2('0x1e')](this[_0x3ed2('0xc')],function(_0x30bf48){return _0x30bf48[_0x3ed2('0x50')]==_0x93905f||_0x30bf48[_0x3ed2('0x51')]==_0x93905f||_0x30bf48[_0x3ed2('0x20')]==_0x93905f;});}else{_0x93905f=_0x27f4cb['substring'](_0x27f4cb[_0x3ed2('0x4f')]('/')+0x1,_0x27f4cb[_0x3ed2('0x52')]('-'));_0x4a8967=this[_0x3ed2('0x1d')](_0x93905f);}if(_0x4a8967){_0x4e3c3d[_0x3ed2('0x21')]=_[_0x3ed2('0x1f')](_0x4a8967['interface'])?util[_0x3ed2('0x27')](_0x3ed2('0x28'),_0x4a8967[_0x3ed2('0x22')]):_0x4a8967[_0x3ed2('0x21')];_0x4e3c3d[_0x3ed2('0x53')]=_0x4a8967['name'];_0x4e3c3d[_0x3ed2('0x20')]=_0x4a8967['accountcode'];RpcMemberReport['voiceDialReport'](_0x4e3c3d);}};Report[_0x3ed2('0xe')][_0x3ed2('0x1a')]=function(_0x4eb909){RpcVoiceTransferReport[_0x3ed2('0x42')][_0x4eb909[_0x3ed2('0x54')]]=_0x4eb909;};Report[_0x3ed2('0xe')][_0x3ed2('0x1c')]=function(_0xff3fb3){RpcVoiceTransferReport[_0x3ed2('0x1c')](_0xff3fb3);};module['exports']=Report; \ No newline at end of file +var _0x26d9=['indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','lodash','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','findAgent','accountcode','name','isNil','find','length','connectedlinenum','assigned','lastAssignedTo','interface','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','format','create','match','destination','exten','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','callerid','\x22%s\x22\x20<%s>','transfers','transfereelinkedid','uniqueid','blindTransfer','linkedid','monitor','monitors','filename','createdAt','calleridname','connectedlinename','membername','isArray','forEach','Local'];(function(_0x238b4b,_0x2fe72d){var _0x4fe904=function(_0x434e9c){while(--_0x434e9c){_0x238b4b['push'](_0x238b4b['shift']());}};_0x4fe904(++_0x2fe72d);}(_0x26d9,0xa6));var _0x926d=function(_0x424e01,_0x1e4e7a){_0x424e01=_0x424e01-0x0;var _0x5171ab=_0x26d9[_0x424e01];return _0x5171ab;};'use strict';var _=require(_0x926d('0x0'));var moment=require('moment');var util=require('util');var config=require(_0x926d('0x1'));var ami=require(_0x926d('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x926d('0x3'));var RpcMemberReport=require(_0x926d('0x4'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x926d('0x5'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x926d('0x6'));var UserReport=require(_0x926d('0x7'));function Report(_0x428692){this[_0x926d('0x8')]=_0x428692;this['agents']=_0x428692[_0x926d('0x9')];this[_0x926d('0xa')]=_0x428692[_0x926d('0xa')];}Report[_0x926d('0xb')][_0x926d('0xc')]=function(_0x3bb335){var _0x5c1951=new VoiceQueueReport(this[_0x926d('0x8')]);var _0xc188f2=new VoiceAgentReport(this['realtime']);var _0x3e26de=new VoiceDialReport(this[_0x926d('0x8')]);var _0x507eea=new VoiceCallReport(this[_0x926d('0x8')]);var _0x37f552=new UserReport(this[_0x926d('0x8')]);if(config[_0x926d('0xd')]&&config[_0x926d('0xd')][_0x926d('0xe')]){ami['on'](_0x926d('0xf'),this[_0x926d('0x10')][_0x926d('0x11')](this));ami['on'](_0x926d('0x12'),this[_0x926d('0x13')][_0x926d('0x11')](this));ami['on'](_0x926d('0x14'),this[_0x926d('0x15')][_0x926d('0x11')](this));ami['on'](_0x926d('0x16'),this[_0x926d('0x17')]['bind'](this));ami['on'](_0x926d('0x18'),this['blindTransfer'][_0x926d('0x11')](this));ami['on'](_0x926d('0x19'),this['attendedTransfer'][_0x926d('0x11')](this));}};Report[_0x926d('0xb')][_0x926d('0x1a')]=function(_0xe03b1b){var _0x2f5d28;_0x2f5d28=_['find'](this['agents'],function(_0x38ffe7){return _0x38ffe7[_0x926d('0x1b')]==_0xe03b1b||_0x38ffe7[_0x926d('0x1c')]==_0xe03b1b;});if(_[_0x926d('0x1d')](_0x2f5d28)){var _0x39641c=_[_0x926d('0x1e')](this[_0x926d('0xa')],function(_0x219903){return _0x219903[_0x926d('0x1b')]==_0xe03b1b||_0x219903['name']==_0xe03b1b;});if(_0x39641c){_0x2f5d28=_['find'](this[_0x926d('0x9')],function(_0x2c01d6){return _0x2c01d6['interface']==util['format']('SIP/%s',_0x39641c['name']);});}}return _0x2f5d28;};Report[_0x926d('0xb')][_0x926d('0x10')]=function(_0x478d97){for(var _0x10ef1f=0x0;_0x10ef1f<_0x478d97[_0x926d('0x1f')];_0x10ef1f+=0x1){var _0x1d3d1c=this['findAgent'](_0x478d97[_0x10ef1f][_0x926d('0x20')]);if(_0x1d3d1c){_0x478d97[_0x10ef1f][_0x926d('0x1b')]=_0x1d3d1c[_0x926d('0x1b')];_0x478d97[_0x10ef1f][_0x926d('0x21')]=!![];_0x478d97[_0x10ef1f][_0x926d('0x22')]=_0x1d3d1c[_0x926d('0x1c')];_0x478d97[_0x10ef1f][_0x926d('0x23')]=_[_0x926d('0x1d')](_0x1d3d1c[_0x926d('0x23')])?util['format'](_0x926d('0x24'),_0x1d3d1c[_0x926d('0x1c')]):_0x1d3d1c[_0x926d('0x23')];if(_0x478d97[_0x10ef1f][_0x926d('0x25')]){_0x478d97[_0x10ef1f][_0x926d('0x26')]=moment()['format'](_0x926d('0x27'));}if(_0x478d97[_0x10ef1f]['queuecallerexit']){_0x478d97[_0x10ef1f][_0x926d('0x28')]=moment()[_0x926d('0x29')](_0x926d('0x27'));}RpcMemberReport[_0x926d('0x10')](_0x478d97[_0x10ef1f]);}RpcVoiceQueueReport[_0x926d('0x2a')](_0x478d97[_0x10ef1f]);}};function extractCalleridNumber(_0x2198b5){var _0xe61310=_0x2198b5[_0x926d('0x2b')](/<(.*?)>/);return _0xe61310?_0xe61310[0x1]:_0x2198b5;}Report[_0x926d('0xb')][_0x926d('0x13')]=function(_0x31553d){_0x31553d[_0x926d('0x2c')]=_0x31553d[_0x926d('0x2c')]||_0x31553d[_0x926d('0x2d')];if(_0x31553d['type']=='dialer'){_0x31553d['lastapplication']=_0x926d('0x2e');_0x31553d[_0x926d('0x2f')]=_0x31553d[_0x926d('0x2e')];if(_0x31553d[_0x926d('0x30')]==_0x926d('0x31')){_0x31553d[_0x926d('0x1b')]='';_0x31553d['destination']=extractCalleridNumber(_0x31553d['callerid']);}else if(_0x31553d[_0x926d('0x30')]==_0x926d('0x32')){if(_0x31553d['destination']==_0x926d('0x33')){_0x31553d[_0x926d('0x2c')]=extractCalleridNumber(_0x31553d[_0x926d('0x34')]);_0x31553d[_0x926d('0x35')]=_0x31553d[_0x926d('0x36')];_0x31553d['destinationchannel']=[_0x31553d[_0x926d('0x37')],_0x31553d[_0x926d('0x37')]=_0x31553d[_0x926d('0x38')]][0x0];_0x31553d[_0x926d('0x39')]=_0x31553d['calleridpreview'];}else{_0x31553d[_0x926d('0x2c')]=_0x31553d['calleridnum'];_0x31553d[_0x926d('0x35')]=_0x31553d[_0x926d('0x36')];if(_0x31553d['disposition']=='ANSWERED'){_0x31553d[_0x926d('0x1b')]=_0x31553d[_0x926d('0x20')];}else{_0x31553d[_0x926d('0x1b')]='';}}}}else{_0x31553d[_0x926d('0x39')]=util['format'](_0x926d('0x3a'),_0x31553d['calleridname'],_0x31553d[_0x926d('0x35')]);}if(RpcVoiceTransferReport[_0x926d('0x3b')][_0x31553d['linkedid']]){var _0x2b794=RpcVoiceTransferReport[_0x926d('0x3b')][_0x31553d['linkedid']];_0x2b794[_0x926d('0x3c')]=_0x31553d[_0x926d('0x3d')];RpcVoiceTransferReport[_0x926d('0x3e')](_0x2b794);delete RpcVoiceTransferReport['transfers'][_0x31553d[_0x926d('0x3f')]];}RpcVoiceCallReport[_0x926d('0x2a')](_0x31553d);if(_0x31553d[_0x926d('0x40')]){for(var _0x5e1c8d=0x0;_0x5e1c8d<_0x31553d[_0x926d('0x41')][_0x926d('0x1f')];_0x5e1c8d+=0x1){_0x31553d['monitorFilename']=_0x31553d[_0x926d('0x41')][_0x5e1c8d][_0x926d('0x42')];_0x31553d['createdAt']=_0x31553d['monitors'][_0x5e1c8d][_0x926d('0x43')];if(_0x31553d[_0x926d('0x2d')]==_0x926d('0x33')){_0x31553d[_0x926d('0x35')]=_0x31553d[_0x926d('0x20')];_0x31553d[_0x926d('0x44')]=_0x31553d[_0x926d('0x45')];_0x31553d[_0x926d('0x20')]=_0x31553d[_0x926d('0x1b')];_0x31553d[_0x926d('0x45')]=_0x31553d[_0x926d('0x46')];_0x31553d['exten']=_0x31553d[_0x926d('0x36')];}else if(_0x31553d[_0x926d('0x2d')]=='xcally-motion-dialer'){_0x31553d[_0x926d('0x35')]=_0x31553d['destination'];_0x31553d[_0x926d('0x2d')]=_0x31553d[_0x926d('0x36')];}RpcVoiceRecording[_0x926d('0x2a')](_0x31553d);}}};Report[_0x926d('0xb')][_0x926d('0x15')]=function(_0x5c7b93){if(_[_0x926d('0x47')](_0x5c7b93)){_0x5c7b93[_0x926d('0x48')](function(_0x1b54d2){RpcVoiceAgentReport[_0x926d('0x2a')](_0x1b54d2);});}else{RpcVoiceAgentReport[_0x926d('0x2a')](_0x5c7b93);}};Report[_0x926d('0xb')][_0x926d('0x17')]=function(_0x261cc6){RpcVoiceDialReport['create'](_0x261cc6);var _0x18145e;var _0x4b6f3f;var _0x525c83=_0x261cc6['channel'];if(_['startsWith'](_0x525c83,_0x926d('0x49'))){_0x4b6f3f=_0x525c83['substring'](_0x525c83[_0x926d('0x4a')]('/')+0x1,_0x525c83[_0x926d('0x4a')]('@'));_0x18145e=_['find'](this[_0x926d('0x9')],function(_0x4adba6){return _0x4adba6[_0x926d('0x4b')]==_0x4b6f3f||_0x4adba6[_0x926d('0x4c')]==_0x4b6f3f||_0x4adba6[_0x926d('0x1b')]==_0x4b6f3f;});}else{_0x4b6f3f=_0x525c83['substring'](_0x525c83[_0x926d('0x4a')]('/')+0x1,_0x525c83[_0x926d('0x4d')]('-'));_0x18145e=this[_0x926d('0x1a')](_0x4b6f3f);}if(_0x18145e){_0x261cc6[_0x926d('0x23')]=_[_0x926d('0x1d')](_0x18145e[_0x926d('0x23')])?util[_0x926d('0x29')](_0x926d('0x24'),_0x18145e['name']):_0x18145e['interface'];_0x261cc6[_0x926d('0x46')]=_0x18145e[_0x926d('0x1c')];_0x261cc6[_0x926d('0x1b')]=_0x18145e[_0x926d('0x1b')];RpcMemberReport[_0x926d('0x17')](_0x261cc6);}};Report[_0x926d('0xb')][_0x926d('0x3e')]=function(_0x519b82){RpcVoiceTransferReport[_0x926d('0x3b')][_0x519b82[_0x926d('0x4e')]]=_0x519b82;};Report[_0x926d('0xb')][_0x926d('0x4f')]=function(_0x152cc8){RpcVoiceTransferReport['attendedTransfer'](_0x152cc8);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 8be4a22..b7d1367 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69b5=['error','[userReport][sipshowregistry]','actionDeviceStateList','inspect','then','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','info','username','find','stateRegistry','state','omit','actionid','debug','format','trunk:%s','name','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','inuse','toLowerCase','toNumber','stateTime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','substring','indexOf','phone','[userReport][devicestatechange]','peer','address','[userReport][peerstatus]','updateStatusRealtime','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:save','exports','lodash','moment','util','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch'];(function(_0x5084d7,_0x49d267){var _0x41ed55=function(_0x566812){while(--_0x566812){_0x5084d7['push'](_0x5084d7['shift']());}};_0x41ed55(++_0x49d267);}(_0x69b5,0x18b));var _0x569b=function(_0x534817,_0x55cc0a){_0x534817=_0x534817-0x0;var _0x4e3ecb=_0x69b5[_0x534817];return _0x4e3ecb;};'use strict';var _=require(_0x569b('0x0'));var moment=require(_0x569b('0x1'));var util=require(_0x569b('0x2'));var Redis=require('ioredis');var BPromise=require(_0x569b('0x3'));var config=require(_0x569b('0x4'));var logger=require(_0x569b('0x5'))(_0x569b('0x6'));var ami=require(_0x569b('0x7'));config[_0x569b('0x8')]=_[_0x569b('0x9')](config[_0x569b('0x8')],{'host':_0x569b('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x569b('0x8')]));function UserReport(_0x43d6a5){this['trunks']=_0x43d6a5[_0x569b('0xb')];this['agents']=_0x43d6a5[_0x569b('0xc')];this[_0x569b('0xd')]=_0x43d6a5[_0x569b('0xd')];ami['on']('registryentry',this[_0x569b('0xe')][_0x569b('0xf')](this));ami['on'](_0x569b('0x10'),this[_0x569b('0xe')][_0x569b('0xf')](this));ami['on'](_0x569b('0x11'),this[_0x569b('0x12')][_0x569b('0xf')](this));ami['on'](_0x569b('0x13'),this[_0x569b('0x14')][_0x569b('0xf')](this));return this[_0x569b('0x15')]();}function showSipRegistrations(){Promise[_0x569b('0x16')]()['then'](ami[_0x569b('0x17')]())[_0x569b('0x18')](function(_0x2778bf){logger[_0x569b('0x19')](_0x569b('0x1a'),util['inspect'](_0x2778bf,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x569b('0x16')]()['then'](ami[_0x569b('0x1b')]())[_0x569b('0x18')](function(_0x4bcca9){logger[_0x569b('0x19')]('[userReport][devicestatelist]',util[_0x569b('0x1c')](_0x4bcca9,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x569b('0x16')]()[_0x569b('0x1d')](ami[_0x569b('0x1e')]())[_0x569b('0x18')](function(_0x1e0ede){logger[_0x569b('0x19')]('[userReport][sippeerstatus]',util[_0x569b('0x1c')](_0x1e0ede,{'showHidden':![],'depth':null}));});}UserReport[_0x569b('0x1f')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x569b('0x16')]()[_0x569b('0x1d')](showSipRegistrations())[_0x569b('0x1d')](listDeviceStates())[_0x569b('0x1d')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x569b('0x20')]=function(_0x56ca99){return _0x56ca99!==null&&!_[_0x569b('0x21')](_0x56ca99);};UserReport[_0x569b('0x1f')][_0x569b('0x22')]=function(_0x5b1f5c,_0x14f757,_0x464c94){io['to'](_0x5b1f5c)[_0x569b('0x22')](_0x14f757,_0x464c94);};UserReport['prototype'][_0x569b('0xe')]=function(_0x12bc74){try{if(this[_0x569b('0x20')](_0x12bc74)){logger[_0x569b('0x23')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x12bc74[_0x569b('0x24')],_0x12bc74['state']);logger['debug']('[userReport][registry]',util['inspect'](_0x12bc74,{'showHidden':![],'depth':null}));var _0x594b44=_[_0x569b('0x25')](this[_0x569b('0xb')],{'registry':_0x12bc74[_0x569b('0x24')]});if(_0x594b44){_0x12bc74[_0x569b('0x26')]=_0x12bc74[_0x569b('0x27')];_['merge'](_0x594b44,_[_0x569b('0x28')](_0x12bc74,['event',_0x569b('0x29'),_0x569b('0x24'),'state']));logger[_0x569b('0x2a')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x569b('0x1c')](_0x594b44,{'showHidden':![],'depth':null}));this[_0x569b('0x22')](util[_0x569b('0x2b')](_0x569b('0x2c'),_0x594b44[_0x569b('0x2d')]),'trunk:save',_0x594b44);}}}catch(_0x2663a2){logger['error'](_0x569b('0x2e'),util[_0x569b('0x1c')](_0x2663a2,{'showHidden':![],'depth':null}));}};UserReport[_0x569b('0x1f')][_0x569b('0x12')]=function(_0x25d96d){try{if(this['isNotNull'](_0x25d96d)){logger[_0x569b('0x23')](_0x569b('0x2f'),_0x25d96d[_0x569b('0x30')],_0x25d96d[_0x569b('0x27')]);logger[_0x569b('0x2a')]('[userReport][devicestatechange]',util[_0x569b('0x1c')](_0x25d96d,{'showHidden':![],'depth':null}));if(this[_0x569b('0xc')][_0x25d96d[_0x569b('0x30')]]){if(!this[_0x569b('0xc')][_0x25d96d[_0x569b('0x30')]][_0x569b('0x31')]||_0x25d96d['state']['toLowerCase']()==_0x569b('0x32')){this[_0x569b('0xc')][_0x25d96d[_0x569b('0x30')]][_0x569b('0x31')]=![];if(this['agents'][_0x25d96d['device']][_0x569b('0x27')]!==_0x25d96d[_0x569b('0x27')][_0x569b('0x33')]()){this[_0x569b('0xc')][_0x25d96d[_0x569b('0x30')]]['stateTime']=_[_0x569b('0x34')](moment()[_0x569b('0x2b')]('x'));}this[_0x569b('0xc')][_0x25d96d[_0x569b('0x30')]]['state']=_0x25d96d[_0x569b('0x27')][_0x569b('0x33')]();this['agents'][_0x25d96d[_0x569b('0x30')]]['updateStatusRealtime'](_0x25d96d);}}else if(this[_0x569b('0xd')][_0x25d96d[_0x569b('0x30')]]){if(this[_0x569b('0xd')][_0x25d96d[_0x569b('0x30')]][_0x569b('0x27')]!==_0x25d96d[_0x569b('0x27')]['toLowerCase']()){this['telephones'][_0x25d96d[_0x569b('0x30')]][_0x569b('0x35')]=_[_0x569b('0x34')](moment()[_0x569b('0x2b')]('x'));}this[_0x569b('0xd')][_0x25d96d[_0x569b('0x30')]][_0x569b('0x27')]=_0x25d96d[_0x569b('0x27')][_0x569b('0x33')]();logger[_0x569b('0x2a')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x569b('0xd')][_0x25d96d[_0x569b('0x30')]],{'showHidden':![],'depth':null}));this[_0x569b('0x22')](util['format'](_0x569b('0x36'),this[_0x569b('0xd')][_0x25d96d[_0x569b('0x30')]]['name']),_0x569b('0x37'),this[_0x569b('0xd')][_0x25d96d[_0x569b('0x30')]]);}else if(this[_0x569b('0xb')][_0x25d96d[_0x569b('0x30')]]){if(this[_0x569b('0xb')][_0x25d96d[_0x569b('0x30')]]['state']!==_0x25d96d[_0x569b('0x27')][_0x569b('0x33')]()){this[_0x569b('0xb')][_0x25d96d[_0x569b('0x30')]]['stateTime']=_[_0x569b('0x34')](moment()[_0x569b('0x2b')]('x'));}this['trunks'][_0x25d96d[_0x569b('0x30')]][_0x569b('0x27')]=_0x25d96d[_0x569b('0x27')][_0x569b('0x33')]();logger[_0x569b('0x2a')](_0x569b('0x38'),util[_0x569b('0x1c')](this[_0x569b('0xb')][_0x25d96d['device']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x569b('0x2c'),this['trunks'][_0x25d96d[_0x569b('0x30')]][_0x569b('0x2d')]),'trunk:save',this['trunks'][_0x25d96d[_0x569b('0x30')]]);}else if(_['startsWith'](_0x25d96d[_0x569b('0x30')],'Local')){var _0x5babdf=_0x25d96d[_0x569b('0x30')];var _0x380426=_0x5babdf[_0x569b('0x39')](_0x5babdf[_0x569b('0x3a')]('/')+0x1,_0x5babdf[_0x569b('0x3a')]('@'));var _0x513d44=_[_0x569b('0x25')](this['agents'],function(_0x290b8d){return _0x290b8d['mobile']==_0x380426||_0x290b8d[_0x569b('0x3b')]==_0x380426||_0x290b8d['accountcode']==_0x380426;});if(_0x513d44){if(_0x513d44[_0x569b('0x27')]!==_0x25d96d[_0x569b('0x27')][_0x569b('0x33')]()){_0x513d44[_0x569b('0x35')]=_[_0x569b('0x34')](moment()['format']('x'));}_0x513d44[_0x569b('0x27')]=_0x25d96d['state'][_0x569b('0x33')]();_0x513d44['local']=!![];_0x513d44['updateStatusRealtime'](_0x25d96d);}}}}catch(_0x59bcd9){logger['error'](_0x569b('0x3c'),util['inspect'](_0x59bcd9,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x4c9d8e){try{if(this[_0x569b('0x20')](_0x4c9d8e)&&this['isNotNull'](_0x4c9d8e[_0x569b('0x13')])){logger[_0x569b('0x23')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x4c9d8e[_0x569b('0x3d')],_0x4c9d8e[_0x569b('0x3e')],_0x4c9d8e[_0x569b('0x13')]);logger[_0x569b('0x2a')](_0x569b('0x3f'),util['inspect'](_0x4c9d8e,{'showHidden':![],'depth':null}));if(this[_0x569b('0xc')][_0x4c9d8e['peer']]){if(!this['agents'][_0x4c9d8e['peer']][_0x569b('0x31')]||_0x4c9d8e[_0x569b('0x13')][_0x569b('0x33')]()=='registered'){this[_0x569b('0xc')][_0x4c9d8e['peer']]['local']=![];this[_0x569b('0xc')][_0x4c9d8e[_0x569b('0x3d')]]['status']=_0x4c9d8e[_0x569b('0x13')][_0x569b('0x33')]();this[_0x569b('0xc')][_0x4c9d8e['peer']][_0x569b('0x3e')]=_0x4c9d8e['address'];this[_0x569b('0xc')][_0x4c9d8e['peer']][_0x569b('0x40')](_0x4c9d8e);}}else if(this[_0x569b('0xd')][_0x4c9d8e[_0x569b('0x3d')]]){this[_0x569b('0xd')][_0x4c9d8e[_0x569b('0x3d')]][_0x569b('0x41')]=_0x4c9d8e[_0x569b('0x13')][_0x569b('0x33')]();this['telephones'][_0x4c9d8e[_0x569b('0x3d')]][_0x569b('0x3e')]=_0x4c9d8e[_0x569b('0x3e')];logger[_0x569b('0x2a')](_0x569b('0x42'),util['inspect'](this[_0x569b('0xd')][_0x4c9d8e['peer']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x569b('0x36'),this[_0x569b('0xd')][_0x4c9d8e['peer']]['name']),'telephone:save',this['telephones'][_0x4c9d8e[_0x569b('0x3d')]]);}else if(this[_0x569b('0xb')][_0x4c9d8e['peer']]){this[_0x569b('0xb')][_0x4c9d8e[_0x569b('0x3d')]][_0x569b('0x41')]=_0x4c9d8e[_0x569b('0x13')]['toLowerCase']();this['trunks'][_0x4c9d8e[_0x569b('0x3d')]][_0x569b('0x3e')]=_0x4c9d8e[_0x569b('0x3e')];logger[_0x569b('0x2a')](_0x569b('0x43'),util[_0x569b('0x1c')](this[_0x569b('0xb')][_0x4c9d8e['peer']],{'showHidden':![],'depth':null}));this[_0x569b('0x22')](util[_0x569b('0x2b')](_0x569b('0x2c'),this[_0x569b('0xb')][_0x4c9d8e[_0x569b('0x3d')]]['name']),_0x569b('0x44'),this[_0x569b('0xb')][_0x4c9d8e['peer']]);}}}catch(_0x39bd4d){logger[_0x569b('0x19')](_0x569b('0x3f'),util[_0x569b('0x1c')](_0x39bd4d,{'showHidden':![],'depth':null}));}};module[_0x569b('0x45')]=UserReport; \ No newline at end of file +var _0xf6a9=['stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','toNumber','startsWith','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:%s','lodash','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncRealtimeShow','then','catch','[userReport][sipshowregistry]','inspect','resolve','error','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','find','stateRegistry','state','merge','omit','event','actionid','format','name','[userReport][registry]','device','[userReport][devicestatechange]','local','toLowerCase','inuse'];(function(_0x18dd15,_0x252692){var _0x46719e=function(_0x29eba7){while(--_0x29eba7){_0x18dd15['push'](_0x18dd15['shift']());}};_0x46719e(++_0x252692);}(_0xf6a9,0xab));var _0x9f6a=function(_0x7cd51d,_0x4140dd){_0x7cd51d=_0x7cd51d-0x0;var _0x4bfaa3=_0xf6a9[_0x7cd51d];return _0x4bfaa3;};'use strict';var _=require(_0x9f6a('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x9f6a('0x1'));var BPromise=require(_0x9f6a('0x2'));var config=require(_0x9f6a('0x3'));var logger=require(_0x9f6a('0x4'))(_0x9f6a('0x5'));var ami=require(_0x9f6a('0x6'));config[_0x9f6a('0x7')]=_[_0x9f6a('0x8')](config[_0x9f6a('0x7')],{'host':_0x9f6a('0x9'),'port':0x18eb});var io=require(_0x9f6a('0xa'))(new Redis(config[_0x9f6a('0x7')]));function UserReport(_0x375c25){this[_0x9f6a('0xb')]=_0x375c25['trunks'];this[_0x9f6a('0xc')]=_0x375c25[_0x9f6a('0xc')];this[_0x9f6a('0xd')]=_0x375c25[_0x9f6a('0xd')];ami['on'](_0x9f6a('0xe'),this[_0x9f6a('0xf')][_0x9f6a('0x10')](this));ami['on'](_0x9f6a('0x11'),this[_0x9f6a('0xf')][_0x9f6a('0x10')](this));ami['on'](_0x9f6a('0x12'),this[_0x9f6a('0x13')][_0x9f6a('0x10')](this));ami['on'](_0x9f6a('0x14'),this['syncPeerStatus']['bind'](this));return this[_0x9f6a('0x15')]();}function showSipRegistrations(){Promise['resolve']()[_0x9f6a('0x16')](ami['actionSipShowRegistry']())[_0x9f6a('0x17')](function(_0x155040){logger['error'](_0x9f6a('0x18'),util[_0x9f6a('0x19')](_0x155040,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x9f6a('0x1a')]()[_0x9f6a('0x16')](ami['actionDeviceStateList']())['catch'](function(_0x13af61){logger[_0x9f6a('0x1b')](_0x9f6a('0x1c'),util[_0x9f6a('0x19')](_0x13af61,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x9f6a('0x1a')]()[_0x9f6a('0x16')](ami[_0x9f6a('0x1d')]())['catch'](function(_0x30ec96){logger['error'](_0x9f6a('0x1e'),util[_0x9f6a('0x19')](_0x30ec96,{'showHidden':![],'depth':null}));});}UserReport[_0x9f6a('0x1f')][_0x9f6a('0x15')]=function(){setInterval(function(){BPromise[_0x9f6a('0x1a')]()[_0x9f6a('0x16')](showSipRegistrations())[_0x9f6a('0x16')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x9f6a('0x1f')][_0x9f6a('0x20')]=function(_0x1e38d8){return _0x1e38d8!==null&&!_[_0x9f6a('0x21')](_0x1e38d8);};UserReport['prototype'][_0x9f6a('0x22')]=function(_0x55bab8,_0x15830d,_0x4fb762){io['to'](_0x55bab8)[_0x9f6a('0x22')](_0x15830d,_0x4fb762);};UserReport[_0x9f6a('0x1f')][_0x9f6a('0xf')]=function(_0x5db5ae){try{if(this[_0x9f6a('0x20')](_0x5db5ae)){logger[_0x9f6a('0x23')](_0x9f6a('0x24'),_0x5db5ae[_0x9f6a('0x25')],_0x5db5ae['state']);logger[_0x9f6a('0x26')]('[userReport][registry]',util[_0x9f6a('0x19')](_0x5db5ae,{'showHidden':![],'depth':null}));var _0x162479=_[_0x9f6a('0x27')](this[_0x9f6a('0xb')],{'registry':_0x5db5ae[_0x9f6a('0x25')]});if(_0x162479){_0x5db5ae[_0x9f6a('0x28')]=_0x5db5ae[_0x9f6a('0x29')];_[_0x9f6a('0x2a')](_0x162479,_[_0x9f6a('0x2b')](_0x5db5ae,[_0x9f6a('0x2c'),_0x9f6a('0x2d'),_0x9f6a('0x25'),_0x9f6a('0x29')]));logger['debug']('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x9f6a('0x19')](_0x162479,{'showHidden':![],'depth':null}));this[_0x9f6a('0x22')](util[_0x9f6a('0x2e')]('trunk:%s',_0x162479[_0x9f6a('0x2f')]),'trunk:save',_0x162479);}}}catch(_0x45f55a){logger[_0x9f6a('0x1b')](_0x9f6a('0x30'),util[_0x9f6a('0x19')](_0x45f55a,{'showHidden':![],'depth':null}));}};UserReport[_0x9f6a('0x1f')][_0x9f6a('0x13')]=function(_0x221fab){try{if(this[_0x9f6a('0x20')](_0x221fab)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x221fab[_0x9f6a('0x31')],_0x221fab['state']);logger[_0x9f6a('0x26')](_0x9f6a('0x32'),util['inspect'](_0x221fab,{'showHidden':![],'depth':null}));if(this['agents'][_0x221fab[_0x9f6a('0x31')]]){if(!this[_0x9f6a('0xc')][_0x221fab[_0x9f6a('0x31')]][_0x9f6a('0x33')]||_0x221fab[_0x9f6a('0x29')][_0x9f6a('0x34')]()==_0x9f6a('0x35')){this['agents'][_0x221fab['device']][_0x9f6a('0x33')]=![];if(this[_0x9f6a('0xc')][_0x221fab['device']]['state']!==_0x221fab[_0x9f6a('0x29')][_0x9f6a('0x34')]()){this[_0x9f6a('0xc')][_0x221fab[_0x9f6a('0x31')]]['stateTime']=_['toNumber'](moment()[_0x9f6a('0x2e')]('x'));}this[_0x9f6a('0xc')][_0x221fab[_0x9f6a('0x31')]][_0x9f6a('0x29')]=_0x221fab[_0x9f6a('0x29')][_0x9f6a('0x34')]();this[_0x9f6a('0xc')][_0x221fab[_0x9f6a('0x31')]]['updateStatusRealtime'](_0x221fab);}}else if(this[_0x9f6a('0xd')][_0x221fab['device']]){if(this[_0x9f6a('0xd')][_0x221fab['device']][_0x9f6a('0x29')]!==_0x221fab[_0x9f6a('0x29')][_0x9f6a('0x34')]()){this[_0x9f6a('0xd')][_0x221fab['device']][_0x9f6a('0x36')]=_['toNumber'](moment()[_0x9f6a('0x2e')]('x'));}this[_0x9f6a('0xd')][_0x221fab[_0x9f6a('0x31')]]['state']=_0x221fab[_0x9f6a('0x29')][_0x9f6a('0x34')]();logger[_0x9f6a('0x26')](_0x9f6a('0x37'),util[_0x9f6a('0x19')](this[_0x9f6a('0xd')][_0x221fab['device']],{'showHidden':![],'depth':null}));this[_0x9f6a('0x22')](util[_0x9f6a('0x2e')](_0x9f6a('0x38'),this[_0x9f6a('0xd')][_0x221fab[_0x9f6a('0x31')]][_0x9f6a('0x2f')]),_0x9f6a('0x39'),this['telephones'][_0x221fab[_0x9f6a('0x31')]]);}else if(this['trunks'][_0x221fab['device']]){if(this[_0x9f6a('0xb')][_0x221fab[_0x9f6a('0x31')]]['state']!==_0x221fab[_0x9f6a('0x29')]['toLowerCase']()){this[_0x9f6a('0xb')][_0x221fab[_0x9f6a('0x31')]]['stateTime']=_[_0x9f6a('0x3a')](moment()[_0x9f6a('0x2e')]('x'));}this[_0x9f6a('0xb')][_0x221fab['device']]['state']=_0x221fab['state'][_0x9f6a('0x34')]();logger[_0x9f6a('0x26')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0x9f6a('0xb')][_0x221fab[_0x9f6a('0x31')]],{'showHidden':![],'depth':null}));this[_0x9f6a('0x22')](util[_0x9f6a('0x2e')]('trunk:%s',this[_0x9f6a('0xb')][_0x221fab[_0x9f6a('0x31')]]['name']),'trunk:save',this[_0x9f6a('0xb')][_0x221fab['device']]);}else if(_[_0x9f6a('0x3b')](_0x221fab[_0x9f6a('0x31')],'Local')){var _0x54ae89=_0x221fab[_0x9f6a('0x31')];var _0x1274b3=_0x54ae89[_0x9f6a('0x3c')](_0x54ae89['indexOf']('/')+0x1,_0x54ae89[_0x9f6a('0x3d')]('@'));var _0x362368=_[_0x9f6a('0x27')](this['agents'],function(_0xdf0c32){return _0xdf0c32[_0x9f6a('0x3e')]==_0x1274b3||_0xdf0c32[_0x9f6a('0x3f')]==_0x1274b3||_0xdf0c32[_0x9f6a('0x40')]==_0x1274b3;});if(_0x362368){if(_0x362368['state']!==_0x221fab[_0x9f6a('0x29')]['toLowerCase']()){_0x362368[_0x9f6a('0x36')]=_['toNumber'](moment()[_0x9f6a('0x2e')]('x'));}_0x362368[_0x9f6a('0x29')]=_0x221fab[_0x9f6a('0x29')][_0x9f6a('0x34')]();_0x362368['local']=!![];_0x362368[_0x9f6a('0x41')](_0x221fab);}}}}catch(_0x4a43d3){logger[_0x9f6a('0x1b')](_0x9f6a('0x32'),util['inspect'](_0x4a43d3,{'showHidden':![],'depth':null}));}};UserReport[_0x9f6a('0x1f')]['syncPeerStatus']=function(_0x5a4b4a){try{if(this[_0x9f6a('0x20')](_0x5a4b4a)&&this[_0x9f6a('0x20')](_0x5a4b4a[_0x9f6a('0x14')])){logger[_0x9f6a('0x23')](_0x9f6a('0x42'),_0x5a4b4a[_0x9f6a('0x43')],_0x5a4b4a[_0x9f6a('0x44')],_0x5a4b4a[_0x9f6a('0x14')]);logger['debug'](_0x9f6a('0x45'),util[_0x9f6a('0x19')](_0x5a4b4a,{'showHidden':![],'depth':null}));if(this[_0x9f6a('0xc')][_0x5a4b4a[_0x9f6a('0x43')]]){if(!this[_0x9f6a('0xc')][_0x5a4b4a[_0x9f6a('0x43')]][_0x9f6a('0x33')]||_0x5a4b4a[_0x9f6a('0x14')][_0x9f6a('0x34')]()==_0x9f6a('0x46')){this[_0x9f6a('0xc')][_0x5a4b4a[_0x9f6a('0x43')]][_0x9f6a('0x33')]=![];this['agents'][_0x5a4b4a[_0x9f6a('0x43')]][_0x9f6a('0x47')]=_0x5a4b4a[_0x9f6a('0x14')][_0x9f6a('0x34')]();this[_0x9f6a('0xc')][_0x5a4b4a[_0x9f6a('0x43')]][_0x9f6a('0x44')]=_0x5a4b4a[_0x9f6a('0x44')];this[_0x9f6a('0xc')][_0x5a4b4a[_0x9f6a('0x43')]][_0x9f6a('0x41')](_0x5a4b4a);}}else if(this[_0x9f6a('0xd')][_0x5a4b4a[_0x9f6a('0x43')]]){this[_0x9f6a('0xd')][_0x5a4b4a[_0x9f6a('0x43')]][_0x9f6a('0x47')]=_0x5a4b4a['peerstatus']['toLowerCase']();this[_0x9f6a('0xd')][_0x5a4b4a['peer']]['address']=_0x5a4b4a['address'];logger[_0x9f6a('0x26')](_0x9f6a('0x48'),util[_0x9f6a('0x19')](this['telephones'][_0x5a4b4a['peer']],{'showHidden':![],'depth':null}));this[_0x9f6a('0x22')](util[_0x9f6a('0x2e')](_0x9f6a('0x38'),this[_0x9f6a('0xd')][_0x5a4b4a['peer']]['name']),_0x9f6a('0x39'),this[_0x9f6a('0xd')][_0x5a4b4a[_0x9f6a('0x43')]]);}else if(this[_0x9f6a('0xb')][_0x5a4b4a['peer']]){this[_0x9f6a('0xb')][_0x5a4b4a[_0x9f6a('0x43')]]['status']=_0x5a4b4a[_0x9f6a('0x14')]['toLowerCase']();this[_0x9f6a('0xb')][_0x5a4b4a[_0x9f6a('0x43')]][_0x9f6a('0x44')]=_0x5a4b4a[_0x9f6a('0x44')];logger[_0x9f6a('0x26')](_0x9f6a('0x49'),util[_0x9f6a('0x19')](this[_0x9f6a('0xb')][_0x5a4b4a['peer']],{'showHidden':![],'depth':null}));this[_0x9f6a('0x22')](util[_0x9f6a('0x2e')](_0x9f6a('0x4a'),this[_0x9f6a('0xb')][_0x5a4b4a[_0x9f6a('0x43')]][_0x9f6a('0x2f')]),'trunk:save',this[_0x9f6a('0xb')][_0x5a4b4a[_0x9f6a('0x43')]]);}}}catch(_0x3cdbd4){logger[_0x9f6a('0x1b')](_0x9f6a('0x45'),util[_0x9f6a('0x19')](_0x3cdbd4,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index ba6d13d..3a22218 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce93=['emit','prototype','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','channels','format','called','queue','mandatoryDisposition','type','inbound','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','isNotNull','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','destchannelstatedesc','holdtime','lastevent','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]','exports','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','voiceQueues','agents','variables','agentcalled','agentconnect','syncAgentConnect','bind','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce93,0x10f));var _0x3ce9=function(_0x187e24,_0x393e15){_0x187e24=_0x187e24-0x0;var _0x39b658=_0xce93[_0x187e24];return _0x39b658;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x3ce9('0x0'));var Redis=require(_0x3ce9('0x1'));var config=require(_0x3ce9('0x2'));var logger=require(_0x3ce9('0x3'))('ami');var ami=require(_0x3ce9('0x4'));config[_0x3ce9('0x5')]=_[_0x3ce9('0x6')](config['redis'],{'host':_0x3ce9('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x525a32){this['channels']={};this[_0x3ce9('0x8')]=_0x525a32[_0x3ce9('0x8')];this['agents']=_0x525a32[_0x3ce9('0x9')];this[_0x3ce9('0xa')]={};ami['on'](_0x3ce9('0xb'),this['syncAgentCalled']['bind'](this));ami['on'](_0x3ce9('0xc'),this[_0x3ce9('0xd')][_0x3ce9('0xe')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x3ce9('0xe')](this));ami['on'](_0x3ce9('0xf'),this['syncQueueCallerAbandon'][_0x3ce9('0xe')](this));ami['on'](_0x3ce9('0x10'),this[_0x3ce9('0x11')][_0x3ce9('0xe')](this));ami['on'](_0x3ce9('0x12'),this[_0x3ce9('0x13')]['bind'](this));ami['on'](_0x3ce9('0x14'),this[_0x3ce9('0x15')][_0x3ce9('0xe')](this));ami['on'](_0x3ce9('0x16'),this['syncMusicOnHoldStart'][_0x3ce9('0xe')](this));ami['on'](_0x3ce9('0x17'),this[_0x3ce9('0x18')][_0x3ce9('0xe')](this));ami['on'](_0x3ce9('0x19'),this[_0x3ce9('0x1a')][_0x3ce9('0xe')](this));ami['on'](_0x3ce9('0x1b'),this[_0x3ce9('0x1c')][_0x3ce9('0xe')](this));}VoiceAgentReport['prototype'][_0x3ce9('0x1d')]=function(_0x2e8345,_0x2eaa0c,_0x5d14d5){io['to'](_0x2e8345)[_0x3ce9('0x1d')](_0x2eaa0c,_0x5d14d5);};VoiceAgentReport[_0x3ce9('0x1e')]['isNotNull']=function(_0x4a7e92){return _0x4a7e92!==null&&!_[_0x3ce9('0x1f')](_0x4a7e92);};VoiceAgentReport[_0x3ce9('0x1e')]['syncAgentCalled']=function(_0x4f71b2){try{if(this['isNotNull'](_0x4f71b2)){logger[_0x3ce9('0x20')](_0x3ce9('0x21'),_0x4f71b2[_0x3ce9('0x22')],_0x4f71b2[_0x3ce9('0x23')],_0x4f71b2[_0x3ce9('0x24')]);logger[_0x3ce9('0x25')](_0x3ce9('0x26'),_0x4f71b2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x4f71b2,{'showHidden':![],'depth':null}));if(_[_0x3ce9('0x1f')](this[_0x3ce9('0x28')][_0x4f71b2[_0x3ce9('0x22')]])){this[_0x3ce9('0x28')][_0x4f71b2['uniqueid']]={};}if(_[_0x3ce9('0x1f')](this['channels'][_0x4f71b2[_0x3ce9('0x22')]][_0x4f71b2['destuniqueid']])){this[_0x3ce9('0x28')][_0x4f71b2['uniqueid']][_0x4f71b2[_0x3ce9('0x24')]]={'agentcalledAt':moment()[_0x3ce9('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x3ce9('0x2a'),'mandatoryDisposition':this[_0x3ce9('0x8')][_0x4f71b2['queue']]?this[_0x3ce9('0x8')][_0x4f71b2[_0x3ce9('0x2b')]][_0x3ce9('0x2c')]||![]:![],'type':this[_0x3ce9('0x8')][_0x4f71b2[_0x3ce9('0x2b')]]?this[_0x3ce9('0x8')][_0x4f71b2[_0x3ce9('0x2b')]][_0x3ce9('0x2d')]||_0x3ce9('0x2e'):_0x3ce9('0x2e'),'variables':this[_0x3ce9('0xa')][_0x4f71b2[_0x3ce9('0x22')]]};}_['merge'](this[_0x3ce9('0x28')][_0x4f71b2[_0x3ce9('0x22')]][_0x4f71b2[_0x3ce9('0x24')]],_['omit'](_0x4f71b2,[_0x3ce9('0x2f'),_0x3ce9('0x30')]));logger['debug'](_0x3ce9('0x31'),_0x4f71b2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](this['channels'][_0x4f71b2[_0x3ce9('0x22')]][_0x4f71b2[_0x3ce9('0x24')]],{'showHidden':![],'depth':null}));ami[_0x3ce9('0x1d')]('custom:agentcalled',this[_0x3ce9('0x28')][_0x4f71b2[_0x3ce9('0x22')]][_0x4f71b2[_0x3ce9('0x24')]]);logger[_0x3ce9('0x25')](_0x3ce9('0x32'),_0x4f71b2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](this[_0x3ce9('0x28')][_0x4f71b2['uniqueid']][_0x4f71b2[_0x3ce9('0x24')]],{'showHidden':![],'depth':null}));this[_0x3ce9('0x1d')](util[_0x3ce9('0x29')](_0x3ce9('0x33'),_0x4f71b2[_0x3ce9('0x23')]),_0x3ce9('0x34'),this[_0x3ce9('0x28')][_0x4f71b2['uniqueid']][_0x4f71b2['destuniqueid']]);}}catch(_0x2919a1){logger[_0x3ce9('0x35')](_0x3ce9('0x36'),_0x4f71b2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x2919a1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3ce9('0xd')]=function(_0x34931c){try{if(this[_0x3ce9('0x37')](_0x34931c)){if(this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]]){logger['debug']('[%s][voiceAgentReport][agentconnect]\x20event:',_0x34931c[_0x3ce9('0x22')],util['inspect'](_0x34931c,{'showHidden':![],'depth':null}));for(var _0x11d3b1 in this['channels'][_0x34931c[_0x3ce9('0x22')]]){if(this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x3ce9('0x38')](_0x11d3b1)){if(_0x34931c['destuniqueid']===_0x11d3b1){logger[_0x3ce9('0x20')](_0x3ce9('0x39'),_0x34931c[_0x3ce9('0x22')],_0x34931c['membername'],_0x34931c[_0x3ce9('0x24')]);this[_0x3ce9('0x28')][_0x34931c['uniqueid']][_0x11d3b1][_0x3ce9('0x3a')]=moment()['format'](_0x3ce9('0x3b'));this['channels'][_0x34931c['uniqueid']][_0x11d3b1]['connectedlinename']=_0x34931c['connectedlinename'];this[_0x3ce9('0x28')][_0x34931c['uniqueid']][_0x11d3b1][_0x3ce9('0x3c')]=_0x34931c[_0x3ce9('0x3c')];this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1]['destchannelstate']=_0x34931c['destchannelstate'];this[_0x3ce9('0x28')][_0x34931c['uniqueid']][_0x11d3b1][_0x3ce9('0x3d')]=_0x34931c[_0x3ce9('0x3d')];this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x3e')]=_0x34931c['holdtime'];this['channels'][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x3f')]='connect';_['merge'](this[_0x3ce9('0x9')][_0x34931c[_0x3ce9('0x40')]],_[_0x3ce9('0x41')](_0x34931c,[_0x3ce9('0x2b'),_0x3ce9('0x42')]));logger[_0x3ce9('0x25')](_0x3ce9('0x43'),_0x34931c[_0x3ce9('0x22')],util[_0x3ce9('0x27')](this['channels'][_0x34931c[_0x3ce9('0x22')]][_0x34931c[_0x3ce9('0x24')]],{'showHidden':![],'depth':null}));ami[_0x3ce9('0x1d')](_0x3ce9('0x44'),this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x34931c['destuniqueid']]);logger[_0x3ce9('0x25')](_0x3ce9('0x45'),_0x34931c[_0x3ce9('0x22')],util['inspect'](this[_0x3ce9('0x28')][_0x34931c['uniqueid']][_0x34931c['destuniqueid']],{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x34931c[_0x3ce9('0x23')]),'user:agentconnect',this[_0x3ce9('0x28')][_0x34931c['uniqueid']][_0x34931c[_0x3ce9('0x24')]]);}else if(!this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x46')]&&!this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x10')]){logger['info'](_0x3ce9('0x47'),_0x34931c[_0x3ce9('0x22')],this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1]['membername'],_0x11d3b1);this[_0x3ce9('0x28')][_0x34931c['uniqueid']][_0x11d3b1]['agentringnoanswer']=!![];this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x48')]=moment()[_0x3ce9('0x29')](_0x3ce9('0x3b'));this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x49')]=_0x34931c[_0x3ce9('0x24')];this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x4a')]=_0x34931c[_0x3ce9('0x23')];this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1]['lastevent']=_0x3ce9('0x4b');this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x4c')]='answered_elsewhere';logger[_0x3ce9('0x25')](_0x3ce9('0x4d'),_0x34931c[_0x3ce9('0x22')],util[_0x3ce9('0x27')](this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1],{'showHidden':![],'depth':null}));ami['emit'](_0x3ce9('0x4e'),this['channels'][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1]);}}}}}}catch(_0x31c102){logger[_0x3ce9('0x35')](_0x3ce9('0x4f'),_0x34931c[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x31c102,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3ce9('0x50')]=function(_0x3f2664){try{if(this[_0x3ce9('0x37')](_0x3f2664)){logger[_0x3ce9('0x25')](_0x3ce9('0x51'),_0x3f2664['uniqueid'],util[_0x3ce9('0x27')](_0x3f2664,{'showHidden':![],'depth':null}));if(this[_0x3ce9('0x28')][_0x3f2664[_0x3ce9('0x22')]]&&this[_0x3ce9('0x28')][_0x3f2664[_0x3ce9('0x22')]][_0x3f2664[_0x3ce9('0x24')]]){logger['info']('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x3f2664['uniqueid'],_0x3f2664[_0x3ce9('0x23')],_0x3f2664['destuniqueid']);this[_0x3ce9('0x28')][_0x3f2664['uniqueid']][_0x3f2664[_0x3ce9('0x24')]]['agentringnoanswer']=!![];this[_0x3ce9('0x28')][_0x3f2664[_0x3ce9('0x22')]][_0x3f2664[_0x3ce9('0x24')]]['agentringnoanswerAt']=moment()[_0x3ce9('0x29')](_0x3ce9('0x3b'));this[_0x3ce9('0x28')][_0x3f2664['uniqueid']][_0x3f2664[_0x3ce9('0x24')]][_0x3ce9('0x3f')]=_0x3ce9('0x52');this['channels'][_0x3f2664[_0x3ce9('0x22')]][_0x3f2664[_0x3ce9('0x24')]][_0x3ce9('0x4c')]='rejected';logger[_0x3ce9('0x25')](_0x3ce9('0x53'),_0x3f2664[_0x3ce9('0x22')],util[_0x3ce9('0x27')](this[_0x3ce9('0x28')][_0x3f2664[_0x3ce9('0x22')]][_0x3f2664[_0x3ce9('0x24')]],{'showHidden':![],'depth':null}));ami['emit'](_0x3ce9('0x54'),this[_0x3ce9('0x28')][_0x3f2664[_0x3ce9('0x22')]][_0x3f2664[_0x3ce9('0x24')]]);}}}catch(_0xecbef5){logger[_0x3ce9('0x35')](_0x3ce9('0x55'),_0x3f2664[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0xecbef5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3ce9('0x56')]=function(_0x46b1de){try{if(this[_0x3ce9('0x37')](_0x46b1de)){logger[_0x3ce9('0x25')](_0x3ce9('0x57'),_0x46b1de[_0x3ce9('0x22')],util['inspect'](_0x46b1de,{'showHidden':![],'depth':null}));if(this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]]){for(var _0x4b74c8 in this['channels'][_0x46b1de[_0x3ce9('0x22')]]){if(this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x3ce9('0x38')](_0x4b74c8)&&!this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8][_0x3ce9('0x46')]&&!this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8][_0x3ce9('0x10')]){logger[_0x3ce9('0x20')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x46b1de[_0x3ce9('0x22')],this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8][_0x3ce9('0x23')],_0x4b74c8);this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8]['agentringnoanswer']=!![];this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8][_0x3ce9('0x48')]=moment()[_0x3ce9('0x29')](_0x3ce9('0x3b'));this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8]['lastevent']=_0x3ce9('0x58');this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8]['reason']=_0x3ce9('0x58');logger[_0x3ce9('0x25')](_0x3ce9('0x59'),_0x46b1de[_0x3ce9('0x22')],util[_0x3ce9('0x27')](this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8],{'showHidden':![],'depth':null}));ami[_0x3ce9('0x1d')](_0x3ce9('0x5a'),this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8]);}}}}}catch(_0x2262d6){logger['error'](_0x3ce9('0x5b'),_0x46b1de[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x2262d6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ce9('0x1e')][_0x3ce9('0x11')]=function(_0x24278d){try{if(this[_0x3ce9('0x37')](_0x24278d)){logger[_0x3ce9('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x24278d['uniqueid'],util[_0x3ce9('0x27')](_0x24278d,{'showHidden':![],'depth':null}));if(this['channels'][_0x24278d[_0x3ce9('0x22')]]){for(var _0x2e3198 in this[_0x3ce9('0x28')][_0x24278d['uniqueid']]){if(this[_0x3ce9('0x28')][_0x24278d['uniqueid']][_0x3ce9('0x38')](_0x2e3198)){if(this['channels'][_0x24278d['uniqueid']][_0x2e3198][_0x3ce9('0x3a')]&&!this[_0x3ce9('0x28')][_0x24278d[_0x3ce9('0x22')]][_0x2e3198]['agentcomplete']){logger[_0x3ce9('0x20')](_0x3ce9('0x5c'),_0x24278d['uniqueid'],this['channels'][_0x24278d['uniqueid']][_0x2e3198][_0x3ce9('0x23')],_0x2e3198);this[_0x3ce9('0x28')][_0x24278d['uniqueid']][_0x2e3198][_0x3ce9('0x10')]=!![];this[_0x3ce9('0x28')][_0x24278d['uniqueid']][_0x2e3198][_0x3ce9('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3ce9('0x28')][_0x24278d[_0x3ce9('0x22')]][_0x2e3198]['lastevent']=_0x3ce9('0x5e');this[_0x3ce9('0x28')][_0x24278d[_0x3ce9('0x22')]][_0x2e3198][_0x3ce9('0x4c')]=_0x24278d['reason']==_0x3ce9('0x5f')?'agent':_0x24278d['reason'];this[_0x3ce9('0x28')][_0x24278d[_0x3ce9('0x22')]][_0x2e3198][_0x3ce9('0x60')]=_0x24278d[_0x3ce9('0x60')];if(this['voiceQueues'][_0x24278d['queue']]&&this[_0x3ce9('0x8')][_0x24278d['queue']][_0x3ce9('0x61')]){this['channels'][_0x24278d[_0x3ce9('0x22')]][_0x2e3198][_0x3ce9('0x62')]=this[_0x3ce9('0x8')][_0x24278d[_0x3ce9('0x2b')]][_0x3ce9('0x63')];this[_0x3ce9('0x28')][_0x24278d[_0x3ce9('0x22')]][_0x2e3198][_0x3ce9('0x64')]=!![];}this[_0x3ce9('0x9')][_0x24278d[_0x3ce9('0x40')]]=_['omit'](this['agents'][_0x24278d[_0x3ce9('0x40')]],[_0x3ce9('0x2b'),_0x3ce9('0x42')]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x24278d[_0x3ce9('0x22')],util['inspect'](this[_0x3ce9('0x28')][_0x24278d[_0x3ce9('0x22')]][_0x2e3198],{'showHidden':![],'depth':null}));ami['emit'](_0x3ce9('0x65'),this[_0x3ce9('0x28')][_0x24278d['uniqueid']][_0x2e3198]);logger[_0x3ce9('0x25')](_0x3ce9('0x66'),_0x24278d[_0x3ce9('0x22')],util[_0x3ce9('0x27')](this[_0x3ce9('0x28')][_0x24278d[_0x3ce9('0x22')]][_0x2e3198],{'showHidden':![],'depth':null}));this['emit'](util[_0x3ce9('0x29')](_0x3ce9('0x33'),_0x24278d[_0x3ce9('0x23')]),_0x3ce9('0x67'),this[_0x3ce9('0x28')][_0x24278d['uniqueid']][_0x2e3198]);}}}}}}catch(_0x63dff0){logger[_0x3ce9('0x35')](_0x3ce9('0x68'),_0x24278d[_0x3ce9('0x22')],util['inspect'](_0x63dff0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ce9('0x1e')]['syncVarSet']=function(_0x35f913){try{if(this[_0x3ce9('0x37')](_0x35f913)){logger[_0x3ce9('0x25')]('[%s][voiceAgentReport][varset]\x20event:',_0x35f913[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x35f913,{'showHidden':![],'depth':null}));this['addVariable'](_0x35f913[_0x3ce9('0x22')],_[_0x3ce9('0x69')](_0x35f913[_0x3ce9('0x6a')])[0x0],_0x35f913[_0x3ce9('0x6b')]);if(this[_0x3ce9('0x28')][_0x35f913[_0x3ce9('0x22')]]){for(var _0x386c1a in this[_0x3ce9('0x28')][_0x35f913[_0x3ce9('0x22')]]){if(this['channels'][_0x35f913[_0x3ce9('0x22')]][_0x3ce9('0x38')](_0x386c1a)){logger[_0x3ce9('0x20')](_0x3ce9('0x6c'),_0x35f913[_0x3ce9('0x22')],_0x386c1a,_[_0x3ce9('0x69')](_0x35f913[_0x3ce9('0x6a')])[0x0],_0x35f913[_0x3ce9('0x6b')]);if(_['isUndefined'](this[_0x3ce9('0x28')][_0x35f913[_0x3ce9('0x22')]][_0x386c1a][_0x3ce9('0xa')])){this['channels'][_0x35f913['uniqueid']][_0x386c1a][_0x3ce9('0xa')]={};}this[_0x3ce9('0x28')][_0x35f913[_0x3ce9('0x22')]][_0x386c1a][_0x3ce9('0xa')]=this['variables'][_0x35f913[_0x3ce9('0x22')]];}}}}}catch(_0x5dcef6){logger['error'](_0x3ce9('0x6d'),_0x35f913['uniqueid'],util[_0x3ce9('0x27')](_0x5dcef6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ce9('0x1e')][_0x3ce9('0x6e')]=function(_0x450cd3,_0x2c81e6,_0x9719c5){var _0x230dcb=['rtpaudioqos','rtpaudioqosbridged',_0x3ce9('0x6f'),_0x3ce9('0x70'),'rtpaudioqosloss',_0x3ce9('0x71'),_0x3ce9('0x72'),_0x3ce9('0x73'),_0x3ce9('0x74'),_0x3ce9('0x75'),'bridgepeer',_0x3ce9('0x76'),_0x3ce9('0x77'),_0x3ce9('0x78'),_0x3ce9('0x79'),_0x3ce9('0x7a'),'membername',_0x3ce9('0x7b'),_0x3ce9('0x7c')];if(!_['isNil'](_0x2c81e6)&&!_[_0x3ce9('0x7d')](_0x230dcb,_0x2c81e6)){if(_[_0x3ce9('0x1f')](this['variables'][_0x450cd3])){this[_0x3ce9('0xa')][_0x450cd3]={};}this['variables'][_0x450cd3][_0x2c81e6]=_0x9719c5;}};VoiceAgentReport[_0x3ce9('0x1e')][_0x3ce9('0x15')]=function(_0x5558d2){try{if(this[_0x3ce9('0x37')](_0x5558d2)){logger[_0x3ce9('0x25')](_0x3ce9('0x7e'),_0x5558d2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x5558d2,{'showHidden':![],'depth':null}));if(this[_0x3ce9('0x28')][_0x5558d2[_0x3ce9('0x22')]]){for(var _0x51233f in this[_0x3ce9('0x28')][_0x5558d2['uniqueid']]){if(this[_0x3ce9('0x28')][_0x5558d2[_0x3ce9('0x22')]][_0x3ce9('0x38')](_0x51233f)){if(this[_0x3ce9('0x28')][_0x5558d2['uniqueid']][_0x51233f]['reason']==_0x3ce9('0x5f')&&this[_0x3ce9('0x28')][_0x5558d2['uniqueid']][_0x51233f][_0x3ce9('0x10')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x5558d2[_0x3ce9('0x22')],_0x51233f);this[_0x3ce9('0x28')][_0x5558d2[_0x3ce9('0x22')]][_0x51233f][_0x3ce9('0x5d')]=moment()[_0x3ce9('0x29')](_0x3ce9('0x3b'));}}}logger['debug'](_0x3ce9('0x7f'),_0x5558d2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_[_0x3ce9('0x80')](this[_0x3ce9('0x28')][_0x5558d2['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x3ce9('0x1d')](_0x3ce9('0x81'),_[_0x3ce9('0x80')](this[_0x3ce9('0x28')][_0x5558d2[_0x3ce9('0x22')]]));delete this['channels'][_0x5558d2[_0x3ce9('0x22')]];}if(this[_0x3ce9('0xa')][_0x5558d2[_0x3ce9('0x22')]]){delete this[_0x3ce9('0xa')][_0x5558d2[_0x3ce9('0x22')]];}}}catch(_0x19ba75){logger[_0x3ce9('0x35')]('[%s][voiceAgentReport][hangup]',_0x5558d2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x19ba75,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ce9('0x1e')][_0x3ce9('0x1a')]=function(_0x57cde2){try{if(this[_0x3ce9('0x37')](_0x57cde2)){logger['debug'](_0x3ce9('0x82'),_0x57cde2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x57cde2,{'showHidden':![],'depth':null}));if(this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x83')]]){for(var _0x45f42f in this['channels'][_0x57cde2[_0x3ce9('0x83')]]){if(this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x83')]][_0x3ce9('0x38')](_0x45f42f)){if(_0x57cde2[_0x3ce9('0x84')]===_0x45f42f){logger[_0x3ce9('0x20')](_0x3ce9('0x85'),_0x57cde2[_0x3ce9('0x22')],this['channels'][_0x57cde2['transfereeuniqueid']][_0x45f42f][_0x3ce9('0x23')],_0x45f42f);var _0x32d8b3=moment();this['channels'][_0x57cde2[_0x3ce9('0x83')]][_0x45f42f][_0x3ce9('0x10')]=!![];this[_0x3ce9('0x28')][_0x57cde2['transfereeuniqueid']][_0x45f42f][_0x3ce9('0x5d')]=moment()[_0x3ce9('0x29')](_0x3ce9('0x3b'));this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x83')]][_0x45f42f][_0x3ce9('0x3f')]=_0x3ce9('0x5e');this[_0x3ce9('0x28')][_0x57cde2['transfereeuniqueid']][_0x45f42f][_0x3ce9('0x4c')]=_0x3ce9('0x5f');this[_0x3ce9('0x28')][_0x57cde2['transfereeuniqueid']][_0x45f42f][_0x3ce9('0x60')]=_0x32d8b3[_0x3ce9('0x86')](this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x83')]][_0x45f42f][_0x3ce9('0x3a')],'seconds');}}}}if(this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x87')]]){var _0x287f05=this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x87')]];this[_0x3ce9('0x28')][_0x57cde2['secondtransfereruniqueid']]=this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x83')]];this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x83')]]=_0x287f05;}}}catch(_0xc1ad4c){logger[_0x3ce9('0x35')](_0x3ce9('0x88'),_0x57cde2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0xc1ad4c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ce9('0x1e')]['syncBlindTransfer']=function(_0x8afa75){try{if(this[_0x3ce9('0x37')](_0x8afa75)){logger[_0x3ce9('0x25')](_0x3ce9('0x89'),_0x8afa75[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x8afa75,{'showHidden':![],'depth':null}));if(this[_0x3ce9('0x28')][_0x8afa75[_0x3ce9('0x83')]]){for(var _0x246958 in this[_0x3ce9('0x28')][_0x8afa75[_0x3ce9('0x83')]]){if(this['channels'][_0x8afa75[_0x3ce9('0x83')]][_0x3ce9('0x38')](_0x246958)){if(_0x8afa75[_0x3ce9('0x8a')]===_0x246958){logger[_0x3ce9('0x20')](_0x3ce9('0x8b'),_0x8afa75['uniqueid'],this[_0x3ce9('0x28')][_0x8afa75[_0x3ce9('0x83')]][_0x246958][_0x3ce9('0x23')],_0x246958);var _0x41f375=moment();this[_0x3ce9('0x28')][_0x8afa75['transfereeuniqueid']][_0x246958][_0x3ce9('0x10')]=!![];this[_0x3ce9('0x28')][_0x8afa75[_0x3ce9('0x83')]][_0x246958][_0x3ce9('0x5d')]=_0x41f375;this[_0x3ce9('0x28')][_0x8afa75[_0x3ce9('0x83')]][_0x246958]['lastevent']=_0x3ce9('0x5e');this[_0x3ce9('0x28')][_0x8afa75[_0x3ce9('0x83')]][_0x246958]['reason']=_0x3ce9('0x5f');this[_0x3ce9('0x28')][_0x8afa75[_0x3ce9('0x83')]][_0x246958]['talktime']=_0x41f375[_0x3ce9('0x86')](this[_0x3ce9('0x28')][_0x8afa75['transfereeuniqueid']][_0x246958][_0x3ce9('0x3a')],_0x3ce9('0x8c'));}}}}}}catch(_0x337ca1){logger[_0x3ce9('0x35')](_0x3ce9('0x8d'),_0x8afa75[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x337ca1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ce9('0x1e')]['syncMusicOnHoldStart']=function(_0x569c53){var _0x1b4b5d='';try{if(this[_0x3ce9('0x37')](_0x569c53)){logger[_0x3ce9('0x25')](_0x3ce9('0x8e'),_0x569c53[_0x3ce9('0x22')],util['inspect'](_0x569c53,{'showHidden':![],'depth':null}));if(_0x569c53[_0x3ce9('0x8f')]){_0x1b4b5d=_0x569c53[_0x3ce9('0x8f')][_0x3ce9('0x90')](0x0,_0x569c53[_0x3ce9('0x8f')]['lastIndexOf']('-'));if(this[_0x3ce9('0x9')][_0x1b4b5d]){logger[_0x3ce9('0x20')](_0x3ce9('0x91'),_0x569c53[_0x3ce9('0x22')],_0x1b4b5d);this[_0x3ce9('0x9')][_0x1b4b5d][_0x3ce9('0x92')]=!![];}}}}catch(_0x59dd5e){logger[_0x3ce9('0x35')]('[%s][voiceAgentReport][musiconholdstart]',_0x569c53[_0x3ce9('0x22')],util['inspect'](_0x59dd5e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3ce9('0x18')]=function(_0x5be634){var _0x4419a7='';try{if(this[_0x3ce9('0x37')](_0x5be634)){logger[_0x3ce9('0x25')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x5be634[_0x3ce9('0x22')],util['inspect'](_0x5be634,{'showHidden':![],'depth':null}));if(_0x5be634[_0x3ce9('0x8f')]){_0x4419a7=_0x5be634[_0x3ce9('0x8f')]['substring'](0x0,_0x5be634['channel'][_0x3ce9('0x93')]('-'));if(this['agents'][_0x4419a7]){logger[_0x3ce9('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x5be634['uniqueid'],_0x4419a7);this[_0x3ce9('0x9')][_0x4419a7][_0x3ce9('0x92')]=![];}}}}catch(_0x726afe){logger[_0x3ce9('0x35')](_0x3ce9('0x94'),_0x5be634[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x726afe,{'showHidden':![],'depth':null}));}};module[_0x3ce9('0x95')]=VoiceAgentReport; \ No newline at end of file +var _0xcb2f=['omit','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','channels','voiceQueues','agents','variables','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','syncAgentCalled','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','privilege','custom:agentcalled','user:called','error','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','merge','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xcb2f,0xc2));var _0xfcb2=function(_0xf898da,_0x521511){_0xf898da=_0xf898da-0x0;var _0x53f644=_0xcb2f[_0xf898da];return _0x53f644;};'use strict';var _=require(_0xfcb2('0x0'));var moment=require('moment');var util=require(_0xfcb2('0x1'));var Redis=require(_0xfcb2('0x2'));var config=require(_0xfcb2('0x3'));var logger=require(_0xfcb2('0x4'))(_0xfcb2('0x5'));var ami=require(_0xfcb2('0x6'));config[_0xfcb2('0x7')]=_['defaults'](config[_0xfcb2('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xfcb2('0x8'))(new Redis(config[_0xfcb2('0x7')]));function VoiceAgentReport(_0xff1ea0){this[_0xfcb2('0x9')]={};this['voiceQueues']=_0xff1ea0[_0xfcb2('0xa')];this[_0xfcb2('0xb')]=_0xff1ea0['agents'];this[_0xfcb2('0xc')]={};ami['on']('agentcalled',this['syncAgentCalled'][_0xfcb2('0xd')](this));ami['on'](_0xfcb2('0xe'),this[_0xfcb2('0xf')]['bind'](this));ami['on'](_0xfcb2('0x10'),this['syncAgentRingNoAnswer'][_0xfcb2('0xd')](this));ami['on'](_0xfcb2('0x11'),this[_0xfcb2('0x12')][_0xfcb2('0xd')](this));ami['on']('agentcomplete',this[_0xfcb2('0x13')][_0xfcb2('0xd')](this));ami['on'](_0xfcb2('0x14'),this[_0xfcb2('0x15')]['bind'](this));ami['on'](_0xfcb2('0x16'),this[_0xfcb2('0x17')][_0xfcb2('0xd')](this));ami['on'](_0xfcb2('0x18'),this[_0xfcb2('0x19')]['bind'](this));ami['on'](_0xfcb2('0x1a'),this[_0xfcb2('0x1b')]['bind'](this));ami['on'](_0xfcb2('0x1c'),this[_0xfcb2('0x1d')][_0xfcb2('0xd')](this));ami['on'](_0xfcb2('0x1e'),this['syncBlindTransfer'][_0xfcb2('0xd')](this));}VoiceAgentReport[_0xfcb2('0x1f')][_0xfcb2('0x20')]=function(_0x2587fd,_0x13feec,_0x52c91f){io['to'](_0x2587fd)['emit'](_0x13feec,_0x52c91f);};VoiceAgentReport[_0xfcb2('0x1f')][_0xfcb2('0x21')]=function(_0x56a264){return _0x56a264!==null&&!_['isUndefined'](_0x56a264);};VoiceAgentReport[_0xfcb2('0x1f')][_0xfcb2('0x22')]=function(_0x3bf217){try{if(this['isNotNull'](_0x3bf217)){logger['info'](_0xfcb2('0x23'),_0x3bf217[_0xfcb2('0x24')],_0x3bf217[_0xfcb2('0x25')],_0x3bf217['destuniqueid']);logger[_0xfcb2('0x26')](_0xfcb2('0x27'),_0x3bf217[_0xfcb2('0x24')],util[_0xfcb2('0x28')](_0x3bf217,{'showHidden':![],'depth':null}));if(_[_0xfcb2('0x29')](this[_0xfcb2('0x9')][_0x3bf217[_0xfcb2('0x24')]])){this[_0xfcb2('0x9')][_0x3bf217['uniqueid']]={};}if(_[_0xfcb2('0x29')](this['channels'][_0x3bf217['uniqueid']][_0x3bf217['destuniqueid']])){this['channels'][_0x3bf217[_0xfcb2('0x24')]][_0x3bf217[_0xfcb2('0x2a')]]={'agentcalledAt':moment()[_0xfcb2('0x2b')](_0xfcb2('0x2c')),'lastevent':_0xfcb2('0x2d'),'mandatoryDisposition':this[_0xfcb2('0xa')][_0x3bf217['queue']]?this['voiceQueues'][_0x3bf217[_0xfcb2('0x2e')]][_0xfcb2('0x2f')]||![]:![],'type':this[_0xfcb2('0xa')][_0x3bf217['queue']]?this[_0xfcb2('0xa')][_0x3bf217[_0xfcb2('0x2e')]][_0xfcb2('0x30')]||_0xfcb2('0x31'):_0xfcb2('0x31'),'variables':this[_0xfcb2('0xc')][_0x3bf217[_0xfcb2('0x24')]]};}_['merge'](this[_0xfcb2('0x9')][_0x3bf217[_0xfcb2('0x24')]][_0x3bf217['destuniqueid']],_['omit'](_0x3bf217,['event',_0xfcb2('0x32')]));logger[_0xfcb2('0x26')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x3bf217[_0xfcb2('0x24')],util[_0xfcb2('0x28')](this[_0xfcb2('0x9')][_0x3bf217[_0xfcb2('0x24')]][_0x3bf217[_0xfcb2('0x2a')]],{'showHidden':![],'depth':null}));ami[_0xfcb2('0x20')](_0xfcb2('0x33'),this[_0xfcb2('0x9')][_0x3bf217[_0xfcb2('0x24')]][_0x3bf217[_0xfcb2('0x2a')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x3bf217[_0xfcb2('0x24')],util[_0xfcb2('0x28')](this[_0xfcb2('0x9')][_0x3bf217['uniqueid']][_0x3bf217[_0xfcb2('0x2a')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xfcb2('0x2b')]('user:%s',_0x3bf217[_0xfcb2('0x25')]),_0xfcb2('0x34'),this[_0xfcb2('0x9')][_0x3bf217[_0xfcb2('0x24')]][_0x3bf217[_0xfcb2('0x2a')]]);}}catch(_0x5af827){logger[_0xfcb2('0x35')]('[%s][voiceAgentReport][agentcalled]',_0x3bf217['uniqueid'],util[_0xfcb2('0x28')](_0x5af827,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfcb2('0xf')]=function(_0x2ea2fe){try{if(this[_0xfcb2('0x21')](_0x2ea2fe)){if(this[_0xfcb2('0x9')][_0x2ea2fe[_0xfcb2('0x24')]]){logger[_0xfcb2('0x26')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x2ea2fe['uniqueid'],util[_0xfcb2('0x28')](_0x2ea2fe,{'showHidden':![],'depth':null}));for(var _0x4bcb53 in this['channels'][_0x2ea2fe[_0xfcb2('0x24')]]){if(this[_0xfcb2('0x9')][_0x2ea2fe['uniqueid']][_0xfcb2('0x36')](_0x4bcb53)){if(_0x2ea2fe[_0xfcb2('0x2a')]===_0x4bcb53){logger[_0xfcb2('0x37')](_0xfcb2('0x38'),_0x2ea2fe[_0xfcb2('0x24')],_0x2ea2fe[_0xfcb2('0x25')],_0x2ea2fe[_0xfcb2('0x2a')]);this[_0xfcb2('0x9')][_0x2ea2fe['uniqueid']][_0x4bcb53][_0xfcb2('0x39')]=moment()[_0xfcb2('0x2b')](_0xfcb2('0x2c'));this[_0xfcb2('0x9')][_0x2ea2fe[_0xfcb2('0x24')]][_0x4bcb53]['connectedlinename']=_0x2ea2fe['connectedlinename'];this[_0xfcb2('0x9')][_0x2ea2fe[_0xfcb2('0x24')]][_0x4bcb53][_0xfcb2('0x3a')]=_0x2ea2fe[_0xfcb2('0x3a')];this['channels'][_0x2ea2fe[_0xfcb2('0x24')]][_0x4bcb53]['destchannelstate']=_0x2ea2fe[_0xfcb2('0x3b')];this[_0xfcb2('0x9')][_0x2ea2fe['uniqueid']][_0x4bcb53][_0xfcb2('0x3c')]=_0x2ea2fe[_0xfcb2('0x3c')];this[_0xfcb2('0x9')][_0x2ea2fe[_0xfcb2('0x24')]][_0x4bcb53]['holdtime']=_0x2ea2fe[_0xfcb2('0x3d')];this['channels'][_0x2ea2fe['uniqueid']][_0x4bcb53][_0xfcb2('0x3e')]=_0xfcb2('0x3f');_[_0xfcb2('0x40')](this[_0xfcb2('0xb')][_0x2ea2fe[_0xfcb2('0x41')]],_[_0xfcb2('0x42')](_0x2ea2fe,[_0xfcb2('0x2e'),_0xfcb2('0x43')]));logger[_0xfcb2('0x26')](_0xfcb2('0x44'),_0x2ea2fe[_0xfcb2('0x24')],util['inspect'](this[_0xfcb2('0x9')][_0x2ea2fe[_0xfcb2('0x24')]][_0x2ea2fe['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xfcb2('0x20')](_0xfcb2('0x45'),this[_0xfcb2('0x9')][_0x2ea2fe[_0xfcb2('0x24')]][_0x2ea2fe[_0xfcb2('0x2a')]]);logger[_0xfcb2('0x26')](_0xfcb2('0x46'),_0x2ea2fe['uniqueid'],util[_0xfcb2('0x28')](this[_0xfcb2('0x9')][_0x2ea2fe[_0xfcb2('0x24')]][_0x2ea2fe[_0xfcb2('0x2a')]],{'showHidden':![],'depth':null}));this[_0xfcb2('0x20')](util[_0xfcb2('0x2b')](_0xfcb2('0x47'),_0x2ea2fe[_0xfcb2('0x25')]),'user:agentconnect',this[_0xfcb2('0x9')][_0x2ea2fe[_0xfcb2('0x24')]][_0x2ea2fe[_0xfcb2('0x2a')]]);}else if(!this[_0xfcb2('0x9')][_0x2ea2fe[_0xfcb2('0x24')]][_0x4bcb53][_0xfcb2('0x10')]&&!this[_0xfcb2('0x9')][_0x2ea2fe[_0xfcb2('0x24')]][_0x4bcb53][_0xfcb2('0x48')]){logger[_0xfcb2('0x37')](_0xfcb2('0x49'),_0x2ea2fe[_0xfcb2('0x24')],this['channels'][_0x2ea2fe[_0xfcb2('0x24')]][_0x4bcb53][_0xfcb2('0x25')],_0x4bcb53);this['channels'][_0x2ea2fe[_0xfcb2('0x24')]][_0x4bcb53]['agentringnoanswer']=!![];this[_0xfcb2('0x9')][_0x2ea2fe[_0xfcb2('0x24')]][_0x4bcb53][_0xfcb2('0x4a')]=moment()[_0xfcb2('0x2b')](_0xfcb2('0x2c'));this['channels'][_0x2ea2fe['uniqueid']][_0x4bcb53][_0xfcb2('0x4b')]=_0x2ea2fe[_0xfcb2('0x2a')];this[_0xfcb2('0x9')][_0x2ea2fe[_0xfcb2('0x24')]][_0x4bcb53][_0xfcb2('0x4c')]=_0x2ea2fe[_0xfcb2('0x25')];this[_0xfcb2('0x9')][_0x2ea2fe['uniqueid']][_0x4bcb53]['lastevent']=_0xfcb2('0x4d');this[_0xfcb2('0x9')][_0x2ea2fe[_0xfcb2('0x24')]][_0x4bcb53][_0xfcb2('0x4e')]=_0xfcb2('0x4d');logger['debug'](_0xfcb2('0x4f'),_0x2ea2fe[_0xfcb2('0x24')],util['inspect'](this[_0xfcb2('0x9')][_0x2ea2fe['uniqueid']][_0x4bcb53],{'showHidden':![],'depth':null}));ami[_0xfcb2('0x20')](_0xfcb2('0x50'),this[_0xfcb2('0x9')][_0x2ea2fe[_0xfcb2('0x24')]][_0x4bcb53]);}}}}}}catch(_0x218335){logger['error'](_0xfcb2('0x51'),_0x2ea2fe[_0xfcb2('0x24')],util[_0xfcb2('0x28')](_0x218335,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfcb2('0x1f')]['syncAgentRingNoAnswer']=function(_0x274a24){try{if(this[_0xfcb2('0x21')](_0x274a24)){logger[_0xfcb2('0x26')](_0xfcb2('0x52'),_0x274a24[_0xfcb2('0x24')],util[_0xfcb2('0x28')](_0x274a24,{'showHidden':![],'depth':null}));if(this['channels'][_0x274a24[_0xfcb2('0x24')]]&&this[_0xfcb2('0x9')][_0x274a24[_0xfcb2('0x24')]][_0x274a24[_0xfcb2('0x2a')]]){logger[_0xfcb2('0x37')](_0xfcb2('0x53'),_0x274a24[_0xfcb2('0x24')],_0x274a24['membername'],_0x274a24['destuniqueid']);this['channels'][_0x274a24['uniqueid']][_0x274a24[_0xfcb2('0x2a')]][_0xfcb2('0x10')]=!![];this[_0xfcb2('0x9')][_0x274a24[_0xfcb2('0x24')]][_0x274a24[_0xfcb2('0x2a')]][_0xfcb2('0x4a')]=moment()[_0xfcb2('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfcb2('0x9')][_0x274a24['uniqueid']][_0x274a24['destuniqueid']]['lastevent']=_0xfcb2('0x54');this[_0xfcb2('0x9')][_0x274a24[_0xfcb2('0x24')]][_0x274a24['destuniqueid']][_0xfcb2('0x4e')]='rejected';logger[_0xfcb2('0x26')](_0xfcb2('0x55'),_0x274a24['uniqueid'],util['inspect'](this['channels'][_0x274a24[_0xfcb2('0x24')]][_0x274a24['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xfcb2('0x56'),this[_0xfcb2('0x9')][_0x274a24[_0xfcb2('0x24')]][_0x274a24[_0xfcb2('0x2a')]]);}}}catch(_0x1b3945){logger['error'](_0xfcb2('0x57'),_0x274a24[_0xfcb2('0x24')],util[_0xfcb2('0x28')](_0x1b3945,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfcb2('0x12')]=function(_0x183b2e){try{if(this[_0xfcb2('0x21')](_0x183b2e)){logger['debug'](_0xfcb2('0x58'),_0x183b2e[_0xfcb2('0x24')],util[_0xfcb2('0x28')](_0x183b2e,{'showHidden':![],'depth':null}));if(this['channels'][_0x183b2e[_0xfcb2('0x24')]]){for(var _0x191bbe in this['channels'][_0x183b2e['uniqueid']]){if(this[_0xfcb2('0x9')][_0x183b2e[_0xfcb2('0x24')]]['hasOwnProperty'](_0x191bbe)&&!this['channels'][_0x183b2e[_0xfcb2('0x24')]][_0x191bbe][_0xfcb2('0x10')]&&!this[_0xfcb2('0x9')][_0x183b2e[_0xfcb2('0x24')]][_0x191bbe][_0xfcb2('0x48')]){logger[_0xfcb2('0x37')](_0xfcb2('0x59'),_0x183b2e[_0xfcb2('0x24')],this['channels'][_0x183b2e[_0xfcb2('0x24')]][_0x191bbe][_0xfcb2('0x25')],_0x191bbe);this[_0xfcb2('0x9')][_0x183b2e[_0xfcb2('0x24')]][_0x191bbe][_0xfcb2('0x10')]=!![];this[_0xfcb2('0x9')][_0x183b2e[_0xfcb2('0x24')]][_0x191bbe][_0xfcb2('0x4a')]=moment()[_0xfcb2('0x2b')](_0xfcb2('0x2c'));this[_0xfcb2('0x9')][_0x183b2e[_0xfcb2('0x24')]][_0x191bbe][_0xfcb2('0x3e')]='abandoned';this['channels'][_0x183b2e[_0xfcb2('0x24')]][_0x191bbe][_0xfcb2('0x4e')]=_0xfcb2('0x5a');logger['debug'](_0xfcb2('0x5b'),_0x183b2e[_0xfcb2('0x24')],util[_0xfcb2('0x28')](this[_0xfcb2('0x9')][_0x183b2e[_0xfcb2('0x24')]][_0x191bbe],{'showHidden':![],'depth':null}));ami[_0xfcb2('0x20')](_0xfcb2('0x5c'),this[_0xfcb2('0x9')][_0x183b2e[_0xfcb2('0x24')]][_0x191bbe]);}}}}}catch(_0xafe7d9){logger['error'](_0xfcb2('0x5d'),_0x183b2e[_0xfcb2('0x24')],util['inspect'](_0xafe7d9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfcb2('0x1f')]['syncAgentComplete']=function(_0x3fb6ea){try{if(this[_0xfcb2('0x21')](_0x3fb6ea)){logger[_0xfcb2('0x26')](_0xfcb2('0x5e'),_0x3fb6ea['uniqueid'],util[_0xfcb2('0x28')](_0x3fb6ea,{'showHidden':![],'depth':null}));if(this[_0xfcb2('0x9')][_0x3fb6ea[_0xfcb2('0x24')]]){for(var _0x4cfa7f in this[_0xfcb2('0x9')][_0x3fb6ea['uniqueid']]){if(this[_0xfcb2('0x9')][_0x3fb6ea[_0xfcb2('0x24')]][_0xfcb2('0x36')](_0x4cfa7f)){if(this[_0xfcb2('0x9')][_0x3fb6ea[_0xfcb2('0x24')]][_0x4cfa7f][_0xfcb2('0x39')]&&!this['channels'][_0x3fb6ea[_0xfcb2('0x24')]][_0x4cfa7f][_0xfcb2('0x48')]){logger[_0xfcb2('0x37')](_0xfcb2('0x5f'),_0x3fb6ea[_0xfcb2('0x24')],this[_0xfcb2('0x9')][_0x3fb6ea[_0xfcb2('0x24')]][_0x4cfa7f][_0xfcb2('0x25')],_0x4cfa7f);this[_0xfcb2('0x9')][_0x3fb6ea[_0xfcb2('0x24')]][_0x4cfa7f][_0xfcb2('0x48')]=!![];this[_0xfcb2('0x9')][_0x3fb6ea[_0xfcb2('0x24')]][_0x4cfa7f][_0xfcb2('0x60')]=moment()[_0xfcb2('0x2b')](_0xfcb2('0x2c'));this['channels'][_0x3fb6ea[_0xfcb2('0x24')]][_0x4cfa7f][_0xfcb2('0x3e')]=_0xfcb2('0x61');this[_0xfcb2('0x9')][_0x3fb6ea[_0xfcb2('0x24')]][_0x4cfa7f][_0xfcb2('0x4e')]=_0x3fb6ea[_0xfcb2('0x4e')]==_0xfcb2('0x62')?_0xfcb2('0x63'):_0x3fb6ea['reason'];this[_0xfcb2('0x9')][_0x3fb6ea[_0xfcb2('0x24')]][_0x4cfa7f][_0xfcb2('0x64')]=_0x3fb6ea[_0xfcb2('0x64')];if(this[_0xfcb2('0xa')][_0x3fb6ea[_0xfcb2('0x2e')]]&&this[_0xfcb2('0xa')][_0x3fb6ea[_0xfcb2('0x2e')]][_0xfcb2('0x65')]){this[_0xfcb2('0x9')][_0x3fb6ea[_0xfcb2('0x24')]][_0x4cfa7f][_0xfcb2('0x66')]=this[_0xfcb2('0xa')][_0x3fb6ea[_0xfcb2('0x2e')]]['acwTimeout'];this['channels'][_0x3fb6ea[_0xfcb2('0x24')]][_0x4cfa7f][_0xfcb2('0x67')]=!![];}this['agents'][_0x3fb6ea[_0xfcb2('0x41')]]=_[_0xfcb2('0x68')](this[_0xfcb2('0xb')][_0x3fb6ea[_0xfcb2('0x41')]],[_0xfcb2('0x2e'),_0xfcb2('0x43')]);logger[_0xfcb2('0x26')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x3fb6ea[_0xfcb2('0x24')],util[_0xfcb2('0x28')](this[_0xfcb2('0x9')][_0x3fb6ea[_0xfcb2('0x24')]][_0x4cfa7f],{'showHidden':![],'depth':null}));ami[_0xfcb2('0x20')]('custom:agentcomplete',this[_0xfcb2('0x9')][_0x3fb6ea[_0xfcb2('0x24')]][_0x4cfa7f]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x3fb6ea[_0xfcb2('0x24')],util['inspect'](this[_0xfcb2('0x9')][_0x3fb6ea[_0xfcb2('0x24')]][_0x4cfa7f],{'showHidden':![],'depth':null}));this[_0xfcb2('0x20')](util['format'](_0xfcb2('0x47'),_0x3fb6ea[_0xfcb2('0x25')]),'user:agentcomplete',this[_0xfcb2('0x9')][_0x3fb6ea[_0xfcb2('0x24')]][_0x4cfa7f]);}}}}}}catch(_0x1231e2){logger[_0xfcb2('0x35')](_0xfcb2('0x69'),_0x3fb6ea['uniqueid'],util[_0xfcb2('0x28')](_0x1231e2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfcb2('0x1f')][_0xfcb2('0x15')]=function(_0x28a48b){try{if(this[_0xfcb2('0x21')](_0x28a48b)){logger[_0xfcb2('0x26')](_0xfcb2('0x6a'),_0x28a48b[_0xfcb2('0x24')],util['inspect'](_0x28a48b,{'showHidden':![],'depth':null}));this['addVariable'](_0x28a48b[_0xfcb2('0x24')],_[_0xfcb2('0x6b')](_0x28a48b[_0xfcb2('0x6c')])[0x0],_0x28a48b[_0xfcb2('0x6d')]);if(this[_0xfcb2('0x9')][_0x28a48b[_0xfcb2('0x24')]]){for(var _0x5cc1e6 in this['channels'][_0x28a48b['uniqueid']]){if(this['channels'][_0x28a48b['uniqueid']][_0xfcb2('0x36')](_0x5cc1e6)){logger['info']('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x28a48b['uniqueid'],_0x5cc1e6,_[_0xfcb2('0x6b')](_0x28a48b[_0xfcb2('0x6c')])[0x0],_0x28a48b[_0xfcb2('0x6d')]);if(_[_0xfcb2('0x29')](this['channels'][_0x28a48b[_0xfcb2('0x24')]][_0x5cc1e6][_0xfcb2('0xc')])){this[_0xfcb2('0x9')][_0x28a48b[_0xfcb2('0x24')]][_0x5cc1e6][_0xfcb2('0xc')]={};}this['channels'][_0x28a48b[_0xfcb2('0x24')]][_0x5cc1e6][_0xfcb2('0xc')]=this['variables'][_0x28a48b[_0xfcb2('0x24')]];}}}}}catch(_0x36b08d){logger[_0xfcb2('0x35')](_0xfcb2('0x6e'),_0x28a48b[_0xfcb2('0x24')],util['inspect'](_0x36b08d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfcb2('0x1f')][_0xfcb2('0x6f')]=function(_0x351743,_0x59b4ae,_0x31811e){var _0x4e3afc=[_0xfcb2('0x70'),_0xfcb2('0x71'),_0xfcb2('0x72'),_0xfcb2('0x73'),_0xfcb2('0x74'),_0xfcb2('0x75'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0xfcb2('0x76'),_0xfcb2('0x77'),_0xfcb2('0x78'),'bridgepvtcallid',_0xfcb2('0x79'),_0xfcb2('0x7a'),_0xfcb2('0x7b'),_0xfcb2('0x7c'),_0xfcb2('0x25'),'memberpenalty','memberrealtime'];if(!_[_0xfcb2('0x7d')](_0x59b4ae)&&!_[_0xfcb2('0x7e')](_0x4e3afc,_0x59b4ae)){if(_['isUndefined'](this[_0xfcb2('0xc')][_0x351743])){this[_0xfcb2('0xc')][_0x351743]={};}this[_0xfcb2('0xc')][_0x351743][_0x59b4ae]=_0x31811e;}};VoiceAgentReport[_0xfcb2('0x1f')]['syncHangup']=function(_0x596467){try{if(this[_0xfcb2('0x21')](_0x596467)){logger[_0xfcb2('0x26')](_0xfcb2('0x7f'),_0x596467[_0xfcb2('0x24')],util['inspect'](_0x596467,{'showHidden':![],'depth':null}));if(this['channels'][_0x596467[_0xfcb2('0x24')]]){for(var _0x2e8beb in this[_0xfcb2('0x9')][_0x596467[_0xfcb2('0x24')]]){if(this[_0xfcb2('0x9')][_0x596467[_0xfcb2('0x24')]][_0xfcb2('0x36')](_0x2e8beb)){if(this[_0xfcb2('0x9')][_0x596467['uniqueid']][_0x2e8beb][_0xfcb2('0x4e')]=='transfer'&&this['channels'][_0x596467[_0xfcb2('0x24')]][_0x2e8beb][_0xfcb2('0x48')]){logger[_0xfcb2('0x37')](_0xfcb2('0x80'),_0x596467[_0xfcb2('0x24')],_0x2e8beb);this[_0xfcb2('0x9')][_0x596467['uniqueid']][_0x2e8beb]['agentcompleteAt']=moment()[_0xfcb2('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0xfcb2('0x26')](_0xfcb2('0x81'),_0x596467[_0xfcb2('0x24')],util[_0xfcb2('0x28')](_['values'](this[_0xfcb2('0x9')][_0x596467[_0xfcb2('0x24')]]),{'showHidden':![],'depth':null}));ami['emit']('custom:voiceAgentReport',_['values'](this['channels'][_0x596467['uniqueid']]));delete this['channels'][_0x596467[_0xfcb2('0x24')]];}if(this[_0xfcb2('0xc')][_0x596467['uniqueid']]){delete this['variables'][_0x596467[_0xfcb2('0x24')]];}}}catch(_0x53d1f8){logger['error']('[%s][voiceAgentReport][hangup]',_0x596467['uniqueid'],util[_0xfcb2('0x28')](_0x53d1f8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfcb2('0x1f')][_0xfcb2('0x1d')]=function(_0x155b9b){try{if(this[_0xfcb2('0x21')](_0x155b9b)){logger[_0xfcb2('0x26')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x155b9b[_0xfcb2('0x24')],util[_0xfcb2('0x28')](_0x155b9b,{'showHidden':![],'depth':null}));if(this[_0xfcb2('0x9')][_0x155b9b['transfereeuniqueid']]){for(var _0x6fd5cd in this['channels'][_0x155b9b[_0xfcb2('0x82')]]){if(this[_0xfcb2('0x9')][_0x155b9b[_0xfcb2('0x82')]][_0xfcb2('0x36')](_0x6fd5cd)){if(_0x155b9b[_0xfcb2('0x83')]===_0x6fd5cd){logger[_0xfcb2('0x37')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x155b9b[_0xfcb2('0x24')],this[_0xfcb2('0x9')][_0x155b9b['transfereeuniqueid']][_0x6fd5cd]['membername'],_0x6fd5cd);var _0x42c6e7=moment();this[_0xfcb2('0x9')][_0x155b9b[_0xfcb2('0x82')]][_0x6fd5cd]['agentcomplete']=!![];this['channels'][_0x155b9b[_0xfcb2('0x82')]][_0x6fd5cd][_0xfcb2('0x60')]=moment()[_0xfcb2('0x2b')](_0xfcb2('0x2c'));this['channels'][_0x155b9b['transfereeuniqueid']][_0x6fd5cd][_0xfcb2('0x3e')]=_0xfcb2('0x61');this[_0xfcb2('0x9')][_0x155b9b[_0xfcb2('0x82')]][_0x6fd5cd][_0xfcb2('0x4e')]=_0xfcb2('0x62');this[_0xfcb2('0x9')][_0x155b9b[_0xfcb2('0x82')]][_0x6fd5cd]['talktime']=_0x42c6e7[_0xfcb2('0x84')](this[_0xfcb2('0x9')][_0x155b9b[_0xfcb2('0x82')]][_0x6fd5cd]['agentconnectAt'],_0xfcb2('0x85'));}}}}if(this['channels'][_0x155b9b[_0xfcb2('0x86')]]){var _0x5b53ec=this[_0xfcb2('0x9')][_0x155b9b['secondtransfereruniqueid']];this[_0xfcb2('0x9')][_0x155b9b[_0xfcb2('0x86')]]=this[_0xfcb2('0x9')][_0x155b9b[_0xfcb2('0x82')]];this[_0xfcb2('0x9')][_0x155b9b['transfereeuniqueid']]=_0x5b53ec;}}}catch(_0x3c3adb){logger[_0xfcb2('0x35')](_0xfcb2('0x87'),_0x155b9b[_0xfcb2('0x24')],util[_0xfcb2('0x28')](_0x3c3adb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfcb2('0x1f')][_0xfcb2('0x88')]=function(_0x1591c4){try{if(this[_0xfcb2('0x21')](_0x1591c4)){logger[_0xfcb2('0x26')](_0xfcb2('0x89'),_0x1591c4[_0xfcb2('0x24')],util[_0xfcb2('0x28')](_0x1591c4,{'showHidden':![],'depth':null}));if(this[_0xfcb2('0x9')][_0x1591c4[_0xfcb2('0x82')]]){for(var _0x5b3b67 in this['channels'][_0x1591c4[_0xfcb2('0x82')]]){if(this[_0xfcb2('0x9')][_0x1591c4[_0xfcb2('0x82')]][_0xfcb2('0x36')](_0x5b3b67)){if(_0x1591c4[_0xfcb2('0x8a')]===_0x5b3b67){logger[_0xfcb2('0x37')](_0xfcb2('0x8b'),_0x1591c4['uniqueid'],this[_0xfcb2('0x9')][_0x1591c4[_0xfcb2('0x82')]][_0x5b3b67][_0xfcb2('0x25')],_0x5b3b67);var _0x1d08db=moment();this['channels'][_0x1591c4[_0xfcb2('0x82')]][_0x5b3b67][_0xfcb2('0x48')]=!![];this[_0xfcb2('0x9')][_0x1591c4[_0xfcb2('0x82')]][_0x5b3b67]['agentcompleteAt']=_0x1d08db;this[_0xfcb2('0x9')][_0x1591c4[_0xfcb2('0x82')]][_0x5b3b67][_0xfcb2('0x3e')]=_0xfcb2('0x61');this[_0xfcb2('0x9')][_0x1591c4['transfereeuniqueid']][_0x5b3b67][_0xfcb2('0x4e')]=_0xfcb2('0x62');this[_0xfcb2('0x9')][_0x1591c4[_0xfcb2('0x82')]][_0x5b3b67]['talktime']=_0x1d08db[_0xfcb2('0x84')](this['channels'][_0x1591c4[_0xfcb2('0x82')]][_0x5b3b67][_0xfcb2('0x39')],'seconds');}}}}}}catch(_0xa879d3){logger['error']('[%s][voiceAgentReport][blindtransfer]',_0x1591c4[_0xfcb2('0x24')],util['inspect'](_0xa879d3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfcb2('0x1f')][_0xfcb2('0x19')]=function(_0x369c1a){var _0x344b37='';try{if(this[_0xfcb2('0x21')](_0x369c1a)){logger[_0xfcb2('0x26')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x369c1a[_0xfcb2('0x24')],util[_0xfcb2('0x28')](_0x369c1a,{'showHidden':![],'depth':null}));if(_0x369c1a[_0xfcb2('0x8c')]){_0x344b37=_0x369c1a[_0xfcb2('0x8c')]['substring'](0x0,_0x369c1a['channel'][_0xfcb2('0x8d')]('-'));if(this[_0xfcb2('0xb')][_0x344b37]){logger[_0xfcb2('0x37')](_0xfcb2('0x8e'),_0x369c1a[_0xfcb2('0x24')],_0x344b37);this[_0xfcb2('0xb')][_0x344b37]['onhold']=!![];}}}}catch(_0x5b61ab){logger[_0xfcb2('0x35')](_0xfcb2('0x8f'),_0x369c1a[_0xfcb2('0x24')],util[_0xfcb2('0x28')](_0x5b61ab,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfcb2('0x1b')]=function(_0xc05633){var _0x2319cb='';try{if(this[_0xfcb2('0x21')](_0xc05633)){logger[_0xfcb2('0x26')](_0xfcb2('0x90'),_0xc05633[_0xfcb2('0x24')],util['inspect'](_0xc05633,{'showHidden':![],'depth':null}));if(_0xc05633[_0xfcb2('0x8c')]){_0x2319cb=_0xc05633[_0xfcb2('0x8c')][_0xfcb2('0x91')](0x0,_0xc05633[_0xfcb2('0x8c')][_0xfcb2('0x8d')]('-'));if(this[_0xfcb2('0xb')][_0x2319cb]){logger[_0xfcb2('0x37')](_0xfcb2('0x92'),_0xc05633['uniqueid'],_0x2319cb);this[_0xfcb2('0xb')][_0x2319cb]['onhold']=![];}}}}catch(_0x529306){logger[_0xfcb2('0x35')](_0xfcb2('0x93'),_0xc05633[_0xfcb2('0x24')],util['inspect'](_0x529306,{'showHidden':![],'depth':null}));}};module[_0xfcb2('0x94')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 2c23170..b8960c5 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5caa=['channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','pick','split','destconnectedlinenum','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','toNumber','UserId','membername','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','.WAV','monitorFilename','find','isNil','monitors','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','from-sip','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','lodash','moment','path','ioredis','../../../config/environment','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','syncNewState','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:'];(function(_0x20ebf7,_0x6dc038){var _0x15ca11=function(_0x287c73){while(--_0x287c73){_0x20ebf7['push'](_0x20ebf7['shift']());}};_0x15ca11(++_0x6dc038);}(_0x5caa,0x137));var _0xa5ca=function(_0x11adbd,_0x5055f5){_0x11adbd=_0x11adbd-0x0;var _0x270029=_0x5caa[_0x11adbd];return _0x270029;};'use strict';var BPromise=require('bluebird');var _=require(_0xa5ca('0x0'));var moment=require(_0xa5ca('0x1'));var util=require('util');var path=require(_0xa5ca('0x2'));var Redis=require(_0xa5ca('0x3'));var config=require(_0xa5ca('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0xa5ca('0x5'));var Channel=require(_0xa5ca('0x6'));var statusDesc=[_0xa5ca('0x7'),_0xa5ca('0x8'),_0xa5ca('0x9'),_0xa5ca('0xa'),_0xa5ca('0xb'),_0xa5ca('0xc'),_0xa5ca('0xd'),_0xa5ca('0xe'),'onhold'];var applications=[_0xa5ca('0xf'),_0xa5ca('0x10'),_0xa5ca('0x11'),_0xa5ca('0x12'),_0xa5ca('0x13'),_0xa5ca('0x14')];var dispositions=[_0xa5ca('0x15'),'FAILED',_0xa5ca('0x16'),_0xa5ca('0x15'),_0xa5ca('0x15'),_0xa5ca('0x15'),_0xa5ca('0x17'),_0xa5ca('0x18'),_0xa5ca('0x16'),_0xa5ca('0x16'),_0xa5ca('0x16')];var actions={};config['redis']=_[_0xa5ca('0x19')](config[_0xa5ca('0x1a')],{'host':_0xa5ca('0x1b'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa5ca('0x1a')]));function VoiceCallReport(_0x1ea152){this[_0xa5ca('0x1c')]=_0x1ea152[_0xa5ca('0x1c')];this[_0xa5ca('0x1d')]=_0x1ea152[_0xa5ca('0x1d')];this[_0xa5ca('0x1e')]={};ami['on'](_0xa5ca('0x1f'),this[_0xa5ca('0x20')][_0xa5ca('0x21')](this));ami['on']('newexten',this[_0xa5ca('0x20')][_0xa5ca('0x21')](this));ami['on'](_0xa5ca('0x22'),this[_0xa5ca('0x23')]['bind'](this));ami['on']('newstate',this[_0xa5ca('0x24')][_0xa5ca('0x21')](this));ami['on']('varset',this['syncVarSet'][_0xa5ca('0x21')](this));ami['on']('hangup',this[_0xa5ca('0x25')][_0xa5ca('0x21')](this));ami['on'](_0xa5ca('0x26'),this[_0xa5ca('0x27')][_0xa5ca('0x21')](this));ami['on'](_0xa5ca('0x28'),this[_0xa5ca('0x29')]['bind'](this));ami['on']('blindtransfer',this[_0xa5ca('0x2a')][_0xa5ca('0x21')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xa5ca('0x21')](this));ami['on'](_0xa5ca('0x2b'),this[_0xa5ca('0x2c')][_0xa5ca('0x21')](this));try{logger[_0xa5ca('0x2d')](_0xa5ca('0x2e'));ami[_0xa5ca('0x2f')]();}catch(_0x332acc){logger[_0xa5ca('0x30')](_0xa5ca('0x31'),util[_0xa5ca('0x32')](_0x332acc,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xa5ca('0x33')]['isNotNull']=function(_0x5e0b5e){return _0x5e0b5e!==null&&!_['isUndefined'](_0x5e0b5e);};VoiceCallReport['prototype']['emit']=function(_0xfb43b4,_0x2e1e79,_0x31615a){io['to'](_0xfb43b4)[_0xa5ca('0x34')](_0x2e1e79,_0x31615a);};VoiceCallReport[_0xa5ca('0x33')][_0xa5ca('0x27')]=function(_0x1733c4){try{if(this[_0xa5ca('0x35')](_0x1733c4)){logger[_0xa5ca('0x2d')](_0xa5ca('0x36'),_0x1733c4[_0xa5ca('0x37')],_0x1733c4[_0xa5ca('0x38')],_0x1733c4['calleridnum']);logger[_0xa5ca('0x39')](_0xa5ca('0x3a'),_0x1733c4[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x1733c4,{'showHidden':![],'depth':null}));if(_0x1733c4[_0xa5ca('0x37')]===_0x1733c4[_0xa5ca('0x3b')]){if(!_[_0xa5ca('0x3c')](this['channels'][_0x1733c4['uniqueid']])){_[_0xa5ca('0x3d')](this[_0xa5ca('0x1c')][_0x1733c4['uniqueid']],_['pick'](_0x1733c4,_[_0xa5ca('0x3e')](this['channels'][_0x1733c4[_0xa5ca('0x37')]])));}}}}catch(_0x22a4a3){logger['error'](_0xa5ca('0x3f'),_0x1733c4[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x22a4a3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa5ca('0x23')]=function(_0x356786){try{if(this[_0xa5ca('0x35')](_0x356786)){logger[_0xa5ca('0x39')](_0xa5ca('0x40'),_0x356786[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x356786,{'showHidden':![],'depth':null}));if(_0x356786[_0xa5ca('0x37')]===_0x356786['linkedid']&&_0x356786[_0xa5ca('0x41')]!=_0xa5ca('0x42')){if(_[_0xa5ca('0x3c')](this[_0xa5ca('0x1c')][_0x356786[_0xa5ca('0x37')]])){logger['info'](_0xa5ca('0x43'),_0x356786[_0xa5ca('0x37')],_0x356786[_0xa5ca('0x44')],_0x356786['exten']);this[_0xa5ca('0x1c')][_0x356786[_0xa5ca('0x37')]]=new Channel();this[_0xa5ca('0x1c')][_0x356786[_0xa5ca('0x37')]][_0xa5ca('0x45')]=moment()[_0xa5ca('0x46')](_0xa5ca('0x47'));this['channels'][_0x356786['uniqueid']][_0xa5ca('0x48')]=dispositions[_['toNumber'](_0x356786[_0xa5ca('0x49')])];_[_0xa5ca('0x3d')](this['channels'][_0x356786['uniqueid']],_[_0xa5ca('0x4a')](_0x356786,_['keys'](this[_0xa5ca('0x1c')][_0x356786[_0xa5ca('0x37')]])));if(_0x356786[_0xa5ca('0x44')]==='from-sip'){if(this['agents'][_0x356786[_0xa5ca('0x41')]['split']('-')[0x0]]){this[_0xa5ca('0x1d')][_0x356786[_0xa5ca('0x41')][_0xa5ca('0x4b')]('-')[0x0]][_0xa5ca('0x4c')]=_0x356786[_0xa5ca('0x4d')];logger[_0xa5ca('0x39')](_0xa5ca('0x4e'),_0x356786[_0xa5ca('0x37')],util[_0xa5ca('0x32')]({'destaccountcode':this[_0xa5ca('0x1d')][_0x356786[_0xa5ca('0x41')]['split']('-')[0x0]][_0xa5ca('0x4f')],'destconnectedlinenum':_0x356786['exten']},{'showHidden':![],'depth':null}));this['emit'](util[_0xa5ca('0x46')](_0xa5ca('0x50'),this[_0xa5ca('0x1d')][_0x356786[_0xa5ca('0x41')][_0xa5ca('0x4b')]('-')[0x0]][_0xa5ca('0x51')]),_0xa5ca('0x52'),{'destaccountcode':this[_0xa5ca('0x1d')][_0x356786['channel'][_0xa5ca('0x4b')]('-')[0x0]][_0xa5ca('0x4f')],'destconnectedlinenum':_0x356786[_0xa5ca('0x4d')]});}}}}}}catch(_0x33a076){logger[_0xa5ca('0x30')](_0xa5ca('0x53'),_0x356786['uniqueid'],util[_0xa5ca('0x32')](_0x33a076,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa5ca('0x33')]['syncNewExten']=function(_0x35ce36){try{if(this[_0xa5ca('0x35')](_0x35ce36)){logger[_0xa5ca('0x39')](_0xa5ca('0x54'),_0x35ce36[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x35ce36,{'showHidden':![],'depth':null}));if(_0x35ce36[_0xa5ca('0x37')]===_0x35ce36[_0xa5ca('0x3b')]&&_0x35ce36[_0xa5ca('0x4d')]!='h'&&_0x35ce36[_0xa5ca('0x41')]!=_0xa5ca('0x42')){_0x35ce36[_0xa5ca('0x55')]=_0x35ce36[_0xa5ca('0x55')][_0xa5ca('0x56')]();_0x35ce36[_0xa5ca('0x57')]=(_0x35ce36[_0xa5ca('0x58')]||_0x35ce36[_0xa5ca('0x57')])[_0xa5ca('0x56')]();logger[_0xa5ca('0x2d')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x35ce36['uniqueid'],_0x35ce36['application'],_0x35ce36['applicationdata']);if(_[_0xa5ca('0x3c')](this[_0xa5ca('0x1c')][_0x35ce36['uniqueid']])){this['channels'][_0x35ce36['uniqueid']]=new Channel();this[_0xa5ca('0x1c')][_0x35ce36[_0xa5ca('0x37')]][_0xa5ca('0x45')]=_0x35ce36[_0xa5ca('0x59')]?moment()[_0xa5ca('0x5a')](moment[_0xa5ca('0x59')](_0x35ce36[_0xa5ca('0x59')])[_0xa5ca('0x5b')](),_0xa5ca('0x5b'))[_0xa5ca('0x46')](_0xa5ca('0x47')):moment()[_0xa5ca('0x46')](_0xa5ca('0x47'));this[_0xa5ca('0x1c')][_0x35ce36['uniqueid']][_0xa5ca('0x48')]=_0xa5ca('0x15');}_[_0xa5ca('0x3d')](this[_0xa5ca('0x1c')][_0x35ce36[_0xa5ca('0x37')]],_['pick'](_0x35ce36,_['keys'](this['channels'][_0x35ce36[_0xa5ca('0x37')]])));if(_[_0xa5ca('0x5c')](applications,_0x35ce36[_0xa5ca('0x55')])){this['channels'][_0x35ce36[_0xa5ca('0x37')]][_0xa5ca('0x5d')]=_0x35ce36[_0xa5ca('0x55')];this['channels'][_0x35ce36[_0xa5ca('0x37')]][_0xa5ca('0x5e')]=_0x35ce36[_0xa5ca('0x57')];if(_0x35ce36[_0xa5ca('0x55')]===_0xa5ca('0xf')&&_[_0xa5ca('0x5f')](_0x35ce36[_0xa5ca('0x57')],_0xa5ca('0x60'))){var _0x1b4971=_0x35ce36[_0xa5ca('0x57')][_0xa5ca('0x4b')]('=');var _0x2a6830=_0x1b4971[0x0][_0xa5ca('0x61')](/cdr\((.*)\)/);if(_0x2a6830){this['channels'][_0x35ce36[_0xa5ca('0x37')]][_0x2a6830[0x1]]=_0x1b4971[0x1];}}else if(_0x35ce36[_0xa5ca('0x55')]===_0xa5ca('0x10')){this[_0xa5ca('0x1c')][_0x35ce36[_0xa5ca('0x37')]][_0xa5ca('0x10')]=_0x35ce36[_0xa5ca('0x57')][_0xa5ca('0x4b')](',')[0x0];}}}}}catch(_0x48318c){logger[_0xa5ca('0x30')](_0xa5ca('0x62'),_0x35ce36[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x48318c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa5ca('0x24')]=function(_0x92acc3){try{if(this[_0xa5ca('0x35')](_0x92acc3)){logger[_0xa5ca('0x2d')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x92acc3[_0xa5ca('0x37')],_0x92acc3[_0xa5ca('0x3b')],_0x92acc3[_0xa5ca('0x38')],_0x92acc3['calleridnum']);logger[_0xa5ca('0x39')](_0xa5ca('0x63'),_0x92acc3[_0xa5ca('0x37')],util['inspect'](_0x92acc3,{'showHidden':![],'depth':null}));if(_0x92acc3['uniqueid']!==_0x92acc3['linkedid']){if(this[_0xa5ca('0x1c')][_0x92acc3['linkedid']]){if(_0x92acc3['channelstate']==='6'){if(!this['channels'][_0x92acc3[_0xa5ca('0x3b')]][_0xa5ca('0x64')]){var _0x140fad=moment();this[_0xa5ca('0x1c')][_0x92acc3['linkedid']][_0xa5ca('0x64')]=!![];this['channels'][_0x92acc3['linkedid']][_0xa5ca('0x65')]=_0x140fad[_0xa5ca('0x46')](_0xa5ca('0x47'));if(this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x3b')]][_0xa5ca('0x45')]){this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x3b')]][_0xa5ca('0x66')]=_0x140fad[_0xa5ca('0x67')](this[_0xa5ca('0x1c')][_0x92acc3['linkedid']][_0xa5ca('0x45')],_0xa5ca('0x5b'));}}this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x3b')]][_0xa5ca('0x3b')]=_0x92acc3[_0xa5ca('0x37')];if(_0x92acc3[_0xa5ca('0x68')]!==_0xa5ca('0x69')){this[_0xa5ca('0x1c')][_0x92acc3['linkedid']][_0xa5ca('0x6a')]=_0x92acc3[_0xa5ca('0x68')];}this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x3b')]][_0xa5ca('0x6b')]=_0x92acc3['calleridname'];this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x3b')]][_0xa5ca('0x6c')]=_0x92acc3['channel'];this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x3b')]][_0xa5ca('0x48')]=dispositions[_[_0xa5ca('0x6d')](_0x92acc3['channelstate'])];if(this['agents'][_0x92acc3[_0xa5ca('0x41')][_0xa5ca('0x4b')]('-')[0x0]]){this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x3b')]]['UserId']=this[_0xa5ca('0x1d')][_0x92acc3[_0xa5ca('0x41')][_0xa5ca('0x4b')]('-')[0x0]]['id'];this[_0xa5ca('0x1c')][_0x92acc3['linkedid']]['membername']=this[_0xa5ca('0x1d')][_0x92acc3[_0xa5ca('0x41')][_0xa5ca('0x4b')]('-')[0x0]]['name'];}}}}else{if(this[_0xa5ca('0x1c')][_0x92acc3['uniqueid']]){if(_0x92acc3[_0xa5ca('0x49')]==='6'){if(this[_0xa5ca('0x1d')][_0x92acc3[_0xa5ca('0x41')][_0xa5ca('0x4b')]('-')[0x0]]){this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x37')]][_0xa5ca('0x6e')]=this[_0xa5ca('0x1d')][_0x92acc3[_0xa5ca('0x41')]['split']('-')[0x0]]['id'];this[_0xa5ca('0x1c')][_0x92acc3['uniqueid']][_0xa5ca('0x6f')]=this[_0xa5ca('0x1d')][_0x92acc3['channel'][_0xa5ca('0x4b')]('-')[0x0]][_0xa5ca('0x51')];}}}}}}catch(_0x1ef5bf){logger[_0xa5ca('0x30')]('[%s][voiceCallReport][newstate]',_0x92acc3[_0xa5ca('0x37')],util['inspect'](_0x1ef5bf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa5ca('0x33')][_0xa5ca('0x70')]=function(_0x3132e8,_0x128f5f){try{if(this[_0xa5ca('0x1c')][_0x3132e8]){logger[_0xa5ca('0x2d')](_0xa5ca('0x71'),_0x3132e8,_0x128f5f);this['channels'][_0x3132e8]['monitor']=!![];if(_[_0xa5ca('0x72')](_0x128f5f,_0xa5ca('0x73'))){_0x128f5f=_0x128f5f['replace'](_0xa5ca('0x73'),_0xa5ca('0x74'));}this['channels'][_0x3132e8][_0xa5ca('0x75')]=_0x128f5f;var _0x1ebb4e=_[_0xa5ca('0x76')](this['channels'][_0x3132e8]['monitors'],{'filename':_0x128f5f});if(_[_0xa5ca('0x77')](_0x1ebb4e)){this[_0xa5ca('0x1c')][_0x3132e8][_0xa5ca('0x78')]['push']({'filename':_0x128f5f,'createdAt':moment()[_0xa5ca('0x46')](_0xa5ca('0x47')),'mixmonitorid':'','status':_0xa5ca('0x79')});}}}catch(_0x124714){logger[_0xa5ca('0x30')]('[%s][voiceCallReport][mixMonitorFilename]',_0x3132e8,util['inspect'](_0x124714,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa5ca('0x33')]['syncVarSet']=function(_0x12ca6a){try{if(this[_0xa5ca('0x35')](_0x12ca6a)){logger['debug'](_0xa5ca('0x7a'),_0x12ca6a['uniqueid'],util[_0xa5ca('0x32')](_0x12ca6a,{'showHidden':![],'depth':null}));if(this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x37')]]&&_0x12ca6a[_0xa5ca('0x41')]!=_0xa5ca('0x42')){if(this['isNotNull'](_0x12ca6a[_0xa5ca('0x7b')])){if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x7c')])){logger['info'](_0xa5ca('0x7d'),_0x12ca6a['uniqueid'],_0x12ca6a[_0xa5ca('0x7e')]);this[_0xa5ca('0x70')](_0x12ca6a['uniqueid'],_0x12ca6a[_0xa5ca('0x7e')]);}else if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x7f')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x80'),_0x12ca6a[_0xa5ca('0x37')],_0x12ca6a[_0xa5ca('0x7e')]);this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x37')]]['calleridnum']=_0x12ca6a[_0xa5ca('0x7e')];}else if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x81')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x82'),_0x12ca6a[_0xa5ca('0x37')],_0x12ca6a[_0xa5ca('0x7e')]);this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x37')]][_0xa5ca('0x83')]=_0x12ca6a['value'];}else if(this[_0xa5ca('0x35')](_0x12ca6a['variable'][_0xa5ca('0x84')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x85'),_0x12ca6a[_0xa5ca('0x37')],_0x12ca6a['value']);this[_0xa5ca('0x1c')][_0x12ca6a['uniqueid']][_0xa5ca('0x86')]=_0x12ca6a['value'];}else if(this['isNotNull'](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x87')])){logger['info'](_0xa5ca('0x88'),_0x12ca6a['uniqueid'],_0x12ca6a[_0xa5ca('0x7e')]['split'](',')[0x0]);this[_0xa5ca('0x1c')][_0x12ca6a['uniqueid']][_0xa5ca('0x10')]=_0x12ca6a[_0xa5ca('0x7e')][_0xa5ca('0x4b')](',')[0x0];}else if(this[_0xa5ca('0x35')](_0x12ca6a['variable'][_0xa5ca('0x89')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x8a'),_0x12ca6a['uniqueid'],_0x12ca6a['value']);this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x37')]][_0xa5ca('0x8b')]=_0x12ca6a['value'];}else if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x8c')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x8d'),_0x12ca6a[_0xa5ca('0x37')],_0x12ca6a[_0xa5ca('0x7e')]);this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x37')]][_0xa5ca('0x8e')]=_0x12ca6a[_0xa5ca('0x7e')];}else if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')]['xmd-callerid-preview'])){logger[_0xa5ca('0x2d')](_0xa5ca('0x8f'),_0x12ca6a[_0xa5ca('0x37')],_0x12ca6a[_0xa5ca('0x7e')]);this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x37')]][_0xa5ca('0x90')]=_0x12ca6a[_0xa5ca('0x7e')];}else if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x91')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x92'),_0x12ca6a[_0xa5ca('0x37')],_0x12ca6a[_0xa5ca('0x7e')]);this[_0xa5ca('0x1c')][_0x12ca6a['uniqueid']]['queue']=_0x12ca6a[_0xa5ca('0x7e')];}else if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x93')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x94'),_0x12ca6a['uniqueid'],_0x12ca6a['value']);this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x37')]][_0xa5ca('0x95')]=_0x12ca6a['value'];}}}else if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x7c')])){if(_0x12ca6a[_0xa5ca('0x7e')]){var _0x1afd75=path[_0xa5ca('0x96')](_0x12ca6a['value'])['name'];logger[_0xa5ca('0x2d')](_0xa5ca('0x7d'),_0x1afd75,_0x12ca6a['value']);this['syncMixMonitorFilename'](_0x1afd75,_0x12ca6a[_0xa5ca('0x7e')]);}}else if(this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x3b')]]){if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')])){if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x93')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x94'),_0x12ca6a['linkedid'],_0x12ca6a['value']);this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x3b')]][_0xa5ca('0x97')]=_0x12ca6a[_0xa5ca('0x7e')];}}}}}catch(_0x34c5a3){logger['error']('[%s][voiceCallReport][varset]',_0x12ca6a['uniqueid'],util[_0xa5ca('0x32')](_0x34c5a3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa5ca('0x33')][_0xa5ca('0x25')]=function(_0x205ede){try{if(this[_0xa5ca('0x35')](_0x205ede)){logger[_0xa5ca('0x39')](_0xa5ca('0x98'),_0x205ede[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x205ede,{'showHidden':![],'depth':null}));if(this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]]){logger[_0xa5ca('0x2d')](_0xa5ca('0x99'),_0x205ede[_0xa5ca('0x37')],_0x205ede[_0xa5ca('0x9a')]);var _0x42c484=moment();this[_0xa5ca('0x1c')][_0x205ede['uniqueid']][_0xa5ca('0x9b')]=_0x42c484[_0xa5ca('0x46')](_0xa5ca('0x47'));this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x59')]=_0x42c484[_0xa5ca('0x67')](this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x45')],_0xa5ca('0x5b'));if(this['channels'][_0x205ede[_0xa5ca('0x37')]]['answered']){this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x9c')]=_0x42c484[_0xa5ca('0x67')](this['channels'][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x65')],_0xa5ca('0x5b'));this[_0xa5ca('0x1c')][_0x205ede['uniqueid']][_0xa5ca('0x66')]=this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x59')]-this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x9c')];}if(_0x205ede[_0xa5ca('0x44')]===_0xa5ca('0x9d')){if(this[_0xa5ca('0x1d')][_0x205ede[_0xa5ca('0x41')]['split']('-')[0x0]]){this['agents'][_0x205ede[_0xa5ca('0x41')][_0xa5ca('0x4b')]('-')[0x0]]=_[_0xa5ca('0x9e')](this['agents'][_0x205ede['channel']['split']('-')[0x0]],[_0xa5ca('0x4c')]);logger['debug'](_0xa5ca('0x9f'),_0x205ede[_0xa5ca('0x37')],util[_0xa5ca('0x32')]({'destaccountcode':this['agents'][_0x205ede[_0xa5ca('0x41')]['split']('-')[0x0]][_0xa5ca('0x4f')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xa5ca('0x46')](_0xa5ca('0x50'),this['agents'][_0x205ede['channel'][_0xa5ca('0x4b')]('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this[_0xa5ca('0x1d')][_0x205ede['channel'][_0xa5ca('0x4b')]('-')[0x0]][_0xa5ca('0x4f')]});}}if(_0x205ede[_0xa5ca('0xa0')]===_0xa5ca('0xa1')){this[_0xa5ca('0x1e')][_0x205ede[_0xa5ca('0x37')]]=this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]];}else{if(this['channels'][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x86')]===_0xa5ca('0xa2')&&this[_0xa5ca('0x1e')][_0x205ede[_0xa5ca('0x37')]]){this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]]['uniqueid']=[this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x3b')],this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]]['linkedid']=this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x37')]][0x0];delete this[_0xa5ca('0x1e')][_0x205ede['uniqueid']];}}logger[_0xa5ca('0x39')](_0xa5ca('0xa3'),_0x205ede[_0xa5ca('0x37')],util[_0xa5ca('0x32')](this['channels'][_0x205ede[_0xa5ca('0x37')]],{'showHidden':![],'depth':null}));ami[_0xa5ca('0x34')](_0xa5ca('0xa4'),this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]]);delete this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]];}}}catch(_0x2b7b15){logger['error'](_0xa5ca('0xa5'),_0x205ede['uniqueid'],util['inspect'](_0x2b7b15,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa5ca('0x33')][_0xa5ca('0x29')]=function(_0x3a94f0){try{if(this[_0xa5ca('0x35')](_0x3a94f0)){logger['info']('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x3a94f0[_0xa5ca('0x37')],_0x3a94f0[_0xa5ca('0xa6')],_0x3a94f0[_0xa5ca('0xa7')]);logger[_0xa5ca('0x39')](_0xa5ca('0xa8'),_0x3a94f0[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x3a94f0,{'showHidden':![],'depth':null}));if(this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xa9')]]){this[_0xa5ca('0x1c')][_0x3a94f0['transfereeuniqueid']]['transfercalleridnum']=_0x3a94f0[_0xa5ca('0xa6')];this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xa9')]][_0xa5ca('0xaa')]=_0x3a94f0[_0xa5ca('0xa7')];if(this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xab')]]){var _0x22ebb2=this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xab')]];this['channels'][_0x3a94f0[_0xa5ca('0xab')]]=this[_0xa5ca('0x1c')][_0x3a94f0['transfereeuniqueid']];this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xa9')]]=_0x22ebb2;}}else if(this['channels'][_0x3a94f0['transfertargetuniqueid']]){this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xac')]][_0xa5ca('0xad')]=_0x3a94f0[_0xa5ca('0xa6')];this['channels'][_0x3a94f0[_0xa5ca('0xac')]]['transferconnectedlinenum']=_0x3a94f0[_0xa5ca('0xa7')];if(this['channels'][_0x3a94f0[_0xa5ca('0xae')]]){var _0x22ebb2=this[_0xa5ca('0x1c')][_0x3a94f0['origtransfereruniqueid']];this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xae')]]=this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xac')]];this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xac')]]=_0x22ebb2;}}}}catch(_0x237a54){logger[_0xa5ca('0x30')](_0xa5ca('0xaf'),_0x3a94f0['uniqueid'],util[_0xa5ca('0x32')](_0x237a54,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa5ca('0x33')][_0xa5ca('0x2a')]=function(_0x132e7c){try{if(this['isNotNull'](_0x132e7c)){logger[_0xa5ca('0x2d')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x132e7c['uniqueid'],_0x132e7c[_0xa5ca('0xb0')],_0x132e7c[_0xa5ca('0xb1')]);logger[_0xa5ca('0x39')](_0xa5ca('0xb2'),_0x132e7c[_0xa5ca('0x37')],util['inspect'](_0x132e7c,{'showHidden':![],'depth':null}));if(this[_0xa5ca('0x1c')][_0x132e7c[_0xa5ca('0xa9')]]){this['channels'][_0x132e7c[_0xa5ca('0xa9')]]['transfercalleridnum']=_0x132e7c[_0xa5ca('0xb0')];this[_0xa5ca('0x1c')][_0x132e7c[_0xa5ca('0xa9')]][_0xa5ca('0xaa')]=_0x132e7c[_0xa5ca('0xb1')];this[_0xa5ca('0x25')]({'event':_0xa5ca('0xa1'),'uniqueid':_0x132e7c['transfereeuniqueid'],'context':_0x132e7c[_0xa5ca('0x44')],'channel':_0x132e7c[_0xa5ca('0xb3')]});}}}catch(_0x5ac6d5){logger['error'](_0xa5ca('0xb4'),_0x132e7c[_0xa5ca('0x37')],util['inspect'](_0x5ac6d5,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x1adee0){try{if(this[_0xa5ca('0x35')](_0x1adee0)){logger[_0xa5ca('0x39')](_0xa5ca('0xb5'),_0x1adee0[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x1adee0,{'showHidden':![],'depth':null}));if(this[_0xa5ca('0x1c')][_0x1adee0[_0xa5ca('0x37')]]){if(!_[_0xa5ca('0x77')](this[_0xa5ca('0x1c')][_0x1adee0[_0xa5ca('0x37')]][_0xa5ca('0x65')])){this[_0xa5ca('0x1c')][_0x1adee0[_0xa5ca('0x37')]][_0xa5ca('0xb6')]=moment()[_0xa5ca('0x46')](_0xa5ca('0x47'));logger[_0xa5ca('0x2d')](_0xa5ca('0xb7'),_0x1adee0['uniqueid'],this[_0xa5ca('0x1c')][_0x1adee0[_0xa5ca('0x37')]][_0xa5ca('0xb6')]);}}}}catch(_0x50c562){logger[_0xa5ca('0x30')]('[%s][voiceCallReport][musiconholdstart]',_0x1adee0[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x50c562,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa5ca('0x2c')]=function(_0x22553d){try{if(this[_0xa5ca('0x35')](_0x22553d)){logger[_0xa5ca('0x39')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x22553d[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x22553d,{'showHidden':![],'depth':null}));if(this[_0xa5ca('0x1c')][_0x22553d[_0xa5ca('0x37')]]){if(!_[_0xa5ca('0x77')](this[_0xa5ca('0x1c')][_0x22553d[_0xa5ca('0x37')]][_0xa5ca('0xb6')])){this[_0xa5ca('0x1c')][_0x22553d['uniqueid']]['mohtime']+=moment()[_0xa5ca('0xb8')](0x0)['diff'](this[_0xa5ca('0x1c')][_0x22553d['uniqueid']][_0xa5ca('0xb6')],_0xa5ca('0x5b'));logger['info'](_0xa5ca('0xb9'),_0x22553d[_0xa5ca('0x37')],this[_0xa5ca('0x1c')][_0x22553d[_0xa5ca('0x37')]][_0xa5ca('0xba')]);delete this[_0xa5ca('0x1c')][_0x22553d[_0xa5ca('0x37')]][_0xa5ca('0xb6')];}}}}catch(_0x5e71ed){logger[_0xa5ca('0x30')](_0xa5ca('0xbb'),_0x22553d['uniqueid'],util[_0xa5ca('0x32')](_0x5e71ed,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x222f=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','split','destconnectedlinenum','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','duration','seconds','includes','lastapplication','lastdata','startsWith','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','membername','UserId','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','endsWith','.wav49','replace','.WAV','monitorFilename','find','isNil','monitors','push','rec','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','transferconnectedlinenum','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','bluebird','ami','../ami','../model/channel','unknown','inuse','ringing','ringinuse','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','channel','OutgoingSpoolFailed','isUndefined'];(function(_0x3afcd2,_0x5109be){var _0x16e3b9=function(_0x587d7c){while(--_0x587d7c){_0x3afcd2['push'](_0x3afcd2['shift']());}};_0x16e3b9(++_0x5109be);}(_0x222f,0x71));var _0xf222=function(_0x579baf,_0x4aaafa){_0x579baf=_0x579baf-0x0;var _0x4c601a=_0x222f[_0x579baf];return _0x4c601a;};'use strict';var BPromise=require(_0xf222('0x0'));var _=require('lodash');var moment=require('moment');var util=require('util');var path=require('path');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xf222('0x1'));var ami=require(_0xf222('0x2'));var Channel=require(_0xf222('0x3'));var statusDesc=[_0xf222('0x4'),'not_inuse',_0xf222('0x5'),'busy','invalid','unavailable',_0xf222('0x6'),_0xf222('0x7'),'onhold'];var applications=[_0xf222('0x8'),_0xf222('0x9'),_0xf222('0xa'),_0xf222('0xb'),_0xf222('0xc'),_0xf222('0xd')];var dispositions=[_0xf222('0xe'),'FAILED',_0xf222('0xf'),_0xf222('0xe'),_0xf222('0xe'),_0xf222('0xe'),_0xf222('0x10'),'BUSY',_0xf222('0xf'),'FAILED',_0xf222('0xf')];var actions={};config[_0xf222('0x11')]=_[_0xf222('0x12')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf222('0x13'))(new Redis(config[_0xf222('0x11')]));function VoiceCallReport(_0x5723a3){this[_0xf222('0x14')]=_0x5723a3['channels'];this[_0xf222('0x15')]=_0x5723a3['agents'];this[_0xf222('0x16')]={};ami['on'](_0xf222('0x17'),this[_0xf222('0x18')][_0xf222('0x19')](this));ami['on'](_0xf222('0x1a'),this[_0xf222('0x18')][_0xf222('0x19')](this));ami['on']('newchannel',this[_0xf222('0x1b')][_0xf222('0x19')](this));ami['on']('newstate',this[_0xf222('0x1c')][_0xf222('0x19')](this));ami['on'](_0xf222('0x1d'),this[_0xf222('0x1e')][_0xf222('0x19')](this));ami['on'](_0xf222('0x1f'),this[_0xf222('0x20')][_0xf222('0x19')](this));ami['on'](_0xf222('0x21'),this[_0xf222('0x22')][_0xf222('0x19')](this));ami['on']('attendedtransfer',this[_0xf222('0x23')][_0xf222('0x19')](this));ami['on'](_0xf222('0x24'),this[_0xf222('0x25')][_0xf222('0x19')](this));ami['on'](_0xf222('0x26'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0xf222('0x27'),this[_0xf222('0x28')][_0xf222('0x19')](this));try{logger[_0xf222('0x29')](_0xf222('0x2a'));ami[_0xf222('0x2b')]();}catch(_0x5297bc){logger[_0xf222('0x2c')](_0xf222('0x2d'),util[_0xf222('0x2e')](_0x5297bc,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xf222('0x2f')][_0xf222('0x30')]=function(_0xeb2d0e){return _0xeb2d0e!==null&&!_['isUndefined'](_0xeb2d0e);};VoiceCallReport['prototype'][_0xf222('0x31')]=function(_0x105f8d,_0x125ad7,_0xb0f721){io['to'](_0x105f8d)[_0xf222('0x31')](_0x125ad7,_0xb0f721);};VoiceCallReport['prototype'][_0xf222('0x22')]=function(_0x2b7ecf){try{if(this[_0xf222('0x30')](_0x2b7ecf)){logger[_0xf222('0x29')](_0xf222('0x32'),_0x2b7ecf[_0xf222('0x33')],_0x2b7ecf[_0xf222('0x34')],_0x2b7ecf['calleridnum']);logger[_0xf222('0x35')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x2b7ecf[_0xf222('0x33')],util['inspect'](_0x2b7ecf,{'showHidden':![],'depth':null}));if(_0x2b7ecf['uniqueid']===_0x2b7ecf[_0xf222('0x36')]){if(!_['isUndefined'](this[_0xf222('0x14')][_0x2b7ecf[_0xf222('0x33')]])){_[_0xf222('0x37')](this[_0xf222('0x14')][_0x2b7ecf[_0xf222('0x33')]],_[_0xf222('0x38')](_0x2b7ecf,_[_0xf222('0x39')](this[_0xf222('0x14')][_0x2b7ecf[_0xf222('0x33')]])));}}}}catch(_0x10a443){logger[_0xf222('0x2c')](_0xf222('0x3a'),_0x2b7ecf[_0xf222('0x33')],util['inspect'](_0x10a443,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf222('0x1b')]=function(_0x8debe9){try{if(this[_0xf222('0x30')](_0x8debe9)){logger[_0xf222('0x35')]('[%s][voiceCallReport][newchannel]\x20event:',_0x8debe9[_0xf222('0x33')],util[_0xf222('0x2e')](_0x8debe9,{'showHidden':![],'depth':null}));if(_0x8debe9[_0xf222('0x33')]===_0x8debe9[_0xf222('0x36')]&&_0x8debe9[_0xf222('0x3b')]!=_0xf222('0x3c')){if(_[_0xf222('0x3d')](this['channels'][_0x8debe9[_0xf222('0x33')]])){logger[_0xf222('0x29')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x8debe9[_0xf222('0x33')],_0x8debe9['context'],_0x8debe9['exten']);this['channels'][_0x8debe9[_0xf222('0x33')]]=new Channel();this[_0xf222('0x14')][_0x8debe9['uniqueid']][_0xf222('0x3e')]=moment()[_0xf222('0x3f')](_0xf222('0x40'));this[_0xf222('0x14')][_0x8debe9[_0xf222('0x33')]][_0xf222('0x41')]=dispositions[_[_0xf222('0x42')](_0x8debe9[_0xf222('0x43')])];_[_0xf222('0x37')](this[_0xf222('0x14')][_0x8debe9[_0xf222('0x33')]],_[_0xf222('0x38')](_0x8debe9,_['keys'](this['channels'][_0x8debe9['uniqueid']])));if(_0x8debe9[_0xf222('0x44')]==='from-sip'){if(this[_0xf222('0x15')][_0x8debe9[_0xf222('0x3b')][_0xf222('0x45')]('-')[0x0]]){this[_0xf222('0x15')][_0x8debe9[_0xf222('0x3b')][_0xf222('0x45')]('-')[0x0]][_0xf222('0x46')]=_0x8debe9[_0xf222('0x47')];logger[_0xf222('0x35')](_0xf222('0x48'),_0x8debe9[_0xf222('0x33')],util[_0xf222('0x2e')]({'destaccountcode':this['agents'][_0x8debe9['channel'][_0xf222('0x45')]('-')[0x0]][_0xf222('0x49')],'destconnectedlinenum':_0x8debe9['exten']},{'showHidden':![],'depth':null}));this[_0xf222('0x31')](util[_0xf222('0x3f')](_0xf222('0x4a'),this[_0xf222('0x15')][_0x8debe9['channel'][_0xf222('0x45')]('-')[0x0]][_0xf222('0x4b')]),_0xf222('0x4c'),{'destaccountcode':this['agents'][_0x8debe9[_0xf222('0x3b')]['split']('-')[0x0]][_0xf222('0x49')],'destconnectedlinenum':_0x8debe9[_0xf222('0x47')]});}}}}}}catch(_0x5b29a4){logger[_0xf222('0x2c')](_0xf222('0x4d'),_0x8debe9[_0xf222('0x33')],util['inspect'](_0x5b29a4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf222('0x2f')][_0xf222('0x18')]=function(_0xf2c35a){try{if(this[_0xf222('0x30')](_0xf2c35a)){logger[_0xf222('0x35')](_0xf222('0x4e'),_0xf2c35a[_0xf222('0x33')],util[_0xf222('0x2e')](_0xf2c35a,{'showHidden':![],'depth':null}));if(_0xf2c35a[_0xf222('0x33')]===_0xf2c35a[_0xf222('0x36')]&&_0xf2c35a[_0xf222('0x47')]!='h'&&_0xf2c35a['channel']!=_0xf222('0x3c')){_0xf2c35a[_0xf222('0x4f')]=_0xf2c35a['application'][_0xf222('0x50')]();_0xf2c35a[_0xf222('0x51')]=(_0xf2c35a[_0xf222('0x52')]||_0xf2c35a[_0xf222('0x51')])[_0xf222('0x50')]();logger[_0xf222('0x29')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0xf2c35a[_0xf222('0x33')],_0xf2c35a[_0xf222('0x4f')],_0xf2c35a[_0xf222('0x51')]);if(_[_0xf222('0x3d')](this['channels'][_0xf2c35a[_0xf222('0x33')]])){this[_0xf222('0x14')][_0xf2c35a[_0xf222('0x33')]]=new Channel();this[_0xf222('0x14')][_0xf2c35a['uniqueid']][_0xf222('0x3e')]=_0xf2c35a[_0xf222('0x53')]?moment()['subtract'](moment[_0xf222('0x53')](_0xf2c35a[_0xf222('0x53')])[_0xf222('0x54')](),_0xf222('0x54'))[_0xf222('0x3f')](_0xf222('0x40')):moment()[_0xf222('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xf2c35a[_0xf222('0x33')]][_0xf222('0x41')]='NO\x20ANSWER';}_[_0xf222('0x37')](this['channels'][_0xf2c35a[_0xf222('0x33')]],_[_0xf222('0x38')](_0xf2c35a,_[_0xf222('0x39')](this[_0xf222('0x14')][_0xf2c35a[_0xf222('0x33')]])));if(_[_0xf222('0x55')](applications,_0xf2c35a[_0xf222('0x4f')])){this[_0xf222('0x14')][_0xf2c35a['uniqueid']][_0xf222('0x56')]=_0xf2c35a[_0xf222('0x4f')];this['channels'][_0xf2c35a[_0xf222('0x33')]][_0xf222('0x57')]=_0xf2c35a[_0xf222('0x51')];if(_0xf2c35a[_0xf222('0x4f')]===_0xf222('0x8')&&_[_0xf222('0x58')](_0xf2c35a[_0xf222('0x51')],'cdr(')){var _0x4d7363=_0xf2c35a[_0xf222('0x51')][_0xf222('0x45')]('=');var _0x412525=_0x4d7363[0x0]['match'](/cdr\((.*)\)/);if(_0x412525){this['channels'][_0xf2c35a[_0xf222('0x33')]][_0x412525[0x1]]=_0x4d7363[0x1];}}else if(_0xf2c35a['application']===_0xf222('0x9')){this[_0xf222('0x14')][_0xf2c35a[_0xf222('0x33')]][_0xf222('0x9')]=_0xf2c35a[_0xf222('0x51')]['split'](',')[0x0];}}}}}catch(_0xa82ec6){logger[_0xf222('0x2c')](_0xf222('0x59'),_0xf2c35a['uniqueid'],util[_0xf222('0x2e')](_0xa82ec6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf222('0x2f')][_0xf222('0x1c')]=function(_0x3e9900){try{if(this['isNotNull'](_0x3e9900)){logger[_0xf222('0x29')](_0xf222('0x5a'),_0x3e9900[_0xf222('0x33')],_0x3e9900['linkedid'],_0x3e9900[_0xf222('0x34')],_0x3e9900[_0xf222('0x5b')]);logger[_0xf222('0x35')]('[%s][voiceCallReport][newstate]\x20event:',_0x3e9900[_0xf222('0x33')],util[_0xf222('0x2e')](_0x3e9900,{'showHidden':![],'depth':null}));if(_0x3e9900[_0xf222('0x33')]!==_0x3e9900[_0xf222('0x36')]){if(this[_0xf222('0x14')][_0x3e9900[_0xf222('0x36')]]){if(_0x3e9900[_0xf222('0x43')]==='6'){if(!this[_0xf222('0x14')][_0x3e9900[_0xf222('0x36')]][_0xf222('0x5c')]){var _0x1d62c5=moment();this[_0xf222('0x14')][_0x3e9900['linkedid']]['answered']=!![];this['channels'][_0x3e9900[_0xf222('0x36')]][_0xf222('0x5d')]=_0x1d62c5[_0xf222('0x3f')](_0xf222('0x40'));if(this[_0xf222('0x14')][_0x3e9900[_0xf222('0x36')]]['starttime']){this[_0xf222('0x14')][_0x3e9900[_0xf222('0x36')]][_0xf222('0x5e')]=_0x1d62c5[_0xf222('0x5f')](this[_0xf222('0x14')][_0x3e9900[_0xf222('0x36')]][_0xf222('0x3e')],_0xf222('0x54'));}}this[_0xf222('0x14')][_0x3e9900[_0xf222('0x36')]]['linkedid']=_0x3e9900[_0xf222('0x33')];if(_0x3e9900[_0xf222('0x5b')]!==_0xf222('0x60')){this[_0xf222('0x14')][_0x3e9900[_0xf222('0x36')]][_0xf222('0x61')]=_0x3e9900['calleridnum'];}this['channels'][_0x3e9900[_0xf222('0x36')]][_0xf222('0x62')]=_0x3e9900[_0xf222('0x34')];this['channels'][_0x3e9900[_0xf222('0x36')]][_0xf222('0x63')]=_0x3e9900['channel'];this[_0xf222('0x14')][_0x3e9900[_0xf222('0x36')]]['disposition']=dispositions[_['toNumber'](_0x3e9900[_0xf222('0x43')])];if(this['agents'][_0x3e9900[_0xf222('0x3b')][_0xf222('0x45')]('-')[0x0]]){this[_0xf222('0x14')][_0x3e9900[_0xf222('0x36')]]['UserId']=this[_0xf222('0x15')][_0x3e9900[_0xf222('0x3b')][_0xf222('0x45')]('-')[0x0]]['id'];this[_0xf222('0x14')][_0x3e9900[_0xf222('0x36')]][_0xf222('0x64')]=this[_0xf222('0x15')][_0x3e9900['channel'][_0xf222('0x45')]('-')[0x0]][_0xf222('0x4b')];}}}}else{if(this[_0xf222('0x14')][_0x3e9900['uniqueid']]){if(_0x3e9900[_0xf222('0x43')]==='6'){if(this[_0xf222('0x15')][_0x3e9900[_0xf222('0x3b')][_0xf222('0x45')]('-')[0x0]]){this['channels'][_0x3e9900[_0xf222('0x33')]][_0xf222('0x65')]=this[_0xf222('0x15')][_0x3e9900[_0xf222('0x3b')][_0xf222('0x45')]('-')[0x0]]['id'];this[_0xf222('0x14')][_0x3e9900[_0xf222('0x33')]][_0xf222('0x64')]=this['agents'][_0x3e9900[_0xf222('0x3b')][_0xf222('0x45')]('-')[0x0]][_0xf222('0x4b')];}}}}}}catch(_0x2ed487){logger[_0xf222('0x2c')](_0xf222('0x66'),_0x3e9900[_0xf222('0x33')],util['inspect'](_0x2ed487,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf222('0x67')]=function(_0x28d318,_0x400575){try{if(this[_0xf222('0x14')][_0x28d318]){logger['info']('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x28d318,_0x400575);this[_0xf222('0x14')][_0x28d318]['monitor']=!![];if(_[_0xf222('0x68')](_0x400575,_0xf222('0x69'))){_0x400575=_0x400575[_0xf222('0x6a')](_0xf222('0x69'),_0xf222('0x6b'));}this[_0xf222('0x14')][_0x28d318][_0xf222('0x6c')]=_0x400575;var _0x2124d7=_[_0xf222('0x6d')](this[_0xf222('0x14')][_0x28d318]['monitors'],{'filename':_0x400575});if(_[_0xf222('0x6e')](_0x2124d7)){this['channels'][_0x28d318][_0xf222('0x6f')][_0xf222('0x70')]({'filename':_0x400575,'createdAt':moment()['format'](_0xf222('0x40')),'mixmonitorid':'','status':_0xf222('0x71')});}}}catch(_0x3a9a21){logger[_0xf222('0x2c')]('[%s][voiceCallReport][mixMonitorFilename]',_0x28d318,util[_0xf222('0x2e')](_0x3a9a21,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf222('0x2f')][_0xf222('0x1e')]=function(_0x1148c4){try{if(this[_0xf222('0x30')](_0x1148c4)){logger[_0xf222('0x35')]('[%s][voiceCallReport][varset]\x20event:',_0x1148c4[_0xf222('0x33')],util[_0xf222('0x2e')](_0x1148c4,{'showHidden':![],'depth':null}));if(this['channels'][_0x1148c4['uniqueid']]&&_0x1148c4[_0xf222('0x3b')]!=_0xf222('0x3c')){if(this[_0xf222('0x30')](_0x1148c4[_0xf222('0x72')])){if(this[_0xf222('0x30')](_0x1148c4[_0xf222('0x72')][_0xf222('0x73')])){logger[_0xf222('0x29')](_0xf222('0x74'),_0x1148c4['uniqueid'],_0x1148c4[_0xf222('0x75')]);this['syncMixMonitorFilename'](_0x1148c4[_0xf222('0x33')],_0x1148c4[_0xf222('0x75')]);}else if(this[_0xf222('0x30')](_0x1148c4[_0xf222('0x72')][_0xf222('0x76')])){logger[_0xf222('0x29')](_0xf222('0x77'),_0x1148c4['uniqueid'],_0x1148c4['value']);this[_0xf222('0x14')][_0x1148c4[_0xf222('0x33')]][_0xf222('0x5b')]=_0x1148c4[_0xf222('0x75')];}else if(this[_0xf222('0x30')](_0x1148c4[_0xf222('0x72')][_0xf222('0x78')])){logger[_0xf222('0x29')](_0xf222('0x79'),_0x1148c4[_0xf222('0x33')],_0x1148c4[_0xf222('0x75')]);this[_0xf222('0x14')][_0x1148c4[_0xf222('0x33')]]['callerid']=_0x1148c4['value'];}else if(this[_0xf222('0x30')](_0x1148c4[_0xf222('0x72')][_0xf222('0x7a')])){logger[_0xf222('0x29')](_0xf222('0x7b'),_0x1148c4['uniqueid'],_0x1148c4[_0xf222('0x75')]);this['channels'][_0x1148c4[_0xf222('0x33')]][_0xf222('0x7c')]=_0x1148c4[_0xf222('0x75')];}else if(this['isNotNull'](_0x1148c4[_0xf222('0x72')][_0xf222('0x7d')])){logger['info'](_0xf222('0x7e'),_0x1148c4[_0xf222('0x33')],_0x1148c4[_0xf222('0x75')][_0xf222('0x45')](',')[0x0]);this[_0xf222('0x14')][_0x1148c4['uniqueid']][_0xf222('0x9')]=_0x1148c4[_0xf222('0x75')][_0xf222('0x45')](',')[0x0];}else if(this[_0xf222('0x30')](_0x1148c4[_0xf222('0x72')]['xmd-originatecalleridnum'])){logger[_0xf222('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1148c4['uniqueid'],_0x1148c4[_0xf222('0x75')]);this[_0xf222('0x14')][_0x1148c4[_0xf222('0x33')]][_0xf222('0x7f')]=_0x1148c4[_0xf222('0x75')];}else if(this[_0xf222('0x30')](_0x1148c4[_0xf222('0x72')][_0xf222('0x80')])){logger[_0xf222('0x29')](_0xf222('0x81'),_0x1148c4[_0xf222('0x33')],_0x1148c4['value']);this[_0xf222('0x14')][_0x1148c4['uniqueid']][_0xf222('0x82')]=_0x1148c4[_0xf222('0x75')];}else if(this['isNotNull'](_0x1148c4[_0xf222('0x72')][_0xf222('0x83')])){logger[_0xf222('0x29')](_0xf222('0x84'),_0x1148c4[_0xf222('0x33')],_0x1148c4[_0xf222('0x75')]);this['channels'][_0x1148c4[_0xf222('0x33')]][_0xf222('0x85')]=_0x1148c4['value'];}else if(this[_0xf222('0x30')](_0x1148c4[_0xf222('0x72')][_0xf222('0x86')])){logger[_0xf222('0x29')](_0xf222('0x87'),_0x1148c4[_0xf222('0x33')],_0x1148c4[_0xf222('0x75')]);this[_0xf222('0x14')][_0x1148c4[_0xf222('0x33')]][_0xf222('0x9')]=_0x1148c4['value'];}else if(this[_0xf222('0x30')](_0x1148c4['variable'][_0xf222('0x88')])){logger[_0xf222('0x29')](_0xf222('0x89'),_0x1148c4[_0xf222('0x33')],_0x1148c4[_0xf222('0x75')]);this[_0xf222('0x14')][_0x1148c4[_0xf222('0x33')]][_0xf222('0x8a')]=_0x1148c4[_0xf222('0x75')];}}}else if(this[_0xf222('0x30')](_0x1148c4['variable'][_0xf222('0x73')])){if(_0x1148c4[_0xf222('0x75')]){var _0x51df57=path['parse'](_0x1148c4['value'])[_0xf222('0x4b')];logger[_0xf222('0x29')](_0xf222('0x74'),_0x51df57,_0x1148c4[_0xf222('0x75')]);this[_0xf222('0x67')](_0x51df57,_0x1148c4['value']);}}else if(this[_0xf222('0x14')][_0x1148c4[_0xf222('0x36')]]){if(this[_0xf222('0x30')](_0x1148c4[_0xf222('0x72')])){if(this[_0xf222('0x30')](_0x1148c4['variable'][_0xf222('0x88')])){logger[_0xf222('0x29')](_0xf222('0x89'),_0x1148c4[_0xf222('0x36')],_0x1148c4[_0xf222('0x75')]);this[_0xf222('0x14')][_0x1148c4[_0xf222('0x36')]][_0xf222('0x8b')]=_0x1148c4[_0xf222('0x75')];}}}}}catch(_0x40a2cc){logger[_0xf222('0x2c')](_0xf222('0x8c'),_0x1148c4[_0xf222('0x33')],util[_0xf222('0x2e')](_0x40a2cc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf222('0x2f')]['syncHangup']=function(_0x16d653){try{if(this[_0xf222('0x30')](_0x16d653)){logger['debug'](_0xf222('0x8d'),_0x16d653[_0xf222('0x33')],util['inspect'](_0x16d653,{'showHidden':![],'depth':null}));if(this[_0xf222('0x14')][_0x16d653['uniqueid']]){logger['info'](_0xf222('0x8e'),_0x16d653[_0xf222('0x33')],_0x16d653[_0xf222('0x8f')]);var _0x3f195c=moment();this['channels'][_0x16d653[_0xf222('0x33')]][_0xf222('0x90')]=_0x3f195c[_0xf222('0x3f')](_0xf222('0x40'));this[_0xf222('0x14')][_0x16d653['uniqueid']][_0xf222('0x53')]=_0x3f195c[_0xf222('0x5f')](this['channels'][_0x16d653[_0xf222('0x33')]][_0xf222('0x3e')],_0xf222('0x54'));if(this['channels'][_0x16d653['uniqueid']][_0xf222('0x5c')]){this[_0xf222('0x14')][_0x16d653['uniqueid']][_0xf222('0x91')]=_0x3f195c[_0xf222('0x5f')](this['channels'][_0x16d653[_0xf222('0x33')]]['answertime'],_0xf222('0x54'));this[_0xf222('0x14')][_0x16d653['uniqueid']][_0xf222('0x5e')]=this['channels'][_0x16d653[_0xf222('0x33')]]['duration']-this[_0xf222('0x14')][_0x16d653['uniqueid']][_0xf222('0x91')];}if(_0x16d653[_0xf222('0x44')]==='from-sip'){if(this[_0xf222('0x15')][_0x16d653[_0xf222('0x3b')]['split']('-')[0x0]]){this['agents'][_0x16d653[_0xf222('0x3b')]['split']('-')[0x0]]=_[_0xf222('0x92')](this[_0xf222('0x15')][_0x16d653[_0xf222('0x3b')][_0xf222('0x45')]('-')[0x0]],[_0xf222('0x46')]);logger[_0xf222('0x35')](_0xf222('0x93'),_0x16d653['uniqueid'],util[_0xf222('0x2e')]({'destaccountcode':this['agents'][_0x16d653[_0xf222('0x3b')][_0xf222('0x45')]('-')[0x0]][_0xf222('0x49')]},{'showHidden':![],'depth':null}));this[_0xf222('0x31')](util[_0xf222('0x3f')](_0xf222('0x4a'),this[_0xf222('0x15')][_0x16d653[_0xf222('0x3b')][_0xf222('0x45')]('-')[0x0]][_0xf222('0x4b')]),_0xf222('0x94'),{'destaccountcode':this[_0xf222('0x15')][_0x16d653[_0xf222('0x3b')]['split']('-')[0x0]]['accountcode']});}}if(_0x16d653[_0xf222('0x95')]===_0xf222('0x96')){this[_0xf222('0x16')][_0x16d653[_0xf222('0x33')]]=this[_0xf222('0x14')][_0x16d653[_0xf222('0x33')]];}else{if(this[_0xf222('0x14')][_0x16d653[_0xf222('0x33')]][_0xf222('0x7c')]===_0xf222('0x97')&&this['blindTransfers'][_0x16d653[_0xf222('0x33')]]){this[_0xf222('0x14')][_0x16d653[_0xf222('0x33')]]['uniqueid']=[this[_0xf222('0x14')][_0x16d653[_0xf222('0x33')]][_0xf222('0x36')],this[_0xf222('0x14')][_0x16d653[_0xf222('0x33')]][_0xf222('0x36')]=this['channels'][_0x16d653[_0xf222('0x33')]][_0xf222('0x33')]][0x0];delete this[_0xf222('0x16')][_0x16d653[_0xf222('0x33')]];}}logger[_0xf222('0x35')](_0xf222('0x98'),_0x16d653[_0xf222('0x33')],util[_0xf222('0x2e')](this['channels'][_0x16d653['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xf222('0x31')]('custom:voiceCallReport',this[_0xf222('0x14')][_0x16d653['uniqueid']]);delete this[_0xf222('0x14')][_0x16d653[_0xf222('0x33')]];}}}catch(_0x3c78dd){logger['error'](_0xf222('0x99'),_0x16d653['uniqueid'],util[_0xf222('0x2e')](_0x3c78dd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf222('0x2f')][_0xf222('0x23')]=function(_0x179c59){try{if(this[_0xf222('0x30')](_0x179c59)){logger['info']('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x179c59[_0xf222('0x33')],_0x179c59[_0xf222('0x9a')],_0x179c59[_0xf222('0x9b')]);logger[_0xf222('0x35')](_0xf222('0x9c'),_0x179c59[_0xf222('0x33')],util[_0xf222('0x2e')](_0x179c59,{'showHidden':![],'depth':null}));if(this[_0xf222('0x14')][_0x179c59[_0xf222('0x9d')]]){this[_0xf222('0x14')][_0x179c59[_0xf222('0x9d')]]['transfercalleridnum']=_0x179c59['origtransferercalleridnum'];this['channels'][_0x179c59[_0xf222('0x9d')]]['transferconnectedlinenum']=_0x179c59[_0xf222('0x9b')];if(this[_0xf222('0x14')][_0x179c59['secondtransfereruniqueid']]){var _0x1e809b=this[_0xf222('0x14')][_0x179c59['secondtransfereruniqueid']];this['channels'][_0x179c59[_0xf222('0x9e')]]=this[_0xf222('0x14')][_0x179c59[_0xf222('0x9d')]];this[_0xf222('0x14')][_0x179c59[_0xf222('0x9d')]]=_0x1e809b;}}else if(this['channels'][_0x179c59[_0xf222('0x9f')]]){this[_0xf222('0x14')][_0x179c59[_0xf222('0x9f')]][_0xf222('0xa0')]=_0x179c59[_0xf222('0x9a')];this[_0xf222('0x14')][_0x179c59[_0xf222('0x9f')]][_0xf222('0xa1')]=_0x179c59[_0xf222('0x9b')];if(this[_0xf222('0x14')][_0x179c59['origtransfereruniqueid']]){var _0x1e809b=this[_0xf222('0x14')][_0x179c59[_0xf222('0xa2')]];this[_0xf222('0x14')][_0x179c59[_0xf222('0xa2')]]=this[_0xf222('0x14')][_0x179c59[_0xf222('0x9f')]];this[_0xf222('0x14')][_0x179c59['transfertargetuniqueid']]=_0x1e809b;}}}}catch(_0x2a4ca0){logger[_0xf222('0x2c')](_0xf222('0xa3'),_0x179c59[_0xf222('0x33')],util['inspect'](_0x2a4ca0,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf222('0x25')]=function(_0x49e66f){try{if(this[_0xf222('0x30')](_0x49e66f)){logger[_0xf222('0x29')](_0xf222('0xa4'),_0x49e66f['uniqueid'],_0x49e66f[_0xf222('0xa5')],_0x49e66f[_0xf222('0xa6')]);logger['debug'](_0xf222('0xa7'),_0x49e66f['uniqueid'],util[_0xf222('0x2e')](_0x49e66f,{'showHidden':![],'depth':null}));if(this['channels'][_0x49e66f[_0xf222('0x9d')]]){this[_0xf222('0x14')][_0x49e66f[_0xf222('0x9d')]][_0xf222('0xa0')]=_0x49e66f[_0xf222('0xa5')];this['channels'][_0x49e66f[_0xf222('0x9d')]][_0xf222('0xa1')]=_0x49e66f['extension'];this[_0xf222('0x20')]({'event':'BlindTransfer','uniqueid':_0x49e66f[_0xf222('0x9d')],'context':_0x49e66f[_0xf222('0x44')],'channel':_0x49e66f['transfererchannel']});}}}catch(_0x387224){logger[_0xf222('0x2c')]('[%s][voiceCallReport][blindtransfer]',_0x49e66f[_0xf222('0x33')],util[_0xf222('0x2e')](_0x387224,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf222('0x2f')][_0xf222('0xa8')]=function(_0x460ec1){try{if(this[_0xf222('0x30')](_0x460ec1)){logger['debug'](_0xf222('0xa9'),_0x460ec1['uniqueid'],util[_0xf222('0x2e')](_0x460ec1,{'showHidden':![],'depth':null}));if(this[_0xf222('0x14')][_0x460ec1[_0xf222('0x33')]]){if(!_['isNil'](this[_0xf222('0x14')][_0x460ec1['uniqueid']][_0xf222('0x5d')])){this['channels'][_0x460ec1['uniqueid']][_0xf222('0xaa')]=moment()[_0xf222('0x3f')](_0xf222('0x40'));logger[_0xf222('0x29')](_0xf222('0xab'),_0x460ec1['uniqueid'],this[_0xf222('0x14')][_0x460ec1[_0xf222('0x33')]][_0xf222('0xaa')]);}}}}catch(_0x5cb8b5){logger[_0xf222('0x2c')]('[%s][voiceCallReport][musiconholdstart]',_0x460ec1[_0xf222('0x33')],util[_0xf222('0x2e')](_0x5cb8b5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf222('0x2f')][_0xf222('0x28')]=function(_0x31b6e2){try{if(this['isNotNull'](_0x31b6e2)){logger[_0xf222('0x35')](_0xf222('0xac'),_0x31b6e2[_0xf222('0x33')],util['inspect'](_0x31b6e2,{'showHidden':![],'depth':null}));if(this[_0xf222('0x14')][_0x31b6e2['uniqueid']]){if(!_['isNil'](this['channels'][_0x31b6e2[_0xf222('0x33')]][_0xf222('0xaa')])){this['channels'][_0x31b6e2[_0xf222('0x33')]]['mohtime']+=moment()['milliseconds'](0x0)[_0xf222('0x5f')](this[_0xf222('0x14')][_0x31b6e2[_0xf222('0x33')]][_0xf222('0xaa')],'seconds');logger[_0xf222('0x29')](_0xf222('0xad'),_0x31b6e2[_0xf222('0x33')],this['channels'][_0x31b6e2[_0xf222('0x33')]]['mohtime']);delete this[_0xf222('0x14')][_0x31b6e2[_0xf222('0x33')]][_0xf222('0xaa')];}}}}catch(_0x39404d){logger['error'](_0xf222('0xae'),_0x31b6e2[_0xf222('0x33')],util[_0xf222('0x2e')](_0x39404d,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 4683bc7..f9f97a7 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73cd=['rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','diff','seconds','lastevent','complete','total','answered','starttime','holdtime','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','destuniqueid','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','isNotNull','isUndefined','prototype','emit','debug','uniqueid','inspect','format','called','channel','substring','lastIndexOf','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt'];(function(_0x3996fa,_0x3e5a86){var _0x3fe730=function(_0x3e1eb6){while(--_0x3e1eb6){_0x3996fa['push'](_0x3996fa['shift']());}};_0x3fe730(++_0x3e5a86);}(_0x73cd,0x94));var _0xd73c=function(_0x25a136,_0x57320e){_0x25a136=_0x25a136-0x0;var _0x5b7159=_0x73cd[_0x25a136];return _0x5b7159;};'use strict';var _=require(_0xd73c('0x0'));var moment=require(_0xd73c('0x1'));var util=require(_0xd73c('0x2'));var Redis=require(_0xd73c('0x3'));var config=require(_0xd73c('0x4'));var logger=require(_0xd73c('0x5'))(_0xd73c('0x6'));var ami=require(_0xd73c('0x7'));config[_0xd73c('0x8')]=_[_0xd73c('0x9')](config[_0xd73c('0x8')],{'host':_0xd73c('0xa'),'port':0x18eb});var io=require(_0xd73c('0xb'))(new Redis(config[_0xd73c('0x8')]));function VoiceDialReport(_0xb1b05c){this[_0xd73c('0xc')]=_0xb1b05c[_0xd73c('0xd')];this['outbound']=_0xb1b05c[_0xd73c('0xe')];this[_0xd73c('0xf')]={};ami['on'](_0xd73c('0x10'),this[_0xd73c('0x11')][_0xd73c('0x12')](this));ami['on']('dialend',this[_0xd73c('0x13')]['bind'](this));ami['on'](_0xd73c('0x14'),this[_0xd73c('0x15')][_0xd73c('0x12')](this));ami['on'](_0xd73c('0x16'),this['syncHangup'][_0xd73c('0x12')](this));}VoiceDialReport['prototype'][_0xd73c('0x17')]=function(_0x53114d){return _0x53114d!==null&&!_[_0xd73c('0x18')](_0x53114d);};VoiceDialReport[_0xd73c('0x19')][_0xd73c('0x1a')]=function(_0x71f2c5,_0x413229,_0x1cf689){io['to'](_0x71f2c5)[_0xd73c('0x1a')](_0x413229,_0x1cf689);};VoiceDialReport[_0xd73c('0x19')][_0xd73c('0x11')]=function(_0x4fbcae){try{if(this[_0xd73c('0x17')](_0x4fbcae)){logger[_0xd73c('0x1b')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x4fbcae[_0xd73c('0x1c')],util[_0xd73c('0x1d')](_0x4fbcae,{'showHidden':![],'depth':null}));if(this[_0xd73c('0xc')][_0x4fbcae[_0xd73c('0x1c')]]){_['merge'](this['channels'][_0x4fbcae[_0xd73c('0x1c')]],{'starttime':moment()[_0xd73c('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xd73c('0x1f'),'interface':_0x4fbcae[_0xd73c('0x20')][_0xd73c('0x21')](0x0,_0x4fbcae['channel'][_0xd73c('0x22')]('-')),'membername':_0x4fbcae[_0xd73c('0x20')][_0xd73c('0x21')](_0x4fbcae['channel'][_0xd73c('0x22')]('/')+0x1,_0x4fbcae[_0xd73c('0x20')]['lastIndexOf']('-'))},_[_0xd73c('0x23')](_0x4fbcae,[_0xd73c('0x24'),'privilege']));logger[_0xd73c('0x25')](_0xd73c('0x26'),_0x4fbcae['uniqueid'],this[_0xd73c('0xc')][_0x4fbcae[_0xd73c('0x1c')]][_0xd73c('0x27')],this[_0xd73c('0xc')][_0x4fbcae[_0xd73c('0x1c')]][_0xd73c('0x28')]);logger[_0xd73c('0x1b')](_0xd73c('0x29'),_0x4fbcae['uniqueid'],util[_0xd73c('0x1d')](this['channels'][_0x4fbcae['uniqueid']],{'showHidden':![],'depth':null}));this[_0xd73c('0x1a')](_0xd73c('0x2a'),_0xd73c('0x2b'),this['channels'][_0x4fbcae['uniqueid']]);logger[_0xd73c('0x1b')](_0xd73c('0x2c'),_0x4fbcae[_0xd73c('0x1c')],util[_0xd73c('0x1d')](this['channels'][_0x4fbcae[_0xd73c('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xd73c('0x1a')]('custom:dialbegin',this[_0xd73c('0xc')][_0x4fbcae[_0xd73c('0x1c')]]);}}}catch(_0x32a22b){logger[_0xd73c('0x2d')](_0xd73c('0x2e'),_0x4fbcae[_0xd73c('0x1c')],util[_0xd73c('0x1d')](_0x32a22b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd73c('0x19')][_0xd73c('0x13')]=function(_0x44dd6f){try{if(this[_0xd73c('0x17')](_0x44dd6f)){logger[_0xd73c('0x1b')](_0xd73c('0x2f'),_0x44dd6f['uniqueid'],util[_0xd73c('0x1d')](_0x44dd6f,{'showHidden':![],'depth':null}));if(this[_0xd73c('0xc')][_0x44dd6f[_0xd73c('0x1c')]]){this['channels'][_0x44dd6f[_0xd73c('0x1c')]][_0xd73c('0x30')]=_0x44dd6f[_0xd73c('0x30')];if(_0x44dd6f[_0xd73c('0x30')]==='ANSWER'){this[_0xd73c('0xc')][_0x44dd6f['uniqueid']]['connectedlinenum']=_0x44dd6f[_0xd73c('0x31')];this[_0xd73c('0xc')][_0x44dd6f[_0xd73c('0x1c')]]['connectedlinename']=_0x44dd6f[_0xd73c('0x32')];this['channels'][_0x44dd6f[_0xd73c('0x1c')]][_0xd73c('0x33')]=moment()[_0xd73c('0x1e')](_0xd73c('0x34'));this[_0xd73c('0xc')][_0x44dd6f[_0xd73c('0x1c')]]['lastevent']=_0xd73c('0x35');logger[_0xd73c('0x25')](_0xd73c('0x36'),_0x44dd6f['uniqueid'],_0x44dd6f[_0xd73c('0x20')][_0xd73c('0x21')](_0x44dd6f[_0xd73c('0x20')][_0xd73c('0x22')]('/')+0x1,_0x44dd6f[_0xd73c('0x20')][_0xd73c('0x22')]('-')));logger[_0xd73c('0x1b')](_0xd73c('0x37'),_0x44dd6f[_0xd73c('0x1c')],util[_0xd73c('0x1d')](this[_0xd73c('0xc')][_0x44dd6f['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xd73c('0x1a')](_0xd73c('0x38'),this['channels'][_0x44dd6f[_0xd73c('0x1c')]]);}logger['debug'](_0xd73c('0x39'),_0x44dd6f[_0xd73c('0x1c')],util['inspect'](this['channels'][_0x44dd6f['uniqueid']],{'showHidden':![],'depth':null}));this[_0xd73c('0x1a')](_0xd73c('0x2a'),'voice_outbound_channel:save',this[_0xd73c('0xc')][_0x44dd6f[_0xd73c('0x1c')]]);}}}catch(_0x2909df){logger['error'](_0xd73c('0x3a'),_0x44dd6f['uniqueid'],util['inspect'](_0x2909df,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd73c('0x19')]['syncVarSet']=function(_0x2d3086){try{if(this['isNotNull'](_0x2d3086)){logger[_0xd73c('0x1b')](_0xd73c('0x3b'),_0x2d3086['uniqueid'],util[_0xd73c('0x1d')](_0x2d3086,{'showHidden':![],'depth':null}));this[_0xd73c('0x3c')](_0x2d3086['uniqueid'],_[_0xd73c('0x3d')](_0x2d3086[_0xd73c('0x3e')])[0x0],_0x2d3086[_0xd73c('0x3f')]);if(this[_0xd73c('0x17')](_0x2d3086[_0xd73c('0x3e')])&&this[_0xd73c('0x17')](_0x2d3086[_0xd73c('0x3e')]['outboundrouteid'])){if(_[_0xd73c('0x18')](this[_0xd73c('0xc')][_0x2d3086[_0xd73c('0x1c')]])){this[_0xd73c('0xc')][_0x2d3086['uniqueid']]={'routeId':_0x2d3086[_0xd73c('0x3f')],'variables':this[_0xd73c('0xf')][_0x2d3086['uniqueid']]};logger['info'](_0xd73c('0x40'),_0x2d3086[_0xd73c('0x1c')],_0x2d3086['variable']['outboundrouteid'],_[_0xd73c('0x3d')](_0x2d3086['variable'])[0x0],_0x2d3086[_0xd73c('0x3f')]);logger[_0xd73c('0x1b')](_0xd73c('0x41'),_0x2d3086['uniqueid'],util['inspect'](this[_0xd73c('0xc')][_0x2d3086[_0xd73c('0x1c')]],{'showHidden':![],'depth':null}));this[_0xd73c('0x1a')](_0xd73c('0x2a'),_0xd73c('0x2b'),this[_0xd73c('0xc')][_0x2d3086[_0xd73c('0x1c')]]);}}}}catch(_0x334326){logger[_0xd73c('0x2d')](_0xd73c('0x42'),_0x2d3086['uniqueid'],util['inspect'](_0x334326,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x3bad27,_0x53d7c0,_0x13f87a){var _0x6bdfac=['rtpaudioqos','rtpaudioqosbridged',_0xd73c('0x43'),_0xd73c('0x44'),_0xd73c('0x45'),_0xd73c('0x46'),_0xd73c('0x47'),_0xd73c('0x48'),_0xd73c('0x49'),_0xd73c('0x4a'),_0xd73c('0x4b'),_0xd73c('0x4c'),_0xd73c('0x4d'),_0xd73c('0x4e'),_0xd73c('0x4f'),_0xd73c('0x50'),'membername',_0xd73c('0x51'),_0xd73c('0x52')];if(!_[_0xd73c('0x53')](_0x53d7c0)&&!_[_0xd73c('0x54')](_0x6bdfac,_0x53d7c0)){if(_[_0xd73c('0x18')](this[_0xd73c('0xf')][_0x3bad27])){this[_0xd73c('0xf')][_0x3bad27]={};}this[_0xd73c('0xf')][_0x3bad27][_0x53d7c0]=_0x13f87a;}};VoiceDialReport[_0xd73c('0x19')]['syncHangup']=function(_0x400c68){try{if(this[_0xd73c('0x17')](_0x400c68)){logger[_0xd73c('0x1b')](_0xd73c('0x55'),_0x400c68[_0xd73c('0x1c')],util[_0xd73c('0x1d')](_0x400c68,{'showHidden':![],'depth':null}));if(this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]]){logger[_0xd73c('0x25')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x400c68[_0xd73c('0x1c')],_0x400c68[_0xd73c('0x56')]);this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x57')]=moment()[_0xd73c('0x1e')](_0xd73c('0x34'));this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x58')]=moment(this[_0xd73c('0xc')][_0x400c68['uniqueid']][_0xd73c('0x57')])[_0xd73c('0x59')](this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]]['starttime'],_0xd73c('0x5a'));this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x5b')]=_0xd73c('0x5c');this[_0xd73c('0xe')][_0xd73c('0x5d')]+=0x1;if(this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x33')]){this[_0xd73c('0xe')][_0xd73c('0x5e')]+=0x1;this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]]['holdtime']=moment(this['channels'][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x33')])['diff'](this['channels'][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x5f')],_0xd73c('0x5a'));this['channels'][_0x400c68[_0xd73c('0x1c')]]['billableseconds']=moment(this[_0xd73c('0xc')][_0x400c68['uniqueid']][_0xd73c('0x57')])['diff'](this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x33')],'seconds');this[_0xd73c('0xe')]['sumHoldTime']+=this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x60')]||0x0;this[_0xd73c('0xe')]['sumBillable']+=this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x61')];}this[_0xd73c('0xe')][_0xd73c('0x62')]+=this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]]['duration'];logger[_0xd73c('0x1b')](_0xd73c('0x63'),_0x400c68[_0xd73c('0x1c')],util['inspect'](this[_0xd73c('0xc')][_0x400c68['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xd73c('0x1a')](_0xd73c('0x64'),this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]]);logger[_0xd73c('0x1b')](_0xd73c('0x65'),_0x400c68[_0xd73c('0x1c')],util[_0xd73c('0x1d')](this[_0xd73c('0xc')][_0x400c68['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xd73c('0x66'),this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]]);logger[_0xd73c('0x1b')](_0xd73c('0x67'),_0x400c68[_0xd73c('0x1c')],util[_0xd73c('0x1d')](this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]],{'showHidden':![],'depth':null}));this[_0xd73c('0x1a')](_0xd73c('0x2a'),'voice_outbound:save',this[_0xd73c('0xe')]);logger[_0xd73c('0x25')](_0xd73c('0x68'),JSON[_0xd73c('0x69')](this[_0xd73c('0xc')][_0x400c68['uniqueid']]));logger[_0xd73c('0x1b')](_0xd73c('0x6a'),_0x400c68['uniqueid'],util[_0xd73c('0x1d')](this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]],{'showHidden':![],'depth':null}));this[_0xd73c('0x1a')](_0xd73c('0x2a'),'voice_outbound_channel:remove',this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]]);delete this['channels'][_0x400c68['uniqueid']];}else if(this[_0xd73c('0xc')][_0x400c68['linkedid']]){this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x6b')]][_0xd73c('0x1c')]=this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x6b')]][_0xd73c('0x6c')];}if(this['variables'][_0x400c68[_0xd73c('0x1c')]]){delete this['variables'][_0x400c68[_0xd73c('0x1c')]];}}}catch(_0x5bdd65){logger[_0xd73c('0x2d')]('[%s][voiceDialReport][hangup]',_0x400c68[_0xd73c('0x1c')],util[_0xd73c('0x1d')](_0x5bdd65,{'showHidden':![],'depth':null}));}};module[_0xd73c('0x6d')]=VoiceDialReport; \ No newline at end of file +var _0xf48d=['[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','outboundrouteid','value','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','membername','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','seconds','lastevent','outbound','total','answertime','answered','starttime','billableseconds','sumHoldTime','holdtime','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','called','substring','channel','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','YYYY-MM-DD\x20HH:mm:ss','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect'];(function(_0x193820,_0x151968){var _0x101062=function(_0x225ca9){while(--_0x225ca9){_0x193820['push'](_0x193820['shift']());}};_0x101062(++_0x151968);}(_0xf48d,0xa3));var _0xdf48=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0xf48d[_0x31e5cb];return _0x4170df;};'use strict';var _=require(_0xdf48('0x0'));var moment=require(_0xdf48('0x1'));var util=require('util');var Redis=require(_0xdf48('0x2'));var config=require(_0xdf48('0x3'));var logger=require(_0xdf48('0x4'))(_0xdf48('0x5'));var ami=require(_0xdf48('0x6'));config[_0xdf48('0x7')]=_['defaults'](config['redis'],{'host':_0xdf48('0x8'),'port':0x18eb});var io=require(_0xdf48('0x9'))(new Redis(config[_0xdf48('0x7')]));function VoiceDialReport(_0x56086f){this[_0xdf48('0xa')]=_0x56086f[_0xdf48('0xb')];this['outbound']=_0x56086f['outbound'];this[_0xdf48('0xc')]={};ami['on'](_0xdf48('0xd'),this[_0xdf48('0xe')][_0xdf48('0xf')](this));ami['on'](_0xdf48('0x10'),this[_0xdf48('0x11')][_0xdf48('0xf')](this));ami['on'](_0xdf48('0x12'),this[_0xdf48('0x13')][_0xdf48('0xf')](this));ami['on'](_0xdf48('0x14'),this[_0xdf48('0x15')][_0xdf48('0xf')](this));}VoiceDialReport[_0xdf48('0x16')][_0xdf48('0x17')]=function(_0x3e913a){return _0x3e913a!==null&&!_[_0xdf48('0x18')](_0x3e913a);};VoiceDialReport['prototype'][_0xdf48('0x19')]=function(_0x3e47ac,_0x3aa3f6,_0x257357){io['to'](_0x3e47ac)['emit'](_0x3aa3f6,_0x257357);};VoiceDialReport[_0xdf48('0x16')][_0xdf48('0xe')]=function(_0x3a91a2){try{if(this['isNotNull'](_0x3a91a2)){logger[_0xdf48('0x1a')](_0xdf48('0x1b'),_0x3a91a2[_0xdf48('0x1c')],util[_0xdf48('0x1d')](_0x3a91a2,{'showHidden':![],'depth':null}));if(this[_0xdf48('0xa')][_0x3a91a2['uniqueid']]){_['merge'](this[_0xdf48('0xa')][_0x3a91a2[_0xdf48('0x1c')]],{'starttime':moment()[_0xdf48('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xdf48('0x1f'),'interface':_0x3a91a2['channel'][_0xdf48('0x20')](0x0,_0x3a91a2[_0xdf48('0x21')][_0xdf48('0x22')]('-')),'membername':_0x3a91a2[_0xdf48('0x21')][_0xdf48('0x20')](_0x3a91a2[_0xdf48('0x21')]['lastIndexOf']('/')+0x1,_0x3a91a2[_0xdf48('0x21')][_0xdf48('0x22')]('-'))},_[_0xdf48('0x23')](_0x3a91a2,[_0xdf48('0x24'),_0xdf48('0x25')]));logger[_0xdf48('0x26')](_0xdf48('0x27'),_0x3a91a2['uniqueid'],this['channels'][_0x3a91a2[_0xdf48('0x1c')]]['membername'],this[_0xdf48('0xa')][_0x3a91a2[_0xdf48('0x1c')]][_0xdf48('0x28')]);logger['debug'](_0xdf48('0x29'),_0x3a91a2[_0xdf48('0x1c')],util[_0xdf48('0x1d')](this[_0xdf48('0xa')][_0x3a91a2[_0xdf48('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0xdf48('0x2a'),_0xdf48('0x2b'),this[_0xdf48('0xa')][_0x3a91a2['uniqueid']]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x3a91a2['uniqueid'],util[_0xdf48('0x1d')](this[_0xdf48('0xa')][_0x3a91a2[_0xdf48('0x1c')]],{'showHidden':![],'depth':null}));ami['emit'](_0xdf48('0x2c'),this['channels'][_0x3a91a2['uniqueid']]);}}}catch(_0x260276){logger[_0xdf48('0x2d')](_0xdf48('0x2e'),_0x3a91a2[_0xdf48('0x1c')],util[_0xdf48('0x1d')](_0x260276,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdf48('0x16')][_0xdf48('0x11')]=function(_0x377b89){try{if(this[_0xdf48('0x17')](_0x377b89)){logger[_0xdf48('0x1a')](_0xdf48('0x2f'),_0x377b89['uniqueid'],util[_0xdf48('0x1d')](_0x377b89,{'showHidden':![],'depth':null}));if(this['channels'][_0x377b89[_0xdf48('0x1c')]]){this['channels'][_0x377b89[_0xdf48('0x1c')]][_0xdf48('0x30')]=_0x377b89[_0xdf48('0x30')];if(_0x377b89['dialstatus']===_0xdf48('0x31')){this[_0xdf48('0xa')][_0x377b89['uniqueid']][_0xdf48('0x32')]=_0x377b89['connectedlinenum'];this[_0xdf48('0xa')][_0x377b89[_0xdf48('0x1c')]][_0xdf48('0x33')]=_0x377b89['connectedlinename'];this[_0xdf48('0xa')][_0x377b89['uniqueid']]['answertime']=moment()[_0xdf48('0x1e')](_0xdf48('0x34'));this[_0xdf48('0xa')][_0x377b89['uniqueid']]['lastevent']=_0xdf48('0x35');logger['info'](_0xdf48('0x36'),_0x377b89[_0xdf48('0x1c')],_0x377b89['channel'][_0xdf48('0x20')](_0x377b89[_0xdf48('0x21')]['lastIndexOf']('/')+0x1,_0x377b89[_0xdf48('0x21')][_0xdf48('0x22')]('-')));logger['debug'](_0xdf48('0x37'),_0x377b89['uniqueid'],util['inspect'](this[_0xdf48('0xa')][_0x377b89[_0xdf48('0x1c')]],{'showHidden':![],'depth':null}));ami['emit'](_0xdf48('0x38'),this[_0xdf48('0xa')][_0x377b89[_0xdf48('0x1c')]]);}logger['debug'](_0xdf48('0x39'),_0x377b89[_0xdf48('0x1c')],util['inspect'](this[_0xdf48('0xa')][_0x377b89[_0xdf48('0x1c')]],{'showHidden':![],'depth':null}));this[_0xdf48('0x19')](_0xdf48('0x2a'),'voice_outbound_channel:save',this[_0xdf48('0xa')][_0x377b89[_0xdf48('0x1c')]]);}}}catch(_0x52fbbb){logger['error'](_0xdf48('0x3a'),_0x377b89['uniqueid'],util['inspect'](_0x52fbbb,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xdf48('0x13')]=function(_0x601a7b){try{if(this['isNotNull'](_0x601a7b)){logger[_0xdf48('0x1a')](_0xdf48('0x3b'),_0x601a7b[_0xdf48('0x1c')],util[_0xdf48('0x1d')](_0x601a7b,{'showHidden':![],'depth':null}));this[_0xdf48('0x3c')](_0x601a7b[_0xdf48('0x1c')],_[_0xdf48('0x3d')](_0x601a7b[_0xdf48('0x3e')])[0x0],_0x601a7b['value']);if(this[_0xdf48('0x17')](_0x601a7b[_0xdf48('0x3e')])&&this[_0xdf48('0x17')](_0x601a7b[_0xdf48('0x3e')][_0xdf48('0x3f')])){if(_[_0xdf48('0x18')](this['channels'][_0x601a7b[_0xdf48('0x1c')]])){this[_0xdf48('0xa')][_0x601a7b[_0xdf48('0x1c')]]={'routeId':_0x601a7b[_0xdf48('0x40')],'variables':this[_0xdf48('0xc')][_0x601a7b['uniqueid']]};logger[_0xdf48('0x26')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x601a7b['uniqueid'],_0x601a7b[_0xdf48('0x3e')]['outboundrouteid'],_[_0xdf48('0x3d')](_0x601a7b[_0xdf48('0x3e')])[0x0],_0x601a7b[_0xdf48('0x40')]);logger[_0xdf48('0x1a')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x601a7b[_0xdf48('0x1c')],util[_0xdf48('0x1d')](this[_0xdf48('0xa')][_0x601a7b[_0xdf48('0x1c')]],{'showHidden':![],'depth':null}));this[_0xdf48('0x19')](_0xdf48('0x2a'),_0xdf48('0x2b'),this[_0xdf48('0xa')][_0x601a7b[_0xdf48('0x1c')]]);}}}}catch(_0x11ad45){logger[_0xdf48('0x2d')](_0xdf48('0x41'),_0x601a7b[_0xdf48('0x1c')],util[_0xdf48('0x1d')](_0x11ad45,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x9742f9,_0x431956,_0x208179){var _0x2fe8c1=[_0xdf48('0x42'),_0xdf48('0x43'),_0xdf48('0x44'),_0xdf48('0x45'),'rtpaudioqosloss',_0xdf48('0x46'),_0xdf48('0x47'),'rtpaudioqosrttbridged',_0xdf48('0x48'),'sipuri','bridgepeer',_0xdf48('0x49'),_0xdf48('0x4a'),_0xdf48('0x4b'),_0xdf48('0x4c'),'memberlastcall',_0xdf48('0x4d'),'memberpenalty',_0xdf48('0x4e')];if(!_[_0xdf48('0x4f')](_0x431956)&&!_[_0xdf48('0x50')](_0x2fe8c1,_0x431956)){if(_[_0xdf48('0x18')](this['variables'][_0x9742f9])){this['variables'][_0x9742f9]={};}this[_0xdf48('0xc')][_0x9742f9][_0x431956]=_0x208179;}};VoiceDialReport[_0xdf48('0x16')][_0xdf48('0x15')]=function(_0x1ff529){try{if(this[_0xdf48('0x17')](_0x1ff529)){logger[_0xdf48('0x1a')](_0xdf48('0x51'),_0x1ff529['uniqueid'],util['inspect'](_0x1ff529,{'showHidden':![],'depth':null}));if(this['channels'][_0x1ff529[_0xdf48('0x1c')]]){logger[_0xdf48('0x26')](_0xdf48('0x52'),_0x1ff529[_0xdf48('0x1c')],_0x1ff529[_0xdf48('0x53')]);this['channels'][_0x1ff529[_0xdf48('0x1c')]][_0xdf48('0x54')]=moment()['format'](_0xdf48('0x34'));this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x1c')]][_0xdf48('0x55')]=moment(this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x1c')]][_0xdf48('0x54')])[_0xdf48('0x56')](this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x1c')]]['starttime'],_0xdf48('0x57'));this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x1c')]][_0xdf48('0x58')]='complete';this[_0xdf48('0x59')][_0xdf48('0x5a')]+=0x1;if(this['channels'][_0x1ff529[_0xdf48('0x1c')]][_0xdf48('0x5b')]){this[_0xdf48('0x59')][_0xdf48('0x5c')]+=0x1;this['channels'][_0x1ff529['uniqueid']]['holdtime']=moment(this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x1c')]][_0xdf48('0x5b')])[_0xdf48('0x56')](this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x1c')]][_0xdf48('0x5d')],_0xdf48('0x57'));this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x1c')]][_0xdf48('0x5e')]=moment(this['channels'][_0x1ff529[_0xdf48('0x1c')]][_0xdf48('0x54')])[_0xdf48('0x56')](this['channels'][_0x1ff529[_0xdf48('0x1c')]][_0xdf48('0x5b')],_0xdf48('0x57'));this[_0xdf48('0x59')][_0xdf48('0x5f')]+=this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x1c')]][_0xdf48('0x60')]||0x0;this[_0xdf48('0x59')][_0xdf48('0x61')]+=this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x1c')]]['billableseconds'];}this[_0xdf48('0x59')]['sumDuration']+=this[_0xdf48('0xa')][_0x1ff529['uniqueid']]['duration'];logger['debug'](_0xdf48('0x62'),_0x1ff529[_0xdf48('0x1c')],util[_0xdf48('0x1d')](this['channels'][_0x1ff529[_0xdf48('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xdf48('0x19')](_0xdf48('0x63'),this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x1c')]]);logger['debug'](_0xdf48('0x64'),_0x1ff529[_0xdf48('0x1c')],util[_0xdf48('0x1d')](this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x1c')]],{'showHidden':![],'depth':null}));ami['emit'](_0xdf48('0x65'),this['channels'][_0x1ff529[_0xdf48('0x1c')]]);logger['debug'](_0xdf48('0x66'),_0x1ff529[_0xdf48('0x1c')],util[_0xdf48('0x1d')](this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x1c')]],{'showHidden':![],'depth':null}));this[_0xdf48('0x19')]('voice:outbound',_0xdf48('0x67'),this['outbound']);logger[_0xdf48('0x26')](_0xdf48('0x68'),JSON['stringify'](this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x1c')]]));logger[_0xdf48('0x1a')](_0xdf48('0x69'),_0x1ff529[_0xdf48('0x1c')],util['inspect'](this[_0xdf48('0xa')][_0x1ff529['uniqueid']],{'showHidden':![],'depth':null}));this[_0xdf48('0x19')](_0xdf48('0x2a'),_0xdf48('0x6a'),this['channels'][_0x1ff529[_0xdf48('0x1c')]]);delete this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x1c')]];}else if(this[_0xdf48('0xa')][_0x1ff529['linkedid']]){this['channels'][_0x1ff529[_0xdf48('0x6b')]][_0xdf48('0x1c')]=this[_0xdf48('0xa')][_0x1ff529[_0xdf48('0x6b')]][_0xdf48('0x6c')];}if(this[_0xdf48('0xc')][_0x1ff529[_0xdf48('0x1c')]]){delete this[_0xdf48('0xc')][_0x1ff529[_0xdf48('0x1c')]];}}}catch(_0x52a5a8){logger[_0xdf48('0x2d')](_0xdf48('0x6d'),_0x1ff529['uniqueid'],util[_0xdf48('0x1d')](_0x52a5a8,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 9b9e836..ca12e9b 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x373d=['[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','lodash','util','md5','ioredis','../../../config/environment','ami','../ami','../model/queueReport','redis','localhost','socket.io-emitter','enqueue','tail','finally','sequence','queueReports','channels','queueChannels','voiceQueues','variables','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','prototype','switch','isNil','status','channel','catch','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','error','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','agents','campaigns','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][','uniqueid','name','voice_queue_channel:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','voice:queue:%s','voice_queue_channel:remove','type','inbound','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','Trunk','callerid','Interval','stringify',']\x20sending\x20voice_queue:save\x20event:','format','voice_queue:save','isUndefined','clearZombieChannels','queues','[voiceQueueReport][queues]','flagQueueSummary','Action','[voiceQueueReport][queuesummary]','isNotNull','[voiceQueueReport][queuesummary]\x20event:','queue','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','available','emitVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','push','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','queuecallerexitreason','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerjoinAt','add','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','toUpperCase','syncVarSet','addVariable','variable','queuestatus','value','CONTINUE','lastevent','timeout','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','[%s][voiceQueueReport][hangup]','length','diff','seconds','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x373d,0x1e2));var _0xd373=function(_0x37b7a0,_0x2ee4f5){_0x37b7a0=_0x37b7a0-0x0;var _0x4fb461=_0x373d[_0x37b7a0];return _0x4fb461;};'use strict';var _=require(_0xd373('0x0'));var moment=require('moment');var util=require(_0xd373('0x1'));var md5=require(_0xd373('0x2'));var Redis=require(_0xd373('0x3'));var config=require(_0xd373('0x4'));var logger=require('../../../config/logger')(_0xd373('0x5'));var ami=require(_0xd373('0x6'));var QueueReport=require(_0xd373('0x7'));config['redis']=_['defaults'](config[_0xd373('0x8')],{'host':_0xd373('0x9'),'port':0x18eb});var io=require(_0xd373('0xa'))(new Redis(config[_0xd373('0x8')]));var Sequence=function(){};Sequence['prototype'][_0xd373('0xb')]=function(_0x51c074){this['tail']=this['tail']?this[_0xd373('0xc')][_0xd373('0xd')](_0x51c074):_0x51c074();};function VoiceQueueReport(_0x4a67af){this[_0xd373('0xe')]=new Sequence();this[_0xd373('0xf')]={};this['agents']=_0x4a67af['agents'];this[_0xd373('0x10')]=_0x4a67af[_0xd373('0x11')];this[_0xd373('0x12')]=_0x4a67af[_0xd373('0x12')];this['flagQueueSummary']=!![];this['campaigns']=_0x4a67af['campaigns'];this[_0xd373('0x13')]={};ami['on'](_0xd373('0x14'),this['syncQueueSummary'][_0xd373('0x15')](this));ami['on'](_0xd373('0x16'),this[_0xd373('0x17')][_0xd373('0x15')](this));ami['on'](_0xd373('0x18'),this[_0xd373('0x19')][_0xd373('0x15')](this));ami['on'](_0xd373('0x1a'),this[_0xd373('0x1b')][_0xd373('0x15')](this));ami['on'](_0xd373('0x1c'),this[_0xd373('0x1d')][_0xd373('0x15')](this));ami['on']('agentcomplete',this[_0xd373('0x1e')]['bind'](this));ami['on'](_0xd373('0x1f'),this[_0xd373('0x20')]['bind'](this));ami['on'](_0xd373('0x21'),this['syncVarSet']['bind'](this));ami['on'](_0xd373('0x22'),this[_0xd373('0x23')][_0xd373('0x15')](this));ami['on'](_0xd373('0x24'),this[_0xd373('0x25')][_0xd373('0x15')](this));ami['on']('musiconholdstart',this[_0xd373('0x26')][_0xd373('0x15')](this));ami['on'](_0xd373('0x27'),this[_0xd373('0x28')][_0xd373('0x15')](this));ami['on'](_0xd373('0x29'),this['syncAttendedTransfer'][_0xd373('0x15')](this));ami['on'](_0xd373('0x2a'),this[_0xd373('0x2b')][_0xd373('0x15')](this));this[_0xd373('0x2c')]();this[_0xd373('0x2d')]();}function clearChannels(_0x466a03){if(!_[_0xd373('0x2e')](_0x466a03)){for(var _0x1ab540 in _0x466a03){if(_0x466a03[_0xd373('0x2f')](_0x1ab540)){delete _0x466a03[_0x1ab540];}}}}function clearCampaigns(_0x437110){if(!_[_0xd373('0x2e')](_0x437110)){for(var _0x388182 in _0x437110){if(_0x437110[_0xd373('0x2f')](_0x388182)){_0x437110[_0x388182][_0xd373('0x30')]=0x0;}}}}function clearVoiceQueues(_0x38ba50){if(!_[_0xd373('0x2e')](_0x38ba50)){for(var _0x13a012 in _0x38ba50){if(_0x38ba50[_0xd373('0x2f')](_0x13a012)){_0x38ba50[_0x13a012][_0xd373('0x30')]=0x0;_0x38ba50[_0x13a012][_0xd373('0x31')]=0x0;_0x38ba50[_0x13a012][_0xd373('0x32')]=0x0;_0x38ba50[_0x13a012][_0xd373('0x33')]=0x0;_0x38ba50[_0x13a012][_0xd373('0x34')]=!![];}}}}function clearAgentBooked(_0xf85ca8){if(!_[_0xd373('0x2e')](_0xf85ca8)){for(var _0x158825 in _0xf85ca8){if(_0xf85ca8[_0xd373('0x2f')](_0x158825)){_0xf85ca8[_0x158825][_0xd373('0x35')]=!![];}}}}VoiceQueueReport[_0xd373('0x36')]['clearZombieChannels']=function(){var _0x7ca56e=this;for(var _0x490842 in this['channels']){if(this[_0xd373('0x10')][_0xd373('0x2f')](_0x490842)&&!this[_0xd373('0x10')][_0x490842][_0xd373('0x37')]){this[_0xd373('0xe')]['enqueue'](function(){if(!_[_0xd373('0x38')](_0x7ca56e[_0xd373('0x10')][_0x490842])){return ami['Action']({'action':_0xd373('0x39'),'channel':_0x7ca56e[_0xd373('0x10')][_0x490842][_0xd373('0x3a')]})[_0xd373('0x3b')](function(_0x26538a){if(_0x26538a[_0xd373('0x3c')]===_0xd373('0x3d')){setTimeout(function(){if(_0x7ca56e[_0xd373('0x10')][_0x490842]){delete _0x7ca56e[_0xd373('0x10')][_0x490842];logger['error'](_0xd373('0x3e'),_0x490842,util[_0xd373('0x3f')](_0x26538a,{'showHidden':![],'depth':null}));}if(_0x7ca56e[_0xd373('0xf')][_0x490842]){delete _0x7ca56e[_0xd373('0xf')][_0x490842];logger[_0xd373('0x40')](_0xd373('0x41'),_0x490842,util[_0xd373('0x3f')](_0x26538a,{'showHidden':![],'depth':null}));}if(_0x7ca56e[_0xd373('0x13')][_0x490842]){delete _0x7ca56e[_0xd373('0x13')][_0x490842];logger[_0xd373('0x40')](_0xd373('0x42'),_0x490842,util[_0xd373('0x3f')](_0x26538a,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xd373('0x36')][_0xd373('0x25')]=function(){logger[_0xd373('0x40')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xd373('0x10')]);this[_0xd373('0x43')](this[_0xd373('0xf')]);clearAgentBooked(this[_0xd373('0x44')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xd373('0x45')]);};VoiceQueueReport[_0xd373('0x36')][_0xd373('0x43')]=function(_0x3af9f7){var _0x38d8ec=this;if(!_[_0xd373('0x2e')](_0x3af9f7)){for(var _0x4aab80 in _0x3af9f7){if(_0x3af9f7['hasOwnProperty'](_0x4aab80)){_0x38d8ec[_0xd373('0x46')](_0x3af9f7[_0x4aab80],'clearqueuereport');delete _0x3af9f7[_0x4aab80];}}}};VoiceQueueReport[_0xd373('0x36')][_0xd373('0x47')]=function(_0x1d9b7a,_0x51ba69,_0x287136){io['to'](_0x1d9b7a)[_0xd373('0x47')](_0x51ba69,_0x287136);};VoiceQueueReport[_0xd373('0x36')][_0xd373('0x48')]=function(_0x504450,_0x513038){logger['debug'](_0xd373('0x49')+_0x513038+']\x20sending\x20voice_queue_channel:save\x20event:',_0x504450[_0xd373('0x4a')],util[_0xd373('0x3f')](_0x504450,{'showHidden':![],'depth':null}));this['emit'](util['format']('voice:queue:%s',_0x504450[_0xd373('0x4b')]),_0xd373('0x4c'),_0x504450);io[_0xd373('0x47')]('voice_queue_presence:save',_0x504450);};VoiceQueueReport['prototype'][_0xd373('0x46')]=function(_0x1dfbe2,_0x51efee){logger[_0xd373('0x4d')](_0xd373('0x49')+_0x51efee+_0xd373('0x4e'),_0x1dfbe2[_0xd373('0x4a')],util[_0xd373('0x3f')](_0x1dfbe2,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xd373('0x4f'),_0x1dfbe2[_0xd373('0x4b')]),_0xd373('0x50'),_0x1dfbe2);io[_0xd373('0x47')]('voice_queue_presence:remove',_0x1dfbe2);};VoiceQueueReport[_0xd373('0x36')]['emitVoiceQueueSummary']=function(_0x11f52d,_0xd75e8f){if(_0x11f52d[_0xd373('0x51')]===_0xd373('0x52')){var _0x15cd1f={'id':_0x11f52d['id'],'name':_0x11f52d['name'],'strategy':_0x11f52d[_0xd373('0x53')],'answered':_0x11f52d[_0xd373('0x54')],'available':_0x11f52d['available'],'loggedIn':_0x11f52d[_0xd373('0x55')],'pTalking':_0x11f52d[_0xd373('0x32')],'sumBillable':_0x11f52d[_0xd373('0x56')],'sumDuration':_0x11f52d[_0xd373('0x57')],'sumHoldTime':_0x11f52d[_0xd373('0x58')]||0x0,'talking':_0x11f52d[_0xd373('0x31')],'total':_0x11f52d[_0xd373('0x59')],'type':_0x11f52d[_0xd373('0x51')],'unmanaged':_0x11f52d[_0xd373('0x5a')],'abandoned':_0x11f52d[_0xd373('0x5b')],'waiting':_0x11f52d['waiting']};if(_0x11f52d['Trunk']){_0x15cd1f[_0xd373('0x5c')]={'id':_0x11f52d['Trunk']['id'],'name':_0x11f52d[_0xd373('0x5c')]['name'],'active':_0x11f52d['Trunk']['active'],'callerid':_0x11f52d[_0xd373('0x5c')][_0xd373('0x5d')]};}if(_0x11f52d[_0xd373('0x5e')]){_0x15cd1f[_0xd373('0x5e')]={'id':_0x11f52d[_0xd373('0x5e')]['id'],'name':_0x11f52d[_0xd373('0x5e')][_0xd373('0x4b')]};}var _0x4d1088=md5(JSON[_0xd373('0x5f')](_0x15cd1f));if(_0x11f52d['md5']!==_0x4d1088){_0x11f52d[_0xd373('0x2')]=_0x4d1088;logger[_0xd373('0x4d')]('[voiceQueueReport]['+_0xd75e8f+_0xd373('0x60'),util['inspect'](_0x15cd1f,{'showHidden':![],'depth':null}));this[_0xd373('0x47')](util[_0xd373('0x61')](_0xd373('0x4f'),_0x15cd1f[_0xd373('0x4b')]),_0xd373('0x62'),_0x15cd1f);}}};VoiceQueueReport['prototype']['isNotNull']=function(_0x5c76d3){return _0x5c76d3!==null&&!_[_0xd373('0x63')](_0x5c76d3);};VoiceQueueReport[_0xd373('0x36')]['loopQueueShow']=function(){var _0x359bca=this;setInterval(function(){_0x359bca[_0xd373('0x64')]();ami['Action']({'action':_0xd373('0x65')})[_0xd373('0x3b')](function(_0x102101){logger[_0xd373('0x40')](_0xd373('0x66'),util[_0xd373('0x3f')](_0x102101,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xd373('0x36')][_0xd373('0x2c')]=function(){var _0x3d1a9c=this;setInterval(function(){if(_0x3d1a9c[_0xd373('0x67')]){return ami[_0xd373('0x68')]({'action':'queuesummary'})['then'](function(_0x51ca73){_0x3d1a9c['flagQueueSummary']=![];})['catch'](function(_0x5bbe1e){logger[_0xd373('0x40')](_0xd373('0x69'),util['inspect'](_0x5bbe1e,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x1f52e9){try{if(this[_0xd373('0x6a')](_0x1f52e9)&&this['isNotNull'](_0x1f52e9['queue'])){logger[_0xd373('0x4d')](_0xd373('0x6b'),util[_0xd373('0x3f')](_0x1f52e9,{'showHidden':![],'depth':null}));if(this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]]){logger['info'](_0xd373('0x6d'),_0x1f52e9[_0xd373('0x6c')]);var _0x386e4c=_[_0xd373('0x6e')](this[_0xd373('0x10')],_0xd373('0x6c'))[_0x1f52e9[_0xd373('0x6c')]]||0x0;var _0x2e4298=_0x386e4c-_0x1f52e9[_0xd373('0x6f')];if(this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]][_0xd373('0x33')]!==_[_0xd373('0x70')](_0x1f52e9[_0xd373('0x6f')])||this[_0xd373('0x12')][_0x1f52e9['queue']][_0xd373('0x55')]!==_[_0xd373('0x70')](_0x1f52e9[_0xd373('0x71')])||this['voiceQueues'][_0x1f52e9[_0xd373('0x6c')]]['available']!==_[_0xd373('0x70')](_0x1f52e9['available'])||this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]][_0xd373('0x31')]!==_0x2e4298){this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]][_0xd373('0x33')]=_[_0xd373('0x70')](_0x1f52e9[_0xd373('0x6f')]);this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]][_0xd373('0x55')]=_[_0xd373('0x70')](_0x1f52e9[_0xd373('0x71')]);this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]][_0xd373('0x72')]=_[_0xd373('0x70')](_0x1f52e9[_0xd373('0x72')]);this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]][_0xd373('0x31')]=_0x2e4298>0x0?_0x2e4298:0x0;this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]][_0xd373('0x31')]=this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]]['talking']>_[_0xd373('0x70')](_0x1f52e9[_0xd373('0x71')])?_[_0xd373('0x70')](_0x1f52e9['loggedin']):this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]][_0xd373('0x31')];this[_0xd373('0x73')](this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]],_0xd373('0x14'));}logger['debug'](_0xd373('0x74'),util[_0xd373('0x3f')](this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]],{'showHidden':![],'depth':null}));ami[_0xd373('0x47')](_0xd373('0x75'),this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]]);}}}catch(_0x4fbf72){logger[_0xd373('0x40')]('[voiceQueueReport][queuesummary]',util[_0xd373('0x3f')](_0x4fbf72,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd373('0x36')][_0xd373('0x17')]=function(_0x2a9582){logger[_0xd373('0x4d')](_0xd373('0x76'),util[_0xd373('0x3f')](_0x2a9582,{'showHidden':![],'depth':null}));this[_0xd373('0x67')]=!![];};VoiceQueueReport['prototype'][_0xd373('0x19')]=function(_0x5c5855){try{if(this[_0xd373('0x6a')](_0x5c5855)){logger[_0xd373('0x4d')](_0xd373('0x77'),_0x5c5855[_0xd373('0x4a')],util[_0xd373('0x3f')](_0x5c5855,{'showHidden':![],'depth':null}));if(_[_0xd373('0x63')](this[_0xd373('0xf')][_0x5c5855['uniqueid']])){this[_0xd373('0xf')][_0x5c5855[_0xd373('0x4a')]]=[];this[_0xd373('0x10')][_0x5c5855['uniqueid']]={};}var _0x4035d4=new QueueReport();_0x4035d4[_0xd373('0x4b')]=_0x5c5855[_0xd373('0x6c')];_0x4035d4[_0xd373('0x51')]=this[_0xd373('0x12')][_0x4035d4[_0xd373('0x4b')]]&&this[_0xd373('0x12')][_0x4035d4[_0xd373('0x4b')]][_0xd373('0x51')]?this[_0xd373('0x12')][_0x4035d4[_0xd373('0x4b')]][_0xd373('0x51')]||'inbound':_0xd373('0x52');_0x4035d4[_0xd373('0x6c')]=_0x5c5855[_0xd373('0x6c')];_0x4035d4['queuecallerjoinAt']=moment()[_0xd373('0x61')](_0xd373('0x78'));_0x4035d4[_0xd373('0x79')]=_0x5c5855['position'];_0x4035d4[_0xd373('0x7a')]=_0x5c5855['count'];_0x4035d4[_0xd373('0x4a')]=_0x5c5855[_0xd373('0x4a')];logger[_0xd373('0x7b')](_0xd373('0x7c'),_0x4035d4['name'],_0x4035d4[_0xd373('0x51')]);_['merge'](_0x4035d4,_[_0xd373('0x7d')](_0x5c5855,_[_0xd373('0x7e')](_0x4035d4)));this[_0xd373('0xf')][_0x5c5855[_0xd373('0x4a')]][_0xd373('0x7f')](_0x4035d4);this[_0xd373('0x10')][_0x5c5855['uniqueid']]=_0x4035d4;this[_0xd373('0x48')](_0x4035d4,'queuecallerjoin');}}catch(_0xd456f8){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x5c5855[_0xd373('0x4a')],util[_0xd373('0x3f')](_0xd456f8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd373('0x36')][_0xd373('0x1b')]=function(_0x5a5651){try{if(this['isNotNull'](_0x5a5651)){logger[_0xd373('0x4d')](_0xd373('0x80'),_0x5a5651[_0xd373('0x4a')],util[_0xd373('0x3f')](_0x5a5651,{'showHidden':![],'depth':null}));if(this[_0xd373('0xf')][_0x5a5651[_0xd373('0x4a')]]){var _0x16e708=_[_0xd373('0x81')](this[_0xd373('0xf')][_0x5a5651[_0xd373('0x4a')]]);_0x16e708['queuecallercomplete']=![];_0x16e708[_0xd373('0x82')]=null;_0x16e708[_0xd373('0x83')]=_0x5a5651[_0xd373('0x83')];_0x16e708[_0xd373('0x84')]=_0x5a5651[_0xd373('0x84')];_0x16e708[_0xd373('0x1a')]=!![];_0x16e708[_0xd373('0x85')]=moment()['format'](_0xd373('0x78'));_0x16e708['queuecallerexitreason']='ABANDONED';_0x16e708[_0xd373('0x86')]=null;logger[_0xd373('0x7b')](_0xd373('0x87'),_0x16e708[_0xd373('0x4b')],_0x16e708[_0xd373('0x51')]);this[_0xd373('0x10')][_0x5a5651['uniqueid']]=_0x16e708;this[_0xd373('0x46')](_0x16e708,_0xd373('0x1a'));}}}catch(_0x6114a5){logger['error'](_0xd373('0x80'),_0x5a5651[_0xd373('0x4a')],util[_0xd373('0x3f')](_0x6114a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd373('0x1d')]=function(_0x33bebe){try{if(this[_0xd373('0x6a')](_0x33bebe)){logger['debug'](_0xd373('0x88'),_0x33bebe[_0xd373('0x4a')],util[_0xd373('0x3f')](_0x33bebe,{'showHidden':![],'depth':null}));if(this[_0xd373('0xf')][_0x33bebe[_0xd373('0x4a')]]){var _0x3c47c6=_[_0xd373('0x81')](this[_0xd373('0xf')][_0x33bebe[_0xd373('0x4a')]]);_0x3c47c6[_0xd373('0x89')]=moment()[_0xd373('0x61')](_0xd373('0x78'));_0x3c47c6[_0xd373('0x8a')]=_0x33bebe['connectedlinenum'];_0x3c47c6[_0xd373('0x8b')]=_0x33bebe[_0xd373('0x8b')];logger[_0xd373('0x7b')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3c47c6[_0xd373('0x4b')],_0x3c47c6[_0xd373('0x51')],_0x33bebe['connectedlinenum'],_0x33bebe[_0xd373('0x8b')]);this['channels'][_0x33bebe[_0xd373('0x4a')]]=_0x3c47c6;this[_0xd373('0x48')](_0x3c47c6,_0xd373('0x1c'));}}}catch(_0x3bc47a){logger[_0xd373('0x40')](_0xd373('0x88'),_0x33bebe['uniqueid'],util[_0xd373('0x3f')](_0x3bc47a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd373('0x20')]=function(_0xc56e62){try{if(this[_0xd373('0x6a')](_0xc56e62)){logger[_0xd373('0x4d')](_0xd373('0x8c'),_0xc56e62['uniqueid'],util[_0xd373('0x3f')](_0xc56e62,{'showHidden':![],'depth':null}));if(this[_0xd373('0xf')][_0xc56e62[_0xd373('0x4a')]]){var _0x12ffc0=_[_0xd373('0x81')](this[_0xd373('0xf')][_0xc56e62['uniqueid']]);_0x12ffc0[_0xd373('0x8d')]=!![];_0x12ffc0[_0xd373('0x8e')]=_0xd373('0x8f');logger['info'](_0xd373('0x90'),_0x12ffc0[_0xd373('0x4b')],_0x12ffc0['type']);}}}catch(_0x191fa3){logger['error'](_0xd373('0x8c'),_0xc56e62['uniqueid'],util['inspect'](_0x191fa3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd373('0x36')][_0xd373('0x1e')]=function(_0x212d7a){try{if(this[_0xd373('0x6a')](_0x212d7a)){logger[_0xd373('0x4d')]('[%s][voiceQueueReport][agentcomplete]',_0x212d7a[_0xd373('0x4a')],util['inspect'](_0x212d7a,{'showHidden':![],'depth':null}));if(this[_0xd373('0xf')][_0x212d7a[_0xd373('0x4a')]]){var _0xc8f4e6=_['last'](this[_0xd373('0xf')][_0x212d7a['uniqueid']]);_0xc8f4e6[_0xd373('0x1a')]=![];_0xc8f4e6[_0xd373('0x85')]=null;_0xc8f4e6[_0xd373('0x91')]=!![];_0xc8f4e6[_0xd373('0x86')]=_0x212d7a[_0xd373('0x92')];_0xc8f4e6['holdtime']=_0x212d7a[_0xd373('0x83')];_0xc8f4e6[_0xd373('0x8d')]=!![];_0xc8f4e6[_0xd373('0x93')]=![];_0xc8f4e6[_0xd373('0x94')]=null;if(!_0xc8f4e6[_0xd373('0x95')]){if(_0x212d7a[_0xd373('0x96')]==_0xd373('0x95')){_0xc8f4e6['queuecallerexitreason']=_0xd373('0x97');logger[_0xd373('0x7b')](_0xd373('0x98'),_0xc8f4e6[_0xd373('0x4b')],_0xc8f4e6[_0xd373('0x51')]);}else{if(_[_0xd373('0x99')](_0x212d7a[_0xd373('0x3a')][_0xd373('0x9a')](),_0xd373('0x9b'))){if(this[_0xd373('0xf')][_0x212d7a[_0xd373('0x9c')]]){var _0x40d7e5=_[_0xd373('0x81')](this[_0xd373('0xf')][_0x212d7a[_0xd373('0x9c')]]);_0x40d7e5[_0xd373('0x8d')]=![];_0x40d7e5[_0xd373('0x93')]=!![];_0x40d7e5['queuecallerexitAt']=moment(_0xc8f4e6[_0xd373('0x9d')])[_0xd373('0x9e')](_0x212d7a['holdtime'],'seconds')[_0xd373('0x61')](_0xd373('0x78'));_0x40d7e5['queuecallerexitreason']=_0xd373('0x9f');_0x40d7e5[_0xd373('0x95')]=!![];_0x40d7e5[_0xd373('0xa0')]=_0xd373('0xa1');_0x40d7e5[_0xd373('0xa2')]=_0x212d7a[_0xd373('0xa3')];_0x40d7e5[_0xd373('0xa4')]=_0x212d7a[_0xd373('0x4a')];logger[_0xd373('0x7b')](_0xd373('0xa5'),_0x40d7e5[_0xd373('0x4b')],_0x40d7e5['type']);var _0x4e8b06=this[_0xd373('0xf')][_0x212d7a[_0xd373('0x9c')]];this['queueReports'][_0x212d7a[_0xd373('0x9c')]]=this[_0xd373('0xf')][_0x212d7a[_0xd373('0x4a')]];this[_0xd373('0xf')][_0x212d7a[_0xd373('0x4a')]]=_0x4e8b06;}}else{_0xc8f4e6[_0xd373('0x8e')]='COMPLETEDBY'+_0x212d7a[_0xd373('0x96')][_0xd373('0xa6')]();logger[_0xd373('0x7b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0xc8f4e6[_0xd373('0x4b')],_0xc8f4e6[_0xd373('0x51')],_0xc8f4e6[_0xd373('0x8e')]);}}}this['channels'][_0x212d7a[_0xd373('0x4a')]]=_0xc8f4e6;this[_0xd373('0x46')](_0xc8f4e6,'agentcomplete');}}}catch(_0xa9b233){logger[_0xd373('0x40')]('[%s][voiceQueueReport][agentcomplete]',_0x212d7a[_0xd373('0x4a')],util['inspect'](_0xa9b233,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd373('0x36')][_0xd373('0xa7')]=function(_0x3b6ba5){try{if(this['isNotNull'](_0x3b6ba5)){logger['debug']('[%s][voiceQueueReport][varset]',_0x3b6ba5[_0xd373('0x4a')],util['inspect'](_0x3b6ba5,{'showHidden':![],'depth':null}));this[_0xd373('0xa8')](_0x3b6ba5[_0xd373('0x4a')],_['keys'](_0x3b6ba5[_0xd373('0xa9')])[0x0],_0x3b6ba5['value']);if(this[_0xd373('0xf')][_0x3b6ba5[_0xd373('0x4a')]]){var _0x15eb3d=_[_0xd373('0x81')](this[_0xd373('0xf')][_0x3b6ba5[_0xd373('0x4a')]]);if(_0x15eb3d){if(this['isNotNull'](_0x3b6ba5[_0xd373('0xa9')])&&this['isNotNull'](_0x3b6ba5[_0xd373('0xa9')][_0xd373('0xaa')])){switch(_0x3b6ba5[_0xd373('0xab')]){case _0xd373('0xac'):_0x15eb3d[_0xd373('0x93')]=![];_0x15eb3d[_0xd373('0x94')]=null;break;case'TIMEOUT':_0x15eb3d[_0xd373('0xad')]=_0xd373('0xae');_0x15eb3d[_0xd373('0x93')]=!![];_0x15eb3d['queuecallerexitAt']=moment()[_0xd373('0x61')](_0xd373('0x78'));_0x15eb3d[_0xd373('0x89')]=moment()[_0xd373('0x61')](_0xd373('0x78'));logger[_0xd373('0x4d')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3b6ba5[_0xd373('0x4a')],util['inspect'](_0x15eb3d,{'showHidden':![],'depth':null}));ami[_0xd373('0x47')](_0xd373('0xaf'),_0x15eb3d);break;default:_0x15eb3d[_0xd373('0x93')]=!![];_0x15eb3d[_0xd373('0x94')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x15eb3d[_0xd373('0x89')]=moment()[_0xd373('0x61')](_0xd373('0x78'));}_0x15eb3d[_0xd373('0x1a')]=![];_0x15eb3d[_0xd373('0x85')]=null;_0x15eb3d[_0xd373('0x8e')]=_0x3b6ba5['value'];this[_0xd373('0x10')][_0x3b6ba5[_0xd373('0x4a')]]=_0x15eb3d;this['emitVoiceQueueChannelRemove'](_0x15eb3d,_0xd373('0x21'));}else if(this[_0xd373('0x6a')](_0x3b6ba5[_0xd373('0xa9')])&&this['isNotNull'](_0x3b6ba5[_0xd373('0xa9')][_0xd373('0xb0')])){if(!_0x15eb3d['queuecallerabandon']){_0x15eb3d['queuecallerexit']=!![];_0x15eb3d[_0xd373('0x94')]=moment()[_0xd373('0x61')](_0xd373('0x78'));_0x15eb3d[_0xd373('0x8e')]=_0xd373('0xb1');_0x15eb3d[_0xd373('0x89')]=moment()[_0xd373('0x61')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd373('0x10')][_0x3b6ba5[_0xd373('0x4a')]]=_0x15eb3d;}}logger[_0xd373('0x7b')](_0xd373('0xb2'),_0x3b6ba5[_0xd373('0x4a')],_0x15eb3d['name'],_0x15eb3d[_0xd373('0x51')],_[_0xd373('0x7e')](_0x3b6ba5['variable'])[0x0],_0x3b6ba5[_0xd373('0xab')]);_0x15eb3d['variables']=this[_0xd373('0x13')][_0x3b6ba5[_0xd373('0x4a')]];}}}}catch(_0x1816a7){logger[_0xd373('0x40')](_0xd373('0xb3'),_0x3b6ba5[_0xd373('0x4a')],util[_0xd373('0x3f')](_0x1816a7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd373('0x36')]['addVariable']=function(_0x3f98d4,_0x4384f0,_0x13b085){var _0x34e385=[_0xd373('0xb4'),_0xd373('0xb5'),'rtpaudioqosjitter',_0xd373('0xb6'),_0xd373('0xb7'),_0xd373('0xb8'),_0xd373('0xb9'),_0xd373('0xba'),_0xd373('0xbb'),_0xd373('0xbc'),_0xd373('0xbd'),_0xd373('0xbe'),'membercalls',_0xd373('0xbf'),_0xd373('0xc0'),_0xd373('0xc1'),'membername',_0xd373('0xc2'),'memberrealtime'];if(!_['isNil'](_0x4384f0)&&!_[_0xd373('0xc3')](_0x34e385,_0x4384f0)){if(_['isUndefined'](this[_0xd373('0x13')][_0x3f98d4])){this['variables'][_0x3f98d4]={};}this['variables'][_0x3f98d4][_0x4384f0]=_0x13b085;}};VoiceQueueReport['prototype']['syncHangup']=function(_0x4934ac){try{if(this[_0xd373('0x6a')](_0x4934ac)){logger[_0xd373('0x4d')](_0xd373('0xc4'),_0x4934ac[_0xd373('0x4a')],util['inspect'](_0x4934ac,{'showHidden':![],'depth':null}));if(this[_0xd373('0xf')][_0x4934ac[_0xd373('0x4a')]]){for(var _0x39cfbf=0x0,_0x1ad6e7={};_0x39cfbf0x0?_0x4347ca:0x0;this[_0x73ee('0xf')][_0x5401ca[_0x73ee('0x61')]]['talking']=this[_0x73ee('0xf')][_0x5401ca[_0x73ee('0x61')]][_0x73ee('0x53')]>_[_0x73ee('0x66')](_0x5401ca['loggedin'])?_[_0x73ee('0x66')](_0x5401ca[_0x73ee('0x67')]):this[_0x73ee('0xf')][_0x5401ca['queue']][_0x73ee('0x53')];this[_0x73ee('0x4a')](this[_0x73ee('0xf')][_0x5401ca[_0x73ee('0x61')]],_0x73ee('0x12'));}logger[_0x73ee('0x40')](_0x73ee('0x68'),util[_0x73ee('0x36')](this[_0x73ee('0xf')][_0x5401ca[_0x73ee('0x61')]],{'showHidden':![],'depth':null}));ami[_0x73ee('0x3e')]('custom:queuesummary',this['voiceQueues'][_0x5401ca[_0x73ee('0x61')]]);}}}catch(_0x117725){logger[_0x73ee('0x35')](_0x73ee('0x69'),util[_0x73ee('0x36')](_0x117725,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x14')]=function(_0x3e2dcf){logger['debug'](_0x73ee('0x6a'),util[_0x73ee('0x36')](_0x3e2dcf,{'showHidden':![],'depth':null}));this[_0x73ee('0x10')]=!![];};VoiceQueueReport[_0x73ee('0x9')]['syncQueueCallerJoin']=function(_0x266a8e){try{if(this['isNotNull'](_0x266a8e)){logger[_0x73ee('0x40')](_0x73ee('0x6b'),_0x266a8e['uniqueid'],util[_0x73ee('0x36')](_0x266a8e,{'showHidden':![],'depth':null}));if(_[_0x73ee('0x5c')](this[_0x73ee('0x37')][_0x266a8e['uniqueid']])){this[_0x73ee('0x37')][_0x266a8e[_0x73ee('0x43')]]=[];this[_0x73ee('0x2e')][_0x266a8e['uniqueid']]={};}var _0x469fcf=new QueueReport();_0x469fcf[_0x73ee('0x46')]=_0x266a8e[_0x73ee('0x61')];_0x469fcf['type']=this['voiceQueues'][_0x469fcf[_0x73ee('0x46')]]&&this['voiceQueues'][_0x469fcf[_0x73ee('0x46')]][_0x73ee('0x4b')]?this['voiceQueues'][_0x469fcf['name']][_0x73ee('0x4b')]||_0x73ee('0x4c'):_0x73ee('0x4c');_0x469fcf[_0x73ee('0x61')]=_0x266a8e[_0x73ee('0x61')];_0x469fcf['queuecallerjoinAt']=moment()[_0x73ee('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x469fcf[_0x73ee('0x6c')]=_0x266a8e['position'];_0x469fcf['count']=_0x266a8e[_0x73ee('0x6d')];_0x469fcf[_0x73ee('0x43')]=_0x266a8e[_0x73ee('0x43')];logger[_0x73ee('0x63')](_0x73ee('0x6e'),_0x469fcf[_0x73ee('0x46')],_0x469fcf[_0x73ee('0x4b')]);_[_0x73ee('0x6f')](_0x469fcf,_[_0x73ee('0x70')](_0x266a8e,_['keys'](_0x469fcf)));this['queueReports'][_0x266a8e[_0x73ee('0x43')]]['push'](_0x469fcf);this[_0x73ee('0x2e')][_0x266a8e[_0x73ee('0x43')]]=_0x469fcf;this[_0x73ee('0x3f')](_0x469fcf,_0x73ee('0x15'));}}catch(_0x59032e){logger['error'](_0x73ee('0x6b'),_0x266a8e[_0x73ee('0x43')],util[_0x73ee('0x36')](_0x59032e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x71')]=function(_0x58e51b){try{if(this['isNotNull'](_0x58e51b)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x58e51b[_0x73ee('0x43')],util['inspect'](_0x58e51b,{'showHidden':![],'depth':null}));if(this[_0x73ee('0x37')][_0x58e51b[_0x73ee('0x43')]]){var _0x3cca1f=_[_0x73ee('0x72')](this['queueReports'][_0x58e51b[_0x73ee('0x43')]]);_0x3cca1f['queuecallercomplete']=![];_0x3cca1f[_0x73ee('0x73')]=null;_0x3cca1f[_0x73ee('0x74')]=_0x58e51b[_0x73ee('0x74')];_0x3cca1f[_0x73ee('0x75')]=_0x58e51b[_0x73ee('0x75')];_0x3cca1f[_0x73ee('0x76')]=!![];_0x3cca1f[_0x73ee('0x77')]=moment()[_0x73ee('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x3cca1f[_0x73ee('0x78')]=_0x73ee('0x79');_0x3cca1f[_0x73ee('0x7a')]=null;logger[_0x73ee('0x63')](_0x73ee('0x7b'),_0x3cca1f[_0x73ee('0x46')],_0x3cca1f[_0x73ee('0x4b')]);this['channels'][_0x58e51b[_0x73ee('0x43')]]=_0x3cca1f;this[_0x73ee('0x3c')](_0x3cca1f,_0x73ee('0x76'));}}}catch(_0x3f1dab){logger['error'](_0x73ee('0x7c'),_0x58e51b[_0x73ee('0x43')],util[_0x73ee('0x36')](_0x3f1dab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x7d')]=function(_0x3120b0){try{if(this['isNotNull'](_0x3120b0)){logger[_0x73ee('0x40')]('[%s][voiceQueueReport][queuecallerleave]',_0x3120b0[_0x73ee('0x43')],util['inspect'](_0x3120b0,{'showHidden':![],'depth':null}));if(this[_0x73ee('0x37')][_0x3120b0[_0x73ee('0x43')]]){var _0x3406e4=_['last'](this['queueReports'][_0x3120b0[_0x73ee('0x43')]]);_0x3406e4[_0x73ee('0x7e')]=moment()[_0x73ee('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x3406e4[_0x73ee('0x7f')]=_0x3120b0[_0x73ee('0x7f')];_0x3406e4[_0x73ee('0x80')]=_0x3120b0[_0x73ee('0x80')];logger['info'](_0x73ee('0x81'),_0x3406e4[_0x73ee('0x46')],_0x3406e4['type'],_0x3120b0[_0x73ee('0x7f')],_0x3120b0[_0x73ee('0x80')]);this[_0x73ee('0x2e')][_0x3120b0[_0x73ee('0x43')]]=_0x3406e4;this[_0x73ee('0x3f')](_0x3406e4,_0x73ee('0x17'));}}}catch(_0x171540){logger['error'](_0x73ee('0x82'),_0x3120b0[_0x73ee('0x43')],util[_0x73ee('0x36')](_0x171540,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73ee('0x9')]['syncAgentConnect']=function(_0x447e8e){try{if(this[_0x73ee('0x5b')](_0x447e8e)){logger[_0x73ee('0x40')](_0x73ee('0x83'),_0x447e8e['uniqueid'],util[_0x73ee('0x36')](_0x447e8e,{'showHidden':![],'depth':null}));if(this[_0x73ee('0x37')][_0x447e8e[_0x73ee('0x43')]]){var _0x201af1=_[_0x73ee('0x72')](this[_0x73ee('0x37')][_0x447e8e['uniqueid']]);_0x201af1[_0x73ee('0x84')]=!![];_0x201af1[_0x73ee('0x78')]=_0x73ee('0x85');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x201af1[_0x73ee('0x46')],_0x201af1[_0x73ee('0x4b')]);}}}catch(_0x23bed7){logger[_0x73ee('0x35')](_0x73ee('0x83'),_0x447e8e['uniqueid'],util['inspect'](_0x23bed7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x86')]=function(_0x18b9fc){try{if(this[_0x73ee('0x5b')](_0x18b9fc)){logger[_0x73ee('0x40')](_0x73ee('0x87'),_0x18b9fc[_0x73ee('0x43')],util[_0x73ee('0x36')](_0x18b9fc,{'showHidden':![],'depth':null}));if(this[_0x73ee('0x37')][_0x18b9fc[_0x73ee('0x43')]]){var _0x5c7215=_[_0x73ee('0x72')](this['queueReports'][_0x18b9fc[_0x73ee('0x43')]]);_0x5c7215[_0x73ee('0x76')]=![];_0x5c7215[_0x73ee('0x77')]=null;_0x5c7215[_0x73ee('0x88')]=!![];_0x5c7215[_0x73ee('0x7a')]=_0x18b9fc[_0x73ee('0x89')];_0x5c7215['holdtime']=_0x18b9fc[_0x73ee('0x74')];_0x5c7215[_0x73ee('0x84')]=!![];_0x5c7215[_0x73ee('0x8a')]=![];_0x5c7215[_0x73ee('0x8b')]=null;if(!_0x5c7215['transfer']){if(_0x18b9fc[_0x73ee('0x8c')]==_0x73ee('0x8d')){_0x5c7215['queuecallerexitreason']='COMPLETED';logger[_0x73ee('0x63')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x5c7215['name'],_0x5c7215[_0x73ee('0x4b')]);}else{if(_[_0x73ee('0x8e')](_0x18b9fc[_0x73ee('0x8f')]['toLowerCase'](),'local/')){if(this[_0x73ee('0x37')][_0x18b9fc[_0x73ee('0x90')]]){var _0x320062=_[_0x73ee('0x72')](this[_0x73ee('0x37')][_0x18b9fc[_0x73ee('0x90')]]);_0x320062[_0x73ee('0x84')]=![];_0x320062[_0x73ee('0x8a')]=!![];_0x320062[_0x73ee('0x8b')]=moment(_0x5c7215['queuecallerjoinAt'])[_0x73ee('0x91')](_0x18b9fc[_0x73ee('0x74')],_0x73ee('0x92'))[_0x73ee('0x44')](_0x73ee('0x93'));_0x320062[_0x73ee('0x78')]='FORWARDTRANSFER';_0x320062[_0x73ee('0x8d')]=!![];_0x320062[_0x73ee('0x94')]=_0x73ee('0x95');_0x320062['transferexten']=_0x18b9fc[_0x73ee('0x96')];_0x320062[_0x73ee('0x97')]=_0x18b9fc['uniqueid'];logger[_0x73ee('0x63')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x320062[_0x73ee('0x46')],_0x320062[_0x73ee('0x4b')]);var _0xdc049f=this[_0x73ee('0x37')][_0x18b9fc[_0x73ee('0x90')]];this[_0x73ee('0x37')][_0x18b9fc[_0x73ee('0x90')]]=this['queueReports'][_0x18b9fc[_0x73ee('0x43')]];this[_0x73ee('0x37')][_0x18b9fc[_0x73ee('0x43')]]=_0xdc049f;}}else{_0x5c7215[_0x73ee('0x78')]=_0x73ee('0x98')+_0x18b9fc['reason'][_0x73ee('0x99')]();logger[_0x73ee('0x63')](_0x73ee('0x9a'),_0x5c7215['name'],_0x5c7215[_0x73ee('0x4b')],_0x5c7215[_0x73ee('0x78')]);}}}this[_0x73ee('0x2e')][_0x18b9fc['uniqueid']]=_0x5c7215;this[_0x73ee('0x3c')](_0x5c7215,_0x73ee('0x9b'));}}}catch(_0xed3899){logger[_0x73ee('0x35')](_0x73ee('0x87'),_0x18b9fc[_0x73ee('0x43')],util[_0x73ee('0x36')](_0xed3899,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x1b')]=function(_0x5e21d0){try{if(this[_0x73ee('0x5b')](_0x5e21d0)){logger[_0x73ee('0x40')](_0x73ee('0x9c'),_0x5e21d0[_0x73ee('0x43')],util['inspect'](_0x5e21d0,{'showHidden':![],'depth':null}));this[_0x73ee('0x9d')](_0x5e21d0[_0x73ee('0x43')],_[_0x73ee('0x9e')](_0x5e21d0['variable'])[0x0],_0x5e21d0[_0x73ee('0x9f')]);if(this[_0x73ee('0x37')][_0x5e21d0[_0x73ee('0x43')]]){var _0x545e69=_[_0x73ee('0x72')](this[_0x73ee('0x37')][_0x5e21d0[_0x73ee('0x43')]]);if(_0x545e69){if(this['isNotNull'](_0x5e21d0['variable'])&&this[_0x73ee('0x5b')](_0x5e21d0[_0x73ee('0xa0')]['queuestatus'])){switch(_0x5e21d0[_0x73ee('0x9f')]){case _0x73ee('0xa1'):_0x545e69['queuecallerexit']=![];_0x545e69[_0x73ee('0x8b')]=null;break;case _0x73ee('0xa2'):_0x545e69[_0x73ee('0xa3')]=_0x73ee('0xa4');_0x545e69[_0x73ee('0x8a')]=!![];_0x545e69[_0x73ee('0x8b')]=moment()[_0x73ee('0x44')](_0x73ee('0x93'));_0x545e69[_0x73ee('0x7e')]=moment()[_0x73ee('0x44')](_0x73ee('0x93'));logger[_0x73ee('0x40')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x5e21d0[_0x73ee('0x43')],util['inspect'](_0x545e69,{'showHidden':![],'depth':null}));ami[_0x73ee('0x3e')]('custom:timeout',_0x545e69);break;default:_0x545e69[_0x73ee('0x8a')]=!![];_0x545e69[_0x73ee('0x8b')]=moment()[_0x73ee('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x545e69[_0x73ee('0x7e')]=moment()[_0x73ee('0x44')](_0x73ee('0x93'));}_0x545e69[_0x73ee('0x76')]=![];_0x545e69['queuecallerabandonAt']=null;_0x545e69[_0x73ee('0x78')]=_0x5e21d0[_0x73ee('0x9f')];this[_0x73ee('0x2e')][_0x5e21d0['uniqueid']]=_0x545e69;this[_0x73ee('0x3c')](_0x545e69,_0x73ee('0x1a'));}else if(this['isNotNull'](_0x5e21d0['variable'])&&this[_0x73ee('0x5b')](_0x5e21d0[_0x73ee('0xa0')][_0x73ee('0xa5')])){if(!_0x545e69[_0x73ee('0x76')]){_0x545e69[_0x73ee('0x8a')]=!![];_0x545e69['queuecallerexitAt']=moment()['format'](_0x73ee('0x93'));_0x545e69['queuecallerexitreason']=_0x73ee('0xa6');_0x545e69[_0x73ee('0x7e')]=moment()['format'](_0x73ee('0x93'));this[_0x73ee('0x2e')][_0x5e21d0[_0x73ee('0x43')]]=_0x545e69;}}logger[_0x73ee('0x63')](_0x73ee('0xa7'),_0x5e21d0[_0x73ee('0x43')],_0x545e69[_0x73ee('0x46')],_0x545e69[_0x73ee('0x4b')],_['keys'](_0x5e21d0[_0x73ee('0xa0')])[0x0],_0x5e21d0['value']);_0x545e69[_0x73ee('0x11')]=this[_0x73ee('0x11')][_0x5e21d0['uniqueid']];}}}}catch(_0x583b79){logger[_0x73ee('0x35')](_0x73ee('0x9c'),_0x5e21d0[_0x73ee('0x43')],util[_0x73ee('0x36')](_0x583b79,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x9d')]=function(_0x44b0c9,_0x29a7b3,_0x198f7f){var _0x1c3a7b=[_0x73ee('0xa8'),_0x73ee('0xa9'),'rtpaudioqosjitter',_0x73ee('0xaa'),_0x73ee('0xab'),_0x73ee('0xac'),_0x73ee('0xad'),_0x73ee('0xae'),_0x73ee('0xaf'),_0x73ee('0xb0'),'bridgepeer',_0x73ee('0xb1'),'membercalls',_0x73ee('0xb2'),_0x73ee('0xb3'),_0x73ee('0xb4'),_0x73ee('0x89'),_0x73ee('0xb5'),_0x73ee('0xb6')];if(!_[_0x73ee('0x30')](_0x29a7b3)&&!_[_0x73ee('0xb7')](_0x1c3a7b,_0x29a7b3)){if(_[_0x73ee('0x5c')](this[_0x73ee('0x11')][_0x44b0c9])){this['variables'][_0x44b0c9]={};}this[_0x73ee('0x11')][_0x44b0c9][_0x29a7b3]=_0x198f7f;}};VoiceQueueReport[_0x73ee('0x9')]['syncHangup']=function(_0x4f11fe){try{if(this['isNotNull'](_0x4f11fe)){logger[_0x73ee('0x40')](_0x73ee('0xb8'),_0x4f11fe[_0x73ee('0x43')],util['inspect'](_0x4f11fe,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4f11fe['uniqueid']]){for(var _0x1d77b0=0x0,_0x5372f6={};_0x1d77b0=0x0?moment(_0x1cd966[_0x9644('0x1a')])[_0x9644('0xf')](_0x1cd966[_0x9644('0x1b')],_0x9644('0x10')):null,'data1':'outbound','data2':_0x1cd966[_0x9644('0x16')],'data3':_0x1cd966[_0x9644('0x13')],'data4':_0x1cd966[_0x9644('0x1c')]||null,'role':_0x9644('0x15'),'internal':_0x1cd966[_0x9644('0x16')]?_[_0x9644('0x17')](_0x1cd966[_0x9644('0x16')]):undefined,'uniqueid':_0x1cd966[_0x9644('0x1d')]},'log':_0x9644('0x6')});}; \ No newline at end of file +var _0x2db7=['inbound','exten','queue','agent','accountcode','toNumber','voiceDialReport','Request','membername','starttime','endtime','outbound','dialstring','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds'];(function(_0x4948a2,_0x2df82b){var _0xf92c72=function(_0x329e6e){while(--_0x329e6e){_0x4948a2['push'](_0x4948a2['shift']());}};_0xf92c72(++_0x2df82b);}(_0x2db7,0x157));var _0x72db=function(_0x54a7ed,_0x53c2a1){_0x54a7ed=_0x54a7ed-0x0;var _0x38ec49=_0x2db7[_0x54a7ed];return _0x38ec49;};'use strict';var moment=require('moment');var _=require(_0x72db('0x0'));var util=require(_0x72db('0x1'));var client=require(_0x72db('0x2'));exports[_0x72db('0x3')]=function(_0x153a80){var _0x1a0613=_0x153a80[_0x72db('0x4')]||_0x153a80[_0x72db('0x5')];return client['Request'](_0x72db('0x6'),{'body':{'channel':_0x72db('0x7'),'membername':_0x153a80['lastAssignedTo'],'interface':_[_0x72db('0x8')](_0x153a80[_0x72db('0x9')])?util[_0x72db('0xa')](_0x72db('0xb'),_0x153a80[_0x72db('0xc')]):_0x153a80[_0x72db('0x9')],'type':_0x72db('0xd'),'enterAt':_0x153a80[_0x72db('0xe')],'exitAt':_0x1a0613,'duration':moment(_0x1a0613)[_0x72db('0xf')](_0x153a80[_0x72db('0xe')],_0x72db('0x10')),'data1':_0x72db('0x11'),'data2':_0x153a80['calleridnum'],'data3':_0x153a80[_0x72db('0x12')],'data4':null,'data5':_0x153a80[_0x72db('0x13')],'role':_0x72db('0x14'),'internal':_0x153a80[_0x72db('0x15')]?_[_0x72db('0x16')](_0x153a80['accountcode']):undefined,'uniqueid':_0x153a80['uniqueid']},'log':_0x72db('0x6')});};exports[_0x72db('0x17')]=function(_0x22f5ad){return client[_0x72db('0x18')](_0x72db('0x6'),{'body':{'channel':_0x72db('0x7'),'membername':_0x22f5ad[_0x72db('0x19')],'interface':_0x22f5ad[_0x72db('0x9')],'type':_0x72db('0xd'),'enterAt':_0x22f5ad[_0x72db('0x1a')],'exitAt':_0x22f5ad['endtime'],'duration':moment(_0x22f5ad['endtime'])[_0x72db('0xf')](_0x22f5ad['starttime'],_0x72db('0x10'))>=0x0?moment(_0x22f5ad[_0x72db('0x1b')])[_0x72db('0xf')](_0x22f5ad[_0x72db('0x1a')],_0x72db('0x10')):null,'data1':_0x72db('0x1c'),'data2':_0x22f5ad[_0x72db('0x15')],'data3':_0x22f5ad[_0x72db('0x12')],'data4':_0x22f5ad[_0x72db('0x1d')]||null,'role':_0x72db('0x14'),'internal':_0x22f5ad[_0x72db('0x15')]?_['toNumber'](_0x22f5ad['accountcode']):undefined,'uniqueid':_0x22f5ad['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 95357e5..a9a5e6d 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 _0x58a4=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x4896c4,_0x34ef36){var _0x2d9312=function(_0x548620){while(--_0x548620){_0x4896c4['push'](_0x4896c4['shift']());}};_0x2d9312(++_0x34ef36);}(_0x58a4,0xbf));var _0x458a=function(_0x470615,_0x1c7aaa){_0x470615=_0x470615-0x0;var _0x189c81=_0x58a4[_0x470615];return _0x189c81;};'use strict';var client=require(_0x458a('0x0'));exports[_0x458a('0x1')]=function(_0x4043ce){return function(_0x1e23ea){return client[_0x458a('0x2')](_0x458a('0x3'),{'options':{'raw':!![],'attributes':['id',_0x458a('0x4'),_0x458a('0x5')]},'log':_0x458a('0x3')});};}; \ No newline at end of file +var _0x74f0=['GetTemplate','name','html','getTemplates','Request'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x74f0,0xf3));var _0x074f=function(_0x35d59c,_0x341ef9){_0x35d59c=_0x35d59c-0x0;var _0x18cd27=_0x74f0[_0x35d59c];return _0x18cd27;};'use strict';var client=require('../client');exports[_0x074f('0x0')]=function(_0x57b681){return function(_0x55d8a0){return client[_0x074f('0x1')](_0x074f('0x2'),{'options':{'raw':!![],'attributes':['id',_0x074f('0x3'),_0x074f('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ed86a7c..9662c9c 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 _0x96d4=['operator','value','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','Request','name','status','Condition','AllConditions','field'];(function(_0x226f1d,_0x2f09f4){var _0x386700=function(_0x22d35f){while(--_0x22d35f){_0x226f1d['push'](_0x226f1d['shift']());}};_0x386700(++_0x2f09f4);}(_0x96d4,0x108));var _0x496d=function(_0xcfb094,_0x3e6258){_0xcfb094=_0xcfb094-0x0;var _0x158a5e=_0x96d4[_0xcfb094];return _0x158a5e;};'use strict';var client=require(_0x496d('0x0'));exports[_0x496d('0x1')]=function(_0x57e1a3){return function(_0x2add8c){return client[_0x496d('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x496d('0x3'),'channel',_0x496d('0x4')],'include':[{'model':_0x496d('0x5'),'as':_0x496d('0x6'),'attributes':['id',_0x496d('0x7'),_0x496d('0x8'),_0x496d('0x9')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x496d('0x7'),_0x496d('0x8'),_0x496d('0x9')]},{'model':'Action','as':'Actions','attributes':['id','action',_0x496d('0xa'),_0x496d('0xb'),_0x496d('0xc'),_0x496d('0xd'),_0x496d('0xe'),_0x496d('0xf'),_0x496d('0x10')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x114c=['channel','status','Condition','AllConditions','field','value','AnyConditions','operator','Action','data1','data3','data5','data6','data7','../client','getTriggers','Request','name'];(function(_0x427c0c,_0xb17e0d){var _0x599e0a=function(_0x461435){while(--_0x461435){_0x427c0c['push'](_0x427c0c['shift']());}};_0x599e0a(++_0xb17e0d);}(_0x114c,0xc2));var _0xc114=function(_0x1bc4de,_0x358405){_0x1bc4de=_0x1bc4de-0x0;var _0xb73fcf=_0x114c[_0x1bc4de];return _0xb73fcf;};'use strict';var client=require(_0xc114('0x0'));exports[_0xc114('0x1')]=function(_0x443c61){return function(_0x4ca783){return client[_0xc114('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xc114('0x3'),_0xc114('0x4'),_0xc114('0x5')],'include':[{'model':_0xc114('0x6'),'as':_0xc114('0x7'),'attributes':['id',_0xc114('0x8'),'operator',_0xc114('0x9')]},{'model':'Condition','as':_0xc114('0xa'),'attributes':['id',_0xc114('0x8'),_0xc114('0xb'),_0xc114('0x9')]},{'model':_0xc114('0xc'),'as':'Actions','attributes':['id','action',_0xc114('0xd'),'data2',_0xc114('0xe'),'data4',_0xc114('0xf'),_0xc114('0x10'),_0xc114('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 43867a0..1c46761 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 _0x8367=['../client','Request','GetTrunk','name','registry'];(function(_0x344eac,_0x3a5e6a){var _0x11a4f5=function(_0x1b4ad0){while(--_0x1b4ad0){_0x344eac['push'](_0x344eac['shift']());}};_0x11a4f5(++_0x3a5e6a);}(_0x8367,0x1ae));var _0x7836=function(_0xa8d025,_0x3a5cbe){_0xa8d025=_0xa8d025-0x0;var _0x29e44e=_0x8367[_0xa8d025];return _0x29e44e;};'use strict';var client=require(_0x7836('0x0'));exports['getTrunks']=function(_0xc33e9){return function(_0x23b0cf){return client[_0x7836('0x1')](_0x7836('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7836('0x3'),_0x7836('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x98ca=['name','../client','getTrunks','Request','GetTrunk'];(function(_0x4bc891,_0x25df64){var _0x5ec79d=function(_0x582730){while(--_0x582730){_0x4bc891['push'](_0x4bc891['shift']());}};_0x5ec79d(++_0x25df64);}(_0x98ca,0x1aa));var _0xa98c=function(_0x4761ed,_0x2c0e06){_0x4761ed=_0x4761ed-0x0;var _0x2f5224=_0x98ca[_0x4761ed];return _0x2f5224;};'use strict';var client=require(_0xa98c('0x0'));exports[_0xa98c('0x1')]=function(_0x41a857){return function(_0x2ad325){return client[_0xa98c('0x2')](_0xa98c('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa98c('0x4'),'registry']},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index f867232..6dd3af4 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 _0xc7dc=['lastLoginAt','pauseType','lastPauseAt','voicePause','phone','interface','getAgents','getTelephones','telephone','savePause','PauseUser','saveUnpause','agent','email','getAgent','../client','Request','GetUser','name','accountcode','fullname','online'];(function(_0x197ed0,_0x4d2080){var _0x380e72=function(_0x3f5a36){while(--_0x3f5a36){_0x197ed0['push'](_0x197ed0['shift']());}};_0x380e72(++_0x4d2080);}(_0xc7dc,0xeb));var _0xcc7d=function(_0x3b5a4a,_0x4096e5){_0x3b5a4a=_0x3b5a4a-0x0;var _0xaaec44=_0xc7dc[_0x3b5a4a];return _0xaaec44;};'use strict';var client=require(_0xcc7d('0x0'));exports['getAgents']=function(){return function(){return client[_0xcc7d('0x1')](_0xcc7d('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0xcc7d('0x3'),'email',_0xcc7d('0x4'),_0xcc7d('0x5'),_0xcc7d('0x6'),_0xcc7d('0x7'),_0xcc7d('0x8'),_0xcc7d('0x9'),_0xcc7d('0xa'),_0xcc7d('0xb'),'mobile',_0xcc7d('0xc')]},'log':_0xcc7d('0xd')});};};exports[_0xcc7d('0xe')]=function(){return function(){return client[_0xcc7d('0x1')](_0xcc7d('0x2'),{'options':{'raw':!![],'where':{'role':_0xcc7d('0xf')},'attributes':['id',_0xcc7d('0x3'),'accountcode','internal']},'log':_0xcc7d('0xe')});};};exports[_0xcc7d('0x10')]=function(_0x21b3ba,_0x4263f1,_0x4bc36e){return client[_0xcc7d('0x1')](_0xcc7d('0x11'),{'body':{'type':_0x4263f1,'uniqueid':_0x4bc36e},'options':{'where':{'id':_0x21b3ba['id']}},'log':'savePause'});};exports[_0xcc7d('0x12')]=function(_0x4db744){return client[_0xcc7d('0x1')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x4db744['id']}},'log':'savePause'});};exports['getAgent']=function(_0x4dcc2e){return client[_0xcc7d('0x1')]('ShowUser',{'options':{'raw':![],'where':{'role':_0xcc7d('0x13'),'id':_0x4dcc2e},'attributes':['id',_0xcc7d('0x3'),_0xcc7d('0x14'),_0xcc7d('0x4'),_0xcc7d('0x5'),'online','lastLoginAt',_0xcc7d('0x8'),_0xcc7d('0x9'),_0xcc7d('0xa'),_0xcc7d('0xc')]},'log':_0xcc7d('0x15')});}; \ No newline at end of file +var _0x6755=['fullname','lastPauseAt','voicePause','phone','mobile','getTelephones','telephone','name','savePause','saveUnpause','UnpauseUser','ShowUser','online','lastLoginAt','pauseType','interface','getAgent','../client','getAgents','Request','GetUser','agent','email'];(function(_0x74fbf2,_0x3983bc){var _0x2dc6d7=function(_0xd675b){while(--_0xd675b){_0x74fbf2['push'](_0x74fbf2['shift']());}};_0x2dc6d7(++_0x3983bc);}(_0x6755,0xe0));var _0x5675=function(_0x24bdff,_0x23511d){_0x24bdff=_0x24bdff-0x0;var _0x757096=_0x6755[_0x24bdff];return _0x757096;};'use strict';var client=require(_0x5675('0x0'));exports[_0x5675('0x1')]=function(){return function(){return client[_0x5675('0x2')](_0x5675('0x3'),{'options':{'raw':![],'where':{'role':_0x5675('0x4')},'attributes':['id','name',_0x5675('0x5'),'accountcode',_0x5675('0x6'),'online','lastLoginAt','pauseType',_0x5675('0x7'),_0x5675('0x8'),_0x5675('0x9'),_0x5675('0xa'),'interface']},'log':_0x5675('0x1')});};};exports[_0x5675('0xb')]=function(){return function(){return client[_0x5675('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x5675('0xc')},'attributes':['id',_0x5675('0xd'),'accountcode','internal']},'log':_0x5675('0xb')});};};exports[_0x5675('0xe')]=function(_0x581cce,_0x5c0de0,_0x1dc3b1){return client['Request']('PauseUser',{'body':{'type':_0x5c0de0,'uniqueid':_0x1dc3b1},'options':{'where':{'id':_0x581cce['id']}},'log':_0x5675('0xe')});};exports[_0x5675('0xf')]=function(_0x597feb){return client[_0x5675('0x2')](_0x5675('0x10'),{'body':{},'options':{'where':{'id':_0x597feb['id']}},'log':_0x5675('0xe')});};exports['getAgent']=function(_0x2d08db){return client[_0x5675('0x2')](_0x5675('0x11'),{'options':{'raw':![],'where':{'role':_0x5675('0x4'),'id':_0x2d08db},'attributes':['id',_0x5675('0xd'),'email','accountcode','fullname',_0x5675('0x12'),_0x5675('0x13'),_0x5675('0x14'),_0x5675('0x7'),_0x5675('0x8'),_0x5675('0x15')]},'log':_0x5675('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index e139165..2f9bdbe 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 _0x85b5=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x5d6052,_0x1be6e9){var _0x28743f=function(_0x3f00af){while(--_0x3f00af){_0x5d6052['push'](_0x5d6052['shift']());}};_0x28743f(++_0x1be6e9);}(_0x85b5,0x7f));var _0x585b=function(_0x1c5bee,_0x232ef4){_0x1c5bee=_0x1c5bee-0x0;var _0x52c6f0=_0x85b5[_0x1c5bee];return _0x52c6f0;};'use strict';var client=require(_0x585b('0x0'));exports[_0x585b('0x1')]=function(_0x4df8b9){return client[_0x585b('0x2')]('CreateVoiceAgentReport',{'body':_0x4df8b9,'log':_0x585b('0x3')});};exports['update']=function(_0x4d5064,_0x331fe8,_0x4f37a9){return client[_0x585b('0x2')](_0x585b('0x4'),{'body':_0x4d5064,'options':{'where':{'uniqueid':_0x331fe8,'interface':_0x4f37a9,'agentcomplete':!![]}},'log':_0x585b('0x4')});}; \ No newline at end of file +var _0xdc32=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x53fd59,_0x18e8a4){var _0x288282=function(_0x524776){while(--_0x524776){_0x53fd59['push'](_0x53fd59['shift']());}};_0x288282(++_0x18e8a4);}(_0xdc32,0x149));var _0x2dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc32[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x2dc3('0x0'));exports[_0x2dc3('0x1')]=function(_0x56d3a1){return client[_0x2dc3('0x2')](_0x2dc3('0x3'),{'body':_0x56d3a1,'log':_0x2dc3('0x3')});};exports[_0x2dc3('0x4')]=function(_0x47a833,_0x2823a1,_0x5222a7){return client['Request'](_0x2dc3('0x5'),{'body':_0x47a833,'options':{'where':{'uniqueid':_0x2823a1,'interface':_0x5222a7,'agentcomplete':!![]}},'log':_0x2dc3('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index c71ec2d..a6a1bdc 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 _0x4509=['moment','util','lodash','Request','CreateVoiceCallReport','merge','callerid','DOCUMENTATION','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds'];(function(_0x4bf7f2,_0x123a78){var _0x329e1b=function(_0x1a74b2){while(--_0x1a74b2){_0x4bf7f2['push'](_0x4bf7f2['shift']());}};_0x329e1b(++_0x123a78);}(_0x4509,0x170));var _0x9450=function(_0x245e9c,_0xeab8e9){_0x245e9c=_0x245e9c-0x0;var _0x358ccf=_0x4509[_0x245e9c];return _0x358ccf;};'use strict';var moment=require(_0x9450('0x0'));var util=require(_0x9450('0x1'));var _=require(_0x9450('0x2'));var client=require('../client');exports['create']=function(_0x394bf0){return client[_0x9450('0x3')](_0x9450('0x4'),{'body':_[_0x9450('0x5')](_0x394bf0,{'source':_0x394bf0['calleridnum'],'destinationcontext':_0x394bf0['context'],'callerid':_0x394bf0[_0x9450('0x6')],'amaflags':_0x9450('0x7')}),'log':_0x9450('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x9450('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x9450('0x8')](_0x9450('0x9'))[_0x9450('0xa')](_0x9450('0xb')),moment()[_0x9450('0xc')](_0x9450('0x9'))[_0x9450('0xa')](_0x9450('0xb'))]}},'attributes':['type',_0x9450('0xd'),_0x9450('0xe'),_0x9450('0xf')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xb302=['create','Request','CreateVoiceCallReport','merge','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','format','YYYY-MM-DD\x20HH:mm:ss','day','disposition','duration','util','lodash','../client'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb302,0x140));var _0x2b30=function(_0x927c6d,_0x3d9062){_0x927c6d=_0x927c6d-0x0;var _0x891028=_0xb302[_0x927c6d];return _0x891028;};'use strict';var moment=require('moment');var util=require(_0x2b30('0x0'));var _=require(_0x2b30('0x1'));var client=require(_0x2b30('0x2'));exports[_0x2b30('0x3')]=function(_0x3030b0){return client[_0x2b30('0x4')](_0x2b30('0x5'),{'body':_[_0x2b30('0x6')](_0x3030b0,{'source':_0x3030b0['calleridnum'],'destinationcontext':_0x3030b0[_0x2b30('0x7')],'callerid':_0x3030b0[_0x2b30('0x8')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x2b30('0x9')]=function(){return function(){return client[_0x2b30('0x4')](_0x2b30('0xa'),{'options':{'where':{'type':[_0x2b30('0xb')],'createdAt':{'$between':[moment()['startOf']('day')[_0x2b30('0xc')](_0x2b30('0xd')),moment()['endOf'](_0x2b30('0xe'))[_0x2b30('0xc')](_0x2b30('0xd'))]}},'attributes':['type',_0x2b30('0xf'),_0x2b30('0x10'),'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 327690a..619506b 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 _0xbe6d=['CreateVoiceDialReport','../client','create','Request'];(function(_0x171033,_0x2e022d){var _0x79ee76=function(_0x500e5c){while(--_0x500e5c){_0x171033['push'](_0x171033['shift']());}};_0x79ee76(++_0x2e022d);}(_0xbe6d,0xc9));var _0xdbe6=function(_0x268857,_0x58a836){_0x268857=_0x268857-0x0;var _0x21b1a2=_0xbe6d[_0x268857];return _0x21b1a2;};'use strict';var client=require(_0xdbe6('0x0'));exports[_0xdbe6('0x1')]=function(_0x572a7e){return client[_0xdbe6('0x2')](_0xdbe6('0x3'),{'body':_0x572a7e,'log':_0xdbe6('0x3')});}; \ No newline at end of file +var _0xc8f2=['CreateVoiceDialReport','create'];(function(_0x3aa595,_0x2a6075){var _0x55c560=function(_0x9d0474){while(--_0x9d0474){_0x3aa595['push'](_0x3aa595['shift']());}};_0x55c560(++_0x2a6075);}(_0xc8f2,0x10b));var _0x2c8f=function(_0x3bc47a,_0xeb4400){_0x3bc47a=_0x3bc47a-0x0;var _0x4b542f=_0xc8f2[_0x3bc47a];return _0x4b542f;};'use strict';var client=require('../client');exports[_0x2c8f('0x0')]=function(_0x446e28){return client['Request'](_0x2c8f('0x1'),{'body':_0x446e28,'log':_0x2c8f('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 7da5aad..e23d0b9 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 _0x9649=['../client','getVoiceExtensions','GetVoiceExtension','exten','recordingFormat'];(function(_0x559084,_0x10053f){var _0x29e0f6=function(_0x3d4f34){while(--_0x3d4f34){_0x559084['push'](_0x559084['shift']());}};_0x29e0f6(++_0x10053f);}(_0x9649,0x118));var _0x9964=function(_0x218d4d,_0x10cc35){_0x218d4d=_0x218d4d-0x0;var _0x466019=_0x9649[_0x218d4d];return _0x466019;};'use strict';var client=require(_0x9964('0x0'));exports[_0x9964('0x1')]=function(){return function(){return client['Request'](_0x9964('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9964('0x3'),_0x9964('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x66d3=['Request','exten','recordingFormat','../client'];(function(_0x3f553b,_0x49a9c2){var _0x183c4e=function(_0x873b22){while(--_0x873b22){_0x3f553b['push'](_0x3f553b['shift']());}};_0x183c4e(++_0x49a9c2);}(_0x66d3,0x10f));var _0x366d=function(_0x1c22f0,_0x418bbe){_0x1c22f0=_0x1c22f0-0x0;var _0x1fc8f7=_0x66d3[_0x1c22f0];return _0x1fc8f7;};'use strict';var client=require(_0x366d('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x366d('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x366d('0x2'),_0x366d('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 1626650..c867625 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 _0xdbb1=['dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive'];(function(_0x460740,_0x428a68){var _0x51bba1=function(_0x485c99){while(--_0x485c99){_0x460740['push'](_0x460740['shift']());}};_0x51bba1(++_0x428a68);}(_0xdbb1,0xb3));var _0x1dbb=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xdbb1[_0x33032e];return _0x13316b;};'use strict';var client=require(_0x1dbb('0x0'));exports[_0x1dbb('0x1')]=function(){return function(){return client[_0x1dbb('0x2')](_0x1dbb('0x3'),{'options':{'raw':![],'attributes':['id',_0x1dbb('0x4'),'acw',_0x1dbb('0x5'),_0x1dbb('0x6'),_0x1dbb('0x7'),_0x1dbb('0x8'),_0x1dbb('0x9'),_0x1dbb('0xa'),_0x1dbb('0xb'),_0x1dbb('0xc'),'dialPowerLevel',_0x1dbb('0xd'),_0x1dbb('0xe'),_0x1dbb('0xf'),_0x1dbb('0x10'),_0x1dbb('0x11'),'dialOriginateTimeout',_0x1dbb('0x12'),'dialQueueTimeout','dialQueueProject',_0x1dbb('0x13'),_0x1dbb('0x14'),_0x1dbb('0x15'),_0x1dbb('0x16'),_0x1dbb('0x17'),_0x1dbb('0x18'),_0x1dbb('0x19'),_0x1dbb('0x1a'),_0x1dbb('0x1b'),_0x1dbb('0x1c'),_0x1dbb('0x1d'),'dialAMDActive',_0x1dbb('0x1e'),_0x1dbb('0x1f'),_0x1dbb('0x20'),_0x1dbb('0x21'),_0x1dbb('0x22'),_0x1dbb('0x23'),_0x1dbb('0x24'),_0x1dbb('0x25'),'dialAMDMaximumWordLength','timeout',_0x1dbb('0x26'),'dialRecallInQueue',_0x1dbb('0x27'),'dialAgiAfterHangupAgent',_0x1dbb('0x28'),'dialQueueProject2',_0x1dbb('0x7'),_0x1dbb('0x29'),_0x1dbb('0x2a'),_0x1dbb('0x2b'),_0x1dbb('0x2c'),_0x1dbb('0x2d'),_0x1dbb('0x2e'),_0x1dbb('0x2f'),_0x1dbb('0x30'),_0x1dbb('0x31'),_0x1dbb('0x32'),_0x1dbb('0x33'),_0x1dbb('0x34'),_0x1dbb('0x35'),'mandatoryDisposition',_0x1dbb('0x36'),_0x1dbb('0x37')],'include':[{'model':_0x1dbb('0x38'),'as':_0x1dbb('0x38'),'attributes':['id',_0x1dbb('0x4'),_0x1dbb('0x39'),_0x1dbb('0x3a')]},{'model':'Pause','as':_0x1dbb('0x3b'),'attributes':['id',_0x1dbb('0x4')]},{'model':_0x1dbb('0x38'),'as':_0x1dbb('0x3c'),'attributes':['id',_0x1dbb('0x4'),_0x1dbb('0x39'),_0x1dbb('0x3a')]},{'model':_0x1dbb('0x3d'),'as':_0x1dbb('0x3d'),'attributes':['id',_0x1dbb('0x4')],'include':[{'model':_0x1dbb('0x3d'),'as':'Intervals','attributes':['id',_0x1dbb('0x4'),_0x1dbb('0x3e')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x2795=['dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout','dialQueueOptions','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_0x2795,0xcc));var _0x5279=function(_0x3dace9,_0x787d10){_0x3dace9=_0x3dace9-0x0;var _0x2f71a5=_0x2795[_0x3dace9];return _0x2f71a5;};'use strict';var client=require(_0x5279('0x0'));exports[_0x5279('0x1')]=function(){return function(){return client[_0x5279('0x2')](_0x5279('0x3'),{'options':{'raw':![],'attributes':['id',_0x5279('0x4'),_0x5279('0x5'),_0x5279('0x6'),'autopause',_0x5279('0x7'),_0x5279('0x8'),_0x5279('0x9'),_0x5279('0xa'),'dialLimitChannel',_0x5279('0xb'),_0x5279('0xc'),_0x5279('0xd'),_0x5279('0xe'),_0x5279('0xf'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x5279('0x10'),_0x5279('0x11'),'dialQueueTimeout','dialQueueProject',_0x5279('0x12'),'dialCongestionRetryFrequency',_0x5279('0x13'),_0x5279('0x14'),_0x5279('0x15'),_0x5279('0x16'),_0x5279('0x17'),'dialTimezone','dialGlobalInterval',_0x5279('0x18'),'dialCheckDuplicateType','dialAMDActive',_0x5279('0x19'),_0x5279('0x1a'),_0x5279('0x1b'),_0x5279('0x1c'),_0x5279('0x1d'),'dialAMDBetweenWordsSilence',_0x5279('0x1e'),_0x5279('0x1f'),'dialAMDMaximumWordLength','timeout',_0x5279('0x20'),_0x5279('0x21'),_0x5279('0x22'),_0x5279('0x23'),_0x5279('0x24'),_0x5279('0x25'),'monitor_format',_0x5279('0x26'),_0x5279('0x27'),_0x5279('0x28'),_0x5279('0x29'),_0x5279('0x2a'),_0x5279('0x2b'),_0x5279('0x2c'),_0x5279('0x2d'),_0x5279('0x2e'),_0x5279('0x2f'),_0x5279('0x30'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x5279('0x31'),'dialPredictiveIntervalMaxThreshold',_0x5279('0x32')],'include':[{'model':_0x5279('0x33'),'as':_0x5279('0x33'),'attributes':['id',_0x5279('0x4'),_0x5279('0x34'),'active']},{'model':_0x5279('0x35'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0x5279('0x4'),'callerid','active']},{'model':'Interval','as':_0x5279('0x36'),'attributes':['id',_0x5279('0x4')],'include':[{'model':_0x5279('0x36'),'as':_0x5279('0x37'),'attributes':['id',_0x5279('0x4'),_0x5279('0x38')]}]}]},'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 8378328..9e95ce8 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 _0xb044=['getVoiceQueueReports','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','lodash','create','Request','CreateVoiceQueueReport'];(function(_0x4ec612,_0x57dfd6){var _0x52a015=function(_0x2771d1){while(--_0x2771d1){_0x4ec612['push'](_0x4ec612['shift']());}};_0x52a015(++_0x57dfd6);}(_0xb044,0x74));var _0x4b04=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb044[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var _=require(_0x4b04('0x0'));var client=require('../client');exports[_0x4b04('0x1')]=function(_0x2d0644){return client[_0x4b04('0x2')](_0x4b04('0x3'),{'body':_0x2d0644,'log':_0x4b04('0x3')});};exports[_0x4b04('0x4')]=function(){return function(){return client[_0x4b04('0x2')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x4b04('0x5')](_0x4b04('0x6'))[_0x4b04('0x7')](_0x4b04('0x8')),moment()['endOf'](_0x4b04('0x6'))[_0x4b04('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x4b04('0x9'),_0x4b04('0xa'),_0x4b04('0xb'),_0x4b04('0xc'),_0x4b04('0xd'),_0x4b04('0xe'),_0x4b04('0xf'),_0x4b04('0x10'),_0x4b04('0x11'),_0x4b04('0x12')]},'log':_0x4b04('0x13')});};}; \ No newline at end of file +var _0x78ea=['GetVoiceQueueReports','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','uniqueid','queuecallerjoinAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x78ea,0x161));var _0xa78e=function(_0x4c7310,_0x5307de){_0x4c7310=_0x4c7310-0x0;var _0x2b68d4=_0x78ea[_0x4c7310];return _0x2b68d4;};'use strict';var moment=require(_0xa78e('0x0'));var _=require(_0xa78e('0x1'));var client=require(_0xa78e('0x2'));exports['create']=function(_0x2141e0){return client[_0xa78e('0x3')](_0xa78e('0x4'),{'body':_0x2141e0,'log':_0xa78e('0x4')});};exports[_0xa78e('0x5')]=function(){return function(){return client['Request'](_0xa78e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xa78e('0x7')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')[_0xa78e('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xa78e('0x9'),'queue',_0xa78e('0xa'),'queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt',_0xa78e('0xb'),_0xa78e('0xc'),_0xa78e('0xd'),_0xa78e('0xe')]},'log':_0xa78e('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index c7272c2..7873270 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 _0xf94a=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x3d2012,_0x3d02b9){var _0x53d542=function(_0x8f2be8){while(--_0x8f2be8){_0x3d2012['push'](_0x3d2012['shift']());}};_0x53d542(++_0x3d02b9);}(_0xf94a,0x1cd));var _0xaf94=function(_0x2dbbe5,_0x5010e8){_0x2dbbe5=_0x2dbbe5-0x0;var _0x2c5d65=_0xf94a[_0x2dbbe5];return _0x2c5d65;};'use strict';var client=require('../client');exports[_0xaf94('0x0')]=function(_0x1875e8){return function(){return client[_0xaf94('0x1')](_0xaf94('0x2'),{'options':{'where':{'VoiceQueueId':_0x1875e8,'paused':!![]},'raw':!![]},'log':_0xaf94('0x0')});};}; \ No newline at end of file +var _0x6b7f=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x6b7f,0x17b));var _0xf6b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b7f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf6b7('0x0'));exports[_0xf6b7('0x1')]=function(_0x379ffe){return function(){return client['Request'](_0xf6b7('0x2'),{'options':{'where':{'VoiceQueueId':_0x379ffe,'paused':!![]},'raw':!![]},'log':_0xf6b7('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 95979a9..cb07a35 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 _0xf614=['../client','Request','merge','monitorFilename','lodash'];(function(_0x1839fe,_0x3e6c3f){var _0x4ade79=function(_0x4ab05e){while(--_0x4ab05e){_0x1839fe['push'](_0x1839fe['shift']());}};_0x4ade79(++_0x3e6c3f);}(_0xf614,0xa4));var _0x4f61=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0xf614[_0x55a89e];return _0x3aa2bd;};'use strict';var _=require(_0x4f61('0x0'));var client=require(_0x4f61('0x1'));exports['create']=function(_0x5a198b){return client[_0x4f61('0x2')]('CreateVoiceRecording',{'body':_[_0x4f61('0x3')](_0x5a198b,{'value':_0x5a198b[_0x4f61('0x4')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0xa565=['../client','Request','CreateVoiceRecording','merge','monitorFilename','lodash'];(function(_0x259d6b,_0x2efc49){var _0x5e3636=function(_0x15c8d6){while(--_0x15c8d6){_0x259d6b['push'](_0x259d6b['shift']());}};_0x5e3636(++_0x2efc49);}(_0xa565,0xe3));var _0x5a56=function(_0xa06f69,_0x5368a3){_0xa06f69=_0xa06f69-0x0;var _0x2de671=_0xa565[_0xa06f69];return _0x2de671;};'use strict';var _=require(_0x5a56('0x0'));var client=require(_0x5a56('0x1'));exports['create']=function(_0x2f1ff6){return client[_0x5a56('0x2')](_0x5a56('0x3'),{'body':_[_0x5a56('0x4')](_0x2f1ff6,{'value':_0x2f1ff6[_0x5a56('0x5')]}),'log':_0x5a56('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 1251913..d7d5227 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 _0x9216=['attended','../client','blindTransfer','Request','CreateVoiceTransferReport','transfereraccountcode','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereecontext','transfereeexten','transfereelinkedid','context','blind','result','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','isexternal','origtransferercontext','origtransfererexten'];(function(_0x3b6c59,_0x10c316){var _0x6d60c8=function(_0x4c38f9){while(--_0x4c38f9){_0x3b6c59['push'](_0x3b6c59['shift']());}};_0x6d60c8(++_0x10c316);}(_0x9216,0x175));var _0x6921=function(_0xb7e28a,_0x5cf4be){_0xb7e28a=_0xb7e28a-0x0;var _0x369be6=_0x9216[_0xb7e28a];return _0x369be6;};'use strict';var client=require(_0x6921('0x0'));exports['transfers']={};exports[_0x6921('0x1')]=function(_0x396574){return client[_0x6921('0x2')](_0x6921('0x3'),{'body':{'result':_0x396574['result'],'transfererchannel':_0x396574['transfererchannel'],'transferercalleridnum':_0x396574['transferercalleridnum'],'transferercalleridname':_0x396574['transferercalleridname'],'transfererconnectedlinenum':_0x396574['transfererconnectedlinenum'],'transfererconnectedlinename':_0x396574['transfererconnectedlinename'],'transfereraccountcode':_0x396574[_0x6921('0x4')],'transferercontext':_0x396574['transferercontext'],'transfererexten':_0x396574[_0x6921('0x5')],'transfererlinkedid':_0x396574[_0x6921('0x6')],'transfereechannel':_0x396574['transfereechannel'],'transfereecalleridnum':_0x396574[_0x6921('0x7')],'transfereecalleridname':_0x396574[_0x6921('0x8')],'transfereeconnectedlinenum':_0x396574['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x396574['transfereeconnectedlinename'],'transfereeaccountcode':_0x396574['transfereeaccountcode'],'transfereecontext':_0x396574[_0x6921('0x9')],'transfereeexten':_0x396574[_0x6921('0xa')],'transfereelinkedid':_0x396574[_0x6921('0xb')],'isexternal':_0x396574['isexternal'],'context':_0x396574[_0x6921('0xc')],'extension':_0x396574['extension'],'type':_0x6921('0xd')},'log':_0x6921('0x3')});};exports['attendedTransfer']=function(_0x3affd7){return client[_0x6921('0x2')](_0x6921('0x3'),{'body':{'result':_0x3affd7[_0x6921('0xe')],'transfererchannel':_0x3affd7['origtransfererchannel'],'transferercalleridnum':_0x3affd7[_0x6921('0xf')],'transferercalleridname':_0x3affd7['origtransferercalleridname'],'transfererconnectedlinenum':_0x3affd7[_0x6921('0x10')],'transfererconnectedlinename':_0x3affd7[_0x6921('0x11')],'transfereraccountcode':_0x3affd7[_0x6921('0x12')],'transferercontext':_0x3affd7[_0x6921('0x13')],'transfererexten':_0x3affd7[_0x6921('0x14')],'transfererlinkedid':_0x3affd7[_0x6921('0x15')],'transfereechannel':_0x3affd7[_0x6921('0x16')],'transfereecalleridnum':_0x3affd7['transfertargetcalleridnum'],'transfereecalleridname':_0x3affd7[_0x6921('0x17')],'transfereeconnectedlinenum':_0x3affd7[_0x6921('0x18')],'transfereeconnectedlinename':_0x3affd7[_0x6921('0x19')],'transfereeaccountcode':_0x3affd7['transfertargetaccountcode'],'transfereecontext':_0x3affd7['transfertargetcontext'],'transfereeexten':_0x3affd7[_0x6921('0x1a')],'transfereelinkedid':_0x3affd7['transfertargetlinkedid'],'isexternal':_0x3affd7[_0x6921('0x1b')],'context':_0x3affd7[_0x6921('0x1c')],'extension':_0x3affd7[_0x6921('0x1d')],'type':_0x6921('0x1e')},'log':_0x6921('0x3')});}; \ No newline at end of file +var _0xa688=['result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','attendedTransfer','origtransfererchannel','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport'];(function(_0x2e2eab,_0x2e609a){var _0x2357bc=function(_0x2235ad){while(--_0x2235ad){_0x2e2eab['push'](_0x2e2eab['shift']());}};_0x2357bc(++_0x2e609a);}(_0xa688,0x1f4));var _0x8a68=function(_0xf58718,_0x33541a){_0xf58718=_0xf58718-0x0;var _0x5aea10=_0xa688[_0xf58718];return _0x5aea10;};'use strict';var client=require('../client');exports[_0x8a68('0x0')]={};exports[_0x8a68('0x1')]=function(_0x14201d){return client[_0x8a68('0x2')](_0x8a68('0x3'),{'body':{'result':_0x14201d[_0x8a68('0x4')],'transfererchannel':_0x14201d[_0x8a68('0x5')],'transferercalleridnum':_0x14201d[_0x8a68('0x6')],'transferercalleridname':_0x14201d['transferercalleridname'],'transfererconnectedlinenum':_0x14201d[_0x8a68('0x7')],'transfererconnectedlinename':_0x14201d[_0x8a68('0x8')],'transfereraccountcode':_0x14201d['transfereraccountcode'],'transferercontext':_0x14201d[_0x8a68('0x9')],'transfererexten':_0x14201d[_0x8a68('0xa')],'transfererlinkedid':_0x14201d[_0x8a68('0xb')],'transfereechannel':_0x14201d[_0x8a68('0xc')],'transfereecalleridnum':_0x14201d[_0x8a68('0xd')],'transfereecalleridname':_0x14201d['transfereecalleridname'],'transfereeconnectedlinenum':_0x14201d['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x14201d[_0x8a68('0xe')],'transfereeaccountcode':_0x14201d[_0x8a68('0xf')],'transfereecontext':_0x14201d[_0x8a68('0x10')],'transfereeexten':_0x14201d['transfereeexten'],'transfereelinkedid':_0x14201d[_0x8a68('0x11')],'isexternal':_0x14201d[_0x8a68('0x12')],'context':_0x14201d[_0x8a68('0x13')],'extension':_0x14201d['extension'],'type':'blind'},'log':_0x8a68('0x3')});};exports[_0x8a68('0x14')]=function(_0x2264e0){return client[_0x8a68('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x2264e0[_0x8a68('0x4')],'transfererchannel':_0x2264e0[_0x8a68('0x15')],'transferercalleridnum':_0x2264e0['origtransferercalleridnum'],'transferercalleridname':_0x2264e0[_0x8a68('0x16')],'transfererconnectedlinenum':_0x2264e0['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2264e0['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2264e0[_0x8a68('0x17')],'transferercontext':_0x2264e0[_0x8a68('0x18')],'transfererexten':_0x2264e0[_0x8a68('0x19')],'transfererlinkedid':_0x2264e0[_0x8a68('0x1a')],'transfereechannel':_0x2264e0['transfertargetchannel'],'transfereecalleridnum':_0x2264e0[_0x8a68('0x1b')],'transfereecalleridname':_0x2264e0[_0x8a68('0x1c')],'transfereeconnectedlinenum':_0x2264e0[_0x8a68('0x1d')],'transfereeconnectedlinename':_0x2264e0['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2264e0[_0x8a68('0x1e')],'transfereecontext':_0x2264e0[_0x8a68('0x1f')],'transfereeexten':_0x2264e0[_0x8a68('0x20')],'transfereelinkedid':_0x2264e0[_0x8a68('0x21')],'isexternal':_0x2264e0[_0x8a68('0x12')],'context':_0x2264e0['origtransferercontext'],'extension':_0x2264e0[_0x8a68('0x22')],'type':_0x8a68('0x23')},'log':_0x8a68('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 1353096..80b7495 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 _0xbbe3=['monitors','stop','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','telephones','trunks','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','checkAfterSend','server','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','format','%s/%s','name','timers','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','answered','available','loggedIn','pTalking','sumBillable','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','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','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','values','channels','voicechannel','map','find','uniqueid','channel','%s.%s','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','push','rec','mixmonitorid','status','toLowerCase','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','filename','wav'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbbe3,0x1b1));var _0x3bbe=function(_0x4797b7,_0x22cd77){_0x4797b7=_0x4797b7-0x0;var _0x41f40c=_0xbbe3[_0x4797b7];return _0x41f40c;};'use strict';var _=require(_0x3bbe('0x0'));var util=require(_0x3bbe('0x1'));var jayson=require(_0x3bbe('0x2'));var schema=require(_0x3bbe('0x3'));var BPromise=require(_0x3bbe('0x4'));var moment=require('moment');var config=require(_0x3bbe('0x5'));var properties=require(_0x3bbe('0x6'));var ami=require('../ami');exports['listen']=function(_0x41a958,_0x1257c2,_0x559c21){return new BPromise(function(_0x3e8ee1,_0x4d1430){var _0x4fee0c={'QueuePause':function(_0x127ee7){return new Promise(function(_0x30e943,_0x5819aa){var _0x272f46=util[_0x3bbe('0x7')](_0x3bbe('0x8'),'SIP',_0x127ee7[_0x3bbe('0x9')]);if(_0x41a958[_0x3bbe('0xa')]&&_0x41a958[_0x3bbe('0xa')][_0x272f46]&&_0x41a958[_0x3bbe('0xa')][_0x272f46]['timer']){_0x41a958[_0x3bbe('0xa')][_0x272f46][_0x3bbe('0xb')]();}if(_0x41a958['agents'][_0x272f46]){_0x41a958[_0x3bbe('0xc')][_0x272f46][_0x3bbe('0xd')]({'statePause':_0x127ee7['pause']?!![]:![]});}_0x30e943({'code':0xc8,'message':_0x3bbe('0xe')});});},'Reload':function(_0x3e9382){var _0x1a1f77=this;return new Promise(function(_0x12c06d,_0xf70be){if(ami[_0x3bbe('0xf')]()==![]){return _0xf70be(_0x1a1f77[_0x3bbe('0x10')](0x1f4,[config[_0x3bbe('0x11')]['ip'],config[_0x3bbe('0x11')][_0x3bbe('0x12')],_0x3bbe('0x13')][_0x3bbe('0x14')]('\x20')));}_0x3e9382=_[_0x3bbe('0x15')](_0x3e9382,_[_0x3bbe('0x16')](properties[_0x3bbe('0x17')]));_0x3e9382[_0x3bbe('0x18')]=_0x3bbe('0x19');return ami[_0x3bbe('0x1a')](_0x3e9382)[_0x3bbe('0x1b')](function(_0x1ffdfe){_0x12c06d({'code':0xc8,'message':_0x1ffdfe[_0x3bbe('0x1c')]});})[_0x3bbe('0x1d')](function(_0x5aafb1){_0xf70be(_0x1a1f77[_0x3bbe('0x10')](0x1f5,_0x5aafb1[_0x3bbe('0x1c')]));});});},'Command':function(_0x573285){var _0x19147b=this;return new Promise(function(_0x3f92cf,_0x598a58){if(ami['isConnected']()==![]){return _0x598a58(_0x19147b[_0x3bbe('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x3bbe('0x11')][_0x3bbe('0x12')],_0x3bbe('0x13')][_0x3bbe('0x14')]('\x20')));}_0x573285=_[_0x3bbe('0x15')](_0x573285,_0x3bbe('0x1e'));_0x573285[_0x3bbe('0x18')]=_0x3bbe('0x1f');return ami[_0x3bbe('0x1a')](_0x573285)[_0x3bbe('0x1b')](function(_0x168e48){_0x3f92cf({'code':0xc8,'message':_0x168e48[_0x3bbe('0x20')]});})[_0x3bbe('0x1d')](function(_0x349ea7){_0x598a58(_0x19147b[_0x3bbe('0x10')](0x1f5,_0x349ea7['message']));});});},'VoiceQueues':function(_0x3e88fe){return new Promise(function(_0x4cf416,_0x59b53f){var _0x54719a=[];for(var _0x194671 in _0x41a958[_0x3bbe('0x21')]){if(_0x41a958[_0x3bbe('0x21')]['hasOwnProperty'](_0x194671)){var _0x1d16f8=_0x41a958[_0x3bbe('0x21')][_0x194671];var _0x1ea40f={'id':_0x1d16f8['id'],'name':_0x1d16f8[_0x3bbe('0x9')],'strategy':_0x1d16f8['strategy'],'answered':_0x1d16f8[_0x3bbe('0x22')],'available':_0x1d16f8[_0x3bbe('0x23')],'loggedIn':_0x1d16f8[_0x3bbe('0x24')],'pTalking':_0x1d16f8[_0x3bbe('0x25')],'sumBillable':_0x1d16f8[_0x3bbe('0x26')],'sumDuration':_0x1d16f8['sumDuration'],'sumHoldTime':_0x1d16f8['sumHoldTime']||0x0,'talking':_0x1d16f8[_0x3bbe('0x27')],'total':_0x1d16f8[_0x3bbe('0x28')],'type':_0x1d16f8[_0x3bbe('0x29')],'unmanaged':_0x1d16f8[_0x3bbe('0x2a')],'abandoned':_0x1d16f8[_0x3bbe('0x2b')],'waiting':_0x1d16f8[_0x3bbe('0x2c')],'loggedInDb':_0x1d16f8[_0x3bbe('0x2d')]};if(_0x1d16f8[_0x3bbe('0x29')]==='outbound'){_0x1ea40f['dialActive']=_0x1d16f8['dialActive'];_0x1ea40f[_0x3bbe('0x2e')]=_0x1d16f8['dialMethod'];_0x1ea40f[_0x3bbe('0x2f')]=_0x1d16f8[_0x3bbe('0x2f')];_0x1ea40f[_0x3bbe('0x30')]=_0x1d16f8[_0x3bbe('0x30')];_0x1ea40f[_0x3bbe('0x31')]=_0x1d16f8[_0x3bbe('0x31')];_0x1ea40f[_0x3bbe('0x32')]=_0x1d16f8[_0x3bbe('0x32')];_0x1ea40f[_0x3bbe('0x33')]=_0x1d16f8[_0x3bbe('0x33')];_0x1ea40f[_0x3bbe('0x34')]=_0x1d16f8['outboundAnswerCallsDay'];_0x1ea40f[_0x3bbe('0x35')]=_0x1d16f8[_0x3bbe('0x35')];_0x1ea40f[_0x3bbe('0x36')]=_0x1d16f8[_0x3bbe('0x36')];_0x1ea40f[_0x3bbe('0x37')]=_0x1d16f8['outboundCongestionCallsDay'];_0x1ea40f[_0x3bbe('0x38')]=_0x1d16f8['outboundDropCallsDayACS'];_0x1ea40f[_0x3bbe('0x39')]=_0x1d16f8[_0x3bbe('0x39')];_0x1ea40f['outboundDropCallsDayTimeout']=_0x1d16f8[_0x3bbe('0x3a')];_0x1ea40f[_0x3bbe('0x3b')]=_0x1d16f8[_0x3bbe('0x3b')];_0x1ea40f['outboundNoSuchCallsDay']=_0x1d16f8[_0x3bbe('0x3c')];_0x1ea40f[_0x3bbe('0x3d')]=_0x1d16f8[_0x3bbe('0x3d')];_0x1ea40f['outboundReCallsDay']=_0x1d16f8[_0x3bbe('0x3e')];_0x1ea40f['outboundRejectCallsDay']=_0x1d16f8[_0x3bbe('0x3f')];_0x1ea40f['outboundUnknownCallsDay']=_0x1d16f8[_0x3bbe('0x40')];_0x1ea40f['predictiveIntervalAnsweredCalls']=_0x1d16f8[_0x3bbe('0x41')];_0x1ea40f['predictiveIntervalAvgHoldtime']=_0x1d16f8[_0x3bbe('0x42')];_0x1ea40f[_0x3bbe('0x43')]=_0x1d16f8['predictiveIntervalAvgTalktime'];_0x1ea40f[_0x3bbe('0x44')]=_0x1d16f8[_0x3bbe('0x44')];_0x1ea40f[_0x3bbe('0x45')]=_0x1d16f8[_0x3bbe('0x45')];_0x1ea40f[_0x3bbe('0x46')]=_0x1d16f8['predictiveIntervalErlangCalls'];_0x1ea40f[_0x3bbe('0x47')]=_0x1d16f8[_0x3bbe('0x47')];_0x1ea40f['predictiveIntervalHitRate']=_0x1d16f8[_0x3bbe('0x48')];_0x1ea40f[_0x3bbe('0x49')]=_0x1d16f8[_0x3bbe('0x49')];_0x1ea40f['predictiveIntervalPauses']=_0x1d16f8[_0x3bbe('0x4a')];_0x1ea40f['predictiveIntervalAvailable']=_0x1d16f8[_0x3bbe('0x4b')];_0x1ea40f[_0x3bbe('0x4c')]=_0x1d16f8['predictiveIntervalTotalCalls'];_0x1ea40f[_0x3bbe('0x1c')]=_0x1d16f8[_0x3bbe('0x1c')];_0x1ea40f['originated']=_0x1d16f8[_0x3bbe('0x4d')];_0x1ea40f[_0x3bbe('0x4e')]=_0x1d16f8[_0x3bbe('0x4e')];_0x1ea40f[_0x3bbe('0x4f')]=_0x1d16f8['erlangCallToSecond'];_0x1ea40f[_0x3bbe('0x50')]=_0x1d16f8[_0x3bbe('0x50')];_0x1ea40f[_0x3bbe('0x51')]=_0x1d16f8[_0x3bbe('0x51')];_0x1ea40f[_0x3bbe('0x52')]=_0x1d16f8['startPredictive'];_0x1ea40f['startProgressive']=_0x1d16f8[_0x3bbe('0x53')];}if(_0x1d16f8[_0x3bbe('0x54')]){_0x1ea40f['Trunk']={'id':_0x1d16f8[_0x3bbe('0x54')]['id'],'name':_0x1d16f8[_0x3bbe('0x54')][_0x3bbe('0x9')],'active':_0x1d16f8[_0x3bbe('0x54')][_0x3bbe('0x55')],'callerid':_0x1d16f8[_0x3bbe('0x54')][_0x3bbe('0x56')]};}if(_0x1d16f8[_0x3bbe('0x57')]){_0x1ea40f[_0x3bbe('0x57')]={'id':_0x1d16f8['Interval']['id'],'name':_0x1d16f8[_0x3bbe('0x57')][_0x3bbe('0x9')]};}_0x54719a['push'](_0x1ea40f);}}_0x4cf416({'count':_0x54719a[_0x3bbe('0x58')],'rows':_0x54719a});});},'VoiceChannels':function(_0xa0a7ad){return new Promise(function(_0xbb0374,_0x35cc28){var _0x1a0a88=_[_0x3bbe('0x59')](_0x41a958[_0x3bbe('0x5a')]);_0xbb0374({'count':_0x1a0a88['length'],'rows':_0x1a0a88});});},'VoiceChannelMixMonitor':function(_0x19cd3b){var _0x557908=this;return new Promise(function(_0x583b35,_0x5cc98a){if(ami['isConnected']()==![]){return _0x5cc98a(_0x557908[_0x3bbe('0x10')](0x1f4,[config[_0x3bbe('0x11')]['ip'],config[_0x3bbe('0x11')][_0x3bbe('0x12')],_0x3bbe('0x13')][_0x3bbe('0x14')]('\x20')));}var _0x418ce3=schema(properties[_0x3bbe('0x5b')])[_0x3bbe('0x3')](_0x19cd3b);if(_0x418ce3[_0x3bbe('0x58')]>0x0){return _0x5cc98a(_0x557908['error'](0x1f4,_[_0x3bbe('0x5c')](_0x418ce3,_0x3bbe('0x1c'))[_0x3bbe('0x14')](',\x20')));}var _0x138f83=_[_0x3bbe('0x5d')](_0x41a958[_0x3bbe('0x5a')],{'uniqueid':_0x19cd3b[_0x3bbe('0x5e')]});if(_0x138f83&&_0x138f83[_0x3bbe('0x5f')]){var _0x265f13=util[_0x3bbe('0x7')](_0x3bbe('0x60'),_0x19cd3b['filename']||_0x19cd3b[_0x3bbe('0x5e')],_0x19cd3b[_0x3bbe('0x7')]||'wav');return ami[_0x3bbe('0x1a')]({'action':_0x3bbe('0x61'),'channel':_0x138f83[_0x3bbe('0x5f')],'file':_0x265f13,'options':_0x3bbe('0x62')})['then'](function(_0x3fff3f){var _0x554d7e=_['find'](_0x138f83['monitors'],{'filename':_0x3bbe('0x63')+_0x265f13['toLowerCase']()});if(_['isNil'](_0x554d7e)){_0x138f83['monitors'][_0x3bbe('0x64')]({'filename':'/var/spool/asterisk/monitor/'+_0x265f13['toLowerCase'](),'createdAt':moment()[_0x3bbe('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x3fff3f['mixmonitorid'],'status':_0x3bbe('0x65')});}else{_0x554d7e[_0x3bbe('0x66')]=_0x3fff3f['mixmonitorid'];_0x554d7e[_0x3bbe('0x67')]=_0x3bbe('0x65');}_0x583b35({'code':0xc8,'message':[_0x19cd3b[_0x3bbe('0x5e')],'MixMonitor\x20Success',_0x3fff3f[_0x3bbe('0x66')]][_0x3bbe('0x14')]('\x20'),'mixmonitorid':_0x3fff3f[_0x3bbe('0x66')]});})[_0x3bbe('0x1d')](function(_0x2aa5b0){_0x5cc98a(_0x557908['error'](0x1f5,[_0x19cd3b[_0x3bbe('0x5e')],_0x2aa5b0[_0x3bbe('0x1c')][_0x3bbe('0x68')]()]['join']('\x20')));});}else{return _0x5cc98a(_0x557908[_0x3bbe('0x10')](0x1f5,_0x3bbe('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x519bb9){var _0x1e0fe3=this;return new Promise(function(_0x1c051e,_0x26bc46){if(ami['isConnected']()==![]){return _0x26bc46(_0x1e0fe3[_0x3bbe('0x10')](0x1f4,[config[_0x3bbe('0x11')]['ip'],config['asterisk']['username'],_0x3bbe('0x13')][_0x3bbe('0x14')]('\x20')));}var _0x3dff2d=schema(properties[_0x3bbe('0x5b')])[_0x3bbe('0x3')](_0x519bb9);if(_0x3dff2d['length']>0x0){return _0x26bc46(_0x1e0fe3['error'](0x1f4,_['map'](_0x3dff2d,'message')[_0x3bbe('0x14')](',\x20')));}var _0x4e3973=_['find'](_0x41a958['channels'],{'uniqueid':_0x519bb9[_0x3bbe('0x5e')]});if(_0x4e3973){return BPromise[_0x3bbe('0x6a')]()[_0x3bbe('0x1b')](function(){if(_0x4e3973[_0x3bbe('0x5f')]){return ami[_0x3bbe('0x1a')]({'action':_0x3bbe('0x6b'),'channel':_0x4e3973['channel'],'mixmonitorid':_0x519bb9['mixmonitorid']})[_0x3bbe('0x1d')](function(_0x47e7a8){});}})[_0x3bbe('0x1b')](function(){if(_0x4e3973[_0x3bbe('0x6c')]){return ami[_0x3bbe('0x1a')]({'action':_0x3bbe('0x6b'),'channel':_0x4e3973[_0x3bbe('0x6c')],'mixmonitorid':_0x519bb9[_0x3bbe('0x66')]})['catch'](function(_0x5e2863){});}})[_0x3bbe('0x1b')](function(_0xdea0d){var _0x2860d9=_[_0x3bbe('0x5d')](_0x4e3973['monitors'],{'mixmonitorid':_0x519bb9[_0x3bbe('0x66')]});if(_0x2860d9){_0x2860d9[_0x3bbe('0x67')]='stop';}})[_0x3bbe('0x1b')](function(){var _0x464e41=util[_0x3bbe('0x7')](_0x3bbe('0x60'),_0x519bb9[_0x3bbe('0x6d')]||_0x519bb9[_0x3bbe('0x5e')],_0x519bb9[_0x3bbe('0x7')]||_0x3bbe('0x6e'));var _0x43e451=_[_0x3bbe('0x5d')](_0x4e3973[_0x3bbe('0x6f')],{'filename':'/var/spool/asterisk/monitor/'+_0x464e41[_0x3bbe('0x68')]()});if(_0x43e451){_0x43e451[_0x3bbe('0x67')]=_0x3bbe('0x70');}})['then'](function(){_0x1c051e({'code':0xc8,'message':[_0x519bb9[_0x3bbe('0x5e')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x3bbe('0x1d')](function(_0x2911bf){_0x26bc46(_0x1e0fe3[_0x3bbe('0x10')](0x1f5,[_0x519bb9['uniqueid'],_0x2911bf[_0x3bbe('0x1c')][_0x3bbe('0x68')]()][_0x3bbe('0x14')]('\x20')));});}else{return _0x26bc46(_0x1e0fe3[_0x3bbe('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5b9ff3){return new Promise(function(_0x40af68,_0x51461a){var _0x26ef06=_[_0x3bbe('0x59')](_0x41a958[_0x3bbe('0x71')]);_0x40af68({'count':_0x26ef06[_0x3bbe('0x58')],'rows':_0x26ef06});});},'VoiceQueuesChannel':function(_0x25e904){var _0x3b9a27=this;return new Promise(function(_0x335cdf,_0x24ce8e){var _0x3f25ae=schema(properties['voicequeuechannel'])[_0x3bbe('0x3')](_0x25e904);if(_0x3f25ae[_0x3bbe('0x58')]>0x0){return _0x24ce8e(_0x3b9a27[_0x3bbe('0x10')](0x1f4,_[_0x3bbe('0x5c')](_0x3f25ae,_0x3bbe('0x1c'))[_0x3bbe('0x14')](',\x20')));}var _0x4890fb=_[_0x3bbe('0x5d')](_0x41a958['queueChannels'],{'uniqueid':_0x25e904['uniqueid']});if(_0x4890fb){_0x335cdf(_0x4890fb);}else{return _0x24ce8e(_0x3b9a27[_0x3bbe('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x24ea53){var _0x4c5123=this;return new Promise(function(_0x57ba6b,_0x458d42){if(ami[_0x3bbe('0xf')]()==![]){return _0x458d42(_0x4c5123[_0x3bbe('0x10')](0x1f4,[config[_0x3bbe('0x11')]['ip'],config['asterisk'][_0x3bbe('0x12')],_0x3bbe('0x13')][_0x3bbe('0x14')]('\x20')));}var _0x2cf322=schema(properties[_0x3bbe('0x72')])[_0x3bbe('0x3')](_0x24ea53);if(_0x2cf322['length']>0x0){return _0x458d42(_0x4c5123[_0x3bbe('0x10')](0x1f4,_[_0x3bbe('0x5c')](_0x2cf322,_0x3bbe('0x1c'))[_0x3bbe('0x14')](',\x20')));}var _0x2ff6d6=_[_0x3bbe('0x5d')](_0x41a958[_0x3bbe('0x71')],{'uniqueid':_0x24ea53['uniqueid']});if(_0x2ff6d6&&_0x2ff6d6[_0x3bbe('0x5f')]){return ami[_0x3bbe('0x1a')]({'action':_0x3bbe('0x73'),'channel':_0x2ff6d6[_0x3bbe('0x5f')]})[_0x3bbe('0x1b')](function(_0x437460){_0x57ba6b({'code':0xc8,'message':[_0x24ea53[_0x3bbe('0x5e')],_0x437460[_0x3bbe('0x1c')][_0x3bbe('0x68')]()][_0x3bbe('0x14')]('\x20')});})[_0x3bbe('0x1d')](function(_0x1af3b5){_0x458d42(_0x4c5123['error'](0x1f5,[_0x24ea53[_0x3bbe('0x5e')],_0x1af3b5[_0x3bbe('0x1c')][_0x3bbe('0x68')]()][_0x3bbe('0x14')]('\x20')));});}else{return _0x458d42(_0x4c5123['error'](0x1f5,_0x3bbe('0x69')));}});},'VoiceQueuesChannelRedirect':function(_0x304a3f){var _0x3fcf1a=this;return new Promise(function(_0x4479b8,_0x4ac1c8){if(ami[_0x3bbe('0xf')]()==![]){return _0x4ac1c8(_0x3fcf1a[_0x3bbe('0x10')](0x1f4,[config[_0x3bbe('0x11')]['ip'],config[_0x3bbe('0x11')][_0x3bbe('0x12')],_0x3bbe('0x13')][_0x3bbe('0x14')]('\x20')));}var _0x74f2e3=schema(properties[_0x3bbe('0x74')])[_0x3bbe('0x3')](_0x304a3f);if(_0x74f2e3[_0x3bbe('0x58')]>0x0){return _0x4ac1c8(_0x3fcf1a[_0x3bbe('0x10')](0x1f4,_['map'](_0x74f2e3,_0x3bbe('0x1c'))['join'](',\x20')));}var _0x478762=_[_0x3bbe('0x5d')](_0x41a958['queueChannels'],{'uniqueid':_0x304a3f['uniqueid']});if(_0x478762&&_0x478762[_0x3bbe('0x5f')]){return ami['Action']({'action':_0x3bbe('0x75'),'channel':_0x478762[_0x3bbe('0x5f')],'exten':_0x304a3f[_0x3bbe('0x76')],'context':_0x304a3f['context']||_0x478762['context'],'priority':0x1})[_0x3bbe('0x1b')](function(_0x1fae00){_0x4479b8({'code':0xc8,'message':[_0x304a3f[_0x3bbe('0x5e')],_0x1fae00[_0x3bbe('0x1c')][_0x3bbe('0x68')]()]['join']('\x20')});})[_0x3bbe('0x1d')](function(_0x450628){_0x4ac1c8(_0x3fcf1a[_0x3bbe('0x10')](0x1f5,[_0x304a3f[_0x3bbe('0x5e')],_0x450628['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x4ac1c8(_0x3fcf1a['error'](0x1f5,_0x3bbe('0x69')));}});},'Agents':function(_0x3a77a2){return new Promise(function(_0x2abe40,_0x533f94){var _0x3f933e=_['values'](_0x41a958[_0x3bbe('0xc')]);_0x2abe40({'count':_0x3f933e['length'],'rows':_0x3f933e});});},'Telephones':function(_0x161833){return new Promise(function(_0x2dbf94,_0x1bd91d){var _0x5549b2=_[_0x3bbe('0x59')](_0x41a958[_0x3bbe('0x77')]);_0x2dbf94({'count':_0x5549b2['length'],'rows':_0x5549b2});});},'Trunks':function(_0xddc669){return new Promise(function(_0x138a89,_0x27784c){var _0x2bcbc7=_[_0x3bbe('0x59')](_0x41a958[_0x3bbe('0x78')]);_0x138a89({'count':_0x2bcbc7[_0x3bbe('0x58')],'rows':_0x2bcbc7});});},'OutboundChannels':function(_0x19beeb){return new Promise(function(_0x2922ab,_0x2ed070){var _0x2b7da7=_[_0x3bbe('0x59')](_0x41a958[_0x3bbe('0x79')]);_0x2922ab({'count':_0x2b7da7[_0x3bbe('0x58')],'rows':_0x2b7da7});});},'Outbound':function(_0x393004){return new Promise(function(_0x4aee7c,_0x71072e){_0x4aee7c(_0x41a958[_0x3bbe('0x7a')]);});},'Campaigns':function(_0x3732c2){return new Promise(function(_0x5a7809,_0x29023c){var _0x461605=_['values'](_0x41a958[_0x3bbe('0x7b')]);_0x5a7809({'count':_0x461605[_0x3bbe('0x58')],'rows':_0x461605});});},'VoiceQueuesPreview':function(_0xa6c35b){var _0x279f5d=this;return new Promise(function(_0x288755,_0x5a07a3){_0x1257c2[_0x3bbe('0x7c')](_0xa6c35b['id'])['then'](function(_0x1aad1a){_0x288755({'code':0xc8,'message':_0x1aad1a[_0x3bbe('0x1c')]});})[_0x3bbe('0x1d')](function(_0x57e0b8){_0x5a07a3(_0x279f5d[_0x3bbe('0x10')](0x1f4,_0x57e0b8[_0x3bbe('0x1c')]));});});},'EventManager':function(_0x47b80c){var _0x209ca8=this;return new Promise(function(_0x34eabc,_0x10208c){if(!_0x47b80c[_0x3bbe('0x7d')]){return _0x10208c(_0x209ca8['error'](0x1f4,_0x3bbe('0x7e')));}ami[_0x3bbe('0x7f')](_0x3bbe('0x80')+_0x47b80c[_0x3bbe('0x7d')],_0x47b80c['message']);_0x34eabc({'code':0xc8,'message':_0x47b80c});});},'FaxAccounts':function(_0x541316){return new Promise(function(_0x2430a6,_0x21b3e8){var _0x433b83=_[_0x3bbe('0x59')](_0x41a958[_0x3bbe('0x81')]);_0x2430a6({'count':_0x433b83[_0x3bbe('0x58')],'rows':_0x433b83});});},'SendFax':function(_0x4d2f36){var _0x18f447=this;return new Promise(function(_0x138348,_0x45b2ed){_0x559c21['send'](_0x4d2f36)[_0x3bbe('0x1b')](function(_0x3c6700){_0x138348({'code':0xc8,'message':_0x3c6700[_0x3bbe('0x1c')]});})[_0x3bbe('0x1d')](function(_0xf64c6e){_0x45b2ed(_0x18f447[_0x3bbe('0x10')](0x1f4,_0xf64c6e[_0x3bbe('0x1c')]));});});},'CheckAfterSend':function(_0x297f83){var _0x3db668=this;return new Promise(function(_0x59418d,_0x55e18f){_0x559c21[_0x3bbe('0x82')](_0x297f83)[_0x3bbe('0x1b')](function(_0x52118b){_0x59418d({'code':0xc8,'message':_0x52118b[_0x3bbe('0x1c')]});})[_0x3bbe('0x1d')](function(_0x279f33){_0x55e18f(_0x3db668[_0x3bbe('0x10')](0x1f4,_0x279f33[_0x3bbe('0x1c')]));});});}};var _0x333443=jayson[_0x3bbe('0x83')](_0x4fee0c)['http']();_0x333443['on'](_0x3bbe('0x10'),function(_0x546985){return _0x4d1430(_0x546985);});_0x333443[_0x3bbe('0x84')](0x232a,_0x3bbe('0x85'),function(){console[_0x3bbe('0x86')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3e8ee1(_0x3bbe('0x87')+0x232a);});});}; \ No newline at end of file +var _0x33d2=['resolve','StopMixMonitor','destinationchannel','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../properties','../ami','listen','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','ami\x20disconnected','pick','keys','module','action','Reload','Action','then','message','catch','isConnected','command','voiceQueues','strategy','answered','available','pTalking','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','type','outbound','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','channels','voicechannel','length','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','isNil','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','MixMonitor\x20Success','join'];(function(_0x451c27,_0x837289){var _0x53422b=function(_0x1c075d){while(--_0x1c075d){_0x451c27['push'](_0x451c27['shift']());}};_0x53422b(++_0x837289);}(_0x33d2,0x1b4));var _0x233d=function(_0x53e6a8,_0x5839ab){_0x53e6a8=_0x53e6a8-0x0;var _0x2b6dcc=_0x33d2[_0x53e6a8];return _0x2b6dcc;};'use strict';var _=require(_0x233d('0x0'));var util=require(_0x233d('0x1'));var jayson=require(_0x233d('0x2'));var schema=require(_0x233d('0x3'));var BPromise=require(_0x233d('0x4'));var moment=require(_0x233d('0x5'));var config=require('../../../config/environment');var properties=require(_0x233d('0x6'));var ami=require(_0x233d('0x7'));exports[_0x233d('0x8')]=function(_0x2a78de,_0x58f951,_0x372fc4){return new BPromise(function(_0x2f8a19,_0x54188d){var _0x3937c9={'QueuePause':function(_0x4564d2){return new Promise(function(_0x171ab0,_0x5adc88){var _0x389a45=util[_0x233d('0x9')](_0x233d('0xa'),'SIP',_0x4564d2[_0x233d('0xb')]);if(_0x2a78de['timers']&&_0x2a78de[_0x233d('0xc')][_0x389a45]&&_0x2a78de[_0x233d('0xc')][_0x389a45][_0x233d('0xd')]){_0x2a78de[_0x233d('0xc')][_0x389a45][_0x233d('0xe')]();}if(_0x2a78de[_0x233d('0xf')][_0x389a45]){_0x2a78de['agents'][_0x389a45][_0x233d('0x10')]({'statePause':_0x4564d2[_0x233d('0x11')]?!![]:![]});}_0x171ab0({'code':0xc8,'message':_0x233d('0x12')});});},'Reload':function(_0x5f0194){var _0x580ad1=this;return new Promise(function(_0x45ceed,_0xb4fbed){if(ami['isConnected']()==![]){return _0xb4fbed(_0x580ad1[_0x233d('0x13')](0x1f4,[config[_0x233d('0x14')]['ip'],config[_0x233d('0x14')][_0x233d('0x15')],_0x233d('0x16')]['join']('\x20')));}_0x5f0194=_[_0x233d('0x17')](_0x5f0194,_[_0x233d('0x18')](properties[_0x233d('0x19')]));_0x5f0194[_0x233d('0x1a')]=_0x233d('0x1b');return ami[_0x233d('0x1c')](_0x5f0194)[_0x233d('0x1d')](function(_0x211c98){_0x45ceed({'code':0xc8,'message':_0x211c98[_0x233d('0x1e')]});})[_0x233d('0x1f')](function(_0x54143f){_0xb4fbed(_0x580ad1['error'](0x1f5,_0x54143f[_0x233d('0x1e')]));});});},'Command':function(_0x4409d8){var _0x340d77=this;return new Promise(function(_0x38cb74,_0x1184eb){if(ami[_0x233d('0x20')]()==![]){return _0x1184eb(_0x340d77[_0x233d('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x233d('0x14')][_0x233d('0x15')],_0x233d('0x16')]['join']('\x20')));}_0x4409d8=_[_0x233d('0x17')](_0x4409d8,_0x233d('0x21'));_0x4409d8[_0x233d('0x1a')]='Command';return ami[_0x233d('0x1c')](_0x4409d8)[_0x233d('0x1d')](function(_0xf34568){_0x38cb74({'code':0xc8,'message':_0xf34568['content']});})[_0x233d('0x1f')](function(_0xf1baae){_0x1184eb(_0x340d77[_0x233d('0x13')](0x1f5,_0xf1baae['message']));});});},'VoiceQueues':function(_0x41ae76){return new Promise(function(_0x16f3e4,_0x44aad3){var _0x187461=[];for(var _0x37f2f1 in _0x2a78de[_0x233d('0x22')]){if(_0x2a78de['voiceQueues']['hasOwnProperty'](_0x37f2f1)){var _0x2c7a29=_0x2a78de[_0x233d('0x22')][_0x37f2f1];var _0x29371c={'id':_0x2c7a29['id'],'name':_0x2c7a29[_0x233d('0xb')],'strategy':_0x2c7a29[_0x233d('0x23')],'answered':_0x2c7a29[_0x233d('0x24')],'available':_0x2c7a29[_0x233d('0x25')],'loggedIn':_0x2c7a29['loggedIn'],'pTalking':_0x2c7a29[_0x233d('0x26')],'sumBillable':_0x2c7a29['sumBillable'],'sumDuration':_0x2c7a29['sumDuration'],'sumHoldTime':_0x2c7a29[_0x233d('0x27')]||0x0,'talking':_0x2c7a29['talking'],'total':_0x2c7a29[_0x233d('0x28')],'type':_0x2c7a29['type'],'unmanaged':_0x2c7a29[_0x233d('0x29')],'abandoned':_0x2c7a29[_0x233d('0x2a')],'waiting':_0x2c7a29[_0x233d('0x2b')],'loggedInDb':_0x2c7a29[_0x233d('0x2c')]};if(_0x2c7a29[_0x233d('0x2d')]===_0x233d('0x2e')){_0x29371c[_0x233d('0x2f')]=_0x2c7a29[_0x233d('0x2f')];_0x29371c['dialMethod']=_0x2c7a29['dialMethod'];_0x29371c[_0x233d('0x30')]=_0x2c7a29['dialOriginateCallerIdName'];_0x29371c[_0x233d('0x31')]=_0x2c7a29[_0x233d('0x31')];_0x29371c['dialOriginateTimeout']=_0x2c7a29[_0x233d('0x32')];_0x29371c[_0x233d('0x33')]=_0x2c7a29[_0x233d('0x33')];_0x29371c['outboundAnswerAgiCallsDay']=_0x2c7a29[_0x233d('0x34')];_0x29371c[_0x233d('0x35')]=_0x2c7a29['outboundAnswerCallsDay'];_0x29371c['outboundBlacklistCallsDay']=_0x2c7a29[_0x233d('0x36')];_0x29371c[_0x233d('0x37')]=_0x2c7a29[_0x233d('0x37')];_0x29371c[_0x233d('0x38')]=_0x2c7a29['outboundCongestionCallsDay'];_0x29371c[_0x233d('0x39')]=_0x2c7a29[_0x233d('0x39')];_0x29371c['outboundDropCallsDayCallersExit']=_0x2c7a29[_0x233d('0x3a')];_0x29371c[_0x233d('0x3b')]=_0x2c7a29[_0x233d('0x3b')];_0x29371c['outboundNoAnswerCallsDay']=_0x2c7a29[_0x233d('0x3c')];_0x29371c[_0x233d('0x3d')]=_0x2c7a29[_0x233d('0x3d')];_0x29371c[_0x233d('0x3e')]=_0x2c7a29['outboundOriginateFailureCallsDay'];_0x29371c[_0x233d('0x3f')]=_0x2c7a29['outboundReCallsDay'];_0x29371c[_0x233d('0x40')]=_0x2c7a29[_0x233d('0x40')];_0x29371c[_0x233d('0x41')]=_0x2c7a29[_0x233d('0x41')];_0x29371c[_0x233d('0x42')]=_0x2c7a29[_0x233d('0x42')];_0x29371c[_0x233d('0x43')]=_0x2c7a29[_0x233d('0x43')];_0x29371c[_0x233d('0x44')]=_0x2c7a29[_0x233d('0x44')];_0x29371c[_0x233d('0x45')]=_0x2c7a29[_0x233d('0x45')];_0x29371c[_0x233d('0x46')]=_0x2c7a29['predictiveIntervalDroppedCallsTimeout'];_0x29371c['predictiveIntervalErlangCalls']=_0x2c7a29[_0x233d('0x47')];_0x29371c[_0x233d('0x48')]=_0x2c7a29['predictiveIntervalErlangCallsDroppedCalls'];_0x29371c['predictiveIntervalHitRate']=_0x2c7a29['predictiveIntervalHitRate'];_0x29371c[_0x233d('0x49')]=_0x2c7a29[_0x233d('0x49')];_0x29371c[_0x233d('0x4a')]=_0x2c7a29[_0x233d('0x4a')];_0x29371c[_0x233d('0x4b')]=_0x2c7a29[_0x233d('0x4b')];_0x29371c[_0x233d('0x4c')]=_0x2c7a29[_0x233d('0x4c')];_0x29371c[_0x233d('0x1e')]=_0x2c7a29['message'];_0x29371c['originated']=_0x2c7a29[_0x233d('0x4d')];_0x29371c[_0x233d('0x4e')]=_0x2c7a29[_0x233d('0x4e')];_0x29371c[_0x233d('0x4f')]=_0x2c7a29[_0x233d('0x4f')];_0x29371c['erlangAbandonmentRate']=_0x2c7a29[_0x233d('0x50')];_0x29371c['erlangBusyFactor']=_0x2c7a29[_0x233d('0x51')];_0x29371c[_0x233d('0x52')]=_0x2c7a29[_0x233d('0x52')];_0x29371c[_0x233d('0x53')]=_0x2c7a29[_0x233d('0x53')];}if(_0x2c7a29[_0x233d('0x54')]){_0x29371c[_0x233d('0x54')]={'id':_0x2c7a29['Trunk']['id'],'name':_0x2c7a29[_0x233d('0x54')][_0x233d('0xb')],'active':_0x2c7a29[_0x233d('0x54')]['active'],'callerid':_0x2c7a29[_0x233d('0x54')][_0x233d('0x55')]};}if(_0x2c7a29[_0x233d('0x56')]){_0x29371c['Interval']={'id':_0x2c7a29[_0x233d('0x56')]['id'],'name':_0x2c7a29[_0x233d('0x56')][_0x233d('0xb')]};}_0x187461[_0x233d('0x57')](_0x29371c);}}_0x16f3e4({'count':_0x187461['length'],'rows':_0x187461});});},'VoiceChannels':function(_0x99b06b){return new Promise(function(_0x29372e,_0x644ca4){var _0x4cd7fd=_['values'](_0x2a78de[_0x233d('0x58')]);_0x29372e({'count':_0x4cd7fd['length'],'rows':_0x4cd7fd});});},'VoiceChannelMixMonitor':function(_0xdf8452){var _0x54dcd3=this;return new Promise(function(_0x16258b,_0x344879){if(ami[_0x233d('0x20')]()==![]){return _0x344879(_0x54dcd3[_0x233d('0x13')](0x1f4,[config[_0x233d('0x14')]['ip'],config[_0x233d('0x14')][_0x233d('0x15')],_0x233d('0x16')]['join']('\x20')));}var _0x2fea5d=schema(properties[_0x233d('0x59')])['validate'](_0xdf8452);if(_0x2fea5d[_0x233d('0x5a')]>0x0){return _0x344879(_0x54dcd3[_0x233d('0x13')](0x1f4,_[_0x233d('0x5b')](_0x2fea5d,'message')['join'](',\x20')));}var _0x26c432=_[_0x233d('0x5c')](_0x2a78de[_0x233d('0x58')],{'uniqueid':_0xdf8452[_0x233d('0x5d')]});if(_0x26c432&&_0x26c432[_0x233d('0x5e')]){var _0x4847ea=util[_0x233d('0x9')](_0x233d('0x5f'),_0xdf8452[_0x233d('0x60')]||_0xdf8452[_0x233d('0x5d')],_0xdf8452[_0x233d('0x9')]||_0x233d('0x61'));return ami[_0x233d('0x1c')]({'action':_0x233d('0x62'),'channel':_0x26c432['channel'],'file':_0x4847ea,'options':_0x233d('0x63')})[_0x233d('0x1d')](function(_0x4dea43){var _0x1aeb4d=_[_0x233d('0x5c')](_0x26c432[_0x233d('0x64')],{'filename':'/var/spool/asterisk/monitor/'+_0x4847ea['toLowerCase']()});if(_[_0x233d('0x65')](_0x1aeb4d)){_0x26c432[_0x233d('0x64')]['push']({'filename':_0x233d('0x66')+_0x4847ea[_0x233d('0x67')](),'createdAt':moment()[_0x233d('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x4dea43[_0x233d('0x68')],'status':'rec'});}else{_0x1aeb4d['mixmonitorid']=_0x4dea43[_0x233d('0x68')];_0x1aeb4d['status']=_0x233d('0x69');}_0x16258b({'code':0xc8,'message':[_0xdf8452[_0x233d('0x5d')],_0x233d('0x6a'),_0x4dea43['mixmonitorid']][_0x233d('0x6b')]('\x20'),'mixmonitorid':_0x4dea43['mixmonitorid']});})[_0x233d('0x1f')](function(_0x52f934){_0x344879(_0x54dcd3[_0x233d('0x13')](0x1f5,[_0xdf8452[_0x233d('0x5d')],_0x52f934[_0x233d('0x1e')][_0x233d('0x67')]()][_0x233d('0x6b')]('\x20')));});}else{return _0x344879(_0x54dcd3[_0x233d('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x1ff94c){var _0xa08957=this;return new Promise(function(_0x5309c1,_0x12e0e6){if(ami[_0x233d('0x20')]()==![]){return _0x12e0e6(_0xa08957[_0x233d('0x13')](0x1f4,[config[_0x233d('0x14')]['ip'],config['asterisk'][_0x233d('0x15')],_0x233d('0x16')][_0x233d('0x6b')]('\x20')));}var _0xa842a9=schema(properties[_0x233d('0x59')])['validate'](_0x1ff94c);if(_0xa842a9[_0x233d('0x5a')]>0x0){return _0x12e0e6(_0xa08957[_0x233d('0x13')](0x1f4,_['map'](_0xa842a9,_0x233d('0x1e'))[_0x233d('0x6b')](',\x20')));}var _0x5c9a1d=_[_0x233d('0x5c')](_0x2a78de[_0x233d('0x58')],{'uniqueid':_0x1ff94c[_0x233d('0x5d')]});if(_0x5c9a1d){return BPromise[_0x233d('0x6c')]()[_0x233d('0x1d')](function(){if(_0x5c9a1d[_0x233d('0x5e')]){return ami['Action']({'action':_0x233d('0x6d'),'channel':_0x5c9a1d[_0x233d('0x5e')],'mixmonitorid':_0x1ff94c[_0x233d('0x68')]})[_0x233d('0x1f')](function(_0x3ae00a){});}})[_0x233d('0x1d')](function(){if(_0x5c9a1d[_0x233d('0x6e')]){return ami['Action']({'action':_0x233d('0x6d'),'channel':_0x5c9a1d[_0x233d('0x6e')],'mixmonitorid':_0x1ff94c[_0x233d('0x68')]})[_0x233d('0x1f')](function(_0x56a0b9){});}})['then'](function(_0x38c274){var _0x4406c6=_[_0x233d('0x5c')](_0x5c9a1d['monitors'],{'mixmonitorid':_0x1ff94c[_0x233d('0x68')]});if(_0x4406c6){_0x4406c6['status']='stop';}})[_0x233d('0x1d')](function(){var _0x1088ae=util[_0x233d('0x9')](_0x233d('0x5f'),_0x1ff94c['filename']||_0x1ff94c[_0x233d('0x5d')],_0x1ff94c[_0x233d('0x9')]||_0x233d('0x61'));var _0x1b2c95=_[_0x233d('0x5c')](_0x5c9a1d['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x1088ae[_0x233d('0x67')]()});if(_0x1b2c95){_0x1b2c95['status']='stop';}})[_0x233d('0x1d')](function(){_0x5309c1({'code':0xc8,'message':[_0x1ff94c[_0x233d('0x5d')],'StopMixMonitor\x20Success'][_0x233d('0x6b')]('\x20')});})['catch'](function(_0x58ce57){_0x12e0e6(_0xa08957[_0x233d('0x13')](0x1f5,[_0x1ff94c[_0x233d('0x5d')],_0x58ce57[_0x233d('0x1e')][_0x233d('0x67')]()][_0x233d('0x6b')]('\x20')));});}else{return _0x12e0e6(_0xa08957[_0x233d('0x13')](0x1f5,_0x233d('0x6f')));}});},'VoiceQueuesChannels':function(_0x2b1eb5){return new Promise(function(_0x362d68,_0x4f31e8){var _0x29be37=_[_0x233d('0x70')](_0x2a78de[_0x233d('0x71')]);_0x362d68({'count':_0x29be37[_0x233d('0x5a')],'rows':_0x29be37});});},'VoiceQueuesChannel':function(_0xfa0ad8){var _0x15d2ef=this;return new Promise(function(_0x1bb996,_0x48e715){var _0x58a1f4=schema(properties[_0x233d('0x72')])['validate'](_0xfa0ad8);if(_0x58a1f4[_0x233d('0x5a')]>0x0){return _0x48e715(_0x15d2ef[_0x233d('0x13')](0x1f4,_[_0x233d('0x5b')](_0x58a1f4,_0x233d('0x1e'))[_0x233d('0x6b')](',\x20')));}var _0x3cc5c9=_['find'](_0x2a78de[_0x233d('0x71')],{'uniqueid':_0xfa0ad8[_0x233d('0x5d')]});if(_0x3cc5c9){_0x1bb996(_0x3cc5c9);}else{return _0x48e715(_0x15d2ef[_0x233d('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x14bd25){var _0x3c8345=this;return new Promise(function(_0x20045a,_0x5687ee){if(ami[_0x233d('0x20')]()==![]){return _0x5687ee(_0x3c8345[_0x233d('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x233d('0x14')][_0x233d('0x15')],_0x233d('0x16')][_0x233d('0x6b')]('\x20')));}var _0x54060f=schema(properties[_0x233d('0x73')])[_0x233d('0x3')](_0x14bd25);if(_0x54060f[_0x233d('0x5a')]>0x0){return _0x5687ee(_0x3c8345['error'](0x1f4,_['map'](_0x54060f,'message')['join'](',\x20')));}var _0x1a0303=_[_0x233d('0x5c')](_0x2a78de[_0x233d('0x71')],{'uniqueid':_0x14bd25['uniqueid']});if(_0x1a0303&&_0x1a0303[_0x233d('0x5e')]){return ami['Action']({'action':_0x233d('0x74'),'channel':_0x1a0303[_0x233d('0x5e')]})['then'](function(_0x4a6eec){_0x20045a({'code':0xc8,'message':[_0x14bd25[_0x233d('0x5d')],_0x4a6eec['message'][_0x233d('0x67')]()][_0x233d('0x6b')]('\x20')});})['catch'](function(_0x46515e){_0x5687ee(_0x3c8345['error'](0x1f5,[_0x14bd25[_0x233d('0x5d')],_0x46515e[_0x233d('0x1e')][_0x233d('0x67')]()][_0x233d('0x6b')]('\x20')));});}else{return _0x5687ee(_0x3c8345['error'](0x1f5,_0x233d('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x3d060f){var _0x235272=this;return new Promise(function(_0x3cf7a4,_0x20e5da){if(ami['isConnected']()==![]){return _0x20e5da(_0x235272[_0x233d('0x13')](0x1f4,[config[_0x233d('0x14')]['ip'],config['asterisk'][_0x233d('0x15')],'ami\x20disconnected'][_0x233d('0x6b')]('\x20')));}var _0x25f5dd=schema(properties[_0x233d('0x75')])[_0x233d('0x3')](_0x3d060f);if(_0x25f5dd[_0x233d('0x5a')]>0x0){return _0x20e5da(_0x235272[_0x233d('0x13')](0x1f4,_[_0x233d('0x5b')](_0x25f5dd,_0x233d('0x1e'))[_0x233d('0x6b')](',\x20')));}var _0x1d934c=_['find'](_0x2a78de[_0x233d('0x71')],{'uniqueid':_0x3d060f[_0x233d('0x5d')]});if(_0x1d934c&&_0x1d934c[_0x233d('0x5e')]){return ami[_0x233d('0x1c')]({'action':_0x233d('0x76'),'channel':_0x1d934c[_0x233d('0x5e')],'exten':_0x3d060f['exten'],'context':_0x3d060f[_0x233d('0x77')]||_0x1d934c['context'],'priority':0x1})[_0x233d('0x1d')](function(_0x370780){_0x3cf7a4({'code':0xc8,'message':[_0x3d060f['uniqueid'],_0x370780['message']['toLowerCase']()][_0x233d('0x6b')]('\x20')});})['catch'](function(_0x203240){_0x20e5da(_0x235272[_0x233d('0x13')](0x1f5,[_0x3d060f['uniqueid'],_0x203240['message']['toLowerCase']()][_0x233d('0x6b')]('\x20')));});}else{return _0x20e5da(_0x235272[_0x233d('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x16f65c){return new Promise(function(_0x385504,_0x3230d0){var _0x4049e1=_['values'](_0x2a78de['agents']);_0x385504({'count':_0x4049e1[_0x233d('0x5a')],'rows':_0x4049e1});});},'Telephones':function(_0x17eb35){return new Promise(function(_0xdb3e81,_0x3755b4){var _0x555dc1=_[_0x233d('0x70')](_0x2a78de[_0x233d('0x78')]);_0xdb3e81({'count':_0x555dc1['length'],'rows':_0x555dc1});});},'Trunks':function(_0x3778f1){return new Promise(function(_0x5a89cc,_0x3e5a3b){var _0x59a9d3=_['values'](_0x2a78de['trunks']);_0x5a89cc({'count':_0x59a9d3[_0x233d('0x5a')],'rows':_0x59a9d3});});},'OutboundChannels':function(_0x22fd5e){return new Promise(function(_0xb8c317,_0x22f890){var _0x41fdd4=_[_0x233d('0x70')](_0x2a78de[_0x233d('0x79')]);_0xb8c317({'count':_0x41fdd4[_0x233d('0x5a')],'rows':_0x41fdd4});});},'Outbound':function(_0x49dc40){return new Promise(function(_0x3dfc65,_0x4934c6){_0x3dfc65(_0x2a78de[_0x233d('0x2e')]);});},'Campaigns':function(_0x3bd7e6){return new Promise(function(_0x23edc2,_0x2e217f){var _0x156c31=_['values'](_0x2a78de[_0x233d('0x7a')]);_0x23edc2({'count':_0x156c31['length'],'rows':_0x156c31});});},'VoiceQueuesPreview':function(_0x114e76){var _0x3b83c2=this;return new Promise(function(_0x140b96,_0x31e848){_0x58f951[_0x233d('0x7b')](_0x114e76['id'])[_0x233d('0x1d')](function(_0x375856){_0x140b96({'code':0xc8,'message':_0x375856['message']});})[_0x233d('0x1f')](function(_0x5456aa){_0x31e848(_0x3b83c2[_0x233d('0x13')](0x1f4,_0x5456aa['message']));});});},'EventManager':function(_0x205c5f){var _0x3d2ed1=this;return new Promise(function(_0x5ac557,_0x8cfe00){if(!_0x205c5f[_0x233d('0x7c')]){return _0x8cfe00(_0x3d2ed1[_0x233d('0x13')](0x1f4,_0x233d('0x7d')));}ami[_0x233d('0x7e')](_0x233d('0x7f')+_0x205c5f[_0x233d('0x7c')],_0x205c5f[_0x233d('0x1e')]);_0x5ac557({'code':0xc8,'message':_0x205c5f});});},'FaxAccounts':function(_0x27d083){return new Promise(function(_0x5ec311,_0x506377){var _0x9d3d5d=_[_0x233d('0x70')](_0x2a78de[_0x233d('0x80')]);_0x5ec311({'count':_0x9d3d5d[_0x233d('0x5a')],'rows':_0x9d3d5d});});},'SendFax':function(_0x354b5f){var _0x5904ea=this;return new Promise(function(_0x8e99c6,_0x173ca0){_0x372fc4[_0x233d('0x81')](_0x354b5f)[_0x233d('0x1d')](function(_0x471255){_0x8e99c6({'code':0xc8,'message':_0x471255[_0x233d('0x1e')]});})[_0x233d('0x1f')](function(_0x3717ea){_0x173ca0(_0x5904ea[_0x233d('0x13')](0x1f4,_0x3717ea[_0x233d('0x1e')]));});});},'CheckAfterSend':function(_0x4b9028){var _0x2d55fb=this;return new Promise(function(_0x47e622,_0x11c333){_0x372fc4[_0x233d('0x82')](_0x4b9028)[_0x233d('0x1d')](function(_0x2bea66){_0x47e622({'code':0xc8,'message':_0x2bea66[_0x233d('0x1e')]});})[_0x233d('0x1f')](function(_0x3eb3db){_0x11c333(_0x2d55fb[_0x233d('0x13')](0x1f4,_0x3eb3db[_0x233d('0x1e')]));});});}};var _0x4ddfe3=jayson['server'](_0x3937c9)[_0x233d('0x83')]();_0x4ddfe3['on'](_0x233d('0x13'),function(_0x25b64d){return _0x54188d(_0x25b64d);});_0x4ddfe3['listen'](0x232a,_0x233d('0x84'),function(){console[_0x233d('0x85')](_0x233d('0x86'),0x232a);return _0x2f8a19(_0x233d('0x87')+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 34c0bf0..a353d42 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 _0x755b=['[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','firstName','destcalleridname','','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1','data2','xmd-contactid','ListId','data3','split','$or','destcalleridnum','calleridnum','lastName','mobile','fax','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone'];(function(_0x883d7,_0x28edb8){var _0x1559d6=function(_0x2a245b){while(--_0x2a245b){_0x883d7['push'](_0x883d7['shift']());}};_0x1559d6(++_0x28edb8);}(_0x755b,0xfb));var _0xb755=function(_0x276341,_0x4ff417){_0x276341=_0x276341-0x0;var _0x5f2f4c=_0x755b[_0x276341];return _0x5f2f4c;};'use strict';var _=require(_0xb755('0x0'));var BPromise=require(_0xb755('0x1'));var Redis=require('ioredis');var util=require(_0xb755('0x2'));var config=require(_0xb755('0x3'));var logger=require(_0xb755('0x4'))('trigger');var cmContactRpc=require(_0xb755('0x5'));config[_0xb755('0x6')]=_[_0xb755('0x7')](config[_0xb755('0x6')],{'host':_0xb755('0x8'),'port':0x18eb});var io=require(_0xb755('0x9'))(new Redis(config[_0xb755('0x6')]));function emit(_0x3e911b,_0x56df76,_0x3bd3ff,_0x2e1d2c,_0x33a1bf){logger[_0xb755('0xa')](_0xb755('0xb'),_0x3e911b,_0x56df76['id'],_0x3bd3ff,_0x2e1d2c,JSON[_0xb755('0xc')](_0x33a1bf));io['to'](_0x3bd3ff)[_0xb755('0xd')](_0x2e1d2c,_0x33a1bf);}exports['exec']=function(_0x36e672,_0x3e3bed,_0x3e1bb0,_0x3759ef){var _0x84c1e9,_0x2be75d;var _0x1d89f7={};var _0x290996=Number(_0x3e1bb0[_0xb755('0xe')]);var _0x2d8668=_0x3e1bb0[_0xb755('0xf')]?Boolean(Number(_0x3e1bb0[_0xb755('0xf')])):![];var _0x2737fd;if(_0x3759ef[_0xb755('0x10')]){_0x1d89f7['id']=_0x3759ef[_0xb755('0x10')];}if(!_0x1d89f7['id']){_0x1d89f7[_0xb755('0x11')]=_0x290996;_0x2737fd=_0x3e1bb0[_0xb755('0x12')]&&_0x3e1bb0[_0xb755('0x12')]!=='0'?_0x3e1bb0[_0xb755('0x12')][_0xb755('0x13')](','):['phone'];_0x1d89f7[_0xb755('0x14')]=_['map'](_0x2737fd,function(_0x1d10b8){var _0x5dc58b={};_0x5dc58b[_0x1d10b8]=_0x3759ef['routeId']?_0x3759ef[_0xb755('0x15')]:_0x3759ef[_0xb755('0x16')];return _0x5dc58b;});}var _0xac1767=['id','firstName',_0xb755('0x17'),'phone',_0xb755('0x18'),_0xb755('0x19'),_0xb755('0x11'),'createdAt',_0xb755('0x1a'),_0xb755('0x1b')];var _0x25b51d=_[_0xb755('0x1c')](_0xac1767,_0x2737fd);BPromise[_0xb755('0x1d')]()[_0xb755('0x1e')](cmContactRpc[_0xb755('0x1f')]({'attributes':_0x25b51d,'where':_0x1d89f7}))[_0xb755('0x1e')](function(_0x54be1d){_0x2be75d=_0x54be1d;if(!_[_0xb755('0x20')](_0x2be75d)){if(_0x2be75d[_0xb755('0x21')]===0x1){_0x84c1e9=_0x2be75d[0x0];logger['info'](_0xb755('0x22'),_0x3759ef[_0xb755('0x23')],_0x3e3bed['id'],_0x84c1e9['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x3759ef[_0xb755('0x23')],_0x3e3bed['id'],_['map'](_0x2be75d,'id')['join'](','));}return;}else{logger[_0xb755('0xa')](_0xb755('0x24'),_0x3759ef[_0xb755('0x23')],_0x3e3bed['id']);var _0x14ab98={'ListId':_0x290996};var _0x366646=_0x3e1bb0[_0xb755('0x25')]&&_0x3e1bb0[_0xb755('0x25')]!=='0'?_0x3e1bb0[_0xb755('0x25')]:_0xb755('0x26');if(_0x2d8668){logger['info'](_0xb755('0x27'),_0x3759ef['uniqueid'],_0x3e3bed['id']);_0x14ab98[_0x366646]=_[_0xb755('0x28')](_0x3759ef[_0xb755('0x29')])?_0x3759ef['calleridnum']:_0x3759ef[_0xb755('0x15')];if(_[_0xb755('0x28')](_0x3759ef[_0xb755('0x29')])){_0x14ab98['firstName']=_0x3759ef['calleridname']&&_0x3759ef[_0xb755('0x2a')]!==''?_0x3759ef['calleridname']:'Unknown';}else{_0x14ab98[_0xb755('0x2b')]=_0x3759ef[_0xb755('0x2c')]&&_0x3759ef[_0xb755('0x2c')]!==_0xb755('0x2d')?_0x3759ef['destcalleridname']:_0xb755('0x2e');}return BPromise[_0xb755('0x1d')]()[_0xb755('0x1e')](cmContactRpc[_0xb755('0x2f')](_0x14ab98))[_0xb755('0x1e')](function(_0x591413){_0x84c1e9=_0x591413;_0x2be75d[_0xb755('0x30')](_0x591413);if(_0x84c1e9){logger[_0xb755('0xa')](_0xb755('0x31'),_0x3759ef[_0xb755('0x23')],_0x3e3bed['id'],_0x84c1e9['id']);}return;});}else{logger[_0xb755('0xa')](_0xb755('0x32'),_0x3759ef[_0xb755('0x23')],_0x3e3bed['id']);_0x14ab98[_0x366646]=_[_0xb755('0x28')](_0x3759ef[_0xb755('0x29')])?_0x3759ef[_0xb755('0x16')]:_0x3759ef['destcalleridnum'];if(_[_0xb755('0x28')](_0x3759ef['routeId'])){_0x14ab98[_0xb755('0x2b')]=_0x3759ef['calleridname']&&_0x3759ef[_0xb755('0x2a')]!==_0xb755('0x2d')?_0x3759ef[_0xb755('0x2a')]:'Unknown';}else{_0x14ab98[_0xb755('0x2b')]=_0x3759ef[_0xb755('0x2c')]&&_0x3759ef[_0xb755('0x2c')]!==_0xb755('0x2d')?_0x3759ef[_0xb755('0x2c')]:_0xb755('0x2e');}_0x84c1e9=_0x14ab98;_0x2be75d[_0xb755('0x30')](_0x14ab98);return;}}})[_0xb755('0x1e')](function(){if(_0x36e672){emit(_0x3759ef[_0xb755('0x23')],_0x3e3bed,util['format'](_0xb755('0x33'),_0x36e672[_0xb755('0x34')]),util[_0xb755('0x35')](_0xb755('0x36'),_0x3e1bb0[_0xb755('0x37')][_0xb755('0x38')]()),{'evt':_[_0xb755('0x39')](_0x3759ef,{'autoCreate':_0x2d8668}),'contact':_0x84c1e9===undefined?{}:_0x84c1e9,'contacts':_0x2be75d[_0xb755('0x21')]===0x0?undefined:_0x2be75d});}});}; \ No newline at end of file +var _0x5c41=['routeId','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','ListId','data3','split','phone','map','destcalleridnum','calleridnum','firstName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil'];(function(_0x4b0fec,_0x216326){var _0x50904e=function(_0xf450d1){while(--_0xf450d1){_0x4b0fec['push'](_0x4b0fec['shift']());}};_0x50904e(++_0x216326);}(_0x5c41,0x159));var _0x15c4=function(_0x331763,_0x41e53d){_0x331763=_0x331763-0x0;var _0x4c3e27=_0x5c41[_0x331763];return _0x4c3e27;};'use strict';var _=require(_0x15c4('0x0'));var BPromise=require(_0x15c4('0x1'));var Redis=require('ioredis');var util=require(_0x15c4('0x2'));var config=require(_0x15c4('0x3'));var logger=require('../../../../config/logger')(_0x15c4('0x4'));var cmContactRpc=require(_0x15c4('0x5'));config['redis']=_['defaults'](config[_0x15c4('0x6')],{'host':_0x15c4('0x7'),'port':0x18eb});var io=require(_0x15c4('0x8'))(new Redis(config[_0x15c4('0x6')]));function emit(_0x144a7c,_0x13202a,_0x5a81df,_0x2535c9,_0x533e86){logger[_0x15c4('0x9')](_0x15c4('0xa'),_0x144a7c,_0x13202a['id'],_0x5a81df,_0x2535c9,JSON['stringify'](_0x533e86));io['to'](_0x5a81df)[_0x15c4('0xb')](_0x2535c9,_0x533e86);}exports[_0x15c4('0xc')]=function(_0x105fad,_0x5ab093,_0x330163,_0x269ac9){var _0x45d8f2,_0x438319;var _0x2175ad={};var _0x4fa3ec=Number(_0x330163[_0x15c4('0xd')]);var _0x383fb8=_0x330163[_0x15c4('0xe')]?Boolean(Number(_0x330163[_0x15c4('0xe')])):![];var _0x2512d2;if(_0x269ac9['xmd-contactid']){_0x2175ad['id']=_0x269ac9['xmd-contactid'];}if(!_0x2175ad['id']){_0x2175ad[_0x15c4('0xf')]=_0x4fa3ec;_0x2512d2=_0x330163[_0x15c4('0x10')]&&_0x330163[_0x15c4('0x10')]!=='0'?_0x330163[_0x15c4('0x10')][_0x15c4('0x11')](','):[_0x15c4('0x12')];_0x2175ad['$or']=_[_0x15c4('0x13')](_0x2512d2,function(_0x28a169){var _0x59f7a0={};_0x59f7a0[_0x28a169]=_0x269ac9['routeId']?_0x269ac9[_0x15c4('0x14')]:_0x269ac9[_0x15c4('0x15')];return _0x59f7a0;});}var _0x494afb=['id',_0x15c4('0x16'),'lastName','phone',_0x15c4('0x17'),_0x15c4('0x18'),_0x15c4('0xf'),_0x15c4('0x19'),_0x15c4('0x1a'),_0x15c4('0x1b')];var _0x405b66=_[_0x15c4('0x1c')](_0x494afb,_0x2512d2);BPromise[_0x15c4('0x1d')]()[_0x15c4('0x1e')](cmContactRpc[_0x15c4('0x1f')]({'attributes':_0x405b66,'where':_0x2175ad}))[_0x15c4('0x1e')](function(_0x21decf){_0x438319=_0x21decf;if(!_['isEmpty'](_0x438319)){if(_0x438319[_0x15c4('0x20')]===0x1){_0x45d8f2=_0x438319[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0x269ac9[_0x15c4('0x21')],_0x5ab093['id'],_0x45d8f2['id']);}else{logger[_0x15c4('0x9')](_0x15c4('0x22'),_0x269ac9['uniqueid'],_0x5ab093['id'],_[_0x15c4('0x13')](_0x438319,'id')[_0x15c4('0x23')](','));}return;}else{logger[_0x15c4('0x9')](_0x15c4('0x24'),_0x269ac9['uniqueid'],_0x5ab093['id']);var _0x3597f8={'ListId':_0x4fa3ec};var _0x8caa92=_0x330163[_0x15c4('0x25')]&&_0x330163[_0x15c4('0x25')]!=='0'?_0x330163[_0x15c4('0x25')]:_0x15c4('0x12');if(_0x383fb8){logger['info'](_0x15c4('0x26'),_0x269ac9[_0x15c4('0x21')],_0x5ab093['id']);_0x3597f8[_0x8caa92]=_[_0x15c4('0x27')](_0x269ac9[_0x15c4('0x28')])?_0x269ac9[_0x15c4('0x15')]:_0x269ac9['destcalleridnum'];if(_['isNil'](_0x269ac9[_0x15c4('0x28')])){_0x3597f8[_0x15c4('0x16')]=_0x269ac9[_0x15c4('0x29')]&&_0x269ac9[_0x15c4('0x29')]!==''?_0x269ac9[_0x15c4('0x29')]:_0x15c4('0x2a');}else{_0x3597f8[_0x15c4('0x16')]=_0x269ac9[_0x15c4('0x2b')]&&_0x269ac9[_0x15c4('0x2b')]!==_0x15c4('0x2c')?_0x269ac9[_0x15c4('0x2b')]:_0x15c4('0x2a');}return BPromise[_0x15c4('0x1d')]()[_0x15c4('0x1e')](cmContactRpc[_0x15c4('0x2d')](_0x3597f8))[_0x15c4('0x1e')](function(_0x32161a){_0x45d8f2=_0x32161a;_0x438319[_0x15c4('0x2e')](_0x32161a);if(_0x45d8f2){logger['info'](_0x15c4('0x2f'),_0x269ac9[_0x15c4('0x21')],_0x5ab093['id'],_0x45d8f2['id']);}return;});}else{logger[_0x15c4('0x9')](_0x15c4('0x30'),_0x269ac9[_0x15c4('0x21')],_0x5ab093['id']);_0x3597f8[_0x8caa92]=_[_0x15c4('0x27')](_0x269ac9[_0x15c4('0x28')])?_0x269ac9[_0x15c4('0x15')]:_0x269ac9[_0x15c4('0x14')];if(_['isNil'](_0x269ac9[_0x15c4('0x28')])){_0x3597f8[_0x15c4('0x16')]=_0x269ac9[_0x15c4('0x29')]&&_0x269ac9[_0x15c4('0x29')]!==''?_0x269ac9[_0x15c4('0x29')]:'Unknown';}else{_0x3597f8[_0x15c4('0x16')]=_0x269ac9['destcalleridname']&&_0x269ac9[_0x15c4('0x2b')]!==''?_0x269ac9[_0x15c4('0x2b')]:'Unknown';}_0x45d8f2=_0x3597f8;_0x438319[_0x15c4('0x2e')](_0x3597f8);return;}}})[_0x15c4('0x1e')](function(){if(_0x105fad){emit(_0x269ac9[_0x15c4('0x21')],_0x5ab093,util['format'](_0x15c4('0x31'),_0x105fad['name']),util[_0x15c4('0x32')](_0x15c4('0x33'),_0x330163[_0x15c4('0x34')][_0x15c4('0x35')]()),{'evt':_[_0x15c4('0x36')](_0x269ac9,{'autoCreate':_0x383fb8}),'contact':_0x45d8f2===undefined?{}:_0x45d8f2,'contacts':_0x438319['length']===0x0?undefined:_0x438319});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index bd75ba7..089e6ab 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 _0xdcc2=['query','search','replace','AllConditions','every','AnyConditions','channel','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','membername','lastevent','exports','util','url','mustache','ioredis','./urlforward','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','custom:agentringnoanswer','syncCustomEvent','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','info','stringify','emit','checkTriggers','agents','interface','status','checkTrigger','merge','Actions','length','toLowerCase','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','name','format','trigger:%s:%s','action','jscripty','user:%s','trigger:%s','contactmanager','exec','integration','queue','routeId','script'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xdcc2,0x16b));var _0x2dcc=function(_0xfcfaad,_0x4dcde4){_0xfcfaad=_0xfcfaad-0x0;var _0x5533b3=_0xdcc2[_0xfcfaad];return _0x5533b3;};'use strict';var util=require(_0x2dcc('0x0'));var _=require('lodash');var url=require(_0x2dcc('0x1'));var Mustache=require(_0x2dcc('0x2'));var Redis=require(_0x2dcc('0x3'));var urlforward=require(_0x2dcc('0x4'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require('./script');var config=require('../../../config/environment');var logger=require(_0x2dcc('0x5'))(_0x2dcc('0x6'));var ami=require(_0x2dcc('0x7'));config[_0x2dcc('0x8')]=_[_0x2dcc('0x9')](config['redis'],{'host':_0x2dcc('0xa'),'port':0x18eb});var io=require(_0x2dcc('0xb'))(new Redis(config[_0x2dcc('0x8')]));var operators={'equals':function(_0x42c499,_0x3002f9){return _0x42c499==_0x3002f9;},'not_equals':function(_0x1c74db,_0x1bdf15){return _0x1c74db!=_0x1bdf15;}};var barAndWebActions=[_0x2dcc('0xc'),_0x2dcc('0x1'),_0x2dcc('0xd')];function Trigger(_0x3b2087){this[_0x2dcc('0xe')]=_0x3b2087[_0x2dcc('0xe')];this['agents']=_0x3b2087['agents'];this['voiceQueues']=_0x3b2087['voiceQueues'];this[_0x2dcc('0xf')]=_0x3b2087[_0x2dcc('0xf')];this[_0x2dcc('0x10')]=_0x3b2087[_0x2dcc('0x10')];this[_0x2dcc('0x11')]=_0x3b2087[_0x2dcc('0x11')];this[_0x2dcc('0x12')]=_0x3b2087[_0x2dcc('0x12')];this[_0x2dcc('0x13')]=_0x3b2087[_0x2dcc('0x13')];this[_0x2dcc('0x14')]=_0x3b2087['sugarcrmAccounts'];this['zohoAccounts']=_0x3b2087[_0x2dcc('0x15')];this[_0x2dcc('0x16')]=_0x3b2087[_0x2dcc('0x16')];this[_0x2dcc('0x17')]=_0x3b2087[_0x2dcc('0x17')];this[_0x2dcc('0x18')]=_0x3b2087[_0x2dcc('0x18')];this[_0x2dcc('0x19')]=_0x3b2087[_0x2dcc('0x19')];this['freshsalesAccounts']=_0x3b2087[_0x2dcc('0x1a')];this[_0x2dcc('0x1b')]={'zendesk':this[_0x2dcc('0x11')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x2dcc('0x14')],'zoho':this['zohoAccounts'],'desk':this[_0x2dcc('0x16')],'vtiger':this[_0x2dcc('0x17')],'dynamics365':this[_0x2dcc('0x19')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x2dcc('0x18')]};ami['on'](_0x2dcc('0x1c'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentconnect',this['syncCustomEvent'][_0x2dcc('0x1d')](this));ami['on'](_0x2dcc('0x1e'),this[_0x2dcc('0x1f')]['bind'](this));ami['on'](_0x2dcc('0x20'),this[_0x2dcc('0x1f')][_0x2dcc('0x1d')](this));ami['on']('custom:agentnosuchnumber',this[_0x2dcc('0x1f')][_0x2dcc('0x1d')](this));ami['on'](_0x2dcc('0x21'),this[_0x2dcc('0x1f')]['bind'](this));ami['on'](_0x2dcc('0x22'),this[_0x2dcc('0x1f')][_0x2dcc('0x1d')](this));ami['on'](_0x2dcc('0x23'),this['syncCustomEvent']['bind'](this));ami['on'](_0x2dcc('0x24'),this[_0x2dcc('0x1f')][_0x2dcc('0x1d')](this));ami['on'](_0x2dcc('0x25'),this['syncCustomEvent'][_0x2dcc('0x1d')](this));ami['on']('custom:timeout',this[_0x2dcc('0x1f')][_0x2dcc('0x1d')](this));ami['on'](_0x2dcc('0x26'),this['syncAgentDial'][_0x2dcc('0x1d')](this));ami['on'](_0x2dcc('0x27'),this['syncAgentDial'][_0x2dcc('0x1d')](this));ami['on']('custom:dialend',this[_0x2dcc('0x28')][_0x2dcc('0x1d')](this));ami['on'](_0x2dcc('0x29'),this[_0x2dcc('0x1f')][_0x2dcc('0x1d')](this));ami['on']('custom:closedinteraction',this[_0x2dcc('0x1f')][_0x2dcc('0x1d')](this));ami['on'](_0x2dcc('0x2a'),this[_0x2dcc('0x1f')][_0x2dcc('0x1d')](this));ami['on'](_0x2dcc('0x2b'),this[_0x2dcc('0x1f')]['bind'](this));ami['on'](_0x2dcc('0x2c'),this['syncCustomEvent']['bind'](this));ami['on'](_0x2dcc('0x2d'),this[_0x2dcc('0x1f')][_0x2dcc('0x1d')](this));}Trigger[_0x2dcc('0x2e')]['emit']=function(_0x218c44,_0x277df4,_0x2ee617){logger[_0x2dcc('0x2f')](_0x218c44,_0x277df4,JSON[_0x2dcc('0x30')](_0x2ee617));io['to'](_0x218c44)[_0x2dcc('0x31')](_0x277df4,_0x2ee617);};Trigger['prototype'][_0x2dcc('0x1f')]=function(_0x4b6c94){var _0x45b110=_['clone'](_0x4b6c94);this[_0x2dcc('0x32')](_0x45b110);};Trigger['prototype'][_0x2dcc('0x28')]=function(_0x1697d5){if(this[_0x2dcc('0x33')][_0x1697d5[_0x2dcc('0x34')]]){this[_0x2dcc('0x1f')](_0x1697d5);}};Trigger[_0x2dcc('0x2e')][_0x2dcc('0x32')]=function(_0x52b649){var _0x3fb2b5;for(var _0x5c727a in this['triggers']){if(this[_0x2dcc('0xe')]['hasOwnProperty'](_0x5c727a)){if(this[_0x2dcc('0xe')][_0x5c727a][_0x2dcc('0x35')]){_0x3fb2b5=this[_0x2dcc('0x36')](this[_0x2dcc('0xe')][_0x5c727a],_0x52b649);if(_0x3fb2b5){_[_0x2dcc('0x37')](_0x52b649,_0x52b649['variables']);for(var _0x2f7a0a=0x0,_0x4026e6,_0x27b01b,_0xcaa93f;_0x2f7a0a0x0){_0x57c21a=_[_0xec3d('0x2b')](_0x54619b,_0x858597);}return _0x57c21a;}function getCustomFields(_0x54e41b,_0x429677){var _0x52586c=[];var _0x52f2a5={'custom_fields':{}};if(_0x54e41b[_0xec3d('0x2a')]>0x0){_[_0xec3d('0x2c')](_0x54e41b,function(_0x474122){if(_[_0xec3d('0x2d')]([_0xec3d('0x2e'),_0xec3d('0x2f')],_0x474122['type'])&&_0x474122['nameField']&&!_0x474122['customField']){_0x52f2a5[_0x474122[_0xec3d('0x30')][_0xec3d('0x31')]()]=_0x474122['content'][_0xec3d('0x24')]();}else if(_[_0xec3d('0x2d')]([_0xec3d('0x2e'),_0xec3d('0x2f')],_0x474122[_0xec3d('0x32')])&&_0x474122['idField']&&_0x474122[_0xec3d('0x33')]){_0x52f2a5['custom_fields'][_0x474122[_0xec3d('0x34')]]=_0x474122[_0xec3d('0x35')]['toString']();}else if(_0x474122['type']===_0xec3d('0x36')&&_0x474122[_0xec3d('0x37')]&&_0x474122[_0xec3d('0x34')]&&_0x474122[_0xec3d('0x33')]){_0x429677[_0x474122[_0xec3d('0x37')]]&&(_0x52f2a5[_0xec3d('0x38')][_0x474122[_0xec3d('0x34')]]=_0x429677[_0x474122[_0xec3d('0x37')]]['toString']());}else if(_0x474122['type']===_0xec3d('0x39')&&_0x474122[_0xec3d('0x3a')]&&_0x474122[_0xec3d('0x3a')][_0xec3d('0x3b')]&&_0x474122[_0xec3d('0x34')]&&_0x474122[_0xec3d('0x33')]){_0x429677[_0x474122[_0xec3d('0x3a')][_0xec3d('0x3b')][_0xec3d('0x31')]()]&&(_0x52f2a5[_0xec3d('0x38')][_0x474122[_0xec3d('0x34')]]=_0x429677[_0x474122[_0xec3d('0x3a')][_0xec3d('0x3b')]['toLowerCase']()][_0xec3d('0x24')]());}});}if(_0x52f2a5[_0xec3d('0x3c')]){_0x52f2a5['priority']=Number(_0x52f2a5['priority']);}return _0x52f2a5;}function getTicket(_0x50e2f8,_0xd1cef4,_0x3133b8,_0x5dca59,_0x3dc106){logger[_0xec3d('0xd')](_0xec3d('0x3d'));var _0x51ff70=_[_0xec3d('0x3e')]({'subject':intUtil['getString'](_0x5dca59[_0xec3d('0x3f')],_0x3dc106,'\x20'),'type':_0xec3d('0x40'),'status':_0xec3d('0x41'),'labels':[_0xec3d('0x42'),_0xec3d('0x43'),_0xec3d('0x44')][_0xec3d('0x45')](getTags(_0x5dca59[_0xec3d('0x46')],_0xec3d('0x3b'))),'description':intUtil[_0xec3d('0x47')](_0x5dca59[_0xec3d('0x48')],_0x3dc106,'\x0a'),'_links':{'assigned_user':{'href':util[_0xec3d('0xf')]('/api/v2/users/%d',_0xd1cef4['id']),'class':_0xec3d('0x49')}},'message':{'direction':'in','body':intUtil[_0xec3d('0x47')](_0x5dca59[_0xec3d('0x48')],_0x3dc106,'\x0a')}},getCustomFields(_0x5dca59[_0xec3d('0x4a')],_0x3dc106));return request({'uri':util[_0xec3d('0xf')](_0xec3d('0x4b'),_0x50e2f8[_0xec3d('0x11')],_0x3133b8['id']),'method':'POST','body':_0x51ff70});}exports[_0xec3d('0x4c')]=function(_0x5d9fe4,_0x263601,_0x5d26c5,_0x318df4,_0x3615dd,_0x3b4617){var _0x42b603,_0x4e648;_0x3b4617[_0xec3d('0x11')]=intUtil[_0xec3d('0x4d')](_0x3b4617[_0xec3d('0x11')]);_0x3b4617[_0xec3d('0x4e')]=intUtil[_0xec3d('0x4d')](_0x3b4617[_0xec3d('0x4e')]);if(_0x3615dd&&_0x3615dd[_0xec3d('0x4f')]){logger[_0xec3d('0xd')](_0xec3d('0x50'),_0xec3d('0x51'));_0x263601[_0xec3d('0x52')]=util[_0xec3d('0xf')](_0xec3d('0x53'),_0x3b4617[_0xec3d('0x4e')],_0x263601['uniqueid'],md5(_0x263601[_0xec3d('0x54')]));}else{_0x263601[_0xec3d('0x52')]='';}headers['Authorization']=getAuth(_0x3b4617);return getUser(_0x3b4617,_0x318df4['email'])[_0xec3d('0x12')](function(_0x2fb3d2){_0x42b603=_0x2fb3d2;logger['info'](_0xec3d('0x55'),_0x42b603['id']);return getEndUser(_0x3b4617,_0x263601[_0xec3d('0x56')],_0x263601[_0xec3d('0x57')]);})[_0xec3d('0x12')](function(_0x4b45a9){_0x4e648=_0x4b45a9;logger[_0xec3d('0xd')](_0xec3d('0x58'),_0x4e648['id']);return getTicket(_0x3b4617,_0x42b603,_0x4e648,_0x5d26c5,_0x263601);})[_0xec3d('0x12')](function(_0x15c48b){if(_0x15c48b){logger[_0xec3d('0xd')](_0xec3d('0x59'));logger[_0xec3d('0xd')]('The\x20Ticket\x20ID\x20is:',_0x15c48b['id']);switch(_0x3b4617['type']){case _0xec3d('0x5a'):logger[_0xec3d('0xd')](_0xec3d('0x50'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xec3d('0xf')](_0xec3d('0x5b'),_0x318df4[_0xec3d('0x3b')]),'trigger:desk:display',{'recordId':_0x15c48b['id']});break;case _0xec3d('0x5c'):logger[_0xec3d('0xd')](_0xec3d('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xec3d('0xf')](_0xec3d('0x5b'),_0x318df4['name']),_0xec3d('0x5d'),{'uri':util[_0xec3d('0xf')](_0xec3d('0x5e'),_0x15c48b['id'])});break;default:logger[_0xec3d('0x5f')](_0xec3d('0x50'),_0xec3d('0x60'));}}})[_0xec3d('0x61')](function(_0x50ade0){console[_0xec3d('0x5f')](_0x50ade0);logger[_0xec3d('0x5f')](_0xec3d('0x50'),JSON[_0xec3d('0x1c')](_0x50ade0));});};exports['outbound']=function(_0x5a9c43,_0x27dc64,_0x44d77c,_0x2de33c,_0x3e8413,_0x59ddcc,_0x3400d3){var _0x5b7788,_0x2b4869;_0x59ddcc[_0xec3d('0x11')]=intUtil[_0xec3d('0x4d')](_0x59ddcc[_0xec3d('0x11')]);_0x59ddcc[_0xec3d('0x4e')]=intUtil[_0xec3d('0x4d')](_0x59ddcc[_0xec3d('0x4e')]);if(_0x3400d3&&_0x3400d3[_0xec3d('0x62')]&&_0x3400d3[_0xec3d('0x62')]!==_0xec3d('0x63')){logger[_0xec3d('0xd')](_0xec3d('0x64'),'Recording\x20is\x20enabled!');_0x27dc64[_0xec3d('0x52')]=util[_0xec3d('0xf')](_0xec3d('0x53'),_0x59ddcc['serverUrl'],_0x27dc64['uniqueid'],md5(_0x27dc64[_0xec3d('0x54')]));}headers[_0xec3d('0x65')]=getAuth(_0x59ddcc);return getUser(_0x59ddcc,_0x2de33c[_0xec3d('0x66')])[_0xec3d('0x12')](function(_0x68873){_0x5b7788=_0x68873;logger[_0xec3d('0xd')](_0xec3d('0x55'),_0x5b7788['id']);return getEndUser(_0x59ddcc,_0x27dc64[_0xec3d('0x67')],_0x27dc64[_0xec3d('0x68')]);})[_0xec3d('0x12')](function(_0x1323a7){_0x2b4869=_0x1323a7;logger['info'](_0xec3d('0x58'),_0x2b4869['id']);return getTicket(_0x59ddcc,_0x5b7788,_0x2b4869,_0x44d77c,_0x27dc64);})[_0xec3d('0x12')](function(_0x12ea0c){if(_0x12ea0c){logger['info'](_0xec3d('0x59'));logger[_0xec3d('0xd')](_0xec3d('0x69'),_0x12ea0c['id']);switch(_0x59ddcc['type']){case _0xec3d('0x5a'):logger[_0xec3d('0xd')]('[QUEUE]',_0xec3d('0x6a'));emit(util[_0xec3d('0xf')](_0xec3d('0x5b'),_0x2de33c[_0xec3d('0x3b')]),_0xec3d('0x6b'),{'recordId':_0x12ea0c['id']});break;case _0xec3d('0x5c'):logger[_0xec3d('0xd')](_0xec3d('0x50'),_0xec3d('0x6c'));emit(util[_0xec3d('0xf')](_0xec3d('0x5b'),_0x2de33c[_0xec3d('0x3b')]),_0xec3d('0x5d'),{'uri':util[_0xec3d('0xf')](_0xec3d('0x6d'),_0x59ddcc['remoteUri'],_0x12ea0c['id'])});break;default:logger['error'](_0xec3d('0x64'),_0xec3d('0x60'));}}})[_0xec3d('0x61')](function(_0x2ff6b2){logger[_0xec3d('0x5f')](_0xec3d('0x64'),JSON['stringify'](_0x2ff6b2));});};exports['unmanaged']=function(_0x136ca8,_0x16af6d,_0x4306a8,_0x23477f,_0x9b50ea,_0x1f2465){var _0x575ab8,_0x58a112;_0x1f2465[_0xec3d('0x11')]=intUtil[_0xec3d('0x4d')](_0x1f2465[_0xec3d('0x11')]);_0x1f2465[_0xec3d('0x4e')]=intUtil[_0xec3d('0x4d')](_0x1f2465[_0xec3d('0x4e')]);if(_0x9b50ea&&_0x9b50ea['monitor_format']){logger['info']('['+_0x16af6d[_0xec3d('0x6e')][_0xec3d('0x6f')]()+']',_0xec3d('0x51'));_0x16af6d['recordingURL']=util[_0xec3d('0xf')](_0xec3d('0x53'),_0x1f2465[_0xec3d('0x4e')],_0x16af6d[_0xec3d('0x54')],md5(_0x16af6d[_0xec3d('0x54')]));}else{_0x16af6d[_0xec3d('0x52')]='';}headers[_0xec3d('0x65')]=getAuth(_0x1f2465);return getUser(_0x1f2465)[_0xec3d('0x12')](function(_0x4d002d){_0x575ab8=_0x4d002d;logger[_0xec3d('0xd')](_0xec3d('0x55'),_0x575ab8['id']);return getEndUser(_0x1f2465,_0x16af6d[_0xec3d('0x56')],_0x16af6d['calleridnum']);})['then'](function(_0x22cc28){_0x58a112=_0x22cc28;logger[_0xec3d('0xd')](_0xec3d('0x58'),_0x58a112['id']);return getTicket(_0x1f2465,_0x575ab8,_0x58a112,_0x4306a8,_0x16af6d);})[_0xec3d('0x12')](function(_0x40c3c5){if(_0x40c3c5){logger[_0xec3d('0xd')](_0xec3d('0x59'));logger[_0xec3d('0xd')](_0xec3d('0x69'),_0x40c3c5['id']);}})[_0xec3d('0x61')](function(_0x4e7dac){logger[_0xec3d('0x5f')]('['+_0x16af6d['lastevent'][_0xec3d('0x6f')]()+']',JSON['stringify'](_0x4e7dac));});}; \ No newline at end of file +var _0x98fa=['Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','total_entries','Enduser\x20found!','%s/customers','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','custom_fields','idField','variable','variableName','customVariable','Variable','name','priority','merge','Subjects','new','Motion','concat','Tags','getString','Descriptions','/api/v2/users/%d','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','Desk\x20account\x20type\x20not\x20recognized','catch','error','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','integrationTab','trigger:desk:display','newTab','%s/agent/tickets/%s','unmanaged','monitor_format','lastevent','Authorization','toUpperCase','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','find','_embedded','entries'];(function(_0x1a809b,_0x4c15e3){var _0x5d90e6=function(_0x5dd2e1){while(--_0x5dd2e1){_0x1a809b['push'](_0x1a809b['shift']());}};_0x5d90e6(++_0x4c15e3);}(_0x98fa,0x192));var _0xa98f=function(_0x4551bc,_0x4aa7fd){_0x4551bc=_0x4551bc-0x0;var _0xc98125=_0x98fa[_0x4551bc];return _0xc98125;};'use strict';var _=require(_0xa98f('0x0'));var rp=require('request-promise');var md5=require(_0xa98f('0x1'));var util=require(_0xa98f('0x2'));var Redis=require(_0xa98f('0x3'));var intUtil=require('./util');var config=require(_0xa98f('0x4'));var logger=require(_0xa98f('0x5'))('desk');config[_0xa98f('0x6')]=_[_0xa98f('0x7')](config[_0xa98f('0x6')],{'host':_0xa98f('0x8'),'port':0x18eb});var io=require(_0xa98f('0x9'))(new Redis(config[_0xa98f('0x6')]));function emit(_0x4dbb0f,_0x4df9cd,_0x293ca1){io['to'](_0x4dbb0f)[_0xa98f('0xa')](_0x4df9cd,_0x293ca1);}var headers={'Content-Type':_0xa98f('0xb'),'Accept':'application/json'};function getUser(_0x116f5e,_0x214e4e){if(intUtil[_0xa98f('0xc')](_0x214e4e)===!![]){logger[_0xa98f('0xd')](_0xa98f('0xe'),_0x214e4e);return request({'uri':util[_0xa98f('0xf')](_0xa98f('0x10'),_0x116f5e[_0xa98f('0x11')])})[_0xa98f('0x12')](function(_0x136fc9){if(_0x136fc9['total_entries']){return _[_0xa98f('0x13')](_0x136fc9[_0xa98f('0x14')][_0xa98f('0x15')],{'email':_0x214e4e});}})[_0xa98f('0x12')](function(_0x47ffbb){if(_0x47ffbb){logger[_0xa98f('0xd')](_0xa98f('0x16'));return _0x47ffbb;}else{logger[_0xa98f('0xd')](_0xa98f('0x17'));return request({'uri':util[_0xa98f('0xf')](_0xa98f('0x18'),_0x116f5e[_0xa98f('0x11')])});}});}else{logger[_0xa98f('0xd')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa98f('0xf')](_0xa98f('0x18'),_0x116f5e['remoteUri'])});}}function request(_0x24df9d){logger[_0xa98f('0x19')](_0xa98f('0x1a'),JSON[_0xa98f('0x1b')](_0x24df9d));return rp(_[_0xa98f('0x7')](_0x24df9d,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x217ef1){var _0x373433;if(_0x217ef1[_0xa98f('0x1c')]==='basic'){_0x373433=util[_0xa98f('0xf')](_0xa98f('0x1d'),_0x217ef1[_0xa98f('0x1e')],_0x217ef1[_0xa98f('0x1f')]);}else if(_0x217ef1['authType']===_0xa98f('0x20')){_0x373433=util['format'](_0xa98f('0x21'),_0x217ef1[_0xa98f('0x1e')],_0x217ef1[_0xa98f('0x20')]);}return util['format'](_0xa98f('0x22'),new Buffer(_0x373433)[_0xa98f('0x23')](_0xa98f('0x24')));}function getEndUser(_0x4f51ef,_0x36ac44,_0x59c907){logger[_0xa98f('0xd')](_0xa98f('0x25'),_0x59c907);return request({'uri':util[_0xa98f('0xf')](_0xa98f('0x26'),_0x4f51ef[_0xa98f('0x11')]),'qs':{'phone':_0x59c907}})[_0xa98f('0x12')](function(_0x5d4036){if(_0x5d4036[_0xa98f('0x27')]){logger['info'](_0xa98f('0x28'));return _0x5d4036['_embedded']['entries'][0x0];}else{logger[_0xa98f('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xa98f('0x29'),_0x4f51ef[_0xa98f('0x11')]),'method':_0xa98f('0x2a'),'body':{'first_name':_0x36ac44,'title':_0x36ac44,'phone_numbers':[{'type':'work','value':_0x59c907}]}});}});}function getTags(_0x3b1c64,_0x3531ef){var _0x3424e0=[];if(_0x3b1c64&&_0x3b1c64[_0xa98f('0x2b')]>0x0){_0x3424e0=_[_0xa98f('0x2c')](_0x3b1c64,_0x3531ef);}return _0x3424e0;}function getCustomFields(_0x579e77,_0x3fb0c0){var _0x238f14=[];var _0x1c1a0e={'custom_fields':{}};if(_0x579e77['length']>0x0){_[_0xa98f('0x2d')](_0x579e77,function(_0x354ccd){if(_[_0xa98f('0x2e')]([_0xa98f('0x2f'),_0xa98f('0x30')],_0x354ccd[_0xa98f('0x31')])&&_0x354ccd[_0xa98f('0x32')]&&!_0x354ccd[_0xa98f('0x33')]){_0x1c1a0e[_0x354ccd[_0xa98f('0x32')][_0xa98f('0x34')]()]=_0x354ccd['content'][_0xa98f('0x23')]();}else if(_[_0xa98f('0x2e')]([_0xa98f('0x2f'),_0xa98f('0x30')],_0x354ccd['type'])&&_0x354ccd['idField']&&_0x354ccd[_0xa98f('0x33')]){_0x1c1a0e[_0xa98f('0x35')][_0x354ccd[_0xa98f('0x36')]]=_0x354ccd['content'][_0xa98f('0x23')]();}else if(_0x354ccd['type']===_0xa98f('0x37')&&_0x354ccd[_0xa98f('0x38')]&&_0x354ccd[_0xa98f('0x36')]&&_0x354ccd[_0xa98f('0x33')]){_0x3fb0c0[_0x354ccd[_0xa98f('0x38')]]&&(_0x1c1a0e[_0xa98f('0x35')][_0x354ccd[_0xa98f('0x36')]]=_0x3fb0c0[_0x354ccd['variableName']][_0xa98f('0x23')]());}else if(_0x354ccd['type']===_0xa98f('0x39')&&_0x354ccd[_0xa98f('0x3a')]&&_0x354ccd[_0xa98f('0x3a')][_0xa98f('0x3b')]&&_0x354ccd[_0xa98f('0x36')]&&_0x354ccd['customField']){_0x3fb0c0[_0x354ccd[_0xa98f('0x3a')][_0xa98f('0x3b')][_0xa98f('0x34')]()]&&(_0x1c1a0e[_0xa98f('0x35')][_0x354ccd[_0xa98f('0x36')]]=_0x3fb0c0[_0x354ccd['Variable'][_0xa98f('0x3b')][_0xa98f('0x34')]()][_0xa98f('0x23')]());}});}if(_0x1c1a0e['priority']){_0x1c1a0e[_0xa98f('0x3c')]=Number(_0x1c1a0e[_0xa98f('0x3c')]);}return _0x1c1a0e;}function getTicket(_0x39a42c,_0x4144c3,_0x337bd8,_0x3f909a,_0x7af825){logger[_0xa98f('0xd')]('Creating\x20new\x20ticket...');var _0x335aca=_[_0xa98f('0x3d')]({'subject':intUtil['getString'](_0x3f909a[_0xa98f('0x3e')],_0x7af825,'\x20'),'type':'phone','status':_0xa98f('0x3f'),'labels':['xCALLY',_0xa98f('0x40'),'CTI'][_0xa98f('0x41')](getTags(_0x3f909a[_0xa98f('0x42')],_0xa98f('0x3b'))),'description':intUtil[_0xa98f('0x43')](_0x3f909a[_0xa98f('0x44')],_0x7af825,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa98f('0xf')](_0xa98f('0x45'),_0x4144c3['id']),'class':'user'}},'message':{'direction':'in','body':intUtil[_0xa98f('0x43')](_0x3f909a[_0xa98f('0x44')],_0x7af825,'\x0a')}},getCustomFields(_0x3f909a[_0xa98f('0x46')],_0x7af825));return request({'uri':util[_0xa98f('0xf')](_0xa98f('0x47'),_0x39a42c[_0xa98f('0x11')],_0x337bd8['id']),'method':_0xa98f('0x2a'),'body':_0x335aca});}exports[_0xa98f('0x48')]=function(_0x27cc86,_0x2e2dcc,_0x4b881c,_0x18a3a0,_0x22e8f0,_0xc701ef){var _0x5b3d53,_0x5e40f7;_0xc701ef['remoteUri']=intUtil[_0xa98f('0x49')](_0xc701ef[_0xa98f('0x11')]);_0xc701ef[_0xa98f('0x4a')]=intUtil[_0xa98f('0x49')](_0xc701ef[_0xa98f('0x4a')]);if(_0x22e8f0&&_0x22e8f0['monitor_format']){logger['info'](_0xa98f('0x4b'),_0xa98f('0x4c'));_0x2e2dcc[_0xa98f('0x4d')]=util[_0xa98f('0xf')](_0xa98f('0x4e'),_0xc701ef[_0xa98f('0x4a')],_0x2e2dcc['uniqueid'],md5(_0x2e2dcc['uniqueid']));}else{_0x2e2dcc[_0xa98f('0x4d')]='';}headers['Authorization']=getAuth(_0xc701ef);return getUser(_0xc701ef,_0x18a3a0[_0xa98f('0x4f')])[_0xa98f('0x12')](function(_0x340049){_0x5b3d53=_0x340049;logger['info'](_0xa98f('0x50'),_0x5b3d53['id']);return getEndUser(_0xc701ef,_0x2e2dcc[_0xa98f('0x51')],_0x2e2dcc[_0xa98f('0x52')]);})[_0xa98f('0x12')](function(_0x20c197){_0x5e40f7=_0x20c197;logger[_0xa98f('0xd')](_0xa98f('0x53'),_0x5e40f7['id']);return getTicket(_0xc701ef,_0x5b3d53,_0x5e40f7,_0x4b881c,_0x2e2dcc);})[_0xa98f('0x12')](function(_0x2fe879){if(_0x2fe879){logger[_0xa98f('0xd')](_0xa98f('0x54'));logger[_0xa98f('0xd')]('The\x20Ticket\x20ID\x20is:',_0x2fe879['id']);switch(_0xc701ef[_0xa98f('0x31')]){case'integrationTab':logger[_0xa98f('0xd')](_0xa98f('0x4b'),_0xa98f('0x55'));emit(util[_0xa98f('0xf')](_0xa98f('0x56'),_0x18a3a0['name']),'trigger:desk:display',{'recordId':_0x2fe879['id']});break;case'newTab':logger['info'](_0xa98f('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x18a3a0[_0xa98f('0x3b')]),_0xa98f('0x57'),{'uri':util[_0xa98f('0xf')](_0xa98f('0x58'),_0x2fe879['id'])});break;default:logger['error'](_0xa98f('0x4b'),_0xa98f('0x59'));}}})[_0xa98f('0x5a')](function(_0x5a8dfa){console[_0xa98f('0x5b')](_0x5a8dfa);logger[_0xa98f('0x5b')]('[QUEUE]',JSON[_0xa98f('0x1b')](_0x5a8dfa));});};exports[_0xa98f('0x5c')]=function(_0x533fc9,_0x3ac50a,_0x42b77d,_0x4f4ca9,_0x1263c5,_0x380cae,_0x1b9fa5){var _0x249032,_0x284501;_0x380cae[_0xa98f('0x11')]=intUtil[_0xa98f('0x49')](_0x380cae['remoteUri']);_0x380cae['serverUrl']=intUtil[_0xa98f('0x49')](_0x380cae[_0xa98f('0x4a')]);if(_0x1b9fa5&&_0x1b9fa5['recordingFormat']&&_0x1b9fa5[_0xa98f('0x5d')]!==_0xa98f('0x5e')){logger[_0xa98f('0xd')](_0xa98f('0x5f'),_0xa98f('0x4c'));_0x3ac50a[_0xa98f('0x4d')]=util[_0xa98f('0xf')](_0xa98f('0x4e'),_0x380cae[_0xa98f('0x4a')],_0x3ac50a[_0xa98f('0x60')],md5(_0x3ac50a[_0xa98f('0x60')]));}headers['Authorization']=getAuth(_0x380cae);return getUser(_0x380cae,_0x4f4ca9[_0xa98f('0x4f')])[_0xa98f('0x12')](function(_0x2f6fe5){_0x249032=_0x2f6fe5;logger[_0xa98f('0xd')](_0xa98f('0x50'),_0x249032['id']);return getEndUser(_0x380cae,_0x3ac50a['destcalleridname'],_0x3ac50a['destcalleridnum']);})['then'](function(_0x3e93ab){_0x284501=_0x3e93ab;logger[_0xa98f('0xd')](_0xa98f('0x53'),_0x284501['id']);return getTicket(_0x380cae,_0x249032,_0x284501,_0x42b77d,_0x3ac50a);})[_0xa98f('0x12')](function(_0xcdc0c5){if(_0xcdc0c5){logger[_0xa98f('0xd')](_0xa98f('0x54'));logger[_0xa98f('0xd')]('The\x20Ticket\x20ID\x20is:',_0xcdc0c5['id']);switch(_0x380cae[_0xa98f('0x31')]){case _0xa98f('0x61'):logger[_0xa98f('0xd')](_0xa98f('0x4b'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4f4ca9[_0xa98f('0x3b')]),_0xa98f('0x62'),{'recordId':_0xcdc0c5['id']});break;case _0xa98f('0x63'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa98f('0xf')]('user:%s',_0x4f4ca9[_0xa98f('0x3b')]),_0xa98f('0x57'),{'uri':util[_0xa98f('0xf')](_0xa98f('0x64'),_0x380cae[_0xa98f('0x11')],_0xcdc0c5['id'])});break;default:logger[_0xa98f('0x5b')]('[OUTBOUND]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x56a005){logger['error'](_0xa98f('0x5f'),JSON[_0xa98f('0x1b')](_0x56a005));});};exports[_0xa98f('0x65')]=function(_0x47fb21,_0x56e478,_0x5623a2,_0x36514f,_0x6258bf,_0x27db67){var _0x5c59fa,_0x497521;_0x27db67[_0xa98f('0x11')]=intUtil['stripTrailingSlash'](_0x27db67[_0xa98f('0x11')]);_0x27db67[_0xa98f('0x4a')]=intUtil[_0xa98f('0x49')](_0x27db67[_0xa98f('0x4a')]);if(_0x6258bf&&_0x6258bf[_0xa98f('0x66')]){logger[_0xa98f('0xd')]('['+_0x56e478[_0xa98f('0x67')]['toUpperCase']()+']',_0xa98f('0x4c'));_0x56e478[_0xa98f('0x4d')]=util[_0xa98f('0xf')](_0xa98f('0x4e'),_0x27db67[_0xa98f('0x4a')],_0x56e478[_0xa98f('0x60')],md5(_0x56e478[_0xa98f('0x60')]));}else{_0x56e478[_0xa98f('0x4d')]='';}headers[_0xa98f('0x68')]=getAuth(_0x27db67);return getUser(_0x27db67)[_0xa98f('0x12')](function(_0x133187){_0x5c59fa=_0x133187;logger[_0xa98f('0xd')](_0xa98f('0x50'),_0x5c59fa['id']);return getEndUser(_0x27db67,_0x56e478[_0xa98f('0x51')],_0x56e478[_0xa98f('0x52')]);})[_0xa98f('0x12')](function(_0x3201b){_0x497521=_0x3201b;logger[_0xa98f('0xd')](_0xa98f('0x53'),_0x497521['id']);return getTicket(_0x27db67,_0x5c59fa,_0x497521,_0x5623a2,_0x56e478);})[_0xa98f('0x12')](function(_0x378d1d){if(_0x378d1d){logger[_0xa98f('0xd')](_0xa98f('0x54'));logger[_0xa98f('0xd')]('The\x20Ticket\x20ID\x20is:',_0x378d1d['id']);}})[_0xa98f('0x5a')](function(_0x340349){logger[_0xa98f('0x5b')]('['+_0x56e478['lastevent'][_0xa98f('0x69')]()+']',JSON[_0xa98f('0x1b')](_0x340349));});}; \ 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 7c00259..ff40004 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 _0xda19=['%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','./util','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','clientId','username','password','clientSecret','then','access_token','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','validateEmail','email','userEmail','length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','POST','contacts','/systemusers(','odata-entityid','lastIndexOf','enduserId','catch','Bearer\x20','outbound','destcalleridnum','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','substring','indexOf','content','ticketType','incident','incidents','getString','Subjects','/contacts(','Fields','phonecall','phonecalls','calleridnum','Descriptions','queue','callDirection','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged'];(function(_0x3dc1a0,_0x1c10de){var _0x5c9f7f=function(_0x590234){while(--_0x590234){_0x3dc1a0['push'](_0x3dc1a0['shift']());}};_0x5c9f7f(++_0x1c10de);}(_0xda19,0xd5));var _0x9da1=function(_0x1178c3,_0x1e719f){_0x1178c3=_0x1178c3-0x0;var _0x23acab=_0xda19[_0x1178c3];return _0x23acab;};'use strict';var _=require('lodash');var BPromise=require(_0x9da1('0x0'));var rp=require(_0x9da1('0x1'));var util=require('util');var intUtil=require(_0x9da1('0x2'));var md5=require('md5');var Redis=require(_0x9da1('0x3'));var logger=require('../../../../config/logger')(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));config[_0x9da1('0x6')]=_[_0x9da1('0x7')](config[_0x9da1('0x6')],{'host':_0x9da1('0x8'),'port':0x18eb});var io=require(_0x9da1('0x9'))(new Redis(config[_0x9da1('0x6')]));function getAuthToken(_0x1c24e6,_0x5e2d18,_0x47df89){var _0x55f66b={'method':'POST','uri':_0x5e2d18,'form':{'client_id':_0x1c24e6[_0x9da1('0xa')],'resource':_0x1c24e6['remoteUri'],'username':_0x1c24e6[_0x9da1('0xb')],'password':_0x1c24e6[_0x9da1('0xc')],'grant_type':_0x9da1('0xc'),'client_secret':_0x1c24e6[_0x9da1('0xd')]},'json':!![]};return rp(_0x55f66b)[_0x9da1('0xe')](function(_0x396e23){return _0x396e23[_0x9da1('0xf')];})['catch'](function(_0x51bc88){logger[_0x9da1('0x10')]('['+[_0x47df89['toUpperCase']()]+_0x9da1('0x11'));return _0x51bc88[_0x9da1('0x12')];});}function getUser(_0xd2d225,_0x1ffa2a,_0x4b75cc,_0x2837e3,_0x535a13,_0x4d17e1){return new BPromise(function(_0x40ba9d,_0x479ccd){return getAuthToken(_0x1ffa2a,_0x2837e3,_0x4d17e1)[_0x9da1('0xe')](function(_0x43c093){var _0x37653d={'method':_0x9da1('0x13'),'uri':_0x535a13+_0x9da1('0x14'),'headers':{'Authorization':'Bearer\x20'+_0x43c093,'OData-Version':_0x9da1('0x15')},'json':!![]};return rp(_0x37653d);})[_0x9da1('0xe')](function(_0xf83bf8){var _0x77347a=_0xf83bf8[_0x9da1('0x16')];var _0x42a9c7=![];var _0x497676=null;if(!_['isNil'](_0x4b75cc)){if(intUtil[_0x9da1('0x17')](_0x4b75cc[_0x9da1('0x18')])){_0xd2d225[_0x9da1('0x19')]=_0x4b75cc[_0x9da1('0x18')];for(_0x497676=0x0;_0x497676<_0x77347a[_0x9da1('0x1a')];_0x497676++){if(_0x77347a[_0x497676][_0x9da1('0x1b')]===_0x4b75cc[_0x9da1('0x18')]&&!_0x77347a[_0x497676]['isdisabled']){_0x42a9c7=!![];logger[_0x9da1('0x1c')]('['+[_0x4d17e1[_0x9da1('0x1d')]()]+_0x9da1('0x1e')+_0x77347a[_0x497676][_0x9da1('0x1f')]+'!');_0xd2d225[_0x9da1('0x20')]=_0x77347a[_0x497676]['systemuserid'];}}}}if(!_0x42a9c7){logger['info']('['+[_0x4d17e1[_0x9da1('0x1d')]()]+_0x9da1('0x21'));_0xd2d225[_0x9da1('0x19')]=_0x1ffa2a[_0x9da1('0xb')];for(_0x497676=0x0;_0x497676<_0x77347a[_0x9da1('0x1a')];_0x497676++){if(_0x77347a[_0x497676][_0x9da1('0x1b')]===_0x1ffa2a['username']){_0xd2d225[_0x9da1('0x20')]=_0x77347a[_0x497676][_0x9da1('0x1f')];}}}_0x40ba9d(_0xd2d225);})['catch'](function(_0x45fcce){_0x479ccd(_0x45fcce[_0x9da1('0x12')]);});});}function createEndUser(_0x534210,_0x2fd49c,_0x16e12f,_0x4b1152,_0x36b87a,_0x1d6af5){return new BPromise(function(_0x55cd3d,_0x5c09ed){return getAuthToken(_0x2fd49c,_0x16e12f,_0x1d6af5)[_0x9da1('0xe')](function(_0x47055e){var _0x5eca5b=_0x1d6af5[_0x9da1('0x22')]()==='outbound'?_0x36b87a['destcalleridnum']:_0x36b87a['calleridnum'];var _0x31b826={'method':_0x9da1('0x23'),'uri':_0x4b1152+_0x9da1('0x24'),'body':{'telephone1':_0x5eca5b,'fullname':_0x5eca5b,'firstname':_0x5eca5b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x9da1('0x25')+_0x534210[_0x9da1('0x20')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x47055e,'OData-Version':_0x9da1('0x15')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x31b826);})['then'](function(_0x1feae0){var _0x235ced=_0x1feae0['headers'][_0x9da1('0x26')];var _0x2eb48f=_0x235ced['substring'](_0x235ced[_0x9da1('0x27')]('(')+0x1,_0x235ced[_0x9da1('0x27')](')'));_0x534210[_0x9da1('0x28')]=_0x2eb48f;_0x55cd3d(_0x534210);})[_0x9da1('0x29')](function(_0x581e9f){_0x5c09ed(_0x581e9f['message']);});});}function getEndUser(_0x4733c3,_0x354733,_0x1ea84f,_0x3ddd57,_0x193273,_0x559645){return new BPromise(function(_0x4b83f3,_0x343c64){return getAuthToken(_0x354733,_0x1ea84f,_0x559645)[_0x9da1('0xe')](function(_0x1d2106){var _0x45a068={'method':_0x9da1('0x13'),'uri':_0x3ddd57+'contacts?$select=telephone1','headers':{'Authorization':_0x9da1('0x2a')+_0x1d2106,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x45a068);})['then'](function(_0x3e62e1){var _0x484f39=null;if(_0x3e62e1){var _0x35879f=_0x3e62e1[_0x9da1('0x16')];var _0x35be8b=![];for(_0x484f39=0x0;_0x484f39<_0x35879f[_0x9da1('0x1a')];_0x484f39++){var _0x98b294=_0x559645[_0x9da1('0x22')]()===_0x9da1('0x2b')?_0x193273[_0x9da1('0x2c')]:_0x193273['calleridnum'];if(_0x35879f[_0x484f39][_0x9da1('0x2d')]===_0x98b294){_0x35be8b=!![];_0x4733c3['enduserId']=_0x35879f[_0x484f39][_0x9da1('0x2e')];}}if(_0x35be8b){_0x4b83f3(_0x4733c3);}else{return createEndUser(_0x4733c3,_0x354733,_0x1ea84f,_0x3ddd57,_0x193273,_0x559645)['then'](function(_0x5eaa7e){logger[_0x9da1('0x1c')]('['+[_0x559645['toUpperCase']()]+_0x9da1('0x2f'),_0x5eaa7e[_0x9da1('0x28')]);_0x4b83f3(_0x5eaa7e);});}}else{return createEndUser(_0x4733c3,_0x354733,_0x1ea84f,_0x3ddd57,_0x193273,_0x559645)['then'](function(_0x38242c){logger[_0x9da1('0x1c')]('['+[_0x559645[_0x9da1('0x1d')]()]+_0x9da1('0x30'),_0x38242c['enduserId']);_0x4b83f3(_0x38242c);});}});});}function getCustomFields(_0x257c2e,_0x5e7846,_0x2bb9e4){var _0x4bdaf1={};if(_0x257c2e[_0x9da1('0x1a')]>0x0){_[_0x9da1('0x31')](_0x257c2e,function(_0x58e165){if(_[_0x9da1('0x32')]([_0x9da1('0x33'),_0x9da1('0x34')],_0x58e165['type'])&&_0x58e165['nameField']&&!_0x58e165['customField']){var _0x27e78c=_0x58e165['idField'][_0x9da1('0x22')]();var _0x287afe=_0x27e78c[_0x9da1('0x35')](0x0,_0x27e78c[_0x9da1('0x36')]('_'));var _0x54f188=_0x27e78c[_0x9da1('0x35')](_0x27e78c[_0x9da1('0x36')]('_')+0x1);if(_0x287afe===_0x2bb9e4){_0x4bdaf1[_0x54f188]=_0x58e165[_0x9da1('0x37')];}}});}return _0x4bdaf1;}function getTicket(_0x173dc6,_0x28fc88,_0x26c225,_0x28e0b2,_0x4f78b1,_0x467350,_0x515f3f){return new BPromise(function(_0x3bb1da,_0x516685){var _0x5e8ebe;return getAuthToken(_0x28fc88,_0x26c225,_0x515f3f)[_0x9da1('0xe')](function(_0x599211){if(_0x467350[_0x9da1('0x38')]===_0x9da1('0x39')){_0x5e8ebe={'method':'POST','uri':_0x28e0b2+_0x9da1('0x3a'),'body':Object['assign']({},{'title':intUtil[_0x9da1('0x3b')](_0x467350[_0x9da1('0x3c')],_0x4f78b1,'\x20'),'description':intUtil['getString'](_0x467350['Descriptions'],_0x4f78b1,'\x0a'),'customerid_contact@odata.bind':_0x9da1('0x3d')+_0x173dc6[_0x9da1('0x28')]+')','ownerid@odata.bind':_0x9da1('0x25')+_0x173dc6[_0x9da1('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x467350[_0x9da1('0x3e')],_0x4f78b1,_0x467350[_0x9da1('0x38')])),'headers':{'Authorization':_0x9da1('0x2a')+_0x599211,'OData-Version':_0x9da1('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x467350['ticketType']===_0x9da1('0x3f')){_0x5e8ebe={'method':_0x9da1('0x23'),'uri':_0x28e0b2+_0x9da1('0x40'),'body':Object['assign']({},{'subject':intUtil[_0x9da1('0x3b')](_0x467350[_0x9da1('0x3c')],_0x4f78b1,'\x20'),'phonenumber':String(_0x4f78b1[_0x9da1('0x41')]),'description':intUtil['getString'](_0x467350[_0x9da1('0x42')],_0x4f78b1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x9da1('0x3d')+_0x173dc6[_0x9da1('0x28')]+')','ownerid@odata.bind':'/systemusers('+_0x173dc6[_0x9da1('0x20')]+')','directioncode':_0x173dc6['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x9da1('0x25')+_0x173dc6[_0x9da1('0x20')]+')','participationtypemask':_0x173dc6['callDirection']===_0x9da1('0x43')?0x2:0x1},{'partyid_contact@odata.bind':_0x9da1('0x3d')+_0x173dc6['enduserId']+')','participationtypemask':_0x173dc6[_0x9da1('0x44')]===_0x9da1('0x43')?0x1:0x2}]},getCustomFields(_0x467350[_0x9da1('0x3e')],_0x4f78b1,_0x467350[_0x9da1('0x38')])),'headers':{'Authorization':_0x9da1('0x2a')+_0x599211,'OData-Version':_0x9da1('0x15')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5e8ebe);})[_0x9da1('0xe')](function(_0x167ada){var _0x3889f4=_0x167ada['headers'][_0x9da1('0x26')];var _0xe6c667=_0x3889f4[_0x9da1('0x35')](_0x3889f4[_0x9da1('0x27')]('(')+0x1,_0x3889f4['lastIndexOf'](')'));_0x173dc6['ticketId']=_0xe6c667;_0x3bb1da(_0x173dc6);})[_0x9da1('0x29')](function(_0x6ca1ac){_0x516685(_0x6ca1ac[_0x9da1('0x12')]);});});}function emit(_0x1f11c5,_0x929f80,_0x315b7b,_0x43aa83){var _0x1b1148={'uri':util[_0x9da1('0x45')](_0x9da1('0x46'),_0x1f11c5,_0x315b7b,_0x43aa83)};io['to'](util[_0x9da1('0x45')](_0x9da1('0x47'),_0x929f80))[_0x9da1('0x48')](_0x9da1('0x49'),_0x1b1148);}exports['cs']=function(_0x4c99e8,_0x26ecdb,_0x1fbb5d,_0x4d241a,_0x227872,_0x4a1e45,_0x2c6145,_0x4f4980){var _0x5df0d8={};_0x4a1e45[_0x9da1('0x4a')]=intUtil[_0x9da1('0x4b')](_0x4a1e45[_0x9da1('0x4a')]);_0x4a1e45[_0x9da1('0x4c')]=intUtil[_0x9da1('0x4b')](_0x4a1e45[_0x9da1('0x4c')]);_0x5df0d8[_0x9da1('0x44')]=_0x4f4980===_0x9da1('0x43')||_0x4f4980===_0x9da1('0x4d')?'queue':_0x9da1('0x2b');var _0x1de7d9=util[_0x9da1('0x45')](_0x9da1('0x4e'),_0x4a1e45[_0x9da1('0x4a')]);var _0x4607a9=util[_0x9da1('0x45')](_0x9da1('0x4f'),_0x4a1e45[_0x9da1('0x50')]);var _0x3f52c9=util['format'](_0x9da1('0x51'),_0x4a1e45[_0x9da1('0x4c')],_0x26ecdb['uniqueid'],md5(_0x26ecdb[_0x9da1('0x52')]));if(_0x227872&&_0x227872[_0x9da1('0x53')]){logger[_0x9da1('0x1c')](_0x9da1('0x54'),_0x9da1('0x55'));_0x26ecdb[_0x9da1('0x56')]=_0x3f52c9;}else if(_0x2c6145&&_0x2c6145[_0x9da1('0x57')]&&_0x2c6145['recordingFormat']!==_0x9da1('0x58')){logger[_0x9da1('0x1c')](_0x9da1('0x59'),_0x9da1('0x55'));_0x26ecdb['recordingURL']=_0x3f52c9;}else{_0x26ecdb[_0x9da1('0x56')]='';}return getUser(_0x5df0d8,_0x4a1e45,_0x4d241a,_0x4607a9,_0x1de7d9,_0x4f4980)['then'](function(_0x27ac84){logger[_0x9da1('0x1c')]('['+_0x4f4980[_0x9da1('0x1d')]()+_0x9da1('0x5a'),_0x27ac84[_0x9da1('0x20')]);logger[_0x9da1('0x1c')]('['+_0x4f4980['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x27ac84[_0x9da1('0x19')]);return getEndUser(_0x27ac84,_0x4a1e45,_0x4607a9,_0x1de7d9,_0x26ecdb,_0x4f4980);})['then'](function(_0x5bf7b7){logger['info']('['+_0x4f4980[_0x9da1('0x1d')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x5bf7b7[_0x9da1('0x28')]);logger['info']('['+_0x4f4980[_0x9da1('0x1d')]()+_0x9da1('0x5b'),_0x26ecdb['calleridnum']);return getTicket(_0x5bf7b7,_0x4a1e45,_0x4607a9,_0x1de7d9,_0x26ecdb,_0x1fbb5d,_0x4f4980);})[_0x9da1('0xe')](function(_0x388a9f){logger['info'](util[_0x9da1('0x45')]('['+_0x4f4980[_0x9da1('0x1d')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x1fbb5d['ticketType'],_0x388a9f[_0x9da1('0x5c')]));logger[_0x9da1('0x1c')](util[_0x9da1('0x45')]('['+_0x4f4980[_0x9da1('0x1d')]()+_0x9da1('0x5d'),_0x4f4980));if(_0x4f4980!==_0x9da1('0x4d')){logger['info']('['+_0x4f4980[_0x9da1('0x1d')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4a1e45['remoteUri'],_0x4d241a[_0x9da1('0x5e')],_0x1fbb5d[_0x9da1('0x38')],_0x388a9f[_0x9da1('0x5c')]);}})[_0x9da1('0x29')](function(_0x3382b1){logger[_0x9da1('0x10')]('['+_0x4f4980[_0x9da1('0x1d')]()+_0x9da1('0x5f'),util[_0x9da1('0x60')](_0x3382b1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0650=['type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','getString','/contacts(','/systemusers(','phonecalls','assign','Subjects','queue','callDirection','Fields','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','request-promise','util','md5','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','POST','clientId','remoteUri','username','password','clientSecret','catch','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','then','value','isNil','email','userEmail','length','internalemailaddress','isdisabled','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','destcalleridnum','calleridnum','contacts','headers','odata-entityid','substring','lastIndexOf','enduserId','message','contacts?$select=telephone1','toLowerCase','outbound','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist'];(function(_0x267678,_0x233201){var _0x394d48=function(_0x3dfe48){while(--_0x3dfe48){_0x267678['push'](_0x267678['shift']());}};_0x394d48(++_0x233201);}(_0x0650,0xed));var _0x0065=function(_0x4eeb43,_0x3fd58d){_0x4eeb43=_0x4eeb43-0x0;var _0x559af8=_0x0650[_0x4eeb43];return _0x559af8;};'use strict';var _=require(_0x0065('0x0'));var BPromise=require('bluebird');var rp=require(_0x0065('0x1'));var util=require(_0x0065('0x2'));var intUtil=require('./util');var md5=require(_0x0065('0x3'));var Redis=require('ioredis');var logger=require(_0x0065('0x4'))(_0x0065('0x5'));var config=require(_0x0065('0x6'));config['redis']=_[_0x0065('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0065('0x8')]));function getAuthToken(_0x415835,_0xefa3cb,_0x3fe697){var _0x317492={'method':_0x0065('0x9'),'uri':_0xefa3cb,'form':{'client_id':_0x415835[_0x0065('0xa')],'resource':_0x415835[_0x0065('0xb')],'username':_0x415835[_0x0065('0xc')],'password':_0x415835['password'],'grant_type':_0x0065('0xd'),'client_secret':_0x415835[_0x0065('0xe')]},'json':!![]};return rp(_0x317492)['then'](function(_0x56a915){return _0x56a915['access_token'];})[_0x0065('0xf')](function(_0x42a395){logger['error']('['+[_0x3fe697[_0x0065('0x10')]()]+_0x0065('0x11'));return _0x42a395['message'];});}function getUser(_0x203fee,_0x32323e,_0x587bb2,_0x5ae653,_0x1b9b1e,_0x5c0b74){return new BPromise(function(_0x4ed9f1,_0x2d29c5){return getAuthToken(_0x32323e,_0x5ae653,_0x5c0b74)['then'](function(_0x38a870){var _0x48d817={'method':_0x0065('0x12'),'uri':_0x1b9b1e+_0x0065('0x13'),'headers':{'Authorization':_0x0065('0x14')+_0x38a870,'OData-Version':_0x0065('0x15')},'json':!![]};return rp(_0x48d817);})[_0x0065('0x16')](function(_0x34b0e2){var _0x99640c=_0x34b0e2[_0x0065('0x17')];var _0x595816=![];var _0x18bfa1=null;if(!_[_0x0065('0x18')](_0x587bb2)){if(intUtil['validateEmail'](_0x587bb2[_0x0065('0x19')])){_0x203fee[_0x0065('0x1a')]=_0x587bb2[_0x0065('0x19')];for(_0x18bfa1=0x0;_0x18bfa1<_0x99640c[_0x0065('0x1b')];_0x18bfa1++){if(_0x99640c[_0x18bfa1][_0x0065('0x1c')]===_0x587bb2[_0x0065('0x19')]&&!_0x99640c[_0x18bfa1][_0x0065('0x1d')]){_0x595816=!![];logger['info']('['+[_0x5c0b74['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x99640c[_0x18bfa1][_0x0065('0x1e')]+'!');_0x203fee[_0x0065('0x1f')]=_0x99640c[_0x18bfa1]['systemuserid'];}}}}if(!_0x595816){logger[_0x0065('0x20')]('['+[_0x5c0b74['toUpperCase']()]+_0x0065('0x21'));_0x203fee[_0x0065('0x1a')]=_0x32323e[_0x0065('0xc')];for(_0x18bfa1=0x0;_0x18bfa1<_0x99640c[_0x0065('0x1b')];_0x18bfa1++){if(_0x99640c[_0x18bfa1][_0x0065('0x1c')]===_0x32323e[_0x0065('0xc')]){_0x203fee[_0x0065('0x1f')]=_0x99640c[_0x18bfa1]['systemuserid'];}}}_0x4ed9f1(_0x203fee);})[_0x0065('0xf')](function(_0x5cb4b0){_0x2d29c5(_0x5cb4b0['message']);});});}function createEndUser(_0x3c715a,_0x5924b3,_0x2d3ca8,_0x6bf13b,_0x5db92c,_0x123604){return new BPromise(function(_0x5e1829,_0x5542e0){return getAuthToken(_0x5924b3,_0x2d3ca8,_0x123604)[_0x0065('0x16')](function(_0x221be2){var _0x47eede=_0x123604['toLowerCase']()==='outbound'?_0x5db92c[_0x0065('0x22')]:_0x5db92c[_0x0065('0x23')];var _0x1a977a={'method':_0x0065('0x9'),'uri':_0x6bf13b+_0x0065('0x24'),'body':{'telephone1':_0x47eede,'fullname':_0x47eede,'firstname':_0x47eede,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3c715a['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x221be2,'OData-Version':_0x0065('0x15')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1a977a);})[_0x0065('0x16')](function(_0x171af7){var _0x5746da=_0x171af7[_0x0065('0x25')][_0x0065('0x26')];var _0x4e67bd=_0x5746da[_0x0065('0x27')](_0x5746da[_0x0065('0x28')]('(')+0x1,_0x5746da[_0x0065('0x28')](')'));_0x3c715a[_0x0065('0x29')]=_0x4e67bd;_0x5e1829(_0x3c715a);})[_0x0065('0xf')](function(_0x95222f){_0x5542e0(_0x95222f[_0x0065('0x2a')]);});});}function getEndUser(_0x279d71,_0x4aa628,_0x4f35e6,_0x5cca79,_0x265d36,_0x8e7b67){return new BPromise(function(_0x2e15dd,_0x3ffb13){return getAuthToken(_0x4aa628,_0x4f35e6,_0x8e7b67)[_0x0065('0x16')](function(_0x24a776){var _0x344443={'method':'GET','uri':_0x5cca79+_0x0065('0x2b'),'headers':{'Authorization':_0x0065('0x14')+_0x24a776,'If-None-Match':null,'OData-Version':_0x0065('0x15')},'json':!![]};return rp(_0x344443);})[_0x0065('0x16')](function(_0x4d2cd5){var _0x5ab797=null;if(_0x4d2cd5){var _0x2597ca=_0x4d2cd5[_0x0065('0x17')];var _0x400c8b=![];for(_0x5ab797=0x0;_0x5ab797<_0x2597ca[_0x0065('0x1b')];_0x5ab797++){var _0x44dcdd=_0x8e7b67[_0x0065('0x2c')]()===_0x0065('0x2d')?_0x265d36[_0x0065('0x22')]:_0x265d36[_0x0065('0x23')];if(_0x2597ca[_0x5ab797][_0x0065('0x2e')]===_0x44dcdd){_0x400c8b=!![];_0x279d71['enduserId']=_0x2597ca[_0x5ab797][_0x0065('0x2f')];}}if(_0x400c8b){_0x2e15dd(_0x279d71);}else{return createEndUser(_0x279d71,_0x4aa628,_0x4f35e6,_0x5cca79,_0x265d36,_0x8e7b67)[_0x0065('0x16')](function(_0x3e174b){logger['info']('['+[_0x8e7b67[_0x0065('0x10')]()]+_0x0065('0x30'),_0x3e174b[_0x0065('0x29')]);_0x2e15dd(_0x3e174b);});}}else{return createEndUser(_0x279d71,_0x4aa628,_0x4f35e6,_0x5cca79,_0x265d36,_0x8e7b67)[_0x0065('0x16')](function(_0x1a9d59){logger[_0x0065('0x20')]('['+[_0x8e7b67['toUpperCase']()]+_0x0065('0x31'),_0x1a9d59[_0x0065('0x29')]);_0x2e15dd(_0x1a9d59);});}});});}function getCustomFields(_0x188fe1,_0x4af6fc,_0x3bb27b){var _0x59409c={};if(_0x188fe1[_0x0065('0x1b')]>0x0){_[_0x0065('0x32')](_0x188fe1,function(_0x4b4a98){if(_[_0x0065('0x33')]([_0x0065('0x34'),_0x0065('0x35')],_0x4b4a98[_0x0065('0x36')])&&_0x4b4a98[_0x0065('0x37')]&&!_0x4b4a98[_0x0065('0x38')]){var _0x4d4c07=_0x4b4a98[_0x0065('0x39')][_0x0065('0x2c')]();var _0x145336=_0x4d4c07[_0x0065('0x27')](0x0,_0x4d4c07[_0x0065('0x3a')]('_'));var _0x1b516c=_0x4d4c07[_0x0065('0x27')](_0x4d4c07[_0x0065('0x3a')]('_')+0x1);if(_0x145336===_0x3bb27b){_0x59409c[_0x1b516c]=_0x4b4a98[_0x0065('0x3b')];}}});}return _0x59409c;}function getTicket(_0x41d6f7,_0x26cef9,_0x32ab66,_0x35722d,_0x11fe15,_0x475f0a,_0x1561f1){return new BPromise(function(_0x208d71,_0x36e37b){var _0x1d1d67;return getAuthToken(_0x26cef9,_0x32ab66,_0x1561f1)[_0x0065('0x16')](function(_0x1fa4bd){if(_0x475f0a[_0x0065('0x3c')]===_0x0065('0x3d')){_0x1d1d67={'method':'POST','uri':_0x35722d+_0x0065('0x3e'),'body':Object['assign']({},{'title':intUtil[_0x0065('0x3f')](_0x475f0a['Subjects'],_0x11fe15,'\x20'),'description':intUtil[_0x0065('0x3f')](_0x475f0a['Descriptions'],_0x11fe15,'\x0a'),'customerid_contact@odata.bind':_0x0065('0x40')+_0x41d6f7[_0x0065('0x29')]+')','ownerid@odata.bind':_0x0065('0x41')+_0x41d6f7['userId']+')','caseorigincode':'1'},getCustomFields(_0x475f0a['Fields'],_0x11fe15,_0x475f0a[_0x0065('0x3c')])),'headers':{'Authorization':_0x0065('0x14')+_0x1fa4bd,'OData-Version':_0x0065('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x475f0a[_0x0065('0x3c')]==='phonecall'){_0x1d1d67={'method':_0x0065('0x9'),'uri':_0x35722d+_0x0065('0x42'),'body':Object[_0x0065('0x43')]({},{'subject':intUtil[_0x0065('0x3f')](_0x475f0a[_0x0065('0x44')],_0x11fe15,'\x20'),'phonenumber':String(_0x11fe15['calleridnum']),'description':intUtil[_0x0065('0x3f')](_0x475f0a['Descriptions'],_0x11fe15,'\x0a'),'regardingobjectid_contact@odata.bind':_0x0065('0x40')+_0x41d6f7[_0x0065('0x29')]+')','ownerid@odata.bind':_0x0065('0x41')+_0x41d6f7[_0x0065('0x1f')]+')','directioncode':_0x41d6f7['callDirection']===_0x0065('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x41d6f7[_0x0065('0x1f')]+')','participationtypemask':_0x41d6f7[_0x0065('0x46')]===_0x0065('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0x0065('0x40')+_0x41d6f7[_0x0065('0x29')]+')','participationtypemask':_0x41d6f7[_0x0065('0x46')]===_0x0065('0x45')?0x1:0x2}]},getCustomFields(_0x475f0a[_0x0065('0x47')],_0x11fe15,_0x475f0a[_0x0065('0x3c')])),'headers':{'Authorization':_0x0065('0x14')+_0x1fa4bd,'OData-Version':_0x0065('0x15')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1d1d67);})['then'](function(_0x19f3e3){var _0xcd7d13=_0x19f3e3[_0x0065('0x25')][_0x0065('0x26')];var _0x419941=_0xcd7d13[_0x0065('0x27')](_0xcd7d13[_0x0065('0x28')]('(')+0x1,_0xcd7d13['lastIndexOf'](')'));_0x41d6f7['ticketId']=_0x419941;_0x208d71(_0x41d6f7);})[_0x0065('0xf')](function(_0x2da487){_0x36e37b(_0x2da487[_0x0065('0x2a')]);});});}function emit(_0x2fd6ce,_0x2ea27c,_0x2c9e53,_0x45e6f9){var _0x1d5d5d={'uri':util[_0x0065('0x48')](_0x0065('0x49'),_0x2fd6ce,_0x2c9e53,_0x45e6f9)};io['to'](util[_0x0065('0x48')](_0x0065('0x4a'),_0x2ea27c))[_0x0065('0x4b')]('trigger:browser:url',_0x1d5d5d);}exports['cs']=function(_0x388d14,_0x3b933a,_0x4f28c6,_0x268076,_0x185395,_0x3c7807,_0x47f6c0,_0x463ecf){var _0x1f4dd8={};_0x3c7807[_0x0065('0xb')]=intUtil[_0x0065('0x4c')](_0x3c7807['remoteUri']);_0x3c7807[_0x0065('0x4d')]=intUtil[_0x0065('0x4c')](_0x3c7807[_0x0065('0x4d')]);_0x1f4dd8[_0x0065('0x46')]=_0x463ecf===_0x0065('0x45')||_0x463ecf===_0x0065('0x4e')?'queue':_0x0065('0x2d');var _0x5035cf=util[_0x0065('0x48')]('%s/api/data/v9.0/',_0x3c7807[_0x0065('0xb')]);var _0x58b49a=util[_0x0065('0x48')](_0x0065('0x4f'),_0x3c7807['tenantId']);var _0x576ad7=util[_0x0065('0x48')](_0x0065('0x50'),_0x3c7807[_0x0065('0x4d')],_0x3b933a['uniqueid'],md5(_0x3b933a[_0x0065('0x51')]));if(_0x185395&&_0x185395[_0x0065('0x52')]){logger['info']('[QUEUE]',_0x0065('0x53'));_0x3b933a[_0x0065('0x54')]=_0x576ad7;}else if(_0x47f6c0&&_0x47f6c0[_0x0065('0x55')]&&_0x47f6c0['recordingFormat']!==_0x0065('0x56')){logger['info'](_0x0065('0x57'),_0x0065('0x53'));_0x3b933a['recordingURL']=_0x576ad7;}else{_0x3b933a[_0x0065('0x54')]='';}return getUser(_0x1f4dd8,_0x3c7807,_0x268076,_0x58b49a,_0x5035cf,_0x463ecf)[_0x0065('0x16')](function(_0x2d8d31){logger[_0x0065('0x20')]('['+_0x463ecf['toUpperCase']()+_0x0065('0x58'),_0x2d8d31[_0x0065('0x1f')]);logger[_0x0065('0x20')]('['+_0x463ecf['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x2d8d31[_0x0065('0x1a')]);return getEndUser(_0x2d8d31,_0x3c7807,_0x58b49a,_0x5035cf,_0x3b933a,_0x463ecf);})[_0x0065('0x16')](function(_0x4d6ada){logger[_0x0065('0x20')]('['+_0x463ecf[_0x0065('0x10')]()+_0x0065('0x59'),_0x4d6ada[_0x0065('0x29')]);logger['info']('['+_0x463ecf[_0x0065('0x10')]()+_0x0065('0x5a'),_0x3b933a['calleridnum']);return getTicket(_0x4d6ada,_0x3c7807,_0x58b49a,_0x5035cf,_0x3b933a,_0x4f28c6,_0x463ecf);})[_0x0065('0x16')](function(_0x229bb2){logger['info'](util[_0x0065('0x48')]('['+_0x463ecf[_0x0065('0x10')]()+_0x0065('0x5b'),_0x4f28c6['ticketType'],_0x229bb2[_0x0065('0x5c')]));logger[_0x0065('0x20')](util[_0x0065('0x48')]('['+_0x463ecf[_0x0065('0x10')]()+_0x0065('0x5d'),_0x463ecf));if(_0x463ecf!==_0x0065('0x4e')){logger[_0x0065('0x20')]('['+_0x463ecf['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3c7807[_0x0065('0xb')],_0x268076[_0x0065('0x5e')],_0x4f28c6[_0x0065('0x3c')],_0x229bb2[_0x0065('0x5c')]);}})['catch'](function(_0x4dcf2d){logger['error']('['+_0x463ecf[_0x0065('0x10')]()+_0x0065('0x5f'),util[_0x0065('0x60')](_0x4dcf2d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index b445d2e..1e236d1 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 _0xc3be=['calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','catch','error','stringify','outbound','stripTrailingSlash','recordingFormat','none','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','monitor_format','Authorization','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','Subjects','
','Tags','Fields','custom_fields','mapValues','keyBy','value','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','length','map','forEach','includes','string','picklist','customField','toLowerCase','content','type','idField','push','variable','variableName','customVariable','Variable','name','queue','serverUrl','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:'];(function(_0x45977c,_0x7eaed0){var _0x399413=function(_0x41cc76){while(--_0x41cc76){_0x45977c['push'](_0x45977c['shift']());}};_0x399413(++_0x7eaed0);}(_0xc3be,0x7b));var _0xec3b=function(_0x495c2b,_0x5044b0){_0x495c2b=_0x495c2b-0x0;var _0x370520=_0xc3be[_0x495c2b];return _0x370520;};'use strict';var _=require(_0xec3b('0x0'));var rp=require(_0xec3b('0x1'));var md5=require('md5');var util=require(_0xec3b('0x2'));var Redis=require(_0xec3b('0x3'));var intUtil=require(_0xec3b('0x4'));var config=require('../../../../config/environment');var logger=require(_0xec3b('0x5'))(_0xec3b('0x6'));config[_0xec3b('0x7')]=_[_0xec3b('0x8')](config[_0xec3b('0x7')],{'host':_0xec3b('0x9'),'port':0x18eb});var io=require(_0xec3b('0xa'))(new Redis(config[_0xec3b('0x7')]));var headers={'Content-Type':'application/json','Accept':_0xec3b('0xb')};function emit(_0xe0061d,_0x249963,_0x1b9206){io['to'](_0xe0061d)[_0xec3b('0xc')](_0x249963,_0x1b9206);}function getTicket(_0x35126f,_0x19543a,_0x43ba66,_0x2cc068,_0x406f09){logger[_0xec3b('0xd')](_0xec3b('0xe'));var _0xf721a5=_[_0xec3b('0xf')]({'responder_id':_0x19543a['id'],'requester_id':_0x43ba66['id'],'name':util[_0xec3b('0x10')](_0xec3b('0x11'),_0x406f09[_0xec3b('0x12')]),'phone':_0x406f09['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2cc068[_0xec3b('0x13')],_0x406f09,'\x20'),'description':intUtil['getString'](_0x2cc068['Descriptions'],_0x406f09,_0xec3b('0x14')),'tags':getTags(_0x2cc068[_0xec3b('0x15')],'name')},getCustomFields(_0x2cc068[_0xec3b('0x16')],_0x406f09));_0xf721a5[_0xec3b('0x17')]=_[_0xec3b('0x18')](_[_0xec3b('0x19')](_0xf721a5[_0xec3b('0x17')],'id'),_0xec3b('0x1a'));return request({'uri':util[_0xec3b('0x10')]('%s/api/v2/tickets',_0x35126f['remoteUri']),'method':'POST','body':_0xf721a5})['then'](function(_0x50f3d3){logger[_0xec3b('0xd')]('Ticket\x20created!');return _0x50f3d3;});}function getUser(_0x398700,_0x1776f0){if(intUtil[_0xec3b('0x1b')](_0x1776f0)){return request({'uri':util['format'](_0xec3b('0x1c'),_0x398700['remoteUri']),'qs':{'email':_0x1776f0}})['then'](function(_0x488430){if(_0x488430['length']){logger[_0xec3b('0xd')](_0xec3b('0x1d'));return _[_0xec3b('0x1e')](_0x488430,function(_0x2d72b2){return _0x2d72b2[_0xec3b('0x1f')][_0xec3b('0x20')]===_0x1776f0;});}else{logger['info'](_0xec3b('0x21'));return request({'uri':util[_0xec3b('0x10')]('%s/api/v2/agents/me',_0x398700[_0xec3b('0x22')])})[_0xec3b('0x23')](function(_0x2afc95){logger[_0xec3b('0xd')](_0xec3b('0x24'));return _0x2afc95;});}});}else{logger[_0xec3b('0xd')](_0xec3b('0x25'));return request({'uri':util[_0xec3b('0x10')](_0xec3b('0x26'),_0x398700[_0xec3b('0x22')])})[_0xec3b('0x23')](function(_0x6460bf){logger['info'](_0xec3b('0x24'));return _0x6460bf;});}}function getEndUser(_0x57696d,_0x12963b,_0x2371c0){logger['info'](_0xec3b('0x27'),_0x2371c0);return request({'uri':util['format'](_0xec3b('0x28'),_0x57696d[_0xec3b('0x22')]),'qs':{'phone':_0x2371c0}})['then'](function(_0x323c70){if(_0x323c70['length']){logger[_0xec3b('0xd')](_0xec3b('0x29'));return _[_0xec3b('0x1e')](_0x323c70,{'phone':_0x2371c0});}else{logger[_0xec3b('0xd')](_0xec3b('0x2a'));return request({'uri':util[_0xec3b('0x10')](_0xec3b('0x28'),_0x57696d[_0xec3b('0x22')]),'method':_0xec3b('0x2b'),'body':{'name':_0x12963b,'phone':_0x2371c0}})['then'](function(_0x4fabf9){logger['info'](_0xec3b('0x2c'));return _0x4fabf9;});}});}function getAuth(_0xd15866){return util[_0xec3b('0x10')](_0xec3b('0x2d'),new Buffer(_0xd15866[_0xec3b('0x2e')]+':X')[_0xec3b('0x2f')](_0xec3b('0x30')));}function request(_0x285ddb){logger[_0xec3b('0x31')](_0xec3b('0x32'),JSON['stringify'](_0x285ddb));return rp(_[_0xec3b('0x8')](_0x285ddb,{'method':_0xec3b('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x4f8f38,_0x52312a){var _0x51fb5e=[];if(_0x4f8f38&&_0x4f8f38[_0xec3b('0x34')]>0x0){_0x51fb5e=_[_0xec3b('0x35')](_0x4f8f38,_0x52312a);}return _0x51fb5e;}function getCustomFields(_0x392822,_0x590b00){var _0xa137e1=[];var _0xbe1b44={'custom_fields':[]};if(_0x392822[_0xec3b('0x34')]>0x0){_[_0xec3b('0x36')](_0x392822,function(_0x52a71c){if(_[_0xec3b('0x37')]([_0xec3b('0x38'),_0xec3b('0x39')],_0x52a71c['type'])&&_0x52a71c['nameField']&&!_0x52a71c[_0xec3b('0x3a')]){_0xbe1b44[_0x52a71c['nameField'][_0xec3b('0x3b')]()]=_0x52a71c[_0xec3b('0x3c')][_0xec3b('0x2f')]();}else if(_[_0xec3b('0x37')](['string','picklist'],_0x52a71c[_0xec3b('0x3d')])&&_0x52a71c[_0xec3b('0x3e')]&&_0x52a71c[_0xec3b('0x3a')]){_0xbe1b44[_0xec3b('0x17')][_0xec3b('0x3f')]({'id':_0x52a71c['idField'],'value':_0x52a71c[_0xec3b('0x3c')]['toString']()});}else if(_0x52a71c[_0xec3b('0x3d')]===_0xec3b('0x40')&&_0x52a71c[_0xec3b('0x41')]&&_0x52a71c['idField']&&_0x52a71c['customField']){_0x590b00[_0x52a71c[_0xec3b('0x41')]]&&_0xbe1b44[_0xec3b('0x17')]['push']({'id':_0x52a71c[_0xec3b('0x3e')],'value':_0x590b00[_0x52a71c['variableName']][_0xec3b('0x2f')]()});}else if(_0x52a71c['type']===_0xec3b('0x42')&&_0x52a71c['Variable']&&_0x52a71c[_0xec3b('0x43')][_0xec3b('0x44')]&&_0x52a71c['idField']&&_0x52a71c[_0xec3b('0x3a')]){_0x590b00[_0x52a71c['Variable']['name']['toLowerCase']()]&&_0xbe1b44[_0xec3b('0x17')]['push']({'id':_0x52a71c[_0xec3b('0x3e')],'value':_0x590b00[_0x52a71c[_0xec3b('0x43')][_0xec3b('0x44')][_0xec3b('0x3b')]()][_0xec3b('0x2f')]()});}});}return _0xbe1b44;}exports[_0xec3b('0x45')]=function(_0x3dfc88,_0x4e31bd,_0x1a2468,_0x2267b9,_0x27e63f,_0x3f5b9a){var _0x246f58,_0x47bcc6;_0x3f5b9a['remoteUri']=intUtil['stripTrailingSlash'](_0x3f5b9a[_0xec3b('0x22')]);_0x3f5b9a[_0xec3b('0x46')]=intUtil['stripTrailingSlash'](_0x3f5b9a['serverUrl']);if(_0x27e63f&&_0x27e63f['monitor_format']){logger['info'](_0xec3b('0x47'),'Recording\x20is\x20enabled!');_0x4e31bd[_0xec3b('0x48')]=util[_0xec3b('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f5b9a[_0xec3b('0x46')],_0x4e31bd[_0xec3b('0x49')],md5(_0x4e31bd[_0xec3b('0x49')]));}else{_0x4e31bd[_0xec3b('0x48')]='';}headers['Authorization']=getAuth(_0x3f5b9a);return getUser(_0x3f5b9a,_0x2267b9['email'])['then'](function(_0x3d537c){_0x246f58=_0x3d537c;logger[_0xec3b('0xd')](_0xec3b('0x4a'),_0x246f58['id']);return getEndUser(_0x3f5b9a,_0x4e31bd[_0xec3b('0x12')],_0x4e31bd[_0xec3b('0x4b')]);})[_0xec3b('0x23')](function(_0x38bd38){_0x47bcc6=_0x38bd38;logger['info'](_0xec3b('0x4c'),_0x47bcc6['id']);return getTicket(_0x3f5b9a,_0x246f58,_0x47bcc6,_0x1a2468,_0x4e31bd);})[_0xec3b('0x23')](function(_0x13b142){if(_0x13b142&&_0x13b142['id']){logger[_0xec3b('0xd')](_0xec3b('0x4d'));logger[_0xec3b('0xd')](_0xec3b('0x4e'),_0x13b142['id']);logger[_0xec3b('0xd')](_0xec3b('0x47'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xec3b('0x4f'),_0x2267b9[_0xec3b('0x44')]),_0xec3b('0x50'),{'uri':util[_0xec3b('0x10')]('%s/helpdesk/tickets/%d',_0x3f5b9a[_0xec3b('0x22')],_0x13b142['id'])});}})[_0xec3b('0x51')](function(_0x4901b6){logger[_0xec3b('0x52')]('[QUEUE]',JSON[_0xec3b('0x53')](_0x4901b6));});};exports[_0xec3b('0x54')]=function(_0x4cb39a,_0x39186a,_0x17b030,_0x485272,_0x3f7de0,_0x3f9b79,_0x4d5aec){var _0x566a1b,_0x1ad7f0;_0x3f9b79[_0xec3b('0x22')]=intUtil[_0xec3b('0x55')](_0x3f9b79['remoteUri']);_0x3f9b79[_0xec3b('0x46')]=intUtil[_0xec3b('0x55')](_0x3f9b79[_0xec3b('0x46')]);if(_0x4d5aec&&_0x4d5aec['recordingFormat']&&_0x4d5aec[_0xec3b('0x56')]!==_0xec3b('0x57')){logger[_0xec3b('0xd')]('[OUTBOUND]',_0xec3b('0x58'));_0x39186a[_0xec3b('0x48')]=util[_0xec3b('0x10')](_0xec3b('0x59'),_0x3f9b79[_0xec3b('0x46')],_0x39186a[_0xec3b('0x49')],md5(_0x39186a[_0xec3b('0x49')]));}headers['Authorization']=getAuth(_0x3f9b79);return getUser(_0x3f9b79,_0x485272[_0xec3b('0x20')])[_0xec3b('0x23')](function(_0x12cfab){_0x566a1b=_0x12cfab;logger[_0xec3b('0xd')](_0xec3b('0x4a'),_0x566a1b['id']);return getEndUser(_0x3f9b79,_0x39186a[_0xec3b('0x5a')],_0x39186a[_0xec3b('0x5b')]);})[_0xec3b('0x23')](function(_0x1214f9){_0x1ad7f0=_0x1214f9;logger[_0xec3b('0xd')](_0xec3b('0x4c'),_0x1ad7f0['id']);return getTicket(_0x3f9b79,_0x566a1b,_0x1ad7f0,_0x17b030,_0x39186a);})[_0xec3b('0x23')](function(_0x9becee){if(_0x9becee&&_0x9becee['id']){logger['info']('Ticket\x20created!');logger[_0xec3b('0xd')](_0xec3b('0x4e'),_0x9becee['id']);logger[_0xec3b('0xd')](_0xec3b('0x5c'),_0xec3b('0x5d'));emit(util[_0xec3b('0x10')]('user:%s',_0x485272['name']),_0xec3b('0x50'),{'uri':util['format'](_0xec3b('0x5e'),_0x3f9b79[_0xec3b('0x22')],_0x9becee['id'])});}})['catch'](function(_0x301f11){logger[_0xec3b('0x52')](_0xec3b('0x5c'),JSON[_0xec3b('0x53')](_0x301f11));});};exports['unmanaged']=function(_0x22cf5b,_0x5c5be9,_0x10dbab,_0x5c5855,_0xe9f759,_0x2dbd41){var _0x125277,_0xe50480;_0x2dbd41[_0xec3b('0x22')]=intUtil[_0xec3b('0x55')](_0x2dbd41[_0xec3b('0x22')]);_0x2dbd41[_0xec3b('0x46')]=intUtil[_0xec3b('0x55')](_0x2dbd41[_0xec3b('0x46')]);if(_0xe9f759&&_0xe9f759[_0xec3b('0x5f')]){logger['info']('['+_0x5c5be9['lastevent']['toUpperCase']()+']',_0xec3b('0x58'));_0x5c5be9['recordingURL']=util[_0xec3b('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2dbd41[_0xec3b('0x46')],_0x5c5be9[_0xec3b('0x49')],md5(_0x5c5be9['uniqueid']));}else{_0x5c5be9[_0xec3b('0x48')]='';}headers[_0xec3b('0x60')]=getAuth(_0x2dbd41);return getUser(_0x2dbd41,'')[_0xec3b('0x23')](function(_0x50a0fc){_0x125277=_0x50a0fc;logger[_0xec3b('0xd')](_0xec3b('0x4a'),_0x125277['id']);return getEndUser(_0x2dbd41,_0x5c5be9[_0xec3b('0x12')],_0x5c5be9[_0xec3b('0x4b')]);})['then'](function(_0x2956ac){_0xe50480=_0x2956ac;logger[_0xec3b('0xd')]('The\x20Enduser\x20ID\x20is:',_0xe50480['id']);return getTicket(_0x2dbd41,_0x125277,_0xe50480,_0x10dbab,_0x5c5be9);})[_0xec3b('0x23')](function(_0x4b4659){if(_0x4b4659){logger[_0xec3b('0xd')]('Ticket\x20created!');logger[_0xec3b('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4b4659['id']);}})['catch'](function(_0x25b9de){logger[_0xec3b('0x52')]('['+_0x5c5be9[_0xec3b('0x61')][_0xec3b('0x62')]()+']',JSON['stringify'](_0x25b9de));});}; \ No newline at end of file +var _0x4f7c=['Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','stringify','outbound','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','unmanaged','catch','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','emit','info','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','format','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','map','includes','string','picklist','type','customField','toLowerCase','content','idField','variable','variableName','push','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0x53b512,_0x1ae564){var _0x5d5053=function(_0x5a9484){while(--_0x5a9484){_0x53b512['push'](_0x53b512['shift']());}};_0x5d5053(++_0x1ae564);}(_0x4f7c,0x185));var _0xc4f7=function(_0x2c347b,_0x2614e1){_0x2c347b=_0x2c347b-0x0;var _0x432049=_0x4f7c[_0x2c347b];return _0x432049;};'use strict';var _=require('lodash');var rp=require(_0xc4f7('0x0'));var md5=require(_0xc4f7('0x1'));var util=require(_0xc4f7('0x2'));var Redis=require(_0xc4f7('0x3'));var intUtil=require(_0xc4f7('0x4'));var config=require(_0xc4f7('0x5'));var logger=require(_0xc4f7('0x6'))(_0xc4f7('0x7'));config[_0xc4f7('0x8')]=_[_0xc4f7('0x9')](config[_0xc4f7('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc4f7('0xa'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0xe95923,_0x3bc97d,_0x4d5cb9){io['to'](_0xe95923)[_0xc4f7('0xb')](_0x3bc97d,_0x4d5cb9);}function getTicket(_0xd05a2,_0x16d7ff,_0x2714e8,_0x8c75e3,_0x5670de){logger[_0xc4f7('0xc')]('Creating\x20new\x20ticket...');var _0x3d8941=_['merge']({'responder_id':_0x16d7ff['id'],'requester_id':_0x2714e8['id'],'name':util['format'](_0xc4f7('0xd'),_0x5670de[_0xc4f7('0xe')]),'phone':_0x5670de[_0xc4f7('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc4f7('0x10')](_0x8c75e3[_0xc4f7('0x11')],_0x5670de,'\x20'),'description':intUtil[_0xc4f7('0x10')](_0x8c75e3[_0xc4f7('0x12')],_0x5670de,_0xc4f7('0x13')),'tags':getTags(_0x8c75e3[_0xc4f7('0x14')],_0xc4f7('0x15'))},getCustomFields(_0x8c75e3[_0xc4f7('0x16')],_0x5670de));_0x3d8941[_0xc4f7('0x17')]=_[_0xc4f7('0x18')](_[_0xc4f7('0x19')](_0x3d8941['custom_fields'],'id'),'value');return request({'uri':util[_0xc4f7('0x1a')]('%s/api/v2/tickets',_0xd05a2[_0xc4f7('0x1b')]),'method':'POST','body':_0x3d8941})[_0xc4f7('0x1c')](function(_0x3f76dd){logger[_0xc4f7('0xc')](_0xc4f7('0x1d'));return _0x3f76dd;});}function getUser(_0x2ad358,_0x1f835c){if(intUtil[_0xc4f7('0x1e')](_0x1f835c)){return request({'uri':util[_0xc4f7('0x1a')](_0xc4f7('0x1f'),_0x2ad358[_0xc4f7('0x1b')]),'qs':{'email':_0x1f835c}})['then'](function(_0x4cece5){if(_0x4cece5[_0xc4f7('0x20')]){logger[_0xc4f7('0xc')](_0xc4f7('0x21'));return _[_0xc4f7('0x22')](_0x4cece5,function(_0x6c9d19){return _0x6c9d19[_0xc4f7('0x23')][_0xc4f7('0x24')]===_0x1f835c;});}else{logger['info'](_0xc4f7('0x25'));return request({'uri':util['format'](_0xc4f7('0x26'),_0x2ad358[_0xc4f7('0x1b')])})['then'](function(_0x277ea8){logger[_0xc4f7('0xc')]('Admin\x20account\x20selected.');return _0x277ea8;});}});}else{logger['info'](_0xc4f7('0x27'));return request({'uri':util[_0xc4f7('0x1a')](_0xc4f7('0x26'),_0x2ad358[_0xc4f7('0x1b')])})['then'](function(_0x58a7a5){logger[_0xc4f7('0xc')](_0xc4f7('0x28'));return _0x58a7a5;});}}function getEndUser(_0x41d37b,_0x29a649,_0x3d2ee0){logger[_0xc4f7('0xc')](_0xc4f7('0x29'),_0x3d2ee0);return request({'uri':util[_0xc4f7('0x1a')](_0xc4f7('0x2a'),_0x41d37b[_0xc4f7('0x1b')]),'qs':{'phone':_0x3d2ee0}})[_0xc4f7('0x1c')](function(_0x4a6dbe){if(_0x4a6dbe[_0xc4f7('0x20')]){logger['info'](_0xc4f7('0x2b'));return _[_0xc4f7('0x22')](_0x4a6dbe,{'phone':_0x3d2ee0});}else{logger[_0xc4f7('0xc')](_0xc4f7('0x2c'));return request({'uri':util[_0xc4f7('0x1a')](_0xc4f7('0x2a'),_0x41d37b['remoteUri']),'method':_0xc4f7('0x2d'),'body':{'name':_0x29a649,'phone':_0x3d2ee0}})[_0xc4f7('0x1c')](function(_0x527d4f){logger['info'](_0xc4f7('0x2e'));return _0x527d4f;});}});}function getAuth(_0x34c846){return util['format'](_0xc4f7('0x2f'),new Buffer(_0x34c846[_0xc4f7('0x30')]+':X')[_0xc4f7('0x31')](_0xc4f7('0x32')));}function request(_0x67d8d2){logger[_0xc4f7('0x33')](_0xc4f7('0x34'),JSON['stringify'](_0x67d8d2));return rp(_[_0xc4f7('0x9')](_0x67d8d2,{'method':_0xc4f7('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x55ab03,_0x29c093){var _0x3c53b2=[];if(_0x55ab03&&_0x55ab03[_0xc4f7('0x20')]>0x0){_0x3c53b2=_[_0xc4f7('0x36')](_0x55ab03,_0x29c093);}return _0x3c53b2;}function getCustomFields(_0x4d5609,_0x17eed1){var _0x101d17=[];var _0x9e41f9={'custom_fields':[]};if(_0x4d5609[_0xc4f7('0x20')]>0x0){_['forEach'](_0x4d5609,function(_0x12beeb){if(_[_0xc4f7('0x37')]([_0xc4f7('0x38'),_0xc4f7('0x39')],_0x12beeb[_0xc4f7('0x3a')])&&_0x12beeb['nameField']&&!_0x12beeb[_0xc4f7('0x3b')]){_0x9e41f9[_0x12beeb['nameField'][_0xc4f7('0x3c')]()]=_0x12beeb[_0xc4f7('0x3d')]['toString']();}else if(_['includes']([_0xc4f7('0x38'),_0xc4f7('0x39')],_0x12beeb[_0xc4f7('0x3a')])&&_0x12beeb[_0xc4f7('0x3e')]&&_0x12beeb['customField']){_0x9e41f9[_0xc4f7('0x17')]['push']({'id':_0x12beeb['idField'],'value':_0x12beeb['content'][_0xc4f7('0x31')]()});}else if(_0x12beeb[_0xc4f7('0x3a')]===_0xc4f7('0x3f')&&_0x12beeb[_0xc4f7('0x40')]&&_0x12beeb['idField']&&_0x12beeb['customField']){_0x17eed1[_0x12beeb[_0xc4f7('0x40')]]&&_0x9e41f9[_0xc4f7('0x17')][_0xc4f7('0x41')]({'id':_0x12beeb[_0xc4f7('0x3e')],'value':_0x17eed1[_0x12beeb['variableName']][_0xc4f7('0x31')]()});}else if(_0x12beeb['type']==='customVariable'&&_0x12beeb['Variable']&&_0x12beeb[_0xc4f7('0x42')][_0xc4f7('0x15')]&&_0x12beeb[_0xc4f7('0x3e')]&&_0x12beeb[_0xc4f7('0x3b')]){_0x17eed1[_0x12beeb[_0xc4f7('0x42')][_0xc4f7('0x15')]['toLowerCase']()]&&_0x9e41f9[_0xc4f7('0x17')][_0xc4f7('0x41')]({'id':_0x12beeb['idField'],'value':_0x17eed1[_0x12beeb[_0xc4f7('0x42')][_0xc4f7('0x15')][_0xc4f7('0x3c')]()][_0xc4f7('0x31')]()});}});}return _0x9e41f9;}exports['queue']=function(_0x3623c7,_0x19411a,_0x1dec30,_0x30f8a4,_0x22da3f,_0x227ff7){var _0x1b79a3,_0x4b50c6;_0x227ff7[_0xc4f7('0x1b')]=intUtil[_0xc4f7('0x43')](_0x227ff7[_0xc4f7('0x1b')]);_0x227ff7[_0xc4f7('0x44')]=intUtil[_0xc4f7('0x43')](_0x227ff7[_0xc4f7('0x44')]);if(_0x22da3f&&_0x22da3f[_0xc4f7('0x45')]){logger[_0xc4f7('0xc')](_0xc4f7('0x46'),_0xc4f7('0x47'));_0x19411a[_0xc4f7('0x48')]=util[_0xc4f7('0x1a')](_0xc4f7('0x49'),_0x227ff7[_0xc4f7('0x44')],_0x19411a[_0xc4f7('0x4a')],md5(_0x19411a['uniqueid']));}else{_0x19411a[_0xc4f7('0x48')]='';}headers['Authorization']=getAuth(_0x227ff7);return getUser(_0x227ff7,_0x30f8a4[_0xc4f7('0x24')])[_0xc4f7('0x1c')](function(_0x1b8008){_0x1b79a3=_0x1b8008;logger['info'](_0xc4f7('0x4b'),_0x1b79a3['id']);return getEndUser(_0x227ff7,_0x19411a[_0xc4f7('0xe')],_0x19411a[_0xc4f7('0xf')]);})[_0xc4f7('0x1c')](function(_0x346207){_0x4b50c6=_0x346207;logger[_0xc4f7('0xc')](_0xc4f7('0x4c'),_0x4b50c6['id']);return getTicket(_0x227ff7,_0x1b79a3,_0x4b50c6,_0x1dec30,_0x19411a);})[_0xc4f7('0x1c')](function(_0x31380d){if(_0x31380d&&_0x31380d['id']){logger[_0xc4f7('0xc')]('Ticket\x20created!');logger[_0xc4f7('0xc')](_0xc4f7('0x4d'),_0x31380d['id']);logger[_0xc4f7('0xc')]('[QUEUE]',_0xc4f7('0x4e'));emit(util['format'](_0xc4f7('0x4f'),_0x30f8a4[_0xc4f7('0x15')]),_0xc4f7('0x50'),{'uri':util[_0xc4f7('0x1a')](_0xc4f7('0x51'),_0x227ff7['remoteUri'],_0x31380d['id'])});}})['catch'](function(_0x950347){logger['error']('[QUEUE]',JSON[_0xc4f7('0x52')](_0x950347));});};exports[_0xc4f7('0x53')]=function(_0x3670c1,_0x257146,_0x1f6ab8,_0x230dbe,_0x5e1b06,_0xb4de43,_0x1a0934){var _0x56816a,_0x371eb8;_0xb4de43['remoteUri']=intUtil[_0xc4f7('0x43')](_0xb4de43['remoteUri']);_0xb4de43[_0xc4f7('0x44')]=intUtil[_0xc4f7('0x43')](_0xb4de43['serverUrl']);if(_0x1a0934&&_0x1a0934[_0xc4f7('0x54')]&&_0x1a0934[_0xc4f7('0x54')]!=='none'){logger[_0xc4f7('0xc')](_0xc4f7('0x55'),_0xc4f7('0x47'));_0x257146['recordingURL']=util[_0xc4f7('0x1a')](_0xc4f7('0x49'),_0xb4de43[_0xc4f7('0x44')],_0x257146[_0xc4f7('0x4a')],md5(_0x257146[_0xc4f7('0x4a')]));}headers[_0xc4f7('0x56')]=getAuth(_0xb4de43);return getUser(_0xb4de43,_0x230dbe[_0xc4f7('0x24')])[_0xc4f7('0x1c')](function(_0x20eb1c){_0x56816a=_0x20eb1c;logger[_0xc4f7('0xc')](_0xc4f7('0x4b'),_0x56816a['id']);return getEndUser(_0xb4de43,_0x257146[_0xc4f7('0x57')],_0x257146[_0xc4f7('0x58')]);})[_0xc4f7('0x1c')](function(_0x4f66e7){_0x371eb8=_0x4f66e7;logger[_0xc4f7('0xc')](_0xc4f7('0x4c'),_0x371eb8['id']);return getTicket(_0xb4de43,_0x56816a,_0x371eb8,_0x1f6ab8,_0x257146);})[_0xc4f7('0x1c')](function(_0x5dce0d){if(_0x5dce0d&&_0x5dce0d['id']){logger['info'](_0xc4f7('0x1d'));logger[_0xc4f7('0xc')](_0xc4f7('0x4d'),_0x5dce0d['id']);logger['info']('[OUTBOUND]',_0xc4f7('0x4e'));emit(util[_0xc4f7('0x1a')](_0xc4f7('0x4f'),_0x230dbe[_0xc4f7('0x15')]),_0xc4f7('0x50'),{'uri':util[_0xc4f7('0x1a')]('%s/helpdesk/tickets/%d',_0xb4de43[_0xc4f7('0x1b')],_0x5dce0d['id'])});}})['catch'](function(_0x1d07a4){logger['error'](_0xc4f7('0x55'),JSON[_0xc4f7('0x52')](_0x1d07a4));});};exports[_0xc4f7('0x59')]=function(_0x28d380,_0x2f50ad,_0x5cb6f0,_0xa00c94,_0x26f493,_0x48cc11){var _0x2d4f59,_0x111b1a;_0x48cc11[_0xc4f7('0x1b')]=intUtil[_0xc4f7('0x43')](_0x48cc11[_0xc4f7('0x1b')]);_0x48cc11[_0xc4f7('0x44')]=intUtil['stripTrailingSlash'](_0x48cc11['serverUrl']);if(_0x26f493&&_0x26f493[_0xc4f7('0x45')]){logger[_0xc4f7('0xc')]('['+_0x2f50ad['lastevent']['toUpperCase']()+']',_0xc4f7('0x47'));_0x2f50ad[_0xc4f7('0x48')]=util[_0xc4f7('0x1a')](_0xc4f7('0x49'),_0x48cc11[_0xc4f7('0x44')],_0x2f50ad[_0xc4f7('0x4a')],md5(_0x2f50ad[_0xc4f7('0x4a')]));}else{_0x2f50ad['recordingURL']='';}headers['Authorization']=getAuth(_0x48cc11);return getUser(_0x48cc11,'')['then'](function(_0x1fbd9a){_0x2d4f59=_0x1fbd9a;logger[_0xc4f7('0xc')](_0xc4f7('0x4b'),_0x2d4f59['id']);return getEndUser(_0x48cc11,_0x2f50ad[_0xc4f7('0xe')],_0x2f50ad[_0xc4f7('0xf')]);})[_0xc4f7('0x1c')](function(_0x5c8070){_0x111b1a=_0x5c8070;logger['info']('The\x20Enduser\x20ID\x20is:',_0x111b1a['id']);return getTicket(_0x48cc11,_0x2d4f59,_0x111b1a,_0x5cb6f0,_0x2f50ad);})[_0xc4f7('0x1c')](function(_0x2a7f1a){if(_0x2a7f1a){logger[_0xc4f7('0xc')](_0xc4f7('0x1d'));logger[_0xc4f7('0xc')](_0xc4f7('0x4d'),_0x2a7f1a['id']);}})[_0xc4f7('0x5a')](function(_0x5979d5){logger['error']('['+_0x2f50ad['lastevent'][_0xc4f7('0x5b')]()+']',JSON['stringify'](_0x5979d5));});}; \ 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 4bb3b44..5dec7b2 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 _0x2a9a=['outbound','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','GET','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','Admin\x20found:','catch','error','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','userEmail','Admin\x20selected','userId','adminId','Requested\x20Resource\x20not\x20Found','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2a9a,0x64));var _0xa2a9=function(_0x2e0dc2,_0x40a0bd){_0x2e0dc2=_0x2e0dc2-0x0;var _0x37dcd0=_0x2a9a[_0x2e0dc2];return _0x37dcd0;};'use strict';var _=require(_0xa2a9('0x0'));var rp=require('request-promise');var md5=require(_0xa2a9('0x1'));var util=require('util');var moment=require('moment');var Promise=require(_0xa2a9('0x2'));var Redis=require(_0xa2a9('0x3'));var intUtil=require(_0xa2a9('0x4'));var config=require(_0xa2a9('0x5'));var logger=require(_0xa2a9('0x6'))('freshsales');config[_0xa2a9('0x7')]=_[_0xa2a9('0x8')](config[_0xa2a9('0x7')],{'host':_0xa2a9('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x540979,_0x523164,_0x40d8b2,_0x1cc641){return new Promise(function(_0x3eaaa6,_0x710040){var _0x47a690=![];var _0x2daf1c={'method':_0xa2a9('0xa'),'uri':_0x1cc641+'/api/selector/owners','json':!![]};_0x2daf1c[_0xa2a9('0xb')]=_0x40d8b2;logger[_0xa2a9('0xc')](_0xa2a9('0xd'));return rp(_0x2daf1c)[_0xa2a9('0xe')](function(_0x4fb822){if(_0x4fb822){var _0x18f13d=_0x4fb822[_0xa2a9('0xf')];var _0x31b217=null;for(_0x31b217=0x0;_0x31b217<_0x18f13d[_0xa2a9('0x10')];_0x31b217++){if(_0x18f13d[_0x31b217][_0xa2a9('0x11')]===_0x540979[_0xa2a9('0x12')]){_0x540979['adminId']=_0x18f13d[_0x31b217]['id'];_0x47a690=!![];}}if(_0x47a690){logger[_0xa2a9('0xc')](_0xa2a9('0x13'),_0x540979['adminId']);_0x3eaaa6(_0x540979);}else{_0x710040({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x710040({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xa2a9('0x14')](function(_0x53a6a1){logger[_0xa2a9('0x15')]('['+[_0x523164['toUpperCase']()]+']',_0x53a6a1[_0xa2a9('0x16')]);_0x710040(_0x53a6a1);});});}function getUser(_0x11838f,_0x657934,_0x74e4a5){return function(_0x4d8707){return new Promise(function(_0x23f9bb,_0x574964){var _0x2d9864={'method':'GET','uri':_0x74e4a5+_0xa2a9('0x17'),'json':!![]};_0x2d9864['headers']=_0x657934;logger[_0xa2a9('0xc')](_0xa2a9('0x18'));return rp(_0x2d9864)[_0xa2a9('0xe')](function(_0x12a238){if(_0x12a238){var _0x39b378=_0x12a238[_0xa2a9('0xf')];var _0x17ccc3=![];var _0x447338=null;if(_0x4d8707[_0xa2a9('0x19')]!==null){logger[_0xa2a9('0xc')]('Getting\x20user\x20with\x20email',_0x4d8707[_0xa2a9('0x19')]);_0x4d8707[_0xa2a9('0x1a')]=_0x4d8707[_0xa2a9('0x19')];for(_0x447338=0x0;_0x447338<_0x39b378[_0xa2a9('0x10')];_0x447338++){if(_0x39b378[_0x447338][_0xa2a9('0x11')]===_0x4d8707[_0xa2a9('0x19')]){_0x17ccc3=!![];_0x4d8707['userId']=_0x39b378[_0x447338]['id'];logger[_0xa2a9('0xc')]('User\x20found:',_0x4d8707['userId']);}}}if(!_0x17ccc3){logger['info'](_0xa2a9('0x1b'));_0x4d8707[_0xa2a9('0x1a')]=_0x4d8707['adminEmail'];_0x4d8707[_0xa2a9('0x1c')]=_0x4d8707[_0xa2a9('0x1d')];_0x17ccc3=!![];}if(_0x17ccc3){_0x23f9bb(_0x4d8707);}else{_0x574964({'statusCode':0x194,'message':_0xa2a9('0x1e')});}}else{_0x574964({'statusCode':0x194,'message':_0xa2a9('0x1e')});}})['catch'](function(_0x3be9c0){logger[_0xa2a9('0x15')]('['+[_0x11838f[_0xa2a9('0x1f')]()]+']',_0x3be9c0['message']);_0x574964(_0x3be9c0);});});};}function searchContact(_0x29cff8,_0x1089ca,_0x44ea8e,_0x48ca76){return new Promise(function(_0x5f27d9,_0x4cfd47){var _0x10b84f={'method':_0xa2a9('0xa'),'headers':_0x1089ca,'uri':_0x29cff8+_0xa2a9('0x20')+_0x48ca76+_0xa2a9('0x21')+_0x44ea8e+_0xa2a9('0x22'),'json':!![]};rp(_0x10b84f)['then'](function(_0x247fc5){var _0x309fec=_[_0xa2a9('0x23')](_0x247fc5[_0xa2a9('0x24')][_0xa2a9('0x24')],[_0x44ea8e,_0x48ca76]);_0x5f27d9(_0x309fec);})['catch'](function(_0x4bfa9b){_0x4cfd47(_0x4bfa9b);});});}function getEndUser(_0x3a0100,_0x57bbbd,_0x5a4ca6){return function(_0x6825cf){return new Promise(function(_0x391d7c,_0x1a6b77){logger['info'](util[_0xa2a9('0x25')](_0xa2a9('0x26'),_0x6825cf[_0xa2a9('0x27')]));searchContact(_0x5a4ca6,_0x57bbbd,_0xa2a9('0x28'),_0x6825cf['contactNumber'])[_0xa2a9('0xe')](function(_0x466d49){if(_0x466d49){_0x6825cf[_0xa2a9('0x29')]=_0x466d49['id'];logger[_0xa2a9('0xc')]('Contact\x20found\x20mobile_number:',_0x6825cf[_0xa2a9('0x29')]);return _0x391d7c(_0x6825cf);}searchContact(_0x5a4ca6,_0x57bbbd,'work_number',_0x6825cf[_0xa2a9('0x27')])['then'](function(_0x4451b3){if(_0x4451b3){_0x6825cf[_0xa2a9('0x29')]=_0x4451b3['id'];logger[_0xa2a9('0xc')]('Contact\x20found\x20work_number:',_0x6825cf['endUserId']);return _0x391d7c(_0x6825cf);}createEndUser(_0x6825cf,_0x3a0100,_0x57bbbd,_0x5a4ca6)[_0xa2a9('0xe')](function(_0x4ecbcf){logger[_0xa2a9('0xc')]('Contact\x20created:',_0x4ecbcf[_0xa2a9('0x29')]);return _0x391d7c(_0x4ecbcf);});});})['catch'](function(_0x11d7e3){_0x1a6b77(_0x11d7e3);});});};}function createEndUser(_0x4eff2a,_0x556a9e,_0x597a20,_0x563803){return new Promise(function(_0x329f57,_0x1ee592){var _0xc49323=moment();var _0x560bed={'method':_0xa2a9('0x2a'),'uri':_0x563803+_0xa2a9('0x2b'),'body':{'contact':{'last_name':_0x4eff2a['contactNumber'],'work_number':_0x4eff2a['contactNumber'],'mobile_number':_0x4eff2a[_0xa2a9('0x27')],'owner_id':_0x4eff2a[_0xa2a9('0x1c')],'created_at':_0xc49323['format'](_0xa2a9('0x2c'))}},'json':!![]};_0x560bed[_0xa2a9('0xb')]=_0x597a20;logger['info'](_0xa2a9('0x2d'));return rp(_0x560bed)[_0xa2a9('0xe')](function(_0x4752d2){_0x4eff2a[_0xa2a9('0x29')]=_0x4752d2[_0xa2a9('0x2e')]['id'];_0x329f57(_0x4eff2a);})[_0xa2a9('0x14')](function(_0x1ddec3){logger[_0xa2a9('0x15')]('['+[_0x556a9e[_0xa2a9('0x1f')]()]+']',_0x1ddec3[_0xa2a9('0x16')]);_0x1ee592(_0x1ddec3[_0xa2a9('0x16')]);});});}function getTicket(_0x4605bd,_0x18626b,_0x451295,_0x5d5e7c,_0x2b2525){return function(_0x529fcf){logger[_0xa2a9('0xc')](_0xa2a9('0x2f'));return new Promise(function(_0xbdf19a,_0x1404ce){var _0x125bc0=moment();var _0x20fd9b={'method':'POST','uri':_0x451295+_0xa2a9('0x30'),'body':{'title':intUtil[_0xa2a9('0x31')](_0x5d5e7c['Subjects'],_0x2b2525,'\x20'),'description':intUtil['getString'](_0x5d5e7c[_0xa2a9('0x32')],_0x2b2525,'\x0a'),'owner_id':_0x529fcf['userId'],'creater_id':_0x529fcf['adminId'],'targetable_id':_0x529fcf['endUserId'],'targetable_type':_0xa2a9('0x33'),'created_at':_0x125bc0['format'](_0xa2a9('0x2c')),'due_date':_0x125bc0[_0xa2a9('0x34')](0x1e,'m')[_0xa2a9('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x20fd9b[_0xa2a9('0xb')]=_0x18626b;return rp(_0x20fd9b)[_0xa2a9('0xe')](function(_0x3af766){_0x529fcf['ticketId']=_0x3af766[_0xa2a9('0x35')]['id'];logger[_0xa2a9('0xc')](_0xa2a9('0x36'),_0x529fcf[_0xa2a9('0x37')]);_0xbdf19a(_0x529fcf);})[_0xa2a9('0x14')](function(_0xcc471c){logger[_0xa2a9('0x15')]('['+[_0x4605bd[_0xa2a9('0x1f')]()]+']',_0xcc471c[_0xa2a9('0x16')]);_0x1404ce(_0xcc471c[_0xa2a9('0x16')]);});});};}function emit(_0x18f6e8,_0x21e9a8,_0x4fd341){var _0x488172={'uri':_0x18f6e8+_0xa2a9('0x38')+_0x4fd341};io['to'](util[_0xa2a9('0x25')](_0xa2a9('0x39'),_0x21e9a8))[_0xa2a9('0x3a')](_0xa2a9('0x3b'),_0x488172);}exports['cs']=function(_0x23a5e8,_0x2d2d5d,_0x2d7df7,_0x56f492,_0x18ea5a,_0x1d02cb,_0x53e2dc,_0x323406){var _0x569e6a={};var _0x2c99ee={'Authorization':_0xa2a9('0x3c')+_0x1d02cb[_0xa2a9('0x3d')]};_0x1d02cb[_0xa2a9('0x3e')]=intUtil['stripTrailingSlash'](_0x1d02cb[_0xa2a9('0x3e')]);_0x1d02cb['serverUrl']=intUtil['stripTrailingSlash'](_0x1d02cb[_0xa2a9('0x3f')]);var _0x2489c0=_0x1d02cb[_0xa2a9('0x3e')];_0x569e6a[_0xa2a9('0x12')]=_0x1d02cb['username'];_0x569e6a['contactNumber']=_0x323406['toLowerCase']()===_0xa2a9('0x40')?_0x2d2d5d[_0xa2a9('0x41')]:_0x2d2d5d[_0xa2a9('0x42')];_0x569e6a['callDirection']=_0x323406===_0xa2a9('0x43')||_0x323406===_0xa2a9('0x44')?'queue':_0xa2a9('0x40');if(_0x56f492){_0x569e6a[_0xa2a9('0x19')]=_0x56f492['email'];}var _0x33c12d=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d02cb[_0xa2a9('0x3f')],_0x2d2d5d[_0xa2a9('0x45')],md5(_0x2d2d5d[_0xa2a9('0x45')]));if(_0x18ea5a&&_0x18ea5a[_0xa2a9('0x46')]){logger['info'](_0xa2a9('0x47'),_0xa2a9('0x48'));_0x2d2d5d[_0xa2a9('0x49')]=_0x33c12d;}else if(_0x53e2dc&&_0x53e2dc['recordingFormat']&&_0x53e2dc[_0xa2a9('0x4a')]!==_0xa2a9('0x4b')){logger[_0xa2a9('0xc')](_0xa2a9('0x4c'),_0xa2a9('0x48'));_0x2d2d5d[_0xa2a9('0x49')]=_0x33c12d;}else{_0x2d2d5d[_0xa2a9('0x49')]='';}return getAdminId(_0x569e6a,_0x323406,_0x2c99ee,_0x2489c0)[_0xa2a9('0xe')](getUser(_0x323406,_0x2c99ee,_0x2489c0))[_0xa2a9('0xe')](getEndUser(_0x323406,_0x2c99ee,_0x2489c0))[_0xa2a9('0xe')](getTicket(_0x323406,_0x2c99ee,_0x2489c0,_0x2d7df7,_0x2d2d5d))[_0xa2a9('0xe')](function(_0x25cf6b){logger[_0xa2a9('0xc')](util[_0xa2a9('0x25')](_0xa2a9('0x4d'),_0x25cf6b[_0xa2a9('0x37')]));if(_0x323406!==_0xa2a9('0x44')){logger[_0xa2a9('0xc')]('['+[_0x323406[_0xa2a9('0x1f')]()]+']',_0xa2a9('0x4e'));emit(_0x2489c0,_0x56f492[_0xa2a9('0x4f')],_0x25cf6b[_0xa2a9('0x29')]);}})['catch'](function(_0x3c5efb){logger[_0xa2a9('0x15')]('['+[_0x323406[_0xa2a9('0x1f')]()]+_0xa2a9('0x50'),util[_0xa2a9('0x51')](_0x3c5efb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb4c7=['serverUrl','uniqueid','recordingURL','none','[OUTBOUND]','Recording\x20is\x20enabled!','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','GET','/api/selector/owners','headers','info','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','contactNumber','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','endUserId','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','Contact','add','ticketId','Task\x20created:','user:%s','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','username','outbound','destcalleridnum','calleridnum','unmanaged','queue'];(function(_0x219fa5,_0x50a213){var _0x2cf0df=function(_0x5a518a){while(--_0x5a518a){_0x219fa5['push'](_0x219fa5['shift']());}};_0x2cf0df(++_0x50a213);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x10c754,_0x15f434){_0x10c754=_0x10c754-0x0;var _0x1274ea=_0xb4c7[_0x10c754];return _0x1274ea;};'use strict';var _=require(_0x7b4c('0x0'));var rp=require(_0x7b4c('0x1'));var md5=require(_0x7b4c('0x2'));var util=require(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var Promise=require('bluebird');var Redis=require(_0x7b4c('0x5'));var intUtil=require(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));var logger=require(_0x7b4c('0x8'))(_0x7b4c('0x9'));config['redis']=_[_0x7b4c('0xa')](config[_0x7b4c('0xb')],{'host':_0x7b4c('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7b4c('0xb')]));function getAdminId(_0x21687f,_0x570daa,_0x433aa2,_0x179b2d){return new Promise(function(_0x28e902,_0x237e28){var _0x365225=![];var _0x93d013={'method':_0x7b4c('0xd'),'uri':_0x179b2d+_0x7b4c('0xe'),'json':!![]};_0x93d013[_0x7b4c('0xf')]=_0x433aa2;logger[_0x7b4c('0x10')]('Getting\x20admin\x20information');return rp(_0x93d013)['then'](function(_0x24dd7d){if(_0x24dd7d){var _0x18342b=_0x24dd7d[_0x7b4c('0x11')];var _0x1722ad=null;for(_0x1722ad=0x0;_0x1722ad<_0x18342b[_0x7b4c('0x12')];_0x1722ad++){if(_0x18342b[_0x1722ad][_0x7b4c('0x13')]===_0x21687f[_0x7b4c('0x14')]){_0x21687f[_0x7b4c('0x15')]=_0x18342b[_0x1722ad]['id'];_0x365225=!![];}}if(_0x365225){logger[_0x7b4c('0x10')](_0x7b4c('0x16'),_0x21687f['adminId']);_0x28e902(_0x21687f);}else{_0x237e28({'statusCode':0x194,'message':_0x7b4c('0x17')});}}else{_0x237e28({'statusCode':0x194,'message':_0x7b4c('0x17')});}})[_0x7b4c('0x18')](function(_0x2a0e2f){logger[_0x7b4c('0x19')]('['+[_0x570daa[_0x7b4c('0x1a')]()]+']',_0x2a0e2f[_0x7b4c('0x1b')]);_0x237e28(_0x2a0e2f);});});}function getUser(_0x22c409,_0x4d3f5e,_0x36e701){return function(_0xe71d88){return new Promise(function(_0x15a5a9,_0x36c02a){var _0x59ae96={'method':_0x7b4c('0xd'),'uri':_0x36e701+_0x7b4c('0xe'),'json':!![]};_0x59ae96[_0x7b4c('0xf')]=_0x4d3f5e;logger[_0x7b4c('0x10')](_0x7b4c('0x1c'));return rp(_0x59ae96)[_0x7b4c('0x1d')](function(_0x237110){if(_0x237110){var _0x445281=_0x237110[_0x7b4c('0x11')];var _0x55e3df=![];var _0x1f06ec=null;if(_0xe71d88[_0x7b4c('0x1e')]!==null){logger[_0x7b4c('0x10')](_0x7b4c('0x1f'),_0xe71d88[_0x7b4c('0x1e')]);_0xe71d88[_0x7b4c('0x20')]=_0xe71d88[_0x7b4c('0x1e')];for(_0x1f06ec=0x0;_0x1f06ec<_0x445281[_0x7b4c('0x12')];_0x1f06ec++){if(_0x445281[_0x1f06ec][_0x7b4c('0x13')]===_0xe71d88[_0x7b4c('0x1e')]){_0x55e3df=!![];_0xe71d88['userId']=_0x445281[_0x1f06ec]['id'];logger[_0x7b4c('0x10')](_0x7b4c('0x21'),_0xe71d88[_0x7b4c('0x22')]);}}}if(!_0x55e3df){logger[_0x7b4c('0x10')](_0x7b4c('0x23'));_0xe71d88[_0x7b4c('0x20')]=_0xe71d88[_0x7b4c('0x14')];_0xe71d88[_0x7b4c('0x22')]=_0xe71d88[_0x7b4c('0x15')];_0x55e3df=!![];}if(_0x55e3df){_0x15a5a9(_0xe71d88);}else{_0x36c02a({'statusCode':0x194,'message':_0x7b4c('0x17')});}}else{_0x36c02a({'statusCode':0x194,'message':_0x7b4c('0x17')});}})[_0x7b4c('0x18')](function(_0x316e5f){logger['error']('['+[_0x22c409[_0x7b4c('0x1a')]()]+']',_0x316e5f[_0x7b4c('0x1b')]);_0x36c02a(_0x316e5f);});});};}function searchContact(_0x1fe0f5,_0x3671c4,_0x207c2f,_0x4ce02c){return new Promise(function(_0x1de2b1,_0x2552f9){var _0x3e4a46={'method':_0x7b4c('0xd'),'headers':_0x3671c4,'uri':_0x1fe0f5+_0x7b4c('0x24')+_0x4ce02c+_0x7b4c('0x25')+_0x207c2f+_0x7b4c('0x26'),'json':!![]};rp(_0x3e4a46)[_0x7b4c('0x1d')](function(_0x435543){var _0x3e5bdd=_[_0x7b4c('0x27')](_0x435543[_0x7b4c('0x28')][_0x7b4c('0x28')],[_0x207c2f,_0x4ce02c]);_0x1de2b1(_0x3e5bdd);})['catch'](function(_0x59874f){_0x2552f9(_0x59874f);});});}function getEndUser(_0x511f21,_0x2fe0f4,_0x2efff3){return function(_0x14fb7f){return new Promise(function(_0x66e770,_0x498391){logger[_0x7b4c('0x10')](util[_0x7b4c('0x29')]('Searching\x20contact\x20with\x20phone\x20%s',_0x14fb7f[_0x7b4c('0x2a')]));searchContact(_0x2efff3,_0x2fe0f4,'mobile_number',_0x14fb7f[_0x7b4c('0x2a')])[_0x7b4c('0x1d')](function(_0x159001){if(_0x159001){_0x14fb7f['endUserId']=_0x159001['id'];logger[_0x7b4c('0x10')](_0x7b4c('0x2b'),_0x14fb7f['endUserId']);return _0x66e770(_0x14fb7f);}searchContact(_0x2efff3,_0x2fe0f4,_0x7b4c('0x2c'),_0x14fb7f[_0x7b4c('0x2a')])[_0x7b4c('0x1d')](function(_0x2e0835){if(_0x2e0835){_0x14fb7f['endUserId']=_0x2e0835['id'];logger['info'](_0x7b4c('0x2d'),_0x14fb7f[_0x7b4c('0x2e')]);return _0x66e770(_0x14fb7f);}createEndUser(_0x14fb7f,_0x511f21,_0x2fe0f4,_0x2efff3)['then'](function(_0x37faae){logger['info']('Contact\x20created:',_0x37faae[_0x7b4c('0x2e')]);return _0x66e770(_0x37faae);});});})[_0x7b4c('0x18')](function(_0x39d69a){_0x498391(_0x39d69a);});});};}function createEndUser(_0x250901,_0x5ba56a,_0x81ddf4,_0x166189){return new Promise(function(_0x19770e,_0x2721d9){var _0x346e0c=moment();var _0xddd16={'method':_0x7b4c('0x2f'),'uri':_0x166189+'/api/contacts','body':{'contact':{'last_name':_0x250901['contactNumber'],'work_number':_0x250901[_0x7b4c('0x2a')],'mobile_number':_0x250901[_0x7b4c('0x2a')],'owner_id':_0x250901[_0x7b4c('0x22')],'created_at':_0x346e0c[_0x7b4c('0x29')](_0x7b4c('0x30'))}},'json':!![]};_0xddd16['headers']=_0x81ddf4;logger[_0x7b4c('0x10')](_0x7b4c('0x31'));return rp(_0xddd16)[_0x7b4c('0x1d')](function(_0x26346a){_0x250901[_0x7b4c('0x2e')]=_0x26346a[_0x7b4c('0x32')]['id'];_0x19770e(_0x250901);})[_0x7b4c('0x18')](function(_0x1080fc){logger[_0x7b4c('0x19')]('['+[_0x5ba56a['toUpperCase']()]+']',_0x1080fc[_0x7b4c('0x1b')]);_0x2721d9(_0x1080fc['message']);});});}function getTicket(_0x2a3a74,_0x4dc71f,_0xd464aa,_0x46a23d,_0x5bb6d0){return function(_0x50f2ed){logger[_0x7b4c('0x10')](_0x7b4c('0x33'));return new Promise(function(_0x1def44,_0x3d8eb8){var _0x57abb5=moment();var _0x2b1681={'method':_0x7b4c('0x2f'),'uri':_0xd464aa+_0x7b4c('0x34'),'body':{'title':intUtil['getString'](_0x46a23d[_0x7b4c('0x35')],_0x5bb6d0,'\x20'),'description':intUtil['getString'](_0x46a23d['Descriptions'],_0x5bb6d0,'\x0a'),'owner_id':_0x50f2ed[_0x7b4c('0x22')],'creater_id':_0x50f2ed['adminId'],'targetable_id':_0x50f2ed[_0x7b4c('0x2e')],'targetable_type':_0x7b4c('0x36'),'created_at':_0x57abb5[_0x7b4c('0x29')](_0x7b4c('0x30')),'due_date':_0x57abb5[_0x7b4c('0x37')](0x1e,'m')[_0x7b4c('0x29')](_0x7b4c('0x30'))},'json':!![]};_0x2b1681[_0x7b4c('0xf')]=_0x4dc71f;return rp(_0x2b1681)[_0x7b4c('0x1d')](function(_0x4c9fe3){_0x50f2ed[_0x7b4c('0x38')]=_0x4c9fe3['task']['id'];logger['info'](_0x7b4c('0x39'),_0x50f2ed[_0x7b4c('0x38')]);_0x1def44(_0x50f2ed);})['catch'](function(_0x529fde){logger[_0x7b4c('0x19')]('['+[_0x2a3a74[_0x7b4c('0x1a')]()]+']',_0x529fde[_0x7b4c('0x1b')]);_0x3d8eb8(_0x529fde[_0x7b4c('0x1b')]);});});};}function emit(_0x8ebf9b,_0x4759e9,_0x336796){var _0x1cf7c7={'uri':_0x8ebf9b+'/contacts/'+_0x336796};io['to'](util[_0x7b4c('0x29')](_0x7b4c('0x3a'),_0x4759e9))[_0x7b4c('0x3b')](_0x7b4c('0x3c'),_0x1cf7c7);}exports['cs']=function(_0xc76435,_0x379f15,_0x11a6f9,_0x2c9cf1,_0x45957d,_0x5a1262,_0x4df2fa,_0x1884a4){var _0x3f6aaa={};var _0x97eadf={'Authorization':'Token\x20token='+_0x5a1262[_0x7b4c('0x3d')]};_0x5a1262[_0x7b4c('0x3e')]=intUtil['stripTrailingSlash'](_0x5a1262[_0x7b4c('0x3e')]);_0x5a1262['serverUrl']=intUtil[_0x7b4c('0x3f')](_0x5a1262['serverUrl']);var _0x2454f8=_0x5a1262['remoteUri'];_0x3f6aaa[_0x7b4c('0x14')]=_0x5a1262[_0x7b4c('0x40')];_0x3f6aaa['contactNumber']=_0x1884a4['toLowerCase']()===_0x7b4c('0x41')?_0x379f15[_0x7b4c('0x42')]:_0x379f15[_0x7b4c('0x43')];_0x3f6aaa['callDirection']=_0x1884a4==='queue'||_0x1884a4===_0x7b4c('0x44')?_0x7b4c('0x45'):'outbound';if(_0x2c9cf1){_0x3f6aaa['agentEmail']=_0x2c9cf1[_0x7b4c('0x13')];}var _0x2a1442=util[_0x7b4c('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5a1262[_0x7b4c('0x46')],_0x379f15[_0x7b4c('0x47')],md5(_0x379f15['uniqueid']));if(_0x45957d&&_0x45957d['monitor_format']){logger[_0x7b4c('0x10')]('[QUEUE]','Recording\x20is\x20enabled!');_0x379f15[_0x7b4c('0x48')]=_0x2a1442;}else if(_0x4df2fa&&_0x4df2fa['recordingFormat']&&_0x4df2fa['recordingFormat']!==_0x7b4c('0x49')){logger[_0x7b4c('0x10')](_0x7b4c('0x4a'),_0x7b4c('0x4b'));_0x379f15['recordingURL']=_0x2a1442;}else{_0x379f15['recordingURL']='';}return getAdminId(_0x3f6aaa,_0x1884a4,_0x97eadf,_0x2454f8)[_0x7b4c('0x1d')](getUser(_0x1884a4,_0x97eadf,_0x2454f8))[_0x7b4c('0x1d')](getEndUser(_0x1884a4,_0x97eadf,_0x2454f8))[_0x7b4c('0x1d')](getTicket(_0x1884a4,_0x97eadf,_0x2454f8,_0x11a6f9,_0x379f15))['then'](function(_0x255262){logger[_0x7b4c('0x10')](util[_0x7b4c('0x29')]('The\x20ticket\x20ID\x20is:\x20%s',_0x255262[_0x7b4c('0x38')]));if(_0x1884a4!==_0x7b4c('0x44')){logger['info']('['+[_0x1884a4[_0x7b4c('0x1a')]()]+']',_0x7b4c('0x4c'));emit(_0x2454f8,_0x2c9cf1[_0x7b4c('0x4d')],_0x255262[_0x7b4c('0x2e')]);}})[_0x7b4c('0x18')](function(_0x254aeb){logger[_0x7b4c('0x19')]('['+[_0x1884a4['toUpperCase']()]+_0x7b4c('0x4e'),util[_0x7b4c('0x4f')](_0x254aeb,{'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 5173f70..935d998 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 _0x93e9=['EVENT\x20UNKNOWN','unmanaged','desk','unknown\x20integration','../../../../config/logger','error','format','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log'];(function(_0x2aeba4,_0x47184c){var _0x3db727=function(_0x4b5056){while(--_0x4b5056){_0x2aeba4['push'](_0x2aeba4['shift']());}};_0x3db727(++_0x47184c);}(_0x93e9,0xcc));var _0x993e=function(_0x2c856c,_0x1eeaa6){_0x2c856c=_0x2c856c-0x0;var _0xa9d840=_0x93e9[_0x2c856c];return _0xa9d840;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var zendesk=require(_0x993e('0x2'));var salesforce=require(_0x993e('0x3'));var sugarcrm=require(_0x993e('0x4'));var freshdesk=require(_0x993e('0x5'));var zoho=require(_0x993e('0x6'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x993e('0x7'));var dynamics365=require(_0x993e('0x8'));var freshsales=require(_0x993e('0x9'));var integrations=[_0x993e('0xa'),_0x993e('0xb'),_0x993e('0xc'),_0x993e('0xd'),_0x993e('0xe'),'desk',_0x993e('0xf'),_0x993e('0x10'),_0x993e('0x11'),_0x993e('0x12')];exports[_0x993e('0x13')]=function(_0x27a28f,_0x1c2324,_0x48291a,_0x196f6d,_0x10cf0e,_0x4fe40b){if(_0x48291a){if(_['includes'](integrations,_0x27a28f[_0x993e('0x14')]['toLowerCase']())){try{var _0x333aa9=null;var _0x5d5c0d='';var _0x4c2707=_0x48291a[_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]()];if(_0x4c2707){var _0x156bef=_0x4c2707[_0x27a28f[_0x993e('0x16')]];if(_0x156bef){var _0x3e082b=_[_0x993e('0x17')](_0x156bef[_0x993e('0x18')],{'id':parseInt(_0x27a28f[_0x993e('0x19')],0xa)});if(_0x3e082b){if(_0x196f6d){if(_0x10cf0e&&_0x1c2324[_0x993e('0x1a')]){_0x5d5c0d=_0x993e('0x1a');}else if(_0x1c2324[_0x993e('0x1b')]){_0x5d5c0d=_0x993e('0x1c');}else{console[_0x993e('0x1d')](_0x993e('0x1e'),_0x1c2324);}}else{_0x5d5c0d=_0x993e('0x1f');}switch(_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]()){case'zendesk':zendesk[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xb'):salesforce[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xc'):sugarcrm[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xd'):freshdesk[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xe'):zoho[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0x20'):desk[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xf'):vtiger[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case'freshsales':freshsales['cs'](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b,_0x5d5c0d);break;case _0x993e('0x12'):servicenow['cs'](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b,_0x5d5c0d);break;case _0x993e('0x10'):dynamics365['cs'](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b,_0x5d5c0d);break;default:console[_0x993e('0x1d')](_0x993e('0x21'));}}else{_0x333aa9=require(_0x993e('0x22'))(_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]());_0x333aa9[_0x993e('0x23')]('[EXEC]',util[_0x993e('0x24')]('%s\x20configuration\x20#%s\x20not\x20found',_0x27a28f[_0x993e('0x14')][_0x993e('0x15')](),_0x27a28f[_0x993e('0x19')]));}}else{_0x333aa9=require('../../../../config/logger')(_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]());_0x333aa9[_0x993e('0x23')](_0x993e('0x25'),util[_0x993e('0x24')](_0x993e('0x26'),_0x27a28f[_0x993e('0x14')][_0x993e('0x15')](),_0x27a28f[_0x993e('0x16')]));}}else{}}catch(_0x18f6ac){console[_0x993e('0x23')](_0x18f6ac);}}}}; \ No newline at end of file +var _0x955f=['%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./servicenow','./freshsales','zendesk','salesforce','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','unmanaged','desk','unknown\x20integration','error','format','../../../../config/logger','[EXEC]'];(function(_0x8e46bc,_0x14dd01){var _0x4da9a9=function(_0x2750ec){while(--_0x2750ec){_0x8e46bc['push'](_0x8e46bc['shift']());}};_0x4da9a9(++_0x14dd01);}(_0x955f,0x1eb));var _0xf955=function(_0x4bc9d7,_0x23ac58){_0x4bc9d7=_0x4bc9d7-0x0;var _0x4a4afb=_0x955f[_0x4bc9d7];return _0x4a4afb;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var zendesk=require(_0xf955('0x2'));var salesforce=require(_0xf955('0x3'));var sugarcrm=require(_0xf955('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xf955('0x5'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0xf955('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0xf955('0x7'));var integrations=[_0xf955('0x8'),_0xf955('0x9'),'sugarcrm',_0xf955('0xa'),_0xf955('0xb'),'desk',_0xf955('0xc'),_0xf955('0xd'),_0xf955('0xe'),_0xf955('0xf')];exports[_0xf955('0x10')]=function(_0x421e4a,_0x186719,_0x4d213a,_0xf7e3e,_0x5b0afa,_0x2d59e9){if(_0x4d213a){if(_[_0xf955('0x11')](integrations,_0x421e4a[_0xf955('0x12')]['toLowerCase']())){try{var _0x2f61b8=null;var _0x542347='';var _0x23e0c6=_0x4d213a[_0x421e4a['data1'][_0xf955('0x13')]()];if(_0x23e0c6){var _0x2ff7e5=_0x23e0c6[_0x421e4a[_0xf955('0x14')]];if(_0x2ff7e5){var _0x109bc5=_[_0xf955('0x15')](_0x2ff7e5[_0xf955('0x16')],{'id':parseInt(_0x421e4a[_0xf955('0x17')],0xa)});if(_0x109bc5){if(_0xf7e3e){if(_0x5b0afa&&_0x186719[_0xf955('0x18')]){_0x542347=_0xf955('0x18');}else if(_0x186719[_0xf955('0x19')]){_0x542347='outbound';}else{console[_0xf955('0x1a')]('EVENT\x20UNKNOWN',_0x186719);}}else{_0x542347=_0xf955('0x1b');}switch(_0x421e4a[_0xf955('0x12')][_0xf955('0x13')]()){case _0xf955('0x8'):zendesk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'salesforce':salesforce[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'sugarcrm':sugarcrm[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xa'):freshdesk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xb'):zoho[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0x1c'):desk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'vtiger':vtiger[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xe'):freshsales['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;case _0xf955('0xf'):servicenow['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;case _0xf955('0xd'):dynamics365['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;default:console[_0xf955('0x1a')](_0xf955('0x1d'));}}else{_0x2f61b8=require('../../../../config/logger')(_0x421e4a[_0xf955('0x12')][_0xf955('0x13')]());_0x2f61b8[_0xf955('0x1e')]('[EXEC]',util[_0xf955('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x421e4a[_0xf955('0x12')][_0xf955('0x13')](),_0x421e4a[_0xf955('0x17')]));}}else{_0x2f61b8=require(_0xf955('0x20'))(_0x421e4a[_0xf955('0x12')]['toLowerCase']());_0x2f61b8[_0xf955('0x1e')](_0xf955('0x21'),util[_0xf955('0x1f')](_0xf955('0x22'),_0x421e4a[_0xf955('0x12')][_0xf955('0x13')](),_0x421e4a[_0xf955('0x14')]));}}else{}}catch(_0x552cf3){console[_0xf955('0x1e')](_0x552cf3);}}}}; \ 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 3107370..72ffd28 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 _0x65c5=['trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','catch','stringify','outbound','recordingFormat','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','WhoId','Case','endUserType','contact','ContactId','lead','leadId','info','isNil','User','find','execute','then','Email','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','length','sobject','Lead','Phone','Name','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','create','forEach','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','remoteUri','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s'];(function(_0x34594e,_0x381c98){var _0x1a7f8b=function(_0x514e72){while(--_0x514e72){_0x34594e['push'](_0x34594e['shift']());}};_0x1a7f8b(++_0x381c98);}(_0x65c5,0x8a));var _0x565c=function(_0xc06a29,_0x3ea273){_0xc06a29=_0xc06a29-0x0;var _0x528394=_0x65c5[_0xc06a29];return _0x528394;};'use strict';var _=require(_0x565c('0x0'));var rp=require(_0x565c('0x1'));var moment=require(_0x565c('0x2'));var BPromise=require(_0x565c('0x3'));var md5=require('md5');var jsforce=require('jsforce');var util=require('util');var Redis=require(_0x565c('0x4'));var intUtil=require(_0x565c('0x5'));var config=require('../../../../config/environment');var logger=require(_0x565c('0x6'))(_0x565c('0x7'));config[_0x565c('0x8')]=_[_0x565c('0x9')](config['redis'],{'host':_0x565c('0xa'),'port':0x18eb});var io=require(_0x565c('0xb'))(new Redis(config[_0x565c('0x8')]));function emit(_0xa9b5d0,_0x4e7a69,_0x21a1aa){io['to'](_0xa9b5d0)[_0x565c('0xc')](_0x4e7a69,_0x21a1aa);}function getTicket(_0x29d40f,_0x3a4d3a,_0x246bba,_0x53873c,_0x1a4b1b,_0x2f9cf7,_0x3a9a61,_0x3a0098){var _0x18d306=Object[_0x565c('0xd')]({},{'OwnerId':_0x3a4d3a['id'],'Subject':intUtil['getString'](_0x53873c[_0x565c('0xe')],_0x1a4b1b,'\x20'),'Description':intUtil['getString'](_0x53873c[_0x565c('0xf')],_0x1a4b1b,'\x0a')},getCustomFields(_0x2f9cf7,_0x1a4b1b));if(_0x246bba){if(_0x53873c[_0x565c('0x10')]===_0x565c('0x11')){_0x18d306[_0x565c('0x12')]=moment[_0x565c('0x13')]();_0x18d306[_0x565c('0x14')]=![];_0x18d306['IsRecurrence']=![];_0x18d306[_0x565c('0x15')]=_0x246bba['id'];}else if(_0x53873c[_0x565c('0x10')]===_0x565c('0x16')){if(_0x246bba[_0x565c('0x17')]===_0x565c('0x18')){_0x18d306[_0x565c('0x19')]=_0x246bba['id'];}else if(_0x246bba['endUserType']===_0x565c('0x1a')&&_0x53873c[_0x565c('0x1b')]){_0x18d306[_0x53873c['leadId']]=_0x246bba['id'];}else{logger[_0x565c('0x1c')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x3a9a61['sobject'](_0x53873c['ticketType'])['create'](_0x18d306);}function getUser(_0x48d48b,_0x2a482b,_0x1ecdba){if(!_[_0x565c('0x1d')](_0x2a482b)&&intUtil['validateEmail'](_0x2a482b)){var _0x3f238d={'Email':_0x2a482b};var _0x111871={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1ecdba['sobject'](_0x565c('0x1e'))[_0x565c('0x1f')](_0x3f238d,_0x111871)[_0x565c('0x20')]()[_0x565c('0x21')](function(_0x3b4576){if(_0x3b4576['length']){var _0x1bc17b=_[_0x565c('0x1f')](_0x3b4576,function(_0x4d4dad){return _0x4d4dad[_0x565c('0x22')]===_0x2a482b;});if(_0x1bc17b){logger[_0x565c('0x1c')](_0x565c('0x23'),_0x2a482b);return BPromise['resolve']({'id':_0x1bc17b['Id'],'name':_0x1bc17b['Name']});}}else{logger[_0x565c('0x1c')](_0x565c('0x24'),_0x2a482b);return _0x1ecdba['identity']()['then'](function(_0x25c44e){return BPromise[_0x565c('0x25')]({'id':_0x25c44e[_0x565c('0x26')],'name':_0x25c44e[_0x565c('0x27')]});});}});}else{logger[_0x565c('0x1c')](_0x565c('0x24'),_0x2a482b);return _0x1ecdba[_0x565c('0x28')]()['then'](function(_0x2217ac){return BPromise[_0x565c('0x25')]({'id':_0x2217ac[_0x565c('0x26')],'name':_0x2217ac['display_name']});});}}function getEndUser(_0x18cdb6,_0x1f50ce,_0x34655f,_0x27b4f4,_0x5ebedc){var _0x31ca51={'Phone':_0x27b4f4};var _0x3f8b03={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x565c('0x25')]()[_0x565c('0x21')](function(){logger[_0x565c('0x1c')](_0x565c('0x29'),_0x27b4f4,_0x1f50ce['moduleSearch']);switch(_0x1f50ce[_0x565c('0x2a')]){case _0x565c('0x2b'):return _0x5ebedc['sobject'](_0x565c('0x2c'))[_0x565c('0x1f')](_0x31ca51,_0x3f8b03)['execute']()[_0x565c('0x21')](function(_0x5c8fa2){if(_0x5c8fa2&&_0x5c8fa2[_0x565c('0x2d')]){return _0x5c8fa2;}else{return _0x5ebedc[_0x565c('0x2e')]('Lead')[_0x565c('0x1f')](_0x31ca51,_0x3f8b03);}});case _0x565c('0x18'):return _0x5ebedc[_0x565c('0x2e')]('Contact')['find'](_0x31ca51,_0x3f8b03)[_0x565c('0x20')]();case _0x565c('0x1a'):return _0x5ebedc[_0x565c('0x2e')](_0x565c('0x2f'))[_0x565c('0x1f')](_0x31ca51,_0x3f8b03);default:return null;}})[_0x565c('0x21')](function(_0x4d6538){if(_0x4d6538&&_0x4d6538['length']){var _0x11d3e1=_[_0x565c('0x1f')](_0x4d6538,function(_0x3dea72){return _0x3dea72[_0x565c('0x30')]===_0x27b4f4;});if(_0x11d3e1){return BPromise[_0x565c('0x25')]({'id':_0x11d3e1['Id'],'name':_0x11d3e1[_0x565c('0x31')],'phone':_0x11d3e1[_0x565c('0x30')],'endUserType':_0x11d3e1[_0x565c('0x32')]['type'][_0x565c('0x33')]()});}}})[_0x565c('0x21')](function(_0x26601a){if(_0x26601a){logger[_0x565c('0x1c')](_0x565c('0x34'),_0x26601a[_0x565c('0x17')],_0x27b4f4);return BPromise[_0x565c('0x25')](_0x26601a);}else{logger[_0x565c('0x1c')](_0x565c('0x35'),_0x27b4f4);var _0xa18683={'LastName':_0x34655f!==_0x565c('0x36')?_0x34655f:util[_0x565c('0x37')](_0x565c('0x38'),_0x27b4f4),'Phone':_0x27b4f4};if(_0x1f50ce[_0x565c('0x39')]){if(_0x1f50ce['moduleCreate']===_0x565c('0x18')){logger[_0x565c('0x1c')](_0x565c('0x3a'),_0x27b4f4,_0x1f50ce['moduleCreate']);}else if(_0x1f50ce[_0x565c('0x39')]===_0x565c('0x1a')){logger[_0x565c('0x1c')](_0x565c('0x3a'),_0x27b4f4,_0x1f50ce[_0x565c('0x39')]);_0xa18683[_0x565c('0x3b')]='No\x20Company';}else{return null;}}return _0x5ebedc[_0x565c('0x2e')](_[_0x565c('0x3c')](_0x1f50ce[_0x565c('0x39')]))[_0x565c('0x3d')](_0xa18683)[_0x565c('0x21')](function(_0x3e3f04){return BPromise[_0x565c('0x25')]({'id':_0x3e3f04['id'],'endUserType':_0x1f50ce[_0x565c('0x39')]});});}});}function getCustomFields(_0x2ada1e,_0x1147aa){var _0x4b8993={};if(_0x2ada1e[_0x565c('0x2d')]>0x0){_[_0x565c('0x3e')](_0x2ada1e,function(_0x5a56a8){if(_['includes']([_0x565c('0x3f'),'picklist'],_0x5a56a8[_0x565c('0x40')])&&_0x5a56a8[_0x565c('0x41')]){_0x4b8993[_0x5a56a8[_0x565c('0x41')]]=_0x5a56a8[_0x565c('0x42')][_0x565c('0x43')]();}else if(_0x5a56a8['type']===_0x565c('0x44')&&_0x5a56a8[_0x565c('0x45')]&&_0x5a56a8[_0x565c('0x41')]){_0x1147aa[_0x5a56a8[_0x565c('0x45')]]&&(_0x4b8993[_0x5a56a8[_0x565c('0x41')]]=_0x1147aa[_0x5a56a8[_0x565c('0x45')]]['toString']());}else if(_0x5a56a8[_0x565c('0x40')]===_0x565c('0x46')&&_0x5a56a8[_0x565c('0x47')]&&_0x5a56a8['Variable'][_0x565c('0x48')]&&_0x5a56a8[_0x565c('0x41')]){_0x1147aa[_0x5a56a8['Variable']['name'][_0x565c('0x33')]()]&&(_0x4b8993[_0x5a56a8[_0x565c('0x41')]]=_0x1147aa[_0x5a56a8[_0x565c('0x47')][_0x565c('0x48')][_0x565c('0x33')]()][_0x565c('0x43')]());}});}return _0x4b8993;}function getConnection(_0x50ff96){var _0x2c9150=_0x50ff96['password'][_0x565c('0x49')](_0x50ff96[_0x565c('0x4a')]);var _0x1b024e=new jsforce['Connection']({'oauth2':{'loginUrl':_0x50ff96[_0x565c('0x4b')]||'https://login.salesforce.com','clientId':_0x50ff96['clientId'],'clientSecret':_0x50ff96[_0x565c('0x4c')]}});return _0x1b024e[_0x565c('0x4d')](_0x50ff96[_0x565c('0x4e')],_0x2c9150)[_0x565c('0x21')](function(){logger[_0x565c('0x1c')](_0x565c('0x4f'));return _0x1b024e;});}exports[_0x565c('0x50')]=function(_0x16412c,_0x1c21c8,_0x20c830,_0x34b9df,_0x13ba59,_0x1d37b9){var _0x429dfb,_0x3bf8d1,_0xc2aa94,_0x5e2192;_0x1d37b9[_0x565c('0x51')]=intUtil[_0x565c('0x52')](_0x1d37b9[_0x565c('0x51')]);_0x1d37b9['remoteUri']=intUtil[_0x565c('0x52')](_0x1d37b9[_0x565c('0x4b')]);if(_0x13ba59&&_0x13ba59[_0x565c('0x53')]){logger[_0x565c('0x1c')]('[QUEUE]',_0x565c('0x54'));_0x1c21c8[_0x565c('0x55')]=util[_0x565c('0x37')](_0x565c('0x56'),_0x1d37b9[_0x565c('0x51')],_0x1c21c8[_0x565c('0x57')],md5(_0x1c21c8[_0x565c('0x57')]));}else{_0x1c21c8[_0x565c('0x55')]='';}return getConnection(_0x1d37b9)[_0x565c('0x21')](function(_0x1f1db3){_0x5e2192=_0x1f1db3;return getUser(_0x1d37b9,_0x34b9df['email'],_0x5e2192);})[_0x565c('0x21')](function(_0x1852e9){_0x429dfb=_0x1852e9;return getEndUser(_0x1d37b9,_0x20c830,_0x1c21c8[_0x565c('0x58')],_0x1c21c8['calleridnum'],_0x5e2192);})[_0x565c('0x21')](function(_0x14ad87){_0x3bf8d1=_0x14ad87;return getTicket(_0x1d37b9,_0x429dfb,_0x3bf8d1,_0x20c830,_0x1c21c8,_0x20c830[_0x565c('0x59')],_0x5e2192,'queue');})[_0x565c('0x21')](function(_0x35624c){_0xc2aa94=_0x35624c;logger['info'](_0x565c('0x5a'),_0xc2aa94['id']);logger[_0x565c('0x1c')](_0x565c('0x5b'),_0xc2aa94['id'],_0x34b9df[_0x565c('0x48')],_0x1d37b9['type']);switch(_0x1d37b9[_0x565c('0x40')]){case _0x565c('0x5c'):emit(util['format'](_0x565c('0x5d'),_0x34b9df['name']),_0x565c('0x5e'),{'recordId':_0xc2aa94['id']});break;case _0x565c('0x5f'):emit(util[_0x565c('0x37')](_0x565c('0x5d'),_0x34b9df[_0x565c('0x48')]),_0x565c('0x60'),{'uri':util[_0x565c('0x37')](_0x565c('0x61'),_0x5e2192['instanceUrl'],_0xc2aa94['id'])});break;default:logger[_0x565c('0x62')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x565c('0x63')](function(_0x30e6c7){logger['error']('[QUEUE]',JSON[_0x565c('0x64')](_0x30e6c7));});};exports[_0x565c('0x65')]=function(_0x562b19,_0x3fcbdb,_0x1cea70,_0xc5df70,_0x3d7899,_0x695c82,_0x1546e8){var _0xc94e1f,_0x5bc1e0,_0x1708ac,_0x57982e;_0x695c82[_0x565c('0x51')]=intUtil[_0x565c('0x52')](_0x695c82[_0x565c('0x51')]);_0x695c82[_0x565c('0x4b')]=intUtil[_0x565c('0x52')](_0x695c82[_0x565c('0x4b')]);if(_0x1546e8&&_0x1546e8[_0x565c('0x66')]&&_0x1546e8[_0x565c('0x66')]!=='none'){logger[_0x565c('0x1c')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3fcbdb['recordingURL']=util[_0x565c('0x37')](_0x565c('0x56'),_0x695c82['serverUrl'],_0x3fcbdb[_0x565c('0x57')],md5(_0x3fcbdb['uniqueid']));}return getConnection(_0x695c82)[_0x565c('0x21')](function(_0x21e6e5){_0x57982e=_0x21e6e5;return getUser(_0x695c82,_0xc5df70[_0x565c('0x67')],_0x57982e);})['then'](function(_0x159d9f){_0xc94e1f=_0x159d9f;return getEndUser(_0x695c82,_0x1cea70,_0x3fcbdb[_0x565c('0x68')],_0x3fcbdb[_0x565c('0x69')],_0x57982e);})[_0x565c('0x21')](function(_0x3d7b3a){_0x5bc1e0=_0x3d7b3a;return getTicket(_0x695c82,_0xc94e1f,_0x5bc1e0,_0x1cea70,_0x3fcbdb,_0x1cea70[_0x565c('0x59')],_0x57982e,_0x565c('0x65'));})['then'](function(_0x4f3102){_0x1708ac=_0x4f3102;logger[_0x565c('0x1c')](_0x565c('0x6a'),_0x1708ac['id']);logger[_0x565c('0x1c')](_0x565c('0x6b'),_0x1708ac['id'],_0xc5df70[_0x565c('0x48')],_0x695c82['type']);switch(_0x695c82['type']){case _0x565c('0x5c'):emit(util[_0x565c('0x37')]('user:%s',_0xc5df70[_0x565c('0x48')]),_0x565c('0x5e'),{'recordId':_0x1708ac['id']});break;case _0x565c('0x5f'):emit(util[_0x565c('0x37')](_0x565c('0x5d'),_0xc5df70['name']),'trigger:browser:url',{'uri':util[_0x565c('0x37')](_0x565c('0x61'),_0x57982e['instanceUrl'],_0x1708ac['id'])});break;default:logger[_0x565c('0x62')](_0x565c('0x6c'),_0x565c('0x6d'));}})[_0x565c('0x63')](function(_0x2cedfd){logger[_0x565c('0x62')](_0x565c('0x6c'),JSON['stringify'](_0x2cedfd));});};exports[_0x565c('0x6e')]=function(_0x455054,_0x521508,_0xa2e0d,_0x32e7d1,_0x5a9e6f,_0x2c8229){var _0x1fd90a,_0x19e00e,_0x31fcb2,_0x7ae906;_0x2c8229[_0x565c('0x51')]=intUtil[_0x565c('0x52')](_0x2c8229[_0x565c('0x51')]);_0x2c8229[_0x565c('0x4b')]=intUtil[_0x565c('0x52')](_0x2c8229['remoteUri']);if(_0x5a9e6f&&_0x5a9e6f['monitor_format']){logger['info']('['+_0x521508[_0x565c('0x6f')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x521508[_0x565c('0x55')]=util[_0x565c('0x37')](_0x565c('0x56'),_0x2c8229[_0x565c('0x51')],_0x521508[_0x565c('0x57')],md5(_0x521508['uniqueid']));}else{_0x521508[_0x565c('0x55')]='';}return getConnection(_0x2c8229)[_0x565c('0x21')](function(_0x2f02c9){_0x7ae906=_0x2f02c9;if(!_['isNil'](_0x32e7d1)){return getUser(_0x2c8229,_0x32e7d1[_0x565c('0x48')],_0x7ae906);}else{return getUser(_0x2c8229,null,_0x7ae906);}})[_0x565c('0x21')](function(_0x1e114d){_0x1fd90a=_0x1e114d;return getEndUser(_0x2c8229,_0xa2e0d,_0x521508['calleridname'],_0x521508[_0x565c('0x70')],_0x7ae906);})['then'](function(_0x2762bd){_0x19e00e=_0x2762bd;return getTicket(_0x2c8229,_0x1fd90a,_0x19e00e,_0xa2e0d,_0x521508,_0xa2e0d['Fields'],_0x7ae906);})['then'](function(_0x1eb205){_0x31fcb2=_0x1eb205;logger[_0x565c('0x1c')]('['+_0x521508[_0x565c('0x6f')][_0x565c('0x71')]()+_0x565c('0x72'),_0x31fcb2['id']);logger[_0x565c('0x1c')]('['+_0x521508[_0x565c('0x6f')][_0x565c('0x71')]()+_0x565c('0x73'),_0x2c8229['type']);})['catch'](function(_0x179c33){logger['error']('['+_0x521508['lastevent']['toUpperCase']()+']',JSON[_0x565c('0x64')](_0x179c33));});}; \ No newline at end of file +var _0x8db2=['outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','moment','bluebird','md5','jsforce','util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','Subjects','getString','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','WhoId','Case','contact','ContactId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','User','execute','then','length','find','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','Phone','attributes','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','create','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','catch','error','[QUEUE]','stringify'];(function(_0x1d2181,_0x4a63ba){var _0x2a05f6=function(_0xd79963){while(--_0xd79963){_0x1d2181['push'](_0x1d2181['shift']());}};_0x2a05f6(++_0x4a63ba);}(_0x8db2,0x7b));var _0x28db=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x8db2[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x28db('0x0'));var rp=require('request-promise');var moment=require(_0x28db('0x1'));var BPromise=require(_0x28db('0x2'));var md5=require(_0x28db('0x3'));var jsforce=require(_0x28db('0x4'));var util=require(_0x28db('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x28db('0x6'));var logger=require(_0x28db('0x7'))(_0x28db('0x8'));config[_0x28db('0x9')]=_[_0x28db('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x28db('0xb'))(new Redis(config[_0x28db('0x9')]));function emit(_0x3fe7ab,_0x82e496,_0x1f6fb0){io['to'](_0x3fe7ab)[_0x28db('0xc')](_0x82e496,_0x1f6fb0);}function getTicket(_0x2d7a73,_0x59c5d3,_0x59369d,_0x4e1d90,_0x5cb84a,_0x45ba09,_0x1b15d8,_0x4a1750){var _0x5b817d=Object[_0x28db('0xd')]({},{'OwnerId':_0x59c5d3['id'],'Subject':intUtil['getString'](_0x4e1d90[_0x28db('0xe')],_0x5cb84a,'\x20'),'Description':intUtil[_0x28db('0xf')](_0x4e1d90['Descriptions'],_0x5cb84a,'\x0a')},getCustomFields(_0x45ba09,_0x5cb84a));if(_0x59369d){if(_0x4e1d90[_0x28db('0x10')]===_0x28db('0x11')){_0x5b817d[_0x28db('0x12')]=moment['utc']();_0x5b817d[_0x28db('0x13')]=![];_0x5b817d[_0x28db('0x14')]=![];_0x5b817d[_0x28db('0x15')]=_0x59369d['id'];}else if(_0x4e1d90['ticketType']===_0x28db('0x16')){if(_0x59369d['endUserType']===_0x28db('0x17')){_0x5b817d[_0x28db('0x18')]=_0x59369d['id'];}else if(_0x59369d['endUserType']===_0x28db('0x19')&&_0x4e1d90[_0x28db('0x1a')]){_0x5b817d[_0x4e1d90['leadId']]=_0x59369d['id'];}else{logger[_0x28db('0x1b')](_0x28db('0x1c'));}}}return _0x1b15d8[_0x28db('0x1d')](_0x4e1d90[_0x28db('0x10')])['create'](_0x5b817d);}function getUser(_0x1cb916,_0x34051b,_0xe9715f){if(!_[_0x28db('0x1e')](_0x34051b)&&intUtil['validateEmail'](_0x34051b)){var _0x4ba049={'Email':_0x34051b};var _0x253397={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xe9715f[_0x28db('0x1d')](_0x28db('0x1f'))['find'](_0x4ba049,_0x253397)[_0x28db('0x20')]()[_0x28db('0x21')](function(_0x5dd212){if(_0x5dd212[_0x28db('0x22')]){var _0xc870d9=_[_0x28db('0x23')](_0x5dd212,function(_0x27e081){return _0x27e081['Email']===_0x34051b;});if(_0xc870d9){logger[_0x28db('0x1b')](_0x28db('0x24'),_0x34051b);return BPromise['resolve']({'id':_0xc870d9['Id'],'name':_0xc870d9['Name']});}}else{logger['info'](_0x28db('0x25'),_0x34051b);return _0xe9715f[_0x28db('0x26')]()['then'](function(_0x4b9bc0){return BPromise[_0x28db('0x27')]({'id':_0x4b9bc0[_0x28db('0x28')],'name':_0x4b9bc0['display_name']});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x34051b);return _0xe9715f[_0x28db('0x26')]()[_0x28db('0x21')](function(_0x45b7b0){return BPromise[_0x28db('0x27')]({'id':_0x45b7b0[_0x28db('0x28')],'name':_0x45b7b0['display_name']});});}}function getEndUser(_0x1153d1,_0xe3111e,_0x3141d6,_0x10fa3e,_0x198fb2){var _0x5c1994={'Phone':_0x10fa3e};var _0x2df56b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x28db('0x27')]()[_0x28db('0x21')](function(){logger[_0x28db('0x1b')](_0x28db('0x29'),_0x10fa3e,_0xe3111e[_0x28db('0x2a')]);switch(_0xe3111e[_0x28db('0x2a')]){case _0x28db('0x2b'):return _0x198fb2['sobject'](_0x28db('0x2c'))[_0x28db('0x23')](_0x5c1994,_0x2df56b)[_0x28db('0x20')]()[_0x28db('0x21')](function(_0x62615f){if(_0x62615f&&_0x62615f[_0x28db('0x22')]){return _0x62615f;}else{return _0x198fb2['sobject'](_0x28db('0x2d'))[_0x28db('0x23')](_0x5c1994,_0x2df56b);}});case _0x28db('0x17'):return _0x198fb2[_0x28db('0x1d')]('Contact')[_0x28db('0x23')](_0x5c1994,_0x2df56b)[_0x28db('0x20')]();case _0x28db('0x19'):return _0x198fb2['sobject'](_0x28db('0x2d'))[_0x28db('0x23')](_0x5c1994,_0x2df56b);default:return null;}})[_0x28db('0x21')](function(_0x2c883a){if(_0x2c883a&&_0x2c883a[_0x28db('0x22')]){var _0x11f070=_[_0x28db('0x23')](_0x2c883a,function(_0x2847b7){return _0x2847b7[_0x28db('0x2e')]===_0x10fa3e;});if(_0x11f070){return BPromise[_0x28db('0x27')]({'id':_0x11f070['Id'],'name':_0x11f070['Name'],'phone':_0x11f070[_0x28db('0x2e')],'endUserType':_0x11f070[_0x28db('0x2f')]['type'][_0x28db('0x30')]()});}}})['then'](function(_0x52c1d7){if(_0x52c1d7){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x52c1d7['endUserType'],_0x10fa3e);return BPromise['resolve'](_0x52c1d7);}else{logger['info'](_0x28db('0x31'),_0x10fa3e);var _0xc028d4={'LastName':_0x3141d6!==_0x28db('0x32')?_0x3141d6:util[_0x28db('0x33')]('Caller\x20-\x20%s',_0x10fa3e),'Phone':_0x10fa3e};if(_0xe3111e['moduleCreate']){if(_0xe3111e[_0x28db('0x34')]==='contact'){logger[_0x28db('0x1b')](_0x28db('0x35'),_0x10fa3e,_0xe3111e[_0x28db('0x34')]);}else if(_0xe3111e['moduleCreate']===_0x28db('0x19')){logger['info'](_0x28db('0x35'),_0x10fa3e,_0xe3111e['moduleCreate']);_0xc028d4[_0x28db('0x36')]='No\x20Company';}else{return null;}}return _0x198fb2['sobject'](_[_0x28db('0x37')](_0xe3111e['moduleCreate']))[_0x28db('0x38')](_0xc028d4)[_0x28db('0x21')](function(_0x5f00f8){return BPromise['resolve']({'id':_0x5f00f8['id'],'endUserType':_0xe3111e[_0x28db('0x34')]});});}});}function getCustomFields(_0x52d81a,_0x1ffb57){var _0x26d021={};if(_0x52d81a[_0x28db('0x22')]>0x0){_[_0x28db('0x39')](_0x52d81a,function(_0x51bdb8){if(_[_0x28db('0x3a')](['string',_0x28db('0x3b')],_0x51bdb8[_0x28db('0x3c')])&&_0x51bdb8[_0x28db('0x3d')]){_0x26d021[_0x51bdb8[_0x28db('0x3d')]]=_0x51bdb8[_0x28db('0x3e')][_0x28db('0x3f')]();}else if(_0x51bdb8[_0x28db('0x3c')]===_0x28db('0x40')&&_0x51bdb8[_0x28db('0x41')]&&_0x51bdb8[_0x28db('0x3d')]){_0x1ffb57[_0x51bdb8[_0x28db('0x41')]]&&(_0x26d021[_0x51bdb8[_0x28db('0x3d')]]=_0x1ffb57[_0x51bdb8['variableName']]['toString']());}else if(_0x51bdb8['type']===_0x28db('0x42')&&_0x51bdb8[_0x28db('0x43')]&&_0x51bdb8[_0x28db('0x43')][_0x28db('0x44')]&&_0x51bdb8[_0x28db('0x3d')]){_0x1ffb57[_0x51bdb8[_0x28db('0x43')][_0x28db('0x44')][_0x28db('0x30')]()]&&(_0x26d021[_0x51bdb8['idField']]=_0x1ffb57[_0x51bdb8[_0x28db('0x43')][_0x28db('0x44')][_0x28db('0x30')]()][_0x28db('0x3f')]());}});}return _0x26d021;}function getConnection(_0x1d23c9){var _0x16fffc=_0x1d23c9[_0x28db('0x45')][_0x28db('0x46')](_0x1d23c9[_0x28db('0x47')]);var _0x563059=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1d23c9[_0x28db('0x48')]||_0x28db('0x49'),'clientId':_0x1d23c9[_0x28db('0x4a')],'clientSecret':_0x1d23c9[_0x28db('0x4b')]}});return _0x563059['login'](_0x1d23c9[_0x28db('0x4c')],_0x16fffc)['then'](function(){logger[_0x28db('0x1b')](_0x28db('0x4d'));return _0x563059;});}exports[_0x28db('0x4e')]=function(_0x24b8d5,_0x3af74d,_0xb200f8,_0x452db4,_0x183d34,_0xe8a399){var _0x2ece98,_0x251509,_0x433213,_0x2af3fc;_0xe8a399[_0x28db('0x4f')]=intUtil[_0x28db('0x50')](_0xe8a399[_0x28db('0x4f')]);_0xe8a399['remoteUri']=intUtil[_0x28db('0x50')](_0xe8a399[_0x28db('0x48')]);if(_0x183d34&&_0x183d34[_0x28db('0x51')]){logger['info']('[QUEUE]',_0x28db('0x52'));_0x3af74d['recordingURL']=util[_0x28db('0x33')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xe8a399['serverUrl'],_0x3af74d[_0x28db('0x53')],md5(_0x3af74d[_0x28db('0x53')]));}else{_0x3af74d[_0x28db('0x54')]='';}return getConnection(_0xe8a399)[_0x28db('0x21')](function(_0x1b31bf){_0x2af3fc=_0x1b31bf;return getUser(_0xe8a399,_0x452db4[_0x28db('0x55')],_0x2af3fc);})[_0x28db('0x21')](function(_0x533538){_0x2ece98=_0x533538;return getEndUser(_0xe8a399,_0xb200f8,_0x3af74d['calleridname'],_0x3af74d[_0x28db('0x56')],_0x2af3fc);})[_0x28db('0x21')](function(_0x199a25){_0x251509=_0x199a25;return getTicket(_0xe8a399,_0x2ece98,_0x251509,_0xb200f8,_0x3af74d,_0xb200f8[_0x28db('0x57')],_0x2af3fc,'queue');})['then'](function(_0x3f2128){_0x433213=_0x3f2128;logger['info'](_0x28db('0x58'),_0x433213['id']);logger['info'](_0x28db('0x59'),_0x433213['id'],_0x452db4[_0x28db('0x44')],_0xe8a399['type']);switch(_0xe8a399[_0x28db('0x3c')]){case _0x28db('0x5a'):emit(util[_0x28db('0x33')](_0x28db('0x5b'),_0x452db4[_0x28db('0x44')]),_0x28db('0x5c'),{'recordId':_0x433213['id']});break;case _0x28db('0x5d'):emit(util[_0x28db('0x33')](_0x28db('0x5b'),_0x452db4[_0x28db('0x44')]),_0x28db('0x5e'),{'uri':util['format']('%s/%s/e',_0x2af3fc['instanceUrl'],_0x433213['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x28db('0x5f')](function(_0x4a2490){logger[_0x28db('0x60')](_0x28db('0x61'),JSON[_0x28db('0x62')](_0x4a2490));});};exports[_0x28db('0x63')]=function(_0x35c5de,_0x1ff863,_0xac39c4,_0x21d87a,_0x5c7e5b,_0x440021,_0x31c2b0){var _0x39a2cd,_0x246a15,_0x33d4a5,_0x3fab39;_0x440021['serverUrl']=intUtil[_0x28db('0x50')](_0x440021['serverUrl']);_0x440021[_0x28db('0x48')]=intUtil[_0x28db('0x50')](_0x440021[_0x28db('0x48')]);if(_0x31c2b0&&_0x31c2b0['recordingFormat']&&_0x31c2b0[_0x28db('0x64')]!==_0x28db('0x65')){logger['info'](_0x28db('0x66'),_0x28db('0x52'));_0x1ff863['recordingURL']=util[_0x28db('0x33')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x440021['serverUrl'],_0x1ff863[_0x28db('0x53')],md5(_0x1ff863[_0x28db('0x53')]));}return getConnection(_0x440021)[_0x28db('0x21')](function(_0x141b92){_0x3fab39=_0x141b92;return getUser(_0x440021,_0x21d87a[_0x28db('0x55')],_0x3fab39);})[_0x28db('0x21')](function(_0x248c9c){_0x39a2cd=_0x248c9c;return getEndUser(_0x440021,_0xac39c4,_0x1ff863['destcalleridname'],_0x1ff863[_0x28db('0x67')],_0x3fab39);})['then'](function(_0x1bbb31){_0x246a15=_0x1bbb31;return getTicket(_0x440021,_0x39a2cd,_0x246a15,_0xac39c4,_0x1ff863,_0xac39c4[_0x28db('0x57')],_0x3fab39,'outbound');})[_0x28db('0x21')](function(_0x4d5f6e){_0x33d4a5=_0x4d5f6e;logger[_0x28db('0x1b')](_0x28db('0x68'),_0x33d4a5['id']);logger['info'](_0x28db('0x69'),_0x33d4a5['id'],_0x21d87a[_0x28db('0x44')],_0x440021['type']);switch(_0x440021[_0x28db('0x3c')]){case _0x28db('0x5a'):emit(util[_0x28db('0x33')](_0x28db('0x5b'),_0x21d87a[_0x28db('0x44')]),_0x28db('0x5c'),{'recordId':_0x33d4a5['id']});break;case'newTab':emit(util[_0x28db('0x33')]('user:%s',_0x21d87a[_0x28db('0x44')]),_0x28db('0x5e'),{'uri':util['format']('%s/%s/e',_0x3fab39[_0x28db('0x6a')],_0x33d4a5['id'])});break;default:logger[_0x28db('0x60')](_0x28db('0x66'),_0x28db('0x6b'));}})[_0x28db('0x5f')](function(_0x2d0f13){logger[_0x28db('0x60')](_0x28db('0x66'),JSON[_0x28db('0x62')](_0x2d0f13));});};exports['unmanaged']=function(_0x23da90,_0x2ee2d4,_0x50d36d,_0x413218,_0x389ad6,_0x44ee87){var _0x1ee974,_0x4e703d,_0x1ac2e5,_0x4962b2;_0x44ee87[_0x28db('0x4f')]=intUtil[_0x28db('0x50')](_0x44ee87[_0x28db('0x4f')]);_0x44ee87['remoteUri']=intUtil[_0x28db('0x50')](_0x44ee87[_0x28db('0x48')]);if(_0x389ad6&&_0x389ad6[_0x28db('0x51')]){logger[_0x28db('0x1b')]('['+_0x2ee2d4[_0x28db('0x6c')][_0x28db('0x6d')]()+']',_0x28db('0x52'));_0x2ee2d4[_0x28db('0x54')]=util[_0x28db('0x33')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x44ee87['serverUrl'],_0x2ee2d4[_0x28db('0x53')],md5(_0x2ee2d4['uniqueid']));}else{_0x2ee2d4[_0x28db('0x54')]='';}return getConnection(_0x44ee87)[_0x28db('0x21')](function(_0x3caa72){_0x4962b2=_0x3caa72;if(!_[_0x28db('0x1e')](_0x413218)){return getUser(_0x44ee87,_0x413218[_0x28db('0x44')],_0x4962b2);}else{return getUser(_0x44ee87,null,_0x4962b2);}})[_0x28db('0x21')](function(_0x407d71){_0x1ee974=_0x407d71;return getEndUser(_0x44ee87,_0x50d36d,_0x2ee2d4['calleridname'],_0x2ee2d4[_0x28db('0x56')],_0x4962b2);})[_0x28db('0x21')](function(_0x5c8b0a){_0x4e703d=_0x5c8b0a;return getTicket(_0x44ee87,_0x1ee974,_0x4e703d,_0x50d36d,_0x2ee2d4,_0x50d36d[_0x28db('0x57')],_0x4962b2);})[_0x28db('0x21')](function(_0xec6b7e){_0x1ac2e5=_0xec6b7e;logger[_0x28db('0x1b')]('['+_0x2ee2d4['lastevent'][_0x28db('0x6d')]()+_0x28db('0x6e'),_0x1ac2e5['id']);logger['info']('['+_0x2ee2d4[_0x28db('0x6c')][_0x28db('0x6d')]()+']\x20Integration\x20account\x20type\x20%s.',_0x44ee87[_0x28db('0x3c')]);})[_0x28db('0x5f')](function(_0xcf2a68){logger['error']('['+_0x2ee2d4[_0x28db('0x6c')][_0x28db('0x6d')]()+']',JSON['stringify'](_0xcf2a68));});}; \ 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 a635bd2..36a2a61 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 _0x955f=['Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','ticketId',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','./util','servicenow','defaults','redis','localhost','sys_user?sysparm_query=user_name%3Dadmin','result','length','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','userEmail','GET','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','sys_id','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','user','endUserNumber','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','Subjects'];(function(_0x4156e2,_0x416565){var _0x8bfdf2=function(_0x53508f){while(--_0x53508f){_0x4156e2['push'](_0x4156e2['shift']());}};_0x8bfdf2(++_0x416565);}(_0x955f,0x1eb));var _0xf955=function(_0x2d2853,_0x383709){_0x2d2853=_0x2d2853-0x0;var _0x4b7166=_0x955f[_0x2d2853];return _0x4b7166;};'use strict';var _=require(_0xf955('0x0'));var Promise=require(_0xf955('0x1'));var rp=require(_0xf955('0x2'));var util=require(_0xf955('0x3'));var md5=require(_0xf955('0x4'));var Redis=require('ioredis');var intUtil=require(_0xf955('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xf955('0x6'));config['redis']=_[_0xf955('0x7')](config[_0xf955('0x8')],{'host':_0xf955('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf955('0x8')]));function getAdminUser(_0x20c096,_0x4f58fb,_0x254b38,_0x151034,_0x168ffb,_0x38b190){return new Promise(function(_0x134c1b,_0x421e4a){var _0x186719={'method':'GET','uri':_0x151034+_0xf955('0xa')+'&'+_0x168ffb+'&'+_0x38b190,'auth':_0x4f58fb,'json':!![]};return rp(_0x186719)['then'](function(_0x2d59e9){if(_0x2d59e9[_0xf955('0xb')][_0xf955('0xc')]>0x0){_0x254b38['adminId']=_0x2d59e9[_0xf955('0xb')][0x0]['sys_id'];}logger[_0xf955('0xd')]('['+[_0x20c096['toUpperCase']()]+_0xf955('0xe'),_0x254b38);_0x134c1b(_0x254b38);})[_0xf955('0xf')](function(_0x22507a){logger[_0xf955('0x10')]('['+[_0x20c096[_0xf955('0x11')]()]+']',_0x22507a[_0xf955('0x12')]);_0x421e4a(_0x22507a[_0xf955('0x12')]);});});}function getUser(_0x2783f2,_0x3c6af7,_0x24e75c,_0x5350e4,_0xc29b35){return function(_0x54e60b){logger[_0xf955('0xd')]('['+[_0x2783f2[_0xf955('0x11')]()]+_0xf955('0x13'),_0x54e60b);return new Promise(function(_0x15c07c,_0x50930d){if(intUtil['validateEmail'](_0x54e60b[_0xf955('0x14')])){var _0xe6de5c={'method':_0xf955('0x15'),'uri':_0x24e75c+'sys_user?sysparm_query=email%3D'+_0x54e60b[_0xf955('0x14')]+'&'+_0x5350e4+'&'+_0xc29b35,'auth':_0x3c6af7,'json':!![]};logger[_0xf955('0xd')]('['+[_0x2783f2[_0xf955('0x11')]()]+_0xf955('0x16'),_0xe6de5c);return rp(_0xe6de5c)[_0xf955('0x17')](function(_0x5f4d9a){logger[_0xf955('0xd')]('['+[_0x2783f2[_0xf955('0x11')]()]+_0xf955('0x18'),_0x5f4d9a);if(_0x5f4d9a['result'][_0xf955('0xc')]>0x0&&String(_0x5f4d9a['result'][0x0][_0xf955('0x19')])===_0xf955('0x1a')){_0x54e60b[_0xf955('0x1b')]=_0x5f4d9a[_0xf955('0xb')][0x0][_0xf955('0x1c')];}else{_0x54e60b['userId']=_0x54e60b[_0xf955('0x1d')];_0x54e60b[_0xf955('0x14')]=_0x54e60b[_0xf955('0x1e')];}logger[_0xf955('0xd')]('['+[_0x2783f2[_0xf955('0x11')]()]+_0xf955('0x1f'),_0x54e60b);_0x15c07c(_0x54e60b);})[_0xf955('0xf')](function(_0x552cf3){logger[_0xf955('0x10')]('['+[_0x2783f2[_0xf955('0x11')]()]+']',_0x552cf3[_0xf955('0x12')]);_0x50930d(_0x552cf3[_0xf955('0x12')]);});}else{logger[_0xf955('0xd')]('['+[_0x2783f2[_0xf955('0x11')]()]+_0xf955('0x20'));_0x54e60b['userId']=_0x54e60b[_0xf955('0x1d')];_0x54e60b[_0xf955('0x14')]=_0x54e60b[_0xf955('0x1e')];_0x15c07c(_0x54e60b);}});};}function createEndUser(_0xbd0b74,_0x28fa9c,_0x264f6d,_0x4d4af0,_0x2232a7){logger[_0xf955('0xd')]('['+[_0xbd0b74['toUpperCase']()]+_0xf955('0x21'),_0x264f6d);return new Promise(function(_0x2c8df1,_0xf3c870){var _0x1ef794={'method':'POST','uri':_0x4d4af0+_0xf955('0x22')+_0x2232a7,'body':{'user_name':_0x264f6d['endUserNumber'],'roles':_0xf955('0x23'),'first_name':_0x264f6d[_0xf955('0x24')],'active':_0xf955('0x1a'),'date_format':_0xf955('0x25'),'phone':_0x264f6d[_0xf955('0x24')]},'auth':_0x28fa9c,'json':!![]};return rp(_0x1ef794)[_0xf955('0x17')](function(_0xd5dfb0){logger[_0xf955('0xd')]('['+[_0xbd0b74['toUpperCase']()]+_0xf955('0x26'),_0xd5dfb0[_0xf955('0xb')]);_0x264f6d[_0xf955('0x27')]=_0xd5dfb0[_0xf955('0xb')]['sys_id'];_0x2c8df1(_0x264f6d);})[_0xf955('0xf')](function(_0x31dad5){logger[_0xf955('0x10')]('['+[_0xbd0b74[_0xf955('0x11')]()]+']',_0x31dad5[_0xf955('0x12')]);_0xf3c870(_0x31dad5['message']);});});}function getEndUser(_0x4d7155,_0x5480db,_0x2626cb,_0x3783dc,_0x374e95){return function(_0x6d564c){logger[_0xf955('0xd')]('['+[_0x4d7155[_0xf955('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x6d564c);return new Promise(function(_0x3acc4b,_0x515dc6){var _0x8f842f={'method':_0xf955('0x15'),'uri':_0x2626cb+_0xf955('0x28')+_0x6d564c['endUserNumber']+'&'+_0x3783dc+'&'+_0x374e95,'auth':_0x5480db,'json':!![]};return rp(_0x8f842f)[_0xf955('0x17')](function(_0x4bef80){if(_0x4bef80[_0xf955('0xb')][_0xf955('0xc')]>0x0){_0x6d564c[_0xf955('0x27')]=_0x4bef80[_0xf955('0xb')][0x0]['sys_id'];logger[_0xf955('0xd')]('['+[_0x4d7155[_0xf955('0x11')]()]+'],\x20getEndUser\x20crm',_0x6d564c);_0x3acc4b(_0x6d564c);}else{return createEndUser(_0x4d7155,_0x5480db,_0x6d564c,_0x2626cb,_0x3783dc)[_0xf955('0x17')](function(_0x460aa7){logger[_0xf955('0xd')]('['+[_0x4d7155['toUpperCase']()]+_0xf955('0x29'),_0x460aa7);_0x3acc4b(_0x460aa7);});}})[_0xf955('0xf')](function(_0x11b7e2){logger['error']('['+[_0x4d7155[_0xf955('0x11')]()]+']',_0x11b7e2[_0xf955('0x12')]);_0x515dc6(_0x11b7e2[_0xf955('0x12')]);});});};}function getCustomFields(_0x2069f3,_0x2bfbe4){var _0x3c4b29={};if(_0x2069f3[_0xf955('0xc')]>0x0){_[_0xf955('0x2a')](_0x2069f3,function(_0x5671c7){if(_[_0xf955('0x2b')]([_0xf955('0x2c'),_0xf955('0x2d')],_0x5671c7[_0xf955('0x2e')])&&_0x5671c7[_0xf955('0x2f')]&&!_0x5671c7[_0xf955('0x30')]){_0x3c4b29[_0x5671c7[_0xf955('0x2f')][_0xf955('0x31')]()]=_0x5671c7[_0xf955('0x32')][_0xf955('0x33')]();}else if(_[_0xf955('0x2b')]([_0xf955('0x2c'),_0xf955('0x2d')],_0x5671c7[_0xf955('0x2e')])&&_0x5671c7[_0xf955('0x34')]&&_0x5671c7[_0xf955('0x30')]){_0x3c4b29[_0x5671c7[_0xf955('0x34')][_0xf955('0x31')]()]=_0x5671c7[_0xf955('0x32')]['toString']();}else if(_0x5671c7[_0xf955('0x2e')]===_0xf955('0x35')&&_0x5671c7[_0xf955('0x36')]&&_0x5671c7['idField']&&_0x5671c7[_0xf955('0x30')]){_0x3c4b29[_0x5671c7['idField'][_0xf955('0x31')]()]=_0x2bfbe4[_0x5671c7['variableName']][_0xf955('0x33')]();}else if(_0x5671c7[_0xf955('0x2e')]===_0xf955('0x37')&&_0x5671c7[_0xf955('0x38')]&&_0x5671c7['Variable'][_0xf955('0x39')]&&_0x5671c7[_0xf955('0x34')]&&_0x5671c7[_0xf955('0x30')]){_0x3c4b29[_0x5671c7['idField']['toLowerCase']()]=_0x2bfbe4[_0x5671c7[_0xf955('0x38')][_0xf955('0x39')][_0xf955('0x31')]()][_0xf955('0x33')]();}});}return _0x3c4b29;}function getTicket(_0x5e4a88,_0x265587,_0x152f57,_0x1ced36,_0x5a350d,_0x388e59){return function(_0x5ba567){logger[_0xf955('0xd')]('['+[_0x5e4a88[_0xf955('0x11')]()]+_0xf955('0x3a'),_0x5ba567);return new Promise(function(_0x4dd592,_0x3e24c9){var _0x3c8634=_0x5e4a88[_0xf955('0x31')]()===_0xf955('0x3b')?_0x5ba567['userId']:_0x5ba567[_0xf955('0x27')];var _0x4ff0f1={'method':_0xf955('0x3c'),'uri':_0x152f57+_0xf955('0x3d')+'?'+_0x388e59,'body':Object[_0xf955('0x3e')]({},{'active':'true','caller_id':_0x3c8634,'assigned_to':_0x5ba567[_0xf955('0x1b')],'short_description':intUtil['getString'](_0x1ced36[_0xf955('0x3f')],_0x5a350d,'\x20'),'description':intUtil['getString'](_0x1ced36[_0xf955('0x40')],_0x5a350d,'\x0a')},getCustomFields(_0x1ced36['Fields'],_0x5a350d)),'auth':_0x265587,'json':!![]};return rp(_0x4ff0f1)['then'](function(_0x3151b4){logger[_0xf955('0xd')]('['+[_0x5e4a88['toUpperCase']()]+_0xf955('0x41'),_0x3151b4['result']);_0x5ba567['ticketId']=_0x3151b4['result']['sys_id'];_0x5ba567[_0xf955('0x42')]=_0x3151b4[_0xf955('0xb')]['number'];logger['info']('['+[_0x5e4a88[_0xf955('0x11')]()]+_0xf955('0x43'),_0x5ba567);_0x4dd592(_0x5ba567);})[_0xf955('0xf')](function(_0x412a5a){logger[_0xf955('0x10')]('['+[_0x5e4a88[_0xf955('0x11')]()]+']',_0x412a5a[_0xf955('0x12')]);_0x3e24c9(_0x412a5a[_0xf955('0x12')]);});});};}function createRemoteTag(_0x376974,_0x141314,_0x1b7b73,_0x350873){return new Promise(function(_0x47a3a6,_0x2e74be){var _0x2e1186={'method':_0xf955('0x3c'),'uri':_0x1b7b73+_0xf955('0x44')+'?'+_0x350873,'body':{'short_description':_0x376974,'global':!![],'active':!![],'name':_0x376974},'auth':_0x141314,'json':!![]};return rp(_0x2e1186)[_0xf955('0x17')](function(_0x4dc34b){var _0xf5d575=_0x4dc34b[_0xf955('0xb')][_0xf955('0x1c')];_0x47a3a6(_0xf5d575);});});}function getRemoteTag(_0x33a054,_0x1e0ef0,_0x9057df,_0x228d59,_0x60c8a2){return new Promise(function(_0x2f9606,_0x1881f6){var _0x54a6b8={'method':_0xf955('0x15'),'uri':_0x9057df+_0xf955('0x44')+_0xf955('0x45')+_0x33a054+'&'+_0x228d59,'auth':_0x1e0ef0,'json':!![]};return rp(_0x54a6b8)[_0xf955('0x17')](function(_0x116458){if(_0x116458[_0xf955('0xb')][_0xf955('0xc')]>0x0){var _0x30b673=_0x116458[_0xf955('0xb')][0x0][_0xf955('0x1c')];_0x2f9606(_0x30b673);}else{return createRemoteTag(_0x33a054,_0x1e0ef0,_0x9057df,_0x228d59)[_0xf955('0x17')](function(_0x2b8173){_0x2f9606(_0x2b8173);});}});});}function assignTagToIncident(_0x5ce480,_0x1388a0,_0x452de9,_0x381cf0,_0x3eb727){return new Promise(function(_0x3c2cfd,_0x3171ba){var _0x1c4e2d={'method':'POST','uri':_0x452de9+'label_entry'+'?'+_0x3eb727,'body':{'label':_0x5ce480,'table':'incident','id_type':_0xf955('0x46'),'table_key':_0x381cf0['ticketId'],'title':'Incident\x20-\x20'+_0x381cf0[_0xf955('0x42')],'id_display':_0x381cf0['ticketNumber']},'auth':_0x1388a0,'json':!![]};return rp(_0x1c4e2d)[_0xf955('0x17')](function(_0x3fa5b5){_0x3c2cfd();})[_0xf955('0xf')](function(){_0x3c2cfd();});});}function manageTags(_0x30cb80,_0x4c88ae,_0x349d76,_0x9e3437,_0xabf581,_0x3149b3,_0x36364d){return new Promise(function(_0x545c1f,_0x189468){var _0x5990d7=[];_0x4c88ae[_0xf955('0x2a')](function(_0xdacba8){_0x5990d7[_0xf955('0x47')](getRemoteTag(_0xdacba8,_0x349d76,_0x9e3437,_0x3149b3,_0x36364d));});return Promise['all'](_0x5990d7)[_0xf955('0x17')](function(_0x40ca54){if(_0x40ca54[_0xf955('0xc')]){logger[_0xf955('0xd')]('['+[_0x30cb80[_0xf955('0x11')]()]+_0xf955('0x48'),_0x40ca54);var _0x3761f2=[];_0x40ca54['forEach'](function(_0x5f2d6c){_0x3761f2[_0xf955('0x47')](assignTagToIncident(_0x5f2d6c,_0x349d76,_0x9e3437,_0xabf581,_0x3149b3));});return Promise[_0xf955('0x49')](_0x3761f2)[_0xf955('0x17')](function(){_0x545c1f();})[_0xf955('0xf')](function(){_0x545c1f();});}else{_0x545c1f();}});});}function getTags(_0xab5eed,_0x34f52a,_0x52803a,_0x319e62,_0x2ceeb4,_0x2d20af){return function(_0x71ee3a){return new Promise(function(_0x4ff892,_0x2fdca9){var _0x4916c3=[];var _0x431729=_0x319e62['Tags'];if(_0x431729&&_0x431729['length']>0x0){_0x4916c3=_[_0xf955('0x4a')](_0x431729,_0xf955('0x39'));}if(_0x4916c3['length']>0x0){return manageTags(_0xab5eed,_0x4916c3,_0x34f52a,_0x52803a,_0x71ee3a,_0x2ceeb4,_0x2d20af)[_0xf955('0x17')](function(){_0x4ff892(_0x71ee3a);});}else{_0x4ff892(_0x71ee3a);}});};}function emit(_0x28e662,_0x5e8f86,_0x50b722){var _0x1e418=_0xf955('0x4b')+_0xf955('0x4c')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xf955('0x4d');var _0x29763d={'uri':_0x28e662+_0xf955('0x4e')+_0x50b722+_0x1e418};io['to'](util[_0xf955('0x4f')](_0xf955('0x50'),_0x5e8f86))[_0xf955('0x51')](_0xf955('0x52'),_0x29763d);}exports['cs']=function(_0xf1e40b,_0x5a45da,_0x3960ec,_0x1bc7b9,_0x58eb99,_0x45dba4,_0x243d61,_0x54dac){var _0x3fa0bc={};var _0x4e0e3f={'user':_0x45dba4[_0xf955('0x53')],'pass':_0x45dba4[_0xf955('0x54')]};var _0x4b85c2='sysparm_limit=1';var _0x2fe31b=_0xf955('0x55');_0x45dba4[_0xf955('0x56')]=intUtil[_0xf955('0x57')](_0x45dba4['remoteUri']);_0x45dba4[_0xf955('0x58')]=intUtil[_0xf955('0x57')](_0x45dba4[_0xf955('0x58')]);var _0x425d42=util[_0xf955('0x4f')](_0xf955('0x59'),_0x45dba4[_0xf955('0x56')]);_0x3fa0bc[_0xf955('0x14')]=!_[_0xf955('0x5a')](_0x1bc7b9)?_0x1bc7b9[_0xf955('0x5b')]:null;_0x3fa0bc[_0xf955('0x1e')]=_0x45dba4[_0xf955('0x5b')];_0x3fa0bc[_0xf955('0x24')]=_0x54dac['toLowerCase']()===_0xf955('0x3b')?_0x5a45da[_0xf955('0x5c')]:_0x5a45da[_0xf955('0x5d')];_0x3fa0bc[_0xf955('0x5e')]=_0x54dac==='queue'||_0x54dac===_0xf955('0x5f')?_0xf955('0x60'):_0xf955('0x3b');var _0x8bdcf2=util[_0xf955('0x4f')](_0xf955('0x61'),_0x45dba4[_0xf955('0x58')],_0x5a45da[_0xf955('0x62')],md5(_0x5a45da[_0xf955('0x62')]));if(_0x58eb99&&_0x58eb99[_0xf955('0x63')]){logger[_0xf955('0xd')]('[QUEUE]',_0xf955('0x64'));_0x5a45da[_0xf955('0x65')]=_0x8bdcf2;}else if(_0x243d61&&_0x243d61[_0xf955('0x66')]&&_0x243d61[_0xf955('0x66')]!==_0xf955('0x67')){logger[_0xf955('0xd')](_0xf955('0x68'),'Recording\x20is\x20enabled!');_0x5a45da[_0xf955('0x65')]=_0x8bdcf2;}else{_0x5a45da['recordingURL']='';}return getAdminUser(_0x54dac,_0x4e0e3f,_0x3fa0bc,_0x425d42,_0x2fe31b,_0x4b85c2)[_0xf955('0x17')](getUser(_0x54dac,_0x4e0e3f,_0x425d42,_0x2fe31b,_0x4b85c2))['then'](getEndUser(_0x54dac,_0x4e0e3f,_0x425d42,_0x2fe31b,_0x4b85c2))[_0xf955('0x17')](getTicket(_0x54dac,_0x4e0e3f,_0x425d42,_0x3960ec,_0x5a45da,_0x2fe31b))[_0xf955('0x17')](function(_0x3f76ce){logger[_0xf955('0xd')](util[_0xf955('0x4f')](_0xf955('0x69'),_0x3f76ce['ticketId']));logger[_0xf955('0xd')](util[_0xf955('0x4f')](_0xf955('0x6a'),_0x54dac));if(_0x54dac!=='unmanaged'){logger['info']('['+[_0x54dac[_0xf955('0x11')]()]+']',_0xf955('0x6b'));emit(_0x45dba4[_0xf955('0x56')],_0x1bc7b9['name'],_0x3f76ce[_0xf955('0x6c')]);}})['catch'](function(_0x36c23e){logger['error']('['+[_0x54dac[_0xf955('0x11')]()]+_0xf955('0x6d'),util[_0xf955('0x6e')](_0x36c23e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf2e3=['Descriptions','Fields','ticketId','number',']\x20getTicket\x20crm','label','label_entry','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','true','userId','adminEmail',']\x20using\x20admin\x20profile','adminId','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','nameField','toLowerCase','content','toString','picklist','idField','customField','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects'];(function(_0x344adc,_0x183c37){var _0x4014b2=function(_0xe809e5){while(--_0xe809e5){_0x344adc['push'](_0x344adc['shift']());}};_0x4014b2(++_0x183c37);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xf2e3[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0x3f2e('0x0'));var Promise=require('bluebird');var rp=require(_0x3f2e('0x1'));var util=require(_0x3f2e('0x2'));var md5=require(_0x3f2e('0x3'));var Redis=require(_0x3f2e('0x4'));var intUtil=require(_0x3f2e('0x5'));var config=require(_0x3f2e('0x6'));var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));config[_0x3f2e('0x9')]=_['defaults'](config[_0x3f2e('0x9')],{'host':_0x3f2e('0xa'),'port':0x18eb});var io=require(_0x3f2e('0xb'))(new Redis(config[_0x3f2e('0x9')]));function getAdminUser(_0x12c6e7,_0x11067d,_0x3636f6,_0x434e0c,_0x2676a7,_0x29a6cc){return new Promise(function(_0x21f22b,_0x32902a){var _0x1dd9d0={'method':_0x3f2e('0xc'),'uri':_0x434e0c+_0x3f2e('0xd')+'&'+_0x2676a7+'&'+_0x29a6cc,'auth':_0x11067d,'json':!![]};return rp(_0x1dd9d0)[_0x3f2e('0xe')](function(_0x824ee8){if(_0x824ee8[_0x3f2e('0xf')][_0x3f2e('0x10')]>0x0){_0x3636f6['adminId']=_0x824ee8[_0x3f2e('0xf')][0x0][_0x3f2e('0x11')];}logger['info']('['+[_0x12c6e7[_0x3f2e('0x12')]()]+_0x3f2e('0x13'),_0x3636f6);_0x21f22b(_0x3636f6);})[_0x3f2e('0x14')](function(_0x395f36){logger[_0x3f2e('0x15')]('['+[_0x12c6e7['toUpperCase']()]+']',_0x395f36[_0x3f2e('0x16')]);_0x32902a(_0x395f36[_0x3f2e('0x16')]);});});}function getUser(_0x2d2fac,_0x4f2e38,_0x43f69e,_0x218b44,_0x17ef58){return function(_0x2c4feb){logger[_0x3f2e('0x17')]('['+[_0x2d2fac[_0x3f2e('0x12')]()]+_0x3f2e('0x18'),_0x2c4feb);return new Promise(function(_0x155411,_0x178283){if(intUtil[_0x3f2e('0x19')](_0x2c4feb[_0x3f2e('0x1a')])){var _0x5b9989={'method':_0x3f2e('0xc'),'uri':_0x43f69e+_0x3f2e('0x1b')+_0x2c4feb[_0x3f2e('0x1a')]+'&'+_0x218b44+'&'+_0x17ef58,'auth':_0x4f2e38,'json':!![]};logger[_0x3f2e('0x17')]('['+[_0x2d2fac[_0x3f2e('0x12')]()]+'],\x20getUser\x20rp\x20obj',_0x5b9989);return rp(_0x5b9989)['then'](function(_0x904d94){logger[_0x3f2e('0x17')]('['+[_0x2d2fac[_0x3f2e('0x12')]()]+_0x3f2e('0x1c'),_0x904d94);if(_0x904d94[_0x3f2e('0xf')][_0x3f2e('0x10')]>0x0&&String(_0x904d94['result'][0x0]['active'])===_0x3f2e('0x1d')){_0x2c4feb[_0x3f2e('0x1e')]=_0x904d94['result'][0x0]['sys_id'];}else{_0x2c4feb[_0x3f2e('0x1e')]=_0x2c4feb['adminId'];_0x2c4feb[_0x3f2e('0x1a')]=_0x2c4feb[_0x3f2e('0x1f')];}logger['info']('['+[_0x2d2fac['toUpperCase']()]+'],\x20getUser\x20crm',_0x2c4feb);_0x155411(_0x2c4feb);})[_0x3f2e('0x14')](function(_0x3d7631){logger['error']('['+[_0x2d2fac[_0x3f2e('0x12')]()]+']',_0x3d7631['message']);_0x178283(_0x3d7631[_0x3f2e('0x16')]);});}else{logger['info']('['+[_0x2d2fac[_0x3f2e('0x12')]()]+_0x3f2e('0x20'));_0x2c4feb[_0x3f2e('0x1e')]=_0x2c4feb[_0x3f2e('0x21')];_0x2c4feb[_0x3f2e('0x1a')]=_0x2c4feb['adminEmail'];_0x155411(_0x2c4feb);}});};}function createEndUser(_0x426d68,_0x28ef64,_0x5eab38,_0x528063,_0x2b9fda){logger[_0x3f2e('0x17')]('['+[_0x426d68[_0x3f2e('0x12')]()]+_0x3f2e('0x22'),_0x5eab38);return new Promise(function(_0x5452f5,_0x3eaaeb){var _0x465a94={'method':_0x3f2e('0x23'),'uri':_0x528063+'sys_user?'+_0x2b9fda,'body':{'user_name':_0x5eab38[_0x3f2e('0x24')],'roles':_0x3f2e('0x25'),'first_name':_0x5eab38[_0x3f2e('0x24')],'active':'true','date_format':_0x3f2e('0x26'),'phone':_0x5eab38[_0x3f2e('0x24')]},'auth':_0x28ef64,'json':!![]};return rp(_0x465a94)[_0x3f2e('0xe')](function(_0x2ed676){logger[_0x3f2e('0x17')]('['+[_0x426d68[_0x3f2e('0x12')]()]+'],\x20EndUser\x20schema',_0x2ed676[_0x3f2e('0xf')]);_0x5eab38[_0x3f2e('0x27')]=_0x2ed676[_0x3f2e('0xf')][_0x3f2e('0x11')];_0x5452f5(_0x5eab38);})[_0x3f2e('0x14')](function(_0x2a8830){logger[_0x3f2e('0x15')]('['+[_0x426d68['toUpperCase']()]+']',_0x2a8830[_0x3f2e('0x16')]);_0x3eaaeb(_0x2a8830[_0x3f2e('0x16')]);});});}function getEndUser(_0x44e5c1,_0x239af7,_0x4e6161,_0x5da5c3,_0x5349d0){return function(_0x35ead3){logger[_0x3f2e('0x17')]('['+[_0x44e5c1[_0x3f2e('0x12')]()]+_0x3f2e('0x28'),_0x35ead3);return new Promise(function(_0x10fbc3,_0x39ba6f){var _0x35937a={'method':_0x3f2e('0xc'),'uri':_0x4e6161+_0x3f2e('0x29')+_0x35ead3['endUserNumber']+'&'+_0x5da5c3+'&'+_0x5349d0,'auth':_0x239af7,'json':!![]};return rp(_0x35937a)[_0x3f2e('0xe')](function(_0xcec01e){if(_0xcec01e[_0x3f2e('0xf')][_0x3f2e('0x10')]>0x0){_0x35ead3['endUserId']=_0xcec01e[_0x3f2e('0xf')][0x0][_0x3f2e('0x11')];logger[_0x3f2e('0x17')]('['+[_0x44e5c1[_0x3f2e('0x12')]()]+_0x3f2e('0x2a'),_0x35ead3);_0x10fbc3(_0x35ead3);}else{return createEndUser(_0x44e5c1,_0x239af7,_0x35ead3,_0x4e6161,_0x5da5c3)[_0x3f2e('0xe')](function(_0x457713){logger[_0x3f2e('0x17')]('['+[_0x44e5c1['toUpperCase']()]+_0x3f2e('0x2b'),_0x457713);_0x10fbc3(_0x457713);});}})[_0x3f2e('0x14')](function(_0x238b6b){logger[_0x3f2e('0x15')]('['+[_0x44e5c1['toUpperCase']()]+']',_0x238b6b[_0x3f2e('0x16')]);_0x39ba6f(_0x238b6b[_0x3f2e('0x16')]);});});};}function getCustomFields(_0x4cb56b,_0x3fc694){var _0x257314={};if(_0x4cb56b['length']>0x0){_[_0x3f2e('0x2c')](_0x4cb56b,function(_0x7f189f){if(_[_0x3f2e('0x2d')]([_0x3f2e('0x2e'),'picklist'],_0x7f189f[_0x3f2e('0x2f')])&&_0x7f189f[_0x3f2e('0x30')]&&!_0x7f189f['customField']){_0x257314[_0x7f189f['nameField'][_0x3f2e('0x31')]()]=_0x7f189f[_0x3f2e('0x32')][_0x3f2e('0x33')]();}else if(_['includes']([_0x3f2e('0x2e'),_0x3f2e('0x34')],_0x7f189f[_0x3f2e('0x2f')])&&_0x7f189f[_0x3f2e('0x35')]&&_0x7f189f[_0x3f2e('0x36')]){_0x257314[_0x7f189f[_0x3f2e('0x35')][_0x3f2e('0x31')]()]=_0x7f189f[_0x3f2e('0x32')][_0x3f2e('0x33')]();}else if(_0x7f189f[_0x3f2e('0x2f')]==='variable'&&_0x7f189f['variableName']&&_0x7f189f[_0x3f2e('0x35')]&&_0x7f189f[_0x3f2e('0x36')]){_0x257314[_0x7f189f['idField']['toLowerCase']()]=_0x3fc694[_0x7f189f[_0x3f2e('0x37')]][_0x3f2e('0x33')]();}else if(_0x7f189f[_0x3f2e('0x2f')]==='customVariable'&&_0x7f189f[_0x3f2e('0x38')]&&_0x7f189f[_0x3f2e('0x38')][_0x3f2e('0x39')]&&_0x7f189f['idField']&&_0x7f189f[_0x3f2e('0x36')]){_0x257314[_0x7f189f[_0x3f2e('0x35')][_0x3f2e('0x31')]()]=_0x3fc694[_0x7f189f['Variable'][_0x3f2e('0x39')][_0x3f2e('0x31')]()][_0x3f2e('0x33')]();}});}return _0x257314;}function getTicket(_0x4a64eb,_0x404f6,_0x568dfc,_0x3dc995,_0x538a4f,_0x5b0419){return function(_0x2ee77f){logger[_0x3f2e('0x17')]('['+[_0x4a64eb[_0x3f2e('0x12')]()]+_0x3f2e('0x3a'),_0x2ee77f);return new Promise(function(_0x3e7fac,_0x5c9cda){var _0x5e2abd=_0x4a64eb[_0x3f2e('0x31')]()===_0x3f2e('0x3b')?_0x2ee77f[_0x3f2e('0x1e')]:_0x2ee77f[_0x3f2e('0x27')];var _0x39dbd1={'method':_0x3f2e('0x23'),'uri':_0x568dfc+_0x3f2e('0x3c')+'?'+_0x5b0419,'body':Object[_0x3f2e('0x3d')]({},{'active':_0x3f2e('0x1d'),'caller_id':_0x5e2abd,'assigned_to':_0x2ee77f['userId'],'short_description':intUtil['getString'](_0x3dc995[_0x3f2e('0x3e')],_0x538a4f,'\x20'),'description':intUtil['getString'](_0x3dc995[_0x3f2e('0x3f')],_0x538a4f,'\x0a')},getCustomFields(_0x3dc995[_0x3f2e('0x40')],_0x538a4f)),'auth':_0x404f6,'json':!![]};return rp(_0x39dbd1)[_0x3f2e('0xe')](function(_0x3eca92){logger['info']('['+[_0x4a64eb[_0x3f2e('0x12')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x3eca92[_0x3f2e('0xf')]);_0x2ee77f[_0x3f2e('0x41')]=_0x3eca92['result'][_0x3f2e('0x11')];_0x2ee77f['ticketNumber']=_0x3eca92[_0x3f2e('0xf')][_0x3f2e('0x42')];logger[_0x3f2e('0x17')]('['+[_0x4a64eb['toUpperCase']()]+_0x3f2e('0x43'),_0x2ee77f);_0x3e7fac(_0x2ee77f);})[_0x3f2e('0x14')](function(_0x2f4b5c){logger[_0x3f2e('0x15')]('['+[_0x4a64eb[_0x3f2e('0x12')]()]+']',_0x2f4b5c[_0x3f2e('0x16')]);_0x5c9cda(_0x2f4b5c[_0x3f2e('0x16')]);});});};}function createRemoteTag(_0x13fc42,_0x9c5a91,_0x3cef58,_0x519afe){return new Promise(function(_0x2634a1,_0x3d4082){var _0x2c5524={'method':_0x3f2e('0x23'),'uri':_0x3cef58+_0x3f2e('0x44')+'?'+_0x519afe,'body':{'short_description':_0x13fc42,'global':!![],'active':!![],'name':_0x13fc42},'auth':_0x9c5a91,'json':!![]};return rp(_0x2c5524)[_0x3f2e('0xe')](function(_0x24b488){var _0x36f4e2=_0x24b488['result'][_0x3f2e('0x11')];_0x2634a1(_0x36f4e2);});});}function getRemoteTag(_0x297067,_0x1cf5ad,_0xb6e744,_0x11f48d,_0x51735b){return new Promise(function(_0x528dc4,_0x2e0717){var _0x4609c3={'method':_0x3f2e('0xc'),'uri':_0xb6e744+'label'+'?sysparm_query=name%3D'+_0x297067+'&'+_0x11f48d,'auth':_0x1cf5ad,'json':!![]};return rp(_0x4609c3)['then'](function(_0x2e2e53){if(_0x2e2e53[_0x3f2e('0xf')][_0x3f2e('0x10')]>0x0){var _0x217bdd=_0x2e2e53[_0x3f2e('0xf')][0x0]['sys_id'];_0x528dc4(_0x217bdd);}else{return createRemoteTag(_0x297067,_0x1cf5ad,_0xb6e744,_0x11f48d)[_0x3f2e('0xe')](function(_0xc3c853){_0x528dc4(_0xc3c853);});}});});}function assignTagToIncident(_0x5520d2,_0x3ea8ab,_0x3c0f04,_0x3d05fe,_0x3d9989){return new Promise(function(_0x567e9d,_0x177592){var _0x5da1f3={'method':'POST','uri':_0x3c0f04+_0x3f2e('0x45')+'?'+_0x3d9989,'body':{'label':_0x5520d2,'table':'incident','id_type':'Incident','table_key':_0x3d05fe[_0x3f2e('0x41')],'title':'Incident\x20-\x20'+_0x3d05fe[_0x3f2e('0x46')],'id_display':_0x3d05fe[_0x3f2e('0x46')]},'auth':_0x3ea8ab,'json':!![]};return rp(_0x5da1f3)[_0x3f2e('0xe')](function(_0x31605b){_0x567e9d();})['catch'](function(){_0x567e9d();});});}function manageTags(_0x380b7b,_0x3d94bc,_0x590430,_0x1b9e1b,_0x5538aa,_0x12282a,_0x4858ee){return new Promise(function(_0x4edf76,_0x7b9e7c){var _0x1d9f99=[];_0x3d94bc['forEach'](function(_0x496964){_0x1d9f99[_0x3f2e('0x47')](getRemoteTag(_0x496964,_0x590430,_0x1b9e1b,_0x12282a,_0x4858ee));});return Promise[_0x3f2e('0x48')](_0x1d9f99)[_0x3f2e('0xe')](function(_0x487daf){if(_0x487daf[_0x3f2e('0x10')]){logger[_0x3f2e('0x17')]('['+[_0x380b7b[_0x3f2e('0x12')]()]+_0x3f2e('0x49'),_0x487daf);var _0x515895=[];_0x487daf[_0x3f2e('0x2c')](function(_0x4c897a){_0x515895[_0x3f2e('0x47')](assignTagToIncident(_0x4c897a,_0x590430,_0x1b9e1b,_0x5538aa,_0x12282a));});return Promise[_0x3f2e('0x48')](_0x515895)[_0x3f2e('0xe')](function(){_0x4edf76();})[_0x3f2e('0x14')](function(){_0x4edf76();});}else{_0x4edf76();}});});}function getTags(_0xf92a73,_0x402d42,_0x32172b,_0x266f60,_0x4f42be,_0x41b405){return function(_0x5a93e5){return new Promise(function(_0x48f0e5,_0x29065c){var _0x3df907=[];var _0x582b3d=_0x266f60[_0x3f2e('0x4a')];if(_0x582b3d&&_0x582b3d[_0x3f2e('0x10')]>0x0){_0x3df907=_['map'](_0x582b3d,_0x3f2e('0x39'));}if(_0x3df907['length']>0x0){return manageTags(_0xf92a73,_0x3df907,_0x402d42,_0x32172b,_0x5a93e5,_0x4f42be,_0x41b405)['then'](function(){_0x48f0e5(_0x5a93e5);});}else{_0x48f0e5(_0x5a93e5);}});};}function emit(_0x2d26c3,_0x467873,_0xab3c94){var _0x5d3db7='%26sysparm_record_target%3Dincident'+_0x3f2e('0x4b')+_0x3f2e('0x4c')+_0x3f2e('0x4d');var _0x2cf3b9={'uri':_0x2d26c3+_0x3f2e('0x4e')+_0xab3c94+_0x5d3db7};io['to'](util[_0x3f2e('0x4f')](_0x3f2e('0x50'),_0x467873))[_0x3f2e('0x51')](_0x3f2e('0x52'),_0x2cf3b9);}exports['cs']=function(_0x10abd8,_0x44c689,_0x342d59,_0x1853ac,_0x16aedc,_0x3513c0,_0x24d30e,_0x77b0be){var _0x41af8c={};var _0x468e63={'user':_0x3513c0[_0x3f2e('0x53')],'pass':_0x3513c0['password']};var _0xbef922=_0x3f2e('0x54');var _0x103ba7=_0x3f2e('0x55');_0x3513c0[_0x3f2e('0x56')]=intUtil[_0x3f2e('0x57')](_0x3513c0[_0x3f2e('0x56')]);_0x3513c0[_0x3f2e('0x58')]=intUtil[_0x3f2e('0x57')](_0x3513c0['serverUrl']);var _0x13dc46=util['format'](_0x3f2e('0x59'),_0x3513c0[_0x3f2e('0x56')]);_0x41af8c['userEmail']=!_[_0x3f2e('0x5a')](_0x1853ac)?_0x1853ac[_0x3f2e('0x5b')]:null;_0x41af8c['adminEmail']=_0x3513c0[_0x3f2e('0x5b')];_0x41af8c[_0x3f2e('0x24')]=_0x77b0be[_0x3f2e('0x31')]()===_0x3f2e('0x3b')?_0x44c689[_0x3f2e('0x5c')]:_0x44c689[_0x3f2e('0x5d')];_0x41af8c[_0x3f2e('0x5e')]=_0x77b0be===_0x3f2e('0x5f')||_0x77b0be==='unmanaged'?_0x3f2e('0x5f'):'outbound';var _0x3500bb=util[_0x3f2e('0x4f')](_0x3f2e('0x60'),_0x3513c0[_0x3f2e('0x58')],_0x44c689[_0x3f2e('0x61')],md5(_0x44c689[_0x3f2e('0x61')]));if(_0x16aedc&&_0x16aedc[_0x3f2e('0x62')]){logger[_0x3f2e('0x17')](_0x3f2e('0x63'),_0x3f2e('0x64'));_0x44c689[_0x3f2e('0x65')]=_0x3500bb;}else if(_0x24d30e&&_0x24d30e[_0x3f2e('0x66')]&&_0x24d30e['recordingFormat']!==_0x3f2e('0x67')){logger[_0x3f2e('0x17')](_0x3f2e('0x68'),_0x3f2e('0x64'));_0x44c689[_0x3f2e('0x65')]=_0x3500bb;}else{_0x44c689['recordingURL']='';}return getAdminUser(_0x77b0be,_0x468e63,_0x41af8c,_0x13dc46,_0x103ba7,_0xbef922)[_0x3f2e('0xe')](getUser(_0x77b0be,_0x468e63,_0x13dc46,_0x103ba7,_0xbef922))[_0x3f2e('0xe')](getEndUser(_0x77b0be,_0x468e63,_0x13dc46,_0x103ba7,_0xbef922))['then'](getTicket(_0x77b0be,_0x468e63,_0x13dc46,_0x342d59,_0x44c689,_0x103ba7))[_0x3f2e('0xe')](function(_0x10ddb6){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x10ddb6[_0x3f2e('0x41')]));logger[_0x3f2e('0x17')](util[_0x3f2e('0x4f')](_0x3f2e('0x69'),_0x77b0be));if(_0x77b0be!==_0x3f2e('0x6a')){logger[_0x3f2e('0x17')]('['+[_0x77b0be[_0x3f2e('0x12')]()]+']',_0x3f2e('0x6b'));emit(_0x3513c0[_0x3f2e('0x56')],_0x1853ac['name'],_0x10ddb6[_0x3f2e('0x41')]);}})['catch'](function(_0x1c0d2a){logger['error']('['+[_0x77b0be[_0x3f2e('0x12')]()]+_0x3f2e('0x6c'),util['inspect'](_0x1c0d2a,{'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 bd7bc98..f3e56d7 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 _0xe205=['merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','push','variable','customVariable','Variable','username','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','recordingURL','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Ticket\x20created!','trigger:browser:url','error','unmanaged','lastevent','toUpperCase','isNil','The\x20User\x20ID\x20is:','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','description','Descriptions','date_start','slice','replace','parent_id','parent_type','name','direction','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]'];(function(_0x1824c9,_0x475d83){var _0x3ad7e9=function(_0x346a23){while(--_0x346a23){_0x1824c9['push'](_0x1824c9['shift']());}};_0x3ad7e9(++_0x475d83);}(_0xe205,0xb0));var _0x5e20=function(_0x4e328e,_0x48ae8c){_0x4e328e=_0x4e328e-0x0;var _0x2334b2=_0xe205[_0x4e328e];return _0x2334b2;};'use strict';var _=require(_0x5e20('0x0'));var rp=require(_0x5e20('0x1'));var BPromise=require('bluebird');var md5=require(_0x5e20('0x2'));var util=require('util');var Redis=require(_0x5e20('0x3'));var intUtil=require(_0x5e20('0x4'));var config=require('../../../../config/environment');var logger=require(_0x5e20('0x5'))(_0x5e20('0x6'));config[_0x5e20('0x7')]=_[_0x5e20('0x8')](config[_0x5e20('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x5e20('0x9'))(new Redis(config[_0x5e20('0x7')]));var def={'method':_0x5e20('0xa'),'json':!![]};function emit(_0x4253ec,_0x567778,_0xfef9a5){io['to'](_0x4253ec)[_0x5e20('0xb')](_0x567778,_0xfef9a5);}function getTicket(_0x592768,_0x243f14,_0x7da11e,_0x3a2905,_0x2ac9f5,_0x43f3b6,_0x42b442,_0x2d0530){logger[_0x5e20('0xc')](_0x5e20('0xd'));var _0x4708da=new Date();var _0x17caee=[{'name':'name','value':intUtil[_0x5e20('0xe')](_0x3a2905[_0x5e20('0xf')],_0x2ac9f5,'\x20')},{'name':_0x5e20('0x10'),'value':_0x243f14['id']},{'name':'created_by','value':_0x243f14['id']},{'name':_0x5e20('0x11'),'value':intUtil[_0x5e20('0xe')](_0x3a2905[_0x5e20('0x12')],_0x2ac9f5,'\x0a')},{'name':_0x5e20('0x13'),'value':_0x4708da['toISOString']()[_0x5e20('0x14')](0x0,0x13)[_0x5e20('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x5e20('0x16'),'value':_0x7da11e['id']},{'name':_0x5e20('0x17'),'value':'Contacts'},{'name':'parent_name','value':_0x7da11e[_0x5e20('0x18')]},{'name':_0x5e20('0x19'),'value':_0x2d0530}];if(_0x43f3b6[_0x5e20('0x1a')]){_[_0x5e20('0x1b')](_0x43f3b6,function(_0x547204){if(_0x2ac9f5[_0x547204[_0x5e20('0x1c')]]){_0x17caee['push']({'name':_0x547204[_0x5e20('0x1d')],'value':_0x2ac9f5[_0x547204[_0x5e20('0x1c')]]});}});}return request({'form':{'method':_0x5e20('0x1e'),'input_type':_0x5e20('0x1f'),'response_type':_0x5e20('0x1f'),'rest_data':JSON[_0x5e20('0x20')]({'session':_0x42b442['id'],'module_name':_0x5e20('0x21'),'name_value_list':_0x17caee})}});}function getAuth(_0x50772c){return util[_0x5e20('0x22')]('Basic\x20%s',new Buffer(_0x50772c[_0x5e20('0x23')]+':X')[_0x5e20('0x24')](_0x5e20('0x25')));}function getServerInfo(_0x2c0b82){return request({'form':{'method':'get_server_info','input_type':_0x5e20('0x1f'),'response_type':_0x5e20('0x1f'),'rest_data':JSON[_0x5e20('0x20')]({'session':_0x2c0b82['id']})}});}function getUser(_0x1d7cae,_0x32ed18,_0x494985){if(!_['isNil'](_0x32ed18)){logger['info'](_0x5e20('0x26'),_0x32ed18);return request({'form':{'method':_0x5e20('0x27'),'input_type':'JSON','response_type':_0x5e20('0x1f'),'rest_data':JSON[_0x5e20('0x20')]({'session':_0x494985['id'],'module_name':_0x5e20('0x28'),'query':util[_0x5e20('0x22')](_0x5e20('0x29'),_0x32ed18),'order_by':'','offset':'0','select_fields':['id',_0x5e20('0x18'),_0x5e20('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x57dcb8){if(_0x57dcb8[_0x5e20('0x2b')]['length']){var _0x56d496=_[_0x5e20('0x2c')](_0x57dcb8[_0x5e20('0x2b')],function(_0x539c7a){return _0x539c7a[_0x5e20('0x2d')][_0x5e20('0x2a')][_0x5e20('0x2e')]===_0x32ed18;});if(_0x56d496){logger['info'](_0x5e20('0x2f'));return BPromise[_0x5e20('0x30')]({'id':_0x56d496[_0x5e20('0x2d')]['id'][_0x5e20('0x2e')],'name':_0x56d496[_0x5e20('0x2d')]['name'][_0x5e20('0x2e')]});}}logger[_0x5e20('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5e20('0x30')]({'id':_0x494985[_0x5e20('0x2d')][_0x5e20('0x31')][_0x5e20('0x2e')],'name':_0x494985[_0x5e20('0x2d')]['user_name'][_0x5e20('0x2e')]});});}else{logger[_0x5e20('0xc')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5e20('0x30')]({'id':_0x494985['name_value_list'][_0x5e20('0x31')][_0x5e20('0x2e')],'name':_0x494985['name_value_list'][_0x5e20('0x2a')][_0x5e20('0x2e')]});}}function getEndUser(_0x226549,_0x4241d5,_0x3e1058,_0xdb3647){logger['info'](_0x5e20('0x32'),_0x3e1058);return request({'form':{'method':'get_entry_list','input_type':_0x5e20('0x1f'),'response_type':_0x5e20('0x1f'),'rest_data':JSON[_0x5e20('0x20')]({'session':_0xdb3647['id'],'module_name':_0x5e20('0x33'),'query':util[_0x5e20('0x22')](_0x5e20('0x34'),_0x3e1058),'order_by':'','offset':'0','select_fields':['id',_0x5e20('0x18'),_0x5e20('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5e20('0x36')](function(_0x20f6a4){if(_0x20f6a4[_0x5e20('0x2b')][_0x5e20('0x1a')]){var _0x41981e=_['find'](_0x20f6a4[_0x5e20('0x2b')],function(_0x1acea0){return _0x1acea0['name_value_list'][_0x5e20('0x35')][_0x5e20('0x2e')]===_0x3e1058;});if(_0x41981e){logger[_0x5e20('0xc')](_0x5e20('0x37'));return BPromise['resolve']({'id':_0x41981e[_0x5e20('0x2d')]['id']['value'],'name':_0x41981e['name_value_list'][_0x5e20('0x18')][_0x5e20('0x2e')],'phone':_0x41981e['name_value_list']['phone_home'][_0x5e20('0x2e')]});}}else{logger[_0x5e20('0xc')](_0x5e20('0x38'));return request({'form':{'method':_0x5e20('0x1e'),'input_type':_0x5e20('0x1f'),'response_type':_0x5e20('0x1f'),'rest_data':JSON[_0x5e20('0x20')]({'session':_0xdb3647['id'],'module_name':_0x5e20('0x33'),'name_value_list':[{'name':_0x5e20('0x39'),'value':_0x4241d5!==''?_0x4241d5:util[_0x5e20('0x22')](_0x5e20('0x3a'),_0x3e1058)},{'name':_0x5e20('0x35'),'value':_0x3e1058}]})}})['then'](function(_0x525e3d){logger[_0x5e20('0xc')](_0x5e20('0x3b'));return BPromise[_0x5e20('0x30')]({'id':_0x525e3d['id'],'name':_0x525e3d[_0x5e20('0x2b')][_0x5e20('0x39')][_0x5e20('0x2e')],'phone':_0x525e3d[_0x5e20('0x2b')][_0x5e20('0x35')]['value']});});}});}function request(_0x505830){logger[_0x5e20('0x3c')](_0x5e20('0x3d'),JSON[_0x5e20('0x20')](_0x505830));return rp(_[_0x5e20('0x3e')](def,_0x505830));}function getTags(_0x57fa8d,_0x26f8ad){var _0x5ce1e7=[];if(_0x57fa8d&&_0x57fa8d[_0x5e20('0x1a')]>0x0){_0x5ce1e7=_[_0x5e20('0x3f')](_0x57fa8d,_0x26f8ad);}return _0x5ce1e7;}function getCustomFields(_0x570a83,_0x539ec3){var _0x1b7c74=[];var _0x406e2b={'custom_fields':[]};if(_0x570a83['length']>0x0){_[_0x5e20('0x1b')](_0x570a83,function(_0x24ab70){if(_0x24ab70[_0x5e20('0x40')]===_0x5e20('0x41')&&_0x24ab70[_0x5e20('0x42')]&&!_0x24ab70[_0x5e20('0x43')]){_0x406e2b[_0x24ab70[_0x5e20('0x42')][_0x5e20('0x44')]()]=_0x24ab70[_0x5e20('0x45')][_0x5e20('0x24')]();}else if(_0x24ab70[_0x5e20('0x40')]===_0x5e20('0x41')&&_0x24ab70[_0x5e20('0x1d')]&&_0x24ab70[_0x5e20('0x43')]){_0x406e2b[_0x5e20('0x46')][_0x5e20('0x47')]({'id':_0x24ab70['idField'],'value':_0x24ab70[_0x5e20('0x45')][_0x5e20('0x24')]()});}else if(_0x24ab70[_0x5e20('0x40')]===_0x5e20('0x48')&&_0x24ab70[_0x5e20('0x1c')]&&_0x24ab70[_0x5e20('0x1d')]&&_0x24ab70['customField']){_0x539ec3[_0x24ab70[_0x5e20('0x1c')]]&&_0x406e2b['custom_fields'][_0x5e20('0x47')]({'id':_0x24ab70[_0x5e20('0x1d')],'value':_0x539ec3[_0x24ab70[_0x5e20('0x1c')]][_0x5e20('0x24')]()});}else if(_0x24ab70[_0x5e20('0x40')]===_0x5e20('0x49')&&_0x24ab70[_0x5e20('0x4a')]&&_0x24ab70[_0x5e20('0x4a')][_0x5e20('0x18')]&&_0x24ab70[_0x5e20('0x1d')]&&_0x24ab70[_0x5e20('0x43')]){_0x539ec3[_0x24ab70[_0x5e20('0x4a')][_0x5e20('0x18')][_0x5e20('0x44')]()]&&_0x406e2b[_0x5e20('0x46')][_0x5e20('0x47')]({'id':_0x24ab70[_0x5e20('0x1d')],'value':_0x539ec3[_0x24ab70[_0x5e20('0x4a')][_0x5e20('0x18')][_0x5e20('0x44')]()][_0x5e20('0x24')]()});}});}return _0x406e2b;}function getConnection(_0x532b75){return request({'method':_0x5e20('0xa'),'form':{'method':'login','input_type':_0x5e20('0x1f'),'response_type':_0x5e20('0x1f'),'rest_data':JSON[_0x5e20('0x20')]({'user_auth':{'user_name':_0x532b75[_0x5e20('0x4b')],'password':_0x532b75['password'],'encryption':_0x5e20('0x4c')},'application':_0x5e20('0x4d')})}})[_0x5e20('0x36')](function(_0x4c0969){var _0x383e04=_0x4c0969;if(_0x383e04['id']){def['sessionID']=_0x383e04['id'];return BPromise[_0x5e20('0x30')](_0x383e04);}else{throw new Error(util[_0x5e20('0x22')](_0x5e20('0x4e'),_0x532b75['id']));}});}function setRelationship(_0x114ad3,_0xeaadcf,_0x4718f2,_0x396ef5){return request({'form':{'method':_0x5e20('0x4f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x5e20('0x20')]({'session':_0x114ad3['id'],'module_name':_0x5e20('0x21'),'module_id':_0x4718f2['id'],'link_field_name':_0x396ef5,'related_ids':[_0xeaadcf['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x5e20('0x50')]=function(_0x4450f4,_0x3c03ad,_0x5c277c,_0x277a26,_0x4c0bc3,_0x42261d){var _0x408ace,_0x25f9ae,_0x38a60a,_0x208256;_0x42261d[_0x5e20('0x51')]=intUtil[_0x5e20('0x52')](_0x42261d[_0x5e20('0x51')]);_0x42261d['serverUrl']=intUtil[_0x5e20('0x52')](_0x42261d[_0x5e20('0x53')]);def[_0x5e20('0x54')]=util[_0x5e20('0x22')]('%s/service/v4_1/rest.php',_0x42261d[_0x5e20('0x51')]);if(_0x4c0bc3&&_0x4c0bc3[_0x5e20('0x55')]){logger[_0x5e20('0xc')](_0x5e20('0x56'),'Recording\x20is\x20enabled!');_0x3c03ad[_0x5e20('0x57')]=util[_0x5e20('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x42261d[_0x5e20('0x53')],_0x3c03ad[_0x5e20('0x58')],md5(_0x3c03ad[_0x5e20('0x58')]));}else{_0x3c03ad[_0x5e20('0x57')]='';}return getConnection(_0x42261d)[_0x5e20('0x36')](function(_0x1cde10){_0x208256=_0x1cde10;return getUser(_0x42261d,_0x277a26['name'],_0x208256);})[_0x5e20('0x36')](function(_0x4facaf){_0x408ace=_0x4facaf;logger[_0x5e20('0xc')]('The\x20User\x20ID\x20is:',_0x408ace['id']);return getEndUser(_0x42261d,_0x3c03ad['calleridname'],_0x3c03ad[_0x5e20('0x59')],_0x208256);})['then'](function(_0xb0414e){_0x25f9ae=_0xb0414e;logger[_0x5e20('0xc')](_0x5e20('0x5a'),_0x25f9ae['id']);return getTicket(_0x42261d,_0x408ace,_0x25f9ae,_0x5c277c,_0x3c03ad,_0x5c277c[_0x5e20('0x5b')],_0x208256,_0x5e20('0x5c'));})[_0x5e20('0x36')](function(_0xf0db25){_0x38a60a=_0xf0db25;logger['info']('Ticket\x20created!');logger['info'](_0x5e20('0x5d'),_0x38a60a['id']);return setRelationship(_0x208256,_0x408ace,_0x38a60a,_0x5e20('0x5e'));})['then'](function(){return setRelationship(_0x208256,_0x25f9ae,_0x38a60a,_0x5e20('0x5f'));})[_0x5e20('0x36')](function(){return getServerInfo(_0x208256);})[_0x5e20('0x36')](function(_0x7862b4){var _0x358dba=parseInt(_0x7862b4[_0x5e20('0x60')][_0x5e20('0x61')](0x0));var _0x413d4d=util[_0x5e20('0x22')](_0x5e20('0x62'),_0x42261d[_0x5e20('0x51')],_0x38a60a['id']);if(_0x358dba>0x6){_0x413d4d=util[_0x5e20('0x22')](_0x5e20('0x63'),_0x42261d[_0x5e20('0x51')],_0x38a60a['id']);}logger[_0x5e20('0xc')](_0x5e20('0x56'),_0x5e20('0x64'));emit(util['format'](_0x5e20('0x65'),_0x277a26[_0x5e20('0x18')]),'trigger:browser:url',{'uri':_0x413d4d});})[_0x5e20('0x66')](function(_0x5702a3){logger['error'](_0x5e20('0x56'),JSON[_0x5e20('0x20')](_0x5702a3));});};exports[_0x5e20('0x67')]=function(_0x5b3438,_0x4409b3,_0x18b238,_0x45267c,_0x34d27e,_0x2ee446,_0x296486){var _0x1384fb,_0x18f20f,_0x9e1173,_0x2d4b78;_0x2ee446[_0x5e20('0x51')]=intUtil[_0x5e20('0x52')](_0x2ee446[_0x5e20('0x51')]);_0x2ee446['serverUrl']=intUtil[_0x5e20('0x52')](_0x2ee446[_0x5e20('0x53')]);def[_0x5e20('0x54')]=util['format'](_0x5e20('0x68'),_0x2ee446[_0x5e20('0x51')]);if(_0x296486&&_0x296486[_0x5e20('0x69')]&&_0x296486[_0x5e20('0x69')]!=='none'){logger[_0x5e20('0xc')](_0x5e20('0x6a'),_0x5e20('0x6b'));_0x4409b3['recordingURL']=util[_0x5e20('0x22')](_0x5e20('0x6c'),_0x2ee446[_0x5e20('0x53')],_0x4409b3[_0x5e20('0x58')],md5(_0x4409b3[_0x5e20('0x58')]));}return getConnection(_0x2ee446)['then'](function(_0x1fa928){_0x2d4b78=_0x1fa928;return getUser(_0x2ee446,_0x45267c[_0x5e20('0x18')],_0x2d4b78);})['then'](function(_0x20c674){_0x1384fb=_0x20c674;logger[_0x5e20('0xc')]('The\x20User\x20ID\x20is:',_0x1384fb['id']);return getEndUser(_0x2ee446,_0x4409b3[_0x5e20('0x6d')],_0x4409b3[_0x5e20('0x6e')],_0x2d4b78);})[_0x5e20('0x36')](function(_0x208664){_0x18f20f=_0x208664;logger['info'](_0x5e20('0x5a'),_0x18f20f['id']);return getTicket(_0x2ee446,_0x1384fb,_0x18f20f,_0x18b238,_0x4409b3,_0x18b238[_0x5e20('0x5b')],_0x2d4b78,'Outbound');})[_0x5e20('0x36')](function(_0x5e2592){_0x9e1173=_0x5e2592;logger[_0x5e20('0xc')](_0x5e20('0x6f'));logger['info'](_0x5e20('0x5d'),_0x9e1173['id']);return setRelationship(_0x2d4b78,_0x1384fb,_0x9e1173,_0x5e20('0x5e'));})['then'](function(){return setRelationship(_0x2d4b78,_0x18f20f,_0x9e1173,'contacts');})[_0x5e20('0x36')](function(){return getServerInfo(_0x2d4b78);})[_0x5e20('0x36')](function(_0x42b2c7){var _0xf563d6=parseInt(_0x42b2c7['version'][_0x5e20('0x61')](0x0));var _0x1d8553=util[_0x5e20('0x22')](_0x5e20('0x62'),_0x2ee446[_0x5e20('0x51')],_0x9e1173['id']);if(_0xf563d6>0x6){_0x1d8553=util['format'](_0x5e20('0x63'),_0x2ee446[_0x5e20('0x51')],_0x9e1173['id']);}logger[_0x5e20('0xc')](_0x5e20('0x6a'),_0x5e20('0x64'));emit(util[_0x5e20('0x22')]('user:%s',_0x45267c[_0x5e20('0x18')]),_0x5e20('0x70'),{'uri':_0x1d8553});})[_0x5e20('0x66')](function(_0x5e1331){logger[_0x5e20('0x71')](_0x5e20('0x6a'),JSON['stringify'](_0x5e1331));});};exports[_0x5e20('0x72')]=function(_0x110636,_0x52fa47,_0x5d38ce,_0x2081eb,_0x3ef0d0,_0x11faa7){var _0x1b8c23,_0x13cd62,_0x67e349,_0x1ef562;_0x11faa7['remoteUri']=intUtil[_0x5e20('0x52')](_0x11faa7[_0x5e20('0x51')]);_0x11faa7[_0x5e20('0x53')]=intUtil[_0x5e20('0x52')](_0x11faa7[_0x5e20('0x53')]);def[_0x5e20('0x54')]=util[_0x5e20('0x22')](_0x5e20('0x68'),_0x11faa7[_0x5e20('0x51')]);if(_0x3ef0d0&&_0x3ef0d0[_0x5e20('0x55')]){logger[_0x5e20('0xc')]('['+_0x52fa47[_0x5e20('0x73')][_0x5e20('0x74')]()+']',_0x5e20('0x6b'));_0x52fa47[_0x5e20('0x57')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x11faa7[_0x5e20('0x53')],_0x52fa47[_0x5e20('0x58')],md5(_0x52fa47['uniqueid']));}else{_0x52fa47[_0x5e20('0x57')]='';}return getConnection(_0x11faa7)['then'](function(_0x2b805a){_0x1ef562=_0x2b805a;if(!_[_0x5e20('0x75')](_0x2081eb)){return getUser(_0x11faa7,_0x2081eb['name'],_0x1ef562);}else{return getUser(_0x11faa7,null,_0x1ef562);}})[_0x5e20('0x36')](function(_0x13004e){_0x1b8c23=_0x13004e;logger[_0x5e20('0xc')](_0x5e20('0x76'),_0x1b8c23['id']);return getEndUser(_0x11faa7,_0x52fa47['calleridname'],_0x52fa47[_0x5e20('0x59')],_0x1ef562);})['then'](function(_0x5e937a){_0x13cd62=_0x5e937a;logger[_0x5e20('0xc')]('The\x20Enduser\x20ID\x20is:',_0x13cd62['id']);return getTicket(_0x11faa7,_0x1b8c23,_0x13cd62,_0x5d38ce,_0x52fa47,_0x5d38ce[_0x5e20('0x5b')],_0x1ef562,_0x5e20('0x5c'));})[_0x5e20('0x36')](function(_0x46c09b){_0x67e349=_0x46c09b;logger[_0x5e20('0xc')](_0x5e20('0x6f'));logger[_0x5e20('0xc')]('The\x20Ticket\x20ID\x20is:',_0x67e349['id']);return setRelationship(_0x1ef562,_0x1b8c23,_0x67e349,_0x5e20('0x5e'));})[_0x5e20('0x36')](function(){return setRelationship(_0x1ef562,_0x13cd62,_0x67e349,_0x5e20('0x5f'));})[_0x5e20('0x36')](function(){return getServerInfo(_0x1ef562);})[_0x5e20('0x66')](function(_0x5b455e){logger[_0x5e20('0x71')]('['+_0x52fa47[_0x5e20('0x73')]['toUpperCase']()+']',JSON[_0x5e20('0x20')](_0x5b455e));});}; \ No newline at end of file +var _0x784a=['[HTTP]','map','string','nameField','customField','toLowerCase','content','type','idField','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','uri','%s/service/v4_1/rest.php','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','Inbound','Ticket\x20created!','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','Outbound','The\x20Ticket\x20ID\x20is:','contacts','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','The\x20Enduser\x20ID\x20is:','lodash','request-promise','bluebird','util','./util','../../../../config/environment','sugarcrm','localhost','socket.io-emitter','redis','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','date_start','toISOString','replace','duration_minutes','parent_id','parent_type','Contacts','direction','length','forEach','push','variableName','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug'];(function(_0x4a14a0,_0x4e10f2){var _0x12bd39=function(_0x3d32ef){while(--_0x3d32ef){_0x4a14a0['push'](_0x4a14a0['shift']());}};_0x12bd39(++_0x4e10f2);}(_0x784a,0x130));var _0xa784=function(_0x511907,_0x4ae413){_0x511907=_0x511907-0x0;var _0x5e58e6=_0x784a[_0x511907];return _0x5e58e6;};'use strict';var _=require(_0xa784('0x0'));var rp=require(_0xa784('0x1'));var BPromise=require(_0xa784('0x2'));var md5=require('md5');var util=require(_0xa784('0x3'));var Redis=require('ioredis');var intUtil=require(_0xa784('0x4'));var config=require(_0xa784('0x5'));var logger=require('../../../../config/logger')(_0xa784('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0xa784('0x7'),'port':0x18eb});var io=require(_0xa784('0x8'))(new Redis(config[_0xa784('0x9')]));var def={'method':_0xa784('0xa'),'json':!![]};function emit(_0x7a773,_0x2ed29f,_0x2e55ec){io['to'](_0x7a773)[_0xa784('0xb')](_0x2ed29f,_0x2e55ec);}function getTicket(_0xf850d,_0x4a2aac,_0x3ec493,_0x4547c3,_0x2303ff,_0x339fad,_0x3bcec9,_0xc63bec){logger[_0xa784('0xc')](_0xa784('0xd'));var _0x114956=new Date();var _0x12ef61=[{'name':_0xa784('0xe'),'value':intUtil['getString'](_0x4547c3[_0xa784('0xf')],_0x2303ff,'\x20')},{'name':_0xa784('0x10'),'value':_0x4a2aac['id']},{'name':_0xa784('0x11'),'value':_0x4a2aac['id']},{'name':_0xa784('0x12'),'value':intUtil['getString'](_0x4547c3['Descriptions'],_0x2303ff,'\x0a')},{'name':_0xa784('0x13'),'value':_0x114956[_0xa784('0x14')]()['slice'](0x0,0x13)[_0xa784('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xa784('0x16'),'value':'15'},{'name':_0xa784('0x17'),'value':_0x3ec493['id']},{'name':_0xa784('0x18'),'value':_0xa784('0x19')},{'name':'parent_name','value':_0x3ec493[_0xa784('0xe')]},{'name':_0xa784('0x1a'),'value':_0xc63bec}];if(_0x339fad[_0xa784('0x1b')]){_[_0xa784('0x1c')](_0x339fad,function(_0x2bc4d6){if(_0x2303ff[_0x2bc4d6['variableName']]){_0x12ef61[_0xa784('0x1d')]({'name':_0x2bc4d6['idField'],'value':_0x2303ff[_0x2bc4d6[_0xa784('0x1e')]]});}});}return request({'form':{'method':_0xa784('0x1f'),'input_type':_0xa784('0x20'),'response_type':_0xa784('0x20'),'rest_data':JSON[_0xa784('0x21')]({'session':_0x3bcec9['id'],'module_name':_0xa784('0x22'),'name_value_list':_0x12ef61})}});}function getAuth(_0x3f6bc4){return util['format'](_0xa784('0x23'),new Buffer(_0x3f6bc4[_0xa784('0x24')]+':X')[_0xa784('0x25')]('base64'));}function getServerInfo(_0x58a132){return request({'form':{'method':_0xa784('0x26'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xa784('0x21')]({'session':_0x58a132['id']})}});}function getUser(_0x5dd044,_0xd73947,_0x4195b9){if(!_[_0xa784('0x27')](_0xd73947)){logger['info'](_0xa784('0x28'),_0xd73947);return request({'form':{'method':_0xa784('0x29'),'input_type':_0xa784('0x20'),'response_type':'JSON','rest_data':JSON[_0xa784('0x21')]({'session':_0x4195b9['id'],'module_name':_0xa784('0x2a'),'query':util[_0xa784('0x2b')](_0xa784('0x2c'),_0xd73947),'order_by':'','offset':'0','select_fields':['id',_0xa784('0xe'),_0xa784('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa784('0x2e')](function(_0x285b1d){if(_0x285b1d[_0xa784('0x2f')][_0xa784('0x1b')]){var _0x390adc=_['find'](_0x285b1d[_0xa784('0x2f')],function(_0x4afa3c){return _0x4afa3c[_0xa784('0x30')][_0xa784('0x2d')][_0xa784('0x31')]===_0xd73947;});if(_0x390adc){logger[_0xa784('0xc')](_0xa784('0x32'));return BPromise[_0xa784('0x33')]({'id':_0x390adc[_0xa784('0x30')]['id']['value'],'name':_0x390adc[_0xa784('0x30')][_0xa784('0xe')][_0xa784('0x31')]});}}logger['info'](_0xa784('0x34'));return BPromise['resolve']({'id':_0x4195b9[_0xa784('0x30')]['user_id'][_0xa784('0x31')],'name':_0x4195b9[_0xa784('0x30')][_0xa784('0x2d')][_0xa784('0x31')]});});}else{logger[_0xa784('0xc')](_0xa784('0x35'));return BPromise[_0xa784('0x33')]({'id':_0x4195b9[_0xa784('0x30')][_0xa784('0x36')][_0xa784('0x31')],'name':_0x4195b9[_0xa784('0x30')]['user_name']['value']});}}function getEndUser(_0x49a755,_0x5e19c7,_0x172e9e,_0x1e3c8f){logger[_0xa784('0xc')](_0xa784('0x37'),_0x172e9e);return request({'form':{'method':_0xa784('0x29'),'input_type':'JSON','response_type':_0xa784('0x20'),'rest_data':JSON['stringify']({'session':_0x1e3c8f['id'],'module_name':_0xa784('0x19'),'query':util[_0xa784('0x2b')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x172e9e),'order_by':'','offset':'0','select_fields':['id',_0xa784('0xe'),_0xa784('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x20a405){if(_0x20a405['entry_list'][_0xa784('0x1b')]){var _0x2bb9ae=_[_0xa784('0x39')](_0x20a405[_0xa784('0x2f')],function(_0x32c3fa){return _0x32c3fa[_0xa784('0x30')][_0xa784('0x38')][_0xa784('0x31')]===_0x172e9e;});if(_0x2bb9ae){logger[_0xa784('0xc')](_0xa784('0x3a'));return BPromise[_0xa784('0x33')]({'id':_0x2bb9ae[_0xa784('0x30')]['id'][_0xa784('0x31')],'name':_0x2bb9ae[_0xa784('0x30')][_0xa784('0xe')][_0xa784('0x31')],'phone':_0x2bb9ae[_0xa784('0x30')][_0xa784('0x38')][_0xa784('0x31')]});}}else{logger[_0xa784('0xc')](_0xa784('0x3b'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xa784('0x21')]({'session':_0x1e3c8f['id'],'module_name':_0xa784('0x19'),'name_value_list':[{'name':_0xa784('0x3c'),'value':_0x5e19c7!==_0xa784('0x3d')?_0x5e19c7:util[_0xa784('0x2b')](_0xa784('0x3e'),_0x172e9e)},{'name':_0xa784('0x38'),'value':_0x172e9e}]})}})['then'](function(_0x44df54){logger[_0xa784('0xc')](_0xa784('0x3f'));return BPromise['resolve']({'id':_0x44df54['id'],'name':_0x44df54[_0xa784('0x2f')][_0xa784('0x3c')][_0xa784('0x31')],'phone':_0x44df54[_0xa784('0x2f')]['phone_home']['value']});});}});}function request(_0x468ba1){logger[_0xa784('0x40')](_0xa784('0x41'),JSON['stringify'](_0x468ba1));return rp(_['merge'](def,_0x468ba1));}function getTags(_0x422082,_0xd8f77a){var _0x34a898=[];if(_0x422082&&_0x422082[_0xa784('0x1b')]>0x0){_0x34a898=_[_0xa784('0x42')](_0x422082,_0xd8f77a);}return _0x34a898;}function getCustomFields(_0x41e203,_0x5ae238){var _0x389241=[];var _0x5ddf60={'custom_fields':[]};if(_0x41e203[_0xa784('0x1b')]>0x0){_[_0xa784('0x1c')](_0x41e203,function(_0x57fe9c){if(_0x57fe9c['type']===_0xa784('0x43')&&_0x57fe9c[_0xa784('0x44')]&&!_0x57fe9c[_0xa784('0x45')]){_0x5ddf60[_0x57fe9c[_0xa784('0x44')][_0xa784('0x46')]()]=_0x57fe9c[_0xa784('0x47')]['toString']();}else if(_0x57fe9c[_0xa784('0x48')]==='string'&&_0x57fe9c[_0xa784('0x49')]&&_0x57fe9c['customField']){_0x5ddf60[_0xa784('0x4a')]['push']({'id':_0x57fe9c[_0xa784('0x49')],'value':_0x57fe9c[_0xa784('0x47')][_0xa784('0x25')]()});}else if(_0x57fe9c[_0xa784('0x48')]===_0xa784('0x4b')&&_0x57fe9c[_0xa784('0x1e')]&&_0x57fe9c['idField']&&_0x57fe9c[_0xa784('0x45')]){_0x5ae238[_0x57fe9c[_0xa784('0x1e')]]&&_0x5ddf60[_0xa784('0x4a')]['push']({'id':_0x57fe9c[_0xa784('0x49')],'value':_0x5ae238[_0x57fe9c[_0xa784('0x1e')]]['toString']()});}else if(_0x57fe9c[_0xa784('0x48')]===_0xa784('0x4c')&&_0x57fe9c[_0xa784('0x4d')]&&_0x57fe9c[_0xa784('0x4d')][_0xa784('0xe')]&&_0x57fe9c[_0xa784('0x49')]&&_0x57fe9c[_0xa784('0x45')]){_0x5ae238[_0x57fe9c[_0xa784('0x4d')]['name'][_0xa784('0x46')]()]&&_0x5ddf60[_0xa784('0x4a')][_0xa784('0x1d')]({'id':_0x57fe9c['idField'],'value':_0x5ae238[_0x57fe9c[_0xa784('0x4d')][_0xa784('0xe')][_0xa784('0x46')]()][_0xa784('0x25')]()});}});}return _0x5ddf60;}function getConnection(_0x1b49c7){return request({'method':_0xa784('0xa'),'form':{'method':_0xa784('0x4e'),'input_type':'JSON','response_type':_0xa784('0x20'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1b49c7[_0xa784('0x4f')],'password':_0x1b49c7[_0xa784('0x50')],'encryption':_0xa784('0x51')},'application':_0xa784('0x52')})}})[_0xa784('0x2e')](function(_0x2d8a8c){var _0x29c3b1=_0x2d8a8c;if(_0x29c3b1['id']){def[_0xa784('0x53')]=_0x29c3b1['id'];return BPromise[_0xa784('0x33')](_0x29c3b1);}else{throw new Error(util[_0xa784('0x2b')](_0xa784('0x54'),_0x1b49c7['id']));}});}function setRelationship(_0x542c11,_0x3f43fa,_0x5ad62f,_0x59efeb){return request({'form':{'method':_0xa784('0x55'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xa784('0x21')]({'session':_0x542c11['id'],'module_name':_0xa784('0x22'),'module_id':_0x5ad62f['id'],'link_field_name':_0x59efeb,'related_ids':[_0x3f43fa['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xa784('0x56')]=function(_0x5a3b31,_0xce0d3d,_0x414cde,_0x10fcf7,_0x468f99,_0x222ae9){var _0x297e35,_0x42e5fb,_0x80a13f,_0x3cae6a;_0x222ae9['remoteUri']=intUtil['stripTrailingSlash'](_0x222ae9[_0xa784('0x57')]);_0x222ae9['serverUrl']=intUtil[_0xa784('0x58')](_0x222ae9[_0xa784('0x59')]);def[_0xa784('0x5a')]=util[_0xa784('0x2b')](_0xa784('0x5b'),_0x222ae9[_0xa784('0x57')]);if(_0x468f99&&_0x468f99['monitor_format']){logger[_0xa784('0xc')](_0xa784('0x5c'),'Recording\x20is\x20enabled!');_0xce0d3d[_0xa784('0x5d')]=util['format'](_0xa784('0x5e'),_0x222ae9[_0xa784('0x59')],_0xce0d3d['uniqueid'],md5(_0xce0d3d[_0xa784('0x5f')]));}else{_0xce0d3d[_0xa784('0x5d')]='';}return getConnection(_0x222ae9)[_0xa784('0x2e')](function(_0x4afef2){_0x3cae6a=_0x4afef2;return getUser(_0x222ae9,_0x10fcf7[_0xa784('0xe')],_0x3cae6a);})[_0xa784('0x2e')](function(_0x4a79d9){_0x297e35=_0x4a79d9;logger[_0xa784('0xc')](_0xa784('0x60'),_0x297e35['id']);return getEndUser(_0x222ae9,_0xce0d3d[_0xa784('0x61')],_0xce0d3d['calleridnum'],_0x3cae6a);})[_0xa784('0x2e')](function(_0x3f3ae9){_0x42e5fb=_0x3f3ae9;logger['info']('The\x20Enduser\x20ID\x20is:',_0x42e5fb['id']);return getTicket(_0x222ae9,_0x297e35,_0x42e5fb,_0x414cde,_0xce0d3d,_0x414cde['Fields'],_0x3cae6a,_0xa784('0x62'));})[_0xa784('0x2e')](function(_0x13c0d4){_0x80a13f=_0x13c0d4;logger[_0xa784('0xc')](_0xa784('0x63'));logger[_0xa784('0xc')]('The\x20Ticket\x20ID\x20is:',_0x80a13f['id']);return setRelationship(_0x3cae6a,_0x297e35,_0x80a13f,_0xa784('0x64'));})[_0xa784('0x2e')](function(){return setRelationship(_0x3cae6a,_0x42e5fb,_0x80a13f,'contacts');})[_0xa784('0x2e')](function(){return getServerInfo(_0x3cae6a);})['then'](function(_0xf1fb8b){var _0x51ab39=parseInt(_0xf1fb8b[_0xa784('0x65')][_0xa784('0x66')](0x0));var _0x5b852f=util['format'](_0xa784('0x67'),_0x222ae9[_0xa784('0x57')],_0x80a13f['id']);if(_0x51ab39>0x6){_0x5b852f=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x222ae9[_0xa784('0x57')],_0x80a13f['id']);}logger[_0xa784('0xc')](_0xa784('0x5c'),_0xa784('0x68'));emit(util[_0xa784('0x2b')](_0xa784('0x69'),_0x10fcf7[_0xa784('0xe')]),_0xa784('0x6a'),{'uri':_0x5b852f});})[_0xa784('0x6b')](function(_0x4b386a){logger[_0xa784('0x6c')](_0xa784('0x5c'),JSON[_0xa784('0x21')](_0x4b386a));});};exports[_0xa784('0x6d')]=function(_0x3d1618,_0x2ea54d,_0x24e4ba,_0x162279,_0x1fa337,_0x4ac896,_0x3a34eb){var _0x2ecd44,_0x5c45cf,_0x215440,_0x5a7ca5;_0x4ac896[_0xa784('0x57')]=intUtil[_0xa784('0x58')](_0x4ac896[_0xa784('0x57')]);_0x4ac896[_0xa784('0x59')]=intUtil[_0xa784('0x58')](_0x4ac896[_0xa784('0x59')]);def[_0xa784('0x5a')]=util[_0xa784('0x2b')](_0xa784('0x5b'),_0x4ac896[_0xa784('0x57')]);if(_0x3a34eb&&_0x3a34eb['recordingFormat']&&_0x3a34eb['recordingFormat']!=='none'){logger[_0xa784('0xc')](_0xa784('0x6e'),'Recording\x20is\x20enabled!');_0x2ea54d[_0xa784('0x5d')]=util[_0xa784('0x2b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4ac896['serverUrl'],_0x2ea54d['uniqueid'],md5(_0x2ea54d[_0xa784('0x5f')]));}return getConnection(_0x4ac896)[_0xa784('0x2e')](function(_0x5d0626){_0x5a7ca5=_0x5d0626;return getUser(_0x4ac896,_0x162279[_0xa784('0xe')],_0x5a7ca5);})[_0xa784('0x2e')](function(_0x4df1a2){_0x2ecd44=_0x4df1a2;logger[_0xa784('0xc')](_0xa784('0x60'),_0x2ecd44['id']);return getEndUser(_0x4ac896,_0x2ea54d[_0xa784('0x6f')],_0x2ea54d[_0xa784('0x70')],_0x5a7ca5);})[_0xa784('0x2e')](function(_0x278e1b){_0x5c45cf=_0x278e1b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5c45cf['id']);return getTicket(_0x4ac896,_0x2ecd44,_0x5c45cf,_0x24e4ba,_0x2ea54d,_0x24e4ba[_0xa784('0x71')],_0x5a7ca5,_0xa784('0x72'));})[_0xa784('0x2e')](function(_0x37d764){_0x215440=_0x37d764;logger['info']('Ticket\x20created!');logger['info'](_0xa784('0x73'),_0x215440['id']);return setRelationship(_0x5a7ca5,_0x2ecd44,_0x215440,_0xa784('0x64'));})[_0xa784('0x2e')](function(){return setRelationship(_0x5a7ca5,_0x5c45cf,_0x215440,_0xa784('0x74'));})[_0xa784('0x2e')](function(){return getServerInfo(_0x5a7ca5);})[_0xa784('0x2e')](function(_0x2287d4){var _0x5bcd50=parseInt(_0x2287d4[_0xa784('0x65')][_0xa784('0x66')](0x0));var _0x87e291=util[_0xa784('0x2b')](_0xa784('0x67'),_0x4ac896[_0xa784('0x57')],_0x215440['id']);if(_0x5bcd50>0x6){_0x87e291=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4ac896[_0xa784('0x57')],_0x215440['id']);}logger[_0xa784('0xc')](_0xa784('0x6e'),_0xa784('0x68'));emit(util['format'](_0xa784('0x69'),_0x162279[_0xa784('0xe')]),_0xa784('0x6a'),{'uri':_0x87e291});})[_0xa784('0x6b')](function(_0x352512){logger[_0xa784('0x6c')]('[OUTBOUND]',JSON[_0xa784('0x21')](_0x352512));});};exports[_0xa784('0x75')]=function(_0x37195e,_0x2545e1,_0x108b19,_0x51d217,_0x402118,_0x132831){var _0x2072e5,_0x3e1951,_0x3b1a13,_0x400d39;_0x132831[_0xa784('0x57')]=intUtil[_0xa784('0x58')](_0x132831['remoteUri']);_0x132831[_0xa784('0x59')]=intUtil[_0xa784('0x58')](_0x132831[_0xa784('0x59')]);def[_0xa784('0x5a')]=util[_0xa784('0x2b')](_0xa784('0x5b'),_0x132831[_0xa784('0x57')]);if(_0x402118&&_0x402118[_0xa784('0x76')]){logger['info']('['+_0x2545e1[_0xa784('0x77')][_0xa784('0x78')]()+']',_0xa784('0x79'));_0x2545e1[_0xa784('0x5d')]=util[_0xa784('0x2b')](_0xa784('0x5e'),_0x132831[_0xa784('0x59')],_0x2545e1[_0xa784('0x5f')],md5(_0x2545e1[_0xa784('0x5f')]));}else{_0x2545e1['recordingURL']='';}return getConnection(_0x132831)['then'](function(_0x5c59f3){_0x400d39=_0x5c59f3;if(!_[_0xa784('0x27')](_0x51d217)){return getUser(_0x132831,_0x51d217[_0xa784('0xe')],_0x400d39);}else{return getUser(_0x132831,null,_0x400d39);}})[_0xa784('0x2e')](function(_0x495215){_0x2072e5=_0x495215;logger[_0xa784('0xc')](_0xa784('0x60'),_0x2072e5['id']);return getEndUser(_0x132831,_0x2545e1[_0xa784('0x61')],_0x2545e1['calleridnum'],_0x400d39);})[_0xa784('0x2e')](function(_0x5b977d){_0x3e1951=_0x5b977d;logger[_0xa784('0xc')](_0xa784('0x7a'),_0x3e1951['id']);return getTicket(_0x132831,_0x2072e5,_0x3e1951,_0x108b19,_0x2545e1,_0x108b19['Fields'],_0x400d39,_0xa784('0x62'));})['then'](function(_0x574b01){_0x3b1a13=_0x574b01;logger['info']('Ticket\x20created!');logger[_0xa784('0xc')](_0xa784('0x73'),_0x3b1a13['id']);return setRelationship(_0x400d39,_0x2072e5,_0x3b1a13,'users');})[_0xa784('0x2e')](function(){return setRelationship(_0x400d39,_0x3e1951,_0x3b1a13,_0xa784('0x74'));})[_0xa784('0x2e')](function(){return getServerInfo(_0x400d39);})[_0xa784('0x6b')](function(_0x404bd){logger['error']('['+_0x2545e1[_0xa784('0x77')][_0xa784('0x78')]()+']',JSON['stringify'](_0x404bd));});}; \ 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 3b5fdb1..5c9ad82 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 _0xf17c=['slice','substring','validateEmail','isNil','test','lodash','util','getString','sortBy','length','string','content','type','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','keyContent','format','%s:\x20%s','join','stripTrailingSlash'];(function(_0x1dc580,_0x5ebbcf){var _0x52b69b=function(_0x3ad2fd){while(--_0x3ad2fd){_0x1dc580['push'](_0x1dc580['shift']());}};_0x52b69b(++_0x5ebbcf);}(_0xf17c,0xb3));var _0xcf17=function(_0x31a47b,_0x23a044){_0x31a47b=_0x31a47b-0x0;var _0x3808f8=_0xf17c[_0x31a47b];return _0x3808f8;};'use strict';var _=require(_0xcf17('0x0'));var util=require(_0xcf17('0x1'));exports[_0xcf17('0x2')]=function(_0x5514e5,_0x4122ed,_0x13c7d8){var _0x46c199=[];if(_0x5514e5['length']>0x0){var _0xbd4ca7=_[_0xcf17('0x3')](_0x5514e5,['id']);for(var _0x48e773=0x0;_0x48e773<_0xbd4ca7[_0xcf17('0x4')];_0x48e773++){var _0xda06ea=_0xbd4ca7[_0x48e773];if(_0xda06ea['type']===_0xcf17('0x5')){_0x46c199['push'](_0xda06ea[_0xcf17('0x6')]);}else if(_0xda06ea[_0xcf17('0x7')]===_0xcf17('0x8')&&_0xda06ea['variableName']){_0x4122ed[_0xda06ea[_0xcf17('0x9')]]&&_0x46c199[_0xcf17('0xa')](_0x4122ed[_0xda06ea['variableName']][_0xcf17('0xb')]());}else if(_0xda06ea[_0xcf17('0x7')]===_0xcf17('0xc')&&_0xda06ea[_0xcf17('0xd')]&&_0xda06ea[_0xcf17('0xd')][_0xcf17('0xe')]){_0x4122ed[_0xda06ea[_0xcf17('0xd')][_0xcf17('0xe')]['toLowerCase']()]&&_0x46c199[_0xcf17('0xa')](_0x4122ed[_0xda06ea[_0xcf17('0xd')]['name'][_0xcf17('0xf')]()][_0xcf17('0xb')]());}else if(_0xda06ea['type']===_0xcf17('0x10')){if(_0xda06ea[_0xcf17('0x11')]===_0xcf17('0x5')&&_0xda06ea[_0xcf17('0x12')]){_0x46c199[_0xcf17('0xa')](util['format']('%s:\x20%s',_0xda06ea[_0xcf17('0x12')],_0xda06ea[_0xcf17('0x13')]));}else if(_0xda06ea[_0xcf17('0x11')]===_0xcf17('0x8')&&_0xda06ea[_0xcf17('0x9')]&&_0xda06ea['key']){_0x4122ed[_0xda06ea[_0xcf17('0x9')]]&&_0x46c199['push'](util[_0xcf17('0x14')](_0xcf17('0x15'),_0xda06ea['key'],_0x4122ed[_0xda06ea[_0xcf17('0x9')]]));}else if(_0xda06ea[_0xcf17('0x11')]===_0xcf17('0xc')&&_0xda06ea[_0xcf17('0xd')]&&_0xda06ea[_0xcf17('0xd')]['name']&&_0xda06ea[_0xcf17('0x12')]){_0x4122ed[_0xda06ea[_0xcf17('0xd')]['name']['toLowerCase']()]&&_0x46c199['push'](util[_0xcf17('0x14')](_0xcf17('0x15'),_0xda06ea[_0xcf17('0x12')],_0x4122ed[_0xda06ea[_0xcf17('0xd')]['name'][_0xcf17('0xf')]()]));}}}}return _0x46c199[_0xcf17('0x16')](_0x13c7d8);};exports[_0xcf17('0x17')]=function(_0x27fa45){var _0xe9343f=_0x27fa45[_0xcf17('0x18')](-0x1);if(_0xe9343f==='/'){_0x27fa45=_0x27fa45[_0xcf17('0x19')](0x0,_0x27fa45['lastIndexOf'](_0xe9343f));}return _0x27fa45;};exports[_0xcf17('0x1a')]=function(_0x4e4fa6){if(!_[_0xcf17('0x1b')](_0x4e4fa6)&&_0x4e4fa6!==''){var _0x53fe73=/^(([^<>()\[\]\\.,;:\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 _0x53fe73[_0xcf17('0x1c')](String(_0x4e4fa6)[_0xcf17('0xf')]());}else{return![];}}; \ No newline at end of file +var _0xe194=['%s:\x20%s','key','keyContent','join','stripTrailingSlash','lastIndexOf','validateEmail','test','util','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','format'];(function(_0x4c0801,_0x30b733){var _0xa7e28b=function(_0x25c8a4){while(--_0x25c8a4){_0x4c0801['push'](_0x4c0801['shift']());}};_0xa7e28b(++_0x30b733);}(_0xe194,0x85));var _0x4e19=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0xe194[_0x2b0bc2];return _0x56e5b9;};'use strict';var _=require('lodash');var util=require(_0x4e19('0x0'));exports['getString']=function(_0x58a8ef,_0x3b7523,_0x54a11b){var _0x303416=[];if(_0x58a8ef[_0x4e19('0x1')]>0x0){var _0x5856e9=_[_0x4e19('0x2')](_0x58a8ef,['id']);for(var _0x54a9d9=0x0;_0x54a9d9<_0x5856e9['length'];_0x54a9d9++){var _0x3bc9de=_0x5856e9[_0x54a9d9];if(_0x3bc9de[_0x4e19('0x3')]===_0x4e19('0x4')){_0x303416[_0x4e19('0x5')](_0x3bc9de[_0x4e19('0x6')]);}else if(_0x3bc9de[_0x4e19('0x3')]===_0x4e19('0x7')&&_0x3bc9de[_0x4e19('0x8')]){_0x3b7523[_0x3bc9de[_0x4e19('0x8')]]&&_0x303416[_0x4e19('0x5')](_0x3b7523[_0x3bc9de[_0x4e19('0x8')]][_0x4e19('0x9')]());}else if(_0x3bc9de[_0x4e19('0x3')]===_0x4e19('0xa')&&_0x3bc9de[_0x4e19('0xb')]&&_0x3bc9de[_0x4e19('0xb')][_0x4e19('0xc')]){_0x3b7523[_0x3bc9de[_0x4e19('0xb')]['name'][_0x4e19('0xd')]()]&&_0x303416['push'](_0x3b7523[_0x3bc9de[_0x4e19('0xb')]['name']['toLowerCase']()][_0x4e19('0x9')]());}else if(_0x3bc9de['type']===_0x4e19('0xe')){if(_0x3bc9de[_0x4e19('0xf')]===_0x4e19('0x4')&&_0x3bc9de['key']){_0x303416[_0x4e19('0x5')](util[_0x4e19('0x10')](_0x4e19('0x11'),_0x3bc9de[_0x4e19('0x12')],_0x3bc9de[_0x4e19('0x13')]));}else if(_0x3bc9de[_0x4e19('0xf')]===_0x4e19('0x7')&&_0x3bc9de[_0x4e19('0x8')]&&_0x3bc9de[_0x4e19('0x12')]){_0x3b7523[_0x3bc9de['variableName']]&&_0x303416[_0x4e19('0x5')](util[_0x4e19('0x10')](_0x4e19('0x11'),_0x3bc9de['key'],_0x3b7523[_0x3bc9de['variableName']]));}else if(_0x3bc9de['keyType']===_0x4e19('0xa')&&_0x3bc9de[_0x4e19('0xb')]&&_0x3bc9de[_0x4e19('0xb')][_0x4e19('0xc')]&&_0x3bc9de[_0x4e19('0x12')]){_0x3b7523[_0x3bc9de[_0x4e19('0xb')][_0x4e19('0xc')][_0x4e19('0xd')]()]&&_0x303416[_0x4e19('0x5')](util[_0x4e19('0x10')](_0x4e19('0x11'),_0x3bc9de['key'],_0x3b7523[_0x3bc9de['Variable'][_0x4e19('0xc')]['toLowerCase']()]));}}}}return _0x303416[_0x4e19('0x14')](_0x54a11b);};exports[_0x4e19('0x15')]=function(_0x2eb440){var _0x58aa33=_0x2eb440['slice'](-0x1);if(_0x58aa33==='/'){_0x2eb440=_0x2eb440['substring'](0x0,_0x2eb440[_0x4e19('0x16')](_0x58aa33));}return _0x2eb440;};exports[_0x4e19('0x17')]=function(_0x253992){if(!_['isNil'](_0x253992)&&_0x253992!==''){var _0x48ed47=/^(([^<>()\[\]\\.,;:\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 _0x48ed47[_0x4e19('0x18')](String(_0x253992)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index a5bca98..f5a1cd7 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 _0x3e41=['ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','defaults','redis','emit','length','includes','picklist','idField','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','create','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','remoteUri','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','getEndUser','accessKey','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','outbound','stripTrailingSlash','serverUrl','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','lastevent','toUpperCase','recordingURL','lodash','request-promise','bluebird','md5','util'];(function(_0x1b3115,_0xd3aa16){var _0x544296=function(_0x301c7a){while(--_0x301c7a){_0x1b3115['push'](_0x1b3115['shift']());}};_0x544296(++_0xd3aa16);}(_0x3e41,0x67));var _0x13e4=function(_0x485eb8,_0x171720){_0x485eb8=_0x485eb8-0x0;var _0x55dfcb=_0x3e41[_0x485eb8];return _0x55dfcb;};'use strict';var _=require(_0x13e4('0x0'));var rp=require(_0x13e4('0x1'));var BPromise=require(_0x13e4('0x2'));var md5=require(_0x13e4('0x3'));var util=require(_0x13e4('0x4'));var Redis=require(_0x13e4('0x5'));var intUtil=require(_0x13e4('0x6'));var config=require(_0x13e4('0x7'));var logger=require(_0x13e4('0x8'))(_0x13e4('0x9'));config['redis']=_[_0x13e4('0xa')](config[_0x13e4('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x2aeb29,_0x2070c6,_0x571d59){io['to'](_0x2aeb29)[_0x13e4('0xc')](_0x2070c6,_0x571d59);}function getCustomFields(_0xbafc04,_0x4eb14e){var _0x1b7b4d={};if(_0xbafc04[_0x13e4('0xd')]>0x0){_['forEach'](_0xbafc04,function(_0x168c8b){if(_[_0x13e4('0xe')](['string',_0x13e4('0xf')],_0x168c8b['type'])&&_0x168c8b['idField']){_0x1b7b4d[_0x168c8b[_0x13e4('0x10')]]=_0x168c8b['content'][_0x13e4('0x11')]();}else if(_0x168c8b[_0x13e4('0x12')]===_0x13e4('0x13')&&_0x168c8b[_0x13e4('0x14')]&&_0x168c8b[_0x13e4('0x10')]&&_0x4eb14e[_0x168c8b[_0x13e4('0x14')]]){_0x1b7b4d[_0x168c8b['idField']]=_0x4eb14e[_0x168c8b['variableName']][_0x13e4('0x11')]();}else if(_0x168c8b[_0x13e4('0x12')]===_0x13e4('0x15')&&_0x168c8b[_0x13e4('0x16')]&&_0x168c8b[_0x13e4('0x16')][_0x13e4('0x17')]&&_0x168c8b[_0x13e4('0x10')]&&_0x4eb14e[_0x168c8b[_0x13e4('0x16')][_0x13e4('0x17')][_0x13e4('0x18')]()]){_0x1b7b4d[_0x168c8b[_0x13e4('0x10')]]=_0x4eb14e[_0x168c8b['Variable'][_0x13e4('0x17')][_0x13e4('0x18')]()][_0x13e4('0x11')]();}});}return _0x1b7b4d;}function createTicket(_0x3a101f,_0x329be9,_0x37639c,_0x34c1ab,_0x13823b,_0x4d4249,_0x5cee8f){logger[_0x13e4('0x19')](_0x13e4('0x1a'));var _0x5235e9=_[_0x13e4('0x1b')]({'parent_id':'','assigned_user_id':_0x329be9['id'],'ticketpriorities':_0x13e4('0x1c'),'ticketstatus':_0x13e4('0x1d'),'ticket_title':intUtil[_0x13e4('0x1e')](_0x34c1ab[_0x13e4('0x1f')],_0x13823b,'\x20'),'description':intUtil[_0x13e4('0x1e')](_0x34c1ab[_0x13e4('0x20')],_0x13823b,'\x0a'),'contact_id':_0x37639c['id']},getCustomFields(_0x4d4249,_0x13823b));var _0x2ff076={'method':_0x13e4('0x21'),'uri':util[_0x13e4('0x22')]('%s/webservice.php',_0x3a101f['remoteUri']),'form':{'operation':_0x13e4('0x23'),'username':_0x3a101f['username'],'sessionName':_0x5cee8f[_0x13e4('0x24')],'elementType':_0x13e4('0x25'),'element':JSON[_0x13e4('0x26')](_0x5235e9)},'json':!![]};return request(_0x2ff076)[_0x13e4('0x27')](function(_0x44c390){if(_0x44c390[_0x13e4('0x28')]){return BPromise[_0x13e4('0x29')]({'id':_0x44c390[_0x13e4('0x2a')]['id']});}else{throw new Error(util[_0x13e4('0x22')](_0x13e4('0x2b'),JSON[_0x13e4('0x26')](_0x44c390[_0x13e4('0x2c')])));}})[_0x13e4('0x2d')](function(_0x3fab54){var _0x9e6dc1=_0x3fab54[_0x13e4('0x2e')]||0x1f4;logger['error'](_0x13e4('0x2f'),_0x13e4('0x30'),_0x9e6dc1,JSON[_0x13e4('0x26')](_0x3fab54));});}function getUser(_0x130d7d,_0x21559e,_0x7206c2){if(intUtil[_0x13e4('0x31')](_0x21559e)){logger[_0x13e4('0x19')](_0x13e4('0x32'),_0x21559e);return request({'method':_0x13e4('0x33'),'uri':util[_0x13e4('0x22')](_0x13e4('0x34'),_0x130d7d['remoteUri']),'qs':{'operation':_0x13e4('0x35'),'username':_0x130d7d[_0x13e4('0x36')],'sessionName':_0x7206c2['sessionName'],'query':util[_0x13e4('0x22')](_0x13e4('0x37'),_0x21559e)},'json':!![]})[_0x13e4('0x27')](function(_0x5daa21){if(_0x5daa21[_0x13e4('0x28')]&&_0x5daa21['result'][_0x13e4('0xd')]){logger[_0x13e4('0x19')](_0x13e4('0x38'));return BPromise[_0x13e4('0x29')]({'id':_0x5daa21[_0x13e4('0x2a')][0x0]['id'],'email':_0x5daa21[_0x13e4('0x2a')][0x0][_0x13e4('0x39')],'name':_0x5daa21[_0x13e4('0x2a')][0x0][_0x13e4('0x3a')]+'\x20'+_0x5daa21[_0x13e4('0x2a')][_0x13e4('0x3b')]});}else{logger[_0x13e4('0x19')](_0x13e4('0x3c'));return BPromise[_0x13e4('0x29')]({'id':_0x7206c2[_0x13e4('0x3d')],'email':_0x130d7d[_0x13e4('0x36')],'name':'admin'});}})[_0x13e4('0x2d')](function(_0x48898e){var _0x39743f=_0x48898e[_0x13e4('0x2e')]||0x1f4;logger['error'](_0x13e4('0x2f'),_0x13e4('0x3e'),_0x39743f,JSON[_0x13e4('0x26')](_0x48898e));});}else{logger[_0x13e4('0x19')](_0x13e4('0x3c'));return BPromise['resolve']({'id':_0x7206c2[_0x13e4('0x3d')],'email':_0x130d7d[_0x13e4('0x36')],'name':_0x13e4('0x3f')})[_0x13e4('0x2d')](function(_0x57404e){var _0x23b55a=_0x57404e['statusCode']||0x1f4;logger[_0x13e4('0x2c')](_0x13e4('0x2f'),_0x13e4('0x3e'),_0x23b55a,JSON[_0x13e4('0x26')](_0x57404e));});}}function getEndUser(_0x6ec76f,_0xf36683,_0x558319,_0x29b884){logger[_0x13e4('0x19')](_0x13e4('0x40'),_0x558319);return request({'method':_0x13e4('0x33'),'uri':util[_0x13e4('0x22')](_0x13e4('0x34'),_0x6ec76f[_0x13e4('0x41')]),'qs':{'operation':_0x13e4('0x35'),'username':_0x6ec76f[_0x13e4('0x36')],'sessionName':_0x29b884[_0x13e4('0x24')],'query':util[_0x13e4('0x22')]('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;',_0x558319,_0x558319,_0x558319,_0x558319,_0x558319)},'json':!![]})[_0x13e4('0x27')](function(_0x585999){if(_0x585999['success']&&_0x585999[_0x13e4('0x2a')]['length']){logger[_0x13e4('0x19')](_0x13e4('0x42'));return BPromise['resolve']({'id':_0x585999[_0x13e4('0x2a')][0x0]['id'],'name':_0x585999[_0x13e4('0x2a')][0x0][_0x13e4('0x43')]+'\x20'+_0x585999[_0x13e4('0x2a')][0x0][_0x13e4('0x44')],'phone':_0x558319});}else{logger[_0x13e4('0x19')](_0x13e4('0x45'));return request({'method':'POST','uri':util[_0x13e4('0x22')](_0x13e4('0x34'),_0x6ec76f[_0x13e4('0x41')]),'form':{'operation':_0x13e4('0x23'),'sessionName':_0x29b884[_0x13e4('0x24')],'elementType':_0x13e4('0x46'),'element':JSON[_0x13e4('0x26')]({'lastname':_0xf36683,'phone':_0x558319,'assigned_user_id':'\x20'})},'json':!![]})[_0x13e4('0x27')](function(_0x4a1d0a){logger[_0x13e4('0x19')]('Enduser\x20created.');return BPromise[_0x13e4('0x29')]({'id':_0x4a1d0a[_0x13e4('0x2a')]['id'],'name':_0x4a1d0a[_0x13e4('0x2a')][_0x13e4('0x44')],'phone':_0x4a1d0a[_0x13e4('0x2a')][_0x13e4('0x47')]});})[_0x13e4('0x2d')](function(_0x3efc5f){var _0x201825=_0x3efc5f[_0x13e4('0x2e')]||0x1f4;logger[_0x13e4('0x2c')](_0x13e4('0x2f'),_0x13e4('0x48'),_0x201825,JSON['stringify'](_0x3efc5f));});}});}function getConnection(_0x5f762f){var _0x585f85=_0x5f762f[_0x13e4('0x36')];var _0x1aedb5=_0x5f762f[_0x13e4('0x49')];return request({'method':_0x13e4('0x33'),'uri':util[_0x13e4('0x22')](_0x13e4('0x34'),_0x5f762f[_0x13e4('0x41')]),'qs':{'operation':_0x13e4('0x4a'),'username':_0x585f85},'json':!![]})[_0x13e4('0x27')](function(_0x326b36){if(_0x326b36[_0x13e4('0x28')]){return request({'method':'POST','uri':util[_0x13e4('0x22')](_0x13e4('0x34'),_0x5f762f[_0x13e4('0x41')]),'form':{'operation':_0x13e4('0x4b'),'username':_0x585f85,'accessKey':md5(_0x326b36[_0x13e4('0x2a')]['token']+_0x1aedb5)},'json':!![]});}})[_0x13e4('0x27')](function(_0xcd2baa){if(_0xcd2baa['success']){return BPromise['resolve'](_0xcd2baa['result']);}else{throw new Error(util[_0x13e4('0x22')](_0x13e4('0x4c'),_0x5f762f['id']));}})['catch'](function(_0xe2c9b8){var _0x2215d5=_0xe2c9b8[_0x13e4('0x2e')]||0x1f4;logger[_0x13e4('0x2c')](_0x13e4('0x2f'),_0x13e4('0x4d'),_0x2215d5,JSON[_0x13e4('0x26')](_0xe2c9b8));});}function request(_0x450a0f){logger[_0x13e4('0x19')](_0x13e4('0x4e'),JSON[_0x13e4('0x26')](_0x450a0f));return rp(_0x450a0f);}exports[_0x13e4('0x4f')]=function(_0x5a04f2,_0x273466,_0xa444ca,_0x555f8e,_0xd173b1,_0x4cb265){var _0x50b687,_0x2b8703,_0x11fc4e,_0x9622d4;_0x4cb265['remoteUri']=intUtil['stripTrailingSlash'](_0x4cb265[_0x13e4('0x41')]);if(_0xd173b1&&_0xd173b1[_0x13e4('0x50')]){logger[_0x13e4('0x19')](_0x13e4('0x51'),_0x13e4('0x52'));_0x273466['recordingURL']=util[_0x13e4('0x22')](_0x13e4('0x53'),_0x4cb265['serverUrl'],_0x273466[_0x13e4('0x54')],md5(_0x273466[_0x13e4('0x54')]));}else{_0x273466['recordingURL']='';}return getConnection(_0x4cb265)[_0x13e4('0x27')](function(_0x3479e4){_0x9622d4=_0x3479e4;return getUser(_0x4cb265,_0x555f8e[_0x13e4('0x55')],_0x9622d4);})[_0x13e4('0x27')](function(_0x25644f){_0x50b687=_0x25644f;logger['info'](_0x13e4('0x56'),_0x50b687['id']);return getEndUser(_0x4cb265,_0x273466[_0x13e4('0x57')],_0x273466[_0x13e4('0x58')],_0x9622d4);})[_0x13e4('0x27')](function(_0x24d4c1){_0x2b8703=_0x24d4c1;logger[_0x13e4('0x19')](_0x13e4('0x59'),_0x2b8703['id']);return createTicket(_0x4cb265,_0x50b687,_0x2b8703,_0xa444ca,_0x273466,_0xa444ca[_0x13e4('0x5a')],_0x9622d4);})[_0x13e4('0x27')](function(_0x5f4283){_0x11fc4e=_0x5f4283;logger[_0x13e4('0x19')]('Ticket\x20created!');logger[_0x13e4('0x19')]('The\x20Ticket\x20ID\x20is:',_0x11fc4e['id']);var _0x543d37=util[_0x13e4('0x22')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4cb265[_0x13e4('0x41')],_[_0x13e4('0x5b')](_0x11fc4e['id'],'x')[0x1]);logger[_0x13e4('0x19')](_0x13e4('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x13e4('0x22')]('user:%s',_0x555f8e['name']),_0x13e4('0x5c'),{'uri':_0x543d37});})['catch'](function(_0x32bd36){logger[_0x13e4('0x2c')]('[QUEUE]',JSON['stringify'](_0x32bd36));});};exports[_0x13e4('0x5d')]=function(_0x812025,_0x50f55b,_0x3f5b0e,_0x5328a8,_0x222ec4,_0x49db95,_0x401ec2){var _0x5ec88b,_0x1c94ce,_0x1e1b22,_0x340bc0;_0x49db95[_0x13e4('0x41')]=intUtil[_0x13e4('0x5e')](_0x49db95[_0x13e4('0x41')]);_0x49db95[_0x13e4('0x5f')]=intUtil[_0x13e4('0x5e')](_0x49db95[_0x13e4('0x5f')]);if(_0x401ec2&&_0x401ec2[_0x13e4('0x60')]&&_0x401ec2['recordingFormat']!=='none'){logger[_0x13e4('0x19')](_0x13e4('0x61'),_0x13e4('0x52'));_0x50f55b['recordingURL']=util[_0x13e4('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49db95['serverUrl'],_0x50f55b[_0x13e4('0x54')],md5(_0x50f55b[_0x13e4('0x54')]));}return getConnection(_0x49db95)[_0x13e4('0x27')](function(_0x57eabb){_0x340bc0=_0x57eabb;return getUser(_0x49db95,_0x5328a8[_0x13e4('0x55')],_0x340bc0);})['then'](function(_0x4b8d29){_0x5ec88b=_0x4b8d29;logger[_0x13e4('0x19')](_0x13e4('0x56'),_0x5ec88b['id']);return getEndUser(_0x49db95,_0x50f55b[_0x13e4('0x62')],_0x50f55b[_0x13e4('0x63')],_0x340bc0);})[_0x13e4('0x27')](function(_0x4a0a57){_0x1c94ce=_0x4a0a57;logger[_0x13e4('0x19')](_0x13e4('0x59'),_0x1c94ce['id']);return createTicket(_0x49db95,_0x5ec88b,_0x1c94ce,_0x3f5b0e,_0x50f55b,_0x3f5b0e['Fields'],_0x340bc0);})[_0x13e4('0x27')](function(_0x3283b7){_0x1e1b22=_0x3283b7;logger[_0x13e4('0x19')](_0x13e4('0x64'));logger[_0x13e4('0x19')](_0x13e4('0x65'),_0x1e1b22['id']);var _0x5e9def=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x49db95[_0x13e4('0x41')],_[_0x13e4('0x5b')](_0x1e1b22['id'],'x')[0x1]);logger[_0x13e4('0x19')]('[OUTBOUND]',_0x13e4('0x66'));emit(util['format'](_0x13e4('0x67'),_0x5328a8[_0x13e4('0x17')]),_0x13e4('0x5c'),{'uri':_0x5e9def});})[_0x13e4('0x2d')](function(_0x4e0033){logger[_0x13e4('0x2c')](_0x13e4('0x61'),JSON[_0x13e4('0x26')](_0x4e0033));});};exports[_0x13e4('0x68')]=function(_0x5624bd,_0x2aa4a3,_0x3ae90d,_0x300d01,_0x4f3a7f,_0x3c1a02){var _0x2ce2fb,_0x6093e2,_0x56fa78,_0x3b3612;_0x3c1a02[_0x13e4('0x41')]=intUtil['stripTrailingSlash'](_0x3c1a02[_0x13e4('0x41')]);_0x3c1a02[_0x13e4('0x5f')]=intUtil[_0x13e4('0x5e')](_0x3c1a02['serverUrl']);if(_0x4f3a7f&&_0x4f3a7f[_0x13e4('0x50')]){logger[_0x13e4('0x19')]('['+_0x2aa4a3[_0x13e4('0x69')][_0x13e4('0x6a')]()+']',_0x13e4('0x52'));_0x2aa4a3[_0x13e4('0x6b')]=util['format'](_0x13e4('0x53'),_0x3c1a02[_0x13e4('0x5f')],_0x2aa4a3[_0x13e4('0x54')],md5(_0x2aa4a3[_0x13e4('0x54')]));}else{_0x2aa4a3[_0x13e4('0x6b')]='';}return getConnection(_0x3c1a02)['then'](function(_0x2686e3){_0x3b3612=_0x2686e3;return getUser(_0x3c1a02,'',_0x3b3612);})[_0x13e4('0x27')](function(_0x288851){_0x2ce2fb=_0x288851;logger[_0x13e4('0x19')](_0x13e4('0x56'),_0x2ce2fb['id']);return getEndUser(_0x3c1a02,_0x2aa4a3[_0x13e4('0x57')],_0x2aa4a3[_0x13e4('0x58')],_0x3b3612);})[_0x13e4('0x27')](function(_0x3f3f3e){_0x6093e2=_0x3f3f3e;logger['info'](_0x13e4('0x59'),_0x6093e2['id']);return createTicket(_0x3c1a02,_0x2ce2fb,_0x6093e2,_0x3ae90d,_0x2aa4a3,_0x3ae90d[_0x13e4('0x5a')],_0x3b3612);})[_0x13e4('0x27')](function(_0x44eaf5){_0x56fa78=_0x44eaf5;logger[_0x13e4('0x19')]('Ticket\x20created!');logger[_0x13e4('0x19')]('The\x20Ticket\x20ID\x20is:',_0x56fa78['id']);})['catch'](function(_0x8c90d4){logger[_0x13e4('0x2c')]('['+_0x2aa4a3['lastevent'][_0x13e4('0x6a')]()+']',JSON['stringify'](_0x8c90d4));});}; \ No newline at end of file +var _0x4bd3=['merge','Open','getString','Subjects','Descriptions','remoteUri','username','sessionName','HelpDesk','then','success','resolve','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','Getting\x20agent\x20with\x20email','%s/webservice.php','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','statusCode','getUser','GET','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!','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Contacts','Enduser\x20created.','phone','getEndUser','login','token','Account\x20%d\x20is\x20not\x20valid','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','Ticket\x20created!','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','bluebird','md5','../../../../config/environment','../../../../config/logger','vTiger','defaults','redis','socket.io-emitter','emit','forEach','includes','string','idField','toString','type','variable','variableName','customVariable','name','Variable','toLowerCase','info','Creating\x20new\x20ticket...'];(function(_0x3050ca,_0x3e36b0){var _0x1eed1d=function(_0x195e8f){while(--_0x195e8f){_0x3050ca['push'](_0x3050ca['shift']());}};_0x1eed1d(++_0x3e36b0);}(_0x4bd3,0x174));var _0x34bd=function(_0x944806,_0x184354){_0x944806=_0x944806-0x0;var _0x5b503e=_0x4bd3[_0x944806];return _0x5b503e;};'use strict';var _=require(_0x34bd('0x0'));var rp=require('request-promise');var BPromise=require(_0x34bd('0x1'));var md5=require(_0x34bd('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x34bd('0x3'));var logger=require(_0x34bd('0x4'))(_0x34bd('0x5'));config['redis']=_[_0x34bd('0x6')](config[_0x34bd('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x34bd('0x8'))(new Redis(config[_0x34bd('0x7')]));function emit(_0x51a4d7,_0xd600e1,_0x76de8d){io['to'](_0x51a4d7)[_0x34bd('0x9')](_0xd600e1,_0x76de8d);}function getCustomFields(_0xed6181,_0x1ac77f){var _0x36a463={};if(_0xed6181['length']>0x0){_[_0x34bd('0xa')](_0xed6181,function(_0x45322f){if(_[_0x34bd('0xb')]([_0x34bd('0xc'),'picklist'],_0x45322f['type'])&&_0x45322f[_0x34bd('0xd')]){_0x36a463[_0x45322f['idField']]=_0x45322f['content'][_0x34bd('0xe')]();}else if(_0x45322f[_0x34bd('0xf')]===_0x34bd('0x10')&&_0x45322f[_0x34bd('0x11')]&&_0x45322f[_0x34bd('0xd')]&&_0x1ac77f[_0x45322f[_0x34bd('0x11')]]){_0x36a463[_0x45322f[_0x34bd('0xd')]]=_0x1ac77f[_0x45322f[_0x34bd('0x11')]][_0x34bd('0xe')]();}else if(_0x45322f['type']===_0x34bd('0x12')&&_0x45322f['Variable']&&_0x45322f['Variable'][_0x34bd('0x13')]&&_0x45322f[_0x34bd('0xd')]&&_0x1ac77f[_0x45322f[_0x34bd('0x14')][_0x34bd('0x13')][_0x34bd('0x15')]()]){_0x36a463[_0x45322f[_0x34bd('0xd')]]=_0x1ac77f[_0x45322f[_0x34bd('0x14')][_0x34bd('0x13')][_0x34bd('0x15')]()][_0x34bd('0xe')]();}});}return _0x36a463;}function createTicket(_0x4b5ebb,_0x48d2ba,_0x10b977,_0x324f7d,_0x265e70,_0x220666,_0x3976e4){logger[_0x34bd('0x16')](_0x34bd('0x17'));var _0x3d5f76=_[_0x34bd('0x18')]({'parent_id':'','assigned_user_id':_0x48d2ba['id'],'ticketpriorities':'Normal','ticketstatus':_0x34bd('0x19'),'ticket_title':intUtil[_0x34bd('0x1a')](_0x324f7d[_0x34bd('0x1b')],_0x265e70,'\x20'),'description':intUtil[_0x34bd('0x1a')](_0x324f7d[_0x34bd('0x1c')],_0x265e70,'\x0a'),'contact_id':_0x10b977['id']},getCustomFields(_0x220666,_0x265e70));var _0x5e0c06={'method':'POST','uri':util['format']('%s/webservice.php',_0x4b5ebb[_0x34bd('0x1d')]),'form':{'operation':'create','username':_0x4b5ebb[_0x34bd('0x1e')],'sessionName':_0x3976e4[_0x34bd('0x1f')],'elementType':_0x34bd('0x20'),'element':JSON['stringify'](_0x3d5f76)},'json':!![]};return request(_0x5e0c06)[_0x34bd('0x21')](function(_0x14479a){if(_0x14479a[_0x34bd('0x22')]){return BPromise[_0x34bd('0x23')]({'id':_0x14479a['result']['id']});}else{throw new Error(util[_0x34bd('0x24')](_0x34bd('0x25'),JSON[_0x34bd('0x26')](_0x14479a[_0x34bd('0x27')])));}})['catch'](function(_0x45b4eb){var _0x3fe8b0=_0x45b4eb['statusCode']||0x1f4;logger[_0x34bd('0x27')](_0x34bd('0x28'),_0x34bd('0x29'),_0x3fe8b0,JSON[_0x34bd('0x26')](_0x45b4eb));});}function getUser(_0x26b8e7,_0x4500c8,_0x177d43){if(intUtil['validateEmail'](_0x4500c8)){logger[_0x34bd('0x16')](_0x34bd('0x2a'),_0x4500c8);return request({'method':'GET','uri':util['format'](_0x34bd('0x2b'),_0x26b8e7[_0x34bd('0x1d')]),'qs':{'operation':_0x34bd('0x2c'),'username':_0x26b8e7['username'],'sessionName':_0x177d43['sessionName'],'query':util[_0x34bd('0x24')](_0x34bd('0x2d'),_0x4500c8)},'json':!![]})[_0x34bd('0x21')](function(_0x19eb5d){if(_0x19eb5d['success']&&_0x19eb5d[_0x34bd('0x2e')][_0x34bd('0x2f')]){logger[_0x34bd('0x16')](_0x34bd('0x30'));return BPromise[_0x34bd('0x23')]({'id':_0x19eb5d[_0x34bd('0x2e')][0x0]['id'],'email':_0x19eb5d['result'][0x0][_0x34bd('0x31')],'name':_0x19eb5d['result'][0x0][_0x34bd('0x32')]+'\x20'+_0x19eb5d[_0x34bd('0x2e')][_0x34bd('0x33')]});}else{logger['info'](_0x34bd('0x34'));return BPromise[_0x34bd('0x23')]({'id':_0x177d43['userId'],'email':_0x26b8e7[_0x34bd('0x1e')],'name':_0x34bd('0x35')});}})[_0x34bd('0x36')](function(_0x4d0a02){var _0x1574c8=_0x4d0a02[_0x34bd('0x37')]||0x1f4;logger['error'](_0x34bd('0x28'),_0x34bd('0x38'),_0x1574c8,JSON[_0x34bd('0x26')](_0x4d0a02));});}else{logger[_0x34bd('0x16')](_0x34bd('0x34'));return BPromise[_0x34bd('0x23')]({'id':_0x177d43['userId'],'email':_0x26b8e7['username'],'name':'admin'})[_0x34bd('0x36')](function(_0x1258cf){var _0x5e30c5=_0x1258cf['statusCode']||0x1f4;logger[_0x34bd('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x5e30c5,JSON[_0x34bd('0x26')](_0x1258cf));});}}function getEndUser(_0xb5a456,_0xa61859,_0xdc3496,_0x2af1af){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0xdc3496);return request({'method':_0x34bd('0x39'),'uri':util['format'](_0x34bd('0x2b'),_0xb5a456[_0x34bd('0x1d')]),'qs':{'operation':_0x34bd('0x2c'),'username':_0xb5a456[_0x34bd('0x1e')],'sessionName':_0x2af1af[_0x34bd('0x1f')],'query':util['format'](_0x34bd('0x3a'),_0xdc3496,_0xdc3496,_0xdc3496,_0xdc3496,_0xdc3496)},'json':!![]})[_0x34bd('0x21')](function(_0x16858c){if(_0x16858c[_0x34bd('0x22')]&&_0x16858c['result'][_0x34bd('0x2f')]){logger['info'](_0x34bd('0x3b'));return BPromise[_0x34bd('0x23')]({'id':_0x16858c['result'][0x0]['id'],'name':_0x16858c[_0x34bd('0x2e')][0x0]['firstname']+'\x20'+_0x16858c[_0x34bd('0x2e')][0x0][_0x34bd('0x3c')],'phone':_0xdc3496});}else{logger[_0x34bd('0x16')](_0x34bd('0x3d'));return request({'method':_0x34bd('0x3e'),'uri':util[_0x34bd('0x24')](_0x34bd('0x2b'),_0xb5a456['remoteUri']),'form':{'operation':'create','sessionName':_0x2af1af['sessionName'],'elementType':_0x34bd('0x3f'),'element':JSON[_0x34bd('0x26')]({'lastname':_0xa61859,'phone':_0xdc3496,'assigned_user_id':'\x20'})},'json':!![]})[_0x34bd('0x21')](function(_0x787f74){logger['info'](_0x34bd('0x40'));return BPromise[_0x34bd('0x23')]({'id':_0x787f74[_0x34bd('0x2e')]['id'],'name':_0x787f74[_0x34bd('0x2e')][_0x34bd('0x3c')],'phone':_0x787f74['result'][_0x34bd('0x41')]});})['catch'](function(_0x589874){var _0x1c637f=_0x589874['statusCode']||0x1f4;logger[_0x34bd('0x27')](_0x34bd('0x28'),_0x34bd('0x42'),_0x1c637f,JSON[_0x34bd('0x26')](_0x589874));});}});}function getConnection(_0x2027ff){var _0x5b061a=_0x2027ff['username'];var _0x33e8e8=_0x2027ff['accessKey'];return request({'method':_0x34bd('0x39'),'uri':util[_0x34bd('0x24')](_0x34bd('0x2b'),_0x2027ff['remoteUri']),'qs':{'operation':'getchallenge','username':_0x5b061a},'json':!![]})['then'](function(_0x5a68f3){if(_0x5a68f3[_0x34bd('0x22')]){return request({'method':'POST','uri':util[_0x34bd('0x24')]('%s/webservice.php',_0x2027ff[_0x34bd('0x1d')]),'form':{'operation':_0x34bd('0x43'),'username':_0x5b061a,'accessKey':md5(_0x5a68f3[_0x34bd('0x2e')][_0x34bd('0x44')]+_0x33e8e8)},'json':!![]});}})[_0x34bd('0x21')](function(_0x5273b1){if(_0x5273b1[_0x34bd('0x22')]){return BPromise[_0x34bd('0x23')](_0x5273b1[_0x34bd('0x2e')]);}else{throw new Error(util[_0x34bd('0x24')](_0x34bd('0x45'),_0x2027ff['id']));}})['catch'](function(_0x14833b){var _0x3bfd9d=_0x14833b['statusCode']||0x1f4;logger[_0x34bd('0x27')](_0x34bd('0x28'),'getConnection',_0x3bfd9d,JSON['stringify'](_0x14833b));});}function request(_0x37ac16){logger['info']('[HTTP]',JSON[_0x34bd('0x26')](_0x37ac16));return rp(_0x37ac16);}exports[_0x34bd('0x46')]=function(_0x556ce8,_0x52d479,_0x56ac18,_0x4f4ce8,_0x1cbf91,_0x43f223){var _0x482a0b,_0x4a8291,_0x5a95f1,_0x477fd4;_0x43f223[_0x34bd('0x1d')]=intUtil['stripTrailingSlash'](_0x43f223[_0x34bd('0x1d')]);if(_0x1cbf91&&_0x1cbf91[_0x34bd('0x47')]){logger[_0x34bd('0x16')](_0x34bd('0x48'),_0x34bd('0x49'));_0x52d479[_0x34bd('0x4a')]=util['format'](_0x34bd('0x4b'),_0x43f223[_0x34bd('0x4c')],_0x52d479[_0x34bd('0x4d')],md5(_0x52d479[_0x34bd('0x4d')]));}else{_0x52d479['recordingURL']='';}return getConnection(_0x43f223)[_0x34bd('0x21')](function(_0x5235e4){_0x477fd4=_0x5235e4;return getUser(_0x43f223,_0x4f4ce8[_0x34bd('0x4e')],_0x477fd4);})['then'](function(_0x2560e8){_0x482a0b=_0x2560e8;logger[_0x34bd('0x16')](_0x34bd('0x4f'),_0x482a0b['id']);return getEndUser(_0x43f223,_0x52d479[_0x34bd('0x50')],_0x52d479[_0x34bd('0x51')],_0x477fd4);})[_0x34bd('0x21')](function(_0x6db4ba){_0x4a8291=_0x6db4ba;logger[_0x34bd('0x16')](_0x34bd('0x52'),_0x4a8291['id']);return createTicket(_0x43f223,_0x482a0b,_0x4a8291,_0x56ac18,_0x52d479,_0x56ac18[_0x34bd('0x53')],_0x477fd4);})[_0x34bd('0x21')](function(_0x5ddb03){_0x5a95f1=_0x5ddb03;logger[_0x34bd('0x16')]('Ticket\x20created!');logger[_0x34bd('0x16')]('The\x20Ticket\x20ID\x20is:',_0x5a95f1['id']);var _0x3fc297=util['format'](_0x34bd('0x54'),_0x43f223[_0x34bd('0x1d')],_[_0x34bd('0x55')](_0x5a95f1['id'],'x')[0x1]);logger[_0x34bd('0x16')](_0x34bd('0x48'),_0x34bd('0x56'));emit(util[_0x34bd('0x24')](_0x34bd('0x57'),_0x4f4ce8[_0x34bd('0x13')]),_0x34bd('0x58'),{'uri':_0x3fc297});})[_0x34bd('0x36')](function(_0x3e65e6){logger[_0x34bd('0x27')](_0x34bd('0x48'),JSON[_0x34bd('0x26')](_0x3e65e6));});};exports['outbound']=function(_0x5c5766,_0x246c52,_0x79e6b4,_0x352f17,_0x3e8c8e,_0x3b45a0,_0x5d4833){var _0x58c0eb,_0x4e92a4,_0x49f095,_0x24c635;_0x3b45a0[_0x34bd('0x1d')]=intUtil['stripTrailingSlash'](_0x3b45a0[_0x34bd('0x1d')]);_0x3b45a0[_0x34bd('0x4c')]=intUtil[_0x34bd('0x59')](_0x3b45a0['serverUrl']);if(_0x5d4833&&_0x5d4833[_0x34bd('0x5a')]&&_0x5d4833[_0x34bd('0x5a')]!==_0x34bd('0x5b')){logger[_0x34bd('0x16')](_0x34bd('0x5c'),_0x34bd('0x49'));_0x246c52[_0x34bd('0x4a')]=util[_0x34bd('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3b45a0['serverUrl'],_0x246c52[_0x34bd('0x4d')],md5(_0x246c52['uniqueid']));}return getConnection(_0x3b45a0)[_0x34bd('0x21')](function(_0x4762d9){_0x24c635=_0x4762d9;return getUser(_0x3b45a0,_0x352f17[_0x34bd('0x4e')],_0x24c635);})['then'](function(_0x4e5ea1){_0x58c0eb=_0x4e5ea1;logger[_0x34bd('0x16')](_0x34bd('0x4f'),_0x58c0eb['id']);return getEndUser(_0x3b45a0,_0x246c52[_0x34bd('0x5d')],_0x246c52['destcalleridnum'],_0x24c635);})['then'](function(_0x15151b){_0x4e92a4=_0x15151b;logger[_0x34bd('0x16')](_0x34bd('0x52'),_0x4e92a4['id']);return createTicket(_0x3b45a0,_0x58c0eb,_0x4e92a4,_0x79e6b4,_0x246c52,_0x79e6b4[_0x34bd('0x53')],_0x24c635);})[_0x34bd('0x21')](function(_0x34c9bc){_0x49f095=_0x34c9bc;logger[_0x34bd('0x16')](_0x34bd('0x5e'));logger[_0x34bd('0x16')]('The\x20Ticket\x20ID\x20is:',_0x49f095['id']);var _0x4d3118=util[_0x34bd('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b45a0[_0x34bd('0x1d')],_[_0x34bd('0x55')](_0x49f095['id'],'x')[0x1]);logger[_0x34bd('0x16')](_0x34bd('0x5c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x34bd('0x57'),_0x352f17[_0x34bd('0x13')]),_0x34bd('0x58'),{'uri':_0x4d3118});})['catch'](function(_0x119ac6){logger['error'](_0x34bd('0x5c'),JSON[_0x34bd('0x26')](_0x119ac6));});};exports[_0x34bd('0x5f')]=function(_0x55876d,_0x353fe9,_0x5c6898,_0x5d96b9,_0x3cf4c3,_0x12ae13){var _0x29a259,_0x5cc0d4,_0x3f909d,_0x23ac17;_0x12ae13[_0x34bd('0x1d')]=intUtil['stripTrailingSlash'](_0x12ae13[_0x34bd('0x1d')]);_0x12ae13[_0x34bd('0x4c')]=intUtil[_0x34bd('0x59')](_0x12ae13[_0x34bd('0x4c')]);if(_0x3cf4c3&&_0x3cf4c3[_0x34bd('0x47')]){logger[_0x34bd('0x16')]('['+_0x353fe9[_0x34bd('0x60')][_0x34bd('0x61')]()+']',_0x34bd('0x49'));_0x353fe9[_0x34bd('0x4a')]=util[_0x34bd('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x12ae13[_0x34bd('0x4c')],_0x353fe9['uniqueid'],md5(_0x353fe9[_0x34bd('0x4d')]));}else{_0x353fe9['recordingURL']='';}return getConnection(_0x12ae13)[_0x34bd('0x21')](function(_0x334517){_0x23ac17=_0x334517;return getUser(_0x12ae13,'',_0x23ac17);})[_0x34bd('0x21')](function(_0x1a6aaf){_0x29a259=_0x1a6aaf;logger[_0x34bd('0x16')](_0x34bd('0x4f'),_0x29a259['id']);return getEndUser(_0x12ae13,_0x353fe9[_0x34bd('0x50')],_0x353fe9[_0x34bd('0x51')],_0x23ac17);})[_0x34bd('0x21')](function(_0x23f5a6){_0x5cc0d4=_0x23f5a6;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5cc0d4['id']);return createTicket(_0x12ae13,_0x29a259,_0x5cc0d4,_0x5c6898,_0x353fe9,_0x5c6898[_0x34bd('0x53')],_0x23ac17);})[_0x34bd('0x21')](function(_0xfc56a3){_0x3f909d=_0xfc56a3;logger['info']('Ticket\x20created!');logger['info'](_0x34bd('0x62'),_0x3f909d['id']);})[_0x34bd('0x36')](function(_0x438458){logger[_0x34bd('0x27')]('['+_0x353fe9[_0x34bd('0x60')]['toUpperCase']()+']',JSON[_0x34bd('0x26')](_0x438458));});}; \ 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 4d186a4..69085f2 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 _0x95cd=['%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','Getting\x20agent\x20with\x20email','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','string','picklist','nameField','customField','type','idField','custom_fields','push','content','variable','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]','/api/v2','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','Recording\x20is\x20enabled!','The\x20Ticket\x20ID\x20is:','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','application/json','info','Creating\x20new\x20ticket...','format'];(function(_0x31fc11,_0x2d3c80){var _0x35030f=function(_0x33c5ca){while(--_0x33c5ca){_0x31fc11['push'](_0x31fc11['shift']());}};_0x35030f(++_0x2d3c80);}(_0x95cd,0x132));var _0xd95c=function(_0x1a10b5,_0x409bbc){_0x1a10b5=_0x1a10b5-0x0;var _0x2d734f=_0x95cd[_0x1a10b5];return _0x2d734f;};'use strict';var _=require(_0xd95c('0x0'));var rp=require('request-promise');var md5=require(_0xd95c('0x1'));var util=require(_0xd95c('0x2'));var Redis=require('ioredis');var intUtil=require(_0xd95c('0x3'));var config=require(_0xd95c('0x4'));var logger=require(_0xd95c('0x5'))(_0xd95c('0x6'));config[_0xd95c('0x7')]=_['defaults'](config[_0xd95c('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd95c('0x7')]));function emit(_0x3c68af,_0x3e8f91,_0x4d88a3){io['to'](_0x3c68af)['emit'](_0x3e8f91,_0x4d88a3);}var headers={'Content-Type':_0xd95c('0x8'),'Accept':_0xd95c('0x8')};function getTicket(_0x540061,_0x1799e7,_0x324024,_0x4e106e,_0x13a99f){logger[_0xd95c('0x9')](_0xd95c('0xa'));return request({'uri':util[_0xd95c('0xb')](_0xd95c('0xc'),_0x540061[_0xd95c('0xd')]),'method':_0xd95c('0xe'),'body':{'ticket':_[_0xd95c('0xf')]({'requester_id':_0x324024['id'],'submitter_id':_0x1799e7?_0x1799e7['id']:undefined,'assignee_id':_0x1799e7?_0x1799e7['id']:undefined,'tags':getTags(_0x4e106e[_0xd95c('0x10')],_0xd95c('0x11')),'subject':intUtil[_0xd95c('0x12')](_0x4e106e['Subjects'],_0x13a99f,'\x20'),'description':intUtil['getString'](_0x4e106e['Descriptions'],_0x13a99f,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x4e106e[_0xd95c('0x13')],_0x13a99f,'\x0a')}},getCustomFields(_0x4e106e[_0xd95c('0x14')],_0x13a99f))}})[_0xd95c('0x15')](function(_0x16ae1c){logger[_0xd95c('0x9')](_0xd95c('0x16'));return _0x16ae1c['ticket'];});}function getUser(_0x341776,_0xab19c7){if(intUtil['validateEmail'](_0xab19c7)){logger['info'](_0xd95c('0x17'),_0xab19c7);return request({'uri':util[_0xd95c('0xb')]('%s/search.json',_0x341776[_0xd95c('0xd')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0xab19c7)}})[_0xd95c('0x15')](function(_0x560da1){if(_0x560da1[_0xd95c('0x18')]){logger['info'](_0xd95c('0x19'));return _[_0xd95c('0x1a')](_0x560da1[_0xd95c('0x1b')],{'email':_0xab19c7,'role':_0xd95c('0x1c')});}else{logger['info'](_0xd95c('0x1d'));return request({'uri':util['format']('%s/users/me.json',_0x341776['remoteUri'])})['then'](function(_0x118d58){logger[_0xd95c('0x9')](_0xd95c('0x1e'));return _0x118d58[_0xd95c('0x1f')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd95c('0xb')]('%s/users/me.json',_0x341776['remoteUri'])})[_0xd95c('0x15')](function(_0x307989){logger[_0xd95c('0x9')](_0xd95c('0x1e'));return _0x307989[_0xd95c('0x1f')];});}}function getEndUser(_0xe78c5d,_0x19284b,_0x193896){logger[_0xd95c('0x9')](_0xd95c('0x20'),_0x193896);return request({'uri':util['format']('%s/search.json',_0xe78c5d['remoteUri']),'qs':{'query':util[_0xd95c('0xb')](_0xd95c('0x21'),_0x193896)}})[_0xd95c('0x15')](function(_0xa498c7){var _0x1b2cc8;if(_0xa498c7[_0xd95c('0x1b')][_0xd95c('0x22')]){_0xa498c7[_0xd95c('0x1b')]=_[_0xd95c('0x23')](_0xa498c7[_0xd95c('0x1b')],{'suspended':![],'role':_0xd95c('0x24')});if(_0xa498c7['results'][_0xd95c('0x22')]){_0x1b2cc8=_[_0xd95c('0x25')](_0xa498c7[_0xd95c('0x1b')]);}}if(_0x1b2cc8){logger[_0xd95c('0x9')](_0xd95c('0x26'));return _0x1b2cc8;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xd95c('0xb')]('%s/users.json',_0xe78c5d['remoteUri']),'method':'POST','body':{'user':{'role':'end-user','name':util['format']('Caller\x20-\x20%s',_0x19284b||_0x193896),'phone':_0x193896}}})['then'](function(_0x1b381a){logger[_0xd95c('0x9')]('Enduser\x20created.');return _0x1b381a[_0xd95c('0x1f')];});}});}function getAuth(_0x3d3d27){var _0xcacb08;if(_0x3d3d27[_0xd95c('0x27')]===_0xd95c('0x28')){_0xcacb08=util[_0xd95c('0xb')](_0xd95c('0x29'),_0x3d3d27[_0xd95c('0x2a')],_0x3d3d27[_0xd95c('0x28')]);}else if(_0x3d3d27[_0xd95c('0x27')]===_0xd95c('0x2b')){_0xcacb08=util[_0xd95c('0xb')](_0xd95c('0x2c'),_0x3d3d27[_0xd95c('0x2a')],_0x3d3d27[_0xd95c('0x2b')]);}return util[_0xd95c('0xb')](_0xd95c('0x2d'),new Buffer(_0xcacb08)[_0xd95c('0x2e')](_0xd95c('0x2f')));}function request(_0xf4b4b3){logger[_0xd95c('0x30')](_0xd95c('0x31'),JSON[_0xd95c('0x32')](_0xf4b4b3));return rp(_['defaults'](_0xf4b4b3,{'method':_0xd95c('0x33'),'headers':headers,'json':!![]}));}function getTags(_0xa56739,_0x16145f){var _0xedb3e8=[];if(_0xa56739&&_0xa56739[_0xd95c('0x22')]>0x0){_0xedb3e8=_['map'](_0xa56739,_0x16145f);}return _0xedb3e8;}function getCustomFields(_0xf7f82d,_0x20ac1a){var _0x3338d4=[];var _0x28ef2b={'custom_fields':[]};if(_0xf7f82d[_0xd95c('0x22')]>0x0){_[_0xd95c('0x34')](_0xf7f82d,function(_0x16d962){if(_[_0xd95c('0x35')]([_0xd95c('0x36'),_0xd95c('0x37')],_0x16d962['type'])&&_0x16d962[_0xd95c('0x38')]&&!_0x16d962[_0xd95c('0x39')]){_0x28ef2b[_0x16d962[_0xd95c('0x38')]['toLowerCase']()]=_0x16d962['content'][_0xd95c('0x2e')]();}else if(_[_0xd95c('0x35')]([_0xd95c('0x36'),_0xd95c('0x37')],_0x16d962[_0xd95c('0x3a')])&&_0x16d962[_0xd95c('0x3b')]&&_0x16d962[_0xd95c('0x39')]){_0x28ef2b[_0xd95c('0x3c')][_0xd95c('0x3d')]({'id':_0x16d962['idField'],'value':_0x16d962[_0xd95c('0x3e')][_0xd95c('0x2e')]()});}else if(_0x16d962[_0xd95c('0x3a')]===_0xd95c('0x3f')&&_0x16d962['variableName']&&_0x16d962[_0xd95c('0x3b')]&&_0x16d962['customField']){_0x20ac1a[_0x16d962['variableName']]&&_0x28ef2b[_0xd95c('0x3c')][_0xd95c('0x3d')]({'id':_0x16d962[_0xd95c('0x3b')],'value':_0x20ac1a[_0x16d962['variableName']][_0xd95c('0x2e')]()});}else if(_0x16d962[_0xd95c('0x3a')]===_0xd95c('0x40')&&_0x16d962['Variable']&&_0x16d962[_0xd95c('0x41')][_0xd95c('0x11')]&&_0x16d962[_0xd95c('0x3b')]&&_0x16d962['customField']){_0x20ac1a[_0x16d962[_0xd95c('0x41')][_0xd95c('0x11')][_0xd95c('0x42')]()]&&_0x28ef2b[_0xd95c('0x3c')]['push']({'id':_0x16d962['idField'],'value':_0x20ac1a[_0x16d962[_0xd95c('0x41')]['name'][_0xd95c('0x42')]()][_0xd95c('0x2e')]()});}});}return _0x28ef2b;}exports[_0xd95c('0x43')]=function(_0x192ed8,_0x4b8d82,_0x1c523e,_0x1af0be,_0x1560c4,_0x452c31){var _0x1a72ed,_0x3d9f59;_0x452c31['remoteUri']=intUtil['stripTrailingSlash'](_0x452c31[_0xd95c('0xd')]);_0x452c31[_0xd95c('0x44')]=intUtil[_0xd95c('0x45')](_0x452c31[_0xd95c('0x44')]);if(_0x1560c4&&_0x1560c4[_0xd95c('0x46')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x4b8d82[_0xd95c('0x47')]=util[_0xd95c('0xb')](_0xd95c('0x48'),_0x452c31[_0xd95c('0x44')],_0x4b8d82['uniqueid'],md5(_0x4b8d82[_0xd95c('0x49')]));}else{_0x4b8d82[_0xd95c('0x47')]='';}headers[_0xd95c('0x4a')]=getAuth(_0x452c31);return getUser(_0x452c31,_0x1af0be[_0xd95c('0x4b')])['then'](function(_0x442755){_0x1a72ed=_0x442755;logger[_0xd95c('0x9')](_0xd95c('0x4c'),_0x1a72ed['id']);return getEndUser(_0x452c31,_0x4b8d82[_0xd95c('0x4d')],_0x4b8d82[_0xd95c('0x4e')]);})[_0xd95c('0x15')](function(_0x256339){_0x3d9f59=_0x256339;logger[_0xd95c('0x9')](_0xd95c('0x4f'),_0x3d9f59['id']);return getTicket(_0x452c31,_0x1a72ed,_0x3d9f59,_0x1c523e,_0x4b8d82);})[_0xd95c('0x15')](function(_0x13cc0f){if(_0x13cc0f){logger[_0xd95c('0x9')]('The\x20Ticket\x20ID\x20is:',_0x13cc0f['id']);switch(_0x452c31['type']){case _0xd95c('0x50'):logger[_0xd95c('0x9')](_0xd95c('0x51'),_0xd95c('0x52'));return request({'uri':util[_0xd95c('0xb')](_0xd95c('0x53'),_0x452c31[_0xd95c('0xd')],_0x1a72ed['id'],_0x13cc0f['id']),'method':_0xd95c('0xe')});case _0xd95c('0x54'):logger['info']('[QUEUE]',_0xd95c('0x55'));emit(util['format'](_0xd95c('0x56'),_0x1af0be[_0xd95c('0x11')]),_0xd95c('0x57'),{'uri':util['format'](_0xd95c('0x58'),_0x452c31['remoteUri'][_0xd95c('0x59')]('/api/v2',''),_0x13cc0f['id'])});break;default:logger[_0xd95c('0x5a')](_0xd95c('0x51'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x268cba){logger['error'](_0xd95c('0x5b'),util[_0xd95c('0x5c')](_0x268cba,{'showHidden':!![],'depth':null}));});};exports[_0xd95c('0x5d')]=function(_0x18985d,_0x5be592,_0x19f934,_0xb5f30b,_0x6eb507,_0x2be779,_0x4dc339){var _0x38cef3,_0x3e584b;_0x2be779['remoteUri']=intUtil[_0xd95c('0x45')](_0x2be779[_0xd95c('0xd')]);_0x2be779[_0xd95c('0x44')]=intUtil[_0xd95c('0x45')](_0x2be779[_0xd95c('0x44')]);if(_0x4dc339&&_0x4dc339[_0xd95c('0x5e')]&&_0x4dc339[_0xd95c('0x5e')]!==_0xd95c('0x5f')){logger[_0xd95c('0x9')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5be592[_0xd95c('0x47')]=util[_0xd95c('0xb')](_0xd95c('0x48'),_0x2be779['serverUrl'],_0x5be592[_0xd95c('0x49')],md5(_0x5be592['uniqueid']));}headers[_0xd95c('0x4a')]=getAuth(_0x2be779);return getUser(_0x2be779,_0xb5f30b[_0xd95c('0x4b')])[_0xd95c('0x15')](function(_0x598eba){_0x38cef3=_0x598eba;logger[_0xd95c('0x9')](_0xd95c('0x4c'),_0x38cef3['id']);return getEndUser(_0x2be779,_0x5be592['destcalleridname'],_0x5be592[_0xd95c('0x60')]);})['then'](function(_0x73359b){_0x3e584b=_0x73359b;logger[_0xd95c('0x9')](_0xd95c('0x4f'),_0x3e584b['id']);return getTicket(_0x2be779,_0x38cef3,_0x3e584b,_0x19f934,_0x5be592);})[_0xd95c('0x15')](function(_0x532a00){if(_0x532a00){logger['info']('The\x20Ticket\x20ID\x20is:',_0x532a00['id']);switch(_0x2be779[_0xd95c('0x3a')]){case _0xd95c('0x50'):logger[_0xd95c('0x9')](_0xd95c('0x61'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xd95c('0xb')](_0xd95c('0x53'),_0x2be779[_0xd95c('0xd')],_0x38cef3['id'],_0x532a00['id']),'method':_0xd95c('0xe')});case _0xd95c('0x54'):logger[_0xd95c('0x9')]('[OUTBOUND]',_0xd95c('0x55'));emit(util[_0xd95c('0xb')](_0xd95c('0x56'),_0xb5f30b['name']),_0xd95c('0x57'),{'uri':util[_0xd95c('0xb')]('%s/agent/tickets/%s',_0x2be779['remoteUri']['replace'](_0xd95c('0x62'),''),_0x532a00['id'])});break;default:logger[_0xd95c('0x5a')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd95c('0x63')](function(_0x3894f2){logger[_0xd95c('0x5a')](_0xd95c('0x64'),util[_0xd95c('0x5c')](_0x3894f2,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x59433f,_0x305b7f,_0x501441,_0x11349c,_0x2207fa,_0x2d1173){var _0x46a00,_0x5b9222;_0x2d1173['remoteUri']=intUtil[_0xd95c('0x45')](_0x2d1173[_0xd95c('0xd')]);_0x2d1173[_0xd95c('0x44')]=intUtil[_0xd95c('0x45')](_0x2d1173['serverUrl']);if(_0x2207fa&&_0x2207fa[_0xd95c('0x46')]){logger[_0xd95c('0x9')]('['+_0x305b7f['lastevent'][_0xd95c('0x65')]()+']',_0xd95c('0x66'));_0x305b7f[_0xd95c('0x47')]=util[_0xd95c('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2d1173[_0xd95c('0x44')],_0x305b7f[_0xd95c('0x49')],md5(_0x305b7f[_0xd95c('0x49')]));}else{_0x305b7f[_0xd95c('0x47')]='';}headers['Authorization']=getAuth(_0x2d1173);return getUser(_0x2d1173)[_0xd95c('0x15')](function(_0x529848){_0x46a00=_0x529848;logger['info'](_0xd95c('0x4c'),_0x46a00['id']);return getEndUser(_0x2d1173,_0x305b7f[_0xd95c('0x4d')],_0x305b7f[_0xd95c('0x4e')]);})[_0xd95c('0x15')](function(_0x208afd){_0x5b9222=_0x208afd;logger[_0xd95c('0x9')](_0xd95c('0x4f'),_0x5b9222['id']);return getTicket(_0x2d1173,_0x46a00,_0x5b9222,_0x501441,_0x305b7f);})[_0xd95c('0x15')](function(_0x19e93b){if(_0x19e93b){logger['info'](_0xd95c('0x67'),_0x19e93b['id']);}})[_0xd95c('0x63')](function(_0x194b70){logger[_0xd95c('0x5a')]('['+_0x305b7f[_0xd95c('0x68')][_0xd95c('0x65')]()+']'+_0xd95c('0x69'),util[_0xd95c('0x5c')](_0x194b70,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x297d=['ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','filter','end-user','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','token','Basic\x20%s','base64','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','nameField','customField','toLowerCase','type','idField','push','content','toString','variable','variableName','custom_fields','customVariable','name','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','Displaying\x20ticket\x20to\x20agent...','user:%s','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!'];(function(_0x49d40d,_0x30e0ea){var _0x5ec463=function(_0x11bab1){while(--_0x11bab1){_0x49d40d['push'](_0x49d40d['shift']());}};_0x5ec463(++_0x30e0ea);}(_0x297d,0x138));var _0xd297=function(_0x3cd784,_0x5177fc){_0x3cd784=_0x3cd784-0x0;var _0x44aae2=_0x297d[_0x3cd784];return _0x44aae2;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xd297('0x0'));var util=require(_0xd297('0x1'));var Redis=require(_0xd297('0x2'));var intUtil=require('./util');var config=require(_0xd297('0x3'));var logger=require(_0xd297('0x4'))(_0xd297('0x5'));config[_0xd297('0x6')]=_[_0xd297('0x7')](config[_0xd297('0x6')],{'host':_0xd297('0x8'),'port':0x18eb});var io=require(_0xd297('0x9'))(new Redis(config[_0xd297('0x6')]));function emit(_0x1d22f2,_0x918f2e,_0x16a9cc){io['to'](_0x1d22f2)['emit'](_0x918f2e,_0x16a9cc);}var headers={'Content-Type':_0xd297('0xa'),'Accept':_0xd297('0xa')};function getTicket(_0x554048,_0x47db07,_0x55aaf3,_0x4b0d30,_0x5c29ef){logger[_0xd297('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xd297('0xc')](_0xd297('0xd'),_0x554048[_0xd297('0xe')]),'method':_0xd297('0xf'),'body':{'ticket':_[_0xd297('0x10')]({'requester_id':_0x55aaf3['id'],'submitter_id':_0x47db07?_0x47db07['id']:undefined,'assignee_id':_0x47db07?_0x47db07['id']:undefined,'tags':getTags(_0x4b0d30[_0xd297('0x11')],'name'),'subject':intUtil[_0xd297('0x12')](_0x4b0d30[_0xd297('0x13')],_0x5c29ef,'\x20'),'description':intUtil['getString'](_0x4b0d30[_0xd297('0x14')],_0x5c29ef,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd297('0x12')](_0x4b0d30[_0xd297('0x14')],_0x5c29ef,'\x0a')}},getCustomFields(_0x4b0d30[_0xd297('0x15')],_0x5c29ef))}})[_0xd297('0x16')](function(_0x53c638){logger[_0xd297('0xb')](_0xd297('0x17'));return _0x53c638[_0xd297('0x18')];});}function getUser(_0x11fc70,_0x24569e){if(intUtil[_0xd297('0x19')](_0x24569e)){logger[_0xd297('0xb')](_0xd297('0x1a'),_0x24569e);return request({'uri':util[_0xd297('0xc')]('%s/search.json',_0x11fc70[_0xd297('0xe')]),'qs':{'query':util['format'](_0xd297('0x1b'),_0x24569e)}})['then'](function(_0x4cdbdd){if(_0x4cdbdd['count']){logger['info'](_0xd297('0x1c'));return _[_0xd297('0x1d')](_0x4cdbdd[_0xd297('0x1e')],{'email':_0x24569e,'role':_0xd297('0x1f')});}else{logger[_0xd297('0xb')](_0xd297('0x20'));return request({'uri':util[_0xd297('0xc')]('%s/users/me.json',_0x11fc70[_0xd297('0xe')])})[_0xd297('0x16')](function(_0x537bf4){logger[_0xd297('0xb')]('Admin\x20account\x20selected.');return _0x537bf4[_0xd297('0x21')];});}});}else{logger[_0xd297('0xb')](_0xd297('0x20'));return request({'uri':util['format'](_0xd297('0x22'),_0x11fc70[_0xd297('0xe')])})[_0xd297('0x16')](function(_0x1fa374){logger['info'](_0xd297('0x23'));return _0x1fa374['user'];});}}function getEndUser(_0x4011f1,_0x54031f,_0x29e45d){logger[_0xd297('0xb')](_0xd297('0x24'),_0x29e45d);return request({'uri':util['format'](_0xd297('0x25'),_0x4011f1[_0xd297('0xe')]),'qs':{'query':util[_0xd297('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x29e45d)}})[_0xd297('0x16')](function(_0x3d1e53){var _0x34b52e;if(_0x3d1e53['results']['length']){_0x3d1e53[_0xd297('0x1e')]=_[_0xd297('0x26')](_0x3d1e53[_0xd297('0x1e')],{'suspended':![],'role':_0xd297('0x27')});if(_0x3d1e53[_0xd297('0x1e')][_0xd297('0x28')]){_0x34b52e=_['first'](_0x3d1e53[_0xd297('0x1e')]);}}if(_0x34b52e){logger[_0xd297('0xb')](_0xd297('0x29'));return _0x34b52e;}else{logger[_0xd297('0xb')](_0xd297('0x2a'));return request({'uri':util[_0xd297('0xc')](_0xd297('0x2b'),_0x4011f1[_0xd297('0xe')]),'method':_0xd297('0xf'),'body':{'user':{'role':'end-user','name':util[_0xd297('0xc')](_0xd297('0x2c'),_0x54031f||_0x29e45d),'phone':_0x29e45d}}})[_0xd297('0x16')](function(_0x4dc429){logger['info']('Enduser\x20created.');return _0x4dc429['user'];});}});}function getAuth(_0x2102da){var _0x4cee9f;if(_0x2102da[_0xd297('0x2d')]===_0xd297('0x2e')){_0x4cee9f=util['format'](_0xd297('0x2f'),_0x2102da[_0xd297('0x30')],_0x2102da['password']);}else if(_0x2102da[_0xd297('0x2d')]===_0xd297('0x31')){_0x4cee9f=util[_0xd297('0xc')]('%s/token:%s',_0x2102da[_0xd297('0x30')],_0x2102da[_0xd297('0x31')]);}return util[_0xd297('0xc')](_0xd297('0x32'),new Buffer(_0x4cee9f)['toString'](_0xd297('0x33')));}function request(_0x5e24bf){logger['debug'](_0xd297('0x34'),JSON[_0xd297('0x35')](_0x5e24bf));return rp(_[_0xd297('0x7')](_0x5e24bf,{'method':_0xd297('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x3da534,_0x370b7e){var _0x57cb56=[];if(_0x3da534&&_0x3da534[_0xd297('0x28')]>0x0){_0x57cb56=_[_0xd297('0x37')](_0x3da534,_0x370b7e);}return _0x57cb56;}function getCustomFields(_0xfbbcf8,_0x152f42){var _0x3c3f2d=[];var _0x5b447b={'custom_fields':[]};if(_0xfbbcf8[_0xd297('0x28')]>0x0){_[_0xd297('0x38')](_0xfbbcf8,function(_0x3d402e){if(_[_0xd297('0x39')]([_0xd297('0x3a'),_0xd297('0x3b')],_0x3d402e['type'])&&_0x3d402e[_0xd297('0x3c')]&&!_0x3d402e[_0xd297('0x3d')]){_0x5b447b[_0x3d402e[_0xd297('0x3c')][_0xd297('0x3e')]()]=_0x3d402e['content']['toString']();}else if(_['includes']([_0xd297('0x3a'),_0xd297('0x3b')],_0x3d402e[_0xd297('0x3f')])&&_0x3d402e[_0xd297('0x40')]&&_0x3d402e['customField']){_0x5b447b['custom_fields'][_0xd297('0x41')]({'id':_0x3d402e[_0xd297('0x40')],'value':_0x3d402e[_0xd297('0x42')][_0xd297('0x43')]()});}else if(_0x3d402e[_0xd297('0x3f')]===_0xd297('0x44')&&_0x3d402e['variableName']&&_0x3d402e['idField']&&_0x3d402e[_0xd297('0x3d')]){_0x152f42[_0x3d402e[_0xd297('0x45')]]&&_0x5b447b[_0xd297('0x46')]['push']({'id':_0x3d402e[_0xd297('0x40')],'value':_0x152f42[_0x3d402e[_0xd297('0x45')]]['toString']()});}else if(_0x3d402e[_0xd297('0x3f')]===_0xd297('0x47')&&_0x3d402e['Variable']&&_0x3d402e['Variable'][_0xd297('0x48')]&&_0x3d402e[_0xd297('0x40')]&&_0x3d402e['customField']){_0x152f42[_0x3d402e[_0xd297('0x49')]['name'][_0xd297('0x3e')]()]&&_0x5b447b[_0xd297('0x46')]['push']({'id':_0x3d402e[_0xd297('0x40')],'value':_0x152f42[_0x3d402e[_0xd297('0x49')][_0xd297('0x48')][_0xd297('0x3e')]()][_0xd297('0x43')]()});}});}return _0x5b447b;}exports[_0xd297('0x4a')]=function(_0x5c0d02,_0x3ba9a8,_0x696b3b,_0x31ba94,_0x5558ff,_0x59565a){var _0x574720,_0x3e7238;_0x59565a[_0xd297('0xe')]=intUtil[_0xd297('0x4b')](_0x59565a['remoteUri']);_0x59565a[_0xd297('0x4c')]=intUtil['stripTrailingSlash'](_0x59565a[_0xd297('0x4c')]);if(_0x5558ff&&_0x5558ff[_0xd297('0x4d')]){logger[_0xd297('0xb')](_0xd297('0x4e'),_0xd297('0x4f'));_0x3ba9a8['recordingURL']=util[_0xd297('0xc')](_0xd297('0x50'),_0x59565a[_0xd297('0x4c')],_0x3ba9a8[_0xd297('0x51')],md5(_0x3ba9a8[_0xd297('0x51')]));}else{_0x3ba9a8[_0xd297('0x52')]='';}headers[_0xd297('0x53')]=getAuth(_0x59565a);return getUser(_0x59565a,_0x31ba94[_0xd297('0x54')])[_0xd297('0x16')](function(_0x42fd11){_0x574720=_0x42fd11;logger['info']('The\x20User\x20ID\x20is:',_0x574720['id']);return getEndUser(_0x59565a,_0x3ba9a8[_0xd297('0x55')],_0x3ba9a8[_0xd297('0x56')]);})[_0xd297('0x16')](function(_0x2575c1){_0x3e7238=_0x2575c1;logger[_0xd297('0xb')](_0xd297('0x57'),_0x3e7238['id']);return getTicket(_0x59565a,_0x574720,_0x3e7238,_0x696b3b,_0x3ba9a8);})[_0xd297('0x16')](function(_0x207973){if(_0x207973){logger['info'](_0xd297('0x58'),_0x207973['id']);switch(_0x59565a[_0xd297('0x3f')]){case _0xd297('0x59'):logger[_0xd297('0xb')](_0xd297('0x4e'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x59565a[_0xd297('0xe')],_0x574720['id'],_0x207973['id']),'method':'POST'});case _0xd297('0x5a'):logger['info'](_0xd297('0x4e'),_0xd297('0x5b'));emit(util[_0xd297('0xc')]('user:%s',_0x31ba94[_0xd297('0x48')]),_0xd297('0x5c'),{'uri':util[_0xd297('0xc')](_0xd297('0x5d'),_0x59565a[_0xd297('0xe')][_0xd297('0x5e')](_0xd297('0x5f'),''),_0x207973['id'])});break;default:logger[_0xd297('0x60')](_0xd297('0x4e'),_0xd297('0x61'));}}})['catch'](function(_0x1b68e0){logger[_0xd297('0x60')](_0xd297('0x62'),util[_0xd297('0x63')](_0x1b68e0,{'showHidden':!![],'depth':null}));});};exports[_0xd297('0x64')]=function(_0x51cbdc,_0xebce4d,_0x2dcee9,_0x472442,_0x154527,_0xf243ab,_0x34c565){var _0x4684ee,_0x4b8360;_0xf243ab[_0xd297('0xe')]=intUtil[_0xd297('0x4b')](_0xf243ab['remoteUri']);_0xf243ab['serverUrl']=intUtil['stripTrailingSlash'](_0xf243ab['serverUrl']);if(_0x34c565&&_0x34c565['recordingFormat']&&_0x34c565['recordingFormat']!==_0xd297('0x65')){logger['info'](_0xd297('0x66'),'Recording\x20is\x20enabled!');_0xebce4d[_0xd297('0x52')]=util[_0xd297('0xc')](_0xd297('0x50'),_0xf243ab[_0xd297('0x4c')],_0xebce4d[_0xd297('0x51')],md5(_0xebce4d[_0xd297('0x51')]));}headers['Authorization']=getAuth(_0xf243ab);return getUser(_0xf243ab,_0x472442[_0xd297('0x54')])[_0xd297('0x16')](function(_0x1486b6){_0x4684ee=_0x1486b6;logger[_0xd297('0xb')](_0xd297('0x67'),_0x4684ee['id']);return getEndUser(_0xf243ab,_0xebce4d[_0xd297('0x68')],_0xebce4d['destcalleridnum']);})[_0xd297('0x16')](function(_0x250201){_0x4b8360=_0x250201;logger[_0xd297('0xb')](_0xd297('0x57'),_0x4b8360['id']);return getTicket(_0xf243ab,_0x4684ee,_0x4b8360,_0x2dcee9,_0xebce4d);})['then'](function(_0x4afac5){if(_0x4afac5){logger['info'](_0xd297('0x58'),_0x4afac5['id']);switch(_0xf243ab[_0xd297('0x3f')]){case'integrationTab':logger['info'](_0xd297('0x66'),_0xd297('0x69'));return request({'uri':util[_0xd297('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xf243ab['remoteUri'],_0x4684ee['id'],_0x4afac5['id']),'method':_0xd297('0xf')});case _0xd297('0x5a'):logger[_0xd297('0xb')](_0xd297('0x66'),_0xd297('0x5b'));emit(util[_0xd297('0xc')](_0xd297('0x6a'),_0x472442[_0xd297('0x48')]),_0xd297('0x5c'),{'uri':util['format']('%s/agent/tickets/%s',_0xf243ab[_0xd297('0xe')][_0xd297('0x5e')](_0xd297('0x5f'),''),_0x4afac5['id'])});break;default:logger[_0xd297('0x60')](_0xd297('0x66'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd297('0x6b')](function(_0x492870){logger[_0xd297('0x60')](_0xd297('0x6c'),util['inspect'](_0x492870,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x4cedf2,_0x26e664,_0x55a7d2,_0x469d12,_0x1678d0,_0x5671af){var _0xd17ca7,_0x45b6bb;_0x5671af['remoteUri']=intUtil[_0xd297('0x4b')](_0x5671af['remoteUri']);_0x5671af[_0xd297('0x4c')]=intUtil[_0xd297('0x4b')](_0x5671af[_0xd297('0x4c')]);if(_0x1678d0&&_0x1678d0[_0xd297('0x4d')]){logger[_0xd297('0xb')]('['+_0x26e664['lastevent'][_0xd297('0x6d')]()+']',_0xd297('0x4f'));_0x26e664[_0xd297('0x52')]=util[_0xd297('0xc')](_0xd297('0x50'),_0x5671af[_0xd297('0x4c')],_0x26e664[_0xd297('0x51')],md5(_0x26e664[_0xd297('0x51')]));}else{_0x26e664[_0xd297('0x52')]='';}headers[_0xd297('0x53')]=getAuth(_0x5671af);return getUser(_0x5671af)[_0xd297('0x16')](function(_0x1b99df){_0xd17ca7=_0x1b99df;logger['info']('The\x20User\x20ID\x20is:',_0xd17ca7['id']);return getEndUser(_0x5671af,_0x26e664[_0xd297('0x55')],_0x26e664[_0xd297('0x56')]);})[_0xd297('0x16')](function(_0x66bea8){_0x45b6bb=_0x66bea8;logger[_0xd297('0xb')](_0xd297('0x57'),_0x45b6bb['id']);return getTicket(_0x5671af,_0xd17ca7,_0x45b6bb,_0x55a7d2,_0x26e664);})[_0xd297('0x16')](function(_0x582d99){if(_0x582d99){logger[_0xd297('0xb')]('The\x20Ticket\x20ID\x20is:',_0x582d99['id']);}})['catch'](function(_0x1c74f5){logger['error']('['+_0x26e664[_0xd297('0x6e')][_0xd297('0x6d')]()+']'+_0xd297('0x6f'),util[_0xd297('0x63')](_0x1c74f5,{'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 1cc9b52..3c6185a 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 _0x5b02=['Zoho-oauthtoken\x20','code','SUCCESS','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Contacts','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','answertime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Called','complete','Call_Result','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','com','destcalleridnum','Outbound','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','isArrayLikeObject','users','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5b02,0xe9));var _0x25b0=function(_0xae4ade,_0x5a8d5b){_0xae4ade=_0xae4ade-0x0;var _0x271600=_0x5b02[_0xae4ade];return _0x271600;};'use strict';var _=require(_0x25b0('0x0'));var rp=require(_0x25b0('0x1'));var md5=require(_0x25b0('0x2'));var util=require(_0x25b0('0x3'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x25b0('0x4'));var BPromise=require('bluebird');var config=require(_0x25b0('0x5'));var logger=require(_0x25b0('0x6'))(_0x25b0('0x7'));config[_0x25b0('0x8')]=_[_0x25b0('0x9')](config['redis'],{'host':_0x25b0('0xa'),'port':0x18eb});var io=require(_0x25b0('0xb'))(new Redis(config['redis']));function emit(_0x412954,_0x4d3e71,_0x56feca){io['to'](_0x412954)[_0x25b0('0xc')](_0x4d3e71,_0x56feca);}function request(_0x45429b){logger[_0x25b0('0xd')]('[HTTP]',JSON[_0x25b0('0xe')](_0x45429b));return rp(_0x45429b);}function getCustomFields(_0x466612,_0x135afb){var _0x250d31={};if(_0x466612[_0x25b0('0xf')]>0x0){_[_0x25b0('0x10')](_0x466612,function(_0x44afbc){if(_[_0x25b0('0x11')]([_0x25b0('0x12'),_0x25b0('0x13')],_0x44afbc[_0x25b0('0x14')])&&_0x44afbc[_0x25b0('0x15')]){_0x250d31[_0x44afbc[_0x25b0('0x15')]]=_0x44afbc[_0x25b0('0x16')][_0x25b0('0x17')]();}else if(_0x44afbc[_0x25b0('0x14')]===_0x25b0('0x18')&&_0x44afbc[_0x25b0('0x19')]&&_0x44afbc[_0x25b0('0x15')]&&_0x135afb[_0x44afbc[_0x25b0('0x19')]]){_0x250d31[_0x44afbc[_0x25b0('0x15')]]=_0x135afb[_0x44afbc['variableName']]['toString']();}else if(_0x44afbc[_0x25b0('0x14')]==='customVariable'&&_0x44afbc[_0x25b0('0x1a')]&&_0x44afbc[_0x25b0('0x1a')][_0x25b0('0x1b')]&&_0x44afbc[_0x25b0('0x15')]&&_0x135afb[_0x44afbc['Variable'][_0x25b0('0x1b')][_0x25b0('0x1c')]()]){_0x250d31[_0x44afbc[_0x25b0('0x15')]]=_0x135afb[_0x44afbc[_0x25b0('0x1a')][_0x25b0('0x1b')][_0x25b0('0x1c')]()]['toString']();}});}return _0x250d31;}function getName(_0x348d36){if(_0x348d36[_0x25b0('0x1d')]('\x20')>0x0){var _0x24e7a0=_0x348d36[_0x25b0('0x1e')](/ (.+)/);if(_0x24e7a0[0x1]){return _0x24e7a0;}}return[_0x348d36,_0x348d36];}var accountsTokens={};function getAccessToken(_0x1dc691){return new Promise(function(_0xea4162,_0x232be7){if(!_[_0x25b0('0x1f')](accountsTokens[_0x1dc691['id']])&&!_[_0x25b0('0x1f')](accountsTokens[_0x1dc691['id']][_0x25b0('0x20')])){if(moment()[_0x25b0('0x21')](accountsTokens[_0x1dc691['id']][_0x25b0('0x22')])){_0xea4162(accountsTokens[_0x1dc691['id']]['access_token']);}}var _0x9f432e;switch(_0x1dc691[_0x25b0('0x23')]){case'US':_0x9f432e='https://accounts.zoho.com';break;case'AU':_0x9f432e=_0x25b0('0x24');break;case'EU':_0x9f432e=_0x25b0('0x25');break;case'IN':_0x9f432e=_0x25b0('0x26');break;case'CN':_0x9f432e='https://accounts.zoho.com.cn';break;default:_0x9f432e='https://accounts.zoho.eu';break;}var _0x50089e={'method':_0x25b0('0x27'),'uri':_0x9f432e+_0x25b0('0x28'),'qs':{'refresh_token':_0x1dc691[_0x25b0('0x29')],'client_id':_0x1dc691[_0x25b0('0x2a')],'client_secret':_0x1dc691[_0x25b0('0x2b')],'grant_type':_0x25b0('0x2c')},'json':!![]};return rp(_0x50089e)[_0x25b0('0x2d')](function(_0x75ce7a){accountsTokens[_0x1dc691['id']]={'access_token':_0x75ce7a[_0x25b0('0x20')],'expires_in':moment()['add'](_0x75ce7a[_0x25b0('0x22')],_0x25b0('0x2e'))};_0xea4162(_0x75ce7a['access_token']);})['catch'](function(_0x5de43d){logger[_0x25b0('0x2f')](_0x25b0('0x30'),_0x5de43d[_0x25b0('0x31')]);_0x232be7(_0x5de43d);});});}function getUser(_0x105129,_0x214377,_0x3285ae,_0x12676b){logger[_0x25b0('0x32')](_0x25b0('0x33'));return request({'method':_0x25b0('0x34'),'uri':util[_0x25b0('0x35')](_0x25b0('0x36'),_0x214377),'qs':{'type':_0x25b0('0x37')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x105129},'json':!![]})['then'](function(_0x7ce48f){if(_0x7ce48f['users']){var _0x4dfeea=-0x1;if(_[_0x25b0('0x38')](_0x7ce48f[_0x25b0('0x39')])){if(!_[_0x25b0('0x1f')](_0x12676b)){_0x4dfeea=_[_0x25b0('0x3a')](_0x7ce48f[_0x25b0('0x39')],function(_0x5d64dc){return _0x5d64dc[_0x25b0('0x3b')]===_0x12676b;});}if(_0x4dfeea>=0x0){logger[_0x25b0('0x32')]('Agent\x20found!');}else{logger[_0x25b0('0x32')](_0x25b0('0x3c'));_0x4dfeea=_['findIndex'](_0x7ce48f[_0x25b0('0x39')],function(_0x49b3a5){return _0x49b3a5[_0x25b0('0x3d')][_0x25b0('0x1b')]===_0x25b0('0x3e');});}return _0x7ce48f[_0x25b0('0x39')][_0x4dfeea];}else{if(_0x7ce48f[_0x25b0('0x3f')][_0x25b0('0x3d')][_0x25b0('0x1b')]===_0x25b0('0x3e')){logger[_0x25b0('0x32')]('Using\x20the\x20admin\x20account!');user=_0x7ce48f[_0x25b0('0x3f')];return user;}else{logger[_0x25b0('0x2f')](_0x25b0('0x40'),JSON[_0x25b0('0xe')](_0x7ce48f));throw new Error(_0x25b0('0x41')+JSON[_0x25b0('0xe')](_0x7ce48f));}}}else{logger[_0x25b0('0x2f')](_0x25b0('0x40'),JSON[_0x25b0('0xe')](_0x7ce48f));throw new Error(_0x25b0('0x41')+JSON['stringify'](_0x7ce48f));}})[_0x25b0('0x42')](function(_0x104b35){console[_0x25b0('0x2f')](_0x104b35);});}function getZohoUser(_0x4834f6,_0x20d98b){return new BPromise(function(_0x42a0ed,_0x2ce2ca){request(_0x4834f6)[_0x25b0('0x2d')](function(_0x17f67c){var _0xa35c6a=null;if(_0x17f67c){_0xa35c6a=_0x17f67c[_0x25b0('0x43')][0x0];_0xa35c6a[_0x25b0('0x44')]=_0x20d98b;}_0x42a0ed(_0xa35c6a);})['catch'](function(_0x4ae0aa){_0x2ce2ca(_0x4ae0aa);});});}function createEndUser(_0x447a18,_0x30d1e3,_0x3f4ae0,_0x52c0af,_0x9c6ab4,_0x48aeb6){var _0x3f4ae0=getName(_0x3f4ae0);return request({'method':_0x25b0('0x27'),'uri':_0x25b0('0x45')+_0x30d1e3+_0x25b0('0x46')+_[_0x25b0('0x47')](_0x48aeb6['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x3f4ae0[0x1],'First_Name':_0x3f4ae0[0x0],'Phone':_0x52c0af,'Owner':{'name':!_[_0x25b0('0x1f')](_0x9c6ab4[_0x25b0('0x48')][_0x25b0('0x1b')])?_0x9c6ab4[_0x25b0('0x48')][_0x25b0('0x1b')]:!_['isNil'](_0x9c6ab4[_0x25b0('0x49')])?_0x9c6ab4[_0x25b0('0x49')]+'\x20'+_0x9c6ab4[_0x25b0('0x4a')]:_0x9c6ab4[_0x25b0('0x4a')],'id':_0x9c6ab4['id']}}]},'headers':{'Authorization':_0x25b0('0x4b')+_0x447a18},'json':!![]})[_0x25b0('0x2d')](function(_0x51deba){if(_0x51deba&&_0x51deba[_0x25b0('0x43')][0x0][_0x25b0('0x4c')]===_0x25b0('0x4d')){var _0x124d4b=_0x51deba['data'][0x0][_0x25b0('0x4e')];_0x124d4b['enduserType']=_[_0x25b0('0x47')](_0x48aeb6[_0x25b0('0x4f')])+'s';return _0x124d4b;}logger[_0x25b0('0x2f')](_0x25b0('0x40'),JSON['stringify'](data));throw new Error(_0x25b0('0x50')+JSON[_0x25b0('0xe')](data));})[_0x25b0('0x42')](function(_0x5cf035){console[_0x25b0('0x51')](_0x25b0('0x52'),_0x5cf035);});}function getEndUser(_0xfbe61d,_0x4434b1,_0x3b6679,_0x3c6ec1,_0x28bdc4,_0x55ff4c,_0x3ad3b3){var _0x295193={'method':_0x25b0('0x34'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xfbe61d},'json':!![]};switch(_0x3ad3b3[_0x25b0('0x53')]){case _0x25b0('0x54'):_0x295193[_0x25b0('0x55')]=_0x25b0('0x45')+_0x4434b1+_0x25b0('0x56')+_0x28bdc4+'))';return getZohoUser(_0x295193,'Contacts')[_0x25b0('0x2d')](function(_0x1cf933){if(_0x1cf933)return _0x1cf933;_0x295193[_0x25b0('0x55')]='https://www.zohoapis.'+_0x4434b1+_0x25b0('0x57')+_0x28bdc4+'))';return getZohoUser(_0x295193,_0x25b0('0x58'))[_0x25b0('0x2d')](function(_0x1d6d55){if(_0x1d6d55)return _0x1d6d55;if(_0x3ad3b3[_0x25b0('0x4f')]!=_0x25b0('0x59')){return createEndUser(_0xfbe61d,_0x4434b1,_0x3c6ec1,_0x28bdc4,_0x55ff4c,_0x3ad3b3);}else{return{};}});});break;case'contact':_0x295193['uri']='https://www.zohoapis.'+_0x4434b1+_0x25b0('0x56')+_0x28bdc4+'))';return getZohoUser(_0x295193,'Contacts')['then'](function(_0x2c5b9e){if(_0x2c5b9e)return _0x2c5b9e;if(_0x3ad3b3['moduleCreate']!=_0x25b0('0x59')){return createEndUser(_0xfbe61d,_0x4434b1,_0x3c6ec1,_0x28bdc4,_0x55ff4c,_0x3ad3b3);}else{return{};}});break;case'lead':_0x295193['uri']=_0x25b0('0x45')+_0x4434b1+_0x25b0('0x57')+_0x28bdc4+'))';return getZohoUser(_0x295193,_0x25b0('0x58'))[_0x25b0('0x2d')](function(_0x42d139){if(_0x42d139)return _0x42d139;if(_0x3ad3b3[_0x25b0('0x4f')]!=_0x25b0('0x59')){return createEndUser(_0xfbe61d,_0x4434b1,_0x3c6ec1,_0x28bdc4,_0x55ff4c,_0x3ad3b3);}else{return{};}});break;}}function getCall(_0x2d5522,_0x2e68ad,_0x20d56f,_0x48fb71,_0x4d3e9e,_0x582f36,_0xf1e6bf,_0xa45e87){logger[_0x25b0('0x32')](_0x25b0('0x5a'));var _0x14db4c={};_0x14db4c[_0x25b0('0x5b')]={'name':!_[_0x25b0('0x1f')](_0x48fb71['role'][_0x25b0('0x1b')])&&!_['isNil'](_0x48fb71[_0x25b0('0x3d')]['name'])&&_0x48fb71['profile'][_0x25b0('0x1b')]==='administrator'?_0x48fb71['role'][_0x25b0('0x1b')]:!_[_0x25b0('0x1f')](_0x48fb71[_0x25b0('0x49')])?_0x48fb71[_0x25b0('0x49')]+'\x20'+_0x48fb71[_0x25b0('0x4a')]:_0x48fb71[_0x25b0('0x4a')],'id':_0x48fb71['id']};_0x14db4c[_0x25b0('0x5c')]=intUtil[_0x25b0('0x5d')](_0x582f36[_0x25b0('0x5e')],_0xf1e6bf,'\x20');_0x14db4c[_0x25b0('0x5f')]=intUtil['getString'](_0x582f36['Descriptions'],_0xf1e6bf,'\x0a');if(_0x4d3e9e[_0x25b0('0x44')]===_0x25b0('0x60')){_0x14db4c['Who_Id']={'name':!_[_0x25b0('0x1f')](_0x4d3e9e[_0x25b0('0x61')])?_0x4d3e9e[_0x25b0('0x61')]:!_[_0x25b0('0x1f')](_0x4d3e9e[_0x25b0('0x62')])?_0x4d3e9e['First_Name']+'\x20'+_0x4d3e9e[_0x25b0('0x63')]:_0x4d3e9e[_0x25b0('0x63')],'id':_0x4d3e9e['id']};}if(_0x4d3e9e[_0x25b0('0x44')]==='Leads'){_0x14db4c[_0x25b0('0x64')]={'name':!_[_0x25b0('0x1f')](_0x4d3e9e[_0x25b0('0x61')])?_0x4d3e9e[_0x25b0('0x61')]:!_[_0x25b0('0x1f')](_0x4d3e9e[_0x25b0('0x62')])?_0x4d3e9e[_0x25b0('0x62')]+'\x20'+_0x4d3e9e[_0x25b0('0x63')]:_0x4d3e9e[_0x25b0('0x63')],'id':_0x4d3e9e['id']};_0x14db4c[_0x25b0('0x65')]=_[_0x25b0('0x47')](_0x4d3e9e[_0x25b0('0x44')]);}if(_0xf1e6bf[_0x25b0('0x66')]){_0x14db4c[_0x25b0('0x67')]=moment['utc'](parseInt(_0xf1e6bf[_0x25b0('0x66')])*0x3e8)[_0x25b0('0x35')]('mm:ss');}else if(_0xf1e6bf[_0x25b0('0x68')]&&_0xf1e6bf['endtime']){_0x14db4c[_0x25b0('0x67')]=moment[_0x25b0('0x69')](moment(_0xf1e6bf['endtime'],_0x25b0('0x6a'))[_0x25b0('0x6b')](moment(_0xf1e6bf[_0x25b0('0x6c')],'YYYY-MM-DDTHH:mm:ss')))[_0x25b0('0x35')]('mm:ss');}switch(_0xf1e6bf[_0x25b0('0x6d')]){case _0x25b0('0x6e'):_0x14db4c['Call_Result']=_0x25b0('0x6f');break;case _0x25b0('0x70'):case'connect':_0x14db4c[_0x25b0('0x71')]='Answered';break;case'rejected':_0x14db4c['Call_Result']=_0x25b0('0x72');break;case _0x25b0('0x73'):_0x14db4c[_0x25b0('0x71')]='Abandoned';break;case _0x25b0('0x74'):_0x14db4c[_0x25b0('0x71')]=_0x25b0('0x75');default:}_0x14db4c[_0x25b0('0x76')]=(_0xa45e87===_0x25b0('0x77')?moment(_0xf1e6bf[_0x25b0('0x6c')])[_0x25b0('0x35')](_0x25b0('0x6a')):moment(_0xf1e6bf[_0x25b0('0x78')])[_0x25b0('0x35')](_0x25b0('0x6a')))||moment()[_0x25b0('0x35')](_0x25b0('0x6a'));_0x14db4c[_0x25b0('0x79')]=_0xa45e87||_0x25b0('0x7a');_0x14db4c=_[_0x25b0('0x7b')](_0x14db4c,getCustomFields(_0x582f36[_0x25b0('0x7c')],_0xf1e6bf));return request({'method':'POST','uri':_0x25b0('0x45')+_0x2e68ad+'/crm/v2/Calls','headers':{'Authorization':_0x25b0('0x4b')+_0x2d5522},'body':{'data':[_0x14db4c]},'json':!![]})[_0x25b0('0x2d')](function(_0x3e3416){if(_0x3e3416&&_0x3e3416[_0x25b0('0x43')][0x0]['code']===_0x25b0('0x4d')){logger[_0x25b0('0x32')](_0x25b0('0x7d'));return{'id':_0x3e3416[_0x25b0('0x43')][0x0][_0x25b0('0x4e')]['id']};}})[_0x25b0('0x42')](function(_0x5eaf94){logger['info'](_0x25b0('0x7e'),_0x5eaf94['stack']);console[_0x25b0('0x51')](_0x25b0('0x7e'),_0x5eaf94);});}exports[_0x25b0('0x7f')]=function(_0x5279ab,_0x2934c2,_0x1259ad,_0x3953e5,_0x1331dd,_0x56509b){var _0x19347f,_0x14d5b6,_0x2a06c6;_0x56509b['host']=intUtil[_0x25b0('0x80')](_0x56509b[_0x25b0('0x81')]);_0x56509b[_0x25b0('0x82')]=intUtil[_0x25b0('0x80')](_0x56509b[_0x25b0('0x82')]);if(_0x1331dd&&_0x1331dd[_0x25b0('0x83')]){logger[_0x25b0('0x32')](_0x25b0('0x84'),'Recording\x20is\x20enabled!');_0x2934c2[_0x25b0('0x85')]=_0x56509b[_0x25b0('0x82')]+_0x25b0('0x86')+_0x2934c2[_0x25b0('0x87')]+'/downloads?type=uniqueid&token='+md5(_0x2934c2['uniqueid']);}else{_0x2934c2[_0x25b0('0x85')]='';}var _0x330daa=_0x56509b[_0x25b0('0x81')]===_0x25b0('0x88')?'eu':'com';return getAccessToken(_0x56509b)[_0x25b0('0x2d')](function(_0x4ac6b7){_0x2a06c6=_0x4ac6b7;return getUser(_0x2a06c6,_0x330daa,_0x56509b,_0x3953e5['email']);})[_0x25b0('0x2d')](function(_0x23e75b){_0x19347f=_0x23e75b;logger['info']('The\x20User\x20ID\x20is:',_0x19347f['id']);return getEndUser(_0x2a06c6,_0x330daa,_0x56509b,_0x2934c2[_0x25b0('0x89')],_0x2934c2[_0x25b0('0x8a')],_0x19347f,_0x1259ad);})[_0x25b0('0x2d')](function(_0x2ea20e){_0x14d5b6=_0x2ea20e;return getCall(_0x2a06c6,_0x330daa,_0x56509b,_0x19347f,_0x14d5b6,_0x1259ad,_0x2934c2,_0x25b0('0x7a'));})[_0x25b0('0x2d')](function(_0x2b43d4){if(_0x2b43d4){logger[_0x25b0('0x32')](_0x25b0('0x8b'),_0x2b43d4['id']);logger[_0x25b0('0x32')](_0x25b0('0x84'),_0x25b0('0x8c'));emit(util[_0x25b0('0x35')]('user:%s',_0x3953e5[_0x25b0('0x1b')]),'trigger:browser:url',{'uri':_0x25b0('0x8d')+_0x56509b[_0x25b0('0x81')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2b43d4['id']});}})[_0x25b0('0x42')](function(_0x703de9){logger[_0x25b0('0x2f')](_0x25b0('0x84'),JSON[_0x25b0('0xe')](_0x703de9));});};exports[_0x25b0('0x77')]=function(_0x1854f1,_0x3f6b41,_0x2e729f,_0xd5351e,_0x36252f,_0x581e22,_0x4de403){var _0x24b839,_0xe3b71,_0x5d3202;_0x581e22['host']=intUtil[_0x25b0('0x80')](_0x581e22['host']);_0x581e22[_0x25b0('0x82')]=intUtil[_0x25b0('0x80')](_0x581e22['serverUrl']);if(_0x4de403&&_0x4de403[_0x25b0('0x8e')]&&_0x4de403[_0x25b0('0x8e')]!=='none'){logger[_0x25b0('0x32')](_0x25b0('0x8f'),_0x25b0('0x90'));_0x3f6b41[_0x25b0('0x85')]=_0x581e22[_0x25b0('0x82')]+'/api/voice/recordings/'+_0x3f6b41['uniqueid']+_0x25b0('0x91')+md5(_0x3f6b41['uniqueid']);}var _0x5adb23=_0x581e22['host']===_0x25b0('0x88')?'eu':_0x25b0('0x92');return getAccessToken(_0x581e22)[_0x25b0('0x2d')](function(_0x4e321b){_0x5d3202=_0x4e321b;return getUser(_0x5d3202,_0x5adb23,_0x581e22,_0xd5351e['email']);})[_0x25b0('0x2d')](function(_0x3aaddc){_0x24b839=_0x3aaddc;logger['info']('The\x20User\x20ID\x20is:',_0x24b839['id']);return getEndUser(_0x5d3202,_0x5adb23,_0x581e22,_0x3f6b41['destcalleridname'],_0x3f6b41[_0x25b0('0x93')],_0x24b839,_0x2e729f);})[_0x25b0('0x2d')](function(_0x1e64de){_0xe3b71=_0x1e64de;return getCall(_0x5d3202,_0x5adb23,_0x581e22,_0x24b839,_0xe3b71,_0x2e729f,_0x3f6b41,_0x25b0('0x94'));})['then'](function(_0x829aa5){if(_0x829aa5){logger[_0x25b0('0x32')](_0x25b0('0x8b'),_0x829aa5['id']);logger[_0x25b0('0x32')](_0x25b0('0x8f'),_0x25b0('0x8c'));emit(util[_0x25b0('0x35')](_0x25b0('0x95'),_0xd5351e[_0x25b0('0x1b')]),_0x25b0('0x96'),{'uri':_0x25b0('0x8d')+_0x581e22[_0x25b0('0x81')]+_0x25b0('0x97')+_0x829aa5['id']});}})[_0x25b0('0x42')](function(_0x1911d2){logger[_0x25b0('0x2f')](_0x25b0('0x8f'),JSON[_0x25b0('0xe')](_0x1911d2));});};exports['unmanaged']=function(_0x5b0091,_0x14ac78,_0x5c6c77,_0x2893b3,_0x53908c,_0x494088){var _0x5abcad,_0x4cb24c,_0x4a083a;_0x494088[_0x25b0('0x81')]=intUtil[_0x25b0('0x80')](_0x494088[_0x25b0('0x81')]);_0x494088['serverUrl']=intUtil[_0x25b0('0x80')](_0x494088[_0x25b0('0x82')]);if(_0x53908c&&_0x53908c['monitor_format']){logger[_0x25b0('0x32')]('['+_0x14ac78[_0x25b0('0x6d')][_0x25b0('0x98')]()+']',_0x25b0('0x90'));_0x14ac78[_0x25b0('0x85')]=_0x494088[_0x25b0('0x82')]+_0x25b0('0x86')+_0x14ac78[_0x25b0('0x87')]+_0x25b0('0x91')+md5(_0x14ac78[_0x25b0('0x87')]);}else{_0x14ac78[_0x25b0('0x85')]='';}var _0x116f56=_0x494088[_0x25b0('0x81')]===_0x25b0('0x88')?'eu':_0x25b0('0x92');return getAccessToken(_0x494088)[_0x25b0('0x2d')](function(_0x20b00b){_0x4a083a=_0x20b00b;return getUser(_0x4a083a,_0x116f56,_0x494088);})['then'](function(_0x2e6b99){_0x5abcad=_0x2e6b99;logger[_0x25b0('0x32')](_0x25b0('0x99'),_0x5abcad['id']);return getEndUser(_0x4a083a,_0x116f56,_0x494088,_0x14ac78[_0x25b0('0x89')],_0x14ac78[_0x25b0('0x8a')],_0x5abcad,_0x5c6c77);})['then'](function(_0x765c81){_0x4cb24c=_0x765c81;return getCall(_0x4a083a,_0x116f56,_0x494088,_0x5abcad,_0x4cb24c,_0x5c6c77,_0x14ac78,'Inbound');})[_0x25b0('0x2d')](function(_0x514269){if(_0x514269){logger['info'](_0x25b0('0x8b'),_0x514269['id']);}})['catch'](function(_0x363d46){logger[_0x25b0('0x2f')]('['+_0x14ac78['lastevent'][_0x25b0('0x98')]()+']',JSON[_0x25b0('0xe')](_0x363d46));});}; \ No newline at end of file +var _0x4ea3=['https://accounts.zoho.com.cn','POST','clientSecret','refresh_token','then','add','expires_in','seconds','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','findIndex','email','Agent\x20found!','info','profile','user','error','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','catch','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','first_name','last_name','Zoho-oauthtoken\x20','code','data','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','Contacts','uri','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','role','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','utc','answertime','Call_Duration','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Timeout','Call_Start_Time','Call_Type','Inbound','Fields','/crm/v2/Calls','err','queue','host','stripTrailingSlash','serverUrl','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','none','[OUTBOUND]','Recording\x20is\x20enabled!','com','destcalleridname','destcalleridnum','Outbound','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','calleridnum','lodash','request-promise','md5','util','moment','bluebird','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','length','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu'];(function(_0x3722b3,_0x18a764){var _0x4614ae=function(_0x522c8e){while(--_0x522c8e){_0x3722b3['push'](_0x3722b3['shift']());}};_0x4614ae(++_0x18a764);}(_0x4ea3,0x70));var _0x34ea=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4ea3[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x34ea('0x0'));var rp=require(_0x34ea('0x1'));var md5=require(_0x34ea('0x2'));var util=require(_0x34ea('0x3'));var intUtil=require('./util');var moment=require(_0x34ea('0x4'));var Redis=require('ioredis');var BPromise=require(_0x34ea('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x34ea('0x6'));config[_0x34ea('0x7')]=_[_0x34ea('0x8')](config[_0x34ea('0x7')],{'host':_0x34ea('0x9'),'port':0x18eb});var io=require(_0x34ea('0xa'))(new Redis(config[_0x34ea('0x7')]));function emit(_0x5bec7c,_0x341727,_0x6e9ccc){io['to'](_0x5bec7c)[_0x34ea('0xb')](_0x341727,_0x6e9ccc);}function request(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),JSON['stringify'](_0x5132c4));return rp(_0x5132c4);}function getCustomFields(_0x4a76b1,_0x5bd8b6){var _0x346287={};if(_0x4a76b1[_0x34ea('0xe')]>0x0){_['forEach'](_0x4a76b1,function(_0x11229e){if(_[_0x34ea('0xf')]([_0x34ea('0x10'),_0x34ea('0x11')],_0x11229e[_0x34ea('0x12')])&&_0x11229e[_0x34ea('0x13')]){_0x346287[_0x11229e[_0x34ea('0x13')]]=_0x11229e[_0x34ea('0x14')][_0x34ea('0x15')]();}else if(_0x11229e[_0x34ea('0x12')]===_0x34ea('0x16')&&_0x11229e['variableName']&&_0x11229e[_0x34ea('0x13')]&&_0x5bd8b6[_0x11229e[_0x34ea('0x17')]]){_0x346287[_0x11229e[_0x34ea('0x13')]]=_0x5bd8b6[_0x11229e[_0x34ea('0x17')]][_0x34ea('0x15')]();}else if(_0x11229e['type']===_0x34ea('0x18')&&_0x11229e[_0x34ea('0x19')]&&_0x11229e[_0x34ea('0x19')][_0x34ea('0x1a')]&&_0x11229e['idField']&&_0x5bd8b6[_0x11229e[_0x34ea('0x19')][_0x34ea('0x1a')][_0x34ea('0x1b')]()]){_0x346287[_0x11229e['idField']]=_0x5bd8b6[_0x11229e[_0x34ea('0x19')][_0x34ea('0x1a')][_0x34ea('0x1b')]()][_0x34ea('0x15')]();}});}return _0x346287;}function getName(_0x52af16){if(_0x52af16[_0x34ea('0x1c')]('\x20')>0x0){var _0x35328c=_0x52af16[_0x34ea('0x1d')](/ (.+)/);if(_0x35328c[0x1]){return _0x35328c;}}return[_0x52af16,_0x52af16];}var accountsTokens={};function getAccessToken(_0x247ee7){return new Promise(function(_0x4fc1a2,_0x55277a){if(!_[_0x34ea('0x1e')](accountsTokens[_0x247ee7['id']])&&!_[_0x34ea('0x1e')](accountsTokens[_0x247ee7['id']][_0x34ea('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x247ee7['id']]['expires_in'])){_0x4fc1a2(accountsTokens[_0x247ee7['id']][_0x34ea('0x1f')]);}}var _0x3ff80e;switch(_0x247ee7[_0x34ea('0x20')]){case'US':_0x3ff80e=_0x34ea('0x21');break;case'AU':_0x3ff80e=_0x34ea('0x22');break;case'EU':_0x3ff80e=_0x34ea('0x23');break;case'IN':_0x3ff80e='https://accounts.zoho.in';break;case'CN':_0x3ff80e=_0x34ea('0x24');break;default:_0x3ff80e=_0x34ea('0x23');break;}var _0x3c0983={'method':_0x34ea('0x25'),'uri':_0x3ff80e+'/oauth/v2/token','qs':{'refresh_token':_0x247ee7['refreshToken'],'client_id':_0x247ee7['clientId'],'client_secret':_0x247ee7[_0x34ea('0x26')],'grant_type':_0x34ea('0x27')},'json':!![]};return rp(_0x3c0983)[_0x34ea('0x28')](function(_0x4204d7){accountsTokens[_0x247ee7['id']]={'access_token':_0x4204d7['access_token'],'expires_in':moment()[_0x34ea('0x29')](_0x4204d7[_0x34ea('0x2a')],_0x34ea('0x2b'))};_0x4fc1a2(_0x4204d7['access_token']);})['catch'](function(_0x5b4727){logger['error'](_0x34ea('0x2c'),_0x5b4727[_0x34ea('0x2d')]);_0x55277a(_0x5b4727);});});}function getUser(_0x859b7e,_0x162081,_0x56c9dd,_0x216379){logger['info'](_0x34ea('0x2e'));return request({'method':'GET','uri':util[_0x34ea('0x2f')](_0x34ea('0x30'),_0x162081),'qs':{'type':_0x34ea('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x859b7e},'json':!![]})[_0x34ea('0x28')](function(_0x1048ea){if(_0x1048ea['users']){var _0x10bcfe=-0x1;if(_['isArrayLikeObject'](_0x1048ea[_0x34ea('0x32')])){if(!_[_0x34ea('0x1e')](_0x216379)){_0x10bcfe=_[_0x34ea('0x33')](_0x1048ea['users'],function(_0x4c5fb4){return _0x4c5fb4[_0x34ea('0x34')]===_0x216379;});}if(_0x10bcfe>=0x0){logger['info'](_0x34ea('0x35'));}else{logger[_0x34ea('0x36')]('Using\x20the\x20admin\x20account!');_0x10bcfe=_[_0x34ea('0x33')](_0x1048ea[_0x34ea('0x32')],function(_0x2cdde6){return _0x2cdde6[_0x34ea('0x37')]['name']==='Administrator';});}return _0x1048ea['users'][_0x10bcfe];}else{if(_0x1048ea[_0x34ea('0x38')][_0x34ea('0x37')][_0x34ea('0x1a')]==='Administrator'){logger['info']('Using\x20the\x20admin\x20account!');user=_0x1048ea[_0x34ea('0x38')];return user;}else{logger[_0x34ea('0x39')]('The\x20failing\x20result\x20is',JSON[_0x34ea('0x3a')](_0x1048ea));throw new Error(_0x34ea('0x3b')+JSON[_0x34ea('0x3a')](_0x1048ea));}}}else{logger[_0x34ea('0x39')](_0x34ea('0x3c'),JSON[_0x34ea('0x3a')](_0x1048ea));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x34ea('0x3a')](_0x1048ea));}})[_0x34ea('0x3d')](function(_0x60f384){console[_0x34ea('0x39')](_0x60f384);});}function getZohoUser(_0x4f05fc,_0x5c44ab){return new BPromise(function(_0x6f024c,_0x2327bc){request(_0x4f05fc)[_0x34ea('0x28')](function(_0x19f401){var _0x29260c=null;if(_0x19f401){_0x29260c=_0x19f401['data'][0x0];_0x29260c[_0x34ea('0x3e')]=_0x5c44ab;}_0x6f024c(_0x29260c);})[_0x34ea('0x3d')](function(_0x475313){_0x2327bc(_0x475313);});});}function createEndUser(_0x3a6a90,_0x5787db,_0x4743f1,_0x2e8e46,_0xa1ff39,_0x38d3b0){var _0x4743f1=getName(_0x4743f1);return request({'method':_0x34ea('0x25'),'uri':_0x34ea('0x3f')+_0x5787db+_0x34ea('0x40')+_[_0x34ea('0x41')](_0x38d3b0[_0x34ea('0x42')])+'s','body':{'data':[{'Last_Name':_0x4743f1[0x1],'First_Name':_0x4743f1[0x0],'Phone':_0x2e8e46,'Owner':{'name':!_[_0x34ea('0x1e')](_0xa1ff39['role'][_0x34ea('0x1a')])?_0xa1ff39['role'][_0x34ea('0x1a')]:!_[_0x34ea('0x1e')](_0xa1ff39[_0x34ea('0x43')])?_0xa1ff39[_0x34ea('0x43')]+'\x20'+_0xa1ff39[_0x34ea('0x44')]:_0xa1ff39[_0x34ea('0x44')],'id':_0xa1ff39['id']}}]},'headers':{'Authorization':_0x34ea('0x45')+_0x3a6a90},'json':!![]})[_0x34ea('0x28')](function(_0xb24a7a){if(_0xb24a7a&&_0xb24a7a['data'][0x0][_0x34ea('0x46')]==='SUCCESS'){var _0x45f170=_0xb24a7a[_0x34ea('0x47')][0x0][_0x34ea('0x48')];_0x45f170[_0x34ea('0x3e')]=_[_0x34ea('0x41')](_0x38d3b0[_0x34ea('0x42')])+'s';return _0x45f170;}logger['error'](_0x34ea('0x3c'),JSON[_0x34ea('0x3a')](data));throw new Error('Error:\x20'+JSON[_0x34ea('0x3a')](data));})[_0x34ea('0x3d')](function(_0x324928){console[_0x34ea('0x49')](_0x34ea('0x4a'),_0x324928);});}function getEndUser(_0x5d8dc9,_0x4384cc,_0x180444,_0x3f7456,_0x2487bd,_0x3e2e61,_0x16c1a6){var _0x4887c5={'method':'GET','uri':'','headers':{'Authorization':_0x34ea('0x45')+_0x5d8dc9},'json':!![]};switch(_0x16c1a6[_0x34ea('0x4b')]){case _0x34ea('0x4c'):_0x4887c5['uri']=_0x34ea('0x3f')+_0x4384cc+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2487bd+'))';return getZohoUser(_0x4887c5,_0x34ea('0x4d'))['then'](function(_0x2e7e4c){if(_0x2e7e4c)return _0x2e7e4c;_0x4887c5[_0x34ea('0x4e')]=_0x34ea('0x3f')+_0x4384cc+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2487bd+'))';return getZohoUser(_0x4887c5,_0x34ea('0x4f'))['then'](function(_0x404a59){if(_0x404a59)return _0x404a59;if(_0x16c1a6[_0x34ea('0x42')]!=_0x34ea('0x50')){return createEndUser(_0x5d8dc9,_0x4384cc,_0x3f7456,_0x2487bd,_0x3e2e61,_0x16c1a6);}else{return{};}});});break;case _0x34ea('0x51'):_0x4887c5['uri']=_0x34ea('0x3f')+_0x4384cc+_0x34ea('0x52')+_0x2487bd+'))';return getZohoUser(_0x4887c5,_0x34ea('0x4d'))[_0x34ea('0x28')](function(_0x3df3c8){if(_0x3df3c8)return _0x3df3c8;if(_0x16c1a6[_0x34ea('0x42')]!=_0x34ea('0x50')){return createEndUser(_0x5d8dc9,_0x4384cc,_0x3f7456,_0x2487bd,_0x3e2e61,_0x16c1a6);}else{return{};}});break;case'lead':_0x4887c5[_0x34ea('0x4e')]=_0x34ea('0x3f')+_0x4384cc+_0x34ea('0x53')+_0x2487bd+'))';return getZohoUser(_0x4887c5,_0x34ea('0x4f'))[_0x34ea('0x28')](function(_0x85bef8){if(_0x85bef8)return _0x85bef8;if(_0x16c1a6[_0x34ea('0x42')]!=_0x34ea('0x50')){return createEndUser(_0x5d8dc9,_0x4384cc,_0x3f7456,_0x2487bd,_0x3e2e61,_0x16c1a6);}else{return{};}});break;}}function getCall(_0x11a9f7,_0x3a1546,_0x2b8990,_0x2b7ff4,_0x28bc5e,_0x56ddc5,_0x1d01f2,_0x3bf855){logger[_0x34ea('0x36')]('Creating\x20new\x20call...');var _0x379a87={};_0x379a87['Owner']={'name':!_[_0x34ea('0x1e')](_0x2b7ff4[_0x34ea('0x54')]['name'])&&!_[_0x34ea('0x1e')](_0x2b7ff4[_0x34ea('0x37')][_0x34ea('0x1a')])&&_0x2b7ff4['profile']['name']===_0x34ea('0x55')?_0x2b7ff4['role']['name']:!_[_0x34ea('0x1e')](_0x2b7ff4['first_name'])?_0x2b7ff4[_0x34ea('0x43')]+'\x20'+_0x2b7ff4[_0x34ea('0x44')]:_0x2b7ff4[_0x34ea('0x44')],'id':_0x2b7ff4['id']};_0x379a87[_0x34ea('0x56')]=intUtil[_0x34ea('0x57')](_0x56ddc5[_0x34ea('0x58')],_0x1d01f2,'\x20');_0x379a87[_0x34ea('0x59')]=intUtil[_0x34ea('0x57')](_0x56ddc5[_0x34ea('0x5a')],_0x1d01f2,'\x0a');if(_0x28bc5e[_0x34ea('0x3e')]===_0x34ea('0x4d')){_0x379a87[_0x34ea('0x5b')]={'name':!_[_0x34ea('0x1e')](_0x28bc5e[_0x34ea('0x5c')])?_0x28bc5e[_0x34ea('0x5c')]:!_[_0x34ea('0x1e')](_0x28bc5e['First_Name'])?_0x28bc5e[_0x34ea('0x5d')]+'\x20'+_0x28bc5e['Last_Name']:_0x28bc5e[_0x34ea('0x5e')],'id':_0x28bc5e['id']};}if(_0x28bc5e[_0x34ea('0x3e')]===_0x34ea('0x4f')){_0x379a87[_0x34ea('0x5f')]={'name':!_[_0x34ea('0x1e')](_0x28bc5e[_0x34ea('0x5c')])?_0x28bc5e['Full_Name']:!_[_0x34ea('0x1e')](_0x28bc5e[_0x34ea('0x5d')])?_0x28bc5e[_0x34ea('0x5d')]+'\x20'+_0x28bc5e[_0x34ea('0x5e')]:_0x28bc5e[_0x34ea('0x5e')],'id':_0x28bc5e['id']};_0x379a87['$se_module']=_[_0x34ea('0x41')](_0x28bc5e['enduserType']);}if(_0x1d01f2['talktime']){_0x379a87['Call_Duration']=moment[_0x34ea('0x60')](parseInt(_0x1d01f2['talktime'])*0x3e8)[_0x34ea('0x2f')]('mm:ss');}else if(_0x1d01f2[_0x34ea('0x61')]&&_0x1d01f2['endtime']){_0x379a87[_0x34ea('0x62')]=moment['utc'](moment(_0x1d01f2[_0x34ea('0x63')],_0x34ea('0x64'))[_0x34ea('0x65')](moment(_0x1d01f2[_0x34ea('0x66')],_0x34ea('0x64'))))['format']('mm:ss');}switch(_0x1d01f2[_0x34ea('0x67')]){case _0x34ea('0x68'):_0x379a87[_0x34ea('0x69')]=_0x34ea('0x6a');break;case _0x34ea('0x6b'):case _0x34ea('0x6c'):_0x379a87[_0x34ea('0x69')]=_0x34ea('0x6d');break;case _0x34ea('0x6e'):_0x379a87['Call_Result']=_0x34ea('0x6f');break;case _0x34ea('0x70'):_0x379a87[_0x34ea('0x69')]='Abandoned';break;case'timeout':_0x379a87[_0x34ea('0x69')]=_0x34ea('0x71');default:}_0x379a87[_0x34ea('0x72')]=(_0x3bf855==='outbound'?moment(_0x1d01f2[_0x34ea('0x66')])[_0x34ea('0x2f')](_0x34ea('0x64')):moment(_0x1d01f2['agentcalledAt'])[_0x34ea('0x2f')](_0x34ea('0x64')))||moment()['format'](_0x34ea('0x64'));_0x379a87[_0x34ea('0x73')]=_0x3bf855||_0x34ea('0x74');_0x379a87=_['merge'](_0x379a87,getCustomFields(_0x56ddc5[_0x34ea('0x75')],_0x1d01f2));return request({'method':'POST','uri':_0x34ea('0x3f')+_0x3a1546+_0x34ea('0x76'),'headers':{'Authorization':_0x34ea('0x45')+_0x11a9f7},'body':{'data':[_0x379a87]},'json':!![]})[_0x34ea('0x28')](function(_0x5f5037){if(_0x5f5037&&_0x5f5037[_0x34ea('0x47')][0x0][_0x34ea('0x46')]==='SUCCESS'){logger[_0x34ea('0x36')]('Call\x20created!');return{'id':_0x5f5037[_0x34ea('0x47')][0x0][_0x34ea('0x48')]['id']};}})[_0x34ea('0x3d')](function(_0x5bcfa9){logger[_0x34ea('0x36')](_0x34ea('0x77'),_0x5bcfa9[_0x34ea('0x2d')]);console[_0x34ea('0x49')]('err',_0x5bcfa9);});}exports[_0x34ea('0x78')]=function(_0x20ab68,_0x10babe,_0x405da9,_0x51862a,_0x5655ee,_0x142367){var _0x3200f7,_0x559d50,_0x114a49;_0x142367[_0x34ea('0x79')]=intUtil[_0x34ea('0x7a')](_0x142367['host']);_0x142367['serverUrl']=intUtil['stripTrailingSlash'](_0x142367[_0x34ea('0x7b')]);if(_0x5655ee&&_0x5655ee['monitor_format']){logger[_0x34ea('0x36')]('[QUEUE]','Recording\x20is\x20enabled!');_0x10babe['recordingURL']=_0x142367[_0x34ea('0x7b')]+_0x34ea('0x7c')+_0x10babe[_0x34ea('0x7d')]+_0x34ea('0x7e')+md5(_0x10babe[_0x34ea('0x7d')]);}else{_0x10babe[_0x34ea('0x7f')]='';}var _0x18fdb9=_0x142367[_0x34ea('0x79')]===_0x34ea('0x80')?'eu':'com';return getAccessToken(_0x142367)[_0x34ea('0x28')](function(_0x5284c1){_0x114a49=_0x5284c1;return getUser(_0x114a49,_0x18fdb9,_0x142367,_0x51862a['email']);})[_0x34ea('0x28')](function(_0x5e2cd6){_0x3200f7=_0x5e2cd6;logger[_0x34ea('0x36')](_0x34ea('0x81'),_0x3200f7['id']);return getEndUser(_0x114a49,_0x18fdb9,_0x142367,_0x10babe[_0x34ea('0x82')],_0x10babe['calleridnum'],_0x3200f7,_0x405da9);})[_0x34ea('0x28')](function(_0x4fbac1){_0x559d50=_0x4fbac1;return getCall(_0x114a49,_0x18fdb9,_0x142367,_0x3200f7,_0x559d50,_0x405da9,_0x10babe,_0x34ea('0x74'));})[_0x34ea('0x28')](function(_0x2b0a4e){if(_0x2b0a4e){logger[_0x34ea('0x36')](_0x34ea('0x83'),_0x2b0a4e['id']);logger[_0x34ea('0x36')](_0x34ea('0x84'),_0x34ea('0x85'));emit(util['format'](_0x34ea('0x86'),_0x51862a[_0x34ea('0x1a')]),_0x34ea('0x87'),{'uri':_0x34ea('0x88')+_0x142367[_0x34ea('0x79')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2b0a4e['id']});}})[_0x34ea('0x3d')](function(_0x56c6a6){logger[_0x34ea('0x39')]('[QUEUE]',JSON['stringify'](_0x56c6a6));});};exports['outbound']=function(_0x3bc819,_0x5a2e6b,_0x153890,_0x4945ea,_0x221a2f,_0x544df8,_0x2ea011){var _0x5be99d,_0x56c24f,_0x412dbc;_0x544df8[_0x34ea('0x79')]=intUtil[_0x34ea('0x7a')](_0x544df8[_0x34ea('0x79')]);_0x544df8[_0x34ea('0x7b')]=intUtil['stripTrailingSlash'](_0x544df8[_0x34ea('0x7b')]);if(_0x2ea011&&_0x2ea011['recordingFormat']&&_0x2ea011['recordingFormat']!==_0x34ea('0x89')){logger[_0x34ea('0x36')](_0x34ea('0x8a'),_0x34ea('0x8b'));_0x5a2e6b['recordingURL']=_0x544df8[_0x34ea('0x7b')]+_0x34ea('0x7c')+_0x5a2e6b[_0x34ea('0x7d')]+_0x34ea('0x7e')+md5(_0x5a2e6b[_0x34ea('0x7d')]);}var _0xce309a=_0x544df8[_0x34ea('0x79')]===_0x34ea('0x80')?'eu':_0x34ea('0x8c');return getAccessToken(_0x544df8)[_0x34ea('0x28')](function(_0x18fbf9){_0x412dbc=_0x18fbf9;return getUser(_0x412dbc,_0xce309a,_0x544df8,_0x4945ea[_0x34ea('0x34')]);})[_0x34ea('0x28')](function(_0x1ac63d){_0x5be99d=_0x1ac63d;logger[_0x34ea('0x36')]('The\x20User\x20ID\x20is:',_0x5be99d['id']);return getEndUser(_0x412dbc,_0xce309a,_0x544df8,_0x5a2e6b[_0x34ea('0x8d')],_0x5a2e6b[_0x34ea('0x8e')],_0x5be99d,_0x153890);})[_0x34ea('0x28')](function(_0x55c3a4){_0x56c24f=_0x55c3a4;return getCall(_0x412dbc,_0xce309a,_0x544df8,_0x5be99d,_0x56c24f,_0x153890,_0x5a2e6b,_0x34ea('0x8f'));})['then'](function(_0x3541cd){if(_0x3541cd){logger[_0x34ea('0x36')](_0x34ea('0x83'),_0x3541cd['id']);logger[_0x34ea('0x36')](_0x34ea('0x8a'),_0x34ea('0x85'));emit(util[_0x34ea('0x2f')](_0x34ea('0x86'),_0x4945ea[_0x34ea('0x1a')]),'trigger:browser:url',{'uri':_0x34ea('0x88')+_0x544df8['host']+_0x34ea('0x90')+_0x3541cd['id']});}})[_0x34ea('0x3d')](function(_0x3224ac){logger[_0x34ea('0x39')](_0x34ea('0x8a'),JSON['stringify'](_0x3224ac));});};exports[_0x34ea('0x91')]=function(_0x4c27f4,_0x4b571b,_0x58d4d2,_0x4b22d9,_0x1c8001,_0x208aa6){var _0x46344b,_0x4d5eb8,_0x429243;_0x208aa6[_0x34ea('0x79')]=intUtil[_0x34ea('0x7a')](_0x208aa6[_0x34ea('0x79')]);_0x208aa6[_0x34ea('0x7b')]=intUtil['stripTrailingSlash'](_0x208aa6[_0x34ea('0x7b')]);if(_0x1c8001&&_0x1c8001['monitor_format']){logger[_0x34ea('0x36')]('['+_0x4b571b[_0x34ea('0x67')][_0x34ea('0x92')]()+']',_0x34ea('0x8b'));_0x4b571b[_0x34ea('0x7f')]=_0x208aa6[_0x34ea('0x7b')]+'/api/voice/recordings/'+_0x4b571b[_0x34ea('0x7d')]+_0x34ea('0x7e')+md5(_0x4b571b[_0x34ea('0x7d')]);}else{_0x4b571b[_0x34ea('0x7f')]='';}var _0x596e26=_0x208aa6[_0x34ea('0x79')]===_0x34ea('0x80')?'eu':'com';return getAccessToken(_0x208aa6)[_0x34ea('0x28')](function(_0x46683d){_0x429243=_0x46683d;return getUser(_0x429243,_0x596e26,_0x208aa6);})[_0x34ea('0x28')](function(_0x2e8473){_0x46344b=_0x2e8473;logger[_0x34ea('0x36')](_0x34ea('0x81'),_0x46344b['id']);return getEndUser(_0x429243,_0x596e26,_0x208aa6,_0x4b571b['calleridname'],_0x4b571b[_0x34ea('0x93')],_0x46344b,_0x58d4d2);})[_0x34ea('0x28')](function(_0xd1fc1b){_0x4d5eb8=_0xd1fc1b;return getCall(_0x429243,_0x596e26,_0x208aa6,_0x46344b,_0x4d5eb8,_0x58d4d2,_0x4b571b,_0x34ea('0x74'));})[_0x34ea('0x28')](function(_0x16c363){if(_0x16c363){logger[_0x34ea('0x36')]('The\x20Call\x20ID\x20is:',_0x16c363['id']);}})[_0x34ea('0x3d')](function(_0x30b728){logger[_0x34ea('0x39')]('['+_0x4b571b[_0x34ea('0x67')]['toUpperCase']()+']',JSON[_0x34ea('0x3a')](_0x30b728));});}; \ 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 f778c1f..e6ec5dd 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 _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x3564ce,_0x177213){var _0x4940fe=function(_0x394635){while(--_0x394635){_0x3564ce['push'](_0x3564ce['shift']());}};_0x4940fe(++_0x177213);}(_0x7a54,0x106));var _0x47a5=function(_0x43a9c0,_0x7cd2b7){_0x43a9c0=_0x43a9c0-0x0;var _0x20bc84=_0x7a54[_0x43a9c0];return _0x20bc84;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x5b4878,_0x257f8a){var _0x347ed6=function(_0x227637){while(--_0x227637){_0x5b4878['push'](_0x5b4878['shift']());}};_0x347ed6(++_0x257f8a);}(_0x7a54,0x106));var _0x47a5=function(_0x383547,_0x4402d4){_0x383547=_0x383547-0x0;var _0x247fc7=_0x7a54[_0x383547];return _0x247fc7;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ 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 31992c4..1094db1 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 _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x3e300b,_0x22ac82){var _0xe1ea37=function(_0x4242e3){while(--_0x4242e3){_0x3e300b['push'](_0x3e300b['shift']());}};_0xe1ea37(++_0x22ac82);}(_0xb10b,0x12a));var _0xbb10=function(_0x348b29,_0x3be5e9){_0x348b29=_0x348b29-0x0;var _0xc260c5=_0xb10b[_0x348b29];return _0xc260c5;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x44fef2,_0x580138){var _0x43e5d4=function(_0x3332a3){while(--_0x3332a3){_0x44fef2['push'](_0x44fef2['shift']());}};_0x43e5d4(++_0x580138);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4b96d1,_0x5c5faf){_0x4b96d1=_0x4b96d1-0x0;var _0x926452=_0x5f2f[_0x4b96d1];return _0x926452;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index f673f02..b281935 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 _0x34aa=['error','message','result','catch','exports','jayson/promise','../../config/logger','routing','client','http','request','then','debug','rpc'];(function(_0x5d67e1,_0x308ffc){var _0x156bda=function(_0x45f853){while(--_0x45f853){_0x5d67e1['push'](_0x5d67e1['shift']());}};_0x156bda(++_0x308ffc);}(_0x34aa,0x171));var _0xa34a=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0x34aa[_0x316c42];return _0x2b38f7;};'use strict';var jayson=require(_0xa34a('0x0'));var BPromise=require('bluebird');var logger=require(_0xa34a('0x1'))(_0xa34a('0x2'));var client=jayson[_0xa34a('0x3')][_0xa34a('0x4')]({'port':0x2329});client['Request']=function(_0x1d7a4f,_0x30f3a2){return new BPromise(function(_0x284561,_0x1db413){return client[_0xa34a('0x5')](_0x1d7a4f,_0x30f3a2)[_0xa34a('0x6')](function(_0x27349c){logger[_0xa34a('0x7')](_0xa34a('0x8'),_0xa34a('0x2'),_0x1d7a4f,_0x30f3a2,_0x27349c);if(_0x27349c[_0xa34a('0x9')]){logger['error'](_0xa34a('0x8'),_0xa34a('0x2'),_0x1d7a4f,_0x27349c[_0xa34a('0x9')][_0xa34a('0xa')],_0x30f3a2);return _0x1db413(_0x27349c[_0xa34a('0x9')]['message']);}else{return _0x284561(_0x27349c[_0xa34a('0xb')]);}})[_0xa34a('0xc')](function(_0x1c8e32){logger[_0xa34a('0x9')](_0xa34a('0x8'),_0xa34a('0x2'),_0x1d7a4f,_0x1c8e32,_0x30f3a2);return _0x1db413(_0x1c8e32);});});};module[_0xa34a('0xd')]=client; \ No newline at end of file +var _0x5d55=['bluebird','routing','client','Request','request','then','debug','rpc','error','message','catch','exports'];(function(_0x424d43,_0x5dcb5e){var _0x3cd680=function(_0x2db866){while(--_0x2db866){_0x424d43['push'](_0x424d43['shift']());}};_0x3cd680(++_0x5dcb5e);}(_0x5d55,0x1a4));var _0x55d5=function(_0x554265,_0x16d870){_0x554265=_0x554265-0x0;var _0x1e0614=_0x5d55[_0x554265];return _0x1e0614;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x55d5('0x0'));var logger=require('../../config/logger')(_0x55d5('0x1'));var client=jayson[_0x55d5('0x2')]['http']({'port':0x2329});client[_0x55d5('0x3')]=function(_0x12beec,_0x3bca0b){return new BPromise(function(_0x546e6c,_0x2b35a2){return client[_0x55d5('0x4')](_0x12beec,_0x3bca0b)[_0x55d5('0x5')](function(_0x35fe43){logger[_0x55d5('0x6')](_0x55d5('0x7'),_0x55d5('0x1'),_0x12beec,_0x3bca0b,_0x35fe43);if(_0x35fe43[_0x55d5('0x8')]){logger[_0x55d5('0x8')]('rpc',_0x55d5('0x1'),_0x12beec,_0x35fe43[_0x55d5('0x8')][_0x55d5('0x9')],_0x3bca0b);return _0x2b35a2(_0x35fe43[_0x55d5('0x8')][_0x55d5('0x9')]);}else{return _0x546e6c(_0x35fe43['result']);}})[_0x55d5('0xa')](function(_0x5d97d3){logger[_0x55d5('0x8')](_0x55d5('0x7'),_0x55d5('0x1'),_0x12beec,_0x5d97d3,_0x3bca0b);return _0x2b35a2(_0x5d97d3);});});};module[_0x55d5('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index e556aef..ceba033 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 _0xb4c7=['./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','bluebird','./server','./realtime'];(function(_0x165e1e,_0x37665c){var _0x2b7ff6=function(_0x2e1fa4){while(--_0x2e1fa4){_0x165e1e['push'](_0x165e1e['shift']());}};_0x2b7ff6(++_0x37665c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x5cf21f,_0x548f55){_0x5cf21f=_0x5cf21f-0x0;var _0x5087b0=_0xb4c7[_0x5cf21f];return _0x5087b0;};'use strict';var BPromise=require(_0x7b4c('0x0'));var server=require(_0x7b4c('0x1'));var Realtime=require(_0x7b4c('0x2'));var EmailChannel=require(_0x7b4c('0x3'));var mailAccount=require(_0x7b4c('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0x7b4c('0x5')]()[_0x7b4c('0x6')](mailAccount[_0x7b4c('0x7')]())[_0x7b4c('0x6')](realtime[_0x7b4c('0x8')]())['then'](function(){email[_0x7b4c('0x9')](realtime[_0x7b4c('0xa')]);return realtime;});}function main(){return server[_0x7b4c('0xb')](realtime,email)['then'](function(_0x2d7b7e){return initRealtime();})[_0x7b4c('0x6')](function(_0x570daa){return db[_0x7b4c('0xc')][_0x7b4c('0xd')]({'attributes':['id',_0x7b4c('0xe')],'raw':!![]});})[_0x7b4c('0x6')](function(_0x365225){return setInterval(initRealtime,_0x365225[_0x7b4c('0xe')]*0x3e8);})[_0x7b4c('0xf')](function(_0xc62104){console[_0x7b4c('0x10')](_0xc62104);});}main(); \ No newline at end of file +var _0x975f=['resolve','then','initMailAccounts','refresh','mailAccounts','listen','Setting','loginMailFrequency','log','bluebird','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb'];(function(_0x5b9b45,_0x457eb3){var _0x3bdb18=function(_0x2534f7){while(--_0x2534f7){_0x5b9b45['push'](_0x5b9b45['shift']());}};_0x3bdb18(++_0x457eb3);}(_0x975f,0x191));var _0xf975=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x975f[_0x2c0dc0];return _0x4c0990;};'use strict';var BPromise=require(_0xf975('0x0'));var server=require('./server');var Realtime=require(_0xf975('0x1'));var EmailChannel=require(_0xf975('0x2'));var mailAccount=require(_0xf975('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xf975('0x4'))['db'];function initRealtime(){return BPromise[_0xf975('0x5')]()[_0xf975('0x6')](mailAccount['getMailAccounts']())[_0xf975('0x6')](realtime[_0xf975('0x7')]())['then'](function(){email[_0xf975('0x8')](realtime[_0xf975('0x9')]);return realtime;});}function main(){return server[_0xf975('0xa')](realtime,email)[_0xf975('0x6')](function(_0xe62d83){return initRealtime();})[_0xf975('0x6')](function(_0x5d5860){return db[_0xf975('0xb')]['findOne']({'attributes':['id',_0xf975('0xc')],'raw':!![]});})['then'](function(_0x32e936){return setInterval(initRealtime,_0x32e936[_0xf975('0xc')]*0x3e8);})['catch'](function(_0x472fc7){console[_0xf975('0xd')](_0x472fc7);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 952202c..c7a1bd0 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 _0x1aed=['sendMail','send','Smtp','verify','verified','moment','md5','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','key','Imap','status','messageStatus','isNil','stringify','mailAccount:update','prototype','refresh','active','hasOwnProperty','box','handleImapEmail','bind','end','handleImapEnd','error','disabled','messages','total','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1aed,0x69));var _0xd1ae=function(_0x1088f3,_0x567939){_0x1088f3=_0x1088f3-0x0;var _0x386077=_0x1aed[_0x1088f3];return _0x386077;};'use strict';var _=require('lodash');var moment=require(_0xd1ae('0x0'));var BPromise=require('bluebird');var md5=require(_0xd1ae('0x1'));var Redis=require('ioredis');var config=require(_0xd1ae('0x2'));var logger=require(_0xd1ae('0x3'))(_0xd1ae('0x4'));config[_0xd1ae('0x5')]=_['defaults'](config[_0xd1ae('0x5')],{'host':_0xd1ae('0x6'),'port':0x18eb});var io=require(_0xd1ae('0x7'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0xd1ae('0x8'));var mailAccount=require(_0xd1ae('0x9'));var md5Accounts={};function EmailChannel(_0x499923){logger['info'](_0xd1ae('0xa'));this[_0xd1ae('0xb')]=_0x499923[_0xd1ae('0xb')];this[_0xd1ae('0xc')]={};this[_0xd1ae('0xd')]=new EmailSmtp();}EmailChannel['prototype'][_0xd1ae('0xe')]=function(_0x21732a){var _0x1bf4de=this[_0xd1ae('0xb')][_0x21732a];var _0x3ec5a3={'id':_0x1bf4de['id'],'name':_0x1bf4de['name'],'key':_0x1bf4de[_0xd1ae('0xf')],'active':_0x1bf4de['active'],'Imap':{'status':_0x1bf4de[_0xd1ae('0x10')][_0xd1ae('0x11')],'messageStatus':_0x1bf4de[_0xd1ae('0x10')][_0xd1ae('0x12')],'total':_0x1bf4de[_0xd1ae('0x10')]['total']}};if(_[_0xd1ae('0x13')](md5Accounts[_0x21732a])){md5Accounts[_0x21732a]={};}var _0x14e954=md5(JSON[_0xd1ae('0x14')](_0x3ec5a3));if(md5Accounts[_0x21732a]['md5']!==_0x14e954){md5Accounts[_0x21732a][_0xd1ae('0x1')]=_0x14e954;io[_0xd1ae('0xe')](_0xd1ae('0x15'),_0x3ec5a3);}};EmailChannel[_0xd1ae('0x16')][_0xd1ae('0x17')]=function(_0x927001){for(var _0x42a993 in _0x927001){if(_0x927001['hasOwnProperty'](_0x42a993)){if(_0x927001[_0x42a993][_0xd1ae('0x10')]&&_0x927001[_0x42a993][_0xd1ae('0x18')]){var _0x393038=_0x927001[_0x42a993][_0xd1ae('0x10')];if(!this[_0xd1ae('0xc')][_0xd1ae('0x19')](_0x393038['id'])){this['imapAccounts'][_0x393038['id']]=new EmailImap(_0x393038,_0x927001[_0x42a993]['email']);this[_0xd1ae('0xc')][_0x393038['id']]['on'](_0xd1ae('0x1a'),this['handleImapBox']['bind'](this,_0x42a993));this[_0xd1ae('0xc')][_0x393038['id']]['on'](_0xd1ae('0x4'),this[_0xd1ae('0x1b')][_0xd1ae('0x1c')](this,_0x42a993));this[_0xd1ae('0xc')][_0x393038['id']]['on'](_0xd1ae('0x1d'),this[_0xd1ae('0x1e')][_0xd1ae('0x1c')](this,_0x42a993));this['imapAccounts'][_0x393038['id']]['on'](_0xd1ae('0x1f'),this['handleImapError'][_0xd1ae('0x1c')](this,_0x42a993));}}else{if(_[_0xd1ae('0x13')](this[_0xd1ae('0xb')][_0x42a993][_0xd1ae('0x10')])){this['mailAccounts'][_0x42a993][_0xd1ae('0x10')]={};}this['mailAccounts'][_0x42a993][_0xd1ae('0x10')][_0xd1ae('0x11')]=_0xd1ae('0x20');this[_0xd1ae('0xb')][_0x42a993][_0xd1ae('0x10')]['messageStatus']='';this[_0xd1ae('0xe')](_0x42a993);}}}};EmailChannel[_0xd1ae('0x16')]['handleImapBox']=function(_0x1dacc1,_0x27937d){if(this[_0xd1ae('0xb')][_0x1dacc1]){this[_0xd1ae('0xb')][_0x1dacc1][_0xd1ae('0x10')][_0xd1ae('0x11')]='connected';this['mailAccounts'][_0x1dacc1][_0xd1ae('0x10')][_0xd1ae('0x12')]=_0x27937d['name'];if(_0x27937d[_0xd1ae('0x21')]){this[_0xd1ae('0xb')][_0x1dacc1][_0xd1ae('0x10')][_0xd1ae('0x22')]=_0x27937d['messages'][_0xd1ae('0x22')];}return this[_0xd1ae('0xe')](_0x1dacc1);}};EmailChannel['prototype']['handleImapEmail']=function(_0x56c20d,_0x2690d5){logger[_0xd1ae('0x23')](_0xd1ae('0x24'),_0x2690d5['firstName'],_0x2690d5[_0xd1ae('0x25')],_0x2690d5['from'],_0x56c20d);if(this[_0xd1ae('0xb')][_0x56c20d]){return mailAccount[_0xd1ae('0x26')](_0x56c20d,_0x2690d5)[_0xd1ae('0x27')](function(_0x4770df){if(_0x4770df){logger['info'](_0xd1ae('0x28'));}})[_0xd1ae('0x29')](function(_0x4c86cd){logger[_0xd1ae('0x1f')](_0xd1ae('0x2a'),JSON[_0xd1ae('0x14')](_0x4c86cd));});}};EmailChannel[_0xd1ae('0x16')]['handleImapEnd']=function(_0x4d198d){if(this[_0xd1ae('0xb')][_0x4d198d]&&this[_0xd1ae('0xb')][_0x4d198d]['Imap']){if(this[_0xd1ae('0xc')][this['mailAccounts'][_0x4d198d][_0xd1ae('0x10')]['id']]){delete this[_0xd1ae('0xc')][this[_0xd1ae('0xb')][_0x4d198d][_0xd1ae('0x10')]['id']];}this[_0xd1ae('0xb')][_0x4d198d][_0xd1ae('0x10')][_0xd1ae('0x2b')]=moment();this['emit'](_0x4d198d);}};EmailChannel[_0xd1ae('0x16')][_0xd1ae('0x2c')]=function(_0x4d16a7,_0x4483c1){if(this[_0xd1ae('0xb')][_0x4d16a7]){this[_0xd1ae('0xb')][_0x4d16a7][_0xd1ae('0x10')][_0xd1ae('0x11')]=_0xd1ae('0x1f');this[_0xd1ae('0xb')][_0x4d16a7]['Imap']['messageStatus']=_0x4483c1;return this[_0xd1ae('0xe')](_0x4d16a7);}};EmailChannel[_0xd1ae('0x16')][_0xd1ae('0x2d')]=function(_0x414b85,_0x4d6c3b){return this[_0xd1ae('0xd')][_0xd1ae('0x2e')](_0x414b85,_0x4d6c3b);};EmailChannel['prototype']['verifySmtp']=function(_0x4295b2){var _0x40052d=this;if(this['mailAccounts'][_0x4295b2['id']]){if(_[_0xd1ae('0x13')](this[_0xd1ae('0xb')][_0x4295b2['id']][_0xd1ae('0x2f')])){this[_0xd1ae('0xb')][_0x4295b2['id']]['Smtp']={};}this[_0xd1ae('0xb')][_0x4295b2['id']][_0xd1ae('0x2f')][_0xd1ae('0x2b')]=moment();return new BPromise(function(_0x5bf959,_0x28a867){return _0x40052d[_0xd1ae('0xd')][_0xd1ae('0x30')](_0x4295b2)[_0xd1ae('0x27')](function(_0x5bcf01){_0x40052d['mailAccounts'][_0x4295b2['id']][_0xd1ae('0x2f')][_0xd1ae('0x11')]=_0xd1ae('0x31');_0x40052d['mailAccounts'][_0x4295b2['id']]['Smtp'][_0xd1ae('0x12')]='';_0x40052d['emit'](_0x4295b2['id']);_0x5bf959(_0x5bcf01);})['catch'](function(_0x3a6574){_0x40052d[_0xd1ae('0xb')][_0x4295b2['id']][_0xd1ae('0x2f')][_0xd1ae('0x11')]='error';_0x40052d['mailAccounts'][_0x4295b2['id']]['Smtp'][_0xd1ae('0x12')]=_0x3a6574;_0x40052d['emit'](_0x4295b2['id']);_0x28a867(_0x3a6574);});});}return this[_0xd1ae('0xd')][_0xd1ae('0x30')](_0x4295b2);};module['exports']=EmailChannel; \ No newline at end of file +var _0x6b31=['handleImapError','status','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','verifySmtp','Smtp','lastSync','verified','verify','exports','lodash','bluebird','md5','ioredis','../../../config/environment','defaults','redis','./imap','./smtp','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','isNil','mailAccount:update','refresh','hasOwnProperty','email','handleImapBox','bind','handleImapEmail','handleImapEnd','error'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x6b31,0x13f));var _0x16b3=function(_0x421036,_0x59312d){_0x421036=_0x421036-0x0;var _0x22a35c=_0x6b31[_0x421036];return _0x22a35c;};'use strict';var _=require(_0x16b3('0x0'));var moment=require('moment');var BPromise=require(_0x16b3('0x1'));var md5=require(_0x16b3('0x2'));var Redis=require(_0x16b3('0x3'));var config=require(_0x16b3('0x4'));var logger=require('../../../config/logger')('email');config['redis']=_[_0x16b3('0x5')](config[_0x16b3('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x16b3('0x6')]));var EmailImap=require(_0x16b3('0x7'));var EmailSmtp=require(_0x16b3('0x8'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x2b12dc){logger[_0x16b3('0x9')]('start\x20email\x20channel');this[_0x16b3('0xa')]=_0x2b12dc[_0x16b3('0xa')];this[_0x16b3('0xb')]={};this[_0x16b3('0xc')]=new EmailSmtp();}EmailChannel[_0x16b3('0xd')][_0x16b3('0xe')]=function(_0xb252f1){var _0x3bb2e8=this[_0x16b3('0xa')][_0xb252f1];var _0x965470={'id':_0x3bb2e8['id'],'name':_0x3bb2e8[_0x16b3('0xf')],'key':_0x3bb2e8[_0x16b3('0x10')],'active':_0x3bb2e8[_0x16b3('0x11')],'Imap':{'status':_0x3bb2e8[_0x16b3('0x12')]['status'],'messageStatus':_0x3bb2e8[_0x16b3('0x12')][_0x16b3('0x13')],'total':_0x3bb2e8[_0x16b3('0x12')][_0x16b3('0x14')]}};if(_[_0x16b3('0x15')](md5Accounts[_0xb252f1])){md5Accounts[_0xb252f1]={};}var _0x2a42f0=md5(JSON['stringify'](_0x965470));if(md5Accounts[_0xb252f1][_0x16b3('0x2')]!==_0x2a42f0){md5Accounts[_0xb252f1]['md5']=_0x2a42f0;io[_0x16b3('0xe')](_0x16b3('0x16'),_0x965470);}};EmailChannel[_0x16b3('0xd')][_0x16b3('0x17')]=function(_0xa7a937){for(var _0x38ec26 in _0xa7a937){if(_0xa7a937['hasOwnProperty'](_0x38ec26)){if(_0xa7a937[_0x38ec26]['Imap']&&_0xa7a937[_0x38ec26][_0x16b3('0x11')]){var _0x1420d9=_0xa7a937[_0x38ec26][_0x16b3('0x12')];if(!this[_0x16b3('0xb')][_0x16b3('0x18')](_0x1420d9['id'])){this[_0x16b3('0xb')][_0x1420d9['id']]=new EmailImap(_0x1420d9,_0xa7a937[_0x38ec26][_0x16b3('0x19')]);this[_0x16b3('0xb')][_0x1420d9['id']]['on']('box',this[_0x16b3('0x1a')][_0x16b3('0x1b')](this,_0x38ec26));this[_0x16b3('0xb')][_0x1420d9['id']]['on'](_0x16b3('0x19'),this[_0x16b3('0x1c')][_0x16b3('0x1b')](this,_0x38ec26));this['imapAccounts'][_0x1420d9['id']]['on']('end',this[_0x16b3('0x1d')][_0x16b3('0x1b')](this,_0x38ec26));this[_0x16b3('0xb')][_0x1420d9['id']]['on'](_0x16b3('0x1e'),this[_0x16b3('0x1f')][_0x16b3('0x1b')](this,_0x38ec26));}}else{if(_[_0x16b3('0x15')](this[_0x16b3('0xa')][_0x38ec26][_0x16b3('0x12')])){this['mailAccounts'][_0x38ec26][_0x16b3('0x12')]={};}this[_0x16b3('0xa')][_0x38ec26][_0x16b3('0x12')][_0x16b3('0x20')]=_0x16b3('0x21');this[_0x16b3('0xa')][_0x38ec26][_0x16b3('0x12')]['messageStatus']='';this[_0x16b3('0xe')](_0x38ec26);}}}};EmailChannel[_0x16b3('0xd')]['handleImapBox']=function(_0x17e032,_0x1f508e){if(this[_0x16b3('0xa')][_0x17e032]){this[_0x16b3('0xa')][_0x17e032][_0x16b3('0x12')][_0x16b3('0x20')]=_0x16b3('0x22');this[_0x16b3('0xa')][_0x17e032][_0x16b3('0x12')][_0x16b3('0x13')]=_0x1f508e[_0x16b3('0xf')];if(_0x1f508e['messages']){this[_0x16b3('0xa')][_0x17e032][_0x16b3('0x12')][_0x16b3('0x14')]=_0x1f508e[_0x16b3('0x23')][_0x16b3('0x14')];}return this['emit'](_0x17e032);}};EmailChannel[_0x16b3('0xd')][_0x16b3('0x1c')]=function(_0x4f5f49,_0x2749c5){logger['info'](_0x16b3('0x24'),_0x2749c5['firstName'],_0x2749c5[_0x16b3('0x25')],_0x2749c5['from'],_0x4f5f49);if(this['mailAccounts'][_0x4f5f49]){return mailAccount[_0x16b3('0x26')](_0x4f5f49,_0x2749c5)[_0x16b3('0x27')](function(_0x5f58bf){if(_0x5f58bf){logger[_0x16b3('0x9')](_0x16b3('0x28'));}})[_0x16b3('0x29')](function(_0x1bbe08){logger[_0x16b3('0x1e')](_0x16b3('0x2a'),JSON['stringify'](_0x1bbe08));});}};EmailChannel[_0x16b3('0xd')][_0x16b3('0x1d')]=function(_0x249c18){if(this[_0x16b3('0xa')][_0x249c18]&&this[_0x16b3('0xa')][_0x249c18]['Imap']){if(this[_0x16b3('0xb')][this[_0x16b3('0xa')][_0x249c18]['Imap']['id']]){delete this[_0x16b3('0xb')][this[_0x16b3('0xa')][_0x249c18][_0x16b3('0x12')]['id']];}this[_0x16b3('0xa')][_0x249c18]['Imap']['lastSync']=moment();this[_0x16b3('0xe')](_0x249c18);}};EmailChannel[_0x16b3('0xd')][_0x16b3('0x1f')]=function(_0x244104,_0x334a26){if(this[_0x16b3('0xa')][_0x244104]){this[_0x16b3('0xa')][_0x244104][_0x16b3('0x12')][_0x16b3('0x20')]='error';this[_0x16b3('0xa')][_0x244104][_0x16b3('0x12')][_0x16b3('0x13')]=_0x334a26;return this[_0x16b3('0xe')](_0x244104);}};EmailChannel[_0x16b3('0xd')][_0x16b3('0x2b')]=function(_0x419e89,_0x5f5a39){return this[_0x16b3('0xc')]['send'](_0x419e89,_0x5f5a39);};EmailChannel[_0x16b3('0xd')][_0x16b3('0x2c')]=function(_0x29fc85){var _0x40abec=this;if(this[_0x16b3('0xa')][_0x29fc85['id']]){if(_[_0x16b3('0x15')](this[_0x16b3('0xa')][_0x29fc85['id']][_0x16b3('0x2d')])){this[_0x16b3('0xa')][_0x29fc85['id']][_0x16b3('0x2d')]={};}this[_0x16b3('0xa')][_0x29fc85['id']][_0x16b3('0x2d')][_0x16b3('0x2e')]=moment();return new BPromise(function(_0x552771,_0x27b992){return _0x40abec[_0x16b3('0xc')]['verify'](_0x29fc85)[_0x16b3('0x27')](function(_0x325cd5){_0x40abec[_0x16b3('0xa')][_0x29fc85['id']][_0x16b3('0x2d')]['status']=_0x16b3('0x2f');_0x40abec['mailAccounts'][_0x29fc85['id']][_0x16b3('0x2d')]['messageStatus']='';_0x40abec['emit'](_0x29fc85['id']);_0x552771(_0x325cd5);})[_0x16b3('0x29')](function(_0x1eb874){_0x40abec[_0x16b3('0xa')][_0x29fc85['id']][_0x16b3('0x2d')][_0x16b3('0x20')]=_0x16b3('0x1e');_0x40abec[_0x16b3('0xa')][_0x29fc85['id']][_0x16b3('0x2d')][_0x16b3('0x13')]=_0x1eb874;_0x40abec[_0x16b3('0xe')](_0x29fc85['id']);_0x27b992(_0x1eb874);});});}return this[_0x16b3('0xc')][_0x16b3('0x30')](_0x29fc85);};module[_0x16b3('0x31')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 60924f9..e3eee8b 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 _0x058c=['prototype','connTimeout','authTimeout','isNil','service','user','password','port','tls','host','anonymous@xcally.com','handleReady','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','end','error','closeBox','handleCloseBox','body','attributes','handleMessageAttributes','handleMessageEnd','account','textCode','hasOwnProperty','upperFirst','imap','lodash','randomstring','mailparser','simpleParser','events','EventEmitter','email','mailbox','getAccount','once','ready','bind','handleEnd','handleError','connect','inherits'];(function(_0x5dc3be,_0x4415cc){var _0x4ddbfc=function(_0x436a4b){while(--_0x436a4b){_0x5dc3be['push'](_0x5dc3be['shift']());}};_0x4ddbfc(++_0x4415cc);}(_0x058c,0x169));var _0xc058=function(_0x17d6c6,_0x2f8c73){_0x17d6c6=_0x17d6c6-0x0;var _0x3a90bc=_0x058c[_0x17d6c6];return _0x3a90bc;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0xc058('0x0'));var _=require(_0xc058('0x1'));var rs=require(_0xc058('0x2'));var simpleParser=require(_0xc058('0x3'))[_0xc058('0x4')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0xc058('0x5'))[_0xc058('0x6')];var utils=require('./utils');var logger=require('../../../config/logger')(_0xc058('0x7'));function EmailImap(_0x550bc0,_0xc4db7e){this[_0xc058('0x8')]='INBOX';this['account']=this[_0xc058('0x9')](_0x550bc0,_0xc4db7e);this[_0xc058('0x0')]=new Imap(this['account']);this['imap'][_0xc058('0xa')](_0xc058('0xb'),this['handleReady'][_0xc058('0xc')](this));this[_0xc058('0x0')][_0xc058('0xa')]('end',this[_0xc058('0xd')][_0xc058('0xc')](this));this['imap']['on']('error',this[_0xc058('0xe')][_0xc058('0xc')](this));this['imap'][_0xc058('0xf')]();}util[_0xc058('0x10')](EmailImap,EventEmitter);EmailImap[_0xc058('0x11')][_0xc058('0x9')]=function(_0x50a053,_0x3a067e){var _0x4e3a51={'connTimeout':_0x50a053[_0xc058('0x12')]?_0x50a053[_0xc058('0x12')]*0x3e8:0x2710,'authTimeout':_0x50a053[_0xc058('0x13')]?_0x50a053['authTimeout']*0x3e8:0x1388};if(_[_0xc058('0x14')](_0x50a053[_0xc058('0x15')])){if(_0x50a053['authentication']){_0x4e3a51[_0xc058('0x16')]=_0x50a053['user'];_0x4e3a51[_0xc058('0x17')]=_0x50a053[_0xc058('0x17')];}_0x4e3a51['host']=_0x50a053['host'];_0x4e3a51['port']=_0x50a053[_0xc058('0x18')]||0x3e1;if(_0x50a053[_0xc058('0x19')]){_0x4e3a51[_0xc058('0x19')]=!![];}else{_0x4e3a51['tls']=![];_0x4e3a51['autotls']='required';}}else{_0x4e3a51['user']=_0x50a053[_0xc058('0x16')];_0x4e3a51['password']=_0x50a053[_0xc058('0x17')];_0x4e3a51[_0xc058('0x1a')]=utils['getHost'](_0x50a053[_0xc058('0x15')]);_0x4e3a51[_0xc058('0x18')]=0x3e1;_0x4e3a51[_0xc058('0x19')]=!![];}_0x4e3a51['email']=_0x3a067e||_0x50a053[_0xc058('0x16')]||_0xc058('0x1b');return _0x4e3a51;};EmailImap[_0xc058('0x11')][_0xc058('0x1c')]=function(){this[_0xc058('0x0')][_0xc058('0x1d')](this[_0xc058('0x8')],![],this[_0xc058('0x1e')][_0xc058('0xc')](this));};EmailImap[_0xc058('0x11')]['handleOpenBox']=function(_0x2f879a,_0x1df8d3){if(_0x2f879a){this[_0xc058('0xe')](_0x2f879a,!![]);}else{this[_0xc058('0x1f')](_0xc058('0x20'),_0x1df8d3);this[_0xc058('0x21')]();}};EmailImap[_0xc058('0x11')]['handleCloseBox']=function(_0x8abbec){if(_0x8abbec){this[_0xc058('0xe')](_0x8abbec,!![]);}else{this[_0xc058('0x0')]['end']();}};EmailImap['prototype'][_0xc058('0x21')]=function(){this[_0xc058('0x0')][_0xc058('0x22')]([_0xc058('0x23')],this[_0xc058('0x24')][_0xc058('0xc')](this));};EmailImap[_0xc058('0x11')]['handleReadUnseen']=function(_0x2e4cea,_0x84e00f){if(_0x2e4cea){this[_0xc058('0xe')](_0x2e4cea,!![]);}else{if(_0x84e00f[_0xc058('0x25')]){try{var _0xc6a11e=this['imap'][_0xc058('0x26')](_0x84e00f,{'bodies':'','markSeen':!![]});_0xc6a11e['on'](_0xc058('0x27'),this[_0xc058('0x28')][_0xc058('0xc')](this));_0xc6a11e[_0xc058('0xa')]('error',this[_0xc058('0x29')]['bind'](this));_0xc6a11e['once'](_0xc058('0x2a'),this['handleFetchEnd'][_0xc058('0xc')](this));}catch(_0x412caf){logger[_0xc058('0x2b')](_0x412caf);}}else{this[_0xc058('0x0')][_0xc058('0x2c')](!![],this[_0xc058('0x2d')][_0xc058('0xc')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x1d882e,_0x2ae96d){_0x1d882e['on'](_0xc058('0x2e'),this['handleMessageBody'][_0xc058('0xc')](this));_0x1d882e[_0xc058('0xa')](_0xc058('0x2f'),this[_0xc058('0x30')][_0xc058('0xc')](this));_0x1d882e[_0xc058('0xa')](_0xc058('0x2a'),this[_0xc058('0x31')][_0xc058('0xc')](this));};EmailImap[_0xc058('0x11')]['handleMessageBody']=function(_0x3762db,_0x2d1216){simpleParser(_0x3762db,{'Iconv':Iconv},this['handleSimpleParser'][_0xc058('0xc')](this));};EmailImap['prototype'][_0xc058('0x30')]=function(_0x4363df){};EmailImap[_0xc058('0x11')]['handleMessageEnd']=function(){};EmailImap[_0xc058('0x11')]['handleSimpleParser']=function(_0x5b3217,_0x155d01){if(_0x5b3217){logger['error'](_0x5b3217);}else{var _0x52dee3=this;utils['parser'](this[_0xc058('0x32')],_0x155d01,function(_0x33cc3c){_0x52dee3[_0xc058('0x1f')](_0xc058('0x7'),_0x33cc3c);});}};EmailImap[_0xc058('0x11')]['handleFetchEnd']=function(){this['imap'][_0xc058('0x2c')](!![],this[_0xc058('0x2d')][_0xc058('0xc')](this));};EmailImap[_0xc058('0x11')][_0xc058('0x29')]=function(_0x41c141){this[_0xc058('0xe')](_0x41c141);this[_0xc058('0x0')][_0xc058('0x2c')](!![],this[_0xc058('0x2d')][_0xc058('0xc')](this));};EmailImap[_0xc058('0x11')][_0xc058('0xd')]=function(){this[_0xc058('0x1f')](_0xc058('0x2a'));};EmailImap['prototype']['handleError']=function(_0x13301c,_0xb0565d){logger[_0xc058('0x2b')](_0xc058('0xe'),this['account'][_0xc058('0x7')],JSON['stringify'](_0x13301c));var _0x1445c9='';if(_0x13301c){if(_0x13301c[_0xc058('0x33')]){_0x1445c9=_0x13301c[_0xc058('0x33')];}else{for(var _0x5c135c in _0x13301c){if(_0x13301c[_0xc058('0x34')](_0x5c135c)){_0x1445c9+=_[_0xc058('0x35')](_0x5c135c)+':\x20'+_0x13301c[_0x5c135c]+'\x0a';}}}}if(_0xb0565d){this[_0xc058('0x0')][_0xc058('0x2a')]();}else{this[_0xc058('0x1f')](_0xc058('0x2b'),_0x1445c9);this[_0xc058('0x1f')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0xa1e2=['mailbox','INBOX','account','once','ready','handleReady','bind','end','error','connect','inherits','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','prototype','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','handleReadUnseen','handleError','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','handleEnd','textCode','hasOwnProperty','upperFirst','path','imap','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email'];(function(_0x3db601,_0x4caeba){var _0x2e2924=function(_0x661dac){while(--_0x661dac){_0x3db601['push'](_0x3db601['shift']());}};_0x2e2924(++_0x4caeba);}(_0xa1e2,0xae));var _0x2a1e=function(_0x3a5099,_0x209963){_0x3a5099=_0x3a5099-0x0;var _0x365635=_0xa1e2[_0x3a5099];return _0x365635;};'use strict';var fs=require('fs');var path=require(_0x2a1e('0x0'));var util=require('util');var Imap=require(_0x2a1e('0x1'));var _=require('lodash');var rs=require(_0x2a1e('0x2'));var simpleParser=require(_0x2a1e('0x3'))[_0x2a1e('0x4')];var Iconv=require(_0x2a1e('0x5'))[_0x2a1e('0x6')];var EventEmitter=require(_0x2a1e('0x7'))[_0x2a1e('0x8')];var utils=require(_0x2a1e('0x9'));var logger=require(_0x2a1e('0xa'))(_0x2a1e('0xb'));function EmailImap(_0x3634db,_0x155e4f){this[_0x2a1e('0xc')]=_0x2a1e('0xd');this[_0x2a1e('0xe')]=this['getAccount'](_0x3634db,_0x155e4f);this[_0x2a1e('0x1')]=new Imap(this[_0x2a1e('0xe')]);this[_0x2a1e('0x1')][_0x2a1e('0xf')](_0x2a1e('0x10'),this[_0x2a1e('0x11')][_0x2a1e('0x12')](this));this[_0x2a1e('0x1')][_0x2a1e('0xf')](_0x2a1e('0x13'),this['handleEnd'][_0x2a1e('0x12')](this));this[_0x2a1e('0x1')]['on'](_0x2a1e('0x14'),this['handleError'][_0x2a1e('0x12')](this));this[_0x2a1e('0x1')][_0x2a1e('0x15')]();}util[_0x2a1e('0x16')](EmailImap,EventEmitter);EmailImap['prototype'][_0x2a1e('0x17')]=function(_0x21eda9,_0x52e548){var _0x480c9c={'connTimeout':_0x21eda9[_0x2a1e('0x18')]?_0x21eda9[_0x2a1e('0x18')]*0x3e8:0x2710,'authTimeout':_0x21eda9[_0x2a1e('0x19')]?_0x21eda9[_0x2a1e('0x19')]*0x3e8:0x1388};if(_[_0x2a1e('0x1a')](_0x21eda9[_0x2a1e('0x1b')])){if(_0x21eda9[_0x2a1e('0x1c')]){_0x480c9c['user']=_0x21eda9[_0x2a1e('0x1d')];_0x480c9c[_0x2a1e('0x1e')]=_0x21eda9['password'];}_0x480c9c[_0x2a1e('0x1f')]=_0x21eda9[_0x2a1e('0x1f')];_0x480c9c[_0x2a1e('0x20')]=_0x21eda9['port']||0x3e1;if(_0x21eda9[_0x2a1e('0x21')]){_0x480c9c[_0x2a1e('0x21')]=!![];}else{_0x480c9c[_0x2a1e('0x21')]=![];_0x480c9c[_0x2a1e('0x22')]=_0x2a1e('0x23');}}else{_0x480c9c[_0x2a1e('0x1d')]=_0x21eda9['user'];_0x480c9c[_0x2a1e('0x1e')]=_0x21eda9[_0x2a1e('0x1e')];_0x480c9c[_0x2a1e('0x1f')]=utils[_0x2a1e('0x24')](_0x21eda9[_0x2a1e('0x1b')]);_0x480c9c['port']=0x3e1;_0x480c9c[_0x2a1e('0x21')]=!![];}_0x480c9c['email']=_0x52e548||_0x21eda9[_0x2a1e('0x1d')]||'anonymous@xcally.com';return _0x480c9c;};EmailImap[_0x2a1e('0x25')][_0x2a1e('0x11')]=function(){this[_0x2a1e('0x1')][_0x2a1e('0x26')](this[_0x2a1e('0xc')],![],this[_0x2a1e('0x27')][_0x2a1e('0x12')](this));};EmailImap[_0x2a1e('0x25')][_0x2a1e('0x27')]=function(_0x48b306,_0x5d1285){if(_0x48b306){this['handleError'](_0x48b306,!![]);}else{this[_0x2a1e('0x28')](_0x2a1e('0x29'),_0x5d1285);this[_0x2a1e('0x2a')]();}};EmailImap[_0x2a1e('0x25')][_0x2a1e('0x2b')]=function(_0x531fef){if(_0x531fef){this['handleError'](_0x531fef,!![]);}else{this[_0x2a1e('0x1')][_0x2a1e('0x13')]();}};EmailImap['prototype'][_0x2a1e('0x2a')]=function(){this[_0x2a1e('0x1')]['search'](['UNSEEN'],this['handleReadUnseen']['bind'](this));};EmailImap[_0x2a1e('0x25')][_0x2a1e('0x2c')]=function(_0x3ee540,_0x9f5a1b){if(_0x3ee540){this[_0x2a1e('0x2d')](_0x3ee540,!![]);}else{if(_0x9f5a1b[_0x2a1e('0x2e')]){try{var _0x2f8dde=this[_0x2a1e('0x1')]['fetch'](_0x9f5a1b,{'bodies':'','markSeen':!![]});_0x2f8dde['on'](_0x2a1e('0x2f'),this[_0x2a1e('0x30')][_0x2a1e('0x12')](this));_0x2f8dde['once']('error',this[_0x2a1e('0x31')][_0x2a1e('0x12')](this));_0x2f8dde['once']('end',this[_0x2a1e('0x32')][_0x2a1e('0x12')](this));}catch(_0xb6146f){logger['error'](_0xb6146f);}}else{this[_0x2a1e('0x1')][_0x2a1e('0x33')](!![],this[_0x2a1e('0x2b')]['bind'](this));}}};EmailImap[_0x2a1e('0x25')][_0x2a1e('0x30')]=function(_0x20bbdb,_0x47dab3){_0x20bbdb['on']('body',this[_0x2a1e('0x34')][_0x2a1e('0x12')](this));_0x20bbdb[_0x2a1e('0xf')](_0x2a1e('0x35'),this[_0x2a1e('0x36')][_0x2a1e('0x12')](this));_0x20bbdb[_0x2a1e('0xf')](_0x2a1e('0x13'),this['handleMessageEnd'][_0x2a1e('0x12')](this));};EmailImap[_0x2a1e('0x25')][_0x2a1e('0x34')]=function(_0x4906a3,_0x5b517b){simpleParser(_0x4906a3,{'Iconv':Iconv},this[_0x2a1e('0x37')][_0x2a1e('0x12')](this));};EmailImap[_0x2a1e('0x25')]['handleMessageAttributes']=function(_0x5b55c6){};EmailImap[_0x2a1e('0x25')][_0x2a1e('0x38')]=function(){};EmailImap[_0x2a1e('0x25')][_0x2a1e('0x37')]=function(_0x4994f0,_0x8522c1){if(_0x4994f0){logger['error'](_0x4994f0);}else{var _0x2aab18=this;utils[_0x2a1e('0x39')](this[_0x2a1e('0xe')],_0x8522c1,function(_0x291bdc){_0x2aab18[_0x2a1e('0x28')](_0x2a1e('0xb'),_0x291bdc);});}};EmailImap[_0x2a1e('0x25')][_0x2a1e('0x32')]=function(){this[_0x2a1e('0x1')][_0x2a1e('0x33')](!![],this[_0x2a1e('0x2b')][_0x2a1e('0x12')](this));};EmailImap[_0x2a1e('0x25')][_0x2a1e('0x31')]=function(_0x202612){this[_0x2a1e('0x2d')](_0x202612);this['imap'][_0x2a1e('0x33')](!![],this[_0x2a1e('0x2b')][_0x2a1e('0x12')](this));};EmailImap[_0x2a1e('0x25')][_0x2a1e('0x3a')]=function(){this[_0x2a1e('0x28')](_0x2a1e('0x13'));};EmailImap['prototype'][_0x2a1e('0x2d')]=function(_0x2ae9c1,_0x59494b){logger[_0x2a1e('0x14')](_0x2a1e('0x2d'),this[_0x2a1e('0xe')][_0x2a1e('0xb')],JSON['stringify'](_0x2ae9c1));var _0x28d2ee='';if(_0x2ae9c1){if(_0x2ae9c1[_0x2a1e('0x3b')]){_0x28d2ee=_0x2ae9c1[_0x2a1e('0x3b')];}else{for(var _0x2b9919 in _0x2ae9c1){if(_0x2ae9c1[_0x2a1e('0x3c')](_0x2b9919)){_0x28d2ee+=_[_0x2a1e('0x3d')](_0x2b9919)+':\x20'+_0x2ae9c1[_0x2b9919]+'\x0a';}}}}if(_0x59494b){this['imap'][_0x2a1e('0x13')]();}else{this[_0x2a1e('0x28')](_0x2a1e('0x14'),_0x28d2ee);this[_0x2a1e('0x28')](_0x2a1e('0x13'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 6736428..c949815 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 _0x29e5=['exports','nodemailer','bluebird','prototype','send','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired'];(function(_0x376703,_0x5aa7c3){var _0x219e48=function(_0x59498d){while(--_0x59498d){_0x376703['push'](_0x376703['shift']());}};_0x219e48(++_0x5aa7c3);}(_0x29e5,0xb5));var _0x529e=function(_0x3d07ad,_0x3d4abe){_0x3d07ad=_0x3d07ad-0x0;var _0x511f22=_0x29e5[_0x3d07ad];return _0x511f22;};'use strict';var nodemailer=require(_0x529e('0x0'));var BPromise=require(_0x529e('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x529e('0x2')][_0x529e('0x3')]=function(_0x111c2c,_0x3a5eae){return new BPromise(function(_0x2d1c33,_0x479b69){var _0x3c9a38=nodemailer[_0x529e('0x4')](_0x111c2c);_0x3c9a38[_0x529e('0x5')](_0x529e('0x6'),inlineBase64());_0x3c9a38[_0x529e('0x7')](_0x3a5eae,function(_0x367011,_0x1779fb){if(_0x367011){_0x479b69(_0x367011[_0x529e('0x8')]());}else{_0x2d1c33(_0x1779fb);}});});};EmailSmtp[_0x529e('0x2')][_0x529e('0x9')]=function(_0x388bdd){return new BPromise(function(_0x3f1932,_0x92d2fe){var _0x2d738e=nodemailer[_0x529e('0x4')](_0x388bdd);_0x2d738e[_0x529e('0x9')](function(_0x5ab51e,_0x34e8c2){if(_0x5ab51e){_0x92d2fe(_0x5ab51e[_0x529e('0x8')]());}else{if(_0x34e8c2){_0x3f1932(_0x34e8c2);}else{_0x92d2fe(_0x529e('0xa'));}}});});};module[_0x529e('0xb')]=EmailSmtp; \ No newline at end of file +var _0x5a68=['nodemailer','prototype','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','exports'];(function(_0x59bad8,_0x1ec010){var _0x5b923a=function(_0x2c8f65){while(--_0x2c8f65){_0x59bad8['push'](_0x59bad8['shift']());}};_0x5b923a(++_0x1ec010);}(_0x5a68,0xe6));var _0x85a6=function(_0x28f405,_0x402f3e){_0x28f405=_0x28f405-0x0;var _0x34e28b=_0x5a68[_0x28f405];return _0x34e28b;};'use strict';var nodemailer=require(_0x85a6('0x0'));var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x85a6('0x1')]['send']=function(_0x34d770,_0x146a17){return new BPromise(function(_0x56b9f3,_0x29bcb5){var _0x349a18=nodemailer[_0x85a6('0x2')](_0x34d770);_0x349a18[_0x85a6('0x3')](_0x85a6('0x4'),inlineBase64());_0x349a18[_0x85a6('0x5')](_0x146a17,function(_0x1839f7,_0x3b837f){if(_0x1839f7){_0x29bcb5(_0x1839f7[_0x85a6('0x6')]());}else{_0x56b9f3(_0x3b837f);}});});};EmailSmtp['prototype']['verify']=function(_0x81e7ea){return new BPromise(function(_0x17924f,_0x11edce){var _0x1a4a3d=nodemailer[_0x85a6('0x2')](_0x81e7ea);_0x1a4a3d[_0x85a6('0x7')](function(_0x34d33a,_0x2d36c9){if(_0x34d33a){_0x11edce(_0x34d33a[_0x85a6('0x6')]());}else{if(_0x2d36c9){_0x17924f(_0x2d36c9);}else{_0x11edce(_0x85a6('0x8'));}}});});};module[_0x85a6('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 252e3d6..35ea123 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 _0x8c98=['originCc','includes','attach','type','filename','attachment-','format','now','root','server/files/attachments/','writeFileSync','contentType','from','subject','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','content','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','name','split','length','slice','join','Anonymous','pop','isEmpty','@xcally.com','html','test','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x1c08e9[_0x88c9('0x11')]():'';}return'';}function getMails(_0x237f10,_0x1cc7b1){var _0x359f3d='';for(var _0x542704=0x0;_0x542704<_0x1cc7b1[_0x88c9('0x7')][_0x88c9('0xd')];_0x542704+=0x1){if(_0x1cc7b1[_0x88c9('0x7')][_0x542704][_0x88c9('0x8')]!==_0x237f10){if(!_[_0x88c9('0x12')](_0x359f3d)){_0x359f3d+=',';}_0x359f3d+=_0x1cc7b1[_0x88c9('0x7')][_0x542704][_0x88c9('0xb')]||_0x1cc7b1['value'][_0x542704][_0x88c9('0x8')]||'';_0x359f3d+='\x20<';_0x359f3d+=_0x1cc7b1[_0x88c9('0x7')][_0x542704][_0x88c9('0x8')]?_0x1cc7b1[_0x88c9('0x7')][_0x542704][_0x88c9('0x8')]:_0x88c9('0x9')+random[_0x88c9('0xa')](0x6)+_0x88c9('0x13');_0x359f3d+='>';}}return _0x359f3d;}function parseEmail(_0x4f3480,_0x297247,_0x176d19){if(_0x297247[_0x88c9('0x14')]){var _0x114146=/)<[^<]*)*<\/script>/gi;while(_0x114146[_0x88c9('0x15')](_0x297247[_0x88c9('0x14')])){_0x297247[_0x88c9('0x14')]=_0x297247[_0x88c9('0x14')][_0x88c9('0x16')](_0x114146,'');}if(_0x297247[_0x88c9('0x14')]['includes'](_0x88c9('0x17'))){var _0x25f314=[];_0x297247[_0x88c9('0x18')][_0x88c9('0x19')](_0x3f19e5=>{_0x25f314[_0x88c9('0x1a')](_0x3f19e5['filename']);});var _0x58a631=/]+>/g;var _0x4d1830=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x1834f3=_0x297247[_0x88c9('0x14')][_0x88c9('0x16')](_0x4d1830,'_SRC');var _0x207bc8=_0x1834f3[_0x88c9('0x16')](_0x58a631,_0x88c9('0x1b'));for(let _0x5c46b0=0x0;_0x5c46b0<_0x25f314[_0x88c9('0xd')];_0x5c46b0++){var _0x11befd=_0x207bc8[_0x88c9('0x16')]('_IMG',_0x88c9('0x1c')+_0x25f314[_0x5c46b0]+_0x88c9('0x1d'));_0x207bc8=_0x11befd;}_0x297247[_0x88c9('0x14')]=_0x207bc8;}_0x176d19['body']=_0x297247[_0x88c9('0x14')];}else{_0x176d19[_0x88c9('0x1e')]=_0x297247[_0x88c9('0x1f')];}if(_0x176d19[_0x88c9('0x1e')]){_0x176d19[_0x88c9('0x1e')]=_0x176d19['body'][_0x88c9('0x16')](/\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo'];(function(_0x371ad6,_0x3ad313){var _0x295453=function(_0x3a37ee){while(--_0x3a37ee){_0x371ad6['push'](_0x371ad6['shift']());}};_0x295453(++_0x3ad313);}(_0x6b43,0x1ca));var _0x36b4=function(_0x10b434,_0x521745){_0x10b434=_0x10b434-0x0;var _0x31050b=_0x6b43[_0x10b434];return _0x31050b;};'use strict';var _=require('lodash');var moment=require(_0x36b4('0x0'));var random=require(_0x36b4('0x1'));var fs=require('fs');var path=require('path');var util=require(_0x36b4('0x2'));var tnef=require('node-tnef');var logger=require(_0x36b4('0x3'))(_0x36b4('0x4'));var config=require('../../../config/environment');function getAddress(_0x464b5b){var _0x307ab7=_[_0x36b4('0x5')](_0x464b5b[_0x36b4('0x6')]);return _0x307ab7&&_0x307ab7[_0x36b4('0x7')]?_0x307ab7[_0x36b4('0x7')]:_0x36b4('0x8')+random[_0x36b4('0x9')](0x6)+_0x36b4('0xa');}function getFirstName(_0x5ab365){var _0x35127c=_[_0x36b4('0x5')](_0x5ab365[_0x36b4('0x6')]);if(_0x35127c&&_0x35127c[_0x36b4('0xb')]){var _0x384d10=_0x35127c[_0x36b4('0xb')][_0x36b4('0xc')](/\s+/);return _0x384d10[_0x36b4('0xd')]?_0x384d10[_0x36b4('0xe')](0x0,-0x1)[_0x36b4('0xf')]('\x20'):_0x35127c[_0x36b4('0xb')];}return _0x36b4('0x10');}function getLastName(_0x1e99cc){var _0x2b1a12=_[_0x36b4('0x5')](_0x1e99cc[_0x36b4('0x6')]);if(_0x2b1a12&&_0x2b1a12[_0x36b4('0xb')]){var _0x3662d7=_0x2b1a12[_0x36b4('0xb')][_0x36b4('0xc')](/\s+/);return _0x3662d7[_0x36b4('0xd')]>0x1?_0x3662d7['pop']():'';}return'';}function getMails(_0x4cfee5,_0x1f4b7f){var _0x59f960='';for(var _0x40fc4b=0x0;_0x40fc4b<_0x1f4b7f[_0x36b4('0x6')]['length'];_0x40fc4b+=0x1){if(_0x1f4b7f[_0x36b4('0x6')][_0x40fc4b][_0x36b4('0x7')]!==_0x4cfee5){if(!_[_0x36b4('0x11')](_0x59f960)){_0x59f960+=',';}_0x59f960+=_0x1f4b7f[_0x36b4('0x6')][_0x40fc4b][_0x36b4('0xb')]||_0x1f4b7f[_0x36b4('0x6')][_0x40fc4b][_0x36b4('0x7')]||'';_0x59f960+='\x20<';_0x59f960+=_0x1f4b7f[_0x36b4('0x6')][_0x40fc4b][_0x36b4('0x7')]?_0x1f4b7f['value'][_0x40fc4b][_0x36b4('0x7')]:'anonymous'+random[_0x36b4('0x9')](0x6)+'@xcally.com';_0x59f960+='>';}}return _0x59f960;}function parseEmail(_0x4df073,_0xb73788,_0x480979){if(_0xb73788[_0x36b4('0x12')]){var _0x409508=/)<[^<]*)*<\/script>/gi;while(_0x409508['test'](_0xb73788[_0x36b4('0x12')])){_0xb73788['html']=_0xb73788[_0x36b4('0x12')][_0x36b4('0x13')](_0x409508,'');}if(_0xb73788['html']['includes'](_0x36b4('0x14'))){var _0x193149=[];_0xb73788[_0x36b4('0x15')][_0x36b4('0x16')](_0x41770d=>{_0x193149[_0x36b4('0x17')](_0x41770d[_0x36b4('0x18')]);});var _0x13d186=/]+>/g;var _0x25f57a=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x27d95c=_0xb73788[_0x36b4('0x12')][_0x36b4('0x13')](_0x25f57a,_0x36b4('0x19'));var _0x331537=_0x27d95c[_0x36b4('0x13')](_0x13d186,_0x36b4('0x1a'));for(let _0x3cda25=0x0;_0x3cda25<_0x193149[_0x36b4('0xd')];_0x3cda25++){var _0x11cf32=_0x331537[_0x36b4('0x13')]('_IMG',_0x36b4('0x1b')+_0x193149[_0x3cda25]+_0x36b4('0x1c'));_0x331537=_0x11cf32;}_0xb73788['html']=_0x331537;}_0x480979[_0x36b4('0x1d')]=_0xb73788[_0x36b4('0x12')];}else{_0x480979['body']=_0xb73788[_0x36b4('0x1e')];}if(_0x480979[_0x36b4('0x1d')]){_0x480979[_0x36b4('0x1d')]=_0x480979[_0x36b4('0x1d')][_0x36b4('0x13')](/0x0){if(this[_0x3595f4+_0xa5f6('0x25')]>0x0&&this[_0x3595f4+_0xa5f6('0x24')]>=this[_0x3595f4+'Capacity']){return'maxcapacity';}else{return _0xa5f6('0x26');}}else{return'idle';}};Agent[_0xa5f6('0x27')]['updateRealtime']=function(){var _0x284e00=[_0xa5f6('0x28'),_0xa5f6('0x29'),_0xa5f6('0x2a'),_0xa5f6('0x2b'),_0xa5f6('0x2c'),_0xa5f6('0x2d')];for(var _0x1bf562=0x0;_0x1bf562<_0x284e00[_0xa5f6('0x2e')];_0x1bf562+=0x1){var _0x1ded63=this[_0xa5f6('0x23')](_0x284e00[_0x1bf562]);if(this[_0x284e00[_0x1bf562]+'Status']!==_0x1ded63){this[_0x284e00[_0x1bf562]+'StatusTime']=_[_0xa5f6('0x2f')](moment()[_0xa5f6('0x30')]('x'));}this[_0x284e00[_0x1bf562]+_0xa5f6('0x31')]=_0x1ded63;}var _0x12e192={'id':this['id'],'name':this[_0xa5f6('0x7')],'online':this[_0xa5f6('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0xa5f6('0x32')],'mailPause':this[_0xa5f6('0xa')],'smsPause':this[_0xa5f6('0xc')],'faxPause':this[_0xa5f6('0xb')],'openchannelPause':this[_0xa5f6('0xd')],'chatStatus':this[_0xa5f6('0xe')],'chatStatusTime':this[_0xa5f6('0xf')],'chatCapacity':this[_0xa5f6('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xa5f6('0x11')],'mailStatusTime':this[_0xa5f6('0x33')],'mailCapacity':this[_0xa5f6('0x13')],'mailCurrentCapacity':this[_0xa5f6('0x14')],'faxStatus':this[_0xa5f6('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xa5f6('0x17')],'faxCurrentCapacity':this[_0xa5f6('0x34')],'smsStatus':this[_0xa5f6('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xa5f6('0x1a')],'smsCurrentCapacity':this[_0xa5f6('0x35')],'whatsappStatus':this[_0xa5f6('0x1b')],'whatsappStatusTime':this[_0xa5f6('0x36')],'whatsappCapacity':this[_0xa5f6('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xa5f6('0x37')],'openchannelStatusTime':this[_0xa5f6('0x38')],'openchannelCapacity':this[_0xa5f6('0x1e')],'openchannelCurrentCapacity':this[_0xa5f6('0x1f')],'busy':this['busy'],'busyQueue':this[_0xa5f6('0x21')]};var _0x9b2ff1=md5(JSON[_0xa5f6('0x39')](_0x12e192));if(this[_0xa5f6('0x3a')]!==_0x9b2ff1){this['md5']=_0x9b2ff1;io[_0xa5f6('0x3b')](_0xa5f6('0x3c'),_0x12e192);}};module[_0xa5f6('0x3d')]=Agent; \ No newline at end of file +var _0xc5cf=['chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','voicePause','faxStatus','openchannelStatusTime','busy','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity'];(function(_0x45eb8a,_0xcbb016){var _0x407f55=function(_0x2ffc2b){while(--_0x2ffc2b){_0x45eb8a['push'](_0x45eb8a['shift']());}};_0x407f55(++_0xcbb016);}(_0xc5cf,0x15b));var _0xfc5c=function(_0x3b633b,_0x1fa29c){_0x3b633b=_0x3b633b-0x0;var _0x5236f9=_0xc5cf[_0x3b633b];return _0x5236f9;};'use strict';var _=require(_0xfc5c('0x0'));var moment=require(_0xfc5c('0x1'));var md5=require(_0xfc5c('0x2'));var Redis=require(_0xfc5c('0x3'));var config=require(_0xfc5c('0x4'));config[_0xfc5c('0x5')]=_[_0xfc5c('0x6')](config[_0xfc5c('0x5')],{'host':_0xfc5c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfc5c('0x5')]));function Agent(_0x382839){this['id']=_0x382839['id']||0x0;this[_0xfc5c('0x8')]=_0x382839[_0xfc5c('0x8')]||'';this[_0xfc5c('0x9')]=_0x382839['online']||!![];this['voicePause']=_0x382839['voicePause']||![];this[_0xfc5c('0xa')]=_0x382839[_0xfc5c('0xa')]||![];this[_0xfc5c('0xb')]=_0x382839[_0xfc5c('0xb')]||![];this['faxPause']=_0x382839[_0xfc5c('0xc')]||![];this[_0xfc5c('0xd')]=_0x382839[_0xfc5c('0xd')]||![];this[_0xfc5c('0xe')]=_0x382839[_0xfc5c('0xe')]||![];this[_0xfc5c('0xf')]=_0xfc5c('0x10');this[_0xfc5c('0x11')]=0x0;this[_0xfc5c('0x12')]=_0x382839[_0xfc5c('0x12')]||0x0;this[_0xfc5c('0x13')]=0x0;this[_0xfc5c('0x14')]=_0xfc5c('0x10');this[_0xfc5c('0x15')]=0x0;this[_0xfc5c('0x16')]=_0x382839['mailCapacity']||0x0;this[_0xfc5c('0x17')]=0x0;this['faxStatus']=_0xfc5c('0x10');this[_0xfc5c('0x18')]=0x0;this[_0xfc5c('0x19')]=_0x382839['faxCapacity']||0x0;this[_0xfc5c('0x1a')]=0x0;this['smsStatus']='unknown';this['smsStatusTime']=0x0;this['smsCapacity']=_0x382839[_0xfc5c('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xfc5c('0x1c')]='unknown';this[_0xfc5c('0x1d')]=0x0;this[_0xfc5c('0x1e')]=_0x382839[_0xfc5c('0x1e')]||0x0;this[_0xfc5c('0x1f')]=0x0;this[_0xfc5c('0x20')]='unknown';this['openchannelStatusTime']=0x0;this[_0xfc5c('0x21')]=_0x382839['openchannelCapacity']||0x0;this[_0xfc5c('0x22')]=0x0;this['busy']=![];this[_0xfc5c('0x23')]=undefined;this[_0xfc5c('0x2')]='';this[_0xfc5c('0x24')]();}Agent[_0xfc5c('0x25')][_0xfc5c('0x26')]=function(_0x92dca){if(this[_0x92dca+_0xfc5c('0x27')]>0x0){if(this[_0x92dca+_0xfc5c('0x28')]>0x0&&this[_0x92dca+_0xfc5c('0x27')]>=this[_0x92dca+_0xfc5c('0x28')]){return _0xfc5c('0x29');}else{return _0xfc5c('0x2a');}}else{return _0xfc5c('0x2b');}};Agent['prototype']['updateRealtime']=function(){var _0x507d06=[_0xfc5c('0x2c'),'chat','openchannel',_0xfc5c('0x2d'),_0xfc5c('0x2e'),_0xfc5c('0x2f')];for(var _0xb8a1e9=0x0;_0xb8a1e9<_0x507d06[_0xfc5c('0x30')];_0xb8a1e9+=0x1){var _0x3ad3e5=this[_0xfc5c('0x26')](_0x507d06[_0xb8a1e9]);if(this[_0x507d06[_0xb8a1e9]+_0xfc5c('0x31')]!==_0x3ad3e5){this[_0x507d06[_0xb8a1e9]+_0xfc5c('0x32')]=_[_0xfc5c('0x33')](moment()[_0xfc5c('0x34')]('x'));}this[_0x507d06[_0xb8a1e9]+_0xfc5c('0x31')]=_0x3ad3e5;}var _0x217753={'id':this['id'],'name':this[_0xfc5c('0x8')],'online':this[_0xfc5c('0x9')],'voicePause':this[_0xfc5c('0x35')],'chatPause':this[_0xfc5c('0xa')],'mailPause':this[_0xfc5c('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0xfc5c('0xc')],'openchannelPause':this[_0xfc5c('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xfc5c('0x11')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xfc5c('0x13')],'mailStatus':this[_0xfc5c('0x14')],'mailStatusTime':this[_0xfc5c('0x15')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xfc5c('0x17')],'faxStatus':this[_0xfc5c('0x36')],'faxStatusTime':this[_0xfc5c('0x18')],'faxCapacity':this[_0xfc5c('0x19')],'faxCurrentCapacity':this[_0xfc5c('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xfc5c('0x1b')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xfc5c('0x1c')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xfc5c('0x1e')],'whatsappCurrentCapacity':this[_0xfc5c('0x1f')],'openchannelStatus':this[_0xfc5c('0x20')],'openchannelStatusTime':this[_0xfc5c('0x37')],'openchannelCapacity':this[_0xfc5c('0x21')],'openchannelCurrentCapacity':this[_0xfc5c('0x22')],'busy':this[_0xfc5c('0x38')],'busyQueue':this[_0xfc5c('0x23')]};var _0x44f291=md5(JSON[_0xfc5c('0x39')](_0x217753));if(this[_0xfc5c('0x2')]!==_0x44f291){this[_0xfc5c('0x2')]=_0x44f291;io[_0xfc5c('0x3a')](_0xfc5c('0x3b'),_0x217753);}};module[_0xfc5c('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index d0c06a3..3ff5a94 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 _0x46f9=['paused','available','stringify','format','chat:queue:%s','chat_queue:save','exports','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','online','chatPause'];(function(_0x273977,_0x2d5898){var _0x58dbd2=function(_0xf7781){while(--_0xf7781){_0x273977['push'](_0x273977['shift']());}};_0x58dbd2(++_0x2d5898);}(_0x46f9,0x77));var _0x946f=function(_0x4a9be7,_0x274e5e){_0x4a9be7=_0x4a9be7-0x0;var _0x2af3cb=_0x46f9[_0x4a9be7];return _0x2af3cb;};'use strict';var _=require('lodash');var md5=require(_0x946f('0x0'));var util=require(_0x946f('0x1'));var Redis=require(_0x946f('0x2'));var config=require('../../../config/environment');config[_0x946f('0x3')]=_[_0x946f('0x4')](config[_0x946f('0x3')],{'host':_0x946f('0x5'),'port':0x18eb});var io=require(_0x946f('0x6'))(new Redis(config['redis']));function ChatQueue(_0x389f7a){this['id']=_0x389f7a['id']||0x0;this['name']=_0x389f7a[_0x946f('0x7')]||'';this[_0x946f('0x8')]=_0x389f7a[_0x946f('0x8')]||0xa;this[_0x946f('0x9')]=_0x389f7a[_0x946f('0x9')]||_0x946f('0xa');this[_0x946f('0xb')]=_0x389f7a[_0x946f('0xb')];this[_0x946f('0xc')]={};this['waiting']=0x0;this[_0x946f('0x0')]='';this[_0x946f('0xd')]();this['updateRealtime']();}ChatQueue['prototype'][_0x946f('0xd')]=function(){var _0x2f7b42=this[_0x946f('0xc')][_0x946f('0xe')];this[_0x946f('0xc')]=_[_0x946f('0xf')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x2f7b42;};ChatQueue[_0x946f('0x10')][_0x946f('0x11')]=function(){this[_0x946f('0x12')]=0x0;this['paused']=0x0;for(var _0x147e3b=0x0;_0x147e3b=0x0?this['available']:0x0;var _0x26b991={'id':this['id'],'available':this[_0x946f('0x16')],'loggedIn':this[_0x946f('0x12')],'name':this[_0x946f('0x7')],'paused':this[_0x946f('0x15')],'waiting':this['waiting']};var _0x531527=md5(JSON[_0x946f('0x17')](_0x26b991));if(this['md5']!==_0x531527){this[_0x946f('0x0')]=_0x531527;io['to'](util[_0x946f('0x18')](_0x946f('0x19'),_0x26b991[_0x946f('0x7')]))['emit'](_0x946f('0x1a'),_0x26b991);}};module[_0x946f('0x1b')]=ChatQueue; \ No newline at end of file +var _0xf98a=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','format','emit','lodash'];(function(_0x420c4b,_0x2ebe5e){var _0x1d44ed=function(_0x2896db){while(--_0x2896db){_0x420c4b['push'](_0x420c4b['shift']());}};_0x1d44ed(++_0x2ebe5e);}(_0xf98a,0x12b));var _0xaf98=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0xf98a[_0x515afd];return _0x536d53;};'use strict';var _=require(_0xaf98('0x0'));var md5=require(_0xaf98('0x1'));var util=require(_0xaf98('0x2'));var Redis=require(_0xaf98('0x3'));var config=require(_0xaf98('0x4'));config[_0xaf98('0x5')]=_[_0xaf98('0x6')](config[_0xaf98('0x5')],{'host':_0xaf98('0x7'),'port':0x18eb});var io=require(_0xaf98('0x8'))(new Redis(config[_0xaf98('0x5')]));function ChatQueue(_0x45a504){this['id']=_0x45a504['id']||0x0;this[_0xaf98('0x9')]=_0x45a504['name']||'';this[_0xaf98('0xa')]=_0x45a504[_0xaf98('0xa')]||0xa;this[_0xaf98('0xb')]=_0x45a504[_0xaf98('0xb')]||_0xaf98('0xc');this[_0xaf98('0xd')]=_0x45a504['Agents'];this['mapAgentsId']={};this[_0xaf98('0xe')]=0x0;this['md5']='';this[_0xaf98('0xf')]();this[_0xaf98('0x10')]();}ChatQueue[_0xaf98('0x11')][_0xaf98('0xf')]=function(){var _0x4ecf2a=this[_0xaf98('0x12')][_0xaf98('0x13')];this[_0xaf98('0x12')]=_[_0xaf98('0x14')](this[_0xaf98('0xd')],'id');this[_0xaf98('0x12')][_0xaf98('0x13')]=_0x4ecf2a;};ChatQueue[_0xaf98('0x11')][_0xaf98('0x10')]=function(){this[_0xaf98('0x15')]=0x0;this[_0xaf98('0x16')]=0x0;for(var _0x320ee3=0x0;_0x320ee3=0x0?this[_0xaf98('0x1a')]:0x0;var _0x4233cd={'id':this['id'],'available':this[_0xaf98('0x1a')],'loggedIn':this[_0xaf98('0x15')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xaf98('0xe')]};var _0x12bd81=md5(JSON[_0xaf98('0x1b')](_0x4233cd));if(this['md5']!==_0x12bd81){this[_0xaf98('0x1')]=_0x12bd81;io['to'](util[_0xaf98('0x1c')]('chat:queue:%s',_0x4233cd[_0xaf98('0x9')]))[_0xaf98('0x1d')]('chat_queue:save',_0x4233cd);}};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 e31ae7f..57cc611 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 _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x53f664,_0x47b9ca){var _0x4d9071=function(_0x2e9a7d){while(--_0x2e9a7d){_0x53f664['push'](_0x53f664['shift']());}};_0x4d9071(++_0x47b9ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x306818,_0x2f78ae){var _0x485b44=function(_0x2bc691){while(--_0x2bc691){_0x306818['push'](_0x306818['shift']());}};_0x485b44(++_0x2f78ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index e9de022..c683c10 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 _0xabdc=['name','Intervals'];(function(_0x47ef38,_0x3446b0){var _0x23b40d=function(_0x4ca03f){while(--_0x4ca03f){_0x47ef38['push'](_0x47ef38['shift']());}};_0x23b40d(++_0x3446b0);}(_0xabdc,0xc4));var _0xcabd=function(_0x5da77f,_0x4e92d8){_0x5da77f=_0x5da77f-0x0;var _0x132ac8=_0xabdc[_0x5da77f];return _0x132ac8;};'use strict';function Interval(_0x1877a3){this['id']=_0x1877a3['id']||0x0;this[_0xcabd('0x0')]=_0x1877a3[_0xcabd('0x0')]||'';this[_0xcabd('0x1')]=_0x1877a3[_0xcabd('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x64bd=['Intervals','exports','name'];(function(_0x3514d2,_0xcb9bf4){var _0x1b2f85=function(_0x2ba10d){while(--_0x2ba10d){_0x3514d2['push'](_0x3514d2['shift']());}};_0x1b2f85(++_0xcb9bf4);}(_0x64bd,0xa4));var _0xd64b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x64bd[_0x3bf83f];return _0x22c4a9;};'use strict';function Interval(_0x278f96){this['id']=_0x278f96['id']||0x0;this[_0xd64b('0x0')]=_0x278f96[_0xd64b('0x0')]||'';this['Intervals']=_0x278f96[_0xd64b('0x1')]||{};}module[_0xd64b('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 ebf5922..4946094 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 _0x21c9=['lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','updateRouting','prototype','map','updateRealtime','loggedIn','paused','online','mailPause','available','waiting','stringify','mail:queue:%s','mail_queue:save','exports'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0x21c9,0xea));var _0x921c=function(_0x3ddb1a,_0xaae356){_0x3ddb1a=_0x3ddb1a-0x0;var _0x767d3b=_0x21c9[_0x3ddb1a];return _0x767d3b;};'use strict';var _=require(_0x921c('0x0'));var md5=require(_0x921c('0x1'));var util=require(_0x921c('0x2'));var Redis=require(_0x921c('0x3'));var config=require('../../../config/environment');config[_0x921c('0x4')]=_[_0x921c('0x5')](config['redis'],{'host':_0x921c('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x7b6f50){this['id']=_0x7b6f50['id']||0x0;this[_0x921c('0x7')]=_0x7b6f50[_0x921c('0x7')]||'';this[_0x921c('0x8')]=_0x7b6f50[_0x921c('0x8')]||0xa;this[_0x921c('0x9')]=_0x7b6f50['strategy']||'beepall';this[_0x921c('0xa')]=_0x7b6f50['Agents'];this[_0x921c('0xb')]={};this['waiting']=0x0;this[_0x921c('0x1')]='';this[_0x921c('0xc')]();this['updateRealtime']();}MailQueue[_0x921c('0xd')][_0x921c('0xc')]=function(){var _0x55da04=this[_0x921c('0xb')]['_rr'];this[_0x921c('0xb')]=_[_0x921c('0xe')](this[_0x921c('0xa')],'id');this['mapAgentsId']['_rr']=_0x55da04;};MailQueue['prototype'][_0x921c('0xf')]=function(){this[_0x921c('0x10')]=0x0;this[_0x921c('0x11')]=0x0;for(var _0x208857=0x0;_0x208857=0x0?this['available']:0x0;var _0x5a39f6={'id':this['id'],'available':this[_0x921c('0x14')],'loggedIn':this[_0x921c('0x10')],'name':this[_0x921c('0x7')],'paused':this[_0x921c('0x11')],'waiting':this[_0x921c('0x15')]};var _0x44effc=md5(JSON[_0x921c('0x16')](_0x5a39f6));if(this['md5']!==_0x44effc){this[_0x921c('0x1')]=_0x44effc;io['to'](util['format'](_0x921c('0x17'),_0x5a39f6['name']))['emit'](_0x921c('0x18'),_0x5a39f6);}};module[_0x921c('0x19')]=MailQueue; \ No newline at end of file +var _0x5bf9=['mapAgentsId','_rr','updateRealtime','loggedIn','paused','length','mailPause','available','waiting','stringify','emit','mail_queue:save','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','prototype','updateRouting'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5bf9,0xa2));var _0x95bf=function(_0x48e40e,_0x403460){_0x48e40e=_0x48e40e-0x0;var _0x8a31ec=_0x5bf9[_0x48e40e];return _0x8a31ec;};'use strict';var _=require('lodash');var md5=require(_0x95bf('0x0'));var util=require(_0x95bf('0x1'));var Redis=require(_0x95bf('0x2'));var config=require('../../../config/environment');config[_0x95bf('0x3')]=_[_0x95bf('0x4')](config[_0x95bf('0x3')],{'host':_0x95bf('0x5'),'port':0x18eb});var io=require(_0x95bf('0x6'))(new Redis(config[_0x95bf('0x3')]));function MailQueue(_0x40d945){this['id']=_0x40d945['id']||0x0;this[_0x95bf('0x7')]=_0x40d945[_0x95bf('0x7')]||'';this['timeout']=_0x40d945[_0x95bf('0x8')]||0xa;this['strategy']=_0x40d945[_0x95bf('0x9')]||'beepall';this[_0x95bf('0xa')]=_0x40d945[_0x95bf('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x95bf('0x0')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x95bf('0xb')][_0x95bf('0xc')]=function(){var _0xc4141e=this[_0x95bf('0xd')][_0x95bf('0xe')];this[_0x95bf('0xd')]=_['map'](this[_0x95bf('0xa')],'id');this[_0x95bf('0xd')][_0x95bf('0xe')]=_0xc4141e;};MailQueue['prototype'][_0x95bf('0xf')]=function(){this[_0x95bf('0x10')]=0x0;this[_0x95bf('0x11')]=0x0;for(var _0x33f318=0x0;_0x33f318=0x0?this['available']:0x0;var _0x10656d={'id':this['id'],'available':this[_0x95bf('0x14')],'loggedIn':this[_0x95bf('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x95bf('0x15')]};var _0x34ed3d=md5(JSON[_0x95bf('0x16')](_0x10656d));if(this[_0x95bf('0x0')]!==_0x34ed3d){this['md5']=_0x34ed3d;io['to'](util['format']('mail:queue:%s',_0x10656d['name']))[_0x95bf('0x17')](_0x95bf('0x18'),_0x10656d);}};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 53d28ee..27e3d98 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 _0x82e6=['map','prototype','loggedIn','openchannelPause','paused','available','stringify','openchannel:queue:%s','emit','exports','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting'];(function(_0x1440d9,_0x4a2c7e){var _0x4a0cfb=function(_0x9dc96c){while(--_0x9dc96c){_0x1440d9['push'](_0x1440d9['shift']());}};_0x4a0cfb(++_0x4a2c7e);}(_0x82e6,0x1e5));var _0x682e=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0x82e6[_0x175e89];return _0x2ed996;};'use strict';var _=require('lodash');var md5=require(_0x682e('0x0'));var util=require(_0x682e('0x1'));var Redis=require('ioredis');var config=require(_0x682e('0x2'));config[_0x682e('0x3')]=_[_0x682e('0x4')](config[_0x682e('0x3')],{'host':_0x682e('0x5'),'port':0x18eb});var io=require(_0x682e('0x6'))(new Redis(config[_0x682e('0x3')]));function OpenchannelQueue(_0x4a77b1){this['id']=_0x4a77b1['id']||0x0;this[_0x682e('0x7')]=_0x4a77b1[_0x682e('0x7')]||'';this['timeout']=_0x4a77b1[_0x682e('0x8')]||0xa;this['strategy']=_0x4a77b1['strategy']||_0x682e('0x9');this[_0x682e('0xa')]=_0x4a77b1[_0x682e('0xa')];this[_0x682e('0xb')]={};this[_0x682e('0xc')]=0x0;this[_0x682e('0x0')]='';this['updateRouting']();this[_0x682e('0xd')]();}OpenchannelQueue['prototype'][_0x682e('0xe')]=function(){var _0x27d362=this[_0x682e('0xb')]['_rr'];this[_0x682e('0xb')]=_[_0x682e('0xf')](this[_0x682e('0xa')],'id');this[_0x682e('0xb')]['_rr']=_0x27d362;};OpenchannelQueue[_0x682e('0x10')][_0x682e('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4d63c8=0x0;_0x4d63c8=0x0?this[_0x682e('0x14')]:0x0;var _0x24234c={'id':this['id'],'available':this[_0x682e('0x14')],'loggedIn':this[_0x682e('0x11')],'name':this[_0x682e('0x7')],'paused':this[_0x682e('0x13')],'waiting':this[_0x682e('0xc')]};var _0x4e04c7=md5(JSON[_0x682e('0x15')](_0x24234c));if(this[_0x682e('0x0')]!==_0x4e04c7){this[_0x682e('0x0')]=_0x4e04c7;io['to'](util['format'](_0x682e('0x16'),_0x24234c['name']))[_0x682e('0x17')]('openchannel_queue:save',_0x24234c);}};module[_0x682e('0x18')]=OpenchannelQueue; \ No newline at end of file +var _0x4caa=['updateRealtime','prototype','_rr','map','length','online','openchannelPause','paused','available','loggedIn','name','waiting','stringify','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x4d1113,_0x129527){var _0x1ae04f=function(_0x451322){while(--_0x451322){_0x4d1113['push'](_0x4d1113['shift']());}};_0x1ae04f(++_0x129527);}(_0x4caa,0x146));var _0xa4ca=function(_0x42b707,_0x22e9c4){_0x42b707=_0x42b707-0x0;var _0x343135=_0x4caa[_0x42b707];return _0x343135;};'use strict';var _=require(_0xa4ca('0x0'));var md5=require(_0xa4ca('0x1'));var util=require(_0xa4ca('0x2'));var Redis=require(_0xa4ca('0x3'));var config=require(_0xa4ca('0x4'));config[_0xa4ca('0x5')]=_[_0xa4ca('0x6')](config[_0xa4ca('0x5')],{'host':_0xa4ca('0x7'),'port':0x18eb});var io=require(_0xa4ca('0x8'))(new Redis(config[_0xa4ca('0x5')]));function OpenchannelQueue(_0x3c3217){this['id']=_0x3c3217['id']||0x0;this['name']=_0x3c3217['name']||'';this['timeout']=_0x3c3217[_0xa4ca('0x9')]||0xa;this['strategy']=_0x3c3217[_0xa4ca('0xa')]||_0xa4ca('0xb');this['Agents']=_0x3c3217[_0xa4ca('0xc')];this[_0xa4ca('0xd')]={};this['waiting']=0x0;this[_0xa4ca('0x1')]='';this[_0xa4ca('0xe')]();this[_0xa4ca('0xf')]();}OpenchannelQueue[_0xa4ca('0x10')][_0xa4ca('0xe')]=function(){var _0x50866e=this[_0xa4ca('0xd')][_0xa4ca('0x11')];this[_0xa4ca('0xd')]=_[_0xa4ca('0x12')](this[_0xa4ca('0xc')],'id');this[_0xa4ca('0xd')]['_rr']=_0x50866e;};OpenchannelQueue[_0xa4ca('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x138341=0x0;_0x138341=0x0?this[_0xa4ca('0x17')]:0x0;var _0x37e2f9={'id':this['id'],'available':this[_0xa4ca('0x17')],'loggedIn':this[_0xa4ca('0x18')],'name':this[_0xa4ca('0x19')],'paused':this[_0xa4ca('0x16')],'waiting':this[_0xa4ca('0x1a')]};var _0x38306d=md5(JSON[_0xa4ca('0x1b')](_0x37e2f9));if(this[_0xa4ca('0x1')]!==_0x38306d){this['md5']=_0x38306d;io['to'](util['format'](_0xa4ca('0x1c'),_0x37e2f9['name']))[_0xa4ca('0x1d')](_0xa4ca('0x1e'),_0x37e2f9);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 46762a0..95ad96a 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 _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x1f4a84,_0x1118c2){var _0x40f4eb=function(_0x5c9e9c){while(--_0x5c9e9c){_0x1f4a84['push'](_0x1f4a84['shift']());}};_0x40f4eb(++_0x1118c2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file +var _0x0713=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0x1a3670,_0x593448){var _0x468ac0=function(_0x56b3a9){while(--_0x56b3a9){_0x1a3670['push'](_0x1a3670['shift']());}};_0x468ac0(++_0x593448);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 4e83249..307544d 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 _0x5663=['online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length'];(function(_0x5bdc3a,_0x18ac2a){var _0x9e0274=function(_0x2821a8){while(--_0x2821a8){_0x5bdc3a['push'](_0x5bdc3a['shift']());}};_0x9e0274(++_0x18ac2a);}(_0x5663,0xe9));var _0x3566=function(_0x3b934f,_0x59dc45){_0x3b934f=_0x3b934f-0x0;var _0x136c82=_0x5663[_0x3b934f];return _0x136c82;};'use strict';var _=require(_0x3566('0x0'));var md5=require(_0x3566('0x1'));var util=require(_0x3566('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x3566('0x3')]=_[_0x3566('0x4')](config[_0x3566('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x3566('0x5'))(new Redis(config[_0x3566('0x3')]));function WhatsappQueue(_0x5f54ec){this['id']=_0x5f54ec['id']||0x0;this[_0x3566('0x6')]=_0x5f54ec['name']||'';this['timeout']=_0x5f54ec[_0x3566('0x7')]||0xa;this['strategy']=_0x5f54ec[_0x3566('0x8')]||'beepall';this[_0x3566('0x9')]=_0x5f54ec[_0x3566('0x9')];this[_0x3566('0xa')]={};this[_0x3566('0xb')]=0x0;this['md5']='';this[_0x3566('0xc')]();this[_0x3566('0xd')]();}WhatsappQueue[_0x3566('0xe')][_0x3566('0xc')]=function(){var _0x4026e5=this[_0x3566('0xa')]['_rr'];this['mapAgentsId']=_[_0x3566('0xf')](this[_0x3566('0x9')],'id');this[_0x3566('0xa')]['_rr']=_0x4026e5;};WhatsappQueue[_0x3566('0xe')]['updateRealtime']=function(){this[_0x3566('0x10')]=0x0;this[_0x3566('0x11')]=0x0;for(var _0x58cd6c=0x0;_0x58cd6c=0x0?this['available']:0x0;var _0x147109={'id':this['id'],'available':this[_0x3566('0x15')],'loggedIn':this[_0x3566('0x10')],'name':this[_0x3566('0x6')],'paused':this[_0x3566('0x11')],'waiting':this['waiting']};var _0x1c3ba0=md5(JSON[_0x3566('0x16')](_0x147109));if(this[_0x3566('0x1')]!==_0x1c3ba0){this['md5']=_0x1c3ba0;io['to'](util[_0x3566('0x17')](_0x3566('0x18'),_0x147109[_0x3566('0x6')]))[_0x3566('0x19')](_0x3566('0x1a'),_0x147109);}};module[_0x3566('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x078f=['md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','Agents','mapAgentsId','updateRealtime','prototype','_rr','map','loggedIn','paused','online','whatsappPause','available','name','stringify','format','whatsapp_queue:save','exports','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x078f,0x1da));var _0xf078=function(_0xbe6968,_0x2d5094){_0xbe6968=_0xbe6968-0x0;var _0x53d936=_0x078f[_0xbe6968];return _0x53d936;};'use strict';var _=require(_0xf078('0x0'));var md5=require(_0xf078('0x1'));var util=require('util');var Redis=require(_0xf078('0x2'));var config=require(_0xf078('0x3'));config[_0xf078('0x4')]=_[_0xf078('0x5')](config[_0xf078('0x4')],{'host':_0xf078('0x6'),'port':0x18eb});var io=require(_0xf078('0x7'))(new Redis(config[_0xf078('0x4')]));function WhatsappQueue(_0x22c1cd){this['id']=_0x22c1cd['id']||0x0;this['name']=_0x22c1cd['name']||'';this['timeout']=_0x22c1cd[_0xf078('0x8')]||0xa;this['strategy']=_0x22c1cd['strategy']||'beepall';this[_0xf078('0x9')]=_0x22c1cd[_0xf078('0x9')];this[_0xf078('0xa')]={};this['waiting']=0x0;this[_0xf078('0x1')]='';this['updateRouting']();this[_0xf078('0xb')]();}WhatsappQueue[_0xf078('0xc')]['updateRouting']=function(){var _0x2cd226=this['mapAgentsId'][_0xf078('0xd')];this['mapAgentsId']=_[_0xf078('0xe')](this['Agents'],'id');this['mapAgentsId'][_0xf078('0xd')]=_0x2cd226;};WhatsappQueue[_0xf078('0xc')]['updateRealtime']=function(){this[_0xf078('0xf')]=0x0;this[_0xf078('0x10')]=0x0;for(var _0x5cfb4a=0x0;_0x5cfb4a=0x0?this['available']:0x0;var _0x43e69a={'id':this['id'],'available':this[_0xf078('0x13')],'loggedIn':this[_0xf078('0xf')],'name':this[_0xf078('0x14')],'paused':this['paused'],'waiting':this['waiting']};var _0x482944=md5(JSON[_0xf078('0x15')](_0x43e69a));if(this[_0xf078('0x1')]!==_0x482944){this['md5']=_0x482944;io['to'](util[_0xf078('0x16')]('whatsapp:queue:%s',_0x43e69a[_0xf078('0x14')]))['emit'](_0xf078('0x17'),_0x43e69a);}};module[_0xf078('0x18')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 115251c..f1445ea 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 _0x008c=['faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','mergeFromDatabase','updateRealtime','chatQueues','updateRouting','initSmsQueues','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues'];(function(_0x4e71ef,_0x128802){var _0x21e0a7=function(_0x467f34){while(--_0x467f34){_0x4e71ef['push'](_0x4e71ef['shift']());}};_0x21e0a7(++_0x128802);}(_0x008c,0x188));var _0xc008=function(_0x274f14,_0x27dd7f){_0x274f14=_0x274f14-0x0;var _0x13b97e=_0x008c[_0x274f14];return _0x13b97e;};'use strict';var BPromise=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var _=require(_0xc008('0x2'));var moment=require(_0xc008('0x3'));var Agent=require(_0xc008('0x4'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xc008('0x5'));var ChatQueue=require(_0xc008('0x6'));var SmsQueue=require(_0xc008('0x7'));var MailQueue=require(_0xc008('0x8'));var FaxQueue=require(_0xc008('0x9'));var WhatsappQueue=require(_0xc008('0xa'));var Realtime=function(){this[_0xc008('0xb')]={};this[_0xc008('0xc')]={};this[_0xc008('0xd')]={};this['chatQueues']={};this[_0xc008('0xe')]={};this['mailQueues']={};this[_0xc008('0xf')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0xc008('0x10')]={};this[_0xc008('0x11')]={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x1eacfa,_0xc881aa,_0x5b2004){var _0xae2dab=_[_0xc008('0x12')](_0x1eacfa,function(_0x2ea200,_0x2a5b4e){return _0x2ea200[_0x5b2004];});for(var _0x9ffa93 in _0xc881aa){if(_0xc881aa[_0xc008('0x13')](_0x9ffa93)){if(!_0xae2dab[_0x9ffa93]){delete _0xc881aa[_0x9ffa93];}}}}Realtime[_0xc008('0x14')]['mergeFromDatabase']=function(_0x560e28,_0x33f44c){for(var _0x50c1ab in _0x33f44c){if(_0x560e28[_0xc008('0x13')](_0x50c1ab)){_0x560e28[_0x50c1ab]=_0x33f44c[_0x50c1ab];}}};Realtime[_0xc008('0x14')][_0xc008('0x15')]=function(){var _0x339ffc=this;return function(_0x3f0ecf){if(_0x3f0ecf){freeIsNotKey(_0x3f0ecf,_0x339ffc['agents'],'id');for(var _0x5e894e=0x0,_0x4bd0f4={},_0x11ef38={};_0x5e894e<_0x3f0ecf[_0xc008('0x16')];_0x5e894e+=0x1){_0x4bd0f4=_0x3f0ecf[_0x5e894e];if(_[_0xc008('0x17')](_0x339ffc[_0xc008('0xb')][_0x4bd0f4['id']])){_0x339ffc['agents'][_0x4bd0f4['id']]=new Agent(_0x4bd0f4);}else{_0x339ffc['mergeFromDatabase'](_0x339ffc['agents'][_0x4bd0f4['id']],_0x4bd0f4);}}}return _0x339ffc['agents'];};};Realtime[_0xc008('0x14')][_0xc008('0x18')]=function(){var _0x501137=this;return function(_0x813397){if(_0x813397){freeIsNotKey(_0x813397,_0x501137['intervals'],'id');for(var _0x4bd611=0x0,_0x543e5d={},_0x50261c={};_0x4bd611<_0x813397[_0xc008('0x16')];_0x4bd611+=0x1){_0x543e5d=_0x813397[_0x4bd611];if(_['isUndefined'](_0x501137['intervals'][_0x543e5d['id']])){_0x501137['intervals'][_0x543e5d['id']]=new Interval(_0x543e5d);}else{_0x501137['mergeFromDatabase'](_0x501137['intervals'][_0x543e5d['id']],_0x543e5d);}}}return _0x501137[_0xc008('0xc')];};};Realtime[_0xc008('0x14')][_0xc008('0x19')]=function(){var _0x415af3=this;return function(_0x11cc75){if(_0x11cc75){freeIsNotKey(_0x11cc75,_0x415af3[_0xc008('0xd')],'id');for(var _0x4f43e2=0x0,_0x459fd9={},_0x5c85f2={};_0x4f43e2<_0x11cc75['length'];_0x4f43e2+=0x1){_0x459fd9=_0x11cc75[_0x4f43e2];if(_[_0xc008('0x17')](_0x415af3[_0xc008('0xd')][_0x459fd9['id']])){_0x415af3[_0xc008('0xd')][_0x459fd9['id']]=new OpenchannelQueue(_0x459fd9);}else{_0x415af3[_0xc008('0x1a')](_0x415af3['openchannelQueues'][_0x459fd9['id']],_0x459fd9);}_0x415af3['openchannelQueues'][_0x459fd9['id']]['updateRouting']();_0x415af3[_0xc008('0xd')][_0x459fd9['id']][_0xc008('0x1b')]();}}return _0x415af3[_0xc008('0xd')];};};Realtime[_0xc008('0x14')]['initChatQueues']=function(){var _0x5e2aca=this;return function(_0x4fce9c){if(_0x4fce9c){freeIsNotKey(_0x4fce9c,_0x5e2aca['chatQueues'],'id');for(var _0x4caaf4=0x0,_0x3865c0={},_0x29ba43={};_0x4caaf4<_0x4fce9c[_0xc008('0x16')];_0x4caaf4+=0x1){_0x3865c0=_0x4fce9c[_0x4caaf4];if(_['isUndefined'](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']])){_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]=new ChatQueue(_0x3865c0);}else{_0x5e2aca[_0xc008('0x1a')](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']],_0x3865c0);}_0x5e2aca['chatQueues'][_0x3865c0['id']][_0xc008('0x1d')]();_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]['updateRealtime']();}}return _0x5e2aca['chatQueues'];};};Realtime['prototype'][_0xc008('0x1e')]=function(){var _0x267abd=this;return function(_0xf831f2){if(_0xf831f2){freeIsNotKey(_0xf831f2,_0x267abd[_0xc008('0xe')],'id');for(var _0x1de04b=0x0,_0xceebc3={},_0x294f97={};_0x1de04b<_0xf831f2[_0xc008('0x16')];_0x1de04b+=0x1){_0xceebc3=_0xf831f2[_0x1de04b];if(_[_0xc008('0x17')](_0x267abd[_0xc008('0xe')][_0xceebc3['id']])){_0x267abd[_0xc008('0xe')][_0xceebc3['id']]=new SmsQueue(_0xceebc3);}else{_0x267abd[_0xc008('0x1a')](_0x267abd['smsQueues'][_0xceebc3['id']],_0xceebc3);}_0x267abd[_0xc008('0xe')][_0xceebc3['id']][_0xc008('0x1d')]();_0x267abd['smsQueues'][_0xceebc3['id']][_0xc008('0x1b')]();}}return _0x267abd[_0xc008('0xe')];};};Realtime[_0xc008('0x14')][_0xc008('0x1f')]=function(){var _0xd0e05a=this;return function(_0x3cd878){if(_0x3cd878){freeIsNotKey(_0x3cd878,_0xd0e05a[_0xc008('0x20')],'id');for(var _0x470e79=0x0,_0x29d4b3={},_0x4f14d2={};_0x470e79<_0x3cd878[_0xc008('0x16')];_0x470e79+=0x1){_0x29d4b3=_0x3cd878[_0x470e79];if(_[_0xc008('0x17')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']])){_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]=new MailQueue(_0x29d4b3);}else{_0xd0e05a[_0xc008('0x1a')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']],_0x29d4b3);}_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]['updateRouting']();_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']][_0xc008('0x1b')]();}}return _0xd0e05a['mailQueues'];};};Realtime[_0xc008('0x14')][_0xc008('0x21')]=function(){var _0x5e38d5=this;return function(_0x263473){if(_0x263473){freeIsNotKey(_0x263473,_0x5e38d5[_0xc008('0xf')],'id');for(var _0x280e9b=0x0,_0x55ff48={},_0x53b353={};_0x280e9b<_0x263473['length'];_0x280e9b+=0x1){_0x55ff48=_0x263473[_0x280e9b];if(_[_0xc008('0x17')](_0x5e38d5['faxQueues'][_0x55ff48['id']])){_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']]=new FaxQueue(_0x55ff48);}else{_0x5e38d5[_0xc008('0x1a')](_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']],_0x55ff48);}_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1d')]();_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1b')]();}}return _0x5e38d5[_0xc008('0xf')];};};Realtime[_0xc008('0x14')][_0xc008('0x22')]=function(){var _0x3ebb83=this;return function(_0xdfca2e){if(_0xdfca2e){freeIsNotKey(_0xdfca2e,_0x3ebb83[_0xc008('0x23')],'id');for(var _0x2bf3fd=0x0,_0x4cace5={},_0x3238b4={};_0x2bf3fd<_0xdfca2e[_0xc008('0x16')];_0x2bf3fd+=0x1){_0x4cace5=_0xdfca2e[_0x2bf3fd];if(_[_0xc008('0x17')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']])){_0x3ebb83['whatsappQueues'][_0x4cace5['id']]=new WhatsappQueue(_0x4cace5);}else{_0x3ebb83[_0xc008('0x1a')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']],_0x4cace5);}_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']][_0xc008('0x1d')]();_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']]['updateRealtime']();}}return _0x3ebb83[_0xc008('0x23')];};};module[_0xc008('0x24')]=Realtime; \ No newline at end of file +var _0x3e74=['initIntervals','mergeFromDatabase','initOpenchannelQueues','openchannelQueues','updateRealtime','updateRouting','initSmsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','bluebird','lodash','moment','../model/agent','../model/chatQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','length','isUndefined'];(function(_0x5620ce,_0x417712){var _0xd3e303=function(_0x3c64c5){while(--_0x3c64c5){_0x5620ce['push'](_0x5620ce['shift']());}};_0xd3e303(++_0x417712);}(_0x3e74,0x175));var _0x43e7=function(_0x958a85,_0x21d2e2){_0x958a85=_0x958a85-0x0;var _0x341ca5=_0x3e74[_0x958a85];return _0x341ca5;};'use strict';var BPromise=require(_0x43e7('0x0'));var util=require('util');var _=require(_0x43e7('0x1'));var moment=require(_0x43e7('0x2'));var Agent=require(_0x43e7('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x43e7('0x4'));var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x43e7('0x5'));var FaxQueue=require(_0x43e7('0x6'));var WhatsappQueue=require(_0x43e7('0x7'));var Realtime=function(){this[_0x43e7('0x8')]={};this[_0x43e7('0x9')]={};this['openchannelQueues']={};this[_0x43e7('0xa')]={};this[_0x43e7('0xb')]={};this[_0x43e7('0xc')]={};this[_0x43e7('0xd')]={};this[_0x43e7('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x43e7('0xf')]={};this['openchannelQueuesWaitingInteractions']={};this['smsQueuesWaitingInteractions']={};this[_0x43e7('0x10')]={};this[_0x43e7('0x11')]={};};function freeIsNotKey(_0x5c34f4,_0x2803d9,_0x513707){var _0xf7c520=_[_0x43e7('0x12')](_0x5c34f4,function(_0x4ebc8e,_0x3eb206){return _0x4ebc8e[_0x513707];});for(var _0xc960ea in _0x2803d9){if(_0x2803d9[_0x43e7('0x13')](_0xc960ea)){if(!_0xf7c520[_0xc960ea]){delete _0x2803d9[_0xc960ea];}}}}Realtime[_0x43e7('0x14')]['mergeFromDatabase']=function(_0x583d85,_0x2fcb36){for(var _0x21fdd3 in _0x2fcb36){if(_0x583d85[_0x43e7('0x13')](_0x21fdd3)){_0x583d85[_0x21fdd3]=_0x2fcb36[_0x21fdd3];}}};Realtime['prototype']['initAgents']=function(){var _0x16849c=this;return function(_0x14c146){if(_0x14c146){freeIsNotKey(_0x14c146,_0x16849c[_0x43e7('0x8')],'id');for(var _0x328445=0x0,_0x4de324={},_0x5c4eaa={};_0x328445<_0x14c146[_0x43e7('0x15')];_0x328445+=0x1){_0x4de324=_0x14c146[_0x328445];if(_[_0x43e7('0x16')](_0x16849c[_0x43e7('0x8')][_0x4de324['id']])){_0x16849c['agents'][_0x4de324['id']]=new Agent(_0x4de324);}else{_0x16849c['mergeFromDatabase'](_0x16849c[_0x43e7('0x8')][_0x4de324['id']],_0x4de324);}}}return _0x16849c[_0x43e7('0x8')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x17')]=function(){var _0x3776f5=this;return function(_0x1f24fb){if(_0x1f24fb){freeIsNotKey(_0x1f24fb,_0x3776f5[_0x43e7('0x9')],'id');for(var _0x1441ef=0x0,_0x2377a3={},_0xab63cf={};_0x1441ef<_0x1f24fb[_0x43e7('0x15')];_0x1441ef+=0x1){_0x2377a3=_0x1f24fb[_0x1441ef];if(_[_0x43e7('0x16')](_0x3776f5['intervals'][_0x2377a3['id']])){_0x3776f5[_0x43e7('0x9')][_0x2377a3['id']]=new Interval(_0x2377a3);}else{_0x3776f5[_0x43e7('0x18')](_0x3776f5['intervals'][_0x2377a3['id']],_0x2377a3);}}}return _0x3776f5[_0x43e7('0x9')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x19')]=function(){var _0x28aacc=this;return function(_0x4077fb){if(_0x4077fb){freeIsNotKey(_0x4077fb,_0x28aacc[_0x43e7('0x1a')],'id');for(var _0x54a9e7=0x0,_0x454359={},_0x4eea52={};_0x54a9e7<_0x4077fb['length'];_0x54a9e7+=0x1){_0x454359=_0x4077fb[_0x54a9e7];if(_[_0x43e7('0x16')](_0x28aacc[_0x43e7('0x1a')][_0x454359['id']])){_0x28aacc['openchannelQueues'][_0x454359['id']]=new OpenchannelQueue(_0x454359);}else{_0x28aacc[_0x43e7('0x18')](_0x28aacc['openchannelQueues'][_0x454359['id']],_0x454359);}_0x28aacc[_0x43e7('0x1a')][_0x454359['id']]['updateRouting']();_0x28aacc[_0x43e7('0x1a')][_0x454359['id']][_0x43e7('0x1b')]();}}return _0x28aacc[_0x43e7('0x1a')];};};Realtime[_0x43e7('0x14')]['initChatQueues']=function(){var _0x52b7b3=this;return function(_0x805b54){if(_0x805b54){freeIsNotKey(_0x805b54,_0x52b7b3['chatQueues'],'id');for(var _0x2dd5f=0x0,_0x40dc8f={},_0x3565cf={};_0x2dd5f<_0x805b54[_0x43e7('0x15')];_0x2dd5f+=0x1){_0x40dc8f=_0x805b54[_0x2dd5f];if(_['isUndefined'](_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']])){_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']]=new ChatQueue(_0x40dc8f);}else{_0x52b7b3[_0x43e7('0x18')](_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']],_0x40dc8f);}_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']][_0x43e7('0x1c')]();_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']][_0x43e7('0x1b')]();}}return _0x52b7b3[_0x43e7('0xa')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1d')]=function(){var _0x19725a=this;return function(_0x2bde44){if(_0x2bde44){freeIsNotKey(_0x2bde44,_0x19725a[_0x43e7('0xb')],'id');for(var _0x4bdb17=0x0,_0x238321={},_0x44f6b0={};_0x4bdb17<_0x2bde44[_0x43e7('0x15')];_0x4bdb17+=0x1){_0x238321=_0x2bde44[_0x4bdb17];if(_[_0x43e7('0x16')](_0x19725a[_0x43e7('0xb')][_0x238321['id']])){_0x19725a['smsQueues'][_0x238321['id']]=new SmsQueue(_0x238321);}else{_0x19725a[_0x43e7('0x18')](_0x19725a[_0x43e7('0xb')][_0x238321['id']],_0x238321);}_0x19725a[_0x43e7('0xb')][_0x238321['id']][_0x43e7('0x1c')]();_0x19725a['smsQueues'][_0x238321['id']]['updateRealtime']();}}return _0x19725a['smsQueues'];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1e')]=function(){var _0x117c07=this;return function(_0x234fe6){if(_0x234fe6){freeIsNotKey(_0x234fe6,_0x117c07[_0x43e7('0xc')],'id');for(var _0xde7ed=0x0,_0x485c6c={},_0x47baee={};_0xde7ed<_0x234fe6['length'];_0xde7ed+=0x1){_0x485c6c=_0x234fe6[_0xde7ed];if(_['isUndefined'](_0x117c07['mailQueues'][_0x485c6c['id']])){_0x117c07['mailQueues'][_0x485c6c['id']]=new MailQueue(_0x485c6c);}else{_0x117c07['mergeFromDatabase'](_0x117c07[_0x43e7('0xc')][_0x485c6c['id']],_0x485c6c);}_0x117c07['mailQueues'][_0x485c6c['id']][_0x43e7('0x1c')]();_0x117c07[_0x43e7('0xc')][_0x485c6c['id']][_0x43e7('0x1b')]();}}return _0x117c07[_0x43e7('0xc')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1f')]=function(){var _0x101d45=this;return function(_0x4f1a5f){if(_0x4f1a5f){freeIsNotKey(_0x4f1a5f,_0x101d45['faxQueues'],'id');for(var _0x5d84f4=0x0,_0xfa0474={},_0xfe70e9={};_0x5d84f4<_0x4f1a5f[_0x43e7('0x15')];_0x5d84f4+=0x1){_0xfa0474=_0x4f1a5f[_0x5d84f4];if(_[_0x43e7('0x16')](_0x101d45[_0x43e7('0xd')][_0xfa0474['id']])){_0x101d45[_0x43e7('0xd')][_0xfa0474['id']]=new FaxQueue(_0xfa0474);}else{_0x101d45[_0x43e7('0x18')](_0x101d45[_0x43e7('0xd')][_0xfa0474['id']],_0xfa0474);}_0x101d45['faxQueues'][_0xfa0474['id']][_0x43e7('0x1c')]();_0x101d45[_0x43e7('0xd')][_0xfa0474['id']]['updateRealtime']();}}return _0x101d45[_0x43e7('0xd')];};};Realtime['prototype'][_0x43e7('0x20')]=function(){var _0x2ad008=this;return function(_0x1c6f45){if(_0x1c6f45){freeIsNotKey(_0x1c6f45,_0x2ad008[_0x43e7('0xe')],'id');for(var _0x35ac85=0x0,_0x234d8f={},_0x5e731b={};_0x35ac85<_0x1c6f45['length'];_0x35ac85+=0x1){_0x234d8f=_0x1c6f45[_0x35ac85];if(_[_0x43e7('0x16')](_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']])){_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']]=new WhatsappQueue(_0x234d8f);}else{_0x2ad008[_0x43e7('0x18')](_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']],_0x234d8f);}_0x2ad008['whatsappQueues'][_0x234d8f['id']][_0x43e7('0x1c')]();_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']]['updateRealtime']();}}return _0x2ad008[_0x43e7('0xe')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index e62d72f..2f6a3dc 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 _0x7d05=['../client','update','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x1c3afc,_0x1bbf56){var _0x3e47f1=function(_0x5c8b17){while(--_0x5c8b17){_0x1c3afc['push'](_0x1c3afc['shift']());}};_0x3e47f1(++_0x1bbf56);}(_0x7d05,0x1d4));var _0x57d0=function(_0x3bd395,_0x132b83){_0x3bd395=_0x3bd395-0x0;var _0x3e5da2=_0x7d05[_0x3bd395];return _0x3e5da2;};'use strict';var client=require(_0x57d0('0x0'));exports[_0x57d0('0x1')]=function(_0xaa7713,_0x517537){return client[_0x57d0('0x2')](_0x57d0('0x3'),{'body':_0x517537,'options':{'where':{'id':_0xaa7713}},'log':'updateChatInteraction'});};exports[_0x57d0('0x4')]=function(_0x2f243e,_0x145340){return client['Request'](_0x57d0('0x5'),{'body':_0x145340,'options':{'where':{'id':_0x2f243e}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x33a3=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x49d27a,_0x166543){var _0x3f0b62=function(_0x4eb485){while(--_0x4eb485){_0x49d27a['push'](_0x49d27a['shift']());}};_0x3f0b62(++_0x166543);}(_0x33a3,0x1eb));var _0x333a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x33a3[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x333a('0x0'));exports[_0x333a('0x1')]=function(_0x5a95b3,_0x3b0fd9){return client[_0x333a('0x2')](_0x333a('0x3'),{'body':_0x3b0fd9,'options':{'where':{'id':_0x5a95b3}},'log':_0x333a('0x4')});};exports[_0x333a('0x5')]=function(_0x20cb7e,_0x4fd99f){return client[_0x333a('0x2')]('AddTagsToChatInteraction',{'body':_0x4fd99f,'options':{'where':{'id':_0x20cb7e}},'log':_0x333a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 2025ed2..6a82b8b 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 _0x22ab=['create','CreateChatMessage','createChatMessage','../client'];(function(_0xa95d11,_0x40bce6){var _0x32366b=function(_0x2ebfa7){while(--_0x2ebfa7){_0xa95d11['push'](_0xa95d11['shift']());}};_0x32366b(++_0x40bce6);}(_0x22ab,0x1ef));var _0xb22a=function(_0x5ebe34,_0x421337){_0x5ebe34=_0x5ebe34-0x0;var _0x36a3ee=_0x22ab[_0x5ebe34];return _0x36a3ee;};'use strict';var client=require(_0xb22a('0x0'));exports[_0xb22a('0x1')]=function(_0x476f53){return client['Request'](_0xb22a('0x2'),{'body':_0x476f53,'log':_0xb22a('0x3')});}; \ No newline at end of file +var _0xaa1f=['../client','CreateChatMessage'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xaa1f,0xde));var _0xfaa1=function(_0x2e95ec,_0x3029bb){_0x2e95ec=_0x2e95ec-0x0;var _0x24bcf9=_0xaa1f[_0x2e95ec];return _0x24bcf9;};'use strict';var client=require(_0xfaa1('0x0'));exports['create']=function(_0x42416b){return client['Request'](_0xfaa1('0x1'),{'body':_0x42416b,'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 8a10893..65bb608 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 _0x36ed=['Request','GetChatQueue','name','User','Agents','chatPause','../client','getChatQueues'];(function(_0x5345fa,_0x5b95f0){var _0x119e0d=function(_0x140c27){while(--_0x140c27){_0x5345fa['push'](_0x5345fa['shift']());}};_0x119e0d(++_0x5b95f0);}(_0x36ed,0xf6));var _0xd36e=function(_0x59cb9d,_0x168910){_0x59cb9d=_0x59cb9d-0x0;var _0x2b8687=_0x36ed[_0x59cb9d];return _0x2b8687;};'use strict';var client=require(_0xd36e('0x0'));exports[_0xd36e('0x1')]=function(){return function(){return client[_0xd36e('0x2')](_0xd36e('0x3'),{'options':{'raw':![],'attributes':['id',_0xd36e('0x4'),'timeout','strategy'],'include':[{'model':_0xd36e('0x5'),'as':_0xd36e('0x6'),'attributes':['id',_0xd36e('0x4'),'online',_0xd36e('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xae54=['Request','GetChatQueue','name','timeout','User','online','../client','getChatQueues'];(function(_0x265396,_0x9a7758){var _0x44919c=function(_0x341f22){while(--_0x341f22){_0x265396['push'](_0x265396['shift']());}};_0x44919c(++_0x9a7758);}(_0xae54,0xc6));var _0x4ae5=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0xae54[_0x4d674b];return _0x535a1f;};'use strict';var client=require(_0x4ae5('0x0'));exports[_0x4ae5('0x1')]=function(){return function(){return client[_0x4ae5('0x2')](_0x4ae5('0x3'),{'options':{'raw':![],'attributes':['id',_0x4ae5('0x4'),_0x4ae5('0x5'),'strategy'],'include':[{'model':_0x4ae5('0x6'),'as':'Agents','attributes':['id',_0x4ae5('0x4'),_0x4ae5('0x7'),'chatPause']}]},'log':_0x4ae5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index c756a58..87b9422 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 _0x3c7b=['../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x1cddb1,_0x4cb675){_0x1cddb1=_0x1cddb1-0x0;var _0x31f198=_0x3c7b[_0x1cddb1];return _0x31f198;};'use strict';var client=require(_0xb3c7('0x0'));exports[_0xb3c7('0x1')]=function(_0xc43ced){return client[_0xb3c7('0x2')](_0xb3c7('0x3'),{'body':_0xc43ced,'log':'CreateChatQueueReport'});};exports['update']=function(_0x500bea,_0x5b34ef){return client[_0xb3c7('0x2')](_0xb3c7('0x4'),{'body':_0x5b34ef,'options':{'where':{'uniqueid':_0x500bea},'order':[['id','DESC']],'limit':0x1},'log':_0xb3c7('0x4')});}; \ No newline at end of file +var _0x03ce=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x53b63f,_0x37af4d){var _0x24aecb=function(_0x2a3a11){while(--_0x2a3a11){_0x53b63f['push'](_0x53b63f['shift']());}};_0x24aecb(++_0x37af4d);}(_0x03ce,0x1a1));var _0xe03c=function(_0x151762,_0x17691f){_0x151762=_0x151762-0x0;var _0x27f596=_0x03ce[_0x151762];return _0x27f596;};'use strict';var client=require(_0xe03c('0x0'));exports[_0xe03c('0x1')]=function(_0x237c84){return client[_0xe03c('0x2')]('CreateChatQueueReport',{'body':_0x237c84,'log':_0xe03c('0x3')});};exports[_0xe03c('0x4')]=function(_0x326c04,_0x527a32){return client[_0xe03c('0x2')](_0xe03c('0x5'),{'body':_0x527a32,'options':{'where':{'uniqueid':_0x326c04},'order':[['id',_0xe03c('0x6')]],'limit':0x1},'log':_0xe03c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index ebaaa8c..100bf83 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 _0x5b45=['updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction'];(function(_0x3f30b0,_0x34a040){var _0x19c233=function(_0x2e3dae){while(--_0x2e3dae){_0x3f30b0['push'](_0x3f30b0['shift']());}};_0x19c233(++_0x34a040);}(_0x5b45,0x162));var _0x55b4=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x5b45[_0x45313f];return _0x402910;};'use strict';var client=require(_0x55b4('0x0'));exports[_0x55b4('0x1')]=function(_0x59124f,_0x27489b){return client['Request'](_0x55b4('0x2'),{'body':_0x27489b,'options':{'where':{'id':_0x59124f}},'log':_0x55b4('0x3')});};exports[_0x55b4('0x4')]=function(_0x1d87e7,_0x344057){return client['Request'](_0x55b4('0x5'),{'body':_0x344057,'options':{'where':{'id':_0x1d87e7}},'log':_0x55b4('0x6')});}; \ No newline at end of file +var _0x508a=['addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','Request','updateFaxInteraction'];(function(_0x47dbf1,_0x20e0b4){var _0x450fe9=function(_0xa2860c){while(--_0xa2860c){_0x47dbf1['push'](_0x47dbf1['shift']());}};_0x450fe9(++_0x20e0b4);}(_0x508a,0x111));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa508('0x0'));exports['update']=function(_0xa79e99,_0x4b8333){return client[_0xa508('0x1')]('UpdateFaxInteraction',{'body':_0x4b8333,'options':{'where':{'id':_0xa79e99}},'log':_0xa508('0x2')});};exports[_0xa508('0x3')]=function(_0x187cbb,_0x2dc741){return client[_0xa508('0x1')](_0xa508('0x4'),{'body':_0x2dc741,'options':{'where':{'id':_0x187cbb}},'log':_0xa508('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 5e7bdd4..a21da97 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 _0x7414=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0xe9225b,_0x57e738){var _0x8366f6=function(_0x3a8383){while(--_0x3a8383){_0xe9225b['push'](_0xe9225b['shift']());}};_0x8366f6(++_0x57e738);}(_0x7414,0x151));var _0x4741=function(_0x3733ea,_0xe0bfa3){_0x3733ea=_0x3733ea-0x0;var _0x2ca5d1=_0x7414[_0x3733ea];return _0x2ca5d1;};'use strict';var client=require(_0x4741('0x0'));exports[_0x4741('0x1')]=function(_0x516660){return client[_0x4741('0x2')](_0x4741('0x3'),{'body':_0x516660,'log':_0x4741('0x4')});}; \ No newline at end of file +var _0x35fc=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x2e336a,_0x50c187){var _0x49adc7=function(_0x38c8c9){while(--_0x38c8c9){_0x2e336a['push'](_0x2e336a['shift']());}};_0x49adc7(++_0x50c187);}(_0x35fc,0x87));var _0xc35f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x35fc[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0xc35f('0x0'));exports[_0xc35f('0x1')]=function(_0x689f4c){return client[_0xc35f('0x2')](_0xc35f('0x3'),{'body':_0x689f4c,'log':_0xc35f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 0315661..1b75148 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 _0xf18a=['GetFaxQueue','name','timeout','online','../client','getFaxQueues'];(function(_0x46193e,_0xbaaf70){var _0x3211cd=function(_0x5209fe){while(--_0x5209fe){_0x46193e['push'](_0x46193e['shift']());}};_0x3211cd(++_0xbaaf70);}(_0xf18a,0x1ae));var _0xaf18=function(_0x251a3e,_0x16895f){_0x251a3e=_0x251a3e-0x0;var _0x410395=_0xf18a[_0x251a3e];return _0x410395;};'use strict';var client=require(_0xaf18('0x0'));exports[_0xaf18('0x1')]=function(){return function(){return client['Request'](_0xaf18('0x2'),{'options':{'raw':![],'attributes':['id',_0xaf18('0x3'),_0xaf18('0x4'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xaf18('0x3'),_0xaf18('0x5'),'faxPause']}]},'log':_0xaf18('0x1')});};}; \ No newline at end of file +var _0xd35f=['Agents','online','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User'];(function(_0x3eff21,_0x5bf36c){var _0x1945bb=function(_0x319a9e){while(--_0x319a9e){_0x3eff21['push'](_0x3eff21['shift']());}};_0x1945bb(++_0x5bf36c);}(_0xd35f,0x1ce));var _0xfd35=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xd35f[_0xc0a3d3];return _0x3386e8;};'use strict';var client=require(_0xfd35('0x0'));exports[_0xfd35('0x1')]=function(){return function(){return client[_0xfd35('0x2')](_0xfd35('0x3'),{'options':{'raw':![],'attributes':['id',_0xfd35('0x4'),_0xfd35('0x5'),_0xfd35('0x6')],'include':[{'model':_0xfd35('0x7'),'as':_0xfd35('0x8'),'attributes':['id',_0xfd35('0x4'),_0xfd35('0x9'),'faxPause']}]},'log':_0xfd35('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0685dd8..88323f3 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 _0x2d97=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x2d97,0x1f1));var _0x72d9=function(_0x52eb71,_0x565708){_0x52eb71=_0x52eb71-0x0;var _0x585935=_0x2d97[_0x52eb71];return _0x585935;};'use strict';var client=require('../client');exports[_0x72d9('0x0')]=function(_0x4c19dd){return client[_0x72d9('0x1')](_0x72d9('0x2'),{'body':_0x4c19dd,'log':'CreateFaxQueueReport'});};exports[_0x72d9('0x3')]=function(_0x283ee2,_0x8a0a95){return client[_0x72d9('0x1')](_0x72d9('0x4'),{'body':_0x8a0a95,'options':{'where':{'uniqueid':_0x283ee2},'order':[['id',_0x72d9('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x14f1=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x14f1,0x71));var _0x114f=function(_0x55260b,_0x21a581){_0x55260b=_0x55260b-0x0;var _0x454d4b=_0x14f1[_0x55260b];return _0x454d4b;};'use strict';var client=require(_0x114f('0x0'));exports['create']=function(_0x1f7439){return client[_0x114f('0x1')]('CreateFaxQueueReport',{'body':_0x1f7439,'log':_0x114f('0x2')});};exports[_0x114f('0x3')]=function(_0x1aff03,_0x352c5f){return client[_0x114f('0x1')](_0x114f('0x4'),{'body':_0x352c5f,'options':{'where':{'uniqueid':_0x1aff03},'order':[['id',_0x114f('0x5')]],'limit':0x1},'log':_0x114f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c3a714b..17cdf29 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 _0x5ec6=['interval','../client','getIntervals','Request','name','Intervals'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x5ec6,0x7f));var _0x65ec=function(_0x529109,_0x18724e){_0x529109=_0x529109-0x0;var _0x3a2914=_0x5ec6[_0x529109];return _0x3a2914;};'use strict';var client=require(_0x65ec('0x0'));exports[_0x65ec('0x1')]=function(){return function(){return client[_0x65ec('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x65ec('0x3')],'include':[{'model':'Interval','as':_0x65ec('0x4'),'attributes':['id','name',_0x65ec('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x0fd9=['GetInterval','name','interval','getIntervals','Request'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x0fd9,0xa3));var _0x90fd=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0x0fd9[_0x52684f];return _0x4a55f0;};'use strict';var client=require('../client');exports[_0x90fd('0x0')]=function(){return function(){return client[_0x90fd('0x1')](_0x90fd('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x90fd('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x90fd('0x3'),_0x90fd('0x4')]}]},'log':_0x90fd('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 6c2abe1..7df7c35 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 _0x454d=['../client','update','Request','addTags','addTagsToChatInteraction'];(function(_0x488732,_0x1a7810){var _0x459add=function(_0x13ee65){while(--_0x13ee65){_0x488732['push'](_0x488732['shift']());}};_0x459add(++_0x1a7810);}(_0x454d,0x1e0));var _0xd454=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0x454d[_0x57e00e];return _0x415e60;};'use strict';var client=require(_0xd454('0x0'));exports[_0xd454('0x1')]=function(_0x504281,_0x3f0fc0){return client[_0xd454('0x2')]('UpdateMailInteraction',{'body':_0x3f0fc0,'options':{'where':{'id':_0x504281}},'log':'updateMailInteraction'});};exports[_0xd454('0x3')]=function(_0xb8678e,_0xea91c){return client['Request']('AddTagsToMailInteraction',{'body':_0xea91c,'options':{'where':{'id':_0xb8678e}},'log':_0xd454('0x4')});}; \ No newline at end of file +var _0x74bb=['addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','Request','AddTagsToMailInteraction'];(function(_0x19fea0,_0x1b5dc7){var _0x527968=function(_0x36276a){while(--_0x36276a){_0x19fea0['push'](_0x19fea0['shift']());}};_0x527968(++_0x1b5dc7);}(_0x74bb,0x15f));var _0xb74b=function(_0x20f50c,_0x417ed4){_0x20f50c=_0x20f50c-0x0;var _0x29b5ba=_0x74bb[_0x20f50c];return _0x29b5ba;};'use strict';var client=require(_0xb74b('0x0'));exports[_0xb74b('0x1')]=function(_0x5056fe,_0x3d7fa8){return client['Request'](_0xb74b('0x2'),{'body':_0x3d7fa8,'options':{'where':{'id':_0x5056fe}},'log':_0xb74b('0x3')});};exports['addTags']=function(_0x3455c1,_0x56ffca){return client[_0xb74b('0x4')](_0xb74b('0x5'),{'body':_0x56ffca,'options':{'where':{'id':_0x3455c1}},'log':_0xb74b('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index f126024..cf167b3 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 _0x2a8d=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x2341c0,_0xf1e896){var _0x5bfff3=function(_0x3b4a0e){while(--_0x3b4a0e){_0x2341c0['push'](_0x2341c0['shift']());}};_0x5bfff3(++_0xf1e896);}(_0x2a8d,0x129));var _0xd2a8=function(_0x2c38c1,_0x108063){_0x2c38c1=_0x2c38c1-0x0;var _0x180ee2=_0x2a8d[_0x2c38c1];return _0x180ee2;};'use strict';var client=require(_0xd2a8('0x0'));exports[_0xd2a8('0x1')]=function(_0x24c92e){return client[_0xd2a8('0x2')](_0xd2a8('0x3'),{'body':_0x24c92e,'log':_0xd2a8('0x4')});}; \ No newline at end of file +var _0x66b0=['create','CreateMailMessage','createMailMessage','../client'];(function(_0x1ac473,_0x2af39c){var _0x995eb1=function(_0x476023){while(--_0x476023){_0x1ac473['push'](_0x1ac473['shift']());}};_0x995eb1(++_0x2af39c);}(_0x66b0,0x18b));var _0x066b=function(_0x5b2c33,_0x1c12b1){_0x5b2c33=_0x5b2c33-0x0;var _0x3e95ac=_0x66b0[_0x5b2c33];return _0x3e95ac;};'use strict';var client=require(_0x066b('0x0'));exports[_0x066b('0x1')]=function(_0x3fe219){return client['Request'](_0x066b('0x2'),{'body':_0x3fe219,'log':_0x066b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index b617368..4c42a11 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 _0x977e=['../client','GetMailQueue','name','timeout','Agents','online','mailPause','getMailQueues'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x977e,0x1c0));var _0xe977=function(_0x1b9138,_0x2e952a){_0x1b9138=_0x1b9138-0x0;var _0x205628=_0x977e[_0x1b9138];return _0x205628;};'use strict';var client=require(_0xe977('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0xe977('0x1'),{'options':{'raw':![],'attributes':['id',_0xe977('0x2'),_0xe977('0x3'),'strategy'],'include':[{'model':'User','as':_0xe977('0x4'),'attributes':['id','name',_0xe977('0x5'),_0xe977('0x6')]}]},'log':_0xe977('0x7')});};}; \ No newline at end of file +var _0xd2eb=['getMailQueues','Request','GetMailQueue','timeout','strategy','User','name','online','mailPause','../client'];(function(_0x291aaf,_0x4c6d8d){var _0x5571e6=function(_0x1b4fec){while(--_0x1b4fec){_0x291aaf['push'](_0x291aaf['shift']());}};_0x5571e6(++_0x4c6d8d);}(_0xd2eb,0x95));var _0xbd2e=function(_0x154b20,_0x20bf45){_0x154b20=_0x154b20-0x0;var _0x5c59a0=_0xd2eb[_0x154b20];return _0x5c59a0;};'use strict';var client=require(_0xbd2e('0x0'));exports[_0xbd2e('0x1')]=function(){return function(){return client[_0xbd2e('0x2')](_0xbd2e('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xbd2e('0x4'),_0xbd2e('0x5')],'include':[{'model':_0xbd2e('0x6'),'as':'Agents','attributes':['id',_0xbd2e('0x7'),_0xbd2e('0x8'),_0xbd2e('0x9')]}]},'log':_0xbd2e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 543a11b..5e06e34 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 _0x3a9d=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x2bdb49,_0x29f6f2){var _0x54b73a=function(_0x58a2c1){while(--_0x58a2c1){_0x2bdb49['push'](_0x2bdb49['shift']());}};_0x54b73a(++_0x29f6f2);}(_0x3a9d,0x17f));var _0xd3a9=function(_0x4c9e59,_0xaeb1d6){_0x4c9e59=_0x4c9e59-0x0;var _0x36c8b0=_0x3a9d[_0x4c9e59];return _0x36c8b0;};'use strict';var client=require(_0xd3a9('0x0'));exports['create']=function(_0x935be3){return client[_0xd3a9('0x1')](_0xd3a9('0x2'),{'body':_0x935be3,'log':_0xd3a9('0x2')});};exports[_0xd3a9('0x3')]=function(_0x4fa66c,_0x291581){return client[_0xd3a9('0x1')](_0xd3a9('0x4'),{'body':_0x291581,'options':{'where':{'uniqueid':_0x4fa66c},'order':[['id',_0xd3a9('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xc994=['../client','create','CreateMailQueueReport','update','Request','DESC'];(function(_0x259694,_0x322239){var _0x11ddb6=function(_0x17811f){while(--_0x17811f){_0x259694['push'](_0x259694['shift']());}};_0x11ddb6(++_0x322239);}(_0xc994,0x13e));var _0x4c99=function(_0x508805,_0x3b8486){_0x508805=_0x508805-0x0;var _0xff1b11=_0xc994[_0x508805];return _0xff1b11;};'use strict';var client=require(_0x4c99('0x0'));exports[_0x4c99('0x1')]=function(_0x3b0b59){return client['Request'](_0x4c99('0x2'),{'body':_0x3b0b59,'log':_0x4c99('0x2')});};exports[_0x4c99('0x3')]=function(_0x26aaca,_0x455dfd){return client[_0x4c99('0x4')]('UpdateMailQueueReport',{'body':_0x455dfd,'options':{'where':{'uniqueid':_0x26aaca},'order':[['id',_0x4c99('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 7d293f4..2d957d3 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 _0x6c3c=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x427882,_0x129ce9){var _0x4c0f90=function(_0x1fe87a){while(--_0x1fe87a){_0x427882['push'](_0x427882['shift']());}};_0x4c0f90(++_0x129ce9);}(_0x6c3c,0x1b0));var _0xc6c3=function(_0x4d928b,_0xfcda3e){_0x4d928b=_0x4d928b-0x0;var _0x24464e=_0x6c3c[_0x4d928b];return _0x24464e;};'use strict';var client=require('../client');exports['update']=function(_0x404aaa,_0x17fbb7){return client[_0xc6c3('0x0')](_0xc6c3('0x1'),{'body':_0x17fbb7,'options':{'where':{'id':_0x404aaa}},'log':_0xc6c3('0x2')});};exports['addTags']=function(_0x22667b,_0xba640f){return client[_0xc6c3('0x0')](_0xc6c3('0x3'),{'body':_0xba640f,'options':{'where':{'id':_0x22667b}},'log':_0xc6c3('0x4')});}; \ No newline at end of file +var _0xf332=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request'];(function(_0x19cfac,_0x3745dc){var _0x25d2a5=function(_0x2bad78){while(--_0x2bad78){_0x19cfac['push'](_0x19cfac['shift']());}};_0x25d2a5(++_0x3745dc);}(_0xf332,0x11b));var _0x2f33=function(_0x45f61c,_0x5b02c7){_0x45f61c=_0x45f61c-0x0;var _0xaf5dc=_0xf332[_0x45f61c];return _0xaf5dc;};'use strict';var client=require('../client');exports[_0x2f33('0x0')]=function(_0xf183a3,_0x54095e){return client[_0x2f33('0x1')]('UpdateOpenchannelInteraction',{'body':_0x54095e,'options':{'where':{'id':_0xf183a3}},'log':'updateOpenchannelInteraction'});};exports[_0x2f33('0x2')]=function(_0x59efb0,_0x2c6b5e){return client['Request'](_0x2f33('0x3'),{'body':_0x2c6b5e,'options':{'where':{'id':_0x59efb0}},'log':_0x2f33('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 780dcd1..782c0bf 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 _0xe5b3=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x73b1cd,_0x176535){var _0x243426=function(_0x1ee7c0){while(--_0x1ee7c0){_0x73b1cd['push'](_0x73b1cd['shift']());}};_0x243426(++_0x176535);}(_0xe5b3,0x133));var _0x3e5b=function(_0x21c460,_0x12b0f7){_0x21c460=_0x21c460-0x0;var _0x10c857=_0xe5b3[_0x21c460];return _0x10c857;};'use strict';var client=require('../client');exports[_0x3e5b('0x0')]=function(_0xba44a0){return client[_0x3e5b('0x1')](_0x3e5b('0x2'),{'body':_0xba44a0,'log':_0x3e5b('0x3')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0xedd9,0xfc));var _0x9edd=function(_0x38a975,_0x180aa9){_0x38a975=_0x38a975-0x0;var _0x19f32b=_0xedd9[_0x38a975];return _0x19f32b;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 17f22a0..daed671 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 _0x469e=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','openchannelPause','../client'];(function(_0x42d3ac,_0x207868){var _0x264745=function(_0x528a73){while(--_0x528a73){_0x42d3ac['push'](_0x42d3ac['shift']());}};_0x264745(++_0x207868);}(_0x469e,0x9f));var _0xe469=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x469e[_0x4ea69d];return _0x5318e0;};'use strict';var client=require(_0xe469('0x0'));exports[_0xe469('0x1')]=function(){return function(){return client[_0xe469('0x2')](_0xe469('0x3'),{'options':{'raw':![],'attributes':['id',_0xe469('0x4'),_0xe469('0x5'),_0xe469('0x6')],'include':[{'model':_0xe469('0x7'),'as':_0xe469('0x8'),'attributes':['id',_0xe469('0x4'),'online',_0xe469('0x9')]}]},'log':_0xe469('0x1')});};}; \ No newline at end of file +var _0x2628=['Request','timeout','strategy','User','name','openchannelPause','../client','getOpenchannelQueues'];(function(_0x227e46,_0x5a362f){var _0x3f7de0=function(_0x5afa0d){while(--_0x5afa0d){_0x227e46['push'](_0x227e46['shift']());}};_0x3f7de0(++_0x5a362f);}(_0x2628,0x12e));var _0x8262=function(_0xd236d9,_0x3d1acd){_0xd236d9=_0xd236d9-0x0;var _0xa8bd40=_0x2628[_0xd236d9];return _0xa8bd40;};'use strict';var client=require(_0x8262('0x0'));exports[_0x8262('0x1')]=function(){return function(){return client[_0x8262('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x8262('0x3'),_0x8262('0x4')],'include':[{'model':_0x8262('0x5'),'as':'Agents','attributes':['id',_0x8262('0x6'),'online',_0x8262('0x7')]}]},'log':_0x8262('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 22fc490..b40e5ed 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 _0xbf5a=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client','create'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xbf5a,0xb8));var _0xabf5=function(_0x4dc34b,_0x263344){_0x4dc34b=_0x4dc34b-0x0;var _0x57b304=_0xbf5a[_0x4dc34b];return _0x57b304;};'use strict';var client=require(_0xabf5('0x0'));exports[_0xabf5('0x1')]=function(_0x433f03){return client[_0xabf5('0x2')](_0xabf5('0x3'),{'body':_0x433f03,'log':'CreateOpenchannelQueueReport'});};exports[_0xabf5('0x4')]=function(_0xbeefe9,_0xa9529f){return client[_0xabf5('0x2')]('UpdateOpenchannelQueueReport',{'body':_0xa9529f,'options':{'where':{'uniqueid':_0xbeefe9},'order':[['id','DESC']],'limit':0x1},'log':_0xabf5('0x5')});}; \ No newline at end of file +var _0x740d=['update','Request','UpdateOpenchannelQueueReport','../client','create','CreateOpenchannelQueueReport'];(function(_0x17bef5,_0x423104){var _0x3f92d1=function(_0x1b2f28){while(--_0x1b2f28){_0x17bef5['push'](_0x17bef5['shift']());}};_0x3f92d1(++_0x423104);}(_0x740d,0x183));var _0xd740=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x740d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd740('0x0'));exports[_0xd740('0x1')]=function(_0xa15bd1){return client['Request'](_0xd740('0x2'),{'body':_0xa15bd1,'log':_0xd740('0x2')});};exports[_0xd740('0x3')]=function(_0x3b0764,_0x4d39d6){return client[_0xd740('0x4')](_0xd740('0x5'),{'body':_0x4d39d6,'options':{'where':{'uniqueid':_0x3b0764},'order':[['id','DESC']],'limit':0x1},'log':_0xd740('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 932f693..f2ea7df 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 _0x6c3d=['updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0x6c3d,0x96));var _0xd6c3=function(_0x4861c2,_0x574489){_0x4861c2=_0x4861c2-0x0;var _0x30bedf=_0x6c3d[_0x4861c2];return _0x30bedf;};'use strict';var client=require(_0xd6c3('0x0'));exports[_0xd6c3('0x1')]=function(_0x3ac5ea,_0x3d9dc1){return client[_0xd6c3('0x2')](_0xd6c3('0x3'),{'body':_0x3d9dc1,'options':{'where':{'id':_0x3ac5ea}},'log':_0xd6c3('0x4')});};exports['addTags']=function(_0x268138,_0x41d965){return client[_0xd6c3('0x2')](_0xd6c3('0x5'),{'body':_0x41d965,'options':{'where':{'id':_0x268138}},'log':_0xd6c3('0x6')});}; \ No newline at end of file +var _0x423c=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x423c,0xba));var _0xc423=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x423c[_0x4b055c];return _0x4b62bb;};'use strict';var client=require(_0xc423('0x0'));exports[_0xc423('0x1')]=function(_0x5374ff,_0x294bcf){return client[_0xc423('0x2')](_0xc423('0x3'),{'body':_0x294bcf,'options':{'where':{'id':_0x5374ff}},'log':_0xc423('0x4')});};exports[_0xc423('0x5')]=function(_0x143843,_0x1a489b){return client[_0xc423('0x2')](_0xc423('0x6'),{'body':_0x1a489b,'options':{'where':{'id':_0x143843}},'log':_0xc423('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 0e1e8fd..50effbe 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 _0x4d7f=['createSmsMessage','../client','CreateSmsMessage'];(function(_0x2c4570,_0x21871d){var _0x26f4b0=function(_0x56b0dc){while(--_0x56b0dc){_0x2c4570['push'](_0x2c4570['shift']());}};_0x26f4b0(++_0x21871d);}(_0x4d7f,0xc1));var _0xf4d7=function(_0x3ae309,_0x4ea0bd){_0x3ae309=_0x3ae309-0x0;var _0x33a076=_0x4d7f[_0x3ae309];return _0x33a076;};'use strict';var client=require(_0xf4d7('0x0'));exports['create']=function(_0x2f93f4){return client['Request'](_0xf4d7('0x1'),{'body':_0x2f93f4,'log':_0xf4d7('0x2')});}; \ No newline at end of file +var _0x02c5=['Request','../client','create'];(function(_0x5040ae,_0x2a23c2){var _0x3215a2=function(_0x150f23){while(--_0x150f23){_0x5040ae['push'](_0x5040ae['shift']());}};_0x3215a2(++_0x2a23c2);}(_0x02c5,0x178));var _0x502c=function(_0x4c6bca,_0x3de390){_0x4c6bca=_0x4c6bca-0x0;var _0x29d58e=_0x02c5[_0x4c6bca];return _0x29d58e;};'use strict';var client=require(_0x502c('0x0'));exports[_0x502c('0x1')]=function(_0x59179e){return client[_0x502c('0x2')]('CreateSmsMessage',{'body':_0x59179e,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 29aca57..e1dce6b 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 _0xf935=['Request','timeout','strategy','User','Agents','name','online','smsPause','../client','getSmsQueues'];(function(_0x25c997,_0xb97174){var _0xa88319=function(_0x5b5ccb){while(--_0x5b5ccb){_0x25c997['push'](_0x25c997['shift']());}};_0xa88319(++_0xb97174);}(_0xf935,0xbc));var _0x5f93=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf935[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x5f93('0x0'));exports[_0x5f93('0x1')]=function(){return function(){return client[_0x5f93('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x5f93('0x3'),_0x5f93('0x4')],'include':[{'model':_0x5f93('0x5'),'as':_0x5f93('0x6'),'attributes':['id',_0x5f93('0x7'),_0x5f93('0x8'),_0x5f93('0x9')]}]},'log':_0x5f93('0x1')});};}; \ No newline at end of file +var _0xca4a=['strategy','User','Agents','getSmsQueues','../client','Request','GetSmsQueue','name','timeout'];(function(_0x38d7fd,_0x4a91af){var _0x451896=function(_0x21e4aa){while(--_0x21e4aa){_0x38d7fd['push'](_0x38d7fd['shift']());}};_0x451896(++_0x4a91af);}(_0xca4a,0xa6));var _0xaca4=function(_0x2d4ad5,_0x11ed84){_0x2d4ad5=_0x2d4ad5-0x0;var _0x281e35=_0xca4a[_0x2d4ad5];return _0x281e35;};'use strict';var client=require(_0xaca4('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0xaca4('0x1')](_0xaca4('0x2'),{'options':{'raw':![],'attributes':['id',_0xaca4('0x3'),_0xaca4('0x4'),_0xaca4('0x5')],'include':[{'model':_0xaca4('0x6'),'as':_0xaca4('0x7'),'attributes':['id',_0xaca4('0x3'),'online','smsPause']}]},'log':_0xaca4('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 2d1d25f..30c5c75 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 _0x00dd=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client','create'];(function(_0x5c183c,_0x3d57a4){var _0xfa883d=function(_0xb22fe2){while(--_0xb22fe2){_0x5c183c['push'](_0x5c183c['shift']());}};_0xfa883d(++_0x3d57a4);}(_0x00dd,0xc9));var _0xd00d=function(_0x18b31e,_0x2065a1){_0x18b31e=_0x18b31e-0x0;var _0x132f59=_0x00dd[_0x18b31e];return _0x132f59;};'use strict';var client=require(_0xd00d('0x0'));exports[_0xd00d('0x1')]=function(_0x5157d1){return client[_0xd00d('0x2')](_0xd00d('0x3'),{'body':_0x5157d1,'log':_0xd00d('0x3')});};exports[_0xd00d('0x4')]=function(_0x28fa44,_0x331461){return client[_0xd00d('0x2')](_0xd00d('0x5'),{'body':_0x331461,'options':{'where':{'uniqueid':_0x28fa44},'order':[['id',_0xd00d('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x0ed1=['Request','UpdateSmsQueueReport','../client','CreateSmsQueueReport','update'];(function(_0x2731c5,_0x1c7fa0){var _0x1c4fee=function(_0x30e1bc){while(--_0x30e1bc){_0x2731c5['push'](_0x2731c5['shift']());}};_0x1c4fee(++_0x1c7fa0);}(_0x0ed1,0xb1));var _0x10ed=function(_0x1ad12e,_0x391c49){_0x1ad12e=_0x1ad12e-0x0;var _0x57c4ef=_0x0ed1[_0x1ad12e];return _0x57c4ef;};'use strict';var client=require(_0x10ed('0x0'));exports['create']=function(_0x12f5f9){return client['Request'](_0x10ed('0x1'),{'body':_0x12f5f9,'log':_0x10ed('0x1')});};exports[_0x10ed('0x2')]=function(_0x22ccc1,_0x3c4bff){return client[_0x10ed('0x3')](_0x10ed('0x4'),{'body':_0x3c4bff,'options':{'where':{'uniqueid':_0x22ccc1},'order':[['id','DESC']],'limit':0x1},'log':_0x10ed('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 46d91a8..6f846f7 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 _0x3de6=['faxPause','smsPause','openchannelPause','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','../client','getAgents','Request','GetUser','agent','name','online','pauseType','lastPauseAt','voicePause','chatPause','mailPause'];(function(_0xbd32c6,_0x3cde5f){var _0x423dfd=function(_0x1065d0){while(--_0x1065d0){_0xbd32c6['push'](_0xbd32c6['shift']());}};_0x423dfd(++_0x3cde5f);}(_0x3de6,0xc5));var _0x63de=function(_0x41d90f,_0x589fe0){_0x41d90f=_0x41d90f-0x0;var _0x3e6b4e=_0x3de6[_0x41d90f];return _0x3e6b4e;};'use strict';var client=require(_0x63de('0x0'));exports[_0x63de('0x1')]=function(){return function(){return client[_0x63de('0x2')](_0x63de('0x3'),{'options':{'raw':!![],'where':{'role':_0x63de('0x4')},'attributes':['id',_0x63de('0x5'),_0x63de('0x6'),_0x63de('0x7'),_0x63de('0x8'),_0x63de('0x9'),_0x63de('0xa'),_0x63de('0xb'),_0x63de('0xc'),_0x63de('0xd'),'whatsappPause',_0x63de('0xe'),'chatCapacity',_0x63de('0xf'),_0x63de('0x10'),_0x63de('0x11'),_0x63de('0x12'),'openchannelCapacity']},'log':_0x63de('0x1')});};}; \ No newline at end of file +var _0xe778=['mailPause','faxPause','whatsappPause','openchannelPause','faxCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name','online','lastPauseAt','chatPause'];(function(_0x183cba,_0xa3a616){var _0x2fd590=function(_0x5cf16d){while(--_0x5cf16d){_0x183cba['push'](_0x183cba['shift']());}};_0x2fd590(++_0xa3a616);}(_0xe778,0x137));var _0x8e77=function(_0x4b8c0c,_0x5a29cc){_0x4b8c0c=_0x4b8c0c-0x0;var _0x312c67=_0xe778[_0x4b8c0c];return _0x312c67;};'use strict';var client=require(_0x8e77('0x0'));exports[_0x8e77('0x1')]=function(){return function(){return client[_0x8e77('0x2')](_0x8e77('0x3'),{'options':{'raw':!![],'where':{'role':_0x8e77('0x4')},'attributes':['id',_0x8e77('0x5'),_0x8e77('0x6'),'pauseType',_0x8e77('0x7'),'voicePause',_0x8e77('0x8'),_0x8e77('0x9'),_0x8e77('0xa'),'smsPause',_0x8e77('0xb'),_0x8e77('0xc'),'chatCapacity','mailCapacity',_0x8e77('0xd'),'smsCapacity',_0x8e77('0xe'),_0x8e77('0xf')]},'log':_0x8e77('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 3dd692d..0c0f33a 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 _0x579c=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction'];(function(_0x15dda5,_0x3f0948){var _0x3b920a=function(_0x4fc0d0){while(--_0x4fc0d0){_0x15dda5['push'](_0x15dda5['shift']());}};_0x3b920a(++_0x3f0948);}(_0x579c,0xda));var _0xc579=function(_0x2358b3,_0x441f7e){_0x2358b3=_0x2358b3-0x0;var _0x3c2b44=_0x579c[_0x2358b3];return _0x3c2b44;};'use strict';var client=require(_0xc579('0x0'));exports[_0xc579('0x1')]=function(_0x2757c6,_0x1db849){return client[_0xc579('0x2')]('UpdateWhatsappInteraction',{'body':_0x1db849,'options':{'where':{'id':_0x2757c6}},'log':_0xc579('0x3')});};exports['addTags']=function(_0x21a0a2,_0x3b913c){return client[_0xc579('0x2')](_0xc579('0x4'),{'body':_0x3b913c,'options':{'where':{'id':_0x21a0a2}},'log':_0xc579('0x5')});}; \ No newline at end of file +var _0x0a12=['addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','UpdateWhatsappInteraction'];(function(_0x2f3738,_0x115a52){var _0x3dfa2c=function(_0x91434d){while(--_0x91434d){_0x2f3738['push'](_0x2f3738['shift']());}};_0x3dfa2c(++_0x115a52);}(_0x0a12,0xb8));var _0x20a1=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x0a12[_0x424a9a];return _0xa7831c;};'use strict';var client=require('../client');exports[_0x20a1('0x0')]=function(_0x4bd998,_0x4a289d){return client['Request'](_0x20a1('0x1'),{'body':_0x4a289d,'options':{'where':{'id':_0x4bd998}},'log':'updateWhatsappInteraction'});};exports[_0x20a1('0x2')]=function(_0x2079d8,_0x2cd34f){return client[_0x20a1('0x3')](_0x20a1('0x4'),{'body':_0x2cd34f,'options':{'where':{'id':_0x2079d8}},'log':_0x20a1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 63a747d..0c24ec8 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 _0x75ff=['create','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x2f6933,_0x4edbce){var _0x28e69c=function(_0x5a3284){while(--_0x5a3284){_0x2f6933['push'](_0x2f6933['shift']());}};_0x28e69c(++_0x4edbce);}(_0x75ff,0x173));var _0xf75f=function(_0x326c48,_0x31eee6){_0x326c48=_0x326c48-0x0;var _0xf71bc5=_0x75ff[_0x326c48];return _0xf71bc5;};'use strict';var client=require(_0xf75f('0x0'));exports[_0xf75f('0x1')]=function(_0x322773){return client['Request'](_0xf75f('0x2'),{'body':_0x322773,'log':_0xf75f('0x3')});}; \ No newline at end of file +var _0x5d8a=['Request','createWhatsappMessage','../client','create'];(function(_0x54b56d,_0x43cee0){var _0x29e581=function(_0x2d0f0f){while(--_0x2d0f0f){_0x54b56d['push'](_0x54b56d['shift']());}};_0x29e581(++_0x43cee0);}(_0x5d8a,0x7a));var _0xa5d8=function(_0x1fac1b,_0x5aa87f){_0x1fac1b=_0x1fac1b-0x0;var _0x5ca6c3=_0x5d8a[_0x1fac1b];return _0x5ca6c3;};'use strict';var client=require(_0xa5d8('0x0'));exports[_0xa5d8('0x1')]=function(_0x366a37){return client[_0xa5d8('0x2')]('CreateWhatsappMessage',{'body':_0x366a37,'log':_0xa5d8('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 50961e2..bbd2926 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 _0x7fce=['Request','name','strategy','Agents','../client','getWhatsappQueues'];(function(_0x26fa67,_0x2f529c){var _0x54d19b=function(_0x50d8ea){while(--_0x50d8ea){_0x26fa67['push'](_0x26fa67['shift']());}};_0x54d19b(++_0x2f529c);}(_0x7fce,0xdc));var _0xe7fc=function(_0x42e8aa,_0x3c82bc){_0x42e8aa=_0x42e8aa-0x0;var _0x235fa5=_0x7fce[_0x42e8aa];return _0x235fa5;};'use strict';var client=require(_0xe7fc('0x0'));exports[_0xe7fc('0x1')]=function(){return function(){return client[_0xe7fc('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xe7fc('0x3'),'timeout',_0xe7fc('0x4')],'include':[{'model':'User','as':_0xe7fc('0x5'),'attributes':['id',_0xe7fc('0x3'),'online','whatsappPause']}]},'log':_0xe7fc('0x1')});};}; \ No newline at end of file +var _0x96cc=['Agents','online','whatsappPause','getWhatsappQueues','../client','Request','name','timeout','strategy','User'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x96cc,0x16c));var _0xc96c=function(_0x4cce3d,_0x1e84ea){_0x4cce3d=_0x4cce3d-0x0;var _0x39b6df=_0x96cc[_0x4cce3d];return _0x39b6df;};'use strict';var client=require(_0xc96c('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xc96c('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xc96c('0x2'),_0xc96c('0x3'),_0xc96c('0x4')],'include':[{'model':_0xc96c('0x5'),'as':_0xc96c('0x6'),'attributes':['id',_0xc96c('0x2'),_0xc96c('0x7'),_0xc96c('0x8')]}]},'log':_0xc96c('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index d00bda8..ba8d5a3 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 _0x056e=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x3ab2af,_0x16776a){var _0x522462=function(_0x2c4cbe){while(--_0x2c4cbe){_0x3ab2af['push'](_0x3ab2af['shift']());}};_0x522462(++_0x16776a);}(_0x056e,0x1c3));var _0xe056=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x056e[_0x2cd1fb];return _0x48fd2b;};'use strict';var client=require(_0xe056('0x0'));exports[_0xe056('0x1')]=function(_0x3d1de6){return client[_0xe056('0x2')](_0xe056('0x3'),{'body':_0x3d1de6,'log':'CreateWhatsappQueueReport'});};exports[_0xe056('0x4')]=function(_0x53f2d6,_0x5781d3){return client[_0xe056('0x2')](_0xe056('0x5'),{'body':_0x5781d3,'options':{'where':{'uniqueid':_0x53f2d6},'order':[['id',_0xe056('0x6')]],'limit':0x1},'log':_0xe056('0x5')});}; \ No newline at end of file +var _0xd867=['UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x5804e9,_0x38e64f){var _0x13e43c=function(_0x47beca){while(--_0x47beca){_0x5804e9['push'](_0x5804e9['shift']());}};_0x13e43c(++_0x38e64f);}(_0xd867,0x151));var _0x7d86=function(_0x38df85,_0x50902a){_0x38df85=_0x38df85-0x0;var _0x126e1f=_0xd867[_0x38df85];return _0x126e1f;};'use strict';var client=require(_0x7d86('0x0'));exports[_0x7d86('0x1')]=function(_0x359505){return client[_0x7d86('0x2')](_0x7d86('0x3'),{'body':_0x359505,'log':_0x7d86('0x3')});};exports[_0x7d86('0x4')]=function(_0x2dfca7,_0x4a3835){return client[_0x7d86('0x2')](_0x7d86('0x5'),{'body':_0x4a3835,'options':{'where':{'uniqueid':_0x2dfca7},'order':[['id','DESC']],'limit':0x1},'log':_0x7d86('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 c480bd9..449cb19 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 _0xc44c=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format'];(function(_0x17d07b,_0x211c4d){var _0x388885=function(_0x23458f){while(--_0x23458f){_0x17d07b['push'](_0x17d07b['shift']());}};_0x388885(++_0x211c4d);}(_0xc44c,0xa0));var _0xcc44=function(_0x5e8bed,_0x207fda){_0x5e8bed=_0x5e8bed-0x0;var _0x50b244=_0xc44c[_0x5e8bed];return _0x50b244;};'use strict';var schema=require(_0xcc44('0x0'));var _=require(_0xcc44('0x1'));var util=require(_0xcc44('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xcc44('0x3'))('routing');var strategy=require(_0xcc44('0x4'));var queue=schema({'name':{'type':_0xcc44('0x5'),'required':!![],'message':_0xcc44('0x6')},'timeout':{'type':'number','message':_0xcc44('0x7')}});function writeLog(_0x1b11b0,_0x3d8f65,_0x4c7047){return logger[_0xcc44('0x8')](util[_0xcc44('0x9')](_0xcc44('0xa'),_0x1b11b0,_0x3d8f65[_0xcc44('0xb')],_0x4c7047));}function handleFindAgent(_0x20e5ce){return function(_0xc21c60){return _0xc21c60[_0xcc44('0xb')][_0xcc44('0xc')]()===_0x20e5ce[_0xcc44('0xc')]();};}exports[_0xcc44('0xd')]=function(_0x38eb85,_0xceee87,_0x1fc936,_0x479f66){return function(_0x334be9){try{var _0x344f01={'name':_0xceee87[0x0],'timeout':_0xceee87[0x1]};var _0x406d29=queue[_0xcc44('0x0')](_0x344f01,{'typecast':!![]});if(_0x406d29[_0xcc44('0xe')]){logger['error']('[%s][AGENT]\x20%s',_0x38eb85,_['map'](_0x406d29,'message')[_0xcc44('0xf')](',\x20'));_0x334be9[_0xcc44('0x10')]();}else{var _0x52936a=_[_0xcc44('0x11')](_0x1fc936[_0xcc44('0x12')],handleFindAgent(_0x344f01[_0xcc44('0xb')]));if(_0x52936a){var _0x37daa3=(_0x344f01[_0xcc44('0x13')]||0xa)*0x3e8;var _0x52d096,_0x5d2a51;var _0x25cbb9=seqqueue[_0xcc44('0x14')](_0x37daa3);_0x25cbb9['id']=_0x38eb85;_0x25cbb9[_0xcc44('0x15')]=_0x37daa3;_0x25cbb9[_0xcc44('0x16')]=_0x479f66[_0xcc44('0x16')];writeLog(_0x38eb85,_0x52936a,util[_0xcc44('0x9')](_0xcc44('0x17'),_0x37daa3));_0x1fc936[_0xcc44('0x18')][_0x38eb85]['on'](_0xcc44('0x19'),function(){logger[_0xcc44('0x8')](_0xcc44('0x1a'),_0x38eb85);clearTimeout(_0x5d2a51);_0x5d2a51=undefined;_0x25cbb9['close']();if(_0x1fc936[_0xcc44('0x18')][_0x38eb85]){delete _0x1fc936[_0xcc44('0x18')][_0x38eb85];}_0x334be9['stop']();});_0x1fc936[_0xcc44('0x18')][_0x38eb85]['on'](_0xcc44('0x1b'),function(){if(_0x1fc936[_0xcc44('0x18')][_0x38eb85]){delete _0x1fc936[_0xcc44('0x18')][_0x38eb85];}});_0x5d2a51=setTimeout(function(){logger['info'](_0xcc44('0x1c'),_0x38eb85);clearTimeout(_0x5d2a51);_0x25cbb9['close']();_0x334be9['next']();},_0x37daa3);strategy[_0xcc44('0x1d')](_0x25cbb9,_0x52936a,_0x1fc936,_0x479f66);}else{logger[_0xcc44('0x1e')](_0xcc44('0x1f'),_0x38eb85,_0x344f01[_0xcc44('0xb')]);_0x334be9['stop']();}}}catch(_0x289876){console[_0xcc44('0x20')](_0x289876);logger[_0xcc44('0x1e')]('[%s][QUEUE]\x20%s',_0x38eb85,_0x289876[_0xcc44('0x21')]);_0x334be9[_0xcc44('0x10')]();}};}; \ No newline at end of file +var _0x6e6a=['name','timeout','createQueue','atimeout','channel','START:%s','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','stack','validate','lodash','util','../../../../config/logger','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','error','map','message','join','stop','find','agents'];(function(_0x4c85bd,_0x3e467e){var _0x3b6c3e=function(_0x52dcd3){while(--_0x52dcd3){_0x4c85bd['push'](_0x4c85bd['shift']());}};_0x3b6c3e(++_0x3e467e);}(_0x6e6a,0xd0));var _0xa6e6=function(_0x2a5bc4,_0x1ef98e){_0x2a5bc4=_0x2a5bc4-0x0;var _0x5cc876=_0x6e6a[_0x2a5bc4];return _0x5cc876;};'use strict';var schema=require(_0xa6e6('0x0'));var _=require(_0xa6e6('0x1'));var util=require(_0xa6e6('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xa6e6('0x3'))('routing');var strategy=require(_0xa6e6('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xa6e6('0x5')},'timeout':{'type':_0xa6e6('0x6'),'message':_0xa6e6('0x7')}});function writeLog(_0x249b9b,_0x226850,_0x77e585){return logger[_0xa6e6('0x8')](util[_0xa6e6('0x9')](_0xa6e6('0xa'),_0x249b9b,_0x226850['name'],_0x77e585));}function handleFindAgent(_0x43c1bb){return function(_0x16c524){return _0x16c524['name'][_0xa6e6('0xb')]()===_0x43c1bb[_0xa6e6('0xb')]();};}exports[_0xa6e6('0xc')]=function(_0x591574,_0x30eab5,_0x547611,_0x432118){return function(_0x1ccb4b){try{var _0x1f7e2b={'name':_0x30eab5[0x0],'timeout':_0x30eab5[0x1]};var _0x42d6c8=queue[_0xa6e6('0x0')](_0x1f7e2b,{'typecast':!![]});if(_0x42d6c8['length']){logger[_0xa6e6('0xd')]('[%s][AGENT]\x20%s',_0x591574,_[_0xa6e6('0xe')](_0x42d6c8,_0xa6e6('0xf'))[_0xa6e6('0x10')](',\x20'));_0x1ccb4b[_0xa6e6('0x11')]();}else{var _0x1fcc9a=_[_0xa6e6('0x12')](_0x547611[_0xa6e6('0x13')],handleFindAgent(_0x1f7e2b[_0xa6e6('0x14')]));if(_0x1fcc9a){var _0x2c837e=(_0x1f7e2b[_0xa6e6('0x15')]||0xa)*0x3e8;var _0x4f09d3,_0x5649ad;var _0x234d2a=seqqueue[_0xa6e6('0x16')](_0x2c837e);_0x234d2a['id']=_0x591574;_0x234d2a[_0xa6e6('0x17')]=_0x2c837e;_0x234d2a['channel']=_0x432118[_0xa6e6('0x18')];writeLog(_0x591574,_0x1fcc9a,util['format'](_0xa6e6('0x19'),_0x2c837e));_0x547611[_0xa6e6('0x1a')][_0x591574]['on'](_0xa6e6('0x1b'),function(){logger[_0xa6e6('0x8')](_0xa6e6('0x1c'),_0x591574);clearTimeout(_0x5649ad);_0x5649ad=undefined;_0x234d2a[_0xa6e6('0x1d')]();if(_0x547611[_0xa6e6('0x1a')][_0x591574]){delete _0x547611[_0xa6e6('0x1a')][_0x591574];}_0x1ccb4b[_0xa6e6('0x11')]();});_0x547611[_0xa6e6('0x1a')][_0x591574]['on'](_0xa6e6('0x1e'),function(){if(_0x547611[_0xa6e6('0x1a')][_0x591574]){delete _0x547611['rules'][_0x591574];}});_0x5649ad=setTimeout(function(){logger['info'](_0xa6e6('0x1f'),_0x591574);clearTimeout(_0x5649ad);_0x234d2a[_0xa6e6('0x1d')]();_0x1ccb4b[_0xa6e6('0x20')]();},_0x2c837e);strategy[_0xa6e6('0x21')](_0x234d2a,_0x1fcc9a,_0x547611,_0x432118);}else{logger[_0xa6e6('0xd')](_0xa6e6('0x22'),_0x591574,_0x1f7e2b[_0xa6e6('0x14')]);_0x1ccb4b[_0xa6e6('0x11')]();}}}catch(_0x56513c){console[_0xa6e6('0x23')](_0x56513c);logger[_0xa6e6('0xd')](_0xa6e6('0x24'),_0x591574,_0x56513c[_0xa6e6('0x25')]);_0x1ccb4b[_0xa6e6('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 0af9255..5010f29 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 _0x35dc=['create','then','catch','finally','info','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','error','providerName','amazonlex','providerResponse','stringify','dialogState','Failed','next','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','[%s][AMAZONLEX]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message'];(function(_0x248403,_0x2bdffc){var _0x54d365=function(_0x251605){while(--_0x251605){_0x248403['push'](_0x248403['shift']());}};_0x54d365(++_0x2bdffc);}(_0x35dc,0x186));var _0xc35d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x35dc[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc35d('0x0'));var moment=require(_0xc35d('0x1'));var AWS=require(_0xc35d('0x2'));var utils=require(_0xc35d('0x3'));var logger=require(_0xc35d('0x4'))(_0xc35d('0x5'));var rpc={'chatMessage':require(_0xc35d('0x6')),'openchannelMessage':require(_0xc35d('0x7')),'mailMessage':require(_0xc35d('0x8')),'smsMessage':require(_0xc35d('0x9')),'faxMessage':require(_0xc35d('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xc35d('0xb')]=function(_0x1d9712,_0x40c2f7){return function(_0x24baa1){try{if(!_[_0xc35d('0xc')](this['interaction'][_0xc35d('0xd')])){logger['info'](_0xc35d('0xe'),_0x1d9712,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x24baa1['next']();}var _0x2aacea={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc35d('0xf')](_0xc35d('0x10')),'direction':_0xc35d('0x11')};if(this[_0xc35d('0x12')]===_0xc35d('0x13')||this[_0xc35d('0x12')]===_0xc35d('0x14')){_0x2aacea[_0xc35d('0x15')]=this[_0xc35d('0x16')]['phone'];}var _0x34322a=this['channel'];if(_0x34322a===_0xc35d('0x17')){_0x2aacea[_0xc35d('0x18')]=this['account']['id'];}else{_0x2aacea[_['upperFirst'](_0x34322a)+_0xc35d('0x19')]=this[_0xc35d('0x1a')]['id'];}_0x2aacea[_[_0xc35d('0x1b')](_0x34322a)+_0xc35d('0x1c')]=this[_0xc35d('0x16')]['id'];if(this[_0xc35d('0x16')][_0xc35d('0x1d')]){var _0x2f60dc=_0x40c2f7[0x4];if(!_[_0xc35d('0x1e')](_0x2f60dc)){_0x2aacea[_0xc35d('0x1f')]=utils[_0xc35d('0x20')](_0x2f60dc,this);return rpc[_0x34322a+_0xc35d('0x21')][_0xc35d('0x22')](_0x2aacea)[_0xc35d('0x23')](function(_0x4d9f25){logger['info']('[%s][AMAZONLEX]\x20%s',_0x1d9712,_0x2aacea[_0xc35d('0x1f')]);})[_0xc35d('0x24')](function(_0x117334){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1d9712,JSON['stringify'](_0x117334));})[_0xc35d('0x25')](function(){logger[_0xc35d('0x26')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1d9712);_0x24baa1[_0xc35d('0x27')]();});}else{logger[_0xc35d('0x26')](_0xc35d('0x28'),_0x1d9712);_0x24baa1[_0xc35d('0x27')]();}}else{var _0x38095b=this;var _0x5493ee=new AWS[(_0xc35d('0x29'))]({'accessKeyId':_0x40c2f7[0x0],'secretAccessKey':_0x40c2f7[0x1],'region':_0x40c2f7[0x2]});var _0x3447fd={'botAlias':'$LATEST','botName':_0x40c2f7[0x3],'inputText':this[_0xc35d('0x2a')][_0xc35d('0x1f')],'userId':this['channel']+':'+this[_0xc35d('0x16')]['id'][_0xc35d('0x2b')]()};_0x5493ee[_0xc35d('0x2c')](_0x3447fd,function(_0x283e87,_0x24813a){if(_0x283e87){logger[_0xc35d('0x2d')](_0xc35d('0xe'),_0x1d9712,_0x283e87[_0xc35d('0x2a')]);_0x24baa1['next']();}else if(_0x24813a&&_0x24813a[_0xc35d('0x2a')]){_0x38095b[_0xc35d('0x1f')]['amazonlex']=_0x24813a;_0x2aacea[_0xc35d('0x1f')]=_0x24813a['message'];_0x2aacea[_0xc35d('0x2e')]=_0xc35d('0x2f');_0x2aacea[_0xc35d('0x30')]=JSON[_0xc35d('0x31')](_0x24813a);return rpc[_0x34322a+_0xc35d('0x21')][_0xc35d('0x22')](_0x2aacea)[_0xc35d('0x23')](function(_0x269ef4){logger[_0xc35d('0x26')]('[%s][AMAZONLEX]\x20%s',_0x1d9712,_0x2aacea[_0xc35d('0x1f')]);if(_0x24813a[_0xc35d('0x32')]==_0xc35d('0x33')){_0x24baa1[_0xc35d('0x34')]();}else{_0x24baa1[_0xc35d('0x27')]();}})['catch'](function(_0x1d8acf){logger[_0xc35d('0x2d')]('[%s][AMAZONLEX]\x20%s',_0x1d9712,JSON[_0xc35d('0x31')](_0x1d8acf));_0x24baa1['next']();});}else{_0x24baa1[_0xc35d('0x34')]();}});}}catch(_0x350759){logger['error'](_0xc35d('0xe'),_0x1d9712,JSON[_0xc35d('0x31')](_0x350759));_0x24baa1['stop']();}};}; \ No newline at end of file +var _0x0f75=['chat','ChatWebsiteId','account','upperFirst','isEmpty','body','Message','create','catch','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','error','next','amazonlex','providerName','providerResponse','then','Failed','moment','aws-sdk','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction'];(function(_0x22b442,_0x183c23){var _0x2ff39f=function(_0xb1a6dd){while(--_0xb1a6dd){_0x22b442['push'](_0x22b442['shift']());}};_0x2ff39f(++_0x183c23);}(_0x0f75,0x177));var _0x50f7=function(_0x154cdf,_0x15feab){_0x154cdf=_0x154cdf-0x0;var _0x1a0ca6=_0x0f75[_0x154cdf];return _0x1a0ca6;};'use strict';var _=require('lodash');var moment=require(_0x50f7('0x0'));var AWS=require(_0x50f7('0x1'));var utils=require('./utils');var logger=require(_0x50f7('0x2'))(_0x50f7('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x50f7('0x4')),'smsMessage':require(_0x50f7('0x5')),'faxMessage':require(_0x50f7('0x6')),'whatsappMessage':require(_0x50f7('0x7'))};exports[_0x50f7('0x8')]=function(_0x28c473,_0x3cc3d8){return function(_0x164f46){try{if(!_[_0x50f7('0x9')](this['interaction']['UserId'])){logger[_0x50f7('0xa')](_0x50f7('0xb'),_0x28c473,_0x50f7('0xc'));return _0x164f46['next']();}var _0x46e265={'ContactId':this['contact']['id'],'sentAt':moment()[_0x50f7('0xd')](_0x50f7('0xe')),'direction':_0x50f7('0xf')};if(this[_0x50f7('0x10')]===_0x50f7('0x11')||this[_0x50f7('0x10')]===_0x50f7('0x12')){_0x46e265[_0x50f7('0x13')]=this[_0x50f7('0x14')][_0x50f7('0x13')];}var _0x17a942=this[_0x50f7('0x10')];if(_0x17a942===_0x50f7('0x15')){_0x46e265[_0x50f7('0x16')]=this[_0x50f7('0x17')]['id'];}else{_0x46e265[_[_0x50f7('0x18')](_0x17a942)+'AccountId']=this['account']['id'];}_0x46e265[_[_0x50f7('0x18')](_0x17a942)+'InteractionId']=this[_0x50f7('0x14')]['id'];if(this[_0x50f7('0x14')]['created']){var _0x9db571=_0x3cc3d8[0x4];if(!_[_0x50f7('0x19')](_0x9db571)){_0x46e265[_0x50f7('0x1a')]=utils['getMustacheRender'](_0x9db571,this);return rpc[_0x17a942+_0x50f7('0x1b')][_0x50f7('0x1c')](_0x46e265)['then'](function(_0xdec43){logger[_0x50f7('0xa')](_0x50f7('0xb'),_0x28c473,_0x46e265[_0x50f7('0x1a')]);})[_0x50f7('0x1d')](function(_0x1700fc){logger['error'](_0x50f7('0xb'),_0x28c473,JSON[_0x50f7('0x1e')](_0x1700fc));})[_0x50f7('0x1f')](function(){logger[_0x50f7('0xa')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x28c473);_0x164f46[_0x50f7('0x20')]();});}else{logger[_0x50f7('0xa')](_0x50f7('0x21'),_0x28c473);_0x164f46['stop']();}}else{var _0x366db1=this;var _0xf0beee=new AWS[(_0x50f7('0x22'))]({'accessKeyId':_0x3cc3d8[0x0],'secretAccessKey':_0x3cc3d8[0x1],'region':_0x3cc3d8[0x2]});var _0x4b1da1={'botAlias':_0x50f7('0x23'),'botName':_0x3cc3d8[0x3],'inputText':this[_0x50f7('0x24')]['body'],'userId':this[_0x50f7('0x10')]+':'+this[_0x50f7('0x14')]['id']['toString']()};_0xf0beee['postText'](_0x4b1da1,function(_0x5501cc,_0x36aa7d){if(_0x5501cc){logger[_0x50f7('0x25')]('[%s][AMAZONLEX]\x20%s',_0x28c473,_0x5501cc[_0x50f7('0x24')]);_0x164f46[_0x50f7('0x26')]();}else if(_0x36aa7d&&_0x36aa7d[_0x50f7('0x24')]){_0x366db1['body'][_0x50f7('0x27')]=_0x36aa7d;_0x46e265[_0x50f7('0x1a')]=_0x36aa7d[_0x50f7('0x24')];_0x46e265[_0x50f7('0x28')]='amazonlex';_0x46e265[_0x50f7('0x29')]=JSON[_0x50f7('0x1e')](_0x36aa7d);return rpc[_0x17a942+_0x50f7('0x1b')]['create'](_0x46e265)[_0x50f7('0x2a')](function(_0x225130){logger[_0x50f7('0xa')](_0x50f7('0xb'),_0x28c473,_0x46e265[_0x50f7('0x1a')]);if(_0x36aa7d['dialogState']==_0x50f7('0x2b')){_0x164f46['next']();}else{_0x164f46[_0x50f7('0x20')]();}})[_0x50f7('0x1d')](function(_0x55ce4b){logger['error'](_0x50f7('0xb'),_0x28c473,JSON[_0x50f7('0x1e')](_0x55ce4b));_0x164f46[_0x50f7('0x26')]();});}else{_0x164f46[_0x50f7('0x26')]();}});}}catch(_0x3bb37c){logger['error'](_0x50f7('0xb'),_0x28c473,JSON[_0x50f7('0x1e')](_0x3bb37c));_0x164f46[_0x50f7('0x20')]();}};}; \ 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 adab0dd..a3dfdd7 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 _0x81f8=['lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','created','interaction','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','contact','format','channel','mail','body','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','Message','service','Smtp','host','port','secure','authentication','auth','user','pass','inReplyTo','messageId','html','','replace','';_0x2eef57[_0x881f('0x34')]={'Auto-Submitted':_0x881f('0x35'),'X-Auto-Response-Suppress':_0x881f('0x36'),'Precedence':'auto_reply'};return mailRpc[_0x881f('0x37')](_0x51bbb2,_0x2eef57)[_0x881f('0x38')](function(_0x5c334d){logger[_0x881f('0xd')](_0x881f('0x39'),_0x791d81);_0x2eef57[_0x881f('0x2e')]=_0x5c334d[_0x881f('0x17')][_0x881f('0x2e')];return rpc[_0x56d967+_0x881f('0x23')][_0x881f('0x3a')](_0x2eef57);})[_0x881f('0x38')](function(_0x3d169d){logger[_0x881f('0xd')](_0x881f('0xe'),_0x791d81,JSON['stringify'](_0x3d169d));})[_0x881f('0x3b')](function(_0x4381e9){logger['error'](_0x881f('0x3c'),_0x791d81,JSON[_0x881f('0x3d')](_0x4381e9));})[_0x881f('0x3e')](function(){_0x2d93bc[_0x881f('0x10')]();});}else{return rpc[this[_0x881f('0x13')]+'Message']['create'](_0x2eef57)[_0x881f('0x38')](function(_0x2b14dd){logger['info'](_0x881f('0xe'),_0x791d81,_0x2eef57['body']);})[_0x881f('0x3b')](function(_0x18e9d2){logger[_0x881f('0x3f')](_0x881f('0xe'),_0x791d81,JSON[_0x881f('0x3d')](_0x18e9d2));})[_0x881f('0x3e')](function(){_0x2d93bc['next']();});}}}catch(_0x27f87d){logger[_0x881f('0x3f')](_0x881f('0xe'),_0x791d81,JSON['stringify'](_0x27f87d));_0x2d93bc[_0x881f('0x40')]();}};}; \ No newline at end of file +var _0xb016=['channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','Message','mail','Smtp','service','host','port','secure','authentication','auth','user','pass','html','','replace','','headers','auto-replied','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','then','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','catch','stop','lodash','moment','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','contact','format','out','body','getMustacheRender','message','phone','read','subject','startsWith','Re:\x20'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb016,0x159));var _0x6b01=function(_0x5db691,_0x18efcc){_0x5db691=_0x5db691-0x0;var _0x151584=_0xb016[_0x5db691];return _0x151584;};'use strict';var _=require(_0x6b01('0x0'));var moment=require(_0x6b01('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x6b01('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6b01('0x3')),'mailMessage':require(_0x6b01('0x4')),'smsMessage':require(_0x6b01('0x5')),'faxMessage':require(_0x6b01('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};var mailRpc=require(_0x6b01('0x7'));exports[_0x6b01('0x8')]=function(_0x192b2d,_0x5759a1){return function(_0x5c5bfb){try{if(_0x5759a1[0x0]==='1'&&(_[_0x6b01('0x9')](this[_0x6b01('0xa')]['created'])||!this['interaction'][_0x6b01('0xb')])){logger[_0x6b01('0xc')](_0x6b01('0xd'),_0x192b2d,_0x6b01('0xe'));return _0x5c5bfb[_0x6b01('0xf')]();}var _0x5bed15=this['channel'];var _0x4627ef={'ContactId':this[_0x6b01('0x10')]['id'],'sentAt':moment()[_0x6b01('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6b01('0x12')};if(this['channel']==='mail'){_0x4627ef[_0x6b01('0x13')]=utils['getMustacheRender'](_0x5759a1[0x2],this);}else{_0x4627ef[_0x6b01('0x13')]=utils[_0x6b01('0x14')](_0x5759a1[0x1],this);}if(this['message']){_0x4627ef['to']=this[_0x6b01('0x15')]['from']||'';if(this['channel']==='mail'&&_0x5759a1[0x1]==='1'){_0x4627ef['cc']=this[_0x6b01('0x15')]['cc']||'';}_0x4627ef['from']=this['message']['to']||'';_0x4627ef[_0x6b01('0x16')]=this[_0x6b01('0x15')][_0x6b01('0x16')]||'';_0x4627ef[_0x6b01('0x17')]=!![];if(this[_0x6b01('0x15')][_0x6b01('0x18')]){_0x4627ef[_0x6b01('0x18')]='';_0x4627ef[_0x6b01('0x18')]+=_[_0x6b01('0x19')](this[_0x6b01('0x15')][_0x6b01('0x18')],'Re:')?'':_0x6b01('0x1a');_0x4627ef[_0x6b01('0x18')]+=this[_0x6b01('0x15')][_0x6b01('0x18')];}}if(this[_0x6b01('0x1b')]===_0x6b01('0x1c')){_0x4627ef[_0x6b01('0x1d')]=this[_0x6b01('0x1e')]['id'];}else{_0x4627ef[_['upperFirst'](this[_0x6b01('0x1b')])+_0x6b01('0x1f')]=this[_0x6b01('0x1e')]['id'];}_0x4627ef[_[_0x6b01('0x20')](this[_0x6b01('0x1b')])+_0x6b01('0x21')]=this[_0x6b01('0xa')]['id'];if(rpc[this['channel']+_0x6b01('0x22')]){if(this[_0x6b01('0x1b')]===_0x6b01('0x23')){var _0x51243c={'tls':{'rejectUnauthorized':![]}};if(this[_0x6b01('0x1e')][_0x6b01('0x24')][_0x6b01('0x25')]){_0x51243c[_0x6b01('0x25')]=this[_0x6b01('0x1e')][_0x6b01('0x24')][_0x6b01('0x25')];}else{_0x51243c[_0x6b01('0x26')]=this[_0x6b01('0x1e')][_0x6b01('0x24')][_0x6b01('0x26')];_0x51243c[_0x6b01('0x27')]=this[_0x6b01('0x1e')]['Smtp'][_0x6b01('0x27')];_0x51243c[_0x6b01('0x28')]=this[_0x6b01('0x1e')][_0x6b01('0x24')][_0x6b01('0x28')];}if(this['account']['Smtp'][_0x6b01('0x29')]){_0x51243c[_0x6b01('0x2a')]={'user':this[_0x6b01('0x1e')][_0x6b01('0x24')][_0x6b01('0x2b')],'pass':this[_0x6b01('0x1e')]['Smtp'][_0x6b01('0x2c')]};}_0x4627ef['inReplyTo']=this[_0x6b01('0x15')]['messageId'];_0x4627ef[_0x6b01('0x2d')]=_0x6b01('0x2e')+_[_0x6b01('0x2f')](_0x4627ef[_0x6b01('0x13')],_0x6b01('0x30'),']+(>|$)/g,''),'priorityTrue':_0x9753e7[0x1],'priorityFalse':_0x9753e7[0x2]};var _0x61ffb2=gotoif[_0xc4b3('0xb')](_0x589369,{'typecast':!![]});if(_0x61ffb2[_0xc4b3('0xc')]){logger[_0xc4b3('0xd')]('[%s][GOTOIF]\x20%s',_0x553c3e,_['map'](_0x61ffb2,_0xc4b3('0xe'))[_0xc4b3('0xf')](',\x20'));_0xab26c0[_0xc4b3('0x10')]();}else{try{var _0x22e7ba=eval('('+_0x589369['condition']+')');var _0x95f48d=_0x22e7ba?_0x589369['priorityTrue']:_0x589369[_0xc4b3('0x11')];logger['info'](_0xc4b3('0x12'),_0x553c3e,_0x589369[_0xc4b3('0x13')],_0x22e7ba,_0x95f48d||_0xc4b3('0x14'));if(_0x95f48d){var _0x7521fd=_[_0xc4b3('0x15')](_0xab26c0['rules'](),{'p':_0x95f48d});if(_0x7521fd>=0x0){logger[_0xc4b3('0x16')](_0xc4b3('0x17'),_0x553c3e,_0x95f48d||'next',_0x7521fd);_0xab26c0[_0xc4b3('0x14')](_0x7521fd);}else{logger['info'](_0xc4b3('0x18'),_0x553c3e,_0x95f48d||_0xc4b3('0x14'));_0xab26c0[_0xc4b3('0x10')]();}}else{_0xab26c0[_0xc4b3('0x14')]();}}catch(_0xcf99bf){logger[_0xc4b3('0xd')](_0xc4b3('0x19'),_0x553c3e,_0xcf99bf[_0xc4b3('0xe')]);_0xab26c0['stop']();}}}catch(_0x3d2142){logger[_0xc4b3('0xd')](_0xc4b3('0x1a'),_0x553c3e,JSON[_0xc4b3('0x1b')](_0x3d2142));_0xab26c0[_0xc4b3('0x10')]();}};}; \ No newline at end of file +var _0xd14e=['length','error','map','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','message','[%s][GOTOIF]\x20%s','validate','lodash','html-to-text','../../../../config/logger','string','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xd14e,0x1b8));var _0xed14=function(_0x495f7d,_0x44340d){_0x495f7d=_0x495f7d-0x0;var _0x547a84=_0xd14e[_0x495f7d];return _0x547a84;};'use strict';var schema=require(_0xed14('0x0'));var _=require(_0xed14('0x1'));var htmlToText=require(_0xed14('0x2'));var utils=require('./utils');var logger=require(_0xed14('0x3'))('routing');var gotoif=schema({'condition':{'type':_0xed14('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xed14('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xed14('0x5'),'message':_0xed14('0x6')}});exports[_0xed14('0x7')]=function(_0x3d46c8,_0x199ad4){return function(_0x256799){try{var _0x140c7d={'condition':htmlToText['fromString'](utils[_0xed14('0x8')](_0x199ad4[0x0],this),{'wordwrap':![]})[_0xed14('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x199ad4[0x1],'priorityFalse':_0x199ad4[0x2]};var _0x2a1c8c=gotoif[_0xed14('0x0')](_0x140c7d,{'typecast':!![]});if(_0x2a1c8c[_0xed14('0xa')]){logger[_0xed14('0xb')]('[%s][GOTOIF]\x20%s',_0x3d46c8,_[_0xed14('0xc')](_0x2a1c8c,'message')['join'](',\x20'));_0x256799[_0xed14('0xd')]();}else{try{var _0x1bd6b2=eval('('+_0x140c7d[_0xed14('0xe')]+')');var _0x34a79e=_0x1bd6b2?_0x140c7d[_0xed14('0xf')]:_0x140c7d[_0xed14('0x10')];logger['info'](_0xed14('0x11'),_0x3d46c8,_0x140c7d[_0xed14('0xe')],_0x1bd6b2,_0x34a79e||_0xed14('0x12'));if(_0x34a79e){var _0x4e8010=_[_0xed14('0x13')](_0x256799[_0xed14('0x14')](),{'p':_0x34a79e});if(_0x4e8010>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3d46c8,_0x34a79e||'next',_0x4e8010);_0x256799[_0xed14('0x12')](_0x4e8010);}else{logger[_0xed14('0x15')](_0xed14('0x16'),_0x3d46c8,_0x34a79e||_0xed14('0x12'));_0x256799[_0xed14('0xd')]();}}else{_0x256799[_0xed14('0x12')]();}}catch(_0x319aac){logger[_0xed14('0xb')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x3d46c8,_0x319aac[_0xed14('0x17')]);_0x256799[_0xed14('0xd')]();}}}catch(_0x2eb756){logger[_0xed14('0xb')](_0xed14('0x18'),_0x3d46c8,JSON['stringify'](_0x2eb756));_0x256799[_0xed14('0xd')]();}};}; \ 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 5e2a9a8..fb427a2 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 _0x03be=['stop','info','priority','findIndex','rules','next','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','join'];(function(_0x26b199,_0x1f60ac){var _0x1ff319=function(_0x1037d6){while(--_0x1037d6){_0x26b199['push'](_0x26b199['shift']());}};_0x1ff319(++_0x1f60ac);}(_0x03be,0xeb));var _0xe03b=function(_0x3d4567,_0x3170fb){_0x3d4567=_0x3d4567-0x0;var _0x372507=_0x03be[_0x3d4567];return _0x372507;};'use strict';var schema=require(_0xe03b('0x0'));var _=require(_0xe03b('0x1'));var logger=require(_0xe03b('0x2'))(_0xe03b('0x3'));var gotop=schema({'priority':{'type':_0xe03b('0x4'),'required':!![],'message':_0xe03b('0x5')}});exports[_0xe03b('0x6')]=function(_0x214ce9,_0xe1ea63){return function(_0x11813a){try{var _0x21249c={'priority':_0xe1ea63[0x0]};var _0x31917b=gotop[_0xe03b('0x0')](_0x21249c,{'typecast':!![]});if(_0x31917b[_0xe03b('0x7')]){logger[_0xe03b('0x8')](_0xe03b('0x9'),_0x214ce9,_[_0xe03b('0xa')](_0x31917b,'message')[_0xe03b('0xb')](',\x20'));_0x11813a[_0xe03b('0xc')]();}else{logger[_0xe03b('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x214ce9,_0x21249c[_0xe03b('0xe')]);if(_0x21249c[_0xe03b('0xe')]){var _0xaf875a=_[_0xe03b('0xf')](_0x11813a[_0xe03b('0x10')](),{'p':_0x21249c[_0xe03b('0xe')]});if(_0xaf875a>=0x0){logger[_0xe03b('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x214ce9,_0x21249c[_0xe03b('0xe')]||_0xe03b('0x11'),_0xaf875a);_0x11813a[_0xe03b('0x11')](_0xaf875a);}else{logger[_0xe03b('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x214ce9,_0x21249c[_0xe03b('0xe')]||_0xe03b('0x11'));_0x11813a['stop']();}}else{_0x11813a[_0xe03b('0x11')]();}}}catch(_0x4d9cc4){logger[_0xe03b('0x8')]('[%s][GOTOP]\x20%s',_0x214ce9,JSON[_0xe03b('0x12')](_0x4d9cc4));_0x11813a[_0xe03b('0xc')]();}};}; \ No newline at end of file +var _0xfb94=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','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','number'];(function(_0x4227c6,_0x28b746){var _0xe7096f=function(_0x17d582){while(--_0x17d582){_0x4227c6['push'](_0x4227c6['shift']());}};_0xe7096f(++_0x28b746);}(_0xfb94,0x160));var _0x4fb9=function(_0xce26c9,_0x56656b){_0xce26c9=_0xce26c9-0x0;var _0x205d34=_0xfb94[_0xce26c9];return _0x205d34;};'use strict';var schema=require(_0x4fb9('0x0'));var _=require(_0x4fb9('0x1'));var logger=require(_0x4fb9('0x2'))(_0x4fb9('0x3'));var gotop=schema({'priority':{'type':_0x4fb9('0x4'),'required':!![],'message':_0x4fb9('0x5')}});exports[_0x4fb9('0x6')]=function(_0x16f1a3,_0x4cedd7){return function(_0xe95da4){try{var _0x5c322f={'priority':_0x4cedd7[0x0]};var _0x5c3b67=gotop[_0x4fb9('0x0')](_0x5c322f,{'typecast':!![]});if(_0x5c3b67['length']){logger[_0x4fb9('0x7')](_0x4fb9('0x8'),_0x16f1a3,_[_0x4fb9('0x9')](_0x5c3b67,'message')[_0x4fb9('0xa')](',\x20'));_0xe95da4[_0x4fb9('0xb')]();}else{logger[_0x4fb9('0xc')](_0x4fb9('0xd'),_0x16f1a3,_0x5c322f['priority']);if(_0x5c322f[_0x4fb9('0xe')]){var _0x463a26=_[_0x4fb9('0xf')](_0xe95da4[_0x4fb9('0x10')](),{'p':_0x5c322f[_0x4fb9('0xe')]});if(_0x463a26>=0x0){logger[_0x4fb9('0xc')](_0x4fb9('0x11'),_0x16f1a3,_0x5c322f[_0x4fb9('0xe')]||_0x4fb9('0x12'),_0x463a26);_0xe95da4[_0x4fb9('0x12')](_0x463a26);}else{logger[_0x4fb9('0xc')](_0x4fb9('0x13'),_0x16f1a3,_0x5c322f['priority']||'next');_0xe95da4[_0x4fb9('0xb')]();}}else{_0xe95da4['next']();}}}catch(_0x5aae30){logger[_0x4fb9('0x7')](_0x4fb9('0x8'),_0x16f1a3,JSON[_0x4fb9('0x14')](_0x5aae30));_0xe95da4[_0x4fb9('0xb')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index bc4fb2d..41cd79e 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 _0x27b2=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','interaction','Message','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','lodash'];(function(_0x5b3b27,_0x3874de){var _0x1c94e8=function(_0x100180){while(--_0x100180){_0x5b3b27['push'](_0x5b3b27['shift']());}};_0x1c94e8(++_0x3874de);}(_0x27b2,0x18f));var _0x227b=function(_0x51fc85,_0x783137){_0x51fc85=_0x51fc85-0x0;var _0x13e93d=_0x27b2[_0x51fc85];return _0x13e93d;};'use strict';var _=require(_0x227b('0x0'));var utils=require(_0x227b('0x1'));var logger=require(_0x227b('0x2'))(_0x227b('0x3'));var rpc={'chatMessage':require(_0x227b('0x4')),'openchannelMessage':require(_0x227b('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x227b('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x227b('0x7')]=function(_0x10b70e,_0x18d6eb){return function(_0x274c75){try{var _0x6ba0ef={'body':utils[_0x227b('0x8')](_0x18d6eb[0x0],this),'ContactId':this[_0x227b('0x9')]['id']};if(this[_0x227b('0xa')]===_0x227b('0xb')){_0x6ba0ef[_0x227b('0xc')]=this[_0x227b('0xd')]['id'];}else{_0x6ba0ef[_['upperFirst'](this['channel'])+_0x227b('0xe')]=this[_0x227b('0xd')]['id'];}_0x6ba0ef[_[_0x227b('0xf')](this['channel'])+'InteractionId']=this[_0x227b('0x10')]['id'];if(rpc[this[_0x227b('0xa')]+'Message']){return rpc[this[_0x227b('0xa')]+_0x227b('0x11')]['create'](_0x6ba0ef)['then'](function(_0x252f04){logger[_0x227b('0x12')](_0x227b('0x13'),_0x10b70e,_0x6ba0ef[_0x227b('0x14')]);_0x274c75[_0x227b('0x15')]();})[_0x227b('0x16')](function(_0x17c83a){logger['error'](_0x227b('0x13'),_0x10b70e,JSON[_0x227b('0x17')](_0x17c83a));_0x274c75[_0x227b('0x18')]();});}}catch(_0x5aa07c){logger['error']('[%s][MESSAGE]\x20%s',_0x10b70e,JSON[_0x227b('0x17')](_0x5aa07c));_0x274c75['stop']();}};}; \ No newline at end of file +var _0x61f1=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','./utils','routing'];(function(_0x1b41f1,_0x3a328b){var _0x4992a1=function(_0x5e248c){while(--_0x5e248c){_0x1b41f1['push'](_0x1b41f1['shift']());}};_0x4992a1(++_0x3a328b);}(_0x61f1,0xde));var _0x161f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x61f1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var utils=require(_0x161f('0x0'));var logger=require('../../../../config/logger')(_0x161f('0x1'));var rpc={'chatMessage':require(_0x161f('0x2')),'openchannelMessage':require(_0x161f('0x3')),'mailMessage':require(_0x161f('0x4')),'smsMessage':require(_0x161f('0x5')),'faxMessage':require(_0x161f('0x6')),'whatsappMessage':require(_0x161f('0x7'))};exports[_0x161f('0x8')]=function(_0x14ba2b,_0x10b7c7){return function(_0xd9ef96){try{var _0x596bd9={'body':utils[_0x161f('0x9')](_0x10b7c7[0x0],this),'ContactId':this[_0x161f('0xa')]['id']};if(this[_0x161f('0xb')]===_0x161f('0xc')){_0x596bd9[_0x161f('0xd')]=this[_0x161f('0xe')]['id'];}else{_0x596bd9[_[_0x161f('0xf')](this[_0x161f('0xb')])+_0x161f('0x10')]=this[_0x161f('0xe')]['id'];}_0x596bd9[_[_0x161f('0xf')](this[_0x161f('0xb')])+_0x161f('0x11')]=this[_0x161f('0x12')]['id'];if(rpc[this[_0x161f('0xb')]+'Message']){return rpc[this[_0x161f('0xb')]+_0x161f('0x13')][_0x161f('0x14')](_0x596bd9)[_0x161f('0x15')](function(_0x483a57){logger['info'](_0x161f('0x16'),_0x14ba2b,_0x596bd9[_0x161f('0x17')]);_0xd9ef96[_0x161f('0x18')]();})[_0x161f('0x19')](function(_0x110513){logger[_0x161f('0x1a')]('[%s][MESSAGE]\x20%s',_0x14ba2b,JSON['stringify'](_0x110513));_0xd9ef96[_0x161f('0x1b')]();});}}catch(_0x5f08d2){logger[_0x161f('0x1a')](_0x161f('0x16'),_0x14ba2b,JSON['stringify'](_0x5f08d2));_0xd9ef96[_0x161f('0x1b')]();}};}; \ 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 c6793d0..f9bdc09 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 _0x4cdd=['stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','stringify'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4cdd,0x91));var _0xd4cd=function(_0x3cf785,_0x37beb6){_0x3cf785=_0x3cf785-0x0;var _0x481d75=_0x4cdd[_0x3cf785];return _0x481d75;};'use strict';var utils=require(_0xd4cd('0x0'));var logger=require(_0xd4cd('0x1'))(_0xd4cd('0x2'));exports[_0xd4cd('0x3')]=function(_0xca8672,_0x78cfa0){return function(_0x2d0a02){try{logger[_0xd4cd('0x4')](_0xd4cd('0x5'),_0xca8672,utils[_0xd4cd('0x6')](_0x78cfa0[0x0],this));_0x2d0a02['next']();}catch(_0x269f82){logger['error'](_0xd4cd('0x5'),_0xca8672,JSON[_0xd4cd('0x7')](_0x269f82));_0x2d0a02[_0xd4cd('0x8')]();}};}; \ No newline at end of file +var _0x4bd5=['stop','./utils','../../../../config/logger','routing','consequence','info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify'];(function(_0xaef996,_0xff6c7b){var _0x5f1425=function(_0x2e0713){while(--_0x2e0713){_0xaef996['push'](_0xaef996['shift']());}};_0x5f1425(++_0xff6c7b);}(_0x4bd5,0x1b9));var _0x54bd=function(_0x529296,_0x1a6a23){_0x529296=_0x529296-0x0;var _0x1796bf=_0x4bd5[_0x529296];return _0x1796bf;};'use strict';var utils=require(_0x54bd('0x0'));var logger=require(_0x54bd('0x1'))(_0x54bd('0x2'));exports[_0x54bd('0x3')]=function(_0x11bfa0,_0x1b4517){return function(_0x37e4e9){try{logger[_0x54bd('0x4')]('[%s][NOOP]\x20%s',_0x11bfa0,utils[_0x54bd('0x5')](_0x1b4517[0x0],this));_0x37e4e9[_0x54bd('0x6')]();}catch(_0x227ac7){logger[_0x54bd('0x7')](_0x54bd('0x8'),_0x11bfa0,JSON[_0x54bd('0x9')](_0x227ac7));_0x37e4e9[_0x54bd('0xa')]();}};}; \ 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 83e2905..4af9ecf 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 _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x1a0ef3,_0x535bbf){var _0x2b86da=function(_0x5d30f9){while(--_0x5d30f9){_0x1a0ef3['push'](_0x1a0ef3['shift']());}};_0x2b86da(++_0x535bbf);}(_0x3e74,0x175));var _0x43e7=function(_0x10236c,_0x1b8867){_0x10236c=_0x10236c-0x0;var _0x1a09ce=_0x3e74[_0x10236c];return _0x1a09ce;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ No newline at end of file +var _0x7217=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId'];(function(_0x32c305,_0x5aed24){var _0x21b318=function(_0x4ccd44){while(--_0x4ccd44){_0x32c305['push'](_0x32c305['shift']());}};_0x21b318(++_0x5aed24);}(_0x7217,0x19e));var _0x7721=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x7217[_0xa1e3e3];return _0xc980e9;};'use strict';var schema=require(_0x7721('0x0'));var _=require('lodash');var util=require(_0x7721('0x1'));var seqqueue=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x7721('0x6'));config[_0x7721('0x7')]=_[_0x7721('0x8')](config[_0x7721('0x7')],{'host':_0x7721('0x9'),'port':0x18eb});var io=require(_0x7721('0xa'))(new Redis(config[_0x7721('0x7')]));var attributes=['id',_0x7721('0xb'),_0x7721('0xc'),_0x7721('0xd'),_0x7721('0xe'),_0x7721('0xf')];function emit(_0xfa8835,_0x138740,_0x2c3986){io['to'](_0xfa8835)['emit'](_0x138740,_0x2c3986);}function emitChannelQueueInteraction(_0x461d1a,_0x29bc8f,_0x8729a6,_0xf78099,_0xa8977c,_0x409b37,_0x1e7fd7,_0x27b36b){var _0x55b4ca=_[_0x7721('0x10')](_0x8729a6);_0x55b4ca[_0x7721('0xb')]=_0x27b36b;_0x55b4ca['queue']=_0x29bc8f;_0x55b4ca[_0x7721('0xc')]=_0xf78099;_0x55b4ca['id']=_0xa8977c;if(_0x409b37){_0x1e7fd7[util[_0x7721('0x11')](_0x7721('0x12'),_0x461d1a)][_0xa8977c]=_[_0x7721('0x13')](_0x55b4ca,attributes);}else{delete _0x1e7fd7[util['format'](_0x7721('0x12'),_0x461d1a)][_0xa8977c];}emit(util[_0x7721('0x11')]('%s:queue:%s',_0x461d1a,_0x29bc8f),util['format']('%s_queue_waiting_interaction:%s',_0x461d1a,_0x409b37?_0x7721('0x14'):_0x7721('0x15')),_[_0x7721('0x13')](_0x55b4ca,attributes));}var rpc={'openchannelQueueReport':require(_0x7721('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x7721('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7721('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7721('0x19'),'required':!![],'message':_0x7721('0x1a')},'timeout':{'type':_0x7721('0x1b'),'message':_0x7721('0x1c')}});function startRouting(_0x2286e5,_0x40af90,_0x402820,_0x413263){if(_0x2286e5&&_0x40af90&&_0x402820){_0x40af90[_0x7721('0x1d')]+=0x1;var _0xaeccc4={'uniqueid':_0x2286e5,'from':_0x402820['body']?_0x402820[_0x7721('0x1e')][_0x7721('0xe')]:'','joinAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'ContactId':_0x402820['contact']?_0x402820[_0x7721('0x20')]['id']:null,'ListId':_0x402820['list']?_0x402820[_0x7721('0x21')]['id']:null};_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x24')]=_0x40af90['id']||null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x25')]=_0x402820['interaction']?_0x402820[_0x7721('0x26')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x27')]=_0x402820[_0x7721('0x28')]?_0x402820[_0x7721('0x28')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+(_0x402820[_0x7721('0x23')]!=='chat'?_0x7721('0x29'):'WebsiteId')]=_0x402820['account']?_0x402820[_0x7721('0xc')]['id']:null;logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x2b'),_0x2286e5,_0x40af90[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x402820[_0x7721('0x23')],_0x40af90[_0x7721('0x2c')],_0xaeccc4,_0x402820[_0x7721('0xc')]['name'],_0x402820[_0x7721('0x28')]['id'],!![],_0x413263,_0x40af90['id']);if(rpc[_0x402820[_0x7721('0x23')]+'QueueReport']){return rpc[_0x402820['channel']+_0x7721('0x2d')][_0x7721('0x2e')](_0xaeccc4)['catch'](function(_0x46f772){logger[_0x7721('0x2f')](_0x7721('0x30'));});}}}function stopRouting(_0x58d54b,_0x3d9a32,_0x1ff31b,_0x1492d4){if(_0x58d54b&&_0x3d9a32){_0x3d9a32[_0x7721('0x1d')]-=0x1;var _0xc0f3c4={'leaveAt':moment()['format'](_0x7721('0x1f')),'acceptAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'reason':'accepted'};logger[_0x7721('0x2a')](util[_0x7721('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x58d54b,_0x3d9a32[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x1ff31b['channel'],_0x3d9a32[_0x7721('0x2c')],_0x1ff31b[_0x7721('0x1e')],_0x1ff31b[_0x7721('0xc')][_0x7721('0x2c')],_0x1ff31b[_0x7721('0x28')]['id'],![],_0x1492d4,_0x3d9a32['id']);if(rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')]){return rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')][_0x7721('0x31')](_0x58d54b,_0xc0f3c4)[_0x7721('0x32')](function(_0x5c806d){logger[_0x7721('0x2f')]('update\x20queue\x20report');});}}}function endRouting(_0x212384,_0x35614c,_0x7942f7,_0x1d03de){if(_0x212384&&_0x35614c){_0x35614c[_0x7721('0x1d')]-=0x1;var _0x378ba5={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7721('0x33')};logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x34'),_0x212384,_0x35614c['name']));emitChannelQueueInteraction(_0x7942f7[_0x7721('0x23')],_0x35614c['name'],_0x7942f7[_0x7721('0x1e')],_0x7942f7[_0x7721('0xc')]['name'],_0x7942f7[_0x7721('0x28')]['id'],![],_0x1d03de);if(rpc[_0x7942f7[_0x7721('0x23')]+'QueueReport']){return rpc[_0x7942f7['channel']+_0x7721('0x2d')][_0x7721('0x31')](_0x212384,_0x378ba5)[_0x7721('0x32')](function(_0x15e34d){logger['error'](_0x7721('0x35'));});}}}function handleFindQueue(_0x120de9){return function(_0x40ce8c){return _0x40ce8c[_0x7721('0x2c')][_0x7721('0x36')]()===_0x120de9['toLowerCase']();};}exports[_0x7721('0x37')]=function(_0x4a2c28,_0xaa3216,_0x4a5b59,_0x2333b8){return function(_0x15fa2c){try{var _0x231dad={'name':_0xaa3216[0x0],'timeout':_0xaa3216[0x1]};var _0x49e0c5=queue[_0x7721('0x0')](_0x231dad,{'typecast':!![]});if(_0x49e0c5[_0x7721('0x38')]){logger[_0x7721('0x2f')]('[%s][QUEUE]\x20%s',_0x4a2c28,_[_0x7721('0x39')](_0x49e0c5,_0x7721('0x28'))[_0x7721('0x3a')](',\x20'));_0x15fa2c[_0x7721('0x3b')]();}else{var _0x135dbc=_[_0x7721('0x3c')](_0x4a5b59[_0x2333b8[_0x7721('0x23')]+'Queues'],handleFindQueue(_0x231dad['name']));if(_0x135dbc){startRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);var _0x1ac3af=(_0x135dbc[_0x7721('0x33')]||0xa)*0x3e8;var _0x421aae=(_0x231dad[_0x7721('0x33')]||0x14)*0x3e8;var _0x335145,_0x15181b;if(_0x1ac3af>_0x421aae){_0x421aae=_0x1ac3af;}var _0x1d2ea5=seqqueue[_0x7721('0x3d')](_0x1ac3af);_0x1d2ea5['id']=_0x4a2c28;_0x1d2ea5[_0x7721('0x3e')]=_0x1ac3af;_0x1d2ea5[_0x7721('0x3f')]=_0x421aae;_0x1d2ea5['channel']=_0x2333b8['channel'];_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on'](_0x7721('0x41'),function(){logger[_0x7721('0x2a')](_0x7721('0x42'),_0x4a2c28);stopRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x335145=undefined;_0x1d2ea5['close'](!![]);if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59[_0x7721('0x40')][_0x4a2c28];}_0x15fa2c['stop']();});_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on']('complete',function(){if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59['rules'][_0x4a2c28];}});_0x335145=setTimeout(function(){logger[_0x7721('0x2a')](_0x7721('0x43'),_0x4a2c28);endRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x1d2ea5[_0x7721('0x44')](!![]);_0x15fa2c['next']();},_0x421aae);switch(_0x135dbc[_0x7721('0x45')]){case _0x7721('0x46'):strategy['rrmemory'](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);break;default:strategy[_0x7721('0x47')](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);}}else{logger[_0x7721('0x2f')](_0x7721('0x48'),_0x4a2c28,_0x231dad['name']);_0x15fa2c[_0x7721('0x3b')]();}}}catch(_0x5a32b6){console[_0x7721('0x49')](_0x5a32b6);logger[_0x7721('0x2f')](_0x7721('0x4a'),_0x4a2c28,_0x5a32b6[_0x7721('0x4b')]);_0x15fa2c[_0x7721('0x3b')]();}};}; \ 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 1f329ab..abfbbb2 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 _0x5493=['busy','showNotification','RINGING',':FORCED','hideNotification','busyQueue','writeLog','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable'];(function(_0x1c8eb5,_0x125c79){var _0x52c6c=function(_0xdcfa04){while(--_0xdcfa04){_0x1c8eb5['push'](_0x1c8eb5['shift']());}};_0x52c6c(++_0x125c79);}(_0x5493,0xe3));var _0x3549=function(_0x3ffc33,_0xc76983){_0x3ffc33=_0x3ffc33-0x0;var _0x42acf6=_0x5493[_0x3ffc33];return _0x42acf6;};'use strict';var _=require('lodash');var uuid=require(_0x3549('0x0'));var util=require(_0x3549('0x1'));var logger=require(_0x3549('0x2'))(_0x3549('0x3'));var Agent=function(_0x1e0253,_0x816ad3,_0x194cb5,_0x3a63de){this['notificationId']=uuid['v4']();this[_0x3549('0x4')]=_0x1e0253;this[_0x3549('0x5')]=_0x816ad3;this[_0x3549('0x6')]=_0x194cb5;this[_0x3549('0x3')]=_0x3a63de;this[_0x3549('0x4')][_0x3549('0x7')](this[_0x3549('0x8')][_0x3549('0x9')](this),this[_0x3549('0xa')]['bind'](this));this[_0x3549('0x4')]['on']('timeout',this[_0x3549('0xa')][_0x3549('0x9')](this));this[_0x3549('0x4')]['on'](_0x3549('0xb'),this['handleDrained'][_0x3549('0x9')](this));};Agent[_0x3549('0xc')][_0x3549('0x7')]=function(){this[_0x3549('0x4')][_0x3549('0x7')](this[_0x3549('0x8')]['bind'](this),this[_0x3549('0xa')][_0x3549('0x9')](this));};Agent[_0x3549('0xc')][_0x3549('0xd')]=function(){this[_0x3549('0xa')](!![]);};Agent[_0x3549('0xc')][_0x3549('0x8')]=function(_0x20d38e){logger[_0x3549('0xe')](_0x3549('0xf'),this[_0x3549('0x4')]['id'],this['agent']['id']);if(_[_0x3549('0x10')](this[_0x3549('0x6')][_0x3549('0x11')][this[_0x3549('0x5')]['id']])){logger['info'](_0x3549('0x12'),this[_0x3549('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x3549('0x7')][_0x3549('0x9')](this),0x3e8);}else{if(this[_0x3549('0x3')][_0x3549('0x13')]||util[_0x3549('0x14')](this[_0x3549('0x4')]['id'],this['realtime'][_0x3549('0x11')][this[_0x3549('0x5')]['id']],this[_0x3549('0x4')]['channel'],![])){this['realtime']['agents'][this['agent']['id']][_0x3549('0x15')]=!![];this[_0x3549('0x6')]['agents'][this[_0x3549('0x5')]['id']]['busyQueue']=undefined;util[_0x3549('0x16')](this['notificationId'],this[_0x3549('0x4')]['id'],this[_0x3549('0x6')]['agents'][this[_0x3549('0x5')]['id']],null,this[_0x3549('0x3')]);util['writeLog'](this[_0x3549('0x4')]['id'],this[_0x3549('0x6')]['agents'][this[_0x3549('0x5')]['id']],_0x3549('0x17')+(this['routing'][_0x3549('0x13')]?_0x3549('0x18'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x3549('0x4')]['id'],this[_0x3549('0x5')]['id']);setTimeout(this[_0x3549('0x7')][_0x3549('0x9')](this),0x3e8);}}};Agent[_0x3549('0xc')][_0x3549('0xa')]=function(_0x24a63e){if(_[_0x3549('0x10')](this[_0x3549('0x6')][_0x3549('0x11')][this[_0x3549('0x5')]['id']])){return logger[_0x3549('0xe')](_0x3549('0x12'),this[_0x3549('0x4')]['id'],this[_0x3549('0x5')]['id']);}else{logger[_0x3549('0xe')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x3549('0x4')]['id'],this[_0x3549('0x5')]['id']);util[_0x3549('0x19')](this['notificationId'],this[_0x3549('0x4')]['id'],this[_0x3549('0x6')][_0x3549('0x11')][this['agent']['id']],null,this['routing']);this[_0x3549('0x6')]['agents'][this[_0x3549('0x5')]['id']][_0x3549('0x15')]=![];this[_0x3549('0x6')][_0x3549('0x11')][this['agent']['id']][_0x3549('0x1a')]=undefined;util[_0x3549('0x1b')](this[_0x3549('0x4')]['id'],this[_0x3549('0x6')][_0x3549('0x11')][this[_0x3549('0x5')]['id']],_0x24a63e?_0x3549('0x1c'):_0x3549('0x1d'));}if(!_0x24a63e){setTimeout(this[_0x3549('0x7')]['bind'](this),0x3e8);}};function agent(_0x592a7a,_0x429bab,_0x388813,_0x4eb862){return new Agent(_0x592a7a,_0x429bab,_0x388813,_0x4eb862);}module[_0x3549('0x1e')]=agent; \ No newline at end of file +var _0x9461=['TIMEOUT','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','routing','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog'];(function(_0x7c658d,_0xa5a056){var _0x12c7b2=function(_0x13061f){while(--_0x13061f){_0x7c658d['push'](_0x7c658d['shift']());}};_0x12c7b2(++_0xa5a056);}(_0x9461,0x85));var _0x1946=function(_0x553aa4,_0x1bedb5){_0x553aa4=_0x553aa4-0x0;var _0x13a6e6=_0x9461[_0x553aa4];return _0x13a6e6;};'use strict';var _=require('lodash');var uuid=require(_0x1946('0x0'));var util=require(_0x1946('0x1'));var logger=require(_0x1946('0x2'))('routing');var Agent=function(_0x42a06f,_0x1c7d09,_0x581c39,_0x38095c){this[_0x1946('0x3')]=uuid['v4']();this[_0x1946('0x4')]=_0x42a06f;this[_0x1946('0x5')]=_0x1c7d09;this['realtime']=_0x581c39;this[_0x1946('0x6')]=_0x38095c;this[_0x1946('0x4')][_0x1946('0x7')](this[_0x1946('0x8')][_0x1946('0x9')](this),this[_0x1946('0xa')][_0x1946('0x9')](this));this[_0x1946('0x4')]['on'](_0x1946('0xb'),this[_0x1946('0xa')][_0x1946('0x9')](this));this[_0x1946('0x4')]['on']('drained',this[_0x1946('0xc')][_0x1946('0x9')](this));};Agent[_0x1946('0xd')][_0x1946('0x7')]=function(){this['squeue'][_0x1946('0x7')](this[_0x1946('0x8')]['bind'](this),this[_0x1946('0xa')][_0x1946('0x9')](this));};Agent['prototype'][_0x1946('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0x1946('0xd')][_0x1946('0x8')]=function(_0x1f8973){logger[_0x1946('0xe')](_0x1946('0xf'),this[_0x1946('0x4')]['id'],this['agent']['id']);if(_[_0x1946('0x10')](this[_0x1946('0x11')][_0x1946('0x12')][this['agent']['id']])){logger[_0x1946('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x1946('0x9')](this),0x3e8);}else{if(this[_0x1946('0x6')][_0x1946('0x13')]||util[_0x1946('0x14')](this[_0x1946('0x4')]['id'],this[_0x1946('0x11')][_0x1946('0x12')][this['agent']['id']],this[_0x1946('0x4')][_0x1946('0x15')],![])){this[_0x1946('0x11')][_0x1946('0x12')][this[_0x1946('0x5')]['id']][_0x1946('0x16')]=!![];this[_0x1946('0x11')][_0x1946('0x12')][this[_0x1946('0x5')]['id']][_0x1946('0x17')]=undefined;util[_0x1946('0x18')](this[_0x1946('0x3')],this[_0x1946('0x4')]['id'],this[_0x1946('0x11')]['agents'][this['agent']['id']],null,this[_0x1946('0x6')]);util['writeLog'](this['squeue']['id'],this[_0x1946('0x11')][_0x1946('0x12')][this[_0x1946('0x5')]['id']],_0x1946('0x19')+(this[_0x1946('0x6')][_0x1946('0x13')]?_0x1946('0x1a'):''));}else{logger[_0x1946('0xe')](_0x1946('0x1b'),this[_0x1946('0x4')]['id'],this[_0x1946('0x5')]['id']);setTimeout(this[_0x1946('0x7')][_0x1946('0x9')](this),0x3e8);}}};Agent[_0x1946('0xd')][_0x1946('0xa')]=function(_0x50dea3){if(_[_0x1946('0x10')](this[_0x1946('0x11')][_0x1946('0x12')][this[_0x1946('0x5')]['id']])){return logger[_0x1946('0xe')](_0x1946('0x1c'),this[_0x1946('0x4')]['id'],this[_0x1946('0x5')]['id']);}else{logger[_0x1946('0xe')](_0x1946('0x1d'),this['squeue']['id'],this[_0x1946('0x5')]['id']);util[_0x1946('0x1e')](this[_0x1946('0x3')],this[_0x1946('0x4')]['id'],this['realtime']['agents'][this[_0x1946('0x5')]['id']],null,this[_0x1946('0x6')]);this['realtime'][_0x1946('0x12')][this[_0x1946('0x5')]['id']]['busy']=![];this[_0x1946('0x11')][_0x1946('0x12')][this[_0x1946('0x5')]['id']][_0x1946('0x17')]=undefined;util[_0x1946('0x1f')](this['squeue']['id'],this[_0x1946('0x11')][_0x1946('0x12')][this['agent']['id']],_0x50dea3?'STOP':_0x1946('0x20'));}if(!_0x50dea3){setTimeout(this[_0x1946('0x7')][_0x1946('0x9')](this),0x3e8);}};function agent(_0x1df8f7,_0x1e2adf,_0x568533,_0x29fd04){return new Agent(_0x1df8f7,_0x1e2adf,_0x568533,_0x29fd04);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 5aa9e32..d4ccf96 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 _0x2fba=['showNotification','notificationId','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','queue','realtime','routing','push','handleRun','bind','handleTimeout','handleDrained','prototype','squeue','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name'];(function(_0x1548a9,_0x27e9c9){var _0x28336d=function(_0x5a18ba){while(--_0x5a18ba){_0x1548a9['push'](_0x1548a9['shift']());}};_0x28336d(++_0x27e9c9);}(_0x2fba,0x1b4));var _0xa2fb=function(_0x35feb4,_0x37a91d){_0x35feb4=_0x35feb4-0x0;var _0x1f9406=_0x2fba[_0x35feb4];return _0x1f9406;};'use strict';var _=require(_0xa2fb('0x0'));var uuid=require(_0xa2fb('0x1'));var util=require(_0xa2fb('0x2'));var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x57e245,_0x209a42,_0x56cdc9,_0x366687){this['notificationId']=uuid['v4']();this['squeue']=_0x57e245;this[_0xa2fb('0x3')]=_0x209a42;this[_0xa2fb('0x4')]=_0x56cdc9;this[_0xa2fb('0x5')]=_0x366687;this['squeue'][_0xa2fb('0x6')](this[_0xa2fb('0x7')][_0xa2fb('0x8')](this),this[_0xa2fb('0x9')]['bind'](this));this['squeue']['on']('timeout',this[_0xa2fb('0x9')][_0xa2fb('0x8')](this));this['squeue']['on']('drained',this[_0xa2fb('0xa')][_0xa2fb('0x8')](this));};Beepall[_0xa2fb('0xb')]['push']=function(){this[_0xa2fb('0xc')][_0xa2fb('0x6')](this[_0xa2fb('0x7')][_0xa2fb('0x8')](this),this[_0xa2fb('0x9')]['bind'](this));};Beepall[_0xa2fb('0xb')]['handleDrained']=function(_0x8a06cc){this[_0xa2fb('0x9')](!![]);};Beepall['prototype'][_0xa2fb('0x7')]=function(_0x783c){var _0x5dfd89=!![];if(!_['isNil'](this[_0xa2fb('0x3')])&&!_[_0xa2fb('0xd')](this[_0xa2fb('0x3')][_0xa2fb('0xe')])&&this[_0xa2fb('0x3')][_0xa2fb('0xe')][_0xa2fb('0xf')]>0x0){for(var _0x21b1c8=0x0,_0x137803;_0x21b1c80x0){for(var _0x2b59f3=0x0,_0x117af5;_0x2b59f30x0&&_0x108153[_0x12c871+_0x9c71('0x26')]>=_0x108153[_0x12c871+'Capacity']){writeLog(_0x5de37b,_0x108153,_0x12c871['toUpperCase']()+_0x9c71('0x27'));return![];}}return!![];};exports[_0x9c71('0x28')]=function(_0x4747d0,_0x39670,_0x27e2ec,_0x4836e5,_0xd9ce71){return sendNotification(!![],_0x4747d0,_0x39670,_0x27e2ec,_0x4836e5,_0xd9ce71);};exports[_0x9c71('0x29')]=function(_0x1f96d2,_0x23ad53,_0x14bd5c,_0x172129,_0x4868ea){return sendNotification(![],_0x1f96d2,_0x23ad53,_0x14bd5c,_0x172129,_0x4868ea);};exports['writeLog']=writeLog; \ No newline at end of file +var _0xa7b5=['account','body','queue','getMustacheRender','notificationTemplate','msg','error','format','[%s][QUEUE]\x20%s','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','showNotification','hideNotification','lodash','util','../utils','mustache','ioredis','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','emit','user:%s','user:save','\x20interaction','notificationSound'];(function(_0x1e1cdc,_0x458566){var _0x26334a=function(_0x49bfde){while(--_0x49bfde){_0x1e1cdc['push'](_0x1e1cdc['shift']());}};_0x26334a(++_0x458566);}(_0xa7b5,0x162));var _0x5a7b=function(_0x11a642,_0x3d825d){_0x11a642=_0x11a642-0x0;var _0x293194=_0xa7b5[_0x11a642];return _0x293194;};'use strict';var _=require(_0x5a7b('0x0'));var util=require(_0x5a7b('0x1'));var utils=require(_0x5a7b('0x2'));var Mustache=require(_0x5a7b('0x3'));var Redis=require(_0x5a7b('0x4'));var config=require('../../../../../config/environment');var logger=require(_0x5a7b('0x5'))(_0x5a7b('0x6'));config[_0x5a7b('0x7')]=_['defaults'](config['redis'],{'host':_0x5a7b('0x8'),'port':0x18eb});var io=require(_0x5a7b('0x9'))(new Redis(config['redis']));function emit(_0x38dac6,_0xe45788,_0x390a68){io['to'](_0x38dac6)[_0x5a7b('0xa')](_0xe45788,_0x390a68);}function sendNotification(_0x14c477,_0x5c281b,_0x21a69c,_0x59b6df,_0xa82b13,_0x333745){io['to'](util['format'](_0x5a7b('0xb'),_0x59b6df['name']))[_0x5a7b('0xa')](_0x5a7b('0xc'),_0x59b6df);var _0xadabe8=_0x333745||{};var _0xf3e3a0=_0x21a69c['split']('.');var _0x4d3c4d={'uniqueid':_0x5c281b,'channel':_0xf3e3a0[0x0],'id':_0xf3e3a0[0x1],'title':_0xf3e3a0[0x0]+_0x5a7b('0xd'),'interactionId':_0xf3e3a0[0x2],'queue':_0xa82b13?_0xa82b13['name']:null,'sound':_0xadabe8['account'][_0x5a7b('0xe')],'shake':_0xadabe8[_0x5a7b('0xf')]['notificationShake']};try{if(!_0xadabe8[_0x5a7b('0x10')]){_0xadabe8[_0x5a7b('0x10')]={};}if(_0xa82b13){_0xadabe8[_0x5a7b('0x10')]['queue']=_0xa82b13;}else if(_0xadabe8[_0x5a7b('0x10')][_0x5a7b('0x11')]){delete _0xadabe8['body'][_0x5a7b('0x11')];}_0x4d3c4d['msg']=utils[_0x5a7b('0x12')](_0xadabe8['account'][_0x5a7b('0x13')],_0xadabe8);}catch(_0x44d6e4){_0x4d3c4d[_0x5a7b('0x14')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x5a7b('0x15')](util[_0x5a7b('0x16')](_0x5a7b('0x17'),_0x5c281b,_0x44d6e4['message']));}io['to'](util['format'](_0x5a7b('0xb'),_0x59b6df['name']))[_0x5a7b('0xa')](util['format'](_0x5a7b('0x18'),_0x14c477?_0x5a7b('0x19'):_0x5a7b('0x1a')),_0x4d3c4d);}function writeLog(_0x4b5788,_0x385cd1,_0x458511){return logger['info'](util[_0x5a7b('0x16')](_0x5a7b('0x1b'),_0x4b5788,_0x385cd1['name'],_0x458511));}exports[_0x5a7b('0x1c')]=function(_0x247723,_0x52c3a9,_0x59fa7f,_0xe27156){if(_0x52c3a9[_0x5a7b('0x1d')]){writeLog(_0x247723,_0x52c3a9,_0x5a7b('0x1e'));return![];}if(!_0x52c3a9[_0x5a7b('0x1f')]){writeLog(_0x247723,_0x52c3a9,_0x5a7b('0x20'));return![];}if(_0x52c3a9[_0x59fa7f+_0x5a7b('0x21')]){writeLog(_0x247723,_0x52c3a9,_0x5a7b('0x22'));return![];}if(_0xe27156&&_0x52c3a9['hasOwnProperty'](_0x59fa7f+'Capacity')&&_0x52c3a9[_0x5a7b('0x23')](_0x59fa7f+_0x5a7b('0x24'))){if(_0x52c3a9[_0x59fa7f+_0x5a7b('0x25')]>0x0&&_0x52c3a9[_0x59fa7f+_0x5a7b('0x24')]>=_0x52c3a9[_0x59fa7f+_0x5a7b('0x25')]){writeLog(_0x247723,_0x52c3a9,_0x59fa7f[_0x5a7b('0x26')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x5a7b('0x27')]=function(_0x3531cf,_0x3d505f,_0x10f937,_0x4d9fd7,_0xb0ce2b){return sendNotification(!![],_0x3531cf,_0x3d505f,_0x10f937,_0x4d9fd7,_0xb0ce2b);};exports[_0x5a7b('0x28')]=function(_0xe1de2a,_0x1ad5da,_0x21b42e,_0x5dd6b9,_0x712d99){return sendNotification(![],_0xe1de2a,_0x1ad5da,_0x21b42e,_0x5dd6b9,_0x712d99);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index be09ded..83e86fa 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 _0x281a=['validate','length','error','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','[%s][SYSTEM]\x20%s','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x43765,_0x263652){var _0x5c8eb7=function(_0x59ca08){while(--_0x59ca08){_0x43765['push'](_0x43765['shift']());}};_0x5c8eb7(++_0x263652);}(_0x281a,0x154));var _0xa281=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x281a[_0x5f0089];return _0x193892;};'use strict';var schema=require('validate');var sh=require(_0xa281('0x0'));var _=require(_0xa281('0x1'));var utils=require(_0xa281('0x2'));var logger=require(_0xa281('0x3'))(_0xa281('0x4'));var system=schema({'command':{'type':_0xa281('0x5'),'required':!![],'message':_0xa281('0x6')}});exports[_0xa281('0x7')]=function(_0x8813bd,_0x47bc63){return function(_0x187dd3){try{var _0x33520a={'command':_0x47bc63[0x0]};var _0x124222=system[_0xa281('0x8')](_0x33520a,{'typecast':!![]});if(_0x124222[_0xa281('0x9')]){logger[_0xa281('0xa')]('[%s][SYSTEM]\x20%s',_0x8813bd,_[_0xa281('0xb')](_0x124222,_0xa281('0xc'))['join'](',\x20'));logger[_0xa281('0xd')](_0xa281('0xe'),_0x8813bd);_0x187dd3['next']();}else{var _0x379a34=this;var _0xe948ed=utils[_0xa281('0xf')](_0x47bc63[0x0],this);logger[_0xa281('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x8813bd,_0xe948ed);sh[_0xa281('0x10')](_[_0xa281('0x11')](_0xe948ed),function(_0x4c0049,_0x59ddc1){logger[_0xa281('0xd')](_0xa281('0x12'),_0x8813bd,_0x4c0049);if(_0x4c0049==0x0){var _0x33c6fd=_0x59ddc1[_0xa281('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xa281('0x14')](_0x47bc63[0x1])||_[_0xa281('0x15')](_0x47bc63[0x1])){logger[_0xa281('0xd')](_0xa281('0x16'),_0x8813bd);_0x379a34[_0xa281('0x17')][_0x47bc63[0x1]]=_0x33c6fd;}else{logger['info'](_0xa281('0x18'),_0x8813bd,_0x47bc63[0x1],_0x33c6fd);_0x379a34[_0xa281('0x17')][_0x47bc63[0x1]]=_0x33c6fd;}}_0x187dd3[_0xa281('0x19')]();});}}catch(_0x24f21d){logger[_0xa281('0xa')](_0xa281('0x1a'),_0x8813bd,_[_0xa281('0x1b')](_0x24f21d)?JSON[_0xa281('0x1c')](_0x24f21d):_0x24f21d);logger['info'](_0xa281('0xe'),_0x8813bd);_0x187dd3[_0xa281('0x19')]();}};}; \ No newline at end of file +var _0x4bc7=['replace','isEmpty','body','isObject','stringify','validate','shelljs','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim'];(function(_0x92f0a8,_0x5538f4){var _0x139d3b=function(_0x49ef84){while(--_0x49ef84){_0x92f0a8['push'](_0x92f0a8['shift']());}};_0x139d3b(++_0x5538f4);}(_0x4bc7,0x1d1));var _0x74bc=function(_0x1819bd,_0x15e90e){_0x1819bd=_0x1819bd-0x0;var _0x5b5f76=_0x4bc7[_0x1819bd];return _0x5b5f76;};'use strict';var schema=require(_0x74bc('0x0'));var sh=require(_0x74bc('0x1'));var _=require(_0x74bc('0x2'));var utils=require(_0x74bc('0x3'));var logger=require('../../../../config/logger')(_0x74bc('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x74bc('0x5')}});exports[_0x74bc('0x6')]=function(_0x562c2b,_0x5628c4){return function(_0x1bd448){try{var _0x258a47={'command':_0x5628c4[0x0]};var _0x59fd96=system[_0x74bc('0x0')](_0x258a47,{'typecast':!![]});if(_0x59fd96[_0x74bc('0x7')]){logger[_0x74bc('0x8')](_0x74bc('0x9'),_0x562c2b,_[_0x74bc('0xa')](_0x59fd96,_0x74bc('0xb'))['join'](',\x20'));logger[_0x74bc('0xc')](_0x74bc('0xd'),_0x562c2b);_0x1bd448[_0x74bc('0xe')]();}else{var _0x3fa1ed=this;var _0x1323b6=utils['getMustacheRender'](_0x5628c4[0x0],this);logger[_0x74bc('0xc')](_0x74bc('0xf'),_0x562c2b,_0x1323b6);sh[_0x74bc('0x10')](_[_0x74bc('0x11')](_0x1323b6),function(_0x1f44ef,_0xe7509c){logger[_0x74bc('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x562c2b,_0x1f44ef);if(_0x1f44ef==0x0){var _0x78b1b=_0xe7509c[_0x74bc('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x5628c4[0x1])||_[_0x74bc('0x13')](_0x5628c4[0x1])){logger[_0x74bc('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x562c2b);_0x3fa1ed[_0x74bc('0x14')][_0x5628c4[0x1]]=_0x78b1b;}else{logger[_0x74bc('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x562c2b,_0x5628c4[0x1],_0x78b1b);_0x3fa1ed[_0x74bc('0x14')][_0x5628c4[0x1]]=_0x78b1b;}}_0x1bd448[_0x74bc('0xe')]();});}}catch(_0x246817){logger[_0x74bc('0x8')](_0x74bc('0x9'),_0x562c2b,_[_0x74bc('0x15')](_0x246817)?JSON[_0x74bc('0x16')](_0x246817):_0x246817);logger[_0x74bc('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x562c2b);_0x1bd448['next']();}};}; \ 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 267941b..0ae11fe 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 _0xa95a=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','channel','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','next','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x247950,_0x4dce98){var _0x2f5d3f=function(_0x2d0865){while(--_0x2d0865){_0x247950['push'](_0x247950['shift']());}};_0x2f5d3f(++_0x4dce98);}(_0xa95a,0x182));var _0xaa95=function(_0x24b824,_0x3c330e){_0x24b824=_0x24b824-0x0;var _0x2be676=_0xa95a[_0x24b824];return _0x2be676;};'use strict';var schema=require(_0xaa95('0x0'));var _=require(_0xaa95('0x1'));var rpc={'chatInteraction':require(_0xaa95('0x2')),'openchannelInteraction':require(_0xaa95('0x3')),'smsInteraction':require(_0xaa95('0x4')),'mailInteraction':require(_0xaa95('0x5')),'faxInteraction':require(_0xaa95('0x6')),'whatsappInteraction':require(_0xaa95('0x7'))};var logger=require('../../../../config/logger')(_0xaa95('0x8'));var tag=schema({'tag':{'type':_0xaa95('0x9'),'required':!![],'message':_0xaa95('0xa')}});exports[_0xaa95('0xb')]=function(_0x2d4a4e,_0x3aad93,_0x3d6479,_0x51ba27){return function(_0x5d26f3){try{var _0x5021f5={'tag':_0x3aad93[0x0]};var _0x5d03e8=tag[_0xaa95('0x0')](_0x5021f5,{'typecast':!![]});if(_0x5d03e8[_0xaa95('0xc')]){logger[_0xaa95('0xd')](_0xaa95('0xe'),_0x2d4a4e,_['map'](_0x5d03e8,_0xaa95('0xf'))[_0xaa95('0x10')](',\x20'));logger[_0xaa95('0x11')](_0xaa95('0x12'),_0x2d4a4e);_0x5d26f3['next']();}else{var _0xef6e09={'ids':[_0x3aad93[0x0]]};if(rpc[_0x51ba27['channel']+_0xaa95('0x13')]){rpc[_0x51ba27[_0xaa95('0x14')]+_0xaa95('0x13')][_0xaa95('0x15')](_0x51ba27['interaction']['id'],_0xef6e09)[_0xaa95('0x16')](function(_0x30e4c5){logger['info'](_0xaa95('0x17'),_0x2d4a4e,_0x3aad93[0x1],_0x51ba27[_0xaa95('0x14')],_0x51ba27[_0xaa95('0x18')]['id']);})[_0xaa95('0x19')](function(_0x4c4b7c){logger[_0xaa95('0xd')]('[%s][TAG]\x20%s',_0x2d4a4e,JSON['stringify'](_0x4c4b7c));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2d4a4e);})['finally'](function(){_0x5d26f3[_0xaa95('0x1a')]();});}}}catch(_0x3bc44c){logger[_0xaa95('0xd')](_0xaa95('0xe'),_0x2d4a4e,_['isObject'](_0x3bc44c)?JSON[_0xaa95('0x1b')](_0x3bc44c):_0x3bc44c);logger['info'](_0xaa95('0x12'),_0x2d4a4e);_0x5d26f3[_0xaa95('0x1a')]();}};}; \ No newline at end of file +var _0x82e8=['../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x82e8,0x1b9));var _0x882e=function(_0x89c40f,_0xd92eb2){_0x89c40f=_0x89c40f-0x0;var _0x17acbb=_0x82e8[_0x89c40f];return _0x17acbb;};'use strict';var schema=require(_0x882e('0x0'));var _=require(_0x882e('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x882e('0x2')),'smsInteraction':require(_0x882e('0x3')),'mailInteraction':require(_0x882e('0x4')),'faxInteraction':require(_0x882e('0x5')),'whatsappInteraction':require(_0x882e('0x6'))};var logger=require(_0x882e('0x7'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x882e('0x8')}});exports[_0x882e('0x9')]=function(_0x3aebff,_0x145e94,_0x2774e9,_0x2d6511){return function(_0x4bcf27){try{var _0x42191e={'tag':_0x145e94[0x0]};var _0x3e06ba=tag[_0x882e('0x0')](_0x42191e,{'typecast':!![]});if(_0x3e06ba[_0x882e('0xa')]){logger['error'](_0x882e('0xb'),_0x3aebff,_['map'](_0x3e06ba,_0x882e('0xc'))[_0x882e('0xd')](',\x20'));logger[_0x882e('0xe')](_0x882e('0xf'),_0x3aebff);_0x4bcf27[_0x882e('0x10')]();}else{var _0x2db808={'ids':[_0x145e94[0x0]]};if(rpc[_0x2d6511[_0x882e('0x11')]+_0x882e('0x12')]){rpc[_0x2d6511[_0x882e('0x11')]+'Interaction'][_0x882e('0x13')](_0x2d6511[_0x882e('0x14')]['id'],_0x2db808)[_0x882e('0x15')](function(_0x24ae8e){logger[_0x882e('0xe')](_0x882e('0x16'),_0x3aebff,_0x145e94[0x1],_0x2d6511['channel'],_0x2d6511[_0x882e('0x14')]['id']);})[_0x882e('0x17')](function(_0x5e5ee6){logger[_0x882e('0x18')](_0x882e('0xb'),_0x3aebff,JSON[_0x882e('0x19')](_0x5e5ee6));logger[_0x882e('0xe')](_0x882e('0xf'),_0x3aebff);})[_0x882e('0x1a')](function(){_0x4bcf27[_0x882e('0x10')]();});}}}catch(_0x407133){logger[_0x882e('0x18')](_0x882e('0xb'),_0x3aebff,_[_0x882e('0x1b')](_0x407133)?JSON[_0x882e('0x19')](_0x407133):_0x407133);logger[_0x882e('0xe')](_0x882e('0xf'),_0x3aebff);_0x4bcf27[_0x882e('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 7b64c84..350c0dc 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 _0x90ae=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x3554e2,_0x2fc7f4){var _0x498ae1=function(_0x5686dd){while(--_0x5686dd){_0x3554e2['push'](_0x3554e2['shift']());}};_0x498ae1(++_0x2fc7f4);}(_0x90ae,0x195));var _0xe90a=function(_0x4cdbfb,_0xb64308){_0x4cdbfb=_0x4cdbfb-0x0;var _0x29c645=_0x90ae[_0x4cdbfb];return _0x29c645;};'use strict';var Mustache=require(_0xe90a('0x0'));var _=require(_0xe90a('0x1'));module[_0xe90a('0x2')]={'getMustacheRender':function(_0x4c6db8,_0xbff9b9){return Mustache[_0xe90a('0x3')](_0x4c6db8,_[_0xe90a('0x4')](_0xbff9b9[_0xe90a('0x5')],{'contact':_0xbff9b9[_0xe90a('0x6')],'message':_0xbff9b9[_0xe90a('0x7')],'account':_0xbff9b9[_0xe90a('0x8')],'interaction':_0xbff9b9[_0xe90a('0x9')],'list':_0xbff9b9[_0xe90a('0xa')]}))||'';}}; \ No newline at end of file +var _0x54f3=['lodash','exports','render','contact','message','account'];(function(_0x333767,_0x3e6f9c){var _0x51661b=function(_0x46e5d6){while(--_0x46e5d6){_0x333767['push'](_0x333767['shift']());}};_0x51661b(++_0x3e6f9c);}(_0x54f3,0x120));var _0x354f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x54f3[_0x178e48];return _0x440d7e;};'use strict';var Mustache=require('mustache');var _=require(_0x354f('0x0'));module[_0x354f('0x1')]={'getMustacheRender':function(_0x1fec84,_0x1cb51f){return Mustache[_0x354f('0x2')](_0x1fec84,_['merge'](_0x1cb51f['body'],{'contact':_0x1cb51f[_0x354f('0x3')],'message':_0x1cb51f[_0x354f('0x4')],'account':_0x1cb51f[_0x354f('0x5')],'interaction':_0x1cb51f['interaction'],'list':_0x1cb51f['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 33f9167..131a7d0 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 _0xfd28=['existsSync','app','toLowerCase','autoreply','appdata','split','channel','push','slice','join','dialogflow','dialogflowv2','amazonlex','%s:%s:%s','./interval','condition','intervals','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','stringify','matchPath','emit','complete','error','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','IntervalId','map','Intervals','interval','isNil','listen','rules','message','interaction','isArray','applications','length'];(function(_0x2e2946,_0x103f24){var _0x34aa1c=function(_0x41ca30){while(--_0x41ca30){_0x2e2946['push'](_0x2e2946['shift']());}};_0x34aa1c(++_0x103f24);}(_0xfd28,0x148));var _0x8fd2=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xfd28[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x8fd2('0x2'));var uuid=require('uuid');var config=require(_0x8fd2('0x3'));var logger=require(_0x8fd2('0x4'))(_0x8fd2('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x8fd2('0x6')),'chatQueueReport':require(_0x8fd2('0x7')),'smsQueueReport':require(_0x8fd2('0x8')),'faxQueueReport':require(_0x8fd2('0x9')),'whatsappQueueReport':require(_0x8fd2('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x53d938,_0x10fccf,_0x466c3d){return util[_0x8fd2('0xb')]('%s.%s.%s',_0x53d938,_0x10fccf||0x0,_0x466c3d||0x0);}function getIntervals(_0x13cc69,_0x49ca87){var _0x2842f3=[];if(!_['isNil'](_0x49ca87[_0x8fd2('0xc')])&&!_['isNil'](_0x13cc69[_0x49ca87[_0x8fd2('0xc')]])&&!_['isNil'](_0x13cc69[_0x49ca87[_0x8fd2('0xc')]]['Intervals'])){_0x2842f3=_[_0x8fd2('0xd')](_0x13cc69[_0x49ca87[_0x8fd2('0xc')]][_0x8fd2('0xe')],_0x8fd2('0xf'));}else if(!_[_0x8fd2('0x10')](_0x49ca87[_0x8fd2('0xf')])){_0x2842f3=[_0x49ca87[_0x8fd2('0xf')]];}return _0x2842f3;}exports[_0x8fd2('0x11')]=function(_0x2b152c){_0x2b152c[_0x8fd2('0x12')]={};return new BPromise(function(_0x118329,_0x6b8ef){var _0x725d57={'Start':function(_0x40712c){var _0xa65b4=this;return new Promise(function(_0x596639,_0x20daca){if(_0x40712c){try{var _0x5ef478=[];var _0x4f0b17=getId(_0x40712c['channel'],_0x40712c[_0x8fd2('0x13')]?_0x40712c[_0x8fd2('0x13')]['id']:0x0,_0x40712c[_0x8fd2('0x14')]?_0x40712c[_0x8fd2('0x14')]['id']:0x0);if(_0x40712c['applications']&&_[_0x8fd2('0x15')](_0x40712c[_0x8fd2('0x16')])&&_0x40712c[_0x8fd2('0x16')][_0x8fd2('0x17')]){for(var _0x14641a=0x0;_0x14641a<_0x40712c['applications']['length'];_0x14641a+=0x1){var _0x3a0939=_0x40712c['applications'][_0x14641a];if(fs[_0x8fd2('0x18')](path['join'](__dirname,_0x8fd2('0x16'),_0x3a0939[_0x8fd2('0x19')]+'.js'))){var _0x122b60=[];switch(_0x3a0939['app'][_0x8fd2('0x1a')]()){case _0x8fd2('0x1b'):var _0x4e0dc4=_0x3a0939[_0x8fd2('0x1c')][_0x8fd2('0x1d')](',');if(_0x40712c[_0x8fd2('0x1e')]==='mail'){_0x122b60[_0x8fd2('0x1f')](_0x4e0dc4[0x0]);_0x122b60[_0x8fd2('0x1f')](_0x4e0dc4[0x1]);_0x122b60[_0x8fd2('0x1f')](_0x4e0dc4[_0x8fd2('0x20')](0x2,_0x4e0dc4[_0x8fd2('0x17')])[_0x8fd2('0x21')](','));}else{_0x122b60[_0x8fd2('0x1f')](_0x4e0dc4[0x0]);_0x122b60[_0x8fd2('0x1f')](_0x4e0dc4[_0x8fd2('0x20')](0x1,_0x4e0dc4[_0x8fd2('0x17')])[_0x8fd2('0x21')](','));}break;case _0x8fd2('0x22'):var _0x3f16a3=_0x3a0939['appdata']['split'](',');_0x122b60[_0x8fd2('0x1f')](_0x3f16a3[0x0]);_0x122b60[_0x8fd2('0x1f')](_0x3f16a3[0x1]);_0x122b60[_0x8fd2('0x1f')](_0x3f16a3['slice'](0x2,_0x3f16a3[_0x8fd2('0x17')])[_0x8fd2('0x21')](','));break;case _0x8fd2('0x23'):var _0x960869=_0x3a0939[_0x8fd2('0x1c')][_0x8fd2('0x1d')](',');_0x122b60[_0x8fd2('0x1f')](_0x960869[0x0]);_0x122b60['push'](_0x960869[0x1]);_0x122b60[_0x8fd2('0x1f')](_0x960869[0x2]);_0x122b60[_0x8fd2('0x1f')](_0x960869[0x3]);_0x122b60[_0x8fd2('0x1f')](_0x960869[_0x8fd2('0x20')](0x4,_0x960869[_0x8fd2('0x17')])[_0x8fd2('0x21')](','));break;case _0x8fd2('0x24'):var _0x4f6b7b=_0x3a0939['appdata']['split'](',');_0x122b60[_0x8fd2('0x1f')](_0x4f6b7b[0x0]);_0x122b60[_0x8fd2('0x1f')](_0x4f6b7b[0x1]);_0x122b60[_0x8fd2('0x1f')](_0x4f6b7b[0x2]);_0x122b60[_0x8fd2('0x1f')](_0x4f6b7b[0x3]);_0x122b60['push'](_0x4f6b7b['slice'](0x4,_0x4f6b7b[_0x8fd2('0x17')])[_0x8fd2('0x21')](','));break;case _0x8fd2('0x13'):_0x122b60[_0x8fd2('0x1f')](_0x3a0939[_0x8fd2('0x1c')]);break;case'tag':_0x122b60[_0x8fd2('0x1f')](_0x3a0939['TagId']);_0x122b60[_0x8fd2('0x1f')](_0x3a0939['appdata']);break;default:_0x122b60=_[_0x8fd2('0x10')](_0x3a0939['appdata'])?[]:_0x3a0939[_0x8fd2('0x1c')][_0x8fd2('0x1d')](',');}var _0x39092e={'id':util['format'](_0x8fd2('0x25'),_0x4f0b17,_0x3a0939['id'],_0x3a0939['app']),'condition':require(_0x8fd2('0x26'))[_0x8fd2('0x27')](_0x4f0b17,getIntervals(_0x2b152c[_0x8fd2('0x28')],_0x3a0939),_0x2b152c),'consequence':require('./applications/'+_0x3a0939[_0x8fd2('0x19')])[_0x8fd2('0x29')](_0x4f0b17,_0x122b60,_0x2b152c,_0x40712c),'p':_0x3a0939[_0x8fd2('0x2a')]||0x0};logger['info'](_0x8fd2('0x2b'),_0x39092e['id'],_0x8fd2('0x2c'),getIntervals(_0x2b152c[_0x8fd2('0x28')],_0x3a0939)['join'](_0x8fd2('0x2d')));_0x5ef478[_0x8fd2('0x1f')](_0x39092e);}else{logger['error'](_0x8fd2('0x2e'),path[_0x8fd2('0x21')](__dirname,_0x8fd2('0x16'),_0x3a0939[_0x8fd2('0x19')]+_0x8fd2('0x2f')));}}_0x2b152c[_0x8fd2('0x12')][_0x4f0b17]=new RuleEngine(_0x5ef478);_0x2b152c[_0x8fd2('0x12')][_0x4f0b17]['execute'](_0x40712c,function(_0x7c60d){logger['info']('Applications\x20executed',JSON[_0x8fd2('0x30')](_0x7c60d[_0x8fd2('0x31')]));if(_0x2b152c[_0x8fd2('0x12')][_0x4f0b17]){_0x2b152c[_0x8fd2('0x12')][_0x4f0b17][_0x8fd2('0x32')](_0x8fd2('0x33'));}});return _0x596639({'code':0xc8,'message':_0x40712c});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x596639({'code':0xc8,'message':_0x40712c});}}catch(_0x2df1da){logger['error'](_0x2df1da['stack']);return _0x20daca(_0xa65b4[_0x8fd2('0x34')](0x1f4,_0x2df1da));}}return _0x20daca(_0x8fd2('0x35'));});},'AcceptMessage':function(_0x3648e0){var _0x28f927=this;return new Promise(function(_0x56b96d,_0x39cd8e){if(_0x3648e0[_0x8fd2('0x36')]&&_0x3648e0[_0x8fd2('0x36')]['id']){if(_0x2b152c[_0x8fd2('0x37')][_0x3648e0[_0x8fd2('0x36')]['id']]){_0x2b152c[_0x8fd2('0x37')][_0x3648e0[_0x8fd2('0x36')]['id']]['busy']=![];_0x2b152c[_0x8fd2('0x37')][_0x3648e0[_0x8fd2('0x36')]['id']][_0x8fd2('0x38')]=undefined;}}if(_0x3648e0[_0x8fd2('0x13')]&&_0x3648e0[_0x8fd2('0x13')]['id']){try{var _0x12b014=getId(_0x3648e0[_0x8fd2('0x1e')],_0x3648e0['message']?_0x3648e0[_0x8fd2('0x13')]['id']:0x0,_0x3648e0[_0x8fd2('0x14')]?_0x3648e0[_0x8fd2('0x14')]['id']:0x0);if(_0x2b152c[_0x8fd2('0x12')][_0x12b014]){_0x2b152c[_0x8fd2('0x12')][_0x12b014][_0x8fd2('0x32')](_0x8fd2('0x39'));if(rpc[_0x3648e0['channel']+_0x8fd2('0x3a')]){rpc[_0x3648e0['channel']+_0x8fd2('0x3a')]['update'](_0x12b014,{'UserId':_0x3648e0[_0x8fd2('0x13')][_0x8fd2('0x3b')]})[_0x8fd2('0x3c')](function(_0x5c0632){logger[_0x8fd2('0x34')](_0x8fd2('0x3d'));});}}return _0x56b96d({'code':0xc8,'message':_0x3648e0});}catch(_0xd4f904){logger['error'](_0xd4f904[_0x8fd2('0x3e')]);return _0x39cd8e(_0x28f927['error'](0x1f4,_0xd4f904));}}logger[_0x8fd2('0x34')](_0x8fd2('0x3f'));return _0x39cd8e(_0x28f927[_0x8fd2('0x34')](0x1f4,_0x8fd2('0x3f')));});},'RejectMessage':function(_0xc62e9e){var _0x7984c9=this;return new Promise(function(_0x154b61,_0x34ffed){if(_0xc62e9e[_0x8fd2('0x36')]&&_0xc62e9e[_0x8fd2('0x36')]['id']){try{if(_0x2b152c[_0x8fd2('0x37')][_0xc62e9e[_0x8fd2('0x36')]['id']]){_0x2b152c[_0x8fd2('0x37')][_0xc62e9e[_0x8fd2('0x36')]['id']][_0x8fd2('0x40')]=![];_0x2b152c[_0x8fd2('0x37')][_0xc62e9e[_0x8fd2('0x36')]['id']][_0x8fd2('0x38')]=undefined;}return _0x154b61({'code':0xc8,'message':_0xc62e9e});}catch(_0x2fdbe5){logger['error'](_0x2fdbe5['stack']);return _0x34ffed(_0x7984c9[_0x8fd2('0x34')](0x1f4,_0x2fdbe5));}}logger[_0x8fd2('0x34')](_0x8fd2('0x3f'));return _0x34ffed(_0x7984c9['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x177f04){var _0x5603e9=this;return new Promise(function(_0x2f61a5,_0x1295c4){if(_0x177f04[_0x8fd2('0x1e')]&&_0x177f04['interaction']&&_0x177f04[_0x8fd2('0x14')]['id']){try{var _0x1ec30e=getId(_0x177f04['channel'],_0x177f04[_0x8fd2('0x13')]?_0x177f04[_0x8fd2('0x13')]['id']:0x0,_0x177f04[_0x8fd2('0x14')]?_0x177f04['interaction']['id']:0x0);if(_0x2b152c[_0x8fd2('0x12')][_0x1ec30e]){_0x2b152c[_0x8fd2('0x12')][_0x1ec30e][_0x8fd2('0x32')](_0x8fd2('0x39'));}return _0x2f61a5({'code':0xc8,'message':_0x177f04});}catch(_0x3101ac){logger[_0x8fd2('0x34')](_0x3101ac['stack']);return _0x1295c4(_0x5603e9['error'](0x1f4,_0x3101ac));}}logger[_0x8fd2('0x34')](_0x8fd2('0x3f'));return _0x1295c4(_0x5603e9['error'](0x1f4,_0x8fd2('0x3f')));});},'AgentCapacity':function(_0x4a176b){var _0x55d862=this;return new Promise(function(_0x2ef7e6,_0x1eca98){if(_0x2b152c[_0x8fd2('0x37')][_0x8fd2('0x41')](_0x4a176b['id'])){for(var _0x353450 in _0x4a176b[_0x8fd2('0x42')]){if(_0x4a176b['capacity'][_0x8fd2('0x41')](_0x353450)){if(_0x2b152c[_0x8fd2('0x37')][_0x4a176b['id']][_0x8fd2('0x41')](_0x353450+_0x8fd2('0x43'))){_0x2b152c[_0x8fd2('0x37')][_0x4a176b['id']][_0x353450+'CurrentCapacity']=parseInt(_0x4a176b['capacity'][_0x353450],0xa);}}}_0x2b152c['agents'][_0x4a176b['id']]['updateRealtime']();return _0x2ef7e6({'code':0xc8,'message':_0x2b152c['agents'][_0x4a176b['id']]});}else{return _0x1eca98(_0x55d862[_0x8fd2('0x34')](0x1f4,_0x8fd2('0x44')));}});},'Agents':function(_0x18ee30){return new Promise(function(_0x2988d0,_0x21696c){var _0x25abdc=_[_0x8fd2('0x45')](_0x2b152c['agents']);_0x2988d0({'count':_0x25abdc[_0x8fd2('0x17')],'rows':_0x25abdc});});},'ChatQueues':function(_0x5f0cfa){return new Promise(function(_0x351cfe,_0xdd46b1){var _0x478aad=[];for(var _0x52006b in _0x2b152c[_0x8fd2('0x46')]){if(_0x2b152c[_0x8fd2('0x46')][_0x8fd2('0x41')](_0x52006b)){var _0x30a952=_0x2b152c[_0x8fd2('0x46')][_0x52006b];var _0x5476ca={'id':_0x30a952['id'],'available':_0x30a952[_0x8fd2('0x47')],'loggedIn':_0x30a952[_0x8fd2('0x48')],'name':_0x30a952[_0x8fd2('0x49')],'paused':_0x30a952[_0x8fd2('0x4a')],'waiting':_0x30a952['waiting']};_0x478aad[_0x8fd2('0x1f')](_0x5476ca);}}_0x351cfe({'count':_0x478aad[_0x8fd2('0x17')],'rows':_0x478aad});});},'MailQueues':function(_0x3ca4b1){return new Promise(function(_0x23c608,_0x5df526){var _0x4e2b22=[];for(var _0x5e142f in _0x2b152c[_0x8fd2('0x4b')]){if(_0x2b152c[_0x8fd2('0x4b')][_0x8fd2('0x41')](_0x5e142f)){var _0x38fc47=_0x2b152c[_0x8fd2('0x4b')][_0x5e142f];var _0x47ede0={'id':_0x38fc47['id'],'available':_0x38fc47[_0x8fd2('0x47')],'loggedIn':_0x38fc47[_0x8fd2('0x48')],'name':_0x38fc47['name'],'paused':_0x38fc47[_0x8fd2('0x4a')],'waiting':_0x38fc47[_0x8fd2('0x4c')]};_0x4e2b22[_0x8fd2('0x1f')](_0x47ede0);}}_0x23c608({'count':_0x4e2b22[_0x8fd2('0x17')],'rows':_0x4e2b22});});},'OpenchannelQueues':function(_0x305d83){return new Promise(function(_0x5547c7,_0x428034){var _0x3408ff=[];for(var _0x21f1a7 in _0x2b152c[_0x8fd2('0x4d')]){if(_0x2b152c[_0x8fd2('0x4d')][_0x8fd2('0x41')](_0x21f1a7)){var _0x172933=_0x2b152c[_0x8fd2('0x4d')][_0x21f1a7];var _0x1787e4={'id':_0x172933['id'],'available':_0x172933[_0x8fd2('0x47')],'loggedIn':_0x172933[_0x8fd2('0x48')],'name':_0x172933[_0x8fd2('0x49')],'paused':_0x172933[_0x8fd2('0x4a')],'waiting':_0x172933['waiting']};_0x3408ff[_0x8fd2('0x1f')](_0x1787e4);}}_0x5547c7({'count':_0x3408ff[_0x8fd2('0x17')],'rows':_0x3408ff});});},'SmsQueues':function(_0x4b043d){return new Promise(function(_0x5c497e,_0x553fa1){var _0x2bd1d0=[];for(var _0x34a06a in _0x2b152c[_0x8fd2('0x4e')]){if(_0x2b152c[_0x8fd2('0x4e')][_0x8fd2('0x41')](_0x34a06a)){var _0x2eaa0c=_0x2b152c['smsQueues'][_0x34a06a];var _0x349e86={'id':_0x2eaa0c['id'],'available':_0x2eaa0c[_0x8fd2('0x47')],'loggedIn':_0x2eaa0c['loggedIn'],'name':_0x2eaa0c[_0x8fd2('0x49')],'paused':_0x2eaa0c['paused'],'waiting':_0x2eaa0c[_0x8fd2('0x4c')]};_0x2bd1d0[_0x8fd2('0x1f')](_0x349e86);}}_0x5c497e({'count':_0x2bd1d0[_0x8fd2('0x17')],'rows':_0x2bd1d0});});},'FaxQueues':function(_0x31e96f){return new Promise(function(_0x3df1bd,_0x4aaa16){var _0x1a1b40=[];for(var _0xfb0041 in _0x2b152c['faxQueues']){if(_0x2b152c[_0x8fd2('0x4f')]['hasOwnProperty'](_0xfb0041)){var _0x50c6a6=_0x2b152c[_0x8fd2('0x4f')][_0xfb0041];var _0x1d36d2={'id':_0x50c6a6['id'],'available':_0x50c6a6['available'],'loggedIn':_0x50c6a6[_0x8fd2('0x48')],'name':_0x50c6a6[_0x8fd2('0x49')],'paused':_0x50c6a6[_0x8fd2('0x4a')],'waiting':_0x50c6a6['waiting']};_0x1a1b40[_0x8fd2('0x1f')](_0x1d36d2);}}_0x3df1bd({'count':_0x1a1b40[_0x8fd2('0x17')],'rows':_0x1a1b40});});},'WhatsappQueues':function(_0x2d4746){return new Promise(function(_0x59f39b,_0x234800){var _0x31cb0e=[];for(var _0x33603c in _0x2b152c['whatsappQueues']){if(_0x2b152c['whatsappQueues'][_0x8fd2('0x41')](_0x33603c)){var _0xf718ec=_0x2b152c['whatsappQueues'][_0x33603c];var _0x500678={'id':_0xf718ec['id'],'available':_0xf718ec['available'],'loggedIn':_0xf718ec['loggedIn'],'name':_0xf718ec['name'],'paused':_0xf718ec[_0x8fd2('0x4a')],'waiting':_0xf718ec[_0x8fd2('0x4c')]};_0x31cb0e[_0x8fd2('0x1f')](_0x500678);}}_0x59f39b({'count':_0x31cb0e[_0x8fd2('0x17')],'rows':_0x31cb0e});});},'ChatQueuesWaitingInteractions':function(_0x1fa13a){return new Promise(function(_0x5a1c27,_0x2fba70){var _0x181634=_[_0x8fd2('0x45')](_0x2b152c['chatQueuesWaitingInteractions']);_0x5a1c27({'count':_0x181634[_0x8fd2('0x17')],'rows':_0x181634});});},'MailQueuesWaitingInteractions':function(_0x3aaf78){return new Promise(function(_0x5f163a,_0x36631b){var _0x33d05e=_[_0x8fd2('0x45')](_0x2b152c[_0x8fd2('0x50')]);_0x5f163a({'count':_0x33d05e[_0x8fd2('0x17')],'rows':_0x33d05e});});},'OpenchannelQueuesWaitingInteractions':function(_0x2fb611){return new Promise(function(_0xbeb55a,_0x5f5487){var _0x26f8b9=_[_0x8fd2('0x45')](_0x2b152c[_0x8fd2('0x51')]);_0xbeb55a({'count':_0x26f8b9[_0x8fd2('0x17')],'rows':_0x26f8b9});});},'SmsQueuesWaitingInteractions':function(_0x15747d){return new Promise(function(_0x3a83d8,_0x3e8080){var _0x5883c3=_[_0x8fd2('0x45')](_0x2b152c[_0x8fd2('0x52')]);_0x3a83d8({'count':_0x5883c3['length'],'rows':_0x5883c3});});},'FaxQueuesWaitingInteractions':function(_0x2d844e){return new Promise(function(_0x3deb1b,_0x3f8baf){var _0x131ee8=_[_0x8fd2('0x45')](_0x2b152c[_0x8fd2('0x53')]);_0x3deb1b({'count':_0x131ee8[_0x8fd2('0x17')],'rows':_0x131ee8});});},'WhatsappQueuesWaitingInteractions':function(_0x2a0c4){return new Promise(function(_0x52de20,_0x9c765d){var _0x5891bb=_['values'](_0x2b152c['whatsappQueuesWaitingInteractions']);_0x52de20({'count':_0x5891bb[_0x8fd2('0x17')],'rows':_0x5891bb});});}};var _0x58b0fa=jayson[_0x8fd2('0x54')](_0x725d57)['http']();_0x58b0fa['on']('error',function(_0x1d6bdb){logger[_0x8fd2('0x34')](JSON['stringify'](_0x1d6bdb));return _0x6b8ef(_0x1d6bdb);});_0x58b0fa[_0x8fd2('0x11')](0x232c,_0x8fd2('0x55'),function(){console[_0x8fd2('0x56')](_0x8fd2('0x57'),0x232c);return _0x118329('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xc818=['openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','channel','message','interaction','applications','length','existsSync','app','appdata','split','mail','push','slice','join','dialogflow','dialogflowv2','amazonlex','tag','TagId','./interval','condition','intervals','./applications/','consequence','priority','info','\x20|\x20','error','rules','Applications\x20executed','stringify','matchPath','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busyQueue','emit','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','mailQueues','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions'];(function(_0x1d2510,_0x215e17){var _0x55f9e9=function(_0x49cf5){while(--_0x49cf5){_0x1d2510['push'](_0x1d2510['shift']());}};_0x55f9e9(++_0x215e17);}(_0xc818,0x1e3));var _0x8c81=function(_0x4cbfc3,_0x3c95a4){_0x4cbfc3=_0x4cbfc3-0x0;var _0x598611=_0xc818[_0x4cbfc3];return _0x598611;};'use strict';var _=require(_0x8c81('0x0'));var util=require(_0x8c81('0x1'));var path=require(_0x8c81('0x2'));var fs=require('fs');var jayson=require(_0x8c81('0x3'));var BPromise=require('bluebird');var uuid=require(_0x8c81('0x4'));var config=require(_0x8c81('0x5'));var logger=require(_0x8c81('0x6'))(_0x8c81('0x7'));var rpc={'openchannelQueueReport':require(_0x8c81('0x8')),'mailQueueReport':require(_0x8c81('0x9')),'chatQueueReport':require(_0x8c81('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x8c81('0xb')),'whatsappQueueReport':require(_0x8c81('0xc'))};var RuleEngine=require(_0x8c81('0xd'));function getId(_0x43d142,_0x501240,_0x1173cf){return util[_0x8c81('0xe')](_0x8c81('0xf'),_0x43d142,_0x501240||0x0,_0x1173cf||0x0);}function getIntervals(_0x15ebff,_0x1b4523){var _0x2ce097=[];if(!_[_0x8c81('0x10')](_0x1b4523['IntervalId'])&&!_[_0x8c81('0x10')](_0x15ebff[_0x1b4523[_0x8c81('0x11')]])&&!_[_0x8c81('0x10')](_0x15ebff[_0x1b4523[_0x8c81('0x11')]]['Intervals'])){_0x2ce097=_[_0x8c81('0x12')](_0x15ebff[_0x1b4523[_0x8c81('0x11')]][_0x8c81('0x13')],_0x8c81('0x14'));}else if(!_[_0x8c81('0x10')](_0x1b4523[_0x8c81('0x14')])){_0x2ce097=[_0x1b4523[_0x8c81('0x14')]];}return _0x2ce097;}exports[_0x8c81('0x15')]=function(_0x1500cc){_0x1500cc['rules']={};return new BPromise(function(_0x4bb8ee,_0x1db769){var _0x1df3ac={'Start':function(_0x238ce5){var _0x4fa5=this;return new Promise(function(_0xf1682e,_0x3e59e3){if(_0x238ce5){try{var _0x4f7180=[];var _0x3683f0=getId(_0x238ce5[_0x8c81('0x16')],_0x238ce5[_0x8c81('0x17')]?_0x238ce5[_0x8c81('0x17')]['id']:0x0,_0x238ce5[_0x8c81('0x18')]?_0x238ce5['interaction']['id']:0x0);if(_0x238ce5[_0x8c81('0x19')]&&_['isArray'](_0x238ce5['applications'])&&_0x238ce5['applications'][_0x8c81('0x1a')]){for(var _0x13e312=0x0;_0x13e312<_0x238ce5[_0x8c81('0x19')]['length'];_0x13e312+=0x1){var _0x2bf715=_0x238ce5[_0x8c81('0x19')][_0x13e312];if(fs[_0x8c81('0x1b')](path['join'](__dirname,_0x8c81('0x19'),_0x2bf715[_0x8c81('0x1c')]+'.js'))){var _0x35d61a=[];switch(_0x2bf715[_0x8c81('0x1c')]['toLowerCase']()){case'autoreply':var _0x39fc0e=_0x2bf715[_0x8c81('0x1d')][_0x8c81('0x1e')](',');if(_0x238ce5['channel']===_0x8c81('0x1f')){_0x35d61a[_0x8c81('0x20')](_0x39fc0e[0x0]);_0x35d61a[_0x8c81('0x20')](_0x39fc0e[0x1]);_0x35d61a[_0x8c81('0x20')](_0x39fc0e[_0x8c81('0x21')](0x2,_0x39fc0e[_0x8c81('0x1a')])[_0x8c81('0x22')](','));}else{_0x35d61a[_0x8c81('0x20')](_0x39fc0e[0x0]);_0x35d61a['push'](_0x39fc0e['slice'](0x1,_0x39fc0e[_0x8c81('0x1a')])[_0x8c81('0x22')](','));}break;case _0x8c81('0x23'):var _0x21bf77=_0x2bf715[_0x8c81('0x1d')][_0x8c81('0x1e')](',');_0x35d61a[_0x8c81('0x20')](_0x21bf77[0x0]);_0x35d61a[_0x8c81('0x20')](_0x21bf77[0x1]);_0x35d61a[_0x8c81('0x20')](_0x21bf77[_0x8c81('0x21')](0x2,_0x21bf77[_0x8c81('0x1a')])[_0x8c81('0x22')](','));break;case _0x8c81('0x24'):var _0x59c7e8=_0x2bf715[_0x8c81('0x1d')][_0x8c81('0x1e')](',');_0x35d61a[_0x8c81('0x20')](_0x59c7e8[0x0]);_0x35d61a[_0x8c81('0x20')](_0x59c7e8[0x1]);_0x35d61a[_0x8c81('0x20')](_0x59c7e8[0x2]);_0x35d61a[_0x8c81('0x20')](_0x59c7e8[0x3]);_0x35d61a[_0x8c81('0x20')](_0x59c7e8[_0x8c81('0x21')](0x4,_0x59c7e8[_0x8c81('0x1a')])['join'](','));break;case _0x8c81('0x25'):var _0x1a632a=_0x2bf715[_0x8c81('0x1d')][_0x8c81('0x1e')](',');_0x35d61a[_0x8c81('0x20')](_0x1a632a[0x0]);_0x35d61a['push'](_0x1a632a[0x1]);_0x35d61a[_0x8c81('0x20')](_0x1a632a[0x2]);_0x35d61a[_0x8c81('0x20')](_0x1a632a[0x3]);_0x35d61a[_0x8c81('0x20')](_0x1a632a[_0x8c81('0x21')](0x4,_0x1a632a[_0x8c81('0x1a')])['join'](','));break;case'message':_0x35d61a[_0x8c81('0x20')](_0x2bf715[_0x8c81('0x1d')]);break;case _0x8c81('0x26'):_0x35d61a['push'](_0x2bf715[_0x8c81('0x27')]);_0x35d61a[_0x8c81('0x20')](_0x2bf715[_0x8c81('0x1d')]);break;default:_0x35d61a=_[_0x8c81('0x10')](_0x2bf715['appdata'])?[]:_0x2bf715[_0x8c81('0x1d')][_0x8c81('0x1e')](',');}var _0x543310={'id':util[_0x8c81('0xe')]('%s:%s:%s',_0x3683f0,_0x2bf715['id'],_0x2bf715['app']),'condition':require(_0x8c81('0x28'))[_0x8c81('0x29')](_0x3683f0,getIntervals(_0x1500cc[_0x8c81('0x2a')],_0x2bf715),_0x1500cc),'consequence':require(_0x8c81('0x2b')+_0x2bf715['app'])[_0x8c81('0x2c')](_0x3683f0,_0x35d61a,_0x1500cc,_0x238ce5),'p':_0x2bf715[_0x8c81('0x2d')]||0x0};logger[_0x8c81('0x2e')]('Push\x20new\x20rule',_0x543310['id'],'on\x20interval',getIntervals(_0x1500cc[_0x8c81('0x2a')],_0x2bf715)[_0x8c81('0x22')](_0x8c81('0x2f')));_0x4f7180['push'](_0x543310);}else{logger[_0x8c81('0x30')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x2bf715[_0x8c81('0x1c')]+'.js'));}}_0x1500cc[_0x8c81('0x31')][_0x3683f0]=new RuleEngine(_0x4f7180);_0x1500cc['rules'][_0x3683f0]['execute'](_0x238ce5,function(_0x20514d){logger[_0x8c81('0x2e')](_0x8c81('0x32'),JSON[_0x8c81('0x33')](_0x20514d[_0x8c81('0x34')]));if(_0x1500cc[_0x8c81('0x31')][_0x3683f0]){_0x1500cc[_0x8c81('0x31')][_0x3683f0]['emit'](_0x8c81('0x35'));}});return _0xf1682e({'code':0xc8,'message':_0x238ce5});}else{logger[_0x8c81('0x2e')](_0x8c81('0x36'));return _0xf1682e({'code':0xc8,'message':_0x238ce5});}}catch(_0x41f9d2){logger[_0x8c81('0x30')](_0x41f9d2['stack']);return _0x3e59e3(_0x4fa5[_0x8c81('0x30')](0x1f4,_0x41f9d2));}}return _0x3e59e3(_0x8c81('0x37'));});},'AcceptMessage':function(_0x2d2f6c){var _0x225955=this;return new Promise(function(_0x1cffdf,_0x2a2b97){if(_0x2d2f6c[_0x8c81('0x38')]&&_0x2d2f6c[_0x8c81('0x38')]['id']){if(_0x1500cc[_0x8c81('0x39')][_0x2d2f6c[_0x8c81('0x38')]['id']]){_0x1500cc[_0x8c81('0x39')][_0x2d2f6c[_0x8c81('0x38')]['id']]['busy']=![];_0x1500cc['agents'][_0x2d2f6c[_0x8c81('0x38')]['id']][_0x8c81('0x3a')]=undefined;}}if(_0x2d2f6c[_0x8c81('0x17')]&&_0x2d2f6c[_0x8c81('0x17')]['id']){try{var _0x21f365=getId(_0x2d2f6c[_0x8c81('0x16')],_0x2d2f6c[_0x8c81('0x17')]?_0x2d2f6c['message']['id']:0x0,_0x2d2f6c['interaction']?_0x2d2f6c[_0x8c81('0x18')]['id']:0x0);if(_0x1500cc[_0x8c81('0x31')][_0x21f365]){_0x1500cc[_0x8c81('0x31')][_0x21f365][_0x8c81('0x3b')](_0x8c81('0x3c'));if(rpc[_0x2d2f6c[_0x8c81('0x16')]+_0x8c81('0x3d')]){rpc[_0x2d2f6c['channel']+_0x8c81('0x3d')][_0x8c81('0x3e')](_0x21f365,{'UserId':_0x2d2f6c[_0x8c81('0x17')][_0x8c81('0x3f')]})['catch'](function(_0x5cd160){logger[_0x8c81('0x30')](_0x8c81('0x40'));});}}return _0x1cffdf({'code':0xc8,'message':_0x2d2f6c});}catch(_0x1c7167){logger[_0x8c81('0x30')](_0x1c7167[_0x8c81('0x41')]);return _0x2a2b97(_0x225955[_0x8c81('0x30')](0x1f4,_0x1c7167));}}logger[_0x8c81('0x30')](_0x8c81('0x42'));return _0x2a2b97(_0x225955[_0x8c81('0x30')](0x1f4,_0x8c81('0x42')));});},'RejectMessage':function(_0x9a46e5){var _0x276713=this;return new Promise(function(_0x3386df,_0x459cdb){if(_0x9a46e5[_0x8c81('0x38')]&&_0x9a46e5[_0x8c81('0x38')]['id']){try{if(_0x1500cc[_0x8c81('0x39')][_0x9a46e5[_0x8c81('0x38')]['id']]){_0x1500cc[_0x8c81('0x39')][_0x9a46e5[_0x8c81('0x38')]['id']][_0x8c81('0x43')]=![];_0x1500cc['agents'][_0x9a46e5[_0x8c81('0x38')]['id']][_0x8c81('0x3a')]=undefined;}return _0x3386df({'code':0xc8,'message':_0x9a46e5});}catch(_0x5c21f0){logger[_0x8c81('0x30')](_0x5c21f0[_0x8c81('0x41')]);return _0x459cdb(_0x276713[_0x8c81('0x30')](0x1f4,_0x5c21f0));}}logger['error'](_0x8c81('0x42'));return _0x459cdb(_0x276713[_0x8c81('0x30')](0x1f4,_0x8c81('0x42')));});},'AbandonInteraction':function(_0x510fa5){var _0x51280e=this;return new Promise(function(_0x364343,_0x3f1d4c){if(_0x510fa5[_0x8c81('0x16')]&&_0x510fa5['interaction']&&_0x510fa5[_0x8c81('0x18')]['id']){try{var _0xc4fa7e=getId(_0x510fa5[_0x8c81('0x16')],_0x510fa5[_0x8c81('0x17')]?_0x510fa5[_0x8c81('0x17')]['id']:0x0,_0x510fa5[_0x8c81('0x18')]?_0x510fa5[_0x8c81('0x18')]['id']:0x0);if(_0x1500cc[_0x8c81('0x31')][_0xc4fa7e]){_0x1500cc['rules'][_0xc4fa7e]['emit'](_0x8c81('0x3c'));}return _0x364343({'code':0xc8,'message':_0x510fa5});}catch(_0x3511dd){logger[_0x8c81('0x30')](_0x3511dd[_0x8c81('0x41')]);return _0x3f1d4c(_0x51280e['error'](0x1f4,_0x3511dd));}}logger[_0x8c81('0x30')](_0x8c81('0x42'));return _0x3f1d4c(_0x51280e[_0x8c81('0x30')](0x1f4,_0x8c81('0x42')));});},'AgentCapacity':function(_0x11f513){var _0x1f05b3=this;return new Promise(function(_0x4eadf0,_0x1be480){if(_0x1500cc['agents'][_0x8c81('0x44')](_0x11f513['id'])){for(var _0x37f7a7 in _0x11f513[_0x8c81('0x45')]){if(_0x11f513['capacity']['hasOwnProperty'](_0x37f7a7)){if(_0x1500cc[_0x8c81('0x39')][_0x11f513['id']][_0x8c81('0x44')](_0x37f7a7+_0x8c81('0x46'))){_0x1500cc[_0x8c81('0x39')][_0x11f513['id']][_0x37f7a7+_0x8c81('0x46')]=parseInt(_0x11f513[_0x8c81('0x45')][_0x37f7a7],0xa);}}}_0x1500cc[_0x8c81('0x39')][_0x11f513['id']][_0x8c81('0x47')]();return _0x4eadf0({'code':0xc8,'message':_0x1500cc[_0x8c81('0x39')][_0x11f513['id']]});}else{return _0x1be480(_0x1f05b3[_0x8c81('0x30')](0x1f4,_0x8c81('0x48')));}});},'Agents':function(_0x30d6df){return new Promise(function(_0x1ba2f3,_0x5b115b){var _0x11ef7a=_[_0x8c81('0x49')](_0x1500cc[_0x8c81('0x39')]);_0x1ba2f3({'count':_0x11ef7a[_0x8c81('0x1a')],'rows':_0x11ef7a});});},'ChatQueues':function(_0x71b641){return new Promise(function(_0x563ad9,_0x214def){var _0x197c46=[];for(var _0x2a420a in _0x1500cc[_0x8c81('0x4a')]){if(_0x1500cc[_0x8c81('0x4a')][_0x8c81('0x44')](_0x2a420a)){var _0x45f92e=_0x1500cc[_0x8c81('0x4a')][_0x2a420a];var _0x4ec178={'id':_0x45f92e['id'],'available':_0x45f92e[_0x8c81('0x4b')],'loggedIn':_0x45f92e[_0x8c81('0x4c')],'name':_0x45f92e[_0x8c81('0x4d')],'paused':_0x45f92e['paused'],'waiting':_0x45f92e['waiting']};_0x197c46['push'](_0x4ec178);}}_0x563ad9({'count':_0x197c46[_0x8c81('0x1a')],'rows':_0x197c46});});},'MailQueues':function(_0x12279a){return new Promise(function(_0x4cfb2e,_0x7dfe1a){var _0x369162=[];for(var _0x58b78b in _0x1500cc['mailQueues']){if(_0x1500cc['mailQueues'][_0x8c81('0x44')](_0x58b78b)){var _0x2e5efd=_0x1500cc[_0x8c81('0x4e')][_0x58b78b];var _0x12a086={'id':_0x2e5efd['id'],'available':_0x2e5efd['available'],'loggedIn':_0x2e5efd[_0x8c81('0x4c')],'name':_0x2e5efd['name'],'paused':_0x2e5efd[_0x8c81('0x4f')],'waiting':_0x2e5efd[_0x8c81('0x50')]};_0x369162[_0x8c81('0x20')](_0x12a086);}}_0x4cfb2e({'count':_0x369162[_0x8c81('0x1a')],'rows':_0x369162});});},'OpenchannelQueues':function(_0x5bfe85){return new Promise(function(_0x916c1,_0x1d69d4){var _0x35a042=[];for(var _0x306a66 in _0x1500cc[_0x8c81('0x51')]){if(_0x1500cc[_0x8c81('0x51')][_0x8c81('0x44')](_0x306a66)){var _0x55d5b0=_0x1500cc[_0x8c81('0x51')][_0x306a66];var _0x2bce9e={'id':_0x55d5b0['id'],'available':_0x55d5b0[_0x8c81('0x4b')],'loggedIn':_0x55d5b0[_0x8c81('0x4c')],'name':_0x55d5b0[_0x8c81('0x4d')],'paused':_0x55d5b0[_0x8c81('0x4f')],'waiting':_0x55d5b0[_0x8c81('0x50')]};_0x35a042['push'](_0x2bce9e);}}_0x916c1({'count':_0x35a042['length'],'rows':_0x35a042});});},'SmsQueues':function(_0x13788c){return new Promise(function(_0xe1d855,_0x308d8d){var _0x59c533=[];for(var _0x2e35ba in _0x1500cc[_0x8c81('0x52')]){if(_0x1500cc[_0x8c81('0x52')][_0x8c81('0x44')](_0x2e35ba)){var _0x3157a3=_0x1500cc[_0x8c81('0x52')][_0x2e35ba];var _0x33c0d2={'id':_0x3157a3['id'],'available':_0x3157a3['available'],'loggedIn':_0x3157a3[_0x8c81('0x4c')],'name':_0x3157a3[_0x8c81('0x4d')],'paused':_0x3157a3['paused'],'waiting':_0x3157a3[_0x8c81('0x50')]};_0x59c533['push'](_0x33c0d2);}}_0xe1d855({'count':_0x59c533[_0x8c81('0x1a')],'rows':_0x59c533});});},'FaxQueues':function(_0x285002){return new Promise(function(_0x529b78,_0x2d3fa2){var _0x40f800=[];for(var _0x1b435a in _0x1500cc['faxQueues']){if(_0x1500cc[_0x8c81('0x53')][_0x8c81('0x44')](_0x1b435a)){var _0x15e71a=_0x1500cc[_0x8c81('0x53')][_0x1b435a];var _0x441036={'id':_0x15e71a['id'],'available':_0x15e71a[_0x8c81('0x4b')],'loggedIn':_0x15e71a['loggedIn'],'name':_0x15e71a['name'],'paused':_0x15e71a[_0x8c81('0x4f')],'waiting':_0x15e71a['waiting']};_0x40f800['push'](_0x441036);}}_0x529b78({'count':_0x40f800[_0x8c81('0x1a')],'rows':_0x40f800});});},'WhatsappQueues':function(_0x3236f8){return new Promise(function(_0x16e48d,_0x16b56){var _0x467ba0=[];for(var _0x3984a4 in _0x1500cc[_0x8c81('0x54')]){if(_0x1500cc['whatsappQueues']['hasOwnProperty'](_0x3984a4)){var _0x4dedd4=_0x1500cc['whatsappQueues'][_0x3984a4];var _0x5762db={'id':_0x4dedd4['id'],'available':_0x4dedd4[_0x8c81('0x4b')],'loggedIn':_0x4dedd4[_0x8c81('0x4c')],'name':_0x4dedd4[_0x8c81('0x4d')],'paused':_0x4dedd4[_0x8c81('0x4f')],'waiting':_0x4dedd4[_0x8c81('0x50')]};_0x467ba0['push'](_0x5762db);}}_0x16e48d({'count':_0x467ba0[_0x8c81('0x1a')],'rows':_0x467ba0});});},'ChatQueuesWaitingInteractions':function(_0x58a7e1){return new Promise(function(_0x34e82f,_0x22a4aa){var _0x198c48=_[_0x8c81('0x49')](_0x1500cc[_0x8c81('0x55')]);_0x34e82f({'count':_0x198c48['length'],'rows':_0x198c48});});},'MailQueuesWaitingInteractions':function(_0x3d88d0){return new Promise(function(_0x33c6f3,_0x2d2dfd){var _0x37d735=_[_0x8c81('0x49')](_0x1500cc[_0x8c81('0x56')]);_0x33c6f3({'count':_0x37d735['length'],'rows':_0x37d735});});},'OpenchannelQueuesWaitingInteractions':function(_0x12bfcb){return new Promise(function(_0x29adbf,_0x1a7d79){var _0x37e501=_[_0x8c81('0x49')](_0x1500cc[_0x8c81('0x57')]);_0x29adbf({'count':_0x37e501[_0x8c81('0x1a')],'rows':_0x37e501});});},'SmsQueuesWaitingInteractions':function(_0x20c03d){return new Promise(function(_0x16c50c,_0x4529e2){var _0x36a06f=_[_0x8c81('0x49')](_0x1500cc[_0x8c81('0x58')]);_0x16c50c({'count':_0x36a06f[_0x8c81('0x1a')],'rows':_0x36a06f});});},'FaxQueuesWaitingInteractions':function(_0x1bd269){return new Promise(function(_0x51434a,_0x3a0590){var _0x417163=_[_0x8c81('0x49')](_0x1500cc[_0x8c81('0x59')]);_0x51434a({'count':_0x417163[_0x8c81('0x1a')],'rows':_0x417163});});},'WhatsappQueuesWaitingInteractions':function(_0x1f5902){return new Promise(function(_0x5b5a46,_0x175aa1){var _0x3f8183=_['values'](_0x1500cc[_0x8c81('0x5a')]);_0x5b5a46({'count':_0x3f8183['length'],'rows':_0x3f8183});});}};var _0x4522e0=jayson[_0x8c81('0x5b')](_0x1df3ac)['http']();_0x4522e0['on'](_0x8c81('0x30'),function(_0x958128){logger['error'](JSON['stringify'](_0x958128));return _0x1db769(_0x958128);});_0x4522e0[_0x8c81('0x15')](0x232c,'127.0.0.1',function(){console[_0x8c81('0x5c')](_0x8c81('0x5d'),0x232c);return _0x4bb8ee(_0x8c81('0x5e')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index f508be7..8676494 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 _0x3d79=['indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','util','bluebird','lodash','../../../config/logger','routing','http','request','then','error','result','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d79,0x121));var _0x93d7=function(_0x1b9af1,_0x1fdb0c){_0x1b9af1=_0x1b9af1-0x0;var _0x3acd26=_0x3d79[_0x1b9af1];return _0x3acd26;};'use strict';var util=require(_0x93d7('0x0'));var BPromise=require(_0x93d7('0x1'));var jayson=require('jayson/promise');var _=require(_0x93d7('0x2'));var logger=require(_0x93d7('0x3'))(_0x93d7('0x4'));var client=jayson['client'][_0x93d7('0x5')]({'port':0x232a});function request(_0x36359b,_0xad9bba){return new BPromise(function(_0x486ab6,_0x31a6e5){return client[_0x93d7('0x6')](_0x36359b,_0xad9bba)[_0x93d7('0x7')](function(_0x2c35ce){if(_0x2c35ce['error']){return _0x31a6e5(_0x2c35ce[_0x93d7('0x8')]['message']);}else{return _0x486ab6(_0x2c35ce[_0x93d7('0x9')]);}})['catch'](function(_0x4463e5){return _0x31a6e5(_0x4463e5);});});}exports[_0x93d7('0xa')]=function(_0x30cd47,_0x2bb0b7,_0x3edc79){return function(_0x5a8664){if(_0x3edc79[_0x93d7('0xb')]&&!_0x3edc79['rules'][_0x30cd47]){logger['info'](_0x93d7('0xc'),_0x30cd47);return _0x5a8664[_0x93d7('0xd')]();}var _0x2141f5=[];for(var _0x5dcc63=0x0;_0x5dcc63<_0x2bb0b7[_0x93d7('0xe')];_0x5dcc63+=0x1){_0x2141f5['push'](request(_0x93d7('0xf'),{'command':util[_0x93d7('0x10')](_0x93d7('0x11'),_0x2bb0b7[_0x5dcc63])})[_0x93d7('0x7')](function(_0x4f88c9){return _0x4f88c9&&_0x4f88c9[_0x93d7('0x12')]&&_0x4f88c9['message'][_0x93d7('0x13')](_0x93d7('0x14'))>=0x0?!![]:![];})['catch'](function(_0x1e9612){logger[_0x93d7('0x8')](_0x93d7('0x15'),_0x30cd47,_0x2bb0b7[_0x5dcc63]);}));}BPromise[_0x93d7('0x16')](_0x2141f5)['then'](function(_0xdffc25){var _0x329bf5=_[_0x93d7('0x17')](_0xdffc25);logger[_0x93d7('0x18')](_0x93d7('0x19'),_0x30cd47,_0x2bb0b7[_0x93d7('0x1a')](_0x93d7('0x1b')),_0x329bf5);_0x5a8664['when'](_0x329bf5);})['catch'](function(_0x3b49e7){console['log'](_0x3b49e7);logger[_0x93d7('0x8')](_0x93d7('0x19'),_0x30cd47,_0x2bb0b7[_0x93d7('0x1a')](_0x93d7('0x1b')),_0x3b49e7['stack']);_0x5a8664['stop']();});};}; \ No newline at end of file +var _0x9c19=['[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','iftime\x20%s','then','true','all','some','info','join','\x20|\x20','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','error','message','result','catch','condition','rules'];(function(_0x4956f2,_0xb602ca){var _0x1da579=function(_0x32166c){while(--_0x32166c){_0x4956f2['push'](_0x4956f2['shift']());}};_0x1da579(++_0xb602ca);}(_0x9c19,0xd2));var _0x99c1=function(_0x595324,_0x5c25fc){_0x595324=_0x595324-0x0;var _0x506510=_0x9c19[_0x595324];return _0x506510;};'use strict';var util=require(_0x99c1('0x0'));var BPromise=require(_0x99c1('0x1'));var jayson=require(_0x99c1('0x2'));var _=require(_0x99c1('0x3'));var logger=require(_0x99c1('0x4'))(_0x99c1('0x5'));var client=jayson[_0x99c1('0x6')]['http']({'port':0x232a});function request(_0x4a704c,_0x4479db){return new BPromise(function(_0x4b0b4a,_0x4ad7f6){return client[_0x99c1('0x7')](_0x4a704c,_0x4479db)['then'](function(_0x38799){if(_0x38799[_0x99c1('0x8')]){return _0x4ad7f6(_0x38799['error'][_0x99c1('0x9')]);}else{return _0x4b0b4a(_0x38799[_0x99c1('0xa')]);}})[_0x99c1('0xb')](function(_0x1db8b6){return _0x4ad7f6(_0x1db8b6);});});}exports[_0x99c1('0xc')]=function(_0xbc31ae,_0x43914e,_0x544ff3){return function(_0x26851b){if(_0x544ff3[_0x99c1('0xd')]&&!_0x544ff3[_0x99c1('0xd')][_0xbc31ae]){logger['info'](_0x99c1('0xe'),_0xbc31ae);return _0x26851b['stop']();}var _0x4b3103=[];for(var _0x249cae=0x0;_0x249cae<_0x43914e[_0x99c1('0xf')];_0x249cae+=0x1){_0x4b3103[_0x99c1('0x10')](request(_0x99c1('0x11'),{'command':util['format'](_0x99c1('0x12'),_0x43914e[_0x249cae])})[_0x99c1('0x13')](function(_0x18aa8d){return _0x18aa8d&&_0x18aa8d[_0x99c1('0x9')]&&_0x18aa8d[_0x99c1('0x9')]['indexOf'](_0x99c1('0x14'))>=0x0?!![]:![];})[_0x99c1('0xb')](function(_0x1e15da){logger[_0x99c1('0x8')]('[%s][INTERVAL]\x20%s',_0xbc31ae,_0x43914e[_0x249cae]);}));}BPromise[_0x99c1('0x15')](_0x4b3103)[_0x99c1('0x13')](function(_0x54e36f){var _0x188c3c=_[_0x99c1('0x16')](_0x54e36f);logger[_0x99c1('0x17')]('[%s][INTERVAL]\x20%s\x20%s',_0xbc31ae,_0x43914e[_0x99c1('0x18')]('\x20|\x20'),_0x188c3c);_0x26851b['when'](_0x188c3c);})[_0x99c1('0xb')](function(_0x26c707){console['log'](_0x26c707);logger[_0x99c1('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0xbc31ae,_0x43914e[_0x99c1('0x18')](_0x99c1('0x19')),_0x26c707[_0x99c1('0x1a')]);_0x26851b[_0x99c1('0x1b')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 426bb19..bc70f87 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 _0x16cc=['channel','queue','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','holdtime','ringtime','push','error','forIn','[%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','connectedlinename','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','reason','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','clone','calleridnum','calleridname','secondtransfererlinkedid','transfer','transfertype','ATTENDED','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','rejected','splice','agentcompleteAt','diffTime','complete','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','info','format','uniqueid'];(function(_0x176d4a,_0x3f14e0){var _0x44b481=function(_0x5c2209){while(--_0x5c2209){_0x176d4a['push'](_0x176d4a['shift']());}};_0x44b481(++_0x3f14e0);}(_0x16cc,0x1dc));var _0xc16c=function(_0x4591ed,_0x114736){_0x4591ed=_0x4591ed-0x0;var _0x1f9efc=_0x16cc[_0x4591ed];return _0x1f9efc;};'use strict';var _=require(_0xc16c('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x45c015,_0x56f755){utils[_0xc16c('0x1')](util[_0xc16c('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x45c015[_0xc16c('0x3')],_0x45c015[_0xc16c('0x4')],_0x45c015[_0xc16c('0x5')],_0x45c015['membername'],_0x45c015['interface'],_0x45c015['calleridnum'],_0x45c015['connectedlinenum'],_0x45c015[_0xc16c('0x6')]));if(_0x45c015[_0xc16c('0x5')]){utils[_0xc16c('0x7')](_0x45c015[_0xc16c('0x5')])['then'](function(_0x265fc3){if(_0x265fc3){_0x45c015[_0xc16c('0x8')]=_0x265fc3[_0xc16c('0x8')];_0x45c015[_0xc16c('0x9')]=_0x45c015[_0xc16c('0xa')]?_0x265fc3[_0xc16c('0xb')]:![];_0x45c015[_0xc16c('0xc')]=_0x45c015[_0xc16c('0x9')]?_0x265fc3['acwTimeout']:0x0;}utils[_0xc16c('0xd')](_0xc16c('0xe'),_0x45c015);});}else{utils[_0xc16c('0xd')]('CreateVoiceAgentReport',_0x45c015);}if(_0x56f755){delete transfers[_0x45c015[_0xc16c('0x3')]];}else{delete agents[_0x45c015[_0xc16c('0xf')]];}}exports['agentcalled']=function(_0x35bad0){try{utils['debug'](util[_0xc16c('0x2')](_0xc16c('0x10'),_0x35bad0[_0xc16c('0x3')]),_0x35bad0);agents[_0x35bad0[_0xc16c('0xf')]]=_0x35bad0;agents[_0x35bad0['destuniqueid']][_0xc16c('0x11')]=utils[_0xc16c('0x12')]();agents[_0x35bad0['destuniqueid']][_0xc16c('0x6')]=_0xc16c('0x13');agents[_0x35bad0[_0xc16c('0xf')]][_0xc16c('0x14')]=null;agents[_0x35bad0['destuniqueid']]['connectedlinename']=null;utils[_0xc16c('0x1')](util[_0xc16c('0x2')](_0xc16c('0x15'),_0x35bad0[_0xc16c('0x3')],agents[_0x35bad0[_0xc16c('0xf')]][_0xc16c('0x16')],_0x35bad0[_0xc16c('0xf')]));}catch(_0x4d90ab){utils['error'](util[_0xc16c('0x2')](_0xc16c('0x10'),_0x35bad0['uniqueid']),_0x4d90ab);}};exports[_0xc16c('0x17')]=function(_0x1e0e7a){try{if(!_[_0xc16c('0x18')](agents[_0x1e0e7a[_0xc16c('0xf')]])){utils[_0xc16c('0x19')](util[_0xc16c('0x2')](_0xc16c('0x1a'),_0x1e0e7a[_0xc16c('0x3')]),_0x1e0e7a);utils['info'](util[_0xc16c('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1e0e7a[_0xc16c('0x3')],agents[_0x1e0e7a['destuniqueid']][_0xc16c('0x16')],_0x1e0e7a[_0xc16c('0xf')]));agents[_0x1e0e7a[_0xc16c('0xf')]][_0xc16c('0x17')]=!![];agents[_0x1e0e7a[_0xc16c('0xf')]][_0xc16c('0x1b')]=utils['now']();agents[_0x1e0e7a[_0xc16c('0xf')]][_0xc16c('0x6')]=_0xc16c('0x1c');agents[_0x1e0e7a[_0xc16c('0xf')]]['reason']=_0xc16c('0x1c');agents[_0x1e0e7a[_0xc16c('0xf')]][_0xc16c('0x1d')]=_0x1e0e7a[_0xc16c('0x1e')]?parseInt(_0x1e0e7a[_0xc16c('0x1e')])/0x3e8:0x0;agents[_0x1e0e7a[_0xc16c('0xf')]]['talktime']=0x0;unanswered[_0xc16c('0x1f')](_0x1e0e7a[_0xc16c('0xf')]);}}catch(_0x4802ca){utils[_0xc16c('0x20')](util[_0xc16c('0x2')](_0xc16c('0x1a'),_0x1e0e7a[_0xc16c('0x3')]),_0x4802ca);}};exports['queuecallerabandon']=function(_0x12e3d9){try{_[_0xc16c('0x21')](agents,function(_0x57f7f4,_0x3e942d){if(_0x57f7f4[_0xc16c('0x3')]==_0x12e3d9[_0xc16c('0x3')]&&!_['includes'](unanswered,_0x57f7f4[_0xc16c('0xf')])){utils['debug'](util[_0xc16c('0x2')](_0xc16c('0x22'),_0x12e3d9['uniqueid']),_0x12e3d9);utils[_0xc16c('0x1')](util[_0xc16c('0x2')](_0xc16c('0x23'),_0x12e3d9[_0xc16c('0x3')],_0x57f7f4[_0xc16c('0x16')],_0x57f7f4[_0xc16c('0xf')]));_0x57f7f4['agentringnoanswer']=!![];_0x57f7f4[_0xc16c('0x1b')]=utils[_0xc16c('0x12')]();_0x57f7f4[_0xc16c('0x6')]=_0xc16c('0x24');_0x57f7f4['reason']='abandoned';_0x57f7f4[_0xc16c('0x1d')]=_0x12e3d9[_0xc16c('0x1d')];_0x57f7f4['talktime']=0x0;writeDB(_0x57f7f4);}});}catch(_0xc3b84b){utils[_0xc16c('0x20')](util[_0xc16c('0x2')](_0xc16c('0x22'),_0x12e3d9[_0xc16c('0x3')]),_0xc3b84b);}};exports['agentconnect']=function(_0x4becb5){try{if(agents[_0x4becb5[_0xc16c('0xf')]]){utils[_0xc16c('0x19')](util[_0xc16c('0x2')](_0xc16c('0x25'),_0x4becb5[_0xc16c('0x3')]),_0x4becb5);utils[_0xc16c('0x1')](util[_0xc16c('0x2')](_0xc16c('0x26'),_0x4becb5[_0xc16c('0x3')],agents[_0x4becb5['destuniqueid']]['membername'],_0x4becb5[_0xc16c('0xf')]));agents[_0x4becb5[_0xc16c('0xf')]][_0xc16c('0x27')]=utils['now']();agents[_0x4becb5[_0xc16c('0xf')]][_0xc16c('0x14')]=_0x4becb5[_0xc16c('0x14')];agents[_0x4becb5[_0xc16c('0xf')]]['connectedlinename']=_0x4becb5[_0xc16c('0x28')];agents[_0x4becb5['destuniqueid']][_0xc16c('0x1d')]=_0x4becb5[_0xc16c('0x1e')];agents[_0x4becb5['destuniqueid']][_0xc16c('0x6')]=_0xc16c('0x29');_[_0xc16c('0x21')](agents,function(_0x544800,_0x4ee3d4){if(_0x544800['destuniqueid']!=_0x4becb5['destuniqueid']&&_0x544800['uniqueid']==_0x4becb5[_0xc16c('0x3')]){_0x544800[_0xc16c('0x2a')]=0x0;_0x544800[_0xc16c('0x1d')]=_0x4becb5['ringtime'];_0x544800[_0xc16c('0x17')]=!![];_0x544800[_0xc16c('0x1b')]=utils['now']();_0x544800[_0xc16c('0x6')]='answered_elsewhere';_0x544800['reason']=_0xc16c('0x2b');_0x544800[_0xc16c('0x2c')]=_0x4becb5['destuniqueid'];_0x544800['answeredelsewheremembername']=_0x4becb5[_0xc16c('0x16')];writeDB(_0x544800);}});}}catch(_0x21bc36){utils[_0xc16c('0x20')](util['format'](_0xc16c('0x25'),_0x4becb5[_0xc16c('0x3')]),_0x21bc36);}};exports['agentcomplete']=function(_0xe28330){try{if(!_[_0xc16c('0x18')](agents[_0xe28330[_0xc16c('0xf')]])){utils[_0xc16c('0x19')](util[_0xc16c('0x2')](_0xc16c('0x2d'),_0xe28330[_0xc16c('0x3')]),_0xe28330);utils['info'](util[_0xc16c('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xe28330[_0xc16c('0x3')],agents[_0xe28330[_0xc16c('0xf')]][_0xc16c('0x16')],_0xe28330[_0xc16c('0xf')]));agents[_0xe28330[_0xc16c('0xf')]][_0xc16c('0xa')]=!![];agents[_0xe28330['destuniqueid']]['agentcompleteAt']=utils[_0xc16c('0x12')]();agents[_0xe28330[_0xc16c('0xf')]][_0xc16c('0x2a')]=utils['diffTime'](agents[_0xe28330[_0xc16c('0xf')]]['agentcompleteAt'],agents[_0xe28330[_0xc16c('0xf')]]['agentconnectAt']);agents[_0xe28330[_0xc16c('0xf')]][_0xc16c('0x2e')]=_0xe28330[_0xc16c('0x2e')];agents[_0xe28330['destuniqueid']][_0xc16c('0x6')]='complete';writeDB(agents[_0xe28330[_0xc16c('0xf')]]);}}catch(_0xf791e3){utils[_0xc16c('0x20')](util[_0xc16c('0x2')]('[%s][agents][agentcomplete]',_0xe28330[_0xc16c('0x3')]),_0xf791e3);}};exports[_0xc16c('0x2f')]=function(_0x2a4145){try{if(!_['isNil'](agents[_0x2a4145[_0xc16c('0x30')]])){utils[_0xc16c('0x19')](util[_0xc16c('0x2')](_0xc16c('0x31'),_0x2a4145[_0xc16c('0x3')]),_0x2a4145);utils['info'](util[_0xc16c('0x2')](_0xc16c('0x32'),_0x2a4145['uniqueid'],agents[_0x2a4145[_0xc16c('0x30')]][_0xc16c('0x16')],agents[_0x2a4145['transfereruniqueid']][_0xc16c('0x3')]));agents[_0x2a4145['transfereruniqueid']]['transfer']=!![];agents[_0x2a4145[_0xc16c('0x30')]]['transfertype']='blind';agents[_0x2a4145[_0xc16c('0x30')]][_0xc16c('0x33')]=_0x2a4145[_0xc16c('0x34')];agents[_0x2a4145[_0xc16c('0x30')]][_0xc16c('0x35')]=agents[_0x2a4145[_0xc16c('0x30')]][_0xc16c('0x3')];}}catch(_0x3e4090){utils['error'](util[_0xc16c('0x2')](_0xc16c('0x31'),_0x2a4145[_0xc16c('0x3')]),_0x3e4090);}};exports[_0xc16c('0x36')]=function(_0x33b162){try{utils['debug'](util['format'](_0xc16c('0x37'),_0x33b162[_0xc16c('0x38')]),_0x33b162);if(_0x33b162[_0xc16c('0x38')]==_0x33b162['origtransfererlinkedid']){if(!_['isNil'](agents[_0x33b162['secondtransfereruniqueid']])){utils[_0xc16c('0x1')](util[_0xc16c('0x2')](_0xc16c('0x39'),_0x33b162[_0xc16c('0x38')],agents[_0x33b162[_0xc16c('0x3a')]][_0xc16c('0x16')]));agents[_0x33b162[_0xc16c('0x3a')]]['transfer']=!![];agents[_0x33b162[_0xc16c('0x3a')]]['transfertype']='ATTENDED';agents[_0x33b162[_0xc16c('0x3a')]][_0xc16c('0x33')]=_0x33b162[_0xc16c('0x3b')];agents[_0x33b162[_0xc16c('0x3a')]]['transferuniqueid']=_0x33b162[_0xc16c('0x38')];}if(_0x33b162[_0xc16c('0x3c')]&&agents[_0x33b162[_0xc16c('0x3c')]]){agents[_0x33b162['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x33b162[_0xc16c('0x3c')]]=_[_0xc16c('0x3d')](agents[_0x33b162['transfereeuniqueid']]);transfers[_0x33b162[_0xc16c('0x3c')]][_0xc16c('0x3e')]=agents[_0x33b162[_0xc16c('0x3a')]][_0xc16c('0x3e')];transfers[_0x33b162['transfereeuniqueid']][_0xc16c('0x3f')]=agents[_0x33b162[_0xc16c('0x3a')]][_0xc16c('0x3f')];transfers[_0x33b162[_0xc16c('0x3c')]]['agentcalledAt']=utils['now']();transfers[_0x33b162['transfereeuniqueid']]['agentconnectAt']=utils[_0xc16c('0x12')]();transfers[_0x33b162[_0xc16c('0x3c')]][_0xc16c('0x1d')]=0x0;transfers[_0x33b162['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x33b162[_0xc16c('0x3a')]==_0x33b162[_0xc16c('0x40')]){if(!_[_0xc16c('0x18')](agents[_0x33b162[_0xc16c('0x38')]])){utils[_0xc16c('0x1')](util[_0xc16c('0x2')](_0xc16c('0x39'),_0x33b162[_0xc16c('0x38')],agents[_0x33b162[_0xc16c('0x38')]][_0xc16c('0x16')]));agents[_0x33b162[_0xc16c('0x38')]][_0xc16c('0x41')]=!![];agents[_0x33b162[_0xc16c('0x38')]][_0xc16c('0x42')]=_0xc16c('0x43');agents[_0x33b162['origtransfereruniqueid']][_0xc16c('0x33')]=_0x33b162[_0xc16c('0x44')];agents[_0x33b162[_0xc16c('0x38')]][_0xc16c('0x35')]=_0x33b162[_0xc16c('0x3a')];}if(_0x33b162['transfertargetuniqueid']&&agents[_0x33b162[_0xc16c('0x45')]]){agents[_0x33b162[_0xc16c('0x45')]][_0xc16c('0x46')]=0x1;transfers[_0x33b162[_0xc16c('0x45')]]=_[_0xc16c('0x3d')](agents[_0x33b162['transfertargetuniqueid']]);transfers[_0x33b162['transfertargetuniqueid']][_0xc16c('0x3e')]=agents[_0x33b162[_0xc16c('0x38')]][_0xc16c('0x3e')];transfers[_0x33b162[_0xc16c('0x45')]][_0xc16c('0x3f')]=agents[_0x33b162['origtransfereruniqueid']][_0xc16c('0x3f')];transfers[_0x33b162[_0xc16c('0x45')]][_0xc16c('0x11')]=utils[_0xc16c('0x12')]();transfers[_0x33b162[_0xc16c('0x45')]][_0xc16c('0x27')]=utils['now']();transfers[_0x33b162[_0xc16c('0x45')]][_0xc16c('0x1d')]=0x0;transfers[_0x33b162[_0xc16c('0x45')]][_0xc16c('0x46')]=0x2;}}}catch(_0x79178a){utils['error'](util[_0xc16c('0x2')]('[%s][agents][attendedtransfer]',_0x33b162['origtransfereruniqueid']),_0x79178a);}};exports[_0xc16c('0x47')]=function(_0x243bf2){try{utils[_0xc16c('0x19')](util[_0xc16c('0x2')](_0xc16c('0x48'),_0x243bf2[_0xc16c('0x3')]),_0x243bf2);if(agents[_0x243bf2[_0xc16c('0x3')]]&&agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2e')]===_0xc16c('0x1c')){if(_0x243bf2['cause']==='21'){agents[_0x243bf2[_0xc16c('0x3')]]['reason']=_0xc16c('0x49');agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x6')]=_0xc16c('0x49');}utils[_0xc16c('0x1')](util[_0xc16c('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x243bf2[_0xc16c('0x3')],agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x16')],agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2e')],agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x6')]));writeDB(agents[_0x243bf2[_0xc16c('0x3')]]);var _0x41b44d=unanswered['indexOf'](_0x243bf2['uniqueid']);if(_0x41b44d>-0x1){unanswered[_0xc16c('0x4a')](_0x41b44d,0x1);}}if(transfers[_0x243bf2['uniqueid']]){transfers[_0x243bf2['uniqueid']][_0xc16c('0xa')]=!![];transfers[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x4b')]=utils[_0xc16c('0x12')]();transfers[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2a')]=utils[_0xc16c('0x4c')](transfers[_0x243bf2[_0xc16c('0x3')]]['agentcompleteAt'],transfers[_0x243bf2[_0xc16c('0x3')]]['agentconnectAt']);transfers[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2e')]='agent';transfers[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x6')]=_0xc16c('0x4d');utils['info'](util[_0xc16c('0x2')](_0xc16c('0x4e'),_0x243bf2[_0xc16c('0x3')],transfers[_0x243bf2['uniqueid']][_0xc16c('0x16')],transfers[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2e')],transfers[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x6')]));writeDB(transfers[_0x243bf2[_0xc16c('0x3')]],!![]);}if(agents[_0x243bf2[_0xc16c('0x3')]]&&agents[_0x243bf2[_0xc16c('0x3')]]['agentconnectAt']){agents[_0x243bf2[_0xc16c('0x3')]]['agentcomplete']=!![];agents[_0x243bf2[_0xc16c('0x3')]]['agentcompleteAt']=utils[_0xc16c('0x12')]();agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2a')]=utils['diffTime'](agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x4b')],agents[_0x243bf2[_0xc16c('0x3')]]['agentconnectAt']);agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2e')]=agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x41')]?_0xc16c('0x41'):_0xc16c('0x4f');agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x6')]=_0xc16c('0x4d');utils['info'](util[_0xc16c('0x2')](_0xc16c('0x4e'),_0x243bf2[_0xc16c('0x3')],agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x16')],agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2e')],agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x6')]));writeDB(agents[_0x243bf2[_0xc16c('0x3')]]);}}catch(_0x54c27c){utils[_0xc16c('0x20')](util[_0xc16c('0x2')](_0xc16c('0x48'),_0x243bf2['uniqueid']),_0x54c27c);}}; \ No newline at end of file +var _0xb665=['info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','then','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinename','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','error','[%s][agents][agentringnoanswer]','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','reason','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','agentcomplete','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','./utils'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb665,0x159));var _0x5b66=function(_0x138345,_0x3e18b3){_0x138345=_0x138345-0x0;var _0x370d1f=_0xb665[_0x138345];return _0x370d1f;};'use strict';var _=require(_0x5b66('0x0'));var util=require(_0x5b66('0x1'));var utils=require(_0x5b66('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3c344a,_0x173d81){utils[_0x5b66('0x3')](util[_0x5b66('0x4')](_0x5b66('0x5'),_0x3c344a[_0x5b66('0x6')],_0x3c344a['channel'],_0x3c344a[_0x5b66('0x7')],_0x3c344a[_0x5b66('0x8')],_0x3c344a[_0x5b66('0x9')],_0x3c344a['calleridnum'],_0x3c344a[_0x5b66('0xa')],_0x3c344a[_0x5b66('0xb')]));if(_0x3c344a[_0x5b66('0x7')]){utils[_0x5b66('0xc')](_0x3c344a[_0x5b66('0x7')])[_0x5b66('0xd')](function(_0x3847c3){if(_0x3847c3){_0x3c344a['type']=_0x3847c3['type'];_0x3c344a['agentacw']=_0x3c344a['agentcomplete']?_0x3847c3[_0x5b66('0xe')]:![];_0x3c344a[_0x5b66('0xf')]=_0x3c344a['agentacw']?_0x3847c3[_0x5b66('0x10')]:0x0;}utils[_0x5b66('0x11')]('CreateVoiceAgentReport',_0x3c344a);});}else{utils[_0x5b66('0x11')](_0x5b66('0x12'),_0x3c344a);}if(_0x173d81){delete transfers[_0x3c344a[_0x5b66('0x6')]];}else{delete agents[_0x3c344a[_0x5b66('0x13')]];}}exports[_0x5b66('0x14')]=function(_0x26ea99){try{utils[_0x5b66('0x15')](util[_0x5b66('0x4')](_0x5b66('0x16'),_0x26ea99[_0x5b66('0x6')]),_0x26ea99);agents[_0x26ea99[_0x5b66('0x13')]]=_0x26ea99;agents[_0x26ea99[_0x5b66('0x13')]][_0x5b66('0x17')]=utils[_0x5b66('0x18')]();agents[_0x26ea99[_0x5b66('0x13')]][_0x5b66('0xb')]='called';agents[_0x26ea99[_0x5b66('0x13')]]['connectedlinenum']=null;agents[_0x26ea99[_0x5b66('0x13')]][_0x5b66('0x19')]=null;utils[_0x5b66('0x3')](util[_0x5b66('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x26ea99[_0x5b66('0x6')],agents[_0x26ea99[_0x5b66('0x13')]][_0x5b66('0x8')],_0x26ea99[_0x5b66('0x13')]));}catch(_0x35b4fc){utils['error'](util[_0x5b66('0x4')](_0x5b66('0x16'),_0x26ea99['uniqueid']),_0x35b4fc);}};exports[_0x5b66('0x1a')]=function(_0x546a3a){try{if(!_[_0x5b66('0x1b')](agents[_0x546a3a[_0x5b66('0x13')]])){utils['debug'](util[_0x5b66('0x4')]('[%s][agents][agentringnoanswer]',_0x546a3a[_0x5b66('0x6')]),_0x546a3a);utils['info'](util[_0x5b66('0x4')](_0x5b66('0x1c'),_0x546a3a[_0x5b66('0x6')],agents[_0x546a3a[_0x5b66('0x13')]][_0x5b66('0x8')],_0x546a3a[_0x5b66('0x13')]));agents[_0x546a3a[_0x5b66('0x13')]][_0x5b66('0x1a')]=!![];agents[_0x546a3a[_0x5b66('0x13')]][_0x5b66('0x1d')]=utils[_0x5b66('0x18')]();agents[_0x546a3a[_0x5b66('0x13')]][_0x5b66('0xb')]=_0x5b66('0x1e');agents[_0x546a3a[_0x5b66('0x13')]]['reason']=_0x5b66('0x1e');agents[_0x546a3a[_0x5b66('0x13')]][_0x5b66('0x1f')]=_0x546a3a[_0x5b66('0x20')]?parseInt(_0x546a3a[_0x5b66('0x20')])/0x3e8:0x0;agents[_0x546a3a['destuniqueid']][_0x5b66('0x21')]=0x0;unanswered[_0x5b66('0x22')](_0x546a3a['destuniqueid']);}}catch(_0xf09c0b){utils[_0x5b66('0x23')](util['format'](_0x5b66('0x24'),_0x546a3a['uniqueid']),_0xf09c0b);}};exports[_0x5b66('0x25')]=function(_0x7a90ea){try{_['forIn'](agents,function(_0x4bfcf6,_0x1b71ba){if(_0x4bfcf6[_0x5b66('0x6')]==_0x7a90ea[_0x5b66('0x6')]&&!_[_0x5b66('0x26')](unanswered,_0x4bfcf6[_0x5b66('0x13')])){utils[_0x5b66('0x15')](util[_0x5b66('0x4')](_0x5b66('0x27'),_0x7a90ea[_0x5b66('0x6')]),_0x7a90ea);utils[_0x5b66('0x3')](util[_0x5b66('0x4')](_0x5b66('0x28'),_0x7a90ea[_0x5b66('0x6')],_0x4bfcf6[_0x5b66('0x8')],_0x4bfcf6['destuniqueid']));_0x4bfcf6[_0x5b66('0x1a')]=!![];_0x4bfcf6[_0x5b66('0x1d')]=utils['now']();_0x4bfcf6['lastevent']='abandoned';_0x4bfcf6['reason']=_0x5b66('0x29');_0x4bfcf6[_0x5b66('0x1f')]=_0x7a90ea['holdtime'];_0x4bfcf6[_0x5b66('0x21')]=0x0;writeDB(_0x4bfcf6);}});}catch(_0x51a3c7){utils[_0x5b66('0x23')](util[_0x5b66('0x4')](_0x5b66('0x27'),_0x7a90ea[_0x5b66('0x6')]),_0x51a3c7);}};exports[_0x5b66('0x2a')]=function(_0x2d0507){try{if(agents[_0x2d0507[_0x5b66('0x13')]]){utils[_0x5b66('0x15')](util[_0x5b66('0x4')]('[%s][agents][agentconnect]',_0x2d0507[_0x5b66('0x6')]),_0x2d0507);utils[_0x5b66('0x3')](util[_0x5b66('0x4')](_0x5b66('0x2b'),_0x2d0507[_0x5b66('0x6')],agents[_0x2d0507[_0x5b66('0x13')]][_0x5b66('0x8')],_0x2d0507[_0x5b66('0x13')]));agents[_0x2d0507[_0x5b66('0x13')]][_0x5b66('0x2c')]=utils[_0x5b66('0x18')]();agents[_0x2d0507[_0x5b66('0x13')]][_0x5b66('0xa')]=_0x2d0507[_0x5b66('0xa')];agents[_0x2d0507['destuniqueid']]['connectedlinename']=_0x2d0507[_0x5b66('0x19')];agents[_0x2d0507[_0x5b66('0x13')]][_0x5b66('0x1f')]=_0x2d0507[_0x5b66('0x20')];agents[_0x2d0507[_0x5b66('0x13')]][_0x5b66('0xb')]=_0x5b66('0x2d');_[_0x5b66('0x2e')](agents,function(_0x5572ba,_0x102f8c){if(_0x5572ba['destuniqueid']!=_0x2d0507[_0x5b66('0x13')]&&_0x5572ba[_0x5b66('0x6')]==_0x2d0507[_0x5b66('0x6')]){_0x5572ba['talktime']=0x0;_0x5572ba[_0x5b66('0x1f')]=_0x2d0507[_0x5b66('0x20')];_0x5572ba[_0x5b66('0x1a')]=!![];_0x5572ba['agentringnoanswerAt']=utils[_0x5b66('0x18')]();_0x5572ba[_0x5b66('0xb')]='answered_elsewhere';_0x5572ba[_0x5b66('0x2f')]='answered_elsewhere';_0x5572ba[_0x5b66('0x30')]=_0x2d0507['destuniqueid'];_0x5572ba[_0x5b66('0x31')]=_0x2d0507[_0x5b66('0x8')];writeDB(_0x5572ba);}});}}catch(_0x109b4c){utils[_0x5b66('0x23')](util[_0x5b66('0x4')](_0x5b66('0x32'),_0x2d0507['uniqueid']),_0x109b4c);}};exports[_0x5b66('0x33')]=function(_0x25b0d7){try{if(!_['isNil'](agents[_0x25b0d7['destuniqueid']])){utils[_0x5b66('0x15')](util[_0x5b66('0x4')](_0x5b66('0x34'),_0x25b0d7[_0x5b66('0x6')]),_0x25b0d7);utils[_0x5b66('0x3')](util[_0x5b66('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x25b0d7[_0x5b66('0x6')],agents[_0x25b0d7['destuniqueid']]['membername'],_0x25b0d7[_0x5b66('0x13')]));agents[_0x25b0d7['destuniqueid']][_0x5b66('0x33')]=!![];agents[_0x25b0d7['destuniqueid']]['agentcompleteAt']=utils[_0x5b66('0x18')]();agents[_0x25b0d7[_0x5b66('0x13')]][_0x5b66('0x21')]=utils[_0x5b66('0x35')](agents[_0x25b0d7['destuniqueid']][_0x5b66('0x36')],agents[_0x25b0d7[_0x5b66('0x13')]]['agentconnectAt']);agents[_0x25b0d7[_0x5b66('0x13')]]['reason']=_0x25b0d7[_0x5b66('0x2f')];agents[_0x25b0d7[_0x5b66('0x13')]][_0x5b66('0xb')]=_0x5b66('0x37');writeDB(agents[_0x25b0d7[_0x5b66('0x13')]]);}}catch(_0x47902a){utils[_0x5b66('0x23')](util[_0x5b66('0x4')]('[%s][agents][agentcomplete]',_0x25b0d7['uniqueid']),_0x47902a);}};exports[_0x5b66('0x38')]=function(_0x19a8de){try{if(!_[_0x5b66('0x1b')](agents[_0x19a8de[_0x5b66('0x39')]])){utils[_0x5b66('0x15')](util[_0x5b66('0x4')](_0x5b66('0x3a'),_0x19a8de[_0x5b66('0x6')]),_0x19a8de);utils[_0x5b66('0x3')](util[_0x5b66('0x4')](_0x5b66('0x3b'),_0x19a8de[_0x5b66('0x6')],agents[_0x19a8de['transfereruniqueid']][_0x5b66('0x8')],agents[_0x19a8de['transfereruniqueid']][_0x5b66('0x6')]));agents[_0x19a8de[_0x5b66('0x39')]][_0x5b66('0x3c')]=!![];agents[_0x19a8de[_0x5b66('0x39')]][_0x5b66('0x3d')]=_0x5b66('0x3e');agents[_0x19a8de[_0x5b66('0x39')]][_0x5b66('0x3f')]=_0x19a8de['extension'];agents[_0x19a8de['transfereruniqueid']][_0x5b66('0x40')]=agents[_0x19a8de['transfereruniqueid']][_0x5b66('0x6')];}}catch(_0x480873){utils[_0x5b66('0x23')](util[_0x5b66('0x4')](_0x5b66('0x3a'),_0x19a8de['uniqueid']),_0x480873);}};exports[_0x5b66('0x41')]=function(_0x5b4064){try{utils[_0x5b66('0x15')](util[_0x5b66('0x4')](_0x5b66('0x42'),_0x5b4064[_0x5b66('0x43')]),_0x5b4064);if(_0x5b4064[_0x5b66('0x43')]==_0x5b4064['origtransfererlinkedid']){if(!_[_0x5b66('0x1b')](agents[_0x5b4064['secondtransfereruniqueid']])){utils[_0x5b66('0x3')](util[_0x5b66('0x4')](_0x5b66('0x44'),_0x5b4064['origtransfereruniqueid'],agents[_0x5b4064[_0x5b66('0x45')]]['membername']));agents[_0x5b4064['secondtransfereruniqueid']]['transfer']=!![];agents[_0x5b4064['secondtransfereruniqueid']][_0x5b66('0x3d')]='ATTENDED';agents[_0x5b4064[_0x5b66('0x45')]][_0x5b66('0x3f')]=_0x5b4064[_0x5b66('0x46')];agents[_0x5b4064[_0x5b66('0x45')]]['transferuniqueid']=_0x5b4064[_0x5b66('0x43')];}if(_0x5b4064[_0x5b66('0x47')]&&agents[_0x5b4064[_0x5b66('0x47')]]){agents[_0x5b4064['transfereeuniqueid']][_0x5b66('0x48')]=0x1;transfers[_0x5b4064[_0x5b66('0x47')]]=_[_0x5b66('0x49')](agents[_0x5b4064[_0x5b66('0x47')]]);transfers[_0x5b4064['transfereeuniqueid']][_0x5b66('0x4a')]=agents[_0x5b4064[_0x5b66('0x45')]]['calleridnum'];transfers[_0x5b4064['transfereeuniqueid']][_0x5b66('0x4b')]=agents[_0x5b4064[_0x5b66('0x45')]][_0x5b66('0x4b')];transfers[_0x5b4064[_0x5b66('0x47')]][_0x5b66('0x17')]=utils[_0x5b66('0x18')]();transfers[_0x5b4064['transfereeuniqueid']]['agentconnectAt']=utils[_0x5b66('0x18')]();transfers[_0x5b4064[_0x5b66('0x47')]][_0x5b66('0x1f')]=0x0;transfers[_0x5b4064[_0x5b66('0x47')]]['agententerreason']=0x2;}}else if(_0x5b4064[_0x5b66('0x45')]==_0x5b4064[_0x5b66('0x4c')]){if(!_[_0x5b66('0x1b')](agents[_0x5b4064[_0x5b66('0x43')]])){utils[_0x5b66('0x3')](util[_0x5b66('0x4')](_0x5b66('0x44'),_0x5b4064[_0x5b66('0x43')],agents[_0x5b4064[_0x5b66('0x43')]]['membername']));agents[_0x5b4064['origtransfereruniqueid']]['transfer']=!![];agents[_0x5b4064['origtransfereruniqueid']][_0x5b66('0x3d')]=_0x5b66('0x4d');agents[_0x5b4064[_0x5b66('0x43')]][_0x5b66('0x3f')]=_0x5b4064[_0x5b66('0x4e')];agents[_0x5b4064['origtransfereruniqueid']][_0x5b66('0x40')]=_0x5b4064['secondtransfereruniqueid'];}if(_0x5b4064[_0x5b66('0x4f')]&&agents[_0x5b4064[_0x5b66('0x4f')]]){agents[_0x5b4064['transfertargetuniqueid']][_0x5b66('0x48')]=0x1;transfers[_0x5b4064[_0x5b66('0x4f')]]=_[_0x5b66('0x49')](agents[_0x5b4064[_0x5b66('0x4f')]]);transfers[_0x5b4064['transfertargetuniqueid']][_0x5b66('0x4a')]=agents[_0x5b4064[_0x5b66('0x43')]][_0x5b66('0x4a')];transfers[_0x5b4064[_0x5b66('0x4f')]][_0x5b66('0x4b')]=agents[_0x5b4064[_0x5b66('0x43')]][_0x5b66('0x4b')];transfers[_0x5b4064[_0x5b66('0x4f')]]['agentcalledAt']=utils[_0x5b66('0x18')]();transfers[_0x5b4064[_0x5b66('0x4f')]][_0x5b66('0x2c')]=utils[_0x5b66('0x18')]();transfers[_0x5b4064[_0x5b66('0x4f')]][_0x5b66('0x1f')]=0x0;transfers[_0x5b4064['transfertargetuniqueid']][_0x5b66('0x48')]=0x2;}}}catch(_0x400f9f){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x5b4064['origtransfereruniqueid']),_0x400f9f);}};exports[_0x5b66('0x50')]=function(_0x36d083){try{utils['debug'](util[_0x5b66('0x4')](_0x5b66('0x51'),_0x36d083['uniqueid']),_0x36d083);if(agents[_0x36d083[_0x5b66('0x6')]]&&agents[_0x36d083[_0x5b66('0x6')]][_0x5b66('0x2f')]===_0x5b66('0x1e')){if(_0x36d083[_0x5b66('0x52')]==='21'){agents[_0x36d083['uniqueid']][_0x5b66('0x2f')]=_0x5b66('0x53');agents[_0x36d083[_0x5b66('0x6')]]['lastevent']=_0x5b66('0x53');}utils['info'](util[_0x5b66('0x4')](_0x5b66('0x54'),_0x36d083[_0x5b66('0x6')],agents[_0x36d083[_0x5b66('0x6')]][_0x5b66('0x8')],agents[_0x36d083['uniqueid']]['reason'],agents[_0x36d083['uniqueid']][_0x5b66('0xb')]));writeDB(agents[_0x36d083[_0x5b66('0x6')]]);var _0x2b8c2b=unanswered['indexOf'](_0x36d083[_0x5b66('0x6')]);if(_0x2b8c2b>-0x1){unanswered[_0x5b66('0x55')](_0x2b8c2b,0x1);}}if(transfers[_0x36d083[_0x5b66('0x6')]]){transfers[_0x36d083[_0x5b66('0x6')]]['agentcomplete']=!![];transfers[_0x36d083['uniqueid']][_0x5b66('0x36')]=utils[_0x5b66('0x18')]();transfers[_0x36d083[_0x5b66('0x6')]]['talktime']=utils[_0x5b66('0x35')](transfers[_0x36d083[_0x5b66('0x6')]][_0x5b66('0x36')],transfers[_0x36d083[_0x5b66('0x6')]][_0x5b66('0x2c')]);transfers[_0x36d083[_0x5b66('0x6')]][_0x5b66('0x2f')]=_0x5b66('0x56');transfers[_0x36d083[_0x5b66('0x6')]][_0x5b66('0xb')]='complete';utils['info'](util[_0x5b66('0x4')](_0x5b66('0x54'),_0x36d083['uniqueid'],transfers[_0x36d083[_0x5b66('0x6')]]['membername'],transfers[_0x36d083[_0x5b66('0x6')]][_0x5b66('0x2f')],transfers[_0x36d083['uniqueid']][_0x5b66('0xb')]));writeDB(transfers[_0x36d083[_0x5b66('0x6')]],!![]);}if(agents[_0x36d083[_0x5b66('0x6')]]&&agents[_0x36d083[_0x5b66('0x6')]][_0x5b66('0x2c')]){agents[_0x36d083[_0x5b66('0x6')]][_0x5b66('0x33')]=!![];agents[_0x36d083['uniqueid']][_0x5b66('0x36')]=utils[_0x5b66('0x18')]();agents[_0x36d083[_0x5b66('0x6')]][_0x5b66('0x21')]=utils['diffTime'](agents[_0x36d083['uniqueid']][_0x5b66('0x36')],agents[_0x36d083[_0x5b66('0x6')]][_0x5b66('0x2c')]);agents[_0x36d083['uniqueid']][_0x5b66('0x2f')]=agents[_0x36d083[_0x5b66('0x6')]]['transfer']?'transfer':_0x5b66('0x56');agents[_0x36d083[_0x5b66('0x6')]][_0x5b66('0xb')]=_0x5b66('0x37');utils['info'](util[_0x5b66('0x4')](_0x5b66('0x54'),_0x36d083['uniqueid'],agents[_0x36d083['uniqueid']]['membername'],agents[_0x36d083[_0x5b66('0x6')]][_0x5b66('0x2f')],agents[_0x36d083[_0x5b66('0x6')]][_0x5b66('0xb')]));writeDB(agents[_0x36d083[_0x5b66('0x6')]]);}}catch(_0x41243b){utils[_0x5b66('0x23')](util[_0x5b66('0x4')](_0x5b66('0x51'),_0x36d083[_0x5b66('0x6')]),_0x41243b);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 722ce2b..762537a 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 _0xe0d0=['gotoif','[%s][calls][newexten]','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','exten','calleridnum','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','context','destinationchannel','answertime','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','starttime','billableseconds','endtime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','musiconholdstartAt','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','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','type','outboundrouteid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase','lastIndexOf','includes','hangup','execif'];(function(_0x389a30,_0x1a4c3d){var _0x407335=function(_0x54d759){while(--_0x54d759){_0x389a30['push'](_0x389a30['shift']());}};_0x407335(++_0x1a4c3d);}(_0xe0d0,0x6f));var _0x0e0d=function(_0x23213d,_0x46696f){_0x23213d=_0x23213d-0x0;var _0x966f81=_0xe0d0[_0x23213d];return _0x966f81;};'use strict';var _=require('lodash');var util=require(_0x0e0d('0x0'));var utils=require(_0x0e0d('0x1'));var dispositions=['NO\x20ANSWER',_0x0e0d('0x2'),_0x0e0d('0x2'),_0x0e0d('0x3'),'NO\x20ANSWER',_0x0e0d('0x3'),_0x0e0d('0x4'),_0x0e0d('0x5'),_0x0e0d('0x2'),'FAILED',_0x0e0d('0x2')];var channels={};function writeDB(_0x48b9de){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x8'),_0x48b9de[_0x0e0d('0x9')],_0x48b9de[_0x0e0d('0xa')],_0x48b9de[_0x0e0d('0xb')],_0x48b9de[_0x0e0d('0xc')],_0x48b9de[_0x0e0d('0xd')],_0x48b9de['calleridnum'],_0x48b9de[_0x0e0d('0xe')],_0x48b9de[_0x0e0d('0xf')]));if(_0x48b9de[_0x0e0d('0x10')]){utils[_0x0e0d('0x11')](_0x48b9de[_0x0e0d('0x10')])[_0x0e0d('0x12')](function(_0x1337ea){if(_0x1337ea){_0x48b9de['UserId']=_0x1337ea['id'];}utils[_0x0e0d('0x13')]('CreateVoiceCallReport',_0x48b9de);});}else{utils[_0x0e0d('0x13')](_0x0e0d('0x14'),_0x48b9de);}if(channels[_0x48b9de[_0x0e0d('0x9')]]){delete channels[_0x48b9de[_0x0e0d('0x9')]];}}exports['newchannel']=function(_0x2c3e78){try{utils[_0x0e0d('0x15')](util['format'](_0x0e0d('0x16'),_0x2c3e78[_0x0e0d('0x9')]),_0x2c3e78);if(_0x2c3e78[_0x0e0d('0x9')]==_0x2c3e78[_0x0e0d('0x17')]&&_0x2c3e78[_0x0e0d('0xa')]!=_0x0e0d('0x18')){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x2c3e78[_0x0e0d('0x9')],_0x2c3e78['context'],_0x2c3e78[_0x0e0d('0x19')]));channels[_0x2c3e78['uniqueid']]={'uniqueid':_0x2c3e78['uniqueid'],'accountcode':_0x2c3e78['accountcode'],'source':_0x2c3e78[_0x0e0d('0x1a')],'destination':_0x2c3e78[_0x0e0d('0x19')],'destinationcontext':_0x2c3e78['context'],'channel':_0x2c3e78[_0x0e0d('0xa')],'starttime':utils[_0x0e0d('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0e0d('0x3'),'amaflags':_0x0e0d('0x1c')};}}catch(_0x4f7eb8){utils[_0x0e0d('0x1d')](util['format'](_0x0e0d('0x16'),_0x2c3e78['uniqueid']),_0x4f7eb8);}};exports[_0x0e0d('0x1e')]=function(_0x2d041d){try{utils[_0x0e0d('0x15')](util[_0x0e0d('0x7')](_0x0e0d('0x1f'),_0x2d041d[_0x0e0d('0x9')]),_0x2d041d);if(!_[_0x0e0d('0x20')](channels[_0x2d041d[_0x0e0d('0x9')]])&&_0x2d041d['channelstate']==0x6){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x21'),_0x2d041d[_0x0e0d('0x9')],_0x2d041d['context'],_0x2d041d[_0x0e0d('0xa')]));if(_[_0x0e0d('0x20')](channels[_0x2d041d[_0x0e0d('0x9')]][_0x0e0d('0x22')])){channels[_0x2d041d[_0x0e0d('0x9')]]['systemanswertime']=utils[_0x0e0d('0x1b')]();}}else if(!_['isNil'](channels[_0x2d041d['linkedid']])&&_0x2d041d[_0x0e0d('0x23')]==0x6&&_0x2d041d['context']!=_0x0e0d('0x24')){utils['info'](util[_0x0e0d('0x7')](_0x0e0d('0x25'),_0x2d041d[_0x0e0d('0x9')],_0x2d041d[_0x0e0d('0x17')],_0x2d041d[_0x0e0d('0x26')],_0x2d041d['channel']));channels[_0x2d041d['linkedid']][_0x0e0d('0x10')]=_0x2d041d[_0x0e0d('0x10')];channels[_0x2d041d[_0x0e0d('0x17')]][_0x0e0d('0x27')]=_0x2d041d[_0x0e0d('0xa')];if(_[_0x0e0d('0x20')](channels[_0x2d041d[_0x0e0d('0x17')]][_0x0e0d('0x28')])){channels[_0x2d041d[_0x0e0d('0x17')]]['answertime']=utils[_0x0e0d('0x1b')]();}channels[_0x2d041d['linkedid']]['disposition']=dispositions[_[_0x0e0d('0x29')](_0x2d041d[_0x0e0d('0x23')])]||'ANSWERED';}}catch(_0x1296d3){utils[_0x0e0d('0x1d')](util[_0x0e0d('0x7')](_0x0e0d('0x1f'),_0x2d041d['uniqueid']),_0x1296d3);}};exports['hangup']=function(_0x39ce62){try{if(!_['isNil'](channels[_0x39ce62[_0x0e0d('0x9')]])){utils['debug'](util[_0x0e0d('0x7')](_0x0e0d('0x2a'),_0x39ce62[_0x0e0d('0x9')]),_0x39ce62);if(_[_0x0e0d('0x20')](channels[_0x39ce62['uniqueid']][_0x0e0d('0x2b')])){channels[_0x39ce62[_0x0e0d('0x9')]][_0x0e0d('0x2b')]=_0x39ce62[_0x0e0d('0x2c')]+'\x20<'+_0x39ce62['calleridnum']+'>';}utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x2d'),_0x39ce62['uniqueid'],channels[_0x39ce62['uniqueid']][_0x0e0d('0x2b')],_0x39ce62[_0x0e0d('0x2e')]));channels[_0x39ce62[_0x0e0d('0x9')]]['endtime']=utils[_0x0e0d('0x1b')]();channels[_0x39ce62['uniqueid']][_0x0e0d('0x2f')]=utils[_0x0e0d('0x30')](channels[_0x39ce62[_0x0e0d('0x9')]]['endtime'],channels[_0x39ce62[_0x0e0d('0x9')]][_0x0e0d('0x31')]);channels[_0x39ce62[_0x0e0d('0x9')]][_0x0e0d('0x32')]=channels[_0x39ce62[_0x0e0d('0x9')]][_0x0e0d('0x28')]?utils[_0x0e0d('0x30')](channels[_0x39ce62[_0x0e0d('0x9')]][_0x0e0d('0x33')],channels[_0x39ce62[_0x0e0d('0x9')]][_0x0e0d('0x28')]):0x0;writeDB(channels[_0x39ce62['uniqueid']]);}}catch(_0x5977d8){utils['error'](util['format']('[%s][calls][hangup]',_0x39ce62[_0x0e0d('0x9')]),_0x5977d8);}};exports[_0x0e0d('0x34')]=function(_0x5b0af6){try{if(!_['isNil'](channels[_0x5b0af6[_0x0e0d('0x35')]])){utils[_0x0e0d('0x15')](util[_0x0e0d('0x7')]('[%s][calls][attendedtransfer]',_0x5b0af6[_0x0e0d('0x36')]),_0x5b0af6);if(channels[_0x5b0af6[_0x0e0d('0x35')]][_0x0e0d('0xa')]==_0x5b0af6[_0x0e0d('0x37')]){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x38'),_0x5b0af6[_0x0e0d('0x36')],_0x5b0af6[_0x0e0d('0x35')],_0x5b0af6['secondtransfererchannel']));channels[_0x5b0af6['localtwolinkedid']][_0x0e0d('0x27')]=_0x5b0af6[_0x0e0d('0x39')];channels[_0x5b0af6['localtwolinkedid']][_0x0e0d('0x3a')]=_0x0e0d('0x3b');}else if(channels[_0x5b0af6[_0x0e0d('0x35')]][_0x0e0d('0xa')]=_0x5b0af6[_0x0e0d('0x3c')]){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x38'),_0x5b0af6[_0x0e0d('0x36')],_0x5b0af6['localtwolinkedid'],_0x5b0af6[_0x0e0d('0x3d')]));channels[_0x5b0af6[_0x0e0d('0x35')]][_0x0e0d('0x27')]=_0x5b0af6[_0x0e0d('0x3d')];channels[_0x5b0af6[_0x0e0d('0x35')]][_0x0e0d('0x3a')]='_attended';}}}catch(_0x2b6da5){utils[_0x0e0d('0x1d')](util[_0x0e0d('0x7')](_0x0e0d('0x3e'),_0x5b0af6[_0x0e0d('0x36')]),_0x2b6da5);}};exports[_0x0e0d('0x3f')]=function(_0x54ea50){try{if(!_['isNil'](channels[_0x54ea50[_0x0e0d('0x9')]])){utils[_0x0e0d('0x15')](util[_0x0e0d('0x7')](_0x0e0d('0x40'),_0x54ea50[_0x0e0d('0x9')]),_0x54ea50);channels[_0x54ea50[_0x0e0d('0x9')]]['musiconholdstartAt']=utils[_0x0e0d('0x1b')]();utils[_0x0e0d('0x6')](util['format'](_0x0e0d('0x41'),_0x54ea50[_0x0e0d('0x9')],channels[_0x54ea50[_0x0e0d('0x9')]]['musiconholdstartAt']));}}catch(_0x17402d){utils[_0x0e0d('0x1d')](util[_0x0e0d('0x7')](_0x0e0d('0x40'),_0x54ea50['uniqueid']),_0x17402d);}};exports['musiconholdstop']=function(_0x51a516){try{if(!_[_0x0e0d('0x20')](channels[_0x51a516[_0x0e0d('0x9')]])){utils['debug'](util[_0x0e0d('0x7')](_0x0e0d('0x42'),_0x51a516[_0x0e0d('0x9')]),_0x51a516);if(!_[_0x0e0d('0x20')](channels[_0x51a516[_0x0e0d('0x9')]]['musiconholdstartAt'])){channels[_0x51a516[_0x0e0d('0x9')]][_0x0e0d('0x43')]+=utils[_0x0e0d('0x30')](utils['now'](),channels[_0x51a516['uniqueid']][_0x0e0d('0x44')]);utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x45'),_0x51a516[_0x0e0d('0x9')],channels[_0x51a516[_0x0e0d('0x9')]][_0x0e0d('0x43')]));delete channels[_0x51a516[_0x0e0d('0x9')]]['musiconholdstartAt'];}}}catch(_0x10d845){utils[_0x0e0d('0x1d')](util[_0x0e0d('0x7')](_0x0e0d('0x42'),_0x51a516[_0x0e0d('0x9')]),_0x10d845);}};exports[_0x0e0d('0x46')]=function(_0x18789d){try{if(!_[_0x0e0d('0x20')](channels[_0x18789d['uniqueid']])){utils[_0x0e0d('0x15')](util[_0x0e0d('0x7')](_0x0e0d('0x47'),_0x18789d[_0x0e0d('0x9')]),_0x18789d);if(!_[_0x0e0d('0x20')](_0x18789d[_0x0e0d('0x48')][_0x0e0d('0x49')])){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x4a'),_0x18789d['uniqueid'],_0x18789d[_0x0e0d('0x4b')]));channels[_0x18789d[_0x0e0d('0x9')]][_0x0e0d('0x4c')]=_0x18789d[_0x0e0d('0x4b')];}if(!_['isNil'](_0x18789d[_0x0e0d('0x48')][_0x0e0d('0x4d')])){utils['info'](util[_0x0e0d('0x7')](_0x0e0d('0x4e'),_0x18789d['uniqueid'],_0x18789d[_0x0e0d('0x4b')]));channels[_0x18789d[_0x0e0d('0x9')]][_0x0e0d('0x4f')]=_0x18789d[_0x0e0d('0x4b')];channels[_0x18789d[_0x0e0d('0x9')]][_0x0e0d('0x2b')]='\x22'+_0x18789d['value']+_0x0e0d('0x50')+_0x18789d['value']+'>';}if(!_[_0x0e0d('0x20')](_0x18789d[_0x0e0d('0x48')][_0x0e0d('0x51')])||!_['isNil'](_0x18789d[_0x0e0d('0x48')]['xmd-callerid'])){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x52'),_0x18789d[_0x0e0d('0x9')],!_[_0x0e0d('0x20')](_0x18789d[_0x0e0d('0x48')][_0x0e0d('0x51')])?_0x0e0d('0x51'):_0x0e0d('0x53'),_0x18789d[_0x0e0d('0x4b')]));channels[_0x18789d[_0x0e0d('0x9')]]['callerid']=_0x18789d['value'];}if(!_[_0x0e0d('0x20')](_0x18789d[_0x0e0d('0x48')]['xmd-queue'])||!_['isNil'](_0x18789d['variable'][_0x0e0d('0x54')])){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x52'),_0x18789d[_0x0e0d('0x9')],!_[_0x0e0d('0x20')](_0x18789d[_0x0e0d('0x48')]['xmd-queue'])?'xmd-queue':_0x0e0d('0x54'),_0x18789d[_0x0e0d('0x4b')]));channels[_0x18789d['uniqueid']][_0x0e0d('0x55')]=_0x0e0d('0x56');channels[_0x18789d['uniqueid']][_0x0e0d('0x57')]=_0x18789d[_0x0e0d('0x4b')];channels[_0x18789d[_0x0e0d('0x9')]][_0x0e0d('0xb')]=!![];}if(!_['isNil'](_0x18789d['variable'][_0x0e0d('0x58')])){utils[_0x0e0d('0x6')](util['format'](_0x0e0d('0x59'),_0x18789d[_0x0e0d('0x9')],_0x18789d[_0x0e0d('0x4b')]));channels[_0x18789d[_0x0e0d('0x9')]]['ContactId']=_0x18789d[_0x0e0d('0x4b')];}if(!_[_0x0e0d('0x20')](_0x18789d['variable'][_0x0e0d('0x5a')])){utils['info'](util[_0x0e0d('0x7')](_0x0e0d('0x5b'),_0x18789d[_0x0e0d('0x9')],_0x18789d[_0x0e0d('0x4b')]));channels[_0x18789d[_0x0e0d('0x9')]][_0x0e0d('0x5c')]=_0x18789d[_0x0e0d('0x4b')];}if(!_[_0x0e0d('0x20')](_0x18789d[_0x0e0d('0x48')][_0x0e0d('0x5d')])){utils[_0x0e0d('0x6')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x18789d[_0x0e0d('0x9')],_0x18789d['value']));channels[_0x18789d['uniqueid']]['routeid']=_0x18789d[_0x0e0d('0x4b')];}if(!_[_0x0e0d('0x20')](_0x18789d[_0x0e0d('0x48')][_0x0e0d('0x5e')])){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x5f'),_0x18789d[_0x0e0d('0x9')],_0x18789d[_0x0e0d('0x4b')]));channels[_0x18789d[_0x0e0d('0x9')]][_0x0e0d('0x5e')]=_0x18789d[_0x0e0d('0x4b')];}}}catch(_0x4a8622){utils[_0x0e0d('0x1d')](util[_0x0e0d('0x7')](_0x0e0d('0x47'),_0x18789d['uniqueid']),_0x4a8622);}};exports[_0x0e0d('0x60')]=function(_0x53b0b5){try{if(!_[_0x0e0d('0x20')](channels[_0x53b0b5['uniqueid']])){utils['debug'](util[_0x0e0d('0x7')]('[%s][calls][newexten]',_0x53b0b5[_0x0e0d('0x9')]),_0x53b0b5);utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x61'),_0x53b0b5[_0x0e0d('0x9')],_0x53b0b5[_0x0e0d('0x62')],_0x53b0b5['appdata']));if(_0x53b0b5[_0x0e0d('0x62')]['toLowerCase']()==_0x0e0d('0x63')&&_[_0x0e0d('0x64')](_0x53b0b5[_0x0e0d('0x65')][_0x0e0d('0x66')](),'cdr')){var _0x2dba19=_0x53b0b5['appdata']['split']('=');var _0x446e36=_0x2dba19[0x0]['substring'](_0x2dba19[0x0]['lastIndexOf']('(')+0x1,_0x2dba19[0x0][_0x0e0d('0x67')](')'));var _0x12b72c=_0x2dba19[0x1];channels[_0x53b0b5[_0x0e0d('0x9')]][_0x446e36]=_0x12b72c;}if(!_[_0x0e0d('0x68')]([_0x0e0d('0x69'),'noop',_0x0e0d('0x6a'),_0x0e0d('0x63'),_0x0e0d('0x6b')],_0x53b0b5[_0x0e0d('0x62')]['toLowerCase']())){channels[_0x53b0b5['uniqueid']][_0x0e0d('0x55')]=_0x53b0b5[_0x0e0d('0x62')];channels[_0x53b0b5['uniqueid']]['lastdata']=_0x53b0b5[_0x0e0d('0x65')];}}}catch(_0x3ade66){utils['error'](util[_0x0e0d('0x7')](_0x0e0d('0x6c'),_0x53b0b5[_0x0e0d('0x9')]),_0x3ade66);}}; \ No newline at end of file +var _0xdc6b=['[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','includes','execif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','secondtransfererchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','origtransfereruniqueid','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','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','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type'];(function(_0x488cfe,_0xb74bea){var _0x238a7e=function(_0x2c98dd){while(--_0x2c98dd){_0x488cfe['push'](_0x488cfe['shift']());}};_0x238a7e(++_0xb74bea);}(_0xdc6b,0x7d));var _0xbdc6=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xdc6b[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0xbdc6('0x0'));var util=require(_0xbdc6('0x1'));var utils=require(_0xbdc6('0x2'));var dispositions=[_0xbdc6('0x3'),_0xbdc6('0x4'),_0xbdc6('0x4'),_0xbdc6('0x3'),_0xbdc6('0x3'),_0xbdc6('0x3'),_0xbdc6('0x5'),_0xbdc6('0x6'),'FAILED','FAILED',_0xbdc6('0x4')];var channels={};function writeDB(_0x142e59){utils['info'](util[_0xbdc6('0x7')](_0xbdc6('0x8'),_0x142e59['uniqueid'],_0x142e59['channel'],_0x142e59[_0xbdc6('0x9')],_0x142e59[_0xbdc6('0xa')],_0x142e59[_0xbdc6('0xb')],_0x142e59[_0xbdc6('0xc')],_0x142e59[_0xbdc6('0xd')],_0x142e59[_0xbdc6('0xe')]));if(_0x142e59['accountcode']){utils[_0xbdc6('0xf')](_0x142e59['accountcode'])[_0xbdc6('0x10')](function(_0x2e8edd){if(_0x2e8edd){_0x142e59[_0xbdc6('0x11')]=_0x2e8edd['id'];}utils[_0xbdc6('0x12')]('CreateVoiceCallReport',_0x142e59);});}else{utils[_0xbdc6('0x12')](_0xbdc6('0x13'),_0x142e59);}if(channels[_0x142e59[_0xbdc6('0x14')]]){delete channels[_0x142e59[_0xbdc6('0x14')]];}}exports[_0xbdc6('0x15')]=function(_0xb954e2){try{utils[_0xbdc6('0x16')](util['format'](_0xbdc6('0x17'),_0xb954e2[_0xbdc6('0x14')]),_0xb954e2);if(_0xb954e2['uniqueid']==_0xb954e2[_0xbdc6('0x18')]&&_0xb954e2[_0xbdc6('0x19')]!=_0xbdc6('0x1a')){utils[_0xbdc6('0x1b')](util[_0xbdc6('0x7')](_0xbdc6('0x1c'),_0xb954e2[_0xbdc6('0x14')],_0xb954e2[_0xbdc6('0x1d')],_0xb954e2[_0xbdc6('0x1e')]));channels[_0xb954e2[_0xbdc6('0x14')]]={'uniqueid':_0xb954e2['uniqueid'],'accountcode':_0xb954e2[_0xbdc6('0x1f')],'source':_0xb954e2[_0xbdc6('0xc')],'destination':_0xb954e2[_0xbdc6('0x1e')],'destinationcontext':_0xb954e2[_0xbdc6('0x1d')],'channel':_0xb954e2[_0xbdc6('0x19')],'starttime':utils[_0xbdc6('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xbdc6('0x21')};}}catch(_0x299317){utils[_0xbdc6('0x22')](util[_0xbdc6('0x7')](_0xbdc6('0x17'),_0xb954e2[_0xbdc6('0x14')]),_0x299317);}};exports['newstate']=function(_0x520813){try{utils[_0xbdc6('0x16')](util[_0xbdc6('0x7')](_0xbdc6('0x23'),_0x520813[_0xbdc6('0x14')]),_0x520813);if(!_[_0xbdc6('0x24')](channels[_0x520813[_0xbdc6('0x14')]])&&_0x520813[_0xbdc6('0x25')]==0x6){utils[_0xbdc6('0x1b')](util[_0xbdc6('0x7')](_0xbdc6('0x26'),_0x520813[_0xbdc6('0x14')],_0x520813[_0xbdc6('0x1d')],_0x520813['channel']));if(_[_0xbdc6('0x24')](channels[_0x520813['uniqueid']]['systemanswertime'])){channels[_0x520813['uniqueid']][_0xbdc6('0x27')]=utils[_0xbdc6('0x20')]();}}else if(!_['isNil'](channels[_0x520813[_0xbdc6('0x18')]])&&_0x520813[_0xbdc6('0x25')]==0x6&&_0x520813['context']!=_0xbdc6('0x28')){utils[_0xbdc6('0x1b')](util[_0xbdc6('0x7')](_0xbdc6('0x29'),_0x520813[_0xbdc6('0x14')],_0x520813[_0xbdc6('0x18')],_0x520813[_0xbdc6('0x1d')],_0x520813['channel']));channels[_0x520813[_0xbdc6('0x18')]][_0xbdc6('0x1f')]=_0x520813[_0xbdc6('0x1f')];channels[_0x520813[_0xbdc6('0x18')]][_0xbdc6('0x2a')]=_0x520813[_0xbdc6('0x19')];if(_[_0xbdc6('0x24')](channels[_0x520813['linkedid']]['answertime'])){channels[_0x520813[_0xbdc6('0x18')]][_0xbdc6('0x2b')]=utils[_0xbdc6('0x20')]();}channels[_0x520813['linkedid']]['disposition']=dispositions[_['toNumber'](_0x520813[_0xbdc6('0x25')])]||_0xbdc6('0x5');}}catch(_0x3184e4){utils[_0xbdc6('0x22')](util[_0xbdc6('0x7')](_0xbdc6('0x23'),_0x520813[_0xbdc6('0x14')]),_0x3184e4);}};exports[_0xbdc6('0x2c')]=function(_0x242254){try{if(!_[_0xbdc6('0x24')](channels[_0x242254[_0xbdc6('0x14')]])){utils[_0xbdc6('0x16')](util['format'](_0xbdc6('0x2d'),_0x242254['uniqueid']),_0x242254);if(_[_0xbdc6('0x24')](channels[_0x242254[_0xbdc6('0x14')]]['callerid'])){channels[_0x242254[_0xbdc6('0x14')]][_0xbdc6('0x2e')]=_0x242254[_0xbdc6('0x2f')]+'\x20<'+_0x242254[_0xbdc6('0xc')]+'>';}utils[_0xbdc6('0x1b')](util[_0xbdc6('0x7')](_0xbdc6('0x30'),_0x242254['uniqueid'],channels[_0x242254[_0xbdc6('0x14')]][_0xbdc6('0x2e')],_0x242254[_0xbdc6('0x31')]));channels[_0x242254['uniqueid']][_0xbdc6('0x32')]=utils[_0xbdc6('0x20')]();channels[_0x242254[_0xbdc6('0x14')]][_0xbdc6('0x33')]=utils[_0xbdc6('0x34')](channels[_0x242254[_0xbdc6('0x14')]][_0xbdc6('0x32')],channels[_0x242254['uniqueid']][_0xbdc6('0x35')]);channels[_0x242254[_0xbdc6('0x14')]][_0xbdc6('0x36')]=channels[_0x242254[_0xbdc6('0x14')]][_0xbdc6('0x2b')]?utils[_0xbdc6('0x34')](channels[_0x242254['uniqueid']]['endtime'],channels[_0x242254[_0xbdc6('0x14')]][_0xbdc6('0x2b')]):0x0;writeDB(channels[_0x242254[_0xbdc6('0x14')]]);}}catch(_0x33273d){utils[_0xbdc6('0x22')](util[_0xbdc6('0x7')]('[%s][calls][hangup]',_0x242254[_0xbdc6('0x14')]),_0x33273d);}};exports[_0xbdc6('0x37')]=function(_0x2f8a36){try{if(!_[_0xbdc6('0x24')](channels[_0x2f8a36[_0xbdc6('0x38')]])){utils[_0xbdc6('0x16')](util[_0xbdc6('0x7')](_0xbdc6('0x39'),_0x2f8a36['origtransfereruniqueid']),_0x2f8a36);if(channels[_0x2f8a36[_0xbdc6('0x38')]][_0xbdc6('0x19')]==_0x2f8a36[_0xbdc6('0x3a')]){utils[_0xbdc6('0x1b')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2f8a36['origtransfereruniqueid'],_0x2f8a36['localtwolinkedid'],_0x2f8a36['secondtransfererchannel']));channels[_0x2f8a36[_0xbdc6('0x38')]]['destinationchannel']=_0x2f8a36[_0xbdc6('0x3b')];channels[_0x2f8a36['localtwolinkedid']]['userfield']='_attended';}else if(channels[_0x2f8a36[_0xbdc6('0x38')]][_0xbdc6('0x19')]=_0x2f8a36['transfertargetchannel']){utils[_0xbdc6('0x1b')](util[_0xbdc6('0x7')](_0xbdc6('0x3c'),_0x2f8a36['origtransfereruniqueid'],_0x2f8a36[_0xbdc6('0x38')],_0x2f8a36[_0xbdc6('0x3d')]));channels[_0x2f8a36['localtwolinkedid']][_0xbdc6('0x2a')]=_0x2f8a36[_0xbdc6('0x3d')];channels[_0x2f8a36['localtwolinkedid']]['userfield']=_0xbdc6('0x3e');}}}catch(_0x323261){utils[_0xbdc6('0x22')](util['format'](_0xbdc6('0x39'),_0x2f8a36[_0xbdc6('0x3f')]),_0x323261);}};exports[_0xbdc6('0x40')]=function(_0x263f41){try{if(!_[_0xbdc6('0x24')](channels[_0x263f41[_0xbdc6('0x14')]])){utils[_0xbdc6('0x16')](util[_0xbdc6('0x7')](_0xbdc6('0x41'),_0x263f41[_0xbdc6('0x14')]),_0x263f41);channels[_0x263f41[_0xbdc6('0x14')]][_0xbdc6('0x42')]=utils[_0xbdc6('0x20')]();utils['info'](util[_0xbdc6('0x7')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x263f41[_0xbdc6('0x14')],channels[_0x263f41['uniqueid']][_0xbdc6('0x42')]));}}catch(_0x5201d4){utils[_0xbdc6('0x22')](util[_0xbdc6('0x7')](_0xbdc6('0x41'),_0x263f41[_0xbdc6('0x14')]),_0x5201d4);}};exports[_0xbdc6('0x43')]=function(_0x5d7fbc){try{if(!_[_0xbdc6('0x24')](channels[_0x5d7fbc['uniqueid']])){utils[_0xbdc6('0x16')](util[_0xbdc6('0x7')](_0xbdc6('0x44'),_0x5d7fbc[_0xbdc6('0x14')]),_0x5d7fbc);if(!_[_0xbdc6('0x24')](channels[_0x5d7fbc[_0xbdc6('0x14')]][_0xbdc6('0x42')])){channels[_0x5d7fbc['uniqueid']]['mohtime']+=utils[_0xbdc6('0x34')](utils['now'](),channels[_0x5d7fbc['uniqueid']][_0xbdc6('0x42')]);utils['info'](util['format'](_0xbdc6('0x45'),_0x5d7fbc[_0xbdc6('0x14')],channels[_0x5d7fbc[_0xbdc6('0x14')]]['mohtime']));delete channels[_0x5d7fbc['uniqueid']]['musiconholdstartAt'];}}}catch(_0x114062){utils['error'](util[_0xbdc6('0x7')](_0xbdc6('0x44'),_0x5d7fbc[_0xbdc6('0x14')]),_0x114062);}};exports['varset']=function(_0x1f656e){try{if(!_[_0xbdc6('0x24')](channels[_0x1f656e[_0xbdc6('0x14')]])){utils['debug'](util['format']('[%s][calls][varset]',_0x1f656e[_0xbdc6('0x14')]),_0x1f656e);if(!_[_0xbdc6('0x24')](_0x1f656e[_0xbdc6('0x46')][_0xbdc6('0x47')])){utils[_0xbdc6('0x1b')](util[_0xbdc6('0x7')](_0xbdc6('0x48'),_0x1f656e[_0xbdc6('0x14')],_0x1f656e['value']));channels[_0x1f656e[_0xbdc6('0x14')]][_0xbdc6('0x49')]=_0x1f656e[_0xbdc6('0x4a')];}if(!_[_0xbdc6('0x24')](_0x1f656e[_0xbdc6('0x46')][_0xbdc6('0x4b')])){utils[_0xbdc6('0x1b')](util[_0xbdc6('0x7')](_0xbdc6('0x4c'),_0x1f656e[_0xbdc6('0x14')],_0x1f656e['value']));channels[_0x1f656e[_0xbdc6('0x14')]][_0xbdc6('0x4d')]=_0x1f656e[_0xbdc6('0x4a')];channels[_0x1f656e[_0xbdc6('0x14')]][_0xbdc6('0x2e')]='\x22'+_0x1f656e[_0xbdc6('0x4a')]+_0xbdc6('0x4e')+_0x1f656e[_0xbdc6('0x4a')]+'>';}if(!_[_0xbdc6('0x24')](_0x1f656e[_0xbdc6('0x46')][_0xbdc6('0x4f')])||!_[_0xbdc6('0x24')](_0x1f656e[_0xbdc6('0x46')][_0xbdc6('0x50')])){utils[_0xbdc6('0x1b')](util[_0xbdc6('0x7')](_0xbdc6('0x51'),_0x1f656e[_0xbdc6('0x14')],!_[_0xbdc6('0x24')](_0x1f656e[_0xbdc6('0x46')]['xmd-callerid-preview'])?'xmd-callerid-preview':_0xbdc6('0x50'),_0x1f656e[_0xbdc6('0x4a')]));channels[_0x1f656e['uniqueid']][_0xbdc6('0x2e')]=_0x1f656e[_0xbdc6('0x4a')];}if(!_[_0xbdc6('0x24')](_0x1f656e[_0xbdc6('0x46')][_0xbdc6('0x52')])||!_[_0xbdc6('0x24')](_0x1f656e[_0xbdc6('0x46')][_0xbdc6('0x53')])){utils[_0xbdc6('0x1b')](util['format'](_0xbdc6('0x51'),_0x1f656e[_0xbdc6('0x14')],!_[_0xbdc6('0x24')](_0x1f656e[_0xbdc6('0x46')][_0xbdc6('0x52')])?_0xbdc6('0x52'):_0xbdc6('0x53'),_0x1f656e[_0xbdc6('0x4a')]));channels[_0x1f656e[_0xbdc6('0x14')]][_0xbdc6('0x54')]=_0xbdc6('0x55');channels[_0x1f656e[_0xbdc6('0x14')]][_0xbdc6('0x56')]=_0x1f656e[_0xbdc6('0x4a')];channels[_0x1f656e[_0xbdc6('0x14')]][_0xbdc6('0x9')]=!![];}if(!_['isNil'](_0x1f656e[_0xbdc6('0x46')][_0xbdc6('0x57')])){utils[_0xbdc6('0x1b')](util[_0xbdc6('0x7')](_0xbdc6('0x58'),_0x1f656e['uniqueid'],_0x1f656e[_0xbdc6('0x4a')]));channels[_0x1f656e[_0xbdc6('0x14')]][_0xbdc6('0x59')]=_0x1f656e['value'];}if(!_[_0xbdc6('0x24')](_0x1f656e[_0xbdc6('0x46')][_0xbdc6('0x5a')])){utils['info'](util[_0xbdc6('0x7')](_0xbdc6('0x5b'),_0x1f656e['uniqueid'],_0x1f656e['value']));channels[_0x1f656e['uniqueid']][_0xbdc6('0x5c')]=_0x1f656e[_0xbdc6('0x4a')];}if(!_[_0xbdc6('0x24')](_0x1f656e[_0xbdc6('0x46')]['outboundrouteid'])){utils[_0xbdc6('0x1b')](util[_0xbdc6('0x7')](_0xbdc6('0x5d'),_0x1f656e[_0xbdc6('0x14')],_0x1f656e[_0xbdc6('0x4a')]));channels[_0x1f656e[_0xbdc6('0x14')]][_0xbdc6('0x5e')]=_0x1f656e[_0xbdc6('0x4a')];}if(!_[_0xbdc6('0x24')](_0x1f656e[_0xbdc6('0x46')][_0xbdc6('0x5f')])){utils['info'](util[_0xbdc6('0x7')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1f656e[_0xbdc6('0x14')],_0x1f656e[_0xbdc6('0x4a')]));channels[_0x1f656e[_0xbdc6('0x14')]][_0xbdc6('0x5f')]=_0x1f656e[_0xbdc6('0x4a')];}}}catch(_0x1b2e75){utils[_0xbdc6('0x22')](util[_0xbdc6('0x7')](_0xbdc6('0x60'),_0x1f656e[_0xbdc6('0x14')]),_0x1b2e75);}};exports[_0xbdc6('0x61')]=function(_0xa5cb60){try{if(!_['isNil'](channels[_0xa5cb60[_0xbdc6('0x14')]])){utils[_0xbdc6('0x16')](util['format'](_0xbdc6('0x62'),_0xa5cb60[_0xbdc6('0x14')]),_0xa5cb60);utils[_0xbdc6('0x1b')](util[_0xbdc6('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0xa5cb60['uniqueid'],_0xa5cb60[_0xbdc6('0x63')],_0xa5cb60['appdata']));if(_0xa5cb60[_0xbdc6('0x63')][_0xbdc6('0x64')]()==_0xbdc6('0x65')&&_[_0xbdc6('0x66')](_0xa5cb60[_0xbdc6('0x67')][_0xbdc6('0x64')](),_0xbdc6('0x68'))){var _0x424e79=_0xa5cb60[_0xbdc6('0x67')][_0xbdc6('0x69')]('=');var _0x113b14=_0x424e79[0x0][_0xbdc6('0x6a')](_0x424e79[0x0]['lastIndexOf']('(')+0x1,_0x424e79[0x0]['lastIndexOf'](')'));var _0x1702c6=_0x424e79[0x1];channels[_0xa5cb60[_0xbdc6('0x14')]][_0x113b14]=_0x1702c6;}if(!_[_0xbdc6('0x6b')]([_0xbdc6('0x2c'),'noop',_0xbdc6('0x6c'),_0xbdc6('0x65'),'gotoif'],_0xa5cb60[_0xbdc6('0x63')]['toLowerCase']())){channels[_0xa5cb60['uniqueid']][_0xbdc6('0x54')]=_0xa5cb60[_0xbdc6('0x63')];channels[_0xa5cb60[_0xbdc6('0x14')]]['lastdata']=_0xa5cb60[_0xbdc6('0x67')];}}}catch(_0x1681b9){utils[_0xbdc6('0x22')](util[_0xbdc6('0x7')]('[%s][calls][newexten]',_0xa5cb60[_0xbdc6('0x14')]),_0x1681b9);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index ec4303d..0d16a32 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 _0x1fb5=['[core]\x20error','close','[core]\x20close','managerevent','./utils','shutdown','info','fullybooted','[core]\x20fullybooted','error'];(function(_0x1d0be2,_0xdeab6c){var _0x52cce2=function(_0x326be7){while(--_0x326be7){_0x1d0be2['push'](_0x1d0be2['shift']());}};_0x52cce2(++_0xdeab6c);}(_0x1fb5,0xa4));var _0x51fb=function(_0x1e821b,_0x57680d){_0x1e821b=_0x1e821b-0x0;var _0x3c5700=_0x1fb5[_0x1e821b];return _0x3c5700;};'use strict';var utils=require(_0x51fb('0x0'));exports['connect']=function(){utils['info']('[core]\x20connected');};exports[_0x51fb('0x1')]=function(){utils[_0x51fb('0x2')]('[core]\x20shutdown');};exports[_0x51fb('0x3')]=function(){utils[_0x51fb('0x2')](_0x51fb('0x4'));};exports[_0x51fb('0x5')]=function(_0x321318){utils[_0x51fb('0x5')](_0x51fb('0x6'),_0x321318);};exports[_0x51fb('0x7')]=function(){utils[_0x51fb('0x2')](_0x51fb('0x8'));};exports[_0x51fb('0x9')]=function(_0x22ea3a){}; \ No newline at end of file +var _0x589f=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils','info','[core]\x20connected','[core]\x20shutdown'];(function(_0x35c97a,_0x513aba){var _0x388917=function(_0xa1f4e1){while(--_0xa1f4e1){_0x35c97a['push'](_0x35c97a['shift']());}};_0x388917(++_0x513aba);}(_0x589f,0x1e6));var _0xf589=function(_0x4c9cc4,_0x1b6528){_0x4c9cc4=_0x4c9cc4-0x0;var _0x4384fb=_0x589f[_0x4c9cc4];return _0x4384fb;};'use strict';var utils=require(_0xf589('0x0'));exports['connect']=function(){utils[_0xf589('0x1')](_0xf589('0x2'));};exports['shutdown']=function(){utils[_0xf589('0x1')](_0xf589('0x3'));};exports[_0xf589('0x4')]=function(){utils[_0xf589('0x1')](_0xf589('0x5'));};exports['error']=function(_0x10f642){utils[_0xf589('0x6')](_0xf589('0x7'),_0x10f642);};exports['close']=function(){utils[_0xf589('0x1')](_0xf589('0x8'));};exports[_0xf589('0x9')]=function(_0x1541fc){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index ee6dd2e..258a5fd 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 _0x2a41=['application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','dialbegin','[%s][dials][dialbegin]','starttime','lastevent','called','dialend','isNil','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete','duration','diffTime','endtime','[%s][dials][hangup]','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s'];(function(_0x34d8f9,_0xb4dffa){var _0x4d8bf2=function(_0x2b9b48){while(--_0x2b9b48){_0x34d8f9['push'](_0x34d8f9['shift']());}};_0x4d8bf2(++_0xb4dffa);}(_0x2a41,0x85));var _0x12a4=function(_0x35c1db,_0xd75c15){_0x35c1db=_0x35c1db-0x0;var _0x4173ff=_0x2a41[_0x35c1db];return _0x4173ff;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x12a4('0x0'));var dials={};function writeDB(_0x44917a){utils[_0x12a4('0x1')](util[_0x12a4('0x2')](_0x12a4('0x3'),_0x44917a[_0x12a4('0x4')],_0x44917a[_0x12a4('0x5')],_0x44917a['dialstring'],_0x44917a['calleridnum'],_0x44917a[_0x12a4('0x6')],_0x44917a[_0x12a4('0x7')]));utils[_0x12a4('0x8')](_0x12a4('0x9'),_0x44917a);delete dials[_0x44917a[_0x12a4('0x4')]];}exports[_0x12a4('0xa')]=function(_0x35abcf){try{utils[_0x12a4('0xb')](util[_0x12a4('0x2')](_0x12a4('0xc'),_0x35abcf['uniqueid']),_0x35abcf);utils[_0x12a4('0x1')](util['format'](_0x12a4('0xd'),_0x35abcf[_0x12a4('0x4')],_0x35abcf[_0x12a4('0xe')],_0x35abcf[_0x12a4('0xf')]));if(_0x35abcf[_0x12a4('0xe')][_0x12a4('0x10')]()==_0x12a4('0x11')&&_[_0x12a4('0x12')](_0x35abcf[_0x12a4('0xf')][_0x12a4('0x10')](),_0x12a4('0x13'))){var _0x4a72e0=_0x35abcf[_0x12a4('0xf')][_0x12a4('0x14')]('=');dials[_0x35abcf['uniqueid']]={'routeId':_0x4a72e0[0x1]};}}catch(_0x552d9e){utils[_0x12a4('0x15')](util[_0x12a4('0x2')]('[%s][dials][newexten]',_0x35abcf[_0x12a4('0x4')]),_0x552d9e);}};exports['varset']=function(_0x7311b0){try{utils['debug'](util[_0x12a4('0x2')](_0x12a4('0x16'),_0x7311b0['uniqueid']),_0x7311b0);if(!_['isNil'](_0x7311b0[_0x12a4('0x17')][_0x12a4('0x18')])){utils[_0x12a4('0x1')](util['format'](_0x12a4('0x19'),_0x7311b0[_0x12a4('0x4')],_0x7311b0['value']));dials[_0x7311b0[_0x12a4('0x4')]]={'routeId':_0x7311b0['value']};}}catch(_0xc5e5f8){utils[_0x12a4('0x15')](util[_0x12a4('0x2')](_0x12a4('0x16'),_0x7311b0[_0x12a4('0x4')]),_0xc5e5f8);}};exports[_0x12a4('0x1a')]=function(_0x11f49d){try{if(!_['isNil'](dials[_0x11f49d[_0x12a4('0x4')]])){utils[_0x12a4('0xb')](util[_0x12a4('0x2')](_0x12a4('0x1b'),_0x11f49d['uniqueid']),_0x11f49d);dials[_0x11f49d[_0x12a4('0x4')]]=_['assign'](dials[_0x11f49d['uniqueid']],_0x11f49d);dials[_0x11f49d[_0x12a4('0x4')]][_0x12a4('0x1c')]=utils['now']();dials[_0x11f49d[_0x12a4('0x4')]][_0x12a4('0x1d')]=_0x12a4('0x1e');utils['info'](util[_0x12a4('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x11f49d['uniqueid'],dials[_0x11f49d[_0x12a4('0x4')]][_0x12a4('0x1c')]));}}catch(_0x318d2a){utils['error'](util[_0x12a4('0x2')](_0x12a4('0x1b'),_0x11f49d[_0x12a4('0x4')]),_0x318d2a);}};exports[_0x12a4('0x1f')]=function(_0x6d0c00){try{if(!_[_0x12a4('0x20')](dials[_0x6d0c00[_0x12a4('0x4')]])){utils[_0x12a4('0xb')](util[_0x12a4('0x2')](_0x12a4('0x21'),_0x6d0c00[_0x12a4('0x4')]),_0x6d0c00);dials[_0x6d0c00[_0x12a4('0x4')]][_0x12a4('0x7')]=_0x6d0c00[_0x12a4('0x7')];if(_0x6d0c00[_0x12a4('0x7')]==_0x12a4('0x22')){dials[_0x6d0c00[_0x12a4('0x4')]]=_[_0x12a4('0x23')](dials[_0x6d0c00[_0x12a4('0x4')]],_0x6d0c00);dials[_0x6d0c00[_0x12a4('0x4')]][_0x12a4('0x24')]=utils['now']();dials[_0x6d0c00[_0x12a4('0x4')]][_0x12a4('0x1d')]=_0x12a4('0x25');utils[_0x12a4('0x1')](util[_0x12a4('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x6d0c00[_0x12a4('0x4')],_0x6d0c00[_0x12a4('0x7')],dials[_0x6d0c00['uniqueid']][_0x12a4('0x24')]));}else{utils[_0x12a4('0x1')](util['format'](_0x12a4('0x26'),_0x6d0c00[_0x12a4('0x4')],_0x6d0c00[_0x12a4('0x7')]));}}}catch(_0x2ecea9){utils[_0x12a4('0x15')](util['format'](_0x12a4('0x21'),_0x6d0c00[_0x12a4('0x4')]),_0x2ecea9);}};exports[_0x12a4('0x27')]=function(_0x512c88){try{if(!_[_0x12a4('0x20')](dials[_0x512c88[_0x12a4('0x4')]])){utils[_0x12a4('0xb')](util[_0x12a4('0x2')]('[%s][dials][hangup]',_0x512c88[_0x12a4('0x4')]),_0x512c88);utils[_0x12a4('0x1')](util[_0x12a4('0x2')](_0x12a4('0x28'),_0x512c88[_0x12a4('0x4')],_0x512c88[_0x12a4('0x29')],_0x512c88[_0x12a4('0x2a')],_0x512c88[_0x12a4('0x2b')]));dials[_0x512c88['uniqueid']]=_['assign'](dials[_0x512c88[_0x12a4('0x4')]],{'endtime':utils['now'](),'lastevent':_0x12a4('0x2c')});dials[_0x512c88[_0x12a4('0x4')]][_0x12a4('0x2d')]=utils['diffTime'](dials[_0x512c88[_0x12a4('0x4')]]['endtime'],dials[_0x512c88[_0x12a4('0x4')]][_0x12a4('0x1c')]);dials[_0x512c88[_0x12a4('0x4')]]['holdtime']=utils[_0x12a4('0x2e')](dials[_0x512c88[_0x12a4('0x4')]][_0x12a4('0x24')]||dials[_0x512c88['uniqueid']][_0x12a4('0x2f')],dials[_0x512c88['uniqueid']]['starttime']);dials[_0x512c88[_0x12a4('0x4')]]['billableseconds']=dials[_0x512c88['uniqueid']][_0x12a4('0x24')]?utils[_0x12a4('0x2e')](dials[_0x512c88[_0x12a4('0x4')]][_0x12a4('0x2f')],dials[_0x512c88['uniqueid']][_0x12a4('0x24')]):0x0;writeDB(dials[_0x512c88[_0x12a4('0x4')]]);}}catch(_0x3c32a4){utils['error'](util['format'](_0x12a4('0x30'),_0x512c88[_0x12a4('0x4')]),_0x3c32a4);}}; \ No newline at end of file +var _0x5539=['endtime','holdtime','lodash','util','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','dialend','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','calleridname','cause-txt','duration','diffTime'];(function(_0x5c4585,_0x3d0eab){var _0x21dede=function(_0x5c3d6a){while(--_0x5c3d6a){_0x5c4585['push'](_0x5c4585['shift']());}};_0x21dede(++_0x3d0eab);}(_0x5539,0x160));var _0x9553=function(_0x3a9a7e,_0x439bb7){_0x3a9a7e=_0x3a9a7e-0x0;var _0x5dac11=_0x5539[_0x3a9a7e];return _0x5dac11;};'use strict';var _=require(_0x9553('0x0'));var util=require(_0x9553('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x35ea20){utils['info'](util['format'](_0x9553('0x2'),_0x35ea20[_0x9553('0x3')],_0x35ea20['channel'],_0x35ea20[_0x9553('0x4')],_0x35ea20[_0x9553('0x5')],_0x35ea20[_0x9553('0x6')],_0x35ea20[_0x9553('0x7')]));utils[_0x9553('0x8')](_0x9553('0x9'),_0x35ea20);delete dials[_0x35ea20[_0x9553('0x3')]];}exports[_0x9553('0xa')]=function(_0x499cbf){try{utils[_0x9553('0xb')](util[_0x9553('0xc')](_0x9553('0xd'),_0x499cbf['uniqueid']),_0x499cbf);utils[_0x9553('0xe')](util['format'](_0x9553('0xf'),_0x499cbf[_0x9553('0x3')],_0x499cbf[_0x9553('0x10')],_0x499cbf['appdata']));if(_0x499cbf['application'][_0x9553('0x11')]()==_0x9553('0x12')&&_[_0x9553('0x13')](_0x499cbf[_0x9553('0x14')][_0x9553('0x11')](),_0x9553('0x15'))){var _0x1a598b=_0x499cbf['appdata'][_0x9553('0x16')]('=');dials[_0x499cbf[_0x9553('0x3')]]={'routeId':_0x1a598b[0x1]};}}catch(_0x28cc0e){utils[_0x9553('0x17')](util[_0x9553('0xc')](_0x9553('0xd'),_0x499cbf[_0x9553('0x3')]),_0x28cc0e);}};exports[_0x9553('0x18')]=function(_0x3afbd8){try{utils[_0x9553('0xb')](util[_0x9553('0xc')]('[%s][dials][varset]',_0x3afbd8['uniqueid']),_0x3afbd8);if(!_[_0x9553('0x19')](_0x3afbd8[_0x9553('0x1a')][_0x9553('0x1b')])){utils['info'](util[_0x9553('0xc')](_0x9553('0x1c'),_0x3afbd8[_0x9553('0x3')],_0x3afbd8['value']));dials[_0x3afbd8[_0x9553('0x3')]]={'routeId':_0x3afbd8[_0x9553('0x1d')]};}}catch(_0x4be402){utils[_0x9553('0x17')](util[_0x9553('0xc')](_0x9553('0x1e'),_0x3afbd8['uniqueid']),_0x4be402);}};exports['dialbegin']=function(_0x2ea795){try{if(!_[_0x9553('0x19')](dials[_0x2ea795[_0x9553('0x3')]])){utils[_0x9553('0xb')](util[_0x9553('0xc')](_0x9553('0x1f'),_0x2ea795[_0x9553('0x3')]),_0x2ea795);dials[_0x2ea795[_0x9553('0x3')]]=_[_0x9553('0x20')](dials[_0x2ea795[_0x9553('0x3')]],_0x2ea795);dials[_0x2ea795[_0x9553('0x3')]][_0x9553('0x21')]=utils[_0x9553('0x22')]();dials[_0x2ea795[_0x9553('0x3')]][_0x9553('0x23')]=_0x9553('0x24');utils[_0x9553('0xe')](util[_0x9553('0xc')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x2ea795[_0x9553('0x3')],dials[_0x2ea795['uniqueid']][_0x9553('0x21')]));}}catch(_0x4be614){utils['error'](util[_0x9553('0xc')]('[%s][dials][dialbegin]',_0x2ea795[_0x9553('0x3')]),_0x4be614);}};exports[_0x9553('0x25')]=function(_0x50a9c7){try{if(!_[_0x9553('0x19')](dials[_0x50a9c7[_0x9553('0x3')]])){utils[_0x9553('0xb')](util['format'](_0x9553('0x26'),_0x50a9c7[_0x9553('0x3')]),_0x50a9c7);dials[_0x50a9c7[_0x9553('0x3')]][_0x9553('0x7')]=_0x50a9c7[_0x9553('0x7')];if(_0x50a9c7[_0x9553('0x7')]=='ANSWER'){dials[_0x50a9c7[_0x9553('0x3')]]=_['assign'](dials[_0x50a9c7['uniqueid']],_0x50a9c7);dials[_0x50a9c7[_0x9553('0x3')]][_0x9553('0x27')]=utils[_0x9553('0x22')]();dials[_0x50a9c7[_0x9553('0x3')]][_0x9553('0x23')]=_0x9553('0x28');utils[_0x9553('0xe')](util[_0x9553('0xc')](_0x9553('0x29'),_0x50a9c7[_0x9553('0x3')],_0x50a9c7[_0x9553('0x7')],dials[_0x50a9c7['uniqueid']]['answertime']));}else{utils[_0x9553('0xe')](util[_0x9553('0xc')](_0x9553('0x2a'),_0x50a9c7[_0x9553('0x3')],_0x50a9c7[_0x9553('0x7')]));}}}catch(_0x403823){utils[_0x9553('0x17')](util[_0x9553('0xc')](_0x9553('0x26'),_0x50a9c7['uniqueid']),_0x403823);}};exports[_0x9553('0x2b')]=function(_0xf129ec){try{if(!_[_0x9553('0x19')](dials[_0xf129ec['uniqueid']])){utils[_0x9553('0xb')](util['format']('[%s][dials][hangup]',_0xf129ec['uniqueid']),_0xf129ec);utils[_0x9553('0xe')](util[_0x9553('0xc')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0xf129ec[_0x9553('0x3')],_0xf129ec[_0x9553('0x5')],_0xf129ec[_0x9553('0x2c')],_0xf129ec[_0x9553('0x2d')]));dials[_0xf129ec[_0x9553('0x3')]]=_[_0x9553('0x20')](dials[_0xf129ec[_0x9553('0x3')]],{'endtime':utils[_0x9553('0x22')](),'lastevent':'complete'});dials[_0xf129ec[_0x9553('0x3')]][_0x9553('0x2e')]=utils[_0x9553('0x2f')](dials[_0xf129ec['uniqueid']][_0x9553('0x30')],dials[_0xf129ec['uniqueid']][_0x9553('0x21')]);dials[_0xf129ec['uniqueid']][_0x9553('0x31')]=utils[_0x9553('0x2f')](dials[_0xf129ec[_0x9553('0x3')]][_0x9553('0x27')]||dials[_0xf129ec[_0x9553('0x3')]][_0x9553('0x30')],dials[_0xf129ec[_0x9553('0x3')]][_0x9553('0x21')]);dials[_0xf129ec[_0x9553('0x3')]]['billableseconds']=dials[_0xf129ec[_0x9553('0x3')]][_0x9553('0x27')]?utils[_0x9553('0x2f')](dials[_0xf129ec[_0x9553('0x3')]][_0x9553('0x30')],dials[_0xf129ec[_0x9553('0x3')]][_0x9553('0x27')]):0x0;writeDB(dials[_0xf129ec['uniqueid']]);}}catch(_0x138b27){utils[_0x9553('0x17')](util[_0x9553('0xc')]('[%s][dials][hangup]',_0xf129ec[_0x9553('0x3')]),_0x138b27);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 7820423..a7ae59e 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 _0x34ca=['[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','port','asterisk','xdr','disabled','info','XDR\x20DISABLED','./queues.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled'];(function(_0x3c0a1b,_0x5a452){var _0x38c9df=function(_0x524383){while(--_0x524383){_0x3c0a1b['push'](_0x3c0a1b['shift']());}};_0x38c9df(++_0x5a452);}(_0x34ca,0xdf));var _0xa34c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x34ca[_0x126558];return _0x1f6d14;};var AsteriskManager=require(_0xa34c('0x0'));var config=require(_0xa34c('0x1'));var utils=require('./utils');var util=require(_0xa34c('0x2'));var ami=new AsteriskManager(config['asterisk'][_0xa34c('0x3')],config[_0xa34c('0x4')]['ip'],config['asterisk']['username'],config[_0xa34c('0x4')]['password'],!![]);ami['keepConnected']();if(config[_0xa34c('0x5')]&&config[_0xa34c('0x5')][_0xa34c('0x6')]){utils[_0xa34c('0x7')](_0xa34c('0x8'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0xa34c('0x9'));var recordings=require('./recordings.controller');var members=require(_0xa34c('0xa'));var dials=require(_0xa34c('0xb'));var transfers=require(_0xa34c('0xc'));var core=require('./core.controller');ami['on'](_0xa34c('0xd'),core[_0xa34c('0xd')]);ami['on'](_0xa34c('0xe'),core[_0xa34c('0xe')]);ami['on'](_0xa34c('0xf'),core['fullybooted']);ami['on'](_0xa34c('0x10'),core[_0xa34c('0x10')]);ami['on'](_0xa34c('0x11'),core[_0xa34c('0x11')]);ami['on'](_0xa34c('0x12'),core[_0xa34c('0x12')]);ami['on'](_0xa34c('0x13'),function(_0x17fc9a){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')]('[%s][index][devicestatechange]',_0x17fc9a[_0xa34c('0x16')]),_0x17fc9a);members['devicestatechange'](_0x17fc9a);}catch(_0x490c12){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x17'),_0x17fc9a[_0xa34c('0x16')]),_0x490c12);}});ami['on'](_0xa34c('0x18'),function(_0x5ec685){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')](_0xa34c('0x19'),_0x5ec685[_0xa34c('0x1a')]),_0x5ec685);agents[_0xa34c('0x18')](_0x5ec685);}catch(_0x111aeb){utils['error'](util[_0xa34c('0x15')](_0xa34c('0x19'),_0x5ec685[_0xa34c('0x1a')]),_0x111aeb);}});ami['on'](_0xa34c('0x1b'),function(_0x4dc404){try{utils[_0xa34c('0x14')](util['format'](_0xa34c('0x1c'),_0x4dc404[_0xa34c('0x1a')]),_0x4dc404);agents[_0xa34c('0x1b')](_0x4dc404);}catch(_0x54b11a){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x1c'),_0x4dc404[_0xa34c('0x1a')]),_0x54b11a);}});ami['on'](_0xa34c('0x1d'),function(_0x258a06){try{utils['debug'](util[_0xa34c('0x15')](_0xa34c('0x1e'),_0x258a06['uniqueid']),_0x258a06);agents[_0xa34c('0x1d')](_0x258a06);queues['agentconnect'](_0x258a06);}catch(_0x17410c){utils['error'](util['format'](_0xa34c('0x1e'),_0x258a06[_0xa34c('0x1a')]),_0x17410c);}});ami['on'](_0xa34c('0x1f'),function(_0x171c85){try{utils[_0xa34c('0x14')](util['format'](_0xa34c('0x20'),_0x171c85[_0xa34c('0x1a')]),_0x171c85);agents[_0xa34c('0x1f')](_0x171c85);queues[_0xa34c('0x1f')](_0x171c85);members[_0xa34c('0x1f')](_0x171c85);}catch(_0x48f0fd){utils['error'](util[_0xa34c('0x15')]('[%s][index][agentcomplete]',_0x171c85[_0xa34c('0x1a')]),_0x48f0fd);}});ami['on'](_0xa34c('0x21'),function(_0x1a68ae){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')](_0xa34c('0x22'),_0x1a68ae[_0xa34c('0x1a')]),_0x1a68ae);agents[_0xa34c('0x21')](_0x1a68ae);queues[_0xa34c('0x21')](_0x1a68ae);}catch(_0x1f095a){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x22'),_0x1a68ae[_0xa34c('0x1a')]),_0x1f095a);}});ami['on'](_0xa34c('0x23'),function(_0x24fafa){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')]('[%s][index][queuecallerjoin]',_0x24fafa[_0xa34c('0x1a')]),_0x24fafa);queues[_0xa34c('0x23')](_0x24fafa);recordings[_0xa34c('0x23')](_0x24fafa);}catch(_0x463827){utils[_0xa34c('0x10')](util[_0xa34c('0x15')]('[%s][index][queuecallerjoin]',_0x24fafa[_0xa34c('0x1a')]),_0x463827);}});ami['on'](_0xa34c('0x24'),function(_0xfd162e){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')](_0xa34c('0x25'),_0xfd162e[_0xa34c('0x1a')]),_0xfd162e);queues[_0xa34c('0x24')](_0xfd162e);}catch(_0x473465){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x25'),_0xfd162e[_0xa34c('0x1a')]),_0x473465);}});ami['on'](_0xa34c('0x26'),function(_0x18a831){try{utils['debug'](util[_0xa34c('0x15')](_0xa34c('0x27'),_0x18a831[_0xa34c('0x1a')]),_0x18a831);queues[_0xa34c('0x26')](_0x18a831);calls[_0xa34c('0x26')](_0x18a831);}catch(_0x2b124c){utils[_0xa34c('0x10')](util[_0xa34c('0x15')]('[%s][index][musiconholdstart]',_0x18a831[_0xa34c('0x1a')]),_0x2b124c);}});ami['on'](_0xa34c('0x28'),function(_0x522c9e){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')]('[%s][index][musiconholdstop]',_0x522c9e['uniqueid']),_0x522c9e);queues[_0xa34c('0x28')](_0x522c9e);calls[_0xa34c('0x28')](_0x522c9e);}catch(_0x11d0fc){utils[_0xa34c('0x10')](util['format'](_0xa34c('0x29'),_0x522c9e[_0xa34c('0x1a')]),_0x11d0fc);}});ami['on'](_0xa34c('0x2a'),function(_0x1f4894){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')]('[%s][index][newstate]',_0x1f4894[_0xa34c('0x1a')]),_0x1f4894);calls['newstate'](_0x1f4894);recordings[_0xa34c('0x2a')](_0x1f4894);}catch(_0x134bcb){utils['error'](util[_0xa34c('0x15')]('[%s][index][newstate]',_0x1f4894[_0xa34c('0x1a')]),_0x134bcb);}});ami['on'](_0xa34c('0x2b'),function(_0x526f1f){try{utils[_0xa34c('0x14')](util['format'](_0xa34c('0x2c'),_0x526f1f[_0xa34c('0x1a')]),_0x526f1f);calls[_0xa34c('0x2b')](_0x526f1f);recordings[_0xa34c('0x2b')](_0x526f1f);dials[_0xa34c('0x2b')](_0x526f1f);agents[_0xa34c('0x2b')](_0x526f1f);queues[_0xa34c('0x2b')](_0x526f1f);}catch(_0x57cc5f){utils['error'](util[_0xa34c('0x15')](_0xa34c('0x2c'),_0x526f1f[_0xa34c('0x1a')]),_0x57cc5f);}});ami['on']('cdr',function(_0x59a100){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')]('[%s][index][cdr]',_0x59a100['uniqueid']),_0x59a100);members['cdr'](_0x59a100);}catch(_0x16e8b5){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x2d'),_0x59a100[_0xa34c('0x1a')]),_0x16e8b5);}});ami['on'](_0xa34c('0x2e'),function(_0x4cc865){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')](_0xa34c('0x2f'),_0x4cc865[_0xa34c('0x1a')]),_0x4cc865);queues[_0xa34c('0x2e')](_0x4cc865);agents[_0xa34c('0x2e')](_0x4cc865);transfers[_0xa34c('0x2e')](_0x4cc865);}catch(_0x4aaa8e){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x2f'),_0x4cc865[_0xa34c('0x1a')]),_0x4aaa8e);}});ami['on'](_0xa34c('0x30'),function(_0x1f0496){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')](_0xa34c('0x31'),_0x1f0496[_0xa34c('0x32')]),_0x1f0496);queues[_0xa34c('0x30')](_0x1f0496);transfers[_0xa34c('0x30')](_0x1f0496);agents[_0xa34c('0x30')](_0x1f0496);calls[_0xa34c('0x30')](_0x1f0496);}catch(_0x1ff256){utils[_0xa34c('0x10')](util['format'](_0xa34c('0x31'),_0x1f0496[_0xa34c('0x32')]),_0x1ff256);}});ami['on'](_0xa34c('0x33'),function(_0x5b1dd4){try{utils['debug'](util[_0xa34c('0x15')](_0xa34c('0x34'),_0x5b1dd4[_0xa34c('0x1a')]),_0x5b1dd4);queues[_0xa34c('0x33')](_0x5b1dd4);recordings[_0xa34c('0x33')](_0x5b1dd4);calls[_0xa34c('0x33')](_0x5b1dd4);dials[_0xa34c('0x33')](_0x5b1dd4);}catch(_0x3ba8ed){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x34'),_0x5b1dd4[_0xa34c('0x1a')]),_0x3ba8ed);}});ami['on'](_0xa34c('0x35'),function(_0x2237f7){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')](_0xa34c('0x36'),_0x2237f7[_0xa34c('0x1a')]),_0x2237f7);calls[_0xa34c('0x35')](_0x2237f7);recordings[_0xa34c('0x35')](_0x2237f7);dials[_0xa34c('0x35')](_0x2237f7);}catch(_0x47e851){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x36'),_0x2237f7[_0xa34c('0x1a')]),_0x47e851);}});ami['on'](_0xa34c('0x37'),function(_0x1f4d03){try{utils['debug'](util[_0xa34c('0x15')]('[%s][index][newchannel]',_0x1f4d03[_0xa34c('0x1a')]),_0x1f4d03);calls[_0xa34c('0x37')](_0x1f4d03);recordings['newchannel'](_0x1f4d03);}catch(_0x5b6b50){utils[_0xa34c('0x10')](util['format'](_0xa34c('0x38'),_0x1f4d03['uniqueid']),_0x5b6b50);}});ami['on']('dialbegin',function(_0x49fca5){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')](_0xa34c('0x39'),_0x49fca5['uniqueid']),_0x49fca5);dials[_0xa34c('0x3a')](_0x49fca5);}catch(_0x492998){utils[_0xa34c('0x10')](util['format'](_0xa34c('0x3b'),_0x49fca5[_0xa34c('0x1a')]),_0x492998);}});ami['on'](_0xa34c('0x3c'),function(_0x3f5401){try{utils[_0xa34c('0x14')](util['format'](_0xa34c('0x3d'),_0x3f5401['uniqueid']),_0x3f5401);dials[_0xa34c('0x3c')](_0x3f5401);}catch(_0x5dd4e3){utils[_0xa34c('0x10')](util['format']('[%s][index][dialend]',_0x3f5401[_0xa34c('0x1a')]),_0x5dd4e3);}});} \ No newline at end of file +var _0x0287=['[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','password','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','format','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]'];(function(_0x1ecae9,_0x3d5fb9){var _0x5518e1=function(_0x1fcef5){while(--_0x1fcef5){_0x1ecae9['push'](_0x1ecae9['shift']());}};_0x5518e1(++_0x3d5fb9);}(_0x0287,0xdc));var _0x7028=function(_0x11c5e0,_0x482d0c){_0x11c5e0=_0x11c5e0-0x0;var _0x251020=_0x0287[_0x11c5e0];return _0x251020;};var AsteriskManager=require(_0x7028('0x0'));var config=require(_0x7028('0x1'));var utils=require(_0x7028('0x2'));var util=require(_0x7028('0x3'));var ami=new AsteriskManager(config[_0x7028('0x4')]['port'],config['asterisk']['ip'],config['asterisk']['username'],config[_0x7028('0x4')][_0x7028('0x5')],!![]);ami[_0x7028('0x6')]();if(config[_0x7028('0x7')]&&config[_0x7028('0x7')]['disabled']){utils[_0x7028('0x8')](_0x7028('0x9'));}else{var agents=require(_0x7028('0xa'));var calls=require(_0x7028('0xb'));var queues=require(_0x7028('0xc'));var recordings=require(_0x7028('0xd'));var members=require('./members.controller');var dials=require(_0x7028('0xe'));var transfers=require(_0x7028('0xf'));var core=require('./core.controller');ami['on'](_0x7028('0x10'),core[_0x7028('0x10')]);ami['on']('shutdown',core['shutdown']);ami['on']('fullybooted',core[_0x7028('0x11')]);ami['on'](_0x7028('0x12'),core[_0x7028('0x12')]);ami['on'](_0x7028('0x13'),core[_0x7028('0x13')]);ami['on']('managerevent',core[_0x7028('0x14')]);ami['on'](_0x7028('0x15'),function(_0x1dcf6f){try{utils[_0x7028('0x16')](util['format'](_0x7028('0x17'),_0x1dcf6f['device']),_0x1dcf6f);members[_0x7028('0x15')](_0x1dcf6f);}catch(_0x4ed253){utils[_0x7028('0x12')](util[_0x7028('0x18')]('[%s][index][devicestatechange]',_0x1dcf6f['device']),_0x4ed253);}});ami['on'](_0x7028('0x19'),function(_0x43d415){try{utils[_0x7028('0x16')](util[_0x7028('0x18')]('[%s][index][agentcalled]',_0x43d415[_0x7028('0x1a')]),_0x43d415);agents[_0x7028('0x19')](_0x43d415);}catch(_0x56f48f){utils[_0x7028('0x12')](util['format'](_0x7028('0x1b'),_0x43d415['uniqueid']),_0x56f48f);}});ami['on'](_0x7028('0x1c'),function(_0x5b1cf3){try{utils['debug'](util[_0x7028('0x18')]('[%s][index][agentringnoanswer]',_0x5b1cf3['uniqueid']),_0x5b1cf3);agents['agentringnoanswer'](_0x5b1cf3);}catch(_0x42a400){utils['error'](util['format'](_0x7028('0x1d'),_0x5b1cf3[_0x7028('0x1a')]),_0x42a400);}});ami['on']('agentconnect',function(_0x4e1300){try{utils[_0x7028('0x16')](util[_0x7028('0x18')](_0x7028('0x1e'),_0x4e1300[_0x7028('0x1a')]),_0x4e1300);agents[_0x7028('0x1f')](_0x4e1300);queues['agentconnect'](_0x4e1300);}catch(_0x330c1c){utils[_0x7028('0x12')](util[_0x7028('0x18')]('[%s][index][agentconnect]',_0x4e1300[_0x7028('0x1a')]),_0x330c1c);}});ami['on'](_0x7028('0x20'),function(_0x3b34f6){try{utils[_0x7028('0x16')](util[_0x7028('0x18')](_0x7028('0x21'),_0x3b34f6[_0x7028('0x1a')]),_0x3b34f6);agents['agentcomplete'](_0x3b34f6);queues[_0x7028('0x20')](_0x3b34f6);members['agentcomplete'](_0x3b34f6);}catch(_0x3f4993){utils['error'](util['format']('[%s][index][agentcomplete]',_0x3b34f6[_0x7028('0x1a')]),_0x3f4993);}});ami['on'](_0x7028('0x22'),function(_0x3e7424){try{utils[_0x7028('0x16')](util[_0x7028('0x18')](_0x7028('0x23'),_0x3e7424[_0x7028('0x1a')]),_0x3e7424);agents['queuecallerabandon'](_0x3e7424);queues['queuecallerabandon'](_0x3e7424);}catch(_0x5888be){utils[_0x7028('0x12')](util[_0x7028('0x18')](_0x7028('0x23'),_0x3e7424[_0x7028('0x1a')]),_0x5888be);}});ami['on'](_0x7028('0x24'),function(_0x3d377f){try{utils[_0x7028('0x16')](util[_0x7028('0x18')]('[%s][index][queuecallerjoin]',_0x3d377f[_0x7028('0x1a')]),_0x3d377f);queues['queuecallerjoin'](_0x3d377f);recordings[_0x7028('0x24')](_0x3d377f);}catch(_0x47b4db){utils[_0x7028('0x12')](util[_0x7028('0x18')](_0x7028('0x25'),_0x3d377f[_0x7028('0x1a')]),_0x47b4db);}});ami['on'](_0x7028('0x26'),function(_0x43b30f){try{utils[_0x7028('0x16')](util[_0x7028('0x18')](_0x7028('0x27'),_0x43b30f[_0x7028('0x1a')]),_0x43b30f);queues[_0x7028('0x26')](_0x43b30f);}catch(_0x230eac){utils[_0x7028('0x12')](util[_0x7028('0x18')]('[%s][index][queuecallerleave]',_0x43b30f[_0x7028('0x1a')]),_0x230eac);}});ami['on']('musiconholdstart',function(_0x6f7035){try{utils[_0x7028('0x16')](util[_0x7028('0x18')](_0x7028('0x28'),_0x6f7035['uniqueid']),_0x6f7035);queues[_0x7028('0x29')](_0x6f7035);calls[_0x7028('0x29')](_0x6f7035);}catch(_0x55b931){utils['error'](util['format'](_0x7028('0x28'),_0x6f7035['uniqueid']),_0x55b931);}});ami['on'](_0x7028('0x2a'),function(_0x17cab5){try{utils[_0x7028('0x16')](util[_0x7028('0x18')]('[%s][index][musiconholdstop]',_0x17cab5[_0x7028('0x1a')]),_0x17cab5);queues[_0x7028('0x2a')](_0x17cab5);calls[_0x7028('0x2a')](_0x17cab5);}catch(_0x264bf9){utils[_0x7028('0x12')](util[_0x7028('0x18')](_0x7028('0x2b'),_0x17cab5['uniqueid']),_0x264bf9);}});ami['on'](_0x7028('0x2c'),function(_0x486f45){try{utils['debug'](util[_0x7028('0x18')](_0x7028('0x2d'),_0x486f45[_0x7028('0x1a')]),_0x486f45);calls['newstate'](_0x486f45);recordings[_0x7028('0x2c')](_0x486f45);}catch(_0x4474ed){utils[_0x7028('0x12')](util['format'](_0x7028('0x2d'),_0x486f45[_0x7028('0x1a')]),_0x4474ed);}});ami['on'](_0x7028('0x2e'),function(_0x3f6e8e){try{utils[_0x7028('0x16')](util[_0x7028('0x18')](_0x7028('0x2f'),_0x3f6e8e[_0x7028('0x1a')]),_0x3f6e8e);calls[_0x7028('0x2e')](_0x3f6e8e);recordings[_0x7028('0x2e')](_0x3f6e8e);dials['hangup'](_0x3f6e8e);agents[_0x7028('0x2e')](_0x3f6e8e);queues[_0x7028('0x2e')](_0x3f6e8e);}catch(_0x299dc9){utils['error'](util[_0x7028('0x18')]('[%s][index][hangup]',_0x3f6e8e['uniqueid']),_0x299dc9);}});ami['on'](_0x7028('0x30'),function(_0xfe4b3){try{utils[_0x7028('0x16')](util[_0x7028('0x18')]('[%s][index][cdr]',_0xfe4b3[_0x7028('0x1a')]),_0xfe4b3);members['cdr'](_0xfe4b3);}catch(_0x3a700a){utils[_0x7028('0x12')](util[_0x7028('0x18')](_0x7028('0x31'),_0xfe4b3['uniqueid']),_0x3a700a);}});ami['on']('blindtransfer',function(_0x1e3732){try{utils[_0x7028('0x16')](util[_0x7028('0x18')]('[%s][index][blindtransfer]',_0x1e3732[_0x7028('0x1a')]),_0x1e3732);queues[_0x7028('0x32')](_0x1e3732);agents['blindtransfer'](_0x1e3732);transfers[_0x7028('0x32')](_0x1e3732);}catch(_0x3a94b0){utils[_0x7028('0x12')](util[_0x7028('0x18')](_0x7028('0x33'),_0x1e3732[_0x7028('0x1a')]),_0x3a94b0);}});ami['on'](_0x7028('0x34'),function(_0x1f7c83){try{utils['debug'](util['format'](_0x7028('0x35'),_0x1f7c83[_0x7028('0x36')]),_0x1f7c83);queues[_0x7028('0x34')](_0x1f7c83);transfers[_0x7028('0x34')](_0x1f7c83);agents[_0x7028('0x34')](_0x1f7c83);calls[_0x7028('0x34')](_0x1f7c83);}catch(_0x14310e){utils['error'](util[_0x7028('0x18')](_0x7028('0x35'),_0x1f7c83['origtransfereruniqueid']),_0x14310e);}});ami['on'](_0x7028('0x37'),function(_0x185b39){try{utils['debug'](util['format'](_0x7028('0x38'),_0x185b39[_0x7028('0x1a')]),_0x185b39);queues[_0x7028('0x37')](_0x185b39);recordings[_0x7028('0x37')](_0x185b39);calls['varset'](_0x185b39);dials[_0x7028('0x37')](_0x185b39);}catch(_0x5f9a16){utils[_0x7028('0x12')](util['format'](_0x7028('0x38'),_0x185b39['uniqueid']),_0x5f9a16);}});ami['on'](_0x7028('0x39'),function(_0x3da7b4){try{utils[_0x7028('0x16')](util[_0x7028('0x18')](_0x7028('0x3a'),_0x3da7b4['uniqueid']),_0x3da7b4);calls[_0x7028('0x39')](_0x3da7b4);recordings[_0x7028('0x39')](_0x3da7b4);dials[_0x7028('0x39')](_0x3da7b4);}catch(_0x256a17){utils[_0x7028('0x12')](util[_0x7028('0x18')](_0x7028('0x3a'),_0x3da7b4[_0x7028('0x1a')]),_0x256a17);}});ami['on'](_0x7028('0x3b'),function(_0x10acab){try{utils['debug'](util[_0x7028('0x18')](_0x7028('0x3c'),_0x10acab[_0x7028('0x1a')]),_0x10acab);calls[_0x7028('0x3b')](_0x10acab);recordings[_0x7028('0x3b')](_0x10acab);}catch(_0x5c5ff6){utils[_0x7028('0x12')](util[_0x7028('0x18')](_0x7028('0x3c'),_0x10acab[_0x7028('0x1a')]),_0x5c5ff6);}});ami['on'](_0x7028('0x3d'),function(_0x1ee428){try{utils[_0x7028('0x16')](util[_0x7028('0x18')]('[%s][index][dialbegin]',_0x1ee428['uniqueid']),_0x1ee428);dials[_0x7028('0x3d')](_0x1ee428);}catch(_0x351191){utils[_0x7028('0x12')](util[_0x7028('0x18')](_0x7028('0x3e'),_0x1ee428[_0x7028('0x1a')]),_0x351191);}});ami['on'](_0x7028('0x3f'),function(_0x2ba8d9){try{utils[_0x7028('0x16')](util[_0x7028('0x18')](_0x7028('0x40'),_0x2ba8d9[_0x7028('0x1a')]),_0x2ba8d9);dials[_0x7028('0x3f')](_0x2ba8d9);}catch(_0x3bdcf){utils[_0x7028('0x12')](util['format'](_0x7028('0x40'),_0x2ba8d9[_0x7028('0x1a')]),_0x3bdcf);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 1f5d4a7..957f5d3 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 _0xb0cf=['data3','destinationchannel','data2','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','[%s][members][cdr]','lodash','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','name','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','error','cdr','assign','data1','source'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xb0cf,0x16b));var _0xfb0c=function(_0x3f2647,_0x4447ac){_0x3f2647=_0x3f2647-0x0;var _0xbd8415=_0xb0cf[_0x3f2647];return _0xbd8415;};'use strict';var _=require(_0xfb0c('0x0'));var util=require('util');var utils=require(_0xfb0c('0x1'));var members={};var exclude=['Local/_attended@transfer',_0xfb0c('0x2')];function writeDB(_0x29ecbf){utils[_0xfb0c('0x3')](util[_0xfb0c('0x4')](_0xfb0c('0x5'),_0x29ecbf[_0xfb0c('0x6')],_0x29ecbf[_0xfb0c('0x7')],_0x29ecbf[_0xfb0c('0x8')],_0x29ecbf['data2'],_0x29ecbf[_0xfb0c('0x9')],_0x29ecbf[_0xfb0c('0xa')]));if(_0x29ecbf[_0xfb0c('0x7')]){utils[_0xfb0c('0xb')](_0x29ecbf[_0xfb0c('0x7')])[_0xfb0c('0xc')](function(_0x2b047f){if(_0x2b047f){_0x29ecbf[_0xfb0c('0x9')]=_0x2b047f['name'];_0x29ecbf[_0xfb0c('0xd')]=_0x2b047f[_0xfb0c('0xd')];utils[_0xfb0c('0xe')](_0xfb0c('0xf'),_0x29ecbf);}else{utils[_0xfb0c('0x10')](_0x29ecbf[_0xfb0c('0x7')][_0xfb0c('0x11')]('/')[0x1])[_0xfb0c('0xc')](function(_0x6248fb){if(_0x6248fb){_0x29ecbf[_0xfb0c('0x9')]=_0x6248fb[_0xfb0c('0x12')];_0x29ecbf['internal']=_0x6248fb[_0xfb0c('0xd')];utils['request'](_0xfb0c('0xf'),_0x29ecbf);}});}})[_0xfb0c('0x13')](function(_0x51a8ab){utils['error'](util[_0xfb0c('0x4')](_0xfb0c('0x14'),_0x29ecbf[_0xfb0c('0x6')]),_0x51a8ab);});}delete members[_0x29ecbf[_0xfb0c('0x7')]];}function startsWith(_0xabc5bb,_0x9a40a5){return _[_0xfb0c('0x15')](_0xabc5bb,function(_0x4c1d48){return _[_0xfb0c('0x16')](_0x9a40a5,_0x4c1d48);});}exports[_0xfb0c('0x17')]=function(_0x63bbf5){try{utils[_0xfb0c('0x18')](util['format'](_0xfb0c('0x19'),members[_0x63bbf5[_0xfb0c('0x1a')]]?members[_0x63bbf5[_0xfb0c('0x1a')]][_0xfb0c('0x6')]:_0x63bbf5[_0xfb0c('0x1a')]),_0x63bbf5);utils[_0xfb0c('0x3')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x63bbf5['device']]?members[_0x63bbf5[_0xfb0c('0x1a')]][_0xfb0c('0x6')]:_0x63bbf5[_0xfb0c('0x1a')],_0x63bbf5[_0xfb0c('0x1b')],_0x63bbf5[_0xfb0c('0x1a')]));switch(_0x63bbf5[_0xfb0c('0x1b')]){case _0xfb0c('0x1c'):case'BUSY':if(!startsWith(exclude,_0x63bbf5[_0xfb0c('0x1a')])){members[_0x63bbf5[_0xfb0c('0x1a')]]={'channel':_0xfb0c('0x1d'),'interface':_0x63bbf5[_0xfb0c('0x1a')],'type':_0xfb0c('0x1e'),'enterAt':utils[_0xfb0c('0x1f')](),'role':_0xfb0c('0x20')};}break;case _0xfb0c('0x21'):if(!_[_0xfb0c('0x22')](members[_0x63bbf5[_0xfb0c('0x1a')]])){members[_0x63bbf5['device']][_0xfb0c('0x23')]=utils[_0xfb0c('0x1f')]();members[_0x63bbf5[_0xfb0c('0x1a')]][_0xfb0c('0x24')]=utils['diffTime'](members[_0x63bbf5['device']][_0xfb0c('0x23')],members[_0x63bbf5[_0xfb0c('0x1a')]]['enterAt']);if(members[_0x63bbf5['device']][_0xfb0c('0x6')]){writeDB(members[_0x63bbf5['device']]);}}break;default:break;}}catch(_0x1cc641){utils['error'](util[_0xfb0c('0x4')](_0xfb0c('0x19'),members[_0x63bbf5['device']]?members[_0x63bbf5[_0xfb0c('0x1a')]]['uniqueid']:_0x63bbf5[_0xfb0c('0x1a')]),_0x1cc641);}};exports['agentcomplete']=function(_0x1bf866){try{if(!_[_0xfb0c('0x22')](members[_0x1bf866[_0xfb0c('0x7')]])){utils[_0xfb0c('0x18')](util[_0xfb0c('0x4')](_0xfb0c('0x25'),_0x1bf866['uniqueid']),_0x1bf866);utils[_0xfb0c('0x3')](util[_0xfb0c('0x4')](_0xfb0c('0x26'),_0x1bf866[_0xfb0c('0x6')],_0x1bf866[_0xfb0c('0x7')],_0x1bf866[_0xfb0c('0x27')]));members[_0x1bf866['interface']]=_['assign'](members[_0x1bf866[_0xfb0c('0x7')]],{'data4':_0x1bf866['queue'],'uniqueid':_0x1bf866[_0xfb0c('0x6')]});}}catch(_0x51e9d0){utils[_0xfb0c('0x28')](util[_0xfb0c('0x4')](_0xfb0c('0x25'),_0x1bf866[_0xfb0c('0x6')]),_0x51e9d0);}};exports[_0xfb0c('0x29')]=function(_0x41d886){try{utils['debug'](util[_0xfb0c('0x4')]('[%s][members][cdr]',_0x41d886['uniqueid']),_0x41d886);if(_0x41d886[_0xfb0c('0x8')]){var _0x18e4e0=_0x41d886[_0xfb0c('0x8')]['split']('-')[0x0];if(!_[_0xfb0c('0x22')](members[_0x18e4e0])){members[_0x18e4e0]=_[_0xfb0c('0x2a')](members[_0x18e4e0],{'data1':members[_0x18e4e0][_0xfb0c('0x2b')]||_0x41d886[_0xfb0c('0xa')],'data2':members[_0x18e4e0]['data2']||_0x41d886[_0xfb0c('0x2c')],'data3':members[_0x18e4e0][_0xfb0c('0x2d')]||_0x41d886['destination'],'uniqueid':members[_0x18e4e0][_0xfb0c('0x6')]||_0x41d886['uniqueid']});utils['info'](util[_0xfb0c('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x41d886[_0xfb0c('0x6')],members[_0x18e4e0][_0xfb0c('0x2b')],members[_0x18e4e0]['data2'],members[_0x18e4e0][_0xfb0c('0x2d')]));if(members[_0x18e4e0][_0xfb0c('0x23')]){writeDB(members[_0x18e4e0]);}}}if(_0x41d886[_0xfb0c('0x2e')]){var _0x1fc45f=_0x41d886[_0xfb0c('0x2e')][_0xfb0c('0x11')]('-')[0x0];if(!_['isNil'](members[_0x1fc45f])){members[_0x1fc45f]=_[_0xfb0c('0x2a')](members[_0x1fc45f],{'data1':members[_0x1fc45f][_0xfb0c('0x2b')]||_0x41d886['type'],'data2':members[_0x1fc45f][_0xfb0c('0x2f')]||_0x41d886['source'],'data3':members[_0x1fc45f]['data3']||_0x41d886[_0xfb0c('0x30')],'uniqueid':members[_0x1fc45f][_0xfb0c('0x6')]||_0x41d886['uniqueid']});utils['info'](util[_0xfb0c('0x4')](_0xfb0c('0x31'),_0x41d886['uniqueid'],members[_0x1fc45f][_0xfb0c('0x2b')],members[_0x1fc45f][_0xfb0c('0x2f')],members[_0x1fc45f]['data3']));if(members[_0x1fc45f][_0xfb0c('0x23')]){writeDB(members[_0x1fc45f]);}}}}catch(_0xd33db7){utils[_0xfb0c('0x28')](util['format'](_0xfb0c('0x32'),_0x41d886[_0xfb0c('0x6')]),_0xd33db7);}}; \ No newline at end of file +var _0xac95=['state','BUSY','TALKING','agent','exitAt','now','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','data2','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','error','lodash','util','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','membername','type','getUserByInterface','then','name','internal','request','getUserByName','split','catch','uniqueid','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s'];(function(_0x438003,_0x453e13){var _0x115172=function(_0x4499a7){while(--_0x4499a7){_0x438003['push'](_0x438003['shift']());}};_0x115172(++_0x453e13);}(_0xac95,0x7c));var _0x5ac9=function(_0xd9e81,_0x2e56c6){_0xd9e81=_0xd9e81-0x0;var _0x784713=_0xac95[_0xd9e81];return _0x784713;};'use strict';var _=require(_0x5ac9('0x0'));var util=require(_0x5ac9('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0x5ac9('0x2')];function writeDB(_0x4c7528){utils[_0x5ac9('0x3')](util[_0x5ac9('0x4')](_0x5ac9('0x5'),_0x4c7528['uniqueid'],_0x4c7528[_0x5ac9('0x6')],_0x4c7528[_0x5ac9('0x7')],_0x4c7528['data2'],_0x4c7528[_0x5ac9('0x8')],_0x4c7528[_0x5ac9('0x9')]));if(_0x4c7528[_0x5ac9('0x6')]){utils[_0x5ac9('0xa')](_0x4c7528[_0x5ac9('0x6')])[_0x5ac9('0xb')](function(_0x359388){if(_0x359388){_0x4c7528[_0x5ac9('0x8')]=_0x359388[_0x5ac9('0xc')];_0x4c7528['internal']=_0x359388[_0x5ac9('0xd')];utils[_0x5ac9('0xe')]('CreateMemberReport',_0x4c7528);}else{utils[_0x5ac9('0xf')](_0x4c7528[_0x5ac9('0x6')][_0x5ac9('0x10')]('/')[0x1])[_0x5ac9('0xb')](function(_0x2fc030){if(_0x2fc030){_0x4c7528[_0x5ac9('0x8')]=_0x2fc030[_0x5ac9('0xc')];_0x4c7528['internal']=_0x2fc030[_0x5ac9('0xd')];utils[_0x5ac9('0xe')]('CreateMemberReport',_0x4c7528);}});}})[_0x5ac9('0x11')](function(_0x46db85){utils['error'](util[_0x5ac9('0x4')]('[%s][members][writeDB]',_0x4c7528[_0x5ac9('0x12')]),_0x46db85);});}delete members[_0x4c7528[_0x5ac9('0x6')]];}function startsWith(_0x189d1d,_0xa2fbe7){return _[_0x5ac9('0x13')](_0x189d1d,function(_0x4f3763){return _[_0x5ac9('0x14')](_0xa2fbe7,_0x4f3763);});}exports[_0x5ac9('0x15')]=function(_0x526c8e){try{utils[_0x5ac9('0x16')](util[_0x5ac9('0x4')](_0x5ac9('0x17'),members[_0x526c8e['device']]?members[_0x526c8e[_0x5ac9('0x18')]]['uniqueid']:_0x526c8e['device']),_0x526c8e);utils[_0x5ac9('0x3')](util[_0x5ac9('0x4')](_0x5ac9('0x19'),members[_0x526c8e['device']]?members[_0x526c8e[_0x5ac9('0x18')]][_0x5ac9('0x12')]:_0x526c8e['device'],_0x526c8e[_0x5ac9('0x1a')],_0x526c8e[_0x5ac9('0x18')]));switch(_0x526c8e[_0x5ac9('0x1a')]){case'INUSE':case _0x5ac9('0x1b'):if(!startsWith(exclude,_0x526c8e['device'])){members[_0x526c8e['device']]={'channel':'voice','interface':_0x526c8e[_0x5ac9('0x18')],'type':_0x5ac9('0x1c'),'enterAt':utils['now'](),'role':_0x5ac9('0x1d')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x526c8e[_0x5ac9('0x18')]])){members[_0x526c8e['device']][_0x5ac9('0x1e')]=utils[_0x5ac9('0x1f')]();members[_0x526c8e[_0x5ac9('0x18')]]['duration']=utils[_0x5ac9('0x20')](members[_0x526c8e[_0x5ac9('0x18')]][_0x5ac9('0x1e')],members[_0x526c8e[_0x5ac9('0x18')]][_0x5ac9('0x21')]);if(members[_0x526c8e[_0x5ac9('0x18')]][_0x5ac9('0x12')]){writeDB(members[_0x526c8e[_0x5ac9('0x18')]]);}}break;default:break;}}catch(_0x5781f2){utils['error'](util[_0x5ac9('0x4')](_0x5ac9('0x17'),members[_0x526c8e['device']]?members[_0x526c8e[_0x5ac9('0x18')]]['uniqueid']:_0x526c8e['device']),_0x5781f2);}};exports[_0x5ac9('0x22')]=function(_0x299732){try{if(!_[_0x5ac9('0x23')](members[_0x299732[_0x5ac9('0x6')]])){utils[_0x5ac9('0x16')](util['format'](_0x5ac9('0x24'),_0x299732['uniqueid']),_0x299732);utils[_0x5ac9('0x3')](util[_0x5ac9('0x4')](_0x5ac9('0x25'),_0x299732[_0x5ac9('0x12')],_0x299732[_0x5ac9('0x6')],_0x299732[_0x5ac9('0x26')]));members[_0x299732[_0x5ac9('0x6')]]=_[_0x5ac9('0x27')](members[_0x299732['interface']],{'data4':_0x299732['queue'],'uniqueid':_0x299732[_0x5ac9('0x12')]});}}catch(_0x24d8c6){utils['error'](util[_0x5ac9('0x4')]('[%s][members][agentcomplete]',_0x299732[_0x5ac9('0x12')]),_0x24d8c6);}};exports[_0x5ac9('0x28')]=function(_0x1faafa){try{utils[_0x5ac9('0x16')](util['format'](_0x5ac9('0x29'),_0x1faafa[_0x5ac9('0x12')]),_0x1faafa);if(_0x1faafa[_0x5ac9('0x7')]){var _0x1cf9ae=_0x1faafa[_0x5ac9('0x7')]['split']('-')[0x0];if(!_[_0x5ac9('0x23')](members[_0x1cf9ae])){members[_0x1cf9ae]=_[_0x5ac9('0x27')](members[_0x1cf9ae],{'data1':members[_0x1cf9ae][_0x5ac9('0x2a')]||_0x1faafa['type'],'data2':members[_0x1cf9ae][_0x5ac9('0x2b')]||_0x1faafa[_0x5ac9('0x2c')],'data3':members[_0x1cf9ae][_0x5ac9('0x2d')]||_0x1faafa[_0x5ac9('0x2e')],'uniqueid':members[_0x1cf9ae][_0x5ac9('0x12')]||_0x1faafa[_0x5ac9('0x12')]});utils[_0x5ac9('0x3')](util[_0x5ac9('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1faafa['uniqueid'],members[_0x1cf9ae]['data1'],members[_0x1cf9ae][_0x5ac9('0x2b')],members[_0x1cf9ae][_0x5ac9('0x2d')]));if(members[_0x1cf9ae][_0x5ac9('0x1e')]){writeDB(members[_0x1cf9ae]);}}}if(_0x1faafa['destinationchannel']){var _0x45dfc1=_0x1faafa[_0x5ac9('0x2f')][_0x5ac9('0x10')]('-')[0x0];if(!_[_0x5ac9('0x23')](members[_0x45dfc1])){members[_0x45dfc1]=_[_0x5ac9('0x27')](members[_0x45dfc1],{'data1':members[_0x45dfc1][_0x5ac9('0x2a')]||_0x1faafa[_0x5ac9('0x9')],'data2':members[_0x45dfc1]['data2']||_0x1faafa[_0x5ac9('0x2c')],'data3':members[_0x45dfc1][_0x5ac9('0x2d')]||_0x1faafa[_0x5ac9('0x2e')],'uniqueid':members[_0x45dfc1][_0x5ac9('0x12')]||_0x1faafa['uniqueid']});utils[_0x5ac9('0x3')](util[_0x5ac9('0x4')](_0x5ac9('0x30'),_0x1faafa[_0x5ac9('0x12')],members[_0x45dfc1][_0x5ac9('0x2a')],members[_0x45dfc1]['data2'],members[_0x45dfc1]['data3']));if(members[_0x45dfc1][_0x5ac9('0x1e')]){writeDB(members[_0x45dfc1]);}}}}catch(_0x50d452){utils[_0x5ac9('0x31')](util[_0x5ac9('0x4')](_0x5ac9('0x29'),_0x1faafa[_0x5ac9('0x12')]),_0x50d452);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 9d3011c..5cd3e80 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 _0x97ce=['attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','format','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','isNil','variable','queuestatus','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','position','agentconnect','[%s][queues][agentconnect]','destaccountcode','membername','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER'];(function(_0x1cb618,_0x242970){var _0x28e063=function(_0x2204ce){while(--_0x2204ce){_0x1cb618['push'](_0x1cb618['shift']());}};_0x28e063(++_0x242970);}(_0x97ce,0x151));var _0xe97c=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x97ce[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0xe97c('0x0'));var util=require(_0xe97c('0x1'));var utils=require(_0xe97c('0x2'));var queues={};function writeDB(_0x31bf3f){utils['info'](util[_0xe97c('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x31bf3f[_0xe97c('0x4')],_0x31bf3f['channel'],_0x31bf3f[_0xe97c('0x5')],_0x31bf3f[_0xe97c('0x6')],_0x31bf3f[_0xe97c('0x7')],_0x31bf3f[_0xe97c('0x8')],_0x31bf3f[_0xe97c('0x9')]));if(_0x31bf3f[_0xe97c('0x5')]){utils['getVoiceQueueByName'](_0x31bf3f[_0xe97c('0x5')])[_0xe97c('0xa')](function(_0x9ce6d){if(_0x9ce6d){_0x31bf3f['type']=_0x9ce6d[_0xe97c('0xb')];}utils['request'](_0xe97c('0xc'),_0x31bf3f);});}else{utils[_0xe97c('0xd')](_0xe97c('0xc'),_0x31bf3f);}if(_0x31bf3f[_0xe97c('0xe')]){delete queues[_0x31bf3f[_0xe97c('0xe')]];}else{delete queues[_0x31bf3f[_0xe97c('0x4')]];}}exports[_0xe97c('0xf')]=function(_0x5bb134){try{utils[_0xe97c('0x10')](util[_0xe97c('0x3')](_0xe97c('0x11'),_0x5bb134[_0xe97c('0x4')]),_0x5bb134);utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x13'),_0x5bb134[_0xe97c('0x4')],_0x5bb134[_0xe97c('0x5')],_0x5bb134['position']));queues[_0x5bb134['uniqueid']]=_[_0xe97c('0x14')](_0x5bb134,{'originalposition':_0x5bb134['position'],'queuecallerjoinAt':utils[_0xe97c('0x15')](),'mohtime':0x0});}catch(_0x4006a6){utils['error'](util['format'](_0xe97c('0x11'),_0x5bb134[_0xe97c('0x4')]),_0x4006a6);}};exports[_0xe97c('0x16')]=function(_0x2e026d){try{if(!_['isNil'](queues[_0x2e026d['uniqueid']])){utils['debug'](util[_0xe97c('0x3')](_0xe97c('0x17'),_0x2e026d[_0xe97c('0x4')]),_0x2e026d);if(queues[_0x2e026d['uniqueid']][_0xe97c('0x18')]){if(!queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0x19')]&&!queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0x1a')]){queues[_0x2e026d['uniqueid']][_0xe97c('0x1b')]=!![];queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0x1c')]=utils[_0xe97c('0x15')]();queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0x9')]=_0xe97c('0x1d');}utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x1e'),_0x2e026d[_0xe97c('0x4')],queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0x1f')],queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0x9')]));writeDB(queues[_0x2e026d[_0xe97c('0x4')]]);}else if(queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0xe')]){utils[_0xe97c('0x12')](util['format'](_0xe97c('0x20'),_0x2e026d[_0xe97c('0x4')],queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0x1f')],queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0xe')]));queues[queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0xe')]]=queues[_0x2e026d[_0xe97c('0x4')]];queues[queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0xe')]][_0xe97c('0x21')]=0x2;delete queues[_0x2e026d['uniqueid']];}}}catch(_0x4a79fb){utils[_0xe97c('0x22')](util[_0xe97c('0x3')](_0xe97c('0x17'),_0x2e026d[_0xe97c('0x4')]),_0x4a79fb);}};exports[_0xe97c('0x23')]=function(_0x6fff8d){try{utils[_0xe97c('0x10')](util['format']('[%s][queues][varset]',_0x6fff8d[_0xe97c('0x4')]),_0x6fff8d);if(!_[_0xe97c('0x24')](_0x6fff8d[_0xe97c('0x25')][_0xe97c('0x26')])&&_0x6fff8d['value']['toUpperCase']()!==_0xe97c('0x27')){if(!_[_0xe97c('0x24')](queues[_0x6fff8d[_0xe97c('0x4')]])){queues[_0x6fff8d['uniqueid']]['queuecallerabandon']=![];queues[_0x6fff8d[_0xe97c('0x4')]][_0xe97c('0x28')]=null;queues[_0x6fff8d[_0xe97c('0x4')]][_0xe97c('0x1a')]=!![];queues[_0x6fff8d[_0xe97c('0x4')]][_0xe97c('0x29')]=utils[_0xe97c('0x15')]();queues[_0x6fff8d['uniqueid']][_0xe97c('0x9')]=_0x6fff8d[_0xe97c('0x2a')]['toUpperCase']();utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x2b'),_0x6fff8d[_0xe97c('0x4')],queues[_0x6fff8d[_0xe97c('0x4')]][_0xe97c('0x1f')],_0x6fff8d[_0xe97c('0x2a')],queues[_0x6fff8d[_0xe97c('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x6fff8d['uniqueid']]);}}else if(!_[_0xe97c('0x24')](_0x6fff8d[_0xe97c('0x25')][_0xe97c('0x2c')])){if(!_[_0xe97c('0x24')](queues[_0x6fff8d['uniqueid']])&&!queues[_0x6fff8d[_0xe97c('0x4')]]['queuecallerabandon']){queues[_0x6fff8d[_0xe97c('0x4')]][_0xe97c('0x19')]=![];queues[_0x6fff8d[_0xe97c('0x4')]]['queuecallerabandonAt']=null;queues[_0x6fff8d[_0xe97c('0x4')]][_0xe97c('0x1a')]=!![];queues[_0x6fff8d[_0xe97c('0x4')]][_0xe97c('0x29')]=utils[_0xe97c('0x15')]();queues[_0x6fff8d['uniqueid']][_0xe97c('0x9')]=_0xe97c('0x2d');utils[_0xe97c('0x12')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x6fff8d[_0xe97c('0x4')],queues[_0x6fff8d['uniqueid']][_0xe97c('0x1f')],_0x6fff8d['value'],queues[_0x6fff8d['uniqueid']]['queuecallerexitreason']));}}}catch(_0x112ae7){utils[_0xe97c('0x22')](util[_0xe97c('0x3')](_0xe97c('0x2e'),_0x6fff8d[_0xe97c('0x4')]),_0x112ae7);}};exports['queuecallerabandon']=function(_0x2935dc){try{if(!_['isNil'](queues[_0x2935dc[_0xe97c('0x4')]])){utils[_0xe97c('0x10')](util[_0xe97c('0x3')](_0xe97c('0x2f'),_0x2935dc[_0xe97c('0x4')]),_0x2935dc);queues[_0x2935dc[_0xe97c('0x4')]][_0xe97c('0x1a')]=![];queues[_0x2935dc[_0xe97c('0x4')]]['queuecallerexitAt']=null;queues[_0x2935dc[_0xe97c('0x4')]][_0xe97c('0x19')]=!![];queues[_0x2935dc[_0xe97c('0x4')]][_0xe97c('0x28')]=utils[_0xe97c('0x15')]();queues[_0x2935dc[_0xe97c('0x4')]][_0xe97c('0x9')]=_0xe97c('0x30');utils[_0xe97c('0x12')](util[_0xe97c('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x2935dc[_0xe97c('0x4')],queues[_0x2935dc[_0xe97c('0x4')]]['name'],queues[_0x2935dc[_0xe97c('0x4')]][_0xe97c('0x9')]));}}catch(_0x1bde24){utils[_0xe97c('0x22')](util['format'](_0xe97c('0x2f'),_0x2935dc['uniqueid']),_0x1bde24);}};exports[_0xe97c('0x31')]=function(_0x373cb2){try{if(!_[_0xe97c('0x24')](queues[_0x373cb2[_0xe97c('0x4')]])){utils[_0xe97c('0x10')](util['format'](_0xe97c('0x32'),_0x373cb2[_0xe97c('0x4')]),_0x373cb2);utils[_0xe97c('0x12')](util[_0xe97c('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x373cb2[_0xe97c('0x4')],queues[_0x373cb2[_0xe97c('0x4')]]['name'],_0x373cb2[_0xe97c('0x33')],_0x373cb2[_0xe97c('0x34')]));queues[_0x373cb2['uniqueid']]['queuecallerleave']=!![];queues[_0x373cb2[_0xe97c('0x4')]][_0xe97c('0x18')]=utils[_0xe97c('0x15')]();queues[_0x373cb2[_0xe97c('0x4')]][_0xe97c('0x35')]=utils[_0xe97c('0x36')](queues[_0x373cb2[_0xe97c('0x4')]][_0xe97c('0x18')],queues[_0x373cb2[_0xe97c('0x4')]]['queuecallerjoinAt']);queues[_0x373cb2[_0xe97c('0x4')]][_0xe97c('0x37')]=_0x373cb2[_0xe97c('0x37')];queues[_0x373cb2[_0xe97c('0x4')]]['count']=_0x373cb2['count'];queues[_0x373cb2[_0xe97c('0x4')]][_0xe97c('0x33')]=_0x373cb2[_0xe97c('0x33')];queues[_0x373cb2[_0xe97c('0x4')]]['connectedlinename']=_0x373cb2['connectedlinename'];}}catch(_0x5b1420){utils[_0xe97c('0x22')](util[_0xe97c('0x3')](_0xe97c('0x32'),_0x373cb2[_0xe97c('0x4')]),_0x5b1420);}};exports[_0xe97c('0x38')]=function(_0x9251cc){try{if(!_[_0xe97c('0x24')](queues[_0x9251cc[_0xe97c('0x4')]])){utils[_0xe97c('0x10')](util[_0xe97c('0x3')](_0xe97c('0x39'),_0x9251cc[_0xe97c('0x4')]),_0x9251cc);utils[_0xe97c('0x12')](util[_0xe97c('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x9251cc[_0xe97c('0x4')],queues[_0x9251cc[_0xe97c('0x4')]][_0xe97c('0x1f')],_0x9251cc['membername'],_0x9251cc[_0xe97c('0x3a')]));queues[_0x9251cc['uniqueid']]['queuecallerabandon']=![];queues[_0x9251cc[_0xe97c('0x4')]][_0xe97c('0x19')]=![];queues[_0x9251cc[_0xe97c('0x4')]]['queuecallerabandonAt']=null;queues[_0x9251cc[_0xe97c('0x4')]][_0xe97c('0x1a')]=![];queues[_0x9251cc[_0xe97c('0x4')]][_0xe97c('0x9')]=null;queues[_0x9251cc['uniqueid']]['queuecallerexitAt']=null;queues[_0x9251cc[_0xe97c('0x4')]]['assigned']=!![];queues[_0x9251cc['uniqueid']][_0xe97c('0x8')]=_0x9251cc[_0xe97c('0x3a')];queues[_0x9251cc[_0xe97c('0x4')]]['lastAssignedTo']=_0x9251cc[_0xe97c('0x3b')];}}catch(_0x586910){utils['error'](util[_0xe97c('0x3')]('[%s][queues][agentconnect]',_0x9251cc[_0xe97c('0x4')]),_0x586910);}};exports[_0xe97c('0x3c')]=function(_0x320774){try{if(!_[_0xe97c('0x24')](queues[_0x320774[_0xe97c('0x4')]])){if(queues[_0x320774[_0xe97c('0x4')]][_0xe97c('0x18')]){utils['debug'](util['format'](_0xe97c('0x3d'),_0x320774[_0xe97c('0x4')]),_0x320774);queues[_0x320774['uniqueid']][_0xe97c('0x19')]=![];queues[_0x320774['uniqueid']][_0xe97c('0x19')]=![];queues[_0x320774['uniqueid']][_0xe97c('0x28')]=null;queues[_0x320774['uniqueid']][_0xe97c('0x1a')]=![];queues[_0x320774[_0xe97c('0x4')]]['queuecallerexitAt']=null;queues[_0x320774[_0xe97c('0x4')]][_0xe97c('0x3e')]=!![];queues[_0x320774[_0xe97c('0x4')]][_0xe97c('0x6')]=_0x320774[_0xe97c('0x3b')];queues[_0x320774['uniqueid']][_0xe97c('0x1b')]=!![];queues[_0x320774[_0xe97c('0x4')]][_0xe97c('0x1c')]=utils['now']();if(_0x320774[_0xe97c('0x3f')]==_0xe97c('0x40')){if(!queues[_0x320774['uniqueid']][_0xe97c('0x40')]){queues[_0x320774[_0xe97c('0x4')]][_0xe97c('0x9')]='TRANSFER';}}else{queues[_0x320774[_0xe97c('0x4')]][_0xe97c('0x9')]=_0xe97c('0x41')+_0x320774[_0xe97c('0x3f')][_0xe97c('0x42')]();}utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x43'),_0x320774[_0xe97c('0x4')],queues[_0x320774[_0xe97c('0x4')]][_0xe97c('0x1f')],_0x320774[_0xe97c('0x3b')],queues[_0x320774['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x320774['uniqueid']]);}}}catch(_0x366470){utils[_0xe97c('0x22')](util[_0xe97c('0x3')](_0xe97c('0x3d'),_0x320774['uniqueid']),_0x366470);}};exports['blindtransfer']=function(_0x29467d){try{if(!_[_0xe97c('0x24')](queues[_0x29467d[_0xe97c('0x44')]])){utils['debug'](util['format'](_0xe97c('0x45'),_0x29467d['uniqueid']),_0x29467d);queues[_0x29467d['transfereeuniqueid']][_0xe97c('0x40')]=!![];queues[_0x29467d[_0xe97c('0x44')]][_0xe97c('0x46')]=_0xe97c('0x47');queues[_0x29467d[_0xe97c('0x44')]][_0xe97c('0x48')]=_0x29467d[_0xe97c('0x49')];queues[_0x29467d[_0xe97c('0x44')]]['transferuniqueid']=_0x29467d['transfereeuniqueid'];queues[_0x29467d['transfereeuniqueid']]['queuecallerexitreason']=_0xe97c('0x4a');utils[_0xe97c('0x12')](util[_0xe97c('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x29467d['uniqueid'],queues[_0x29467d[_0xe97c('0x44')]][_0xe97c('0x1f')],_0x29467d[_0xe97c('0x44')],_0x29467d[_0xe97c('0x49')]));}}catch(_0x4bb044){utils[_0xe97c('0x22')](util['format']('[%s][queues][blindtransfer]',_0x29467d[_0xe97c('0x4')]),_0x4bb044);}};exports[_0xe97c('0x4b')]=function(_0x3cd085){try{utils[_0xe97c('0x10')](util[_0xe97c('0x3')](_0xe97c('0x4c'),_0x3cd085[_0xe97c('0x4d')]),_0x3cd085);if(_0x3cd085['origtransfereruniqueid']==_0x3cd085[_0xe97c('0x4e')]){if(!_[_0xe97c('0x24')](queues[_0x3cd085[_0xe97c('0x4f')]])){utils[_0xe97c('0x12')](util['format'](_0xe97c('0x50'),_0x3cd085['origtransfereruniqueid'],queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0x1f')],_0x3cd085[_0xe97c('0x51')]));queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0x40')]=!![];queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0x46')]='ATTENDED';queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0x48')]=_0x3cd085[_0xe97c('0x51')];queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0x52')]=_0x3cd085[_0xe97c('0x4d')];queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0x9')]=_0xe97c('0x53');}if(!_[_0xe97c('0x24')](queues[_0x3cd085[_0xe97c('0x4e')]])){if(_0x3cd085[_0xe97c('0x54')]&&queues[_0x3cd085['transfereelinkedid']]){queues[_0x3cd085['transfereelinkedid']][_0xe97c('0x21')]=0x1;queues[_0x3cd085[_0xe97c('0x44')]]=_['clone'](queues[_0x3cd085['transfereelinkedid']]);queues[_0x3cd085[_0xe97c('0x44')]][_0xe97c('0xe')]=_0x3cd085[_0xe97c('0x55')];queues[_0x3cd085[_0xe97c('0x44')]]['queuecallerenterreason']=0x2;queues[_0x3cd085[_0xe97c('0x44')]][_0xe97c('0x7')]=queues[_0x3cd085[_0xe97c('0x4f')]]['calleridnum'];queues[_0x3cd085['transfereeuniqueid']][_0xe97c('0x56')]=queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0x56')];queues[_0x3cd085[_0xe97c('0x44')]][_0xe97c('0x57')]=utils[_0xe97c('0x15')]();queues[_0x3cd085[_0xe97c('0x44')]][_0xe97c('0x18')]=utils[_0xe97c('0x15')]();queues[_0x3cd085[_0xe97c('0x44')]][_0xe97c('0x35')]=0x0;queues[_0x3cd085[_0xe97c('0x44')]]['mohtime']=0x0;utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x58'),_0x3cd085[_0xe97c('0x4d')],queues[_0x3cd085['transfereeuniqueid']][_0xe97c('0x1f')],queues[_0x3cd085['transfereeuniqueid']][_0xe97c('0x7')],queues[_0x3cd085[_0xe97c('0x44')]][_0xe97c('0x56')]));}else{utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x59'),_0x3cd085[_0xe97c('0x4d')],queues[_0x3cd085[_0xe97c('0x4e')]][_0xe97c('0x1f')],_0x3cd085[_0xe97c('0x4f')]));queues[_0x3cd085['origtransfererlinkedid']][_0xe97c('0xe')]=_0x3cd085[_0xe97c('0x4f')];}}}else if(_0x3cd085[_0xe97c('0x5a')]==_0x3cd085[_0xe97c('0x4f')]){if(!_[_0xe97c('0x24')](queues[_0x3cd085[_0xe97c('0x4e')]])){utils['info'](util[_0xe97c('0x3')](_0xe97c('0x5b'),_0x3cd085['origtransfereruniqueid'],queues[_0x3cd085[_0xe97c('0x4e')]][_0xe97c('0x1f')],_0x3cd085[_0xe97c('0x5a')],_0x3cd085['secondtransfererexten']));queues[_0x3cd085[_0xe97c('0x4e')]]['transfer']=!![];queues[_0x3cd085[_0xe97c('0x4e')]][_0xe97c('0x46')]='ATTENDED';queues[_0x3cd085[_0xe97c('0x4e')]]['transferexten']=_0x3cd085[_0xe97c('0x5c')];queues[_0x3cd085['origtransfererlinkedid']][_0xe97c('0x52')]=_0x3cd085[_0xe97c('0x5a')];queues[_0x3cd085[_0xe97c('0x4e')]][_0xe97c('0x9')]=_0xe97c('0x53');}if(!_[_0xe97c('0x24')](queues[_0x3cd085[_0xe97c('0x4f')]])){if(_0x3cd085[_0xe97c('0x5d')]&&queues[_0x3cd085['transfertargetlinkedid']]){queues[_0x3cd085['transfertargetlinkedid']][_0xe97c('0x21')]=0x1;queues[_0x3cd085['transfertargetuniqueid']]=_[_0xe97c('0x5e')](queues[_0x3cd085[_0xe97c('0x5d')]]);queues[_0x3cd085['transfertargetuniqueid']][_0xe97c('0xe')]=_0x3cd085[_0xe97c('0x55')];queues[_0x3cd085[_0xe97c('0x55')]][_0xe97c('0x21')]=0x2;queues[_0x3cd085[_0xe97c('0x55')]][_0xe97c('0x7')]=queues[_0x3cd085['origtransfererlinkedid']][_0xe97c('0x7')];queues[_0x3cd085[_0xe97c('0x55')]][_0xe97c('0x56')]=queues[_0x3cd085[_0xe97c('0x4e')]][_0xe97c('0x56')];queues[_0x3cd085[_0xe97c('0x55')]][_0xe97c('0x57')]=utils[_0xe97c('0x15')]();queues[_0x3cd085[_0xe97c('0x55')]][_0xe97c('0x18')]=utils[_0xe97c('0x15')]();queues[_0x3cd085[_0xe97c('0x55')]]['holdtime']=0x0;queues[_0x3cd085['transfertargetuniqueid']][_0xe97c('0x5f')]=0x0;utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x60'),_0x3cd085[_0xe97c('0x4d')],queues[_0x3cd085['transfertargetuniqueid']][_0xe97c('0x1f')],queues[_0x3cd085['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x3cd085[_0xe97c('0x55')]][_0xe97c('0x7')],queues[_0x3cd085[_0xe97c('0x55')]][_0xe97c('0x56')]));}else{utils['info'](util['format'](_0xe97c('0x59'),_0x3cd085['origtransfereruniqueid'],queues[_0x3cd085[_0xe97c('0x4f')]]['name'],_0x3cd085[_0xe97c('0x4e')]));queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0xe')]=_0x3cd085[_0xe97c('0x4e')];}}}}catch(_0xc55d6){utils[_0xe97c('0x22')](util[_0xe97c('0x3')](_0xe97c('0x4c'),_0x3cd085[_0xe97c('0x4d')]),_0xc55d6);}};exports[_0xe97c('0x61')]=function(_0x5f1368){try{if(!_[_0xe97c('0x24')](queues[_0x5f1368[_0xe97c('0x4')]])){utils[_0xe97c('0x10')](util['format']('[%s][queues][musiconholdstart]',_0x5f1368[_0xe97c('0x4')]),_0x5f1368);queues[_0x5f1368[_0xe97c('0x4')]][_0xe97c('0x62')]=utils[_0xe97c('0x15')]();utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x63'),_0x5f1368[_0xe97c('0x4')],queues[_0x5f1368[_0xe97c('0x4')]]['name'],queues[_0x5f1368[_0xe97c('0x4')]][_0xe97c('0x62')]));}}catch(_0x5e3e9e){utils[_0xe97c('0x22')](util[_0xe97c('0x3')]('[%s][queues][musiconholdstart]',_0x5f1368['uniqueid']),_0x5e3e9e);}};exports[_0xe97c('0x64')]=function(_0x2a5cc4){try{if(!_[_0xe97c('0x24')](queues[_0x2a5cc4['uniqueid']])){if(!_[_0xe97c('0x24')](queues[_0x2a5cc4[_0xe97c('0x4')]][_0xe97c('0x62')])){utils['debug'](util[_0xe97c('0x3')]('[%s][queues][musiconholdstop]',_0x2a5cc4[_0xe97c('0x4')]),_0x2a5cc4);queues[_0x2a5cc4[_0xe97c('0x4')]]['mohtime']+=utils[_0xe97c('0x36')](utils[_0xe97c('0x15')](),queues[_0x2a5cc4[_0xe97c('0x4')]]['musiconholdstartAt']);utils[_0xe97c('0x12')](util['format'](_0xe97c('0x65'),_0x2a5cc4[_0xe97c('0x4')],queues[_0x2a5cc4[_0xe97c('0x4')]][_0xe97c('0x1f')],queues[_0x2a5cc4['uniqueid']]['mohtime']));delete queues[_0x2a5cc4['uniqueid']][_0xe97c('0x62')];}}}catch(_0x339354){utils['error'](util[_0xe97c('0x3')](_0xe97c('0x66'),_0x2a5cc4[_0xe97c('0x4')]),_0x339354);}}; \ No newline at end of file +var _0xc224=['[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerexitreason','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','membername','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime'];(function(_0x51912a,_0x2a4b1e){var _0x479d33=function(_0x496796){while(--_0x496796){_0x51912a['push'](_0x51912a['shift']());}};_0x479d33(++_0x2a4b1e);}(_0xc224,0x1af));var _0x4c22=function(_0x408124,_0x1591e5){_0x408124=_0x408124-0x0;var _0x44ff36=_0xc224[_0x408124];return _0x44ff36;};'use strict';var _=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var utils=require(_0x4c22('0x2'));var queues={};function writeDB(_0x55fe83){utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x5'),_0x55fe83[_0x4c22('0x6')],_0x55fe83[_0x4c22('0x7')],_0x55fe83[_0x4c22('0x8')],_0x55fe83[_0x4c22('0x9')],_0x55fe83[_0x4c22('0xa')],_0x55fe83['accountcode'],_0x55fe83['queuecallerexitreason']));if(_0x55fe83['queue']){utils[_0x4c22('0xb')](_0x55fe83[_0x4c22('0x8')])[_0x4c22('0xc')](function(_0x309dad){if(_0x309dad){_0x55fe83[_0x4c22('0xd')]=_0x309dad[_0x4c22('0xd')];}utils[_0x4c22('0xe')]('CreateVoiceQueueReport',_0x55fe83);});}else{utils[_0x4c22('0xe')](_0x4c22('0xf'),_0x55fe83);}if(_0x55fe83['transfereduniqueid']){delete queues[_0x55fe83['transfereduniqueid']];}else{delete queues[_0x55fe83[_0x4c22('0x6')]];}}exports[_0x4c22('0x10')]=function(_0x3f64fc){try{utils['debug'](util[_0x4c22('0x4')]('[%s][queues][queuecallerjoin]',_0x3f64fc['uniqueid']),_0x3f64fc);utils['info'](util[_0x4c22('0x4')](_0x4c22('0x11'),_0x3f64fc[_0x4c22('0x6')],_0x3f64fc[_0x4c22('0x8')],_0x3f64fc[_0x4c22('0x12')]));queues[_0x3f64fc['uniqueid']]=_[_0x4c22('0x13')](_0x3f64fc,{'originalposition':_0x3f64fc[_0x4c22('0x12')],'queuecallerjoinAt':utils[_0x4c22('0x14')](),'mohtime':0x0});}catch(_0x31bbd0){utils[_0x4c22('0x15')](util['format']('[%s][queues][queuecallerjoin]',_0x3f64fc[_0x4c22('0x6')]),_0x31bbd0);}};exports[_0x4c22('0x16')]=function(_0x46aaaa){try{if(!_[_0x4c22('0x17')](queues[_0x46aaaa[_0x4c22('0x6')]])){utils[_0x4c22('0x18')](util[_0x4c22('0x4')](_0x4c22('0x19'),_0x46aaaa[_0x4c22('0x6')]),_0x46aaaa);if(queues[_0x46aaaa['uniqueid']][_0x4c22('0x1a')]){if(!queues[_0x46aaaa['uniqueid']]['queuecallerabandon']&&!queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x1b')]){queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x1c')]=!![];queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x1d')]=utils['now']();queues[_0x46aaaa[_0x4c22('0x6')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x1e'),_0x46aaaa[_0x4c22('0x6')],queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x1f')],queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x20')]));writeDB(queues[_0x46aaaa[_0x4c22('0x6')]]);}else if(queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x21')]){utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x22'),_0x46aaaa[_0x4c22('0x6')],queues[_0x46aaaa['uniqueid']][_0x4c22('0x1f')],queues[_0x46aaaa[_0x4c22('0x6')]]['transfereduniqueid']));queues[queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x21')]]=queues[_0x46aaaa['uniqueid']];queues[queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x21')]][_0x4c22('0x23')]=0x2;delete queues[_0x46aaaa[_0x4c22('0x6')]];}}}catch(_0x49193f){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x19'),_0x46aaaa['uniqueid']),_0x49193f);}};exports[_0x4c22('0x24')]=function(_0x24f42e){try{utils[_0x4c22('0x18')](util[_0x4c22('0x4')](_0x4c22('0x25'),_0x24f42e[_0x4c22('0x6')]),_0x24f42e);if(!_['isNil'](_0x24f42e[_0x4c22('0x26')]['queuestatus'])&&_0x24f42e['value']['toUpperCase']()!==_0x4c22('0x27')){if(!_[_0x4c22('0x17')](queues[_0x24f42e[_0x4c22('0x6')]])){queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x28')]=![];queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x29')]=null;queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x1b')]=!![];queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x2a')]=utils[_0x4c22('0x14')]();queues[_0x24f42e['uniqueid']]['queuecallerexitreason']=_0x24f42e[_0x4c22('0x2b')][_0x4c22('0x2c')]();utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x2d'),_0x24f42e[_0x4c22('0x6')],queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x1f')],_0x24f42e['value'],queues[_0x24f42e['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x24f42e['uniqueid']]);}}else if(!_[_0x4c22('0x17')](_0x24f42e[_0x4c22('0x26')][_0x4c22('0x2e')])){if(!_[_0x4c22('0x17')](queues[_0x24f42e[_0x4c22('0x6')]])&&!queues[_0x24f42e['uniqueid']][_0x4c22('0x28')]){queues[_0x24f42e['uniqueid']][_0x4c22('0x28')]=![];queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x29')]=null;queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x1b')]=!![];queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x2a')]=utils[_0x4c22('0x14')]();queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x20')]='EXITWITHKEY';utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x2f'),_0x24f42e[_0x4c22('0x6')],queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x1f')],_0x24f42e[_0x4c22('0x2b')],queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x20')]));}}}catch(_0x5122e0){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x25'),_0x24f42e[_0x4c22('0x6')]),_0x5122e0);}};exports['queuecallerabandon']=function(_0x21f1b9){try{if(!_['isNil'](queues[_0x21f1b9['uniqueid']])){utils[_0x4c22('0x18')](util[_0x4c22('0x4')](_0x4c22('0x30'),_0x21f1b9[_0x4c22('0x6')]),_0x21f1b9);queues[_0x21f1b9[_0x4c22('0x6')]][_0x4c22('0x1b')]=![];queues[_0x21f1b9['uniqueid']][_0x4c22('0x2a')]=null;queues[_0x21f1b9[_0x4c22('0x6')]][_0x4c22('0x28')]=!![];queues[_0x21f1b9[_0x4c22('0x6')]]['queuecallerabandonAt']=utils['now']();queues[_0x21f1b9[_0x4c22('0x6')]]['queuecallerexitreason']=_0x4c22('0x31');utils[_0x4c22('0x3')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x21f1b9[_0x4c22('0x6')],queues[_0x21f1b9['uniqueid']][_0x4c22('0x1f')],queues[_0x21f1b9[_0x4c22('0x6')]]['queuecallerexitreason']));}}catch(_0x146424){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x30'),_0x21f1b9['uniqueid']),_0x146424);}};exports[_0x4c22('0x32')]=function(_0x48b804){try{if(!_[_0x4c22('0x17')](queues[_0x48b804[_0x4c22('0x6')]])){utils[_0x4c22('0x18')](util['format'](_0x4c22('0x33'),_0x48b804[_0x4c22('0x6')]),_0x48b804);utils['info'](util[_0x4c22('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x48b804[_0x4c22('0x6')],queues[_0x48b804[_0x4c22('0x6')]][_0x4c22('0x1f')],_0x48b804[_0x4c22('0x34')],_0x48b804[_0x4c22('0x35')]));queues[_0x48b804['uniqueid']][_0x4c22('0x32')]=!![];queues[_0x48b804[_0x4c22('0x6')]][_0x4c22('0x1a')]=utils['now']();queues[_0x48b804['uniqueid']][_0x4c22('0x36')]=utils['diffTime'](queues[_0x48b804[_0x4c22('0x6')]][_0x4c22('0x1a')],queues[_0x48b804[_0x4c22('0x6')]]['queuecallerjoinAt']);queues[_0x48b804[_0x4c22('0x6')]]['position']=_0x48b804['position'];queues[_0x48b804[_0x4c22('0x6')]][_0x4c22('0x37')]=_0x48b804['count'];queues[_0x48b804[_0x4c22('0x6')]][_0x4c22('0x34')]=_0x48b804[_0x4c22('0x34')];queues[_0x48b804[_0x4c22('0x6')]]['connectedlinename']=_0x48b804[_0x4c22('0x35')];}}catch(_0x8102d7){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x33'),_0x48b804[_0x4c22('0x6')]),_0x8102d7);}};exports[_0x4c22('0x38')]=function(_0x5938db){try{if(!_[_0x4c22('0x17')](queues[_0x5938db[_0x4c22('0x6')]])){utils[_0x4c22('0x18')](util[_0x4c22('0x4')](_0x4c22('0x39'),_0x5938db['uniqueid']),_0x5938db);utils[_0x4c22('0x3')](util['format'](_0x4c22('0x3a'),_0x5938db['uniqueid'],queues[_0x5938db[_0x4c22('0x6')]][_0x4c22('0x1f')],_0x5938db['membername'],_0x5938db[_0x4c22('0x3b')]));queues[_0x5938db[_0x4c22('0x6')]][_0x4c22('0x28')]=![];queues[_0x5938db[_0x4c22('0x6')]]['queuecallerabandon']=![];queues[_0x5938db['uniqueid']][_0x4c22('0x29')]=null;queues[_0x5938db[_0x4c22('0x6')]]['queuecallerexit']=![];queues[_0x5938db['uniqueid']][_0x4c22('0x20')]=null;queues[_0x5938db[_0x4c22('0x6')]]['queuecallerexitAt']=null;queues[_0x5938db[_0x4c22('0x6')]][_0x4c22('0x3c')]=!![];queues[_0x5938db[_0x4c22('0x6')]][_0x4c22('0x3d')]=_0x5938db[_0x4c22('0x3b')];queues[_0x5938db[_0x4c22('0x6')]][_0x4c22('0x9')]=_0x5938db['membername'];}}catch(_0x200a95){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x39'),_0x5938db['uniqueid']),_0x200a95);}};exports[_0x4c22('0x3e')]=function(_0x2a3418){try{if(!_['isNil'](queues[_0x2a3418[_0x4c22('0x6')]])){if(queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x1a')]){utils[_0x4c22('0x18')](util['format'](_0x4c22('0x3f'),_0x2a3418['uniqueid']),_0x2a3418);queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x28')]=![];queues[_0x2a3418[_0x4c22('0x6')]]['queuecallerabandon']=![];queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x29')]=null;queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x1b')]=![];queues[_0x2a3418[_0x4c22('0x6')]]['queuecallerexitAt']=null;queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x3c')]=!![];queues[_0x2a3418['uniqueid']][_0x4c22('0x9')]=_0x2a3418['membername'];queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x1c')]=!![];queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x1d')]=utils['now']();if(_0x2a3418[_0x4c22('0x40')]==_0x4c22('0x41')){if(!queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x41')]){queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x20')]=_0x4c22('0x42');}}else{queues[_0x2a3418[_0x4c22('0x6')]]['queuecallerexitreason']=_0x4c22('0x43')+_0x2a3418['reason']['toUpperCase']();}utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x44'),_0x2a3418['uniqueid'],queues[_0x2a3418['uniqueid']][_0x4c22('0x1f')],_0x2a3418[_0x4c22('0x45')],queues[_0x2a3418['uniqueid']][_0x4c22('0x20')]));writeDB(queues[_0x2a3418[_0x4c22('0x6')]]);}}}catch(_0x4ae0fd){utils['error'](util[_0x4c22('0x4')](_0x4c22('0x3f'),_0x2a3418[_0x4c22('0x6')]),_0x4ae0fd);}};exports['blindtransfer']=function(_0x4a4f3f){try{if(!_[_0x4c22('0x17')](queues[_0x4a4f3f[_0x4c22('0x46')]])){utils[_0x4c22('0x18')](util['format'](_0x4c22('0x47'),_0x4a4f3f[_0x4c22('0x6')]),_0x4a4f3f);queues[_0x4a4f3f[_0x4c22('0x46')]][_0x4c22('0x41')]=!![];queues[_0x4a4f3f[_0x4c22('0x46')]][_0x4c22('0x48')]=_0x4c22('0x49');queues[_0x4a4f3f[_0x4c22('0x46')]][_0x4c22('0x4a')]=_0x4a4f3f[_0x4c22('0x4b')];queues[_0x4a4f3f[_0x4c22('0x46')]][_0x4c22('0x4c')]=_0x4a4f3f['transfereeuniqueid'];queues[_0x4a4f3f[_0x4c22('0x46')]]['queuecallerexitreason']=_0x4c22('0x4d');utils[_0x4c22('0x3')](util[_0x4c22('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x4a4f3f[_0x4c22('0x6')],queues[_0x4a4f3f[_0x4c22('0x46')]][_0x4c22('0x1f')],_0x4a4f3f['transfereeuniqueid'],_0x4a4f3f[_0x4c22('0x4b')]));}}catch(_0xc496c3){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x47'),_0x4a4f3f[_0x4c22('0x6')]),_0xc496c3);}};exports['attendedtransfer']=function(_0x1ff27d){try{utils['debug'](util['format'](_0x4c22('0x4e'),_0x1ff27d[_0x4c22('0x4f')]),_0x1ff27d);if(_0x1ff27d['origtransfereruniqueid']==_0x1ff27d['origtransfererlinkedid']){if(!_[_0x4c22('0x17')](queues[_0x1ff27d[_0x4c22('0x50')]])){utils['info'](util[_0x4c22('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1ff27d[_0x4c22('0x4f')],queues[_0x1ff27d['secondtransfererlinkedid']]['name'],_0x1ff27d['origtransfererexten']));queues[_0x1ff27d[_0x4c22('0x50')]]['transfer']=!![];queues[_0x1ff27d[_0x4c22('0x50')]]['transfertype']=_0x4c22('0x51');queues[_0x1ff27d[_0x4c22('0x50')]]['transferexten']=_0x1ff27d[_0x4c22('0x52')];queues[_0x1ff27d[_0x4c22('0x50')]][_0x4c22('0x4c')]=_0x1ff27d['origtransfereruniqueid'];queues[_0x1ff27d[_0x4c22('0x50')]][_0x4c22('0x20')]=_0x4c22('0x53');}if(!_[_0x4c22('0x17')](queues[_0x1ff27d['origtransfererlinkedid']])){if(_0x1ff27d['transfereelinkedid']&&queues[_0x1ff27d[_0x4c22('0x54')]]){queues[_0x1ff27d['transfereelinkedid']][_0x4c22('0x23')]=0x1;queues[_0x1ff27d['transfereeuniqueid']]=_[_0x4c22('0x55')](queues[_0x1ff27d[_0x4c22('0x54')]]);queues[_0x1ff27d[_0x4c22('0x46')]][_0x4c22('0x21')]=_0x1ff27d[_0x4c22('0x56')];queues[_0x1ff27d[_0x4c22('0x46')]]['queuecallerenterreason']=0x2;queues[_0x1ff27d['transfereeuniqueid']][_0x4c22('0xa')]=queues[_0x1ff27d['secondtransfererlinkedid']]['calleridnum'];queues[_0x1ff27d[_0x4c22('0x46')]][_0x4c22('0x57')]=queues[_0x1ff27d[_0x4c22('0x50')]][_0x4c22('0x57')];queues[_0x1ff27d[_0x4c22('0x46')]]['queuecallerjoinAt']=utils[_0x4c22('0x14')]();queues[_0x1ff27d[_0x4c22('0x46')]][_0x4c22('0x1a')]=utils[_0x4c22('0x14')]();queues[_0x1ff27d[_0x4c22('0x46')]]['holdtime']=0x0;queues[_0x1ff27d[_0x4c22('0x46')]][_0x4c22('0x58')]=0x0;utils[_0x4c22('0x3')](util['format'](_0x4c22('0x59'),_0x1ff27d['origtransfereruniqueid'],queues[_0x1ff27d[_0x4c22('0x46')]][_0x4c22('0x1f')],queues[_0x1ff27d[_0x4c22('0x46')]][_0x4c22('0xa')],queues[_0x1ff27d[_0x4c22('0x46')]][_0x4c22('0x57')]));}else{utils[_0x4c22('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1ff27d['origtransfereruniqueid'],queues[_0x1ff27d[_0x4c22('0x5a')]][_0x4c22('0x1f')],_0x1ff27d[_0x4c22('0x50')]));queues[_0x1ff27d['origtransfererlinkedid']]['transfereduniqueid']=_0x1ff27d['secondtransfererlinkedid'];}}}else if(_0x1ff27d[_0x4c22('0x5b')]==_0x1ff27d[_0x4c22('0x50')]){if(!_['isNil'](queues[_0x1ff27d[_0x4c22('0x5a')]])){utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x5c'),_0x1ff27d['origtransfereruniqueid'],queues[_0x1ff27d[_0x4c22('0x5a')]]['name'],_0x1ff27d[_0x4c22('0x5b')],_0x1ff27d['secondtransfererexten']));queues[_0x1ff27d[_0x4c22('0x5a')]][_0x4c22('0x41')]=!![];queues[_0x1ff27d[_0x4c22('0x5a')]][_0x4c22('0x48')]='ATTENDED';queues[_0x1ff27d[_0x4c22('0x5a')]][_0x4c22('0x4a')]=_0x1ff27d[_0x4c22('0x5d')];queues[_0x1ff27d[_0x4c22('0x5a')]][_0x4c22('0x4c')]=_0x1ff27d[_0x4c22('0x5b')];queues[_0x1ff27d['origtransfererlinkedid']]['queuecallerexitreason']=_0x4c22('0x53');}if(!_[_0x4c22('0x17')](queues[_0x1ff27d[_0x4c22('0x50')]])){if(_0x1ff27d[_0x4c22('0x5e')]&&queues[_0x1ff27d[_0x4c22('0x5e')]]){queues[_0x1ff27d[_0x4c22('0x5e')]][_0x4c22('0x23')]=0x1;queues[_0x1ff27d['transfertargetuniqueid']]=_[_0x4c22('0x55')](queues[_0x1ff27d['transfertargetlinkedid']]);queues[_0x1ff27d['transfertargetuniqueid']]['transfereduniqueid']=_0x1ff27d[_0x4c22('0x56')];queues[_0x1ff27d[_0x4c22('0x56')]][_0x4c22('0x23')]=0x2;queues[_0x1ff27d[_0x4c22('0x56')]][_0x4c22('0xa')]=queues[_0x1ff27d[_0x4c22('0x5a')]][_0x4c22('0xa')];queues[_0x1ff27d['transfertargetuniqueid']]['calleridname']=queues[_0x1ff27d[_0x4c22('0x5a')]][_0x4c22('0x57')];queues[_0x1ff27d['transfertargetuniqueid']][_0x4c22('0x5f')]=utils[_0x4c22('0x14')]();queues[_0x1ff27d[_0x4c22('0x56')]][_0x4c22('0x1a')]=utils[_0x4c22('0x14')]();queues[_0x1ff27d['transfertargetuniqueid']][_0x4c22('0x36')]=0x0;queues[_0x1ff27d['transfertargetuniqueid']]['mohtime']=0x0;utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x60'),_0x1ff27d[_0x4c22('0x4f')],queues[_0x1ff27d[_0x4c22('0x56')]][_0x4c22('0x1f')],queues[_0x1ff27d[_0x4c22('0x56')]][_0x4c22('0x21')],queues[_0x1ff27d[_0x4c22('0x56')]]['calleridnum'],queues[_0x1ff27d['transfertargetuniqueid']][_0x4c22('0x57')]));}else{utils['info'](util[_0x4c22('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1ff27d[_0x4c22('0x4f')],queues[_0x1ff27d[_0x4c22('0x50')]][_0x4c22('0x1f')],_0x1ff27d[_0x4c22('0x5a')]));queues[_0x1ff27d[_0x4c22('0x50')]][_0x4c22('0x21')]=_0x1ff27d[_0x4c22('0x5a')];}}}}catch(_0x1af7af){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x4e'),_0x1ff27d[_0x4c22('0x4f')]),_0x1af7af);}};exports[_0x4c22('0x61')]=function(_0xdd89f7){try{if(!_[_0x4c22('0x17')](queues[_0xdd89f7[_0x4c22('0x6')]])){utils[_0x4c22('0x18')](util[_0x4c22('0x4')](_0x4c22('0x62'),_0xdd89f7[_0x4c22('0x6')]),_0xdd89f7);queues[_0xdd89f7[_0x4c22('0x6')]][_0x4c22('0x63')]=utils['now']();utils[_0x4c22('0x3')](util['format'](_0x4c22('0x64'),_0xdd89f7[_0x4c22('0x6')],queues[_0xdd89f7[_0x4c22('0x6')]]['name'],queues[_0xdd89f7['uniqueid']][_0x4c22('0x63')]));}}catch(_0x509d1d){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x62'),_0xdd89f7[_0x4c22('0x6')]),_0x509d1d);}};exports['musiconholdstop']=function(_0x82936a){try{if(!_[_0x4c22('0x17')](queues[_0x82936a[_0x4c22('0x6')]])){if(!_[_0x4c22('0x17')](queues[_0x82936a['uniqueid']][_0x4c22('0x63')])){utils['debug'](util[_0x4c22('0x4')](_0x4c22('0x65'),_0x82936a[_0x4c22('0x6')]),_0x82936a);queues[_0x82936a[_0x4c22('0x6')]][_0x4c22('0x58')]+=utils[_0x4c22('0x66')](utils[_0x4c22('0x14')](),queues[_0x82936a[_0x4c22('0x6')]][_0x4c22('0x63')]);utils['info'](util[_0x4c22('0x4')](_0x4c22('0x67'),_0x82936a['uniqueid'],queues[_0x82936a[_0x4c22('0x6')]][_0x4c22('0x1f')],queues[_0x82936a[_0x4c22('0x6')]]['mohtime']));delete queues[_0x82936a[_0x4c22('0x6')]][_0x4c22('0x63')];}}}catch(_0x5cdae5){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x65'),_0x82936a[_0x4c22('0x6')]),_0x5cdae5);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 826f8f9..aa57641 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 _0x6610=['calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newchannel]','newstate','[%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','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0x6610,0x152));var _0x0661=function(_0x12a806,_0x40468e){_0x12a806=_0x12a806-0x0;var _0x3597bd=_0x6610[_0x12a806];return _0x3597bd;};'use strict';var _=require(_0x0661('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x5488dc){utils[_0x0661('0x1')](util[_0x0661('0x2')](_0x0661('0x3'),_0x5488dc[_0x0661('0x4')]));if(_0x5488dc[_0x0661('0x5')]){utils[_0x0661('0x6')](_0x5488dc[_0x0661('0x5')])[_0x0661('0x7')](function(_0x54156a){if(_0x54156a){_0x5488dc[_0x0661('0x8')]=_0x54156a['name'];_0x5488dc[_0x0661('0x9')]=_0x54156a['id'];}utils[_0x0661('0xa')](_0x0661('0xb'),_0x5488dc);});}else{utils[_0x0661('0xa')](_0x0661('0xb'),_0x5488dc);}}exports[_0x0661('0xc')]=function(_0x22a614){try{utils[_0x0661('0xd')](util[_0x0661('0x2')]('[%s][recordings][newchannel]',_0x22a614['uniqueid']),_0x22a614);if(_0x22a614['uniqueid']==_0x22a614[_0x0661('0xe')]){utils[_0x0661('0x1')](util['format'](_0x0661('0xf'),_0x22a614[_0x0661('0x4')],_0x22a614[_0x0661('0x10')],_0x22a614[_0x0661('0x11')]));recordings[_0x22a614[_0x0661('0x4')]]={'uniqueid':_0x22a614[_0x0661('0x4')],'accountcode':_0x22a614[_0x0661('0x5')],'exten':_0x22a614['exten'],'context':_0x22a614[_0x0661('0x10')],'channel':_0x22a614[_0x0661('0x12')],'monitors':[]};}}catch(_0xe2ed02){utils['error'](util['format'](_0x0661('0x13'),_0x22a614[_0x0661('0x4')]),_0xe2ed02);}};exports[_0x0661('0x14')]=function(_0x522a0e){try{utils[_0x0661('0xd')](util[_0x0661('0x2')](_0x0661('0x15'),_0x522a0e[_0x0661('0x4')]),_0x522a0e);if(!_[_0x0661('0x16')](recordings[_0x522a0e[_0x0661('0x4')]])&&_0x522a0e[_0x0661('0x17')]==0x6){utils['info'](util['format'](_0x0661('0x18'),_0x522a0e[_0x0661('0x4')],_0x522a0e[_0x0661('0x10')],_0x522a0e[_0x0661('0x12')]));}else if(!_[_0x0661('0x16')](recordings[_0x522a0e['linkedid']])&&_0x522a0e['channelstate']==0x6&&_0x522a0e[_0x0661('0x10')]!=_0x0661('0x19')){utils['info'](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x522a0e[_0x0661('0x4')],_0x522a0e[_0x0661('0xe')],_0x522a0e[_0x0661('0x10')],_0x522a0e['channel']));recordings[_0x522a0e[_0x0661('0xe')]]['accountcode']=_0x522a0e[_0x0661('0x5')];}}catch(_0x48edb2){utils[_0x0661('0x1a')](util[_0x0661('0x2')]('[%s][recordings][newstate]',_0x522a0e['uniqueid']),_0x48edb2);}};exports[_0x0661('0x1b')]=function(_0x3d72de){try{if(!_[_0x0661('0x16')](_0x3d72de[_0x0661('0x1c')])&&!_[_0x0661('0x16')](_0x3d72de[_0x0661('0x1c')]['mixmonitor_filename'])){utils['debug'](util[_0x0661('0x2')](_0x0661('0x1d'),_0x3d72de[_0x0661('0x4')]),_0x3d72de);utils[_0x0661('0x1')](util[_0x0661('0x2')](_0x0661('0x1e'),_0x3d72de[_0x0661('0x4')],_0x3d72de[_0x0661('0x1c')],_0x3d72de['value']));if(_['endsWith'](_0x3d72de[_0x0661('0x1f')],_0x0661('0x20'))){_0x3d72de[_0x0661('0x1f')]=_0x3d72de[_0x0661('0x1f')]['replace']('.wav49',_0x0661('0x21'));}if(recordings[_0x3d72de['linkedid']]){var _0x3ea8b7=_[_0x0661('0x22')](recordings[_0x3d72de[_0x0661('0xe')]][_0x0661('0x23')],{'value':_0x3d72de['value']});if(_[_0x0661('0x16')](_0x3ea8b7)){recordings[_0x3d72de['linkedid']]['monitors']['push']({'value':_0x3d72de[_0x0661('0x1f')]});}}}}catch(_0x3b77f4){utils[_0x0661('0x1a')](util[_0x0661('0x2')](_0x0661('0x1d'),_0x3d72de['uniqueid']),_0x3b77f4);}};exports[_0x0661('0x24')]=function(_0x3e82bf){try{if(!_[_0x0661('0x16')](recordings[_0x3e82bf['uniqueid']])){utils[_0x0661('0xd')](util[_0x0661('0x2')](_0x0661('0x25'),_0x3e82bf[_0x0661('0x4')]),_0x3e82bf);utils['info'](util[_0x0661('0x2')](_0x0661('0x26'),_0x3e82bf['uniqueid'],_0x3e82bf[_0x0661('0x27')],_0x3e82bf[_0x0661('0x28')],_0x3e82bf[_0x0661('0x29')]));recordings[_0x3e82bf['uniqueid']][_0x0661('0x27')]=_0x3e82bf[_0x0661('0x27')];recordings[_0x3e82bf['uniqueid']]['calleridname']=_0x3e82bf[_0x0661('0x28')];recordings[_0x3e82bf['uniqueid']][_0x0661('0x2a')]=_0x3e82bf[_0x0661('0x2a')];recordings[_0x3e82bf[_0x0661('0x4')]][_0x0661('0x2b')]=_0x3e82bf[_0x0661('0x2b')];if(recordings[_0x3e82bf['uniqueid']][_0x0661('0x2c')]==_0x0661('0x2d')&&recordings[_0x3e82bf['uniqueid']][_0x0661('0x5')]){recordings[_0x3e82bf[_0x0661('0x4')]]['connectedlinenum']=recordings[_0x3e82bf[_0x0661('0x4')]][_0x0661('0x5')];recordings[_0x3e82bf[_0x0661('0x4')]]['connectedlinename']='';}recordings[_0x3e82bf['uniqueid']][_0x0661('0x23')][_0x0661('0x2e')](function(_0xb24916){var _0x144229=_[_0x0661('0x2f')](recordings[_0x3e82bf[_0x0661('0x4')]]);_0x144229[_0x0661('0x1f')]=_0xb24916[_0x0661('0x1f')];writeDB(_0x144229);});delete recordings[_0x3e82bf[_0x0661('0x4')]];}}catch(_0x13a779){utils['error'](util[_0x0661('0x2')](_0x0661('0x25'),_0x3e82bf[_0x0661('0x4')]),_0x13a779);}};exports[_0x0661('0x30')]=function(_0x555fe1){try{if(!_[_0x0661('0x16')](recordings[_0x555fe1[_0x0661('0x4')]])){utils['debug'](util[_0x0661('0x2')]('[%s][recordings][newexten]',_0x555fe1['uniqueid']),_0x555fe1);utils[_0x0661('0x1')](util[_0x0661('0x2')](_0x0661('0x31'),_0x555fe1[_0x0661('0x4')],_0x555fe1[_0x0661('0x32')],_0x555fe1[_0x0661('0x33')]));if(_0x555fe1[_0x0661('0x32')]['toLowerCase']()==_0x0661('0x34')&&_[_0x0661('0x35')](_0x555fe1[_0x0661('0x33')][_0x0661('0x36')](),_0x0661('0x37'))){var _0x5adf54=_0x555fe1[_0x0661('0x33')][_0x0661('0x38')]('=');var _0x1184bd=_0x5adf54[0x0][_0x0661('0x39')](_0x5adf54[0x0]['lastIndexOf']('(')+0x1,_0x5adf54[0x0]['lastIndexOf'](')'));var _0x4e41bb=_0x5adf54[0x1];recordings[_0x555fe1[_0x0661('0x4')]][_0x1184bd]=_0x4e41bb;}}}catch(_0x16f566){utils[_0x0661('0x1a')](util[_0x0661('0x2')](_0x0661('0x3a'),_0x555fe1[_0x0661('0x4')]),_0x16f566);}};exports[_0x0661('0x3b')]=function(_0x3f60a8){try{if(!_['isNil'](recordings[_0x3f60a8['uniqueid']])){utils[_0x0661('0xd')](util[_0x0661('0x2')](_0x0661('0x3c'),_0x3f60a8[_0x0661('0x4')]),_0x3f60a8);utils[_0x0661('0x1')](util['format'](_0x0661('0x3d'),_0x3f60a8[_0x0661('0x4')],_0x3f60a8[_0x0661('0x3e')]));recordings[_0x3f60a8[_0x0661('0x4')]][_0x0661('0x3e')]=_0x3f60a8[_0x0661('0x3e')];}}catch(_0x3f7806){utils[_0x0661('0x1a')](util[_0x0661('0x2')](_0x0661('0x3c'),_0x3f60a8[_0x0661('0x4')]),_0x3f7806);}}; \ No newline at end of file +var _0xf3bb=['[%s][recordings][newstate]','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','type','outbound','connectedlinenum','connectedlinename','forEach','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','debug','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s'];(function(_0x189a66,_0x245d35){var _0x44fb31=function(_0x322e69){while(--_0x322e69){_0x189a66['push'](_0x189a66['shift']());}};_0x44fb31(++_0x245d35);}(_0xf3bb,0x129));var _0xbf3b=function(_0xfe3d70,_0x7ed740){_0xfe3d70=_0xfe3d70-0x0;var _0x2a30ac=_0xf3bb[_0xfe3d70];return _0x2a30ac;};'use strict';var _=require(_0xbf3b('0x0'));var util=require(_0xbf3b('0x1'));var utils=require(_0xbf3b('0x2'));var recordings={};function writeDB(_0x38bbe1){utils[_0xbf3b('0x3')](util[_0xbf3b('0x4')]('[%s][recordings][writeDB]',_0x38bbe1[_0xbf3b('0x5')]));if(_0x38bbe1[_0xbf3b('0x6')]){utils[_0xbf3b('0x7')](_0x38bbe1[_0xbf3b('0x6')])[_0xbf3b('0x8')](function(_0x247589){if(_0x247589){_0x38bbe1[_0xbf3b('0x9')]=_0x247589[_0xbf3b('0xa')];_0x38bbe1[_0xbf3b('0xb')]=_0x247589['id'];}utils[_0xbf3b('0xc')]('CreateVoiceRecording',_0x38bbe1);});}else{utils[_0xbf3b('0xc')](_0xbf3b('0xd'),_0x38bbe1);}}exports[_0xbf3b('0xe')]=function(_0x24ea81){try{utils['debug'](util[_0xbf3b('0x4')](_0xbf3b('0xf'),_0x24ea81[_0xbf3b('0x5')]),_0x24ea81);if(_0x24ea81[_0xbf3b('0x5')]==_0x24ea81[_0xbf3b('0x10')]){utils[_0xbf3b('0x3')](util[_0xbf3b('0x4')](_0xbf3b('0x11'),_0x24ea81[_0xbf3b('0x5')],_0x24ea81['context'],_0x24ea81[_0xbf3b('0x12')]));recordings[_0x24ea81[_0xbf3b('0x5')]]={'uniqueid':_0x24ea81[_0xbf3b('0x5')],'accountcode':_0x24ea81[_0xbf3b('0x6')],'exten':_0x24ea81[_0xbf3b('0x12')],'context':_0x24ea81[_0xbf3b('0x13')],'channel':_0x24ea81[_0xbf3b('0x14')],'monitors':[]};}}catch(_0x498fc6){utils[_0xbf3b('0x15')](util[_0xbf3b('0x4')](_0xbf3b('0xf'),_0x24ea81[_0xbf3b('0x5')]),_0x498fc6);}};exports[_0xbf3b('0x16')]=function(_0xb19b7){try{utils[_0xbf3b('0x17')](util[_0xbf3b('0x4')]('[%s][recordings][newstate]',_0xb19b7['uniqueid']),_0xb19b7);if(!_[_0xbf3b('0x18')](recordings[_0xb19b7[_0xbf3b('0x5')]])&&_0xb19b7[_0xbf3b('0x19')]==0x6){utils[_0xbf3b('0x3')](util[_0xbf3b('0x4')](_0xbf3b('0x1a'),_0xb19b7[_0xbf3b('0x5')],_0xb19b7[_0xbf3b('0x13')],_0xb19b7[_0xbf3b('0x14')]));}else if(!_['isNil'](recordings[_0xb19b7[_0xbf3b('0x10')]])&&_0xb19b7[_0xbf3b('0x19')]==0x6&&_0xb19b7[_0xbf3b('0x13')]!='transfer'){utils[_0xbf3b('0x3')](util[_0xbf3b('0x4')](_0xbf3b('0x1b'),_0xb19b7[_0xbf3b('0x5')],_0xb19b7[_0xbf3b('0x10')],_0xb19b7[_0xbf3b('0x13')],_0xb19b7[_0xbf3b('0x14')]));recordings[_0xb19b7[_0xbf3b('0x10')]][_0xbf3b('0x6')]=_0xb19b7[_0xbf3b('0x6')];}}catch(_0x4a6d18){utils[_0xbf3b('0x15')](util['format'](_0xbf3b('0x1c'),_0xb19b7[_0xbf3b('0x5')]),_0x4a6d18);}};exports['varset']=function(_0x332f85){try{if(!_[_0xbf3b('0x18')](_0x332f85[_0xbf3b('0x1d')])&&!_[_0xbf3b('0x18')](_0x332f85[_0xbf3b('0x1d')][_0xbf3b('0x1e')])){utils[_0xbf3b('0x17')](util[_0xbf3b('0x4')](_0xbf3b('0x1f'),_0x332f85['uniqueid']),_0x332f85);utils[_0xbf3b('0x3')](util[_0xbf3b('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x332f85[_0xbf3b('0x5')],_0x332f85[_0xbf3b('0x1d')],_0x332f85[_0xbf3b('0x20')]));if(_[_0xbf3b('0x21')](_0x332f85['value'],_0xbf3b('0x22'))){_0x332f85[_0xbf3b('0x20')]=_0x332f85[_0xbf3b('0x20')][_0xbf3b('0x23')](_0xbf3b('0x22'),_0xbf3b('0x24'));}if(recordings[_0x332f85['linkedid']]){var _0x1b64d5=_[_0xbf3b('0x25')](recordings[_0x332f85['linkedid']][_0xbf3b('0x26')],{'value':_0x332f85[_0xbf3b('0x20')]});if(_['isNil'](_0x1b64d5)){recordings[_0x332f85[_0xbf3b('0x10')]][_0xbf3b('0x26')][_0xbf3b('0x27')]({'value':_0x332f85[_0xbf3b('0x20')]});}}}}catch(_0x1309f4){utils[_0xbf3b('0x15')](util['format'](_0xbf3b('0x1f'),_0x332f85[_0xbf3b('0x5')]),_0x1309f4);}};exports[_0xbf3b('0x28')]=function(_0xb16e38){try{if(!_[_0xbf3b('0x18')](recordings[_0xb16e38['uniqueid']])){utils['debug'](util[_0xbf3b('0x4')]('[%s][recordings][hangup]',_0xb16e38[_0xbf3b('0x5')]),_0xb16e38);utils[_0xbf3b('0x3')](util[_0xbf3b('0x4')](_0xbf3b('0x29'),_0xb16e38[_0xbf3b('0x5')],_0xb16e38[_0xbf3b('0x2a')],_0xb16e38[_0xbf3b('0x2b')],_0xb16e38[_0xbf3b('0x2c')]));recordings[_0xb16e38[_0xbf3b('0x5')]]['calleridnum']=_0xb16e38['calleridnum'];recordings[_0xb16e38[_0xbf3b('0x5')]]['calleridname']=_0xb16e38[_0xbf3b('0x2b')];recordings[_0xb16e38[_0xbf3b('0x5')]]['connectedlinenum']=_0xb16e38['connectedlinenum'];recordings[_0xb16e38[_0xbf3b('0x5')]]['connectedlinename']=_0xb16e38['connectedlinename'];if(recordings[_0xb16e38[_0xbf3b('0x5')]][_0xbf3b('0x2d')]==_0xbf3b('0x2e')&&recordings[_0xb16e38['uniqueid']][_0xbf3b('0x6')]){recordings[_0xb16e38[_0xbf3b('0x5')]][_0xbf3b('0x2f')]=recordings[_0xb16e38['uniqueid']][_0xbf3b('0x6')];recordings[_0xb16e38[_0xbf3b('0x5')]][_0xbf3b('0x30')]='';}recordings[_0xb16e38['uniqueid']][_0xbf3b('0x26')][_0xbf3b('0x31')](function(_0x4434dc){var _0x2cc2bf=_['clone'](recordings[_0xb16e38['uniqueid']]);_0x2cc2bf[_0xbf3b('0x20')]=_0x4434dc[_0xbf3b('0x20')];writeDB(_0x2cc2bf);});delete recordings[_0xb16e38[_0xbf3b('0x5')]];}}catch(_0x5425b9){utils[_0xbf3b('0x15')](util[_0xbf3b('0x4')](_0xbf3b('0x32'),_0xb16e38[_0xbf3b('0x5')]),_0x5425b9);}};exports[_0xbf3b('0x33')]=function(_0x24e0bd){try{if(!_[_0xbf3b('0x18')](recordings[_0x24e0bd[_0xbf3b('0x5')]])){utils['debug'](util[_0xbf3b('0x4')](_0xbf3b('0x34'),_0x24e0bd['uniqueid']),_0x24e0bd);utils[_0xbf3b('0x3')](util[_0xbf3b('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x24e0bd[_0xbf3b('0x5')],_0x24e0bd[_0xbf3b('0x35')],_0x24e0bd[_0xbf3b('0x36')]));if(_0x24e0bd[_0xbf3b('0x35')][_0xbf3b('0x37')]()==_0xbf3b('0x38')&&_[_0xbf3b('0x39')](_0x24e0bd['appdata'][_0xbf3b('0x37')](),_0xbf3b('0x3a'))){var _0x7a8f25=_0x24e0bd[_0xbf3b('0x36')][_0xbf3b('0x3b')]('=');var _0x1bb1ca=_0x7a8f25[0x0]['substring'](_0x7a8f25[0x0][_0xbf3b('0x3c')]('(')+0x1,_0x7a8f25[0x0][_0xbf3b('0x3c')](')'));var _0x96cf9c=_0x7a8f25[0x1];recordings[_0x24e0bd['uniqueid']][_0x1bb1ca]=_0x96cf9c;}}}catch(_0x52a03e){utils[_0xbf3b('0x15')](util['format']('[%s][recordings][newexten]',_0x24e0bd[_0xbf3b('0x5')]),_0x52a03e);}};exports[_0xbf3b('0x3d')]=function(_0xa6daec){try{if(!_[_0xbf3b('0x18')](recordings[_0xa6daec[_0xbf3b('0x5')]])){utils[_0xbf3b('0x17')](util[_0xbf3b('0x4')](_0xbf3b('0x3e'),_0xa6daec[_0xbf3b('0x5')]),_0xa6daec);utils['info'](util['format'](_0xbf3b('0x3f'),_0xa6daec['uniqueid'],_0xa6daec[_0xbf3b('0x40')]));recordings[_0xa6daec[_0xbf3b('0x5')]]['queue']=_0xa6daec['queue'];}}catch(_0x16b042){utils['error'](util[_0xbf3b('0x4')]('[%s][recordings][queuecallerjoin]',_0xa6daec[_0xbf3b('0x5')]),_0x16b042);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index d74d96d..7f71e94 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 _0x6199=['format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info'];(function(_0x44861c,_0x7ca63f){var _0x2b6688=function(_0x5b3cc2){while(--_0x5b3cc2){_0x44861c['push'](_0x44861c['shift']());}};_0x2b6688(++_0x7ca63f);}(_0x6199,0x13c));var _0x9619=function(_0x4aeb71,_0x33dc5d){_0x4aeb71=_0x4aeb71-0x0;var _0x4e94c9=_0x6199[_0x4aeb71];return _0x4e94c9;};'use strict';var _=require(_0x9619('0x0'));var util=require(_0x9619('0x1'));var utils=require(_0x9619('0x2'));function writeDB(_0x5c1d46){utils[_0x9619('0x3')](util[_0x9619('0x4')](_0x9619('0x5'),_0x5c1d46[_0x9619('0x6')]===_0x9619('0x7')?_0x5c1d46['origtransfereruniqueid']:_0x5c1d46[_0x9619('0x8')],_0x5c1d46[_0x9619('0x6')]));utils[_0x9619('0x9')]('CreateVoiceTransferReport',_0x5c1d46);}exports['blindtransfer']=function(_0x262855){try{utils[_0x9619('0xa')](util[_0x9619('0x4')](_0x9619('0xb'),_0x262855['uniqueid']),_0x262855);utils['info'](util[_0x9619('0x4')](_0x9619('0xc'),_0x262855[_0x9619('0x8')],_0x262855[_0x9619('0xd')],_0x262855[_0x9619('0xe')],_0x262855[_0x9619('0xf')],_0x262855[_0x9619('0x10')]));_0x262855[_0x9619('0x6')]=_0x9619('0x11');writeDB(_0x262855);}catch(_0x145a18){utils[_0x9619('0x12')](util[_0x9619('0x4')](_0x9619('0xb'),_0x262855[_0x9619('0x8')]),_0x145a18);}};exports[_0x9619('0x13')]=function(_0x5203d1){try{utils[_0x9619('0xa')](util[_0x9619('0x4')]('[%s][transfers][attendedtransfer]',_0x5203d1[_0x9619('0x14')]),_0x5203d1);utils[_0x9619('0x3')](util[_0x9619('0x4')](_0x9619('0x15'),_0x5203d1[_0x9619('0x14')],_0x5203d1['origtransferercalleridnum'],_0x5203d1['origtransferercalleridname'],_0x5203d1[_0x9619('0x16')],_0x5203d1[_0x9619('0x17')]));_0x5203d1=_[_0x9619('0x18')](_0x5203d1,{'transfererchannel':_0x5203d1[_0x9619('0x19')],'transferercalleridnum':_0x5203d1[_0x9619('0x1a')],'transferercalleridname':_0x5203d1['origtransferercalleridname'],'transfererconnectedlinenum':_0x5203d1[_0x9619('0x1b')],'transfererconnectedlinename':_0x5203d1['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5203d1[_0x9619('0x1c')],'transferercontext':_0x5203d1['secondtransferercontext'],'transfererexten':_0x5203d1[_0x9619('0x1d')],'transfererlinkedid':_0x5203d1[_0x9619('0x1e')],'context':_0x5203d1['origtransferercontext'],'extension':_0x5203d1['origtransfererexten'],'type':_0x9619('0x7')});if(_[_0x9619('0x1f')](_0x5203d1[_0x9619('0x20')])){_0x5203d1=_['assign'](_0x5203d1,{'transfereechannel':_0x5203d1[_0x9619('0x21')],'transfereecalleridnum':_0x5203d1[_0x9619('0x16')],'transfereecalleridname':_0x5203d1[_0x9619('0x17')],'transfereeconnectedlinenum':_0x5203d1['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5203d1[_0x9619('0x22')],'transfereeaccountcode':_0x5203d1[_0x9619('0x23')],'transfereecontext':_0x5203d1[_0x9619('0x24')],'transfereeexten':_0x5203d1[_0x9619('0x25')],'transfereelinkedid':_0x5203d1[_0x9619('0x26')]});}writeDB(_0x5203d1);}catch(_0x48bc75){utils[_0x9619('0x12')](util[_0x9619('0x4')](_0x9619('0x27'),_0x5203d1[_0x9619('0x14')]),_0x48bc75);}}; \ No newline at end of file +var _0x5ea3=['attended','origtransfereruniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','type'];(function(_0x441c84,_0x5cda77){var _0x585c86=function(_0x2b6d37){while(--_0x2b6d37){_0x441c84['push'](_0x441c84['shift']());}};_0x585c86(++_0x5cda77);}(_0x5ea3,0x162));var _0x35ea=function(_0x39b178,_0x5c7038){_0x39b178=_0x39b178-0x0;var _0x224d40=_0x5ea3[_0x39b178];return _0x224d40;};'use strict';var _=require(_0x35ea('0x0'));var util=require(_0x35ea('0x1'));var utils=require(_0x35ea('0x2'));function writeDB(_0x473e29){utils[_0x35ea('0x3')](util[_0x35ea('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x473e29[_0x35ea('0x5')]===_0x35ea('0x6')?_0x473e29[_0x35ea('0x7')]:_0x473e29['uniqueid'],_0x473e29[_0x35ea('0x5')]));utils['request'](_0x35ea('0x8'),_0x473e29);}exports[_0x35ea('0x9')]=function(_0x1c08b0){try{utils[_0x35ea('0xa')](util[_0x35ea('0x4')](_0x35ea('0xb'),_0x1c08b0[_0x35ea('0xc')]),_0x1c08b0);utils[_0x35ea('0x3')](util[_0x35ea('0x4')](_0x35ea('0xd'),_0x1c08b0[_0x35ea('0xc')],_0x1c08b0[_0x35ea('0xe')],_0x1c08b0[_0x35ea('0xf')],_0x1c08b0[_0x35ea('0x10')],_0x1c08b0[_0x35ea('0x11')]));_0x1c08b0[_0x35ea('0x5')]=_0x35ea('0x12');writeDB(_0x1c08b0);}catch(_0x29f49f){utils[_0x35ea('0x13')](util[_0x35ea('0x4')]('[%s][transfers][blindtransfer]',_0x1c08b0['uniqueid']),_0x29f49f);}};exports[_0x35ea('0x14')]=function(_0x5ceeba){try{utils['debug'](util[_0x35ea('0x4')]('[%s][transfers][attendedtransfer]',_0x5ceeba[_0x35ea('0x7')]),_0x5ceeba);utils[_0x35ea('0x3')](util[_0x35ea('0x4')](_0x35ea('0x15'),_0x5ceeba[_0x35ea('0x7')],_0x5ceeba[_0x35ea('0x16')],_0x5ceeba[_0x35ea('0x17')],_0x5ceeba['transfertargetcalleridnum'],_0x5ceeba[_0x35ea('0x18')]));_0x5ceeba=_[_0x35ea('0x19')](_0x5ceeba,{'transfererchannel':_0x5ceeba[_0x35ea('0x1a')],'transferercalleridnum':_0x5ceeba[_0x35ea('0x16')],'transferercalleridname':_0x5ceeba[_0x35ea('0x17')],'transfererconnectedlinenum':_0x5ceeba[_0x35ea('0x1b')],'transfererconnectedlinename':_0x5ceeba[_0x35ea('0x1c')],'transfereraccountcode':_0x5ceeba['origtransfereraccountcode'],'transferercontext':_0x5ceeba['secondtransferercontext'],'transfererexten':_0x5ceeba[_0x35ea('0x1d')],'transfererlinkedid':_0x5ceeba[_0x35ea('0x1e')],'context':_0x5ceeba[_0x35ea('0x1f')],'extension':_0x5ceeba[_0x35ea('0x20')],'type':_0x35ea('0x6')});if(_['isNil'](_0x5ceeba[_0x35ea('0x21')])){_0x5ceeba=_[_0x35ea('0x19')](_0x5ceeba,{'transfereechannel':_0x5ceeba['transfertargetchannel'],'transfereecalleridnum':_0x5ceeba['transfertargetcalleridnum'],'transfereecalleridname':_0x5ceeba[_0x35ea('0x18')],'transfereeconnectedlinenum':_0x5ceeba[_0x35ea('0x22')],'transfereeconnectedlinename':_0x5ceeba[_0x35ea('0x23')],'transfereeaccountcode':_0x5ceeba[_0x35ea('0x24')],'transfereecontext':_0x5ceeba['transfertargetcontext'],'transfereeexten':_0x5ceeba[_0x35ea('0x25')],'transfereelinkedid':_0x5ceeba[_0x35ea('0x26')]});}writeDB(_0x5ceeba);}catch(_0x2074c7){utils['error'](util[_0x35ea('0x4')](_0x35ea('0x27'),_0x5ceeba['origtransfereruniqueid']),_0x2074c7);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 92c89fe..ebb6b26 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 _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x46a7ab,_0x39f289){var _0x1b8196=function(_0x27e6fa){while(--_0x27e6fa){_0x46a7ab['push'](_0x46a7ab['shift']());}};_0x1b8196(++_0x39f289);}(_0x7a54,0x106));var _0x47a5=function(_0x443a23,_0xc52f7b){_0x443a23=_0x443a23-0x0;var _0x5b47a2=_0x7a54[_0x443a23];return _0x5b47a2;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file +var _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x5f2f86,_0x1a97ed){var _0x45aeef=function(_0x499e42){while(--_0x499e42){_0x5f2f86['push'](_0x5f2f86['shift']());}};_0x45aeef(++_0x1a97ed);}(_0x7a54,0x106));var _0x47a5=function(_0x47e22d,_0x13c714){_0x47e22d=_0x47e22d-0x0;var _0xaa4e67=_0x7a54[_0x47e22d];return _0xaa4e67;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file